@fumadocs/base-ui 16.7.2 → 16.7.3

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.
Files changed (33) hide show
  1. package/css/generated/docs.css +1 -8
  2. package/css/generated/flux.css +0 -3
  3. package/css/generated/home.css +26 -11
  4. package/css/generated/notebook.css +2 -4
  5. package/css/generated/shared.css +63 -10
  6. package/dist/components/sidebar/base.js +1 -2
  7. package/dist/components/tabs.d.ts +9 -4
  8. package/dist/components/tabs.js +12 -13
  9. package/dist/components/toc/clerk.js +65 -29
  10. package/dist/components/toc/default.js +5 -3
  11. package/dist/components/toc/index.d.ts +4 -2
  12. package/dist/components/toc/index.js +36 -18
  13. package/dist/components/ui/button.d.ts +1 -1
  14. package/dist/components/ui/collapsible.js +1 -1
  15. package/dist/components/ui/navigation-menu.d.ts +24 -12
  16. package/dist/components/ui/navigation-menu.js +47 -32
  17. package/dist/components/ui/popover.d.ts +7 -1
  18. package/dist/components/ui/popover.js +13 -13
  19. package/dist/components/ui/scroll-area.d.ts +15 -4
  20. package/dist/components/ui/scroll-area.js +26 -27
  21. package/dist/layouts/docs/page/slots/toc.js +3 -3
  22. package/dist/layouts/docs/slots/sidebar.js +9 -19
  23. package/dist/layouts/flux/page/slots/toc.js +3 -3
  24. package/dist/layouts/flux/slots/sidebar.js +8 -13
  25. package/dist/layouts/home/index.js +6 -1
  26. package/dist/layouts/home/navbar.d.ts +2 -4
  27. package/dist/layouts/home/navbar.js +6 -9
  28. package/dist/layouts/home/slots/header.d.ts +2 -3
  29. package/dist/layouts/home/slots/header.js +122 -112
  30. package/dist/layouts/notebook/page/slots/toc.js +3 -3
  31. package/dist/layouts/notebook/slots/sidebar.js +9 -19
  32. package/dist/style.css +302 -60
  33. package/package.json +4 -4
@@ -6,8 +6,7 @@ import { Popover, PopoverContent, PopoverTrigger } from "../../../components/ui/
6
6
  import { SearchTrigger } from "../../shared/slots/search-trigger.js";
7
7
  import { LinkItem } from "../../shared/client.js";
8
8
  import { isLayoutTabActive } from "../../shared/index.js";
9
- import { ScrollArea, ScrollViewport } from "../../../components/ui/scroll-area.js";
10
- 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";
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, SidebarViewport, base_exports, useFolder, useFolderDepth } from "../../../components/sidebar/base.js";
11
10
  import { createPageTreeRenderer } from "../../../components/sidebar/page-tree.js";
12
11
  import { createLinkItemRenderer } from "../../../components/sidebar/link-item.js";
13
12
  import { useDocsLayout } from "../client.js";
