@gustavo-valsechi/client 1.4.123 → 1.4.125

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,8 +50,10 @@ const TargetProviderContainer = ({ children }) => {
50
50
  if (isFocusable) return target.ref.current;
51
51
  return inputRef.current[index];
52
52
  };
53
+ console.log("insideMemory", insideMemory);
53
54
  const blur = (index) => {
54
55
  insideMemory.splice(import_lodash.default.findIndex(insideMemory, (i) => i === index), 1);
56
+ console.log("insideMemory in blur function", insideMemory);
55
57
  elementFocusable(targets[index], index).blur();
56
58
  };
57
59
  const close = (index) => {
@@ -117,7 +119,7 @@ const TargetProviderContainer = ({ children }) => {
117
119
  element.addEventListener("click", () => {
118
120
  const styles = window.getComputedStyle(targetElement);
119
121
  if (styles.opacity === "1") {
120
- blur(index);
122
+ close(index);
121
123
  return;
122
124
  }
123
125
  open(target, index);
@@ -126,7 +128,7 @@ const TargetProviderContainer = ({ children }) => {
126
128
  import_lodash.default.forEach(containerRef.current, (elementRef) => blur(index));
127
129
  });
128
130
  focusable.addEventListener("blur", () => {
129
- console.log(insideMemory);
131
+ console.log("insideMemory in blur", insideMemory);
130
132
  if (import_lodash.default.some(insideMemory, (i) => i === index)) return;
131
133
  close(index);
132
134
  });
@@ -162,7 +164,7 @@ const TargetProviderContainer = ({ children }) => {
162
164
  };
163
165
  const closeTarget = (ref) => {
164
166
  const index = import_lodash.default.findIndex(memory, (data) => data.ref.current === ref.current);
165
- setTimeout(() => blur(index), 50);
167
+ blur(index);
166
168
  };
167
169
  return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
168
170
  TargetContext.Provider,
@@ -185,11 +187,6 @@ const TargetProviderContainer = ({ children }) => {
185
187
  if (import_lodash.default.some(insideMemory, (i) => i === index)) return;
186
188
  insideMemory.push(index);
187
189
  },
188
- onClick: () => {
189
- elementFocusable(target, index).focus();
190
- if (import_lodash.default.some(insideMemory, (i) => i === index)) return;
191
- insideMemory.push(index);
192
- },
193
190
  onMouseLeave: () => {
194
191
  insideMemory.splice(import_lodash.default.findIndex(insideMemory, (i) => i === index), 1);
195
192
  },
@@ -16,8 +16,10 @@ const TargetProviderContainer = ({ children }) => {
16
16
  if (isFocusable) return target.ref.current;
17
17
  return inputRef.current[index];
18
18
  };
19
+ console.log("insideMemory", insideMemory);
19
20
  const blur = (index) => {
20
21
  insideMemory.splice(_.findIndex(insideMemory, (i) => i === index), 1);
22
+ console.log("insideMemory in blur function", insideMemory);
21
23
  elementFocusable(targets[index], index).blur();
22
24
  };
23
25
  const close = (index) => {
@@ -83,7 +85,7 @@ const TargetProviderContainer = ({ children }) => {
83
85
  element.addEventListener("click", () => {
84
86
  const styles = window.getComputedStyle(targetElement);
85
87
  if (styles.opacity === "1") {
86
- blur(index);
88
+ close(index);
87
89
  return;
88
90
  }
89
91
  open(target, index);
@@ -92,7 +94,7 @@ const TargetProviderContainer = ({ children }) => {
92
94
  _.forEach(containerRef.current, (elementRef) => blur(index));
93
95
  });
94
96
  focusable.addEventListener("blur", () => {
95
- console.log(insideMemory);
97
+ console.log("insideMemory in blur", insideMemory);
96
98
  if (_.some(insideMemory, (i) => i === index)) return;
97
99
  close(index);
98
100
  });
@@ -128,7 +130,7 @@ const TargetProviderContainer = ({ children }) => {
128
130
  };
129
131
  const closeTarget = (ref) => {
130
132
  const index = _.findIndex(memory, (data) => data.ref.current === ref.current);
131
- setTimeout(() => blur(index), 50);
133
+ blur(index);
132
134
  };
133
135
  return /* @__PURE__ */ jsxs(
134
136
  TargetContext.Provider,
@@ -151,11 +153,6 @@ const TargetProviderContainer = ({ children }) => {
151
153
  if (_.some(insideMemory, (i) => i === index)) return;
152
154
  insideMemory.push(index);
153
155
  },
154
- onClick: () => {
155
- elementFocusable(target, index).focus();
156
- if (_.some(insideMemory, (i) => i === index)) return;
157
- insideMemory.push(index);
158
- },
159
156
  onMouseLeave: () => {
160
157
  insideMemory.splice(_.findIndex(insideMemory, (i) => i === index), 1);
161
158
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gustavo-valsechi/client",
3
- "version": "1.4.123",
3
+ "version": "1.4.125",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.js",
6
6
  "types": "dist/index.d.ts",