@gustavo-valsechi/client 1.4.21 → 1.4.22
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/components/types/form/index.js +4 -2
- package/dist/components/types/form/index.mjs +4 -2
- package/dist/components/types/form/types/custom/index.js +4 -5
- package/dist/components/types/form/types/custom/index.mjs +5 -6
- package/dist/interfaces/components/form/custom/index.d.ts +1 -0
- package/package.json +1 -1
|
@@ -59,7 +59,8 @@ function Form(props) {
|
|
|
59
59
|
register,
|
|
60
60
|
handleSubmit,
|
|
61
61
|
reset,
|
|
62
|
-
formState: { errors }
|
|
62
|
+
formState: { errors },
|
|
63
|
+
setValue
|
|
63
64
|
} = (0, import_react_hook_form.useForm)({
|
|
64
65
|
resolver: (0, import_zod2.zodResolver)(schema),
|
|
65
66
|
defaultValues: props.defaultValues,
|
|
@@ -96,7 +97,8 @@ function Form(props) {
|
|
|
96
97
|
id: data.name,
|
|
97
98
|
type: component2 ? void 0 : data.type,
|
|
98
99
|
error: (_a = errors[data.name]) == null ? void 0 : _a.message,
|
|
99
|
-
register
|
|
100
|
+
register,
|
|
101
|
+
setValue
|
|
100
102
|
}
|
|
101
103
|
);
|
|
102
104
|
};
|
|
@@ -25,7 +25,8 @@ function Form(props) {
|
|
|
25
25
|
register,
|
|
26
26
|
handleSubmit,
|
|
27
27
|
reset,
|
|
28
|
-
formState: { errors }
|
|
28
|
+
formState: { errors },
|
|
29
|
+
setValue
|
|
29
30
|
} = useForm({
|
|
30
31
|
resolver: zodResolver(schema),
|
|
31
32
|
defaultValues: props.defaultValues,
|
|
@@ -62,7 +63,8 @@ function Form(props) {
|
|
|
62
63
|
id: data.name,
|
|
63
64
|
type: component2 ? void 0 : data.type,
|
|
64
65
|
error: (_a = errors[data.name]) == null ? void 0 : _a.message,
|
|
65
|
-
register
|
|
66
|
+
register,
|
|
67
|
+
setValue
|
|
66
68
|
}
|
|
67
69
|
);
|
|
68
70
|
};
|
|
@@ -28,19 +28,18 @@ var import_styles = require("./styles");
|
|
|
28
28
|
var import_label = require("../label");
|
|
29
29
|
var import_error = require("../error");
|
|
30
30
|
function InputCustom(props) {
|
|
31
|
-
const inputRef = (0, import_react.useRef)({});
|
|
32
31
|
const register = (props.register || ((name) => ({})))(props.name || "");
|
|
33
32
|
(0, import_react.useEffect)(() => {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
}, [
|
|
33
|
+
var _a;
|
|
34
|
+
(_a = props.setValue) == null ? void 0 : _a.call(props, props.name, props.value);
|
|
35
|
+
}, [props.name, props.value]);
|
|
37
36
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_styles.Container, { className: props.className, children: [
|
|
38
37
|
!!props.label && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_label.InputLabel, { children: [
|
|
39
38
|
props.label,
|
|
40
39
|
props.required ? "*" : ""
|
|
41
40
|
] }),
|
|
42
41
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "iz-input-content", children: [
|
|
43
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", {
|
|
42
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", { hidden: true, ...register }),
|
|
44
43
|
props.children
|
|
45
44
|
] }),
|
|
46
45
|
!!props.error && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_error.InputError, { className: "iz-input-custom-error", children: props.error })
|
|
@@ -1,23 +1,22 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { useEffect
|
|
3
|
+
import { useEffect } from "react";
|
|
4
4
|
import { Container } from "./styles";
|
|
5
5
|
import { InputLabel } from "../label";
|
|
6
6
|
import { InputError } from "../error";
|
|
7
7
|
function InputCustom(props) {
|
|
8
|
-
const inputRef = useRef({});
|
|
9
8
|
const register = (props.register || ((name) => ({})))(props.name || "");
|
|
10
9
|
useEffect(() => {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
}, [
|
|
10
|
+
var _a;
|
|
11
|
+
(_a = props.setValue) == null ? void 0 : _a.call(props, props.name, props.value);
|
|
12
|
+
}, [props.name, props.value]);
|
|
14
13
|
return /* @__PURE__ */ jsxs(Container, { className: props.className, children: [
|
|
15
14
|
!!props.label && /* @__PURE__ */ jsxs(InputLabel, { children: [
|
|
16
15
|
props.label,
|
|
17
16
|
props.required ? "*" : ""
|
|
18
17
|
] }),
|
|
19
18
|
/* @__PURE__ */ jsxs("div", { className: "iz-input-content", children: [
|
|
20
|
-
/* @__PURE__ */ jsx("input", {
|
|
19
|
+
/* @__PURE__ */ jsx("input", { hidden: true, ...register }),
|
|
21
20
|
props.children
|
|
22
21
|
] }),
|
|
23
22
|
!!props.error && /* @__PURE__ */ jsx(InputError, { className: "iz-input-custom-error", children: props.error })
|