@fumadocs/base-ui 16.7.1 → 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 (75) hide show
  1. package/css/generated/docs.css +5 -9
  2. package/css/generated/flux.css +3 -6
  3. package/css/generated/home.css +28 -14
  4. package/css/generated/notebook.css +5 -5
  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 +46 -19
  13. package/dist/components/ui/collapsible.js +1 -1
  14. package/dist/components/ui/navigation-menu.d.ts +24 -12
  15. package/dist/components/ui/navigation-menu.js +47 -32
  16. package/dist/components/ui/popover.d.ts +7 -1
  17. package/dist/components/ui/popover.js +13 -13
  18. package/dist/components/ui/scroll-area.d.ts +15 -4
  19. package/dist/components/ui/scroll-area.js +26 -27
  20. package/dist/layouts/docs/client.d.ts +3 -3
  21. package/dist/layouts/docs/client.js +19 -22
  22. package/dist/layouts/docs/index.d.ts +1 -1
  23. package/dist/layouts/docs/page/index.d.ts +91 -3
  24. package/dist/layouts/docs/page/index.js +67 -7
  25. package/dist/layouts/docs/page/slots/breadcrumb.js +1 -0
  26. package/dist/layouts/docs/page/slots/container.js +2 -1
  27. package/dist/layouts/docs/page/slots/footer.js +1 -0
  28. package/dist/layouts/docs/page/slots/toc.js +3 -3
  29. package/dist/layouts/docs/slots/container.js +1 -0
  30. package/dist/layouts/docs/slots/header.js +1 -0
  31. package/dist/layouts/docs/slots/sidebar.js +9 -19
  32. package/dist/layouts/flux/index.d.ts +4 -4
  33. package/dist/layouts/flux/index.js +8 -11
  34. package/dist/layouts/flux/page/index.d.ts +79 -3
  35. package/dist/layouts/flux/page/index.js +61 -7
  36. package/dist/layouts/flux/page/slots/breadcrumb.js +1 -0
  37. package/dist/layouts/flux/page/slots/container.js +2 -1
  38. package/dist/layouts/flux/page/slots/footer.js +1 -0
  39. package/dist/layouts/flux/page/slots/toc.d.ts +4 -1
  40. package/dist/layouts/flux/page/slots/toc.js +6 -5
  41. package/dist/layouts/flux/slots/container.js +1 -0
  42. package/dist/layouts/flux/slots/sidebar.js +8 -13
  43. package/dist/layouts/home/index.d.ts +3 -3
  44. package/dist/layouts/home/index.js +11 -8
  45. package/dist/layouts/home/navbar.d.ts +2 -4
  46. package/dist/layouts/home/navbar.js +6 -9
  47. package/dist/layouts/home/slots/container.js +1 -0
  48. package/dist/layouts/home/slots/header.d.ts +2 -3
  49. package/dist/layouts/home/slots/header.js +125 -115
  50. package/dist/layouts/notebook/client.d.ts +3 -3
  51. package/dist/layouts/notebook/client.js +14 -17
  52. package/dist/layouts/notebook/index.d.ts +1 -1
  53. package/dist/layouts/notebook/page/index.d.ts +91 -3
  54. package/dist/layouts/notebook/page/index.js +67 -7
  55. package/dist/layouts/notebook/page/slots/breadcrumb.js +1 -0
  56. package/dist/layouts/notebook/page/slots/container.js +2 -1
  57. package/dist/layouts/notebook/page/slots/footer.js +1 -0
  58. package/dist/layouts/notebook/page/slots/toc.js +3 -3
  59. package/dist/layouts/notebook/slots/container.js +1 -0
  60. package/dist/layouts/notebook/slots/sidebar.js +9 -19
  61. package/dist/layouts/shared/client.d.ts +6 -6
  62. package/dist/layouts/shared/client.js +4 -4
  63. package/dist/layouts/shared/index.d.ts +3 -3
  64. package/dist/layouts/shared/page-actions.d.ts +2 -2
  65. package/dist/layouts/shared/page-actions.js +3 -3
  66. package/dist/page.d.ts +1 -2
  67. package/dist/page.js +1 -2
  68. package/dist/style.css +302 -60
  69. package/package.json +3 -3
  70. package/dist/layouts/docs/page/client.d.ts +0 -98
  71. package/dist/layouts/docs/page/client.js +0 -110
  72. package/dist/layouts/flux/page/client.d.ts +0 -82
  73. package/dist/layouts/flux/page/client.js +0 -94
  74. package/dist/layouts/notebook/page/client.d.ts +0 -98
  75. package/dist/layouts/notebook/page/client.js +0 -110
