@gustavo-valsechi/client 1.4.46 → 1.4.47
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.
|
@@ -48,13 +48,13 @@ const TargetProviderContainer = ({ children }) => {
|
|
|
48
48
|
if (!element) return;
|
|
49
49
|
element.addEventListener("click", () => {
|
|
50
50
|
const newTargets = [...targets];
|
|
51
|
-
|
|
52
|
-
newTargets.splice(index, 1, { ...target, show: !target.show, coords });
|
|
51
|
+
newTargets.splice(index, 1, { ...target, show: !target.show });
|
|
53
52
|
setTargets(newTargets);
|
|
54
53
|
});
|
|
55
54
|
});
|
|
56
55
|
}, [targets]);
|
|
57
56
|
const getCoords = (target) => {
|
|
57
|
+
if (!target) return {};
|
|
58
58
|
const rect = target.getBoundingClientRect();
|
|
59
59
|
const targetTop = rect.top + window.scrollY;
|
|
60
60
|
const targetLeft = rect.left + window.scrollX;
|
|
@@ -71,7 +71,7 @@ const TargetProviderContainer = ({ children }) => {
|
|
|
71
71
|
return coords;
|
|
72
72
|
};
|
|
73
73
|
const add = (target) => {
|
|
74
|
-
memory.push({ ...target, show: false
|
|
74
|
+
memory.push({ ...target, show: false });
|
|
75
75
|
setTargets(memory);
|
|
76
76
|
};
|
|
77
77
|
const remove = (ref) => {
|
|
@@ -89,14 +89,21 @@ const TargetProviderContainer = ({ children }) => {
|
|
|
89
89
|
children: [
|
|
90
90
|
import_lodash.default.map(
|
|
91
91
|
targets,
|
|
92
|
-
(target, index) =>
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
92
|
+
(target, index) => {
|
|
93
|
+
var _a;
|
|
94
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
95
|
+
import_styles.Container,
|
|
96
|
+
{
|
|
97
|
+
style: {
|
|
98
|
+
...getCoords((_a = target.ref) == null ? void 0 : _a.current),
|
|
99
|
+
zIndex: target.show ? "10" : "-1",
|
|
100
|
+
opacity: target.show ? "1" : "0"
|
|
101
|
+
},
|
|
102
|
+
children: target.component
|
|
103
|
+
},
|
|
104
|
+
index
|
|
105
|
+
);
|
|
106
|
+
}
|
|
100
107
|
),
|
|
101
108
|
children
|
|
102
109
|
]
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { createContext, useContext, useEffect, useState } from "react";
|
|
4
4
|
import { Container } from "./styles";
|
|
5
5
|
import _ from "lodash";
|
|
@@ -14,13 +14,13 @@ const TargetProviderContainer = ({ children }) => {
|
|
|
14
14
|
if (!element) return;
|
|
15
15
|
element.addEventListener("click", () => {
|
|
16
16
|
const newTargets = [...targets];
|
|
17
|
-
|
|
18
|
-
newTargets.splice(index, 1, { ...target, show: !target.show, coords });
|
|
17
|
+
newTargets.splice(index, 1, { ...target, show: !target.show });
|
|
19
18
|
setTargets(newTargets);
|
|
20
19
|
});
|
|
21
20
|
});
|
|
22
21
|
}, [targets]);
|
|
23
22
|
const getCoords = (target) => {
|
|
23
|
+
if (!target) return {};
|
|
24
24
|
const rect = target.getBoundingClientRect();
|
|
25
25
|
const targetTop = rect.top + window.scrollY;
|
|
26
26
|
const targetLeft = rect.left + window.scrollX;
|
|
@@ -37,7 +37,7 @@ const TargetProviderContainer = ({ children }) => {
|
|
|
37
37
|
return coords;
|
|
38
38
|
};
|
|
39
39
|
const add = (target) => {
|
|
40
|
-
memory.push({ ...target, show: false
|
|
40
|
+
memory.push({ ...target, show: false });
|
|
41
41
|
setTargets(memory);
|
|
42
42
|
};
|
|
43
43
|
const remove = (ref) => {
|
|
@@ -55,14 +55,21 @@ const TargetProviderContainer = ({ children }) => {
|
|
|
55
55
|
children: [
|
|
56
56
|
_.map(
|
|
57
57
|
targets,
|
|
58
|
-
(target, index) =>
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
58
|
+
(target, index) => {
|
|
59
|
+
var _a;
|
|
60
|
+
return /* @__PURE__ */ jsx(
|
|
61
|
+
Container,
|
|
62
|
+
{
|
|
63
|
+
style: {
|
|
64
|
+
...getCoords((_a = target.ref) == null ? void 0 : _a.current),
|
|
65
|
+
zIndex: target.show ? "10" : "-1",
|
|
66
|
+
opacity: target.show ? "1" : "0"
|
|
67
|
+
},
|
|
68
|
+
children: target.component
|
|
69
|
+
},
|
|
70
|
+
index
|
|
71
|
+
);
|
|
72
|
+
}
|
|
66
73
|
),
|
|
67
74
|
children
|
|
68
75
|
]
|
|
@@ -34,7 +34,6 @@ module.exports = __toCommonJS(styles_exports);
|
|
|
34
34
|
var import_styled_components = __toESM(require("styled-components"));
|
|
35
35
|
const Container = import_styled_components.default.div`
|
|
36
36
|
position: absolute;
|
|
37
|
-
z-index: 10;
|
|
38
37
|
|
|
39
38
|
@media(max-width: ${({ theme }) => theme.mobileMaxWidth}) {
|
|
40
39
|
width: 100%;
|