@gustavo-valsechi/client 1.4.85 → 1.4.87

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,8 +48,7 @@ const TargetProviderContainer = ({ children }) => {
48
48
  element.style.opacity = "0";
49
49
  element.style.zIndex = "-1";
50
50
  };
51
- const open = (element) => {
52
- const coords = getCoords(element);
51
+ const open = (element, coords) => {
53
52
  element.style.top = `${coords.top}px`;
54
53
  element.style.left = `${coords.left}px`;
55
54
  element.style.opacity = "1";
@@ -99,15 +98,17 @@ const TargetProviderContainer = ({ children }) => {
99
98
  element.addEventListener("click", () => {
100
99
  const targetElement = import_lodash.default.find(containerRef.current, (data, i) => i === index);
101
100
  if (!targetElement) return;
102
- if (targetElement.style.opacity === "1") return close(targetElement);
103
- open(targetElement);
101
+ console.log("target opacity", targetElement.style.opacity);
102
+ if (targetElement.style.opacity === "1") {
103
+ close(targetElement);
104
+ return;
105
+ }
106
+ const coords = getCoords(element);
107
+ open(targetElement, coords);
104
108
  inputRef.current[index].focus();
105
109
  });
106
110
  element.addEventListener("resize", () => {
107
- import_lodash.default.forEach(containerRef.current, (elementRef) => {
108
- elementRef.style.opacity = "0";
109
- elementRef.style.zIndex = "-1";
110
- });
111
+ import_lodash.default.forEach(containerRef.current, (elementRef) => close(elementRef));
111
112
  });
112
113
  });
113
114
  }, [targets, inputRef, containerRef]);
@@ -14,8 +14,7 @@ const TargetProviderContainer = ({ children }) => {
14
14
  element.style.opacity = "0";
15
15
  element.style.zIndex = "-1";
16
16
  };
17
- const open = (element) => {
18
- const coords = getCoords(element);
17
+ const open = (element, coords) => {
19
18
  element.style.top = `${coords.top}px`;
20
19
  element.style.left = `${coords.left}px`;
21
20
  element.style.opacity = "1";
@@ -65,15 +64,17 @@ const TargetProviderContainer = ({ children }) => {
65
64
  element.addEventListener("click", () => {
66
65
  const targetElement = _.find(containerRef.current, (data, i) => i === index);
67
66
  if (!targetElement) return;
68
- if (targetElement.style.opacity === "1") return close(targetElement);
69
- open(targetElement);
67
+ console.log("target opacity", targetElement.style.opacity);
68
+ if (targetElement.style.opacity === "1") {
69
+ close(targetElement);
70
+ return;
71
+ }
72
+ const coords = getCoords(element);
73
+ open(targetElement, coords);
70
74
  inputRef.current[index].focus();
71
75
  });
72
76
  element.addEventListener("resize", () => {
73
- _.forEach(containerRef.current, (elementRef) => {
74
- elementRef.style.opacity = "0";
75
- elementRef.style.zIndex = "-1";
76
- });
77
+ _.forEach(containerRef.current, (elementRef) => close(elementRef));
77
78
  });
78
79
  });
79
80
  }, [targets, inputRef, containerRef]);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gustavo-valsechi/client",
3
- "version": "1.4.85",
3
+ "version": "1.4.87",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.js",
6
6
  "types": "dist/index.d.ts",