@saas-ui/forms 2.4.0 → 2.5.0
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +14 -0
- package/dist/ajv/index.d.mts +34 -0
- package/dist/ajv/index.d.ts +1 -1
- package/dist/index.d.mts +908 -0
- package/dist/index.d.ts +53 -31
- package/dist/index.js +111 -75
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +85 -50
- package/dist/index.mjs.map +1 -1
- package/dist/yup/index.d.mts +254 -0
- package/dist/yup/index.d.ts +72 -476
- package/dist/yup/index.js.map +1 -1
- package/dist/yup/index.mjs.map +1 -1
- package/dist/zod/index.d.mts +279 -0
- package/dist/zod/index.d.ts +71 -474
- package/dist/zod/index.js.map +1 -1
- package/dist/zod/index.mjs.map +1 -1
- package/package.json +5 -3
- package/src/base-field.tsx +29 -7
- package/src/create-field.tsx +38 -32
- package/src/create-form.tsx +30 -12
- package/src/create-step-form.tsx +23 -9
- package/src/fields-context.tsx +17 -7
- package/src/form.tsx +31 -9
- package/src/index.ts +2 -1
- package/src/types.ts +66 -42
- package/src/use-array-field.tsx +3 -2
package/dist/zod/index.d.ts
CHANGED
@@ -1,431 +1,28 @@
|
|
1
|
-
import * as
|
1
|
+
import * as _chakra_ui_button from '@chakra-ui/button';
|
2
2
|
import * as _saas_ui_modals from '@saas-ui/modals';
|
3
3
|
import { BaseModalProps } from '@saas-ui/modals';
|
4
|
-
import * as
|
4
|
+
import * as _chakra_ui_checkbox from '@chakra-ui/checkbox';
|
5
5
|
import * as react_hook_form from 'react-hook-form';
|
6
|
-
import
|
7
|
-
import
|
8
|
-
import
|
9
|
-
import { InputProps, RadioGroupProps, SelectProps as SelectProps$1, TextareaProps, SwitchProps, UsePinInputProps, SystemProps, ButtonProps, ResponsiveValue, FormControlProps, HTMLChakraProps, NumberInputProps as NumberInputProps$1, StackDirection, MenuProps, ThemingProps, MenuListProps, NumberInputFieldProps as NumberInputFieldProps$1, MenuItemOptionProps, RadioProps, CheckboxProps } from '@chakra-ui/react';
|
10
|
-
import { UseStepperProps, UseStepperReturn } from '@saas-ui/core';
|
11
|
-
import { FocusableElement } from '@chakra-ui/utils';
|
12
|
-
import { MaybeRenderProp } from '@chakra-ui/react-utils';
|
13
|
-
import * as _chakra_ui_system_dist_system_types from '@chakra-ui/system/dist/system.types';
|
6
|
+
import * as react from 'react';
|
7
|
+
import react__default from 'react';
|
8
|
+
import * as dist from 'dist';
|
14
9
|
import * as zod from 'zod';
|
15
10
|
import { z, AnyZodObject } from 'zod';
|
16
|
-
import { FieldProps
|
11
|
+
import { FieldProps, WithFields, FormProps, GetBaseField, CreateFormProps, CreateStepFormProps, StepsOptions, WithStepFields, UseStepFormProps } from '@saas-ui/forms';
|
17
12
|
import { zodResolver } from '@hookform/resolvers/zod';
|
18
13
|
export { zodResolver } from '@hookform/resolvers/zod';
|
19
14
|
|
20
|
-
interface NumberInputOptions {
|
21
|
-
/**
|
22
|
-
* Hide the stepper. This will be true when `rightAddon` is provided.
|
23
|
-
*/
|
24
|
-
hideStepper?: boolean;
|
25
|
-
/**
|
26
|
-
* Render a custom increment icon.
|
27
|
-
*/
|
28
|
-
incrementIcon?: React$1.ReactNode;
|
29
|
-
/**
|
30
|
-
* Render a custom decrement icon.
|
31
|
-
*/
|
32
|
-
decrementIcon?: React$1.ReactNode;
|
33
|
-
/**
|
34
|
-
* The placeholder text when no value is selected.
|
35
|
-
*/
|
36
|
-
placeholder?: string;
|
37
|
-
/**
|
38
|
-
* Props to pass to the NumberInputField component.
|
39
|
-
*/
|
40
|
-
fieldProps?: NumberInputFieldProps$1;
|
41
|
-
/**
|
42
|
-
* Either `InputLeftAddon` or `InputLeftElement`
|
43
|
-
*/
|
44
|
-
leftAddon?: React$1.ReactNode;
|
45
|
-
/**
|
46
|
-
* Either `InputRightAddon` or `InputRightElement`
|
47
|
-
*/
|
48
|
-
rightAddon?: React$1.ReactNode;
|
49
|
-
}
|
50
|
-
interface NumberInputProps extends NumberInputProps$1, NumberInputOptions {
|
51
|
-
}
|
52
|
-
|
53
|
-
interface PasswordOptions {
|
54
|
-
viewIcon?: React$1__default.ReactNode;
|
55
|
-
viewOffIcon?: React$1__default.ReactNode;
|
56
|
-
leftAddon?: React$1__default.ReactNode;
|
57
|
-
}
|
58
|
-
interface PasswordInputProps extends InputProps, PasswordOptions {
|
59
|
-
}
|
60
|
-
|
61
|
-
interface RadioOption extends Omit<RadioProps, 'value' | 'label'>, FieldOption {
|
62
|
-
}
|
63
|
-
type RadioOptions = FieldOptions<RadioOption>;
|
64
|
-
interface RadioInputOptions {
|
65
|
-
options: RadioOptions;
|
66
|
-
spacing?: SystemProps['margin'];
|
67
|
-
direction?: StackDirection;
|
68
|
-
}
|
69
|
-
interface RadioInputProps extends Omit<RadioGroupProps, 'children'>, RadioInputOptions {
|
70
|
-
}
|
71
|
-
|
72
|
-
interface SelectOptions {
|
73
|
-
/**
|
74
|
-
* The name of the input field in a native form.
|
75
|
-
*/
|
76
|
-
name: string;
|
77
|
-
/**
|
78
|
-
* The value of the select field.
|
79
|
-
*/
|
80
|
-
value?: string | string[];
|
81
|
-
/**
|
82
|
-
* The initial value of the select field.
|
83
|
-
*/
|
84
|
-
defaultValue?: string | string[];
|
85
|
-
/**
|
86
|
-
* The callback invoked when the value of the select field changes.
|
87
|
-
* @param value The value of the select field.
|
88
|
-
*/
|
89
|
-
onChange?: (value: string | string[]) => void;
|
90
|
-
/**
|
91
|
-
* The placeholder text when there's no value.
|
92
|
-
*/
|
93
|
-
placeholder?: string;
|
94
|
-
/**
|
95
|
-
* If `true`, the select will be disabled.
|
96
|
-
*/
|
97
|
-
isDisabled?: boolean;
|
98
|
-
/**
|
99
|
-
* An array of options
|
100
|
-
* If you leave this empty the children prop will be rendered.
|
101
|
-
*/
|
102
|
-
options?: FieldOptions<SelectOption>;
|
103
|
-
/**
|
104
|
-
* Enable multiple select.
|
105
|
-
*/
|
106
|
-
multiple?: boolean;
|
107
|
-
/**
|
108
|
-
* The function used to render the value of the select field.
|
109
|
-
* @param value The value of the select field.
|
110
|
-
* @returns The rendered value.
|
111
|
-
*/
|
112
|
-
renderValue?: (value: string | string[]) => React$1__default.ReactNode;
|
113
|
-
}
|
114
|
-
|
115
|
-
interface SelectProps extends Omit<MenuProps, 'children' | 'variant' | 'size'>, ThemingProps<'SuiSelect'>, SelectOptions {
|
116
|
-
}
|
117
|
-
interface SelectButtonProps extends Omit<ButtonProps, 'size' | 'variant'> {
|
118
|
-
}
|
119
|
-
interface SelectListProps extends MenuListProps {
|
120
|
-
}
|
121
|
-
interface SelectOption extends Omit<MenuItemOptionProps, 'value'>, FieldOption {
|
122
|
-
}
|
123
|
-
/**
|
124
|
-
* An option in a select list
|
125
|
-
*
|
126
|
-
* @see https://saas-ui.dev/docs/components/forms/select
|
127
|
-
*/
|
128
|
-
declare const SelectOption: _chakra_ui_system_dist_system_types.ComponentWithAs<"button", MenuItemOptionProps>;
|
129
|
-
|
130
|
-
interface Option$1 {
|
131
|
-
value: string;
|
132
|
-
label?: string;
|
133
|
-
}
|
134
|
-
interface NativeSelectOptions {
|
135
|
-
options?: Option$1[];
|
136
|
-
}
|
137
|
-
interface NativeSelectProps extends SelectProps$1, NativeSelectOptions {
|
138
|
-
}
|
139
|
-
|
140
|
-
interface InputFieldProps extends InputProps {
|
141
|
-
type?: string;
|
142
|
-
leftAddon?: React$1.ReactNode;
|
143
|
-
rightAddon?: React$1.ReactNode;
|
144
|
-
}
|
145
|
-
interface NumberInputFieldProps extends NumberInputProps {
|
146
|
-
type: 'number';
|
147
|
-
}
|
148
|
-
interface TextareaFieldProps extends TextareaProps {
|
149
|
-
}
|
150
|
-
interface SwitchFieldProps extends SwitchProps {
|
151
|
-
}
|
152
|
-
interface SelectFieldProps extends SelectProps {
|
153
|
-
buttonProps?: SelectButtonProps;
|
154
|
-
listProps?: SelectListProps;
|
155
|
-
}
|
156
|
-
interface PinFieldProps extends Omit<UsePinInputProps, 'type'> {
|
157
|
-
pinLength?: number;
|
158
|
-
pinType?: 'alphanumeric' | 'number';
|
159
|
-
spacing?: SystemProps['margin'];
|
160
|
-
}
|
161
|
-
declare const defaultFieldTypes: {
|
162
|
-
text: React$1.FC<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof InputFieldProps> & InputFieldProps>;
|
163
|
-
email: React$1.FC<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof InputFieldProps> & InputFieldProps>;
|
164
|
-
url: React$1.FC<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof InputFieldProps> & InputFieldProps>;
|
165
|
-
phone: React$1.FC<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof InputFieldProps> & InputFieldProps>;
|
166
|
-
number: React$1.FC<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof NumberInputFieldProps> & NumberInputFieldProps>;
|
167
|
-
password: React$1.FC<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof PasswordInputProps> & PasswordInputProps>;
|
168
|
-
textarea: React$1.FC<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof TextareaFieldProps> & TextareaFieldProps>;
|
169
|
-
switch: React$1.FC<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof SwitchFieldProps> & SwitchFieldProps>;
|
170
|
-
select: React$1.FC<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof SelectFieldProps> & SelectFieldProps>;
|
171
|
-
checkbox: React$1.FC<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof CheckboxProps> & CheckboxProps>;
|
172
|
-
radio: React$1.FC<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof RadioInputProps> & RadioInputProps>;
|
173
|
-
pin: React$1.FC<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof PinFieldProps> & PinFieldProps>;
|
174
|
-
'native-select': React$1.FC<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof NativeSelectProps> & NativeSelectProps>;
|
175
|
-
};
|
176
|
-
type DefaultFields = typeof defaultFieldTypes;
|
177
|
-
|
178
|
-
interface SubmitButtonProps extends ButtonProps {
|
179
|
-
/**
|
180
|
-
* Disable the submit button if the form is untouched.
|
181
|
-
*/
|
182
|
-
disableIfUntouched?: boolean;
|
183
|
-
/**
|
184
|
-
* Disable the submit button if the form is invalid.
|
185
|
-
*/
|
186
|
-
disableIfInvalid?: boolean;
|
187
|
-
}
|
188
|
-
|
189
|
-
interface ObjectFieldProps<TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>> extends BaseFieldProps {
|
190
|
-
name: TName;
|
191
|
-
children: React$1.ReactNode;
|
192
|
-
columns?: ResponsiveValue<number>;
|
193
|
-
spacing?: ResponsiveValue<string | number>;
|
194
|
-
}
|
195
|
-
|
196
|
-
interface UseArrayFieldReturn extends UseFieldArrayReturn {
|
197
|
-
/**
|
198
|
-
* The array field name
|
199
|
-
*/
|
200
|
-
name: string;
|
201
|
-
/**
|
202
|
-
* The default value for new items
|
203
|
-
*/
|
204
|
-
defaultValue: Record<string, any>;
|
205
|
-
/**
|
206
|
-
* Min amount of items
|
207
|
-
*/
|
208
|
-
min?: number;
|
209
|
-
/**
|
210
|
-
* Max amount of items
|
211
|
-
*/
|
212
|
-
max?: number;
|
213
|
-
}
|
214
|
-
interface ArrayFieldOptions<TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>> {
|
215
|
-
/**
|
216
|
-
* The field name
|
217
|
-
*/
|
218
|
-
name: TName;
|
219
|
-
/**
|
220
|
-
* Default value for new values in the array
|
221
|
-
*/
|
222
|
-
defaultValue?: Record<string, any>;
|
223
|
-
/**
|
224
|
-
* Default key name for rows, change this if your data uses a different 'id' field
|
225
|
-
* @default "id"
|
226
|
-
*/
|
227
|
-
keyName?: string;
|
228
|
-
min?: number;
|
229
|
-
max?: number;
|
230
|
-
}
|
231
|
-
interface ArrayFieldProps<TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>> extends ArrayFieldOptions<TFieldValues, TName>, Omit<BaseFieldProps<TFieldValues, TName>, 'name' | 'defaultValue' | 'children'> {
|
232
|
-
children: MaybeRenderProp<ArrayField[]>;
|
233
|
-
}
|
234
|
-
interface ArrayField {
|
235
|
-
id: string;
|
236
|
-
[key: string]: unknown;
|
237
|
-
}
|
238
|
-
/**
|
239
|
-
* The wrapper component that composes the default ArrayField functionality.
|
240
|
-
*
|
241
|
-
* @see Docs https://saas-ui.dev/docs/components/forms/array-field
|
242
|
-
*/
|
243
|
-
declare const ArrayField: ((props: ArrayFieldProps & {
|
244
|
-
ref?: React$1.ForwardedRef<UseArrayFieldReturn>;
|
245
|
-
}) => React$1.ReactElement) & {
|
246
|
-
displayName: string;
|
247
|
-
};
|
248
|
-
|
249
|
-
type FieldOption = {
|
250
|
-
label?: string;
|
251
|
-
value: string;
|
252
|
-
};
|
253
|
-
type FieldOptions<TOption extends FieldOption = FieldOption> = Array<string> | Array<TOption>;
|
254
|
-
type ValueOf<T> = T[keyof T];
|
255
|
-
type ShallowMerge<A, B> = Omit<A, keyof B> & B;
|
256
|
-
type Split<S extends string, D extends string> = string extends S ? string[] : S extends '' ? [] : S extends `${infer T}${D}${infer U}` ? [T, ...Split<U, D>] : [S];
|
257
|
-
type MapPath<T extends string[]> = T extends [infer U, ...infer R] ? U extends string ? `${U extends `${number}` ? '$' : U}${R[0] extends string ? '.' : ''}${R extends string[] ? MapPath<R> : ''}` : '' : '';
|
258
|
-
type TransformPath<T extends string> = MapPath<Split<T, '.'>>;
|
259
|
-
type ArrayFieldPath<Name extends string> = Name extends string ? TransformPath<Name> : never;
|
260
|
-
interface BaseFieldProps<TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>> extends Omit<FormControlProps, 'label' | 'type' | 'onChange'> {
|
261
|
-
/**
|
262
|
-
* The field name
|
263
|
-
*/
|
264
|
-
name: TName | ArrayFieldPath<TName>;
|
265
|
-
/**
|
266
|
-
* The field label
|
267
|
-
*/
|
268
|
-
label?: string;
|
269
|
-
/**
|
270
|
-
* Hide the field label
|
271
|
-
*/
|
272
|
-
hideLabel?: boolean;
|
273
|
-
/**
|
274
|
-
* Field help text
|
275
|
-
*/
|
276
|
-
help?: string;
|
277
|
-
/**
|
278
|
-
* React hook form rules
|
279
|
-
*/
|
280
|
-
rules?: Omit<RegisterOptions<TFieldValues, TName>, 'valueAsNumber' | 'valueAsDate' | 'setValueAs' | 'disabled'>;
|
281
|
-
/**
|
282
|
-
* Build-in types:
|
283
|
-
* text, number, password, textarea, select, native-select, checkbox, radio, switch, pin
|
284
|
-
*
|
285
|
-
* Will default to a text field if there is no matching type.
|
286
|
-
*/
|
287
|
-
type?: string;
|
288
|
-
/**
|
289
|
-
* The input placeholder
|
290
|
-
*/
|
291
|
-
placeholder?: string;
|
292
|
-
}
|
293
|
-
type MergeFieldProps<FieldDefs, TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>> = ValueOf<{
|
294
|
-
[K in keyof FieldDefs]: FieldDefs[K] extends React.FC<infer Props> ? {
|
295
|
-
type?: K;
|
296
|
-
} & ShallowMerge<Props, BaseFieldProps<TFieldValues, TName>> : never;
|
297
|
-
}>;
|
298
|
-
type FieldProps<TFieldValues extends FieldValues = FieldValues> = MergeFieldProps<DefaultFields, TFieldValues>;
|
299
|
-
type DefaultFieldOverrides = {
|
300
|
-
submit?: SubmitButtonProps;
|
301
|
-
[key: string]: any;
|
302
|
-
};
|
303
|
-
type StepFormChildren<FieldDefs, TSteps extends StepsOptions<any> = StepsOptions<any>, TFieldValues extends FieldValues = FieldValues, TContext extends object = object> = MaybeRenderProp<StepFormRenderContext<TSteps, TFieldValues, TContext, MergeFieldProps<FieldDefs extends never ? DefaultFields : ShallowMerge<DefaultFields, FieldDefs>, TFieldValues>>>;
|
304
|
-
|
305
|
-
type FieldResolver = {
|
306
|
-
getFields(): BaseFieldProps[];
|
307
|
-
getNestedFields(name: string): BaseFieldProps[];
|
308
|
-
};
|
309
|
-
|
310
|
-
interface DisplayIfProps<TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>> {
|
311
|
-
children: React$1.ReactElement;
|
312
|
-
name: TName;
|
313
|
-
defaultValue?: unknown;
|
314
|
-
isDisabled?: boolean;
|
315
|
-
isExact?: boolean;
|
316
|
-
condition?: (value: unknown, context: UseFormReturn<TFieldValues>) => boolean;
|
317
|
-
onToggle?: (conditionMatched: boolean, context: UseFormReturn<TFieldValues>) => void;
|
318
|
-
}
|
319
|
-
|
320
|
-
interface FormRenderContext<TFieldValues extends FieldValues = FieldValues, TContext extends object = object, TFieldTypes = FieldProps<TFieldValues>> extends UseFormReturn<TFieldValues, TContext> {
|
321
|
-
Field: React$1.FC<TFieldTypes & React$1.RefAttributes<FocusableElement>>;
|
322
|
-
DisplayIf: React$1.FC<DisplayIfProps<TFieldValues>>;
|
323
|
-
ArrayField: React$1.FC<ArrayFieldProps<TFieldValues> & React$1.RefAttributes<UseArrayFieldReturn>>;
|
324
|
-
ObjectField: React$1.FC<ObjectFieldProps<TFieldValues>>;
|
325
|
-
}
|
326
|
-
interface FormOptions<TSchema = unknown, TFieldValues extends FieldValues = FieldValues, TContext extends object = object, TFieldTypes = FieldProps<TFieldValues>> {
|
327
|
-
/**
|
328
|
-
* The form schema.
|
329
|
-
*/
|
330
|
-
schema?: TSchema;
|
331
|
-
/**
|
332
|
-
* Triggers when any of the field change.
|
333
|
-
*/
|
334
|
-
onChange?: WatchObserver<TFieldValues>;
|
335
|
-
/**
|
336
|
-
* The submit handler.
|
337
|
-
*/
|
338
|
-
onSubmit: SubmitHandler<TFieldValues>;
|
339
|
-
/**
|
340
|
-
* Triggers when there are validation errors.
|
341
|
-
*/
|
342
|
-
onError?: SubmitErrorHandler<TFieldValues>;
|
343
|
-
/**
|
344
|
-
* The Hook Form state ref.
|
345
|
-
*/
|
346
|
-
formRef?: React$1.RefObject<UseFormReturn<TFieldValues, TContext>>;
|
347
|
-
/**
|
348
|
-
* The form children, can be a render prop or a ReactNode.
|
349
|
-
*/
|
350
|
-
children?: MaybeRenderProp<FormRenderContext<TFieldValues, TContext, TFieldTypes>>;
|
351
|
-
/**
|
352
|
-
* The field resolver, used to resolve the fields from schemas.
|
353
|
-
*/
|
354
|
-
fieldResolver?: FieldResolver;
|
355
|
-
/**
|
356
|
-
* Field overrides
|
357
|
-
*/
|
358
|
-
fields?: DefaultFieldOverrides;
|
359
|
-
}
|
360
|
-
interface FormProps<TSchema = unknown, TFieldValues extends FieldValues = FieldValues, TContext extends object = object, TFieldTypes = FieldProps<TFieldValues>> extends UseFormProps<TFieldValues, TContext>, Omit<HTMLChakraProps<'form'>, 'children' | 'onChange' | 'onSubmit' | 'onError'>, FormOptions<TSchema, TFieldValues, TContext, TFieldTypes> {
|
361
|
-
}
|
362
|
-
type FormStepSubmitHandler<TFieldValues extends FieldValues = FieldValues> = (data: TFieldValues, stepper: UseStepperReturn) => Promise<void>;
|
363
|
-
|
364
|
-
type StepName<T extends {
|
365
|
-
[k: number]: {
|
366
|
-
readonly name: string;
|
367
|
-
};
|
368
|
-
}> = T[number]['name'];
|
369
|
-
interface StepFormRenderContext<TSteps extends StepsOptions<any> = StepsOptions<any>, TFieldValues extends FieldValues = FieldValues, TContext extends object = object, TFieldTypes = FieldProps<TFieldValues>> extends UseStepFormReturn<TFieldValues> {
|
370
|
-
Field: React$1.FC<TFieldTypes & React$1.RefAttributes<FocusableElement>>;
|
371
|
-
FormStep: React$1.FC<FormStepProps<StepName<TSteps>>>;
|
372
|
-
DisplayIf: React$1.FC<DisplayIfProps<TFieldValues>>;
|
373
|
-
ArrayField: React$1.FC<ArrayFieldProps<TFieldValues> & React$1.RefAttributes<UseArrayFieldReturn>>;
|
374
|
-
ObjectField: React$1.FC<ObjectFieldProps<TFieldValues>>;
|
375
|
-
}
|
376
|
-
interface UseStepFormProps<TSteps extends StepsOptions<any> = StepsOptions<any>, TFieldValues extends FieldValues = FieldValues, TContext extends object = object> extends Omit<UseStepperProps, 'onChange'>, Omit<FormProps<any, TFieldValues, TContext>, 'children'> {
|
377
|
-
steps?: TSteps;
|
378
|
-
children: StepFormChildren<any, TSteps, TFieldValues, TContext>;
|
379
|
-
}
|
380
|
-
interface UseStepFormReturn<TFieldValues extends FieldValues = FieldValues> extends UseStepperReturn {
|
381
|
-
getFormProps(): {
|
382
|
-
onSubmit: SubmitHandler<TFieldValues>;
|
383
|
-
schema?: any;
|
384
|
-
resolver?: any;
|
385
|
-
};
|
386
|
-
updateStep(step: any): void;
|
387
|
-
steps: Record<string, any>;
|
388
|
-
}
|
389
|
-
|
390
|
-
type StepsOptions<TSchema, TName extends string = string> = {
|
391
|
-
/**
|
392
|
-
* The step name
|
393
|
-
*/
|
394
|
-
name: TName;
|
395
|
-
/**
|
396
|
-
* Schema
|
397
|
-
*/
|
398
|
-
schema?: TSchema;
|
399
|
-
}[];
|
400
|
-
interface FormStepOptions<TName extends string = string> {
|
401
|
-
/**
|
402
|
-
* The step name
|
403
|
-
*/
|
404
|
-
name: TName;
|
405
|
-
/**
|
406
|
-
* Schema
|
407
|
-
*/
|
408
|
-
schema?: any;
|
409
|
-
/**
|
410
|
-
* Hook Form Resolver
|
411
|
-
*/
|
412
|
-
resolver?: any;
|
413
|
-
}
|
414
|
-
interface FormStepProps<TName extends string = string> extends FormStepOptions<TName>, Omit<HTMLChakraProps<'div'>, 'onSubmit'> {
|
415
|
-
onSubmit?: FormStepSubmitHandler;
|
416
|
-
}
|
417
|
-
|
418
15
|
/**
|
419
16
|
* A helper function to render forms automatically based on a Yup schema
|
420
17
|
*
|
421
18
|
* @param schema The Yup schema
|
422
19
|
* @returns {FieldProps[]}
|
423
20
|
*/
|
424
|
-
declare const getFieldsFromSchema: (schema: zod.ZodTypeAny) => FieldProps
|
21
|
+
declare const getFieldsFromSchema: (schema: zod.ZodTypeAny) => FieldProps[];
|
425
22
|
declare const getNestedSchema: (schema: zod.ZodTypeAny, path: string) => any;
|
426
23
|
declare const zodFieldResolver: <T extends zod.ZodTypeAny>(schema: T) => {
|
427
|
-
getFields(): FieldProps
|
428
|
-
getNestedFields(name: string): FieldProps
|
24
|
+
getFields(): FieldProps[];
|
25
|
+
getNestedFields(name: string): FieldProps[];
|
429
26
|
};
|
430
27
|
interface ZodMeta {
|
431
28
|
/**
|
@@ -454,43 +51,43 @@ declare const zodMeta: (meta: ZodMeta) => string;
|
|
454
51
|
declare const zodParseMeta: (meta: string) => any;
|
455
52
|
|
456
53
|
type ResolverArgs$1 = Parameters<typeof zodResolver>;
|
457
|
-
interface CreateZodFormProps<FieldDefs> extends CreateFormProps<FieldDefs> {
|
54
|
+
interface CreateZodFormProps<FieldDefs, TGetBaseField extends GetBaseField = GetBaseField> extends CreateFormProps<FieldDefs, TGetBaseField> {
|
458
55
|
schemaOptions?: ResolverArgs$1[1];
|
459
56
|
resolverOptions?: ResolverArgs$1[2];
|
460
57
|
}
|
461
|
-
type ZodFormType<FieldDefs, ExtraProps = object, ExtraOverrides = object, Type extends 'zod' = 'zod'> = (<TSchema extends z.AnyZodObject = z.AnyZodObject, TFieldValues extends z.infer<TSchema> = z.infer<TSchema>, TContext extends object = object>(props: WithFields<FormProps
|
58
|
+
type ZodFormType<FieldDefs, ExtraProps = object, ExtraFieldProps extends object = object, ExtraOverrides = object, Type extends 'zod' = 'zod'> = (<TSchema extends z.AnyZodObject = z.AnyZodObject, TFieldValues extends z.infer<TSchema> = z.infer<TSchema>, TContext extends object = object>(props: WithFields<FormProps<TSchema, TFieldValues, TContext, ExtraFieldProps>, FieldDefs, ExtraOverrides> & {
|
462
59
|
ref?: React.ForwardedRef<HTMLFormElement>;
|
463
60
|
} & ExtraProps) => React.ReactElement) & {
|
464
61
|
displayName?: string;
|
465
62
|
id?: string;
|
466
63
|
};
|
467
|
-
declare const createZodForm: <FieldDefs>(options?: CreateZodFormProps<FieldDefs>
|
64
|
+
declare const createZodForm: <FieldDefs, TGetBaseField extends GetBaseField<any> = GetBaseField<any>>(options?: CreateZodFormProps<FieldDefs, TGetBaseField>) => ZodFormType<FieldDefs, object, TGetBaseField extends GetBaseField<infer ExtraFieldProps extends object> ? ExtraFieldProps : object, object, "zod">;
|
468
65
|
|
469
|
-
declare function createZodFormDialog<FieldDefs = any, ExtraProps = object, ExtraOverrides = object>(Form: ZodFormType<FieldDefs, ExtraProps, ExtraOverrides>): ZodFormType<FieldDefs, ExtraProps & Omit<BaseModalProps, "children">, ExtraOverrides & DefaultFieldOverrides & {
|
470
|
-
cancel?:
|
66
|
+
declare function createZodFormDialog<FieldDefs = any, ExtraProps = object, ExtraFieldProps extends object = object, ExtraOverrides = object>(Form: ZodFormType<FieldDefs, ExtraProps, ExtraFieldProps, ExtraOverrides>): ZodFormType<FieldDefs, ExtraProps & Omit<BaseModalProps, "children">, ExtraFieldProps, ExtraOverrides & dist.DefaultFieldOverrides & {
|
67
|
+
cancel?: _chakra_ui_button.ButtonProps | undefined;
|
471
68
|
}>;
|
472
69
|
|
473
70
|
type ResolverArgs = Parameters<typeof zodResolver>;
|
474
|
-
interface CreateZodStepFormProps<FieldDefs> extends CreateStepFormProps<FieldDefs> {
|
71
|
+
interface CreateZodStepFormProps<FieldDefs, TGetBaseField extends GetBaseField = GetBaseField> extends CreateStepFormProps<FieldDefs, TGetBaseField> {
|
475
72
|
schemaOptions?: ResolverArgs[1];
|
476
73
|
resolverOptions?: ResolverArgs[2];
|
477
74
|
}
|
478
|
-
type InferStepType<T extends Required<StepsOptions
|
75
|
+
type InferStepType<T extends Required<StepsOptions<AnyZodObject>>> = T extends [
|
479
76
|
infer Step,
|
480
77
|
...infer Rest
|
481
78
|
] ? Step extends {
|
482
79
|
schema: AnyZodObject;
|
483
|
-
} ? z.infer<Step['schema']> & (Rest extends Required<StepsOptions
|
484
|
-
type ZodStepFormType<FieldDefs, ExtraProps = object, ExtraOverrides = object> = (<TSteps extends Required<StepsOptions
|
80
|
+
} ? z.infer<Step['schema']> & (Rest extends Required<StepsOptions<AnyZodObject>> ? InferStepType<Rest> : object) : object : object;
|
81
|
+
type ZodStepFormType<FieldDefs, ExtraProps = object, ExtraFieldProps extends object = object, ExtraOverrides = object> = (<TSteps extends Required<StepsOptions<AnyZodObject>> = Required<StepsOptions<AnyZodObject>>, TFieldValues extends InferStepType<TSteps> = InferStepType<TSteps>, TContext extends object = object>(props: WithStepFields<UseStepFormProps<TSteps, TFieldValues, TContext>, FieldDefs, ExtraOverrides> & {
|
485
82
|
steps: TSteps;
|
486
|
-
ref?:
|
487
|
-
} & ExtraProps) =>
|
83
|
+
ref?: react__default.ForwardedRef<HTMLFormElement>;
|
84
|
+
} & ExtraProps) => react__default.ReactElement) & {
|
488
85
|
displayName?: string;
|
489
86
|
id?: string;
|
490
87
|
};
|
491
|
-
declare const createZodStepForm: <FieldDefs>(options?: CreateZodStepFormProps<FieldDefs>
|
88
|
+
declare const createZodStepForm: <FieldDefs, TGetBaseField extends GetBaseField = GetBaseField>(options?: CreateZodStepFormProps<FieldDefs, TGetBaseField>) => ZodStepFormType<FieldDefs, object, TGetBaseField extends GetBaseField<infer ExtraFieldProps extends object> ? ExtraFieldProps : object, object>;
|
492
89
|
|
493
|
-
declare const Form: ZodFormType<unknown, object, object, "zod">;
|
90
|
+
declare const Form: ZodFormType<unknown, object, any, object, "zod">;
|
494
91
|
declare const StepForm: (<TSteps extends {
|
495
92
|
name: string;
|
496
93
|
schema?: zod.AnyZodObject | undefined;
|
@@ -607,76 +204,76 @@ declare const StepForm: (<TSteps extends {
|
|
607
204
|
} ? zod.TypeOf<Step["schema"]> & (Rest extends {
|
608
205
|
name: string;
|
609
206
|
schema?: zod.AnyZodObject | undefined;
|
610
|
-
}[] ? any : object) : object : object : never : never : object) : object : object : never : never : object) : object : object : never : never : object) : object : object : never : never : object) : object : object : never : never : object) : object : object : never : never : object) : object : object : never : never : object) : object : object : never : never : object) : object : object : never : never : object) : object : object : never : never : object) : object : object, TContext extends object = object>(props: Omit<UseStepFormProps<TSteps, TFieldValues, TContext>, "children" | "fields"> & {
|
611
|
-
children?:
|
207
|
+
}[] ? any : object) : object : object : never : never : object) : object : object : never : never : object) : object : object : never : never : object) : object : object : never : never : object) : object : object : never : never : object) : object : object : never : never : object) : object : object : never : never : object) : object : object : never : never : object) : object : object : never : never : object) : object : object : never : never : object) : object : object, TContext extends object = object>(props: Omit<dist.UseStepFormProps<TSteps, TFieldValues, TContext>, "children" | "fields"> & {
|
208
|
+
children?: react.ReactNode | ((props: dist.StepFormRenderContext<TSteps, TFieldValues, TContext, ({
|
612
209
|
type?: "number" | undefined;
|
613
|
-
} & Omit<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof NumberInputFieldProps> & NumberInputFieldProps, keyof BaseFieldProps<TFieldValues_1, TName>> & BaseFieldProps<TFieldValues, react_hook_form.Path<TFieldValues>>) | ({
|
614
|
-
type?: "
|
615
|
-
} & Omit<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof
|
616
|
-
type?: "email" | undefined;
|
617
|
-
} & Omit<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof InputFieldProps> & InputFieldProps, keyof BaseFieldProps<TFieldValues_1, TName>> & BaseFieldProps<TFieldValues, react_hook_form.Path<TFieldValues>>) | ({
|
618
|
-
type?: "url" | undefined;
|
619
|
-
} & Omit<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof InputFieldProps> & InputFieldProps, keyof BaseFieldProps<TFieldValues_1, TName>> & BaseFieldProps<TFieldValues, react_hook_form.Path<TFieldValues>>) | ({
|
620
|
-
type?: "phone" | undefined;
|
621
|
-
} & Omit<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof InputFieldProps> & InputFieldProps, keyof BaseFieldProps<TFieldValues_1, TName>> & BaseFieldProps<TFieldValues, react_hook_form.Path<TFieldValues>>) | ({
|
622
|
-
type?: "password" | undefined;
|
623
|
-
} & Omit<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof PasswordInputProps> & PasswordInputProps, keyof BaseFieldProps<TFieldValues_1, TName>> & BaseFieldProps<TFieldValues, react_hook_form.Path<TFieldValues>>) | ({
|
210
|
+
} & Omit<Omit<dist.BaseFieldProps<react_hook_form.FieldValues, string>, keyof dist.NumberInputFieldProps> & dist.NumberInputFieldProps, keyof dist.BaseFieldProps<TFieldValues_1, TName>> & dist.BaseFieldProps<TFieldValues, react_hook_form.Path<TFieldValues>> & object) | ({
|
211
|
+
type?: "select" | undefined;
|
212
|
+
} & Omit<Omit<dist.BaseFieldProps<react_hook_form.FieldValues, string>, keyof dist.SelectFieldProps> & dist.SelectFieldProps, keyof dist.BaseFieldProps<TFieldValues_1, TName>> & dist.BaseFieldProps<TFieldValues, react_hook_form.Path<TFieldValues>> & object) | ({
|
624
213
|
type?: "textarea" | undefined;
|
625
|
-
} & Omit<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof TextareaFieldProps> & TextareaFieldProps, keyof BaseFieldProps<TFieldValues_1, TName>> & BaseFieldProps<TFieldValues, react_hook_form.Path<TFieldValues>>) | ({
|
214
|
+
} & Omit<Omit<dist.BaseFieldProps<react_hook_form.FieldValues, string>, keyof dist.TextareaFieldProps> & dist.TextareaFieldProps, keyof dist.BaseFieldProps<TFieldValues_1, TName>> & dist.BaseFieldProps<TFieldValues, react_hook_form.Path<TFieldValues>> & object) | ({
|
626
215
|
type?: "switch" | undefined;
|
627
|
-
} & Omit<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof SwitchFieldProps> & SwitchFieldProps, keyof BaseFieldProps<TFieldValues_1, TName>> & BaseFieldProps<TFieldValues, react_hook_form.Path<TFieldValues>>) | ({
|
628
|
-
type?: "
|
629
|
-
} & Omit<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof
|
216
|
+
} & Omit<Omit<dist.BaseFieldProps<react_hook_form.FieldValues, string>, keyof dist.SwitchFieldProps> & dist.SwitchFieldProps, keyof dist.BaseFieldProps<TFieldValues_1, TName>> & dist.BaseFieldProps<TFieldValues, react_hook_form.Path<TFieldValues>> & object) | ({
|
217
|
+
type?: "text" | undefined;
|
218
|
+
} & Omit<Omit<dist.BaseFieldProps<react_hook_form.FieldValues, string>, keyof dist.InputFieldProps> & dist.InputFieldProps, keyof dist.BaseFieldProps<TFieldValues_1, TName>> & dist.BaseFieldProps<TFieldValues, react_hook_form.Path<TFieldValues>> & object) | ({
|
630
219
|
type?: "checkbox" | undefined;
|
631
|
-
} & Omit<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof
|
220
|
+
} & Omit<Omit<dist.BaseFieldProps<react_hook_form.FieldValues, string>, keyof _chakra_ui_checkbox.CheckboxProps> & _chakra_ui_checkbox.CheckboxProps, keyof dist.BaseFieldProps<TFieldValues_1, TName>> & dist.BaseFieldProps<TFieldValues, react_hook_form.Path<TFieldValues>> & object) | ({
|
632
221
|
type?: "radio" | undefined;
|
633
|
-
} & Omit<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof RadioInputProps> & RadioInputProps, keyof BaseFieldProps<TFieldValues_1, TName>> & BaseFieldProps<TFieldValues, react_hook_form.Path<TFieldValues>>) | ({
|
634
|
-
type?: "pin" | undefined;
|
635
|
-
} & Omit<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof PinFieldProps> & PinFieldProps, keyof BaseFieldProps<TFieldValues_1, TName>> & BaseFieldProps<TFieldValues, react_hook_form.Path<TFieldValues>>) | ({
|
636
|
-
type?: "native-select" | undefined;
|
637
|
-
} & Omit<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof NativeSelectProps> & NativeSelectProps, keyof BaseFieldProps<TFieldValues_1, TName>> & BaseFieldProps<TFieldValues, react_hook_form.Path<TFieldValues>>)>) => React$1.ReactNode);
|
638
|
-
fields?: ({ [K in react_hook_form.Path<TFieldValues> | (react_hook_form.Path<TFieldValues> extends infer T_20 ? T_20 extends react_hook_form.Path<TFieldValues> ? T_20 extends string ? (string extends T_20 ? (T_20 & string)[] : T_20 extends infer T_21 ? T_21 extends T_20 ? T_21 extends "" ? [] : T_21 extends `${infer T_22}.${infer U}` ? [T_22, ...string extends U ? (U & string)[] : U extends "" ? [] : U extends `${infer T_22}.${infer U}` ? [T_22, ...string extends U ? (U & string)[] : U extends "" ? [] : U extends `${infer T_22}.${infer U}` ? [T_22, ...string extends U ? (U & string)[] : U extends "" ? [] : U extends `${infer T_22}.${infer U}` ? [T_22, ...string extends U ? (U & string)[] : U extends "" ? [] : U extends `${infer T_22}.${infer U}` ? [T_22, ...string extends U ? (U & string)[] : U extends "" ? [] : U extends `${infer T_22}.${infer U}` ? [T_22, ...string extends U ? (U & string)[] : U extends "" ? [] : U extends `${infer T_22}.${infer U}` ? [T_22, ...string extends U ? (U & string)[] : U extends "" ? [] : U extends `${infer T_22}.${infer U}` ? [T_22, ...string extends U ? (U & string)[] : U extends "" ? [] : U extends `${infer T_22}.${infer U}` ? [T_22, ...string extends U ? (U & string)[] : U extends "" ? [] : U extends `${infer T_22}.${infer U}` ? [T_22, ...string extends U ? (U & string)[] : U extends "" ? [] : U extends `${infer T_22}.${infer U}` ? [T_22, ...any] : [U]] : [U]] : [U]] : [U]] : [U]] : [U]] : [U]] : [U]] : [U]] : [U]] : [T_21] : never : never) extends infer T_23 ? T_23 extends (string extends T_20 ? (T_20 & string)[] : T_20 extends infer T_34 ? T_34 extends T_20 ? T_34 extends "" ? [] : T_34 extends `${infer T_22}.${infer U}` ? [T_22, ...string extends U ? (U & string)[] : U extends "" ? [] : U extends `${infer T_22}.${infer U}` ? [T_22, ...string extends U ? (U & string)[] : U extends "" ? [] : U extends `${infer T_22}.${infer U}` ? [T_22, ...string extends U ? (U & string)[] : U extends "" ? [] : U extends `${infer T_22}.${infer U}` ? [T_22, ...string extends U ? (U & string)[] : U extends "" ? [] : U extends `${infer T_22}.${infer U}` ? [T_22, ...string extends U ? (U & string)[] : U extends "" ? [] : U extends `${infer T_22}.${infer U}` ? [T_22, ...string extends U ? (U & string)[] : U extends "" ? [] : U extends `${infer T_22}.${infer U}` ? [T_22, ...string extends U ? (U & string)[] : U extends "" ? [] : U extends `${infer T_22}.${infer U}` ? [T_22, ...string extends U ? (U & string)[] : U extends "" ? [] : U extends `${infer T_22}.${infer U}` ? [T_22, ...string extends U ? (U & string)[] : U extends "" ? [] : U extends `${infer T_22}.${infer U}` ? [T_22, ...string extends U ? (U & string)[] : U extends "" ? [] : U extends `${infer T_22}.${infer U}` ? [T_22, ...any] : [U]] : [U]] : [U]] : [U]] : [U]] : [U]] : [U]] : [U]] : [U]] : [U]] : [T_34] : never : never) ? T_23 extends [infer U_1, ...infer R] ? U_1 extends string ? `${U_1 extends `${number}` ? "$" : U_1}${R[0] extends string ? "." : ""}${R extends string[] ? R extends infer T_24 ? T_24 extends R ? T_24 extends [infer U_1, ...infer R] ? U_1 extends string ? `${U_1 extends `${number}` ? "$" : U_1}${R[0] extends string ? "." : ""}${R extends string[] ? R extends infer T_25 ? T_25 extends R ? T_25 extends [infer U_1, ...infer R] ? U_1 extends string ? `${U_1 extends `${number}` ? "$" : U_1}${R[0] extends string ? "." : ""}${R extends string[] ? R extends infer T_26 ? T_26 extends R ? T_26 extends [infer U_1, ...infer R] ? U_1 extends string ? `${U_1 extends `${number}` ? "$" : U_1}${R[0] extends string ? "." : ""}${R extends string[] ? R extends infer T_27 ? T_27 extends R ? T_27 extends [infer U_1, ...infer R] ? U_1 extends string ? `${U_1 extends `${number}` ? "$" : U_1}${R[0] extends string ? "." : ""}${R extends string[] ? R extends infer T_28 ? T_28 extends R ? T_28 extends [infer U_1, ...infer R] ? U_1 extends string ? `${U_1 extends `${number}` ? "$" : U_1}${R[0] extends string ? "." : ""}${R extends string[] ? R extends infer T_29 ? T_29 extends R ? T_29 extends [infer U_1, ...infer R] ? U_1 extends string ? `${U_1 extends `${number}` ? "$" : U_1}${R[0] extends string ? "." : ""}${R extends string[] ? R extends infer T_30 ? T_30 extends R ? T_30 extends [infer U_1, ...infer R] ? U_1 extends string ? `${U_1 extends `${number}` ? "$" : U_1}${R[0] extends string ? "." : ""}${R extends string[] ? R extends infer T_31 ? T_31 extends R ? T_31 extends [infer U_1, ...infer R] ? U_1 extends string ? `${U_1 extends `${number}` ? "$" : U_1}${R[0] extends string ? "." : ""}${R extends string[] ? R extends infer T_32 ? T_32 extends R ? T_32 extends [infer U_1, ...infer R] ? U_1 extends string ? `${U_1 extends `${number}` ? "$" : U_1}${R[0] extends string ? "." : ""}${R extends string[] ? R extends infer T_33 ? T_33 extends R ? T_33 extends [infer U_1, ...infer R] ? U_1 extends string ? `${U_1 extends `${number}` ? "$" : U_1}${R[0] extends string ? "." : ""}${R extends string[] ? any : ""}` : "" : "" : never : never : ""}` : "" : "" : never : never : ""}` : "" : "" : never : never : ""}` : "" : "" : never : never : ""}` : "" : "" : never : never : ""}` : "" : "" : never : never : ""}` : "" : "" : never : never : ""}` : "" : "" : never : never : ""}` : "" : "" : never : never : ""}` : "" : "" : never : never : ""}` : "" : "" : never : never : never : never : never)]?: (({
|
639
|
-
type?: "number" | undefined;
|
640
|
-
} & Omit<Omit<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof NumberInputFieldProps> & NumberInputFieldProps, keyof BaseFieldProps<TFieldValues_2, TName_1>> & BaseFieldProps<TFieldValues, react_hook_form.Path<TFieldValues>>, "name">) | ({
|
641
|
-
type?: "text" | undefined;
|
642
|
-
} & Omit<Omit<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof InputFieldProps> & InputFieldProps, keyof BaseFieldProps<TFieldValues_2, TName_1>> & BaseFieldProps<TFieldValues, react_hook_form.Path<TFieldValues>>, "name">) | ({
|
643
|
-
type?: "email" | undefined;
|
644
|
-
} & Omit<Omit<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof InputFieldProps> & InputFieldProps, keyof BaseFieldProps<TFieldValues_2, TName_1>> & BaseFieldProps<TFieldValues, react_hook_form.Path<TFieldValues>>, "name">) | ({
|
222
|
+
} & Omit<Omit<dist.BaseFieldProps<react_hook_form.FieldValues, string>, keyof dist.RadioInputProps> & dist.RadioInputProps, keyof dist.BaseFieldProps<TFieldValues_1, TName>> & dist.BaseFieldProps<TFieldValues, react_hook_form.Path<TFieldValues>> & object) | ({
|
645
223
|
type?: "url" | undefined;
|
646
|
-
} & Omit<Omit<
|
224
|
+
} & Omit<Omit<dist.BaseFieldProps<react_hook_form.FieldValues, string>, keyof dist.InputFieldProps> & dist.InputFieldProps, keyof dist.BaseFieldProps<TFieldValues_1, TName>> & dist.BaseFieldProps<TFieldValues, react_hook_form.Path<TFieldValues>> & object) | ({
|
225
|
+
type?: "email" | undefined;
|
226
|
+
} & Omit<Omit<dist.BaseFieldProps<react_hook_form.FieldValues, string>, keyof dist.InputFieldProps> & dist.InputFieldProps, keyof dist.BaseFieldProps<TFieldValues_1, TName>> & dist.BaseFieldProps<TFieldValues, react_hook_form.Path<TFieldValues>> & object) | ({
|
647
227
|
type?: "phone" | undefined;
|
648
|
-
} & Omit<Omit<
|
228
|
+
} & Omit<Omit<dist.BaseFieldProps<react_hook_form.FieldValues, string>, keyof dist.InputFieldProps> & dist.InputFieldProps, keyof dist.BaseFieldProps<TFieldValues_1, TName>> & dist.BaseFieldProps<TFieldValues, react_hook_form.Path<TFieldValues>> & object) | ({
|
649
229
|
type?: "password" | undefined;
|
650
|
-
} & Omit<Omit<
|
230
|
+
} & Omit<Omit<dist.BaseFieldProps<react_hook_form.FieldValues, string>, keyof dist.PasswordInputProps> & dist.PasswordInputProps, keyof dist.BaseFieldProps<TFieldValues_1, TName>> & dist.BaseFieldProps<TFieldValues, react_hook_form.Path<TFieldValues>> & object) | ({
|
231
|
+
type?: "pin" | undefined;
|
232
|
+
} & Omit<Omit<dist.BaseFieldProps<react_hook_form.FieldValues, string>, keyof dist.PinFieldProps> & dist.PinFieldProps, keyof dist.BaseFieldProps<TFieldValues_1, TName>> & dist.BaseFieldProps<TFieldValues, react_hook_form.Path<TFieldValues>> & object) | ({
|
233
|
+
type?: "native-select" | undefined;
|
234
|
+
} & Omit<Omit<dist.BaseFieldProps<react_hook_form.FieldValues, string>, keyof dist.NativeSelectProps> & dist.NativeSelectProps, keyof dist.BaseFieldProps<TFieldValues_1, TName>> & dist.BaseFieldProps<TFieldValues, react_hook_form.Path<TFieldValues>> & object)>) => react.ReactNode);
|
235
|
+
fields?: ({ [K in react_hook_form.Path<TFieldValues> | (react_hook_form.Path<TFieldValues> extends infer T_20 ? T_20 extends react_hook_form.Path<TFieldValues> ? T_20 extends string ? (string extends T_20 ? (T_20 & string)[] : T_20 extends infer T_21 ? T_21 extends T_20 ? T_21 extends "" ? [] : T_21 extends `${infer T_22}.${infer U}` ? [T_22, ...string extends U ? U[] : U extends "" ? [] : U extends `${infer T_22}.${infer U}` ? [T_22, ...string extends U ? U[] : U extends "" ? [] : U extends `${infer T_22}.${infer U}` ? [T_22, ...string extends U ? U[] : U extends "" ? [] : U extends `${infer T_22}.${infer U}` ? [T_22, ...string extends U ? U[] : U extends "" ? [] : U extends `${infer T_22}.${infer U}` ? [T_22, ...string extends U ? U[] : U extends "" ? [] : U extends `${infer T_22}.${infer U}` ? [T_22, ...string extends U ? U[] : U extends "" ? [] : U extends `${infer T_22}.${infer U}` ? [T_22, ...string extends U ? U[] : U extends "" ? [] : U extends `${infer T_22}.${infer U}` ? [T_22, ...string extends U ? U[] : U extends "" ? [] : U extends `${infer T_22}.${infer U}` ? [T_22, ...string extends U ? U[] : U extends "" ? [] : U extends `${infer T_22}.${infer U}` ? [T_22, ...string extends U ? U[] : U extends "" ? [] : U extends `${infer T_22}.${infer U}` ? [T_22, ...any] : [U]] : [U]] : [U]] : [U]] : [U]] : [U]] : [U]] : [U]] : [U]] : [U]] : [T_21] : never : never) extends infer T_23 ? T_23 extends (string extends T_20 ? (T_20 & string)[] : T_20 extends infer T_34 ? T_34 extends T_20 ? T_34 extends "" ? [] : T_34 extends `${infer T_22}.${infer U}` ? [T_22, ...string extends U ? U[] : U extends "" ? [] : U extends `${infer T_22}.${infer U}` ? [T_22, ...string extends U ? U[] : U extends "" ? [] : U extends `${infer T_22}.${infer U}` ? [T_22, ...string extends U ? U[] : U extends "" ? [] : U extends `${infer T_22}.${infer U}` ? [T_22, ...string extends U ? U[] : U extends "" ? [] : U extends `${infer T_22}.${infer U}` ? [T_22, ...string extends U ? U[] : U extends "" ? [] : U extends `${infer T_22}.${infer U}` ? [T_22, ...string extends U ? U[] : U extends "" ? [] : U extends `${infer T_22}.${infer U}` ? [T_22, ...string extends U ? U[] : U extends "" ? [] : U extends `${infer T_22}.${infer U}` ? [T_22, ...string extends U ? U[] : U extends "" ? [] : U extends `${infer T_22}.${infer U}` ? [T_22, ...string extends U ? U[] : U extends "" ? [] : U extends `${infer T_22}.${infer U}` ? [T_22, ...string extends U ? U[] : U extends "" ? [] : U extends `${infer T_22}.${infer U}` ? [T_22, ...any] : [U]] : [U]] : [U]] : [U]] : [U]] : [U]] : [U]] : [U]] : [U]] : [U]] : [T_34] : never : never) ? T_23 extends [infer U_1, ...infer R] ? U_1 extends string ? `${U_1 extends `${number}` ? "$" : U_1}${R[0] extends string ? "." : ""}${R extends string[] ? R extends infer T_24 ? T_24 extends R ? T_24 extends [infer U_1, ...infer R] ? U_1 extends string ? `${U_1 extends `${number}` ? "$" : U_1}${R[0] extends string ? "." : ""}${R extends string[] ? R extends infer T_25 ? T_25 extends R ? T_25 extends [infer U_1, ...infer R] ? U_1 extends string ? `${U_1 extends `${number}` ? "$" : U_1}${R[0] extends string ? "." : ""}${R extends string[] ? R extends infer T_26 ? T_26 extends R ? T_26 extends [infer U_1, ...infer R] ? U_1 extends string ? `${U_1 extends `${number}` ? "$" : U_1}${R[0] extends string ? "." : ""}${R extends string[] ? R extends infer T_27 ? T_27 extends R ? T_27 extends [infer U_1, ...infer R] ? U_1 extends string ? `${U_1 extends `${number}` ? "$" : U_1}${R[0] extends string ? "." : ""}${R extends string[] ? R extends infer T_28 ? T_28 extends R ? T_28 extends [infer U_1, ...infer R] ? U_1 extends string ? `${U_1 extends `${number}` ? "$" : U_1}${R[0] extends string ? "." : ""}${R extends string[] ? R extends infer T_29 ? T_29 extends R ? T_29 extends [infer U_1, ...infer R] ? U_1 extends string ? `${U_1 extends `${number}` ? "$" : U_1}${R[0] extends string ? "." : ""}${R extends string[] ? R extends infer T_30 ? T_30 extends R ? T_30 extends [infer U_1, ...infer R] ? U_1 extends string ? `${U_1 extends `${number}` ? "$" : U_1}${R[0] extends string ? "." : ""}${R extends string[] ? R extends infer T_31 ? T_31 extends R ? T_31 extends [infer U_1, ...infer R] ? U_1 extends string ? `${U_1 extends `${number}` ? "$" : U_1}${R[0] extends string ? "." : ""}${R extends string[] ? R extends infer T_32 ? T_32 extends R ? T_32 extends [infer U_1, ...infer R] ? U_1 extends string ? `${U_1 extends `${number}` ? "$" : U_1}${R[0] extends string ? "." : ""}${R extends string[] ? R extends infer T_33 ? T_33 extends R ? T_33 extends [infer U_1, ...infer R] ? U_1 extends string ? `${U_1 extends `${number}` ? "$" : U_1}${R[0] extends string ? "." : ""}${R extends string[] ? any : ""}` : "" : "" : never : never : ""}` : "" : "" : never : never : ""}` : "" : "" : never : never : ""}` : "" : "" : never : never : ""}` : "" : "" : never : never : ""}` : "" : "" : never : never : ""}` : "" : "" : never : never : ""}` : "" : "" : never : never : ""}` : "" : "" : never : never : ""}` : "" : "" : never : never : ""}` : "" : "" : never : never : never : never : never)]?: (({
|
236
|
+
type?: "number" | undefined;
|
237
|
+
} & Omit<Omit<Omit<dist.BaseFieldProps<react_hook_form.FieldValues, string>, keyof dist.NumberInputFieldProps> & dist.NumberInputFieldProps, keyof dist.BaseFieldProps<TFieldValues_2, TName_1>> & dist.BaseFieldProps<TFieldValues, react_hook_form.Path<TFieldValues>>, "name">) | ({
|
238
|
+
type?: "select" | undefined;
|
239
|
+
} & Omit<Omit<Omit<dist.BaseFieldProps<react_hook_form.FieldValues, string>, keyof dist.SelectFieldProps> & dist.SelectFieldProps, keyof dist.BaseFieldProps<TFieldValues_2, TName_1>> & dist.BaseFieldProps<TFieldValues, react_hook_form.Path<TFieldValues>>, "name">) | ({
|
651
240
|
type?: "textarea" | undefined;
|
652
|
-
} & Omit<Omit<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof TextareaFieldProps> & TextareaFieldProps, keyof BaseFieldProps<TFieldValues_2, TName_1>> & BaseFieldProps<TFieldValues, react_hook_form.Path<TFieldValues>>, "name">) | ({
|
241
|
+
} & Omit<Omit<Omit<dist.BaseFieldProps<react_hook_form.FieldValues, string>, keyof dist.TextareaFieldProps> & dist.TextareaFieldProps, keyof dist.BaseFieldProps<TFieldValues_2, TName_1>> & dist.BaseFieldProps<TFieldValues, react_hook_form.Path<TFieldValues>>, "name">) | ({
|
653
242
|
type?: "switch" | undefined;
|
654
|
-
} & Omit<Omit<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof SwitchFieldProps> & SwitchFieldProps, keyof BaseFieldProps<TFieldValues_2, TName_1>> & BaseFieldProps<TFieldValues, react_hook_form.Path<TFieldValues>>, "name">) | ({
|
655
|
-
type?: "
|
656
|
-
} & Omit<Omit<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof
|
243
|
+
} & Omit<Omit<Omit<dist.BaseFieldProps<react_hook_form.FieldValues, string>, keyof dist.SwitchFieldProps> & dist.SwitchFieldProps, keyof dist.BaseFieldProps<TFieldValues_2, TName_1>> & dist.BaseFieldProps<TFieldValues, react_hook_form.Path<TFieldValues>>, "name">) | ({
|
244
|
+
type?: "text" | undefined;
|
245
|
+
} & Omit<Omit<Omit<dist.BaseFieldProps<react_hook_form.FieldValues, string>, keyof dist.InputFieldProps> & dist.InputFieldProps, keyof dist.BaseFieldProps<TFieldValues_2, TName_1>> & dist.BaseFieldProps<TFieldValues, react_hook_form.Path<TFieldValues>>, "name">) | ({
|
657
246
|
type?: "checkbox" | undefined;
|
658
|
-
} & Omit<Omit<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof
|
247
|
+
} & Omit<Omit<Omit<dist.BaseFieldProps<react_hook_form.FieldValues, string>, keyof _chakra_ui_checkbox.CheckboxProps> & _chakra_ui_checkbox.CheckboxProps, keyof dist.BaseFieldProps<TFieldValues_2, TName_1>> & dist.BaseFieldProps<TFieldValues, react_hook_form.Path<TFieldValues>>, "name">) | ({
|
659
248
|
type?: "radio" | undefined;
|
660
|
-
} & Omit<Omit<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof RadioInputProps> & RadioInputProps, keyof BaseFieldProps<TFieldValues_2, TName_1>> & BaseFieldProps<TFieldValues, react_hook_form.Path<TFieldValues>>, "name">) | ({
|
249
|
+
} & Omit<Omit<Omit<dist.BaseFieldProps<react_hook_form.FieldValues, string>, keyof dist.RadioInputProps> & dist.RadioInputProps, keyof dist.BaseFieldProps<TFieldValues_2, TName_1>> & dist.BaseFieldProps<TFieldValues, react_hook_form.Path<TFieldValues>>, "name">) | ({
|
250
|
+
type?: "url" | undefined;
|
251
|
+
} & Omit<Omit<Omit<dist.BaseFieldProps<react_hook_form.FieldValues, string>, keyof dist.InputFieldProps> & dist.InputFieldProps, keyof dist.BaseFieldProps<TFieldValues_2, TName_1>> & dist.BaseFieldProps<TFieldValues, react_hook_form.Path<TFieldValues>>, "name">) | ({
|
252
|
+
type?: "email" | undefined;
|
253
|
+
} & Omit<Omit<Omit<dist.BaseFieldProps<react_hook_form.FieldValues, string>, keyof dist.InputFieldProps> & dist.InputFieldProps, keyof dist.BaseFieldProps<TFieldValues_2, TName_1>> & dist.BaseFieldProps<TFieldValues, react_hook_form.Path<TFieldValues>>, "name">) | ({
|
254
|
+
type?: "phone" | undefined;
|
255
|
+
} & Omit<Omit<Omit<dist.BaseFieldProps<react_hook_form.FieldValues, string>, keyof dist.InputFieldProps> & dist.InputFieldProps, keyof dist.BaseFieldProps<TFieldValues_2, TName_1>> & dist.BaseFieldProps<TFieldValues, react_hook_form.Path<TFieldValues>>, "name">) | ({
|
256
|
+
type?: "password" | undefined;
|
257
|
+
} & Omit<Omit<Omit<dist.BaseFieldProps<react_hook_form.FieldValues, string>, keyof dist.PasswordInputProps> & dist.PasswordInputProps, keyof dist.BaseFieldProps<TFieldValues_2, TName_1>> & dist.BaseFieldProps<TFieldValues, react_hook_form.Path<TFieldValues>>, "name">) | ({
|
661
258
|
type?: "pin" | undefined;
|
662
|
-
} & Omit<Omit<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof PinFieldProps> & PinFieldProps, keyof BaseFieldProps<TFieldValues_2, TName_1>> & BaseFieldProps<TFieldValues, react_hook_form.Path<TFieldValues>>, "name">) | ({
|
259
|
+
} & Omit<Omit<Omit<dist.BaseFieldProps<react_hook_form.FieldValues, string>, keyof dist.PinFieldProps> & dist.PinFieldProps, keyof dist.BaseFieldProps<TFieldValues_2, TName_1>> & dist.BaseFieldProps<TFieldValues, react_hook_form.Path<TFieldValues>>, "name">) | ({
|
663
260
|
type?: "native-select" | undefined;
|
664
|
-
} & Omit<Omit<Omit<BaseFieldProps<react_hook_form.FieldValues, string>, keyof NativeSelectProps> & NativeSelectProps, keyof BaseFieldProps<TFieldValues_2, TName_1>> & BaseFieldProps<TFieldValues, react_hook_form.Path<TFieldValues>>, "name">)) | ({
|
261
|
+
} & Omit<Omit<Omit<dist.BaseFieldProps<react_hook_form.FieldValues, string>, keyof dist.NativeSelectProps> & dist.NativeSelectProps, keyof dist.BaseFieldProps<TFieldValues_2, TName_1>> & dist.BaseFieldProps<TFieldValues, react_hook_form.Path<TFieldValues>>, "name">)) | ({
|
665
262
|
type?: "object" | undefined;
|
666
|
-
} & Omit<ObjectFieldProps<TFieldValues, react_hook_form.Path<TFieldValues>>, "
|
263
|
+
} & Omit<dist.ObjectFieldProps<TFieldValues, react_hook_form.Path<TFieldValues>>, "name" | "children">) | ({
|
667
264
|
type?: "array" | undefined;
|
668
|
-
} & Omit<ArrayFieldProps<TFieldValues, react_hook_form.Path<TFieldValues>>, "
|
669
|
-
submit?: SubmitButtonProps | undefined;
|
265
|
+
} & Omit<dist.ArrayFieldProps<TFieldValues, react_hook_form.Path<TFieldValues>>, "name" | "children">) | undefined; } & {
|
266
|
+
submit?: dist.SubmitButtonProps | undefined;
|
670
267
|
} & object) | undefined;
|
671
268
|
} & {
|
672
269
|
steps: TSteps;
|
673
|
-
ref?:
|
674
|
-
} & object) =>
|
270
|
+
ref?: react.ForwardedRef<HTMLFormElement> | undefined;
|
271
|
+
} & object) => react.ReactElement<any, string | react.JSXElementConstructor<any>>) & {
|
675
272
|
displayName?: string | undefined;
|
676
273
|
id?: string | undefined;
|
677
274
|
};
|
678
|
-
declare const FormDialog: ZodFormType<unknown, object & Omit<_saas_ui_modals.BaseModalProps, "children">, object & DefaultFieldOverrides & {
|
679
|
-
cancel?:
|
275
|
+
declare const FormDialog: ZodFormType<unknown, object & Omit<_saas_ui_modals.BaseModalProps, "children">, any, object & dist.DefaultFieldOverrides & {
|
276
|
+
cancel?: _chakra_ui_button.ButtonProps | undefined;
|
680
277
|
}>;
|
681
278
|
|
682
|
-
export { Form, FormDialog, StepForm, ZodFormType, ZodMeta, createZodForm, createZodFormDialog, createZodStepForm, getFieldsFromSchema, getNestedSchema, zodFieldResolver, zodMeta, zodParseMeta };
|
279
|
+
export { Form, FormDialog, StepForm, type ZodFormType, type ZodMeta, createZodForm, createZodFormDialog, createZodStepForm, getFieldsFromSchema, getNestedSchema, zodFieldResolver, zodMeta, zodParseMeta };
|