@mediaradar/design-components 0.54.0 → 0.54.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.
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.54.0",
2
+ "version": "0.54.1",
3
3
  "components": [
4
4
  "AISpark",
5
5
  "AdvertiserNoResults",
package/dist/index.cjs CHANGED
@@ -5023,6 +5023,7 @@ var WIDTH = {
5023
5023
  // own tabs, a grid of events. 880 squeezed their tables into scrolling.
5024
5024
  xl: "max-w-300"
5025
5025
  };
5026
+ var EXIT_MS = 200;
5026
5027
  var FOCUSABLE = 'a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';
5027
5028
  function Modal({ open, onClose, title, description, size = "md", footer, children, className, testIdPrefix }) {
5028
5029
  const titleId = (0, import_react25.useId)();
@@ -5030,8 +5031,20 @@ function Modal({ open, onClose, title, description, size = "md", footer, childre
5030
5031
  const panel = (0, import_react25.useRef)(null);
5031
5032
  const close = (0, import_react25.useRef)(onClose);
5032
5033
  close.current = onClose;
5034
+ const [mounted, setMounted] = (0, import_react25.useState)(open);
5035
+ const [shown, setShown] = (0, import_react25.useState)(false);
5033
5036
  (0, import_react25.useEffect)(() => {
5034
- if (!open) return;
5037
+ if (open) {
5038
+ setMounted(true);
5039
+ const raf = requestAnimationFrame(() => requestAnimationFrame(() => setShown(true)));
5040
+ return () => cancelAnimationFrame(raf);
5041
+ }
5042
+ setShown(false);
5043
+ const t = setTimeout(() => setMounted(false), EXIT_MS);
5044
+ return () => clearTimeout(t);
5045
+ }, [open]);
5046
+ (0, import_react25.useEffect)(() => {
5047
+ if (!open || !mounted) return;
5035
5048
  const opener = document.activeElement;
5036
5049
  const firstIn = (region) => panel.current?.querySelector(region)?.querySelector(FOCUSABLE) ?? null;
5037
5050
  const first = firstIn("[data-modal-body]") ?? firstIn("[data-modal-footer]");
@@ -5062,13 +5075,16 @@ function Modal({ open, onClose, title, description, size = "md", footer, childre
5062
5075
  document.body.style.overflow = overflow;
5063
5076
  opener?.focus?.();
5064
5077
  };
5065
- }, [open]);
5066
- if (!open || typeof document === "undefined") return null;
5078
+ }, [open, mounted]);
5079
+ if (!mounted || typeof document === "undefined") return null;
5067
5080
  return (0, import_react_dom7.createPortal)(
5068
5081
  /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
5069
5082
  "div",
5070
5083
  {
5071
- className: "fixed inset-0 z-modal flex items-center justify-center bg-scrim px-4 py-6",
5084
+ className: cn(
5085
+ "fixed inset-0 z-modal flex items-center justify-center bg-scrim px-4 py-6 transition-opacity duration-(--mr-motion-duration-interactive) ease-interactive motion-reduce:transition-none",
5086
+ shown ? "opacity-100" : "opacity-0"
5087
+ ),
5072
5088
  onMouseDown: (e) => e.target === e.currentTarget && onClose(),
5073
5089
  children: /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(
5074
5090
  "div",
@@ -5081,12 +5097,14 @@ function Modal({ open, onClose, title, description, size = "md", footer, childre
5081
5097
  "aria-describedby": description ? descId : void 0,
5082
5098
  tabIndex: -1,
5083
5099
  className: cn(
5084
- "flex max-h-full w-full flex-col rounded-card border border-border-default bg-surface shadow-overlay outline-hidden",
5100
+ "flex max-h-full w-full flex-col rounded-card border border-border-default bg-surface shadow-overlay outline-hidden transition-transform duration-(--mr-motion-duration-interactive) ease-interactive motion-reduce:transition-none",
5101
+ // Settles in from 98%; the scrim's opacity carries the panel's fade.
5102
+ shown ? "scale-100" : "scale-98",
5085
5103
  WIDTH[size],
5086
5104
  className
5087
5105
  ),
5088
5106
  children: [
5089
- /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: "flex items-start gap-3 px-5 pt-5 pb-3", children: [
5107
+ /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: "flex items-start gap-3 px-5 pt-5 pb-2", children: [
5090
5108
  /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: "min-w-0 flex-1", children: [
5091
5109
  /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("h2", { id: titleId, className: "text-base font-semibold text-text-primary", children: title }),
5092
5110
  description && /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("p", { id: descId, className: "mt-0.5 text-sm text-text-secondary", children: description })
@@ -5102,7 +5120,7 @@ function Modal({ open, onClose, title, description, size = "md", footer, childre
5102
5120
  }
5103
5121
  )
5104
5122
  ] }),
5105
- children && /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("div", { "data-modal-body": true, className: "min-h-0 flex-1 overflow-y-auto px-5 pb-5 text-sm text-text-primary", children }),
5123
+ children && /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("div", { "data-modal-body": true, className: "min-h-0 flex-1 overflow-y-auto px-5 pt-1 pb-5 text-sm text-text-primary", children }),
5106
5124
  footer && /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("div", { "data-modal-footer": true, className: "flex items-center justify-end gap-2 border-t border-border-default px-5 py-3", children: footer })
5107
5125
  ]
5108
5126
  }
@@ -5200,7 +5218,7 @@ var WIDTH2 = {
5200
5218
  md: "max-w-160",
5201
5219
  lg: "max-w-230"
5202
5220
  };
5203
- var EXIT_MS = 200;
5221
+ var EXIT_MS2 = 200;
5204
5222
  var FOCUSABLE2 = 'a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';
5205
5223
  function Drawer({ open, onClose, title, description, size = "sm", footer, children, className, testIdPrefix }) {
5206
5224
  const titleId = (0, import_react27.useId)();
@@ -5217,7 +5235,7 @@ function Drawer({ open, onClose, title, description, size = "sm", footer, childr
5217
5235
  return () => cancelAnimationFrame(raf);
5218
5236
  }
5219
5237
  setShown(false);
5220
- const t = setTimeout(() => setMounted(false), EXIT_MS);
5238
+ const t = setTimeout(() => setMounted(false), EXIT_MS2);
5221
5239
  return () => clearTimeout(t);
5222
5240
  }, [open]);
5223
5241
  (0, import_react27.useEffect)(() => {
@@ -5287,7 +5305,7 @@ function Drawer({ open, onClose, title, description, size = "sm", footer, childr
5287
5305
  className
5288
5306
  ),
5289
5307
  children: [
5290
- /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("div", { className: "flex items-start gap-3 px-5 pt-5 pb-3", children: [
5308
+ /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("div", { className: "flex items-start gap-3 px-5 pt-5 pb-2", children: [
5291
5309
  /* @__PURE__ */ (0, import_jsx_runtime52.jsxs)("div", { className: "min-w-0 flex-1", children: [
5292
5310
  /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("h2", { id: titleId, className: "text-base font-semibold text-text-primary", children: title }),
5293
5311
  description && /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("p", { id: descId, className: "mt-0.5 text-sm text-text-secondary", children: description })
@@ -5303,7 +5321,7 @@ function Drawer({ open, onClose, title, description, size = "sm", footer, childr
5303
5321
  }
5304
5322
  )
5305
5323
  ] }),
5306
- /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("div", { "data-drawer-body": true, className: "min-h-0 flex-1 overflow-y-auto px-5 pb-5 text-sm text-text-primary", children }),
5324
+ /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("div", { "data-drawer-body": true, className: "min-h-0 flex-1 overflow-y-auto px-5 pt-1 pb-5 text-sm text-text-primary", children }),
5307
5325
  footer && /* @__PURE__ */ (0, import_jsx_runtime52.jsx)("div", { "data-drawer-footer": true, className: "flex items-center justify-end gap-2 border-t border-border-default px-5 py-3", children: footer })
5308
5326
  ]
5309
5327
  }