@gustavo-valsechi/client 1.4.85 → 1.4.86

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,16 @@ 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
+ if (targetElement.style.opacity === "1") {
102
+ close(targetElement);
103
+ return;
104
+ }
105
+ const coords = getCoords(element);
106
+ open(targetElement, coords);
104
107
  inputRef.current[index].focus();
105
108
  });
106
109
  element.addEventListener("resize", () => {
107
- import_lodash.default.forEach(containerRef.current, (elementRef) => {
108
- elementRef.style.opacity = "0";
109
- elementRef.style.zIndex = "-1";
110
- });
110
+ import_lodash.default.forEach(containerRef.current, (elementRef) => close(elementRef));
111
111
  });
112
112
  });
113
113
  }, [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,16 @@ 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
+ if (targetElement.style.opacity === "1") {
68
+ close(targetElement);
69
+ return;
70
+ }
71
+ const coords = getCoords(element);
72
+ open(targetElement, coords);
70
73
  inputRef.current[index].focus();
71
74
  });
72
75
  element.addEventListener("resize", () => {
73
- _.forEach(containerRef.current, (elementRef) => {
74
- elementRef.style.opacity = "0";
75
- elementRef.style.zIndex = "-1";
76
- });
76
+ _.forEach(containerRef.current, (elementRef) => close(elementRef));
77
77
  });
78
78
  });
79
79
  }, [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.86",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.js",
6
6
  "types": "dist/index.d.ts",