import * as React from 'react' ; import InputNumber from '@synerise/ds-input-number' ; import { debounce } from 'lodash' ; import { InputProps } from '../../Factors.types' ; const NumberInput = ( { value , onChange , texts , opened } ) => { const [ localValue , setLocalValue ] = React . useState < string | number | undefined > ( value as number ) ; const onChangeValueDebounce = React . useCallback ( debounce ( onChange , 300 ) , [ onChange ] ) ; const handleChange = ( val ) : void => { setLocalValue ( val ) ; onChangeValueDebounce ( val ) ; } ; React . useEffect ( ( ) => { setLocalValue ( value as number ) ; } , [ value ] ) ; return ( < InputNumber autoFocus = { opened } placeholder = { texts . valuePlaceholder } value = { localValue as number } onChange = { handleChange } / > ) ; } ; export default NumberInput ;