@mediaradar/design-components 0.61.0 → 0.63.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
@@ -596,25 +596,286 @@ function Badge({ tone = "neutral", kind = "label", dot = false, highlight = fals
596
596
  }
597
597
 
598
598
  // src/Delta.tsx
599
+ import { createContext, useContext } from "react";
599
600
  import { ArrowDownRight, ArrowUpRight } from "lucide-react";
601
+
602
+ // src/Tooltip.tsx
603
+ import { useEffect as useEffect3, useId as useId2, useLayoutEffect, useRef as useRef3, useState as useState3 } from "react";
604
+ import { createPortal as createPortal2 } from "react-dom";
600
605
  import { jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
601
- function Delta({ value, suffix = "%", arrow = false, period, className, testIdPrefix }) {
602
- const up = value >= 0;
606
+ function addDescribedBy(el, id) {
607
+ const ids = (el.getAttribute("aria-describedby") ?? "").split(" ").filter(Boolean);
608
+ if (!ids.includes(id)) el.setAttribute("aria-describedby", [...ids, id].join(" "));
609
+ }
610
+ function removeDescribedBy(el, id) {
611
+ const ids = (el.getAttribute("aria-describedby") ?? "").split(" ").filter((x) => x && x !== id);
612
+ if (ids.length) el.setAttribute("aria-describedby", ids.join(" "));
613
+ else el.removeAttribute("aria-describedby");
614
+ }
615
+ function exitDurationMs(el) {
616
+ if (typeof window.matchMedia === "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches) return 0;
617
+ const cs = window.getComputedStyle(el);
618
+ if (cs.transitionProperty === "none") return 0;
619
+ const toMs = (v) => {
620
+ const n = parseFloat(v);
621
+ if (!Number.isFinite(n)) return 0;
622
+ return v.trim().endsWith("ms") ? n : n * 1e3;
623
+ };
624
+ const durations = cs.transitionDuration.split(",").map(toMs);
625
+ const delays = cs.transitionDelay.split(",").map(toMs);
626
+ return Math.max(0, ...durations.map((d, i) => d + (delays[i] ?? delays[0] ?? 0)));
627
+ }
628
+ function Tooltip({
629
+ label,
630
+ children,
631
+ anchorRef,
632
+ className,
633
+ whenTruncated = false,
634
+ interactive = false,
635
+ placement = "top",
636
+ align = "center",
637
+ delay = 0,
638
+ variant = "surface",
639
+ testIdPrefix
640
+ }) {
641
+ const [anchor, setAnchor] = useState3(null);
642
+ const [boxWidth, setBoxWidth] = useState3(null);
643
+ const ref = useRef3(null);
644
+ const boxRef = useRef3(null);
645
+ const hideTimer = useRef3(null);
646
+ const showTimer = useRef3(null);
647
+ const exitTimer = useRef3(null);
648
+ const [shown, setShown] = useState3(false);
649
+ const openRef = useRef3(false);
650
+ const mountedRef = useRef3(false);
651
+ const id = useId2();
652
+ const describedRef = useRef3(null);
653
+ const clearHideTimer = () => {
654
+ if (hideTimer.current) {
655
+ clearTimeout(hideTimer.current);
656
+ hideTimer.current = null;
657
+ }
658
+ };
659
+ const clearShowTimer = () => {
660
+ if (showTimer.current) {
661
+ clearTimeout(showTimer.current);
662
+ showTimer.current = null;
663
+ }
664
+ };
665
+ const clearExitTimer = () => {
666
+ if (exitTimer.current) {
667
+ clearTimeout(exitTimer.current);
668
+ exitTimer.current = null;
669
+ }
670
+ };
671
+ useEffect3(
672
+ () => () => {
673
+ clearHideTimer();
674
+ clearShowTimer();
675
+ clearExitTimer();
676
+ },
677
+ []
678
+ );
679
+ const reveal = () => {
680
+ const el = anchorRef ? anchorRef.current : ref.current;
681
+ if (!el) return;
682
+ if (whenTruncated && el.scrollWidth <= el.clientWidth) return;
683
+ clearExitTimer();
684
+ openRef.current = true;
685
+ const r = el.getBoundingClientRect();
686
+ if (!mountedRef.current) setBoxWidth(null);
687
+ mountedRef.current = true;
688
+ setAnchor({ top: r.top, left: r.left, width: r.width, height: r.height, bottom: r.bottom, right: r.right });
689
+ const target = anchorRef ? el : describedRef.current;
690
+ if (target) addDescribedBy(target, id);
691
+ };
692
+ const show = () => {
693
+ clearHideTimer();
694
+ clearShowTimer();
695
+ if (delay > 0 && !mountedRef.current) {
696
+ showTimer.current = setTimeout(reveal, delay);
697
+ } else {
698
+ reveal();
699
+ }
700
+ };
701
+ const unmount = () => {
702
+ clearExitTimer();
703
+ if (openRef.current || !mountedRef.current) return;
704
+ mountedRef.current = false;
705
+ setAnchor(null);
706
+ setBoxWidth(null);
707
+ if (anchorRef?.current) removeDescribedBy(anchorRef.current, id);
708
+ if (describedRef.current) removeDescribedBy(describedRef.current, id);
709
+ describedRef.current = null;
710
+ };
711
+ const hideNow = () => {
712
+ clearShowTimer();
713
+ clearHideTimer();
714
+ openRef.current = false;
715
+ if (!mountedRef.current) return;
716
+ setShown(false);
717
+ clearExitTimer();
718
+ const ms = boxRef.current ? exitDurationMs(boxRef.current) : 0;
719
+ if (ms === 0) {
720
+ unmount();
721
+ return;
722
+ }
723
+ exitTimer.current = setTimeout(unmount, ms + 50);
724
+ };
725
+ const keepOpen = () => {
726
+ clearHideTimer();
727
+ if (openRef.current || !mountedRef.current) return;
728
+ clearExitTimer();
729
+ openRef.current = true;
730
+ setShown(true);
731
+ };
732
+ const onBoxTransitionEnd = (e) => {
733
+ if (e.target !== e.currentTarget || e.propertyName !== "opacity") return;
734
+ if (!openRef.current) unmount();
735
+ };
736
+ const hide = () => {
737
+ clearShowTimer();
738
+ if (!interactive) {
739
+ hideNow();
740
+ return;
741
+ }
742
+ clearHideTimer();
743
+ hideTimer.current = setTimeout(hideNow, 120);
744
+ };
745
+ useEffect3(() => {
746
+ if (!anchorRef) return;
747
+ const el = anchorRef.current;
748
+ if (!el) return;
749
+ el.addEventListener("mouseenter", show);
750
+ el.addEventListener("mouseleave", hide);
751
+ el.addEventListener("focus", show);
752
+ el.addEventListener("blur", hide);
753
+ return () => {
754
+ el.removeEventListener("mouseenter", show);
755
+ el.removeEventListener("mouseleave", hide);
756
+ el.removeEventListener("focus", show);
757
+ el.removeEventListener("blur", hide);
758
+ };
759
+ }, [anchorRef, placement, delay]);
760
+ useEffect3(() => {
761
+ if (!anchor) return;
762
+ const onKey = (e) => e.key === "Escape" && hideNow();
763
+ window.addEventListener("keydown", onKey);
764
+ return () => window.removeEventListener("keydown", onKey);
765
+ }, [anchor]);
766
+ useLayoutEffect(() => {
767
+ if (!anchor) return;
768
+ const el = boxRef.current;
769
+ if (!el) return;
770
+ setBoxWidth(el.getBoundingClientRect().width);
771
+ if (openRef.current) setShown(true);
772
+ }, [anchor, label]);
773
+ const margin = 8;
774
+ let style = { top: 0, left: 0 };
775
+ let translate = "";
776
+ if (anchor) {
777
+ if (placement === "right") {
778
+ style = { top: anchor.top + anchor.height / 2, left: anchor.right + 8 };
779
+ translate = "-translate-y-1/2";
780
+ } else if (placement === "bottom-end") {
781
+ style = { top: anchor.bottom + 8, right: window.innerWidth - anchor.right };
782
+ } else {
783
+ const w = boxWidth ?? anchor.width;
784
+ const desired = align === "start" ? anchor.left : anchor.left + anchor.width / 2 - w / 2;
785
+ const left = Math.min(Math.max(desired, margin), Math.max(margin, window.innerWidth - w - margin));
786
+ style = { left, top: placement === "bottom" ? anchor.bottom : anchor.top };
787
+ translate = placement === "bottom" ? "translate-y-2" : "-translate-y-[calc(100%+8px)]";
788
+ }
789
+ }
790
+ const floating = anchor != null && typeof document !== "undefined" ? createPortal2(
791
+ /* @__PURE__ */ jsx6(
792
+ "span",
793
+ {
794
+ ref: boxRef,
795
+ role: "tooltip",
796
+ id,
797
+ "data-testid": testIdPrefix && `${testIdPrefix}-tooltip`,
798
+ style: { top: style.top, left: style.left, right: style.right, visibility: boxWidth == null ? "hidden" : "visible" },
799
+ onMouseEnter: interactive ? keepOpen : void 0,
800
+ onMouseLeave: interactive ? hide : void 0,
801
+ onTransitionEnd: onBoxTransitionEnd,
802
+ className: cn(
803
+ "fixed z-tooltip w-max max-w-xs whitespace-normal break-words px-2.5 py-1.5 text-xs leading-snug",
804
+ // Fade in/out. The sys duration token rather than a ref one:
805
+ // it is what Button's hover/press transition uses, and a
806
+ // tooltip's fade is the same kind of interactive feedback.
807
+ // design-tokens has no in-out curve (ease-interactive is the
808
+ // decelerating "standard" curve), so ease-in-out is Tailwind's.
809
+ "transition-opacity duration-(--mr-motion-duration-interactive) ease-in-out motion-reduce:transition-none",
810
+ shown ? "opacity-100" : "opacity-0",
811
+ // Non-interactive: never a pointer target, fade-out included.
812
+ interactive ? "pointer-events-auto" : "pointer-events-none",
813
+ variant === "inverted" ? "rounded-control bg-text-primary text-surface" : "rounded-control border border-border-default bg-surface text-text-primary shadow-overlay",
814
+ translate
815
+ ),
816
+ children: label
817
+ }
818
+ ),
819
+ document.body
820
+ ) : null;
821
+ if (anchorRef) return floating;
603
822
  return /* @__PURE__ */ jsxs6(
823
+ "span",
824
+ {
825
+ ref,
826
+ className,
827
+ "data-testid": testIdPrefix,
828
+ onMouseEnter: show,
829
+ onMouseLeave: hide,
830
+ onFocus: (e) => {
831
+ describedRef.current = e.target;
832
+ show();
833
+ },
834
+ onBlur: hide,
835
+ children: [
836
+ children,
837
+ floating
838
+ ]
839
+ }
840
+ );
841
+ }
842
+
843
+ // src/Delta.tsx
844
+ import { jsx as jsx7, jsxs as jsxs7 } from "react/jsx-runtime";
845
+ var DeltaBoldContext = createContext(false);
846
+ function Delta({ value, suffix = "%", unit, arrow = false, period, className, testIdPrefix }) {
847
+ const bold = useContext(DeltaBoldContext);
848
+ const abs = Math.abs(value);
849
+ const word = unit === void 0 ? null : typeof unit === "string" ? unit : abs === 1 ? unit.one : unit.other;
850
+ const shown = word !== null && Number.isInteger(abs) ? String(abs) : abs.toFixed(1);
851
+ if (Number(shown) === 0) {
852
+ const exact = value === 0 ? null : `${value > 0 ? "+" : "\u2212"}${abs}${word === null ? suffix : `\xA0${word}`}`;
853
+ const words = /* @__PURE__ */ jsxs7("span", { className: cn("text-text-tertiary", bold && "font-semibold", className), "data-testid": testIdPrefix, children: [
854
+ "No change",
855
+ exact && /* @__PURE__ */ jsxs7("span", { className: "sr-only", children: [
856
+ " (",
857
+ exact,
858
+ ")"
859
+ ] })
860
+ ] });
861
+ return exact ? /* @__PURE__ */ jsx7(Tooltip, { label: exact, delay: 300, children: words }) : words;
862
+ }
863
+ const up = value > 0;
864
+ return /* @__PURE__ */ jsxs7(
604
865
  "span",
605
866
  {
606
867
  className: cn(
607
- "inline-flex items-center gap-0.5 font-medium tabular-nums",
868
+ "inline-flex items-center gap-0.5 tabular-nums",
869
+ bold ? "font-semibold" : "font-medium",
608
870
  up ? "text-text-success" : "text-text-danger",
609
871
  className
610
872
  ),
611
873
  "data-testid": testIdPrefix,
612
874
  children: [
613
- arrow && (up ? /* @__PURE__ */ jsx6(ArrowUpRight, { size: 13, "aria-hidden": "true" }) : /* @__PURE__ */ jsx6(ArrowDownRight, { size: 13, "aria-hidden": "true" })),
875
+ arrow && (up ? /* @__PURE__ */ jsx7(ArrowUpRight, { size: 13, "aria-hidden": "true" }) : /* @__PURE__ */ jsx7(ArrowDownRight, { size: 13, "aria-hidden": "true" })),
614
876
  up ? "+" : "\u2212",
615
- Math.abs(value).toFixed(1),
616
- suffix,
617
- period && /* @__PURE__ */ jsx6("span", { className: "ml-0.5", children: period })
877
+ word === null ? `${shown}${suffix}` : `${shown}\xA0${word}`,
878
+ period && /* @__PURE__ */ jsx7("span", { className: "ml-0.5", children: period })
618
879
  ]
619
880
  }
620
881
  );
@@ -622,19 +883,19 @@ function Delta({ value, suffix = "%", arrow = false, period, className, testIdPr
622
883
 
623
884
  // src/PrimaryBadge.tsx
624
885
  import { Check as Check2 } from "lucide-react";
625
- import { jsx as jsx7, jsxs as jsxs7 } from "react/jsx-runtime";
886
+ import { jsx as jsx8, jsxs as jsxs8 } from "react/jsx-runtime";
626
887
  function PrimaryBadge({ label = "Primary", icon: Icon = Check2, title, className, testIdPrefix }) {
627
- const badge = /* @__PURE__ */ jsxs7(Badge, { tone: "brand", className: title ? void 0 : className, testIdPrefix, children: [
628
- Icon && /* @__PURE__ */ jsx7(Icon, { size: 11, "aria-hidden": "true" }),
888
+ const badge = /* @__PURE__ */ jsxs8(Badge, { tone: "brand", className: title ? void 0 : className, testIdPrefix, children: [
889
+ Icon && /* @__PURE__ */ jsx8(Icon, { size: 11, "aria-hidden": "true" }),
629
890
  label
630
891
  ] });
631
- return title ? /* @__PURE__ */ jsx7("span", { title, className: cn("inline-flex shrink-0", className), children: badge }) : badge;
892
+ return title ? /* @__PURE__ */ jsx8("span", { title, className: cn("inline-flex shrink-0", className), children: badge }) : badge;
632
893
  }
633
894
 
634
895
  // src/CheckBox.tsx
635
896
  import { forwardRef } from "react";
636
897
  import { Check as Check3, Minus } from "lucide-react";
637
- import { jsx as jsx8 } from "react/jsx-runtime";
898
+ import { jsx as jsx9 } from "react/jsx-runtime";
638
899
  function boxClass(on, disabled) {
639
900
  return cn(
640
901
  "flex size-4.5 shrink-0 items-center justify-center rounded-small border transition-colors",
@@ -643,12 +904,12 @@ function boxClass(on, disabled) {
643
904
  );
644
905
  }
645
906
  function Glyph({ checked, indeterminate }) {
646
- if (indeterminate) return /* @__PURE__ */ jsx8(Minus, { size: 13, strokeWidth: 3 });
647
- return checked ? /* @__PURE__ */ jsx8(Check3, { size: 13, strokeWidth: 3 }) : null;
907
+ if (indeterminate) return /* @__PURE__ */ jsx9(Minus, { size: 13, strokeWidth: 3 });
908
+ return checked ? /* @__PURE__ */ jsx9(Check3, { size: 13, strokeWidth: 3 }) : null;
648
909
  }
649
910
  var CheckBox = forwardRef(function CheckBox2({ checked, indeterminate, onChange, ariaLabel, disabled, stopPropagation = true, testId, testIdPrefix, title, className }, ref) {
650
911
  const on = checked || !!indeterminate;
651
- return /* @__PURE__ */ jsx8(
912
+ return /* @__PURE__ */ jsx9(
652
913
  "button",
653
914
  {
654
915
  ref,
@@ -673,29 +934,29 @@ var CheckBox = forwardRef(function CheckBox2({ checked, indeterminate, onChange,
673
934
  disabled && "hover:border-border-interactive",
674
935
  className
675
936
  ),
676
- children: /* @__PURE__ */ jsx8(Glyph, { checked, indeterminate })
937
+ children: /* @__PURE__ */ jsx9(Glyph, { checked, indeterminate })
677
938
  }
678
939
  );
679
940
  });
680
941
  CheckBox.displayName = "CheckBox";
681
942
  var CheckBoxBox = forwardRef(function CheckBoxBox2({ checked, indeterminate, disabled, className, testIdPrefix }, ref) {
682
- return /* @__PURE__ */ jsx8(
943
+ return /* @__PURE__ */ jsx9(
683
944
  "span",
684
945
  {
685
946
  ref,
686
947
  "aria-hidden": "true",
687
948
  "data-testid": testIdPrefix,
688
949
  className: cn(boxClass(checked || !!indeterminate, disabled), className),
689
- children: /* @__PURE__ */ jsx8(Glyph, { checked, indeterminate })
950
+ children: /* @__PURE__ */ jsx9(Glyph, { checked, indeterminate })
690
951
  }
691
952
  );
692
953
  });
693
954
  CheckBoxBox.displayName = "CheckBoxBox";
694
955
 
695
956
  // src/DateRangeFilter.tsx
696
- import { useEffect as useEffect3, useId as useId2, useLayoutEffect, useMemo as useMemo2, useRef as useRef3, useState as useState3 } from "react";
957
+ import { useEffect as useEffect4, useId as useId3, useLayoutEffect as useLayoutEffect2, useMemo as useMemo2, useRef as useRef4, useState as useState4 } from "react";
697
958
  import { ChevronDown as ChevronDown2, ChevronLeft, ChevronRight } from "lucide-react";
698
- import { jsx as jsx9, jsxs as jsxs8 } from "react/jsx-runtime";
959
+ import { jsx as jsx10, jsxs as jsxs9 } from "react/jsx-runtime";
699
960
  var DEFAULT_SHORTCUTS = [
700
961
  "Year to date",
701
962
  "Rolling 3 months",
@@ -881,35 +1142,35 @@ function DateRangeFilter({
881
1142
  const initRange = controlled ? controlledRange : initShortcut === "Custom" && initialRange ? snap(...initialRange) : snap(...presetRange(initShortcut === "Custom" ? "Rolling 12 months" : initShortcut, today));
882
1143
  const compareLabel = (id) => compare?.options.find((o) => o.id === id)?.label;
883
1144
  const dateLine = (s, e) => monthly ? `${fmtMonth(s)} \u2013 ${fmtMonth(e)}` : formatted ? showRange(s, e) : shortDates ? `${fmt(s)} \u2013 ${fmt(e)}` : fullRangeLabel(s, e);
884
- const [open, setOpen] = useState3(false);
885
- const [uncontrolledValue, setUncontrolledValue] = useState3(
1145
+ const [open, setOpen] = useState4(false);
1146
+ const [uncontrolledValue, setUncontrolledValue] = useState4(
886
1147
  startsEmpty ? emptyLabel : showDates ? presetLabel(initShortcut) : defaultValue || "Last 7 days"
887
1148
  );
888
- const [uncontrolledDatesLine, setUncontrolledDatesLine] = useState3(
1149
+ const [uncontrolledDatesLine, setUncontrolledDatesLine] = useState4(
889
1150
  startsEmpty ? null : dateLine(initRange[0], initRange[1])
890
1151
  );
891
- const committed = useRef3({ shortcut: initShortcut, start: initRange[0], end: initRange[1], set: !startsEmpty });
892
- const [cmp, setCmp] = useState3(compare?.value);
893
- const committedCmp = useRef3(compare?.value);
894
- const [appliedCmp, setAppliedCmp] = useState3(compare?.value);
895
- useEffect3(() => {
1152
+ const committed = useRef4({ shortcut: initShortcut, start: initRange[0], end: initRange[1], set: !startsEmpty });
1153
+ const [cmp, setCmp] = useState4(compare?.value);
1154
+ const committedCmp = useRef4(compare?.value);
1155
+ const [appliedCmp, setAppliedCmp] = useState4(compare?.value);
1156
+ useEffect4(() => {
896
1157
  committedCmp.current = compare?.value;
897
1158
  setAppliedCmp(compare?.value);
898
1159
  }, [compare?.value]);
899
- const compareName = `${useId2()}-compare`;
1160
+ const compareName = `${useId3()}-compare`;
900
1161
  const displayValue = controlled ? showDates ? presetLabel(initShortcut) : showValue(controlledValue, initRange[0], initRange[1]) : showValue(uncontrolledValue, committed.current.start, committed.current.end);
901
1162
  const displayDatesLine = controlled ? dateLine(initRange[0], initRange[1]) : uncontrolledDatesLine;
902
- const [shortcut, setShortcut] = useState3(initShortcut);
903
- const [start, setStart] = useState3(initRange[0]);
904
- const [end, setEnd] = useState3(initRange[1]);
905
- const [leftMonth, setLeftMonth] = useState3(new Date(initRange[0].getFullYear(), initRange[0].getMonth(), 1));
906
- const ref = useRef3(null);
907
- const triggerRef = useRef3(null);
908
- useEffect3(() => {
1163
+ const [shortcut, setShortcut] = useState4(initShortcut);
1164
+ const [start, setStart] = useState4(initRange[0]);
1165
+ const [end, setEnd] = useState4(initRange[1]);
1166
+ const [leftMonth, setLeftMonth] = useState4(new Date(initRange[0].getFullYear(), initRange[0].getMonth(), 1));
1167
+ const ref = useRef4(null);
1168
+ const triggerRef = useRef4(null);
1169
+ useEffect4(() => {
909
1170
  if (controlled || startsEmpty) return;
910
1171
  onRangeChange?.(committed.current.start, committed.current.end);
911
1172
  }, []);
912
- useEffect3(() => {
1173
+ useEffect4(() => {
913
1174
  if (!open) return;
914
1175
  const committedShortcut = controlled ? initShortcut : committed.current.shortcut;
915
1176
  const committedStart = controlled ? initRange[0] : committed.current.start;
@@ -976,16 +1237,16 @@ function DateRangeFilter({
976
1237
  setOpen(false);
977
1238
  triggerRef.current?.focus();
978
1239
  };
979
- const popRef = useRef3(null);
980
- const monthIdBase = useId2();
981
- const [flipBelow, setFlipBelow] = useState3(false);
982
- useLayoutEffect(() => {
1240
+ const popRef = useRef4(null);
1241
+ const monthIdBase = useId3();
1242
+ const [flipBelow, setFlipBelow] = useState4(false);
1243
+ useLayoutEffect2(() => {
983
1244
  if (!open || placement !== "above" || !ref.current || !popRef.current) return;
984
1245
  setFlipBelow(ref.current.getBoundingClientRect().top < popRef.current.offsetHeight + 16);
985
1246
  }, [open, placement]);
986
1247
  const above = placement === "above" && !flipBelow;
987
- return /* @__PURE__ */ jsxs8("div", { className: cn("relative", className), ref, "data-testid": testIdPrefix, children: [
988
- /* @__PURE__ */ jsxs8(
1248
+ return /* @__PURE__ */ jsxs9("div", { className: cn("relative", className), ref, "data-testid": testIdPrefix, children: [
1249
+ /* @__PURE__ */ jsxs9(
989
1250
  "button",
990
1251
  {
991
1252
  ref: triggerRef,
@@ -995,22 +1256,22 @@ function DateRangeFilter({
995
1256
  "aria-expanded": open,
996
1257
  className: chipTriggerClass(),
997
1258
  children: [
998
- icon && /* @__PURE__ */ jsx9("span", { className: "shrink-0 text-text-tertiary", children: icon }),
999
- /* @__PURE__ */ jsxs8("span", { className: "flex flex-col gap-1 text-left leading-none", children: [
1000
- /* @__PURE__ */ jsx9("span", { className: showDates && displayDatesLine ? "text-micro leading-none text-text-tertiary" : "text-control-caption leading-none uppercase tracking-wide text-text-tertiary", children: showDates && displayDatesLine ? displayDatesLine : caption }),
1001
- /* @__PURE__ */ jsxs8("span", { className: "text-xs leading-none font-medium text-text-primary", children: [
1259
+ icon && /* @__PURE__ */ jsx10("span", { className: "shrink-0 text-text-tertiary", children: icon }),
1260
+ /* @__PURE__ */ jsxs9("span", { className: "flex flex-col gap-1 text-left leading-none", children: [
1261
+ /* @__PURE__ */ jsx10("span", { className: showDates && displayDatesLine ? "text-micro leading-none text-text-tertiary" : "text-control-caption leading-none uppercase tracking-wide text-text-tertiary", children: showDates && displayDatesLine ? displayDatesLine : caption }),
1262
+ /* @__PURE__ */ jsxs9("span", { className: "text-xs leading-none font-medium text-text-primary", children: [
1002
1263
  displayValue,
1003
- compareLabel(appliedCmp) && /* @__PURE__ */ jsxs8("span", { className: "font-normal text-text-secondary", children: [
1264
+ compareLabel(appliedCmp) && /* @__PURE__ */ jsxs9("span", { className: "font-normal text-text-secondary", children: [
1004
1265
  " \xB7 vs ",
1005
1266
  compareLabel(appliedCmp).toLowerCase()
1006
1267
  ] })
1007
1268
  ] })
1008
1269
  ] }),
1009
- /* @__PURE__ */ jsx9(ChevronDown2, { size: 14, "aria-hidden": "true", className: `shrink-0 text-text-secondary transition-transform ${open ? "rotate-180" : ""}` })
1270
+ /* @__PURE__ */ jsx10(ChevronDown2, { size: 14, "aria-hidden": "true", className: `shrink-0 text-text-secondary transition-transform ${open ? "rotate-180" : ""}` })
1010
1271
  ]
1011
1272
  }
1012
1273
  ),
1013
- open && /* @__PURE__ */ jsxs8(
1274
+ open && /* @__PURE__ */ jsxs9(
1014
1275
  "div",
1015
1276
  {
1016
1277
  "data-testid": testIdPrefix && `${testIdPrefix}-popover`,
@@ -1019,7 +1280,7 @@ function DateRangeFilter({
1019
1280
  role: "dialog",
1020
1281
  "aria-label": "Select date range",
1021
1282
  children: [
1022
- /* @__PURE__ */ jsx9("div", { className: "flex w-44 shrink-0 flex-col gap-0.5 border-r border-border-default p-2", children: SHORTCUTS.map((s) => /* @__PURE__ */ jsx9(
1283
+ /* @__PURE__ */ jsx10("div", { className: "flex w-44 shrink-0 flex-col gap-0.5 border-r border-border-default p-2", children: SHORTCUTS.map((s) => /* @__PURE__ */ jsx10(
1023
1284
  "button",
1024
1285
  {
1025
1286
  type: "button",
@@ -1030,28 +1291,28 @@ function DateRangeFilter({
1030
1291
  },
1031
1292
  s
1032
1293
  )) }),
1033
- /* @__PURE__ */ jsxs8("div", { className: "flex flex-col p-4", children: [
1034
- /* @__PURE__ */ jsxs8("div", { className: "flex items-end gap-3", children: [
1035
- /* @__PURE__ */ jsx9(Field, { label: "Start date", value: start ? showDate(start) : "\u2014" }),
1036
- /* @__PURE__ */ jsx9("span", { className: "pb-2.5 text-text-tertiary", children: "\u2014" }),
1037
- /* @__PURE__ */ jsx9(Field, { label: "End date", value: end ? showDate(end) : start ? showDate(start) : "\u2014" })
1294
+ /* @__PURE__ */ jsxs9("div", { className: "flex flex-col p-4", children: [
1295
+ /* @__PURE__ */ jsxs9("div", { className: "flex items-end gap-3", children: [
1296
+ /* @__PURE__ */ jsx10(Field, { label: "Start date", value: start ? showDate(start) : "\u2014" }),
1297
+ /* @__PURE__ */ jsx10("span", { className: "pb-2.5 text-text-tertiary", children: "\u2014" }),
1298
+ /* @__PURE__ */ jsx10(Field, { label: "End date", value: end ? showDate(end) : start ? showDate(start) : "\u2014" })
1038
1299
  ] }),
1039
- /* @__PURE__ */ jsx9("div", { className: "my-4 border-t border-border-default" }),
1040
- /* @__PURE__ */ jsx9("div", { className: "flex gap-8", children: [0, 1].map((offset) => {
1300
+ /* @__PURE__ */ jsx10("div", { className: "my-4 border-t border-border-default" }),
1301
+ /* @__PURE__ */ jsx10("div", { className: "flex gap-8", children: [0, 1].map((offset) => {
1041
1302
  const m = addMonths(leftMonth, offset);
1042
1303
  const grid = monthGrid(m.getFullYear(), m.getMonth());
1043
- return /* @__PURE__ */ jsxs8("div", { className: "w-63", children: [
1044
- /* @__PURE__ */ jsxs8("div", { className: "mb-2 flex items-center justify-between", children: [
1045
- offset === 0 ? /* @__PURE__ */ jsx9(NavBtn, { onClick: () => setLeftMonth(addMonths(leftMonth, -1)), "aria-label": "Previous month", children: /* @__PURE__ */ jsx9(ChevronLeft, { size: 16 }) }) : /* @__PURE__ */ jsx9("span", { className: "h-7 w-7" }),
1046
- /* @__PURE__ */ jsxs8("span", { id: `${monthIdBase}-m${offset}`, "aria-live": "polite", className: "text-panel-title font-semibold text-text-primary", children: [
1304
+ return /* @__PURE__ */ jsxs9("div", { className: "w-63", children: [
1305
+ /* @__PURE__ */ jsxs9("div", { className: "mb-2 flex items-center justify-between", children: [
1306
+ offset === 0 ? /* @__PURE__ */ jsx10(NavBtn, { onClick: () => setLeftMonth(addMonths(leftMonth, -1)), "aria-label": "Previous month", children: /* @__PURE__ */ jsx10(ChevronLeft, { size: 16 }) }) : /* @__PURE__ */ jsx10("span", { className: "h-7 w-7" }),
1307
+ /* @__PURE__ */ jsxs9("span", { id: `${monthIdBase}-m${offset}`, "aria-live": "polite", className: "text-panel-title font-semibold text-text-primary", children: [
1047
1308
  MONTHS[m.getMonth()],
1048
1309
  " ",
1049
1310
  m.getFullYear()
1050
1311
  ] }),
1051
- offset === 1 ? /* @__PURE__ */ jsx9(NavBtn, { onClick: () => setLeftMonth(addMonths(leftMonth, 1)), "aria-label": "Next month", children: /* @__PURE__ */ jsx9(ChevronRight, { size: 16 }) }) : /* @__PURE__ */ jsx9("span", { className: "h-7 w-7" })
1312
+ offset === 1 ? /* @__PURE__ */ jsx10(NavBtn, { onClick: () => setLeftMonth(addMonths(leftMonth, 1)), "aria-label": "Next month", children: /* @__PURE__ */ jsx10(ChevronRight, { size: 16 }) }) : /* @__PURE__ */ jsx10("span", { className: "h-7 w-7" })
1052
1313
  ] }),
1053
- /* @__PURE__ */ jsxs8("div", { className: "grid grid-cols-7", role: "group", "aria-labelledby": `${monthIdBase}-m${offset}`, children: [
1054
- WEEKDAYS.map((w) => /* @__PURE__ */ jsx9("div", { "aria-hidden": "true", className: "flex h-8 items-center justify-center text-xs font-semibold text-text-secondary", children: w }, w)),
1314
+ /* @__PURE__ */ jsxs9("div", { className: "grid grid-cols-7", role: "group", "aria-labelledby": `${monthIdBase}-m${offset}`, children: [
1315
+ WEEKDAYS.map((w) => /* @__PURE__ */ jsx10("div", { "aria-hidden": "true", className: "flex h-8 items-center justify-center text-xs font-semibold text-text-secondary", children: w }, w)),
1055
1316
  grid.map((d, i) => {
1056
1317
  const inMonth = d.getMonth() === m.getMonth();
1057
1318
  const hasRange = !!(start && end);
@@ -1066,7 +1327,7 @@ function DateRangeFilter({
1066
1327
  else if (end && isEnd) band = "left-0 right-1/2";
1067
1328
  else band = "left-0 right-0";
1068
1329
  }
1069
- return /* @__PURE__ */ jsxs8(
1330
+ return /* @__PURE__ */ jsxs9(
1070
1331
  "button",
1071
1332
  {
1072
1333
  type: "button",
@@ -1075,8 +1336,8 @@ function DateRangeFilter({
1075
1336
  "aria-pressed": endpoint || inRange,
1076
1337
  className: "relative flex h-9 items-center justify-center focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-border-focus",
1077
1338
  children: [
1078
- band && /* @__PURE__ */ jsx9("span", { className: `absolute inset-y-1 bg-ai-tint ${band}`, "aria-hidden": "true" }),
1079
- /* @__PURE__ */ jsx9(
1339
+ band && /* @__PURE__ */ jsx10("span", { className: `absolute inset-y-1 bg-ai-tint ${band}`, "aria-hidden": "true" }),
1340
+ /* @__PURE__ */ jsx10(
1080
1341
  "span",
1081
1342
  {
1082
1343
  className: `relative z-10 flex h-8 w-8 items-center justify-center rounded-full text-dense tabular-nums ${endpoint ? "bg-brand-primaryAction font-semibold text-brand-onprimary" : inMonth ? "text-text-primary hover:bg-subtle" : "text-text-tertiary"}`,
@@ -1091,16 +1352,16 @@ function DateRangeFilter({
1091
1352
  ] })
1092
1353
  ] }, offset);
1093
1354
  }) }),
1094
- compare && /* @__PURE__ */ jsxs8("fieldset", { className: "mt-4 border-t border-border-default pt-4", children: [
1095
- /* @__PURE__ */ jsx9("legend", { className: "float-left mb-2 w-full text-xs font-medium text-text-secondary", children: "Compare to" }),
1096
- /* @__PURE__ */ jsx9("div", { className: "clear-left flex flex-col gap-1", children: compare.options.map((o) => {
1355
+ compare && /* @__PURE__ */ jsxs9("fieldset", { className: "mt-4 border-t border-border-default pt-4", children: [
1356
+ /* @__PURE__ */ jsx10("legend", { className: "float-left mb-2 w-full text-xs font-medium text-text-secondary", children: "Compare to" }),
1357
+ /* @__PURE__ */ jsx10("div", { className: "clear-left flex flex-col gap-1", children: compare.options.map((o) => {
1097
1358
  const on = (cmp ?? compare.value) === o.id;
1098
- return /* @__PURE__ */ jsxs8(
1359
+ return /* @__PURE__ */ jsxs9(
1099
1360
  "label",
1100
1361
  {
1101
1362
  className: `flex cursor-pointer items-center gap-2.5 rounded-control px-2 py-1.5 text-dense transition-colors ${on ? "bg-subtle" : "hover:bg-subtle"}`,
1102
1363
  children: [
1103
- /* @__PURE__ */ jsx9(
1364
+ /* @__PURE__ */ jsx10(
1104
1365
  "input",
1105
1366
  {
1106
1367
  type: "radio",
@@ -1112,21 +1373,21 @@ function DateRangeFilter({
1112
1373
  className: "h-4 w-4 accent-brand-primaryAction"
1113
1374
  }
1114
1375
  ),
1115
- /* @__PURE__ */ jsx9("span", { className: `w-44 shrink-0 ${on ? "font-semibold text-text-primary" : "text-text-secondary"}`, children: o.label }),
1116
- start && /* @__PURE__ */ jsx9("span", { className: "tabular-nums text-text-tertiary", children: (formatted ? showRange : spanLabel)(...compareSpan(start, end ?? start, o.id)) })
1376
+ /* @__PURE__ */ jsx10("span", { className: `w-44 shrink-0 ${on ? "font-semibold text-text-primary" : "text-text-secondary"}`, children: o.label }),
1377
+ start && /* @__PURE__ */ jsx10("span", { className: "tabular-nums text-text-tertiary", children: (formatted ? showRange : spanLabel)(...compareSpan(start, end ?? start, o.id)) })
1117
1378
  ]
1118
1379
  },
1119
1380
  o.id
1120
1381
  );
1121
1382
  }) })
1122
1383
  ] }),
1123
- /* @__PURE__ */ jsxs8("div", { className: "mt-4 flex items-center justify-end gap-2", children: [
1124
- monthly && /* @__PURE__ */ jsx9("span", { className: "mr-auto text-xs text-text-tertiary", children: "Data is monthly, so ranges cover whole months." }),
1125
- /* @__PURE__ */ jsx9("button", { type: "button", "data-testid": testIdPrefix && `${testIdPrefix}-cancel`, onClick: () => {
1384
+ /* @__PURE__ */ jsxs9("div", { className: "mt-4 flex items-center justify-end gap-2", children: [
1385
+ monthly && /* @__PURE__ */ jsx10("span", { className: "mr-auto text-xs text-text-tertiary", children: "Data is monthly, so ranges cover whole months." }),
1386
+ /* @__PURE__ */ jsx10("button", { type: "button", "data-testid": testIdPrefix && `${testIdPrefix}-cancel`, onClick: () => {
1126
1387
  setOpen(false);
1127
1388
  triggerRef.current?.focus();
1128
1389
  }, 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-1 focus-visible:outline-border-focus", children: "Cancel" }),
1129
- /* @__PURE__ */ jsx9("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-1 focus-visible:outline-border-focus", children: "Apply" })
1390
+ /* @__PURE__ */ jsx10("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-1 focus-visible:outline-border-focus", children: "Apply" })
1130
1391
  ] })
1131
1392
  ] })
1132
1393
  ]
@@ -1135,19 +1396,19 @@ function DateRangeFilter({
1135
1396
  ] });
1136
1397
  }
1137
1398
  function Field({ label, value }) {
1138
- return /* @__PURE__ */ jsxs8("div", { className: "flex flex-col gap-1.5", children: [
1139
- /* @__PURE__ */ jsx9("span", { className: "text-xs font-medium text-text-secondary", children: label }),
1140
- /* @__PURE__ */ jsx9("div", { className: "flex h-10 min-w-35 items-center rounded-control border border-border-strong bg-input px-3 text-sm font-medium text-text-primary", children: value })
1399
+ return /* @__PURE__ */ jsxs9("div", { className: "flex flex-col gap-1.5", children: [
1400
+ /* @__PURE__ */ jsx10("span", { className: "text-xs font-medium text-text-secondary", children: label }),
1401
+ /* @__PURE__ */ jsx10("div", { className: "flex h-10 min-w-35 items-center rounded-control border border-border-strong bg-input px-3 text-sm font-medium text-text-primary", children: value })
1141
1402
  ] });
1142
1403
  }
1143
1404
  function NavBtn({ children, onClick, ...rest }) {
1144
- return /* @__PURE__ */ jsx9("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-1 focus-visible:outline-border-focus", ...rest, children });
1405
+ return /* @__PURE__ */ jsx10("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-1 focus-visible:outline-border-focus", ...rest, children });
1145
1406
  }
1146
1407
 
1147
1408
  // src/SearchBar.tsx
1148
- import { forwardRef as forwardRef2, useEffect as useEffect4, useId as useId3, useLayoutEffect as useLayoutEffect2, useRef as useRef4, useState as useState4 } from "react";
1409
+ import { forwardRef as forwardRef2, useEffect as useEffect5, useId as useId4, useLayoutEffect as useLayoutEffect3, useRef as useRef5, useState as useState5 } from "react";
1149
1410
  import { AlertCircle, Check as Check4, ChevronDown as ChevronDown3, Search as Search3, X as X2 } from "lucide-react";
1150
- import { Fragment as Fragment2, jsx as jsx10, jsxs as jsxs9 } from "react/jsx-runtime";
1411
+ import { Fragment as Fragment2, jsx as jsx11, jsxs as jsxs10 } from "react/jsx-runtime";
1151
1412
  var HEIGHT = { sm: "h-8", md: "h-10", lg: "h-11" };
1152
1413
  var DEFAULT_SEARCH_MATCH = { mode: "anyWord", wordJoin: "Or" };
1153
1414
  var MODE_LABEL = {
@@ -1190,22 +1451,22 @@ var SearchBar = forwardRef2(function SearchBar2({
1190
1451
  className,
1191
1452
  testIdPrefix
1192
1453
  }, forwardedRef) {
1193
- const [open, setOpen] = useState4(false);
1194
- const ref = useRef4(null);
1195
- const input = useRef4(null);
1454
+ const [open, setOpen] = useState5(false);
1455
+ const ref = useRef5(null);
1456
+ const input = useRef5(null);
1196
1457
  const setInput = (el) => {
1197
1458
  input.current = el;
1198
1459
  if (typeof forwardedRef === "function") forwardedRef(el);
1199
1460
  else if (forwardedRef) forwardedRef.current = el;
1200
1461
  };
1201
- const [codesOpen, setCodesOpen] = useState4(false);
1202
- const codesRef = useRef4(null);
1203
- const codesPopover = useRef4(null);
1204
- const refocus = useRef4(null);
1462
+ const [codesOpen, setCodesOpen] = useState5(false);
1463
+ const codesRef = useRef5(null);
1464
+ const codesPopover = useRef5(null);
1465
+ const refocus = useRef5(null);
1205
1466
  const adCodeMode = variant === "filterable" && matchValue?.mode === "adCode" && !!onAdCodesChange;
1206
1467
  const matchedCount = adCodes.filter((c) => isAdCodeMatched?.(c)).length;
1207
1468
  const hasMisses = !!isAdCodeMatched && matchedCount < adCodes.length;
1208
- useEffect4(() => {
1469
+ useEffect5(() => {
1209
1470
  if (!codesOpen) return;
1210
1471
  const onKey = (e) => {
1211
1472
  if (e.key !== "Escape") return;
@@ -1222,7 +1483,7 @@ var SearchBar = forwardRef2(function SearchBar2({
1222
1483
  window.removeEventListener("mousedown", onClick);
1223
1484
  };
1224
1485
  }, [codesOpen]);
1225
- useLayoutEffect2(() => {
1486
+ useLayoutEffect3(() => {
1226
1487
  const i = refocus.current;
1227
1488
  if (i === null) return;
1228
1489
  refocus.current = null;
@@ -1235,7 +1496,7 @@ var SearchBar = forwardRef2(function SearchBar2({
1235
1496
  if (!next.length) setCodesOpen(false);
1236
1497
  onAdCodesChange?.(next);
1237
1498
  };
1238
- useEffect4(() => {
1499
+ useEffect5(() => {
1239
1500
  if (!open) return;
1240
1501
  const onKey = (e) => e.key === "Escape" && setOpen(false);
1241
1502
  const onClick = (e) => {
@@ -1249,7 +1510,7 @@ var SearchBar = forwardRef2(function SearchBar2({
1249
1510
  };
1250
1511
  }, [open]);
1251
1512
  const showMatch = variant === "filterable" && matchValue;
1252
- return /* @__PURE__ */ jsxs9(
1513
+ return /* @__PURE__ */ jsxs10(
1253
1514
  "div",
1254
1515
  {
1255
1516
  className: cn(
@@ -1262,8 +1523,8 @@ var SearchBar = forwardRef2(function SearchBar2({
1262
1523
  ),
1263
1524
  "data-testid": testIdPrefix,
1264
1525
  children: [
1265
- scope && /* @__PURE__ */ jsx10(ScopeMenu, { scope, onOpenChange: onScopeOpenChange, testIdPrefix }),
1266
- /* @__PURE__ */ jsxs9(
1526
+ scope && /* @__PURE__ */ jsx11(ScopeMenu, { scope, onOpenChange: onScopeOpenChange, testIdPrefix }),
1527
+ /* @__PURE__ */ jsxs10(
1267
1528
  "div",
1268
1529
  {
1269
1530
  ref: codesRef,
@@ -1275,8 +1536,8 @@ var SearchBar = forwardRef2(function SearchBar2({
1275
1536
  }
1276
1537
  },
1277
1538
  children: [
1278
- /* @__PURE__ */ jsx10(Search3, { size: 15, "aria-hidden": "true", className: "shrink-0 text-text-tertiary" }),
1279
- adCodeMode && adCodes.length > 0 && /* @__PURE__ */ jsxs9(
1539
+ /* @__PURE__ */ jsx11(Search3, { size: 15, "aria-hidden": "true", className: "shrink-0 text-text-tertiary" }),
1540
+ adCodeMode && adCodes.length > 0 && /* @__PURE__ */ jsxs10(
1280
1541
  "span",
1281
1542
  {
1282
1543
  className: cn(
@@ -1284,7 +1545,7 @@ var SearchBar = forwardRef2(function SearchBar2({
1284
1545
  hasMisses ? "bg-status-danger/15 text-text-danger" : "bg-subtle text-text-primary"
1285
1546
  ),
1286
1547
  children: [
1287
- /* @__PURE__ */ jsxs9(
1548
+ /* @__PURE__ */ jsxs10(
1288
1549
  "button",
1289
1550
  {
1290
1551
  type: "button",
@@ -1294,12 +1555,12 @@ var SearchBar = forwardRef2(function SearchBar2({
1294
1555
  "data-testid": testIdPrefix && `${testIdPrefix}-ad-codes`,
1295
1556
  className: "inline-flex items-center gap-1 rounded-control focus-visible:outline-solid focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-border-focus",
1296
1557
  children: [
1297
- hasMisses && /* @__PURE__ */ jsx10(AlertCircle, { size: 13, "aria-hidden": "true" }),
1558
+ hasMisses && /* @__PURE__ */ jsx11(AlertCircle, { size: 13, "aria-hidden": "true" }),
1298
1559
  hasMisses ? `${matchedCount} of ${adCodes.length} matched` : adCodes.length === 1 ? adCodes[0] : `${adCodes.length} Ad Codes`
1299
1560
  ]
1300
1561
  }
1301
1562
  ),
1302
- /* @__PURE__ */ jsx10(
1563
+ /* @__PURE__ */ jsx11(
1303
1564
  "button",
1304
1565
  {
1305
1566
  type: "button",
@@ -1307,13 +1568,13 @@ var SearchBar = forwardRef2(function SearchBar2({
1307
1568
  onClick: () => updateCodes([], -1),
1308
1569
  "data-testid": testIdPrefix && `${testIdPrefix}-ad-codes-clear`,
1309
1570
  className: "inline-flex rounded-full p-0.5 hover:bg-surface focus-visible:outline-solid focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-border-focus",
1310
- children: /* @__PURE__ */ jsx10(X2, { size: 12, "aria-hidden": "true" })
1571
+ children: /* @__PURE__ */ jsx11(X2, { size: 12, "aria-hidden": "true" })
1311
1572
  }
1312
1573
  )
1313
1574
  ]
1314
1575
  }
1315
1576
  ),
1316
- /* @__PURE__ */ jsx10(
1577
+ /* @__PURE__ */ jsx11(
1317
1578
  "input",
1318
1579
  {
1319
1580
  ref: setInput,
@@ -1334,7 +1595,7 @@ var SearchBar = forwardRef2(function SearchBar2({
1334
1595
  className: "min-w-0 flex-1 bg-transparent text-dense text-text-primary outline-hidden placeholder:text-text-tertiary"
1335
1596
  }
1336
1597
  ),
1337
- adCodeMode && codesOpen && adCodes.length > 0 && /* @__PURE__ */ jsxs9(
1598
+ adCodeMode && codesOpen && adCodes.length > 0 && /* @__PURE__ */ jsxs10(
1338
1599
  "div",
1339
1600
  {
1340
1601
  ref: codesPopover,
@@ -1343,10 +1604,10 @@ var SearchBar = forwardRef2(function SearchBar2({
1343
1604
  "data-testid": testIdPrefix && `${testIdPrefix}-ad-codes-popover`,
1344
1605
  className: "absolute right-0 top-full z-50 mt-2 w-110 max-w-[90vw] cursor-auto rounded-card border border-border-default bg-surface p-3 shadow-overlay",
1345
1606
  children: [
1346
- /* @__PURE__ */ jsx10("p", { className: "mb-2 text-xs font-medium text-text-secondary", children: isAdCodeMatched ? `${matchedCount} ${matchedCount === 1 ? "ad was" : "ads were"} found` : `${adCodes.length} ${adCodes.length === 1 ? "ad code" : "ad codes"}` }),
1347
- /* @__PURE__ */ jsx10("ul", { className: "flex max-h-50 flex-wrap gap-2 overflow-y-auto p-0.5", children: adCodes.map((code, i) => {
1607
+ /* @__PURE__ */ jsx11("p", { className: "mb-2 text-xs font-medium text-text-secondary", children: isAdCodeMatched ? `${matchedCount} ${matchedCount === 1 ? "ad was" : "ads were"} found` : `${adCodes.length} ${adCodes.length === 1 ? "ad code" : "ad codes"}` }),
1608
+ /* @__PURE__ */ jsx11("ul", { className: "flex max-h-50 flex-wrap gap-2 overflow-y-auto p-0.5", children: adCodes.map((code, i) => {
1348
1609
  const missed = !!isAdCodeMatched && !isAdCodeMatched(code);
1349
- return /* @__PURE__ */ jsxs9(
1610
+ return /* @__PURE__ */ jsxs10(
1350
1611
  "li",
1351
1612
  {
1352
1613
  className: cn(
@@ -1355,8 +1616,8 @@ var SearchBar = forwardRef2(function SearchBar2({
1355
1616
  ),
1356
1617
  children: [
1357
1618
  code,
1358
- missed && /* @__PURE__ */ jsx10("span", { className: "sr-only", children: " (not found)" }),
1359
- /* @__PURE__ */ jsx10(
1619
+ missed && /* @__PURE__ */ jsx11("span", { className: "sr-only", children: " (not found)" }),
1620
+ /* @__PURE__ */ jsx11(
1360
1621
  "button",
1361
1622
  {
1362
1623
  type: "button",
@@ -1365,7 +1626,7 @@ var SearchBar = forwardRef2(function SearchBar2({
1365
1626
  onClick: () => updateCodes(adCodes.filter((c) => c !== code), i),
1366
1627
  "data-testid": testIdPrefix && `${testIdPrefix}-ad-code-remove-${slug3(code)}`,
1367
1628
  className: "inline-flex rounded-full p-0.5 hover:bg-surface focus-visible:outline-solid focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-border-focus",
1368
- children: /* @__PURE__ */ jsx10(X2, { size: 13, "aria-hidden": "true" })
1629
+ children: /* @__PURE__ */ jsx11(X2, { size: 13, "aria-hidden": "true" })
1369
1630
  }
1370
1631
  )
1371
1632
  ]
@@ -1373,7 +1634,7 @@ var SearchBar = forwardRef2(function SearchBar2({
1373
1634
  code
1374
1635
  );
1375
1636
  }) }),
1376
- /* @__PURE__ */ jsx10("div", { className: "mt-3 flex justify-end", children: /* @__PURE__ */ jsx10(
1637
+ /* @__PURE__ */ jsx11("div", { className: "mt-3 flex justify-end", children: /* @__PURE__ */ jsx11(
1377
1638
  "button",
1378
1639
  {
1379
1640
  type: "button",
@@ -1386,11 +1647,11 @@ var SearchBar = forwardRef2(function SearchBar2({
1386
1647
  children: "Search"
1387
1648
  }
1388
1649
  ) }),
1389
- onDownloadAdCodes && /* @__PURE__ */ jsxs9("div", { className: "mt-3 flex items-start gap-2 rounded-control border border-border-default px-3 py-2.5 text-card-title text-text-secondary", children: [
1390
- /* @__PURE__ */ jsx10(AlertCircle, { size: 16, "aria-hidden": "true", className: "mt-0.5 shrink-0 text-text-tertiary" }),
1391
- /* @__PURE__ */ jsxs9("span", { children: [
1650
+ onDownloadAdCodes && /* @__PURE__ */ jsxs10("div", { className: "mt-3 flex items-start gap-2 rounded-control border border-border-default px-3 py-2.5 text-card-title text-text-secondary", children: [
1651
+ /* @__PURE__ */ jsx11(AlertCircle, { size: 16, "aria-hidden": "true", className: "mt-0.5 shrink-0 text-text-tertiary" }),
1652
+ /* @__PURE__ */ jsxs10("span", { children: [
1392
1653
  hasMisses && "Some ad codes in your search could not be matched. ",
1393
- /* @__PURE__ */ jsx10(
1654
+ /* @__PURE__ */ jsx11(
1394
1655
  "button",
1395
1656
  {
1396
1657
  type: "button",
@@ -1410,7 +1671,7 @@ var SearchBar = forwardRef2(function SearchBar2({
1410
1671
  ]
1411
1672
  }
1412
1673
  ),
1413
- value && onChange && /* @__PURE__ */ jsx10(
1674
+ value && onChange && /* @__PURE__ */ jsx11(
1414
1675
  "button",
1415
1676
  {
1416
1677
  type: "button",
@@ -1421,7 +1682,7 @@ var SearchBar = forwardRef2(function SearchBar2({
1421
1682
  "aria-label": "Clear search",
1422
1683
  "data-testid": testIdPrefix && `${testIdPrefix}-clear`,
1423
1684
  className: "mr-1.5 flex size-6 shrink-0 items-center justify-center self-center rounded-control text-text-tertiary hover:bg-subtle hover:text-text-primary focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-border-focus",
1424
- children: /* @__PURE__ */ jsx10(X2, { size: 14, "aria-hidden": "true" })
1685
+ children: /* @__PURE__ */ jsx11(X2, { size: 14, "aria-hidden": "true" })
1425
1686
  }
1426
1687
  ),
1427
1688
  showMatch && // border-border-default, not the bare `border-border` both source
@@ -1435,8 +1696,8 @@ var SearchBar = forwardRef2(function SearchBar2({
1435
1696
  // token package (insights-studio-prototype's own src/index.css;
1436
1697
  // mr-clientapps' own tailwind.config.ts `colors.border.DEFAULT`) --
1437
1698
  // an alias this shared component can't rely on existing.
1438
- /* @__PURE__ */ jsxs9("div", { className: "relative shrink-0 border-l border-border-default", ref, children: [
1439
- /* @__PURE__ */ jsxs9(
1699
+ /* @__PURE__ */ jsxs10("div", { className: "relative shrink-0 border-l border-border-default", ref, children: [
1700
+ /* @__PURE__ */ jsxs10(
1440
1701
  "button",
1441
1702
  {
1442
1703
  type: "button",
@@ -1447,7 +1708,7 @@ var SearchBar = forwardRef2(function SearchBar2({
1447
1708
  className: "flex h-full items-center gap-1 px-2.5 text-dense font-medium text-text-primary transition-colors hover:bg-subtle",
1448
1709
  children: [
1449
1710
  matchValue.mode === "anyWord" ? `${MODE_LABEL.anyWord} (${matchValue.wordJoin})` : MODE_LABEL[matchValue.mode],
1450
- /* @__PURE__ */ jsx10(
1711
+ /* @__PURE__ */ jsx11(
1451
1712
  ChevronDown3,
1452
1713
  {
1453
1714
  size: 14,
@@ -1458,25 +1719,25 @@ var SearchBar = forwardRef2(function SearchBar2({
1458
1719
  ]
1459
1720
  }
1460
1721
  ),
1461
- open && /* @__PURE__ */ jsx10(
1722
+ open && /* @__PURE__ */ jsx11(
1462
1723
  "div",
1463
1724
  {
1464
1725
  role: "dialog",
1465
1726
  "aria-label": "Search match type",
1466
1727
  "data-testid": testIdPrefix && `${testIdPrefix}-mode-popover`,
1467
1728
  className: "absolute right-0 top-full mt-2 z-50 w-100 rounded-card border border-border-default bg-surface p-3 shadow-overlay",
1468
- children: /* @__PURE__ */ jsxs9("div", { role: "radiogroup", "aria-label": "Search match type", className: "flex flex-col", children: [
1469
- /* @__PURE__ */ jsx10(
1729
+ children: /* @__PURE__ */ jsxs10("div", { role: "radiogroup", "aria-label": "Search match type", className: "flex flex-col", children: [
1730
+ /* @__PURE__ */ jsx11(
1470
1731
  ModeRow,
1471
1732
  {
1472
1733
  title: "Any Word Text Search",
1473
1734
  selected: matchValue.mode === "anyWord",
1474
1735
  onSelect: () => onMatchChange?.({ mode: "anyWord", wordJoin: matchValue.wordJoin }),
1475
1736
  testId: testIdPrefix && `${testIdPrefix}-mode-anyWord`,
1476
- description: /* @__PURE__ */ jsx10(Fragment2, { children: "Find creatives that contain your keyword(s) using an \u201COr\u201D (match any) or \u201CAnd\u201D (match all) conditional in any order." }),
1737
+ description: /* @__PURE__ */ jsx11(Fragment2, { children: "Find creatives that contain your keyword(s) using an \u201COr\u201D (match any) or \u201CAnd\u201D (match all) conditional in any order." }),
1477
1738
  infoText: "The Or/And choice applies only when Any Word is the active search mode.",
1478
- extra: /* @__PURE__ */ jsxs9("span", { className: "flex items-center gap-3", children: [
1479
- /* @__PURE__ */ jsx10(
1739
+ extra: /* @__PURE__ */ jsxs10("span", { className: "flex items-center gap-3", children: [
1740
+ /* @__PURE__ */ jsx11(
1480
1741
  RadioOption,
1481
1742
  {
1482
1743
  label: "Or",
@@ -1485,7 +1746,7 @@ var SearchBar = forwardRef2(function SearchBar2({
1485
1746
  testId: testIdPrefix && `${testIdPrefix}-word-join-or`
1486
1747
  }
1487
1748
  ),
1488
- /* @__PURE__ */ jsx10(
1749
+ /* @__PURE__ */ jsx11(
1489
1750
  RadioOption,
1490
1751
  {
1491
1752
  label: "And",
@@ -1497,8 +1758,8 @@ var SearchBar = forwardRef2(function SearchBar2({
1497
1758
  ] })
1498
1759
  }
1499
1760
  ),
1500
- /* @__PURE__ */ jsx10(Divider, {}),
1501
- /* @__PURE__ */ jsx10(
1761
+ /* @__PURE__ */ jsx11(Divider, {}),
1762
+ /* @__PURE__ */ jsx11(
1502
1763
  ModeRow,
1503
1764
  {
1504
1765
  title: "Exact Match Text Search",
@@ -1509,8 +1770,8 @@ var SearchBar = forwardRef2(function SearchBar2({
1509
1770
  infoText: "Keywords are matched as a single contiguous phrase, in the order you typed them."
1510
1771
  }
1511
1772
  ),
1512
- /* @__PURE__ */ jsx10(Divider, {}),
1513
- /* @__PURE__ */ jsx10(
1773
+ /* @__PURE__ */ jsx11(Divider, {}),
1774
+ /* @__PURE__ */ jsx11(
1514
1775
  ModeRow,
1515
1776
  {
1516
1777
  title: "Contextual Search",
@@ -1522,8 +1783,8 @@ var SearchBar = forwardRef2(function SearchBar2({
1522
1783
  infoText: "Uses semantic matching, so results can include related terms even when the exact keyword isn't present."
1523
1784
  }
1524
1785
  ),
1525
- /* @__PURE__ */ jsx10(Divider, {}),
1526
- /* @__PURE__ */ jsx10(
1786
+ /* @__PURE__ */ jsx11(Divider, {}),
1787
+ /* @__PURE__ */ jsx11(
1527
1788
  ModeRow,
1528
1789
  {
1529
1790
  title: "Ad Code Search",
@@ -1544,7 +1805,7 @@ var SearchBar = forwardRef2(function SearchBar2({
1544
1805
  });
1545
1806
  SearchBar.displayName = "SearchBar";
1546
1807
  function Divider() {
1547
- return /* @__PURE__ */ jsx10("div", { className: "my-2.5 border-t border-border-default", "aria-hidden": "true" });
1808
+ return /* @__PURE__ */ jsx11("div", { className: "my-2.5 border-t border-border-default", "aria-hidden": "true" });
1548
1809
  }
1549
1810
  function ModeRow({
1550
1811
  title,
@@ -1556,17 +1817,17 @@ function ModeRow({
1556
1817
  onSelect,
1557
1818
  testId
1558
1819
  }) {
1559
- const descId = useId3();
1560
- return /* @__PURE__ */ jsxs9(
1820
+ const descId = useId4();
1821
+ return /* @__PURE__ */ jsxs10(
1561
1822
  "div",
1562
1823
  {
1563
1824
  onClick: onSelect,
1564
1825
  className: "flex cursor-pointer flex-col items-stretch gap-1 rounded-control p-1.5 text-left transition-colors hover:bg-subtle",
1565
1826
  children: [
1566
- /* @__PURE__ */ jsxs9("div", { className: "flex items-center justify-between gap-2", children: [
1567
- /* @__PURE__ */ jsxs9("div", { className: "flex flex-wrap items-center gap-3", children: [
1568
- /* @__PURE__ */ jsxs9("span", { className: "flex items-center gap-1", children: [
1569
- /* @__PURE__ */ jsx10(
1827
+ /* @__PURE__ */ jsxs10("div", { className: "flex items-center justify-between gap-2", children: [
1828
+ /* @__PURE__ */ jsxs10("div", { className: "flex flex-wrap items-center gap-3", children: [
1829
+ /* @__PURE__ */ jsxs10("span", { className: "flex items-center gap-1", children: [
1830
+ /* @__PURE__ */ jsx11(
1570
1831
  "button",
1571
1832
  {
1572
1833
  type: "button",
@@ -1582,14 +1843,14 @@ function ModeRow({
1582
1843
  children: title
1583
1844
  }
1584
1845
  ),
1585
- /* @__PURE__ */ jsx10(RowInfoTip, { text: infoText })
1846
+ /* @__PURE__ */ jsx11(RowInfoTip, { text: infoText })
1586
1847
  ] }),
1587
- badge && /* @__PURE__ */ jsx10(Badge, { kind: "category", children: badge }),
1848
+ badge && /* @__PURE__ */ jsx11(Badge, { kind: "category", children: badge }),
1588
1849
  extra
1589
1850
  ] }),
1590
- selected && /* @__PURE__ */ jsx10(Check4, { size: 16, strokeWidth: 2.5, "aria-hidden": "true", className: "shrink-0 text-brand-primaryAction" })
1851
+ selected && /* @__PURE__ */ jsx11(Check4, { size: 16, strokeWidth: 2.5, "aria-hidden": "true", className: "shrink-0 text-brand-primaryAction" })
1591
1852
  ] }),
1592
- /* @__PURE__ */ jsx10("span", { id: descId, className: "block text-xs leading-snug text-text-secondary", children: description })
1853
+ /* @__PURE__ */ jsx11("span", { id: descId, className: "block text-xs leading-snug text-text-secondary", children: description })
1593
1854
  ]
1594
1855
  }
1595
1856
  );
@@ -1600,7 +1861,7 @@ function RadioOption({
1600
1861
  onSelect,
1601
1862
  testId
1602
1863
  }) {
1603
- return /* @__PURE__ */ jsxs9(
1864
+ return /* @__PURE__ */ jsxs10(
1604
1865
  "button",
1605
1866
  {
1606
1867
  type: "button",
@@ -1613,14 +1874,14 @@ function RadioOption({
1613
1874
  "aria-checked": checked,
1614
1875
  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",
1615
1876
  children: [
1616
- /* @__PURE__ */ jsx10(
1877
+ /* @__PURE__ */ jsx11(
1617
1878
  "span",
1618
1879
  {
1619
1880
  className: cn(
1620
1881
  "flex h-4 w-4 shrink-0 items-center justify-center rounded-full border-2 transition-colors",
1621
1882
  checked ? "border-brand-primaryAction" : "border-border-interactive"
1622
1883
  ),
1623
- children: checked && /* @__PURE__ */ jsx10("span", { className: "h-2 w-2 rounded-full bg-brand-primaryAction" })
1884
+ children: checked && /* @__PURE__ */ jsx11("span", { className: "h-2 w-2 rounded-full bg-brand-primaryAction" })
1624
1885
  }
1625
1886
  ),
1626
1887
  label
@@ -1629,10 +1890,10 @@ function RadioOption({
1629
1890
  );
1630
1891
  }
1631
1892
  function RowInfoTip({ text }) {
1632
- const [open, setOpen] = useState4(false);
1633
- const id = useId3();
1634
- const ref = useRef4(null);
1635
- useEffect4(() => {
1893
+ const [open, setOpen] = useState5(false);
1894
+ const id = useId4();
1895
+ const ref = useRef5(null);
1896
+ useEffect5(() => {
1636
1897
  if (!open) return;
1637
1898
  const onDown = (e) => {
1638
1899
  if (ref.current && !ref.current.contains(e.target)) setOpen(false);
@@ -1640,8 +1901,8 @@ function RowInfoTip({ text }) {
1640
1901
  window.addEventListener("mousedown", onDown);
1641
1902
  return () => window.removeEventListener("mousedown", onDown);
1642
1903
  }, [open]);
1643
- return /* @__PURE__ */ jsxs9("span", { className: "relative inline-flex shrink-0 items-center", ref, children: [
1644
- /* @__PURE__ */ jsx10(
1904
+ return /* @__PURE__ */ jsxs10("span", { className: "relative inline-flex shrink-0 items-center", ref, children: [
1905
+ /* @__PURE__ */ jsx11(
1645
1906
  "button",
1646
1907
  {
1647
1908
  type: "button",
@@ -1653,10 +1914,10 @@ function RowInfoTip({ text }) {
1653
1914
  "aria-expanded": open,
1654
1915
  "aria-describedby": id,
1655
1916
  className: "-m-1.5 inline-flex size-6 items-center justify-center rounded-control text-text-tertiary transition-colors hover:text-text-primary focus-visible:outline-solid focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-border-focus",
1656
- children: /* @__PURE__ */ jsx10(AlertCircle, { size: 13, "aria-hidden": "true" })
1917
+ children: /* @__PURE__ */ jsx11(AlertCircle, { size: 13, "aria-hidden": "true" })
1657
1918
  }
1658
1919
  ),
1659
- /* @__PURE__ */ jsx10(
1920
+ /* @__PURE__ */ jsx11(
1660
1921
  "span",
1661
1922
  {
1662
1923
  id,
@@ -1672,11 +1933,11 @@ function ScopeMenu({
1672
1933
  onOpenChange,
1673
1934
  testIdPrefix
1674
1935
  }) {
1675
- const [open, setOpenState] = useState4(false);
1676
- const ref = useRef4(null);
1677
- const trigger = useRef4(null);
1678
- const list = useRef4(null);
1679
- const listId = useId3();
1936
+ const [open, setOpenState] = useState5(false);
1937
+ const ref = useRef5(null);
1938
+ const trigger = useRef5(null);
1939
+ const list = useRef5(null);
1940
+ const listId = useId4();
1680
1941
  const setOpen = (next) => {
1681
1942
  setOpenState(next);
1682
1943
  onOpenChange?.(next);
@@ -1685,7 +1946,7 @@ function ScopeMenu({
1685
1946
  setOpen(false);
1686
1947
  if (refocus) trigger.current?.focus();
1687
1948
  };
1688
- useEffect4(() => {
1949
+ useEffect5(() => {
1689
1950
  if (!open) return;
1690
1951
  list.current?.querySelector('[aria-selected="true"]')?.focus();
1691
1952
  const onClick = (e) => {
@@ -1711,8 +1972,8 @@ function ScopeMenu({
1711
1972
  close(false);
1712
1973
  }
1713
1974
  };
1714
- return /* @__PURE__ */ jsxs9("div", { className: "relative flex shrink-0 border-r border-border-default", ref, children: [
1715
- /* @__PURE__ */ jsxs9(
1975
+ return /* @__PURE__ */ jsxs10("div", { className: "relative flex shrink-0 border-r border-border-default", ref, children: [
1976
+ /* @__PURE__ */ jsxs10(
1716
1977
  "button",
1717
1978
  {
1718
1979
  ref: trigger,
@@ -1726,7 +1987,7 @@ function ScopeMenu({
1726
1987
  className: "flex h-full items-center gap-1.5 rounded-l-control px-2.5 text-dense font-semibold text-text-primary transition-colors hover:bg-subtle focus-visible:outline-solid focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-border-focus",
1727
1988
  children: [
1728
1989
  scope.value,
1729
- /* @__PURE__ */ jsx10(
1990
+ /* @__PURE__ */ jsx11(
1730
1991
  ChevronDown3,
1731
1992
  {
1732
1993
  size: 13,
@@ -1737,7 +1998,7 @@ function ScopeMenu({
1737
1998
  ]
1738
1999
  }
1739
2000
  ),
1740
- open && /* @__PURE__ */ jsxs9(
2001
+ open && /* @__PURE__ */ jsxs10(
1741
2002
  "div",
1742
2003
  {
1743
2004
  ref: list,
@@ -1748,13 +2009,13 @@ function ScopeMenu({
1748
2009
  "data-testid": testIdPrefix && `${testIdPrefix}-scope-popover`,
1749
2010
  className: "absolute left-0 top-[calc(100%+6px)] z-50 min-w-50 max-w-72 rounded-card border border-border-default bg-surface py-1 shadow-overlay",
1750
2011
  children: [
1751
- /* @__PURE__ */ jsxs9("div", { className: "px-3 pb-1.5 pt-1", "aria-hidden": "true", children: [
1752
- /* @__PURE__ */ jsx10("p", { className: "text-micro font-semibold uppercase tracking-wide text-text-tertiary", children: scope.label }),
1753
- scope.info && /* @__PURE__ */ jsx10("p", { className: "mt-0.5 text-xs text-text-secondary", children: scope.info })
2012
+ /* @__PURE__ */ jsxs10("div", { className: "px-3 pb-1.5 pt-1", "aria-hidden": "true", children: [
2013
+ /* @__PURE__ */ jsx11("p", { className: "text-micro font-semibold uppercase tracking-wide text-text-tertiary", children: scope.label }),
2014
+ scope.info && /* @__PURE__ */ jsx11("p", { className: "mt-0.5 text-xs text-text-secondary", children: scope.info })
1754
2015
  ] }),
1755
2016
  scope.options.map((o) => {
1756
2017
  const sel = o === scope.value;
1757
- return /* @__PURE__ */ jsxs9(
2018
+ return /* @__PURE__ */ jsxs10(
1758
2019
  "button",
1759
2020
  {
1760
2021
  type: "button",
@@ -1771,7 +2032,7 @@ function ScopeMenu({
1771
2032
  sel ? "font-semibold text-text-primary" : "text-text-secondary"
1772
2033
  ),
1773
2034
  children: [
1774
- /* @__PURE__ */ jsx10(Check4, { size: 14, "aria-hidden": "true", className: cn("shrink-0 text-brand-primaryAction", !sel && "invisible") }),
2035
+ /* @__PURE__ */ jsx11(Check4, { size: 14, "aria-hidden": "true", className: cn("shrink-0 text-brand-primaryAction", !sel && "invisible") }),
1775
2036
  o
1776
2037
  ]
1777
2038
  },
@@ -1785,9 +2046,9 @@ function ScopeMenu({
1785
2046
  }
1786
2047
 
1787
2048
  // src/SectionRail.tsx
1788
- import { useRef as useRef5 } from "react";
2049
+ import { useRef as useRef6 } from "react";
1789
2050
  import { ChevronLeft as ChevronLeft2, ChevronRight as ChevronRight2 } from "lucide-react";
1790
- import { jsx as jsx11, jsxs as jsxs10 } from "react/jsx-runtime";
2051
+ import { jsx as jsx12, jsxs as jsxs11 } from "react/jsx-runtime";
1791
2052
  function SectionRail({
1792
2053
  title,
1793
2054
  titleSerif,
@@ -1798,24 +2059,24 @@ function SectionRail({
1798
2059
  className,
1799
2060
  testIdPrefix
1800
2061
  }) {
1801
- const scrollRef = useRef5(null);
2062
+ const scrollRef = useRef6(null);
1802
2063
  const scroll = (direction) => {
1803
2064
  scrollRef.current?.scrollBy({ left: direction * 320, behavior: "smooth" });
1804
2065
  };
1805
- return /* @__PURE__ */ jsxs10("section", { className: cn("flex flex-col gap-4", className), "data-testid": testIdPrefix, children: [
1806
- /* @__PURE__ */ jsxs10("header", { className: "flex flex-col gap-3 sm:flex-row sm:items-end sm:justify-between", children: [
1807
- /* @__PURE__ */ jsxs10("div", { children: [
1808
- /* @__PURE__ */ jsx11(
2066
+ return /* @__PURE__ */ jsxs11("section", { className: cn("flex flex-col gap-4", className), "data-testid": testIdPrefix, children: [
2067
+ /* @__PURE__ */ jsxs11("header", { className: "flex flex-col gap-3 sm:flex-row sm:items-end sm:justify-between", children: [
2068
+ /* @__PURE__ */ jsxs11("div", { children: [
2069
+ /* @__PURE__ */ jsx12(
1809
2070
  "h2",
1810
2071
  {
1811
2072
  className: titleSerif ? "font-serif text-xl font-normal tracking-tight text-text-primary" : "text-xl font-medium tracking-tight text-text-primary",
1812
2073
  children: title
1813
2074
  }
1814
2075
  ),
1815
- /* @__PURE__ */ jsx11("p", { className: "mt-1 text-sm text-text-secondary", children: subtitle })
2076
+ /* @__PURE__ */ jsx12("p", { className: "mt-1 text-sm text-text-secondary", children: subtitle })
1816
2077
  ] }),
1817
- /* @__PURE__ */ jsxs10("div", { className: "flex items-center gap-2", children: [
1818
- viewAllLabel && viewAllHref && /* @__PURE__ */ jsxs10(
2078
+ /* @__PURE__ */ jsxs11("div", { className: "flex items-center gap-2", children: [
2079
+ viewAllLabel && viewAllHref && /* @__PURE__ */ jsxs11(
1819
2080
  "a",
1820
2081
  {
1821
2082
  href: viewAllHref,
@@ -1826,29 +2087,29 @@ function SectionRail({
1826
2087
  ]
1827
2088
  }
1828
2089
  ),
1829
- /* @__PURE__ */ jsx11(
2090
+ /* @__PURE__ */ jsx12(
1830
2091
  "button",
1831
2092
  {
1832
2093
  type: "button",
1833
2094
  onClick: () => scroll(-1),
1834
2095
  "aria-label": "Previous",
1835
2096
  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-1 focus-visible:outline-border-focus sm:flex lg:hidden",
1836
- children: /* @__PURE__ */ jsx11(ChevronLeft2, { size: 16 })
2097
+ children: /* @__PURE__ */ jsx12(ChevronLeft2, { size: 16 })
1837
2098
  }
1838
2099
  ),
1839
- /* @__PURE__ */ jsx11(
2100
+ /* @__PURE__ */ jsx12(
1840
2101
  "button",
1841
2102
  {
1842
2103
  type: "button",
1843
2104
  onClick: () => scroll(1),
1844
2105
  "aria-label": "Next",
1845
2106
  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-1 focus-visible:outline-border-focus sm:flex lg:hidden",
1846
- children: /* @__PURE__ */ jsx11(ChevronRight2, { size: 16 })
2107
+ children: /* @__PURE__ */ jsx12(ChevronRight2, { size: 16 })
1847
2108
  }
1848
2109
  )
1849
2110
  ] })
1850
2111
  ] }),
1851
- /* @__PURE__ */ jsx11(
2112
+ /* @__PURE__ */ jsx12(
1852
2113
  "div",
1853
2114
  {
1854
2115
  ref: scrollRef,
@@ -1860,15 +2121,15 @@ function SectionRail({
1860
2121
  }
1861
2122
 
1862
2123
  // src/DataScopeFilter.tsx
1863
- import { useEffect as useEffect5, useRef as useRef6, useState as useState5 } from "react";
2124
+ import { useEffect as useEffect6, useRef as useRef7, useState as useState6 } from "react";
1864
2125
  import { Check as Check5, ChevronDown as ChevronDown4 } from "lucide-react";
1865
- import { jsx as jsx12, jsxs as jsxs11 } from "react/jsx-runtime";
2126
+ import { jsx as jsx13, jsxs as jsxs12 } from "react/jsx-runtime";
1866
2127
  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.";
1867
2128
  function DataScopeFilter({ value, onChange, align = "right", className, testIdPrefix }) {
1868
- const [open, setOpen] = useState5(false);
1869
- const ref = useRef6(null);
2129
+ const [open, setOpen] = useState6(false);
2130
+ const ref = useRef7(null);
1870
2131
  const display = value ? "Final only" : "All";
1871
- useEffect5(() => {
2132
+ useEffect6(() => {
1872
2133
  if (!open) return;
1873
2134
  const onDown = (e) => {
1874
2135
  if (ref.current && !ref.current.contains(e.target)) setOpen(false);
@@ -1885,8 +2146,8 @@ function DataScopeFilter({ value, onChange, align = "right", className, testIdPr
1885
2146
  onChange(v);
1886
2147
  setOpen(false);
1887
2148
  };
1888
- return /* @__PURE__ */ jsxs11("div", { className: cn("relative", className), ref, "data-testid": testIdPrefix, children: [
1889
- /* @__PURE__ */ jsxs11(
2149
+ return /* @__PURE__ */ jsxs12("div", { className: cn("relative", className), ref, "data-testid": testIdPrefix, children: [
2150
+ /* @__PURE__ */ jsxs12(
1890
2151
  "button",
1891
2152
  {
1892
2153
  type: "button",
@@ -1895,8 +2156,8 @@ function DataScopeFilter({ value, onChange, align = "right", className, testIdPr
1895
2156
  "data-testid": testIdPrefix && `${testIdPrefix}-trigger`,
1896
2157
  className: chipTriggerClass(),
1897
2158
  children: [
1898
- /* @__PURE__ */ jsx12(ChipContent, { caption: "Data", value: display }),
1899
- /* @__PURE__ */ jsx12(
2159
+ /* @__PURE__ */ jsx13(ChipContent, { caption: "Data", value: display }),
2160
+ /* @__PURE__ */ jsx13(
1900
2161
  ChevronDown4,
1901
2162
  {
1902
2163
  size: 14,
@@ -1907,7 +2168,7 @@ function DataScopeFilter({ value, onChange, align = "right", className, testIdPr
1907
2168
  ]
1908
2169
  }
1909
2170
  ),
1910
- open && /* @__PURE__ */ jsxs11(
2171
+ open && /* @__PURE__ */ jsxs12(
1911
2172
  "div",
1912
2173
  {
1913
2174
  role: "group",
@@ -1918,8 +2179,8 @@ function DataScopeFilter({ value, onChange, align = "right", className, testIdPr
1918
2179
  align === "right" ? "right-0" : "left-0"
1919
2180
  ),
1920
2181
  children: [
1921
- /* @__PURE__ */ jsx12(Option, { label: "All", selected: !value, onClick: () => choose(false) }),
1922
- /* @__PURE__ */ jsx12(Option, { label: "Final only", selected: value, onClick: () => choose(true), hint: FINAL_ONLY_TEXT })
2182
+ /* @__PURE__ */ jsx13(Option, { label: "All", selected: !value, onClick: () => choose(false) }),
2183
+ /* @__PURE__ */ jsx13(Option, { label: "Final only", selected: value, onClick: () => choose(true), hint: FINAL_ONLY_TEXT })
1923
2184
  ]
1924
2185
  }
1925
2186
  )
@@ -1931,7 +2192,7 @@ function Option({
1931
2192
  onClick,
1932
2193
  hint
1933
2194
  }) {
1934
- const option = /* @__PURE__ */ jsxs11(
2195
+ const option = /* @__PURE__ */ jsxs12(
1935
2196
  "button",
1936
2197
  {
1937
2198
  type: "button",
@@ -1943,33 +2204,33 @@ function Option({
1943
2204
  selected ? "font-semibold text-text-primary" : "text-text-secondary"
1944
2205
  ),
1945
2206
  children: [
1946
- /* @__PURE__ */ jsx12(Check5, { size: 14, "aria-hidden": "true", className: cn("shrink-0 text-brand-primaryAction", !selected && "invisible") }),
2207
+ /* @__PURE__ */ jsx13(Check5, { size: 14, "aria-hidden": "true", className: cn("shrink-0 text-brand-primaryAction", !selected && "invisible") }),
1947
2208
  label
1948
2209
  ]
1949
2210
  }
1950
2211
  );
1951
2212
  if (!hint) return option;
1952
- return /* @__PURE__ */ jsxs11("div", { className: "flex items-center gap-2 pr-2.5", children: [
2213
+ return /* @__PURE__ */ jsxs12("div", { className: "flex items-center gap-2 pr-2.5", children: [
1953
2214
  option,
1954
- /* @__PURE__ */ jsx12(InfoTip, { text: hint, trigger: "hover", label: `About ${label}` })
2215
+ /* @__PURE__ */ jsx13(InfoTip, { text: hint, trigger: "hover", label: `About ${label}` })
1955
2216
  ] });
1956
2217
  }
1957
2218
 
1958
2219
  // src/SelectFilter.tsx
1959
- import { useCallback as useCallback2, useEffect as useEffect6, useLayoutEffect as useLayoutEffect3, useRef as useRef7, useState as useState6 } from "react";
1960
- import { createPortal as createPortal2 } from "react-dom";
2220
+ import { useCallback as useCallback2, useEffect as useEffect7, useLayoutEffect as useLayoutEffect4, useRef as useRef8, useState as useState7 } from "react";
2221
+ import { createPortal as createPortal3 } from "react-dom";
1961
2222
  import { Check as Check6, ChevronDown as ChevronDown5 } from "lucide-react";
1962
2223
 
1963
2224
  // src/MenuStatus.tsx
1964
- import { jsx as jsx13, jsxs as jsxs12 } from "react/jsx-runtime";
2225
+ import { jsx as jsx14, jsxs as jsxs13 } from "react/jsx-runtime";
1965
2226
  var ROW_WIDTHS = ["w-3/4", "w-1/2", "w-4/5", "w-3/5"];
1966
2227
  function MenuLoading() {
1967
- return /* @__PURE__ */ jsx13("div", { role: "status", "aria-label": "Loading options", className: "p-1", children: ROW_WIDTHS.map((w) => /* @__PURE__ */ jsx13("div", { className: "flex h-9 items-center px-2", children: /* @__PURE__ */ jsx13("span", { className: `inline-block h-3 ${w} animate-pulse rounded-full bg-subtle`, "aria-hidden": "true" }) }, w)) });
2228
+ return /* @__PURE__ */ jsx14("div", { role: "status", "aria-label": "Loading options", className: "p-1", children: ROW_WIDTHS.map((w) => /* @__PURE__ */ jsx14("div", { className: "flex h-9 items-center px-2", children: /* @__PURE__ */ jsx14("span", { className: `inline-block h-3 ${w} animate-pulse rounded-full bg-subtle`, "aria-hidden": "true" }) }, w)) });
1968
2229
  }
1969
2230
  function MenuError({ onRetry }) {
1970
- return /* @__PURE__ */ jsxs12("div", { role: "alert", className: "px-3 py-5 text-center text-dense text-text-secondary", children: [
2231
+ return /* @__PURE__ */ jsxs13("div", { role: "alert", className: "px-3 py-5 text-center text-dense text-text-secondary", children: [
1971
2232
  "Couldn't load options.",
1972
- onRetry && /* @__PURE__ */ jsx13(
2233
+ onRetry && /* @__PURE__ */ jsx14(
1973
2234
  "button",
1974
2235
  {
1975
2236
  type: "button",
@@ -1982,12 +2243,12 @@ function MenuError({ onRetry }) {
1982
2243
  }
1983
2244
 
1984
2245
  // src/SelectFilter.tsx
1985
- import { jsx as jsx14, jsxs as jsxs13 } from "react/jsx-runtime";
2246
+ import { jsx as jsx15, jsxs as jsxs14 } from "react/jsx-runtime";
1986
2247
  function slug4(value) {
1987
2248
  return value.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/(^-|-$)/g, "");
1988
2249
  }
1989
2250
  function OptionIcon({ children }) {
1990
- return /* @__PURE__ */ jsx14(
2251
+ return /* @__PURE__ */ jsx15(
1991
2252
  "span",
1992
2253
  {
1993
2254
  "aria-hidden": "true",
@@ -2016,10 +2277,10 @@ function SelectFilter({
2016
2277
  }) {
2017
2278
  const sm = size === "sm";
2018
2279
  const bare = !sm && hideCaption;
2019
- const [open, setOpen] = useState6(false);
2020
- const [pos, setPos] = useState6(null);
2021
- const ref = useRef7(null);
2022
- const popoverRef = useRef7(null);
2280
+ const [open, setOpen] = useState7(false);
2281
+ const [pos, setPos] = useState7(null);
2282
+ const ref = useRef8(null);
2283
+ const popoverRef = useRef8(null);
2023
2284
  const close = useCallback2(() => setOpen(false), []);
2024
2285
  const reposition = useCallback2(() => {
2025
2286
  if (!ref.current) return;
@@ -2032,11 +2293,11 @@ function SelectFilter({
2032
2293
  width: r.width
2033
2294
  });
2034
2295
  }, [align, options.length]);
2035
- useLayoutEffect3(() => {
2296
+ useLayoutEffect4(() => {
2036
2297
  if (!open) return;
2037
2298
  reposition();
2038
2299
  }, [open, reposition]);
2039
- useEffect6(() => {
2300
+ useEffect7(() => {
2040
2301
  if (!open) return;
2041
2302
  const onKey = (e) => e.key === "Escape" && close();
2042
2303
  const onClick = (e) => {
@@ -2055,20 +2316,20 @@ function SelectFilter({
2055
2316
  window.removeEventListener("scroll", reposition, true);
2056
2317
  };
2057
2318
  }, [open, close, reposition]);
2058
- const valueContent = renderIcon ? /* @__PURE__ */ jsxs13("span", { className: "flex items-center gap-1.5", children: [
2059
- /* @__PURE__ */ jsx14(OptionIcon, { children: renderIcon(value) }),
2319
+ const valueContent = renderIcon ? /* @__PURE__ */ jsxs14("span", { className: "flex items-center gap-1.5", children: [
2320
+ /* @__PURE__ */ jsx15(OptionIcon, { children: renderIcon(value) }),
2060
2321
  value
2061
2322
  ] }) : value;
2062
- const triggerValue = sm && inlineCaption ? /* @__PURE__ */ jsxs13("span", { children: [
2063
- /* @__PURE__ */ jsxs13("span", { className: "font-normal text-text-secondary", children: [
2323
+ const triggerValue = sm && inlineCaption ? /* @__PURE__ */ jsxs14("span", { children: [
2324
+ /* @__PURE__ */ jsxs14("span", { className: "font-normal text-text-secondary", children: [
2064
2325
  caption,
2065
2326
  ":"
2066
2327
  ] }),
2067
2328
  " ",
2068
2329
  valueContent
2069
2330
  ] }) : valueContent;
2070
- return /* @__PURE__ */ jsxs13("div", { className: cn("relative", fullWidth && "w-full"), ref, "data-testid": testIdPrefix, children: [
2071
- /* @__PURE__ */ jsxs13(
2331
+ return /* @__PURE__ */ jsxs14("div", { className: cn("relative", fullWidth && "w-full"), ref, "data-testid": testIdPrefix, children: [
2332
+ /* @__PURE__ */ jsxs14(
2072
2333
  "button",
2073
2334
  {
2074
2335
  type: "button",
@@ -2085,8 +2346,8 @@ function SelectFilter({
2085
2346
  className
2086
2347
  ),
2087
2348
  children: [
2088
- sm || bare ? triggerValue : /* @__PURE__ */ jsx14(ChipContent, { caption, value: triggerValue }),
2089
- /* @__PURE__ */ jsx14(
2349
+ sm || bare ? triggerValue : /* @__PURE__ */ jsx15(ChipContent, { caption, value: triggerValue }),
2350
+ /* @__PURE__ */ jsx15(
2090
2351
  ChevronDown5,
2091
2352
  {
2092
2353
  size: 14,
@@ -2097,8 +2358,8 @@ function SelectFilter({
2097
2358
  ]
2098
2359
  }
2099
2360
  ),
2100
- open && pos && createPortal2(
2101
- /* @__PURE__ */ jsx14(
2361
+ open && pos && createPortal3(
2362
+ /* @__PURE__ */ jsx15(
2102
2363
  "div",
2103
2364
  {
2104
2365
  ref: popoverRef,
@@ -2110,9 +2371,9 @@ function SelectFilter({
2110
2371
  ),
2111
2372
  role: loading || error ? "group" : "listbox",
2112
2373
  "aria-label": caption,
2113
- children: loading ? /* @__PURE__ */ jsx14(MenuLoading, {}) : error ? /* @__PURE__ */ jsx14(MenuError, { onRetry }) : /* @__PURE__ */ jsx14("div", { className: "max-h-70 overflow-y-auto p-1", children: options.map((o) => {
2374
+ children: loading ? /* @__PURE__ */ jsx15(MenuLoading, {}) : error ? /* @__PURE__ */ jsx15(MenuError, { onRetry }) : /* @__PURE__ */ jsx15("div", { className: "max-h-70 overflow-y-auto p-1", children: options.map((o) => {
2114
2375
  const selected = o === value;
2115
- return /* @__PURE__ */ jsxs13(
2376
+ return /* @__PURE__ */ jsxs14(
2116
2377
  "button",
2117
2378
  {
2118
2379
  type: "button",
@@ -2125,9 +2386,9 @@ function SelectFilter({
2125
2386
  },
2126
2387
  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",
2127
2388
  children: [
2128
- /* @__PURE__ */ jsx14("span", { className: "flex h-4 w-4 shrink-0 items-center justify-center text-brand-primaryAction", children: selected && /* @__PURE__ */ jsx14(Check6, { size: 15, strokeWidth: 3 }) }),
2129
- renderIcon && /* @__PURE__ */ jsx14(OptionIcon, { children: renderIcon(o) }),
2130
- /* @__PURE__ */ jsx14(
2389
+ /* @__PURE__ */ jsx15("span", { className: "flex h-4 w-4 shrink-0 items-center justify-center text-brand-primaryAction", children: selected && /* @__PURE__ */ jsx15(Check6, { size: 15, strokeWidth: 3 }) }),
2390
+ renderIcon && /* @__PURE__ */ jsx15(OptionIcon, { children: renderIcon(o) }),
2391
+ /* @__PURE__ */ jsx15(
2131
2392
  "span",
2132
2393
  {
2133
2394
  className: cn("flex-1 text-sm", selected ? "font-semibold text-text-primary" : "text-text-primary"),
@@ -2150,14 +2411,14 @@ function SelectFilter({
2150
2411
  import { forwardRef as forwardRef4 } from "react";
2151
2412
 
2152
2413
  // src/Skeleton.tsx
2153
- import { useEffect as useEffect7, useState as useState7 } from "react";
2414
+ import { useEffect as useEffect8, useState as useState8 } from "react";
2154
2415
 
2155
2416
  // src/Button.tsx
2156
2417
  import { forwardRef as forwardRef3 } from "react";
2157
2418
  import { Slot } from "@radix-ui/react-slot";
2158
2419
  import { cva } from "class-variance-authority";
2159
2420
  import { Loader2 } from "lucide-react";
2160
- import { jsx as jsx15, jsxs as jsxs14 } from "react/jsx-runtime";
2421
+ import { jsx as jsx16, jsxs as jsxs15 } from "react/jsx-runtime";
2161
2422
  var buttonVariants = cva(
2162
2423
  "inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-control transition-all duration-(--mr-motion-duration-interactive) ease-interactive disabled:pointer-events-none disabled:opacity-40 focus-visible:outline-solid focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-border-focus",
2163
2424
  {
@@ -2228,10 +2489,10 @@ var Button = forwardRef3(
2228
2489
  ...props
2229
2490
  };
2230
2491
  if (asChild) {
2231
- return /* @__PURE__ */ jsx15(Slot, { ref, ...shared, children });
2492
+ return /* @__PURE__ */ jsx16(Slot, { ref, ...shared, children });
2232
2493
  }
2233
- return /* @__PURE__ */ jsxs14("button", { ref, ...shared, children: [
2234
- loading && /* @__PURE__ */ jsx15(Loader2, { className: "size-4 shrink-0 animate-spin", "aria-hidden": "true" }),
2494
+ return /* @__PURE__ */ jsxs15("button", { ref, ...shared, children: [
2495
+ loading && /* @__PURE__ */ jsx16(Loader2, { className: "size-4 shrink-0 animate-spin", "aria-hidden": "true" }),
2235
2496
  children
2236
2497
  ] });
2237
2498
  }
@@ -2239,7 +2500,7 @@ var Button = forwardRef3(
2239
2500
  Button.displayName = "Button";
2240
2501
 
2241
2502
  // src/Skeleton.tsx
2242
- import { jsx as jsx16, jsxs as jsxs15 } from "react/jsx-runtime";
2503
+ import { jsx as jsx17, jsxs as jsxs16 } from "react/jsx-runtime";
2243
2504
  var STYLE_ID = "mrLoadingStyle";
2244
2505
  var CSS = `
2245
2506
  [data-mr-skeleton]{position:relative;overflow:hidden}
@@ -2250,7 +2511,7 @@ var CSS = `
2250
2511
  @media (prefers-reduced-motion:reduce){[data-mr-skeleton]::after{animation:none;display:none}[data-mr-refresh-line]{animation:none;width:100%;opacity:.5}}
2251
2512
  `;
2252
2513
  function useLoadingStyle() {
2253
- useEffect7(() => {
2514
+ useEffect8(() => {
2254
2515
  if (typeof document === "undefined" || document.getElementById(STYLE_ID)) return;
2255
2516
  const el = document.createElement("style");
2256
2517
  el.id = STYLE_ID;
@@ -2259,9 +2520,9 @@ function useLoadingStyle() {
2259
2520
  }, []);
2260
2521
  }
2261
2522
  function useDelayedLoading(loading, delay = 300, min = 500) {
2262
- const [show, setShow] = useState7(false);
2263
- const [shownAt, setShownAt] = useState7(0);
2264
- useEffect7(() => {
2523
+ const [show, setShow] = useState8(false);
2524
+ const [shownAt, setShownAt] = useState8(0);
2525
+ useEffect8(() => {
2265
2526
  if (loading && !show) {
2266
2527
  const t = setTimeout(() => {
2267
2528
  setShow(true);
@@ -2280,7 +2541,7 @@ function useDelayedLoading(loading, delay = 300, min = 500) {
2280
2541
  var SHAPE = { line: "h-3 rounded-pill", block: "rounded-control", circle: "rounded-full" };
2281
2542
  function Skeleton({ shape = "line", className, style, testIdPrefix }) {
2282
2543
  useLoadingStyle();
2283
- return /* @__PURE__ */ jsx16(
2544
+ return /* @__PURE__ */ jsx17(
2284
2545
  "span",
2285
2546
  {
2286
2547
  "aria-hidden": "true",
@@ -2292,32 +2553,32 @@ function Skeleton({ shape = "line", className, style, testIdPrefix }) {
2292
2553
  );
2293
2554
  }
2294
2555
  function SkeletonLines({ lines = 3, className }) {
2295
- return /* @__PURE__ */ jsx16("span", { "aria-hidden": "true", className: cn("flex flex-col gap-2", className), children: Array.from({ length: lines }, (_, i) => /* @__PURE__ */ jsx16(Skeleton, { className: i === lines - 1 ? "w-2/3" : "w-full" }, i)) });
2556
+ return /* @__PURE__ */ jsx17("span", { "aria-hidden": "true", className: cn("flex flex-col gap-2", className), children: Array.from({ length: lines }, (_, i) => /* @__PURE__ */ jsx17(Skeleton, { className: i === lines - 1 ? "w-2/3" : "w-full" }, i)) });
2296
2557
  }
2297
2558
  function ChartSkeleton({ className }) {
2298
2559
  const bars = [55, 80, 40, 95, 70, 60, 85];
2299
- return /* @__PURE__ */ jsxs15("span", { "aria-hidden": "true", className: cn("flex h-48 flex-col gap-2", className), children: [
2300
- /* @__PURE__ */ jsx16("span", { className: "flex flex-1 items-end gap-3", children: bars.map((h, i) => /* @__PURE__ */ jsx16(Skeleton, { shape: "block", className: "flex-1", style: { height: `${h}%` } }, i)) }),
2301
- /* @__PURE__ */ jsx16("span", { className: "flex gap-3", children: bars.map((_, i) => /* @__PURE__ */ jsx16(Skeleton, { className: "h-2 flex-1" }, i)) })
2560
+ return /* @__PURE__ */ jsxs16("span", { "aria-hidden": "true", className: cn("flex h-48 flex-col gap-2", className), children: [
2561
+ /* @__PURE__ */ jsx17("span", { className: "flex flex-1 items-end gap-3", children: bars.map((h, i) => /* @__PURE__ */ jsx17(Skeleton, { shape: "block", className: "flex-1", style: { height: `${h}%` } }, i)) }),
2562
+ /* @__PURE__ */ jsx17("span", { className: "flex gap-3", children: bars.map((_, i) => /* @__PURE__ */ jsx17(Skeleton, { className: "h-2 flex-1" }, i)) })
2302
2563
  ] });
2303
2564
  }
2304
2565
  function StatStripSkeleton({ tiles = 3, className }) {
2305
- return /* @__PURE__ */ jsx16(
2566
+ return /* @__PURE__ */ jsx17(
2306
2567
  "span",
2307
2568
  {
2308
2569
  "aria-hidden": "true",
2309
2570
  className: cn("grid divide-y divide-border-default rounded-card border border-border-default bg-surface sm:auto-cols-fr sm:grid-flow-col sm:divide-x sm:divide-y-0", className),
2310
- children: Array.from({ length: tiles }, (_, i) => /* @__PURE__ */ jsxs15("span", { className: "flex flex-col gap-2 px-5 py-3", children: [
2311
- /* @__PURE__ */ jsx16(Skeleton, { className: "h-2 w-20" }),
2312
- /* @__PURE__ */ jsx16(Skeleton, { className: "h-6 w-24" }),
2313
- /* @__PURE__ */ jsx16(Skeleton, { className: "h-2 w-28" })
2571
+ children: Array.from({ length: tiles }, (_, i) => /* @__PURE__ */ jsxs16("span", { className: "flex flex-col gap-2 px-5 py-3", children: [
2572
+ /* @__PURE__ */ jsx17(Skeleton, { className: "h-2 w-20" }),
2573
+ /* @__PURE__ */ jsx17(Skeleton, { className: "h-6 w-24" }),
2574
+ /* @__PURE__ */ jsx17(Skeleton, { className: "h-2 w-28" })
2314
2575
  ] }, i))
2315
2576
  }
2316
2577
  );
2317
2578
  }
2318
2579
  function LongWait({ loading, onRetry, hint = "Large date ranges take longer.", className }) {
2319
- const [stage, setStage] = useState7(0);
2320
- useEffect7(() => {
2580
+ const [stage, setStage] = useState8(0);
2581
+ useEffect8(() => {
2321
2582
  setStage(0);
2322
2583
  if (!loading) return void 0;
2323
2584
  const a = setTimeout(() => setStage(1), 5e3);
@@ -2328,24 +2589,24 @@ function LongWait({ loading, onRetry, hint = "Large date ranges take longer.", c
2328
2589
  };
2329
2590
  }, [loading]);
2330
2591
  if (!loading || stage === 0) return null;
2331
- return /* @__PURE__ */ jsxs15("p", { role: "status", className: cn("mt-3 flex items-center gap-2 text-xs text-text-tertiary", className), children: [
2592
+ return /* @__PURE__ */ jsxs16("p", { role: "status", className: cn("mt-3 flex items-center gap-2 text-xs text-text-tertiary", className), children: [
2332
2593
  stage === 1 ? `Still loading. ${hint}` : "This is taking longer than usual.",
2333
- stage === 2 && onRetry && /* @__PURE__ */ jsx16(Button, { variant: "link", size: "sm", onClick: onRetry, children: "Retry" })
2594
+ stage === 2 && onRetry && /* @__PURE__ */ jsx17(Button, { variant: "link", size: "sm", onClick: onRetry, children: "Retry" })
2334
2595
  ] });
2335
2596
  }
2336
2597
  function LoadError({ onRetry, children = "Couldn't load this." }) {
2337
- return /* @__PURE__ */ jsxs15("div", { role: "alert", className: "flex flex-1 flex-col items-center justify-center gap-2 py-8 text-center text-dense text-text-secondary", children: [
2338
- /* @__PURE__ */ jsx16("span", { children }),
2339
- onRetry && /* @__PURE__ */ jsx16(Button, { variant: "secondary", size: "sm", onClick: onRetry, children: "Try again" })
2598
+ return /* @__PURE__ */ jsxs16("div", { role: "alert", className: "flex flex-1 flex-col items-center justify-center gap-2 py-8 text-center text-dense text-text-secondary", children: [
2599
+ /* @__PURE__ */ jsx17("span", { children }),
2600
+ onRetry && /* @__PURE__ */ jsx17(Button, { variant: "secondary", size: "sm", onClick: onRetry, children: "Try again" })
2340
2601
  ] });
2341
2602
  }
2342
2603
  function RefreshLine() {
2343
2604
  useLoadingStyle();
2344
- return /* @__PURE__ */ jsx16("span", { "aria-hidden": "true", className: "pointer-events-none absolute inset-x-0 top-0 h-0.5 overflow-hidden", children: /* @__PURE__ */ jsx16("span", { "data-mr-refresh-line": "" }) });
2605
+ return /* @__PURE__ */ jsx17("span", { "aria-hidden": "true", className: "pointer-events-none absolute inset-x-0 top-0 h-0.5 overflow-hidden", children: /* @__PURE__ */ jsx17("span", { "data-mr-refresh-line": "" }) });
2345
2606
  }
2346
2607
 
2347
2608
  // src/Card.tsx
2348
- import { jsx as jsx17, jsxs as jsxs16 } from "react/jsx-runtime";
2609
+ import { jsx as jsx18, jsxs as jsxs17 } from "react/jsx-runtime";
2349
2610
  var Card = forwardRef4(function Card2({
2350
2611
  staticCard,
2351
2612
  title,
@@ -2366,11 +2627,11 @@ var Card = forwardRef4(function Card2({
2366
2627
  }, ref) {
2367
2628
  const chart = variant === "chart";
2368
2629
  const showSkeleton = useDelayedLoading(loading);
2369
- const body = error ? /* @__PURE__ */ jsx17("div", { className: "flex min-h-48 flex-1 flex-col", children: /* @__PURE__ */ jsx17(LoadError, { onRetry }) }) : loading ? /* @__PURE__ */ jsxs16("div", { className: "flex min-h-48 flex-1 flex-col", children: [
2370
- showSkeleton && (skeleton ?? /* @__PURE__ */ jsx17(ChartSkeleton, {})),
2371
- /* @__PURE__ */ jsx17(LongWait, { loading, onRetry })
2372
- ] }) : refreshing ? /* @__PURE__ */ jsx17("div", { className: "flex flex-1 flex-col opacity-50 transition-opacity motion-reduce:transition-none", children }) : children;
2373
- return /* @__PURE__ */ jsxs16(
2630
+ const body = error ? /* @__PURE__ */ jsx18("div", { className: "flex min-h-48 flex-1 flex-col", children: /* @__PURE__ */ jsx18(LoadError, { onRetry }) }) : loading ? /* @__PURE__ */ jsxs17("div", { className: "flex min-h-48 flex-1 flex-col", children: [
2631
+ showSkeleton && (skeleton ?? /* @__PURE__ */ jsx18(ChartSkeleton, {})),
2632
+ /* @__PURE__ */ jsx18(LongWait, { loading, onRetry })
2633
+ ] }) : refreshing ? /* @__PURE__ */ jsx18("div", { className: "flex flex-1 flex-col opacity-50 transition-opacity motion-reduce:transition-none", children }) : children;
2634
+ return /* @__PURE__ */ jsxs17(
2374
2635
  "article",
2375
2636
  {
2376
2637
  ref,
@@ -2385,19 +2646,19 @@ var Card = forwardRef4(function Card2({
2385
2646
  "aria-busy": loading || refreshing || void 0,
2386
2647
  ...rest,
2387
2648
  children: [
2388
- refreshing && !loading && !error && /* @__PURE__ */ jsx17(RefreshLine, {}),
2389
- title ? /* @__PURE__ */ jsxs16("div", { className: "flex flex-1 flex-col p-card-padding", children: [
2390
- /* @__PURE__ */ jsxs16("div", { className: "flex items-start justify-between gap-2", children: [
2391
- /* @__PURE__ */ jsxs16("div", { className: "min-w-0", children: [
2392
- /* @__PURE__ */ jsxs16("div", { className: "flex items-center gap-1.5", children: [
2393
- /* @__PURE__ */ jsx17(TitleTag, { className: chart ? "text-panel-title font-semibold text-text-primary" : "text-style-card-title", children: title }),
2394
- info && /* @__PURE__ */ jsx17(InfoTip, { text: info, label: `About ${title.toLowerCase()}` })
2649
+ refreshing && !loading && !error && /* @__PURE__ */ jsx18(RefreshLine, {}),
2650
+ title ? /* @__PURE__ */ jsxs17("div", { className: "flex flex-1 flex-col p-card-padding", children: [
2651
+ /* @__PURE__ */ jsxs17("div", { className: "flex items-start justify-between gap-2", children: [
2652
+ /* @__PURE__ */ jsxs17("div", { className: "min-w-0", children: [
2653
+ /* @__PURE__ */ jsxs17("div", { className: "flex items-center gap-1.5", children: [
2654
+ /* @__PURE__ */ jsx18(TitleTag, { className: chart ? "text-panel-title font-semibold text-text-primary" : "text-style-card-title", children: title }),
2655
+ info && /* @__PURE__ */ jsx18(InfoTip, { text: info, label: `About ${title.toLowerCase()}` })
2395
2656
  ] }),
2396
- subtitle && /* @__PURE__ */ jsx17("p", { className: "mt-0.5 text-xs leading-snug text-text-tertiary", children: subtitle })
2657
+ subtitle && /* @__PURE__ */ jsx18("p", { className: "mt-0.5 text-xs leading-snug text-text-tertiary", children: subtitle })
2397
2658
  ] }),
2398
- action && /* @__PURE__ */ jsx17("div", { className: "shrink-0 text-text-tertiary", children: action })
2659
+ action && /* @__PURE__ */ jsx18("div", { className: "shrink-0 text-text-tertiary", children: action })
2399
2660
  ] }),
2400
- /* @__PURE__ */ jsx17("div", { className: "mt-4 flex flex-1 flex-col", children: body })
2661
+ /* @__PURE__ */ jsx18("div", { className: "mt-4 flex flex-1 flex-col", children: body })
2401
2662
  ] }) : body
2402
2663
  ]
2403
2664
  }
@@ -2406,9 +2667,9 @@ var Card = forwardRef4(function Card2({
2406
2667
 
2407
2668
  // src/StatStrip.tsx
2408
2669
  import { forwardRef as forwardRef5 } from "react";
2409
- import { jsx as jsx18, jsxs as jsxs17 } from "react/jsx-runtime";
2670
+ import { jsx as jsx19, jsxs as jsxs18 } from "react/jsx-runtime";
2410
2671
  var StatStrip = forwardRef5(
2411
- ({ className, testIdPrefix, children, ...props }, ref) => /* @__PURE__ */ jsx18(
2672
+ ({ className, testIdPrefix, children, ...props }, ref) => /* @__PURE__ */ jsx19(
2412
2673
  "div",
2413
2674
  {
2414
2675
  ref,
@@ -2426,32 +2687,32 @@ var StatStrip = forwardRef5(
2426
2687
  );
2427
2688
  StatStrip.displayName = "StatStrip";
2428
2689
  function StatTile({ label, value, unit, change, note, icon, info, children, className, testIdPrefix }) {
2429
- return /* @__PURE__ */ jsxs17("div", { "data-testid": testIdPrefix, className: cn("flex min-w-0 flex-col gap-1 px-5 py-3", className), children: [
2430
- /* @__PURE__ */ jsxs17("span", { className: "flex items-center gap-1.5 text-micro font-semibold uppercase tracking-wide text-text-tertiary", children: [
2431
- icon && /* @__PURE__ */ jsx18("span", { "aria-hidden": "true", className: "flex shrink-0 text-brand-primaryAction", children: icon }),
2690
+ return /* @__PURE__ */ jsxs18("div", { "data-testid": testIdPrefix, className: cn("flex min-w-0 flex-col gap-1 px-5 py-3", className), children: [
2691
+ /* @__PURE__ */ jsxs18("span", { className: "flex items-center gap-1.5 text-micro font-semibold uppercase tracking-wide text-text-tertiary", children: [
2692
+ icon && /* @__PURE__ */ jsx19("span", { "aria-hidden": "true", className: "flex shrink-0 text-brand-primaryAction", children: icon }),
2432
2693
  label,
2433
- info && /* @__PURE__ */ jsx18(InfoTip, { text: info, label: `About ${label.toLowerCase()}` })
2694
+ info && /* @__PURE__ */ jsx19(InfoTip, { text: info, label: `About ${label.toLowerCase()}` })
2434
2695
  ] }),
2435
- /* @__PURE__ */ jsxs17("span", { className: "flex flex-wrap items-baseline gap-x-2.5 gap-y-0.5", children: [
2436
- /* @__PURE__ */ jsxs17("span", { className: "text-xl font-bold leading-tight tracking-tight tabular-nums text-text-primary", children: [
2696
+ /* @__PURE__ */ jsxs18("span", { className: "flex flex-wrap items-baseline gap-x-2.5 gap-y-0.5", children: [
2697
+ /* @__PURE__ */ jsxs18("span", { className: "text-xl font-bold leading-tight tracking-tight tabular-nums text-text-primary", children: [
2437
2698
  value,
2438
- unit && /* @__PURE__ */ jsxs17("span", { className: "text-dense font-medium tracking-normal text-text-tertiary", children: [
2699
+ unit && /* @__PURE__ */ jsxs18("span", { className: "text-dense font-medium tracking-normal text-text-tertiary", children: [
2439
2700
  " ",
2440
2701
  unit
2441
2702
  ] })
2442
2703
  ] }),
2443
- change && /* @__PURE__ */ jsx18("span", { className: "text-card-title font-medium", children: change })
2704
+ change && /* @__PURE__ */ jsx19("span", { className: "text-card-title font-medium", children: change })
2444
2705
  ] }),
2445
- note && /* @__PURE__ */ jsx18("span", { className: "text-xs text-text-tertiary", children: note }),
2446
- children && /* @__PURE__ */ jsx18("div", { className: "text-xs text-text-secondary", children })
2706
+ note && /* @__PURE__ */ jsx19("span", { className: "text-xs text-text-tertiary", children: note }),
2707
+ children && /* @__PURE__ */ jsx19("div", { className: "text-xs text-text-secondary", children })
2447
2708
  ] });
2448
2709
  }
2449
2710
 
2450
2711
  // src/ChartLegend.tsx
2451
2712
  import { forwardRef as forwardRef6 } from "react";
2452
- import { jsx as jsx19, jsxs as jsxs18 } from "react/jsx-runtime";
2713
+ import { jsx as jsx20, jsxs as jsxs19 } from "react/jsx-runtime";
2453
2714
  var ChartLegend = forwardRef6(
2454
- ({ className, testIdPrefix, children, ...props }, ref) => /* @__PURE__ */ jsx19(
2715
+ ({ className, testIdPrefix, children, ...props }, ref) => /* @__PURE__ */ jsx20(
2455
2716
  "ul",
2456
2717
  {
2457
2718
  ref,
@@ -2471,8 +2732,8 @@ var MARK = {
2471
2732
  };
2472
2733
  function LegendItem({ mark = "dot", color, you = false, children, className, testIdPrefix }) {
2473
2734
  const dashed = mark === "dashed";
2474
- return /* @__PURE__ */ jsxs18("li", { "data-testid": testIdPrefix, className: cn("flex items-center gap-1.5", you && "text-text-secondary", className), children: [
2475
- /* @__PURE__ */ jsx19(
2735
+ return /* @__PURE__ */ jsxs19("li", { "data-testid": testIdPrefix, className: cn("flex items-center gap-1.5", you && "text-text-secondary", className), children: [
2736
+ /* @__PURE__ */ jsx20(
2476
2737
  "span",
2477
2738
  {
2478
2739
  "aria-hidden": "true",
@@ -2486,7 +2747,7 @@ function LegendItem({ mark = "dot", color, you = false, children, className, tes
2486
2747
  style: color ? dashed ? { borderColor: color } : { background: color } : void 0
2487
2748
  }
2488
2749
  ),
2489
- /* @__PURE__ */ jsxs18("span", { children: [
2750
+ /* @__PURE__ */ jsxs19("span", { children: [
2490
2751
  children,
2491
2752
  you && " (you)"
2492
2753
  ] })
@@ -2494,30 +2755,30 @@ function LegendItem({ mark = "dot", color, you = false, children, className, tes
2494
2755
  }
2495
2756
 
2496
2757
  // src/BarList.tsx
2497
- import { jsx as jsx20, jsxs as jsxs19 } from "react/jsx-runtime";
2758
+ import { jsx as jsx21, jsxs as jsxs20 } from "react/jsx-runtime";
2498
2759
  var COL_WIDTH = ["w-16", "w-13"];
2499
2760
  function BarList({ rows, columns, empty, className, testIdPrefix, "aria-label": ariaLabel }) {
2500
2761
  if (!rows.length) {
2501
- return empty ? /* @__PURE__ */ jsx20("p", { className: cn("text-xs text-text-tertiary", className), children: empty }) : null;
2762
+ return empty ? /* @__PURE__ */ jsx21("p", { className: cn("text-xs text-text-tertiary", className), children: empty }) : null;
2502
2763
  }
2503
2764
  const max = Math.max(...rows.flatMap((r) => [r.bar, r.tick ?? 0]), 1);
2504
2765
  const full = !!columns?.length;
2505
2766
  const colClass = (i) => full ? COL_WIDTH[i] ?? "w-13" : "";
2506
- return /* @__PURE__ */ jsxs19("div", { "data-testid": testIdPrefix, className: cn("flex flex-col", className), children: [
2507
- full && /* @__PURE__ */ jsxs19("div", { "aria-hidden": "true", className: "flex items-baseline gap-2 pb-1", children: [
2508
- /* @__PURE__ */ jsx20("span", { className: "flex-1" }),
2509
- columns.map((c, i) => /* @__PURE__ */ jsx20("span", { className: cn("shrink-0 text-right text-micro font-medium text-text-tertiary", colClass(i)), children: c }, c))
2767
+ return /* @__PURE__ */ jsxs20("div", { "data-testid": testIdPrefix, className: cn("flex flex-col", className), children: [
2768
+ full && /* @__PURE__ */ jsxs20("div", { "aria-hidden": "true", className: "flex items-baseline gap-2 pb-1", children: [
2769
+ /* @__PURE__ */ jsx21("span", { className: "flex-1" }),
2770
+ columns.map((c, i) => /* @__PURE__ */ jsx21("span", { className: cn("shrink-0 text-right text-micro font-medium text-text-tertiary", colClass(i)), children: c }, c))
2510
2771
  ] }),
2511
- /* @__PURE__ */ jsx20("ul", { "aria-label": ariaLabel, className: "flex flex-col", children: rows.map((r) => /* @__PURE__ */ jsxs19("li", { className: "py-2", children: [
2512
- /* @__PURE__ */ jsxs19("div", { className: "mb-1.5 flex items-baseline gap-2", children: [
2513
- /* @__PURE__ */ jsxs19("span", { className: "min-w-0 flex-1 truncate text-dense font-semibold text-text-primary", children: [
2772
+ /* @__PURE__ */ jsx21("ul", { "aria-label": ariaLabel, className: "flex flex-col", children: rows.map((r) => /* @__PURE__ */ jsxs20("li", { className: "py-2", children: [
2773
+ /* @__PURE__ */ jsxs20("div", { className: "mb-1.5 flex items-baseline gap-2", children: [
2774
+ /* @__PURE__ */ jsxs20("span", { className: "min-w-0 flex-1 truncate text-dense font-semibold text-text-primary", children: [
2514
2775
  r.label,
2515
- r.note && /* @__PURE__ */ jsxs19("span", { className: "font-normal text-text-tertiary", children: [
2776
+ r.note && /* @__PURE__ */ jsxs20("span", { className: "font-normal text-text-tertiary", children: [
2516
2777
  " \xB7 ",
2517
2778
  r.note
2518
2779
  ] })
2519
2780
  ] }),
2520
- r.values?.map((v, i) => /* @__PURE__ */ jsxs19(
2781
+ r.values?.map((v, i) => /* @__PURE__ */ jsxs20(
2521
2782
  "span",
2522
2783
  {
2523
2784
  className: cn(
@@ -2526,7 +2787,7 @@ function BarList({ rows, columns, empty, className, testIdPrefix, "aria-label":
2526
2787
  colClass(i)
2527
2788
  ),
2528
2789
  children: [
2529
- full && /* @__PURE__ */ jsxs19("span", { className: "sr-only", children: [
2790
+ full && /* @__PURE__ */ jsxs20("span", { className: "sr-only", children: [
2530
2791
  columns[i],
2531
2792
  ": "
2532
2793
  ] }),
@@ -2536,15 +2797,15 @@ function BarList({ rows, columns, empty, className, testIdPrefix, "aria-label":
2536
2797
  i
2537
2798
  ))
2538
2799
  ] }),
2539
- /* @__PURE__ */ jsxs19("div", { "aria-hidden": "true", className: "relative h-2 rounded-pill bg-subtle", children: [
2540
- /* @__PURE__ */ jsx20(
2800
+ /* @__PURE__ */ jsxs20("div", { "aria-hidden": "true", className: "relative h-2 rounded-pill bg-subtle", children: [
2801
+ /* @__PURE__ */ jsx21(
2541
2802
  "div",
2542
2803
  {
2543
2804
  className: cn("h-full rounded-pill", !r.color && "bg-brand-primaryAction"),
2544
2805
  style: { width: `${Math.max(r.bar, 0) / max * 100}%`, background: r.color }
2545
2806
  }
2546
2807
  ),
2547
- r.tick !== void 0 && /* @__PURE__ */ jsx20(
2808
+ r.tick !== void 0 && /* @__PURE__ */ jsx21(
2548
2809
  "span",
2549
2810
  {
2550
2811
  className: "absolute -bottom-1 -top-1 w-0.5 -translate-x-1/2 rounded-pill bg-text-primary",
@@ -2552,14 +2813,14 @@ function BarList({ rows, columns, empty, className, testIdPrefix, "aria-label":
2552
2813
  }
2553
2814
  )
2554
2815
  ] }),
2555
- r.tickLabel && /* @__PURE__ */ jsx20("span", { className: "sr-only", children: r.tickLabel })
2816
+ r.tickLabel && /* @__PURE__ */ jsx21("span", { className: "sr-only", children: r.tickLabel })
2556
2817
  ] }, r.key)) })
2557
2818
  ] });
2558
2819
  }
2559
2820
 
2560
2821
  // src/NoResultsEmptyState.tsx
2561
2822
  import { FilterX } from "lucide-react";
2562
- import { jsx as jsx21, jsxs as jsxs20 } from "react/jsx-runtime";
2823
+ import { jsx as jsx22, jsxs as jsxs21 } from "react/jsx-runtime";
2563
2824
  var NO_RESULTS_TITLE = "No results match your filters";
2564
2825
  var NO_RESULTS_BODY = "Your filters may be too narrow, conflict with each other, or have no activity in this period.";
2565
2826
  function noResultsBody(workspaceName) {
@@ -2582,12 +2843,12 @@ function NoResultsEmptyState({
2582
2843
  const showClear = hasFilters !== false && Boolean(onClearFilters);
2583
2844
  const showEdit = Boolean(onEditFilters);
2584
2845
  const hasActions = showClear || showEdit || Boolean(actions && actions.length > 0);
2585
- return /* @__PURE__ */ jsxs20("div", { className: cn("flex flex-col items-center justify-center gap-3 text-center", className), "data-testid": testIdPrefix, children: [
2586
- /* @__PURE__ */ jsx21("span", { className: "flex h-11 w-11 items-center justify-center rounded-full bg-subtle text-text-tertiary", children: /* @__PURE__ */ jsx21(FilterX, { size: 20, "aria-hidden": "true" }) }),
2587
- /* @__PURE__ */ jsx21("h2", { className: "text-base font-semibold text-text-primary", children: title }),
2588
- /* @__PURE__ */ jsx21("p", { className: "max-w-105 text-dense leading-relaxed text-text-secondary", children: bodyText }),
2589
- hasActions && /* @__PURE__ */ jsxs20("div", { className: "mt-1 flex flex-col items-center gap-3", children: [
2590
- showClear && /* @__PURE__ */ jsx21(
2846
+ return /* @__PURE__ */ jsxs21("div", { className: cn("flex flex-col items-center justify-center gap-3 text-center", className), "data-testid": testIdPrefix, children: [
2847
+ /* @__PURE__ */ jsx22("span", { className: "flex h-11 w-11 items-center justify-center rounded-full bg-subtle text-text-tertiary", children: /* @__PURE__ */ jsx22(FilterX, { size: 20, "aria-hidden": "true" }) }),
2848
+ /* @__PURE__ */ jsx22("h2", { className: "text-base font-semibold text-text-primary", children: title }),
2849
+ /* @__PURE__ */ jsx22("p", { className: "max-w-105 text-dense leading-relaxed text-text-secondary", children: bodyText }),
2850
+ hasActions && /* @__PURE__ */ jsxs21("div", { className: "mt-1 flex flex-col items-center gap-3", children: [
2851
+ showClear && /* @__PURE__ */ jsx22(
2591
2852
  "button",
2592
2853
  {
2593
2854
  type: "button",
@@ -2597,7 +2858,7 @@ function NoResultsEmptyState({
2597
2858
  children: "Clear all filters"
2598
2859
  }
2599
2860
  ),
2600
- showEdit && /* @__PURE__ */ jsx21(
2861
+ showEdit && /* @__PURE__ */ jsx22(
2601
2862
  "button",
2602
2863
  {
2603
2864
  type: "button",
@@ -2607,7 +2868,7 @@ function NoResultsEmptyState({
2607
2868
  children: "Edit filters"
2608
2869
  }
2609
2870
  ),
2610
- actions?.map((action, i) => /* @__PURE__ */ jsx21(
2871
+ actions?.map((action, i) => /* @__PURE__ */ jsx22(
2611
2872
  "button",
2612
2873
  {
2613
2874
  type: "button",
@@ -2622,11 +2883,11 @@ function NoResultsEmptyState({
2622
2883
  }
2623
2884
 
2624
2885
  // src/WorkspaceSelectedCard.tsx
2625
- import { useEffect as useEffect8, useRef as useRef8, useState as useState8 } from "react";
2886
+ import { useEffect as useEffect9, useRef as useRef9, useState as useState9 } from "react";
2626
2887
  import { ChevronDown as ChevronDown6, X as X3 } from "lucide-react";
2627
- import { jsx as jsx22, jsxs as jsxs21 } from "react/jsx-runtime";
2888
+ import { jsx as jsx23, jsxs as jsxs22 } from "react/jsx-runtime";
2628
2889
  function WorkspaceSelectedCard({ groups, className, testIdPrefix }) {
2629
- return /* @__PURE__ */ jsx22(
2890
+ return /* @__PURE__ */ jsx23(
2630
2891
  "aside",
2631
2892
  {
2632
2893
  className: cn(
@@ -2634,7 +2895,7 @@ function WorkspaceSelectedCard({ groups, className, testIdPrefix }) {
2634
2895
  className
2635
2896
  ),
2636
2897
  "data-testid": testIdPrefix,
2637
- children: /* @__PURE__ */ jsx22("div", { className: "flex flex-col divide-y divide-border-default", children: groups.map((g) => /* @__PURE__ */ jsx22(SummaryGroupItem, { group: g, testIdPrefix }, g.id)) })
2898
+ children: /* @__PURE__ */ jsx23("div", { className: "flex flex-col divide-y divide-border-default", children: groups.map((g) => /* @__PURE__ */ jsx23(SummaryGroupItem, { group: g, testIdPrefix }, g.id)) })
2638
2899
  }
2639
2900
  );
2640
2901
  }
@@ -2646,15 +2907,15 @@ function SummaryGroupItem({
2646
2907
  const ownCount = group.items.length;
2647
2908
  const subCount = (group.subGroups ?? []).reduce((n, sg) => n + sg.items.length, 0);
2648
2909
  const expandCount = ownCount + subCount;
2649
- const [open, setOpen] = useState8(expandCount > 0);
2650
- const wasEmpty = useRef8(expandCount === 0);
2651
- useEffect8(() => {
2910
+ const [open, setOpen] = useState9(expandCount > 0);
2911
+ const wasEmpty = useRef9(expandCount === 0);
2912
+ useEffect9(() => {
2652
2913
  if (wasEmpty.current && expandCount > 0) setOpen(true);
2653
2914
  else if (expandCount === 0) setOpen(false);
2654
2915
  wasEmpty.current = expandCount === 0;
2655
2916
  }, [expandCount]);
2656
- return /* @__PURE__ */ jsxs21("div", { className: nested ? "" : "py-3 first:pt-0 last:pb-0", children: [
2657
- /* @__PURE__ */ jsxs21(
2917
+ return /* @__PURE__ */ jsxs22("div", { className: nested ? "" : "py-3 first:pt-0 last:pb-0", children: [
2918
+ /* @__PURE__ */ jsxs22(
2658
2919
  "button",
2659
2920
  {
2660
2921
  type: "button",
@@ -2663,7 +2924,7 @@ function SummaryGroupItem({
2663
2924
  "data-testid": testIdPrefix && `${testIdPrefix}-group-${group.id}`,
2664
2925
  className: "flex w-full min-w-0 items-center gap-2 text-left focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-border-focus",
2665
2926
  children: [
2666
- /* @__PURE__ */ jsx22(
2927
+ /* @__PURE__ */ jsx23(
2667
2928
  ChevronDown6,
2668
2929
  {
2669
2930
  size: 14,
@@ -2671,37 +2932,37 @@ function SummaryGroupItem({
2671
2932
  className: cn("shrink-0 text-text-secondary transition-transform", !open && "-rotate-90")
2672
2933
  }
2673
2934
  ),
2674
- /* @__PURE__ */ jsx22("span", { className: cn("truncate font-semibold text-text-primary", nested ? "text-xs" : "text-dense"), children: group.label }),
2675
- /* @__PURE__ */ jsx22("span", { className: "shrink-0 rounded-full bg-subtle px-1.5 py-0.5 text-micro font-semibold text-text-secondary", children: ownCount })
2935
+ /* @__PURE__ */ jsx23("span", { className: cn("truncate font-semibold text-text-primary", nested ? "text-xs" : "text-dense"), children: group.label }),
2936
+ /* @__PURE__ */ jsx23("span", { className: "shrink-0 rounded-full bg-subtle px-1.5 py-0.5 text-micro font-semibold text-text-secondary", children: ownCount })
2676
2937
  ]
2677
2938
  }
2678
2939
  ),
2679
- open && /* @__PURE__ */ jsx22("div", { className: "pt-2.5", children: ownCount === 0 && subCount === 0 ? /* @__PURE__ */ jsx22("p", { className: "text-xs text-text-secondary", children: "Nothing selected." }) : /* @__PURE__ */ jsxs21("div", { className: "flex flex-col gap-2.5", children: [
2680
- ownCount > 0 && /* @__PURE__ */ jsxs21("div", { className: "flex flex-col gap-1.5", children: [
2681
- group.items.map((item) => /* @__PURE__ */ jsxs21(
2940
+ open && /* @__PURE__ */ jsx23("div", { className: "pt-2.5", children: ownCount === 0 && subCount === 0 ? /* @__PURE__ */ jsx23("p", { className: "text-xs text-text-secondary", children: "Nothing selected." }) : /* @__PURE__ */ jsxs22("div", { className: "flex flex-col gap-2.5", children: [
2941
+ ownCount > 0 && /* @__PURE__ */ jsxs22("div", { className: "flex flex-col gap-1.5", children: [
2942
+ group.items.map((item) => /* @__PURE__ */ jsxs22(
2682
2943
  "div",
2683
2944
  {
2684
2945
  className: "flex items-center justify-between gap-2 rounded-control border border-border-default bg-canvas px-2 py-1",
2685
2946
  children: [
2686
- /* @__PURE__ */ jsxs21("span", { className: "min-w-0 flex-1", children: [
2687
- /* @__PURE__ */ jsx22("span", { className: "block truncate text-xs text-text-primary", children: item.name }),
2688
- item.meta && /* @__PURE__ */ jsx22("span", { className: "block truncate text-micro text-text-secondary", children: item.meta })
2947
+ /* @__PURE__ */ jsxs22("span", { className: "min-w-0 flex-1", children: [
2948
+ /* @__PURE__ */ jsx23("span", { className: "block truncate text-xs text-text-primary", children: item.name }),
2949
+ item.meta && /* @__PURE__ */ jsx23("span", { className: "block truncate text-micro text-text-secondary", children: item.meta })
2689
2950
  ] }),
2690
- /* @__PURE__ */ jsx22(
2951
+ /* @__PURE__ */ jsx23(
2691
2952
  "button",
2692
2953
  {
2693
2954
  type: "button",
2694
2955
  "aria-label": `Remove ${item.name}`,
2695
2956
  onClick: () => group.onRemove(item.id),
2696
2957
  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-1 focus-visible:outline-border-focus",
2697
- children: /* @__PURE__ */ jsx22(X3, { size: 12, "aria-hidden": "true" })
2958
+ children: /* @__PURE__ */ jsx23(X3, { size: 12, "aria-hidden": "true" })
2698
2959
  }
2699
2960
  )
2700
2961
  ]
2701
2962
  },
2702
2963
  item.id
2703
2964
  )),
2704
- /* @__PURE__ */ jsx22(
2965
+ /* @__PURE__ */ jsx23(
2705
2966
  "button",
2706
2967
  {
2707
2968
  type: "button",
@@ -2712,446 +2973,205 @@ function SummaryGroupItem({
2712
2973
  }
2713
2974
  )
2714
2975
  ] }),
2715
- group.subGroups?.map((sg) => /* @__PURE__ */ jsx22(SummaryGroupItem, { group: sg, nested: true, testIdPrefix }, sg.id))
2976
+ group.subGroups?.map((sg) => /* @__PURE__ */ jsx23(SummaryGroupItem, { group: sg, nested: true, testIdPrefix }, sg.id))
2716
2977
  ] }) })
2717
2978
  ] });
2718
2979
  }
2719
2980
 
2720
2981
  // src/chart-placeholder-shared.tsx
2721
- import { jsx as jsx23, jsxs as jsxs22 } from "react/jsx-runtime";
2722
- var GRID_ROWS = [0, 25, 50, 75, 100];
2723
- var Y_TICK_WIDTHS = [26, 30, 30, 26, 20];
2724
- var Y_AXIS_W = 48;
2725
- var X_AXIS_H = 22;
2726
- var LEGEND_WIDTHS = [58, 44, 66, 50, 38, 62, 46, 54];
2727
- function AxisFrame({
2728
- height,
2729
- xTicks,
2730
- children,
2731
- className,
2732
- testIdPrefix
2733
- }) {
2734
- const gutter = xTicks > 0 ? X_AXIS_H : 0;
2735
- return /* @__PURE__ */ jsx23("div", { className: cn("w-full", className), style: { height }, role: "presentation", "aria-hidden": "true", "data-testid": testIdPrefix, children: /* @__PURE__ */ jsxs22("div", { className: "relative h-full w-full", children: [
2736
- /* @__PURE__ */ jsxs22("div", { className: "absolute inset-y-0 right-0", style: { left: Y_AXIS_W, bottom: gutter }, children: [
2737
- GRID_ROWS.map((pct) => /* @__PURE__ */ jsx23(
2738
- "div",
2739
- {
2740
- className: "absolute inset-x-0 border-t border-dashed",
2741
- style: { top: `${pct}%`, borderColor: "var(--mr-color-border-default)" }
2742
- },
2743
- pct
2744
- )),
2745
- /* @__PURE__ */ jsx23("div", { className: "absolute inset-0", children })
2746
- ] }),
2747
- /* @__PURE__ */ jsx23("div", { className: "absolute left-0 top-0", style: { width: Y_AXIS_W, bottom: gutter }, children: GRID_ROWS.map((pct, i) => /* @__PURE__ */ jsx23(
2748
- "div",
2749
- {
2750
- className: "absolute right-2 h-2 -translate-y-1/2 rounded-xs bg-subtle",
2751
- style: { top: `${pct}%`, width: Y_TICK_WIDTHS[i] }
2752
- },
2753
- pct
2754
- )) }),
2755
- xTicks > 0 && /* @__PURE__ */ jsx23(
2756
- "div",
2757
- {
2758
- className: "absolute bottom-0 right-0 flex items-center",
2759
- style: { left: Y_AXIS_W, height: X_AXIS_H },
2760
- children: Array.from({ length: xTicks }, (_, i) => /* @__PURE__ */ jsx23("div", { className: "flex flex-1 justify-center", children: /* @__PURE__ */ jsx23("div", { className: "h-2 w-full max-w-6.5 rounded-xs bg-subtle" }) }, i))
2761
- }
2762
- )
2763
- ] }) });
2764
- }
2765
- function BlankLegend({ rows, reverse = false }) {
2766
- return /* @__PURE__ */ jsx23(
2767
- "ul",
2768
- {
2769
- className: `flex flex-1 justify-center gap-1.5 ${reverse ? "flex-col-reverse" : "flex-col"}`,
2770
- role: "presentation",
2771
- "aria-hidden": "true",
2772
- children: Array.from({ length: rows }, (_, i) => /* @__PURE__ */ jsxs22("li", { className: "flex items-center justify-between gap-2", children: [
2773
- /* @__PURE__ */ jsxs22("span", { className: "flex items-center gap-1.5", children: [
2774
- /* @__PURE__ */ jsx23("span", { className: "h-2.5 w-2.5 rounded-xs bg-subtle" }),
2775
- /* @__PURE__ */ jsx23(
2776
- "span",
2777
- {
2778
- className: "h-2 rounded-xs bg-subtle",
2779
- style: { width: LEGEND_WIDTHS[i % LEGEND_WIDTHS.length] }
2780
- }
2781
- )
2782
- ] }),
2783
- /* @__PURE__ */ jsx23("span", { className: "h-2 w-6 rounded-xs bg-subtle" })
2784
- ] }, i))
2785
- }
2786
- );
2787
- }
2788
-
2789
- // src/BarChartPlaceholder.tsx
2790
- import { jsx as jsx24 } from "react/jsx-runtime";
2791
- var BAR_PROFILE = [92, 86, 76, 65, 57, 40, 30, 24, 18, 13];
2792
- function BarChartPlaceholder({ height = 220, className, testIdPrefix }) {
2793
- return /* @__PURE__ */ jsx24(AxisFrame, { height, xTicks: BAR_PROFILE.length, className, testIdPrefix, children: /* @__PURE__ */ jsx24("div", { className: "flex h-full w-full items-end gap-2", children: BAR_PROFILE.map((pct, i) => /* @__PURE__ */ jsx24("div", { className: "flex-1 rounded-t-small bg-subtle", style: { height: `${pct}%` } }, i)) }) });
2794
- }
2795
-
2796
- // src/LineChartPlaceholder.tsx
2797
- import { jsx as jsx25, jsxs as jsxs23 } from "react/jsx-runtime";
2798
- var LINE_SERIES = [
2799
- [58, 52, 55, 41, 45, 33, 36, 25, 28, 17],
2800
- [74, 71, 66, 68, 59, 61, 54, 56, 48, 45],
2801
- [40, 44, 37, 41, 34, 38, 31, 34, 27, 26],
2802
- [86, 82, 84, 77, 79, 71, 73, 66, 68, 61]
2803
- ];
2804
- var LINE_FORECAST_FROM = 7;
2805
- function LineChartPlaceholder({ height = 280, className, testIdPrefix }) {
2806
- const toPath = (pts, from, to) => pts.slice(from, to).map((y, i) => `${(i + from) / (pts.length - 1) * 100},${y}`).join(" ");
2807
- return /* @__PURE__ */ jsxs23(AxisFrame, { height, xTicks: LINE_SERIES[0].length, className, testIdPrefix, children: [
2808
- /* @__PURE__ */ jsx25("svg", { viewBox: "0 0 100 100", preserveAspectRatio: "none", className: "absolute inset-0 h-full w-full", children: LINE_SERIES.map((pts, s) => /* @__PURE__ */ jsxs23("g", { children: [
2809
- /* @__PURE__ */ jsx25(
2810
- "polyline",
2811
- {
2812
- points: toPath(pts, 0, LINE_FORECAST_FROM + 1),
2813
- fill: "none",
2814
- stroke: "var(--mr-color-subtle)",
2815
- strokeWidth: "2",
2816
- vectorEffect: "non-scaling-stroke",
2817
- strokeLinecap: "round",
2818
- strokeLinejoin: "round"
2819
- }
2820
- ),
2821
- /* @__PURE__ */ jsx25(
2822
- "polyline",
2823
- {
2824
- points: toPath(pts, LINE_FORECAST_FROM, pts.length),
2825
- fill: "none",
2826
- stroke: "var(--mr-color-subtle)",
2827
- strokeWidth: "2",
2828
- strokeDasharray: "5 4",
2829
- vectorEffect: "non-scaling-stroke",
2830
- strokeLinecap: "round",
2831
- strokeLinejoin: "round"
2832
- }
2833
- )
2834
- ] }, s)) }),
2835
- LINE_SERIES.map(
2836
- (pts, s) => pts.map((y, i) => /* @__PURE__ */ jsx25(
2837
- "div",
2838
- {
2839
- className: "absolute h-1.5 w-1.5 -translate-x-1/2 -translate-y-1/2 rounded-full",
2840
- style: {
2841
- left: `${i / (pts.length - 1) * 100}%`,
2842
- top: `${y}%`,
2843
- backgroundColor: "var(--mr-color-subtle)"
2844
- }
2845
- },
2846
- `${s}-${i}`
2847
- ))
2848
- )
2849
- ] });
2850
- }
2851
-
2852
- // src/PieChartPlaceholder.tsx
2853
- import { jsx as jsx26, jsxs as jsxs24 } from "react/jsx-runtime";
2854
- var PIE_SEAMS = [0, 115, 180, 230, 262, 288, 310, 332];
2855
- function PieChartPlaceholder({ height = 220, legendRows = 8, className, testIdPrefix }) {
2856
- const r = 45;
2857
- return /* @__PURE__ */ jsxs24("div", { className: cn("flex w-full items-center gap-3", className), style: { height }, role: "presentation", "aria-hidden": "true", "data-testid": testIdPrefix, children: [
2858
- /* @__PURE__ */ jsx26("div", { className: "flex h-full items-center justify-center", style: { width: "60%" }, children: /* @__PURE__ */ jsxs24("svg", { viewBox: "0 0 100 100", className: "h-full", style: { aspectRatio: "1 / 1" }, children: [
2859
- /* @__PURE__ */ jsx26("circle", { cx: "50", cy: "50", r, fill: "var(--mr-color-subtle)" }),
2860
- PIE_SEAMS.map((deg) => {
2861
- const rad = (deg - 90) * Math.PI / 180;
2862
- return /* @__PURE__ */ jsx26(
2863
- "line",
2864
- {
2865
- x1: "50",
2866
- y1: "50",
2867
- x2: 50 + r * Math.cos(rad),
2868
- y2: 50 + r * Math.sin(rad),
2869
- stroke: "var(--mr-color-surface)",
2870
- strokeWidth: "1"
2871
- },
2872
- deg
2873
- );
2874
- })
2875
- ] }) }),
2876
- /* @__PURE__ */ jsx26(BlankLegend, { rows: legendRows })
2877
- ] });
2878
- }
2879
-
2880
- // src/StackedColumnPlaceholder.tsx
2881
- import { jsx as jsx27, jsxs as jsxs25 } from "react/jsx-runtime";
2882
- var COLUMN_WEIGHTS = [20, 30, 15, 35, 24, 12, 28, 18];
2883
- function columnBands(count) {
2884
- const weights = Array.from({ length: count }, (_, i) => COLUMN_WEIGHTS[i % COLUMN_WEIGHTS.length]);
2885
- const total = weights.reduce((a, b) => a + b, 0);
2886
- return weights.map((w) => w / total * 100);
2887
- }
2888
- function StackedColumnPlaceholder({
2889
- height = 220,
2890
- width = 96,
2891
- legendRows = 4,
2892
- axis = false,
2893
- className,
2894
- testIdPrefix
2895
- }) {
2896
- const column = /* @__PURE__ */ jsx27("div", { className: "flex h-full flex-col overflow-hidden rounded-control bg-subtle", style: { width }, children: columnBands(legendRows).map((pct, i) => /* @__PURE__ */ jsx27(
2897
- "div",
2898
- {
2899
- style: {
2900
- height: `${pct}%`,
2901
- /* A gap in the card's color, not a border tone: border-default
2902
- disappears on the subtle fill, border-strong reads darker. */
2903
- borderTop: i === 0 ? void 0 : "1px solid var(--mr-color-surface)"
2904
- }
2905
- },
2906
- i
2907
- )) });
2908
- return /* @__PURE__ */ jsxs25("div", { className: cn("flex w-full gap-4", className), style: { height }, role: "presentation", "aria-hidden": "true", "data-testid": testIdPrefix, children: [
2909
- axis ? /* @__PURE__ */ jsx27("div", { style: { width: "55%" }, children: /* @__PURE__ */ jsx27(AxisFrame, { height, xTicks: 0, children: /* @__PURE__ */ jsx27("div", { className: "flex h-full items-stretch justify-center", children: column }) }) }) : /* @__PURE__ */ jsx27("div", { className: "flex items-stretch py-1", children: column }),
2910
- /* @__PURE__ */ jsx27(BlankLegend, { rows: legendRows, reverse: !axis })
2911
- ] });
2912
- }
2913
-
2914
- // src/Tooltip.tsx
2915
- import { useEffect as useEffect9, useId as useId4, useLayoutEffect as useLayoutEffect4, useRef as useRef9, useState as useState9 } from "react";
2916
- import { createPortal as createPortal3 } from "react-dom";
2917
- import { jsx as jsx28, jsxs as jsxs26 } from "react/jsx-runtime";
2918
- function addDescribedBy(el, id) {
2919
- const ids = (el.getAttribute("aria-describedby") ?? "").split(" ").filter(Boolean);
2920
- if (!ids.includes(id)) el.setAttribute("aria-describedby", [...ids, id].join(" "));
2921
- }
2922
- function removeDescribedBy(el, id) {
2923
- const ids = (el.getAttribute("aria-describedby") ?? "").split(" ").filter((x) => x && x !== id);
2924
- if (ids.length) el.setAttribute("aria-describedby", ids.join(" "));
2925
- else el.removeAttribute("aria-describedby");
2926
- }
2927
- function exitDurationMs(el) {
2928
- if (typeof window.matchMedia === "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches) return 0;
2929
- const cs = window.getComputedStyle(el);
2930
- if (cs.transitionProperty === "none") return 0;
2931
- const toMs = (v) => {
2932
- const n = parseFloat(v);
2933
- if (!Number.isFinite(n)) return 0;
2934
- return v.trim().endsWith("ms") ? n : n * 1e3;
2935
- };
2936
- const durations = cs.transitionDuration.split(",").map(toMs);
2937
- const delays = cs.transitionDelay.split(",").map(toMs);
2938
- return Math.max(0, ...durations.map((d, i) => d + (delays[i] ?? delays[0] ?? 0)));
2939
- }
2940
- function Tooltip({
2941
- label,
2942
- children,
2943
- anchorRef,
2944
- className,
2945
- whenTruncated = false,
2946
- interactive = false,
2947
- placement = "top",
2948
- align = "center",
2949
- delay = 0,
2950
- variant = "surface",
2951
- testIdPrefix
2952
- }) {
2953
- const [anchor, setAnchor] = useState9(null);
2954
- const [boxWidth, setBoxWidth] = useState9(null);
2955
- const ref = useRef9(null);
2956
- const boxRef = useRef9(null);
2957
- const hideTimer = useRef9(null);
2958
- const showTimer = useRef9(null);
2959
- const exitTimer = useRef9(null);
2960
- const [shown, setShown] = useState9(false);
2961
- const openRef = useRef9(false);
2962
- const mountedRef = useRef9(false);
2963
- const id = useId4();
2964
- const describedRef = useRef9(null);
2965
- const clearHideTimer = () => {
2966
- if (hideTimer.current) {
2967
- clearTimeout(hideTimer.current);
2968
- hideTimer.current = null;
2969
- }
2970
- };
2971
- const clearShowTimer = () => {
2972
- if (showTimer.current) {
2973
- clearTimeout(showTimer.current);
2974
- showTimer.current = null;
2975
- }
2976
- };
2977
- const clearExitTimer = () => {
2978
- if (exitTimer.current) {
2979
- clearTimeout(exitTimer.current);
2980
- exitTimer.current = null;
2981
- }
2982
- };
2983
- useEffect9(
2984
- () => () => {
2985
- clearHideTimer();
2986
- clearShowTimer();
2987
- clearExitTimer();
2988
- },
2989
- []
2990
- );
2991
- const reveal = () => {
2992
- const el = anchorRef ? anchorRef.current : ref.current;
2993
- if (!el) return;
2994
- if (whenTruncated && el.scrollWidth <= el.clientWidth) return;
2995
- clearExitTimer();
2996
- openRef.current = true;
2997
- const r = el.getBoundingClientRect();
2998
- if (!mountedRef.current) setBoxWidth(null);
2999
- mountedRef.current = true;
3000
- setAnchor({ top: r.top, left: r.left, width: r.width, height: r.height, bottom: r.bottom, right: r.right });
3001
- const target = anchorRef ? el : describedRef.current;
3002
- if (target) addDescribedBy(target, id);
3003
- };
3004
- const show = () => {
3005
- clearHideTimer();
3006
- clearShowTimer();
3007
- if (delay > 0 && !mountedRef.current) {
3008
- showTimer.current = setTimeout(reveal, delay);
3009
- } else {
3010
- reveal();
3011
- }
3012
- };
3013
- const unmount = () => {
3014
- clearExitTimer();
3015
- if (openRef.current || !mountedRef.current) return;
3016
- mountedRef.current = false;
3017
- setAnchor(null);
3018
- setBoxWidth(null);
3019
- if (anchorRef?.current) removeDescribedBy(anchorRef.current, id);
3020
- if (describedRef.current) removeDescribedBy(describedRef.current, id);
3021
- describedRef.current = null;
3022
- };
3023
- const hideNow = () => {
3024
- clearShowTimer();
3025
- clearHideTimer();
3026
- openRef.current = false;
3027
- if (!mountedRef.current) return;
3028
- setShown(false);
3029
- clearExitTimer();
3030
- const ms = boxRef.current ? exitDurationMs(boxRef.current) : 0;
3031
- if (ms === 0) {
3032
- unmount();
3033
- return;
3034
- }
3035
- exitTimer.current = setTimeout(unmount, ms + 50);
3036
- };
3037
- const keepOpen = () => {
3038
- clearHideTimer();
3039
- if (openRef.current || !mountedRef.current) return;
3040
- clearExitTimer();
3041
- openRef.current = true;
3042
- setShown(true);
3043
- };
3044
- const onBoxTransitionEnd = (e) => {
3045
- if (e.target !== e.currentTarget || e.propertyName !== "opacity") return;
3046
- if (!openRef.current) unmount();
3047
- };
3048
- const hide = () => {
3049
- clearShowTimer();
3050
- if (!interactive) {
3051
- hideNow();
3052
- return;
3053
- }
3054
- clearHideTimer();
3055
- hideTimer.current = setTimeout(hideNow, 120);
3056
- };
3057
- useEffect9(() => {
3058
- if (!anchorRef) return;
3059
- const el = anchorRef.current;
3060
- if (!el) return;
3061
- el.addEventListener("mouseenter", show);
3062
- el.addEventListener("mouseleave", hide);
3063
- el.addEventListener("focus", show);
3064
- el.addEventListener("blur", hide);
3065
- return () => {
3066
- el.removeEventListener("mouseenter", show);
3067
- el.removeEventListener("mouseleave", hide);
3068
- el.removeEventListener("focus", show);
3069
- el.removeEventListener("blur", hide);
3070
- };
3071
- }, [anchorRef, placement, delay]);
3072
- useEffect9(() => {
3073
- if (!anchor) return;
3074
- const onKey = (e) => e.key === "Escape" && hideNow();
3075
- window.addEventListener("keydown", onKey);
3076
- return () => window.removeEventListener("keydown", onKey);
3077
- }, [anchor]);
3078
- useLayoutEffect4(() => {
3079
- if (!anchor) return;
3080
- const el = boxRef.current;
3081
- if (!el) return;
3082
- setBoxWidth(el.getBoundingClientRect().width);
3083
- if (openRef.current) setShown(true);
3084
- }, [anchor, label]);
3085
- const margin = 8;
3086
- let style = { top: 0, left: 0 };
3087
- let translate = "";
3088
- if (anchor) {
3089
- if (placement === "right") {
3090
- style = { top: anchor.top + anchor.height / 2, left: anchor.right + 8 };
3091
- translate = "-translate-y-1/2";
3092
- } else if (placement === "bottom-end") {
3093
- style = { top: anchor.bottom + 8, right: window.innerWidth - anchor.right };
3094
- } else {
3095
- const w = boxWidth ?? anchor.width;
3096
- const desired = align === "start" ? anchor.left : anchor.left + anchor.width / 2 - w / 2;
3097
- const left = Math.min(Math.max(desired, margin), Math.max(margin, window.innerWidth - w - margin));
3098
- style = { left, top: placement === "bottom" ? anchor.bottom : anchor.top };
3099
- translate = placement === "bottom" ? "translate-y-2" : "-translate-y-[calc(100%+8px)]";
3100
- }
3101
- }
3102
- const floating = anchor != null && typeof document !== "undefined" ? createPortal3(
3103
- /* @__PURE__ */ jsx28(
3104
- "span",
2982
+ import { jsx as jsx24, jsxs as jsxs23 } from "react/jsx-runtime";
2983
+ var GRID_ROWS = [0, 25, 50, 75, 100];
2984
+ var Y_TICK_WIDTHS = [26, 30, 30, 26, 20];
2985
+ var Y_AXIS_W = 48;
2986
+ var X_AXIS_H = 22;
2987
+ var LEGEND_WIDTHS = [58, 44, 66, 50, 38, 62, 46, 54];
2988
+ function AxisFrame({
2989
+ height,
2990
+ xTicks,
2991
+ children,
2992
+ className,
2993
+ testIdPrefix
2994
+ }) {
2995
+ const gutter = xTicks > 0 ? X_AXIS_H : 0;
2996
+ return /* @__PURE__ */ jsx24("div", { className: cn("w-full", className), style: { height }, role: "presentation", "aria-hidden": "true", "data-testid": testIdPrefix, children: /* @__PURE__ */ jsxs23("div", { className: "relative h-full w-full", children: [
2997
+ /* @__PURE__ */ jsxs23("div", { className: "absolute inset-y-0 right-0", style: { left: Y_AXIS_W, bottom: gutter }, children: [
2998
+ GRID_ROWS.map((pct) => /* @__PURE__ */ jsx24(
2999
+ "div",
3000
+ {
3001
+ className: "absolute inset-x-0 border-t border-dashed",
3002
+ style: { top: `${pct}%`, borderColor: "var(--mr-color-border-default)" }
3003
+ },
3004
+ pct
3005
+ )),
3006
+ /* @__PURE__ */ jsx24("div", { className: "absolute inset-0", children })
3007
+ ] }),
3008
+ /* @__PURE__ */ jsx24("div", { className: "absolute left-0 top-0", style: { width: Y_AXIS_W, bottom: gutter }, children: GRID_ROWS.map((pct, i) => /* @__PURE__ */ jsx24(
3009
+ "div",
3105
3010
  {
3106
- ref: boxRef,
3107
- role: "tooltip",
3108
- id,
3109
- "data-testid": testIdPrefix && `${testIdPrefix}-tooltip`,
3110
- style: { top: style.top, left: style.left, right: style.right, visibility: boxWidth == null ? "hidden" : "visible" },
3111
- onMouseEnter: interactive ? keepOpen : void 0,
3112
- onMouseLeave: interactive ? hide : void 0,
3113
- onTransitionEnd: onBoxTransitionEnd,
3114
- className: cn(
3115
- "fixed z-tooltip w-max max-w-xs whitespace-normal break-words px-2.5 py-1.5 text-xs leading-snug",
3116
- // Fade in/out. The sys duration token rather than a ref one:
3117
- // it is what Button's hover/press transition uses, and a
3118
- // tooltip's fade is the same kind of interactive feedback.
3119
- // design-tokens has no in-out curve (ease-interactive is the
3120
- // decelerating "standard" curve), so ease-in-out is Tailwind's.
3121
- "transition-opacity duration-(--mr-motion-duration-interactive) ease-in-out motion-reduce:transition-none",
3122
- shown ? "opacity-100" : "opacity-0",
3123
- // Non-interactive: never a pointer target, fade-out included.
3124
- interactive ? "pointer-events-auto" : "pointer-events-none",
3125
- variant === "inverted" ? "rounded-control bg-text-primary text-surface" : "rounded-control border border-border-default bg-surface text-text-primary shadow-overlay",
3126
- translate
3127
- ),
3128
- children: label
3011
+ className: "absolute right-2 h-2 -translate-y-1/2 rounded-xs bg-subtle",
3012
+ style: { top: `${pct}%`, width: Y_TICK_WIDTHS[i] }
3013
+ },
3014
+ pct
3015
+ )) }),
3016
+ xTicks > 0 && /* @__PURE__ */ jsx24(
3017
+ "div",
3018
+ {
3019
+ className: "absolute bottom-0 right-0 flex items-center",
3020
+ style: { left: Y_AXIS_W, height: X_AXIS_H },
3021
+ children: Array.from({ length: xTicks }, (_, i) => /* @__PURE__ */ jsx24("div", { className: "flex flex-1 justify-center", children: /* @__PURE__ */ jsx24("div", { className: "h-2 w-full max-w-6.5 rounded-xs bg-subtle" }) }, i))
3129
3022
  }
3130
- ),
3131
- document.body
3132
- ) : null;
3133
- if (anchorRef) return floating;
3134
- return /* @__PURE__ */ jsxs26(
3135
- "span",
3023
+ )
3024
+ ] }) });
3025
+ }
3026
+ function BlankLegend({ rows, reverse = false }) {
3027
+ return /* @__PURE__ */ jsx24(
3028
+ "ul",
3136
3029
  {
3137
- ref,
3138
- className,
3139
- "data-testid": testIdPrefix,
3140
- onMouseEnter: show,
3141
- onMouseLeave: hide,
3142
- onFocus: (e) => {
3143
- describedRef.current = e.target;
3144
- show();
3145
- },
3146
- onBlur: hide,
3147
- children: [
3148
- children,
3149
- floating
3150
- ]
3030
+ className: `flex flex-1 justify-center gap-1.5 ${reverse ? "flex-col-reverse" : "flex-col"}`,
3031
+ role: "presentation",
3032
+ "aria-hidden": "true",
3033
+ children: Array.from({ length: rows }, (_, i) => /* @__PURE__ */ jsxs23("li", { className: "flex items-center justify-between gap-2", children: [
3034
+ /* @__PURE__ */ jsxs23("span", { className: "flex items-center gap-1.5", children: [
3035
+ /* @__PURE__ */ jsx24("span", { className: "h-2.5 w-2.5 rounded-xs bg-subtle" }),
3036
+ /* @__PURE__ */ jsx24(
3037
+ "span",
3038
+ {
3039
+ className: "h-2 rounded-xs bg-subtle",
3040
+ style: { width: LEGEND_WIDTHS[i % LEGEND_WIDTHS.length] }
3041
+ }
3042
+ )
3043
+ ] }),
3044
+ /* @__PURE__ */ jsx24("span", { className: "h-2 w-6 rounded-xs bg-subtle" })
3045
+ ] }, i))
3151
3046
  }
3152
3047
  );
3153
3048
  }
3154
3049
 
3050
+ // src/BarChartPlaceholder.tsx
3051
+ import { jsx as jsx25 } from "react/jsx-runtime";
3052
+ var BAR_PROFILE = [92, 86, 76, 65, 57, 40, 30, 24, 18, 13];
3053
+ function BarChartPlaceholder({ height = 220, className, testIdPrefix }) {
3054
+ return /* @__PURE__ */ jsx25(AxisFrame, { height, xTicks: BAR_PROFILE.length, className, testIdPrefix, children: /* @__PURE__ */ jsx25("div", { className: "flex h-full w-full items-end gap-2", children: BAR_PROFILE.map((pct, i) => /* @__PURE__ */ jsx25("div", { className: "flex-1 rounded-t-small bg-subtle", style: { height: `${pct}%` } }, i)) }) });
3055
+ }
3056
+
3057
+ // src/LineChartPlaceholder.tsx
3058
+ import { jsx as jsx26, jsxs as jsxs24 } from "react/jsx-runtime";
3059
+ var LINE_SERIES = [
3060
+ [58, 52, 55, 41, 45, 33, 36, 25, 28, 17],
3061
+ [74, 71, 66, 68, 59, 61, 54, 56, 48, 45],
3062
+ [40, 44, 37, 41, 34, 38, 31, 34, 27, 26],
3063
+ [86, 82, 84, 77, 79, 71, 73, 66, 68, 61]
3064
+ ];
3065
+ var LINE_FORECAST_FROM = 7;
3066
+ function LineChartPlaceholder({ height = 280, className, testIdPrefix }) {
3067
+ const toPath = (pts, from, to) => pts.slice(from, to).map((y, i) => `${(i + from) / (pts.length - 1) * 100},${y}`).join(" ");
3068
+ return /* @__PURE__ */ jsxs24(AxisFrame, { height, xTicks: LINE_SERIES[0].length, className, testIdPrefix, children: [
3069
+ /* @__PURE__ */ jsx26("svg", { viewBox: "0 0 100 100", preserveAspectRatio: "none", className: "absolute inset-0 h-full w-full", children: LINE_SERIES.map((pts, s) => /* @__PURE__ */ jsxs24("g", { children: [
3070
+ /* @__PURE__ */ jsx26(
3071
+ "polyline",
3072
+ {
3073
+ points: toPath(pts, 0, LINE_FORECAST_FROM + 1),
3074
+ fill: "none",
3075
+ stroke: "var(--mr-color-subtle)",
3076
+ strokeWidth: "2",
3077
+ vectorEffect: "non-scaling-stroke",
3078
+ strokeLinecap: "round",
3079
+ strokeLinejoin: "round"
3080
+ }
3081
+ ),
3082
+ /* @__PURE__ */ jsx26(
3083
+ "polyline",
3084
+ {
3085
+ points: toPath(pts, LINE_FORECAST_FROM, pts.length),
3086
+ fill: "none",
3087
+ stroke: "var(--mr-color-subtle)",
3088
+ strokeWidth: "2",
3089
+ strokeDasharray: "5 4",
3090
+ vectorEffect: "non-scaling-stroke",
3091
+ strokeLinecap: "round",
3092
+ strokeLinejoin: "round"
3093
+ }
3094
+ )
3095
+ ] }, s)) }),
3096
+ LINE_SERIES.map(
3097
+ (pts, s) => pts.map((y, i) => /* @__PURE__ */ jsx26(
3098
+ "div",
3099
+ {
3100
+ className: "absolute h-1.5 w-1.5 -translate-x-1/2 -translate-y-1/2 rounded-full",
3101
+ style: {
3102
+ left: `${i / (pts.length - 1) * 100}%`,
3103
+ top: `${y}%`,
3104
+ backgroundColor: "var(--mr-color-subtle)"
3105
+ }
3106
+ },
3107
+ `${s}-${i}`
3108
+ ))
3109
+ )
3110
+ ] });
3111
+ }
3112
+
3113
+ // src/PieChartPlaceholder.tsx
3114
+ import { jsx as jsx27, jsxs as jsxs25 } from "react/jsx-runtime";
3115
+ var PIE_SEAMS = [0, 115, 180, 230, 262, 288, 310, 332];
3116
+ function PieChartPlaceholder({ height = 220, legendRows = 8, className, testIdPrefix }) {
3117
+ const r = 45;
3118
+ return /* @__PURE__ */ jsxs25("div", { className: cn("flex w-full items-center gap-3", className), style: { height }, role: "presentation", "aria-hidden": "true", "data-testid": testIdPrefix, children: [
3119
+ /* @__PURE__ */ jsx27("div", { className: "flex h-full items-center justify-center", style: { width: "60%" }, children: /* @__PURE__ */ jsxs25("svg", { viewBox: "0 0 100 100", className: "h-full", style: { aspectRatio: "1 / 1" }, children: [
3120
+ /* @__PURE__ */ jsx27("circle", { cx: "50", cy: "50", r, fill: "var(--mr-color-subtle)" }),
3121
+ PIE_SEAMS.map((deg) => {
3122
+ const rad = (deg - 90) * Math.PI / 180;
3123
+ return /* @__PURE__ */ jsx27(
3124
+ "line",
3125
+ {
3126
+ x1: "50",
3127
+ y1: "50",
3128
+ x2: 50 + r * Math.cos(rad),
3129
+ y2: 50 + r * Math.sin(rad),
3130
+ stroke: "var(--mr-color-surface)",
3131
+ strokeWidth: "1"
3132
+ },
3133
+ deg
3134
+ );
3135
+ })
3136
+ ] }) }),
3137
+ /* @__PURE__ */ jsx27(BlankLegend, { rows: legendRows })
3138
+ ] });
3139
+ }
3140
+
3141
+ // src/StackedColumnPlaceholder.tsx
3142
+ import { jsx as jsx28, jsxs as jsxs26 } from "react/jsx-runtime";
3143
+ var COLUMN_WEIGHTS = [20, 30, 15, 35, 24, 12, 28, 18];
3144
+ function columnBands(count) {
3145
+ const weights = Array.from({ length: count }, (_, i) => COLUMN_WEIGHTS[i % COLUMN_WEIGHTS.length]);
3146
+ const total = weights.reduce((a, b) => a + b, 0);
3147
+ return weights.map((w) => w / total * 100);
3148
+ }
3149
+ function StackedColumnPlaceholder({
3150
+ height = 220,
3151
+ width = 96,
3152
+ legendRows = 4,
3153
+ axis = false,
3154
+ className,
3155
+ testIdPrefix
3156
+ }) {
3157
+ const column = /* @__PURE__ */ jsx28("div", { className: "flex h-full flex-col overflow-hidden rounded-control bg-subtle", style: { width }, children: columnBands(legendRows).map((pct, i) => /* @__PURE__ */ jsx28(
3158
+ "div",
3159
+ {
3160
+ style: {
3161
+ height: `${pct}%`,
3162
+ /* A gap in the card's color, not a border tone: border-default
3163
+ disappears on the subtle fill, border-strong reads darker. */
3164
+ borderTop: i === 0 ? void 0 : "1px solid var(--mr-color-surface)"
3165
+ }
3166
+ },
3167
+ i
3168
+ )) });
3169
+ return /* @__PURE__ */ jsxs26("div", { className: cn("flex w-full gap-4", className), style: { height }, role: "presentation", "aria-hidden": "true", "data-testid": testIdPrefix, children: [
3170
+ axis ? /* @__PURE__ */ jsx28("div", { style: { width: "55%" }, children: /* @__PURE__ */ jsx28(AxisFrame, { height, xTicks: 0, children: /* @__PURE__ */ jsx28("div", { className: "flex h-full items-stretch justify-center", children: column }) }) }) : /* @__PURE__ */ jsx28("div", { className: "flex items-stretch py-1", children: column }),
3171
+ /* @__PURE__ */ jsx28(BlankLegend, { rows: legendRows, reverse: !axis })
3172
+ ] });
3173
+ }
3174
+
3155
3175
  // src/AdvertiserNoResults.tsx
3156
3176
  import { jsx as jsx29, jsxs as jsxs27 } from "react/jsx-runtime";
3157
3177
  function AdvertiserNoResults({
@@ -5395,7 +5415,7 @@ function Drawer({ open, onClose, title, description, size = "sm", footer, childr
5395
5415
  }
5396
5416
 
5397
5417
  // src/DataTable.tsx
5398
- import { Fragment as Fragment7, useEffect as useEffect17, useId as useId10, useState as useState18 } from "react";
5418
+ import { Fragment as Fragment7, useEffect as useEffect17, useId as useId10, useRef as useRef19, useState as useState18 } from "react";
5399
5419
  import { ChevronRight as ChevronRight6 } from "lucide-react";
5400
5420
 
5401
5421
  // src/numbers.ts
@@ -5455,12 +5475,32 @@ function formatPercent(value, _opts = {}) {
5455
5475
  }
5456
5476
 
5457
5477
  // src/DataTable.tsx
5458
- import { jsx as jsx55, jsxs as jsxs49 } from "react/jsx-runtime";
5478
+ import { Fragment as Fragment8, jsx as jsx55, jsxs as jsxs49 } from "react/jsx-runtime";
5459
5479
  var WIDTH3 = { fill: "", sm: "w-24", md: "w-36", lg: "w-48" };
5460
5480
  var MAX_H = { sm: "max-h-80", md: "max-h-120", lg: "max-h-160" };
5461
5481
  var HEAD_PAD = { default: "px-4 py-3", compact: "px-3 py-2" };
5462
5482
  var CELL_PAD = { default: "px-4 py-3.5", compact: "px-3 py-2" };
5483
+ var SUB_INDENT = { default: "pl-10", compact: "pl-9" };
5484
+ var TINT = "bg-brand-primaryTint";
5485
+ var TINT_HOVER = "group-hover/row:bg-linear-to-r group-hover/row:from-brand-primaryAction/10 group-hover/row:to-brand-primaryAction/10";
5486
+ var ROW_RING = "group-has-[[data-row-open]:focus-visible]/row:after:pointer-events-none group-has-[[data-row-open]:focus-visible]/row:after:absolute group-has-[[data-row-open]:focus-visible]/row:after:inset-0 group-has-[[data-row-open]:focus-visible]/row:after:border-y-2 group-has-[[data-row-open]:focus-visible]/row:after:border-border-focus";
5487
+ var RING_LEFT = "group-has-[[data-row-open]:focus-visible]/row:after:border-l-2";
5488
+ var RING_RIGHT = "group-has-[[data-row-open]:focus-visible]/row:after:border-r-2";
5489
+ var RING_PAST_EDGE = "group-has-[[data-row-open]:focus-visible]/row:after:-right-2";
5463
5490
  var OWN_CLICK = "a, button, input, select, textarea, label, summary, [role='button'], [role='checkbox'], [role='menuitem'], [role='switch'], [role='tab'], [contenteditable='true']";
5491
+ function isDev() {
5492
+ try {
5493
+ return process.env.NODE_ENV !== "production";
5494
+ } catch {
5495
+ return false;
5496
+ }
5497
+ }
5498
+ function rowClickCounts(e) {
5499
+ if (e.target.closest(OWN_CLICK)) return false;
5500
+ const sel = window.getSelection?.();
5501
+ if (sel && sel.toString() && sel.anchorNode && e.currentTarget.contains(sel.anchorNode)) return false;
5502
+ return true;
5503
+ }
5464
5504
  function NoValue({ reason = "No data" }) {
5465
5505
  return /* @__PURE__ */ jsxs49(Tooltip, { label: reason, delay: 300, className: "text-text-tertiary", children: [
5466
5506
  /* @__PURE__ */ jsx55("span", { "aria-hidden": "true", children: NO_VALUE }),
@@ -5491,9 +5531,25 @@ function DataTable({
5491
5531
  sort = null,
5492
5532
  onSortChange,
5493
5533
  defaultSort = null,
5494
- renderExpanded,
5534
+ renderExpanded: renderExpandedProp,
5495
5535
  canExpand,
5536
+ subRows: subRowsProp,
5537
+ subRowNoun = { one: "row", other: "rows" },
5538
+ totalsRow,
5539
+ totalsLabel = "Total",
5540
+ onRowClick,
5541
+ rowClickLabel,
5542
+ highlightRow,
5496
5543
  rowLabel,
5544
+ selected,
5545
+ onSelectedChange,
5546
+ totalCount,
5547
+ onSelectAll,
5548
+ selectedCount,
5549
+ selectionActions,
5550
+ selectionDisabled,
5551
+ selectionBar = true,
5552
+ selectAll = true,
5497
5553
  density = "default",
5498
5554
  loading = false,
5499
5555
  loadingRows = 5,
@@ -5518,32 +5574,164 @@ function DataTable({
5518
5574
  const col = columns.find((c) => c.key === key);
5519
5575
  onSortChange?.(cycleSort(shown, key, col?.firstDir ?? (right(col) ? "desc" : "asc"), defaultSort));
5520
5576
  };
5577
+ const clash = !!onRowClick && (!!renderExpandedProp || !!subRowsProp);
5578
+ useEffect17(() => {
5579
+ if (clash && isDev()) {
5580
+ console.warn("DataTable: pass `onRowClick` or rows that open in place (`renderExpanded`, `subRows`), not both. The row click wins; rows won't open.");
5581
+ }
5582
+ }, [clash]);
5583
+ const renderExpanded = onRowClick ? void 0 : renderExpandedProp;
5584
+ const subRows = onRowClick ? void 0 : subRowsProp;
5585
+ const childrenOf = (row) => {
5586
+ const kids = subRows?.(row);
5587
+ return kids && kids.length > 0 ? kids : null;
5588
+ };
5521
5589
  const [open, setOpen] = useState18(() => /* @__PURE__ */ new Set());
5522
- const visibleKeys = rows.map(rowKey).join("|");
5523
- useEffect17(() => setOpen(/* @__PURE__ */ new Set()), [shown?.key, shown?.dir, visibleKeys]);
5524
- const expandable = (row) => !!renderExpanded && (canExpand ? canExpand(row) : true);
5525
- const anyExpandable = !!renderExpanded && rows.some(expandable);
5590
+ const visible = rows.map(rowKey);
5591
+ const resetOn = subRows ? [...visible].sort().join("|") : `${shown?.key}|${shown?.dir}|${visible.join("|")}`;
5592
+ useEffect17(() => setOpen(/* @__PURE__ */ new Set()), [resetOn]);
5593
+ const expandable = (row) => (!!renderExpanded || !!childrenOf(row)) && (canExpand ? canExpand(row) : true);
5594
+ const anyExpandable = (!!renderExpanded || !!subRows) && rows.some(expandable);
5526
5595
  const toggle = (key) => setOpen((prev) => {
5527
5596
  const next = new Set(prev);
5528
5597
  if (next.has(key)) next.delete(key);
5529
5598
  else next.add(key);
5530
5599
  return next;
5531
5600
  });
5532
- const onRowClick = (e, key) => {
5533
- if (e.target.closest(OWN_CLICK)) return;
5534
- if (window.getSelection?.()?.toString()) return;
5535
- toggle(key);
5601
+ const selectable = !!onSelectedChange;
5602
+ const picked = new Set(selected ?? []);
5603
+ const blocked = (row) => selectionDisabled ? selectionDisabled(row) : false;
5604
+ const pickable = rows.filter((r) => !blocked(r)).map(rowKey);
5605
+ const allVisible = pickable.length > 0 && pickable.every((k) => picked.has(k));
5606
+ const someVisible = pickable.some((k) => picked.has(k));
5607
+ const setPicked = (next) => onSelectedChange?.([...next]);
5608
+ const toggleAllVisible = () => {
5609
+ const next = new Set(picked);
5610
+ pickable.forEach((k) => allVisible ? next.delete(k) : next.add(k));
5611
+ setPicked(next);
5612
+ };
5613
+ const lastPicked = useRef19(null);
5614
+ const shiftHeld = useRef19(false);
5615
+ const togglePick = (index) => {
5616
+ const key = visible[index];
5617
+ const on = !picked.has(key);
5618
+ const next = new Set(picked);
5619
+ const from = shiftHeld.current && lastPicked.current !== null ? Math.min(lastPicked.current, index) : index;
5620
+ const to = shiftHeld.current && lastPicked.current !== null ? Math.max(lastPicked.current, index) : index;
5621
+ for (let i = from; i <= to; i++) {
5622
+ if (i !== index && blocked(rows[i])) continue;
5623
+ if (on) next.add(visible[i]);
5624
+ else next.delete(visible[i]);
5625
+ }
5626
+ lastPicked.current = index;
5627
+ setPicked(next);
5536
5628
  };
5537
- const span = columns.length + (anyExpandable ? 1 : 0);
5629
+ const count = selectedCount ?? picked.size;
5630
+ const barCount = selectable && selectionBar ? count : 0;
5631
+ const scroller = useRef19(null);
5632
+ const [pinned, setPinned] = useState18(false);
5633
+ const [scrolled, setScrolled] = useState18(false);
5634
+ const heads = useRef19(/* @__PURE__ */ new Map());
5635
+ const [lefts, setLefts] = useState18({});
5636
+ useEffect17(() => {
5637
+ const el = scroller.current;
5638
+ if (!el || typeof ResizeObserver === "undefined") return void 0;
5639
+ const measure = () => {
5640
+ setPinned(el.scrollWidth > el.clientWidth + 1);
5641
+ const next = {};
5642
+ const order = [...heads.current.entries()].sort(([, a], [, b]) => a.cellIndex - b.cellIndex);
5643
+ let x = 0;
5644
+ for (const [id, th] of order) {
5645
+ next[id] = x;
5646
+ x += th.offsetWidth;
5647
+ }
5648
+ setLefts((prev) => Object.keys(next).every((k) => prev[k] === next[k]) && Object.keys(prev).length === Object.keys(next).length ? prev : next);
5649
+ };
5650
+ measure();
5651
+ const ro = new ResizeObserver(measure);
5652
+ ro.observe(el);
5653
+ if (el.firstElementChild) ro.observe(el.firstElementChild);
5654
+ return () => ro.disconnect();
5655
+ }, []);
5656
+ const nameIdx = Math.max(0, columns.findIndex((c) => !c.rank));
5657
+ const leftOf = (part) => lefts[String(part)] ?? 0;
5658
+ const headRef = (part) => (el) => {
5659
+ if (el) heads.current.set(String(part), el);
5660
+ else heads.current.delete(String(part));
5661
+ };
5662
+ const isPinned = (part) => pinned && (typeof part !== "number" || part <= nameIdx);
5663
+ const pinCls = (part, where, rowBg) => isPinned(part) ? cn(
5664
+ "sticky z-1",
5665
+ where === "head" ? rowBg ?? "bg-subtle" : rowBg ?? "bg-surface group-hover/row:bg-subtle",
5666
+ part === nameIdx && "max-w-60 border-r border-r-border-default"
5667
+ ) : "";
5668
+ const pinStyle = (part) => isPinned(part) ? { left: leftOf(part) } : void 0;
5669
+ const edge = (part) => pinned && scrolled && part === nameIdx ? /* @__PURE__ */ jsx55("span", { "aria-hidden": "true", className: "pointer-events-none absolute inset-y-0 left-full w-2 bg-linear-to-r from-border-default to-transparent" }) : null;
5670
+ const span = columns.length + (anyExpandable ? 1 : 0) + (selectable ? 1 : 0);
5538
5671
  const renderCell = (c, row) => {
5539
5672
  const v = c.cell(row);
5540
5673
  return v === null || v === void 0 || v === "" ? /* @__PURE__ */ jsx55(NoValue, { reason: c.missing }) : v;
5541
5674
  };
5675
+ const fit = (ci, content) => pinned && ci === nameIdx ? /* @__PURE__ */ jsx55(Tooltip, { label: content, whenTruncated: true, delay: 300, className: "block truncate", children: content }) : content;
5676
+ const colBg = (c, rowBg) => c.highlight ? TINT : rowBg;
5677
+ const firstPart = selectable ? "select" : anyExpandable ? "expand" : 0;
5678
+ const ringCls = (part) => onRowClick ? cn(
5679
+ "relative",
5680
+ ROW_RING,
5681
+ part === firstPart && RING_LEFT,
5682
+ part === columns.length - 1 && RING_RIGHT,
5683
+ pinned && scrolled && part === nameIdx && part !== columns.length - 1 && RING_PAST_EDGE
5684
+ ) : "";
5685
+ const plainRow = (kind, row, key, rowBg, extra) => /* @__PURE__ */ jsxs49("tr", { id: extra?.id, className: cn("[&:last-child>td]:border-b-0", kind === "total" && "font-semibold"), children: [
5686
+ selectable && /* @__PURE__ */ jsx55("td", { className: cn("border-b border-border-default pr-0", pad2, rowBg, pinCls("select", "body", rowBg)), style: pinStyle("select") }),
5687
+ anyExpandable && /* @__PURE__ */ jsx55("td", { className: cn("border-b border-border-default pr-0", pad2, rowBg, pinCls("expand", "body", rowBg)), style: pinStyle("expand") }),
5688
+ columns.map((c, ci) => {
5689
+ const bg = kind === "sub" ? colBg(c, rowBg) : rowBg;
5690
+ const isName = ci === nameIdx;
5691
+ return /* @__PURE__ */ jsxs49(
5692
+ "td",
5693
+ {
5694
+ className: cn(
5695
+ "border-b border-border-default",
5696
+ pad2,
5697
+ align(c),
5698
+ right(c) && "tabular-nums",
5699
+ c.rank && "text-text-tertiary",
5700
+ kind === "sub" && isName && cn(SUB_INDENT[density], "text-text-secondary"),
5701
+ bg,
5702
+ pinCls(ci, "body", bg)
5703
+ ),
5704
+ style: pinStyle(ci),
5705
+ children: [
5706
+ c.rank ? null : isName && kind === "total" ? fit(ci, totalsLabel) : kind === "total" ? /* @__PURE__ */ jsx55(DeltaBoldContext.Provider, { value: true, children: fit(ci, renderCell(c, row)) }) : fit(ci, renderCell(c, row)),
5707
+ kind === "sub" && isName && rowLabel && extra?.parent !== void 0 && /* @__PURE__ */ jsxs49("span", { className: "sr-only", children: [
5708
+ ", in ",
5709
+ rowLabel(extra.parent)
5710
+ ] }),
5711
+ edge(ci)
5712
+ ]
5713
+ },
5714
+ c.key
5715
+ );
5716
+ })
5717
+ ] }, key);
5542
5718
  const inside = variant === "chart";
5719
+ const bar = barCount > 0 ? /* @__PURE__ */ jsxs49("div", { className: "flex flex-wrap items-center gap-x-3 gap-y-1 text-dense", children: [
5720
+ /* @__PURE__ */ jsxs49("span", { role: "status", className: "font-medium text-text-primary", children: [
5721
+ formatCountFull(count),
5722
+ " selected"
5723
+ ] }),
5724
+ allVisible && totalCount !== void 0 && count < totalCount && onSelectAll && /* @__PURE__ */ jsxs49(Button, { variant: "link", size: "sm", onClick: onSelectAll, children: [
5725
+ "Select all ",
5726
+ formatCountFull(totalCount)
5727
+ ] }),
5728
+ selectionActions,
5729
+ /* @__PURE__ */ jsx55(Button, { variant: "link", size: "sm", onClick: () => onSelectedChange?.([]), children: "Clear" })
5730
+ ] }) : null;
5543
5731
  const frame = /* @__PURE__ */ jsxs49(
5544
5732
  "div",
5545
5733
  {
5546
- className: cn("relative flex w-full flex-col overflow-hidden rounded-card border border-border-default bg-surface", !(title && !inside) && className),
5734
+ className: cn("relative flex w-full flex-col overflow-hidden rounded-card border border-border-default bg-surface", (inside || !title && barCount === 0) && className),
5547
5735
  "data-testid": testIdPrefix,
5548
5736
  children: [
5549
5737
  title && inside && /* @__PURE__ */ jsxs49("div", { className: "flex items-start justify-between gap-2 p-card-padding", children: [
@@ -5551,108 +5739,201 @@ function DataTable({
5551
5739
  /* @__PURE__ */ jsx55("h3", { id: titleId, className: "text-panel-title font-semibold text-text-primary", children: title }),
5552
5740
  subtitle && /* @__PURE__ */ jsx55("p", { className: "mt-0.5 text-xs leading-snug text-text-tertiary", children: subtitle })
5553
5741
  ] }),
5554
- action && /* @__PURE__ */ jsx55("div", { className: "shrink-0 text-text-tertiary", children: action })
5742
+ (bar ?? action) && /* @__PURE__ */ jsx55("div", { className: "shrink-0 text-text-tertiary", children: bar ?? action })
5555
5743
  ] }),
5556
- /* @__PURE__ */ jsx55("div", { className: cn("overflow-x-auto", maxHeight && cn("overflow-y-auto", MAX_H[maxHeight])), children: /* @__PURE__ */ jsxs49(
5557
- "table",
5744
+ /* @__PURE__ */ jsx55(
5745
+ "div",
5558
5746
  {
5559
- "aria-labelledby": title ? titleId : void 0,
5560
- "aria-label": title ? void 0 : rest["aria-label"],
5561
- "aria-busy": loading || refreshing || void 0,
5562
- className: "w-full border-collapse text-left",
5563
- children: [
5564
- /* @__PURE__ */ jsx55("thead", { className: cn(maxHeight && "sticky top-0 z-10"), children: /* @__PURE__ */ jsxs49("tr", { className: "bg-subtle text-micro font-semibold uppercase tracking-wider text-text-secondary", children: [
5565
- anyExpandable && /* @__PURE__ */ jsx55("th", { scope: "col", className: cn("w-10 border-b border-border-default", head), children: /* @__PURE__ */ jsx55("span", { className: "sr-only", children: "Details" }) }),
5566
- columns.map((c) => /* @__PURE__ */ jsx55(
5567
- "th",
5568
- {
5569
- scope: "col",
5570
- "aria-sort": c.sortable ? ariaSortFor(shown, c.key) : void 0,
5571
- className: cn("group/head whitespace-nowrap border-b border-border-default font-semibold", head, align(c), width(c)),
5572
- children: c.sortable && onSortChange ? /* @__PURE__ */ jsx55(
5573
- SortButton,
5747
+ ref: scroller,
5748
+ onScroll: (e) => setScrolled(e.currentTarget.scrollLeft > 0),
5749
+ className: cn("overflow-x-auto", maxHeight && cn("overflow-y-auto", MAX_H[maxHeight])),
5750
+ children: /* @__PURE__ */ jsxs49(
5751
+ "table",
5752
+ {
5753
+ "aria-labelledby": title ? titleId : void 0,
5754
+ "aria-label": title ? void 0 : rest["aria-label"],
5755
+ "aria-busy": loading || refreshing || void 0,
5756
+ className: "w-full border-separate border-spacing-0 text-left",
5757
+ children: [
5758
+ /* @__PURE__ */ jsx55("thead", { className: cn(maxHeight && "sticky top-0 z-10"), children: /* @__PURE__ */ jsxs49("tr", { className: "bg-subtle text-micro font-semibold uppercase tracking-wider text-text-secondary", children: [
5759
+ selectable && /* @__PURE__ */ jsx55("th", { ref: headRef("select"), scope: "col", className: cn("w-10 border-b border-border-default pr-0", head, pinCls("select", "head")), style: pinStyle("select"), children: selectAll ? /* @__PURE__ */ jsx55(
5760
+ CheckBox,
5574
5761
  {
5575
- label: c.label,
5576
- sortKey: c.key,
5577
- align: right(c) ? "right" : "left",
5578
- sort: sortProp(shown),
5579
- onSort,
5580
- description: c.info,
5581
- testIdPrefix
5762
+ checked: allVisible,
5763
+ indeterminate: someVisible && !allVisible,
5764
+ onChange: toggleAllVisible,
5765
+ disabled: pickable.length === 0,
5766
+ ariaLabel: allVisible ? "Deselect all rows on this page" : "Select all rows on this page"
5582
5767
  }
5583
- ) : c.info ? /* @__PURE__ */ jsx55(SortButton, { label: c.label, sortKey: c.key, sortable: false, sort: sortProp(shown), onSort: () => {
5584
- }, description: c.info, align: right(c) ? "right" : "left" }) : c.label
5585
- },
5586
- c.key
5587
- ))
5588
- ] }) }),
5589
- /* @__PURE__ */ jsx55("tbody", { className: cn("text-dense text-text-primary", refreshing && !loading && "opacity-50 transition-opacity motion-reduce:transition-none"), children: loading ? Array.from({ length: loadingRows }, (_, i) => /* @__PURE__ */ jsxs49("tr", { "aria-hidden": "true", className: "[&:last-child>td]:border-b-0", children: [
5590
- anyExpandable && /* @__PURE__ */ jsx55("td", { className: cn("border-b border-border-default", pad2) }),
5591
- columns.map((c) => /* @__PURE__ */ jsx55("td", { className: cn("border-b border-border-default", pad2, align(c)), children: showSkeleton ? /* @__PURE__ */ jsx55(Skeleton, { className: cn("inline-block", right(c) ? "w-12" : "w-2/3") }) : /* @__PURE__ */ jsx55("span", { className: "inline-block h-3" }) }, c.key))
5592
- ] }, i)) : rows.length === 0 ? /* @__PURE__ */ jsx55("tr", { children: /* @__PURE__ */ jsx55("td", { colSpan: span, className: "px-6 py-12", children: empty ?? /* @__PURE__ */ jsx55(NoResultsEmptyState, {}) }) }) : rows.map((row, index) => {
5593
- const key = rowKey(row);
5594
- const canOpen = expandable(row);
5595
- const isOpen = canOpen && open.has(key);
5596
- const panelId = `${titleId}-row-${index}`;
5597
- return /* @__PURE__ */ jsxs49(Fragment7, { children: [
5598
- /* @__PURE__ */ jsxs49(
5599
- "tr",
5600
- {
5601
- onClick: canOpen ? (e) => onRowClick(e, key) : void 0,
5602
- className: cn("hover:bg-subtle [&:last-child>td]:border-b-0", canOpen && "cursor-pointer", isOpen && "bg-subtle"),
5603
- children: [
5604
- anyExpandable && /* @__PURE__ */ jsx55("td", { className: cn("border-b border-border-default pr-0", pad2, isOpen && "border-b-0"), children: canOpen && /* @__PURE__ */ jsx55(
5605
- "button",
5606
- {
5607
- type: "button",
5608
- "aria-expanded": isOpen,
5609
- "aria-controls": isOpen ? panelId : void 0,
5610
- "aria-label": `${isOpen ? "Hide" : "Show"} details${rowLabel ? ` for ${rowLabel(row)}` : ""}`,
5611
- onClick: () => toggle(key),
5612
- className: "flex size-6 items-center justify-center rounded-control text-text-tertiary hover:text-text-primary focus-visible:outline-solid focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-border-focus",
5613
- children: /* @__PURE__ */ jsx55(
5614
- ChevronRight6,
5615
- {
5616
- size: 16,
5617
- "aria-hidden": "true",
5618
- className: cn("transition-transform motion-reduce:transition-none", isOpen && "rotate-90")
5619
- }
5620
- )
5621
- }
5622
- ) }),
5623
- columns.map((c) => /* @__PURE__ */ jsx55(
5624
- "td",
5768
+ ) : /* @__PURE__ */ jsx55("span", { className: "sr-only", children: "Select" }) }),
5769
+ anyExpandable && /* @__PURE__ */ jsx55("th", { ref: headRef("expand"), scope: "col", className: cn("w-10 border-b border-border-default", head, pinCls("expand", "head")), style: pinStyle("expand"), children: /* @__PURE__ */ jsx55("span", { className: "sr-only", children: "Details" }) }),
5770
+ columns.map((c, ci) => /* @__PURE__ */ jsxs49(
5771
+ "th",
5772
+ {
5773
+ ref: ci <= nameIdx ? headRef(ci) : void 0,
5774
+ scope: "col",
5775
+ "aria-sort": c.sortable ? ariaSortFor(shown, c.key) : void 0,
5776
+ className: cn(
5777
+ "group/head whitespace-nowrap border-b border-border-default font-semibold",
5778
+ head,
5779
+ align(c),
5780
+ width(c),
5781
+ c.highlight && TINT,
5782
+ pinCls(ci, "head", c.highlight ? TINT : void 0)
5783
+ ),
5784
+ style: pinStyle(ci),
5785
+ children: [
5786
+ c.sortable && onSortChange ? /* @__PURE__ */ jsx55(
5787
+ SortButton,
5788
+ {
5789
+ label: c.label,
5790
+ sortKey: c.key,
5791
+ align: right(c) ? "right" : "left",
5792
+ sort: sortProp(shown),
5793
+ onSort,
5794
+ description: c.info,
5795
+ testIdPrefix
5796
+ }
5797
+ ) : c.info ? /* @__PURE__ */ jsx55(SortButton, { label: c.label, sortKey: c.key, sortable: false, sort: sortProp(shown), onSort: () => {
5798
+ }, description: c.info, align: right(c) ? "right" : "left" }) : c.label,
5799
+ edge(ci)
5800
+ ]
5801
+ },
5802
+ c.key
5803
+ ))
5804
+ ] }) }),
5805
+ /* @__PURE__ */ jsx55("tbody", { className: cn("text-dense text-text-primary", refreshing && !loading && "opacity-50 transition-opacity motion-reduce:transition-none"), children: loading ? Array.from({ length: loadingRows }, (_, i) => /* @__PURE__ */ jsxs49("tr", { "aria-hidden": "true", className: "[&:last-child>td]:border-b-0", children: [
5806
+ selectable && /* @__PURE__ */ jsx55("td", { className: cn("border-b border-border-default", pad2) }),
5807
+ anyExpandable && /* @__PURE__ */ jsx55("td", { className: cn("border-b border-border-default", pad2) }),
5808
+ columns.map((c) => /* @__PURE__ */ jsx55("td", { className: cn("border-b border-border-default", pad2, align(c)), children: showSkeleton ? /* @__PURE__ */ jsx55(Skeleton, { className: cn("inline-block", right(c) ? "w-12" : "w-2/3") }) : /* @__PURE__ */ jsx55("span", { className: "inline-block h-3" }) }, c.key))
5809
+ ] }, i)) : rows.length === 0 ? /* @__PURE__ */ jsx55("tr", { children: /* @__PURE__ */ jsx55("td", { colSpan: span, className: "px-6 py-12", children: empty ?? /* @__PURE__ */ jsx55(NoResultsEmptyState, {}) }) }) : /* @__PURE__ */ jsxs49(Fragment8, { children: [
5810
+ totalsRow !== void 0 && plainRow("total", totalsRow, "__totals", "bg-subtle"),
5811
+ rows.map((row, ri) => {
5812
+ const key = rowKey(row);
5813
+ const canOpen = expandable(row);
5814
+ const kids = canOpen ? childrenOf(row) : null;
5815
+ const isOpen = canOpen && open.has(key);
5816
+ const panelOpen = isOpen && !kids;
5817
+ const panelId = `${titleId}-row-${ri}`;
5818
+ const kidIds = kids ? kids.map((_, si) => `${panelId}-${si}`) : [];
5819
+ const rowBg = highlightRow?.(row) ? cn(TINT, onRowClick && TINT_HOVER) : panelOpen ? "bg-subtle" : void 0;
5820
+ const reason = selectable ? blocked(row) : false;
5821
+ const ticked = picked.has(key);
5822
+ const label = rowLabel ? rowLabel(row) : "row";
5823
+ const clickable = !!onRowClick || canOpen;
5824
+ return /* @__PURE__ */ jsxs49(Fragment7, { children: [
5825
+ /* @__PURE__ */ jsxs49(
5826
+ "tr",
5625
5827
  {
5828
+ onClick: onRowClick ? (e) => rowClickCounts(e) && onRowClick(row) : canOpen ? (e) => rowClickCounts(e) && toggle(key) : void 0,
5626
5829
  className: cn(
5627
- "border-b border-border-default",
5628
- pad2,
5629
- align(c),
5630
- right(c) && "tabular-nums",
5631
- c.rank && "text-text-tertiary",
5632
- isOpen && "border-b-0"
5830
+ "group/row hover:bg-subtle [&:last-child>td]:border-b-0",
5831
+ clickable && "cursor-pointer",
5832
+ panelOpen && "bg-subtle"
5833
+ // The row's hidden open button has keyboard focus: ring the whole row.
5633
5834
  ),
5634
- children: renderCell(c, row)
5635
- },
5636
- c.key
5637
- ))
5638
- ]
5639
- }
5640
- ),
5641
- isOpen && /* @__PURE__ */ jsx55("tr", { className: "[&:last-child>td]:border-b-0", children: /* @__PURE__ */ jsx55("td", { id: panelId, colSpan: span, className: "border-b border-border-default bg-subtle px-4 pb-4 pl-14", children: renderExpanded(row) }) })
5642
- ] }, key);
5643
- }) })
5644
- ]
5835
+ children: [
5836
+ selectable && /* @__PURE__ */ jsx55(
5837
+ "td",
5838
+ {
5839
+ onPointerDownCapture: (e) => shiftHeld.current = e.shiftKey,
5840
+ onKeyDownCapture: (e) => shiftHeld.current = e.shiftKey,
5841
+ className: cn("border-b border-border-default pr-0", pad2, panelOpen && "border-b-0", rowBg, ringCls("select"), pinCls("select", "body", rowBg)),
5842
+ style: pinStyle("select"),
5843
+ children: reason ? /* @__PURE__ */ jsx55(Tooltip, { label: reason, delay: 300, className: "inline-flex align-middle", children: /* @__PURE__ */ jsx55(
5844
+ "button",
5845
+ {
5846
+ type: "button",
5847
+ role: "checkbox",
5848
+ "aria-checked": ticked,
5849
+ "aria-disabled": "true",
5850
+ "aria-label": `Select ${label}`,
5851
+ onClick: (e) => e.preventDefault(),
5852
+ className: "flex cursor-not-allowed rounded-small focus-visible:outline-solid focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-border-focus",
5853
+ children: /* @__PURE__ */ jsx55(CheckBoxBox, { checked: ticked, disabled: true })
5854
+ }
5855
+ ) }) : /* @__PURE__ */ jsx55(CheckBox, { checked: ticked, onChange: () => togglePick(ri), ariaLabel: `Select ${label}` })
5856
+ }
5857
+ ),
5858
+ anyExpandable && /* @__PURE__ */ jsx55(
5859
+ "td",
5860
+ {
5861
+ className: cn("border-b border-border-default pr-0", pad2, panelOpen && "border-b-0", rowBg, ringCls("expand"), pinCls("expand", "body", rowBg)),
5862
+ style: pinStyle("expand"),
5863
+ children: canOpen && /* @__PURE__ */ jsx55(
5864
+ "button",
5865
+ {
5866
+ type: "button",
5867
+ "aria-expanded": isOpen,
5868
+ "aria-controls": isOpen ? kids ? kidIds.join(" ") : panelId : void 0,
5869
+ "aria-label": kids ? `${isOpen ? "Hide" : "Show"} ${kids.length} ${kids.length === 1 ? subRowNoun.one : subRowNoun.other}${rowLabel ? ` under ${rowLabel(row)}` : ""}` : `${isOpen ? "Hide" : "Show"} details${rowLabel ? ` for ${rowLabel(row)}` : ""}`,
5870
+ onClick: () => toggle(key),
5871
+ className: "flex size-6 items-center justify-center rounded-control text-text-tertiary hover:text-text-primary focus-visible:outline-solid focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-border-focus",
5872
+ children: /* @__PURE__ */ jsx55(
5873
+ ChevronRight6,
5874
+ {
5875
+ size: 16,
5876
+ "aria-hidden": "true",
5877
+ className: cn("transition-transform motion-reduce:transition-none", isOpen && "rotate-90")
5878
+ }
5879
+ )
5880
+ }
5881
+ )
5882
+ }
5883
+ ),
5884
+ columns.map((c, ci) => {
5885
+ const bg = colBg(c, rowBg);
5886
+ const opener = !!onRowClick && ci === nameIdx;
5887
+ return /* @__PURE__ */ jsxs49(
5888
+ "td",
5889
+ {
5890
+ className: cn(
5891
+ "border-b border-border-default",
5892
+ pad2,
5893
+ align(c),
5894
+ right(c) && "tabular-nums",
5895
+ c.rank && "text-text-tertiary",
5896
+ panelOpen && "border-b-0",
5897
+ ringCls(ci),
5898
+ bg,
5899
+ pinCls(ci, "body", bg)
5900
+ ),
5901
+ style: pinStyle(ci),
5902
+ children: [
5903
+ fit(ci, renderCell(c, row)),
5904
+ opener && // The keyboard's and screen reader's way to the row click. It
5905
+ // stays hidden; while it has focus the whole row takes the ring.
5906
+ /* @__PURE__ */ jsx55("button", { type: "button", "data-row-open": "", onClick: () => onRowClick(row), className: "sr-only", children: rowClickLabel ? rowClickLabel(row) : `Open ${rowLabel ? rowLabel(row) : "row"}` }),
5907
+ edge(ci)
5908
+ ]
5909
+ },
5910
+ c.key
5911
+ );
5912
+ })
5913
+ ]
5914
+ }
5915
+ ),
5916
+ panelOpen && /* @__PURE__ */ jsx55("tr", { className: "[&:last-child>td]:border-b-0", children: /* @__PURE__ */ jsx55("td", { id: panelId, colSpan: span, className: "border-b border-border-default bg-subtle px-4 pb-4 pl-14", children: renderExpanded(row) }) }),
5917
+ isOpen && kids?.map(
5918
+ (child, si) => plainRow("sub", child, `${key}::${rowKey(child)}`, highlightRow?.(child) ? TINT : "bg-subtle", { id: kidIds[si], parent: row })
5919
+ )
5920
+ ] }, key);
5921
+ })
5922
+ ] }) })
5923
+ ]
5924
+ }
5925
+ )
5645
5926
  }
5646
- ) }),
5927
+ ),
5647
5928
  refreshing && !loading && /* @__PURE__ */ jsx55(RefreshLine, {}),
5648
5929
  /* @__PURE__ */ jsx55(LongWait, { loading, onRetry, className: "mb-3 px-4" }),
5649
5930
  footer && /* @__PURE__ */ jsx55("div", { className: "border-t border-border-default px-4 py-3", children: footer })
5650
5931
  ]
5651
5932
  }
5652
5933
  );
5653
- if (!title || inside) return frame;
5654
- return /* @__PURE__ */ jsxs49("section", { "aria-labelledby": titleId, className: cn("flex w-full flex-col gap-3", className), children: [
5655
- /* @__PURE__ */ jsx55(SectionHeading, { id: titleId, as: titleAs, title, description: subtitle, actions: action }),
5934
+ if (inside || !title && barCount === 0) return frame;
5935
+ return /* @__PURE__ */ jsxs49("section", { "aria-labelledby": title ? titleId : void 0, className: cn("flex w-full flex-col gap-3", className), children: [
5936
+ title ? /* @__PURE__ */ jsx55(SectionHeading, { id: titleId, as: titleAs, title, description: subtitle, actions: bar ?? action }) : /* @__PURE__ */ jsx55("div", { className: "flex justify-end", children: bar }),
5656
5937
  frame
5657
5938
  ] });
5658
5939
  }
@@ -5736,13 +6017,13 @@ var ToggleChip = forwardRef11(function ToggleChip2({ selected, onChange, childre
5736
6017
  ToggleChip.displayName = "ToggleChip";
5737
6018
 
5738
6019
  // src/CopyButton.tsx
5739
- import { forwardRef as forwardRef12, useEffect as useEffect18, useRef as useRef19, useState as useState19 } from "react";
6020
+ import { forwardRef as forwardRef12, useEffect as useEffect18, useRef as useRef20, useState as useState19 } from "react";
5740
6021
  import { Check as Check10, Copy } from "lucide-react";
5741
6022
  import { jsx as jsx59, jsxs as jsxs51 } from "react/jsx-runtime";
5742
6023
  var CONFIRM_MS = 2e3;
5743
6024
  var CopyButton = forwardRef12(function CopyButton2({ value, label, "aria-label": ariaLabel, size = "xs", className, testIdPrefix }, ref) {
5744
6025
  const [copied, setCopied] = useState19(false);
5745
- const timer = useRef19(void 0);
6026
+ const timer = useRef20(void 0);
5746
6027
  useEffect18(() => () => clearTimeout(timer.current), []);
5747
6028
  const copy = async () => {
5748
6029
  try {
@@ -5826,7 +6107,7 @@ function InlineMessage({ tone = "info", title, children, actions, onDismiss, cla
5826
6107
  }
5827
6108
 
5828
6109
  // src/FilterDrawer.tsx
5829
- import { useEffect as useEffect19, useLayoutEffect as useLayoutEffect6, useRef as useRef20, useState as useState20 } from "react";
6110
+ import { useEffect as useEffect19, useLayoutEffect as useLayoutEffect6, useRef as useRef21, useState as useState20 } from "react";
5830
6111
  import { ChevronLeft as ChevronLeft5, ChevronRight as ChevronRight7 } from "lucide-react";
5831
6112
  import { jsx as jsx61, jsxs as jsxs53 } from "react/jsx-runtime";
5832
6113
  var SLIDE_MS = 200;
@@ -5874,9 +6155,9 @@ function FilterDrawer({
5874
6155
  const t = setTimeout(() => setLeaving(null), SLIDE_MS);
5875
6156
  return () => clearTimeout(t);
5876
6157
  }, [leaving, phase]);
5877
- const backRef = useRef20(null);
5878
- const rowRefs = useRef20(/* @__PURE__ */ new Map());
5879
- const lastView = useRef20(null);
6158
+ const backRef = useRef21(null);
6159
+ const rowRefs = useRef21(/* @__PURE__ */ new Map());
6160
+ const lastView = useRef21(null);
5880
6161
  useEffect19(() => {
5881
6162
  if (!open) return;
5882
6163
  if (view) backRef.current?.focus();
@@ -6028,7 +6309,7 @@ var AllFiltersButton = forwardRef13(function AllFiltersButton2({ count = 0, open
6028
6309
  import { forwardRef as forwardRef14 } from "react";
6029
6310
  import { Slot as Slot2, Slottable } from "@radix-ui/react-slot";
6030
6311
  import { Check as Check11, ChevronRight as ChevronRight8 } from "lucide-react";
6031
- import { Fragment as Fragment8, jsx as jsx63, jsxs as jsxs55 } from "react/jsx-runtime";
6312
+ import { Fragment as Fragment9, jsx as jsx63, jsxs as jsxs55 } from "react/jsx-runtime";
6032
6313
  var ROW_SELECTOR = '[role^="menuitem"]:not([aria-disabled="true"]):not(:disabled)';
6033
6314
  function moveFocus(e) {
6034
6315
  const keys = ["ArrowDown", "ArrowUp", "Home", "End"];
@@ -6062,7 +6343,7 @@ var MenuItem = forwardRef14(
6062
6343
  ({ className, testIdPrefix, icon, trailing, description, submenu, checked, danger, disabled, asChild = false, children, ...props }, ref) => {
6063
6344
  const Comp = asChild ? Slot2 : "button";
6064
6345
  const radio = checked !== void 0;
6065
- const body = /* @__PURE__ */ jsxs55(Fragment8, { children: [
6346
+ const body = /* @__PURE__ */ jsxs55(Fragment9, { children: [
6066
6347
  icon && /* @__PURE__ */ jsx63("span", { "aria-hidden": "true", className: cn("flex shrink-0", danger ? "text-text-danger" : "text-text-secondary"), children: icon }),
6067
6348
  asChild ? (
6068
6349
  // The link's own text lands here; the link becomes the row.
@@ -6227,12 +6508,12 @@ function defaultDateOrder(country) {
6227
6508
  }
6228
6509
 
6229
6510
  // src/Figure.tsx
6230
- import { Fragment as Fragment9, jsx as jsx64, jsxs as jsxs56 } from "react/jsx-runtime";
6511
+ import { Fragment as Fragment10, jsx as jsx64, jsxs as jsxs56 } from "react/jsx-runtime";
6231
6512
  function Figure({ value, kind = "money", missing, ...opts }) {
6232
6513
  if (value === null || value === void 0 || Number.isNaN(value)) return /* @__PURE__ */ jsx64(NoValue, { reason: missing });
6233
6514
  const short = kind === "money" ? formatMoney(value, opts) : formatCount(value, opts);
6234
6515
  const full = kind === "money" ? formatMoneyFull(value, opts) : formatCountFull(value);
6235
- if (short === full) return /* @__PURE__ */ jsx64(Fragment9, { children: short });
6516
+ if (short === full) return /* @__PURE__ */ jsx64(Fragment10, { children: short });
6236
6517
  return /* @__PURE__ */ jsxs56(Tooltip, { label: full, delay: 300, children: [
6237
6518
  /* @__PURE__ */ jsx64("span", { "aria-hidden": "true", children: short }),
6238
6519
  /* @__PURE__ */ jsx64("span", { className: "sr-only", children: full })