fumadocs-ui 12.3.6 → 12.4.0

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 (35) hide show
  1. package/dist/{chunk-3WVIP3N5.js → chunk-6JD7NGHG.js} +1 -1
  2. package/dist/{chunk-U2R7CI27.js → chunk-BZ53GHJX.js} +1 -1
  3. package/dist/{chunk-AN2Y6MA2.js → chunk-IIDV3RNQ.js} +5 -1
  4. package/dist/{chunk-Q3FSJZ3E.js → chunk-KH555T4I.js} +1 -1
  5. package/dist/{chunk-FOIG7ZU7.js → chunk-NZA3MCPM.js} +61 -62
  6. package/dist/{chunk-34Z7WODD.js → chunk-R3M2OC5U.js} +1 -1
  7. package/dist/{chunk-CPOVVDVF.js → chunk-VUIQ7ZYI.js} +16 -1
  8. package/dist/components/accordion.js +2 -2
  9. package/dist/components/api.js +2 -2
  10. package/dist/components/banner.js +1 -1
  11. package/dist/components/callout.d.ts +1 -1
  12. package/dist/components/codeblock.js +2 -2
  13. package/dist/components/dialog/search-algolia.js +2 -2
  14. package/dist/components/dialog/search-default.js +2 -2
  15. package/dist/components/dialog/search.js +2 -2
  16. package/dist/components/image-zoom.js +1 -1
  17. package/dist/components/layout/language-toggle.js +1 -1
  18. package/dist/components/layout/root-toggle.js +1 -1
  19. package/dist/components/roll-button.js +4 -4
  20. package/dist/docs.client.d.ts +3 -9
  21. package/dist/docs.client.js +6 -17
  22. package/dist/{layout-CyXwmMCy.d.ts → layout-ZAteQVYk.d.ts} +67 -43
  23. package/dist/layout.client.d.ts +1 -1
  24. package/dist/layout.client.js +19 -18
  25. package/dist/layout.d.ts +1 -1
  26. package/dist/layout.js +17 -2
  27. package/dist/mdx.client.js +2 -2
  28. package/dist/mdx.js +1 -1
  29. package/dist/page.client.js +14 -16
  30. package/dist/page.js +1 -1
  31. package/dist/provider.js +2 -2
  32. package/dist/style.css +1 -1
  33. package/dist/tailwind-plugin.cjs +1 -1
  34. package/dist/tailwind-plugin.js +1 -1
  35. package/package.json +4 -4
@@ -1,5 +1,5 @@
1
1
  import { PageTree } from 'fumadocs-core/server';
2
- import { ReactNode, HTMLAttributes, ReactElement } from 'react';
2
+ import { ReactNode, HTMLAttributes } from 'react';
3
3
 
