@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.js
CHANGED
|
@@ -3951,6 +3951,8 @@ function FilterDropdownFooter({
|
|
|
3951
3951
|
onApply,
|
|
3952
3952
|
clearLabel = "Clear all",
|
|
3953
3953
|
applyLabel = "Apply",
|
|
3954
|
+
onCancel,
|
|
3955
|
+
cancelLabel = "Cancel",
|
|
3954
3956
|
className,
|
|
3955
3957
|
testIdPrefix
|
|
3956
3958
|
}) {
|
|
@@ -3965,7 +3967,10 @@ function FilterDropdownFooter({
|
|
|
3965
3967
|
"data-testid": testIdPrefix,
|
|
3966
3968
|
children: [
|
|
3967
3969
|
onClear && /* @__PURE__ */ jsx35(Button, { type: "button", variant: "ghost", size: "sm", onClick: onClear, children: clearLabel }),
|
|
3968
|
-
/* @__PURE__ */
|
|
3970
|
+
/* @__PURE__ */ jsxs33("div", { className: "flex items-center gap-2", children: [
|
|
3971
|
+
onCancel && /* @__PURE__ */ jsx35(Button, { type: "button", variant: "secondary", size: "sm", onClick: onCancel, children: cancelLabel }),
|
|
3972
|
+
/* @__PURE__ */ jsx35(Button, { type: "button", variant: "primary", size: "sm", onClick: onApply, children: applyLabel })
|
|
3973
|
+
] })
|
|
3969
3974
|
]
|
|
3970
3975
|
}
|
|
3971
3976
|
);
|
|
@@ -4178,6 +4183,15 @@ var SortButton = forwardRef7(
|
|
|
4178
4183
|
return description ? /* @__PURE__ */ jsx38(HeaderTip, { description, children: plain }) : plain;
|
|
4179
4184
|
}
|
|
4180
4185
|
const active = !disabled && sort.key === sortKey;
|
|
4186
|
+
const iconFirst = align === "right";
|
|
4187
|
+
const icon = disabled ? null : active ? sort.dir === "asc" ? /* @__PURE__ */ jsx38(ArrowUp, { size: 12, "aria-hidden": "true", className: "shrink-0 text-brand-primaryAction" }) : /* @__PURE__ */ jsx38(ArrowDown, { size: 12, "aria-hidden": "true", className: "shrink-0 text-brand-primaryAction" }) : /* @__PURE__ */ jsx38(
|
|
4188
|
+
ArrowUpDown,
|
|
4189
|
+
{
|
|
4190
|
+
size: 12,
|
|
4191
|
+
"aria-hidden": "true",
|
|
4192
|
+
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"
|
|
4193
|
+
}
|
|
4194
|
+
);
|
|
4181
4195
|
const button = /* @__PURE__ */ jsxs36(
|
|
4182
4196
|
"button",
|
|
4183
4197
|
{
|
|
@@ -4208,15 +4222,9 @@ var SortButton = forwardRef7(
|
|
|
4208
4222
|
className
|
|
4209
4223
|
),
|
|
4210
4224
|
children: [
|
|
4225
|
+
iconFirst && icon,
|
|
4211
4226
|
text,
|
|
4212
|
-
!
|
|
4213
|
-
ArrowUpDown,
|
|
4214
|
-
{
|
|
4215
|
-
size: 12,
|
|
4216
|
-
"aria-hidden": "true",
|
|
4217
|
-
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"
|
|
4218
|
-
}
|
|
4219
|
-
))
|
|
4227
|
+
!iconFirst && icon
|
|
4220
4228
|
]
|
|
4221
4229
|
}
|
|
4222
4230
|
);
|
|
@@ -4614,6 +4622,7 @@ function DateRangePicker({
|
|
|
4614
4622
|
years,
|
|
4615
4623
|
formatDate: formatDate2,
|
|
4616
4624
|
formatRange,
|
|
4625
|
+
caption,
|
|
4617
4626
|
className,
|
|
4618
4627
|
testIdPrefix
|
|
4619
4628
|
}) {
|
|
@@ -4623,6 +4632,7 @@ function DateRangePicker({
|
|
|
4623
4632
|
const [value, setValue] = useState14(defaultValue);
|
|
4624
4633
|
const [draft, setDraft] = useState14(defaultValue);
|
|
4625
4634
|
const ref = useRef15(null);
|
|
4635
|
+
const triggerRef = useRef15(null);
|
|
4626
4636
|
const [fromMo, setFromMo] = useState14(end.getMonth());
|
|
4627
4637
|
const [fromYr, setFromYr] = useState14(end.getFullYear() - 1);
|
|
4628
4638
|
const [toMo, setToMo] = useState14(end.getMonth());
|
|
@@ -4667,13 +4677,14 @@ function DateRangePicker({
|
|
|
4667
4677
|
/* @__PURE__ */ jsxs40(
|
|
4668
4678
|
"button",
|
|
4669
4679
|
{
|
|
4680
|
+
ref: triggerRef,
|
|
4670
4681
|
type: "button",
|
|
4671
4682
|
onClick: toggleOpen,
|
|
4672
4683
|
"aria-expanded": open,
|
|
4673
4684
|
"aria-haspopup": "listbox",
|
|
4674
4685
|
className: chipTriggerClass(),
|
|
4675
4686
|
children: [
|
|
4676
|
-
/* @__PURE__ */ jsxs40("span", { className: "flex flex-col gap-1 text-left leading-none", children: [
|
|
4687
|
+
caption ? /* @__PURE__ */ jsx44(ChipContent, { caption, value }) : /* @__PURE__ */ jsxs40("span", { className: "flex flex-col gap-1 text-left leading-none", children: [
|
|
4677
4688
|
/* @__PURE__ */ jsx44("span", { className: "text-control-caption leading-none text-text-tertiary", children: spanLabel2(value, end, formatDate2, formatRange) }),
|
|
4678
4689
|
/* @__PURE__ */ jsx44("span", { className: "text-xs leading-none font-medium text-text-primary", children: value })
|
|
4679
4690
|
] }),
|
|
@@ -4681,6 +4692,7 @@ function DateRangePicker({
|
|
|
4681
4692
|
]
|
|
4682
4693
|
}
|
|
4683
4694
|
),
|
|
4695
|
+
caption && !open && /* @__PURE__ */ jsx44(Tooltip, { anchorRef: triggerRef, label: spanLabel2(value, end, formatDate2, formatRange), delay: 300, placement: "top" }),
|
|
4684
4696
|
open && /* @__PURE__ */ jsxs40("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: [
|
|
4685
4697
|
presets.map((p) => /* @__PURE__ */ jsx44(
|
|
4686
4698
|
"button",
|
|
@@ -4760,6 +4772,8 @@ function MultiSelectFilter({
|
|
|
4760
4772
|
hints,
|
|
4761
4773
|
note,
|
|
4762
4774
|
hideCaption = false,
|
|
4775
|
+
size = "md",
|
|
4776
|
+
inlineCaption = false,
|
|
4763
4777
|
max,
|
|
4764
4778
|
maxReason,
|
|
4765
4779
|
className,
|
|
@@ -4768,6 +4782,7 @@ function MultiSelectFilter({
|
|
|
4768
4782
|
const groupLeaves = (g) => g.children.length ? g.children : [{ id: g.id, label: g.label }];
|
|
4769
4783
|
const leafOptions = groups ? groups.flatMap(groupLeaves) : options;
|
|
4770
4784
|
const showSearch = searchable ?? leafOptions.length > SEARCH_AFTER;
|
|
4785
|
+
const sm = size === "sm";
|
|
4771
4786
|
const [open, setOpen] = useState15(false);
|
|
4772
4787
|
const [q, setQ] = useState15("");
|
|
4773
4788
|
const [draft, setDraft] = useState15(selected);
|
|
@@ -4887,14 +4902,24 @@ function MultiSelectFilter({
|
|
|
4887
4902
|
type: "button",
|
|
4888
4903
|
onClick: () => open ? close() : openTray(),
|
|
4889
4904
|
"aria-expanded": open,
|
|
4890
|
-
"aria-label": hideCaption ? caption : void 0,
|
|
4905
|
+
"aria-label": sm && !inlineCaption || !sm && hideCaption ? caption : void 0,
|
|
4891
4906
|
"data-testid": testIdPrefix && `${testIdPrefix}-trigger`,
|
|
4892
4907
|
className: cn(
|
|
4893
|
-
hideCaption ? "flex h-10 items-center gap-2 rounded-control border border-border-strong bg-input pl-3 pr-2.5 text-sm font-medium text-text-primary transition-colors hover:bg-subtle focus-visible:outline-solid focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-border-focus" : chipTriggerClass(variant),
|
|
4908
|
+
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),
|
|
4894
4909
|
fullWidth && "w-full justify-between"
|
|
4895
4910
|
),
|
|
4896
4911
|
children: [
|
|
4897
|
-
|
|
4912
|
+
sm ? /* @__PURE__ */ jsxs41("span", { className: "flex items-center gap-1.5", children: [
|
|
4913
|
+
icon && /* @__PURE__ */ jsx45("span", { className: "shrink-0 text-text-tertiary", children: icon }),
|
|
4914
|
+
inlineCaption ? /* @__PURE__ */ jsxs41("span", { children: [
|
|
4915
|
+
/* @__PURE__ */ jsxs41("span", { className: "font-normal text-text-secondary", children: [
|
|
4916
|
+
caption,
|
|
4917
|
+
":"
|
|
4918
|
+
] }),
|
|
4919
|
+
" ",
|
|
4920
|
+
value
|
|
4921
|
+
] }) : value
|
|
4922
|
+
] }) : hideCaption ? /* @__PURE__ */ jsxs41("span", { className: "flex items-center gap-2", children: [
|
|
4898
4923
|
icon && /* @__PURE__ */ jsx45("span", { className: "shrink-0 text-text-tertiary", children: icon }),
|
|
4899
4924
|
value
|
|
4900
4925
|
] }) : /* @__PURE__ */ jsx45(ChipContent, { caption, value, icon }),
|
|
@@ -5444,8 +5469,8 @@ function Drawer({ open, onClose, title, description, size = "sm", footer, childr
|
|
|
5444
5469
|
}
|
|
5445
5470
|
|
|
5446
5471
|
// src/DataTable.tsx
|
|
5447
|
-
import { Fragment as
|
|
5448
|
-
import { ChevronRight as
|
|
5472
|
+
import { Fragment as Fragment8, useEffect as useEffect19, useId as useId11, useLayoutEffect as useLayoutEffect7, useRef as useRef21, useState as useState20 } from "react";
|
|
5473
|
+
import { ChevronRight as ChevronRight7 } from "lucide-react";
|
|
5449
5474
|
|
|
5450
5475
|
// src/numbers.ts
|
|
5451
5476
|
var US = { units: ["K", "M", "B", "T"] };
|
|
@@ -5581,13 +5606,347 @@ function StickyBar({ children, className, testIdPrefix }) {
|
|
|
5581
5606
|
);
|
|
5582
5607
|
}
|
|
5583
5608
|
|
|
5609
|
+
// src/DataTableHeaderMenu.tsx
|
|
5610
|
+
import { useCallback as useCallback5, useEffect as useEffect18, useId as useId10, useLayoutEffect as useLayoutEffect6, useRef as useRef20, useState as useState19 } from "react";
|
|
5611
|
+
import { createPortal as createPortal9 } from "react-dom";
|
|
5612
|
+
import { Check as Check10, ChevronDown as ChevronDown11 } from "lucide-react";
|
|
5613
|
+
|
|
5614
|
+
// src/Menu.tsx
|
|
5615
|
+
import { forwardRef as forwardRef10 } from "react";
|
|
5616
|
+
import { Slot as Slot2, Slottable } from "@radix-ui/react-slot";
|
|
5617
|
+
import { Check as Check9, ChevronRight as ChevronRight6 } from "lucide-react";
|
|
5618
|
+
import { jsx as jsx56, jsxs as jsxs49 } from "react/jsx-runtime";
|
|
5619
|
+
var ROW_SELECTOR = '[role^="menuitem"]:not([aria-disabled="true"]):not(:disabled)';
|
|
5620
|
+
function moveFocus(e) {
|
|
5621
|
+
const keys = ["ArrowDown", "ArrowUp", "Home", "End"];
|
|
5622
|
+
if (!keys.includes(e.key)) return;
|
|
5623
|
+
const rows = Array.from(e.currentTarget.querySelectorAll(ROW_SELECTOR));
|
|
5624
|
+
if (!rows.length) return;
|
|
5625
|
+
e.preventDefault();
|
|
5626
|
+
const i = rows.indexOf(document.activeElement);
|
|
5627
|
+
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;
|
|
5628
|
+
rows[next].focus();
|
|
5629
|
+
}
|
|
5630
|
+
var Menu = forwardRef10(
|
|
5631
|
+
({ className, testIdPrefix, onKeyDown, children, ...props }, ref) => /* @__PURE__ */ jsx56(
|
|
5632
|
+
"div",
|
|
5633
|
+
{
|
|
5634
|
+
ref,
|
|
5635
|
+
role: "menu",
|
|
5636
|
+
"data-testid": testIdPrefix,
|
|
5637
|
+
onKeyDown: (e) => {
|
|
5638
|
+
moveFocus(e);
|
|
5639
|
+
onKeyDown?.(e);
|
|
5640
|
+
},
|
|
5641
|
+
className: cn("flex flex-col p-1", className),
|
|
5642
|
+
...props,
|
|
5643
|
+
children
|
|
5644
|
+
}
|
|
5645
|
+
)
|
|
5646
|
+
);
|
|
5647
|
+
Menu.displayName = "Menu";
|
|
5648
|
+
var MenuItem = forwardRef10(
|
|
5649
|
+
({ className, testIdPrefix, icon, trailing, description, submenu, checked, danger, disabled, asChild = false, children, ...props }, ref) => {
|
|
5650
|
+
const Comp = asChild ? Slot2 : "button";
|
|
5651
|
+
const radio = checked !== void 0;
|
|
5652
|
+
return /* @__PURE__ */ jsxs49(
|
|
5653
|
+
Comp,
|
|
5654
|
+
{
|
|
5655
|
+
ref,
|
|
5656
|
+
type: asChild ? void 0 : "button",
|
|
5657
|
+
role: radio ? "menuitemradio" : "menuitem",
|
|
5658
|
+
"aria-checked": radio ? checked : void 0,
|
|
5659
|
+
"aria-haspopup": submenu ? "menu" : void 0,
|
|
5660
|
+
"aria-disabled": disabled || void 0,
|
|
5661
|
+
disabled: asChild ? void 0 : disabled,
|
|
5662
|
+
tabIndex: -1,
|
|
5663
|
+
"data-testid": testIdPrefix,
|
|
5664
|
+
className: cn(
|
|
5665
|
+
"flex min-h-9 w-full items-center gap-2.5 rounded-control px-3 py-1.5 text-left text-sm transition-colors",
|
|
5666
|
+
"focus-visible:outline-solid focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-border-focus",
|
|
5667
|
+
danger ? "text-text-danger" : "text-text-primary",
|
|
5668
|
+
disabled ? "cursor-not-allowed opacity-40" : "hover:bg-subtle focus-visible:bg-subtle",
|
|
5669
|
+
className
|
|
5670
|
+
),
|
|
5671
|
+
...props,
|
|
5672
|
+
children: [
|
|
5673
|
+
icon && /* @__PURE__ */ jsx56("span", { "aria-hidden": "true", className: cn("flex shrink-0", danger ? "text-text-danger" : "text-text-secondary"), children: icon }),
|
|
5674
|
+
asChild ? (
|
|
5675
|
+
// The link's own text lands here; the link becomes the row.
|
|
5676
|
+
/* @__PURE__ */ jsx56(Slottable, { children })
|
|
5677
|
+
) : /* @__PURE__ */ jsxs49("span", { className: "min-w-0 flex-1", children: [
|
|
5678
|
+
/* @__PURE__ */ jsx56("span", { className: "block truncate", children }),
|
|
5679
|
+
description && /* @__PURE__ */ jsx56("span", { className: "block truncate text-xs text-text-tertiary", children: description })
|
|
5680
|
+
] }),
|
|
5681
|
+
trailing && /* @__PURE__ */ jsx56("span", { className: "ml-auto flex shrink-0 items-center text-xs text-text-secondary", children: trailing }),
|
|
5682
|
+
radio && checked && /* @__PURE__ */ jsx56(Check9, { size: 16, "aria-hidden": "true", className: "shrink-0 text-brand-primaryAction" }),
|
|
5683
|
+
submenu && /* @__PURE__ */ jsx56(ChevronRight6, { size: 16, "aria-hidden": "true", className: "shrink-0 text-text-secondary" })
|
|
5684
|
+
]
|
|
5685
|
+
}
|
|
5686
|
+
);
|
|
5687
|
+
}
|
|
5688
|
+
);
|
|
5689
|
+
MenuItem.displayName = "MenuItem";
|
|
5690
|
+
function MenuLabel({ className, testIdPrefix, id, children }) {
|
|
5691
|
+
return /* @__PURE__ */ jsx56(
|
|
5692
|
+
"div",
|
|
5693
|
+
{
|
|
5694
|
+
id,
|
|
5695
|
+
role: "presentation",
|
|
5696
|
+
"data-testid": testIdPrefix,
|
|
5697
|
+
className: cn("px-3 pb-1 pt-2 text-micro font-semibold uppercase tracking-wide text-text-tertiary", className),
|
|
5698
|
+
children
|
|
5699
|
+
}
|
|
5700
|
+
);
|
|
5701
|
+
}
|
|
5702
|
+
function MenuSeparator({ className, testIdPrefix }) {
|
|
5703
|
+
return /* @__PURE__ */ jsx56("div", { role: "separator", "data-testid": testIdPrefix, className: cn("-mx-1 my-1 border-t border-border-default", className) });
|
|
5704
|
+
}
|
|
5705
|
+
|
|
5706
|
+
// src/DataTableHeaderMenu.tsx
|
|
5707
|
+
import { Fragment as Fragment7, jsx as jsx57, jsxs as jsxs50 } from "react/jsx-runtime";
|
|
5708
|
+
function RadioSection({
|
|
5709
|
+
label,
|
|
5710
|
+
rows,
|
|
5711
|
+
value,
|
|
5712
|
+
onPick,
|
|
5713
|
+
first,
|
|
5714
|
+
testId
|
|
5715
|
+
}) {
|
|
5716
|
+
const id = useId10();
|
|
5717
|
+
const enabled = rows.filter((r) => !r.disabled);
|
|
5718
|
+
const tabStop = enabled.some((r) => r.id === value) ? value : enabled[0]?.id;
|
|
5719
|
+
const onKey = (e) => {
|
|
5720
|
+
const keys = ["ArrowDown", "ArrowUp", "ArrowRight", "ArrowLeft", "Home", "End"];
|
|
5721
|
+
if (!keys.includes(e.key) || enabled.length === 0) return;
|
|
5722
|
+
e.preventDefault();
|
|
5723
|
+
const i = Math.max(0, enabled.findIndex((r) => r.id === value));
|
|
5724
|
+
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;
|
|
5725
|
+
onPick(enabled[next].id);
|
|
5726
|
+
const el = e.currentTarget.querySelectorAll('[role="radio"]:not([aria-disabled="true"])')[next];
|
|
5727
|
+
el?.focus();
|
|
5728
|
+
};
|
|
5729
|
+
return /* @__PURE__ */ jsxs50(Fragment7, { children: [
|
|
5730
|
+
/* @__PURE__ */ jsx57(MenuLabel, { id, children: label }),
|
|
5731
|
+
/* @__PURE__ */ jsx57("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) => {
|
|
5732
|
+
const checked = r.id === value;
|
|
5733
|
+
return /* @__PURE__ */ jsxs50(
|
|
5734
|
+
"button",
|
|
5735
|
+
{
|
|
5736
|
+
type: "button",
|
|
5737
|
+
role: "radio",
|
|
5738
|
+
"aria-checked": checked,
|
|
5739
|
+
"aria-disabled": r.disabled || void 0,
|
|
5740
|
+
tabIndex: r.id === tabStop ? 0 : -1,
|
|
5741
|
+
onClick: () => !r.disabled && onPick(r.id),
|
|
5742
|
+
className: cn(
|
|
5743
|
+
// MenuItem's row: 36px, 14px, inset and rounded, the tick on the right.
|
|
5744
|
+
"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",
|
|
5745
|
+
"focus-visible:outline-solid focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-border-focus",
|
|
5746
|
+
r.disabled ? "cursor-not-allowed opacity-40" : "hover:bg-subtle focus-visible:bg-subtle"
|
|
5747
|
+
),
|
|
5748
|
+
children: [
|
|
5749
|
+
/* @__PURE__ */ jsx57("span", { className: "min-w-0 flex-1 truncate", children: r.label }),
|
|
5750
|
+
checked && /* @__PURE__ */ jsx57(Check10, { size: 16, "aria-hidden": "true", className: "shrink-0 text-brand-primaryAction" })
|
|
5751
|
+
]
|
|
5752
|
+
},
|
|
5753
|
+
r.id ?? "__none"
|
|
5754
|
+
);
|
|
5755
|
+
}) })
|
|
5756
|
+
] });
|
|
5757
|
+
}
|
|
5758
|
+
function HeaderMenuTrigger({
|
|
5759
|
+
menu,
|
|
5760
|
+
columnLabel,
|
|
5761
|
+
sortDir,
|
|
5762
|
+
onSort,
|
|
5763
|
+
testId
|
|
5764
|
+
}) {
|
|
5765
|
+
const [open, setOpen] = useState19(false);
|
|
5766
|
+
const [pos, setPos] = useState19(null);
|
|
5767
|
+
const trigger = useRef20(null);
|
|
5768
|
+
const panel = useRef20(null);
|
|
5769
|
+
const { groupBy, breakOutBy } = menu;
|
|
5770
|
+
const groupLabel = groupBy.options.find((o) => o.id === groupBy.value)?.label ?? "";
|
|
5771
|
+
const breakLabel = breakOutBy?.value != null ? breakOutBy.options.find((o) => o.id === breakOutBy.value)?.label : void 0;
|
|
5772
|
+
const [draftGroup, setDraftGroup] = useState19(groupBy.value);
|
|
5773
|
+
const [draftBreak, setDraftBreak] = useState19(breakOutBy?.value ?? null);
|
|
5774
|
+
const [draftSort, setDraftSort] = useState19(sortDir);
|
|
5775
|
+
const openPanel = () => {
|
|
5776
|
+
setDraftGroup(groupBy.value);
|
|
5777
|
+
setDraftBreak(breakOutBy?.value ?? null);
|
|
5778
|
+
setDraftSort(sortDir);
|
|
5779
|
+
setOpen(true);
|
|
5780
|
+
};
|
|
5781
|
+
const close = useCallback5((refocus) => {
|
|
5782
|
+
setOpen(false);
|
|
5783
|
+
if (refocus) trigger.current?.focus();
|
|
5784
|
+
}, []);
|
|
5785
|
+
const apply = () => {
|
|
5786
|
+
if (draftGroup !== groupBy.value) groupBy.onChange(draftGroup);
|
|
5787
|
+
if (breakOutBy && draftBreak !== breakOutBy.value) breakOutBy.onChange(draftBreak);
|
|
5788
|
+
if (onSort && draftSort && draftSort !== sortDir) onSort(draftSort);
|
|
5789
|
+
close(true);
|
|
5790
|
+
};
|
|
5791
|
+
const place = useCallback5(() => {
|
|
5792
|
+
const t = trigger.current;
|
|
5793
|
+
if (!t) return;
|
|
5794
|
+
const r = t.getBoundingClientRect();
|
|
5795
|
+
const h = panel.current?.offsetHeight ?? 0;
|
|
5796
|
+
const above = r.bottom + 4 + h > window.innerHeight && r.top - 4 - h > 0;
|
|
5797
|
+
setPos({ top: above ? r.top - 4 - h : r.bottom + 4, left: r.left });
|
|
5798
|
+
}, []);
|
|
5799
|
+
useLayoutEffect6(() => {
|
|
5800
|
+
if (open) place();
|
|
5801
|
+
else setPos(null);
|
|
5802
|
+
}, [open, place]);
|
|
5803
|
+
const placed = pos !== null;
|
|
5804
|
+
useEffect18(() => {
|
|
5805
|
+
if (open && placed) panel.current?.querySelector('[data-first-group] [tabindex="0"]')?.focus();
|
|
5806
|
+
}, [open, placed]);
|
|
5807
|
+
useEffect18(() => {
|
|
5808
|
+
if (!open) return void 0;
|
|
5809
|
+
const onDown = (e) => {
|
|
5810
|
+
const t = e.target;
|
|
5811
|
+
if (trigger.current?.contains(t) || panel.current?.contains(t)) return;
|
|
5812
|
+
close(false);
|
|
5813
|
+
};
|
|
5814
|
+
window.addEventListener("mousedown", onDown);
|
|
5815
|
+
window.addEventListener("resize", place);
|
|
5816
|
+
window.addEventListener("scroll", place, true);
|
|
5817
|
+
return () => {
|
|
5818
|
+
window.removeEventListener("mousedown", onDown);
|
|
5819
|
+
window.removeEventListener("resize", place);
|
|
5820
|
+
window.removeEventListener("scroll", place, true);
|
|
5821
|
+
};
|
|
5822
|
+
}, [open, close, place]);
|
|
5823
|
+
const onTriggerKey = (e) => {
|
|
5824
|
+
if (e.key === "ArrowDown" && !open) {
|
|
5825
|
+
e.preventDefault();
|
|
5826
|
+
openPanel();
|
|
5827
|
+
}
|
|
5828
|
+
};
|
|
5829
|
+
const onPanelKey = (e) => {
|
|
5830
|
+
if (e.key === "Escape") {
|
|
5831
|
+
e.preventDefault();
|
|
5832
|
+
e.stopPropagation();
|
|
5833
|
+
close(true);
|
|
5834
|
+
return;
|
|
5835
|
+
}
|
|
5836
|
+
if (e.key === "Tab") {
|
|
5837
|
+
const stops = [...e.currentTarget.querySelectorAll('[tabindex="0"], button:not([tabindex])')];
|
|
5838
|
+
const at = stops.indexOf(document.activeElement);
|
|
5839
|
+
if (e.shiftKey && at === 0 || !e.shiftKey && at === stops.length - 1) {
|
|
5840
|
+
e.preventDefault();
|
|
5841
|
+
close(true);
|
|
5842
|
+
}
|
|
5843
|
+
}
|
|
5844
|
+
};
|
|
5845
|
+
const pickGroup = (id) => {
|
|
5846
|
+
setDraftGroup(id);
|
|
5847
|
+
if (draftBreak === id) setDraftBreak(null);
|
|
5848
|
+
};
|
|
5849
|
+
return /* @__PURE__ */ jsxs50(Fragment7, { children: [
|
|
5850
|
+
/* @__PURE__ */ jsxs50(
|
|
5851
|
+
"button",
|
|
5852
|
+
{
|
|
5853
|
+
ref: trigger,
|
|
5854
|
+
type: "button",
|
|
5855
|
+
"aria-haspopup": "dialog",
|
|
5856
|
+
"aria-expanded": open,
|
|
5857
|
+
"data-testid": testId,
|
|
5858
|
+
onClick: () => open ? close(false) : openPanel(),
|
|
5859
|
+
onKeyDown: onTriggerKey,
|
|
5860
|
+
className: cn(
|
|
5861
|
+
// Restores the header row's uppercase: a <button> doesn't inherit
|
|
5862
|
+
// text-transform (see SortButton). The negative margin keeps the
|
|
5863
|
+
// label lined up with the names under it while the hover fill
|
|
5864
|
+
// reaches past it.
|
|
5865
|
+
"-mx-1.5 -my-1 inline-flex items-center gap-1 rounded-control px-1.5 py-1 uppercase transition-colors",
|
|
5866
|
+
"hover:bg-border-default hover:text-text-primary aria-expanded:bg-border-default aria-expanded:text-text-primary",
|
|
5867
|
+
"focus-visible:outline-solid focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-border-focus"
|
|
5868
|
+
),
|
|
5869
|
+
children: [
|
|
5870
|
+
/* @__PURE__ */ jsxs50("span", { children: [
|
|
5871
|
+
groupLabel,
|
|
5872
|
+
breakLabel && /* @__PURE__ */ jsxs50(Fragment7, { children: [
|
|
5873
|
+
/* @__PURE__ */ jsx57("span", { "aria-hidden": "true", className: "text-text-tertiary", children: " \u203A " }),
|
|
5874
|
+
/* @__PURE__ */ jsx57("span", { className: "sr-only", children: " then " }),
|
|
5875
|
+
breakLabel
|
|
5876
|
+
] })
|
|
5877
|
+
] }),
|
|
5878
|
+
/* @__PURE__ */ jsx57(ChevronDown11, { size: 12, "aria-hidden": "true", className: cn("shrink-0 transition-transform motion-reduce:transition-none", open && "rotate-180") })
|
|
5879
|
+
]
|
|
5880
|
+
}
|
|
5881
|
+
),
|
|
5882
|
+
open && createPortal9(
|
|
5883
|
+
/* @__PURE__ */ jsxs50(
|
|
5884
|
+
"div",
|
|
5885
|
+
{
|
|
5886
|
+
ref: panel,
|
|
5887
|
+
role: "dialog",
|
|
5888
|
+
"aria-label": columnLabel,
|
|
5889
|
+
"data-testid": testId && `${testId}-menu`,
|
|
5890
|
+
onKeyDown: onPanelKey,
|
|
5891
|
+
style: { position: "fixed", top: pos?.top ?? 0, left: pos?.left ?? 0, visibility: pos ? void 0 : "hidden" },
|
|
5892
|
+
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",
|
|
5893
|
+
children: [
|
|
5894
|
+
/* @__PURE__ */ jsxs50("div", { className: "flex min-h-0 flex-col overflow-y-auto p-1", children: [
|
|
5895
|
+
/* @__PURE__ */ jsx57(
|
|
5896
|
+
RadioSection,
|
|
5897
|
+
{
|
|
5898
|
+
first: true,
|
|
5899
|
+
label: groupBy.label ?? "Group rows by",
|
|
5900
|
+
rows: groupBy.options,
|
|
5901
|
+
value: draftGroup,
|
|
5902
|
+
onPick: pickGroup
|
|
5903
|
+
}
|
|
5904
|
+
),
|
|
5905
|
+
breakOutBy && /* @__PURE__ */ jsxs50(Fragment7, { children: [
|
|
5906
|
+
/* @__PURE__ */ jsx57(MenuSeparator, {}),
|
|
5907
|
+
/* @__PURE__ */ jsx57(
|
|
5908
|
+
RadioSection,
|
|
5909
|
+
{
|
|
5910
|
+
label: breakOutBy.label ?? "Then break out by",
|
|
5911
|
+
rows: [{ id: null, label: "None" }, ...breakOutBy.options.map((o) => ({ ...o, disabled: o.id === draftGroup }))],
|
|
5912
|
+
value: draftBreak,
|
|
5913
|
+
onPick: setDraftBreak
|
|
5914
|
+
}
|
|
5915
|
+
)
|
|
5916
|
+
] }),
|
|
5917
|
+
onSort && /* @__PURE__ */ jsxs50(Fragment7, { children: [
|
|
5918
|
+
/* @__PURE__ */ jsx57(MenuSeparator, {}),
|
|
5919
|
+
/* @__PURE__ */ jsx57(
|
|
5920
|
+
RadioSection,
|
|
5921
|
+
{
|
|
5922
|
+
label: "Sort",
|
|
5923
|
+
rows: [
|
|
5924
|
+
{ id: "asc", label: "A to Z" },
|
|
5925
|
+
{ id: "desc", label: "Z to A" }
|
|
5926
|
+
],
|
|
5927
|
+
value: draftSort ?? void 0,
|
|
5928
|
+
onPick: setDraftSort
|
|
5929
|
+
}
|
|
5930
|
+
)
|
|
5931
|
+
] })
|
|
5932
|
+
] }),
|
|
5933
|
+
/* @__PURE__ */ jsx57(FilterDropdownFooter, { onCancel: () => close(true), onApply: apply })
|
|
5934
|
+
]
|
|
5935
|
+
}
|
|
5936
|
+
),
|
|
5937
|
+
document.body
|
|
5938
|
+
)
|
|
5939
|
+
] });
|
|
5940
|
+
}
|
|
5941
|
+
|
|
5584
5942
|
// src/DataTable.tsx
|
|
5585
|
-
import { Fragment as
|
|
5943
|
+
import { Fragment as Fragment9, jsx as jsx58, jsxs as jsxs51 } from "react/jsx-runtime";
|
|
5586
5944
|
var WIDTH3 = { fill: "", sm: "w-24", md: "w-36", lg: "w-48" };
|
|
5587
5945
|
var MAX_H = { sm: "max-h-80", md: "max-h-120", lg: "max-h-160" };
|
|
5588
5946
|
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)]";
|
|
5589
5947
|
var HEAD_PAD = { default: "px-4 py-3", compact: "px-3 py-2" };
|
|
5590
5948
|
var CELL_PAD = { default: "px-4 py-3.5", compact: "px-3 py-2" };
|
|
5949
|
+
var EXPAND_PAD = "px-2";
|
|
5591
5950
|
var SUB_INDENT = { default: "pl-10", compact: "pl-9" };
|
|
5592
5951
|
var TINT = "bg-brand-primaryTint";
|
|
5593
5952
|
var TINT_HOVER = "group-hover/row:bg-linear-to-r group-hover/row:from-brand-primaryAction/10 group-hover/row:to-brand-primaryAction/10";
|
|
@@ -5603,7 +5962,7 @@ function isDev() {
|
|
|
5603
5962
|
return false;
|
|
5604
5963
|
}
|
|
5605
5964
|
}
|
|
5606
|
-
var useBrowserLayoutEffect = typeof window === "undefined" ?
|
|
5965
|
+
var useBrowserLayoutEffect = typeof window === "undefined" ? useEffect19 : useLayoutEffect7;
|
|
5607
5966
|
function rowClickCounts(e) {
|
|
5608
5967
|
if (e.target.closest(OWN_CLICK)) return false;
|
|
5609
5968
|
const sel = window.getSelection?.();
|
|
@@ -5611,13 +5970,13 @@ function rowClickCounts(e) {
|
|
|
5611
5970
|
return true;
|
|
5612
5971
|
}
|
|
5613
5972
|
function NoValue({ reason = "No data" }) {
|
|
5614
|
-
return /* @__PURE__ */
|
|
5615
|
-
/* @__PURE__ */
|
|
5616
|
-
/* @__PURE__ */
|
|
5973
|
+
return /* @__PURE__ */ jsxs51(Tooltip, { label: reason, delay: 300, className: "text-text-tertiary", children: [
|
|
5974
|
+
/* @__PURE__ */ jsx58("span", { "aria-hidden": "true", children: NO_VALUE }),
|
|
5975
|
+
/* @__PURE__ */ jsx58("span", { className: "sr-only", children: reason })
|
|
5617
5976
|
] });
|
|
5618
5977
|
}
|
|
5619
5978
|
function TableLink({ className, ...props }) {
|
|
5620
|
-
return /* @__PURE__ */
|
|
5979
|
+
return /* @__PURE__ */ jsx58(
|
|
5621
5980
|
"a",
|
|
5622
5981
|
{
|
|
5623
5982
|
...props,
|
|
@@ -5674,7 +6033,7 @@ function DataTable({
|
|
|
5674
6033
|
...rest
|
|
5675
6034
|
}) {
|
|
5676
6035
|
const maxHeight = sticky ? void 0 : maxHeightProp;
|
|
5677
|
-
const titleId =
|
|
6036
|
+
const titleId = useId11();
|
|
5678
6037
|
const showSkeleton = useDelayedLoading(loading);
|
|
5679
6038
|
const head = HEAD_PAD[density];
|
|
5680
6039
|
const pad2 = CELL_PAD[density];
|
|
@@ -5687,7 +6046,7 @@ function DataTable({
|
|
|
5687
6046
|
onSortChange?.(cycleSort(shown, key, col?.firstDir ?? (right(col) ? "desc" : "asc"), defaultSort));
|
|
5688
6047
|
};
|
|
5689
6048
|
const clash = !!onRowClick && (!!renderExpandedProp || !!subRowsProp);
|
|
5690
|
-
|
|
6049
|
+
useEffect19(() => {
|
|
5691
6050
|
if (clash && isDev()) {
|
|
5692
6051
|
console.warn("DataTable: pass `onRowClick` or rows that open in place (`renderExpanded`, `subRows`), not both. The row click wins; rows won't open.");
|
|
5693
6052
|
}
|
|
@@ -5698,10 +6057,10 @@ function DataTable({
|
|
|
5698
6057
|
const kids = subRows?.(row);
|
|
5699
6058
|
return kids && kids.length > 0 ? kids : null;
|
|
5700
6059
|
};
|
|
5701
|
-
const [open, setOpen] =
|
|
6060
|
+
const [open, setOpen] = useState20(() => /* @__PURE__ */ new Set());
|
|
5702
6061
|
const visible = rows.map(rowKey);
|
|
5703
6062
|
const resetOn = subRows ? [...visible].sort().join("|") : `${shown?.key}|${shown?.dir}|${visible.join("|")}`;
|
|
5704
|
-
|
|
6063
|
+
useEffect19(() => setOpen(/* @__PURE__ */ new Set()), [resetOn]);
|
|
5705
6064
|
const expandable = (row) => (!!renderExpanded || !!childrenOf(row)) && (canExpand ? canExpand(row) : true);
|
|
5706
6065
|
const anyExpandable = (!!renderExpanded || !!subRows) && rows.some(expandable);
|
|
5707
6066
|
const toggle = (key) => setOpen((prev) => {
|
|
@@ -5722,8 +6081,8 @@ function DataTable({
|
|
|
5722
6081
|
pickable.forEach((k) => allVisible ? next.delete(k) : next.add(k));
|
|
5723
6082
|
setPicked(next);
|
|
5724
6083
|
};
|
|
5725
|
-
const lastPicked =
|
|
5726
|
-
const shiftHeld =
|
|
6084
|
+
const lastPicked = useRef21(null);
|
|
6085
|
+
const shiftHeld = useRef21(false);
|
|
5727
6086
|
const togglePick = (index) => {
|
|
5728
6087
|
const key = visible[index];
|
|
5729
6088
|
const on = !picked.has(key);
|
|
@@ -5740,12 +6099,12 @@ function DataTable({
|
|
|
5740
6099
|
};
|
|
5741
6100
|
const count = selectedCount ?? picked.size;
|
|
5742
6101
|
const barCount = selectable && selectionBar ? count : 0;
|
|
5743
|
-
const scroller =
|
|
5744
|
-
const [pinned, setPinned] =
|
|
5745
|
-
const [scrolled, setScrolled] =
|
|
5746
|
-
const heads =
|
|
5747
|
-
const [lefts, setLefts] =
|
|
5748
|
-
|
|
6102
|
+
const scroller = useRef21(null);
|
|
6103
|
+
const [pinned, setPinned] = useState20(false);
|
|
6104
|
+
const [scrolled, setScrolled] = useState20(false);
|
|
6105
|
+
const heads = useRef21(/* @__PURE__ */ new Map());
|
|
6106
|
+
const [lefts, setLefts] = useState20({});
|
|
6107
|
+
useEffect19(() => {
|
|
5749
6108
|
const el = scroller.current;
|
|
5750
6109
|
if (!el || typeof ResizeObserver === "undefined") return void 0;
|
|
5751
6110
|
const measure = () => {
|
|
@@ -5778,19 +6137,19 @@ function DataTable({
|
|
|
5778
6137
|
part === nameIdx && "max-w-60 border-r border-r-border-default"
|
|
5779
6138
|
) : "";
|
|
5780
6139
|
const pinStyle = (part) => isPinned(part) ? { left: leftOf(part) } : void 0;
|
|
5781
|
-
const edge = (part) => pinned && scrolled && part === nameIdx ? /* @__PURE__ */
|
|
6140
|
+
const edge = (part) => pinned && scrolled && part === nameIdx ? /* @__PURE__ */ jsx58("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;
|
|
5782
6141
|
const span = columns.length + (anyExpandable ? 1 : 0) + (selectable ? 1 : 0);
|
|
5783
|
-
const wrapRef =
|
|
5784
|
-
const theadRef =
|
|
5785
|
-
const cloneRef =
|
|
5786
|
-
const [stuck, setStuck] =
|
|
5787
|
-
const [geom, setGeom] =
|
|
5788
|
-
const [barH, setBarH] =
|
|
5789
|
-
const [scrollPad, setScrollPad] =
|
|
5790
|
-
const [footerStuck, setFooterStuck] =
|
|
5791
|
-
const [scrolledDown, setScrolledDown] =
|
|
5792
|
-
const [animate, setAnimate] =
|
|
5793
|
-
|
|
6142
|
+
const wrapRef = useRef21(null);
|
|
6143
|
+
const theadRef = useRef21(null);
|
|
6144
|
+
const cloneRef = useRef21(null);
|
|
6145
|
+
const [stuck, setStuck] = useState20(false);
|
|
6146
|
+
const [geom, setGeom] = useState20({ cols: [], width: 0, height: 0 });
|
|
6147
|
+
const [barH, setBarH] = useState20(0);
|
|
6148
|
+
const [scrollPad, setScrollPad] = useState20({ top: 0, bottom: 0 });
|
|
6149
|
+
const [footerStuck, setFooterStuck] = useState20(false);
|
|
6150
|
+
const [scrolledDown, setScrolledDown] = useState20(false);
|
|
6151
|
+
const [animate, setAnimate] = useState20(false);
|
|
6152
|
+
useEffect19(() => {
|
|
5794
6153
|
const thead = theadRef.current;
|
|
5795
6154
|
if (!sticky || !thead || typeof ResizeObserver === "undefined") return void 0;
|
|
5796
6155
|
const measure = () => {
|
|
@@ -5839,7 +6198,7 @@ function DataTable({
|
|
|
5839
6198
|
ro?.disconnect();
|
|
5840
6199
|
};
|
|
5841
6200
|
}, [sticky]);
|
|
5842
|
-
|
|
6201
|
+
useEffect19(() => {
|
|
5843
6202
|
const clone = cloneRef.current;
|
|
5844
6203
|
if (!clone) return;
|
|
5845
6204
|
clone.querySelectorAll("button, a[href], input, [tabindex]").forEach((el) => {
|
|
@@ -5850,9 +6209,9 @@ function DataTable({
|
|
|
5850
6209
|
const top = (stickyTop ?? barH) - scrollPad.top;
|
|
5851
6210
|
const renderCell = (c, row) => {
|
|
5852
6211
|
const v = c.cell(row);
|
|
5853
|
-
return v === null || v === void 0 || v === "" ? /* @__PURE__ */
|
|
6212
|
+
return v === null || v === void 0 || v === "" ? /* @__PURE__ */ jsx58(NoValue, { reason: c.missing }) : v;
|
|
5854
6213
|
};
|
|
5855
|
-
const fit = (ci, content) => pinned && ci === nameIdx ? /* @__PURE__ */
|
|
6214
|
+
const fit = (ci, content) => pinned && ci === nameIdx ? /* @__PURE__ */ jsx58(Tooltip, { label: content, whenTruncated: true, delay: 300, className: "block truncate", children: content }) : content;
|
|
5856
6215
|
const colBg = (c, rowBg) => c.highlight ? TINT : rowBg;
|
|
5857
6216
|
const firstPart = selectable ? "select" : anyExpandable ? "expand" : 0;
|
|
5858
6217
|
const ringCls = (part) => onRowClick ? cn(
|
|
@@ -5862,13 +6221,13 @@ function DataTable({
|
|
|
5862
6221
|
part === columns.length - 1 && RING_RIGHT,
|
|
5863
6222
|
pinned && scrolled && part === nameIdx && part !== columns.length - 1 && RING_PAST_EDGE
|
|
5864
6223
|
) : "";
|
|
5865
|
-
const plainRow = (kind, row, key, rowBg, extra) => /* @__PURE__ */
|
|
5866
|
-
selectable && /* @__PURE__ */
|
|
5867
|
-
anyExpandable && /* @__PURE__ */
|
|
6224
|
+
const plainRow = (kind, row, key, rowBg, extra) => /* @__PURE__ */ jsxs51("tr", { id: extra?.id, className: cn("[&:last-child>td]:border-b-0", kind === "total" && "font-semibold"), children: [
|
|
6225
|
+
selectable && /* @__PURE__ */ jsx58("td", { className: cn("border-b border-border-default pr-0", pad2, rowBg, pinCls("select", "body", rowBg)), style: pinStyle("select") }),
|
|
6226
|
+
anyExpandable && /* @__PURE__ */ jsx58("td", { className: cn("border-b border-border-default", pad2, EXPAND_PAD, rowBg, pinCls("expand", "body", rowBg)), style: pinStyle("expand") }),
|
|
5868
6227
|
columns.map((c, ci) => {
|
|
5869
6228
|
const bg = kind === "sub" ? colBg(c, rowBg) : rowBg;
|
|
5870
6229
|
const isName = ci === nameIdx;
|
|
5871
|
-
return /* @__PURE__ */
|
|
6230
|
+
return /* @__PURE__ */ jsxs51(
|
|
5872
6231
|
"td",
|
|
5873
6232
|
{
|
|
5874
6233
|
className: cn(
|
|
@@ -5883,8 +6242,8 @@ function DataTable({
|
|
|
5883
6242
|
),
|
|
5884
6243
|
style: pinStyle(ci),
|
|
5885
6244
|
children: [
|
|
5886
|
-
c.rank || c.lead ? null : isName && kind === "total" ? fit(ci, totalsLabel) : kind === "total" ? /* @__PURE__ */
|
|
5887
|
-
kind === "sub" && isName && rowLabel && extra?.parent !== void 0 && /* @__PURE__ */
|
|
6245
|
+
c.rank || c.lead ? null : isName && kind === "total" ? fit(ci, totalsLabel) : kind === "total" ? /* @__PURE__ */ jsx58(DeltaBoldContext.Provider, { value: true, children: fit(ci, renderCell(c, row)) }) : fit(ci, renderCell(c, row)),
|
|
6246
|
+
kind === "sub" && isName && rowLabel && extra?.parent !== void 0 && /* @__PURE__ */ jsxs51("span", { className: "sr-only", children: [
|
|
5888
6247
|
", in ",
|
|
5889
6248
|
rowLabel(extra.parent)
|
|
5890
6249
|
] }),
|
|
@@ -5895,8 +6254,8 @@ function DataTable({
|
|
|
5895
6254
|
);
|
|
5896
6255
|
})
|
|
5897
6256
|
] }, key);
|
|
5898
|
-
const headRow = (clone) => /* @__PURE__ */
|
|
5899
|
-
selectable && /* @__PURE__ */
|
|
6257
|
+
const headRow = (clone) => /* @__PURE__ */ jsxs51("tr", { className: "bg-subtle text-micro font-semibold uppercase tracking-wider text-text-secondary", children: [
|
|
6258
|
+
selectable && /* @__PURE__ */ jsx58("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__ */ jsx58(
|
|
5900
6259
|
CheckBox,
|
|
5901
6260
|
{
|
|
5902
6261
|
checked: allVisible,
|
|
@@ -5905,14 +6264,14 @@ function DataTable({
|
|
|
5905
6264
|
disabled: pickable.length === 0,
|
|
5906
6265
|
ariaLabel: allVisible ? "Deselect all rows on this page" : "Select all rows on this page"
|
|
5907
6266
|
}
|
|
5908
|
-
) : /* @__PURE__ */
|
|
5909
|
-
anyExpandable && /* @__PURE__ */
|
|
5910
|
-
columns.map((c, ci) => /* @__PURE__ */
|
|
6267
|
+
) : /* @__PURE__ */ jsx58("span", { className: "sr-only", children: "Select" }) }),
|
|
6268
|
+
anyExpandable && /* @__PURE__ */ jsx58("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__ */ jsx58("span", { className: "sr-only", children: "Details" }) }),
|
|
6269
|
+
columns.map((c, ci) => /* @__PURE__ */ jsxs51(
|
|
5911
6270
|
"th",
|
|
5912
6271
|
{
|
|
5913
6272
|
ref: !clone && ci <= nameIdx ? headRef(ci) : void 0,
|
|
5914
6273
|
scope: "col",
|
|
5915
|
-
"aria-sort": c.sortable ? ariaSortFor(shown, c.key) : void 0,
|
|
6274
|
+
"aria-sort": c.sortable || c.headerMenu && onSortChange ? ariaSortFor(shown, c.key) : void 0,
|
|
5916
6275
|
className: cn(
|
|
5917
6276
|
"group/head whitespace-nowrap border-b border-border-default font-semibold",
|
|
5918
6277
|
head,
|
|
@@ -5923,7 +6282,16 @@ function DataTable({
|
|
|
5923
6282
|
),
|
|
5924
6283
|
style: pinStyle(ci),
|
|
5925
6284
|
children: [
|
|
5926
|
-
c.
|
|
6285
|
+
c.headerMenu ? /* @__PURE__ */ jsx58(
|
|
6286
|
+
HeaderMenuTrigger,
|
|
6287
|
+
{
|
|
6288
|
+
menu: c.headerMenu,
|
|
6289
|
+
columnLabel: c.label,
|
|
6290
|
+
sortDir: shown?.key === c.key ? shown.dir : null,
|
|
6291
|
+
onSort: onSortChange ? (dir) => onSortChange({ key: c.key, dir }) : void 0,
|
|
6292
|
+
testId: clone || !testIdPrefix ? void 0 : `${testIdPrefix}-header-menu-${c.key}`
|
|
6293
|
+
}
|
|
6294
|
+
) : c.sortable && onSortChange ? /* @__PURE__ */ jsx58(
|
|
5927
6295
|
SortButton,
|
|
5928
6296
|
{
|
|
5929
6297
|
label: c.label,
|
|
@@ -5934,7 +6302,7 @@ function DataTable({
|
|
|
5934
6302
|
description: c.info,
|
|
5935
6303
|
testIdPrefix: clone ? void 0 : testIdPrefix
|
|
5936
6304
|
}
|
|
5937
|
-
) : c.info ? /* @__PURE__ */
|
|
6305
|
+
) : c.info ? /* @__PURE__ */ jsx58(SortButton, { label: c.label, sortKey: c.key, sortable: false, sort: sortProp(shown), onSort: () => {
|
|
5938
6306
|
}, description: c.info, align: right(c) ? "right" : "left" }) : c.label,
|
|
5939
6307
|
edge(ci)
|
|
5940
6308
|
]
|
|
@@ -5943,19 +6311,19 @@ function DataTable({
|
|
|
5943
6311
|
))
|
|
5944
6312
|
] });
|
|
5945
6313
|
const inside = variant === "chart";
|
|
5946
|
-
const bar = barCount > 0 ? /* @__PURE__ */
|
|
5947
|
-
/* @__PURE__ */
|
|
6314
|
+
const bar = barCount > 0 ? /* @__PURE__ */ jsxs51("div", { className: "flex flex-wrap items-center gap-x-3 gap-y-1 text-dense", children: [
|
|
6315
|
+
/* @__PURE__ */ jsxs51("span", { role: "status", className: "font-medium text-text-primary", children: [
|
|
5948
6316
|
formatCountFull(count),
|
|
5949
6317
|
" selected"
|
|
5950
6318
|
] }),
|
|
5951
|
-
allVisible && totalCount !== void 0 && count < totalCount && onSelectAll && /* @__PURE__ */
|
|
6319
|
+
allVisible && totalCount !== void 0 && count < totalCount && onSelectAll && /* @__PURE__ */ jsxs51(Button, { variant: "link", size: "sm", onClick: onSelectAll, children: [
|
|
5952
6320
|
"Select all ",
|
|
5953
6321
|
formatCountFull(totalCount)
|
|
5954
6322
|
] }),
|
|
5955
6323
|
selectionActions,
|
|
5956
|
-
/* @__PURE__ */
|
|
6324
|
+
/* @__PURE__ */ jsx58(Button, { variant: "link", size: "sm", onClick: () => onSelectedChange?.([]), children: "Clear" })
|
|
5957
6325
|
] }) : null;
|
|
5958
|
-
const scrollArea = /* @__PURE__ */
|
|
6326
|
+
const scrollArea = /* @__PURE__ */ jsx58(
|
|
5959
6327
|
"div",
|
|
5960
6328
|
{
|
|
5961
6329
|
ref: scroller,
|
|
@@ -5964,7 +6332,7 @@ function DataTable({
|
|
|
5964
6332
|
if (cloneRef.current) cloneRef.current.scrollLeft = e.currentTarget.scrollLeft;
|
|
5965
6333
|
},
|
|
5966
6334
|
className: cn("overflow-x-auto", SCROLLBAR, maxHeight && cn("overflow-y-auto", MAX_H[maxHeight])),
|
|
5967
|
-
children: /* @__PURE__ */
|
|
6335
|
+
children: /* @__PURE__ */ jsxs51(
|
|
5968
6336
|
"table",
|
|
5969
6337
|
{
|
|
5970
6338
|
"aria-labelledby": title ? titleId : void 0,
|
|
@@ -5972,12 +6340,12 @@ function DataTable({
|
|
|
5972
6340
|
"aria-busy": loading || refreshing || void 0,
|
|
5973
6341
|
className: "w-full border-separate border-spacing-0 text-left",
|
|
5974
6342
|
children: [
|
|
5975
|
-
/* @__PURE__ */
|
|
5976
|
-
/* @__PURE__ */
|
|
5977
|
-
selectable && /* @__PURE__ */
|
|
5978
|
-
anyExpandable && /* @__PURE__ */
|
|
5979
|
-
columns.map((c) => /* @__PURE__ */
|
|
5980
|
-
] }, i)) : rows.length === 0 ? /* @__PURE__ */
|
|
6343
|
+
/* @__PURE__ */ jsx58("thead", { ref: theadRef, className: cn(maxHeight && "sticky top-0 z-10"), children: headRow(false) }),
|
|
6344
|
+
/* @__PURE__ */ jsx58("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__ */ jsxs51("tr", { "aria-hidden": "true", className: "[&:last-child>td]:border-b-0", children: [
|
|
6345
|
+
selectable && /* @__PURE__ */ jsx58("td", { className: cn("border-b border-border-default", pad2) }),
|
|
6346
|
+
anyExpandable && /* @__PURE__ */ jsx58("td", { className: cn("border-b border-border-default", pad2, EXPAND_PAD) }),
|
|
6347
|
+
columns.map((c) => /* @__PURE__ */ jsx58("td", { className: cn("border-b border-border-default", pad2, align(c)), children: showSkeleton ? /* @__PURE__ */ jsx58(Skeleton, { className: cn("inline-block", right(c) ? "w-12" : "w-2/3") }) : /* @__PURE__ */ jsx58("span", { className: "inline-block h-3" }) }, c.key))
|
|
6348
|
+
] }, i)) : rows.length === 0 ? /* @__PURE__ */ jsx58("tr", { children: /* @__PURE__ */ jsx58("td", { colSpan: span, className: "px-6 py-12", children: empty ?? /* @__PURE__ */ jsx58(NoResultsEmptyState, {}) }) }) : /* @__PURE__ */ jsxs51(Fragment9, { children: [
|
|
5981
6349
|
totalsRow !== void 0 && plainRow("total", totalsRow, "__totals", "bg-subtle"),
|
|
5982
6350
|
rows.map((row, ri) => {
|
|
5983
6351
|
const key = rowKey(row);
|
|
@@ -5992,8 +6360,8 @@ function DataTable({
|
|
|
5992
6360
|
const ticked = picked.has(key);
|
|
5993
6361
|
const label = rowLabel ? rowLabel(row) : "row";
|
|
5994
6362
|
const clickable = !!onRowClick || canOpen;
|
|
5995
|
-
return /* @__PURE__ */
|
|
5996
|
-
/* @__PURE__ */
|
|
6363
|
+
return /* @__PURE__ */ jsxs51(Fragment8, { children: [
|
|
6364
|
+
/* @__PURE__ */ jsxs51(
|
|
5997
6365
|
"tr",
|
|
5998
6366
|
{
|
|
5999
6367
|
onClick: onRowClick ? (e) => rowClickCounts(e) && onRowClick(row) : canOpen ? (e) => rowClickCounts(e) && toggle(key) : void 0,
|
|
@@ -6004,14 +6372,14 @@ function DataTable({
|
|
|
6004
6372
|
// The row's hidden open button has keyboard focus: ring the whole row.
|
|
6005
6373
|
),
|
|
6006
6374
|
children: [
|
|
6007
|
-
selectable && /* @__PURE__ */
|
|
6375
|
+
selectable && /* @__PURE__ */ jsx58(
|
|
6008
6376
|
"td",
|
|
6009
6377
|
{
|
|
6010
6378
|
onPointerDownCapture: (e) => shiftHeld.current = e.shiftKey,
|
|
6011
6379
|
onKeyDownCapture: (e) => shiftHeld.current = e.shiftKey,
|
|
6012
6380
|
className: cn("border-b border-border-default pr-0", pad2, panelOpen && "border-b-0", rowBg, ringCls("select"), pinCls("select", "body", rowBg)),
|
|
6013
6381
|
style: pinStyle("select"),
|
|
6014
|
-
children: reason ? /* @__PURE__ */
|
|
6382
|
+
children: reason ? /* @__PURE__ */ jsx58(Tooltip, { label: reason, delay: 300, className: "inline-flex align-middle", children: /* @__PURE__ */ jsx58(
|
|
6015
6383
|
"button",
|
|
6016
6384
|
{
|
|
6017
6385
|
type: "button",
|
|
@@ -6021,17 +6389,17 @@ function DataTable({
|
|
|
6021
6389
|
"aria-label": `Select ${label}`,
|
|
6022
6390
|
onClick: (e) => e.preventDefault(),
|
|
6023
6391
|
className: "flex cursor-not-allowed rounded-small focus-visible:outline-solid focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-border-focus",
|
|
6024
|
-
children: /* @__PURE__ */
|
|
6392
|
+
children: /* @__PURE__ */ jsx58(CheckBoxBox, { checked: ticked, disabled: true })
|
|
6025
6393
|
}
|
|
6026
|
-
) }) : /* @__PURE__ */
|
|
6394
|
+
) }) : /* @__PURE__ */ jsx58(CheckBox, { checked: ticked, onChange: () => togglePick(ri), ariaLabel: `Select ${label}` })
|
|
6027
6395
|
}
|
|
6028
6396
|
),
|
|
6029
|
-
anyExpandable && /* @__PURE__ */
|
|
6397
|
+
anyExpandable && /* @__PURE__ */ jsx58(
|
|
6030
6398
|
"td",
|
|
6031
6399
|
{
|
|
6032
|
-
className: cn("border-b border-border-default
|
|
6400
|
+
className: cn("border-b border-border-default", pad2, EXPAND_PAD, panelOpen && "border-b-0", rowBg, ringCls("expand"), pinCls("expand", "body", rowBg)),
|
|
6033
6401
|
style: pinStyle("expand"),
|
|
6034
|
-
children: canOpen && /* @__PURE__ */
|
|
6402
|
+
children: canOpen && /* @__PURE__ */ jsx58(
|
|
6035
6403
|
"button",
|
|
6036
6404
|
{
|
|
6037
6405
|
type: "button",
|
|
@@ -6040,8 +6408,8 @@ function DataTable({
|
|
|
6040
6408
|
"aria-label": kids ? `${isOpen ? "Hide" : "Show"} ${kids.length} ${kids.length === 1 ? subRowNoun.one : subRowNoun.other}${rowLabel ? ` under ${rowLabel(row)}` : ""}` : `${isOpen ? "Hide" : "Show"} details${rowLabel ? ` for ${rowLabel(row)}` : ""}`,
|
|
6041
6409
|
onClick: () => toggle(key),
|
|
6042
6410
|
className: "flex size-6 items-center justify-center rounded-control text-text-tertiary hover:text-text-primary focus-visible:outline-solid focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-border-focus",
|
|
6043
|
-
children: /* @__PURE__ */
|
|
6044
|
-
|
|
6411
|
+
children: /* @__PURE__ */ jsx58(
|
|
6412
|
+
ChevronRight7,
|
|
6045
6413
|
{
|
|
6046
6414
|
size: 16,
|
|
6047
6415
|
"aria-hidden": "true",
|
|
@@ -6055,7 +6423,7 @@ function DataTable({
|
|
|
6055
6423
|
columns.map((c, ci) => {
|
|
6056
6424
|
const bg = colBg(c, rowBg);
|
|
6057
6425
|
const opener = !!onRowClick && ci === nameIdx;
|
|
6058
|
-
return /* @__PURE__ */
|
|
6426
|
+
return /* @__PURE__ */ jsxs51(
|
|
6059
6427
|
"td",
|
|
6060
6428
|
{
|
|
6061
6429
|
className: cn(
|
|
@@ -6074,7 +6442,7 @@ function DataTable({
|
|
|
6074
6442
|
fit(ci, renderCell(c, row)),
|
|
6075
6443
|
opener && // The keyboard's and screen reader's way to the row click. It
|
|
6076
6444
|
// stays hidden; while it has focus the whole row takes the ring.
|
|
6077
|
-
/* @__PURE__ */
|
|
6445
|
+
/* @__PURE__ */ jsx58("button", { type: "button", "data-row-open": "", onClick: () => onRowClick(row), className: "sr-only", children: rowClickLabel ? rowClickLabel(row) : `Open ${rowLabel ? rowLabel(row) : "row"}` }),
|
|
6078
6446
|
edge(ci)
|
|
6079
6447
|
]
|
|
6080
6448
|
},
|
|
@@ -6084,7 +6452,7 @@ function DataTable({
|
|
|
6084
6452
|
]
|
|
6085
6453
|
}
|
|
6086
6454
|
),
|
|
6087
|
-
panelOpen && /* @__PURE__ */
|
|
6455
|
+
panelOpen && /* @__PURE__ */ jsx58("tr", { className: "[&:last-child>td]:border-b-0", children: /* @__PURE__ */ jsx58("td", { id: panelId, colSpan: span, className: "border-b border-border-default bg-subtle px-4 pb-4 pl-14", children: renderExpanded(row) }) }),
|
|
6088
6456
|
isOpen && kids?.map(
|
|
6089
6457
|
(child, si) => plainRow("sub", child, `${key}::${rowKey(child)}`, highlightRow?.(child) ? TINT : "bg-subtle", { id: kidIds[si], parent: row })
|
|
6090
6458
|
)
|
|
@@ -6097,7 +6465,7 @@ function DataTable({
|
|
|
6097
6465
|
}
|
|
6098
6466
|
);
|
|
6099
6467
|
const bare = inside || !title && barCount === 0;
|
|
6100
|
-
const frame = /* @__PURE__ */
|
|
6468
|
+
const frame = /* @__PURE__ */ jsxs51(
|
|
6101
6469
|
"div",
|
|
6102
6470
|
{
|
|
6103
6471
|
className: cn(
|
|
@@ -6109,17 +6477,17 @@ function DataTable({
|
|
|
6109
6477
|
),
|
|
6110
6478
|
"data-testid": testIdPrefix,
|
|
6111
6479
|
children: [
|
|
6112
|
-
title && inside && /* @__PURE__ */
|
|
6113
|
-
/* @__PURE__ */
|
|
6114
|
-
/* @__PURE__ */
|
|
6115
|
-
subtitle && /* @__PURE__ */
|
|
6480
|
+
title && inside && /* @__PURE__ */ jsxs51("div", { className: "flex items-start justify-between gap-2 p-card-padding", children: [
|
|
6481
|
+
/* @__PURE__ */ jsxs51("div", { className: "min-w-0", children: [
|
|
6482
|
+
/* @__PURE__ */ jsx58("h3", { id: titleId, className: "text-panel-title font-semibold text-text-primary", children: title }),
|
|
6483
|
+
subtitle && /* @__PURE__ */ jsx58("p", { className: "mt-0.5 text-xs leading-snug text-text-tertiary", children: subtitle })
|
|
6116
6484
|
] }),
|
|
6117
|
-
(bar ?? action) && /* @__PURE__ */
|
|
6485
|
+
(bar ?? action) && /* @__PURE__ */ jsx58("div", { className: "shrink-0 text-text-tertiary", children: bar ?? action })
|
|
6118
6486
|
] }),
|
|
6119
6487
|
sticky ? (
|
|
6120
6488
|
// The copy of the header sticks within this box, so it leaves with the last row.
|
|
6121
|
-
/* @__PURE__ */
|
|
6122
|
-
/* @__PURE__ */
|
|
6489
|
+
/* @__PURE__ */ jsxs51("div", { className: "relative", children: [
|
|
6490
|
+
/* @__PURE__ */ jsx58(
|
|
6123
6491
|
"div",
|
|
6124
6492
|
{
|
|
6125
6493
|
ref: cloneRef,
|
|
@@ -6130,25 +6498,25 @@ function DataTable({
|
|
|
6130
6498
|
},
|
|
6131
6499
|
className: "sticky z-2 overflow-hidden",
|
|
6132
6500
|
style: { top, height: geom.height, marginBottom: -geom.height, visibility: stuck ? "visible" : "hidden" },
|
|
6133
|
-
children: /* @__PURE__ */
|
|
6134
|
-
/* @__PURE__ */
|
|
6135
|
-
/* @__PURE__ */
|
|
6501
|
+
children: /* @__PURE__ */ jsxs51("table", { className: "table-fixed border-separate border-spacing-0 text-left", style: { width: geom.width }, children: [
|
|
6502
|
+
/* @__PURE__ */ jsx58("colgroup", { children: geom.cols.map((w, i) => /* @__PURE__ */ jsx58("col", { style: { width: w } }, i)) }),
|
|
6503
|
+
/* @__PURE__ */ jsx58("thead", { children: headRow(true) })
|
|
6136
6504
|
] })
|
|
6137
6505
|
}
|
|
6138
6506
|
),
|
|
6139
6507
|
scrollArea
|
|
6140
6508
|
] })
|
|
6141
6509
|
) : scrollArea,
|
|
6142
|
-
refreshing && !loading && /* @__PURE__ */
|
|
6143
|
-
/* @__PURE__ */
|
|
6144
|
-
footer && !sticky && /* @__PURE__ */
|
|
6510
|
+
refreshing && !loading && /* @__PURE__ */ jsx58(RefreshLine, {}),
|
|
6511
|
+
/* @__PURE__ */ jsx58(LongWait, { loading, onRetry, className: "mb-3 px-4" }),
|
|
6512
|
+
footer && !sticky && /* @__PURE__ */ jsx58("div", { className: "border-t border-border-default px-4 py-3", children: footer })
|
|
6145
6513
|
]
|
|
6146
6514
|
}
|
|
6147
6515
|
);
|
|
6148
6516
|
const hideFooter = footerStuck && !scrolledDown;
|
|
6149
|
-
const body = sticky ? /* @__PURE__ */
|
|
6517
|
+
const body = sticky ? /* @__PURE__ */ jsxs51("div", { ref: wrapRef, className: cn("flex w-full flex-col", bare && className), children: [
|
|
6150
6518
|
frame,
|
|
6151
|
-
footer && /* @__PURE__ */
|
|
6519
|
+
footer && /* @__PURE__ */ jsx58(
|
|
6152
6520
|
"div",
|
|
6153
6521
|
{
|
|
6154
6522
|
"data-sticky-footer": "",
|
|
@@ -6165,14 +6533,14 @@ function DataTable({
|
|
|
6165
6533
|
)
|
|
6166
6534
|
] }) : frame;
|
|
6167
6535
|
if (bare) return body;
|
|
6168
|
-
return /* @__PURE__ */
|
|
6169
|
-
title ? /* @__PURE__ */
|
|
6536
|
+
return /* @__PURE__ */ jsxs51("section", { "aria-labelledby": title ? titleId : void 0, className: cn("flex w-full flex-col gap-3", className), children: [
|
|
6537
|
+
title ? /* @__PURE__ */ jsx58(SectionHeading, { id: titleId, as: titleAs, title, description: subtitle, actions: bar ?? action }) : /* @__PURE__ */ jsx58("div", { className: "flex justify-end", children: bar }),
|
|
6170
6538
|
body
|
|
6171
6539
|
] });
|
|
6172
6540
|
}
|
|
6173
6541
|
|
|
6174
6542
|
// src/MediaLabel.tsx
|
|
6175
|
-
import { jsx as
|
|
6543
|
+
import { jsx as jsx59 } from "react/jsx-runtime";
|
|
6176
6544
|
var FILL = {
|
|
6177
6545
|
TV: "bg-media-tv",
|
|
6178
6546
|
CTV: "bg-media-ctv",
|
|
@@ -6183,7 +6551,7 @@ var FILL = {
|
|
|
6183
6551
|
Magazine: "bg-media-magazine"
|
|
6184
6552
|
};
|
|
6185
6553
|
function MediaLabel({ type, className, testIdPrefix }) {
|
|
6186
|
-
return /* @__PURE__ */
|
|
6554
|
+
return /* @__PURE__ */ jsx59(
|
|
6187
6555
|
"span",
|
|
6188
6556
|
{
|
|
6189
6557
|
className: cn(
|
|
@@ -6198,10 +6566,10 @@ function MediaLabel({ type, className, testIdPrefix }) {
|
|
|
6198
6566
|
}
|
|
6199
6567
|
|
|
6200
6568
|
// src/SuggestionChip.tsx
|
|
6201
|
-
import { forwardRef as
|
|
6202
|
-
import { jsx as
|
|
6203
|
-
var SuggestionChip =
|
|
6204
|
-
return /* @__PURE__ */
|
|
6569
|
+
import { forwardRef as forwardRef11 } from "react";
|
|
6570
|
+
import { jsx as jsx60 } from "react/jsx-runtime";
|
|
6571
|
+
var SuggestionChip = forwardRef11(function SuggestionChip2({ children, className, testIdPrefix, type = "button", ...props }, ref) {
|
|
6572
|
+
return /* @__PURE__ */ jsx60(
|
|
6205
6573
|
"button",
|
|
6206
6574
|
{
|
|
6207
6575
|
ref,
|
|
@@ -6212,18 +6580,18 @@ var SuggestionChip = forwardRef10(function SuggestionChip2({ children, className
|
|
|
6212
6580
|
"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",
|
|
6213
6581
|
className
|
|
6214
6582
|
),
|
|
6215
|
-
children: /* @__PURE__ */
|
|
6583
|
+
children: /* @__PURE__ */ jsx60("span", { className: "truncate", children })
|
|
6216
6584
|
}
|
|
6217
6585
|
);
|
|
6218
6586
|
});
|
|
6219
6587
|
SuggestionChip.displayName = "SuggestionChip";
|
|
6220
6588
|
|
|
6221
6589
|
// src/ToggleChip.tsx
|
|
6222
|
-
import { forwardRef as
|
|
6223
|
-
import { Check as
|
|
6224
|
-
import { jsx as
|
|
6225
|
-
var ToggleChip =
|
|
6226
|
-
return /* @__PURE__ */
|
|
6590
|
+
import { forwardRef as forwardRef12 } from "react";
|
|
6591
|
+
import { Check as Check11 } from "lucide-react";
|
|
6592
|
+
import { jsx as jsx61, jsxs as jsxs52 } from "react/jsx-runtime";
|
|
6593
|
+
var ToggleChip = forwardRef12(function ToggleChip2({ selected, onChange, children, className, testIdPrefix, type = "button", onClick, ...props }, ref) {
|
|
6594
|
+
return /* @__PURE__ */ jsxs52(
|
|
6227
6595
|
"button",
|
|
6228
6596
|
{
|
|
6229
6597
|
ref,
|
|
@@ -6241,7 +6609,7 @@ var ToggleChip = forwardRef11(function ToggleChip2({ selected, onChange, childre
|
|
|
6241
6609
|
className
|
|
6242
6610
|
),
|
|
6243
6611
|
children: [
|
|
6244
|
-
selected && /* @__PURE__ */
|
|
6612
|
+
selected && /* @__PURE__ */ jsx61(Check11, { size: 14, "aria-hidden": "true", className: "-ml-0.5 shrink-0" }),
|
|
6245
6613
|
children
|
|
6246
6614
|
]
|
|
6247
6615
|
}
|
|
@@ -6250,14 +6618,14 @@ var ToggleChip = forwardRef11(function ToggleChip2({ selected, onChange, childre
|
|
|
6250
6618
|
ToggleChip.displayName = "ToggleChip";
|
|
6251
6619
|
|
|
6252
6620
|
// src/CopyButton.tsx
|
|
6253
|
-
import { forwardRef as
|
|
6254
|
-
import { Check as
|
|
6255
|
-
import { jsx as
|
|
6621
|
+
import { forwardRef as forwardRef13, useEffect as useEffect20, useRef as useRef22, useState as useState21 } from "react";
|
|
6622
|
+
import { Check as Check12, Copy } from "lucide-react";
|
|
6623
|
+
import { jsx as jsx62, jsxs as jsxs53 } from "react/jsx-runtime";
|
|
6256
6624
|
var CONFIRM_MS = 2e3;
|
|
6257
|
-
var CopyButton =
|
|
6258
|
-
const [copied, setCopied] =
|
|
6259
|
-
const timer =
|
|
6260
|
-
|
|
6625
|
+
var CopyButton = forwardRef13(function CopyButton2({ value, label, "aria-label": ariaLabel, size = "xs", className, testIdPrefix }, ref) {
|
|
6626
|
+
const [copied, setCopied] = useState21(false);
|
|
6627
|
+
const timer = useRef22(void 0);
|
|
6628
|
+
useEffect20(() => () => clearTimeout(timer.current), []);
|
|
6261
6629
|
const copy = async () => {
|
|
6262
6630
|
try {
|
|
6263
6631
|
await navigator.clipboard.writeText(typeof value === "function" ? value() : value);
|
|
@@ -6269,8 +6637,8 @@ var CopyButton = forwardRef12(function CopyButton2({ value, label, "aria-label":
|
|
|
6269
6637
|
timer.current = setTimeout(() => setCopied(false), CONFIRM_MS);
|
|
6270
6638
|
};
|
|
6271
6639
|
const iconSize = size === "xs" ? 13 : 15;
|
|
6272
|
-
const icon = copied ? /* @__PURE__ */
|
|
6273
|
-
return /* @__PURE__ */
|
|
6640
|
+
const icon = copied ? /* @__PURE__ */ jsx62(Check12, { size: iconSize, "aria-hidden": "true", className: "shrink-0 text-text-success" }) : /* @__PURE__ */ jsx62(Copy, { size: iconSize, "aria-hidden": "true", className: "shrink-0" });
|
|
6641
|
+
return /* @__PURE__ */ jsxs53(
|
|
6274
6642
|
Button,
|
|
6275
6643
|
{
|
|
6276
6644
|
ref,
|
|
@@ -6284,8 +6652,8 @@ var CopyButton = forwardRef12(function CopyButton2({ value, label, "aria-label":
|
|
|
6284
6652
|
className: cn(!copied && "text-text-secondary", className),
|
|
6285
6653
|
children: [
|
|
6286
6654
|
icon,
|
|
6287
|
-
label && /* @__PURE__ */
|
|
6288
|
-
/* @__PURE__ */
|
|
6655
|
+
label && /* @__PURE__ */ jsx62("span", { children: copied ? "Copied" : label }),
|
|
6656
|
+
/* @__PURE__ */ jsx62("span", { role: "status", className: "sr-only", children: copied ? "Copied" : "" })
|
|
6289
6657
|
]
|
|
6290
6658
|
}
|
|
6291
6659
|
);
|
|
@@ -6294,7 +6662,7 @@ CopyButton.displayName = "CopyButton";
|
|
|
6294
6662
|
|
|
6295
6663
|
// src/InlineMessage.tsx
|
|
6296
6664
|
import { AlertTriangle as AlertTriangle2, CheckCircle2, Info as Info3, X as X8, XCircle } from "lucide-react";
|
|
6297
|
-
import { jsx as
|
|
6665
|
+
import { jsx as jsx63, jsxs as jsxs54 } from "react/jsx-runtime";
|
|
6298
6666
|
var BOX = {
|
|
6299
6667
|
info: "border-brand-primaryAction/30 bg-brand-primaryAction/10",
|
|
6300
6668
|
success: "border-status-success/40 bg-status-success/10",
|
|
@@ -6311,27 +6679,27 @@ var ICON_INK = {
|
|
|
6311
6679
|
var ICON2 = { info: Info3, success: CheckCircle2, warning: AlertTriangle2, danger: XCircle };
|
|
6312
6680
|
function InlineMessage({ tone = "info", title, children, actions, onDismiss, className, testIdPrefix }) {
|
|
6313
6681
|
const Icon = ICON2[tone];
|
|
6314
|
-
return /* @__PURE__ */
|
|
6682
|
+
return /* @__PURE__ */ jsxs54(
|
|
6315
6683
|
"div",
|
|
6316
6684
|
{
|
|
6317
6685
|
role: tone === "warning" || tone === "danger" ? "alert" : "status",
|
|
6318
6686
|
className: cn("flex items-start gap-2.5 rounded-control border px-3 py-2.5 text-sm", BOX[tone], className),
|
|
6319
6687
|
"data-testid": testIdPrefix,
|
|
6320
6688
|
children: [
|
|
6321
|
-
/* @__PURE__ */
|
|
6322
|
-
/* @__PURE__ */
|
|
6323
|
-
/* @__PURE__ */
|
|
6324
|
-
children && /* @__PURE__ */
|
|
6325
|
-
actions && /* @__PURE__ */
|
|
6689
|
+
/* @__PURE__ */ jsx63(Icon, { size: 16, "aria-hidden": "true", className: cn("mt-0.5 shrink-0", ICON_INK[tone]) }),
|
|
6690
|
+
/* @__PURE__ */ jsxs54("div", { className: "min-w-0 flex-1", children: [
|
|
6691
|
+
/* @__PURE__ */ jsx63("p", { className: "font-semibold text-text-primary", children: title }),
|
|
6692
|
+
children && /* @__PURE__ */ jsx63("div", { className: "mt-0.5 text-text-secondary", children }),
|
|
6693
|
+
actions && /* @__PURE__ */ jsx63("div", { className: "mt-2 flex flex-wrap items-center gap-2", children: actions })
|
|
6326
6694
|
] }),
|
|
6327
|
-
onDismiss && /* @__PURE__ */
|
|
6695
|
+
onDismiss && /* @__PURE__ */ jsx63(
|
|
6328
6696
|
"button",
|
|
6329
6697
|
{
|
|
6330
6698
|
type: "button",
|
|
6331
6699
|
onClick: onDismiss,
|
|
6332
6700
|
"aria-label": "Dismiss",
|
|
6333
6701
|
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",
|
|
6334
|
-
children: /* @__PURE__ */
|
|
6702
|
+
children: /* @__PURE__ */ jsx63(X8, { size: 14, "aria-hidden": "true" })
|
|
6335
6703
|
}
|
|
6336
6704
|
)
|
|
6337
6705
|
]
|
|
@@ -6340,9 +6708,9 @@ function InlineMessage({ tone = "info", title, children, actions, onDismiss, cla
|
|
|
6340
6708
|
}
|
|
6341
6709
|
|
|
6342
6710
|
// src/FilterDrawer.tsx
|
|
6343
|
-
import { useEffect as
|
|
6344
|
-
import { ChevronLeft as ChevronLeft5, ChevronRight as
|
|
6345
|
-
import { Fragment as
|
|
6711
|
+
import { useEffect as useEffect21, useLayoutEffect as useLayoutEffect8, useRef as useRef23, useState as useState22 } from "react";
|
|
6712
|
+
import { ChevronLeft as ChevronLeft5, ChevronRight as ChevronRight8 } from "lucide-react";
|
|
6713
|
+
import { Fragment as Fragment10, jsx as jsx64, jsxs as jsxs55 } from "react/jsx-runtime";
|
|
6346
6714
|
var SLIDE_MS = 200;
|
|
6347
6715
|
function reducedMotion() {
|
|
6348
6716
|
return typeof window !== "undefined" && !!window.matchMedia?.("(prefers-reduced-motion: reduce)").matches;
|
|
@@ -6362,12 +6730,12 @@ function FilterDrawer({
|
|
|
6362
6730
|
testIdPrefix
|
|
6363
6731
|
}) {
|
|
6364
6732
|
const marks = (list) => list.map((x) => `${x.id}:${x.count ?? 0}:${x.badge ?? ""}`).join("|");
|
|
6365
|
-
const [openedWith, setOpenedWith] =
|
|
6366
|
-
const [confirming, setConfirming] =
|
|
6367
|
-
const [view, setViewState] =
|
|
6368
|
-
const [leaving, setLeaving] =
|
|
6369
|
-
const [phase, setPhase] =
|
|
6370
|
-
const [wasOpen, setWasOpen] =
|
|
6733
|
+
const [openedWith, setOpenedWith] = useState22(() => marks(sections));
|
|
6734
|
+
const [confirming, setConfirming] = useState22(false);
|
|
6735
|
+
const [view, setViewState] = useState22(focus);
|
|
6736
|
+
const [leaving, setLeaving] = useState22(null);
|
|
6737
|
+
const [phase, setPhase] = useState22("run");
|
|
6738
|
+
const [wasOpen, setWasOpen] = useState22(open);
|
|
6371
6739
|
if (open !== wasOpen) {
|
|
6372
6740
|
setWasOpen(open);
|
|
6373
6741
|
setConfirming(false);
|
|
@@ -6389,20 +6757,20 @@ function FilterDrawer({
|
|
|
6389
6757
|
}
|
|
6390
6758
|
setViewState(next);
|
|
6391
6759
|
};
|
|
6392
|
-
|
|
6760
|
+
useLayoutEffect8(() => {
|
|
6393
6761
|
if (phase !== "start") return;
|
|
6394
6762
|
const raf = requestAnimationFrame(() => requestAnimationFrame(() => setPhase("run")));
|
|
6395
6763
|
return () => cancelAnimationFrame(raf);
|
|
6396
6764
|
}, [phase]);
|
|
6397
|
-
|
|
6765
|
+
useEffect21(() => {
|
|
6398
6766
|
if (!leaving || phase !== "run") return;
|
|
6399
6767
|
const t = setTimeout(() => setLeaving(null), SLIDE_MS);
|
|
6400
6768
|
return () => clearTimeout(t);
|
|
6401
6769
|
}, [leaving, phase]);
|
|
6402
|
-
const backRef =
|
|
6403
|
-
const rowRefs =
|
|
6404
|
-
const lastView =
|
|
6405
|
-
|
|
6770
|
+
const backRef = useRef23(null);
|
|
6771
|
+
const rowRefs = useRef23(/* @__PURE__ */ new Map());
|
|
6772
|
+
const lastView = useRef23(null);
|
|
6773
|
+
useEffect21(() => {
|
|
6406
6774
|
if (!open) return;
|
|
6407
6775
|
if (view) backRef.current?.focus();
|
|
6408
6776
|
else if (lastView.current) rowRefs.current.get(lastView.current)?.focus();
|
|
@@ -6415,8 +6783,8 @@ function FilterDrawer({
|
|
|
6415
6783
|
const outgoing = phase === "start" ? void 0 : dir > 0 ? "translateX(-33%)" : "translateX(100%)";
|
|
6416
6784
|
const panel = (v, rows = true) => {
|
|
6417
6785
|
const s = v ? sections.find((x) => x.id === v) : void 0;
|
|
6418
|
-
if (s) return /* @__PURE__ */
|
|
6419
|
-
return /* @__PURE__ */
|
|
6786
|
+
if (s) return /* @__PURE__ */ jsx64("div", { className: "border-t border-border-default px-5 pt-4", children: renderSection(s.id) });
|
|
6787
|
+
return /* @__PURE__ */ jsx64("ul", { className: "border-t border-border-default", children: sections.map((x) => /* @__PURE__ */ jsx64("li", { className: "border-b border-border-default", children: /* @__PURE__ */ jsxs55(
|
|
6420
6788
|
"button",
|
|
6421
6789
|
{
|
|
6422
6790
|
ref: rows ? (el) => {
|
|
@@ -6428,7 +6796,7 @@ function FilterDrawer({
|
|
|
6428
6796
|
"data-testid": testIdPrefix && `${testIdPrefix}-row-${x.id}`,
|
|
6429
6797
|
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",
|
|
6430
6798
|
children: [
|
|
6431
|
-
/* @__PURE__ */
|
|
6799
|
+
/* @__PURE__ */ jsx64(
|
|
6432
6800
|
x.icon,
|
|
6433
6801
|
{
|
|
6434
6802
|
size: 17,
|
|
@@ -6436,15 +6804,15 @@ function FilterDrawer({
|
|
|
6436
6804
|
className: inUse(x) ? "text-brand-primaryAction" : "text-text-secondary"
|
|
6437
6805
|
}
|
|
6438
6806
|
),
|
|
6439
|
-
/* @__PURE__ */
|
|
6440
|
-
/* @__PURE__ */
|
|
6441
|
-
/* @__PURE__ */
|
|
6807
|
+
/* @__PURE__ */ jsx64("span", { className: "flex-1 text-sm font-medium text-text-primary", children: x.label }),
|
|
6808
|
+
/* @__PURE__ */ jsx64(SectionMark, { section: x }),
|
|
6809
|
+
/* @__PURE__ */ jsx64(ChevronRight8, { size: 16, "aria-hidden": "true", className: "shrink-0 text-text-secondary" })
|
|
6442
6810
|
]
|
|
6443
6811
|
}
|
|
6444
6812
|
) }, x.id)) });
|
|
6445
6813
|
};
|
|
6446
|
-
return /* @__PURE__ */
|
|
6447
|
-
/* @__PURE__ */
|
|
6814
|
+
return /* @__PURE__ */ jsxs55(Fragment10, { children: [
|
|
6815
|
+
/* @__PURE__ */ jsx64(
|
|
6448
6816
|
Modal,
|
|
6449
6817
|
{
|
|
6450
6818
|
open: open && confirming,
|
|
@@ -6453,9 +6821,9 @@ function FilterDrawer({
|
|
|
6453
6821
|
title: "Discard changes?",
|
|
6454
6822
|
description: "Your filter picks haven't been applied.",
|
|
6455
6823
|
testIdPrefix: testIdPrefix && `${testIdPrefix}-discard`,
|
|
6456
|
-
footer: /* @__PURE__ */
|
|
6457
|
-
/* @__PURE__ */
|
|
6458
|
-
/* @__PURE__ */
|
|
6824
|
+
footer: /* @__PURE__ */ jsxs55(Fragment10, { children: [
|
|
6825
|
+
/* @__PURE__ */ jsx64(Button, { variant: "secondary", size: "md", onClick: () => setConfirming(false), children: "Keep editing" }),
|
|
6826
|
+
/* @__PURE__ */ jsx64(
|
|
6459
6827
|
Button,
|
|
6460
6828
|
{
|
|
6461
6829
|
variant: "danger",
|
|
@@ -6470,15 +6838,15 @@ function FilterDrawer({
|
|
|
6470
6838
|
] })
|
|
6471
6839
|
}
|
|
6472
6840
|
),
|
|
6473
|
-
/* @__PURE__ */
|
|
6841
|
+
/* @__PURE__ */ jsx64(
|
|
6474
6842
|
Drawer,
|
|
6475
6843
|
{
|
|
6476
6844
|
open,
|
|
6477
6845
|
onClose: requestClose,
|
|
6478
6846
|
size,
|
|
6479
6847
|
testIdPrefix,
|
|
6480
|
-
title: focused ? /* @__PURE__ */
|
|
6481
|
-
/* @__PURE__ */
|
|
6848
|
+
title: focused ? /* @__PURE__ */ jsxs55("span", { className: "flex items-center gap-1.5", children: [
|
|
6849
|
+
/* @__PURE__ */ jsx64(
|
|
6482
6850
|
"button",
|
|
6483
6851
|
{
|
|
6484
6852
|
ref: backRef,
|
|
@@ -6487,25 +6855,25 @@ function FilterDrawer({
|
|
|
6487
6855
|
"aria-label": "Back to all filters",
|
|
6488
6856
|
"data-testid": testIdPrefix && `${testIdPrefix}-back`,
|
|
6489
6857
|
className: "-ml-1.5 rounded-control p-1 text-text-secondary hover:bg-subtle hover:text-text-primary focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-border-focus",
|
|
6490
|
-
children: /* @__PURE__ */
|
|
6858
|
+
children: /* @__PURE__ */ jsx64(ChevronLeft5, { size: 18, "aria-hidden": "true" })
|
|
6491
6859
|
}
|
|
6492
6860
|
),
|
|
6493
6861
|
focused.label,
|
|
6494
|
-
(focused.count ?? 0) > 0 && /* @__PURE__ */
|
|
6495
|
-
focused.info && /* @__PURE__ */
|
|
6862
|
+
(focused.count ?? 0) > 0 && /* @__PURE__ */ jsx64(CountBadge, { count: focused.count }),
|
|
6863
|
+
focused.info && /* @__PURE__ */ jsx64(InfoTip, { text: focused.info, label: `About ${focused.label}` })
|
|
6496
6864
|
] }) : "Filters",
|
|
6497
6865
|
footer: focused ? (
|
|
6498
6866
|
// Picks are kept as they're made; Apply goes back to the list, and only
|
|
6499
6867
|
// See results, on the list, applies them to the page.
|
|
6500
|
-
/* @__PURE__ */
|
|
6501
|
-
/* @__PURE__ */
|
|
6502
|
-
/* @__PURE__ */
|
|
6868
|
+
/* @__PURE__ */ jsxs55("div", { className: "flex w-full items-center justify-between gap-2", children: [
|
|
6869
|
+
/* @__PURE__ */ jsx64(Button, { variant: "link", size: "md", onClick: () => onClearSection(focused.id), className: "px-0", children: "Clear" }),
|
|
6870
|
+
/* @__PURE__ */ jsx64(Button, { variant: "primary", size: "md", onClick: () => setView(null), testIdPrefix: testIdPrefix && `${testIdPrefix}-apply-section`, children: "Apply" })
|
|
6503
6871
|
] })
|
|
6504
|
-
) : /* @__PURE__ */
|
|
6505
|
-
/* @__PURE__ */
|
|
6506
|
-
/* @__PURE__ */
|
|
6507
|
-
/* @__PURE__ */
|
|
6508
|
-
/* @__PURE__ */
|
|
6872
|
+
) : /* @__PURE__ */ jsxs55("div", { className: "flex w-full items-center justify-between gap-2", children: [
|
|
6873
|
+
/* @__PURE__ */ jsx64(Button, { variant: "link", size: "md", onClick: onClearAll, className: "px-0", children: "Clear all" }),
|
|
6874
|
+
/* @__PURE__ */ jsxs55("div", { className: "flex items-center gap-2", children: [
|
|
6875
|
+
/* @__PURE__ */ jsx64(Button, { variant: "secondary", size: "md", onClick: onClose, children: "Cancel" }),
|
|
6876
|
+
/* @__PURE__ */ jsx64(
|
|
6509
6877
|
Button,
|
|
6510
6878
|
{
|
|
6511
6879
|
variant: "primary",
|
|
@@ -6519,8 +6887,8 @@ function FilterDrawer({
|
|
|
6519
6887
|
)
|
|
6520
6888
|
] })
|
|
6521
6889
|
] }),
|
|
6522
|
-
children: /* @__PURE__ */
|
|
6523
|
-
/* @__PURE__ */
|
|
6890
|
+
children: /* @__PURE__ */ jsxs55("div", { className: "relative -mx-5 overflow-x-clip", children: [
|
|
6891
|
+
/* @__PURE__ */ jsx64(
|
|
6524
6892
|
"div",
|
|
6525
6893
|
{
|
|
6526
6894
|
style: { transform: incoming },
|
|
@@ -6529,7 +6897,7 @@ function FilterDrawer({
|
|
|
6529
6897
|
},
|
|
6530
6898
|
view ?? "__list"
|
|
6531
6899
|
),
|
|
6532
|
-
leaving && /* @__PURE__ */
|
|
6900
|
+
leaving && /* @__PURE__ */ jsx64(
|
|
6533
6901
|
"div",
|
|
6534
6902
|
{
|
|
6535
6903
|
"aria-hidden": "true",
|
|
@@ -6546,22 +6914,22 @@ function FilterDrawer({
|
|
|
6546
6914
|
}
|
|
6547
6915
|
var inUse = (x) => (x.count ?? 0) > 0 || !!x.badge;
|
|
6548
6916
|
function CountBadge({ count }) {
|
|
6549
|
-
return /* @__PURE__ */
|
|
6917
|
+
return /* @__PURE__ */ jsxs55(Badge, { tone: "brandSolid", kind: "count", children: [
|
|
6550
6918
|
count,
|
|
6551
|
-
/* @__PURE__ */
|
|
6919
|
+
/* @__PURE__ */ jsx64("span", { className: "sr-only", children: " selected" })
|
|
6552
6920
|
] });
|
|
6553
6921
|
}
|
|
6554
6922
|
function SectionMark({ section }) {
|
|
6555
|
-
if ((section.count ?? 0) > 0) return /* @__PURE__ */
|
|
6556
|
-
return section.badge ? /* @__PURE__ */
|
|
6923
|
+
if ((section.count ?? 0) > 0) return /* @__PURE__ */ jsx64(CountBadge, { count: section.count });
|
|
6924
|
+
return section.badge ? /* @__PURE__ */ jsx64(Badge, { tone: "brand", children: section.badge }) : null;
|
|
6557
6925
|
}
|
|
6558
6926
|
|
|
6559
6927
|
// src/AllFiltersButton.tsx
|
|
6560
|
-
import { forwardRef as
|
|
6928
|
+
import { forwardRef as forwardRef14 } from "react";
|
|
6561
6929
|
import { SlidersHorizontal } from "lucide-react";
|
|
6562
|
-
import { jsx as
|
|
6563
|
-
var AllFiltersButton =
|
|
6564
|
-
return /* @__PURE__ */
|
|
6930
|
+
import { jsx as jsx65, jsxs as jsxs56 } from "react/jsx-runtime";
|
|
6931
|
+
var AllFiltersButton = forwardRef14(function AllFiltersButton2({ count = 0, open, className, testIdPrefix, ...rest }, ref) {
|
|
6932
|
+
return /* @__PURE__ */ jsxs56(
|
|
6565
6933
|
"button",
|
|
6566
6934
|
{
|
|
6567
6935
|
ref,
|
|
@@ -6573,105 +6941,14 @@ var AllFiltersButton = forwardRef13(function AllFiltersButton2({ count = 0, open
|
|
|
6573
6941
|
className: cn(chipTriggerClass(), className),
|
|
6574
6942
|
...rest,
|
|
6575
6943
|
children: [
|
|
6576
|
-
/* @__PURE__ */
|
|
6577
|
-
/* @__PURE__ */
|
|
6578
|
-
count > 0 && /* @__PURE__ */
|
|
6944
|
+
/* @__PURE__ */ jsx65(SlidersHorizontal, { size: 15, "aria-hidden": "true", className: "text-text-secondary" }),
|
|
6945
|
+
/* @__PURE__ */ jsx65("span", { className: "text-dense font-medium text-text-primary", children: "All filters" }),
|
|
6946
|
+
count > 0 && /* @__PURE__ */ jsx65(Badge, { tone: "brandSolid", kind: "count", children: count })
|
|
6579
6947
|
]
|
|
6580
6948
|
}
|
|
6581
6949
|
);
|
|
6582
6950
|
});
|
|
6583
6951
|
|
|
6584
|
-
// src/Menu.tsx
|
|
6585
|
-
import { forwardRef as forwardRef14 } from "react";
|
|
6586
|
-
import { Slot as Slot2, Slottable } from "@radix-ui/react-slot";
|
|
6587
|
-
import { Check as Check11, ChevronRight as ChevronRight8 } from "lucide-react";
|
|
6588
|
-
import { jsx as jsx64, jsxs as jsxs55 } from "react/jsx-runtime";
|
|
6589
|
-
var ROW_SELECTOR = '[role^="menuitem"]:not([aria-disabled="true"]):not(:disabled)';
|
|
6590
|
-
function moveFocus(e) {
|
|
6591
|
-
const keys = ["ArrowDown", "ArrowUp", "Home", "End"];
|
|
6592
|
-
if (!keys.includes(e.key)) return;
|
|
6593
|
-
const rows = Array.from(e.currentTarget.querySelectorAll(ROW_SELECTOR));
|
|
6594
|
-
if (!rows.length) return;
|
|
6595
|
-
e.preventDefault();
|
|
6596
|
-
const i = rows.indexOf(document.activeElement);
|
|
6597
|
-
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;
|
|
6598
|
-
rows[next].focus();
|
|
6599
|
-
}
|
|
6600
|
-
var Menu = forwardRef14(
|
|
6601
|
-
({ className, testIdPrefix, onKeyDown, children, ...props }, ref) => /* @__PURE__ */ jsx64(
|
|
6602
|
-
"div",
|
|
6603
|
-
{
|
|
6604
|
-
ref,
|
|
6605
|
-
role: "menu",
|
|
6606
|
-
"data-testid": testIdPrefix,
|
|
6607
|
-
onKeyDown: (e) => {
|
|
6608
|
-
moveFocus(e);
|
|
6609
|
-
onKeyDown?.(e);
|
|
6610
|
-
},
|
|
6611
|
-
className: cn("flex flex-col p-1", className),
|
|
6612
|
-
...props,
|
|
6613
|
-
children
|
|
6614
|
-
}
|
|
6615
|
-
)
|
|
6616
|
-
);
|
|
6617
|
-
Menu.displayName = "Menu";
|
|
6618
|
-
var MenuItem = forwardRef14(
|
|
6619
|
-
({ className, testIdPrefix, icon, trailing, description, submenu, checked, danger, disabled, asChild = false, children, ...props }, ref) => {
|
|
6620
|
-
const Comp = asChild ? Slot2 : "button";
|
|
6621
|
-
const radio = checked !== void 0;
|
|
6622
|
-
return /* @__PURE__ */ jsxs55(
|
|
6623
|
-
Comp,
|
|
6624
|
-
{
|
|
6625
|
-
ref,
|
|
6626
|
-
type: asChild ? void 0 : "button",
|
|
6627
|
-
role: radio ? "menuitemradio" : "menuitem",
|
|
6628
|
-
"aria-checked": radio ? checked : void 0,
|
|
6629
|
-
"aria-haspopup": submenu ? "menu" : void 0,
|
|
6630
|
-
"aria-disabled": disabled || void 0,
|
|
6631
|
-
disabled: asChild ? void 0 : disabled,
|
|
6632
|
-
tabIndex: -1,
|
|
6633
|
-
"data-testid": testIdPrefix,
|
|
6634
|
-
className: cn(
|
|
6635
|
-
"flex min-h-9 w-full items-center gap-2.5 rounded-control px-3 py-1.5 text-left text-sm transition-colors",
|
|
6636
|
-
"focus-visible:outline-solid focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-border-focus",
|
|
6637
|
-
danger ? "text-text-danger" : "text-text-primary",
|
|
6638
|
-
disabled ? "cursor-not-allowed opacity-40" : "hover:bg-subtle focus-visible:bg-subtle",
|
|
6639
|
-
className
|
|
6640
|
-
),
|
|
6641
|
-
...props,
|
|
6642
|
-
children: [
|
|
6643
|
-
icon && /* @__PURE__ */ jsx64("span", { "aria-hidden": "true", className: cn("flex shrink-0", danger ? "text-text-danger" : "text-text-secondary"), children: icon }),
|
|
6644
|
-
asChild ? (
|
|
6645
|
-
// The link's own text lands here; the link becomes the row.
|
|
6646
|
-
/* @__PURE__ */ jsx64(Slottable, { children })
|
|
6647
|
-
) : /* @__PURE__ */ jsxs55("span", { className: "min-w-0 flex-1", children: [
|
|
6648
|
-
/* @__PURE__ */ jsx64("span", { className: "block truncate", children }),
|
|
6649
|
-
description && /* @__PURE__ */ jsx64("span", { className: "block truncate text-xs text-text-tertiary", children: description })
|
|
6650
|
-
] }),
|
|
6651
|
-
trailing && /* @__PURE__ */ jsx64("span", { className: "ml-auto flex shrink-0 items-center text-xs text-text-secondary", children: trailing }),
|
|
6652
|
-
radio && checked && /* @__PURE__ */ jsx64(Check11, { size: 16, "aria-hidden": "true", className: "shrink-0 text-brand-primaryAction" }),
|
|
6653
|
-
submenu && /* @__PURE__ */ jsx64(ChevronRight8, { size: 16, "aria-hidden": "true", className: "shrink-0 text-text-secondary" })
|
|
6654
|
-
]
|
|
6655
|
-
}
|
|
6656
|
-
);
|
|
6657
|
-
}
|
|
6658
|
-
);
|
|
6659
|
-
MenuItem.displayName = "MenuItem";
|
|
6660
|
-
function MenuLabel({ className, testIdPrefix, children }) {
|
|
6661
|
-
return /* @__PURE__ */ jsx64(
|
|
6662
|
-
"div",
|
|
6663
|
-
{
|
|
6664
|
-
role: "presentation",
|
|
6665
|
-
"data-testid": testIdPrefix,
|
|
6666
|
-
className: cn("px-3 pb-1 pt-2 text-micro font-semibold uppercase tracking-wide text-text-tertiary", className),
|
|
6667
|
-
children
|
|
6668
|
-
}
|
|
6669
|
-
);
|
|
6670
|
-
}
|
|
6671
|
-
function MenuSeparator({ className, testIdPrefix }) {
|
|
6672
|
-
return /* @__PURE__ */ jsx64("div", { role: "separator", "data-testid": testIdPrefix, className: cn("-mx-1 my-1 border-t border-border-default", className) });
|
|
6673
|
-
}
|
|
6674
|
-
|
|
6675
6952
|
// src/dates.ts
|
|
6676
6953
|
var MONTHS2 = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
|
|
6677
6954
|
var MONTHS_LONG = [
|
|
@@ -6783,15 +7060,15 @@ function defaultDateOrder(country) {
|
|
|
6783
7060
|
}
|
|
6784
7061
|
|
|
6785
7062
|
// src/Figure.tsx
|
|
6786
|
-
import { Fragment as
|
|
7063
|
+
import { Fragment as Fragment11, jsx as jsx66, jsxs as jsxs57 } from "react/jsx-runtime";
|
|
6787
7064
|
function Figure({ value, kind = "money", missing, ...opts }) {
|
|
6788
|
-
if (value === null || value === void 0 || Number.isNaN(value)) return /* @__PURE__ */
|
|
7065
|
+
if (value === null || value === void 0 || Number.isNaN(value)) return /* @__PURE__ */ jsx66(NoValue, { reason: missing });
|
|
6789
7066
|
const short = kind === "money" ? formatMoney(value, opts) : formatCount(value, opts);
|
|
6790
7067
|
const full = kind === "money" ? formatMoneyFull(value, opts) : formatCountFull(value);
|
|
6791
|
-
if (short === full) return /* @__PURE__ */
|
|
6792
|
-
return /* @__PURE__ */
|
|
6793
|
-
/* @__PURE__ */
|
|
6794
|
-
/* @__PURE__ */
|
|
7068
|
+
if (short === full) return /* @__PURE__ */ jsx66(Fragment11, { children: short });
|
|
7069
|
+
return /* @__PURE__ */ jsxs57(Tooltip, { label: full, delay: 300, children: [
|
|
7070
|
+
/* @__PURE__ */ jsx66("span", { "aria-hidden": "true", children: short }),
|
|
7071
|
+
/* @__PURE__ */ jsx66("span", { className: "sr-only", children: full })
|
|
6795
7072
|
] });
|
|
6796
7073
|
}
|
|
6797
7074
|
export {
|