@gustavo-valsechi/client 1.4.144 → 1.4.145

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.
@@ -50,12 +50,6 @@ function InputSelect(props) {
50
50
  const register = (props.register || ((name) => ({})))(props.name || "");
51
51
  const inputValue = (_a = props.watch) == null ? void 0 : _a.call(props, props.name);
52
52
  const value = ((_b = import_lodash.default.find(props.options, (option) => Object.keys(option)[0] === inputValue)) == null ? void 0 : _b[inputValue || ""]) || "";
53
- (0, import_react.useEffect)(() => {
54
- if (focus) return;
55
- const optionsElement = document.getElementById("input-options");
56
- if (!optionsElement) return;
57
- optionsElement.setAttribute("value", "");
58
- }, [focus]);
59
53
  (0, import_react.useEffect)(() => {
60
54
  var _a2;
61
55
  if (!(inputRef == null ? void 0 : inputRef.current) || !(containerRef == null ? void 0 : containerRef.current)) return;
@@ -81,6 +75,9 @@ function InputSelect(props) {
81
75
  const onFocus = (event) => {
82
76
  setFocus(true);
83
77
  if (register.onFocus) register.onFocus(event);
78
+ const optionsElement = document.getElementById("input-options");
79
+ if (!optionsElement) return;
80
+ setFilter(optionsElement.getAttribute("value") || "");
84
81
  };
85
82
  const onChange = (event) => {
86
83
  const value2 = event.target.value || "";
@@ -17,12 +17,6 @@ function InputSelect(props) {
17
17
  const register = (props.register || ((name) => ({})))(props.name || "");
18
18
  const inputValue = (_a = props.watch) == null ? void 0 : _a.call(props, props.name);
19
19
  const value = ((_b = _.find(props.options, (option) => Object.keys(option)[0] === inputValue)) == null ? void 0 : _b[inputValue || ""]) || "";
20
- useEffect(() => {
21
- if (focus) return;
22
- const optionsElement = document.getElementById("input-options");
23
- if (!optionsElement) return;
24
- optionsElement.setAttribute("value", "");
25
- }, [focus]);
26
20
  useEffect(() => {
27
21
  var _a2;
28
22
  if (!(inputRef == null ? void 0 : inputRef.current) || !(containerRef == null ? void 0 : containerRef.current)) return;
@@ -48,6 +42,9 @@ function InputSelect(props) {
48
42
  const onFocus = (event) => {
49
43
  setFocus(true);
50
44
  if (register.onFocus) register.onFocus(event);
45
+ const optionsElement = document.getElementById("input-options");
46
+ if (!optionsElement) return;
47
+ setFilter(optionsElement.getAttribute("value") || "");
51
48
  };
52
49
  const onChange = (event) => {
53
50
  const value2 = event.target.value || "";
@@ -68,6 +68,9 @@ function InputSelectOption(props) {
68
68
  var _a;
69
69
  (_a = props.setValue) == null ? void 0 : _a.call(props, props.name, value);
70
70
  target.close(props.inputRef);
71
+ const optionsElement = document.getElementById("input-options");
72
+ if (!optionsElement) return;
73
+ optionsElement.setAttribute("value", "");
71
74
  };
72
75
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_styles.Container, { id: "input-options", width: props.width, children: import_lodash.default.map(
73
76
  options,
@@ -35,6 +35,9 @@ function InputSelectOption(props) {
35
35
  var _a;
36
36
  (_a = props.setValue) == null ? void 0 : _a.call(props, props.name, value);
37
37
  target.close(props.inputRef);
38
+ const optionsElement = document.getElementById("input-options");
39
+ if (!optionsElement) return;
40
+ optionsElement.setAttribute("value", "");
38
41
  };
39
42
  return /* @__PURE__ */ jsx(Container, { id: "input-options", width: props.width, children: _.map(
40
43
  options,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gustavo-valsechi/client",
3
- "version": "1.4.144",
3
+ "version": "1.4.145",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.js",
6
6
  "types": "dist/index.d.ts",