import type { FormField, FormValue, ValidationFunc } from '../sharedTypes/formHelperTypes'; /** * A custom React hook that manages form field state, validation, and interactions within a form context. * This hook provides a complete interface for form field management including value handling, error states, and field references. * It must be used within a FormProvider component to access the form context and will throw an error if used outside of it. * * @param name The unique identifier for the form field within the form. * @param defaultValue The initial value to be set for the form field when it's first created. * @param resetValue The value to reset the field to when form reset is triggered. Defaults to defaultValue if not provided. * @param validation An optional validation function to validate the field value and return error messages. * @param keepOnUnmount A boolean indicating whether to retain the field's value in the form state upon unmounting. Defaults to false. * @returns An object containing the field's current value, error state, field reference, form ID, and change handler. * * @throws Will throw an error if used outside of a FormProvider context. * * @example * ```tsx * const { value, error, handleFieldChange, fieldRef } = useFormField( * 'email', * '', * '', * (value) => value.includes('@') ? undefined : 'Invalid email' * ); * ``` */ export declare const useFormField: (name: string, defaultValue: T, resetValue?: T | undefined, validation?: (ValidationFunc | undefined), keepOnUnmount?: boolean) => { error: string[] | null; fieldRef: import("react").RefObject; formId: string; handleFieldChange: (value: FormValue) => void; value: T; };