@fumadocs/base-ui 16.7.0 → 16.7.2

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.
Files changed (72) hide show
  1. package/css/generated/docs.css +5 -4
  2. package/css/generated/flux.css +3 -3
  3. package/css/generated/home.css +2 -3
  4. package/css/generated/notebook.css +4 -4
  5. package/css/generated/shared.css +2 -1
  6. package/dist/components/accordion.js +2 -2
  7. package/dist/components/dialog/search.js +2 -2
  8. package/dist/components/files.js +3 -3
  9. package/dist/components/heading.js +2 -2
  10. package/dist/components/sidebar/tabs/dropdown.js +1 -1
  11. package/dist/components/toc/index.d.ts +3 -2
  12. package/dist/components/toc/index.js +12 -2
  13. package/dist/components/ui/button.d.ts +1 -1
  14. package/dist/layouts/docs/client.d.ts +3 -3
  15. package/dist/layouts/docs/client.js +20 -23
  16. package/dist/layouts/docs/index.d.ts +1 -1
  17. package/dist/layouts/docs/page/index.d.ts +91 -3
  18. package/dist/layouts/docs/page/index.js +67 -7
  19. package/dist/layouts/docs/page/slots/breadcrumb.js +3 -1
  20. package/dist/layouts/docs/page/slots/container.js +2 -1
  21. package/dist/layouts/docs/page/slots/footer.js +1 -0
  22. package/dist/layouts/docs/page/slots/toc.d.ts +29 -1
  23. package/dist/layouts/docs/page/slots/toc.js +137 -4
  24. package/dist/layouts/docs/slots/container.js +2 -1
  25. package/dist/layouts/docs/slots/header.js +1 -0
  26. package/dist/layouts/docs/slots/sidebar.js +7 -7
  27. package/dist/layouts/flux/index.d.ts +4 -4
  28. package/dist/layouts/flux/index.js +8 -11
  29. package/dist/layouts/flux/page/index.d.ts +79 -3
  30. package/dist/layouts/flux/page/index.js +61 -7
  31. package/dist/layouts/flux/page/slots/breadcrumb.js +1 -0
  32. package/dist/layouts/flux/page/slots/container.js +2 -1
  33. package/dist/layouts/flux/page/slots/footer.js +1 -0
  34. package/dist/layouts/flux/page/slots/toc.d.ts +4 -1
  35. package/dist/layouts/flux/page/slots/toc.js +3 -2
  36. package/dist/layouts/flux/slots/container.js +1 -0
  37. package/dist/layouts/home/index.d.ts +3 -3
  38. package/dist/layouts/home/index.js +6 -8
  39. package/dist/layouts/home/slots/container.js +1 -0
  40. package/dist/layouts/home/slots/header.d.ts +1 -1
  41. package/dist/layouts/home/slots/header.js +5 -5
  42. package/dist/layouts/notebook/client.d.ts +3 -3
  43. package/dist/layouts/notebook/client.js +15 -18
  44. package/dist/layouts/notebook/index.d.ts +1 -1
  45. package/dist/layouts/notebook/page/index.d.ts +91 -3
  46. package/dist/layouts/notebook/page/index.js +67 -7
  47. package/dist/layouts/notebook/page/slots/breadcrumb.js +1 -0
  48. package/dist/layouts/notebook/page/slots/container.js +2 -1
  49. package/dist/layouts/notebook/page/slots/footer.js +1 -0
  50. package/dist/layouts/notebook/page/slots/toc.d.ts +29 -1
  51. package/dist/layouts/notebook/page/slots/toc.js +136 -4
  52. package/dist/layouts/notebook/slots/container.js +1 -0
  53. package/dist/layouts/notebook/slots/sidebar.js +5 -5
  54. package/dist/layouts/shared/client.d.ts +8 -8
  55. package/dist/layouts/shared/client.js +4 -4
  56. package/dist/layouts/shared/index.d.ts +6 -6
  57. package/dist/layouts/shared/page-actions.d.ts +2 -2
  58. package/dist/layouts/shared/page-actions.js +3 -3
  59. package/dist/layouts/shared/slots/search-trigger.d.ts +3 -3
  60. package/dist/page.d.ts +1 -2
  61. package/dist/page.js +1 -2
  62. package/package.json +4 -6
  63. package/dist/layouts/docs/page/client.d.ts +0 -98
  64. package/dist/layouts/docs/page/client.js +0 -110
  65. package/dist/layouts/docs/page/slots/toc-popover.d.ts +0 -31
  66. package/dist/layouts/docs/page/slots/toc-popover.js +0 -141
  67. package/dist/layouts/flux/page/client.d.ts +0 -82
  68. package/dist/layouts/flux/page/client.js +0 -94
  69. package/dist/layouts/notebook/page/client.d.ts +0 -98
  70. package/dist/layouts/notebook/page/client.js +0 -110
  71. package/dist/layouts/notebook/page/slots/toc-popover.d.ts +0 -31
  72. package/dist/layouts/notebook/page/slots/toc-popover.js +0 -141
