@vx-oss/docs-react 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +5 -0
- package/css/aspen.css +39 -0
- package/css/black.css +39 -0
- package/css/catppuccin.css +49 -0
- package/css/dusk.css +47 -0
- package/css/emerald.css +39 -0
- package/css/generated/docs.css +1 -0
- package/css/generated/flux.css +1 -0
- package/css/generated/glass.css +1 -0
- package/css/generated/home.css +1 -0
- package/css/generated/notebook.css +1 -0
- package/css/generated/shared.css +1 -0
- package/css/lib/base.css +296 -0
- package/css/lib/default-colors.css +51 -0
- package/css/lib/shiki.css +108 -0
- package/css/neutral.css +7 -0
- package/css/ocean.css +44 -0
- package/css/preset-legacy.css +43 -0
- package/css/preset.css +11 -0
- package/css/purple.css +39 -0
- package/css/ruby.css +39 -0
- package/css/shadcn.css +36 -0
- package/css/solar.css +65 -0
- package/css/style.css +9 -0
- package/css/vitepress.css +72 -0
- package/dist/.translations/index.d.ts +55 -0
- package/dist/.translations/keys.js +55 -0
- package/dist/_virtual/_rolldown/runtime.js +13 -0
- package/dist/components/accordion.d.ts +10 -0
- package/dist/components/accordion.js +68 -0
- package/dist/components/banner.d.ts +25 -0
- package/dist/components/banner.js +85 -0
- package/dist/components/callout.d.ts +21 -0
- package/dist/components/callout.js +60 -0
- package/dist/components/card.d.ts +13 -0
- package/dist/components/card.js +39 -0
- package/dist/components/codeblock.d.ts +45 -0
- package/dist/components/codeblock.js +126 -0
- package/dist/components/codeblock.rsc.d.ts +15 -0
- package/dist/components/codeblock.rsc.js +22 -0
- package/dist/components/dialog/search-algolia.d.ts +27 -0
- package/dist/components/dialog/search-algolia.js +64 -0
- package/dist/components/dialog/search-default.d.ts +29 -0
- package/dist/components/dialog/search-default.js +66 -0
- package/dist/components/dialog/search-orama.d.ts +32 -0
- package/dist/components/dialog/search-orama.js +69 -0
- package/dist/components/dialog/search.d.ts +76 -0
- package/dist/components/dialog/search.js +351 -0
- package/dist/components/dynamic-codeblock.core.d.ts +26 -0
- package/dist/components/dynamic-codeblock.core.js +51 -0
- package/dist/components/dynamic-codeblock.d.ts +8 -0
- package/dist/components/dynamic-codeblock.js +17 -0
- package/dist/components/files.d.ts +21 -0
- package/dist/components/files.js +40 -0
- package/dist/components/github-info.d.ts +20 -0
- package/dist/components/github-info.js +75 -0
- package/dist/components/heading.d.ts +9 -0
- package/dist/components/heading.js +38 -0
- package/dist/components/image-zoom.d.ts +18 -0
- package/dist/components/image-zoom.js +32 -0
- package/dist/components/image-zoom2.css +71 -0
- package/dist/components/inline-toc.d.ts +10 -0
- package/dist/components/inline-toc.js +28 -0
- package/dist/components/sidebar/base.d.ts +85 -0
- package/dist/components/sidebar/base.js +277 -0
- package/dist/components/sidebar/link-item.d.ts +12 -0
- package/dist/components/sidebar/link-item.js +37 -0
- package/dist/components/sidebar/page-tree.d.ts +20 -0
- package/dist/components/sidebar/page-tree.js +69 -0
- package/dist/components/sidebar/tabs/dropdown.d.ts +15 -0
- package/dist/components/sidebar/tabs/dropdown.js +83 -0
- package/dist/components/sidebar/tabs/index.d.ts +8 -0
- package/dist/components/sidebar/tabs/index.js +46 -0
- package/dist/components/steps.d.ts +10 -0
- package/dist/components/steps.js +16 -0
- package/dist/components/tabs.d.ts +33 -0
- package/dist/components/tabs.js +95 -0
- package/dist/components/toc/clerk.d.ts +11 -0
- package/dist/components/toc/clerk.js +227 -0
- package/dist/components/toc/default.d.ts +13 -0
- package/dist/components/toc/default.js +260 -0
- package/dist/components/toc/index.d.ts +10 -0
- package/dist/components/toc/index.js +45 -0
- package/dist/components/type-table.d.ts +37 -0
- package/dist/components/type-table.js +117 -0
- package/dist/components/ui/accordion.d.ts +10 -0
- package/dist/components/ui/accordion.js +42 -0
- package/dist/components/ui/button.d.ts +10 -0
- package/dist/components/ui/button.js +20 -0
- package/dist/components/ui/collapsible.d.ts +11 -0
- package/dist/components/ui/collapsible.js +21 -0
- package/dist/components/ui/navigation-menu.d.ts +14 -0
- package/dist/components/ui/navigation-menu.js +41 -0
- package/dist/components/ui/popover.d.ts +9 -0
- package/dist/components/ui/popover.js +20 -0
- package/dist/components/ui/scroll-area.d.ts +9 -0
- package/dist/components/ui/scroll-area.js +34 -0
- package/dist/components/ui/tabs.d.ts +23 -0
- package/dist/components/ui/tabs.js +102 -0
- package/dist/contexts/i18n.d.ts +34 -0
- package/dist/contexts/i18n.js +37 -0
- package/dist/contexts/search.d.ts +64 -0
- package/dist/contexts/search.js +68 -0
- package/dist/contexts/tree.d.ts +29 -0
- package/dist/contexts/tree.js +91 -0
- package/dist/i18n.d.ts +15 -0
- package/dist/i18n.js +38 -0
- package/dist/layouts/docs/client.d.ts +33 -0
- package/dist/layouts/docs/client.js +94 -0
- package/dist/layouts/docs/index.d.ts +32 -0
- package/dist/layouts/docs/index.js +23 -0
- package/dist/layouts/docs/page/index.d.ts +76 -0
- package/dist/layouts/docs/page/index.js +124 -0
- package/dist/layouts/docs/page/slots/breadcrumb.d.ts +7 -0
- package/dist/layouts/docs/page/slots/breadcrumb.js +44 -0
- package/dist/layouts/docs/page/slots/container.d.ts +5 -0
- package/dist/layouts/docs/page/slots/container.js +22 -0
- package/dist/layouts/docs/page/slots/footer.d.ts +16 -0
- package/dist/layouts/docs/page/slots/footer.js +56 -0
- package/dist/layouts/docs/page/slots/toc.d.ts +47 -0
- package/dist/layouts/docs/page/slots/toc.js +182 -0
- package/dist/layouts/docs/slots/container.d.ts +5 -0
- package/dist/layouts/docs/slots/container.js +36 -0
- package/dist/layouts/docs/slots/header.d.ts +5 -0
- package/dist/layouts/docs/slots/header.js +38 -0
- package/dist/layouts/docs/slots/sidebar.d.ts +22 -0
- package/dist/layouts/docs/slots/sidebar.js +268 -0
- package/dist/layouts/flux/index.d.ts +61 -0
- package/dist/layouts/flux/index.js +146 -0
- package/dist/layouts/flux/page/index.d.ts +67 -0
- package/dist/layouts/flux/page/index.js +104 -0
- package/dist/layouts/flux/page/slots/breadcrumb.d.ts +7 -0
- package/dist/layouts/flux/page/slots/breadcrumb.js +44 -0
- package/dist/layouts/flux/page/slots/container.d.ts +5 -0
- package/dist/layouts/flux/page/slots/container.js +22 -0
- package/dist/layouts/flux/page/slots/footer.d.ts +16 -0
- package/dist/layouts/flux/page/slots/footer.js +56 -0
- package/dist/layouts/flux/page/slots/toc.d.ts +29 -0
- package/dist/layouts/flux/page/slots/toc.js +181 -0
- package/dist/layouts/flux/slots/container.d.ts +5 -0
- package/dist/layouts/flux/slots/container.js +13 -0
- package/dist/layouts/flux/slots/sidebar.d.ts +16 -0
- package/dist/layouts/flux/slots/sidebar.js +243 -0
- package/dist/layouts/flux/slots/tab-dropdown.d.ts +10 -0
- package/dist/layouts/flux/slots/tab-dropdown.js +88 -0
- package/dist/layouts/glass/index.d.ts +39 -0
- package/dist/layouts/glass/index.js +70 -0
- package/dist/layouts/glass/layout-tabs.js +54 -0
- package/dist/layouts/glass/page/index.d.ts +31 -0
- package/dist/layouts/glass/page/index.js +92 -0
- package/dist/layouts/glass/page/slots/breadcrumb.d.ts +7 -0
- package/dist/layouts/glass/page/slots/breadcrumb.js +44 -0
- package/dist/layouts/glass/page/slots/footer.d.ts +16 -0
- package/dist/layouts/glass/page/slots/footer.js +56 -0
- package/dist/layouts/glass/page/slots/toc.d.ts +19 -0
- package/dist/layouts/glass/page/slots/toc.js +108 -0
- package/dist/layouts/glass/slots/header.d.ts +6 -0
- package/dist/layouts/glass/slots/header.js +68 -0
- package/dist/layouts/glass/slots/sidebar.d.ts +21 -0
- package/dist/layouts/glass/slots/sidebar.js +267 -0
- package/dist/layouts/home/index.d.ts +27 -0
- package/dist/layouts/home/index.js +40 -0
- package/dist/layouts/home/navbar.d.ts +9 -0
- package/dist/layouts/home/navbar.js +34 -0
- package/dist/layouts/home/not-found.d.ts +7 -0
- package/dist/layouts/home/not-found.js +41 -0
- package/dist/layouts/home/slots/container.d.ts +5 -0
- package/dist/layouts/home/slots/container.js +13 -0
- package/dist/layouts/home/slots/header.d.ts +8 -0
- package/dist/layouts/home/slots/header.js +239 -0
- package/dist/layouts/notebook/client.d.ts +35 -0
- package/dist/layouts/notebook/client.js +69 -0
- package/dist/layouts/notebook/index.d.ts +26 -0
- package/dist/layouts/notebook/index.js +23 -0
- package/dist/layouts/notebook/page/index.d.ts +76 -0
- package/dist/layouts/notebook/page/index.js +124 -0
- package/dist/layouts/notebook/page/slots/breadcrumb.d.ts +7 -0
- package/dist/layouts/notebook/page/slots/breadcrumb.js +44 -0
- package/dist/layouts/notebook/page/slots/container.d.ts +5 -0
- package/dist/layouts/notebook/page/slots/container.js +22 -0
- package/dist/layouts/notebook/page/slots/footer.d.ts +16 -0
- package/dist/layouts/notebook/page/slots/footer.js +56 -0
- package/dist/layouts/notebook/page/slots/toc.d.ts +47 -0
- package/dist/layouts/notebook/page/slots/toc.js +181 -0
- package/dist/layouts/notebook/slots/container.d.ts +5 -0
- package/dist/layouts/notebook/slots/container.js +38 -0
- package/dist/layouts/notebook/slots/header.d.ts +5 -0
- package/dist/layouts/notebook/slots/header.js +204 -0
- package/dist/layouts/notebook/slots/sidebar.d.ts +23 -0
- package/dist/layouts/notebook/slots/sidebar.js +240 -0
- package/dist/layouts/shared/client.d.ts +37 -0
- package/dist/layouts/shared/client.js +85 -0
- package/dist/layouts/shared/index.d.ts +169 -0
- package/dist/layouts/shared/index.js +98 -0
- package/dist/layouts/shared/page-actions.d.ts +27 -0
- package/dist/layouts/shared/page-actions.js +199 -0
- package/dist/layouts/shared/slots/language-select.d.ts +12 -0
- package/dist/layouts/shared/slots/language-select.js +43 -0
- package/dist/layouts/shared/slots/search-trigger.d.ts +13 -0
- package/dist/layouts/shared/slots/search-trigger.js +53 -0
- package/dist/layouts/shared/slots/theme-switch.d.ts +8 -0
- package/dist/layouts/shared/slots/theme-switch.js +70 -0
- package/dist/legacy/layout.d.ts +29 -0
- package/dist/legacy/layout.js +44 -0
- package/dist/legacy/sidebar.d.ts +14 -0
- package/dist/legacy/sidebar.js +34 -0
- package/dist/mdx.d.ts +44 -0
- package/dist/mdx.js +70 -0
- package/dist/mdx.server.d.ts +14 -0
- package/dist/mdx.server.js +20 -0
- package/dist/node_modules/.pnpm/react-medium-image-zoom@5.4.9_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/react-medium-image-zoom/dist/controlled.d.ts +30 -0
- package/dist/node_modules/.pnpm/react-medium-image-zoom@5.4.9_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/react-medium-image-zoom/dist/controlled.js +461 -0
- package/dist/node_modules/.pnpm/react-medium-image-zoom@5.4.9_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/react-medium-image-zoom/dist/index.d.ts +3 -0
- package/dist/node_modules/.pnpm/react-medium-image-zoom@5.4.9_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/react-medium-image-zoom/dist/uncontrolled.d.ts +6 -0
- package/dist/node_modules/.pnpm/react-medium-image-zoom@5.4.9_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/react-medium-image-zoom/dist/uncontrolled.js +17 -0
- package/dist/node_modules/.pnpm/react-medium-image-zoom@5.4.9_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/react-medium-image-zoom/dist/utils/adjust-svg-ids.js +53 -0
- package/dist/node_modules/.pnpm/react-medium-image-zoom@5.4.9_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/react-medium-image-zoom/dist/utils/compute-positioned-style.js +25 -0
- package/dist/node_modules/.pnpm/react-medium-image-zoom@5.4.9_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/react-medium-image-zoom/dist/utils/element-tests.js +12 -0
- package/dist/node_modules/.pnpm/react-medium-image-zoom@5.4.9_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/react-medium-image-zoom/dist/utils/get-div-img-style.js +45 -0
- package/dist/node_modules/.pnpm/react-medium-image-zoom@5.4.9_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/react-medium-image-zoom/dist/utils/get-img-alt.js +10 -0
- package/dist/node_modules/.pnpm/react-medium-image-zoom@5.4.9_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/react-medium-image-zoom/dist/utils/get-img-object-fit-style.js +57 -0
- package/dist/node_modules/.pnpm/react-medium-image-zoom@5.4.9_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/react-medium-image-zoom/dist/utils/get-img-regular-style.js +21 -0
- package/dist/node_modules/.pnpm/react-medium-image-zoom@5.4.9_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/react-medium-image-zoom/dist/utils/get-img-src.js +14 -0
- package/dist/node_modules/.pnpm/react-medium-image-zoom@5.4.9_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/react-medium-image-zoom/dist/utils/get-modal-img-transform.js +22 -0
- package/dist/node_modules/.pnpm/react-medium-image-zoom@5.4.9_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/react-medium-image-zoom/dist/utils/get-scale.js +27 -0
- package/dist/node_modules/.pnpm/react-medium-image-zoom@5.4.9_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/react-medium-image-zoom/dist/utils/get-style-ghost.js +31 -0
- package/dist/node_modules/.pnpm/react-medium-image-zoom@5.4.9_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/react-medium-image-zoom/dist/utils/get-style-modal-img.js +75 -0
- package/dist/node_modules/.pnpm/react-medium-image-zoom@5.4.9_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/react-medium-image-zoom/dist/utils/get-target-dimension.js +4 -0
- package/dist/node_modules/.pnpm/react-medium-image-zoom@5.4.9_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/react-medium-image-zoom/dist/utils/parse-position.js +7 -0
- package/dist/node_modules/.pnpm/react-medium-image-zoom@5.4.9_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/react-medium-image-zoom/dist/utils/test-has-scalable-src.js +5 -0
- package/dist/og/takumi.d.ts +15 -0
- package/dist/og/takumi.js +91 -0
- package/dist/og.d.ts +16 -0
- package/dist/og.js +91 -0
- package/dist/page.d.ts +29 -0
- package/dist/page.js +33 -0
- package/dist/provider/astro.d.ts +29 -0
- package/dist/provider/astro.js +20 -0
- package/dist/provider/base.d.ts +48 -0
- package/dist/provider/base.js +73 -0
- package/dist/provider/next.d.ts +16 -0
- package/dist/provider/next.js +17 -0
- package/dist/provider/react-router.d.ts +16 -0
- package/dist/provider/react-router.js +17 -0
- package/dist/provider/tanstack.d.ts +16 -0
- package/dist/provider/tanstack.js +17 -0
- package/dist/provider/waku.d.ts +16 -0
- package/dist/provider/waku.js +17 -0
- package/dist/style.css +3640 -0
- package/dist/tailwind/typography.d.ts +2 -0
- package/dist/tailwind/typography.js +2 -0
- package/dist/utils/cn.js +2 -0
- package/dist/utils/merge-refs.js +11 -0
- package/dist/utils/urls.js +15 -0
- package/dist/utils/use-copy-button.d.ts +5 -0
- package/dist/utils/use-copy-button.js +26 -0
- package/dist/utils/use-footer-items.d.ts +8 -0
- package/dist/utils/use-footer-items.js +24 -0
- package/dist/utils/use-is-scroll-top.d.ts +6 -0
- package/dist/utils/use-is-scroll-top.js +20 -0
- package/package.json +212 -0
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn } from "../../../utils/cn.js";
|
|
3
|
+
import { buttonVariants } from "../../../components/ui/button.js";
|
|
4
|
+
import { SidebarTrigger } from "../../../components/sidebar/base.js";
|
|
5
|
+
import { LayoutTabsDropdown } from "../layout-tabs.js";
|
|
6
|
+
import { useGlassLayout } from "../index.js";
|
|
7
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
import { ChevronsUpDown, LanguagesIcon, MessageCircleIcon, SidebarIcon } from "lucide-react";
|
|
9
|
+
import { useTranslations } from "@fuma-translate/react";
|
|
10
|
+
//#region src/layouts/glass/slots/header.tsx
|
|
11
|
+
const baseVariants = "rounded-full bg-fd-popover/80 text-fd-popover-foreground border backdrop-blur-sm shadow-sm";
|
|
12
|
+
function Header({ className, ...props }) {
|
|
13
|
+
const { props: { tabs, aiChat }, slots } = useGlassLayout();
|
|
14
|
+
const t = useTranslations();
|
|
15
|
+
const sidebar = slots.sidebar.use();
|
|
16
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
17
|
+
className: cn("sticky flex flex-row justify-end gap-2 [grid-area:left-margin/left-margin/right/right] z-20 px-4 md:top-0 md:pt-2 md:px-2 md:h-12 md:bg-linear-to-b md:from-fd-background max-md:bottom-0 max-md:mt-auto max-md:h-16 max-md:pb-4 max-md:bg-linear-to-t max-md:from-fd-background", className),
|
|
18
|
+
...props,
|
|
19
|
+
children: [
|
|
20
|
+
sidebar.collapsible && sidebar.collapsed && /* @__PURE__ */ jsx("button", {
|
|
21
|
+
"aria-label": t("Show Sidebar", { note: "sidebar" }),
|
|
22
|
+
className: cn(buttonVariants({
|
|
23
|
+
size: "icon-sm",
|
|
24
|
+
variant: "secondary"
|
|
25
|
+
}), baseVariants, "size-10 me-auto shrink-0 max-md:hidden"),
|
|
26
|
+
onClick: () => sidebar.setCollapsed(false),
|
|
27
|
+
children: /* @__PURE__ */ jsx(SidebarIcon, {})
|
|
28
|
+
}),
|
|
29
|
+
slots.searchTrigger && /* @__PURE__ */ jsx(slots.searchTrigger.sm, {
|
|
30
|
+
color: "secondary",
|
|
31
|
+
size: "icon",
|
|
32
|
+
className: cn(baseVariants, "size-12 shrink-0 md:hidden")
|
|
33
|
+
}),
|
|
34
|
+
tabs.length > 0 && /* @__PURE__ */ jsx(LayoutTabsDropdown, {
|
|
35
|
+
tabs,
|
|
36
|
+
size: "lg",
|
|
37
|
+
className: cn(baseVariants, "min-w-0 ps-4 pe-3 flex-1 [&_svg]:size-5 md:hidden")
|
|
38
|
+
}),
|
|
39
|
+
slots.searchTrigger && /* @__PURE__ */ jsx("div", {
|
|
40
|
+
className: "@container flex justify-end flex-1 max-md:hidden",
|
|
41
|
+
children: /* @__PURE__ */ jsx(slots.searchTrigger.full, { className: cn(baseVariants, "text-fd-muted-foreground ps-3 w-full @sm:max-w-[200px]") })
|
|
42
|
+
}),
|
|
43
|
+
aiChat && !aiChat.open && /* @__PURE__ */ jsxs("button", {
|
|
44
|
+
className: cn(buttonVariants({ variant: "secondary" }), baseVariants, "px-3 gap-2 text-fd-muted-foreground shrink-0 max-md:hidden"),
|
|
45
|
+
onClick: () => aiChat.onOpenChange(true),
|
|
46
|
+
children: [/* @__PURE__ */ jsx(MessageCircleIcon, { className: "size-4" }), t("Ask AI", { note: "AI chat button" })]
|
|
47
|
+
}),
|
|
48
|
+
slots.languageSelect && /* @__PURE__ */ jsxs(slots.languageSelect.root, {
|
|
49
|
+
className: cn(baseVariants, "px-3 rounded-full max-md:hidden"),
|
|
50
|
+
children: [
|
|
51
|
+
/* @__PURE__ */ jsx(LanguagesIcon, { className: "size-4 text-fd-muted-foreground shrink-0" }),
|
|
52
|
+
/* @__PURE__ */ jsx(slots.languageSelect.text, {}),
|
|
53
|
+
/* @__PURE__ */ jsx(ChevronsUpDown, { className: "size-3.5 text-fd-muted-foreground shrink-0" })
|
|
54
|
+
]
|
|
55
|
+
}),
|
|
56
|
+
slots.themeSwitch && /* @__PURE__ */ jsx(slots.themeSwitch, { className: cn(baseVariants, "shrink-0 px-1.5 max-md:hidden") }),
|
|
57
|
+
/* @__PURE__ */ jsx(SidebarTrigger, {
|
|
58
|
+
className: cn(buttonVariants({
|
|
59
|
+
variant: "secondary",
|
|
60
|
+
size: "icon"
|
|
61
|
+
}), baseVariants, "shrink-0 size-12 md:hidden"),
|
|
62
|
+
children: /* @__PURE__ */ jsx(SidebarIcon, {})
|
|
63
|
+
})
|
|
64
|
+
]
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
//#endregion
|
|
68
|
+
export { Header };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { ComponentProps, ReactNode } from "react";
|
|
2
|
+
//#region src/layouts/glass/slots/sidebar.d.ts
|
|
3
|
+
interface SidebarProviderProps {
|
|
4
|
+
/** @default true */
|
|
5
|
+
collapsible?: boolean;
|
|
6
|
+
children: ReactNode;
|
|
7
|
+
}
|
|
8
|
+
declare function SidebarProvider({ children, collapsible }: SidebarProviderProps): import("react").JSX.Element;
|
|
9
|
+
declare function useSidebar(): {
|
|
10
|
+
collapsible: boolean;
|
|
11
|
+
collapsed: boolean;
|
|
12
|
+
setCollapsed: import("react").Dispatch<import("react").SetStateAction<boolean>>;
|
|
13
|
+
};
|
|
14
|
+
interface SidebarDrawerProps {
|
|
15
|
+
contentProps?: ComponentProps<'div'>;
|
|
16
|
+
}
|
|
17
|
+
declare function SidebarDrawer({ contentProps }: SidebarDrawerProps): import("react").JSX.Element;
|
|
18
|
+
type SidebarProps = ComponentProps<'aside'>;
|
|
19
|
+
declare function Sidebar({ className, children, ...props }: SidebarProps): import("react").JSX.Element;
|
|
20
|
+
//#endregion
|
|
21
|
+
export { Sidebar, SidebarDrawer, SidebarDrawerProps, SidebarProps, SidebarProvider, SidebarProviderProps, useSidebar };
|
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn } from "../../../utils/cn.js";
|
|
3
|
+
import { buttonVariants } from "../../../components/ui/button.js";
|
|
4
|
+
import { useTreeContext, useTreePath } from "../../../contexts/tree.js";
|
|
5
|
+
import { Collapsible, CollapsibleContent, CollapsibleTrigger } from "../../../components/ui/collapsible.js";
|
|
6
|
+
import { isLinkItemActive } from "../../shared/index.js";
|
|
7
|
+
import { ScrollArea, ScrollViewport } from "../../../components/ui/scroll-area.js";
|
|
8
|
+
import { SidebarDrawerContent, SidebarDrawerOverlay, SidebarProvider as SidebarProvider$1, useSidebar as useSidebar$1 } from "../../../components/sidebar/base.js";
|
|
9
|
+
import { LayoutTabsDropdown } from "../layout-tabs.js";
|
|
10
|
+
import { useGlassLayout } from "../index.js";
|
|
11
|
+
import Link from "@vx-oss/docs-core/link";
|
|
12
|
+
import { usePathname } from "@vx-oss/docs-core/framework";
|
|
13
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
14
|
+
import { ChevronDown, ChevronsUpDown, LanguagesIcon, MessageCircleIcon, SidebarIcon, XIcon } from "lucide-react";
|
|
15
|
+
import { cva } from "class-variance-authority";
|
|
16
|
+
import { cloneElement, createContext, use, useState } from "react";
|
|
17
|
+
import { useTranslations } from "@fuma-translate/react";
|
|
18
|
+
import { useOnChange } from "@vx-oss/docs-core/utils/use-on-change";
|
|
19
|
+
//#region src/layouts/glass/slots/sidebar.tsx
|
|
20
|
+
const itemTriggerVariants = cva("inline-flex text-sm items-center gap-2 rounded-lg px-2.5 py-2 md:py-1.5 [&_svg]:size-4 outline-none focus-visible:ring-2 focus-visible:ring-fd-ring", { variants: { active: {
|
|
21
|
+
true: "bg-fd-primary/10 text-fd-primary",
|
|
22
|
+
false: "text-fd-muted-foreground hover:bg-fd-accent hover:text-fd-accent-foreground"
|
|
23
|
+
} } });
|
|
24
|
+
const CollapsibleContext = createContext(true);
|
|
25
|
+
function SidebarProvider({ children, collapsible = true }) {
|
|
26
|
+
return /* @__PURE__ */ jsx(SidebarProvider$1, { children: /* @__PURE__ */ jsx(CollapsibleContext, {
|
|
27
|
+
value: collapsible,
|
|
28
|
+
children
|
|
29
|
+
}) });
|
|
30
|
+
}
|
|
31
|
+
function useSidebar() {
|
|
32
|
+
const collapsible = use(CollapsibleContext);
|
|
33
|
+
const { collapsed, setCollapsed } = useSidebar$1();
|
|
34
|
+
return {
|
|
35
|
+
collapsible,
|
|
36
|
+
collapsed,
|
|
37
|
+
setCollapsed
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
function SidebarDrawer({ contentProps }) {
|
|
41
|
+
const { menuItems, props: { aiChat }, slots } = useGlassLayout();
|
|
42
|
+
const { root } = useTreeContext();
|
|
43
|
+
const { setOpen } = useSidebar$1();
|
|
44
|
+
const t = useTranslations();
|
|
45
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(SidebarDrawerOverlay, { className: "fixed z-40 inset-0 bg-fd-overlay backdrop-blur-sm data-[state=open]:animate-fd-fade-in data-[state=closed]:animate-fd-fade-out" }), /* @__PURE__ */ jsx(SidebarDrawerContent, {
|
|
46
|
+
className: "fixed z-40 inset-e-0 inset-y-0 flex flex-col w-[360px] max-w-[calc(100vw-3rem)] border-s bg-fd-background text-fd-foreground shadow-md data-[state=open]:animate-fd-sidebar-in data-[state=closed]:animate-fd-sidebar-out",
|
|
47
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
48
|
+
...contentProps,
|
|
49
|
+
className: cn("flex flex-col px-3 size-full overflow-y-auto fd-scroll-container", contentProps?.className),
|
|
50
|
+
children: [
|
|
51
|
+
/* @__PURE__ */ jsxs("div", {
|
|
52
|
+
className: "sticky flex flex-col gap-2 top-0 py-2 bg-fd-background shadow-lg shadow-fd-background",
|
|
53
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
54
|
+
className: "flex items-center gap-1.5 ps-2.5",
|
|
55
|
+
children: [
|
|
56
|
+
/* @__PURE__ */ jsx(slots.navTitle, { className: "flex text-sm items-center font-semibold gap-2 flex-1" }),
|
|
57
|
+
aiChat && /* @__PURE__ */ jsxs("button", {
|
|
58
|
+
type: "button",
|
|
59
|
+
className: cn(buttonVariants({
|
|
60
|
+
variant: "secondary",
|
|
61
|
+
size: "sm"
|
|
62
|
+
}), "rounded-full h-8 gap-1.5"),
|
|
63
|
+
onClick: () => {
|
|
64
|
+
aiChat.onOpenChange(!aiChat.open);
|
|
65
|
+
setOpen(false);
|
|
66
|
+
},
|
|
67
|
+
children: [/* @__PURE__ */ jsx(MessageCircleIcon, { className: "size-4 text-fd-muted-foreground" }), t("Ask AI", { note: "AI chat button" })]
|
|
68
|
+
}),
|
|
69
|
+
/* @__PURE__ */ jsx("button", {
|
|
70
|
+
type: "button",
|
|
71
|
+
"aria-label": t("Close Sidebar", { note: "aria-label" }),
|
|
72
|
+
onClick: () => setOpen(false),
|
|
73
|
+
className: cn(buttonVariants({
|
|
74
|
+
variant: "secondary",
|
|
75
|
+
size: "icon-sm"
|
|
76
|
+
}), "rounded-full"),
|
|
77
|
+
children: /* @__PURE__ */ jsx(XIcon, {})
|
|
78
|
+
})
|
|
79
|
+
]
|
|
80
|
+
}), slots.languageSelect && /* @__PURE__ */ jsxs(slots.languageSelect.root, {
|
|
81
|
+
variant: "secondary",
|
|
82
|
+
className: "px-2.5 gap-2 rounded-lg",
|
|
83
|
+
children: [
|
|
84
|
+
/* @__PURE__ */ jsx(LanguagesIcon, { className: "size-4 text-fd-muted-foreground shrink-0" }),
|
|
85
|
+
/* @__PURE__ */ jsx(slots.languageSelect.text, {}),
|
|
86
|
+
/* @__PURE__ */ jsx(ChevronsUpDown, { className: "ms-auto size-3.5 text-fd-muted-foreground shrink-0" })
|
|
87
|
+
]
|
|
88
|
+
})]
|
|
89
|
+
}),
|
|
90
|
+
/* @__PURE__ */ jsxs("div", {
|
|
91
|
+
className: "flex flex-col py-2 flex-1",
|
|
92
|
+
children: [menuItems.map((item, i) => item.type !== "icon" && /* @__PURE__ */ jsx(SidebarLinkItem, { item }, i)), root.children.map((item, i) => cloneElement(renderNode(item), { key: i }))]
|
|
93
|
+
}),
|
|
94
|
+
/* @__PURE__ */ jsxs("div", {
|
|
95
|
+
className: "flex items-center sticky bottom-0 bg-fd-background px-1 pt-2 pb-4 border-t mt-2 empty:hidden",
|
|
96
|
+
children: [menuItems.map((item, i) => item.type === "icon" && /* @__PURE__ */ jsx(SidebarIconLinkItem, { item }, i)), slots.themeSwitch && /* @__PURE__ */ jsx(slots.themeSwitch, { className: "p-0 ms-auto" })]
|
|
97
|
+
})
|
|
98
|
+
]
|
|
99
|
+
})
|
|
100
|
+
})] });
|
|
101
|
+
}
|
|
102
|
+
function Sidebar({ className, children, ...props }) {
|
|
103
|
+
const { menuItems, props: { tabs }, slots } = useGlassLayout();
|
|
104
|
+
const { root } = useTreeContext();
|
|
105
|
+
const { collapsible, collapsed, setCollapsed } = useSidebar();
|
|
106
|
+
const t = useTranslations({ note: "sidebar" });
|
|
107
|
+
return /* @__PURE__ */ jsxs("aside", {
|
|
108
|
+
id: "nd-sidebar",
|
|
109
|
+
className: cn("sticky flex flex-col transition-transform [grid-area:left] my-2 ms-2 z-30 top-2 border rounded-2xl bg-fd-popover/80 text-fd-popover-foreground backdrop-blur-sm shadow-sm h-[calc(100dvh---spacing(4))] max-md:hidden md:layout:[--fd-left-width:280px]", collapsed && "w-[calc(280px---spacing(2))] -translate-x-[280px] md:layout:[--fd-left-width:0px]", className),
|
|
110
|
+
...props,
|
|
111
|
+
children: [
|
|
112
|
+
/* @__PURE__ */ jsxs("div", {
|
|
113
|
+
className: "flex items-start gap-1 pt-4 ps-4.5 pe-3.5 empty:hidden",
|
|
114
|
+
children: [/* @__PURE__ */ jsx(slots.navTitle, { className: "flex text-sm items-center font-semibold gap-2 me-auto" }), /* @__PURE__ */ jsxs("div", {
|
|
115
|
+
className: "flex -mt-1.5 -me-1.5 empty:hidden",
|
|
116
|
+
children: [menuItems.map((item, i) => item.type === "icon" && /* @__PURE__ */ jsx(SidebarIconLinkItem, { item }, i)), collapsible && /* @__PURE__ */ jsx("button", {
|
|
117
|
+
"aria-label": collapsed ? t("Show Sidebar") : t("Hide Sidebar"),
|
|
118
|
+
className: cn(buttonVariants({
|
|
119
|
+
variant: "ghost",
|
|
120
|
+
size: "icon-sm"
|
|
121
|
+
}), "text-fd-muted-foreground"),
|
|
122
|
+
onClick: () => setCollapsed(!collapsed),
|
|
123
|
+
children: /* @__PURE__ */ jsx(SidebarIcon, {})
|
|
124
|
+
})]
|
|
125
|
+
})]
|
|
126
|
+
}),
|
|
127
|
+
tabs.length > 0 && /* @__PURE__ */ jsx(LayoutTabsDropdown, {
|
|
128
|
+
tabs,
|
|
129
|
+
className: "min-w-0 bg-fd-secondary text-fd-secondary-foreground rounded-xl px-2.5 py-2 [&_svg]:size-4 border rounded-xl shadow-sm mx-2 mt-2.5 empty:hidden"
|
|
130
|
+
}),
|
|
131
|
+
/* @__PURE__ */ jsx(ScrollArea, {
|
|
132
|
+
className: "min-h-0 flex-1",
|
|
133
|
+
children: /* @__PURE__ */ jsxs(ScrollViewport, {
|
|
134
|
+
className: "flex flex-col p-2 [mask-image:linear-gradient(to_bottom,transparent,white_16px,white_calc(100%-16px),transparent))]",
|
|
135
|
+
children: [menuItems.map((item, i) => item.type !== "icon" && /* @__PURE__ */ jsx(SidebarLinkItem, { item }, i)), root.children.map((item, i) => cloneElement(renderNode(item), { key: i }))]
|
|
136
|
+
})
|
|
137
|
+
}),
|
|
138
|
+
children
|
|
139
|
+
]
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
function SidebarIconLinkItem({ item, className }) {
|
|
143
|
+
return /* @__PURE__ */ jsx(Link, {
|
|
144
|
+
href: item.url,
|
|
145
|
+
external: item.external,
|
|
146
|
+
"aria-label": item.label,
|
|
147
|
+
className: cn(buttonVariants({
|
|
148
|
+
variant: "ghost",
|
|
149
|
+
size: "icon-sm"
|
|
150
|
+
}), "text-fd-muted-foreground", className),
|
|
151
|
+
children: item.icon
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
function SidebarLinkItem({ item, className }) {
|
|
155
|
+
const pathname = usePathname();
|
|
156
|
+
const [open, setOpen] = useState(true);
|
|
157
|
+
switch (item.type) {
|
|
158
|
+
case "custom": return /* @__PURE__ */ jsx("div", {
|
|
159
|
+
className,
|
|
160
|
+
children: item.children
|
|
161
|
+
});
|
|
162
|
+
case "menu": {
|
|
163
|
+
const rightIcon = /* @__PURE__ */ jsx(ChevronDown, { className: cn("ms-auto text-fd-muted-foreground size-3.5! transition-transform", !open && "-rotate-90") });
|
|
164
|
+
return /* @__PURE__ */ jsxs(Collapsible, {
|
|
165
|
+
open,
|
|
166
|
+
onOpenChange: setOpen,
|
|
167
|
+
className: cn("mt-4 first:mt-0", className),
|
|
168
|
+
children: [item.url ? /* @__PURE__ */ jsxs("div", {
|
|
169
|
+
className: "flex w-full text-sm px-2.5 py-1.5 font-medium",
|
|
170
|
+
children: [/* @__PURE__ */ jsxs(Link, {
|
|
171
|
+
href: item.url,
|
|
172
|
+
external: item.external,
|
|
173
|
+
className: cn("inline-flex items-center gap-2 [&_svg]:size-4", isLinkItemActive(item, pathname) ? "text-fd-primary" : "hover:underline hover:decoration-fd-muted-foreground hover:underline-offset-4 hover:decoration-dashed hover:text-fd-accent-foreground"),
|
|
174
|
+
children: [item.icon, item.text]
|
|
175
|
+
}), /* @__PURE__ */ jsx(CollapsibleTrigger, {
|
|
176
|
+
className: "flex-1",
|
|
177
|
+
children: rightIcon
|
|
178
|
+
})]
|
|
179
|
+
}) : /* @__PURE__ */ jsxs(CollapsibleTrigger, {
|
|
180
|
+
className: "w-full text-sm px-2.5 py-1.5 font-medium inline-flex items-center gap-2 [&_svg]:size-4",
|
|
181
|
+
children: [
|
|
182
|
+
item.icon,
|
|
183
|
+
item.text,
|
|
184
|
+
rightIcon
|
|
185
|
+
]
|
|
186
|
+
}), /* @__PURE__ */ jsx(CollapsibleContent, {
|
|
187
|
+
className: "flex flex-col",
|
|
188
|
+
children: item.items.map((item, i) => /* @__PURE__ */ jsx(SidebarLinkItem, { item }, i))
|
|
189
|
+
})]
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
default: return /* @__PURE__ */ jsxs(Link, {
|
|
193
|
+
href: item.url,
|
|
194
|
+
external: item.external,
|
|
195
|
+
className: cn(itemTriggerVariants({
|
|
196
|
+
active: isLinkItemActive(item, pathname),
|
|
197
|
+
className
|
|
198
|
+
})),
|
|
199
|
+
children: [item.icon, item.text]
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
function renderNode(node) {
|
|
204
|
+
if (node.type === "page") return /* @__PURE__ */ jsx(SidebarItem, { item: node });
|
|
205
|
+
if (node.type === "folder") return /* @__PURE__ */ jsx(SidebarFolder, { folder: node });
|
|
206
|
+
return /* @__PURE__ */ jsxs("p", {
|
|
207
|
+
className: "mt-4 w-full text-sm px-2.5 py-1.5 font-medium inline-flex items-center gap-2 [&_svg]:size-4 empty:hidden first:mt-0",
|
|
208
|
+
children: [node.icon, node.name]
|
|
209
|
+
});
|
|
210
|
+
}
|
|
211
|
+
function SidebarItem({ item }) {
|
|
212
|
+
const path = useTreePath();
|
|
213
|
+
return /* @__PURE__ */ jsxs(Link, {
|
|
214
|
+
href: item.url,
|
|
215
|
+
external: item.external,
|
|
216
|
+
className: itemTriggerVariants({ active: isNodeInPath(item, path) }),
|
|
217
|
+
children: [item.icon, item.name]
|
|
218
|
+
});
|
|
219
|
+
}
|
|
220
|
+
function SidebarFolder({ folder }) {
|
|
221
|
+
const path = useTreePath();
|
|
222
|
+
const shouldOpen = (folder.defaultOpen ?? true) || isNodeInPath(folder, path);
|
|
223
|
+
const [open, setOpen] = useState(shouldOpen);
|
|
224
|
+
useOnChange(shouldOpen, () => shouldOpen && setOpen(true));
|
|
225
|
+
if (folder.collapsible === false) return /* @__PURE__ */ jsxs(Fragment, { children: [folder.index ? /* @__PURE__ */ jsxs(Link, {
|
|
226
|
+
href: folder.index.url,
|
|
227
|
+
external: folder.index.external,
|
|
228
|
+
className: cn("inline-flex text-sm px-2.5 py-1.5 font-medium items-center gap-2 [&_svg]:size-4 mt-4 first:mt-0", isNodeInPath(folder.index, path) ? "text-fd-primary" : "hover:underline hover:decoration-fd-muted-foreground hover:underline-offset-4 hover:decoration-dashed hover:text-fd-accent-foreground"),
|
|
229
|
+
children: [folder.icon, folder.name]
|
|
230
|
+
}) : /* @__PURE__ */ jsxs("div", {
|
|
231
|
+
className: "w-full text-sm px-3 py-1.5 font-medium inline-flex items-center gap-2 [&_svg]:size-4 mt-4 first:mt-0",
|
|
232
|
+
children: [folder.icon, folder.name]
|
|
233
|
+
}), folder.children.map((item, i) => cloneElement(renderNode(item), { key: i }))] });
|
|
234
|
+
const rightIcon = /* @__PURE__ */ jsx(ChevronDown, { className: cn("ms-auto text-fd-muted-foreground size-3.5! transition-transform", !open && "-rotate-90") });
|
|
235
|
+
return /* @__PURE__ */ jsxs(Collapsible, {
|
|
236
|
+
open,
|
|
237
|
+
onOpenChange: setOpen,
|
|
238
|
+
className: "mt-4 first:mt-0",
|
|
239
|
+
children: [folder.index ? /* @__PURE__ */ jsxs("div", {
|
|
240
|
+
className: "flex w-full text-sm px-2.5 py-1.5 font-medium",
|
|
241
|
+
children: [/* @__PURE__ */ jsxs(Link, {
|
|
242
|
+
href: folder.index.url,
|
|
243
|
+
external: folder.index.external,
|
|
244
|
+
className: cn("inline-flex items-center gap-2 [&_svg]:size-4", isNodeInPath(folder.index, path) ? "text-fd-primary" : "hover:underline hover:decoration-fd-muted-foreground hover:underline-offset-4 hover:decoration-dashed hover:text-fd-accent-foreground"),
|
|
245
|
+
children: [folder.icon, folder.name]
|
|
246
|
+
}), /* @__PURE__ */ jsx(CollapsibleTrigger, {
|
|
247
|
+
className: "flex-1",
|
|
248
|
+
children: rightIcon
|
|
249
|
+
})]
|
|
250
|
+
}) : /* @__PURE__ */ jsxs(CollapsibleTrigger, {
|
|
251
|
+
className: "w-full text-sm px-2.5 py-1.5 font-medium inline-flex items-center gap-2 [&_svg]:size-4",
|
|
252
|
+
children: [
|
|
253
|
+
folder.icon,
|
|
254
|
+
folder.name,
|
|
255
|
+
rightIcon
|
|
256
|
+
]
|
|
257
|
+
}), /* @__PURE__ */ jsx(CollapsibleContent, {
|
|
258
|
+
className: "flex flex-col",
|
|
259
|
+
children: folder.children.map((item, i) => cloneElement(renderNode(item), { key: i }))
|
|
260
|
+
})]
|
|
261
|
+
});
|
|
262
|
+
}
|
|
263
|
+
function isNodeInPath(node, path) {
|
|
264
|
+
return path.some((other) => other.$id === node.$id || other === node);
|
|
265
|
+
}
|
|
266
|
+
//#endregion
|
|
267
|
+
export { Sidebar, SidebarDrawer, SidebarProvider, useSidebar };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { BaseSlots, BaseSlotsProps } from "../shared/client.js";
|
|
2
|
+
import { BaseLayoutProps, LinkItemType, NavOptions } from "../shared/index.js";
|
|
3
|
+
import { ComponentProps, FC } from "react";
|
|
4
|
+
//#region src/layouts/home/index.d.ts
|
|
5
|
+
interface HomeLayoutProps extends BaseLayoutProps, ComponentProps<'main'> {
|
|
6
|
+
nav?: Nav;
|
|
7
|
+
slots?: Partial<HomeSlots>;
|
|
8
|
+
}
|
|
9
|
+
interface Nav extends NavOptions {
|
|
10
|
+
/**
|
|
11
|
+
* Open mobile menu when hovering the trigger
|
|
12
|
+
*/
|
|
13
|
+
enableHoverToOpen?: boolean;
|
|
14
|
+
}
|
|
15
|
+
interface HomeSlots extends BaseSlots {
|
|
16
|
+
header: FC<ComponentProps<'header'>>;
|
|
17
|
+
container: FC<ComponentProps<'main'>>;
|
|
18
|
+
}
|
|
19
|
+
declare function useHomeLayout(): {
|
|
20
|
+
props: BaseSlotsProps<HomeLayoutProps>;
|
|
21
|
+
navItems: LinkItemType[];
|
|
22
|
+
menuItems: LinkItemType[];
|
|
23
|
+
slots: HomeSlots;
|
|
24
|
+
};
|
|
25
|
+
declare function HomeLayout(props: HomeLayoutProps): import("react").JSX.Element;
|
|
26
|
+
//#endregion
|
|
27
|
+
export { HomeLayout, HomeLayoutProps, HomeSlots, useHomeLayout };
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { baseSlots } from "../shared/client.js";
|
|
3
|
+
import { useLinkItems } from "../shared/index.js";
|
|
4
|
+
import { Container } from "./slots/container.js";
|
|
5
|
+
import { Header } from "./slots/header.js";
|
|
6
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
import { createContext, use } from "react";
|
|
8
|
+
//#region src/layouts/home/index.tsx
|
|
9
|
+
const LayoutContext = createContext(null);
|
|
10
|
+
function useHomeLayout() {
|
|
11
|
+
const context = use(LayoutContext);
|
|
12
|
+
if (!context) throw new Error("Please use this component under <HomeLayout /> (`@vx-oss/docs-react/layouts/home`).");
|
|
13
|
+
return context;
|
|
14
|
+
}
|
|
15
|
+
const { useBaseSlots } = baseSlots({ useProps() {
|
|
16
|
+
return useHomeLayout().props;
|
|
17
|
+
} });
|
|
18
|
+
function HomeLayout(props) {
|
|
19
|
+
const { nav: { enabled: navEnabled = true } = {}, slots: defaultSlots, children, i18n: _i18n, githubUrl: _githubUrl, links: _links, themeSwitch: _themeSwitch, searchToggle: _searchToggle, ...rest } = props;
|
|
20
|
+
const { baseSlots, baseProps } = useBaseSlots(props);
|
|
21
|
+
const linkItems = useLinkItems(props);
|
|
22
|
+
const slots = {
|
|
23
|
+
...baseSlots,
|
|
24
|
+
header: defaultSlots?.header ?? Header,
|
|
25
|
+
container: defaultSlots?.container ?? Container
|
|
26
|
+
};
|
|
27
|
+
return /* @__PURE__ */ jsx(LayoutContext, {
|
|
28
|
+
value: {
|
|
29
|
+
props: baseProps,
|
|
30
|
+
slots,
|
|
31
|
+
...linkItems
|
|
32
|
+
},
|
|
33
|
+
children: /* @__PURE__ */ jsxs(slots.container, {
|
|
34
|
+
...rest,
|
|
35
|
+
children: [navEnabled && /* @__PURE__ */ jsx(slots.header, {}), children]
|
|
36
|
+
})
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
//#endregion
|
|
40
|
+
export { HomeLayout, useHomeLayout };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { NavigationMenuContentProps, NavigationMenuItem, NavigationMenuTriggerProps } from "../../components/ui/navigation-menu.js";
|
|
2
|
+
import { LinkProps } from "@vx-oss/docs-core/link";
|
|
3
|
+
//#region src/layouts/home/navbar.d.ts
|
|
4
|
+
declare const NavbarMenu: typeof NavigationMenuItem;
|
|
5
|
+
declare function NavbarMenuContent(props: NavigationMenuContentProps): import("react").JSX.Element;
|
|
6
|
+
declare function NavbarMenuTrigger(props: NavigationMenuTriggerProps): import("react").JSX.Element;
|
|
7
|
+
declare function NavbarMenuLink(props: LinkProps): import("react").JSX.Element;
|
|
8
|
+
//#endregion
|
|
9
|
+
export { NavbarMenu, NavbarMenuContent, NavbarMenuLink, NavbarMenuTrigger };
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn } from "../../utils/cn.js";
|
|
3
|
+
import { NavigationMenuContent, NavigationMenuItem, NavigationMenuLink, NavigationMenuTrigger } from "../../components/ui/navigation-menu.js";
|
|
4
|
+
import { navItemVariants } from "./slots/header.js";
|
|
5
|
+
import Link from "@vx-oss/docs-core/link";
|
|
6
|
+
import { jsx } from "react/jsx-runtime";
|
|
7
|
+
//#region src/layouts/home/navbar.tsx
|
|
8
|
+
const NavbarMenu = NavigationMenuItem;
|
|
9
|
+
function NavbarMenuContent(props) {
|
|
10
|
+
return /* @__PURE__ */ jsx(NavigationMenuContent, {
|
|
11
|
+
...props,
|
|
12
|
+
className: cn("grid grid-cols-1 gap-2 p-4 md:grid-cols-2 lg:grid-cols-3", props.className),
|
|
13
|
+
children: props.children
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
function NavbarMenuTrigger(props) {
|
|
17
|
+
return /* @__PURE__ */ jsx(NavigationMenuTrigger, {
|
|
18
|
+
...props,
|
|
19
|
+
className: cn(navItemVariants(), "text-sm rounded-md", props.className),
|
|
20
|
+
children: props.children
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
function NavbarMenuLink(props) {
|
|
24
|
+
return /* @__PURE__ */ jsx(NavigationMenuLink, {
|
|
25
|
+
asChild: true,
|
|
26
|
+
children: /* @__PURE__ */ jsx(Link, {
|
|
27
|
+
...props,
|
|
28
|
+
className: cn("flex flex-col gap-2 rounded-lg border bg-fd-card p-3 transition-colors hover:bg-fd-accent/80 hover:text-fd-accent-foreground", props.className),
|
|
29
|
+
children: props.children
|
|
30
|
+
})
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
//#endregion
|
|
34
|
+
export { NavbarMenu, NavbarMenuContent, NavbarMenuLink, NavbarMenuTrigger };
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn } from "../../utils/cn.js";
|
|
3
|
+
import { buttonVariants } from "../../components/ui/button.js";
|
|
4
|
+
import Link from "@vx-oss/docs-core/link";
|
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
import { HomeIcon } from "lucide-react";
|
|
7
|
+
import { useTranslations } from "@fuma-translate/react";
|
|
8
|
+
//#region src/layouts/home/not-found.tsx
|
|
9
|
+
/**
|
|
10
|
+
* the default not found page content, please make your own if you want to customize it.
|
|
11
|
+
*/
|
|
12
|
+
function DefaultNotFound() {
|
|
13
|
+
const t = useTranslations({ note: "404 page" });
|
|
14
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
15
|
+
className: "flex flex-col px-8 justify-center flex-1 text-center items-center gap-4",
|
|
16
|
+
children: [
|
|
17
|
+
/* @__PURE__ */ jsx("h1", {
|
|
18
|
+
className: "text-6xl font-bold text-fd-muted-foreground",
|
|
19
|
+
children: "404"
|
|
20
|
+
}),
|
|
21
|
+
/* @__PURE__ */ jsx("h2", {
|
|
22
|
+
className: "text-2xl font-semibold",
|
|
23
|
+
children: t("Page Not Found")
|
|
24
|
+
}),
|
|
25
|
+
/* @__PURE__ */ jsx("p", {
|
|
26
|
+
className: "text-fd-muted-foreground max-w-md",
|
|
27
|
+
children: t("The page you are looking for might have been removed, had its name changed, or is temporarily unavailable.")
|
|
28
|
+
}),
|
|
29
|
+
/* @__PURE__ */ jsxs(Link, {
|
|
30
|
+
href: "/",
|
|
31
|
+
className: cn(buttonVariants({
|
|
32
|
+
className: "mt-4 gap-1.5",
|
|
33
|
+
variant: "primary"
|
|
34
|
+
})),
|
|
35
|
+
children: [/* @__PURE__ */ jsx(HomeIcon, { className: "size-4" }), t("Back to Home")]
|
|
36
|
+
})
|
|
37
|
+
]
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
//#endregion
|
|
41
|
+
export { DefaultNotFound };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn } from "../../../utils/cn.js";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
//#region src/layouts/home/slots/container.tsx
|
|
5
|
+
function Container(props) {
|
|
6
|
+
return /* @__PURE__ */ jsx("main", {
|
|
7
|
+
id: "nd-home-layout",
|
|
8
|
+
...props,
|
|
9
|
+
className: cn("flex flex-1 flex-col [--fd-layout-width:1400px]", props.className)
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
//#endregion
|
|
13
|
+
export { Container };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ComponentProps } from "react";
|
|
2
|
+
//#region src/layouts/home/slots/header.d.ts
|
|
3
|
+
declare const navItemVariants: (props?: ({
|
|
4
|
+
variant?: "main" | "icon" | "button" | null | undefined;
|
|
5
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
6
|
+
declare function Header(props: ComponentProps<'header'>): string | number | bigint | true | import("react").JSX.Element | Iterable<import("react").ReactNode> | Promise<string | number | bigint | boolean | import("react").ReactPortal | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<import("react").ReactNode> | null | undefined>;
|
|
7
|
+
//#endregion
|
|
8
|
+
export { Header, navItemVariants };
|