opin-ui 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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/home.css +1 -0
- package/css/generated/notebook.css +1 -0
- package/css/generated/shared.css +1 -0
- package/css/lib/base.css +314 -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 +75 -0
- package/css/style.css +9 -0
- package/css/vitepress.css +65 -0
- package/dist/.translations/index.d.ts +49 -0
- package/dist/.translations/keys.js +49 -0
- package/dist/_virtual/_rolldown/runtime.js +13 -0
- package/dist/components/accordion.d.ts +23 -0
- package/dist/components/accordion.js +68 -0
- package/dist/components/banner.d.ts +33 -0
- package/dist/components/banner.js +85 -0
- package/dist/components/callout.d.ts +41 -0
- package/dist/components/callout.js +53 -0
- package/dist/components/card.d.ts +19 -0
- package/dist/components/card.js +38 -0
- package/dist/components/codeblock.d.ts +61 -0
- package/dist/components/codeblock.js +173 -0
- package/dist/components/codeblock.rsc.d.ts +20 -0
- package/dist/components/codeblock.rsc.js +22 -0
- package/dist/components/dialog/search-algolia.d.ts +36 -0
- package/dist/components/dialog/search-algolia.js +64 -0
- package/dist/components/dialog/search-default.d.ts +36 -0
- package/dist/components/dialog/search-default.js +58 -0
- package/dist/components/dialog/search-orama.d.ts +43 -0
- package/dist/components/dialog/search-orama.js +69 -0
- package/dist/components/dialog/search.d.ts +112 -0
- package/dist/components/dialog/search.js +350 -0
- package/dist/components/dynamic-codeblock.core.d.ts +34 -0
- package/dist/components/dynamic-codeblock.core.js +51 -0
- package/dist/components/dynamic-codeblock.d.ts +9 -0
- package/dist/components/dynamic-codeblock.js +17 -0
- package/dist/components/files.d.ts +34 -0
- package/dist/components/files.js +40 -0
- package/dist/components/github-info.d.ts +35 -0
- package/dist/components/github-info.js +75 -0
- package/dist/components/heading.d.ts +13 -0
- package/dist/components/heading.js +38 -0
- package/dist/components/image-zoom.d.ts +23 -0
- package/dist/components/image-zoom.js +32 -0
- package/dist/components/image-zoom2.css +71 -0
- package/dist/components/inline-toc.d.ts +14 -0
- package/dist/components/inline-toc.js +28 -0
- package/dist/components/sidebar/base.d.ts +131 -0
- package/dist/components/sidebar/base.js +274 -0
- package/dist/components/sidebar/link-item.d.ts +22 -0
- package/dist/components/sidebar/link-item.js +38 -0
- package/dist/components/sidebar/page-tree.d.ts +28 -0
- package/dist/components/sidebar/page-tree.js +71 -0
- package/dist/components/sidebar/tabs/dropdown.d.ts +16 -0
- package/dist/components/sidebar/tabs/dropdown.js +71 -0
- package/dist/components/sidebar/tabs/index.d.ts +11 -0
- package/dist/components/sidebar/tabs/index.js +46 -0
- package/dist/components/steps.d.ts +15 -0
- package/dist/components/steps.js +16 -0
- package/dist/components/tabs.d.ts +49 -0
- package/dist/components/tabs.js +88 -0
- package/dist/components/toc/clerk.d.ts +20 -0
- package/dist/components/toc/clerk.js +226 -0
- package/dist/components/toc/default.d.ts +23 -0
- package/dist/components/toc/default.js +259 -0
- package/dist/components/toc/index.d.ts +19 -0
- package/dist/components/toc/index.js +45 -0
- package/dist/components/type-table.d.ts +43 -0
- package/dist/components/type-table.js +117 -0
- package/dist/components/ui/accordion.d.ts +30 -0
- package/dist/components/ui/accordion.js +42 -0
- package/dist/components/ui/button.d.ts +11 -0
- package/dist/components/ui/button.js +20 -0
- package/dist/components/ui/collapsible.d.ts +15 -0
- package/dist/components/ui/collapsible.js +21 -0
- package/dist/components/ui/navigation-menu.d.ts +30 -0
- package/dist/components/ui/navigation-menu.js +41 -0
- package/dist/components/ui/popover.d.ts +15 -0
- package/dist/components/ui/popover.js +20 -0
- package/dist/components/ui/scroll-area.d.ts +22 -0
- package/dist/components/ui/scroll-area.js +34 -0
- package/dist/components/ui/tabs.d.ts +36 -0
- package/dist/components/ui/tabs.js +77 -0
- package/dist/contexts/i18n.d.ts +41 -0
- package/dist/contexts/i18n.js +37 -0
- package/dist/contexts/search.d.ts +73 -0
- package/dist/contexts/search.js +68 -0
- package/dist/contexts/tree.d.ts +20 -0
- package/dist/contexts/tree.js +38 -0
- package/dist/i18n.d.ts +16 -0
- package/dist/i18n.js +38 -0
- package/dist/layouts/docs/client.d.ts +34 -0
- package/dist/layouts/docs/client.js +92 -0
- package/dist/layouts/docs/index.d.ts +44 -0
- package/dist/layouts/docs/index.js +22 -0
- package/dist/layouts/docs/page/index.d.ts +115 -0
- package/dist/layouts/docs/page/index.js +124 -0
- package/dist/layouts/docs/page/slots/breadcrumb.d.ts +13 -0
- package/dist/layouts/docs/page/slots/breadcrumb.js +44 -0
- package/dist/layouts/docs/page/slots/container.d.ts +6 -0
- package/dist/layouts/docs/page/slots/container.js +17 -0
- package/dist/layouts/docs/page/slots/footer.d.ts +22 -0
- package/dist/layouts/docs/page/slots/footer.js +56 -0
- package/dist/layouts/docs/page/slots/toc.d.ts +62 -0
- package/dist/layouts/docs/page/slots/toc.js +182 -0
- package/dist/layouts/docs/slots/container.d.ts +6 -0
- package/dist/layouts/docs/slots/container.js +36 -0
- package/dist/layouts/docs/slots/header.d.ts +6 -0
- package/dist/layouts/docs/slots/header.js +38 -0
- package/dist/layouts/docs/slots/sidebar.d.ts +29 -0
- package/dist/layouts/docs/slots/sidebar.js +326 -0
- package/dist/layouts/flux/index.d.ts +73 -0
- package/dist/layouts/flux/index.js +146 -0
- package/dist/layouts/flux/page/index.d.ts +102 -0
- package/dist/layouts/flux/page/index.js +104 -0
- package/dist/layouts/flux/page/slots/breadcrumb.d.ts +13 -0
- package/dist/layouts/flux/page/slots/breadcrumb.js +44 -0
- package/dist/layouts/flux/page/slots/container.d.ts +6 -0
- package/dist/layouts/flux/page/slots/container.js +17 -0
- package/dist/layouts/flux/page/slots/footer.d.ts +22 -0
- package/dist/layouts/flux/page/slots/footer.js +56 -0
- package/dist/layouts/flux/page/slots/toc.d.ts +38 -0
- package/dist/layouts/flux/page/slots/toc.js +181 -0
- package/dist/layouts/flux/slots/container.d.ts +6 -0
- package/dist/layouts/flux/slots/container.js +13 -0
- package/dist/layouts/flux/slots/sidebar.d.ts +22 -0
- package/dist/layouts/flux/slots/sidebar.js +237 -0
- package/dist/layouts/flux/slots/tab-dropdown.d.ts +16 -0
- package/dist/layouts/flux/slots/tab-dropdown.js +85 -0
- package/dist/layouts/home/index.d.ts +28 -0
- package/dist/layouts/home/index.js +40 -0
- package/dist/layouts/home/navbar.d.ts +10 -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 +6 -0
- package/dist/layouts/home/slots/container.js +13 -0
- package/dist/layouts/home/slots/header.d.ts +9 -0
- package/dist/layouts/home/slots/header.js +239 -0
- package/dist/layouts/notebook/client.d.ts +36 -0
- package/dist/layouts/notebook/client.js +69 -0
- package/dist/layouts/notebook/index.d.ts +37 -0
- package/dist/layouts/notebook/index.js +22 -0
- package/dist/layouts/notebook/page/index.d.ts +115 -0
- package/dist/layouts/notebook/page/index.js +124 -0
- package/dist/layouts/notebook/page/slots/breadcrumb.d.ts +13 -0
- package/dist/layouts/notebook/page/slots/breadcrumb.js +44 -0
- package/dist/layouts/notebook/page/slots/container.d.ts +6 -0
- package/dist/layouts/notebook/page/slots/container.js +17 -0
- package/dist/layouts/notebook/page/slots/footer.d.ts +22 -0
- package/dist/layouts/notebook/page/slots/footer.js +56 -0
- package/dist/layouts/notebook/page/slots/toc.d.ts +62 -0
- package/dist/layouts/notebook/page/slots/toc.js +181 -0
- package/dist/layouts/notebook/slots/container.d.ts +6 -0
- package/dist/layouts/notebook/slots/container.js +38 -0
- package/dist/layouts/notebook/slots/header.d.ts +6 -0
- package/dist/layouts/notebook/slots/header.js +194 -0
- package/dist/layouts/notebook/slots/sidebar.d.ts +30 -0
- package/dist/layouts/notebook/slots/sidebar.js +298 -0
- package/dist/layouts/shared/client.d.ts +44 -0
- package/dist/layouts/shared/client.js +84 -0
- package/dist/layouts/shared/index.d.ts +178 -0
- package/dist/layouts/shared/index.js +98 -0
- package/dist/layouts/shared/page-actions.d.ts +35 -0
- package/dist/layouts/shared/page-actions.js +195 -0
- package/dist/layouts/shared/slots/language-select.d.ts +18 -0
- package/dist/layouts/shared/slots/language-select.js +43 -0
- package/dist/layouts/shared/slots/search-trigger.d.ts +22 -0
- package/dist/layouts/shared/slots/search-trigger.js +53 -0
- package/dist/layouts/shared/slots/theme-switch.d.ts +13 -0
- package/dist/layouts/shared/slots/theme-switch.js +65 -0
- package/dist/legacy/layout.d.ts +36 -0
- package/dist/legacy/layout.js +44 -0
- package/dist/legacy/sidebar.d.ts +17 -0
- package/dist/legacy/sidebar.js +33 -0
- package/dist/mdx.d.ts +45 -0
- package/dist/mdx.js +70 -0
- package/dist/mdx.server.d.ts +15 -0
- package/dist/mdx.server.js +20 -0
- package/dist/node_modules/.bun/react-medium-image-zoom@5.4.8_7492c01c6988791b/node_modules/react-medium-image-zoom/dist/controlled.d.ts +31 -0
- package/dist/node_modules/.bun/react-medium-image-zoom@5.4.8_7492c01c6988791b/node_modules/react-medium-image-zoom/dist/controlled.js +461 -0
- package/dist/node_modules/.bun/react-medium-image-zoom@5.4.8_7492c01c6988791b/node_modules/react-medium-image-zoom/dist/index.d.ts +2 -0
- package/dist/node_modules/.bun/react-medium-image-zoom@5.4.8_7492c01c6988791b/node_modules/react-medium-image-zoom/dist/uncontrolled.d.ts +7 -0
- package/dist/node_modules/.bun/react-medium-image-zoom@5.4.8_7492c01c6988791b/node_modules/react-medium-image-zoom/dist/uncontrolled.js +17 -0
- package/dist/node_modules/.bun/react-medium-image-zoom@5.4.8_7492c01c6988791b/node_modules/react-medium-image-zoom/dist/utils/adjust-svg-ids.js +53 -0
- package/dist/node_modules/.bun/react-medium-image-zoom@5.4.8_7492c01c6988791b/node_modules/react-medium-image-zoom/dist/utils/compute-positioned-style.js +25 -0
- package/dist/node_modules/.bun/react-medium-image-zoom@5.4.8_7492c01c6988791b/node_modules/react-medium-image-zoom/dist/utils/element-tests.js +12 -0
- package/dist/node_modules/.bun/react-medium-image-zoom@5.4.8_7492c01c6988791b/node_modules/react-medium-image-zoom/dist/utils/get-div-img-style.js +45 -0
- package/dist/node_modules/.bun/react-medium-image-zoom@5.4.8_7492c01c6988791b/node_modules/react-medium-image-zoom/dist/utils/get-img-alt.js +8 -0
- package/dist/node_modules/.bun/react-medium-image-zoom@5.4.8_7492c01c6988791b/node_modules/react-medium-image-zoom/dist/utils/get-img-object-fit-style.js +55 -0
- package/dist/node_modules/.bun/react-medium-image-zoom@5.4.8_7492c01c6988791b/node_modules/react-medium-image-zoom/dist/utils/get-img-regular-style.js +21 -0
- package/dist/node_modules/.bun/react-medium-image-zoom@5.4.8_7492c01c6988791b/node_modules/react-medium-image-zoom/dist/utils/get-img-src.js +14 -0
- package/dist/node_modules/.bun/react-medium-image-zoom@5.4.8_7492c01c6988791b/node_modules/react-medium-image-zoom/dist/utils/get-modal-img-transform.js +22 -0
- package/dist/node_modules/.bun/react-medium-image-zoom@5.4.8_7492c01c6988791b/node_modules/react-medium-image-zoom/dist/utils/get-scale.js +27 -0
- package/dist/node_modules/.bun/react-medium-image-zoom@5.4.8_7492c01c6988791b/node_modules/react-medium-image-zoom/dist/utils/get-style-ghost.js +31 -0
- package/dist/node_modules/.bun/react-medium-image-zoom@5.4.8_7492c01c6988791b/node_modules/react-medium-image-zoom/dist/utils/get-style-modal-img.js +75 -0
- package/dist/node_modules/.bun/react-medium-image-zoom@5.4.8_7492c01c6988791b/node_modules/react-medium-image-zoom/dist/utils/get-target-dimension.js +4 -0
- package/dist/node_modules/.bun/react-medium-image-zoom@5.4.8_7492c01c6988791b/node_modules/react-medium-image-zoom/dist/utils/parse-position.js +7 -0
- package/dist/node_modules/.bun/react-medium-image-zoom@5.4.8_7492c01c6988791b/node_modules/react-medium-image-zoom/dist/utils/test-has-scalable-src.js +5 -0
- package/dist/og/takumi.d.ts +21 -0
- package/dist/og/takumi.js +91 -0
- package/dist/og.d.ts +22 -0
- package/dist/og.js +91 -0
- package/dist/page.d.ts +35 -0
- package/dist/page.js +33 -0
- package/dist/provider/base.d.ts +49 -0
- package/dist/provider/base.js +32 -0
- package/dist/provider/next.d.ts +20 -0
- package/dist/provider/next.js +17 -0
- package/dist/provider/react-router.d.ts +20 -0
- package/dist/provider/react-router.js +17 -0
- package/dist/provider/tanstack.d.ts +20 -0
- package/dist/provider/tanstack.js +17 -0
- package/dist/provider/waku.d.ts +20 -0
- package/dist/provider/waku.js +17 -0
- package/dist/style.css +3534 -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 +6 -0
- package/dist/utils/use-copy-button.js +26 -0
- package/dist/utils/use-footer-items.d.ts +9 -0
- package/dist/utils/use-footer-items.js +24 -0
- package/dist/utils/use-is-scroll-top.d.ts +8 -0
- package/dist/utils/use-is-scroll-top.js +20 -0
- package/package.json +200 -0
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn } from "../../utils/cn.js";
|
|
3
|
+
import { TreeContextProvider } from "../../contexts/tree.js";
|
|
4
|
+
import { baseSlots } from "../shared/client.js";
|
|
5
|
+
import { isLayoutTabActive, useLinkItems } from "../shared/index.js";
|
|
6
|
+
import { useIsScrollTop } from "../../utils/use-is-scroll-top.js";
|
|
7
|
+
import { Sidebar, SidebarProvider, SidebarTrigger, useSidebar } from "./slots/sidebar.js";
|
|
8
|
+
import { Header } from "./slots/header.js";
|
|
9
|
+
import { Container } from "./slots/container.js";
|
|
10
|
+
import Link from "fumadocs-core/link";
|
|
11
|
+
import { usePathname } from "fumadocs-core/framework";
|
|
12
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
13
|
+
import { createContext, use, useMemo } from "react";
|
|
14
|
+
//#region src/layouts/docs/client.tsx
|
|
15
|
+
const { useProvider } = baseSlots({ useProps() {
|
|
16
|
+
return useDocsLayout().props;
|
|
17
|
+
} });
|
|
18
|
+
const LayoutContext = createContext(null);
|
|
19
|
+
function useIsDocsLayout() {
|
|
20
|
+
return use(LayoutContext) !== null;
|
|
21
|
+
}
|
|
22
|
+
function useDocsLayout() {
|
|
23
|
+
const context = use(LayoutContext);
|
|
24
|
+
if (!context) throw new Error("Please use <DocsPage /> (`opin-ui/layouts/docs/page`) under <DocsLayout /> (`opin-ui/layouts/docs`).");
|
|
25
|
+
return context;
|
|
26
|
+
}
|
|
27
|
+
function LayoutBody(props) {
|
|
28
|
+
const { nav: { enabled: navEnabled = true, transparentMode: navTransparentMode = "none" } = {}, sidebar: { enabled: sidebarEnabled = true, defaultOpenLevel, prefetch, ...sidebarProps } = {}, slots: defaultSlots, tabs, tabMode = "auto", tree, containerProps, children } = props;
|
|
29
|
+
const isTop = useIsScrollTop({ enabled: navTransparentMode === "top" }) ?? true;
|
|
30
|
+
const isNavTransparent = navTransparentMode === "top" ? isTop : navTransparentMode === "always";
|
|
31
|
+
const { baseSlots, baseProps } = useProvider(props);
|
|
32
|
+
const linkItems = useLinkItems(props);
|
|
33
|
+
const slots = {
|
|
34
|
+
...baseSlots,
|
|
35
|
+
header: defaultSlots?.header ?? Header,
|
|
36
|
+
container: defaultSlots?.container ?? Container,
|
|
37
|
+
sidebar: defaultSlots?.sidebar ?? {
|
|
38
|
+
provider: SidebarProvider,
|
|
39
|
+
root: Sidebar,
|
|
40
|
+
trigger: SidebarTrigger,
|
|
41
|
+
useSidebar
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
return /* @__PURE__ */ jsx(TreeContextProvider, {
|
|
45
|
+
tree,
|
|
46
|
+
children: /* @__PURE__ */ jsx(LayoutContext, {
|
|
47
|
+
value: {
|
|
48
|
+
props: {
|
|
49
|
+
tabMode,
|
|
50
|
+
tabs,
|
|
51
|
+
...baseProps
|
|
52
|
+
},
|
|
53
|
+
isNavTransparent,
|
|
54
|
+
slots,
|
|
55
|
+
...linkItems
|
|
56
|
+
},
|
|
57
|
+
children: /* @__PURE__ */ jsx(slots.sidebar.provider, {
|
|
58
|
+
defaultOpenLevel,
|
|
59
|
+
prefetch,
|
|
60
|
+
children: /* @__PURE__ */ jsxs(slots.container, {
|
|
61
|
+
...containerProps,
|
|
62
|
+
children: [
|
|
63
|
+
navEnabled && /* @__PURE__ */ jsx(slots.header, {}),
|
|
64
|
+
sidebarEnabled && /* @__PURE__ */ jsx(slots.sidebar.root, { ...sidebarProps }),
|
|
65
|
+
tabMode === "top" && tabs.length > 0 && /* @__PURE__ */ jsx(LayoutTabs, {
|
|
66
|
+
tabs,
|
|
67
|
+
className: "z-10 bg-fd-background border-b px-6 pt-3 xl:px-8 max-md:hidden"
|
|
68
|
+
}),
|
|
69
|
+
children
|
|
70
|
+
]
|
|
71
|
+
})
|
|
72
|
+
})
|
|
73
|
+
})
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
function LayoutTabs({ tabs, ...props }) {
|
|
77
|
+
const pathname = usePathname();
|
|
78
|
+
const selected = useMemo(() => {
|
|
79
|
+
return tabs.findLast((option) => isLayoutTabActive(option, pathname));
|
|
80
|
+
}, [tabs, pathname]);
|
|
81
|
+
return /* @__PURE__ */ jsx("div", {
|
|
82
|
+
...props,
|
|
83
|
+
className: cn("flex flex-row items-end gap-6 overflow-auto [grid-area:main]", props.className),
|
|
84
|
+
children: tabs.map((tab, i) => /* @__PURE__ */ jsx(Link, {
|
|
85
|
+
href: tab.url,
|
|
86
|
+
className: cn("inline-flex border-b-2 border-transparent transition-colors items-center pb-1.5 font-medium gap-2 text-fd-muted-foreground text-sm text-nowrap hover:text-fd-accent-foreground", tab.unlisted && selected !== tab && "hidden", selected === tab && "border-fd-primary text-fd-primary"),
|
|
87
|
+
children: tab.title
|
|
88
|
+
}, i))
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
//#endregion
|
|
92
|
+
export { LayoutBody, useDocsLayout, useIsDocsLayout };
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { BaseLayoutProps, GetLayoutTabsOptions, LayoutTab } from "../shared/index.js";
|
|
2
|
+
import { SidebarProps, SidebarProviderProps } from "./slots/sidebar.js";
|
|
3
|
+
import { DocsSlots, useDocsLayout } from "./client.js";
|
|
4
|
+
import { HTMLAttributes, ReactNode } from "react";
|
|
5
|
+
import * as PageTree from "fumadocs-core/page-tree";
|
|
6
|
+
|
|
7
|
+
//#region src/layouts/docs/index.d.ts
|
|
8
|
+
interface DocsLayoutProps extends BaseLayoutProps {
|
|
9
|
+
tree: PageTree.Root;
|
|
10
|
+
sidebar?: SidebarOptions;
|
|
11
|
+
tabMode?: 'top' | 'auto';
|
|
12
|
+
tabs?: LayoutTab[] | GetLayoutTabsOptions | false;
|
|
13
|
+
containerProps?: HTMLAttributes<HTMLDivElement>;
|
|
14
|
+
slots?: Partial<DocsSlots>;
|
|
15
|
+
}
|
|
16
|
+
interface SidebarOptions extends SidebarProps, SidebarProviderProps {
|
|
17
|
+
enabled?: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* @deprecated use `slots.sidebar` instead.
|
|
20
|
+
*/
|
|
21
|
+
component?: ReactNode;
|
|
22
|
+
/**
|
|
23
|
+
* @deprecated use layout-level `tabMode` option instead.
|
|
24
|
+
*/
|
|
25
|
+
tabMode?: 'auto' | 'top';
|
|
26
|
+
/**
|
|
27
|
+
* @deprecated use layout-level `tabs` option instead.
|
|
28
|
+
*/
|
|
29
|
+
tabs?: LayoutTab[] | GetLayoutTabsOptions | false;
|
|
30
|
+
}
|
|
31
|
+
declare function DocsLayout({
|
|
32
|
+
tree,
|
|
33
|
+
sidebar: {
|
|
34
|
+
tabs: _tabs,
|
|
35
|
+
tabMode: _tabMode,
|
|
36
|
+
...sidebarProps
|
|
37
|
+
},
|
|
38
|
+
tabs: layoutTabs,
|
|
39
|
+
tabMode,
|
|
40
|
+
children,
|
|
41
|
+
...props
|
|
42
|
+
}: DocsLayoutProps): import("react").JSX.Element;
|
|
43
|
+
//#endregion
|
|
44
|
+
export { DocsLayout, DocsLayoutProps, type DocsSlots, useDocsLayout };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { getLayoutTabs } from "../shared/index.js";
|
|
2
|
+
import { LayoutBody, useDocsLayout } from "./client.js";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
import { useMemo } from "react";
|
|
5
|
+
//#region src/layouts/docs/index.tsx
|
|
6
|
+
function DocsLayout({ tree, sidebar: { tabs: _tabs, tabMode: _tabMode, ...sidebarProps } = {}, tabs: layoutTabs = _tabs, tabMode = _tabMode, children, ...props }) {
|
|
7
|
+
return /* @__PURE__ */ jsx(LayoutBody, {
|
|
8
|
+
tree,
|
|
9
|
+
tabs: useMemo(() => {
|
|
10
|
+
if (Array.isArray(layoutTabs)) return layoutTabs;
|
|
11
|
+
if (typeof layoutTabs === "object") return getLayoutTabs(tree, layoutTabs);
|
|
12
|
+
if (layoutTabs !== false) return getLayoutTabs(tree);
|
|
13
|
+
return [];
|
|
14
|
+
}, [tree, layoutTabs]),
|
|
15
|
+
tabMode,
|
|
16
|
+
sidebar: sidebarProps,
|
|
17
|
+
...props,
|
|
18
|
+
children
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
//#endregion
|
|
22
|
+
export { DocsLayout, useDocsLayout };
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { TOCPopoverProps, TOCProps, TOCProviderProps } from "./slots/toc.js";
|
|
2
|
+
import { Footer, FooterProps } from "./slots/footer.js";
|
|
3
|
+
import { Breadcrumb, BreadcrumbProps } from "./slots/breadcrumb.js";
|
|
4
|
+
import { MarkdownCopyButton, ViewOptionsPopover } from "../../shared/page-actions.js";
|
|
5
|
+
import { ComponentProps, FC, ReactNode } from "react";
|
|
6
|
+
import { TOCItemType } from "fumadocs-core/toc";
|
|
7
|
+
|
|
8
|
+
//#region src/layouts/docs/page/index.d.ts
|
|
9
|
+
interface DocsPageProps extends ComponentProps<'article'> {
|
|
10
|
+
toc?: TOCItemType[];
|
|
11
|
+
/**
|
|
12
|
+
* Extend the page to fill all available space
|
|
13
|
+
*
|
|
14
|
+
* @defaultValue false
|
|
15
|
+
*/
|
|
16
|
+
full?: boolean | undefined;
|
|
17
|
+
slots?: Partial<DocsPageSlots>;
|
|
18
|
+
footer?: FooterOptions;
|
|
19
|
+
breadcrumb?: BreadcrumbOptions;
|
|
20
|
+
tableOfContent?: TableOfContentOptions;
|
|
21
|
+
tableOfContentPopover?: TableOfContentPopoverOptions;
|
|
22
|
+
}
|
|
23
|
+
interface BreadcrumbOptions extends BreadcrumbProps {
|
|
24
|
+
enabled?: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* @deprecated use `slots.breadcrumb` instead.
|
|
27
|
+
*/
|
|
28
|
+
component?: ReactNode;
|
|
29
|
+
}
|
|
30
|
+
interface FooterOptions extends FooterProps {
|
|
31
|
+
enabled?: boolean;
|
|
32
|
+
/**
|
|
33
|
+
* @deprecated use `slots.footer` instead.
|
|
34
|
+
*/
|
|
35
|
+
component?: ReactNode;
|
|
36
|
+
}
|
|
37
|
+
type TableOfContentOptions = Pick<TOCProviderProps, 'single'> & TOCProps & {
|
|
38
|
+
enabled?: boolean;
|
|
39
|
+
/**
|
|
40
|
+
* @deprecated use `slots.toc` instead.
|
|
41
|
+
*/
|
|
42
|
+
component?: ReactNode;
|
|
43
|
+
};
|
|
44
|
+
type TableOfContentPopoverOptions = TOCPopoverProps & {
|
|
45
|
+
enabled?: boolean;
|
|
46
|
+
/**
|
|
47
|
+
* @deprecated use `slots.tocPopover` instead.
|
|
48
|
+
*/
|
|
49
|
+
component?: ReactNode;
|
|
50
|
+
};
|
|
51
|
+
interface DocsPageSlots {
|
|
52
|
+
toc: {
|
|
53
|
+
provider: FC<TOCProviderProps>;
|
|
54
|
+
main: FC<TOCProps>;
|
|
55
|
+
popover: FC<TOCPopoverProps>;
|
|
56
|
+
};
|
|
57
|
+
container: FC<ComponentProps<'article'>>;
|
|
58
|
+
footer: FC<FooterProps>;
|
|
59
|
+
breadcrumb: FC<BreadcrumbProps>;
|
|
60
|
+
}
|
|
61
|
+
declare function useDocsPage(): {
|
|
62
|
+
full: NonNullable<DocsPageProps["full"]>;
|
|
63
|
+
slots: DocsPageSlots;
|
|
64
|
+
};
|
|
65
|
+
declare function DocsPage({
|
|
66
|
+
full,
|
|
67
|
+
tableOfContent: {
|
|
68
|
+
enabled: tocEnabled,
|
|
69
|
+
single,
|
|
70
|
+
...tocProps
|
|
71
|
+
},
|
|
72
|
+
tableOfContentPopover: {
|
|
73
|
+
enabled: tocPopoverEnabled,
|
|
74
|
+
...tocPopoverProps
|
|
75
|
+
},
|
|
76
|
+
breadcrumb: {
|
|
77
|
+
enabled: breadcrumbEnabled,
|
|
78
|
+
...breadcrumb
|
|
79
|
+
},
|
|
80
|
+
footer: {
|
|
81
|
+
enabled: footerEnabled,
|
|
82
|
+
...footer
|
|
83
|
+
},
|
|
84
|
+
toc,
|
|
85
|
+
slots: defaultSlots,
|
|
86
|
+
children,
|
|
87
|
+
...containerProps
|
|
88
|
+
}: DocsPageProps): import("react").JSX.Element;
|
|
89
|
+
declare function EditOnGitHub(props: ComponentProps<'a'>): import("react").JSX.Element;
|
|
90
|
+
/**
|
|
91
|
+
* Add typography styles
|
|
92
|
+
*/
|
|
93
|
+
declare function DocsBody({
|
|
94
|
+
children,
|
|
95
|
+
className,
|
|
96
|
+
...props
|
|
97
|
+
}: ComponentProps<'div'>): import("react").JSX.Element;
|
|
98
|
+
declare function DocsDescription({
|
|
99
|
+
children,
|
|
100
|
+
className,
|
|
101
|
+
...props
|
|
102
|
+
}: ComponentProps<'p'>): import("react").JSX.Element | null;
|
|
103
|
+
declare function DocsTitle({
|
|
104
|
+
children,
|
|
105
|
+
className,
|
|
106
|
+
...props
|
|
107
|
+
}: ComponentProps<'h1'>): import("react").JSX.Element;
|
|
108
|
+
declare function PageLastUpdate({
|
|
109
|
+
date: value,
|
|
110
|
+
...props
|
|
111
|
+
}: Omit<ComponentProps<'p'>, 'children'> & {
|
|
112
|
+
date: Date;
|
|
113
|
+
}): import("react").JSX.Element;
|
|
114
|
+
//#endregion
|
|
115
|
+
export { type BreadcrumbProps, DocsBody, DocsDescription, DocsPage, DocsPageProps, DocsTitle, EditOnGitHub, type FooterProps, MarkdownCopyButton, Breadcrumb as PageBreadcrumb, Footer as PageFooter, PageLastUpdate, ViewOptionsPopover, useDocsPage };
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { __exportAll } from "../../../_virtual/_rolldown/runtime.js";
|
|
3
|
+
import { cn } from "../../../utils/cn.js";
|
|
4
|
+
import { buttonVariants } from "../../../components/ui/button.js";
|
|
5
|
+
import { TOC, TOCPopover, TOCProvider } from "./slots/toc.js";
|
|
6
|
+
import { Footer } from "./slots/footer.js";
|
|
7
|
+
import { Breadcrumb } from "./slots/breadcrumb.js";
|
|
8
|
+
import { Container } from "./slots/container.js";
|
|
9
|
+
import { MarkdownCopyButton, ViewOptionsPopover } from "../../shared/page-actions.js";
|
|
10
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
11
|
+
import { Edit } from "lucide-react";
|
|
12
|
+
import { createContext, use, useEffect, useState } from "react";
|
|
13
|
+
import { useTranslations } from "@fuma-translate/react";
|
|
14
|
+
//#region src/layouts/docs/page/index.tsx
|
|
15
|
+
var page_exports = /* @__PURE__ */ __exportAll({
|
|
16
|
+
DocsBody: () => DocsBody,
|
|
17
|
+
DocsDescription: () => DocsDescription,
|
|
18
|
+
DocsPage: () => DocsPage,
|
|
19
|
+
DocsTitle: () => DocsTitle,
|
|
20
|
+
EditOnGitHub: () => EditOnGitHub,
|
|
21
|
+
MarkdownCopyButton: () => MarkdownCopyButton,
|
|
22
|
+
PageBreadcrumb: () => Breadcrumb,
|
|
23
|
+
PageFooter: () => Footer,
|
|
24
|
+
PageLastUpdate: () => PageLastUpdate,
|
|
25
|
+
ViewOptionsPopover: () => ViewOptionsPopover,
|
|
26
|
+
useDocsPage: () => useDocsPage
|
|
27
|
+
});
|
|
28
|
+
const PageContext = createContext(null);
|
|
29
|
+
function useDocsPage() {
|
|
30
|
+
const context = use(PageContext);
|
|
31
|
+
if (!context) throw new Error("Please use page components under <DocsPage /> (`opin-ui/layouts/docs/page`).");
|
|
32
|
+
return context;
|
|
33
|
+
}
|
|
34
|
+
function DocsPage({ full = false, tableOfContent: { enabled: tocEnabled = !full, single, ...tocProps } = {}, tableOfContentPopover: { enabled: tocPopoverEnabled, ...tocPopoverProps } = {}, breadcrumb: { enabled: breadcrumbEnabled = true, ...breadcrumb } = {}, footer: { enabled: footerEnabled = true, ...footer } = {}, toc = [], slots: defaultSlots = {}, children, ...containerProps }) {
|
|
35
|
+
tocPopoverEnabled ??= Boolean(toc.length > 0 || tocPopoverProps.header || tocPopoverProps.footer);
|
|
36
|
+
const slots = {
|
|
37
|
+
breadcrumb: defaultSlots.breadcrumb ?? Breadcrumb,
|
|
38
|
+
footer: defaultSlots.footer ?? Footer,
|
|
39
|
+
toc: defaultSlots.toc ?? {
|
|
40
|
+
provider: TOCProvider,
|
|
41
|
+
main: TOC,
|
|
42
|
+
popover: TOCPopover
|
|
43
|
+
},
|
|
44
|
+
container: defaultSlots.container ?? Container
|
|
45
|
+
};
|
|
46
|
+
return /* @__PURE__ */ jsx(PageContext, {
|
|
47
|
+
value: {
|
|
48
|
+
full,
|
|
49
|
+
slots
|
|
50
|
+
},
|
|
51
|
+
children: /* @__PURE__ */ jsxs(slots.toc.provider, {
|
|
52
|
+
single,
|
|
53
|
+
toc: tocEnabled || tocPopoverEnabled ? toc : [],
|
|
54
|
+
children: [
|
|
55
|
+
tocPopoverEnabled && (tocPopoverProps.component ?? /* @__PURE__ */ jsx(slots.toc.popover, { ...tocPopoverProps })),
|
|
56
|
+
/* @__PURE__ */ jsxs(slots.container, {
|
|
57
|
+
...containerProps,
|
|
58
|
+
children: [
|
|
59
|
+
breadcrumbEnabled && (breadcrumb.component ?? /* @__PURE__ */ jsx(slots.breadcrumb, { ...breadcrumb })),
|
|
60
|
+
children,
|
|
61
|
+
footerEnabled && (footer.component ?? /* @__PURE__ */ jsx(slots.footer, { ...footer }))
|
|
62
|
+
]
|
|
63
|
+
}),
|
|
64
|
+
tocEnabled && (tocProps.component ?? /* @__PURE__ */ jsx(slots.toc.main, { ...tocProps }))
|
|
65
|
+
]
|
|
66
|
+
})
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
function EditOnGitHub(props) {
|
|
70
|
+
const t = useTranslations({ note: "edit page" });
|
|
71
|
+
return /* @__PURE__ */ jsx("a", {
|
|
72
|
+
target: "_blank",
|
|
73
|
+
rel: "noreferrer noopener",
|
|
74
|
+
...props,
|
|
75
|
+
className: cn(buttonVariants({
|
|
76
|
+
color: "secondary",
|
|
77
|
+
size: "sm"
|
|
78
|
+
}), "gap-1.5 not-prose", props.className),
|
|
79
|
+
children: props.children ?? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(Edit, { className: "size-3.5" }), t("Edit on GitHub")] })
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Add typography styles
|
|
84
|
+
*/
|
|
85
|
+
function DocsBody({ children, className, ...props }) {
|
|
86
|
+
return /* @__PURE__ */ jsx("div", {
|
|
87
|
+
...props,
|
|
88
|
+
className: cn("prose flex-1", className),
|
|
89
|
+
children
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
function DocsDescription({ children, className, ...props }) {
|
|
93
|
+
if (children === void 0) return null;
|
|
94
|
+
return /* @__PURE__ */ jsx("p", {
|
|
95
|
+
...props,
|
|
96
|
+
className: cn("mb-8 text-lg text-fd-muted-foreground", className),
|
|
97
|
+
children
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
function DocsTitle({ children, className, ...props }) {
|
|
101
|
+
return /* @__PURE__ */ jsx("h1", {
|
|
102
|
+
...props,
|
|
103
|
+
className: cn("text-[1.75em] font-semibold", className),
|
|
104
|
+
children
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
function PageLastUpdate({ date: value, ...props }) {
|
|
108
|
+
const t = useTranslations({ note: "page footer" });
|
|
109
|
+
const [date, setDate] = useState("");
|
|
110
|
+
useEffect(() => {
|
|
111
|
+
setDate(value.toLocaleDateString());
|
|
112
|
+
}, [value]);
|
|
113
|
+
return /* @__PURE__ */ jsxs("p", {
|
|
114
|
+
...props,
|
|
115
|
+
className: cn("text-sm text-fd-muted-foreground", props.className),
|
|
116
|
+
children: [
|
|
117
|
+
t("Last updated on"),
|
|
118
|
+
" ",
|
|
119
|
+
date
|
|
120
|
+
]
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
//#endregion
|
|
124
|
+
export { DocsBody, DocsDescription, DocsPage, DocsTitle, EditOnGitHub, MarkdownCopyButton, Breadcrumb as PageBreadcrumb, Footer as PageFooter, PageLastUpdate, ViewOptionsPopover, page_exports, useDocsPage };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ComponentProps } from "react";
|
|
2
|
+
import { BreadcrumbOptions } from "fumadocs-core/breadcrumb";
|
|
3
|
+
|
|
4
|
+
//#region src/layouts/docs/page/slots/breadcrumb.d.ts
|
|
5
|
+
type BreadcrumbProps = BreadcrumbOptions & ComponentProps<'div'>;
|
|
6
|
+
declare function Breadcrumb({
|
|
7
|
+
includeRoot,
|
|
8
|
+
includeSeparator,
|
|
9
|
+
includePage,
|
|
10
|
+
...props
|
|
11
|
+
}: BreadcrumbProps): import("react").JSX.Element | null;
|
|
12
|
+
//#endregion
|
|
13
|
+
export { Breadcrumb, BreadcrumbProps };
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn } from "../../../../utils/cn.js";
|
|
3
|
+
import { useTreeContext, useTreePath } from "../../../../contexts/tree.js";
|
|
4
|
+
import Link from "fumadocs-core/link";
|
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
import { ChevronRight } from "lucide-react";
|
|
7
|
+
import { Fragment as Fragment$1, useMemo } from "react";
|
|
8
|
+
import { getBreadcrumbItemsFromPath } from "fumadocs-core/breadcrumb";
|
|
9
|
+
//#region src/layouts/docs/page/slots/breadcrumb.tsx
|
|
10
|
+
function Breadcrumb({ includeRoot, includeSeparator, includePage, ...props }) {
|
|
11
|
+
const path = useTreePath();
|
|
12
|
+
const { root } = useTreeContext();
|
|
13
|
+
const items = useMemo(() => {
|
|
14
|
+
return getBreadcrumbItemsFromPath(root, path, {
|
|
15
|
+
includePage,
|
|
16
|
+
includeSeparator,
|
|
17
|
+
includeRoot
|
|
18
|
+
});
|
|
19
|
+
}, [
|
|
20
|
+
includePage,
|
|
21
|
+
includeRoot,
|
|
22
|
+
includeSeparator,
|
|
23
|
+
path,
|
|
24
|
+
root
|
|
25
|
+
]);
|
|
26
|
+
if (items.length === 0) return null;
|
|
27
|
+
return /* @__PURE__ */ jsx("div", {
|
|
28
|
+
...props,
|
|
29
|
+
className: cn("flex items-center gap-1.5 text-sm text-fd-muted-foreground", props.className),
|
|
30
|
+
children: items.map((item, i) => {
|
|
31
|
+
const className = cn("truncate", i === items.length - 1 && "text-fd-primary font-medium");
|
|
32
|
+
return /* @__PURE__ */ jsxs(Fragment$1, { children: [i !== 0 && /* @__PURE__ */ jsx(ChevronRight, { className: "size-3.5 shrink-0" }), item.url ? /* @__PURE__ */ jsx(Link, {
|
|
33
|
+
href: item.url,
|
|
34
|
+
className: cn(className, "transition-opacity hover:opacity-80"),
|
|
35
|
+
children: item.name
|
|
36
|
+
}) : /* @__PURE__ */ jsx("span", {
|
|
37
|
+
className,
|
|
38
|
+
children: item.name
|
|
39
|
+
})] }, i);
|
|
40
|
+
})
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
//#endregion
|
|
44
|
+
export { Breadcrumb };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn } from "../../../../utils/cn.js";
|
|
3
|
+
import { useDocsPage } from "../index.js";
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
5
|
+
//#region src/layouts/docs/page/slots/container.tsx
|
|
6
|
+
function Container(props) {
|
|
7
|
+
const { full } = useDocsPage();
|
|
8
|
+
return /* @__PURE__ */ jsx("article", {
|
|
9
|
+
id: "nd-page",
|
|
10
|
+
"data-full": full,
|
|
11
|
+
...props,
|
|
12
|
+
className: cn("flex flex-col w-full max-w-[900px] mx-auto [grid-area:main] px-4 py-6 gap-4 md:px-6 md:pt-8 xl:px-8 xl:pt-14", full && "max-w-[1168px]", props.className),
|
|
13
|
+
children: props.children
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
//#endregion
|
|
17
|
+
export { Container };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ComponentProps } from "react";
|
|
2
|
+
import * as PageTree from "fumadocs-core/page-tree";
|
|
3
|
+
|
|
4
|
+
//#region src/layouts/docs/page/slots/footer.d.ts
|
|
5
|
+
type Item = Pick<PageTree.Item, 'name' | 'description' | 'url'>;
|
|
6
|
+
interface FooterProps extends ComponentProps<'div'> {
|
|
7
|
+
/**
|
|
8
|
+
* Items including information for the next and previous page
|
|
9
|
+
*/
|
|
10
|
+
items?: {
|
|
11
|
+
previous?: Item;
|
|
12
|
+
next?: Item;
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
declare function Footer({
|
|
16
|
+
items,
|
|
17
|
+
children,
|
|
18
|
+
className,
|
|
19
|
+
...props
|
|
20
|
+
}: FooterProps): import("react").JSX.Element;
|
|
21
|
+
//#endregion
|
|
22
|
+
export { Footer, FooterProps };
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn } from "../../../../utils/cn.js";
|
|
3
|
+
import { isActive } from "../../../../utils/urls.js";
|
|
4
|
+
import { useFooterItems } from "../../../../utils/use-footer-items.js";
|
|
5
|
+
import Link from "fumadocs-core/link";
|
|
6
|
+
import { usePathname } from "fumadocs-core/framework";
|
|
7
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
import { ChevronLeft, ChevronRight } from "lucide-react";
|
|
9
|
+
import { useMemo } from "react";
|
|
10
|
+
import { useTranslations } from "@fuma-translate/react";
|
|
11
|
+
//#region src/layouts/docs/page/slots/footer.tsx
|
|
12
|
+
function Footer({ items, children, className, ...props }) {
|
|
13
|
+
const footerList = useFooterItems();
|
|
14
|
+
const pathname = usePathname();
|
|
15
|
+
const { previous, next } = useMemo(() => {
|
|
16
|
+
if (items) return items;
|
|
17
|
+
const idx = footerList.findIndex((item) => isActive(item.url, pathname));
|
|
18
|
+
if (idx === -1) return {};
|
|
19
|
+
return {
|
|
20
|
+
previous: footerList[idx - 1],
|
|
21
|
+
next: footerList[idx + 1]
|
|
22
|
+
};
|
|
23
|
+
}, [
|
|
24
|
+
footerList,
|
|
25
|
+
items,
|
|
26
|
+
pathname
|
|
27
|
+
]);
|
|
28
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs("div", {
|
|
29
|
+
className: cn("@container grid gap-4", previous && next ? "grid-cols-2" : "grid-cols-1", className),
|
|
30
|
+
...props,
|
|
31
|
+
children: [previous && /* @__PURE__ */ jsx(FooterItem, {
|
|
32
|
+
item: previous,
|
|
33
|
+
index: 0
|
|
34
|
+
}), next && /* @__PURE__ */ jsx(FooterItem, {
|
|
35
|
+
item: next,
|
|
36
|
+
index: 1
|
|
37
|
+
})]
|
|
38
|
+
}), children] });
|
|
39
|
+
}
|
|
40
|
+
function FooterItem({ item, index }) {
|
|
41
|
+
const t = useTranslations({ note: "pagination" });
|
|
42
|
+
const Icon = index === 0 ? ChevronLeft : ChevronRight;
|
|
43
|
+
return /* @__PURE__ */ jsxs(Link, {
|
|
44
|
+
href: item.url,
|
|
45
|
+
className: cn("flex flex-col gap-2 rounded-lg border p-4 text-sm transition-colors hover:bg-fd-accent/80 hover:text-fd-accent-foreground @max-lg:col-span-full", index === 1 && "text-end"),
|
|
46
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
47
|
+
className: cn("inline-flex items-center gap-1.5 font-medium", index === 1 && "flex-row-reverse"),
|
|
48
|
+
children: [/* @__PURE__ */ jsx(Icon, { className: "-mx-1 size-4 shrink-0 rtl:rotate-180" }), /* @__PURE__ */ jsx("p", { children: item.name })]
|
|
49
|
+
}), /* @__PURE__ */ jsx("p", {
|
|
50
|
+
className: "text-fd-muted-foreground truncate",
|
|
51
|
+
children: item.description ?? (index === 0 ? t("Previous Page") : t("Next Page"))
|
|
52
|
+
})]
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
//#endregion
|
|
56
|
+
export { Footer };
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { TOCItemsProps } from "../../../../components/toc/clerk.js";
|
|
2
|
+
import { TOCItemsProps as TOCItemsProps$1 } from "../../../../components/toc/default.js";
|
|
3
|
+
import { TOCProviderProps as TOCProviderProps$1 } from "../../../../components/toc/index.js";
|
|
4
|
+
import { ComponentProps, ReactNode } from "react";
|
|
5
|
+
|
|
6
|
+
//#region src/layouts/docs/page/slots/toc.d.ts
|
|
7
|
+
type TOCProviderProps = TOCProviderProps$1;
|
|
8
|
+
declare function TOCProvider(props: TOCProviderProps): import("react").JSX.Element;
|
|
9
|
+
type TOCProps = {
|
|
10
|
+
container?: ComponentProps<'div'>;
|
|
11
|
+
/**
|
|
12
|
+
* Custom content in TOC container, before the main TOC
|
|
13
|
+
*/
|
|
14
|
+
header?: ReactNode;
|
|
15
|
+
/**
|
|
16
|
+
* Custom content in TOC container, after the main TOC
|
|
17
|
+
*/
|
|
18
|
+
footer?: ReactNode;
|
|
19
|
+
} & ({
|
|
20
|
+
style?: 'normal';
|
|
21
|
+
list?: TOCItemsProps$1;
|
|
22
|
+
} | {
|
|
23
|
+
style: 'clerk';
|
|
24
|
+
list?: TOCItemsProps;
|
|
25
|
+
});
|
|
26
|
+
declare function TOC({
|
|
27
|
+
container,
|
|
28
|
+
header,
|
|
29
|
+
footer,
|
|
30
|
+
style,
|
|
31
|
+
list
|
|
32
|
+
}: TOCProps): import("react").JSX.Element;
|
|
33
|
+
type TOCPopoverProps = {
|
|
34
|
+
container?: ComponentProps<'div'>;
|
|
35
|
+
trigger?: ComponentProps<'button'>;
|
|
36
|
+
content?: ComponentProps<'div'>;
|
|
37
|
+
/**
|
|
38
|
+
* Custom content in TOC container, before the main TOC
|
|
39
|
+
*/
|
|
40
|
+
header?: ReactNode;
|
|
41
|
+
/**
|
|
42
|
+
* Custom content in TOC container, after the main TOC
|
|
43
|
+
*/
|
|
44
|
+
footer?: ReactNode;
|
|
45
|
+
} & ({
|
|
46
|
+
style?: 'normal';
|
|
47
|
+
list?: TOCItemsProps$1;
|
|
48
|
+
} | {
|
|
49
|
+
style: 'clerk';
|
|
50
|
+
list?: TOCItemsProps;
|
|
51
|
+
});
|
|
52
|
+
declare function TOCPopover({
|
|
53
|
+
container,
|
|
54
|
+
trigger,
|
|
55
|
+
content,
|
|
56
|
+
header,
|
|
57
|
+
footer,
|
|
58
|
+
style,
|
|
59
|
+
list
|
|
60
|
+
}: TOCPopoverProps): import("react").JSX.Element;
|
|
61
|
+
//#endregion
|
|
62
|
+
export { TOC, TOCPopover, TOCPopoverProps, TOCProps, TOCProvider, TOCProviderProps };
|