@@ -1,141 +0,0 @@
1
- "use client";
2
- import { useI18n } from "../../../../contexts/i18n.js";
3
- import { cn } from "../../../../utils/cn.js";
4
- import { TOCScrollArea, useTOCItems } from "../../../../components/toc/index.js";
5
- import { TOCItems } from "../../../../components/toc/default.js";
6
- import { TOCItems as TOCItems$1 } from "../../../../components/toc/clerk.js";
7
- import { useTreePath } from "../../../../contexts/tree.js";
8
- import { Collapsible, CollapsibleContent, CollapsibleTrigger } from "../../../../components/ui/collapsible.js";
9
- import { useDocsLayout } from "../../client.js";
10
- import { createContext, use, useEffect, useEffectEvent, useMemo, useRef, useState } from "react";
11
- import { jsx, jsxs } from "react/jsx-runtime";
12
- import { ChevronDown } from "lucide-react";
13
- import { useActiveAnchor } from "fumadocs-core/toc";
14
- //#region src/layouts/docs/page/slots/toc-popover.tsx
15
- const TocPopoverContext = createContext(null);
16
- function TOCPopover({ container, trigger, content, header, footer, style }) {
17
- return /* @__PURE__ */ jsxs(PageTOCPopover, {
18
- ...container,
19
- children: [/* @__PURE__ */ jsx(PageTOCPopoverTrigger, { ...trigger }), /* @__PURE__ */ jsxs(PageTOCPopoverContent, {
20
- ...content,
21
- children: [
22
- header,
23
- /* @__PURE__ */ jsx(TOCScrollArea, { children: style === "clerk" ? /* @__PURE__ */ jsx(TOCItems$1, {}) : /* @__PURE__ */ jsx(TOCItems, {}) }),
24
- footer
25
- ]
26
- })]
27
- });
28
- }
29
- function PageTOCPopover({ className, children, ...rest }) {
30
- const ref = useRef(null);
31
- const [open, setOpen] = useState(false);
32
- const { isNavTransparent } = useDocsLayout();
33
- const onClick = useEffectEvent((e) => {
34
- if (!open) return;
35
- if (ref.current && !ref.current.contains(e.target)) setOpen(false);
36
- });
37
- useEffect(() => {
38
- window.addEventListener("click", onClick);
39
- return () => {
40
- window.removeEventListener("click", onClick);
41
- };
42
- }, []);
43
- return /* @__PURE__ */ jsx(TocPopoverContext, {
44
- value: useMemo(() => ({
45
- open,
46
- setOpen
47
- }), [setOpen, open]),
48
- children: /* @__PURE__ */ jsx(Collapsible, {
49
- open,
50
- onOpenChange: setOpen,
51
- "data-toc-popover": "",
52
- className: cn("sticky top-(--fd-docs-row-2) z-10 [grid-area:toc-popover] h-(--fd-toc-popover-height) xl:hidden max-xl:layout:[--fd-toc-popover-height:--spacing(10)]", className),
53
- ...rest,
54
- children: /* @__PURE__ */ jsx("header", {
55
- ref,
56
- className: cn("border-b backdrop-blur-sm transition-colors", (!isNavTransparent || open) && "bg-fd-background/80", open && "shadow-lg"),
57
- children
58
- })
59
- })
60
- });
61
- }
62
- function PageTOCPopoverTrigger({ className, ...props }) {
63
- const { text } = useI18n();
64
- const { open } = use(TocPopoverContext);
65
- const items = useTOCItems();
66
- const active = useActiveAnchor();
67
- const selected = useMemo(() => items.findIndex((item) => active === item.url.slice(1)), [items, active]);
68
- const path = useTreePath().at(-1);
69
- const showItem = selected !== -1 && !open;
70
- return /* @__PURE__ */ jsxs(CollapsibleTrigger, {
71
- className: cn("flex w-full h-10 items-center text-sm text-fd-muted-foreground gap-2.5 px-4 py-2.5 text-start focus-visible:outline-none [&_svg]:size-4 md:px-6", className),
72
- "data-toc-popover-trigger": "",
73
- ...props,
74
- children: [
75
- /* @__PURE__ */ jsx(ProgressCircle, {
76
- value: (selected + 1) / Math.max(1, items.length),
77
- max: 1,
78
- className: cn("shrink-0", open && "text-fd-primary")
79
- }),
80
- /* @__PURE__ */ jsxs("span", {
81
- className: "grid flex-1 *:my-auto *:row-start-1 *:col-start-1",
82
- children: [/* @__PURE__ */ jsx("span", {
83
- className: cn("truncate transition-[opacity,translate,color]", open && "text-fd-foreground", showItem && "opacity-0 -translate-y-full pointer-events-none"),
84
- children: path?.name ?? text.toc
85
- }), /* @__PURE__ */ jsx("span", {
86
- className: cn("truncate transition-[opacity,translate]", !showItem && "opacity-0 translate-y-full pointer-events-none"),
87
- children: items[selected]?.title
88
- })]
89
- }),
90
- /* @__PURE__ */ jsx(ChevronDown, { className: cn("shrink-0 transition-transform mx-0.5", open && "rotate-180") })
91
- ]
92
- });
93
- }
94
- function clamp(input, min, max) {
95
- if (input < min) return min;
96
- if (input > max) return max;
97
- return input;
98
- }
99
- function ProgressCircle({ value, strokeWidth = 2, size = 24, min = 0, max = 100, ...restSvgProps }) {
100
- const normalizedValue = clamp(value, min, max);
101
- const radius = (size - strokeWidth) / 2;
102
- const circumference = 2 * Math.PI * radius;
103
- const progress = normalizedValue / max * circumference;
104
- const circleProps = {
105
- cx: size / 2,
106
- cy: size / 2,
107
- r: radius,
108
- fill: "none",
109
- strokeWidth
110
- };
111
- return /* @__PURE__ */ jsxs("svg", {
112
- role: "progressbar",
113
- viewBox: `0 0 ${size} ${size}`,
114
- "aria-valuenow": normalizedValue,
115
- "aria-valuemin": min,
116
- "aria-valuemax": max,
117
- ...restSvgProps,
118
- children: [/* @__PURE__ */ jsx("circle", {
119
- ...circleProps,
120
- className: "stroke-current/25"
121
- }), /* @__PURE__ */ jsx("circle", {
122
- ...circleProps,
123
- stroke: "currentColor",
124
- strokeDasharray: circumference,
125
- strokeDashoffset: circumference - progress,
126
- strokeLinecap: "round",
127
- transform: `rotate(-90 ${size / 2} ${size / 2})`,
128
- className: "transition-all"
129
- })]
130
- });
131
- }
132
- function PageTOCPopoverContent(props) {
133
- return /* @__PURE__ */ jsx(CollapsibleContent, {
134
- "data-toc-popover-content": "",
135
- ...props,
136
- className: cn("flex flex-col px-4 max-h-[50vh] md:px-6", props.className),
137
- children: props.children
138
- });
139
- }
140
- //#endregion
141
- export { TOCPopover };
@@ -1,82 +0,0 @@
1
- import { TOCProviderProps } from "../../../components/toc/index.js";
2
- import { TOCProps } from "./slots/toc.js";
3
- import { FooterProps } from "./slots/footer.js";
4
- import { BreadcrumbProps } from "./slots/breadcrumb.js";
5
- import { ComponentProps, FC, ReactNode } from "react";
6
- import * as react_jsx_runtime0 from "react/jsx-runtime";
7
- import { TOCItemType } from "fumadocs-core/toc";
8
-
9
- //#region src/layouts/flux/page/client.d.ts
10
- interface DocsPageSlots {
11
- toc?: FC<TOCProps>;
12
- container?: FC<ComponentProps<'article'>>;
13
- tocProvider?: FC<TOCProviderProps>;
14
- footer?: FC<FooterProps>;
15
- breadcrumb?: FC<BreadcrumbProps>;
16
- }
17
- interface DocsPageProps extends ComponentProps<'article'> {
18
- toc?: TOCItemType[];
19
- /**
20
- * Extend the page to fill all available space
21
- *
22
- * @defaultValue false
23
- */
24
- full?: boolean;
25
- children?: ReactNode;
26
- slots?: DocsPageSlots;
27
- footer?: FooterOptions;
28
- breadcrumb?: BreadcrumbOptions;
29
- tableOfContent?: TableOfContentOptions;
30
- }
31
- interface TableOfContentOptions extends Pick<TOCProviderProps, 'single'>, TOCProps {
32
- enabled?: boolean;
33
- /**
34
- * @deprecated use `slots.toc` instead.
35
- */
36
- component?: ReactNode;
37
- }
38
- interface BreadcrumbOptions extends BreadcrumbProps {
39
- enabled?: boolean;
40
- /**
41
- * @deprecated use `slots.breadcrumb` instead.
42
- */
43
- component?: ReactNode;
44
- }
45
- interface FooterOptions extends FooterProps {
46
- enabled?: boolean;
47
- /**
48
- * @deprecated use `slots.footer` instead.
49
- */
50
- component?: ReactNode;
51
- }
52
- interface PageSlotsProps extends Pick<DocsPageProps, 'full' | 'footer' | 'breadcrumb'> {
53
- tableOfContent: TOCProps & {
54
- component?: ReactNode;
55
- };
56
- }
57
- declare function useDocsPage(): {
58
- props: PageSlotsProps;
59
- slots: DocsPageSlots;
60
- };
61
- declare function DocsPage({
62
- tableOfContent: {
63
- enabled: tocEnabled,
64
- single,
65
- ...tocProps
66
- },
67
- footer,
68
- breadcrumb,
69
- full,
70
- toc,
71
- slots: defaultSlots,
72
- children,
73
- ...containerProps
74
- }: DocsPageProps): react_jsx_runtime0.JSX.Element;
75
- declare function PageLastUpdate({
76
- date: value,
77
- ...props
78
- }: Omit<ComponentProps<'p'>, 'children'> & {
79
- date: Date;
80
- }): react_jsx_runtime0.JSX.Element;
81
- //#endregion
82
- export { DocsPage, DocsPageProps, DocsPageSlots, PageLastUpdate, useDocsPage };
@@ -1,94 +0,0 @@
1
- "use client";
2
- import { useI18n } from "../../../contexts/i18n.js";
3
- import { cn } from "../../../utils/cn.js";
4
- import { TOCProvider } from "../../../components/toc/index.js";
5
- import { TOC } 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 { createContext, use, useEffect, useState } from "react";
10
- import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
11
- //#region src/layouts/flux/page/client.tsx
12
- const PageContext = createContext(null);
13
- function useDocsPage() {
14
- const context = use(PageContext);
15
- if (!context) throw new Error("Please use page components under <DocsPage /> (`fumadocs-ui/layouts/flux/page`).");
16
- return context;
17
- }
18
- function DocsPage({ tableOfContent: { enabled: tocEnabled, single = false, ...tocProps } = {}, footer = {}, breadcrumb = {}, full = false, toc = [], slots: defaultSlots = {}, children, ...containerProps }) {
19
- tocEnabled ??= Boolean(toc.length > 0 || tocProps.header || tocProps.footer);
20
- const slots = {
21
- breadcrumb: breadcrumb.enabled !== false ? defaultSlots.breadcrumb ?? InlineBreadcrumb : void 0,
22
- footer: footer.enabled !== false ? defaultSlots.footer ?? InlineFooter : void 0,
23
- toc: tocEnabled ? defaultSlots.toc ?? InlineTOC : void 0,
24
- tocProvider: defaultSlots.tocProvider ?? TOCProvider,
25
- container: defaultSlots.container ?? Container
26
- };
27
- let content = /* @__PURE__ */ jsxs(Fragment$1, { children: [slots.toc && /* @__PURE__ */ jsx(slots.toc, {}), slots.container && /* @__PURE__ */ jsxs(slots.container, {
28
- ...containerProps,
29
- children: [
30
- slots.breadcrumb && /* @__PURE__ */ jsx(slots.breadcrumb, {}),
31
- children,
32
- slots.footer && /* @__PURE__ */ jsx(slots.footer, {})
33
- ]
34
- })] });
35
- if (slots.tocProvider) content = /* @__PURE__ */ jsx(slots.tocProvider, {
36
- single,
37
- toc: tocEnabled ? toc : [],
38
- children: content
39
- });
40
- return /* @__PURE__ */ jsx(PageContext, {
41
- value: {
42
- props: {
43
- full,
44
- tableOfContent: tocProps,
45
- footer,
46
- breadcrumb
47
- },
48
- slots
49
- },
50
- children: content
51
- });
52
- }
53
- function InlineBreadcrumb(props) {
54
- const { component, enabled: _, ...rest } = useDocsPage().props.breadcrumb ?? {};
55
- if (component) return component;
56
- return /* @__PURE__ */ jsx(Breadcrumb, {
57
- ...props,
58
- ...rest
59
- });
60
- }
61
- function InlineFooter(props) {
62
- const { component, enabled: _, ...rest } = useDocsPage().props.footer ?? {};
63
- if (component) return component;
64
- return /* @__PURE__ */ jsx(Footer, {
65
- ...props,
66
- ...rest
67
- });
68
- }
69
- function InlineTOC(props) {
70
- const { tableOfContent } = useDocsPage().props;
71
- if (tableOfContent.component) return tableOfContent.component;
72
- return /* @__PURE__ */ jsx(TOC, {
73
- ...props,
74
- ...tableOfContent
75
- });
76
- }
77
- function PageLastUpdate({ date: value, ...props }) {
78
- const { text } = useI18n();
79
- const [date, setDate] = useState("");
80
- useEffect(() => {
81
- setDate(value.toLocaleDateString());
82
- }, [value]);
83
- return /* @__PURE__ */ jsxs("p", {
84
- ...props,
85
- className: cn("text-sm text-fd-muted-foreground", props.className),
86
- children: [
87
- text.lastUpdate,
88
- " ",
89
- date
90
- ]
91
- });
92
- }
93
- //#endregion
94
- export { DocsPage, PageLastUpdate, useDocsPage };
@@ -1,98 +0,0 @@
1
- import { TOCProviderProps } from "../../../components/toc/index.js";
2
- import { TOCProps } from "./slots/toc.js";
3
- import { TOCPopoverProps } from "./slots/toc-popover.js";
4
- import { FooterProps } from "./slots/footer.js";
5
- import { BreadcrumbProps } from "./slots/breadcrumb.js";
6
- import { ComponentProps, FC, ReactNode } from "react";
7
- import * as react_jsx_runtime0 from "react/jsx-runtime";
8
- import { TOCItemType } from "fumadocs-core/toc";
9
-
10
- //#region src/layouts/notebook/page/client.d.ts
11
- interface DocsPageSlots {
12
- toc?: FC<TOCProps>;
13
- container?: FC<ComponentProps<'article'>>;
14
- tocPopover?: FC<TOCPopoverProps>;
15
- tocProvider?: FC<TOCProviderProps>;
16
- footer?: FC<FooterProps>;
17
- breadcrumb?: FC<BreadcrumbProps>;
18
- }
19
- interface DocsPageProps extends ComponentProps<'article'> {
20
- toc?: TOCItemType[];
21
- /**
22
- * Extend the page to fill all available space
23
- *
24
- * @defaultValue false
25
- */
26
- full?: boolean;
27
- slots?: DocsPageSlots;
28
- footer?: FooterOptions;
29
- breadcrumb?: BreadcrumbOptions;
30
- tableOfContent?: TableOfContentOptions;
31
- tableOfContentPopover?: TableOfContentPopoverOptions;
32
- }
33
- interface BreadcrumbOptions extends BreadcrumbProps {
34
- enabled?: boolean;
35
- /**
36
- * @deprecated use `slots.breadcrumb` instead.
37
- */
38
- component?: ReactNode;
39
- }
40
- interface FooterOptions extends FooterProps {
41
- enabled?: boolean;
42
- /**
43
- * @deprecated use `slots.footer` instead.
44
- */
45
- component?: ReactNode;
46
- }
47
- interface TableOfContentOptions extends Pick<TOCProviderProps, 'single'>, TOCProps {
48
- enabled?: boolean;
49
- /**
50
- * @deprecated use `slots.toc` instead.
51
- */
52
- component?: ReactNode;
53
- }
54
- interface TableOfContentPopoverOptions extends TOCPopoverProps {
55
- enabled?: boolean;
56
- /**
57
- * @deprecated use `slots.tocPopover` instead.
58
- */
59
- component?: ReactNode;
60
- }
61
- interface PageSlotsProps extends Pick<DocsPageProps, 'full' | 'breadcrumb' | 'footer'> {
62
- tableOfContent: TOCProps & {
63
- component?: ReactNode;
64
- };
65
- tableOfContentPopover: TOCPopoverProps & {
66
- component?: ReactNode;
67
- };
68
- }
69
- declare function useDocsPage(): {
70
- props: PageSlotsProps;
71
- slots: DocsPageSlots;
72
- };
73
- declare function DocsPage({
74
- tableOfContent: {
75
- enabled: tocEnabled,
76
- single,
77
- ...tocProps
78
- },
79
- tableOfContentPopover: {
80
- enabled: tocPopoverEnabled,
81
- ...tocPopoverProps
82
- },
83
- footer,
84
- breadcrumb,
85
- full,
86
- toc,
87
- slots: defaultSlots,
88
- children,
89
- ...containerProps
90
- }: DocsPageProps): react_jsx_runtime0.JSX.Element;
91
- declare function PageLastUpdate({
92
- date: value,
93
- ...props
94
- }: Omit<ComponentProps<'p'>, 'children'> & {
95
- date: Date;
96
- }): react_jsx_runtime0.JSX.Element;
97
- //#endregion
98
- export { DocsPage, DocsPageProps, DocsPageSlots, PageLastUpdate, useDocsPage };
@@ -1,110 +0,0 @@
1
- "use client";
2
- import { useI18n } from "../../../contexts/i18n.js";
3
- import { cn } from "../../../utils/cn.js";
4
- import { TOCProvider } from "../../../components/toc/index.js";
5
- import { TOC } from "./slots/toc.js";
6
- import { TOCPopover } from "./slots/toc-popover.js";
7
- import { Footer } from "./slots/footer.js";
8
- import { Breadcrumb } from "./slots/breadcrumb.js";
9
- import { Container } from "./slots/container.js";
10
- import { createContext, use, useEffect, useState } from "react";
11
- import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
12
- //#region src/layouts/notebook/page/client.tsx
13
- const PageContext = createContext(null);
14
- function useDocsPage() {
15
- const context = use(PageContext);
16
- if (!context) throw new Error("Please use page components under <DocsPage /> (`fumadocs-ui/layouts/notebook/page`).");
17
- return context;
18
- }
19
- function DocsPage({ tableOfContent: { enabled: tocEnabled, single = false, ...tocProps } = {}, tableOfContentPopover: { enabled: tocPopoverEnabled, ...tocPopoverProps } = {}, footer = {}, breadcrumb = {}, full = false, toc = [], slots: defaultSlots = {}, children, ...containerProps }) {
20
- tocEnabled ??= Boolean(!full && (toc.length > 0 || tocProps.footer || tocProps.header));
21
- tocPopoverEnabled ??= Boolean(toc.length > 0 || tocPopoverProps.header || tocPopoverProps.footer);
22
- const slots = {
23
- breadcrumb: breadcrumb.enabled !== false ? defaultSlots.breadcrumb ?? InlineBreadcrumb : void 0,
24
- footer: footer.enabled !== false ? defaultSlots.footer ?? InlineFooter : void 0,
25
- toc: tocEnabled ? defaultSlots.toc ?? InlineTOC : void 0,
26
- tocPopover: tocPopoverEnabled ? defaultSlots.tocPopover ?? InlineTOCPopover : void 0,
27
- tocProvider: defaultSlots.tocProvider ?? TOCProvider,
28
- container: defaultSlots.container ?? Container
29
- };
30
- let content = /* @__PURE__ */ jsxs(Fragment$1, { children: [
31
- slots.tocPopover && /* @__PURE__ */ jsx(slots.tocPopover, {}),
32
- slots.container && /* @__PURE__ */ jsxs(slots.container, {
33
- ...containerProps,
34
- children: [
35
- slots.breadcrumb && /* @__PURE__ */ jsx(slots.breadcrumb, {}),
36
- children,
37
- slots.footer && /* @__PURE__ */ jsx(slots.footer, {})
38
- ]
39
- }),
40
- slots.toc && /* @__PURE__ */ jsx(slots.toc, {})
41
- ] });
42
- if (slots.tocProvider) content = /* @__PURE__ */ jsx(slots.tocProvider, {
43
- single,
44
- toc: tocEnabled || tocPopoverEnabled ? toc : [],
45
- children: content
46
- });
47
- return /* @__PURE__ */ jsx(PageContext, {
48
- value: {
49
- props: {
50
- full,
51
- tableOfContent: tocProps,
52
- tableOfContentPopover: tocPopoverProps,
53
- footer,
54
- breadcrumb
55
- },
56
- slots
57
- },
58
- children: content
59
- });
60
- }
61
- function InlineBreadcrumb(props) {
62
- const { component, enabled: _, ...rest } = useDocsPage().props.breadcrumb ?? {};
63
- if (component) return component;
64
- return /* @__PURE__ */ jsx(Breadcrumb, {
65
- ...props,
66
- ...rest
67
- });
68
- }
69
- function InlineFooter(props) {
70
- const { component, enabled: _, ...rest } = useDocsPage().props.footer ?? {};
71
- if (component) return component;
72
- return /* @__PURE__ */ jsx(Footer, {
73
- ...props,
74
- ...rest
75
- });
76
- }
77
- function InlineTOCPopover(props) {
78
- const { tableOfContentPopover } = useDocsPage().props;
79
- if (tableOfContentPopover.component) return tableOfContentPopover.component;
80
- return /* @__PURE__ */ jsx(TOCPopover, {
81
- ...props,
82
- ...tableOfContentPopover
83
- });
84
- }
85
- function InlineTOC(props) {
86
- const { tableOfContent } = useDocsPage().props;
87
- if (tableOfContent.component) return tableOfContent.component;
88
- return /* @__PURE__ */ jsx(TOC, {
89
- ...props,
90
- ...tableOfContent
91
- });
92
- }
93
- function PageLastUpdate({ date: value, ...props }) {
94
- const { text } = useI18n();
95
- const [date, setDate] = useState("");
96
- useEffect(() => {
97
- setDate(value.toLocaleDateString());
98
- }, [value]);
99
- return /* @__PURE__ */ jsxs("p", {
100
- ...props,
101
- className: cn("text-sm text-fd-muted-foreground", props.className),
102
- children: [
103
- text.lastUpdate,
104
- " ",
105
- date
106
- ]
107
- });
108
- }
109
- //#endregion
110
- export { DocsPage, PageLastUpdate, useDocsPage };
@@ -1,31 +0,0 @@
1
- import { ComponentProps, ReactNode } from "react";
2
- import * as react_jsx_runtime0 from "react/jsx-runtime";
3
-
4
- //#region src/layouts/notebook/page/slots/toc-popover.d.ts
5
- interface TOCPopoverProps {
6
- container?: ComponentProps<'div'>;
7
- trigger?: ComponentProps<'button'>;
8
- content?: ComponentProps<'div'>;
9
- /**
10
- * Custom content in TOC container, before the main TOC
11
- */
12
- header?: ReactNode;
13
- /**
14
- * Custom content in TOC container, after the main TOC
15
- */
16
- footer?: ReactNode;
17
- /**
18
- * @defaultValue 'normal'
19
- */
20
- style?: 'normal' | 'clerk';
21
- }
22
- declare function TOCPopover({
23
- container,
24
- trigger,
25
- content,
26
- header,
27
- footer,
28
- style
29
- }: TOCPopoverProps): react_jsx_runtime0.JSX.Element;
30
- //#endregion
31
- export { TOCPopover, TOCPopoverProps };