@mediaradar/design-components 0.58.0 → 0.59.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.
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.58.0",
2
+ "version": "0.59.0",
3
3
  "components": [
4
4
  "AISpark",
5
5
  "AdvertiserNoResults",
package/dist/index.cjs CHANGED
@@ -44,6 +44,7 @@ __export(index_exports, {
44
44
  Delta: () => Delta,
45
45
  Drawer: () => Drawer,
46
46
  EmptyState: () => EmptyState,
47
+ Figure: () => Figure,
47
48
  FilterChipBar: () => FilterChipBar,
48
49
  FilterDrawer: () => FilterDrawer,
49
50
  FilterDropdownFooter: () => FilterDropdownFooter,
@@ -64,6 +65,7 @@ __export(index_exports, {
64
65
  NO_VALUE: () => NO_VALUE,
65
66
  NameListModal: () => NameListModal,
66
67
  NoResultsEmptyState: () => NoResultsEmptyState,
68
+ NoValue: () => NoValue,
67
69
  PRIMARY_ACTION_CLASS: () => PRIMARY_ACTION_CLASS,
68
70
  PageHeader: () => PageHeader,
69
71
  Pager: () => Pager,
@@ -84,6 +86,7 @@ __export(index_exports, {
84
86
  StatStrip: () => StatStrip,
85
87
  StatTile: () => StatTile,
86
88
  SuggestionChip: () => SuggestionChip,
89
+ TableLink: () => TableLink,
87
90
  TablePagination: () => TablePagination,
88
91
  Tabs: () => Tabs,
89
92
  Tag: () => Tag,
@@ -4130,15 +4133,22 @@ var SortButton = (0, import_react19.forwardRef)(
4130
4133
  disabled = false,
4131
4134
  sortable = true,
4132
4135
  align = "left",
4136
+ description,
4133
4137
  className,
4134
4138
  testIdPrefix
4135
4139
  }, ref) {
4136
- if (!sortable) return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { className: cn("inline-flex", ALIGN[align], className), children: label });
4140
+ const own = (0, import_react19.useRef)(null);
4141
+ (0, import_react19.useImperativeHandle)(ref, () => own.current);
4142
+ const text = description ? /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { className: DESCRIBED, children: label }) : label;
4143
+ if (!sortable) {
4144
+ const plain = /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { className: cn("inline-flex", ALIGN[align], className), children: text });
4145
+ return description ? /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(HeaderTip, { description, children: plain }) : plain;
4146
+ }
4137
4147
  const active = !disabled && sort.key === sortKey;
4138
- return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(
4148
+ const button = /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(
4139
4149
  "button",
4140
4150
  {
4141
- ref,
4151
+ ref: own,
4142
4152
  type: "button",
4143
4153
  disabled,
4144
4154
  onClick: () => onSort(sortKey),
@@ -4165,27 +4175,35 @@ var SortButton = (0, import_react19.forwardRef)(
4165
4175
  className
4166
4176
  ),
4167
4177
  children: [
4168
- label,
4178
+ text,
4169
4179
  !disabled && (active ? sort.dir === "asc" ? /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_lucide_react19.ArrowUp, { size: 12, "aria-hidden": "true", className: "shrink-0 text-brand-primaryAction" }) : /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_lucide_react19.ArrowDown, { size: 12, "aria-hidden": "true", className: "shrink-0 text-brand-primaryAction" }) : /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
4170
4180
  import_lucide_react19.ArrowUpDown,
4171
4181
  {
4172
4182
  size: 12,
4173
4183
  "aria-hidden": "true",
4174
- className: "shrink-0 text-text-tertiary opacity-50 transition-opacity group-hover:opacity-100"
4184
+ className: "shrink-0 text-text-tertiary opacity-0 transition-opacity group-hover:opacity-100 group-focus-visible:opacity-100 group-hover/head:opacity-100 pointer-coarse:opacity-50"
4175
4185
  }
4176
4186
  ))
4177
4187
  ]
4178
4188
  }
4179
4189
  );
4190
+ return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(import_jsx_runtime37.Fragment, { children: [
4191
+ button,
4192
+ description && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Tooltip, { anchorRef: own, label: description, delay: 300, placement: "top" })
4193
+ ] });
4180
4194
  }
4181
4195
  );
4182
4196
  SortButton.displayName = "SortButton";
4197
+ var DESCRIBED = "underline decoration-dotted decoration-1 decoration-text-tertiary underline-offset-4";
4198
+ function HeaderTip({ description, children }) {
4199
+ return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Tooltip, { label: description, delay: 300, className: "inline-flex rounded-xs focus-visible:outline-solid focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-border-focus", children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { tabIndex: 0, children }) });
4200
+ }
4183
4201
 
