/** Opaque handle for the form's control object: pass the `control` from react-hook-form's useForm (or omit it inside a ). It is only ever handed back to RHF — AuraGlass reads no member of it. */ export type FormControl = object; export type FormValidationRule = V | { value: V | undefined; message: string; }; export type FormValidateResult = string | string[] | boolean | undefined; /** One validator: RHF calls it with the field value and all form values. */ export type FormValidate = (value: unknown, formValues: Record) => FormValidateResult | Promise; /** RHF validation rules for the field (required, min, pattern, validate, …), structurally RHF's controller rules (RegisterOptions minus the value-coercion keys a Controller registration does not take). */ export interface FormFieldRules { required?: string | FormValidationRule | undefined; min?: FormValidationRule | undefined; max?: FormValidationRule | undefined; maxLength?: FormValidationRule | undefined; minLength?: FormValidationRule | undefined; pattern?: FormValidationRule | undefined; validate?: FormValidate | Record | undefined; /** Other field names whose changes revalidate this field. */ deps?: string | string[] | undefined; } /** One field error as RHF reports it (`type` is the failed rule's name). */ export interface FormFieldError { type?: string | undefined; message?: string | undefined; } /** The controller binding for compound/hidden-input controls, structurally RHF's ControllerRenderProps. */ export interface FormFieldBinding { name: string; value: unknown; onChange: (...event: unknown[]) => void; onBlur: () => void; ref: (instance: HTMLElement | null) => void; disabled?: boolean | undefined; } /** Field-level state, structurally RHF's ControllerFieldState. */ export interface FormFieldState { invalid: boolean; isTouched: boolean; isDirty: boolean; isValidating: boolean; error?: FormFieldError | undefined; } /** Form-level state flags, structurally RHF's FormState. */ export interface FormStateSnapshot { isDirty: boolean; isValid: boolean; isValidating: boolean; isLoading: boolean; isSubmitted: boolean; isSubmitting: boolean; isSubmitSuccessful: boolean; submitCount: number; errors: Record; } /** Controller binding for compound/hidden-input controls (Switch/Checkbox/Select/Combobox), structurally RHF's UseControllerReturn. */ export interface FormFieldController { field: FormFieldBinding; fieldState: FormFieldState; formState: FormStateSnapshot; } export interface UseFormFieldResult { /** Binds a native input by ref: resolves the control's inner input/textarea and hands it to RHF's field.ref, plus input/blur listeners so onChange/onBlur validation modes see updates. Spread as `ref` prop. */ bindNative: (el: HTMLElement | null) => void; /** Controller binding for compound/hidden-input controls (Switch/Checkbox/Select/Combobox). */ controller: FormFieldController; /** Field name. */ name: Name; /** Current invalid state + first error message for Field.Root/Field.Error. */ invalid: boolean; error: string | undefined; } /** useFormField(name, control?, rules?) — must be rendered inside a react-hook-form (or given `control`). `rules` are the field's RHF validation rules: the controller registration owns the field, so rules must be passed here rather than through a separate register() call (which it overrides). */ export declare function useFormField(name: Name, control?: FormControl, rules?: FormFieldRules): UseFormFieldResult; //# sourceMappingURL=useFormField.d.ts.map