import { type Constraint, type Combine, type FormId, type FieldName, type FormContext as BaseFormContext, type FormValue, type FormState, type Intent, type SubscriptionScope, type SubscriptionSubject, type FormOptions as BaseFormOptions } from '@conform-to/dom'; import { type FormEvent, type ReactElement, type ReactNode, type MutableRefObject } from 'react'; export type Pretty = { [K in keyof T]: T[K]; } & {}; export type Primitive = string | number | bigint | boolean | Date | File | null | undefined; export type Metadata, FormError = string[]> = { key: string | undefined; id: string; errorId: string; descriptionId: string; name: FieldName; defaultValue: string | undefined; defaultOptions: string[] | undefined; defaultChecked: boolean | undefined; initialValue: FormValue; value: FormValue; errors: FormError | undefined; allErrors: Record; valid: boolean; dirty: boolean; }; export type FormMetadata = any, FormError = string[]> = Omit, 'id'> & Pick, Intent['type']> & { id: FormId; context: Wrapped>; status?: 'success' | 'error'; getFieldset: () => Required<{ [Key in keyof Combine]: FieldMetadata[Key], Schema, FormError>; }>; onSubmit: (event: React.FormEvent) => void; noValidate: boolean; }; type SubfieldMetadata, FormError> = [Schema] extends [Primitive] ? {} : [Schema] extends [Array | null | undefined] ? { getFieldList: () => Array>; } : [Schema] extends [Record | null | undefined] ? { getFieldset: () => Required<{ [Key in keyof Combine]: FieldMetadata[Key], FormSchema, FormError>; }>; } : {}; export type FieldMetadata = any, FormError = string[]> = Metadata & Constraint & { formId: FormId; } & SubfieldMetadata; export declare const Form: import("react").Context[]>; declare const wrappedSymbol: unique symbol; export type Wrapped = { [wrappedSymbol]: Type; }; export declare function getWrappedFormContext(context: Wrapped): FormContext; export declare function useFormContext, FormError>(formId?: FormId): FormContext; export declare function useFormState(form: FormContext, subjectRef?: MutableRefObject): FormState; export declare function FormProvider(props: { context: Wrapped>; children: ReactNode; }): ReactElement; export declare function FormStateInput(props: { formId?: string; }): React.ReactElement; export declare function useSubjectRef(initialSubject?: SubscriptionSubject): MutableRefObject; export declare function updateSubjectRef(ref: MutableRefObject, subject: 'status' | 'formId'): void; export declare function updateSubjectRef(ref: MutableRefObject, subject: Exclude, scope: keyof SubscriptionScope, name: string): void; export declare function getMetadata>(context: FormContext, subjectRef: MutableRefObject, stateSnapshot: FormState, name?: FieldName): Metadata; export declare function getFieldMetadata, FormError>(context: FormContext, subjectRef: MutableRefObject, stateSnapshot: FormState, prefix?: string, key?: string | number): FieldMetadata; export declare function getFormMetadata, FormError = string[], FormValue = Schema>(context: FormContext, subjectRef: MutableRefObject, stateSnapshot: FormState, noValidate: boolean): FormMetadata; export type FormOptions = any, FormError = string[], FormValue = Schema> = BaseFormOptions & { /** * A function to be called before the form is submitted. */ onSubmit?: (event: FormEvent, context: ReturnType['submit']>) => void; }; export type FormContext = any, FormError = string[], FormValue = Schema> = Omit, 'submit' | 'onUpdate'> & { submit: (event: FormEvent) => void; onUpdate: (options: Partial>) => void; }; export declare function createFormContext = any, FormError = string[], FormValue = Schema>(options: FormOptions): FormContext; export {}; //# sourceMappingURL=context.d.ts.map