4184
4202
  // src/tableSort.ts
4185
- function cycleSort(current, key, firstDir = "desc") {
4203
+ function cycleSort(current, key, firstDir = "desc", fallback = null) {
4186
4204
  if (!current || current.key !== key) return { key, dir: firstDir };
4187
4205
  if (current.dir === firstDir) return { key, dir: firstDir === "desc" ? "asc" : "desc" };
4188
- return null;
4206
+ return fallback && fallback.key === key ? { key, dir: firstDir } : fallback;
4189
4207
  }
4190
4208
  function sortProp(sort) {
4191
4209
  return sort ?? { key: null, dir: "desc" };
@@ -5365,11 +5383,89 @@ function Drawer({ open, onClose, title, description, size = "sm", footer, childr
5365
5383
 
5366
5384
  // src/DataTable.tsx
5367
5385
  var import_react28 = require("react");
5386
+ var import_lucide_react29 = require("lucide-react");
5387
+
5388
+ // src/numbers.ts
5389
+ var US = { units: ["K", "M", "B", "T"] };
5390
+ var STYLES = {
5391
+ "en-US": US,
5392
+ "en-CA": US,
5393
+ "en-GB": { units: ["k", "m", "bn", "tn"] }
5394
+ };
5395
+ var styleFor = (language) => STYLES[language ?? "en-US"] ?? US;
5396
+ var NO_VALUE = "\u2014";
5397
+ var MINUS = "\u2212";
5398
+ var SHORTEN_FROM = 1e4;
5399
+ var isMissing = (v) => v === null || v === void 0 || Number.isNaN(v);
5400
+ var withCommas = (n) => Math.round(n).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
5401
+ function shortAbs(abs, style) {
5402
+ if (abs < SHORTEN_FROM) return withCommas(abs);
5403
+ let tier = Math.min(Math.floor(Math.log10(abs) / 3), 4);
5404
+ let scaled = Math.round(abs / 1e3 ** tier * 10) / 10;
5405
+ if (scaled >= 1e3 && tier < 4) {
5406
+ tier += 1;
5407
+ scaled = Math.round(abs / 1e3 ** tier * 10) / 10;
5408
+ }
5409
+ const text = Number.isInteger(scaled) ? withCommas(scaled) : scaled.toFixed(1);
5410
+ return `${text}${style.units[tier - 1]}`;
5411
+ }
5412
+ function symbol(opts) {
5413
+ const currency = opts.currency ?? "USD";
5414
+ if (currency === "GBP") return "\xA3";
5415
+ if (currency === "EUR") return "\u20AC";
5416
+ if (opts.mixedDollars) return currency === "CAD" ? "CA$" : "US$";
5417
+ return "$";
5418
+ }
5419
+ var sign = (v) => v < 0 ? MINUS : "";
5420
+ function formatCount(value, opts = {}) {
5421
+ if (isMissing(value)) return NO_VALUE;
5422
+ return sign(value) + shortAbs(Math.abs(value), styleFor(opts.language));
5423
+ }
5424
+ function formatCountFull(value) {
5425
+ if (isMissing(value)) return NO_VALUE;
5426
+ return sign(value) + withCommas(Math.abs(value));
5427
+ }
5428
+ function formatMoney(value, opts = {}) {
5429
+ if (isMissing(value)) return NO_VALUE;
5430
+ return sign(value) + symbol(opts) + shortAbs(Math.abs(value), styleFor(opts.language));
5431
+ }
5432
+ function formatMoneyFull(value, opts = {}) {
5433
+ if (isMissing(value)) return NO_VALUE;
5434
+ return sign(value) + symbol(opts) + withCommas(Math.abs(value));
5435
+ }
5436
+ function formatPercent(value, _opts = {}) {
5437
+ if (isMissing(value)) return NO_VALUE;
5438
+ const abs = Math.abs(value);
5439
+ if (abs > 0 && abs < 0.05) return `${value < 0 ? MINUS : ""}<0.1%`;
5440
+ const text = (Math.round(abs * 10) / 10).toFixed(1);
5441
+ return text === "0.0" ? "0.0%" : `${sign(value)}${text}%`;
5442
+ }
5443
+
5444
+ // src/DataTable.tsx
5368
5445
  var import_jsx_runtime54 = require("react/jsx-runtime");
5369
5446
  var WIDTH3 = { fill: "", sm: "w-24", md: "w-36", lg: "w-48" };
5370
5447
  var MAX_H = { sm: "max-h-80", md: "max-h-120", lg: "max-h-160" };
5371
5448
  var HEAD_PAD = { default: "px-4 py-3", compact: "px-3 py-2" };
5372
5449
  var CELL_PAD = { default: "px-4 py-3.5", compact: "px-3 py-2" };
5450
+ var OWN_CLICK = "a, button, input, select, textarea, label, summary, [role='button'], [role='checkbox'], [role='menuitem'], [role='switch'], [role='tab'], [contenteditable='true']";
5451
+ function NoValue({ reason = "No data" }) {
5452
+ return /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(Tooltip, { label: reason, delay: 300, className: "text-text-tertiary", children: [
5453
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { "aria-hidden": "true", children: NO_VALUE }),
5454
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { className: "sr-only", children: reason })
5455
+ ] });
5456
+ }
5457
+ function TableLink({ className, ...props }) {
5458
+ return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
5459
+ "a",
5460
+ {
5461
+ ...props,
5462
+ className: cn(
5463
+ "rounded-xs text-inherit decoration-1 underline-offset-2 hover:underline focus-visible:underline focus-visible:outline-solid focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-border-focus",
5464
+ className
5465
+ )
5466
+ }
5467
+ );
5468
+ }
5373
5469
  function DataTable({
5374
5470
  columns,
5375
5471
  rows,
@@ -5377,8 +5473,14 @@ function DataTable({
5377
5473
  title,
5378
5474
  subtitle,
5379
5475
  action,
5476
+ variant = "default",
5477
+ titleAs = "h2",
5380
5478
  sort = null,
5381
5479
  onSortChange,
5480
+ defaultSort = null,
5481
+ renderExpanded,
5482
+ canExpand,
5483
+ rowLabel,
5382
5484
  density = "default",
5383
5485
  loading = false,
5384
5486
  loadingRows = 5,
@@ -5392,24 +5494,48 @@ function DataTable({
5392
5494
  const titleId = (0, import_react28.useId)();
5393
5495
  const head = HEAD_PAD[density];
5394
5496
  const pad2 = CELL_PAD[density];
5395
- const align = (c) => c.numeric ? "text-right" : "text-left";
5396
- const width = (c) => WIDTH3[c.width ?? (c.numeric ? "md" : "fill")];
5497
+ const right = (c) => c.numeric || c.rank;
5498
+ const align = (c) => right(c) ? "text-right" : "text-left";
5499
+ const width = (c) => c.rank ? "w-12" : WIDTH3[c.width ?? (c.numeric ? "md" : "fill")];
5500
+ const shown = sort ?? defaultSort;
5397
5501
  const onSort = (key) => {
5398
5502
  const col = columns.find((c) => c.key === key);
5399
- onSortChange?.(cycleSort(sort, key, col?.firstDir ?? (col?.numeric ? "desc" : "asc")));
5503
+ onSortChange?.(cycleSort(shown, key, col?.firstDir ?? (right(col) ? "desc" : "asc"), defaultSort));
5504
+ };
5505
+ const [open, setOpen] = (0, import_react28.useState)(() => /* @__PURE__ */ new Set());
5506
+ const visibleKeys = rows.map(rowKey).join("|");
5507
+ (0, import_react28.useEffect)(() => setOpen(/* @__PURE__ */ new Set()), [shown?.key, shown?.dir, visibleKeys]);
5508
+ const expandable = (row) => !!renderExpanded && (canExpand ? canExpand(row) : true);
5509
+ const anyExpandable = !!renderExpanded && rows.some(expandable);
5510
+ const toggle = (key) => setOpen((prev) => {
5511
+ const next = new Set(prev);
5512
+ if (next.has(key)) next.delete(key);
5513
+ else next.add(key);
5514
+ return next;
5515
+ });
5516
+ const onRowClick = (e, key) => {
5517
+ if (e.target.closest(OWN_CLICK)) return;
5518
+ if (window.getSelection?.()?.toString()) return;
5519
+ toggle(key);
5520
+ };
5521
+ const span = columns.length + (anyExpandable ? 1 : 0);
5522
+ const renderCell = (c, row) => {
5523
+ const v = c.cell(row);
5524
+ return v === null || v === void 0 || v === "" ? /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(NoValue, { reason: c.missing }) : v;
5400
5525
  };
5401
- return /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(
5526
+ const inside = variant === "chart";
5527
+ const frame = /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(
5402
5528
  "div",
5403
5529
  {
5404
- className: cn("flex w-full flex-col overflow-hidden rounded-card border border-border-default bg-surface", className),
5530
+ className: cn("flex w-full flex-col overflow-hidden rounded-card border border-border-default bg-surface", !(title && !inside) && className),
5405
5531
  "data-testid": testIdPrefix,
5406
5532
  children: [
5407
- title && /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: "flex items-start justify-between gap-2 p-card-padding", children: [
5533
+ title && inside && /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: "flex items-start justify-between gap-2 p-card-padding", children: [
5408
5534
  /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: "min-w-0", children: [
5409
- /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("h3", { id: titleId, className: "text-style-card-title", children: title }),
5410
- subtitle && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("p", { className: "mt-0.5 text-xs text-text-tertiary", children: subtitle })
5535
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("h3", { id: titleId, className: "text-panel-title font-semibold text-text-primary", children: title }),
5536
+ subtitle && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("p", { className: "mt-0.5 text-xs leading-snug text-text-tertiary", children: subtitle })
5411
5537
  ] }),
5412
- action && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { className: "shrink-0", children: action })
5538
+ action && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { className: "shrink-0 text-text-tertiary", children: action })
5413
5539
  ] }),
5414
5540
  /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("div", { className: cn("overflow-x-auto", maxHeight && cn("overflow-y-auto", MAX_H[maxHeight])), children: /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(
5415
5541
  "table",
@@ -5419,42 +5545,94 @@ function DataTable({
5419
5545
  "aria-busy": loading || void 0,
5420
5546
  className: "w-full border-collapse text-left",
5421
5547
  children: [
5422
- /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("thead", { className: cn(maxHeight && "sticky top-0 z-10"), children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("tr", { className: "bg-subtle text-micro font-semibold uppercase tracking-wider text-text-secondary", children: columns.map((c) => /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
5423
- "th",
5424
- {
5425
- scope: "col",
5426
- "aria-sort": c.sortable ? ariaSortFor(sort, c.key) : void 0,
5427
- className: cn("whitespace-nowrap border-b border-border-default font-semibold", head, align(c), width(c)),
5428
- children: c.sortable && onSortChange ? /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
5429
- SortButton,
5548
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("thead", { className: cn(maxHeight && "sticky top-0 z-10"), children: /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("tr", { className: "bg-subtle text-micro font-semibold uppercase tracking-wider text-text-secondary", children: [
5549
+ anyExpandable && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("th", { scope: "col", className: cn("w-10 border-b border-border-default", head), children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { className: "sr-only", children: "Details" }) }),
5550
+ columns.map((c) => /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
5551
+ "th",
5552
+ {
5553
+ scope: "col",
5554
+ "aria-sort": c.sortable ? ariaSortFor(shown, c.key) : void 0,
5555
+ className: cn("group/head whitespace-nowrap border-b border-border-default font-semibold", head, align(c), width(c)),
5556
+ children: c.sortable && onSortChange ? /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
5557
+ SortButton,
5558
+ {
5559
+ label: c.label,
5560
+ sortKey: c.key,
5561
+ align: right(c) ? "right" : "left",
5562
+ sort: sortProp(shown),
5563
+ onSort,
5564
+ description: c.info,
5565
+ testIdPrefix
5566
+ }
5567
+ ) : c.info ? /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(SortButton, { label: c.label, sortKey: c.key, sortable: false, sort: sortProp(shown), onSort: () => {
5568
+ }, description: c.info, align: right(c) ? "right" : "left" }) : c.label
5569
+ },
5570
+ c.key
5571
+ ))
5572
+ ] }) }),
5573
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("tbody", { className: "text-dense text-text-primary", children: loading ? Array.from({ length: loadingRows }, (_, i) => /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("tr", { "aria-hidden": "true", className: "[&:last-child>td]:border-b-0", children: [
5574
+ anyExpandable && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("td", { className: cn("border-b border-border-default", pad2) }),
5575
+ columns.map((c) => /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("td", { className: cn("border-b border-border-default", pad2, align(c)), children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
5576
+ "span",
5577
+ {
5578
+ className: cn(
5579
+ "inline-block h-3 animate-pulse rounded-full bg-subtle",
5580
+ c.numeric ? "w-12" : "w-2/3"
5581
+ )
5582
+ }
5583
+ ) }, c.key))
5584
+ ] }, i)) : rows.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("tr", { children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("td", { colSpan: span, className: "px-6 py-12", children: empty ?? /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(NoResultsEmptyState, {}) }) }) : rows.map((row, index) => {
5585
+ const key = rowKey(row);
5586
+ const canOpen = expandable(row);
5587
+ const isOpen = canOpen && open.has(key);
5588
+ const panelId = `${titleId}-row-${index}`;
5589
+ return /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(import_react28.Fragment, { children: [
5590
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(
5591
+ "tr",
5430
5592
  {
5431
- label: c.label,
5432
- sortKey: c.key,
5433
- align: c.numeric ? "right" : "left",
5434
- sort: sortProp(sort),
5435
- onSort,
5436
- testIdPrefix
5593
+ onClick: canOpen ? (e) => onRowClick(e, key) : void 0,
5594
+ className: cn("hover:bg-subtle [&:last-child>td]:border-b-0", canOpen && "cursor-pointer", isOpen && "bg-subtle"),
5595
+ children: [
5596
+ anyExpandable && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("td", { className: cn("border-b border-border-default pr-0", pad2, isOpen && "border-b-0"), children: canOpen && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
5597
+ "button",
5598
+ {
5599
+ type: "button",
5600
+ "aria-expanded": isOpen,
5601
+ "aria-controls": isOpen ? panelId : void 0,
5602
+ "aria-label": `${isOpen ? "Hide" : "Show"} details${rowLabel ? ` for ${rowLabel(row)}` : ""}`,
5603
+ onClick: () => toggle(key),
5604
+ 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",
5605
+ children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
5606
+ import_lucide_react29.ChevronRight,
5607
+ {
5608
+ size: 16,
5609
+ "aria-hidden": "true",
5610
+ className: cn("transition-transform motion-reduce:transition-none", isOpen && "rotate-90")
5611
+ }
5612
+ )
5613
+ }
5614
+ ) }),
5615
+ columns.map((c) => /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
5616
+ "td",
5617
+ {
5618
+ className: cn(
5619
+ "border-b border-border-default",
5620
+ pad2,
5621
+ align(c),
5622
+ right(c) && "tabular-nums",
5623
+ c.rank && "text-text-tertiary",
5624
+ isOpen && "border-b-0"
5625
+ ),
5626
+ children: renderCell(c, row)
5627
+ },
5628
+ c.key
5629
+ ))
5630
+ ]
5437
5631
  }
5438
- ) : c.label
5439
- },
5440
- c.key
5441
- )) }) }),
5442
- /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("tbody", { className: "text-dense text-text-primary", children: loading ? Array.from({ length: loadingRows }, (_, i) => /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("tr", { "aria-hidden": "true", className: "[&:last-child>td]:border-b-0", children: columns.map((c) => /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("td", { className: cn("border-b border-border-default", pad2, align(c)), children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
5443
- "span",
5444
- {
5445
- className: cn(
5446
- "inline-block h-3 animate-pulse rounded-full bg-subtle",
5447
- c.numeric ? "w-12" : "w-2/3"
5448
- )
5449
- }
5450
- ) }, c.key)) }, i)) : rows.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("tr", { children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("td", { colSpan: columns.length, className: "px-6 py-12", children: empty ?? /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(NoResultsEmptyState, {}) }) }) : rows.map((row) => /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("tr", { className: "hover:bg-subtle [&:last-child>td]:border-b-0", children: columns.map((c) => /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
5451
- "td",
5452
- {
5453
- className: cn("border-b border-border-default", pad2, align(c), c.numeric && "tabular-nums"),
5454
- children: c.cell(row)
5455
- },
5456
- c.key
5457
- )) }, rowKey(row))) })
5632
+ ),
5633
+ isOpen && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("tr", { className: "[&:last-child>td]:border-b-0", children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("td", { id: panelId, colSpan: span, className: "border-b border-border-default bg-subtle px-4 pb-4 pl-14", children: renderExpanded(row) }) })
5634
+ ] }, key);
5635
+ }) })
5458
5636
  ]
