@mediaradar/design-components 0.50.1 → 0.53.0
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 +2 -1
- package/dist/index.cjs +148 -31
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +154 -23
- package/dist/index.d.ts +154 -23
- package/dist/index.js +144 -31
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "0.
|
|
2
|
+
"version": "0.53.0",
|
|
3
3
|
"components": [
|
|
4
4
|
"AISpark",
|
|
5
5
|
"AdvertiserNoResults",
|
|
@@ -28,6 +28,7 @@
|
|
|
28
28
|
"InlineMessage",
|
|
29
29
|
"LineChartPlaceholder",
|
|
30
30
|
"MediaLabel",
|
|
31
|
+
"Menu",
|
|
31
32
|
"Modal",
|
|
32
33
|
"MultiSelectFilter",
|
|
33
34
|
"NameListModal",
|
package/dist/index.cjs
CHANGED
|
@@ -50,6 +50,10 @@ __export(index_exports, {
|
|
|
50
50
|
InlineMessage: () => InlineMessage,
|
|
51
51
|
LineChartPlaceholder: () => LineChartPlaceholder,
|
|
52
52
|
MediaLabel: () => MediaLabel,
|
|
53
|
+
Menu: () => Menu,
|
|
54
|
+
MenuItem: () => MenuItem,
|
|
55
|
+
MenuLabel: () => MenuLabel,
|
|
56
|
+
MenuSeparator: () => MenuSeparator,
|
|
53
57
|
Modal: () => Modal,
|
|
54
58
|
MultiSelectFilter: () => MultiSelectFilter,
|
|
55
59
|
NO_RESULTS_BODY: () => NO_RESULTS_BODY,
|
|
@@ -317,6 +321,12 @@ function AdvertiserQuickFilter({
|
|
|
317
321
|
setOpen(false);
|
|
318
322
|
setQ("");
|
|
319
323
|
};
|
|
324
|
+
const clearAll = () => {
|
|
325
|
+
setDraft(clearValue);
|
|
326
|
+
onChange(clearValue);
|
|
327
|
+
setOpen(false);
|
|
328
|
+
setQ("");
|
|
329
|
+
};
|
|
320
330
|
(0, import_react2.useEffect)(() => {
|
|
321
331
|
if (!open) return;
|
|
322
332
|
inputRef.current?.focus();
|
|
@@ -394,7 +404,7 @@ function AdvertiserQuickFilter({
|
|
|
394
404
|
"div",
|
|
395
405
|
{
|
|
396
406
|
className: cn(
|
|
397
|
-
"absolute top-
|
|
407
|
+
"absolute top-full mt-2 z-30 flex w-72 flex-col overflow-hidden rounded-card border border-border-default bg-surface shadow-overlay",
|
|
398
408
|
align === "right" ? "right-0" : "left-0"
|
|
399
409
|
),
|
|
400
410
|
role: "dialog",
|
|
@@ -428,7 +438,7 @@ function AdvertiserQuickFilter({
|
|
|
428
438
|
}
|
|
429
439
|
)
|
|
430
440
|
] }) }),
|
|
431
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "max-h-
|
|
441
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "max-h-75 overflow-y-auto p-1", children: [
|
|
432
442
|
selectedOptions.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "mb-1 border-b border-border-default pb-1", children: [
|
|
433
443
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
434
444
|
"button",
|
|
@@ -522,7 +532,7 @@ function AdvertiserQuickFilter({
|
|
|
522
532
|
{
|
|
523
533
|
type: "button",
|
|
524
534
|
"data-testid": testIdPrefix && `${testIdPrefix}-clear-all`,
|
|
525
|
-
onClick:
|
|
535
|
+
onClick: clearAll,
|
|
526
536
|
disabled: draft.length === 0,
|
|
527
537
|
className: "text-dense font-medium text-text-secondary transition-colors hover:text-text-primary disabled:opacity-40 focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-border-focus",
|
|
528
538
|
children: "Clear all"
|
|
@@ -585,7 +595,7 @@ function OptionRow({
|
|
|
585
595
|
className: cn(
|
|
586
596
|
// scroll-my-1: Tab scrolls the list just far enough to show the box,
|
|
587
597
|
// which would leave its 3px ring cut off at the list's edge.
|
|
588
|
-
"flex h-
|
|
598
|
+
"flex h-4.5 w-4.5 shrink-0 scroll-my-1 items-center justify-center rounded-small border transition-colors",
|
|
589
599
|
"focus-visible:outline-solid focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-border-focus",
|
|
590
600
|
checked ? "border-transparent bg-brand-primaryAction text-brand-onprimary" : "border-border-interactive bg-surface hover:border-brand-primaryAction"
|
|
591
601
|
),
|
|
@@ -647,7 +657,7 @@ var KIND = {
|
|
|
647
657
|
// Square-ish and centred, with a floor width so a 1-digit and a 3-digit
|
|
648
658
|
// count are the same shape, and lining figures so the width does not shift
|
|
649
659
|
// as the number changes.
|
|
650
|
-
count: "h-
|
|
660
|
+
count: "h-4.5 min-w-4.5 justify-center px-1.5 tabular-nums",
|
|
651
661
|
// The only kind that shouts. Caps need the letterspacing -- caps set tight
|
|
652
662
|
// are harder to read than the sentence case they replaced.
|
|
653
663
|
eyebrow: "px-2.5 py-1 uppercase tracking-wider",
|
|
@@ -1091,7 +1101,7 @@ function DateRangeFilter({
|
|
|
1091
1101
|
{
|
|
1092
1102
|
"data-testid": testIdPrefix && `${testIdPrefix}-popover`,
|
|
1093
1103
|
ref: popRef,
|
|
1094
|
-
className: `absolute z-30 flex overflow-hidden rounded-card border border-border-default bg-surface shadow-overlay ${placement === "right" ? "bottom-0 left-full ml-2" : `${above ? "bottom-full mb-2" : "top-
|
|
1104
|
+
className: `absolute z-30 flex overflow-hidden rounded-card border border-border-default bg-surface shadow-overlay ${placement === "right" ? "bottom-0 left-full ml-2" : `${above ? "bottom-full mb-2" : "top-full mt-2"} ${align === "right" ? "right-0" : "left-0"}`}`,
|
|
1095
1105
|
role: "dialog",
|
|
1096
1106
|
"aria-label": "Select date range",
|
|
1097
1107
|
children: [
|
|
@@ -1116,7 +1126,7 @@ function DateRangeFilter({
|
|
|
1116
1126
|
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "flex gap-8", children: [0, 1].map((offset) => {
|
|
1117
1127
|
const m = addMonths(leftMonth, offset);
|
|
1118
1128
|
const grid = monthGrid(m.getFullYear(), m.getMonth());
|
|
1119
|
-
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "w-
|
|
1129
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "w-63", children: [
|
|
1120
1130
|
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "mb-2 flex items-center justify-between", children: [
|
|
1121
1131
|
offset === 0 ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(NavBtn, { onClick: () => setLeftMonth(addMonths(leftMonth, -1)), "aria-label": "Previous month", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react6.ChevronLeft, { size: 16 }) }) : /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "h-7 w-7" }),
|
|
1122
1132
|
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("span", { id: `${monthIdBase}-m${offset}`, "aria-live": "polite", className: "text-panel-title font-semibold text-text-primary", children: [
|
|
@@ -1151,7 +1161,7 @@ function DateRangeFilter({
|
|
|
1151
1161
|
"aria-pressed": endpoint || inRange,
|
|
1152
1162
|
className: "relative flex h-9 items-center justify-center focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-border-focus",
|
|
1153
1163
|
children: [
|
|
1154
|
-
band && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: `absolute inset-y-
|
|
1164
|
+
band && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: `absolute inset-y-1 bg-ai-tint ${band}`, "aria-hidden": "true" }),
|
|
1155
1165
|
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1156
1166
|
"span",
|
|
1157
1167
|
{
|
|
@@ -1213,7 +1223,7 @@ function DateRangeFilter({
|
|
|
1213
1223
|
function Field({ label, value }) {
|
|
1214
1224
|
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "flex flex-col gap-1.5", children: [
|
|
1215
1225
|
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "text-xs font-medium text-text-secondary", children: label }),
|
|
1216
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "flex h-10 min-w-
|
|
1226
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "flex h-10 min-w-35 items-center rounded-control border border-border-strong bg-input px-3 text-sm font-medium text-text-primary", children: value })
|
|
1217
1227
|
] });
|
|
1218
1228
|
}
|
|
1219
1229
|
function NavBtn({ children, onClick, ...rest }) {
|
|
@@ -1332,7 +1342,7 @@ var SearchBar = (0, import_react5.forwardRef)(function SearchBar2({
|
|
|
1332
1342
|
// flex-auto, not flex-1: flex-1's 0% basis took the height away in a
|
|
1333
1343
|
// column (a filter panel's stack), squashing the sm box from 32px to
|
|
1334
1344
|
// its text's 22px. auto keeps the h-8/10/11 and still fills a row.
|
|
1335
|
-
"relative flex min-w-
|
|
1345
|
+
"relative flex min-w-50 flex-auto items-stretch rounded-control border border-border-strong bg-input focus-within:outline-2 focus-within:outline-offset-1 focus-within:outline-border-focus",
|
|
1336
1346
|
HEIGHT[size],
|
|
1337
1347
|
className
|
|
1338
1348
|
),
|
|
@@ -1540,7 +1550,7 @@ var SearchBar = (0, import_react5.forwardRef)(function SearchBar2({
|
|
|
1540
1550
|
role: "dialog",
|
|
1541
1551
|
"aria-label": "Search match type",
|
|
1542
1552
|
"data-testid": testIdPrefix && `${testIdPrefix}-mode-popover`,
|
|
1543
|
-
className: "absolute right-0 top-
|
|
1553
|
+
className: "absolute right-0 top-full mt-2 z-50 w-100 rounded-card border border-border-default bg-surface p-3 shadow-overlay",
|
|
1544
1554
|
children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { role: "radiogroup", "aria-label": "Search match type", className: "flex flex-col", children: [
|
|
1545
1555
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1546
1556
|
ModeRow,
|
|
@@ -1737,7 +1747,7 @@ function RowInfoTip({ text }) {
|
|
|
1737
1747
|
{
|
|
1738
1748
|
id,
|
|
1739
1749
|
hidden: !open,
|
|
1740
|
-
className: "absolute left-0 top-
|
|
1750
|
+
className: "absolute left-0 top-full mt-1.5 z-40 w-55 rounded-control border border-border-default bg-surface px-2.5 py-1.5 text-xs font-normal leading-snug text-text-secondary shadow-overlay",
|
|
1741
1751
|
children: text
|
|
1742
1752
|
}
|
|
1743
1753
|
)
|
|
@@ -1990,7 +2000,7 @@ function DataScopeFilter({ value, onChange, align = "right", className, testIdPr
|
|
|
1990
2000
|
"aria-label": "Data",
|
|
1991
2001
|
"data-testid": testIdPrefix && `${testIdPrefix}-popover`,
|
|
1992
2002
|
className: cn(
|
|
1993
|
-
"absolute top-
|
|
2003
|
+
"absolute top-full mt-2 z-30 min-w-55 overflow-hidden rounded-card border border-border-default bg-surface p-1 shadow-overlay",
|
|
1994
2004
|
align === "right" ? "right-0" : "left-0"
|
|
1995
2005
|
),
|
|
1996
2006
|
children: [
|
|
@@ -2184,7 +2194,7 @@ function SelectFilter({
|
|
|
2184
2194
|
),
|
|
2185
2195
|
role: loading || error ? "group" : "listbox",
|
|
2186
2196
|
"aria-label": caption,
|
|
2187
|
-
children: loading ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(MenuLoading, {}) : error ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(MenuError, { onRetry }) : /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "max-h-
|
|
2197
|
+
children: loading ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(MenuLoading, {}) : error ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(MenuError, { onRetry }) : /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "max-h-70 overflow-y-auto p-1", children: options.map((o) => {
|
|
2188
2198
|
const selected = o === value;
|
|
2189
2199
|
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
2190
2200
|
"button",
|
|
@@ -2278,7 +2288,7 @@ function NoResultsEmptyState({
|
|
|
2278
2288
|
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: cn("flex flex-col items-center justify-center gap-3 text-center", className), "data-testid": testIdPrefix, children: [
|
|
2279
2289
|
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "flex h-11 w-11 items-center justify-center rounded-full bg-subtle text-text-tertiary", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_lucide_react11.FilterX, { size: 20, "aria-hidden": "true" }) }),
|
|
2280
2290
|
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("h2", { className: "text-base font-semibold text-text-primary", children: title }),
|
|
2281
|
-
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("p", { className: "max-w-
|
|
2291
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)("p", { className: "max-w-105 text-dense leading-relaxed text-text-secondary", children: bodyText }),
|
|
2282
2292
|
hasActions && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "mt-1 flex flex-col items-center gap-3", children: [
|
|
2283
2293
|
showClear && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
2284
2294
|
"button",
|
|
@@ -2450,7 +2460,7 @@ function AxisFrame({
|
|
|
2450
2460
|
{
|
|
2451
2461
|
className: "absolute bottom-0 right-0 flex items-center",
|
|
2452
2462
|
style: { left: Y_AXIS_W, height: X_AXIS_H },
|
|
2453
|
-
children: Array.from({ length: xTicks }, (_, i) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "flex flex-1 justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "h-2 w-full max-w-
|
|
2463
|
+
children: Array.from({ length: xTicks }, (_, i) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "flex flex-1 justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "h-2 w-full max-w-6.5 rounded-xs bg-subtle" }) }, i))
|
|
2454
2464
|
}
|
|
2455
2465
|
)
|
|
2456
2466
|
] }) });
|
|
@@ -3524,7 +3534,7 @@ function Monogram({ name, size = 28 }) {
|
|
|
3524
3534
|
"span",
|
|
3525
3535
|
{
|
|
3526
3536
|
"aria-hidden": "true",
|
|
3527
|
-
className: "flex shrink-0 items-center justify-center rounded-
|
|
3537
|
+
className: "flex shrink-0 items-center justify-center rounded-control bg-subtle font-bold leading-none text-text-secondary",
|
|
3528
3538
|
style: { width: size, height: size, fontSize: Math.round(size * 0.36) },
|
|
3529
3539
|
children: initials(name)
|
|
3530
3540
|
}
|
|
@@ -3540,7 +3550,7 @@ function DelayedTip({ label, children }) {
|
|
|
3540
3550
|
"span",
|
|
3541
3551
|
{
|
|
3542
3552
|
role: "tooltip",
|
|
3543
|
-
className: "pointer-events-none invisible absolute bottom-
|
|
3553
|
+
className: "pointer-events-none invisible absolute bottom-full mb-1.5 left-1/2 z-40 w-40 -translate-x-1/2 rounded-control border border-border-default bg-surface px-2 py-1.5 text-center text-micro font-medium leading-snug text-text-secondary opacity-0 shadow-overlay transition-[opacity,visibility] delay-1000 duration-150 group-hover/dt:visible group-hover/dt:opacity-100 group-focus/dt:visible group-focus/dt:opacity-100",
|
|
3544
3554
|
children: label
|
|
3545
3555
|
}
|
|
3546
3556
|
)
|
|
@@ -4425,7 +4435,7 @@ function DateRangePicker({
|
|
|
4425
4435
|
]
|
|
4426
4436
|
}
|
|
4427
4437
|
),
|
|
4428
|
-
open && /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: cn("absolute top-
|
|
4438
|
+
open && /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: cn("absolute top-full mt-2 z-30 w-70 overflow-hidden rounded-card border border-border-default bg-surface py-1 shadow-overlay", align === "right" ? "right-0" : "left-0"), children: [
|
|
4429
4439
|
presets.map((p) => /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
4430
4440
|
"button",
|
|
4431
4441
|
{
|
|
@@ -4476,6 +4486,7 @@ function DateRangePicker({
|
|
|
4476
4486
|
var import_react20 = require("react");
|
|
4477
4487
|
var import_lucide_react23 = require("lucide-react");
|
|
4478
4488
|
var import_jsx_runtime40 = require("react/jsx-runtime");
|
|
4489
|
+
var SEARCH_AFTER = 8;
|
|
4479
4490
|
function MultiSelectFilter({
|
|
4480
4491
|
caption,
|
|
4481
4492
|
options = [],
|
|
@@ -4485,7 +4496,7 @@ function MultiSelectFilter({
|
|
|
4485
4496
|
selected,
|
|
4486
4497
|
onChange,
|
|
4487
4498
|
allLabel = "All",
|
|
4488
|
-
searchable
|
|
4499
|
+
searchable,
|
|
4489
4500
|
searchPlaceholder,
|
|
4490
4501
|
align = "left",
|
|
4491
4502
|
fullIsAll = false,
|
|
@@ -4507,6 +4518,7 @@ function MultiSelectFilter({
|
|
|
4507
4518
|
}) {
|
|
4508
4519
|
const groupLeaves = (g) => g.children.length ? g.children : [{ id: g.id, label: g.label }];
|
|
4509
4520
|
const leafOptions = groups ? groups.flatMap(groupLeaves) : options;
|
|
4521
|
+
const showSearch = searchable ?? leafOptions.length > SEARCH_AFTER;
|
|
4510
4522
|
const [open, setOpen] = (0, import_react20.useState)(false);
|
|
4511
4523
|
const [q, setQ] = (0, import_react20.useState)("");
|
|
4512
4524
|
const [draft, setDraft] = (0, import_react20.useState)(selected);
|
|
@@ -4528,6 +4540,12 @@ function MultiSelectFilter({
|
|
|
4528
4540
|
setOpen(false);
|
|
4529
4541
|
setQ("");
|
|
4530
4542
|
};
|
|
4543
|
+
const clearAll = () => {
|
|
4544
|
+
setDraft(clearValue);
|
|
4545
|
+
onChange(clearValue);
|
|
4546
|
+
setOpen(false);
|
|
4547
|
+
setQ("");
|
|
4548
|
+
};
|
|
4531
4549
|
(0, import_react20.useEffect)(() => {
|
|
4532
4550
|
if (!open) return;
|
|
4533
4551
|
const onKey = (e) => e.key === "Escape" && close();
|
|
@@ -4604,7 +4622,7 @@ function MultiSelectFilter({
|
|
|
4604
4622
|
"div",
|
|
4605
4623
|
{
|
|
4606
4624
|
className: cn(
|
|
4607
|
-
"absolute top-
|
|
4625
|
+
"absolute top-full mt-2 z-30 flex flex-col overflow-hidden rounded-card border border-border-default bg-surface shadow-overlay",
|
|
4608
4626
|
menuWidthClass,
|
|
4609
4627
|
align === "right" ? "right-0" : "left-0"
|
|
4610
4628
|
),
|
|
@@ -4612,7 +4630,7 @@ function MultiSelectFilter({
|
|
|
4612
4630
|
role: "dialog",
|
|
4613
4631
|
"aria-label": caption,
|
|
4614
4632
|
children: loading ? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(MenuLoading, {}) : error ? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(MenuError, { onRetry }) : /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(import_jsx_runtime40.Fragment, { children: [
|
|
4615
|
-
|
|
4633
|
+
showSearch && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: "border-b border-border-default p-2", children: /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: "flex h-8 items-center gap-2 rounded-control border border-border-strong bg-input px-2.5 focus-within:outline-2 focus-within:outline-offset-1 focus-within:outline-border-focus", children: [
|
|
4616
4634
|
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_lucide_react23.Search, { size: 14, className: "text-text-secondary", "aria-hidden": "true" }),
|
|
4617
4635
|
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
4618
4636
|
"input",
|
|
@@ -4626,7 +4644,7 @@ function MultiSelectFilter({
|
|
|
4626
4644
|
),
|
|
4627
4645
|
q && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("button", { type: "button", onClick: () => setQ(""), "aria-label": "Clear search", className: "text-text-tertiary hover:text-text-primary focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-border-focus", children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_lucide_react23.X, { size: 13 }) })
|
|
4628
4646
|
] }) }),
|
|
4629
|
-
/* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: "max-h-
|
|
4647
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: "max-h-70 overflow-y-auto p-1", children: [
|
|
4630
4648
|
groups ? visibleGroups.map((g) => {
|
|
4631
4649
|
const state = groupState(g);
|
|
4632
4650
|
return /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { children: [
|
|
@@ -4681,7 +4699,7 @@ function MultiSelectFilter({
|
|
|
4681
4699
|
(groups && !visibleGroups.length || !groups && !items.length) && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: "py-6 text-center text-dense text-text-tertiary", children: "No matches." })
|
|
4682
4700
|
] }),
|
|
4683
4701
|
note && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("p", { className: "border-t border-border-default px-3 py-2 text-xs text-text-tertiary", children: note }),
|
|
4684
|
-
showFooter ? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(FilterDropdownFooter, { onClear:
|
|
4702
|
+
showFooter ? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(FilterDropdownFooter, { onClear: clearAll, onApply: apply }) : min === 0 && draft.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: "border-t border-border-default p-2", children: /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(
|
|
4685
4703
|
"button",
|
|
4686
4704
|
{
|
|
4687
4705
|
type: "button",
|
|
@@ -4710,8 +4728,8 @@ function OptionCount({ n }) {
|
|
|
4710
4728
|
var import_react21 = require("react");
|
|
4711
4729
|
var import_jsx_runtime41 = require("react/jsx-runtime");
|
|
4712
4730
|
var SIZES2 = {
|
|
4713
|
-
sm: { track: "h-5 w-9", knob: "h-4 w-4", on: "translate-x-
|
|
4714
|
-
md: { track: "h-6 w-11", knob: "h-5 w-5", on: "translate-x-
|
|
4731
|
+
sm: { track: "h-5 w-9", knob: "h-4 w-4", on: "translate-x-4.5" },
|
|
4732
|
+
md: { track: "h-6 w-11", knob: "h-5 w-5", on: "translate-x-5.5" }
|
|
4715
4733
|
};
|
|
4716
4734
|
var OFF_TRACK = "color-mix(in srgb, var(--mr-color-border-interactive) 70%, var(--mr-color-text-secondary))";
|
|
4717
4735
|
var Toggle = (0, import_react21.forwardRef)(function Toggle2({ checked, onChange, label, size = "md", disabled, className, testIdPrefix }, ref) {
|
|
@@ -4759,7 +4777,7 @@ function AISpark({ size = 16, className, testIdPrefix }) {
|
|
|
4759
4777
|
return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(import_jsx_runtime42.Fragment, { children: [
|
|
4760
4778
|
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("svg", { width: "0", height: "0", "aria-hidden": "true", style: { position: "absolute" }, children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("defs", { children: /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("linearGradient", { id, x1: "0", y1: "0", x2: "1", y2: "1", children: [
|
|
4761
4779
|
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("stop", { offset: "0%", stopColor: "var(--mr-color-brand-primary)" }),
|
|
4762
|
-
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("stop", { offset: "100%",
|
|
4780
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("stop", { offset: "100%", stopColor: "var(--mr-color-ai-violet)" })
|
|
4763
4781
|
] }) }) }),
|
|
4764
4782
|
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_lucide_react24.Sparkles, { size, stroke: `url(#${id})`, className, "data-testid": testIdPrefix, "aria-hidden": "true" })
|
|
4765
4783
|
] });
|
|
@@ -5466,7 +5484,7 @@ function FilterDrawer({
|
|
|
5466
5484
|
const outgoing = phase === "start" ? void 0 : dir > 0 ? "translateX(-33%)" : "translateX(100%)";
|
|
5467
5485
|
const panel = (v, rows = true) => {
|
|
5468
5486
|
const s = v ? sections.find((x) => x.id === v) : void 0;
|
|
5469
|
-
if (s) return /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("div", { className: "px-5 pt-
|
|
5487
|
+
if (s) return /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("div", { className: "border-t border-border-default px-5 pt-4", children: renderSection(s.id) });
|
|
5470
5488
|
return /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("ul", { className: "border-t border-border-default", children: sections.map((x) => /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("li", { className: "border-b border-border-default", children: /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(
|
|
5471
5489
|
"button",
|
|
5472
5490
|
{
|
|
@@ -5520,8 +5538,11 @@ function FilterDrawer({
|
|
|
5520
5538
|
"Filters",
|
|
5521
5539
|
activeCount > 0 && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(Badge, { tone: "brandSolid", kind: "count", children: activeCount })
|
|
5522
5540
|
] }),
|
|
5523
|
-
footer:
|
|
5524
|
-
|
|
5541
|
+
footer: focused ? (
|
|
5542
|
+
// Picks are kept as they're made; only See results, on the list, applies them.
|
|
5543
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)("div", { className: "flex w-full items-center", children: /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(Button, { variant: "link", size: "md", onClick: () => onClearSection(focused.id), className: "px-0", children: "Clear" }) })
|
|
5544
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("div", { className: "flex w-full items-center justify-between gap-2", children: [
|
|
5545
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)(Button, { variant: "link", size: "md", onClick: onClearAll, className: "px-0", children: "Clear all" }),
|
|
5525
5546
|
/* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
5526
5547
|
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)(Button, { variant: "secondary", size: "md", onClick: onClose, children: "Cancel" }),
|
|
5527
5548
|
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
@@ -5533,7 +5554,7 @@ function FilterDrawer({
|
|
|
5533
5554
|
onApply();
|
|
5534
5555
|
onClose();
|
|
5535
5556
|
},
|
|
5536
|
-
children: "
|
|
5557
|
+
children: "See results"
|
|
5537
5558
|
}
|
|
5538
5559
|
)
|
|
5539
5560
|
] })
|
|
@@ -5587,6 +5608,98 @@ var AllFiltersButton = (0, import_react31.forwardRef)(function AllFiltersButton2
|
|
|
5587
5608
|
}
|
|
5588
5609
|
);
|
|
5589
5610
|
});
|
|
5611
|
+
|
|
5612
|
+
// src/Menu.tsx
|
|
5613
|
+
var import_react32 = require("react");
|
|
5614
|
+
var import_react_slot2 = require("@radix-ui/react-slot");
|
|
5615
|
+
var import_lucide_react33 = require("lucide-react");
|
|
5616
|
+
var import_jsx_runtime58 = require("react/jsx-runtime");
|
|
5617
|
+
var ROW_SELECTOR = '[role^="menuitem"]:not([aria-disabled="true"]):not(:disabled)';
|
|
5618
|
+
function moveFocus(e) {
|
|
5619
|
+
const keys = ["ArrowDown", "ArrowUp", "Home", "End"];
|
|
5620
|
+
if (!keys.includes(e.key)) return;
|
|
5621
|
+
const rows = Array.from(e.currentTarget.querySelectorAll(ROW_SELECTOR));
|
|
5622
|
+
if (!rows.length) return;
|
|
5623
|
+
e.preventDefault();
|
|
5624
|
+
const i = rows.indexOf(document.activeElement);
|
|
5625
|
+
const next = e.key === "Home" ? 0 : e.key === "End" ? rows.length - 1 : e.key === "ArrowDown" ? (i + 1) % rows.length : (i - 1 + rows.length) % rows.length;
|
|
5626
|
+
rows[next].focus();
|
|
5627
|
+
}
|
|
5628
|
+
var Menu = (0, import_react32.forwardRef)(
|
|
5629
|
+
({ className, testIdPrefix, onKeyDown, children, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
5630
|
+
"div",
|
|
5631
|
+
{
|
|
5632
|
+
ref,
|
|
5633
|
+
role: "menu",
|
|
5634
|
+
"data-testid": testIdPrefix,
|
|
5635
|
+
onKeyDown: (e) => {
|
|
5636
|
+
moveFocus(e);
|
|
5637
|
+
onKeyDown?.(e);
|
|
5638
|
+
},
|
|
5639
|
+
className: cn("flex flex-col p-1", className),
|
|
5640
|
+
...props,
|
|
5641
|
+
children
|
|
5642
|
+
}
|
|
5643
|
+
)
|
|
5644
|
+
);
|
|
5645
|
+
Menu.displayName = "Menu";
|
|
5646
|
+
var MenuItem = (0, import_react32.forwardRef)(
|
|
5647
|
+
({ className, testIdPrefix, icon, trailing, description, submenu, checked, danger, disabled, asChild = false, children, ...props }, ref) => {
|
|
5648
|
+
const Comp = asChild ? import_react_slot2.Slot : "button";
|
|
5649
|
+
const radio = checked !== void 0;
|
|
5650
|
+
const body = /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)(import_jsx_runtime58.Fragment, { children: [
|
|
5651
|
+
icon && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("span", { "aria-hidden": "true", className: cn("flex shrink-0", danger ? "text-text-danger" : "text-text-secondary"), children: icon }),
|
|
5652
|
+
asChild ? (
|
|
5653
|
+
// The link's own text lands here; the link becomes the row.
|
|
5654
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)(import_react_slot2.Slottable, { children })
|
|
5655
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("span", { className: "min-w-0 flex-1", children: [
|
|
5656
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)("span", { className: "block truncate", children }),
|
|
5657
|
+
description && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("span", { className: "block truncate text-xs text-text-tertiary", children: description })
|
|
5658
|
+
] }),
|
|
5659
|
+
trailing && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("span", { className: "ml-auto flex shrink-0 items-center text-xs text-text-secondary", children: trailing }),
|
|
5660
|
+
radio && checked && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(import_lucide_react33.Check, { size: 16, "aria-hidden": "true", className: "shrink-0 text-brand-primaryAction" }),
|
|
5661
|
+
submenu && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(import_lucide_react33.ChevronRight, { size: 16, "aria-hidden": "true", className: "shrink-0 text-text-secondary" })
|
|
5662
|
+
] });
|
|
5663
|
+
return /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
5664
|
+
Comp,
|
|
5665
|
+
{
|
|
5666
|
+
ref,
|
|
5667
|
+
type: asChild ? void 0 : "button",
|
|
5668
|
+
role: radio ? "menuitemradio" : "menuitem",
|
|
5669
|
+
"aria-checked": radio ? checked : void 0,
|
|
5670
|
+
"aria-haspopup": submenu ? "menu" : void 0,
|
|
5671
|
+
"aria-disabled": disabled || void 0,
|
|
5672
|
+
disabled: asChild ? void 0 : disabled,
|
|
5673
|
+
tabIndex: -1,
|
|
5674
|
+
"data-testid": testIdPrefix,
|
|
5675
|
+
className: cn(
|
|
5676
|
+
"flex min-h-9 w-full items-center gap-2.5 rounded-control px-3 py-1.5 text-left text-sm transition-colors",
|
|
5677
|
+
"focus-visible:outline-solid focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-border-focus",
|
|
5678
|
+
danger ? "text-text-danger" : "text-text-primary",
|
|
5679
|
+
disabled ? "cursor-not-allowed opacity-40" : "hover:bg-subtle focus-visible:bg-subtle",
|
|
5680
|
+
className
|
|
5681
|
+
),
|
|
5682
|
+
...props,
|
|
5683
|
+
children: body
|
|
5684
|
+
}
|
|
5685
|
+
);
|
|
5686
|
+
}
|
|
5687
|
+
);
|
|
5688
|
+
MenuItem.displayName = "MenuItem";
|
|
5689
|
+
function MenuLabel({ className, testIdPrefix, children }) {
|
|
5690
|
+
return /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
5691
|
+
"div",
|
|
5692
|
+
{
|
|
5693
|
+
role: "presentation",
|
|
5694
|
+
"data-testid": testIdPrefix,
|
|
5695
|
+
className: cn("px-3 pb-1 pt-2 text-micro font-semibold uppercase tracking-wide text-text-tertiary", className),
|
|
5696
|
+
children
|
|
5697
|
+
}
|
|
5698
|
+
);
|
|
5699
|
+
}
|
|
5700
|
+
function MenuSeparator({ className, testIdPrefix }) {
|
|
5701
|
+
return /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("div", { role: "separator", "data-testid": testIdPrefix, className: cn("-mx-1 my-1 border-t border-border-default", className) });
|
|
5702
|
+
}
|
|
5590
5703
|
// Annotate the CommonJS export names for ESM import in node:
|
|
5591
5704
|
0 && (module.exports = {
|
|
5592
5705
|
AISpark,
|
|
@@ -5618,6 +5731,10 @@ var AllFiltersButton = (0, import_react31.forwardRef)(function AllFiltersButton2
|
|
|
5618
5731
|
InlineMessage,
|
|
5619
5732
|
LineChartPlaceholder,
|
|
5620
5733
|
MediaLabel,
|
|
5734
|
+
Menu,
|
|
5735
|
+
MenuItem,
|
|
5736
|
+
MenuLabel,
|
|
5737
|
+
MenuSeparator,
|
|
5621
5738
|
Modal,
|
|
5622
5739
|
MultiSelectFilter,
|
|
5623
5740
|
NO_RESULTS_BODY,
|