@inf-monkeys-tech/monkeys-design 2.0.2 → 2.0.3
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/components/agent-workbench/index.js.map +1 -1
- package/dist/components/agent-workbench/index.mjs.map +1 -1
- package/dist/components/layout/index.d.mts +4 -1
- package/dist/components/layout/index.d.ts +4 -1
- package/dist/components/layout/index.js +217 -138
- package/dist/components/layout/index.js.map +1 -1
- package/dist/components/layout/index.mjs +216 -137
- package/dist/components/layout/index.mjs.map +1 -1
- package/dist/index.js +290 -211
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +289 -210
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { forwardRef, useState, useEffect, useContext, useMemo, isValidElement, Fragment, createContext, useRef } from 'react';
|
|
2
|
-
import * as
|
|
2
|
+
import * as DropdownMenu2 from '@radix-ui/react-dropdown-menu';
|
|
3
3
|
import { twMerge } from 'tailwind-merge';
|
|
4
4
|
import { jsxs, jsx, Fragment as Fragment$1 } from 'react/jsx-runtime';
|
|
5
5
|
import 'react-dom';
|
|
@@ -2629,9 +2629,9 @@ function UserAccountMenuSelector({
|
|
|
2629
2629
|
if (selector.visible === false || selector.options.length === 0) return null;
|
|
2630
2630
|
const radiusClass = radiusClassNames[menuRadius];
|
|
2631
2631
|
const currentLabel = getCurrentOptionLabel(selector);
|
|
2632
|
-
return /* @__PURE__ */ jsxs(
|
|
2632
|
+
return /* @__PURE__ */ jsxs(DropdownMenu2.Sub, { children: [
|
|
2633
2633
|
/* @__PURE__ */ jsxs(
|
|
2634
|
-
|
|
2634
|
+
DropdownMenu2.SubTrigger,
|
|
2635
2635
|
{
|
|
2636
2636
|
disabled: selector.disabled,
|
|
2637
2637
|
className: cn(
|
|
@@ -2646,8 +2646,8 @@ function UserAccountMenuSelector({
|
|
|
2646
2646
|
]
|
|
2647
2647
|
}
|
|
2648
2648
|
),
|
|
2649
|
-
/* @__PURE__ */ jsx(
|
|
2650
|
-
|
|
2649
|
+
/* @__PURE__ */ jsx(DropdownMenu2.Portal, { children: /* @__PURE__ */ jsx(
|
|
2650
|
+
DropdownMenu2.SubContent,
|
|
2651
2651
|
{
|
|
2652
2652
|
sideOffset: 8,
|
|
2653
2653
|
className: cn(
|
|
@@ -2656,8 +2656,8 @@ function UserAccountMenuSelector({
|
|
|
2656
2656
|
selector.contentWidthClassName,
|
|
2657
2657
|
classNames?.subContent
|
|
2658
2658
|
),
|
|
2659
|
-
children: /* @__PURE__ */ jsx(
|
|
2660
|
-
|
|
2659
|
+
children: /* @__PURE__ */ jsx(DropdownMenu2.RadioGroup, { value: selector.value, onValueChange: selector.onChange, children: selector.options.map((option) => /* @__PURE__ */ jsxs(
|
|
2660
|
+
DropdownMenu2.RadioItem,
|
|
2661
2661
|
{
|
|
2662
2662
|
value: option.value,
|
|
2663
2663
|
disabled: option.disabled,
|
|
@@ -2667,7 +2667,7 @@ function UserAccountMenuSelector({
|
|
|
2667
2667
|
classNames?.item
|
|
2668
2668
|
),
|
|
2669
2669
|
children: [
|
|
2670
|
-
/* @__PURE__ */ jsx(
|
|
2670
|
+
/* @__PURE__ */ jsx(DropdownMenu2.ItemIndicator, { className: "absolute left-2 inline-flex h-4 w-4 items-center justify-center", children: /* @__PURE__ */ jsx(CheckIcon, {}) }),
|
|
2671
2671
|
renderIcon(option.icon, classNames?.itemIcon),
|
|
2672
2672
|
/* @__PURE__ */ jsx("span", { className: "min-w-0 truncate", children: option.label })
|
|
2673
2673
|
]
|
|
@@ -2716,8 +2716,8 @@ function UserAccountMenu({
|
|
|
2716
2716
|
}
|
|
2717
2717
|
);
|
|
2718
2718
|
const isProfileTrigger = triggerVariant === "profile";
|
|
2719
|
-
return /* @__PURE__ */ jsxs(
|
|
2720
|
-
/* @__PURE__ */ jsx(
|
|
2719
|
+
return /* @__PURE__ */ jsxs(DropdownMenu2.Root, { children: [
|
|
2720
|
+
/* @__PURE__ */ jsx(DropdownMenu2.Trigger, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
2721
2721
|
BaseButton,
|
|
2722
2722
|
{
|
|
2723
2723
|
appearance,
|
|
@@ -2743,8 +2743,8 @@ function UserAccountMenu({
|
|
|
2743
2743
|
tone: "muted"
|
|
2744
2744
|
}
|
|
2745
2745
|
) }),
|
|
2746
|
-
/* @__PURE__ */ jsx(
|
|
2747
|
-
|
|
2746
|
+
/* @__PURE__ */ jsx(DropdownMenu2.Portal, { children: /* @__PURE__ */ jsxs(
|
|
2747
|
+
DropdownMenu2.Content,
|
|
2748
2748
|
{
|
|
2749
2749
|
align,
|
|
2750
2750
|
side,
|
|
@@ -2756,7 +2756,7 @@ function UserAccountMenu({
|
|
|
2756
2756
|
classNames?.content
|
|
2757
2757
|
),
|
|
2758
2758
|
children: [
|
|
2759
|
-
/* @__PURE__ */ jsx(
|
|
2759
|
+
/* @__PURE__ */ jsx(DropdownMenu2.Label, { className: cn("px-2 py-1.5 font-normal", classNames?.label), children: /* @__PURE__ */ jsxs("div", { className: "flex min-w-0 items-center gap-2", children: [
|
|
2760
2760
|
avatar,
|
|
2761
2761
|
/* @__PURE__ */ jsxs("div", { className: "flex min-w-0 flex-col", children: [
|
|
2762
2762
|
/* @__PURE__ */ jsx("span", { className: cn("truncate text-sm font-medium leading-none", classNames?.userName), children: displayName }),
|
|
@@ -2773,7 +2773,7 @@ function UserAccountMenu({
|
|
|
2773
2773
|
] })
|
|
2774
2774
|
] }) }),
|
|
2775
2775
|
hasMenuBody ? /* @__PURE__ */ jsx(
|
|
2776
|
-
|
|
2776
|
+
DropdownMenu2.Separator,
|
|
2777
2777
|
{
|
|
2778
2778
|
className: cn("my-1 h-px bg-[hsl(var(--border))]", classNames?.separator)
|
|
2779
2779
|
}
|
|
@@ -2788,20 +2788,20 @@ function UserAccountMenu({
|
|
|
2788
2788
|
selector.id ?? `selector-${index}`
|
|
2789
2789
|
)),
|
|
2790
2790
|
visibleSelectors.length > 0 && visibleItems.length > 0 ? /* @__PURE__ */ jsx(
|
|
2791
|
-
|
|
2791
|
+
DropdownMenu2.Separator,
|
|
2792
2792
|
{
|
|
2793
2793
|
className: cn("my-1 h-px bg-[hsl(var(--border))]", classNames?.separator)
|
|
2794
2794
|
}
|
|
2795
2795
|
) : null,
|
|
2796
2796
|
visibleItems.map((item) => /* @__PURE__ */ jsxs("div", { children: [
|
|
2797
2797
|
item.separatorBefore ? /* @__PURE__ */ jsx(
|
|
2798
|
-
|
|
2798
|
+
DropdownMenu2.Separator,
|
|
2799
2799
|
{
|
|
2800
2800
|
className: cn("my-1 h-px bg-[hsl(var(--border))]", classNames?.separator)
|
|
2801
2801
|
}
|
|
2802
2802
|
) : null,
|
|
2803
2803
|
/* @__PURE__ */ jsxs(
|
|
2804
|
-
|
|
2804
|
+
DropdownMenu2.Item,
|
|
2805
2805
|
{
|
|
2806
2806
|
disabled: item.disabled,
|
|
2807
2807
|
onSelect: item.disabled ? void 0 : item.onSelect,
|
|
@@ -2925,8 +2925,8 @@ function AppHeader({
|
|
|
2925
2925
|
(!tabs || tabs.length === 0) && /* @__PURE__ */ jsx("div", { className: "flex-1" }),
|
|
2926
2926
|
/* @__PURE__ */ jsxs("div", { className: "flex shrink-0 items-center gap-4", children: [
|
|
2927
2927
|
extra,
|
|
2928
|
-
user && /* @__PURE__ */ jsxs(
|
|
2929
|
-
/* @__PURE__ */ jsx(
|
|
2928
|
+
user && /* @__PURE__ */ jsxs(DropdownMenu2.Root, { children: [
|
|
2929
|
+
/* @__PURE__ */ jsx(DropdownMenu2.Trigger, { asChild: true, children: /* @__PURE__ */ jsx("button", { className: "flex h-8 w-8 items-center justify-center rounded-full hover:ring-2 hover:ring-[hsl(var(--ring))]/20 transition-all overflow-hidden focus-visible:outline-none", children: user.photo ? /* @__PURE__ */ jsx(
|
|
2930
2930
|
"img",
|
|
2931
2931
|
{
|
|
2932
2932
|
src: user.photo,
|
|
@@ -2934,14 +2934,14 @@ function AppHeader({
|
|
|
2934
2934
|
className: "h-8 w-8 rounded-full object-cover"
|
|
2935
2935
|
}
|
|
2936
2936
|
) : /* @__PURE__ */ jsx("div", { className: "flex h-8 w-8 items-center justify-center rounded-full bg-[hsl(var(--muted))] text-xs font-medium", children: user.name ? getUserInitials(user.name) : "U" }) }) }),
|
|
2937
|
-
/* @__PURE__ */ jsx(
|
|
2938
|
-
|
|
2937
|
+
/* @__PURE__ */ jsx(DropdownMenu2.Portal, { children: /* @__PURE__ */ jsxs(
|
|
2938
|
+
DropdownMenu2.Content,
|
|
2939
2939
|
{
|
|
2940
2940
|
className: "z-50 w-52 rounded-md border border-[hsl(var(--border))] bg-[hsl(var(--popover))] p-1 text-[hsl(var(--popover-foreground))] shadow-md animate-in fade-in-0 zoom-in-95",
|
|
2941
2941
|
sideOffset: 5,
|
|
2942
2942
|
align: "end",
|
|
2943
2943
|
children: [
|
|
2944
|
-
/* @__PURE__ */ jsxs(
|
|
2944
|
+
/* @__PURE__ */ jsxs(DropdownMenu2.Label, { className: "flex items-center gap-2 px-2 py-1.5 font-normal", children: [
|
|
2945
2945
|
user.photo ? /* @__PURE__ */ jsx(
|
|
2946
2946
|
"img",
|
|
2947
2947
|
{
|
|
@@ -2955,11 +2955,11 @@ function AppHeader({
|
|
|
2955
2955
|
user.email && /* @__PURE__ */ jsx("span", { className: "text-xs text-[hsl(var(--muted-foreground))] leading-none mt-1", children: user.email })
|
|
2956
2956
|
] })
|
|
2957
2957
|
] }),
|
|
2958
|
-
/* @__PURE__ */ jsx(
|
|
2959
|
-
/* @__PURE__ */ jsxs(
|
|
2958
|
+
/* @__PURE__ */ jsx(DropdownMenu2.Separator, { className: "h-px bg-[hsl(var(--border))] my-1" }),
|
|
2959
|
+
/* @__PURE__ */ jsxs(DropdownMenu2.Group, { children: [
|
|
2960
2960
|
userMenuItems,
|
|
2961
2961
|
/* @__PURE__ */ jsxs(
|
|
2962
|
-
|
|
2962
|
+
DropdownMenu2.Item,
|
|
2963
2963
|
{
|
|
2964
2964
|
className: "relative flex cursor-pointer select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm text-[hsl(var(--destructive))] outline-none transition-colors hover:bg-[hsl(var(--accent))]",
|
|
2965
2965
|
onSelect: () => onLogout?.(),
|
|
@@ -3236,6 +3236,7 @@ function AppLayout({
|
|
|
3236
3236
|
}
|
|
3237
3237
|
var NAVIGATION_LAYOUT_SIDEBAR_EXPANDED_WIDTH = "13.7rem";
|
|
3238
3238
|
var NAVIGATION_LAYOUT_SIDEBAR_COLLAPSED_WIDTH = "4.25rem";
|
|
3239
|
+
var NAVIGATION_LAYOUT_CONTEXTUAL_SIDEBAR_WIDTH = "15rem";
|
|
3239
3240
|
var NAVIGATION_LAYOUT_TRANSITION_TIMING = "cubic-bezier(0.22, 1, 0.36, 1)";
|
|
3240
3241
|
var NAVIGATION_LAYOUT_HEADBAR_DEFAULT_HEIGHT_PX = 72;
|
|
3241
3242
|
var NAVIGATION_LAYOUT_HEADBAR_MIN_HEIGHT_PX = 56;
|
|
@@ -3363,11 +3364,18 @@ function getHeadbarCompoundStyle(active, useTokenRadius = true) {
|
|
|
3363
3364
|
function findNavigationRootId(items, activeItemId) {
|
|
3364
3365
|
for (const item of items) {
|
|
3365
3366
|
if (item.id === activeItemId) return item.id;
|
|
3366
|
-
if (item
|
|
3367
|
-
return item.id;
|
|
3367
|
+
if (containsNavigationItem(item, activeItemId)) return item.id;
|
|
3368
3368
|
}
|
|
3369
3369
|
return activeItemId;
|
|
3370
3370
|
}
|
|
3371
|
+
function containsNavigationItem(item, itemId) {
|
|
3372
|
+
if (!itemId) return false;
|
|
3373
|
+
if (item.id === itemId) return true;
|
|
3374
|
+
return item.children?.some((child) => containsNavigationItem(child, itemId)) ?? false;
|
|
3375
|
+
}
|
|
3376
|
+
function findActiveNavigationBranch(item, activeItemId) {
|
|
3377
|
+
return item.children?.find((child) => containsNavigationItem(child, activeItemId));
|
|
3378
|
+
}
|
|
3371
3379
|
function getNavigationActionTitle(action) {
|
|
3372
3380
|
return action.title || (typeof action.label === "string" ? action.label : void 0);
|
|
3373
3381
|
}
|
|
@@ -3436,10 +3444,7 @@ function SidebarNavigationList({
|
|
|
3436
3444
|
const [expandedByRoot, setExpandedByRoot] = useState(
|
|
3437
3445
|
{}
|
|
3438
3446
|
);
|
|
3439
|
-
const canReveal = revealRequest ? items.some(
|
|
3440
|
-
(item) => item.id === revealRequest.id && !item.disabled
|
|
3441
|
-
) : false;
|
|
3442
|
-
const activeRootId = findNavigationRootId(items, activeItemId);
|
|
3447
|
+
const canReveal = revealRequest ? items.some((item) => containsNavigationItem(item, revealRequest.id) && !item.disabled) : false;
|
|
3443
3448
|
const toggleRoot = (id) => {
|
|
3444
3449
|
setExpandedByRoot((current) => ({
|
|
3445
3450
|
...current,
|
|
@@ -3448,13 +3453,10 @@ function SidebarNavigationList({
|
|
|
3448
3453
|
};
|
|
3449
3454
|
useEffect(() => {
|
|
3450
3455
|
if (!revealRequest || !canReveal) return;
|
|
3451
|
-
setExpandedByRoot((current) => ({
|
|
3452
|
-
...current,
|
|
3453
|
-
[revealRequest.id]: true
|
|
3454
|
-
}));
|
|
3456
|
+
setExpandedByRoot((current) => ({ ...current, [revealRequest.id]: true }));
|
|
3455
3457
|
const frameId = window.requestAnimationFrame(() => {
|
|
3456
3458
|
const targetElement = navRef.current?.querySelector(
|
|
3457
|
-
`[data-navigation-sidebar-
|
|
3459
|
+
`[data-navigation-sidebar-item-id="${CSS.escape(revealRequest.id)}"]`
|
|
3458
3460
|
);
|
|
3459
3461
|
if (targetElement instanceof HTMLElement) {
|
|
3460
3462
|
targetElement.scrollIntoView({
|
|
@@ -3466,6 +3468,34 @@ function SidebarNavigationList({
|
|
|
3466
3468
|
});
|
|
3467
3469
|
return () => window.cancelAnimationFrame(frameId);
|
|
3468
3470
|
}, [canReveal, revealRequest]);
|
|
3471
|
+
const renderItems = (navigationItems, depth = 0) => navigationItems.map((item) => {
|
|
3472
|
+
const isGroup = Boolean(item.children?.length);
|
|
3473
|
+
const containsActiveItem = containsNavigationItem(item, activeItemId);
|
|
3474
|
+
const isExpanded = !item.disabled && (expandedByRoot[item.id] ?? containsActiveItem);
|
|
3475
|
+
return /* @__PURE__ */ jsxs("div", { "data-navigation-sidebar-item-id": item.id, children: [
|
|
3476
|
+
/* @__PURE__ */ jsx(
|
|
3477
|
+
NavButton,
|
|
3478
|
+
{
|
|
3479
|
+
active: containsActiveItem,
|
|
3480
|
+
className: depth > 0 ? "pl-3" : void 0,
|
|
3481
|
+
disabled: item.disabled,
|
|
3482
|
+
icon: item.icon,
|
|
3483
|
+
onClick: () => isGroup ? toggleRoot(item.id) : onNavigate?.(item.id),
|
|
3484
|
+
postfix: isGroup ? /* @__PURE__ */ jsx("div", { className: "flex flex-1 justify-end", children: /* @__PURE__ */ jsx(
|
|
3485
|
+
HeadbarChevronIcon,
|
|
3486
|
+
{
|
|
3487
|
+
open: false,
|
|
3488
|
+
sideways: true,
|
|
3489
|
+
className: "text-[hsl(var(--foreground))] transition-transform duration-200",
|
|
3490
|
+
style: { transform: isExpanded ? "rotate(90deg)" : "rotate(0deg)" }
|
|
3491
|
+
}
|
|
3492
|
+
) }) : void 0,
|
|
3493
|
+
children: item.label
|
|
3494
|
+
}
|
|
3495
|
+
),
|
|
3496
|
+
isGroup && isExpanded ? /* @__PURE__ */ jsx("div", { className: "mt-1 ml-3 flex flex-col gap-1 border-l border-[hsl(var(--input))] pl-2", children: renderItems(item.children ?? [], depth + 1) }) : null
|
|
3497
|
+
] }, item.id);
|
|
3498
|
+
});
|
|
3469
3499
|
return /* @__PURE__ */ jsxs(
|
|
3470
3500
|
"div",
|
|
3471
3501
|
{
|
|
@@ -3478,64 +3508,7 @@ function SidebarNavigationList({
|
|
|
3478
3508
|
{
|
|
3479
3509
|
ref: navRef,
|
|
3480
3510
|
className: "monkeys-navigation-sidebar-nav flex w-full flex-col gap-2 text-xs text-[hsl(var(--foreground))]",
|
|
3481
|
-
children: items
|
|
3482
|
-
const isGroup = Boolean(item.children?.length);
|
|
3483
|
-
const isExpanded = !item.disabled && Boolean(expandedByRoot[item.id]);
|
|
3484
|
-
const isActive = activeRootId === item.id;
|
|
3485
|
-
if (isGroup) {
|
|
3486
|
-
return /* @__PURE__ */ jsxs("div", { "data-navigation-sidebar-root-id": item.id, children: [
|
|
3487
|
-
/* @__PURE__ */ jsx(
|
|
3488
|
-
NavButton,
|
|
3489
|
-
{
|
|
3490
|
-
active: isActive,
|
|
3491
|
-
disabled: item.disabled,
|
|
3492
|
-
icon: item.icon,
|
|
3493
|
-
onClick: () => toggleRoot(item.id),
|
|
3494
|
-
postfix: /* @__PURE__ */ jsx("div", { className: "flex flex-1 justify-end", children: /* @__PURE__ */ jsx(
|
|
3495
|
-
"svg",
|
|
3496
|
-
{
|
|
3497
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
3498
|
-
width: "16",
|
|
3499
|
-
height: "16",
|
|
3500
|
-
viewBox: "0 0 24 24",
|
|
3501
|
-
fill: "none",
|
|
3502
|
-
stroke: "currentColor",
|
|
3503
|
-
strokeWidth: "2",
|
|
3504
|
-
strokeLinecap: "round",
|
|
3505
|
-
strokeLinejoin: "round",
|
|
3506
|
-
className: "shrink-0 text-[hsl(var(--foreground))] transition-transform duration-200",
|
|
3507
|
-
style: {
|
|
3508
|
-
transform: isExpanded ? "rotate(90deg)" : "rotate(0deg)"
|
|
3509
|
-
},
|
|
3510
|
-
children: /* @__PURE__ */ jsx("path", { d: "m9 18 6-6-6-6" })
|
|
3511
|
-
}
|
|
3512
|
-
) }),
|
|
3513
|
-
children: item.label
|
|
3514
|
-
}
|
|
3515
|
-
),
|
|
3516
|
-
isExpanded ? /* @__PURE__ */ jsx("div", { className: "mt-1 flex flex-col gap-1", children: item.children?.map((child) => /* @__PURE__ */ jsx(
|
|
3517
|
-
NavButton,
|
|
3518
|
-
{
|
|
3519
|
-
active: activeItemId === child.id,
|
|
3520
|
-
disabled: child.disabled,
|
|
3521
|
-
onClick: () => onNavigate?.(child.id),
|
|
3522
|
-
children: child.label
|
|
3523
|
-
},
|
|
3524
|
-
child.id
|
|
3525
|
-
)) }) : null
|
|
3526
|
-
] }, item.id);
|
|
3527
|
-
}
|
|
3528
|
-
return /* @__PURE__ */ jsx("div", { "data-navigation-sidebar-root-id": item.id, children: /* @__PURE__ */ jsx(
|
|
3529
|
-
NavButton,
|
|
3530
|
-
{
|
|
3531
|
-
active: isActive,
|
|
3532
|
-
disabled: item.disabled,
|
|
3533
|
-
icon: item.icon,
|
|
3534
|
-
onClick: () => onNavigate?.(item.id),
|
|
3535
|
-
children: item.label
|
|
3536
|
-
}
|
|
3537
|
-
) }, item.id);
|
|
3538
|
-
})
|
|
3511
|
+
children: renderItems(items)
|
|
3539
3512
|
}
|
|
3540
3513
|
)
|
|
3541
3514
|
]
|
|
@@ -3694,22 +3667,30 @@ function Sidebar({
|
|
|
3694
3667
|
] })
|
|
3695
3668
|
] });
|
|
3696
3669
|
}
|
|
3697
|
-
function HeadbarChevronIcon({
|
|
3670
|
+
function HeadbarChevronIcon({
|
|
3671
|
+
className,
|
|
3672
|
+
open,
|
|
3673
|
+
sideways = false,
|
|
3674
|
+
style
|
|
3675
|
+
}) {
|
|
3698
3676
|
return /* @__PURE__ */ jsx(
|
|
3699
3677
|
"svg",
|
|
3700
3678
|
{
|
|
3701
3679
|
"aria-hidden": "true",
|
|
3702
3680
|
className: cn2(
|
|
3703
|
-
"h-4 w-4 shrink-0
|
|
3704
|
-
|
|
3681
|
+
"h-4 w-4 shrink-0",
|
|
3682
|
+
!sideways && "transition-transform duration-200",
|
|
3683
|
+
!sideways && open && "rotate-180",
|
|
3684
|
+
className
|
|
3705
3685
|
),
|
|
3686
|
+
style,
|
|
3706
3687
|
viewBox: "0 0 24 24",
|
|
3707
3688
|
fill: "none",
|
|
3708
3689
|
stroke: "currentColor",
|
|
3709
3690
|
strokeWidth: "2",
|
|
3710
3691
|
strokeLinecap: "round",
|
|
3711
3692
|
strokeLinejoin: "round",
|
|
3712
|
-
children: /* @__PURE__ */ jsx("path", { d: "m6 9 6 6 6-6" })
|
|
3693
|
+
children: /* @__PURE__ */ jsx("path", { d: sideways ? "m9 18 6-6-6-6" : "m6 9 6 6 6-6" })
|
|
3713
3694
|
}
|
|
3714
3695
|
);
|
|
3715
3696
|
}
|
|
@@ -3721,6 +3702,100 @@ function getHeadbarSummaryTitle(rootLabel, childLabel) {
|
|
|
3721
3702
|
const childText = childLabel.trim();
|
|
3722
3703
|
return rootText && childText ? `${rootText} ${childText}` : void 0;
|
|
3723
3704
|
}
|
|
3705
|
+
var HEADBAR_DROPDOWN_ITEM_CLASS = "relative flex w-full min-w-0 cursor-pointer select-none items-center gap-2.5 px-3 py-2 text-sm outline-none transition-colors hover:!bg-[var(--monkeys-component-navigation-headbar-item-hover-background,hsl(var(--accent)))] hover:!text-[var(--monkeys-component-navigation-headbar-item-hover-foreground,hsl(var(--accent-foreground)))] focus:!bg-[var(--monkeys-component-navigation-headbar-item-hover-background,hsl(var(--accent)))] focus:!text-[var(--monkeys-component-navigation-headbar-item-hover-foreground,hsl(var(--accent-foreground)))] data-[highlighted]:!bg-[var(--monkeys-component-navigation-headbar-item-hover-background,hsl(var(--accent)))] data-[highlighted]:!text-[var(--monkeys-component-navigation-headbar-item-hover-foreground,hsl(var(--accent-foreground)))]";
|
|
3706
|
+
var HEADBAR_DROPDOWN_CONTENT_STYLE = {
|
|
3707
|
+
width: "max-content",
|
|
3708
|
+
maxWidth: "min(20rem, var(--radix-dropdown-menu-content-available-width))",
|
|
3709
|
+
background: "var(--monkeys-component-navigation-headbar-menu-background, hsl(var(--popover)))",
|
|
3710
|
+
borderColor: "var(--monkeys-component-navigation-headbar-menu-border-color, hsl(var(--border)))",
|
|
3711
|
+
color: "var(--monkeys-component-navigation-headbar-menu-foreground, hsl(var(--popover-foreground)))",
|
|
3712
|
+
boxShadow: "var(--monkeys-component-navigation-headbar-menu-shadow, 0 10px 15px -3px rgb(0 0 0 / 0.1))"
|
|
3713
|
+
};
|
|
3714
|
+
function HeadbarDropdownItems({
|
|
3715
|
+
activeItemId,
|
|
3716
|
+
items,
|
|
3717
|
+
menuContentRadiusClass,
|
|
3718
|
+
menuItemRadiusClass,
|
|
3719
|
+
onNavigate,
|
|
3720
|
+
onNavigateComplete,
|
|
3721
|
+
useTokenRadius
|
|
3722
|
+
}) {
|
|
3723
|
+
return items.map((item) => {
|
|
3724
|
+
const label = /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
3725
|
+
item.icon ? /* @__PURE__ */ jsx("span", { className: "inline-flex h-4 w-4 shrink-0 items-center justify-center text-[hsl(var(--muted-foreground))]", children: item.icon }) : null,
|
|
3726
|
+
/* @__PURE__ */ jsx(
|
|
3727
|
+
"span",
|
|
3728
|
+
{
|
|
3729
|
+
className: cn2(
|
|
3730
|
+
"min-w-0 truncate",
|
|
3731
|
+
Boolean(item.children?.length) && "flex-1"
|
|
3732
|
+
),
|
|
3733
|
+
children: item.headbarLabel ?? item.label
|
|
3734
|
+
}
|
|
3735
|
+
)
|
|
3736
|
+
] });
|
|
3737
|
+
if (item.children?.length) {
|
|
3738
|
+
return /* @__PURE__ */ jsxs(DropdownMenu2.Sub, { children: [
|
|
3739
|
+
/* @__PURE__ */ jsxs(
|
|
3740
|
+
DropdownMenu2.SubTrigger,
|
|
3741
|
+
{
|
|
3742
|
+
disabled: item.disabled,
|
|
3743
|
+
className: cn2(HEADBAR_DROPDOWN_ITEM_CLASS, menuItemRadiusClass),
|
|
3744
|
+
children: [
|
|
3745
|
+
label,
|
|
3746
|
+
/* @__PURE__ */ jsx(HeadbarChevronIcon, { open: false, sideways: true })
|
|
3747
|
+
]
|
|
3748
|
+
}
|
|
3749
|
+
),
|
|
3750
|
+
/* @__PURE__ */ jsx(DropdownMenu2.Portal, { children: /* @__PURE__ */ jsx(
|
|
3751
|
+
DropdownMenu2.SubContent,
|
|
3752
|
+
{
|
|
3753
|
+
sideOffset: 4,
|
|
3754
|
+
alignOffset: -6,
|
|
3755
|
+
className: cn2(
|
|
3756
|
+
"z-50 border p-1.5 animate-in fade-in-0 zoom-in-95",
|
|
3757
|
+
menuContentRadiusClass
|
|
3758
|
+
),
|
|
3759
|
+
style: {
|
|
3760
|
+
...HEADBAR_DROPDOWN_CONTENT_STYLE,
|
|
3761
|
+
minWidth: "12rem"
|
|
3762
|
+
},
|
|
3763
|
+
children: /* @__PURE__ */ jsx(
|
|
3764
|
+
HeadbarDropdownItems,
|
|
3765
|
+
{
|
|
3766
|
+
activeItemId,
|
|
3767
|
+
items: item.children,
|
|
3768
|
+
menuContentRadiusClass,
|
|
3769
|
+
menuItemRadiusClass,
|
|
3770
|
+
onNavigate,
|
|
3771
|
+
onNavigateComplete,
|
|
3772
|
+
useTokenRadius
|
|
3773
|
+
}
|
|
3774
|
+
)
|
|
3775
|
+
}
|
|
3776
|
+
) })
|
|
3777
|
+
] }, item.id);
|
|
3778
|
+
}
|
|
3779
|
+
return /* @__PURE__ */ jsxs(
|
|
3780
|
+
DropdownMenu2.Item,
|
|
3781
|
+
{
|
|
3782
|
+
disabled: item.disabled,
|
|
3783
|
+
className: cn2(HEADBAR_DROPDOWN_ITEM_CLASS, menuItemRadiusClass),
|
|
3784
|
+
style: getHeadbarItemStyle(item.id === activeItemId, useTokenRadius),
|
|
3785
|
+
onSelect: () => {
|
|
3786
|
+
if (item.disabled) return;
|
|
3787
|
+
onNavigateComplete();
|
|
3788
|
+
onNavigate?.(item.id);
|
|
3789
|
+
},
|
|
3790
|
+
children: [
|
|
3791
|
+
label,
|
|
3792
|
+
item.trailing
|
|
3793
|
+
]
|
|
3794
|
+
},
|
|
3795
|
+
item.id
|
|
3796
|
+
);
|
|
3797
|
+
});
|
|
3798
|
+
}
|
|
3724
3799
|
function HeadbarNavMenuItem({
|
|
3725
3800
|
activeItemId,
|
|
3726
3801
|
compound,
|
|
@@ -3764,13 +3839,13 @@ function HeadbarNavMenuItem({
|
|
|
3764
3839
|
};
|
|
3765
3840
|
useEffect(() => clearCloseTimer, []);
|
|
3766
3841
|
return /* @__PURE__ */ jsxs(
|
|
3767
|
-
|
|
3842
|
+
DropdownMenu2.Root,
|
|
3768
3843
|
{
|
|
3769
3844
|
modal: false,
|
|
3770
3845
|
open: isOpen,
|
|
3771
3846
|
onOpenChange: (nextOpen) => setOpen(!item.disabled && nextOpen),
|
|
3772
3847
|
children: [
|
|
3773
|
-
/* @__PURE__ */ jsx(
|
|
3848
|
+
/* @__PURE__ */ jsx(DropdownMenu2.Trigger, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
3774
3849
|
BaseButton,
|
|
3775
3850
|
{
|
|
3776
3851
|
appearance: NAVIGATION_LAYOUT_DEFAULT_APPEARANCE,
|
|
@@ -3816,8 +3891,8 @@ function HeadbarNavMenuItem({
|
|
|
3816
3891
|
)
|
|
3817
3892
|
}
|
|
3818
3893
|
) }),
|
|
3819
|
-
/* @__PURE__ */ jsx(
|
|
3820
|
-
|
|
3894
|
+
/* @__PURE__ */ jsx(DropdownMenu2.Portal, { children: /* @__PURE__ */ jsx(
|
|
3895
|
+
DropdownMenu2.Content,
|
|
3821
3896
|
{
|
|
3822
3897
|
align: "start",
|
|
3823
3898
|
sideOffset: 5,
|
|
@@ -3829,40 +3904,22 @@ function HeadbarNavMenuItem({
|
|
|
3829
3904
|
menuContentRadiusClass
|
|
3830
3905
|
),
|
|
3831
3906
|
style: {
|
|
3832
|
-
|
|
3907
|
+
...HEADBAR_DROPDOWN_CONTENT_STYLE,
|
|
3833
3908
|
minWidth: "var(--radix-dropdown-menu-trigger-width)",
|
|
3834
|
-
maxWidth: "min(20rem, var(--radix-dropdown-menu-content-available-width))",
|
|
3835
|
-
background: "var(--monkeys-component-navigation-headbar-menu-background, hsl(var(--popover)))",
|
|
3836
|
-
borderColor: "var(--monkeys-component-navigation-headbar-menu-border-color, hsl(var(--border)))",
|
|
3837
|
-
color: "var(--monkeys-component-navigation-headbar-menu-foreground, hsl(var(--popover-foreground)))",
|
|
3838
|
-
boxShadow: "var(--monkeys-component-navigation-headbar-menu-shadow, 0 10px 15px -3px rgb(0 0 0 / 0.1))",
|
|
3839
3909
|
backdropFilter: "blur(var(--monkeys-component-navigation-headbar-menu-backdrop-blur, 0px))"
|
|
3840
3910
|
},
|
|
3841
|
-
children:
|
|
3842
|
-
|
|
3911
|
+
children: /* @__PURE__ */ jsx(
|
|
3912
|
+
HeadbarDropdownItems,
|
|
3843
3913
|
{
|
|
3844
|
-
|
|
3845
|
-
|
|
3846
|
-
|
|
3847
|
-
|
|
3848
|
-
|
|
3849
|
-
|
|
3850
|
-
|
|
3851
|
-
|
|
3852
|
-
|
|
3853
|
-
onSelect: () => {
|
|
3854
|
-
if (child.disabled) return;
|
|
3855
|
-
setOpen(false);
|
|
3856
|
-
onNavigate?.(child.id);
|
|
3857
|
-
},
|
|
3858
|
-
children: [
|
|
3859
|
-
child.icon ? /* @__PURE__ */ jsx("span", { className: "inline-flex h-4 w-4 shrink-0 items-center justify-center text-[hsl(var(--muted-foreground))]", children: child.icon }) : null,
|
|
3860
|
-
/* @__PURE__ */ jsx("span", { className: "min-w-0 truncate", children: child.headbarLabel ?? child.label }),
|
|
3861
|
-
child.trailing
|
|
3862
|
-
]
|
|
3863
|
-
},
|
|
3864
|
-
child.id
|
|
3865
|
-
))
|
|
3914
|
+
activeItemId,
|
|
3915
|
+
items: item.children ?? [],
|
|
3916
|
+
menuContentRadiusClass,
|
|
3917
|
+
menuItemRadiusClass,
|
|
3918
|
+
onNavigate,
|
|
3919
|
+
onNavigateComplete: () => setOpen(false),
|
|
3920
|
+
useTokenRadius
|
|
3921
|
+
}
|
|
3922
|
+
)
|
|
3866
3923
|
}
|
|
3867
3924
|
) })
|
|
3868
3925
|
]
|
|
@@ -3888,9 +3945,7 @@ function NavigationHeadbarMenu({
|
|
|
3888
3945
|
const isActive = activeRootId === item.id || activeItemId === item.id;
|
|
3889
3946
|
const hasSecondaryAction = Boolean(item.headbarSecondaryAction);
|
|
3890
3947
|
const rootLabel = item.headbarLabel ?? item.label;
|
|
3891
|
-
const activeChild = item
|
|
3892
|
-
(child) => child.id === activeItemId
|
|
3893
|
-
);
|
|
3948
|
+
const activeChild = findActiveNavigationBranch(item, activeItemId);
|
|
3894
3949
|
const activeChildLabel = activeChild ? activeChild.headbarLabel ?? activeChild.label : void 0;
|
|
3895
3950
|
const label = activeChild ? /* @__PURE__ */ jsxs(
|
|
3896
3951
|
"span",
|
|
@@ -4096,6 +4151,9 @@ function NavigationLayout({
|
|
|
4096
4151
|
className,
|
|
4097
4152
|
collapsedSidebarAccountMenu,
|
|
4098
4153
|
collapsedSidebarWidth = NAVIGATION_LAYOUT_SIDEBAR_COLLAPSED_WIDTH,
|
|
4154
|
+
contextualSidebar = false,
|
|
4155
|
+
contextualSidebarHeader,
|
|
4156
|
+
contextualSidebarWidth = NAVIGATION_LAYOUT_CONTEXTUAL_SIDEBAR_WIDTH,
|
|
4099
4157
|
defaultMode = "headbar",
|
|
4100
4158
|
defaultSidebarCollapsed = false,
|
|
4101
4159
|
expandedSidebarWidth = NAVIGATION_LAYOUT_SIDEBAR_EXPANDED_WIDTH,
|
|
@@ -4127,6 +4185,9 @@ function NavigationLayout({
|
|
|
4127
4185
|
const sidebarCollapsed = isSidebarCollapsedControlled ? controlledSidebarCollapsed : uncontrolledSidebarCollapsed;
|
|
4128
4186
|
const isHeadbarMode = navigationMode === "headbar";
|
|
4129
4187
|
const sidebarWidth = sidebarCollapsed ? collapsedSidebarWidth : expandedSidebarWidth;
|
|
4188
|
+
const resolvedActiveRootId = activeRootId ?? findNavigationRootId(navItems, activeItemId);
|
|
4189
|
+
const activeRoot = navItems.find((item) => item.id === resolvedActiveRootId);
|
|
4190
|
+
const contextualItems = activeRoot?.children ?? [];
|
|
4130
4191
|
useEffect(() => {
|
|
4131
4192
|
if (!isModeControlled) {
|
|
4132
4193
|
setUncontrolledMode(defaultMode);
|
|
@@ -4197,7 +4258,25 @@ function NavigationLayout({
|
|
|
4197
4258
|
}
|
|
4198
4259
|
)
|
|
4199
4260
|
});
|
|
4200
|
-
const sidebar = isHeadbarMode
|
|
4261
|
+
const sidebar = isHeadbarMode && contextualSidebar && contextualItems.length ? /* @__PURE__ */ jsx(
|
|
4262
|
+
"aside",
|
|
4263
|
+
{
|
|
4264
|
+
className: "relative h-full min-h-0 shrink-0 overflow-hidden",
|
|
4265
|
+
"data-navigation-contextual-sidebar": resolvedActiveRootId,
|
|
4266
|
+
style: { width: contextualSidebarWidth },
|
|
4267
|
+
children: /* @__PURE__ */ jsxs("div", { className: "flex h-full min-h-0 w-full flex-col gap-3 rounded-xl border border-[hsl(var(--input))] bg-[hsl(var(--background))] px-4 py-4", children: [
|
|
4268
|
+
/* @__PURE__ */ jsx("div", { className: "shrink-0 px-2 text-sm font-semibold text-[hsl(var(--foreground))]", children: contextualSidebarHeader ?? activeRoot?.label }),
|
|
4269
|
+
/* @__PURE__ */ jsx(
|
|
4270
|
+
SidebarNavigationList,
|
|
4271
|
+
{
|
|
4272
|
+
activeItemId,
|
|
4273
|
+
items: contextualItems,
|
|
4274
|
+
onNavigate
|
|
4275
|
+
}
|
|
4276
|
+
)
|
|
4277
|
+
] })
|
|
4278
|
+
}
|
|
4279
|
+
) : isHeadbarMode ? null : /* @__PURE__ */ jsx(
|
|
4201
4280
|
"div",
|
|
4202
4281
|
{
|
|
4203
4282
|
className: cn2(
|
|
@@ -4236,7 +4315,7 @@ function NavigationLayout({
|
|
|
4236
4315
|
NavigationHeadbar,
|
|
4237
4316
|
{
|
|
4238
4317
|
activeItemId,
|
|
4239
|
-
activeRootId:
|
|
4318
|
+
activeRootId: resolvedActiveRootId,
|
|
4240
4319
|
actions: allowModeSwitch ? /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
4241
4320
|
headbarActions,
|
|
4242
4321
|
/* @__PURE__ */ jsx(
|