@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.js CHANGED
@@ -15805,7 +15805,7 @@ function UserAccountMenu({
15805
15805
  DropdownMenu2__namespace.Item,
15806
15806
  {
15807
15807
  disabled: item.disabled,
15808
- onSelect: item.disabled ? void 0 : item.onSelect,
15808
+ onSelect: item.onSelect,
15809
15809
  className: cn(
15810
15810
  "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",
15811
15811
  radiusClass,
@@ -15831,7 +15831,6 @@ function cn2(...inputs) {
15831
15831
  }
15832
15832
  function NavButton({
15833
15833
  active,
15834
- disabled,
15835
15834
  icon,
15836
15835
  postfix,
15837
15836
  onClick,
@@ -15839,17 +15838,11 @@ function NavButton({
15839
15838
  children
15840
15839
  }) {
15841
15840
  return /* @__PURE__ */ jsxRuntime.jsxs(
15842
- "button",
15841
+ "div",
15843
15842
  {
15844
- type: "button",
15845
- "aria-disabled": disabled || void 0,
15846
- "aria-pressed": active || void 0,
15847
- "data-disabled": disabled || void 0,
15848
- disabled,
15849
15843
  className: cn2(
15850
- "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",
15844
+ "flex w-full cursor-pointer select-none items-center gap-2 rounded-xl border p-2 text-xs text-[hsl(var(--foreground))] transition-colors",
15851
15845
  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",
15852
- disabled && "!cursor-not-allowed opacity-60 hover:border-transparent hover:bg-transparent",
15853
15846
  className
15854
15847
  ),
15855
15848
  onClick,
@@ -16142,8 +16135,6 @@ function SidebarNavList({
16142
16135
  /* @__PURE__ */ jsxRuntime.jsx(
16143
16136
  NavButton,
16144
16137
  {
16145
- active: item.id === resolvedActiveItemId,
16146
- disabled: item.disabled,
16147
16138
  icon: item.icon,
16148
16139
  onClick: () => toggle(item.id),
16149
16140
  postfix: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-1 justify-end", children: /* @__PURE__ */ jsxRuntime.jsx(
@@ -16168,11 +16159,10 @@ function SidebarNavList({
16168
16159
  children: item.label
16169
16160
  }
16170
16161
  ),
16171
- isExpanded && !item.disabled && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-col gap-1 mt-1", children: item.children.map((child) => /* @__PURE__ */ jsxRuntime.jsx(
16162
+ isExpanded && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-col gap-1 mt-1", children: item.children.map((child) => /* @__PURE__ */ jsxRuntime.jsx(
16172
16163
  NavButton,
16173
16164
  {
16174
16165
  active: child.id === resolvedActiveItemId,
16175
- disabled: child.disabled,
16176
16166
  onClick: () => {
16177
16167
  setLocalActiveItemId(child.id);
16178
16168
  onNavigate?.(child.id);
@@ -16188,7 +16178,6 @@ function SidebarNavList({
16188
16178
  {
16189
16179
  icon: item.icon,
16190
16180
  active: item.id === resolvedActiveItemId,
16191
- disabled: item.disabled,
16192
16181
  onClick: () => {
16193
16182
  setLocalActiveItemId(item.id);
16194
16183
  onNavigate?.(item.id);
@@ -16438,10 +16427,6 @@ function SidebarNavigationList({
16438
16427
  const [expandedByRoot, setExpandedByRoot] = React2.useState(
16439
16428
  {}
16440
16429
  );
16441
- const canRevealRequestedRoot = revealRequest ? items.some(
16442
- (item) => item.id === revealRequest.id && !item.disabled
16443
- ) : false;
16444
- const activeRootId = findNavigationRootId(items, activeItemId);
16445
16430
  const toggleRoot = (id) => {
16446
16431
  setExpandedByRoot((current) => ({
16447
16432
  ...current,
@@ -16449,7 +16434,7 @@ function SidebarNavigationList({
16449
16434
  }));
16450
16435
  };
16451
16436
  React2.useEffect(() => {
16452
- if (!revealRequest || !canRevealRequestedRoot) return;
16437
+ if (!revealRequest) return;
16453
16438
  setExpandedByRoot((current) => ({
16454
16439
  ...current,
16455
16440
  [revealRequest.id]: true
@@ -16467,7 +16452,7 @@ function SidebarNavigationList({
16467
16452
  }
16468
16453
  });
16469
16454
  return () => window.cancelAnimationFrame(frameId);
16470
- }, [canRevealRequestedRoot, revealRequest]);
16455
+ }, [revealRequest]);
16471
16456
  return /* @__PURE__ */ jsxRuntime.jsxs(
16472
16457
  "div",
16473
16458
  {
@@ -16482,15 +16467,13 @@ function SidebarNavigationList({
16482
16467
  className: "monkeys-navigation-sidebar-nav flex w-full flex-col gap-2 text-xs text-[hsl(var(--foreground))]",
16483
16468
  children: items.map((item) => {
16484
16469
  const isGroup = Boolean(item.children?.length);
16485
- const isExpanded = !item.disabled && Boolean(expandedByRoot[item.id]);
16486
- const isActive = activeRootId === item.id;
16470
+ const isExpanded = Boolean(expandedByRoot[item.id]);
16471
+ const isActive = activeItemId === item.id;
16487
16472
  if (isGroup) {
16488
16473
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-navigation-sidebar-root-id": item.id, children: [
16489
16474
  /* @__PURE__ */ jsxRuntime.jsx(
16490
16475
  NavButton,
16491
16476
  {
16492
- active: isActive,
16493
- disabled: item.disabled,
16494
16477
  icon: item.icon,
16495
16478
  onClick: () => toggleRoot(item.id),
16496
16479
  postfix: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-1 justify-end", children: /* @__PURE__ */ jsxRuntime.jsx(
@@ -16519,7 +16502,6 @@ function SidebarNavigationList({
16519
16502
  NavButton,
16520
16503
  {
16521
16504
  active: activeItemId === child.id,
16522
- disabled: child.disabled,
16523
16505
  onClick: () => onNavigate?.(child.id),
16524
16506
  children: child.label
16525
16507
  },
@@ -16531,7 +16513,6 @@ function SidebarNavigationList({
16531
16513
  NavButton,
16532
16514
  {
16533
16515
  active: isActive,
16534
- disabled: item.disabled,
16535
16516
  icon: item.icon,
16536
16517
  onClick: () => onNavigate?.(item.id),
16537
16518
  children: item.label
@@ -16647,11 +16628,9 @@ function Sidebar({
16647
16628
  appearance: NAVIGATION_LAYOUT_DEFAULT_APPEARANCE,
16648
16629
  tone: "muted",
16649
16630
  active: isActive,
16650
- disabled: item.disabled,
16651
16631
  iconOnly: true,
16652
16632
  icon: item.icon,
16653
16633
  onClick: () => {
16654
- if (item.disabled) return;
16655
16634
  onRevealRoot?.(item.id);
16656
16635
  onCollapsedChange?.(false);
16657
16636
  if (item.children?.length) return;
@@ -16728,7 +16707,6 @@ function HeadbarNavMenuItem({
16728
16707
  useTokenRadius
16729
16708
  }) {
16730
16709
  const [open, setOpen] = React2.useState(false);
16731
- const menuOpen = !item.disabled && open;
16732
16710
  const closeTimerRef = React2.useRef(null);
16733
16711
  const wasOpenOnPointerDownRef = React2.useRef(false);
16734
16712
  const clearCloseTimer = () => {
@@ -16737,7 +16715,6 @@ function HeadbarNavMenuItem({
16737
16715
  closeTimerRef.current = null;
16738
16716
  };
16739
16717
  const openMenu = () => {
16740
- if (item.disabled) return;
16741
16718
  clearCloseTimer();
16742
16719
  setOpen(true);
16743
16720
  };
@@ -16749,7 +16726,6 @@ function HeadbarNavMenuItem({
16749
16726
  }, 120);
16750
16727
  };
16751
16728
  const navigateToFirstEnabledChild = () => {
16752
- if (item.disabled) return false;
16753
16729
  const firstEnabledChild = item.children?.find((child) => !child.disabled);
16754
16730
  if (!firstEnabledChild) return false;
16755
16731
  setOpen(false);
@@ -16757,113 +16733,98 @@ function HeadbarNavMenuItem({
16757
16733
  return true;
16758
16734
  };
16759
16735
  React2.useEffect(() => clearCloseTimer, []);
16760
- return /* @__PURE__ */ jsxRuntime.jsxs(
16761
- DropdownMenu2__namespace.Root,
16762
- {
16763
- modal: false,
16764
- open: menuOpen,
16765
- onOpenChange: (nextOpen) => setOpen(item.disabled ? false : nextOpen),
16766
- children: [
16767
- /* @__PURE__ */ jsxRuntime.jsx(DropdownMenu2__namespace.Trigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(
16768
- BaseButton,
16769
- {
16770
- appearance: NAVIGATION_LAYOUT_DEFAULT_APPEARANCE,
16771
- tone: "muted",
16772
- active: isActive || menuOpen,
16773
- icon: item.icon,
16774
- endIcon: /* @__PURE__ */ jsxRuntime.jsx(HeadbarChevronIcon, { open: menuOpen }),
16775
- label: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate whitespace-nowrap", children: label }),
16776
- disabled: item.disabled,
16777
- onClick: () => {
16778
- if (item.disabled) return;
16779
- const wasOpenOnPointerDown = wasOpenOnPointerDownRef.current;
16780
- wasOpenOnPointerDownRef.current = false;
16781
- if (wasOpenOnPointerDown && navigateToFirstEnabledChild()) return;
16782
- setOpen(true);
16783
- },
16784
- onPointerDown: () => {
16785
- if (item.disabled) return;
16786
- wasOpenOnPointerDownRef.current = menuOpen;
16787
- },
16788
- onPointerCancel: () => {
16789
- wasOpenOnPointerDownRef.current = false;
16790
- },
16791
- onKeyDown: (event) => {
16792
- if (item.disabled || !menuOpen || event.key !== "Enter" && event.key !== " ")
16793
- return;
16794
- if (navigateToFirstEnabledChild()) event.preventDefault();
16795
- },
16796
- onMouseEnter: openMenu,
16797
- onMouseLeave: scheduleCloseMenu,
16798
- style: getHeadbarItemStyle(
16799
- isActive || menuOpen,
16800
- compound ? false : useTokenRadius
16801
- ),
16802
- classNames: {
16803
- icon: "text-[inherit] [&_*]:!text-[inherit] [&_svg]:!stroke-current",
16804
- label: "text-[inherit] [&_*]:!text-[inherit]"
16805
- },
16806
- className: cn2(
16807
- "max-w-[12rem] shrink-0 border shadow-none",
16808
- compound && "!rounded-none !border-0 !bg-transparent",
16809
- menuButtonRadiusClass,
16810
- 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)))]"
16811
- )
16812
- }
16813
- ) }),
16814
- /* @__PURE__ */ jsxRuntime.jsx(DropdownMenu2__namespace.Portal, { children: /* @__PURE__ */ jsxRuntime.jsx(
16815
- DropdownMenu2__namespace.Content,
16736
+ return /* @__PURE__ */ jsxRuntime.jsxs(DropdownMenu2__namespace.Root, { modal: false, open, onOpenChange: setOpen, children: [
16737
+ /* @__PURE__ */ jsxRuntime.jsx(DropdownMenu2__namespace.Trigger, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(
16738
+ BaseButton,
16739
+ {
16740
+ appearance: NAVIGATION_LAYOUT_DEFAULT_APPEARANCE,
16741
+ tone: "muted",
16742
+ active: isActive || open,
16743
+ icon: item.icon,
16744
+ endIcon: /* @__PURE__ */ jsxRuntime.jsx(HeadbarChevronIcon, { open }),
16745
+ label: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate whitespace-nowrap", children: label }),
16746
+ disabled: item.disabled,
16747
+ onClick: () => {
16748
+ const wasOpenOnPointerDown = wasOpenOnPointerDownRef.current;
16749
+ wasOpenOnPointerDownRef.current = false;
16750
+ if (wasOpenOnPointerDown && navigateToFirstEnabledChild()) return;
16751
+ setOpen(true);
16752
+ },
16753
+ onPointerDown: () => {
16754
+ wasOpenOnPointerDownRef.current = open;
16755
+ },
16756
+ onPointerCancel: () => {
16757
+ wasOpenOnPointerDownRef.current = false;
16758
+ },
16759
+ onKeyDown: (event) => {
16760
+ if (!open || event.key !== "Enter" && event.key !== " ") return;
16761
+ if (navigateToFirstEnabledChild()) event.preventDefault();
16762
+ },
16763
+ onMouseEnter: openMenu,
16764
+ onMouseLeave: scheduleCloseMenu,
16765
+ style: getHeadbarItemStyle(
16766
+ isActive || open,
16767
+ compound ? false : useTokenRadius
16768
+ ),
16769
+ classNames: {
16770
+ icon: "text-[inherit] [&_*]:!text-[inherit] [&_svg]:!stroke-current",
16771
+ label: "text-[inherit] [&_*]:!text-[inherit]"
16772
+ },
16773
+ className: cn2(
16774
+ "max-w-[12rem] shrink-0 border shadow-none",
16775
+ compound && "!rounded-none !border-0 !bg-transparent",
16776
+ menuButtonRadiusClass,
16777
+ 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)))]"
16778
+ )
16779
+ }
16780
+ ) }),
16781
+ /* @__PURE__ */ jsxRuntime.jsx(DropdownMenu2__namespace.Portal, { children: /* @__PURE__ */ jsxRuntime.jsx(
16782
+ DropdownMenu2__namespace.Content,
16783
+ {
16784
+ align: "start",
16785
+ sideOffset: 5,
16786
+ onCloseAutoFocus: (event) => event.preventDefault(),
16787
+ onMouseEnter: openMenu,
16788
+ onMouseLeave: scheduleCloseMenu,
16789
+ className: cn2(
16790
+ "z-50 min-w-56 border p-1.5 animate-in fade-in-0 zoom-in-95",
16791
+ menuContentRadiusClass
16792
+ ),
16793
+ style: {
16794
+ background: "var(--monkeys-component-navigation-headbar-menu-background, hsl(var(--popover)))",
16795
+ borderColor: "var(--monkeys-component-navigation-headbar-menu-border-color, hsl(var(--border)))",
16796
+ color: "var(--monkeys-component-navigation-headbar-menu-foreground, hsl(var(--popover-foreground)))",
16797
+ boxShadow: "var(--monkeys-component-navigation-headbar-menu-shadow, 0 10px 15px -3px rgb(0 0 0 / 0.1))",
16798
+ backdropFilter: "blur(var(--monkeys-component-navigation-headbar-menu-backdrop-blur, 0px))"
16799
+ },
16800
+ children: item.children?.map((child) => /* @__PURE__ */ jsxRuntime.jsxs(
16801
+ DropdownMenu2__namespace.Item,
16816
16802
  {
16817
- align: "start",
16818
- sideOffset: 5,
16819
- onCloseAutoFocus: (event) => event.preventDefault(),
16820
- onMouseEnter: openMenu,
16821
- onMouseLeave: scheduleCloseMenu,
16803
+ disabled: child.disabled,
16822
16804
  className: cn2(
16823
- "z-50 min-w-56 border p-1.5 animate-in fade-in-0 zoom-in-95",
16824
- menuContentRadiusClass
16805
+ "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)))]",
16806
+ menuItemRadiusClass
16825
16807
  ),
16826
- style: {
16827
- background: "var(--monkeys-component-navigation-headbar-menu-background, hsl(var(--popover)))",
16828
- borderColor: "var(--monkeys-component-navigation-headbar-menu-border-color, hsl(var(--border)))",
16829
- color: "var(--monkeys-component-navigation-headbar-menu-foreground, hsl(var(--popover-foreground)))",
16830
- boxShadow: "var(--monkeys-component-navigation-headbar-menu-shadow, 0 10px 15px -3px rgb(0 0 0 / 0.1))",
16831
- backdropFilter: "blur(var(--monkeys-component-navigation-headbar-menu-backdrop-blur, 0px))"
16808
+ style: getHeadbarItemStyle(
16809
+ child.id === activeItemId,
16810
+ useTokenRadius
16811
+ ),
16812
+ onSelect: () => {
16813
+ if (child.disabled) return;
16814
+ setOpen(false);
16815
+ onNavigate?.(child.id);
16832
16816
  },
16833
- children: item.children?.map((child) => /* @__PURE__ */ jsxRuntime.jsxs(
16834
- DropdownMenu2__namespace.Item,
16835
- {
16836
- disabled: child.disabled,
16837
- className: cn2(
16838
- "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)))]",
16839
- menuItemRadiusClass
16840
- ),
16841
- style: getHeadbarItemStyle(
16842
- child.id === activeItemId,
16843
- useTokenRadius
16844
- ),
16845
- onSelect: () => {
16846
- if (child.disabled) return;
16847
- setOpen(false);
16848
- onNavigate?.(child.id);
16849
- },
16850
- children: [
16851
- 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,
16852
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "min-w-0 truncate", children: child.headbarLabel ?? child.label }),
16853
- child.trailing
16854
- ]
16855
- },
16856
- child.id
16857
- ))
16858
- }
16859
- ) })
16860
- ]
16861
- }
16862
- );
16863
- }
16864
- function preventDisabledNavigationInteraction(event) {
16865
- event.preventDefault();
16866
- event.stopPropagation();
16817
+ children: [
16818
+ 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,
16819
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "min-w-0 truncate", children: child.headbarLabel ?? child.label }),
16820
+ child.trailing
16821
+ ]
16822
+ },
16823
+ child.id
16824
+ ))
16825
+ }
16826
+ ) })
16827
+ ] });
16867
16828
  }
16868
16829
  function NavigationHeadbarMenu({
16869
16830
  activeItemId,
@@ -16930,13 +16891,10 @@ function NavigationHeadbarMenu({
16930
16891
  "div",
16931
16892
  {
16932
16893
  "data-navigation-headbar-compound-item": item.id,
16933
- "data-disabled": item.disabled || void 0,
16934
- "aria-disabled": item.disabled || void 0,
16935
16894
  className: cn2(
16936
16895
  "inline-flex min-w-0 shrink-0 items-center gap-0 overflow-hidden border shadow-none",
16937
16896
  menuButtonRadiusClass,
16938
- 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)))]",
16939
- item.disabled && "!cursor-not-allowed"
16897
+ 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)))]"
16940
16898
  ),
16941
16899
  style: getHeadbarCompoundStyle(isActive, useTokenRadius),
16942
16900
  children: [
@@ -16952,16 +16910,7 @@ function NavigationHeadbarMenu({
16952
16910
  "span",
16953
16911
  {
16954
16912
  "data-navigation-headbar-secondary-action": item.id,
16955
- "aria-disabled": item.disabled || void 0,
16956
- ...item.disabled ? { inert: "" } : {},
16957
- onClickCapture: item.disabled ? preventDisabledNavigationInteraction : void 0,
16958
- onKeyDownCapture: item.disabled ? preventDisabledNavigationInteraction : void 0,
16959
- onKeyUpCapture: item.disabled ? preventDisabledNavigationInteraction : void 0,
16960
- onPointerDownCapture: item.disabled ? preventDisabledNavigationInteraction : void 0,
16961
- className: cn2(
16962
- "inline-flex min-w-0 shrink-0 items-center",
16963
- item.disabled && "!cursor-not-allowed opacity-60"
16964
- ),
16913
+ className: "inline-flex min-w-0 shrink-0 items-center",
16965
16914
  children: item.headbarSecondaryAction
16966
16915
  }
16967
16916
  )