@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
|
@@ -2856,16 +2856,24 @@ function getHeadbarMenuRadiusClass(menuRadius = "default", part = "all") {
|
|
|
2856
2856
|
}
|
|
2857
2857
|
return NAVIGATION_LAYOUT_MENU_RADIUS_CLASS_MAP[menuRadius][part];
|
|
2858
2858
|
}
|
|
2859
|
-
function getHeadbarFrameClass(layoutMode = "boxed") {
|
|
2860
|
-
|
|
2859
|
+
function getHeadbarFrameClass(layoutMode = "boxed", navPosition = "center") {
|
|
2860
|
+
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]";
|
|
2861
|
+
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);
|
|
2861
2862
|
}
|
|
2862
|
-
function getHeadbarFrameStyle(layoutMode = "boxed", heightPx) {
|
|
2863
|
+
function getHeadbarFrameStyle(layoutMode = "boxed", heightPx, surface = "card") {
|
|
2863
2864
|
const verticalPaddingPx = getHeadbarVerticalPaddingPx(heightPx);
|
|
2865
|
+
const fallbackBackground = "hsl(var(--background))";
|
|
2864
2866
|
const style = {
|
|
2865
|
-
height:
|
|
2866
|
-
minHeight:
|
|
2867
|
+
height: `var(--monkeys-component-navigation-headbar-height, ${heightPx}px)`,
|
|
2868
|
+
minHeight: `var(--monkeys-component-navigation-headbar-height, ${heightPx}px)`,
|
|
2867
2869
|
paddingTop: `${verticalPaddingPx}px`,
|
|
2868
|
-
paddingBottom: `${verticalPaddingPx}px
|
|
2870
|
+
paddingBottom: `${verticalPaddingPx}px`,
|
|
2871
|
+
background: `var(--monkeys-component-navigation-headbar-frame-background, ${fallbackBackground})`,
|
|
2872
|
+
color: "var(--monkeys-component-navigation-headbar-frame-foreground, hsl(var(--foreground)))",
|
|
2873
|
+
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)))",
|
|
2874
|
+
borderRadius: layoutMode === "full-bleed" ? "0" : "var(--monkeys-component-navigation-headbar-frame-radius, var(--radius, 0.75rem))",
|
|
2875
|
+
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)",
|
|
2876
|
+
backdropFilter: `blur(var(--monkeys-component-navigation-headbar-frame-backdrop-blur, ${surface === "glassy" ? "45px" : "0px"}))`
|
|
2869
2877
|
};
|
|
2870
2878
|
if (layoutMode === "full-bleed") {
|
|
2871
2879
|
style.marginLeft = "calc(var(--global-spacing,0.75rem) * -1)";
|
|
@@ -2880,6 +2888,19 @@ function getHeadbarNavClass(navPosition = "center") {
|
|
|
2880
2888
|
if (navPosition === "right") return "justify-end";
|
|
2881
2889
|
return "justify-center";
|
|
2882
2890
|
}
|
|
2891
|
+
function getHeadbarItemStyle(active, useTokenRadius = true) {
|
|
2892
|
+
return {
|
|
2893
|
+
height: "var(--monkeys-component-navigation-headbar-item-height, 2.25rem)",
|
|
2894
|
+
borderRadius: useTokenRadius ? "var(--monkeys-component-navigation-headbar-item-radius, var(--radius, 0.5rem))" : void 0,
|
|
2895
|
+
paddingInline: "var(--monkeys-component-navigation-headbar-item-padding-inline, 0.75rem)",
|
|
2896
|
+
columnGap: "var(--monkeys-component-navigation-headbar-item-gap, 0.375rem)",
|
|
2897
|
+
color: active ? "var(--monkeys-component-navigation-headbar-item-active-foreground, hsl(var(--foreground)))" : "var(--monkeys-component-navigation-headbar-item-foreground, hsl(var(--muted-foreground)))",
|
|
2898
|
+
background: active ? "var(--monkeys-component-navigation-headbar-item-active-background, hsl(var(--muted)))" : "transparent",
|
|
2899
|
+
borderColor: active ? "var(--monkeys-component-navigation-headbar-item-active-border-color, transparent)" : "transparent",
|
|
2900
|
+
fontSize: "var(--monkeys-component-navigation-headbar-item-font-size, 0.875rem)",
|
|
2901
|
+
fontWeight: "var(--monkeys-component-navigation-headbar-item-font-weight, 500)"
|
|
2902
|
+
};
|
|
2903
|
+
}
|
|
2883
2904
|
function findNavigationRootId(items, activeItemId) {
|
|
2884
2905
|
for (const item of items) {
|
|
2885
2906
|
if (item.id === activeItemId) return item.id;
|
|
@@ -3197,7 +3218,8 @@ function HeadbarNavMenuItem({
|
|
|
3197
3218
|
menuButtonRadiusClass,
|
|
3198
3219
|
menuContentRadiusClass,
|
|
3199
3220
|
menuItemRadiusClass,
|
|
3200
|
-
onNavigate
|
|
3221
|
+
onNavigate,
|
|
3222
|
+
useTokenRadius
|
|
3201
3223
|
}) {
|
|
3202
3224
|
const [open, setOpen] = useState(false);
|
|
3203
3225
|
const closeTimerRef = useRef(null);
|
|
@@ -3228,13 +3250,19 @@ function HeadbarNavMenuItem({
|
|
|
3228
3250
|
icon: item.icon,
|
|
3229
3251
|
endIcon: /* @__PURE__ */ jsx(HeadbarChevronIcon, { open }),
|
|
3230
3252
|
label: /* @__PURE__ */ jsx("span", { className: "truncate whitespace-nowrap", children: label }),
|
|
3253
|
+
disabled: item.disabled,
|
|
3231
3254
|
onClick: () => setOpen(true),
|
|
3232
3255
|
onMouseEnter: openMenu,
|
|
3233
3256
|
onMouseLeave: scheduleCloseMenu,
|
|
3257
|
+
style: getHeadbarItemStyle(isActive || open, useTokenRadius),
|
|
3258
|
+
classNames: {
|
|
3259
|
+
icon: "text-[inherit] [&_*]:!text-[inherit] [&_svg]:!stroke-current",
|
|
3260
|
+
label: "text-[inherit] [&_*]:!text-[inherit]"
|
|
3261
|
+
},
|
|
3234
3262
|
className: cn2(
|
|
3235
|
-
"
|
|
3263
|
+
"max-w-[12rem] shrink-0 border shadow-none",
|
|
3236
3264
|
menuButtonRadiusClass,
|
|
3237
|
-
isActive || open ? "
|
|
3265
|
+
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)))]"
|
|
3238
3266
|
)
|
|
3239
3267
|
}
|
|
3240
3268
|
) }),
|
|
@@ -3247,24 +3275,34 @@ function HeadbarNavMenuItem({
|
|
|
3247
3275
|
onMouseEnter: openMenu,
|
|
3248
3276
|
onMouseLeave: scheduleCloseMenu,
|
|
3249
3277
|
className: cn2(
|
|
3250
|
-
"z-50 min-w-56 border
|
|
3278
|
+
"z-50 min-w-56 border p-1.5 animate-in fade-in-0 zoom-in-95",
|
|
3251
3279
|
menuContentRadiusClass
|
|
3252
3280
|
),
|
|
3281
|
+
style: {
|
|
3282
|
+
background: "var(--monkeys-component-navigation-headbar-menu-background, hsl(var(--popover)))",
|
|
3283
|
+
borderColor: "var(--monkeys-component-navigation-headbar-menu-border-color, hsl(var(--border)))",
|
|
3284
|
+
color: "var(--monkeys-component-navigation-headbar-menu-foreground, hsl(var(--popover-foreground)))",
|
|
3285
|
+
boxShadow: "var(--monkeys-component-navigation-headbar-menu-shadow, 0 10px 15px -3px rgb(0 0 0 / 0.1))",
|
|
3286
|
+
backdropFilter: "blur(var(--monkeys-component-navigation-headbar-menu-backdrop-blur, 0px))"
|
|
3287
|
+
},
|
|
3253
3288
|
children: item.children?.map((child) => /* @__PURE__ */ jsxs(
|
|
3254
3289
|
DropdownMenu.Item,
|
|
3255
3290
|
{
|
|
3291
|
+
disabled: child.disabled,
|
|
3256
3292
|
className: cn2(
|
|
3257
|
-
"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))]",
|
|
3258
|
-
menuItemRadiusClass
|
|
3259
|
-
child.id === activeItemId && "bg-[hsl(var(--muted))] text-[hsl(var(--foreground))]"
|
|
3293
|
+
"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)))]",
|
|
3294
|
+
menuItemRadiusClass
|
|
3260
3295
|
),
|
|
3296
|
+
style: getHeadbarItemStyle(child.id === activeItemId, useTokenRadius),
|
|
3261
3297
|
onSelect: () => {
|
|
3298
|
+
if (child.disabled) return;
|
|
3262
3299
|
setOpen(false);
|
|
3263
3300
|
onNavigate?.(child.id);
|
|
3264
3301
|
},
|
|
3265
3302
|
children: [
|
|
3266
3303
|
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,
|
|
3267
|
-
/* @__PURE__ */ jsx("span", { className: "min-w-0 truncate", children: child.headbarLabel ?? child.label })
|
|
3304
|
+
/* @__PURE__ */ jsx("span", { className: "min-w-0 truncate", children: child.headbarLabel ?? child.label }),
|
|
3305
|
+
child.trailing
|
|
3268
3306
|
]
|
|
3269
3307
|
},
|
|
3270
3308
|
child.id
|
|
@@ -3273,16 +3311,17 @@ function HeadbarNavMenuItem({
|
|
|
3273
3311
|
) })
|
|
3274
3312
|
] });
|
|
3275
3313
|
}
|
|
3276
|
-
function
|
|
3314
|
+
function NavigationHeadbarMenu({
|
|
3277
3315
|
activeItemId,
|
|
3278
3316
|
activeRootId,
|
|
3279
3317
|
items,
|
|
3280
|
-
menuRadius,
|
|
3318
|
+
menuRadius = "default",
|
|
3281
3319
|
onNavigate
|
|
3282
3320
|
}) {
|
|
3283
3321
|
const menuButtonRadiusClass = getHeadbarMenuRadiusClass(menuRadius);
|
|
3284
3322
|
const menuContentRadiusClass = getHeadbarMenuRadiusClass(menuRadius);
|
|
3285
3323
|
const menuItemRadiusClass = getHeadbarMenuRadiusClass(menuRadius);
|
|
3324
|
+
const useTokenRadius = menuRadius === "default";
|
|
3286
3325
|
return /* @__PURE__ */ jsx("div", { className: "flex w-max min-w-0 shrink-0 items-center gap-1", children: items.map((item) => {
|
|
3287
3326
|
const isActive = activeRootId === item.id || activeItemId === item.id;
|
|
3288
3327
|
const label = item.headbarLabel ?? item.label;
|
|
@@ -3297,7 +3336,8 @@ function HeadbarNav({
|
|
|
3297
3336
|
menuButtonRadiusClass,
|
|
3298
3337
|
menuContentRadiusClass,
|
|
3299
3338
|
menuItemRadiusClass,
|
|
3300
|
-
onNavigate
|
|
3339
|
+
onNavigate,
|
|
3340
|
+
useTokenRadius
|
|
3301
3341
|
},
|
|
3302
3342
|
item.id
|
|
3303
3343
|
);
|
|
@@ -3308,77 +3348,99 @@ function HeadbarNav({
|
|
|
3308
3348
|
appearance: NAVIGATION_LAYOUT_DEFAULT_APPEARANCE,
|
|
3309
3349
|
tone: "muted",
|
|
3310
3350
|
active: isActive,
|
|
3351
|
+
disabled: item.disabled,
|
|
3311
3352
|
icon: item.icon,
|
|
3312
|
-
label: /* @__PURE__ */
|
|
3353
|
+
label: /* @__PURE__ */ jsxs("span", { className: "flex min-w-0 items-center gap-1.5", children: [
|
|
3354
|
+
/* @__PURE__ */ jsx("span", { className: "truncate whitespace-nowrap", children: label }),
|
|
3355
|
+
item.trailing
|
|
3356
|
+
] }),
|
|
3313
3357
|
onClick: () => onNavigate?.(item.id),
|
|
3358
|
+
style: getHeadbarItemStyle(isActive, useTokenRadius),
|
|
3359
|
+
classNames: {
|
|
3360
|
+
icon: "text-[inherit] [&_*]:!text-[inherit] [&_svg]:!stroke-current",
|
|
3361
|
+
label: "text-[inherit] [&_*]:!text-[inherit]"
|
|
3362
|
+
},
|
|
3314
3363
|
className: cn2(
|
|
3315
|
-
"
|
|
3364
|
+
"max-w-[12rem] shrink-0 border shadow-none",
|
|
3316
3365
|
menuButtonRadiusClass,
|
|
3317
|
-
isActive ? "
|
|
3366
|
+
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)))]"
|
|
3318
3367
|
)
|
|
3319
3368
|
},
|
|
3320
3369
|
item.id
|
|
3321
3370
|
);
|
|
3322
3371
|
}) });
|
|
3323
3372
|
}
|
|
3324
|
-
function
|
|
3373
|
+
function NavigationHeadbar({
|
|
3325
3374
|
activeItemId,
|
|
3326
3375
|
activeRootId,
|
|
3327
3376
|
actions,
|
|
3328
3377
|
accountMenu,
|
|
3378
|
+
className,
|
|
3329
3379
|
extra,
|
|
3330
3380
|
layout,
|
|
3381
|
+
brand,
|
|
3331
3382
|
logo,
|
|
3332
|
-
|
|
3383
|
+
navigation,
|
|
3384
|
+
navItems = [],
|
|
3333
3385
|
onNavigate
|
|
3334
3386
|
}) {
|
|
3335
3387
|
const heightPx = clampHeadbarHeight(layout?.heightPx);
|
|
3336
3388
|
const layoutMode = layout?.layoutMode ?? "boxed";
|
|
3337
3389
|
const menuRadius = layout?.menuRadius ?? "default";
|
|
3390
|
+
const surface = layout?.surface ?? "card";
|
|
3338
3391
|
const logoHeightPx = getHeadbarLogoSizePx(heightPx);
|
|
3339
|
-
const frameStyle = getHeadbarFrameStyle(layoutMode, heightPx);
|
|
3392
|
+
const frameStyle = getHeadbarFrameStyle(layoutMode, heightPx, surface);
|
|
3340
3393
|
const showBrandTitle = Boolean(layout?.brandTitle);
|
|
3341
|
-
return /* @__PURE__ */ jsxs(
|
|
3342
|
-
|
|
3343
|
-
|
|
3344
|
-
|
|
3345
|
-
|
|
3346
|
-
|
|
3347
|
-
|
|
3348
|
-
|
|
3394
|
+
return /* @__PURE__ */ jsxs(
|
|
3395
|
+
"header",
|
|
3396
|
+
{
|
|
3397
|
+
className: cn2(getHeadbarFrameClass(layoutMode, layout?.navPosition), className),
|
|
3398
|
+
"data-navigation-headbar": "",
|
|
3399
|
+
"data-navigation-headbar-surface": surface,
|
|
3400
|
+
style: frameStyle,
|
|
3401
|
+
children: [
|
|
3402
|
+
/* @__PURE__ */ jsx("div", { className: "flex min-w-0 items-center justify-start", children: brand ?? (logo ? /* @__PURE__ */ jsx(
|
|
3403
|
+
BaseButton,
|
|
3349
3404
|
{
|
|
3350
|
-
|
|
3351
|
-
|
|
3352
|
-
|
|
3405
|
+
appearance: NAVIGATION_LAYOUT_DEFAULT_APPEARANCE,
|
|
3406
|
+
tone: "muted",
|
|
3407
|
+
icon: /* @__PURE__ */ jsx(
|
|
3408
|
+
"div",
|
|
3409
|
+
{
|
|
3410
|
+
className: cn2(
|
|
3411
|
+
"flex items-center justify-center overflow-hidden rounded-lg",
|
|
3412
|
+
logo.url ? "w-auto max-w-[min(22rem,30vw)] bg-transparent" : "bg-[hsl(var(--primary))] text-[hsl(var(--primary-foreground))]"
|
|
3413
|
+
),
|
|
3414
|
+
style: logo.url ? { height: logoHeightPx } : { width: logoHeightPx, height: logoHeightPx },
|
|
3415
|
+
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) })
|
|
3416
|
+
}
|
|
3353
3417
|
),
|
|
3354
|
-
|
|
3355
|
-
|
|
3418
|
+
label: showBrandTitle ? /* @__PURE__ */ jsx("span", { className: "truncate whitespace-nowrap text-base font-medium text-[hsl(var(--foreground))]", children: layout?.brandTitle }) : null,
|
|
3419
|
+
ariaLabel: logo.title,
|
|
3420
|
+
title: logo.title,
|
|
3421
|
+
className: "h-auto min-w-0 justify-start border-transparent bg-transparent p-0 shadow-none hover:bg-transparent",
|
|
3422
|
+
classNames: logo.url ? { icon: "!h-auto !w-auto shrink-0" } : void 0,
|
|
3423
|
+
onClick: logo.onClick
|
|
3356
3424
|
}
|
|
3357
|
-
),
|
|
3358
|
-
|
|
3359
|
-
|
|
3360
|
-
|
|
3361
|
-
|
|
3362
|
-
|
|
3363
|
-
|
|
3364
|
-
|
|
3365
|
-
|
|
3366
|
-
|
|
3367
|
-
|
|
3368
|
-
|
|
3369
|
-
|
|
3370
|
-
|
|
3371
|
-
|
|
3372
|
-
|
|
3373
|
-
|
|
3374
|
-
|
|
3375
|
-
|
|
3376
|
-
/* @__PURE__ */ jsxs("div", { className: "flex min-w-0 items-center justify-end gap-3", children: [
|
|
3377
|
-
actions,
|
|
3378
|
-
extra,
|
|
3379
|
-
accountMenu
|
|
3380
|
-
] })
|
|
3381
|
-
] });
|
|
3425
|
+
) : null) }),
|
|
3426
|
+
/* @__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(
|
|
3427
|
+
NavigationHeadbarMenu,
|
|
3428
|
+
{
|
|
3429
|
+
activeItemId,
|
|
3430
|
+
activeRootId,
|
|
3431
|
+
items: navItems,
|
|
3432
|
+
menuRadius,
|
|
3433
|
+
onNavigate
|
|
3434
|
+
}
|
|
3435
|
+
) }) }),
|
|
3436
|
+
/* @__PURE__ */ jsxs("div", { className: "flex min-w-0 items-center justify-end gap-3", children: [
|
|
3437
|
+
actions,
|
|
3438
|
+
extra,
|
|
3439
|
+
accountMenu
|
|
3440
|
+
] })
|
|
3441
|
+
]
|
|
3442
|
+
}
|
|
3443
|
+
);
|
|
3382
3444
|
}
|
|
3383
3445
|
function NavigationLayout({
|
|
3384
3446
|
activeItemId,
|
|
@@ -3494,7 +3556,7 @@ function NavigationLayout({
|
|
|
3494
3556
|
}
|
|
3495
3557
|
);
|
|
3496
3558
|
const header = isHeadbarMode ? /* @__PURE__ */ jsx(
|
|
3497
|
-
|
|
3559
|
+
NavigationHeadbar,
|
|
3498
3560
|
{
|
|
3499
3561
|
activeItemId,
|
|
3500
3562
|
activeRootId: activeRootId ?? findNavigationRootId(navItems, activeItemId),
|
|
@@ -3530,6 +3592,6 @@ function NavigationLayout({
|
|
|
3530
3592
|
return /* @__PURE__ */ jsx(AppLayout, { header, sidebar, flush, className, children });
|
|
3531
3593
|
}
|
|
3532
3594
|
|
|
3533
|
-
export { AppHeader, AppLayout, AppSidebar, NavButton, NavigationLayout, UserAccountMenu, cn2 as cn };
|
|
3595
|
+
export { AppHeader, AppLayout, AppSidebar, NavButton, NavigationHeadbar, NavigationHeadbarMenu, NavigationLayout, UserAccountMenu, cn2 as cn };
|
|
3534
3596
|
//# sourceMappingURL=index.mjs.map
|
|
3535
3597
|
//# sourceMappingURL=index.mjs.map
|