@inf-monkeys-tech/monkeys-design 1.0.4 → 1.0.6

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
@@ -16016,16 +16016,24 @@ function getHeadbarMenuRadiusClass(menuRadius = "default", part = "all") {
16016
16016
  }
16017
16017
  return NAVIGATION_LAYOUT_MENU_RADIUS_CLASS_MAP[menuRadius][part];
16018
16018
  }
16019
- function getHeadbarFrameClass(layoutMode = "boxed") {
16020
- return layoutMode === "full-bleed" ? "relative z-40 grid w-full shrink-0 grid-cols-[minmax(max-content,1fr)_minmax(0,max-content)_minmax(max-content,1fr)] items-center gap-4 rounded-none border-b border-x-0 border-t-0 border-[hsl(var(--input))] bg-[hsl(var(--background))] p-[var(--global-spacing,0.75rem)]" : "relative z-40 grid w-full shrink-0 grid-cols-[minmax(max-content,1fr)_minmax(0,max-content)_minmax(max-content,1fr)] items-center gap-4 rounded-xl border border-[hsl(var(--input))] bg-[hsl(var(--background))] p-[var(--global-spacing,0.75rem)]";
16019
+ function getHeadbarFrameClass(layoutMode = "boxed", navPosition = "center") {
16020
+ const columns = navPosition === "center" ? "grid-cols-[minmax(max-content,1fr)_minmax(0,max-content)_minmax(max-content,1fr)]" : "grid-cols-[max-content_minmax(0,1fr)_max-content]";
16021
+ return layoutMode === "full-bleed" ? cn2("sticky top-0 z-40 grid w-full shrink-0 items-center gap-4 rounded-none border-b border-x-0 border-t-0 border-[hsl(var(--input))] bg-[hsl(var(--background))] p-[var(--global-spacing,0.75rem)]", columns) : cn2("sticky top-0 z-40 grid w-full shrink-0 items-center gap-4 rounded-xl border border-[hsl(var(--input))] bg-[hsl(var(--background))] p-[var(--global-spacing,0.75rem)]", columns);
16021
16022
  }
16022
- function getHeadbarFrameStyle(layoutMode = "boxed", heightPx) {
16023
+ function getHeadbarFrameStyle(layoutMode = "boxed", heightPx, surface = "card") {
16023
16024
  const verticalPaddingPx = getHeadbarVerticalPaddingPx(heightPx);
16025
+ const fallbackBackground = "hsl(var(--background))";
16024
16026
  const style = {
16025
- height: `${heightPx}px`,
16026
- minHeight: `${heightPx}px`,
16027
+ height: `var(--monkeys-component-navigation-headbar-height, ${heightPx}px)`,
16028
+ minHeight: `var(--monkeys-component-navigation-headbar-height, ${heightPx}px)`,
16027
16029
  paddingTop: `${verticalPaddingPx}px`,
16028
- paddingBottom: `${verticalPaddingPx}px`
16030
+ paddingBottom: `${verticalPaddingPx}px`,
16031
+ background: `var(--monkeys-component-navigation-headbar-frame-background, ${fallbackBackground})`,
16032
+ color: "var(--monkeys-component-navigation-headbar-frame-foreground, hsl(var(--foreground)))",
16033
+ borderColor: surface === "glassy" ? "var(--monkeys-component-navigation-headbar-frame-border-color, rgb(255 255 255 / 0.5))" : "var(--monkeys-component-navigation-headbar-frame-border-color, hsl(var(--input)))",
16034
+ borderRadius: layoutMode === "full-bleed" ? "0" : "var(--monkeys-component-navigation-headbar-frame-radius, var(--radius, 0.75rem))",
16035
+ boxShadow: surface === "glassy" ? "var(--monkeys-component-navigation-headbar-frame-shadow, inset 0 0 0 0 rgb(0 0 0 / 0.1))" : "var(--monkeys-component-navigation-headbar-frame-shadow, none)",
16036
+ backdropFilter: `blur(var(--monkeys-component-navigation-headbar-frame-backdrop-blur, ${surface === "glassy" ? "45px" : "0px"}))`
16029
16037
  };
16030
16038
  if (layoutMode === "full-bleed") {
16031
16039
  style.marginLeft = "calc(var(--global-spacing,0.75rem) * -1)";
@@ -16040,6 +16048,19 @@ function getHeadbarNavClass(navPosition = "center") {
16040
16048
  if (navPosition === "right") return "justify-end";
16041
16049
  return "justify-center";
16042
16050
  }
16051
+ function getHeadbarItemStyle(active, useTokenRadius = true) {
16052
+ return {
16053
+ height: "var(--monkeys-component-navigation-headbar-item-height, 2.25rem)",
16054
+ borderRadius: useTokenRadius ? "var(--monkeys-component-navigation-headbar-item-radius, var(--radius, 0.5rem))" : void 0,
16055
+ paddingInline: "var(--monkeys-component-navigation-headbar-item-padding-inline, 0.75rem)",
16056
+ columnGap: "var(--monkeys-component-navigation-headbar-item-gap, 0.375rem)",
16057
+ color: active ? "var(--monkeys-component-navigation-headbar-item-active-foreground, hsl(var(--foreground)))" : "var(--monkeys-component-navigation-headbar-item-foreground, hsl(var(--muted-foreground)))",
16058
+ background: active ? "var(--monkeys-component-navigation-headbar-item-active-background, hsl(var(--muted)))" : "transparent",
16059
+ borderColor: active ? "var(--monkeys-component-navigation-headbar-item-active-border-color, transparent)" : "transparent",
16060
+ fontSize: "var(--monkeys-component-navigation-headbar-item-font-size, 0.875rem)",
16061
+ fontWeight: "var(--monkeys-component-navigation-headbar-item-font-weight, 500)"
16062
+ };
16063
+ }
16043
16064
  function findNavigationRootId(items, activeItemId) {
16044
16065
  for (const item of items) {
16045
16066
  if (item.id === activeItemId) return item.id;
@@ -16357,7 +16378,8 @@ function HeadbarNavMenuItem({
16357
16378
  menuButtonRadiusClass,
16358
16379
  menuContentRadiusClass,
16359
16380
  menuItemRadiusClass,
16360
- onNavigate
16381
+ onNavigate,
16382
+ useTokenRadius
16361
16383
  }) {
16362
16384
  const [open, setOpen] = useState(false);
16363
16385
  const closeTimerRef = useRef(null);
@@ -16388,13 +16410,19 @@ function HeadbarNavMenuItem({
16388
16410
  icon: item.icon,
16389
16411
  endIcon: /* @__PURE__ */ jsx(HeadbarChevronIcon, { open }),
16390
16412
  label: /* @__PURE__ */ jsx("span", { className: "truncate whitespace-nowrap", children: label }),
16413
+ disabled: item.disabled,
16391
16414
  onClick: () => setOpen(true),
16392
16415
  onMouseEnter: openMenu,
16393
16416
  onMouseLeave: scheduleCloseMenu,
16417
+ style: getHeadbarItemStyle(isActive || open, useTokenRadius),
16418
+ classNames: {
16419
+ icon: "text-[inherit] [&_*]:!text-[inherit] [&_svg]:!stroke-current",
16420
+ label: "text-[inherit] [&_*]:!text-[inherit]"
16421
+ },
16394
16422
  className: cn2(
16395
- "h-9 max-w-[12rem] shrink-0 border-transparent px-3 text-sm font-medium shadow-none",
16423
+ "max-w-[12rem] shrink-0 border shadow-none",
16396
16424
  menuButtonRadiusClass,
16397
- isActive || open ? "!bg-[hsl(var(--muted))] text-[hsl(var(--foreground))]" : "!bg-transparent text-[hsl(var(--muted-foreground))] hover:!bg-[hsl(var(--muted))]/60 hover:text-[hsl(var(--foreground))]"
16425
+ 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)))]"
16398
16426
  )
16399
16427
  }
16400
16428
  ) }),
@@ -16407,24 +16435,34 @@ function HeadbarNavMenuItem({
16407
16435
  onMouseEnter: openMenu,
16408
16436
  onMouseLeave: scheduleCloseMenu,
16409
16437
  className: cn2(
16410
- "z-50 min-w-56 border border-[hsl(var(--border))] bg-[hsl(var(--popover))] p-1.5 text-[hsl(var(--popover-foreground))] shadow-md animate-in fade-in-0 zoom-in-95",
16438
+ "z-50 min-w-56 border p-1.5 animate-in fade-in-0 zoom-in-95",
16411
16439
  menuContentRadiusClass
16412
16440
  ),
16441
+ style: {
16442
+ background: "var(--monkeys-component-navigation-headbar-menu-background, hsl(var(--popover)))",
16443
+ borderColor: "var(--monkeys-component-navigation-headbar-menu-border-color, hsl(var(--border)))",
16444
+ color: "var(--monkeys-component-navigation-headbar-menu-foreground, hsl(var(--popover-foreground)))",
16445
+ boxShadow: "var(--monkeys-component-navigation-headbar-menu-shadow, 0 10px 15px -3px rgb(0 0 0 / 0.1))",
16446
+ backdropFilter: "blur(var(--monkeys-component-navigation-headbar-menu-backdrop-blur, 0px))"
16447
+ },
16413
16448
  children: item.children?.map((child) => /* @__PURE__ */ jsxs(
16414
16449
  DropdownMenu2.Item,
16415
16450
  {
16451
+ disabled: child.disabled,
16416
16452
  className: cn2(
16417
- "relative flex cursor-pointer select-none items-center gap-2.5 px-3 py-2 text-sm outline-none transition-colors hover:bg-[hsl(var(--accent))]",
16418
- menuItemRadiusClass,
16419
- child.id === activeItemId && "bg-[hsl(var(--muted))] text-[hsl(var(--foreground))]"
16453
+ "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)))]",
16454
+ menuItemRadiusClass
16420
16455
  ),
16456
+ style: getHeadbarItemStyle(child.id === activeItemId, useTokenRadius),
16421
16457
  onSelect: () => {
16458
+ if (child.disabled) return;
16422
16459
  setOpen(false);
16423
16460
  onNavigate?.(child.id);
16424
16461
  },
16425
16462
  children: [
16426
16463
  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,
16427
- /* @__PURE__ */ jsx("span", { className: "min-w-0 truncate", children: child.headbarLabel ?? child.label })
16464
+ /* @__PURE__ */ jsx("span", { className: "min-w-0 truncate", children: child.headbarLabel ?? child.label }),
16465
+ child.trailing
16428
16466
  ]
16429
16467
  },
16430
16468
  child.id
@@ -16433,16 +16471,17 @@ function HeadbarNavMenuItem({
16433
16471
  ) })
16434
16472
  ] });
16435
16473
  }
