File tree Expand file tree Collapse file tree 1 file changed +4
-7
lines changed
web-components/src/components/inputs/new/EditableInput Expand file tree Collapse file tree 1 file changed +4
-7
lines changed Original file line number Diff line number Diff line change @@ -43,15 +43,12 @@ export const EditableInput = ({
4343 const [ currentValue , setCurrentValue ] = useState ( value ) ;
4444 const [ decimalSeparator , setDecimalSeparator ] = useState ( '.' ) ;
4545 const wrapperRef = useRef ( null ) ;
46+ const formattedValue = + currentValue . replace ( '.' , ',' ) ;
4647
47- const amountValid =
48- + currentValue . replace ( / , / g, '.' ) <= maxValue &&
49- + currentValue . replace ( / , / g, '.' ) > 0 ;
48+ const amountValid = formattedValue <= maxValue && formattedValue > 0 ;
5049
5150 const isUpdateDisabled =
52- ! amountValid ||
53- error ?. hasError ||
54- + initialValue === + currentValue . replace ( / , / g, '.' ) ;
51+ ! amountValid || error ?. hasError || + initialValue === formattedValue ;
5552
5653 useEffect ( ( ) => {
5754 setInitialValue ( value ) ;
@@ -112,7 +109,7 @@ export const EditableInput = ({
112109
113110 const handleOnUpdate = ( ) => {
114111 if ( isUpdateDisabled ) return ;
115- onChange ( + currentValue . replace ( / , / g , '.' ) ) ;
112+ onChange ( formattedValue ) ;
116113 toggleEditable ( ) ;
117114 } ;
118115
You can’t perform that action at this time.
0 commit comments