@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.
@@ -236,6 +236,9 @@ interface NavigationLayoutProps {
236
236
  className?: string;
237
237
  collapsedSidebarAccountMenu?: ReactNode;
238
238
  collapsedSidebarWidth?: string;
239
+ contextualSidebar?: boolean;
240
+ contextualSidebarHeader?: ReactNode;
241
+ contextualSidebarWidth?: string;
239
242
  defaultMode?: NavigationMode;
240
243
  defaultSidebarCollapsed?: boolean;
241
244
  expandedSidebarWidth?: string;
@@ -281,5 +284,5 @@ interface NavigationHeadbarProps {
281
284
  onNavigate?: (itemId: string) => void;
282
285
  }
283
286
  declare function NavigationHeadbar({ activeItemId, activeRootId, actions, accountMenu, className, extra, layout, brand, logo, navigation, navItems, onNavigate, }: NavigationHeadbarProps): react_jsx_runtime.JSX.Element;
284
- declare function NavigationLayout({ activeItemId, activeRootId, allowModeSwitch, accountMenu, children, className, collapsedSidebarAccountMenu, collapsedSidebarWidth, defaultMode, defaultSidebarCollapsed, expandedSidebarWidth, expandSidebarLabel, flush, headbarActions, headbarLayout, logo, mode, navItems, onModeChange, onNavigate, onSidebarCollapsedChange, renderHeadbarExtra, collapseSidebarLabel, sidebarCollapsed: controlledSidebarCollapsed, sidebarAccountMenu, sidebarFooter, sidebarHeader, switchToHeadbarLabel, switchToSidebarLabel, }: NavigationLayoutProps): react_jsx_runtime.JSX.Element;
287
+ declare function NavigationLayout({ activeItemId, activeRootId, allowModeSwitch, accountMenu, children, className, collapsedSidebarAccountMenu, collapsedSidebarWidth, contextualSidebar, contextualSidebarHeader, contextualSidebarWidth, defaultMode, defaultSidebarCollapsed, expandedSidebarWidth, expandSidebarLabel, flush, headbarActions, headbarLayout, logo, mode, navItems, onModeChange, onNavigate, onSidebarCollapsedChange, renderHeadbarExtra, collapseSidebarLabel, sidebarCollapsed: controlledSidebarCollapsed, sidebarAccountMenu, sidebarFooter, sidebarHeader, switchToHeadbarLabel, switchToSidebarLabel, }: NavigationLayoutProps): react_jsx_runtime.JSX.Element;
285
288
  export { AppHeader, type AppHeaderLogo, type AppHeaderProps, type AppHeaderUser, AppLayout, type AppLayoutProps, AppShellSidebar, type AppShellSidebarClassNames, type AppShellSidebarProps, AppSidebar, type AppSidebarProps, type HeadbarLayout, type HeadbarLayoutMode, type HeadbarMenuRadius, type HeadbarNavPosition, type HeadbarSurface, type HeaderTab, type LayoutNavItem, NavButton, type NavButtonProps, NavigationHeadbar, NavigationHeadbarMenu, type NavigationHeadbarMenuProps, type NavigationHeadbarProps, NavigationLayout, type NavigationLayoutProps, type NavigationMode, type SidebarAccount, type SidebarNavItem, UserAccountMenu, type UserAccountMenuClassNames, type UserAccountMenuItem, type UserAccountMenuProps, type UserAccountMenuRadius, type UserAccountMenuSelectorConfig, type UserAccountMenuSelectorOption, type UserAccountMenuSide, type UserAccountMenuTriggerVariant, type UserAccountMenuUser, cn };
@@ -236,6 +236,9 @@ interface NavigationLayoutProps {
236
236
  className?: string;
237
237
  collapsedSidebarAccountMenu?: ReactNode;
238
238
  collapsedSidebarWidth?: string;
239
+ contextualSidebar?: boolean;
240
+ contextualSidebarHeader?: ReactNode;
241
+ contextualSidebarWidth?: string;
239
242
  defaultMode?: NavigationMode;
240
243
  defaultSidebarCollapsed?: boolean;
241
244
  expandedSidebarWidth?: string;
@@ -281,5 +284,5 @@ interface NavigationHeadbarProps {
281
284
  onNavigate?: (itemId: string) => void;
282
285
  }
283
286
  declare function NavigationHeadbar({ activeItemId, activeRootId, actions, accountMenu, className, extra, layout, brand, logo, navigation, navItems, onNavigate, }: NavigationHeadbarProps): react_jsx_runtime.JSX.Element;
284
- declare function NavigationLayout({ activeItemId, activeRootId, allowModeSwitch, accountMenu, children, className, collapsedSidebarAccountMenu, collapsedSidebarWidth, defaultMode, defaultSidebarCollapsed, expandedSidebarWidth, expandSidebarLabel, flush, headbarActions, headbarLayout, logo, mode, navItems, onModeChange, onNavigate, onSidebarCollapsedChange, renderHeadbarExtra, collapseSidebarLabel, sidebarCollapsed: controlledSidebarCollapsed, sidebarAccountMenu, sidebarFooter, sidebarHeader, switchToHeadbarLabel, switchToSidebarLabel, }: NavigationLayoutProps): react_jsx_runtime.JSX.Element;
287
+ declare function NavigationLayout({ activeItemId, activeRootId, allowModeSwitch, accountMenu, children, className, collapsedSidebarAccountMenu, collapsedSidebarWidth, contextualSidebar, contextualSidebarHeader, contextualSidebarWidth, defaultMode, defaultSidebarCollapsed, expandedSidebarWidth, expandSidebarLabel, flush, headbarActions, headbarLayout, logo, mode, navItems, onModeChange, onNavigate, onSidebarCollapsedChange, renderHeadbarExtra, collapseSidebarLabel, sidebarCollapsed: controlledSidebarCollapsed, sidebarAccountMenu, sidebarFooter, sidebarHeader, switchToHeadbarLabel, switchToSidebarLabel, }: NavigationLayoutProps): react_jsx_runtime.JSX.Element;
285
288
  export { AppHeader, type AppHeaderLogo, type AppHeaderProps, type AppHeaderUser, AppLayout, type AppLayoutProps, AppShellSidebar, type AppShellSidebarClassNames, type AppShellSidebarProps, AppSidebar, type AppSidebarProps, type HeadbarLayout, type HeadbarLayoutMode, type HeadbarMenuRadius, type HeadbarNavPosition, type HeadbarSurface, type HeaderTab, type LayoutNavItem, NavButton, type NavButtonProps, NavigationHeadbar, NavigationHeadbarMenu, type NavigationHeadbarMenuProps, type NavigationHeadbarProps, NavigationLayout, type NavigationLayoutProps, type NavigationMode, type SidebarAccount, type SidebarNavItem, UserAccountMenu, type UserAccountMenuClassNames, type UserAccountMenuItem, type UserAccountMenuProps, type UserAccountMenuRadius, type UserAccountMenuSelectorConfig, type UserAccountMenuSelectorOption, type UserAccountMenuSide, type UserAccountMenuTriggerVariant, type UserAccountMenuUser, cn };
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var react = require('react');
4
- var DropdownMenu = require('@radix-ui/react-dropdown-menu');
4
+ var DropdownMenu2 = require('@radix-ui/react-dropdown-menu');
5
5
  var tailwindMerge = require('tailwind-merge');
6
6
  var jsxRuntime = require('react/jsx-runtime');
7
7
  require('react-dom');
@@ -25,7 +25,7 @@ function _interopNamespace(e) {
25
25
  return Object.freeze(n);
26
26
  }
27
27
 
28
- var DropdownMenu__namespace = /*#__PURE__*/_interopNamespace(DropdownMenu);
28
+ var DropdownMenu2__namespace = /*#__PURE__*/_interopNamespace(DropdownMenu2);
29
29
  var Tooltip__namespace = /*#__PURE__*/_interopNamespace(Tooltip);
30
30
 
31
31
  // src/components/layout/index.tsx
@@ -2652,9 +2652,9 @@ function UserAccountMenuSelector({
2652
2652
  if (selector.visible === false || selector.options.length === 0) return null;
2653
2653
  const radiusClass = radiusClassNames[menuRadius];
2654
2654
  const currentLabel = getCurrentOptionLabel(selector);
2655
- return /* @__PURE__ */ jsxRuntime.jsxs(DropdownMenu__namespace.Sub, { children: [
2655
+ return /* @__PURE__ */ jsxRuntime.jsxs(DropdownMenu2__namespace.Sub, { children: [
2656
2656
  /* @__PURE__ */ jsxRuntime.jsxs(
2657
- DropdownMenu__namespace.SubTrigger,
2657
+ DropdownMenu2__namespace.SubTrigger,
2658
2658
  {
2659
2659
  disabled: selector.disabled,
2660
2660
  className: cn(
@@ -2669,8 +2669,8 @@ function UserAccountMenuSelector({
2669
2669
  ]
2670
2670
  }
2671
2671
  ),
2672
- /* @__PURE__ */ jsxRuntime.jsx(DropdownMenu__namespace.Portal, { children: /* @__PURE__ */ jsxRuntime.jsx(
2673
- DropdownMenu__namespace.SubContent,
2672
+ /* @__PURE__ */ jsxRuntime.jsx(DropdownMenu2__namespace.Portal, { children: /* @__PURE__ */ jsxRuntime.jsx(
2673
+ DropdownMenu2__namespace.SubContent,
2674
2674
  {
2675
2675
  sideOffset: 8,
2676
2676
  className: cn(
@@ -2679,8 +2679,8 @@ function UserAccountMenuSelector({
2679
2679
  selector.contentWidthClassName,
2680
2680
  classNames?.subContent
2681
2681
  ),
2682
- children: /* @__PURE__ */ jsxRuntime.jsx(DropdownMenu__namespace.RadioGroup, { value: selector.value, onValueChange: selector.onChange, children: selector.options.map((option) => /* @__PURE__ */ jsxRuntime.jsxs(
2683
- DropdownMenu__namespace.RadioItem,
2682
+ children: /* @__PURE__ */ jsxRuntime.jsx(DropdownMenu2__namespace.RadioGroup, { value: selector.value, onValueChange: selector.onChange, children: selector.options.map((option) => /* @__PURE__ */ jsxRuntime.jsxs(
2683
+ DropdownMenu2__namespace.RadioItem,
2684
2684
  {
2685
2685
  value: option.value,
2686
2686
  disabled: option.disabled,
@@ -2690,7 +2690,7 @@ function UserAccountMenuSelector({
2690
2690
  classNames?.item
2691
2691
  ),
2692
2692
  children: [
2693
- /* @__PURE__ */ jsxRuntime.jsx(DropdownMenu__namespace.ItemIndicator, { className: "absolute left-2 inline-flex h-4 w-4 items-center justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(CheckIcon, {}) }),
2693
+ /* @__PURE__ */ jsxRuntime.jsx(DropdownMenu2__namespace.ItemIndicator, { className: "absolute left-2 inline-flex h-4 w-4 items-center justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(CheckIcon, {}) }),
2694
2694
  renderIcon(option.icon, classNames?.itemIcon),
2695
2695
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "min-w-0 truncate", children: option.label })
2696
2696
  ]
@@ -2739,8 +2739,8 @@ function UserAccountMenu({
2739
2739
  }
2740
2740
  );
2741
2741
  const isProfileTrigger = triggerVariant === "profile";
2742
- return /* @__PURE__ */ jsxRuntime.jsxs(DropdownMenu__namespace.Root, { children: [
2743
- /* @__PURE__ */ jsxRuntime.jsx(DropdownMenu__namespace.Trigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(
2742
+ return /* @__PURE__ */ jsxRuntime.jsxs(DropdownMenu2__namespace.Root, { children: [
2743
+ /* @__PURE__ */ jsxRuntime.jsx(DropdownMenu2__namespace.Trigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(
2744
2744
  BaseButton,
2745
2745
  {
2746
2746
  appearance,
@@ -2766,8 +2766,8 @@ function UserAccountMenu({
2766
2766
  tone: "muted"
2767
2767
  }
2768
2768
  ) }),
2769
- /* @__PURE__ */ jsxRuntime.jsx(DropdownMenu__namespace.Portal, { children: /* @__PURE__ */ jsxRuntime.jsxs(
2770
- DropdownMenu__namespace.Content,
2769
+ /* @__PURE__ */ jsxRuntime.jsx(DropdownMenu2__namespace.Portal, { children: /* @__PURE__ */ jsxRuntime.jsxs(
2770
+ DropdownMenu2__namespace.Content,
2771
2771
  {
2772
2772
  align,
2773
2773
  side,
@@ -2779,7 +2779,7 @@ function UserAccountMenu({
2779
2779
  classNames?.content
2780
2780
  ),
2781
2781
  children: [
2782
- /* @__PURE__ */ jsxRuntime.jsx(DropdownMenu__namespace.Label, { className: cn("px-2 py-1.5 font-normal", classNames?.label), children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex min-w-0 items-center gap-2", children: [
2782
+ /* @__PURE__ */ jsxRuntime.jsx(DropdownMenu2__namespace.Label, { className: cn("px-2 py-1.5 font-normal", classNames?.label), children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex min-w-0 items-center gap-2", children: [
2783
2783
  avatar,
2784
2784
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex min-w-0 flex-col", children: [
2785
2785
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: cn("truncate text-sm font-medium leading-none", classNames?.userName), children: displayName }),
@@ -2796,7 +2796,7 @@ function UserAccountMenu({
2796
2796
  ] })
2797
2797
  ] }) }),
2798
2798
  hasMenuBody ? /* @__PURE__ */ jsxRuntime.jsx(
2799
- DropdownMenu__namespace.Separator,
2799
+ DropdownMenu2__namespace.Separator,
2800
2800
  {
2801
2801
  className: cn("my-1 h-px bg-[hsl(var(--border))]", classNames?.separator)
2802
2802
  }
@@ -2811,20 +2811,20 @@ function UserAccountMenu({
2811
2811
  selector.id ?? `selector-${index}`
2812
2812
  )),
2813
2813
  visibleSelectors.length > 0 && visibleItems.length > 0 ? /* @__PURE__ */ jsxRuntime.jsx(
2814
- DropdownMenu__namespace.Separator,
2814
+ DropdownMenu2__namespace.Separator,
2815
2815
  {
2816
2816
  className: cn("my-1 h-px bg-[hsl(var(--border))]", classNames?.separator)
2817
2817
  }
2818
2818
  ) : null,
2819
2819
  visibleItems.map((item) => /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
2820
2820
  item.separatorBefore ? /* @__PURE__ */ jsxRuntime.jsx(
2821
- DropdownMenu__namespace.Separator,
2821
+ DropdownMenu2__namespace.Separator,
2822
2822
  {
2823
2823
  className: cn("my-1 h-px bg-[hsl(var(--border))]", classNames?.separator)
2824
2824
  }
2825
2825
  ) : null,
2826
2826
  /* @__PURE__ */ jsxRuntime.jsxs(
2827
- DropdownMenu__namespace.Item,
2827
+ DropdownMenu2__namespace.Item,
2828
2828
  {
2829
2829
  disabled: item.disabled,
2830
2830
  onSelect: item.disabled ? void 0 : item.onSelect,
@@ -2948,8 +2948,8 @@ function AppHeader({
2948
2948
  (!tabs || tabs.length === 0) && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-1" }),
2949
2949
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex shrink-0 items-center gap-4", children: [
2950
2950
  extra,
2951
- user && /* @__PURE__ */ jsxRuntime.jsxs(DropdownMenu__namespace.Root, { children: [
2952
- /* @__PURE__ */ jsxRuntime.jsx(DropdownMenu__namespace.Trigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.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__ */ jsxRuntime.jsx(
2951
+ user && /* @__PURE__ */ jsxRuntime.jsxs(DropdownMenu2__namespace.Root, { children: [
2952
+ /* @__PURE__ */ jsxRuntime.jsx(DropdownMenu2__namespace.Trigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.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__ */ jsxRuntime.jsx(
2953
2953
  "img",
2954
2954
  {
2955
2955
  src: user.photo,
@@ -2957,14 +2957,14 @@ function AppHeader({
2957
2957
  className: "h-8 w-8 rounded-full object-cover"
2958
2958
  }
2959
2959
  ) : /* @__PURE__ */ jsxRuntime.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" }) }) }),
2960
- /* @__PURE__ */ jsxRuntime.jsx(DropdownMenu__namespace.Portal, { children: /* @__PURE__ */ jsxRuntime.jsxs(
2961
- DropdownMenu__namespace.Content,
2960
+ /* @__PURE__ */ jsxRuntime.jsx(DropdownMenu2__namespace.Portal, { children: /* @__PURE__ */ jsxRuntime.jsxs(
2961
+ DropdownMenu2__namespace.Content,
2962
2962
  {
2963
2963
  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",
2964
2964
  sideOffset: 5,
2965
2965
  align: "end",
2966
2966
  children: [
2967
- /* @__PURE__ */ jsxRuntime.jsxs(DropdownMenu__namespace.Label, { className: "flex items-center gap-2 px-2 py-1.5 font-normal", children: [
2967
+ /* @__PURE__ */ jsxRuntime.jsxs(DropdownMenu2__namespace.Label, { className: "flex items-center gap-2 px-2 py-1.5 font-normal", children: [
2968
2968
  user.photo ? /* @__PURE__ */ jsxRuntime.jsx(
2969
2969
  "img",
2970
2970
  {
@@ -2978,11 +2978,11 @@ function AppHeader({
2978
2978
  user.email && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-xs text-[hsl(var(--muted-foreground))] leading-none mt-1", children: user.email })
2979
2979
  ] })
2980
2980
  ] }),
2981
- /* @__PURE__ */ jsxRuntime.jsx(DropdownMenu__namespace.Separator, { className: "h-px bg-[hsl(var(--border))] my-1" }),
2982
- /* @__PURE__ */ jsxRuntime.jsxs(DropdownMenu__namespace.Group, { children: [
2981
+ /* @__PURE__ */ jsxRuntime.jsx(DropdownMenu2__namespace.Separator, { className: "h-px bg-[hsl(var(--border))] my-1" }),
2982
+ /* @__PURE__ */ jsxRuntime.jsxs(DropdownMenu2__namespace.Group, { children: [
2983
2983
  userMenuItems,
2984
2984
  /* @__PURE__ */ jsxRuntime.jsxs(
2985
- DropdownMenu__namespace.Item,
2985
+ DropdownMenu2__namespace.Item,
2986
2986
  {
2987
2987
  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))]",
2988
2988
  onSelect: () => onLogout?.(),
@@ -3259,6 +3259,7 @@ function AppLayout({
3259
3259
  }
3260
3260
  var NAVIGATION_LAYOUT_SIDEBAR_EXPANDED_WIDTH = "13.7rem";
3261
3261
  var NAVIGATION_LAYOUT_SIDEBAR_COLLAPSED_WIDTH = "4.25rem";
3262
+ var NAVIGATION_LAYOUT_CONTEXTUAL_SIDEBAR_WIDTH = "15rem";
3262
3263
  var NAVIGATION_LAYOUT_TRANSITION_TIMING = "cubic-bezier(0.22, 1, 0.36, 1)";
3263
3264
  var NAVIGATION_LAYOUT_HEADBAR_DEFAULT_HEIGHT_PX = 72;
3264
3265
  var NAVIGATION_LAYOUT_HEADBAR_MIN_HEIGHT_PX = 56;
@@ -3386,11 +3387,18 @@ function getHeadbarCompoundStyle(active, useTokenRadius = true) {
3386
3387
  function findNavigationRootId(items, activeItemId) {
3387
3388
  for (const item of items) {
3388
3389
  if (item.id === activeItemId) return item.id;
3389
- if (item.children?.some((child) => child.id === activeItemId))
3390
- return item.id;
3390
+ if (containsNavigationItem(item, activeItemId)) return item.id;
3391
3391
  }
3392
3392
  return activeItemId;
3393
3393
  }
3394
+ function containsNavigationItem(item, itemId) {
3395
+ if (!itemId) return false;
3396
+ if (item.id === itemId) return true;
3397
+ return item.children?.some((child) => containsNavigationItem(child, itemId)) ?? false;
3398
+ }
3399
+ function findActiveNavigationBranch(item, activeItemId) {
3400
+ return item.children?.find((child) => containsNavigationItem(child, activeItemId));
3401
+ }
3394
3402
  function getNavigationActionTitle(action) {
3395
3403
  return action.title || (typeof action.label === "string" ? action.label : void 0);
3396
3404
  }
@@ -3459,10 +3467,7 @@ function SidebarNavigationList({
3459
3467
  const [expandedByRoot, setExpandedByRoot] = react.useState(
3460
3468
  {}
3461
3469
  );
3462
- const canReveal = revealRequest ? items.some(
3463
- (item) => item.id === revealRequest.id && !item.disabled
3464
- ) : false;
3465
- const activeRootId = findNavigationRootId(items, activeItemId);
3470
+ const canReveal = revealRequest ? items.some((item) => containsNavigationItem(item, revealRequest.id) && !item.disabled) : false;
3466
3471
  const toggleRoot = (id) => {
3467
3472
  setExpandedByRoot((current) => ({
3468
3473
  ...current,
@@ -3471,13 +3476,10 @@ function SidebarNavigationList({
3471
3476
  };
3472
3477
  react.useEffect(() => {
3473
3478
  if (!revealRequest || !canReveal) return;
3474
- setExpandedByRoot((current) => ({
3475
- ...current,
3476
- [revealRequest.id]: true
3477
- }));
3479
+ setExpandedByRoot((current) => ({ ...current, [revealRequest.id]: true }));
3478
3480
  const frameId = window.requestAnimationFrame(() => {
3479
3481
  const targetElement = navRef.current?.querySelector(
3480
- `[data-navigation-sidebar-root-id="${CSS.escape(revealRequest.id)}"]`
3482
+ `[data-navigation-sidebar-item-id="${CSS.escape(revealRequest.id)}"]`
3481
3483
  );
3482
3484
  if (targetElement instanceof HTMLElement) {
3483
3485
  targetElement.scrollIntoView({
@@ -3489,6 +3491,34 @@ function SidebarNavigationList({
3489
3491
  });
3490
3492
  return () => window.cancelAnimationFrame(frameId);
3491
3493
  }, [canReveal, revealRequest]);
3494
+ const renderItems = (navigationItems, depth = 0) => navigationItems.map((item) => {
3495
+ const isGroup = Boolean(item.children?.length);
3496
+ const containsActiveItem = containsNavigationItem(item, activeItemId);
3497
+ const isExpanded = !item.disabled && (expandedByRoot[item.id] ?? containsActiveItem);
3498
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-navigation-sidebar-item-id": item.id, children: [
3499
+ /* @__PURE__ */ jsxRuntime.jsx(
3500
+ NavButton,
3501
+ {
3502
+ active: containsActiveItem,
3503
+ className: depth > 0 ? "pl-3" : void 0,
3504
+ disabled: item.disabled,
3505
+ icon: item.icon,
3506
+ onClick: () => isGroup ? toggleRoot(item.id) : onNavigate?.(item.id),
3507
+ postfix: isGroup ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-1 justify-end", children: /* @__PURE__ */ jsxRuntime.jsx(
3508
+ HeadbarChevronIcon,
3509
+ {
3510
+ open: false,
3511
+ sideways: true,
3512
+ className: "text-[hsl(var(--foreground))] transition-transform duration-200",
3513
+ style: { transform: isExpanded ? "rotate(90deg)" : "rotate(0deg)" }
3514
+ }
3515
+ ) }) : void 0,
3516
+ children: item.label
3517
+ }
3518
+ ),
3519
+ isGroup && isExpanded ? /* @__PURE__ */ jsxRuntime.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
3520
+ ] }, item.id);
3521
+ });
3492
3522
  return /* @__PURE__ */ jsxRuntime.jsxs(
3493
3523
  "div",
3494
3524
  {
@@ -3501,64 +3531,7 @@ function SidebarNavigationList({
3501
3531
  {
3502
3532
  ref: navRef,
3503
3533
  className: "monkeys-navigation-sidebar-nav flex w-full flex-col gap-2 text-xs text-[hsl(var(--foreground))]",
3504
- children: items.map((item) => {
3505
- const isGroup = Boolean(item.children?.length);
3506
- const isExpanded = !item.disabled && Boolean(expandedByRoot[item.id]);
3507
- const isActive = activeRootId === item.id;
3508
- if (isGroup) {
3509
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-navigation-sidebar-root-id": item.id, children: [
3510
- /* @__PURE__ */ jsxRuntime.jsx(
3511
- NavButton,
3512
- {
3513
- active: isActive,
3514
- disabled: item.disabled,
3515
- icon: item.icon,
3516
- onClick: () => toggleRoot(item.id),
3517
- postfix: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-1 justify-end", children: /* @__PURE__ */ jsxRuntime.jsx(
3518
- "svg",
3519
- {
3520
- xmlns: "http://www.w3.org/2000/svg",
3521
- width: "16",
3522
- height: "16",
3523
- viewBox: "0 0 24 24",
3524
- fill: "none",
3525
- stroke: "currentColor",
3526
- strokeWidth: "2",
3527
- strokeLinecap: "round",
3528
- strokeLinejoin: "round",
3529
- className: "shrink-0 text-[hsl(var(--foreground))] transition-transform duration-200",
3530
- style: {
3531
- transform: isExpanded ? "rotate(90deg)" : "rotate(0deg)"
3532
- },
3533
- children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "m9 18 6-6-6-6" })
3534
- }
3535
- ) }),
3536
- children: item.label
3537
- }
3538
- ),
3539
- isExpanded ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-1 flex flex-col gap-1", children: item.children?.map((child) => /* @__PURE__ */ jsxRuntime.jsx(
3540
- NavButton,
3541
- {
3542
- active: activeItemId === child.id,
3543
- disabled: child.disabled,
3544
- onClick: () => onNavigate?.(child.id),
3545
- children: child.label
3546
- },
3547
- child.id
3548
- )) }) : null
3549
- ] }, item.id);
3550
- }
3551
- return /* @__PURE__ */ jsxRuntime.jsx("div", { "data-navigation-sidebar-root-id": item.id, children: /* @__PURE__ */ jsxRuntime.jsx(
3552
- NavButton,
3553
- {
3554
- active: isActive,
3555
- disabled: item.disabled,
3556
- icon: item.icon,
3557
- onClick: () => onNavigate?.(item.id),
3558
- children: item.label
3559
- }
3560
- ) }, item.id);
3561
- })
3534
+ children: renderItems(items)
3562
3535
  }
3563
3536
  )
3564
3537
  ]
@@ -3717,22 +3690,30 @@ function Sidebar({
3717
3690
  ] })
3718
3691
  ] });
3719
3692
  }
3720
- function HeadbarChevronIcon({ open }) {
3693
+ function HeadbarChevronIcon({
3694
+ className,
3695
+ open,
3696
+ sideways = false,
3697
+ style
3698
+ }) {
3721
3699
  return /* @__PURE__ */ jsxRuntime.jsx(
3722
3700
  "svg",
3723
3701
  {
3724
3702
  "aria-hidden": "true",
3725
3703
  className: cn2(
3726
- "h-4 w-4 shrink-0 transition-transform duration-200",
3727
- open && "rotate-180"
3704
+ "h-4 w-4 shrink-0",
3705
+ !sideways && "transition-transform duration-200",
3706
+ !sideways && open && "rotate-180",
3707
+ className
3728
3708
  ),
3709
+ style,
3729
3710
  viewBox: "0 0 24 24",
3730
3711
  fill: "none",
3731
3712
  stroke: "currentColor",
3732
3713
  strokeWidth: "2",
3733
3714
  strokeLinecap: "round",
3734
3715
  strokeLinejoin: "round",
3735
- children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "m6 9 6 6 6-6" })
3716
+ children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: sideways ? "m9 18 6-6-6-6" : "m6 9 6 6 6-6" })
3736
3717
  }
3737
3718
  );
3738
3719
  }
@@ -3744,6 +3725,100 @@ function getHeadbarSummaryTitle(rootLabel, childLabel) {
3744
3725
  const childText = childLabel.trim();
3745
3726
  return rootText && childText ? `${rootText} ${childText}` : void 0;
3746
3727
  }
3728
+ 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)))]";
3729
+ var HEADBAR_DROPDOWN_CONTENT_STYLE = {
3730
+ width: "max-content",
3731
+ maxWidth: "min(20rem, var(--radix-dropdown-menu-content-available-width))",
3732
+ background: "var(--monkeys-component-navigation-headbar-menu-background, hsl(var(--popover)))",
3733
+ borderColor: "var(--monkeys-component-navigation-headbar-menu-border-color, hsl(var(--border)))",
3734
+ color: "var(--monkeys-component-navigation-headbar-menu-foreground, hsl(var(--popover-foreground)))",
3735
+ boxShadow: "var(--monkeys-component-navigation-headbar-menu-shadow, 0 10px 15px -3px rgb(0 0 0 / 0.1))"
3736
+ };
3737
+ function HeadbarDropdownItems({
3738
+ activeItemId,
3739
+ items,
3740
+ menuContentRadiusClass,
3741
+ menuItemRadiusClass,
3742
+ onNavigate,
3743
+ onNavigateComplete,
3744
+ useTokenRadius
3745
+ }) {
3746
+ return items.map((item) => {
3747
+ const label = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
3748
+ item.icon ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "inline-flex h-4 w-4 shrink-0 items-center justify-center text-[hsl(var(--muted-foreground))]", children: item.icon }) : null,
3749
+ /* @__PURE__ */ jsxRuntime.jsx(
3750
+ "span",
3751
+ {
3752
+ className: cn2(
3753
+ "min-w-0 truncate",
3754
+ Boolean(item.children?.length) && "flex-1"
3755
+ ),
3756
+ children: item.headbarLabel ?? item.label
3757
+ }
3758
+ )
3759
+ ] });
3760
+ if (item.children?.length) {
3761
+ return /* @__PURE__ */ jsxRuntime.jsxs(DropdownMenu2__namespace.Sub, { children: [
3762
+ /* @__PURE__ */ jsxRuntime.jsxs(
3763
+ DropdownMenu2__namespace.SubTrigger,
3764
+ {
3765
+ disabled: item.disabled,
3766
+ className: cn2(HEADBAR_DROPDOWN_ITEM_CLASS, menuItemRadiusClass),
3767
+ children: [
3768
+ label,
3769
+ /* @__PURE__ */ jsxRuntime.jsx(HeadbarChevronIcon, { open: false, sideways: true })
3770
+ ]
3771
+ }
3772
+ ),
3773
+ /* @__PURE__ */ jsxRuntime.jsx(DropdownMenu2__namespace.Portal, { children: /* @__PURE__ */ jsxRuntime.jsx(
3774
+ DropdownMenu2__namespace.SubContent,
3775
+ {
3776
+ sideOffset: 4,
3777
+ alignOffset: -6,
3778
+ className: cn2(
3779
+ "z-50 border p-1.5 animate-in fade-in-0 zoom-in-95",
3780
+ menuContentRadiusClass
3781
+ ),
3782
+ style: {
3783
+ ...HEADBAR_DROPDOWN_CONTENT_STYLE,
3784
+ minWidth: "12rem"
3785
+ },
3786
+ children: /* @__PURE__ */ jsxRuntime.jsx(
3787
+ HeadbarDropdownItems,
3788
+ {
3789
+ activeItemId,
3790
+ items: item.children,
3791
+ menuContentRadiusClass,
3792
+ menuItemRadiusClass,
3793
+ onNavigate,
3794
+ onNavigateComplete,
3795
+ useTokenRadius
3796
+ }
3797
+ )
3798
+ }
3799
+ ) })
3800
+ ] }, item.id);
3801
+ }
3802
+ return /* @__PURE__ */ jsxRuntime.jsxs(
3803
+ DropdownMenu2__namespace.Item,
3804
+ {
3805
+ disabled: item.disabled,
3806
+ className: cn2(HEADBAR_DROPDOWN_ITEM_CLASS, menuItemRadiusClass),
3807
+ style: getHeadbarItemStyle(item.id === activeItemId, useTokenRadius),
3808
+ onSelect: () => {
3809
+ if (item.disabled) return;
3810
+ onNavigateComplete();
3811
+ onNavigate?.(item.id);
3812
+ },
3813
+ children: [
3814
+ label,
3815
+ item.trailing
3816
+ ]
3817
+ },
3818
+ item.id
3819
+ );
3820
+ });
3821
+ }
3747
3822
  function HeadbarNavMenuItem({
3748
3823
  activeItemId,
3749
3824
  compound,
@@ -3787,13 +3862,13 @@ function HeadbarNavMenuItem({
3787
3862
  };
3788
3863
  react.useEffect(() => clearCloseTimer, []);
3789
3864
  return /* @__PURE__ */ jsxRuntime.jsxs(
3790
- DropdownMenu__namespace.Root,
3865
+ DropdownMenu2__namespace.Root,
3791
3866
  {
3792
3867
  modal: false,
3793
3868
  open: isOpen,
3794
3869
  onOpenChange: (nextOpen) => setOpen(!item.disabled && nextOpen),
3795
3870
  children: [
3796
- /* @__PURE__ */ jsxRuntime.jsx(DropdownMenu__namespace.Trigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(
3871
+ /* @__PURE__ */ jsxRuntime.jsx(DropdownMenu2__namespace.Trigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(
3797
3872
  BaseButton,
3798
3873
  {
3799
3874
  appearance: NAVIGATION_LAYOUT_DEFAULT_APPEARANCE,
@@ -3839,8 +3914,8 @@ function HeadbarNavMenuItem({
3839
3914
  )
3840
3915
  }
3841
3916
  ) }),
3842
- /* @__PURE__ */ jsxRuntime.jsx(DropdownMenu__namespace.Portal, { children: /* @__PURE__ */ jsxRuntime.jsx(
3843
- DropdownMenu__namespace.Content,
3917
+ /* @__PURE__ */ jsxRuntime.jsx(DropdownMenu2__namespace.Portal, { children: /* @__PURE__ */ jsxRuntime.jsx(
3918
+ DropdownMenu2__namespace.Content,
3844
3919
  {
3845
3920
  align: "start",
3846
3921
  sideOffset: 5,
@@ -3852,40 +3927,22 @@ function HeadbarNavMenuItem({
3852
3927
  menuContentRadiusClass
3853
3928
  ),
3854
3929
  style: {
3855
- width: "max-content",
3930
+ ...HEADBAR_DROPDOWN_CONTENT_STYLE,
3856
3931
  minWidth: "var(--radix-dropdown-menu-trigger-width)",
3857
- maxWidth: "min(20rem, var(--radix-dropdown-menu-content-available-width))",
3858
- background: "var(--monkeys-component-navigation-headbar-menu-background, hsl(var(--popover)))",
3859
- borderColor: "var(--monkeys-component-navigation-headbar-menu-border-color, hsl(var(--border)))",
3860
- color: "var(--monkeys-component-navigation-headbar-menu-foreground, hsl(var(--popover-foreground)))",
3861
- boxShadow: "var(--monkeys-component-navigation-headbar-menu-shadow, 0 10px 15px -3px rgb(0 0 0 / 0.1))",
3862
3932
  backdropFilter: "blur(var(--monkeys-component-navigation-headbar-menu-backdrop-blur, 0px))"
3863
3933
  },
3864
- children: item.children?.map((child) => /* @__PURE__ */ jsxRuntime.jsxs(
3865
- DropdownMenu__namespace.Item,
3934
+ children: /* @__PURE__ */ jsxRuntime.jsx(
3935
+ HeadbarDropdownItems,
3866
3936
  {
3867
- disabled: child.disabled,
3868
- className: cn2(
3869
- "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)))]",
3870
- menuItemRadiusClass
3871
- ),
3872
- style: getHeadbarItemStyle(
3873
- child.id === activeItemId,
3874
- useTokenRadius
3875
- ),
3876
- onSelect: () => {
3877
- if (child.disabled) return;
3878
- setOpen(false);
3879
- onNavigate?.(child.id);
3880
- },
3881
- children: [
3882
- 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,
3883
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "min-w-0 truncate", children: child.headbarLabel ?? child.label }),
3884
- child.trailing
3885
- ]
3886
- },
3887
- child.id
3888
- ))
3937
+ activeItemId,
3938
+ items: item.children ?? [],
3939
+ menuContentRadiusClass,
3940
+ menuItemRadiusClass,
3941
+ onNavigate,
3942
+ onNavigateComplete: () => setOpen(false),
3943
+ useTokenRadius
3944
+ }
3945
+ )
3889
3946
  }
3890
3947
  ) })
3891
3948
  ]
@@ -3911,9 +3968,7 @@ function NavigationHeadbarMenu({
3911
3968
  const isActive = activeRootId === item.id || activeItemId === item.id;
3912
3969
  const hasSecondaryAction = Boolean(item.headbarSecondaryAction);
3913
3970
  const rootLabel = item.headbarLabel ?? item.label;
3914
- const activeChild = item.children?.find(
3915
- (child) => child.id === activeItemId
3916
- );
3971
+ const activeChild = findActiveNavigationBranch(item, activeItemId);
3917
3972
  const activeChildLabel = activeChild ? activeChild.headbarLabel ?? activeChild.label : void 0;
3918
3973
  const label = activeChild ? /* @__PURE__ */ jsxRuntime.jsxs(
3919
3974
  "span",
@@ -4119,6 +4174,9 @@ function NavigationLayout({
4119
4174
  className,
4120
4175
  collapsedSidebarAccountMenu,
4121
4176
  collapsedSidebarWidth = NAVIGATION_LAYOUT_SIDEBAR_COLLAPSED_WIDTH,
4177
+ contextualSidebar = false,
4178
+ contextualSidebarHeader,
4179
+ contextualSidebarWidth = NAVIGATION_LAYOUT_CONTEXTUAL_SIDEBAR_WIDTH,
4122
4180
  defaultMode = "headbar",
4123
4181
  defaultSidebarCollapsed = false,
4124
4182
  expandedSidebarWidth = NAVIGATION_LAYOUT_SIDEBAR_EXPANDED_WIDTH,
@@ -4150,6 +4208,9 @@ function NavigationLayout({
4150
4208
  const sidebarCollapsed = isSidebarCollapsedControlled ? controlledSidebarCollapsed : uncontrolledSidebarCollapsed;
4151
4209
  const isHeadbarMode = navigationMode === "headbar";
4152
4210
  const sidebarWidth = sidebarCollapsed ? collapsedSidebarWidth : expandedSidebarWidth;
4211
+ const resolvedActiveRootId = activeRootId ?? findNavigationRootId(navItems, activeItemId);
4212
+ const activeRoot = navItems.find((item) => item.id === resolvedActiveRootId);
4213
+ const contextualItems = activeRoot?.children ?? [];
4153
4214
  react.useEffect(() => {
4154
4215
  if (!isModeControlled) {
4155
4216
  setUncontrolledMode(defaultMode);
@@ -4220,7 +4281,25 @@ function NavigationLayout({
4220
4281
  }
4221
4282
  )
4222
4283
  });
4223
- const sidebar = isHeadbarMode ? null : /* @__PURE__ */ jsxRuntime.jsx(
4284
+ const sidebar = isHeadbarMode && contextualSidebar && contextualItems.length ? /* @__PURE__ */ jsxRuntime.jsx(
4285
+ "aside",
4286
+ {
4287
+ className: "relative h-full min-h-0 shrink-0 overflow-hidden",
4288
+ "data-navigation-contextual-sidebar": resolvedActiveRootId,
4289
+ style: { width: contextualSidebarWidth },
4290
+ children: /* @__PURE__ */ jsxRuntime.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: [
4291
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "shrink-0 px-2 text-sm font-semibold text-[hsl(var(--foreground))]", children: contextualSidebarHeader ?? activeRoot?.label }),
4292
+ /* @__PURE__ */ jsxRuntime.jsx(
4293
+ SidebarNavigationList,
4294
+ {
4295
+ activeItemId,
4296
+ items: contextualItems,
4297
+ onNavigate
4298
+ }
4299
+ )
4300
+ ] })
4301
+ }
4302
+ ) : isHeadbarMode ? null : /* @__PURE__ */ jsxRuntime.jsx(
4224
4303
  "div",
4225
4304
  {
4226
4305
  className: cn2(
@@ -4259,7 +4338,7 @@ function NavigationLayout({
4259
4338
  NavigationHeadbar,
4260
4339
  {
4261
4340
  activeItemId,
4262
- activeRootId: activeRootId ?? findNavigationRootId(navItems, activeItemId),
4341
+ activeRootId: resolvedActiveRootId,
4263
4342
  actions: allowModeSwitch ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
4264
4343
  headbarActions,
4265
4344
  /* @__PURE__ */ jsxRuntime.jsx(