formstand 0.13.0 → 0.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +40 -0
- package/README.md +86 -386
- package/dist/chunk-N7WPXYCU.js +144 -0
- package/dist/chunk-N7WPXYCU.js.map +1 -0
- package/dist/createForm-C9hZffCQ.d.cts +190 -0
- package/dist/createForm-C9hZffCQ.d.ts +190 -0
- package/dist/devtools/index.cjs +313 -0
- package/dist/devtools/index.cjs.map +1 -0
- package/dist/devtools/index.d.cts +27 -0
- package/dist/devtools/index.d.ts +27 -0
- package/dist/devtools/index.js +276 -0
- package/dist/devtools/index.js.map +1 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -188
- package/dist/index.d.ts +4 -188
- package/dist/index.js +3 -141
- package/dist/index.js.map +1 -1
- package/package.json +12 -2
package/dist/index.d.cts
CHANGED
|
@@ -1,193 +1,9 @@
|
|
|
1
|
+
import { P as PathDepth, D as DefaultPathDepth, F as Form, C as CreateFormOptions, a as FieldValidationResult, b as FormState, c as FieldPath, d as FieldValue, E as ErrorMap } from './createForm-C9hZffCQ.cjs';
|
|
2
|
+
export { B as BoolMap, e as FieldSnapshot, f as FieldsValidationResult, I as InvalidSubmitHandler, R as ReadonlyStoreApi, g as ResetOptions, S as SettledFieldValidationResult, h as SettledFieldsValidationResult, i as SettledValidationResult, j as SubmitHandler, k as SubmitOptions, l as SubmitResult, V as ValidationMode, m as ValidationResult, n as ValidationTrigger, o as createForm, p as emptyValueForSchema, q as flattenIssues, r as isAsyncRequiredError, s as shouldValidateOn, v as validateAsync, t as validateSync } from './createForm-C9hZffCQ.cjs';
|
|
1
3
|
import { z } from 'zod';
|
|
2
|
-
import { StoreApi } from 'zustand/vanilla';
|
|
3
4
|
import * as react from 'react';
|
|
4
5
|
import { ReactNode, ChangeEvent } from 'react';
|
|
5
|
-
|
|
6
|
-
type LeafType = string | number | boolean | bigint | symbol | null | undefined | Date | RegExp;
|
|
7
|
-
type IsRecord<T> = T extends LeafType ? false : T extends readonly unknown[] ? false : T extends object ? true : false;
|
|
8
|
-
type IsArray<T> = T extends readonly unknown[] ? true : false;
|
|
9
|
-
type Prev = [
|
|
10
|
-
never,
|
|
11
|
-
0,
|
|
12
|
-
1,
|
|
13
|
-
2,
|
|
14
|
-
3,
|
|
15
|
-
4,
|
|
16
|
-
5,
|
|
17
|
-
6,
|
|
18
|
-
7,
|
|
19
|
-
8,
|
|
20
|
-
9,
|
|
21
|
-
10,
|
|
22
|
-
11,
|
|
23
|
-
12,
|
|
24
|
-
13,
|
|
25
|
-
14,
|
|
26
|
-
15,
|
|
27
|
-
16,
|
|
28
|
-
17,
|
|
29
|
-
18,
|
|
30
|
-
19,
|
|
31
|
-
20,
|
|
32
|
-
21,
|
|
33
|
-
22,
|
|
34
|
-
23,
|
|
35
|
-
24
|
|
36
|
-
];
|
|
37
|
-
type DefaultPathDepth = 9;
|
|
38
|
-
type PathDepth = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25;
|
|
39
|
-
type IsUnion<T, U = T> = [T] extends [never] ? false : T extends unknown ? [U] extends [T] ? false : true : never;
|
|
40
|
-
type NormalizeDepth<D extends number> = number extends D ? DefaultPathDepth : [D] extends [PathDepth] ? IsUnion<D> extends true ? DefaultPathDepth : D : DefaultPathDepth;
|
|
41
|
-
type FieldPath<T, D extends number = DefaultPathDepth> = FieldPathRec<T, NormalizeDepth<D>>;
|
|
42
|
-
type FieldPathRec<T, D extends number> = [D] extends [0] ? never : IsArray<T> extends true ? T extends readonly (infer U)[] ? `${number}` | (IsRecord<NonNullable<U>> extends true ? `${number}.${FieldPathRec<NonNullable<U>, Prev[D]>}` : IsArray<NonNullable<U>> extends true ? `${number}.${FieldPathRec<NonNullable<U>, Prev[D]>}` : never) : never : IsRecord<T> extends true ? {
|
|
43
|
-
[K in keyof T & string]: K | (IsRecord<NonNullable<T[K]>> extends true ? `${K}.${FieldPathRec<NonNullable<T[K]>, Prev[D]>}` : IsArray<NonNullable<T[K]>> extends true ? `${K}.${FieldPathRec<NonNullable<T[K]>, Prev[D]>}` : never);
|
|
44
|
-
}[keyof T & string] : never;
|
|
45
|
-
type StepValue<T, K extends string> = T extends readonly (infer U)[] ? K extends `${number}` ? U : never : T extends object ? K extends keyof T ? T[K] : never : never;
|
|
46
|
-
type FieldValue<T, P extends string> = [T] extends [NonNullable<T>] ? P extends `${infer Head}.${infer Tail}` ? FieldValue<StepValue<T, Head>, Tail> : StepValue<T, P> : FieldValue<NonNullable<T>, P> | undefined;
|
|
47
|
-
|
|
48
|
-
type ValidationMode = "onChange" | "onBlur" | "onSubmit" | "onTouched" | "all";
|
|
49
|
-
type ValidationTrigger = "change" | "blur";
|
|
50
|
-
declare const shouldValidateOn: (trigger: ValidationTrigger, mode: ValidationMode, reValidateMode: ValidationMode, submitAttempted: boolean, touched?: boolean) => boolean;
|
|
51
|
-
|
|
52
|
-
type ErrorMap = Readonly<Record<string, readonly string[]>>;
|
|
53
|
-
type BoolMap = Readonly<Record<string, boolean>>;
|
|
54
|
-
type FormState<TValues> = Readonly<{
|
|
55
|
-
values: TValues;
|
|
56
|
-
initialValues: TValues;
|
|
57
|
-
errors: ErrorMap;
|
|
58
|
-
schemaErrors: ErrorMap;
|
|
59
|
-
serverErrors: ErrorMap;
|
|
60
|
-
touched: BoolMap;
|
|
61
|
-
isSubmitting: boolean;
|
|
62
|
-
submitCount: number;
|
|
63
|
-
isValidating: BoolMap;
|
|
64
|
-
isValidatingForm: boolean;
|
|
65
|
-
mode: ValidationMode;
|
|
66
|
-
reValidateMode: ValidationMode;
|
|
67
|
-
}>;
|
|
68
|
-
|
|
69
|
-
type SettledValidationResult<TOutput> = Readonly<{
|
|
70
|
-
kind: "valid";
|
|
71
|
-
data: TOutput;
|
|
72
|
-
}> | Readonly<{
|
|
73
|
-
kind: "invalid";
|
|
74
|
-
errors: ErrorMap;
|
|
75
|
-
}>;
|
|
76
|
-
type ValidationResult<TOutput> = SettledValidationResult<TOutput> | Readonly<{
|
|
77
|
-
kind: "pending";
|
|
78
|
-
promise: Promise<SettledValidationResult<TOutput>>;
|
|
79
|
-
}>;
|
|
80
|
-
type SettledFieldValidationResult = Readonly<{
|
|
81
|
-
kind: "valid";
|
|
82
|
-
}> | Readonly<{
|
|
83
|
-
kind: "invalid";
|
|
84
|
-
errors: readonly string[];
|
|
85
|
-
}>;
|
|
86
|
-
type FieldValidationResult = SettledFieldValidationResult | Readonly<{
|
|
87
|
-
kind: "pending";
|
|
88
|
-
promise: Promise<SettledFieldValidationResult>;
|
|
89
|
-
}>;
|
|
90
|
-
type SettledFieldsValidationResult = Readonly<{
|
|
91
|
-
kind: "valid";
|
|
92
|
-
}> | Readonly<{
|
|
93
|
-
kind: "invalid";
|
|
94
|
-
errors: ErrorMap;
|
|
95
|
-
}>;
|
|
96
|
-
type FieldsValidationResult = SettledFieldsValidationResult | Readonly<{
|
|
97
|
-
kind: "pending";
|
|
98
|
-
promise: Promise<SettledFieldsValidationResult>;
|
|
99
|
-
}>;
|
|
100
|
-
declare const flattenIssues: (issues: readonly z.core.$ZodIssue[]) => ErrorMap;
|
|
101
|
-
declare const validateSync: <TSchema extends z.ZodType>(schema: TSchema, values: z.input<TSchema>) => SettledValidationResult<z.output<TSchema>>;
|
|
102
|
-
declare const validateAsync: <TSchema extends z.ZodType>(schema: TSchema, values: z.input<TSchema>) => Promise<SettledValidationResult<z.output<TSchema>>>;
|
|
103
|
-
declare const isAsyncRequiredError: (e: unknown) => boolean;
|
|
104
|
-
declare const emptyValueForSchema: (schema: z.ZodType) => null | undefined;
|
|
105
|
-
|
|
106
|
-
type ReadonlyStoreApi<T> = Pick<StoreApi<T>, "getState" | "getInitialState" | "subscribe">;
|
|
107
|
-
type CreateFormOptions<TSchema extends z.ZodType, D extends PathDepth = DefaultPathDepth> = Readonly<{
|
|
108
|
-
initialValues: z.input<TSchema>;
|
|
109
|
-
pathDepth?: D & (IsUnion<D> extends true ? never : unknown);
|
|
110
|
-
mode?: ValidationMode;
|
|
111
|
-
reValidateMode?: ValidationMode;
|
|
112
|
-
validateOnMount?: boolean;
|
|
113
|
-
devtools?: boolean | string;
|
|
114
|
-
}>;
|
|
115
|
-
type SubmitHandler<TSchema extends z.ZodType> = (data: z.output<TSchema>) => void | Promise<void>;
|
|
116
|
-
type InvalidSubmitHandler = (errors: ErrorMap) => void;
|
|
117
|
-
type SubmitOptions = Readonly<{
|
|
118
|
-
force?: boolean;
|
|
119
|
-
}>;
|
|
120
|
-
type SubmitResult<TOutput> = Readonly<{
|
|
121
|
-
kind: "valid";
|
|
122
|
-
data: TOutput;
|
|
123
|
-
}> | Readonly<{
|
|
124
|
-
kind: "invalid";
|
|
125
|
-
errors: ErrorMap;
|
|
126
|
-
}> | Readonly<{
|
|
127
|
-
kind: "skipped";
|
|
128
|
-
}> | Readonly<{
|
|
129
|
-
kind: "error";
|
|
130
|
-
error: unknown;
|
|
131
|
-
}>;
|
|
132
|
-
type ArrayItemOf$1<T> = T extends readonly (infer U)[] ? U : never;
|
|
133
|
-
type ErrorPath<TValues, D extends PathDepth = DefaultPathDepth> = FieldPath<TValues, D> | "";
|
|
134
|
-
type ResetOptions = Readonly<{
|
|
135
|
-
keepErrors?: boolean;
|
|
136
|
-
keepTouched?: boolean;
|
|
137
|
-
keepSubmitCount?: boolean;
|
|
138
|
-
}>;
|
|
139
|
-
type FieldSnapshot<TValue> = Readonly<{
|
|
140
|
-
value: TValue;
|
|
141
|
-
error: readonly string[] | undefined;
|
|
142
|
-
touched: boolean;
|
|
143
|
-
dirty: boolean;
|
|
144
|
-
isValidating: boolean;
|
|
145
|
-
}>;
|
|
146
|
-
type Form<TSchema extends z.ZodType, D extends PathDepth = DefaultPathDepth> = Readonly<{
|
|
147
|
-
"~pathDepth"?: D;
|
|
148
|
-
schema: TSchema;
|
|
149
|
-
store: ReadonlyStoreApi<FormState<z.input<TSchema>>>;
|
|
150
|
-
getState: () => FormState<z.input<TSchema>>;
|
|
151
|
-
subscribe: (listener: (state: FormState<z.input<TSchema>>, prev: FormState<z.input<TSchema>>) => void) => () => void;
|
|
152
|
-
getField: <P extends FieldPath<z.input<TSchema>, D>>(path: P) => FieldValue<z.input<TSchema>, P>;
|
|
153
|
-
watchField: <P extends FieldPath<z.input<TSchema>, D>>(path: P, listener: (snapshot: FieldSnapshot<FieldValue<z.input<TSchema>, P>>) => void) => () => void;
|
|
154
|
-
watchValue: <P extends FieldPath<z.input<TSchema>, D>>(path: P, listener: (value: FieldValue<z.input<TSchema>, P>, previous: FieldValue<z.input<TSchema>, P>) => void) => () => void;
|
|
155
|
-
watchValues: (listener: (values: z.input<TSchema>, previous: z.input<TSchema>) => void) => () => void;
|
|
156
|
-
setValue: <P extends FieldPath<z.input<TSchema>, D>>(path: P, value: FieldValue<z.input<TSchema>, P>) => void;
|
|
157
|
-
setValues: (next: z.input<TSchema>) => void;
|
|
158
|
-
setTouched: (path: FieldPath<z.input<TSchema>, D>, touched?: boolean) => void;
|
|
159
|
-
setSubmitting: (value: boolean) => void;
|
|
160
|
-
setMode: (mode: ValidationMode) => void;
|
|
161
|
-
setReValidateMode: (mode: ValidationMode) => void;
|
|
162
|
-
setError: (path: ErrorPath<z.input<TSchema>, D>, errors: string | readonly string[]) => void;
|
|
163
|
-
setErrors: (errors: ErrorMap) => void;
|
|
164
|
-
clearErrors: (path?: ErrorPath<z.input<TSchema>, D>) => void;
|
|
165
|
-
updateState: (updater: (state: FormState<z.input<TSchema>>) => Partial<Omit<FormState<z.input<TSchema>>, "errors">>) => void;
|
|
166
|
-
reset: (nextInitial?: Partial<z.input<TSchema>>, options?: ResetOptions) => void;
|
|
167
|
-
resetField: (path: FieldPath<z.input<TSchema>, D>) => void;
|
|
168
|
-
adoptValues: (values: z.input<TSchema>) => void;
|
|
169
|
-
getFieldState: <P extends FieldPath<z.input<TSchema>, D>>(path: P) => FieldSnapshot<FieldValue<z.input<TSchema>, P>>;
|
|
170
|
-
validate: () => ValidationResult<z.output<TSchema>>;
|
|
171
|
-
validateField: (path: ErrorPath<z.input<TSchema>, D>) => FieldValidationResult;
|
|
172
|
-
validateFields: (paths: readonly FieldPath<z.input<TSchema>, D>[]) => FieldsValidationResult;
|
|
173
|
-
validateAsync: () => Promise<ValidationResult<z.output<TSchema>>>;
|
|
174
|
-
validateFieldAsync: (path: ErrorPath<z.input<TSchema>, D>) => Promise<FieldValidationResult>;
|
|
175
|
-
validateFieldsAsync: (paths: readonly FieldPath<z.input<TSchema>, D>[]) => Promise<SettledFieldsValidationResult>;
|
|
176
|
-
submit: (onValid: SubmitHandler<TSchema>, onInvalid?: InvalidSubmitHandler, options?: SubmitOptions) => Promise<SubmitResult<z.output<TSchema>>>;
|
|
177
|
-
arrayPush: <P extends FieldPath<z.input<TSchema>, D>>(path: P, item: ArrayItemOf$1<NonNullable<FieldValue<z.input<TSchema>, P>>>) => void;
|
|
178
|
-
arrayRemove: (path: FieldPath<z.input<TSchema>, D>, index: number) => void;
|
|
179
|
-
arrayInsert: <P extends FieldPath<z.input<TSchema>, D>>(path: P, index: number, item: ArrayItemOf$1<NonNullable<FieldValue<z.input<TSchema>, P>>>) => void;
|
|
180
|
-
arrayMove: (path: FieldPath<z.input<TSchema>, D>, from: number, to: number) => void;
|
|
181
|
-
arraySwap: (path: FieldPath<z.input<TSchema>, D>, a: number, b: number) => void;
|
|
182
|
-
handleSubmit: (onValid: SubmitHandler<TSchema>, onInvalid?: InvalidSubmitHandler, options?: SubmitOptions) => (event?: {
|
|
183
|
-
preventDefault: () => void;
|
|
184
|
-
}) => Promise<SubmitResult<z.output<TSchema>>>;
|
|
185
|
-
diff: () => Readonly<Record<string, unknown>>;
|
|
186
|
-
dirtyFields: () => readonly string[];
|
|
187
|
-
snapshot: () => FormState<z.input<TSchema>>;
|
|
188
|
-
restore: (snapshot: FormState<z.input<TSchema>>) => void;
|
|
189
|
-
}>;
|
|
190
|
-
declare const createForm: <TSchema extends z.ZodType, D extends PathDepth = DefaultPathDepth>(schema: TSchema, options: CreateFormOptions<TSchema, D>) => Form<TSchema, D>;
|
|
6
|
+
import { StoreApi } from 'zustand/vanilla';
|
|
191
7
|
|
|
192
8
|
type PathSegment = string | number;
|
|
193
9
|
declare const parsePath: (path: string) => readonly PathSegment[];
|
|
@@ -524,4 +340,4 @@ declare const dateInputProps: <T extends Date | null | undefined>(field: UseFiel
|
|
|
524
340
|
declare const checkboxProps: <T extends boolean | null | undefined>(field: UseFieldReturn<T>) => CheckboxProps;
|
|
525
341
|
declare const selectProps: <T extends string | null | undefined>(field: UseFieldReturn<T>) => SelectProps;
|
|
526
342
|
|
|
527
|
-
export { type
|
|
343
|
+
export { type BoundUseField, type BoundUseFieldArray, type BoundUseFlag, type BoundUseSelector, CheckboxField, type CheckboxFieldProps, type CheckboxProps, CreateFormOptions, DateField, type DateFieldProps, type DateInputProps, DefaultPathDepth, ErrorMap, type FieldArrayEntry, type FieldArrayFormApi, type FieldFormApi, FieldPath, type FieldPathArg, type FieldRef, FieldValidationResult, FieldValue, Form, type FormContextApi, type FormHooks, type FormProviderProps, FormState, type FormStateApi, NumberField, type NumberFieldProps, type NumberInputBinding, type NumberInputProps, type ParsedDateText, type ParsedNumberText, PathDepth, type PathSegment, type PathsOf, type PersistHandle, type PersistOptions, type PersistStorage, SelectField, type SelectFieldOption, type SelectFieldProps, type SelectProps, TextField, type TextFieldProps, type TextInputProps, type UseFieldArrayReturn, type UseFieldOptions, type UseFieldReturn, checkboxProps, createFormContext, createFormHooks, dateInputProps, dateToInputText, focusField, focusFirstError, getAtPath, hasFieldError, numberInputProps, numberToInputText, parseDateText, parseNumberText, parsePath, persistForm, selectProps, setAtPath, textInputProps, useField, useFieldArray, useForm, useFormError, useFormSelector, useFormSelectorShallow, useFormValues, useIsDirty, useIsSubmitting, useIsValid, useNumberInput, useSubmitCount, useVariantField };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,193 +1,9 @@
|
|
|
1
|
+
import { P as PathDepth, D as DefaultPathDepth, F as Form, C as CreateFormOptions, a as FieldValidationResult, b as FormState, c as FieldPath, d as FieldValue, E as ErrorMap } from './createForm-C9hZffCQ.js';
|
|
2
|
+
export { B as BoolMap, e as FieldSnapshot, f as FieldsValidationResult, I as InvalidSubmitHandler, R as ReadonlyStoreApi, g as ResetOptions, S as SettledFieldValidationResult, h as SettledFieldsValidationResult, i as SettledValidationResult, j as SubmitHandler, k as SubmitOptions, l as SubmitResult, V as ValidationMode, m as ValidationResult, n as ValidationTrigger, o as createForm, p as emptyValueForSchema, q as flattenIssues, r as isAsyncRequiredError, s as shouldValidateOn, v as validateAsync, t as validateSync } from './createForm-C9hZffCQ.js';
|
|
1
3
|
import { z } from 'zod';
|
|
2
|
-
import { StoreApi } from 'zustand/vanilla';
|
|
3
4
|
import * as react from 'react';
|
|
4
5
|
import { ReactNode, ChangeEvent } from 'react';
|
|
5
|
-
|
|
6
|
-
type LeafType = string | number | boolean | bigint | symbol | null | undefined | Date | RegExp;
|
|
7
|
-
type IsRecord<T> = T extends LeafType ? false : T extends readonly unknown[] ? false : T extends object ? true : false;
|
|
8
|
-
type IsArray<T> = T extends readonly unknown[] ? true : false;
|
|
9
|
-
type Prev = [
|
|
10
|
-
never,
|
|
11
|
-
0,
|
|
12
|
-
1,
|
|
13
|
-
2,
|
|
14
|
-
3,
|
|
15
|
-
4,
|
|
16
|
-
5,
|
|
17
|
-
6,
|
|
18
|
-
7,
|
|
19
|
-
8,
|
|
20
|
-
9,
|
|
21
|
-
10,
|
|
22
|
-
11,
|
|
23
|
-
12,
|
|
24
|
-
13,
|
|
25
|
-
14,
|
|
26
|
-
15,
|
|
27
|
-
16,
|
|
28
|
-
17,
|
|
29
|
-
18,
|
|
30
|
-
19,
|
|
31
|
-
20,
|
|
32
|
-
21,
|
|
33
|
-
22,
|
|
34
|
-
23,
|
|
35
|
-
24
|
|
36
|
-
];
|
|
37
|
-
type DefaultPathDepth = 9;
|
|
38
|
-
type PathDepth = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25;
|
|
39
|
-
type IsUnion<T, U = T> = [T] extends [never] ? false : T extends unknown ? [U] extends [T] ? false : true : never;
|
|
40
|
-
type NormalizeDepth<D extends number> = number extends D ? DefaultPathDepth : [D] extends [PathDepth] ? IsUnion<D> extends true ? DefaultPathDepth : D : DefaultPathDepth;
|
|
41
|
-
type FieldPath<T, D extends number = DefaultPathDepth> = FieldPathRec<T, NormalizeDepth<D>>;
|
|
42
|
-
type FieldPathRec<T, D extends number> = [D] extends [0] ? never : IsArray<T> extends true ? T extends readonly (infer U)[] ? `${number}` | (IsRecord<NonNullable<U>> extends true ? `${number}.${FieldPathRec<NonNullable<U>, Prev[D]>}` : IsArray<NonNullable<U>> extends true ? `${number}.${FieldPathRec<NonNullable<U>, Prev[D]>}` : never) : never : IsRecord<T> extends true ? {
|
|
43
|
-
[K in keyof T & string]: K | (IsRecord<NonNullable<T[K]>> extends true ? `${K}.${FieldPathRec<NonNullable<T[K]>, Prev[D]>}` : IsArray<NonNullable<T[K]>> extends true ? `${K}.${FieldPathRec<NonNullable<T[K]>, Prev[D]>}` : never);
|
|
44
|
-
}[keyof T & string] : never;
|
|
45
|
-
type StepValue<T, K extends string> = T extends readonly (infer U)[] ? K extends `${number}` ? U : never : T extends object ? K extends keyof T ? T[K] : never : never;
|
|
46
|
-
type FieldValue<T, P extends string> = [T] extends [NonNullable<T>] ? P extends `${infer Head}.${infer Tail}` ? FieldValue<StepValue<T, Head>, Tail> : StepValue<T, P> : FieldValue<NonNullable<T>, P> | undefined;
|
|
47
|
-
|
|
48
|
-
type ValidationMode = "onChange" | "onBlur" | "onSubmit" | "onTouched" | "all";
|
|
49
|
-
type ValidationTrigger = "change" | "blur";
|
|
50
|
-
declare const shouldValidateOn: (trigger: ValidationTrigger, mode: ValidationMode, reValidateMode: ValidationMode, submitAttempted: boolean, touched?: boolean) => boolean;
|
|
51
|
-
|
|
52
|
-
type ErrorMap = Readonly<Record<string, readonly string[]>>;
|
|
53
|
-
type BoolMap = Readonly<Record<string, boolean>>;
|
|
54
|
-
type FormState<TValues> = Readonly<{
|
|
55
|
-
values: TValues;
|
|
56
|
-
initialValues: TValues;
|
|
57
|
-
errors: ErrorMap;
|
|
58
|
-
schemaErrors: ErrorMap;
|
|
59
|
-
serverErrors: ErrorMap;
|
|
60
|
-
touched: BoolMap;
|
|
61
|
-
isSubmitting: boolean;
|
|
62
|
-
submitCount: number;
|
|
63
|
-
isValidating: BoolMap;
|
|
64
|
-
isValidatingForm: boolean;
|
|
65
|
-
mode: ValidationMode;
|
|
66
|
-
reValidateMode: ValidationMode;
|
|
67
|
-
}>;
|
|
68
|
-
|
|
69
|
-
type SettledValidationResult<TOutput> = Readonly<{
|
|
70
|
-
kind: "valid";
|
|
71
|
-
data: TOutput;
|
|
72
|
-
}> | Readonly<{
|
|
73
|
-
kind: "invalid";
|
|
74
|
-
errors: ErrorMap;
|
|
75
|
-
}>;
|
|
76
|
-
type ValidationResult<TOutput> = SettledValidationResult<TOutput> | Readonly<{
|
|
77
|
-
kind: "pending";
|
|
78
|
-
promise: Promise<SettledValidationResult<TOutput>>;
|
|
79
|
-
}>;
|
|
80
|
-
type SettledFieldValidationResult = Readonly<{
|
|
81
|
-
kind: "valid";
|
|
82
|
-
}> | Readonly<{
|
|
83
|
-
kind: "invalid";
|
|
84
|
-
errors: readonly string[];
|
|
85
|
-
}>;
|
|
86
|
-
type FieldValidationResult = SettledFieldValidationResult | Readonly<{
|
|
87
|
-
kind: "pending";
|
|
88
|
-
promise: Promise<SettledFieldValidationResult>;
|
|
89
|
-
}>;
|
|
90
|
-
type SettledFieldsValidationResult = Readonly<{
|
|
91
|
-
kind: "valid";
|
|
92
|
-
}> | Readonly<{
|
|
93
|
-
kind: "invalid";
|
|
94
|
-
errors: ErrorMap;
|
|
95
|
-
}>;
|
|
96
|
-
type FieldsValidationResult = SettledFieldsValidationResult | Readonly<{
|
|
97
|
-
kind: "pending";
|
|
98
|
-
promise: Promise<SettledFieldsValidationResult>;
|
|
99
|
-
}>;
|
|
100
|
-
declare const flattenIssues: (issues: readonly z.core.$ZodIssue[]) => ErrorMap;
|
|
101
|
-
declare const validateSync: <TSchema extends z.ZodType>(schema: TSchema, values: z.input<TSchema>) => SettledValidationResult<z.output<TSchema>>;
|
|
102
|
-
declare const validateAsync: <TSchema extends z.ZodType>(schema: TSchema, values: z.input<TSchema>) => Promise<SettledValidationResult<z.output<TSchema>>>;
|
|
103
|
-
declare const isAsyncRequiredError: (e: unknown) => boolean;
|
|
104
|
-
declare const emptyValueForSchema: (schema: z.ZodType) => null | undefined;
|
|
105
|
-
|
|
106
|
-
type ReadonlyStoreApi<T> = Pick<StoreApi<T>, "getState" | "getInitialState" | "subscribe">;
|
|
107
|
-
type CreateFormOptions<TSchema extends z.ZodType, D extends PathDepth = DefaultPathDepth> = Readonly<{
|
|
108
|
-
initialValues: z.input<TSchema>;
|
|
109
|
-
pathDepth?: D & (IsUnion<D> extends true ? never : unknown);
|
|
110
|
-
mode?: ValidationMode;
|
|
111
|
-
reValidateMode?: ValidationMode;
|
|
112
|
-
validateOnMount?: boolean;
|
|
113
|
-
devtools?: boolean | string;
|
|
114
|
-
}>;
|
|
115
|
-
type SubmitHandler<TSchema extends z.ZodType> = (data: z.output<TSchema>) => void | Promise<void>;
|
|
116
|
-
type InvalidSubmitHandler = (errors: ErrorMap) => void;
|
|
117
|
-
type SubmitOptions = Readonly<{
|
|
118
|
-
force?: boolean;
|
|
119
|
-
}>;
|
|
120
|
-
type SubmitResult<TOutput> = Readonly<{
|
|
121
|
-
kind: "valid";
|
|
122
|
-
data: TOutput;
|
|
123
|
-
}> | Readonly<{
|
|
124
|
-
kind: "invalid";
|
|
125
|
-
errors: ErrorMap;
|
|
126
|
-
}> | Readonly<{
|
|
127
|
-
kind: "skipped";
|
|
128
|
-
}> | Readonly<{
|
|
129
|
-
kind: "error";
|
|
130
|
-
error: unknown;
|
|
131
|
-
}>;
|
|
132
|
-
type ArrayItemOf$1<T> = T extends readonly (infer U)[] ? U : never;
|
|
133
|
-
type ErrorPath<TValues, D extends PathDepth = DefaultPathDepth> = FieldPath<TValues, D> | "";
|
|
134
|
-
type ResetOptions = Readonly<{
|
|
135
|
-
keepErrors?: boolean;
|
|
136
|
-
keepTouched?: boolean;
|
|
137
|
-
keepSubmitCount?: boolean;
|
|
138
|
-
}>;
|
|
139
|
-
type FieldSnapshot<TValue> = Readonly<{
|
|
140
|
-
value: TValue;
|
|
141
|
-
error: readonly string[] | undefined;
|
|
142
|
-
touched: boolean;
|
|
143
|
-
dirty: boolean;
|
|
144
|
-
isValidating: boolean;
|
|
145
|
-
}>;
|
|
146
|
-
type Form<TSchema extends z.ZodType, D extends PathDepth = DefaultPathDepth> = Readonly<{
|
|
147
|
-
"~pathDepth"?: D;
|
|
148
|
-
schema: TSchema;
|
|
149
|
-
store: ReadonlyStoreApi<FormState<z.input<TSchema>>>;
|
|
150
|
-
getState: () => FormState<z.input<TSchema>>;
|
|
151
|
-
subscribe: (listener: (state: FormState<z.input<TSchema>>, prev: FormState<z.input<TSchema>>) => void) => () => void;
|
|
152
|
-
getField: <P extends FieldPath<z.input<TSchema>, D>>(path: P) => FieldValue<z.input<TSchema>, P>;
|
|
153
|
-
watchField: <P extends FieldPath<z.input<TSchema>, D>>(path: P, listener: (snapshot: FieldSnapshot<FieldValue<z.input<TSchema>, P>>) => void) => () => void;
|
|
154
|
-
watchValue: <P extends FieldPath<z.input<TSchema>, D>>(path: P, listener: (value: FieldValue<z.input<TSchema>, P>, previous: FieldValue<z.input<TSchema>, P>) => void) => () => void;
|
|
155
|
-
watchValues: (listener: (values: z.input<TSchema>, previous: z.input<TSchema>) => void) => () => void;
|
|
156
|
-
setValue: <P extends FieldPath<z.input<TSchema>, D>>(path: P, value: FieldValue<z.input<TSchema>, P>) => void;
|
|
157
|
-
setValues: (next: z.input<TSchema>) => void;
|
|
158
|
-
setTouched: (path: FieldPath<z.input<TSchema>, D>, touched?: boolean) => void;
|
|
159
|
-
setSubmitting: (value: boolean) => void;
|
|
160
|
-
setMode: (mode: ValidationMode) => void;
|
|
161
|
-
setReValidateMode: (mode: ValidationMode) => void;
|
|
162
|
-
setError: (path: ErrorPath<z.input<TSchema>, D>, errors: string | readonly string[]) => void;
|
|
163
|
-
setErrors: (errors: ErrorMap) => void;
|
|
164
|
-
clearErrors: (path?: ErrorPath<z.input<TSchema>, D>) => void;
|
|
165
|
-
updateState: (updater: (state: FormState<z.input<TSchema>>) => Partial<Omit<FormState<z.input<TSchema>>, "errors">>) => void;
|
|
166
|
-
reset: (nextInitial?: Partial<z.input<TSchema>>, options?: ResetOptions) => void;
|
|
167
|
-
resetField: (path: FieldPath<z.input<TSchema>, D>) => void;
|
|
168
|
-
adoptValues: (values: z.input<TSchema>) => void;
|
|
169
|
-
getFieldState: <P extends FieldPath<z.input<TSchema>, D>>(path: P) => FieldSnapshot<FieldValue<z.input<TSchema>, P>>;
|
|
170
|
-
validate: () => ValidationResult<z.output<TSchema>>;
|
|
171
|
-
validateField: (path: ErrorPath<z.input<TSchema>, D>) => FieldValidationResult;
|
|
172
|
-
validateFields: (paths: readonly FieldPath<z.input<TSchema>, D>[]) => FieldsValidationResult;
|
|
173
|
-
validateAsync: () => Promise<ValidationResult<z.output<TSchema>>>;
|
|
174
|
-
validateFieldAsync: (path: ErrorPath<z.input<TSchema>, D>) => Promise<FieldValidationResult>;
|
|
175
|
-
validateFieldsAsync: (paths: readonly FieldPath<z.input<TSchema>, D>[]) => Promise<SettledFieldsValidationResult>;
|
|
176
|
-
submit: (onValid: SubmitHandler<TSchema>, onInvalid?: InvalidSubmitHandler, options?: SubmitOptions) => Promise<SubmitResult<z.output<TSchema>>>;
|
|
177
|
-
arrayPush: <P extends FieldPath<z.input<TSchema>, D>>(path: P, item: ArrayItemOf$1<NonNullable<FieldValue<z.input<TSchema>, P>>>) => void;
|
|
178
|
-
arrayRemove: (path: FieldPath<z.input<TSchema>, D>, index: number) => void;
|
|
179
|
-
arrayInsert: <P extends FieldPath<z.input<TSchema>, D>>(path: P, index: number, item: ArrayItemOf$1<NonNullable<FieldValue<z.input<TSchema>, P>>>) => void;
|
|
180
|
-
arrayMove: (path: FieldPath<z.input<TSchema>, D>, from: number, to: number) => void;
|
|
181
|
-
arraySwap: (path: FieldPath<z.input<TSchema>, D>, a: number, b: number) => void;
|
|
182
|
-
handleSubmit: (onValid: SubmitHandler<TSchema>, onInvalid?: InvalidSubmitHandler, options?: SubmitOptions) => (event?: {
|
|
183
|
-
preventDefault: () => void;
|
|
184
|
-
}) => Promise<SubmitResult<z.output<TSchema>>>;
|
|
185
|
-
diff: () => Readonly<Record<string, unknown>>;
|
|
186
|
-
dirtyFields: () => readonly string[];
|
|
187
|
-
snapshot: () => FormState<z.input<TSchema>>;
|
|
188
|
-
restore: (snapshot: FormState<z.input<TSchema>>) => void;
|
|
189
|
-
}>;
|
|
190
|
-
declare const createForm: <TSchema extends z.ZodType, D extends PathDepth = DefaultPathDepth>(schema: TSchema, options: CreateFormOptions<TSchema, D>) => Form<TSchema, D>;
|
|
6
|
+
import { StoreApi } from 'zustand/vanilla';
|
|
191
7
|
|
|
192
8
|
type PathSegment = string | number;
|
|
193
9
|
declare const parsePath: (path: string) => readonly PathSegment[];
|
|
@@ -524,4 +340,4 @@ declare const dateInputProps: <T extends Date | null | undefined>(field: UseFiel
|
|
|
524
340
|
declare const checkboxProps: <T extends boolean | null | undefined>(field: UseFieldReturn<T>) => CheckboxProps;
|
|
525
341
|
declare const selectProps: <T extends string | null | undefined>(field: UseFieldReturn<T>) => SelectProps;
|
|
526
342
|
|
|
527
|
-
export { type
|
|
343
|
+
export { type BoundUseField, type BoundUseFieldArray, type BoundUseFlag, type BoundUseSelector, CheckboxField, type CheckboxFieldProps, type CheckboxProps, CreateFormOptions, DateField, type DateFieldProps, type DateInputProps, DefaultPathDepth, ErrorMap, type FieldArrayEntry, type FieldArrayFormApi, type FieldFormApi, FieldPath, type FieldPathArg, type FieldRef, FieldValidationResult, FieldValue, Form, type FormContextApi, type FormHooks, type FormProviderProps, FormState, type FormStateApi, NumberField, type NumberFieldProps, type NumberInputBinding, type NumberInputProps, type ParsedDateText, type ParsedNumberText, PathDepth, type PathSegment, type PathsOf, type PersistHandle, type PersistOptions, type PersistStorage, SelectField, type SelectFieldOption, type SelectFieldProps, type SelectProps, TextField, type TextFieldProps, type TextInputProps, type UseFieldArrayReturn, type UseFieldOptions, type UseFieldReturn, checkboxProps, createFormContext, createFormHooks, dateInputProps, dateToInputText, focusField, focusFirstError, getAtPath, hasFieldError, numberInputProps, numberToInputText, parseDateText, parseNumberText, parsePath, persistForm, selectProps, setAtPath, textInputProps, useField, useFieldArray, useForm, useFormError, useFormSelector, useFormSelectorShallow, useFormValues, useIsDirty, useIsSubmitting, useIsValid, useNumberInput, useSubmitCount, useVariantField };
|
package/dist/index.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { getAtPath, slotAtPath, setAtPath, isPlainObject, hasOwnSlot, valuesEqual, isFieldDirty, useFormSelector, useFormSelectorShallow, parsePath } from './chunk-N7WPXYCU.js';
|
|
2
|
+
export { getAtPath, parsePath, setAtPath, useFormSelector, useFormSelectorShallow } from './chunk-N7WPXYCU.js';
|
|
1
3
|
import { createStore } from 'zustand/vanilla';
|
|
2
4
|
import { devtools } from 'zustand/middleware';
|
|
3
5
|
import { z } from 'zod';
|
|
@@ -6,8 +8,6 @@ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
|
6
8
|
import { useStore } from 'zustand/react';
|
|
7
9
|
import { useShallow } from 'zustand/react/shallow';
|
|
8
10
|
|
|
9
|
-
// src/core/createForm.ts
|
|
10
|
-
|
|
11
11
|
// src/core/array.ts
|
|
12
12
|
var removeAt = (i) => (n) => n === i ? null : n > i ? n - 1 : n;
|
|
13
13
|
var insertAt = (i) => (n) => n >= i ? n + 1 : n;
|
|
@@ -101,138 +101,6 @@ var clearArrayOpsUnder = (store, path, keepSelf = false) => {
|
|
|
101
101
|
);
|
|
102
102
|
related.forEach((p) => byPath.delete(p));
|
|
103
103
|
};
|
|
104
|
-
|
|
105
|
-
// src/core/equality.ts
|
|
106
|
-
var isPlainObject = (v) => {
|
|
107
|
-
if (typeof v !== "object" || v === null) return false;
|
|
108
|
-
const proto = Object.getPrototypeOf(v);
|
|
109
|
-
return proto === Object.prototype || proto === null;
|
|
110
|
-
};
|
|
111
|
-
var valuesEqual = (a, b) => {
|
|
112
|
-
if (Object.is(a, b)) return true;
|
|
113
|
-
if (a instanceof Date && b instanceof Date) {
|
|
114
|
-
return a.getTime() === b.getTime();
|
|
115
|
-
}
|
|
116
|
-
if (Array.isArray(a) && Array.isArray(b)) {
|
|
117
|
-
return a.length === b.length && a.every((v, i) => valuesEqual(v, b[i]));
|
|
118
|
-
}
|
|
119
|
-
if (isPlainObject(a) && isPlainObject(b)) {
|
|
120
|
-
const aKeys = Object.keys(a);
|
|
121
|
-
const bKeys = Object.keys(b);
|
|
122
|
-
return aKeys.length === bKeys.length && aKeys.every((k) => Object.hasOwn(b, k) && valuesEqual(a[k], b[k]));
|
|
123
|
-
}
|
|
124
|
-
return false;
|
|
125
|
-
};
|
|
126
|
-
var dirtyCache = /* @__PURE__ */ new WeakMap();
|
|
127
|
-
var MAX_VERDICTS = 4;
|
|
128
|
-
var isFieldDirty = (value, initialValue) => {
|
|
129
|
-
if (Object.is(value, initialValue)) return false;
|
|
130
|
-
if (typeof value !== "object" || value === null) {
|
|
131
|
-
return !valuesEqual(value, initialValue);
|
|
132
|
-
}
|
|
133
|
-
const cached = dirtyCache.get(value) ?? [];
|
|
134
|
-
const hit = cached.find((v) => Object.is(v.initial, initialValue));
|
|
135
|
-
if (hit !== void 0) return hit.dirty;
|
|
136
|
-
const dirty = !valuesEqual(value, initialValue);
|
|
137
|
-
dirtyCache.set(
|
|
138
|
-
value,
|
|
139
|
-
[{ initial: initialValue, dirty }, ...cached].slice(0, MAX_VERDICTS)
|
|
140
|
-
);
|
|
141
|
-
return dirty;
|
|
142
|
-
};
|
|
143
|
-
|
|
144
|
-
// src/core/path.ts
|
|
145
|
-
var MAX_ARRAY_INDEX = 1e5;
|
|
146
|
-
var isIndexSegment = (s) => {
|
|
147
|
-
const n = Number(s);
|
|
148
|
-
return Number.isInteger(n) && n >= 0 && String(n) === s;
|
|
149
|
-
};
|
|
150
|
-
var PARSE_CACHE_MAX = 4096;
|
|
151
|
-
var parseCache = /* @__PURE__ */ new Map();
|
|
152
|
-
var parsePath = (path) => {
|
|
153
|
-
const cached = parseCache.get(path);
|
|
154
|
-
if (cached !== void 0) return cached;
|
|
155
|
-
const segments = Object.freeze(
|
|
156
|
-
path === "" ? [] : path.split(".").map((s) => isIndexSegment(s) ? Number(s) : s)
|
|
157
|
-
);
|
|
158
|
-
if (parseCache.size >= PARSE_CACHE_MAX) parseCache.clear();
|
|
159
|
-
parseCache.set(path, segments);
|
|
160
|
-
return segments;
|
|
161
|
-
};
|
|
162
|
-
var isPlainRecord = (value) => value !== null && typeof value === "object" && !Array.isArray(value);
|
|
163
|
-
var readSegment = (obj, segment) => {
|
|
164
|
-
if (obj == null) return void 0;
|
|
165
|
-
if (Array.isArray(obj)) {
|
|
166
|
-
return typeof segment === "number" ? obj[segment] : void 0;
|
|
167
|
-
}
|
|
168
|
-
return isPlainRecord(obj) && Object.hasOwn(obj, String(segment)) ? obj[String(segment)] : void 0;
|
|
169
|
-
};
|
|
170
|
-
var getAtPath = (obj, path) => parsePath(path).reduce(readSegment, obj);
|
|
171
|
-
var slotAtPath = (obj, path) => {
|
|
172
|
-
const walked = parsePath(path).reduce(
|
|
173
|
-
(acc, segment) => {
|
|
174
|
-
const container = acc.current;
|
|
175
|
-
const addressable = typeof segment === "number" ? Array.isArray(container) ? segment < container.length : isPlainRecord(container) : isPlainRecord(container);
|
|
176
|
-
return !acc.ok || !addressable ? { ok: false, current: void 0 } : { ok: true, current: readSegment(container, segment) };
|
|
177
|
-
},
|
|
178
|
-
{ ok: true, current: obj }
|
|
179
|
-
);
|
|
180
|
-
return walked.ok ? { exists: true, value: walked.current } : { exists: false };
|
|
181
|
-
};
|
|
182
|
-
var hasOwnSlot = (obj, path) => parsePath(path).reduce(
|
|
183
|
-
(acc, segment) => {
|
|
184
|
-
const container = acc.current;
|
|
185
|
-
const owns = Array.isArray(container) ? typeof segment === "number" && segment < container.length : isPlainRecord(container) && Object.hasOwn(container, String(segment));
|
|
186
|
-
return !acc.ok || !owns ? { ok: false, current: void 0 } : { ok: true, current: readSegment(container, segment) };
|
|
187
|
-
},
|
|
188
|
-
{ ok: true, current: obj }
|
|
189
|
-
).ok;
|
|
190
|
-
var writeIntoArray = (arr, index, rest, value) => {
|
|
191
|
-
const length = Math.max(arr.length, index + 1);
|
|
192
|
-
return Array.from(
|
|
193
|
-
{ length },
|
|
194
|
-
(_, i) => i === index ? writeSegments(arr[i], rest, value) : arr[i]
|
|
195
|
-
);
|
|
196
|
-
};
|
|
197
|
-
var refusesHugeIndex = (index) => {
|
|
198
|
-
if (index > MAX_ARRAY_INDEX) {
|
|
199
|
-
console.warn(
|
|
200
|
-
`[formstand] refusing to write array index ${index} (max ${MAX_ARRAY_INDEX}); value left unchanged.`
|
|
201
|
-
);
|
|
202
|
-
return true;
|
|
203
|
-
}
|
|
204
|
-
return false;
|
|
205
|
-
};
|
|
206
|
-
var writeSegments = (obj, segments, value) => {
|
|
207
|
-
const [head, ...rest] = segments;
|
|
208
|
-
if (head === void 0) return value;
|
|
209
|
-
if (Array.isArray(obj)) {
|
|
210
|
-
if (typeof head !== "number") {
|
|
211
|
-
console.warn(
|
|
212
|
-
`[formstand] cannot write string key "${head}" into an array; value left unchanged.`
|
|
213
|
-
);
|
|
214
|
-
return obj;
|
|
215
|
-
}
|
|
216
|
-
if (refusesHugeIndex(head)) return obj;
|
|
217
|
-
return writeIntoArray(obj, head, rest, value);
|
|
218
|
-
}
|
|
219
|
-
if (isPlainRecord(obj)) {
|
|
220
|
-
if (!isPlainObject(obj)) {
|
|
221
|
-
console.warn(
|
|
222
|
-
`[formstand] cannot write key "${String(head)}" through a non-plain object (Date/Map/Set/class instance); value left unchanged.`
|
|
223
|
-
);
|
|
224
|
-
return obj;
|
|
225
|
-
}
|
|
226
|
-
const key = String(head);
|
|
227
|
-
return { ...obj, [key]: writeSegments(obj[key], rest, value) };
|
|
228
|
-
}
|
|
229
|
-
if (typeof head === "number") {
|
|
230
|
-
if (refusesHugeIndex(head)) return obj;
|
|
231
|
-
return writeIntoArray([], head, rest, value);
|
|
232
|
-
}
|
|
233
|
-
return { [head]: writeSegments(void 0, rest, value) };
|
|
234
|
-
};
|
|
235
|
-
var setAtPath = (obj, path, value) => writeSegments(obj, parsePath(path), value);
|
|
236
104
|
var issuePathToFormPath = (path) => path.filter((segment) => typeof segment !== "symbol").join(".");
|
|
237
105
|
var expandIssue = (issue, prefix) => {
|
|
238
106
|
const at = [...prefix, ...issue.path];
|
|
@@ -1582,12 +1450,6 @@ function useIsValid(form, path) {
|
|
|
1582
1450
|
}
|
|
1583
1451
|
var useIsSubmitting = (form) => useStore(form.store, (state) => state.isSubmitting);
|
|
1584
1452
|
var useSubmitCount = (form) => useStore(form.store, (state) => state.submitCount);
|
|
1585
|
-
function useFormSelector(form, selector) {
|
|
1586
|
-
return useStore(form.store, selector);
|
|
1587
|
-
}
|
|
1588
|
-
function useFormSelectorShallow(form, selector) {
|
|
1589
|
-
return useStore(form.store, useShallow(selector));
|
|
1590
|
-
}
|
|
1591
1453
|
|
|
1592
1454
|
// src/react/createFormHooks.ts
|
|
1593
1455
|
var capitalize = (name) => name.length === 0 ? name : name.charAt(0).toUpperCase() + name.slice(1);
|
|
@@ -2013,6 +1875,6 @@ var focusField = (path, root) => {
|
|
|
2013
1875
|
return path === "" ? (root !== void 0 || document.querySelectorAll("form").length <= 1) && focusFirstOf(namedControls(scope).filter(isFocusCandidate)) : focusFirstOf(pathCandidates(scope, [path]).filter(isFocusCandidate));
|
|
2014
1876
|
};
|
|
2015
1877
|
|
|
2016
|
-
export { CheckboxField, DateField, NumberField, SelectField, TextField, checkboxProps, createForm, createFormContext, createFormHooks, dateInputProps, dateToInputText, emptyValueForSchema, flattenIssues, focusField, focusFirstError,
|
|
1878
|
+
export { CheckboxField, DateField, NumberField, SelectField, TextField, checkboxProps, createForm, createFormContext, createFormHooks, dateInputProps, dateToInputText, emptyValueForSchema, flattenIssues, focusField, focusFirstError, hasFieldError, isAsyncRequiredError, numberInputProps, numberToInputText, parseDateText, parseNumberText, persistForm, selectProps, shouldValidateOn, textInputProps, useField, useFieldArray, useForm, useFormError, useFormValues, useIsDirty, useIsSubmitting, useIsValid, useNumberInput, useSubmitCount, useVariantField, validateAsync, validateSync };
|
|
2017
1879
|
//# sourceMappingURL=index.js.map
|
|
2018
1880
|
//# sourceMappingURL=index.js.map
|