@mediaradar/design-components 0.45.3 → 0.46.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 +1 -1
- package/dist/index.cjs +592 -492
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +199 -128
- package/dist/index.d.ts +199 -128
- package/dist/index.js +440 -340
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -7,8 +7,24 @@ var define_FONT_SIZE_KEYS_default = ["control-caption", "badge", "micro", "xs",
|
|
|
7
7
|
import { useEffect, useId, useRef, useState } from "react";
|
|
8
8
|
import { createPortal } from "react-dom";
|
|
9
9
|
import { Info } from "lucide-react";
|
|
10
|
+
|
|
11
|
+
// src/cn.ts
|
|
12
|
+
import { clsx } from "clsx";
|
|
13
|
+
import { extendTailwindMerge } from "tailwind-merge";
|
|
14
|
+
var twMerge = extendTailwindMerge({
|
|
15
|
+
extend: {
|
|
16
|
+
classGroups: {
|
|
17
|
+
"font-size": [{ text: define_FONT_SIZE_KEYS_default }]
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
function cn(...inputs) {
|
|
22
|
+
return twMerge(clsx(inputs));
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// src/InfoTip.tsx
|
|
10
26
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
11
|
-
function InfoTip({ text, size = 11, label = "More information", trigger = "click" }) {
|
|
27
|
+
function InfoTip({ text, size = 11, label = "More information", trigger = "click", className, testIdPrefix }) {
|
|
12
28
|
const [open, setOpen] = useState(false);
|
|
13
29
|
const [pos, setPos] = useState(null);
|
|
14
30
|
const btnRef = useRef(null);
|
|
@@ -69,8 +85,12 @@ function InfoTip({ text, size = 11, label = "More information", trigger = "click
|
|
|
69
85
|
"aria-label": label,
|
|
70
86
|
"aria-expanded": open,
|
|
71
87
|
"aria-describedby": textId,
|
|
88
|
+
"data-testid": testIdPrefix,
|
|
72
89
|
...hoverProps,
|
|
73
|
-
className:
|
|
90
|
+
className: cn(
|
|
91
|
+
"inline-flex cursor-pointer items-center text-text-tertiary transition-colors hover:text-text-primary focus-visible:outline-solid focus-visible:outline-2 focus-visible:outline-border-focus",
|
|
92
|
+
className
|
|
93
|
+
),
|
|
74
94
|
children: /* @__PURE__ */ jsx(Info, { size, "aria-hidden": "true" })
|
|
75
95
|
}
|
|
76
96
|
),
|
|
@@ -99,8 +119,8 @@ import { Check, ChevronDown, ListChecks, Plus, Search as Search2, X } from "luci
|
|
|
99
119
|
// src/AdvertiserSearchPrompt.tsx
|
|
100
120
|
import { Search } from "lucide-react";
|
|
101
121
|
import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
102
|
-
function AdvertiserSearchPrompt({ label = "an advertiser name" }) {
|
|
103
|
-
return /* @__PURE__ */ jsxs2("div", { className: "flex flex-col items-center gap-2 px-4 py-8 text-center", children: [
|
|
122
|
+
function AdvertiserSearchPrompt({ label = "an advertiser name", className, testIdPrefix }) {
|
|
123
|
+
return /* @__PURE__ */ jsxs2("div", { className: cn("flex flex-col items-center gap-2 px-4 py-8 text-center", className), "data-testid": testIdPrefix, children: [
|
|
104
124
|
/* @__PURE__ */ jsx2("span", { className: "flex h-9 w-9 items-center justify-center rounded-full bg-subtle text-text-tertiary", children: /* @__PURE__ */ jsx2(Search, { size: 16, "aria-hidden": "true" }) }),
|
|
105
125
|
/* @__PURE__ */ jsxs2("p", { className: "text-xs leading-snug text-text-tertiary", children: [
|
|
106
126
|
"Start typing ",
|
|
@@ -110,20 +130,6 @@ function AdvertiserSearchPrompt({ label = "an advertiser name" }) {
|
|
|
110
130
|
] });
|
|
111
131
|
}
|
|
112
132
|
|
|
113
|
-
// src/cn.ts
|
|
114
|
-
import { clsx } from "clsx";
|
|
115
|
-
import { extendTailwindMerge } from "tailwind-merge";
|
|
116
|
-
var twMerge = extendTailwindMerge({
|
|
117
|
-
extend: {
|
|
118
|
-
classGroups: {
|
|
119
|
-
"font-size": [{ text: define_FONT_SIZE_KEYS_default }]
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
});
|
|
123
|
-
function cn(...inputs) {
|
|
124
|
-
return twMerge(clsx(inputs));
|
|
125
|
-
}
|
|
126
|
-
|
|
127
133
|
// src/ChipTrigger.tsx
|
|
128
134
|
import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
129
135
|
function chipTriggerClass(_variant = "box") {
|
|
@@ -134,13 +140,20 @@ function chipTriggerClass(_variant = "box") {
|
|
|
134
140
|
// a different kind of control. The variant no longer changes anything.
|
|
135
141
|
);
|
|
136
142
|
}
|
|
137
|
-
function ChipContent({ caption, value, icon }) {
|
|
138
|
-
const stack = /* @__PURE__ */ jsxs3(
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
143
|
+
function ChipContent({ caption, value, icon, className, testIdPrefix }) {
|
|
144
|
+
const stack = /* @__PURE__ */ jsxs3(
|
|
145
|
+
"span",
|
|
146
|
+
{
|
|
147
|
+
className: cn("flex flex-col gap-1 text-left leading-none", !icon && className),
|
|
148
|
+
"data-testid": icon ? void 0 : testIdPrefix,
|
|
149
|
+
children: [
|
|
150
|
+
/* @__PURE__ */ jsx3("span", { className: "text-control-caption leading-none uppercase tracking-wide text-text-tertiary", children: caption }),
|
|
151
|
+
/* @__PURE__ */ jsx3("span", { className: "text-xs leading-none font-medium text-text-primary", children: value })
|
|
152
|
+
]
|
|
153
|
+
}
|
|
154
|
+
);
|
|
142
155
|
if (icon) {
|
|
143
|
-
return /* @__PURE__ */ jsxs3("span", { className: "flex items-center gap-2", children: [
|
|
156
|
+
return /* @__PURE__ */ jsxs3("span", { className: cn("flex items-center gap-2", className), "data-testid": testIdPrefix, children: [
|
|
144
157
|
/* @__PURE__ */ jsx3("span", { className: "shrink-0 text-text-tertiary", children: icon }),
|
|
145
158
|
stack
|
|
146
159
|
] });
|
|
@@ -150,9 +163,6 @@ function ChipContent({ caption, value, icon }) {
|
|
|
150
163
|
|
|
151
164
|
// src/AdvertiserQuickFilter.tsx
|
|
152
165
|
import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
153
|
-
function cx(...parts) {
|
|
154
|
-
return parts.filter(Boolean).join(" ");
|
|
155
|
-
}
|
|
156
166
|
var SELECT_ALL_THRESHOLD = 5;
|
|
157
167
|
function usePaging(total, pageSize, resetKey) {
|
|
158
168
|
const [pages, setPages] = useState2(1);
|
|
@@ -183,6 +193,7 @@ function AdvertiserQuickFilter({
|
|
|
183
193
|
promptLabel = "an advertiser name",
|
|
184
194
|
noResultsHint = "Try checking your spelling or searching for a broader brand name.",
|
|
185
195
|
clearLabel = "Clear advertisers",
|
|
196
|
+
className,
|
|
186
197
|
testIdPrefix
|
|
187
198
|
}) {
|
|
188
199
|
const [open, setOpen] = useState2(false);
|
|
@@ -263,7 +274,7 @@ function AdvertiserQuickFilter({
|
|
|
263
274
|
const shown = open && !showFooter ? draft : selected;
|
|
264
275
|
const counted = parked.length ? shown.filter((id) => !parked.includes(id)) : shown;
|
|
265
276
|
const value = counted.length === 0 ? "All" : counted.length === 1 ? options.find((o) => o.id === counted[0])?.label ?? "1 selected" : `${counted.length} selected`;
|
|
266
|
-
return /* @__PURE__ */ jsxs4("div", { className: "relative", ref, children: [
|
|
277
|
+
return /* @__PURE__ */ jsxs4("div", { className: cn("relative", className), ref, "data-testid": testIdPrefix, children: [
|
|
267
278
|
/* @__PURE__ */ jsxs4(
|
|
268
279
|
"button",
|
|
269
280
|
{
|
|
@@ -280,7 +291,7 @@ function AdvertiserQuickFilter({
|
|
|
280
291
|
{
|
|
281
292
|
size: 14,
|
|
282
293
|
"aria-hidden": "true",
|
|
283
|
-
className:
|
|
294
|
+
className: cn("shrink-0 text-text-secondary transition-transform", open && "rotate-180")
|
|
284
295
|
}
|
|
285
296
|
)
|
|
286
297
|
]
|
|
@@ -289,7 +300,7 @@ function AdvertiserQuickFilter({
|
|
|
289
300
|
open && /* @__PURE__ */ jsxs4(
|
|
290
301
|
"div",
|
|
291
302
|
{
|
|
292
|
-
className:
|
|
303
|
+
className: cn(
|
|
293
304
|
"absolute top-[calc(100%+8px)] z-30 flex w-72 flex-col overflow-hidden rounded-card border border-border-default bg-surface shadow-overlay",
|
|
294
305
|
align === "right" ? "right-0" : "left-0"
|
|
295
306
|
),
|
|
@@ -319,7 +330,7 @@ function AdvertiserQuickFilter({
|
|
|
319
330
|
type: "button",
|
|
320
331
|
onClick: clearSearch,
|
|
321
332
|
"aria-label": "Clear search",
|
|
322
|
-
className: "shrink-0 text-text-tertiary transition-colors hover:text-text-primary",
|
|
333
|
+
className: "shrink-0 text-text-tertiary transition-colors hover:text-text-primary focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-border-focus",
|
|
323
334
|
children: /* @__PURE__ */ jsx4(X, { size: 13 })
|
|
324
335
|
}
|
|
325
336
|
)
|
|
@@ -333,14 +344,14 @@ function AdvertiserQuickFilter({
|
|
|
333
344
|
"data-testid": testIdPrefix && `${testIdPrefix}-selected-toggle`,
|
|
334
345
|
onClick: () => setSelectedOpen((v) => !v),
|
|
335
346
|
"aria-expanded": selectedOpen,
|
|
336
|
-
className: "flex w-full items-center gap-1.5 rounded-control px-2 py-1 text-left text-micro font-semibold uppercase tracking-wide text-text-tertiary transition-colors hover:text-text-primary",
|
|
347
|
+
className: "flex w-full items-center gap-1.5 rounded-control px-2 py-1 text-left text-micro font-semibold uppercase tracking-wide text-text-tertiary transition-colors hover:text-text-primary focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-border-focus",
|
|
337
348
|
children: [
|
|
338
349
|
/* @__PURE__ */ jsx4(
|
|
339
350
|
ChevronDown,
|
|
340
351
|
{
|
|
341
352
|
size: 13,
|
|
342
353
|
"aria-hidden": "true",
|
|
343
|
-
className:
|
|
354
|
+
className: cn("transition-transform", !selectedOpen && "-rotate-90")
|
|
344
355
|
}
|
|
345
356
|
),
|
|
346
357
|
"Selected (",
|
|
@@ -378,7 +389,7 @@ function AdvertiserQuickFilter({
|
|
|
378
389
|
type: "button",
|
|
379
390
|
"data-testid": testIdPrefix && `${testIdPrefix}-select-all-visible`,
|
|
380
391
|
onClick: toggleAllVisible,
|
|
381
|
-
className: "flex w-full items-center gap-2 rounded-control px-2 py-1.5 text-left text-xs font-semibold text-text-link transition-colors hover:bg-subtle",
|
|
392
|
+
className: "flex w-full items-center gap-2 rounded-control px-2 py-1.5 text-left text-xs font-semibold text-text-link transition-colors hover:bg-subtle focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-border-focus",
|
|
382
393
|
children: [
|
|
383
394
|
/* @__PURE__ */ jsx4(ListChecks, { size: 14, "aria-hidden": "true" }),
|
|
384
395
|
allVisibleSelected ? `Deselect ${results.length} visible` : `Select all ${results.length} visible`
|
|
@@ -420,7 +431,7 @@ function AdvertiserQuickFilter({
|
|
|
420
431
|
"data-testid": testIdPrefix && `${testIdPrefix}-clear-all`,
|
|
421
432
|
onClick: () => setDraft(clearValue),
|
|
422
433
|
disabled: draft.length === 0,
|
|
423
|
-
className: "text-dense font-medium text-text-secondary transition-colors hover:text-text-primary disabled:opacity-40",
|
|
434
|
+
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-2 focus-visible:outline-border-focus",
|
|
424
435
|
children: "Clear all"
|
|
425
436
|
}
|
|
426
437
|
),
|
|
@@ -430,7 +441,7 @@ function AdvertiserQuickFilter({
|
|
|
430
441
|
type: "button",
|
|
431
442
|
"data-testid": testIdPrefix && `${testIdPrefix}-apply`,
|
|
432
443
|
onClick: apply,
|
|
433
|
-
className: "rounded-control bg-brand-primaryAction px-5 py-2 text-dense font-semibold text-brand-onprimary transition hover:brightness-110",
|
|
444
|
+
className: "rounded-control bg-brand-primaryAction px-5 py-2 text-dense font-semibold text-brand-onprimary transition hover:brightness-110 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-border-focus",
|
|
434
445
|
children: "Apply"
|
|
435
446
|
}
|
|
436
447
|
)
|
|
@@ -444,7 +455,7 @@ function AdvertiserQuickFilter({
|
|
|
444
455
|
{
|
|
445
456
|
type: "button",
|
|
446
457
|
onClick: () => setDraft([]),
|
|
447
|
-
className: "text-xs font-medium text-text-link hover:underline",
|
|
458
|
+
className: "text-xs font-medium text-text-link hover:underline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-border-focus",
|
|
448
459
|
children: clearLabel
|
|
449
460
|
}
|
|
450
461
|
)
|
|
@@ -478,7 +489,7 @@ function OptionRow({
|
|
|
478
489
|
e.stopPropagation();
|
|
479
490
|
onToggle();
|
|
480
491
|
},
|
|
481
|
-
className:
|
|
492
|
+
className: cn(
|
|
482
493
|
"flex h-[18px] w-[18px] shrink-0 items-center justify-center rounded-[5px] border transition-colors",
|
|
483
494
|
"focus-visible:outline-solid focus-visible:outline-2 focus-visible:outline-border-focus",
|
|
484
495
|
checked ? "border-transparent bg-brand-primaryAction text-brand-onprimary" : "border-border-interactive bg-surface hover:border-brand-primaryAction"
|
|
@@ -551,11 +562,12 @@ var KIND = {
|
|
|
551
562
|
category: "px-2 py-1"
|
|
552
563
|
};
|
|
553
564
|
var CATEGORY = "bg-subtle font-medium text-text-tertiary";
|
|
554
|
-
function Badge({ tone = "neutral", kind = "label", dot = false, children, className }) {
|
|
565
|
+
function Badge({ tone = "neutral", kind = "label", dot = false, children, className, testIdPrefix }) {
|
|
555
566
|
return /* @__PURE__ */ jsxs5(
|
|
556
567
|
"span",
|
|
557
568
|
{
|
|
558
569
|
style: kind === "category" ? void 0 : TONE_STYLE[tone],
|
|
570
|
+
"data-testid": testIdPrefix,
|
|
559
571
|
className: cn(
|
|
560
572
|
// `inline-flex` + `gap` so a leading icon sits on the text baseline
|
|
561
573
|
// without every caller re-inventing the spacing. `shrink-0` because a
|
|
@@ -577,7 +589,7 @@ function Badge({ tone = "neutral", kind = "label", dot = false, children, classN
|
|
|
577
589
|
// src/Delta.tsx
|
|
578
590
|
import { ArrowDownRight, ArrowUpRight } from "lucide-react";
|
|
579
591
|
import { jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
580
|
-
function Delta({ value, suffix = "%", arrow = false, period, className }) {
|
|
592
|
+
function Delta({ value, suffix = "%", arrow = false, period, className, testIdPrefix }) {
|
|
581
593
|
const up = value >= 0;
|
|
582
594
|
return /* @__PURE__ */ jsxs6(
|
|
583
595
|
"span",
|
|
@@ -587,6 +599,7 @@ function Delta({ value, suffix = "%", arrow = false, period, className }) {
|
|
|
587
599
|
up ? "text-text-success" : "text-text-danger",
|
|
588
600
|
className
|
|
589
601
|
),
|
|
602
|
+
"data-testid": testIdPrefix,
|
|
590
603
|
children: [
|
|
591
604
|
arrow && (up ? /* @__PURE__ */ jsx6(ArrowUpRight, { size: 13, "aria-hidden": "true" }) : /* @__PURE__ */ jsx6(ArrowDownRight, { size: 13, "aria-hidden": "true" })),
|
|
592
605
|
up ? "+" : "\u2212",
|
|
@@ -599,6 +612,7 @@ function Delta({ value, suffix = "%", arrow = false, period, className }) {
|
|
|
599
612
|
}
|
|
600
613
|
|
|
601
614
|
// src/CheckBox.tsx
|
|
615
|
+
import { forwardRef } from "react";
|
|
602
616
|
import { Check as Check2, Minus } from "lucide-react";
|
|
603
617
|
import { jsx as jsx7 } from "react/jsx-runtime";
|
|
604
618
|
function boxClass(on, disabled) {
|
|
@@ -612,28 +626,19 @@ function Glyph({ checked, indeterminate }) {
|
|
|
612
626
|
if (indeterminate) return /* @__PURE__ */ jsx7(Minus, { size: 13, strokeWidth: 3 });
|
|
613
627
|
return checked ? /* @__PURE__ */ jsx7(Check2, { size: 13, strokeWidth: 3 }) : null;
|
|
614
628
|
}
|
|
615
|
-
|
|
616
|
-
checked,
|
|
617
|
-
indeterminate,
|
|
618
|
-
onChange,
|
|
619
|
-
ariaLabel,
|
|
620
|
-
disabled,
|
|
621
|
-
stopPropagation = true,
|
|
622
|
-
testId,
|
|
623
|
-
title,
|
|
624
|
-
className
|
|
625
|
-
}) {
|
|
629
|
+
var CheckBox = forwardRef(function CheckBox2({ checked, indeterminate, onChange, ariaLabel, disabled, stopPropagation = true, testId, testIdPrefix, title, className }, ref) {
|
|
626
630
|
const on = checked || !!indeterminate;
|
|
627
631
|
return /* @__PURE__ */ jsx7(
|
|
628
632
|
"button",
|
|
629
633
|
{
|
|
634
|
+
ref,
|
|
630
635
|
type: "button",
|
|
631
636
|
role: "checkbox",
|
|
632
637
|
"aria-checked": indeterminate ? "mixed" : checked,
|
|
633
638
|
"aria-label": ariaLabel,
|
|
634
639
|
title,
|
|
635
640
|
disabled,
|
|
636
|
-
"data-testid": testId,
|
|
641
|
+
"data-testid": testId ?? testIdPrefix,
|
|
637
642
|
onClick: (e) => {
|
|
638
643
|
if (stopPropagation) e.stopPropagation();
|
|
639
644
|
onChange();
|
|
@@ -651,10 +656,21 @@ function CheckBox({
|
|
|
651
656
|
children: /* @__PURE__ */ jsx7(Glyph, { checked, indeterminate })
|
|
652
657
|
}
|
|
653
658
|
);
|
|
654
|
-
}
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
659
|
+
});
|
|
660
|
+
CheckBox.displayName = "CheckBox";
|
|
661
|
+
var CheckBoxBox = forwardRef(function CheckBoxBox2({ checked, indeterminate, disabled, className, testIdPrefix }, ref) {
|
|
662
|
+
return /* @__PURE__ */ jsx7(
|
|
663
|
+
"span",
|
|
664
|
+
{
|
|
665
|
+
ref,
|
|
666
|
+
"aria-hidden": "true",
|
|
667
|
+
"data-testid": testIdPrefix,
|
|
668
|
+
className: cn(boxClass(checked || !!indeterminate, disabled), className),
|
|
669
|
+
children: /* @__PURE__ */ jsx7(Glyph, { checked, indeterminate })
|
|
670
|
+
}
|
|
671
|
+
);
|
|
672
|
+
});
|
|
673
|
+
CheckBoxBox.displayName = "CheckBoxBox";
|
|
658
674
|
|
|
659
675
|
// src/DateRangeFilter.tsx
|
|
660
676
|
import { useEffect as useEffect3, useId as useId2, useLayoutEffect, useMemo as useMemo2, useRef as useRef3, useState as useState3 } from "react";
|
|
@@ -814,6 +830,7 @@ function DateRangeFilter({
|
|
|
814
830
|
initialRange,
|
|
815
831
|
compare,
|
|
816
832
|
onApply,
|
|
833
|
+
className,
|
|
817
834
|
testIdPrefix,
|
|
818
835
|
granularity = "day",
|
|
819
836
|
formatDate,
|
|
@@ -931,7 +948,7 @@ function DateRangeFilter({
|
|
|
931
948
|
setFlipBelow(ref.current.getBoundingClientRect().top < popRef.current.offsetHeight + 16);
|
|
932
949
|
}, [open, placement]);
|
|
933
950
|
const above = placement === "above" && !flipBelow;
|
|
934
|
-
return /* @__PURE__ */ jsxs7("div", { className: "relative", ref, children: [
|
|
951
|
+
return /* @__PURE__ */ jsxs7("div", { className: cn("relative", className), ref, "data-testid": testIdPrefix, children: [
|
|
935
952
|
/* @__PURE__ */ jsxs7(
|
|
936
953
|
"button",
|
|
937
954
|
{
|
|
@@ -971,7 +988,7 @@ function DateRangeFilter({
|
|
|
971
988
|
type: "button",
|
|
972
989
|
"data-testid": testIdPrefix && `${testIdPrefix}-option-${slug2(s)}`,
|
|
973
990
|
onClick: () => choosePreset(s),
|
|
974
|
-
className: `rounded-control px-3 py-2 text-left text-dense font-medium transition-colors ${shortcut === s ? "bg-subtle text-text-primary" : "text-text-secondary hover:bg-subtle hover:text-text-primary"}`,
|
|
991
|
+
className: `rounded-control px-3 py-2 text-left text-dense font-medium transition-colors focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-border-focus ${shortcut === s ? "bg-subtle text-text-primary" : "text-text-secondary hover:bg-subtle hover:text-text-primary"}`,
|
|
975
992
|
children: s
|
|
976
993
|
},
|
|
977
994
|
s
|
|
@@ -1012,7 +1029,7 @@ function DateRangeFilter({
|
|
|
1012
1029
|
else if (end && isEnd) band = "left-0 right-1/2";
|
|
1013
1030
|
else band = "left-0 right-0";
|
|
1014
1031
|
}
|
|
1015
|
-
return /* @__PURE__ */ jsxs7("button", { type: "button", onClick: () => pickDay(d), className: "relative flex h-9 items-center justify-center", children: [
|
|
1032
|
+
return /* @__PURE__ */ jsxs7("button", { type: "button", onClick: () => pickDay(d), className: "relative flex h-9 items-center justify-center focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-border-focus", children: [
|
|
1016
1033
|
band && /* @__PURE__ */ jsx8("span", { className: `absolute inset-y-[3px] bg-ai-tint ${band}`, "aria-hidden": "true" }),
|
|
1017
1034
|
/* @__PURE__ */ jsx8(
|
|
1018
1035
|
"span",
|
|
@@ -1057,8 +1074,8 @@ function DateRangeFilter({
|
|
|
1057
1074
|
] }),
|
|
1058
1075
|
/* @__PURE__ */ jsxs7("div", { className: "mt-4 flex items-center justify-end gap-2", children: [
|
|
1059
1076
|
monthly && /* @__PURE__ */ jsx8("span", { className: "mr-auto text-xs text-text-tertiary", children: "Data is monthly, so ranges cover whole months." }),
|
|
1060
|
-
/* @__PURE__ */ jsx8("button", { type: "button", "data-testid": testIdPrefix && `${testIdPrefix}-cancel`, onClick: () => setOpen(false), className: "rounded-control border border-border-default bg-surface px-5 py-2 text-dense font-semibold text-text-primary transition-colors hover:bg-subtle", children: "Cancel" }),
|
|
1061
|
-
/* @__PURE__ */ jsx8("button", { type: "button", "data-testid": testIdPrefix && `${testIdPrefix}-apply`, onClick: apply, disabled: !canApply, className: "rounded-control bg-brand-primaryAction px-5 py-2 text-dense font-semibold text-brand-onprimary transition-[filter] hover:brightness-110 disabled:cursor-not-allowed disabled:opacity-50", children: "Apply" })
|
|
1077
|
+
/* @__PURE__ */ jsx8("button", { type: "button", "data-testid": testIdPrefix && `${testIdPrefix}-cancel`, onClick: () => setOpen(false), className: "rounded-control border border-border-default bg-surface px-5 py-2 text-dense font-semibold text-text-primary transition-colors hover:bg-subtle focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-border-focus", children: "Cancel" }),
|
|
1078
|
+
/* @__PURE__ */ jsx8("button", { type: "button", "data-testid": testIdPrefix && `${testIdPrefix}-apply`, onClick: apply, disabled: !canApply, className: "rounded-control bg-brand-primaryAction px-5 py-2 text-dense font-semibold text-brand-onprimary transition-[filter] hover:brightness-110 disabled:cursor-not-allowed disabled:opacity-50 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-border-focus", children: "Apply" })
|
|
1062
1079
|
] })
|
|
1063
1080
|
] })
|
|
1064
1081
|
]
|
|
@@ -1073,11 +1090,11 @@ function Field({ label, value }) {
|
|
|
1073
1090
|
] });
|
|
1074
1091
|
}
|
|
1075
1092
|
function NavBtn({ children, onClick, ...rest }) {
|
|
1076
|
-
return /* @__PURE__ */ jsx8("button", { type: "button", onClick, className: "flex h-7 w-7 items-center justify-center rounded-full text-text-secondary transition-colors hover:bg-subtle hover:text-text-primary", ...rest, children });
|
|
1093
|
+
return /* @__PURE__ */ jsx8("button", { type: "button", onClick, className: "flex h-7 w-7 items-center justify-center rounded-full text-text-secondary transition-colors hover:bg-subtle hover:text-text-primary focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-border-focus", ...rest, children });
|
|
1077
1094
|
}
|
|
1078
1095
|
|
|
1079
1096
|
// src/SearchBar.tsx
|
|
1080
|
-
import { useEffect as useEffect4, useId as useId3, useLayoutEffect as useLayoutEffect2, useRef as useRef4, useState as useState4 } from "react";
|
|
1097
|
+
import { forwardRef as forwardRef2, useEffect as useEffect4, useId as useId3, useLayoutEffect as useLayoutEffect2, useRef as useRef4, useState as useState4 } from "react";
|
|
1081
1098
|
import { AlertCircle, Check as Check3, ChevronDown as ChevronDown3, Search as Search3, X as X2 } from "lucide-react";
|
|
1082
1099
|
import { Fragment as Fragment2, jsx as jsx9, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
1083
1100
|
var HEIGHT = { sm: "h-8", md: "h-10", lg: "h-11" };
|
|
@@ -1105,10 +1122,7 @@ function mergeAdCodes(existing, incoming) {
|
|
|
1105
1122
|
function slug3(value) {
|
|
1106
1123
|
return value.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/(^-|-$)/g, "");
|
|
1107
1124
|
}
|
|
1108
|
-
function
|
|
1109
|
-
return classes.filter(Boolean).join(" ");
|
|
1110
|
-
}
|
|
1111
|
-
function SearchBar({
|
|
1125
|
+
var SearchBar = forwardRef2(function SearchBar2({
|
|
1112
1126
|
placeholder = "Search\u2026",
|
|
1113
1127
|
value,
|
|
1114
1128
|
onChange,
|
|
@@ -1122,10 +1136,15 @@ function SearchBar({
|
|
|
1122
1136
|
onDownloadAdCodes,
|
|
1123
1137
|
className,
|
|
1124
1138
|
testIdPrefix
|
|
1125
|
-
}) {
|
|
1139
|
+
}, forwardedRef) {
|
|
1126
1140
|
const [open, setOpen] = useState4(false);
|
|
1127
1141
|
const ref = useRef4(null);
|
|
1128
1142
|
const input = useRef4(null);
|
|
1143
|
+
const setInput = (el) => {
|
|
1144
|
+
input.current = el;
|
|
1145
|
+
if (typeof forwardedRef === "function") forwardedRef(el);
|
|
1146
|
+
else if (forwardedRef) forwardedRef.current = el;
|
|
1147
|
+
};
|
|
1129
1148
|
const [codesOpen, setCodesOpen] = useState4(false);
|
|
1130
1149
|
const codesRef = useRef4(null);
|
|
1131
1150
|
const codesPopover = useRef4(null);
|
|
@@ -1180,11 +1199,12 @@ function SearchBar({
|
|
|
1180
1199
|
return /* @__PURE__ */ jsxs8(
|
|
1181
1200
|
"div",
|
|
1182
1201
|
{
|
|
1183
|
-
className:
|
|
1202
|
+
className: cn(
|
|
1184
1203
|
"relative flex min-w-[200px] flex-1 items-stretch rounded-control border border-border-strong bg-input focus-within:outline-2 focus-within:outline-offset-1 focus-within:outline-border-focus",
|
|
1185
1204
|
HEIGHT[size],
|
|
1186
1205
|
className
|
|
1187
1206
|
),
|
|
1207
|
+
"data-testid": testIdPrefix,
|
|
1188
1208
|
children: [
|
|
1189
1209
|
/* @__PURE__ */ jsxs8(
|
|
1190
1210
|
"div",
|
|
@@ -1202,7 +1222,7 @@ function SearchBar({
|
|
|
1202
1222
|
adCodeMode && adCodes.length > 0 && /* @__PURE__ */ jsxs8(
|
|
1203
1223
|
"span",
|
|
1204
1224
|
{
|
|
1205
|
-
className:
|
|
1225
|
+
className: cn(
|
|
1206
1226
|
"inline-flex shrink-0 items-center gap-1 rounded-full py-0.5 pl-2 pr-1 text-xs font-medium",
|
|
1207
1227
|
hasMisses ? "bg-status-danger/15 text-text-danger" : "bg-subtle text-text-primary"
|
|
1208
1228
|
),
|
|
@@ -1239,7 +1259,7 @@ function SearchBar({
|
|
|
1239
1259
|
/* @__PURE__ */ jsx9(
|
|
1240
1260
|
"input",
|
|
1241
1261
|
{
|
|
1242
|
-
ref:
|
|
1262
|
+
ref: setInput,
|
|
1243
1263
|
type: "text",
|
|
1244
1264
|
value,
|
|
1245
1265
|
onChange: (e) => onChange?.(e.target.value),
|
|
@@ -1272,7 +1292,7 @@ function SearchBar({
|
|
|
1272
1292
|
return /* @__PURE__ */ jsxs8(
|
|
1273
1293
|
"li",
|
|
1274
1294
|
{
|
|
1275
|
-
className:
|
|
1295
|
+
className: cn(
|
|
1276
1296
|
"inline-flex items-center gap-1 rounded-full py-1 pl-2.5 pr-1.5 text-card-title",
|
|
1277
1297
|
missed ? "bg-status-danger/15 text-text-danger" : "bg-subtle text-text-primary"
|
|
1278
1298
|
),
|
|
@@ -1375,7 +1395,7 @@ function SearchBar({
|
|
|
1375
1395
|
{
|
|
1376
1396
|
size: 14,
|
|
1377
1397
|
"aria-hidden": "true",
|
|
1378
|
-
className:
|
|
1398
|
+
className: cn("shrink-0 text-text-secondary transition-transform", open && "rotate-180")
|
|
1379
1399
|
}
|
|
1380
1400
|
)
|
|
1381
1401
|
]
|
|
@@ -1464,7 +1484,8 @@ function SearchBar({
|
|
|
1464
1484
|
]
|
|
1465
1485
|
}
|
|
1466
1486
|
);
|
|
1467
|
-
}
|
|
1487
|
+
});
|
|
1488
|
+
SearchBar.displayName = "SearchBar";
|
|
1468
1489
|
function Divider() {
|
|
1469
1490
|
return /* @__PURE__ */ jsx9("div", { className: "my-2.5 border-t border-border-default", "aria-hidden": "true" });
|
|
1470
1491
|
}
|
|
@@ -1533,12 +1554,12 @@ function RadioOption({
|
|
|
1533
1554
|
},
|
|
1534
1555
|
role: "radio",
|
|
1535
1556
|
"aria-checked": checked,
|
|
1536
|
-
className: "flex items-center gap-1.5 text-dense font-medium text-text-primary",
|
|
1557
|
+
className: "flex items-center gap-1.5 text-dense font-medium text-text-primary focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-border-focus",
|
|
1537
1558
|
children: [
|
|
1538
1559
|
/* @__PURE__ */ jsx9(
|
|
1539
1560
|
"span",
|
|
1540
1561
|
{
|
|
1541
|
-
className:
|
|
1562
|
+
className: cn(
|
|
1542
1563
|
"flex h-4 w-4 shrink-0 items-center justify-center rounded-full border-2 transition-colors",
|
|
1543
1564
|
checked ? "border-brand-primaryAction" : "border-border-interactive"
|
|
1544
1565
|
),
|
|
@@ -1600,13 +1621,15 @@ function SectionRail({
|
|
|
1600
1621
|
subtitle,
|
|
1601
1622
|
viewAllLabel,
|
|
1602
1623
|
viewAllHref,
|
|
1603
|
-
children
|
|
1624
|
+
children,
|
|
1625
|
+
className,
|
|
1626
|
+
testIdPrefix
|
|
1604
1627
|
}) {
|
|
1605
1628
|
const scrollRef = useRef5(null);
|
|
1606
1629
|
const scroll = (direction) => {
|
|
1607
1630
|
scrollRef.current?.scrollBy({ left: direction * 320, behavior: "smooth" });
|
|
1608
1631
|
};
|
|
1609
|
-
return /* @__PURE__ */ jsxs9("section", { className: "flex flex-col gap-4", children: [
|
|
1632
|
+
return /* @__PURE__ */ jsxs9("section", { className: cn("flex flex-col gap-4", className), "data-testid": testIdPrefix, children: [
|
|
1610
1633
|
/* @__PURE__ */ jsxs9("header", { className: "flex flex-col gap-3 sm:flex-row sm:items-end sm:justify-between", children: [
|
|
1611
1634
|
/* @__PURE__ */ jsxs9("div", { children: [
|
|
1612
1635
|
/* @__PURE__ */ jsx10(
|
|
@@ -1636,7 +1659,7 @@ function SectionRail({
|
|
|
1636
1659
|
type: "button",
|
|
1637
1660
|
onClick: () => scroll(-1),
|
|
1638
1661
|
"aria-label": "Previous",
|
|
1639
|
-
className: "hidden h-10 w-10 items-center justify-center rounded-control border border-border-default text-text-secondary transition-colors hover:bg-subtle hover:text-text-primary sm:flex lg:hidden",
|
|
1662
|
+
className: "hidden h-10 w-10 items-center justify-center rounded-control border border-border-default text-text-secondary transition-colors hover:bg-subtle hover:text-text-primary focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-border-focus sm:flex lg:hidden",
|
|
1640
1663
|
children: /* @__PURE__ */ jsx10(ChevronLeft2, { size: 16 })
|
|
1641
1664
|
}
|
|
1642
1665
|
),
|
|
@@ -1646,7 +1669,7 @@ function SectionRail({
|
|
|
1646
1669
|
type: "button",
|
|
1647
1670
|
onClick: () => scroll(1),
|
|
1648
1671
|
"aria-label": "Next",
|
|
1649
|
-
className: "hidden h-10 w-10 items-center justify-center rounded-control border border-border-default text-text-secondary transition-colors hover:bg-subtle hover:text-text-primary sm:flex lg:hidden",
|
|
1672
|
+
className: "hidden h-10 w-10 items-center justify-center rounded-control border border-border-default text-text-secondary transition-colors hover:bg-subtle hover:text-text-primary focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-border-focus sm:flex lg:hidden",
|
|
1650
1673
|
children: /* @__PURE__ */ jsx10(ChevronRight2, { size: 16 })
|
|
1651
1674
|
}
|
|
1652
1675
|
)
|
|
@@ -1668,10 +1691,7 @@ import { useEffect as useEffect5, useRef as useRef6, useState as useState5 } fro
|
|
|
1668
1691
|
import { Check as Check4, ChevronDown as ChevronDown4 } from "lucide-react";
|
|
1669
1692
|
import { jsx as jsx11, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
1670
1693
|
var FINAL_ONLY_TEXT = "Trims time periods to data that has finalized across the selected media formats. Some formats (e.g. Network TV and Cinema) finalize later, so the most recent periods may still change. Turn on for stable, report-ready numbers.";
|
|
1671
|
-
function
|
|
1672
|
-
return classes.filter(Boolean).join(" ");
|
|
1673
|
-
}
|
|
1674
|
-
function DataScopeFilter({ value, onChange, align = "right" }) {
|
|
1694
|
+
function DataScopeFilter({ value, onChange, align = "right", className, testIdPrefix }) {
|
|
1675
1695
|
const [open, setOpen] = useState5(false);
|
|
1676
1696
|
const ref = useRef6(null);
|
|
1677
1697
|
const display = value ? "Final only" : "All";
|
|
@@ -1692,13 +1712,14 @@ function DataScopeFilter({ value, onChange, align = "right" }) {
|
|
|
1692
1712
|
onChange(v);
|
|
1693
1713
|
setOpen(false);
|
|
1694
1714
|
};
|
|
1695
|
-
return /* @__PURE__ */ jsxs10("div", { className: "relative", ref, children: [
|
|
1715
|
+
return /* @__PURE__ */ jsxs10("div", { className: cn("relative", className), ref, "data-testid": testIdPrefix, children: [
|
|
1696
1716
|
/* @__PURE__ */ jsxs10(
|
|
1697
1717
|
"button",
|
|
1698
1718
|
{
|
|
1699
1719
|
type: "button",
|
|
1700
1720
|
onClick: () => setOpen((o) => !o),
|
|
1701
1721
|
"aria-expanded": open,
|
|
1722
|
+
"data-testid": testIdPrefix && `${testIdPrefix}-trigger`,
|
|
1702
1723
|
className: chipTriggerClass(),
|
|
1703
1724
|
children: [
|
|
1704
1725
|
/* @__PURE__ */ jsx11(ChipContent, { caption: "Data", value: display }),
|
|
@@ -1707,7 +1728,7 @@ function DataScopeFilter({ value, onChange, align = "right" }) {
|
|
|
1707
1728
|
{
|
|
1708
1729
|
size: 14,
|
|
1709
1730
|
"aria-hidden": "true",
|
|
1710
|
-
className:
|
|
1731
|
+
className: cn("shrink-0 text-text-secondary transition-transform", open && "rotate-180")
|
|
1711
1732
|
}
|
|
1712
1733
|
)
|
|
1713
1734
|
]
|
|
@@ -1718,7 +1739,8 @@ function DataScopeFilter({ value, onChange, align = "right" }) {
|
|
|
1718
1739
|
{
|
|
1719
1740
|
role: "group",
|
|
1720
1741
|
"aria-label": "Data",
|
|
1721
|
-
|
|
1742
|
+
"data-testid": testIdPrefix && `${testIdPrefix}-popover`,
|
|
1743
|
+
className: cn(
|
|
1722
1744
|
"absolute top-[calc(100%+8px)] z-30 min-w-[220px] overflow-hidden rounded-card border border-border-default bg-surface p-1 shadow-overlay",
|
|
1723
1745
|
align === "right" ? "right-0" : "left-0"
|
|
1724
1746
|
),
|
|
@@ -1742,13 +1764,13 @@ function Option({
|
|
|
1742
1764
|
type: "button",
|
|
1743
1765
|
"aria-pressed": selected,
|
|
1744
1766
|
onClick,
|
|
1745
|
-
className:
|
|
1746
|
-
"flex items-center gap-2 rounded-control px-2.5 py-2 text-left text-dense transition-colors hover:bg-subtle",
|
|
1767
|
+
className: cn(
|
|
1768
|
+
"flex items-center gap-2 rounded-control px-2.5 py-2 text-left text-dense transition-colors hover:bg-subtle focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-border-focus",
|
|
1747
1769
|
hint ? "flex-1" : "w-full",
|
|
1748
1770
|
selected ? "font-semibold text-text-primary" : "text-text-secondary"
|
|
1749
1771
|
),
|
|
1750
1772
|
children: [
|
|
1751
|
-
/* @__PURE__ */ jsx11(Check4, { size: 14, "aria-hidden": "true", className:
|
|
1773
|
+
/* @__PURE__ */ jsx11(Check4, { size: 14, "aria-hidden": "true", className: cn("shrink-0 text-brand-primaryAction", !selected && "invisible") }),
|
|
1752
1774
|
label
|
|
1753
1775
|
]
|
|
1754
1776
|
}
|
|
@@ -1788,9 +1810,6 @@ function MenuError({ onRetry }) {
|
|
|
1788
1810
|
|
|
1789
1811
|
// src/SelectFilter.tsx
|
|
1790
1812
|
import { jsx as jsx13, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
1791
|
-
function cx4(...classes) {
|
|
1792
|
-
return classes.filter(Boolean).join(" ");
|
|
1793
|
-
}
|
|
1794
1813
|
function slug4(value) {
|
|
1795
1814
|
return value.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/(^-|-$)/g, "");
|
|
1796
1815
|
}
|
|
@@ -1873,7 +1892,7 @@ function SelectFilter({
|
|
|
1873
1892
|
" ",
|
|
1874
1893
|
valueContent
|
|
1875
1894
|
] }) : valueContent;
|
|
1876
|
-
return /* @__PURE__ */ jsxs12("div", { className:
|
|
1895
|
+
return /* @__PURE__ */ jsxs12("div", { className: cn("relative", fullWidth && "w-full"), ref, "data-testid": testIdPrefix, children: [
|
|
1877
1896
|
/* @__PURE__ */ jsxs12(
|
|
1878
1897
|
"button",
|
|
1879
1898
|
{
|
|
@@ -1884,7 +1903,7 @@ function SelectFilter({
|
|
|
1884
1903
|
"aria-haspopup": "listbox",
|
|
1885
1904
|
"aria-label": sm && !inlineCaption ? caption : void 0,
|
|
1886
1905
|
disabled,
|
|
1887
|
-
className:
|
|
1906
|
+
className: cn(
|
|
1888
1907
|
sm ? "flex h-8 items-center gap-1.5 rounded-control border border-border-strong bg-input pl-2.5 pr-2 text-dense font-medium text-text-primary transition-colors hover:bg-subtle focus-visible:outline-solid focus-visible:outline-2 focus-visible:outline-border-focus" : chipTriggerClass(),
|
|
1889
1908
|
"disabled:pointer-events-none disabled:opacity-40",
|
|
1890
1909
|
fullWidth && "w-full justify-between",
|
|
@@ -1897,7 +1916,7 @@ function SelectFilter({
|
|
|
1897
1916
|
{
|
|
1898
1917
|
size: 14,
|
|
1899
1918
|
"aria-hidden": "true",
|
|
1900
|
-
className:
|
|
1919
|
+
className: cn("shrink-0 text-text-secondary transition-transform", open && "rotate-180")
|
|
1901
1920
|
}
|
|
1902
1921
|
)
|
|
1903
1922
|
]
|
|
@@ -1910,7 +1929,7 @@ function SelectFilter({
|
|
|
1910
1929
|
ref: popoverRef,
|
|
1911
1930
|
"data-testid": testIdPrefix && `${testIdPrefix}-popover`,
|
|
1912
1931
|
style: { position: "fixed", top: pos.top, left: pos.left, right: pos.right, width: fullWidth ? pos.width : void 0 },
|
|
1913
|
-
className:
|
|
1932
|
+
className: cn(
|
|
1914
1933
|
"z-[65] flex flex-col overflow-hidden rounded-card border border-border-default bg-surface shadow-overlay",
|
|
1915
1934
|
!fullWidth && (sm ? "w-max min-w-28 max-w-72" : "w-56")
|
|
1916
1935
|
),
|
|
@@ -1929,14 +1948,14 @@ function SelectFilter({
|
|
|
1929
1948
|
onChange(o);
|
|
1930
1949
|
close();
|
|
1931
1950
|
},
|
|
1932
|
-
className: "flex w-full items-center gap-2.5 rounded-control px-2 py-2 text-left transition-colors hover:bg-subtle",
|
|
1951
|
+
className: "flex w-full items-center gap-2.5 rounded-control px-2 py-2 text-left transition-colors hover:bg-subtle focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-border-focus",
|
|
1933
1952
|
children: [
|
|
1934
1953
|
/* @__PURE__ */ jsx13("span", { className: "flex h-4 w-4 shrink-0 items-center justify-center text-brand-primaryAction", children: selected && /* @__PURE__ */ jsx13(Check5, { size: 15, strokeWidth: 3 }) }),
|
|
1935
1954
|
renderIcon && /* @__PURE__ */ jsx13(OptionIcon, { children: renderIcon(o) }),
|
|
1936
1955
|
/* @__PURE__ */ jsx13(
|
|
1937
1956
|
"span",
|
|
1938
1957
|
{
|
|
1939
|
-
className:
|
|
1958
|
+
className: cn("flex-1 text-sm", selected ? "font-semibold text-text-primary" : "text-text-primary"),
|
|
1940
1959
|
children: o
|
|
1941
1960
|
}
|
|
1942
1961
|
)
|
|
@@ -1953,19 +1972,20 @@ function SelectFilter({
|
|
|
1953
1972
|
}
|
|
1954
1973
|
|
|
1955
1974
|
// src/Card.tsx
|
|
1956
|
-
import { forwardRef } from "react";
|
|
1975
|
+
import { forwardRef as forwardRef3 } from "react";
|
|
1957
1976
|
import { jsx as jsx14, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
1958
|
-
var Card =
|
|
1977
|
+
var Card = forwardRef3(function Card2({ staticCard, title, titleAs: TitleTag = "h3", subtitle, action, className, testIdPrefix, children, ...rest }, ref) {
|
|
1959
1978
|
return /* @__PURE__ */ jsx14(
|
|
1960
1979
|
"article",
|
|
1961
1980
|
{
|
|
1962
1981
|
ref,
|
|
1963
|
-
className:
|
|
1982
|
+
className: cn(
|
|
1964
1983
|
"flex h-full flex-col overflow-hidden rounded-card border border-border-default bg-surface shadow-raised",
|
|
1965
1984
|
// Interactive hover: deeper drop shadow only -- no elevation/transform.
|
|
1966
1985
|
!staticCard && "group transition-shadow hover:shadow-overlay",
|
|
1967
1986
|
className
|
|
1968
|
-
|
|
1987
|
+
),
|
|
1988
|
+
"data-testid": testIdPrefix,
|
|
1969
1989
|
...rest,
|
|
1970
1990
|
children: title ? /* @__PURE__ */ jsxs13("div", { className: "flex flex-1 flex-col p-card-padding", children: [
|
|
1971
1991
|
/* @__PURE__ */ jsxs13("div", { className: "flex items-start justify-between gap-2", children: [
|
|
@@ -1989,7 +2009,7 @@ var NO_RESULTS_BODY = "Your filters may be too narrow, conflict with each other,
|
|
|
1989
2009
|
function noResultsBody(workspaceName) {
|
|
1990
2010
|
return workspaceName ? `Nothing in the \u201C${workspaceName}\u201D workspace matches. ${NO_RESULTS_BODY}` : NO_RESULTS_BODY;
|
|
1991
2011
|
}
|
|
1992
|
-
var PRIMARY_ACTION_CLASS = "rounded-control bg-brand-primaryAction px-3.5 py-2 text-dense font-semibold text-brand-onprimary transition-colors hover:opacity-90";
|
|
2012
|
+
var PRIMARY_ACTION_CLASS = "rounded-control bg-brand-primaryAction px-3.5 py-2 text-dense font-semibold text-brand-onprimary transition-colors hover:opacity-90 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-border-focus";
|
|
1993
2013
|
var QUIET_ACTION_CLASS = "rounded-control text-dense font-medium text-text-link transition-colors hover:underline focus-visible:outline-solid focus-visible:outline-2 focus-visible:outline-border-focus";
|
|
1994
2014
|
function NoResultsEmptyState({
|
|
1995
2015
|
title = NO_RESULTS_TITLE,
|
|
@@ -1999,13 +2019,14 @@ function NoResultsEmptyState({
|
|
|
1999
2019
|
onClearFilters,
|
|
2000
2020
|
onEditFilters,
|
|
2001
2021
|
actions,
|
|
2022
|
+
className,
|
|
2002
2023
|
testIdPrefix
|
|
2003
2024
|
}) {
|
|
2004
2025
|
const bodyText = body ?? noResultsBody(workspaceName);
|
|
2005
2026
|
const showClear = hasFilters !== false && Boolean(onClearFilters);
|
|
2006
2027
|
const showEdit = Boolean(onEditFilters);
|
|
2007
2028
|
const hasActions = showClear || showEdit || Boolean(actions && actions.length > 0);
|
|
2008
|
-
return /* @__PURE__ */ jsxs14("div", { className: "flex flex-col items-center justify-center gap-3 text-center", "data-testid": testIdPrefix, children: [
|
|
2029
|
+
return /* @__PURE__ */ jsxs14("div", { className: cn("flex flex-col items-center justify-center gap-3 text-center", className), "data-testid": testIdPrefix, children: [
|
|
2009
2030
|
/* @__PURE__ */ jsx15("span", { className: "flex h-11 w-11 items-center justify-center rounded-full bg-subtle text-text-tertiary", children: /* @__PURE__ */ jsx15(FilterX, { size: 20, "aria-hidden": "true" }) }),
|
|
2010
2031
|
/* @__PURE__ */ jsx15("h2", { className: "text-base font-semibold text-text-primary", children: title }),
|
|
2011
2032
|
/* @__PURE__ */ jsx15("p", { className: "max-w-[420px] text-dense leading-relaxed text-text-secondary", children: bodyText }),
|
|
@@ -2048,11 +2069,18 @@ function NoResultsEmptyState({
|
|
|
2048
2069
|
import { useEffect as useEffect7, useRef as useRef8, useState as useState7 } from "react";
|
|
2049
2070
|
import { ChevronDown as ChevronDown6, X as X3 } from "lucide-react";
|
|
2050
2071
|
import { jsx as jsx16, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
2051
|
-
function
|
|
2052
|
-
return
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
|
|
2072
|
+
function WorkspaceSelectedCard({ groups, className, testIdPrefix }) {
|
|
2073
|
+
return /* @__PURE__ */ jsx16(
|
|
2074
|
+
"aside",
|
|
2075
|
+
{
|
|
2076
|
+
className: cn(
|
|
2077
|
+
"sticky top-4 flex min-w-0 flex-col gap-4 self-start rounded-card border border-border-default bg-surface px-5 pb-5 pt-4 shadow-raised sm:px-6 sm:pb-6",
|
|
2078
|
+
className
|
|
2079
|
+
),
|
|
2080
|
+
"data-testid": testIdPrefix,
|
|
2081
|
+
children: /* @__PURE__ */ jsx16("div", { className: "flex flex-col divide-y divide-border-default", children: groups.map((g) => /* @__PURE__ */ jsx16(SummaryGroupItem, { group: g, testIdPrefix }, g.id)) })
|
|
2082
|
+
}
|
|
2083
|
+
);
|
|
2056
2084
|
}
|
|
2057
2085
|
function SummaryGroupItem({
|
|
2058
2086
|
group,
|
|
@@ -2077,17 +2105,17 @@ function SummaryGroupItem({
|
|
|
2077
2105
|
onClick: () => setOpen((v) => !v),
|
|
2078
2106
|
"aria-expanded": open,
|
|
2079
2107
|
"data-testid": testIdPrefix && `${testIdPrefix}-group-${group.id}`,
|
|
2080
|
-
className: "flex w-full min-w-0 items-center gap-2 text-left",
|
|
2108
|
+
className: "flex w-full min-w-0 items-center gap-2 text-left focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-border-focus",
|
|
2081
2109
|
children: [
|
|
2082
2110
|
/* @__PURE__ */ jsx16(
|
|
2083
2111
|
ChevronDown6,
|
|
2084
2112
|
{
|
|
2085
2113
|
size: 14,
|
|
2086
2114
|
"aria-hidden": "true",
|
|
2087
|
-
className:
|
|
2115
|
+
className: cn("shrink-0 text-text-secondary transition-transform", !open && "-rotate-90")
|
|
2088
2116
|
}
|
|
2089
2117
|
),
|
|
2090
|
-
/* @__PURE__ */ jsx16("span", { className:
|
|
2118
|
+
/* @__PURE__ */ jsx16("span", { className: cn("truncate font-semibold text-text-primary", nested ? "text-xs" : "text-dense"), children: group.label }),
|
|
2091
2119
|
/* @__PURE__ */ jsx16("span", { className: "shrink-0 rounded-full bg-subtle px-1.5 py-0.5 text-micro font-semibold text-text-secondary", children: ownCount })
|
|
2092
2120
|
]
|
|
2093
2121
|
}
|
|
@@ -2109,7 +2137,7 @@ function SummaryGroupItem({
|
|
|
2109
2137
|
type: "button",
|
|
2110
2138
|
"aria-label": `Remove ${item.name}`,
|
|
2111
2139
|
onClick: () => group.onRemove(item.id),
|
|
2112
|
-
className: "flex h-5 w-5 shrink-0 items-center justify-center rounded-control text-text-secondary hover:bg-subtle hover:text-text-danger",
|
|
2140
|
+
className: "flex h-5 w-5 shrink-0 items-center justify-center rounded-control text-text-secondary hover:bg-subtle hover:text-text-danger focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-border-focus",
|
|
2113
2141
|
children: /* @__PURE__ */ jsx16(X3, { size: 12, "aria-hidden": "true" })
|
|
2114
2142
|
}
|
|
2115
2143
|
)
|
|
@@ -2123,7 +2151,7 @@ function SummaryGroupItem({
|
|
|
2123
2151
|
type: "button",
|
|
2124
2152
|
onClick: group.onRemoveAll,
|
|
2125
2153
|
"data-testid": testIdPrefix && `${testIdPrefix}-remove-all-${group.id}`,
|
|
2126
|
-
className: "mt-0.5 self-start text-micro font-medium text-text-link hover:underline",
|
|
2154
|
+
className: "mt-0.5 self-start text-micro font-medium text-text-link hover:underline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-border-focus",
|
|
2127
2155
|
children: "Remove all"
|
|
2128
2156
|
}
|
|
2129
2157
|
)
|
|
@@ -2143,10 +2171,12 @@ var LEGEND_WIDTHS = [58, 44, 66, 50, 38, 62, 46, 54];
|
|
|
2143
2171
|
function AxisFrame({
|
|
2144
2172
|
height,
|
|
2145
2173
|
xTicks,
|
|
2146
|
-
children
|
|
2174
|
+
children,
|
|
2175
|
+
className,
|
|
2176
|
+
testIdPrefix
|
|
2147
2177
|
}) {
|
|
2148
2178
|
const gutter = xTicks > 0 ? X_AXIS_H : 0;
|
|
2149
|
-
return /* @__PURE__ */ jsx17("div", { className: "w-full", style: { height }, role: "presentation", "aria-hidden": "true", children: /* @__PURE__ */ jsxs16("div", { className: "relative h-full w-full", children: [
|
|
2179
|
+
return /* @__PURE__ */ jsx17("div", { className: cn("w-full", className), style: { height }, role: "presentation", "aria-hidden": "true", "data-testid": testIdPrefix, children: /* @__PURE__ */ jsxs16("div", { className: "relative h-full w-full", children: [
|
|
2150
2180
|
/* @__PURE__ */ jsxs16("div", { className: "absolute inset-y-0 right-0", style: { left: Y_AXIS_W, bottom: gutter }, children: [
|
|
2151
2181
|
GRID_ROWS.map((pct) => /* @__PURE__ */ jsx17(
|
|
2152
2182
|
"div",
|
|
@@ -2203,8 +2233,8 @@ function BlankLegend({ rows, reverse = false }) {
|
|
|
2203
2233
|
// src/BarChartPlaceholder.tsx
|
|
2204
2234
|
import { jsx as jsx18 } from "react/jsx-runtime";
|
|
2205
2235
|
var BAR_PROFILE = [92, 86, 76, 65, 57, 40, 30, 24, 18, 13];
|
|
2206
|
-
function BarChartPlaceholder({ height = 220 }) {
|
|
2207
|
-
return /* @__PURE__ */ jsx18(AxisFrame, { height, xTicks: BAR_PROFILE.length, children: /* @__PURE__ */ jsx18("div", { className: "flex h-full w-full items-end gap-2", children: BAR_PROFILE.map((pct, i) => /* @__PURE__ */ jsx18("div", { className: "flex-1 rounded-t-small bg-subtle", style: { height: `${pct}%` } }, i)) }) });
|
|
2236
|
+
function BarChartPlaceholder({ height = 220, className, testIdPrefix }) {
|
|
2237
|
+
return /* @__PURE__ */ jsx18(AxisFrame, { height, xTicks: BAR_PROFILE.length, className, testIdPrefix, children: /* @__PURE__ */ jsx18("div", { className: "flex h-full w-full items-end gap-2", children: BAR_PROFILE.map((pct, i) => /* @__PURE__ */ jsx18("div", { className: "flex-1 rounded-t-small bg-subtle", style: { height: `${pct}%` } }, i)) }) });
|
|
2208
2238
|
}
|
|
2209
2239
|
|
|
2210
2240
|
// src/LineChartPlaceholder.tsx
|
|
@@ -2216,9 +2246,9 @@ var LINE_SERIES = [
|
|
|
2216
2246
|
[86, 82, 84, 77, 79, 71, 73, 66, 68, 61]
|
|
2217
2247
|
];
|
|
2218
2248
|
var LINE_FORECAST_FROM = 7;
|
|
2219
|
-
function LineChartPlaceholder({ height = 280 }) {
|
|
2249
|
+
function LineChartPlaceholder({ height = 280, className, testIdPrefix }) {
|
|
2220
2250
|
const toPath = (pts, from, to) => pts.slice(from, to).map((y, i) => `${(i + from) / (pts.length - 1) * 100},${y}`).join(" ");
|
|
2221
|
-
return /* @__PURE__ */ jsxs17(AxisFrame, { height, xTicks: LINE_SERIES[0].length, children: [
|
|
2251
|
+
return /* @__PURE__ */ jsxs17(AxisFrame, { height, xTicks: LINE_SERIES[0].length, className, testIdPrefix, children: [
|
|
2222
2252
|
/* @__PURE__ */ jsx19("svg", { viewBox: "0 0 100 100", preserveAspectRatio: "none", className: "absolute inset-0 h-full w-full", children: LINE_SERIES.map((pts, s) => /* @__PURE__ */ jsxs17("g", { children: [
|
|
2223
2253
|
/* @__PURE__ */ jsx19(
|
|
2224
2254
|
"polyline",
|
|
@@ -2266,9 +2296,9 @@ function LineChartPlaceholder({ height = 280 }) {
|
|
|
2266
2296
|
// src/PieChartPlaceholder.tsx
|
|
2267
2297
|
import { jsx as jsx20, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
2268
2298
|
var PIE_SEAMS = [0, 115, 180, 230, 262, 288, 310, 332];
|
|
2269
|
-
function PieChartPlaceholder({ height = 220, legendRows = 8 }) {
|
|
2299
|
+
function PieChartPlaceholder({ height = 220, legendRows = 8, className, testIdPrefix }) {
|
|
2270
2300
|
const r = 45;
|
|
2271
|
-
return /* @__PURE__ */ jsxs18("div", { className: "flex w-full items-center gap-3", style: { height }, role: "presentation", "aria-hidden": "true", children: [
|
|
2301
|
+
return /* @__PURE__ */ jsxs18("div", { className: cn("flex w-full items-center gap-3", className), style: { height }, role: "presentation", "aria-hidden": "true", "data-testid": testIdPrefix, children: [
|
|
2272
2302
|
/* @__PURE__ */ jsx20("div", { className: "flex h-full items-center justify-center", style: { width: "60%" }, children: /* @__PURE__ */ jsxs18("svg", { viewBox: "0 0 100 100", className: "h-full", style: { aspectRatio: "1 / 1" }, children: [
|
|
2273
2303
|
/* @__PURE__ */ jsx20("circle", { cx: "50", cy: "50", r, fill: "var(--mr-color-subtle)" }),
|
|
2274
2304
|
PIE_SEAMS.map((deg) => {
|
|
@@ -2303,7 +2333,9 @@ function StackedColumnPlaceholder({
|
|
|
2303
2333
|
height = 220,
|
|
2304
2334
|
width = 96,
|
|
2305
2335
|
legendRows = 4,
|
|
2306
|
-
axis = false
|
|
2336
|
+
axis = false,
|
|
2337
|
+
className,
|
|
2338
|
+
testIdPrefix
|
|
2307
2339
|
}) {
|
|
2308
2340
|
const column = /* @__PURE__ */ jsx21("div", { className: "flex h-full flex-col overflow-hidden rounded-control bg-subtle", style: { width }, children: columnBands(legendRows).map((pct, i) => /* @__PURE__ */ jsx21(
|
|
2309
2341
|
"div",
|
|
@@ -2317,7 +2349,7 @@ function StackedColumnPlaceholder({
|
|
|
2317
2349
|
},
|
|
2318
2350
|
i
|
|
2319
2351
|
)) });
|
|
2320
|
-
return /* @__PURE__ */ jsxs19("div", { className: "flex w-full gap-4", style: { height }, role: "presentation", "aria-hidden": "true", children: [
|
|
2352
|
+
return /* @__PURE__ */ jsxs19("div", { className: cn("flex w-full gap-4", className), style: { height }, role: "presentation", "aria-hidden": "true", "data-testid": testIdPrefix, children: [
|
|
2321
2353
|
axis ? /* @__PURE__ */ jsx21("div", { style: { width: "55%" }, children: /* @__PURE__ */ jsx21(AxisFrame, { height, xTicks: 0, children: /* @__PURE__ */ jsx21("div", { className: "flex h-full items-stretch justify-center", children: column }) }) }) : /* @__PURE__ */ jsx21("div", { className: "flex items-stretch py-1", children: column }),
|
|
2322
2354
|
/* @__PURE__ */ jsx21(BlankLegend, { rows: legendRows, reverse: !axis })
|
|
2323
2355
|
] });
|
|
@@ -2327,9 +2359,6 @@ function StackedColumnPlaceholder({
|
|
|
2327
2359
|
import { useEffect as useEffect8, useId as useId4, useLayoutEffect as useLayoutEffect4, useRef as useRef9, useState as useState8 } from "react";
|
|
2328
2360
|
import { createPortal as createPortal3 } from "react-dom";
|
|
2329
2361
|
import { jsx as jsx22, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
2330
|
-
function cx6(...parts) {
|
|
2331
|
-
return parts.filter(Boolean).join(" ");
|
|
2332
|
-
}
|
|
2333
2362
|
function addDescribedBy(el, id) {
|
|
2334
2363
|
const ids = (el.getAttribute("aria-describedby") ?? "").split(" ").filter(Boolean);
|
|
2335
2364
|
if (!ids.includes(id)) el.setAttribute("aria-describedby", [...ids, id].join(" "));
|
|
@@ -2526,7 +2555,7 @@ function Tooltip({
|
|
|
2526
2555
|
onMouseEnter: interactive ? keepOpen : void 0,
|
|
2527
2556
|
onMouseLeave: interactive ? hide : void 0,
|
|
2528
2557
|
onTransitionEnd: onBoxTransitionEnd,
|
|
2529
|
-
className:
|
|
2558
|
+
className: cn(
|
|
2530
2559
|
"fixed z-[90] w-max max-w-xs whitespace-normal break-words px-2.5 py-1.5 text-xs leading-snug",
|
|
2531
2560
|
// Fade in/out. The sys duration token rather than a ref one:
|
|
2532
2561
|
// it is what Button's hover/press transition uses, and a
|
|
@@ -2551,6 +2580,7 @@ function Tooltip({
|
|
|
2551
2580
|
{
|
|
2552
2581
|
ref,
|
|
2553
2582
|
className,
|
|
2583
|
+
"data-testid": testIdPrefix,
|
|
2554
2584
|
onMouseEnter: show,
|
|
2555
2585
|
onMouseLeave: hide,
|
|
2556
2586
|
onFocus: (e) => {
|
|
@@ -2570,9 +2600,11 @@ function Tooltip({
|
|
|
2570
2600
|
import { jsx as jsx23, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
2571
2601
|
function AdvertiserNoResults({
|
|
2572
2602
|
query,
|
|
2573
|
-
hint = "Try checking your spelling or searching for a broader brand name."
|
|
2603
|
+
hint = "Try checking your spelling or searching for a broader brand name.",
|
|
2604
|
+
className,
|
|
2605
|
+
testIdPrefix
|
|
2574
2606
|
}) {
|
|
2575
|
-
return /* @__PURE__ */ jsxs21("div", { className: "flex flex-col items-center gap-1.5 px-4 py-8 text-center", children: [
|
|
2607
|
+
return /* @__PURE__ */ jsxs21("div", { className: cn("flex flex-col items-center gap-1.5 px-4 py-8 text-center", className), "data-testid": testIdPrefix, children: [
|
|
2576
2608
|
/* @__PURE__ */ jsxs21("p", { className: "text-dense font-medium text-text-primary", children: [
|
|
2577
2609
|
"No results found for \u201C",
|
|
2578
2610
|
query,
|
|
@@ -2585,14 +2617,17 @@ function AdvertiserNoResults({
|
|
|
2585
2617
|
// src/SelectAllVisible.tsx
|
|
2586
2618
|
import { ListChecks as ListChecks2 } from "lucide-react";
|
|
2587
2619
|
import { jsx as jsx24, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
2588
|
-
function SelectAllVisible({ count, allSelected, onToggle, testIdPrefix }) {
|
|
2620
|
+
function SelectAllVisible({ count, allSelected, onToggle, className, testIdPrefix }) {
|
|
2589
2621
|
return /* @__PURE__ */ jsxs22(
|
|
2590
2622
|
"button",
|
|
2591
2623
|
{
|
|
2592
2624
|
type: "button",
|
|
2593
2625
|
"data-testid": testIdPrefix && `${testIdPrefix}-select-all-visible`,
|
|
2594
2626
|
onClick: onToggle,
|
|
2595
|
-
className:
|
|
2627
|
+
className: cn(
|
|
2628
|
+
"flex w-full items-center gap-2 rounded-control px-2 py-1.5 text-left text-xs font-semibold text-text-link transition-colors hover:bg-subtle focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-border-focus",
|
|
2629
|
+
className
|
|
2630
|
+
),
|
|
2596
2631
|
children: [
|
|
2597
2632
|
/* @__PURE__ */ jsx24(ListChecks2, { size: 14, "aria-hidden": "true" }),
|
|
2598
2633
|
allSelected ? `Deselect ${count} visible` : `Select all ${count} visible`
|
|
@@ -2604,12 +2639,9 @@ function SelectAllVisible({ count, allSelected, onToggle, testIdPrefix }) {
|
|
|
2604
2639
|
// src/SelectedSection.tsx
|
|
2605
2640
|
import { ChevronDown as ChevronDown7 } from "lucide-react";
|
|
2606
2641
|
import { jsx as jsx25, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
2607
|
-
function
|
|
2608
|
-
return parts.filter(Boolean).join(" ");
|
|
2609
|
-
}
|
|
2610
|
-
function SelectedSection({ count, open, onToggle, children, testIdPrefix }) {
|
|
2642
|
+
function SelectedSection({ count, open, onToggle, children, className, testIdPrefix }) {
|
|
2611
2643
|
if (count === 0) return null;
|
|
2612
|
-
return /* @__PURE__ */ jsxs23("div", { className: "flex flex-col", children: [
|
|
2644
|
+
return /* @__PURE__ */ jsxs23("div", { className: cn("flex flex-col", className), "data-testid": testIdPrefix, children: [
|
|
2613
2645
|
/* @__PURE__ */ jsxs23(
|
|
2614
2646
|
"button",
|
|
2615
2647
|
{
|
|
@@ -2617,9 +2649,9 @@ function SelectedSection({ count, open, onToggle, children, testIdPrefix }) {
|
|
|
2617
2649
|
"data-testid": testIdPrefix && `${testIdPrefix}-selected-toggle`,
|
|
2618
2650
|
onClick: onToggle,
|
|
2619
2651
|
"aria-expanded": open,
|
|
2620
|
-
className: "flex w-full items-center gap-1.5 rounded-control px-2 py-1 text-left text-micro font-semibold uppercase tracking-wide text-text-tertiary transition-colors hover:text-text-primary",
|
|
2652
|
+
className: "flex w-full items-center gap-1.5 rounded-control px-2 py-1 text-left text-micro font-semibold uppercase tracking-wide text-text-tertiary transition-colors hover:text-text-primary focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-border-focus",
|
|
2621
2653
|
children: [
|
|
2622
|
-
/* @__PURE__ */ jsx25(ChevronDown7, { size: 13, "aria-hidden": "true", className:
|
|
2654
|
+
/* @__PURE__ */ jsx25(ChevronDown7, { size: 13, "aria-hidden": "true", className: cn("transition-transform", !open && "-rotate-90") }),
|
|
2623
2655
|
"Selected (",
|
|
2624
2656
|
count,
|
|
2625
2657
|
")"
|
|
@@ -2647,7 +2679,7 @@ function arrowKeys(e, row) {
|
|
|
2647
2679
|
items[next]?.focus();
|
|
2648
2680
|
items[next]?.click();
|
|
2649
2681
|
}
|
|
2650
|
-
function Tabs({ items, value, onChange, idPrefix = "tabs", className, ...rest }) {
|
|
2682
|
+
function Tabs({ items, value, onChange, idPrefix = "tabs", className, testIdPrefix, ...rest }) {
|
|
2651
2683
|
const row = useRef10(null);
|
|
2652
2684
|
return /* @__PURE__ */ jsx26(
|
|
2653
2685
|
"div",
|
|
@@ -2655,6 +2687,7 @@ function Tabs({ items, value, onChange, idPrefix = "tabs", className, ...rest })
|
|
|
2655
2687
|
ref: row,
|
|
2656
2688
|
role: "tablist",
|
|
2657
2689
|
"aria-label": rest["aria-label"],
|
|
2690
|
+
"data-testid": testIdPrefix,
|
|
2658
2691
|
onKeyDown: (e) => arrowKeys(e, row.current),
|
|
2659
2692
|
className: cn("flex gap-6 border-b border-border-default", className),
|
|
2660
2693
|
children: items.map((item) => {
|
|
@@ -2665,6 +2698,7 @@ function Tabs({ items, value, onChange, idPrefix = "tabs", className, ...rest })
|
|
|
2665
2698
|
type: "button",
|
|
2666
2699
|
role: "tab",
|
|
2667
2700
|
id: `${idPrefix}-tab-${item.value}`,
|
|
2701
|
+
"data-testid": testIdPrefix && `${testIdPrefix}-tab-${item.value}`,
|
|
2668
2702
|
"aria-controls": `${idPrefix}-panel-${item.value}`,
|
|
2669
2703
|
"aria-selected": on,
|
|
2670
2704
|
tabIndex: on ? 0 : -1,
|
|
@@ -2691,6 +2725,7 @@ function SegmentedControl({
|
|
|
2691
2725
|
onChange,
|
|
2692
2726
|
size = "sm",
|
|
2693
2727
|
className,
|
|
2728
|
+
testIdPrefix,
|
|
2694
2729
|
...rest
|
|
2695
2730
|
}) {
|
|
2696
2731
|
const row = useRef10(null);
|
|
@@ -2700,6 +2735,7 @@ function SegmentedControl({
|
|
|
2700
2735
|
ref: row,
|
|
2701
2736
|
role: "radiogroup",
|
|
2702
2737
|
"aria-label": rest["aria-label"],
|
|
2738
|
+
"data-testid": testIdPrefix,
|
|
2703
2739
|
onKeyDown: (e) => arrowKeys(e, row.current),
|
|
2704
2740
|
className: cn("inline-flex w-fit items-stretch gap-0.5 rounded-full bg-subtle p-1", size === "md" ? "h-10" : "h-8", className),
|
|
2705
2741
|
children: options.map((o) => {
|
|
@@ -2712,7 +2748,7 @@ function SegmentedControl({
|
|
|
2712
2748
|
"aria-checked": on,
|
|
2713
2749
|
tabIndex: on ? 0 : -1,
|
|
2714
2750
|
onClick: () => onChange(o.value),
|
|
2715
|
-
"data-testid": o.testId,
|
|
2751
|
+
"data-testid": o.testId ?? (testIdPrefix && `${testIdPrefix}-option-${o.value}`),
|
|
2716
2752
|
className: cn(
|
|
2717
2753
|
"rounded-full px-3 focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-border-focus",
|
|
2718
2754
|
size === "md" ? "text-sm" : "text-xs",
|
|
@@ -2729,9 +2765,6 @@ function SegmentedControl({
|
|
|
2729
2765
|
|
|
2730
2766
|
// src/SelectionPicker.tsx
|
|
2731
2767
|
import { Fragment as Fragment3, jsx as jsx27, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
2732
|
-
function cx8(...parts) {
|
|
2733
|
-
return parts.filter(Boolean).join(" ");
|
|
2734
|
-
}
|
|
2735
2768
|
function slug5(value) {
|
|
2736
2769
|
return value.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/(^-|-$)/g, "");
|
|
2737
2770
|
}
|
|
@@ -2761,6 +2794,7 @@ function SelectionPicker({
|
|
|
2761
2794
|
loadingMore = false,
|
|
2762
2795
|
onLoadMore,
|
|
2763
2796
|
toolbarExtra,
|
|
2797
|
+
className,
|
|
2764
2798
|
testIdPrefix
|
|
2765
2799
|
}) {
|
|
2766
2800
|
const hasAccountLists = !!accountLists;
|
|
@@ -2823,7 +2857,7 @@ function SelectionPicker({
|
|
|
2823
2857
|
}
|
|
2824
2858
|
};
|
|
2825
2859
|
const rowGridCols = showInfoColumn ? "grid-cols-[36px_1fr_44px]" : "grid-cols-[36px_1fr]";
|
|
2826
|
-
return /* @__PURE__ */ jsxs25("div", { className: "flex flex-col gap-4", children: [
|
|
2860
|
+
return /* @__PURE__ */ jsxs25("div", { className: cn("flex flex-col gap-4", className), "data-testid": testIdPrefix, children: [
|
|
2827
2861
|
helper && /* @__PURE__ */ jsxs25(Fragment3, { children: [
|
|
2828
2862
|
/* @__PURE__ */ jsx27("p", { className: "text-dense text-text-secondary", children: helper }),
|
|
2829
2863
|
/* @__PURE__ */ jsx27("hr", { className: "-mx-5 -mt-2 border-border-default sm:-mx-6" })
|
|
@@ -2883,7 +2917,7 @@ function SelectionPicker({
|
|
|
2883
2917
|
/* @__PURE__ */ jsxs25(
|
|
2884
2918
|
"div",
|
|
2885
2919
|
{
|
|
2886
|
-
className:
|
|
2920
|
+
className: cn(
|
|
2887
2921
|
"grid items-center gap-2 border-b border-border-default bg-canvas px-3 py-2 text-micro font-semibold uppercase tracking-[0.06em] text-text-secondary",
|
|
2888
2922
|
rowGridCols
|
|
2889
2923
|
),
|
|
@@ -2896,10 +2930,10 @@ function SelectionPicker({
|
|
|
2896
2930
|
disabled: toggleable.length === 0,
|
|
2897
2931
|
onChange: toggleAll,
|
|
2898
2932
|
ariaLabel: "Select all",
|
|
2899
|
-
|
|
2933
|
+
testIdPrefix: testIdPrefix && `${testIdPrefix}-select-all`
|
|
2900
2934
|
}
|
|
2901
2935
|
),
|
|
2902
|
-
/* @__PURE__ */ jsx27("div", { className:
|
|
2936
|
+
/* @__PURE__ */ jsx27("div", { className: cn("grid gap-2", gridForColumns(columns)), children: columns.map((c) => /* @__PURE__ */ jsx27("span", { className: c.className, children: c.header }, c.key)) }),
|
|
2903
2937
|
showInfoColumn && /* @__PURE__ */ jsx27("span", { className: "text-right", children: "Info" })
|
|
2904
2938
|
]
|
|
2905
2939
|
}
|
|
@@ -2915,7 +2949,7 @@ function SelectionPicker({
|
|
|
2915
2949
|
{
|
|
2916
2950
|
onClick: isLocked ? void 0 : () => toggleRow(row),
|
|
2917
2951
|
"aria-disabled": isLocked || void 0,
|
|
2918
|
-
className:
|
|
2952
|
+
className: cn(
|
|
2919
2953
|
"grid items-center gap-2 px-3 py-2.5",
|
|
2920
2954
|
rowGridCols,
|
|
2921
2955
|
isLocked ? "cursor-default opacity-50" : "cursor-pointer hover:bg-subtle",
|
|
@@ -2929,10 +2963,10 @@ function SelectionPicker({
|
|
|
2929
2963
|
checked: isSel,
|
|
2930
2964
|
onChange: () => toggleRow(row),
|
|
2931
2965
|
ariaLabel: row.name,
|
|
2932
|
-
|
|
2966
|
+
testIdPrefix: testIdPrefix && `${testIdPrefix}-row-${slug5(row.id)}`
|
|
2933
2967
|
}
|
|
2934
2968
|
),
|
|
2935
|
-
/* @__PURE__ */ jsx27("div", { className:
|
|
2969
|
+
/* @__PURE__ */ jsx27("div", { className: cn("grid gap-2 text-dense text-text-primary", gridForColumns(columns)), children: columns.map((c) => /* @__PURE__ */ jsx27("span", { className: cn("truncate", c.className), children: c.render(row) }, c.key)) }),
|
|
2936
2970
|
showInfoColumn && /* @__PURE__ */ jsx27("div", { className: "flex items-center justify-end", children: kids && kids.length > 0 ? /* @__PURE__ */ jsx27(
|
|
2937
2971
|
"button",
|
|
2938
2972
|
{
|
|
@@ -2946,8 +2980,8 @@ function SelectionPicker({
|
|
|
2946
2980
|
return n;
|
|
2947
2981
|
});
|
|
2948
2982
|
},
|
|
2949
|
-
className: "flex h-7 w-7 items-center justify-center rounded-control text-text-secondary hover:bg-canvas hover:text-text-primary",
|
|
2950
|
-
children: /* @__PURE__ */ jsx27(ChevronRight3, { size: 15, className:
|
|
2983
|
+
className: "flex h-7 w-7 items-center justify-center rounded-control text-text-secondary hover:bg-canvas hover:text-text-primary focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-border-focus",
|
|
2984
|
+
children: /* @__PURE__ */ jsx27(ChevronRight3, { size: 15, className: cn("transition-transform", isOpen && "rotate-90") })
|
|
2951
2985
|
}
|
|
2952
2986
|
) : /* @__PURE__ */ jsx27(
|
|
2953
2987
|
"span",
|
|
@@ -2974,8 +3008,8 @@ function SelectionPicker({
|
|
|
2974
3008
|
type: "button",
|
|
2975
3009
|
disabled: kidSel,
|
|
2976
3010
|
onClick: () => addRows([kid]),
|
|
2977
|
-
className:
|
|
2978
|
-
"inline-flex items-center gap-1 rounded-control px-2 py-1 text-xs font-medium",
|
|
3011
|
+
className: cn(
|
|
3012
|
+
"inline-flex items-center gap-1 rounded-control px-2 py-1 text-xs font-medium focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-border-focus",
|
|
2979
3013
|
kidSel ? "text-text-tertiary" : "text-text-link hover:bg-subtle"
|
|
2980
3014
|
),
|
|
2981
3015
|
children: [
|
|
@@ -2998,7 +3032,7 @@ function SelectionPicker({
|
|
|
2998
3032
|
onClick: onLoadMore,
|
|
2999
3033
|
disabled: loadingMore,
|
|
3000
3034
|
"data-testid": testIdPrefix && `${testIdPrefix}-load-more`,
|
|
3001
|
-
className: "flex w-full items-center justify-center gap-2 border-t border-border-default px-2 py-1.5 text-dense text-brand-primaryAction transition-colors hover:bg-subtle disabled:opacity-50",
|
|
3035
|
+
className: "flex w-full items-center justify-center gap-2 border-t border-border-default px-2 py-1.5 text-dense text-brand-primaryAction transition-colors hover:bg-subtle disabled:opacity-50 focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-border-focus",
|
|
3002
3036
|
children: [
|
|
3003
3037
|
loadingMore ? /* @__PURE__ */ jsx27(Loader2, { size: 13, className: "animate-spin", "aria-hidden": "true" }) : null,
|
|
3004
3038
|
loadingMore ? "Loading\u2026" : "Load more"
|
|
@@ -3019,15 +3053,15 @@ function SelectionPicker({
|
|
|
3019
3053
|
onClick: () => onToggleList?.(list.id),
|
|
3020
3054
|
"aria-pressed": on,
|
|
3021
3055
|
"data-testid": testIdPrefix && `${testIdPrefix}-list-${list.id}`,
|
|
3022
|
-
className:
|
|
3023
|
-
"flex items-center gap-3 rounded-control border px-3.5 py-3 text-left transition-colors",
|
|
3056
|
+
className: cn(
|
|
3057
|
+
"flex items-center gap-3 rounded-control border px-3.5 py-3 text-left transition-colors focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-border-focus",
|
|
3024
3058
|
on ? "border-brand-primaryAction bg-brand-primarySoft" : "border-border-default bg-surface hover:bg-subtle"
|
|
3025
3059
|
),
|
|
3026
3060
|
children: [
|
|
3027
3061
|
/* @__PURE__ */ jsx27(
|
|
3028
3062
|
"span",
|
|
3029
3063
|
{
|
|
3030
|
-
className:
|
|
3064
|
+
className: cn(
|
|
3031
3065
|
"flex h-5 w-5 shrink-0 items-center justify-center rounded-full",
|
|
3032
3066
|
on ? "text-brand-primaryAction" : "text-text-secondary"
|
|
3033
3067
|
),
|
|
@@ -3044,7 +3078,7 @@ function SelectionPicker({
|
|
|
3044
3078
|
formatListDate(list.updatedAt)
|
|
3045
3079
|
] })
|
|
3046
3080
|
] }),
|
|
3047
|
-
/* @__PURE__ */ jsx27("span", { className:
|
|
3081
|
+
/* @__PURE__ */ jsx27("span", { className: cn("shrink-0 text-xs font-medium", on ? "text-brand-primaryAction" : "text-text-secondary"), children: on ? "Added" : "Add" })
|
|
3048
3082
|
]
|
|
3049
3083
|
},
|
|
3050
3084
|
list.id
|
|
@@ -3157,10 +3191,10 @@ function FilterDropdown({
|
|
|
3157
3191
|
onClick: () => setOpen((v) => !v),
|
|
3158
3192
|
"aria-expanded": open,
|
|
3159
3193
|
"data-testid": testIdPrefix && `${testIdPrefix}-filter-${filterSlug}`,
|
|
3160
|
-
className: "inline-flex h-8 items-center gap-1.5 whitespace-nowrap rounded-control border border-border-strong bg-input px-3 text-dense font-medium text-text-secondary transition-colors hover:bg-subtle",
|
|
3194
|
+
className: "inline-flex h-8 items-center gap-1.5 whitespace-nowrap rounded-control border border-border-strong bg-input px-3 text-dense font-medium text-text-secondary transition-colors hover:bg-subtle focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-border-focus",
|
|
3161
3195
|
children: [
|
|
3162
3196
|
label,
|
|
3163
|
-
/* @__PURE__ */ jsx27(ChevronDown8, { size: 13, "aria-hidden": "true", className:
|
|
3197
|
+
/* @__PURE__ */ jsx27(ChevronDown8, { size: 13, "aria-hidden": "true", className: cn("transition-transform", open && "rotate-180") })
|
|
3164
3198
|
]
|
|
3165
3199
|
}
|
|
3166
3200
|
),
|
|
@@ -3187,7 +3221,7 @@ function FilterDropdown({
|
|
|
3187
3221
|
}
|
|
3188
3222
|
)
|
|
3189
3223
|
] }),
|
|
3190
|
-
/* @__PURE__ */ jsx27("div", { className:
|
|
3224
|
+
/* @__PURE__ */ jsx27("div", { className: cn("flex flex-col gap-0.5", searchable && "max-h-60 overflow-y-auto"), children: shownOptions.length === 0 ? /* @__PURE__ */ jsx27("p", { className: "px-2 py-3 text-center text-xs text-text-secondary", children: "No matches." }) : shownOptions.map((opt) => {
|
|
3191
3225
|
const on = active.has(opt);
|
|
3192
3226
|
return /* @__PURE__ */ jsxs25(
|
|
3193
3227
|
"label",
|
|
@@ -3200,7 +3234,7 @@ function FilterDropdown({
|
|
|
3200
3234
|
checked: on,
|
|
3201
3235
|
onChange: () => onToggle(opt),
|
|
3202
3236
|
ariaLabel: opt,
|
|
3203
|
-
|
|
3237
|
+
testIdPrefix: testIdPrefix && `${testIdPrefix}-filter-${filterSlug}-${slug5(opt)}`
|
|
3204
3238
|
}
|
|
3205
3239
|
),
|
|
3206
3240
|
opt
|
|
@@ -3226,9 +3260,6 @@ function gridForColumns(columns) {
|
|
|
3226
3260
|
// src/PublisherBreakdownList.tsx
|
|
3227
3261
|
import { useState as useState10 } from "react";
|
|
3228
3262
|
import { jsx as jsx28, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
3229
|
-
function cx9(...parts) {
|
|
3230
|
-
return parts.filter(Boolean).join(" ");
|
|
3231
|
-
}
|
|
3232
3263
|
var fmtM = (v) => v >= 100 ? `$${Math.round(v)}M` : `$${v.toFixed(1)}M`;
|
|
3233
3264
|
function priorYearAmt(spendN, yoy) {
|
|
3234
3265
|
if (yoy === "NEW" || yoy <= -100) return null;
|
|
@@ -3270,7 +3301,7 @@ var COL_CURRENT = 76;
|
|
|
3270
3301
|
var COL_PREVIOUS = 76;
|
|
3271
3302
|
var COL_YOY = 44;
|
|
3272
3303
|
function MetricListHeader({ className }) {
|
|
3273
|
-
return /* @__PURE__ */ jsxs26("div", { className:
|
|
3304
|
+
return /* @__PURE__ */ jsxs26("div", { className: cn("flex items-baseline gap-2 pb-2", className), children: [
|
|
3274
3305
|
/* @__PURE__ */ jsx28("span", { className: "flex-1" }),
|
|
3275
3306
|
/* @__PURE__ */ jsxs26("span", { className: "flex shrink-0 items-center gap-2 pr-1.5", children: [
|
|
3276
3307
|
/* @__PURE__ */ jsx28("span", { className: "text-right text-micro font-medium text-text-tertiary", style: { width: COL_CURRENT }, children: "Current" }),
|
|
@@ -3285,21 +3316,29 @@ function MetricCells({ spendN, yoy }) {
|
|
|
3285
3316
|
return /* @__PURE__ */ jsxs26("span", { className: "flex shrink-0 items-center gap-2 pr-1.5", children: [
|
|
3286
3317
|
/* @__PURE__ */ jsx28("span", { className: "text-right text-xs font-bold tabular-nums text-text-primary", style: { width: COL_CURRENT }, children: fmtM(spendN) }),
|
|
3287
3318
|
/* @__PURE__ */ jsx28("span", { className: "text-right text-xs font-normal tabular-nums text-text-primary", style: { width: COL_PREVIOUS }, children: prior ?? "\u2014" }),
|
|
3288
|
-
/* @__PURE__ */ jsx28("span", { className: "flex justify-end", style: { width: COL_YOY }, children: yoy === "NEW" ? /* @__PURE__ */ jsx28("span", { className: "rounded-full bg-status-warning/15 px-1.5 text-badge font-semibold text-text-warning", children: "NEW" }) : /* @__PURE__ */ jsxs26("span", { className:
|
|
3319
|
+
/* @__PURE__ */ jsx28("span", { className: "flex justify-end", style: { width: COL_YOY }, children: yoy === "NEW" ? /* @__PURE__ */ jsx28("span", { className: "rounded-full bg-status-warning/15 px-1.5 text-badge font-semibold text-text-warning", children: "NEW" }) : /* @__PURE__ */ jsxs26("span", { className: cn("text-right text-xs font-semibold tabular-nums", up ? "text-text-success" : "text-text-danger"), children: [
|
|
3289
3320
|
up ? "+" : "\u2212",
|
|
3290
3321
|
Math.abs(yoy),
|
|
3291
3322
|
"%"
|
|
3292
3323
|
] }) })
|
|
3293
3324
|
] });
|
|
3294
3325
|
}
|
|
3295
|
-
function PublisherBreakdownList({
|
|
3326
|
+
function PublisherBreakdownList({
|
|
3327
|
+
rows,
|
|
3328
|
+
defaultVisibleCount = 10,
|
|
3329
|
+
padded = true,
|
|
3330
|
+
viewAllHref,
|
|
3331
|
+
renderLogo,
|
|
3332
|
+
className,
|
|
3333
|
+
testIdPrefix
|
|
3334
|
+
}) {
|
|
3296
3335
|
const [showAll, setShowAll] = useState10(false);
|
|
3297
3336
|
const visible = showAll ? rows : rows.slice(0, defaultVisibleCount);
|
|
3298
3337
|
const rowPad = padded ? "px-5" : "";
|
|
3299
|
-
return /* @__PURE__ */ jsxs26("div", { className: "flex flex-col", children: [
|
|
3338
|
+
return /* @__PURE__ */ jsxs26("div", { className: cn("flex flex-col", className), "data-testid": testIdPrefix, children: [
|
|
3300
3339
|
/* @__PURE__ */ jsxs26("div", { className: "flex flex-col", children: [
|
|
3301
3340
|
/* @__PURE__ */ jsx28(MetricListHeader, { className: rowPad }),
|
|
3302
|
-
visible.map((p) => /* @__PURE__ */ jsxs26("div", { className:
|
|
3341
|
+
visible.map((p) => /* @__PURE__ */ jsxs26("div", { className: cn("flex items-center justify-between gap-3 border-t border-border-default/60 py-2.5 first:border-t-0", rowPad), children: [
|
|
3303
3342
|
/* @__PURE__ */ jsxs26("div", { className: "flex min-w-0 items-center gap-2.5", children: [
|
|
3304
3343
|
renderLogo ? renderLogo(p) : /* @__PURE__ */ jsx28(Monogram, { name: p.brand, size: 28 }),
|
|
3305
3344
|
/* @__PURE__ */ jsxs26("div", { className: "min-w-0", children: [
|
|
@@ -3313,24 +3352,24 @@ function PublisherBreakdownList({ rows, defaultVisibleCount = 10, padded = true,
|
|
|
3313
3352
|
/* @__PURE__ */ jsx28(MetricCells, { spendN: p.spendN, yoy: p.yoy })
|
|
3314
3353
|
] }, p.brand))
|
|
3315
3354
|
] }),
|
|
3316
|
-
rows.length > defaultVisibleCount && (viewAllHref ? /* @__PURE__ */ jsx28("div", { className:
|
|
3355
|
+
rows.length > defaultVisibleCount && (viewAllHref ? /* @__PURE__ */ jsx28("div", { className: cn("border-t border-border-default py-3", rowPad), children: /* @__PURE__ */ jsx28("a", { href: viewAllHref, className: "text-xs font-semibold text-text-link hover:underline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-border-focus", children: "See all publishers" }) }) : /* @__PURE__ */ jsxs26("div", { className: cn("flex items-center gap-2 border-t border-border-default py-3 text-xs text-text-tertiary", rowPad), children: [
|
|
3317
3356
|
/* @__PURE__ */ jsxs26("span", { children: [
|
|
3318
3357
|
"Showing ",
|
|
3319
3358
|
visible.length,
|
|
3320
3359
|
" of ",
|
|
3321
3360
|
rows.length
|
|
3322
3361
|
] }),
|
|
3323
|
-
!showAll ? /* @__PURE__ */ jsxs26("button", { type: "button", onClick: () => setShowAll(true), className: "font-semibold text-text-link hover:underline", children: [
|
|
3362
|
+
!showAll ? /* @__PURE__ */ jsxs26("button", { type: "button", onClick: () => setShowAll(true), className: "font-semibold text-text-link hover:underline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-border-focus", children: [
|
|
3324
3363
|
"See all (",
|
|
3325
3364
|
rows.length - defaultVisibleCount,
|
|
3326
3365
|
" more)"
|
|
3327
|
-
] }) : /* @__PURE__ */ jsx28("button", { type: "button", onClick: () => setShowAll(false), className: "font-semibold text-text-link hover:underline", children: "Show less" })
|
|
3366
|
+
] }) : /* @__PURE__ */ jsx28("button", { type: "button", onClick: () => setShowAll(false), className: "font-semibold text-text-link hover:underline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-border-focus", children: "Show less" })
|
|
3328
3367
|
] }))
|
|
3329
3368
|
] });
|
|
3330
3369
|
}
|
|
3331
3370
|
|
|
3332
3371
|
// src/Button.tsx
|
|
3333
|
-
import { forwardRef as
|
|
3372
|
+
import { forwardRef as forwardRef4 } from "react";
|
|
3334
3373
|
import { Slot } from "@radix-ui/react-slot";
|
|
3335
3374
|
import { cva } from "class-variance-authority";
|
|
3336
3375
|
import { Loader2 as Loader22 } from "lucide-react";
|
|
@@ -3395,10 +3434,11 @@ var buttonVariants = cva(
|
|
|
3395
3434
|
}
|
|
3396
3435
|
}
|
|
3397
3436
|
);
|
|
3398
|
-
var Button =
|
|
3399
|
-
({ className, variant, size, iconOnly, asChild = false, loading = false, disabled, children, ...props }, ref) => {
|
|
3437
|
+
var Button = forwardRef4(
|
|
3438
|
+
({ className, testIdPrefix, variant, size, iconOnly, asChild = false, loading = false, disabled, children, ...props }, ref) => {
|
|
3400
3439
|
const shared = {
|
|
3401
3440
|
className: cn(buttonVariants({ variant, size, iconOnly, className })),
|
|
3441
|
+
"data-testid": testIdPrefix,
|
|
3402
3442
|
disabled: disabled || loading,
|
|
3403
3443
|
"aria-busy": loading || void 0,
|
|
3404
3444
|
...props
|
|
@@ -3420,15 +3460,19 @@ function FilterDropdownFooter({
|
|
|
3420
3460
|
onClear,
|
|
3421
3461
|
onApply,
|
|
3422
3462
|
clearLabel = "Clear all",
|
|
3423
|
-
applyLabel = "Apply"
|
|
3463
|
+
applyLabel = "Apply",
|
|
3464
|
+
className,
|
|
3465
|
+
testIdPrefix
|
|
3424
3466
|
}) {
|
|
3425
3467
|
return /* @__PURE__ */ jsxs28(
|
|
3426
3468
|
"div",
|
|
3427
3469
|
{
|
|
3428
3470
|
className: cn(
|
|
3429
3471
|
"flex items-center gap-2 border-t border-border-default p-2",
|
|
3430
|
-
onClear ? "justify-between" : "justify-end"
|
|
3472
|
+
onClear ? "justify-between" : "justify-end",
|
|
3473
|
+
className
|
|
3431
3474
|
),
|
|
3475
|
+
"data-testid": testIdPrefix,
|
|
3432
3476
|
children: [
|
|
3433
3477
|
onClear && /* @__PURE__ */ jsx30(Button, { type: "button", variant: "ghost", size: "sm", onClick: onClear, children: clearLabel }),
|
|
3434
3478
|
/* @__PURE__ */ jsx30(Button, { type: "button", variant: "primary", size: "sm", onClick: onApply, children: applyLabel })
|
|
@@ -3449,7 +3493,9 @@ function NameListModal({
|
|
|
3449
3493
|
onSubmit,
|
|
3450
3494
|
fieldLabel = "List name",
|
|
3451
3495
|
placeholder = "e.g. Q4 prospecting targets",
|
|
3452
|
-
options
|
|
3496
|
+
options,
|
|
3497
|
+
className,
|
|
3498
|
+
testIdPrefix
|
|
3453
3499
|
}) {
|
|
3454
3500
|
const [name, setName] = useState11(initialName);
|
|
3455
3501
|
const [checked, setChecked] = useState11(
|
|
@@ -3505,7 +3551,8 @@ function NameListModal({
|
|
|
3505
3551
|
"aria-modal": "true",
|
|
3506
3552
|
"aria-labelledby": titleId,
|
|
3507
3553
|
onKeyDown: trapTab,
|
|
3508
|
-
|
|
3554
|
+
"data-testid": testIdPrefix,
|
|
3555
|
+
className: cn("w-full max-w-110 rounded-card border border-border-default bg-surface p-5 shadow-overlay", className),
|
|
3509
3556
|
children: [
|
|
3510
3557
|
/* @__PURE__ */ jsx31("h2", { id: titleId, className: "text-base font-semibold text-text-primary", children: title }),
|
|
3511
3558
|
/* @__PURE__ */ jsxs29("div", { className: "mt-4 flex flex-col gap-1.5", children: [
|
|
@@ -3542,9 +3589,9 @@ function NameListModal({
|
|
|
3542
3589
|
// src/FilterChipBar.tsx
|
|
3543
3590
|
import { CircleSlash, X as X4 } from "lucide-react";
|
|
3544
3591
|
import { jsx as jsx32, jsxs as jsxs30 } from "react/jsx-runtime";
|
|
3545
|
-
function FilterChipBar({ chips, onRemove, onClearAll, parkedKeys }) {
|
|
3592
|
+
function FilterChipBar({ chips, onRemove, onClearAll, parkedKeys, className, testIdPrefix }) {
|
|
3546
3593
|
if (chips.length === 0) return null;
|
|
3547
|
-
return /* @__PURE__ */ jsxs30("div", { className: "flex flex-wrap items-center gap-1.5 border-t border-border-default pt-2.5", children: [
|
|
3594
|
+
return /* @__PURE__ */ jsxs30("div", { className: cn("flex flex-wrap items-center gap-1.5 border-t border-border-default pt-2.5", className), "data-testid": testIdPrefix, children: [
|
|
3548
3595
|
chips.map((c) => /* @__PURE__ */ jsx32(
|
|
3549
3596
|
Chip,
|
|
3550
3597
|
{
|
|
@@ -3555,7 +3602,15 @@ function FilterChipBar({ chips, onRemove, onClearAll, parkedKeys }) {
|
|
|
3555
3602
|
},
|
|
3556
3603
|
c.key
|
|
3557
3604
|
)),
|
|
3558
|
-
/* @__PURE__ */ jsx32(
|
|
3605
|
+
/* @__PURE__ */ jsx32(
|
|
3606
|
+
"button",
|
|
3607
|
+
{
|
|
3608
|
+
type: "button",
|
|
3609
|
+
onClick: onClearAll,
|
|
3610
|
+
className: "ml-1 rounded-small text-xs font-medium text-text-link hover:underline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-border-focus",
|
|
3611
|
+
children: "Clear all"
|
|
3612
|
+
}
|
|
3613
|
+
)
|
|
3559
3614
|
] });
|
|
3560
3615
|
}
|
|
3561
3616
|
function Chip({
|
|
@@ -3585,7 +3640,7 @@ function Chip({
|
|
|
3585
3640
|
type: "button",
|
|
3586
3641
|
onClick: onRemove,
|
|
3587
3642
|
"aria-label": `Remove ${groupLabel}: ${label}`,
|
|
3588
|
-
className: "text-text-tertiary transition-colors hover:text-text-primary",
|
|
3643
|
+
className: "rounded-full text-text-tertiary transition-colors hover:text-text-primary focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-border-focus",
|
|
3589
3644
|
children: /* @__PURE__ */ jsx32(X4, { size: 12 })
|
|
3590
3645
|
}
|
|
3591
3646
|
)
|
|
@@ -3604,6 +3659,7 @@ function Chip({
|
|
|
3604
3659
|
}
|
|
3605
3660
|
|
|
3606
3661
|
// src/SortButton.tsx
|
|
3662
|
+
import { forwardRef as forwardRef5 } from "react";
|
|
3607
3663
|
import { ArrowUp, ArrowDown, ArrowUpDown } from "lucide-react";
|
|
3608
3664
|
import { jsx as jsx33, jsxs as jsxs31 } from "react/jsx-runtime";
|
|
3609
3665
|
var ALIGN = {
|
|
@@ -3611,59 +3667,65 @@ var ALIGN = {
|
|
|
3611
3667
|
center: "justify-center text-center",
|
|
3612
3668
|
right: "justify-end text-right"
|
|
3613
3669
|
};
|
|
3614
|
-
|
|
3615
|
-
|
|
3616
|
-
|
|
3617
|
-
|
|
3618
|
-
|
|
3619
|
-
|
|
3620
|
-
|
|
3621
|
-
|
|
3622
|
-
|
|
3623
|
-
|
|
3624
|
-
|
|
3625
|
-
|
|
3626
|
-
|
|
3627
|
-
|
|
3628
|
-
|
|
3629
|
-
|
|
3630
|
-
|
|
3631
|
-
|
|
3632
|
-
|
|
3633
|
-
|
|
3634
|
-
|
|
3635
|
-
|
|
3636
|
-
|
|
3637
|
-
|
|
3638
|
-
|
|
3639
|
-
|
|
3640
|
-
|
|
3641
|
-
|
|
3642
|
-
|
|
3643
|
-
|
|
3644
|
-
|
|
3645
|
-
|
|
3646
|
-
|
|
3647
|
-
|
|
3648
|
-
|
|
3649
|
-
|
|
3650
|
-
|
|
3651
|
-
|
|
3652
|
-
|
|
3653
|
-
|
|
3654
|
-
|
|
3655
|
-
|
|
3656
|
-
|
|
3657
|
-
|
|
3658
|
-
|
|
3659
|
-
|
|
3660
|
-
|
|
3661
|
-
|
|
3662
|
-
|
|
3663
|
-
|
|
3664
|
-
|
|
3665
|
-
|
|
3666
|
-
|
|
3670
|
+
var SortButton = forwardRef5(
|
|
3671
|
+
function SortButton2({
|
|
3672
|
+
label,
|
|
3673
|
+
sortKey,
|
|
3674
|
+
sort,
|
|
3675
|
+
onSort,
|
|
3676
|
+
disabled = false,
|
|
3677
|
+
sortable = true,
|
|
3678
|
+
align = "left",
|
|
3679
|
+
className,
|
|
3680
|
+
testIdPrefix
|
|
3681
|
+
}, ref) {
|
|
3682
|
+
if (!sortable) return /* @__PURE__ */ jsx33("span", { className: cn("inline-flex", ALIGN[align], className), children: label });
|
|
3683
|
+
const active = !disabled && sort.key === sortKey;
|
|
3684
|
+
return /* @__PURE__ */ jsxs31(
|
|
3685
|
+
"button",
|
|
3686
|
+
{
|
|
3687
|
+
ref,
|
|
3688
|
+
type: "button",
|
|
3689
|
+
disabled,
|
|
3690
|
+
onClick: () => onSort(sortKey),
|
|
3691
|
+
"data-testid": testIdPrefix && `${testIdPrefix}-sort-${sortKey}`,
|
|
3692
|
+
className: cn(
|
|
3693
|
+
// ALIGN's text-* overrides the UA default on <button>, which would centre a
|
|
3694
|
+
// label that wraps onto two lines, out of step with the column under it.
|
|
3695
|
+
// `uppercase` is NOT this control imposing a treatment -- it is
|
|
3696
|
+
// restoring one. Every table header row sets uppercase on the <tr>,
|
|
3697
|
+
// and a <button> does not inherit text-transform from its parent
|
|
3698
|
+
// (measured: the <th> computes `uppercase`, the button inside it
|
|
3699
|
+
// computes `none`), so without this a sortable label renders
|
|
3700
|
+
// sentence case beside caps neighbours in the same band.
|
|
3701
|
+
//
|
|
3702
|
+
// Letter-spacing DOES inherit, which is why no tracking is set here.
|
|
3703
|
+
// This control used to set its own `tracking-wide` while every
|
|
3704
|
+
// header row sets `tracking-wider`, so sortable labels rendered
|
|
3705
|
+
// subtly tighter than the fixed headers next to them. A control
|
|
3706
|
+
// should carry exactly the properties that do not inherit, and
|
|
3707
|
+
// nothing more.
|
|
3708
|
+
"group inline-flex items-center gap-1 uppercase transition-colors focus-visible:outline-solid focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-border-focus",
|
|
3709
|
+
ALIGN[align],
|
|
3710
|
+
!disabled && "hover:text-text-primary",
|
|
3711
|
+
className
|
|
3712
|
+
),
|
|
3713
|
+
children: [
|
|
3714
|
+
label,
|
|
3715
|
+
!disabled && (active ? sort.dir === "asc" ? /* @__PURE__ */ jsx33(ArrowUp, { size: 12, "aria-hidden": "true", className: "shrink-0 text-brand-primaryAction" }) : /* @__PURE__ */ jsx33(ArrowDown, { size: 12, "aria-hidden": "true", className: "shrink-0 text-brand-primaryAction" }) : /* @__PURE__ */ jsx33(
|
|
3716
|
+
ArrowUpDown,
|
|
3717
|
+
{
|
|
3718
|
+
size: 12,
|
|
3719
|
+
"aria-hidden": "true",
|
|
3720
|
+
className: "shrink-0 text-text-tertiary opacity-50 transition-opacity group-hover:opacity-100"
|
|
3721
|
+
}
|
|
3722
|
+
))
|
|
3723
|
+
]
|
|
3724
|
+
}
|
|
3725
|
+
);
|
|
3726
|
+
}
|
|
3727
|
+
);
|
|
3728
|
+
SortButton.displayName = "SortButton";
|
|
3667
3729
|
|
|
3668
3730
|
// src/tableSort.ts
|
|
3669
3731
|
function cycleSort(current, key, firstDir = "desc") {
|
|
@@ -3695,9 +3757,9 @@ function pageWindow(current, total) {
|
|
|
3695
3757
|
}
|
|
3696
3758
|
return out;
|
|
3697
3759
|
}
|
|
3698
|
-
function Pager({ page, totalPages, onPage, disabled = false, label = "Pagination" }) {
|
|
3699
|
-
const btn = "flex h-8 min-w-8 items-center justify-center rounded-control px-2 text-dense transition-colors disabled:pointer-events-none disabled:opacity-30";
|
|
3700
|
-
return /* @__PURE__ */ jsxs32("nav", { "aria-label": label, className: "flex items-center gap-1", children: [
|
|
3760
|
+
function Pager({ page, totalPages, onPage, disabled = false, label = "Pagination", className, testIdPrefix }) {
|
|
3761
|
+
const btn = "flex h-8 min-w-8 items-center justify-center rounded-control px-2 text-dense transition-colors disabled:pointer-events-none disabled:opacity-30 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-border-focus";
|
|
3762
|
+
return /* @__PURE__ */ jsxs32("nav", { "aria-label": label, className: cn("flex items-center gap-1", className), "data-testid": testIdPrefix, children: [
|
|
3701
3763
|
/* @__PURE__ */ jsx34(
|
|
3702
3764
|
"button",
|
|
3703
3765
|
{
|
|
@@ -3759,15 +3821,17 @@ var SIZES = {
|
|
|
3759
3821
|
md: "h-7 w-7 text-micro",
|
|
3760
3822
|
lg: "h-11 w-11 text-panel-title"
|
|
3761
3823
|
};
|
|
3762
|
-
function WorkspaceAvatar({ name, size = "md" }) {
|
|
3824
|
+
function WorkspaceAvatar({ name, size = "md", className, testIdPrefix }) {
|
|
3763
3825
|
return /* @__PURE__ */ jsx35(
|
|
3764
3826
|
"span",
|
|
3765
3827
|
{
|
|
3766
3828
|
"aria-hidden": "true",
|
|
3767
3829
|
className: cn(
|
|
3768
3830
|
"flex shrink-0 items-center justify-center rounded-control bg-subtle font-semibold leading-none text-text-secondary",
|
|
3769
|
-
SIZES[size]
|
|
3831
|
+
SIZES[size],
|
|
3832
|
+
className
|
|
3770
3833
|
),
|
|
3834
|
+
"data-testid": testIdPrefix,
|
|
3771
3835
|
children: size === "xs" ? workspaceInitials(name ?? "All data").slice(0, 1) : workspaceInitials(name ?? "All data")
|
|
3772
3836
|
}
|
|
3773
3837
|
);
|
|
@@ -3783,7 +3847,7 @@ var ICON = {
|
|
|
3783
3847
|
success: /* @__PURE__ */ jsx36(Check7, { size: 15, className: "shrink-0", "aria-hidden": "true" }),
|
|
3784
3848
|
warning: /* @__PURE__ */ jsx36(AlertTriangle, { size: 15, className: "shrink-0", "aria-hidden": "true" })
|
|
3785
3849
|
};
|
|
3786
|
-
function Toast({ message, action, onClose, tone = "neutral", duration, className }) {
|
|
3850
|
+
function Toast({ message, action, onClose, tone = "neutral", duration, className, testIdPrefix }) {
|
|
3787
3851
|
const ms = duration ?? (action ? 1e4 : 5e3);
|
|
3788
3852
|
const [paused, setPaused] = useState12(false);
|
|
3789
3853
|
const closed = useRef13(false);
|
|
@@ -3802,6 +3866,7 @@ function Toast({ message, action, onClose, tone = "neutral", duration, className
|
|
|
3802
3866
|
{
|
|
3803
3867
|
role: "status",
|
|
3804
3868
|
"aria-live": "polite",
|
|
3869
|
+
"data-testid": testIdPrefix,
|
|
3805
3870
|
onMouseEnter: () => setPaused(true),
|
|
3806
3871
|
onMouseLeave: () => setPaused(false),
|
|
3807
3872
|
onFocusCapture: () => setPaused(true),
|
|
@@ -3848,8 +3913,8 @@ function Toast({ message, action, onClose, tone = "neutral", duration, className
|
|
|
3848
3913
|
|
|
3849
3914
|
// src/Tag.tsx
|
|
3850
3915
|
import { jsx as jsx37 } from "react/jsx-runtime";
|
|
3851
|
-
function Tag({ children, className }) {
|
|
3852
|
-
return /* @__PURE__ */ jsx37(Badge, { kind: "category", className, children });
|
|
3916
|
+
function Tag({ children, className, testIdPrefix }) {
|
|
3917
|
+
return /* @__PURE__ */ jsx37(Badge, { kind: "category", className, testIdPrefix, children });
|
|
3853
3918
|
}
|
|
3854
3919
|
|
|
3855
3920
|
// src/TablePagination.tsx
|
|
@@ -3871,7 +3936,7 @@ function TablePagination({
|
|
|
3871
3936
|
const current = Math.min(page, totalPages);
|
|
3872
3937
|
const rangeStart = totalItems === 0 ? 0 : (current - 1) * perPage + 1;
|
|
3873
3938
|
const rangeEnd = Math.min(current * perPage, totalItems);
|
|
3874
|
-
const btn = "flex h-8 min-w-8 items-center justify-center rounded-control px-2 text-dense transition-colors";
|
|
3939
|
+
const btn = "flex h-8 min-w-8 items-center justify-center rounded-control px-2 text-dense transition-colors focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-border-focus";
|
|
3875
3940
|
const off = "disabled:pointer-events-none disabled:opacity-30";
|
|
3876
3941
|
const stepBtn = cn(btn, "text-text-secondary hover:bg-subtle hover:text-text-primary", off);
|
|
3877
3942
|
const range = /* @__PURE__ */ jsxs34("span", { className: "text-dense text-text-tertiary tabular-nums", children: [
|
|
@@ -4043,7 +4108,9 @@ function DateRangePicker({
|
|
|
4043
4108
|
today,
|
|
4044
4109
|
years,
|
|
4045
4110
|
formatDate,
|
|
4046
|
-
formatRange
|
|
4111
|
+
formatRange,
|
|
4112
|
+
className,
|
|
4113
|
+
testIdPrefix
|
|
4047
4114
|
}) {
|
|
4048
4115
|
const end = useMemo4(() => today ?? startOfToday(), [today]);
|
|
4049
4116
|
const yearOptions = years ?? [3, 2, 1, 0].map((n) => end.getFullYear() - n);
|
|
@@ -4091,7 +4158,7 @@ function DateRangePicker({
|
|
|
4091
4158
|
if (showFooter) setDraft(label);
|
|
4092
4159
|
else commit(label);
|
|
4093
4160
|
};
|
|
4094
|
-
return /* @__PURE__ */ jsxs35("div", { className: "relative", ref, children: [
|
|
4161
|
+
return /* @__PURE__ */ jsxs35("div", { className: cn("relative", className), ref, "data-testid": testIdPrefix, children: [
|
|
4095
4162
|
/* @__PURE__ */ jsxs35(
|
|
4096
4163
|
"button",
|
|
4097
4164
|
{
|
|
@@ -4115,7 +4182,7 @@ function DateRangePicker({
|
|
|
4115
4182
|
{
|
|
4116
4183
|
type: "button",
|
|
4117
4184
|
onClick: () => showFooter ? setDraft(p) : commit(p),
|
|
4118
|
-
className: cn("block w-full px-3 py-2 text-left text-dense transition-colors hover:bg-subtle", (showFooter ? draft : value) === p ? "font-semibold text-brand-primaryAction" : "text-text-secondary"),
|
|
4185
|
+
className: cn("block w-full px-3 py-2 text-left text-dense transition-colors hover:bg-subtle focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-border-focus", (showFooter ? draft : value) === p ? "font-semibold text-brand-primaryAction" : "text-text-secondary"),
|
|
4119
4186
|
children: p
|
|
4120
4187
|
},
|
|
4121
4188
|
p
|
|
@@ -4145,7 +4212,7 @@ function DateRangePicker({
|
|
|
4145
4212
|
type: "button",
|
|
4146
4213
|
onClick: applyCustom,
|
|
4147
4214
|
disabled: !valid,
|
|
4148
|
-
className: "self-start text-dense font-semibold text-brand-primaryAction transition-opacity hover:opacity-80 disabled:cursor-not-allowed disabled:opacity-40",
|
|
4215
|
+
className: "self-start text-dense font-semibold text-brand-primaryAction transition-opacity hover:opacity-80 disabled:cursor-not-allowed disabled:opacity-40 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-border-focus",
|
|
4149
4216
|
children: showFooter ? "Use custom range" : "Apply"
|
|
4150
4217
|
}
|
|
4151
4218
|
)
|
|
@@ -4185,7 +4252,9 @@ function MultiSelectFilter({
|
|
|
4185
4252
|
onRetry,
|
|
4186
4253
|
valueLabel,
|
|
4187
4254
|
hints,
|
|
4188
|
-
note
|
|
4255
|
+
note,
|
|
4256
|
+
className,
|
|
4257
|
+
testIdPrefix
|
|
4189
4258
|
}) {
|
|
4190
4259
|
const groupLeaves = (g) => g.children.length ? g.children : [{ id: g.id, label: g.label }];
|
|
4191
4260
|
const leafOptions = groups ? groups.flatMap(groupLeaves) : options;
|
|
@@ -4260,13 +4329,14 @@ function MultiSelectFilter({
|
|
|
4260
4329
|
const kids = live.filter((c) => c.label.toLowerCase().includes(ql));
|
|
4261
4330
|
return kids.length ? { ...g, children: kids } : null;
|
|
4262
4331
|
}).filter((g) => g !== null) : [];
|
|
4263
|
-
return /* @__PURE__ */ jsxs36("div", { className: cn("relative", fullWidth && "w-full"), ref, children: [
|
|
4332
|
+
return /* @__PURE__ */ jsxs36("div", { className: cn("relative", fullWidth && "w-full", className), ref, "data-testid": testIdPrefix, children: [
|
|
4264
4333
|
/* @__PURE__ */ jsxs36(
|
|
4265
4334
|
"button",
|
|
4266
4335
|
{
|
|
4267
4336
|
type: "button",
|
|
4268
4337
|
onClick: () => open ? close() : openTray(),
|
|
4269
4338
|
"aria-expanded": open,
|
|
4339
|
+
"data-testid": testIdPrefix && `${testIdPrefix}-trigger`,
|
|
4270
4340
|
className: cn(chipTriggerClass(variant), fullWidth && "w-full justify-between"),
|
|
4271
4341
|
children: [
|
|
4272
4342
|
/* @__PURE__ */ jsx40(ChipContent, { caption, value, icon }),
|
|
@@ -4289,6 +4359,7 @@ function MultiSelectFilter({
|
|
|
4289
4359
|
menuWidthClass,
|
|
4290
4360
|
align === "right" ? "right-0" : "left-0"
|
|
4291
4361
|
),
|
|
4362
|
+
"data-testid": testIdPrefix && `${testIdPrefix}-popover`,
|
|
4292
4363
|
role: "dialog",
|
|
4293
4364
|
"aria-label": caption,
|
|
4294
4365
|
children: loading ? /* @__PURE__ */ jsx40(MenuLoading, {}) : error ? /* @__PURE__ */ jsx40(MenuError, { onRetry }) : /* @__PURE__ */ jsxs36(Fragment4, { children: [
|
|
@@ -4304,7 +4375,7 @@ function MultiSelectFilter({
|
|
|
4304
4375
|
className: "h-full flex-1 bg-transparent text-dense outline-hidden placeholder:text-text-tertiary"
|
|
4305
4376
|
}
|
|
4306
4377
|
),
|
|
4307
|
-
q && /* @__PURE__ */ jsx40("button", { type: "button", onClick: () => setQ(""), "aria-label": "Clear search", className: "text-text-tertiary hover:text-text-primary", children: /* @__PURE__ */ jsx40(X5, { size: 13 }) })
|
|
4378
|
+
q && /* @__PURE__ */ jsx40("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-2 focus-visible:outline-border-focus", children: /* @__PURE__ */ jsx40(X5, { size: 13 }) })
|
|
4308
4379
|
] }) }),
|
|
4309
4380
|
/* @__PURE__ */ jsxs36("div", { className: "max-h-[280px] overflow-y-auto p-1", children: [
|
|
4310
4381
|
groups ? visibleGroups.map((g) => {
|
|
@@ -4315,7 +4386,7 @@ function MultiSelectFilter({
|
|
|
4315
4386
|
{
|
|
4316
4387
|
type: "button",
|
|
4317
4388
|
onClick: () => toggleGroup(g),
|
|
4318
|
-
className: "flex w-full items-center gap-2.5 rounded-control px-2 py-2 text-left transition-colors hover:bg-subtle",
|
|
4389
|
+
className: "flex w-full items-center gap-2.5 rounded-control px-2 py-2 text-left transition-colors hover:bg-subtle focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-border-focus",
|
|
4319
4390
|
children: [
|
|
4320
4391
|
/* @__PURE__ */ jsx40(CheckBoxBox, { checked: state === "all", indeterminate: state === "some" }),
|
|
4321
4392
|
/* @__PURE__ */ jsx40("span", { className: cn("flex-1 text-sm text-text-primary", !plainParent && "font-semibold"), children: labelled(g.id, g.label) }),
|
|
@@ -4330,7 +4401,7 @@ function MultiSelectFilter({
|
|
|
4330
4401
|
{
|
|
4331
4402
|
type: "button",
|
|
4332
4403
|
onClick: () => toggle(c.id),
|
|
4333
|
-
className: "flex w-full items-center gap-2.5 rounded-control py-2 pl-9 pr-2 text-left transition-colors hover:bg-subtle",
|
|
4404
|
+
className: "flex w-full items-center gap-2.5 rounded-control py-2 pl-9 pr-2 text-left transition-colors hover:bg-subtle focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-border-focus",
|
|
4334
4405
|
children: [
|
|
4335
4406
|
/* @__PURE__ */ jsx40(CheckBoxBox, { checked }),
|
|
4336
4407
|
/* @__PURE__ */ jsx40("span", { className: "flex-1 text-sm text-text-primary", children: labelled(c.id, c.label) }),
|
|
@@ -4348,7 +4419,7 @@ function MultiSelectFilter({
|
|
|
4348
4419
|
{
|
|
4349
4420
|
type: "button",
|
|
4350
4421
|
onClick: () => toggle(o.id),
|
|
4351
|
-
className: "flex w-full items-center gap-2.5 rounded-control px-2 py-2 text-left transition-colors hover:bg-subtle",
|
|
4422
|
+
className: "flex w-full items-center gap-2.5 rounded-control px-2 py-2 text-left transition-colors hover:bg-subtle focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-border-focus",
|
|
4352
4423
|
children: [
|
|
4353
4424
|
/* @__PURE__ */ jsx40(CheckBoxBox, { checked }),
|
|
4354
4425
|
/* @__PURE__ */ jsx40("span", { className: "flex-1 text-sm text-text-primary", children: labelled(o.id, o.label) }),
|
|
@@ -4366,7 +4437,7 @@ function MultiSelectFilter({
|
|
|
4366
4437
|
{
|
|
4367
4438
|
type: "button",
|
|
4368
4439
|
onClick: () => setDraft([]),
|
|
4369
|
-
className: "text-xs font-medium text-text-link hover:underline",
|
|
4440
|
+
className: "text-xs font-medium text-text-link hover:underline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-border-focus",
|
|
4370
4441
|
children: [
|
|
4371
4442
|
"Clear ",
|
|
4372
4443
|
caption.toLowerCase()
|
|
@@ -4387,17 +4458,19 @@ function OptionCount({ n }) {
|
|
|
4387
4458
|
}
|
|
4388
4459
|
|
|
4389
4460
|
// src/Toggle.tsx
|
|
4461
|
+
import { forwardRef as forwardRef6 } from "react";
|
|
4390
4462
|
import { jsx as jsx41 } from "react/jsx-runtime";
|
|
4391
4463
|
var SIZES2 = {
|
|
4392
4464
|
sm: { track: "h-5 w-9", knob: "h-4 w-4", on: "translate-x-[18px]" },
|
|
4393
4465
|
md: { track: "h-6 w-11", knob: "h-5 w-5", on: "translate-x-[22px]" }
|
|
4394
4466
|
};
|
|
4395
4467
|
var OFF_TRACK = "color-mix(in srgb, var(--mr-color-border-interactive) 70%, var(--mr-color-text-secondary))";
|
|
4396
|
-
|
|
4468
|
+
var Toggle = forwardRef6(function Toggle2({ checked, onChange, label, size = "md", disabled, className, testIdPrefix }, ref) {
|
|
4397
4469
|
const s = SIZES2[size];
|
|
4398
4470
|
return /* @__PURE__ */ jsx41(
|
|
4399
4471
|
"button",
|
|
4400
4472
|
{
|
|
4473
|
+
ref,
|
|
4401
4474
|
type: "button",
|
|
4402
4475
|
role: "switch",
|
|
4403
4476
|
"aria-checked": checked,
|
|
@@ -4425,20 +4498,21 @@ function Toggle({ checked, onChange, label, size = "md", disabled, className, te
|
|
|
4425
4498
|
)
|
|
4426
4499
|
}
|
|
4427
4500
|
);
|
|
4428
|
-
}
|
|
4501
|
+
});
|
|
4502
|
+
Toggle.displayName = "Toggle";
|
|
4429
4503
|
|
|
4430
4504
|
// src/AISpark.tsx
|
|
4431
4505
|
import { useId as useId6 } from "react";
|
|
4432
4506
|
import { Sparkles } from "lucide-react";
|
|
4433
4507
|
import { Fragment as Fragment5, jsx as jsx42, jsxs as jsxs37 } from "react/jsx-runtime";
|
|
4434
|
-
function AISpark({ size = 16, className }) {
|
|
4508
|
+
function AISpark({ size = 16, className, testIdPrefix }) {
|
|
4435
4509
|
const id = useId6();
|
|
4436
4510
|
return /* @__PURE__ */ jsxs37(Fragment5, { children: [
|
|
4437
4511
|
/* @__PURE__ */ jsx42("svg", { width: "0", height: "0", "aria-hidden": "true", style: { position: "absolute" }, children: /* @__PURE__ */ jsx42("defs", { children: /* @__PURE__ */ jsxs37("linearGradient", { id, x1: "0", y1: "0", x2: "1", y2: "1", children: [
|
|
4438
4512
|
/* @__PURE__ */ jsx42("stop", { offset: "0%", stopColor: "var(--mr-color-brand-primary)" }),
|
|
4439
4513
|
/* @__PURE__ */ jsx42("stop", { offset: "100%", className: "[stop-color:#9474ff] in-data-[theme=dark]:[stop-color:#a488ff]" })
|
|
4440
4514
|
] }) }) }),
|
|
4441
|
-
/* @__PURE__ */ jsx42(Sparkles, { size, stroke: `url(#${id})`, className, "aria-hidden": "true" })
|
|
4515
|
+
/* @__PURE__ */ jsx42(Sparkles, { size, stroke: `url(#${id})`, className, "data-testid": testIdPrefix, "aria-hidden": "true" })
|
|
4442
4516
|
] });
|
|
4443
4517
|
}
|
|
4444
4518
|
|
|
@@ -4454,11 +4528,12 @@ var srLabel = {
|
|
|
4454
4528
|
recent: "Recent (today)",
|
|
4455
4529
|
stale: "Older than a day"
|
|
4456
4530
|
};
|
|
4457
|
-
function Freshness({ level }) {
|
|
4531
|
+
function Freshness({ level, className, testIdPrefix }) {
|
|
4458
4532
|
return /* @__PURE__ */ jsx43(
|
|
4459
4533
|
"span",
|
|
4460
4534
|
{
|
|
4461
|
-
className: cn("inline-block h-1.5 w-1.5 shrink-0 rounded-full", dotColor[level]),
|
|
4535
|
+
className: cn("inline-block h-1.5 w-1.5 shrink-0 rounded-full", dotColor[level], className),
|
|
4536
|
+
"data-testid": testIdPrefix,
|
|
4462
4537
|
role: "img",
|
|
4463
4538
|
"aria-label": srLabel[level]
|
|
4464
4539
|
}
|
|
@@ -4467,8 +4542,8 @@ function Freshness({ level }) {
|
|
|
4467
4542
|
|
|
4468
4543
|
// src/SectionHeading.tsx
|
|
4469
4544
|
import { jsx as jsx44, jsxs as jsxs38 } from "react/jsx-runtime";
|
|
4470
|
-
function SectionHeading({ title, description, actions, as: Tag2 = "h2", id, className }) {
|
|
4471
|
-
return /* @__PURE__ */ jsxs38("div", { className: cn("flex flex-wrap items-end justify-between gap-x-4 gap-y-2", className), children: [
|
|
4545
|
+
function SectionHeading({ title, description, actions, as: Tag2 = "h2", id, className, testIdPrefix }) {
|
|
4546
|
+
return /* @__PURE__ */ jsxs38("div", { className: cn("flex flex-wrap items-end justify-between gap-x-4 gap-y-2", className), "data-testid": testIdPrefix, children: [
|
|
4472
4547
|
/* @__PURE__ */ jsxs38("div", { className: "min-w-0", children: [
|
|
4473
4548
|
/* @__PURE__ */ jsx44(Tag2, { id, className: "text-base font-semibold text-text-primary", children: title }),
|
|
4474
4549
|
description && /* @__PURE__ */ jsx44("p", { className: "mt-0.5 text-dense text-text-secondary", children: description })
|
|
@@ -4480,8 +4555,8 @@ function SectionHeading({ title, description, actions, as: Tag2 = "h2", id, clas
|
|
|
4480
4555
|
// src/PageHeader.tsx
|
|
4481
4556
|
import { ArrowLeft } from "lucide-react";
|
|
4482
4557
|
import { jsx as jsx45, jsxs as jsxs39 } from "react/jsx-runtime";
|
|
4483
|
-
function PageHeader({ title, description, actions, meta, back, className }) {
|
|
4484
|
-
return /* @__PURE__ */ jsxs39("header", { className: cn("flex flex-wrap items-center justify-between gap-x-6 gap-y-3", className), children: [
|
|
4558
|
+
function PageHeader({ title, description, actions, meta, back, className, testIdPrefix }) {
|
|
4559
|
+
return /* @__PURE__ */ jsxs39("header", { className: cn("flex flex-wrap items-center justify-between gap-x-6 gap-y-3", className), "data-testid": testIdPrefix, children: [
|
|
4485
4560
|
/* @__PURE__ */ jsxs39("div", { className: "min-w-0", children: [
|
|
4486
4561
|
back && /* @__PURE__ */ jsxs39(
|
|
4487
4562
|
"a",
|
|
@@ -4519,7 +4594,7 @@ var WIDTH = {
|
|
|
4519
4594
|
xl: "max-w-300"
|
|
4520
4595
|
};
|
|
4521
4596
|
var FOCUSABLE = 'a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';
|
|
4522
|
-
function Modal({ open, onClose, title, description, size = "md", footer, children, className }) {
|
|
4597
|
+
function Modal({ open, onClose, title, description, size = "md", footer, children, className, testIdPrefix }) {
|
|
4523
4598
|
const titleId = useId7();
|
|
4524
4599
|
const descId = useId7();
|
|
4525
4600
|
const panel = useRef16(null);
|
|
@@ -4571,6 +4646,7 @@ function Modal({ open, onClose, title, description, size = "md", footer, childre
|
|
|
4571
4646
|
ref: panel,
|
|
4572
4647
|
role: "dialog",
|
|
4573
4648
|
"aria-modal": "true",
|
|
4649
|
+
"data-testid": testIdPrefix,
|
|
4574
4650
|
"aria-labelledby": titleId,
|
|
4575
4651
|
"aria-describedby": description ? descId : void 0,
|
|
4576
4652
|
tabIndex: -1,
|
|
@@ -4609,7 +4685,7 @@ function Modal({ open, onClose, title, description, size = "md", footer, childre
|
|
|
4609
4685
|
|
|
4610
4686
|
// src/EmptyState.tsx
|
|
4611
4687
|
import { jsx as jsx47, jsxs as jsxs41 } from "react/jsx-runtime";
|
|
4612
|
-
function EmptyState({ icon, title, description, action, size = "sm", className }) {
|
|
4688
|
+
function EmptyState({ icon, title, description, action, size = "sm", className, testIdPrefix }) {
|
|
4613
4689
|
const md = size === "md";
|
|
4614
4690
|
return /* @__PURE__ */ jsxs41(
|
|
4615
4691
|
"div",
|
|
@@ -4619,6 +4695,7 @@ function EmptyState({ icon, title, description, action, size = "sm", className }
|
|
|
4619
4695
|
md ? "gap-2 px-6 py-16" : "gap-1.5 px-4 py-8",
|
|
4620
4696
|
className
|
|
4621
4697
|
),
|
|
4698
|
+
"data-testid": testIdPrefix,
|
|
4622
4699
|
children: [
|
|
4623
4700
|
icon && /* @__PURE__ */ jsx47(
|
|
4624
4701
|
"span",
|
|
@@ -4640,16 +4717,16 @@ function EmptyState({ icon, title, description, action, size = "sm", className }
|
|
|
4640
4717
|
}
|
|
4641
4718
|
|
|
4642
4719
|
// src/TextField.tsx
|
|
4643
|
-
import { forwardRef as
|
|
4720
|
+
import { forwardRef as forwardRef7, useId as useId8 } from "react";
|
|
4644
4721
|
import { jsx as jsx48, jsxs as jsxs42 } from "react/jsx-runtime";
|
|
4645
4722
|
var HEIGHT2 = { sm: "h-8", md: "h-10", lg: "h-11" };
|
|
4646
|
-
var TextField =
|
|
4647
|
-
({ label, hint, error, size = "md", icon, className, id, disabled, ...props }, ref) => {
|
|
4723
|
+
var TextField = forwardRef7(
|
|
4724
|
+
({ label, hint, error, size = "md", icon, className, testIdPrefix, id, disabled, ...props }, ref) => {
|
|
4648
4725
|
const auto = useId8();
|
|
4649
4726
|
const fieldId = id ?? auto;
|
|
4650
4727
|
const noteId = `${fieldId}-note`;
|
|
4651
4728
|
const note = error ?? hint;
|
|
4652
|
-
return /* @__PURE__ */ jsxs42("div", { className: cn("flex flex-col gap-1.5", className), children: [
|
|
4729
|
+
return /* @__PURE__ */ jsxs42("div", { className: cn("flex flex-col gap-1.5", className), "data-testid": testIdPrefix, children: [
|
|
4653
4730
|
label && /* @__PURE__ */ jsx48("label", { htmlFor: fieldId, className: "text-xs font-medium text-text-secondary", children: label }),
|
|
4654
4731
|
/* @__PURE__ */ jsxs42(
|
|
4655
4732
|
"div",
|
|
@@ -4695,7 +4772,7 @@ var WIDTH2 = {
|
|
|
4695
4772
|
};
|
|
4696
4773
|
var EXIT_MS = 200;
|
|
4697
4774
|
var FOCUSABLE2 = 'a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';
|
|
4698
|
-
function Drawer({ open, onClose, title, description, size = "sm", footer, children, className }) {
|
|
4775
|
+
function Drawer({ open, onClose, title, description, size = "sm", footer, children, className, testIdPrefix }) {
|
|
4699
4776
|
const titleId = useId9();
|
|
4700
4777
|
const descId = useId9();
|
|
4701
4778
|
const panel = useRef17(null);
|
|
@@ -4769,6 +4846,7 @@ function Drawer({ open, onClose, title, description, size = "sm", footer, childr
|
|
|
4769
4846
|
ref: panel,
|
|
4770
4847
|
role: "dialog",
|
|
4771
4848
|
"aria-modal": "true",
|
|
4849
|
+
"data-testid": testIdPrefix,
|
|
4772
4850
|
"aria-labelledby": titleId,
|
|
4773
4851
|
"aria-describedby": description ? descId : void 0,
|
|
4774
4852
|
tabIndex: -1,
|
|
@@ -4828,6 +4906,7 @@ function DataTable({
|
|
|
4828
4906
|
maxHeight,
|
|
4829
4907
|
footer,
|
|
4830
4908
|
className,
|
|
4909
|
+
testIdPrefix,
|
|
4831
4910
|
...rest
|
|
4832
4911
|
}) {
|
|
4833
4912
|
const titleId = useId10();
|
|
@@ -4839,62 +4918,70 @@ function DataTable({
|
|
|
4839
4918
|
const col = columns.find((c) => c.key === key);
|
|
4840
4919
|
onSortChange?.(cycleSort(sort, key, col?.firstDir ?? (col?.numeric ? "desc" : "asc")));
|
|
4841
4920
|
};
|
|
4842
|
-
return /* @__PURE__ */ jsxs44(
|
|
4843
|
-
|
|
4844
|
-
|
|
4845
|
-
|
|
4846
|
-
|
|
4847
|
-
|
|
4848
|
-
|
|
4849
|
-
|
|
4850
|
-
|
|
4851
|
-
|
|
4852
|
-
|
|
4853
|
-
|
|
4854
|
-
|
|
4855
|
-
"
|
|
4856
|
-
|
|
4857
|
-
|
|
4858
|
-
|
|
4859
|
-
"
|
|
4860
|
-
|
|
4861
|
-
|
|
4862
|
-
|
|
4863
|
-
className: cn("
|
|
4864
|
-
|
|
4865
|
-
|
|
4921
|
+
return /* @__PURE__ */ jsxs44(
|
|
4922
|
+
"div",
|
|
4923
|
+
{
|
|
4924
|
+
className: cn("flex w-full flex-col overflow-hidden rounded-card border border-border-default bg-surface", className),
|
|
4925
|
+
"data-testid": testIdPrefix,
|
|
4926
|
+
children: [
|
|
4927
|
+
title && /* @__PURE__ */ jsxs44("div", { className: "flex items-start justify-between gap-2 p-card-padding", children: [
|
|
4928
|
+
/* @__PURE__ */ jsxs44("div", { className: "min-w-0", children: [
|
|
4929
|
+
/* @__PURE__ */ jsx50("h3", { id: titleId, className: "text-style-card-title", children: title }),
|
|
4930
|
+
subtitle && /* @__PURE__ */ jsx50("p", { className: "mt-0.5 text-xs text-text-tertiary", children: subtitle })
|
|
4931
|
+
] }),
|
|
4932
|
+
action && /* @__PURE__ */ jsx50("div", { className: "shrink-0", children: action })
|
|
4933
|
+
] }),
|
|
4934
|
+
/* @__PURE__ */ jsx50("div", { className: cn("overflow-x-auto", maxHeight && cn("overflow-y-auto", MAX_H[maxHeight])), children: /* @__PURE__ */ jsxs44(
|
|
4935
|
+
"table",
|
|
4936
|
+
{
|
|
4937
|
+
"aria-labelledby": title ? titleId : void 0,
|
|
4938
|
+
"aria-label": title ? void 0 : rest["aria-label"],
|
|
4939
|
+
"aria-busy": loading || void 0,
|
|
4940
|
+
className: "w-full border-collapse text-left",
|
|
4941
|
+
children: [
|
|
4942
|
+
/* @__PURE__ */ jsx50("thead", { className: cn(maxHeight && "sticky top-0 z-10"), children: /* @__PURE__ */ jsx50("tr", { className: "bg-subtle text-micro font-semibold uppercase tracking-wider text-text-secondary", children: columns.map((c) => /* @__PURE__ */ jsx50(
|
|
4943
|
+
"th",
|
|
4944
|
+
{
|
|
4945
|
+
scope: "col",
|
|
4946
|
+
"aria-sort": c.sortable ? ariaSortFor(sort, c.key) : void 0,
|
|
4947
|
+
className: cn("border-b border-border-default font-semibold", head, align(c), width(c)),
|
|
4948
|
+
children: c.sortable && onSortChange ? /* @__PURE__ */ jsx50(
|
|
4949
|
+
SortButton,
|
|
4950
|
+
{
|
|
4951
|
+
label: c.label,
|
|
4952
|
+
sortKey: c.key,
|
|
4953
|
+
align: c.numeric ? "right" : "left",
|
|
4954
|
+
sort: sortProp(sort),
|
|
4955
|
+
onSort,
|
|
4956
|
+
testIdPrefix
|
|
4957
|
+
}
|
|
4958
|
+
) : c.label
|
|
4959
|
+
},
|
|
4960
|
+
c.key
|
|
4961
|
+
)) }) }),
|
|
4962
|
+
/* @__PURE__ */ jsx50("tbody", { className: "text-dense text-text-primary", children: loading ? Array.from({ length: loadingRows }, (_, i) => /* @__PURE__ */ jsx50("tr", { "aria-hidden": "true", className: "[&:last-child>td]:border-b-0", children: columns.map((c) => /* @__PURE__ */ jsx50("td", { className: cn("border-b border-border-default", pad, align(c)), children: /* @__PURE__ */ jsx50(
|
|
4963
|
+
"span",
|
|
4866
4964
|
{
|
|
4867
|
-
|
|
4868
|
-
|
|
4869
|
-
|
|
4870
|
-
|
|
4871
|
-
onSort
|
|
4965
|
+
className: cn(
|
|
4966
|
+
"inline-block h-3 animate-pulse rounded-full bg-subtle",
|
|
4967
|
+
c.numeric ? "w-12" : "w-2/3"
|
|
4968
|
+
)
|
|
4872
4969
|
}
|
|
4873
|
-
) : c
|
|
4874
|
-
|
|
4875
|
-
|
|
4876
|
-
|
|
4877
|
-
|
|
4878
|
-
|
|
4879
|
-
|
|
4880
|
-
|
|
4881
|
-
|
|
4882
|
-
|
|
4883
|
-
|
|
4884
|
-
|
|
4885
|
-
|
|
4886
|
-
|
|
4887
|
-
|
|
4888
|
-
className: cn("border-b border-border-default", pad, align(c), c.numeric && "tabular-nums"),
|
|
4889
|
-
children: c.cell(row)
|
|
4890
|
-
},
|
|
4891
|
-
c.key
|
|
4892
|
-
)) }, rowKey(row))) })
|
|
4893
|
-
]
|
|
4894
|
-
}
|
|
4895
|
-
) }),
|
|
4896
|
-
footer && /* @__PURE__ */ jsx50("div", { className: "border-t border-border-default px-4 py-3", children: footer })
|
|
4897
|
-
] });
|
|
4970
|
+
) }, c.key)) }, i)) : rows.length === 0 ? /* @__PURE__ */ jsx50("tr", { children: /* @__PURE__ */ jsx50("td", { colSpan: columns.length, className: "px-6 py-12", children: empty ?? /* @__PURE__ */ jsx50(NoResultsEmptyState, {}) }) }) : rows.map((row) => /* @__PURE__ */ jsx50("tr", { className: "hover:bg-subtle [&:last-child>td]:border-b-0", children: columns.map((c) => /* @__PURE__ */ jsx50(
|
|
4971
|
+
"td",
|
|
4972
|
+
{
|
|
4973
|
+
className: cn("border-b border-border-default", pad, align(c), c.numeric && "tabular-nums"),
|
|
4974
|
+
children: c.cell(row)
|
|
4975
|
+
},
|
|
4976
|
+
c.key
|
|
4977
|
+
)) }, rowKey(row))) })
|
|
4978
|
+
]
|
|
4979
|
+
}
|
|
4980
|
+
) }),
|
|
4981
|
+
footer && /* @__PURE__ */ jsx50("div", { className: "border-t border-border-default px-4 py-3", children: footer })
|
|
4982
|
+
]
|
|
4983
|
+
}
|
|
4984
|
+
);
|
|
4898
4985
|
}
|
|
4899
4986
|
|
|
4900
4987
|
// src/MediaLabel.tsx
|
|
@@ -4908,7 +4995,7 @@ var FILL = {
|
|
|
4908
4995
|
Newspaper: "bg-media-newspaper",
|
|
4909
4996
|
Magazine: "bg-media-magazine"
|
|
4910
4997
|
};
|
|
4911
|
-
function MediaLabel({ type, className }) {
|
|
4998
|
+
function MediaLabel({ type, className, testIdPrefix }) {
|
|
4912
4999
|
return /* @__PURE__ */ jsx51(
|
|
4913
5000
|
"span",
|
|
4914
5001
|
{
|
|
@@ -4917,18 +5004,22 @@ function MediaLabel({ type, className }) {
|
|
|
4917
5004
|
FILL[type] ?? "bg-media-other",
|
|
4918
5005
|
className
|
|
4919
5006
|
),
|
|
5007
|
+
"data-testid": testIdPrefix,
|
|
4920
5008
|
children: type
|
|
4921
5009
|
}
|
|
4922
5010
|
);
|
|
4923
5011
|
}
|
|
4924
5012
|
|
|
4925
5013
|
// src/SuggestionChip.tsx
|
|
5014
|
+
import { forwardRef as forwardRef8 } from "react";
|
|
4926
5015
|
import { jsx as jsx52 } from "react/jsx-runtime";
|
|
4927
|
-
|
|
5016
|
+
var SuggestionChip = forwardRef8(function SuggestionChip2({ children, className, testIdPrefix, type = "button", ...props }, ref) {
|
|
4928
5017
|
return /* @__PURE__ */ jsx52(
|
|
4929
5018
|
"button",
|
|
4930
5019
|
{
|
|
5020
|
+
ref,
|
|
4931
5021
|
type,
|
|
5022
|
+
"data-testid": testIdPrefix,
|
|
4932
5023
|
...props,
|
|
4933
5024
|
className: cn(
|
|
4934
5025
|
"inline-flex h-8 max-w-full items-center rounded-full border border-border-default bg-surface px-3 text-sm text-text-primary transition-colors duration-(--mr-motion-duration-interactive) ease-interactive hover:border-border-strong hover:bg-subtle focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-border-focus",
|
|
@@ -4937,17 +5028,21 @@ function SuggestionChip({ children, className, type = "button", ...props }) {
|
|
|
4937
5028
|
children: /* @__PURE__ */ jsx52("span", { className: "truncate", children })
|
|
4938
5029
|
}
|
|
4939
5030
|
);
|
|
4940
|
-
}
|
|
5031
|
+
});
|
|
5032
|
+
SuggestionChip.displayName = "SuggestionChip";
|
|
4941
5033
|
|
|
4942
5034
|
// src/ToggleChip.tsx
|
|
5035
|
+
import { forwardRef as forwardRef9 } from "react";
|
|
4943
5036
|
import { Check as Check8 } from "lucide-react";
|
|
4944
5037
|
import { jsx as jsx53, jsxs as jsxs45 } from "react/jsx-runtime";
|
|
4945
|
-
|
|
5038
|
+
var ToggleChip = forwardRef9(function ToggleChip2({ selected, onChange, children, className, testIdPrefix, type = "button", onClick, ...props }, ref) {
|
|
4946
5039
|
return /* @__PURE__ */ jsxs45(
|
|
4947
5040
|
"button",
|
|
4948
5041
|
{
|
|
5042
|
+
ref,
|
|
4949
5043
|
type,
|
|
4950
5044
|
"aria-pressed": selected,
|
|
5045
|
+
"data-testid": testIdPrefix,
|
|
4951
5046
|
...props,
|
|
4952
5047
|
onClick: (e) => {
|
|
4953
5048
|
onClick?.(e);
|
|
@@ -4964,14 +5059,15 @@ function ToggleChip({ selected, onChange, children, className, type = "button",
|
|
|
4964
5059
|
]
|
|
4965
5060
|
}
|
|
4966
5061
|
);
|
|
4967
|
-
}
|
|
5062
|
+
});
|
|
5063
|
+
ToggleChip.displayName = "ToggleChip";
|
|
4968
5064
|
|
|
4969
5065
|
// src/CopyButton.tsx
|
|
4970
|
-
import { useEffect as useEffect16, useRef as useRef18, useState as useState16 } from "react";
|
|
5066
|
+
import { forwardRef as forwardRef10, useEffect as useEffect16, useRef as useRef18, useState as useState16 } from "react";
|
|
4971
5067
|
import { Check as Check9, Copy } from "lucide-react";
|
|
4972
5068
|
import { jsx as jsx54, jsxs as jsxs46 } from "react/jsx-runtime";
|
|
4973
5069
|
var CONFIRM_MS = 2e3;
|
|
4974
|
-
|
|
5070
|
+
var CopyButton = forwardRef10(function CopyButton2({ value, label, "aria-label": ariaLabel, size = "xs", className, testIdPrefix }, ref) {
|
|
4975
5071
|
const [copied, setCopied] = useState16(false);
|
|
4976
5072
|
const timer = useRef18(void 0);
|
|
4977
5073
|
useEffect16(() => () => clearTimeout(timer.current), []);
|
|
@@ -4990,7 +5086,9 @@ function CopyButton({ value, label, "aria-label": ariaLabel, size = "xs", classN
|
|
|
4990
5086
|
return /* @__PURE__ */ jsxs46(
|
|
4991
5087
|
Button,
|
|
4992
5088
|
{
|
|
5089
|
+
ref,
|
|
4993
5090
|
type: "button",
|
|
5091
|
+
"data-testid": testIdPrefix,
|
|
4994
5092
|
variant: "ghost",
|
|
4995
5093
|
size,
|
|
4996
5094
|
iconOnly: !label,
|
|
@@ -5004,7 +5102,8 @@ function CopyButton({ value, label, "aria-label": ariaLabel, size = "xs", classN
|
|
|
5004
5102
|
]
|
|
5005
5103
|
}
|
|
5006
5104
|
);
|
|
5007
|
-
}
|
|
5105
|
+
});
|
|
5106
|
+
CopyButton.displayName = "CopyButton";
|
|
5008
5107
|
|
|
5009
5108
|
// src/InlineMessage.tsx
|
|
5010
5109
|
import { AlertTriangle as AlertTriangle2, CheckCircle2, Info as Info3, X as X8, XCircle } from "lucide-react";
|
|
@@ -5023,13 +5122,14 @@ var ICON_INK = {
|
|
|
5023
5122
|
danger: "text-text-danger"
|
|
5024
5123
|
};
|
|
5025
5124
|
var ICON2 = { info: Info3, success: CheckCircle2, warning: AlertTriangle2, danger: XCircle };
|
|
5026
|
-
function InlineMessage({ tone = "info", title, children, actions, onDismiss, className }) {
|
|
5125
|
+
function InlineMessage({ tone = "info", title, children, actions, onDismiss, className, testIdPrefix }) {
|
|
5027
5126
|
const Icon = ICON2[tone];
|
|
5028
5127
|
return /* @__PURE__ */ jsxs47(
|
|
5029
5128
|
"div",
|
|
5030
5129
|
{
|
|
5031
5130
|
role: tone === "warning" || tone === "danger" ? "alert" : "status",
|
|
5032
5131
|
className: cn("flex items-start gap-2.5 rounded-control border px-3 py-2.5 text-sm", BOX[tone], className),
|
|
5132
|
+
"data-testid": testIdPrefix,
|
|
5033
5133
|
children: [
|
|
5034
5134
|
/* @__PURE__ */ jsx55(Icon, { size: 16, "aria-hidden": "true", className: cn("mt-0.5 shrink-0", ICON_INK[tone]) }),
|
|
5035
5135
|
/* @__PURE__ */ jsxs47("div", { className: "min-w-0 flex-1", children: [
|