import { type Getter, type ReadableBoxedValues, type WithRefProps } from "svelte-toolbelt"; import type { FormPath } from "sveltekit-superforms"; import type { PrimitiveFromIndex } from "./internal/types.js"; import type { FsSuperForm } from "./components/types.js"; type FieldState, U extends FormPath> = FormFieldState | ElementFieldState; type FormFieldStateProps, U extends FormPath, M = any> = ReadableBoxedValues<{ form: FsSuperForm; name: U; }>; declare class FormFieldState, U extends FormPath> { #private; form: FsSuperForm; name: U; errors: string[]; constraints: any; tainted: boolean; errorNode: HTMLElement | null; descriptionNode: HTMLElement | null; errorId: string | undefined; descriptionId: string | undefined; constructor(props: FormFieldStateProps); snippetProps: { readonly value: T[U]; readonly errors: string[]; readonly tainted: boolean; readonly constraints: any; }; } type ElementFieldStateProps, U extends FormPath, M = any> = ReadableBoxedValues<{ form: FsSuperForm; name: U; }>; declare class ElementFieldState, U extends FormPath> { #private; form: FsSuperForm; name: U; errors: string[]; constraints: any; tainted: boolean; errorNode: HTMLElement | null; descriptionNode: HTMLElement | null; derivedDescriptionNode: HTMLElement | null; value: PrimitiveFromIndex; errorId: string | undefined; descriptionId: string | undefined; constructor(props: ElementFieldStateProps, field: FieldState); snippetProps: { readonly value: T[U]; readonly errors: string[]; readonly tainted: boolean; readonly constraints: any; }; } type FieldErrorsStateProps = WithRefProps; declare class FieldErrorsState, U extends FormPath> { #private; field: FieldState; constructor(props: FieldErrorsStateProps, field: FieldState); snippetProps: { errors: string[]; errorProps: { "data-fs-field-error": string; "data-fs-error": string | undefined; }; }; fieldErrorsProps: { id: string; "data-fs-error": string | undefined; "data-fs-field-errors": string; "aria-live": "assertive"; }; errorProps: { "data-fs-field-error": string; "data-fs-error": string | undefined; }; } type DescriptionStateProps = WithRefProps; declare class DescriptionState { #private; field: FieldState, string>; constructor(props: DescriptionStateProps, field: FieldState, string>); props: { id: string; "data-fs-error": string | undefined; "data-fs-description": string; }; } type ControlStateProps = ReadableBoxedValues<{ id: string; }>; declare class ControlState { #private; field: FieldState, string>; labelId: ControlStateProps["id"]; id: string; constructor(props: ControlStateProps, field: FieldState, string>); props: { id: string; name: string; "data-fs-error": string | undefined; "aria-describedby": string | undefined; "aria-invalid": "true" | undefined; "aria-required": "true" | undefined; "data-fs-control": string; }; labelProps: { id: string; "data-fs-label": string; "data-fs-error": string | undefined; for: string; }; } type LabelStateProps = WithRefProps; declare class LabelState { #private; control: ControlState; constructor(props: LabelStateProps, control: ControlState); get props(): { id: string; "data-fs-label": string; "data-fs-error": string | undefined; for: string; }; } type LegendStateProps = WithRefProps; declare class LegendState { #private; field: FieldState, string>; constructor(props: LegendStateProps, field: FieldState, string>); props: { readonly id: string; readonly "data-fs-error": string | undefined; readonly "data-fs-legend": ""; }; } export declare function useField, U extends FormPath>(props: FormFieldStateProps): FormFieldState; export declare function useElementField, U extends FormPath>(props: ElementFieldStateProps): ElementFieldState; export declare function getField = Record, U extends FormPath = FormPath>(): FieldState; export declare function useFieldErrors = Record, U extends FormPath = FormPath>(props: FieldErrorsStateProps): FieldErrorsState; export declare function useDescription(props: DescriptionStateProps): DescriptionState; export declare function useControl(props: ControlStateProps): ControlState; export declare function _getFormControl(): ControlState; export declare function useLabel(props: LabelStateProps): LabelState; export declare function useLegend(props: LegendStateProps): LegendState; export type UseFormFieldProps = { /** Optionally provide a function that returns the ID of the field errors container. */ errorsId?: Getter; /** Optionally provide a function that returns the ID of the description element. */ descriptionId?: Getter; }; export declare function useFormField = Record, U extends FormPath = FormPath>(props: UseFormFieldProps): { form: FsSuperForm; readonly name: U; readonly errors: string[]; readonly constraints: any; readonly tainted: boolean; readonly errorsId: string | undefined; readonly descriptionId: string | undefined; }; export type UseFormControlProps = { /** Optionally provide a function that returns the ID of the control element. */ id?: Getter; }; export declare function useFormControl(props: UseFormControlProps): { readonly id: string; readonly labelProps: { id: string; "data-fs-label": string; "data-fs-error": string | undefined; for: string; }; readonly props: { id: string; name: string; "data-fs-error": string | undefined; "aria-describedby": string | undefined; "aria-invalid": "true" | undefined; "aria-required": "true" | undefined; "data-fs-control": string; }; }; /** * Use `useFormControl` instead. * @deprecated */ export declare const getFormControl: typeof useFormControl; /** * Use `useFormField` instead. * @deprecated */ export declare const getFormField: typeof useFormField; export {};