formstand 0.21.0 → 0.22.1
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 +430 -0
- package/README.md +2 -1
- package/dist/{chunk-OB23TUKY.js → chunk-BMXIZEI4.js} +14 -4
- package/dist/chunk-BMXIZEI4.js.map +1 -0
- package/dist/{chunk-MQ6262S3.js → chunk-V3PDMTPP.js} +7 -3
- package/dist/chunk-V3PDMTPP.js.map +1 -0
- package/dist/{createForm-B73p1TgL.d.cts → createForm-BJum0RBu.d.cts} +10 -7
- package/dist/{createForm-B73p1TgL.d.ts → createForm-BJum0RBu.d.ts} +10 -7
- package/dist/devtools/index.cjs +8 -2
- package/dist/devtools/index.cjs.map +1 -1
- package/dist/devtools/index.d.cts +7 -5
- package/dist/devtools/index.d.ts +7 -5
- package/dist/devtools/index.js +2 -3
- package/dist/devtools/index.js.map +1 -1
- package/dist/index.cjs +223 -81
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +18 -15
- package/dist/index.d.ts +18 -15
- package/dist/index.js +212 -84
- package/dist/index.js.map +1 -1
- package/dist/testing/index.cjs +4 -1
- package/dist/testing/index.cjs.map +1 -1
- package/dist/testing/index.d.cts +2 -2
- package/dist/testing/index.d.ts +2 -2
- package/dist/testing/index.js +2 -2
- package/dist/testing/index.js.map +1 -1
- package/package.json +17 -17
- package/dist/chunk-MQ6262S3.js.map +0 -1
- package/dist/chunk-OB23TUKY.js.map +0 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { P as PathDepth, D as DefaultPathDepth, F as Form, C as CreateFormOptions, a as
|
|
2
|
-
export { B as BoolMap,
|
|
1
|
+
import { P as PathDepth, D as DefaultPathDepth, F as Form, C as CreateFormOptions, a as FormState, b as FieldValidationResult, S as SettledFieldValidationResult, c as FieldPath, d as FieldValue, I as InvalidSubmitHandler, A as ArrayFieldPath, e as ArrayItemOf, E as ErrorMap } from './createForm-BJum0RBu.cjs';
|
|
2
|
+
export { B as BoolMap, f as FieldSnapshot, g as FieldsValidationResult, R as ReadonlyStoreApi, h as ResetOptions, i as SettledFieldsValidationResult, j as SettledValidationResult, k as SubmitHandler, l as SubmitOptions, m as SubmitResult, V as ValidationMode, n as ValidationResult, o as ValidationTrigger, p as createForm, q as emptyValueForSchema, r as flattenIssues, s as isAsyncRequiredError, t as isClearableSchema, u as shouldValidateOn, v as validateAsync, w as validateSync } from './createForm-BJum0RBu.cjs';
|
|
3
3
|
import { z } from 'zod';
|
|
4
4
|
import * as react from 'react';
|
|
5
5
|
import { ChangeEvent, ReactNode } from 'react';
|
|
@@ -20,7 +20,7 @@ type PersistOptions<TSchema extends z.ZodType> = Readonly<{
|
|
|
20
20
|
storage?: PersistStorage;
|
|
21
21
|
debounceMs?: number;
|
|
22
22
|
version?: string | number;
|
|
23
|
-
apply?: "adopt" | "restore" | "manual";
|
|
23
|
+
apply?: "adopt" | "edit" | "restore" | "manual";
|
|
24
24
|
}>;
|
|
25
25
|
type PersistHandle = Readonly<{
|
|
26
26
|
load: () => boolean;
|
|
@@ -193,7 +193,6 @@ type UseFieldArrayReturn<TItem> = Readonly<{
|
|
|
193
193
|
move: (from: number, to: number) => void;
|
|
194
194
|
swap: (a: number, b: number) => void;
|
|
195
195
|
}>;
|
|
196
|
-
type ArrayItemOf<T> = [NonNullable<T>] extends [readonly (infer U)[]] ? U : never;
|
|
197
196
|
declare const inferredCallsOnly: unique symbol;
|
|
198
197
|
interface InferredTypeArg {
|
|
199
198
|
readonly [inferredCallsOnly]: typeof inferredCallsOnly;
|
|
@@ -208,7 +207,7 @@ declare function useFieldArray<TItem = InferredTypeArg>(form: FieldArrayFormApi
|
|
|
208
207
|
declare function useFieldArray<TItem = unknown>(form: FieldArrayFormApi & {
|
|
209
208
|
readonly schema?: undefined;
|
|
210
209
|
}, path: FieldPathArg<unknown>): UseFieldArrayReturn<TItem>;
|
|
211
|
-
declare function useFieldArray<TSchema extends z.ZodType, P extends
|
|
210
|
+
declare function useFieldArray<TSchema extends z.ZodType, P extends ArrayFieldPath<z.input<TSchema>, D> & string, D extends PathDepth = DefaultPathDepth>(form: Form<TSchema, D>, path: P): UseFieldArrayReturn<ArrayItemOf<FieldValue<z.input<TSchema>, P>>>;
|
|
212
211
|
|
|
213
212
|
type UseFieldsReturn<TFields extends readonly unknown[]> = Readonly<{
|
|
214
213
|
fields: TFields;
|
|
@@ -233,7 +232,7 @@ type BoundUseField<TSchema extends z.ZodType, D extends PathDepth = DefaultPathD
|
|
|
233
232
|
type BoundUseVariantField<TSchema extends z.ZodType> = <P extends string, TField extends VariantFieldPath<UnionValueAt<z.input<TSchema>, P>>>(unionPath: P, field: TField) => UseFieldReturn<VariantFieldValue<UnionValueAt<z.input<TSchema>, P>, TField> | undefined>;
|
|
234
233
|
type BoundUseFieldArray<TSchema extends z.ZodType, D extends PathDepth = DefaultPathDepth> = {
|
|
235
234
|
(pathSelector: (state: FormState<z.input<TSchema>>) => string): UseFieldArrayReturn<unknown>;
|
|
236
|
-
<P extends
|
|
235
|
+
<P extends ArrayFieldPath<z.input<TSchema>, D>>(path: P): UseFieldArrayReturn<ArrayItemOf<FieldValue<z.input<TSchema>, P>>>;
|
|
237
236
|
};
|
|
238
237
|
type BoundUseSelector<TSchema extends z.ZodType> = <U>(selector: (state: FormState<z.input<TSchema>>) => U) => U;
|
|
239
238
|
type BoundUseFlag<TSchema extends z.ZodType, D extends PathDepth = DefaultPathDepth> = (path?: FieldPath<z.input<TSchema>, D>) => boolean;
|
|
@@ -307,12 +306,16 @@ declare const useIsSubmitting: (form: FormStateApi) => boolean;
|
|
|
307
306
|
declare const useSubmitCount: (form: FormStateApi) => number;
|
|
308
307
|
|
|
309
308
|
type PathsOf<F extends FieldFormApi> = F extends Form<infer TSchema extends z.ZodType, infer D extends PathDepth> ? FieldPath<z.input<TSchema>, D> : string;
|
|
309
|
+
type PathsAccepting<F extends FieldFormApi, V> = F extends Form<infer TSchema extends z.ZodType, infer D extends PathDepth> ? PathsWhereValue<z.input<TSchema>, FieldPath<z.input<TSchema>, D>, V> : string;
|
|
310
|
+
type PathsWhereValue<Values, P extends string, V> = P extends unknown ? FieldValue<Values, P> extends V ? P : never : never;
|
|
311
|
+
type ArrayPathsOf<F extends FieldFormApi> = F extends Form<infer TSchema extends z.ZodType, infer D extends PathDepth> ? ArrayFieldPath<z.input<TSchema>, D> : string;
|
|
312
|
+
type SelectValueAt<F extends FieldFormApi, P extends string> = F extends Form<infer TSchema extends z.ZodType, infer D extends PathDepth> ? P extends FieldPath<z.input<TSchema>, D> ? Extract<NonNullable<FieldValue<z.input<TSchema>, P>>, string> : string : string;
|
|
310
313
|
type FieldRef<T> = ((instance: T | null) => void) | Readonly<{
|
|
311
314
|
current: T | null;
|
|
312
315
|
}> | null;
|
|
313
316
|
type TextFieldProps<F extends FieldFormApi = FieldFormApi> = Readonly<{
|
|
314
317
|
form: F;
|
|
315
|
-
path:
|
|
318
|
+
path: PathsAccepting<F, string | null | undefined>;
|
|
316
319
|
label?: ReactNode;
|
|
317
320
|
placeholder?: string;
|
|
318
321
|
type?: "text" | "password" | "email" | "url" | "tel";
|
|
@@ -322,7 +325,7 @@ type TextFieldProps<F extends FieldFormApi = FieldFormApi> = Readonly<{
|
|
|
322
325
|
declare const TextField: <F extends FieldFormApi>({ form, path, label, placeholder, type, autoComplete, ref, }: TextFieldProps<F>) => react.JSX.Element;
|
|
323
326
|
type DateFieldProps<F extends FieldFormApi = FieldFormApi> = Readonly<{
|
|
324
327
|
form: F;
|
|
325
|
-
path:
|
|
328
|
+
path: PathsAccepting<F, Date | null | undefined>;
|
|
326
329
|
label?: ReactNode;
|
|
327
330
|
min?: string;
|
|
328
331
|
max?: string;
|
|
@@ -331,7 +334,7 @@ type DateFieldProps<F extends FieldFormApi = FieldFormApi> = Readonly<{
|
|
|
331
334
|
declare const DateField: <F extends FieldFormApi>({ form, path, label, min, max, ref, }: DateFieldProps<F>) => react.JSX.Element;
|
|
332
335
|
type NumberFieldProps<F extends FieldFormApi = FieldFormApi> = Readonly<{
|
|
333
336
|
form: F;
|
|
334
|
-
path:
|
|
337
|
+
path: PathsAccepting<F, number | null | undefined>;
|
|
335
338
|
label?: ReactNode;
|
|
336
339
|
placeholder?: string;
|
|
337
340
|
ref?: FieldRef<HTMLInputElement>;
|
|
@@ -348,7 +351,7 @@ declare const useNumberInput: (field: UseFieldReturn<number | null | undefined>)
|
|
|
348
351
|
declare const NumberField: <F extends FieldFormApi>({ form, path, label, placeholder, ref, }: NumberFieldProps<F>) => react.JSX.Element;
|
|
349
352
|
type CheckboxFieldProps<F extends FieldFormApi = FieldFormApi> = Readonly<{
|
|
350
353
|
form: F;
|
|
351
|
-
path:
|
|
354
|
+
path: PathsAccepting<F, boolean | null | undefined>;
|
|
352
355
|
label?: ReactNode;
|
|
353
356
|
ref?: FieldRef<HTMLInputElement>;
|
|
354
357
|
}>;
|
|
@@ -357,15 +360,15 @@ type SelectFieldOption<T extends string> = Readonly<{
|
|
|
357
360
|
value: T;
|
|
358
361
|
label: ReactNode;
|
|
359
362
|
}>;
|
|
360
|
-
type SelectFieldProps<
|
|
363
|
+
type SelectFieldProps<F extends FieldFormApi = FieldFormApi, P extends PathsAccepting<F, string | null | undefined> = PathsAccepting<F, string | null | undefined>> = Readonly<{
|
|
361
364
|
form: F;
|
|
362
|
-
path:
|
|
365
|
+
path: P;
|
|
363
366
|
label?: ReactNode;
|
|
364
|
-
options: readonly SelectFieldOption<
|
|
367
|
+
options: readonly SelectFieldOption<SelectValueAt<F, P>>[];
|
|
365
368
|
placeholder?: string;
|
|
366
369
|
ref?: FieldRef<HTMLSelectElement>;
|
|
367
370
|
}>;
|
|
368
|
-
declare const SelectField: <
|
|
371
|
+
declare const SelectField: <F extends FieldFormApi, P extends PathsAccepting<F, string | null | undefined>>({ form, path, label, options, placeholder, ref, }: SelectFieldProps<F, P>) => react.JSX.Element;
|
|
369
372
|
|
|
370
373
|
declare const focusFirstError: (errors: ErrorMap, root?: ParentNode) => boolean;
|
|
371
374
|
declare const focusField: (path: string, root?: ParentNode) => boolean;
|
|
@@ -435,4 +438,4 @@ declare const dateInputProps: <T extends Date | null | undefined>(field: UseFiel
|
|
|
435
438
|
declare const checkboxProps: <T extends boolean | null | undefined>(field: UseFieldReturn<T>) => CheckboxProps;
|
|
436
439
|
declare const selectProps: <T extends string | null | undefined>(field: UseFieldReturn<T>) => SelectProps;
|
|
437
440
|
|
|
438
|
-
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 FormActionHandler, type FormActionOptions, type FormActionStateHandler, type FormContextApi, type FormHooks, type FormProviderProps, FormState, type FormStateApi, type FormStep, InvalidSubmitHandler, type MaskedInputBinding, type MaskedInputOptions, type MaskedParse, 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, SettledFieldValidationResult, type StepStatus, TextField, type TextFieldProps, type TextInputProps, type UnionValueAt, type UseFieldArrayReturn, type UseFieldOptions, type UseFieldReturn, type UseFieldsReturn, type UseFormStepsReturn, type VariantFieldPath, type VariantFieldValue, type VariantKeys, checkboxProps, createFormContext, createFormHooks, dateInputProps, dateToInputText, focusField, focusFirstError, getAtPath, hasFieldError, numberInputProps, numberToInputText, parseDateText, parseNumberText, parsePath, persistForm, selectProps, setAtPath, textInputProps, useField, useFieldArray, useFields, useForm, useFormAction, useFormActionState, useFormError, useFormSelector, useFormSelectorShallow, useFormSteps, useFormValues, useIsDirty, useIsSubmitting, useIsValid, useIsValidating, useMaskedInput, useNumberInput, usePersistForm, useSubmitCount, useVariantField };
|
|
441
|
+
export { ArrayFieldPath, ArrayItemOf, type ArrayPathsOf, type BoundUseField, type BoundUseFieldArray, type BoundUseFields, type BoundUseFlag, type BoundUseSelector, type BoundUseVariantField, 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 FormActionHandler, type FormActionOptions, type FormActionStateHandler, type FormContextApi, type FormHooks, type FormProviderProps, FormState, type FormStateApi, type FormStep, InvalidSubmitHandler, type MaskedInputBinding, type MaskedInputOptions, type MaskedParse, NumberField, type NumberFieldProps, type NumberInputBinding, type NumberInputProps, type ParsedDateText, type ParsedNumberText, PathDepth, type PathSegment, type PathsAccepting, type PathsOf, type PersistHandle, type PersistOptions, type PersistStorage, SelectField, type SelectFieldOption, type SelectFieldProps, type SelectProps, type SelectValueAt, SettledFieldValidationResult, type StepStatus, TextField, type TextFieldProps, type TextInputProps, type UnionValueAt, type UseFieldArrayReturn, type UseFieldOptions, type UseFieldReturn, type UseFieldsReturn, type UseFormStepsReturn, type VariantFieldPath, type VariantFieldValue, type VariantKeys, checkboxProps, createFormContext, createFormHooks, dateInputProps, dateToInputText, focusField, focusFirstError, getAtPath, hasFieldError, numberInputProps, numberToInputText, parseDateText, parseNumberText, parsePath, persistForm, selectProps, setAtPath, textInputProps, useField, useFieldArray, useFields, useForm, useFormAction, useFormActionState, useFormError, useFormSelector, useFormSelectorShallow, useFormSteps, useFormValues, useIsDirty, useIsSubmitting, useIsValid, useIsValidating, useMaskedInput, useNumberInput, usePersistForm, useSubmitCount, useVariantField };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { P as PathDepth, D as DefaultPathDepth, F as Form, C as CreateFormOptions, a as
|
|
2
|
-
export { B as BoolMap,
|
|
1
|
+
import { P as PathDepth, D as DefaultPathDepth, F as Form, C as CreateFormOptions, a as FormState, b as FieldValidationResult, S as SettledFieldValidationResult, c as FieldPath, d as FieldValue, I as InvalidSubmitHandler, A as ArrayFieldPath, e as ArrayItemOf, E as ErrorMap } from './createForm-BJum0RBu.js';
|
|
2
|
+
export { B as BoolMap, f as FieldSnapshot, g as FieldsValidationResult, R as ReadonlyStoreApi, h as ResetOptions, i as SettledFieldsValidationResult, j as SettledValidationResult, k as SubmitHandler, l as SubmitOptions, m as SubmitResult, V as ValidationMode, n as ValidationResult, o as ValidationTrigger, p as createForm, q as emptyValueForSchema, r as flattenIssues, s as isAsyncRequiredError, t as isClearableSchema, u as shouldValidateOn, v as validateAsync, w as validateSync } from './createForm-BJum0RBu.js';
|
|
3
3
|
import { z } from 'zod';
|
|
4
4
|
import * as react from 'react';
|
|
5
5
|
import { ChangeEvent, ReactNode } from 'react';
|
|
@@ -20,7 +20,7 @@ type PersistOptions<TSchema extends z.ZodType> = Readonly<{
|
|
|
20
20
|
storage?: PersistStorage;
|
|
21
21
|
debounceMs?: number;
|
|
22
22
|
version?: string | number;
|
|
23
|
-
apply?: "adopt" | "restore" | "manual";
|
|
23
|
+
apply?: "adopt" | "edit" | "restore" | "manual";
|
|
24
24
|
}>;
|
|
25
25
|
type PersistHandle = Readonly<{
|
|
26
26
|
load: () => boolean;
|
|
@@ -193,7 +193,6 @@ type UseFieldArrayReturn<TItem> = Readonly<{
|
|
|
193
193
|
move: (from: number, to: number) => void;
|
|
194
194
|
swap: (a: number, b: number) => void;
|
|
195
195
|
}>;
|
|
196
|
-
type ArrayItemOf<T> = [NonNullable<T>] extends [readonly (infer U)[]] ? U : never;
|
|
197
196
|
declare const inferredCallsOnly: unique symbol;
|
|
198
197
|
interface InferredTypeArg {
|
|
199
198
|
readonly [inferredCallsOnly]: typeof inferredCallsOnly;
|
|
@@ -208,7 +207,7 @@ declare function useFieldArray<TItem = InferredTypeArg>(form: FieldArrayFormApi
|
|
|
208
207
|
declare function useFieldArray<TItem = unknown>(form: FieldArrayFormApi & {
|
|
209
208
|
readonly schema?: undefined;
|
|
210
209
|
}, path: FieldPathArg<unknown>): UseFieldArrayReturn<TItem>;
|
|
211
|
-
declare function useFieldArray<TSchema extends z.ZodType, P extends
|
|
210
|
+
declare function useFieldArray<TSchema extends z.ZodType, P extends ArrayFieldPath<z.input<TSchema>, D> & string, D extends PathDepth = DefaultPathDepth>(form: Form<TSchema, D>, path: P): UseFieldArrayReturn<ArrayItemOf<FieldValue<z.input<TSchema>, P>>>;
|
|
212
211
|
|
|
213
212
|
type UseFieldsReturn<TFields extends readonly unknown[]> = Readonly<{
|
|
214
213
|
fields: TFields;
|
|
@@ -233,7 +232,7 @@ type BoundUseField<TSchema extends z.ZodType, D extends PathDepth = DefaultPathD
|
|
|
233
232
|
type BoundUseVariantField<TSchema extends z.ZodType> = <P extends string, TField extends VariantFieldPath<UnionValueAt<z.input<TSchema>, P>>>(unionPath: P, field: TField) => UseFieldReturn<VariantFieldValue<UnionValueAt<z.input<TSchema>, P>, TField> | undefined>;
|
|
234
233
|
type BoundUseFieldArray<TSchema extends z.ZodType, D extends PathDepth = DefaultPathDepth> = {
|
|
235
234
|
(pathSelector: (state: FormState<z.input<TSchema>>) => string): UseFieldArrayReturn<unknown>;
|
|
236
|
-
<P extends
|
|
235
|
+
<P extends ArrayFieldPath<z.input<TSchema>, D>>(path: P): UseFieldArrayReturn<ArrayItemOf<FieldValue<z.input<TSchema>, P>>>;
|
|
237
236
|
};
|
|
238
237
|
type BoundUseSelector<TSchema extends z.ZodType> = <U>(selector: (state: FormState<z.input<TSchema>>) => U) => U;
|
|
239
238
|
type BoundUseFlag<TSchema extends z.ZodType, D extends PathDepth = DefaultPathDepth> = (path?: FieldPath<z.input<TSchema>, D>) => boolean;
|
|
@@ -307,12 +306,16 @@ declare const useIsSubmitting: (form: FormStateApi) => boolean;
|
|
|
307
306
|
declare const useSubmitCount: (form: FormStateApi) => number;
|
|
308
307
|
|
|
309
308
|
type PathsOf<F extends FieldFormApi> = F extends Form<infer TSchema extends z.ZodType, infer D extends PathDepth> ? FieldPath<z.input<TSchema>, D> : string;
|
|
309
|
+
type PathsAccepting<F extends FieldFormApi, V> = F extends Form<infer TSchema extends z.ZodType, infer D extends PathDepth> ? PathsWhereValue<z.input<TSchema>, FieldPath<z.input<TSchema>, D>, V> : string;
|
|
310
|
+
type PathsWhereValue<Values, P extends string, V> = P extends unknown ? FieldValue<Values, P> extends V ? P : never : never;
|
|
311
|
+
type ArrayPathsOf<F extends FieldFormApi> = F extends Form<infer TSchema extends z.ZodType, infer D extends PathDepth> ? ArrayFieldPath<z.input<TSchema>, D> : string;
|
|
312
|
+
type SelectValueAt<F extends FieldFormApi, P extends string> = F extends Form<infer TSchema extends z.ZodType, infer D extends PathDepth> ? P extends FieldPath<z.input<TSchema>, D> ? Extract<NonNullable<FieldValue<z.input<TSchema>, P>>, string> : string : string;
|
|
310
313
|
type FieldRef<T> = ((instance: T | null) => void) | Readonly<{
|
|
311
314
|
current: T | null;
|
|
312
315
|
}> | null;
|
|
313
316
|
type TextFieldProps<F extends FieldFormApi = FieldFormApi> = Readonly<{
|
|
314
317
|
form: F;
|
|
315
|
-
path:
|
|
318
|
+
path: PathsAccepting<F, string | null | undefined>;
|
|
316
319
|
label?: ReactNode;
|
|
317
320
|
placeholder?: string;
|
|
318
321
|
type?: "text" | "password" | "email" | "url" | "tel";
|
|
@@ -322,7 +325,7 @@ type TextFieldProps<F extends FieldFormApi = FieldFormApi> = Readonly<{
|
|
|
322
325
|
declare const TextField: <F extends FieldFormApi>({ form, path, label, placeholder, type, autoComplete, ref, }: TextFieldProps<F>) => react.JSX.Element;
|
|
323
326
|
type DateFieldProps<F extends FieldFormApi = FieldFormApi> = Readonly<{
|
|
324
327
|
form: F;
|
|
325
|
-
path:
|
|
328
|
+
path: PathsAccepting<F, Date | null | undefined>;
|
|
326
329
|
label?: ReactNode;
|
|
327
330
|
min?: string;
|
|
328
331
|
max?: string;
|
|
@@ -331,7 +334,7 @@ type DateFieldProps<F extends FieldFormApi = FieldFormApi> = Readonly<{
|
|
|
331
334
|
declare const DateField: <F extends FieldFormApi>({ form, path, label, min, max, ref, }: DateFieldProps<F>) => react.JSX.Element;
|
|
332
335
|
type NumberFieldProps<F extends FieldFormApi = FieldFormApi> = Readonly<{
|
|
333
336
|
form: F;
|
|
334
|
-
path:
|
|
337
|
+
path: PathsAccepting<F, number | null | undefined>;
|
|
335
338
|
label?: ReactNode;
|
|
336
339
|
placeholder?: string;
|
|
337
340
|
ref?: FieldRef<HTMLInputElement>;
|
|
@@ -348,7 +351,7 @@ declare const useNumberInput: (field: UseFieldReturn<number | null | undefined>)
|
|
|
348
351
|
declare const NumberField: <F extends FieldFormApi>({ form, path, label, placeholder, ref, }: NumberFieldProps<F>) => react.JSX.Element;
|
|
349
352
|
type CheckboxFieldProps<F extends FieldFormApi = FieldFormApi> = Readonly<{
|
|
350
353
|
form: F;
|
|
351
|
-
path:
|
|
354
|
+
path: PathsAccepting<F, boolean | null | undefined>;
|
|
352
355
|
label?: ReactNode;
|
|
353
356
|
ref?: FieldRef<HTMLInputElement>;
|
|
354
357
|
}>;
|
|
@@ -357,15 +360,15 @@ type SelectFieldOption<T extends string> = Readonly<{
|
|
|
357
360
|
value: T;
|
|
358
361
|
label: ReactNode;
|
|
359
362
|
}>;
|
|
360
|
-
type SelectFieldProps<
|
|
363
|
+
type SelectFieldProps<F extends FieldFormApi = FieldFormApi, P extends PathsAccepting<F, string | null | undefined> = PathsAccepting<F, string | null | undefined>> = Readonly<{
|
|
361
364
|
form: F;
|
|
362
|
-
path:
|
|
365
|
+
path: P;
|
|
363
366
|
label?: ReactNode;
|
|
364
|
-
options: readonly SelectFieldOption<
|
|
367
|
+
options: readonly SelectFieldOption<SelectValueAt<F, P>>[];
|
|
365
368
|
placeholder?: string;
|
|
366
369
|
ref?: FieldRef<HTMLSelectElement>;
|
|
367
370
|
}>;
|
|
368
|
-
declare const SelectField: <
|
|
371
|
+
declare const SelectField: <F extends FieldFormApi, P extends PathsAccepting<F, string | null | undefined>>({ form, path, label, options, placeholder, ref, }: SelectFieldProps<F, P>) => react.JSX.Element;
|
|
369
372
|
|
|
370
373
|
declare const focusFirstError: (errors: ErrorMap, root?: ParentNode) => boolean;
|
|
371
374
|
declare const focusField: (path: string, root?: ParentNode) => boolean;
|
|
@@ -435,4 +438,4 @@ declare const dateInputProps: <T extends Date | null | undefined>(field: UseFiel
|
|
|
435
438
|
declare const checkboxProps: <T extends boolean | null | undefined>(field: UseFieldReturn<T>) => CheckboxProps;
|
|
436
439
|
declare const selectProps: <T extends string | null | undefined>(field: UseFieldReturn<T>) => SelectProps;
|
|
437
440
|
|
|
438
|
-
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 FormActionHandler, type FormActionOptions, type FormActionStateHandler, type FormContextApi, type FormHooks, type FormProviderProps, FormState, type FormStateApi, type FormStep, InvalidSubmitHandler, type MaskedInputBinding, type MaskedInputOptions, type MaskedParse, 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, SettledFieldValidationResult, type StepStatus, TextField, type TextFieldProps, type TextInputProps, type UnionValueAt, type UseFieldArrayReturn, type UseFieldOptions, type UseFieldReturn, type UseFieldsReturn, type UseFormStepsReturn, type VariantFieldPath, type VariantFieldValue, type VariantKeys, checkboxProps, createFormContext, createFormHooks, dateInputProps, dateToInputText, focusField, focusFirstError, getAtPath, hasFieldError, numberInputProps, numberToInputText, parseDateText, parseNumberText, parsePath, persistForm, selectProps, setAtPath, textInputProps, useField, useFieldArray, useFields, useForm, useFormAction, useFormActionState, useFormError, useFormSelector, useFormSelectorShallow, useFormSteps, useFormValues, useIsDirty, useIsSubmitting, useIsValid, useIsValidating, useMaskedInput, useNumberInput, usePersistForm, useSubmitCount, useVariantField };
|
|
441
|
+
export { ArrayFieldPath, ArrayItemOf, type ArrayPathsOf, type BoundUseField, type BoundUseFieldArray, type BoundUseFields, type BoundUseFlag, type BoundUseSelector, type BoundUseVariantField, 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 FormActionHandler, type FormActionOptions, type FormActionStateHandler, type FormContextApi, type FormHooks, type FormProviderProps, FormState, type FormStateApi, type FormStep, InvalidSubmitHandler, type MaskedInputBinding, type MaskedInputOptions, type MaskedParse, NumberField, type NumberFieldProps, type NumberInputBinding, type NumberInputProps, type ParsedDateText, type ParsedNumberText, PathDepth, type PathSegment, type PathsAccepting, type PathsOf, type PersistHandle, type PersistOptions, type PersistStorage, SelectField, type SelectFieldOption, type SelectFieldProps, type SelectProps, type SelectValueAt, SettledFieldValidationResult, type StepStatus, TextField, type TextFieldProps, type TextInputProps, type UnionValueAt, type UseFieldArrayReturn, type UseFieldOptions, type UseFieldReturn, type UseFieldsReturn, type UseFormStepsReturn, type VariantFieldPath, type VariantFieldValue, type VariantKeys, checkboxProps, createFormContext, createFormHooks, dateInputProps, dateToInputText, focusField, focusFirstError, getAtPath, hasFieldError, numberInputProps, numberToInputText, parseDateText, parseNumberText, parsePath, persistForm, selectProps, setAtPath, textInputProps, useField, useFieldArray, useFields, useForm, useFormAction, useFormActionState, useFormError, useFormSelector, useFormSelectorShallow, useFormSteps, useFormValues, useIsDirty, useIsSubmitting, useIsValid, useIsValidating, useMaskedInput, useNumberInput, usePersistForm, useSubmitCount, useVariantField };
|