UNPKG

fumadocs-ui

Version:

The Radix UI version of Fumadocs UI

104 lines (102 loc) 4.9 kB
import { __exportAll } from "../../../_virtual/rolldown_runtime.js"; import { buttonVariants } from "../../../components/ui/button.js"; import { i18n_exports } from "../../../contexts/i18n.js"; import { toc_exports } from "../../../components/toc/index.js"; import { default_exports } from "../../../components/toc/default.js"; import { clerk_exports } from "../../../components/toc/clerk.js"; import { PageBreadcrumb, PageFooter, PageLastUpdate, PageTOCPopover, PageTOCPopoverContent, PageTOCPopoverTrigger } from "./client.js"; import { cn } from "@fumadocs/ui/cn"; import { Fragment, jsx, jsxs } from "react/jsx-runtime"; import { Edit, Text } from "lucide-react"; //#region src/layouts/notebook/page/index.tsx var page_exports = /* @__PURE__ */ __exportAll({ DocsBody: () => DocsBody, DocsDescription: () => DocsDescription, DocsPage: () => DocsPage, DocsTitle: () => DocsTitle, EditOnGitHub: () => EditOnGitHub, PageBreadcrumb: () => PageBreadcrumb, PageLastUpdate: () => PageLastUpdate }); function DocsPage({ breadcrumb: { enabled: breadcrumbEnabled = true, component: breadcrumb, ...breadcrumbProps } = {}, footer = {}, full = false, tableOfContentPopover: { enabled: tocPopoverEnabled, component: tocPopover, ...tocPopoverOptions } = {}, tableOfContent: { enabled: tocEnabled, component: tocReplace, ...tocOptions } = {}, toc = [], children }) { tocEnabled ??= !full && (toc.length > 0 || tocOptions.footer !== void 0 || tocOptions.header !== void 0); tocPopoverEnabled ??= toc.length > 0 || tocPopoverOptions.header !== void 0 || tocPopoverOptions.footer !== void 0; let wrapper = (children$1) => children$1; if (tocEnabled || tocPopoverEnabled) wrapper = (children$1) => /* @__PURE__ */ jsx(toc_exports.TOCProvider, { single: tocOptions.single, toc, children: children$1 }); return wrapper(/* @__PURE__ */ jsxs(Fragment, { children: [ tocPopoverEnabled && (tocPopover ?? /* @__PURE__ */ jsxs(PageTOCPopover, { children: [/* @__PURE__ */ jsx(PageTOCPopoverTrigger, {}), /* @__PURE__ */ jsxs(PageTOCPopoverContent, { children: [ tocPopoverOptions.header, /* @__PURE__ */ jsx(toc_exports.TOCScrollArea, { children: tocPopoverOptions.style === "clerk" ? /* @__PURE__ */ jsx(clerk_exports.TOCItems, {}) : /* @__PURE__ */ jsx(default_exports.TOCItems, {}) }), tocPopoverOptions.footer ] })] })), /* @__PURE__ */ jsxs("article", { id: "nd-page", "data-full": full, className: cn("flex flex-col [grid-area:main] px-4 py-6 gap-4 md:px-6 md:pt-8 xl:px-8 xl:pt-14 *:max-w-[900px]", full && "*:max-w-[1285px]"), children: [ breadcrumbEnabled && (breadcrumb ?? /* @__PURE__ */ jsx(PageBreadcrumb, { ...breadcrumbProps })), children, footer.enabled !== false && (footer.component ?? /* @__PURE__ */ jsx(PageFooter, { items: footer.items })) ] }), tocEnabled && (tocReplace ?? /* @__PURE__ */ jsxs("div", { id: "nd-toc", className: "sticky top-(--fd-docs-row-3) [grid-area:toc] h-[calc(var(--fd-docs-height)-var(--fd-docs-row-3))] flex flex-col w-(--fd-toc-width) pt-12 pe-4 pb-2 xl:layout:[--fd-toc-width:268px] max-xl:hidden", children: [ tocOptions.header, /* @__PURE__ */ jsxs("h3", { id: "toc-title", className: "inline-flex items-center gap-1.5 text-sm text-fd-muted-foreground", children: [/* @__PURE__ */ jsx(Text, { className: "size-4" }), /* @__PURE__ */ jsx(i18n_exports.I18nLabel, { label: "toc" })] }), /* @__PURE__ */ jsx(toc_exports.TOCScrollArea, { children: tocOptions.style === "clerk" ? /* @__PURE__ */ jsx(clerk_exports.TOCItems, {}) : /* @__PURE__ */ jsx(default_exports.TOCItems, {}) }), tocOptions.footer ] })) ] })); } function EditOnGitHub(props) { return /* @__PURE__ */ jsx("a", { target: "_blank", rel: "noreferrer noopener", ...props, className: cn(buttonVariants({ color: "secondary", size: "sm", className: "gap-1.5 not-prose" }), props.className), children: props.children ?? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(Edit, { className: "size-3.5" }), /* @__PURE__ */ jsx(i18n_exports.I18nLabel, { label: "editOnGithub" })] }) }); } /** * Add typography styles */ function DocsBody({ children, className, ...props }) { return /* @__PURE__ */ jsx("div", { ...props, className: cn("prose flex-1", className), children }); } function DocsDescription({ children, className, ...props }) { if (children === void 0) return null; return /* @__PURE__ */ jsx("p", { ...props, className: cn("mb-8 text-lg text-fd-muted-foreground", className), children }); } function DocsTitle({ children, className, ...props }) { return /* @__PURE__ */ jsx("h1", { ...props, className: cn("text-[1.75em] font-semibold", className), children }); } //#endregion export { DocsBody, DocsDescription, DocsPage, DocsTitle, EditOnGitHub, PageBreadcrumb, PageLastUpdate, page_exports }; //# sourceMappingURL=index.js.map