@tapizlabs/ui 0.2.25 → 0.2.27

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
@@ -2777,6 +2777,31 @@ function Drawer({ open, onClose, title, description, children, footer, side = "r
2777
2777
  // src/components/overlays/SidePanel.tsx
2778
2778
  import { useEffect as useEffect4, useId as useId4, useState as useState10 } from "react";
2779
2779
  import { createPortal as createPortal5 } from "react-dom";
2780
+
2781
+ // src/components/overlays/scrollLock.ts
2782
+ var lockCount = 0;
2783
+ var originalHtmlOverflow = "";
2784
+ var originalBodyOverflow = "";
2785
+ function acquireBodyScrollLock() {
2786
+ if (lockCount === 0) {
2787
+ originalHtmlOverflow = document.documentElement.style.overflow;
2788
+ originalBodyOverflow = document.body.style.overflow;
2789
+ document.documentElement.style.overflow = "hidden";
2790
+ document.body.style.overflow = "hidden";
2791
+ }
2792
+ lockCount += 1;
2793
+ return () => {
2794
+ lockCount = Math.max(0, lockCount - 1);
2795
+ if (lockCount === 0) {
2796
+ document.documentElement.style.overflow = originalHtmlOverflow;
2797
+ document.body.style.overflow = originalBodyOverflow;
2798
+ originalHtmlOverflow = "";
2799
+ originalBodyOverflow = "";
2800
+ }
2801
+ };
2802
+ }
2803
+
2804
+ // src/components/overlays/SidePanel.tsx
2780
2805
  import { jsx as jsx66, jsxs as jsxs47 } from "react/jsx-runtime";
2781
2806
  var widthRem = {
2782
2807
  md: 28,
@@ -2835,17 +2860,13 @@ function SidePanel({
2835
2860
  }, []);
2836
2861
  useEffect4(() => {
2837
2862
  if (!isOpen) return;
2838
- const html = document.documentElement.style.overflow;
2839
- const body = document.body.style.overflow;
2840
- document.documentElement.style.overflow = "hidden";
2841
- document.body.style.overflow = "hidden";
2863
+ const releaseBodyScrollLock = acquireBodyScrollLock();
2842
2864
  const onKeyDown = (e) => {
2843
2865
  if (e.key === "Escape") onClose();
2844
2866
  };
2845
2867
  document.addEventListener("keydown", onKeyDown);
2846
2868
  return () => {
2847
- document.documentElement.style.overflow = html;
2848
- document.body.style.overflow = body;
2869
+ releaseBodyScrollLock();
2849
2870
  document.removeEventListener("keydown", onKeyDown);
2850
2871
  };
2851
2872
  }, [isOpen, onClose]);
@@ -2867,6 +2888,8 @@ function SidePanel({
2867
2888
  className: `fixed inset-0 z-50 flex bg-[rgba(5,6,8,0.75)] backdrop-blur-[2px] ${side === "right" ? "justify-end" : "justify-start"} ${shown ? "opacity-100" : "opacity-0"}`,
2868
2889
  style: { transition: reduceMotion ? "none" : `opacity ${TRANSITION_MS}ms ${TRANSITION_EASE}` },
2869
2890
  onClick: (e) => e.target === e.currentTarget && onClose(),
2891
+ onWheel: (e) => e.preventDefault(),
2892
+ onTouchMove: (e) => e.preventDefault(),
2870
2893
  children: /* @__PURE__ */ jsxs47(
2871
2894
  "div",
2872
2895
  {
@@ -2893,7 +2916,15 @@ function SidePanel({
2893
2916
  }
2894
2917
  )
2895
2918
  ] }),
2896
- /* @__PURE__ */ jsx66("div", { className: "min-h-0 flex-1 overflow-y-auto overscroll-contain px-4 py-4 sm:px-5", children }),
2919
+ /* @__PURE__ */ jsx66(
2920
+ "div",
2921
+ {
2922
+ className: "min-h-0 flex-1 overflow-y-auto overscroll-contain px-4 py-4 sm:px-5",
2923
+ onWheel: (e) => e.stopPropagation(),
2924
+ onTouchMove: (e) => e.stopPropagation(),
2925
+ children
2926
+ }
2927
+ ),
2897
2928
  footer && /* @__PURE__ */ jsx66("div", { className: "shrink-0 border-t border-border px-4 py-3 sm:px-5", children: footer })
2898
2929
  ]
2899
2930
  }