import type { VNode } from 'vue'; import type { FormSchema, FormError, FormInputEvents, FormErrorEvent, FormSubmitEvent, FormErrorWithId, InferInput, FormData } from '../types/form'; import type { FormHTMLAttributes } from '../types/html'; export type FormProps = { id?: string | number; /** Schema to validate the form state. Supports Standard Schema objects, Yup, Joi, and Superstructs. */ schema?: S; /** An object representing the current state of the form. */ state?: N extends false ? Partial> : never; /** * Custom validation function to validate the form state. * @param state - The current state of the form. * @returns A promise that resolves to an array of FormError objects, or an array of FormError objects directly. */ validate?: (state: Partial>) => Promise | FormError[]; /** * The list of input events that trigger the form validation. * @remarks The form always validates on submit. * @defaultValue `['blur', 'change', 'input']` */ validateOn?: FormInputEvents[]; /** Disable all inputs inside the form. */ disabled?: boolean; /** * Path of the form's state within it's parent form. * Used for nesting forms. Only available if `nested` is true. */ name?: N extends true ? string : never; /** * Delay in milliseconds before validating the form on input events. * @defaultValue `300` */ validateOnInputDelay?: number; /** * If true, applies schema transformations on submit. * @defaultValue `true` */ transform?: T; /** * If true, this form will attach to its parent Form and validate at the same time. * @defaultValue `false` */ nested?: N & boolean; /** * When `true`, all form elements will be disabled on `@submit` event. * This will cause any focused input elements to lose their focus state. * @defaultValue `true` */ loadingAuto?: boolean; class?: any; b24ui?: { base?: any; }; onSubmit?: ((event: FormSubmitEvent>) => void | Promise) | (() => void | Promise); } & /** @vue-ignore */ Omit; export interface FormEmits { submit: [event: FormSubmitEvent>]; error: [event: FormErrorEvent]; } export interface FormSlots { default?(props: { errors: FormErrorWithId[]; loading: boolean; }): VNode[]; } declare const _default: typeof __VLS_export; export default _default; declare const __VLS_export: (__VLS_props: NonNullable>["props"], __VLS_ctx?: __VLS_PrettifyLocal>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable>["expose"], __VLS_setup?: Promise<{ props: import("vue").PublicProps & __VLS_PrettifyLocal & { onError?: ((event: FormErrorEvent) => any) | undefined; onSubmit?: ((event: FormSubmitEvent>) => any) | undefined; }> & (typeof globalThis extends { __VLS_PROPS_FALLBACK: infer P; } ? P : {}); expose: (exposed: import("vue").ShallowUnwrapRef<{ validate: { (opts: { name?: keyof InferInput | (keyof InferInput)[] | undefined; silent?: false | undefined; nested?: boolean; transform?: T_1 | undefined; }): Promise>; (opts: { name?: keyof InferInput | (keyof InferInput)[] | undefined; silent?: true | undefined; nested?: boolean; transform?: T_1 | undefined; }): Promise | false>; }; errors: import("vue").Ref<{ id?: string | undefined; name?: string | undefined; message: string; }[], FormErrorWithId[] | { id?: string | undefined; name?: string | undefined; message: string; }[]>; setErrors(errs: FormError[], name?: keyof InferInput | string | RegExp): void; submit(): Promise; getErrors(name?: keyof InferInput | string | RegExp): { id?: string | undefined; name?: string | undefined; message: string; }[]; clear(name?: keyof InferInput | string | RegExp): void; disabled: import("vue").ComputedRef; loading: import("vue").Ref; dirty: import("vue").ComputedRef; dirtyFields: ReadonlySet>>>; blurredFields: ReadonlySet>>>; touchedFields: ReadonlySet>>>; }>) => void; attrs: any; slots: FormSlots; emit: ((evt: "error", event: FormErrorEvent) => void) & ((evt: "submit", event: FormSubmitEvent>) => void); }>) => import("vue").VNode & { __ctx?: Awaited; }; type __VLS_PrettifyLocal = (T extends any ? { [K in keyof T]: T[K]; } : { [K in keyof T as K]: T[K]; }) & {};