@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.
package/dist/index.mjs CHANGED
@@ -15770,7 +15770,7 @@ function UserAccountMenu({
15770
15770
  DropdownMenu2.Item,
15771
15771
  {
15772
15772
  disabled: item.disabled,
15773
- onSelect: item.disabled ? void 0 : item.onSelect,
15773
+ onSelect: item.onSelect,
15774
15774
  className: cn(
15775
15775
  "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",
15776
15776
  radiusClass,
@@ -15796,7 +15796,6 @@ function cn2(...inputs) {
15796
15796
  }
15797
15797
  function NavButton({
15798
15798
  active,
15799
- disabled,
15800
15799
  icon,
15801
15800
  postfix,
15802
15801
  onClick,
@@ -15804,17 +15803,11 @@ function NavButton({
15804
15803
  children
15805
15804
  }) {
15806
15805
  return /* @__PURE__ */ jsxs(
15807
- "button",
15806
+ "div",
15808
15807
  {
15809
- type: "button",
15810
- "aria-disabled": disabled || void 0,
15811
- "aria-pressed": active || void 0,
15812
- "data-disabled": disabled || void 0,
15813
- disabled,
15814
15808
  className: cn2(
15815
- "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",
15809
+ "flex w-full cursor-pointer select-none items-center gap-2 rounded-xl border p-2 text-xs text-[hsl(var(--foreground))] transition-colors",
15816
15810
  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",
15817
- disabled && "!cursor-not-allowed opacity-60 hover:border-transparent hover:bg-transparent",
15818
15811
  className
15819
15812
  ),
15820
15813
  onClick,
@@ -16107,8 +16100,6 @@ function SidebarNavList({
16107
16100
  /* @__PURE__ */ jsx(
16108
16101
  NavButton,
16109
16102
  {
16110
- active: item.id === resolvedActiveItemId,
16111
- disabled: item.disabled,
16112
16103
  icon: item.icon,
16113
16104
  onClick: () => toggle(item.id),
16114
16105
  postfix: /* @__PURE__ */ jsx("div", { className: "flex flex-1 justify-end", children: /* @__PURE__ */ jsx(
@@ -16133,11 +16124,10 @@ function SidebarNavList({
16133
16124
  children: item.label
16134
16125
  }
16135
16126
  ),
16136
- isExpanded && !item.disabled && /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-1 mt-1", children: item.children.map((child) => /* @__PURE__ */ jsx(
16127
+ isExpanded && /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-1 mt-1", children: item.children.map((child) => /* @__PURE__ */ jsx(
16137
16128
  NavButton,
16138
16129
  {
16139
16130
  active: child.id === resolvedActiveItemId,
16140
- disabled: child.disabled,
16141
16131
  onClick: () => {
16142
16132
  setLocalActiveItemId(child.id);
16143
16133
  onNavigate?.(child.id);
@@ -16153,7 +16143,6 @@ function SidebarNavList({
16153
16143
  {
16154
16144
  icon: item.icon,
16155
16145
  active: item.id === resolvedActiveItemId,
16156
- disabled: item.disabled,
16157
16146
  onClick: () => {
16158
16147
  setLocalActiveItemId(item.id);
16159
16148
  onNavigate?.(item.id);
@@ -16403,10 +16392,6 @@ function SidebarNavigationList({
16403
16392
  const [expandedByRoot, setExpandedByRoot] = useState(
16404
16393
  {}
16405
16394
  );
16406
- const canRevealRequestedRoot = revealRequest ? items.some(
16407
- (item) => item.id === revealRequest.id && !item.disabled
16408
- ) : false;
16409
- const activeRootId = findNavigationRootId(items, activeItemId);
16410
16395
  const toggleRoot = (id) => {
16411
16396
  setExpandedByRoot((current) => ({
16412
16397
  ...current,
@@ -16414,7 +16399,7 @@ function SidebarNavigationList({
16414
16399
  }));
16415
16400
  };
16416
16401
  useEffect(() => {
16417
- if (!revealRequest || !canRevealRequestedRoot) return;
16402
+ if (!revealRequest) return;
16418
16403
  setExpandedByRoot((current) => ({
16419
16404
  ...current,
16420
16405
  [revealRequest.id]: true
@@ -16432,7 +16417,7 @@ function SidebarNavigationList({
16432
16417
  }
16433
16418
  });
16434
16419
  return () => window.cancelAnimationFrame(frameId);
16435
- }, [canRevealRequestedRoot, revealRequest]);
16420
+ }, [revealRequest]);
16436
16421
  return /* @__PURE__ */ jsxs(
16437
16422
  "div",
16438
16423
  {
@@ -16447,15 +16432,13 @@ function SidebarNavigationList({
16447
16432
  className: "monkeys-navigation-sidebar-nav flex w-full flex-col gap-2 text-xs text-[hsl(var(--foreground))]",
16448
16433
  children: items.map((item) => {
16449
16434
  const isGroup = Boolean(item.children?.length);
16450
- const isExpanded = !item.disabled && Boolean(expandedByRoot[item.id]);
16451
- const isActive = activeRootId === item.id;
16435
+ const isExpanded = Boolean(expandedByRoot[item.id]);
16436
+ const isActive = activeItemId === item.id;
16452
16437
  if (isGroup) {
16453
16438
  return /* @__PURE__ */ jsxs("div", { "data-navigation-sidebar-root-id": item.id, children: [
16454
16439
  /* @__PURE__ */ jsx(
16455
16440
  NavButton,
16456
16441
  {
16457
- active: isActive,
16458
- disabled: item.disabled,
16459
16442
  icon: item.icon,
16460
16443
  onClick: () => toggleRoot(item.id),
16461
16444
  postfix: /* @__PURE__ */ jsx("div", { className: "flex flex-1 justify-end", children: /* @__PURE__ */ jsx(
@@ -16484,7 +16467,6 @@ function SidebarNavigationList({
16484
16467
  NavButton,
16485
16468
  {
16486
16469
  active: activeItemId === child.id,
16487
- disabled: child.disabled,
16488
16470
  onClick: () => onNavigate?.(child.id),
16489
16471
  children: child.label
16490
16472
  },
@@ -16496,7 +16478,6 @@ function SidebarNavigationList({
16496
16478
  NavButton,
16497
16479
  {
16498
16480
  active: isActive,
16499
- disabled: item.disabled,
16500
16481
  icon: item.icon,
16501
16482
  onClick: () => onNavigate?.(item.id),
16502
16483
  children: item.label
@@ -16612,11 +16593,9 @@ function Sidebar({
16612
16593
  appearance: NAVIGATION_LAYOUT_DEFAULT_APPEARANCE,
16613
16594
  tone: "muted",
16614
16595
  active: isActive,
16615
- disabled: item.disabled,
16616
16596
  iconOnly: true,
16617
16597
  icon: item.icon,
16618
16598
  onClick: () => {
16619
- if (item.disabled) return;
16620
16599
  onRevealRoot?.(item.id);
16621
16600
  onCollapsedChange?.(false);
16622
16601
  if (item.children?.length) return;
@@ -16693,7 +16672,6 @@ function HeadbarNavMenuItem({
16693
16672
  useTokenRadius
16694
16673
  }) {
16695
16674
  const [open, setOpen] = useState(false);
16696
- const menuOpen = !item.disabled && open;
16697
16675
  const closeTimerRef = useRef(null);
16698
16676
  const wasOpenOnPointerDownRef = useRef(false);
16699
16677
  const clearCloseTimer = () => {
@@ -16702,7 +16680,6 @@ function HeadbarNavMenuItem({
16702
16680
  closeTimerRef.current = null;
16703
16681
  };
16704
16682
  const openMenu = () => {
16705
- if (item.disabled) return;
16706
16683
  clearCloseTimer();
16707
16684
  setOpen(true);
16708
16685
  };
@@ -16714,7 +16691,6 @@ function HeadbarNavMenuItem({
16714
16691
  }, 120);
16715
16692
  };
16716
16693
  const navigateToFirstEnabledChild = () => {
16717
- if (item.disabled) return false;
16718
16694
  const firstEnabledChild = item.children?.find((child) => !child.disabled);
16719
16695
  if (!firstEnabledChild) return false;
16720
16696
  setOpen(false);
@@ -16722,113 +16698,98 @@ function HeadbarNavMenuItem({
16722
16698
  return true;
16723
16699
  };
16724
16700
  useEffect(() => clearCloseTimer, []);
16725
- return /* @__PURE__ */ jsxs(
16726
- DropdownMenu2.Root,
16727
- {
16728
- modal: false,
16729
- open: menuOpen,
16730
- onOpenChange: (nextOpen) => setOpen(item.disabled ? false : nextOpen),
16731
- children: [
16732
- /* @__PURE__ */ jsx(DropdownMenu2.Trigger, { asChild: true, children: /* @__PURE__ */ jsx(
16733
- BaseButton,
16734
- {
16735
- appearance: NAVIGATION_LAYOUT_DEFAULT_APPEARANCE,
16736
- tone: "muted",
16737
- active: isActive || menuOpen,
16738
- icon: item.icon,
16739
- endIcon: /* @__PURE__ */ jsx(HeadbarChevronIcon, { open: menuOpen }),
16740
- label: /* @__PURE__ */ jsx("span", { className: "truncate whitespace-nowrap", children: label }),
16741
- disabled: item.disabled,
16742
- onClick: () => {
16743
- if (item.disabled) return;
16744
- const wasOpenOnPointerDown = wasOpenOnPointerDownRef.current;
16745
- wasOpenOnPointerDownRef.current = false;
16746
- if (wasOpenOnPointerDown && navigateToFirstEnabledChild()) return;
16747
- setOpen(true);
16748
- },
16749
- onPointerDown: () => {
16750
- if (item.disabled) return;
16751
- wasOpenOnPointerDownRef.current = menuOpen;
16752
- },
16753
- onPointerCancel: () => {
16754
- wasOpenOnPointerDownRef.current = false;
16755
- },
16756
- onKeyDown: (event) => {
16757
- if (item.disabled || !menuOpen || event.key !== "Enter" && event.key !== " ")
16758
- return;
16759
- if (navigateToFirstEnabledChild()) event.preventDefault();
16760
- },
16761
- onMouseEnter: openMenu,
16762
- onMouseLeave: scheduleCloseMenu,
16763
- style: getHeadbarItemStyle(
16764
- isActive || menuOpen,
16765
- compound ? false : useTokenRadius
16766
- ),
16767
- classNames: {
16768
- icon: "text-[inherit] [&_*]:!text-[inherit] [&_svg]:!stroke-current",
16769
- label: "text-[inherit] [&_*]:!text-[inherit]"
16770
- },
16771
- className: cn2(
16772
- "max-w-[12rem] shrink-0 border shadow-none",
16773
- compound && "!rounded-none !border-0 !bg-transparent",
16774
- menuButtonRadiusClass,
16775
- 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)))]"
16776
- )
16777
- }
16778
- ) }),
16779
- /* @__PURE__ */ jsx(DropdownMenu2.Portal, { children: /* @__PURE__ */ jsx(
16780
- DropdownMenu2.Content,
16701
+ return /* @__PURE__ */ jsxs(DropdownMenu2.Root, { modal: false, open, onOpenChange: setOpen, children: [
16702
+ /* @__PURE__ */ jsx(DropdownMenu2.Trigger, { asChild: true, children: /* @__PURE__ */ jsx(
16703
+ BaseButton,
16704
+ {
16705
+ appearance: NAVIGATION_LAYOUT_DEFAULT_APPEARANCE,
16706
+ tone: "muted",
16707
+ active: isActive || open,
16708
+ icon: item.icon,
16709
+ endIcon: /* @__PURE__ */ jsx(HeadbarChevronIcon, { open }),
16710
+ label: /* @__PURE__ */ jsx("span", { className: "truncate whitespace-nowrap", children: label }),
16711
+ disabled: item.disabled,
16712
+ onClick: () => {
16713
+ const wasOpenOnPointerDown = wasOpenOnPointerDownRef.current;
16714
+ wasOpenOnPointerDownRef.current = false;
16715
+ if (wasOpenOnPointerDown && navigateToFirstEnabledChild()) return;
16716
+ setOpen(true);
16717
+ },
16718
+ onPointerDown: () => {
16719
+ wasOpenOnPointerDownRef.current = open;
16720
+ },
16721
+ onPointerCancel: () => {
16722
+ wasOpenOnPointerDownRef.current = false;
16723
+ },
16724
+ onKeyDown: (event) => {
16725
+ if (!open || event.key !== "Enter" && event.key !== " ") return;
16726
+ if (navigateToFirstEnabledChild()) event.preventDefault();
16727
+ },
16728
+ onMouseEnter: openMenu,
16729
+ onMouseLeave: scheduleCloseMenu,
16730
+ style: getHeadbarItemStyle(
16731
+ isActive || open,
16732
+ compound ? false : useTokenRadius
16733
+ ),
16734
+ classNames: {
16735
+ icon: "text-[inherit] [&_*]:!text-[inherit] [&_svg]:!stroke-current",
16736
+ label: "text-[inherit] [&_*]:!text-[inherit]"
16737
+ },
16738
+ className: cn2(
16739
+ "max-w-[12rem] shrink-0 border shadow-none",
16740
+ compound && "!rounded-none !border-0 !bg-transparent",
16741
+ menuButtonRadiusClass,
16742
+ 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)))]"
16743
+ )
16744
+ }
16745
+ ) }),
16746
+ /* @__PURE__ */ jsx(DropdownMenu2.Portal, { children: /* @__PURE__ */ jsx(
16747
+ DropdownMenu2.Content,
16748
+ {
16749
+ align: "start",
16750
+ sideOffset: 5,
16751
+ onCloseAutoFocus: (event) => event.preventDefault(),
16752
+ onMouseEnter: openMenu,
16753
+ onMouseLeave: scheduleCloseMenu,
16754
+ className: cn2(
16755
+ "z-50 min-w-56 border p-1.5 animate-in fade-in-0 zoom-in-95",
16756
+ menuContentRadiusClass
16757
+ ),
16758
+ style: {
16759
+ background: "var(--monkeys-component-navigation-headbar-menu-background, hsl(var(--popover)))",
16760
+ borderColor: "var(--monkeys-component-navigation-headbar-menu-border-color, hsl(var(--border)))",
16761
+ color: "var(--monkeys-component-navigation-headbar-menu-foreground, hsl(var(--popover-foreground)))",
16762
+ boxShadow: "var(--monkeys-component-navigation-headbar-menu-shadow, 0 10px 15px -3px rgb(0 0 0 / 0.1))",
16763
+ backdropFilter: "blur(var(--monkeys-component-navigation-headbar-menu-backdrop-blur, 0px))"
16764
+ },
16765
+ children: item.children?.map((child) => /* @__PURE__ */ jsxs(
16766
+ DropdownMenu2.Item,
16781
16767
  {
16782
- align: "start",
16783
- sideOffset: 5,
16784
- onCloseAutoFocus: (event) => event.preventDefault(),
16785
- onMouseEnter: openMenu,
16786
- onMouseLeave: scheduleCloseMenu,
16768
+ disabled: child.disabled,
16787
16769
  className: cn2(
16788
- "z-50 min-w-56 border p-1.5 animate-in fade-in-0 zoom-in-95",
16789
- menuContentRadiusClass
16770
+ "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)))]",
16771
+ menuItemRadiusClass
16790
16772
  ),
16791
- style: {
16792
- background: "var(--monkeys-component-navigation-headbar-menu-background, hsl(var(--popover)))",
16793
- borderColor: "var(--monkeys-component-navigation-headbar-menu-border-color, hsl(var(--border)))",
16794
- color: "var(--monkeys-component-navigation-headbar-menu-foreground, hsl(var(--popover-foreground)))",
16795
- boxShadow: "var(--monkeys-component-navigation-headbar-menu-shadow, 0 10px 15px -3px rgb(0 0 0 / 0.1))",
16796
- backdropFilter: "blur(var(--monkeys-component-navigation-headbar-menu-backdrop-blur, 0px))"
16773
+ style: getHeadbarItemStyle(
16774
+ child.id === activeItemId,
16775
+ useTokenRadius
16776
+ ),
16777
+ onSelect: () => {
16778
+ if (child.disabled) return;
16779
+ setOpen(false);
16780
+ onNavigate?.(child.id);
16797
16781
  },
16798
- children: item.children?.map((child) => /* @__PURE__ */ jsxs(
16799
- DropdownMenu2.Item,
16800
- {
16801
- disabled: child.disabled,
16802
- className: cn2(
16803
- "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)))]",
16804
- menuItemRadiusClass
16805
- ),
16806
- style: getHeadbarItemStyle(
16807
- child.id === activeItemId,
16808
- useTokenRadius
16809
- ),
16810
- onSelect: () => {
16811
- if (child.disabled) return;
16812
- setOpen(false);
16813
- onNavigate?.(child.id);
16814
- },
16815
- children: [
16816
- 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,
16817
- /* @__PURE__ */ jsx("span", { className: "min-w-0 truncate", children: child.headbarLabel ?? child.label }),
16818
- child.trailing
16819
- ]
16820
- },
16821
- child.id
16822
- ))
16823
- }
16824
- ) })
16825
- ]
16826
- }
16827
- );
16828
- }
16829
- function preventDisabledNavigationInteraction(event) {
16830
- event.preventDefault();
16831
- event.stopPropagation();
16782
+ children: [
16783
+ 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,
16784
+ /* @__PURE__ */ jsx("span", { className: "min-w-0 truncate", children: child.headbarLabel ?? child.label }),
16785
+ child.trailing
16786
+ ]
16787
+ },
16788
+ child.id
16789
+ ))
16790
+ }
16791
+ ) })
16792
+ ] });
16832
16793
  }
16833
16794
  function NavigationHeadbarMenu({
16834
16795
  activeItemId,
@@ -16895,13 +16856,10 @@ function NavigationHeadbarMenu({
16895
16856
  "div",
16896
16857
  {
16897
16858
  "data-navigation-headbar-compound-item": item.id,
16898
- "data-disabled": item.disabled || void 0,
16899
- "aria-disabled": item.disabled || void 0,
16900
16859
  className: cn2(
16901
16860
  "inline-flex min-w-0 shrink-0 items-center gap-0 overflow-hidden border shadow-none",
16902
16861
  menuButtonRadiusClass,
16903
- 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)))]",
16904
- item.disabled && "!cursor-not-allowed"
16862
+ 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)))]"
16905
16863
  ),
16906
16864
  style: getHeadbarCompoundStyle(isActive, useTokenRadius),
16907
16865
  children: [
@@ -16917,16 +16875,7 @@ function NavigationHeadbarMenu({
16917
16875
  "span",
16918
16876
  {
16919
16877
  "data-navigation-headbar-secondary-action": item.id,
16920
- "aria-disabled": item.disabled || void 0,
16921
- ...item.disabled ? { inert: "" } : {},
16922
- onClickCapture: item.disabled ? preventDisabledNavigationInteraction : void 0,
16923
- onKeyDownCapture: item.disabled ? preventDisabledNavigationInteraction : void 0,
16924
- onKeyUpCapture: item.disabled ? preventDisabledNavigationInteraction : void 0,
16925
- onPointerDownCapture: item.disabled ? preventDisabledNavigationInteraction : void 0,
16926
- className: cn2(
16927
- "inline-flex min-w-0 shrink-0 items-center",
16928
- item.disabled && "!cursor-not-allowed opacity-60"
16929
- ),
16878
+ className: "inline-flex min-w-0 shrink-0 items-center",
16930
16879
  children: item.headbarSecondaryAction
16931
16880
  }
16932
16881
  )