@gustavo-valsechi/client 1.4.120 → 1.4.122

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
  });
@@ -50,14 +50,19 @@ const TargetProviderContainer = ({ children }) => {
50
50
  if (isFocusable) return target.ref.current;
51
51
  return inputRef.current[index];
52
52
  };
53
+ const blur = (index) => {
54
+ insideMemory.splice(import_lodash.default.findIndex(insideMemory, (i) => i === index), 1);
55
+ elementFocusable(targets[index], index).blur();
56
+ };
53
57
  const close = (target, index) => {
54
58
  const element = containerRef.current[index];
55
59
  element.style.opacity = "0";
56
60
  element.style.zIndex = "-1";
57
61
  insideMemory.splice(import_lodash.default.findIndex(insideMemory, (i) => i === index), 1);
58
62
  };
59
- const open = (target, index, coords) => {
63
+ const open = (target, index) => {
60
64
  const element = containerRef.current[index];
65
+ const coords = getCoords(target.ref.current);
61
66
  element.style.top = `${coords.top}px`;
62
67
  element.style.left = `${coords.left}px`;
63
68
  element.style.opacity = "1";
@@ -111,15 +116,16 @@ const TargetProviderContainer = ({ children }) => {
111
116
  const targetElement = containerRef.current[index];
112
117
  element.addEventListener("click", () => {
113
118
  const styles = window.getComputedStyle(targetElement);
119
+ console.log("opacity", styles.opacity);
120
+ console.log("target", target);
114
121
  if (styles.opacity === "1") {
115
- close(target, index);
122
+ blur(index);
116
123
  return;
117
124
  }
118
- const coords = getCoords(element);
119
- open(target, index, coords);
125
+ open(target, index);
120
126
  });
121
127
  element.addEventListener("resize", () => {
122
- import_lodash.default.forEach(containerRef.current, (elementRef) => close(target, index));
128
+ import_lodash.default.forEach(containerRef.current, (elementRef) => blur(index));
123
129
  });
124
130
  focusable.addEventListener("blur", () => {
125
131
  if (import_lodash.default.some(insideMemory, (i) => i === index)) return;
@@ -157,8 +163,7 @@ const TargetProviderContainer = ({ children }) => {
157
163
  };
158
164
  const closeTarget = (ref) => {
159
165
  const index = import_lodash.default.findIndex(memory, (data) => data.ref.current === ref.current);
160
- insideMemory.splice(import_lodash.default.findIndex(insideMemory, (i) => i === index), 1);
161
- elementFocusable(targets[index], index).blur();
166
+ blur(index);
162
167
  };
163
168
  return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
164
169
  TargetContext.Provider,
@@ -16,14 +16,19 @@ const TargetProviderContainer = ({ children }) => {
16
16
  if (isFocusable) return target.ref.current;
17
17
  return inputRef.current[index];
18
18
  };
19
+ const blur = (index) => {
20
+ insideMemory.splice(_.findIndex(insideMemory, (i) => i === index), 1);
21
+ elementFocusable(targets[index], index).blur();
22
+ };
19
23
  const close = (target, index) => {
20
24
  const element = containerRef.current[index];
21
25
  element.style.opacity = "0";
22
26
  element.style.zIndex = "-1";
23
27
  insideMemory.splice(_.findIndex(insideMemory, (i) => i === index), 1);
24
28
  };
25
- const open = (target, index, coords) => {
29
+ const open = (target, index) => {
26
30
  const element = containerRef.current[index];
31
+ const coords = getCoords(target.ref.current);
27
32
  element.style.top = `${coords.top}px`;
28
33
  element.style.left = `${coords.left}px`;
29
34
  element.style.opacity = "1";
@@ -77,15 +82,16 @@ const TargetProviderContainer = ({ children }) => {
77
82
  const targetElement = containerRef.current[index];
78
83
  element.addEventListener("click", () => {
79
84
  const styles = window.getComputedStyle(targetElement);
85
+ console.log("opacity", styles.opacity);
86
+ console.log("target", target);
80
87
  if (styles.opacity === "1") {
81
- close(target, index);
88
+ blur(index);
82
89
  return;
83
90
  }
84
- const coords = getCoords(element);
85
- open(target, index, coords);
91
+ open(target, index);
86
92
  });
87
93
  element.addEventListener("resize", () => {
88
- _.forEach(containerRef.current, (elementRef) => close(target, index));
94
+ _.forEach(containerRef.current, (elementRef) => blur(index));
89
95
  });
90
96
  focusable.addEventListener("blur", () => {
91
97
  if (_.some(insideMemory, (i) => i === index)) return;
@@ -123,8 +129,7 @@ const TargetProviderContainer = ({ children }) => {
123
129
  };
124
130
  const closeTarget = (ref) => {
125
131
  const index = _.findIndex(memory, (data) => data.ref.current === ref.current);
126
- insideMemory.splice(_.findIndex(insideMemory, (i) => i === index), 1);
127
- elementFocusable(targets[index], index).blur();
132
+ blur(index);
128
133
  };
129
134
  return /* @__PURE__ */ jsxs(
130
135
  TargetContext.Provider,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gustavo-valsechi/client",
3
- "version": "1.4.120",
3
+ "version": "1.4.122",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.js",
6
6
  "types": "dist/index.d.ts",