@ttoss/forms 0.26.2 → 0.26.4
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/Brazil/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** Powered by @ttoss/config. https://ttoss.dev/docs/modules/packages/config/ */
|
|
2
|
-
import { FormField, FormFieldCNPJ, FormFieldPatternFormat, isCnpjValid } from "../chunk-
|
|
2
|
+
import { FormField, FormFieldCNPJ, FormFieldPatternFormat, isCnpjValid } from "../chunk-7QGUPKPM.js";
|
|
3
3
|
|
|
4
4
|
// src/Brazil/FormFieldPhone.tsx
|
|
5
5
|
import { Input } from "@ttoss/ui";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** Powered by @ttoss/config. https://ttoss.dev/docs/modules/packages/config/ */
|
|
2
|
-
import { Form, __publicField, useForm, yupResolver } from "../chunk-
|
|
2
|
+
import { Form, __publicField, useForm, yupResolver } from "../chunk-7QGUPKPM.js";
|
|
3
3
|
|
|
4
4
|
// src/MultistepForm/MultistepForm.tsx
|
|
5
5
|
import * as React3 from "react";
|
|
@@ -280,6 +280,7 @@ var FormField = ({
|
|
|
280
280
|
};
|
|
281
281
|
|
|
282
282
|
// src/FormFieldCheckbox.tsx
|
|
283
|
+
import * as React2 from "react";
|
|
283
284
|
import { Checkbox, Flex as Flex2, Label as Label2 } from "@ttoss/ui";
|
|
284
285
|
import { useController as useController2 } from "react-hook-form";
|
|
285
286
|
import { jsx as jsx5, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
@@ -304,7 +305,8 @@ var FormFieldCheckbox = ({
|
|
|
304
305
|
name,
|
|
305
306
|
defaultValue: false
|
|
306
307
|
});
|
|
307
|
-
const
|
|
308
|
+
const uniqueId = React2.useId();
|
|
309
|
+
const id = checkboxProps.id || `form-field-checkbox-${name}-${uniqueId}`;
|
|
308
310
|
const error = !!errors[name]?.message;
|
|
309
311
|
return /* @__PURE__ */jsxs2(Flex2, {
|
|
310
312
|
sx: {
|
|
@@ -627,10 +629,10 @@ var FormFieldTextarea = ({
|
|
|
627
629
|
};
|
|
628
630
|
|
|
629
631
|
// src/FormGroup.tsx
|
|
630
|
-
import * as
|
|
632
|
+
import * as React3 from "react";
|
|
631
633
|
import { Box as Box3, Flex as Flex4, Text } from "@ttoss/ui";
|
|
632
634
|
import { jsx as jsx15, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
633
|
-
var FormGroupLevelsManagerContext =
|
|
635
|
+
var FormGroupLevelsManagerContext = React3.createContext({
|
|
634
636
|
levelsLength: 1,
|
|
635
637
|
registerChild: () => {
|
|
636
638
|
return null;
|
|
@@ -639,8 +641,8 @@ var FormGroupLevelsManagerContext = React2.createContext({
|
|
|
639
641
|
var FormGroupLevelsManager = ({
|
|
640
642
|
children
|
|
641
643
|
}) => {
|
|
642
|
-
const [levelsLength, setLevelsLength] =
|
|
643
|
-
const registerChild =
|
|
644
|
+
const [levelsLength, setLevelsLength] = React3.useState(0);
|
|
645
|
+
const registerChild = React3.useCallback(level => {
|
|
644
646
|
if (level + 1 > levelsLength) {
|
|
645
647
|
setLevelsLength(level + 1);
|
|
646
648
|
}
|
|
@@ -653,14 +655,14 @@ var FormGroupLevelsManager = ({
|
|
|
653
655
|
children
|
|
654
656
|
});
|
|
655
657
|
};
|
|
656
|
-
var FormGroupContext =
|
|
658
|
+
var FormGroupContext = React3.createContext({});
|
|
657
659
|
var useFormGroup = () => {
|
|
658
660
|
const {
|
|
659
661
|
parentLevel
|
|
660
|
-
} =
|
|
662
|
+
} = React3.useContext(FormGroupContext);
|
|
661
663
|
const {
|
|
662
664
|
levelsLength
|
|
663
|
-
} =
|
|
665
|
+
} = React3.useContext(FormGroupLevelsManagerContext);
|
|
664
666
|
return {
|
|
665
667
|
level: parentLevel,
|
|
666
668
|
levelsLength
|
|
@@ -678,8 +680,8 @@ var FormGroupWrapper = ({
|
|
|
678
680
|
} = useFormGroup();
|
|
679
681
|
const {
|
|
680
682
|
registerChild
|
|
681
|
-
} =
|
|
682
|
-
|
|
683
|
+
} = React3.useContext(FormGroupLevelsManagerContext);
|
|
684
|
+
React3.useEffect(() => {
|
|
683
685
|
if (typeof level === "number") {
|
|
684
686
|
registerChild(level);
|
|
685
687
|
}
|
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 { Controller, Form, FormErrorMessage, FormField, FormFieldCheckbox, FormFieldCreditCardNumber, FormFieldCurrencyInput, FormFieldInput, FormFieldNumericFormat, FormFieldPassword, FormFieldPatternFormat, FormFieldRadio, FormFieldSelect, FormFieldTextarea, FormGroup, FormProvider, useController, useFieldArray, useForm, useFormContext, useFormGroup, useFormState, useWatch, yup, yupResolver } from "./chunk-
|
|
2
|
+
import { Controller, Form, FormErrorMessage, FormField, FormFieldCheckbox, FormFieldCreditCardNumber, FormFieldCurrencyInput, FormFieldInput, FormFieldNumericFormat, FormFieldPassword, FormFieldPatternFormat, FormFieldRadio, FormFieldSelect, FormFieldTextarea, FormGroup, FormProvider, useController, useFieldArray, useForm, useFormContext, useFormGroup, useFormState, useWatch, yup, yupResolver } from "./chunk-7QGUPKPM.js";
|
|
3
3
|
export { Controller, Form, FormErrorMessage, FormField, FormFieldCheckbox, FormFieldCreditCardNumber, FormFieldCurrencyInput, FormFieldInput, FormFieldNumericFormat, FormFieldPassword, FormFieldPatternFormat, FormFieldRadio, FormFieldSelect, FormFieldTextarea, FormGroup, FormProvider, useController, useFieldArray, useForm, useFormContext, useFormGroup, useFormState, useWatch, yup, yupResolver };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ttoss/forms",
|
|
3
|
-
"version": "0.26.
|
|
3
|
+
"version": "0.26.4",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": "ttoss",
|
|
6
6
|
"contributors": [
|
|
@@ -32,30 +32,30 @@
|
|
|
32
32
|
"sideEffects": true,
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@hookform/error-message": "^2.0.1",
|
|
35
|
-
"@hookform/resolvers": "^3.
|
|
36
|
-
"react-hook-form": "^7.
|
|
37
|
-
"react-number-format": "^5.
|
|
35
|
+
"@hookform/resolvers": "^3.9.1",
|
|
36
|
+
"react-hook-form": "^7.53.2",
|
|
37
|
+
"react-number-format": "^5.4.2",
|
|
38
38
|
"yup": "^1.4.0"
|
|
39
39
|
},
|
|
40
40
|
"peerDependencies": {
|
|
41
41
|
"react": ">=16.8.0",
|
|
42
|
-
"@ttoss/react-i18n": "^2.0.
|
|
43
|
-
"@ttoss/ui": "^5.0.
|
|
42
|
+
"@ttoss/react-i18n": "^2.0.5",
|
|
43
|
+
"@ttoss/ui": "^5.0.10"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
|
-
"@types/jest": "^29.5.
|
|
47
|
-
"@types/react": "^18.3.
|
|
46
|
+
"@types/jest": "^29.5.14",
|
|
47
|
+
"@types/react": "^18.3.12",
|
|
48
48
|
"jest": "^29.7.0",
|
|
49
49
|
"react": "^18.3.1",
|
|
50
|
-
"react-error-boundary": "^4.
|
|
51
|
-
"tsup": "^8.3.
|
|
50
|
+
"react-error-boundary": "^4.1.2",
|
|
51
|
+
"tsup": "^8.3.5",
|
|
52
52
|
"yup": "^1.4.0",
|
|
53
|
-
"@ttoss/config": "^1.34.
|
|
54
|
-
"@ttoss/i18n-cli": "^0.7.
|
|
55
|
-
"@ttoss/react-
|
|
56
|
-
"@ttoss/react-
|
|
57
|
-
"@ttoss/test-utils": "^2.1.
|
|
58
|
-
"@ttoss/ui": "^5.0.
|
|
53
|
+
"@ttoss/config": "^1.34.2",
|
|
54
|
+
"@ttoss/i18n-cli": "^0.7.23",
|
|
55
|
+
"@ttoss/react-icons": "^0.4.5",
|
|
56
|
+
"@ttoss/react-i18n": "^2.0.5",
|
|
57
|
+
"@ttoss/test-utils": "^2.1.18",
|
|
58
|
+
"@ttoss/ui": "^5.0.10"
|
|
59
59
|
},
|
|
60
60
|
"publishConfig": {
|
|
61
61
|
"access": "public",
|