@zenkigen-inc/component-ui 1.20.0 → 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
@@ -907,11 +907,10 @@ var DatePicker = ({
907
907
  setIsOpen(false);
908
908
  };
909
909
  const handleSelect = (selected) => {
910
- if (!selected) {
911
- return;
910
+ if (selected != null) {
911
+ const selectedKey2 = formatLocalDateKey(selected);
912
+ onChange(createDateFromKey(selectedKey2, timeZone));
912
913
  }
913
- const selectedKey2 = formatLocalDateKey(selected);
914
- onChange(createDateFromKey(selectedKey2, timeZone));
915
914
  setIsOpen(false);
916
915
  };
917
916
  const handleClear = () => {
@@ -3687,8 +3686,19 @@ function Tooltip({
3687
3686
  if (isDisabledHover) {
3688
3687
  return;
3689
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
+ }
3690
3700
  setIsVisible(true);
3691
- }, [isDisabledHover]);
3701
+ }, [isDisabledHover, calculatePosition, maxWidth, verticalPosition, horizontalAlign, size]);
3692
3702
  const handleMouseOutWrapper = (0, import_react53.useCallback)(() => {
3693
3703
  setIsVisible(false);
3694
3704
  }, []);
@@ -3698,6 +3708,27 @@ function Tooltip({
3698
3708
  const position = calculatePosition({ dimensions, maxWidth, verticalPosition, horizontalAlign, tooltipSize: size });
3699
3709
  setTooltipPosition(position);
3700
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]);
3701
3732
  return /* @__PURE__ */ (0, import_jsx_runtime67.jsxs)(
3702
3733
  "div",
3703
3734
  {
package/dist/index.mjs CHANGED
@@ -839,11 +839,10 @@ var DatePicker = ({
839
839
  setIsOpen(false);
840
840
  };
841
841
  const handleSelect = (selected) => {
842
- if (!selected) {
843
- return;
842
+ if (selected != null) {
843
+ const selectedKey2 = formatLocalDateKey(selected);
844
+ onChange(createDateFromKey(selectedKey2, timeZone));
844
845
  }
845
- const selectedKey2 = formatLocalDateKey(selected);
846
- onChange(createDateFromKey(selectedKey2, timeZone));
847
846
  setIsOpen(false);
848
847
  };
849
848
  const handleClear = () => {
@@ -3619,8 +3618,19 @@ function Tooltip({
3619
3618
  if (isDisabledHover) {
3620
3619
  return;
3621
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
+ }
3622
3632
  setIsVisible(true);
3623
- }, [isDisabledHover]);
3633
+ }, [isDisabledHover, calculatePosition, maxWidth, verticalPosition, horizontalAlign, size]);
3624
3634
  const handleMouseOutWrapper = useCallback14(() => {
3625
3635
  setIsVisible(false);
3626
3636
  }, []);
@@ -3630,6 +3640,27 @@ function Tooltip({
3630
3640
  const position = calculatePosition({ dimensions, maxWidth, verticalPosition, horizontalAlign, tooltipSize: size });
3631
3641
  setTooltipPosition(position);
3632
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]);
3633
3664
  return /* @__PURE__ */ jsxs33(
3634
3665
  "div",
3635
3666
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zenkigen-inc/component-ui",
3
- "version": "1.20.0",
3
+ "version": "1.20.3",
4
4
  "repository": "https://github.com/zenkigen/zenkigen-component",
5
5
  "license": "MIT",
6
6
  "publishConfig": {
@@ -25,23 +25,23 @@
25
25
  "test:ci": "vitest run"
26
26
  },
27
27
  "devDependencies": {
28
- "@testing-library/jest-dom": "6.4.0",
29
- "@testing-library/react": "16.3.0",
28
+ "@testing-library/jest-dom": "6.9.1",
29
+ "@testing-library/react": "16.3.2",
30
30
  "@testing-library/user-event": "14.6.1",
31
31
  "hygen": "6.2.11",
32
- "tsup": "8.5.0",
33
- "typescript": "5.8.3"
32
+ "tsup": "8.5.1",
33
+ "typescript": "5.9.3"
34
34
  },
35
35
  "peerDependencies": {
36
36
  "react": "^18.0.0 || ^19.0.0",
37
37
  "react-dom": "^18.0.0 || ^19.0.0"
38
38
  },
39
39
  "dependencies": {
40
- "@floating-ui/react": "0.27.16",
41
- "@zenkigen-inc/component-config": "1.20.0",
42
- "@zenkigen-inc/component-icons": "1.20.0",
43
- "@zenkigen-inc/component-theme": "1.20.0",
40
+ "@floating-ui/react": "0.27.19",
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
- "react-day-picker": "9.13.0"
45
+ "react-day-picker": "9.14.0"
46
46
  }
47
47
  }