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