import { useState, type ComponentProps, type ReactNode } from 'react' import { get, type FieldError, type FieldValues, type Path, type RegisterOptions, } from 'react-hook-form' import { useRemixFormContext } from 'remix-hook-form' import { EyeIcon } from '~/components/icons/eye' import { Button } from './button' type TInputProperties = Omit< ComponentProps<'input'>, 'size' > & { id: string label?: ReactNode name: Path rules?: RegisterOptions } export const Input = >( properties: TInputProperties, ) => { const { id, label, name, rules, type = 'text', ...rest } = properties const [inputType, setInputType] = useState(type) const { register, formState: { errors }, } = useRemixFormContext() const error: FieldError = get(errors, name) return (
{type === 'password' && ( )}
) }