import { type ForwardedRef, type ReactElement } from 'react'; 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'; import type { FormApi, FormSubmitData, FormSubmitOutcome, FormValidator } from './form.types.js'; import { type FormRuntime } from './runtime/createFormRuntime.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 once per submit trigger, **before** validation runs. Work before * `await context.validationResult` lands in the pre-validation window; the * resolved value carries the outcome. Returning a promise makes the * consumer's own work part of the submit, so `submit()` resolves only once * it settles. */ onSubmit?: (context: FormSubmitData) => FormSubmitOutcome | Promise; /** * Called when the form's aggregate validation state transitions. Every * validation run emits a `'pending'` then a `'done'` state. Between runs, a * recompute that changes neither the validity nor the error set is skipped. */ 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