fumadocs-ui 12.4.2 → 12.5.1

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 (45) hide show
  1. package/dist/{chunk-NZA3MCPM.js → chunk-4NMHXJDQ.js} +67 -145
  2. package/dist/chunk-FMI5QZTV.js +21 -0
  3. package/dist/{chunk-BZ53GHJX.js → chunk-INUQLSIT.js} +66 -18
  4. package/dist/{docs.client.js → chunk-IY5T63PK.js} +20 -179
  5. package/dist/{chunk-KH555T4I.js → chunk-QQAMPLSA.js} +1 -1
  6. package/dist/{chunk-NUPTR2L5.js → chunk-QZBW7643.js} +6 -10
  7. package/dist/chunk-UDMQQ2YW.js +90 -0
  8. package/dist/chunk-V7IGWU5C.js +13 -0
  9. package/dist/{chunk-6JD7NGHG.js → chunk-YKLVLKDA.js} +4 -6
  10. package/dist/{chunk-VUIQ7ZYI.js → chunk-YSCK5YFO.js} +1 -0
  11. package/dist/{chunk-3F57TIUQ.js → chunk-YXSAWF3G.js} +9 -6
  12. package/dist/components/accordion.js +2 -2
  13. package/dist/components/api.d.ts +16 -2
  14. package/dist/components/api.js +19 -6
  15. package/dist/components/banner.js +1 -1
  16. package/dist/components/codeblock.js +2 -2
  17. package/dist/components/dialog/search-algolia.d.ts +10 -2
  18. package/dist/components/dialog/search-algolia.js +41 -7
  19. package/dist/components/dialog/search-default.d.ts +6 -2
  20. package/dist/components/dialog/search-default.js +21 -7
  21. package/dist/components/dialog/search.d.ts +16 -5
  22. package/dist/components/dialog/search.js +8 -5
  23. package/dist/components/files.d.ts +1 -0
  24. package/dist/components/layout/language-toggle.js +1 -1
  25. package/dist/components/layout/root-toggle.js +11 -4
  26. package/dist/components/roll-button.js +1 -1
  27. package/dist/components/tabs.d.ts +3 -5
  28. package/dist/components/tabs.js +1 -1
  29. package/dist/{docs.client.d.ts → docs-layout.client.d.ts} +4 -5
  30. package/dist/docs-layout.client.js +83 -0
  31. package/dist/dynamic-sidebar-YIDNYTMX.js +123 -0
  32. package/dist/{layout.client.d.ts → home-layout.client.d.ts} +1 -2
  33. package/dist/{layout.client.js → home-layout.client.js} +10 -7
  34. package/dist/home-layout.d.ts +7 -0
  35. package/dist/home-layout.js +29 -0
  36. package/dist/layout.d.ts +29 -3
  37. package/dist/layout.js +17 -22
  38. package/dist/{layout-ZAteQVYk.d.ts → layout.shared-GQuo9xqE.d.ts} +12 -65
  39. package/dist/mdx.client.js +2 -2
  40. package/dist/page.client.js +17 -9
  41. package/dist/provider.d.ts +1 -1
  42. package/dist/provider.js +5 -4
  43. package/dist/sidebar-C7MbvaPk.d.ts +39 -0
  44. package/dist/style.css +1 -1
  45. package/package.json +15 -7
@@ -1,11 +1,15 @@
1
1
  "use client";
2
2
  import {
3
- SearchDialog
4
- } from "../../chunk-BZ53GHJX.js";
5
- import "../../chunk-3F57TIUQ.js";
3
+ SearchDialog,
4
+ TagsList
5
+ } from "../../chunk-INUQLSIT.js";
6
6
  import "../../chunk-ET4TW6M5.js";
7
+ import "../../chunk-YXSAWF3G.js";
7
8
  import "../../chunk-HLGNIWUN.js";
8
- import "../../chunk-VUIQ7ZYI.js";
9
+ import {
10
+ useOnChange
11
+ } from "../../chunk-V7IGWU5C.js";
12
+ import "../../chunk-YSCK5YFO.js";
9
13
  import "../../chunk-TK3TM3MR.js";
