@estiva-app/ui 0.93.0 → 0.95.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/LinkRow.d.ts.map +1 -1
- package/dist/NavItem.d.ts +7 -1
- 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/PartCard.d.ts +4 -7
- package/dist/PartCard.d.ts.map +1 -1
- package/dist/ShowMore.d.ts +1 -7
- package/dist/ShowMore.d.ts.map +1 -1
- package/dist/index.js +280 -224
- package/dist/index.js.map +4 -4
- package/package.json +1 -1
- package/registry.json +26 -14
- package/src/CollapsibleSection.tsx +30 -3
- package/src/LinkCard.test.tsx +5 -2
- package/src/LinkRow.mdx +1 -1
- package/src/LinkRow.tsx +10 -5
- package/src/NavItem.tsx +9 -0
- 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/PartCard.mdx +1 -1
- package/src/PartCard.stories.tsx +2 -9
- package/src/PartCard.test.tsx +13 -1
- package/src/PartCard.tsx +6 -9
- package/src/ShowMore.mdx +2 -5
- package/src/ShowMore.stories.tsx +0 -14
- package/src/ShowMore.test.tsx +0 -16
- package/src/ShowMore.tsx +2 -16
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,196 +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(
|
|
3614
|
-
(action) => action.menu != null ? (
|
|
3615
|
-
// `data-section-menu`, as the ⋮ has: the row stays lit while its menu is open.
|
|
3616
|
-
/* @__PURE__ */ jsx51("div", { "data-section-menu": true, className: "flex items-center", children: /* @__PURE__ */ jsx51(
|
|
3617
|
-
Menu,
|
|
3618
|
-
{
|
|
3619
|
-
align: "right",
|
|
3620
|
-
trigger: /* @__PURE__ */ jsx51(IconButton, { tooltip: action.tooltip, "aria-label": action.tooltip, children: action.icon }),
|
|
3621
|
-
children: action.menu
|
|
3622
|
-
}
|
|
3623
|
-
) }, action.tooltip)
|
|
3624
|
-
) : /* @__PURE__ */ jsx51(IconButton, { tooltip: action.tooltip, "aria-label": action.tooltip, onClick: action.onClick, children: action.icon }, action.tooltip)
|
|
3625
|
-
),
|
|
3626
|
-
menu != null && /* @__PURE__ */ jsx51("div", { "data-section-menu": true, className: "flex items-center", children: /* @__PURE__ */ jsx51(
|
|
3627
|
-
Menu,
|
|
3628
|
-
{
|
|
3629
|
-
align: "right",
|
|
3630
|
-
trigger: /* @__PURE__ */ jsx51(IconButton, { tooltip: "More options", "aria-label": menuLabel ?? `More options for ${title}`, children: /* @__PURE__ */ jsx51(IconDotsVertical2, { size: 16, stroke: 1.5 }) }),
|
|
3631
|
-
children: menu
|
|
3632
|
-
}
|
|
3633
|
-
) })
|
|
3634
|
-
] })
|
|
3635
|
-
}
|
|
3636
|
-
)
|
|
3637
|
-
]
|
|
3638
|
-
}
|
|
3639
|
-
);
|
|
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));
|
|
3640
3699
|
}
|
|
3641
|
-
|
|
3642
|
-
|
|
3643
|
-
|
|
3644
|
-
|
|
3645
|
-
|
|
3646
|
-
function readStored(key) {
|
|
3647
|
-
if (!key) return void 0;
|
|
3648
|
-
try {
|
|
3649
|
-
const value = window.localStorage.getItem(key);
|
|
3650
|
-
return value === OPEN ? true : value === CLOSED ? false : void 0;
|
|
3651
|
-
} catch {
|
|
3652
|
-
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];
|
|
3653
3705
|
}
|
|
3654
|
-
|
|
3655
|
-
|
|
3656
|
-
|
|
3657
|
-
|
|
3658
|
-
|
|
3659
|
-
|
|
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
|
+
}
|
|
3660
3717
|
}
|
|
3718
|
+
return null;
|
|
3661
3719
|
}
|
|
3662
|
-
function
|
|
3663
|
-
|
|
3664
|
-
|
|
3665
|
-
|
|
3666
|
-
|
|
3667
|
-
|
|
3668
|
-
|
|
3669
|
-
|
|
3670
|
-
const shown = open && !pending;
|
|
3671
|
-
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: [
|
|
3672
|
-
/* @__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 }) }),
|
|
3673
|
-
/* @__PURE__ */ jsx52(
|
|
3674
|
-
Collapsible2.Panel,
|
|
3675
|
-
{
|
|
3676
|
-
hiddenUntilFound: true,
|
|
3677
|
-
className: COLLAPSIBLE_PANEL_CLASSES,
|
|
3678
|
-
children: /* @__PURE__ */ jsx52("div", { className: cn("flex flex-col pt-0.5", (look === "row" || indent) && "pl-6", contentClassName), children })
|
|
3679
|
-
}
|
|
3680
|
-
)
|
|
3681
|
-
] });
|
|
3682
|
-
}
|
|
3683
|
-
|
|
3684
|
-
// src/NavTree.tsx
|
|
3685
|
-
import { Fragment as Fragment14, jsx as jsx53, jsxs as jsxs36 } from "react/jsx-runtime";
|
|
3686
|
-
var NAV_TREE_INTENT_MS = 150;
|
|
3687
|
-
function holds(nodes, id) {
|
|
3688
|
-
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;
|
|
3689
3728
|
}
|
|
3690
3729
|
function Line({ message }) {
|
|
3691
3730
|
return /* @__PURE__ */ jsx53("div", { className: "px-2 py-1", children: /* @__PURE__ */ jsx53(EmptyState, { scope: "section", message }) });
|
|
3692
3731
|
}
|
|
3693
|
-
function Row({ node, selected, onSelect }) {
|
|
3694
|
-
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;
|
|
3695
3734
|
return /* @__PURE__ */ jsx53(
|
|
3696
3735
|
NavItem,
|
|
3697
3736
|
{
|
|
@@ -3708,12 +3747,13 @@ function Row({ node, selected, onSelect }) {
|
|
|
3708
3747
|
defaultOpen: node.defaultOpen ?? true,
|
|
3709
3748
|
open: node.open,
|
|
3710
3749
|
onOpenChange: node.onOpenChange,
|
|
3750
|
+
openFor: opening?.rows.has(node.id) ? opening.item : void 0,
|
|
3711
3751
|
onClick: onSelect ? (event) => onSelect(node, event) : void 0,
|
|
3712
3752
|
children: under
|
|
3713
3753
|
}
|
|
3714
3754
|
);
|
|
3715
3755
|
}
|
|
3716
|
-
function Group({ group, selected, onSelect, storageKey }) {
|
|
3756
|
+
function Group({ group, selected, onSelect, opening, storageKey }) {
|
|
3717
3757
|
return /* @__PURE__ */ jsx53(
|
|
3718
3758
|
NavTreeSection,
|
|
3719
3759
|
{
|
|
@@ -3729,14 +3769,15 @@ function Group({ group, selected, onSelect, storageKey }) {
|
|
|
3729
3769
|
open: group.open,
|
|
3730
3770
|
onOpenChange: group.onOpenChange,
|
|
3731
3771
|
storageKey: storageKey ? `${storageKey}.${group.id}` : void 0,
|
|
3772
|
+
openFor: opening?.group === group.id ? opening.item : void 0,
|
|
3732
3773
|
onIntent: group.onIntent,
|
|
3733
|
-
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))
|
|
3734
3775
|
}
|
|
3735
3776
|
);
|
|
3736
3777
|
}
|
|
3737
|
-
function NavTreeSection({ id, title, message, loading = false, pending, trailing, actions, menu, icon, defaultOpen = true, open, onOpenChange, storageKey, onIntent, children }) {
|
|
3738
|
-
const timer =
|
|
3739
|
-
|
|
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), []);
|
|
3740
3781
|
const intent = onIntent;
|
|
3741
3782
|
return /* @__PURE__ */ jsx53(
|
|
3742
3783
|
"div",
|
|
@@ -3759,6 +3800,7 @@ function NavTreeSection({ id, title, message, loading = false, pending, trailing
|
|
|
3759
3800
|
onOpenChange,
|
|
3760
3801
|
pending,
|
|
3761
3802
|
storageKey,
|
|
3803
|
+
openFor,
|
|
3762
3804
|
trailing,
|
|
3763
3805
|
actions,
|
|
3764
3806
|
menu,
|
|
@@ -3771,14 +3813,34 @@ function NavTreeSection({ id, title, message, loading = false, pending, trailing
|
|
|
3771
3813
|
}
|
|
3772
3814
|
);
|
|
3773
3815
|
}
|
|
3774
|
-
function NavTree({ title, titleActions, groups, children, selected, onSelect, emptyMessage = "", storageKey }) {
|
|
3775
|
-
|
|
3776
|
-
|
|
3777
|
-
|
|
3778
|
-
|
|
3779
|
-
|
|
3780
|
-
|
|
3781
|
-
|
|
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
|
+
);
|
|
3782
3844
|
}
|
|
3783
3845
|
|
|
3784
3846
|
// src/Popover.tsx
|
|
@@ -3837,10 +3899,10 @@ function Popover({ trigger, anchor, align = "left", side = "bottom", open, onOpe
|
|
|
3837
3899
|
}
|
|
3838
3900
|
|
|
3839
3901
|
// src/SuggestionMenu.tsx
|
|
3840
|
-
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";
|
|
3841
3903
|
import { jsx as jsx55, jsxs as jsxs38 } from "react/jsx-runtime";
|
|
3842
3904
|
function SuggestionMenu({ rect, editorElement, ariaLabel, width, maxHeight, sections, itemKey, row, onSelect, handle }) {
|
|
3843
|
-
const last =
|
|
3905
|
+
const last = useRef13(null);
|
|
3844
3906
|
const anchor = useMemo5(() => {
|
|
3845
3907
|
if (typeof rect !== "function") return rect;
|
|
3846
3908
|
return {
|
|
@@ -3857,9 +3919,9 @@ function SuggestionMenu({ rect, editorElement, ariaLabel, width, maxHeight, sect
|
|
|
3857
3919
|
const [highlight, setHighlight] = useState11(0);
|
|
3858
3920
|
const base = useId3();
|
|
3859
3921
|
const listboxId = `${base}-list`;
|
|
3860
|
-
const chosen =
|
|
3861
|
-
|
|
3862
|
-
|
|
3922
|
+
const chosen = useRef13(null);
|
|
3923
|
+
useEffect8(() => void (chosen.current = highlight > 0 ? keys.split("\n")[highlight] ?? null : null), [highlight]);
|
|
3924
|
+
useEffect8(() => {
|
|
3863
3925
|
const at = chosen.current ? keys.split("\n").indexOf(chosen.current) : -1;
|
|
3864
3926
|
setHighlight(at > 0 ? at : 0);
|
|
3865
3927
|
}, [keys]);
|
|
@@ -3884,7 +3946,7 @@ function SuggestionMenu({ rect, editorElement, ariaLabel, width, maxHeight, sect
|
|
|
3884
3946
|
}
|
|
3885
3947
|
}), [items, highlight, onSelect]);
|
|
3886
3948
|
const open = rect !== null && items.length > 0;
|
|
3887
|
-
|
|
3949
|
+
useEffect8(() => {
|
|
3888
3950
|
if (!editorElement || !open) return;
|
|
3889
3951
|
editorElement.setAttribute("aria-autocomplete", "list");
|
|
3890
3952
|
editorElement.setAttribute("aria-haspopup", "listbox");
|
|
@@ -3893,7 +3955,7 @@ function SuggestionMenu({ rect, editorElement, ariaLabel, width, maxHeight, sect
|
|
|
3893
3955
|
for (const name of ["aria-autocomplete", "aria-haspopup", "aria-controls", "aria-activedescendant"]) editorElement.removeAttribute(name);
|
|
3894
3956
|
};
|
|
3895
3957
|
}, [editorElement, open, listboxId]);
|
|
3896
|
-
|
|
3958
|
+
useEffect8(() => {
|
|
3897
3959
|
if (!editorElement || !open) return;
|
|
3898
3960
|
editorElement.setAttribute("aria-activedescendant", `${base}-${highlight}`);
|
|
3899
3961
|
}, [editorElement, open, base, highlight]);
|
|
@@ -3950,12 +4012,12 @@ function SuggestionMenu({ rect, editorElement, ariaLabel, width, maxHeight, sect
|
|
|
3950
4012
|
}
|
|
3951
4013
|
|
|
3952
4014
|
// src/ShowMore.tsx
|
|
3953
|
-
import { useLayoutEffect as useLayoutEffect5, useRef as
|
|
4015
|
+
import { useLayoutEffect as useLayoutEffect5, useRef as useRef14, useState as useState12 } from "react";
|
|
3954
4016
|
import { IconChevronDown as IconChevronDown4, IconChevronUp } from "@tabler/icons-react";
|
|
3955
4017
|
import { jsx as jsx56, jsxs as jsxs39 } from "react/jsx-runtime";
|
|
3956
4018
|
var FADE = "linear-gradient(to top, transparent, black 40px)";
|
|
3957
|
-
function ShowMore({ children, maxHeight = 96,
|
|
3958
|
-
const box =
|
|
4019
|
+
function ShowMore({ children, maxHeight = 96, contentClassName, className }) {
|
|
4020
|
+
const box = useRef14(null);
|
|
3959
4021
|
const [open, setOpen] = useState12(false);
|
|
3960
4022
|
const [overflows, setOverflows] = useState12(false);
|
|
3961
4023
|
useLayoutEffect5(() => {
|
|
@@ -3971,10 +4033,7 @@ function ShowMore({ children, maxHeight = 96, action, contentClassName, classNam
|
|
|
3971
4033
|
const cut = overflows && !open;
|
|
3972
4034
|
return /* @__PURE__ */ jsxs39("div", { className: cn("flex flex-col items-start", className), children: [
|
|
3973
4035
|
/* @__PURE__ */ jsx56("div", { ref: box, className: cn("relative w-full", cut && "overflow-hidden", contentClassName), style: cut ? { maxHeight, maskImage: FADE, WebkitMaskImage: FADE } : void 0, onFocus: cut ? () => setOpen(true) : void 0, children }),
|
|
3974
|
-
|
|
3975
|
-
overflows && /* @__PURE__ */ jsx56(Toggle, { open, onToggle: () => setOpen((o) => !o) }),
|
|
3976
|
-
/* @__PURE__ */ jsx56("div", { className: "-mr-2 flex shrink-0", children: action })
|
|
3977
|
-
] }) : overflows && /* @__PURE__ */ jsx56(Toggle, { open, onToggle: () => setOpen((o) => !o), className: "mt-1" })
|
|
4036
|
+
overflows && /* @__PURE__ */ jsx56(Toggle, { open, onToggle: () => setOpen((o) => !o), className: "mt-1" })
|
|
3978
4037
|
] });
|
|
3979
4038
|
}
|
|
3980
4039
|
function Toggle({ open, onToggle, className }) {
|
|
@@ -4551,6 +4610,7 @@ import { useContext as useContext9 } from "react";
|
|
|
4551
4610
|
|
|
4552
4611
|
// src/LinkRow.tsx
|
|
4553
4612
|
import { useContext as useContext8 } from "react";
|
|
4613
|
+
import { IconExternalLink } from "@tabler/icons-react";
|
|
4554
4614
|
import { jsx as jsx61, jsxs as jsxs42 } from "react/jsx-runtime";
|
|
4555
4615
|
var ROW_CLASSES2 = "flex items-center gap-3 p-1.5 pr-3";
|
|
4556
4616
|
function LinkUnavailable({ kind, noun, openIn, card = false, deleted = false }) {
|
|
@@ -4561,11 +4621,7 @@ function UnavailableRow({ kind, words, href, openIn, card = false }) {
|
|
|
4561
4621
|
return /* @__PURE__ */ jsxs42(Card, { fill: wide ? "elevated" : "inset", className: cn(card ? "flex items-center gap-3 p-3" : ROW_CLASSES2, "max-w-[480px]"), children: [
|
|
4562
4622
|
/* @__PURE__ */ jsx61("span", { className: TYPE_TILE_CLASSES, children: /* @__PURE__ */ jsx61(LinkedIcon, { kind }) }),
|
|
4563
4623
|
/* @__PURE__ */ jsx61("span", { className: "min-w-0 flex-1 truncate text-body-2 text-text-muted", children: href && !wide ? /* @__PURE__ */ jsx61(Link, { href, variant: "quiet", children: words }) : words }),
|
|
4564
|
-
openIn && /* @__PURE__ */ jsx61(
|
|
4565
|
-
"Open in ",
|
|
4566
|
-
openIn.app,
|
|
4567
|
-
" \u2197"
|
|
4568
|
-
] }) })
|
|
4624
|
+
openIn && /* @__PURE__ */ jsx61(WithTooltip, { label: `Open in ${openIn.app}`, children: /* @__PURE__ */ jsx61(Button, { href: openIn.href, external: true, size: "small", className: "shrink-0", leadingIcon: /* @__PURE__ */ jsx61(IconExternalLink, { stroke: 1.5, className: "size-3.5" }), "aria-label": `Open in ${openIn.app}`, children: "Open" }) })
|
|
4569
4625
|
] });
|
|
4570
4626
|
}
|
|
4571
4627
|
function linkMetaOf(linked, withWhen = false) {
|
|
@@ -4621,7 +4677,7 @@ function LinkRow({ link, preview = true }) {
|
|
|
4621
4677
|
}
|
|
4622
4678
|
|
|
4623
4679
|
// src/LinkCard.tsx
|
|
4624
|
-
import { Fragment as
|
|
4680
|
+
import { Fragment as Fragment14, jsx as jsx62, jsxs as jsxs43 } from "react/jsx-runtime";
|
|
4625
4681
|
var CARD_CLASSES = "flex flex-col gap-3 p-3";
|
|
4626
4682
|
function CardLink({ href, truncate = false, className, children }) {
|
|
4627
4683
|
const boxed = useContext9(inTheBox);
|
|
@@ -4645,7 +4701,7 @@ function CardBody({ linked, readOnly }) {
|
|
|
4645
4701
|
const on = boxed ? "elevated" : "inset";
|
|
4646
4702
|
const meta = linkMetaOf(linked);
|
|
4647
4703
|
const footed = Boolean(linked.status || linked.owner || linked.authors || linked.updated);
|
|
4648
|
-
return /* @__PURE__ */ jsxs43(
|
|
4704
|
+
return /* @__PURE__ */ jsxs43(Fragment14, { children: [
|
|
4649
4705
|
/* @__PURE__ */ jsxs43("div", { className: "flex items-center gap-3", children: [
|
|
4650
4706
|
/* @__PURE__ */ jsx62(LinkTile, { kind: linked.kind }),
|
|
4651
4707
|
/* @__PURE__ */ jsxs43("span", { className: "flex min-w-0 flex-1 flex-col gap-0.5", children: [
|
|
@@ -4696,7 +4752,7 @@ function CardBody({ linked, readOnly }) {
|
|
|
4696
4752
|
}
|
|
4697
4753
|
function SaidBody({ linked }) {
|
|
4698
4754
|
const author = linked.author;
|
|
4699
|
-
return /* @__PURE__ */ jsxs43(
|
|
4755
|
+
return /* @__PURE__ */ jsxs43(Fragment14, { children: [
|
|
4700
4756
|
/* @__PURE__ */ jsxs43("div", { className: "flex items-center gap-2", children: [
|
|
4701
4757
|
/* @__PURE__ */ jsx62(Avatar, { name: author.name, src: author.picture, size: 24 }),
|
|
4702
4758
|
/* @__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 }) }),
|
|
@@ -4735,10 +4791,10 @@ function LinkCardLoading({ kind, shape }) {
|
|
|
4735
4791
|
/* @__PURE__ */ jsx62(SkeletonBar, { on: "inset", className: "h-3 w-3/5" })
|
|
4736
4792
|
] })
|
|
4737
4793
|
] }),
|
|
4738
|
-
footer !== "none" && /* @__PURE__ */ jsx62("div", { className: "flex min-h-6 items-center gap-2", children: footer === "pickers" ? /* @__PURE__ */ jsxs43(
|
|
4794
|
+
footer !== "none" && /* @__PURE__ */ jsx62("div", { className: "flex min-h-6 items-center gap-2", children: footer === "pickers" ? /* @__PURE__ */ jsxs43(Fragment14, { children: [
|
|
4739
4795
|
/* @__PURE__ */ jsx62(SkeletonBar, { on: "inset", shape: "control", className: "h-6 w-24" }),
|
|
4740
4796
|
/* @__PURE__ */ jsx62(SkeletonBar, { on: "inset", shape: "control", className: "h-6 w-28" })
|
|
4741
|
-
] }) : footer === "people" ? /* @__PURE__ */ jsxs43(
|
|
4797
|
+
] }) : footer === "people" ? /* @__PURE__ */ jsxs43(Fragment14, { children: [
|
|
4742
4798
|
/* @__PURE__ */ jsx62(SkeletonBar, { on: "inset", shape: "round", className: "size-4" }),
|
|
4743
4799
|
/* @__PURE__ */ jsx62(SkeletonBar, { on: "inset", className: "h-3 w-40" })
|
|
4744
4800
|
] }) : /* @__PURE__ */ jsx62(SkeletonBar, { on: "inset", className: "h-3 w-40" }) })
|
|
@@ -4746,7 +4802,7 @@ function LinkCardLoading({ kind, shape }) {
|
|
|
4746
4802
|
}
|
|
4747
4803
|
|
|
4748
4804
|
// src/LinkPreview.tsx
|
|
4749
|
-
import { Fragment as
|
|
4805
|
+
import { Fragment as Fragment15, jsx as jsx63 } from "react/jsx-runtime";
|
|
4750
4806
|
var HOVER = "(hover: hover)";
|
|
4751
4807
|
function subscribe(onChange) {
|
|
4752
4808
|
if (typeof window === "undefined" || !window.matchMedia) return () => {
|
|
@@ -4764,7 +4820,7 @@ function useCanHover() {
|
|
|
4764
4820
|
}
|
|
4765
4821
|
function LinkPreview({ linked, block = false, children }) {
|
|
4766
4822
|
const canHover = useCanHover();
|
|
4767
|
-
if (!canHover) return /* @__PURE__ */ jsx63(
|
|
4823
|
+
if (!canHover) return /* @__PURE__ */ jsx63(Fragment15, { children });
|
|
4768
4824
|
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 });
|
|
4769
4825
|
}
|
|
4770
4826
|
function LinkPreviewOpen({ linked }) {
|
|
@@ -4807,12 +4863,12 @@ function LinkChip({ link, preview = true }) {
|
|
|
4807
4863
|
|
|
4808
4864
|
// src/AttachedCard.tsx
|
|
4809
4865
|
import { createContext as createContext8, useContext as useContext10 } from "react";
|
|
4810
|
-
import { Fragment as
|
|
4866
|
+
import { Fragment as Fragment16, jsx as jsx65, jsxs as jsxs45 } from "react/jsx-runtime";
|
|
4811
4867
|
var Attached = createContext8(false);
|
|
4812
4868
|
function AttachedCard({ link, children, onRemove }) {
|
|
4813
4869
|
const card = link ? /* @__PURE__ */ jsx65(LinkCard, { link }) : children;
|
|
4814
4870
|
const inside = useContext10(Attached);
|
|
4815
|
-
if (inside) return /* @__PURE__ */ jsx65(
|
|
4871
|
+
if (inside) return /* @__PURE__ */ jsx65(Fragment16, { children: card });
|
|
4816
4872
|
return (
|
|
4817
4873
|
// At most 480px, so it never runs a column's or a wide box's whole width (Katerina, 29 and 30 Oct).
|
|
4818
4874
|
/* @__PURE__ */ jsxs45("div", { className: "group/card relative max-w-[480px]", children: [
|
|
@@ -4832,7 +4888,7 @@ function AttachedCard({ link, children, onRemove }) {
|
|
|
4832
4888
|
// src/PartCard.tsx
|
|
4833
4889
|
import { useContext as useContext11 } from "react";
|
|
4834
4890
|
import { jsx as jsx66, jsxs as jsxs46 } from "react/jsx-runtime";
|
|
4835
|
-
function PartCard({ state = "ready", kind, heading, href, partKey, noun, openIn, children,
|
|
4891
|
+
function PartCard({ state = "ready", kind, heading, href, partKey, noun, openIn, children, maxHeight }) {
|
|
4836
4892
|
const word = noun ?? kindNounOf({ kind }) ?? "File";
|
|
4837
4893
|
const boxed = useContext11(inTheBox);
|
|
4838
4894
|
if (state === "loading") return /* @__PURE__ */ jsx66(LinkCardLoading, { kind, shape: { summary: true, rows: 0, footer: "none" } });
|
|
@@ -4851,7 +4907,7 @@ function PartCard({ state = "ready", kind, heading, href, partKey, noun, openIn,
|
|
|
4851
4907
|
/* @__PURE__ */ jsx66("span", { className: "truncate text-caption text-text-secondary", children: partKey ? `A part of ${partKey}` : `A part of this ${word.toLowerCase()}` })
|
|
4852
4908
|
] })
|
|
4853
4909
|
] }),
|
|
4854
|
-
|
|
4910
|
+
maxHeight !== void 0 ? /* @__PURE__ */ jsx66(ShowMore, { maxHeight, contentClassName: QUOTE_BAR_CLASSES, children }) : /* @__PURE__ */ jsx66("div", { className: QUOTE_BAR_CLASSES, children })
|
|
4855
4911
|
] })
|
|
4856
4912
|
);
|
|
4857
4913
|
}
|
|
@@ -5116,7 +5172,7 @@ function ListColumn(props) {
|
|
|
5116
5172
|
|
|
5117
5173
|
// src/Tabs.tsx
|
|
5118
5174
|
import { Tabs as BaseTabs } from "@base-ui/react/tabs";
|
|
5119
|
-
import { Fragment as
|
|
5175
|
+
import { Fragment as Fragment17, jsx as jsx75, jsxs as jsxs54 } from "react/jsx-runtime";
|
|
5120
5176
|
function Tabs({ tabs, active, onChange, size = "default", className, ...aria }) {
|
|
5121
5177
|
return /* @__PURE__ */ jsx75(
|
|
5122
5178
|
BaseTabs.Root,
|
|
@@ -5150,7 +5206,7 @@ function Tabs({ tabs, active, onChange, size = "default", className, ...aria })
|
|
|
5150
5206
|
tab.label,
|
|
5151
5207
|
tab.count !== void 0 ? /* @__PURE__ */ jsx75("span", { className: "ml-2.5 font-mono text-caption tabular-nums text-text-secondary", children: tab.count }) : null
|
|
5152
5208
|
] }),
|
|
5153
|
-
tab.unread ? /* @__PURE__ */ jsxs54(
|
|
5209
|
+
tab.unread ? /* @__PURE__ */ jsxs54(Fragment17, { children: [
|
|
5154
5210
|
/* @__PURE__ */ jsx75(UnreadDot, { className: "h-auto w-auto" }),
|
|
5155
5211
|
/* @__PURE__ */ jsx75("span", { className: "sr-only", children: "new" })
|
|
5156
5212
|
] }) : null
|