import { ArrowDropDown } from '@mui/icons-material' import clsx from 'clsx' import { ComponentPropsWithoutRef } from 'react' import { FieldError, FieldPathValue, FieldValues, Path, UseFormRegister, Validate, } from 'react-hook-form' import { useTranslation } from 'react-i18next' export interface SelectInputProps< FV extends FieldValues, FieldName extends Path, > extends Omit, 'required' | 'onChange'> { fieldName?: FieldName register?: UseFormRegister validation?: Validate>[] error?: FieldError required?: boolean onChange?: (value: string) => void containerClassName?: string iconClassName?: string } export const SelectInput = < FV extends FieldValues, FieldName extends Path, >({ fieldName, register, error, validation, children, required, className, onChange, containerClassName, iconClassName, disabled, ...props }: SelectInputProps) => { const { t } = useTranslation() const validate = validation?.reduce( (a, v) => ({ ...a, [v.toString()]: v }), {} ) return (
{!disabled && (
)}
) }