@estiva-app/ui 0.92.1 → 0.94.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/CollapsibleSection.d.ts +19 -2
- package/dist/CollapsibleSection.d.ts.map +1 -1
- package/dist/NavItem.d.ts +10 -2
- package/dist/NavItem.d.ts.map +1 -1
- package/dist/NavTree.d.ts +25 -3
- package/dist/NavTree.d.ts.map +1 -1
- package/dist/SectionHeader.d.ts +11 -1
- package/dist/SectionHeader.d.ts.map +1 -1
- package/dist/Toast.d.ts +6 -0
- package/dist/Toast.d.ts.map +1 -1
- package/dist/index.js +276 -201
- package/dist/index.js.map +4 -4
- package/package.json +1 -1
- package/registry.json +27 -3
- package/src/CollapsibleSection.tsx +30 -3
- package/src/NavItem.tsx +10 -1
- package/src/NavTree.mdx +31 -2
- package/src/NavTree.stories.tsx +140 -2
- package/src/NavTree.test.tsx +75 -0
- package/src/NavTree.tsx +102 -10
- package/src/SectionHeader.mdx +2 -0
- package/src/SectionHeader.tsx +30 -8
- package/src/Toast.mdx +3 -0
- package/src/Toast.tsx +8 -1
package/dist/index.js
CHANGED
|
@@ -3358,18 +3358,173 @@ function Breadcrumb({ items, className }) {
|
|
|
3358
3358
|
}
|
|
3359
3359
|
|
|
3360
3360
|
// src/NavItem.tsx
|
|
3361
|
-
import { useId as useId2, useState as
|
|
3361
|
+
import { useId as useId2, useState as useState10 } from "react";
|
|
3362
|
+
import { Collapsible as Collapsible2 } from "@base-ui/react/collapsible";
|
|
3363
|
+
import { IconAlertSquareRounded, IconChevronRight as IconChevronRight3, IconDotsVertical as IconDotsVertical2 } from "@tabler/icons-react";
|
|
3364
|
+
|
|
3365
|
+
// src/CollapsibleSection.tsx
|
|
3366
|
+
import { useEffect as useEffect6, useRef as useRef11, useState as useState9 } from "react";
|
|
3362
3367
|
import { Collapsible } from "@base-ui/react/collapsible";
|
|
3363
|
-
|
|
3368
|
+
|
|
3369
|
+
// src/SectionHeader.tsx
|
|
3370
|
+
import { IconChevronRight as IconChevronRight2, IconDotsVertical } from "@tabler/icons-react";
|
|
3371
|
+
import { useRender } from "@base-ui/react/use-render";
|
|
3372
|
+
import { Fragment as Fragment13, jsx as jsx49, jsxs as jsxs33 } from "react/jsx-runtime";
|
|
3373
|
+
function SectionHeader({ title, chevron = false, icon, isExpanded = true, onToggle, trailing, count, actions, menu, menuLabel, showActions = "hover", hover = "fill", look = "heading", render, className }) {
|
|
3374
|
+
const row = look === "row";
|
|
3375
|
+
const acts = actions && actions.length > 0 || menu != null;
|
|
3376
|
+
const trailingClasses = !acts ? "has-[[data-unread]]:-mr-1" : showActions === "hover" && "has-[[data-unread]]:pointer-events-none has-[[data-unread]]:absolute has-[[data-unread]]:inset-y-0 has-[[data-unread]]:right-1 has-[[data-unread]]:w-6 has-[[data-unread]]:justify-center has-[[data-unread]]:transition-opacity group-hover:has-[[data-unread]]:opacity-0 group-has-[:focus-visible]:has-[[data-unread]]:opacity-0 group-has-[[data-section-menu]_[aria-expanded=true]]:has-[[data-unread]]:opacity-0 [@media(hover:none)]:has-[[data-unread]]:opacity-0";
|
|
3377
|
+
const reveal = showActions === "hover" && "opacity-0 transition-opacity group-hover:opacity-100 group-has-[:focus-visible]:opacity-100 has-[[aria-expanded=true]]:opacity-100 [@media(hover:none)]:opacity-100";
|
|
3378
|
+
const titleElement = useRender({
|
|
3379
|
+
render: render ?? (chevron ? /* @__PURE__ */ jsx49("button", { type: "button", onClick: onToggle, "aria-expanded": isExpanded }) : /* @__PURE__ */ jsx49("span", {})),
|
|
3380
|
+
props: {
|
|
3381
|
+
// `text-left`: a button centres its text. `h-full` and `flex-1`: the
|
|
3382
|
+
// whole row up to the actions is the hit target, as it was when the
|
|
3383
|
+
// row itself carried the click.
|
|
3384
|
+
// An icon is a row's: NavItem's 8px after it.
|
|
3385
|
+
className: cn("flex h-full min-w-0 flex-1 items-center text-left", row || chevron || icon != null ? "gap-2" : "gap-1"),
|
|
3386
|
+
children: /* @__PURE__ */ jsxs33(Fragment13, { children: [
|
|
3387
|
+
icon != null ? /* @__PURE__ */ jsxs33("span", { className: "relative flex size-4 shrink-0 items-center justify-center text-text-secondary", children: [
|
|
3388
|
+
/* @__PURE__ */ jsx49("span", { className: cn("flex", chevron && "transition-opacity group-hover:opacity-0 group-has-[:focus-visible]:opacity-0"), children: icon }),
|
|
3389
|
+
chevron && /* @__PURE__ */ jsx49(
|
|
3390
|
+
IconChevronRight2,
|
|
3391
|
+
{
|
|
3392
|
+
size: 16,
|
|
3393
|
+
stroke: 1.5,
|
|
3394
|
+
className: cn("absolute opacity-0 transition-[opacity,transform] duration-150 group-hover:opacity-100 group-has-[:focus-visible]:opacity-100", isExpanded && "rotate-90")
|
|
3395
|
+
}
|
|
3396
|
+
)
|
|
3397
|
+
] }) : chevron && /* @__PURE__ */ jsx49(
|
|
3398
|
+
IconChevronRight2,
|
|
3399
|
+
{
|
|
3400
|
+
size: 16,
|
|
3401
|
+
stroke: 1.5,
|
|
3402
|
+
className: cn("shrink-0 transition-transform duration-150", !row && "text-text-secondary", isExpanded && "rotate-90")
|
|
3403
|
+
}
|
|
3404
|
+
),
|
|
3405
|
+
look === "quiet" ? /* @__PURE__ */ jsx49("span", { className: "min-w-0 truncate text-caption text-text-muted", children: title }) : row ? (
|
|
3406
|
+
// A row's words: NavItem's size and colour, brightening under the pointer with the row.
|
|
3407
|
+
/* @__PURE__ */ jsx49("span", { className: "min-w-0 flex-1 truncate text-body-2", children: title })
|
|
3408
|
+
) : /* @__PURE__ */ jsx49(SectionLabel, { folds: chevron, children: title }),
|
|
3409
|
+
count != null && /* @__PURE__ */ jsx49("span", { className: cn("ml-1 shrink-0", COUNT_TEXT_CLASSES), children: count })
|
|
3410
|
+
] })
|
|
3411
|
+
}
|
|
3412
|
+
});
|
|
3413
|
+
return /* @__PURE__ */ jsxs33(
|
|
3414
|
+
"div",
|
|
3415
|
+
{
|
|
3416
|
+
className: cn(
|
|
3417
|
+
// `relative`: a dot in the last button's place is placed against the row.
|
|
3418
|
+
"group relative flex h-[32px] shrink-0 items-center gap-1 px-2",
|
|
3419
|
+
!row && "transition-colors",
|
|
3420
|
+
// A row is NavItem's shape and colour: 6px corners, secondary words that brighten on hover.
|
|
3421
|
+
row ? cn(SIDEBAR_ROW_CLASSES, SIDEBAR_ROW_TEXT_CLASSES) : "rounded-lg",
|
|
3422
|
+
// The fill says "this does something": a row with a toggle or actions
|
|
3423
|
+
// lights up, a fixed heading over rows does not (2026-09-09, the
|
|
3424
|
+
// Sidebar's fixed group).
|
|
3425
|
+
// A quiet label never lights up: it is a label; its button does.
|
|
3426
|
+
hover === "fill" && look !== "quiet" && (chevron || acts) && "hover:bg-bg-hover",
|
|
3427
|
+
// While its menu is open the pointer is on the menu, not the row: the
|
|
3428
|
+
// row keeps its hover look, as a NavItem's does.
|
|
3429
|
+
hover === "fill" && look !== "quiet" && menu != null && "has-[[data-section-menu]_[aria-expanded=true]]:bg-bg-hover",
|
|
3430
|
+
className
|
|
3431
|
+
),
|
|
3432
|
+
children: [
|
|
3433
|
+
titleElement,
|
|
3434
|
+
trailing != null && /* @__PURE__ */ jsx49("div", { className: cn("flex shrink-0 items-center", trailingClasses), children: trailing }),
|
|
3435
|
+
acts && /* @__PURE__ */ jsx49(
|
|
3436
|
+
"div",
|
|
3437
|
+
{
|
|
3438
|
+
className: "-mr-1 flex shrink-0 items-center",
|
|
3439
|
+
children: /* @__PURE__ */ jsxs33("div", { className: cn("flex items-center gap-1", reveal), children: [
|
|
3440
|
+
actions?.map(
|
|
3441
|
+
(action) => action.menu != null ? (
|
|
3442
|
+
// `data-section-menu`, as the ⋮ has: the row stays lit while its menu is open.
|
|
3443
|
+
/* @__PURE__ */ jsx49("div", { "data-section-menu": true, className: "flex items-center", children: /* @__PURE__ */ jsx49(
|
|
3444
|
+
Menu,
|
|
3445
|
+
{
|
|
3446
|
+
align: "right",
|
|
3447
|
+
trigger: /* @__PURE__ */ jsx49(IconButton, { tooltip: action.tooltip, "aria-label": action.tooltip, children: action.icon }),
|
|
3448
|
+
children: action.menu
|
|
3449
|
+
}
|
|
3450
|
+
) }, action.tooltip)
|
|
3451
|
+
) : /* @__PURE__ */ jsx49(IconButton, { tooltip: action.tooltip, "aria-label": action.tooltip, onClick: action.onClick, children: action.icon }, action.tooltip)
|
|
3452
|
+
),
|
|
3453
|
+
menu != null && /* @__PURE__ */ jsx49("div", { "data-section-menu": true, className: "flex items-center", children: /* @__PURE__ */ jsx49(
|
|
3454
|
+
Menu,
|
|
3455
|
+
{
|
|
3456
|
+
align: "right",
|
|
3457
|
+
trigger: /* @__PURE__ */ jsx49(IconButton, { tooltip: "More options", "aria-label": menuLabel ?? `More options for ${title}`, children: /* @__PURE__ */ jsx49(IconDotsVertical, { size: 16, stroke: 1.5 }) }),
|
|
3458
|
+
children: menu
|
|
3459
|
+
}
|
|
3460
|
+
) })
|
|
3461
|
+
] })
|
|
3462
|
+
}
|
|
3463
|
+
)
|
|
3464
|
+
]
|
|
3465
|
+
}
|
|
3466
|
+
);
|
|
3467
|
+
}
|
|
3468
|
+
|
|
3469
|
+
// src/CollapsibleSection.tsx
|
|
3470
|
+
import { jsx as jsx50, jsxs as jsxs34 } from "react/jsx-runtime";
|
|
3471
|
+
var OPEN = "open";
|
|
3472
|
+
var CLOSED = "closed";
|
|
3473
|
+
function useOpenFor(openFor, open, setOpen) {
|
|
3474
|
+
const seen = useRef11(void 0);
|
|
3475
|
+
useEffect6(() => {
|
|
3476
|
+
if (openFor === seen.current) return;
|
|
3477
|
+
seen.current = openFor;
|
|
3478
|
+
if (openFor !== void 0 && !open) setOpen(true);
|
|
3479
|
+
}, [openFor]);
|
|
3480
|
+
}
|
|
3481
|
+
function readStored(key) {
|
|
3482
|
+
if (!key) return void 0;
|
|
3483
|
+
try {
|
|
3484
|
+
const value = window.localStorage.getItem(key);
|
|
3485
|
+
return value === OPEN ? true : value === CLOSED ? false : void 0;
|
|
3486
|
+
} catch {
|
|
3487
|
+
return void 0;
|
|
3488
|
+
}
|
|
3489
|
+
}
|
|
3490
|
+
function writeStored(key, open) {
|
|
3491
|
+
if (!key) return;
|
|
3492
|
+
try {
|
|
3493
|
+
window.localStorage.setItem(key, open ? OPEN : CLOSED);
|
|
3494
|
+
} catch {
|
|
3495
|
+
}
|
|
3496
|
+
}
|
|
3497
|
+
function CollapsibleSection({ title, defaultOpen = true, open: openProp, onOpenChange, pending = false, storageKey, openFor, icon, trailing, actions, menu, menuLabel, showActions, look = "heading", indent = false, children, className, contentClassName }) {
|
|
3498
|
+
const [openState, setOpenState] = useState9(() => readStored(storageKey) ?? defaultOpen);
|
|
3499
|
+
const open = openProp ?? openState;
|
|
3500
|
+
const setOpen = (next) => {
|
|
3501
|
+
setOpenState(next);
|
|
3502
|
+
writeStored(storageKey, next);
|
|
3503
|
+
onOpenChange?.(next);
|
|
3504
|
+
};
|
|
3505
|
+
useOpenFor(openFor, open, setOpen);
|
|
3506
|
+
const shown = open && !pending;
|
|
3507
|
+
return /* @__PURE__ */ jsxs34(Collapsible.Root, { open: shown, onOpenChange: (next, details) => setOpen(pending && details.reason === "trigger-press" ? !open : next), className: cn("flex flex-col", className), children: [
|
|
3508
|
+
/* @__PURE__ */ jsx50(SectionHeader, { title, chevron: true, icon, isExpanded: open, trailing, actions, menu, menuLabel, showActions, look, className: "shrink-0", render: /* @__PURE__ */ jsx50(Collapsible.Trigger, { "aria-expanded": open, "aria-busy": pending && open ? true : void 0 }) }),
|
|
3509
|
+
/* @__PURE__ */ jsx50(
|
|
3510
|
+
Collapsible.Panel,
|
|
3511
|
+
{
|
|
3512
|
+
hiddenUntilFound: true,
|
|
3513
|
+
className: COLLAPSIBLE_PANEL_CLASSES,
|
|
3514
|
+
children: /* @__PURE__ */ jsx50("div", { className: cn("flex flex-col pt-0.5", (look === "row" || indent) && "pl-6", contentClassName), children })
|
|
3515
|
+
}
|
|
3516
|
+
)
|
|
3517
|
+
] });
|
|
3518
|
+
}
|
|
3364
3519
|
|
|
3365
3520
|
// src/UnreadDot.tsx
|
|
3366
|
-
import { jsx as
|
|
3521
|
+
import { jsx as jsx51 } from "react/jsx-runtime";
|
|
3367
3522
|
function UnreadDot({ className }) {
|
|
3368
|
-
return /* @__PURE__ */
|
|
3523
|
+
return /* @__PURE__ */ jsx51("div", { className: cn("flex h-6 w-6 shrink-0 items-center justify-center", className), "data-unread": true, children: /* @__PURE__ */ jsx51("div", { className: "h-1.5 w-1.5 rounded-full bg-accent-primary" }) });
|
|
3369
3524
|
}
|
|
3370
3525
|
|
|
3371
3526
|
// src/NavItem.tsx
|
|
3372
|
-
import { jsx as
|
|
3527
|
+
import { jsx as jsx52, jsxs as jsxs35 } from "react/jsx-runtime";
|
|
3373
3528
|
function NavItem({
|
|
3374
3529
|
label,
|
|
3375
3530
|
href,
|
|
@@ -3388,12 +3543,13 @@ function NavItem({
|
|
|
3388
3543
|
defaultOpen = true,
|
|
3389
3544
|
open: openProp,
|
|
3390
3545
|
onOpenChange,
|
|
3546
|
+
openFor,
|
|
3391
3547
|
className,
|
|
3392
3548
|
onClick,
|
|
3393
3549
|
...props
|
|
3394
3550
|
}) {
|
|
3395
3551
|
const inApp = useInAppClick(href, onClick);
|
|
3396
|
-
const [openState, setOpenState] =
|
|
3552
|
+
const [openState, setOpenState] = useState10(defaultOpen);
|
|
3397
3553
|
const panelId = useId2();
|
|
3398
3554
|
const hasRows = children != null && children !== false;
|
|
3399
3555
|
const open = openProp ?? openState;
|
|
@@ -3401,11 +3557,12 @@ function NavItem({
|
|
|
3401
3557
|
setOpenState(next);
|
|
3402
3558
|
onOpenChange?.(next);
|
|
3403
3559
|
};
|
|
3560
|
+
useOpenFor(hasRows ? openFor : void 0, open, setOpen);
|
|
3404
3561
|
const buttons = (menu != null ? 1 : 0) + (action ? 1 : 0);
|
|
3405
3562
|
const besides = buttons > 0 || hasRows;
|
|
3406
|
-
const mark = unread ? urgent ? /* @__PURE__ */
|
|
3563
|
+
const mark = unread ? urgent ? /* @__PURE__ */ jsx52(UrgentMark, {}) : /* @__PURE__ */ jsx52(UnreadDot, {}) : null;
|
|
3407
3564
|
const stepsAside = buttons > 0 && "transition-opacity group-hover/nav:opacity-0 group-has-[:focus-visible]/nav:opacity-0 group-has-[[data-nav-menu]_[aria-expanded=true]]/nav:opacity-0 [@media(hover:none)]:opacity-0";
|
|
3408
|
-
const row = /* @__PURE__ */
|
|
3565
|
+
const row = /* @__PURE__ */ jsxs35(
|
|
3409
3566
|
"a",
|
|
3410
3567
|
{
|
|
3411
3568
|
href,
|
|
@@ -3427,7 +3584,7 @@ function NavItem({
|
|
|
3427
3584
|
...props,
|
|
3428
3585
|
onClick: inApp,
|
|
3429
3586
|
children: [
|
|
3430
|
-
(icon || hasRows) && /* @__PURE__ */
|
|
3587
|
+
(icon || hasRows) && /* @__PURE__ */ jsx52(
|
|
3431
3588
|
"span",
|
|
3432
3589
|
{
|
|
3433
3590
|
className: cn(
|
|
@@ -3441,14 +3598,14 @@ function NavItem({
|
|
|
3441
3598
|
tooltip?.trim() ? (
|
|
3442
3599
|
// On the label alone, not the row: the ⋮ and the action keep their
|
|
3443
3600
|
// own tooltips, and the two never stand up at once.
|
|
3444
|
-
/* @__PURE__ */
|
|
3445
|
-
) : /* @__PURE__ */
|
|
3601
|
+
/* @__PURE__ */ jsx52(WithTooltip, { label: tooltip, inline: true, wrapperClassName: "flex min-w-0 flex-1", children: /* @__PURE__ */ jsx52("span", { className: cn("flex-1 truncate", unread && "font-medium"), children: label }) })
|
|
3602
|
+
) : /* @__PURE__ */ jsx52("span", { className: cn("flex-1 truncate", unread && "font-medium"), children: label }),
|
|
3446
3603
|
hint != null && // Takes room only while it shows, so the label gives way to it.
|
|
3447
|
-
/* @__PURE__ */
|
|
3604
|
+
/* @__PURE__ */ jsx52("span", { className: "hidden shrink-0 items-center group-hover/nav:flex group-has-[:focus-visible]/nav:flex", children: hint }),
|
|
3448
3605
|
buttons > 1 && // Two buttons: the second one's room (24px and the 4px between them, the
|
|
3449
3606
|
// row's 8px gap making up the rest), kept only while they show.
|
|
3450
|
-
/* @__PURE__ */
|
|
3451
|
-
count ? /* @__PURE__ */
|
|
3607
|
+
/* @__PURE__ */ jsx52("span", { "aria-hidden": "true", className: "hidden w-5 shrink-0 group-hover/nav:block group-has-[:focus-visible]/nav:block group-has-[[data-nav-menu]_[aria-expanded=true]]/nav:block [@media(hover:none)]:block" }),
|
|
3608
|
+
count ? /* @__PURE__ */ jsx52(WithTooltip, { label: countLabel ?? `${count} open`, children: /* @__PURE__ */ jsx52(
|
|
3452
3609
|
"span",
|
|
3453
3610
|
{
|
|
3454
3611
|
className: cn(
|
|
@@ -3464,7 +3621,7 @@ function NavItem({
|
|
|
3464
3621
|
// `-mr-1`: the 24px slot's dot then sits on the axis of a count and
|
|
3465
3622
|
// of the ⋮ (8px from the edge to the 16px box), one column with a
|
|
3466
3623
|
// folder heading's dot and ⋮ (Katerina, 5 October).
|
|
3467
|
-
/* @__PURE__ */
|
|
3624
|
+
/* @__PURE__ */ jsx52("span", { className: cn("-mr-1 flex shrink-0", stepsAside), children: mark })
|
|
3468
3625
|
) : buttons > 0 && !count ? (
|
|
3469
3626
|
// Nothing at the right, but a menu: no room is kept at rest, so the
|
|
3470
3627
|
// label has the row's whole width; while the ⋮ shows, its 24px slot
|
|
@@ -3472,18 +3629,18 @@ function NavItem({
|
|
|
3472
3629
|
// `-mr-1`: the ⋮ sits at `right-1`, 4px into the row's padding, so the
|
|
3473
3630
|
// slot does too — at the padding's edge it kept 4px the ⋮ never
|
|
3474
3631
|
// covers, and the label stopped 12px short of the button, not 8.
|
|
3475
|
-
/* @__PURE__ */
|
|
3632
|
+
/* @__PURE__ */ jsx52("span", { "aria-hidden": "true", className: "-mr-1 hidden w-6 shrink-0 group-hover/nav:block group-has-[:focus-visible]/nav:block group-has-[[data-nav-menu]_[aria-expanded=true]]/nav:block [@media(hover:none)]:block" })
|
|
3476
3633
|
) : null
|
|
3477
3634
|
]
|
|
3478
3635
|
}
|
|
3479
3636
|
);
|
|
3480
3637
|
if (!besides && hint == null) return row;
|
|
3481
3638
|
const name = menuLabel ?? `More options for ${label}`;
|
|
3482
|
-
const line = /* @__PURE__ */
|
|
3639
|
+
const line = /* @__PURE__ */ jsxs35("div", { className: "group/nav relative shrink-0", children: [
|
|
3483
3640
|
row,
|
|
3484
3641
|
hasRows && // `left-1`: the 24px button's 16px arrow then sits where the icon
|
|
3485
3642
|
// sits (the row's px-2), so the icon turns into the arrow in place.
|
|
3486
|
-
/* @__PURE__ */
|
|
3643
|
+
/* @__PURE__ */ jsx52("div", { className: "absolute inset-y-0 left-1 flex items-center opacity-0 transition-opacity group-hover/nav:opacity-100 group-has-[:focus-visible]/nav:opacity-100", children: /* @__PURE__ */ jsx52(
|
|
3487
3644
|
IconButton,
|
|
3488
3645
|
{
|
|
3489
3646
|
tooltip: open ? "Collapse" : "Expand",
|
|
@@ -3491,7 +3648,7 @@ function NavItem({
|
|
|
3491
3648
|
"aria-expanded": open,
|
|
3492
3649
|
"aria-controls": panelId,
|
|
3493
3650
|
onClick: () => setOpen(!open),
|
|
3494
|
-
children: /* @__PURE__ */
|
|
3651
|
+
children: /* @__PURE__ */ jsx52(IconChevronRight3, { size: 16, stroke: 1.5, className: cn("transition-transform duration-150", open && "rotate-90") })
|
|
3495
3652
|
}
|
|
3496
3653
|
) }),
|
|
3497
3654
|
buttons > 0 && // `right-1`: the 24px button's 16px icon ends 8px from the row's
|
|
@@ -3502,184 +3659,78 @@ function NavItem({
|
|
|
3502
3659
|
// right of the slot's centre.
|
|
3503
3660
|
// On a screen with no hover it always shows: nothing there can point
|
|
3504
3661
|
// at the row, and the menu has no other way in.
|
|
3505
|
-
/* @__PURE__ */
|
|
3506
|
-
action && /* @__PURE__ */
|
|
3507
|
-
menu != null && /* @__PURE__ */
|
|
3662
|
+
/* @__PURE__ */ jsxs35("div", { "data-nav-menu": true, className: cn("absolute inset-y-0 right-1 flex items-center gap-1", "opacity-0 transition-opacity group-hover/nav:opacity-100 group-has-[:focus-visible]/nav:opacity-100 has-[[aria-expanded=true]]:opacity-100 [@media(hover:none)]:opacity-100"), children: [
|
|
3663
|
+
action && /* @__PURE__ */ jsx52(IconButton, { tooltip: action.tooltip, "aria-label": `${action.tooltip}: ${label}`, onClick: action.onClick, children: action.icon }),
|
|
3664
|
+
menu != null && /* @__PURE__ */ jsx52(
|
|
3508
3665
|
Menu,
|
|
3509
3666
|
{
|
|
3510
3667
|
align: "right",
|
|
3511
|
-
trigger: /* @__PURE__ */
|
|
3668
|
+
trigger: /* @__PURE__ */ jsx52(IconButton, { tooltip: "More options", "aria-label": name, children: /* @__PURE__ */ jsx52(IconDotsVertical2, { size: 16, stroke: 1.5 }) }),
|
|
3512
3669
|
children: menu
|
|
3513
3670
|
}
|
|
3514
3671
|
)
|
|
3515
3672
|
] })
|
|
3516
3673
|
] });
|
|
3517
3674
|
if (!hasRows) return line;
|
|
3518
|
-
return /* @__PURE__ */
|
|
3675
|
+
return /* @__PURE__ */ jsxs35(Collapsible2.Root, { open, onOpenChange: setOpen, className: "flex shrink-0 flex-col", children: [
|
|
3519
3676
|
line,
|
|
3520
|
-
/* @__PURE__ */
|
|
3521
|
-
|
|
3677
|
+
/* @__PURE__ */ jsx52(
|
|
3678
|
+
Collapsible2.Panel,
|
|
3522
3679
|
{
|
|
3523
3680
|
id: panelId,
|
|
3524
3681
|
hiddenUntilFound: true,
|
|
3525
3682
|
className: COLLAPSIBLE_PANEL_CLASSES,
|
|
3526
|
-
children: /* @__PURE__ */
|
|
3683
|
+
children: /* @__PURE__ */ jsx52("div", { className: "flex flex-col gap-0.5 pt-0.5 pl-6", children })
|
|
3527
3684
|
}
|
|
3528
3685
|
)
|
|
3529
3686
|
] });
|
|
3530
3687
|
}
|
|
3531
3688
|
function UrgentMark() {
|
|
3532
|
-
return /* @__PURE__ */
|
|
3689
|
+
return /* @__PURE__ */ jsx52("div", { className: "flex h-6 w-6 shrink-0 items-center justify-center", "data-urgent": true, children: /* @__PURE__ */ jsx52("div", { className: "flex items-center rounded-full bg-warning-muted p-0.5 signal:shadow-glow-warning", children: /* @__PURE__ */ jsx52(IconAlertSquareRounded, { size: 12, stroke: 2.5, className: "text-warning-default" }) }) });
|
|
3533
3690
|
}
|
|
3534
3691
|
|
|
3535
3692
|
// src/NavTree.tsx
|
|
3536
|
-
import { useEffect as
|
|
3537
|
-
|
|
3538
|
-
|
|
3539
|
-
|
|
3540
|
-
|
|
3541
|
-
|
|
3542
|
-
// src/SectionHeader.tsx
|
|
3543
|
-
import { IconChevronRight as IconChevronRight3, IconDotsVertical as IconDotsVertical2 } from "@tabler/icons-react";
|
|
3544
|
-
import { useRender } from "@base-ui/react/use-render";
|
|
3545
|
-
import { Fragment as Fragment13, jsx as jsx51, jsxs as jsxs34 } from "react/jsx-runtime";
|
|
3546
|
-
function SectionHeader({ title, chevron = false, icon, isExpanded = true, onToggle, trailing, count, actions, menu, menuLabel, showActions = "hover", hover = "fill", look = "heading", render, className }) {
|
|
3547
|
-
const row = look === "row";
|
|
3548
|
-
const acts = actions && actions.length > 0 || menu != null;
|
|
3549
|
-
const trailingClasses = !acts ? "has-[[data-unread]]:-mr-1" : showActions === "hover" && "has-[[data-unread]]:pointer-events-none has-[[data-unread]]:absolute has-[[data-unread]]:inset-y-0 has-[[data-unread]]:right-1 has-[[data-unread]]:w-6 has-[[data-unread]]:justify-center has-[[data-unread]]:transition-opacity group-hover:has-[[data-unread]]:opacity-0 group-has-[:focus-visible]:has-[[data-unread]]:opacity-0 group-has-[[data-section-menu]_[aria-expanded=true]]:has-[[data-unread]]:opacity-0 [@media(hover:none)]:has-[[data-unread]]:opacity-0";
|
|
3550
|
-
const reveal = showActions === "hover" && "opacity-0 transition-opacity group-hover:opacity-100 group-has-[:focus-visible]:opacity-100 has-[[aria-expanded=true]]:opacity-100 [@media(hover:none)]:opacity-100";
|
|
3551
|
-
const titleElement = useRender({
|
|
3552
|
-
render: render ?? (chevron ? /* @__PURE__ */ jsx51("button", { type: "button", onClick: onToggle, "aria-expanded": isExpanded }) : /* @__PURE__ */ jsx51("span", {})),
|
|
3553
|
-
props: {
|
|
3554
|
-
// `text-left`: a button centres its text. `h-full` and `flex-1`: the
|
|
3555
|
-
// whole row up to the actions is the hit target, as it was when the
|
|
3556
|
-
// row itself carried the click.
|
|
3557
|
-
// An icon is a row's: NavItem's 8px after it.
|
|
3558
|
-
className: cn("flex h-full min-w-0 flex-1 items-center text-left", row || chevron || icon != null ? "gap-2" : "gap-1"),
|
|
3559
|
-
children: /* @__PURE__ */ jsxs34(Fragment13, { children: [
|
|
3560
|
-
icon != null ? /* @__PURE__ */ jsxs34("span", { className: "relative flex size-4 shrink-0 items-center justify-center text-text-secondary", children: [
|
|
3561
|
-
/* @__PURE__ */ jsx51("span", { className: cn("flex", chevron && "transition-opacity group-hover:opacity-0 group-has-[:focus-visible]:opacity-0"), children: icon }),
|
|
3562
|
-
chevron && /* @__PURE__ */ jsx51(
|
|
3563
|
-
IconChevronRight3,
|
|
3564
|
-
{
|
|
3565
|
-
size: 16,
|
|
3566
|
-
stroke: 1.5,
|
|
3567
|
-
className: cn("absolute opacity-0 transition-[opacity,transform] duration-150 group-hover:opacity-100 group-has-[:focus-visible]:opacity-100", isExpanded && "rotate-90")
|
|
3568
|
-
}
|
|
3569
|
-
)
|
|
3570
|
-
] }) : chevron && /* @__PURE__ */ jsx51(
|
|
3571
|
-
IconChevronRight3,
|
|
3572
|
-
{
|
|
3573
|
-
size: 16,
|
|
3574
|
-
stroke: 1.5,
|
|
3575
|
-
className: cn("shrink-0 transition-transform duration-150", !row && "text-text-secondary", isExpanded && "rotate-90")
|
|
3576
|
-
}
|
|
3577
|
-
),
|
|
3578
|
-
look === "quiet" ? /* @__PURE__ */ jsx51("span", { className: "min-w-0 truncate text-caption text-text-muted", children: title }) : row ? (
|
|
3579
|
-
// A row's words: NavItem's size and colour, brightening under the pointer with the row.
|
|
3580
|
-
/* @__PURE__ */ jsx51("span", { className: "min-w-0 flex-1 truncate text-body-2", children: title })
|
|
3581
|
-
) : /* @__PURE__ */ jsx51(SectionLabel, { folds: chevron, children: title }),
|
|
3582
|
-
count != null && /* @__PURE__ */ jsx51("span", { className: cn("ml-1 shrink-0", COUNT_TEXT_CLASSES), children: count })
|
|
3583
|
-
] })
|
|
3584
|
-
}
|
|
3585
|
-
});
|
|
3586
|
-
return /* @__PURE__ */ jsxs34(
|
|
3587
|
-
"div",
|
|
3588
|
-
{
|
|
3589
|
-
className: cn(
|
|
3590
|
-
// `relative`: a dot in the last button's place is placed against the row.
|
|
3591
|
-
"group relative flex h-[32px] shrink-0 items-center gap-1 px-2",
|
|
3592
|
-
!row && "transition-colors",
|
|
3593
|
-
// A row is NavItem's shape and colour: 6px corners, secondary words that brighten on hover.
|
|
3594
|
-
row ? cn(SIDEBAR_ROW_CLASSES, SIDEBAR_ROW_TEXT_CLASSES) : "rounded-lg",
|
|
3595
|
-
// The fill says "this does something": a row with a toggle or actions
|
|
3596
|
-
// lights up, a fixed heading over rows does not (2026-09-09, the
|
|
3597
|
-
// Sidebar's fixed group).
|
|
3598
|
-
// A quiet label never lights up: it is a label; its button does.
|
|
3599
|
-
hover === "fill" && look !== "quiet" && (chevron || acts) && "hover:bg-bg-hover",
|
|
3600
|
-
// While its menu is open the pointer is on the menu, not the row: the
|
|
3601
|
-
// row keeps its hover look, as a NavItem's does.
|
|
3602
|
-
hover === "fill" && look !== "quiet" && menu != null && "has-[[data-section-menu]_[aria-expanded=true]]:bg-bg-hover",
|
|
3603
|
-
className
|
|
3604
|
-
),
|
|
3605
|
-
children: [
|
|
3606
|
-
titleElement,
|
|
3607
|
-
trailing != null && /* @__PURE__ */ jsx51("div", { className: cn("flex shrink-0 items-center", trailingClasses), children: trailing }),
|
|
3608
|
-
acts && /* @__PURE__ */ jsx51(
|
|
3609
|
-
"div",
|
|
3610
|
-
{
|
|
3611
|
-
className: "-mr-1 flex shrink-0 items-center",
|
|
3612
|
-
children: /* @__PURE__ */ jsxs34("div", { className: cn("flex items-center gap-1", reveal), children: [
|
|
3613
|
-
actions?.map((action) => /* @__PURE__ */ jsx51(IconButton, { tooltip: action.tooltip, "aria-label": action.tooltip, onClick: action.onClick, children: action.icon }, action.tooltip)),
|
|
3614
|
-
menu != null && /* @__PURE__ */ jsx51("div", { "data-section-menu": true, className: "flex items-center", children: /* @__PURE__ */ jsx51(
|
|
3615
|
-
Menu,
|
|
3616
|
-
{
|
|
3617
|
-
align: "right",
|
|
3618
|
-
trigger: /* @__PURE__ */ jsx51(IconButton, { tooltip: "More options", "aria-label": menuLabel ?? `More options for ${title}`, children: /* @__PURE__ */ jsx51(IconDotsVertical2, { size: 16, stroke: 1.5 }) }),
|
|
3619
|
-
children: menu
|
|
3620
|
-
}
|
|
3621
|
-
) })
|
|
3622
|
-
] })
|
|
3623
|
-
}
|
|
3624
|
-
)
|
|
3625
|
-
]
|
|
3626
|
-
}
|
|
3627
|
-
);
|
|
3693
|
+
import { useEffect as useEffect7, useRef as useRef12 } from "react";
|
|
3694
|
+
import { jsx as jsx53, jsxs as jsxs36 } from "react/jsx-runtime";
|
|
3695
|
+
var NAV_TREE_INTENT_MS = 150;
|
|
3696
|
+
var NAV_TREE_REVEAL_MS = 200;
|
|
3697
|
+
function holds(nodes, id) {
|
|
3698
|
+
return !!nodes && id !== void 0 && nodes.some((node) => node.id === id || holds(node.children ?? null, id));
|
|
3628
3699
|
}
|
|
3629
|
-
|
|
3630
|
-
|
|
3631
|
-
|
|
3632
|
-
|
|
3633
|
-
|
|
3634
|
-
function readStored(key) {
|
|
3635
|
-
if (!key) return void 0;
|
|
3636
|
-
try {
|
|
3637
|
-
const value = window.localStorage.getItem(key);
|
|
3638
|
-
return value === OPEN ? true : value === CLOSED ? false : void 0;
|
|
3639
|
-
} catch {
|
|
3640
|
-
return void 0;
|
|
3700
|
+
function rowsAbove(nodes, id) {
|
|
3701
|
+
for (const node of nodes ?? []) {
|
|
3702
|
+
if (node.id === id) return [];
|
|
3703
|
+
const inner = rowsAbove(node.children, id);
|
|
3704
|
+
if (inner) return [node.id, ...inner];
|
|
3641
3705
|
}
|
|
3642
|
-
|
|
3643
|
-
|
|
3644
|
-
|
|
3645
|
-
|
|
3646
|
-
|
|
3647
|
-
|
|
3706
|
+
return null;
|
|
3707
|
+
}
|
|
3708
|
+
function openingFor(groups, selected, selectedParent) {
|
|
3709
|
+
const item = selected ?? selectedParent;
|
|
3710
|
+
if (item === void 0) return null;
|
|
3711
|
+
for (const [target, andItself] of [[selected, false], [selectedParent, true]]) {
|
|
3712
|
+
if (target === void 0) continue;
|
|
3713
|
+
for (const group of groups) {
|
|
3714
|
+
const above = rowsAbove(group.nodes, target);
|
|
3715
|
+
if (above) return { item, group: group.id, rows: new Set(andItself ? [...above, target] : above) };
|
|
3716
|
+
}
|
|
3648
3717
|
}
|
|
3718
|
+
return null;
|
|
3649
3719
|
}
|
|
3650
|
-
function
|
|
3651
|
-
|
|
3652
|
-
|
|
3653
|
-
|
|
3654
|
-
|
|
3655
|
-
|
|
3656
|
-
|
|
3657
|
-
|
|
3658
|
-
const shown = open && !pending;
|
|
3659
|
-
return /* @__PURE__ */ jsxs35(Collapsible2.Root, { open: shown, onOpenChange: (next, details) => setOpen(pending && details.reason === "trigger-press" ? !open : next), className: cn("flex flex-col", className), children: [
|
|
3660
|
-
/* @__PURE__ */ jsx52(SectionHeader, { title, chevron: true, icon, isExpanded: open, trailing, actions, menu, menuLabel, showActions, look, className: "shrink-0", render: /* @__PURE__ */ jsx52(Collapsible2.Trigger, { "aria-expanded": open, "aria-busy": pending && open ? true : void 0 }) }),
|
|
3661
|
-
/* @__PURE__ */ jsx52(
|
|
3662
|
-
Collapsible2.Panel,
|
|
3663
|
-
{
|
|
3664
|
-
hiddenUntilFound: true,
|
|
3665
|
-
className: COLLAPSIBLE_PANEL_CLASSES,
|
|
3666
|
-
children: /* @__PURE__ */ jsx52("div", { className: cn("flex flex-col pt-0.5", (look === "row" || indent) && "pl-6", contentClassName), children })
|
|
3667
|
-
}
|
|
3668
|
-
)
|
|
3669
|
-
] });
|
|
3670
|
-
}
|
|
3671
|
-
|
|
3672
|
-
// src/NavTree.tsx
|
|
3673
|
-
import { Fragment as Fragment14, jsx as jsx53, jsxs as jsxs36 } from "react/jsx-runtime";
|
|
3674
|
-
var NAV_TREE_INTENT_MS = 150;
|
|
3675
|
-
function holds(nodes, id) {
|
|
3676
|
-
return !!nodes && id !== void 0 && nodes.some((node) => node.id === id || holds(node.children ?? null, id));
|
|
3720
|
+
function scrollToRow(row) {
|
|
3721
|
+
let box = row.parentElement;
|
|
3722
|
+
while (box && !(/(auto|scroll)/.test(getComputedStyle(box).overflowY) && box.scrollHeight > box.clientHeight)) box = box.parentElement;
|
|
3723
|
+
if (!box || box === document.documentElement || box === document.body) return;
|
|
3724
|
+
const at = row.getBoundingClientRect();
|
|
3725
|
+
const view = box.getBoundingClientRect();
|
|
3726
|
+
if (at.top < view.top) box.scrollTop -= view.top - at.top;
|
|
3727
|
+
else if (at.bottom > view.bottom) box.scrollTop += at.bottom - view.bottom;
|
|
3677
3728
|
}
|
|
3678
3729
|
function Line({ message }) {
|
|
3679
3730
|
return /* @__PURE__ */ jsx53("div", { className: "px-2 py-1", children: /* @__PURE__ */ jsx53(EmptyState, { scope: "section", message }) });
|
|
3680
3731
|
}
|
|
3681
|
-
function Row({ node, selected, onSelect }) {
|
|
3682
|
-
const under = node.childrenMessage !== void 0 ? /* @__PURE__ */ jsx53(Line, { message: node.childrenMessage }) : node.children?.length ? node.children.map((child) => /* @__PURE__ */ jsx53(Row, { node: child, selected, onSelect }, child.id)) : node.children === null || node.hasChildren && node.children === void 0 ? /* @__PURE__ */ jsx53(SkeletonList, { rows: 2 }) : void 0;
|
|
3732
|
+
function Row({ node, selected, onSelect, opening }) {
|
|
3733
|
+
const under = node.childrenMessage !== void 0 ? /* @__PURE__ */ jsx53(Line, { message: node.childrenMessage }) : node.children?.length ? node.children.map((child) => /* @__PURE__ */ jsx53(Row, { node: child, selected, onSelect, opening }, child.id)) : node.children === null || node.hasChildren && node.children === void 0 ? /* @__PURE__ */ jsx53(SkeletonList, { rows: 2 }) : void 0;
|
|
3683
3734
|
return /* @__PURE__ */ jsx53(
|
|
3684
3735
|
NavItem,
|
|
3685
3736
|
{
|
|
@@ -3696,12 +3747,13 @@ function Row({ node, selected, onSelect }) {
|
|
|
3696
3747
|
defaultOpen: node.defaultOpen ?? true,
|
|
3697
3748
|
open: node.open,
|
|
3698
3749
|
onOpenChange: node.onOpenChange,
|
|
3750
|
+
openFor: opening?.rows.has(node.id) ? opening.item : void 0,
|
|
3699
3751
|
onClick: onSelect ? (event) => onSelect(node, event) : void 0,
|
|
3700
3752
|
children: under
|
|
3701
3753
|
}
|
|
3702
3754
|
);
|
|
3703
3755
|
}
|
|
3704
|
-
function Group({ group, selected, onSelect, storageKey }) {
|
|
3756
|
+
function Group({ group, selected, onSelect, opening, storageKey }) {
|
|
3705
3757
|
return /* @__PURE__ */ jsx53(
|
|
3706
3758
|
NavTreeSection,
|
|
3707
3759
|
{
|
|
@@ -3717,14 +3769,15 @@ function Group({ group, selected, onSelect, storageKey }) {
|
|
|
3717
3769
|
open: group.open,
|
|
3718
3770
|
onOpenChange: group.onOpenChange,
|
|
3719
3771
|
storageKey: storageKey ? `${storageKey}.${group.id}` : void 0,
|
|
3772
|
+
openFor: opening?.group === group.id ? opening.item : void 0,
|
|
3720
3773
|
onIntent: group.onIntent,
|
|
3721
|
-
children: group.nodes?.map((node) => /* @__PURE__ */ jsx53(Row, { node, selected, onSelect }, node.id))
|
|
3774
|
+
children: group.nodes?.map((node) => /* @__PURE__ */ jsx53(Row, { node, selected, onSelect, opening }, node.id))
|
|
3722
3775
|
}
|
|
3723
3776
|
);
|
|
3724
3777
|
}
|
|
3725
|
-
function NavTreeSection({ id, title, message, loading = false, pending, trailing, actions, menu, icon, defaultOpen = true, open, onOpenChange, storageKey, onIntent, children }) {
|
|
3726
|
-
const timer =
|
|
3727
|
-
|
|
3778
|
+
function NavTreeSection({ id, title, message, loading = false, pending, trailing, actions, menu, icon, defaultOpen = true, open, onOpenChange, storageKey, openFor, onIntent, children }) {
|
|
3779
|
+
const timer = useRef12(void 0);
|
|
3780
|
+
useEffect7(() => () => clearTimeout(timer.current), []);
|
|
3728
3781
|
const intent = onIntent;
|
|
3729
3782
|
return /* @__PURE__ */ jsx53(
|
|
3730
3783
|
"div",
|
|
@@ -3747,6 +3800,7 @@ function NavTreeSection({ id, title, message, loading = false, pending, trailing
|
|
|
3747
3800
|
onOpenChange,
|
|
3748
3801
|
pending,
|
|
3749
3802
|
storageKey,
|
|
3803
|
+
openFor,
|
|
3750
3804
|
trailing,
|
|
3751
3805
|
actions,
|
|
3752
3806
|
menu,
|
|
@@ -3759,14 +3813,34 @@ function NavTreeSection({ id, title, message, loading = false, pending, trailing
|
|
|
3759
3813
|
}
|
|
3760
3814
|
);
|
|
3761
3815
|
}
|
|
3762
|
-
function NavTree({ title, titleActions, groups, children, selected, onSelect, emptyMessage = "", storageKey }) {
|
|
3763
|
-
|
|
3764
|
-
|
|
3765
|
-
|
|
3766
|
-
|
|
3767
|
-
|
|
3768
|
-
|
|
3769
|
-
|
|
3816
|
+
function NavTree({ title, titleActions, groups, children, selected, selectedParent, onSelect, emptyMessage = "", storageKey }) {
|
|
3817
|
+
const opening = groups ? openingFor(groups, selected, selectedParent) : null;
|
|
3818
|
+
const box = useRef12(null);
|
|
3819
|
+
const scrolled = useRef12(void 0);
|
|
3820
|
+
const waiting = useRef12(void 0);
|
|
3821
|
+
const latest = useRef12(selected);
|
|
3822
|
+
latest.current = selected;
|
|
3823
|
+
useEffect7(() => {
|
|
3824
|
+
if (selected === void 0 || scrolled.current === selected || waiting.current !== void 0) return;
|
|
3825
|
+
waiting.current = setTimeout(() => {
|
|
3826
|
+
waiting.current = void 0;
|
|
3827
|
+
const row = box.current?.querySelector('[aria-current="page"]');
|
|
3828
|
+
if (!row || row.getBoundingClientRect().height === 0) return;
|
|
3829
|
+
scrolled.current = latest.current;
|
|
3830
|
+
scrollToRow(row);
|
|
3831
|
+
}, NAV_TREE_REVEAL_MS);
|
|
3832
|
+
});
|
|
3833
|
+
useEffect7(() => () => clearTimeout(waiting.current), []);
|
|
3834
|
+
return (
|
|
3835
|
+
// `contents`: a box to find the current row in, that lays nothing out — the groups stay the column's own.
|
|
3836
|
+
/* @__PURE__ */ jsxs36("div", { ref: box, className: "contents", children: [
|
|
3837
|
+
title && /* @__PURE__ */ jsx53(SectionHeader, { title, look: "quiet", showActions: "always", actions: titleActions, className: "mt-4 shrink-0" }),
|
|
3838
|
+
groups === void 0 ? children : groups === null ? /* @__PURE__ */ jsx53(SkeletonList, { rows: 5 }) : groups.length === 0 ? (
|
|
3839
|
+
// No words, no line: an app that says nothing when it has no groups.
|
|
3840
|
+
emptyMessage ? /* @__PURE__ */ jsx53(Line, { message: emptyMessage }) : null
|
|
3841
|
+
) : groups.map((group) => /* @__PURE__ */ jsx53(Group, { group, selected, onSelect, opening, storageKey }, group.id))
|
|
3842
|
+
] })
|
|
3843
|
+
);
|
|
3770
3844
|
}
|
|
3771
3845
|
|
|
3772
3846
|
// src/Popover.tsx
|
|
@@ -3825,10 +3899,10 @@ function Popover({ trigger, anchor, align = "left", side = "bottom", open, onOpe
|
|
|
3825
3899
|
}
|
|
3826
3900
|
|
|
3827
3901
|
// src/SuggestionMenu.tsx
|
|
3828
|
-
import { useCallback as useCallback4, useEffect as
|
|
3902
|
+
import { useCallback as useCallback4, useEffect as useEffect8, useId as useId3, useImperativeHandle, useMemo as useMemo5, useRef as useRef13, useState as useState11 } from "react";
|
|
3829
3903
|
import { jsx as jsx55, jsxs as jsxs38 } from "react/jsx-runtime";
|
|
3830
3904
|
function SuggestionMenu({ rect, editorElement, ariaLabel, width, maxHeight, sections, itemKey, row, onSelect, handle }) {
|
|
3831
|
-
const last =
|
|
3905
|
+
const last = useRef13(null);
|
|
3832
3906
|
const anchor = useMemo5(() => {
|
|
3833
3907
|
if (typeof rect !== "function") return rect;
|
|
3834
3908
|
return {
|
|
@@ -3845,9 +3919,9 @@ function SuggestionMenu({ rect, editorElement, ariaLabel, width, maxHeight, sect
|
|
|
3845
3919
|
const [highlight, setHighlight] = useState11(0);
|
|
3846
3920
|
const base = useId3();
|
|
3847
3921
|
const listboxId = `${base}-list`;
|
|
3848
|
-
const chosen =
|
|
3849
|
-
|
|
3850
|
-
|
|
3922
|
+
const chosen = useRef13(null);
|
|
3923
|
+
useEffect8(() => void (chosen.current = highlight > 0 ? keys.split("\n")[highlight] ?? null : null), [highlight]);
|
|
3924
|
+
useEffect8(() => {
|
|
3851
3925
|
const at = chosen.current ? keys.split("\n").indexOf(chosen.current) : -1;
|
|
3852
3926
|
setHighlight(at > 0 ? at : 0);
|
|
3853
3927
|
}, [keys]);
|
|
@@ -3872,7 +3946,7 @@ function SuggestionMenu({ rect, editorElement, ariaLabel, width, maxHeight, sect
|
|
|
3872
3946
|
}
|
|
3873
3947
|
}), [items, highlight, onSelect]);
|
|
3874
3948
|
const open = rect !== null && items.length > 0;
|
|
3875
|
-
|
|
3949
|
+
useEffect8(() => {
|
|
3876
3950
|
if (!editorElement || !open) return;
|
|
3877
3951
|
editorElement.setAttribute("aria-autocomplete", "list");
|
|
3878
3952
|
editorElement.setAttribute("aria-haspopup", "listbox");
|
|
@@ -3881,7 +3955,7 @@ function SuggestionMenu({ rect, editorElement, ariaLabel, width, maxHeight, sect
|
|
|
3881
3955
|
for (const name of ["aria-autocomplete", "aria-haspopup", "aria-controls", "aria-activedescendant"]) editorElement.removeAttribute(name);
|
|
3882
3956
|
};
|
|
3883
3957
|
}, [editorElement, open, listboxId]);
|
|
3884
|
-
|
|
3958
|
+
useEffect8(() => {
|
|
3885
3959
|
if (!editorElement || !open) return;
|
|
3886
3960
|
editorElement.setAttribute("aria-activedescendant", `${base}-${highlight}`);
|
|
3887
3961
|
}, [editorElement, open, base, highlight]);
|
|
@@ -3938,12 +4012,12 @@ function SuggestionMenu({ rect, editorElement, ariaLabel, width, maxHeight, sect
|
|
|
3938
4012
|
}
|
|
3939
4013
|
|
|
3940
4014
|
// src/ShowMore.tsx
|
|
3941
|
-
import { useLayoutEffect as useLayoutEffect5, useRef as
|
|
4015
|
+
import { useLayoutEffect as useLayoutEffect5, useRef as useRef14, useState as useState12 } from "react";
|
|
3942
4016
|
import { IconChevronDown as IconChevronDown4, IconChevronUp } from "@tabler/icons-react";
|
|
3943
4017
|
import { jsx as jsx56, jsxs as jsxs39 } from "react/jsx-runtime";
|
|
3944
4018
|
var FADE = "linear-gradient(to top, transparent, black 40px)";
|
|
3945
4019
|
function ShowMore({ children, maxHeight = 96, action, contentClassName, className }) {
|
|
3946
|
-
const box =
|
|
4020
|
+
const box = useRef14(null);
|
|
3947
4021
|
const [open, setOpen] = useState12(false);
|
|
3948
4022
|
const [overflows, setOverflows] = useState12(false);
|
|
3949
4023
|
useLayoutEffect5(() => {
|
|
@@ -4609,7 +4683,7 @@ function LinkRow({ link, preview = true }) {
|
|
|
4609
4683
|
}
|
|
4610
4684
|
|
|
4611
4685
|
// src/LinkCard.tsx
|
|
4612
|
-
import { Fragment as
|
|
4686
|
+
import { Fragment as Fragment14, jsx as jsx62, jsxs as jsxs43 } from "react/jsx-runtime";
|
|
4613
4687
|
var CARD_CLASSES = "flex flex-col gap-3 p-3";
|
|
4614
4688
|
function CardLink({ href, truncate = false, className, children }) {
|
|
4615
4689
|
const boxed = useContext9(inTheBox);
|
|
@@ -4633,7 +4707,7 @@ function CardBody({ linked, readOnly }) {
|
|
|
4633
4707
|
const on = boxed ? "elevated" : "inset";
|
|
4634
4708
|
const meta = linkMetaOf(linked);
|
|
4635
4709
|
const footed = Boolean(linked.status || linked.owner || linked.authors || linked.updated);
|
|
4636
|
-
return /* @__PURE__ */ jsxs43(
|
|
4710
|
+
return /* @__PURE__ */ jsxs43(Fragment14, { children: [
|
|
4637
4711
|
/* @__PURE__ */ jsxs43("div", { className: "flex items-center gap-3", children: [
|
|
4638
4712
|
/* @__PURE__ */ jsx62(LinkTile, { kind: linked.kind }),
|
|
4639
4713
|
/* @__PURE__ */ jsxs43("span", { className: "flex min-w-0 flex-1 flex-col gap-0.5", children: [
|
|
@@ -4684,7 +4758,7 @@ function CardBody({ linked, readOnly }) {
|
|
|
4684
4758
|
}
|
|
4685
4759
|
function SaidBody({ linked }) {
|
|
4686
4760
|
const author = linked.author;
|
|
4687
|
-
return /* @__PURE__ */ jsxs43(
|
|
4761
|
+
return /* @__PURE__ */ jsxs43(Fragment14, { children: [
|
|
4688
4762
|
/* @__PURE__ */ jsxs43("div", { className: "flex items-center gap-2", children: [
|
|
4689
4763
|
/* @__PURE__ */ jsx62(Avatar, { name: author.name, src: author.picture, size: 24 }),
|
|
4690
4764
|
/* @__PURE__ */ jsx62("span", { className: "text-body-2-strong text-text-primary", children: linked.updated ? author.name : /* @__PURE__ */ jsx62(CardLink, { href: linked.href, children: author.name }) }),
|
|
@@ -4723,10 +4797,10 @@ function LinkCardLoading({ kind, shape }) {
|
|
|
4723
4797
|
/* @__PURE__ */ jsx62(SkeletonBar, { on: "inset", className: "h-3 w-3/5" })
|
|
4724
4798
|
] })
|
|
4725
4799
|
] }),
|
|
4726
|
-
footer !== "none" && /* @__PURE__ */ jsx62("div", { className: "flex min-h-6 items-center gap-2", children: footer === "pickers" ? /* @__PURE__ */ jsxs43(
|
|
4800
|
+
footer !== "none" && /* @__PURE__ */ jsx62("div", { className: "flex min-h-6 items-center gap-2", children: footer === "pickers" ? /* @__PURE__ */ jsxs43(Fragment14, { children: [
|
|
4727
4801
|
/* @__PURE__ */ jsx62(SkeletonBar, { on: "inset", shape: "control", className: "h-6 w-24" }),
|
|
4728
4802
|
/* @__PURE__ */ jsx62(SkeletonBar, { on: "inset", shape: "control", className: "h-6 w-28" })
|
|
4729
|
-
] }) : footer === "people" ? /* @__PURE__ */ jsxs43(
|
|
4803
|
+
] }) : footer === "people" ? /* @__PURE__ */ jsxs43(Fragment14, { children: [
|
|
4730
4804
|
/* @__PURE__ */ jsx62(SkeletonBar, { on: "inset", shape: "round", className: "size-4" }),
|
|
4731
4805
|
/* @__PURE__ */ jsx62(SkeletonBar, { on: "inset", className: "h-3 w-40" })
|
|
4732
4806
|
] }) : /* @__PURE__ */ jsx62(SkeletonBar, { on: "inset", className: "h-3 w-40" }) })
|
|
@@ -4734,7 +4808,7 @@ function LinkCardLoading({ kind, shape }) {
|
|
|
4734
4808
|
}
|
|
4735
4809
|
|
|
4736
4810
|
// src/LinkPreview.tsx
|
|
4737
|
-
import { Fragment as
|
|
4811
|
+
import { Fragment as Fragment15, jsx as jsx63 } from "react/jsx-runtime";
|
|
4738
4812
|
var HOVER = "(hover: hover)";
|
|
4739
4813
|
function subscribe(onChange) {
|
|
4740
4814
|
if (typeof window === "undefined" || !window.matchMedia) return () => {
|
|
@@ -4752,7 +4826,7 @@ function useCanHover() {
|
|
|
4752
4826
|
}
|
|
4753
4827
|
function LinkPreview({ linked, block = false, children }) {
|
|
4754
4828
|
const canHover = useCanHover();
|
|
4755
|
-
if (!canHover) return /* @__PURE__ */ jsx63(
|
|
4829
|
+
if (!canHover) return /* @__PURE__ */ jsx63(Fragment15, { children });
|
|
4756
4830
|
return /* @__PURE__ */ jsx63(PreviewCard, { side: "top", contentClassName: "p-0", content: /* @__PURE__ */ jsx63(LinkCard, { link: { state: "ready", linked }, bare: true, readOnly: true }), wrapperClassName: block ? "grid w-full min-w-0 grid-cols-[minmax(0,1fr)]" : "max-w-full", children });
|
|
4757
4831
|
}
|
|
4758
4832
|
function LinkPreviewOpen({ linked }) {
|
|
@@ -4795,12 +4869,12 @@ function LinkChip({ link, preview = true }) {
|
|
|
4795
4869
|
|
|
4796
4870
|
// src/AttachedCard.tsx
|
|
4797
4871
|
import { createContext as createContext8, useContext as useContext10 } from "react";
|
|
4798
|
-
import { Fragment as
|
|
4872
|
+
import { Fragment as Fragment16, jsx as jsx65, jsxs as jsxs45 } from "react/jsx-runtime";
|
|
4799
4873
|
var Attached = createContext8(false);
|
|
4800
4874
|
function AttachedCard({ link, children, onRemove }) {
|
|
4801
4875
|
const card = link ? /* @__PURE__ */ jsx65(LinkCard, { link }) : children;
|
|
4802
4876
|
const inside = useContext10(Attached);
|
|
4803
|
-
if (inside) return /* @__PURE__ */ jsx65(
|
|
4877
|
+
if (inside) return /* @__PURE__ */ jsx65(Fragment16, { children: card });
|
|
4804
4878
|
return (
|
|
4805
4879
|
// At most 480px, so it never runs a column's or a wide box's whole width (Katerina, 29 and 30 Oct).
|
|
4806
4880
|
/* @__PURE__ */ jsxs45("div", { className: "group/card relative max-w-[480px]", children: [
|
|
@@ -5104,7 +5178,7 @@ function ListColumn(props) {
|
|
|
5104
5178
|
|
|
5105
5179
|
// src/Tabs.tsx
|
|
5106
5180
|
import { Tabs as BaseTabs } from "@base-ui/react/tabs";
|
|
5107
|
-
import { Fragment as
|
|
5181
|
+
import { Fragment as Fragment17, jsx as jsx75, jsxs as jsxs54 } from "react/jsx-runtime";
|
|
5108
5182
|
function Tabs({ tabs, active, onChange, size = "default", className, ...aria }) {
|
|
5109
5183
|
return /* @__PURE__ */ jsx75(
|
|
5110
5184
|
BaseTabs.Root,
|
|
@@ -5138,7 +5212,7 @@ function Tabs({ tabs, active, onChange, size = "default", className, ...aria })
|
|
|
5138
5212
|
tab.label,
|
|
5139
5213
|
tab.count !== void 0 ? /* @__PURE__ */ jsx75("span", { className: "ml-2.5 font-mono text-caption tabular-nums text-text-secondary", children: tab.count }) : null
|
|
5140
5214
|
] }),
|
|
5141
|
-
tab.unread ? /* @__PURE__ */ jsxs54(
|
|
5215
|
+
tab.unread ? /* @__PURE__ */ jsxs54(Fragment17, { children: [
|
|
5142
5216
|
/* @__PURE__ */ jsx75(UnreadDot, { className: "h-auto w-auto" }),
|
|
5143
5217
|
/* @__PURE__ */ jsx75("span", { className: "sr-only", children: "new" })
|
|
5144
5218
|
] }) : null
|
|
@@ -5210,10 +5284,11 @@ function ToastProvider({ children }) {
|
|
|
5210
5284
|
const manager = useMemo6(() => BaseToast.createToastManager(), []);
|
|
5211
5285
|
const value = useMemo6(
|
|
5212
5286
|
() => ({
|
|
5213
|
-
showToast: ({ label, type = "neutral", leadingIcon = true, actionLabel, onAction, durationMs = 5e3 }) => manager.add({
|
|
5287
|
+
showToast: ({ label, type = "neutral", leadingIcon = true, actionLabel, onAction, durationMs = 5e3, onClose }) => manager.add({
|
|
5214
5288
|
title: label,
|
|
5215
5289
|
type,
|
|
5216
5290
|
timeout: durationMs,
|
|
5291
|
+
onClose,
|
|
5217
5292
|
// A failure interrupts; everything else waits for a pause.
|
|
5218
5293
|
priority: type === "error" ? "high" : "low",
|
|
5219
5294
|
data: { leadingIcon, actionLabel, onAction }
|