@gustavo-valsechi/client 1.4.121 → 1.4.123

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.
@@ -59,6 +59,8 @@ function InputSelectOption(props) {
59
59
  const value2 = ((_a = Object.values(data || {})) == null ? void 0 : _a[0]) || "";
60
60
  const normalize = (text) => import_lodash.default.deburr(text == null ? void 0 : text.toLowerCase());
61
61
  if (import_lodash.default.isString(value2)) return import_lodash.default.includes(normalize(value2), normalize(filter));
62
+ console.log(typeof value2);
63
+ console.log(value2);
62
64
  console.log(value2 == null ? void 0 : value2.textContent);
63
65
  return import_lodash.default.includes(normalize(value2 == null ? void 0 : value2.textContent), normalize(filter));
64
66
  });
@@ -26,6 +26,8 @@ function InputSelectOption(props) {
26
26
  const value2 = ((_a = Object.values(data || {})) == null ? void 0 : _a[0]) || "";
27
27
  const normalize = (text) => _.deburr(text == null ? void 0 : text.toLowerCase());
28
28
  if (_.isString(value2)) return _.includes(normalize(value2), normalize(filter));
29
+ console.log(typeof value2);
30
+ console.log(value2);
29
31
  console.log(value2 == null ? void 0 : value2.textContent);
30
32
  return _.includes(normalize(value2 == null ? void 0 : value2.textContent), normalize(filter));
31
33
  });
@@ -54,14 +54,15 @@ const TargetProviderContainer = ({ children }) => {
54
54
  insideMemory.splice(import_lodash.default.findIndex(insideMemory, (i) => i === index), 1);
55
55
  elementFocusable(targets[index], index).blur();
56
56
  };
57
- const close = (target, index) => {
57
+ const close = (index) => {
58
58
  const element = containerRef.current[index];
59
59
  element.style.opacity = "0";
60
60
  element.style.zIndex = "-1";
61
61
  insideMemory.splice(import_lodash.default.findIndex(insideMemory, (i) => i === index), 1);
62
62
  };
63
- const open = (target, index, coords) => {
63
+ const open = (target, index) => {
64
64
  const element = containerRef.current[index];
65
+ const coords = getCoords(target.ref.current);
65
66
  element.style.top = `${coords.top}px`;
66
67
  element.style.left = `${coords.left}px`;
67
68
  element.style.opacity = "1";
@@ -72,7 +73,7 @@ const TargetProviderContainer = ({ children }) => {
72
73
  const handleScroll = () => {
73
74
  import_lodash.default.forEach(containerRef.current, (element, index) => {
74
75
  if (import_lodash.default.some(insideMemory, (i) => i === index)) return;
75
- close(targets[index], index);
76
+ close(index);
76
77
  });
77
78
  };
78
79
  window.addEventListener("scroll", handleScroll, { passive: true });
@@ -116,18 +117,18 @@ const TargetProviderContainer = ({ children }) => {
116
117
  element.addEventListener("click", () => {
117
118
  const styles = window.getComputedStyle(targetElement);
118
119
  if (styles.opacity === "1") {
119
- close(target, index);
120
+ blur(index);
120
121
  return;
121
122
  }
122
- const coords = getCoords(element);
123
- open(target, index, coords);
123
+ open(target, index);
124
124
  });
125
125
  element.addEventListener("resize", () => {
126
126
  import_lodash.default.forEach(containerRef.current, (elementRef) => blur(index));
127
127
  });
128
128
  focusable.addEventListener("blur", () => {
129
+ console.log(insideMemory);
129
130
  if (import_lodash.default.some(insideMemory, (i) => i === index)) return;
130
- close(target, index);
131
+ close(index);
131
132
  });
132
133
  });
133
134
  }, [targets, inputRef, containerRef]);
@@ -161,7 +162,7 @@ const TargetProviderContainer = ({ children }) => {
161
162
  };
162
163
  const closeTarget = (ref) => {
163
164
  const index = import_lodash.default.findIndex(memory, (data) => data.ref.current === ref.current);
164
- blur(index);
165
+ setTimeout(() => blur(index), 50);
165
166
  };
166
167
  return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
167
168
  TargetContext.Provider,
@@ -20,14 +20,15 @@ const TargetProviderContainer = ({ children }) => {
20
20
  insideMemory.splice(_.findIndex(insideMemory, (i) => i === index), 1);
21
21
  elementFocusable(targets[index], index).blur();
22
22
  };
23
- const close = (target, index) => {
23
+ const close = (index) => {
24
24
  const element = containerRef.current[index];
25
25
  element.style.opacity = "0";
26
26
  element.style.zIndex = "-1";
27
27
  insideMemory.splice(_.findIndex(insideMemory, (i) => i === index), 1);
28
28
  };
29
- const open = (target, index, coords) => {
29
+ const open = (target, index) => {
30
30
  const element = containerRef.current[index];
31
+ const coords = getCoords(target.ref.current);
31
32
  element.style.top = `${coords.top}px`;
32
33
  element.style.left = `${coords.left}px`;
33
34
  element.style.opacity = "1";
@@ -38,7 +39,7 @@ const TargetProviderContainer = ({ children }) => {
38
39
  const handleScroll = () => {
39
40
  _.forEach(containerRef.current, (element, index) => {
40
41
  if (_.some(insideMemory, (i) => i === index)) return;
41
- close(targets[index], index);
42
+ close(index);
42
43
  });
43
44
  };
44
45
  window.addEventListener("scroll", handleScroll, { passive: true });
@@ -82,18 +83,18 @@ const TargetProviderContainer = ({ children }) => {
82
83
  element.addEventListener("click", () => {
83
84
  const styles = window.getComputedStyle(targetElement);
84
85
  if (styles.opacity === "1") {
85
- close(target, index);
86
+ blur(index);
86
87
  return;
87
88
  }
88
- const coords = getCoords(element);
89
- open(target, index, coords);
89
+ open(target, index);
90
90
  });
91
91
  element.addEventListener("resize", () => {
92
92
  _.forEach(containerRef.current, (elementRef) => blur(index));
93
93
  });
94
94
  focusable.addEventListener("blur", () => {
95
+ console.log(insideMemory);
95
96
  if (_.some(insideMemory, (i) => i === index)) return;
96
- close(target, index);
97
+ close(index);
97
98
  });
98
99
  });
99
100
  }, [targets, inputRef, containerRef]);
@@ -127,7 +128,7 @@ const TargetProviderContainer = ({ children }) => {
127
128
  };
128
129
  const closeTarget = (ref) => {
129
130
  const index = _.findIndex(memory, (data) => data.ref.current === ref.current);
130
- blur(index);
131
+ setTimeout(() => blur(index), 50);
131
132
  };
132
133
  return /* @__PURE__ */ jsxs(
133
134
  TargetContext.Provider,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gustavo-valsechi/client",
3
- "version": "1.4.121",
3
+ "version": "1.4.123",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.js",
6
6
  "types": "dist/index.d.ts",