@gustavo-valsechi/client 1.4.286 → 1.4.289
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.
|
@@ -51,6 +51,7 @@ const TargetProviderContainer = ({ children }) => {
|
|
|
51
51
|
const theme = (0, import_theme.useTheme)();
|
|
52
52
|
const [targets, setTargets] = (0, import_react.useState)([]);
|
|
53
53
|
const [modal, setModal] = (0, import_react.useState)(-1);
|
|
54
|
+
console.log("targets", targets);
|
|
54
55
|
(0, import_react.useEffect)(() => {
|
|
55
56
|
(0, import_events.onScroll)(close, containerRef);
|
|
56
57
|
}, [containerRef]);
|
|
@@ -68,20 +69,6 @@ const TargetProviderContainer = ({ children }) => {
|
|
|
68
69
|
focusable.addEventListener("focus", () => (0, import_events.onFocus)(target, index, open));
|
|
69
70
|
focusable.addEventListener("blur", () => (0, import_events.onBlur)(target, index, close, focusable, insideMemory));
|
|
70
71
|
});
|
|
71
|
-
return () => {
|
|
72
|
-
import_lodash.default.forEach(targets, (target, index) => {
|
|
73
|
-
var _a, _b;
|
|
74
|
-
const element = (_a = target.ref) == null ? void 0 : _a.current;
|
|
75
|
-
const toggleElement = ((_b = target.toggleRef) == null ? void 0 : _b.current) || element;
|
|
76
|
-
if (!(toggleElement == null ? void 0 : toggleElement.removeEventListener)) return;
|
|
77
|
-
const focusable = elementFocusable(target, index);
|
|
78
|
-
const targetElement = containerRef.current[index];
|
|
79
|
-
toggleElement.removeEventListener("click", () => (0, import_events.onClick)(target, index, close, focusable, targetElement, theme, setModal));
|
|
80
|
-
toggleElement.removeEventListener("mouseleave", () => removeInside(index));
|
|
81
|
-
focusable.removeEventListener("focus", () => (0, import_events.onFocus)(target, index, open));
|
|
82
|
-
focusable.removeEventListener("blur", () => (0, import_events.onBlur)(target, index, close, focusable, insideMemory));
|
|
83
|
-
});
|
|
84
|
-
};
|
|
85
72
|
}, [targets, inputRef, containerRef, theme.content.isMobile]);
|
|
86
73
|
const getCoords = (target, component) => {
|
|
87
74
|
const rect = target.getBoundingClientRect();
|
|
@@ -133,6 +120,7 @@ const TargetProviderContainer = ({ children }) => {
|
|
|
133
120
|
const exists = import_lodash.default.find(memory, (data) => data.ref.current === target.ref.current);
|
|
134
121
|
if (exists) return;
|
|
135
122
|
memory.push(target);
|
|
123
|
+
console.log("memory", [...memory]);
|
|
136
124
|
setTargets([...memory]);
|
|
137
125
|
};
|
|
138
126
|
const remove = (ref) => {
|
|
@@ -17,6 +17,7 @@ const TargetProviderContainer = ({ children }) => {
|
|
|
17
17
|
const theme = useTheme();
|
|
18
18
|
const [targets, setTargets] = useState([]);
|
|
19
19
|
const [modal, setModal] = useState(-1);
|
|
20
|
+
console.log("targets", targets);
|
|
20
21
|
useEffect(() => {
|
|
21
22
|
onScroll(close, containerRef);
|
|
22
23
|
}, [containerRef]);
|
|
@@ -34,20 +35,6 @@ const TargetProviderContainer = ({ children }) => {
|
|
|
34
35
|
focusable.addEventListener("focus", () => onFocus(target, index, open));
|
|
35
36
|
focusable.addEventListener("blur", () => onBlur(target, index, close, focusable, insideMemory));
|
|
36
37
|
});
|
|
37
|
-
return () => {
|
|
38
|
-
_.forEach(targets, (target, index) => {
|
|
39
|
-
var _a, _b;
|
|
40
|
-
const element = (_a = target.ref) == null ? void 0 : _a.current;
|
|
41
|
-
const toggleElement = ((_b = target.toggleRef) == null ? void 0 : _b.current) || element;
|
|
42
|
-
if (!(toggleElement == null ? void 0 : toggleElement.removeEventListener)) return;
|
|
43
|
-
const focusable = elementFocusable(target, index);
|
|
44
|
-
const targetElement = containerRef.current[index];
|
|
45
|
-
toggleElement.removeEventListener("click", () => onClick(target, index, close, focusable, targetElement, theme, setModal));
|
|
46
|
-
toggleElement.removeEventListener("mouseleave", () => removeInside(index));
|
|
47
|
-
focusable.removeEventListener("focus", () => onFocus(target, index, open));
|
|
48
|
-
focusable.removeEventListener("blur", () => onBlur(target, index, close, focusable, insideMemory));
|
|
49
|
-
});
|
|
50
|
-
};
|
|
51
38
|
}, [targets, inputRef, containerRef, theme.content.isMobile]);
|
|
52
39
|
const getCoords = (target, component) => {
|
|
53
40
|
const rect = target.getBoundingClientRect();
|
|
@@ -99,6 +86,7 @@ const TargetProviderContainer = ({ children }) => {
|
|
|
99
86
|
const exists = _.find(memory, (data) => data.ref.current === target.ref.current);
|
|
100
87
|
if (exists) return;
|
|
101
88
|
memory.push(target);
|
|
89
|
+
console.log("memory", [...memory]);
|
|
102
90
|
setTargets([...memory]);
|
|
103
91
|
};
|
|
104
92
|
const remove = (ref) => {
|