@ttoss/forms 0.22.5 → 0.22.7
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/README.md +4 -0
- package/dist/MultistepForm/index.js +11 -2
- package/dist/esm/MultistepForm/index.js +1 -1
- package/dist/esm/{chunk-NDUNPJBB.js → chunk-5SH4STWG.js} +5 -3
- package/dist/esm/index.js +2 -2
- package/dist/index.d.mts +5 -5
- package/dist/index.d.ts +5 -5
- package/dist/index.js +18 -2
- package/package.json +9 -10
- package/src/index.ts +18 -2
package/README.md
CHANGED
|
@@ -45,6 +45,10 @@ export const FormComponent = () => {
|
|
|
45
45
|
|
|
46
46
|
**WARNING:** I18n is necessary as `Forms` module has some integrations with it.
|
|
47
47
|
|
|
48
|
+
## React Hook Form
|
|
49
|
+
|
|
50
|
+
It exposes all the API from react-hook-form, so you can use all the methods and properties from it. Check the [React Hook Form](https://react-hook-form.com/docs) documentation for more details.
|
|
51
|
+
|
|
48
52
|
## FormFieldSelect support for Default Value
|
|
49
53
|
|
|
50
54
|
FormFieldSelect has support for default values, by assigning the first option defined or the value passed to it in the parameter `defaultValue`.
|
|
@@ -76,6 +76,7 @@ var import_ui16 = require("@ttoss/ui");
|
|
|
76
76
|
// src/index.ts
|
|
77
77
|
var src_exports = {};
|
|
78
78
|
__export(src_exports, {
|
|
79
|
+
Controller: () => import_react_hook_form6.Controller,
|
|
79
80
|
Form: () => Form,
|
|
80
81
|
FormField: () => FormField,
|
|
81
82
|
FormFieldCheckbox: () => FormFieldCheckbox,
|
|
@@ -89,8 +90,14 @@ __export(src_exports, {
|
|
|
89
90
|
FormFieldSelect: () => FormFieldSelect,
|
|
90
91
|
FormFieldTextarea: () => FormFieldTextarea,
|
|
91
92
|
FormGroup: () => FormGroup,
|
|
93
|
+
FormProvider: () => import_react_hook_form6.FormProvider,
|
|
94
|
+
useController: () => import_react_hook_form6.useController,
|
|
95
|
+
useFieldArray: () => import_react_hook_form6.useFieldArray,
|
|
92
96
|
useForm: () => import_react_hook_form6.useForm,
|
|
97
|
+
useFormContext: () => import_react_hook_form6.useFormContext,
|
|
93
98
|
useFormGroup: () => useFormGroup,
|
|
99
|
+
useFormState: () => import_react_hook_form6.useFormState,
|
|
100
|
+
useWatch: () => import_react_hook_form6.useWatch,
|
|
94
101
|
yup: () => yup,
|
|
95
102
|
yupResolver: () => import_yup2.yupResolver
|
|
96
103
|
});
|
|
@@ -137,8 +144,6 @@ var import_yup = require("yup");
|
|
|
137
144
|
|
|
138
145
|
// src/index.ts
|
|
139
146
|
var import_yup2 = require("@hookform/resolvers/yup");
|
|
140
|
-
__reExport(src_exports, require("react-hook-form"));
|
|
141
|
-
var import_react_hook_form6 = require("react-hook-form");
|
|
142
147
|
var yup = __toESM(require("yup"));
|
|
143
148
|
|
|
144
149
|
// src/Form.tsx
|
|
@@ -713,6 +718,10 @@ var FormGroup = props => {
|
|
|
713
718
|
});
|
|
714
719
|
};
|
|
715
720
|
|
|
721
|
+
// src/index.ts
|
|
722
|
+
var import_react_hook_form6 = require("react-hook-form");
|
|
723
|
+
__reExport(src_exports, require("react-hook-form"));
|
|
724
|
+
|
|
716
725
|
// src/MultistepForm/MultistepFlowMessageImageText.tsx
|
|
717
726
|
var import_ui14 = require("@ttoss/ui");
|
|
718
727
|
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** Powered by @ttoss/config. https://ttoss.dev/docs/modules/packages/config/ */
|
|
2
|
-
import { Form, useForm, yupResolver } from "../chunk-
|
|
2
|
+
import { Form, useForm, yupResolver } from "../chunk-5SH4STWG.js";
|
|
3
3
|
|
|
4
4
|
// src/MultistepForm/MultistepForm.tsx
|
|
5
5
|
import * as React3 from "react";
|
|
@@ -60,8 +60,6 @@ setLocale({
|
|
|
60
60
|
|
|
61
61
|
// src/index.ts
|
|
62
62
|
import { yupResolver } from "@hookform/resolvers/yup";
|
|
63
|
-
export * from "react-hook-form";
|
|
64
|
-
import { useForm } from "react-hook-form";
|
|
65
63
|
import * as yup from "yup";
|
|
66
64
|
|
|
67
65
|
// src/Form.tsx
|
|
@@ -635,4 +633,8 @@ var FormGroup = props => {
|
|
|
635
633
|
})
|
|
636
634
|
});
|
|
637
635
|
};
|
|
638
|
-
|
|
636
|
+
|
|
637
|
+
// src/index.ts
|
|
638
|
+
import { useForm, useFormContext as useFormContext2, useWatch, useFieldArray, useController as useController4, useFormState, Controller, FormProvider as FormProvider2 } from "react-hook-form";
|
|
639
|
+
export * from "react-hook-form";
|
|
640
|
+
export { Form, FormField, FormFieldCheckbox, FormFieldPatternFormat, FormFieldCreditCardNumber, FormFieldNumericFormat, FormFieldCurrencyInput, FormFieldInput, FormFieldPassword, FormFieldRadio, FormFieldSelect, FormFieldTextarea, useFormGroup, FormGroup, yupResolver, yup, useForm, useFormContext2 as useFormContext, useWatch, useFieldArray, useController4 as useController, useFormState, Controller, FormProvider2 as FormProvider };
|
package/dist/esm/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/** Powered by @ttoss/config. https://ttoss.dev/docs/modules/packages/config/ */
|
|
2
|
-
import { Form, FormField, FormFieldCheckbox, FormFieldCreditCardNumber, FormFieldCurrencyInput, FormFieldInput, FormFieldNumericFormat, FormFieldPassword, FormFieldPatternFormat, FormFieldRadio, FormFieldSelect, FormFieldTextarea, FormGroup, useForm, useFormGroup, yup, yupResolver } from "./chunk-
|
|
3
|
-
export { Form, FormField, FormFieldCheckbox, FormFieldCreditCardNumber, FormFieldCurrencyInput, FormFieldInput, FormFieldNumericFormat, FormFieldPassword, FormFieldPatternFormat, FormFieldRadio, FormFieldSelect, FormFieldTextarea, FormGroup, useForm, useFormGroup, yup, yupResolver };
|
|
2
|
+
import { Controller, Form, FormField, FormFieldCheckbox, FormFieldCreditCardNumber, FormFieldCurrencyInput, FormFieldInput, FormFieldNumericFormat, FormFieldPassword, FormFieldPatternFormat, FormFieldRadio, FormFieldSelect, FormFieldTextarea, FormGroup, FormProvider, useController, useFieldArray, useForm, useFormContext, useFormGroup, useFormState, useWatch, yup, yupResolver } from "./chunk-5SH4STWG.js";
|
|
3
|
+
export { Controller, Form, FormField, FormFieldCheckbox, FormFieldCreditCardNumber, FormFieldCurrencyInput, FormFieldInput, FormFieldNumericFormat, FormFieldPassword, FormFieldPatternFormat, FormFieldRadio, FormFieldSelect, FormFieldTextarea, FormGroup, FormProvider, useController, useFieldArray, useForm, useFormContext, useFormGroup, useFormState, useWatch, yup, yupResolver };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
export { yupResolver } from '@hookform/resolvers/yup';
|
|
2
|
-
import * as react_hook_form from 'react-hook-form';
|
|
3
|
-
import { FieldValues, FieldPath, UseControllerReturn, FieldPathValue } from 'react-hook-form';
|
|
4
|
-
export * from 'react-hook-form';
|
|
5
|
-
export { useForm } from 'react-hook-form';
|
|
6
2
|
import * as yup from 'yup';
|
|
7
3
|
export { yup };
|
|
8
4
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
5
|
+
import * as react_hook_form from 'react-hook-form';
|
|
6
|
+
import { FieldValues, FieldPath, UseControllerReturn, FieldPathValue } from 'react-hook-form';
|
|
7
|
+
export * from 'react-hook-form';
|
|
8
|
+
export { Controller, FormProvider, useController, useFieldArray, useForm, useFormContext, useFormState, useWatch } from 'react-hook-form';
|
|
9
9
|
import * as React from 'react';
|
|
10
10
|
import { BoxProps, SxProp, CheckboxProps, InputProps, InputPasswordProps, RadioProps, SelectProps, TextareaProps } from '@ttoss/ui';
|
|
11
11
|
import { PatternFormatProps, NumericFormatProps } from 'react-number-format';
|
|
@@ -16,7 +16,7 @@ declare const Form: <TFieldValues extends FieldValues = FieldValues>({ children,
|
|
|
16
16
|
sx?: BoxProps['sx'];
|
|
17
17
|
} & {
|
|
18
18
|
children: React.ReactNode | React.ReactNode[];
|
|
19
|
-
} & react_hook_form.UseFormReturn<TFieldValues, any,
|
|
19
|
+
} & react_hook_form.UseFormReturn<TFieldValues, any, undefined>) => react_jsx_runtime.JSX.Element;
|
|
20
20
|
|
|
21
21
|
type FormFieldProps<TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>> = {
|
|
22
22
|
label?: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
export { yupResolver } from '@hookform/resolvers/yup';
|
|
2
|
-
import * as react_hook_form from 'react-hook-form';
|
|
3
|
-
import { FieldValues, FieldPath, UseControllerReturn, FieldPathValue } from 'react-hook-form';
|
|
4
|
-
export * from 'react-hook-form';
|
|
5
|
-
export { useForm } from 'react-hook-form';
|
|
6
2
|
import * as yup from 'yup';
|
|
7
3
|
export { yup };
|
|
8
4
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
5
|
+
import * as react_hook_form from 'react-hook-form';
|
|
6
|
+
import { FieldValues, FieldPath, UseControllerReturn, FieldPathValue } from 'react-hook-form';
|
|
7
|
+
export * from 'react-hook-form';
|
|
8
|
+
export { Controller, FormProvider, useController, useFieldArray, useForm, useFormContext, useFormState, useWatch } from 'react-hook-form';
|
|
9
9
|
import * as React from 'react';
|
|
10
10
|
import { BoxProps, SxProp, CheckboxProps, InputProps, InputPasswordProps, RadioProps, SelectProps, TextareaProps } from '@ttoss/ui';
|
|
11
11
|
import { PatternFormatProps, NumericFormatProps } from 'react-number-format';
|
|
@@ -16,7 +16,7 @@ declare const Form: <TFieldValues extends FieldValues = FieldValues>({ children,
|
|
|
16
16
|
sx?: BoxProps['sx'];
|
|
17
17
|
} & {
|
|
18
18
|
children: React.ReactNode | React.ReactNode[];
|
|
19
|
-
} & react_hook_form.UseFormReturn<TFieldValues, any,
|
|
19
|
+
} & react_hook_form.UseFormReturn<TFieldValues, any, undefined>) => react_jsx_runtime.JSX.Element;
|
|
20
20
|
|
|
21
21
|
type FormFieldProps<TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>> = {
|
|
22
22
|
label?: string;
|
package/dist/index.js
CHANGED
|
@@ -39,6 +39,7 @@ var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
|
39
39
|
// src/index.ts
|
|
40
40
|
var src_exports = {};
|
|
41
41
|
__export(src_exports, {
|
|
42
|
+
Controller: () => import_react_hook_form6.Controller,
|
|
42
43
|
Form: () => Form,
|
|
43
44
|
FormField: () => FormField,
|
|
44
45
|
FormFieldCheckbox: () => FormFieldCheckbox,
|
|
@@ -52,8 +53,14 @@ __export(src_exports, {
|
|
|
52
53
|
FormFieldSelect: () => FormFieldSelect,
|
|
53
54
|
FormFieldTextarea: () => FormFieldTextarea,
|
|
54
55
|
FormGroup: () => FormGroup,
|
|
56
|
+
FormProvider: () => import_react_hook_form6.FormProvider,
|
|
57
|
+
useController: () => import_react_hook_form6.useController,
|
|
58
|
+
useFieldArray: () => import_react_hook_form6.useFieldArray,
|
|
55
59
|
useForm: () => import_react_hook_form6.useForm,
|
|
60
|
+
useFormContext: () => import_react_hook_form6.useFormContext,
|
|
56
61
|
useFormGroup: () => useFormGroup,
|
|
62
|
+
useFormState: () => import_react_hook_form6.useFormState,
|
|
63
|
+
useWatch: () => import_react_hook_form6.useWatch,
|
|
57
64
|
yup: () => yup,
|
|
58
65
|
yupResolver: () => import_yup2.yupResolver
|
|
59
66
|
});
|
|
@@ -101,8 +108,6 @@ var import_yup = require("yup");
|
|
|
101
108
|
|
|
102
109
|
// src/index.ts
|
|
103
110
|
var import_yup2 = require("@hookform/resolvers/yup");
|
|
104
|
-
__reExport(src_exports, require("react-hook-form"), module.exports);
|
|
105
|
-
var import_react_hook_form6 = require("react-hook-form");
|
|
106
111
|
var yup = __toESM(require("yup"));
|
|
107
112
|
|
|
108
113
|
// src/Form.tsx
|
|
@@ -676,8 +681,13 @@ var FormGroup = props => {
|
|
|
676
681
|
})
|
|
677
682
|
});
|
|
678
683
|
};
|
|
684
|
+
|
|
685
|
+
// src/index.ts
|
|
686
|
+
var import_react_hook_form6 = require("react-hook-form");
|
|
687
|
+
__reExport(src_exports, require("react-hook-form"), module.exports);
|
|
679
688
|
// Annotate the CommonJS export names for ESM import in node:
|
|
680
689
|
0 && (module.exports = {
|
|
690
|
+
Controller,
|
|
681
691
|
Form,
|
|
682
692
|
FormField,
|
|
683
693
|
FormFieldCheckbox,
|
|
@@ -691,8 +701,14 @@ var FormGroup = props => {
|
|
|
691
701
|
FormFieldSelect,
|
|
692
702
|
FormFieldTextarea,
|
|
693
703
|
FormGroup,
|
|
704
|
+
FormProvider,
|
|
705
|
+
useController,
|
|
706
|
+
useFieldArray,
|
|
694
707
|
useForm,
|
|
708
|
+
useFormContext,
|
|
695
709
|
useFormGroup,
|
|
710
|
+
useFormState,
|
|
711
|
+
useWatch,
|
|
696
712
|
yup,
|
|
697
713
|
yupResolver,
|
|
698
714
|
...require("react-hook-form")
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ttoss/forms",
|
|
3
|
-
"version": "0.22.
|
|
3
|
+
"version": "0.22.7",
|
|
4
4
|
"author": "ttoss",
|
|
5
5
|
"contributors": [
|
|
6
6
|
"Pedro Arantes <pedro@arantespp.com> (https://arantespp.com/contact)"
|
|
@@ -30,31 +30,30 @@
|
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"@hookform/error-message": "^2.0.1",
|
|
32
32
|
"@hookform/resolvers": "^3.3.4",
|
|
33
|
-
"react-hook-form": "^7.
|
|
34
|
-
"react-number-format": "^5.3.
|
|
33
|
+
"react-hook-form": "^7.51.0",
|
|
34
|
+
"react-number-format": "^5.3.3",
|
|
35
35
|
"yup": "^1.3.3"
|
|
36
36
|
},
|
|
37
37
|
"peerDependencies": {
|
|
38
38
|
"react": ">=16.8.0",
|
|
39
|
-
"@ttoss/
|
|
40
|
-
"@ttoss/
|
|
39
|
+
"@ttoss/ui": "^4.1.4",
|
|
40
|
+
"@ttoss/react-i18n": "^1.26.1"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"@types/jest": "^29.5.12",
|
|
44
44
|
"@types/react": "^18.2.58",
|
|
45
45
|
"jest": "^29.7.0",
|
|
46
46
|
"react": "^18.2.0",
|
|
47
|
-
"react-error-boundary": "^4.0.
|
|
48
|
-
"react-hook-form": "^7.50.1",
|
|
47
|
+
"react-error-boundary": "^4.0.13",
|
|
49
48
|
"theme-ui": "^0.16.2",
|
|
50
49
|
"tsup": "^8.0.2",
|
|
51
50
|
"yup": "^1.3.3",
|
|
52
51
|
"@ttoss/config": "^1.31.5",
|
|
53
|
-
"@ttoss/i18n-cli": "^0.7.6",
|
|
54
52
|
"@ttoss/react-i18n": "^1.26.1",
|
|
55
|
-
"@ttoss/
|
|
53
|
+
"@ttoss/i18n-cli": "^0.7.6",
|
|
56
54
|
"@ttoss/react-icons": "^0.3.1",
|
|
57
|
-
"@ttoss/ui": "^4.1.
|
|
55
|
+
"@ttoss/ui": "^4.1.4",
|
|
56
|
+
"@ttoss/test-utils": "^2.1.1"
|
|
58
57
|
},
|
|
59
58
|
"publishConfig": {
|
|
60
59
|
"access": "public",
|
package/src/index.ts
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import './i18n';
|
|
2
2
|
|
|
3
3
|
export { yupResolver } from '@hookform/resolvers/yup';
|
|
4
|
-
export * from 'react-hook-form';
|
|
5
|
-
export { useForm } from 'react-hook-form';
|
|
6
4
|
export * as yup from 'yup';
|
|
7
5
|
|
|
8
6
|
export { Form } from './Form';
|
|
@@ -18,3 +16,21 @@ export { FormFieldRadio } from './FormFieldRadio';
|
|
|
18
16
|
export { FormFieldSelect } from './FormFieldSelect';
|
|
19
17
|
export { FormFieldTextarea } from './FormFieldTextarea';
|
|
20
18
|
export { FormGroup, useFormGroup } from './FormGroup';
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Export everything from react-hook-form without using export *
|
|
22
|
+
* https://github.com/evanw/esbuild/issues/1737
|
|
23
|
+
*/
|
|
24
|
+
export {
|
|
25
|
+
useForm,
|
|
26
|
+
useFormContext,
|
|
27
|
+
useWatch,
|
|
28
|
+
useFieldArray,
|
|
29
|
+
useController,
|
|
30
|
+
useFormState,
|
|
31
|
+
Controller,
|
|
32
|
+
FormProvider,
|
|
33
|
+
} from 'react-hook-form';
|
|
34
|
+
|
|
35
|
+
// Export types
|
|
36
|
+
export * from 'react-hook-form';
|