@mediaradar/design-components 0.64.0 → 0.66.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/approved-components.json +1 -1
- package/dist/index.cjs +551 -293
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +142 -14
- package/dist/index.d.ts +142 -14
- package/dist/index.js +548 -290
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.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,330 @@ 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
|
+
className,
|
|
5715
|
+
testId
|
|
5716
|
+
}) {
|
|
5717
|
+
const id = useId10();
|
|
5718
|
+
const enabled = rows.filter((r) => !r.disabled);
|
|
5719
|
+
const tabStop = enabled.some((r) => r.id === value) ? value : enabled[0]?.id;
|
|
5720
|
+
const onKey = (e) => {
|
|
5721
|
+
const keys = ["ArrowDown", "ArrowUp", "ArrowRight", "ArrowLeft", "Home", "End"];
|
|
5722
|
+
if (!keys.includes(e.key) || enabled.length === 0) return;
|
|
5723
|
+
e.preventDefault();
|
|
5724
|
+
const i = Math.max(0, enabled.findIndex((r) => r.id === value));
|
|
5725
|
+
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;
|
|
5726
|
+
onPick(enabled[next].id);
|
|
5727
|
+
const el = e.currentTarget.querySelectorAll('[role="radio"]:not([aria-disabled="true"])')[next];
|
|
5728
|
+
el?.focus();
|
|
5729
|
+
};
|
|
5730
|
+
return /* @__PURE__ */ jsxs50("div", { className: cn("flex min-w-0 flex-col p-1", className), children: [
|
|
5731
|
+
/* @__PURE__ */ jsx57(MenuLabel, { id, children: label }),
|
|
5732
|
+
/* @__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) => {
|
|
5733
|
+
const checked = r.id === value;
|
|
5734
|
+
return /* @__PURE__ */ jsxs50(
|
|
5735
|
+
"button",
|
|
5736
|
+
{
|
|
5737
|
+
type: "button",
|
|
5738
|
+
role: "radio",
|
|
5739
|
+
"aria-checked": checked,
|
|
5740
|
+
"aria-disabled": r.disabled || void 0,
|
|
5741
|
+
tabIndex: r.id === tabStop ? 0 : -1,
|
|
5742
|
+
onClick: () => !r.disabled && onPick(r.id),
|
|
5743
|
+
className: cn(
|
|
5744
|
+
// MenuItem's row: 36px, 14px, inset and rounded, the tick on the right.
|
|
5745
|
+
"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",
|
|
5746
|
+
"focus-visible:outline-solid focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-border-focus",
|
|
5747
|
+
r.disabled ? "cursor-not-allowed opacity-40" : "hover:bg-subtle focus-visible:bg-subtle"
|
|
5748
|
+
),
|
|
5749
|
+
children: [
|
|
5750
|
+
/* @__PURE__ */ jsx57("span", { className: "min-w-0 flex-1 truncate", children: r.label }),
|
|
5751
|
+
checked && /* @__PURE__ */ jsx57(Check10, { size: 16, "aria-hidden": "true", className: "shrink-0 text-brand-primaryAction" })
|
|
5752
|
+
]
|
|
5753
|
+
},
|
|
5754
|
+
r.id ?? "__none"
|
|
5755
|
+
);
|
|
5756
|
+
}) })
|
|
5757
|
+
] });
|
|
5758
|
+
}
|
|
5759
|
+
function HeaderMenuTrigger({
|
|
5760
|
+
menu,
|
|
5761
|
+
columnLabel,
|
|
5762
|
+
testId
|
|
5763
|
+
}) {
|
|
5764
|
+
const [open, setOpen] = useState19(false);
|
|
5765
|
+
const [pos, setPos] = useState19(null);
|
|
5766
|
+
const trigger = useRef20(null);
|
|
5767
|
+
const panel = useRef20(null);
|
|
5768
|
+
const { groupBy, breakOutBy } = menu;
|
|
5769
|
+
const groupLabel = groupBy.options.find((o) => o.id === groupBy.value)?.label ?? "";
|
|
5770
|
+
const breakLabel = breakOutBy?.value != null ? breakOutBy.options.find((o) => o.id === breakOutBy.value)?.label : void 0;
|
|
5771
|
+
const [draftGroup, setDraftGroup] = useState19(groupBy.value);
|
|
5772
|
+
const [draftBreak, setDraftBreak] = useState19(breakOutBy?.value ?? null);
|
|
5773
|
+
const openPanel = () => {
|
|
5774
|
+
setDraftGroup(groupBy.value);
|
|
5775
|
+
setDraftBreak(breakOutBy?.value ?? null);
|
|
5776
|
+
setOpen(true);
|
|
5777
|
+
};
|
|
5778
|
+
const close = useCallback5((refocus) => {
|
|
5779
|
+
setOpen(false);
|
|
5780
|
+
if (refocus) trigger.current?.focus();
|
|
5781
|
+
}, []);
|
|
5782
|
+
const apply = () => {
|
|
5783
|
+
if (draftGroup !== groupBy.value) groupBy.onChange(draftGroup);
|
|
5784
|
+
if (breakOutBy && draftBreak !== breakOutBy.value) breakOutBy.onChange(draftBreak);
|
|
5785
|
+
close(true);
|
|
5786
|
+
};
|
|
5787
|
+
const place = useCallback5(() => {
|
|
5788
|
+
const t = trigger.current;
|
|
5789
|
+
if (!t) return;
|
|
5790
|
+
const r = t.getBoundingClientRect();
|
|
5791
|
+
const h = panel.current?.offsetHeight ?? 0;
|
|
5792
|
+
const above = r.bottom + 4 + h > window.innerHeight && r.top - 4 - h > 0;
|
|
5793
|
+
setPos({ top: above ? r.top - 4 - h : r.bottom + 4, left: r.left });
|
|
5794
|
+
}, []);
|
|
5795
|
+
useLayoutEffect6(() => {
|
|
5796
|
+
if (open) place();
|
|
5797
|
+
else setPos(null);
|
|
5798
|
+
}, [open, place]);
|
|
5799
|
+
const placed = pos !== null;
|
|
5800
|
+
useEffect18(() => {
|
|
5801
|
+
if (open && placed) panel.current?.querySelector('[data-first-group] [tabindex="0"]')?.focus();
|
|
5802
|
+
}, [open, placed]);
|
|
5803
|
+
useEffect18(() => {
|
|
5804
|
+
if (!open) return void 0;
|
|
5805
|
+
const onDown = (e) => {
|
|
5806
|
+
const t = e.target;
|
|
5807
|
+
if (trigger.current?.contains(t) || panel.current?.contains(t)) return;
|
|
5808
|
+
close(false);
|
|
5809
|
+
};
|
|
5810
|
+
window.addEventListener("mousedown", onDown);
|
|
5811
|
+
window.addEventListener("resize", place);
|
|
5812
|
+
window.addEventListener("scroll", place, true);
|
|
5813
|
+
return () => {
|
|
5814
|
+
window.removeEventListener("mousedown", onDown);
|
|
5815
|
+
window.removeEventListener("resize", place);
|
|
5816
|
+
window.removeEventListener("scroll", place, true);
|
|
5817
|
+
};
|
|
5818
|
+
}, [open, close, place]);
|
|
5819
|
+
const onTriggerKey = (e) => {
|
|
5820
|
+
if (e.key === "ArrowDown" && !open) {
|
|
5821
|
+
e.preventDefault();
|
|
5822
|
+
openPanel();
|
|
5823
|
+
}
|
|
5824
|
+
};
|
|
5825
|
+
const onPanelKey = (e) => {
|
|
5826
|
+
if (e.key === "Escape") {
|
|
5827
|
+
e.preventDefault();
|
|
5828
|
+
e.stopPropagation();
|
|
5829
|
+
close(true);
|
|
5830
|
+
return;
|
|
5831
|
+
}
|
|
5832
|
+
if (e.key === "Tab") {
|
|
5833
|
+
const stops = [...e.currentTarget.querySelectorAll('[tabindex="0"], button:not([tabindex])')];
|
|
5834
|
+
const at = stops.indexOf(document.activeElement);
|
|
5835
|
+
if (e.shiftKey && at === 0 || !e.shiftKey && at === stops.length - 1) {
|
|
5836
|
+
e.preventDefault();
|
|
5837
|
+
close(true);
|
|
5838
|
+
}
|
|
5839
|
+
}
|
|
5840
|
+
};
|
|
5841
|
+
const pickGroup = (id) => {
|
|
5842
|
+
setDraftGroup(id);
|
|
5843
|
+
if (draftBreak === id) setDraftBreak(null);
|
|
5844
|
+
};
|
|
5845
|
+
return /* @__PURE__ */ jsxs50(Fragment7, { children: [
|
|
5846
|
+
/* @__PURE__ */ jsxs50(
|
|
5847
|
+
"button",
|
|
5848
|
+
{
|
|
5849
|
+
ref: trigger,
|
|
5850
|
+
type: "button",
|
|
5851
|
+
"aria-haspopup": "dialog",
|
|
5852
|
+
"aria-expanded": open,
|
|
5853
|
+
"data-testid": testId,
|
|
5854
|
+
onClick: () => open ? close(false) : openPanel(),
|
|
5855
|
+
onKeyDown: onTriggerKey,
|
|
5856
|
+
className: cn(
|
|
5857
|
+
// Restores the header row's uppercase: a <button> doesn't inherit
|
|
5858
|
+
// text-transform (see SortButton). The negative margin keeps the
|
|
5859
|
+
// label lined up with the names under it while the hover fill
|
|
5860
|
+
// reaches past it.
|
|
5861
|
+
"-mx-1.5 -my-1 inline-flex items-center gap-1 rounded-control px-1.5 py-1 uppercase transition-colors",
|
|
5862
|
+
"hover:bg-border-default hover:text-text-primary aria-expanded:bg-border-default aria-expanded:text-text-primary",
|
|
5863
|
+
"focus-visible:outline-solid focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-border-focus"
|
|
5864
|
+
),
|
|
5865
|
+
children: [
|
|
5866
|
+
/* @__PURE__ */ jsxs50("span", { children: [
|
|
5867
|
+
groupLabel,
|
|
5868
|
+
breakLabel && /* @__PURE__ */ jsxs50(Fragment7, { children: [
|
|
5869
|
+
/* @__PURE__ */ jsx57("span", { "aria-hidden": "true", className: "text-text-tertiary", children: " \u203A " }),
|
|
5870
|
+
/* @__PURE__ */ jsx57("span", { className: "sr-only", children: " then " }),
|
|
5871
|
+
breakLabel
|
|
5872
|
+
] })
|
|
5873
|
+
] }),
|
|
5874
|
+
/* @__PURE__ */ jsx57(ChevronDown11, { size: 12, "aria-hidden": "true", className: cn("shrink-0 transition-transform motion-reduce:transition-none", open && "rotate-180") })
|
|
5875
|
+
]
|
|
5876
|
+
}
|
|
5877
|
+
),
|
|
5878
|
+
open && createPortal9(
|
|
5879
|
+
/* @__PURE__ */ jsxs50(
|
|
5880
|
+
"div",
|
|
5881
|
+
{
|
|
5882
|
+
ref: panel,
|
|
5883
|
+
role: "dialog",
|
|
5884
|
+
"aria-label": columnLabel,
|
|
5885
|
+
"data-testid": testId && `${testId}-menu`,
|
|
5886
|
+
onKeyDown: onPanelKey,
|
|
5887
|
+
style: { position: "fixed", top: pos?.top ?? 0, left: pos?.left ?? 0, visibility: pos ? void 0 : "hidden" },
|
|
5888
|
+
className: cn(
|
|
5889
|
+
"z-dropdown flex max-h-120 flex-col overflow-hidden rounded-card border border-border-default bg-surface text-left normal-case tracking-normal shadow-overlay",
|
|
5890
|
+
// Two columns side by side, as Advertising Trends' Group by.
|
|
5891
|
+
breakOutBy ? "w-105" : "w-60"
|
|
5892
|
+
),
|
|
5893
|
+
children: [
|
|
5894
|
+
/* @__PURE__ */ jsxs50("div", { className: cn("grid min-h-0 overflow-y-auto", breakOutBy && "grid-cols-2"), 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
|
+
className: breakOutBy ? "border-r border-border-default" : void 0
|
|
5904
|
+
}
|
|
5905
|
+
),
|
|
5906
|
+
breakOutBy && /* @__PURE__ */ jsx57(
|
|
5907
|
+
RadioSection,
|
|
5908
|
+
{
|
|
5909
|
+
label: breakOutBy.label ?? "Then break out by",
|
|
5910
|
+
rows: [{ id: null, label: "None" }, ...breakOutBy.options.map((o) => ({ ...o, disabled: o.id === draftGroup }))],
|
|
5911
|
+
value: draftBreak,
|
|
5912
|
+
onPick: setDraftBreak
|
|
5913
|
+
}
|
|
5914
|
+
)
|
|
5915
|
+
] }),
|
|
5916
|
+
/* @__PURE__ */ jsx57(FilterDropdownFooter, { onApply: apply })
|
|
5917
|
+
]
|
|
5918
|
+
}
|
|
5919
|
+
),
|
|
5920
|
+
document.body
|
|
5921
|
+
)
|
|
5922
|
+
] });
|
|
5923
|
+
}
|
|
5924
|
+
|
|
5584
5925
|
// src/DataTable.tsx
|
|
5585
|
-
import { Fragment as
|
|
5926
|
+
import { Fragment as Fragment9, jsx as jsx58, jsxs as jsxs51 } from "react/jsx-runtime";
|
|
5586
5927
|
var WIDTH3 = { fill: "", sm: "w-24", md: "w-36", lg: "w-48" };
|
|
5587
5928
|
var MAX_H = { sm: "max-h-80", md: "max-h-120", lg: "max-h-160" };
|
|
5588
5929
|
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
5930
|
var HEAD_PAD = { default: "px-4 py-3", compact: "px-3 py-2" };
|
|
5590
5931
|
var CELL_PAD = { default: "px-4 py-3.5", compact: "px-3 py-2" };
|
|
5932
|
+
var EXPAND_PAD = "px-2";
|
|
5591
5933
|
var SUB_INDENT = { default: "pl-10", compact: "pl-9" };
|
|
5592
5934
|
var TINT = "bg-brand-primaryTint";
|
|
5593
5935
|
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 +5945,7 @@ function isDev() {
|
|
|
5603
5945
|
return false;
|
|
5604
5946
|
}
|
|
5605
5947
|
}
|
|
5606
|
-
var useBrowserLayoutEffect = typeof window === "undefined" ?
|
|
5948
|
+
var useBrowserLayoutEffect = typeof window === "undefined" ? useEffect19 : useLayoutEffect7;
|
|
5607
5949
|
function rowClickCounts(e) {
|
|
5608
5950
|
if (e.target.closest(OWN_CLICK)) return false;
|
|
5609
5951
|
const sel = window.getSelection?.();
|
|
@@ -5611,13 +5953,13 @@ function rowClickCounts(e) {
|
|
|
5611
5953
|
return true;
|
|
5612
5954
|
}
|
|
5613
5955
|
function NoValue({ reason = "No data" }) {
|
|
5614
|
-
return /* @__PURE__ */
|
|
5615
|
-
/* @__PURE__ */
|
|
5616
|
-
/* @__PURE__ */
|
|
5956
|
+
return /* @__PURE__ */ jsxs51(Tooltip, { label: reason, delay: 300, className: "text-text-tertiary", children: [
|
|
5957
|
+
/* @__PURE__ */ jsx58("span", { "aria-hidden": "true", children: NO_VALUE }),
|
|
5958
|
+
/* @__PURE__ */ jsx58("span", { className: "sr-only", children: reason })
|
|
5617
5959
|
] });
|
|
5618
5960
|
}
|
|
5619
5961
|
function TableLink({ className, ...props }) {
|
|
5620
|
-
return /* @__PURE__ */
|
|
5962
|
+
return /* @__PURE__ */ jsx58(
|
|
5621
5963
|
"a",
|
|
5622
5964
|
{
|
|
5623
5965
|
...props,
|
|
@@ -5674,7 +6016,7 @@ function DataTable({
|
|
|
5674
6016
|
...rest
|
|
5675
6017
|
}) {
|
|
5676
6018
|
const maxHeight = sticky ? void 0 : maxHeightProp;
|
|
5677
|
-
const titleId =
|
|
6019
|
+
const titleId = useId11();
|
|
5678
6020
|
const showSkeleton = useDelayedLoading(loading);
|
|
5679
6021
|
const head = HEAD_PAD[density];
|
|
5680
6022
|
const pad2 = CELL_PAD[density];
|
|
@@ -5687,7 +6029,7 @@ function DataTable({
|
|
|
5687
6029
|
onSortChange?.(cycleSort(shown, key, col?.firstDir ?? (right(col) ? "desc" : "asc"), defaultSort));
|
|
5688
6030
|
};
|
|
5689
6031
|
const clash = !!onRowClick && (!!renderExpandedProp || !!subRowsProp);
|
|
5690
|
-
|
|
6032
|
+
useEffect19(() => {
|
|
5691
6033
|
if (clash && isDev()) {
|
|
5692
6034
|
console.warn("DataTable: pass `onRowClick` or rows that open in place (`renderExpanded`, `subRows`), not both. The row click wins; rows won't open.");
|
|
5693
6035
|
}
|
|
@@ -5698,10 +6040,10 @@ function DataTable({
|
|
|
5698
6040
|
const kids = subRows?.(row);
|
|
5699
6041
|
return kids && kids.length > 0 ? kids : null;
|
|
5700
6042
|
};
|
|
5701
|
-
const [open, setOpen] =
|
|
6043
|
+
const [open, setOpen] = useState20(() => /* @__PURE__ */ new Set());
|
|
5702
6044
|
const visible = rows.map(rowKey);
|
|
5703
6045
|
const resetOn = subRows ? [...visible].sort().join("|") : `${shown?.key}|${shown?.dir}|${visible.join("|")}`;
|
|
5704
|
-
|
|
6046
|
+
useEffect19(() => setOpen(/* @__PURE__ */ new Set()), [resetOn]);
|
|
5705
6047
|
const expandable = (row) => (!!renderExpanded || !!childrenOf(row)) && (canExpand ? canExpand(row) : true);
|
|
5706
6048
|
const anyExpandable = (!!renderExpanded || !!subRows) && rows.some(expandable);
|
|
5707
6049
|
const toggle = (key) => setOpen((prev) => {
|
|
@@ -5722,8 +6064,8 @@ function DataTable({
|
|
|
5722
6064
|
pickable.forEach((k) => allVisible ? next.delete(k) : next.add(k));
|
|
5723
6065
|
setPicked(next);
|
|
5724
6066
|
};
|
|
5725
|
-
const lastPicked =
|
|
5726
|
-
const shiftHeld =
|
|
6067
|
+
const lastPicked = useRef21(null);
|
|
6068
|
+
const shiftHeld = useRef21(false);
|
|
5727
6069
|
const togglePick = (index) => {
|
|
5728
6070
|
const key = visible[index];
|
|
5729
6071
|
const on = !picked.has(key);
|
|
@@ -5740,12 +6082,12 @@ function DataTable({
|
|
|
5740
6082
|
};
|
|
5741
6083
|
const count = selectedCount ?? picked.size;
|
|
5742
6084
|
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
|
-
|
|
6085
|
+
const scroller = useRef21(null);
|
|
6086
|
+
const [pinned, setPinned] = useState20(false);
|
|
6087
|
+
const [scrolled, setScrolled] = useState20(false);
|
|
6088
|
+
const heads = useRef21(/* @__PURE__ */ new Map());
|
|
6089
|
+
const [lefts, setLefts] = useState20({});
|
|
6090
|
+
useEffect19(() => {
|
|
5749
6091
|
const el = scroller.current;
|
|
5750
6092
|
if (!el || typeof ResizeObserver === "undefined") return void 0;
|
|
5751
6093
|
const measure = () => {
|
|
@@ -5778,19 +6120,19 @@ function DataTable({
|
|
|
5778
6120
|
part === nameIdx && "max-w-60 border-r border-r-border-default"
|
|
5779
6121
|
) : "";
|
|
5780
6122
|
const pinStyle = (part) => isPinned(part) ? { left: leftOf(part) } : void 0;
|
|
5781
|
-
const edge = (part) => pinned && scrolled && part === nameIdx ? /* @__PURE__ */
|
|
6123
|
+
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
6124
|
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
|
-
|
|
6125
|
+
const wrapRef = useRef21(null);
|
|
6126
|
+
const theadRef = useRef21(null);
|
|
6127
|
+
const cloneRef = useRef21(null);
|
|
6128
|
+
const [stuck, setStuck] = useState20(false);
|
|
6129
|
+
const [geom, setGeom] = useState20({ cols: [], width: 0, height: 0 });
|
|
6130
|
+
const [barH, setBarH] = useState20(0);
|
|
6131
|
+
const [scrollPad, setScrollPad] = useState20({ top: 0, bottom: 0 });
|
|
6132
|
+
const [footerStuck, setFooterStuck] = useState20(false);
|
|
6133
|
+
const [scrolledDown, setScrolledDown] = useState20(false);
|
|
6134
|
+
const [animate, setAnimate] = useState20(false);
|
|
6135
|
+
useEffect19(() => {
|
|
5794
6136
|
const thead = theadRef.current;
|
|
5795
6137
|
if (!sticky || !thead || typeof ResizeObserver === "undefined") return void 0;
|
|
5796
6138
|
const measure = () => {
|
|
@@ -5839,7 +6181,7 @@ function DataTable({
|
|
|
5839
6181
|
ro?.disconnect();
|
|
5840
6182
|
};
|
|
5841
6183
|
}, [sticky]);
|
|
5842
|
-
|
|
6184
|
+
useEffect19(() => {
|
|
5843
6185
|
const clone = cloneRef.current;
|
|
5844
6186
|
if (!clone) return;
|
|
5845
6187
|
clone.querySelectorAll("button, a[href], input, [tabindex]").forEach((el) => {
|
|
@@ -5850,9 +6192,9 @@ function DataTable({
|
|
|
5850
6192
|
const top = (stickyTop ?? barH) - scrollPad.top;
|
|
5851
6193
|
const renderCell = (c, row) => {
|
|
5852
6194
|
const v = c.cell(row);
|
|
5853
|
-
return v === null || v === void 0 || v === "" ? /* @__PURE__ */
|
|
6195
|
+
return v === null || v === void 0 || v === "" ? /* @__PURE__ */ jsx58(NoValue, { reason: c.missing }) : v;
|
|
5854
6196
|
};
|
|
5855
|
-
const fit = (ci, content) => pinned && ci === nameIdx ? /* @__PURE__ */
|
|
6197
|
+
const fit = (ci, content) => pinned && ci === nameIdx ? /* @__PURE__ */ jsx58(Tooltip, { label: content, whenTruncated: true, delay: 300, className: "block truncate", children: content }) : content;
|
|
5856
6198
|
const colBg = (c, rowBg) => c.highlight ? TINT : rowBg;
|
|
5857
6199
|
const firstPart = selectable ? "select" : anyExpandable ? "expand" : 0;
|
|
5858
6200
|
const ringCls = (part) => onRowClick ? cn(
|
|
@@ -5862,13 +6204,13 @@ function DataTable({
|
|
|
5862
6204
|
part === columns.length - 1 && RING_RIGHT,
|
|
5863
6205
|
pinned && scrolled && part === nameIdx && part !== columns.length - 1 && RING_PAST_EDGE
|
|
5864
6206
|
) : "";
|
|
5865
|
-
const plainRow = (kind, row, key, rowBg, extra) => /* @__PURE__ */
|
|
5866
|
-
selectable && /* @__PURE__ */
|
|
5867
|
-
anyExpandable && /* @__PURE__ */
|
|
6207
|
+
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: [
|
|
6208
|
+
selectable && /* @__PURE__ */ jsx58("td", { className: cn("border-b border-border-default pr-0", pad2, rowBg, pinCls("select", "body", rowBg)), style: pinStyle("select") }),
|
|
6209
|
+
anyExpandable && /* @__PURE__ */ jsx58("td", { className: cn("border-b border-border-default", pad2, EXPAND_PAD, rowBg, pinCls("expand", "body", rowBg)), style: pinStyle("expand") }),
|
|
5868
6210
|
columns.map((c, ci) => {
|
|
5869
6211
|
const bg = kind === "sub" ? colBg(c, rowBg) : rowBg;
|
|
5870
6212
|
const isName = ci === nameIdx;
|
|
5871
|
-
return /* @__PURE__ */
|
|
6213
|
+
return /* @__PURE__ */ jsxs51(
|
|
5872
6214
|
"td",
|
|
5873
6215
|
{
|
|
5874
6216
|
className: cn(
|
|
@@ -5883,8 +6225,8 @@ function DataTable({
|
|
|
5883
6225
|
),
|
|
5884
6226
|
style: pinStyle(ci),
|
|
5885
6227
|
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__ */
|
|
6228
|
+
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)),
|
|
6229
|
+
kind === "sub" && isName && rowLabel && extra?.parent !== void 0 && /* @__PURE__ */ jsxs51("span", { className: "sr-only", children: [
|
|
5888
6230
|
", in ",
|
|
5889
6231
|
rowLabel(extra.parent)
|
|
5890
6232
|
] }),
|
|
@@ -5895,8 +6237,8 @@ function DataTable({
|
|
|
5895
6237
|
);
|
|
5896
6238
|
})
|
|
5897
6239
|
] }, key);
|
|
5898
|
-
const headRow = (clone) => /* @__PURE__ */
|
|
5899
|
-
selectable && /* @__PURE__ */
|
|
6240
|
+
const headRow = (clone) => /* @__PURE__ */ jsxs51("tr", { className: "bg-subtle text-micro font-semibold uppercase tracking-wider text-text-secondary", children: [
|
|
6241
|
+
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
6242
|
CheckBox,
|
|
5901
6243
|
{
|
|
5902
6244
|
checked: allVisible,
|
|
@@ -5905,14 +6247,14 @@ function DataTable({
|
|
|
5905
6247
|
disabled: pickable.length === 0,
|
|
5906
6248
|
ariaLabel: allVisible ? "Deselect all rows on this page" : "Select all rows on this page"
|
|
5907
6249
|
}
|
|
5908
|
-
) : /* @__PURE__ */
|
|
5909
|
-
anyExpandable && /* @__PURE__ */
|
|
5910
|
-
columns.map((c, ci) => /* @__PURE__ */
|
|
6250
|
+
) : /* @__PURE__ */ jsx58("span", { className: "sr-only", children: "Select" }) }),
|
|
6251
|
+
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" }) }),
|
|
6252
|
+
columns.map((c, ci) => /* @__PURE__ */ jsxs51(
|
|
5911
6253
|
"th",
|
|
5912
6254
|
{
|
|
5913
6255
|
ref: !clone && ci <= nameIdx ? headRef(ci) : void 0,
|
|
5914
6256
|
scope: "col",
|
|
5915
|
-
"aria-sort": c.sortable ? ariaSortFor(shown, c.key) : void 0,
|
|
6257
|
+
"aria-sort": c.sortable && !c.headerMenu ? ariaSortFor(shown, c.key) : void 0,
|
|
5916
6258
|
className: cn(
|
|
5917
6259
|
"group/head whitespace-nowrap border-b border-border-default font-semibold",
|
|
5918
6260
|
head,
|
|
@@ -5923,7 +6265,14 @@ function DataTable({
|
|
|
5923
6265
|
),
|
|
5924
6266
|
style: pinStyle(ci),
|
|
5925
6267
|
children: [
|
|
5926
|
-
c.
|
|
6268
|
+
c.headerMenu ? /* @__PURE__ */ jsx58(
|
|
6269
|
+
HeaderMenuTrigger,
|
|
6270
|
+
{
|
|
6271
|
+
menu: c.headerMenu,
|
|
6272
|
+
columnLabel: c.label,
|
|
6273
|
+
testId: clone || !testIdPrefix ? void 0 : `${testIdPrefix}-header-menu-${c.key}`
|
|
6274
|
+
}
|
|
6275
|
+
) : c.sortable && onSortChange ? /* @__PURE__ */ jsx58(
|
|
5927
6276
|
SortButton,
|
|
5928
6277
|
{
|
|
5929
6278
|
label: c.label,
|
|
@@ -5934,7 +6283,7 @@ function DataTable({
|
|
|
5934
6283
|
description: c.info,
|
|
5935
6284
|
testIdPrefix: clone ? void 0 : testIdPrefix
|
|
5936
6285
|
}
|
|
5937
|
-
) : c.info ? /* @__PURE__ */
|
|
6286
|
+
) : c.info ? /* @__PURE__ */ jsx58(SortButton, { label: c.label, sortKey: c.key, sortable: false, sort: sortProp(shown), onSort: () => {
|
|
5938
6287
|
}, description: c.info, align: right(c) ? "right" : "left" }) : c.label,
|
|
5939
6288
|
edge(ci)
|
|
5940
6289
|
]
|
|
@@ -5943,19 +6292,19 @@ function DataTable({
|
|
|
5943
6292
|
))
|
|
5944
6293
|
] });
|
|
5945
6294
|
const inside = variant === "chart";
|
|
5946
|
-
const bar = barCount > 0 ? /* @__PURE__ */
|
|
5947
|
-
/* @__PURE__ */
|
|
6295
|
+
const bar = barCount > 0 ? /* @__PURE__ */ jsxs51("div", { className: "flex flex-wrap items-center gap-x-3 gap-y-1 text-dense", children: [
|
|
6296
|
+
/* @__PURE__ */ jsxs51("span", { role: "status", className: "font-medium text-text-primary", children: [
|
|
5948
6297
|
formatCountFull(count),
|
|
5949
6298
|
" selected"
|
|
5950
6299
|
] }),
|
|
5951
|
-
allVisible && totalCount !== void 0 && count < totalCount && onSelectAll && /* @__PURE__ */
|
|
6300
|
+
allVisible && totalCount !== void 0 && count < totalCount && onSelectAll && /* @__PURE__ */ jsxs51(Button, { variant: "link", size: "sm", onClick: onSelectAll, children: [
|
|
5952
6301
|
"Select all ",
|
|
5953
6302
|
formatCountFull(totalCount)
|
|
5954
6303
|
] }),
|
|
5955
6304
|
selectionActions,
|
|
5956
|
-
/* @__PURE__ */
|
|
6305
|
+
/* @__PURE__ */ jsx58(Button, { variant: "link", size: "sm", onClick: () => onSelectedChange?.([]), children: "Clear" })
|
|
5957
6306
|
] }) : null;
|
|
5958
|
-
const scrollArea = /* @__PURE__ */
|
|
6307
|
+
const scrollArea = /* @__PURE__ */ jsx58(
|
|
5959
6308
|
"div",
|
|
5960
6309
|
{
|
|
5961
6310
|
ref: scroller,
|
|
@@ -5964,7 +6313,7 @@ function DataTable({
|
|
|
5964
6313
|
if (cloneRef.current) cloneRef.current.scrollLeft = e.currentTarget.scrollLeft;
|
|
5965
6314
|
},
|
|
5966
6315
|
className: cn("overflow-x-auto", SCROLLBAR, maxHeight && cn("overflow-y-auto", MAX_H[maxHeight])),
|
|
5967
|
-
children: /* @__PURE__ */
|
|
6316
|
+
children: /* @__PURE__ */ jsxs51(
|
|
5968
6317
|
"table",
|
|
5969
6318
|
{
|
|
5970
6319
|
"aria-labelledby": title ? titleId : void 0,
|
|
@@ -5972,12 +6321,12 @@ function DataTable({
|
|
|
5972
6321
|
"aria-busy": loading || refreshing || void 0,
|
|
5973
6322
|
className: "w-full border-separate border-spacing-0 text-left",
|
|
5974
6323
|
children: [
|
|
5975
|
-
/* @__PURE__ */
|
|
5976
|
-
/* @__PURE__ */
|
|
5977
|
-
selectable && /* @__PURE__ */
|
|
5978
|
-
anyExpandable && /* @__PURE__ */
|
|
5979
|
-
columns.map((c) => /* @__PURE__ */
|
|
5980
|
-
] }, i)) : rows.length === 0 ? /* @__PURE__ */
|
|
6324
|
+
/* @__PURE__ */ jsx58("thead", { ref: theadRef, className: cn(maxHeight && "sticky top-0 z-10"), children: headRow(false) }),
|
|
6325
|
+
/* @__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: [
|
|
6326
|
+
selectable && /* @__PURE__ */ jsx58("td", { className: cn("border-b border-border-default", pad2) }),
|
|
6327
|
+
anyExpandable && /* @__PURE__ */ jsx58("td", { className: cn("border-b border-border-default", pad2, EXPAND_PAD) }),
|
|
6328
|
+
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))
|
|
6329
|
+
] }, 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
6330
|
totalsRow !== void 0 && plainRow("total", totalsRow, "__totals", "bg-subtle"),
|
|
5982
6331
|
rows.map((row, ri) => {
|
|
5983
6332
|
const key = rowKey(row);
|
|
@@ -5992,8 +6341,8 @@ function DataTable({
|
|
|
5992
6341
|
const ticked = picked.has(key);
|
|
5993
6342
|
const label = rowLabel ? rowLabel(row) : "row";
|
|
5994
6343
|
const clickable = !!onRowClick || canOpen;
|
|
5995
|
-
return /* @__PURE__ */
|
|
5996
|
-
/* @__PURE__ */
|
|
6344
|
+
return /* @__PURE__ */ jsxs51(Fragment8, { children: [
|
|
6345
|
+
/* @__PURE__ */ jsxs51(
|
|
5997
6346
|
"tr",
|
|
5998
6347
|
{
|
|
5999
6348
|
onClick: onRowClick ? (e) => rowClickCounts(e) && onRowClick(row) : canOpen ? (e) => rowClickCounts(e) && toggle(key) : void 0,
|
|
@@ -6004,14 +6353,14 @@ function DataTable({
|
|
|
6004
6353
|
// The row's hidden open button has keyboard focus: ring the whole row.
|
|
6005
6354
|
),
|
|
6006
6355
|
children: [
|
|
6007
|
-
selectable && /* @__PURE__ */
|
|
6356
|
+
selectable && /* @__PURE__ */ jsx58(
|
|
6008
6357
|
"td",
|
|
6009
6358
|
{
|
|
6010
6359
|
onPointerDownCapture: (e) => shiftHeld.current = e.shiftKey,
|
|
6011
6360
|
onKeyDownCapture: (e) => shiftHeld.current = e.shiftKey,
|
|
6012
6361
|
className: cn("border-b border-border-default pr-0", pad2, panelOpen && "border-b-0", rowBg, ringCls("select"), pinCls("select", "body", rowBg)),
|
|
6013
6362
|
style: pinStyle("select"),
|
|
6014
|
-
children: reason ? /* @__PURE__ */
|
|
6363
|
+
children: reason ? /* @__PURE__ */ jsx58(Tooltip, { label: reason, delay: 300, className: "inline-flex align-middle", children: /* @__PURE__ */ jsx58(
|
|
6015
6364
|
"button",
|
|
6016
6365
|
{
|
|
6017
6366
|
type: "button",
|
|
@@ -6021,17 +6370,17 @@ function DataTable({
|
|
|
6021
6370
|
"aria-label": `Select ${label}`,
|
|
6022
6371
|
onClick: (e) => e.preventDefault(),
|
|
6023
6372
|
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__ */
|
|
6373
|
+
children: /* @__PURE__ */ jsx58(CheckBoxBox, { checked: ticked, disabled: true })
|
|
6025
6374
|
}
|
|
6026
|
-
) }) : /* @__PURE__ */
|
|
6375
|
+
) }) : /* @__PURE__ */ jsx58(CheckBox, { checked: ticked, onChange: () => togglePick(ri), ariaLabel: `Select ${label}` })
|
|
6027
6376
|
}
|
|
6028
6377
|
),
|
|
6029
|
-
anyExpandable && /* @__PURE__ */
|
|
6378
|
+
anyExpandable && /* @__PURE__ */ jsx58(
|
|
6030
6379
|
"td",
|
|
6031
6380
|
{
|
|
6032
|
-
className: cn("border-b border-border-default
|
|
6381
|
+
className: cn("border-b border-border-default", pad2, EXPAND_PAD, panelOpen && "border-b-0", rowBg, ringCls("expand"), pinCls("expand", "body", rowBg)),
|
|
6033
6382
|
style: pinStyle("expand"),
|
|
6034
|
-
children: canOpen && /* @__PURE__ */
|
|
6383
|
+
children: canOpen && /* @__PURE__ */ jsx58(
|
|
6035
6384
|
"button",
|
|
6036
6385
|
{
|
|
6037
6386
|
type: "button",
|
|
@@ -6040,8 +6389,8 @@ function DataTable({
|
|
|
6040
6389
|
"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
6390
|
onClick: () => toggle(key),
|
|
6042
6391
|
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
|
-
|
|
6392
|
+
children: /* @__PURE__ */ jsx58(
|
|
6393
|
+
ChevronRight7,
|
|
6045
6394
|
{
|
|
6046
6395
|
size: 16,
|
|
6047
6396
|
"aria-hidden": "true",
|
|
@@ -6055,7 +6404,7 @@ function DataTable({
|
|
|
6055
6404
|
columns.map((c, ci) => {
|
|
6056
6405
|
const bg = colBg(c, rowBg);
|
|
6057
6406
|
const opener = !!onRowClick && ci === nameIdx;
|
|
6058
|
-
return /* @__PURE__ */
|
|
6407
|
+
return /* @__PURE__ */ jsxs51(
|
|
6059
6408
|
"td",
|
|
6060
6409
|
{
|
|
6061
6410
|
className: cn(
|
|
@@ -6074,7 +6423,7 @@ function DataTable({
|
|
|
6074
6423
|
fit(ci, renderCell(c, row)),
|
|
6075
6424
|
opener && // The keyboard's and screen reader's way to the row click. It
|
|
6076
6425
|
// stays hidden; while it has focus the whole row takes the ring.
|
|
6077
|
-
/* @__PURE__ */
|
|
6426
|
+
/* @__PURE__ */ jsx58("button", { type: "button", "data-row-open": "", onClick: () => onRowClick(row), className: "sr-only", children: rowClickLabel ? rowClickLabel(row) : `Open ${rowLabel ? rowLabel(row) : "row"}` }),
|
|
6078
6427
|
edge(ci)
|
|
6079
6428
|
]
|
|
6080
6429
|
},
|
|
@@ -6084,7 +6433,7 @@ function DataTable({
|
|
|
6084
6433
|
]
|
|
6085
6434
|
}
|
|
6086
6435
|
),
|
|
6087
|
-
panelOpen && /* @__PURE__ */
|
|
6436
|
+
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
6437
|
isOpen && kids?.map(
|
|
6089
6438
|
(child, si) => plainRow("sub", child, `${key}::${rowKey(child)}`, highlightRow?.(child) ? TINT : "bg-subtle", { id: kidIds[si], parent: row })
|
|
6090
6439
|
)
|
|
@@ -6097,7 +6446,7 @@ function DataTable({
|
|
|
6097
6446
|
}
|
|
6098
6447
|
);
|
|
6099
6448
|
const bare = inside || !title && barCount === 0;
|
|
6100
|
-
const frame = /* @__PURE__ */
|
|
6449
|
+
const frame = /* @__PURE__ */ jsxs51(
|
|
6101
6450
|
"div",
|
|
6102
6451
|
{
|
|
6103
6452
|
className: cn(
|
|
@@ -6109,17 +6458,17 @@ function DataTable({
|
|
|
6109
6458
|
),
|
|
6110
6459
|
"data-testid": testIdPrefix,
|
|
6111
6460
|
children: [
|
|
6112
|
-
title && inside && /* @__PURE__ */
|
|
6113
|
-
/* @__PURE__ */
|
|
6114
|
-
/* @__PURE__ */
|
|
6115
|
-
subtitle && /* @__PURE__ */
|
|
6461
|
+
title && inside && /* @__PURE__ */ jsxs51("div", { className: "flex items-start justify-between gap-2 p-card-padding", children: [
|
|
6462
|
+
/* @__PURE__ */ jsxs51("div", { className: "min-w-0", children: [
|
|
6463
|
+
/* @__PURE__ */ jsx58("h3", { id: titleId, className: "text-panel-title font-semibold text-text-primary", children: title }),
|
|
6464
|
+
subtitle && /* @__PURE__ */ jsx58("p", { className: "mt-0.5 text-xs leading-snug text-text-tertiary", children: subtitle })
|
|
6116
6465
|
] }),
|
|
6117
|
-
(bar ?? action) && /* @__PURE__ */
|
|
6466
|
+
(bar ?? action) && /* @__PURE__ */ jsx58("div", { className: "shrink-0 text-text-tertiary", children: bar ?? action })
|
|
6118
6467
|
] }),
|
|
6119
6468
|
sticky ? (
|
|
6120
6469
|
// The copy of the header sticks within this box, so it leaves with the last row.
|
|
6121
|
-
/* @__PURE__ */
|
|
6122
|
-
/* @__PURE__ */
|
|
6470
|
+
/* @__PURE__ */ jsxs51("div", { className: "relative", children: [
|
|
6471
|
+
/* @__PURE__ */ jsx58(
|
|
6123
6472
|
"div",
|
|
6124
6473
|
{
|
|
6125
6474
|
ref: cloneRef,
|
|
@@ -6130,25 +6479,25 @@ function DataTable({
|
|
|
6130
6479
|
},
|
|
6131
6480
|
className: "sticky z-2 overflow-hidden",
|
|
6132
6481
|
style: { top, height: geom.height, marginBottom: -geom.height, visibility: stuck ? "visible" : "hidden" },
|
|
6133
|
-
children: /* @__PURE__ */
|
|
6134
|
-
/* @__PURE__ */
|
|
6135
|
-
/* @__PURE__ */
|
|
6482
|
+
children: /* @__PURE__ */ jsxs51("table", { className: "table-fixed border-separate border-spacing-0 text-left", style: { width: geom.width }, children: [
|
|
6483
|
+
/* @__PURE__ */ jsx58("colgroup", { children: geom.cols.map((w, i) => /* @__PURE__ */ jsx58("col", { style: { width: w } }, i)) }),
|
|
6484
|
+
/* @__PURE__ */ jsx58("thead", { children: headRow(true) })
|
|
6136
6485
|
] })
|
|
6137
6486
|
}
|
|
6138
6487
|
),
|
|
6139
6488
|
scrollArea
|
|
6140
6489
|
] })
|
|
6141
6490
|
) : scrollArea,
|
|
6142
|
-
refreshing && !loading && /* @__PURE__ */
|
|
6143
|
-
/* @__PURE__ */
|
|
6144
|
-
footer && !sticky && /* @__PURE__ */
|
|
6491
|
+
refreshing && !loading && /* @__PURE__ */ jsx58(RefreshLine, {}),
|
|
6492
|
+
/* @__PURE__ */ jsx58(LongWait, { loading, onRetry, className: "mb-3 px-4" }),
|
|
6493
|
+
footer && !sticky && /* @__PURE__ */ jsx58("div", { className: "border-t border-border-default px-4 py-3", children: footer })
|
|
6145
6494
|
]
|
|
6146
6495
|
}
|
|
6147
6496
|
);
|
|
6148
6497
|
const hideFooter = footerStuck && !scrolledDown;
|
|
6149
|
-
const body = sticky ? /* @__PURE__ */
|
|
6498
|
+
const body = sticky ? /* @__PURE__ */ jsxs51("div", { ref: wrapRef, className: cn("flex w-full flex-col", bare && className), children: [
|
|
6150
6499
|
frame,
|
|
6151
|
-
footer && /* @__PURE__ */
|
|
6500
|
+
footer && /* @__PURE__ */ jsx58(
|
|
6152
6501
|
"div",
|
|
6153
6502
|
{
|
|
6154
6503
|
"data-sticky-footer": "",
|
|
@@ -6165,14 +6514,14 @@ function DataTable({
|
|
|
6165
6514
|
)
|
|
6166
6515
|
] }) : frame;
|
|
6167
6516
|
if (bare) return body;
|
|
6168
|
-
return /* @__PURE__ */
|
|
6169
|
-
title ? /* @__PURE__ */
|
|
6517
|
+
return /* @__PURE__ */ jsxs51("section", { "aria-labelledby": title ? titleId : void 0, className: cn("flex w-full flex-col gap-3", className), children: [
|
|
6518
|
+
title ? /* @__PURE__ */ jsx58(SectionHeading, { id: titleId, as: titleAs, title, description: subtitle, actions: bar ?? action }) : /* @__PURE__ */ jsx58("div", { className: "flex justify-end", children: bar }),
|
|
6170
6519
|
body
|
|
6171
6520
|
] });
|
|
6172
6521
|
}
|
|
6173
6522
|
|
|
6174
6523
|
// src/MediaLabel.tsx
|
|
6175
|
-
import { jsx as
|
|
6524
|
+
import { jsx as jsx59 } from "react/jsx-runtime";
|
|
6176
6525
|
var FILL = {
|
|
6177
6526
|
TV: "bg-media-tv",
|
|
6178
6527
|
CTV: "bg-media-ctv",
|
|
@@ -6183,7 +6532,7 @@ var FILL = {
|
|
|
6183
6532
|
Magazine: "bg-media-magazine"
|
|
6184
6533
|
};
|
|
6185
6534
|
function MediaLabel({ type, className, testIdPrefix }) {
|
|
6186
|
-
return /* @__PURE__ */
|
|
6535
|
+
return /* @__PURE__ */ jsx59(
|
|
6187
6536
|
"span",
|
|
6188
6537
|
{
|
|
6189
6538
|
className: cn(
|
|
@@ -6198,10 +6547,10 @@ function MediaLabel({ type, className, testIdPrefix }) {
|
|
|
6198
6547
|
}
|
|
6199
6548
|
|
|
6200
6549
|
// src/SuggestionChip.tsx
|
|
6201
|
-
import { forwardRef as
|
|
6202
|
-
import { jsx as
|
|
6203
|
-
var SuggestionChip =
|
|
6204
|
-
return /* @__PURE__ */
|
|
6550
|
+
import { forwardRef as forwardRef11 } from "react";
|
|
6551
|
+
import { jsx as jsx60 } from "react/jsx-runtime";
|
|
6552
|
+
var SuggestionChip = forwardRef11(function SuggestionChip2({ children, className, testIdPrefix, type = "button", ...props }, ref) {
|
|
6553
|
+
return /* @__PURE__ */ jsx60(
|
|
6205
6554
|
"button",
|
|
6206
6555
|
{
|
|
6207
6556
|
ref,
|
|
@@ -6212,18 +6561,18 @@ var SuggestionChip = forwardRef10(function SuggestionChip2({ children, className
|
|
|
6212
6561
|
"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
6562
|
className
|
|
6214
6563
|
),
|
|
6215
|
-
children: /* @__PURE__ */
|
|
6564
|
+
children: /* @__PURE__ */ jsx60("span", { className: "truncate", children })
|
|
6216
6565
|
}
|
|
6217
6566
|
);
|
|
6218
6567
|
});
|
|
6219
6568
|
SuggestionChip.displayName = "SuggestionChip";
|
|
6220
6569
|
|
|
6221
6570
|
// src/ToggleChip.tsx
|
|
6222
|
-
import { forwardRef as
|
|
6223
|
-
import { Check as
|
|
6224
|
-
import { jsx as
|
|
6225
|
-
var ToggleChip =
|
|
6226
|
-
return /* @__PURE__ */
|
|
6571
|
+
import { forwardRef as forwardRef12 } from "react";
|
|
6572
|
+
import { Check as Check11 } from "lucide-react";
|
|
6573
|
+
import { jsx as jsx61, jsxs as jsxs52 } from "react/jsx-runtime";
|
|
6574
|
+
var ToggleChip = forwardRef12(function ToggleChip2({ selected, onChange, children, className, testIdPrefix, type = "button", onClick, ...props }, ref) {
|
|
6575
|
+
return /* @__PURE__ */ jsxs52(
|
|
6227
6576
|
"button",
|
|
6228
6577
|
{
|
|
6229
6578
|
ref,
|
|
@@ -6241,7 +6590,7 @@ var ToggleChip = forwardRef11(function ToggleChip2({ selected, onChange, childre
|
|
|
6241
6590
|
className
|
|
6242
6591
|
),
|
|
6243
6592
|
children: [
|
|
6244
|
-
selected && /* @__PURE__ */
|
|
6593
|
+
selected && /* @__PURE__ */ jsx61(Check11, { size: 14, "aria-hidden": "true", className: "-ml-0.5 shrink-0" }),
|
|
6245
6594
|
children
|
|
6246
6595
|
]
|
|
6247
6596
|
}
|
|
@@ -6250,14 +6599,14 @@ var ToggleChip = forwardRef11(function ToggleChip2({ selected, onChange, childre
|
|
|
6250
6599
|
ToggleChip.displayName = "ToggleChip";
|
|
6251
6600
|
|
|
6252
6601
|
// src/CopyButton.tsx
|
|
6253
|
-
import { forwardRef as
|
|
6254
|
-
import { Check as
|
|
6255
|
-
import { jsx as
|
|
6602
|
+
import { forwardRef as forwardRef13, useEffect as useEffect20, useRef as useRef22, useState as useState21 } from "react";
|
|
6603
|
+
import { Check as Check12, Copy } from "lucide-react";
|
|
6604
|
+
import { jsx as jsx62, jsxs as jsxs53 } from "react/jsx-runtime";
|
|
6256
6605
|
var CONFIRM_MS = 2e3;
|
|
6257
|
-
var CopyButton =
|
|
6258
|
-
const [copied, setCopied] =
|
|
6259
|
-
const timer =
|
|
6260
|
-
|
|
6606
|
+
var CopyButton = forwardRef13(function CopyButton2({ value, label, "aria-label": ariaLabel, size = "xs", className, testIdPrefix }, ref) {
|
|
6607
|
+
const [copied, setCopied] = useState21(false);
|
|
6608
|
+
const timer = useRef22(void 0);
|
|
6609
|
+
useEffect20(() => () => clearTimeout(timer.current), []);
|
|
6261
6610
|
const copy = async () => {
|
|
6262
6611
|
try {
|
|
6263
6612
|
await navigator.clipboard.writeText(typeof value === "function" ? value() : value);
|
|
@@ -6269,8 +6618,8 @@ var CopyButton = forwardRef12(function CopyButton2({ value, label, "aria-label":
|
|
|
6269
6618
|
timer.current = setTimeout(() => setCopied(false), CONFIRM_MS);
|
|
6270
6619
|
};
|
|
6271
6620
|
const iconSize = size === "xs" ? 13 : 15;
|
|
6272
|
-
const icon = copied ? /* @__PURE__ */
|
|
6273
|
-
return /* @__PURE__ */
|
|
6621
|
+
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" });
|
|
6622
|
+
return /* @__PURE__ */ jsxs53(
|
|
6274
6623
|
Button,
|
|
6275
6624
|
{
|
|
6276
6625
|
ref,
|
|
@@ -6284,8 +6633,8 @@ var CopyButton = forwardRef12(function CopyButton2({ value, label, "aria-label":
|
|
|
6284
6633
|
className: cn(!copied && "text-text-secondary", className),
|
|
6285
6634
|
children: [
|
|
6286
6635
|
icon,
|
|
6287
|
-
label && /* @__PURE__ */
|
|
6288
|
-
/* @__PURE__ */
|
|
6636
|
+
label && /* @__PURE__ */ jsx62("span", { children: copied ? "Copied" : label }),
|
|
6637
|
+
/* @__PURE__ */ jsx62("span", { role: "status", className: "sr-only", children: copied ? "Copied" : "" })
|
|
6289
6638
|
]
|
|
6290
6639
|
}
|
|
6291
6640
|
);
|
|
@@ -6294,7 +6643,7 @@ CopyButton.displayName = "CopyButton";
|
|
|
6294
6643
|
|
|
6295
6644
|
// src/InlineMessage.tsx
|
|
6296
6645
|
import { AlertTriangle as AlertTriangle2, CheckCircle2, Info as Info3, X as X8, XCircle } from "lucide-react";
|
|
6297
|
-
import { jsx as
|
|
6646
|
+
import { jsx as jsx63, jsxs as jsxs54 } from "react/jsx-runtime";
|
|
6298
6647
|
var BOX = {
|
|
6299
6648
|
info: "border-brand-primaryAction/30 bg-brand-primaryAction/10",
|
|
6300
6649
|
success: "border-status-success/40 bg-status-success/10",
|
|
@@ -6311,27 +6660,27 @@ var ICON_INK = {
|
|
|
6311
6660
|
var ICON2 = { info: Info3, success: CheckCircle2, warning: AlertTriangle2, danger: XCircle };
|
|
6312
6661
|
function InlineMessage({ tone = "info", title, children, actions, onDismiss, className, testIdPrefix }) {
|
|
6313
6662
|
const Icon = ICON2[tone];
|
|
6314
|
-
return /* @__PURE__ */
|
|
6663
|
+
return /* @__PURE__ */ jsxs54(
|
|
6315
6664
|
"div",
|
|
6316
6665
|
{
|
|
6317
6666
|
role: tone === "warning" || tone === "danger" ? "alert" : "status",
|
|
6318
6667
|
className: cn("flex items-start gap-2.5 rounded-control border px-3 py-2.5 text-sm", BOX[tone], className),
|
|
6319
6668
|
"data-testid": testIdPrefix,
|
|
6320
6669
|
children: [
|
|
6321
|
-
/* @__PURE__ */
|
|
6322
|
-
/* @__PURE__ */
|
|
6323
|
-
/* @__PURE__ */
|
|
6324
|
-
children && /* @__PURE__ */
|
|
6325
|
-
actions && /* @__PURE__ */
|
|
6670
|
+
/* @__PURE__ */ jsx63(Icon, { size: 16, "aria-hidden": "true", className: cn("mt-0.5 shrink-0", ICON_INK[tone]) }),
|
|
6671
|
+
/* @__PURE__ */ jsxs54("div", { className: "min-w-0 flex-1", children: [
|
|
6672
|
+
/* @__PURE__ */ jsx63("p", { className: "font-semibold text-text-primary", children: title }),
|
|
6673
|
+
children && /* @__PURE__ */ jsx63("div", { className: "mt-0.5 text-text-secondary", children }),
|
|
6674
|
+
actions && /* @__PURE__ */ jsx63("div", { className: "mt-2 flex flex-wrap items-center gap-2", children: actions })
|
|
6326
6675
|
] }),
|
|
6327
|
-
onDismiss && /* @__PURE__ */
|
|
6676
|
+
onDismiss && /* @__PURE__ */ jsx63(
|
|
6328
6677
|
"button",
|
|
6329
6678
|
{
|
|
6330
6679
|
type: "button",
|
|
6331
6680
|
onClick: onDismiss,
|
|
6332
6681
|
"aria-label": "Dismiss",
|
|
6333
6682
|
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__ */
|
|
6683
|
+
children: /* @__PURE__ */ jsx63(X8, { size: 14, "aria-hidden": "true" })
|
|
6335
6684
|
}
|
|
6336
6685
|
)
|
|
6337
6686
|
]
|
|
@@ -6340,9 +6689,9 @@ function InlineMessage({ tone = "info", title, children, actions, onDismiss, cla
|
|
|
6340
6689
|
}
|
|
6341
6690
|
|
|
6342
6691
|
// src/FilterDrawer.tsx
|
|
6343
|
-
import { useEffect as
|
|
6344
|
-
import { ChevronLeft as ChevronLeft5, ChevronRight as
|
|
6345
|
-
import { Fragment as
|
|
6692
|
+
import { useEffect as useEffect21, useLayoutEffect as useLayoutEffect8, useRef as useRef23, useState as useState22 } from "react";
|
|
6693
|
+
import { ChevronLeft as ChevronLeft5, ChevronRight as ChevronRight8 } from "lucide-react";
|
|
6694
|
+
import { Fragment as Fragment10, jsx as jsx64, jsxs as jsxs55 } from "react/jsx-runtime";
|
|
6346
6695
|
var SLIDE_MS = 200;
|
|
6347
6696
|
function reducedMotion() {
|
|
6348
6697
|
return typeof window !== "undefined" && !!window.matchMedia?.("(prefers-reduced-motion: reduce)").matches;
|
|
@@ -6362,12 +6711,12 @@ function FilterDrawer({
|
|
|
6362
6711
|
testIdPrefix
|
|
6363
6712
|
}) {
|
|
6364
6713
|
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] =
|
|
6714
|
+
const [openedWith, setOpenedWith] = useState22(() => marks(sections));
|
|
6715
|
+
const [confirming, setConfirming] = useState22(false);
|
|
6716
|
+
const [view, setViewState] = useState22(focus);
|
|
6717
|
+
const [leaving, setLeaving] = useState22(null);
|
|
6718
|
+
const [phase, setPhase] = useState22("run");
|
|
6719
|
+
const [wasOpen, setWasOpen] = useState22(open);
|
|
6371
6720
|
if (open !== wasOpen) {
|
|
6372
6721
|
setWasOpen(open);
|
|
6373
6722
|
setConfirming(false);
|
|
@@ -6389,20 +6738,20 @@ function FilterDrawer({
|
|
|
6389
6738
|
}
|
|
6390
6739
|
setViewState(next);
|
|
6391
6740
|
};
|
|
6392
|
-
|
|
6741
|
+
useLayoutEffect8(() => {
|
|
6393
6742
|
if (phase !== "start") return;
|
|
6394
6743
|
const raf = requestAnimationFrame(() => requestAnimationFrame(() => setPhase("run")));
|
|
6395
6744
|
return () => cancelAnimationFrame(raf);
|
|
6396
6745
|
}, [phase]);
|
|
6397
|
-
|
|
6746
|
+
useEffect21(() => {
|
|
6398
6747
|
if (!leaving || phase !== "run") return;
|
|
6399
6748
|
const t = setTimeout(() => setLeaving(null), SLIDE_MS);
|
|
6400
6749
|
return () => clearTimeout(t);
|
|
6401
6750
|
}, [leaving, phase]);
|
|
6402
|
-
const backRef =
|
|
6403
|
-
const rowRefs =
|
|
6404
|
-
const lastView =
|
|
6405
|
-
|
|
6751
|
+
const backRef = useRef23(null);
|
|
6752
|
+
const rowRefs = useRef23(/* @__PURE__ */ new Map());
|
|
6753
|
+
const lastView = useRef23(null);
|
|
6754
|
+
useEffect21(() => {
|
|
6406
6755
|
if (!open) return;
|
|
6407
6756
|
if (view) backRef.current?.focus();
|
|
6408
6757
|
else if (lastView.current) rowRefs.current.get(lastView.current)?.focus();
|
|
@@ -6415,8 +6764,8 @@ function FilterDrawer({
|
|
|
6415
6764
|
const outgoing = phase === "start" ? void 0 : dir > 0 ? "translateX(-33%)" : "translateX(100%)";
|
|
6416
6765
|
const panel = (v, rows = true) => {
|
|
6417
6766
|
const s = v ? sections.find((x) => x.id === v) : void 0;
|
|
6418
|
-
if (s) return /* @__PURE__ */
|
|
6419
|
-
return /* @__PURE__ */
|
|
6767
|
+
if (s) return /* @__PURE__ */ jsx64("div", { className: "border-t border-border-default px-5 pt-4", children: renderSection(s.id) });
|
|
6768
|
+
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
6769
|
"button",
|
|
6421
6770
|
{
|
|
6422
6771
|
ref: rows ? (el) => {
|
|
@@ -6428,7 +6777,7 @@ function FilterDrawer({
|
|
|
6428
6777
|
"data-testid": testIdPrefix && `${testIdPrefix}-row-${x.id}`,
|
|
6429
6778
|
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
6779
|
children: [
|
|
6431
|
-
/* @__PURE__ */
|
|
6780
|
+
/* @__PURE__ */ jsx64(
|
|
6432
6781
|
x.icon,
|
|
6433
6782
|
{
|
|
6434
6783
|
size: 17,
|
|
@@ -6436,15 +6785,15 @@ function FilterDrawer({
|
|
|
6436
6785
|
className: inUse(x) ? "text-brand-primaryAction" : "text-text-secondary"
|
|
6437
6786
|
}
|
|
6438
6787
|
),
|
|
6439
|
-
/* @__PURE__ */
|
|
6440
|
-
/* @__PURE__ */
|
|
6441
|
-
/* @__PURE__ */
|
|
6788
|
+
/* @__PURE__ */ jsx64("span", { className: "flex-1 text-sm font-medium text-text-primary", children: x.label }),
|
|
6789
|
+
/* @__PURE__ */ jsx64(SectionMark, { section: x }),
|
|
6790
|
+
/* @__PURE__ */ jsx64(ChevronRight8, { size: 16, "aria-hidden": "true", className: "shrink-0 text-text-secondary" })
|
|
6442
6791
|
]
|
|
6443
6792
|
}
|
|
6444
6793
|
) }, x.id)) });
|
|
6445
6794
|
};
|
|
6446
|
-
return /* @__PURE__ */
|
|
6447
|
-
/* @__PURE__ */
|
|
6795
|
+
return /* @__PURE__ */ jsxs55(Fragment10, { children: [
|
|
6796
|
+
/* @__PURE__ */ jsx64(
|
|
6448
6797
|
Modal,
|
|
6449
6798
|
{
|
|
6450
6799
|
open: open && confirming,
|
|
@@ -6453,9 +6802,9 @@ function FilterDrawer({
|
|
|
6453
6802
|
title: "Discard changes?",
|
|
6454
6803
|
description: "Your filter picks haven't been applied.",
|
|
6455
6804
|
testIdPrefix: testIdPrefix && `${testIdPrefix}-discard`,
|
|
6456
|
-
footer: /* @__PURE__ */
|
|
6457
|
-
/* @__PURE__ */
|
|
6458
|
-
/* @__PURE__ */
|
|
6805
|
+
footer: /* @__PURE__ */ jsxs55(Fragment10, { children: [
|
|
6806
|
+
/* @__PURE__ */ jsx64(Button, { variant: "secondary", size: "md", onClick: () => setConfirming(false), children: "Keep editing" }),
|
|
6807
|
+
/* @__PURE__ */ jsx64(
|
|
6459
6808
|
Button,
|
|
6460
6809
|
{
|
|
6461
6810
|
variant: "danger",
|
|
@@ -6470,15 +6819,15 @@ function FilterDrawer({
|
|
|
6470
6819
|
] })
|
|
6471
6820
|
}
|
|
6472
6821
|
),
|
|
6473
|
-
/* @__PURE__ */
|
|
6822
|
+
/* @__PURE__ */ jsx64(
|
|
6474
6823
|
Drawer,
|
|
6475
6824
|
{
|
|
6476
6825
|
open,
|
|
6477
6826
|
onClose: requestClose,
|
|
6478
6827
|
size,
|
|
6479
6828
|
testIdPrefix,
|
|
6480
|
-
title: focused ? /* @__PURE__ */
|
|
6481
|
-
/* @__PURE__ */
|
|
6829
|
+
title: focused ? /* @__PURE__ */ jsxs55("span", { className: "flex items-center gap-1.5", children: [
|
|
6830
|
+
/* @__PURE__ */ jsx64(
|
|
6482
6831
|
"button",
|
|
6483
6832
|
{
|
|
6484
6833
|
ref: backRef,
|
|
@@ -6487,25 +6836,25 @@ function FilterDrawer({
|
|
|
6487
6836
|
"aria-label": "Back to all filters",
|
|
6488
6837
|
"data-testid": testIdPrefix && `${testIdPrefix}-back`,
|
|
6489
6838
|
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__ */
|
|
6839
|
+
children: /* @__PURE__ */ jsx64(ChevronLeft5, { size: 18, "aria-hidden": "true" })
|
|
6491
6840
|
}
|
|
6492
6841
|
),
|
|
6493
6842
|
focused.label,
|
|
6494
|
-
(focused.count ?? 0) > 0 && /* @__PURE__ */
|
|
6495
|
-
focused.info && /* @__PURE__ */
|
|
6843
|
+
(focused.count ?? 0) > 0 && /* @__PURE__ */ jsx64(CountBadge, { count: focused.count }),
|
|
6844
|
+
focused.info && /* @__PURE__ */ jsx64(InfoTip, { text: focused.info, label: `About ${focused.label}` })
|
|
6496
6845
|
] }) : "Filters",
|
|
6497
6846
|
footer: focused ? (
|
|
6498
6847
|
// Picks are kept as they're made; Apply goes back to the list, and only
|
|
6499
6848
|
// See results, on the list, applies them to the page.
|
|
6500
|
-
/* @__PURE__ */
|
|
6501
|
-
/* @__PURE__ */
|
|
6502
|
-
/* @__PURE__ */
|
|
6849
|
+
/* @__PURE__ */ jsxs55("div", { className: "flex w-full items-center justify-between gap-2", children: [
|
|
6850
|
+
/* @__PURE__ */ jsx64(Button, { variant: "link", size: "md", onClick: () => onClearSection(focused.id), className: "px-0", children: "Clear" }),
|
|
6851
|
+
/* @__PURE__ */ jsx64(Button, { variant: "primary", size: "md", onClick: () => setView(null), testIdPrefix: testIdPrefix && `${testIdPrefix}-apply-section`, children: "Apply" })
|
|
6503
6852
|
] })
|
|
6504
|
-
) : /* @__PURE__ */
|
|
6505
|
-
/* @__PURE__ */
|
|
6506
|
-
/* @__PURE__ */
|
|
6507
|
-
/* @__PURE__ */
|
|
6508
|
-
/* @__PURE__ */
|
|
6853
|
+
) : /* @__PURE__ */ jsxs55("div", { className: "flex w-full items-center justify-between gap-2", children: [
|
|
6854
|
+
/* @__PURE__ */ jsx64(Button, { variant: "link", size: "md", onClick: onClearAll, className: "px-0", children: "Clear all" }),
|
|
6855
|
+
/* @__PURE__ */ jsxs55("div", { className: "flex items-center gap-2", children: [
|
|
6856
|
+
/* @__PURE__ */ jsx64(Button, { variant: "secondary", size: "md", onClick: onClose, children: "Cancel" }),
|
|
6857
|
+
/* @__PURE__ */ jsx64(
|
|
6509
6858
|
Button,
|
|
6510
6859
|
{
|
|
6511
6860
|
variant: "primary",
|
|
@@ -6519,8 +6868,8 @@ function FilterDrawer({
|
|
|
6519
6868
|
)
|
|
6520
6869
|
] })
|
|
6521
6870
|
] }),
|
|
6522
|
-
children: /* @__PURE__ */
|
|
6523
|
-
/* @__PURE__ */
|
|
6871
|
+
children: /* @__PURE__ */ jsxs55("div", { className: "relative -mx-5 overflow-x-clip", children: [
|
|
6872
|
+
/* @__PURE__ */ jsx64(
|
|
6524
6873
|
"div",
|
|
6525
6874
|
{
|
|
6526
6875
|
style: { transform: incoming },
|
|
@@ -6529,7 +6878,7 @@ function FilterDrawer({
|
|
|
6529
6878
|
},
|
|
6530
6879
|
view ?? "__list"
|
|
6531
6880
|
),
|
|
6532
|
-
leaving && /* @__PURE__ */
|
|
6881
|
+
leaving && /* @__PURE__ */ jsx64(
|
|
6533
6882
|
"div",
|
|
6534
6883
|
{
|
|
6535
6884
|
"aria-hidden": "true",
|
|
@@ -6546,22 +6895,22 @@ function FilterDrawer({
|
|
|
6546
6895
|
}
|
|
6547
6896
|
var inUse = (x) => (x.count ?? 0) > 0 || !!x.badge;
|
|
6548
6897
|
function CountBadge({ count }) {
|
|
6549
|
-
return /* @__PURE__ */
|
|
6898
|
+
return /* @__PURE__ */ jsxs55(Badge, { tone: "brandSolid", kind: "count", children: [
|
|
6550
6899
|
count,
|
|
6551
|
-
/* @__PURE__ */
|
|
6900
|
+
/* @__PURE__ */ jsx64("span", { className: "sr-only", children: " selected" })
|
|
6552
6901
|
] });
|
|
6553
6902
|
}
|
|
6554
6903
|
function SectionMark({ section }) {
|
|
6555
|
-
if ((section.count ?? 0) > 0) return /* @__PURE__ */
|
|
6556
|
-
return section.badge ? /* @__PURE__ */
|
|
6904
|
+
if ((section.count ?? 0) > 0) return /* @__PURE__ */ jsx64(CountBadge, { count: section.count });
|
|
6905
|
+
return section.badge ? /* @__PURE__ */ jsx64(Badge, { tone: "brand", children: section.badge }) : null;
|
|
6557
6906
|
}
|
|
6558
6907
|
|
|
6559
6908
|
// src/AllFiltersButton.tsx
|
|
6560
|
-
import { forwardRef as
|
|
6909
|
+
import { forwardRef as forwardRef14 } from "react";
|
|
6561
6910
|
import { SlidersHorizontal } from "lucide-react";
|
|
6562
|
-
import { jsx as
|
|
6563
|
-
var AllFiltersButton =
|
|
6564
|
-
return /* @__PURE__ */
|
|
6911
|
+
import { jsx as jsx65, jsxs as jsxs56 } from "react/jsx-runtime";
|
|
6912
|
+
var AllFiltersButton = forwardRef14(function AllFiltersButton2({ count = 0, open, className, testIdPrefix, ...rest }, ref) {
|
|
6913
|
+
return /* @__PURE__ */ jsxs56(
|
|
6565
6914
|
"button",
|
|
6566
6915
|
{
|
|
6567
6916
|
ref,
|
|
@@ -6573,105 +6922,14 @@ var AllFiltersButton = forwardRef13(function AllFiltersButton2({ count = 0, open
|
|
|
6573
6922
|
className: cn(chipTriggerClass(), className),
|
|
6574
6923
|
...rest,
|
|
6575
6924
|
children: [
|
|
6576
|
-
/* @__PURE__ */
|
|
6577
|
-
/* @__PURE__ */
|
|
6578
|
-
count > 0 && /* @__PURE__ */
|
|
6925
|
+
/* @__PURE__ */ jsx65(SlidersHorizontal, { size: 15, "aria-hidden": "true", className: "text-text-secondary" }),
|
|
6926
|
+
/* @__PURE__ */ jsx65("span", { className: "text-dense font-medium text-text-primary", children: "All filters" }),
|
|
6927
|
+
count > 0 && /* @__PURE__ */ jsx65(Badge, { tone: "brandSolid", kind: "count", children: count })
|
|
6579
6928
|
]
|
|
6580
6929
|
}
|
|
6581
6930
|
);
|
|
6582
6931
|
});
|
|
6583
6932
|
|
|
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
6933
|
// src/dates.ts
|
|
6676
6934
|
var MONTHS2 = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
|
|
6677
6935
|
var MONTHS_LONG = [
|
|
@@ -6783,15 +7041,15 @@ function defaultDateOrder(country) {
|
|
|
6783
7041
|
}
|
|
6784
7042
|
|
|
6785
7043
|
// src/Figure.tsx
|
|
6786
|
-
import { Fragment as
|
|
7044
|
+
import { Fragment as Fragment11, jsx as jsx66, jsxs as jsxs57 } from "react/jsx-runtime";
|
|
6787
7045
|
function Figure({ value, kind = "money", missing, ...opts }) {
|
|
6788
|
-
if (value === null || value === void 0 || Number.isNaN(value)) return /* @__PURE__ */
|
|
7046
|
+
if (value === null || value === void 0 || Number.isNaN(value)) return /* @__PURE__ */ jsx66(NoValue, { reason: missing });
|
|
6789
7047
|
const short = kind === "money" ? formatMoney(value, opts) : formatCount(value, opts);
|
|
6790
7048
|
const full = kind === "money" ? formatMoneyFull(value, opts) : formatCountFull(value);
|
|
6791
|
-
if (short === full) return /* @__PURE__ */
|
|
6792
|
-
return /* @__PURE__ */
|
|
6793
|
-
/* @__PURE__ */
|
|
6794
|
-
/* @__PURE__ */
|
|
7049
|
+
if (short === full) return /* @__PURE__ */ jsx66(Fragment11, { children: short });
|
|
7050
|
+
return /* @__PURE__ */ jsxs57(Tooltip, { label: full, delay: 300, children: [
|
|
7051
|
+
/* @__PURE__ */ jsx66("span", { "aria-hidden": "true", children: short }),
|
|
7052
|
+
/* @__PURE__ */ jsx66("span", { className: "sr-only", children: full })
|
|
6795
7053
|
] });
|
|
6796
7054
|
}
|
|
6797
7055
|
export {
|