10
14
  import "../../chunk-MLKGABMK.js";
11
15
 
@@ -13,20 +17,50 @@ import "../../chunk-MLKGABMK.js";
13
17
  import {
14
18
  useAlgoliaSearch
15
19
  } from "fumadocs-core/search-algolia/client";
16
- import { jsx } from "react/jsx-runtime";
20
+ import { useState } from "react";
21
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
17
22
  function AlgoliaSearchDialog({
18
23
  index,
19
24
  searchOptions,
25
+ tags,
26
+ defaultTag,
27
+ showAlgolia = false,
20
28
  ...props
21
29
  }) {
22
- const { search, setSearch, query } = useAlgoliaSearch(index, searchOptions);
30
+ const [tag, setTag] = useState(defaultTag);
31
+ let filters = searchOptions?.filters;
32
+ if (tag) {
33
+ filters = filters ? `tag:${tag} AND (${filters})` : `tag:${tag}`;
34
+ }
35
+ const { search, setSearch, query } = useAlgoliaSearch(index, {
36
+ ...searchOptions,
37
+ filters
38
+ });
39
+ useOnChange(defaultTag, (v) => {
40
+ setTag(v);
41
+ });
23
42
  return /* @__PURE__ */ jsx(
24
43
  SearchDialog,
25
44
  {
26
45
  search,
27
46
  onSearchChange: setSearch,
28
47
  results: query.data ?? [],
29
- ...props
48
+ ...props,
49
+ footer: /* @__PURE__ */ jsxs(Fragment, { children: [
50
+ tags ? /* @__PURE__ */ jsx(TagsList, { tag, onTagChange: setTag, items: tags, children: showAlgolia ? /* @__PURE__ */ jsx(AlgoliaTitle, {}) : null }) : null,
51
+ props.footer
52
+ ] })
53
+ }
54
+ );
55
+ }
56
+ function AlgoliaTitle() {
57
+ return /* @__PURE__ */ jsx(
58
+ "a",
59
+ {
60
+ href: "https://algolia.com",
61
+ rel: "noreferrer noopener",
62
+ className: "ms-auto text-xs text-muted-foreground",
63
+ children: "Search powered by Algolia"
30
64
  }
31
65
  );
32
66
  }
@@ -1,12 +1,16 @@
1
1
  import { ReactNode } from 'react';
2
- import { SharedProps } from './search.js';
2
+ import { SharedProps, TagItem } from './search.js';
3
3
  import 'fumadocs-core/search/shared';
4
4
 
5
5
  interface DefaultSearchDialogProps extends SharedProps {
6
6
  /**
7
7
  * Search tag
8
+ *
9
+ * @deprecated Use Tags API instead
8
10
  */
9
11
  tag?: string;
12
+ defaultTag?: string;
13
+ tags?: TagItem[];
10
14
  /**
11
15
  * Search API URL
12
16
  */
@@ -17,6 +21,6 @@ interface DefaultSearchDialogProps extends SharedProps {
17
21
  delayMs?: number;
18
22
  footer?: ReactNode;
19
23
  }
20
- declare function DefaultSearchDialog({ tag, api, delayMs, ...props }: DefaultSearchDialogProps): React.ReactElement;
24
+ declare function DefaultSearchDialog({ defaultTag, tags, api, delayMs, ...props }: DefaultSearchDialogProps): React.ReactElement;
21
25
 
22
26
  export { type DefaultSearchDialogProps, DefaultSearchDialog as default };
@@ -1,34 +1,48 @@
1
1
  "use client";
2
2
  import {
3
- SearchDialog
4
- } from "../../chunk-BZ53GHJX.js";
5
- import "../../chunk-3F57TIUQ.js";
3
+ SearchDialog,
4
+ TagsList
5
+ } from "../../chunk-INUQLSIT.js";
6
6
  import "../../chunk-ET4TW6M5.js";
7
+ import "../../chunk-YXSAWF3G.js";
7
8
  import {
8
9
  useI18n
9
10
  } from "../../chunk-HLGNIWUN.js";
