@inf-monkeys-tech/monkeys-design 1.0.35 → 1.0.36
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 +149 -98
- package/dist/components/layout/index.js.map +1 -1
- package/dist/components/layout/index.mjs +149 -98
- package/dist/components/layout/index.mjs.map +1 -1
- package/dist/index.js +149 -98
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +149 -98
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -107,6 +107,8 @@ declare function cn(...inputs: (false | null | string | undefined)[]): string;
|
|
|
107
107
|
interface NavButtonProps {
|
|
108
108
|
/** 是否处于激活状态 */
|
|
109
109
|
active?: boolean;
|
|
110
|
+
/** 是否显示但禁止交互 */
|
|
111
|
+
disabled?: boolean;
|
|
110
112
|
/** 左侧图标 */
|
|
111
113
|
icon?: ReactNode;
|
|
112
114
|
/** 右侧附加内容(如 chevron) */
|
|
@@ -116,7 +118,7 @@ interface NavButtonProps {
|
|
|
116
118
|
className?: string;
|
|
117
119
|
children: ReactNode;
|
|
118
120
|
}
|
|
119
|
-
declare function NavButton({ active, icon, postfix, onClick, className, children, }: NavButtonProps): react_jsx_runtime.JSX.Element;
|
|
121
|
+
declare function NavButton({ active, disabled, icon, postfix, onClick, className, children, }: NavButtonProps): react_jsx_runtime.JSX.Element;
|
|
120
122
|
interface HeaderTab {
|
|
121
123
|
id: string;
|
|
122
124
|
label: string;
|
|
@@ -160,6 +162,7 @@ interface SidebarNavItem {
|
|
|
160
162
|
id: string;
|
|
161
163
|
label: string;
|
|
162
164
|
icon?: ReactNode;
|
|
165
|
+
disabled?: boolean;
|
|
163
166
|
/** 如果有 children 则为分组,点击展开/折叠 */
|
|
164
167
|
children?: SidebarNavItem[];
|
|
165
168
|
}
|
|
@@ -107,6 +107,8 @@ declare function cn(...inputs: (false | null | string | undefined)[]): string;
|
|
|
107
107
|
interface NavButtonProps {
|
|
108
108
|
/** 是否处于激活状态 */
|
|
109
109
|
active?: boolean;
|
|
110
|
+
/** 是否显示但禁止交互 */
|
|
111
|
+
disabled?: boolean;
|
|
110
112
|
/** 左侧图标 */
|
|
111
113
|
icon?: ReactNode;
|
|
112
114
|
/** 右侧附加内容(如 chevron) */
|
|
@@ -116,7 +118,7 @@ interface NavButtonProps {
|
|
|
116
118
|
className?: string;
|
|
117
119
|
children: ReactNode;
|
|
118
120
|
}
|
|
119
|
-
declare function NavButton({ active, icon, postfix, onClick, className, children, }: NavButtonProps): react_jsx_runtime.JSX.Element;
|
|
121
|
+
declare function NavButton({ active, disabled, icon, postfix, onClick, className, children, }: NavButtonProps): react_jsx_runtime.JSX.Element;
|
|
120
122
|
interface HeaderTab {
|
|
121
123
|
id: string;
|
|
122
124
|
label: string;
|
|
@@ -160,6 +162,7 @@ interface SidebarNavItem {
|
|
|
160
162
|
id: string;
|
|
161
163
|
label: string;
|
|
162
164
|
icon?: ReactNode;
|
|
165
|
+
disabled?: boolean;
|
|
163
166
|
/** 如果有 children 则为分组,点击展开/折叠 */
|
|
164
167
|
children?: SidebarNavItem[];
|
|
165
168
|
}
|
|
@@ -2789,7 +2789,7 @@ function UserAccountMenu({
|
|
|
2789
2789
|
DropdownMenu__namespace.Item,
|
|
2790
2790
|
{
|
|
2791
2791
|
disabled: item.disabled,
|
|
2792
|
-
onSelect: item.onSelect,
|
|
2792
|
+
onSelect: item.disabled ? void 0 : item.onSelect,
|
|
2793
2793
|
className: cn(
|
|
2794
2794
|
"relative flex cursor-pointer select-none items-center gap-2 px-2 py-2 text-sm outline-none transition-colors hover:bg-[hsl(var(--accent))] hover:text-[hsl(var(--accent-foreground))] data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
|
2795
2795
|
radiusClass,
|
|
@@ -2815,6 +2815,7 @@ function cn2(...inputs) {
|
|
|
2815
2815
|
}
|
|
2816
2816
|
function NavButton({
|
|
2817
2817
|
active,
|
|
2818
|
+
disabled,
|
|
2818
2819
|
icon,
|
|
2819
2820
|
postfix,
|
|
2820
2821
|
onClick,
|
|
@@ -2822,11 +2823,17 @@ function NavButton({
|
|
|
2822
2823
|
children
|
|
2823
2824
|
}) {
|
|
2824
2825
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2825
|
-
"
|
|
2826
|
+
"button",
|
|
2826
2827
|
{
|
|
2828
|
+
type: "button",
|
|
2829
|
+
"aria-disabled": disabled || void 0,
|
|
2830
|
+
"aria-pressed": active || void 0,
|
|
2831
|
+
"data-disabled": disabled || void 0,
|
|
2832
|
+
disabled,
|
|
2827
2833
|
className: cn2(
|
|
2828
|
-
"flex w-full cursor-pointer select-none items-center gap-2 rounded-xl border p-2 text-xs text-[hsl(var(--foreground))] transition-colors",
|
|
2834
|
+
"flex w-full cursor-pointer select-none items-center gap-2 rounded-xl border p-2 text-left text-xs text-[hsl(var(--foreground))] transition-colors",
|
|
2829
2835
|
active ? "border-[hsl(var(--input))] bg-[hsl(var(--muted))] font-bold" : "border-transparent hover:border-[hsl(var(--input))]/60 hover:bg-[hsl(var(--muted))]/60",
|
|
2836
|
+
disabled && "!cursor-not-allowed opacity-60 hover:border-transparent hover:bg-transparent",
|
|
2830
2837
|
className
|
|
2831
2838
|
),
|
|
2832
2839
|
onClick,
|
|
@@ -3119,6 +3126,8 @@ function SidebarNavList({
|
|
|
3119
3126
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3120
3127
|
NavButton,
|
|
3121
3128
|
{
|
|
3129
|
+
active: item.id === resolvedActiveItemId,
|
|
3130
|
+
disabled: item.disabled,
|
|
3122
3131
|
icon: item.icon,
|
|
3123
3132
|
onClick: () => toggle(item.id),
|
|
3124
3133
|
postfix: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-1 justify-end", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -3143,10 +3152,11 @@ function SidebarNavList({
|
|
|
3143
3152
|
children: item.label
|
|
3144
3153
|
}
|
|
3145
3154
|
),
|
|
3146
|
-
isExpanded && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-col gap-1 mt-1", children: item.children.map((child) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
3155
|
+
isExpanded && !item.disabled && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-col gap-1 mt-1", children: item.children.map((child) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
3147
3156
|
NavButton,
|
|
3148
3157
|
{
|
|
3149
3158
|
active: child.id === resolvedActiveItemId,
|
|
3159
|
+
disabled: child.disabled,
|
|
3150
3160
|
onClick: () => {
|
|
3151
3161
|
setLocalActiveItemId(child.id);
|
|
3152
3162
|
onNavigate?.(child.id);
|
|
@@ -3162,6 +3172,7 @@ function SidebarNavList({
|
|
|
3162
3172
|
{
|
|
3163
3173
|
icon: item.icon,
|
|
3164
3174
|
active: item.id === resolvedActiveItemId,
|
|
3175
|
+
disabled: item.disabled,
|
|
3165
3176
|
onClick: () => {
|
|
3166
3177
|
setLocalActiveItemId(item.id);
|
|
3167
3178
|
onNavigate?.(item.id);
|
|
@@ -3411,6 +3422,10 @@ function SidebarNavigationList({
|
|
|
3411
3422
|
const [expandedByRoot, setExpandedByRoot] = react.useState(
|
|
3412
3423
|
{}
|
|
3413
3424
|
);
|
|
3425
|
+
const canRevealRequestedRoot = revealRequest ? items.some(
|
|
3426
|
+
(item) => item.id === revealRequest.id && !item.disabled
|
|
3427
|
+
) : false;
|
|
3428
|
+
const activeRootId = findNavigationRootId(items, activeItemId);
|
|
3414
3429
|
const toggleRoot = (id) => {
|
|
3415
3430
|
setExpandedByRoot((current) => ({
|
|
3416
3431
|
...current,
|
|
@@ -3418,7 +3433,7 @@ function SidebarNavigationList({
|
|
|
3418
3433
|
}));
|
|
3419
3434
|
};
|
|
3420
3435
|
react.useEffect(() => {
|
|
3421
|
-
if (!revealRequest) return;
|
|
3436
|
+
if (!revealRequest || !canRevealRequestedRoot) return;
|
|
3422
3437
|
setExpandedByRoot((current) => ({
|
|
3423
3438
|
...current,
|
|
3424
3439
|
[revealRequest.id]: true
|
|
@@ -3436,7 +3451,7 @@ function SidebarNavigationList({
|
|
|
3436
3451
|
}
|
|
3437
3452
|
});
|
|
3438
3453
|
return () => window.cancelAnimationFrame(frameId);
|
|
3439
|
-
}, [revealRequest]);
|
|
3454
|
+
}, [canRevealRequestedRoot, revealRequest]);
|
|
3440
3455
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
3441
3456
|
"div",
|
|
3442
3457
|
{
|
|
@@ -3451,13 +3466,15 @@ function SidebarNavigationList({
|
|
|
3451
3466
|
className: "monkeys-navigation-sidebar-nav flex w-full flex-col gap-2 text-xs text-[hsl(var(--foreground))]",
|
|
3452
3467
|
children: items.map((item) => {
|
|
3453
3468
|
const isGroup = Boolean(item.children?.length);
|
|
3454
|
-
const isExpanded = Boolean(expandedByRoot[item.id]);
|
|
3455
|
-
const isActive =
|
|
3469
|
+
const isExpanded = !item.disabled && Boolean(expandedByRoot[item.id]);
|
|
3470
|
+
const isActive = activeRootId === item.id;
|
|
3456
3471
|
if (isGroup) {
|
|
3457
3472
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-navigation-sidebar-root-id": item.id, children: [
|
|
3458
3473
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3459
3474
|
NavButton,
|
|
3460
3475
|
{
|
|
3476
|
+
active: isActive,
|
|
3477
|
+
disabled: item.disabled,
|
|
3461
3478
|
icon: item.icon,
|
|
3462
3479
|
onClick: () => toggleRoot(item.id),
|
|
3463
3480
|
postfix: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-1 justify-end", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -3486,6 +3503,7 @@ function SidebarNavigationList({
|
|
|
3486
3503
|
NavButton,
|
|
3487
3504
|
{
|
|
3488
3505
|
active: activeItemId === child.id,
|
|
3506
|
+
disabled: child.disabled,
|
|
3489
3507
|
onClick: () => onNavigate?.(child.id),
|
|
3490
3508
|
children: child.label
|
|
3491
3509
|
},
|
|
@@ -3497,6 +3515,7 @@ function SidebarNavigationList({
|
|
|
3497
3515
|
NavButton,
|
|
3498
3516
|
{
|
|
3499
3517
|
active: isActive,
|
|
3518
|
+
disabled: item.disabled,
|
|
3500
3519
|
icon: item.icon,
|
|
3501
3520
|
onClick: () => onNavigate?.(item.id),
|
|
3502
3521
|
children: item.label
|
|
@@ -3612,9 +3631,11 @@ function Sidebar({
|
|
|
3612
3631
|
appearance: NAVIGATION_LAYOUT_DEFAULT_APPEARANCE,
|
|
3613
3632
|
tone: "muted",
|
|
3614
3633
|
active: isActive,
|
|
3634
|
+
disabled: item.disabled,
|
|
3615
3635
|
iconOnly: true,
|
|
3616
3636
|
icon: item.icon,
|
|
3617
3637
|
onClick: () => {
|
|
3638
|
+
if (item.disabled) return;
|
|
3618
3639
|
onRevealRoot?.(item.id);
|
|
3619
3640
|
onCollapsedChange?.(false);
|
|
3620
3641
|
if (item.children?.length) return;
|
|
@@ -3691,6 +3712,7 @@ function HeadbarNavMenuItem({
|
|
|
3691
3712
|
useTokenRadius
|
|
3692
3713
|
}) {
|
|
3693
3714
|
const [open, setOpen] = react.useState(false);
|
|
3715
|
+
const menuOpen = !item.disabled && open;
|
|
3694
3716
|
const closeTimerRef = react.useRef(null);
|
|
3695
3717
|
const wasOpenOnPointerDownRef = react.useRef(false);
|
|
3696
3718
|
const clearCloseTimer = () => {
|
|
@@ -3699,6 +3721,7 @@ function HeadbarNavMenuItem({
|
|
|
3699
3721
|
closeTimerRef.current = null;
|
|
3700
3722
|
};
|
|
3701
3723
|
const openMenu = () => {
|
|
3724
|
+
if (item.disabled) return;
|
|
3702
3725
|
clearCloseTimer();
|
|
3703
3726
|
setOpen(true);
|
|
3704
3727
|
};
|
|
@@ -3710,6 +3733,7 @@ function HeadbarNavMenuItem({
|
|
|
3710
3733
|
}, 120);
|
|
3711
3734
|
};
|
|
3712
3735
|
const navigateToFirstEnabledChild = () => {
|
|
3736
|
+
if (item.disabled) return false;
|
|
3713
3737
|
const firstEnabledChild = item.children?.find((child) => !child.disabled);
|
|
3714
3738
|
if (!firstEnabledChild) return false;
|
|
3715
3739
|
setOpen(false);
|
|
@@ -3717,98 +3741,113 @@ function HeadbarNavMenuItem({
|
|
|
3717
3741
|
return true;
|
|
3718
3742
|
};
|
|
3719
3743
|
react.useEffect(() => clearCloseTimer, []);
|
|
3720
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
3721
|
-
|
|
3722
|
-
|
|
3723
|
-
|
|
3724
|
-
|
|
3725
|
-
|
|
3726
|
-
|
|
3727
|
-
|
|
3728
|
-
|
|
3729
|
-
label: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate whitespace-nowrap", children: label }),
|
|
3730
|
-
disabled: item.disabled,
|
|
3731
|
-
onClick: () => {
|
|
3732
|
-
const wasOpenOnPointerDown = wasOpenOnPointerDownRef.current;
|
|
3733
|
-
wasOpenOnPointerDownRef.current = false;
|
|
3734
|
-
if (wasOpenOnPointerDown && navigateToFirstEnabledChild()) return;
|
|
3735
|
-
setOpen(true);
|
|
3736
|
-
},
|
|
3737
|
-
onPointerDown: () => {
|
|
3738
|
-
wasOpenOnPointerDownRef.current = open;
|
|
3739
|
-
},
|
|
3740
|
-
onPointerCancel: () => {
|
|
3741
|
-
wasOpenOnPointerDownRef.current = false;
|
|
3742
|
-
},
|
|
3743
|
-
onKeyDown: (event) => {
|
|
3744
|
-
if (!open || event.key !== "Enter" && event.key !== " ") return;
|
|
3745
|
-
if (navigateToFirstEnabledChild()) event.preventDefault();
|
|
3746
|
-
},
|
|
3747
|
-
onMouseEnter: openMenu,
|
|
3748
|
-
onMouseLeave: scheduleCloseMenu,
|
|
3749
|
-
style: getHeadbarItemStyle(
|
|
3750
|
-
isActive || open,
|
|
3751
|
-
compound ? false : useTokenRadius
|
|
3752
|
-
),
|
|
3753
|
-
classNames: {
|
|
3754
|
-
icon: "text-[inherit] [&_*]:!text-[inherit] [&_svg]:!stroke-current",
|
|
3755
|
-
label: "text-[inherit] [&_*]:!text-[inherit]"
|
|
3756
|
-
},
|
|
3757
|
-
className: cn2(
|
|
3758
|
-
"max-w-[12rem] shrink-0 border shadow-none",
|
|
3759
|
-
compound && "!rounded-none !border-0 !bg-transparent",
|
|
3760
|
-
menuButtonRadiusClass,
|
|
3761
|
-
isActive || open ? "" : "hover:!bg-[var(--monkeys-component-navigation-headbar-item-hover-background,hsl(var(--muted)))] hover:!text-[var(--monkeys-component-navigation-headbar-item-hover-foreground,hsl(var(--foreground)))]"
|
|
3762
|
-
)
|
|
3763
|
-
}
|
|
3764
|
-
) }),
|
|
3765
|
-
/* @__PURE__ */ jsxRuntime.jsx(DropdownMenu__namespace.Portal, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3766
|
-
DropdownMenu__namespace.Content,
|
|
3767
|
-
{
|
|
3768
|
-
align: "start",
|
|
3769
|
-
sideOffset: 5,
|
|
3770
|
-
onCloseAutoFocus: (event) => event.preventDefault(),
|
|
3771
|
-
onMouseEnter: openMenu,
|
|
3772
|
-
onMouseLeave: scheduleCloseMenu,
|
|
3773
|
-
className: cn2(
|
|
3774
|
-
"z-50 min-w-56 border p-1.5 animate-in fade-in-0 zoom-in-95",
|
|
3775
|
-
menuContentRadiusClass
|
|
3776
|
-
),
|
|
3777
|
-
style: {
|
|
3778
|
-
background: "var(--monkeys-component-navigation-headbar-menu-background, hsl(var(--popover)))",
|
|
3779
|
-
borderColor: "var(--monkeys-component-navigation-headbar-menu-border-color, hsl(var(--border)))",
|
|
3780
|
-
color: "var(--monkeys-component-navigation-headbar-menu-foreground, hsl(var(--popover-foreground)))",
|
|
3781
|
-
boxShadow: "var(--monkeys-component-navigation-headbar-menu-shadow, 0 10px 15px -3px rgb(0 0 0 / 0.1))",
|
|
3782
|
-
backdropFilter: "blur(var(--monkeys-component-navigation-headbar-menu-backdrop-blur, 0px))"
|
|
3783
|
-
},
|
|
3784
|
-
children: item.children?.map((child) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
3785
|
-
DropdownMenu__namespace.Item,
|
|
3744
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
3745
|
+
DropdownMenu__namespace.Root,
|
|
3746
|
+
{
|
|
3747
|
+
modal: false,
|
|
3748
|
+
open: menuOpen,
|
|
3749
|
+
onOpenChange: (nextOpen) => setOpen(item.disabled ? false : nextOpen),
|
|
3750
|
+
children: [
|
|
3751
|
+
/* @__PURE__ */ jsxRuntime.jsx(DropdownMenu__namespace.Trigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3752
|
+
BaseButton,
|
|
3786
3753
|
{
|
|
3787
|
-
|
|
3788
|
-
|
|
3789
|
-
|
|
3790
|
-
|
|
3791
|
-
),
|
|
3754
|
+
appearance: NAVIGATION_LAYOUT_DEFAULT_APPEARANCE,
|
|
3755
|
+
tone: "muted",
|
|
3756
|
+
active: isActive || menuOpen,
|
|
3757
|
+
icon: item.icon,
|
|
3758
|
+
endIcon: /* @__PURE__ */ jsxRuntime.jsx(HeadbarChevronIcon, { open: menuOpen }),
|
|
3759
|
+
label: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate whitespace-nowrap", children: label }),
|
|
3760
|
+
disabled: item.disabled,
|
|
3761
|
+
onClick: () => {
|
|
3762
|
+
if (item.disabled) return;
|
|
3763
|
+
const wasOpenOnPointerDown = wasOpenOnPointerDownRef.current;
|
|
3764
|
+
wasOpenOnPointerDownRef.current = false;
|
|
3765
|
+
if (wasOpenOnPointerDown && navigateToFirstEnabledChild()) return;
|
|
3766
|
+
setOpen(true);
|
|
3767
|
+
},
|
|
3768
|
+
onPointerDown: () => {
|
|
3769
|
+
if (item.disabled) return;
|
|
3770
|
+
wasOpenOnPointerDownRef.current = menuOpen;
|
|
3771
|
+
},
|
|
3772
|
+
onPointerCancel: () => {
|
|
3773
|
+
wasOpenOnPointerDownRef.current = false;
|
|
3774
|
+
},
|
|
3775
|
+
onKeyDown: (event) => {
|
|
3776
|
+
if (item.disabled || !menuOpen || event.key !== "Enter" && event.key !== " ")
|
|
3777
|
+
return;
|
|
3778
|
+
if (navigateToFirstEnabledChild()) event.preventDefault();
|
|
3779
|
+
},
|
|
3780
|
+
onMouseEnter: openMenu,
|
|
3781
|
+
onMouseLeave: scheduleCloseMenu,
|
|
3792
3782
|
style: getHeadbarItemStyle(
|
|
3793
|
-
|
|
3794
|
-
useTokenRadius
|
|
3783
|
+
isActive || menuOpen,
|
|
3784
|
+
compound ? false : useTokenRadius
|
|
3795
3785
|
),
|
|
3796
|
-
|
|
3797
|
-
|
|
3798
|
-
|
|
3799
|
-
onNavigate?.(child.id);
|
|
3786
|
+
classNames: {
|
|
3787
|
+
icon: "text-[inherit] [&_*]:!text-[inherit] [&_svg]:!stroke-current",
|
|
3788
|
+
label: "text-[inherit] [&_*]:!text-[inherit]"
|
|
3800
3789
|
},
|
|
3801
|
-
|
|
3802
|
-
|
|
3803
|
-
|
|
3804
|
-
|
|
3805
|
-
|
|
3806
|
-
|
|
3807
|
-
|
|
3808
|
-
))
|
|
3809
|
-
|
|
3810
|
-
|
|
3811
|
-
|
|
3790
|
+
className: cn2(
|
|
3791
|
+
"max-w-[12rem] shrink-0 border shadow-none",
|
|
3792
|
+
compound && "!rounded-none !border-0 !bg-transparent",
|
|
3793
|
+
menuButtonRadiusClass,
|
|
3794
|
+
isActive || menuOpen ? "" : "hover:!bg-[var(--monkeys-component-navigation-headbar-item-hover-background,hsl(var(--muted)))] hover:!text-[var(--monkeys-component-navigation-headbar-item-hover-foreground,hsl(var(--foreground)))]"
|
|
3795
|
+
)
|
|
3796
|
+
}
|
|
3797
|
+
) }),
|
|
3798
|
+
/* @__PURE__ */ jsxRuntime.jsx(DropdownMenu__namespace.Portal, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3799
|
+
DropdownMenu__namespace.Content,
|
|
3800
|
+
{
|
|
3801
|
+
align: "start",
|
|
3802
|
+
sideOffset: 5,
|
|
3803
|
+
onCloseAutoFocus: (event) => event.preventDefault(),
|
|
3804
|
+
onMouseEnter: openMenu,
|
|
3805
|
+
onMouseLeave: scheduleCloseMenu,
|
|
3806
|
+
className: cn2(
|
|
3807
|
+
"z-50 min-w-56 border p-1.5 animate-in fade-in-0 zoom-in-95",
|
|
3808
|
+
menuContentRadiusClass
|
|
3809
|
+
),
|
|
3810
|
+
style: {
|
|
3811
|
+
background: "var(--monkeys-component-navigation-headbar-menu-background, hsl(var(--popover)))",
|
|
3812
|
+
borderColor: "var(--monkeys-component-navigation-headbar-menu-border-color, hsl(var(--border)))",
|
|
3813
|
+
color: "var(--monkeys-component-navigation-headbar-menu-foreground, hsl(var(--popover-foreground)))",
|
|
3814
|
+
boxShadow: "var(--monkeys-component-navigation-headbar-menu-shadow, 0 10px 15px -3px rgb(0 0 0 / 0.1))",
|
|
3815
|
+
backdropFilter: "blur(var(--monkeys-component-navigation-headbar-menu-backdrop-blur, 0px))"
|
|
3816
|
+
},
|
|
3817
|
+
children: item.children?.map((child) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
3818
|
+
DropdownMenu__namespace.Item,
|
|
3819
|
+
{
|
|
3820
|
+
disabled: child.disabled,
|
|
3821
|
+
className: cn2(
|
|
3822
|
+
"relative flex 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)))]",
|
|
3823
|
+
menuItemRadiusClass
|
|
3824
|
+
),
|
|
3825
|
+
style: getHeadbarItemStyle(
|
|
3826
|
+
child.id === activeItemId,
|
|
3827
|
+
useTokenRadius
|
|
3828
|
+
),
|
|
3829
|
+
onSelect: () => {
|
|
3830
|
+
if (child.disabled) return;
|
|
3831
|
+
setOpen(false);
|
|
3832
|
+
onNavigate?.(child.id);
|
|
3833
|
+
},
|
|
3834
|
+
children: [
|
|
3835
|
+
child.icon ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "inline-flex h-4 w-4 shrink-0 items-center justify-center text-[hsl(var(--muted-foreground))]", children: child.icon }) : null,
|
|
3836
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "min-w-0 truncate", children: child.headbarLabel ?? child.label }),
|
|
3837
|
+
child.trailing
|
|
3838
|
+
]
|
|
3839
|
+
},
|
|
3840
|
+
child.id
|
|
3841
|
+
))
|
|
3842
|
+
}
|
|
3843
|
+
) })
|
|
3844
|
+
]
|
|
3845
|
+
}
|
|
3846
|
+
);
|
|
3847
|
+
}
|
|
3848
|
+
function preventDisabledNavigationInteraction(event) {
|
|
3849
|
+
event.preventDefault();
|
|
3850
|
+
event.stopPropagation();
|
|
3812
3851
|
}
|
|
3813
3852
|
function NavigationHeadbarMenu({
|
|
3814
3853
|
activeItemId,
|
|
@@ -3875,10 +3914,13 @@ function NavigationHeadbarMenu({
|
|
|
3875
3914
|
"div",
|
|
3876
3915
|
{
|
|
3877
3916
|
"data-navigation-headbar-compound-item": item.id,
|
|
3917
|
+
"data-disabled": item.disabled || void 0,
|
|
3918
|
+
"aria-disabled": item.disabled || void 0,
|
|
3878
3919
|
className: cn2(
|
|
3879
3920
|
"inline-flex min-w-0 shrink-0 items-center gap-0 overflow-hidden border shadow-none",
|
|
3880
3921
|
menuButtonRadiusClass,
|
|
3881
|
-
isActive ? "" : "hover:!bg-[var(--monkeys-component-navigation-headbar-item-hover-background,hsl(var(--muted)))] hover:!text-[var(--monkeys-component-navigation-headbar-item-hover-foreground,hsl(var(--foreground)))]"
|
|
3922
|
+
isActive ? "" : "hover:!bg-[var(--monkeys-component-navigation-headbar-item-hover-background,hsl(var(--muted)))] hover:!text-[var(--monkeys-component-navigation-headbar-item-hover-foreground,hsl(var(--foreground)))]",
|
|
3923
|
+
item.disabled && "!cursor-not-allowed"
|
|
3882
3924
|
),
|
|
3883
3925
|
style: getHeadbarCompoundStyle(isActive, useTokenRadius),
|
|
3884
3926
|
children: [
|
|
@@ -3894,7 +3936,16 @@ function NavigationHeadbarMenu({
|
|
|
3894
3936
|
"span",
|
|
3895
3937
|
{
|
|
3896
3938
|
"data-navigation-headbar-secondary-action": item.id,
|
|
3897
|
-
|
|
3939
|
+
"aria-disabled": item.disabled || void 0,
|
|
3940
|
+
...item.disabled ? { inert: "" } : {},
|
|
3941
|
+
onClickCapture: item.disabled ? preventDisabledNavigationInteraction : void 0,
|
|
3942
|
+
onKeyDownCapture: item.disabled ? preventDisabledNavigationInteraction : void 0,
|
|
3943
|
+
onKeyUpCapture: item.disabled ? preventDisabledNavigationInteraction : void 0,
|
|
3944
|
+
onPointerDownCapture: item.disabled ? preventDisabledNavigationInteraction : void 0,
|
|
3945
|
+
className: cn2(
|
|
3946
|
+
"inline-flex min-w-0 shrink-0 items-center",
|
|
3947
|
+
item.disabled && "!cursor-not-allowed opacity-60"
|
|
3948
|
+
),
|
|
3898
3949
|
children: item.headbarSecondaryAction
|
|
3899
3950
|
}
|
|
3900
3951
|
)
|