@mediaradar/design-components 0.33.0 → 0.35.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
@@ -554,7 +554,7 @@ import { Check as Check2, Minus } from "lucide-react";
554
554
  import { jsx as jsx7 } from "react/jsx-runtime";
555
555
  function boxClass(on, disabled) {
556
556
  return cn(
557
- "flex h-[18px] w-[18px] shrink-0 items-center justify-center rounded-[5px] border transition-colors",
557
+ "flex size-4.5 shrink-0 items-center justify-center rounded-small border transition-colors",
558
558
  on ? "border-transparent bg-brand-primaryAction text-brand-onprimary" : "border-border-interactive bg-input",
559
559
  disabled && "cursor-not-allowed opacity-50"
560
560
  );
@@ -608,7 +608,7 @@ function CheckBoxBox({ checked, indeterminate, disabled, className }) {
608
608
  }
609
609
 
610
610
  // src/DateRangeFilter.tsx
611
- import { useEffect as useEffect3, useLayoutEffect, useMemo as useMemo2, useRef as useRef3, useState as useState3 } from "react";
611
+ import { useEffect as useEffect3, useId as useId2, useLayoutEffect, useMemo as useMemo2, useRef as useRef3, useState as useState3 } from "react";
612
612
  import { ChevronDown as ChevronDown2, ChevronLeft, ChevronRight } from "lucide-react";
613
613
  import { jsx as jsx8, jsxs as jsxs7 } from "react/jsx-runtime";
614
614
  var DEFAULT_SHORTCUTS = [
@@ -636,6 +636,7 @@ var CREATIVE_INTEL_SHORTCUTS = [
636
636
  "All available history",
637
637
  "Custom"
638
638
  ];
639
+ var HIDDEN_SHORTCUTS = ["Last 30 days"];
639
640
  var WEEKDAYS = ["Mo", "Tu", "We", "Th", "Fr", "Sa", "Su"];
640
641
  var MONTHS = [
641
642
  "January",
@@ -666,6 +667,20 @@ var fmt = (d) => `${MONTHS[d.getMonth()].slice(0, 3)} ${d.getDate()}, ${d.getFul
666
667
  var fmtFull = (d) => `${MONTHS[d.getMonth()]} ${d.getDate()}, ${d.getFullYear()}`;
667
668
  var fullRangeLabel = (s, e) => `${fmtFull(s)} - ${fmtFull(e)}`;
668
669
  var presetLabel = (sc) => sc === "Custom" ? "Custom range" : sc;
670
+ var MON = (d) => MONTHS[d.getMonth()].slice(0, 3);
671
+ function spanLabel(s, e) {
672
+ if (s.getFullYear() !== e.getFullYear()) return `${fmt(s)} \u2013 ${fmt(e)}`;
673
+ if (s.getMonth() !== e.getMonth()) return `${MON(s)} ${s.getDate()} \u2013 ${MON(e)} ${e.getDate()}, ${e.getFullYear()}`;
674
+ return s.getDate() === e.getDate() ? fmt(s) : `${MON(s)} ${s.getDate()} \u2013 ${e.getDate()}, ${e.getFullYear()}`;
675
+ }
676
+ function compareSpan(s, e, mode) {
677
+ if (mode === "year") {
678
+ const back = (d) => new Date(d.getFullYear() - 1, d.getMonth(), d.getDate());
679
+ return [back(s), back(e)];
680
+ }
681
+ const days = Math.round((startOfDay(e).getTime() - startOfDay(s).getTime()) / 864e5) + 1;
682
+ return [addDays(s, -days), addDays(s, -1)];
683
+ }
669
684
  function presetRange(key, today) {
670
685
  const t = startOfDay(today);
671
686
  const qMonth = Math.floor(t.getMonth() / 3) * 3;
@@ -702,6 +717,8 @@ function presetRange(key, today) {
702
717
  return [addDays(t, -6), t];
703
718
  case "Last 14 days":
704
719
  return [addDays(t, -13), t];
720
+ case "Last 30 days":
721
+ return [addDays(t, -29), t];
705
722
  case "Last month": {
706
723
  const s = new Date(t.getFullYear(), t.getMonth() - 1, 1);
707
724
  const e = new Date(t.getFullYear(), t.getMonth(), 0);
@@ -723,7 +740,7 @@ function monthGrid(year, month) {
723
740
  }
724
741
  function matchShortcut(shortcuts, label) {
725
742
  if (!label) return "Rolling 12 months";
726
- const hit = shortcuts.find((s) => s.toLowerCase() === label.toLowerCase());
743
+ const hit = [...shortcuts, ...HIDDEN_SHORTCUTS].find((s) => s.toLowerCase() === label.toLowerCase());
727
744
  return hit || "Custom";
728
745
  }
729
746
  function slug2(value) {
@@ -742,23 +759,43 @@ function DateRangeFilter({
742
759
  shortDates = false,
743
760
  icon,
744
761
  presetSet = "default",
762
+ excludePresets = [],
763
+ emptyLabel,
764
+ today: todayProp,
765
+ initialRange,
766
+ compare,
767
+ onApply,
745
768
  testIdPrefix,
746
769
  granularity = "day"
747
770
  }) {
748
771
  const monthly = granularity === "month";
749
772
  const snap = (s, e) => monthly ? [firstOfMonth(s), lastOfMonth(e)] : [s, e];
750
773
  const controlled = controlledValue !== void 0 && controlledRange !== void 0;
751
- const SHORTCUTS = presetSet === "creativeIntel" ? CREATIVE_INTEL_SHORTCUTS : DEFAULT_SHORTCUTS;
752
- const today = useMemo2(() => /* @__PURE__ */ new Date(), []);
774
+ const startsEmpty = !controlled && !!emptyLabel;
775
+ const SHORTCUTS = (presetSet === "creativeIntel" ? CREATIVE_INTEL_SHORTCUTS : DEFAULT_SHORTCUTS).filter(
776
+ (s) => !excludePresets.includes(s)
777
+ );
778
+ const today = useMemo2(() => todayProp ?? /* @__PURE__ */ new Date(), []);
753
779
  const initShortcut = matchShortcut(SHORTCUTS, controlled ? controlledValue : defaultValue);
754
- const initRange = controlled ? controlledRange : snap(...presetRange(initShortcut === "Custom" ? "Rolling 12 months" : initShortcut, today));
780
+ const initRange = controlled ? controlledRange : initShortcut === "Custom" && initialRange ? snap(...initialRange) : snap(...presetRange(initShortcut === "Custom" ? "Rolling 12 months" : initShortcut, today));
781
+ const compareLabel = (id) => compare?.options.find((o) => o.id === id)?.label;
755
782
  const dateLine = (s, e) => monthly ? `${fmtMonth(s)} \u2013 ${fmtMonth(e)}` : shortDates ? `${fmt(s)} \u2013 ${fmt(e)}` : fullRangeLabel(s, e);
756
783
  const [open, setOpen] = useState3(false);
757
784
  const [uncontrolledValue, setUncontrolledValue] = useState3(
758
- showDates ? presetLabel(initShortcut) : defaultValue || "Last 7 days"
785
+ startsEmpty ? emptyLabel : showDates ? presetLabel(initShortcut) : defaultValue || "Last 7 days"
759
786
  );
760
- const [uncontrolledDatesLine, setUncontrolledDatesLine] = useState3(dateLine(initRange[0], initRange[1]));
761
- const committed = useRef3({ shortcut: initShortcut, start: initRange[0], end: initRange[1] });
787
+ const [uncontrolledDatesLine, setUncontrolledDatesLine] = useState3(
788
+ startsEmpty ? null : dateLine(initRange[0], initRange[1])
789
+ );
790
+ const committed = useRef3({ shortcut: initShortcut, start: initRange[0], end: initRange[1], set: !startsEmpty });
791
+ const [cmp, setCmp] = useState3(compare?.value);
792
+ const committedCmp = useRef3(compare?.value);
793
+ const [appliedCmp, setAppliedCmp] = useState3(compare?.value);
794
+ useEffect3(() => {
795
+ committedCmp.current = compare?.value;
796
+ setAppliedCmp(compare?.value);
797
+ }, [compare?.value]);
798
+ const compareName = `${useId2()}-compare`;
762
799
  const displayValue = controlled ? showDates ? presetLabel(initShortcut) : controlledValue : uncontrolledValue;
763
800
  const displayDatesLine = controlled ? dateLine(initRange[0], initRange[1]) : uncontrolledDatesLine;
764
801
  const [shortcut, setShortcut] = useState3(initShortcut);
@@ -767,7 +804,7 @@ function DateRangeFilter({
767
804
  const [leftMonth, setLeftMonth] = useState3(new Date(initRange[0].getFullYear(), initRange[0].getMonth(), 1));
768
805
  const ref = useRef3(null);
769
806
  useEffect3(() => {
770
- if (controlled) return;
807
+ if (controlled || startsEmpty) return;
771
808
  onRangeChange?.(committed.current.start, committed.current.end);
772
809
  }, []);
773
810
  useEffect3(() => {
@@ -775,10 +812,12 @@ function DateRangeFilter({
775
812
  const committedShortcut = controlled ? initShortcut : committed.current.shortcut;
776
813
  const committedStart = controlled ? initRange[0] : committed.current.start;
777
814
  const committedEnd = controlled ? initRange[1] : committed.current.end;
815
+ const hasRange = controlled || committed.current.set;
778
816
  setShortcut(committedShortcut);
779
- setStart(committedStart);
780
- setEnd(committedEnd);
781
- setLeftMonth(new Date(committedStart.getFullYear(), committedStart.getMonth(), 1));
817
+ setStart(hasRange ? committedStart : null);
818
+ setEnd(hasRange ? committedEnd : null);
819
+ setLeftMonth(hasRange ? new Date(committedStart.getFullYear(), committedStart.getMonth(), 1) : addMonths(today, -1));
820
+ setCmp(committedCmp.current);
782
821
  const onKey = (e) => e.key === "Escape" && setOpen(false);
783
822
  const onClick = (e) => {
784
823
  if (ref.current && !ref.current.contains(e.target)) setOpen(false);
@@ -812,17 +851,22 @@ function DateRangeFilter({
812
851
  setEnd(e);
813
852
  } else setEnd(monthly ? lastOfMonth(d) : d);
814
853
  };
854
+ const canApply = !!start || controlled || committed.current.set;
815
855
  const apply = () => {
856
+ if (!canApply) return;
816
857
  const [s, e] = snap(start || initRange[0], end || start || initRange[0]);
817
858
  const custom = monthly ? `${fmtMonth(s)} \u2014 ${fmtMonth(e)}` : `${fmt(s)} \u2014 ${fmt(e)}`;
818
859
  const v = showDates ? presetLabel(shortcut) : shortcut === "Custom" ? custom : shortcut;
819
860
  if (!controlled) {
820
- committed.current = { shortcut, start: s, end: e };
861
+ committed.current = { shortcut, start: s, end: e, set: true };
821
862
  setUncontrolledValue(v);
822
863
  setUncontrolledDatesLine(dateLine(s, e));
823
864
  }
865
+ committedCmp.current = cmp;
866
+ setAppliedCmp(cmp);
824
867
  onChange?.(v);
825
868
  onRangeChange?.(s, e);
869
+ onApply?.(shortcut === "Custom" ? `${fmt(s)} \u2013 ${fmt(e)}` : shortcut, s, e, cmp);
826
870
  setOpen(false);
827
871
  };
828
872
  const popRef = useRef3(null);
@@ -844,8 +888,14 @@ function DateRangeFilter({
844
888
  children: [
845
889
  icon && /* @__PURE__ */ jsx8("span", { className: "shrink-0 text-text-tertiary", children: icon }),
846
890
  /* @__PURE__ */ jsxs7("span", { className: "flex flex-col gap-1 text-left leading-none", children: [
847
- /* @__PURE__ */ jsx8("span", { className: showDates ? "text-[11px] text-text-tertiary" : "text-control-caption uppercase tracking-wide text-text-tertiary", children: showDates ? displayDatesLine : caption }),
848
- /* @__PURE__ */ jsx8("span", { className: "text-[12px] font-medium text-text-primary", children: displayValue })
891
+ /* @__PURE__ */ jsx8("span", { className: showDates && displayDatesLine ? "text-[11px] text-text-tertiary" : "text-control-caption uppercase tracking-wide text-text-tertiary", children: showDates && displayDatesLine ? displayDatesLine : caption }),
892
+ /* @__PURE__ */ jsxs7("span", { className: "text-[12px] font-medium text-text-primary", children: [
893
+ displayValue,
894
+ compareLabel(appliedCmp) && /* @__PURE__ */ jsxs7("span", { className: "font-normal text-text-secondary", children: [
895
+ " \xB7 vs ",
896
+ compareLabel(appliedCmp).toLowerCase()
897
+ ] })
898
+ ] })
849
899
  ] }),
850
900
  /* @__PURE__ */ jsx8(ChevronDown2, { size: 14, "aria-hidden": "true", className: `shrink-0 text-text-secondary transition-transform ${open ? "rotate-180" : ""}` })
851
901
  ]
@@ -921,10 +971,39 @@ function DateRangeFilter({
921
971
  ] })
922
972
  ] }, offset);
923
973
  }) }),
974
+ compare && /* @__PURE__ */ jsxs7("fieldset", { className: "mt-4 border-t border-border-default pt-4", children: [
975
+ /* @__PURE__ */ jsx8("legend", { className: "float-left mb-2 w-full text-xs font-medium text-text-secondary", children: "Compare to" }),
976
+ /* @__PURE__ */ jsx8("div", { className: "clear-left flex flex-col gap-1", children: compare.options.map((o) => {
977
+ const on = (cmp ?? compare.value) === o.id;
978
+ return /* @__PURE__ */ jsxs7(
979
+ "label",
980
+ {
981
+ 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"}`,
982
+ children: [
983
+ /* @__PURE__ */ jsx8(
984
+ "input",
985
+ {
986
+ type: "radio",
987
+ name: compareName,
988
+ value: o.id,
989
+ checked: on,
990
+ onChange: () => setCmp(o.id),
991
+ "data-testid": testIdPrefix && `${testIdPrefix}-compare-${slug2(o.id)}`,
992
+ className: "h-4 w-4 accent-brand-primaryAction"
993
+ }
994
+ ),
995
+ /* @__PURE__ */ jsx8("span", { className: `w-44 shrink-0 ${on ? "font-semibold text-text-primary" : "text-text-secondary"}`, children: o.label }),
996
+ start && /* @__PURE__ */ jsx8("span", { className: "tabular-nums text-text-tertiary", children: spanLabel(...compareSpan(start, end ?? start, o.id)) })
997
+ ]
998
+ },
999
+ o.id
1000
+ );
1001
+ }) })
1002
+ ] }),
924
1003
  /* @__PURE__ */ jsxs7("div", { className: "mt-4 flex items-center justify-end gap-2", children: [
925
1004
  monthly && /* @__PURE__ */ jsx8("span", { className: "mr-auto text-xs text-text-tertiary", children: "Data is monthly, so ranges cover whole months." }),
926
1005
  /* @__PURE__ */ jsx8("button", { type: "button", "data-testid": testIdPrefix && `${testIdPrefix}-cancel`, onClick: () => setOpen(false), className: "rounded-control border border-border-default bg-surface px-5 py-2 text-[13px] font-semibold text-text-primary transition-colors hover:bg-subtle", children: "Cancel" }),
927
- /* @__PURE__ */ jsx8("button", { type: "button", "data-testid": testIdPrefix && `${testIdPrefix}-apply`, onClick: apply, className: "rounded-control bg-brand-primaryAction px-5 py-2 text-[13px] font-semibold text-brand-onprimary transition-[filter] hover:brightness-110", children: "Apply" })
1006
+ /* @__PURE__ */ jsx8("button", { type: "button", "data-testid": testIdPrefix && `${testIdPrefix}-apply`, onClick: apply, disabled: !canApply, className: "rounded-control bg-brand-primaryAction px-5 py-2 text-[13px] font-semibold text-brand-onprimary transition-[filter] hover:brightness-110 disabled:cursor-not-allowed disabled:opacity-50", children: "Apply" })
928
1007
  ] })