10
- import "../../chunk-VUIQ7ZYI.js";
11
+ import {
12
+ useOnChange
13
+ } from "../../chunk-V7IGWU5C.js";
14
+ import "../../chunk-YSCK5YFO.js";
11
15
  import "../../chunk-TK3TM3MR.js";
12
16
  import "../../chunk-MLKGABMK.js";
13
17
 
14
18
  // src/components/dialog/search-default.tsx
15
19
  import { useDocsSearch } from "fumadocs-core/search/client";
16
- import { jsx } from "react/jsx-runtime";
20
+ import { useState } from "react";
21
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
17
22
  function DefaultSearchDialog({
18
- tag,
23
+ defaultTag,
24
+ tags,
19
25
  api,
20
26
  delayMs,
21
27
  ...props
22
28
  }) {
23
29
  const { locale } = useI18n();
30
+ const [tag, setTag] = useState(defaultTag);
24
31
  const { search, setSearch, query } = useDocsSearch(locale, tag, api, delayMs);
32
+ useOnChange(defaultTag, (v) => {
33
+ setTag(v);
34
+ });
25
35
  return /* @__PURE__ */ jsx(
26
36
  SearchDialog,
27
37
  {
28
38
  search,
29
39
  onSearchChange: setSearch,
30
40
  results: query.data ?? [],
31
- ...props
41
+ ...props,
42
+ footer: /* @__PURE__ */ jsxs(Fragment, { children: [
43
+ tags ? /* @__PURE__ */ jsx(TagsList, { tag, onTagChange: setTag, items: tags }) : null,
44
+ props.footer
45
+ ] })
32
46
  }
33
47
  );
34
48
  }
@@ -1,5 +1,5 @@
1
1
  import { SortedResult } from 'fumadocs-core/search/shared';
2
- import { ReactNode } from 'react';
2
+ import { HTMLAttributes, ReactNode } from 'react';
3
3
 
4
4
  type SearchLink = [name: string, href: string];
