import {ChangeEvent, ReactNode, HTMLProps, useCallback, useId} from 'react';
import classNames from 'classnames';
type CommonProps = {
label: ReactNode;
error?: ReactNode;
};
type TextInputProps = {
value: string;
onChange: (value: string) => void;
}
type HTMLInputProps = Omit, 'onChange' | 'label'>;
function BaseInput({label, value, onChange, error, ...props}: CommonProps & HTMLInputProps & TextInputProps) {
const id = useId();
const handleChange = useCallback(
(e: ChangeEvent) => onChange(e.target.value),
[onChange],
);
return
{error &&
{error}
}
;
}
export function TextInput(props: CommonProps & TextInputProps) {
return ;
}
export function NumberInput({value, onChange, ...props}: CommonProps & {
value: number;
onChange: (value: number) => void;
min?: number;
max?: number;
}) {
const handleChange = useCallback((value: string) => onChange(+value), [onChange]);
return ;
}