/* eslint-disable @typescript-eslint/no-explicit-any */ import { ChangeEvent, FocusEvent } from "react"; import { FieldValidation, FormAdapter, ValidatorType } from "utils"; export type UseFieldOptions
, Value> = { attachFieldElement?: boolean; validate?: ValidatorType; onChange?: (value: Value, event: ChangeEvent) => void; onBlur?: (value: Value, event: FocusEvent) => void; } & FieldValidation; export type FieldElements = HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement; export type UseFieldOutput = { field: { value: Value; ref: React.RefObject; onChange: (value: Value, event: ChangeEvent) => void; onBlur: (event: FocusEvent) => void; }; error: string | undefined; isDirty: boolean; isTouched: boolean; isValidating: boolean; }; export type UseField, Value> = ( name: string, options?: UseFieldOptions, ) => UseFieldOutput;