import { ReactElement, ReactNode } from 'react'; import { Control, ControllerRenderProps, FieldPath, FieldPathValue, FieldValues, RegisterOptions } from 'react-hook-form'; import { AsmaFormsOptions } from './types'; export interface AutofillAnimationEvent { animationName: string; target: EventTarget | null; } export interface AsmaFieldRenderProps { value: TValue; onChange: (...event: unknown[]) => void; onBlur: () => void; onAnimationStart: (event: AutofillAnimationEvent) => void; name: string; ref: ControllerRenderProps['ref']; error: boolean; helperText: ReactNode; reserveHelperText: boolean; } export interface AsmaFieldControllerProps = FieldPath> { name: TName; control?: Control; rules?: Omit, 'valueAsNumber' | 'valueAsDate' | 'setValueAs' | 'disabled'>; helperText?: ReactNode; /** For controls that own their input ref (comboboxes, rich editors): RHF focuses the field through this instead of a DOM node. */ requestFocus?: () => void; render: (props: AsmaFieldRenderProps>) => ReactElement; } export declare function createAsmaFieldController({ getLanguageCode, browserAutofill, }: AsmaFormsOptions): = FieldPath>({ name, control, rules, helperText, requestFocus, render, }: AsmaFieldControllerProps) => ReactElement;