import { InputNumberThousand } from './InputNumberThousand'; import type { LunaticComponentProps } from '../type'; import { Label } from '../shared/Label/Label'; import { ComponentErrors, getComponentErrors, } from '../shared/ComponentErrors/ComponentErrors'; import { slottableComponent } from '../shared/HOC/slottableComponent'; import { Declarations } from '../shared/Declarations/Declarations'; import type { LunaticError } from '../../use-lunatic/type'; export function InputNumber({ handleChanges, response, errors, decimals, ...props }: LunaticComponentProps<'InputNumber'>) { return ( handleChanges([{ name: response.name, value }])} errors={getComponentErrors(errors, props.id)} /> ); } type CustomProps = Omit< LunaticComponentProps<'InputNumber'>, 'response' | 'handleChanges' | 'errors' > & { onChange: (v: number | null) => void; errors?: LunaticError[]; }; export const CustomInputNumber = slottableComponent( 'InputNumber', (props) => { const { id, value, onChange, disabled, readOnly, min, max, decimals, unit, label, errors, required, description, declarations, } = props; const labelId = `label-${id}`; return (
{unit && {unit}}
); } );