@gustavo-valsechi/client 1.4.364 → 1.4.365

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.
@@ -64,19 +64,24 @@ function InputSelect(props) {
64
64
  ...props,
65
65
  inputRef,
66
66
  register,
67
- width: ((_a2 = containerRef == null ? void 0 : containerRef.current) == null ? void 0 : _a2.offsetWidth) - 1 || 0,
67
+ width: ((_a2 = containerRef == null ? void 0 : containerRef.current) == null ? void 0 : _a2.offsetWidth) - 2 || 0,
68
68
  value: inputValue
69
69
  }
70
70
  )
71
71
  });
72
72
  }, [containerRef, inputRef, props.options, inputValue]);
73
+ (0, import_react.useEffect)(() => {
74
+ if (focus) return;
75
+ setTimeout(() => {
76
+ setFilter("");
77
+ const optionsElement = document.getElementById(`input[${props.name}-options]`);
78
+ if (!optionsElement) return;
79
+ optionsElement.setAttribute("value", "");
80
+ }, 100);
81
+ }, [focus]);
73
82
  const onBlur = (event) => {
74
83
  setFocus(false);
75
- setFilter("");
76
84
  if (props.onBlur) props.onBlur(event);
77
- const optionsElement = document.getElementById(`input[${props.name}-options]`);
78
- if (!optionsElement) return;
79
- optionsElement.setAttribute("value", "");
80
85
  };
81
86
  const onFocus = (event) => {
82
87
  setFocus(true);
@@ -86,7 +91,6 @@ function InputSelect(props) {
86
91
  const value = event.target.value || "";
87
92
  setFilter(value);
88
93
  if (props.onFilter) props.onFilter(value);
89
- if (register.onChange) register.onChange(event);
90
94
  const optionsElement = document.getElementById(`input[${props.name}-options]`);
91
95
  if (!optionsElement) return;
92
96
  optionsElement.setAttribute("value", value);
@@ -31,19 +31,24 @@ function InputSelect(props) {
31
31
  ...props,
32
32
  inputRef,
33
33
  register,
34
- width: ((_a2 = containerRef == null ? void 0 : containerRef.current) == null ? void 0 : _a2.offsetWidth) - 1 || 0,
34
+ width: ((_a2 = containerRef == null ? void 0 : containerRef.current) == null ? void 0 : _a2.offsetWidth) - 2 || 0,
35
35
  value: inputValue
36
36
  }
37
37
  )
38
38
  });
39
39
  }, [containerRef, inputRef, props.options, inputValue]);
40
+ useEffect(() => {
41
+ if (focus) return;
42
+ setTimeout(() => {
43
+ setFilter("");
44
+ const optionsElement = document.getElementById(`input[${props.name}-options]`);
45
+ if (!optionsElement) return;
46
+ optionsElement.setAttribute("value", "");
47
+ }, 100);
48
+ }, [focus]);
40
49
  const onBlur = (event) => {
41
50
  setFocus(false);
42
- setFilter("");
43
51
  if (props.onBlur) props.onBlur(event);
44
- const optionsElement = document.getElementById(`input[${props.name}-options]`);
45
- if (!optionsElement) return;
46
- optionsElement.setAttribute("value", "");
47
52
  };
48
53
  const onFocus = (event) => {
49
54
  setFocus(true);
@@ -53,7 +58,6 @@ function InputSelect(props) {
53
58
  const value = event.target.value || "";
54
59
  setFilter(value);
55
60
  if (props.onFilter) props.onFilter(value);
56
- if (register.onChange) register.onChange(event);
57
61
  const optionsElement = document.getElementById(`input[${props.name}-options]`);
58
62
  if (!optionsElement) return;
59
63
  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.365",
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",