import { type ForwardedRef, type ReactElement } from 'react'; import type { FormApi, FormInvalidContext, FormSubmitContext, FormValidator } from './form.types.js'; import { type FormRuntime } from './runtime/createFormRuntime.js'; import type { AriaLabelingProps } from '../../core/types/a11y-props.js'; import type { BehaviorTrackingProps } from '../../core/types/behavior-tracking-props.js'; import type { DataTestId } from '../../core/types/data-props.js'; import type { StylingProps } from '../../core/types/styling-props.js'; import { WithChildren } from '../../core/types/with-children.js'; import type { ValidationState } from '../validation/types.js'; /** * Props for `Form`. * @internal */ export interface FormProps> extends WithChildren, StylingProps, DataTestId, AriaLabelingProps, BehaviorTrackingProps { /** * Native form id. Required to associate `FormMessages` or a control from * outside the React subtree via `form="…"`; optional otherwise. */ id?: string; /** Form-level validators. Receive the full snapshot and may be async. */ validators?: FormValidator[]; /** Called after successful validation on a submit trigger. */ onSubmit?: (context: FormSubmitContext) => void; /** Called after failed validation on a submit trigger. */ onInvalid?: (context: FormInvalidContext) => void; /** * Called when the form's aggregate validation state transitions — validity * flips, or the set of errors changes. Not called on identical recomputations. */ onValidityChange?: (state: ValidationState) => void; /** * Pre-built runtime created by `useForm` or `createForm`. When provided, * the form uses this runtime instead of creating its own, so callers outside * the subtree can drive `submit()`, `setError()`, etc. via the same handle. * @internal */ form?: FormApi; } /** * Narrows a `FormApi` (or unknown value) to a full `FormRuntime` by checking * for the runtime-only methods (`register`, `subscribe`, `getFormMessages`, * `getFieldMessages`). `useForm` / `createForm` return the underlying runtime * widened to `FormApi`, so this succeeds for legitimate handles. * @internal */ export declare function isFormRuntime>(value: unknown): value is FormRuntime; /** * Aggregates the validation state of the `FormField`s it wraps into a single * submit / validity flow, without owning any control values. * @internal */ export declare const Form: >(props: FormProps & { ref?: ForwardedRef; }) => ReactElement; //# sourceMappingURL=Form.d.ts.map