import React from 'react'; import { type Control, Controller, type FieldValues } from 'react-hook-form'; import { type NumberInputProps } from '@carbon/react/lib/components/NumberInput/NumberInput'; import { NumberInput } from '@carbon/react'; import { type StockItemPackagingUOMDTO } from '../../api/types/stockItem/StockItemPackagingUOM'; interface ControlledNumberInputProps extends NumberInputProps { row?: StockItemPackagingUOMDTO; controllerName: string; name: string; control: Control; } const ControlledNumberInput = (props: ControlledNumberInputProps) => { const { controllerName, name, control, row, onChange: onChangeProp, id, ...numberInputProps } = props; return ( ( , state: { value: number | string; direction: string; }, ) => { onChange(state.value); if (onChangeProp) { onChangeProp(event, state); } }} /> )} /> ); }; export default ControlledNumberInput;