@gustavo-valsechi/client 1.4.364 → 1.4.366

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.
@@ -56,6 +56,7 @@ function InputSelect(props) {
56
56
  (0, import_react.useEffect)(() => {
57
57
  var _a2;
58
58
  if (!(inputRef == null ? void 0 : inputRef.current) || !(containerRef == null ? void 0 : containerRef.current)) return;
59
+ console.log("props.options", props.options);
59
60
  target.save({
60
61
  ref: inputRef,
61
62
  component: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
@@ -64,19 +65,24 @@ function InputSelect(props) {
64
65
  ...props,
65
66
  inputRef,
66
67
  register,
67
- width: ((_a2 = containerRef == null ? void 0 : containerRef.current) == null ? void 0 : _a2.offsetWidth) - 1 || 0,
68
+ width: ((_a2 = containerRef == null ? void 0 : containerRef.current) == null ? void 0 : _a2.offsetWidth) - 2 || 0,
68
69
  value: inputValue
69
70
  }
70
71
  )
71
72
  });
72
73
  }, [containerRef, inputRef, props.options, inputValue]);
74
+ (0, import_react.useEffect)(() => {
75
+ if (focus) return;
76
+ setTimeout(() => {
77
+ setFilter("");
78
+ const optionsElement = document.getElementById(`input[${props.name}-options]`);
79
+ if (!optionsElement) return;
80
+ optionsElement.setAttribute("value", "");
81
+ }, 100);
82
+ }, [focus]);
73
83
  const onBlur = (event) => {
74
84
  setFocus(false);
75
- setFilter("");
76
85
  if (props.onBlur) props.onBlur(event);
77
- const optionsElement = document.getElementById(`input[${props.name}-options]`);
78
- if (!optionsElement) return;
79
- optionsElement.setAttribute("value", "");
80
86
  };
81
87
  const onFocus = (event) => {
82
88
  setFocus(true);
@@ -86,7 +92,6 @@ function InputSelect(props) {
86
92
  const value = event.target.value || "";
87
93
  setFilter(value);
88
94
  if (props.onFilter) props.onFilter(value);
89
- if (register.onChange) register.onChange(event);
90
95
  const optionsElement = document.getElementById(`input[${props.name}-options]`);
91
96
  if (!optionsElement) return;
92
97
  optionsElement.setAttribute("value", value);
@@ -23,6 +23,7 @@ function InputSelect(props) {
23
23
  useEffect(() => {
24
24
  var _a2;
25
25
  if (!(inputRef == null ? void 0 : inputRef.current) || !(containerRef == null ? void 0 : containerRef.current)) return;
26
+ console.log("props.options", props.options);
26
27
  target.save({
27
28
  ref: inputRef,
28
29
  component: /* @__PURE__ */ jsx(
@@ -31,19 +32,24 @@ function InputSelect(props) {
31
32
  ...props,
32
33
  inputRef,
33
34
  register,
34
- width: ((_a2 = containerRef == null ? void 0 : containerRef.current) == null ? void 0 : _a2.offsetWidth) - 1 || 0,
35
+ width: ((_a2 = containerRef == null ? void 0 : containerRef.current) == null ? void 0 : _a2.offsetWidth) - 2 || 0,
35
36
  value: inputValue
36
37
  }
37
38
  )
38
39
  });
39
40
  }, [containerRef, inputRef, props.options, inputValue]);
41
+ useEffect(() => {
42
+ if (focus) return;
43
+ setTimeout(() => {
44
+ setFilter("");
45
+ const optionsElement = document.getElementById(`input[${props.name}-options]`);
46
+ if (!optionsElement) return;
47
+ optionsElement.setAttribute("value", "");
48
+ }, 100);
49
+ }, [focus]);
40
50
  const onBlur = (event) => {
41
51
  setFocus(false);
42
- setFilter("");
43
52
  if (props.onBlur) props.onBlur(event);
44
- const optionsElement = document.getElementById(`input[${props.name}-options]`);
45
- if (!optionsElement) return;
46
- optionsElement.setAttribute("value", "");
47
53
  };
48
54
  const onFocus = (event) => {
49
55
  setFocus(true);
@@ -53,7 +59,6 @@ function InputSelect(props) {
53
59
  const value = event.target.value || "";
54
60
  setFilter(value);
55
61
  if (props.onFilter) props.onFilter(value);
56
- if (register.onChange) register.onChange(event);
57
62
  const optionsElement = document.getElementById(`input[${props.name}-options]`);
58
63
  if (!optionsElement) return;
59
64
  optionsElement.setAttribute("value", value);
@@ -94,9 +94,6 @@ function InputSelectOptions(props) {
94
94
  setTimeout(() => target.close(props.inputRef), 10);
95
95
  (_a = props.setValue) == null ? void 0 : _a.call(props, props.name, value);
96
96
  if (props.onChange) props.onChange(value);
97
- const optionsElement = document.getElementById(`input[${props.name}-options]`);
98
- if (!optionsElement) return;
99
- optionsElement.setAttribute("value", "");
100
97
  const content = document.getElementById(`input[${props.name}-options-content]`);
101
98
  if (!content) return;
102
99
  content.scrollTop = 0;
@@ -124,7 +121,7 @@ function InputSelectOptions(props) {
124
121
  "div",
125
122
  {
126
123
  className: "input-option",
127
- onClick: () => onSelect(value),
124
+ onMouseDown: () => onSelect(value),
128
125
  "data-string": import_lodash.default.isString(data),
129
126
  "data-selected": value === props.value,
130
127
  children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_option.default, { content: data })
@@ -61,9 +61,6 @@ function InputSelectOptions(props) {
61
61
  setTimeout(() => target.close(props.inputRef), 10);
62
62
  (_a = props.setValue) == null ? void 0 : _a.call(props, props.name, value);
63
63
  if (props.onChange) props.onChange(value);
64
- const optionsElement = document.getElementById(`input[${props.name}-options]`);
65
- if (!optionsElement) return;
66
- optionsElement.setAttribute("value", "");
67
64
  const content = document.getElementById(`input[${props.name}-options-content]`);
68
65
  if (!content) return;
69
66
  content.scrollTop = 0;
@@ -91,7 +88,7 @@ function InputSelectOptions(props) {
91
88
  "div",
92
89
  {
93
90
  className: "input-option",
94
- onClick: () => onSelect(value),
91
+ onMouseDown: () => onSelect(value),
95
92
  "data-string": _.isString(data),
96
93
  "data-selected": value === props.value,
97
94
  children: /* @__PURE__ */ jsx(InputSelectOption, { content: data })
@@ -42,10 +42,10 @@ function InputSelectOption(props) {
42
42
  if (import_lodash.default.isArray(props.content)) return "";
43
43
  if (!!((_a = props.content) == null ? void 0 : _a.icon) || !!((_b = props.content) == null ? void 0 : _b.img)) {
44
44
  return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_styles.Container, { color: (_c = props.content) == null ? void 0 : _c.color, img: (_d = props.content) == null ? void 0 : _d.img, children: [
45
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "select-option-identifier", children: [
45
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "select-option-identifier", children: [
46
46
  !!((_e = props.content) == null ? void 0 : _e.icon) && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("i", { "aria-hidden": true, className: (_f = props.content) == null ? void 0 : _f.icon }),
47
47
  !!((_g = props.content) == null ? void 0 : _g.img) && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "select-option-img" })
48
- ] }),
48
+ ] }) }),
49
49
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "select-option-label-container", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "select-option-label", children: (_h = props.content) == null ? void 0 : _h.label }) })
50
50
  ] });