@@ -32,10 +31,13 @@ function SidebarProvider(props) {
32
31
  function Sidebar({ footer, banner, collapsible = true, components, ...rest }) {
33
32
  const { menuItems, slots, props: { tabs, nav, tabMode } } = useDocsLayout();
34
33
  const iconLinks = menuItems.filter((item) => item.type === "icon");
35
- const viewport = /* @__PURE__ */ jsxs(SidebarViewport, { children: [menuItems.filter((v) => v.type !== "icon").map((item, i, list) => /* @__PURE__ */ jsx(SidebarLinkItem, {
36
- item,
37
- className: cn(i === list.length - 1 && "mb-4")
38
- }, i)), /* @__PURE__ */ jsx(SidebarPageTree, { ...components })] });
34
+ const viewport = /* @__PURE__ */ jsx(SidebarViewport, { children: /* @__PURE__ */ jsxs("div", {
35
+ className: "flex flex-col gap-0.5",
36
+ children: [menuItems.filter((v) => v.type !== "icon").map((item, i, list) => /* @__PURE__ */ jsx(SidebarLinkItem, {
37
+ item,
38
+ className: cn(i === list.length - 1 && "mb-4")
39
+ }, i)), /* @__PURE__ */ jsx(SidebarPageTree, { ...components })]
40
+ }) });
39
41
  return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsxs(SidebarContent, {
40
42
  ...rest,
41
43
  children: [
@@ -132,18 +134,6 @@ function SidebarFolder(props) {
132
134
  function SidebarCollapseTrigger(props) {
133
135
  return /* @__PURE__ */ jsx(SidebarCollapseTrigger$1, { ...props });
134
136
  }
135
- function SidebarViewport(props) {
136
- const { className, ...rest } = props;
137
- return /* @__PURE__ */ jsx(ScrollArea, {
138
- ...rest,
139
- className: (state) => cn("min-h-0 flex-1", typeof className === "function" ? className(state) : className),
140
- children: /* @__PURE__ */ jsx(ScrollViewport, {
141
- className: "*:flex! *:flex-col! *:gap-0.5! p-4 overscroll-contain",
142
- style: { maskImage: "linear-gradient(to bottom, transparent, white 12px, white calc(100% - 12px), transparent)" },
143
- children: props.children
144
- })
145
- });
146
- }
147
137
  function SidebarTrigger(props) {
148
138
  return /* @__PURE__ */ jsx(SidebarTrigger$1, { ...props });
149
139
  }
@@ -245,7 +235,7 @@ function SidebarFolderLink({ className, style, ...props }) {
245
235
  function SidebarFolderContent({ className, children, ...props }) {
246
236
  const depth = useFolderDepth();
247
237
  return /* @__PURE__ */ jsx(SidebarFolderContent$1, {
248
- className: (state) => cn("relative flex flex-col gap-0.5 *:first:mt-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),
238
+ 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),
249
239
  ...props,
250
240
  children
251
241
  });
@@ -18,13 +18,13 @@ const { TOCProvider } = toc_exports;
18
18
  function TOC({ container, trigger, content, header, footer, style }) {
19
19
  return /* @__PURE__ */ jsxs(PageTOCPopover, {
20
20
  ...container,
21
- children: [/* @__PURE__ */ jsxs(PageTOCPopoverContent, {
21
+ children: [/* @__PURE__ */ jsx(PageTOCPopoverContent, {
22
22
  ...content,
23
- children: [
23
+ children: /* @__PURE__ */ jsxs("div", { children: [
24
24
  header,
25
25
  /* @__PURE__ */ jsx(TOCScrollArea, { children: style === "clerk" ? /* @__PURE__ */ jsx(TOCItems$1, {}) : /* @__PURE__ */ jsx(TOCItems, {}) }),
26
26
  footer
27
- ]
27
+ ] })
28
28
  }), /* @__PURE__ */ jsx(PageTOCPopoverTrigger, { ...trigger })]
29
29
  });
30
30
  }
@@ -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 { ScrollArea, ScrollViewport } from "../../../components/ui/scroll-area.js";
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(ScrollArea, {
44
- className: "min-h-0 flex-1",
45
- children: /* @__PURE__ */ jsxs(ScrollViewport, {
46
- className: "p-4 overscroll-contain",
47
- style: { maskImage: "linear-gradient(to bottom, transparent, white 12px, white calc(100% - 12px), transparent)" },
48
- children: [menuItems.filter((v) => v.type !== "icon").map((item, i, list) => /* @__PURE__ */ jsx(SidebarLinkItem, {
49
- item,
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 ?? 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: react.ForwardRefExoticComponent<Omit<Omit<_base_ui_react0.NavigationMenuItemProps, "ref"> & react.RefAttributes<HTMLLIElement>, "ref"> & react.RefAttributes<HTMLLIElement>>;
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 p-4 md:grid-cols-2 lg:grid-cols-3", typeof className === "function" ? className(state) : className),
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
- asChild: true,
28
- children: /* @__PURE__ */ jsx(Link, {
29
- ...props,
30
- 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),
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" | "button" | "main" | null | undefined;
7
+ variant?: "icon" | "main" | "button" | null | undefined;
9
8
  } & class_variance_authority_types0.ClassProp) | undefined) => string;
10
- declare function Header(props: ComponentProps<'header'>): string | number | bigint | true | react_jsx_runtime0.JSX.Element | Iterable<react.ReactNode> | Promise<string | number | bigint | boolean | react.ReactPortal | react.ReactElement<unknown, string | react.JSXElementConstructor<any>> | Iterable<react.ReactNode> | null | undefined>;
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 as NavigationMenuRoot, NavigationMenuContent, NavigationMenuItem, NavigationMenuLink, NavigationMenuList, NavigationMenuTrigger, NavigationMenuViewport } from "../../../components/ui/navigation-menu.js";
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
- if (nav?.component) return nav.component;
32
- return /* @__PURE__ */ jsxs(HeaderNavigationMenu, {
33
- transparentMode: nav?.transparentMode,
34
- ...props,
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(NavigationMenuItem, { children: /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx(NavigationMenuTrigger, {
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
- onPointerMove: nav?.enableHoverToOpen ? void 0 : (e) => e.preventDefault(),
76
- children: /* @__PURE__ */ jsx(ChevronDown, { className: "transition-transform duration-300 group-data-[state=open]:rotate-180" })
77
- }), /* @__PURE__ */ jsxs(NavigationMenuContent, {
78
- className: "flex flex-col p-4 sm:flex-row sm:items-center sm:justify-end",
79
- children: [menuItems.filter((item) => !isSecondary(item)).map((item, i) => /* @__PURE__ */ jsx(MobileNavigationMenuLinkItem, {
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
- asChild: true,
142
- children: /* @__PURE__ */ jsx(Link, {
143
- href: child.url,
144
- external: child.external,
145
- ...rest,
146
- 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),
147
- children: rest.children ?? /* @__PURE__ */ jsxs(Fragment$1, { children: [
148
- banner,
149
- /* @__PURE__ */ jsx("p", {
150
- className: "text-base font-medium",
151
- children: child.text
152
- }),
153
- /* @__PURE__ */ jsx("p", {
154
- className: "text-sm text-fd-muted-foreground empty:hidden",
155
- children: child.description
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 p-4 md:grid-cols-2 lg:grid-cols-3",
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
- asChild: true,
180
- children: /* @__PURE__ */ jsx(LinkItem, {
181
- item,
182
- "aria-label": item.type === "icon" ? item.label : void 0,
183
- className: cn(navItemVariants({ variant: item.type })),
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(NavigationMenuLink, {
201
- asChild: true,
202
- children: /* @__PURE__ */ jsx(Link, {
203
- href: item.url,
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__ */ jsx(NavigationMenuLink, {
212
- asChild: true,
213
- children: /* @__PURE__ */ jsxs(LinkItem, {
214
- item,
215
- className: cn({
216
- 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",
217
- icon: buttonVariants({
218
- size: "icon",
219
- color: "ghost"
220
- }),
221
- button: buttonVariants({
222
- color: "secondary",
223
- className: "gap-1.5 [&_svg]:size-4"
224
- })
225
- }[item.type ?? "main"], props.className),
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
@@ -35,13 +35,13 @@ const TocPopoverContext = createContext(null);
35
35
  function TOCPopover({ container, trigger, content, header, footer, style }) {
36
36
  return /* @__PURE__ */ jsxs(PageTOCPopover, {
37
37
  ...container,
38
- children: [/* @__PURE__ */ jsx(PageTOCPopoverTrigger, { ...trigger }), /* @__PURE__ */ jsxs(PageTOCPopoverContent, {
38
+ children: [/* @__PURE__ */ jsx(PageTOCPopoverTrigger, { ...trigger }), /* @__PURE__ */ jsx(PageTOCPopoverContent, {
39
39
  ...content,
40
- children: [
40
+ children: /* @__PURE__ */ jsxs("div", { children: [
41
41
  header,
42
42
  /* @__PURE__ */ jsx(TOCScrollArea, { children: style === "clerk" ? /* @__PURE__ */ jsx(TOCItems$1, {}) : /* @__PURE__ */ jsx(TOCItems, {}) }),
43
43
  footer
44
- ]
44
+ ] })
45
45
  })]
46
46
  });
47
47
  }
@@ -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 { ScrollArea, ScrollViewport } from "../../../components/ui/scroll-area.js";
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__ */ jsxs(SidebarViewport, { children: [menuItems.filter((item) => item.type !== "icon").map((item, i, arr) => /* @__PURE__ */ jsx(SidebarLinkItem, {
182
- item,
183
- className: cn("lg:hidden", i === arr.length - 1 && "mb-4")
184
- }, i)), /* @__PURE__ */ jsx(SidebarPageTree, { ...components })] });
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: [