@gustavo-valsechi/client 1.4.122 → 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.
@@ -54,7 +54,7 @@ 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";
@@ -73,7 +73,7 @@ const TargetProviderContainer = ({ children }) => {
73
73
  const handleScroll = () => {
74
74
  import_lodash.default.forEach(containerRef.current, (element, index) => {
75
75
  if (import_lodash.default.some(insideMemory, (i) => i === index)) return;
76
- close(targets[index], index);
76
+ close(index);
77
77
  });
78
78
  };
79
79
  window.addEventListener("scroll", handleScroll, { passive: true });
@@ -116,8 +116,6 @@ const TargetProviderContainer = ({ children }) => {
116
116
  const targetElement = containerRef.current[index];
117
117
  element.addEventListener("click", () => {
118
118
  const styles = window.getComputedStyle(targetElement);
119
- console.log("opacity", styles.opacity);
120
- console.log("target", target);
121
119
  if (styles.opacity === "1") {
122
120
  blur(index);
123
121
  return;
@@ -128,8 +126,9 @@ const TargetProviderContainer = ({ children }) => {
128
126
  import_lodash.default.forEach(containerRef.current, (elementRef) => blur(index));
129
127
  });
130
128
  focusable.addEventListener("blur", () => {
129
+ console.log(insideMemory);
131
130
  if (import_lodash.default.some(insideMemory, (i) => i === index)) return;
132
- close(target, index);
131
+ close(index);
133
132
  });
134
133
  });
135
134
  }, [targets, inputRef, containerRef]);
@@ -163,7 +162,7 @@ const TargetProviderContainer = ({ children }) => {
163
162
  };
164
163
  const closeTarget = (ref) => {
165
164
  const index = import_lodash.default.findIndex(memory, (data) => data.ref.current === ref.current);
166
- blur(index);
165
+ setTimeout(() => blur(index), 50);
167
166
  };
168
167
  return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
169
168
  TargetContext.Provider,
@@ -20,7 +20,7 @@ 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";
@@ -39,7 +39,7 @@ const TargetProviderContainer = ({ children }) => {
39
39
  const handleScroll = () => {
40
40
  _.forEach(containerRef.current, (element, index) => {
41
41
  if (_.some(insideMemory, (i) => i === index)) return;
42
- close(targets[index], index);
42
+ close(index);
43
43
  });
44
44
  };
45
45
  window.addEventListener("scroll", handleScroll, { passive: true });
@@ -82,8 +82,6 @@ const TargetProviderContainer = ({ children }) => {
82
82
  const targetElement = containerRef.current[index];
83
83
  element.addEventListener("click", () => {
84
84
  const styles = window.getComputedStyle(targetElement);
85
- console.log("opacity", styles.opacity);
86
- console.log("target", target);
87
85
  if (styles.opacity === "1") {
88
86
  blur(index);
89
87
  return;
@@ -94,8 +92,9 @@ const TargetProviderContainer = ({ children }) => {
94
92
  _.forEach(containerRef.current, (elementRef) => blur(index));
95
93
  });
96
94
  focusable.addEventListener("blur", () => {
95
+ console.log(insideMemory);
97
96
  if (_.some(insideMemory, (i) => i === index)) return;
98
- close(target, index);
97
+ close(index);
99
98
  });
100
99
  });
101
100
  }, [targets, inputRef, containerRef]);
@@ -129,7 +128,7 @@ const TargetProviderContainer = ({ children }) => {
129
128
  };
130
129
  const closeTarget = (ref) => {
131
130
  const index = _.findIndex(memory, (data) => data.ref.current === ref.current);
132
- blur(index);
131
+ setTimeout(() => blur(index), 50);
133
132
  };
134
133
  return /* @__PURE__ */ jsxs(
135
134
  TargetContext.Provider,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gustavo-valsechi/client",
3
- "version": "1.4.122",
3
+ "version": "1.4.123",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.js",
6
6
  "types": "dist/index.d.ts",