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.js CHANGED
@@ -5301,6 +5301,16 @@ var SCircleProgress = /* @__PURE__ */ forwardRef(
5301
5301
  );
5302
5302
  }
5303
5303
  );
5304
+
5305
+ // src/lib/global-overlay.ts
5306
+ var GLOBAL_OVERLAY_ATTR = "data-s-global-overlay";
5307
+ var globalOverlayProps = { [GLOBAL_OVERLAY_ATTR]: "" };
5308
+ function isFromGlobalOverlay(event) {
5309
+ const detail = event.detail;
5310
+ const target = detail?.originalEvent?.target ?? event.target;
5311
+ const element = target instanceof Element ? target : target instanceof Node ? target.parentElement : null;
5312
+ return !!element?.closest(`[${GLOBAL_OVERLAY_ATTR}]`);
5313
+ }
5304
5314
  var SLoadingContainer = /* @__PURE__ */ forwardRef(
5305
5315
  function SLoadingContainer2({ open = false, message, zIndex = Z_INDEX.loading, className, style }, ref) {
5306
5316
  const [mounted2, setMounted] = useState(false);
@@ -5337,6 +5347,7 @@ var SLoadingContainer = /* @__PURE__ */ forwardRef(
5337
5347
  "div",
5338
5348
  {
5339
5349
  ref: setRef,
5350
+ ...globalOverlayProps,
5340
5351
  "aria-hidden": !open,
5341
5352
  className: cn(
5342
5353
  "fixed inset-0 flex items-center justify-center transition-opacity duration-200",
@@ -5544,6 +5555,7 @@ var SDropdownButtonImpl = /* @__PURE__ */ forwardRef(
5544
5555
  style
5545
5556
  }, ref) {
5546
5557
  const portalContainer = usePortalContainer();
5558
+ const insideModal = useInsideModal();
5547
5559
  const [open, setOpen] = useState(false);
5548
5560
  const splitWrapRef = useRef(null);
5549
5561
  const splitToggleRef = useRef(null);
@@ -5632,6 +5644,7 @@ var SDropdownButtonImpl = /* @__PURE__ */ forwardRef(
5632
5644
  return /* @__PURE__ */ jsxs(
5633
5645
  RDropdown.Root,
5634
5646
  {
5647
+ modal: !insideModal,
5635
5648
  open,
5636
5649
  onOpenChange: (o) => {
5637
5650
  setOpen(o);
@@ -6066,6 +6079,7 @@ function SGuide({
6066
6079
  style
6067
6080
  }) {
6068
6081
  const [open, setOpen] = useState(false);
6082
+ const portalContainer = usePortalContainer();
6069
6083
  const isNotion = type === "notion";
6070
6084
  const defaultLabel = DEFAULT_LABEL[type];
6071
6085
  const iconName = ICON[type];
@@ -6100,7 +6114,7 @@ function SGuide({
6100
6114
  return /* @__PURE__ */ jsx("span", { className, style, children: trigger });
6101
6115
  return /* @__PURE__ */ jsxs(RPopover2.Root, { open, onOpenChange: setOpen, children: [
6102
6116
  /* @__PURE__ */ jsx(RPopover2.Trigger, { asChild: true, children: trigger }),
6103
- /* @__PURE__ */ jsx(RPopover2.Portal, { children: /* @__PURE__ */ jsxs(
6117
+ /* @__PURE__ */ jsx(RPopover2.Portal, { container: portalContainer, children: /* @__PURE__ */ jsxs(
6104
6118
  RPopover2.Content,
6105
6119
  {
6106
6120
  side: "bottom",
@@ -6241,6 +6255,13 @@ function SModalContainer({
6241
6255
  e.preventDefault();
6242
6256
  if (stackRegistrationRef.current?.isTop()) triggerShake();
6243
6257
  } : void 0;
6258
+ const guardInteractOutside = (e) => {
6259
+ if (isFromGlobalOverlay(e)) {
6260
+ e.preventDefault();
6261
+ return;
6262
+ }
6263
+ guardClose?.(e);
6264
+ };
6244
6265
  return /* @__PURE__ */ jsx(RDialog.Root, { open, onOpenChange, children: /* @__PURE__ */ jsx(RDialog.Portal, { container: modalHost, forceMount: rendered ? true : void 0, children: /* @__PURE__ */ jsxs("div", { className: "pointer-events-none absolute inset-0", style: { zIndex: layerIndex ?? 0 }, children: [
6245
6266
  /* @__PURE__ */ jsx(
6246
6267
  RDialog.Overlay,
@@ -6267,8 +6288,8 @@ function SModalContainer({
6267
6288
  contentRef.current?.focus({ preventScroll: true });
6268
6289
  },
6269
6290
  onEscapeKeyDown: guardClose,
6270
- onPointerDownOutside: guardClose,
6271
- onInteractOutside: guardClose,
6291
+ onPointerDownOutside: guardInteractOutside,
6292
+ onInteractOutside: guardInteractOutside,
6272
6293
  children: [
6273
6294
  /* @__PURE__ */ jsx(RDialog.Title, { className: "sr-only", children: ariaTitle }),
6274
6295
  /* @__PURE__ */ jsxs(
@@ -6630,6 +6651,13 @@ function SDrawer({
6630
6651
  event.preventDefault();
6631
6652
  if (stackRegistrationRef.current?.isTop()) triggerShake();
6632
6653
  } : void 0;
6654
+ const guardInteractOutside = (e) => {
6655
+ if (isFromGlobalOverlay(e)) {
6656
+ e.preventDefault();
6657
+ return;
6658
+ }
6659
+ guardClose?.(e);
6660
+ };
6633
6661
  const handleBackdropInteraction = () => {
6634
6662
  if (persistent) {
6635
6663
  if (stackRegistrationRef.current?.isTop()) triggerShake();
@@ -6672,8 +6700,8 @@ function SDrawer({
6672
6700
  contentRef.current?.focus({ preventScroll: true });
6673
6701
  },
6674
6702
  onEscapeKeyDown: guardClose,
6675
- onPointerDownOutside: guardClose,
6676
- onInteractOutside: guardClose,
6703
+ onPointerDownOutside: guardInteractOutside,
6704
+ onInteractOutside: guardInteractOutside,
6677
6705
  children: [
6678
6706
  /* @__PURE__ */ jsx(RDialog.Title, { className: "sr-only", children: title || "Drawer" }),
6679
6707
  /* @__PURE__ */ jsxs(
@@ -11949,6 +11977,7 @@ var SToastContainer = /* @__PURE__ */ forwardRef(
11949
11977
  /* @__PURE__ */ jsx(
11950
11978
  "div",
11951
11979
  {
11980
+ ...globalOverlayProps,
11952
11981
  style: {
11953
11982
  position: "fixed",
11954
11983
  zIndex,