@zenkigen-inc/component-ui 1.20.1 → 1.20.3

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.
package/dist/index.js CHANGED
@@ -3686,8 +3686,19 @@ function Tooltip({
3686
3686
  if (isDisabledHover) {
3687
3687
  return;
3688
3688
  }
3689
+ if (targetRef.current !== null) {
3690
+ const dimensions = targetRef.current.getBoundingClientRect();
3691
+ const position = calculatePosition({
3692
+ dimensions,
3693
+ maxWidth,
3694
+ verticalPosition,
3695
+ horizontalAlign,
3696
+ tooltipSize: size
3697
+ });
3698
+ setTooltipPosition(position);
3699
+ }
3689
3700
  setIsVisible(true);
3690
- }, [isDisabledHover]);
3701
+ }, [isDisabledHover, calculatePosition, maxWidth, verticalPosition, horizontalAlign, size]);
3691
3702
  const handleMouseOutWrapper = (0, import_react53.useCallback)(() => {
3692
3703
  setIsVisible(false);
3693
3704
  }, []);
@@ -3697,6 +3708,27 @@ function Tooltip({
3697
3708
  const position = calculatePosition({ dimensions, maxWidth, verticalPosition, horizontalAlign, tooltipSize: size });
3698
3709
  setTooltipPosition(position);
3699
3710
  }, [calculatePosition, horizontalAlign, maxWidth, size, verticalPosition]);
3711
+ (0, import_react53.useEffect)(() => {
3712
+ if (!isVisible) return;
3713
+ const updatePosition = () => {
3714
+ if (targetRef.current === null) return;
3715
+ const dimensions = targetRef.current.getBoundingClientRect();
3716
+ const position = calculatePosition({
3717
+ dimensions,
3718
+ maxWidth,
3719
+ verticalPosition,
3720
+ horizontalAlign,
3721
+ tooltipSize: size
3722
+ });
3723
+ setTooltipPosition(position);
3724
+ };
3725
+ window.addEventListener("scroll", updatePosition, { capture: true, passive: true });
3726
+ window.addEventListener("resize", updatePosition, { passive: true });
3727
+ return () => {
3728
+ window.removeEventListener("scroll", updatePosition, { capture: true });
3729
+ window.removeEventListener("resize", updatePosition);
3730
+ };
3731
+ }, [isVisible, calculatePosition, maxWidth, verticalPosition, horizontalAlign, size]);
3700
3732
  return /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)(
3701
3733
  "div",
3702
3734
  {
package/dist/index.mjs CHANGED
@@ -3618,8 +3618,19 @@ function Tooltip({
3618
3618
  if (isDisabledHover) {
3619
3619
  return;
3620
3620
  }
3621
+ if (targetRef.current !== null) {
3622
+ const dimensions = targetRef.current.getBoundingClientRect();
3623
+ const position = calculatePosition({
3624
+ dimensions,
3625
+ maxWidth,
3626
+ verticalPosition,
3627
+ horizontalAlign,
3628
+ tooltipSize: size
3629
+ });
3630
+ setTooltipPosition(position);
3631
+ }
3621
3632
  setIsVisible(true);
3622
- }, [isDisabledHover]);
3633
+ }, [isDisabledHover, calculatePosition, maxWidth, verticalPosition, horizontalAlign, size]);
3623
3634
  const handleMouseOutWrapper = useCallback14(() => {
3624
3635
  setIsVisible(false);
3625
3636
  }, []);
@@ -3629,6 +3640,27 @@ function Tooltip({
3629
3640
  const position = calculatePosition({ dimensions, maxWidth, verticalPosition, horizontalAlign, tooltipSize: size });
3630
3641
  setTooltipPosition(position);
3631
3642
  }, [calculatePosition, horizontalAlign, maxWidth, size, verticalPosition]);
3643
+ useEffect9(() => {
3644
+ if (!isVisible) return;
3645
+ const updatePosition = () => {
3646
+ if (targetRef.current === null) return;
3647
+ const dimensions = targetRef.current.getBoundingClientRect();
3648
+ const position = calculatePosition({
3649
+ dimensions,
3650
+ maxWidth,
3651
+ verticalPosition,
3652
+ horizontalAlign,
3653
+ tooltipSize: size
3654
+ });
3655
+ setTooltipPosition(position);
3656
+ };
3657
+ window.addEventListener("scroll", updatePosition, { capture: true, passive: true });
3658
+ window.addEventListener("resize", updatePosition, { passive: true });
3659
+ return () => {
3660
+ window.removeEventListener("scroll", updatePosition, { capture: true });
3661
+ window.removeEventListener("resize", updatePosition);
3662
+ };
3663
+ }, [isVisible, calculatePosition, maxWidth, verticalPosition, horizontalAlign, size]);
3632
3664
  return /* @__PURE__ */ jsxs33(
3633
3665
  "div",
3634
3666
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zenkigen-inc/component-ui",
3
- "version": "1.20.1",
3
+ "version": "1.20.3",
4
4
  "repository": "https://github.com/zenkigen/zenkigen-component",
5
5
  "license": "MIT",
6
6
  "publishConfig": {
@@ -38,9 +38,9 @@
38
38
  },
39
39
  "dependencies": {
40
40
  "@floating-ui/react": "0.27.19",
41
- "@zenkigen-inc/component-config": "1.20.1",
42
- "@zenkigen-inc/component-icons": "1.20.1",
43
- "@zenkigen-inc/component-theme": "1.20.1",
41
+ "@zenkigen-inc/component-config": "1.20.3",
42
+ "@zenkigen-inc/component-icons": "1.20.3",
43
+ "@zenkigen-inc/component-theme": "1.20.3",
44
44
  "clsx": "2.1.1",
45
45
  "react-day-picker": "9.14.0"
46
46
  }