sellmate-design-system-react 4.3.0 → 4.3.1

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.cjs CHANGED
@@ -5329,6 +5329,16 @@ var SCircleProgress = /* @__PURE__ */ react.forwardRef(
5329
5329
  );
5330
5330
  }
5331
5331
  );
5332
+
5333
+ // src/lib/global-overlay.ts
5334
+ var GLOBAL_OVERLAY_ATTR = "data-s-global-overlay";
5335
+ var globalOverlayProps = { [GLOBAL_OVERLAY_ATTR]: "" };
5336
+ function isFromGlobalOverlay(event) {
5337
+ const detail = event.detail;
5338
+ const target = detail?.originalEvent?.target ?? event.target;
5339
+ const element = target instanceof Element ? target : target instanceof Node ? target.parentElement : null;
5340
+ return !!element?.closest(`[${GLOBAL_OVERLAY_ATTR}]`);
5341
+ }
5332
5342
  var SLoadingContainer = /* @__PURE__ */ react.forwardRef(
5333
5343
  function SLoadingContainer2({ open = false, message, zIndex = Z_INDEX.loading, className, style }, ref) {
5334
5344
  const [mounted2, setMounted] = react.useState(false);
@@ -5365,6 +5375,7 @@ var SLoadingContainer = /* @__PURE__ */ react.forwardRef(
5365
5375
  "div",
5366
5376
  {
5367
5377
  ref: setRef,
5378
+ ...globalOverlayProps,
5368
5379
  "aria-hidden": !open,
5369
5380
  className: cn(
5370
5381
  "fixed inset-0 flex items-center justify-center transition-opacity duration-200",
@@ -5572,6 +5583,7 @@ var SDropdownButtonImpl = /* @__PURE__ */ react.forwardRef(
5572
5583
  style
5573
5584
  }, ref) {
5574
5585
  const portalContainer = usePortalContainer();
5586
+ const insideModal = useInsideModal();
5575
5587
  const [open, setOpen] = react.useState(false);
5576
5588
  const splitWrapRef = react.useRef(null);
5577
5589
  const splitToggleRef = react.useRef(null);
@@ -5660,6 +5672,7 @@ var SDropdownButtonImpl = /* @__PURE__ */ react.forwardRef(
5660
5672
  return /* @__PURE__ */ jsxRuntime.jsxs(
5661
5673
  RDropdown__namespace.Root,
5662
5674
  {
5675
+ modal: !insideModal,
5663
5676
  open,
5664
5677
  onOpenChange: (o) => {
5665
5678
  setOpen(o);
@@ -6094,6 +6107,7 @@ function SGuide({
6094
6107
  style
6095
6108
  }) {
6096
6109
  const [open, setOpen] = react.useState(false);
6110
+ const portalContainer = usePortalContainer();
6097
6111
  const isNotion = type === "notion";
6098
6112
  const defaultLabel = DEFAULT_LABEL[type];
6099
6113
  const iconName = ICON[type];
@@ -6128,7 +6142,7 @@ function SGuide({
6128
6142
  return /* @__PURE__ */ jsxRuntime.jsx("span", { className, style, children: trigger });
6129
6143
  return /* @__PURE__ */ jsxRuntime.jsxs(RPopover2__namespace.Root, { open, onOpenChange: setOpen, children: [
6130
6144
  /* @__PURE__ */ jsxRuntime.jsx(RPopover2__namespace.Trigger, { asChild: true, children: trigger }),
6131
- /* @__PURE__ */ jsxRuntime.jsx(RPopover2__namespace.Portal, { children: /* @__PURE__ */ jsxRuntime.jsxs(
6145
+ /* @__PURE__ */ jsxRuntime.jsx(RPopover2__namespace.Portal, { container: portalContainer, children: /* @__PURE__ */ jsxRuntime.jsxs(
6132
6146
  RPopover2__namespace.Content,
6133
6147
  {
6134
6148
  side: "bottom",
@@ -6269,6 +6283,13 @@ function SModalContainer({
6269
6283
  e.preventDefault();
6270
6284
  if (stackRegistrationRef.current?.isTop()) triggerShake();
6271
6285
  } : void 0;
6286
+ const guardInteractOutside = (e) => {
6287
+ if (isFromGlobalOverlay(e)) {
6288
+ e.preventDefault();
6289
+ return;
6290
+ }
6291
+ guardClose?.(e);
6292
+ };
6272
6293
  return /* @__PURE__ */ jsxRuntime.jsx(RDialog__namespace.Root, { open, onOpenChange, children: /* @__PURE__ */ jsxRuntime.jsx(RDialog__namespace.Portal, { container: modalHost, forceMount: rendered ? true : void 0, children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "pointer-events-none absolute inset-0", style: { zIndex: layerIndex ?? 0 }, children: [
6273
6294
  /* @__PURE__ */ jsxRuntime.jsx(
6274
6295
  RDialog__namespace.Overlay,
@@ -6295,8 +6316,8 @@ function SModalContainer({
6295
6316
  contentRef.current?.focus({ preventScroll: true });
6296
6317
  },
6297
6318
  onEscapeKeyDown: guardClose,
6298
- onPointerDownOutside: guardClose,
6299
- onInteractOutside: guardClose,
6319
+ onPointerDownOutside: guardInteractOutside,
6320
+ onInteractOutside: guardInteractOutside,
6300
6321
  children: [
6301
6322
  /* @__PURE__ */ jsxRuntime.jsx(RDialog__namespace.Title, { className: "sr-only", children: ariaTitle }),
6302
6323
  /* @__PURE__ */ jsxRuntime.jsxs(
@@ -6658,6 +6679,13 @@ function SDrawer({
6658
6679
  event.preventDefault();
6659
6680
  if (stackRegistrationRef.current?.isTop()) triggerShake();
6660
6681
  } : void 0;
6682
+ const guardInteractOutside = (e) => {
6683
+ if (isFromGlobalOverlay(e)) {
6684
+ e.preventDefault();
6685
+ return;
6686
+ }
6687
+ guardClose?.(e);
6688
+ };
6661
6689
  const handleBackdropInteraction = () => {
6662
6690
  if (persistent) {
6663
6691
  if (stackRegistrationRef.current?.isTop()) triggerShake();
@@ -6700,8 +6728,8 @@ function SDrawer({
6700
6728
  contentRef.current?.focus({ preventScroll: true });
6701
6729
  },
6702
6730
  onEscapeKeyDown: guardClose,
6703
- onPointerDownOutside: guardClose,
6704
- onInteractOutside: guardClose,
6731
+ onPointerDownOutside: guardInteractOutside,
6732
+ onInteractOutside: guardInteractOutside,
6705
6733
  children: [
6706
6734
  /* @__PURE__ */ jsxRuntime.jsx(RDialog__namespace.Title, { className: "sr-only", children: title || "Drawer" }),
6707
6735
  /* @__PURE__ */ jsxRuntime.jsxs(
@@ -11977,6 +12005,7 @@ var SToastContainer = /* @__PURE__ */ react.forwardRef(
11977
12005
  /* @__PURE__ */ jsxRuntime.jsx(
11978
12006
  "div",
11979
12007
  {
12008
+ ...globalOverlayProps,
11980
12009
  style: {
11981
12010
  position: "fixed",
11982
12011
  zIndex,