5459
5637
  }
5460
5638
  ) }),
@@ -5462,6 +5640,11 @@ function DataTable({
5462
5640
  ]
5463
5641
  }
5464
5642
  );
5643
+ if (!title || inside) return frame;
5644
+ return /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("section", { "aria-labelledby": titleId, className: cn("flex w-full flex-col gap-3", className), children: [
5645
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(SectionHeading, { id: titleId, as: titleAs, title, description: subtitle, actions: action }),
5646
+ frame
5647
+ ] });
5465
5648
  }
5466
5649
 
5467
5650
  // src/MediaLabel.tsx
@@ -5513,7 +5696,7 @@ SuggestionChip.displayName = "SuggestionChip";
5513
5696
 
5514
5697
  // src/ToggleChip.tsx
5515
5698
  var import_react30 = require("react");
5516
- var import_lucide_react29 = require("lucide-react");
5699
+ var import_lucide_react30 = require("lucide-react");
5517
5700
  var import_jsx_runtime57 = require("react/jsx-runtime");
5518
5701
  var ToggleChip = (0, import_react30.forwardRef)(function ToggleChip2({ selected, onChange, children, className, testIdPrefix, type = "button", onClick, ...props }, ref) {
5519
5702
  return /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(
@@ -5534,7 +5717,7 @@ var ToggleChip = (0, import_react30.forwardRef)(function ToggleChip2({ selected,
5534
5717
  className
5535
5718
  ),
5536
5719
  children: [
5537
- selected && /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(import_lucide_react29.Check, { size: 14, "aria-hidden": "true", className: "-ml-0.5 shrink-0" }),
5720
+ selected && /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(import_lucide_react30.Check, { size: 14, "aria-hidden": "true", className: "-ml-0.5 shrink-0" }),
5538
5721
  children
5539
5722
  ]
5540
5723
  }
@@ -5544,7 +5727,7 @@ ToggleChip.displayName = "ToggleChip";
5544
5727
 
5545
5728
  // src/CopyButton.tsx
5546
5729
  var import_react31 = require("react");
5547
- var import_lucide_react30 = require("lucide-react");
5730
+ var import_lucide_react31 = require("lucide-react");
5548
5731
  var import_jsx_runtime58 = require("react/jsx-runtime");
5549
5732
  var CONFIRM_MS = 2e3;
5550
5733
  var CopyButton = (0, import_react31.forwardRef)(function CopyButton2({ value, label, "aria-label": ariaLabel, size = "xs", className, testIdPrefix }, ref) {
@@ -5562,7 +5745,7 @@ var CopyButton = (0, import_react31.forwardRef)(function CopyButton2({ value, la
5562
5745
  timer.current = setTimeout(() => setCopied(false), CONFIRM_MS);
5563
5746
  };
5564
5747
  const iconSize = size === "xs" ? 13 : 15;
5565
- const icon = copied ? /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(import_lucide_react30.Check, { size: iconSize, "aria-hidden": "true", className: "shrink-0 text-text-success" }) : /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(import_lucide_react30.Copy, { size: iconSize, "aria-hidden": "true", className: "shrink-0" });
5748
+ const icon = copied ? /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(import_lucide_react31.Check, { size: iconSize, "aria-hidden": "true", className: "shrink-0 text-text-success" }) : /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(import_lucide_react31.Copy, { size: iconSize, "aria-hidden": "true", className: "shrink-0" });
5566
5749
  return /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)(
5567
5750
  Button,
5568
5751
  {
@@ -5586,7 +5769,7 @@ var CopyButton = (0, import_react31.forwardRef)(function CopyButton2({ value, la
5586
5769
  CopyButton.displayName = "CopyButton";
5587
5770
 
5588
5771
  // src/InlineMessage.tsx
5589
- var import_lucide_react31 = require("lucide-react");
5772
+ var import_lucide_react32 = require("lucide-react");
5590
5773
  var import_jsx_runtime59 = require("react/jsx-runtime");
5591
5774
  var BOX = {
5592
5775
  info: "border-brand-primaryAction/30 bg-brand-primaryAction/10",
@@ -5601,7 +5784,7 @@ var ICON_INK = {
5601
5784
  warning: "text-text-warning",
5602
5785
  danger: "text-text-danger"
5603
5786
  };
5604
- var ICON2 = { info: import_lucide_react31.Info, success: import_lucide_react31.CheckCircle2, warning: import_lucide_react31.AlertTriangle, danger: import_lucide_react31.XCircle };
5787
+ var ICON2 = { info: import_lucide_react32.Info, success: import_lucide_react32.CheckCircle2, warning: import_lucide_react32.AlertTriangle, danger: import_lucide_react32.XCircle };
5605
5788
  function InlineMessage({ tone = "info", title, children, actions, onDismiss, className, testIdPrefix }) {
5606
5789
  const Icon = ICON2[tone];
5607
5790
  return /* @__PURE__ */ (0, import_jsx_runtime59.jsxs)(
@@ -5624,7 +5807,7 @@ function InlineMessage({ tone = "info", title, children, actions, onDismiss, cla
5624
5807
  onClick: onDismiss,
5625
5808
  "aria-label": "Dismiss",
5626
5809
  className: "-mr-1 -mt-0.5 flex size-6 shrink-0 items-center justify-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",
5627
- children: /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(import_lucide_react31.X, { size: 14, "aria-hidden": "true" })
5810
+ children: /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(import_lucide_react32.X, { size: 14, "aria-hidden": "true" })
5628
5811
  }
5629
5812
  )
5630
5813
  ]
@@ -5634,7 +5817,7 @@ function InlineMessage({ tone = "info", title, children, actions, onDismiss, cla
5634
5817
 
5635
5818
  // src/FilterDrawer.tsx
5636
5819
  var import_react32 = require("react");
5637
- var import_lucide_react32 = require("lucide-react");
5820
+ var import_lucide_react33 = require("lucide-react");
5638
5821
  var import_jsx_runtime60 = require("react/jsx-runtime");
5639
5822
  var SLIDE_MS = 200;
5640
5823
  function reducedMotion() {
@@ -5720,7 +5903,7 @@ function FilterDrawer({
5720
5903
  ),
5721
5904
  /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("span", { className: "flex-1 text-sm font-medium text-text-primary", children: x.label }),
5722
5905
  x.badge && /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(Badge, { tone: "brand", children: x.badge }),
5723
- /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(import_lucide_react32.ChevronRight, { size: 16, "aria-hidden": "true", className: "shrink-0 text-text-secondary" })
5906
+ /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(import_lucide_react33.ChevronRight, { size: 16, "aria-hidden": "true", className: "shrink-0 text-text-secondary" })
5724
5907
  ]
5725
5908
  }
5726
5909
  ) }, x.id)) });
@@ -5742,7 +5925,7 @@ function FilterDrawer({
5742
5925
  "aria-label": "Back to all filters",
5743
5926
  "data-testid": testIdPrefix && `${testIdPrefix}-back`,
5744
5927
  className: "-ml-1.5 rounded-control p-1 text-text-secondary hover:bg-subtle hover:text-text-primary focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-border-focus",
5745
- children: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(import_lucide_react32.ChevronLeft, { size: 18, "aria-hidden": "true" })
5928
+ children: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(import_lucide_react33.ChevronLeft, { size: 18, "aria-hidden": "true" })
5746
5929
  }
5747
5930
  ),
5748
5931
  focused.label,
@@ -5799,7 +5982,7 @@ function FilterDrawer({
5799
5982
 
5800
5983
  // src/AllFiltersButton.tsx
5801
5984
  var import_react33 = require("react");
5802
- var import_lucide_react33 = require("lucide-react");
5985
+ var import_lucide_react34 = require("lucide-react");
5803
5986
  var import_jsx_runtime61 = require("react/jsx-runtime");
5804
5987
  var AllFiltersButton = (0, import_react33.forwardRef)(function AllFiltersButton2({ count = 0, open, className, testIdPrefix, ...rest }, ref) {
5805
5988
  return /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)(
@@ -5814,7 +5997,7 @@ var AllFiltersButton = (0, import_react33.forwardRef)(function AllFiltersButton2
5814
5997
  className: cn(chipTriggerClass(), className),
5815
5998
  ...rest,
5816
5999
  children: [
5817
- /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(import_lucide_react33.SlidersHorizontal, { size: 15, "aria-hidden": "true", className: "text-text-secondary" }),
6000
+ /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(import_lucide_react34.SlidersHorizontal, { size: 15, "aria-hidden": "true", className: "text-text-secondary" }),
5818
6001
  /* @__PURE__ */ (0, import_jsx_runtime61.jsx)("span", { className: "text-dense font-medium text-text-primary", children: "All filters" }),
5819
6002
  count > 0 && /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(Badge, { tone: "brandSolid", kind: "count", children: count })
5820
6003
  ]
@@ -5825,7 +6008,7 @@ var AllFiltersButton = (0, import_react33.forwardRef)(function AllFiltersButton2
5825
6008
  // src/Menu.tsx
5826
6009
  var import_react34 = require("react");
5827
6010
  var import_react_slot2 = require("@radix-ui/react-slot");
5828
- var import_lucide_react34 = require("lucide-react");
6011
+ var import_lucide_react35 = require("lucide-react");
5829
6012
  var import_jsx_runtime62 = require("react/jsx-runtime");
5830
6013
  var ROW_SELECTOR = '[role^="menuitem"]:not([aria-disabled="true"]):not(:disabled)';
5831
6014
  function moveFocus(e) {
@@ -5870,8 +6053,8 @@ var MenuItem = (0, import_react34.forwardRef)(
5870
6053
  description && /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("span", { className: "block truncate text-xs text-text-tertiary", children: description })
5871
6054
  ] }),
5872
6055
  trailing && /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("span", { className: "ml-auto flex shrink-0 items-center text-xs text-text-secondary", children: trailing }),
5873
- radio && checked && /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(import_lucide_react34.Check, { size: 16, "aria-hidden": "true", className: "shrink-0 text-brand-primaryAction" }),
5874
- submenu && /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(import_lucide_react34.ChevronRight, { size: 16, "aria-hidden": "true", className: "shrink-0 text-text-secondary" })
6056
+ radio && checked && /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(import_lucide_react35.Check, { size: 16, "aria-hidden": "true", className: "shrink-0 text-brand-primaryAction" }),
6057
+ submenu && /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(import_lucide_react35.ChevronRight, { size: 16, "aria-hidden": "true", className: "shrink-0 text-text-secondary" })
5875
6058
  ] });
5876
6059
  return /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
5877
6060
  Comp,
@@ -6024,60 +6207,17 @@ function defaultDateOrder(country) {
6024
6207
  return c === "US" || c === "CA" || c === "" ? "mdy" : "dmy";
6025
6208
  }
6026
6209
 
6027
- // src/numbers.ts
6028
- var US = { units: ["K", "M", "B", "T"] };
6029
- var STYLES = {
6030
- "en-US": US,
6031
- "en-CA": US,
6032
- "en-GB": { units: ["k", "m", "bn", "tn"] }
6033
- };
6034
- var styleFor = (language) => STYLES[language ?? "en-US"] ?? US;
6035
- var NO_VALUE = "\u2014";
6036
- var MINUS = "\u2212";
6037
- var SHORTEN_FROM = 1e4;
6038
- var isMissing = (v) => v === null || v === void 0 || Number.isNaN(v);
6039
- var withCommas = (n) => Math.round(n).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
6040
- function shortAbs(abs, style) {
6041
- if (abs < SHORTEN_FROM) return withCommas(abs);
6042
- let tier = Math.min(Math.floor(Math.log10(abs) / 3), 4);
6043
- let scaled = Math.round(abs / 1e3 ** tier * 10) / 10;
6044
- if (scaled >= 1e3 && tier < 4) {
6045
- tier += 1;
6046
- scaled = Math.round(abs / 1e3 ** tier * 10) / 10;
6047
- }
6048
- const text = Number.isInteger(scaled) ? withCommas(scaled) : scaled.toFixed(1);
6049
- return `${text}${style.units[tier - 1]}`;
6050
- }
6051
- function symbol(opts) {
6052
- const currency = opts.currency ?? "USD";
6053
- if (currency === "GBP") return "\xA3";
6054
- if (currency === "EUR") return "\u20AC";
6055
- if (opts.mixedDollars) return currency === "CAD" ? "CA$" : "US$";
6056
- return "$";
6057
- }
6058
- var sign = (v) => v < 0 ? MINUS : "";
6059
- function formatCount(value, opts = {}) {
6060
- if (isMissing(value)) return NO_VALUE;
6061
- return sign(value) + shortAbs(Math.abs(value), styleFor(opts.language));
6062
- }
6063
- function formatCountFull(value) {
6064
- if (isMissing(value)) return NO_VALUE;
6065
- return sign(value) + withCommas(Math.abs(value));
6066
- }
6067
- function formatMoney(value, opts = {}) {
6068
- if (isMissing(value)) return NO_VALUE;
6069
- return sign(value) + symbol(opts) + shortAbs(Math.abs(value), styleFor(opts.language));
6070
- }
6071
- function formatMoneyFull(value, opts = {}) {
6072
- if (isMissing(value)) return NO_VALUE;
6073
- return sign(value) + symbol(opts) + withCommas(Math.abs(value));
6074
- }
6075
- function formatPercent(value, _opts = {}) {
6076
- if (isMissing(value)) return NO_VALUE;
6077
- const abs = Math.abs(value);
6078
- if (abs > 0 && abs < 0.05) return `${value < 0 ? MINUS : ""}<0.1%`;
6079
- const text = (Math.round(abs * 10) / 10).toFixed(1);
6080
- return text === "0.0" ? "0.0%" : `${sign(value)}${text}%`;
6210
+ // src/Figure.tsx
6211
+ var import_jsx_runtime63 = require("react/jsx-runtime");
6212
+ function Figure({ value, kind = "money", missing, ...opts }) {
6213
+ if (value === null || value === void 0 || Number.isNaN(value)) return /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(NoValue, { reason: missing });
6214
+ const short = kind === "money" ? formatMoney(value, opts) : formatCount(value, opts);
6215
+ const full = kind === "money" ? formatMoneyFull(value, opts) : formatCountFull(value);
6216
+ if (short === full) return /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(import_jsx_runtime63.Fragment, { children: short });
6217
+ return /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(Tooltip, { label: full, delay: 300, children: [
6218
+ /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("span", { "aria-hidden": "true", children: short }),
6219
+ /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("span", { className: "sr-only", children: full })
6220
+ ] });
6081
6221
  }
6082
6222
  // Annotate the CommonJS export names for ESM import in node:
6083
6223
  0 && (module.exports = {
@@ -6104,6 +6244,7 @@ function formatPercent(value, _opts = {}) {
6104
6244
  Delta,
6105
6245
  Drawer,
6106
6246
  EmptyState,
6247
+ Figure,
6107
6248
  FilterChipBar,
6108
6249
  FilterDrawer,
6109
6250
  FilterDropdownFooter,
@@ -6124,6 +6265,7 @@ function formatPercent(value, _opts = {}) {
6124
6265
  NO_VALUE,
6125
6266
  NameListModal,
6126
6267
  NoResultsEmptyState,
6268
+ NoValue,
6127
6269
  PRIMARY_ACTION_CLASS,
6128
6270
  PageHeader,
6129
6271
  Pager,
@@ -6144,6 +6286,7 @@ function formatPercent(value, _opts = {}) {
6144
6286
  StatStrip,
6145
6287
  StatTile,
6146
6288
  SuggestionChip,
6289
+ TableLink,
6147
6290
  TablePagination,
6148
6291
  Tabs,
6149
6292
  Tag,