@mediaradar/design-components 0.64.0 → 0.65.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 +570 -293
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +143 -14
- package/dist/index.d.ts +143 -14
- package/dist/index.js +567 -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,347 @@ 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
|
+
testId
|
|
5848
|
+
}) {
|
|
5849
|
+
const id = (0, import_react32.useId)();
|
|
5850
|
+
const enabled = rows.filter((r) => !r.disabled);
|
|
5851
|
+
const tabStop = enabled.some((r) => r.id === value) ? value : enabled[0]?.id;
|
|
5852
|
+
const onKey = (e) => {
|
|
5853
|
+
const keys = ["ArrowDown", "ArrowUp", "ArrowRight", "ArrowLeft", "Home", "End"];
|
|
5854
|
+
if (!keys.includes(e.key) || enabled.length === 0) return;
|
|
5855
|
+
e.preventDefault();
|
|
5856
|
+
const i = Math.max(0, enabled.findIndex((r) => r.id === value));
|
|
5857
|
+
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;
|
|
5858
|
+
onPick(enabled[next].id);
|
|
5859
|
+
const el = e.currentTarget.querySelectorAll('[role="radio"]:not([aria-disabled="true"])')[next];
|
|
5860
|
+
el?.focus();
|
|
5861
|
+
};
|
|
5862
|
+
return /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(import_jsx_runtime57.Fragment, { children: [
|
|
5863
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)(MenuLabel, { id, children: label }),
|
|
5864
|
+
/* @__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) => {
|
|
5865
|
+
const checked = r.id === value;
|
|
5866
|
+
return /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(
|
|
5867
|
+
"button",
|
|
5868
|
+
{
|
|
5869
|
+
type: "button",
|
|
5870
|
+
role: "radio",
|
|
5871
|
+
"aria-checked": checked,
|
|
5872
|
+
"aria-disabled": r.disabled || void 0,
|
|
5873
|
+
tabIndex: r.id === tabStop ? 0 : -1,
|
|
5874
|
+
onClick: () => !r.disabled && onPick(r.id),
|
|
5875
|
+
className: cn(
|
|
5876
|
+
// MenuItem's row: 36px, 14px, inset and rounded, the tick on the right.
|
|
5877
|
+
"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",
|
|
5878
|
+
"focus-visible:outline-solid focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-border-focus",
|
|
5879
|
+
r.disabled ? "cursor-not-allowed opacity-40" : "hover:bg-subtle focus-visible:bg-subtle"
|
|
5880
|
+
),
|
|
5881
|
+
children: [
|
|
5882
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)("span", { className: "min-w-0 flex-1 truncate", children: r.label }),
|
|
5883
|
+
checked && /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(import_lucide_react30.Check, { size: 16, "aria-hidden": "true", className: "shrink-0 text-brand-primaryAction" })
|
|
5884
|
+
]
|
|
5885
|
+
},
|
|
5886
|
+
r.id ?? "__none"
|
|
5887
|
+
);
|
|
5888
|
+
}) })
|
|
5889
|
+
] });
|
|
5890
|
+
}
|
|
5891
|
+
function HeaderMenuTrigger({
|
|
5892
|
+
menu,
|
|
5893
|
+
columnLabel,
|
|
5894
|
+
sortDir,
|
|
5895
|
+
onSort,
|
|
5896
|
+
testId
|
|
5897
|
+
}) {
|
|
5898
|
+
const [open, setOpen] = (0, import_react32.useState)(false);
|
|
5899
|
+
const [pos, setPos] = (0, import_react32.useState)(null);
|
|
5900
|
+
const trigger = (0, import_react32.useRef)(null);
|
|
5901
|
+
const panel = (0, import_react32.useRef)(null);
|
|
5902
|
+
const { groupBy, breakOutBy } = menu;
|
|
5903
|
+
const groupLabel = groupBy.options.find((o) => o.id === groupBy.value)?.label ?? "";
|
|
5904
|
+
const breakLabel = breakOutBy?.value != null ? breakOutBy.options.find((o) => o.id === breakOutBy.value)?.label : void 0;
|
|
5905
|
+
const [draftGroup, setDraftGroup] = (0, import_react32.useState)(groupBy.value);
|
|
5906
|
+
const [draftBreak, setDraftBreak] = (0, import_react32.useState)(breakOutBy?.value ?? null);
|
|
5907
|
+
const [draftSort, setDraftSort] = (0, import_react32.useState)(sortDir);
|
|
5908
|
+
const openPanel = () => {
|
|
5909
|
+
setDraftGroup(groupBy.value);
|
|
5910
|
+
setDraftBreak(breakOutBy?.value ?? null);
|
|
5911
|
+
setDraftSort(sortDir);
|
|
5912
|
+
setOpen(true);
|
|
5913
|
+
};
|
|
5914
|
+
const close = (0, import_react32.useCallback)((refocus) => {
|
|
5915
|
+
setOpen(false);
|
|
5916
|
+
if (refocus) trigger.current?.focus();
|
|
5917
|
+
}, []);
|
|
5918
|
+
const apply = () => {
|
|
5919
|
+
if (draftGroup !== groupBy.value) groupBy.onChange(draftGroup);
|
|
5920
|
+
if (breakOutBy && draftBreak !== breakOutBy.value) breakOutBy.onChange(draftBreak);
|
|
5921
|
+
if (onSort && draftSort && draftSort !== sortDir) onSort(draftSort);
|
|
5922
|
+
close(true);
|
|
5923
|
+
};
|
|
5924
|
+
const place = (0, import_react32.useCallback)(() => {
|
|
5925
|
+
const t = trigger.current;
|
|
5926
|
+
if (!t) return;
|
|
5927
|
+
const r = t.getBoundingClientRect();
|
|
5928
|
+
const h = panel.current?.offsetHeight ?? 0;
|
|
5929
|
+
const above = r.bottom + 4 + h > window.innerHeight && r.top - 4 - h > 0;
|
|
5930
|
+
setPos({ top: above ? r.top - 4 - h : r.bottom + 4, left: r.left });
|
|
5931
|
+
}, []);
|
|
5932
|
+
(0, import_react32.useLayoutEffect)(() => {
|
|
5933
|
+
if (open) place();
|
|
5934
|
+
else setPos(null);
|
|
5935
|
+
}, [open, place]);
|
|
5936
|
+
const placed = pos !== null;
|
|
5937
|
+
(0, import_react32.useEffect)(() => {
|
|
5938
|
+
if (open && placed) panel.current?.querySelector('[data-first-group] [tabindex="0"]')?.focus();
|
|
5939
|
+
}, [open, placed]);
|
|
5940
|
+
(0, import_react32.useEffect)(() => {
|
|
5941
|
+
if (!open) return void 0;
|
|
5942
|
+
const onDown = (e) => {
|
|
5943
|
+
const t = e.target;
|
|
5944
|
+
if (trigger.current?.contains(t) || panel.current?.contains(t)) return;
|
|
5945
|
+
close(false);
|
|
5946
|
+
};
|
|
5947
|
+
window.addEventListener("mousedown", onDown);
|
|
5948
|
+
window.addEventListener("resize", place);
|
|
5949
|
+
window.addEventListener("scroll", place, true);
|
|
5950
|
+
return () => {
|
|
5951
|
+
window.removeEventListener("mousedown", onDown);
|
|
5952
|
+
window.removeEventListener("resize", place);
|
|
5953
|
+
window.removeEventListener("scroll", place, true);
|
|
5954
|
+
};
|
|
5955
|
+
}, [open, close, place]);
|
|
5956
|
+
const onTriggerKey = (e) => {
|
|
5957
|
+
if (e.key === "ArrowDown" && !open) {
|
|
5958
|
+
e.preventDefault();
|
|
5959
|
+
openPanel();
|
|
5960
|
+
}
|
|
5961
|
+
};
|
|
5962
|
+
const onPanelKey = (e) => {
|
|
5963
|
+
if (e.key === "Escape") {
|
|
5964
|
+
e.preventDefault();
|
|
5965
|
+
e.stopPropagation();
|
|
5966
|
+
close(true);
|
|
5967
|
+
return;
|
|
5968
|
+
}
|
|
5969
|
+
if (e.key === "Tab") {
|
|
5970
|
+
const stops = [...e.currentTarget.querySelectorAll('[tabindex="0"], button:not([tabindex])')];
|
|
5971
|
+
const at = stops.indexOf(document.activeElement);
|
|
5972
|
+
if (e.shiftKey && at === 0 || !e.shiftKey && at === stops.length - 1) {
|
|
5973
|
+
e.preventDefault();
|
|
5974
|
+
close(true);
|
|
5975
|
+
}
|
|
5976
|
+
}
|
|
5977
|
+
};
|
|
5978
|
+
const pickGroup = (id) => {
|
|
5979
|
+
setDraftGroup(id);
|
|
5980
|
+
if (draftBreak === id) setDraftBreak(null);
|
|
5981
|
+
};
|
|
5982
|
+
return /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(import_jsx_runtime57.Fragment, { children: [
|
|
5983
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(
|
|
5984
|
+
"button",
|
|
5985
|
+
{
|
|
5986
|
+
ref: trigger,
|
|
5987
|
+
type: "button",
|
|
5988
|
+
"aria-haspopup": "dialog",
|
|
5989
|
+
"aria-expanded": open,
|
|
5990
|
+
"data-testid": testId,
|
|
5991
|
+
onClick: () => open ? close(false) : openPanel(),
|
|
5992
|
+
onKeyDown: onTriggerKey,
|
|
5993
|
+
className: cn(
|
|
5994
|
+
// Restores the header row's uppercase: a <button> doesn't inherit
|
|
5995
|
+
// text-transform (see SortButton). The negative margin keeps the
|
|
5996
|
+
// label lined up with the names under it while the hover fill
|
|
5997
|
+
// reaches past it.
|
|
5998
|
+
"-mx-1.5 -my-1 inline-flex items-center gap-1 rounded-control px-1.5 py-1 uppercase transition-colors",
|
|
5999
|
+
"hover:bg-border-default hover:text-text-primary aria-expanded:bg-border-default aria-expanded:text-text-primary",
|
|
6000
|
+
"focus-visible:outline-solid focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-border-focus"
|
|
6001
|
+
),
|
|
6002
|
+
children: [
|
|
6003
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsxs)("span", { children: [
|
|
6004
|
+
groupLabel,
|
|
6005
|
+
breakLabel && /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(import_jsx_runtime57.Fragment, { children: [
|
|
6006
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)("span", { "aria-hidden": "true", className: "text-text-tertiary", children: " \u203A " }),
|
|
6007
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)("span", { className: "sr-only", children: " then " }),
|
|
6008
|
+
breakLabel
|
|
6009
|
+
] })
|
|
6010
|
+
] }),
|
|
6011
|
+
/* @__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") })
|
|
6012
|
+
]
|
|
6013
|
+
}
|
|
6014
|
+
),
|
|
6015
|
+
open && (0, import_react_dom9.createPortal)(
|
|
6016
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(
|
|
6017
|
+
"div",
|
|
6018
|
+
{
|
|
6019
|
+
ref: panel,
|
|
6020
|
+
role: "dialog",
|
|
6021
|
+
"aria-label": columnLabel,
|
|
6022
|
+
"data-testid": testId && `${testId}-menu`,
|
|
6023
|
+
onKeyDown: onPanelKey,
|
|
6024
|
+
style: { position: "fixed", top: pos?.top ?? 0, left: pos?.left ?? 0, visibility: pos ? void 0 : "hidden" },
|
|
6025
|
+
className: "z-dropdown flex max-h-120 w-60 flex-col overflow-hidden rounded-card border border-border-default bg-surface text-left normal-case tracking-normal shadow-overlay",
|
|
6026
|
+
children: [
|
|
6027
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsxs)("div", { className: "flex min-h-0 flex-col overflow-y-auto p-1", 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
|
+
}
|
|
6037
|
+
),
|
|
6038
|
+
breakOutBy && /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(import_jsx_runtime57.Fragment, { children: [
|
|
6039
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)(MenuSeparator, {}),
|
|
6040
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
|
|
6041
|
+
RadioSection,
|
|
6042
|
+
{
|
|
6043
|
+
label: breakOutBy.label ?? "Then break out by",
|
|
6044
|
+
rows: [{ id: null, label: "None" }, ...breakOutBy.options.map((o) => ({ ...o, disabled: o.id === draftGroup }))],
|
|
6045
|
+
value: draftBreak,
|
|
6046
|
+
onPick: setDraftBreak
|
|
6047
|
+
}
|
|
6048
|
+
)
|
|
6049
|
+
] }),
|
|
6050
|
+
onSort && /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(import_jsx_runtime57.Fragment, { children: [
|
|
6051
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)(MenuSeparator, {}),
|
|
6052
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)(
|
|
6053
|
+
RadioSection,
|
|
6054
|
+
{
|
|
6055
|
+
label: "Sort",
|
|
6056
|
+
rows: [
|
|
6057
|
+
{ id: "asc", label: "A to Z" },
|
|
6058
|
+
{ id: "desc", label: "Z to A" }
|
|
6059
|
+
],
|
|
6060
|
+
value: draftSort ?? void 0,
|
|
6061
|
+
onPick: setDraftSort
|
|
6062
|
+
}
|
|
6063
|
+
)
|
|
6064
|
+
] })
|
|
6065
|
+
] }),
|
|
6066
|
+
/* @__PURE__ */ (0, import_jsx_runtime57.jsx)(FilterDropdownFooter, { onCancel: () => close(true), onApply: apply })
|
|
6067
|
+
]
|
|
6068
|
+
}
|
|
6069
|
+
),
|
|
6070
|
+
document.body
|
|
6071
|
+
)
|
|
6072
|
+
] });
|
|
6073
|
+
}
|
|
6074
|
+
|
|
6075
|
+
// src/DataTable.tsx
|
|
6076
|
+
var import_jsx_runtime58 = require("react/jsx-runtime");
|
|
5719
6077
|
var WIDTH3 = { fill: "", sm: "w-24", md: "w-36", lg: "w-48" };
|
|
5720
6078
|
var MAX_H = { sm: "max-h-80", md: "max-h-120", lg: "max-h-160" };
|
|
5721
6079
|
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
6080
|
var HEAD_PAD = { default: "px-4 py-3", compact: "px-3 py-2" };
|
|
5723
6081
|
var CELL_PAD = { default: "px-4 py-3.5", compact: "px-3 py-2" };
|
|
6082
|
+
var EXPAND_PAD = "px-2";
|
|
5724
6083
|
var SUB_INDENT = { default: "pl-10", compact: "pl-9" };
|
|
5725
6084
|
var TINT = "bg-brand-primaryTint";
|
|
5726
6085
|
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 +6095,7 @@ function isDev() {
|
|
|
5736
6095
|
return false;
|
|
5737
6096
|
}
|
|
5738
6097
|
}
|
|
5739
|
-
var useBrowserLayoutEffect = typeof window === "undefined" ?
|
|
6098
|
+
var useBrowserLayoutEffect = typeof window === "undefined" ? import_react33.useEffect : import_react33.useLayoutEffect;
|
|
5740
6099
|
function rowClickCounts(e) {
|
|
5741
6100
|
if (e.target.closest(OWN_CLICK)) return false;
|
|
5742
6101
|
const sel = window.getSelection?.();
|
|
@@ -5744,13 +6103,13 @@ function rowClickCounts(e) {
|
|
|
5744
6103
|
return true;
|
|
5745
6104
|
}
|
|
5746
6105
|
function NoValue({ reason = "No data" }) {
|
|
5747
|
-
return /* @__PURE__ */ (0,
|
|
5748
|
-
/* @__PURE__ */ (0,
|
|
5749
|
-
/* @__PURE__ */ (0,
|
|
6106
|
+
return /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)(Tooltip, { label: reason, delay: 300, className: "text-text-tertiary", children: [
|
|
6107
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)("span", { "aria-hidden": "true", children: NO_VALUE }),
|
|
6108
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)("span", { className: "sr-only", children: reason })
|
|
5750
6109
|
] });
|
|
5751
6110
|
}
|
|
5752
6111
|
function TableLink({ className, ...props }) {
|
|
5753
|
-
return /* @__PURE__ */ (0,
|
|
6112
|
+
return /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
5754
6113
|
"a",
|
|
5755
6114
|
{
|
|
5756
6115
|
...props,
|
|
@@ -5807,7 +6166,7 @@ function DataTable({
|
|
|
5807
6166
|
...rest
|
|
5808
6167
|
}) {
|
|
5809
6168
|
const maxHeight = sticky ? void 0 : maxHeightProp;
|
|
5810
|
-
const titleId = (0,
|
|
6169
|
+
const titleId = (0, import_react33.useId)();
|
|
5811
6170
|
const showSkeleton = useDelayedLoading(loading);
|
|
5812
6171
|
const head = HEAD_PAD[density];
|
|
5813
6172
|
const pad2 = CELL_PAD[density];
|
|
@@ -5820,7 +6179,7 @@ function DataTable({
|
|
|
5820
6179
|
onSortChange?.(cycleSort(shown, key, col?.firstDir ?? (right(col) ? "desc" : "asc"), defaultSort));
|
|
5821
6180
|
};
|
|
5822
6181
|
const clash = !!onRowClick && (!!renderExpandedProp || !!subRowsProp);
|
|
5823
|
-
(0,
|
|
6182
|
+
(0, import_react33.useEffect)(() => {
|
|
5824
6183
|
if (clash && isDev()) {
|
|
5825
6184
|
console.warn("DataTable: pass `onRowClick` or rows that open in place (`renderExpanded`, `subRows`), not both. The row click wins; rows won't open.");
|
|
5826
6185
|
}
|
|
@@ -5831,10 +6190,10 @@ function DataTable({
|
|
|
5831
6190
|
const kids = subRows?.(row);
|
|
5832
6191
|
return kids && kids.length > 0 ? kids : null;
|
|
5833
6192
|
};
|
|
5834
|
-
const [open, setOpen] = (0,
|
|
6193
|
+
const [open, setOpen] = (0, import_react33.useState)(() => /* @__PURE__ */ new Set());
|
|
5835
6194
|
const visible = rows.map(rowKey);
|
|
5836
6195
|
const resetOn = subRows ? [...visible].sort().join("|") : `${shown?.key}|${shown?.dir}|${visible.join("|")}`;
|
|
5837
|
-
(0,
|
|
6196
|
+
(0, import_react33.useEffect)(() => setOpen(/* @__PURE__ */ new Set()), [resetOn]);
|
|
5838
6197
|
const expandable = (row) => (!!renderExpanded || !!childrenOf(row)) && (canExpand ? canExpand(row) : true);
|
|
5839
6198
|
const anyExpandable = (!!renderExpanded || !!subRows) && rows.some(expandable);
|
|
5840
6199
|
const toggle = (key) => setOpen((prev) => {
|
|
@@ -5855,8 +6214,8 @@ function DataTable({
|
|
|
5855
6214
|
pickable.forEach((k) => allVisible ? next.delete(k) : next.add(k));
|
|
5856
6215
|
setPicked(next);
|
|
5857
6216
|
};
|
|
5858
|
-
const lastPicked = (0,
|
|
5859
|
-
const shiftHeld = (0,
|
|
6217
|
+
const lastPicked = (0, import_react33.useRef)(null);
|
|
6218
|
+
const shiftHeld = (0, import_react33.useRef)(false);
|
|
5860
6219
|
const togglePick = (index) => {
|
|
5861
6220
|
const key = visible[index];
|
|
5862
6221
|
const on = !picked.has(key);
|
|
@@ -5873,12 +6232,12 @@ function DataTable({
|
|
|
5873
6232
|
};
|
|
5874
6233
|
const count = selectedCount ?? picked.size;
|
|
5875
6234
|
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,
|
|
6235
|
+
const scroller = (0, import_react33.useRef)(null);
|
|
6236
|
+
const [pinned, setPinned] = (0, import_react33.useState)(false);
|
|
6237
|
+
const [scrolled, setScrolled] = (0, import_react33.useState)(false);
|
|
6238
|
+
const heads = (0, import_react33.useRef)(/* @__PURE__ */ new Map());
|
|
6239
|
+
const [lefts, setLefts] = (0, import_react33.useState)({});
|
|
6240
|
+
(0, import_react33.useEffect)(() => {
|
|
5882
6241
|
const el = scroller.current;
|
|
5883
6242
|
if (!el || typeof ResizeObserver === "undefined") return void 0;
|
|
5884
6243
|
const measure = () => {
|
|
@@ -5911,19 +6270,19 @@ function DataTable({
|
|
|
5911
6270
|
part === nameIdx && "max-w-60 border-r border-r-border-default"
|
|
5912
6271
|
) : "";
|
|
5913
6272
|
const pinStyle = (part) => isPinned(part) ? { left: leftOf(part) } : void 0;
|
|
5914
|
-
const edge = (part) => pinned && scrolled && part === nameIdx ? /* @__PURE__ */ (0,
|
|
6273
|
+
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
6274
|
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,
|
|
6275
|
+
const wrapRef = (0, import_react33.useRef)(null);
|
|
6276
|
+
const theadRef = (0, import_react33.useRef)(null);
|
|
6277
|
+
const cloneRef = (0, import_react33.useRef)(null);
|
|
6278
|
+
const [stuck, setStuck] = (0, import_react33.useState)(false);
|
|
6279
|
+
const [geom, setGeom] = (0, import_react33.useState)({ cols: [], width: 0, height: 0 });
|
|
6280
|
+
const [barH, setBarH] = (0, import_react33.useState)(0);
|
|
6281
|
+
const [scrollPad, setScrollPad] = (0, import_react33.useState)({ top: 0, bottom: 0 });
|
|
6282
|
+
const [footerStuck, setFooterStuck] = (0, import_react33.useState)(false);
|
|
6283
|
+
const [scrolledDown, setScrolledDown] = (0, import_react33.useState)(false);
|
|
6284
|
+
const [animate, setAnimate] = (0, import_react33.useState)(false);
|
|
6285
|
+
(0, import_react33.useEffect)(() => {
|
|
5927
6286
|
const thead = theadRef.current;
|
|
5928
6287
|
if (!sticky || !thead || typeof ResizeObserver === "undefined") return void 0;
|
|
5929
6288
|
const measure = () => {
|
|
@@ -5972,7 +6331,7 @@ function DataTable({
|
|
|
5972
6331
|
ro?.disconnect();
|
|
5973
6332
|
};
|
|
5974
6333
|
}, [sticky]);
|
|
5975
|
-
(0,
|
|
6334
|
+
(0, import_react33.useEffect)(() => {
|
|
5976
6335
|
const clone = cloneRef.current;
|
|
5977
6336
|
if (!clone) return;
|
|
5978
6337
|
clone.querySelectorAll("button, a[href], input, [tabindex]").forEach((el) => {
|
|
@@ -5983,9 +6342,9 @@ function DataTable({
|
|
|
5983
6342
|
const top = (stickyTop ?? barH) - scrollPad.top;
|
|
5984
6343
|
const renderCell = (c, row) => {
|
|
5985
6344
|
const v = c.cell(row);
|
|
5986
|
-
return v === null || v === void 0 || v === "" ? /* @__PURE__ */ (0,
|
|
6345
|
+
return v === null || v === void 0 || v === "" ? /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(NoValue, { reason: c.missing }) : v;
|
|
5987
6346
|
};
|
|
5988
|
-
const fit = (ci, content) => pinned && ci === nameIdx ? /* @__PURE__ */ (0,
|
|
6347
|
+
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
6348
|
const colBg = (c, rowBg) => c.highlight ? TINT : rowBg;
|
|
5990
6349
|
const firstPart = selectable ? "select" : anyExpandable ? "expand" : 0;
|
|
5991
6350
|
const ringCls = (part) => onRowClick ? cn(
|
|
@@ -5995,13 +6354,13 @@ function DataTable({
|
|
|
5995
6354
|
part === columns.length - 1 && RING_RIGHT,
|
|
5996
6355
|
pinned && scrolled && part === nameIdx && part !== columns.length - 1 && RING_PAST_EDGE
|
|
5997
6356
|
) : "";
|
|
5998
|
-
const plainRow = (kind, row, key, rowBg, extra) => /* @__PURE__ */ (0,
|
|
5999
|
-
selectable && /* @__PURE__ */ (0,
|
|
6000
|
-
anyExpandable && /* @__PURE__ */ (0,
|
|
6357
|
+
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: [
|
|
6358
|
+
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") }),
|
|
6359
|
+
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
6360
|
columns.map((c, ci) => {
|
|
6002
6361
|
const bg = kind === "sub" ? colBg(c, rowBg) : rowBg;
|
|
6003
6362
|
const isName = ci === nameIdx;
|
|
6004
|
-
return /* @__PURE__ */ (0,
|
|
6363
|
+
return /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)(
|
|
6005
6364
|
"td",
|
|
6006
6365
|
{
|
|
6007
6366
|
className: cn(
|
|
@@ -6016,8 +6375,8 @@ function DataTable({
|
|
|
6016
6375
|
),
|
|
6017
6376
|
style: pinStyle(ci),
|
|
6018
6377
|
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,
|
|
6378
|
+
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)),
|
|
6379
|
+
kind === "sub" && isName && rowLabel && extra?.parent !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("span", { className: "sr-only", children: [
|
|
6021
6380
|
", in ",
|
|
6022
6381
|
rowLabel(extra.parent)
|
|
6023
6382
|
] }),
|
|
@@ -6028,8 +6387,8 @@ function DataTable({
|
|
|
6028
6387
|
);
|
|
6029
6388
|
})
|
|
6030
6389
|
] }, key);
|
|
6031
|
-
const headRow = (clone) => /* @__PURE__ */ (0,
|
|
6032
|
-
selectable && /* @__PURE__ */ (0,
|
|
6390
|
+
const headRow = (clone) => /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("tr", { className: "bg-subtle text-micro font-semibold uppercase tracking-wider text-text-secondary", children: [
|
|
6391
|
+
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
6392
|
CheckBox,
|
|
6034
6393
|
{
|
|
6035
6394
|
checked: allVisible,
|
|
@@ -6038,14 +6397,14 @@ function DataTable({
|
|
|
6038
6397
|
disabled: pickable.length === 0,
|
|
6039
6398
|
ariaLabel: allVisible ? "Deselect all rows on this page" : "Select all rows on this page"
|
|
6040
6399
|
}
|
|
6041
|
-
) : /* @__PURE__ */ (0,
|
|
6042
|
-
anyExpandable && /* @__PURE__ */ (0,
|
|
6043
|
-
columns.map((c, ci) => /* @__PURE__ */ (0,
|
|
6400
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("span", { className: "sr-only", children: "Select" }) }),
|
|
6401
|
+
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" }) }),
|
|
6402
|
+
columns.map((c, ci) => /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)(
|
|
6044
6403
|
"th",
|
|
6045
6404
|
{
|
|
6046
6405
|
ref: !clone && ci <= nameIdx ? headRef(ci) : void 0,
|
|
6047
6406
|
scope: "col",
|
|
6048
|
-
"aria-sort": c.sortable ? ariaSortFor(shown, c.key) : void 0,
|
|
6407
|
+
"aria-sort": c.sortable || c.headerMenu && onSortChange ? ariaSortFor(shown, c.key) : void 0,
|
|
6049
6408
|
className: cn(
|
|
6050
6409
|
"group/head whitespace-nowrap border-b border-border-default font-semibold",
|
|
6051
6410
|
head,
|
|
@@ -6056,7 +6415,16 @@ function DataTable({
|
|
|
6056
6415
|
),
|
|
6057
6416
|
style: pinStyle(ci),
|
|
6058
6417
|
children: [
|
|
6059
|
-
c.
|
|
6418
|
+
c.headerMenu ? /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
6419
|
+
HeaderMenuTrigger,
|
|
6420
|
+
{
|
|
6421
|
+
menu: c.headerMenu,
|
|
6422
|
+
columnLabel: c.label,
|
|
6423
|
+
sortDir: shown?.key === c.key ? shown.dir : null,
|
|
6424
|
+
onSort: onSortChange ? (dir) => onSortChange({ key: c.key, dir }) : void 0,
|
|
6425
|
+
testId: clone || !testIdPrefix ? void 0 : `${testIdPrefix}-header-menu-${c.key}`
|
|
6426
|
+
}
|
|
6427
|
+
) : c.sortable && onSortChange ? /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
6060
6428
|
SortButton,
|
|
6061
6429
|
{
|
|
6062
6430
|
label: c.label,
|
|
@@ -6067,7 +6435,7 @@ function DataTable({
|
|
|
6067
6435
|
description: c.info,
|
|
6068
6436
|
testIdPrefix: clone ? void 0 : testIdPrefix
|
|
6069
6437
|
}
|
|
6070
|
-
) : c.info ? /* @__PURE__ */ (0,
|
|
6438
|
+
) : c.info ? /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(SortButton, { label: c.label, sortKey: c.key, sortable: false, sort: sortProp(shown), onSort: () => {
|
|
6071
6439
|
}, description: c.info, align: right(c) ? "right" : "left" }) : c.label,
|
|
6072
6440
|
edge(ci)
|
|
6073
6441
|
]
|
|
@@ -6076,19 +6444,19 @@ function DataTable({
|
|
|
6076
6444
|
))
|
|
6077
6445
|
] });
|
|
6078
6446
|
const inside = variant === "chart";
|
|
6079
|
-
const bar = barCount > 0 ? /* @__PURE__ */ (0,
|
|
6080
|
-
/* @__PURE__ */ (0,
|
|
6447
|
+
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: [
|
|
6448
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("span", { role: "status", className: "font-medium text-text-primary", children: [
|
|
6081
6449
|
formatCountFull(count),
|
|
6082
6450
|
" selected"
|
|
6083
6451
|
] }),
|
|
6084
|
-
allVisible && totalCount !== void 0 && count < totalCount && onSelectAll && /* @__PURE__ */ (0,
|
|
6452
|
+
allVisible && totalCount !== void 0 && count < totalCount && onSelectAll && /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)(Button, { variant: "link", size: "sm", onClick: onSelectAll, children: [
|
|
6085
6453
|
"Select all ",
|
|
6086
6454
|
formatCountFull(totalCount)
|
|
6087
6455
|
] }),
|
|
6088
6456
|
selectionActions,
|
|
6089
|
-
/* @__PURE__ */ (0,
|
|
6457
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)(Button, { variant: "link", size: "sm", onClick: () => onSelectedChange?.([]), children: "Clear" })
|
|
6090
6458
|
] }) : null;
|
|
6091
|
-
const scrollArea = /* @__PURE__ */ (0,
|
|
6459
|
+
const scrollArea = /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
6092
6460
|
"div",
|
|
6093
6461
|
{
|
|
6094
6462
|
ref: scroller,
|
|
@@ -6097,7 +6465,7 @@ function DataTable({
|
|
|
6097
6465
|
if (cloneRef.current) cloneRef.current.scrollLeft = e.currentTarget.scrollLeft;
|
|
6098
6466
|
},
|
|
6099
6467
|
className: cn("overflow-x-auto", SCROLLBAR, maxHeight && cn("overflow-y-auto", MAX_H[maxHeight])),
|
|
6100
|
-
children: /* @__PURE__ */ (0,
|
|
6468
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)(
|
|
6101
6469
|
"table",
|
|
6102
6470
|
{
|
|
6103
6471
|
"aria-labelledby": title ? titleId : void 0,
|
|
@@ -6105,12 +6473,12 @@ function DataTable({
|
|
|
6105
6473
|
"aria-busy": loading || refreshing || void 0,
|
|
6106
6474
|
className: "w-full border-separate border-spacing-0 text-left",
|
|
6107
6475
|
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,
|
|
6476
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)("thead", { ref: theadRef, className: cn(maxHeight && "sticky top-0 z-10"), children: headRow(false) }),
|
|
6477
|
+
/* @__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: [
|
|
6478
|
+
selectable && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("td", { className: cn("border-b border-border-default", pad2) }),
|
|
6479
|
+
anyExpandable && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("td", { className: cn("border-b border-border-default", pad2, EXPAND_PAD) }),
|
|
6480
|
+
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))
|
|
6481
|
+
] }, 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
6482
|
totalsRow !== void 0 && plainRow("total", totalsRow, "__totals", "bg-subtle"),
|
|
6115
6483
|
rows.map((row, ri) => {
|
|
6116
6484
|
const key = rowKey(row);
|
|
@@ -6125,8 +6493,8 @@ function DataTable({
|
|
|
6125
6493
|
const ticked = picked.has(key);
|
|
6126
6494
|
const label = rowLabel ? rowLabel(row) : "row";
|
|
6127
6495
|
const clickable = !!onRowClick || canOpen;
|
|
6128
|
-
return /* @__PURE__ */ (0,
|
|
6129
|
-
/* @__PURE__ */ (0,
|
|
6496
|
+
return /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)(import_react33.Fragment, { children: [
|
|
6497
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsxs)(
|
|
6130
6498
|
"tr",
|
|
6131
6499
|
{
|
|
6132
6500
|
onClick: onRowClick ? (e) => rowClickCounts(e) && onRowClick(row) : canOpen ? (e) => rowClickCounts(e) && toggle(key) : void 0,
|
|
@@ -6137,14 +6505,14 @@ function DataTable({
|
|
|
6137
6505
|
// The row's hidden open button has keyboard focus: ring the whole row.
|
|
6138
6506
|
),
|
|
6139
6507
|
children: [
|
|
6140
|
-
selectable && /* @__PURE__ */ (0,
|
|
6508
|
+
selectable && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
6141
6509
|
"td",
|
|
6142
6510
|
{
|
|
6143
6511
|
onPointerDownCapture: (e) => shiftHeld.current = e.shiftKey,
|
|
6144
6512
|
onKeyDownCapture: (e) => shiftHeld.current = e.shiftKey,
|
|
6145
6513
|
className: cn("border-b border-border-default pr-0", pad2, panelOpen && "border-b-0", rowBg, ringCls("select"), pinCls("select", "body", rowBg)),
|
|
6146
6514
|
style: pinStyle("select"),
|
|
6147
|
-
children: reason ? /* @__PURE__ */ (0,
|
|
6515
|
+
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
6516
|
"button",
|
|
6149
6517
|
{
|
|
6150
6518
|
type: "button",
|
|
@@ -6154,17 +6522,17 @@ function DataTable({
|
|
|
6154
6522
|
"aria-label": `Select ${label}`,
|
|
6155
6523
|
onClick: (e) => e.preventDefault(),
|
|
6156
6524
|
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,
|
|
6525
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(CheckBoxBox, { checked: ticked, disabled: true })
|
|
6158
6526
|
}
|
|
6159
|
-
) }) : /* @__PURE__ */ (0,
|
|
6527
|
+
) }) : /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(CheckBox, { checked: ticked, onChange: () => togglePick(ri), ariaLabel: `Select ${label}` })
|
|
6160
6528
|
}
|
|
6161
6529
|
),
|
|
6162
|
-
anyExpandable && /* @__PURE__ */ (0,
|
|
6530
|
+
anyExpandable && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
6163
6531
|
"td",
|
|
6164
6532
|
{
|
|
6165
|
-
className: cn("border-b border-border-default
|
|
6533
|
+
className: cn("border-b border-border-default", pad2, EXPAND_PAD, panelOpen && "border-b-0", rowBg, ringCls("expand"), pinCls("expand", "body", rowBg)),
|
|
6166
6534
|
style: pinStyle("expand"),
|
|
6167
|
-
children: canOpen && /* @__PURE__ */ (0,
|
|
6535
|
+
children: canOpen && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
6168
6536
|
"button",
|
|
6169
6537
|
{
|
|
6170
6538
|
type: "button",
|
|
@@ -6173,8 +6541,8 @@ function DataTable({
|
|
|
6173
6541
|
"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
6542
|
onClick: () => toggle(key),
|
|
6175
6543
|
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
|
-
|
|
6544
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
6545
|
+
import_lucide_react31.ChevronRight,
|
|
6178
6546
|
{
|
|
6179
6547
|
size: 16,
|
|
6180
6548
|
"aria-hidden": "true",
|
|
@@ -6188,7 +6556,7 @@ function DataTable({
|
|
|
6188
6556
|
columns.map((c, ci) => {
|
|
6189
6557
|
const bg = colBg(c, rowBg);
|
|
6190
6558
|
const opener = !!onRowClick && ci === nameIdx;
|
|
6191
|
-
return /* @__PURE__ */ (0,
|
|
6559
|
+
return /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)(
|
|
6192
6560
|
"td",
|
|
6193
6561
|
{
|
|
6194
6562
|
className: cn(
|
|
@@ -6207,7 +6575,7 @@ function DataTable({
|
|
|
6207
6575
|
fit(ci, renderCell(c, row)),
|
|
6208
6576
|
opener && // The keyboard's and screen reader's way to the row click. It
|
|
6209
6577
|
// stays hidden; while it has focus the whole row takes the ring.
|
|
6210
|
-
/* @__PURE__ */ (0,
|
|
6578
|
+
/* @__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
6579
|
edge(ci)
|
|
6212
6580
|
]
|
|
6213
6581
|
},
|
|
@@ -6217,7 +6585,7 @@ function DataTable({
|
|
|
6217
6585
|
]
|
|
6218
6586
|
}
|
|
6219
6587
|
),
|
|
6220
|
-
panelOpen && /* @__PURE__ */ (0,
|
|
6588
|
+
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
6589
|
isOpen && kids?.map(
|
|
6222
6590
|
(child, si) => plainRow("sub", child, `${key}::${rowKey(child)}`, highlightRow?.(child) ? TINT : "bg-subtle", { id: kidIds[si], parent: row })
|
|
6223
6591
|
)
|
|
@@ -6230,7 +6598,7 @@ function DataTable({
|
|
|
6230
6598
|
}
|
|
6231
6599
|
);
|
|
6232
6600
|
const bare = inside || !title && barCount === 0;
|
|
6233
|
-
const frame = /* @__PURE__ */ (0,
|
|
6601
|
+
const frame = /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)(
|
|
6234
6602
|
"div",
|
|
6235
6603
|
{
|
|
6236
6604
|
className: cn(
|
|
@@ -6242,17 +6610,17 @@ function DataTable({
|
|
|
6242
6610
|
),
|
|
6243
6611
|
"data-testid": testIdPrefix,
|
|
6244
6612
|
children: [
|
|
6245
|
-
title && inside && /* @__PURE__ */ (0,
|
|
6246
|
-
/* @__PURE__ */ (0,
|
|
6247
|
-
/* @__PURE__ */ (0,
|
|
6248
|
-
subtitle && /* @__PURE__ */ (0,
|
|
6613
|
+
title && inside && /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("div", { className: "flex items-start justify-between gap-2 p-card-padding", children: [
|
|
6614
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("div", { className: "min-w-0", children: [
|
|
6615
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)("h3", { id: titleId, className: "text-panel-title font-semibold text-text-primary", children: title }),
|
|
6616
|
+
subtitle && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("p", { className: "mt-0.5 text-xs leading-snug text-text-tertiary", children: subtitle })
|
|
6249
6617
|
] }),
|
|
6250
|
-
(bar ?? action) && /* @__PURE__ */ (0,
|
|
6618
|
+
(bar ?? action) && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("div", { className: "shrink-0 text-text-tertiary", children: bar ?? action })
|
|
6251
6619
|
] }),
|
|
6252
6620
|
sticky ? (
|
|
6253
6621
|
// The copy of the header sticks within this box, so it leaves with the last row.
|
|
6254
|
-
/* @__PURE__ */ (0,
|
|
6255
|
-
/* @__PURE__ */ (0,
|
|
6622
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("div", { className: "relative", children: [
|
|
6623
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
6256
6624
|
"div",
|
|
6257
6625
|
{
|
|
6258
6626
|
ref: cloneRef,
|
|
@@ -6263,25 +6631,25 @@ function DataTable({
|
|
|
6263
6631
|
},
|
|
6264
6632
|
className: "sticky z-2 overflow-hidden",
|
|
6265
6633
|
style: { top, height: geom.height, marginBottom: -geom.height, visibility: stuck ? "visible" : "hidden" },
|
|
6266
|
-
children: /* @__PURE__ */ (0,
|
|
6267
|
-
/* @__PURE__ */ (0,
|
|
6268
|
-
/* @__PURE__ */ (0,
|
|
6634
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("table", { className: "table-fixed border-separate border-spacing-0 text-left", style: { width: geom.width }, children: [
|
|
6635
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)("colgroup", { children: geom.cols.map((w, i) => /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("col", { style: { width: w } }, i)) }),
|
|
6636
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)("thead", { children: headRow(true) })
|
|
6269
6637
|
] })
|
|
6270
6638
|
}
|
|
6271
6639
|
),
|
|
6272
6640
|
scrollArea
|
|
6273
6641
|
] })
|
|
6274
6642
|
) : scrollArea,
|
|
6275
|
-
refreshing && !loading && /* @__PURE__ */ (0,
|
|
6276
|
-
/* @__PURE__ */ (0,
|
|
6277
|
-
footer && !sticky && /* @__PURE__ */ (0,
|
|
6643
|
+
refreshing && !loading && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(RefreshLine, {}),
|
|
6644
|
+
/* @__PURE__ */ (0, import_jsx_runtime58.jsx)(LongWait, { loading, onRetry, className: "mb-3 px-4" }),
|
|
6645
|
+
footer && !sticky && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("div", { className: "border-t border-border-default px-4 py-3", children: footer })
|
|
6278
6646
|
]
|
|
6279
6647
|
}
|
|
6280
6648
|
);
|
|
6281
6649
|
const hideFooter = footerStuck && !scrolledDown;
|
|
6282
|
-
const body = sticky ? /* @__PURE__ */ (0,
|
|
6650
|
+
const body = sticky ? /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("div", { ref: wrapRef, className: cn("flex w-full flex-col", bare && className), children: [
|
|
6283
6651
|
frame,
|
|
6284
|
-
footer && /* @__PURE__ */ (0,
|
|
6652
|
+
footer && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
|
|
6285
6653
|
"div",
|
|
6286
6654
|
{
|
|
6287
6655
|
"data-sticky-footer": "",
|
|
@@ -6298,14 +6666,14 @@ function DataTable({
|
|
|
6298
6666
|
)
|
|
6299
6667
|
] }) : frame;
|
|
6300
6668
|
if (bare) return body;
|
|
6301
|
-
return /* @__PURE__ */ (0,
|
|
6302
|
-
title ? /* @__PURE__ */ (0,
|
|
6669
|
+
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: [
|
|
6670
|
+
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
6671
|
body
|
|
6304
6672
|
] });
|
|
6305
6673
|
}
|
|
6306
6674
|
|
|
6307
6675
|
// src/MediaLabel.tsx
|
|
6308
|
-
var
|
|
6676
|
+
var import_jsx_runtime59 = require("react/jsx-runtime");
|
|
6309
6677
|
var FILL = {
|
|
6310
6678
|
TV: "bg-media-tv",
|
|
6311
6679
|
CTV: "bg-media-ctv",
|
|
@@ -6316,7 +6684,7 @@ var FILL = {
|
|
|
6316
6684
|
Magazine: "bg-media-magazine"
|
|
6317
6685
|
};
|
|
6318
6686
|
function MediaLabel({ type, className, testIdPrefix }) {
|
|
6319
|
-
return /* @__PURE__ */ (0,
|
|
6687
|
+
return /* @__PURE__ */ (0, import_jsx_runtime59.jsx)(
|
|
6320
6688
|
"span",
|
|
6321
6689
|
{
|
|
6322
6690
|
className: cn(
|
|
@@ -6331,10 +6699,10 @@ function MediaLabel({ type, className, testIdPrefix }) {
|
|
|
6331
6699
|
}
|
|
6332
6700
|
|
|
6333
6701
|
// src/SuggestionChip.tsx
|
|
6334
|
-
var
|
|
6335
|
-
var
|
|
6336
|
-
var SuggestionChip = (0,
|
|
6337
|
-
return /* @__PURE__ */ (0,
|
|
6702
|
+
var import_react34 = require("react");
|
|
6703
|
+
var import_jsx_runtime60 = require("react/jsx-runtime");
|
|
6704
|
+
var SuggestionChip = (0, import_react34.forwardRef)(function SuggestionChip2({ children, className, testIdPrefix, type = "button", ...props }, ref) {
|
|
6705
|
+
return /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
|
|
6338
6706
|
"button",
|
|
6339
6707
|
{
|
|
6340
6708
|
ref,
|
|
@@ -6345,18 +6713,18 @@ var SuggestionChip = (0, import_react32.forwardRef)(function SuggestionChip2({ c
|
|
|
6345
6713
|
"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
6714
|
className
|
|
6347
6715
|
),
|
|
6348
|
-
children: /* @__PURE__ */ (0,
|
|
6716
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("span", { className: "truncate", children })
|
|
6349
6717
|
}
|
|
6350
6718
|
);
|
|
6351
6719
|
});
|
|
6352
6720
|
SuggestionChip.displayName = "SuggestionChip";
|
|
6353
6721
|
|
|
6354
6722
|
// src/ToggleChip.tsx
|
|
6355
|
-
var
|
|
6356
|
-
var
|
|
6357
|
-
var
|
|
6358
|
-
var ToggleChip = (0,
|
|
6359
|
-
return /* @__PURE__ */ (0,
|
|
6723
|
+
var import_react35 = require("react");
|
|
6724
|
+
var import_lucide_react32 = require("lucide-react");
|
|
6725
|
+
var import_jsx_runtime61 = require("react/jsx-runtime");
|
|
6726
|
+
var ToggleChip = (0, import_react35.forwardRef)(function ToggleChip2({ selected, onChange, children, className, testIdPrefix, type = "button", onClick, ...props }, ref) {
|
|
6727
|
+
return /* @__PURE__ */ (0, import_jsx_runtime61.jsxs)(
|
|
6360
6728
|
"button",
|
|
6361
6729
|
{
|
|
6362
6730
|
ref,
|
|
@@ -6374,7 +6742,7 @@ var ToggleChip = (0, import_react33.forwardRef)(function ToggleChip2({ selected,
|
|
|
6374
6742
|
className
|
|
6375
6743
|
),
|
|
6376
6744
|
children: [
|
|
6377
|
-
selected && /* @__PURE__ */ (0,
|
|
6745
|
+
selected && /* @__PURE__ */ (0, import_jsx_runtime61.jsx)(import_lucide_react32.Check, { size: 14, "aria-hidden": "true", className: "-ml-0.5 shrink-0" }),
|
|
6378
6746
|
children
|
|
6379
6747
|
]
|
|
6380
6748
|
}
|
|
@@ -6383,14 +6751,14 @@ var ToggleChip = (0, import_react33.forwardRef)(function ToggleChip2({ selected,
|
|
|
6383
6751
|
ToggleChip.displayName = "ToggleChip";
|
|
6384
6752
|
|
|
6385
6753
|
// src/CopyButton.tsx
|
|
6386
|
-
var
|
|
6387
|
-
var
|
|
6388
|
-
var
|
|
6754
|
+
var import_react36 = require("react");
|
|
6755
|
+
var import_lucide_react33 = require("lucide-react");
|
|
6756
|
+
var import_jsx_runtime62 = require("react/jsx-runtime");
|
|
6389
6757
|
var CONFIRM_MS = 2e3;
|
|
6390
|
-
var CopyButton = (0,
|
|
6391
|
-
const [copied, setCopied] = (0,
|
|
6392
|
-
const timer = (0,
|
|
6393
|
-
(0,
|
|
6758
|
+
var CopyButton = (0, import_react36.forwardRef)(function CopyButton2({ value, label, "aria-label": ariaLabel, size = "xs", className, testIdPrefix }, ref) {
|
|
6759
|
+
const [copied, setCopied] = (0, import_react36.useState)(false);
|
|
6760
|
+
const timer = (0, import_react36.useRef)(void 0);
|
|
6761
|
+
(0, import_react36.useEffect)(() => () => clearTimeout(timer.current), []);
|
|
6394
6762
|
const copy = async () => {
|
|
6395
6763
|
try {
|
|
6396
6764
|
await navigator.clipboard.writeText(typeof value === "function" ? value() : value);
|
|
@@ -6402,8 +6770,8 @@ var CopyButton = (0, import_react34.forwardRef)(function CopyButton2({ value, la
|
|
|
6402
6770
|
timer.current = setTimeout(() => setCopied(false), CONFIRM_MS);
|
|
6403
6771
|
};
|
|
6404
6772
|
const iconSize = size === "xs" ? 13 : 15;
|
|
6405
|
-
const icon = copied ? /* @__PURE__ */ (0,
|
|
6406
|
-
return /* @__PURE__ */ (0,
|
|
6773
|
+
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" });
|
|
6774
|
+
return /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(
|
|
6407
6775
|
Button,
|
|
6408
6776
|
{
|
|
6409
6777
|
ref,
|
|
@@ -6417,8 +6785,8 @@ var CopyButton = (0, import_react34.forwardRef)(function CopyButton2({ value, la
|
|
|
6417
6785
|
className: cn(!copied && "text-text-secondary", className),
|
|
6418
6786
|
children: [
|
|
6419
6787
|
icon,
|
|
6420
|
-
label && /* @__PURE__ */ (0,
|
|
6421
|
-
/* @__PURE__ */ (0,
|
|
6788
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("span", { children: copied ? "Copied" : label }),
|
|
6789
|
+
/* @__PURE__ */ (0, import_jsx_runtime62.jsx)("span", { role: "status", className: "sr-only", children: copied ? "Copied" : "" })
|
|
6422
6790
|
]
|
|
6423
6791
|
}
|
|
6424
6792
|
);
|
|
@@ -6426,8 +6794,8 @@ var CopyButton = (0, import_react34.forwardRef)(function CopyButton2({ value, la
|
|
|
6426
6794
|
CopyButton.displayName = "CopyButton";
|
|
6427
6795
|
|
|
6428
6796
|
// src/InlineMessage.tsx
|
|
6429
|
-
var
|
|
6430
|
-
var
|
|
6797
|
+
var import_lucide_react34 = require("lucide-react");
|
|
6798
|
+
var import_jsx_runtime63 = require("react/jsx-runtime");
|
|
6431
6799
|
var BOX = {
|
|
6432
6800
|
info: "border-brand-primaryAction/30 bg-brand-primaryAction/10",
|
|
6433
6801
|
success: "border-status-success/40 bg-status-success/10",
|
|
@@ -6441,30 +6809,30 @@ var ICON_INK = {
|
|
|
6441
6809
|
warning: "text-text-warning",
|
|
6442
6810
|
danger: "text-text-danger"
|
|
6443
6811
|
};
|
|
6444
|
-
var ICON2 = { info:
|
|
6812
|
+
var ICON2 = { info: import_lucide_react34.Info, success: import_lucide_react34.CheckCircle2, warning: import_lucide_react34.AlertTriangle, danger: import_lucide_react34.XCircle };
|
|
6445
6813
|
function InlineMessage({ tone = "info", title, children, actions, onDismiss, className, testIdPrefix }) {
|
|
6446
6814
|
const Icon = ICON2[tone];
|
|
6447
|
-
return /* @__PURE__ */ (0,
|
|
6815
|
+
return /* @__PURE__ */ (0, import_jsx_runtime63.jsxs)(
|
|
6448
6816
|
"div",
|
|
6449
6817
|
{
|
|
6450
6818
|
role: tone === "warning" || tone === "danger" ? "alert" : "status",
|
|
6451
6819
|
className: cn("flex items-start gap-2.5 rounded-control border px-3 py-2.5 text-sm", BOX[tone], className),
|
|
6452
6820
|
"data-testid": testIdPrefix,
|
|
6453
6821
|
children: [
|
|
6454
|
-
/* @__PURE__ */ (0,
|
|
6455
|
-
/* @__PURE__ */ (0,
|
|
6456
|
-
/* @__PURE__ */ (0,
|
|
6457
|
-
children && /* @__PURE__ */ (0,
|
|
6458
|
-
actions && /* @__PURE__ */ (0,
|
|
6822
|
+
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)(Icon, { size: 16, "aria-hidden": "true", className: cn("mt-0.5 shrink-0", ICON_INK[tone]) }),
|
|
6823
|
+
/* @__PURE__ */ (0, import_jsx_runtime63.jsxs)("div", { className: "min-w-0 flex-1", children: [
|
|
6824
|
+
/* @__PURE__ */ (0, import_jsx_runtime63.jsx)("p", { className: "font-semibold text-text-primary", children: title }),
|
|
6825
|
+
children && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("div", { className: "mt-0.5 text-text-secondary", children }),
|
|
6826
|
+
actions && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)("div", { className: "mt-2 flex flex-wrap items-center gap-2", children: actions })
|
|
6459
6827
|
] }),
|
|
6460
|
-
onDismiss && /* @__PURE__ */ (0,
|
|
6828
|
+
onDismiss && /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(
|
|
6461
6829
|
"button",
|
|
6462
6830
|
{
|
|
6463
6831
|
type: "button",
|
|
6464
6832
|
onClick: onDismiss,
|
|
6465
6833
|
"aria-label": "Dismiss",
|
|
6466
6834
|
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,
|
|
6835
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime63.jsx)(import_lucide_react34.X, { size: 14, "aria-hidden": "true" })
|
|
6468
6836
|
}
|
|
6469
6837
|
)
|
|
6470
6838
|
]
|
|
@@ -6473,9 +6841,9 @@ function InlineMessage({ tone = "info", title, children, actions, onDismiss, cla
|
|
|
6473
6841
|
}
|
|
6474
6842
|
|
|
6475
6843
|
// src/FilterDrawer.tsx
|
|
6476
|
-
var
|
|
6477
|
-
var
|
|
6478
|
-
var
|
|
6844
|
+
var import_react37 = require("react");
|
|
6845
|
+
var import_lucide_react35 = require("lucide-react");
|
|
6846
|
+
var import_jsx_runtime64 = require("react/jsx-runtime");
|
|
6479
6847
|
var SLIDE_MS = 200;
|
|
6480
6848
|
function reducedMotion() {
|
|
6481
6849
|
return typeof window !== "undefined" && !!window.matchMedia?.("(prefers-reduced-motion: reduce)").matches;
|
|
@@ -6495,12 +6863,12 @@ function FilterDrawer({
|
|
|
6495
6863
|
testIdPrefix
|
|
6496
6864
|
}) {
|
|
6497
6865
|
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,
|
|
6866
|
+
const [openedWith, setOpenedWith] = (0, import_react37.useState)(() => marks(sections));
|
|
6867
|
+
const [confirming, setConfirming] = (0, import_react37.useState)(false);
|
|
6868
|
+
const [view, setViewState] = (0, import_react37.useState)(focus);
|
|
6869
|
+
const [leaving, setLeaving] = (0, import_react37.useState)(null);
|
|
6870
|
+
const [phase, setPhase] = (0, import_react37.useState)("run");
|
|
6871
|
+
const [wasOpen, setWasOpen] = (0, import_react37.useState)(open);
|
|
6504
6872
|
if (open !== wasOpen) {
|
|
6505
6873
|
setWasOpen(open);
|
|
6506
6874
|
setConfirming(false);
|
|
@@ -6522,20 +6890,20 @@ function FilterDrawer({
|
|
|
6522
6890
|
}
|
|
6523
6891
|
setViewState(next);
|
|
6524
6892
|
};
|
|
6525
|
-
(0,
|
|
6893
|
+
(0, import_react37.useLayoutEffect)(() => {
|
|
6526
6894
|
if (phase !== "start") return;
|
|
6527
6895
|
const raf = requestAnimationFrame(() => requestAnimationFrame(() => setPhase("run")));
|
|
6528
6896
|
return () => cancelAnimationFrame(raf);
|
|
6529
6897
|
}, [phase]);
|
|
6530
|
-
(0,
|
|
6898
|
+
(0, import_react37.useEffect)(() => {
|
|
6531
6899
|
if (!leaving || phase !== "run") return;
|
|
6532
6900
|
const t = setTimeout(() => setLeaving(null), SLIDE_MS);
|
|
6533
6901
|
return () => clearTimeout(t);
|
|
6534
6902
|
}, [leaving, phase]);
|
|
6535
|
-
const backRef = (0,
|
|
6536
|
-
const rowRefs = (0,
|
|
6537
|
-
const lastView = (0,
|
|
6538
|
-
(0,
|
|
6903
|
+
const backRef = (0, import_react37.useRef)(null);
|
|
6904
|
+
const rowRefs = (0, import_react37.useRef)(/* @__PURE__ */ new Map());
|
|
6905
|
+
const lastView = (0, import_react37.useRef)(null);
|
|
6906
|
+
(0, import_react37.useEffect)(() => {
|
|
6539
6907
|
if (!open) return;
|
|
6540
6908
|
if (view) backRef.current?.focus();
|
|
6541
6909
|
else if (lastView.current) rowRefs.current.get(lastView.current)?.focus();
|
|
@@ -6548,8 +6916,8 @@ function FilterDrawer({
|
|
|
6548
6916
|
const outgoing = phase === "start" ? void 0 : dir > 0 ? "translateX(-33%)" : "translateX(100%)";
|
|
6549
6917
|
const panel = (v, rows = true) => {
|
|
6550
6918
|
const s = v ? sections.find((x) => x.id === v) : void 0;
|
|
6551
|
-
if (s) return /* @__PURE__ */ (0,
|
|
6552
|
-
return /* @__PURE__ */ (0,
|
|
6919
|
+
if (s) return /* @__PURE__ */ (0, import_jsx_runtime64.jsx)("div", { className: "border-t border-border-default px-5 pt-4", children: renderSection(s.id) });
|
|
6920
|
+
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
6921
|
"button",
|
|
6554
6922
|
{
|
|
6555
6923
|
ref: rows ? (el) => {
|
|
@@ -6561,7 +6929,7 @@ function FilterDrawer({
|
|
|
6561
6929
|
"data-testid": testIdPrefix && `${testIdPrefix}-row-${x.id}`,
|
|
6562
6930
|
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
6931
|
children: [
|
|
6564
|
-
/* @__PURE__ */ (0,
|
|
6932
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
6565
6933
|
x.icon,
|
|
6566
6934
|
{
|
|
6567
6935
|
size: 17,
|
|
@@ -6569,15 +6937,15 @@ function FilterDrawer({
|
|
|
6569
6937
|
className: inUse(x) ? "text-brand-primaryAction" : "text-text-secondary"
|
|
6570
6938
|
}
|
|
6571
6939
|
),
|
|
6572
|
-
/* @__PURE__ */ (0,
|
|
6573
|
-
/* @__PURE__ */ (0,
|
|
6574
|
-
/* @__PURE__ */ (0,
|
|
6940
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)("span", { className: "flex-1 text-sm font-medium text-text-primary", children: x.label }),
|
|
6941
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)(SectionMark, { section: x }),
|
|
6942
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)(import_lucide_react35.ChevronRight, { size: 16, "aria-hidden": "true", className: "shrink-0 text-text-secondary" })
|
|
6575
6943
|
]
|
|
6576
6944
|
}
|
|
6577
6945
|
) }, x.id)) });
|
|
6578
6946
|
};
|
|
6579
|
-
return /* @__PURE__ */ (0,
|
|
6580
|
-
/* @__PURE__ */ (0,
|
|
6947
|
+
return /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)(import_jsx_runtime64.Fragment, { children: [
|
|
6948
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
6581
6949
|
Modal,
|
|
6582
6950
|
{
|
|
6583
6951
|
open: open && confirming,
|
|
@@ -6586,9 +6954,9 @@ function FilterDrawer({
|
|
|
6586
6954
|
title: "Discard changes?",
|
|
6587
6955
|
description: "Your filter picks haven't been applied.",
|
|
6588
6956
|
testIdPrefix: testIdPrefix && `${testIdPrefix}-discard`,
|
|
6589
|
-
footer: /* @__PURE__ */ (0,
|
|
6590
|
-
/* @__PURE__ */ (0,
|
|
6591
|
-
/* @__PURE__ */ (0,
|
|
6957
|
+
footer: /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)(import_jsx_runtime64.Fragment, { children: [
|
|
6958
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)(Button, { variant: "secondary", size: "md", onClick: () => setConfirming(false), children: "Keep editing" }),
|
|
6959
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
6592
6960
|
Button,
|
|
6593
6961
|
{
|
|
6594
6962
|
variant: "danger",
|
|
@@ -6603,15 +6971,15 @@ function FilterDrawer({
|
|
|
6603
6971
|
] })
|
|
6604
6972
|
}
|
|
6605
6973
|
),
|
|
6606
|
-
/* @__PURE__ */ (0,
|
|
6974
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
6607
6975
|
Drawer,
|
|
6608
6976
|
{
|
|
6609
6977
|
open,
|
|
6610
6978
|
onClose: requestClose,
|
|
6611
6979
|
size,
|
|
6612
6980
|
testIdPrefix,
|
|
6613
|
-
title: focused ? /* @__PURE__ */ (0,
|
|
6614
|
-
/* @__PURE__ */ (0,
|
|
6981
|
+
title: focused ? /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)("span", { className: "flex items-center gap-1.5", children: [
|
|
6982
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
6615
6983
|
"button",
|
|
6616
6984
|
{
|
|
6617
6985
|
ref: backRef,
|
|
@@ -6620,25 +6988,25 @@ function FilterDrawer({
|
|
|
6620
6988
|
"aria-label": "Back to all filters",
|
|
6621
6989
|
"data-testid": testIdPrefix && `${testIdPrefix}-back`,
|
|
6622
6990
|
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,
|
|
6991
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(import_lucide_react35.ChevronLeft, { size: 18, "aria-hidden": "true" })
|
|
6624
6992
|
}
|
|
6625
6993
|
),
|
|
6626
6994
|
focused.label,
|
|
6627
|
-
(focused.count ?? 0) > 0 && /* @__PURE__ */ (0,
|
|
6628
|
-
focused.info && /* @__PURE__ */ (0,
|
|
6995
|
+
(focused.count ?? 0) > 0 && /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(CountBadge, { count: focused.count }),
|
|
6996
|
+
focused.info && /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(InfoTip, { text: focused.info, label: `About ${focused.label}` })
|
|
6629
6997
|
] }) : "Filters",
|
|
6630
6998
|
footer: focused ? (
|
|
6631
6999
|
// Picks are kept as they're made; Apply goes back to the list, and only
|
|
6632
7000
|
// See results, on the list, applies them to the page.
|
|
6633
|
-
/* @__PURE__ */ (0,
|
|
6634
|
-
/* @__PURE__ */ (0,
|
|
6635
|
-
/* @__PURE__ */ (0,
|
|
7001
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsxs)("div", { className: "flex w-full items-center justify-between gap-2", children: [
|
|
7002
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)(Button, { variant: "link", size: "md", onClick: () => onClearSection(focused.id), className: "px-0", children: "Clear" }),
|
|
7003
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)(Button, { variant: "primary", size: "md", onClick: () => setView(null), testIdPrefix: testIdPrefix && `${testIdPrefix}-apply-section`, children: "Apply" })
|
|
6636
7004
|
] })
|
|
6637
|
-
) : /* @__PURE__ */ (0,
|
|
6638
|
-
/* @__PURE__ */ (0,
|
|
6639
|
-
/* @__PURE__ */ (0,
|
|
6640
|
-
/* @__PURE__ */ (0,
|
|
6641
|
-
/* @__PURE__ */ (0,
|
|
7005
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)("div", { className: "flex w-full items-center justify-between gap-2", children: [
|
|
7006
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)(Button, { variant: "link", size: "md", onClick: onClearAll, className: "px-0", children: "Clear all" }),
|
|
7007
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
7008
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)(Button, { variant: "secondary", size: "md", onClick: onClose, children: "Cancel" }),
|
|
7009
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
6642
7010
|
Button,
|
|
6643
7011
|
{
|
|
6644
7012
|
variant: "primary",
|
|
@@ -6652,8 +7020,8 @@ function FilterDrawer({
|
|
|
6652
7020
|
)
|
|
6653
7021
|
] })
|
|
6654
7022
|
] }),
|
|
6655
|
-
children: /* @__PURE__ */ (0,
|
|
6656
|
-
/* @__PURE__ */ (0,
|
|
7023
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)("div", { className: "relative -mx-5 overflow-x-clip", children: [
|
|
7024
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
6657
7025
|
"div",
|
|
6658
7026
|
{
|
|
6659
7027
|
style: { transform: incoming },
|
|
@@ -6662,7 +7030,7 @@ function FilterDrawer({
|
|
|
6662
7030
|
},
|
|
6663
7031
|
view ?? "__list"
|
|
6664
7032
|
),
|
|
6665
|
-
leaving && /* @__PURE__ */ (0,
|
|
7033
|
+
leaving && /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(
|
|
6666
7034
|
"div",
|
|
6667
7035
|
{
|
|
6668
7036
|
"aria-hidden": "true",
|
|
@@ -6679,22 +7047,22 @@ function FilterDrawer({
|
|
|
6679
7047
|
}
|
|
6680
7048
|
var inUse = (x) => (x.count ?? 0) > 0 || !!x.badge;
|
|
6681
7049
|
function CountBadge({ count }) {
|
|
6682
|
-
return /* @__PURE__ */ (0,
|
|
7050
|
+
return /* @__PURE__ */ (0, import_jsx_runtime64.jsxs)(Badge, { tone: "brandSolid", kind: "count", children: [
|
|
6683
7051
|
count,
|
|
6684
|
-
/* @__PURE__ */ (0,
|
|
7052
|
+
/* @__PURE__ */ (0, import_jsx_runtime64.jsx)("span", { className: "sr-only", children: " selected" })
|
|
6685
7053
|
] });
|
|
6686
7054
|
}
|
|
6687
7055
|
function SectionMark({ section }) {
|
|
6688
|
-
if ((section.count ?? 0) > 0) return /* @__PURE__ */ (0,
|
|
6689
|
-
return section.badge ? /* @__PURE__ */ (0,
|
|
7056
|
+
if ((section.count ?? 0) > 0) return /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(CountBadge, { count: section.count });
|
|
7057
|
+
return section.badge ? /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(Badge, { tone: "brand", children: section.badge }) : null;
|
|
6690
7058
|
}
|
|
6691
7059
|
|
|
6692
7060
|
// src/AllFiltersButton.tsx
|
|
6693
|
-
var
|
|
6694
|
-
var
|
|
6695
|
-
var
|
|
6696
|
-
var AllFiltersButton = (0,
|
|
6697
|
-
return /* @__PURE__ */ (0,
|
|
7061
|
+
var import_react38 = require("react");
|
|
7062
|
+
var import_lucide_react36 = require("lucide-react");
|
|
7063
|
+
var import_jsx_runtime65 = require("react/jsx-runtime");
|
|
7064
|
+
var AllFiltersButton = (0, import_react38.forwardRef)(function AllFiltersButton2({ count = 0, open, className, testIdPrefix, ...rest }, ref) {
|
|
7065
|
+
return /* @__PURE__ */ (0, import_jsx_runtime65.jsxs)(
|
|
6698
7066
|
"button",
|
|
6699
7067
|
{
|
|
6700
7068
|
ref,
|
|
@@ -6706,105 +7074,14 @@ var AllFiltersButton = (0, import_react36.forwardRef)(function AllFiltersButton2
|
|
|
6706
7074
|
className: cn(chipTriggerClass(), className),
|
|
6707
7075
|
...rest,
|
|
6708
7076
|
children: [
|
|
6709
|
-
/* @__PURE__ */ (0,
|
|
6710
|
-
/* @__PURE__ */ (0,
|
|
6711
|
-
count > 0 && /* @__PURE__ */ (0,
|
|
7077
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)(import_lucide_react36.SlidersHorizontal, { size: 15, "aria-hidden": "true", className: "text-text-secondary" }),
|
|
7078
|
+
/* @__PURE__ */ (0, import_jsx_runtime65.jsx)("span", { className: "text-dense font-medium text-text-primary", children: "All filters" }),
|
|
7079
|
+
count > 0 && /* @__PURE__ */ (0, import_jsx_runtime65.jsx)(Badge, { tone: "brandSolid", kind: "count", children: count })
|
|
6712
7080
|
]
|
|
6713
7081
|
}
|
|
6714
7082
|
);
|
|
6715
7083
|
});
|
|
6716
7084
|
|
|
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
7085
|
// src/dates.ts
|
|
6809
7086
|
var MONTHS2 = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
|
|
6810
7087
|
var MONTHS_LONG = [
|
|
@@ -6916,15 +7193,15 @@ function defaultDateOrder(country) {
|
|
|
6916
7193
|
}
|
|
6917
7194
|
|
|
6918
7195
|
// src/Figure.tsx
|
|
6919
|
-
var
|
|
7196
|
+
var import_jsx_runtime66 = require("react/jsx-runtime");
|
|
6920
7197
|
function Figure({ value, kind = "money", missing, ...opts }) {
|
|
6921
|
-
if (value === null || value === void 0 || Number.isNaN(value)) return /* @__PURE__ */ (0,
|
|
7198
|
+
if (value === null || value === void 0 || Number.isNaN(value)) return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(NoValue, { reason: missing });
|
|
6922
7199
|
const short = kind === "money" ? formatMoney(value, opts) : formatCount(value, opts);
|
|
6923
7200
|
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,
|
|
7201
|
+
if (short === full) return /* @__PURE__ */ (0, import_jsx_runtime66.jsx)(import_jsx_runtime66.Fragment, { children: short });
|
|
7202
|
+
return /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)(Tooltip, { label: full, delay: 300, children: [
|
|
7203
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)("span", { "aria-hidden": "true", children: short }),
|
|
7204
|
+
/* @__PURE__ */ (0, import_jsx_runtime66.jsx)("span", { className: "sr-only", children: full })
|
|
6928
7205
|
] });
|
|
6929
7206
|
}
|
|
6930
7207
|
// Annotate the CommonJS export names for ESM import in node:
|