import React from 'react' ; import FormControl from '@material-ui/core/FormControl' ; import Input from '@material-ui/core/Input' ; import InputLabel from '@material-ui/core/InputLabel' ; import { WidgetProps } from 'react-jsonschema-form' ; const UpDownWidget = ( { id , required , readonly , disabled , label , value , onChange , onBlur , onFocus , autofocus , } ) => { const _onChange = ( { target : { value } , } ) => onChange ( value ) ; const _onBlur = ( { target : { value } } ) => onBlur ( id , value ) ; const _onFocus = ( { target : { value } , } ) => onFocus ( id , value ) ; return ( < FormControl fullWidth = { true } required = { required } > < InputLabel > { label } < /InputLabel> < Input id = { id } autoFocus = { autofocus } required = { required } type = "number" disabled = { disabled || readonly } name = { name } value = { value ? value : '' } onChange = { _onChange } onBlur = { _onBlur } onFocus = { _onFocus } / > < /FormControl>); } ; export default UpDownWidget ;