fumadocs-ui 14.3.1 → 14.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.
- package/dist/components/layout/nav.d.ts +3 -3
- package/dist/components/layout/nav.d.ts.map +1 -1
- package/dist/components/layout/nav.js +5 -2
- package/dist/components/layout/toc-clerk.d.ts +1 -1
- package/dist/components/layout/toc-clerk.d.ts.map +1 -1
- package/dist/components/layout/toc-clerk.js +6 -7
- package/dist/components/layout/toc.d.ts +1 -0
- package/dist/components/layout/toc.d.ts.map +1 -1
- package/dist/components/layout/toc.js +6 -3
- package/dist/components/registry.d.ts.map +1 -1
- package/dist/components/registry.js +5 -0
- package/dist/contexts/search.d.ts +6 -3
- package/dist/contexts/search.d.ts.map +1 -1
- package/dist/contexts/search.js +3 -0
- package/dist/layouts/docs/navbar.d.ts +2 -2
- package/dist/layouts/docs/navbar.d.ts.map +1 -1
- package/dist/layouts/docs/navbar.js +6 -8
- package/dist/layouts/docs/shared.d.ts +41 -0
- package/dist/layouts/docs/shared.d.ts.map +1 -0
- package/dist/layouts/docs/shared.js +30 -0
- package/dist/layouts/docs/sidebar.d.ts +7 -0
- package/dist/layouts/docs/sidebar.d.ts.map +1 -1
- package/dist/layouts/docs/sidebar.js +46 -20
- package/dist/layouts/docs.client.d.ts +0 -4
- package/dist/layouts/docs.client.d.ts.map +1 -1
- package/dist/layouts/docs.client.js +1 -25
- package/dist/layouts/docs.d.ts +2 -33
- package/dist/layouts/docs.d.ts.map +1 -1
- package/dist/layouts/docs.js +15 -32
- package/dist/layouts/home/navbar.d.ts.map +1 -1
- package/dist/layouts/home/navbar.js +3 -3
- package/dist/layouts/notebook.client.d.ts +3 -0
- package/dist/layouts/notebook.client.d.ts.map +1 -0
- package/dist/layouts/notebook.client.js +13 -0
- package/dist/layouts/notebook.d.ts +11 -0
- package/dist/layouts/notebook.d.ts.map +1 -0
- package/dist/layouts/notebook.js +56 -0
- package/dist/layouts/shared.d.ts +1 -2
- package/dist/layouts/shared.d.ts.map +1 -1
- package/dist/layouts/shared.js +1 -0
- package/dist/page.client.d.ts +3 -0
- package/dist/page.client.d.ts.map +1 -1
- package/dist/page.client.js +18 -4
- package/dist/page.d.ts +8 -2
- package/dist/page.d.ts.map +1 -1
- package/dist/page.js +4 -6
- package/dist/style.css +1 -1
- package/dist/tailwind-plugin.d.ts +5 -1
- package/dist/tailwind-plugin.d.ts.map +1 -1
- package/dist/tailwind-plugin.js +1 -14
- package/dist/theme/colors.d.ts +1 -0
- package/dist/theme/colors.d.ts.map +1 -1
- package/dist/theme/colors.js +15 -14
- package/dist/theme/typography.d.ts +27 -4
- package/dist/theme/typography.d.ts.map +1 -1
- package/dist/theme/typography.js +28 -2
- package/package.json +4 -4
- package/dist/components/layout/breadcrumb.d.ts +0 -11
- package/dist/components/layout/breadcrumb.d.ts.map +0 -1
- package/dist/components/layout/breadcrumb.js +0 -20
package/dist/layouts/docs.js
CHANGED
|
@@ -1,62 +1,39 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { Fragment } from 'react';
|
|
3
2
|
import Link from 'next/link';
|
|
4
3
|
import { Languages, MoreHorizontal } from 'lucide-react';
|
|
5
4
|
import { notFound } from 'next/navigation';
|
|
6
5
|
import { cn } from '../utils/cn';
|
|
7
6
|
import { buttonVariants } from '../components/ui/button';
|
|
8
|
-
import { CollapsibleSidebar, Sidebar, SidebarFooter, SidebarHeader, SidebarCollapseTrigger, SidebarViewport,
|
|
7
|
+
import { CollapsibleSidebar, Sidebar, SidebarFooter, SidebarHeader, SidebarCollapseTrigger, SidebarViewport, SidebarPageTree, } from '../layouts/docs/sidebar';
|
|
9
8
|
import { replaceOrDefault } from '../layouts/shared';
|
|
10
9
|
import { BaseLinkItem, } from '../layouts/links';
|
|
11
10
|
import { getSidebarTabs } from '../utils/get-sidebar-tabs';
|
|
12
11
|
import { RootToggle } from '../components/layout/root-toggle';
|
|
13
12
|
import { getLinks } from './shared';
|
|
14
13
|
import { LanguageToggle, LanguageToggleText, } from '../components/layout/language-toggle';
|
|
15
|
-
import {
|
|
14
|
+
import { LinksMenu } from '../layouts/docs.client';
|
|
16
15
|
import { TreeContextProvider } from '../contexts/tree';
|
|
17
16
|
import { NavProvider, Title } from '../components/layout/nav';
|
|
18
17
|
import { ThemeToggle } from '../components/layout/theme-toggle';
|
|
19
18
|
import { Navbar, NavbarSidebarTrigger } from '../layouts/docs/navbar';
|
|
20
19
|
import { LargeSearchToggle, SearchToggle, } from '../components/layout/search-toggle';
|
|
21
20
|
import { SearchOnly } from '../contexts/search';
|
|
21
|
+
import { getSidebarTabsFromOptions, SidebarLinkItem, } from '../layouts/docs/shared';
|
|
22
22
|
export function DocsLayout({ nav: { enabled: navEnabled = true, component: navReplace, transparentMode, ...nav } = {}, sidebar: { enabled: sidebarEnabled = true, collapsible = true, component: sidebarReplace, tabs: tabOptions, banner: sidebarBanner, footer: sidebarFooter, components: sidebarComponents, ...sidebar } = {}, i18n = false, ...props }) {
|
|
23
23
|
const links = getLinks(props.links ?? [], props.githubUrl);
|
|
24
24
|
const Aside = collapsible ? CollapsibleSidebar : Sidebar;
|
|
25
25
|
if (props.tree === undefined)
|
|
26
26
|
notFound();
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
tabs = tabOptions;
|
|
30
|
-
}
|
|
31
|
-
else if (typeof tabOptions === 'object') {
|
|
32
|
-
tabs = getSidebarTabs(props.tree, tabOptions);
|
|
33
|
-
}
|
|
34
|
-
else if (tabOptions !== false) {
|
|
35
|
-
tabs = getSidebarTabs(props.tree);
|
|
36
|
-
}
|
|
37
|
-
return (_jsx(TreeContextProvider, { tree: props.tree, children: _jsxs(NavProvider, { transparentMode: transparentMode, children: [replaceOrDefault({ enabled: navEnabled, component: navReplace }, _jsxs(Navbar, { className: "h-14 md:hidden", children: [_jsx(Title, { url: nav.url, title: nav.title }), _jsx("div", { className: "flex flex-1 flex-row items-center gap-1", children: nav.children }), _jsx(SearchOnly, { children: _jsx(SearchToggle, {}) }), _jsx(NavbarSidebarTrigger, {})] }), nav), _jsxs("main", { id: "nd-docs-layout", ...props.containerProps, className: cn('flex flex-1 flex-row', !navReplace && navEnabled
|
|
27
|
+
const tabs = getSidebarTabsFromOptions(tabOptions, props.tree) ?? [];
|
|
28
|
+
return (_jsx(TreeContextProvider, { tree: props.tree, children: _jsxs(NavProvider, { transparentMode: transparentMode, children: [replaceOrDefault({ enabled: navEnabled, component: navReplace }, _jsxs(Navbar, { className: "h-14 md:hidden", children: [_jsx(Title, { url: nav.url, title: nav.title }), _jsx("div", { className: "flex flex-1 flex-row items-center gap-1", children: nav.children }), _jsx(SearchOnly, { children: _jsx(SearchToggle, {}) }), _jsx(NavbarSidebarTrigger, { className: "-me-2 md:hidden" })] }), nav), _jsxs("main", { id: "nd-docs-layout", ...props.containerProps, className: cn('flex flex-1 flex-row md:[--fd-sidebar-width:260px] xl:[--fd-toc-width:260px]', !navReplace && navEnabled
|
|
38
29
|
? '[--fd-nav-height:3.5rem] md:[--fd-nav-height:0px]'
|
|
39
|
-
: null, props.containerProps?.className), children: [replaceOrDefault({ enabled: sidebarEnabled, component: sidebarReplace }, _jsxs(Aside, { ...sidebar, children: [_jsxs(SidebarHeader, { children: [_jsx(SidebarHeaderItems, { ...nav, links: links }), sidebarBanner, tabs.length > 0 ? (_jsx(RootToggle, { options: tabs, className: "-mx-2" })) : null, _jsx(SearchOnly, { children: _jsx(LargeSearchToggle, { className: "rounded-lg max-md:hidden" }) })] }), _jsxs(SidebarViewport, { children: [_jsx("div", { className: "px-2 pt-4 empty:hidden md:hidden", children: links
|
|
30
|
+
: null, props.containerProps?.className), children: [collapsible ? (_jsx(SidebarCollapseTrigger, { className: "fixed bottom-3 start-2 z-40 transition-opacity data-[collapsed=false]:pointer-events-none data-[collapsed=false]:opacity-0 max-md:hidden" })) : null, replaceOrDefault({ enabled: sidebarEnabled, component: sidebarReplace }, _jsxs(Aside, { ...sidebar, children: [_jsxs(SidebarHeader, { children: [_jsx(SidebarHeaderItems, { ...nav, links: links }), sidebarBanner, tabs.length > 0 ? (_jsx(RootToggle, { options: tabs, className: "-mx-2" })) : null, _jsx(SearchOnly, { children: _jsx(LargeSearchToggle, { className: "rounded-lg max-md:hidden" }) })] }), _jsxs(SidebarViewport, { children: [_jsx("div", { className: "px-2 pt-4 empty:hidden md:hidden", children: links
|
|
40
31
|
.filter((v) => v.type !== 'icon')
|
|
41
|
-
.map((item, i) => (_jsx(
|
|
32
|
+
.map((item, i) => (_jsx(SidebarLinkItem, { item: item }, i))) }), _jsx("div", { className: "px-2 py-4 md:px-3", children: _jsx(SidebarPageTree, { components: sidebarComponents }) })] }), _jsxs(SidebarFooter, { children: [_jsx(SidebarFooterItems, { sidebarCollapsible: collapsible, i18n: i18n, disableThemeSwitch: props.disableThemeSwitch ?? false, iconItems: links.filter((v) => v.type === 'icon') }), sidebarFooter] })] }), {
|
|
42
33
|
...sidebar,
|
|
43
34
|
tabs,
|
|
44
35
|
}), props.children] })] }) }));
|
|
45
36
|
}
|
|
46
|
-
function renderLinkItem(item) {
|
|
47
|
-
if (!item.type || item.type === 'main' || item.type === 'icon')
|
|
48
|
-
return (_jsx(SidebarItem, { href: item.url, icon: item.icon, external: item.external, children: item.text }));
|
|
49
|
-
if (item.type === 'menu')
|
|
50
|
-
return (_jsxs(SidebarFolder, { level: 1, children: [item.url ? (_jsxs(SidebarFolderLink, { href: item.url, children: [item.icon, item.text] })) : (_jsxs(SidebarFolderTrigger, { children: [item.icon, item.text] })), _jsx(SidebarFolderContent, { children: item.items.map((child, i) => (_jsx(Fragment, { children: renderLinkItem(child) }, i))) })] }));
|
|
51
|
-
if (item.type === 'button') {
|
|
52
|
-
return (_jsxs(BaseLinkItem, { item: item, className: cn(buttonVariants({
|
|
53
|
-
color: 'secondary',
|
|
54
|
-
className: 'gap-1.5 [&_svg]:size-4',
|
|
55
|
-
})), children: [item.icon, item.text] }));
|
|
56
|
-
}
|
|
57
|
-
if (item.type === 'custom')
|
|
58
|
-
return item.children;
|
|
59
|
-
}
|
|
60
37
|
function SidebarHeaderItems({ links, ...props }) {
|
|
61
38
|
const isEmpty = !props.title && !props.children && links.length === 0;
|
|
62
39
|
if (isEmpty)
|
|
@@ -66,7 +43,13 @@ function SidebarHeaderItems({ links, ...props }) {
|
|
|
66
43
|
color: 'ghost',
|
|
67
44
|
}), 'ms-auto'), children: _jsx(MoreHorizontal, {}) })) : null] }));
|
|
68
45
|
}
|
|
69
|
-
function SidebarFooterItems({ iconItems,
|
|
70
|
-
|
|
46
|
+
function SidebarFooterItems({ iconItems, i18n, sidebarCollapsible, disableThemeSwitch, }) {
|
|
47
|
+
// empty footer items
|
|
48
|
+
if (iconItems.length === 0 &&
|
|
49
|
+
!i18n &&
|
|
50
|
+
disableThemeSwitch &&
|
|
51
|
+
!sidebarCollapsible)
|
|
52
|
+
return null;
|
|
53
|
+
return (_jsxs("div", { className: "flex flex-row items-center", children: [iconItems.map((item, i) => (_jsx(BaseLinkItem, { item: item, className: cn(buttonVariants({ size: 'icon', color: 'ghost' }), 'text-fd-muted-foreground md:hidden'), "aria-label": item.label, children: item.icon }, i))), _jsx("div", { role: "separator", className: "flex-1" }), i18n ? (_jsxs(LanguageToggle, { className: "me-1.5", children: [_jsx(Languages, { className: "size-5" }), _jsx(LanguageToggleText, { className: "md:hidden" })] })) : null, !disableThemeSwitch ? (_jsx(ThemeToggle, { className: "p-0 md:order-first" })) : null, sidebarCollapsible ? (_jsx(SidebarCollapseTrigger, { className: "-me-1.5 max-md:hidden" })) : null] }));
|
|
71
54
|
}
|
|
72
55
|
export { getSidebarTabs };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"navbar.d.ts","sourceRoot":"","sources":["../../../src/layouts/home/navbar.tsx"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"navbar.d.ts","sourceRoot":"","sources":["../../../src/layouts/home/navbar.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,cAAc,EAAE,KAAK,cAAc,EAAY,MAAM,OAAO,CAAC;AAC3E,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAa,EAAE,KAAK,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAE1D,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAU/C,OAAO,KAAK,EACV,0BAA0B,EAC1B,0BAA0B,EAC3B,MAAM,iCAAiC,CAAC;AAOzC,wBAAgB,MAAM,CAAC,KAAK,EAAE,cAAc,CAAC,WAAW,CAAC,2CAwBxD;AAED,eAAO,MAAM,UAAU,6JAAqB,CAAC;AAE7C,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,0BAA0B,2CAYlE;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,0BAA0B,2CASlE;AAED,QAAA,MAAM,YAAY;;8EAiBhB,CAAC;AAEH,wBAAgB,UAAU,CAAC,EACzB,IAAI,EACJ,OAAO,EACP,GAAG,KAAK,EACT,EAAE,cAAc,CAAC,OAAO,YAAY,CAAC,GAAG,YAAY,CAAC,OAAO,YAAY,CAAC,2CAczE;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,SAAS,2CAY9C"}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import {
|
|
3
|
+
import { useState } from 'react';
|
|
4
4
|
import { cva } from 'class-variance-authority';
|
|
5
5
|
import Link from 'fumadocs-core/link';
|
|
6
6
|
import { cn } from '../../utils/cn';
|
|
7
7
|
import { BaseLinkItem } from '../../layouts/links';
|
|
8
8
|
import { NavigationMenu, NavigationMenuContent, NavigationMenuItem, NavigationMenuLink, NavigationMenuTrigger, NavigationMenuViewport, } from '../../components/ui/navigation-menu';
|
|
9
|
-
import {
|
|
9
|
+
import { useNav } from '../../components/layout/nav';
|
|
10
10
|
import { buttonVariants } from '../../components/ui/button';
|
|
11
11
|
const navItemVariants = cva('inline-flex items-center gap-1 p-2 text-fd-muted-foreground transition-colors hover:text-fd-accent-foreground data-[active=true]:text-fd-primary [&_svg]:size-4');
|
|
12
12
|
export function Navbar(props) {
|
|
13
13
|
const [value, setValue] = useState('');
|
|
14
|
-
const { isTransparent } =
|
|
14
|
+
const { isTransparent } = useNav();
|
|
15
15
|
return (_jsx(NavigationMenu, { value: value, onValueChange: setValue, asChild: true, children: _jsxs("header", { id: "nd-nav", ...props, className: cn('fixed left-1/2 top-[var(--fd-banner-height)] z-40 w-full max-w-fd-container -translate-x-1/2 border-b border-fd-foreground/10 transition-colors lg:mt-2 lg:w-[calc(100%-1rem)] lg:rounded-2xl lg:border', value.length > 0 ? 'shadow-lg' : 'shadow-sm', (!isTransparent || value.length > 0) &&
|
|
16
16
|
'bg-fd-background/80 backdrop-blur-lg', props.className), children: [_jsx("nav", { className: "flex h-14 w-full flex-row items-center gap-6 px-4 lg:h-12", children: props.children }), _jsx(NavigationMenuViewport, {})] }) }));
|
|
17
17
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"notebook.client.d.ts","sourceRoot":"","sources":["../../src/layouts/notebook.client.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAG5C,wBAAgB,UAAU,CAAC,KAAK,EAAE,cAAc,CAAC,WAAW,CAAC,2CAoB5D"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { cn } from '../utils/cn';
|
|
4
|
+
import { useSidebar } from '../contexts/sidebar';
|
|
5
|
+
export function LayoutBody(props) {
|
|
6
|
+
const { collapsed } = useSidebar();
|
|
7
|
+
return (_jsx("main", { id: "nd-docs-layout", ...props, className: cn('flex w-full flex-1 flex-row', props.className), style: {
|
|
8
|
+
...props.style,
|
|
9
|
+
'--fd-content-width': collapsed
|
|
10
|
+
? '100vw'
|
|
11
|
+
: 'calc(min(100vw, var(--fd-layout-width)) - var(--fd-sidebar-width))',
|
|
12
|
+
}, children: props.children }));
|
|
13
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type HTMLAttributes, type ReactNode } from 'react';
|
|
2
|
+
import { type BaseLayoutProps } from '../layouts/shared';
|
|
3
|
+
import { type SidebarOptions } from '../layouts/docs/shared';
|
|
4
|
+
import type { PageTree } from 'fumadocs-core/server';
|
|
5
|
+
export interface DocsLayoutProps extends BaseLayoutProps {
|
|
6
|
+
tree: PageTree.Root;
|
|
7
|
+
sidebar?: Omit<Partial<SidebarOptions>, 'component' | 'enabled'>;
|
|
8
|
+
containerProps?: HTMLAttributes<HTMLDivElement>;
|
|
9
|
+
}
|
|
10
|
+
export declare function DocsLayout({ nav: { transparentMode, ...nav }, sidebar: { collapsible: sidebarCollapsible, tabs: tabOptions, banner: sidebarBanner, footer: sidebarFooter, components: sidebarComponents, ...sidebar }, i18n, ...props }: DocsLayoutProps): ReactNode;
|
|
11
|
+
//# sourceMappingURL=notebook.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"notebook.d.ts","sourceRoot":"","sources":["../../src/layouts/notebook.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAY,KAAK,cAAc,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AACtE,OAAO,EACL,KAAK,eAAe,EAGrB,MAAM,kBAAkB,CAAC;AAgC1B,OAAO,EAGL,KAAK,cAAc,EACpB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAGrD,MAAM,WAAW,eAAgB,SAAQ,eAAe;IACtD,IAAI,EAAE,QAAQ,CAAC,IAAI,CAAC;IAEpB,OAAO,CAAC,EAAE,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,EAAE,WAAW,GAAG,SAAS,CAAC,CAAC;IAEjE,cAAc,CAAC,EAAE,cAAc,CAAC,cAAc,CAAC,CAAC;CACjD;AAED,wBAAgB,UAAU,CAAC,EACzB,GAAG,EAAE,EAAE,eAAe,EAAE,GAAG,GAAG,EAAO,EACrC,OAAO,EAAE,EACP,WAAW,EAAE,kBAAyB,EACtC,IAAI,EAAE,UAAU,EAChB,MAAM,EAAE,aAAa,EACrB,MAAM,EAAE,aAAa,EACrB,UAAU,EAAE,iBAAiB,EAC7B,GAAG,OAAO,EACN,EACN,IAAY,EACZ,GAAG,KAAK,EACT,EAAE,eAAe,GAAG,SAAS,CAgE7B"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Fragment } from 'react';
|
|
3
|
+
import { getLinks, } from '../layouts/shared';
|
|
4
|
+
import { CollapsibleSidebar, Sidebar, SidebarCollapseTrigger, SidebarFooter, SidebarHeader, SidebarViewport, SidebarPageTree, } from '../layouts/docs/sidebar';
|
|
5
|
+
import { notFound } from 'next/navigation';
|
|
6
|
+
import { RootToggle } from '../components/layout/root-toggle';
|
|
7
|
+
import { TreeContextProvider } from '../contexts/tree';
|
|
8
|
+
import { NavProvider, Title } from '../components/layout/nav';
|
|
9
|
+
import { Navbar, NavbarSidebarTrigger } from '../layouts/docs/navbar';
|
|
10
|
+
import { SearchOnly } from '../contexts/search';
|
|
11
|
+
import { LargeSearchToggle, SearchToggle, } from '../components/layout/search-toggle';
|
|
12
|
+
import { cn } from '../utils/cn';
|
|
13
|
+
import Link from 'next/link';
|
|
14
|
+
import { buttonVariants } from '../components/ui/button';
|
|
15
|
+
import { ChevronDown, Languages } from 'lucide-react';
|
|
16
|
+
import { BaseLinkItem } from '../layouts/links';
|
|
17
|
+
import { LanguageToggle } from '../components/layout/language-toggle';
|
|
18
|
+
import { ThemeToggle } from '../components/layout/theme-toggle';
|
|
19
|
+
import { Popover, PopoverContent, PopoverTrigger, } from '../components/ui/popover';
|
|
20
|
+
import { getSidebarTabsFromOptions, SidebarLinkItem, } from '../layouts/docs/shared';
|
|
21
|
+
import { LayoutBody } from './notebook.client';
|
|
22
|
+
export function DocsLayout({ nav: { transparentMode, ...nav } = {}, sidebar: { collapsible: sidebarCollapsible = true, tabs: tabOptions, banner: sidebarBanner, footer: sidebarFooter, components: sidebarComponents, ...sidebar } = {}, i18n = false, ...props }) {
|
|
23
|
+
const links = getLinks(props.links ?? [], props.githubUrl);
|
|
24
|
+
const Aside = sidebarCollapsible ? CollapsibleSidebar : Sidebar;
|
|
25
|
+
if (props.tree === undefined)
|
|
26
|
+
notFound();
|
|
27
|
+
const tabs = getSidebarTabsFromOptions(tabOptions, props.tree) ?? [];
|
|
28
|
+
return (_jsx(TreeContextProvider, { tree: props.tree, children: _jsx(NavProvider, { transparentMode: transparentMode, children: _jsxs(LayoutBody, { ...props.containerProps, className: cn('[--fd-nav-height:3.5rem] md:[--fd-sidebar-width:260px] xl:[--fd-toc-width:260px]', props.containerProps?.className), children: [_jsxs(Aside, { ...sidebar, className: cn('md:[--fd-nav-height:0px]', sidebar.className), children: [_jsxs(SidebarHeader, { children: [_jsxs(SidebarHeaderItems, { nav: nav, links: links, children: [nav.children, sidebarCollapsible ? (_jsx(SidebarCollapseTrigger, { className: "ms-auto text-fd-muted-foreground" })) : null] }), sidebarBanner, tabs.length > 0 ? (_jsx(RootToggle, { options: tabs, className: "md:-mx-2" })) : null] }), _jsxs(SidebarViewport, { children: [_jsx("div", { className: "px-4 pt-4 empty:hidden md:px-3 lg:hidden", children: links.map((item, i) => (_jsx(SidebarLinkItem, { item: item }, i))) }), _jsx("div", { className: "p-4 md:px-3", children: _jsx(SidebarPageTree, { components: sidebarComponents }) })] }), _jsx(SidebarFooter, { children: sidebarFooter })] }), _jsxs("div", { className: "w-full min-w-0 max-w-[var(--fd-content-width)] [--fd-nav-height:3.5rem]", children: [_jsx(DocsNavbar, { nav: nav, links: links, i18n: i18n, sidebarCollapsible: sidebarCollapsible }), _jsx("div", { className: "flex flex-row", children: props.children })] }), _jsx("div", { className: "min-w-[var(--fd-sidebar-width)] flex-1", style: {
|
|
29
|
+
marginInlineStart: 'calc(var(--fd-sidebar-width) * -1)',
|
|
30
|
+
} })] }) }) }));
|
|
31
|
+
}
|
|
32
|
+
function DocsNavbar({ sidebarCollapsible, links, nav = {}, i18n, }) {
|
|
33
|
+
return (_jsxs(Navbar, { className: "h-14", children: [sidebarCollapsible ? (_jsx(SidebarCollapseTrigger, { className: "me-2 data-[collapsed=false]:hidden max-md:hidden" })) : null, _jsx(SearchOnly, { children: _jsx(LargeSearchToggle, { className: "w-full max-w-[240px] rounded-lg max-md:hidden" }) }), _jsx(Title, { url: nav.url, title: nav.title, className: "md:hidden" }), _jsxs("div", { className: "ms-4 flex flex-1 flex-row items-center gap-6", children: [links
|
|
34
|
+
.filter((item) => item.type !== 'icon')
|
|
35
|
+
.map((item, i) => (_jsx(NavbarLinkItem, { item: item, className: "text-sm text-fd-muted-foreground transition-colors hover:text-fd-accent-foreground max-lg:hidden" }, i))), nav.children] }), _jsx(SearchOnly, { children: _jsx(SearchToggle, { className: "md:hidden" }) }), _jsx(NavbarSidebarTrigger, { className: "-me-2 md:hidden" }), links
|
|
36
|
+
.filter((item) => item.type === 'icon')
|
|
37
|
+
.map((item, i) => (_jsx(BaseLinkItem, { item: item, className: cn(buttonVariants({ size: 'icon', color: 'ghost' }), 'text-fd-muted-foreground max-lg:hidden'), "aria-label": item.label, children: item.icon }, i))), i18n ? (_jsx(LanguageToggle, { className: "me-1.5", children: _jsx(Languages, { className: "size-5" }) })) : null, _jsx(ThemeToggle, { className: "max-md:hidden" })] }));
|
|
38
|
+
}
|
|
39
|
+
function NavbarLinkItem({ item, ...props }) {
|
|
40
|
+
if (item.type === 'menu') {
|
|
41
|
+
return (_jsxs(Popover, { children: [_jsxs(PopoverTrigger, { ...props, className: cn('inline-flex items-center gap-1.5', props.className), children: [item.text, _jsx(ChevronDown, { className: "size-3" })] }), _jsx(PopoverContent, { className: "flex flex-col", children: item.items.map((child, i) => {
|
|
42
|
+
if (child.type === 'custom')
|
|
43
|
+
return _jsx(Fragment, { children: child.children }, i);
|
|
44
|
+
return (_jsxs(BaseLinkItem, { item: child, className: "inline-flex items-center gap-2 rounded-md p-2 text-start hover:bg-fd-accent hover:text-fd-accent-foreground data-[active=true]:text-fd-primary [&_svg]:size-4", children: [child.icon, child.text] }, i));
|
|
45
|
+
}) })] }));
|
|
46
|
+
}
|
|
47
|
+
if (item.type === 'custom')
|
|
48
|
+
return item.children;
|
|
49
|
+
return (_jsx(BaseLinkItem, { item: item, ...props, children: item.text }));
|
|
50
|
+
}
|
|
51
|
+
function SidebarHeaderItems({ links, nav = {}, children, }) {
|
|
52
|
+
const isEmpty = !nav.title && !nav.children && links.length === 0;
|
|
53
|
+
if (isEmpty)
|
|
54
|
+
return null;
|
|
55
|
+
return (_jsxs("div", { className: "flex flex-row items-center max-md:hidden", children: [nav.title ? (_jsx(Link, { href: nav.url ?? '/', className: "inline-flex items-center gap-2.5 py-1 font-medium", children: nav.title })) : null, children] }));
|
|
56
|
+
}
|
package/dist/layouts/shared.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ReactNode } from 'react';
|
|
2
2
|
import type { LinkItemType } from '../layouts/links';
|
|
3
3
|
import type { NavProviderProps, TitleProps } from '../components/layout/nav';
|
|
4
|
-
interface NavOptions extends SharedNavProps {
|
|
4
|
+
export interface NavOptions extends SharedNavProps {
|
|
5
5
|
enabled: boolean;
|
|
6
6
|
component: ReactNode;
|
|
7
7
|
}
|
|
@@ -44,5 +44,4 @@ export declare function replaceOrDefault(obj: {
|
|
|
44
44
|
enabled?: boolean;
|
|
45
45
|
component?: ReactNode;
|
|
46
46
|
} | undefined, def: ReactNode, customComponentProps?: object, disabled?: ReactNode): ReactNode;
|
|
47
|
-
export {};
|
|
48
47
|
//# sourceMappingURL=shared.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../../src/layouts/shared.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,KAAK,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAG5E,
|
|
1
|
+
{"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../../src/layouts/shared.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,KAAK,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAG5E,MAAM,WAAW,UAAW,SAAQ,cAAc;IAChD,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,EAAE,SAAS,CAAC;CACtB;AAED,MAAM,WAAW,cAAe,SAAQ,UAAU,EAAE,gBAAgB;IAClE;;;;OAIG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAED,MAAM,WAAW,eAAe;IAC9B;;OAEG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAE7B;;;;OAIG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;IAEf;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,KAAK,CAAC,EAAE,YAAY,EAAE,CAAC;IACvB;;OAEG;IACH,GAAG,CAAC,EAAE,OAAO,CAAC,UAAU,CAAC,CAAC;IAE1B,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAED;;GAEG;AACH,wBAAgB,QAAQ,CACtB,KAAK,CAAC,EAAE,YAAY,EAAE,EACtB,SAAS,CAAC,EAAE,MAAM,GACjB,YAAY,EAAE,CAqBhB;AAED,wBAAgB,gBAAgB,CAC9B,GAAG,EACC;IACE,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,SAAS,CAAC,EAAE,SAAS,CAAC;CACvB,GACD,SAAS,EACb,GAAG,EAAE,SAAS,EACd,oBAAoB,CAAC,EAAE,MAAM,EAC7B,QAAQ,CAAC,EAAE,SAAS,GACnB,SAAS,CAMX"}
|
package/dist/layouts/shared.js
CHANGED
|
@@ -12,6 +12,7 @@ export function getLinks(links, githubUrl) {
|
|
|
12
12
|
type: 'icon',
|
|
13
13
|
url: githubUrl,
|
|
14
14
|
text: 'Github',
|
|
15
|
+
label: 'GitHub',
|
|
15
16
|
icon: (_jsx("svg", { role: "img", viewBox: "0 0 24 24", fill: "currentColor", children: _jsx("path", { d: "M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12" }) })),
|
|
16
17
|
external: true,
|
|
17
18
|
},
|
package/dist/page.client.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type HTMLAttributes } from 'react';
|
|
2
|
+
import { type BreadcrumbOptions } from 'fumadocs-core/breadcrumb';
|
|
2
3
|
export declare function PageContainer(props: HTMLAttributes<HTMLDivElement>): import("react/jsx-runtime").JSX.Element;
|
|
3
4
|
export declare function PageHeader(props: HTMLAttributes<HTMLDivElement>): import("react/jsx-runtime").JSX.Element;
|
|
4
5
|
export declare function LastUpdate(props: {
|
|
@@ -20,4 +21,6 @@ export interface FooterProps {
|
|
|
20
21
|
};
|
|
21
22
|
}
|
|
22
23
|
export declare function Footer({ items }: FooterProps): import("react/jsx-runtime").JSX.Element;
|
|
24
|
+
export type BreadcrumbProps = BreadcrumbOptions;
|
|
25
|
+
export declare function Breadcrumb(options: BreadcrumbProps): import("react/jsx-runtime").JSX.Element | null;
|
|
23
26
|
//# sourceMappingURL=page.client.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"page.client.d.ts","sourceRoot":"","sources":["../src/page.client.tsx"],"names":[],"mappings":"AAEA,OAAO,
|
|
1
|
+
{"version":3,"file":"page.client.d.ts","sourceRoot":"","sources":["../src/page.client.tsx"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,cAAc,EAIpB,MAAM,OAAO,CAAC;AAWf,OAAO,EACL,KAAK,iBAAiB,EAEvB,MAAM,0BAA0B,CAAC;AAElC,wBAAgB,aAAa,CAAC,KAAK,EAAE,cAAc,CAAC,cAAc,CAAC,2CAuBlE;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,cAAc,CAAC,cAAc,CAAC,2CAyB/D;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE;IAAE,IAAI,EAAE,IAAI,CAAA;CAAE,2CAc/C;AAED,MAAM,WAAW,WAAW;IAC1B;;OAEG;IACH,KAAK,CAAC,EAAE;QACN,QAAQ,CAAC,EAAE;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,GAAG,EAAE,MAAM,CAAA;SAAE,CAAC;QACzC,IAAI,CAAC,EAAE;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,GAAG,EAAE,MAAM,CAAA;SAAE,CAAC;KACtC,CAAC;CACH;AAiCD,wBAAgB,MAAM,CAAC,EAAE,KAAK,EAAE,EAAE,WAAW,2CA8C5C;AAED,MAAM,MAAM,eAAe,GAAG,iBAAiB,CAAC;AAEhD,wBAAgB,UAAU,CAAC,OAAO,EAAE,eAAe,kDAiClD"}
|
package/dist/page.client.js
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import {
|
|
3
|
+
import { Fragment, useEffect, useMemo, useState, } from 'react';
|
|
4
4
|
import { ChevronLeft, ChevronRight } from 'lucide-react';
|
|
5
5
|
import Link from 'next/link';
|
|
6
6
|
import { cva } from 'class-variance-authority';
|
|
7
7
|
import { cn } from './utils/cn';
|
|
8
8
|
import { useI18n } from './contexts/i18n';
|
|
9
|
-
import { useTreeContext } from './contexts/tree';
|
|
9
|
+
import { useTreeContext, useTreePath } from './contexts/tree';
|
|
10
10
|
import { useSidebar } from './contexts/sidebar';
|
|
11
11
|
import { usePathname } from 'next/navigation';
|
|
12
|
-
import {
|
|
12
|
+
import { useNav } from './components/layout/nav';
|
|
13
|
+
import { getBreadcrumbItemsFromPath, } from 'fumadocs-core/breadcrumb';
|
|
13
14
|
export function PageContainer(props) {
|
|
14
15
|
const { collapsed } = useSidebar();
|
|
15
16
|
return (_jsx("div", { id: "nd-page", ...props, className: cn('flex w-full min-w-0 max-w-[var(--fd-page-width)] flex-col md:transition-[max-width]', props.className), style: {
|
|
@@ -21,7 +22,7 @@ export function PageContainer(props) {
|
|
|
21
22
|
}
|
|
22
23
|
export function PageHeader(props) {
|
|
23
24
|
const { open } = useSidebar();
|
|
24
|
-
const { isTransparent } =
|
|
25
|
+
const { isTransparent } = useNav();
|
|
25
26
|
return (_jsx("div", { id: "nd-tocnav", ...props, className: cn('sticky top-fd-layout-top z-10 flex flex-row items-center border-b border-fd-foreground/10 text-sm transition-colors', !isTransparent && 'bg-fd-background/80 backdrop-blur-md', open && 'opacity-0', props.className), style: {
|
|
26
27
|
...props.style,
|
|
27
28
|
'--fd-toc-top-with-offset': 'calc(4px + var(--fd-banner-height) + var(--fd-nav-height))',
|
|
@@ -75,3 +76,16 @@ export function Footer({ items }) {
|
|
|
75
76
|
}, [items, pathname, root]);
|
|
76
77
|
return (_jsxs("div", { className: "grid grid-cols-2 gap-4 pb-6", children: [previous ? (_jsxs(Link, { href: previous.url, className: cn(itemVariants()), children: [_jsxs("div", { className: cn(itemLabel()), children: [_jsx(ChevronLeft, { className: "-ms-1 size-4 shrink-0 rtl:rotate-180" }), _jsx("p", { children: text.previousPage })] }), _jsx("p", { className: "font-medium", children: previous.name })] })) : null, next ? (_jsxs(Link, { href: next.url, className: cn(itemVariants({ className: 'col-start-2 text-end' })), children: [_jsxs("div", { className: cn(itemLabel({ className: 'flex-row-reverse' })), children: [_jsx(ChevronRight, { className: "-me-1 size-4 shrink-0 rtl:rotate-180" }), _jsx("p", { children: text.nextPage })] }), _jsx("p", { className: "font-medium", children: next.name })] })) : null] }));
|
|
77
78
|
}
|
|
79
|
+
export function Breadcrumb(options) {
|
|
80
|
+
const path = useTreePath();
|
|
81
|
+
const { root } = useTreeContext();
|
|
82
|
+
const items = useMemo(() => {
|
|
83
|
+
return getBreadcrumbItemsFromPath(root, path, {
|
|
84
|
+
includePage: options.includePage ?? false,
|
|
85
|
+
...options,
|
|
86
|
+
});
|
|
87
|
+
}, [options, path, root]);
|
|
88
|
+
if (items.length === 0)
|
|
89
|
+
return null;
|
|
90
|
+
return (_jsx("div", { className: "-mb-3 flex flex-row items-center gap-1 text-sm font-medium text-fd-muted-foreground", children: items.map((item, i) => (_jsxs(Fragment, { children: [i !== 0 && (_jsx(ChevronRight, { className: "size-4 shrink-0 rtl:rotate-180" })), item.url ? (_jsx(Link, { href: item.url, className: "truncate hover:text-fd-accent-foreground", children: item.name })) : (_jsx("span", { className: "truncate", children: item.name }))] }, i))) }));
|
|
91
|
+
}
|
package/dist/page.d.ts
CHANGED
|
@@ -2,8 +2,7 @@ import { type PageTree, type TableOfContents } from 'fumadocs-core/server';
|
|
|
2
2
|
import { type AnchorHTMLAttributes, type HTMLAttributes, type ReactNode } from 'react';
|
|
3
3
|
import type { LoaderConfig, LoaderOutput, Page } from 'fumadocs-core/source';
|
|
4
4
|
import { type AnchorProviderProps } from 'fumadocs-core/toc';
|
|
5
|
-
import { type FooterProps } from './page.client';
|
|
6
|
-
import { type BreadcrumbProps } from './components/layout/breadcrumb';
|
|
5
|
+
import { type FooterProps, type BreadcrumbProps } from './page.client';
|
|
7
6
|
import { type TOCProps } from './components/layout/toc';
|
|
8
7
|
type TableOfContentOptions = Omit<TOCProps, 'items' | 'children'> & Pick<AnchorProviderProps, 'single'> & {
|
|
9
8
|
enabled: boolean;
|
|
@@ -31,6 +30,13 @@ interface EditOnGitHubOptions extends Omit<AnchorHTMLAttributes<HTMLAnchorElemen
|
|
|
31
30
|
interface BreadcrumbOptions extends BreadcrumbProps {
|
|
32
31
|
enabled: boolean;
|
|
33
32
|
component: ReactNode;
|
|
33
|
+
/**
|
|
34
|
+
* Show the full path to the current page
|
|
35
|
+
*
|
|
36
|
+
* @defaultValue false
|
|
37
|
+
* @deprecated use `includePage` instead
|
|
38
|
+
*/
|
|
39
|
+
full?: boolean;
|
|
34
40
|
}
|
|
35
41
|
interface FooterOptions extends FooterProps {
|
|
36
42
|
enabled: boolean;
|
package/dist/page.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"page.d.ts","sourceRoot":"","sources":["../src/page.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,QAAQ,EAAE,KAAK,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAC3E,OAAO,EACL,KAAK,oBAAoB,EAEzB,KAAK,cAAc,EACnB,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"page.d.ts","sourceRoot":"","sources":["../src/page.tsx"],"names":[],"mappings":"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"}
|
package/dist/page.js
CHANGED
|
@@ -1,27 +1,25 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef, } from 'react';
|
|
3
|
-
import dynamic from 'next/dynamic';
|
|
4
3
|
import { AnchorProvider } from 'fumadocs-core/toc';
|
|
5
4
|
import { Card, Cards } from './components/card';
|
|
6
5
|
import { replaceOrDefault } from './layouts/shared';
|
|
7
6
|
import { cn } from './utils/cn';
|
|
8
|
-
import { Footer, LastUpdate, PageContainer, PageHeader, } from './page.client';
|
|
9
|
-
import { Breadcrumb, } from './components/layout/breadcrumb';
|
|
7
|
+
import { Footer, LastUpdate, PageContainer, PageHeader, Breadcrumb, } from './page.client';
|
|
10
8
|
import { Toc, TOCItems } from './components/layout/toc';
|
|
11
9
|
import { TocPopoverTrigger, TocPopover, TocPopoverContent, } from './components/layout/toc-popover';
|
|
12
10
|
import { buttonVariants } from './components/ui/button';
|
|
13
11
|
import { Edit, Text } from 'lucide-react';
|
|
14
12
|
import { I18nLabel } from './contexts/i18n';
|
|
15
|
-
|
|
13
|
+
import ClerkTOCItems from './components/layout/toc-clerk';
|
|
16
14
|
export function DocsPage({ toc = [], breadcrumb = {}, full = false, footer = {}, tableOfContentPopover: { enabled: tocPopoverEnabled = true, component: tocPopoverReplace, ...tocPopoverOptions } = {}, tableOfContent: {
|
|
17
15
|
// disable TOC on full mode, you can still enable it with `enabled` option.
|
|
18
16
|
enabled: tocEnabled = !full, component: tocReplace, ...tocOptions } = {}, ...props }) {
|
|
19
17
|
return (_jsxs(AnchorProvider, { toc: toc, single: tocOptions.single, children: [_jsxs(PageContainer, { style: {
|
|
20
18
|
'--fd-toc-width': tocEnabled ? undefined : '0px',
|
|
21
|
-
}, children: [replaceOrDefault({ enabled: tocPopoverEnabled, component: tocPopoverReplace }, _jsx(PageHeader, { className: "
|
|
19
|
+
}, children: [replaceOrDefault({ enabled: tocPopoverEnabled, component: tocPopoverReplace }, _jsx(PageHeader, { className: "xl:hidden", children: _jsxs(TocPopover, { children: [_jsx(TocPopoverTrigger, { className: "size-full", items: toc }), _jsxs(TocPopoverContent, { children: [tocPopoverOptions.header, tocPopoverOptions.style === 'clerk' ? (_jsx(ClerkTOCItems, { items: toc, isMenu: true })) : (_jsx(TOCItems, { items: toc, isMenu: true })), tocPopoverOptions.footer] })] }) }), {
|
|
22
20
|
items: toc,
|
|
23
21
|
...tocPopoverOptions,
|
|
24
|
-
}), _jsxs("article", { className: cn('mx-auto flex w-full flex-1 flex-col gap-6 px-4 pt-10 md:px-
|
|
22
|
+
}), _jsxs("article", { className: cn('mx-auto flex w-full flex-1 flex-col gap-6 px-4 pt-10 md:px-8 md:pt-12', tocEnabled ? 'max-w-[860px]' : 'max-w-[1120px]'), children: [replaceOrDefault(breadcrumb, _jsx(Breadcrumb, { includePage: breadcrumb.full, ...breadcrumb })), props.children, _jsx("div", { role: "none", className: "flex-1" }), _jsxs("div", { className: "flex flex-row flex-wrap items-center justify-between gap-4 empty:hidden", children: [props.editOnGithub ? (_jsx(EditOnGitHub, { ...props.editOnGithub })) : null, props.lastUpdate ? (_jsx(LastUpdate, { date: new Date(props.lastUpdate) })) : null] }), replaceOrDefault(footer, _jsx(Footer, { items: footer.items }))] })] }), replaceOrDefault({ enabled: tocEnabled, component: tocReplace }, _jsx(Toc, { className: "max-xl:hidden", children: _jsxs("div", { className: "flex h-full w-[var(--fd-toc-width)] max-w-full flex-col gap-3 pe-2", children: [tocOptions.header, _jsxs("h3", { className: "-ms-0.5 inline-flex items-center gap-1.5 text-sm text-fd-muted-foreground", children: [_jsx(Text, { className: "size-4" }), _jsx(I18nLabel, { label: "toc" })] }), tocOptions.style === 'clerk' ? (_jsx(ClerkTOCItems, { items: toc })) : (_jsx(TOCItems, { items: toc })), tocOptions.footer] }) }), {
|
|
25
23
|
items: toc,
|
|
26
24
|
...tocOptions,
|
|
27
25
|
}, _jsx("div", { role: "none", className: "flex-1" }))] }));
|