import * as vue from 'vue'; import { MaybeRef, Ref, MaybeRefOrGetter, ComputedRef, PropType, VNode, UnwrapRef, InjectionKey } from 'vue'; import { PartialDeep } from 'type-fest'; type BrowserNativeObject = Date | FileList | File; type Primitive = null | undefined | string | number | boolean | symbol | bigint; /** * Checks whether the type is any * See {@link https://stackoverflow.com/a/49928360/3406963} * @typeParam T - type which may be any * ``` * IsAny = true * IsAny = false * ``` */ type IsAny = 0 extends 1 & T ? true : false; /** * Checks whether T1 can be exactly (mutually) assigned to T2 * @typeParam T1 - type to check * @typeParam T2 - type to check against * ``` * IsEqual = true * IsEqual<'foo', 'foo'> = true * IsEqual = false * IsEqual = false * IsEqual = false * IsEqual<'foo', string> = false * IsEqual<'foo' | 'bar', 'foo'> = boolean // 'foo' is assignable, but 'bar' is not (true | false) -> boolean * ``` */ type IsEqual = T1 extends T2 ? (() => G extends T1 ? 1 : 2) extends () => G extends T2 ? 1 : 2 ? true : false : false; /** * Type to query whether an array type T is a tuple type. * @typeParam T - type which may be an array or tuple * @example * ``` * IsTuple<[number]> = true * IsTuple = false * ``` */ type IsTuple> = number extends T['length'] ? false : true; /** * Type which can be used to index an array or tuple type. */ type ArrayKey = number; /** * Helper function to break apart T1 and check if any are equal to T2 * * See {@link IsEqual} */ type AnyIsEqual = T1 extends T2 ? (IsEqual extends true ? true : never) : never; /** * Type which given a tuple type returns its own keys, i.e. only its indices. * @typeParam T - tuple type * @example * ``` * TupleKeys<[number, string]> = '0' | '1' * ``` */ type TupleKeys> = Exclude; /** * Helper type for recursively constructing paths through a type. * This actually constructs the strings and recurses into nested * object types. * * See {@link Path} */ type PathImpl = V extends Primitive | BrowserNativeObject ? `${K}` : true extends AnyIsEqual ? `${K}` : `${K}` | `${K}.${PathInternal}`; /** * Helper type for recursively constructing paths through a type. * This obscures the internal type param TraversedTypes from ed contract. * * See {@link Path} */ type PathInternal = T extends ReadonlyArray ? IsTuple extends true ? { [K in TupleKeys]-?: PathImpl; }[TupleKeys] : PathImpl : { [K in keyof T]-?: PathImpl; }[keyof T]; /** * Helper type for recursively constructing paths through a type. * This actually constructs the strings and recurses into nested * object types. * * See {@link ArrayPath} */ type ArrayPathImpl = V extends Primitive | BrowserNativeObject ? IsAny extends true ? string : never : V extends ReadonlyArray ? U extends Primitive | BrowserNativeObject ? IsAny extends true ? string : never : true extends AnyIsEqual ? never : `${K}` | `${K}.${ArrayPathInternal}` : true extends AnyIsEqual ? never : `${K}.${ArrayPathInternal}`; /** * Helper type for recursively constructing paths through a type. * This obscures the internal type param TraversedTypes from ed contract. * * See {@link ArrayPath} */ type ArrayPathInternal = T extends ReadonlyArray ? IsTuple extends true ? { [K in TupleKeys]-?: ArrayPathImpl; }[TupleKeys] : ArrayPathImpl : { [K in keyof T]-?: ArrayPathImpl; }[keyof T]; /** * Type which eagerly collects all paths through a type which point to an array * type. * @typeParam T - type which should be introspected. * @example * ``` * Path<{foo: {bar: string[], baz: number[]}}> = 'foo.bar' | 'foo.baz' * ``` */ type ArrayPath = T extends any ? ArrayPathInternal : never; /** * Type to evaluate the type which the given path points to. * @typeParam T - deeply nested type which is indexed by the path * @typeParam P - path into the deeply nested type * @example * ``` * PathValue<{foo: {bar: string}}, 'foo.bar'> = string * PathValue<[number, string], '1'> = string * ``` */ type PathValue | ArrayPath> = T extends any ? P extends `${infer K}.${infer R}` ? K extends keyof T ? R extends Path ? PathValue : never : K extends `${ArrayKey}` ? T extends ReadonlyArray ? PathValue> : never : never : P extends keyof T ? T[P] : P extends `${ArrayKey}` ? T extends ReadonlyArray ? V : never : never : never; /** * Type which eagerly collects all paths through a type * @typeParam T - type which should be introspected * @example * ``` * Path<{foo: {bar: string}}> = 'foo' | 'foo.bar' * ``` */ type Path = T extends any ? PathInternal : never; type GenericObject = Record; type MaybeArray = T | T[]; type MaybePromise = T | Promise; type FlattenAndSetPathsType = { [K in Path]: TType; }; type MapValuesPathsToRefs>[]]> = { readonly [K in keyof TPaths]: TPaths[K] extends MaybeRef ? TKey extends Path ? Ref> : Ref : Ref; }; interface FieldValidationMetaInfo { field: string; name: string; label?: string; value: unknown; form: Record; rule?: { name: string; params?: Record | unknown[]; }; } type ValidationRuleFunction> = (value: TValue, params: TParams, ctx: FieldValidationMetaInfo) => boolean | string | Promise; type SimpleValidationRuleFunction> = (value: TValue, params: TParams) => boolean | string | Promise; type ValidationMessageGenerator = (ctx: FieldValidationMetaInfo) => string; interface ValidationResult { errors: string[]; valid: boolean; value?: TValue; } type FlattenAndMapPathsValidationResult = { [K in Path]: ValidationResult; }; interface TypedSchemaError { path?: string; errors: string[]; } interface TypedSchemaPathDescription { required: boolean; exists: boolean; } interface TypedSchemaContext { formData: GenericObject; } interface TypedSchema { __type: 'VVTypedSchema'; parse(values: TInput, context?: TypedSchemaContext): Promise<{ value?: TOutput; errors: TypedSchemaError[]; }>; cast?(values: Partial): TInput; describe?(path?: Path): Partial; } type InferOutput = TSchema extends TypedSchema ? TOutput : never; type InferInput = TSchema extends TypedSchema ? TInput : never; type YupSchema = { __isYupSchema__: boolean; validate(value: any, options: GenericObject): Promise; }; type Locator = { __locatorRef: string; } & ((values: GenericObject) => unknown); interface FieldMeta { touched: boolean; dirty: boolean; valid: boolean; validated: boolean; required: boolean; pending: boolean; initialValue?: TValue; } interface FormMeta { touched: boolean; dirty: boolean; valid: boolean; pending: boolean; initialValues?: Partial; } interface FieldState { value: TValue; touched: boolean; errors: string[]; } type InputType = 'checkbox' | 'radio' | 'default'; /** * validated-only: only mutate the previously validated fields * silent: do not mutate any field * force: validate all fields and mutate their state */ type SchemaValidationMode = 'validated-only' | 'silent' | 'force'; interface ValidationOptions$1 { mode: SchemaValidationMode; warn: boolean; } type FieldValidator = (opts?: Partial) => Promise>; interface PathStateConfig { bails: boolean; label: MaybeRefOrGetter; type: InputType; validate: FieldValidator; schema?: MaybeRefOrGetter; } interface PathState { id: number | number[]; path: string; touched: boolean; dirty: boolean; valid: boolean; required: boolean; validated: boolean; pending: boolean; initialValue: TInput | undefined; value: TInput | undefined; errors: string[]; bails: boolean; label: string | undefined; type: InputType; multiple: boolean; fieldsCount: number; __flags: { pendingUnmount: Record; pendingReset: boolean; }; validate?: FieldValidator; } interface FieldEntry { value: TValue; key: string | number; isFirst: boolean; isLast: boolean; } interface FieldArrayContext { fields: Ref[]>; remove(idx: number): void; replace(newArray: TValue[]): void; update(idx: number, value: TValue): void; push(value: TValue): void; swap(indexA: number, indexB: number): void; insert(idx: number, value: TValue): void; prepend(value: TValue): void; move(oldIdx: number, newIdx: number): void; } interface PrivateFieldArrayContext extends FieldArrayContext { reset(): void; path: MaybeRefOrGetter; } interface PrivateFieldContext { id: number; name: MaybeRef; value: Ref; meta: FieldMeta; errors: Ref; errorMessage: Ref; label?: MaybeRefOrGetter; type?: string; bails?: boolean; keepValueOnUnmount?: MaybeRefOrGetter; checkedValue?: MaybeRefOrGetter; uncheckedValue?: MaybeRefOrGetter; checked?: Ref; resetField(state?: Partial>): void; handleReset(): void; validate: FieldValidator; handleChange(e: Event | unknown, shouldValidate?: boolean): void; handleBlur(e?: Event, shouldValidate?: boolean): void; setState(state: Partial>): void; setTouched(isTouched: boolean): void; setErrors(message: string | string[]): void; setValue(value: TInput, shouldValidate?: boolean): void; } type FieldContext = Omit, 'id' | 'instances'>; type GenericValidateFunction = (value: TValue, ctx: FieldValidationMetaInfo) => MaybePromise>; interface FormState { values: PartialDeep; errors: Partial, string | undefined>>; touched: Partial, boolean>>; submitCount: number; } type FormErrors = Partial, string | undefined>>; type FormErrorBag = Partial, string[]>>; interface ResetFormOpts { force: boolean; } interface FormActions { setFieldValue>(field: T, value: PathValue, shouldValidate?: boolean): void; setFieldError(field: Path, message: string | string[] | undefined): void; setErrors(fields: Partial>): void; setValues(fields: PartialDeep, shouldValidate?: boolean): void; setFieldTouched(field: Path, isTouched: boolean): void; setTouched(fields: Partial, boolean>> | boolean): void; resetForm(state?: Partial>, opts?: Partial): void; resetField(field: Path, state?: Partial): void; } interface FormValidationResult { valid: boolean; results: Partial>; errors: Partial, string>>; values?: Partial; source: 'schema' | 'fields' | 'none'; } interface SubmissionContext extends FormActions { evt?: Event; controlledValues: Partial; } type SubmissionHandler = (values: TOutput, ctx: SubmissionContext) => TReturn; interface InvalidSubmissionContext { values: TInput; evt?: Event; errors: Partial, string>>; results: FormValidationResult['results']; } type InvalidSubmissionHandler = (ctx: InvalidSubmissionContext) => void; type RawFormSchema = Record, string | GenericValidateFunction | GenericObject>; type FieldPathLookup = Partial, PrivateFieldContext | PrivateFieldContext[]>>; type HandleSubmitFactory = (cb: SubmissionHandler, onSubmitValidationErrorCb?: InvalidSubmissionHandler) => (e?: Event) => Promise; type PublicPathState = Omit, 'bails' | 'label' | 'multiple' | 'fieldsCount' | 'validate' | 'id' | 'type' | '__flags'>; interface BaseFieldProps { onBlur: () => void; onChange: () => void; onInput: () => void; } interface InputBindsConfig { props: (state: PublicPathState) => TExtraProps; validateOnBlur: boolean; label: MaybeRefOrGetter; validateOnChange: boolean; validateOnInput: boolean; validateOnModelUpdate: boolean; } type LazyInputBindsConfig = (state: PublicPathState) => Partial<{ props: TExtraProps; validateOnBlur: boolean; validateOnChange: boolean; validateOnInput: boolean; validateOnModelUpdate: boolean; }>; interface ComponentBindsConfig { mapProps: (state: PublicPathState) => TExtraProps; validateOnBlur: boolean; validateOnModelUpdate: boolean; model: TModel; } type LazyComponentBindsConfig = (state: PublicPathState) => Partial<{ props: TExtraProps; validateOnBlur: boolean; validateOnModelUpdate: boolean; model: TModel; }>; interface ComponentModellessBinds { onBlur: () => void; } type ComponentModelBinds = ComponentModellessBinds & { [TKey in `onUpdate:${TModel}`]: (value: TValue) => void; }; type BaseComponentBinds = ComponentModelBinds & { [k in TModel]: TValue; }; interface BaseInputBinds { value: TValue | undefined; onBlur: (e: Event) => void; onChange: (e: Event) => void; onInput: (e: Event) => void; } interface PrivateFormContext extends FormActions { formId: number; values: TValues; initialValues: Ref>; controlledValues: Ref; fieldArrays: PrivateFieldArrayContext[]; submitCount: Ref; schema?: MaybeRef | TypedSchema | YupSchema | undefined>; errorBag: Ref>; errors: ComputedRef>; meta: ComputedRef>; isSubmitting: Ref; isValidating: Ref; keepValuesOnUnmount: MaybeRef; validateSchema?: (mode: SchemaValidationMode) => Promise>; validate(opts?: Partial): Promise>; validateField>(field: TPath, opts?: Partial): Promise>; stageInitialValue(path: string, value: unknown, updateOriginal?: boolean): void; unsetInitialValue(path: string): void; handleSubmit: HandleSubmitFactory & { withControlled: HandleSubmitFactory; }; setFieldInitialValue(path: string, value: unknown, updateOriginal?: boolean): void; createPathState>(path: MaybeRef, config?: Partial>): PathState>; getPathState>(path: TPath): PathState> | undefined; getAllPathStates(): PathState[]; removePathState>(path: TPath, id: number): void; unsetPathValue>(path: TPath): void; destroyPath(path: string): void; isFieldTouched>(path: TPath): boolean; isFieldDirty>(path: TPath): boolean; isFieldValid>(path: TPath): boolean; defineField, TValue = PathValue, TExtras extends GenericObject = GenericObject>(path: MaybeRefOrGetter, config?: Partial> | LazyInputBindsConfig): [Ref, Ref]; /** * @deprecated use defineField instead */ useFieldModel>(path: TPath): Ref>; /** * @deprecated use defineField instead */ useFieldModel>[]]>(paths: TPaths): MapValuesPathsToRefs; /** * @deprecated use defineField instead */ defineComponentBinds, TValue = PathValue, TModel extends string = 'modelValue', TExtras extends GenericObject = GenericObject>(path: MaybeRefOrGetter, config?: Partial> | LazyComponentBindsConfig): Ref & TExtras>; /** * @deprecated use defineField instead */ defineInputBinds, TValue = PathValue, TExtras extends GenericObject = GenericObject>(path: MaybeRefOrGetter, config?: Partial> | LazyInputBindsConfig): Ref & TExtras>; } interface FormContext extends Omit, 'formId' | 'schema' | 'initialValues' | 'getPathState' | 'getAllPathStates' | 'removePathState' | 'unsetPathValue' | 'validateSchema' | 'stageInitialValue' | 'setFieldInitialValue' | 'unsetInitialValue' | 'fieldArrays' | 'markForUnmount' | 'keepValuesOnUnmount' | 'values'> { values: TValues; handleReset: () => void; submitForm: (e?: unknown) => Promise; } interface DevtoolsPluginFieldState { name: string; value: any; initialValue: any; errors: string[]; meta: FieldMeta; } interface DevtoolsPluginFormState { meta: FormMeta>; errors: FormErrors>; values: Record; isSubmitting: boolean; isValidating: boolean; submitCount: number; } interface ValidationOptions { name?: string; label?: string; values?: Record; bails?: boolean; } /** * Validates a value against the rules. */ declare function validate(value: TInput, rules: string | Record | GenericValidateFunction | GenericValidateFunction[] | TypedSchema, options?: ValidationOptions): Promise>; declare function validateObjectSchema(schema: RawFormSchema, values: TValues | undefined, opts?: Partial<{ names: Record; bailsMap: Record; }>): Promise>; /** * Adds a custom validator to the list of validation rules. */ declare function defineRule>(id: string, validator: ValidationRuleFunction | SimpleValidationRuleFunction): void; interface VeeValidateConfig { bails: boolean; generateMessage: ValidationMessageGenerator; validateOnInput: boolean; validateOnChange: boolean; validateOnBlur: boolean; validateOnModelUpdate: boolean; } declare const configure: (newConf: Partial) => void; /** * Checks if the path opted out of nested fields using `[fieldName]` syntax */ declare function isNotNestedPath(path: string): boolean; declare function cleanupNonNestedPath(path: string): string; /** * Normalizes the given rules expression. */ declare function normalizeRules(rules: undefined | string | Record>): Record>; interface FieldOptions { initialValue?: MaybeRef; validateOnValueUpdate: boolean; validateOnMount?: boolean; bails?: boolean; type?: InputType; /** * @deprecated Use `checkedValue` instead. */ valueProp?: MaybeRefOrGetter; checkedValue?: MaybeRefOrGetter; uncheckedValue?: MaybeRefOrGetter; label?: MaybeRefOrGetter; controlled?: boolean; /** * @deprecated Use `controlled` instead, controlled is opposite of standalone. */ standalone?: boolean; keepValueOnUnmount?: MaybeRefOrGetter; /** * @deprecated Pass the model prop name to `syncVModel` instead. */ modelPropName?: string; syncVModel?: boolean | string; form?: FormContext; } type RuleExpression = string | Record | GenericValidateFunction | GenericValidateFunction[] | TypedSchema | YupSchema | undefined; /** * Creates a field composite. */ declare function useField(path: MaybeRefOrGetter, rules?: MaybeRef>, opts?: Partial>): FieldContext; interface SharedBindingObject { name: string; onBlur: (e: Event) => void; onInput: (e: Event | unknown) => void; onChange: (e: Event | unknown) => void; 'onUpdate:modelValue'?: ((e: TValue) => unknown) | undefined; } interface FieldBindingObject extends SharedBindingObject { value?: TValue; checked?: boolean; } interface ComponentFieldBindingObject extends SharedBindingObject { modelValue?: TValue; } interface FieldSlotProps extends Pick { field: FieldBindingObject; componentField: ComponentFieldBindingObject; value: TValue; meta: FieldMeta; errors: string[]; errorMessage: string | undefined; handleInput: FieldContext['handleChange']; } declare const Field: { new (...args: any[]): vue.CreateComponentPublicInstance>; default: any; }; validateOnMount: { type: BooleanConstructor; default: boolean; }; validateOnBlur: { type: BooleanConstructor; default: any; }; validateOnChange: { type: BooleanConstructor; default: any; }; validateOnInput: { type: BooleanConstructor; default: any; }; validateOnModelUpdate: { type: BooleanConstructor; default: any; }; bails: { type: BooleanConstructor; default: () => boolean; }; label: { type: StringConstructor; default: any; }; uncheckedValue: { type: any; default: any; }; modelValue: { type: any; default: symbol; }; modelModifiers: { type: any; default: () => {}; }; 'onUpdate:modelValue': { type: PropType<(e: any) => unknown>; default: any; }; standalone: { type: BooleanConstructor; default: boolean; }; keepValue: { type: BooleanConstructor; default: any; }; }>>, () => VNode | vue.Slot | VNode[] | { default: () => VNode[]; }, unknown, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, vue.VNodeProps & vue.AllowedComponentProps & vue.ComponentCustomProps & Readonly>; default: any; }; validateOnMount: { type: BooleanConstructor; default: boolean; }; validateOnBlur: { type: BooleanConstructor; default: any; }; validateOnChange: { type: BooleanConstructor; default: any; }; validateOnInput: { type: BooleanConstructor; default: any; }; validateOnModelUpdate: { type: BooleanConstructor; default: any; }; bails: { type: BooleanConstructor; default: () => boolean; }; label: { type: StringConstructor; default: any; }; uncheckedValue: { type: any; default: any; }; modelValue: { type: any; default: symbol; }; modelModifiers: { type: any; default: () => {}; }; 'onUpdate:modelValue': { type: PropType<(e: any) => unknown>; default: any; }; standalone: { type: BooleanConstructor; default: boolean; }; keepValue: { type: BooleanConstructor; default: any; }; }>>, { label: string; as: string | Record; bails: boolean; uncheckedValue: any; modelValue: any; validateOnInput: boolean; validateOnChange: boolean; validateOnBlur: boolean; validateOnModelUpdate: boolean; rules: RuleExpression; validateOnMount: boolean; modelModifiers: any; 'onUpdate:modelValue': (e: any) => unknown; standalone: boolean; keepValue: boolean; }, true, {}, {}, { P: {}; B: {}; D: {}; C: {}; M: {}; Defaults: {}; }, Readonly>; default: any; }; validateOnMount: { type: BooleanConstructor; default: boolean; }; validateOnBlur: { type: BooleanConstructor; default: any; }; validateOnChange: { type: BooleanConstructor; default: any; }; validateOnInput: { type: BooleanConstructor; default: any; }; validateOnModelUpdate: { type: BooleanConstructor; default: any; }; bails: { type: BooleanConstructor; default: () => boolean; }; label: { type: StringConstructor; default: any; }; uncheckedValue: { type: any; default: any; }; modelValue: { type: any; default: symbol; }; modelModifiers: { type: any; default: () => {}; }; 'onUpdate:modelValue': { type: PropType<(e: any) => unknown>; default: any; }; standalone: { type: BooleanConstructor; default: boolean; }; keepValue: { type: BooleanConstructor; default: any; }; }>>, () => VNode | vue.Slot | VNode[] | { default: () => VNode[]; }, {}, {}, {}, { label: string; as: string | Record; bails: boolean; uncheckedValue: any; modelValue: any; validateOnInput: boolean; validateOnChange: boolean; validateOnBlur: boolean; validateOnModelUpdate: boolean; rules: RuleExpression; validateOnMount: boolean; modelModifiers: any; 'onUpdate:modelValue': (e: any) => unknown; standalone: boolean; keepValue: boolean; }>; __isFragment?: never; __isTeleport?: never; __isSuspense?: never; } & vue.ComponentOptionsBase>; default: any; }; validateOnMount: { type: BooleanConstructor; default: boolean; }; validateOnBlur: { type: BooleanConstructor; default: any; }; validateOnChange: { type: BooleanConstructor; default: any; }; validateOnInput: { type: BooleanConstructor; default: any; }; validateOnModelUpdate: { type: BooleanConstructor; default: any; }; bails: { type: BooleanConstructor; default: () => boolean; }; label: { type: StringConstructor; default: any; }; uncheckedValue: { type: any; default: any; }; modelValue: { type: any; default: symbol; }; modelModifiers: { type: any; default: () => {}; }; 'onUpdate:modelValue': { type: PropType<(e: any) => unknown>; default: any; }; standalone: { type: BooleanConstructor; default: boolean; }; keepValue: { type: BooleanConstructor; default: any; }; }>>, () => VNode | vue.Slot | VNode[] | { default: () => VNode[]; }, unknown, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, { label: string; as: string | Record; bails: boolean; uncheckedValue: any; modelValue: any; validateOnInput: boolean; validateOnChange: boolean; validateOnBlur: boolean; validateOnModelUpdate: boolean; rules: RuleExpression; validateOnMount: boolean; modelModifiers: any; 'onUpdate:modelValue': (e: any) => unknown; standalone: boolean; keepValue: boolean; }, {}, string, {}> & vue.VNodeProps & vue.AllowedComponentProps & vue.ComponentCustomProps & (new () => { value: UnwrapRef; meta: UnwrapRef; errors: UnwrapRef; errorMessage: UnwrapRef; setErrors: FieldContext['setErrors']; setTouched: FieldContext['setTouched']; reset: FieldContext['resetField']; validate: FieldContext['validate']; setValue: FieldContext['setValue']; handleChange: FieldContext['handleChange']; $slots: { default: (arg: FieldSlotProps) => VNode[]; }; }); type FormSlotProps = UnwrapRef> & { handleSubmit: (evt: Event | SubmissionHandler, onSubmit?: SubmissionHandler) => Promise; submitForm(evt?: Event): void; getValues(): TValues; getMeta(): FormMeta; getErrors(): FormErrors; }; declare const Form: { new (...args: any[]): vue.CreateComponentPublicInstance; default: string; }; validationSchema: { type: ObjectConstructor; default: any; }; initialValues: { type: ObjectConstructor; default: any; }; initialErrors: { type: ObjectConstructor; default: any; }; initialTouched: { type: ObjectConstructor; default: any; }; validateOnMount: { type: BooleanConstructor; default: boolean; }; onSubmit: { type: PropType; default: any; }; onInvalidSubmit: { type: PropType; default: any; }; keepValues: { type: BooleanConstructor; default: boolean; }; }>>, () => VNode | vue.Slot | VNode[] | { default: () => VNode[]; }, unknown, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, vue.VNodeProps & vue.AllowedComponentProps & vue.ComponentCustomProps & Readonly; default: string; }; validationSchema: { type: ObjectConstructor; default: any; }; initialValues: { type: ObjectConstructor; default: any; }; initialErrors: { type: ObjectConstructor; default: any; }; initialTouched: { type: ObjectConstructor; default: any; }; validateOnMount: { type: BooleanConstructor; default: boolean; }; onSubmit: { type: PropType; default: any; }; onInvalidSubmit: { type: PropType; default: any; }; keepValues: { type: BooleanConstructor; default: boolean; }; }>>, { onSubmit: SubmissionHandler; as: string; initialValues: Record; validateOnMount: boolean; validationSchema: Record; initialErrors: Record; initialTouched: Record; onInvalidSubmit: InvalidSubmissionHandler; keepValues: boolean; }, true, {}, {}, { P: {}; B: {}; D: {}; C: {}; M: {}; Defaults: {}; }, Readonly; default: string; }; validationSchema: { type: ObjectConstructor; default: any; }; initialValues: { type: ObjectConstructor; default: any; }; initialErrors: { type: ObjectConstructor; default: any; }; initialTouched: { type: ObjectConstructor; default: any; }; validateOnMount: { type: BooleanConstructor; default: boolean; }; onSubmit: { type: PropType; default: any; }; onInvalidSubmit: { type: PropType; default: any; }; keepValues: { type: BooleanConstructor; default: boolean; }; }>>, () => VNode | vue.Slot | VNode[] | { default: () => VNode[]; }, {}, {}, {}, { onSubmit: SubmissionHandler; as: string; initialValues: Record; validateOnMount: boolean; validationSchema: Record; initialErrors: Record; initialTouched: Record; onInvalidSubmit: InvalidSubmissionHandler; keepValues: boolean; }>; __isFragment?: never; __isTeleport?: never; __isSuspense?: never; } & vue.ComponentOptionsBase; default: string; }; validationSchema: { type: ObjectConstructor; default: any; }; initialValues: { type: ObjectConstructor; default: any; }; initialErrors: { type: ObjectConstructor; default: any; }; initialTouched: { type: ObjectConstructor; default: any; }; validateOnMount: { type: BooleanConstructor; default: boolean; }; onSubmit: { type: PropType; default: any; }; onInvalidSubmit: { type: PropType; default: any; }; keepValues: { type: BooleanConstructor; default: boolean; }; }>>, () => VNode | vue.Slot | VNode[] | { default: () => VNode[]; }, unknown, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, { onSubmit: SubmissionHandler; as: string; initialValues: Record; validateOnMount: boolean; validationSchema: Record; initialErrors: Record; initialTouched: Record; onInvalidSubmit: InvalidSubmissionHandler; keepValues: boolean; }, {}, string, {}> & vue.VNodeProps & vue.AllowedComponentProps & vue.ComponentCustomProps & (new () => { setFieldError: FormContext['setFieldError']; setErrors: FormContext['setErrors']; setFieldValue: FormContext['setFieldValue']; setValues: FormContext['setValues']; setFieldTouched: FormContext['setFieldTouched']; setTouched: FormContext['setTouched']; resetForm: FormContext['resetForm']; resetField: FormContext['resetField']; validate: FormContext['validate']; validateField: FormContext['validateField']; getValues: FormSlotProps['getValues']; getMeta: FormSlotProps['getMeta']; getErrors: FormSlotProps['getErrors']; meta: FormSlotProps['meta']; values: FormSlotProps['values']; errors: FormSlotProps['errors']; $slots: { default: (arg: FormSlotProps) => VNode[]; }; }); declare const FieldArray: { new (...args: any[]): vue.CreateComponentPublicInstance>, () => vue.Slot | VNode[] | { default: () => VNode[]; }, unknown, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, vue.VNodeProps & vue.AllowedComponentProps & vue.ComponentCustomProps & Readonly>, {}, true, {}, {}, { P: {}; B: {}; D: {}; C: {}; M: {}; Defaults: {}; }, Readonly>, () => vue.Slot | VNode[] | { default: () => VNode[]; }, {}, {}, {}, {}>; __isFragment?: never; __isTeleport?: never; __isSuspense?: never; } & vue.ComponentOptionsBase>, () => vue.Slot | VNode[] | { default: () => VNode[]; }, unknown, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, {}, {}, string, {}> & vue.VNodeProps & vue.AllowedComponentProps & vue.ComponentCustomProps & (new () => { push: FieldArrayContext['push']; remove: FieldArrayContext['remove']; swap: FieldArrayContext['swap']; insert: FieldArrayContext['insert']; update: FieldArrayContext['update']; replace: FieldArrayContext['replace']; prepend: FieldArrayContext['prepend']; move: FieldArrayContext['move']; $slots: { default: (arg: UnwrapRef) => VNode[]; }; }); interface ErrorMessageSlotProps { message: string | undefined; } declare const ErrorMessage: { new (...args: any[]): vue.CreateComponentPublicInstance>, () => VNode | vue.Slot | VNode[] | { default: () => VNode[]; }, unknown, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, vue.VNodeProps & vue.AllowedComponentProps & vue.ComponentCustomProps & Readonly>, { as: string; }, true, {}, {}, { P: {}; B: {}; D: {}; C: {}; M: {}; Defaults: {}; }, Readonly>, () => VNode | vue.Slot | VNode[] | { default: () => VNode[]; }, {}, {}, {}, { as: string; }>; __isFragment?: never; __isTeleport?: never; __isSuspense?: never; } & vue.ComponentOptionsBase>, () => VNode | vue.Slot | VNode[] | { default: () => VNode[]; }, unknown, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, { as: string; }, {}, string, {}> & vue.VNodeProps & vue.AllowedComponentProps & vue.ComponentCustomProps & (new () => { $slots: { default: (arg: ErrorMessageSlotProps) => VNode[]; }; }); type FormSchema> = FlattenAndSetPathsType | undefined; interface FormOptions | FormSchema = FormSchema | TypedSchema> { validationSchema?: MaybeRef : any>; initialValues?: PartialDeep | undefined | null; initialErrors?: FlattenAndSetPathsType; initialTouched?: FlattenAndSetPathsType; validateOnMount?: boolean; keepValuesOnUnmount?: MaybeRef; } declare function useForm | TypedSchema = FormSchema | TypedSchema>(opts?: FormOptions): FormContext; declare function useFieldArray(arrayPath: MaybeRefOrGetter): FieldArrayContext; declare function useResetForm = Record>(): (state?: Partial>, opts?: ResetFormOpts) => void; /** * If a field is dirty or not */ declare function useIsFieldDirty(path?: MaybeRefOrGetter): vue.ComputedRef; /** * If a field is touched or not */ declare function useIsFieldTouched(path?: MaybeRefOrGetter): vue.ComputedRef; /** * If a field is validated and is valid */ declare function useIsFieldValid(path?: MaybeRefOrGetter): vue.ComputedRef; /** * If the form is submitting or not */ declare function useIsSubmitting(): vue.ComputedRef; /** * If the form is validating or not */ declare function useIsValidating(): vue.ComputedRef; /** * Validates a single field */ declare function useValidateField(path?: MaybeRefOrGetter): () => Promise>; /** * If the form is dirty or not */ declare function useIsFormDirty(): vue.ComputedRef; /** * If the form is touched or not */ declare function useIsFormTouched(): vue.ComputedRef; /** * If the form has been validated and is valid */ declare function useIsFormValid(): vue.ComputedRef; /** * Validate multiple fields */ declare function useValidateForm = Record>(): () => Promise>; /** * The number of form's submission count */ declare function useSubmitCount(): vue.ComputedRef; /** * Gives access to a field's current value */ declare function useFieldValue(path?: MaybeRefOrGetter): vue.ComputedRef; /** * Gives access to a form's values */ declare function useFormValues = Record>(): vue.ComputedRef>; /** * Gives access to all form errors */ declare function useFormErrors = Record>(): vue.ComputedRef, string>>>; /** * Gives access to a single field error */ declare function useFieldError(path?: MaybeRefOrGetter): vue.ComputedRef; declare function useSubmitForm = Record>(cb: SubmissionHandler): (e?: Event) => Promise; /** * Sets a field's error message */ declare function useSetFieldError(path?: MaybeRefOrGetter): (message: string | string[] | undefined) => void; /** * Sets a field's touched meta state */ declare function useSetFieldTouched(path?: MaybeRefOrGetter): (touched: boolean) => void; /** * Sets a field's value */ declare function useSetFieldValue(path?: MaybeRefOrGetter): (value: TValue, shouldValidate?: boolean) => void; /** * Sets multiple fields errors */ declare function useSetFormErrors(): (fields: Record) => void; /** * Sets multiple fields touched or all fields in the form */ declare function useSetFormTouched(): (fields: Record | boolean) => void; /** * Sets multiple fields values */ declare function useSetFormValues = Record>(): (fields: TValues, shouldValidate?: boolean) => void; declare const FormContextKey: InjectionKey; declare const FieldContextKey: InjectionKey>; declare const IS_ABSENT: unique symbol; export { type BaseComponentBinds, type BaseFieldProps, type BaseInputBinds, type ComponentBindsConfig, type ComponentFieldBindingObject, type ComponentModelBinds, type ComponentModellessBinds, type DevtoolsPluginFieldState, type DevtoolsPluginFormState, ErrorMessage, Field, FieldArray, type FieldArrayContext, type FieldBindingObject, type FieldContext, FieldContextKey, type FieldEntry, type FieldMeta, type FieldOptions, type FieldPathLookup, type FieldState, type FieldValidator, type FlattenAndMapPathsValidationResult, type FlattenAndSetPathsType, Form, type FormActions, type FormContext, FormContextKey, type FormErrorBag, type FormErrors, type FormMeta, type FormOptions, type FormState, type FormValidationResult, type GenericObject, type GenericValidateFunction, IS_ABSENT, type InferInput, type InferOutput, type InputBindsConfig, type InputType, type InvalidSubmissionContext, type InvalidSubmissionHandler, type IsAny, type IsEqual, type LazyComponentBindsConfig, type LazyInputBindsConfig, type Locator, type MapValuesPathsToRefs, type MaybeArray, type MaybePromise, type Path, type PathState, type PathStateConfig, type PathValue, type PrivateFieldArrayContext, type PrivateFieldContext, type PrivateFormContext, type PublicPathState, type RawFormSchema, type ResetFormOpts, type RuleExpression, type SchemaValidationMode, type SubmissionContext, type SubmissionHandler, type TypedSchema, type TypedSchemaContext, type TypedSchemaError, type TypedSchemaPathDescription, type ValidationOptions$1 as ValidationOptions, type ValidationResult, type YupSchema, cleanupNonNestedPath, configure, defineRule, isNotNestedPath, normalizeRules, useField, useFieldArray, useFieldError, useFieldValue, useForm, useFormErrors, useFormValues, useIsFieldDirty, useIsFieldTouched, useIsFieldValid, useIsFormDirty, useIsFormTouched, useIsFormValid, useIsSubmitting, useIsValidating, useResetForm, useSetFieldError, useSetFieldTouched, useSetFieldValue, useSetFormErrors, useSetFormTouched, useSetFormValues, useSubmitCount, useSubmitForm, useValidateField, useValidateForm, validate, validateObjectSchema as validateObject };