@saas-ui/forms 2.0.0-next.11 → 2.0.0-next.13
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +49 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +28 -9
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +28 -9
- package/dist/index.mjs.map +1 -1
- package/dist/yup/index.d.ts +3 -3
- package/dist/zod/index.d.ts +5 -5
- package/package.json +22 -8
- package/src/array-field.tsx +6 -3
- package/src/form-context.tsx +1 -1
- package/src/object-field.tsx +22 -5
- package/src/select/select.tsx +2 -2
package/dist/zod/index.d.ts
CHANGED
@@ -348,8 +348,8 @@ type Options = {
|
|
348
348
|
declare const getFieldsFromSchema: (schema: zod.ZodTypeAny) => FieldProps$1[];
|
349
349
|
declare const getNestedSchema: (schema: zod.ZodTypeAny, path: string) => any;
|
350
350
|
declare const zodFieldResolver: <T extends zod.ZodTypeAny>(schema: T) => {
|
351
|
-
getFields(): FieldProps$1
|
352
|
-
getNestedFields(name: string): FieldProps$1
|
351
|
+
getFields(): FieldProps$1[];
|
352
|
+
getNestedFields(name: string): FieldProps$1[];
|
353
353
|
};
|
354
354
|
interface ZodMeta {
|
355
355
|
label: string;
|
@@ -451,7 +451,7 @@ declare const createZodForm: <FieldDefs>(options?: CreateZodFormProps<FieldDefs>
|
|
451
451
|
pin: react.FC<_saas_ui_forms.PinFieldProps & _saas_ui_forms.BaseFieldProps<_saas_ui_forms.FieldValues, string>>;
|
452
452
|
'native-select': react.FC<_saas_ui_forms.NativeSelectProps & _saas_ui_forms.BaseFieldProps<_saas_ui_forms.FieldValues, string>>;
|
453
453
|
}, keyof FieldDefs> & FieldDefs)]>) => react.ReactNode);
|
454
|
-
fields?: ({ [K_1 in react_hook_form.Path<z.TypeOf<TSchema>> | (react_hook_form.Path<z.TypeOf<TSchema>> extends infer T_1 ? T_1 extends react_hook_form.Path<z.TypeOf<TSchema>> ? T_1 extends string ? (string extends T_1 ? (T_1 & string)[] : T_1 extends infer T_2 ? T_2 extends T_1 ? T_2 extends "" ? [] : T_2 extends `${infer T_3}.${infer U}` ? [T_3, ...string extends U ? (U & string)[] : U extends "" ? [] : U extends `${infer T_3}.${infer U}` ? [T_3, ...string extends U ? (U & string)[] : U extends "" ? [] : U extends `${infer T_3}.${infer U}` ? [T_3, ...string extends U ? (U & string)[] : U extends "" ? [] : U extends `${infer T_3}.${infer U}` ? [T_3, ...string extends U ? (U & string)[] : U extends "" ? [] : U extends `${infer T_3}.${infer U}` ? [T_3, ...string extends U ? (U & string)[] : U extends "" ? [] : U extends `${infer T_3}.${infer U}` ? [T_3, ...string extends U ? (U & string)[] : U extends "" ? [] : U extends `${infer T_3}.${infer U}` ? [T_3, ...string extends U ? (U & string)[] : U extends "" ? [] : U extends `${infer T_3}.${infer U}` ? [T_3, ...string extends U ? (U & string)[] : U extends "" ? [] : U extends `${infer T_3}.${infer U}` ? [T_3, ...string extends U ? (U & string)[] : U extends "" ? [] : U extends `${infer T_3}.${infer U}` ? [T_3, ...string extends U ? (U & string)[] : U extends "" ? [] : U extends `${infer T_3}.${infer U}` ? [T_3, ...any] : [U]] : [U]] : [U]] : [U]] : [U]] : [U]] : [U]] : [U]] : [U]] : [U]] : [T_2] : never : never) extends infer T_4 ? T_4 extends (string extends T_1 ? (T_1 & string)[] : T_1 extends infer
|
454
|
+
fields?: ({ [K_1 in react_hook_form.Path<z.TypeOf<TSchema>> | (react_hook_form.Path<z.TypeOf<TSchema>> extends infer T_1 ? T_1 extends react_hook_form.Path<z.TypeOf<TSchema>> ? T_1 extends string ? (string extends T_1 ? (T_1 & string)[] : T_1 extends infer T_2 ? T_2 extends T_1 ? T_2 extends "" ? [] : T_2 extends `${infer T_3}.${infer U}` ? [T_3, ...string extends U ? (U & string)[] : U extends "" ? [] : U extends `${infer T_3}.${infer U}` ? [T_3, ...string extends U ? (U & string)[] : U extends "" ? [] : U extends `${infer T_3}.${infer U}` ? [T_3, ...string extends U ? (U & string)[] : U extends "" ? [] : U extends `${infer T_3}.${infer U}` ? [T_3, ...string extends U ? (U & string)[] : U extends "" ? [] : U extends `${infer T_3}.${infer U}` ? [T_3, ...string extends U ? (U & string)[] : U extends "" ? [] : U extends `${infer T_3}.${infer U}` ? [T_3, ...string extends U ? (U & string)[] : U extends "" ? [] : U extends `${infer T_3}.${infer U}` ? [T_3, ...string extends U ? (U & string)[] : U extends "" ? [] : U extends `${infer T_3}.${infer U}` ? [T_3, ...string extends U ? (U & string)[] : U extends "" ? [] : U extends `${infer T_3}.${infer U}` ? [T_3, ...string extends U ? (U & string)[] : U extends "" ? [] : U extends `${infer T_3}.${infer U}` ? [T_3, ...string extends U ? (U & string)[] : U extends "" ? [] : U extends `${infer T_3}.${infer U}` ? [T_3, ...any] : [U]] : [U]] : [U]] : [U]] : [U]] : [U]] : [U]] : [U]] : [U]] : [U]] : [T_2] : never : never) extends infer T_4 ? T_4 extends (string extends T_1 ? (T_1 & string)[] : T_1 extends infer T_15 ? T_15 extends T_1 ? T_15 extends "" ? [] : T_15 extends `${infer T_3}.${infer U}` ? [T_3, ...string extends U ? (U & string)[] : U extends "" ? [] : U extends `${infer T_3}.${infer U}` ? [T_3, ...string extends U ? (U & string)[] : U extends "" ? [] : U extends `${infer T_3}.${infer U}` ? [T_3, ...string extends U ? (U & string)[] : U extends "" ? [] : U extends `${infer T_3}.${infer U}` ? [T_3, ...string extends U ? (U & string)[] : U extends "" ? [] : U extends `${infer T_3}.${infer U}` ? [T_3, ...string extends U ? (U & string)[] : U extends "" ? [] : U extends `${infer T_3}.${infer U}` ? [T_3, ...string extends U ? (U & string)[] : U extends "" ? [] : U extends `${infer T_3}.${infer U}` ? [T_3, ...string extends U ? (U & string)[] : U extends "" ? [] : U extends `${infer T_3}.${infer U}` ? [T_3, ...string extends U ? (U & string)[] : U extends "" ? [] : U extends `${infer T_3}.${infer U}` ? [T_3, ...string extends U ? (U & string)[] : U extends "" ? [] : U extends `${infer T_3}.${infer U}` ? [T_3, ...string extends U ? (U & string)[] : U extends "" ? [] : U extends `${infer T_3}.${infer U}` ? [T_3, ...any] : [U]] : [U]] : [U]] : [U]] : [U]] : [U]] : [U]] : [U]] : [U]] : [U]] : [T_15] : never : never) ? T_4 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_5 ? T_5 extends R ? T_5 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_6 ? T_6 extends R ? T_6 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_7 ? T_7 extends R ? T_7 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_8 ? T_8 extends R ? T_8 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_9 ? T_9 extends R ? T_9 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_10 ? T_10 extends R ? T_10 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_11 ? T_11 extends R ? T_11 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_12 ? T_12 extends R ? T_12 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_13 ? T_13 extends R ? T_13 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_14 ? T_14 extends R ? T_14 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)]?: Omit<((FieldDefs extends never ? {
|
455
455
|
text: react.FC<_saas_ui_forms.InputFieldProps & _saas_ui_forms.BaseFieldProps<_saas_ui_forms.FieldValues, string>>;
|
456
456
|
email: react.FC<_saas_ui_forms.InputFieldProps & _saas_ui_forms.BaseFieldProps<_saas_ui_forms.FieldValues, string>>;
|
457
457
|
url: react.FC<_saas_ui_forms.InputFieldProps & _saas_ui_forms.BaseFieldProps<_saas_ui_forms.FieldValues, string>>;
|
@@ -479,7 +479,7 @@ declare const createZodForm: <FieldDefs>(options?: CreateZodFormProps<FieldDefs>
|
|
479
479
|
radio: react.FC<_saas_ui_forms.RadioInputProps & _saas_ui_forms.BaseFieldProps<_saas_ui_forms.FieldValues, string>>;
|
480
480
|
pin: react.FC<_saas_ui_forms.PinFieldProps & _saas_ui_forms.BaseFieldProps<_saas_ui_forms.FieldValues, string>>;
|
481
481
|
'native-select': react.FC<_saas_ui_forms.NativeSelectProps & _saas_ui_forms.BaseFieldProps<_saas_ui_forms.FieldValues, string>>;
|
482
|
-
}, keyof FieldDefs> & FieldDefs) extends infer
|
482
|
+
}, keyof FieldDefs> & FieldDefs) extends infer T_16 ? { [K_2 in keyof T_16]: (FieldDefs extends never ? {
|
483
483
|
text: react.FC<_saas_ui_forms.InputFieldProps & _saas_ui_forms.BaseFieldProps<_saas_ui_forms.FieldValues, string>>;
|
484
484
|
email: react.FC<_saas_ui_forms.InputFieldProps & _saas_ui_forms.BaseFieldProps<_saas_ui_forms.FieldValues, string>>;
|
485
485
|
url: react.FC<_saas_ui_forms.InputFieldProps & _saas_ui_forms.BaseFieldProps<_saas_ui_forms.FieldValues, string>>;
|
@@ -572,7 +572,7 @@ declare const Form: <TSchema extends zod.AnyZodObject = zod.AnyZodObject, TConte
|
|
572
572
|
} & Omit<PinFieldProps & BaseFieldProps<react_hook_form.FieldValues, string>, keyof BaseFieldProps<TFieldValues, TName>> & BaseFieldProps<zod.TypeOf<TSchema>, react_hook_form.Path<zod.TypeOf<TSchema>>>) | ({
|
573
573
|
type?: "native-select" | undefined;
|
574
574
|
} & Omit<NativeSelectProps & BaseFieldProps<react_hook_form.FieldValues, string>, keyof BaseFieldProps<TFieldValues, TName>> & BaseFieldProps<zod.TypeOf<TSchema>, react_hook_form.Path<zod.TypeOf<TSchema>>>)>) => react.ReactNode);
|
575
|
-
fields?: ({ [K in react_hook_form.Path<zod.TypeOf<TSchema>> | (react_hook_form.Path<zod.TypeOf<TSchema>> extends infer T ? T extends react_hook_form.Path<zod.TypeOf<TSchema>> ? T extends string ? (string extends T ? (T & string)[] : T extends infer T_1 ? T_1 extends T ? T_1 extends "" ? [] : T_1 extends `${infer T_2}.${infer U}` ? [T_2, ...string extends U ? (U & string)[] : U extends "" ? [] : U extends `${infer T_2}.${infer U}` ? [T_2, ...string extends U ? (U & string)[] : U extends "" ? [] : U extends `${infer T_2}.${infer U}` ? [T_2, ...string extends U ? (U & string)[] : U extends "" ? [] : U extends `${infer T_2}.${infer U}` ? [T_2, ...string extends U ? (U & string)[] : U extends "" ? [] : U extends `${infer T_2}.${infer U}` ? [T_2, ...string extends U ? (U & string)[] : U extends "" ? [] : U extends `${infer T_2}.${infer U}` ? [T_2, ...string extends U ? (U & string)[] : U extends "" ? [] : U extends `${infer T_2}.${infer U}` ? [T_2, ...string extends U ? (U & string)[] : U extends "" ? [] : U extends `${infer T_2}.${infer U}` ? [T_2, ...string extends U ? (U & string)[] : U extends "" ? [] : U extends `${infer T_2}.${infer U}` ? [T_2, ...string extends U ? (U & string)[] : U extends "" ? [] : U extends `${infer T_2}.${infer U}` ? [T_2, ...string extends U ? (U & string)[] : U extends "" ? [] : U extends `${infer T_2}.${infer U}` ? [T_2, ...any] : [U]] : [U]] : [U]] : [U]] : [U]] : [U]] : [U]] : [U]] : [U]] : [U]] : [T_1] : never : never) extends infer T_3 ? T_3 extends (string extends T ? (T & string)[] : T extends infer
|
575
|
+
fields?: ({ [K in react_hook_form.Path<zod.TypeOf<TSchema>> | (react_hook_form.Path<zod.TypeOf<TSchema>> extends infer T ? T extends react_hook_form.Path<zod.TypeOf<TSchema>> ? T extends string ? (string extends T ? (T & string)[] : T extends infer T_1 ? T_1 extends T ? T_1 extends "" ? [] : T_1 extends `${infer T_2}.${infer U}` ? [T_2, ...string extends U ? (U & string)[] : U extends "" ? [] : U extends `${infer T_2}.${infer U}` ? [T_2, ...string extends U ? (U & string)[] : U extends "" ? [] : U extends `${infer T_2}.${infer U}` ? [T_2, ...string extends U ? (U & string)[] : U extends "" ? [] : U extends `${infer T_2}.${infer U}` ? [T_2, ...string extends U ? (U & string)[] : U extends "" ? [] : U extends `${infer T_2}.${infer U}` ? [T_2, ...string extends U ? (U & string)[] : U extends "" ? [] : U extends `${infer T_2}.${infer U}` ? [T_2, ...string extends U ? (U & string)[] : U extends "" ? [] : U extends `${infer T_2}.${infer U}` ? [T_2, ...string extends U ? (U & string)[] : U extends "" ? [] : U extends `${infer T_2}.${infer U}` ? [T_2, ...string extends U ? (U & string)[] : U extends "" ? [] : U extends `${infer T_2}.${infer U}` ? [T_2, ...string extends U ? (U & string)[] : U extends "" ? [] : U extends `${infer T_2}.${infer U}` ? [T_2, ...string extends U ? (U & string)[] : U extends "" ? [] : U extends `${infer T_2}.${infer U}` ? [T_2, ...any] : [U]] : [U]] : [U]] : [U]] : [U]] : [U]] : [U]] : [U]] : [U]] : [U]] : [T_1] : never : never) extends infer T_3 ? T_3 extends (string extends T ? (T & string)[] : T extends infer T_14 ? T_14 extends T ? T_14 extends "" ? [] : T_14 extends `${infer T_2}.${infer U}` ? [T_2, ...string extends U ? (U & string)[] : U extends "" ? [] : U extends `${infer T_2}.${infer U}` ? [T_2, ...string extends U ? (U & string)[] : U extends "" ? [] : U extends `${infer T_2}.${infer U}` ? [T_2, ...string extends U ? (U & string)[] : U extends "" ? [] : U extends `${infer T_2}.${infer U}` ? [T_2, ...string extends U ? (U & string)[] : U extends "" ? [] : U extends `${infer T_2}.${infer U}` ? [T_2, ...string extends U ? (U & string)[] : U extends "" ? [] : U extends `${infer T_2}.${infer U}` ? [T_2, ...string extends U ? (U & string)[] : U extends "" ? [] : U extends `${infer T_2}.${infer U}` ? [T_2, ...string extends U ? (U & string)[] : U extends "" ? [] : U extends `${infer T_2}.${infer U}` ? [T_2, ...string extends U ? (U & string)[] : U extends "" ? [] : U extends `${infer T_2}.${infer U}` ? [T_2, ...string extends U ? (U & string)[] : U extends "" ? [] : U extends `${infer T_2}.${infer U}` ? [T_2, ...string extends U ? (U & string)[] : U extends "" ? [] : U extends `${infer T_2}.${infer U}` ? [T_2, ...any] : [U]] : [U]] : [U]] : [U]] : [U]] : [U]] : [U]] : [U]] : [U]] : [U]] : [T_14] : never : never) ? T_3 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_4 ? T_4 extends R ? T_4 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_5 ? T_5 extends R ? T_5 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_6 ? T_6 extends R ? T_6 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_7 ? T_7 extends R ? T_7 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_8 ? T_8 extends R ? T_8 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_9 ? T_9 extends R ? T_9 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_10 ? T_10 extends R ? T_10 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_11 ? T_11 extends R ? T_11 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_12 ? T_12 extends R ? T_12 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_13 ? T_13 extends R ? T_13 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)]?: Omit<({
|
576
576
|
type?: "number" | undefined;
|
577
577
|
} & Omit<NumberInputFieldProps & BaseFieldProps<react_hook_form.FieldValues, string>, keyof BaseFieldProps<TFieldValues, TName>> & BaseFieldProps<zod.TypeOf<TSchema>, react_hook_form.Path<zod.TypeOf<TSchema>>>) | ({
|
578
578
|
type?: "text" | undefined;
|
package/package.json
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
{
|
2
2
|
"name": "@saas-ui/forms",
|
3
|
-
"version": "2.0.0-next.
|
3
|
+
"version": "2.0.0-next.13",
|
4
4
|
"description": "Fully functional forms for Chakra UI.",
|
5
5
|
"source": "src/index.ts",
|
6
6
|
"exports": {
|
7
7
|
".": {
|
8
8
|
"require": "./dist/index.js",
|
9
|
-
"
|
9
|
+
"types": "./dist/index.d.ts",
|
10
|
+
"import": "./dist/index.modern.mjs"
|
10
11
|
},
|
11
12
|
"./src": {
|
12
13
|
"default": "./src/index.ts"
|
@@ -14,7 +15,7 @@
|
|
14
15
|
"./yup": {
|
15
16
|
"require": "./dist/yup/index.js",
|
16
17
|
"types": "./dist/yup/index.d.ts",
|
17
|
-
"import": "./dist/yup/index.mjs"
|
18
|
+
"import": "./dist/yup/index.modern.mjs"
|
18
19
|
},
|
19
20
|
"./yup/src": {
|
20
21
|
"default": "./yup/src/index.ts"
|
@@ -22,20 +23,33 @@
|
|
22
23
|
"./zod": {
|
23
24
|
"require": "./dist/zod/index.js",
|
24
25
|
"types": "./dist/zod/index.d.ts",
|
25
|
-
"import": "./dist/zod/index.mjs"
|
26
|
+
"import": "./dist/zod/index.modern.mjs"
|
26
27
|
},
|
27
28
|
"./zod/src": {
|
28
29
|
"default": "./zod/src/index.ts"
|
29
30
|
},
|
30
31
|
"./ajv": {
|
31
32
|
"require": "./dist/ajv/index.js",
|
32
|
-
"types": "./dist/
|
33
|
-
"import": "./dist/ajv/index.mjs"
|
33
|
+
"types": "./dist/ajv/index.d.ts",
|
34
|
+
"import": "./dist/ajv/index.modern.mjs"
|
34
35
|
},
|
35
36
|
"./ajv/src": {
|
36
37
|
"default": "./ajv/src/index.ts"
|
37
38
|
}
|
38
39
|
},
|
40
|
+
"typesVersions": {
|
41
|
+
"*": {
|
42
|
+
"ajv": [
|
43
|
+
"./dist/ajv/index.d.ts"
|
44
|
+
],
|
45
|
+
"yup": [
|
46
|
+
"./dist/yup/index.d.ts"
|
47
|
+
],
|
48
|
+
"zod": [
|
49
|
+
"./dist/zod/index.d.ts"
|
50
|
+
]
|
51
|
+
}
|
52
|
+
},
|
39
53
|
"main": "./dist/index.js",
|
40
54
|
"module": "./dist/index.mjs",
|
41
55
|
"types": "./dist/index.d.ts",
|
@@ -89,7 +103,8 @@
|
|
89
103
|
"dependencies": {
|
90
104
|
"@chakra-ui/react-utils": "^2.0.12",
|
91
105
|
"@chakra-ui/utils": "^2.0.15",
|
92
|
-
"@
|
106
|
+
"@hookform/resolvers": "^3.0.1",
|
107
|
+
"@saas-ui/core": "2.0.0-next.11",
|
93
108
|
"react-hook-form": "^7.43.9"
|
94
109
|
},
|
95
110
|
"peerDependencies": {
|
@@ -101,7 +116,6 @@
|
|
101
116
|
"react-dom": ">=18.0.0"
|
102
117
|
},
|
103
118
|
"devDependencies": {
|
104
|
-
"@hookform/resolvers": "^3.0.1",
|
105
119
|
"@types/json-schema": "^7.0.11",
|
106
120
|
"ajv": "^8.12.0",
|
107
121
|
"ajv-errors": "^3.0.0",
|
package/src/array-field.tsx
CHANGED
@@ -30,6 +30,7 @@ import {
|
|
30
30
|
import { FieldPath, FieldValues } from 'react-hook-form'
|
31
31
|
import { isFunction } from '@chakra-ui/utils'
|
32
32
|
import { MaybeRenderProp } from '@chakra-ui/react-utils'
|
33
|
+
import { useFieldProps } from './form-context'
|
33
34
|
|
34
35
|
export interface ArrayFieldButtonProps extends ButtonProps {}
|
35
36
|
|
@@ -262,12 +263,14 @@ export const ArrayFieldContainer = React.forwardRef(
|
|
262
263
|
}: ArrayFieldContainerProps,
|
263
264
|
ref: React.ForwardedRef<UseArrayFieldReturn>
|
264
265
|
) => {
|
266
|
+
const overrides = useFieldProps(name)
|
267
|
+
|
265
268
|
const context = useArrayField({
|
266
269
|
name,
|
267
270
|
defaultValue,
|
268
271
|
keyName,
|
269
|
-
min,
|
270
|
-
max,
|
272
|
+
min: min || (overrides as any)?.min,
|
273
|
+
max: max || (overrides as any)?.max,
|
271
274
|
})
|
272
275
|
|
273
276
|
// This exposes the useArrayField api through the forwarded ref
|
@@ -275,7 +278,7 @@ export const ArrayFieldContainer = React.forwardRef(
|
|
275
278
|
|
276
279
|
return (
|
277
280
|
<ArrayFieldProvider value={context}>
|
278
|
-
<BaseField name={name} {...fieldProps}>
|
281
|
+
<BaseField name={name} {...fieldProps} {...overrides}>
|
279
282
|
{children}
|
280
283
|
</BaseField>
|
281
284
|
</ArrayFieldProvider>
|
package/src/form-context.tsx
CHANGED
@@ -57,7 +57,7 @@ export const useFieldProps = <TFieldValues extends FieldValues = FieldValues>(
|
|
57
57
|
): BaseFieldProps<TFieldValues> | undefined => {
|
58
58
|
const parsedName = name?.replace(/\.[0-9]/g, '.$')
|
59
59
|
const context = useFormContext()
|
60
|
-
return context?.fields?.[parsedName] as any
|
60
|
+
return (context?.fields?.[parsedName] as any) || {}
|
61
61
|
}
|
62
62
|
|
63
63
|
export type UseFormReturn<
|
package/src/object-field.tsx
CHANGED
@@ -12,6 +12,7 @@ import { BaseFieldProps } from './types'
|
|
12
12
|
|
13
13
|
import { mapNestedFields } from './utils'
|
14
14
|
import { FieldPath, FieldValues } from 'react-hook-form'
|
15
|
+
import { useFieldProps } from './form-context'
|
15
16
|
|
16
17
|
export interface ObjectFieldProps<
|
17
18
|
TFieldValues extends FieldValues = FieldValues,
|
@@ -33,13 +34,29 @@ export const FormLegend = (props: FormLabelProps) => {
|
|
33
34
|
* @see Docs https://saas-ui.dev/docs/components/forms/object-field
|
34
35
|
*/
|
35
36
|
export const ObjectField: React.FC<ObjectFieldProps> = (props) => {
|
36
|
-
const {
|
37
|
-
|
37
|
+
const {
|
38
|
+
name,
|
39
|
+
label,
|
40
|
+
hideLabel: hideLabelProp,
|
41
|
+
children,
|
42
|
+
columns: columnsProp,
|
43
|
+
spacing: spacingProp,
|
44
|
+
...fieldProps
|
45
|
+
} = props
|
46
|
+
|
47
|
+
const { hideLabel, columns, spacing, ...overrides } = useFieldProps(
|
48
|
+
name
|
49
|
+
) as Omit<ObjectFieldProps, 'name'>
|
38
50
|
|
39
51
|
return (
|
40
|
-
<FormControl name={name} as="fieldset" {...fieldProps}>
|
41
|
-
<FormLegend display={hideLabel ? 'none' : 'block'}>
|
42
|
-
|
52
|
+
<FormControl name={name} as="fieldset" {...fieldProps} {...overrides}>
|
53
|
+
<FormLegend display={hideLabelProp || hideLabel ? 'none' : 'block'}>
|
54
|
+
{label}
|
55
|
+
</FormLegend>
|
56
|
+
<FormLayout
|
57
|
+
columns={columnsProp || columns}
|
58
|
+
gridGap={spacingProp || spacing}
|
59
|
+
>
|
43
60
|
{mapNestedFields(name, children)}
|
44
61
|
</FormLayout>
|
45
62
|
</FormControl>
|
package/src/select/select.tsx
CHANGED
@@ -80,7 +80,7 @@ export const SelectButton = forwardRef<SelectButtonProps, 'button'>(
|
|
80
80
|
|
81
81
|
const height = styles.field?.h || styles.field?.height
|
82
82
|
|
83
|
-
const buttonStyles:
|
83
|
+
const buttonStyles: any = {
|
84
84
|
fontWeight: 'normal',
|
85
85
|
textAlign: 'left',
|
86
86
|
color: 'inherit',
|
@@ -101,6 +101,7 @@ export const SelectButton = forwardRef<SelectButtonProps, 'button'>(
|
|
101
101
|
<MenuButton
|
102
102
|
as={Button}
|
103
103
|
id={id || React.useId()}
|
104
|
+
{...buttonStyles}
|
104
105
|
{...rest}
|
105
106
|
onFocus={onFocus}
|
106
107
|
onBlur={onBlur}
|
@@ -111,7 +112,6 @@ export const SelectButton = forwardRef<SelectButtonProps, 'button'>(
|
|
111
112
|
data-required={dataAttr(isRequired)}
|
112
113
|
rightIcon={rightIcon}
|
113
114
|
ref={ref}
|
114
|
-
sx={buttonStyles}
|
115
115
|
>
|
116
116
|
{renderValue(displayValue) || placeholder}
|
117
117
|
</MenuButton>
|