@@ -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,3 +1,4 @@
1
+ "use client";
1
2
  import { cn } from "../../../utils/cn.js";
2
3
  import { jsx } from "react/jsx-runtime";
3
4
  //#region src/layouts/home/slots/container.tsx
@@ -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?: "button" | "main" | "icon" | 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,
@@ -45,12 +63,12 @@ function Header(props) {
45
63
  /* @__PURE__ */ jsxs("div", {
46
64
  className: "flex flex-row items-center justify-end gap-1.5 flex-1 max-lg:hidden",
47
65
  children: [
48
- slots.searchTrigger?.full && /* @__PURE__ */ jsx(slots.searchTrigger.full, {
66
+ slots.searchTrigger && /* @__PURE__ */ jsx(slots.searchTrigger.full, {
49
67
  hideIfDisabled: true,
50
68
  className: "w-full rounded-full ps-2.5 max-w-[240px]"
51
69
  }),
52
70
  slots.themeSwitch && /* @__PURE__ */ jsx(slots.themeSwitch, {}),
53
- slots.languageSelect?.root && /* @__PURE__ */ jsx(slots.languageSelect.root, { children: /* @__PURE__ */ jsx(Languages, { className: "size-5" }) }),
71
+ slots.languageSelect && /* @__PURE__ */ jsx(slots.languageSelect.root, { children: /* @__PURE__ */ jsx(Languages, { className: "size-5" }) }),
54
72
  /* @__PURE__ */ jsx("ul", {
55
73
  className: "flex flex-row gap-2 items-center empty:hidden",
56
74
  children: navItems.filter(isSecondary).map((item, i) => /* @__PURE__ */ jsx(NavigationMenuLinkItem, {
@@ -62,72 +80,76 @@ function Header(props) {
62
80
  }),
63
81
  /* @__PURE__ */ jsxs("div", {
64
82
  className: "flex flex-row items-center ms-auto -me-1.5 lg:hidden",
65
- children: [slots.searchTrigger?.sm && /* @__PURE__ */ jsx(slots.searchTrigger.sm, {
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?.root && /* @__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
@@ -5,9 +5,9 @@ import { DocsLayoutProps } from "./index.js";
5
5
  import { ComponentProps, FC } from "react";
6
6
  //#region src/layouts/notebook/client.d.ts
7
7
  interface DocsSlots extends BaseSlots {
8
- container?: FC<ComponentProps<'div'>>;
9
- header?: FC<ComponentProps<'header'>>;
10
- sidebar?: {
8
+ container: FC<ComponentProps<'div'>>;
9
+ header: FC<ComponentProps<'header'>>;
10
+ sidebar: {
11
11
  provider: FC<SidebarProviderProps>;
12
12
  root: FC<SidebarProps>;
13
13
  trigger: FC<ComponentProps<'button'>>;
@@ -7,7 +7,7 @@ import { Container } from "./slots/container.js";
7
7
  import { Sidebar, SidebarCollapseTrigger, SidebarProvider, SidebarTrigger, useSidebar } from "./slots/sidebar.js";
8
8
  import { Header } from "./slots/header.js";
9
9
  import { createContext, use } from "react";
10
- import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
10
+ import { jsx, jsxs } from "react/jsx-runtime";
11
11
  //#region src/layouts/notebook/client.tsx
12
12
  const { useProvider } = baseSlots({ useProps() {
13
13
  return useNotebookLayout().props;
@@ -26,7 +26,7 @@ function LayoutBody(props) {
26
26
  const linkItems = useLinkItems(props);
27
27
  const slots = {
28
28
  ...baseSlots,
29
- header: navEnabled ? defaultSlots?.header ?? Header : void 0,
29
+ header: defaultSlots?.header ?? Header,
30
30
  container: defaultSlots?.container ?? Container,
31
31
  sidebar: defaultSlots?.sidebar ?? {
32
32
  provider: SidebarProvider,
@@ -36,20 +36,6 @@ function LayoutBody(props) {
36
36
  useSidebar
37
37
  }
38
38
  };
39
- let content = /* @__PURE__ */ jsxs(Fragment$1, { children: [
40
- slots.header && /* @__PURE__ */ jsx(slots.header, {}),
41
- slots.sidebar && /* @__PURE__ */ jsx(slots.sidebar.root, { ...sidebarProps }),
42
- children
43
- ] });
44
- if (slots.container) content = /* @__PURE__ */ jsx(slots.container, {
45
- ...containerProps,
46
- children: content
47
- });
48
- if (slots.sidebar) content = /* @__PURE__ */ jsx(slots.sidebar.provider, {
49
- defaultOpenLevel,
50
- prefetch,
51
- children: content
52
- });
53
39
  return /* @__PURE__ */ jsx(TreeContextProvider, {
54
40
  tree,
55
41
  children: /* @__PURE__ */ jsx(LayoutContext, {
@@ -64,7 +50,18 @@ function LayoutBody(props) {
64
50
  slots,
65
51
  ...linkItems
66
52
  },
67
- children: content
53
+ children: /* @__PURE__ */ jsx(slots.sidebar.provider, {
54
+ defaultOpenLevel,
55
+ prefetch,
56
+ children: /* @__PURE__ */ jsxs(slots.container, {
57
+ ...containerProps,
58
+ children: [
59
+ navEnabled && /* @__PURE__ */ jsx(slots.header, {}),
60
+ /* @__PURE__ */ jsx(slots.sidebar.root, { ...sidebarProps }),
61
+ children
62
+ ]
63
+ })
64
+ })
68
65
  })
69
66
  });
70
67
  }
@@ -13,7 +13,7 @@ interface DocsLayoutProps extends BaseLayoutProps {
13
13
  sidebar?: SidebarOptions;
14
14
  nav?: Nav;
15
15
  containerProps?: HTMLAttributes<HTMLDivElement>;
16
- slots?: DocsSlots;
16
+ slots?: Partial<DocsSlots>;
17
17
  }
18
18
  interface Nav extends NavOptions {
19
19
  mode?: 'top' | 'auto';
@@ -1,11 +1,93 @@
1
1
  import { MarkdownCopyButton, ViewOptionsPopover } from "../../shared/page-actions.js";
2
+ import { TOCPopoverProps, TOCProps, TOCProviderProps } from "./slots/toc.js";
2
3
  import { Footer, FooterProps } from "./slots/footer.js";
3
4
  import { Breadcrumb, BreadcrumbProps } from "./slots/breadcrumb.js";
4
- import { DocsPage, DocsPageProps, DocsPageSlots, PageLastUpdate, useDocsPage } from "./client.js";
5
- import { ComponentProps } from "react";
5
+ import { ComponentProps, FC, ReactNode } from "react";
6
6
  import * as react_jsx_runtime0 from "react/jsx-runtime";
7
+ import { TOCItemType } from "fumadocs-core/toc";
7
8
 
8
9
  //#region src/layouts/notebook/page/index.d.ts
10
+ interface DocsPageProps extends ComponentProps<'article'> {
11
+ toc?: TOCItemType[];
12
+ /**
13
+ * Extend the page to fill all available space
14
+ *
15
+ * @defaultValue false
16
+ */
17
+ full?: boolean;
18
+ slots?: Partial<DocsPageSlots>;
19
+ footer?: FooterOptions;
20
+ breadcrumb?: BreadcrumbOptions;
21
+ tableOfContent?: TableOfContentOptions;
22
+ tableOfContentPopover?: TableOfContentPopoverOptions;
23
+ }
24
+ interface BreadcrumbOptions extends BreadcrumbProps {
25
+ enabled?: boolean;
26
+ /**
27
+ * @deprecated use `slots.breadcrumb` instead.
28
+ */
29
+ component?: ReactNode;
30
+ }
31
+ interface FooterOptions extends FooterProps {
32
+ enabled?: boolean;
33
+ /**
34
+ * @deprecated use `slots.footer` instead.
35
+ */
36
+ component?: ReactNode;
37
+ }
38
+ interface TableOfContentOptions extends Pick<TOCProviderProps, 'single'>, TOCProps {
39
+ enabled?: boolean;
40
+ /**
41
+ * @deprecated use `slots.toc` instead.
42
+ */
43
+ component?: ReactNode;
44
+ }
45
+ interface TableOfContentPopoverOptions extends TOCPopoverProps {
46
+ enabled?: boolean;
47
+ /**
48
+ * @deprecated use `slots.tocPopover` instead.
49
+ */
50
+ component?: ReactNode;
51
+ }
52
+ interface DocsPageSlots {
53
+ toc: {
54
+ provider: FC<TOCProviderProps>;
55
+ main: FC<TOCProps>;
56
+ popover: FC<TOCPopoverProps>;
57
+ };
58
+ container: FC<ComponentProps<'article'>>;
59
+ footer: FC<FooterProps>;
60
+ breadcrumb: FC<BreadcrumbProps>;
61
+ }
62
+ type PageSlotsProps = Pick<DocsPageProps, 'full'>;
63
+ declare function useDocsPage(): {
64
+ props: PageSlotsProps;
65
+ slots: DocsPageSlots;
66
+ };
67
+ declare function DocsPage({
68
+ tableOfContent: {
69
+ enabled: tocEnabled,
70
+ single,
71
+ ...tocProps
72
+ },
73
+ tableOfContentPopover: {
74
+ enabled: tocPopoverEnabled,
75
+ ...tocPopoverProps
76
+ },
77
+ breadcrumb: {
78
+ enabled: breadcrumbEnabled,
79
+ ...breadcrumb
80
+ },
81
+ footer: {
82
+ enabled: footerEnabled,
83
+ ...footer
84
+ },
85
+ full,
86
+ toc,
87
+ slots: defaultSlots,
88
+ children,
89
+ ...containerProps
90
+ }: DocsPageProps): react_jsx_runtime0.JSX.Element;
9
91
  declare function EditOnGitHub(props: ComponentProps<'a'>): react_jsx_runtime0.JSX.Element;
10
92
  /**
11
93
  * Add typography styles
@@ -25,5 +107,11 @@ declare function DocsTitle({
25
107
  className,
26
108
  ...props
27
109
  }: ComponentProps<'h1'>): react_jsx_runtime0.JSX.Element;
110
+ declare function PageLastUpdate({
111
+ date: value,
112
+ ...props
113
+ }: Omit<ComponentProps<'p'>, 'children'> & {
114
+ date: Date;
115
+ }): react_jsx_runtime0.JSX.Element;
28
116
  //#endregion
29
- export { type BreadcrumbProps, DocsBody, DocsDescription, DocsPage, type DocsPageProps, type DocsPageSlots, DocsTitle, EditOnGitHub, type FooterProps, MarkdownCopyButton, Breadcrumb as PageBreadcrumb, Footer as PageFooter, PageLastUpdate, ViewOptionsPopover, useDocsPage };
117
+ export { type BreadcrumbProps, DocsBody, DocsDescription, DocsPage, DocsPageProps, DocsTitle, EditOnGitHub, type FooterProps, MarkdownCopyButton, Breadcrumb as PageBreadcrumb, Footer as PageFooter, PageLastUpdate, ViewOptionsPopover, useDocsPage };