import type { FormContextType, RJSFSchema, StrictRJSFSchema, WidgetProps } from '@rjsf/utils'; import { ariaDescribedByIds, getInputProps } from '@rjsf/utils'; import type { InputNumberChangeEvent } from 'primereact/inputnumber'; import { InputNumber } 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 handleChange = (event: InputNumberChangeEvent) => onChange(event.value === null ? options.emptyValue : value); const handleBlur = () => onBlur && onBlur(id, value); const handleFocus = () => onFocus && onFocus(id, value); return ( 0} onChange={onChangeOverride || handleChange} onBlur={handleBlur} onFocus={handleFocus} aria-describedby={ariaDescribedByIds(id, !!schema.examples)} /> ); }