4
4
  interface NavBoxProps {
5
5
  /**
@@ -18,6 +18,71 @@ interface TitleProps {
18
18
  url?: string;
19
19
  }
20
20
 
21
+ interface BaseItem {
22
+ /**
23
+ * Restrict where the item is displayed
24
+ *
25
+ * @defaultValue 'all'
26
+ */
27
+ on?: 'menu' | 'nav' | 'all';
28
+ }
29
+ interface BaseLinkItem extends BaseItem {
30
+ url: string;
31
+ /**
32
+ * When the item is marked as active
33
+ *
34
+ * @defaultValue 'url'
35
+ */
36
+ active?: 'url' | 'nested-url' | 'none';
37
+ external?: boolean;
38
+ }
39
+ type LinkItemType = (BaseLinkItem & {
40
+ type?: 'main';
41
+ icon?: ReactNode;
42
+ text: ReactNode;
43
+ }) | (BaseLinkItem & {
44
+ type: 'icon' | 'secondary';
45
+ /**
46
+ * `aria-label` of icon button
47
+ */
48
+ label?: string;
49
+ icon: ReactNode;
50
+ text: ReactNode;
51
+ /**
52
+ * @defaultValue true
53
+ */
54
+ secondary?: boolean;
55
+ }) | (BaseLinkItem & {
56
+ type: 'button';
57
+ icon?: ReactNode;
58
+ text: ReactNode;
59
+ /**
60
+ * @defaultValue false
61
+ */
62
+ secondary?: boolean;
63
+ }) | (BaseItem & {
64
+ type: 'menu';
65
+ icon?: ReactNode;
66
+ text: ReactNode;
67
+ items: LinkItemType[];
68
+ /**
69
+ * @defaultValue false
70
+ */
71
+ secondary?: boolean;
72
+ }) | (BaseItem & {
73
+ type: 'custom';
74
+ /**
75
+ * @defaultValue false
76
+ */
77
+ secondary?: boolean;
78
+ children: ReactNode;
79
+ });
80
+ interface LinksMenuProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
81
+ items: LinkItemType[];
82
+ footer?: React.ReactNode;
83
+ }
84
+ declare function LinksMenu({ items, footer, ...props }: LinksMenuProps): React.ReactElement;
85
+
21
86
  interface SidebarProps {
22
87
  items: LinkItemType[];
23
88
  /**
@@ -52,47 +117,6 @@ declare function Sidebar({ footer, components, defaultOpenLevel, banner, items,
52
117
  aside?: HTMLAttributes<HTMLElement> & Record<string, unknown>;
53
118
  }): React.ReactElement;
54
119
 
55
- type ActiveType = 'none' | 'url' | 'nested-url';
56
- type LinkItemType = {
57
- type?: 'main';
58
- url: string;
59
- /**
60
- * When the item is marked as active
61
- *
62
- * @defaultValue 'url'
63
- */
64
- active?: ActiveType;
65
- icon?: ReactNode;
66
- text: string;
67
- external?: boolean;
68
- } | {
69
- type: 'menu';
70
- icon?: ReactNode;
71
- text: string;
72
- items: LinkItemType[];
73
- } | {
74
- type: 'secondary';
75
- url: string;
76
- /**
77
- * When the item is marked as active
78
- *
79
- * @defaultValue 'url'
80
- */
81
- active?: ActiveType;
82
- icon: ReactNode;
83
- text: string;
84
- external?: boolean;
85
- } | {
86
- type: 'custom';
87
- /**
88
- * Restrict where the item is displayed
89
- *
90
- * @defaultValue 'all'
91
- */
92
- on?: 'menu' | 'nav' | 'all';
93
- secondary?: boolean;
94
- children: ReactElement;
95
- };
96
120
  interface NavOptions extends SharedNavProps {
97
121
  enabled: boolean;
98
122
  component: ReactNode;
@@ -137,4 +161,4 @@ interface DocsLayoutProps extends BaseLayoutProps {
137
161
  declare function Layout({ nav, links, githubUrl, children, }: BaseLayoutProps): React.ReactElement;
138
162
  declare function DocsLayout({ nav, githubUrl, sidebar: { enabled: sidebarEnabled, collapsible, component: sidebarReplace, ...sidebar }, links, containerProps, tree, i18n, children, }: DocsLayoutProps): React.ReactElement;
139
163
 
140
- export { type BaseLayoutProps as B, type DocsLayoutProps as D, type LinkItemType as L, type SidebarProps as S, type SharedNavProps as a, Sidebar as b, Layout as c, DocsLayout as d };
164
+ export { type BaseLayoutProps as B, type DocsLayoutProps as D, LinksMenu as L, type SidebarProps as S, type SharedNavProps as a, Sidebar as b, type LinkItemType as c, Layout as d, DocsLayout as e };
@@ -1,4 +1,4 @@
1
- import { a as SharedNavProps, L as LinkItemType } from './layout-CyXwmMCy.js';
1
+ import { a as SharedNavProps, c as LinkItemType } from './layout-ZAteQVYk.js';
2
2
  import 'fumadocs-core/server';
3
3
  import 'react';
4
4
 
@@ -7,9 +7,11 @@ import {
7
7
  SearchToggle,
8
8
  ThemeToggle,
9
9
  Title
10
- } from "./chunk-FOIG7ZU7.js";
10
+ } from "./chunk-NZA3MCPM.js";
11
11
  import "./chunk-GHKJ6EFT.js";
12
- import "./chunk-AN2Y6MA2.js";
12
+ import {
13
+ isSecondary
14
+ } from "./chunk-IIDV3RNQ.js";
13
15
  import {
14
16
  useSearchContext
15
17
  } from "./chunk-ET4TW6M5.js";
@@ -17,8 +19,12 @@ import {
17
19
  useI18n
18
20
  } from "./chunk-HLGNIWUN.js";
19
21
  import "./chunk-7XPZOMJ2.js";
20
- import "./chunk-CPOVVDVF.js";
21
- import "./chunk-TK3TM3MR.js";
22
+ import {
23
+ buttonVariants
24
+ } from "./chunk-VUIQ7ZYI.js";
25
+ import {
26
+ twMerge
27
+ } from "./chunk-TK3TM3MR.js";
22
28
  import "./chunk-MLKGABMK.js";
23
29
 
24
30
  // src/layout.client.tsx
@@ -37,30 +43,25 @@ function Nav({
37
43
  return /* @__PURE__ */ jsx(NavBox, { id: "nd-nav", className: "h-14", transparentMode, children: /* @__PURE__ */ jsxs("nav", { className: "mx-auto flex size-full max-w-container flex-row items-center gap-6 px-4", children: [
38
44
  /* @__PURE__ */ jsx(Title, { title, url }),
39
45
  children,
40
- items.filter(
41
- (item) => item.type !== "secondary" && !(item.type === "custom" && item.secondary)
42
- ).map((item, i) => /* @__PURE__ */ jsx(
43
- LinkItem,
44
- {
45
- item,
46
- className: "-mx-2 text-sm max-lg:hidden"
47
- },
48
- i
49
- )),
46
+ items.filter((item) => !isSecondary(item)).map((item, i) => /* @__PURE__ */ jsx(LinkItem, { item, className: "text-sm max-lg:hidden" }, i)),
50
47
  /* @__PURE__ */ jsxs("div", { className: "flex flex-1 flex-row items-center justify-end md:gap-2", children: [
51
48
  enableSearch && search.enabled ? /* @__PURE__ */ jsxs(Fragment, { children: [
52
49
  /* @__PURE__ */ jsx(SearchToggle, { className: "md:hidden" }),
53
50
  /* @__PURE__ */ jsx(LargeSearchToggle, { className: "w-full max-w-[240px] max-md:hidden" })
54
51
  ] }) : null,
55
52
  /* @__PURE__ */ jsx(ThemeToggle, { className: "max-lg:hidden" }),
56
- items.filter(
57
- (item) => item.type === "secondary" || item.type === "custom" && item.secondary
58
- ).map((item, i) => /* @__PURE__ */ jsx(LinkItem, { item, className: "max-lg:hidden" }, i)),
53
+ items.filter(isSecondary).map((item, i) => /* @__PURE__ */ jsx(LinkItem, { item, className: "max-lg:hidden" }, i)),
59
54
  /* @__PURE__ */ jsx(
60
55
  LinksMenu,
61
56
  {
62
57
  items,
63
- className: "-me-2 lg:hidden",
58
+ className: twMerge(
59
+ buttonVariants({
60
+ size: "icon",
61
+ color: "ghost",
62
+ className: "-me-2 lg:hidden"
63
+ })
64
+ ),
64
65
  footer: /* @__PURE__ */ jsxs("div", { className: "flex flex-row items-center justify-between px-2 pt-2", children: [
65
66
  /* @__PURE__ */ jsx("p", { className: "font-medium text-muted-foreground", children: text.chooseTheme }),
66
67
  /* @__PURE__ */ jsx(ThemeToggle, {})
package/dist/layout.d.ts CHANGED
@@ -1,3 +1,3 @@
1
1
  import 'fumadocs-core/server';
2
2
  import 'react';
3
- export { B as BaseLayoutProps, d as DocsLayout, D as DocsLayoutProps, c as Layout, L as LinkItemType, a as SharedNavProps } from './layout-CyXwmMCy.js';
3
+ export { B as BaseLayoutProps, e as DocsLayout, D as DocsLayoutProps, d as Layout, c as LinkItemType, a as SharedNavProps } from './layout-ZAteQVYk.js';
package/dist/layout.js CHANGED
@@ -12,7 +12,10 @@ import {
12
12
  import { Nav } from "./layout.client"
13
13
  import {
14
14
  replaceOrDefault
15
- } from "./chunk-AN2Y6MA2.js";
15
+ } from "./chunk-IIDV3RNQ.js";
16
+ import {
17
+ buttonVariants
18
+ } from "./chunk-VUIQ7ZYI.js";
16
19
  import {
17
20
  twMerge
18
21
  } from "./chunk-TK3TM3MR.js";
@@ -80,7 +83,19 @@ function DocsLayout({
80
83
  children: nav?.title
81
84
  }
82
85
  ),
83
- finalLinks.length > 0 && /* @__PURE__ */ jsx(LinksMenu, { items: finalLinks, children: /* @__PURE__ */ jsx(MoreHorizontal, {}) })
86
+ finalLinks.length > 0 && /* @__PURE__ */ jsx(
87
+ LinksMenu,
88
+ {
89
+ items: finalLinks,
90
+ className: twMerge(
91
+ buttonVariants({
92
+ size: "icon",
93
+ color: "ghost"
94
+ })
95
+ ),
96
+ children: /* @__PURE__ */ jsx(MoreHorizontal, {})
97
+ }
98
+ )
84
99
  ] }),
85
100
  sidebar.banner
86
101
  ] }),
@@ -2,10 +2,10 @@
2
2
  import {
3
3
  CodeBlock,
4
4
  Pre
5
- } from "./chunk-Q3FSJZ3E.js";
5
+ } from "./chunk-KH555T4I.js";
6
6
  import "./chunk-VYTHQTZE.js";
7
7
  import "./chunk-2KMKNVSN.js";
8
- import "./chunk-CPOVVDVF.js";
8
+ import "./chunk-VUIQ7ZYI.js";
9
9
  import "./chunk-TK3TM3MR.js";
10
10
  import "./chunk-MLKGABMK.js";
11
11
 
package/dist/mdx.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { Pre } from "./mdx.client"
2
2
  import {
3
3
  defaultImageSizes
4
- } from "./chunk-AN2Y6MA2.js";
4
+ } from "./chunk-IIDV3RNQ.js";
5
5
  import {
6
6
  Card,
7
7
  Cards
@@ -10,8 +10,8 @@ import {
10
10
  } from "./chunk-GHKJ6EFT.js";
11
11
  import {
12
12
  useTreeContext
13
- } from "./chunk-34Z7WODD.js";
14
- import "./chunk-AN2Y6MA2.js";
13
+ } from "./chunk-R3M2OC5U.js";
14
+ import "./chunk-IIDV3RNQ.js";
15
15
  import {
16
16
  useI18n
17
17
  } from "./chunk-HLGNIWUN.js";
@@ -165,19 +165,17 @@ function Breadcrumb({
165
165
  "-mb-3 flex flex-row items-center gap-1 text-sm font-medium text-muted-foreground",
166
166
  items.length === 0 && "hidden"
167
167
  ),
168
- children: items.map((item, i) => {
169
- return /* @__PURE__ */ jsxs2(Fragment, { children: [
170
- i !== 0 && /* @__PURE__ */ jsx2(ChevronRight, { className: "size-4 shrink-0 rtl:rotate-180" }),
171
- item.url ? /* @__PURE__ */ jsx2(
172
- Link,
173
- {
174
- href: item.url,
175
- className: "truncate hover:text-accent-foreground",
176
- children: item.name
177
- }
178
- ) : /* @__PURE__ */ jsx2("span", { className: "truncate", children: item.name })
179
- ] }, i);
180
- })
168
+ children: items.map((item, i) => /* @__PURE__ */ jsxs2(Fragment, { children: [
169
+ i !== 0 && /* @__PURE__ */ jsx2(ChevronRight, { className: "size-4 shrink-0 rtl:rotate-180" }),
170
+ item.url ? /* @__PURE__ */ jsx2(
171
+ Link,
172
+ {
173
+ href: item.url,
174
+ className: "truncate hover:text-accent-foreground",
175
+ children: item.name
176
+ }
177
+ ) : /* @__PURE__ */ jsx2("span", { className: "truncate", children: item.name })
178
+ ] }, i))
181
179
  }
182
180
  );
183
181
  }
@@ -211,7 +209,7 @@ function Footer({ items }) {
211
209
  next: tree.navigation[idx + 1]
212
210
  };
213
211
  }, [pathname, tree.navigation]);
214
- return /* @__PURE__ */ jsxs3("div", { className: "grid grid-cols-2 gap-4 border-t py-6", children: [
212
+ return /* @__PURE__ */ jsxs3("div", { className: "grid grid-cols-2 gap-4 pb-6", children: [
215
213
  previous ? /* @__PURE__ */ jsxs3(Link2, { href: previous.url, className: twMerge(itemVariants()), children: [
216
214
  /* @__PURE__ */ jsxs3("div", { className: twMerge(itemLabel()), children: [
217
215
  /* @__PURE__ */ jsx3(ChevronLeft, { className: "-ms-1 size-4 shrink-0 rtl:rotate-180" }),
package/dist/page.js CHANGED
@@ -8,7 +8,7 @@ import {
8
8
  } from "./page.client"
9
9
  import {
10
10
  replaceOrDefault
11
- } from "./chunk-AN2Y6MA2.js";
11
+ } from "./chunk-IIDV3RNQ.js";
12
12
  import {
13
13
  twMerge
14
14
  } from "./chunk-TK3TM3MR.js";
package/dist/provider.js CHANGED
@@ -1,8 +1,8 @@
1
1
  "use client";
2
2
  import {
3
3
  useTreeContext
4
- } from "./chunk-34Z7WODD.js";
5
- import "./chunk-AN2Y6MA2.js";
4
+ } from "./chunk-R3M2OC5U.js";
5
+ import "./chunk-IIDV3RNQ.js";
6
6
  import {
7
7
  SidebarProvider,
8
8
  useSidebar