diff --git a/src/Components/Input/Number/index.jsx b/src/Components/Input/Number/index.jsx index 6764f84fe..d121aff88 100644 --- a/src/Components/Input/Number/index.jsx +++ b/src/Components/Input/Number/index.jsx @@ -4,9 +4,12 @@ import React, { useState, } from 'react'; -import Info from '../Info'; +import FormControl from '@mui/material/FormControl'; +import Grid from '@mui/material/Grid'; +import Input from '@mui/material/Input'; +import Typography from '@mui/material/Typography'; -import './style.scss'; +import Info from '../Info'; function Number({ name, @@ -22,7 +25,8 @@ function Number({ hint, disabled, }) { - const [displayValue, setDisplayValue] = useState(value * factor + offset); + const calculated = Math.round(value * factor + offset); + const [displayValue, setDisplayValue] = useState(calculated); const updateValue = useCallback(() => { let value = displayValue; @@ -36,11 +40,12 @@ function Number({ value = (max - offset) / factor; } - value = Math.round(value); if(isNaN(value)) { value = (min - offset) / factor; } + value = Math.round(value); + setDisplayValue(value * factor + offset); onChange(name, value); }, [displayValue, offset, factor, min, max, onChange, name]); @@ -51,11 +56,22 @@ function Number({ }, []); return ( -