@mediaradar/design-components 0.50.1 → 0.53.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 +2 -1
- package/dist/index.cjs +148 -31
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +154 -23
- package/dist/index.d.ts +154 -23
- package/dist/index.js +144 -31
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -224,6 +224,12 @@ function AdvertiserQuickFilter({
|
|
|
224
224
|
setOpen(false);
|
|
225
225
|
setQ("");
|
|
226
226
|
};
|
|
227
|
+
const clearAll = () => {
|
|
228
|
+
setDraft(clearValue);
|
|
229
|
+
onChange(clearValue);
|
|
230
|
+
setOpen(false);
|
|
231
|
+
setQ("");
|
|
232
|
+
};
|
|
227
233
|
useEffect2(() => {
|
|
228
234
|
if (!open) return;
|
|
229
235
|
inputRef.current?.focus();
|
|
@@ -301,7 +307,7 @@ function AdvertiserQuickFilter({
|
|
|
301
307
|
"div",
|
|
302
308
|
{
|
|
303
309
|
className: cn(
|
|
304
|
-
"absolute top-
|
|
310
|
+
"absolute top-full mt-2 z-30 flex w-72 flex-col overflow-hidden rounded-card border border-border-default bg-surface shadow-overlay",
|
|
305
311
|
align === "right" ? "right-0" : "left-0"
|
|
306
312
|
),
|
|
307
313
|
role: "dialog",
|
|
@@ -335,7 +341,7 @@ function AdvertiserQuickFilter({
|
|
|
335
341
|
}
|
|
336
342
|
)
|
|
337
343
|
] }) }),
|
|
338
|
-
/* @__PURE__ */ jsxs4("div", { className: "max-h-
|
|
344
|
+
/* @__PURE__ */ jsxs4("div", { className: "max-h-75 overflow-y-auto p-1", children: [
|
|
339
345
|
selectedOptions.length > 0 && /* @__PURE__ */ jsxs4("div", { className: "mb-1 border-b border-border-default pb-1", children: [
|
|
340
346
|
/* @__PURE__ */ jsxs4(
|
|
341
347
|
"button",
|
|
@@ -429,7 +435,7 @@ function AdvertiserQuickFilter({
|
|
|
429
435
|
{
|
|
430
436
|
type: "button",
|
|
431
437
|
"data-testid": testIdPrefix && `${testIdPrefix}-clear-all`,
|
|
432
|
-
onClick:
|
|
438
|
+
onClick: clearAll,
|
|
433
439
|
disabled: draft.length === 0,
|
|
434
440
|
className: "text-dense font-medium text-text-secondary transition-colors hover:text-text-primary disabled:opacity-40 focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-border-focus",
|
|
435
441
|
children: "Clear all"
|
|
@@ -492,7 +498,7 @@ function OptionRow({
|
|
|
492
498
|
className: cn(
|
|
493
499
|
// scroll-my-1: Tab scrolls the list just far enough to show the box,
|
|
494
500
|
// which would leave its 3px ring cut off at the list's edge.
|
|
495
|
-
"flex h-
|
|
501
|
+
"flex h-4.5 w-4.5 shrink-0 scroll-my-1 items-center justify-center rounded-small border transition-colors",
|
|
496
502
|
"focus-visible:outline-solid focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-border-focus",
|
|
497
503
|
checked ? "border-transparent bg-brand-primaryAction text-brand-onprimary" : "border-border-interactive bg-surface hover:border-brand-primaryAction"
|
|
498
504
|
),
|
|
@@ -554,7 +560,7 @@ var KIND = {
|
|
|
554
560
|
// Square-ish and centred, with a floor width so a 1-digit and a 3-digit
|
|
555
561
|
// count are the same shape, and lining figures so the width does not shift
|
|
556
562
|
// as the number changes.
|
|
557
|
-
count: "h-
|
|
563
|
+
count: "h-4.5 min-w-4.5 justify-center px-1.5 tabular-nums",
|
|
558
564
|
// The only kind that shouts. Caps need the letterspacing -- caps set tight
|
|
559
565
|
// are harder to read than the sentence case they replaced.
|
|
560
566
|
eyebrow: "px-2.5 py-1 uppercase tracking-wider",
|
|
@@ -998,7 +1004,7 @@ function DateRangeFilter({
|
|
|
998
1004
|
{
|
|
999
1005
|
"data-testid": testIdPrefix && `${testIdPrefix}-popover`,
|
|
1000
1006
|
ref: popRef,
|
|
1001
|
-
className: `absolute z-30 flex overflow-hidden rounded-card border border-border-default bg-surface shadow-overlay ${placement === "right" ? "bottom-0 left-full ml-2" : `${above ? "bottom-full mb-2" : "top-
|
|
1007
|
+
className: `absolute z-30 flex overflow-hidden rounded-card border border-border-default bg-surface shadow-overlay ${placement === "right" ? "bottom-0 left-full ml-2" : `${above ? "bottom-full mb-2" : "top-full mt-2"} ${align === "right" ? "right-0" : "left-0"}`}`,
|
|
1002
1008
|
role: "dialog",
|
|
1003
1009
|
"aria-label": "Select date range",
|
|
1004
1010
|
children: [
|
|
@@ -1023,7 +1029,7 @@ function DateRangeFilter({
|
|
|
1023
1029
|
/* @__PURE__ */ jsx8("div", { className: "flex gap-8", children: [0, 1].map((offset) => {
|
|
1024
1030
|
const m = addMonths(leftMonth, offset);
|
|
1025
1031
|
const grid = monthGrid(m.getFullYear(), m.getMonth());
|
|
1026
|
-
return /* @__PURE__ */ jsxs7("div", { className: "w-
|
|
1032
|
+
return /* @__PURE__ */ jsxs7("div", { className: "w-63", children: [
|
|
1027
1033
|
/* @__PURE__ */ jsxs7("div", { className: "mb-2 flex items-center justify-between", children: [
|
|
1028
1034
|
offset === 0 ? /* @__PURE__ */ jsx8(NavBtn, { onClick: () => setLeftMonth(addMonths(leftMonth, -1)), "aria-label": "Previous month", children: /* @__PURE__ */ jsx8(ChevronLeft, { size: 16 }) }) : /* @__PURE__ */ jsx8("span", { className: "h-7 w-7" }),
|
|
1029
1035
|
/* @__PURE__ */ jsxs7("span", { id: `${monthIdBase}-m${offset}`, "aria-live": "polite", className: "text-panel-title font-semibold text-text-primary", children: [
|
|
@@ -1058,7 +1064,7 @@ function DateRangeFilter({
|
|
|
1058
1064
|
"aria-pressed": endpoint || inRange,
|
|
1059
1065
|
className: "relative flex h-9 items-center justify-center focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-border-focus",
|
|
1060
1066
|
children: [
|
|
1061
|
-
band && /* @__PURE__ */ jsx8("span", { className: `absolute inset-y-
|
|
1067
|
+
band && /* @__PURE__ */ jsx8("span", { className: `absolute inset-y-1 bg-ai-tint ${band}`, "aria-hidden": "true" }),
|
|
1062
1068
|
/* @__PURE__ */ jsx8(
|
|
1063
1069
|
"span",
|
|
1064
1070
|
{
|
|
@@ -1120,7 +1126,7 @@ function DateRangeFilter({
|
|
|
1120
1126
|
function Field({ label, value }) {
|
|
1121
1127
|
return /* @__PURE__ */ jsxs7("div", { className: "flex flex-col gap-1.5", children: [
|
|
1122
1128
|
/* @__PURE__ */ jsx8("span", { className: "text-xs font-medium text-text-secondary", children: label }),
|
|
1123
|
-
/* @__PURE__ */ jsx8("div", { className: "flex h-10 min-w-
|
|
1129
|
+
/* @__PURE__ */ jsx8("div", { className: "flex h-10 min-w-35 items-center rounded-control border border-border-strong bg-input px-3 text-sm font-medium text-text-primary", children: value })
|
|
1124
1130
|
] });
|
|
1125
1131
|
}
|
|
1126
1132
|
function NavBtn({ children, onClick, ...rest }) {
|
|
@@ -1239,7 +1245,7 @@ var SearchBar = forwardRef2(function SearchBar2({
|
|
|
1239
1245
|
// flex-auto, not flex-1: flex-1's 0% basis took the height away in a
|
|
1240
1246
|
// column (a filter panel's stack), squashing the sm box from 32px to
|
|
1241
1247
|
// its text's 22px. auto keeps the h-8/10/11 and still fills a row.
|
|
1242
|
-
"relative flex min-w-
|
|
1248
|
+
"relative flex min-w-50 flex-auto items-stretch rounded-control border border-border-strong bg-input focus-within:outline-2 focus-within:outline-offset-1 focus-within:outline-border-focus",
|
|
1243
1249
|
HEIGHT[size],
|
|
1244
1250
|
className
|
|
1245
1251
|
),
|
|
@@ -1447,7 +1453,7 @@ var SearchBar = forwardRef2(function SearchBar2({
|
|
|
1447
1453
|
role: "dialog",
|
|
1448
1454
|
"aria-label": "Search match type",
|
|
1449
1455
|
"data-testid": testIdPrefix && `${testIdPrefix}-mode-popover`,
|
|
1450
|
-
className: "absolute right-0 top-
|
|
1456
|
+
className: "absolute right-0 top-full mt-2 z-50 w-100 rounded-card border border-border-default bg-surface p-3 shadow-overlay",
|
|
1451
1457
|
children: /* @__PURE__ */ jsxs8("div", { role: "radiogroup", "aria-label": "Search match type", className: "flex flex-col", children: [
|
|
1452
1458
|
/* @__PURE__ */ jsx9(
|
|
1453
1459
|
ModeRow,
|
|
@@ -1644,7 +1650,7 @@ function RowInfoTip({ text }) {
|
|
|
1644
1650
|
{
|
|
1645
1651
|
id,
|
|
1646
1652
|
hidden: !open,
|
|
1647
|
-
className: "absolute left-0 top-
|
|
1653
|
+
className: "absolute left-0 top-full mt-1.5 z-40 w-55 rounded-control border border-border-default bg-surface px-2.5 py-1.5 text-xs font-normal leading-snug text-text-secondary shadow-overlay",
|
|
1648
1654
|
children: text
|
|
1649
1655
|
}
|
|
1650
1656
|
)
|
|
@@ -1897,7 +1903,7 @@ function DataScopeFilter({ value, onChange, align = "right", className, testIdPr
|
|
|
1897
1903
|
"aria-label": "Data",
|
|
1898
1904
|
"data-testid": testIdPrefix && `${testIdPrefix}-popover`,
|
|
1899
1905
|
className: cn(
|
|
1900
|
-
"absolute top-
|
|
1906
|
+
"absolute top-full mt-2 z-30 min-w-55 overflow-hidden rounded-card border border-border-default bg-surface p-1 shadow-overlay",
|
|
1901
1907
|
align === "right" ? "right-0" : "left-0"
|
|
1902
1908
|
),
|
|
1903
1909
|
children: [
|
|
@@ -2091,7 +2097,7 @@ function SelectFilter({
|
|
|
2091
2097
|
),
|
|
2092
2098
|
role: loading || error ? "group" : "listbox",
|
|
2093
2099
|
"aria-label": caption,
|
|
2094
|
-
children: loading ? /* @__PURE__ */ jsx13(MenuLoading, {}) : error ? /* @__PURE__ */ jsx13(MenuError, { onRetry }) : /* @__PURE__ */ jsx13("div", { className: "max-h-
|
|
2100
|
+
children: loading ? /* @__PURE__ */ jsx13(MenuLoading, {}) : error ? /* @__PURE__ */ jsx13(MenuError, { onRetry }) : /* @__PURE__ */ jsx13("div", { className: "max-h-70 overflow-y-auto p-1", children: options.map((o) => {
|
|
2095
2101
|
const selected = o === value;
|
|
2096
2102
|
return /* @__PURE__ */ jsxs12(
|
|
2097
2103
|
"button",
|
|
@@ -2185,7 +2191,7 @@ function NoResultsEmptyState({
|
|
|
2185
2191
|
return /* @__PURE__ */ jsxs14("div", { className: cn("flex flex-col items-center justify-center gap-3 text-center", className), "data-testid": testIdPrefix, children: [
|
|
2186
2192
|
/* @__PURE__ */ jsx15("span", { className: "flex h-11 w-11 items-center justify-center rounded-full bg-subtle text-text-tertiary", children: /* @__PURE__ */ jsx15(FilterX, { size: 20, "aria-hidden": "true" }) }),
|
|
2187
2193
|
/* @__PURE__ */ jsx15("h2", { className: "text-base font-semibold text-text-primary", children: title }),
|
|
2188
|
-
/* @__PURE__ */ jsx15("p", { className: "max-w-
|
|
2194
|
+
/* @__PURE__ */ jsx15("p", { className: "max-w-105 text-dense leading-relaxed text-text-secondary", children: bodyText }),
|
|
2189
2195
|
hasActions && /* @__PURE__ */ jsxs14("div", { className: "mt-1 flex flex-col items-center gap-3", children: [
|
|
2190
2196
|
showClear && /* @__PURE__ */ jsx15(
|
|
2191
2197
|
"button",
|
|
@@ -2357,7 +2363,7 @@ function AxisFrame({
|
|
|
2357
2363
|
{
|
|
2358
2364
|
className: "absolute bottom-0 right-0 flex items-center",
|
|
2359
2365
|
style: { left: Y_AXIS_W, height: X_AXIS_H },
|
|
2360
|
-
children: Array.from({ length: xTicks }, (_, i) => /* @__PURE__ */ jsx17("div", { className: "flex flex-1 justify-center", children: /* @__PURE__ */ jsx17("div", { className: "h-2 w-full max-w-
|
|
2366
|
+
children: Array.from({ length: xTicks }, (_, i) => /* @__PURE__ */ jsx17("div", { className: "flex flex-1 justify-center", children: /* @__PURE__ */ jsx17("div", { className: "h-2 w-full max-w-6.5 rounded-xs bg-subtle" }) }, i))
|
|
2361
2367
|
}
|
|
2362
2368
|
)
|
|
2363
2369
|
] }) });
|
|
@@ -3431,7 +3437,7 @@ function Monogram({ name, size = 28 }) {
|
|
|
3431
3437
|
"span",
|
|
3432
3438
|
{
|
|
3433
3439
|
"aria-hidden": "true",
|
|
3434
|
-
className: "flex shrink-0 items-center justify-center rounded-
|
|
3440
|
+
className: "flex shrink-0 items-center justify-center rounded-control bg-subtle font-bold leading-none text-text-secondary",
|
|
3435
3441
|
style: { width: size, height: size, fontSize: Math.round(size * 0.36) },
|
|
3436
3442
|
children: initials(name)
|
|
3437
3443
|
}
|
|
@@ -3447,7 +3453,7 @@ function DelayedTip({ label, children }) {
|
|
|
3447
3453
|
"span",
|
|
3448
3454
|
{
|
|
3449
3455
|
role: "tooltip",
|
|
3450
|
-
className: "pointer-events-none invisible absolute bottom-
|
|
3456
|
+
className: "pointer-events-none invisible absolute bottom-full mb-1.5 left-1/2 z-40 w-40 -translate-x-1/2 rounded-control border border-border-default bg-surface px-2 py-1.5 text-center text-micro font-medium leading-snug text-text-secondary opacity-0 shadow-overlay transition-[opacity,visibility] delay-1000 duration-150 group-hover/dt:visible group-hover/dt:opacity-100 group-focus/dt:visible group-focus/dt:opacity-100",
|
|
3451
3457
|
children: label
|
|
3452
3458
|
}
|
|
3453
3459
|
)
|
|
@@ -4332,7 +4338,7 @@ function DateRangePicker({
|
|
|
4332
4338
|
]
|
|
4333
4339
|
}
|
|
4334
4340
|
),
|
|
4335
|
-
open && /* @__PURE__ */ jsxs35("div", { className: cn("absolute top-
|
|
4341
|
+
open && /* @__PURE__ */ jsxs35("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: [
|
|
4336
4342
|
presets.map((p) => /* @__PURE__ */ jsx39(
|
|
4337
4343
|
"button",
|
|
4338
4344
|
{
|
|
@@ -4383,6 +4389,7 @@ function DateRangePicker({
|
|
|
4383
4389
|
import { useCallback as useCallback4, useEffect as useEffect13, useRef as useRef15, useState as useState14 } from "react";
|
|
4384
4390
|
import { ChevronDown as ChevronDown10, Search as Search5, X as X5 } from "lucide-react";
|
|
4385
4391
|
import { Fragment as Fragment4, jsx as jsx40, jsxs as jsxs36 } from "react/jsx-runtime";
|
|
4392
|
+
var SEARCH_AFTER = 8;
|
|
4386
4393
|
function MultiSelectFilter({
|
|
4387
4394
|
caption,
|
|
4388
4395
|
options = [],
|
|
@@ -4392,7 +4399,7 @@ function MultiSelectFilter({
|
|
|
4392
4399
|
selected,
|
|
4393
4400
|
onChange,
|
|
4394
4401
|
allLabel = "All",
|
|
4395
|
-
searchable
|
|
4402
|
+
searchable,
|
|
4396
4403
|
searchPlaceholder,
|
|
4397
4404
|
align = "left",
|
|
4398
4405
|
fullIsAll = false,
|
|
@@ -4414,6 +4421,7 @@ function MultiSelectFilter({
|
|
|
4414
4421
|
}) {
|
|
4415
4422
|
const groupLeaves = (g) => g.children.length ? g.children : [{ id: g.id, label: g.label }];
|
|
4416
4423
|
const leafOptions = groups ? groups.flatMap(groupLeaves) : options;
|
|
4424
|
+
const showSearch = searchable ?? leafOptions.length > SEARCH_AFTER;
|
|
4417
4425
|
const [open, setOpen] = useState14(false);
|
|
4418
4426
|
const [q, setQ] = useState14("");
|
|
4419
4427
|
const [draft, setDraft] = useState14(selected);
|
|
@@ -4435,6 +4443,12 @@ function MultiSelectFilter({
|
|
|
4435
4443
|
setOpen(false);
|
|
4436
4444
|
setQ("");
|
|
4437
4445
|
};
|
|
4446
|
+
const clearAll = () => {
|
|
4447
|
+
setDraft(clearValue);
|
|
4448
|
+
onChange(clearValue);
|
|
4449
|
+
setOpen(false);
|
|
4450
|
+
setQ("");
|
|
4451
|
+
};
|
|
4438
4452
|
useEffect13(() => {
|
|
4439
4453
|
if (!open) return;
|
|
4440
4454
|
const onKey = (e) => e.key === "Escape" && close();
|
|
@@ -4511,7 +4525,7 @@ function MultiSelectFilter({
|
|
|
4511
4525
|
"div",
|
|
4512
4526
|
{
|
|
4513
4527
|
className: cn(
|
|
4514
|
-
"absolute top-
|
|
4528
|
+
"absolute top-full mt-2 z-30 flex flex-col overflow-hidden rounded-card border border-border-default bg-surface shadow-overlay",
|
|
4515
4529
|
menuWidthClass,
|
|
4516
4530
|
align === "right" ? "right-0" : "left-0"
|
|
4517
4531
|
),
|
|
@@ -4519,7 +4533,7 @@ function MultiSelectFilter({
|
|
|
4519
4533
|
role: "dialog",
|
|
4520
4534
|
"aria-label": caption,
|
|
4521
4535
|
children: loading ? /* @__PURE__ */ jsx40(MenuLoading, {}) : error ? /* @__PURE__ */ jsx40(MenuError, { onRetry }) : /* @__PURE__ */ jsxs36(Fragment4, { children: [
|
|
4522
|
-
|
|
4536
|
+
showSearch && /* @__PURE__ */ jsx40("div", { className: "border-b border-border-default p-2", children: /* @__PURE__ */ jsxs36("div", { className: "flex h-8 items-center gap-2 rounded-control border border-border-strong bg-input px-2.5 focus-within:outline-2 focus-within:outline-offset-1 focus-within:outline-border-focus", children: [
|
|
4523
4537
|
/* @__PURE__ */ jsx40(Search5, { size: 14, className: "text-text-secondary", "aria-hidden": "true" }),
|
|
4524
4538
|
/* @__PURE__ */ jsx40(
|
|
4525
4539
|
"input",
|
|
@@ -4533,7 +4547,7 @@ function MultiSelectFilter({
|
|
|
4533
4547
|
),
|
|
4534
4548
|
q && /* @__PURE__ */ jsx40("button", { type: "button", onClick: () => setQ(""), "aria-label": "Clear search", className: "text-text-tertiary hover:text-text-primary focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-border-focus", children: /* @__PURE__ */ jsx40(X5, { size: 13 }) })
|
|
4535
4549
|
] }) }),
|
|
4536
|
-
/* @__PURE__ */ jsxs36("div", { className: "max-h-
|
|
4550
|
+
/* @__PURE__ */ jsxs36("div", { className: "max-h-70 overflow-y-auto p-1", children: [
|
|
4537
4551
|
groups ? visibleGroups.map((g) => {
|
|
4538
4552
|
const state = groupState(g);
|
|
4539
4553
|
return /* @__PURE__ */ jsxs36("div", { children: [
|
|
@@ -4588,7 +4602,7 @@ function MultiSelectFilter({
|
|
|
4588
4602
|
(groups && !visibleGroups.length || !groups && !items.length) && /* @__PURE__ */ jsx40("div", { className: "py-6 text-center text-dense text-text-tertiary", children: "No matches." })
|
|
4589
4603
|
] }),
|
|
4590
4604
|
note && /* @__PURE__ */ jsx40("p", { className: "border-t border-border-default px-3 py-2 text-xs text-text-tertiary", children: note }),
|
|
4591
|
-
showFooter ? /* @__PURE__ */ jsx40(FilterDropdownFooter, { onClear:
|
|
4605
|
+
showFooter ? /* @__PURE__ */ jsx40(FilterDropdownFooter, { onClear: clearAll, onApply: apply }) : min === 0 && draft.length > 0 && /* @__PURE__ */ jsx40("div", { className: "border-t border-border-default p-2", children: /* @__PURE__ */ jsxs36(
|
|
4592
4606
|
"button",
|
|
4593
4607
|
{
|
|
4594
4608
|
type: "button",
|
|
@@ -4617,8 +4631,8 @@ function OptionCount({ n }) {
|
|
|
4617
4631
|
import { forwardRef as forwardRef6 } from "react";
|
|
4618
4632
|
import { jsx as jsx41 } from "react/jsx-runtime";
|
|
4619
4633
|
var SIZES2 = {
|
|
4620
|
-
sm: { track: "h-5 w-9", knob: "h-4 w-4", on: "translate-x-
|
|
4621
|
-
md: { track: "h-6 w-11", knob: "h-5 w-5", on: "translate-x-
|
|
4634
|
+
sm: { track: "h-5 w-9", knob: "h-4 w-4", on: "translate-x-4.5" },
|
|
4635
|
+
md: { track: "h-6 w-11", knob: "h-5 w-5", on: "translate-x-5.5" }
|
|
4622
4636
|
};
|
|
4623
4637
|
var OFF_TRACK = "color-mix(in srgb, var(--mr-color-border-interactive) 70%, var(--mr-color-text-secondary))";
|
|
4624
4638
|
var Toggle = forwardRef6(function Toggle2({ checked, onChange, label, size = "md", disabled, className, testIdPrefix }, ref) {
|
|
@@ -4666,7 +4680,7 @@ function AISpark({ size = 16, className, testIdPrefix }) {
|
|
|
4666
4680
|
return /* @__PURE__ */ jsxs37(Fragment5, { children: [
|
|
4667
4681
|
/* @__PURE__ */ jsx42("svg", { width: "0", height: "0", "aria-hidden": "true", style: { position: "absolute" }, children: /* @__PURE__ */ jsx42("defs", { children: /* @__PURE__ */ jsxs37("linearGradient", { id, x1: "0", y1: "0", x2: "1", y2: "1", children: [
|
|
4668
4682
|
/* @__PURE__ */ jsx42("stop", { offset: "0%", stopColor: "var(--mr-color-brand-primary)" }),
|
|
4669
|
-
/* @__PURE__ */ jsx42("stop", { offset: "100%",
|
|
4683
|
+
/* @__PURE__ */ jsx42("stop", { offset: "100%", stopColor: "var(--mr-color-ai-violet)" })
|
|
4670
4684
|
] }) }) }),
|
|
4671
4685
|
/* @__PURE__ */ jsx42(Sparkles, { size, stroke: `url(#${id})`, className, "data-testid": testIdPrefix, "aria-hidden": "true" })
|
|
4672
4686
|
] });
|
|
@@ -5373,7 +5387,7 @@ function FilterDrawer({
|
|
|
5373
5387
|
const outgoing = phase === "start" ? void 0 : dir > 0 ? "translateX(-33%)" : "translateX(100%)";
|
|
5374
5388
|
const panel = (v, rows = true) => {
|
|
5375
5389
|
const s = v ? sections.find((x) => x.id === v) : void 0;
|
|
5376
|
-
if (s) return /* @__PURE__ */ jsx56("div", { className: "px-5 pt-
|
|
5390
|
+
if (s) return /* @__PURE__ */ jsx56("div", { className: "border-t border-border-default px-5 pt-4", children: renderSection(s.id) });
|
|
5377
5391
|
return /* @__PURE__ */ jsx56("ul", { className: "border-t border-border-default", children: sections.map((x) => /* @__PURE__ */ jsx56("li", { className: "border-b border-border-default", children: /* @__PURE__ */ jsxs48(
|
|
5378
5392
|
"button",
|
|
5379
5393
|
{
|
|
@@ -5427,8 +5441,11 @@ function FilterDrawer({
|
|
|
5427
5441
|
"Filters",
|
|
5428
5442
|
activeCount > 0 && /* @__PURE__ */ jsx56(Badge, { tone: "brandSolid", kind: "count", children: activeCount })
|
|
5429
5443
|
] }),
|
|
5430
|
-
footer:
|
|
5431
|
-
|
|
5444
|
+
footer: focused ? (
|
|
5445
|
+
// Picks are kept as they're made; only See results, on the list, applies them.
|
|
5446
|
+
/* @__PURE__ */ jsx56("div", { className: "flex w-full items-center", children: /* @__PURE__ */ jsx56(Button, { variant: "link", size: "md", onClick: () => onClearSection(focused.id), className: "px-0", children: "Clear" }) })
|
|
5447
|
+
) : /* @__PURE__ */ jsxs48("div", { className: "flex w-full items-center justify-between gap-2", children: [
|
|
5448
|
+
/* @__PURE__ */ jsx56(Button, { variant: "link", size: "md", onClick: onClearAll, className: "px-0", children: "Clear all" }),
|
|
5432
5449
|
/* @__PURE__ */ jsxs48("div", { className: "flex items-center gap-2", children: [
|
|
5433
5450
|
/* @__PURE__ */ jsx56(Button, { variant: "secondary", size: "md", onClick: onClose, children: "Cancel" }),
|
|
5434
5451
|
/* @__PURE__ */ jsx56(
|
|
@@ -5440,7 +5457,7 @@ function FilterDrawer({
|
|
|
5440
5457
|
onApply();
|
|
5441
5458
|
onClose();
|
|
5442
5459
|
},
|
|
5443
|
-
children: "
|
|
5460
|
+
children: "See results"
|
|
5444
5461
|
}
|
|
5445
5462
|
)
|
|
5446
5463
|
] })
|
|
@@ -5494,6 +5511,98 @@ var AllFiltersButton = forwardRef11(function AllFiltersButton2({ count = 0, open
|
|
|
5494
5511
|
}
|
|
5495
5512
|
);
|
|
5496
5513
|
});
|
|
5514
|
+
|
|
5515
|
+
// src/Menu.tsx
|
|
5516
|
+
import { forwardRef as forwardRef12 } from "react";
|
|
5517
|
+
import { Slot as Slot2, Slottable } from "@radix-ui/react-slot";
|
|
5518
|
+
import { Check as Check10, ChevronRight as ChevronRight7 } from "lucide-react";
|
|
5519
|
+
import { Fragment as Fragment6, jsx as jsx58, jsxs as jsxs50 } from "react/jsx-runtime";
|
|
5520
|
+
var ROW_SELECTOR = '[role^="menuitem"]:not([aria-disabled="true"]):not(:disabled)';
|
|
5521
|
+
function moveFocus(e) {
|
|
5522
|
+
const keys = ["ArrowDown", "ArrowUp", "Home", "End"];
|
|
5523
|
+
if (!keys.includes(e.key)) return;
|
|
5524
|
+
const rows = Array.from(e.currentTarget.querySelectorAll(ROW_SELECTOR));
|
|
5525
|
+
if (!rows.length) return;
|
|
5526
|
+
e.preventDefault();
|
|
5527
|
+
const i = rows.indexOf(document.activeElement);
|
|
5528
|
+
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;
|
|
5529
|
+
rows[next].focus();
|
|
5530
|
+
}
|
|
5531
|
+
var Menu = forwardRef12(
|
|
5532
|
+
({ className, testIdPrefix, onKeyDown, children, ...props }, ref) => /* @__PURE__ */ jsx58(
|
|
5533
|
+
"div",
|
|
5534
|
+
{
|
|
5535
|
+
ref,
|
|
5536
|
+
role: "menu",
|
|
5537
|
+
"data-testid": testIdPrefix,
|
|
5538
|
+
onKeyDown: (e) => {
|
|
5539
|
+
moveFocus(e);
|
|
5540
|
+
onKeyDown?.(e);
|
|
5541
|
+
},
|
|
5542
|
+
className: cn("flex flex-col p-1", className),
|
|
5543
|
+
...props,
|
|
5544
|
+
children
|
|
5545
|
+
}
|
|
5546
|
+
)
|
|
5547
|
+
);
|
|
5548
|
+
Menu.displayName = "Menu";
|
|
5549
|
+
var MenuItem = forwardRef12(
|
|
5550
|
+
({ className, testIdPrefix, icon, trailing, description, submenu, checked, danger, disabled, asChild = false, children, ...props }, ref) => {
|
|
5551
|
+
const Comp = asChild ? Slot2 : "button";
|
|
5552
|
+
const radio = checked !== void 0;
|
|
5553
|
+
const body = /* @__PURE__ */ jsxs50(Fragment6, { children: [
|
|
5554
|
+
icon && /* @__PURE__ */ jsx58("span", { "aria-hidden": "true", className: cn("flex shrink-0", danger ? "text-text-danger" : "text-text-secondary"), children: icon }),
|
|
5555
|
+
asChild ? (
|
|
5556
|
+
// The link's own text lands here; the link becomes the row.
|
|
5557
|
+
/* @__PURE__ */ jsx58(Slottable, { children })
|
|
5558
|
+
) : /* @__PURE__ */ jsxs50("span", { className: "min-w-0 flex-1", children: [
|
|
5559
|
+
/* @__PURE__ */ jsx58("span", { className: "block truncate", children }),
|
|
5560
|
+
description && /* @__PURE__ */ jsx58("span", { className: "block truncate text-xs text-text-tertiary", children: description })
|
|
5561
|
+
] }),
|
|
5562
|
+
trailing && /* @__PURE__ */ jsx58("span", { className: "ml-auto flex shrink-0 items-center text-xs text-text-secondary", children: trailing }),
|
|
5563
|
+
radio && checked && /* @__PURE__ */ jsx58(Check10, { size: 16, "aria-hidden": "true", className: "shrink-0 text-brand-primaryAction" }),
|
|
5564
|
+
submenu && /* @__PURE__ */ jsx58(ChevronRight7, { size: 16, "aria-hidden": "true", className: "shrink-0 text-text-secondary" })
|
|
5565
|
+
] });
|
|
5566
|
+
return /* @__PURE__ */ jsx58(
|
|
5567
|
+
Comp,
|
|
5568
|
+
{
|
|
5569
|
+
ref,
|
|
5570
|
+
type: asChild ? void 0 : "button",
|
|
5571
|
+
role: radio ? "menuitemradio" : "menuitem",
|
|
5572
|
+
"aria-checked": radio ? checked : void 0,
|
|
5573
|
+
"aria-haspopup": submenu ? "menu" : void 0,
|
|
5574
|
+
"aria-disabled": disabled || void 0,
|
|
5575
|
+
disabled: asChild ? void 0 : disabled,
|
|
5576
|
+
tabIndex: -1,
|
|
5577
|
+
"data-testid": testIdPrefix,
|
|
5578
|
+
className: cn(
|
|
5579
|
+
"flex min-h-9 w-full items-center gap-2.5 rounded-control px-3 py-1.5 text-left text-sm transition-colors",
|
|
5580
|
+
"focus-visible:outline-solid focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-border-focus",
|
|
5581
|
+
danger ? "text-text-danger" : "text-text-primary",
|
|
5582
|
+
disabled ? "cursor-not-allowed opacity-40" : "hover:bg-subtle focus-visible:bg-subtle",
|
|
5583
|
+
className
|
|
5584
|
+
),
|
|
5585
|
+
...props,
|
|
5586
|
+
children: body
|
|
5587
|
+
}
|
|
5588
|
+
);
|
|
5589
|
+
}
|
|
5590
|
+
);
|
|
5591
|
+
MenuItem.displayName = "MenuItem";
|
|
5592
|
+
function MenuLabel({ className, testIdPrefix, children }) {
|
|
5593
|
+
return /* @__PURE__ */ jsx58(
|
|
5594
|
+
"div",
|
|
5595
|
+
{
|
|
5596
|
+
role: "presentation",
|
|
5597
|
+
"data-testid": testIdPrefix,
|
|
5598
|
+
className: cn("px-3 pb-1 pt-2 text-micro font-semibold uppercase tracking-wide text-text-tertiary", className),
|
|
5599
|
+
children
|
|
5600
|
+
}
|
|
5601
|
+
);
|
|
5602
|
+
}
|
|
5603
|
+
function MenuSeparator({ className, testIdPrefix }) {
|
|
5604
|
+
return /* @__PURE__ */ jsx58("div", { role: "separator", "data-testid": testIdPrefix, className: cn("-mx-1 my-1 border-t border-border-default", className) });
|
|
5605
|
+
}
|
|
5497
5606
|
export {
|
|
5498
5607
|
AISpark,
|
|
5499
5608
|
AdvertiserNoResults,
|
|
@@ -5524,6 +5633,10 @@ export {
|
|
|
5524
5633
|
InlineMessage,
|
|
5525
5634
|
LineChartPlaceholder,
|
|
5526
5635
|
MediaLabel,
|
|
5636
|
+
Menu,
|
|
5637
|
+
MenuItem,
|
|
5638
|
+
MenuLabel,
|
|
5639
|
+
MenuSeparator,
|
|
5527
5640
|
Modal,
|
|
5528
5641
|
MultiSelectFilter,
|
|
5529
5642
|
NO_RESULTS_BODY,
|