import type { JSX, ValidComponent } from "@solidjs/web"; import type { FieldValidationMode } from "../internals/field-constants.js"; import { type FormContextValue, type FormErrors, type FormFieldEntry } from "../internals/form-context.js"; import type { BaseUIComponentProps } from "../internals/types.js"; export type { FormContextValue, FormErrors, FormFieldEntry }; export type FormValidationMode = FieldValidationMode; export type FormState = Record; export interface FormProps extends BaseUIComponentProps<"form", FormState> { /** * Tag/component to render. Defaults to `"form"`. */ as?: ValidComponent; /** * Determines when the form should be validated. The `validationMode` * prop on `` takes precedence over this. * * @default "onSubmit" */ validationMode?: FormValidationMode | undefined; /** * Validation errors returned externally (e.g. from server submission). * Keys correspond to ``'s `name` attribute; values are the * error(s) for that field. */ errors?: FormErrors | undefined; /** * Called when the consumer submits the form AND every registered field * passed validation. The native submit event is passed through — the * consumer is free to call `preventDefault()` as needed. */ onSubmit?: JSX.EventHandler | undefined; /** * Called when submission is blocked because one or more registered * fields failed validation. Base UI already calls `preventDefault()` on * the submit event before invoking this handler. */ onSubmitValidationFailed?: ((event: SubmitEvent, invalidFields: FormFieldEntry[]) => void) | undefined; } /** * A native `
` element that coordinates cross-field validation with * any `` descendants. * * On native submit: * 1. Flip `submitAttemptedRef.current` to `true`. * 2. Iterate `formRef.current.fields` and call each field's `validate`. * 3. If any field reports `validityData.state.valid === false`, call * `preventDefault()` on the submit event and invoke * `onSubmitValidationFailed`. * 4. Otherwise pass the event through to the consumer's `onSubmit`. * * On native reset: clear the internal error map and reset * `submitAttemptedRef`. * * Documentation: [Base UI Form](https://base-ui.com/react/components/form) */ export declare function Form(props: FormProps): JSX.Element; //# sourceMappingURL=form.d.ts.map