@hanzo/docs-base-ui 16.5.3 → 16.7.5
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/css/generated/docs.css +68 -33
- package/css/generated/flux.css +44 -34
- package/css/generated/home.css +88 -4
- package/css/generated/notebook.css +65 -31
- package/css/generated/shared.css +199 -59
- package/css/lib/base.css +1 -4
- package/css/lib/shiki.css +49 -41
- package/css/preset.css +3 -0
- package/dist/_virtual/_rolldown/runtime.js +6 -11
- package/dist/components/accordion.d.ts +1 -2
- package/dist/components/accordion.js +3 -7
- package/dist/components/banner.d.ts +1 -2
- package/dist/components/banner.js +1 -5
- package/dist/components/callout.d.ts +1 -2
- package/dist/components/callout.js +0 -3
- package/dist/components/card.d.ts +1 -2
- package/dist/components/card.js +0 -3
- package/dist/components/codeblock.d.ts +1 -2
- package/dist/components/codeblock.js +2 -6
- package/dist/components/codeblock.rsc.d.ts +21 -0
- package/dist/components/codeblock.rsc.js +22 -0
- package/dist/components/dialog/search-algolia.d.ts +1 -3
- package/dist/components/dialog/search-algolia.js +1 -5
- package/dist/components/dialog/search-default.d.ts +1 -3
- package/dist/components/dialog/search-default.js +1 -5
- package/dist/components/dialog/search-orama.d.ts +1 -3
- package/dist/components/dialog/search-orama.js +1 -5
- package/dist/components/dialog/search.d.ts +5 -5
- package/dist/components/dialog/search.js +124 -47
- package/dist/components/dynamic-codeblock.core.d.ts +7 -5
- package/dist/components/dynamic-codeblock.core.js +17 -32
- package/dist/components/dynamic-codeblock.d.ts +5 -3
- package/dist/components/dynamic-codeblock.js +8 -13
- package/dist/components/files.d.ts +1 -2
- package/dist/components/files.js +4 -8
- package/dist/components/github-info.d.ts +22 -9
- package/dist/components/github-info.js +33 -28
- package/dist/components/heading.d.ts +1 -2
- package/dist/components/heading.js +2 -5
- package/dist/components/image-zoom.d.ts +1 -2
- package/dist/components/image-zoom.js +2 -5
- package/dist/components/inline-toc.d.ts +1 -2
- package/dist/components/inline-toc.js +1 -5
- package/dist/components/sidebar/base.d.ts +7 -3
- package/dist/components/sidebar/base.js +6 -16
- package/dist/components/sidebar/link-item.d.ts +2 -3
- package/dist/components/sidebar/link-item.js +6 -3
- package/dist/components/sidebar/page-tree.d.ts +1 -2
- package/dist/components/sidebar/page-tree.js +54 -43
- package/dist/components/sidebar/tabs/dropdown.d.ts +4 -7
- package/dist/components/sidebar/tabs/dropdown.js +4 -11
- package/dist/components/sidebar/tabs/index.d.ts +3 -17
- package/dist/components/sidebar/tabs/index.js +0 -3
- package/dist/components/steps.d.ts +1 -2
- package/dist/components/steps.js +0 -3
- package/dist/components/tabs.d.ts +11 -7
- package/dist/components/tabs.js +13 -18
- package/dist/components/toc/clerk.d.ts +9 -2
- package/dist/components/toc/clerk.js +117 -62
- package/dist/components/toc/default.d.ts +9 -2
- package/dist/components/toc/default.js +28 -21
- package/dist/components/toc/index.d.ts +8 -5
- package/dist/components/toc/index.js +50 -25
- package/dist/components/type-table.d.ts +10 -5
- package/dist/components/type-table.js +22 -17
- package/dist/components/ui/accordion.d.ts +1 -2
- package/dist/components/ui/accordion.js +1 -5
- package/dist/components/ui/button.d.ts +2 -3
- package/dist/components/ui/button.js +0 -3
- package/dist/components/ui/collapsible.d.ts +1 -2
- package/dist/components/ui/collapsible.js +2 -6
- package/dist/components/ui/navigation-menu.d.ts +26 -12
- package/dist/components/ui/navigation-menu.js +52 -30
- package/dist/components/ui/popover.d.ts +10 -5
- package/dist/components/ui/popover.js +14 -18
- package/dist/components/ui/scroll-area.d.ts +17 -7
- package/dist/components/ui/scroll-area.js +26 -30
- package/dist/components/ui/tabs.d.ts +1 -2
- package/dist/components/ui/tabs.js +1 -5
- package/dist/contexts/i18n.d.ts +7 -5
- package/dist/contexts/i18n.js +3 -8
- package/dist/contexts/search.d.ts +2 -2
- package/dist/contexts/search.js +4 -6
- package/dist/contexts/tree.d.ts +1 -2
- package/dist/contexts/tree.js +1 -5
- package/dist/i18n.d.ts +16 -9
- package/dist/i18n.js +14 -14
- package/dist/layouts/docs/client.d.ts +30 -29
- package/dist/layouts/docs/client.js +72 -48
- package/dist/layouts/docs/index.d.ts +19 -33
- package/dist/layouts/docs/index.js +16 -172
- package/dist/layouts/docs/page/index.d.ts +67 -55
- package/dist/layouts/docs/page/index.js +74 -54
- package/dist/layouts/docs/page/slots/breadcrumb.d.ts +14 -0
- package/dist/layouts/docs/page/slots/breadcrumb.js +44 -0
- package/dist/layouts/docs/page/slots/container.d.ts +7 -0
- package/dist/layouts/docs/page/slots/container.js +17 -0
- package/dist/layouts/docs/page/slots/footer.d.ts +23 -0
- package/dist/layouts/docs/page/slots/footer.js +56 -0
- package/dist/layouts/docs/page/slots/toc.d.ts +55 -0
- package/dist/layouts/docs/page/slots/toc.js +166 -0
- package/dist/layouts/docs/slots/container.d.ts +7 -0
- package/dist/layouts/docs/slots/container.js +29 -0
- package/dist/layouts/docs/slots/header.d.ts +8 -0
- package/dist/layouts/docs/slots/header.js +38 -0
- package/dist/layouts/docs/slots/sidebar.d.ts +30 -0
- package/dist/layouts/docs/slots/sidebar.js +319 -0
- package/dist/layouts/flux/index.d.ts +34 -39
- package/dist/layouts/flux/index.js +77 -99
- package/dist/layouts/flux/page/index.d.ts +56 -49
- package/dist/layouts/flux/page/index.js +63 -35
- package/dist/layouts/flux/page/slots/breadcrumb.d.ts +14 -0
- package/dist/layouts/flux/page/slots/breadcrumb.js +44 -0
- package/dist/layouts/flux/page/slots/container.d.ts +7 -0
- package/dist/layouts/flux/page/slots/container.js +17 -0
- package/dist/layouts/flux/page/slots/footer.d.ts +23 -0
- package/dist/layouts/flux/page/slots/footer.js +56 -0
- package/dist/layouts/flux/page/slots/toc.d.ts +34 -0
- package/dist/layouts/flux/page/slots/toc.js +172 -0
- package/dist/layouts/flux/slots/container.d.ts +7 -0
- package/dist/layouts/flux/slots/container.js +13 -0
- package/dist/layouts/flux/slots/sidebar.d.ts +23 -0
- package/dist/layouts/flux/{sidebar.js → slots/sidebar.js} +74 -34
- package/dist/layouts/flux/slots/tab-dropdown.d.ts +17 -0
- package/dist/layouts/flux/{tab-dropdown.js → slots/tab-dropdown.js} +13 -24
- package/dist/layouts/home/index.d.ts +24 -7
- package/dist/layouts/home/index.js +39 -19
- package/dist/layouts/home/navbar.d.ts +5 -14
- package/dist/layouts/home/navbar.js +10 -12
- package/dist/layouts/home/not-found.d.ts +9 -0
- package/dist/layouts/home/not-found.js +38 -0
- package/dist/layouts/home/slots/container.d.ts +7 -0
- package/dist/layouts/home/slots/container.js +13 -0
- package/dist/layouts/home/slots/header.d.ts +11 -0
- package/dist/layouts/home/slots/header.js +242 -0
- package/dist/layouts/notebook/client.d.ts +32 -44
- package/dist/layouts/notebook/client.js +57 -147
- package/dist/layouts/notebook/index.d.ts +25 -24
- package/dist/layouts/notebook/index.js +16 -212
- package/dist/layouts/notebook/page/index.d.ts +67 -55
- package/dist/layouts/notebook/page/index.js +74 -54
- package/dist/layouts/notebook/page/slots/breadcrumb.d.ts +14 -0
- package/dist/layouts/notebook/page/slots/breadcrumb.js +44 -0
- package/dist/layouts/notebook/page/slots/container.d.ts +7 -0
- package/dist/layouts/notebook/page/slots/container.js +17 -0
- package/dist/layouts/notebook/page/slots/footer.d.ts +23 -0
- package/dist/layouts/notebook/page/slots/footer.js +56 -0
- package/dist/layouts/notebook/page/slots/toc.d.ts +55 -0
- package/dist/layouts/notebook/page/slots/toc.js +165 -0
- package/dist/layouts/notebook/slots/container.d.ts +7 -0
- package/dist/layouts/notebook/slots/container.js +31 -0
- package/dist/layouts/notebook/slots/header.d.ts +8 -0
- package/dist/layouts/notebook/slots/header.js +194 -0
- package/dist/layouts/notebook/slots/sidebar.d.ts +40 -0
- package/dist/layouts/notebook/slots/sidebar.js +297 -0
- package/dist/layouts/shared/client.d.ts +45 -0
- package/dist/layouts/shared/client.js +84 -0
- package/dist/layouts/shared/index.d.ts +136 -34
- package/dist/layouts/shared/index.js +49 -17
- package/dist/layouts/shared/page-actions.d.ts +36 -0
- package/dist/layouts/shared/page-actions.js +190 -0
- package/dist/layouts/shared/slots/language-select.d.ts +10 -0
- package/dist/layouts/shared/{language-toggle.js → slots/language-select.js} +11 -15
- package/dist/layouts/shared/slots/search-trigger.d.ts +23 -0
- package/dist/layouts/shared/{search-toggle.js → slots/search-trigger.js} +9 -13
- package/dist/layouts/shared/slots/theme-switch.d.ts +14 -0
- package/dist/layouts/shared/{theme-toggle.js → slots/theme-switch.js} +5 -9
- package/dist/mdx.d.ts +13 -3
- package/dist/mdx.js +0 -4
- package/dist/mdx.server.d.ts +1 -2
- package/dist/mdx.server.js +0 -3
- package/dist/og/takumi.d.ts +21 -0
- package/dist/og/takumi.js +70 -0
- package/dist/og.d.ts +1 -2
- package/dist/og.js +6 -6
- package/dist/page.d.ts +3 -4
- package/dist/page.js +6 -11
- package/dist/provider/base.d.ts +1 -2
- package/dist/provider/base.js +2 -6
- package/dist/provider/next.d.ts +1 -2
- package/dist/provider/next.js +1 -5
- package/dist/provider/react-router.d.ts +1 -2
- package/dist/provider/react-router.js +1 -5
- package/dist/provider/tanstack.d.ts +1 -2
- package/dist/provider/tanstack.js +1 -5
- package/dist/provider/waku.d.ts +1 -2
- package/dist/provider/waku.js +1 -5
- package/dist/style.css +433 -166
- package/dist/tailwind/typography.d.ts +2 -0
- package/dist/tailwind/typography.js +2 -0
- package/dist/utils/cn.js +1 -2
- package/dist/utils/merge-refs.js +0 -2
- package/dist/utils/urls.js +1 -3
- package/dist/utils/use-copy-button.d.ts +1 -2
- package/dist/utils/use-copy-button.js +1 -5
- package/dist/utils/use-footer-items.d.ts +1 -2
- package/dist/utils/use-footer-items.js +4 -8
- package/dist/utils/use-is-scroll-top.d.ts +1 -2
- package/dist/utils/use-is-scroll-top.js +1 -5
- package/package.json +139 -103
- package/LICENSE +0 -21
- package/dist/components/accordion.d.ts.map +0 -1
- package/dist/components/accordion.js.map +0 -1
- package/dist/components/banner.d.ts.map +0 -1
- package/dist/components/banner.js.map +0 -1
- package/dist/components/callout.d.ts.map +0 -1
- package/dist/components/callout.js.map +0 -1
- package/dist/components/card.d.ts.map +0 -1
- package/dist/components/card.js.map +0 -1
- package/dist/components/codeblock.d.ts.map +0 -1
- package/dist/components/codeblock.js.map +0 -1
- package/dist/components/dialog/search-algolia.d.ts.map +0 -1
- package/dist/components/dialog/search-algolia.js.map +0 -1
- package/dist/components/dialog/search-default.d.ts.map +0 -1
- package/dist/components/dialog/search-default.js.map +0 -1
- package/dist/components/dialog/search-orama.d.ts.map +0 -1
- package/dist/components/dialog/search-orama.js.map +0 -1
- package/dist/components/dialog/search.d.ts.map +0 -1
- package/dist/components/dialog/search.js.map +0 -1
- package/dist/components/dynamic-codeblock.core.d.ts.map +0 -1
- package/dist/components/dynamic-codeblock.core.js.map +0 -1
- package/dist/components/dynamic-codeblock.d.ts.map +0 -1
- package/dist/components/dynamic-codeblock.js.map +0 -1
- package/dist/components/files.d.ts.map +0 -1
- package/dist/components/files.js.map +0 -1
- package/dist/components/github-info.d.ts.map +0 -1
- package/dist/components/github-info.js.map +0 -1
- package/dist/components/heading.d.ts.map +0 -1
- package/dist/components/heading.js.map +0 -1
- package/dist/components/image-zoom-DGvp66QF.css +0 -80
- package/dist/components/image-zoom-DGvp66QF.css.map +0 -1
- package/dist/components/image-zoom.d.ts.map +0 -1
- package/dist/components/image-zoom.js.map +0 -1
- package/dist/components/image-zoom2.js +0 -1
- package/dist/components/inline-toc.d.ts.map +0 -1
- package/dist/components/inline-toc.js.map +0 -1
- package/dist/components/sidebar/base.d.ts.map +0 -1
- package/dist/components/sidebar/base.js.map +0 -1
- package/dist/components/sidebar/link-item.d.ts.map +0 -1
- package/dist/components/sidebar/link-item.js.map +0 -1
- package/dist/components/sidebar/page-tree.d.ts.map +0 -1
- package/dist/components/sidebar/page-tree.js.map +0 -1
- package/dist/components/sidebar/tabs/dropdown.d.ts.map +0 -1
- package/dist/components/sidebar/tabs/dropdown.js.map +0 -1
- package/dist/components/sidebar/tabs/index.d.ts.map +0 -1
- package/dist/components/sidebar/tabs/index.js.map +0 -1
- package/dist/components/steps.d.ts.map +0 -1
- package/dist/components/steps.js.map +0 -1
- package/dist/components/tabs.d.ts.map +0 -1
- package/dist/components/tabs.js.map +0 -1
- package/dist/components/toc/clerk.d.ts.map +0 -1
- package/dist/components/toc/clerk.js.map +0 -1
- package/dist/components/toc/default.d.ts.map +0 -1
- package/dist/components/toc/default.js.map +0 -1
- package/dist/components/toc/index.d.ts.map +0 -1
- package/dist/components/toc/index.js.map +0 -1
- package/dist/components/type-table.d.ts.map +0 -1
- package/dist/components/type-table.js.map +0 -1
- package/dist/components/ui/accordion.d.ts.map +0 -1
- package/dist/components/ui/accordion.js.map +0 -1
- package/dist/components/ui/button.d.ts.map +0 -1
- package/dist/components/ui/button.js.map +0 -1
- package/dist/components/ui/collapsible.d.ts.map +0 -1
- package/dist/components/ui/collapsible.js.map +0 -1
- package/dist/components/ui/navigation-menu.d.ts.map +0 -1
- package/dist/components/ui/navigation-menu.js.map +0 -1
- package/dist/components/ui/popover.d.ts.map +0 -1
- package/dist/components/ui/popover.js.map +0 -1
- package/dist/components/ui/scroll-area.d.ts.map +0 -1
- package/dist/components/ui/scroll-area.js.map +0 -1
- package/dist/components/ui/tabs.d.ts.map +0 -1
- package/dist/components/ui/tabs.js.map +0 -1
- package/dist/contexts/i18n.d.ts.map +0 -1
- package/dist/contexts/i18n.js.map +0 -1
- package/dist/contexts/search.d.ts.map +0 -1
- package/dist/contexts/search.js.map +0 -1
- package/dist/contexts/tree.d.ts.map +0 -1
- package/dist/contexts/tree.js.map +0 -1
- package/dist/i18n.d.ts.map +0 -1
- package/dist/i18n.js.map +0 -1
- package/dist/layouts/docs/client.d.ts.map +0 -1
- package/dist/layouts/docs/client.js.map +0 -1
- package/dist/layouts/docs/index.d.ts.map +0 -1
- package/dist/layouts/docs/index.js.map +0 -1
- package/dist/layouts/docs/page/client.d.ts +0 -48
- package/dist/layouts/docs/page/client.d.ts.map +0 -1
- package/dist/layouts/docs/page/client.js +0 -227
- package/dist/layouts/docs/page/client.js.map +0 -1
- package/dist/layouts/docs/page/index.d.ts.map +0 -1
- package/dist/layouts/docs/page/index.js.map +0 -1
- package/dist/layouts/docs/sidebar.d.ts +0 -64
- package/dist/layouts/docs/sidebar.d.ts.map +0 -1
- package/dist/layouts/docs/sidebar.js +0 -162
- package/dist/layouts/docs/sidebar.js.map +0 -1
- package/dist/layouts/flux/index.d.ts.map +0 -1
- package/dist/layouts/flux/index.js.map +0 -1
- package/dist/layouts/flux/page/client.d.ts +0 -45
- package/dist/layouts/flux/page/client.d.ts.map +0 -1
- package/dist/layouts/flux/page/client.js +0 -255
- package/dist/layouts/flux/page/client.js.map +0 -1
- package/dist/layouts/flux/page/index.d.ts.map +0 -1
- package/dist/layouts/flux/page/index.js.map +0 -1
- package/dist/layouts/flux/sidebar.d.ts +0 -59
- package/dist/layouts/flux/sidebar.d.ts.map +0 -1
- package/dist/layouts/flux/sidebar.js.map +0 -1
- package/dist/layouts/flux/tab-dropdown.d.ts +0 -21
- package/dist/layouts/flux/tab-dropdown.d.ts.map +0 -1
- package/dist/layouts/flux/tab-dropdown.js.map +0 -1
- package/dist/layouts/home/client.d.ts +0 -19
- package/dist/layouts/home/client.d.ts.map +0 -1
- package/dist/layouts/home/client.js +0 -267
- package/dist/layouts/home/client.js.map +0 -1
- package/dist/layouts/home/index.d.ts.map +0 -1
- package/dist/layouts/home/index.js.map +0 -1
- package/dist/layouts/home/navbar.d.ts.map +0 -1
- package/dist/layouts/home/navbar.js.map +0 -1
- package/dist/layouts/notebook/client.d.ts.map +0 -1
- package/dist/layouts/notebook/client.js.map +0 -1
- package/dist/layouts/notebook/index.d.ts.map +0 -1
- package/dist/layouts/notebook/index.js.map +0 -1
- package/dist/layouts/notebook/page/client.d.ts +0 -48
- package/dist/layouts/notebook/page/client.d.ts.map +0 -1
- package/dist/layouts/notebook/page/client.js +0 -227
- package/dist/layouts/notebook/page/client.js.map +0 -1
- package/dist/layouts/notebook/page/index.d.ts.map +0 -1
- package/dist/layouts/notebook/page/index.js.map +0 -1
- package/dist/layouts/notebook/sidebar.d.ts +0 -60
- package/dist/layouts/notebook/sidebar.d.ts.map +0 -1
- package/dist/layouts/notebook/sidebar.js +0 -133
- package/dist/layouts/notebook/sidebar.js.map +0 -1
- package/dist/layouts/shared/index.d.ts.map +0 -1
- package/dist/layouts/shared/index.js.map +0 -1
- package/dist/layouts/shared/language-toggle.d.ts +0 -10
- package/dist/layouts/shared/language-toggle.d.ts.map +0 -1
- package/dist/layouts/shared/language-toggle.js.map +0 -1
- package/dist/layouts/shared/search-toggle.d.ts +0 -23
- package/dist/layouts/shared/search-toggle.d.ts.map +0 -1
- package/dist/layouts/shared/search-toggle.js.map +0 -1
- package/dist/layouts/shared/theme-toggle.d.ts +0 -14
- package/dist/layouts/shared/theme-toggle.d.ts.map +0 -1
- package/dist/layouts/shared/theme-toggle.js.map +0 -1
- package/dist/mdx.d.ts.map +0 -1
- package/dist/mdx.js.map +0 -1
- package/dist/mdx.server.d.ts.map +0 -1
- package/dist/mdx.server.js.map +0 -1
- package/dist/og.d.ts.map +0 -1
- package/dist/og.js.map +0 -1
- package/dist/page.d.ts.map +0 -1
- package/dist/page.js.map +0 -1
- package/dist/provider/base.d.ts.map +0 -1
- package/dist/provider/base.js.map +0 -1
- package/dist/provider/next.d.ts.map +0 -1
- package/dist/provider/next.js.map +0 -1
- package/dist/provider/react-router.d.ts.map +0 -1
- package/dist/provider/react-router.js.map +0 -1
- package/dist/provider/tanstack.d.ts.map +0 -1
- package/dist/provider/tanstack.js.map +0 -1
- package/dist/provider/waku.d.ts.map +0 -1
- package/dist/provider/waku.js.map +0 -1
- package/dist/utils/link-item.d.ts +0 -86
- package/dist/utils/link-item.d.ts.map +0 -1
- package/dist/utils/link-item.js +0 -25
- package/dist/utils/link-item.js.map +0 -1
- package/dist/utils/merge-refs.js.map +0 -1
- package/dist/utils/urls.js.map +0 -1
- package/dist/utils/use-copy-button.d.ts.map +0 -1
- package/dist/utils/use-copy-button.js.map +0 -1
- package/dist/utils/use-footer-items.d.ts.map +0 -1
- package/dist/utils/use-footer-items.js.map +0 -1
- package/dist/utils/use-is-scroll-top.d.ts.map +0 -1
- package/dist/utils/use-is-scroll-top.js.map +0 -1
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { SidebarProviderProps as SidebarProviderProps$1, useSidebar as useSidebar$1 } from "../../../components/sidebar/base.js";
|
|
2
|
+
import { SidebarPageTreeComponents } from "../../../components/sidebar/page-tree.js";
|
|
3
|
+
import { ComponentProps, ReactNode } from "react";
|
|
4
|
+
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
5
|
+
|
|
6
|
+
//#region src/layouts/docs/slots/sidebar.d.ts
|
|
7
|
+
interface SidebarProps extends ComponentProps<'aside'> {
|
|
8
|
+
components?: Partial<SidebarPageTreeComponents>;
|
|
9
|
+
banner?: ReactNode;
|
|
10
|
+
footer?: ReactNode;
|
|
11
|
+
/**
|
|
12
|
+
* Support collapsing the sidebar on desktop mode
|
|
13
|
+
*
|
|
14
|
+
* @defaultValue true
|
|
15
|
+
*/
|
|
16
|
+
collapsible?: boolean;
|
|
17
|
+
}
|
|
18
|
+
type SidebarProviderProps = SidebarProviderProps$1;
|
|
19
|
+
declare const useSidebar: typeof useSidebar$1;
|
|
20
|
+
declare function SidebarProvider(props: SidebarProviderProps): react_jsx_runtime0.JSX.Element;
|
|
21
|
+
declare function Sidebar({
|
|
22
|
+
footer,
|
|
23
|
+
banner,
|
|
24
|
+
collapsible,
|
|
25
|
+
components,
|
|
26
|
+
...rest
|
|
27
|
+
}: SidebarProps): react_jsx_runtime0.JSX.Element;
|
|
28
|
+
declare function SidebarTrigger(props: ComponentProps<'button'>): react_jsx_runtime0.JSX.Element;
|
|
29
|
+
//#endregion
|
|
30
|
+
export { Sidebar, SidebarProps, SidebarProvider, SidebarProviderProps, SidebarTrigger, useSidebar };
|
|
@@ -0,0 +1,319 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn } from "../../../utils/cn.js";
|
|
3
|
+
import { buttonVariants } from "../../../components/ui/button.js";
|
|
4
|
+
import { mergeRefs } from "../../../utils/merge-refs.js";
|
|
5
|
+
import { Popover, PopoverContent, PopoverTrigger } from "../../../components/ui/popover.js";
|
|
6
|
+
import { SearchTrigger } from "../../shared/slots/search-trigger.js";
|
|
7
|
+
import { LinkItem } from "../../shared/client.js";
|
|
8
|
+
import { isLayoutTabActive } from "../../shared/index.js";
|
|
9
|
+
import { SidebarCollapseTrigger as SidebarCollapseTrigger$1, SidebarContent as SidebarContent$1, SidebarDrawerContent, SidebarDrawerOverlay, SidebarFolder as SidebarFolder$1, SidebarFolderContent as SidebarFolderContent$1, SidebarFolderLink as SidebarFolderLink$1, SidebarFolderTrigger as SidebarFolderTrigger$1, SidebarItem as SidebarItem$1, SidebarProvider as SidebarProvider$1, SidebarSeparator as SidebarSeparator$1, SidebarTrigger as SidebarTrigger$1, SidebarViewport, base_exports, useFolder, useFolderDepth } from "../../../components/sidebar/base.js";
|
|
10
|
+
import { createPageTreeRenderer } from "../../../components/sidebar/page-tree.js";
|
|
11
|
+
import { createLinkItemRenderer } from "../../../components/sidebar/link-item.js";
|
|
12
|
+
import { useDocsLayout } from "../client.js";
|
|
13
|
+
import { useMemo, useRef, useState } from "react";
|
|
14
|
+
import { usePathname } from "@hanzo/docs-core/framework";
|
|
15
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
16
|
+
import Link from "@hanzo/docs-core/link";
|
|
17
|
+
import { Check, ChevronsUpDown, Languages, SidebarIcon } from "lucide-react";
|
|
18
|
+
import { cva } from "class-variance-authority";
|
|
19
|
+
//#region src/layouts/docs/slots/sidebar.tsx
|
|
20
|
+
const itemVariants = cva("relative flex flex-row items-center gap-2 rounded-lg p-2 text-start text-fd-muted-foreground wrap-anywhere [&_svg]:size-4 [&_svg]:shrink-0", { variants: {
|
|
21
|
+
variant: {
|
|
22
|
+
link: "transition-colors hover:bg-fd-accent/50 hover:text-fd-accent-foreground/80 hover:transition-none data-[active=true]:bg-fd-primary/10 data-[active=true]:text-fd-primary data-[active=true]:hover:transition-colors",
|
|
23
|
+
button: "transition-colors hover:bg-fd-accent/50 hover:text-fd-accent-foreground/80 hover:transition-none"
|
|
24
|
+
},
|
|
25
|
+
highlight: { true: "data-[active=true]:before:content-[''] data-[active=true]:before:bg-fd-primary data-[active=true]:before:absolute data-[active=true]:before:w-px data-[active=true]:before:inset-y-2.5 data-[active=true]:before:start-2.5" }
|
|
26
|
+
} });
|
|
27
|
+
const { useSidebar } = base_exports;
|
|
28
|
+
function SidebarProvider(props) {
|
|
29
|
+
return /* @__PURE__ */ jsx(SidebarProvider$1, { ...props });
|
|
30
|
+
}
|
|
31
|
+
function Sidebar({ footer, banner, collapsible = true, components, ...rest }) {
|
|
32
|
+
const { menuItems, slots, props: { tabs, nav, tabMode } } = useDocsLayout();
|
|
33
|
+
const iconLinks = menuItems.filter((item) => item.type === "icon");
|
|
34
|
+
const viewport = /* @__PURE__ */ jsx(SidebarViewport, { children: /* @__PURE__ */ jsxs("div", {
|
|
35
|
+
className: "flex flex-col gap-0.5",
|
|
36
|
+
children: [menuItems.filter((v) => v.type !== "icon").map((item, i, list) => /* @__PURE__ */ jsx(SidebarLinkItem, {
|
|
37
|
+
item,
|
|
38
|
+
className: cn(i === list.length - 1 && "mb-4")
|
|
39
|
+
}, i)), /* @__PURE__ */ jsx(SidebarPageTree, { ...components })]
|
|
40
|
+
}) });
|
|
41
|
+
return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsxs(SidebarContent, {
|
|
42
|
+
...rest,
|
|
43
|
+
children: [
|
|
44
|
+
/* @__PURE__ */ jsxs("div", {
|
|
45
|
+
className: "flex flex-col gap-3 p-4 pb-2",
|
|
46
|
+
children: [
|
|
47
|
+
/* @__PURE__ */ jsxs("div", {
|
|
48
|
+
className: "flex",
|
|
49
|
+
children: [
|
|
50
|
+
slots.navTitle && /* @__PURE__ */ jsx(slots.navTitle, { className: "inline-flex text-[0.9375rem] items-center gap-2.5 font-medium me-auto" }),
|
|
51
|
+
nav?.children,
|
|
52
|
+
collapsible && /* @__PURE__ */ jsx(SidebarCollapseTrigger, {
|
|
53
|
+
className: cn(buttonVariants({
|
|
54
|
+
color: "ghost",
|
|
55
|
+
size: "icon-sm",
|
|
56
|
+
className: "mb-auto text-fd-muted-foreground"
|
|
57
|
+
})),
|
|
58
|
+
children: /* @__PURE__ */ jsx(SidebarIcon, {})
|
|
59
|
+
})
|
|
60
|
+
]
|
|
61
|
+
}),
|
|
62
|
+
slots.searchTrigger && /* @__PURE__ */ jsx(slots.searchTrigger.full, { hideIfDisabled: true }),
|
|
63
|
+
tabs.length > 0 && tabMode === "auto" && /* @__PURE__ */ jsx(SidebarTabsDropdown, { tabs }),
|
|
64
|
+
banner
|
|
65
|
+
]
|
|
66
|
+
}),
|
|
67
|
+
viewport,
|
|
68
|
+
(slots.languageSelect || iconLinks.length > 0 || slots.themeSwitch || footer) && /* @__PURE__ */ jsxs("div", {
|
|
69
|
+
className: "flex flex-col border-t p-4 pt-2 empty:hidden",
|
|
70
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
71
|
+
className: "flex text-fd-muted-foreground items-center empty:hidden",
|
|
72
|
+
children: [
|
|
73
|
+
slots.languageSelect && /* @__PURE__ */ jsx(slots.languageSelect.root, { children: /* @__PURE__ */ jsx(Languages, { className: "size-4.5" }) }),
|
|
74
|
+
iconLinks.map((item, i) => /* @__PURE__ */ jsx(LinkItem, {
|
|
75
|
+
item,
|
|
76
|
+
className: cn(buttonVariants({
|
|
77
|
+
size: "icon-sm",
|
|
78
|
+
color: "ghost"
|
|
79
|
+
})),
|
|
80
|
+
"aria-label": item.label,
|
|
81
|
+
children: item.icon
|
|
82
|
+
}, i)),
|
|
83
|
+
slots.themeSwitch && /* @__PURE__ */ jsx(slots.themeSwitch, { className: "ms-auto p-0" })
|
|
84
|
+
]
|
|
85
|
+
}), footer]
|
|
86
|
+
})
|
|
87
|
+
]
|
|
88
|
+
}), /* @__PURE__ */ jsxs(SidebarDrawer, { children: [
|
|
89
|
+
/* @__PURE__ */ jsxs("div", {
|
|
90
|
+
className: "flex flex-col gap-3 p-4 pb-2",
|
|
91
|
+
children: [
|
|
92
|
+
/* @__PURE__ */ jsxs("div", {
|
|
93
|
+
className: "flex text-fd-muted-foreground items-center gap-1.5",
|
|
94
|
+
children: [
|
|
95
|
+
/* @__PURE__ */ jsx("div", {
|
|
96
|
+
className: "flex flex-1",
|
|
97
|
+
children: iconLinks.map((item, i) => /* @__PURE__ */ jsx(LinkItem, {
|
|
98
|
+
item,
|
|
99
|
+
className: cn(buttonVariants({
|
|
100
|
+
size: "icon-sm",
|
|
101
|
+
color: "ghost",
|
|
102
|
+
className: "p-2"
|
|
103
|
+
})),
|
|
104
|
+
"aria-label": item.label,
|
|
105
|
+
children: item.icon
|
|
106
|
+
}, i))
|
|
107
|
+
}),
|
|
108
|
+
slots.languageSelect && /* @__PURE__ */ jsxs(slots.languageSelect.root, { children: [/* @__PURE__ */ jsx(Languages, { className: "size-4.5" }), /* @__PURE__ */ jsx(slots.languageSelect.text, {})] }),
|
|
109
|
+
slots.themeSwitch && /* @__PURE__ */ jsx(slots.themeSwitch, { className: "p-0" }),
|
|
110
|
+
/* @__PURE__ */ jsx(SidebarTrigger, {
|
|
111
|
+
className: cn(buttonVariants({
|
|
112
|
+
color: "ghost",
|
|
113
|
+
size: "icon-sm",
|
|
114
|
+
className: "p-2"
|
|
115
|
+
})),
|
|
116
|
+
children: /* @__PURE__ */ jsx(SidebarIcon, {})
|
|
117
|
+
})
|
|
118
|
+
]
|
|
119
|
+
}),
|
|
120
|
+
tabs.length > 0 && /* @__PURE__ */ jsx(SidebarTabsDropdown, { tabs }),
|
|
121
|
+
banner
|
|
122
|
+
]
|
|
123
|
+
}),
|
|
124
|
+
viewport,
|
|
125
|
+
/* @__PURE__ */ jsx("div", {
|
|
126
|
+
className: "flex flex-col border-t p-4 pt-2 empty:hidden",
|
|
127
|
+
children: footer
|
|
128
|
+
})
|
|
129
|
+
] })] });
|
|
130
|
+
}
|
|
131
|
+
function SidebarFolder(props) {
|
|
132
|
+
return /* @__PURE__ */ jsx(SidebarFolder$1, { ...props });
|
|
133
|
+
}
|
|
134
|
+
function SidebarCollapseTrigger(props) {
|
|
135
|
+
return /* @__PURE__ */ jsx(SidebarCollapseTrigger$1, { ...props });
|
|
136
|
+
}
|
|
137
|
+
function SidebarTrigger(props) {
|
|
138
|
+
return /* @__PURE__ */ jsx(SidebarTrigger$1, { ...props });
|
|
139
|
+
}
|
|
140
|
+
function SidebarContent({ ref: refProp, className, children, ...props }) {
|
|
141
|
+
const ref = useRef(null);
|
|
142
|
+
return /* @__PURE__ */ jsx(SidebarContent$1, { children: ({ collapsed, hovered, ref: asideRef, ...rest }) => /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsxs("div", {
|
|
143
|
+
"data-sidebar-placeholder": "",
|
|
144
|
+
className: "sticky top-(--fd-docs-row-1) z-20 [grid-area:sidebar] pointer-events-none *:pointer-events-auto h-[calc(var(--fd-docs-height)-var(--fd-docs-row-1))] md:layout:[--fd-sidebar-width:268px] max-md:hidden",
|
|
145
|
+
children: [collapsed && /* @__PURE__ */ jsx("div", {
|
|
146
|
+
className: "absolute start-0 inset-y-0 w-4",
|
|
147
|
+
...rest
|
|
148
|
+
}), /* @__PURE__ */ jsx("aside", {
|
|
149
|
+
id: "nd-sidebar",
|
|
150
|
+
ref: mergeRefs(ref, refProp, asideRef),
|
|
151
|
+
"data-collapsed": collapsed,
|
|
152
|
+
"data-hovered": collapsed && hovered,
|
|
153
|
+
className: cn("absolute flex flex-col w-full start-0 inset-y-0 items-end bg-fd-card text-sm border-e duration-250 *:w-(--fd-sidebar-width)", collapsed && ["inset-y-2 rounded-xl transition-transform border w-(--fd-sidebar-width)", hovered ? "shadow-lg translate-x-2 rtl:-translate-x-2" : "-translate-x-(--fd-sidebar-width) rtl:translate-x-full"], ref.current && ref.current.getAttribute("data-collapsed") === "true" !== collapsed && "transition-[width,inset-block,translate,background-color]", className),
|
|
154
|
+
...props,
|
|
155
|
+
...rest,
|
|
156
|
+
children
|
|
157
|
+
})]
|
|
158
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
159
|
+
"data-sidebar-panel": "",
|
|
160
|
+
className: cn("fixed flex top-[calc(--spacing(4)+var(--fd-docs-row-3))] start-4 shadow-lg transition-opacity rounded-xl p-0.5 border bg-fd-muted text-fd-muted-foreground z-10", (!collapsed || hovered) && "pointer-events-none opacity-0"),
|
|
161
|
+
children: [/* @__PURE__ */ jsx(SidebarCollapseTrigger$1, {
|
|
162
|
+
className: cn(buttonVariants({
|
|
163
|
+
color: "ghost",
|
|
164
|
+
size: "icon-sm",
|
|
165
|
+
className: "rounded-lg"
|
|
166
|
+
})),
|
|
167
|
+
children: /* @__PURE__ */ jsx(SidebarIcon, {})
|
|
168
|
+
}), /* @__PURE__ */ jsx(SearchTrigger, {
|
|
169
|
+
className: "rounded-lg",
|
|
170
|
+
hideIfDisabled: true
|
|
171
|
+
})]
|
|
172
|
+
})] }) });
|
|
173
|
+
}
|
|
174
|
+
function SidebarDrawer({ children, className, ...props }) {
|
|
175
|
+
return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(SidebarDrawerOverlay, { className: "fixed z-40 inset-0 backdrop-blur-xs data-[state=open]:animate-fd-fade-in data-[state=closed]:animate-fd-fade-out" }), /* @__PURE__ */ jsx(SidebarDrawerContent, {
|
|
176
|
+
className: cn("fixed text-[0.9375rem] flex flex-col shadow-lg border-s end-0 inset-y-0 w-[85%] max-w-[380px] z-40 bg-fd-background data-[state=open]:animate-fd-sidebar-in data-[state=closed]:animate-fd-sidebar-out", className),
|
|
177
|
+
...props,
|
|
178
|
+
children
|
|
179
|
+
})] });
|
|
180
|
+
}
|
|
181
|
+
function SidebarSeparator({ className, style, children, ...props }) {
|
|
182
|
+
const depth = useFolderDepth();
|
|
183
|
+
return /* @__PURE__ */ jsx(SidebarSeparator$1, {
|
|
184
|
+
className: cn("inline-flex items-center gap-2 mb-1 px-2 mt-6 empty:mb-0 [&_svg]:size-4 [&_svg]:shrink-0", depth === 0 && "first:mt-0", className),
|
|
185
|
+
style: {
|
|
186
|
+
paddingInlineStart: getItemOffset(depth),
|
|
187
|
+
...style
|
|
188
|
+
},
|
|
189
|
+
...props,
|
|
190
|
+
children
|
|
191
|
+
});
|
|
192
|
+
}
|
|
193
|
+
function SidebarItem({ className, style, children, ...props }) {
|
|
194
|
+
const depth = useFolderDepth();
|
|
195
|
+
return /* @__PURE__ */ jsx(SidebarItem$1, {
|
|
196
|
+
className: cn(itemVariants({
|
|
197
|
+
variant: "link",
|
|
198
|
+
highlight: depth >= 1
|
|
199
|
+
}), className),
|
|
200
|
+
style: {
|
|
201
|
+
paddingInlineStart: getItemOffset(depth),
|
|
202
|
+
...style
|
|
203
|
+
},
|
|
204
|
+
...props,
|
|
205
|
+
children
|
|
206
|
+
});
|
|
207
|
+
}
|
|
208
|
+
function SidebarFolderTrigger({ className, style, ...props }) {
|
|
209
|
+
const { depth, collapsible } = useFolder();
|
|
210
|
+
return /* @__PURE__ */ jsx(SidebarFolderTrigger$1, {
|
|
211
|
+
className: (state) => cn(itemVariants({ variant: collapsible ? "button" : null }), "w-full", typeof className === "function" ? className(state) : className),
|
|
212
|
+
style: {
|
|
213
|
+
paddingInlineStart: getItemOffset(depth - 1),
|
|
214
|
+
...style
|
|
215
|
+
},
|
|
216
|
+
...props,
|
|
217
|
+
children: props.children
|
|
218
|
+
});
|
|
219
|
+
}
|
|
220
|
+
function SidebarFolderLink({ className, style, ...props }) {
|
|
221
|
+
const depth = useFolderDepth();
|
|
222
|
+
return /* @__PURE__ */ jsx(SidebarFolderLink$1, {
|
|
223
|
+
className: cn(itemVariants({
|
|
224
|
+
variant: "link",
|
|
225
|
+
highlight: depth > 1
|
|
226
|
+
}), "w-full", className),
|
|
227
|
+
style: {
|
|
228
|
+
paddingInlineStart: getItemOffset(depth - 1),
|
|
229
|
+
...style
|
|
230
|
+
},
|
|
231
|
+
...props,
|
|
232
|
+
children: props.children
|
|
233
|
+
});
|
|
234
|
+
}
|
|
235
|
+
function SidebarFolderContent({ className, children, ...props }) {
|
|
236
|
+
const depth = useFolderDepth();
|
|
237
|
+
return /* @__PURE__ */ jsx(SidebarFolderContent$1, {
|
|
238
|
+
className: (state) => cn("relative flex flex-col gap-0.5 pt-0.5", depth === 1 && "before:content-[''] before:absolute before:w-px before:inset-y-1 before:bg-fd-border before:start-2.5", typeof className === "function" ? className(state) : className),
|
|
239
|
+
...props,
|
|
240
|
+
children
|
|
241
|
+
});
|
|
242
|
+
}
|
|
243
|
+
function SidebarTabsDropdown({ tabs, placeholder, ...props }) {
|
|
244
|
+
const [open, setOpen] = useState(false);
|
|
245
|
+
const { closeOnRedirect } = useSidebar();
|
|
246
|
+
const pathname = usePathname();
|
|
247
|
+
const selected = useMemo(() => {
|
|
248
|
+
return tabs.findLast((item) => isLayoutTabActive(item, pathname));
|
|
249
|
+
}, [tabs, pathname]);
|
|
250
|
+
const onClick = () => {
|
|
251
|
+
closeOnRedirect.current = false;
|
|
252
|
+
setOpen(false);
|
|
253
|
+
};
|
|
254
|
+
const item = selected ? /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("div", {
|
|
255
|
+
className: "size-9 shrink-0 empty:hidden md:size-5",
|
|
256
|
+
children: selected.icon
|
|
257
|
+
}), /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("p", {
|
|
258
|
+
className: "text-sm font-medium",
|
|
259
|
+
children: selected.title
|
|
260
|
+
}), /* @__PURE__ */ jsx("p", {
|
|
261
|
+
className: "text-sm text-fd-muted-foreground empty:hidden md:hidden",
|
|
262
|
+
children: selected.description
|
|
263
|
+
})] })] }) : placeholder;
|
|
264
|
+
return /* @__PURE__ */ jsxs(Popover, {
|
|
265
|
+
open,
|
|
266
|
+
onOpenChange: setOpen,
|
|
267
|
+
children: [item && /* @__PURE__ */ jsxs(PopoverTrigger, {
|
|
268
|
+
...props,
|
|
269
|
+
className: cn("flex items-center gap-2 rounded-lg p-2 border bg-fd-secondary/50 text-start text-fd-secondary-foreground transition-colors hover:bg-fd-accent data-[state=open]:bg-fd-accent data-[state=open]:text-fd-accent-foreground", props.className),
|
|
270
|
+
children: [item, /* @__PURE__ */ jsx(ChevronsUpDown, { className: "shrink-0 ms-auto size-4 text-fd-muted-foreground" })]
|
|
271
|
+
}), /* @__PURE__ */ jsx(PopoverContent, {
|
|
272
|
+
className: "flex flex-col gap-1 w-(--radix-popover-trigger-width) p-1 fd-scroll-container",
|
|
273
|
+
children: tabs.map((item) => {
|
|
274
|
+
const isActive = selected && item.url === selected.url;
|
|
275
|
+
if (!isActive && item.unlisted) return;
|
|
276
|
+
return /* @__PURE__ */ jsxs(Link, {
|
|
277
|
+
href: item.url,
|
|
278
|
+
onClick,
|
|
279
|
+
...item.props,
|
|
280
|
+
className: cn("flex items-center gap-2 rounded-lg p-1.5 hover:bg-fd-accent hover:text-fd-accent-foreground", item.props?.className),
|
|
281
|
+
children: [
|
|
282
|
+
/* @__PURE__ */ jsx("div", {
|
|
283
|
+
className: "shrink-0 size-9 md:mb-auto md:size-5 empty:hidden",
|
|
284
|
+
children: item.icon
|
|
285
|
+
}),
|
|
286
|
+
/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("p", {
|
|
287
|
+
className: "text-sm font-medium leading-none",
|
|
288
|
+
children: item.title
|
|
289
|
+
}), /* @__PURE__ */ jsx("p", {
|
|
290
|
+
className: "text-[0.8125rem] text-fd-muted-foreground mt-1 empty:hidden",
|
|
291
|
+
children: item.description
|
|
292
|
+
})] }),
|
|
293
|
+
/* @__PURE__ */ jsx(Check, { className: cn("shrink-0 ms-auto size-3.5 text-fd-primary", !isActive && "invisible") })
|
|
294
|
+
]
|
|
295
|
+
}, item.url);
|
|
296
|
+
})
|
|
297
|
+
})]
|
|
298
|
+
});
|
|
299
|
+
}
|
|
300
|
+
function getItemOffset(depth) {
|
|
301
|
+
return `calc(${2 + 3 * depth} * var(--spacing))`;
|
|
302
|
+
}
|
|
303
|
+
const SidebarPageTree = createPageTreeRenderer({
|
|
304
|
+
SidebarFolder,
|
|
305
|
+
SidebarFolderContent,
|
|
306
|
+
SidebarFolderLink,
|
|
307
|
+
SidebarFolderTrigger,
|
|
308
|
+
SidebarItem,
|
|
309
|
+
SidebarSeparator
|
|
310
|
+
});
|
|
311
|
+
const SidebarLinkItem = createLinkItemRenderer({
|
|
312
|
+
SidebarFolder,
|
|
313
|
+
SidebarFolderContent,
|
|
314
|
+
SidebarFolderLink,
|
|
315
|
+
SidebarFolderTrigger,
|
|
316
|
+
SidebarItem
|
|
317
|
+
});
|
|
318
|
+
//#endregion
|
|
319
|
+
export { Sidebar, SidebarProvider, SidebarTrigger, useSidebar };
|
|
@@ -1,52 +1,49 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { ComponentProps, HTMLAttributes, ReactNode } from "react";
|
|
1
|
+
import { BaseSlots, BaseSlotsProps } from "../shared/client.js";
|
|
2
|
+
import { BaseLayoutProps, GetLayoutTabsOptions, LayoutTab, LinkItemType } from "../shared/index.js";
|
|
3
|
+
import { TabDropdownProps } from "./slots/tab-dropdown.js";
|
|
4
|
+
import { SidebarProps, SidebarProviderProps } from "./slots/sidebar.js";
|
|
5
|
+
import { ComponentProps, FC, ReactNode } from "react";
|
|
7
6
|
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
8
|
-
import { motion } from "motion/react";
|
|
9
7
|
import * as PageTree from "@hanzo/docs-core/page-tree";
|
|
8
|
+
import { motion } from "motion/react";
|
|
10
9
|
|
|
11
10
|
//#region src/layouts/flux/index.d.ts
|
|
11
|
+
interface DocsSlots extends BaseSlots {
|
|
12
|
+
container: FC<ComponentProps<'div'>>;
|
|
13
|
+
tabDropdown: FC<TabDropdownProps>;
|
|
14
|
+
sidebar: {
|
|
15
|
+
provider: FC<SidebarProviderProps>;
|
|
16
|
+
trigger: FC<ComponentProps<'button'>>;
|
|
17
|
+
root: FC<SidebarProps>;
|
|
18
|
+
useSidebar: () => {
|
|
19
|
+
collapsed: boolean;
|
|
20
|
+
open: boolean;
|
|
21
|
+
setOpen: (v: boolean) => void;
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
}
|
|
12
25
|
interface DocsLayoutProps extends BaseLayoutProps {
|
|
13
26
|
tree: PageTree.Root;
|
|
14
27
|
sidebar?: SidebarOptions;
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
*/
|
|
18
|
-
containerProps?: HTMLAttributes<HTMLDivElement>;
|
|
28
|
+
tabs?: LayoutTab[] | GetLayoutTabsOptions | false;
|
|
29
|
+
slots?: Partial<DocsSlots>;
|
|
19
30
|
renderNavigationPanel?: (props: NavigationPanelProps) => ReactNode;
|
|
31
|
+
containerProps?: ComponentProps<'div'>;
|
|
20
32
|
}
|
|
21
|
-
interface SidebarOptions extends
|
|
33
|
+
interface SidebarOptions extends SidebarProps, SidebarProviderProps {
|
|
22
34
|
enabled?: boolean;
|
|
23
|
-
component?: ReactNode;
|
|
24
|
-
components?: Partial<SidebarPageTreeComponents>;
|
|
25
35
|
/**
|
|
26
|
-
*
|
|
36
|
+
* @deprecated use layout-level `tabs` instead.
|
|
27
37
|
*/
|
|
28
|
-
tabs?:
|
|
29
|
-
banner?: ReactNode;
|
|
30
|
-
footer?: ReactNode;
|
|
38
|
+
tabs?: LayoutTab[] | GetLayoutTabsOptions | false;
|
|
31
39
|
}
|
|
32
|
-
declare function
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
prefetch,
|
|
40
|
-
...sidebarProps
|
|
41
|
-
},
|
|
42
|
-
searchToggle,
|
|
43
|
-
themeSwitch,
|
|
44
|
-
i18n,
|
|
45
|
-
children,
|
|
46
|
-
containerProps,
|
|
47
|
-
renderNavigationPanel,
|
|
48
|
-
...props
|
|
49
|
-
}: DocsLayoutProps): react_jsx_runtime0.JSX.Element;
|
|
40
|
+
declare function useFluxLayout(): {
|
|
41
|
+
props: BaseSlotsProps;
|
|
42
|
+
menuItems: LinkItemType[];
|
|
43
|
+
navItems: LinkItemType[];
|
|
44
|
+
slots: DocsSlots;
|
|
45
|
+
};
|
|
46
|
+
declare function DocsLayout(props: DocsLayoutProps): react_jsx_runtime0.JSX.Element;
|
|
50
47
|
interface NavigationPanelProps {
|
|
51
48
|
head: ReactNode;
|
|
52
49
|
tabDropdown: ReactNode;
|
|
@@ -58,7 +55,6 @@ declare function NavigationPanel({
|
|
|
58
55
|
tabDropdown,
|
|
59
56
|
tool,
|
|
60
57
|
link,
|
|
61
|
-
className,
|
|
62
58
|
children,
|
|
63
59
|
...props
|
|
64
60
|
}: NavigationPanelProps & Omit<ComponentProps<typeof motion.div>, 'children'> & {
|
|
@@ -75,5 +71,4 @@ declare function NavigationPanelOverlay({
|
|
|
75
71
|
enabled?: boolean;
|
|
76
72
|
}): react_jsx_runtime0.JSX.Element;
|
|
77
73
|
//#endregion
|
|
78
|
-
export { DocsLayout, DocsLayoutProps, NavigationPanel, NavigationPanelOverlay, NavigationPanelProps };
|
|
79
|
-
//# sourceMappingURL=index.d.ts.map
|
|
74
|
+
export { DocsLayout, DocsLayoutProps, DocsSlots, NavigationPanel, NavigationPanelOverlay, NavigationPanelProps, useFluxLayout };
|
|
@@ -1,80 +1,84 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use client";
|
|
3
2
|
import { cn } from "../../utils/cn.js";
|
|
4
3
|
import { buttonVariants } from "../../components/ui/button.js";
|
|
5
4
|
import { TreeContextProvider } from "../../contexts/tree.js";
|
|
6
|
-
import {
|
|
7
|
-
import { LinkItem } from "
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import { SidebarTabsDropdown } from "./tab-dropdown.js";
|
|
14
|
-
import { Sidebar as Sidebar$1, SidebarContent, SidebarLinkItem, SidebarPageTree } from "./sidebar.js";
|
|
15
|
-
import { useMemo } from "react";
|
|
5
|
+
import { useSearchContext } from "../../contexts/search.js";
|
|
6
|
+
import { LinkItem, baseSlots } from "../shared/client.js";
|
|
7
|
+
import { getLayoutTabs, useLinkItems } from "../shared/index.js";
|
|
8
|
+
import { TabDropdown } from "./slots/tab-dropdown.js";
|
|
9
|
+
import { Sidebar as Sidebar$1, SidebarProvider, SidebarTrigger, useSidebar } from "./slots/sidebar.js";
|
|
10
|
+
import { Container } from "./slots/container.js";
|
|
11
|
+
import { createContext, use, useMemo } from "react";
|
|
16
12
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
17
|
-
import { Languages
|
|
18
|
-
import {
|
|
13
|
+
import { Languages } from "lucide-react";
|
|
14
|
+
import { motion } from "motion/react";
|
|
19
15
|
import { RemoveScroll } from "react-remove-scroll";
|
|
20
|
-
|
|
21
16
|
//#region src/layouts/flux/index.tsx
|
|
22
|
-
|
|
17
|
+
const LayoutContext = createContext(null);
|
|
18
|
+
function useFluxLayout() {
|
|
19
|
+
const context = use(LayoutContext);
|
|
20
|
+
if (!context) throw new Error("Please use Flux layout components under <DocsLayout /> (`@hanzo/docs-ui/layouts/flux`).");
|
|
21
|
+
return context;
|
|
22
|
+
}
|
|
23
|
+
const { useProvider } = baseSlots({ useProps() {
|
|
24
|
+
return useFluxLayout().props;
|
|
25
|
+
} });
|
|
26
|
+
function DocsLayout(props) {
|
|
27
|
+
const { tree, nav = {}, sidebar: { enabled: sidebarEnabled = true, tabs: _tabs, defaultOpenLevel, prefetch, ...sidebarProps } = {}, tabs: defaultTabs = _tabs, children, containerProps, renderNavigationPanel = (props) => /* @__PURE__ */ jsx(NavigationPanel, { ...props }), slots: defaultSlots = {} } = props;
|
|
28
|
+
const linkItems = useLinkItems(props);
|
|
29
|
+
const { baseSlots, baseProps } = useProvider(props);
|
|
23
30
|
const tabs = useMemo(() => {
|
|
24
|
-
if (Array.isArray(
|
|
25
|
-
if (typeof
|
|
26
|
-
if (
|
|
31
|
+
if (Array.isArray(defaultTabs)) return defaultTabs;
|
|
32
|
+
if (typeof defaultTabs === "object") return getLayoutTabs(tree, defaultTabs);
|
|
33
|
+
if (defaultTabs !== false) return getLayoutTabs(tree);
|
|
27
34
|
return [];
|
|
28
|
-
}, [tree,
|
|
29
|
-
const
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
id: "nd-flux-layout",
|
|
56
|
-
...containerProps,
|
|
57
|
-
className: cn("flex flex-col items-center pb-24 overflow-x-clip", containerProps?.className),
|
|
58
|
-
children: [sidebarEnabled && sidebar(), children]
|
|
35
|
+
}, [tree, defaultTabs]);
|
|
36
|
+
const slots = {
|
|
37
|
+
...baseSlots,
|
|
38
|
+
container: defaultSlots.container ?? Container,
|
|
39
|
+
tabDropdown: defaultSlots.tabDropdown ?? TabDropdown,
|
|
40
|
+
sidebar: defaultSlots.sidebar ?? {
|
|
41
|
+
root: Sidebar$1,
|
|
42
|
+
provider: SidebarProvider,
|
|
43
|
+
trigger: SidebarTrigger,
|
|
44
|
+
useSidebar
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
return /* @__PURE__ */ jsx(LayoutContext, {
|
|
48
|
+
value: {
|
|
49
|
+
props: baseProps,
|
|
50
|
+
slots,
|
|
51
|
+
...linkItems
|
|
52
|
+
},
|
|
53
|
+
children: /* @__PURE__ */ jsxs(TreeContextProvider, {
|
|
54
|
+
tree,
|
|
55
|
+
children: [/* @__PURE__ */ jsx(slots.sidebar.provider, {
|
|
56
|
+
defaultOpenLevel,
|
|
57
|
+
prefetch,
|
|
58
|
+
children: /* @__PURE__ */ jsxs(slots.container, {
|
|
59
|
+
...containerProps,
|
|
60
|
+
children: [sidebarEnabled && /* @__PURE__ */ jsx(slots.sidebar.root, { ...sidebarProps }), children]
|
|
61
|
+
})
|
|
59
62
|
}), renderNavigationPanel({
|
|
60
|
-
head:
|
|
61
|
-
tabDropdown: tabs.length > 0 && /* @__PURE__ */ jsx(
|
|
63
|
+
head: /* @__PURE__ */ jsxs(Fragment$1, { children: [slots.navTitle && /* @__PURE__ */ jsx(slots.navTitle, { className: "inline-flex items-center gap-2.5 text-sm font-semibold" }), nav.children] }),
|
|
64
|
+
tabDropdown: slots.tabDropdown && tabs.length > 0 && /* @__PURE__ */ jsx(slots.tabDropdown, {
|
|
62
65
|
className: "flex-1",
|
|
63
|
-
|
|
66
|
+
tabs
|
|
64
67
|
}),
|
|
65
68
|
tool: /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
})
|
|
71
|
-
/* @__PURE__ */ jsx(
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
}))
|
|
69
|
+
slots.languageSelect && /* @__PURE__ */ jsx(slots.languageSelect.root, { children: /* @__PURE__ */ jsx(Languages, { className: "size-4.5" }) }),
|
|
70
|
+
slots.searchTrigger && /* @__PURE__ */ jsx(slots.searchTrigger.sm, {
|
|
71
|
+
hideIfDisabled: true,
|
|
72
|
+
className: "rounded-lg"
|
|
73
|
+
}),
|
|
74
|
+
slots.sidebar && /* @__PURE__ */ jsx(slots.sidebar.trigger, { className: cn(buttonVariants({
|
|
75
|
+
variant: "ghost",
|
|
76
|
+
size: "icon-sm",
|
|
77
|
+
className: "overflow-hidden"
|
|
78
|
+
})) }),
|
|
79
|
+
slots.themeSwitch && /* @__PURE__ */ jsx(slots.themeSwitch, { className: "p-1 h-full ms-1 rounded-xl bg-fd-muted *:rounded-lg" })
|
|
76
80
|
] }),
|
|
77
|
-
link:
|
|
81
|
+
link: linkItems.menuItems.filter((item) => item.type === "icon").map((item, i) => /* @__PURE__ */ jsx(LinkItem, {
|
|
78
82
|
item,
|
|
79
83
|
className: cn(buttonVariants({
|
|
80
84
|
size: "icon-sm",
|
|
@@ -87,40 +91,16 @@ function DocsLayout({ tree, nav = {}, sidebar: { enabled: sidebarEnabled = true,
|
|
|
87
91
|
})
|
|
88
92
|
});
|
|
89
93
|
}
|
|
90
|
-
function
|
|
91
|
-
const { open
|
|
92
|
-
return /* @__PURE__ */ jsx("button", {
|
|
93
|
-
className: cn(buttonVariants({
|
|
94
|
-
variant: "ghost",
|
|
95
|
-
size: "icon-sm",
|
|
96
|
-
className: "overflow-hidden"
|
|
97
|
-
})),
|
|
98
|
-
onClick: () => setOpen((prev) => !prev),
|
|
99
|
-
children: /* @__PURE__ */ jsx(AnimatePresence, {
|
|
100
|
-
mode: "wait",
|
|
101
|
-
children: /* @__PURE__ */ jsx(motion.span, {
|
|
102
|
-
transition: { duration: .2 },
|
|
103
|
-
initial: {
|
|
104
|
-
y: "100%",
|
|
105
|
-
opacity: 0
|
|
106
|
-
},
|
|
107
|
-
animate: {
|
|
108
|
-
y: 0,
|
|
109
|
-
opacity: 1
|
|
110
|
-
},
|
|
111
|
-
exit: {
|
|
112
|
-
y: "100%",
|
|
113
|
-
opacity: 0
|
|
114
|
-
},
|
|
115
|
-
children: open ? /* @__PURE__ */ jsx(XIcon, {}) : /* @__PURE__ */ jsx(SidebarIcon, {})
|
|
116
|
-
}, open ? "open" : "closed")
|
|
117
|
-
})
|
|
118
|
-
});
|
|
119
|
-
}
|
|
120
|
-
function NavigationPanel({ head, tabDropdown, tool, link, className, children = (v) => v, ...props }) {
|
|
94
|
+
function NavigationPanel({ head, tabDropdown, tool, link, children = (v) => v, ...props }) {
|
|
95
|
+
const { open } = useSearchContext();
|
|
121
96
|
return /* @__PURE__ */ jsx(motion.div, {
|
|
122
|
-
className: cn("fixed left-1/2 w-[calc(100%-var(--removed-body-scroll-bar-size,0px))] translate-x-[calc(-50%-var(--removed-body-scroll-bar-size,0px)/2)] bottom-0 z-40 bg-fd-popover text-fd-popover-foreground border-t shadow-lg sm:bottom-6 sm:rounded-2xl sm:border sm:max-w-[380px]", className),
|
|
123
97
|
...props,
|
|
98
|
+
className: cn("fixed left-1/2 w-[calc(100%-var(--removed-body-scroll-bar-size,0px))] translate-x-[calc(-50%-var(--removed-body-scroll-bar-size,0px)/2)] bottom-0 z-40 bg-fd-popover text-fd-popover-foreground border-t shadow-lg sm:bottom-6 sm:rounded-2xl sm:border sm:max-w-[380px]", props.className),
|
|
99
|
+
animate: props.animate ?? {
|
|
100
|
+
scale: open ? .9 : 1,
|
|
101
|
+
translateY: open ? 20 : 0,
|
|
102
|
+
opacity: open ? .8 : 1
|
|
103
|
+
},
|
|
124
104
|
children: children(/* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsxs("div", {
|
|
125
105
|
className: "flex flex-row items-center ps-2.5 p-1 gap-2 min-h-11",
|
|
126
106
|
children: [head, /* @__PURE__ */ jsx("div", {
|
|
@@ -162,7 +142,5 @@ function NavigationPanelOverlay({ enabled = false, className, ...props }) {
|
|
|
162
142
|
})
|
|
163
143
|
});
|
|
164
144
|
}
|
|
165
|
-
|
|
166
145
|
//#endregion
|
|
167
|
-
export { DocsLayout, NavigationPanel, NavigationPanelOverlay };
|
|
168
|
-
//# sourceMappingURL=index.js.map
|
|
146
|
+
export { DocsLayout, NavigationPanel, NavigationPanelOverlay, useFluxLayout };
|