16436
- function HeadbarNav({
16474
+ function NavigationHeadbarMenu({
16437
16475
  activeItemId,
16438
16476
  activeRootId,
16439
16477
  items,
16440
- menuRadius,
16478
+ menuRadius = "default",
16441
16479
  onNavigate
16442
16480
  }) {
16443
16481
  const menuButtonRadiusClass = getHeadbarMenuRadiusClass(menuRadius);
16444
16482
  const menuContentRadiusClass = getHeadbarMenuRadiusClass(menuRadius);
16445
16483
  const menuItemRadiusClass = getHeadbarMenuRadiusClass(menuRadius);
16484
+ const useTokenRadius = menuRadius === "default";
16446
16485
  return /* @__PURE__ */ jsx("div", { className: "flex w-max min-w-0 shrink-0 items-center gap-1", children: items.map((item) => {
16447
16486
  const isActive = activeRootId === item.id || activeItemId === item.id;
16448
16487
  const label = item.headbarLabel ?? item.label;
@@ -16457,7 +16496,8 @@ function HeadbarNav({
16457
16496
  menuButtonRadiusClass,
16458
16497
  menuContentRadiusClass,
16459
16498
  menuItemRadiusClass,
16460
- onNavigate
16499
+ onNavigate,
16500
+ useTokenRadius
16461
16501
  },
16462
16502
  item.id
16463
16503
  );
@@ -16468,77 +16508,99 @@ function HeadbarNav({
16468
16508
  appearance: NAVIGATION_LAYOUT_DEFAULT_APPEARANCE,
16469
16509
  tone: "muted",
16470
16510
  active: isActive,
16511
+ disabled: item.disabled,
16471
16512
  icon: item.icon,
16472
- label: /* @__PURE__ */ jsx("span", { className: "truncate whitespace-nowrap", children: label }),
16513
+ label: /* @__PURE__ */ jsxs("span", { className: "flex min-w-0 items-center gap-1.5", children: [
16514
+ /* @__PURE__ */ jsx("span", { className: "truncate whitespace-nowrap", children: label }),
16515
+ item.trailing
16516
+ ] }),
16473
16517
  onClick: () => onNavigate?.(item.id),
16518
+ style: getHeadbarItemStyle(isActive, useTokenRadius),
16519
+ classNames: {
16520
+ icon: "text-[inherit] [&_*]:!text-[inherit] [&_svg]:!stroke-current",
16521
+ label: "text-[inherit] [&_*]:!text-[inherit]"
16522
+ },
16474
16523
  className: cn2(
16475
- "h-9 max-w-[12rem] shrink-0 border-transparent px-3 text-sm font-medium shadow-none",
16524
+ "max-w-[12rem] shrink-0 border shadow-none",
16476
16525
  menuButtonRadiusClass,
16477
- isActive ? "!bg-[hsl(var(--muted))] text-[hsl(var(--foreground))]" : "!bg-transparent text-[hsl(var(--muted-foreground))] hover:!bg-[hsl(var(--muted))]/60 hover:text-[hsl(var(--foreground))]"
16526
+ 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)))]"
16478
16527
  )
16479
16528
  },
16480
16529
  item.id
16481
16530
  );
16482
16531
  }) });
