@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.
- package/dist/approved-components.json +1 -1
- package/dist/index.cjs +29 -11
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +6 -2
- package/dist/index.d.ts +6 -2
- package/dist/index.js +40 -22
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -3127,13 +3127,17 @@ interface ModalProps extends CommonProps {
|
|
|
3127
3127
|
* @variant lg - 880px. A table, a long list, a preview.
|
|
3128
3128
|
* @variant xl - 1200px. A full workspace: a column picker, a detail view with
|
|
3129
3129
|
* its own tabs or panes, a grid.
|
|
3130
|
-
* @tokens bg-scrim, z-modal,
|
|
3130
|
+
* @tokens bg-scrim, z-modal, transition-opacity, transition-transform,
|
|
3131
|
+
* duration-(--mr-motion-duration-interactive), ease-interactive,
|
|
3132
|
+
* motion-reduce:transition-none, rounded-card, border-border-default, bg-surface,
|
|
3131
3133
|
* shadow-overlay, text-base, font-semibold, text-text-primary, text-sm,
|
|
3132
3134
|
* text-text-secondary, text-text-tertiary, hover:bg-subtle,
|
|
3133
3135
|
* hover:text-text-primary, rounded-control, border-t,
|
|
3134
3136
|
* focus-visible:outline-border-focus
|
|
3135
3137
|
* @dependencies lucide-react, react-dom
|
|
3136
|
-
* @behavior Portals to <body>.
|
|
3138
|
+
* @behavior Portals to <body>. Fades in over 200ms while the panel settles
|
|
3139
|
+
* from 98% to full size, and fades back out before it unmounts, as Drawer;
|
|
3140
|
+
* with reduced motion it appears and goes without moving. Escape, a click on the background and the ×
|
|
3137
3141
|
* all call `onClose`. Focus moves to the first field (else the first footer
|
|
3138
3142
|
* button) on open, Tab stays inside
|
|
3139
3143
|
* it, and focus goes back to whatever opened it on close. The page behind
|
package/dist/index.d.ts
CHANGED
|
@@ -3127,13 +3127,17 @@ interface ModalProps extends CommonProps {
|
|
|
3127
3127
|
* @variant lg - 880px. A table, a long list, a preview.
|
|
3128
3128
|
* @variant xl - 1200px. A full workspace: a column picker, a detail view with
|
|
3129
3129
|
* its own tabs or panes, a grid.
|
|
3130
|
-
* @tokens bg-scrim, z-modal,
|
|
3130
|
+
* @tokens bg-scrim, z-modal, transition-opacity, transition-transform,
|
|
3131
|
+
* duration-(--mr-motion-duration-interactive), ease-interactive,
|
|
3132
|
+
* motion-reduce:transition-none, rounded-card, border-border-default, bg-surface,
|
|
3131
3133
|
* shadow-overlay, text-base, font-semibold, text-text-primary, text-sm,
|
|
3132
3134
|
* text-text-secondary, text-text-tertiary, hover:bg-subtle,
|
|
3133
3135
|
* hover:text-text-primary, rounded-control, border-t,
|
|
3134
3136
|
* focus-visible:outline-border-focus
|
|
3135
3137
|
* @dependencies lucide-react, react-dom
|
|
3136
|
-
* @behavior Portals to <body>.
|
|
3138
|
+
* @behavior Portals to <body>. Fades in over 200ms while the panel settles
|
|
3139
|
+
* from 98% to full size, and fades back out before it unmounts, as Drawer;
|
|
3140
|
+
* with reduced motion it appears and goes without moving. Escape, a click on the background and the ×
|
|
3137
3141
|
* all call `onClose`. Focus moves to the first field (else the first footer
|
|
3138
3142
|
* button) on open, Tab stays inside
|
|
3139
3143
|
* it, and focus goes back to whatever opened it on close. The page behind
|
package/dist/index.js
CHANGED
|
@@ -4909,7 +4909,7 @@ function PageHeader({ title, description, actions, meta, back, className, testId
|
|
|
4909
4909
|
}
|
|
4910
4910
|
|
|
4911
4911
|
// src/Modal.tsx
|
|
4912
|
-
import { useEffect as useEffect14, useId as useId7, useRef as useRef16 } from "react";
|
|
4912
|
+
import { useEffect as useEffect14, useId as useId7, useRef as useRef16, useState as useState15 } from "react";
|
|
4913
4913
|
import { createPortal as createPortal7 } from "react-dom";
|
|
4914
4914
|
import { X as X6 } from "lucide-react";
|
|
4915
4915
|
import { jsx as jsx49, jsxs as jsxs43 } from "react/jsx-runtime";
|
|
@@ -4921,6 +4921,7 @@ var WIDTH = {
|
|
|
4921
4921
|
// own tabs, a grid of events. 880 squeezed their tables into scrolling.
|
|
4922
4922
|
xl: "max-w-300"
|
|
4923
4923
|
};
|
|
4924
|
+
var EXIT_MS = 200;
|
|
4924
4925
|
var FOCUSABLE = 'a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';
|
|
4925
4926
|
function Modal({ open, onClose, title, description, size = "md", footer, children, className, testIdPrefix }) {
|
|
4926
4927
|
const titleId = useId7();
|
|
@@ -4928,8 +4929,20 @@ function Modal({ open, onClose, title, description, size = "md", footer, childre
|
|
|
4928
4929
|
const panel = useRef16(null);
|
|
4929
4930
|
const close = useRef16(onClose);
|
|
4930
4931
|
close.current = onClose;
|
|
4932
|
+
const [mounted, setMounted] = useState15(open);
|
|
4933
|
+
const [shown, setShown] = useState15(false);
|
|
4931
4934
|
useEffect14(() => {
|
|
4932
|
-
if (
|
|
4935
|
+
if (open) {
|
|
4936
|
+
setMounted(true);
|
|
4937
|
+
const raf = requestAnimationFrame(() => requestAnimationFrame(() => setShown(true)));
|
|
4938
|
+
return () => cancelAnimationFrame(raf);
|
|
4939
|
+
}
|
|
4940
|
+
setShown(false);
|
|
4941
|
+
const t = setTimeout(() => setMounted(false), EXIT_MS);
|
|
4942
|
+
return () => clearTimeout(t);
|
|
4943
|
+
}, [open]);
|
|
4944
|
+
useEffect14(() => {
|
|
4945
|
+
if (!open || !mounted) return;
|
|
4933
4946
|
const opener = document.activeElement;
|
|
4934
4947
|
const firstIn = (region) => panel.current?.querySelector(region)?.querySelector(FOCUSABLE) ?? null;
|
|
4935
4948
|
const first = firstIn("[data-modal-body]") ?? firstIn("[data-modal-footer]");
|
|
@@ -4960,13 +4973,16 @@ function Modal({ open, onClose, title, description, size = "md", footer, childre
|
|
|
4960
4973
|
document.body.style.overflow = overflow;
|
|
4961
4974
|
opener?.focus?.();
|
|
4962
4975
|
};
|
|
4963
|
-
}, [open]);
|
|
4964
|
-
if (!
|
|
4976
|
+
}, [open, mounted]);
|
|
4977
|
+
if (!mounted || typeof document === "undefined") return null;
|
|
4965
4978
|
return createPortal7(
|
|
4966
4979
|
/* @__PURE__ */ jsx49(
|
|
4967
4980
|
"div",
|
|
4968
4981
|
{
|
|
4969
|
-
className:
|
|
4982
|
+
className: cn(
|
|
4983
|
+
"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",
|
|
4984
|
+
shown ? "opacity-100" : "opacity-0"
|
|
4985
|
+
),
|
|
4970
4986
|
onMouseDown: (e) => e.target === e.currentTarget && onClose(),
|
|
4971
4987
|
children: /* @__PURE__ */ jsxs43(
|
|
4972
4988
|
"div",
|
|
@@ -4979,12 +4995,14 @@ function Modal({ open, onClose, title, description, size = "md", footer, childre
|
|
|
4979
4995
|
"aria-describedby": description ? descId : void 0,
|
|
4980
4996
|
tabIndex: -1,
|
|
4981
4997
|
className: cn(
|
|
4982
|
-
"flex max-h-full w-full flex-col rounded-card border border-border-default bg-surface shadow-overlay outline-hidden",
|
|
4998
|
+
"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",
|
|
4999
|
+
// Settles in from 98%; the scrim's opacity carries the panel's fade.
|
|
5000
|
+
shown ? "scale-100" : "scale-98",
|
|
4983
5001
|
WIDTH[size],
|
|
4984
5002
|
className
|
|
4985
5003
|
),
|
|
4986
5004
|
children: [
|
|
4987
|
-
/* @__PURE__ */ jsxs43("div", { className: "flex items-start gap-3 px-5 pt-5 pb-
|
|
5005
|
+
/* @__PURE__ */ jsxs43("div", { className: "flex items-start gap-3 px-5 pt-5 pb-2", children: [
|
|
4988
5006
|
/* @__PURE__ */ jsxs43("div", { className: "min-w-0 flex-1", children: [
|
|
4989
5007
|
/* @__PURE__ */ jsx49("h2", { id: titleId, className: "text-base font-semibold text-text-primary", children: title }),
|
|
4990
5008
|
description && /* @__PURE__ */ jsx49("p", { id: descId, className: "mt-0.5 text-sm text-text-secondary", children: description })
|
|
@@ -5000,7 +5018,7 @@ function Modal({ open, onClose, title, description, size = "md", footer, childre
|
|
|
5000
5018
|
}
|
|
5001
5019
|
)
|
|
5002
5020
|
] }),
|
|
5003
|
-
children && /* @__PURE__ */ jsx49("div", { "data-modal-body": true, className: "min-h-0 flex-1 overflow-y-auto px-5 pb-5 text-sm text-text-primary", children }),
|
|
5021
|
+
children && /* @__PURE__ */ jsx49("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 }),
|
|
5004
5022
|
footer && /* @__PURE__ */ jsx49("div", { "data-modal-footer": true, className: "flex items-center justify-end gap-2 border-t border-border-default px-5 py-3", children: footer })
|
|
5005
5023
|
]
|
|
5006
5024
|
}
|
|
@@ -5089,7 +5107,7 @@ var TextField = forwardRef9(
|
|
|
5089
5107
|
TextField.displayName = "TextField";
|
|
5090
5108
|
|
|
5091
5109
|
// src/Drawer.tsx
|
|
5092
|
-
import { useEffect as useEffect15, useId as useId9, useRef as useRef17, useState as
|
|
5110
|
+
import { useEffect as useEffect15, useId as useId9, useRef as useRef17, useState as useState16 } from "react";
|
|
5093
5111
|
import { createPortal as createPortal8 } from "react-dom";
|
|
5094
5112
|
import { X as X7 } from "lucide-react";
|
|
5095
5113
|
import { jsx as jsx52, jsxs as jsxs46 } from "react/jsx-runtime";
|
|
@@ -5098,7 +5116,7 @@ var WIDTH2 = {
|
|
|
5098
5116
|
md: "max-w-160",
|
|
5099
5117
|
lg: "max-w-230"
|
|
5100
5118
|
};
|
|
5101
|
-
var
|
|
5119
|
+
var EXIT_MS2 = 200;
|
|
5102
5120
|
var FOCUSABLE2 = 'a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';
|
|
5103
5121
|
function Drawer({ open, onClose, title, description, size = "sm", footer, children, className, testIdPrefix }) {
|
|
5104
5122
|
const titleId = useId9();
|
|
@@ -5106,8 +5124,8 @@ function Drawer({ open, onClose, title, description, size = "sm", footer, childr
|
|
|
5106
5124
|
const panel = useRef17(null);
|
|
5107
5125
|
const close = useRef17(onClose);
|
|
5108
5126
|
close.current = onClose;
|
|
5109
|
-
const [mounted, setMounted] =
|
|
5110
|
-
const [shown, setShown] =
|
|
5127
|
+
const [mounted, setMounted] = useState16(open);
|
|
5128
|
+
const [shown, setShown] = useState16(false);
|
|
5111
5129
|
useEffect15(() => {
|
|
5112
5130
|
if (open) {
|
|
5113
5131
|
setMounted(true);
|
|
@@ -5115,7 +5133,7 @@ function Drawer({ open, onClose, title, description, size = "sm", footer, childr
|
|
|
5115
5133
|
return () => cancelAnimationFrame(raf);
|
|
5116
5134
|
}
|
|
5117
5135
|
setShown(false);
|
|
5118
|
-
const t = setTimeout(() => setMounted(false),
|
|
5136
|
+
const t = setTimeout(() => setMounted(false), EXIT_MS2);
|
|
5119
5137
|
return () => clearTimeout(t);
|
|
5120
5138
|
}, [open]);
|
|
5121
5139
|
useEffect15(() => {
|
|
@@ -5185,7 +5203,7 @@ function Drawer({ open, onClose, title, description, size = "sm", footer, childr
|
|
|
5185
5203
|
className
|
|
5186
5204
|
),
|
|
5187
5205
|
children: [
|
|
5188
|
-
/* @__PURE__ */ jsxs46("div", { className: "flex items-start gap-3 px-5 pt-5 pb-
|
|
5206
|
+
/* @__PURE__ */ jsxs46("div", { className: "flex items-start gap-3 px-5 pt-5 pb-2", children: [
|
|
5189
5207
|
/* @__PURE__ */ jsxs46("div", { className: "min-w-0 flex-1", children: [
|
|
5190
5208
|
/* @__PURE__ */ jsx52("h2", { id: titleId, className: "text-base font-semibold text-text-primary", children: title }),
|
|
5191
5209
|
description && /* @__PURE__ */ jsx52("p", { id: descId, className: "mt-0.5 text-sm text-text-secondary", children: description })
|
|
@@ -5201,7 +5219,7 @@ function Drawer({ open, onClose, title, description, size = "sm", footer, childr
|
|
|
5201
5219
|
}
|
|
5202
5220
|
)
|
|
5203
5221
|
] }),
|
|
5204
|
-
/* @__PURE__ */ jsx52("div", { "data-drawer-body": true, className: "min-h-0 flex-1 overflow-y-auto px-5 pb-5 text-sm text-text-primary", children }),
|
|
5222
|
+
/* @__PURE__ */ jsx52("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 }),
|
|
5205
5223
|
footer && /* @__PURE__ */ jsx52("div", { "data-drawer-footer": true, className: "flex items-center justify-end gap-2 border-t border-border-default px-5 py-3", children: footer })
|
|
5206
5224
|
]
|
|
5207
5225
|
}
|
|
@@ -5391,12 +5409,12 @@ var ToggleChip = forwardRef11(function ToggleChip2({ selected, onChange, childre
|
|
|
5391
5409
|
ToggleChip.displayName = "ToggleChip";
|
|
5392
5410
|
|
|
5393
5411
|
// src/CopyButton.tsx
|
|
5394
|
-
import { forwardRef as forwardRef12, useEffect as useEffect16, useRef as useRef18, useState as
|
|
5412
|
+
import { forwardRef as forwardRef12, useEffect as useEffect16, useRef as useRef18, useState as useState17 } from "react";
|
|
5395
5413
|
import { Check as Check9, Copy } from "lucide-react";
|
|
5396
5414
|
import { jsx as jsx57, jsxs as jsxs49 } from "react/jsx-runtime";
|
|
5397
5415
|
var CONFIRM_MS = 2e3;
|
|
5398
5416
|
var CopyButton = forwardRef12(function CopyButton2({ value, label, "aria-label": ariaLabel, size = "xs", className, testIdPrefix }, ref) {
|
|
5399
|
-
const [copied, setCopied] =
|
|
5417
|
+
const [copied, setCopied] = useState17(false);
|
|
5400
5418
|
const timer = useRef18(void 0);
|
|
5401
5419
|
useEffect16(() => () => clearTimeout(timer.current), []);
|
|
5402
5420
|
const copy = async () => {
|
|
@@ -5481,7 +5499,7 @@ function InlineMessage({ tone = "info", title, children, actions, onDismiss, cla
|
|
|
5481
5499
|
}
|
|
5482
5500
|
|
|
5483
5501
|
// src/FilterDrawer.tsx
|
|
5484
|
-
import { useEffect as useEffect17, useLayoutEffect as useLayoutEffect6, useRef as useRef19, useState as
|
|
5502
|
+
import { useEffect as useEffect17, useLayoutEffect as useLayoutEffect6, useRef as useRef19, useState as useState18 } from "react";
|
|
5485
5503
|
import { ChevronLeft as ChevronLeft5, ChevronRight as ChevronRight6 } from "lucide-react";
|
|
5486
5504
|
import { jsx as jsx59, jsxs as jsxs51 } from "react/jsx-runtime";
|
|
5487
5505
|
var SLIDE_MS = 200;
|
|
@@ -5501,10 +5519,10 @@ function FilterDrawer({
|
|
|
5501
5519
|
size = "sm",
|
|
5502
5520
|
testIdPrefix
|
|
5503
5521
|
}) {
|
|
5504
|
-
const [view, setViewState] =
|
|
5505
|
-
const [leaving, setLeaving] =
|
|
5506
|
-
const [phase, setPhase] =
|
|
5507
|
-
const [wasOpen, setWasOpen] =
|
|
5522
|
+
const [view, setViewState] = useState18(focus);
|
|
5523
|
+
const [leaving, setLeaving] = useState18(null);
|
|
5524
|
+
const [phase, setPhase] = useState18("run");
|
|
5525
|
+
const [wasOpen, setWasOpen] = useState18(open);
|
|
5508
5526
|
if (open !== wasOpen) {
|
|
5509
5527
|
setWasOpen(open);
|
|
5510
5528
|
if (open) {
|