@fumadocs/base-ui 16.7.2 → 16.7.4
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/css/generated/docs.css +1 -8
- package/css/generated/flux.css +0 -3
- package/css/generated/home.css +26 -11
- package/css/generated/notebook.css +2 -4
- package/css/generated/shared.css +59 -10
- package/dist/components/sidebar/base.js +1 -2
- package/dist/components/tabs.d.ts +9 -4
- package/dist/components/tabs.js +12 -13
- package/dist/components/toc/clerk.js +66 -30
- package/dist/components/toc/default.js +2 -2
- package/dist/components/toc/index.d.ts +4 -2
- package/dist/components/toc/index.js +36 -18
- package/dist/components/ui/button.d.ts +1 -1
- package/dist/components/ui/collapsible.js +1 -1
- package/dist/components/ui/navigation-menu.d.ts +24 -12
- package/dist/components/ui/navigation-menu.js +47 -32
- package/dist/components/ui/popover.d.ts +7 -1
- package/dist/components/ui/popover.js +13 -13
- package/dist/components/ui/scroll-area.d.ts +15 -4
- package/dist/components/ui/scroll-area.js +26 -27
- package/dist/layouts/docs/page/slots/toc.js +4 -2
- package/dist/layouts/docs/slots/sidebar.js +9 -19
- package/dist/layouts/flux/page/slots/toc.js +4 -2
- package/dist/layouts/flux/slots/sidebar.js +8 -13
- package/dist/layouts/home/index.js +6 -1
- package/dist/layouts/home/navbar.d.ts +2 -4
- package/dist/layouts/home/navbar.js +6 -9
- package/dist/layouts/home/slots/header.d.ts +2 -3
- package/dist/layouts/home/slots/header.js +122 -112
- package/dist/layouts/notebook/page/slots/toc.js +4 -2
- package/dist/layouts/notebook/slots/sidebar.js +9 -19
- package/dist/style.css +228 -60
- package/package.json +5 -5
|
@@ -162,8 +162,10 @@ function PageTOCPopoverContent(props) {
|
|
|
162
162
|
return /* @__PURE__ */ jsx(CollapsibleContent, {
|
|
163
163
|
"data-toc-popover-content": "",
|
|
164
164
|
...props,
|
|
165
|
-
|
|
166
|
-
|
|
165
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
166
|
+
className: "flex flex-col px-2 max-h-[50vh]",
|
|
167
|
+
children: props.children
|
|
168
|
+
})
|
|
167
169
|
});
|
|
168
170
|
}
|
|
169
171
|
//#endregion
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { cn } from "../../../utils/cn.js";
|
|
3
3
|
import { mergeRefs } from "../../../utils/merge-refs.js";
|
|
4
|
-
import {
|
|
5
|
-
import { SidebarFolder as SidebarFolder$1, SidebarFolderContent as SidebarFolderContent$1, SidebarFolderLink as SidebarFolderLink$1, SidebarFolderTrigger as SidebarFolderTrigger$1, SidebarItem as SidebarItem$1, SidebarProvider as SidebarProvider$1, SidebarSeparator as SidebarSeparator$1, base_exports, useFolder, useFolderDepth } from "../../../components/sidebar/base.js";
|
|
4
|
+
import { SidebarFolder as SidebarFolder$1, SidebarFolderContent as SidebarFolderContent$1, SidebarFolderLink as SidebarFolderLink$1, SidebarFolderTrigger as SidebarFolderTrigger$1, SidebarItem as SidebarItem$1, SidebarProvider as SidebarProvider$1, SidebarSeparator as SidebarSeparator$1, SidebarViewport, base_exports, useFolder, useFolderDepth } from "../../../components/sidebar/base.js";
|
|
6
5
|
import { createPageTreeRenderer } from "../../../components/sidebar/page-tree.js";
|
|
7
6
|
import { createLinkItemRenderer } from "../../../components/sidebar/link-item.js";
|
|
8
7
|
import { useFluxLayout } from "../index.js";
|
|
@@ -40,17 +39,13 @@ function Sidebar({ footer, banner, components, ...rest }) {
|
|
|
40
39
|
className: "flex flex-col gap-3 p-4 pb-2 empty:hidden",
|
|
41
40
|
children: banner
|
|
42
41
|
}),
|
|
43
|
-
/* @__PURE__ */ jsx(
|
|
44
|
-
className: "
|
|
45
|
-
children: /* @__PURE__ */
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
className: cn(i === list.length - 1 && "mb-4")
|
|
51
|
-
}, i)), /* @__PURE__ */ jsx(SidebarPageTree, { ...components })]
|
|
52
|
-
})
|
|
53
|
-
}),
|
|
42
|
+
/* @__PURE__ */ jsx(SidebarViewport, { children: /* @__PURE__ */ jsxs("div", {
|
|
43
|
+
className: "flex flex-col",
|
|
44
|
+
children: [menuItems.filter((v) => v.type !== "icon").map((item, i, list) => /* @__PURE__ */ jsx(SidebarLinkItem, {
|
|
45
|
+
item,
|
|
46
|
+
className: cn(i === list.length - 1 && "mb-4")
|
|
47
|
+
}, i)), /* @__PURE__ */ jsx(SidebarPageTree, { ...components })]
|
|
48
|
+
}) }),
|
|
54
49
|
footer
|
|
55
50
|
]
|
|
56
51
|
});
|
|
@@ -21,7 +21,7 @@ function HomeLayout(props) {
|
|
|
21
21
|
const linkItems = useLinkItems(props);
|
|
22
22
|
const slots = {
|
|
23
23
|
...baseSlots,
|
|
24
|
-
header: defaultSlots?.header ??
|
|
24
|
+
header: defaultSlots?.header ?? InlineHeader,
|
|
25
25
|
container: defaultSlots?.container ?? Container
|
|
26
26
|
};
|
|
27
27
|
return /* @__PURE__ */ jsx(LayoutContext, {
|
|
@@ -36,5 +36,10 @@ function HomeLayout(props) {
|
|
|
36
36
|
})
|
|
37
37
|
});
|
|
38
38
|
}
|
|
39
|
+
function InlineHeader(props) {
|
|
40
|
+
const { nav } = useHomeLayout().props;
|
|
41
|
+
if (nav?.component) return nav.component;
|
|
42
|
+
return /* @__PURE__ */ jsx(Header, { ...props });
|
|
43
|
+
}
|
|
39
44
|
//#endregion
|
|
40
45
|
export { HomeLayout, useHomeLayout };
|
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
import { NavigationMenuContentProps, NavigationMenuTriggerProps } from "../../components/ui/navigation-menu.js";
|
|
2
|
-
import * as react from "react";
|
|
1
|
+
import { NavigationMenuContentProps, NavigationMenuItem, NavigationMenuTriggerProps } from "../../components/ui/navigation-menu.js";
|
|
3
2
|
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
4
3
|
import { LinkProps } from "fumadocs-core/link";
|
|
5
|
-
import * as _base_ui_react0 from "@base-ui/react";
|
|
6
4
|
|
|
7
5
|
//#region src/layouts/home/navbar.d.ts
|
|
8
|
-
declare const NavbarMenu:
|
|
6
|
+
declare const NavbarMenu: typeof NavigationMenuItem;
|
|
9
7
|
declare function NavbarMenuContent(props: NavigationMenuContentProps): react_jsx_runtime0.JSX.Element;
|
|
10
8
|
declare function NavbarMenuTrigger(props: NavigationMenuTriggerProps): react_jsx_runtime0.JSX.Element;
|
|
11
9
|
declare function NavbarMenuLink(props: LinkProps): react_jsx_runtime0.JSX.Element;
|
|
@@ -10,7 +10,7 @@ function NavbarMenuContent(props) {
|
|
|
10
10
|
const { className, ...rest } = props;
|
|
11
11
|
return /* @__PURE__ */ jsx(NavigationMenuContent, {
|
|
12
12
|
...rest,
|
|
13
|
-
className: (state) => cn("grid grid-cols-1 gap-2
|
|
13
|
+
className: (state) => cn("grid grid-cols-1 gap-2 md:grid-cols-2 lg:grid-cols-3", typeof className === "function" ? className(state) : className),
|
|
14
14
|
children: props.children
|
|
15
15
|
});
|
|
16
16
|
}
|
|
@@ -23,14 +23,11 @@ function NavbarMenuTrigger(props) {
|
|
|
23
23
|
});
|
|
24
24
|
}
|
|
25
25
|
function NavbarMenuLink(props) {
|
|
26
|
-
return /* @__PURE__ */ jsx(NavigationMenuLink, {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
children: props.children
|
|
32
|
-
})
|
|
33
|
-
});
|
|
26
|
+
return /* @__PURE__ */ jsx(NavigationMenuLink, { render: /* @__PURE__ */ jsx(Link, {
|
|
27
|
+
...props,
|
|
28
|
+
className: cn("flex flex-col gap-2 rounded-lg border bg-fd-card p-3 transition-colors hover:bg-fd-accent/80 hover:text-fd-accent-foreground", props.className),
|
|
29
|
+
children: props.children
|
|
30
|
+
}) });
|
|
34
31
|
}
|
|
35
32
|
//#endregion
|
|
36
33
|
export { NavbarMenu, NavbarMenuContent, NavbarMenuLink, NavbarMenuTrigger };
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import * as react from "react";
|
|
2
1
|
import { ComponentProps } from "react";
|
|
3
2
|
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
4
3
|
import * as class_variance_authority_types0 from "class-variance-authority/types";
|
|
5
4
|
|
|
6
5
|
//#region src/layouts/home/slots/header.d.ts
|
|
7
6
|
declare const navItemVariants: (props?: ({
|
|
8
|
-
variant?: "icon" | "
|
|
7
|
+
variant?: "icon" | "main" | "button" | null | undefined;
|
|
9
8
|
} & class_variance_authority_types0.ClassProp) | undefined) => string;
|
|
10
|
-
declare function Header(props: ComponentProps<'header'>):
|
|
9
|
+
declare function Header(props: ComponentProps<'header'>): react_jsx_runtime0.JSX.Element;
|
|
11
10
|
//#endregion
|
|
12
11
|
export { Header, navItemVariants };
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { cn } from "../../../utils/cn.js";
|
|
3
3
|
import { buttonVariants } from "../../../components/ui/button.js";
|
|
4
|
+
import { mergeRefs } from "../../../utils/merge-refs.js";
|
|
5
|
+
import { Collapsible, CollapsibleContent, CollapsibleTrigger } from "../../../components/ui/collapsible.js";
|
|
4
6
|
import { LinkItem } from "../../shared/client.js";
|
|
5
7
|
import "../../shared/index.js";
|
|
6
8
|
import { useIsScrollTop } from "../../../utils/use-is-scroll-top.js";
|
|
7
|
-
import { NavigationMenu
|
|
9
|
+
import { NavigationMenu, NavigationMenuContent, NavigationMenuItem, NavigationMenuLink, NavigationMenuList, NavigationMenuTrigger, NavigationMenuViewport } from "../../../components/ui/navigation-menu.js";
|
|
8
10
|
import { useHomeLayout } from "../index.js";
|
|
9
|
-
import { Fragment, useState } from "react";
|
|
11
|
+
import { Fragment, useEffect, useEffectEvent, useRef, useState } from "react";
|
|
10
12
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
11
13
|
import Link from "fumadocs-core/link";
|
|
12
14
|
import { ChevronDown, Languages } from "lucide-react";
|
|
@@ -28,10 +30,26 @@ const navItemVariants = cva("[&_svg]:size-4", {
|
|
|
28
30
|
});
|
|
29
31
|
function Header(props) {
|
|
30
32
|
const { navItems, menuItems, slots, props: { nav } } = useHomeLayout();
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
const headerRef = useRef(null);
|
|
34
|
+
const listRef = useRef(null);
|
|
35
|
+
const [open, setOpen] = useState(false);
|
|
36
|
+
const transparentMode = nav?.transparentMode ?? "none";
|
|
37
|
+
const isTop = useIsScrollTop({ enabled: transparentMode === "top" }) ?? true;
|
|
38
|
+
const isNavTransparent = transparentMode === "top" ? isTop : transparentMode === "always";
|
|
39
|
+
const onClick = useEffectEvent((e) => {
|
|
40
|
+
const element = headerRef.current;
|
|
41
|
+
if (!open || !element) return;
|
|
42
|
+
if (element !== e.target && !element.contains(e.target)) setOpen(false);
|
|
43
|
+
});
|
|
44
|
+
useEffect(() => {
|
|
45
|
+
window.addEventListener("click", onClick);
|
|
46
|
+
return () => {
|
|
47
|
+
window.removeEventListener("click", onClick);
|
|
48
|
+
};
|
|
49
|
+
}, []);
|
|
50
|
+
const list = /* @__PURE__ */ jsxs(NavigationMenuList, {
|
|
51
|
+
ref: listRef,
|
|
52
|
+
className: "flex h-14 w-full mx-auto max-w-(--fd-layout-width) items-center px-4",
|
|
35
53
|
children: [
|
|
36
54
|
slots.navTitle && /* @__PURE__ */ jsx(slots.navTitle, { className: "inline-flex items-center gap-2.5 font-semibold" }),
|
|
37
55
|
nav?.children,
|
|
@@ -65,69 +83,73 @@ function Header(props) {
|
|
|
65
83
|
children: [slots.searchTrigger && /* @__PURE__ */ jsx(slots.searchTrigger.sm, {
|
|
66
84
|
hideIfDisabled: true,
|
|
67
85
|
className: "p-2"
|
|
68
|
-
}), /* @__PURE__ */ jsx(
|
|
86
|
+
}), /* @__PURE__ */ jsx(CollapsibleTrigger, {
|
|
69
87
|
"aria-label": "Toggle Menu",
|
|
70
88
|
className: cn(buttonVariants({
|
|
71
89
|
size: "icon",
|
|
72
|
-
color: "ghost"
|
|
73
|
-
className: "group [&_svg]:size-5.5"
|
|
90
|
+
color: "ghost"
|
|
74
91
|
})),
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
item,
|
|
81
|
-
className: "sm:hidden"
|
|
82
|
-
}, i)), /* @__PURE__ */ jsxs("div", {
|
|
83
|
-
className: "-ms-1.5 flex flex-row items-center gap-2 max-sm:mt-2",
|
|
84
|
-
children: [
|
|
85
|
-
menuItems.filter(isSecondary).map((item, i) => /* @__PURE__ */ jsx(MobileNavigationMenuLinkItem, {
|
|
86
|
-
item,
|
|
87
|
-
className: cn(item.type === "icon" && "-mx-1 first:ms-0")
|
|
88
|
-
}, i)),
|
|
89
|
-
/* @__PURE__ */ jsx("div", {
|
|
90
|
-
role: "separator",
|
|
91
|
-
className: "flex-1"
|
|
92
|
-
}),
|
|
93
|
-
slots.languageSelect && /* @__PURE__ */ jsxs(slots.languageSelect.root, { children: [
|
|
94
|
-
/* @__PURE__ */ jsx(Languages, { className: "size-5" }),
|
|
95
|
-
slots.languageSelect.text && /* @__PURE__ */ jsx(slots.languageSelect.text, {}),
|
|
96
|
-
/* @__PURE__ */ jsx(ChevronDown, { className: "size-3 text-fd-muted-foreground" })
|
|
97
|
-
] }),
|
|
98
|
-
slots.themeSwitch && /* @__PURE__ */ jsx(slots.themeSwitch, {})
|
|
99
|
-
]
|
|
100
|
-
})]
|
|
101
|
-
})] }) })]
|
|
92
|
+
onPointerEnter: nav?.enableHoverToOpen ? () => {
|
|
93
|
+
setOpen(true);
|
|
94
|
+
} : void 0,
|
|
95
|
+
children: /* @__PURE__ */ jsx(ChevronDown, { className: cn("transition-transform", open && "rotate-180") })
|
|
96
|
+
})]
|
|
102
97
|
})
|
|
103
98
|
]
|
|
104
99
|
});
|
|
100
|
+
return /* @__PURE__ */ jsx(Collapsible, {
|
|
101
|
+
open,
|
|
102
|
+
onOpenChange: setOpen,
|
|
103
|
+
render: /* @__PURE__ */ jsx("header", {
|
|
104
|
+
id: "nd-nav",
|
|
105
|
+
...props,
|
|
106
|
+
ref: mergeRefs(headerRef, props.ref),
|
|
107
|
+
className: cn("sticky h-14 top-0 z-40", props.className),
|
|
108
|
+
children: /* @__PURE__ */ jsxs(NavigationMenu, {
|
|
109
|
+
className: (s) => cn("backdrop-blur-lg border-b transition-[box-shadow,background-color,border-radius]", open && "max-lg:shadow-lg max-lg:rounded-b-2xl", (open || !isNavTransparent || s.open) && "bg-fd-background/80"),
|
|
110
|
+
children: [
|
|
111
|
+
list,
|
|
112
|
+
/* @__PURE__ */ jsx(CollapsibleContent, {
|
|
113
|
+
className: "mx-auto max-w-(--fd-layout-width) lg:hidden",
|
|
114
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
115
|
+
className: "flex flex-col pt-2 p-4 sm:flex-row sm:items-center sm:justify-end",
|
|
116
|
+
children: [menuItems.filter((item) => !isSecondary(item)).map((item, i) => /* @__PURE__ */ jsx(MobileNavigationMenuLinkItem, {
|
|
117
|
+
item,
|
|
118
|
+
className: "sm:hidden"
|
|
119
|
+
}, i)), /* @__PURE__ */ jsxs("div", {
|
|
120
|
+
className: "-ms-1.5 flex flex-row items-center gap-2 max-sm:mt-2",
|
|
121
|
+
children: [
|
|
122
|
+
menuItems.filter(isSecondary).map((item, i) => /* @__PURE__ */ jsx(MobileNavigationMenuLinkItem, {
|
|
123
|
+
item,
|
|
124
|
+
className: cn(item.type === "icon" && "-mx-1 first:ms-0")
|
|
125
|
+
}, i)),
|
|
126
|
+
/* @__PURE__ */ jsx("div", {
|
|
127
|
+
role: "separator",
|
|
128
|
+
className: "flex-1"
|
|
129
|
+
}),
|
|
130
|
+
slots.languageSelect && /* @__PURE__ */ jsxs(slots.languageSelect.root, { children: [
|
|
131
|
+
/* @__PURE__ */ jsx(Languages, { className: "size-5" }),
|
|
132
|
+
slots.languageSelect.text && /* @__PURE__ */ jsx(slots.languageSelect.text, {}),
|
|
133
|
+
/* @__PURE__ */ jsx(ChevronDown, { className: "size-3 text-fd-muted-foreground" })
|
|
134
|
+
] }),
|
|
135
|
+
slots.themeSwitch && /* @__PURE__ */ jsx(slots.themeSwitch, {})
|
|
136
|
+
]
|
|
137
|
+
})]
|
|
138
|
+
})
|
|
139
|
+
}),
|
|
140
|
+
/* @__PURE__ */ jsx(NavigationMenuViewport, {
|
|
141
|
+
side: "bottom",
|
|
142
|
+
anchor: listRef
|
|
143
|
+
})
|
|
144
|
+
]
|
|
145
|
+
})
|
|
146
|
+
})
|
|
147
|
+
});
|
|
105
148
|
}
|
|
106
149
|
function isSecondary(item) {
|
|
107
150
|
if ("secondary" in item && item.secondary != null) return item.secondary;
|
|
108
151
|
return item.type === "icon";
|
|
109
152
|
}
|
|
110
|
-
function HeaderNavigationMenu({ transparentMode = "none", ...props }) {
|
|
111
|
-
const [value, setValue] = useState("");
|
|
112
|
-
const isTop = useIsScrollTop({ enabled: transparentMode === "top" }) ?? true;
|
|
113
|
-
const isTransparent = transparentMode === "top" ? isTop : transparentMode === "always";
|
|
114
|
-
return /* @__PURE__ */ jsx("header", {
|
|
115
|
-
id: "nd-nav",
|
|
116
|
-
...props,
|
|
117
|
-
className: cn("sticky h-14 top-0 z-40", props.className),
|
|
118
|
-
children: /* @__PURE__ */ jsx(NavigationMenuRoot, {
|
|
119
|
-
value,
|
|
120
|
-
onValueChange: setValue,
|
|
121
|
-
children: /* @__PURE__ */ jsxs("div", {
|
|
122
|
-
className: cn("backdrop-blur-lg border-b transition-colors *:mx-auto *:max-w-(--fd-layout-width)", value.length > 0 && "max-lg:shadow-lg max-lg:rounded-b-2xl", (!isTransparent || value.length > 0) && "bg-fd-background/80"),
|
|
123
|
-
children: [/* @__PURE__ */ jsx(NavigationMenuList, {
|
|
124
|
-
className: "flex h-14 w-full items-center px-4",
|
|
125
|
-
children: props.children
|
|
126
|
-
}), /* @__PURE__ */ jsx(NavigationMenuViewport, {})]
|
|
127
|
-
})
|
|
128
|
-
})
|
|
129
|
-
});
|
|
130
|
-
}
|
|
131
153
|
function NavigationMenuLinkItem({ item, ...props }) {
|
|
132
154
|
if (item.type === "custom") return item.children;
|
|
133
155
|
if (item.type === "menu") {
|
|
@@ -137,26 +159,23 @@ function NavigationMenuLinkItem({ item, ...props }) {
|
|
|
137
159
|
className: "w-fit rounded-md border bg-fd-muted p-1 [&_svg]:size-4",
|
|
138
160
|
children: child.icon
|
|
139
161
|
}) : null, ...rest } = child.menu ?? {};
|
|
140
|
-
return /* @__PURE__ */ jsx(NavigationMenuLink, {
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
] })
|
|
158
|
-
})
|
|
159
|
-
}, `${j}-${child.url}`);
|
|
162
|
+
return /* @__PURE__ */ jsx(NavigationMenuLink, { render: /* @__PURE__ */ jsx(Link, {
|
|
163
|
+
href: child.url,
|
|
164
|
+
external: child.external,
|
|
165
|
+
...rest,
|
|
166
|
+
className: cn("flex flex-col gap-2 rounded-lg border bg-fd-card p-3 transition-colors hover:bg-fd-accent/80 hover:text-fd-accent-foreground", rest.className),
|
|
167
|
+
children: rest.children ?? /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
168
|
+
banner,
|
|
169
|
+
/* @__PURE__ */ jsx("p", {
|
|
170
|
+
className: "text-base font-medium",
|
|
171
|
+
children: child.text
|
|
172
|
+
}),
|
|
173
|
+
/* @__PURE__ */ jsx("p", {
|
|
174
|
+
className: "text-sm text-fd-muted-foreground empty:hidden",
|
|
175
|
+
children: child.description
|
|
176
|
+
})
|
|
177
|
+
] })
|
|
178
|
+
}) }, `${j}-${child.url}`);
|
|
160
179
|
});
|
|
161
180
|
return /* @__PURE__ */ jsxs(NavigationMenuItem, {
|
|
162
181
|
...props,
|
|
@@ -168,22 +187,19 @@ function NavigationMenuLinkItem({ item, ...props }) {
|
|
|
168
187
|
children: item.text
|
|
169
188
|
}) : item.text
|
|
170
189
|
}), /* @__PURE__ */ jsx(NavigationMenuContent, {
|
|
171
|
-
className: "grid grid-cols-1 gap-2
|
|
190
|
+
className: "grid grid-cols-1 gap-2 md:grid-cols-2 lg:grid-cols-3",
|
|
172
191
|
children
|
|
173
192
|
})]
|
|
174
193
|
});
|
|
175
194
|
}
|
|
176
195
|
return /* @__PURE__ */ jsx(NavigationMenuItem, {
|
|
177
196
|
...props,
|
|
178
|
-
children: /* @__PURE__ */ jsx(NavigationMenuLink, {
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
children: item.type === "icon" ? item.icon : item.text
|
|
185
|
-
})
|
|
186
|
-
})
|
|
197
|
+
children: /* @__PURE__ */ jsx(NavigationMenuLink, { render: /* @__PURE__ */ jsx(LinkItem, {
|
|
198
|
+
item,
|
|
199
|
+
"aria-label": item.type === "icon" ? item.label : void 0,
|
|
200
|
+
className: cn(navItemVariants({ variant: item.type })),
|
|
201
|
+
children: item.type === "icon" ? item.icon : item.text
|
|
202
|
+
}) })
|
|
187
203
|
});
|
|
188
204
|
}
|
|
189
205
|
function MobileNavigationMenuLinkItem({ item, ...props }) {
|
|
@@ -197,35 +213,29 @@ function MobileNavigationMenuLinkItem({ item, ...props }) {
|
|
|
197
213
|
className: cn("mb-4 flex flex-col", props.className),
|
|
198
214
|
children: [/* @__PURE__ */ jsx("p", {
|
|
199
215
|
className: "mb-1 text-sm text-fd-muted-foreground",
|
|
200
|
-
children: item.url ? /* @__PURE__ */ jsx(
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
external: item.external,
|
|
205
|
-
children: header
|
|
206
|
-
})
|
|
216
|
+
children: item.url ? /* @__PURE__ */ jsx(Link, {
|
|
217
|
+
href: item.url,
|
|
218
|
+
external: item.external,
|
|
219
|
+
children: header
|
|
207
220
|
}) : header
|
|
208
221
|
}), item.items.map((child, i) => /* @__PURE__ */ jsx(MobileNavigationMenuLinkItem, { item: child }, i))]
|
|
209
222
|
});
|
|
210
223
|
}
|
|
211
|
-
return /* @__PURE__ */
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
"aria-label": item.type === "icon" ? item.label : void 0,
|
|
227
|
-
children: [item.icon, item.type === "icon" ? void 0 : item.text]
|
|
228
|
-
})
|
|
224
|
+
return /* @__PURE__ */ jsxs(LinkItem, {
|
|
225
|
+
item,
|
|
226
|
+
className: cn({
|
|
227
|
+
main: "inline-flex items-center gap-2 py-1.5 transition-colors hover:text-fd-popover-foreground/50 data-[active=true]:font-medium data-[active=true]:text-fd-primary [&_svg]:size-4",
|
|
228
|
+
icon: buttonVariants({
|
|
229
|
+
size: "icon",
|
|
230
|
+
color: "ghost"
|
|
231
|
+
}),
|
|
232
|
+
button: buttonVariants({
|
|
233
|
+
color: "secondary",
|
|
234
|
+
className: "gap-1.5 [&_svg]:size-4"
|
|
235
|
+
})
|
|
236
|
+
}[item.type ?? "main"], props.className),
|
|
237
|
+
"aria-label": item.type === "icon" ? item.label : void 0,
|
|
238
|
+
children: [item.icon, item.type === "icon" ? void 0 : item.text]
|
|
229
239
|
});
|
|
230
240
|
}
|
|
231
241
|
//#endregion
|
|
@@ -152,8 +152,10 @@ function PageTOCPopoverContent(props) {
|
|
|
152
152
|
return /* @__PURE__ */ jsx(CollapsibleContent, {
|
|
153
153
|
"data-toc-popover-content": "",
|
|
154
154
|
...props,
|
|
155
|
-
|
|
156
|
-
|
|
155
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
156
|
+
className: "flex flex-col px-4 max-h-[50vh] md:px-6",
|
|
157
|
+
children: props.children
|
|
158
|
+
})
|
|
157
159
|
});
|
|
158
160
|
}
|
|
159
161
|
//#endregion
|
|
@@ -5,8 +5,7 @@ import { mergeRefs } from "../../../utils/merge-refs.js";
|
|
|
5
5
|
import { Popover, PopoverContent, PopoverTrigger } from "../../../components/ui/popover.js";
|
|
6
6
|
import { LinkItem } from "../../shared/client.js";
|
|
7
7
|
import { isLayoutTabActive } from "../../shared/index.js";
|
|
8
|
-
import {
|
|
9
|
-
import { SidebarCollapseTrigger as SidebarCollapseTrigger$1, SidebarContent as SidebarContent$1, SidebarDrawerContent, SidebarDrawerOverlay, SidebarFolder as SidebarFolder$1, SidebarFolderContent as SidebarFolderContent$1, SidebarFolderLink as SidebarFolderLink$1, SidebarFolderTrigger as SidebarFolderTrigger$1, SidebarItem as SidebarItem$1, SidebarProvider as SidebarProvider$1, SidebarSeparator as SidebarSeparator$1, SidebarTrigger as SidebarTrigger$1, base_exports, useFolder, useFolderDepth } from "../../../components/sidebar/base.js";
|
|
8
|
+
import { SidebarCollapseTrigger as SidebarCollapseTrigger$1, SidebarContent as SidebarContent$1, SidebarDrawerContent, SidebarDrawerOverlay, SidebarFolder as SidebarFolder$1, SidebarFolderContent as SidebarFolderContent$1, SidebarFolderLink as SidebarFolderLink$1, SidebarFolderTrigger as SidebarFolderTrigger$1, SidebarItem as SidebarItem$1, SidebarProvider as SidebarProvider$1, SidebarSeparator as SidebarSeparator$1, SidebarTrigger as SidebarTrigger$1, SidebarViewport, base_exports, useFolder, useFolderDepth } from "../../../components/sidebar/base.js";
|
|
10
9
|
import { createPageTreeRenderer } from "../../../components/sidebar/page-tree.js";
|
|
11
10
|
import { createLinkItemRenderer } from "../../../components/sidebar/link-item.js";
|
|
12
11
|
import { useNotebookLayout } from "../client.js";
|
|
@@ -37,18 +36,6 @@ function SidebarTrigger(props) {
|
|
|
37
36
|
function SidebarCollapseTrigger(props) {
|
|
38
37
|
return /* @__PURE__ */ jsx(SidebarCollapseTrigger$1, { ...props });
|
|
39
38
|
}
|
|
40
|
-
function SidebarViewport(props) {
|
|
41
|
-
const { className, ...rest } = props;
|
|
42
|
-
return /* @__PURE__ */ jsx(ScrollArea, {
|
|
43
|
-
...rest,
|
|
44
|
-
className: (state) => cn("min-h-0 flex-1", typeof className === "function" ? className(state) : className),
|
|
45
|
-
children: /* @__PURE__ */ jsx(ScrollViewport, {
|
|
46
|
-
className: "p-4 overscroll-contain",
|
|
47
|
-
style: { maskImage: "linear-gradient(to bottom, transparent, white 12px, white calc(100% - 12px), transparent)" },
|
|
48
|
-
children: props.children
|
|
49
|
-
})
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
39
|
function SidebarContent({ ref: refProp, className, children, ...props }) {
|
|
53
40
|
const { props: { nav } } = useNotebookLayout();
|
|
54
41
|
const navMode = nav?.mode ?? "auto";
|
|
@@ -138,7 +125,7 @@ function SidebarFolderLink({ className, style, ...props }) {
|
|
|
138
125
|
function SidebarFolderContent({ className, children, ...props }) {
|
|
139
126
|
const depth = useFolderDepth();
|
|
140
127
|
return /* @__PURE__ */ jsx(SidebarFolderContent$1, {
|
|
141
|
-
className: (state) => cn("relative", depth === 1 && "before:content-[''] before:absolute before:w-px before:inset-y-1 before:bg-fd-border before:start-2.5", typeof className === "function" ? className(state) : className),
|
|
128
|
+
className: (state) => cn("relative flex flex-col gap-0.5 pt-0.5", depth === 1 && "before:content-[''] before:absolute before:w-px before:inset-y-1 before:bg-fd-border before:start-2.5", typeof className === "function" ? className(state) : className),
|
|
142
129
|
...props,
|
|
143
130
|
children
|
|
144
131
|
});
|
|
@@ -178,10 +165,13 @@ function Sidebar({ banner, footer, components, collapsible = true, ...rest }) {
|
|
|
178
165
|
children: [props.children, footer]
|
|
179
166
|
});
|
|
180
167
|
}
|
|
181
|
-
const viewport = /* @__PURE__ */
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
168
|
+
const viewport = /* @__PURE__ */ jsx(SidebarViewport, { children: /* @__PURE__ */ jsxs("div", {
|
|
169
|
+
className: "flex flex-col gap-0.5",
|
|
170
|
+
children: [menuItems.filter((item) => item.type !== "icon").map((item, i, arr) => /* @__PURE__ */ jsx(SidebarLinkItem, {
|
|
171
|
+
item,
|
|
172
|
+
className: cn("lg:hidden", i === arr.length - 1 && "mb-4")
|
|
173
|
+
}, i)), /* @__PURE__ */ jsx(SidebarPageTree, { ...components })]
|
|
174
|
+
}) });
|
|
185
175
|
return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsxs(SidebarContent, {
|
|
186
176
|
...rest,
|
|
187
177
|
children: [
|