16483
16532
  }
16484
- function Headbar({
16533
+ function NavigationHeadbar({
16485
16534
  activeItemId,
16486
16535
  activeRootId,
16487
16536
  actions,
16488
16537
  accountMenu,
16538
+ className,
16489
16539
  extra,
16490
16540
  layout,
16541
+ brand,
16491
16542
  logo,
16492
- navItems,
16543
+ navigation,
16544
+ navItems = [],
16493
16545
  onNavigate
16494
16546
  }) {
16495
16547
  const heightPx = clampHeadbarHeight(layout?.heightPx);
16496
16548
  const layoutMode = layout?.layoutMode ?? "boxed";
16497
16549
  const menuRadius = layout?.menuRadius ?? "default";
16550
+ const surface = layout?.surface ?? "card";
16498
16551
  const logoHeightPx = getHeadbarLogoSizePx(heightPx);
16499
- const frameStyle = getHeadbarFrameStyle(layoutMode, heightPx);
16552
+ const frameStyle = getHeadbarFrameStyle(layoutMode, heightPx, surface);
16500
16553
  const showBrandTitle = Boolean(layout?.brandTitle);
16501
- return /* @__PURE__ */ jsxs("header", { className: getHeadbarFrameClass(layoutMode), style: frameStyle, children: [
16502
- /* @__PURE__ */ jsx("div", { className: "flex min-w-0 items-center justify-start", children: logo ? /* @__PURE__ */ jsx(
16503
- BaseButton,
16504
- {
16505
- appearance: NAVIGATION_LAYOUT_DEFAULT_APPEARANCE,
16506
- tone: "muted",
16507
- icon: /* @__PURE__ */ jsx(
16508
- "div",
16554
+ return /* @__PURE__ */ jsxs(
16555
+ "header",
16556
+ {
16557
+ className: cn2(getHeadbarFrameClass(layoutMode, layout?.navPosition), className),
16558
+ "data-navigation-headbar": "",
16559
+ "data-navigation-headbar-surface": surface,
16560
+ style: frameStyle,
16561
+ children: [
16562
+ /* @__PURE__ */ jsx("div", { className: "flex min-w-0 items-center justify-start", children: brand ?? (logo ? /* @__PURE__ */ jsx(
16563
+ BaseButton,
16509
16564
  {
16510
- className: cn2(
16511
- "flex items-center justify-center overflow-hidden rounded-lg",
16512
- logo.url ? "w-auto max-w-[min(22rem,30vw)] bg-transparent" : "bg-[hsl(var(--primary))] text-[hsl(var(--primary-foreground))]"
16565
+ appearance: NAVIGATION_LAYOUT_DEFAULT_APPEARANCE,
16566
+ tone: "muted",
16567
+ icon: /* @__PURE__ */ jsx(
16568
+ "div",
16569
+ {
16570
+ className: cn2(
16571
+ "flex items-center justify-center overflow-hidden rounded-lg",
16572
+ logo.url ? "w-auto max-w-[min(22rem,30vw)] bg-transparent" : "bg-[hsl(var(--primary))] text-[hsl(var(--primary-foreground))]"
16573
+ ),
16574
+ style: logo.url ? { height: logoHeightPx } : { width: logoHeightPx, height: logoHeightPx },
16575
+ children: logo.url ? /* @__PURE__ */ jsx("img", { src: logo.url, alt: logo.title, className: "block h-full w-auto object-contain" }) : /* @__PURE__ */ jsx("span", { className: "text-base font-bold", children: logo.title.charAt(0) })
16576
+ }
16513
16577
  ),
16514
- style: logo.url ? { height: logoHeightPx } : { width: logoHeightPx, height: logoHeightPx },
16515
- children: logo.url ? /* @__PURE__ */ jsx("img", { src: logo.url, alt: logo.title, className: "block h-full w-auto object-contain" }) : /* @__PURE__ */ jsx("span", { className: "text-base font-bold", children: logo.title.charAt(0) })
16578
+ label: showBrandTitle ? /* @__PURE__ */ jsx("span", { className: "truncate whitespace-nowrap text-base font-medium text-[hsl(var(--foreground))]", children: layout?.brandTitle }) : null,
16579
+ ariaLabel: logo.title,
16580
+ title: logo.title,
16581
+ className: "h-auto min-w-0 justify-start border-transparent bg-transparent p-0 shadow-none hover:bg-transparent",
16582
+ classNames: logo.url ? { icon: "!h-auto !w-auto shrink-0" } : void 0,
16583
+ onClick: logo.onClick
16516
16584
  }
16517
- ),
16518
- label: showBrandTitle ? /* @__PURE__ */ jsx("span", { className: "truncate whitespace-nowrap text-base font-medium text-[hsl(var(--foreground))]", children: layout?.brandTitle }) : null,
16519
- ariaLabel: logo.title,
16520
- title: logo.title,
16521
- className: "h-auto min-w-0 justify-start border-transparent bg-transparent p-0 shadow-none hover:bg-transparent",
16522
- classNames: logo.url ? { icon: "!h-auto !w-auto shrink-0" } : void 0,
16523
- onClick: logo.onClick
16524
- }
16525
- ) : null }),
16526
- /* @__PURE__ */ jsx("div", { className: cn2("flex min-w-0 items-center", getHeadbarNavClass(layout?.navPosition)), children: /* @__PURE__ */ jsx("div", { className: "no-scrollbar flex max-w-full min-w-0 items-center overflow-x-auto overscroll-x-contain", children: /* @__PURE__ */ jsx(
16527
- HeadbarNav,
16528
- {
16529
- activeItemId,
16530
- activeRootId,
16531
- items: navItems,
16532
- menuRadius,
16533
- onNavigate
16534
- }
16535
- ) }) }),
16536
- /* @__PURE__ */ jsxs("div", { className: "flex min-w-0 items-center justify-end gap-3", children: [
16537
- actions,
16538
- extra,
16539
- accountMenu
16540
- ] })
16541
- ] });
16585
+ ) : null) }),
16586
+ /* @__PURE__ */ jsx("div", { className: cn2("flex min-w-0 items-center", getHeadbarNavClass(layout?.navPosition)), children: /* @__PURE__ */ jsx("div", { className: "no-scrollbar flex max-w-full min-w-0 items-center overflow-x-auto overscroll-x-contain", children: navigation ?? /* @__PURE__ */ jsx(
16587
+ NavigationHeadbarMenu,
16588
+ {
16589
+ activeItemId,
16590
+ activeRootId,
16591
+ items: navItems,
16592
+ menuRadius,
16593
+ onNavigate
16594
+ }
16595
+ ) }) }),
16596
+ /* @__PURE__ */ jsxs("div", { className: "flex min-w-0 items-center justify-end gap-3", children: [
16597
+ actions,
16598
+ extra,
16599
+ accountMenu
16600
+ ] })
16601
+ ]
16602
+ }
16603
+ );
16542
16604
  }
16543
16605
  function NavigationLayout({
16544
16606
  activeItemId,
@@ -16654,7 +16716,7 @@ function NavigationLayout({
16654
16716
  }
16655
16717
  );
16656
16718
  const header = isHeadbarMode ? /* @__PURE__ */ jsx(
16657
- Headbar,
16719
+ NavigationHeadbar,
16658
16720
  {
16659
16721
  activeItemId,
16660
16722
  activeRootId: activeRootId ?? findNavigationRootId(navItems, activeItemId),