import { ariaDescribedByIds, FormContextType, getInputProps, RJSFSchema, StrictRJSFSchema, WidgetProps, } from '@snups/rjsf-utils'; import { InputNumber, InputNumberChangeEvent } from 'primereact/inputnumber'; /** The `UpDownWidget` renders an input component for a number. * * @param props - The `WidgetProps` for this component */ export default function UpDownWidget( props: WidgetProps, ) { const { id, placeholder, value, required, readonly, disabled, onChange, onChangeOverride, onBlur, onFocus, autofocus, options, schema, type, rawErrors = [], } = props; const inputProps = getInputProps(schema, type, options); const { showButtons, buttonLayout, useGrouping, minFractionDigits, maxFractionDigits, locale, currency } = options; const primeProps = (options.prime || {}) as object; const _onChange = (event: InputNumberChangeEvent) => onChange(event.value === null ? options.emptyValue : value); const _onBlur = () => onBlur && onBlur(id, value); const _onFocus = () => onFocus && onFocus(id, value); return ( 0} onChange={(onChangeOverride as any) || _onChange} onBlur={_onBlur} onFocus={_onFocus} aria-describedby={ariaDescribedByIds(id, !!schema.examples)} /> ); }