51
51
  }
@@ -9,10 +9,10 @@ function InputSelectOption(props) {
9
9
  if (_.isArray(props.content)) return "";
10
10
  if (!!((_a = props.content) == null ? void 0 : _a.icon) || !!((_b = props.content) == null ? void 0 : _b.img)) {
11
11
  return /* @__PURE__ */ jsxs(Container, { color: (_c = props.content) == null ? void 0 : _c.color, img: (_d = props.content) == null ? void 0 : _d.img, children: [
12
- /* @__PURE__ */ jsxs("div", { className: "select-option-identifier", children: [
12
+ /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsxs("div", { className: "select-option-identifier", children: [
13
13
  !!((_e = props.content) == null ? void 0 : _e.icon) && /* @__PURE__ */ jsx("i", { "aria-hidden": true, className: (_f = props.content) == null ? void 0 : _f.icon }),
14
14
  !!((_g = props.content) == null ? void 0 : _g.img) && /* @__PURE__ */ jsx("div", { className: "select-option-img" })
15
- ] }),
15
+ ] }) }),
16
16
  /* @__PURE__ */ jsx("div", { className: "select-option-label-container", children: /* @__PURE__ */ jsx("div", { className: "select-option-label", children: (_h = props.content) == null ? void 0 : _h.label }) })
17
17
  ] });
18
18
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gustavo-valsechi/client",
3
- "version": "1.4.364",
3
+ "version": "1.4.366",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -28,7 +28,7 @@
28
28
  "@emotion/react": "11.14.0",
29
29
  "@emotion/styled": "11.14.1",
30
30
  "@gustavo-valsechi/server": "1.0.13",
31
- "@gustavo-valsechi/utils": "1.0.19",
31
+ "@gustavo-valsechi/utils": "1.0.23",
32
32
  "@hookform/resolvers": "5.2.2",
33
33
  "@mui/material": "7.3.7",
34
34
  "@mui/x-date-pickers": "8.24.0",