929
1008
  ] })
930
1009
  ]
@@ -943,7 +1022,7 @@ function NavBtn({ children, onClick, ...rest }) {
943
1022
  }
944
1023
 
945
1024
  // src/SearchBar.tsx
946
- import { useEffect as useEffect4, useId as useId2, useRef as useRef4, useState as useState4 } from "react";
1025
+ import { useEffect as useEffect4, useId as useId3, useRef as useRef4, useState as useState4 } from "react";
947
1026
  import { AlertCircle, Check as Check3, ChevronDown as ChevronDown3, Search as Search3, X as X2 } from "lucide-react";
948
1027
  import { Fragment as Fragment3, jsx as jsx9, jsxs as jsxs8 } from "react/jsx-runtime";
949
1028
  var HEIGHT = { sm: "h-8", md: "h-10", lg: "h-11" };
@@ -1223,7 +1302,7 @@ function RadioOption({
1223
1302
  }
1224
1303
  function RowInfoTip({ text }) {
1225
1304
  const [open, setOpen] = useState4(false);
1226
- const id = useId2();
1305
+ const id = useId3();
1227
1306
  const ref = useRef4(null);
1228
1307
  useEffect4(() => {
1229
1308
  if (!open) return;
@@ -1283,7 +1362,7 @@ function SectionRail({
1283
1362
  /* @__PURE__ */ jsx10(
1284
1363
  "h2",
1285
1364
  {
1286
- className: titleSerif ? "font-serif text-2xl font-normal tracking-tight text-text-primary sm:text-[28px]" : "text-xl font-medium tracking-tight text-text-primary sm:text-2xl",
1365
+ className: titleSerif ? "font-serif text-xl font-normal tracking-tight text-text-primary" : "text-xl font-medium tracking-tight text-text-primary",
1287
1366
  children: title
1288
1367
  }
1289
1368
  ),
@@ -1327,7 +1406,7 @@ function SectionRail({
1327
1406
  "div",
1328
1407
  {
1329
1408
  ref: scrollRef,
1330
- className: "flex gap-4 overflow-x-auto scroll-smooth pb-2 snap-x snap-mandatory scrollbar-none [&::-webkit-scrollbar]:hidden -mx-4 px-4 sm:mx-0 sm:px-0 *:w-[268px] *:shrink-0 *:snap-start lg:grid lg:grid-cols-[repeat(4,minmax(0,320px))] lg:gap-5 lg:overflow-visible lg:justify-start lg:*:w-auto lg:*:shrink lg:*:snap-none",
1409
+ className: "flex gap-4 overflow-x-auto scroll-smooth pb-2 snap-x snap-mandatory scrollbar-none [&::-webkit-scrollbar]:hidden -mx-4 px-4 sm:mx-0 sm:px-0 *:w-67 *:shrink-0 *:snap-start lg:grid lg:grid-cols-[repeat(4,minmax(0,320px))] lg:gap-5 lg:overflow-visible lg:justify-start lg:*:w-auto lg:*:shrink lg:*:snap-none",
1331
1410
  children
1332
1411
  }
1333
1412
  )
@@ -1745,12 +1824,12 @@ function SummaryGroupItem({
1745
1824
  className: cx5("shrink-0 text-text-secondary transition-transform", !open && "-rotate-90")
1746
1825
  }
1747
1826
  ),
1748
- /* @__PURE__ */ jsx16("span", { className: cx5("truncate font-semibold text-text-primary", nested ? "text-[12px]" : "text-[13px]"), children: group.label }),
1749
- /* @__PURE__ */ jsx16("span", { className: "shrink-0 rounded-full bg-subtle px-1.5 py-0.5 text-[11px] font-semibold text-text-secondary", children: ownCount })
1827
+ /* @__PURE__ */ jsx16("span", { className: cx5("truncate font-semibold text-text-primary", nested ? "text-xs" : "text-dense"), children: group.label }),
1828
+ /* @__PURE__ */ jsx16("span", { className: "shrink-0 rounded-full bg-subtle px-1.5 py-0.5 text-micro font-semibold text-text-secondary", children: ownCount })
1750
1829
  ]
1751
1830
  }
1752
1831
  ),
1753
- open && /* @__PURE__ */ jsx16("div", { className: "pt-2.5", children: ownCount === 0 && subCount === 0 ? /* @__PURE__ */ jsx16("p", { className: "text-[12px] text-text-secondary", children: "Nothing selected." }) : /* @__PURE__ */ jsxs15("div", { className: "flex flex-col gap-2.5", children: [
1832
+ open && /* @__PURE__ */ jsx16("div", { className: "pt-2.5", children: ownCount === 0 && subCount === 0 ? /* @__PURE__ */ jsx16("p", { className: "text-xs text-text-secondary", children: "Nothing selected." }) : /* @__PURE__ */ jsxs15("div", { className: "flex flex-col gap-2.5", children: [
1754
1833
  ownCount > 0 && /* @__PURE__ */ jsxs15("div", { className: "flex flex-col gap-1.5", children: [
1755
1834
  group.items.map((item) => /* @__PURE__ */ jsxs15(
1756
1835
  "div",
@@ -1758,8 +1837,8 @@ function SummaryGroupItem({
1758
1837
  className: "flex items-center justify-between gap-2 rounded-control border border-border-default bg-canvas px-2 py-1",
1759
1838
  children: [
1760
1839
  /* @__PURE__ */ jsxs15("span", { className: "min-w-0 flex-1", children: [
1761
- /* @__PURE__ */ jsx16("span", { className: "block truncate text-[12px] text-text-primary", children: item.name }),
1762
- item.meta && /* @__PURE__ */ jsx16("span", { className: "block truncate text-[11px] text-text-secondary", children: item.meta })
1840
+ /* @__PURE__ */ jsx16("span", { className: "block truncate text-xs text-text-primary", children: item.name }),
1841
+ item.meta && /* @__PURE__ */ jsx16("span", { className: "block truncate text-micro text-text-secondary", children: item.meta })
1763
1842
  ] }),
1764
1843
  /* @__PURE__ */ jsx16(
1765
1844
  "button",
@@ -1781,7 +1860,7 @@ function SummaryGroupItem({
1781
1860
  type: "button",
1782
1861
  onClick: group.onRemoveAll,
1783
1862
  "data-testid": testIdPrefix && `${testIdPrefix}-remove-all-${group.id}`,
1784
- className: "mt-0.5 self-start text-[11px] font-medium text-text-link hover:underline",
1863
+ className: "mt-0.5 self-start text-micro font-medium text-text-link hover:underline",
1785
1864
  children: "Remove all"
1786
1865
  }
1787
1866
  )
@@ -1862,7 +1941,7 @@ function BlankLegend({ rows, reverse = false }) {
1862
1941
  import { jsx as jsx18 } from "react/jsx-runtime";
1863
1942
  var BAR_PROFILE = [92, 86, 76, 65, 57, 40, 30, 24, 18, 13];
1864
1943
  function BarChartPlaceholder({ height = 220 }) {
1865
- return /* @__PURE__ */ jsx18(AxisFrame, { height, xTicks: BAR_PROFILE.length, children: /* @__PURE__ */ jsx18("div", { className: "flex h-full w-full items-end gap-2", children: BAR_PROFILE.map((pct, i) => /* @__PURE__ */ jsx18("div", { className: "flex-1 rounded-t-[3px] bg-subtle", style: { height: `${pct}%` } }, i)) }) });
1944
+ return /* @__PURE__ */ jsx18(AxisFrame, { height, xTicks: BAR_PROFILE.length, children: /* @__PURE__ */ jsx18("div", { className: "flex h-full w-full items-end gap-2", children: BAR_PROFILE.map((pct, i) => /* @__PURE__ */ jsx18("div", { className: "flex-1 rounded-t-small bg-subtle", style: { height: `${pct}%` } }, i)) }) });
1866
1945
  }
1867
1946
 
1868
1947
  // src/LineChartPlaceholder.tsx
@@ -1982,7 +2061,7 @@ function StackedColumnPlaceholder({
1982
2061
  }
1983
2062
 
1984
2063
  // src/Tooltip.tsx
1985
- import { useEffect as useEffect8, useId as useId3, useLayoutEffect as useLayoutEffect3, useRef as useRef9, useState as useState8 } from "react";
2064
+ import { useEffect as useEffect8, useId as useId4, useLayoutEffect as useLayoutEffect3, useRef as useRef9, useState as useState8 } from "react";
1986
2065
  import { createPortal as createPortal3 } from "react-dom";
1987
2066
  import { jsx as jsx22, jsxs as jsxs20 } from "react/jsx-runtime";
1988
2067
  function cx6(...parts) {
@@ -2033,7 +2112,7 @@ function Tooltip({
2033
2112
  const [shown, setShown] = useState8(false);
2034
2113
  const openRef = useRef9(false);
2035
2114
  const mountedRef = useRef9(false);
2036
- const id = useId3();
2115
+ const id = useId4();
2037
2116
  const describedRef = useRef9(null);
2038
2117
  const clearHideTimer = () => {
2039
2118
  if (hideTimer.current) {
@@ -3012,7 +3091,7 @@ function FilterDropdownFooter({
3012
3091
  }
3013
3092
 
3014
3093
  // src/NameListModal.tsx
3015
- import { useEffect as useEffect10, useId as useId4, useRef as useRef11, useState as useState11 } from "react";
3094
+ import { useEffect as useEffect10, useId as useId5, useRef as useRef11, useState as useState11 } from "react";
3016
3095
  import { createPortal as createPortal5 } from "react-dom";
3017
3096
  import { jsx as jsx30, jsxs as jsxs28 } from "react/jsx-runtime";
3018
3097
  function NameListModal({
@@ -3031,8 +3110,8 @@ function NameListModal({
3031
3110
  );
3032
3111
  const toggle = (key) => setChecked((c) => ({ ...c, [key]: !c[key] }));
3033
3112
  const dialogRef = useRef11(null);
3034
- const titleId = useId4();
3035
- const fieldId = useId4();
3113
+ const titleId = useId5();
3114
+ const fieldId = useId5();
3036
3115
  useEffect10(() => {
3037
3116
  const onKey = (e) => e.key === "Escape" && onCancel();
3038
3117
  window.addEventListener("keydown", onKey);
@@ -3324,11 +3403,12 @@ function workspaceInitials(name) {
3324
3403
  }
3325
3404
  var SIZES = {
3326
3405
  /** Matches a 15px lucide icon exactly, so a workspace name in a menu row
3327
- * left-aligns with labels in icon-led rows above and below it. */
3328
- xs: "h-[15px] w-[15px] rounded-[4px] text-[8px] tracking-tight",
3329
- /** 10px, not text-control-caption: that step is for dropdown captions.
3330
- * Two initials need to sit inside the 24px circle, a step below md. */
3331
- sm: "h-6 w-6 text-[10px]",
3406
+ * left-aligns with labels in icon-led rows above and below it. Shows one
3407
+ * initial: two at the smallest type step (10px) don't fit in 15px. */
3408
+ xs: "size-3.75 rounded-small text-badge",
3409
+ /** text-badge (10px), not text-control-caption: that step is for dropdown
3410
+ * captions. Two initials need to sit inside the 24px tile, a step below md. */
3411
+ sm: "h-6 w-6 text-badge",
3332
3412
  md: "h-7 w-7 text-micro",
3333
3413
  lg: "h-11 w-11 text-panel-title"
3334
3414
  };
@@ -3341,7 +3421,7 @@ function WorkspaceAvatar({ name, size = "md" }) {
3341
3421
  "flex shrink-0 items-center justify-center rounded-control bg-subtle font-semibold leading-none text-text-secondary",
3342
3422
  SIZES[size]
3343
3423
  ),
3344
- children: workspaceInitials(name ?? "All data")
3424
+ children: size === "xs" ? workspaceInitials(name ?? "All data").slice(0, 1) : workspaceInitials(name ?? "All data")
3345
3425
  }
3346
3426
  );
3347
3427
  }
@@ -3444,10 +3524,10 @@ function TablePagination({
3444
3524
  const current = Math.min(page, totalPages);
3445
3525
  const rangeStart = totalItems === 0 ? 0 : (current - 1) * perPage + 1;
3446
3526
  const rangeEnd = Math.min(current * perPage, totalItems);
3447
- const btn = "flex h-8 min-w-8 items-center justify-center rounded-control px-2 text-[13px] transition-colors";
3527
+ const btn = "flex h-8 min-w-8 items-center justify-center rounded-control px-2 text-dense transition-colors";
3448
3528
  const off = "disabled:pointer-events-none disabled:opacity-30";
3449
3529
  const stepBtn = cn(btn, "text-text-secondary hover:bg-subtle hover:text-text-primary", off);
3450
- const range = /* @__PURE__ */ jsxs33("span", { className: "text-[13px] text-text-tertiary tabular-nums", children: [
3530
+ const range = /* @__PURE__ */ jsxs33("span", { className: "text-dense text-text-tertiary tabular-nums", children: [
3451
3531
  rangeStart.toLocaleString(),
3452
3532
  " \u2013 ",
3453
3533
  rangeEnd.toLocaleString(),
@@ -3460,7 +3540,7 @@ function TablePagination({
3460
3540
  /* @__PURE__ */ jsxs33(
3461
3541
  "div",
3462
3542
  {
3463
- className: cn("flex items-center gap-2 text-[13px] text-text-secondary", !onPerPageChange && "invisible"),
3543
+ className: cn("flex items-center gap-2 text-dense text-text-secondary", !onPerPageChange && "invisible"),
3464
3544
  children: [
3465
3545
  /* @__PURE__ */ jsx37(
3466
3546
  SelectFilter,
@@ -3504,7 +3584,7 @@ function TablePagination({
3504
3584
  }
3505
3585
  ),
3506
3586
  pageWindow(current, totalPages).map(
3507
- (p) => typeof p === "string" ? /* @__PURE__ */ jsx37("span", { className: "px-1 text-[13px] text-text-tertiary", children: "\u2026" }, p) : /* @__PURE__ */ jsx37(
3587
+ (p) => typeof p === "string" ? /* @__PURE__ */ jsx37("span", { className: "px-1 text-dense text-text-tertiary", children: "\u2026" }, p) : /* @__PURE__ */ jsx37(
3508
3588
  "button",
3509
3589
  {
3510
3590
  type: "button",
@@ -3585,7 +3665,7 @@ function resolveRange(label, today = startOfToday()) {
3585
3665
  }
3586
3666
  return [new Date(end.getFullYear(), end.getMonth() - 6, 1), end];
3587
3667
  }
3588
- function spanLabel(label, today) {
3668
+ function spanLabel2(label, today) {
3589
3669
  const [s, e] = resolveRange(label, today);
3590
3670
  return `${fmtDate(s)} \u2013 ${fmtDate(e)}`;
3591
3671
  }
@@ -3671,7 +3751,7 @@ function DateRangePicker({
3671
3751
  className: chipTriggerClass(),
3672
3752
  children: [
3673
3753
  /* @__PURE__ */ jsxs34("span", { className: "flex flex-col gap-1 text-left leading-none", children: [
3674
- /* @__PURE__ */ jsx38("span", { className: "text-control-caption text-text-tertiary", children: spanLabel(value, end) }),
3754
+ /* @__PURE__ */ jsx38("span", { className: "text-control-caption text-text-tertiary", children: spanLabel2(value, end) }),
3675
3755
  /* @__PURE__ */ jsx38("span", { className: "text-[12px] font-medium text-text-primary", children: value })
3676
3756
  ] }),
3677
3757
  /* @__PURE__ */ jsx38(ChevronDown9, { size: 14, "aria-hidden": "true", className: cn("shrink-0 text-text-secondary transition-transform", open && "rotate-180") })
@@ -3727,7 +3807,7 @@ function DateRangePicker({
3727
3807
 
3728
3808
  // src/MultiSelectFilter.tsx
3729
3809
  import { useCallback as useCallback4, useEffect as useEffect13, useRef as useRef14, useState as useState14 } from "react";
3730
- import { ChevronDown as ChevronDown10, Check as Check8, Minus as Minus2, Search as Search5, X as X5 } from "lucide-react";
3810
+ import { ChevronDown as ChevronDown10, Search as Search5, X as X5 } from "lucide-react";
3731
3811
  import { Fragment as Fragment5, jsx as jsx39, jsxs as jsxs35 } from "react/jsx-runtime";
3732
3812
  function MultiSelectFilter({
3733
3813
  caption,
@@ -3879,7 +3959,7 @@ function MultiSelectFilter({
3879
3959
  onClick: () => toggleGroup(g),
3880
3960
  className: "flex w-full items-center gap-2.5 rounded-control px-2 py-2 text-left transition-colors hover:bg-subtle",
3881
3961
  children: [
3882
- /* @__PURE__ */ jsx39(TriCheck, { state }),
3962
+ /* @__PURE__ */ jsx39(CheckBoxBox, { checked: state === "all", indeterminate: state === "some" }),
3883
3963
  /* @__PURE__ */ jsx39("span", { className: cn("flex-1 text-[14px] text-text-primary", !plainParent && "font-semibold"), children: g.label }),
3884
3964
  counts && /* @__PURE__ */ jsx39(OptionCount, { n: countFor(g.id) })
3885
3965
  ]
@@ -3894,7 +3974,7 @@ function MultiSelectFilter({
3894
3974
  onClick: () => toggle(c.id),
3895
3975
  className: "flex w-full items-center gap-2.5 rounded-control py-2 pl-9 pr-2 text-left transition-colors hover:bg-subtle",
3896
3976
  children: [
3897
- /* @__PURE__ */ jsx39(TriCheck, { state: checked ? "all" : "none" }),
3977
+ /* @__PURE__ */ jsx39(CheckBoxBox, { checked }),
3898
3978
  /* @__PURE__ */ jsx39("span", { className: "flex-1 text-[14px] text-text-primary", children: c.label }),
3899
3979
  counts && /* @__PURE__ */ jsx39(OptionCount, { n: countFor(c.id) })
3900
3980
  ]
@@ -3912,16 +3992,7 @@ function MultiSelectFilter({
3912
3992
  onClick: () => toggle(o.id),
3913
3993
  className: "flex w-full items-center gap-2.5 rounded-control px-2 py-2 text-left transition-colors hover:bg-subtle",
3914
3994
  children: [
3915
- /* @__PURE__ */ jsx39(
3916
- "span",
3917
- {
3918
- className: cn(
3919
- "flex h-[18px] w-[18px] shrink-0 items-center justify-center rounded-[5px] border transition-colors",
3920
- checked ? "border-transparent bg-brand-primaryAction text-brand-onprimary" : "border-border-interactive bg-input"
3921
- ),
3922
- children: checked && /* @__PURE__ */ jsx39(Check8, { size: 13, strokeWidth: 3 })
3923
- }
3924
- ),
3995
+ /* @__PURE__ */ jsx39(CheckBoxBox, { checked }),
3925
3996
  /* @__PURE__ */ jsx39("span", { className: "flex-1 text-[14px] text-text-primary", children: o.label }),
3926
3997
  counts && /* @__PURE__ */ jsx39(OptionCount, { n: countFor(o.id) })
3927
3998
  ]
@@ -3948,22 +4019,6 @@ function MultiSelectFilter({
3948
4019
  )
3949
4020
  ] });
3950
4021
  }
3951
- function TriCheck({ state }) {
3952
- const filled = state !== "none";
3953
- return /* @__PURE__ */ jsxs35(
3954
- "span",
3955
- {
3956
- className: cn(
3957
- "flex h-[18px] w-[18px] shrink-0 items-center justify-center rounded-[5px] border transition-colors",
3958
- filled ? "border-transparent bg-brand-primaryAction text-brand-onprimary" : "border-border-interactive bg-input"
3959
- ),
3960
- children: [
3961
- state === "all" && /* @__PURE__ */ jsx39(Check8, { size: 13, strokeWidth: 3 }),
3962
- state === "some" && /* @__PURE__ */ jsx39(Minus2, { size: 13, strokeWidth: 3 })
3963
- ]
3964
- }
3965
- );
3966
- }
3967
4022
  function OptionCount({ n }) {
3968
4023
  return /* @__PURE__ */ jsxs35("span", { className: "shrink-0 text-[12px] tabular-nums text-text-tertiary", children: [
3969
4024
  "(",
@@ -4014,11 +4069,11 @@ function Toggle({ checked, onChange, label, size = "md", disabled, className, te
4014
4069
  }
4015
4070
 
4016
4071
  // src/AISpark.tsx
4017
- import { useId as useId5 } from "react";
4072
+ import { useId as useId6 } from "react";
4018
4073
  import { Sparkles } from "lucide-react";
4019
4074
  import { Fragment as Fragment6, jsx as jsx41, jsxs as jsxs36 } from "react/jsx-runtime";
4020
4075
  function AISpark({ size = 16, className }) {
4021
- const id = useId5();
4076
+ const id = useId6();
4022
4077
  return /* @__PURE__ */ jsxs36(Fragment6, { children: [
4023
4078
  /* @__PURE__ */ jsx41("svg", { width: "0", height: "0", "aria-hidden": "true", style: { position: "absolute" }, children: /* @__PURE__ */ jsx41("defs", { children: /* @__PURE__ */ jsxs36("linearGradient", { id, x1: "0", y1: "0", x2: "1", y2: "1", children: [
4024
4079
  /* @__PURE__ */ jsx41("stop", { offset: "0%", stopColor: "var(--mr-color-brand-primary)" }),
@@ -4089,7 +4144,7 @@ function PageHeader({ title, description, actions, back, className }) {
4089
4144
  }
4090
4145
 
4091
4146
  // src/Modal.tsx
4092
- import { useEffect as useEffect14, useId as useId6, useRef as useRef15 } from "react";
4147
+ import { useEffect as useEffect14, useId as useId7, useRef as useRef15 } from "react";
4093
4148
  import { createPortal as createPortal7 } from "react-dom";
4094
4149
  import { X as X6 } from "lucide-react";
4095
4150
  import { jsx as jsx45, jsxs as jsxs39 } from "react/jsx-runtime";
@@ -4103,8 +4158,8 @@ var WIDTH = {
4103
4158
  };
4104
4159
  var FOCUSABLE = 'a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';
4105
4160
  function Modal({ open, onClose, title, description, size = "md", footer, children, className }) {
4106
- const titleId = useId6();
4107
- const descId = useId6();
4161
+ const titleId = useId7();
4162
+ const descId = useId7();
4108
4163
  const panel = useRef15(null);
4109
4164
  const close = useRef15(onClose);
4110
4165
  close.current = onClose;
@@ -4314,12 +4369,12 @@ function SegmentedControl({
4314
4369
  }
4315
4370
 
4316
4371
  // src/TextField.tsx
4317
- import { forwardRef as forwardRef3, useId as useId7 } from "react";
4372
+ import { forwardRef as forwardRef3, useId as useId8 } from "react";
4318
4373
  import { jsx as jsx48, jsxs as jsxs42 } from "react/jsx-runtime";
4319
4374
  var HEIGHT2 = { sm: "h-8", md: "h-10", lg: "h-11" };
4320
4375
  var TextField = forwardRef3(
4321
4376
  ({ label, hint, error, size = "md", icon, className, id, disabled, ...props }, ref) => {
4322
- const auto = useId7();
4377
+ const auto = useId8();
4323
4378
  const fieldId = id ?? auto;
4324
4379
  const noteId = `${fieldId}-note`;
4325
4380
  const note = error ?? hint;
@@ -4358,7 +4413,7 @@ var TextField = forwardRef3(
4358
4413
  TextField.displayName = "TextField";
4359
4414
 
4360
4415
  // src/Drawer.tsx
4361
- import { useEffect as useEffect15, useId as useId8, useRef as useRef17, useState as useState15 } from "react";
4416
+ import { useEffect as useEffect15, useId as useId9, useRef as useRef17, useState as useState15 } from "react";
4362
4417
  import { createPortal as createPortal8 } from "react-dom";
4363
4418
  import { X as X7 } from "lucide-react";
4364
4419
  import { jsx as jsx49, jsxs as jsxs43 } from "react/jsx-runtime";
@@ -4370,8 +4425,8 @@ var WIDTH2 = {
4370
4425
  var EXIT_MS = 200;
4371
4426
  var FOCUSABLE2 = 'a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';
4372
4427
  function Drawer({ open, onClose, title, description, size = "sm", footer, children, className }) {
4373
- const titleId = useId8();
4374
- const descId = useId8();
4428
+ const titleId = useId9();
4429
+ const descId = useId9();
4375
4430
  const panel = useRef17(null);
4376
4431
  const close = useRef17(onClose);
4377
4432
  close.current = onClose;
@@ -4480,7 +4535,7 @@ function Drawer({ open, onClose, title, description, size = "sm", footer, childr
4480
4535
  }
4481
4536
 
4482
4537
  // src/DataTable.tsx
4483
- import { useId as useId9 } from "react";
4538
+ import { useId as useId10 } from "react";
4484
4539
  import { jsx as jsx50, jsxs as jsxs44 } from "react/jsx-runtime";
4485
4540
  var WIDTH3 = { fill: "", sm: "w-24", md: "w-36", lg: "w-48" };
4486
4541
  var MAX_H = { sm: "max-h-80", md: "max-h-120", lg: "max-h-160" };
@@ -4504,7 +4559,7 @@ function DataTable({
4504
4559
  className,
4505
4560
  ...rest
4506
4561
  }) {
4507
- const titleId = useId9();
4562
+ const titleId = useId10();
4508
4563
  const head = HEAD_PAD[density];
4509
4564
  const pad = CELL_PAD[density];
4510
4565
  const align = (c) => c.numeric ? "text-right" : "text-left";
@@ -4614,7 +4669,7 @@ function SuggestionChip({ children, className, type = "button", ...props }) {
4614
4669
  }
4615
4670
 
4616
4671
  // src/ToggleChip.tsx
4617
- import { Check as Check9 } from "lucide-react";
4672
+ import { Check as Check8 } from "lucide-react";
4618
4673
  import { jsx as jsx53, jsxs as jsxs45 } from "react/jsx-runtime";
4619
4674
  function ToggleChip({ selected, onChange, children, className, type = "button", onClick, ...props }) {
4620
4675
  return /* @__PURE__ */ jsxs45(
@@ -4633,7 +4688,7 @@ function ToggleChip({ selected, onChange, children, className, type = "button",
4633
4688
  className
4634
4689
  ),
4635
4690
  children: [
4636
- selected && /* @__PURE__ */ jsx53(Check9, { size: 14, "aria-hidden": "true", className: "-ml-0.5 shrink-0" }),
4691
+ selected && /* @__PURE__ */ jsx53(Check8, { size: 14, "aria-hidden": "true", className: "-ml-0.5 shrink-0" }),
4637
4692
  children
4638
4693
  ]
4639
4694
  }
@@ -4642,7 +4697,7 @@ function ToggleChip({ selected, onChange, children, className, type = "button",
4642
4697
 
4643
4698
  // src/CopyButton.tsx
4644
4699
  import { useEffect as useEffect16, useRef as useRef18, useState as useState16 } from "react";
4645
- import { Check as Check10, Copy } from "lucide-react";
4700
+ import { Check as Check9, Copy } from "lucide-react";
4646
4701
  import { jsx as jsx54, jsxs as jsxs46 } from "react/jsx-runtime";
4647
4702
  var CONFIRM_MS = 2e3;
4648
4703
  function CopyButton({ value, label, "aria-label": ariaLabel, size = "xs", className }) {
@@ -4660,7 +4715,7 @@ function CopyButton({ value, label, "aria-label": ariaLabel, size = "xs", classN
4660
4715
  timer.current = setTimeout(() => setCopied(false), CONFIRM_MS);
4661
4716
  };
4662
4717
  const iconSize = size === "xs" ? 13 : 15;
4663
- const icon = copied ? /* @__PURE__ */ jsx54(Check10, { size: iconSize, "aria-hidden": "true", className: "shrink-0 text-text-success" }) : /* @__PURE__ */ jsx54(Copy, { size: iconSize, "aria-hidden": "true", className: "shrink-0" });
4718
+ const icon = copied ? /* @__PURE__ */ jsx54(Check9, { size: iconSize, "aria-hidden": "true", className: "shrink-0 text-text-success" }) : /* @__PURE__ */ jsx54(Copy, { size: iconSize, "aria-hidden": "true", className: "shrink-0" });
4664
4719
  return /* @__PURE__ */ jsxs46(
4665
4720
  Button,
4666
4721
  {