@mediaradar/design-components 0.64.0 → 0.66.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 +551 -293
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +142 -14
- package/dist/index.d.ts +142 -14
- package/dist/index.js +548 -290
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -4084,6 +4084,8 @@ function FilterDropdownFooter({
|
|
|
4084
4084
|
onApply,
|
|
4085
4085
|
clearLabel = "Clear all",
|
|
4086
4086
|
applyLabel = "Apply",
|
|
4087
|
+
onCancel,
|
|
4088
|
+
cancelLabel = "Cancel",
|
|
4087
4089
|
className,
|
|
4088
4090
|
testIdPrefix
|
|
4089
4091
|
}) {
|
|
@@ -4098,7 +4100,10 @@ function FilterDropdownFooter({
|
|
|
4098
4100
|
"data-testid": testIdPrefix,
|
|
4099
4101
|
children: [
|
|
4100
4102
|
onClear && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Button, { type: "button", variant: "ghost", size: "sm", onClick: onClear, children: clearLabel }),
|
|
4101
|
-
/* @__PURE__ */ (0, import_jsx_runtime35.
|
|
4103
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
4104
|
+
onCancel && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Button, { type: "button", variant: "secondary", size: "sm", onClick: onCancel, children: cancelLabel }),
|
|
4105
|
+
/* @__PURE__ */ (0, import_jsx_runtime35.jsx)(Button, { type: "button", variant: "primary", size: "sm", onClick: onApply, children: applyLabel })
|
|
4106
|
+
] })
|
|
4102
4107
|
]
|
|
4103
4108
|
}
|
|
4104
4109
|
);
|
|
@@ -4311,6 +4316,15 @@ var SortButton = (0, import_react21.forwardRef)(
|
|
|
4311
4316
|
return description ? /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(HeaderTip, { description, children: plain }) : plain;
|
|
4312
4317
|
}
|
|
4313
4318
|
const active = !disabled && sort.key === sortKey;
|
|
4319
|
+
const iconFirst = align === "right";
|
|
4320
|
+
const icon = disabled ? null : active ? sort.dir === "asc" ? /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_lucide_react19.ArrowUp, { size: 12, "aria-hidden": "true", className: "shrink-0 text-brand-primaryAction" }) : /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_lucide_react19.ArrowDown, { size: 12, "aria-hidden": "true", className: "shrink-0 text-brand-primaryAction" }) : /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
4321
|
+
import_lucide_react19.ArrowUpDown,
|
|
4322
|
+
{
|
|
4323
|
+
size: 12,
|
|
4324
|
+
"aria-hidden": "true",
|
|
4325
|
+
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"
|
|
4326
|
+
}
|
|
4327
|
+
);
|
|
4314
4328
|
const button = /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(
|
|
4315
4329
|
"button",
|
|
4316
4330
|
{
|
|
@@ -4341,15 +4355,9 @@ var SortButton = (0, import_react21.forwardRef)(
|
|
|
4341
4355
|
className
|
|
4342
4356
|
),
|
|
4343
4357
|
children: [
|
|
4358
|
+
iconFirst && icon,
|
|
4344
4359
|
text,
|
|
4345
|
-
!
|
|
4346
|
-
import_lucide_react19.ArrowUpDown,
|
|
4347
|
-
{
|
|
4348
|
-
size: 12,
|
|
4349
|
-
"aria-hidden": "true",
|
|
4350
|
-
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"
|
|
4351
|
-
}
|
|
4352
|
-
))
|
|
4360
|
+
!iconFirst && icon
|
|
4353
4361
|
]
|
|
4354
4362
|
}
|
|
4355
4363
|
);
|
|
@@ -4747,6 +4755,7 @@ function DateRangePicker({
|
|
|
4747
4755
|
years,
|
|
4748
4756
|
formatDate: formatDate2,
|
|
4749
4757
|
formatRange,
|
|
4758
|
+
caption,
|
|
4750
4759
|
className,
|
|
4751
4760
|
testIdPrefix
|
|
4752
4761
|
}) {
|
|
@@ -4756,6 +4765,7 @@ function DateRangePicker({
|
|
|
4756
4765
|
const [value, setValue] = (0, import_react23.useState)(defaultValue);
|
|
4757
4766
|
const [draft, setDraft] = (0, import_react23.useState)(defaultValue);
|
|
4758
4767
|
const ref = (0, import_react23.useRef)(null);
|
|
4768
|
+
const triggerRef = (0, import_react23.useRef)(null);
|
|
4759
4769
|
const [fromMo, setFromMo] = (0, import_react23.useState)(end.getMonth());
|
|
4760
4770
|
const [fromYr, setFromYr] = (0, import_react23.useState)(end.getFullYear() - 1);
|
|
4761
4771
|
const [toMo, setToMo] = (0, import_react23.useState)(end.getMonth());
|
|
@@ -4800,13 +4810,14 @@ function DateRangePicker({
|
|
|
4800
4810
|
/* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(
|
|
4801
4811
|
"button",
|
|
4802
4812
|
{
|
|
4813
|
+
ref: triggerRef,
|
|
4803
4814
|
type: "button",
|
|
4804
4815
|
onClick: toggleOpen,
|
|
4805
4816
|
"aria-expanded": open,
|
|
4806
4817
|
"aria-haspopup": "listbox",
|
|
4807
4818
|
className: chipTriggerClass(),
|
|
4808
4819
|
children: [
|
|
4809
|
-
/* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("span", { className: "flex flex-col gap-1 text-left leading-none", children: [
|
|
4820
|
+
caption ? /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(ChipContent, { caption, value }) : /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("span", { className: "flex flex-col gap-1 text-left leading-none", children: [
|
|
4810
4821
|
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)("span", { className: "text-control-caption leading-none text-text-tertiary", children: spanLabel2(value, end, formatDate2, formatRange) }),
|
|
4811
4822
|
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)("span", { className: "text-xs leading-none font-medium text-text-primary", children: value })
|
|
4812
4823
|
] }),
|
|
@@ -4814,6 +4825,7 @@ function DateRangePicker({
|
|
|
4814
4825
|
]
|
|
4815
4826
|
}
|
|
4816
4827
|
),
|
|
4828
|
+
caption && !open && /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(Tooltip, { anchorRef: triggerRef, label: spanLabel2(value, end, formatDate2, formatRange), delay: 300, placement: "top" }),
|
|
4817
4829
|
open && /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)("div", { className: cn("absolute top-full mt-2 z-30 w-70 overflow-hidden rounded-card border border-border-default bg-surface py-1 shadow-overlay", align === "right" ? "right-0" : "left-0"), children: [
|
|
4818
4830
|
presets.map((p) => /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
4819
4831
|
"button",
|
|
@@ -4893,6 +4905,8 @@ function MultiSelectFilter({
|
|
|
4893
4905
|
hints,
|
|
4894
4906
|
note,
|
|
4895
4907
|
hideCaption = false,
|
|
4908
|
+
size = "md",
|
|
4909
|
+
inlineCaption = false,
|
|
4896
4910
|
max,
|
|
4897
4911
|
maxReason,
|
|
4898
4912
|
className,
|
|
@@ -4901,6 +4915,7 @@ function MultiSelectFilter({
|
|
|
4901
4915
|
const groupLeaves = (g) => g.children.length ? g.children : [{ id: g.id, label: g.label }];
|
|
4902
4916
|
const leafOptions = groups ? groups.flatMap(groupLeaves) : options;
|
|
4903
4917
|
const showSearch = searchable ?? leafOptions.length > SEARCH_AFTER;
|
|
4918
|
+
const sm = size === "sm";
|
|
4904
4919
|
const [open, setOpen] = (0, import_react24.useState)(false);
|
|
4905
4920
|
const [q, setQ] = (0, import_react24.useState)("");
|
|
4906
4921
|
const [draft, setDraft] = (0, import_react24.useState)(selected);
|
|
@@ -5020,14 +5035,24 @@ function MultiSelectFilter({
|
|
|
5020
5035
|
type: "button",
|
|
5021
5036
|
onClick: () => open ? close() : openTray(),
|
|
5022
5037
|
"aria-expanded": open,
|
|
5023
|
-
"aria-label": hideCaption ? caption : void 0,
|
|
5038
|
+
"aria-label": sm && !inlineCaption || !sm && hideCaption ? caption : void 0,
|
|
5024
5039
|
"data-testid": testIdPrefix && `${testIdPrefix}-trigger`,
|
|
5025
5040
|
className: cn(
|
|
5026
|
-
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),
|
|
5041
|
+
sm ? "flex h-8 items-center gap-1.5 rounded-control border border-border-strong bg-input pl-2.5 pr-2 text-dense font-medium text-text-primary transition-colors hover:bg-subtle focus-visible:outline-solid focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-border-focus" : 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),
|
|
5027
5042
|
fullWidth && "w-full justify-between"
|
|
5028
5043
|
),
|
|
5029
5044
|
children: [
|
|
5030
|
-
|
|
5045
|
+
sm ? /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("span", { className: "flex items-center gap-1.5", children: [
|
|
5046
|
+
icon && /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("span", { className: "shrink-0 text-text-tertiary", children: icon }),
|
|
5047
|
+
inlineCaption ? /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("span", { children: [
|
|
5048
|
+
/* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("span", { className: "font-normal text-text-secondary", children: [
|
|
5049
|
+
caption,
|
|
5050
|
+
":"
|
|
5051
|
+
] }),
|
|
5052
|
+
" ",
|
|
5053
|
+
value
|
|
5054
|
+
] }) : value
|
|
5055
|
+
] }) : hideCaption ? /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("span", { className: "flex items-center gap-2", children: [
|
|
5031
5056
|
icon && /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("span", { className: "shrink-0 text-text-tertiary", children: icon }),
|
|
5032
5057
|
value
|
|
5033
5058
|
] }) : /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(ChipContent, { caption, value, icon }),
|
|
@@ -5577,8 +5602,8 @@ function Drawer({ open, onClose, title, description, size = "sm", footer, childr
|
|
|
5577
5602
|
}
|
|
5578
5603
|
|
|
5579
5604
|
// src/DataTable.tsx
|
|
5580
|
-
var
|
|
5581
|
-
var
|
|
5605
|
+
var import_react33 = require("react");
|
|
5606
|
+
var import_lucide_react31 = require("lucide-react");
|
|
5582
5607
|
|
|
5583
5608
|
// src/numbers.ts
|
|
5584
5609
|
var US = { units: ["K", "M", "B", "T"] };
|
|
@@ -5714,13 +5739,330 @@ function StickyBar({ children, className, testIdPrefix }) {
|
|
|
5714
5739
|
);
|
|
5715
5740
|
}
|
|
5716
5741
|
|
|
5717
|
-
// src/
|
|
5742
|
+
// src/DataTableHeaderMenu.tsx
|
|
5743
|
+
var import_react32 = require("react");
|
|
5744
|
+
var import_react_dom9 = require("react-dom");
|
|
5745
|
+
var import_lucide_react30 = require("lucide-react");
|
|
5746
|
+
|
|
5747
|
+
// src/Menu.tsx
|
|
5748
|
+
var import_react31 = require("react");
|
|
5749
|
+
var import_react_slot2 = require("@radix-ui/react-slot");
|
|
5750
|
+
var import_lucide_react29 = require("lucide-react");
|
|
5718
5751
|
var import_jsx_runtime56 = require("react/jsx-runtime");
|
|
5752
|
+
var ROW_SELECTOR = '[role^="menuitem"]:not([aria-disabled="true"]):not(:disabled)';
|
|
5753
|
+
function moveFocus(e) {
|
|
5754
|
+
const keys = ["ArrowDown", "ArrowUp", "Home", "End"];
|
|
5755
|
+
if (!keys.includes(e.key)) return;
|
|
5756
|
+
const rows = Array.from(e.currentTarget.querySelectorAll(ROW_SELECTOR));
|
|
5757
|
+
if (!rows.length) return;
|
|
5758
|
+
e.preventDefault();
|
|
5759
|
+
const i = rows.indexOf(document.activeElement);
|
|
5760
|
+
const next = e.key === "Home" ? 0 : e.key === "End" ? rows.length - 1 : e.key === "ArrowDown" ? (i + 1) % rows.length : (i - 1 + rows.length) % rows.length;
|
|
5761
|
+
rows[next].focus();
|
|
5762
|
+
}
|
|
5763
|
+
var Menu = (0, import_react31.forwardRef)(
|
|
5764
|
+
({ className, testIdPrefix, onKeyDown, children, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
5765
|
+
"div",
|
|
5766
|
+
{
|
|
5767
|
+
ref,
|
|
5768
|
+
role: "menu",
|
|
5769
|
+
"data-testid": testIdPrefix,
|
|
5770
|
+
onKeyDown: (e) => {
|
|
5771
|
+
moveFocus(e);
|
|
5772
|
+
onKeyDown?.(e);
|
|
5773
|
+
},
|
|
5774
|
+
className: cn("flex flex-col p-1", className),
|
|
5775
|
+
...props,
|
|
5776
|
+
children
|
|
5777
|
+
}
|
|
5778
|
+
)
|
|
5779
|
+
);
|
|
5780
|
+
Menu.displayName = "Menu";
|
|
5781
|
+
var MenuItem = (0, import_react31.forwardRef)(
|
|
5782
|
+
({ className, testIdPrefix, icon, trailing, description, submenu, checked, danger, disabled, asChild = false, children, ...props }, ref) => {
|
|
5783
|
+
const Comp = asChild ? import_react_slot2.Slot : "button";
|
|
5784
|
+
const radio = checked !== void 0;
|
|
5785
|
+
return /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)(
|
|
5786
|
+
Comp,
|
|
5787
|
+
{
|
|
5788
|
+
ref,
|
|
5789
|
+
type: asChild ? void 0 : "button",
|
|
5790
|
+
role: radio ? "menuitemradio" : "menuitem",
|
|
5791
|
+
"aria-checked": radio ? checked : void 0,
|
|
5792
|
+
"aria-haspopup": submenu ? "menu" : void 0,
|
|
5793
|
+
"aria-disabled": disabled || void 0,
|
|
5794
|
+
disabled: asChild ? void 0 : disabled,
|
|
5795
|
+
tabIndex: -1,
|
|
5796
|
+
"data-testid": testIdPrefix,
|
|
5797
|
+
className: cn(
|
|
5798
|
+
"flex min-h-9 w-full items-center gap-2.5 rounded-control px-3 py-1.5 text-left text-sm transition-colors",
|
|
5799
|
+
"focus-visible:outline-solid focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-border-focus",
|
|
5800
|
+
danger ? "text-text-danger" : "text-text-primary",
|
|
5801
|
+
disabled ? "cursor-not-allowed opacity-40" : "hover:bg-subtle focus-visible:bg-subtle",
|
|
5802
|
+
className
|
|
5803
|
+
),
|
|
5804
|
+
...props,
|
|
5805
|
+
children: [
|
|
5806
|
+
icon && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("span", { "aria-hidden": "true", className: cn("flex shrink-0", danger ? "text-text-danger" : "text-text-secondary"), children: icon }),
|
|
5807
|
+
asChild ? (
|
|
5808
|
+
// The link's own text lands here; the link becomes the row.
|
|
5809
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)(import_react_slot2.Slottable, { children })
|
|
5810
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime56.jsxs)("span", { className: "min-w-0 flex-1", children: [
|
|
5811
|
+
/* @__PURE__ */ (0, import_jsx_runtime56.jsx)("span", { className: "block truncate", children }),
|
|
5812
|
+
description && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("span", { className: "block truncate text-xs text-text-tertiary", children: description })
|
|
5813
|
+
] }),
|
|
5814
|
+
trailing && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("span", { className: "ml-auto flex shrink-0 items-center text-xs text-text-secondary", children: trailing }),
|
|
5815
|
+
radio && checked && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(import_lucide_react29.Check, { size: 16, "aria-hidden": "true", className: "shrink-0 text-brand-primaryAction" }),
|
|
5816
|
+
submenu && /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(import_lucide_react29.ChevronRight, { size: 16, "aria-hidden": "true", className: "shrink-0 text-text-secondary" })
|
|
5817
|
+
]
|
|
5818
|
+
}
|
|
5819
|
+
);
|
|
5820
|
+
}
|
|
5821
|
+
);
|
|
5822
|
+
MenuItem.displayName = "MenuItem";
|
|
5823
|
+
function MenuLabel({ className, testIdPrefix, id, children }) {
|
|
5824
|
+
return /* @__PURE__ */ (0, import_jsx_runtime56.jsx)(
|
|
5825
|
+
"div",
|
|
5826
|
+
{
|
|
5827
|
+
id,
|
|
5828
|
+
role: "presentation",
|
|
5829
|
+
"data-testid": testIdPrefix,
|
|
5830
|
+
className: cn("px-3 pb-1 pt-2 text-micro font-semibold uppercase tracking-wide text-text-tertiary", className),
|
|
5831
|
+
children
|
|
5832
|
+
}
|
|
5833
|
+
);
|
|
5834
|
+
}
|
|
5835
|
+
function MenuSeparator({ className, testIdPrefix }) {
|
|
5836
|
+
return /* @__PURE__ */ (0, import_jsx_runtime56.jsx)("div", { role: "separator", "data-testid": testIdPrefix, className: cn("-mx-1 my-1 border-t border-border-default", className) });
|
|
5837
|
+
}
|
|
5838
|
+
|
|
5839
|
+
// src/DataTableHeaderMenu.tsx
|
|
5840
|
+
var import_jsx_runtime57 = require("react/jsx-runtime");
|
|
5841
|
+
function RadioSection({
|
|
5842
|
+
label,
|
|
5843
|
+
rows,
|
|
5844
|
+
value,
|
|
5845
|
+
onPick,
|
|
5846
|
+
first,
|
|
5847
|
+
className,
|
|
5848
|
+
testId
|
|
5849
|
+
}) {
|
|
5850
|
+
const id = (0, import_react32.useId)();
|
|
5851
|
+
const enabled = rows.filter((r) => !r.disabled);
|
|
5852
|
+
const tabStop = enabled.some((r) => r.id === value) ? value : enabled[0]?.id;
|
|
5853
|
+
const onKey = (e) => {
|
|
5854
|
+
const keys = ["ArrowDown", "ArrowUp", "ArrowRight", "ArrowLeft", "Home", "End"];
|
|
5855
|
+
if (!keys.includes(e.key) || enabled.length === 0) return;
|
|
5856
|
+
e.preventDefault();
|
|
5857
|
+
const i = Math.max(0, enabled.findIndex((r) => r.id === value));
|
|
5858
|
+
const next = e.key === "Home" ? 0 : e.key === "End" ? enabled.length - 1 : e.key === "ArrowDown" || e.key === "ArrowRight" ? (i + 1) % enabled.length : (i - 1 + enabled.length) % enabled.length;
|
|
5859
|
+
onPick(enabled[next].id);
|
|
5860
|
+
const el = e.currentTarget.querySelectorAll('[role="radio"]:not([aria-disabled="true"])')[next];
|
|
5861
|
+
el?.focus();
|
|
5862
|
+
};
|
|
5863
|
+
return /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)("div", { className: cn("flex min-w-0 flex-col p-1", className), children: [
|
|
5864
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)(MenuLabel, { id, children: label }),
|
|
5865
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)("div", { role: "radiogroup", "aria-labelledby": id, onKeyDown: onKey, "data-testid": testId, "data-first-group": first ? "" : void 0, className: "flex flex-col", children: rows.map((r) => {
|
|
5866
|
+
const checked = r.id === value;
|
|
5867
|
+
return /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(
|
|
5868
|
+
"button",
|
|
5869
|
+
{
|
|
5870
|
+
type: "button",
|
|
5871
|
+
role: "radio",
|
|
5872
|
+
"aria-checked": checked,
|
|
5873
|
+
"aria-disabled": r.disabled || void 0,
|
|
5874
|
+
tabIndex: r.id === tabStop ? 0 : -1,
|
|
5875
|
+
onClick: () => !r.disabled && onPick(r.id),
|
|
5876
|
+
className: cn(
|
|
5877
|
+
// MenuItem's row: 36px, 14px, inset and rounded, the tick on the right.
|
|
5878
|
+
"flex min-h-9 w-full items-center gap-2.5 rounded-control px-3 py-1.5 text-left text-sm text-text-primary transition-colors",
|
|
5879
|
+
"focus-visible:outline-solid focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-border-focus",
|
|
5880
|
+
r.disabled ? "cursor-not-allowed opacity-40" : "hover:bg-subtle focus-visible:bg-subtle"
|
|
5881
|
+
),
|
|
5882
|
+
children: [
|
|
5883
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)("span", { className: "min-w-0 flex-1 truncate", children: r.label }),
|
|
5884
|
+
checked && /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(import_lucide_react30.Check, { size: 16, "aria-hidden": "true", className: "shrink-0 text-brand-primaryAction" })
|
|
5885
|
+
]
|
|
5886
|
+
},
|
|
5887
|
+
r.id ?? "__none"
|
|
5888
|
+
);
|
|
5889
|
+
}) })
|
|
5890
|
+
] });
|
|
5891
|
+
}
|
|
5892
|
+
function HeaderMenuTrigger({
|
|
5893
|
+
menu,
|
|
5894
|
+
columnLabel,
|
|
5895
|
+
testId
|
|
5896
|
+
}) {
|
|
5897
|
+
const [open, setOpen] = (0, import_react32.useState)(false);
|
|
5898
|
+
const [pos, setPos] = (0, import_react32.useState)(null);
|
|
5899
|
+
const trigger = (0, import_react32.useRef)(null);
|
|
5900
|
+
const panel = (0, import_react32.useRef)(null);
|
|
5901
|
+
const { groupBy, breakOutBy } = menu;
|
|
5902
|
+
const groupLabel = groupBy.options.find((o) => o.id === groupBy.value)?.label ?? "";
|
|
5903
|
+
const breakLabel = breakOutBy?.value != null ? breakOutBy.options.find((o) => o.id === breakOutBy.value)?.label : void 0;
|
|
5904
|
+
const [draftGroup, setDraftGroup] = (0, import_react32.useState)(groupBy.value);
|
|
5905
|
+
const [draftBreak, setDraftBreak] = (0, import_react32.useState)(breakOutBy?.value ?? null);
|
|
5906
|
+
const openPanel = () => {
|
|
5907
|
+
setDraftGroup(groupBy.value);
|
|
5908
|
+
setDraftBreak(breakOutBy?.value ?? null);
|
|
5909
|
+
setOpen(true);
|
|
5910
|
+
};
|
|
5911
|
+
const close = (0, import_react32.useCallback)((refocus) => {
|
|
5912
|
+
setOpen(false);
|
|
5913
|
+
if (refocus) trigger.current?.focus();
|
|
5914
|
+
}, []);
|
|
5915
|
+
const apply = () => {
|
|
5916
|
+
if (draftGroup !== groupBy.value) groupBy.onChange(draftGroup);
|
|
5917
|
+
if (breakOutBy && draftBreak !== breakOutBy.value) breakOutBy.onChange(draftBreak);
|
|
5918
|
+
close(true);
|
|
5919
|
+
};
|
|
5920
|
+
const place = (0, import_react32.useCallback)(() => {
|
|
5921
|
+
const t = trigger.current;
|
|
5922
|
+
if (!t) return;
|
|
5923
|
+
const r = t.getBoundingClientRect();
|
|
5924
|
+
const h = panel.current?.offsetHeight ?? 0;
|
|
5925
|
+
const above = r.bottom + 4 + h > window.innerHeight && r.top - 4 - h > 0;
|
|
5926
|
+
setPos({ top: above ? r.top - 4 - h : r.bottom + 4, left: r.left });
|
|
5927
|
+
}, []);
|
|
5928
|
+
(0, import_react32.useLayoutEffect)(() => {
|
|
5929
|
+
if (open) place();
|
|
5930
|
+
else setPos(null);
|
|
5931
|
+
}, [open, place]);
|
|
5932
|
+
const placed = pos !== null;
|
|
5933
|
+
(0, import_react32.useEffect)(() => {
|
|
5934
|
+
if (open && placed) panel.current?.querySelector('[data-first-group] [tabindex="0"]')?.focus();
|
|
5935
|
+
}, [open, placed]);
|
|
5936
|
+
(0, import_react32.useEffect)(() => {
|
|
5937
|
+
if (!open) return void 0;
|
|
5938
|
+
const onDown = (e) => {
|
|
5939
|
+
const t = e.target;
|
|
5940
|
+
if (trigger.current?.contains(t) || panel.current?.contains(t)) return;
|
|
5941
|
+
close(false);
|
|
5942
|
+
};
|
|
5943
|
+
window.addEventListener("mousedown", onDown);
|
|
5944
|
+
window.addEventListener("resize", place);
|
|
5945
|
+
window.addEventListener("scroll", place, true);
|
|
5946
|
+
return () => {
|
|
5947
|
+
window.removeEventListener("mousedown", onDown);
|
|
5948
|
+
window.removeEventListener("resize", place);
|
|
5949
|
+
window.removeEventListener("scroll", place, true);
|
|
5950
|
+
};
|
|
5951
|
+
}, [open, close, place]);
|
|
5952
|
+
const onTriggerKey = (e) => {
|
|
5953
|
+
if (e.key === "ArrowDown" && !open) {
|
|
5954
|
+
e.preventDefault();
|
|
5955
|
+
openPanel();
|
|
5956
|
+
}
|
|
5957
|
+
};
|
|
5958
|
+
const onPanelKey = (e) => {
|
|
5959
|
+
if (e.key === "Escape") {
|
|
5960
|
+
e.preventDefault();
|
|
5961
|
+
e.stopPropagation();
|
|
5962
|
+
close(true);
|
|
5963
|
+
return;
|
|
5964
|
+
}
|
|
5965
|
+
if (e.key === "Tab") {
|
|
5966
|
+
const stops = [...e.currentTarget.querySelectorAll('[tabindex="0"], button:not([tabindex])')];
|
|
5967
|
+
const at = stops.indexOf(document.activeElement);
|
|
5968
|
+
if (e.shiftKey && at === 0 || !e.shiftKey && at === stops.length - 1) {
|
|
5969
|
+
e.preventDefault();
|
|
5970
|
+
close(true);
|
|
5971
|
+
}
|
|
5972
|
+
}
|
|
5973
|
+
};
|
|
5974
|
+
const pickGroup = (id) => {
|
|
5975
|
+
setDraftGroup(id);
|
|
5976
|
+
if (draftBreak === id) setDraftBreak(null);
|
|
5977
|
+
};
|
|
5978
|
+
return /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(import_jsx_runtime57.Fragment, { children: [
|
|
5979
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(
|
|
5980
|
+
"button",
|
|
5981
|
+
{
|
|
5982
|
+
ref: trigger,
|
|
5983
|
+
type: "button",
|
|
5984
|
+
"aria-haspopup": "dialog",
|
|
5985
|
+
"aria-expanded": open,
|
|
5986
|
+
"data-testid": testId,
|
|
5987
|
+
onClick: () => open ? close(false) : openPanel(),
|
|
5988
|
+
onKeyDown: onTriggerKey,
|
|
5989
|
+
className: cn(
|
|
5990
|
+
// Restores the header row's uppercase: a <button> doesn't inherit
|
|
5991
|
+
// text-transform (see SortButton). The negative margin keeps the
|
|
5992
|
+
// label lined up with the names under it while the hover fill
|
|
5993
|
+
// reaches past it.
|
|
5994
|
+
"-mx-1.5 -my-1 inline-flex items-center gap-1 rounded-control px-1.5 py-1 uppercase transition-colors",
|
|
5995
|
+
"hover:bg-border-default hover:text-text-primary aria-expanded:bg-border-default aria-expanded:text-text-primary",
|
|
5996
|
+
"focus-visible:outline-solid focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-border-focus"
|
|
5997
|
+
),
|
|
5998
|
+
children: [
|
|
5999
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsxs)("span", { children: [
|
|
6000
|
+
groupLabel,
|
|
6001
|
+
breakLabel && /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(import_jsx_runtime57.Fragment, { children: [
|
|
6002
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)("span", { "aria-hidden": "true", className: "text-text-tertiary", children: " \u203A " }),
|
|
6003
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)("span", { className: "sr-only", children: " then " }),
|
|
6004
|
+
breakLabel
|
|
6005
|
+
] })
|
|
6006
|
+
] }),
|
|
6007
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)(import_lucide_react30.ChevronDown, { size: 12, "aria-hidden": "true", className: cn("shrink-0 transition-transform motion-reduce:transition-none", open && "rotate-180") })
|
|
6008
|
+
]
|
|
6009
|
+
}
|
|
6010
|
+
),
|
|
6011
|
+
open && (0, import_react_dom9.createPortal)(
|
|
6012
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(
|
|
6013
|
+
"div",
|
|
6014
|
+
{
|
|
6015
|
+
ref: panel,
|
|
6016
|
+
role: "dialog",
|
|
6017
|
+
"aria-label": columnLabel,
|
|
6018
|
+
"data-testid": testId && `${testId}-menu`,
|
|
6019
|
+
onKeyDown: onPanelKey,
|
|
6020
|
+
style: { position: "fixed", top: pos?.top ?? 0, left: pos?.left ?? 0, visibility: pos ? void 0 : "hidden" },
|
|
6021
|
+
className: cn(
|
|
6022
|
+
"z-dropdown flex max-h-120 flex-col overflow-hidden rounded-card border border-border-default bg-surface text-left normal-case tracking-normal shadow-overlay",
|
|
6023
|
+
// Two columns side by side, as Advertising Trends' Group by.
|
|
6024
|
+
breakOutBy ? "w-105" : "w-60"
|
|
6025
|
+
),
|
|
6026
|
+
children: [
|
|
6027
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsxs)("div", { className: cn("grid min-h-0 overflow-y-auto", breakOutBy && "grid-cols-2"), children: [
|
|
6028
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
|
|
6029
|
+
RadioSection,
|
|
6030
|
+
{
|
|
6031
|
+
first: true,
|
|
6032
|
+
label: groupBy.label ?? "Group rows by",
|
|
6033
|
+
rows: groupBy.options,
|
|
6034
|
+
value: draftGroup,
|
|
6035
|
+
onPick: pickGroup,
|
|
6036
|
+
className: breakOutBy ? "border-r border-border-default" : void 0
|
|
6037
|
+
}
|
|
6038
|
+
),
|
|
6039
|
+
breakOutBy && /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
|
|
6040
|
+
RadioSection,
|
|
6041
|
+
{
|
|
6042
|
+
label: breakOutBy.label ?? "Then break out by",
|
|
6043
|
+
rows: [{ id: null, label: "None" }, ...breakOutBy.options.map((o) => ({ ...o, disabled: o.id === draftGroup }))],
|
|
6044
|
+
value: draftBreak,
|
|
6045
|
+
onPick: setDraftBreak
|
|
6046
|
+
}
|
|
6047
|
+
)
|
|
6048
|
+
] }),
|
|
6049
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)(FilterDropdownFooter, { onApply: apply })
|
|
6050
|
+
]
|
|
6051
|
+
}
|
|
6052
|
+
),
|
|
6053
|
+
document.body
|
|
6054
|
+
)
|
|
6055
|
+
] });
|
|
6056
|
+
}
|
|
6057
|
+
|
|
6058
|
+
// src/DataTable.tsx
|
|
6059
|
+
var import_jsx_runtime58 = require("react/jsx-runtime");
|
|
5719
6060
|
var WIDTH3 = { fill: "", sm: "w-24", md: "w-36", lg: "w-48" };
|
|
5720
6061
|
var MAX_H = { sm: "max-h-80", md: "max-h-120", lg: "max-h-160" };
|
|
5721
6062
|
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)]";
|
|
5722
6063
|
var HEAD_PAD = { default: "px-4 py-3", compact: "px-3 py-2" };
|
|
5723
6064
|
var CELL_PAD = { default: "px-4 py-3.5", compact: "px-3 py-2" };
|
|
6065
|
+
var EXPAND_PAD = "px-2";
|
|
5724
6066
|
var SUB_INDENT = { default: "pl-10", compact: "pl-9" };
|
|
5725
6067
|
var TINT = "bg-brand-primaryTint";
|
|
5726
6068
|
var TINT_HOVER = "group-hover/row:bg-linear-to-r group-hover/row:from-brand-primaryAction/10 group-hover/row:to-brand-primaryAction/10";
|
|
@@ -5736,7 +6078,7 @@ function isDev() {
|
|
|
5736
6078
|
return false;
|
|
5737
6079
|
}
|
|
5738
6080
|
}
|
|
5739
|
-
var useBrowserLayoutEffect = typeof window === "undefined" ?
|
|
6081
|
+
var useBrowserLayoutEffect = typeof window === "undefined" ? import_react33.useEffect : import_react33.useLayoutEffect;
|
|
5740
6082
|
function rowClickCounts(e) {
|
|
5741
6083
|
if (e.target.closest(OWN_CLICK)) return false;
|
|
5742
6084
|
const sel = window.getSelection?.();
|
|
@@ -5744,13 +6086,13 @@ function rowClickCounts(e) {
|
|
|
5744
6086
|
return true;
|
|
5745
6087
|
}
|
|
5746
6088
|
function NoValue({ reason = "No data" }) {
|
|
5747
|
-
return /* @__PURE__ */ (0,
|
|
5748
|
-
/* @__PURE__ */ (0,
|
|
5749
|
-
/* @__PURE__ */ (0,
|
|
6089
|
+
return /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)(Tooltip, { label: reason, delay: 300, className: "text-text-tertiary", children: [
|
|
6090
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)("span", { "aria-hidden": "true", children: NO_VALUE }),
|
|
6091
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)("span", { className: "sr-only", children: reason })
|
|
5750
6092
|
] });
|
|
5751
6093
|
}
|
|
5752
6094
|
function TableLink({ className, ...props }) {
|
|
5753
|
-
return /* @__PURE__ */ (0,
|
|
6095
|
+
return /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
5754
6096
|
"a",
|
|
5755
6097
|
{
|
|
5756
6098
|
...props,
|
|
@@ -5807,7 +6149,7 @@ function DataTable({
|
|
|
5807
6149
|
...rest
|
|
5808
6150
|
}) {
|
|
5809
6151
|
const maxHeight = sticky ? void 0 : maxHeightProp;
|
|
5810
|
-
const titleId = (0,
|
|
6152
|
+
const titleId = (0, import_react33.useId)();
|
|
5811
6153
|
const showSkeleton = useDelayedLoading(loading);
|
|
5812
6154
|
const head = HEAD_PAD[density];
|
|
5813
6155
|
const pad2 = CELL_PAD[density];
|
|
@@ -5820,7 +6162,7 @@ function DataTable({
|
|
|
5820
6162
|
onSortChange?.(cycleSort(shown, key, col?.firstDir ?? (right(col) ? "desc" : "asc"), defaultSort));
|
|
5821
6163
|
};
|
|
5822
6164
|
const clash = !!onRowClick && (!!renderExpandedProp || !!subRowsProp);
|
|
5823
|
-
(0,
|
|
6165
|
+
(0, import_react33.useEffect)(() => {
|
|
5824
6166
|
if (clash && isDev()) {
|
|
5825
6167
|
console.warn("DataTable: pass `onRowClick` or rows that open in place (`renderExpanded`, `subRows`), not both. The row click wins; rows won't open.");
|
|
5826
6168
|
}
|
|
@@ -5831,10 +6173,10 @@ function DataTable({
|
|
|
5831
6173
|
const kids = subRows?.(row);
|
|
5832
6174
|
return kids && kids.length > 0 ? kids : null;
|
|
5833
6175
|
};
|
|
5834
|
-
const [open, setOpen] = (0,
|
|
6176
|
+
const [open, setOpen] = (0, import_react33.useState)(() => /* @__PURE__ */ new Set());
|
|
5835
6177
|
const visible = rows.map(rowKey);
|
|
5836
6178
|
const resetOn = subRows ? [...visible].sort().join("|") : `${shown?.key}|${shown?.dir}|${visible.join("|")}`;
|
|
5837
|
-
(0,
|
|
6179
|
+
(0, import_react33.useEffect)(() => setOpen(/* @__PURE__ */ new Set()), [resetOn]);
|
|
5838
6180
|
const expandable = (row) => (!!renderExpanded || !!childrenOf(row)) && (canExpand ? canExpand(row) : true);
|
|
5839
6181
|
const anyExpandable = (!!renderExpanded || !!subRows) && rows.some(expandable);
|
|
5840
6182
|
const toggle = (key) => setOpen((prev) => {
|
|
@@ -5855,8 +6197,8 @@ function DataTable({
|
|
|
5855
6197
|
pickable.forEach((k) => allVisible ? next.delete(k) : next.add(k));
|
|
5856
6198
|
setPicked(next);
|
|
5857
6199
|
};
|
|
5858
|
-
const lastPicked = (0,
|
|
5859
|
-
const shiftHeld = (0,
|
|
6200
|
+
const lastPicked = (0, import_react33.useRef)(null);
|
|
6201
|
+
const shiftHeld = (0, import_react33.useRef)(false);
|
|
5860
6202
|
const togglePick = (index) => {
|
|
5861
6203
|
const key = visible[index];
|
|
5862
6204
|
const on = !picked.has(key);
|
|
@@ -5873,12 +6215,12 @@ function DataTable({
|
|
|
5873
6215
|
};
|
|
5874
6216
|
const count = selectedCount ?? picked.size;
|
|
5875
6217
|
const barCount = selectable && selectionBar ? count : 0;
|
|
5876
|
-
const scroller = (0,
|
|
5877
|
-
const [pinned, setPinned] = (0,
|
|
5878
|
-
const [scrolled, setScrolled] = (0,
|
|
5879
|
-
const heads = (0,
|
|
5880
|
-
const [lefts, setLefts] = (0,
|
|
5881
|
-
(0,
|
|
6218
|
+
const scroller = (0, import_react33.useRef)(null);
|
|
6219
|
+
const [pinned, setPinned] = (0, import_react33.useState)(false);
|
|
6220
|
+
const [scrolled, setScrolled] = (0, import_react33.useState)(false);
|
|
6221
|
+
const heads = (0, import_react33.useRef)(/* @__PURE__ */ new Map());
|
|
6222
|
+
const [lefts, setLefts] = (0, import_react33.useState)({});
|
|
6223
|
+
(0, import_react33.useEffect)(() => {
|
|
5882
6224
|
const el = scroller.current;
|
|
5883
6225
|
if (!el || typeof ResizeObserver === "undefined") return void 0;
|
|
5884
6226
|
const measure = () => {
|
|
@@ -5911,19 +6253,19 @@ function DataTable({
|
|
|
5911
6253
|
part === nameIdx && "max-w-60 border-r border-r-border-default"
|
|
5912
6254
|
) : "";
|
|
5913
6255
|
const pinStyle = (part) => isPinned(part) ? { left: leftOf(part) } : void 0;
|
|
5914
|
-
const edge = (part) => pinned && scrolled && part === nameIdx ? /* @__PURE__ */ (0,
|
|
6256
|
+
const edge = (part) => pinned && scrolled && part === nameIdx ? /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("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;
|
|
5915
6257
|
const span = columns.length + (anyExpandable ? 1 : 0) + (selectable ? 1 : 0);
|
|
5916
|
-
const wrapRef = (0,
|
|
5917
|
-
const theadRef = (0,
|
|
5918
|
-
const cloneRef = (0,
|
|
5919
|
-
const [stuck, setStuck] = (0,
|
|
5920
|
-
const [geom, setGeom] = (0,
|
|
5921
|
-
const [barH, setBarH] = (0,
|
|
5922
|
-
const [scrollPad, setScrollPad] = (0,
|
|
5923
|
-
const [footerStuck, setFooterStuck] = (0,
|
|
5924
|
-
const [scrolledDown, setScrolledDown] = (0,
|
|
5925
|
-
const [animate, setAnimate] = (0,
|
|
5926
|
-
(0,
|
|
6258
|
+
const wrapRef = (0, import_react33.useRef)(null);
|
|
6259
|
+
const theadRef = (0, import_react33.useRef)(null);
|
|
6260
|
+
const cloneRef = (0, import_react33.useRef)(null);
|
|
6261
|
+
const [stuck, setStuck] = (0, import_react33.useState)(false);
|
|
6262
|
+
const [geom, setGeom] = (0, import_react33.useState)({ cols: [], width: 0, height: 0 });
|
|
6263
|
+
const [barH, setBarH] = (0, import_react33.useState)(0);
|
|
6264
|
+
const [scrollPad, setScrollPad] = (0, import_react33.useState)({ top: 0, bottom: 0 });
|
|
6265
|
+
const [footerStuck, setFooterStuck] = (0, import_react33.useState)(false);
|
|
6266
|
+
const [scrolledDown, setScrolledDown] = (0, import_react33.useState)(false);
|
|
6267
|
+
const [animate, setAnimate] = (0, import_react33.useState)(false);
|
|
6268
|
+
(0, import_react33.useEffect)(() => {
|
|
5927
6269
|
const thead = theadRef.current;
|
|
5928
6270
|
if (!sticky || !thead || typeof ResizeObserver === "undefined") return void 0;
|
|
5929
6271
|
const measure = () => {
|
|
@@ -5972,7 +6314,7 @@ function DataTable({
|
|
|
5972
6314
|
ro?.disconnect();
|
|
5973
6315
|
};
|
|
5974
6316
|
}, [sticky]);
|
|
5975
|
-
(0,
|
|
6317
|
+
(0, import_react33.useEffect)(() => {
|
|
5976
6318
|
const clone = cloneRef.current;
|
|
5977
6319
|
if (!clone) return;
|
|
5978
6320
|
clone.querySelectorAll("button, a[href], input, [tabindex]").forEach((el) => {
|
|
@@ -5983,9 +6325,9 @@ function DataTable({
|
|
|
5983
6325
|
const top = (stickyTop ?? barH) - scrollPad.top;
|
|
5984
6326
|
const renderCell = (c, row) => {
|
|
5985
6327
|
const v = c.cell(row);
|
|
5986
|
-
return v === null || v === void 0 || v === "" ? /* @__PURE__ */ (0,
|
|
6328
|
+
return v === null || v === void 0 || v === "" ? /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(NoValue, { reason: c.missing }) : v;
|
|
5987
6329
|
};
|
|
5988
|
-
const fit = (ci, content) => pinned && ci === nameIdx ? /* @__PURE__ */ (0,
|
|
6330
|
+
const fit = (ci, content) => pinned && ci === nameIdx ? /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(Tooltip, { label: content, whenTruncated: true, delay: 300, className: "block truncate", children: content }) : content;
|
|
5989
6331
|
const colBg = (c, rowBg) => c.highlight ? TINT : rowBg;
|
|
5990
6332
|
const firstPart = selectable ? "select" : anyExpandable ? "expand" : 0;
|
|
5991
6333
|
const ringCls = (part) => onRowClick ? cn(
|
|
@@ -5995,13 +6337,13 @@ function DataTable({
|
|
|
5995
6337
|
part === columns.length - 1 && RING_RIGHT,
|
|
5996
6338
|
pinned && scrolled && part === nameIdx && part !== columns.length - 1 && RING_PAST_EDGE
|
|
5997
6339
|
) : "";
|
|
5998
|
-
const plainRow = (kind, row, key, rowBg, extra) => /* @__PURE__ */ (0,
|
|
5999
|
-
selectable && /* @__PURE__ */ (0,
|
|
6000
|
-
anyExpandable && /* @__PURE__ */ (0,
|
|
6340
|
+
const plainRow = (kind, row, key, rowBg, extra) => /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("tr", { id: extra?.id, className: cn("[&:last-child>td]:border-b-0", kind === "total" && "font-semibold"), children: [
|
|
6341
|
+
selectable && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("td", { className: cn("border-b border-border-default pr-0", pad2, rowBg, pinCls("select", "body", rowBg)), style: pinStyle("select") }),
|
|
6342
|
+
anyExpandable && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("td", { className: cn("border-b border-border-default", pad2, EXPAND_PAD, rowBg, pinCls("expand", "body", rowBg)), style: pinStyle("expand") }),
|
|
6001
6343
|
columns.map((c, ci) => {
|
|
6002
6344
|
const bg = kind === "sub" ? colBg(c, rowBg) : rowBg;
|
|
6003
6345
|
const isName = ci === nameIdx;
|
|
6004
|
-
return /* @__PURE__ */ (0,
|
|
6346
|
+
return /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)(
|
|
6005
6347
|
"td",
|
|
6006
6348
|
{
|
|
6007
6349
|
className: cn(
|
|
@@ -6016,8 +6358,8 @@ function DataTable({
|
|
|
6016
6358
|
),
|
|
6017
6359
|
style: pinStyle(ci),
|
|
6018
6360
|
children: [
|
|
6019
|
-
c.rank || c.lead ? null : isName && kind === "total" ? fit(ci, totalsLabel) : kind === "total" ? /* @__PURE__ */ (0,
|
|
6020
|
-
kind === "sub" && isName && rowLabel && extra?.parent !== void 0 && /* @__PURE__ */ (0,
|
|
6361
|
+
c.rank || c.lead ? null : isName && kind === "total" ? fit(ci, totalsLabel) : kind === "total" ? /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(DeltaBoldContext.Provider, { value: true, children: fit(ci, renderCell(c, row)) }) : fit(ci, renderCell(c, row)),
|
|
6362
|
+
kind === "sub" && isName && rowLabel && extra?.parent !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("span", { className: "sr-only", children: [
|
|
6021
6363
|
", in ",
|
|
6022
6364
|
rowLabel(extra.parent)
|
|
6023
6365
|
] }),
|
|
@@ -6028,8 +6370,8 @@ function DataTable({
|
|
|
6028
6370
|
);
|
|
6029
6371
|
})
|
|
6030
6372
|
] }, key);
|
|
6031
|
-
const headRow = (clone) => /* @__PURE__ */ (0,
|
|
6032
|
-
selectable && /* @__PURE__ */ (0,
|
|
6373
|
+
const headRow = (clone) => /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("tr", { className: "bg-subtle text-micro font-semibold uppercase tracking-wider text-text-secondary", children: [
|
|
6374
|
+
selectable && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("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__ */ (0, import_jsx_runtime58.jsx)(
|
|
6033
6375
|
CheckBox,
|
|
6034
6376
|
{
|
|
6035
6377
|
checked: allVisible,
|
|
@@ -6038,14 +6380,14 @@ function DataTable({
|
|
|
6038
6380
|
disabled: pickable.length === 0,
|
|
6039
6381
|
ariaLabel: allVisible ? "Deselect all rows on this page" : "Select all rows on this page"
|
|
6040
6382
|
}
|
|
6041
|
-
) : /* @__PURE__ */ (0,
|
|
6042
|
-
anyExpandable && /* @__PURE__ */ (0,
|
|
6043
|
-
columns.map((c, ci) => /* @__PURE__ */ (0,
|
|
6383
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("span", { className: "sr-only", children: "Select" }) }),
|
|
6384
|
+
anyExpandable && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("th", { ref: clone ? void 0 : headRef("expand"), scope: "col", className: cn("w-10 border-b border-border-default", head, EXPAND_PAD, pinCls("expand", "head")), style: pinStyle("expand"), children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("span", { className: "sr-only", children: "Details" }) }),
|
|
6385
|
+
columns.map((c, ci) => /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)(
|
|
6044
6386
|
"th",
|
|
6045
6387
|
{
|
|
6046
6388
|
ref: !clone && ci <= nameIdx ? headRef(ci) : void 0,
|
|
6047
6389
|
scope: "col",
|
|
6048
|
-
"aria-sort": c.sortable ? ariaSortFor(shown, c.key) : void 0,
|
|
6390
|
+
"aria-sort": c.sortable && !c.headerMenu ? ariaSortFor(shown, c.key) : void 0,
|
|
6049
6391
|
className: cn(
|
|
6050
6392
|
"group/head whitespace-nowrap border-b border-border-default font-semibold",
|
|
6051
6393
|
head,
|
|
@@ -6056,7 +6398,14 @@ function DataTable({
|
|
|
6056
6398
|
),
|
|
6057
6399
|
style: pinStyle(ci),
|
|
6058
6400
|
children: [
|
|
6059
|
-
c.
|
|
6401
|
+
c.headerMenu ? /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
6402
|
+
HeaderMenuTrigger,
|
|
6403
|
+
{
|
|
6404
|
+
menu: c.headerMenu,
|
|
6405
|
+
columnLabel: c.label,
|
|
6406
|
+
testId: clone || !testIdPrefix ? void 0 : `${testIdPrefix}-header-menu-${c.key}`
|
|
6407
|
+
}
|
|
6408
|
+
) : c.sortable && onSortChange ? /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
6060
6409
|
SortButton,
|
|
6061
6410
|
{
|
|
6062
6411
|
label: c.label,
|
|
@@ -6067,7 +6416,7 @@ function DataTable({
|
|
|
6067
6416
|
description: c.info,
|
|
6068
6417
|
testIdPrefix: clone ? void 0 : testIdPrefix
|
|
6069
6418
|
}
|
|
6070
|
-
) : c.info ? /* @__PURE__ */ (0,
|
|
6419
|
+
) : c.info ? /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(SortButton, { label: c.label, sortKey: c.key, sortable: false, sort: sortProp(shown), onSort: () => {
|
|
6071
6420
|
}, description: c.info, align: right(c) ? "right" : "left" }) : c.label,
|
|
6072
6421
|
edge(ci)
|
|
6073
6422
|
]
|
|
@@ -6076,19 +6425,19 @@ function DataTable({
|
|
|
6076
6425
|
))
|
|
6077
6426
|
] });
|
|
6078
6427
|
const inside = variant === "chart";
|
|
6079
|
-
const bar = barCount > 0 ? /* @__PURE__ */ (0,
|
|
6080
|
-
/* @__PURE__ */ (0,
|
|
6428
|
+
const bar = barCount > 0 ? /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("div", { className: "flex flex-wrap items-center gap-x-3 gap-y-1 text-dense", children: [
|
|
6429
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("span", { role: "status", className: "font-medium text-text-primary", children: [
|
|
6081
6430
|
formatCountFull(count),
|
|
6082
6431
|
" selected"
|
|
6083
6432
|
] }),
|
|
6084
|
-
allVisible && totalCount !== void 0 && count < totalCount && onSelectAll && /* @__PURE__ */ (0,
|
|
6433
|
+
allVisible && totalCount !== void 0 && count < totalCount && onSelectAll && /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)(Button, { variant: "link", size: "sm", onClick: onSelectAll, children: [
|
|
6085
6434
|
"Select all ",
|
|
6086
6435
|
formatCountFull(totalCount)
|
|
6087
6436
|
] }),
|
|
6088
6437
|
selectionActions,
|
|
6089
|
-
/* @__PURE__ */ (0,
|
|
6438
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)(Button, { variant: "link", size: "sm", onClick: () => onSelectedChange?.([]), children: "Clear" })
|
|
6090
6439
|
] }) : null;
|
|
6091
|
-
const scrollArea = /* @__PURE__ */ (0,
|
|
6440
|
+
const scrollArea = /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
6092
6441
|
"div",
|
|
6093
6442
|
{
|
|
6094
6443
|
ref: scroller,
|
|
@@ -6097,7 +6446,7 @@ function DataTable({
|
|
|
6097
6446
|
if (cloneRef.current) cloneRef.current.scrollLeft = e.currentTarget.scrollLeft;
|
|
6098
6447
|
},
|
|
6099
6448
|
className: cn("overflow-x-auto", SCROLLBAR, maxHeight && cn("overflow-y-auto", MAX_H[maxHeight])),
|
|
6100
|
-
children: /* @__PURE__ */ (0,
|
|
6449
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)(
|
|
6101
6450
|
"table",
|
|
6102
6451
|
{
|
|
6103
6452
|
"aria-labelledby": title ? titleId : void 0,
|
|
@@ -6105,12 +6454,12 @@ function DataTable({
|
|
|
6105
6454
|
"aria-busy": loading || refreshing || void 0,
|
|
6106
6455
|
className: "w-full border-separate border-spacing-0 text-left",
|
|
6107
6456
|
children: [
|
|
6108
|
-
/* @__PURE__ */ (0,
|
|
6109
|
-
/* @__PURE__ */ (0,
|
|
6110
|
-
selectable && /* @__PURE__ */ (0,
|
|
6111
|
-
anyExpandable && /* @__PURE__ */ (0,
|
|
6112
|
-
columns.map((c) => /* @__PURE__ */ (0,
|
|
6113
|
-
] }, i)) : rows.length === 0 ? /* @__PURE__ */ (0,
|
|
6457
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)("thead", { ref: theadRef, className: cn(maxHeight && "sticky top-0 z-10"), children: headRow(false) }),
|
|
6458
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)("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__ */ (0, import_jsx_runtime58.jsxs)("tr", { "aria-hidden": "true", className: "[&:last-child>td]:border-b-0", children: [
|
|
6459
|
+
selectable && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("td", { className: cn("border-b border-border-default", pad2) }),
|
|
6460
|
+
anyExpandable && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("td", { className: cn("border-b border-border-default", pad2, EXPAND_PAD) }),
|
|
6461
|
+
columns.map((c) => /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("td", { className: cn("border-b border-border-default", pad2, align(c)), children: showSkeleton ? /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(Skeleton, { className: cn("inline-block", right(c) ? "w-12" : "w-2/3") }) : /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("span", { className: "inline-block h-3" }) }, c.key))
|
|
6462
|
+
] }, i)) : rows.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("tr", { children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("td", { colSpan: span, className: "px-6 py-12", children: empty ?? /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(NoResultsEmptyState, {}) }) }) : /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)(import_jsx_runtime58.Fragment, { children: [
|
|
6114
6463
|
totalsRow !== void 0 && plainRow("total", totalsRow, "__totals", "bg-subtle"),
|
|
6115
6464
|
rows.map((row, ri) => {
|
|
6116
6465
|
const key = rowKey(row);
|
|
@@ -6125,8 +6474,8 @@ function DataTable({
|
|
|
6125
6474
|
const ticked = picked.has(key);
|
|
6126
6475
|
const label = rowLabel ? rowLabel(row) : "row";
|
|
6127
6476
|
const clickable = !!onRowClick || canOpen;
|
|
6128
|
-
return /* @__PURE__ */ (0,
|
|
6129
|
-
/* @__PURE__ */ (0,
|
|
6477
|
+
return /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)(import_react33.Fragment, { children: [
|
|
6478
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsxs)(
|
|
6130
6479
|
"tr",
|
|
6131
6480
|
{
|
|
6132
6481
|
onClick: onRowClick ? (e) => rowClickCounts(e) && onRowClick(row) : canOpen ? (e) => rowClickCounts(e) && toggle(key) : void 0,
|
|
@@ -6137,14 +6486,14 @@ function DataTable({
|
|
|
6137
6486
|
// The row's hidden open button has keyboard focus: ring the whole row.
|
|
6138
6487
|
),
|
|
6139
6488
|
children: [
|
|
6140
|
-
selectable && /* @__PURE__ */ (0,
|
|
6489
|
+
selectable && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
6141
6490
|
"td",
|
|
6142
6491
|
{
|
|
6143
6492
|
onPointerDownCapture: (e) => shiftHeld.current = e.shiftKey,
|
|
6144
6493
|
onKeyDownCapture: (e) => shiftHeld.current = e.shiftKey,
|
|
6145
6494
|
className: cn("border-b border-border-default pr-0", pad2, panelOpen && "border-b-0", rowBg, ringCls("select"), pinCls("select", "body", rowBg)),
|
|
6146
6495
|
style: pinStyle("select"),
|
|
6147
|
-
children: reason ? /* @__PURE__ */ (0,
|
|
6496
|
+
children: reason ? /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(Tooltip, { label: reason, delay: 300, className: "inline-flex align-middle", children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
6148
6497
|
"button",
|
|
6149
6498
|
{
|
|
6150
6499
|
type: "button",
|
|
@@ -6154,17 +6503,17 @@ function DataTable({
|
|
|
6154
6503
|
"aria-label": `Select ${label}`,
|
|
6155
6504
|
onClick: (e) => e.preventDefault(),
|
|
6156
6505
|
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",
|
|
6157
|
-
children: /* @__PURE__ */ (0,
|
|
6506
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(CheckBoxBox, { checked: ticked, disabled: true })
|
|
6158
6507
|
}
|
|
6159
|
-
) }) : /* @__PURE__ */ (0,
|
|
6508
|
+
) }) : /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(CheckBox, { checked: ticked, onChange: () => togglePick(ri), ariaLabel: `Select ${label}` })
|
|
6160
6509
|
}
|
|
6161
6510
|
),
|
|
6162
|
-
anyExpandable && /* @__PURE__ */ (0,
|
|
6511
|
+
anyExpandable && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
6163
6512
|
"td",
|
|
6164
6513
|
{
|
|
6165
|
-
className: cn("border-b border-border-default
|
|
6514
|
+
className: cn("border-b border-border-default", pad2, EXPAND_PAD, panelOpen && "border-b-0", rowBg, ringCls("expand"), pinCls("expand", "body", rowBg)),
|
|
6166
6515
|
style: pinStyle("expand"),
|
|
6167
|
-
children: canOpen && /* @__PURE__ */ (0,
|
|
6516
|
+
children: canOpen && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
6168
6517
|
"button",
|
|
6169
6518
|
{
|
|
6170
6519
|
type: "button",
|
|
@@ -6173,8 +6522,8 @@ function DataTable({
|
|
|
6173
6522
|
"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)}` : ""}`,
|
|
6174
6523
|
onClick: () => toggle(key),
|
|
6175
6524
|
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",
|
|
6176
|
-
children: /* @__PURE__ */ (0,
|
|
6177
|
-
|
|
6525
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
6526
|
+
import_lucide_react31.ChevronRight,
|
|
6178
6527
|
{
|
|
6179
6528
|
size: 16,
|
|
6180
6529
|
"aria-hidden": "true",
|
|
@@ -6188,7 +6537,7 @@ function DataTable({
|
|
|
6188
6537
|
columns.map((c, ci) => {
|
|
6189
6538
|
const bg = colBg(c, rowBg);
|
|
6190
6539
|
const opener = !!onRowClick && ci === nameIdx;
|
|
6191
|
-
return /* @__PURE__ */ (0,
|
|
6540
|
+
return /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)(
|
|
6192
6541
|
"td",
|
|
6193
6542
|
{
|
|
6194
6543
|
className: cn(
|
|
@@ -6207,7 +6556,7 @@ function DataTable({
|
|
|
6207
6556
|
fit(ci, renderCell(c, row)),
|
|
6208
6557
|
opener && // The keyboard's and screen reader's way to the row click. It
|
|
6209
6558
|
// stays hidden; while it has focus the whole row takes the ring.
|
|
6210
|
-
/* @__PURE__ */ (0,
|
|
6559
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)("button", { type: "button", "data-row-open": "", onClick: () => onRowClick(row), className: "sr-only", children: rowClickLabel ? rowClickLabel(row) : `Open ${rowLabel ? rowLabel(row) : "row"}` }),
|
|
6211
6560
|
edge(ci)
|
|
6212
6561
|
]
|
|
6213
6562
|
},
|
|
@@ -6217,7 +6566,7 @@ function DataTable({
|
|
|
6217
6566
|
]
|
|
6218
6567
|
}
|
|
6219
6568
|
),
|
|
6220
|
-
panelOpen && /* @__PURE__ */ (0,
|
|
6569
|
+
panelOpen && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("tr", { className: "[&:last-child>td]:border-b-0", children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("td", { id: panelId, colSpan: span, className: "border-b border-border-default bg-subtle px-4 pb-4 pl-14", children: renderExpanded(row) }) }),
|
|
6221
6570
|
isOpen && kids?.map(
|
|
6222
6571
|
(child, si) => plainRow("sub", child, `${key}::${rowKey(child)}`, highlightRow?.(child) ? TINT : "bg-subtle", { id: kidIds[si], parent: row })
|
|
6223
6572
|
)
|
|
@@ -6230,7 +6579,7 @@ function DataTable({
|
|
|
6230
6579
|
}
|
|
6231
6580
|
);
|
|
6232
6581
|
const bare = inside || !title && barCount === 0;
|
|
6233
|
-
const frame = /* @__PURE__ */ (0,
|
|
6582
|
+
const frame = /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)(
|
|
6234
6583
|
"div",
|
|
6235
6584
|
{
|
|
6236
6585
|
className: cn(
|
|
@@ -6242,17 +6591,17 @@ function DataTable({
|
|
|
6242
6591
|
),
|
|
6243
6592
|
"data-testid": testIdPrefix,
|
|
6244
6593
|
children: [
|
|
6245
|
-
title && inside && /* @__PURE__ */ (0,
|
|
6246
|
-
/* @__PURE__ */ (0,
|
|
6247
|
-
/* @__PURE__ */ (0,
|
|
6248
|
-
subtitle && /* @__PURE__ */ (0,
|
|
6594
|
+
title && inside && /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("div", { className: "flex items-start justify-between gap-2 p-card-padding", children: [
|
|
6595
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("div", { className: "min-w-0", children: [
|
|
6596
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)("h3", { id: titleId, className: "text-panel-title font-semibold text-text-primary", children: title }),
|
|
6597
|
+
subtitle && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("p", { className: "mt-0.5 text-xs leading-snug text-text-tertiary", children: subtitle })
|
|
6249
6598
|
] }),
|
|
6250
|
-
(bar ?? action) && /* @__PURE__ */ (0,
|
|
6599
|
+
(bar ?? action) && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("div", { className: "shrink-0 text-text-tertiary", children: bar ?? action })
|
|
6251
6600
|
] }),
|
|
6252
6601
|
sticky ? (
|
|
6253
6602
|
// The copy of the header sticks within this box, so it leaves with the last row.
|
|
6254
|
-
/* @__PURE__ */ (0,
|
|
6255
|
-
/* @__PURE__ */ (0,
|
|
6603
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("div", { className: "relative", children: [
|
|
6604
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
6256
6605
|
"div",
|
|
6257
6606
|
{
|
|
6258
6607
|
ref: cloneRef,
|
|
@@ -6263,25 +6612,25 @@ function DataTable({
|
|
|
6263
6612
|
},
|
|
6264
6613
|
className: "sticky z-2 overflow-hidden",
|
|
6265
6614
|
style: { top, height: geom.height, marginBottom: -geom.height, visibility: stuck ? "visible" : "hidden" },
|
|
6266
|
-
children: /* @__PURE__ */ (0,
|
|
6267
|
-
/* @__PURE__ */ (0,
|
|
6268
|
-
/* @__PURE__ */ (0,
|
|
6615
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("table", { className: "table-fixed border-separate border-spacing-0 text-left", style: { width: geom.width }, children: [
|
|
6616
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)("colgroup", { children: geom.cols.map((w, i) => /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("col", { style: { width: w } }, i)) }),
|
|
6617
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)("thead", { children: headRow(true) })
|
|
6269
6618
|
] })
|
|
6270
6619
|
}
|
|
6271
6620
|
),
|
|
6272
6621
|
scrollArea
|
|
6273
6622
|
] })
|
|
6274
6623
|
) : scrollArea,
|
|
6275
|
-
refreshing && !loading && /* @__PURE__ */ (0,
|
|
6276
|
-
/* @__PURE__ */ (0,
|
|
6277
|
-
footer && !sticky && /* @__PURE__ */ (0,
|
|
6624
|
+
refreshing && !loading && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(RefreshLine, {}),
|
|
6625
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)(LongWait, { loading, onRetry, className: "mb-3 px-4" }),
|
|
6626
|
+
footer && !sticky && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("div", { className: "border-t border-border-default px-4 py-3", children: footer })
|
|
6278
6627
|
]
|
|
6279
6628
|
}
|
|
6280
6629
|
);
|
|
6281
6630
|
const hideFooter = footerStuck && !scrolledDown;
|
|
6282
|
-
const body = sticky ? /* @__PURE__ */ (0,
|
|
6631
|
+
const body = sticky ? /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("div", { ref: wrapRef, className: cn("flex w-full flex-col", bare && className), children: [
|
|
6283
6632
|
frame,
|
|
6284
|
-
footer && /* @__PURE__ */ (0,
|
|
6633
|
+
footer && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
6285
6634
|
"div",
|
|
6286
6635
|
{
|
|
6287
6636
|
"data-sticky-footer": "",
|
|
@@ -6298,14 +6647,14 @@ function DataTable({
|
|
|
6298
6647
|
)
|
|
6299
6648
|
] }) : frame;
|
|
6300
6649
|
if (bare) return body;
|
|
6301
|
-
return /* @__PURE__ */ (0,
|
|
6302
|
-
title ? /* @__PURE__ */ (0,
|
|
6650
|
+
return /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("section", { "aria-labelledby": title ? titleId : void 0, className: cn("flex w-full flex-col gap-3", className), children: [
|
|
6651
|
+
title ? /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(SectionHeading, { id: titleId, as: titleAs, title, description: subtitle, actions: bar ?? action }) : /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("div", { className: "flex justify-end", children: bar }),
|
|
6303
6652
|
body
|
|
6304
6653
|
] });
|
|
6305
6654
|
}
|
|
6306
6655
|
|
|
6307
6656
|
// src/MediaLabel.tsx
|
|
6308
|
-
var
|
|
6657
|
+
var import_jsx_runtime59 = require("react/jsx-runtime");
|
|
6309
6658
|
var FILL = {
|
|
6310
6659
|
TV: "bg-media-tv",
|
|
6311
6660
|
CTV: "bg-media-ctv",
|
|
@@ -6316,7 +6665,7 @@ var FILL = {
|
|
|
6316
6665
|
Magazine: "bg-media-magazine"
|
|
6317
6666
|
};
|
|
6318
6667
|
function MediaLabel({ type, className, testIdPrefix }) {
|
|
6319
|
-
return /* @__PURE__ */ (0,
|
|
6668
|
+
return /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
6320
6669
|
"span",
|
|
6321
6670
|
{
|
|
6322
6671
|
className: cn(
|
|
@@ -6331,10 +6680,10 @@ function MediaLabel({ type, className, testIdPrefix }) {
|
|
|
6331
6680
|
}
|
|
6332
6681
|
|
|
6333
6682
|
// src/SuggestionChip.tsx
|
|
6334
|
-
var
|
|
6335
|
-
var
|
|
6336
|
-
var SuggestionChip = (0,
|
|
6337
|
-
return /* @__PURE__ */ (0,
|
|
6683
|
+
var import_react34 = require("react");
|
|
6684
|
+
var import_jsx_runtime60 = require("react/jsx-runtime");
|
|
6685
|
+
var SuggestionChip = (0, import_react34.forwardRef)(function SuggestionChip2({ children, className, testIdPrefix, type = "button", ...props }, ref) {
|
|
6686
|
+
return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
6338
6687
|
"button",
|
|
6339
6688
|
{
|
|
6340
6689
|
ref,
|
|
@@ -6345,18 +6694,18 @@ var SuggestionChip = (0, import_react32.forwardRef)(function SuggestionChip2({ c
|
|
|
6345
6694
|
"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",
|
|
6346
6695
|
className
|
|
6347
6696
|
),
|
|
6348
|
-
children: /* @__PURE__ */ (0,
|
|
6697
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("span", { className: "truncate", children })
|
|
6349
6698
|
}
|
|
6350
6699
|
);
|
|
6351
6700
|
});
|
|
6352
6701
|
SuggestionChip.displayName = "SuggestionChip";
|
|
6353
6702
|
|
|
6354
6703
|
// src/ToggleChip.tsx
|
|
6355
|
-
var
|
|
6356
|
-
var
|
|
6357
|
-
var
|
|
6358
|
-
var ToggleChip = (0,
|
|
6359
|
-
return /* @__PURE__ */ (0,
|
|
6704
|
+
var import_react35 = require("react");
|
|
6705
|
+
var import_lucide_react32 = require("lucide-react");
|
|
6706
|
+
var import_jsx_runtime61 = require("react/jsx-runtime");
|
|
6707
|
+
var ToggleChip = (0, import_react35.forwardRef)(function ToggleChip2({ selected, onChange, children, className, testIdPrefix, type = "button", onClick, ...props }, ref) {
|
|
6708
|
+
return /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)(
|
|
6360
6709
|
"button",
|
|
6361
6710
|
{
|
|
6362
6711
|
ref,
|
|
@@ -6374,7 +6723,7 @@ var ToggleChip = (0, import_react33.forwardRef)(function ToggleChip2({ selected,
|
|
|
6374
6723
|
className
|
|
6375
6724
|
),
|
|
6376
6725
|
children: [
|
|
6377
|
-
selected && /* @__PURE__ */ (0,
|
|
6726
|
+
selected && /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(import_lucide_react32.Check, { size: 14, "aria-hidden": "true", className: "-ml-0.5 shrink-0" }),
|
|
6378
6727
|
children
|
|
6379
6728
|
]
|
|
6380
6729
|
}
|
|
@@ -6383,14 +6732,14 @@ var ToggleChip = (0, import_react33.forwardRef)(function ToggleChip2({ selected,
|
|
|
6383
6732
|
ToggleChip.displayName = "ToggleChip";
|
|
6384
6733
|
|
|
6385
6734
|
// src/CopyButton.tsx
|
|
6386
|
-
var
|
|
6387
|
-
var
|
|
6388
|
-
var
|
|
6735
|
+
var import_react36 = require("react");
|
|
6736
|
+
var import_lucide_react33 = require("lucide-react");
|
|
6737
|
+
var import_jsx_runtime62 = require("react/jsx-runtime");
|
|
6389
6738
|
var CONFIRM_MS = 2e3;
|
|
6390
|
-
var CopyButton = (0,
|
|
6391
|
-
const [copied, setCopied] = (0,
|
|
6392
|
-
const timer = (0,
|
|
6393
|
-
(0,
|
|
6739
|
+
var CopyButton = (0, import_react36.forwardRef)(function CopyButton2({ value, label, "aria-label": ariaLabel, size = "xs", className, testIdPrefix }, ref) {
|
|
6740
|
+
const [copied, setCopied] = (0, import_react36.useState)(false);
|
|
6741
|
+
const timer = (0, import_react36.useRef)(void 0);
|
|
6742
|
+
(0, import_react36.useEffect)(() => () => clearTimeout(timer.current), []);
|
|
6394
6743
|
const copy = async () => {
|
|
6395
6744
|
try {
|
|
6396
6745
|
await navigator.clipboard.writeText(typeof value === "function" ? value() : value);
|
|
@@ -6402,8 +6751,8 @@ var CopyButton = (0, import_react34.forwardRef)(function CopyButton2({ value, la
|
|
|
6402
6751
|
timer.current = setTimeout(() => setCopied(false), CONFIRM_MS);
|
|
6403
6752
|
};
|
|
6404
6753
|
const iconSize = size === "xs" ? 13 : 15;
|
|
6405
|
-
const icon = copied ? /* @__PURE__ */ (0,
|
|
6406
|
-
return /* @__PURE__ */ (0,
|
|
6754
|
+
const icon = copied ? /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(import_lucide_react33.Check, { size: iconSize, "aria-hidden": "true", className: "shrink-0 text-text-success" }) : /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(import_lucide_react33.Copy, { size: iconSize, "aria-hidden": "true", className: "shrink-0" });
|
|
6755
|
+
return /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(
|
|
6407
6756
|
Button,
|
|
6408
6757
|
{
|
|
6409
6758
|
ref,
|
|
@@ -6417,8 +6766,8 @@ var CopyButton = (0, import_react34.forwardRef)(function CopyButton2({ value, la
|
|
|
6417
6766
|
className: cn(!copied && "text-text-secondary", className),
|
|
6418
6767
|
children: [
|
|
6419
6768
|
icon,
|
|
6420
|
-
label && /* @__PURE__ */ (0,
|
|
6421
|
-
/* @__PURE__ */ (0,
|
|
6769
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("span", { children: copied ? "Copied" : label }),
|
|
6770
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)("span", { role: "status", className: "sr-only", children: copied ? "Copied" : "" })
|
|
6422
6771
|
]
|
|
6423
6772
|
}
|
|
6424
6773
|
);
|
|
@@ -6426,8 +6775,8 @@ var CopyButton = (0, import_react34.forwardRef)(function CopyButton2({ value, la
|
|
|
6426
6775
|
CopyButton.displayName = "CopyButton";
|
|
6427
6776
|
|
|
6428
6777
|
// src/InlineMessage.tsx
|
|
6429
|
-
var
|
|
6430
|
-
var
|
|
6778
|
+
var import_lucide_react34 = require("lucide-react");
|
|
6779
|
+
var import_jsx_runtime63 = require("react/jsx-runtime");
|
|
6431
6780
|
var BOX = {
|
|
6432
6781
|
info: "border-brand-primaryAction/30 bg-brand-primaryAction/10",
|
|
6433
6782
|
success: "border-status-success/40 bg-status-success/10",
|
|
@@ -6441,30 +6790,30 @@ var ICON_INK = {
|
|
|
6441
6790
|
warning: "text-text-warning",
|
|
6442
6791
|
danger: "text-text-danger"
|
|
6443
6792
|
};
|
|
6444
|
-
var ICON2 = { info:
|
|
6793
|
+
var ICON2 = { info: import_lucide_react34.Info, success: import_lucide_react34.CheckCircle2, warning: import_lucide_react34.AlertTriangle, danger: import_lucide_react34.XCircle };
|
|
6445
6794
|
function InlineMessage({ tone = "info", title, children, actions, onDismiss, className, testIdPrefix }) {
|
|
6446
6795
|
const Icon = ICON2[tone];
|
|
6447
|
-
return /* @__PURE__ */ (0,
|
|
6796
|
+
return /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(
|
|
6448
6797
|
"div",
|
|
6449
6798
|
{
|
|
6450
6799
|
role: tone === "warning" || tone === "danger" ? "alert" : "status",
|
|
6451
6800
|
className: cn("flex items-start gap-2.5 rounded-control border px-3 py-2.5 text-sm", BOX[tone], className),
|
|
6452
6801
|
"data-testid": testIdPrefix,
|
|
6453
6802
|
children: [
|
|
6454
|
-
/* @__PURE__ */ (0,
|
|
6455
|
-
/* @__PURE__ */ (0,
|
|
6456
|
-
/* @__PURE__ */ (0,
|
|
6457
|
-
children && /* @__PURE__ */ (0,
|
|
6458
|
-
actions && /* @__PURE__ */ (0,
|
|
6803
|
+
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)(Icon, { size: 16, "aria-hidden": "true", className: cn("mt-0.5 shrink-0", ICON_INK[tone]) }),
|
|
6804
|
+
/* @__PURE__ */ (0, import_jsx_runtime63.jsxs)("div", { className: "min-w-0 flex-1", children: [
|
|
6805
|
+
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)("p", { className: "font-semibold text-text-primary", children: title }),
|
|
6806
|
+
children && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("div", { className: "mt-0.5 text-text-secondary", children }),
|
|
6807
|
+
actions && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("div", { className: "mt-2 flex flex-wrap items-center gap-2", children: actions })
|
|
6459
6808
|
] }),
|
|
6460
|
-
onDismiss && /* @__PURE__ */ (0,
|
|
6809
|
+
onDismiss && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
6461
6810
|
"button",
|
|
6462
6811
|
{
|
|
6463
6812
|
type: "button",
|
|
6464
6813
|
onClick: onDismiss,
|
|
6465
6814
|
"aria-label": "Dismiss",
|
|
6466
6815
|
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",
|
|
6467
|
-
children: /* @__PURE__ */ (0,
|
|
6816
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(import_lucide_react34.X, { size: 14, "aria-hidden": "true" })
|
|
6468
6817
|
}
|
|
6469
6818
|
)
|
|
6470
6819
|
]
|
|
@@ -6473,9 +6822,9 @@ function InlineMessage({ tone = "info", title, children, actions, onDismiss, cla
|
|
|
6473
6822
|
}
|
|
6474
6823
|
|
|
6475
6824
|
// src/FilterDrawer.tsx
|
|
6476
|
-
var
|
|
6477
|
-
var
|
|
6478
|
-
var
|
|
6825
|
+
var import_react37 = require("react");
|
|
6826
|
+
var import_lucide_react35 = require("lucide-react");
|
|
6827
|
+
var import_jsx_runtime64 = require("react/jsx-runtime");
|
|
6479
6828
|
var SLIDE_MS = 200;
|
|
6480
6829
|
function reducedMotion() {
|
|
6481
6830
|
return typeof window !== "undefined" && !!window.matchMedia?.("(prefers-reduced-motion: reduce)").matches;
|
|
@@ -6495,12 +6844,12 @@ function FilterDrawer({
|
|
|
6495
6844
|
testIdPrefix
|
|
6496
6845
|
}) {
|
|
6497
6846
|
const marks = (list) => list.map((x) => `${x.id}:${x.count ?? 0}:${x.badge ?? ""}`).join("|");
|
|
6498
|
-
const [openedWith, setOpenedWith] = (0,
|
|
6499
|
-
const [confirming, setConfirming] = (0,
|
|
6500
|
-
const [view, setViewState] = (0,
|
|
6501
|
-
const [leaving, setLeaving] = (0,
|
|
6502
|
-
const [phase, setPhase] = (0,
|
|
6503
|
-
const [wasOpen, setWasOpen] = (0,
|
|
6847
|
+
const [openedWith, setOpenedWith] = (0, import_react37.useState)(() => marks(sections));
|
|
6848
|
+
const [confirming, setConfirming] = (0, import_react37.useState)(false);
|
|
6849
|
+
const [view, setViewState] = (0, import_react37.useState)(focus);
|
|
6850
|
+
const [leaving, setLeaving] = (0, import_react37.useState)(null);
|
|
6851
|
+
const [phase, setPhase] = (0, import_react37.useState)("run");
|
|
6852
|
+
const [wasOpen, setWasOpen] = (0, import_react37.useState)(open);
|
|
6504
6853
|
if (open !== wasOpen) {
|
|
6505
6854
|
setWasOpen(open);
|
|
6506
6855
|
setConfirming(false);
|
|
@@ -6522,20 +6871,20 @@ function FilterDrawer({
|
|
|
6522
6871
|
}
|
|
6523
6872
|
setViewState(next);
|
|
6524
6873
|
};
|
|
6525
|
-
(0,
|
|
6874
|
+
(0, import_react37.useLayoutEffect)(() => {
|
|
6526
6875
|
if (phase !== "start") return;
|
|
6527
6876
|
const raf = requestAnimationFrame(() => requestAnimationFrame(() => setPhase("run")));
|
|
6528
6877
|
return () => cancelAnimationFrame(raf);
|
|
6529
6878
|
}, [phase]);
|
|
6530
|
-
(0,
|
|
6879
|
+
(0, import_react37.useEffect)(() => {
|
|
6531
6880
|
if (!leaving || phase !== "run") return;
|
|
6532
6881
|
const t = setTimeout(() => setLeaving(null), SLIDE_MS);
|
|
6533
6882
|
return () => clearTimeout(t);
|
|
6534
6883
|
}, [leaving, phase]);
|
|
6535
|
-
const backRef = (0,
|
|
6536
|
-
const rowRefs = (0,
|
|
6537
|
-
const lastView = (0,
|
|
6538
|
-
(0,
|
|
6884
|
+
const backRef = (0, import_react37.useRef)(null);
|
|
6885
|
+
const rowRefs = (0, import_react37.useRef)(/* @__PURE__ */ new Map());
|
|
6886
|
+
const lastView = (0, import_react37.useRef)(null);
|
|
6887
|
+
(0, import_react37.useEffect)(() => {
|
|
6539
6888
|
if (!open) return;
|
|
6540
6889
|
if (view) backRef.current?.focus();
|
|
6541
6890
|
else if (lastView.current) rowRefs.current.get(lastView.current)?.focus();
|
|
@@ -6548,8 +6897,8 @@ function FilterDrawer({
|
|
|
6548
6897
|
const outgoing = phase === "start" ? void 0 : dir > 0 ? "translateX(-33%)" : "translateX(100%)";
|
|
6549
6898
|
const panel = (v, rows = true) => {
|
|
6550
6899
|
const s = v ? sections.find((x) => x.id === v) : void 0;
|
|
6551
|
-
if (s) return /* @__PURE__ */ (0,
|
|
6552
|
-
return /* @__PURE__ */ (0,
|
|
6900
|
+
if (s) return /* @__PURE__ */ (0, import_jsx_runtime64.jsx)("div", { className: "border-t border-border-default px-5 pt-4", children: renderSection(s.id) });
|
|
6901
|
+
return /* @__PURE__ */ (0, import_jsx_runtime64.jsx)("ul", { className: "border-t border-border-default", children: sections.map((x) => /* @__PURE__ */ (0, import_jsx_runtime64.jsx)("li", { className: "border-b border-border-default", children: /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)(
|
|
6553
6902
|
"button",
|
|
6554
6903
|
{
|
|
6555
6904
|
ref: rows ? (el) => {
|
|
@@ -6561,7 +6910,7 @@ function FilterDrawer({
|
|
|
6561
6910
|
"data-testid": testIdPrefix && `${testIdPrefix}-row-${x.id}`,
|
|
6562
6911
|
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",
|
|
6563
6912
|
children: [
|
|
6564
|
-
/* @__PURE__ */ (0,
|
|
6913
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
6565
6914
|
x.icon,
|
|
6566
6915
|
{
|
|
6567
6916
|
size: 17,
|
|
@@ -6569,15 +6918,15 @@ function FilterDrawer({
|
|
|
6569
6918
|
className: inUse(x) ? "text-brand-primaryAction" : "text-text-secondary"
|
|
6570
6919
|
}
|
|
6571
6920
|
),
|
|
6572
|
-
/* @__PURE__ */ (0,
|
|
6573
|
-
/* @__PURE__ */ (0,
|
|
6574
|
-
/* @__PURE__ */ (0,
|
|
6921
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)("span", { className: "flex-1 text-sm font-medium text-text-primary", children: x.label }),
|
|
6922
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)(SectionMark, { section: x }),
|
|
6923
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)(import_lucide_react35.ChevronRight, { size: 16, "aria-hidden": "true", className: "shrink-0 text-text-secondary" })
|
|
6575
6924
|
]
|
|
6576
6925
|
}
|
|
6577
6926
|
) }, x.id)) });
|
|
6578
6927
|
};
|
|
6579
|
-
return /* @__PURE__ */ (0,
|
|
6580
|
-
/* @__PURE__ */ (0,
|
|
6928
|
+
return /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)(import_jsx_runtime64.Fragment, { children: [
|
|
6929
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
6581
6930
|
Modal,
|
|
6582
6931
|
{
|
|
6583
6932
|
open: open && confirming,
|
|
@@ -6586,9 +6935,9 @@ function FilterDrawer({
|
|
|
6586
6935
|
title: "Discard changes?",
|
|
6587
6936
|
description: "Your filter picks haven't been applied.",
|
|
6588
6937
|
testIdPrefix: testIdPrefix && `${testIdPrefix}-discard`,
|
|
6589
|
-
footer: /* @__PURE__ */ (0,
|
|
6590
|
-
/* @__PURE__ */ (0,
|
|
6591
|
-
/* @__PURE__ */ (0,
|
|
6938
|
+
footer: /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)(import_jsx_runtime64.Fragment, { children: [
|
|
6939
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)(Button, { variant: "secondary", size: "md", onClick: () => setConfirming(false), children: "Keep editing" }),
|
|
6940
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
6592
6941
|
Button,
|
|
6593
6942
|
{
|
|
6594
6943
|
variant: "danger",
|
|
@@ -6603,15 +6952,15 @@ function FilterDrawer({
|
|
|
6603
6952
|
] })
|
|
6604
6953
|
}
|
|
6605
6954
|
),
|
|
6606
|
-
/* @__PURE__ */ (0,
|
|
6955
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
6607
6956
|
Drawer,
|
|
6608
6957
|
{
|
|
6609
6958
|
open,
|
|
6610
6959
|
onClose: requestClose,
|
|
6611
6960
|
size,
|
|
6612
6961
|
testIdPrefix,
|
|
6613
|
-
title: focused ? /* @__PURE__ */ (0,
|
|
6614
|
-
/* @__PURE__ */ (0,
|
|
6962
|
+
title: focused ? /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)("span", { className: "flex items-center gap-1.5", children: [
|
|
6963
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
6615
6964
|
"button",
|
|
6616
6965
|
{
|
|
6617
6966
|
ref: backRef,
|
|
@@ -6620,25 +6969,25 @@ function FilterDrawer({
|
|
|
6620
6969
|
"aria-label": "Back to all filters",
|
|
6621
6970
|
"data-testid": testIdPrefix && `${testIdPrefix}-back`,
|
|
6622
6971
|
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",
|
|
6623
|
-
children: /* @__PURE__ */ (0,
|
|
6972
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(import_lucide_react35.ChevronLeft, { size: 18, "aria-hidden": "true" })
|
|
6624
6973
|
}
|
|
6625
6974
|
),
|
|
6626
6975
|
focused.label,
|
|
6627
|
-
(focused.count ?? 0) > 0 && /* @__PURE__ */ (0,
|
|
6628
|
-
focused.info && /* @__PURE__ */ (0,
|
|
6976
|
+
(focused.count ?? 0) > 0 && /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(CountBadge, { count: focused.count }),
|
|
6977
|
+
focused.info && /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(InfoTip, { text: focused.info, label: `About ${focused.label}` })
|
|
6629
6978
|
] }) : "Filters",
|
|
6630
6979
|
footer: focused ? (
|
|
6631
6980
|
// Picks are kept as they're made; Apply goes back to the list, and only
|
|
6632
6981
|
// See results, on the list, applies them to the page.
|
|
6633
|
-
/* @__PURE__ */ (0,
|
|
6634
|
-
/* @__PURE__ */ (0,
|
|
6635
|
-
/* @__PURE__ */ (0,
|
|
6982
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsxs)("div", { className: "flex w-full items-center justify-between gap-2", children: [
|
|
6983
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)(Button, { variant: "link", size: "md", onClick: () => onClearSection(focused.id), className: "px-0", children: "Clear" }),
|
|
6984
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)(Button, { variant: "primary", size: "md", onClick: () => setView(null), testIdPrefix: testIdPrefix && `${testIdPrefix}-apply-section`, children: "Apply" })
|
|
6636
6985
|
] })
|
|
6637
|
-
) : /* @__PURE__ */ (0,
|
|
6638
|
-
/* @__PURE__ */ (0,
|
|
6639
|
-
/* @__PURE__ */ (0,
|
|
6640
|
-
/* @__PURE__ */ (0,
|
|
6641
|
-
/* @__PURE__ */ (0,
|
|
6986
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)("div", { className: "flex w-full items-center justify-between gap-2", children: [
|
|
6987
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)(Button, { variant: "link", size: "md", onClick: onClearAll, className: "px-0", children: "Clear all" }),
|
|
6988
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
6989
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)(Button, { variant: "secondary", size: "md", onClick: onClose, children: "Cancel" }),
|
|
6990
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
6642
6991
|
Button,
|
|
6643
6992
|
{
|
|
6644
6993
|
variant: "primary",
|
|
@@ -6652,8 +7001,8 @@ function FilterDrawer({
|
|
|
6652
7001
|
)
|
|
6653
7002
|
] })
|
|
6654
7003
|
] }),
|
|
6655
|
-
children: /* @__PURE__ */ (0,
|
|
6656
|
-
/* @__PURE__ */ (0,
|
|
7004
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)("div", { className: "relative -mx-5 overflow-x-clip", children: [
|
|
7005
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
6657
7006
|
"div",
|
|
6658
7007
|
{
|
|
6659
7008
|
style: { transform: incoming },
|
|
@@ -6662,7 +7011,7 @@ function FilterDrawer({
|
|
|
6662
7011
|
},
|
|
6663
7012
|
view ?? "__list"
|
|
6664
7013
|
),
|
|
6665
|
-
leaving && /* @__PURE__ */ (0,
|
|
7014
|
+
leaving && /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
6666
7015
|
"div",
|
|
6667
7016
|
{
|
|
6668
7017
|
"aria-hidden": "true",
|
|
@@ -6679,22 +7028,22 @@ function FilterDrawer({
|
|
|
6679
7028
|
}
|
|
6680
7029
|
var inUse = (x) => (x.count ?? 0) > 0 || !!x.badge;
|
|
6681
7030
|
function CountBadge({ count }) {
|
|
6682
|
-
return /* @__PURE__ */ (0,
|
|
7031
|
+
return /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)(Badge, { tone: "brandSolid", kind: "count", children: [
|
|
6683
7032
|
count,
|
|
6684
|
-
/* @__PURE__ */ (0,
|
|
7033
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)("span", { className: "sr-only", children: " selected" })
|
|
6685
7034
|
] });
|
|
6686
7035
|
}
|
|
6687
7036
|
function SectionMark({ section }) {
|
|
6688
|
-
if ((section.count ?? 0) > 0) return /* @__PURE__ */ (0,
|
|
6689
|
-
return section.badge ? /* @__PURE__ */ (0,
|
|
7037
|
+
if ((section.count ?? 0) > 0) return /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(CountBadge, { count: section.count });
|
|
7038
|
+
return section.badge ? /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(Badge, { tone: "brand", children: section.badge }) : null;
|
|
6690
7039
|
}
|
|
6691
7040
|
|
|
6692
7041
|
// src/AllFiltersButton.tsx
|
|
6693
|
-
var
|
|
6694
|
-
var
|
|
6695
|
-
var
|
|
6696
|
-
var AllFiltersButton = (0,
|
|
6697
|
-
return /* @__PURE__ */ (0,
|
|
7042
|
+
var import_react38 = require("react");
|
|
7043
|
+
var import_lucide_react36 = require("lucide-react");
|
|
7044
|
+
var import_jsx_runtime65 = require("react/jsx-runtime");
|
|
7045
|
+
var AllFiltersButton = (0, import_react38.forwardRef)(function AllFiltersButton2({ count = 0, open, className, testIdPrefix, ...rest }, ref) {
|
|
7046
|
+
return /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(
|
|
6698
7047
|
"button",
|
|
6699
7048
|
{
|
|
6700
7049
|
ref,
|
|
@@ -6706,105 +7055,14 @@ var AllFiltersButton = (0, import_react36.forwardRef)(function AllFiltersButton2
|
|
|
6706
7055
|
className: cn(chipTriggerClass(), className),
|
|
6707
7056
|
...rest,
|
|
6708
7057
|
children: [
|
|
6709
|
-
/* @__PURE__ */ (0,
|
|
6710
|
-
/* @__PURE__ */ (0,
|
|
6711
|
-
count > 0 && /* @__PURE__ */ (0,
|
|
7058
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)(import_lucide_react36.SlidersHorizontal, { size: 15, "aria-hidden": "true", className: "text-text-secondary" }),
|
|
7059
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)("span", { className: "text-dense font-medium text-text-primary", children: "All filters" }),
|
|
7060
|
+
count > 0 && /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(Badge, { tone: "brandSolid", kind: "count", children: count })
|
|
6712
7061
|
]
|
|
6713
7062
|
}
|
|
6714
7063
|
);
|
|
6715
7064
|
});
|
|
6716
7065
|
|
|
6717
|
-
// src/Menu.tsx
|
|
6718
|
-
var import_react37 = require("react");
|
|
6719
|
-
var import_react_slot2 = require("@radix-ui/react-slot");
|
|
6720
|
-
var import_lucide_react35 = require("lucide-react");
|
|
6721
|
-
var import_jsx_runtime64 = require("react/jsx-runtime");
|
|
6722
|
-
var ROW_SELECTOR = '[role^="menuitem"]:not([aria-disabled="true"]):not(:disabled)';
|
|
6723
|
-
function moveFocus(e) {
|
|
6724
|
-
const keys = ["ArrowDown", "ArrowUp", "Home", "End"];
|
|
6725
|
-
if (!keys.includes(e.key)) return;
|
|
6726
|
-
const rows = Array.from(e.currentTarget.querySelectorAll(ROW_SELECTOR));
|
|
6727
|
-
if (!rows.length) return;
|
|
6728
|
-
e.preventDefault();
|
|
6729
|
-
const i = rows.indexOf(document.activeElement);
|
|
6730
|
-
const next = e.key === "Home" ? 0 : e.key === "End" ? rows.length - 1 : e.key === "ArrowDown" ? (i + 1) % rows.length : (i - 1 + rows.length) % rows.length;
|
|
6731
|
-
rows[next].focus();
|
|
6732
|
-
}
|
|
6733
|
-
var Menu = (0, import_react37.forwardRef)(
|
|
6734
|
-
({ className, testIdPrefix, onKeyDown, children, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
6735
|
-
"div",
|
|
6736
|
-
{
|
|
6737
|
-
ref,
|
|
6738
|
-
role: "menu",
|
|
6739
|
-
"data-testid": testIdPrefix,
|
|
6740
|
-
onKeyDown: (e) => {
|
|
6741
|
-
moveFocus(e);
|
|
6742
|
-
onKeyDown?.(e);
|
|
6743
|
-
},
|
|
6744
|
-
className: cn("flex flex-col p-1", className),
|
|
6745
|
-
...props,
|
|
6746
|
-
children
|
|
6747
|
-
}
|
|
6748
|
-
)
|
|
6749
|
-
);
|
|
6750
|
-
Menu.displayName = "Menu";
|
|
6751
|
-
var MenuItem = (0, import_react37.forwardRef)(
|
|
6752
|
-
({ className, testIdPrefix, icon, trailing, description, submenu, checked, danger, disabled, asChild = false, children, ...props }, ref) => {
|
|
6753
|
-
const Comp = asChild ? import_react_slot2.Slot : "button";
|
|
6754
|
-
const radio = checked !== void 0;
|
|
6755
|
-
return /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)(
|
|
6756
|
-
Comp,
|
|
6757
|
-
{
|
|
6758
|
-
ref,
|
|
6759
|
-
type: asChild ? void 0 : "button",
|
|
6760
|
-
role: radio ? "menuitemradio" : "menuitem",
|
|
6761
|
-
"aria-checked": radio ? checked : void 0,
|
|
6762
|
-
"aria-haspopup": submenu ? "menu" : void 0,
|
|
6763
|
-
"aria-disabled": disabled || void 0,
|
|
6764
|
-
disabled: asChild ? void 0 : disabled,
|
|
6765
|
-
tabIndex: -1,
|
|
6766
|
-
"data-testid": testIdPrefix,
|
|
6767
|
-
className: cn(
|
|
6768
|
-
"flex min-h-9 w-full items-center gap-2.5 rounded-control px-3 py-1.5 text-left text-sm transition-colors",
|
|
6769
|
-
"focus-visible:outline-solid focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-border-focus",
|
|
6770
|
-
danger ? "text-text-danger" : "text-text-primary",
|
|
6771
|
-
disabled ? "cursor-not-allowed opacity-40" : "hover:bg-subtle focus-visible:bg-subtle",
|
|
6772
|
-
className
|
|
6773
|
-
),
|
|
6774
|
-
...props,
|
|
6775
|
-
children: [
|
|
6776
|
-
icon && /* @__PURE__ */ (0, import_jsx_runtime64.jsx)("span", { "aria-hidden": "true", className: cn("flex shrink-0", danger ? "text-text-danger" : "text-text-secondary"), children: icon }),
|
|
6777
|
-
asChild ? (
|
|
6778
|
-
// The link's own text lands here; the link becomes the row.
|
|
6779
|
-
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)(import_react_slot2.Slottable, { children })
|
|
6780
|
-
) : /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)("span", { className: "min-w-0 flex-1", children: [
|
|
6781
|
-
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)("span", { className: "block truncate", children }),
|
|
6782
|
-
description && /* @__PURE__ */ (0, import_jsx_runtime64.jsx)("span", { className: "block truncate text-xs text-text-tertiary", children: description })
|
|
6783
|
-
] }),
|
|
6784
|
-
trailing && /* @__PURE__ */ (0, import_jsx_runtime64.jsx)("span", { className: "ml-auto flex shrink-0 items-center text-xs text-text-secondary", children: trailing }),
|
|
6785
|
-
radio && checked && /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(import_lucide_react35.Check, { size: 16, "aria-hidden": "true", className: "shrink-0 text-brand-primaryAction" }),
|
|
6786
|
-
submenu && /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(import_lucide_react35.ChevronRight, { size: 16, "aria-hidden": "true", className: "shrink-0 text-text-secondary" })
|
|
6787
|
-
]
|
|
6788
|
-
}
|
|
6789
|
-
);
|
|
6790
|
-
}
|
|
6791
|
-
);
|
|
6792
|
-
MenuItem.displayName = "MenuItem";
|
|
6793
|
-
function MenuLabel({ className, testIdPrefix, children }) {
|
|
6794
|
-
return /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
6795
|
-
"div",
|
|
6796
|
-
{
|
|
6797
|
-
role: "presentation",
|
|
6798
|
-
"data-testid": testIdPrefix,
|
|
6799
|
-
className: cn("px-3 pb-1 pt-2 text-micro font-semibold uppercase tracking-wide text-text-tertiary", className),
|
|
6800
|
-
children
|
|
6801
|
-
}
|
|
6802
|
-
);
|
|
6803
|
-
}
|
|
6804
|
-
function MenuSeparator({ className, testIdPrefix }) {
|
|
6805
|
-
return /* @__PURE__ */ (0, import_jsx_runtime64.jsx)("div", { role: "separator", "data-testid": testIdPrefix, className: cn("-mx-1 my-1 border-t border-border-default", className) });
|
|
6806
|
-
}
|
|
6807
|
-
|
|
6808
7066
|
// src/dates.ts
|
|
6809
7067
|
var MONTHS2 = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
|
|
6810
7068
|
var MONTHS_LONG = [
|
|
@@ -6916,15 +7174,15 @@ function defaultDateOrder(country) {
|
|
|
6916
7174
|
}
|
|
6917
7175
|
|
|
6918
7176
|
// src/Figure.tsx
|
|
6919
|
-
var
|
|
7177
|
+
var import_jsx_runtime66 = require("react/jsx-runtime");
|
|
6920
7178
|
function Figure({ value, kind = "money", missing, ...opts }) {
|
|
6921
|
-
if (value === null || value === void 0 || Number.isNaN(value)) return /* @__PURE__ */ (0,
|
|
7179
|
+
if (value === null || value === void 0 || Number.isNaN(value)) return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(NoValue, { reason: missing });
|
|
6922
7180
|
const short = kind === "money" ? formatMoney(value, opts) : formatCount(value, opts);
|
|
6923
7181
|
const full = kind === "money" ? formatMoneyFull(value, opts) : formatCountFull(value);
|
|
6924
|
-
if (short === full) return /* @__PURE__ */ (0,
|
|
6925
|
-
return /* @__PURE__ */ (0,
|
|
6926
|
-
/* @__PURE__ */ (0,
|
|
6927
|
-
/* @__PURE__ */ (0,
|
|
7182
|
+
if (short === full) return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(import_jsx_runtime66.Fragment, { children: short });
|
|
7183
|
+
return /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)(Tooltip, { label: full, delay: 300, children: [
|
|
7184
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)("span", { "aria-hidden": "true", children: short }),
|
|
7185
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)("span", { className: "sr-only", children: full })
|
|
6928
7186
|
] });
|
|
6929
7187
|
}
|
|
6930
7188
|
// Annotate the CommonJS export names for ESM import in node:
|