@mediaradar/design-components 0.19.0 → 0.20.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/index.cjs +204 -129
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +91 -1
- package/dist/index.d.ts +91 -1
- package/dist/index.js +194 -120
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -3270,10 +3270,83 @@ function WorkspaceAvatar({ name, size = "md" }) {
|
|
|
3270
3270
|
);
|
|
3271
3271
|
}
|
|
3272
3272
|
|
|
3273
|
+
// src/Toast.tsx
|
|
3274
|
+
import { useEffect as useEffect11, useRef as useRef12, useState as useState12 } from "react";
|
|
3275
|
+
import { createPortal as createPortal6 } from "react-dom";
|
|
3276
|
+
import { AlertTriangle, Check as Check7 } from "lucide-react";
|
|
3277
|
+
import { jsx as jsx34, jsxs as jsxs31 } from "react/jsx-runtime";
|
|
3278
|
+
var ICON = {
|
|
3279
|
+
neutral: null,
|
|
3280
|
+
success: /* @__PURE__ */ jsx34(Check7, { size: 15, className: "shrink-0", "aria-hidden": "true" }),
|
|
3281
|
+
warning: /* @__PURE__ */ jsx34(AlertTriangle, { size: 15, className: "shrink-0", "aria-hidden": "true" })
|
|
3282
|
+
};
|
|
3283
|
+
function Toast({ message, action, onClose, tone = "neutral", duration, className }) {
|
|
3284
|
+
const ms = duration ?? (action ? 1e4 : 5e3);
|
|
3285
|
+
const [paused, setPaused] = useState12(false);
|
|
3286
|
+
const closed = useRef12(false);
|
|
3287
|
+
useEffect11(() => {
|
|
3288
|
+
if (paused) return;
|
|
3289
|
+
const t = window.setTimeout(() => {
|
|
3290
|
+
if (closed.current) return;
|
|
3291
|
+
closed.current = true;
|
|
3292
|
+
onClose();
|
|
3293
|
+
}, ms);
|
|
3294
|
+
return () => window.clearTimeout(t);
|
|
3295
|
+
}, [message, ms, paused]);
|
|
3296
|
+
return createPortal6(
|
|
3297
|
+
/* @__PURE__ */ jsxs31(
|
|
3298
|
+
"div",
|
|
3299
|
+
{
|
|
3300
|
+
role: "status",
|
|
3301
|
+
"aria-live": "polite",
|
|
3302
|
+
onMouseEnter: () => setPaused(true),
|
|
3303
|
+
onMouseLeave: () => setPaused(false),
|
|
3304
|
+
onFocusCapture: () => setPaused(true),
|
|
3305
|
+
onBlurCapture: () => setPaused(false),
|
|
3306
|
+
className: cn(
|
|
3307
|
+
"fixed bottom-6 left-1/2 z-toast flex max-w-[92vw] -translate-x-1/2 items-center gap-2.5",
|
|
3308
|
+
"rounded-control bg-inverseSurface py-2.5 pl-4 pr-2.5 text-sm font-medium text-text-inverse shadow-overlay",
|
|
3309
|
+
className
|
|
3310
|
+
),
|
|
3311
|
+
children: [
|
|
3312
|
+
ICON[tone] && // The inverse pair, not text-success / text-warning: those are tuned
|
|
3313
|
+
// for the page, and on the toast's flipped surface amber drops to 2:1.
|
|
3314
|
+
/* @__PURE__ */ jsx34(
|
|
3315
|
+
"span",
|
|
3316
|
+
{
|
|
3317
|
+
className: cn(
|
|
3318
|
+
"flex",
|
|
3319
|
+
tone === "success" ? "text-text-inverseSuccess" : "text-text-inverseWarning"
|
|
3320
|
+
),
|
|
3321
|
+
children: ICON[tone]
|
|
3322
|
+
}
|
|
3323
|
+
),
|
|
3324
|
+
/* @__PURE__ */ jsx34("span", { className: "min-w-0", children: message }),
|
|
3325
|
+
action && /* @__PURE__ */ jsx34(
|
|
3326
|
+
"button",
|
|
3327
|
+
{
|
|
3328
|
+
type: "button",
|
|
3329
|
+
onClick: () => {
|
|
3330
|
+
if (!closed.current) {
|
|
3331
|
+
closed.current = true;
|
|
3332
|
+
action.onClick();
|
|
3333
|
+
}
|
|
3334
|
+
},
|
|
3335
|
+
className: "shrink-0 rounded-control px-2.5 py-1 text-sm font-semibold text-text-inverse underline-offset-2 transition-colors duration-(--mr-motion-duration-interactive) ease-interactive hover:bg-text-inverse/15 hover:underline focus-visible:outline-solid focus-visible:outline-2 focus-visible:outline-border-focus",
|
|
3336
|
+
children: action.label
|
|
3337
|
+
}
|
|
3338
|
+
)
|
|
3339
|
+
]
|
|
3340
|
+
}
|
|
3341
|
+
),
|
|
3342
|
+
document.body
|
|
3343
|
+
);
|
|
3344
|
+
}
|
|
3345
|
+
|
|
3273
3346
|
// src/Tag.tsx
|
|
3274
|
-
import { jsx as
|
|
3347
|
+
import { jsx as jsx35 } from "react/jsx-runtime";
|
|
3275
3348
|
function Tag({ children, className }) {
|
|
3276
|
-
return /* @__PURE__ */
|
|
3349
|
+
return /* @__PURE__ */ jsx35(
|
|
3277
3350
|
"span",
|
|
3278
3351
|
{
|
|
3279
3352
|
className: cn(
|
|
@@ -3293,7 +3366,7 @@ function Tag({ children, className }) {
|
|
|
3293
3366
|
|
|
3294
3367
|
// src/TablePagination.tsx
|
|
3295
3368
|
import { ChevronDown as ChevronDown9, ChevronFirst, ChevronLast, ChevronLeft as ChevronLeft4, ChevronRight as ChevronRight5 } from "lucide-react";
|
|
3296
|
-
import { jsx as
|
|
3369
|
+
import { jsx as jsx36, jsxs as jsxs32 } from "react/jsx-runtime";
|
|
3297
3370
|
function TablePagination({
|
|
3298
3371
|
page,
|
|
3299
3372
|
perPage,
|
|
@@ -3314,10 +3387,10 @@ function TablePagination({
|
|
|
3314
3387
|
btn,
|
|
3315
3388
|
"text-text-secondary hover:bg-subtle hover:text-text-primary disabled:pointer-events-none disabled:opacity-30"
|
|
3316
3389
|
);
|
|
3317
|
-
return /* @__PURE__ */
|
|
3318
|
-
/* @__PURE__ */
|
|
3319
|
-
/* @__PURE__ */
|
|
3320
|
-
/* @__PURE__ */
|
|
3390
|
+
return /* @__PURE__ */ jsxs32("div", { className: cn("flex flex-wrap items-center justify-between gap-x-4 gap-y-2", className), "data-testid": testIdPrefix, children: [
|
|
3391
|
+
/* @__PURE__ */ jsxs32("label", { className: "flex items-center gap-2 text-[13px] text-text-secondary", children: [
|
|
3392
|
+
/* @__PURE__ */ jsxs32("span", { className: "relative", children: [
|
|
3393
|
+
/* @__PURE__ */ jsx36(
|
|
3321
3394
|
"select",
|
|
3322
3395
|
{
|
|
3323
3396
|
value: perPage,
|
|
@@ -3325,10 +3398,10 @@ function TablePagination({
|
|
|
3325
3398
|
"aria-label": "Items per page",
|
|
3326
3399
|
"data-testid": testIdPrefix && `${testIdPrefix}-per-page`,
|
|
3327
3400
|
className: "appearance-none rounded-control border border-border-strong bg-input py-1 pl-2.5 pr-7 text-[13px] font-medium text-text-primary focus:outline focus:outline-2 focus:outline-border-focus",
|
|
3328
|
-
children: perPageOptions.map((n) => /* @__PURE__ */
|
|
3401
|
+
children: perPageOptions.map((n) => /* @__PURE__ */ jsx36("option", { value: n, children: n }, n))
|
|
3329
3402
|
}
|
|
3330
3403
|
),
|
|
3331
|
-
/* @__PURE__ */
|
|
3404
|
+
/* @__PURE__ */ jsx36(
|
|
3332
3405
|
ChevronDown9,
|
|
3333
3406
|
{
|
|
3334
3407
|
size: 13,
|
|
@@ -3339,8 +3412,8 @@ function TablePagination({
|
|
|
3339
3412
|
] }),
|
|
3340
3413
|
"items per page"
|
|
3341
3414
|
] }),
|
|
3342
|
-
/* @__PURE__ */
|
|
3343
|
-
/* @__PURE__ */
|
|
3415
|
+
/* @__PURE__ */ jsxs32("nav", { className: "flex items-center gap-1", "aria-label": "Pagination", children: [
|
|
3416
|
+
/* @__PURE__ */ jsx36(
|
|
3344
3417
|
"button",
|
|
3345
3418
|
{
|
|
3346
3419
|
type: "button",
|
|
@@ -3349,10 +3422,10 @@ function TablePagination({
|
|
|
3349
3422
|
"aria-label": "First page",
|
|
3350
3423
|
"data-testid": testIdPrefix && `${testIdPrefix}-first`,
|
|
3351
3424
|
className: stepBtn,
|
|
3352
|
-
children: /* @__PURE__ */
|
|
3425
|
+
children: /* @__PURE__ */ jsx36(ChevronFirst, { size: 16, "aria-hidden": "true" })
|
|
3353
3426
|
}
|
|
3354
3427
|
),
|
|
3355
|
-
/* @__PURE__ */
|
|
3428
|
+
/* @__PURE__ */ jsx36(
|
|
3356
3429
|
"button",
|
|
3357
3430
|
{
|
|
3358
3431
|
type: "button",
|
|
@@ -3361,11 +3434,11 @@ function TablePagination({
|
|
|
3361
3434
|
"aria-label": "Previous page",
|
|
3362
3435
|
"data-testid": testIdPrefix && `${testIdPrefix}-prev`,
|
|
3363
3436
|
className: stepBtn,
|
|
3364
|
-
children: /* @__PURE__ */
|
|
3437
|
+
children: /* @__PURE__ */ jsx36(ChevronLeft4, { size: 16, "aria-hidden": "true" })
|
|
3365
3438
|
}
|
|
3366
3439
|
),
|
|
3367
3440
|
pageWindow(current, totalPages).map(
|
|
3368
|
-
(p) => typeof p === "string" ? /* @__PURE__ */
|
|
3441
|
+
(p) => typeof p === "string" ? /* @__PURE__ */ jsx36("span", { className: "px-1 text-[13px] text-text-tertiary", children: "\u2026" }, p) : /* @__PURE__ */ jsx36(
|
|
3369
3442
|
"button",
|
|
3370
3443
|
{
|
|
3371
3444
|
type: "button",
|
|
@@ -3381,7 +3454,7 @@ function TablePagination({
|
|
|
3381
3454
|
p
|
|
3382
3455
|
)
|
|
3383
3456
|
),
|
|
3384
|
-
/* @__PURE__ */
|
|
3457
|
+
/* @__PURE__ */ jsx36(
|
|
3385
3458
|
"button",
|
|
3386
3459
|
{
|
|
3387
3460
|
type: "button",
|
|
@@ -3390,10 +3463,10 @@ function TablePagination({
|
|
|
3390
3463
|
"aria-label": "Next page",
|
|
3391
3464
|
"data-testid": testIdPrefix && `${testIdPrefix}-next`,
|
|
3392
3465
|
className: stepBtn,
|
|
3393
|
-
children: /* @__PURE__ */
|
|
3466
|
+
children: /* @__PURE__ */ jsx36(ChevronRight5, { size: 16, "aria-hidden": "true" })
|
|
3394
3467
|
}
|
|
3395
3468
|
),
|
|
3396
|
-
/* @__PURE__ */
|
|
3469
|
+
/* @__PURE__ */ jsx36(
|
|
3397
3470
|
"button",
|
|
3398
3471
|
{
|
|
3399
3472
|
type: "button",
|
|
@@ -3402,11 +3475,11 @@ function TablePagination({
|
|
|
3402
3475
|
"aria-label": "Last page",
|
|
3403
3476
|
"data-testid": testIdPrefix && `${testIdPrefix}-last`,
|
|
3404
3477
|
className: stepBtn,
|
|
3405
|
-
children: /* @__PURE__ */
|
|
3478
|
+
children: /* @__PURE__ */ jsx36(ChevronLast, { size: 16, "aria-hidden": "true" })
|
|
3406
3479
|
}
|
|
3407
3480
|
)
|
|
3408
3481
|
] }),
|
|
3409
|
-
/* @__PURE__ */
|
|
3482
|
+
/* @__PURE__ */ jsxs32("span", { className: "text-[13px] text-text-tertiary tabular-nums", children: [
|
|
3410
3483
|
rangeStart.toLocaleString(),
|
|
3411
3484
|
" \u2013 ",
|
|
3412
3485
|
rangeEnd.toLocaleString(),
|
|
@@ -3419,9 +3492,9 @@ function TablePagination({
|
|
|
3419
3492
|
}
|
|
3420
3493
|
|
|
3421
3494
|
// src/DateRangePicker.tsx
|
|
3422
|
-
import { useEffect as
|
|
3495
|
+
import { useEffect as useEffect12, useMemo as useMemo4, useRef as useRef13, useState as useState13 } from "react";
|
|
3423
3496
|
import { ChevronDown as ChevronDown10 } from "lucide-react";
|
|
3424
|
-
import { jsx as
|
|
3497
|
+
import { jsx as jsx37, jsxs as jsxs33 } from "react/jsx-runtime";
|
|
3425
3498
|
var MONTH_ABBR = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
|
|
3426
3499
|
var QUARTER_ABBR = ["Q1", "Q2", "Q3", "Q4"];
|
|
3427
3500
|
var PRESETS = ["Rolling 3 months", "Rolling 6 months", "Rolling 12 months"];
|
|
@@ -3457,7 +3530,7 @@ function spanLabel(label, today) {
|
|
|
3457
3530
|
return `${fmtDate(s)} \u2013 ${fmtDate(e)}`;
|
|
3458
3531
|
}
|
|
3459
3532
|
function MiniSelect({ value, onChange, options }) {
|
|
3460
|
-
return /* @__PURE__ */
|
|
3533
|
+
return /* @__PURE__ */ jsx37(
|
|
3461
3534
|
"select",
|
|
3462
3535
|
{
|
|
3463
3536
|
value: String(value),
|
|
@@ -3466,7 +3539,7 @@ function MiniSelect({ value, onChange, options }) {
|
|
|
3466
3539
|
if (opt) onChange(opt.value);
|
|
3467
3540
|
},
|
|
3468
3541
|
className: "rounded-control border border-border-strong bg-input px-1.5 py-1 text-[12px] text-text-primary outline-hidden focus:border-border-focus",
|
|
3469
|
-
children: options.map((o) => /* @__PURE__ */
|
|
3542
|
+
children: options.map((o) => /* @__PURE__ */ jsx37("option", { value: String(o.value), children: o.label }, String(o.value)))
|
|
3470
3543
|
}
|
|
3471
3544
|
);
|
|
3472
3545
|
}
|
|
@@ -3483,17 +3556,17 @@ function DateRangePicker({
|
|
|
3483
3556
|
}) {
|
|
3484
3557
|
const end = useMemo4(() => today ?? startOfToday(), [today]);
|
|
3485
3558
|
const yearOptions = years ?? [3, 2, 1, 0].map((n) => end.getFullYear() - n);
|
|
3486
|
-
const [open, setOpen] =
|
|
3487
|
-
const [value, setValue] =
|
|
3488
|
-
const [draft, setDraft] =
|
|
3489
|
-
const ref =
|
|
3490
|
-
const [fromMo, setFromMo] =
|
|
3491
|
-
const [fromYr, setFromYr] =
|
|
3492
|
-
const [toMo, setToMo] =
|
|
3493
|
-
const [toYr, setToYr] =
|
|
3494
|
-
const [fromQ, setFromQ] =
|
|
3495
|
-
const [toQ, setToQ] =
|
|
3496
|
-
|
|
3559
|
+
const [open, setOpen] = useState13(false);
|
|
3560
|
+
const [value, setValue] = useState13(defaultValue);
|
|
3561
|
+
const [draft, setDraft] = useState13(defaultValue);
|
|
3562
|
+
const ref = useRef13(null);
|
|
3563
|
+
const [fromMo, setFromMo] = useState13(end.getMonth());
|
|
3564
|
+
const [fromYr, setFromYr] = useState13(end.getFullYear() - 1);
|
|
3565
|
+
const [toMo, setToMo] = useState13(end.getMonth());
|
|
3566
|
+
const [toYr, setToYr] = useState13(end.getFullYear());
|
|
3567
|
+
const [fromQ, setFromQ] = useState13(Math.floor(end.getMonth() / 3));
|
|
3568
|
+
const [toQ, setToQ] = useState13(Math.floor(end.getMonth() / 3));
|
|
3569
|
+
useEffect12(() => {
|
|
3497
3570
|
const [s, e] = resolveRange(value, end);
|
|
3498
3571
|
onRangeChange?.(s, e);
|
|
3499
3572
|
}, [value]);
|
|
@@ -3501,7 +3574,7 @@ function DateRangePicker({
|
|
|
3501
3574
|
if (!open) setDraft(value);
|
|
3502
3575
|
setOpen((o) => !o);
|
|
3503
3576
|
};
|
|
3504
|
-
|
|
3577
|
+
useEffect12(() => {
|
|
3505
3578
|
if (!open) return;
|
|
3506
3579
|
const onDown = (e) => {
|
|
3507
3580
|
if (ref.current && !ref.current.contains(e.target)) setOpen(false);
|
|
@@ -3527,8 +3600,8 @@ function DateRangePicker({
|
|
|
3527
3600
|
if (showFooter) setDraft(label);
|
|
3528
3601
|
else commit(label);
|
|
3529
3602
|
};
|
|
3530
|
-
return /* @__PURE__ */
|
|
3531
|
-
/* @__PURE__ */
|
|
3603
|
+
return /* @__PURE__ */ jsxs33("div", { className: "relative", ref, children: [
|
|
3604
|
+
/* @__PURE__ */ jsxs33(
|
|
3532
3605
|
"button",
|
|
3533
3606
|
{
|
|
3534
3607
|
type: "button",
|
|
@@ -3537,16 +3610,16 @@ function DateRangePicker({
|
|
|
3537
3610
|
"aria-haspopup": "listbox",
|
|
3538
3611
|
className: chipTriggerClass(),
|
|
3539
3612
|
children: [
|
|
3540
|
-
/* @__PURE__ */
|
|
3541
|
-
/* @__PURE__ */
|
|
3542
|
-
/* @__PURE__ */
|
|
3613
|
+
/* @__PURE__ */ jsxs33("span", { className: "flex flex-col gap-1 text-left leading-none", children: [
|
|
3614
|
+
/* @__PURE__ */ jsx37("span", { className: "text-control-caption text-text-tertiary", children: spanLabel(value, end) }),
|
|
3615
|
+
/* @__PURE__ */ jsx37("span", { className: "text-[12px] font-medium text-text-primary", children: value })
|
|
3543
3616
|
] }),
|
|
3544
|
-
/* @__PURE__ */
|
|
3617
|
+
/* @__PURE__ */ jsx37(ChevronDown10, { size: 14, "aria-hidden": "true", className: cn("shrink-0 text-text-secondary transition-transform", open && "rotate-180") })
|
|
3545
3618
|
]
|
|
3546
3619
|
}
|
|
3547
3620
|
),
|
|
3548
|
-
open && /* @__PURE__ */
|
|
3549
|
-
presets.map((p) => /* @__PURE__ */
|
|
3621
|
+
open && /* @__PURE__ */ jsxs33("div", { className: cn("absolute top-[calc(100%+8px)] z-30 w-[280px] overflow-hidden rounded-card border border-border-default bg-surface py-1 shadow-overlay", align === "right" ? "right-0" : "left-0"), children: [
|
|
3622
|
+
presets.map((p) => /* @__PURE__ */ jsx37(
|
|
3550
3623
|
"button",
|
|
3551
3624
|
{
|
|
3552
3625
|
type: "button",
|
|
@@ -3556,26 +3629,26 @@ function DateRangePicker({
|
|
|
3556
3629
|
},
|
|
3557
3630
|
p
|
|
3558
3631
|
)),
|
|
3559
|
-
/* @__PURE__ */
|
|
3560
|
-
/* @__PURE__ */
|
|
3561
|
-
/* @__PURE__ */
|
|
3562
|
-
/* @__PURE__ */
|
|
3632
|
+
/* @__PURE__ */ jsxs33("div", { className: "mt-1 border-t border-border-default px-3 pb-2 pt-2", children: [
|
|
3633
|
+
/* @__PURE__ */ jsx37("div", { className: "text-[13px] font-semibold text-text-primary", children: "Custom Range" }),
|
|
3634
|
+
/* @__PURE__ */ jsxs33("div", { className: "mt-2 flex flex-col gap-2", children: [
|
|
3635
|
+
/* @__PURE__ */ jsxs33("label", { className: "flex items-center justify-between gap-2 text-[12px] text-text-secondary", children: [
|
|
3563
3636
|
"From",
|
|
3564
|
-
/* @__PURE__ */
|
|
3565
|
-
granularity === "month" && /* @__PURE__ */
|
|
3566
|
-
granularity === "quarter" && /* @__PURE__ */
|
|
3567
|
-
/* @__PURE__ */
|
|
3637
|
+
/* @__PURE__ */ jsxs33("span", { className: "flex gap-1", children: [
|
|
3638
|
+
granularity === "month" && /* @__PURE__ */ jsx37(MiniSelect, { value: fromMo, onChange: setFromMo, options: MONTH_ABBR.map((mm, i) => ({ label: mm, value: i })) }),
|
|
3639
|
+
granularity === "quarter" && /* @__PURE__ */ jsx37(MiniSelect, { value: fromQ, onChange: setFromQ, options: QUARTER_ABBR.map((qq, i) => ({ label: qq, value: i })) }),
|
|
3640
|
+
/* @__PURE__ */ jsx37(MiniSelect, { value: fromYr, onChange: setFromYr, options: yearOptions.map((y) => ({ label: String(y), value: y })) })
|
|
3568
3641
|
] })
|
|
3569
3642
|
] }),
|
|
3570
|
-
/* @__PURE__ */
|
|
3643
|
+
/* @__PURE__ */ jsxs33("label", { className: "flex items-center justify-between gap-2 text-[12px] text-text-secondary", children: [
|
|
3571
3644
|
"To",
|
|
3572
|
-
/* @__PURE__ */
|
|
3573
|
-
granularity === "month" && /* @__PURE__ */
|
|
3574
|
-
granularity === "quarter" && /* @__PURE__ */
|
|
3575
|
-
/* @__PURE__ */
|
|
3645
|
+
/* @__PURE__ */ jsxs33("span", { className: "flex gap-1", children: [
|
|
3646
|
+
granularity === "month" && /* @__PURE__ */ jsx37(MiniSelect, { value: toMo, onChange: setToMo, options: MONTH_ABBR.map((mm, i) => ({ label: mm, value: i })) }),
|
|
3647
|
+
granularity === "quarter" && /* @__PURE__ */ jsx37(MiniSelect, { value: toQ, onChange: setToQ, options: QUARTER_ABBR.map((qq, i) => ({ label: qq, value: i })) }),
|
|
3648
|
+
/* @__PURE__ */ jsx37(MiniSelect, { value: toYr, onChange: setToYr, options: yearOptions.map((y) => ({ label: String(y), value: y })) })
|
|
3576
3649
|
] })
|
|
3577
3650
|
] }),
|
|
3578
|
-
/* @__PURE__ */
|
|
3651
|
+
/* @__PURE__ */ jsx37(
|
|
3579
3652
|
"button",
|
|
3580
3653
|
{
|
|
3581
3654
|
type: "button",
|
|
@@ -3587,15 +3660,15 @@ function DateRangePicker({
|
|
|
3587
3660
|
)
|
|
3588
3661
|
] })
|
|
3589
3662
|
] }),
|
|
3590
|
-
showFooter && /* @__PURE__ */
|
|
3663
|
+
showFooter && /* @__PURE__ */ jsx37(FilterDropdownFooter, { onApply: () => commit(draft) })
|
|
3591
3664
|
] })
|
|
3592
3665
|
] });
|
|
3593
3666
|
}
|
|
3594
3667
|
|
|
3595
3668
|
// src/MultiSelectFilter.tsx
|
|
3596
|
-
import { useCallback as useCallback4, useEffect as
|
|
3597
|
-
import { ChevronDown as ChevronDown11, Check as
|
|
3598
|
-
import { jsx as
|
|
3669
|
+
import { useCallback as useCallback4, useEffect as useEffect13, useRef as useRef14, useState as useState14 } from "react";
|
|
3670
|
+
import { ChevronDown as ChevronDown11, Check as Check8, Minus as Minus2, Search as Search5, X as X4 } from "lucide-react";
|
|
3671
|
+
import { jsx as jsx38, jsxs as jsxs34 } from "react/jsx-runtime";
|
|
3599
3672
|
function MultiSelectFilter({
|
|
3600
3673
|
caption,
|
|
3601
3674
|
options = [],
|
|
@@ -3619,10 +3692,10 @@ function MultiSelectFilter({
|
|
|
3619
3692
|
}) {
|
|
3620
3693
|
const groupLeaves = (g) => g.children.length ? g.children : [{ id: g.id, label: g.label }];
|
|
3621
3694
|
const leafOptions = groups ? groups.flatMap(groupLeaves) : options;
|
|
3622
|
-
const [open, setOpen] =
|
|
3623
|
-
const [q, setQ] =
|
|
3624
|
-
const [draft, setDraft] =
|
|
3625
|
-
const ref =
|
|
3695
|
+
const [open, setOpen] = useState14(false);
|
|
3696
|
+
const [q, setQ] = useState14("");
|
|
3697
|
+
const [draft, setDraft] = useState14(selected);
|
|
3698
|
+
const ref = useRef14(null);
|
|
3626
3699
|
const close = useCallback4(() => {
|
|
3627
3700
|
setOpen(false);
|
|
3628
3701
|
setQ("");
|
|
@@ -3640,7 +3713,7 @@ function MultiSelectFilter({
|
|
|
3640
3713
|
setOpen(false);
|
|
3641
3714
|
setQ("");
|
|
3642
3715
|
};
|
|
3643
|
-
|
|
3716
|
+
useEffect13(() => {
|
|
3644
3717
|
if (!open) return;
|
|
3645
3718
|
const onKey = (e) => e.key === "Escape" && close();
|
|
3646
3719
|
const onClick = (e) => {
|
|
@@ -3686,8 +3759,8 @@ function MultiSelectFilter({
|
|
|
3686
3759
|
const kids = live.filter((c) => c.label.toLowerCase().includes(ql));
|
|
3687
3760
|
return kids.length ? { ...g, children: kids } : null;
|
|
3688
3761
|
}).filter((g) => g !== null) : [];
|
|
3689
|
-
return /* @__PURE__ */
|
|
3690
|
-
/* @__PURE__ */
|
|
3762
|
+
return /* @__PURE__ */ jsxs34("div", { className: cn("relative", fullWidth && "w-full"), ref, children: [
|
|
3763
|
+
/* @__PURE__ */ jsxs34(
|
|
3691
3764
|
"button",
|
|
3692
3765
|
{
|
|
3693
3766
|
type: "button",
|
|
@@ -3695,8 +3768,8 @@ function MultiSelectFilter({
|
|
|
3695
3768
|
"aria-expanded": open,
|
|
3696
3769
|
className: cn(chipTriggerClass(variant), fullWidth && "w-full justify-between"),
|
|
3697
3770
|
children: [
|
|
3698
|
-
/* @__PURE__ */
|
|
3699
|
-
/* @__PURE__ */
|
|
3771
|
+
/* @__PURE__ */ jsx38(ChipContent, { caption, value, icon }),
|
|
3772
|
+
/* @__PURE__ */ jsx38(
|
|
3700
3773
|
ChevronDown11,
|
|
3701
3774
|
{
|
|
3702
3775
|
size: 14,
|
|
@@ -3707,7 +3780,7 @@ function MultiSelectFilter({
|
|
|
3707
3780
|
]
|
|
3708
3781
|
}
|
|
3709
3782
|
),
|
|
3710
|
-
open && /* @__PURE__ */
|
|
3783
|
+
open && /* @__PURE__ */ jsxs34(
|
|
3711
3784
|
"div",
|
|
3712
3785
|
{
|
|
3713
3786
|
className: cn(
|
|
@@ -3718,9 +3791,9 @@ function MultiSelectFilter({
|
|
|
3718
3791
|
role: "dialog",
|
|
3719
3792
|
"aria-label": caption,
|
|
3720
3793
|
children: [
|
|
3721
|
-
searchable && /* @__PURE__ */
|
|
3722
|
-
/* @__PURE__ */
|
|
3723
|
-
/* @__PURE__ */
|
|
3794
|
+
searchable && /* @__PURE__ */ jsx38("div", { className: "border-b border-border-default p-2", children: /* @__PURE__ */ jsxs34("div", { className: "flex h-9 items-center gap-2 rounded-control border border-border-strong bg-input px-2.5", children: [
|
|
3795
|
+
/* @__PURE__ */ jsx38(Search5, { size: 14, className: "text-text-secondary", "aria-hidden": "true" }),
|
|
3796
|
+
/* @__PURE__ */ jsx38(
|
|
3724
3797
|
"input",
|
|
3725
3798
|
{
|
|
3726
3799
|
type: "text",
|
|
@@ -3730,37 +3803,37 @@ function MultiSelectFilter({
|
|
|
3730
3803
|
className: "h-full flex-1 bg-transparent text-[13px] outline-hidden placeholder:text-text-tertiary"
|
|
3731
3804
|
}
|
|
3732
3805
|
),
|
|
3733
|
-
q && /* @__PURE__ */
|
|
3806
|
+
q && /* @__PURE__ */ jsx38("button", { type: "button", onClick: () => setQ(""), "aria-label": "Clear search", className: "text-text-tertiary hover:text-text-primary", children: /* @__PURE__ */ jsx38(X4, { size: 13 }) })
|
|
3734
3807
|
] }) }),
|
|
3735
|
-
/* @__PURE__ */
|
|
3808
|
+
/* @__PURE__ */ jsxs34("div", { className: "max-h-[280px] overflow-y-auto p-1", children: [
|
|
3736
3809
|
groups ? visibleGroups.map((g) => {
|
|
3737
3810
|
const state = groupState(g);
|
|
3738
|
-
return /* @__PURE__ */
|
|
3739
|
-
/* @__PURE__ */
|
|
3811
|
+
return /* @__PURE__ */ jsxs34("div", { children: [
|
|
3812
|
+
/* @__PURE__ */ jsxs34(
|
|
3740
3813
|
"button",
|
|
3741
3814
|
{
|
|
3742
3815
|
type: "button",
|
|
3743
3816
|
onClick: () => toggleGroup(g),
|
|
3744
3817
|
className: "flex w-full items-center gap-2.5 rounded-control px-2 py-2 text-left transition-colors hover:bg-subtle",
|
|
3745
3818
|
children: [
|
|
3746
|
-
/* @__PURE__ */
|
|
3747
|
-
/* @__PURE__ */
|
|
3748
|
-
counts && /* @__PURE__ */
|
|
3819
|
+
/* @__PURE__ */ jsx38(TriCheck, { state }),
|
|
3820
|
+
/* @__PURE__ */ jsx38("span", { className: cn("flex-1 text-[14px] text-text-primary", !plainParent && "font-semibold"), children: g.label }),
|
|
3821
|
+
counts && /* @__PURE__ */ jsx38(OptionCount, { n: countFor(g.id) })
|
|
3749
3822
|
]
|
|
3750
3823
|
}
|
|
3751
3824
|
),
|
|
3752
3825
|
g.children.map((c) => {
|
|
3753
3826
|
const checked = draft.includes(c.id);
|
|
3754
|
-
return /* @__PURE__ */
|
|
3827
|
+
return /* @__PURE__ */ jsxs34(
|
|
3755
3828
|
"button",
|
|
3756
3829
|
{
|
|
3757
3830
|
type: "button",
|
|
3758
3831
|
onClick: () => toggle(c.id),
|
|
3759
3832
|
className: "flex w-full items-center gap-2.5 rounded-control py-2 pl-9 pr-2 text-left transition-colors hover:bg-subtle",
|
|
3760
3833
|
children: [
|
|
3761
|
-
/* @__PURE__ */
|
|
3762
|
-
/* @__PURE__ */
|
|
3763
|
-
counts && /* @__PURE__ */
|
|
3834
|
+
/* @__PURE__ */ jsx38(TriCheck, { state: checked ? "all" : "none" }),
|
|
3835
|
+
/* @__PURE__ */ jsx38("span", { className: "flex-1 text-[14px] text-text-primary", children: c.label }),
|
|
3836
|
+
counts && /* @__PURE__ */ jsx38(OptionCount, { n: countFor(c.id) })
|
|
3764
3837
|
]
|
|
3765
3838
|
},
|
|
3766
3839
|
c.id
|
|
@@ -3769,33 +3842,33 @@ function MultiSelectFilter({
|
|
|
3769
3842
|
] }, g.id);
|
|
3770
3843
|
}) : items.map((o) => {
|
|
3771
3844
|
const checked = draft.includes(o.id);
|
|
3772
|
-
return /* @__PURE__ */
|
|
3845
|
+
return /* @__PURE__ */ jsxs34(
|
|
3773
3846
|
"button",
|
|
3774
3847
|
{
|
|
3775
3848
|
type: "button",
|
|
3776
3849
|
onClick: () => toggle(o.id),
|
|
3777
3850
|
className: "flex w-full items-center gap-2.5 rounded-control px-2 py-2 text-left transition-colors hover:bg-subtle",
|
|
3778
3851
|
children: [
|
|
3779
|
-
/* @__PURE__ */
|
|
3852
|
+
/* @__PURE__ */ jsx38(
|
|
3780
3853
|
"span",
|
|
3781
3854
|
{
|
|
3782
3855
|
className: cn(
|
|
3783
3856
|
"flex h-[18px] w-[18px] shrink-0 items-center justify-center rounded-[5px] border transition-colors",
|
|
3784
3857
|
checked ? "border-transparent bg-brand-primaryAction text-brand-onprimary" : "border-border-interactive bg-input"
|
|
3785
3858
|
),
|
|
3786
|
-
children: checked && /* @__PURE__ */
|
|
3859
|
+
children: checked && /* @__PURE__ */ jsx38(Check8, { size: 13, strokeWidth: 3 })
|
|
3787
3860
|
}
|
|
3788
3861
|
),
|
|
3789
|
-
/* @__PURE__ */
|
|
3790
|
-
counts && /* @__PURE__ */
|
|
3862
|
+
/* @__PURE__ */ jsx38("span", { className: "flex-1 text-[14px] text-text-primary", children: o.label }),
|
|
3863
|
+
counts && /* @__PURE__ */ jsx38(OptionCount, { n: countFor(o.id) })
|
|
3791
3864
|
]
|
|
3792
3865
|
},
|
|
3793
3866
|
o.id
|
|
3794
3867
|
);
|
|
3795
3868
|
}),
|
|
3796
|
-
(groups && !visibleGroups.length || !groups && !items.length) && /* @__PURE__ */
|
|
3869
|
+
(groups && !visibleGroups.length || !groups && !items.length) && /* @__PURE__ */ jsx38("div", { className: "py-6 text-center text-[13px] text-text-tertiary", children: "No matches." })
|
|
3797
3870
|
] }),
|
|
3798
|
-
showFooter ? /* @__PURE__ */
|
|
3871
|
+
showFooter ? /* @__PURE__ */ jsx38(FilterDropdownFooter, { onClear: () => setDraft(clearValue), onApply: apply }) : min === 0 && draft.length > 0 && /* @__PURE__ */ jsx38("div", { className: "border-t border-border-default p-2", children: /* @__PURE__ */ jsxs34(
|
|
3799
3872
|
"button",
|
|
3800
3873
|
{
|
|
3801
3874
|
type: "button",
|
|
@@ -3814,7 +3887,7 @@ function MultiSelectFilter({
|
|
|
3814
3887
|
}
|
|
3815
3888
|
function TriCheck({ state }) {
|
|
3816
3889
|
const filled = state !== "none";
|
|
3817
|
-
return /* @__PURE__ */
|
|
3890
|
+
return /* @__PURE__ */ jsxs34(
|
|
3818
3891
|
"span",
|
|
3819
3892
|
{
|
|
3820
3893
|
className: cn(
|
|
@@ -3822,14 +3895,14 @@ function TriCheck({ state }) {
|
|
|
3822
3895
|
filled ? "border-transparent bg-brand-primaryAction text-brand-onprimary" : "border-border-interactive bg-input"
|
|
3823
3896
|
),
|
|
3824
3897
|
children: [
|
|
3825
|
-
state === "all" && /* @__PURE__ */
|
|
3826
|
-
state === "some" && /* @__PURE__ */
|
|
3898
|
+
state === "all" && /* @__PURE__ */ jsx38(Check8, { size: 13, strokeWidth: 3 }),
|
|
3899
|
+
state === "some" && /* @__PURE__ */ jsx38(Minus2, { size: 13, strokeWidth: 3 })
|
|
3827
3900
|
]
|
|
3828
3901
|
}
|
|
3829
3902
|
);
|
|
3830
3903
|
}
|
|
3831
3904
|
function OptionCount({ n }) {
|
|
3832
|
-
return /* @__PURE__ */
|
|
3905
|
+
return /* @__PURE__ */ jsxs34("span", { className: "shrink-0 text-[12px] tabular-nums text-text-tertiary", children: [
|
|
3833
3906
|
"(",
|
|
3834
3907
|
n.toLocaleString(),
|
|
3835
3908
|
")"
|
|
@@ -3837,7 +3910,7 @@ function OptionCount({ n }) {
|
|
|
3837
3910
|
}
|
|
3838
3911
|
|
|
3839
3912
|
// src/Toggle.tsx
|
|
3840
|
-
import { jsx as
|
|
3913
|
+
import { jsx as jsx39 } from "react/jsx-runtime";
|
|
3841
3914
|
var SIZES2 = {
|
|
3842
3915
|
sm: { track: "h-5 w-9", knob: "h-4 w-4", on: "translate-x-[18px]" },
|
|
3843
3916
|
md: { track: "h-6 w-11", knob: "h-5 w-5", on: "translate-x-[22px]" }
|
|
@@ -3845,7 +3918,7 @@ var SIZES2 = {
|
|
|
3845
3918
|
var OFF_TRACK = "color-mix(in srgb, var(--mr-color-border-interactive) 70%, var(--mr-color-text-secondary))";
|
|
3846
3919
|
function Toggle({ checked, onChange, label, size = "md", disabled, className, testIdPrefix }) {
|
|
3847
3920
|
const s = SIZES2[size];
|
|
3848
|
-
return /* @__PURE__ */
|
|
3921
|
+
return /* @__PURE__ */ jsx39(
|
|
3849
3922
|
"button",
|
|
3850
3923
|
{
|
|
3851
3924
|
type: "button",
|
|
@@ -3863,7 +3936,7 @@ function Toggle({ checked, onChange, label, size = "md", disabled, className, te
|
|
|
3863
3936
|
disabled && "cursor-not-allowed opacity-50",
|
|
3864
3937
|
className
|
|
3865
3938
|
),
|
|
3866
|
-
children: /* @__PURE__ */
|
|
3939
|
+
children: /* @__PURE__ */ jsx39(
|
|
3867
3940
|
"span",
|
|
3868
3941
|
{
|
|
3869
3942
|
className: cn(
|
|
@@ -3880,20 +3953,20 @@ function Toggle({ checked, onChange, label, size = "md", disabled, className, te
|
|
|
3880
3953
|
// src/AISpark.tsx
|
|
3881
3954
|
import { useId as useId5 } from "react";
|
|
3882
3955
|
import { Sparkles } from "lucide-react";
|
|
3883
|
-
import { Fragment as Fragment5, jsx as
|
|
3956
|
+
import { Fragment as Fragment5, jsx as jsx40, jsxs as jsxs35 } from "react/jsx-runtime";
|
|
3884
3957
|
function AISpark({ size = 16, className }) {
|
|
3885
3958
|
const id = useId5();
|
|
3886
|
-
return /* @__PURE__ */
|
|
3887
|
-
/* @__PURE__ */
|
|
3888
|
-
/* @__PURE__ */
|
|
3889
|
-
/* @__PURE__ */
|
|
3959
|
+
return /* @__PURE__ */ jsxs35(Fragment5, { children: [
|
|
3960
|
+
/* @__PURE__ */ jsx40("svg", { width: "0", height: "0", "aria-hidden": "true", style: { position: "absolute" }, children: /* @__PURE__ */ jsx40("defs", { children: /* @__PURE__ */ jsxs35("linearGradient", { id, x1: "0", y1: "0", x2: "1", y2: "1", children: [
|
|
3961
|
+
/* @__PURE__ */ jsx40("stop", { offset: "0%", stopColor: "var(--mr-color-brand-primary)" }),
|
|
3962
|
+
/* @__PURE__ */ jsx40("stop", { offset: "100%", className: "[stop-color:#9474ff] in-data-[theme=dark]:[stop-color:#a488ff]" })
|
|
3890
3963
|
] }) }) }),
|
|
3891
|
-
/* @__PURE__ */
|
|
3964
|
+
/* @__PURE__ */ jsx40(Sparkles, { size, stroke: `url(#${id})`, className, "aria-hidden": "true" })
|
|
3892
3965
|
] });
|
|
3893
3966
|
}
|
|
3894
3967
|
|
|
3895
3968
|
// src/Freshness.tsx
|
|
3896
|
-
import { jsx as
|
|
3969
|
+
import { jsx as jsx41 } from "react/jsx-runtime";
|
|
3897
3970
|
var dotColor = {
|
|
3898
3971
|
fresh: "bg-status-success",
|
|
3899
3972
|
recent: "bg-status-warning",
|
|
@@ -3905,7 +3978,7 @@ var srLabel = {
|
|
|
3905
3978
|
stale: "Older than a day"
|
|
3906
3979
|
};
|
|
3907
3980
|
function Freshness({ level }) {
|
|
3908
|
-
return /* @__PURE__ */
|
|
3981
|
+
return /* @__PURE__ */ jsx41(
|
|
3909
3982
|
"span",
|
|
3910
3983
|
{
|
|
3911
3984
|
className: cn("inline-block h-1.5 w-1.5 shrink-0 rounded-full", dotColor[level]),
|
|
@@ -3916,26 +3989,26 @@ function Freshness({ level }) {
|
|
|
3916
3989
|
}
|
|
3917
3990
|
|
|
3918
3991
|
// src/SectionHeading.tsx
|
|
3919
|
-
import { jsx as
|
|
3992
|
+
import { jsx as jsx42, jsxs as jsxs36 } from "react/jsx-runtime";
|
|
3920
3993
|
function SectionHeading({ title, description, actions, as: Tag2 = "h2", id, className }) {
|
|
3921
|
-
return /* @__PURE__ */
|
|
3922
|
-
/* @__PURE__ */
|
|
3923
|
-
/* @__PURE__ */
|
|
3924
|
-
description && /* @__PURE__ */
|
|
3994
|
+
return /* @__PURE__ */ jsxs36("div", { className: cn("flex flex-wrap items-end justify-between gap-x-4 gap-y-2", className), children: [
|
|
3995
|
+
/* @__PURE__ */ jsxs36("div", { className: "min-w-0", children: [
|
|
3996
|
+
/* @__PURE__ */ jsx42(Tag2, { id, className: "text-base font-semibold text-text-primary", children: title }),
|
|
3997
|
+
description && /* @__PURE__ */ jsx42("p", { className: "mt-0.5 text-dense text-text-secondary", children: description })
|
|
3925
3998
|
] }),
|
|
3926
|
-
actions && /* @__PURE__ */
|
|
3999
|
+
actions && /* @__PURE__ */ jsx42("div", { className: "flex shrink-0 items-center gap-2", children: actions })
|
|
3927
4000
|
] });
|
|
3928
4001
|
}
|
|
3929
4002
|
|
|
3930
4003
|
// src/PageHeader.tsx
|
|
3931
|
-
import { jsx as
|
|
4004
|
+
import { jsx as jsx43, jsxs as jsxs37 } from "react/jsx-runtime";
|
|
3932
4005
|
function PageHeader({ title, description, actions, className }) {
|
|
3933
|
-
return /* @__PURE__ */
|
|
3934
|
-
/* @__PURE__ */
|
|
3935
|
-
/* @__PURE__ */
|
|
3936
|
-
description && /* @__PURE__ */
|
|
4006
|
+
return /* @__PURE__ */ jsxs37("header", { className: cn("flex flex-wrap items-center justify-between gap-x-6 gap-y-3", className), children: [
|
|
4007
|
+
/* @__PURE__ */ jsxs37("div", { className: "min-w-0", children: [
|
|
4008
|
+
/* @__PURE__ */ jsx43("h1", { className: "text-xl font-semibold tracking-tight text-text-primary", children: title }),
|
|
4009
|
+
description && /* @__PURE__ */ jsx43("p", { className: "mt-0.5 max-w-2xl text-sm text-text-secondary", children: description })
|
|
3937
4010
|
] }),
|
|
3938
|
-
actions && /* @__PURE__ */
|
|
4011
|
+
actions && /* @__PURE__ */ jsx43("div", { className: "flex shrink-0 items-center gap-2", children: actions })
|
|
3939
4012
|
] });
|
|
3940
4013
|
}
|
|
3941
4014
|
export {
|
|
@@ -3982,6 +4055,7 @@ export {
|
|
|
3982
4055
|
StackedColumnPlaceholder,
|
|
3983
4056
|
TablePagination,
|
|
3984
4057
|
Tag,
|
|
4058
|
+
Toast,
|
|
3985
4059
|
Toggle,
|
|
3986
4060
|
Tooltip,
|
|
3987
4061
|
WorkspaceAvatar,
|