@ttoss/forms 0.8.0 → 0.9.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/dist/esm/index.js +9 -5
- package/dist/index.d.ts +42 -6
- package/dist/index.js +13 -5
- package/package.json +5 -8
- package/src/FormField.tsx +3 -1
- package/src/index.ts +7 -2
package/dist/esm/index.js
CHANGED
|
@@ -3,6 +3,11 @@
|
|
|
3
3
|
// tsup.inject.js
|
|
4
4
|
import * as React from "react";
|
|
5
5
|
|
|
6
|
+
// src/index.ts
|
|
7
|
+
import { yupResolver } from "@hookform/resolvers/yup";
|
|
8
|
+
export * from "react-hook-form";
|
|
9
|
+
import * as yup from "yup";
|
|
10
|
+
|
|
6
11
|
// src/Form.tsx
|
|
7
12
|
import { Box } from "@ttoss/ui";
|
|
8
13
|
import { FormProvider } from "react-hook-form";
|
|
@@ -226,14 +231,13 @@ FormField.Input = FormFieldInput;
|
|
|
226
231
|
FormField.Radio = FormFieldRadio;
|
|
227
232
|
FormField.Select = FormFieldSelect;
|
|
228
233
|
FormField.Checkbox = FormFieldCheckbox;
|
|
229
|
-
|
|
230
|
-
// src/index.ts
|
|
231
|
-
import { yupResolver } from "@hookform/resolvers/yup";
|
|
232
|
-
export * from "react-hook-form";
|
|
233
|
-
import * as yup from "yup";
|
|
234
234
|
export {
|
|
235
235
|
Form,
|
|
236
236
|
FormField,
|
|
237
|
+
FormFieldCheckbox,
|
|
238
|
+
FormFieldInput,
|
|
239
|
+
FormFieldRadio,
|
|
240
|
+
FormFieldSelect,
|
|
237
241
|
yup,
|
|
238
242
|
yupResolver
|
|
239
243
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
+
export { yupResolver } from '@hookform/resolvers/yup';
|
|
1
2
|
import * as react_hook_form from 'react-hook-form';
|
|
2
|
-
import { FieldValues } from 'react-hook-form';
|
|
3
|
+
import { FieldValues, Path } from 'react-hook-form';
|
|
3
4
|
export * from 'react-hook-form';
|
|
4
|
-
import * as React from 'react';
|
|
5
|
-
import { BoxProps } from '@ttoss/ui';
|
|
6
|
-
export { yupResolver } from '@hookform/resolvers/yup';
|
|
7
5
|
import * as yup from 'yup';
|
|
8
6
|
export { yup };
|
|
7
|
+
import * as React from 'react';
|
|
8
|
+
import { BoxProps, SelectProps } from '@ttoss/ui';
|
|
9
9
|
|
|
10
10
|
declare const Form: <TFieldValues extends FieldValues = FieldValues>({ children, onSubmit, sx, ...formMethods }: {
|
|
11
11
|
children?: React.ReactNode;
|
|
@@ -15,6 +15,9 @@ declare const Form: <TFieldValues extends FieldValues = FieldValues>({ children,
|
|
|
15
15
|
children: React.ReactNode | React.ReactNode[];
|
|
16
16
|
} & react_hook_form.UseFormReturn<TFieldValues, any>) => JSX.Element;
|
|
17
17
|
|
|
18
|
+
/**
|
|
19
|
+
* DEPRECATED: Use `FormFieldInput` instead.
|
|
20
|
+
*/
|
|
18
21
|
declare const FormField: {
|
|
19
22
|
(): null;
|
|
20
23
|
Input: <TFieldValues extends react_hook_form.FieldValues = react_hook_form.FieldValues>({ label, name, }: {
|
|
@@ -25,7 +28,9 @@ declare const FormField: {
|
|
|
25
28
|
label?: string | undefined;
|
|
26
29
|
name: react_hook_form.Path<TFieldValues_1>;
|
|
27
30
|
options: {
|
|
28
|
-
value: string | number;
|
|
31
|
+
value: string | number; /**
|
|
32
|
+
* DEPRECATED: Use `FormFieldInput` instead.
|
|
33
|
+
*/
|
|
29
34
|
label: string;
|
|
30
35
|
}[];
|
|
31
36
|
}) => JSX.Element;
|
|
@@ -44,4 +49,35 @@ declare const FormField: {
|
|
|
44
49
|
}) => JSX.Element;
|
|
45
50
|
};
|
|
46
51
|
|
|
47
|
-
|
|
52
|
+
declare const FormFieldCheckbox: <TFieldValues extends FieldValues = FieldValues>({ label, name, }: {
|
|
53
|
+
label?: string | undefined;
|
|
54
|
+
name: Path<TFieldValues>;
|
|
55
|
+
}) => JSX.Element;
|
|
56
|
+
|
|
57
|
+
declare const FormFieldInput: <TFieldValues extends FieldValues = FieldValues>({ label, name, }: {
|
|
58
|
+
label?: string | undefined;
|
|
59
|
+
name: Path<TFieldValues>;
|
|
60
|
+
}) => JSX.Element;
|
|
61
|
+
|
|
62
|
+
declare type FormRadioOption$1 = {
|
|
63
|
+
value: string | number;
|
|
64
|
+
label: string;
|
|
65
|
+
};
|
|
66
|
+
declare const FormFieldRadio: <TFieldValues extends FieldValues = FieldValues>({ label, name, options, }: {
|
|
67
|
+
label?: string | undefined;
|
|
68
|
+
name: Path<TFieldValues>;
|
|
69
|
+
options: FormRadioOption$1[];
|
|
70
|
+
}) => JSX.Element;
|
|
71
|
+
|
|
72
|
+
declare type FormRadioOption = {
|
|
73
|
+
value: string | number;
|
|
74
|
+
label: string;
|
|
75
|
+
};
|
|
76
|
+
declare const FormFieldSelect: <TFieldValues extends FieldValues = FieldValues>({ label, name, options, arrow, }: {
|
|
77
|
+
label?: string | undefined;
|
|
78
|
+
name: Path<TFieldValues>;
|
|
79
|
+
options: FormRadioOption[];
|
|
80
|
+
arrow?: SelectProps['arrow'];
|
|
81
|
+
}) => JSX.Element;
|
|
82
|
+
|
|
83
|
+
export { Form, FormField, FormFieldCheckbox, FormFieldInput, FormFieldRadio, FormFieldSelect };
|
package/dist/index.js
CHANGED
|
@@ -30,6 +30,10 @@ var src_exports = {};
|
|
|
30
30
|
__export(src_exports, {
|
|
31
31
|
Form: () => Form,
|
|
32
32
|
FormField: () => FormField,
|
|
33
|
+
FormFieldCheckbox: () => FormFieldCheckbox,
|
|
34
|
+
FormFieldInput: () => FormFieldInput,
|
|
35
|
+
FormFieldRadio: () => FormFieldRadio,
|
|
36
|
+
FormFieldSelect: () => FormFieldSelect,
|
|
33
37
|
yup: () => yup,
|
|
34
38
|
yupResolver: () => import_yup.yupResolver
|
|
35
39
|
});
|
|
@@ -38,6 +42,11 @@ module.exports = __toCommonJS(src_exports);
|
|
|
38
42
|
// tsup.inject.js
|
|
39
43
|
var React = __toESM(require("react"));
|
|
40
44
|
|
|
45
|
+
// src/index.ts
|
|
46
|
+
var import_yup = require("@hookform/resolvers/yup");
|
|
47
|
+
__reExport(src_exports, require("react-hook-form"), module.exports);
|
|
48
|
+
var yup = __toESM(require("yup"));
|
|
49
|
+
|
|
41
50
|
// src/Form.tsx
|
|
42
51
|
var import_ui = require("@ttoss/ui");
|
|
43
52
|
var import_react_hook_form = require("react-hook-form");
|
|
@@ -261,15 +270,14 @@ FormField.Input = FormFieldInput;
|
|
|
261
270
|
FormField.Radio = FormFieldRadio;
|
|
262
271
|
FormField.Select = FormFieldSelect;
|
|
263
272
|
FormField.Checkbox = FormFieldCheckbox;
|
|
264
|
-
|
|
265
|
-
// src/index.ts
|
|
266
|
-
var import_yup = require("@hookform/resolvers/yup");
|
|
267
|
-
__reExport(src_exports, require("react-hook-form"), module.exports);
|
|
268
|
-
var yup = __toESM(require("yup"));
|
|
269
273
|
// Annotate the CommonJS export names for ESM import in node:
|
|
270
274
|
0 && (module.exports = {
|
|
271
275
|
Form,
|
|
272
276
|
FormField,
|
|
277
|
+
FormFieldCheckbox,
|
|
278
|
+
FormFieldInput,
|
|
279
|
+
FormFieldRadio,
|
|
280
|
+
FormFieldSelect,
|
|
273
281
|
yup,
|
|
274
282
|
yupResolver
|
|
275
283
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ttoss/forms",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.1",
|
|
4
4
|
"license": "UNLICENSED",
|
|
5
5
|
"author": "ttoss",
|
|
6
6
|
"contributors": [
|
|
@@ -28,20 +28,17 @@
|
|
|
28
28
|
"react": "^18.2.0"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
|
-
"@ttoss/config": "^1.
|
|
32
|
-
"@ttoss/test-utils": "^1.18.
|
|
33
|
-
"@ttoss/ui": "^1.25.
|
|
31
|
+
"@ttoss/config": "^1.21.0",
|
|
32
|
+
"@ttoss/test-utils": "^1.18.1",
|
|
33
|
+
"@ttoss/ui": "^1.25.1",
|
|
34
34
|
"@types/jest": "^29.2.3",
|
|
35
35
|
"jest": "^29.3.1",
|
|
36
36
|
"react": "^18.2.0",
|
|
37
37
|
"react-hook-form": "^7.39.7",
|
|
38
38
|
"yup": "^0.32.11"
|
|
39
39
|
},
|
|
40
|
-
"engines": {
|
|
41
|
-
"node": ">=16"
|
|
42
|
-
},
|
|
43
40
|
"publishConfig": {
|
|
44
41
|
"access": "public"
|
|
45
42
|
},
|
|
46
|
-
"gitHead": "
|
|
43
|
+
"gitHead": "e7bef1331103e477af72cbd5c27a5c3deab92dd1"
|
|
47
44
|
}
|
package/src/FormField.tsx
CHANGED
|
@@ -3,6 +3,9 @@ import { FormFieldInput } from './FormFieldInput';
|
|
|
3
3
|
import { FormFieldRadio } from './FormFieldRadio';
|
|
4
4
|
import { FormFieldSelect } from './FormFieldSelect';
|
|
5
5
|
|
|
6
|
+
/**
|
|
7
|
+
* DEPRECATED: Use `FormFieldInput` instead.
|
|
8
|
+
*/
|
|
6
9
|
const FormField = () => {
|
|
7
10
|
// to be implemented
|
|
8
11
|
return null;
|
|
@@ -11,7 +14,6 @@ const FormField = () => {
|
|
|
11
14
|
FormField.Input = FormFieldInput;
|
|
12
15
|
FormField.Radio = FormFieldRadio;
|
|
13
16
|
FormField.Select = FormFieldSelect;
|
|
14
|
-
|
|
15
17
|
FormField.Checkbox = FormFieldCheckbox;
|
|
16
18
|
|
|
17
19
|
export { FormField };
|
package/src/index.ts
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
|
-
export { Form } from './Form';
|
|
2
|
-
export { FormField } from './FormField';
|
|
3
1
|
export { yupResolver } from '@hookform/resolvers/yup';
|
|
4
2
|
export * from 'react-hook-form';
|
|
5
3
|
export * as yup from 'yup';
|
|
4
|
+
|
|
5
|
+
export { Form } from './Form';
|
|
6
|
+
export { FormField } from './FormField';
|
|
7
|
+
export { FormFieldCheckbox } from './FormFieldCheckbox';
|
|
8
|
+
export { FormFieldInput } from './FormFieldInput';
|
|
9
|
+
export { FormFieldRadio } from './FormFieldRadio';
|
|
10
|
+
export { FormFieldSelect } from './FormFieldSelect';
|