@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/components/layout/index.d.mts +28 -1
- package/dist/components/layout/index.d.ts +28 -1
- package/dist/components/layout/index.js +126 -62
- package/dist/components/layout/index.js.map +1 -1
- package/dist/components/layout/index.mjs +125 -63
- package/dist/components/layout/index.mjs.map +1 -1
- package/dist/index.js +124 -62
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +124 -62
- package/dist/index.mjs.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -16045,16 +16045,24 @@ function getHeadbarMenuRadiusClass(menuRadius = "default", part = "all") {
|
|
|
16045
16045
|
}
|
|
16046
16046
|
return NAVIGATION_LAYOUT_MENU_RADIUS_CLASS_MAP[menuRadius][part];
|
|
16047
16047
|
}
|
|
16048
|
-
function getHeadbarFrameClass(layoutMode = "boxed") {
|
|
16049
|
-
|
|
16048
|
+
function getHeadbarFrameClass(layoutMode = "boxed", navPosition = "center") {
|
|
16049
|
+
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]";
|
|
16050
|
+
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);
|
|
16050
16051
|
}
|
|
16051
|
-
function getHeadbarFrameStyle(layoutMode = "boxed", heightPx) {
|
|
16052
|
+
function getHeadbarFrameStyle(layoutMode = "boxed", heightPx, surface = "card") {
|
|
16052
16053
|
const verticalPaddingPx = getHeadbarVerticalPaddingPx(heightPx);
|
|
16054
|
+
const fallbackBackground = "hsl(var(--background))";
|
|
16053
16055
|
const style = {
|
|
16054
|
-
height:
|
|
16055
|
-
minHeight:
|
|
16056
|
+
height: `var(--monkeys-component-navigation-headbar-height, ${heightPx}px)`,
|
|
16057
|
+
minHeight: `var(--monkeys-component-navigation-headbar-height, ${heightPx}px)`,
|
|
16056
16058
|
paddingTop: `${verticalPaddingPx}px`,
|
|
16057
|
-
paddingBottom: `${verticalPaddingPx}px
|
|
16059
|
+
paddingBottom: `${verticalPaddingPx}px`,
|
|
16060
|
+
background: `var(--monkeys-component-navigation-headbar-frame-background, ${fallbackBackground})`,
|
|
16061
|
+
color: "var(--monkeys-component-navigation-headbar-frame-foreground, hsl(var(--foreground)))",
|
|
16062
|
+
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)))",
|
|
16063
|
+
borderRadius: layoutMode === "full-bleed" ? "0" : "var(--monkeys-component-navigation-headbar-frame-radius, var(--radius, 0.75rem))",
|
|
16064
|
+
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)",
|
|
16065
|
+
backdropFilter: `blur(var(--monkeys-component-navigation-headbar-frame-backdrop-blur, ${surface === "glassy" ? "45px" : "0px"}))`
|
|
16058
16066
|
};
|
|
16059
16067
|
if (layoutMode === "full-bleed") {
|
|
16060
16068
|
style.marginLeft = "calc(var(--global-spacing,0.75rem) * -1)";
|
|
@@ -16069,6 +16077,19 @@ function getHeadbarNavClass(navPosition = "center") {
|
|
|
16069
16077
|
if (navPosition === "right") return "justify-end";
|
|
16070
16078
|
return "justify-center";
|
|
16071
16079
|
}
|
|
16080
|
+
function getHeadbarItemStyle(active, useTokenRadius = true) {
|
|
16081
|
+
return {
|
|
16082
|
+
height: "var(--monkeys-component-navigation-headbar-item-height, 2.25rem)",
|
|
16083
|
+
borderRadius: useTokenRadius ? "var(--monkeys-component-navigation-headbar-item-radius, var(--radius, 0.5rem))" : void 0,
|
|
16084
|
+
paddingInline: "var(--monkeys-component-navigation-headbar-item-padding-inline, 0.75rem)",
|
|
16085
|
+
columnGap: "var(--monkeys-component-navigation-headbar-item-gap, 0.375rem)",
|
|
16086
|
+
color: active ? "var(--monkeys-component-navigation-headbar-item-active-foreground, hsl(var(--foreground)))" : "var(--monkeys-component-navigation-headbar-item-foreground, hsl(var(--muted-foreground)))",
|
|
16087
|
+
background: active ? "var(--monkeys-component-navigation-headbar-item-active-background, hsl(var(--muted)))" : "transparent",
|
|
16088
|
+
borderColor: active ? "var(--monkeys-component-navigation-headbar-item-active-border-color, transparent)" : "transparent",
|
|
16089
|
+
fontSize: "var(--monkeys-component-navigation-headbar-item-font-size, 0.875rem)",
|
|
16090
|
+
fontWeight: "var(--monkeys-component-navigation-headbar-item-font-weight, 500)"
|
|
16091
|
+
};
|
|
16092
|
+
}
|
|
16072
16093
|
function findNavigationRootId(items, activeItemId) {
|
|
16073
16094
|
for (const item of items) {
|
|
16074
16095
|
if (item.id === activeItemId) return item.id;
|
|
@@ -16386,7 +16407,8 @@ function HeadbarNavMenuItem({
|
|
|
16386
16407
|
menuButtonRadiusClass,
|
|
16387
16408
|
menuContentRadiusClass,
|
|
16388
16409
|
menuItemRadiusClass,
|
|
16389
|
-
onNavigate
|
|
16410
|
+
onNavigate,
|
|
16411
|
+
useTokenRadius
|
|
16390
16412
|
}) {
|
|
16391
16413
|
const [open, setOpen] = React.useState(false);
|
|
16392
16414
|
const closeTimerRef = React.useRef(null);
|
|
@@ -16417,13 +16439,19 @@ function HeadbarNavMenuItem({
|
|
|
16417
16439
|
icon: item.icon,
|
|
16418
16440
|
endIcon: /* @__PURE__ */ jsxRuntime.jsx(HeadbarChevronIcon, { open }),
|
|
16419
16441
|
label: /* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate whitespace-nowrap", children: label }),
|
|
16442
|
+
disabled: item.disabled,
|
|
16420
16443
|
onClick: () => setOpen(true),
|
|
16421
16444
|
onMouseEnter: openMenu,
|
|
16422
16445
|
onMouseLeave: scheduleCloseMenu,
|
|
16446
|
+
style: getHeadbarItemStyle(isActive || open, useTokenRadius),
|
|
16447
|
+
classNames: {
|
|
16448
|
+
icon: "text-[inherit] [&_*]:!text-[inherit] [&_svg]:!stroke-current",
|
|
16449
|
+
label: "text-[inherit] [&_*]:!text-[inherit]"
|
|
16450
|
+
},
|
|
16423
16451
|
className: cn2(
|
|
16424
|
-
"
|
|
16452
|
+
"max-w-[12rem] shrink-0 border shadow-none",
|
|
16425
16453
|
menuButtonRadiusClass,
|
|
16426
|
-
isActive || open ? "
|
|
16454
|
+
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)))]"
|
|
16427
16455
|
)
|
|
16428
16456
|
}
|
|
16429
16457
|
) }),
|
|
@@ -16436,24 +16464,34 @@ function HeadbarNavMenuItem({
|
|
|
16436
16464
|
onMouseEnter: openMenu,
|
|
16437
16465
|
onMouseLeave: scheduleCloseMenu,
|
|
16438
16466
|
className: cn2(
|
|
16439
|
-
"z-50 min-w-56 border
|
|
16467
|
+
"z-50 min-w-56 border p-1.5 animate-in fade-in-0 zoom-in-95",
|
|
16440
16468
|
menuContentRadiusClass
|
|
16441
16469
|
),
|
|
16470
|
+
style: {
|
|
16471
|
+
background: "var(--monkeys-component-navigation-headbar-menu-background, hsl(var(--popover)))",
|
|
16472
|
+
borderColor: "var(--monkeys-component-navigation-headbar-menu-border-color, hsl(var(--border)))",
|
|
16473
|
+
color: "var(--monkeys-component-navigation-headbar-menu-foreground, hsl(var(--popover-foreground)))",
|
|
16474
|
+
boxShadow: "var(--monkeys-component-navigation-headbar-menu-shadow, 0 10px 15px -3px rgb(0 0 0 / 0.1))",
|
|
16475
|
+
backdropFilter: "blur(var(--monkeys-component-navigation-headbar-menu-backdrop-blur, 0px))"
|
|
16476
|
+
},
|
|
16442
16477
|
children: item.children?.map((child) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
16443
16478
|
DropdownMenu2__namespace.Item,
|
|
16444
16479
|
{
|
|
16480
|
+
disabled: child.disabled,
|
|
16445
16481
|
className: cn2(
|
|
16446
|
-
"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))]",
|
|
16447
|
-
menuItemRadiusClass
|
|
16448
|
-
child.id === activeItemId && "bg-[hsl(var(--muted))] text-[hsl(var(--foreground))]"
|
|
16482
|
+
"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)))]",
|
|
16483
|
+
menuItemRadiusClass
|
|
16449
16484
|
),
|
|
16485
|
+
style: getHeadbarItemStyle(child.id === activeItemId, useTokenRadius),
|
|
16450
16486
|
onSelect: () => {
|
|
16487
|
+
if (child.disabled) return;
|
|
16451
16488
|
setOpen(false);
|
|
16452
16489
|
onNavigate?.(child.id);
|
|
16453
16490
|
},
|
|
16454
16491
|
children: [
|
|
16455
16492
|
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,
|
|
16456
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "min-w-0 truncate", children: child.headbarLabel ?? child.label })
|
|
16493
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "min-w-0 truncate", children: child.headbarLabel ?? child.label }),
|
|
16494
|
+
child.trailing
|
|
16457
16495
|
]
|
|
16458
16496
|
},
|
|
16459
16497
|
child.id
|
|
@@ -16462,16 +16500,17 @@ function HeadbarNavMenuItem({
|
|
|
16462
16500
|
) })
|
|
16463
16501
|
] });
|
|
16464
16502
|
}
|
|
16465
|
-
function
|
|
16503
|
+
function NavigationHeadbarMenu({
|
|
16466
16504
|
activeItemId,
|
|
16467
16505
|
activeRootId,
|
|
16468
16506
|
items,
|
|
16469
|
-
menuRadius,
|
|
16507
|
+
menuRadius = "default",
|
|
16470
16508
|
onNavigate
|
|
16471
16509
|
}) {
|
|
16472
16510
|
const menuButtonRadiusClass = getHeadbarMenuRadiusClass(menuRadius);
|
|
16473
16511
|
const menuContentRadiusClass = getHeadbarMenuRadiusClass(menuRadius);
|
|
16474
16512
|
const menuItemRadiusClass = getHeadbarMenuRadiusClass(menuRadius);
|
|
16513
|
+
const useTokenRadius = menuRadius === "default";
|
|
16475
16514
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex w-max min-w-0 shrink-0 items-center gap-1", children: items.map((item) => {
|
|
16476
16515
|
const isActive = activeRootId === item.id || activeItemId === item.id;
|
|
16477
16516
|
const label = item.headbarLabel ?? item.label;
|
|
@@ -16486,7 +16525,8 @@ function HeadbarNav({
|
|
|
16486
16525
|
menuButtonRadiusClass,
|
|
16487
16526
|
menuContentRadiusClass,
|
|
16488
16527
|
menuItemRadiusClass,
|
|
16489
|
-
onNavigate
|
|
16528
|
+
onNavigate,
|
|
16529
|
+
useTokenRadius
|
|
16490
16530
|
},
|
|
16491
16531
|
item.id
|
|
16492
16532
|
);
|
|
@@ -16497,77 +16537,99 @@ function HeadbarNav({
|
|
|
16497
16537
|
appearance: NAVIGATION_LAYOUT_DEFAULT_APPEARANCE,
|
|
16498
16538
|
tone: "muted",
|
|
16499
16539
|
active: isActive,
|
|
16540
|
+
disabled: item.disabled,
|
|
16500
16541
|
icon: item.icon,
|
|
16501
|
-
label: /* @__PURE__ */ jsxRuntime.
|
|
16542
|
+
label: /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "flex min-w-0 items-center gap-1.5", children: [
|
|
16543
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate whitespace-nowrap", children: label }),
|
|
16544
|
+
item.trailing
|
|
16545
|
+
] }),
|
|
16502
16546
|
onClick: () => onNavigate?.(item.id),
|
|
16547
|
+
style: getHeadbarItemStyle(isActive, useTokenRadius),
|
|
16548
|
+
classNames: {
|
|
16549
|
+
icon: "text-[inherit] [&_*]:!text-[inherit] [&_svg]:!stroke-current",
|
|
16550
|
+
label: "text-[inherit] [&_*]:!text-[inherit]"
|
|
16551
|
+
},
|
|
16503
16552
|
className: cn2(
|
|
16504
|
-
"
|
|
16553
|
+
"max-w-[12rem] shrink-0 border shadow-none",
|
|
16505
16554
|
menuButtonRadiusClass,
|
|
16506
|
-
isActive ? "
|
|
16555
|
+
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)))]"
|
|
16507
16556
|
)
|
|
16508
16557
|
},
|
|
16509
16558
|
item.id
|
|
16510
16559
|
);
|
|
16511
16560
|
}) });
|
|
16512
16561
|
}
|
|
16513
|
-
function
|
|
16562
|
+
function NavigationHeadbar({
|
|
16514
16563
|
activeItemId,
|
|
16515
16564
|
activeRootId,
|
|
16516
16565
|
actions,
|
|
16517
16566
|
accountMenu,
|
|
16567
|
+
className,
|
|
16518
16568
|
extra,
|
|
16519
16569
|
layout,
|
|
16570
|
+
brand,
|
|
16520
16571
|
logo,
|
|
16521
|
-
|
|
16572
|
+
navigation,
|
|
16573
|
+
navItems = [],
|
|
16522
16574
|
onNavigate
|
|
16523
16575
|
}) {
|
|
16524
16576
|
const heightPx = clampHeadbarHeight(layout?.heightPx);
|
|
16525
16577
|
const layoutMode = layout?.layoutMode ?? "boxed";
|
|
16526
16578
|
const menuRadius = layout?.menuRadius ?? "default";
|
|
16579
|
+
const surface = layout?.surface ?? "card";
|
|
16527
16580
|
const logoHeightPx = getHeadbarLogoSizePx(heightPx);
|
|
16528
|
-
const frameStyle = getHeadbarFrameStyle(layoutMode, heightPx);
|
|
16581
|
+
const frameStyle = getHeadbarFrameStyle(layoutMode, heightPx, surface);
|
|
16529
16582
|
const showBrandTitle = Boolean(layout?.brandTitle);
|
|
16530
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
16531
|
-
|
|
16532
|
-
|
|
16533
|
-
|
|
16534
|
-
|
|
16535
|
-
|
|
16536
|
-
|
|
16537
|
-
|
|
16583
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
16584
|
+
"header",
|
|
16585
|
+
{
|
|
16586
|
+
className: cn2(getHeadbarFrameClass(layoutMode, layout?.navPosition), className),
|
|
16587
|
+
"data-navigation-headbar": "",
|
|
16588
|
+
"data-navigation-headbar-surface": surface,
|
|
16589
|
+
style: frameStyle,
|
|
16590
|
+
children: [
|
|
16591
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex min-w-0 items-center justify-start", children: brand ?? (logo ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
16592
|
+
BaseButton,
|
|
16538
16593
|
{
|
|
16539
|
-
|
|
16540
|
-
|
|
16541
|
-
|
|
16594
|
+
appearance: NAVIGATION_LAYOUT_DEFAULT_APPEARANCE,
|
|
16595
|
+
tone: "muted",
|
|
16596
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(
|
|
16597
|
+
"div",
|
|
16598
|
+
{
|
|
16599
|
+
className: cn2(
|
|
16600
|
+
"flex items-center justify-center overflow-hidden rounded-lg",
|
|
16601
|
+
logo.url ? "w-auto max-w-[min(22rem,30vw)] bg-transparent" : "bg-[hsl(var(--primary))] text-[hsl(var(--primary-foreground))]"
|
|
16602
|
+
),
|
|
16603
|
+
style: logo.url ? { height: logoHeightPx } : { width: logoHeightPx, height: logoHeightPx },
|
|
16604
|
+
children: logo.url ? /* @__PURE__ */ jsxRuntime.jsx("img", { src: logo.url, alt: logo.title, className: "block h-full w-auto object-contain" }) : /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-base font-bold", children: logo.title.charAt(0) })
|
|
16605
|
+
}
|
|
16542
16606
|
),
|
|
16543
|
-
|
|
16544
|
-
|
|
16607
|
+
label: showBrandTitle ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "truncate whitespace-nowrap text-base font-medium text-[hsl(var(--foreground))]", children: layout?.brandTitle }) : null,
|
|
16608
|
+
ariaLabel: logo.title,
|
|
16609
|
+
title: logo.title,
|
|
16610
|
+
className: "h-auto min-w-0 justify-start border-transparent bg-transparent p-0 shadow-none hover:bg-transparent",
|
|
16611
|
+
classNames: logo.url ? { icon: "!h-auto !w-auto shrink-0" } : void 0,
|
|
16612
|
+
onClick: logo.onClick
|
|
16545
16613
|
}
|
|
16546
|
-
),
|
|
16547
|
-
|
|
16548
|
-
|
|
16549
|
-
|
|
16550
|
-
|
|
16551
|
-
|
|
16552
|
-
|
|
16553
|
-
|
|
16554
|
-
|
|
16555
|
-
|
|
16556
|
-
|
|
16557
|
-
|
|
16558
|
-
|
|
16559
|
-
|
|
16560
|
-
|
|
16561
|
-
|
|
16562
|
-
|
|
16563
|
-
|
|
16564
|
-
|
|
16565
|
-
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex min-w-0 items-center justify-end gap-3", children: [
|
|
16566
|
-
actions,
|
|
16567
|
-
extra,
|
|
16568
|
-
accountMenu
|
|
16569
|
-
] })
|
|
16570
|
-
] });
|
|
16614
|
+
) : null) }),
|
|
16615
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: cn2("flex min-w-0 items-center", getHeadbarNavClass(layout?.navPosition)), children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "no-scrollbar flex max-w-full min-w-0 items-center overflow-x-auto overscroll-x-contain", children: navigation ?? /* @__PURE__ */ jsxRuntime.jsx(
|
|
16616
|
+
NavigationHeadbarMenu,
|
|
16617
|
+
{
|
|
16618
|
+
activeItemId,
|
|
16619
|
+
activeRootId,
|
|
16620
|
+
items: navItems,
|
|
16621
|
+
menuRadius,
|
|
16622
|
+
onNavigate
|
|
16623
|
+
}
|
|
16624
|
+
) }) }),
|
|
16625
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex min-w-0 items-center justify-end gap-3", children: [
|
|
16626
|
+
actions,
|
|
16627
|
+
extra,
|
|
16628
|
+
accountMenu
|
|
16629
|
+
] })
|
|
16630
|
+
]
|
|
16631
|
+
}
|
|
16632
|
+
);
|
|
16571
16633
|
}
|
|
16572
16634
|
function NavigationLayout({
|
|
16573
16635
|
activeItemId,
|
|
@@ -16683,7 +16745,7 @@ function NavigationLayout({
|
|
|
16683
16745
|
}
|
|
16684
16746
|
);
|
|
16685
16747
|
const header = isHeadbarMode ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
16686
|
-
|
|
16748
|
+
NavigationHeadbar,
|
|
16687
16749
|
{
|
|
16688
16750
|
activeItemId,
|
|
16689
16751
|
activeRootId: activeRootId ?? findNavigationRootId(navItems, activeItemId),
|