sag_components 1.0.915 → 1.0.917

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.
@@ -20,46 +20,17 @@ const HaiTooltip = _ref => {
20
20
  });
21
21
  const wrapperRef = (0, _react.useRef)(null);
22
22
  const tooltipRef = (0, _react.useRef)(null);
23
-
24
- // const calculatePosition = () => {
25
- // const rect = wrapperRef.current.getBoundingClientRect();
26
-
27
- // if (tooltipRef.current) {
28
- // const tooltipRect = tooltipRef.current.getBoundingClientRect();
29
- // const top = rect.top - tooltipRect.height - 10;
30
- // const left = rect.left + (rect.width / 2) - (tooltipRect.width / 2) + 105; // Adjust this offset value as needed
31
-
32
- // if (left < 0) {
33
- // left = 10;
34
- // }
35
- // if (left + tooltipRect.width > window.innerWidth) {
36
- // left = window.innerWidth - tooltipRect.width - 10;
37
- // }
38
-
39
- // setPosition({ top, left });
40
- // }
41
- // };
42
-
43
23
  const calculatePosition = () => {
44
24
  const rect = wrapperRef.current.getBoundingClientRect();
45
25
  if (tooltipRef.current) {
46
26
  const tooltipRect = tooltipRef.current.getBoundingClientRect();
47
-
48
- // Calculate the top position above the InfoIcon
49
27
  const top = rect.top - tooltipRect.height - 10;
50
-
51
- // Calculate the left position to center the tooltip directly above the InfoIcon
52
- // Use let instead of const for variables that may be reassigned
53
- let left = rect.left + rect.width / 2 - tooltipRect.width / 2 + 105; // Adjust this offset value as needed
54
-
55
- // Ensure the tooltip does not go off the screen (left side)
28
+ let left = rect.left + rect.width / 2 - tooltipRect.width / 2 + 70;
56
29
  if (left < 0) {
57
- left = 10; // Keep a small margin from the left edge of the screen
30
+ left = 10;
58
31
  }
59
-
60
- // Ensure the tooltip does not go off the screen (right side)
61
32
  if (left + tooltipRect.width > window.innerWidth) {
62
- left = window.innerWidth - tooltipRect.width - 10; // Keep a small margin from the right edge
33
+ left = window.innerWidth - tooltipRect.width - 10;
63
34
  }
64
35
  setPosition({
65
36
  top,
@@ -75,12 +46,9 @@ const HaiTooltip = _ref => {
75
46
  };
76
47
  (0, _react.useEffect)(() => {
77
48
  if (isVisible) {
78
- calculatePosition(); // Calculate the position after tooltip becomes visible
79
-
49
+ calculatePosition();
80
50
  window.addEventListener('resize', calculatePosition);
81
51
  window.addEventListener('scroll', calculatePosition);
82
-
83
- // Ensure the tooltip is recalculated after rendering
84
52
  setTimeout(calculatePosition, 0);
85
53
  }
86
54
  return () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sag_components",
3
- "version": "1.0.915",
3
+ "version": "1.0.917",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {