@caratlogic/design-system 0.1.6 → 0.1.7

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.
@@ -1 +1 @@
1
- {"version":3,"file":"ConfirmDialog.d.ts","sourceRoot":"","sources":["../../../../src/components/molecules/ConfirmDialog/ConfirmDialog.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAa1B,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAEhE,QAAA,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CAoE/C,CAAC;AAEF,OAAO,EAAE,aAAa,EAAE,CAAC"}
1
+ {"version":3,"file":"ConfirmDialog.d.ts","sourceRoot":"","sources":["../../../../src/components/molecules/ConfirmDialog/ConfirmDialog.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAc1B,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAEhE,QAAA,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CAuE/C,CAAC;AAEF,OAAO,EAAE,aAAa,EAAE,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"Modal.d.ts","sourceRoot":"","sources":["../../../../src/components/molecules/Modal/Modal.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,UAAU,EAAa,MAAM,eAAe,CAAC;AAE3D,YAAY,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAS3D;;;;GAIG;AACH,wBAAgB,KAAK,CAAC,EACpB,IAAI,EACJ,OAAO,EACP,KAAK,EACL,IAAI,EACJ,QAAQ,EACR,MAAM,EACN,IAAW,EACX,eAAuB,EACvB,SAAS,EACT,aAAa,GACd,EAAE,UAAU,2CA4CZ"}
1
+ {"version":3,"file":"Modal.d.ts","sourceRoot":"","sources":["../../../../src/components/molecules/Modal/Modal.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,UAAU,EAAa,MAAM,eAAe,CAAC;AAE3D,YAAY,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAS3D;;;;GAIG;AACH,wBAAgB,KAAK,CAAC,EACpB,IAAI,EACJ,OAAO,EACP,KAAK,EACL,IAAI,EACJ,QAAQ,EACR,MAAM,EACN,IAAW,EACX,eAAuB,EACvB,SAAS,EACT,aAAa,GACd,EAAE,UAAU,2CA8CZ"}
package/dist/index.cjs.js CHANGED
@@ -4375,13 +4375,19 @@ const notify = {
4375
4375
  promise: sonner.toast.promise.bind(sonner.toast),
4376
4376
  };
4377
4377
 
4378
+ /**
4379
+ * Only overlays that actually lock `<body>` count. `[data-radix-popper-content-wrapper]`
4380
+ * is deliberately absent: a tooltip renders into one, so including it made an
4381
+ * open tooltip — say, on the Edit button you just clicked — look like a live
4382
+ * modal and suppress the release, leaving the page unclickable. Modal poppers
4383
+ * (menus, selects) still match through their roles.
4384
+ */
4378
4385
  const OVERLAY_CONTENT_SELECTOR = [
4379
4386
  '[data-slot="dialog-content"]',
4380
4387
  '[role="dialog"]',
4381
4388
  '[role="alertdialog"]',
4382
4389
  '[role="menu"]',
4383
4390
  '[role="listbox"]',
4384
- '[data-radix-popper-content-wrapper]',
4385
4391
  ].join(',');
4386
4392
  /**
4387
4393
  * `@radix-ui/react-dismissable-layer` keeps the value it must restore to
@@ -4393,6 +4399,36 @@ const OVERLAY_CONTENT_SELECTOR = [
4393
4399
  * Clearing is only safe once nothing is on screen, so this is a no-op while any
4394
4400
  * overlay content is still mounted.
4395
4401
  */
4402
+ /**
4403
+ * Watches `<body>` and clears a lock that outlives every overlay.
4404
+ *
4405
+ * The per-overlay hooks handle the normal close path; this is the backstop for
4406
+ * the ones they cannot see — an overlay unmounted by a route change, a layer
4407
+ * combination nobody anticipated, a third-party popup. Returns a disposer.
4408
+ *
4409
+ * Cheap: an attribute-scoped MutationObserver that only reacts when something
4410
+ * actually writes `style` or `data-scroll-locked` on `<body>`.
4411
+ */
4412
+ function watchOverlayBodyLock() {
4413
+ if (typeof document === 'undefined')
4414
+ return () => { };
4415
+ let timer;
4416
+ const check = () => {
4417
+ window.clearTimeout(timer);
4418
+ // Outlive the exit animation, so a legitimately-open overlay is still
4419
+ // mounted when `releaseStaleOverlayBodyLock` looks for it.
4420
+ timer = window.setTimeout(() => releaseStaleOverlayBodyLock(), 500);
4421
+ };
4422
+ const observer = new MutationObserver(check);
4423
+ observer.observe(document.body, {
4424
+ attributes: true,
4425
+ attributeFilter: ['style', 'data-scroll-locked'],
4426
+ });
4427
+ return () => {
4428
+ window.clearTimeout(timer);
4429
+ observer.disconnect();
4430
+ };
4431
+ }
4396
4432
  function releaseStaleOverlayBodyLock() {
4397
4433
  if (typeof document === 'undefined')
4398
4434
  return;
@@ -12123,6 +12159,9 @@ function useRefundToWallet(open) {
12123
12159
 
12124
12160
  const ConfirmDialog = ({ open, onOpenChange, title, description, info, confirmLabel = 'Yes', cancelLabel = 'Cancel', confirmVariant = 'default', icon: Icon = Trash2, disabled = false, onConfirm, onCancel, }) => {
12125
12161
  const { refundToWallet, setRefundToWallet } = useRefundToWallet(open);
12162
+ // Opened from a modal menu row, two dismissable layers overlap and Radix
12163
+ // restores `pointer-events: none` to <body> on close, freezing the page.
12164
+ useOverlayBodyLockRelease(open);
12126
12165
  return (jsxRuntime.jsx(Dialog, { open: open, onOpenChange: onOpenChange, children: jsxRuntime.jsxs(DialogContent, { className: "gap-3 p-5", children: [jsxRuntime.jsxs(DialogHeader, { className: "gap-1.5", children: [jsxRuntime.jsxs(DialogTitle, { className: "flex items-center gap-2", children: [confirmVariant === 'destructive' && (jsxRuntime.jsx("span", { className: "inline-flex h-7 w-7 shrink-0 items-center justify-center rounded-full bg-destructive/10", children: jsxRuntime.jsx(Icon, { className: "h-3.5 w-3.5 text-destructive" }) })), jsxRuntime.jsx("span", { children: title })] }), description && jsxRuntime.jsx(DialogDescription, { children: description }), info && (jsxRuntime.jsx(InfoCard, { info: info, title: title, refundToWallet: refundToWallet, onRefundChange: setRefundToWallet }))] }), jsxRuntime.jsxs(DialogFooter, { className: "mt-1", children: [jsxRuntime.jsx(Button$1, { variant: "outline", onClick: () => {
12127
12166
  onCancel?.();
12128
12167
  onOpenChange(false);
@@ -28606,6 +28645,8 @@ const SIZE_WIDTH = {
28606
28645
  */
28607
28646
  function Modal({ open, onClose, title, icon, children, footer, size = 'md', hideCloseButton = false, className, bodyClassName, }) {
28608
28647
  const maxWidth = SIZE_WIDTH[size];
28648
+ // See ConfirmDialog: overlapping dismissable layers leak the <body> lock.
28649
+ useOverlayBodyLockRelease(open);
28609
28650
  return (jsxRuntime.jsx(Dialog, { open: open, onOpenChange: (o) => !o && onClose(), children: jsxRuntime.jsxs(DialogContent, { hideCloseButton: true, style: {
28610
28651
  width: `min(${maxWidth}px, calc(100vw - 2rem))`,
28611
28652
  maxWidth: `${maxWidth}px`,
@@ -68044,4 +68085,5 @@ exports.useDropdownMenu = useDropdownMenu;
68044
68085
  exports.useNavbar = useNavbar;
68045
68086
  exports.useSidebar = useSidebar;
68046
68087
  exports.videoThumbnailSrc = videoThumbnailSrc;
68088
+ exports.watchOverlayBodyLock = watchOverlayBodyLock;
68047
68089
  //# sourceMappingURL=index.cjs.js.map