import * as React from 'react'; /** The two constraint-validation methods every form-associated component publishes, the same pair a native `HTMLInputElement` has; hung onto the root's element, or the object itself when the root renders no DOM. */ export interface FormValidityHandle { /** Returns whether the current value satisfies its constraints, firing `invalid` if not. */ checkValidity(): boolean; /** Like {@link checkValidity}, but also shows the browser's validation message. */ reportValidity(): boolean; /** Pushes an externally-computed error into the control, exactly like `HTMLInputElement.setCustomValidity()`: a non-empty message makes it invalid (`customError`) and is what {@link reportValidity} shows; `''` clears it. */ setCustomValidity(message: string): void; } /** Builds {@link FormValidityHandle} on top of whichever native control actually carries the submitted value, both methods answering `true` when that control is absent (nothing to submit, nothing to be invalid about). */ export declare function formValidityHandle(control: React.RefObject): FormValidityHandle; /** The readable half of constraint validation — the control's own `ValidityState` and the message the browser would show — kept as a separate interface of live getters, since `Object.assign` can't carry accessors and a snapshot at ref-build time would go stale. */ export interface FormValidityStateView { /** The wrapped control's own `ValidityState`, live; `null` when no control has mounted. */ readonly validity: ValidityState | null; /** The message the browser would show for the current validity — `''` when valid or when no control has mounted. */ readonly validationMessage: string; } type ValidityStateSource = Pick; /** * Builds {@link FormValidityStateView} over whichever native control carries * the value, as **getters**, so each read reflects the control's validity now * rather than when the handle was assembled. */ export declare function formValidityStateView(control: React.RefObject): FormValidityStateView; /** * Render-phase form of {@link formValidityStateView}: the React Compiler reads a ref handed to a * plain function as a render-phase ref access, and a hook boundary is where it stops looking. * * @internal */ export declare function useFormValidityStateView(control: React.RefObject): FormValidityStateView; /** * Publishes {@link FormValidityHandle} on the forwarded ref of a root that renders an element, assigning the methods onto the node rather than replacing it so existing ref uses keep working; `extra` adds accessor-shaped members like {@link formValidityStateView}. * * @example * ```tsx * const rootRef = React.useRef(null); * const inputRef = React.useRef(null); * useFormValidityHandle(forwardedRef, rootRef, inputRef); * return ; * ``` */ export declare function useFormValidityHandle(forwardedRef: React.Ref | undefined, nodeRef: React.RefObject, control: React.RefObject, extra?: E): void; /** * Restores a control's declared default when the owning `
` is reset, found from `element` via `closest('form')` (or `formId`, which wins, for a control outside the DOM subtree of its form — a portalled dialog) and resolved once on mount; `onReset` fires through the component's normal change callback since a controlled value belongs to the parent. */ export declare function useFormReset(element: React.RefObject, onReset: () => void, formId?: string): void; export {};