@gustavo-valsechi/client 1.4.250 → 1.4.251

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.
@@ -53,14 +53,7 @@ function InputDateTime(props) {
53
53
  const register = (props.register || ((name) => ({})))(props.name || "");
54
54
  const [dateTime, setDateDime] = (0, import_react.useState)((0, import_dayjs.default)());
55
55
  (0, import_react.useEffect)(() => {
56
- if (props.setValue) props.setValue(props.name, dateTime);
57
- }, [dateTime]);
58
- const onChange = (event) => {
59
- if (register.onChange) register.onChange(event);
60
- if (props.onChange) props.onChange(event);
61
- };
62
- const showPicker = () => {
63
- if (!inputRef.current) return;
56
+ if (!inputRef.current || !toggleRef.current) return;
64
57
  target.add({
65
58
  ref: inputRef,
66
59
  toggleRef,
@@ -85,6 +78,13 @@ function InputDateTime(props) {
85
78
  }
86
79
  )
87
80
  });
81
+ }, [inputRef, toggleRef]);
82
+ (0, import_react.useEffect)(() => {
83
+ if (props.setValue) props.setValue(props.name, dateTime);
84
+ }, [dateTime]);
85
+ const onChange = (event) => {
86
+ if (register.onChange) register.onChange(event);
87
+ if (props.onChange) props.onChange(event);
88
88
  };
89
89
  return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_styles.Container, { className: props.className, error: props.error, disabled: props.disabled, children: [
90
90
  !!props.label && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_label.InputLabel, { optional: props.optional, children: props.label }),
@@ -107,7 +107,6 @@ function InputDateTime(props) {
107
107
  {
108
108
  ref: toggleRef,
109
109
  className: "input-icon",
110
- onClick: showPicker,
111
110
  children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("i", { "aria-hidden": true, className: "fa-solid fa-calendar" })
112
111
  }
113
112
  )
@@ -20,14 +20,7 @@ function InputDateTime(props) {
20
20
  const register = (props.register || ((name) => ({})))(props.name || "");
21
21
  const [dateTime, setDateDime] = useState(dayjs());
22
22
  useEffect(() => {
23
- if (props.setValue) props.setValue(props.name, dateTime);
24
- }, [dateTime]);
25
- const onChange = (event) => {
26
- if (register.onChange) register.onChange(event);
27
- if (props.onChange) props.onChange(event);
28
- };
29
- const showPicker = () => {
30
- if (!inputRef.current) return;
23
+ if (!inputRef.current || !toggleRef.current) return;
31
24
  target.add({
32
25
  ref: inputRef,
33
26
  toggleRef,
@@ -52,6 +45,13 @@ function InputDateTime(props) {
52
45
  }
53
46
  )
54
47
  });
48
+ }, [inputRef, toggleRef]);
49
+ useEffect(() => {
50
+ if (props.setValue) props.setValue(props.name, dateTime);
51
+ }, [dateTime]);
52
+ const onChange = (event) => {
53
+ if (register.onChange) register.onChange(event);
54
+ if (props.onChange) props.onChange(event);
55
55
  };
56
56
  return /* @__PURE__ */ jsxs(Container, { className: props.className, error: props.error, disabled: props.disabled, children: [
57
57
  !!props.label && /* @__PURE__ */ jsx(InputLabel, { optional: props.optional, children: props.label }),
@@ -74,7 +74,6 @@ function InputDateTime(props) {
74
74
  {
75
75
  ref: toggleRef,
76
76
  className: "input-icon",
77
- onClick: showPicker,
78
77
  children: /* @__PURE__ */ jsx("i", { "aria-hidden": true, className: "fa-solid fa-calendar" })
79
78
  }
80
79
  )
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gustavo-valsechi/client",
3
- "version": "1.4.250",
3
+ "version": "1.4.251",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.js",
6
6
  "types": "dist/index.d.ts",