@gustavo-valsechi/client 1.4.120 → 1.4.121

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,6 +50,10 @@ 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";
@@ -119,7 +123,7 @@ const TargetProviderContainer = ({ children }) => {
119
123
  open(target, index, coords);
120
124
  });
121
125
  element.addEventListener("resize", () => {
122
- import_lodash.default.forEach(containerRef.current, (elementRef) => close(target, index));
126
+ import_lodash.default.forEach(containerRef.current, (elementRef) => blur(index));
123
127
  });
124
128
  focusable.addEventListener("blur", () => {
125
129
  if (import_lodash.default.some(insideMemory, (i) => i === index)) return;
@@ -157,8 +161,7 @@ const TargetProviderContainer = ({ children }) => {
157
161
  };
158
162
  const closeTarget = (ref) => {
159
163
  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();
164
+ blur(index);
162
165
  };
163
166
  return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
164
167
  TargetContext.Provider,
@@ -16,6 +16,10 @@ 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";
@@ -85,7 +89,7 @@ const TargetProviderContainer = ({ children }) => {
85
89
  open(target, index, coords);
86
90
  });
87
91
  element.addEventListener("resize", () => {
88
- _.forEach(containerRef.current, (elementRef) => close(target, index));
92
+ _.forEach(containerRef.current, (elementRef) => blur(index));
89
93
  });
90
94
  focusable.addEventListener("blur", () => {
91
95
  if (_.some(insideMemory, (i) => i === index)) return;
@@ -123,8 +127,7 @@ const TargetProviderContainer = ({ children }) => {
123
127
  };
124
128
  const closeTarget = (ref) => {
125
129
  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();
130
+ blur(index);
128
131
  };
129
132
  return /* @__PURE__ */ jsxs(
130
133
  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.121",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.js",
6
6
  "types": "dist/index.d.ts",