@gustavo-valsechi/client 1.4.98 → 1.4.100
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.
|
@@ -101,13 +101,12 @@ const TargetProviderContainer = ({ children }) => {
|
|
|
101
101
|
var _a;
|
|
102
102
|
const element = (_a = target.ref) == null ? void 0 : _a.current;
|
|
103
103
|
if (!(element == null ? void 0 : element.addEventListener)) return;
|
|
104
|
+
const focusable = elementFocusable(target, index);
|
|
104
105
|
element.addEventListener("click", () => {
|
|
105
106
|
const targetElement = import_lodash.default.find(containerRef.current, (data, i) => i === index);
|
|
106
107
|
if (!targetElement) return;
|
|
107
|
-
const
|
|
108
|
-
|
|
109
|
-
console.log(document.activeElement);
|
|
110
|
-
if (focusable !== document.activeElement) {
|
|
108
|
+
const styles = window.getComputedStyle(targetElement);
|
|
109
|
+
if (styles.opacity === "1") {
|
|
111
110
|
close(targetElement);
|
|
112
111
|
return;
|
|
113
112
|
}
|
|
@@ -118,8 +117,12 @@ const TargetProviderContainer = ({ children }) => {
|
|
|
118
117
|
element.addEventListener("resize", () => {
|
|
119
118
|
import_lodash.default.forEach(containerRef.current, (elementRef) => close(elementRef));
|
|
120
119
|
});
|
|
120
|
+
focusable.addEventListener("blur", () => {
|
|
121
|
+
if (inside) return;
|
|
122
|
+
close(containerRef.current[index]);
|
|
123
|
+
});
|
|
121
124
|
});
|
|
122
|
-
}, [targets, inputRef, containerRef]);
|
|
125
|
+
}, [targets, inputRef, containerRef, inside]);
|
|
123
126
|
const getCoords = (target) => {
|
|
124
127
|
const rect = target.getBoundingClientRect();
|
|
125
128
|
const targetTop = rect.top + window.scrollY;
|
|
@@ -175,11 +178,7 @@ const TargetProviderContainer = ({ children }) => {
|
|
|
175
178
|
"input",
|
|
176
179
|
{
|
|
177
180
|
style: { zIndex: "-1", position: "fixed", opacity: "0" },
|
|
178
|
-
ref: (element) => inputRef.current[index] = element
|
|
179
|
-
onBlur: () => {
|
|
180
|
-
if (inside) return;
|
|
181
|
-
close(containerRef.current[index]);
|
|
182
|
-
}
|
|
181
|
+
ref: (element) => inputRef.current[index] = element
|
|
183
182
|
}
|
|
184
183
|
)
|
|
185
184
|
] }, index)
|
|
@@ -67,13 +67,12 @@ const TargetProviderContainer = ({ children }) => {
|
|
|
67
67
|
var _a;
|
|
68
68
|
const element = (_a = target.ref) == null ? void 0 : _a.current;
|
|
69
69
|
if (!(element == null ? void 0 : element.addEventListener)) return;
|
|
70
|
+
const focusable = elementFocusable(target, index);
|
|
70
71
|
element.addEventListener("click", () => {
|
|
71
72
|
const targetElement = _.find(containerRef.current, (data, i) => i === index);
|
|
72
73
|
if (!targetElement) return;
|
|
73
|
-
const
|
|
74
|
-
|
|
75
|
-
console.log(document.activeElement);
|
|
76
|
-
if (focusable !== document.activeElement) {
|
|
74
|
+
const styles = window.getComputedStyle(targetElement);
|
|
75
|
+
if (styles.opacity === "1") {
|
|
77
76
|
close(targetElement);
|
|
78
77
|
return;
|
|
79
78
|
}
|
|
@@ -84,8 +83,12 @@ const TargetProviderContainer = ({ children }) => {
|
|
|
84
83
|
element.addEventListener("resize", () => {
|
|
85
84
|
_.forEach(containerRef.current, (elementRef) => close(elementRef));
|
|
86
85
|
});
|
|
86
|
+
focusable.addEventListener("blur", () => {
|
|
87
|
+
if (inside) return;
|
|
88
|
+
close(containerRef.current[index]);
|
|
89
|
+
});
|
|
87
90
|
});
|
|
88
|
-
}, [targets, inputRef, containerRef]);
|
|
91
|
+
}, [targets, inputRef, containerRef, inside]);
|
|
89
92
|
const getCoords = (target) => {
|
|
90
93
|
const rect = target.getBoundingClientRect();
|
|
91
94
|
const targetTop = rect.top + window.scrollY;
|
|
@@ -141,11 +144,7 @@ const TargetProviderContainer = ({ children }) => {
|
|
|
141
144
|
"input",
|
|
142
145
|
{
|
|
143
146
|
style: { zIndex: "-1", position: "fixed", opacity: "0" },
|
|
144
|
-
ref: (element) => inputRef.current[index] = element
|
|
145
|
-
onBlur: () => {
|
|
146
|
-
if (inside) return;
|
|
147
|
-
close(containerRef.current[index]);
|
|
148
|
-
}
|
|
147
|
+
ref: (element) => inputRef.current[index] = element
|
|
149
148
|
}
|
|
150
149
|
)
|
|
151
150
|
] }, index)
|