5
5
  interface SharedProps {
@@ -10,15 +10,26 @@ interface SharedProps {
10
10
  */
11
11
  links?: SearchLink[];
12
12
  }
13
- interface SearchDialogProps extends SharedProps, Omit<SearchContentProps, 'defaultItems'> {
13
+ interface SearchDialogProps extends SharedProps, Omit<SearchContentProps, 'items'> {
14
+ results: SortedResult[] | 'empty';
14
15
  footer?: ReactNode;
15
16
  }
16
17
  interface SearchContentProps {
17
18
  search: string;
18
19
  onSearchChange: (v: string) => void;
19
- results: SortedResult[] | 'empty';
20
- defaultItems?: SortedResult[];
20
+ items: SortedResult[];
21
+ hideResults?: boolean;
21
22
  }
22
23
  declare function SearchDialog({ open, onOpenChange, footer, links, ...props }: SearchDialogProps): React.ReactElement;
24
+ interface TagItem {
25
+ name: string;
26
+ value: string;
27
+ }
28
+ interface TagsListProps extends HTMLAttributes<HTMLDivElement> {
29
+ tag?: string;
30
+ onTagChange: (tag: string) => void;
31
+ items: TagItem[];
32
+ }
33
+ declare function TagsList({ tag, onTagChange, items, ...props }: TagsListProps): ReactNode;
23
34
 
24
- export { SearchDialog, type SearchLink, type SharedProps };
35
+ export { SearchDialog, type SearchLink, type SharedProps, type TagItem, TagsList, type TagsListProps };
@@ -1,12 +1,15 @@
1
1
  import {
2
- SearchDialog
3
- } from "../../chunk-BZ53GHJX.js";
4
- import "../../chunk-3F57TIUQ.js";
2
+ SearchDialog,
3
+ TagsList
4
+ } from "../../chunk-INUQLSIT.js";
5
5
  import "../../chunk-ET4TW6M5.js";
6
+ import "../../chunk-YXSAWF3G.js";
6
7
  import "../../chunk-HLGNIWUN.js";
7
- import "../../chunk-VUIQ7ZYI.js";
8
+ import "../../chunk-V7IGWU5C.js";
9
+ import "../../chunk-YSCK5YFO.js";
8
10
  import "../../chunk-TK3TM3MR.js";
9
11
  import "../../chunk-MLKGABMK.js";
10
12
  export {
11
- SearchDialog
13
+ SearchDialog,
14
+ TagsList
12
15
  };
@@ -7,6 +7,7 @@ interface FileProps extends HTMLAttributes<HTMLDivElement> {
7
7
  }
8
8
  interface FolderProps extends HTMLAttributes<HTMLDivElement> {
9
9
  name: string;
10
+ disabled?: boolean;
10
11
  /**
11
12
  * Open folder by default
12
13
  *
@@ -9,7 +9,7 @@ import {
9
9
  } from "../../chunk-HLGNIWUN.js";
10
10
  import {
11
11
  buttonVariants
12
- } from "../../chunk-VUIQ7ZYI.js";
12
+ } from "../../chunk-YSCK5YFO.js";
13
13
  import {
14
14
  twMerge
15
15
  } from "../../chunk-TK3TM3MR.js";
@@ -7,6 +7,10 @@ import {
7
7
  import {
8
8
  isActive
9
9
  } from "../../chunk-IIDV3RNQ.js";
10
+ import {
11
+ useSidebar
12
+ } from "../../chunk-YXSAWF3G.js";
13
+ import "../../chunk-V7IGWU5C.js";
10
14
  import {
11
15
  twMerge
12
16
  } from "../../chunk-TK3TM3MR.js";
@@ -14,7 +18,7 @@ import "../../chunk-MLKGABMK.js";
14
18
 
15
19
  // src/components/layout/root-toggle.tsx
16
20
  import { ChevronDown } from "lucide-react";
17
- import { useState } from "react";
21
+ import { useCallback, useState } from "react";
18
22
  import Link from "next/link";
19
23
  import { usePathname } from "next/navigation";
20
24
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
@@ -22,8 +26,13 @@ function RootToggle({
22
26
  options
23
27
  }) {
24
28
  const [open, setOpen] = useState(false);
29
+ const { closeOnRedirect } = useSidebar();
25
30
  const pathname = usePathname();
26
31
  const selected = options.find((item) => isActive(item.url, pathname, true)) ?? options[0];
32
+ const onClick = useCallback(() => {
33
+ closeOnRedirect.current = false;
34
+ setOpen(false);
35
+ }, [closeOnRedirect]);
27
36
  return /* @__PURE__ */ jsxs(Popover, { open, onOpenChange: setOpen, children: [
28
37
  /* @__PURE__ */ jsxs(PopoverTrigger, { className: "-mx-2 flex flex-row items-center gap-2.5 rounded-lg p-2 hover:bg-muted", children: [
29
38
  /* @__PURE__ */ jsx(Item, { ...selected }),
@@ -33,9 +42,7 @@ function RootToggle({
33
42
  Link,
34
43
  {
35
44
  href: item.url,
36
- onClick: () => {
37
- setOpen(false);
38
- },
45
+ onClick,
39
46
  className: twMerge(
40
47
  "flex w-full flex-row gap-2 p-2",
41
48
  selected === item ? "bg-accent text-accent-foreground" : "hover:bg-accent/50"
@@ -5,7 +5,7 @@ import {
5
5
  import "../chunk-IIDV3RNQ.js";
6
6
  import {
7
7
  buttonVariants
8
- } from "../chunk-VUIQ7ZYI.js";
8
+ } from "../chunk-YSCK5YFO.js";
9
9
  import {
10
10
  twMerge
11
11
  } from "../chunk-TK3TM3MR.js";
@@ -1,7 +1,6 @@
1
1
  import * as TabsPrimitive from '@radix-ui/react-tabs';
2
- import { TabsContentProps } from '@radix-ui/react-tabs';
2
+ import { TabsProps as TabsProps$1, TabsContentProps } from '@radix-ui/react-tabs';
3
3
  import * as React$1 from 'react';
4
- import { ReactNode } from 'react';
5
4
 
6
5
  declare const Tabs$1: React$1.ForwardRefExoticComponent<Omit<TabsPrimitive.TabsProps & React$1.RefAttributes<HTMLDivElement>, "ref"> & React$1.RefAttributes<HTMLDivElement>>;
7
6
  declare const TabsList: React$1.ForwardRefExoticComponent<Omit<TabsPrimitive.TabsListProps & React$1.RefAttributes<HTMLDivElement>, "ref"> & React$1.RefAttributes<HTMLDivElement>>;
@@ -15,7 +14,7 @@ declare namespace tabs {
15
14
  export { Tabs$1 as Tabs, tabs_TabsContent as TabsContent, tabs_TabsList as TabsList, tabs_TabsTrigger as TabsTrigger };
16
15
  }
17
16
 
18
- interface TabsProps {
17
+ interface TabsProps extends TabsProps$1 {
19
18
  /**
20
19
  * Identifier for Sharing value of tabs
21
20
  */
@@ -29,9 +28,8 @@ interface TabsProps {
29
28
  */
30
29
  defaultIndex?: number;
31
30
  items?: string[];
32
- children: ReactNode;
33
31
  }
34
- declare function Tabs({ id, items, persist, defaultIndex, children, }: TabsProps): React.ReactElement;
32
+ declare function Tabs({ id, items, persist, defaultIndex, ...props }: TabsProps): React.ReactElement;
35
33
  declare function Tab({ value, className, ...props }: TabsContentProps): React.ReactElement;
36
34
 
37
35
  export { tabs as Primitive, Tab, Tabs, type TabsProps };
@@ -3,7 +3,7 @@ import {
3
3
  Tab,
4
4
  Tabs,
5
5
  tabs_exports
6
- } from "../chunk-NUPTR2L5.js";
6
+ } from "../chunk-QZBW7643.js";
7
7
  import "../chunk-TK3TM3MR.js";
8
8
  import "../chunk-MLKGABMK.js";
9
9
  export {
@@ -1,13 +1,12 @@
1
- import { S as SidebarProps, a as SharedNavProps } from './layout-ZAteQVYk.js';
2
- export { L as LinksMenu, b as Sidebar } from './layout-ZAteQVYk.js';
1
+ import { S as SharedNavProps } from './layout.shared-GQuo9xqE.js';
2
+ export { a as LinksMenu } from './layout.shared-GQuo9xqE.js';
3
+ export { a as Sidebar } from './sidebar-C7MbvaPk.js';
3
4
  export { T as TreeContextProvider } from './tree-CrKzI9Nz.js';
4
5
  import { ButtonHTMLAttributes } from 'react';
5
6
  import 'fumadocs-core/server';
6
7
 
7
- declare function DynamicSidebar(props: SidebarProps): React.ReactElement;
8
-
9
8
  declare function ThemeToggle({ className, ...props }: ButtonHTMLAttributes<HTMLButtonElement>): React.ReactElement;
10
9
 
11
10
  declare function SubNav({ title, url, transparentMode, children, enableSearch, }: SharedNavProps): React.ReactElement;
12
11
 
13
- export { DynamicSidebar, SubNav, ThemeToggle };
12
+ export { SubNav, ThemeToggle };
@@ -0,0 +1,83 @@
1
+ "use client";
2
+ import {
3
+ NavBox,
4
+ ThemeToggle,
5
+ Title
6
+ } from "./chunk-UDMQQ2YW.js";
7
+ import {
8
+ Sidebar
9
+ } from "./chunk-IY5T63PK.js";
10
+ import {
11
+ LinksMenu,
12
+ SearchToggle
13
+ } from "./chunk-4NMHXJDQ.js";
14
+ import "./chunk-VYTHQTZE.js";
15
+ import "./chunk-GHKJ6EFT.js";
16
+ import {
17
+ TreeContextProvider
18
+ } from "./chunk-R3M2OC5U.js";
19
+ import "./chunk-IIDV3RNQ.js";
20
+ import {
21
+ useSearchContext
22
+ } from "./chunk-ET4TW6M5.js";
23
+ import {
24
+ useSidebar
25
+ } from "./chunk-YXSAWF3G.js";
26
+ import "./chunk-HLGNIWUN.js";
27
+ import "./chunk-V7IGWU5C.js";
28
+ import "./chunk-7XPZOMJ2.js";
29
+ import {
30
+ buttonVariants
31
+ } from "./chunk-YSCK5YFO.js";
32
+ import {
33
+ twMerge
34
+ } from "./chunk-TK3TM3MR.js";
35
+ import "./chunk-MLKGABMK.js";
36
+
37
+ // src/docs-layout.client.tsx
38
+ import { SidebarTrigger } from "fumadocs-core/sidebar";
39
+ import { Menu, X } from "lucide-react";
40
+ import { jsx, jsxs } from "react/jsx-runtime";
41
+ function SubNav({
42
+ title,
43
+ url,
44
+ transparentMode,
45
+ children,
46
+ enableSearch = true
47
+ }) {
48
+ const { open } = useSidebar();
49
+ const { enabled } = useSearchContext();
50
+ return /* @__PURE__ */ jsxs(
51
+ NavBox,
52
+ {
53
+ id: "nd-subnav",
54
+ className: "flex h-14 flex-row items-center px-4 md:hidden",
55
+ transparentMode,
56
+ children: [
57
+ /* @__PURE__ */ jsx(Title, { url, title }),
58
+ /* @__PURE__ */ jsx("div", { className: "flex flex-1 flex-row items-center", children }),
59
+ enabled && enableSearch ? /* @__PURE__ */ jsx(SearchToggle, {}) : null,
60
+ /* @__PURE__ */ jsx(
61
+ SidebarTrigger,
62
+ {
63
+ className: twMerge(
64
+ buttonVariants({
65
+ color: "ghost",
66
+ size: "icon",
67
+ className: "-me-2"
68
+ })
69
+ ),
70
+ children: open ? /* @__PURE__ */ jsx(X, {}) : /* @__PURE__ */ jsx(Menu, {})
71
+ }
72
+ )
73
+ ]
74
+ }
75
+ );
76
+ }
77
+ export {
78
+ LinksMenu,
79
+ Sidebar,
80
+ SubNav,
81
+ ThemeToggle,
82
+ TreeContextProvider
83
+ };
@@ -0,0 +1,123 @@
1
+ "use client";
2
+ import {
3
+ Sidebar
4
+ } from "./chunk-IY5T63PK.js";
5
+ import "./chunk-4NMHXJDQ.js";
6
+ import "./chunk-VYTHQTZE.js";
7
+ import "./chunk-GHKJ6EFT.js";
8
+ import "./chunk-R3M2OC5U.js";
9
+ import "./chunk-IIDV3RNQ.js";
10
+ import "./chunk-ET4TW6M5.js";
11
+ import {
12
+ useSidebar
13
+ } from "./chunk-YXSAWF3G.js";
14
+ import "./chunk-HLGNIWUN.js";
15
+ import "./chunk-V7IGWU5C.js";
16
+ import "./chunk-7XPZOMJ2.js";
17
+ import {
18
+ buttonVariants
19
+ } from "./chunk-YSCK5YFO.js";
20
+ import {
21
+ twMerge
22
+ } from "./chunk-TK3TM3MR.js";
23
+ import "./chunk-MLKGABMK.js";
24
+
25
+ // src/components/layout/dynamic-sidebar.tsx
26
+ import { useCallback, useRef, useState } from "react";
27
+ import { SidebarIcon } from "lucide-react";
28
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
29
+ function DynamicSidebar(props) {
30
+ const { collapsed, setCollapsed } = useSidebar();
31
+ const [hover, setHover] = useState(false);
32
+ const timerRef = useRef(0);
33
+ const closeTimeRef = useRef(0);
34
+ const onCollapse = useCallback(() => {
35
+ setCollapsed((v) => !v);
36
+ setHover(false);
37
+ closeTimeRef.current = Date.now() + 150;
38
+ }, [setCollapsed]);
39
+ const onEnter = useCallback((e) => {
40
+ if (e.pointerType === "touch" || closeTimeRef.current > Date.now()) return;
41
+ window.clearTimeout(timerRef.current);
42
+ setHover(true);
43
+ }, []);
44
+ const onLeave = useCallback((e) => {
45
+ if (e.pointerType === "touch") return;
46
+ window.clearTimeout(timerRef.current);
47
+ timerRef.current = window.setTimeout(
48
+ () => {
49
+ setHover(false);
50
+ closeTimeRef.current = Date.now() + 150;
51
+ },
52
+ Math.min(e.clientX, document.body.clientWidth - e.clientX) > 100 ? 0 : 500
53
+ );
54
+ }, []);
55
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
56
+ collapsed ? /* @__PURE__ */ jsx(
57
+ "div",
58
+ {
59
+ className: "fixed inset-y-0 start-0 w-6 max-md:hidden xl:w-[50px]",
60
+ onPointerEnter: onEnter,
61
+ onPointerLeave: onLeave
62
+ }
63
+ ) : null,
64
+ collapsed ? /* @__PURE__ */ jsx(
65
+ "button",
66
+ {
67
+ type: "button",
68
+ "aria-label": "Collapse Sidebar",
69
+ className: twMerge(
70
+ buttonVariants({
71
+ color: "secondary",
72
+ size: "icon",
73
+ className: "fixed start-4 bottom-2 z-10 max-md:hidden"
74
+ })
75
+ ),
76
+ onClick: onCollapse,
77
+ children: /* @__PURE__ */ jsx(SidebarIcon, {})
78
+ }
79
+ ) : null,
80
+ /* @__PURE__ */ jsx(
81
+ Sidebar,
82
+ {
83
+ ...props,
84
+ aside: {
85
+ "data-collapse": collapsed,
86
+ "data-hover": hover,
87
+ onPointerEnter: onEnter,
88
+ onPointerLeave: onLeave,
89
+ "aria-hidden": Boolean(collapsed && !hover),
90
+ className: twMerge(
91
+ "md:transition-[transform,margin]",
92
+ collapsed && [
93
+ "md:top-1 md:mr-[-240px] md:h-[calc(100dvh-4px)] md:animate-sidebar-collapse md:rounded-xl md:border md:shadow-md xl:mr-[-260px]",
94
+ hover ? "md:translate-x-1 rtl:md:-translate-x-1" : "md:-translate-x-full rtl:md:translate-x-full"
95
+ ]
96
+ )
97
+ },
98
+ footer: /* @__PURE__ */ jsxs(Fragment, { children: [
99
+ props.footer,
100
+ /* @__PURE__ */ jsx(
101
+ "button",
102
+ {
103
+ type: "button",
104
+ "aria-label": "Collapse Sidebar",
105
+ className: twMerge(
106
+ buttonVariants({
107
+ color: "ghost",
108
+ size: "icon",
109
+ className: "max-md:hidden"
110
+ })
111
+ ),
112
+ onClick: onCollapse,
113
+ children: /* @__PURE__ */ jsx(SidebarIcon, {})
114
+ }
115
+ )
116
+ ] })
117
+ }
118
+ )
119
+ ] });
120
+ }
121
+ export {
122
+ DynamicSidebar
123
+ };
@@ -1,5 +1,4 @@
1
- import { a as SharedNavProps, c as LinkItemType } from './layout-ZAteQVYk.js';
2
- import 'fumadocs-core/server';
1
+ import { S as SharedNavProps, L as LinkItemType } from './layout.shared-GQuo9xqE.js';
3
2
  import 'react';
4
3
 
5
4
  declare function Nav({ title, url, items, transparentMode, enableSearch, children, }: SharedNavProps & {
@@ -1,13 +1,15 @@
1
1
  "use client";
2
2
  import {
3
- LargeSearchToggle,
4
- LinkItem,
5
- LinksMenu,
6
3
  NavBox,
7
- SearchToggle,
8
4
  ThemeToggle,
9
5
  Title
10
- } from "./chunk-NZA3MCPM.js";
6
+ } from "./chunk-UDMQQ2YW.js";
7
+ import {
8
+ LargeSearchToggle,
9
+ LinkItem,
10
+ LinksMenu,
11
+ SearchToggle
12
+ } from "./chunk-4NMHXJDQ.js";
11
13
  import "./chunk-GHKJ6EFT.js";
12
14
  import {
13
15
  isSecondary
@@ -18,16 +20,17 @@ import {
18
20
  import {
19
21
  useI18n
20
22
  } from "./chunk-HLGNIWUN.js";
23
+ import "./chunk-V7IGWU5C.js";
21
24
  import "./chunk-7XPZOMJ2.js";
22
25
  import {
23
26
  buttonVariants
24
- } from "./chunk-VUIQ7ZYI.js";
27
+ } from "./chunk-YSCK5YFO.js";
25
28
  import {
26
29
  twMerge
27
30
  } from "./chunk-TK3TM3MR.js";
28
31
  import "./chunk-MLKGABMK.js";
29
32
 
30
- // src/layout.client.tsx
33
+ // src/home-layout.client.tsx
31
34
  import { MoreVertical } from "lucide-react";
32
35
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
33
36
  function Nav({
@@ -0,0 +1,7 @@
1
+ import { B as BaseLayoutProps } from './layout.shared-GQuo9xqE.js';
2
+ import 'react';
3
+
4
+ type HomeLayoutProps = BaseLayoutProps;
5
+ declare function HomeLayout({ nav, links, githubUrl, children, }: BaseLayoutProps): React.ReactElement;
6
+
7
+ export { HomeLayout, type HomeLayoutProps };
@@ -0,0 +1,29 @@
1
+ import { Nav } from "./home-layout.client"
2
+ import {
3
+ getLinks
4
+ } from "./chunk-FMI5QZTV.js";
5
+ import {
6
+ replaceOrDefault
7
+ } from "./chunk-IIDV3RNQ.js";
8
+ import "./chunk-MLKGABMK.js";
9
+
10
+ // src/home-layout.tsx
11
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
12
+ function HomeLayout({
13
+ nav = {},
14
+ links = [],
15
+ githubUrl,
16
+ children
17
+ }) {
18
+ const finalLinks = getLinks(links, githubUrl);
19
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
20
+ replaceOrDefault(
21
+ nav,
22
+ /* @__PURE__ */ jsx(Nav, { items: finalLinks, ...nav, children: nav.children })
23
+ ),
24
+ children
25
+ ] });
26
+ }
27
+ export {
28
+ HomeLayout
29
+ };
package/dist/layout.d.ts CHANGED
@@ -1,3 +1,29 @@
1
- import 'fumadocs-core/server';
2
- import 'react';
3
- export { B as BaseLayoutProps, e as DocsLayout, D as DocsLayoutProps, d as Layout, c as LinkItemType, a as SharedNavProps } from './layout-ZAteQVYk.js';
1
+ import { PageTree } from 'fumadocs-core/server';
2
+ import { HTMLAttributes, ReactNode } from 'react';
3
+ import { S as SidebarProps } from './sidebar-C7MbvaPk.js';
4
+ import { B as BaseLayoutProps } from './layout.shared-GQuo9xqE.js';
5
+ export { L as LinkItemType } from './layout.shared-GQuo9xqE.js';
6
+
7
+ interface SidebarOptions extends Omit<SidebarProps, 'items'> {
8
+ enabled: boolean;
9
+ component: ReactNode;
10
+ collapsible: boolean;
11
+ }
12
+ interface DocsLayoutProps extends BaseLayoutProps {
13
+ tree: PageTree.Root;
14
+ sidebar?: Partial<SidebarOptions>;
15
+ containerProps?: HTMLAttributes<HTMLDivElement>;
16
+ /**
17
+ * Enable Language Switch
18
+ *
19
+ * @defaultValue false
20
+ */
21
+ i18n?: boolean;
22
+ }
23
+ /**
24
+ * @deprecated Use `HomeLayout` from `fumadocs-ui/home-layout` instead
25
+ */
26
+ declare function Layout({ nav, links, githubUrl, children, }: BaseLayoutProps): React.ReactElement;
27
+ declare function DocsLayout({ nav, githubUrl, sidebar: { enabled: sidebarEnabled, collapsible, component: sidebarReplace, ...sidebar }, links, containerProps, tree, i18n, children, }: DocsLayoutProps): React.ReactElement;
28
+
29
+ export { BaseLayoutProps, DocsLayout, type DocsLayoutProps, Layout };