@inf-monkeys-tech/monkeys-design 1.0.36 → 1.0.37

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.
@@ -2766,7 +2766,7 @@ function UserAccountMenu({
2766
2766
  DropdownMenu.Item,
2767
2767
  {
2768
2768
  disabled: item.disabled,
2769
- onSelect: item.disabled ? void 0 : item.onSelect,
2769
+ onSelect: item.onSelect,
2770
2770
  className: cn(
2771
2771
  "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",
2772
2772
  radiusClass,
@@ -2792,7 +2792,6 @@ function cn2(...inputs) {
2792
2792
  }
2793
2793
  function NavButton({
2794
2794
  active,
2795
- disabled,
2796
2795
  icon,
2797
2796
  postfix,
2798
2797
  onClick,
@@ -2800,17 +2799,11 @@ function NavButton({
2800
2799
  children
2801
2800
  }) {
2802
2801
  return /* @__PURE__ */ jsxs(
2803
- "button",
2802
+ "div",
2804
2803
  {
2805
- type: "button",
2806
- "aria-disabled": disabled || void 0,
2807
- "aria-pressed": active || void 0,
2808
- "data-disabled": disabled || void 0,
2809
- disabled,
2810
2804
  className: cn2(
2811
- "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",
2805
+ "flex w-full cursor-pointer select-none items-center gap-2 rounded-xl border p-2 text-xs text-[hsl(var(--foreground))] transition-colors",
2812
2806
  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",
2813
- disabled && "!cursor-not-allowed opacity-60 hover:border-transparent hover:bg-transparent",
2814
2807
  className
2815
2808
  ),
2816
2809
  onClick,
@@ -3103,8 +3096,6 @@ function SidebarNavList({
3103
3096
  /* @__PURE__ */ jsx(
3104
3097
  NavButton,
3105
3098
  {
3106
- active: item.id === resolvedActiveItemId,
3107
- disabled: item.disabled,
3108
3099
  icon: item.icon,
3109
3100
  onClick: () => toggle(item.id),
3110
3101
  postfix: /* @__PURE__ */ jsx("div", { className: "flex flex-1 justify-end", children: /* @__PURE__ */ jsx(
@@ -3129,11 +3120,10 @@ function SidebarNavList({
3129
3120
  children: item.label
3130
3121
  }
3131
3122
  ),
3132
- isExpanded && !item.disabled && /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-1 mt-1", children: item.children.map((child) => /* @__PURE__ */ jsx(
3123
+ isExpanded && /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-1 mt-1", children: item.children.map((child) => /* @__PURE__ */ jsx(
3133
3124
  NavButton,
3134
3125
  {
3135
3126
  active: child.id === resolvedActiveItemId,
3136
- disabled: child.disabled,
3137
3127
  onClick: () => {
3138
3128
  setLocalActiveItemId(child.id);
3139
3129
  onNavigate?.(child.id);
@@ -3149,7 +3139,6 @@ function SidebarNavList({
3149
3139
  {
3150
3140
  icon: item.icon,
3151
3141
  active: item.id === resolvedActiveItemId,
3152
- disabled: item.disabled,
3153
3142
  onClick: () => {
3154
3143
  setLocalActiveItemId(item.id);
3155
3144
  onNavigate?.(item.id);
@@ -3399,10 +3388,6 @@ function SidebarNavigationList({
3399
3388
  const [expandedByRoot, setExpandedByRoot] = useState(
3400
3389
  {}
3401
3390
  );
3402
- const canRevealRequestedRoot = revealRequest ? items.some(
3403
- (item) => item.id === revealRequest.id && !item.disabled
3404
- ) : false;
3405
- const activeRootId = findNavigationRootId(items, activeItemId);
3406
3391
  const toggleRoot = (id) => {
3407
3392
  setExpandedByRoot((current) => ({
3408
3393
  ...current,
@@ -3410,7 +3395,7 @@ function SidebarNavigationList({
3410
3395
  }));
3411
3396
  };
3412
3397
  useEffect(() => {
3413
- if (!revealRequest || !canRevealRequestedRoot) return;
3398
+ if (!revealRequest) return;
3414
3399
  setExpandedByRoot((current) => ({
3415
3400
  ...current,
3416
3401
  [revealRequest.id]: true
@@ -3428,7 +3413,7 @@ function SidebarNavigationList({
3428
3413
  }
3429
3414
  });
3430
3415
  return () => window.cancelAnimationFrame(frameId);
3431
- }, [canRevealRequestedRoot, revealRequest]);
3416
+ }, [revealRequest]);
3432
3417
  return /* @__PURE__ */ jsxs(
3433
3418
  "div",
3434
3419
  {
@@ -3443,15 +3428,13 @@ function SidebarNavigationList({
3443
3428
  className: "monkeys-navigation-sidebar-nav flex w-full flex-col gap-2 text-xs text-[hsl(var(--foreground))]",
3444
3429
  children: items.map((item) => {
3445
3430
  const isGroup = Boolean(item.children?.length);
3446
- const isExpanded = !item.disabled && Boolean(expandedByRoot[item.id]);
3447
- const isActive = activeRootId === item.id;
3431
+ const isExpanded = Boolean(expandedByRoot[item.id]);
3432
+ const isActive = activeItemId === item.id;
3448
3433
  if (isGroup) {
3449
3434
  return /* @__PURE__ */ jsxs("div", { "data-navigation-sidebar-root-id": item.id, children: [
3450
3435
  /* @__PURE__ */ jsx(
3451
3436
  NavButton,
3452
3437
  {
3453
- active: isActive,
3454
- disabled: item.disabled,
3455
3438
  icon: item.icon,
3456
3439
  onClick: () => toggleRoot(item.id),
3457
3440
  postfix: /* @__PURE__ */ jsx("div", { className: "flex flex-1 justify-end", children: /* @__PURE__ */ jsx(
@@ -3480,7 +3463,6 @@ function SidebarNavigationList({
3480
3463
  NavButton,
3481
3464
  {
3482
3465
  active: activeItemId === child.id,
3483
- disabled: child.disabled,
3484
3466
  onClick: () => onNavigate?.(child.id),
3485
3467
  children: child.label
3486
3468
  },
@@ -3492,7 +3474,6 @@ function SidebarNavigationList({
3492
3474
  NavButton,
3493
3475
  {
3494
3476
  active: isActive,
3495
- disabled: item.disabled,
3496
3477
  icon: item.icon,
3497
3478
  onClick: () => onNavigate?.(item.id),
3498
3479
  children: item.label
@@ -3608,11 +3589,9 @@ function Sidebar({
3608
3589
  appearance: NAVIGATION_LAYOUT_DEFAULT_APPEARANCE,
3609
3590
  tone: "muted",
3610
3591
  active: isActive,
3611
- disabled: item.disabled,
3612
3592
  iconOnly: true,
3613
3593
  icon: item.icon,
3614
3594
  onClick: () => {
3615
- if (item.disabled) return;
3616
3595
  onRevealRoot?.(item.id);
3617
3596
  onCollapsedChange?.(false);
3618
3597
  if (item.children?.length) return;
@@ -3689,7 +3668,6 @@ function HeadbarNavMenuItem({
3689
3668
  useTokenRadius
3690
3669
  }) {
3691
3670
  const [open, setOpen] = useState(false);
3692
- const menuOpen = !item.disabled && open;
3693
3671
  const closeTimerRef = useRef(null);
3694
3672
  const wasOpenOnPointerDownRef = useRef(false);
3695
3673
  const clearCloseTimer = () => {
@@ -3698,7 +3676,6 @@ function HeadbarNavMenuItem({
3698
3676
  closeTimerRef.current = null;
3699
3677
  };
3700
3678
  const openMenu = () => {
3701
- if (item.disabled) return;
3702
3679
  clearCloseTimer();
3703
3680
  setOpen(true);
3704
3681
  };
@@ -3710,7 +3687,6 @@ function HeadbarNavMenuItem({
3710
3687
  }, 120);
3711
3688
  };
3712
3689
  const navigateToFirstEnabledChild = () => {
3713
- if (item.disabled) return false;
3714
3690
  const firstEnabledChild = item.children?.find((child) => !child.disabled);
3715
3691
  if (!firstEnabledChild) return false;
3716
3692
  setOpen(false);
@@ -3718,113 +3694,98 @@ function HeadbarNavMenuItem({
3718
3694
  return true;
3719
3695
  };
3720
3696
  useEffect(() => clearCloseTimer, []);
3721
- return /* @__PURE__ */ jsxs(
3722
- DropdownMenu.Root,
3723
- {
3724
- modal: false,
3725
- open: menuOpen,
3726
- onOpenChange: (nextOpen) => setOpen(item.disabled ? false : nextOpen),
3727
- children: [
3728
- /* @__PURE__ */ jsx(DropdownMenu.Trigger, { asChild: true, children: /* @__PURE__ */ jsx(
3729
- BaseButton,
3730
- {
3731
- appearance: NAVIGATION_LAYOUT_DEFAULT_APPEARANCE,
3732
- tone: "muted",
3733
- active: isActive || menuOpen,
3734
- icon: item.icon,
3735
- endIcon: /* @__PURE__ */ jsx(HeadbarChevronIcon, { open: menuOpen }),
3736
- label: /* @__PURE__ */ jsx("span", { className: "truncate whitespace-nowrap", children: label }),
3737
- disabled: item.disabled,
3738
- onClick: () => {
3739
- if (item.disabled) return;
3740
- const wasOpenOnPointerDown = wasOpenOnPointerDownRef.current;
3741
- wasOpenOnPointerDownRef.current = false;
3742
- if (wasOpenOnPointerDown && navigateToFirstEnabledChild()) return;
3743
- setOpen(true);
3744
- },
3745
- onPointerDown: () => {
3746
- if (item.disabled) return;
3747
- wasOpenOnPointerDownRef.current = menuOpen;
3748
- },
3749
- onPointerCancel: () => {
3750
- wasOpenOnPointerDownRef.current = false;
3751
- },
3752
- onKeyDown: (event) => {
3753
- if (item.disabled || !menuOpen || event.key !== "Enter" && event.key !== " ")
3754
- return;
3755
- if (navigateToFirstEnabledChild()) event.preventDefault();
3756
- },
3757
- onMouseEnter: openMenu,
3758
- onMouseLeave: scheduleCloseMenu,
3759
- style: getHeadbarItemStyle(
3760
- isActive || menuOpen,
3761
- compound ? false : useTokenRadius
3762
- ),
3763
- classNames: {
3764
- icon: "text-[inherit] [&_*]:!text-[inherit] [&_svg]:!stroke-current",
3765
- label: "text-[inherit] [&_*]:!text-[inherit]"
3766
- },
3767
- className: cn2(
3768
- "max-w-[12rem] shrink-0 border shadow-none",
3769
- compound && "!rounded-none !border-0 !bg-transparent",
3770
- menuButtonRadiusClass,
3771
- 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)))]"
3772
- )
3773
- }
3774
- ) }),
3775
- /* @__PURE__ */ jsx(DropdownMenu.Portal, { children: /* @__PURE__ */ jsx(
3776
- DropdownMenu.Content,
3697
+ return /* @__PURE__ */ jsxs(DropdownMenu.Root, { modal: false, open, onOpenChange: setOpen, children: [
3698
+ /* @__PURE__ */ jsx(DropdownMenu.Trigger, { asChild: true, children: /* @__PURE__ */ jsx(
3699
+ BaseButton,
3700
+ {
3701
+ appearance: NAVIGATION_LAYOUT_DEFAULT_APPEARANCE,
3702
+ tone: "muted",
3703
+ active: isActive || open,
3704
+ icon: item.icon,
3705
+ endIcon: /* @__PURE__ */ jsx(HeadbarChevronIcon, { open }),
3706
+ label: /* @__PURE__ */ jsx("span", { className: "truncate whitespace-nowrap", children: label }),
3707
+ disabled: item.disabled,
3708
+ onClick: () => {
3709
+ const wasOpenOnPointerDown = wasOpenOnPointerDownRef.current;
3710
+ wasOpenOnPointerDownRef.current = false;
3711
+ if (wasOpenOnPointerDown && navigateToFirstEnabledChild()) return;
3712
+ setOpen(true);
3713
+ },
3714
+ onPointerDown: () => {
3715
+ wasOpenOnPointerDownRef.current = open;
3716
+ },
3717
+ onPointerCancel: () => {
3718
+ wasOpenOnPointerDownRef.current = false;
3719
+ },
3720
+ onKeyDown: (event) => {
3721
+ if (!open || event.key !== "Enter" && event.key !== " ") return;
3722
+ if (navigateToFirstEnabledChild()) event.preventDefault();
3723
+ },
3724
+ onMouseEnter: openMenu,
3725
+ onMouseLeave: scheduleCloseMenu,
3726
+ style: getHeadbarItemStyle(
3727
+ isActive || open,
3728
+ compound ? false : useTokenRadius
3729
+ ),
3730
+ classNames: {
3731
+ icon: "text-[inherit] [&_*]:!text-[inherit] [&_svg]:!stroke-current",
3732
+ label: "text-[inherit] [&_*]:!text-[inherit]"
3733
+ },
3734
+ className: cn2(
3735
+ "max-w-[12rem] shrink-0 border shadow-none",
3736
+ compound && "!rounded-none !border-0 !bg-transparent",
3737
+ menuButtonRadiusClass,
3738
+ 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)))]"
3739
+ )
3740
+ }
3741
+ ) }),
3742
+ /* @__PURE__ */ jsx(DropdownMenu.Portal, { children: /* @__PURE__ */ jsx(
3743
+ DropdownMenu.Content,
3744
+ {
3745
+ align: "start",
3746
+ sideOffset: 5,
3747
+ onCloseAutoFocus: (event) => event.preventDefault(),
3748
+ onMouseEnter: openMenu,
3749
+ onMouseLeave: scheduleCloseMenu,
3750
+ className: cn2(
3751
+ "z-50 min-w-56 border p-1.5 animate-in fade-in-0 zoom-in-95",
3752
+ menuContentRadiusClass
3753
+ ),
3754
+ style: {
3755
+ background: "var(--monkeys-component-navigation-headbar-menu-background, hsl(var(--popover)))",
3756
+ borderColor: "var(--monkeys-component-navigation-headbar-menu-border-color, hsl(var(--border)))",
3757
+ color: "var(--monkeys-component-navigation-headbar-menu-foreground, hsl(var(--popover-foreground)))",
3758
+ boxShadow: "var(--monkeys-component-navigation-headbar-menu-shadow, 0 10px 15px -3px rgb(0 0 0 / 0.1))",
3759
+ backdropFilter: "blur(var(--monkeys-component-navigation-headbar-menu-backdrop-blur, 0px))"
3760
+ },
3761
+ children: item.children?.map((child) => /* @__PURE__ */ jsxs(
3762
+ DropdownMenu.Item,
3777
3763
  {
3778
- align: "start",
3779
- sideOffset: 5,
3780
- onCloseAutoFocus: (event) => event.preventDefault(),
3781
- onMouseEnter: openMenu,
3782
- onMouseLeave: scheduleCloseMenu,
3764
+ disabled: child.disabled,
3783
3765
  className: cn2(
3784
- "z-50 min-w-56 border p-1.5 animate-in fade-in-0 zoom-in-95",
3785
- menuContentRadiusClass
3766
+ "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)))]",
3767
+ menuItemRadiusClass
3786
3768
  ),
3787
- style: {
3788
- background: "var(--monkeys-component-navigation-headbar-menu-background, hsl(var(--popover)))",
3789
- borderColor: "var(--monkeys-component-navigation-headbar-menu-border-color, hsl(var(--border)))",
3790
- color: "var(--monkeys-component-navigation-headbar-menu-foreground, hsl(var(--popover-foreground)))",
3791
- boxShadow: "var(--monkeys-component-navigation-headbar-menu-shadow, 0 10px 15px -3px rgb(0 0 0 / 0.1))",
3792
- backdropFilter: "blur(var(--monkeys-component-navigation-headbar-menu-backdrop-blur, 0px))"
3769
+ style: getHeadbarItemStyle(
3770
+ child.id === activeItemId,
3771
+ useTokenRadius
3772
+ ),
3773
+ onSelect: () => {
3774
+ if (child.disabled) return;
3775
+ setOpen(false);
3776
+ onNavigate?.(child.id);
3793
3777
  },
3794
- children: item.children?.map((child) => /* @__PURE__ */ jsxs(
3795
- DropdownMenu.Item,
3796
- {
3797
- disabled: child.disabled,
3798
- className: cn2(
3799
- "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)))]",
3800
- menuItemRadiusClass
3801
- ),
3802
- style: getHeadbarItemStyle(
3803
- child.id === activeItemId,
3804
- useTokenRadius
3805
- ),
3806
- onSelect: () => {
3807
- if (child.disabled) return;
3808
- setOpen(false);
3809
- onNavigate?.(child.id);
3810
- },
3811
- children: [
3812
- 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,
3813
- /* @__PURE__ */ jsx("span", { className: "min-w-0 truncate", children: child.headbarLabel ?? child.label }),
3814
- child.trailing
3815
- ]
3816
- },
3817
- child.id
3818
- ))
3819
- }
3820
- ) })
3821
- ]
3822
- }
3823
- );
3824
- }
3825
- function preventDisabledNavigationInteraction(event) {
3826
- event.preventDefault();
3827
- event.stopPropagation();
3778
+ children: [
3779
+ 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,
3780
+ /* @__PURE__ */ jsx("span", { className: "min-w-0 truncate", children: child.headbarLabel ?? child.label }),
3781
+ child.trailing
3782
+ ]
3783
+ },
3784
+ child.id
3785
+ ))
3786
+ }
3787
+ ) })
3788
+ ] });
3828
3789
  }
3829
3790
  function NavigationHeadbarMenu({
3830
3791
  activeItemId,
@@ -3891,13 +3852,10 @@ function NavigationHeadbarMenu({
3891
3852
  "div",
3892
3853
  {
3893
3854
  "data-navigation-headbar-compound-item": item.id,
3894
- "data-disabled": item.disabled || void 0,
3895
- "aria-disabled": item.disabled || void 0,
3896
3855
  className: cn2(
3897
3856
  "inline-flex min-w-0 shrink-0 items-center gap-0 overflow-hidden border shadow-none",
3898
3857
  menuButtonRadiusClass,
3899
- 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)))]",
3900
- item.disabled && "!cursor-not-allowed"
3858
+ 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)))]"
3901
3859
  ),
3902
3860
  style: getHeadbarCompoundStyle(isActive, useTokenRadius),
3903
3861
  children: [
@@ -3913,16 +3871,7 @@ function NavigationHeadbarMenu({
3913
3871
  "span",
3914
3872
  {
3915
3873
  "data-navigation-headbar-secondary-action": item.id,
3916
- "aria-disabled": item.disabled || void 0,
3917
- ...item.disabled ? { inert: "" } : {},
3918
- onClickCapture: item.disabled ? preventDisabledNavigationInteraction : void 0,
3919
- onKeyDownCapture: item.disabled ? preventDisabledNavigationInteraction : void 0,
3920
- onKeyUpCapture: item.disabled ? preventDisabledNavigationInteraction : void 0,
3921
- onPointerDownCapture: item.disabled ? preventDisabledNavigationInteraction : void 0,
3922
- className: cn2(
3923
- "inline-flex min-w-0 shrink-0 items-center",
3924
- item.disabled && "!cursor-not-allowed opacity-60"
3925
- ),
3874
+ className: "inline-flex min-w-0 shrink-0 items-center",
3926
3875
  children: item.headbarSecondaryAction
3927
3876
  }
3928
3877
  )