feat(ui): add typed navbar menu items
Quality / quality (ubuntu-latest) (push) Failing after 11m12s
Quality / quality (windows-latest) (push) Canceled after 0s

This commit is contained in:
2026-08-24 21:36:46 +05:30
parent fc1eea3939
commit 9d64ec60c4
9 changed files with 396 additions and 27 deletions
+19 -1
View File
@@ -24,4 +24,22 @@
* server-only subpath. Import from there instead if you need them.
*/
export {};
export type {
MegaMenuColumn,
MegaMenuDensity,
MegaMenuFeatured,
MegaMenuPanelAlign,
MegaMenuPanelWidth,
MegaMenuRailItem,
MegaMenuVariant,
NavbarAction,
NavbarBrand,
NavbarDropdownGroup,
NavbarDropdownItem,
NavbarItem,
NavbarItemType,
NavbarLinkItem,
NavbarMegaMenuData,
NavbarMegaMenuItem,
NavigationLink,
} from "./navigation";
+120
View File
@@ -0,0 +1,120 @@
/** Shared, serializable navigation contracts for Navbar and application configs. */
export type NavbarItemType = "link" | "dropdown" | "mega";
export type MegaMenuVariant = "default" | "icon-grid" | "catalog" | "dark";
export type MegaMenuDensity = "compact" | "default" | "comfortable";
export type MegaMenuPanelWidth = "sm" | "md" | "lg" | "xl" | "2xl" | "full";
export type MegaMenuPanelAlign = "start" | "center" | "end";
export interface NavigationLink {
label: string;
href: string;
value?: string;
labelKey?: string;
description?: string;
descriptionKey?: string;
icon?: string;
image?: string;
imageAlt?: string;
eyebrow?: string;
badge?: string;
target?: string;
rel?: string;
disabled?: boolean;
}
export interface NavbarLinkItem extends NavigationLink {
type?: "link";
}
export interface NavbarDropdownGroup {
label?: string;
labelKey?: string;
description?: string;
descriptionKey?: string;
items: NavigationLink[];
/** Compatibility alias accepted by Navbar. Prefer `items`. */
children?: NavigationLink[];
}
export interface NavbarDropdownItem {
type: "dropdown";
label: string;
value?: string;
labelKey?: string;
description?: string;
descriptionKey?: string;
icon?: string;
columns?: number;
items: Array<NavigationLink | NavbarDropdownGroup>;
/** Compatibility alias accepted by Navbar. Prefer `items`. */
children?: Array<NavigationLink | NavbarDropdownGroup>;
}
export interface MegaMenuColumn {
heading?: string;
eyebrow?: string;
description?: string;
image?: string;
imageAlt?: string;
items: NavigationLink[];
actionLabel?: string;
actionHref?: string;
}
export interface MegaMenuRailItem extends NavigationLink {}
export interface MegaMenuFeatured {
eyebrow?: string;
image?: string;
imageAlt?: string;
title?: string;
description?: string;
actionLabel?: string;
actionHref?: string;
}
export interface NavbarMegaMenuData {
variant?: MegaMenuVariant;
density?: MegaMenuDensity;
panelWidth?: MegaMenuPanelWidth;
panelAlign?: MegaMenuPanelAlign;
fullWidth?: boolean;
columnCount?: number;
columns: MegaMenuColumn[];
rail?: MegaMenuRailItem[];
featured?: MegaMenuFeatured;
actionLabel?: string;
actionHref?: string;
actionIcon?: string;
footer?: string;
}
export interface NavbarMegaMenuItem {
type: "mega";
label: string;
value?: string;
labelKey?: string;
icon?: string;
mega: NavbarMegaMenuData;
}
export type NavbarItem = NavbarLinkItem | NavbarDropdownItem | NavbarMegaMenuItem;
export interface NavbarAction extends NavigationLink {
variant?: "link" | "outline" | "primary";
}
export interface NavbarBrand {
label?: string;
labelKey?: string;
description?: string;
descriptionKey?: string;
href?: string;
ariaLabel?: string;
icon?: string;
logo?: string;
logoAlt?: string;
logoWidth?: number | string;
logoHeight?: number | string;
}