@mediaradar/design-components 0.63.1 → 0.64.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/approved-components.json +1 -1
- package/dist/index.cjs +698 -420
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +193 -20
- package/dist/index.d.ts +193 -20
- package/dist/index.js +666 -389
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -4759,6 +4759,9 @@ function MultiSelectFilter({
|
|
|
4759
4759
|
valueLabel,
|
|
4760
4760
|
hints,
|
|
4761
4761
|
note,
|
|
4762
|
+
hideCaption = false,
|
|
4763
|
+
max,
|
|
4764
|
+
maxReason,
|
|
4762
4765
|
className,
|
|
4763
4766
|
testIdPrefix
|
|
4764
4767
|
}) {
|
|
@@ -4805,9 +4808,12 @@ function MultiSelectFilter({
|
|
|
4805
4808
|
window.removeEventListener("mousedown", onClick);
|
|
4806
4809
|
};
|
|
4807
4810
|
}, [open, close]);
|
|
4811
|
+
const capReason = maxReason ?? `Up to ${max}. Untick one to add another.`;
|
|
4812
|
+
const overCap = (n) => max !== void 0 && n > max;
|
|
4808
4813
|
const toggle = (id) => setDraft((cur) => {
|
|
4809
4814
|
const next = cur.includes(id) ? cur.filter((x) => x !== id) : [...cur, id];
|
|
4810
4815
|
if (next.length < min) return cur;
|
|
4816
|
+
if (!cur.includes(id) && overCap(next.length)) return cur;
|
|
4811
4817
|
return next;
|
|
4812
4818
|
});
|
|
4813
4819
|
const toggleGroup = (g) => setDraft((cur) => {
|
|
@@ -4816,8 +4822,40 @@ function MultiSelectFilter({
|
|
|
4816
4822
|
const allSel = ids.every((id) => cur.includes(id));
|
|
4817
4823
|
const next = allSel ? cur.filter((id) => !ids.includes(id)) : [.../* @__PURE__ */ new Set([...cur, ...ids])];
|
|
4818
4824
|
if (next.length < min) return cur;
|
|
4825
|
+
if (!allSel && overCap(next.length)) return cur;
|
|
4819
4826
|
return next;
|
|
4820
4827
|
});
|
|
4828
|
+
const blockedLeaf = (id) => !draft.includes(id) && overCap(draft.length + 1) ? capReason : null;
|
|
4829
|
+
const blockedGroup = (g) => {
|
|
4830
|
+
if (max === void 0) return null;
|
|
4831
|
+
const ids = groupLeaves(g).map((c) => c.id).filter((id) => !counts || (counts[id] ?? 0) > 0 || draft.includes(id));
|
|
4832
|
+
if (!ids.length || ids.every((id) => draft.includes(id))) return null;
|
|
4833
|
+
return overCap((/* @__PURE__ */ new Set([...draft, ...ids])).size) ? capReason : null;
|
|
4834
|
+
};
|
|
4835
|
+
const row = (opts) => {
|
|
4836
|
+
const button = /* @__PURE__ */ jsxs41(
|
|
4837
|
+
"button",
|
|
4838
|
+
{
|
|
4839
|
+
type: "button",
|
|
4840
|
+
role: "checkbox",
|
|
4841
|
+
"aria-checked": opts.indeterminate ? "mixed" : opts.checked,
|
|
4842
|
+
"aria-disabled": opts.blocked ? "true" : void 0,
|
|
4843
|
+
onClick: opts.blocked ? void 0 : opts.onClick,
|
|
4844
|
+
className: cn(
|
|
4845
|
+
"flex w-full items-center gap-2.5 rounded-control py-2 text-left transition-colors focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-border-focus",
|
|
4846
|
+
opts.indent ? "pl-9 pr-2" : "px-2",
|
|
4847
|
+
opts.blocked ? "cursor-not-allowed" : "hover:bg-subtle"
|
|
4848
|
+
),
|
|
4849
|
+
children: [
|
|
4850
|
+
/* @__PURE__ */ jsx45(CheckBoxBox, { checked: opts.checked, indeterminate: opts.indeterminate, disabled: !!opts.blocked }),
|
|
4851
|
+
/* @__PURE__ */ jsx45("span", { className: cn("flex-1 text-sm", opts.blocked ? "text-text-tertiary" : "text-text-primary", opts.bold && "font-semibold"), children: opts.label }),
|
|
4852
|
+
opts.count
|
|
4853
|
+
]
|
|
4854
|
+
},
|
|
4855
|
+
opts.key
|
|
4856
|
+
);
|
|
4857
|
+
return opts.blocked ? /* @__PURE__ */ jsx45(Tooltip, { label: opts.blocked, delay: 300, className: "flex w-full", children: button }, opts.key) : button;
|
|
4858
|
+
};
|
|
4821
4859
|
const isAvailable = (id) => !counts || (counts[id] ?? 0) > 0 || draft.includes(id);
|
|
4822
4860
|
const countFor = (id) => counts?.[id] ?? 0;
|
|
4823
4861
|
const groupState = (g) => {
|
|
@@ -4849,10 +4887,17 @@ function MultiSelectFilter({
|
|
|
4849
4887
|
type: "button",
|
|
4850
4888
|
onClick: () => open ? close() : openTray(),
|
|
4851
4889
|
"aria-expanded": open,
|
|
4890
|
+
"aria-label": hideCaption ? caption : void 0,
|
|
4852
4891
|
"data-testid": testIdPrefix && `${testIdPrefix}-trigger`,
|
|
4853
|
-
className: cn(
|
|
4892
|
+
className: cn(
|
|
4893
|
+
hideCaption ? "flex h-10 items-center gap-2 rounded-control border border-border-strong bg-input pl-3 pr-2.5 text-sm font-medium text-text-primary transition-colors hover:bg-subtle focus-visible:outline-solid focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-border-focus" : chipTriggerClass(variant),
|
|
4894
|
+
fullWidth && "w-full justify-between"
|
|
4895
|
+
),
|
|
4854
4896
|
children: [
|
|
4855
|
-
/* @__PURE__ */
|
|
4897
|
+
hideCaption ? /* @__PURE__ */ jsxs41("span", { className: "flex items-center gap-2", children: [
|
|
4898
|
+
icon && /* @__PURE__ */ jsx45("span", { className: "shrink-0 text-text-tertiary", children: icon }),
|
|
4899
|
+
value
|
|
4900
|
+
] }) : /* @__PURE__ */ jsx45(ChipContent, { caption, value, icon }),
|
|
4856
4901
|
/* @__PURE__ */ jsx45(
|
|
4857
4902
|
ChevronDown10,
|
|
4858
4903
|
{
|
|
@@ -4894,54 +4939,38 @@ function MultiSelectFilter({
|
|
|
4894
4939
|
groups ? visibleGroups.map((g) => {
|
|
4895
4940
|
const state = groupState(g);
|
|
4896
4941
|
return /* @__PURE__ */ jsxs41("div", { children: [
|
|
4897
|
-
|
|
4898
|
-
|
|
4899
|
-
|
|
4900
|
-
|
|
4901
|
-
|
|
4902
|
-
|
|
4903
|
-
|
|
4904
|
-
|
|
4905
|
-
|
|
4906
|
-
|
|
4907
|
-
|
|
4908
|
-
|
|
4909
|
-
|
|
4910
|
-
|
|
4911
|
-
|
|
4912
|
-
|
|
4913
|
-
|
|
4914
|
-
|
|
4915
|
-
|
|
4916
|
-
|
|
4917
|
-
|
|
4918
|
-
children: [
|
|
4919
|
-
/* @__PURE__ */ jsx45(CheckBoxBox, { checked }),
|
|
4920
|
-
/* @__PURE__ */ jsx45("span", { className: "flex-1 text-sm text-text-primary", children: labelled(c.id, c.label) }),
|
|
4921
|
-
counts && /* @__PURE__ */ jsx45(OptionCount, { n: countFor(c.id) })
|
|
4922
|
-
]
|
|
4923
|
-
},
|
|
4924
|
-
c.id
|
|
4925
|
-
);
|
|
4926
|
-
})
|
|
4942
|
+
row({
|
|
4943
|
+
key: g.id,
|
|
4944
|
+
onClick: () => toggleGroup(g),
|
|
4945
|
+
checked: state === "all",
|
|
4946
|
+
indeterminate: state === "some",
|
|
4947
|
+
label: labelled(g.id, g.label),
|
|
4948
|
+
count: counts && /* @__PURE__ */ jsx45(OptionCount, { n: countFor(g.id) }),
|
|
4949
|
+
bold: !plainParent,
|
|
4950
|
+
blocked: blockedGroup(g)
|
|
4951
|
+
}),
|
|
4952
|
+
g.children.map(
|
|
4953
|
+
(c) => row({
|
|
4954
|
+
key: c.id,
|
|
4955
|
+
onClick: () => toggle(c.id),
|
|
4956
|
+
checked: draft.includes(c.id),
|
|
4957
|
+
label: labelled(c.id, c.label),
|
|
4958
|
+
count: counts && /* @__PURE__ */ jsx45(OptionCount, { n: countFor(c.id) }),
|
|
4959
|
+
indent: true,
|
|
4960
|
+
blocked: blockedLeaf(c.id)
|
|
4961
|
+
})
|
|
4962
|
+
)
|
|
4927
4963
|
] }, g.id);
|
|
4928
|
-
}) : items.map(
|
|
4929
|
-
|
|
4930
|
-
|
|
4931
|
-
|
|
4932
|
-
|
|
4933
|
-
|
|
4934
|
-
|
|
4935
|
-
|
|
4936
|
-
|
|
4937
|
-
|
|
4938
|
-
/* @__PURE__ */ jsx45("span", { className: "flex-1 text-sm text-text-primary", children: labelled(o.id, o.label) }),
|
|
4939
|
-
counts && /* @__PURE__ */ jsx45(OptionCount, { n: countFor(o.id) })
|
|
4940
|
-
]
|
|
4941
|
-
},
|
|
4942
|
-
o.id
|
|
4943
|
-
);
|
|
4944
|
-
}),
|
|
4964
|
+
}) : items.map(
|
|
4965
|
+
(o) => row({
|
|
4966
|
+
key: o.id,
|
|
4967
|
+
onClick: () => toggle(o.id),
|
|
4968
|
+
checked: draft.includes(o.id),
|
|
4969
|
+
label: labelled(o.id, o.label),
|
|
4970
|
+
count: counts && /* @__PURE__ */ jsx45(OptionCount, { n: countFor(o.id) }),
|
|
4971
|
+
blocked: blockedLeaf(o.id)
|
|
4972
|
+
})
|
|
4973
|
+
),
|
|
4945
4974
|
(groups && !visibleGroups.length || !groups && !items.length) && /* @__PURE__ */ jsx45("div", { className: "py-6 text-center text-dense text-text-tertiary", children: "No matches." })
|
|
4946
4975
|
] }),
|
|
4947
4976
|
note && /* @__PURE__ */ jsx45("p", { className: "border-t border-border-default px-3 py-2 text-xs text-text-tertiary", children: note }),
|
|
@@ -5415,7 +5444,7 @@ function Drawer({ open, onClose, title, description, size = "sm", footer, childr
|
|
|
5415
5444
|
}
|
|
5416
5445
|
|
|
5417
5446
|
// src/DataTable.tsx
|
|
5418
|
-
import { Fragment as Fragment7, useEffect as
|
|
5447
|
+
import { Fragment as Fragment7, useEffect as useEffect18, useId as useId10, useLayoutEffect as useLayoutEffect6, useRef as useRef20, useState as useState19 } from "react";
|
|
5419
5448
|
import { ChevronRight as ChevronRight6 } from "lucide-react";
|
|
5420
5449
|
|
|
5421
5450
|
// src/numbers.ts
|
|
@@ -5474,10 +5503,89 @@ function formatPercent(value, _opts = {}) {
|
|
|
5474
5503
|
return text === "0.0" ? "0.0%" : `${sign(value)}${text}%`;
|
|
5475
5504
|
}
|
|
5476
5505
|
|
|
5506
|
+
// src/StickyBar.tsx
|
|
5507
|
+
import { useEffect as useEffect17, useRef as useRef19, useState as useState18 } from "react";
|
|
5508
|
+
import { jsx as jsx55 } from "react/jsx-runtime";
|
|
5509
|
+
function scrollParent(el) {
|
|
5510
|
+
if (typeof window === "undefined") return null;
|
|
5511
|
+
for (let p = el?.parentElement ?? null; p && p !== document.body && p !== document.documentElement; p = p.parentElement) {
|
|
5512
|
+
const y = window.getComputedStyle(p).overflowY;
|
|
5513
|
+
if (y === "auto" || y === "scroll" || y === "overlay") return p;
|
|
5514
|
+
}
|
|
5515
|
+
return null;
|
|
5516
|
+
}
|
|
5517
|
+
function viewportOf(root) {
|
|
5518
|
+
if (!root) return { top: 0, bottom: window.innerHeight };
|
|
5519
|
+
const r = root.getBoundingClientRect();
|
|
5520
|
+
return { top: r.top + root.clientTop, bottom: r.top + root.clientTop + root.clientHeight };
|
|
5521
|
+
}
|
|
5522
|
+
function scrollPadding(root) {
|
|
5523
|
+
if (!root) return { top: 0, bottom: 0 };
|
|
5524
|
+
const cs = window.getComputedStyle(root);
|
|
5525
|
+
return { top: parseFloat(cs.paddingTop) || 0, bottom: parseFloat(cs.paddingBottom) || 0 };
|
|
5526
|
+
}
|
|
5527
|
+
var STICKY_BAR_ATTR = "data-sticky-bar";
|
|
5528
|
+
function StickyBar({ children, className, testIdPrefix }) {
|
|
5529
|
+
const ref = useRef19(null);
|
|
5530
|
+
const [stuck, setStuck] = useState18(false);
|
|
5531
|
+
const [pad2, setPad] = useState18(0);
|
|
5532
|
+
const [edges, setEdges] = useState18({ left: 0, right: 0 });
|
|
5533
|
+
useEffect17(() => {
|
|
5534
|
+
const el = ref.current;
|
|
5535
|
+
const parent = el?.parentElement;
|
|
5536
|
+
if (!el || !parent) return void 0;
|
|
5537
|
+
let root = scrollParent(el);
|
|
5538
|
+
const update = () => setStuck(el.getBoundingClientRect().top <= viewportOf(root).top + 0.5 && (root ? root.scrollTop : window.scrollY) > 0);
|
|
5539
|
+
const resize = () => {
|
|
5540
|
+
root = scrollParent(el);
|
|
5541
|
+
setPad(scrollPadding(root).top);
|
|
5542
|
+
const pr = parent.getBoundingClientRect();
|
|
5543
|
+
const ps = window.getComputedStyle(parent);
|
|
5544
|
+
const colLeft = pr.left + parent.clientLeft + (parseFloat(ps.paddingLeft) || 0);
|
|
5545
|
+
const colRight = pr.left + parent.clientLeft + parent.clientWidth - (parseFloat(ps.paddingRight) || 0);
|
|
5546
|
+
const rr = root?.getBoundingClientRect();
|
|
5547
|
+
const boxLeft = root && rr ? rr.left + root.clientLeft : 0;
|
|
5548
|
+
const boxRight = root && rr ? rr.left + root.clientLeft + root.clientWidth : document.documentElement.clientWidth;
|
|
5549
|
+
const next = { left: Math.max(0, colLeft - boxLeft), right: Math.max(0, boxRight - colRight) };
|
|
5550
|
+
setEdges((prev) => prev.left === next.left && prev.right === next.right ? prev : next);
|
|
5551
|
+
update();
|
|
5552
|
+
};
|
|
5553
|
+
resize();
|
|
5554
|
+
document.addEventListener("scroll", update, { capture: true, passive: true });
|
|
5555
|
+
window.addEventListener("resize", resize);
|
|
5556
|
+
const ro = typeof ResizeObserver === "undefined" ? null : new ResizeObserver(resize);
|
|
5557
|
+
ro?.observe(parent);
|
|
5558
|
+
return () => {
|
|
5559
|
+
document.removeEventListener("scroll", update, { capture: true });
|
|
5560
|
+
window.removeEventListener("resize", resize);
|
|
5561
|
+
ro?.disconnect();
|
|
5562
|
+
};
|
|
5563
|
+
}, []);
|
|
5564
|
+
return /* @__PURE__ */ jsx55(
|
|
5565
|
+
"div",
|
|
5566
|
+
{
|
|
5567
|
+
ref,
|
|
5568
|
+
...{ [STICKY_BAR_ATTR]: "" },
|
|
5569
|
+
"data-stuck": stuck ? "" : void 0,
|
|
5570
|
+
"data-testid": testIdPrefix,
|
|
5571
|
+
className: cn("sticky top-0 z-10 border-b bg-canvas", stuck ? "border-border-default" : "border-transparent", className),
|
|
5572
|
+
style: {
|
|
5573
|
+
// At the very top of what scrolls, past the scroll box's own padding.
|
|
5574
|
+
top: pad2 ? -pad2 : void 0,
|
|
5575
|
+
// Stuck: a full-width band, edge to edge of the scroll box; the
|
|
5576
|
+
// filter bar inside stays where it was.
|
|
5577
|
+
...stuck && (edges.left || edges.right) ? { marginLeft: -edges.left, marginRight: -edges.right, paddingLeft: edges.left, paddingRight: edges.right } : null
|
|
5578
|
+
},
|
|
5579
|
+
children
|
|
5580
|
+
}
|
|
5581
|
+
);
|
|
5582
|
+
}
|
|
5583
|
+
|
|
5477
5584
|
// src/DataTable.tsx
|
|
5478
|
-
import { Fragment as Fragment8, jsx as
|
|
5585
|
+
import { Fragment as Fragment8, jsx as jsx56, jsxs as jsxs49 } from "react/jsx-runtime";
|
|
5479
5586
|
var WIDTH3 = { fill: "", sm: "w-24", md: "w-36", lg: "w-48" };
|
|
5480
5587
|
var MAX_H = { sm: "max-h-80", md: "max-h-120", lg: "max-h-160" };
|
|
5588
|
+
var SCROLLBAR = "[&::-webkit-scrollbar]:size-2 [&::-webkit-scrollbar-track]:bg-subtle [&::-webkit-scrollbar-corner]:bg-subtle [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-thumb]:bg-border-strong supports-[not_selector(::-webkit-scrollbar)]:[scrollbar-width:thin] supports-[not_selector(::-webkit-scrollbar)]:[scrollbar-color:var(--mr-color-border-strong)_var(--mr-color-subtle)]";
|
|
5481
5589
|
var HEAD_PAD = { default: "px-4 py-3", compact: "px-3 py-2" };
|
|
5482
5590
|
var CELL_PAD = { default: "px-4 py-3.5", compact: "px-3 py-2" };
|
|
5483
5591
|
var SUB_INDENT = { default: "pl-10", compact: "pl-9" };
|
|
@@ -5495,6 +5603,7 @@ function isDev() {
|
|
|
5495
5603
|
return false;
|
|
5496
5604
|
}
|
|
5497
5605
|
}
|
|
5606
|
+
var useBrowserLayoutEffect = typeof window === "undefined" ? useEffect18 : useLayoutEffect6;
|
|
5498
5607
|
function rowClickCounts(e) {
|
|
5499
5608
|
if (e.target.closest(OWN_CLICK)) return false;
|
|
5500
5609
|
const sel = window.getSelection?.();
|
|
@@ -5503,12 +5612,12 @@ function rowClickCounts(e) {
|
|
|
5503
5612
|
}
|
|
5504
5613
|
function NoValue({ reason = "No data" }) {
|
|
5505
5614
|
return /* @__PURE__ */ jsxs49(Tooltip, { label: reason, delay: 300, className: "text-text-tertiary", children: [
|
|
5506
|
-
/* @__PURE__ */
|
|
5507
|
-
/* @__PURE__ */
|
|
5615
|
+
/* @__PURE__ */ jsx56("span", { "aria-hidden": "true", children: NO_VALUE }),
|
|
5616
|
+
/* @__PURE__ */ jsx56("span", { className: "sr-only", children: reason })
|
|
5508
5617
|
] });
|
|
5509
5618
|
}
|
|
5510
5619
|
function TableLink({ className, ...props }) {
|
|
5511
|
-
return /* @__PURE__ */
|
|
5620
|
+
return /* @__PURE__ */ jsx56(
|
|
5512
5621
|
"a",
|
|
5513
5622
|
{
|
|
5514
5623
|
...props,
|
|
@@ -5556,26 +5665,29 @@ function DataTable({
|
|
|
5556
5665
|
refreshing = false,
|
|
5557
5666
|
onRetry,
|
|
5558
5667
|
empty,
|
|
5559
|
-
maxHeight,
|
|
5668
|
+
maxHeight: maxHeightProp,
|
|
5560
5669
|
footer,
|
|
5670
|
+
sticky = false,
|
|
5671
|
+
stickyTop,
|
|
5561
5672
|
className,
|
|
5562
5673
|
testIdPrefix,
|
|
5563
5674
|
...rest
|
|
5564
5675
|
}) {
|
|
5676
|
+
const maxHeight = sticky ? void 0 : maxHeightProp;
|
|
5565
5677
|
const titleId = useId10();
|
|
5566
5678
|
const showSkeleton = useDelayedLoading(loading);
|
|
5567
5679
|
const head = HEAD_PAD[density];
|
|
5568
5680
|
const pad2 = CELL_PAD[density];
|
|
5569
5681
|
const right = (c) => c.numeric || c.rank;
|
|
5570
5682
|
const align = (c) => right(c) ? "text-right" : "text-left";
|
|
5571
|
-
const width = (c) => c.rank ? "w-12" : WIDTH3[c.width ?? (c.numeric ? "md" : "fill")];
|
|
5683
|
+
const width = (c) => c.rank ? "w-12" : WIDTH3[c.width ?? (c.lead ? "sm" : c.numeric ? "md" : "fill")];
|
|
5572
5684
|
const shown = sort ?? defaultSort;
|
|
5573
5685
|
const onSort = (key) => {
|
|
5574
5686
|
const col = columns.find((c) => c.key === key);
|
|
5575
5687
|
onSortChange?.(cycleSort(shown, key, col?.firstDir ?? (right(col) ? "desc" : "asc"), defaultSort));
|
|
5576
5688
|
};
|
|
5577
5689
|
const clash = !!onRowClick && (!!renderExpandedProp || !!subRowsProp);
|
|
5578
|
-
|
|
5690
|
+
useEffect18(() => {
|
|
5579
5691
|
if (clash && isDev()) {
|
|
5580
5692
|
console.warn("DataTable: pass `onRowClick` or rows that open in place (`renderExpanded`, `subRows`), not both. The row click wins; rows won't open.");
|
|
5581
5693
|
}
|
|
@@ -5586,10 +5698,10 @@ function DataTable({
|
|
|
5586
5698
|
const kids = subRows?.(row);
|
|
5587
5699
|
return kids && kids.length > 0 ? kids : null;
|
|
5588
5700
|
};
|
|
5589
|
-
const [open, setOpen] =
|
|
5701
|
+
const [open, setOpen] = useState19(() => /* @__PURE__ */ new Set());
|
|
5590
5702
|
const visible = rows.map(rowKey);
|
|
5591
5703
|
const resetOn = subRows ? [...visible].sort().join("|") : `${shown?.key}|${shown?.dir}|${visible.join("|")}`;
|
|
5592
|
-
|
|
5704
|
+
useEffect18(() => setOpen(/* @__PURE__ */ new Set()), [resetOn]);
|
|
5593
5705
|
const expandable = (row) => (!!renderExpanded || !!childrenOf(row)) && (canExpand ? canExpand(row) : true);
|
|
5594
5706
|
const anyExpandable = (!!renderExpanded || !!subRows) && rows.some(expandable);
|
|
5595
5707
|
const toggle = (key) => setOpen((prev) => {
|
|
@@ -5610,8 +5722,8 @@ function DataTable({
|
|
|
5610
5722
|
pickable.forEach((k) => allVisible ? next.delete(k) : next.add(k));
|
|
5611
5723
|
setPicked(next);
|
|
5612
5724
|
};
|
|
5613
|
-
const lastPicked =
|
|
5614
|
-
const shiftHeld =
|
|
5725
|
+
const lastPicked = useRef20(null);
|
|
5726
|
+
const shiftHeld = useRef20(false);
|
|
5615
5727
|
const togglePick = (index) => {
|
|
5616
5728
|
const key = visible[index];
|
|
5617
5729
|
const on = !picked.has(key);
|
|
@@ -5628,12 +5740,12 @@ function DataTable({
|
|
|
5628
5740
|
};
|
|
5629
5741
|
const count = selectedCount ?? picked.size;
|
|
5630
5742
|
const barCount = selectable && selectionBar ? count : 0;
|
|
5631
|
-
const scroller =
|
|
5632
|
-
const [pinned, setPinned] =
|
|
5633
|
-
const [scrolled, setScrolled] =
|
|
5634
|
-
const heads =
|
|
5635
|
-
const [lefts, setLefts] =
|
|
5636
|
-
|
|
5743
|
+
const scroller = useRef20(null);
|
|
5744
|
+
const [pinned, setPinned] = useState19(false);
|
|
5745
|
+
const [scrolled, setScrolled] = useState19(false);
|
|
5746
|
+
const heads = useRef20(/* @__PURE__ */ new Map());
|
|
5747
|
+
const [lefts, setLefts] = useState19({});
|
|
5748
|
+
useEffect18(() => {
|
|
5637
5749
|
const el = scroller.current;
|
|
5638
5750
|
if (!el || typeof ResizeObserver === "undefined") return void 0;
|
|
5639
5751
|
const measure = () => {
|
|
@@ -5653,7 +5765,7 @@ function DataTable({
|
|
|
5653
5765
|
if (el.firstElementChild) ro.observe(el.firstElementChild);
|
|
5654
5766
|
return () => ro.disconnect();
|
|
5655
5767
|
}, []);
|
|
5656
|
-
const nameIdx = Math.max(0, columns.findIndex((c) => !c.rank));
|
|
5768
|
+
const nameIdx = Math.max(0, columns.findIndex((c) => !c.rank && !c.lead));
|
|
5657
5769
|
const leftOf = (part) => lefts[String(part)] ?? 0;
|
|
5658
5770
|
const headRef = (part) => (el) => {
|
|
5659
5771
|
if (el) heads.current.set(String(part), el);
|
|
@@ -5666,13 +5778,81 @@ function DataTable({
|
|
|
5666
5778
|
part === nameIdx && "max-w-60 border-r border-r-border-default"
|
|
5667
5779
|
) : "";
|
|
5668
5780
|
const pinStyle = (part) => isPinned(part) ? { left: leftOf(part) } : void 0;
|
|
5669
|
-
const edge = (part) => pinned && scrolled && part === nameIdx ? /* @__PURE__ */
|
|
5781
|
+
const edge = (part) => pinned && scrolled && part === nameIdx ? /* @__PURE__ */ jsx56("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
5782
|
const span = columns.length + (anyExpandable ? 1 : 0) + (selectable ? 1 : 0);
|
|
5783
|
+
const wrapRef = useRef20(null);
|
|
5784
|
+
const theadRef = useRef20(null);
|
|
5785
|
+
const cloneRef = useRef20(null);
|
|
5786
|
+
const [stuck, setStuck] = useState19(false);
|
|
5787
|
+
const [geom, setGeom] = useState19({ cols: [], width: 0, height: 0 });
|
|
5788
|
+
const [barH, setBarH] = useState19(0);
|
|
5789
|
+
const [scrollPad, setScrollPad] = useState19({ top: 0, bottom: 0 });
|
|
5790
|
+
const [footerStuck, setFooterStuck] = useState19(false);
|
|
5791
|
+
const [scrolledDown, setScrolledDown] = useState19(false);
|
|
5792
|
+
const [animate, setAnimate] = useState19(false);
|
|
5793
|
+
useEffect18(() => {
|
|
5794
|
+
const thead = theadRef.current;
|
|
5795
|
+
if (!sticky || !thead || typeof ResizeObserver === "undefined") return void 0;
|
|
5796
|
+
const measure = () => {
|
|
5797
|
+
const cells = [...thead.rows[0]?.cells ?? []];
|
|
5798
|
+
const next = { cols: cells.map((c) => c.getBoundingClientRect().width), width: thead.getBoundingClientRect().width, height: thead.getBoundingClientRect().height };
|
|
5799
|
+
setGeom((prev) => prev.width === next.width && prev.height === next.height && prev.cols.join() === next.cols.join() ? prev : next);
|
|
5800
|
+
};
|
|
5801
|
+
measure();
|
|
5802
|
+
const ro = new ResizeObserver(measure);
|
|
5803
|
+
ro.observe(thead);
|
|
5804
|
+
for (const c of thead.rows[0]?.cells ?? []) ro.observe(c);
|
|
5805
|
+
return () => ro.disconnect();
|
|
5806
|
+
}, [sticky, span]);
|
|
5807
|
+
useBrowserLayoutEffect(() => {
|
|
5808
|
+
const wrap = wrapRef.current;
|
|
5809
|
+
if (!sticky || !wrap) return void 0;
|
|
5810
|
+
let root = scrollParent(wrap);
|
|
5811
|
+
const bar2 = (root ?? document).querySelector(`[${STICKY_BAR_ATTR}]`) ?? document.querySelector(`[${STICKY_BAR_ATTR}]`);
|
|
5812
|
+
const update = () => {
|
|
5813
|
+
const thead = theadRef.current;
|
|
5814
|
+
const clone = cloneRef.current;
|
|
5815
|
+
if (thead && clone) setStuck(clone.getBoundingClientRect().top > thead.getBoundingClientRect().top + 0.5);
|
|
5816
|
+
setFooterStuck(wrap.getBoundingClientRect().bottom > viewportOf(root).bottom + 1);
|
|
5817
|
+
setScrolledDown((root ? root.scrollTop : window.scrollY) > 0);
|
|
5818
|
+
};
|
|
5819
|
+
const measure = () => {
|
|
5820
|
+
root = scrollParent(wrap);
|
|
5821
|
+
setBarH(bar2 ? bar2.getBoundingClientRect().height : 0);
|
|
5822
|
+
setScrollPad((prev) => {
|
|
5823
|
+
const next = scrollPadding(root);
|
|
5824
|
+
return prev.top === next.top && prev.bottom === next.bottom ? prev : next;
|
|
5825
|
+
});
|
|
5826
|
+
update();
|
|
5827
|
+
};
|
|
5828
|
+
measure();
|
|
5829
|
+
const raf = requestAnimationFrame(() => setAnimate(true));
|
|
5830
|
+
document.addEventListener("scroll", update, { capture: true, passive: true });
|
|
5831
|
+
window.addEventListener("resize", measure);
|
|
5832
|
+
const ro = typeof ResizeObserver === "undefined" ? null : new ResizeObserver(measure);
|
|
5833
|
+
if (bar2) ro?.observe(bar2);
|
|
5834
|
+
ro?.observe(wrap);
|
|
5835
|
+
return () => {
|
|
5836
|
+
cancelAnimationFrame(raf);
|
|
5837
|
+
document.removeEventListener("scroll", update, { capture: true });
|
|
5838
|
+
window.removeEventListener("resize", measure);
|
|
5839
|
+
ro?.disconnect();
|
|
5840
|
+
};
|
|
5841
|
+
}, [sticky]);
|
|
5842
|
+
useEffect18(() => {
|
|
5843
|
+
const clone = cloneRef.current;
|
|
5844
|
+
if (!clone) return;
|
|
5845
|
+
clone.querySelectorAll("button, a[href], input, [tabindex]").forEach((el) => {
|
|
5846
|
+
if (el.tabIndex !== -1) el.tabIndex = -1;
|
|
5847
|
+
});
|
|
5848
|
+
if (scroller.current) clone.scrollLeft = scroller.current.scrollLeft;
|
|
5849
|
+
});
|
|
5850
|
+
const top = (stickyTop ?? barH) - scrollPad.top;
|
|
5671
5851
|
const renderCell = (c, row) => {
|
|
5672
5852
|
const v = c.cell(row);
|
|
5673
|
-
return v === null || v === void 0 || v === "" ? /* @__PURE__ */
|
|
5853
|
+
return v === null || v === void 0 || v === "" ? /* @__PURE__ */ jsx56(NoValue, { reason: c.missing }) : v;
|
|
5674
5854
|
};
|
|
5675
|
-
const fit = (ci, content) => pinned && ci === nameIdx ? /* @__PURE__ */
|
|
5855
|
+
const fit = (ci, content) => pinned && ci === nameIdx ? /* @__PURE__ */ jsx56(Tooltip, { label: content, whenTruncated: true, delay: 300, className: "block truncate", children: content }) : content;
|
|
5676
5856
|
const colBg = (c, rowBg) => c.highlight ? TINT : rowBg;
|
|
5677
5857
|
const firstPart = selectable ? "select" : anyExpandable ? "expand" : 0;
|
|
5678
5858
|
const ringCls = (part) => onRowClick ? cn(
|
|
@@ -5683,8 +5863,8 @@ function DataTable({
|
|
|
5683
5863
|
pinned && scrolled && part === nameIdx && part !== columns.length - 1 && RING_PAST_EDGE
|
|
5684
5864
|
) : "";
|
|
5685
5865
|
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__ */
|
|
5687
|
-
anyExpandable && /* @__PURE__ */
|
|
5866
|
+
selectable && /* @__PURE__ */ jsx56("td", { className: cn("border-b border-border-default pr-0", pad2, rowBg, pinCls("select", "body", rowBg)), style: pinStyle("select") }),
|
|
5867
|
+
anyExpandable && /* @__PURE__ */ jsx56("td", { className: cn("border-b border-border-default pr-0", pad2, rowBg, pinCls("expand", "body", rowBg)), style: pinStyle("expand") }),
|
|
5688
5868
|
columns.map((c, ci) => {
|
|
5689
5869
|
const bg = kind === "sub" ? colBg(c, rowBg) : rowBg;
|
|
5690
5870
|
const isName = ci === nameIdx;
|
|
@@ -5703,7 +5883,7 @@ function DataTable({
|
|
|
5703
5883
|
),
|
|
5704
5884
|
style: pinStyle(ci),
|
|
5705
5885
|
children: [
|
|
5706
|
-
c.rank ? null : isName && kind === "total" ? fit(ci, totalsLabel) : kind === "total" ? /* @__PURE__ */
|
|
5886
|
+
c.rank || c.lead ? null : isName && kind === "total" ? fit(ci, totalsLabel) : kind === "total" ? /* @__PURE__ */ jsx56(DeltaBoldContext.Provider, { value: true, children: fit(ci, renderCell(c, row)) }) : fit(ci, renderCell(c, row)),
|
|
5707
5887
|
kind === "sub" && isName && rowLabel && extra?.parent !== void 0 && /* @__PURE__ */ jsxs49("span", { className: "sr-only", children: [
|
|
5708
5888
|
", in ",
|
|
5709
5889
|
rowLabel(extra.parent)
|
|
@@ -5715,6 +5895,53 @@ function DataTable({
|
|
|
5715
5895
|
);
|
|
5716
5896
|
})
|
|
5717
5897
|
] }, key);
|
|
5898
|
+
const headRow = (clone) => /* @__PURE__ */ jsxs49("tr", { className: "bg-subtle text-micro font-semibold uppercase tracking-wider text-text-secondary", children: [
|
|
5899
|
+
selectable && /* @__PURE__ */ jsx56("th", { ref: clone ? void 0 : 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__ */ jsx56(
|
|
5900
|
+
CheckBox,
|
|
5901
|
+
{
|
|
5902
|
+
checked: allVisible,
|
|
5903
|
+
indeterminate: someVisible && !allVisible,
|
|
5904
|
+
onChange: toggleAllVisible,
|
|
5905
|
+
disabled: pickable.length === 0,
|
|
5906
|
+
ariaLabel: allVisible ? "Deselect all rows on this page" : "Select all rows on this page"
|
|
5907
|
+
}
|
|
5908
|
+
) : /* @__PURE__ */ jsx56("span", { className: "sr-only", children: "Select" }) }),
|
|
5909
|
+
anyExpandable && /* @__PURE__ */ jsx56("th", { ref: clone ? void 0 : headRef("expand"), scope: "col", className: cn("w-10 border-b border-border-default", head, pinCls("expand", "head")), style: pinStyle("expand"), children: /* @__PURE__ */ jsx56("span", { className: "sr-only", children: "Details" }) }),
|
|
5910
|
+
columns.map((c, ci) => /* @__PURE__ */ jsxs49(
|
|
5911
|
+
"th",
|
|
5912
|
+
{
|
|
5913
|
+
ref: !clone && ci <= nameIdx ? headRef(ci) : void 0,
|
|
5914
|
+
scope: "col",
|
|
5915
|
+
"aria-sort": c.sortable ? ariaSortFor(shown, c.key) : void 0,
|
|
5916
|
+
className: cn(
|
|
5917
|
+
"group/head whitespace-nowrap border-b border-border-default font-semibold",
|
|
5918
|
+
head,
|
|
5919
|
+
align(c),
|
|
5920
|
+
width(c),
|
|
5921
|
+
c.highlight && TINT,
|
|
5922
|
+
pinCls(ci, "head", c.highlight ? TINT : void 0)
|
|
5923
|
+
),
|
|
5924
|
+
style: pinStyle(ci),
|
|
5925
|
+
children: [
|
|
5926
|
+
c.sortable && onSortChange ? /* @__PURE__ */ jsx56(
|
|
5927
|
+
SortButton,
|
|
5928
|
+
{
|
|
5929
|
+
label: c.label,
|
|
5930
|
+
sortKey: c.key,
|
|
5931
|
+
align: right(c) ? "right" : "left",
|
|
5932
|
+
sort: sortProp(shown),
|
|
5933
|
+
onSort,
|
|
5934
|
+
description: c.info,
|
|
5935
|
+
testIdPrefix: clone ? void 0 : testIdPrefix
|
|
5936
|
+
}
|
|
5937
|
+
) : c.info ? /* @__PURE__ */ jsx56(SortButton, { label: c.label, sortKey: c.key, sortable: false, sort: sortProp(shown), onSort: () => {
|
|
5938
|
+
}, description: c.info, align: right(c) ? "right" : "left" }) : c.label,
|
|
5939
|
+
edge(ci)
|
|
5940
|
+
]
|
|
5941
|
+
},
|
|
5942
|
+
c.key
|
|
5943
|
+
))
|
|
5944
|
+
] });
|
|
5718
5945
|
const inside = variant === "chart";
|
|
5719
5946
|
const bar = barCount > 0 ? /* @__PURE__ */ jsxs49("div", { className: "flex flex-wrap items-center gap-x-3 gap-y-1 text-dense", children: [
|
|
5720
5947
|
/* @__PURE__ */ jsxs49("span", { role: "status", className: "font-medium text-text-primary", children: [
|
|
@@ -5726,220 +5953,226 @@ function DataTable({
|
|
|
5726
5953
|
formatCountFull(totalCount)
|
|
5727
5954
|
] }),
|
|
5728
5955
|
selectionActions,
|
|
5729
|
-
/* @__PURE__ */
|
|
5956
|
+
/* @__PURE__ */ jsx56(Button, { variant: "link", size: "sm", onClick: () => onSelectedChange?.([]), children: "Clear" })
|
|
5730
5957
|
] }) : null;
|
|
5958
|
+
const scrollArea = /* @__PURE__ */ jsx56(
|
|
5959
|
+
"div",
|
|
5960
|
+
{
|
|
5961
|
+
ref: scroller,
|
|
5962
|
+
onScroll: (e) => {
|
|
5963
|
+
setScrolled(e.currentTarget.scrollLeft > 0);
|
|
5964
|
+
if (cloneRef.current) cloneRef.current.scrollLeft = e.currentTarget.scrollLeft;
|
|
5965
|
+
},
|
|
5966
|
+
className: cn("overflow-x-auto", SCROLLBAR, maxHeight && cn("overflow-y-auto", MAX_H[maxHeight])),
|
|
5967
|
+
children: /* @__PURE__ */ jsxs49(
|
|
5968
|
+
"table",
|
|
5969
|
+
{
|
|
5970
|
+
"aria-labelledby": title ? titleId : void 0,
|
|
5971
|
+
"aria-label": title ? void 0 : rest["aria-label"],
|
|
5972
|
+
"aria-busy": loading || refreshing || void 0,
|
|
5973
|
+
className: "w-full border-separate border-spacing-0 text-left",
|
|
5974
|
+
children: [
|
|
5975
|
+
/* @__PURE__ */ jsx56("thead", { ref: theadRef, className: cn(maxHeight && "sticky top-0 z-10"), children: headRow(false) }),
|
|
5976
|
+
/* @__PURE__ */ jsx56("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: [
|
|
5977
|
+
selectable && /* @__PURE__ */ jsx56("td", { className: cn("border-b border-border-default", pad2) }),
|
|
5978
|
+
anyExpandable && /* @__PURE__ */ jsx56("td", { className: cn("border-b border-border-default", pad2) }),
|
|
5979
|
+
columns.map((c) => /* @__PURE__ */ jsx56("td", { className: cn("border-b border-border-default", pad2, align(c)), children: showSkeleton ? /* @__PURE__ */ jsx56(Skeleton, { className: cn("inline-block", right(c) ? "w-12" : "w-2/3") }) : /* @__PURE__ */ jsx56("span", { className: "inline-block h-3" }) }, c.key))
|
|
5980
|
+
] }, i)) : rows.length === 0 ? /* @__PURE__ */ jsx56("tr", { children: /* @__PURE__ */ jsx56("td", { colSpan: span, className: "px-6 py-12", children: empty ?? /* @__PURE__ */ jsx56(NoResultsEmptyState, {}) }) }) : /* @__PURE__ */ jsxs49(Fragment8, { children: [
|
|
5981
|
+
totalsRow !== void 0 && plainRow("total", totalsRow, "__totals", "bg-subtle"),
|
|
5982
|
+
rows.map((row, ri) => {
|
|
5983
|
+
const key = rowKey(row);
|
|
5984
|
+
const canOpen = expandable(row);
|
|
5985
|
+
const kids = canOpen ? childrenOf(row) : null;
|
|
5986
|
+
const isOpen = canOpen && open.has(key);
|
|
5987
|
+
const panelOpen = isOpen && !kids;
|
|
5988
|
+
const panelId = `${titleId}-row-${ri}`;
|
|
5989
|
+
const kidIds = kids ? kids.map((_, si) => `${panelId}-${si}`) : [];
|
|
5990
|
+
const rowBg = highlightRow?.(row) ? cn(TINT, onRowClick && TINT_HOVER) : panelOpen ? "bg-subtle" : void 0;
|
|
5991
|
+
const reason = selectable ? blocked(row) : false;
|
|
5992
|
+
const ticked = picked.has(key);
|
|
5993
|
+
const label = rowLabel ? rowLabel(row) : "row";
|
|
5994
|
+
const clickable = !!onRowClick || canOpen;
|
|
5995
|
+
return /* @__PURE__ */ jsxs49(Fragment7, { children: [
|
|
5996
|
+
/* @__PURE__ */ jsxs49(
|
|
5997
|
+
"tr",
|
|
5998
|
+
{
|
|
5999
|
+
onClick: onRowClick ? (e) => rowClickCounts(e) && onRowClick(row) : canOpen ? (e) => rowClickCounts(e) && toggle(key) : void 0,
|
|
6000
|
+
className: cn(
|
|
6001
|
+
"group/row hover:bg-subtle [&:last-child>td]:border-b-0",
|
|
6002
|
+
clickable && "cursor-pointer",
|
|
6003
|
+
panelOpen && "bg-subtle"
|
|
6004
|
+
// The row's hidden open button has keyboard focus: ring the whole row.
|
|
6005
|
+
),
|
|
6006
|
+
children: [
|
|
6007
|
+
selectable && /* @__PURE__ */ jsx56(
|
|
6008
|
+
"td",
|
|
6009
|
+
{
|
|
6010
|
+
onPointerDownCapture: (e) => shiftHeld.current = e.shiftKey,
|
|
6011
|
+
onKeyDownCapture: (e) => shiftHeld.current = e.shiftKey,
|
|
6012
|
+
className: cn("border-b border-border-default pr-0", pad2, panelOpen && "border-b-0", rowBg, ringCls("select"), pinCls("select", "body", rowBg)),
|
|
6013
|
+
style: pinStyle("select"),
|
|
6014
|
+
children: reason ? /* @__PURE__ */ jsx56(Tooltip, { label: reason, delay: 300, className: "inline-flex align-middle", children: /* @__PURE__ */ jsx56(
|
|
6015
|
+
"button",
|
|
6016
|
+
{
|
|
6017
|
+
type: "button",
|
|
6018
|
+
role: "checkbox",
|
|
6019
|
+
"aria-checked": ticked,
|
|
6020
|
+
"aria-disabled": "true",
|
|
6021
|
+
"aria-label": `Select ${label}`,
|
|
6022
|
+
onClick: (e) => e.preventDefault(),
|
|
6023
|
+
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",
|
|
6024
|
+
children: /* @__PURE__ */ jsx56(CheckBoxBox, { checked: ticked, disabled: true })
|
|
6025
|
+
}
|
|
6026
|
+
) }) : /* @__PURE__ */ jsx56(CheckBox, { checked: ticked, onChange: () => togglePick(ri), ariaLabel: `Select ${label}` })
|
|
6027
|
+
}
|
|
6028
|
+
),
|
|
6029
|
+
anyExpandable && /* @__PURE__ */ jsx56(
|
|
6030
|
+
"td",
|
|
6031
|
+
{
|
|
6032
|
+
className: cn("border-b border-border-default pr-0", pad2, panelOpen && "border-b-0", rowBg, ringCls("expand"), pinCls("expand", "body", rowBg)),
|
|
6033
|
+
style: pinStyle("expand"),
|
|
6034
|
+
children: canOpen && /* @__PURE__ */ jsx56(
|
|
6035
|
+
"button",
|
|
6036
|
+
{
|
|
6037
|
+
type: "button",
|
|
6038
|
+
"aria-expanded": isOpen,
|
|
6039
|
+
"aria-controls": isOpen ? kids ? kidIds.join(" ") : panelId : void 0,
|
|
6040
|
+
"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)}` : ""}`,
|
|
6041
|
+
onClick: () => toggle(key),
|
|
6042
|
+
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",
|
|
6043
|
+
children: /* @__PURE__ */ jsx56(
|
|
6044
|
+
ChevronRight6,
|
|
6045
|
+
{
|
|
6046
|
+
size: 16,
|
|
6047
|
+
"aria-hidden": "true",
|
|
6048
|
+
className: cn("transition-transform motion-reduce:transition-none", isOpen && "rotate-90")
|
|
6049
|
+
}
|
|
6050
|
+
)
|
|
6051
|
+
}
|
|
6052
|
+
)
|
|
6053
|
+
}
|
|
6054
|
+
),
|
|
6055
|
+
columns.map((c, ci) => {
|
|
6056
|
+
const bg = colBg(c, rowBg);
|
|
6057
|
+
const opener = !!onRowClick && ci === nameIdx;
|
|
6058
|
+
return /* @__PURE__ */ jsxs49(
|
|
6059
|
+
"td",
|
|
6060
|
+
{
|
|
6061
|
+
className: cn(
|
|
6062
|
+
"border-b border-border-default",
|
|
6063
|
+
pad2,
|
|
6064
|
+
align(c),
|
|
6065
|
+
right(c) && "tabular-nums",
|
|
6066
|
+
c.rank && "text-text-tertiary",
|
|
6067
|
+
panelOpen && "border-b-0",
|
|
6068
|
+
ringCls(ci),
|
|
6069
|
+
bg,
|
|
6070
|
+
pinCls(ci, "body", bg)
|
|
6071
|
+
),
|
|
6072
|
+
style: pinStyle(ci),
|
|
6073
|
+
children: [
|
|
6074
|
+
fit(ci, renderCell(c, row)),
|
|
6075
|
+
opener && // The keyboard's and screen reader's way to the row click. It
|
|
6076
|
+
// stays hidden; while it has focus the whole row takes the ring.
|
|
6077
|
+
/* @__PURE__ */ jsx56("button", { type: "button", "data-row-open": "", onClick: () => onRowClick(row), className: "sr-only", children: rowClickLabel ? rowClickLabel(row) : `Open ${rowLabel ? rowLabel(row) : "row"}` }),
|
|
6078
|
+
edge(ci)
|
|
6079
|
+
]
|
|
6080
|
+
},
|
|
6081
|
+
c.key
|
|
6082
|
+
);
|
|
6083
|
+
})
|
|
6084
|
+
]
|
|
6085
|
+
}
|
|
6086
|
+
),
|
|
6087
|
+
panelOpen && /* @__PURE__ */ jsx56("tr", { className: "[&:last-child>td]:border-b-0", children: /* @__PURE__ */ jsx56("td", { id: panelId, colSpan: span, className: "border-b border-border-default bg-subtle px-4 pb-4 pl-14", children: renderExpanded(row) }) }),
|
|
6088
|
+
isOpen && kids?.map(
|
|
6089
|
+
(child, si) => plainRow("sub", child, `${key}::${rowKey(child)}`, highlightRow?.(child) ? TINT : "bg-subtle", { id: kidIds[si], parent: row })
|
|
6090
|
+
)
|
|
6091
|
+
] }, key);
|
|
6092
|
+
})
|
|
6093
|
+
] }) })
|
|
6094
|
+
]
|
|
6095
|
+
}
|
|
6096
|
+
)
|
|
6097
|
+
}
|
|
6098
|
+
);
|
|
6099
|
+
const bare = inside || !title && barCount === 0;
|
|
5731
6100
|
const frame = /* @__PURE__ */ jsxs49(
|
|
5732
6101
|
"div",
|
|
5733
6102
|
{
|
|
5734
|
-
className: cn(
|
|
6103
|
+
className: cn(
|
|
6104
|
+
"relative flex w-full flex-col rounded-card border border-border-default bg-surface",
|
|
6105
|
+
// clip, not hidden, on a sticky table: hidden would make the frame the
|
|
6106
|
+
// box its header sticks in, instead of the page.
|
|
6107
|
+
sticky ? "overflow-clip" : "overflow-hidden",
|
|
6108
|
+
!sticky && bare && className
|
|
6109
|
+
),
|
|
5735
6110
|
"data-testid": testIdPrefix,
|
|
5736
6111
|
children: [
|
|
5737
6112
|
title && inside && /* @__PURE__ */ jsxs49("div", { className: "flex items-start justify-between gap-2 p-card-padding", children: [
|
|
5738
6113
|
/* @__PURE__ */ jsxs49("div", { className: "min-w-0", children: [
|
|
5739
|
-
/* @__PURE__ */
|
|
5740
|
-
subtitle && /* @__PURE__ */
|
|
6114
|
+
/* @__PURE__ */ jsx56("h3", { id: titleId, className: "text-panel-title font-semibold text-text-primary", children: title }),
|
|
6115
|
+
subtitle && /* @__PURE__ */ jsx56("p", { className: "mt-0.5 text-xs leading-snug text-text-tertiary", children: subtitle })
|
|
5741
6116
|
] }),
|
|
5742
|
-
(bar ?? action) && /* @__PURE__ */
|
|
6117
|
+
(bar ?? action) && /* @__PURE__ */ jsx56("div", { className: "shrink-0 text-text-tertiary", children: bar ?? action })
|
|
5743
6118
|
] }),
|
|
5744
|
-
|
|
5745
|
-
|
|
5746
|
-
{
|
|
5747
|
-
|
|
5748
|
-
|
|
5749
|
-
className: cn("overflow-x-auto", maxHeight && cn("overflow-y-auto", MAX_H[maxHeight])),
|
|
5750
|
-
children: /* @__PURE__ */ jsxs49(
|
|
5751
|
-
"table",
|
|
6119
|
+
sticky ? (
|
|
6120
|
+
// The copy of the header sticks within this box, so it leaves with the last row.
|
|
6121
|
+
/* @__PURE__ */ jsxs49("div", { className: "relative", children: [
|
|
6122
|
+
/* @__PURE__ */ jsx56(
|
|
6123
|
+
"div",
|
|
5752
6124
|
{
|
|
5753
|
-
|
|
5754
|
-
"aria-
|
|
5755
|
-
"
|
|
5756
|
-
|
|
5757
|
-
|
|
5758
|
-
|
|
5759
|
-
|
|
5760
|
-
|
|
5761
|
-
|
|
5762
|
-
|
|
5763
|
-
|
|
5764
|
-
|
|
5765
|
-
disabled: pickable.length === 0,
|
|
5766
|
-
ariaLabel: allVisible ? "Deselect all rows on this page" : "Select all rows on this page"
|
|
5767
|
-
}
|
|
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",
|
|
5827
|
-
{
|
|
5828
|
-
onClick: onRowClick ? (e) => rowClickCounts(e) && onRowClick(row) : canOpen ? (e) => rowClickCounts(e) && toggle(key) : void 0,
|
|
5829
|
-
className: cn(
|
|
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.
|
|
5834
|
-
),
|
|
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
|
-
]
|
|
6125
|
+
ref: cloneRef,
|
|
6126
|
+
"aria-hidden": "true",
|
|
6127
|
+
"data-sticky-head": "",
|
|
6128
|
+
onWheel: (e) => {
|
|
6129
|
+
if (scroller.current && Math.abs(e.deltaX) > Math.abs(e.deltaY)) scroller.current.scrollLeft += e.deltaX;
|
|
6130
|
+
},
|
|
6131
|
+
className: "sticky z-2 overflow-hidden",
|
|
6132
|
+
style: { top, height: geom.height, marginBottom: -geom.height, visibility: stuck ? "visible" : "hidden" },
|
|
6133
|
+
children: /* @__PURE__ */ jsxs49("table", { className: "table-fixed border-separate border-spacing-0 text-left", style: { width: geom.width }, children: [
|
|
6134
|
+
/* @__PURE__ */ jsx56("colgroup", { children: geom.cols.map((w, i) => /* @__PURE__ */ jsx56("col", { style: { width: w } }, i)) }),
|
|
6135
|
+
/* @__PURE__ */ jsx56("thead", { children: headRow(true) })
|
|
6136
|
+
] })
|
|
5924
6137
|
}
|
|
5925
|
-
)
|
|
5926
|
-
|
|
5927
|
-
|
|
5928
|
-
|
|
5929
|
-
/* @__PURE__ */
|
|
5930
|
-
|
|
6138
|
+
),
|
|
6139
|
+
scrollArea
|
|
6140
|
+
] })
|
|
6141
|
+
) : scrollArea,
|
|
6142
|
+
refreshing && !loading && /* @__PURE__ */ jsx56(RefreshLine, {}),
|
|
6143
|
+
/* @__PURE__ */ jsx56(LongWait, { loading, onRetry, className: "mb-3 px-4" }),
|
|
6144
|
+
footer && !sticky && /* @__PURE__ */ jsx56("div", { className: "border-t border-border-default px-4 py-3", children: footer })
|
|
5931
6145
|
]
|
|
5932
6146
|
}
|
|
5933
6147
|
);
|
|
5934
|
-
|
|
6148
|
+
const hideFooter = footerStuck && !scrolledDown;
|
|
6149
|
+
const body = sticky ? /* @__PURE__ */ jsxs49("div", { ref: wrapRef, className: cn("flex w-full flex-col", bare && className), children: [
|
|
6150
|
+
frame,
|
|
6151
|
+
footer && /* @__PURE__ */ jsx56(
|
|
6152
|
+
"div",
|
|
6153
|
+
{
|
|
6154
|
+
"data-sticky-footer": "",
|
|
6155
|
+
style: scrollPad.bottom ? { bottom: -scrollPad.bottom } : void 0,
|
|
6156
|
+
className: cn(
|
|
6157
|
+
"sticky bottom-0 z-3 border-t bg-canvas py-3",
|
|
6158
|
+
footerStuck ? "border-border-default" : "border-transparent",
|
|
6159
|
+
animate && "transition-[opacity,translate] duration-(--mr-motion-duration-interactive) ease-interactive motion-reduce:transition-none",
|
|
6160
|
+
// Hidden, not gone: Tab still reaches it, and focus shows it.
|
|
6161
|
+
hideFooter && "pointer-events-none translate-y-full opacity-0 focus-within:pointer-events-auto focus-within:translate-y-0 focus-within:opacity-100"
|
|
6162
|
+
),
|
|
6163
|
+
children: footer
|
|
6164
|
+
}
|
|
6165
|
+
)
|
|
6166
|
+
] }) : frame;
|
|
6167
|
+
if (bare) return body;
|
|
5935
6168
|
return /* @__PURE__ */ jsxs49("section", { "aria-labelledby": title ? titleId : void 0, className: cn("flex w-full flex-col gap-3", className), children: [
|
|
5936
|
-
title ? /* @__PURE__ */
|
|
5937
|
-
|
|
6169
|
+
title ? /* @__PURE__ */ jsx56(SectionHeading, { id: titleId, as: titleAs, title, description: subtitle, actions: bar ?? action }) : /* @__PURE__ */ jsx56("div", { className: "flex justify-end", children: bar }),
|
|
6170
|
+
body
|
|
5938
6171
|
] });
|
|
5939
6172
|
}
|
|
5940
6173
|
|
|
5941
6174
|
// src/MediaLabel.tsx
|
|
5942
|
-
import { jsx as
|
|
6175
|
+
import { jsx as jsx57 } from "react/jsx-runtime";
|
|
5943
6176
|
var FILL = {
|
|
5944
6177
|
TV: "bg-media-tv",
|
|
5945
6178
|
CTV: "bg-media-ctv",
|
|
@@ -5950,7 +6183,7 @@ var FILL = {
|
|
|
5950
6183
|
Magazine: "bg-media-magazine"
|
|
5951
6184
|
};
|
|
5952
6185
|
function MediaLabel({ type, className, testIdPrefix }) {
|
|
5953
|
-
return /* @__PURE__ */
|
|
6186
|
+
return /* @__PURE__ */ jsx57(
|
|
5954
6187
|
"span",
|
|
5955
6188
|
{
|
|
5956
6189
|
className: cn(
|
|
@@ -5966,9 +6199,9 @@ function MediaLabel({ type, className, testIdPrefix }) {
|
|
|
5966
6199
|
|
|
5967
6200
|
// src/SuggestionChip.tsx
|
|
5968
6201
|
import { forwardRef as forwardRef10 } from "react";
|
|
5969
|
-
import { jsx as
|
|
6202
|
+
import { jsx as jsx58 } from "react/jsx-runtime";
|
|
5970
6203
|
var SuggestionChip = forwardRef10(function SuggestionChip2({ children, className, testIdPrefix, type = "button", ...props }, ref) {
|
|
5971
|
-
return /* @__PURE__ */
|
|
6204
|
+
return /* @__PURE__ */ jsx58(
|
|
5972
6205
|
"button",
|
|
5973
6206
|
{
|
|
5974
6207
|
ref,
|
|
@@ -5979,7 +6212,7 @@ var SuggestionChip = forwardRef10(function SuggestionChip2({ children, className
|
|
|
5979
6212
|
"inline-flex h-8 max-w-full items-center rounded-full border border-border-default bg-surface px-3 text-sm text-text-primary transition-colors duration-(--mr-motion-duration-interactive) ease-interactive hover:border-border-strong hover:bg-subtle focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-border-focus",
|
|
5980
6213
|
className
|
|
5981
6214
|
),
|
|
5982
|
-
children: /* @__PURE__ */
|
|
6215
|
+
children: /* @__PURE__ */ jsx58("span", { className: "truncate", children })
|
|
5983
6216
|
}
|
|
5984
6217
|
);
|
|
5985
6218
|
});
|
|
@@ -5988,7 +6221,7 @@ SuggestionChip.displayName = "SuggestionChip";
|
|
|
5988
6221
|
// src/ToggleChip.tsx
|
|
5989
6222
|
import { forwardRef as forwardRef11 } from "react";
|
|
5990
6223
|
import { Check as Check9 } from "lucide-react";
|
|
5991
|
-
import { jsx as
|
|
6224
|
+
import { jsx as jsx59, jsxs as jsxs50 } from "react/jsx-runtime";
|
|
5992
6225
|
var ToggleChip = forwardRef11(function ToggleChip2({ selected, onChange, children, className, testIdPrefix, type = "button", onClick, ...props }, ref) {
|
|
5993
6226
|
return /* @__PURE__ */ jsxs50(
|
|
5994
6227
|
"button",
|
|
@@ -6008,7 +6241,7 @@ var ToggleChip = forwardRef11(function ToggleChip2({ selected, onChange, childre
|
|
|
6008
6241
|
className
|
|
6009
6242
|
),
|
|
6010
6243
|
children: [
|
|
6011
|
-
selected && /* @__PURE__ */
|
|
6244
|
+
selected && /* @__PURE__ */ jsx59(Check9, { size: 14, "aria-hidden": "true", className: "-ml-0.5 shrink-0" }),
|
|
6012
6245
|
children
|
|
6013
6246
|
]
|
|
6014
6247
|
}
|
|
@@ -6017,14 +6250,14 @@ var ToggleChip = forwardRef11(function ToggleChip2({ selected, onChange, childre
|
|
|
6017
6250
|
ToggleChip.displayName = "ToggleChip";
|
|
6018
6251
|
|
|
6019
6252
|
// src/CopyButton.tsx
|
|
6020
|
-
import { forwardRef as forwardRef12, useEffect as
|
|
6253
|
+
import { forwardRef as forwardRef12, useEffect as useEffect19, useRef as useRef21, useState as useState20 } from "react";
|
|
6021
6254
|
import { Check as Check10, Copy } from "lucide-react";
|
|
6022
|
-
import { jsx as
|
|
6255
|
+
import { jsx as jsx60, jsxs as jsxs51 } from "react/jsx-runtime";
|
|
6023
6256
|
var CONFIRM_MS = 2e3;
|
|
6024
6257
|
var CopyButton = forwardRef12(function CopyButton2({ value, label, "aria-label": ariaLabel, size = "xs", className, testIdPrefix }, ref) {
|
|
6025
|
-
const [copied, setCopied] =
|
|
6026
|
-
const timer =
|
|
6027
|
-
|
|
6258
|
+
const [copied, setCopied] = useState20(false);
|
|
6259
|
+
const timer = useRef21(void 0);
|
|
6260
|
+
useEffect19(() => () => clearTimeout(timer.current), []);
|
|
6028
6261
|
const copy = async () => {
|
|
6029
6262
|
try {
|
|
6030
6263
|
await navigator.clipboard.writeText(typeof value === "function" ? value() : value);
|
|
@@ -6036,7 +6269,7 @@ var CopyButton = forwardRef12(function CopyButton2({ value, label, "aria-label":
|
|
|
6036
6269
|
timer.current = setTimeout(() => setCopied(false), CONFIRM_MS);
|
|
6037
6270
|
};
|
|
6038
6271
|
const iconSize = size === "xs" ? 13 : 15;
|
|
6039
|
-
const icon = copied ? /* @__PURE__ */
|
|
6272
|
+
const icon = copied ? /* @__PURE__ */ jsx60(Check10, { size: iconSize, "aria-hidden": "true", className: "shrink-0 text-text-success" }) : /* @__PURE__ */ jsx60(Copy, { size: iconSize, "aria-hidden": "true", className: "shrink-0" });
|
|
6040
6273
|
return /* @__PURE__ */ jsxs51(
|
|
6041
6274
|
Button,
|
|
6042
6275
|
{
|
|
@@ -6051,8 +6284,8 @@ var CopyButton = forwardRef12(function CopyButton2({ value, label, "aria-label":
|
|
|
6051
6284
|
className: cn(!copied && "text-text-secondary", className),
|
|
6052
6285
|
children: [
|
|
6053
6286
|
icon,
|
|
6054
|
-
label && /* @__PURE__ */
|
|
6055
|
-
/* @__PURE__ */
|
|
6287
|
+
label && /* @__PURE__ */ jsx60("span", { children: copied ? "Copied" : label }),
|
|
6288
|
+
/* @__PURE__ */ jsx60("span", { role: "status", className: "sr-only", children: copied ? "Copied" : "" })
|
|
6056
6289
|
]
|
|
6057
6290
|
}
|
|
6058
6291
|
);
|
|
@@ -6061,7 +6294,7 @@ CopyButton.displayName = "CopyButton";
|
|
|
6061
6294
|
|
|
6062
6295
|
// src/InlineMessage.tsx
|
|
6063
6296
|
import { AlertTriangle as AlertTriangle2, CheckCircle2, Info as Info3, X as X8, XCircle } from "lucide-react";
|
|
6064
|
-
import { jsx as
|
|
6297
|
+
import { jsx as jsx61, jsxs as jsxs52 } from "react/jsx-runtime";
|
|
6065
6298
|
var BOX = {
|
|
6066
6299
|
info: "border-brand-primaryAction/30 bg-brand-primaryAction/10",
|
|
6067
6300
|
success: "border-status-success/40 bg-status-success/10",
|
|
@@ -6085,20 +6318,20 @@ function InlineMessage({ tone = "info", title, children, actions, onDismiss, cla
|
|
|
6085
6318
|
className: cn("flex items-start gap-2.5 rounded-control border px-3 py-2.5 text-sm", BOX[tone], className),
|
|
6086
6319
|
"data-testid": testIdPrefix,
|
|
6087
6320
|
children: [
|
|
6088
|
-
/* @__PURE__ */
|
|
6321
|
+
/* @__PURE__ */ jsx61(Icon, { size: 16, "aria-hidden": "true", className: cn("mt-0.5 shrink-0", ICON_INK[tone]) }),
|
|
6089
6322
|
/* @__PURE__ */ jsxs52("div", { className: "min-w-0 flex-1", children: [
|
|
6090
|
-
/* @__PURE__ */
|
|
6091
|
-
children && /* @__PURE__ */
|
|
6092
|
-
actions && /* @__PURE__ */
|
|
6323
|
+
/* @__PURE__ */ jsx61("p", { className: "font-semibold text-text-primary", children: title }),
|
|
6324
|
+
children && /* @__PURE__ */ jsx61("div", { className: "mt-0.5 text-text-secondary", children }),
|
|
6325
|
+
actions && /* @__PURE__ */ jsx61("div", { className: "mt-2 flex flex-wrap items-center gap-2", children: actions })
|
|
6093
6326
|
] }),
|
|
6094
|
-
onDismiss && /* @__PURE__ */
|
|
6327
|
+
onDismiss && /* @__PURE__ */ jsx61(
|
|
6095
6328
|
"button",
|
|
6096
6329
|
{
|
|
6097
6330
|
type: "button",
|
|
6098
6331
|
onClick: onDismiss,
|
|
6099
6332
|
"aria-label": "Dismiss",
|
|
6100
6333
|
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",
|
|
6101
|
-
children: /* @__PURE__ */
|
|
6334
|
+
children: /* @__PURE__ */ jsx61(X8, { size: 14, "aria-hidden": "true" })
|
|
6102
6335
|
}
|
|
6103
6336
|
)
|
|
6104
6337
|
]
|
|
@@ -6107,9 +6340,9 @@ function InlineMessage({ tone = "info", title, children, actions, onDismiss, cla
|
|
|
6107
6340
|
}
|
|
6108
6341
|
|
|
6109
6342
|
// src/FilterDrawer.tsx
|
|
6110
|
-
import { useEffect as
|
|
6343
|
+
import { useEffect as useEffect20, useLayoutEffect as useLayoutEffect7, useRef as useRef22, useState as useState21 } from "react";
|
|
6111
6344
|
import { ChevronLeft as ChevronLeft5, ChevronRight as ChevronRight7 } from "lucide-react";
|
|
6112
|
-
import { jsx as
|
|
6345
|
+
import { Fragment as Fragment9, jsx as jsx62, jsxs as jsxs53 } from "react/jsx-runtime";
|
|
6113
6346
|
var SLIDE_MS = 200;
|
|
6114
6347
|
function reducedMotion() {
|
|
6115
6348
|
return typeof window !== "undefined" && !!window.matchMedia?.("(prefers-reduced-motion: reduce)").matches;
|
|
@@ -6125,19 +6358,30 @@ function FilterDrawer({
|
|
|
6125
6358
|
onApply,
|
|
6126
6359
|
focus = null,
|
|
6127
6360
|
size = "sm",
|
|
6361
|
+
hasChanges,
|
|
6128
6362
|
testIdPrefix
|
|
6129
6363
|
}) {
|
|
6130
|
-
const
|
|
6131
|
-
const [
|
|
6132
|
-
const [
|
|
6133
|
-
const [
|
|
6364
|
+
const marks = (list) => list.map((x) => `${x.id}:${x.count ?? 0}:${x.badge ?? ""}`).join("|");
|
|
6365
|
+
const [openedWith, setOpenedWith] = useState21(() => marks(sections));
|
|
6366
|
+
const [confirming, setConfirming] = useState21(false);
|
|
6367
|
+
const [view, setViewState] = useState21(focus);
|
|
6368
|
+
const [leaving, setLeaving] = useState21(null);
|
|
6369
|
+
const [phase, setPhase] = useState21("run");
|
|
6370
|
+
const [wasOpen, setWasOpen] = useState21(open);
|
|
6134
6371
|
if (open !== wasOpen) {
|
|
6135
6372
|
setWasOpen(open);
|
|
6373
|
+
setConfirming(false);
|
|
6136
6374
|
if (open) {
|
|
6137
6375
|
setViewState(focus);
|
|
6138
6376
|
setLeaving(null);
|
|
6377
|
+
setOpenedWith(marks(sections));
|
|
6139
6378
|
}
|
|
6140
6379
|
}
|
|
6380
|
+
const changed = hasChanges ?? marks(sections) !== openedWith;
|
|
6381
|
+
const requestClose = () => {
|
|
6382
|
+
if (changed) setConfirming(true);
|
|
6383
|
+
else onClose();
|
|
6384
|
+
};
|
|
6141
6385
|
const setView = (next) => {
|
|
6142
6386
|
if (!reducedMotion()) {
|
|
6143
6387
|
setLeaving({ view, dir: next ? 1 : -1 });
|
|
@@ -6145,20 +6389,20 @@ function FilterDrawer({
|
|
|
6145
6389
|
}
|
|
6146
6390
|
setViewState(next);
|
|
6147
6391
|
};
|
|
6148
|
-
|
|
6392
|
+
useLayoutEffect7(() => {
|
|
6149
6393
|
if (phase !== "start") return;
|
|
6150
6394
|
const raf = requestAnimationFrame(() => requestAnimationFrame(() => setPhase("run")));
|
|
6151
6395
|
return () => cancelAnimationFrame(raf);
|
|
6152
6396
|
}, [phase]);
|
|
6153
|
-
|
|
6397
|
+
useEffect20(() => {
|
|
6154
6398
|
if (!leaving || phase !== "run") return;
|
|
6155
6399
|
const t = setTimeout(() => setLeaving(null), SLIDE_MS);
|
|
6156
6400
|
return () => clearTimeout(t);
|
|
6157
6401
|
}, [leaving, phase]);
|
|
6158
|
-
const backRef =
|
|
6159
|
-
const rowRefs =
|
|
6160
|
-
const lastView =
|
|
6161
|
-
|
|
6402
|
+
const backRef = useRef22(null);
|
|
6403
|
+
const rowRefs = useRef22(/* @__PURE__ */ new Map());
|
|
6404
|
+
const lastView = useRef22(null);
|
|
6405
|
+
useEffect20(() => {
|
|
6162
6406
|
if (!open) return;
|
|
6163
6407
|
if (view) backRef.current?.focus();
|
|
6164
6408
|
else if (lastView.current) rowRefs.current.get(lastView.current)?.focus();
|
|
@@ -6171,8 +6415,8 @@ function FilterDrawer({
|
|
|
6171
6415
|
const outgoing = phase === "start" ? void 0 : dir > 0 ? "translateX(-33%)" : "translateX(100%)";
|
|
6172
6416
|
const panel = (v, rows = true) => {
|
|
6173
6417
|
const s = v ? sections.find((x) => x.id === v) : void 0;
|
|
6174
|
-
if (s) return /* @__PURE__ */
|
|
6175
|
-
return /* @__PURE__ */
|
|
6418
|
+
if (s) return /* @__PURE__ */ jsx62("div", { className: "border-t border-border-default px-5 pt-4", children: renderSection(s.id) });
|
|
6419
|
+
return /* @__PURE__ */ jsx62("ul", { className: "border-t border-border-default", children: sections.map((x) => /* @__PURE__ */ jsx62("li", { className: "border-b border-border-default", children: /* @__PURE__ */ jsxs53(
|
|
6176
6420
|
"button",
|
|
6177
6421
|
{
|
|
6178
6422
|
ref: rows ? (el) => {
|
|
@@ -6184,7 +6428,7 @@ function FilterDrawer({
|
|
|
6184
6428
|
"data-testid": testIdPrefix && `${testIdPrefix}-row-${x.id}`,
|
|
6185
6429
|
className: "flex w-full items-center gap-3 px-5 py-3.5 text-left transition-colors hover:bg-subtle focus-visible:outline-solid focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-border-focus",
|
|
6186
6430
|
children: [
|
|
6187
|
-
/* @__PURE__ */
|
|
6431
|
+
/* @__PURE__ */ jsx62(
|
|
6188
6432
|
x.icon,
|
|
6189
6433
|
{
|
|
6190
6434
|
size: 17,
|
|
@@ -6192,98 +6436,130 @@ function FilterDrawer({
|
|
|
6192
6436
|
className: inUse(x) ? "text-brand-primaryAction" : "text-text-secondary"
|
|
6193
6437
|
}
|
|
6194
6438
|
),
|
|
6195
|
-
/* @__PURE__ */
|
|
6196
|
-
/* @__PURE__ */
|
|
6197
|
-
/* @__PURE__ */
|
|
6439
|
+
/* @__PURE__ */ jsx62("span", { className: "flex-1 text-sm font-medium text-text-primary", children: x.label }),
|
|
6440
|
+
/* @__PURE__ */ jsx62(SectionMark, { section: x }),
|
|
6441
|
+
/* @__PURE__ */ jsx62(ChevronRight7, { size: 16, "aria-hidden": "true", className: "shrink-0 text-text-secondary" })
|
|
6198
6442
|
]
|
|
6199
6443
|
}
|
|
6200
6444
|
) }, x.id)) });
|
|
6201
6445
|
};
|
|
6202
|
-
return /* @__PURE__ */
|
|
6203
|
-
|
|
6204
|
-
|
|
6205
|
-
|
|
6206
|
-
|
|
6207
|
-
|
|
6208
|
-
|
|
6209
|
-
|
|
6210
|
-
|
|
6211
|
-
|
|
6212
|
-
|
|
6213
|
-
|
|
6214
|
-
|
|
6215
|
-
onClick: () => setView(null),
|
|
6216
|
-
"aria-label": "Back to all filters",
|
|
6217
|
-
"data-testid": testIdPrefix && `${testIdPrefix}-back`,
|
|
6218
|
-
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",
|
|
6219
|
-
children: /* @__PURE__ */ jsx61(ChevronLeft5, { size: 18, "aria-hidden": "true" })
|
|
6220
|
-
}
|
|
6221
|
-
),
|
|
6222
|
-
focused.label,
|
|
6223
|
-
(focused.count ?? 0) > 0 && /* @__PURE__ */ jsx61(CountBadge, { count: focused.count }),
|
|
6224
|
-
focused.info && /* @__PURE__ */ jsx61(InfoTip, { text: focused.info, label: `About ${focused.label}` })
|
|
6225
|
-
] }) : "Filters",
|
|
6226
|
-
footer: focused ? (
|
|
6227
|
-
// Picks are kept as they're made; only See results, on the list, applies them.
|
|
6228
|
-
/* @__PURE__ */ jsx61("div", { className: "flex w-full items-center", children: /* @__PURE__ */ jsx61(Button, { variant: "link", size: "md", onClick: () => onClearSection(focused.id), className: "px-0", children: "Clear" }) })
|
|
6229
|
-
) : /* @__PURE__ */ jsxs53("div", { className: "flex w-full items-center justify-between gap-2", children: [
|
|
6230
|
-
/* @__PURE__ */ jsx61(Button, { variant: "link", size: "md", onClick: onClearAll, className: "px-0", children: "Clear all" }),
|
|
6231
|
-
/* @__PURE__ */ jsxs53("div", { className: "flex items-center gap-2", children: [
|
|
6232
|
-
/* @__PURE__ */ jsx61(Button, { variant: "secondary", size: "md", onClick: onClose, children: "Cancel" }),
|
|
6233
|
-
/* @__PURE__ */ jsx61(
|
|
6446
|
+
return /* @__PURE__ */ jsxs53(Fragment9, { children: [
|
|
6447
|
+
/* @__PURE__ */ jsx62(
|
|
6448
|
+
Modal,
|
|
6449
|
+
{
|
|
6450
|
+
open: open && confirming,
|
|
6451
|
+
onClose: () => setConfirming(false),
|
|
6452
|
+
size: "sm",
|
|
6453
|
+
title: "Discard changes?",
|
|
6454
|
+
description: "Your filter picks haven't been applied.",
|
|
6455
|
+
testIdPrefix: testIdPrefix && `${testIdPrefix}-discard`,
|
|
6456
|
+
footer: /* @__PURE__ */ jsxs53(Fragment9, { children: [
|
|
6457
|
+
/* @__PURE__ */ jsx62(Button, { variant: "secondary", size: "md", onClick: () => setConfirming(false), children: "Keep editing" }),
|
|
6458
|
+
/* @__PURE__ */ jsx62(
|
|
6234
6459
|
Button,
|
|
6235
6460
|
{
|
|
6236
|
-
variant: "
|
|
6461
|
+
variant: "danger",
|
|
6237
6462
|
size: "md",
|
|
6238
6463
|
onClick: () => {
|
|
6239
|
-
|
|
6464
|
+
setConfirming(false);
|
|
6240
6465
|
onClose();
|
|
6241
6466
|
},
|
|
6242
|
-
children: "
|
|
6467
|
+
children: "Discard"
|
|
6243
6468
|
}
|
|
6244
6469
|
)
|
|
6245
6470
|
] })
|
|
6246
|
-
|
|
6247
|
-
|
|
6248
|
-
|
|
6249
|
-
|
|
6250
|
-
|
|
6251
|
-
|
|
6252
|
-
|
|
6253
|
-
|
|
6254
|
-
|
|
6255
|
-
|
|
6256
|
-
|
|
6257
|
-
|
|
6258
|
-
|
|
6259
|
-
|
|
6260
|
-
|
|
6261
|
-
|
|
6262
|
-
|
|
6263
|
-
|
|
6264
|
-
|
|
6265
|
-
|
|
6266
|
-
|
|
6267
|
-
|
|
6268
|
-
|
|
6269
|
-
|
|
6471
|
+
}
|
|
6472
|
+
),
|
|
6473
|
+
/* @__PURE__ */ jsx62(
|
|
6474
|
+
Drawer,
|
|
6475
|
+
{
|
|
6476
|
+
open,
|
|
6477
|
+
onClose: requestClose,
|
|
6478
|
+
size,
|
|
6479
|
+
testIdPrefix,
|
|
6480
|
+
title: focused ? /* @__PURE__ */ jsxs53("span", { className: "flex items-center gap-1.5", children: [
|
|
6481
|
+
/* @__PURE__ */ jsx62(
|
|
6482
|
+
"button",
|
|
6483
|
+
{
|
|
6484
|
+
ref: backRef,
|
|
6485
|
+
type: "button",
|
|
6486
|
+
onClick: () => setView(null),
|
|
6487
|
+
"aria-label": "Back to all filters",
|
|
6488
|
+
"data-testid": testIdPrefix && `${testIdPrefix}-back`,
|
|
6489
|
+
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",
|
|
6490
|
+
children: /* @__PURE__ */ jsx62(ChevronLeft5, { size: 18, "aria-hidden": "true" })
|
|
6491
|
+
}
|
|
6492
|
+
),
|
|
6493
|
+
focused.label,
|
|
6494
|
+
(focused.count ?? 0) > 0 && /* @__PURE__ */ jsx62(CountBadge, { count: focused.count }),
|
|
6495
|
+
focused.info && /* @__PURE__ */ jsx62(InfoTip, { text: focused.info, label: `About ${focused.label}` })
|
|
6496
|
+
] }) : "Filters",
|
|
6497
|
+
footer: focused ? (
|
|
6498
|
+
// Picks are kept as they're made; Apply goes back to the list, and only
|
|
6499
|
+
// See results, on the list, applies them to the page.
|
|
6500
|
+
/* @__PURE__ */ jsxs53("div", { className: "flex w-full items-center justify-between gap-2", children: [
|
|
6501
|
+
/* @__PURE__ */ jsx62(Button, { variant: "link", size: "md", onClick: () => onClearSection(focused.id), className: "px-0", children: "Clear" }),
|
|
6502
|
+
/* @__PURE__ */ jsx62(Button, { variant: "primary", size: "md", onClick: () => setView(null), testIdPrefix: testIdPrefix && `${testIdPrefix}-apply-section`, children: "Apply" })
|
|
6503
|
+
] })
|
|
6504
|
+
) : /* @__PURE__ */ jsxs53("div", { className: "flex w-full items-center justify-between gap-2", children: [
|
|
6505
|
+
/* @__PURE__ */ jsx62(Button, { variant: "link", size: "md", onClick: onClearAll, className: "px-0", children: "Clear all" }),
|
|
6506
|
+
/* @__PURE__ */ jsxs53("div", { className: "flex items-center gap-2", children: [
|
|
6507
|
+
/* @__PURE__ */ jsx62(Button, { variant: "secondary", size: "md", onClick: onClose, children: "Cancel" }),
|
|
6508
|
+
/* @__PURE__ */ jsx62(
|
|
6509
|
+
Button,
|
|
6510
|
+
{
|
|
6511
|
+
variant: "primary",
|
|
6512
|
+
size: "md",
|
|
6513
|
+
onClick: () => {
|
|
6514
|
+
onApply();
|
|
6515
|
+
onClose();
|
|
6516
|
+
},
|
|
6517
|
+
children: "See results"
|
|
6518
|
+
}
|
|
6519
|
+
)
|
|
6520
|
+
] })
|
|
6521
|
+
] }),
|
|
6522
|
+
children: /* @__PURE__ */ jsxs53("div", { className: "relative -mx-5 overflow-x-clip", children: [
|
|
6523
|
+
/* @__PURE__ */ jsx62(
|
|
6524
|
+
"div",
|
|
6525
|
+
{
|
|
6526
|
+
style: { transform: incoming },
|
|
6527
|
+
className: cn(moving && "transition-transform duration-(--mr-motion-duration-interactive) ease-interactive motion-reduce:transition-none"),
|
|
6528
|
+
children: panel(view)
|
|
6529
|
+
},
|
|
6530
|
+
view ?? "__list"
|
|
6531
|
+
),
|
|
6532
|
+
leaving && /* @__PURE__ */ jsx62(
|
|
6533
|
+
"div",
|
|
6534
|
+
{
|
|
6535
|
+
"aria-hidden": "true",
|
|
6536
|
+
ref: (el) => el?.setAttribute("inert", ""),
|
|
6537
|
+
style: { transform: outgoing, opacity: phase === "start" ? 1 : dir > 0 ? 0.4 : 1 },
|
|
6538
|
+
className: "pointer-events-none absolute inset-x-0 top-0 transition duration-(--mr-motion-duration-interactive) ease-interactive motion-reduce:transition-none",
|
|
6539
|
+
children: panel(leaving.view, false)
|
|
6540
|
+
}
|
|
6541
|
+
)
|
|
6542
|
+
] })
|
|
6543
|
+
}
|
|
6544
|
+
)
|
|
6545
|
+
] });
|
|
6270
6546
|
}
|
|
6271
6547
|
var inUse = (x) => (x.count ?? 0) > 0 || !!x.badge;
|
|
6272
6548
|
function CountBadge({ count }) {
|
|
6273
6549
|
return /* @__PURE__ */ jsxs53(Badge, { tone: "brandSolid", kind: "count", children: [
|
|
6274
6550
|
count,
|
|
6275
|
-
/* @__PURE__ */
|
|
6551
|
+
/* @__PURE__ */ jsx62("span", { className: "sr-only", children: " selected" })
|
|
6276
6552
|
] });
|
|
6277
6553
|
}
|
|
6278
6554
|
function SectionMark({ section }) {
|
|
6279
|
-
if ((section.count ?? 0) > 0) return /* @__PURE__ */
|
|
6280
|
-
return section.badge ? /* @__PURE__ */
|
|
6555
|
+
if ((section.count ?? 0) > 0) return /* @__PURE__ */ jsx62(CountBadge, { count: section.count });
|
|
6556
|
+
return section.badge ? /* @__PURE__ */ jsx62(Badge, { tone: "brand", children: section.badge }) : null;
|
|
6281
6557
|
}
|
|
6282
6558
|
|
|
6283
6559
|
// src/AllFiltersButton.tsx
|
|
6284
6560
|
import { forwardRef as forwardRef13 } from "react";
|
|
6285
6561
|
import { SlidersHorizontal } from "lucide-react";
|
|
6286
|
-
import { jsx as
|
|
6562
|
+
import { jsx as jsx63, jsxs as jsxs54 } from "react/jsx-runtime";
|
|
6287
6563
|
var AllFiltersButton = forwardRef13(function AllFiltersButton2({ count = 0, open, className, testIdPrefix, ...rest }, ref) {
|
|
6288
6564
|
return /* @__PURE__ */ jsxs54(
|
|
6289
6565
|
"button",
|
|
@@ -6297,9 +6573,9 @@ var AllFiltersButton = forwardRef13(function AllFiltersButton2({ count = 0, open
|
|
|
6297
6573
|
className: cn(chipTriggerClass(), className),
|
|
6298
6574
|
...rest,
|
|
6299
6575
|
children: [
|
|
6300
|
-
/* @__PURE__ */
|
|
6301
|
-
/* @__PURE__ */
|
|
6302
|
-
count > 0 && /* @__PURE__ */
|
|
6576
|
+
/* @__PURE__ */ jsx63(SlidersHorizontal, { size: 15, "aria-hidden": "true", className: "text-text-secondary" }),
|
|
6577
|
+
/* @__PURE__ */ jsx63("span", { className: "text-dense font-medium text-text-primary", children: "All filters" }),
|
|
6578
|
+
count > 0 && /* @__PURE__ */ jsx63(Badge, { tone: "brandSolid", kind: "count", children: count })
|
|
6303
6579
|
]
|
|
6304
6580
|
}
|
|
6305
6581
|
);
|
|
@@ -6309,7 +6585,7 @@ var AllFiltersButton = forwardRef13(function AllFiltersButton2({ count = 0, open
|
|
|
6309
6585
|
import { forwardRef as forwardRef14 } from "react";
|
|
6310
6586
|
import { Slot as Slot2, Slottable } from "@radix-ui/react-slot";
|
|
6311
6587
|
import { Check as Check11, ChevronRight as ChevronRight8 } from "lucide-react";
|
|
6312
|
-
import { jsx as
|
|
6588
|
+
import { jsx as jsx64, jsxs as jsxs55 } from "react/jsx-runtime";
|
|
6313
6589
|
var ROW_SELECTOR = '[role^="menuitem"]:not([aria-disabled="true"]):not(:disabled)';
|
|
6314
6590
|
function moveFocus(e) {
|
|
6315
6591
|
const keys = ["ArrowDown", "ArrowUp", "Home", "End"];
|
|
@@ -6322,7 +6598,7 @@ function moveFocus(e) {
|
|
|
6322
6598
|
rows[next].focus();
|
|
6323
6599
|
}
|
|
6324
6600
|
var Menu = forwardRef14(
|
|
6325
|
-
({ className, testIdPrefix, onKeyDown, children, ...props }, ref) => /* @__PURE__ */
|
|
6601
|
+
({ className, testIdPrefix, onKeyDown, children, ...props }, ref) => /* @__PURE__ */ jsx64(
|
|
6326
6602
|
"div",
|
|
6327
6603
|
{
|
|
6328
6604
|
ref,
|
|
@@ -6364,17 +6640,17 @@ var MenuItem = forwardRef14(
|
|
|
6364
6640
|
),
|
|
6365
6641
|
...props,
|
|
6366
6642
|
children: [
|
|
6367
|
-
icon && /* @__PURE__ */
|
|
6643
|
+
icon && /* @__PURE__ */ jsx64("span", { "aria-hidden": "true", className: cn("flex shrink-0", danger ? "text-text-danger" : "text-text-secondary"), children: icon }),
|
|
6368
6644
|
asChild ? (
|
|
6369
6645
|
// The link's own text lands here; the link becomes the row.
|
|
6370
|
-
/* @__PURE__ */
|
|
6646
|
+
/* @__PURE__ */ jsx64(Slottable, { children })
|
|
6371
6647
|
) : /* @__PURE__ */ jsxs55("span", { className: "min-w-0 flex-1", children: [
|
|
6372
|
-
/* @__PURE__ */
|
|
6373
|
-
description && /* @__PURE__ */
|
|
6648
|
+
/* @__PURE__ */ jsx64("span", { className: "block truncate", children }),
|
|
6649
|
+
description && /* @__PURE__ */ jsx64("span", { className: "block truncate text-xs text-text-tertiary", children: description })
|
|
6374
6650
|
] }),
|
|
6375
|
-
trailing && /* @__PURE__ */
|
|
6376
|
-
radio && checked && /* @__PURE__ */
|
|
6377
|
-
submenu && /* @__PURE__ */
|
|
6651
|
+
trailing && /* @__PURE__ */ jsx64("span", { className: "ml-auto flex shrink-0 items-center text-xs text-text-secondary", children: trailing }),
|
|
6652
|
+
radio && checked && /* @__PURE__ */ jsx64(Check11, { size: 16, "aria-hidden": "true", className: "shrink-0 text-brand-primaryAction" }),
|
|
6653
|
+
submenu && /* @__PURE__ */ jsx64(ChevronRight8, { size: 16, "aria-hidden": "true", className: "shrink-0 text-text-secondary" })
|
|
6378
6654
|
]
|
|
6379
6655
|
}
|
|
6380
6656
|
);
|
|
@@ -6382,7 +6658,7 @@ var MenuItem = forwardRef14(
|
|
|
6382
6658
|
);
|
|
6383
6659
|
MenuItem.displayName = "MenuItem";
|
|
6384
6660
|
function MenuLabel({ className, testIdPrefix, children }) {
|
|
6385
|
-
return /* @__PURE__ */
|
|
6661
|
+
return /* @__PURE__ */ jsx64(
|
|
6386
6662
|
"div",
|
|
6387
6663
|
{
|
|
6388
6664
|
role: "presentation",
|
|
@@ -6393,7 +6669,7 @@ function MenuLabel({ className, testIdPrefix, children }) {
|
|
|
6393
6669
|
);
|
|
6394
6670
|
}
|
|
6395
6671
|
function MenuSeparator({ className, testIdPrefix }) {
|
|
6396
|
-
return /* @__PURE__ */
|
|
6672
|
+
return /* @__PURE__ */ jsx64("div", { role: "separator", "data-testid": testIdPrefix, className: cn("-mx-1 my-1 border-t border-border-default", className) });
|
|
6397
6673
|
}
|
|
6398
6674
|
|
|
6399
6675
|
// src/dates.ts
|
|
@@ -6507,15 +6783,15 @@ function defaultDateOrder(country) {
|
|
|
6507
6783
|
}
|
|
6508
6784
|
|
|
6509
6785
|
// src/Figure.tsx
|
|
6510
|
-
import { Fragment as
|
|
6786
|
+
import { Fragment as Fragment10, jsx as jsx65, jsxs as jsxs56 } from "react/jsx-runtime";
|
|
6511
6787
|
function Figure({ value, kind = "money", missing, ...opts }) {
|
|
6512
|
-
if (value === null || value === void 0 || Number.isNaN(value)) return /* @__PURE__ */
|
|
6788
|
+
if (value === null || value === void 0 || Number.isNaN(value)) return /* @__PURE__ */ jsx65(NoValue, { reason: missing });
|
|
6513
6789
|
const short = kind === "money" ? formatMoney(value, opts) : formatCount(value, opts);
|
|
6514
6790
|
const full = kind === "money" ? formatMoneyFull(value, opts) : formatCountFull(value);
|
|
6515
|
-
if (short === full) return /* @__PURE__ */
|
|
6791
|
+
if (short === full) return /* @__PURE__ */ jsx65(Fragment10, { children: short });
|
|
6516
6792
|
return /* @__PURE__ */ jsxs56(Tooltip, { label: full, delay: 300, children: [
|
|
6517
|
-
/* @__PURE__ */
|
|
6518
|
-
/* @__PURE__ */
|
|
6793
|
+
/* @__PURE__ */ jsx65("span", { "aria-hidden": "true", children: short }),
|
|
6794
|
+
/* @__PURE__ */ jsx65("span", { className: "sr-only", children: full })
|
|
6519
6795
|
] });
|
|
6520
6796
|
}
|
|
6521
6797
|
export {
|
|
@@ -6590,6 +6866,7 @@ export {
|
|
|
6590
6866
|
StatStrip,
|
|
6591
6867
|
StatStripSkeleton,
|
|
6592
6868
|
StatTile,
|
|
6869
|
+
StickyBar,
|
|
6593
6870
|
SuggestionChip,
|
|
6594
6871
|
TableLink,
|
|
6595
6872
|
TablePagination,
|