fumadocs-ui 16.4.1 → 16.4.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/css/preset.css +2 -4
- package/dist/_virtual/rolldown_runtime.js +36 -0
- package/dist/components/accordion.d.ts +24 -7
- package/dist/components/accordion.d.ts.map +1 -1
- package/dist/components/accordion.js +65 -38
- package/dist/components/accordion.js.map +1 -0
- package/dist/components/banner.d.ts +33 -22
- package/dist/components/banner.d.ts.map +1 -1
- package/dist/components/banner.js +63 -47
- package/dist/components/banner.js.map +1 -0
- package/dist/components/callout.d.ts +41 -17
- package/dist/components/callout.d.ts.map +1 -1
- package/dist/components/callout.js +57 -28
- package/dist/components/callout.js.map +1 -0
- package/dist/components/card.d.ts +19 -9
- package/dist/components/card.d.ts.map +1 -1
- package/dist/components/card.js +39 -8
- package/dist/components/card.js.map +1 -0
- package/dist/components/codeblock.d.ts +61 -40
- package/dist/components/codeblock.d.ts.map +1 -1
- package/dist/components/codeblock.js +116 -58
- package/dist/components/codeblock.js.map +1 -0
- package/dist/components/dialog/search-algolia.d.ts +37 -23
- package/dist/components/dialog/search-algolia.d.ts.map +1 -1
- package/dist/components/dialog/search-algolia.js +64 -31
- package/dist/components/dialog/search-algolia.js.map +1 -0
- package/dist/components/dialog/search-default.d.ts +42 -27
- package/dist/components/dialog/search-default.d.ts.map +1 -1
- package/dist/components/dialog/search-default.js +64 -38
- package/dist/components/dialog/search-default.js.map +1 -0
- package/dist/components/dialog/search-orama.d.ts +41 -25
- package/dist/components/dialog/search-orama.d.ts.map +1 -1
- package/dist/components/dialog/search-orama.js +68 -35
- package/dist/components/dialog/search-orama.js.map +1 -0
- package/dist/components/dialog/search.d.ts +103 -64
- package/dist/components/dialog/search.d.ts.map +1 -1
- package/dist/components/dialog/search.js +264 -185
- package/dist/components/dialog/search.js.map +1 -0
- package/dist/components/dynamic-codeblock.d.ts +30 -19
- package/dist/components/dynamic-codeblock.d.ts.map +1 -1
- package/dist/components/dynamic-codeblock.js +60 -27
- package/dist/components/dynamic-codeblock.js.map +1 -0
- package/dist/components/files.d.ts +32 -16
- package/dist/components/files.d.ts.map +1 -1
- package/dist/components/files.js +40 -14
- package/dist/components/files.js.map +1 -0
- package/dist/components/github-info.d.ts +18 -7
- package/dist/components/github-info.d.ts.map +1 -1
- package/dist/components/github-info.js +63 -48
- package/dist/components/github-info.js.map +1 -0
- package/dist/components/heading.d.ts +11 -4
- package/dist/components/heading.d.ts.map +1 -1
- package/dist/components/heading.js +28 -8
- package/dist/components/heading.js.map +1 -0
- package/dist/components/image-zoom-CtfZieBH.css +80 -0
- package/dist/components/image-zoom-CtfZieBH.css.map +1 -0
- package/dist/components/image-zoom.d.ts +23 -14
- package/dist/components/image-zoom.d.ts.map +1 -1
- package/dist/components/image-zoom.js +32 -19
- package/dist/components/image-zoom.js.map +1 -0
- package/dist/components/image-zoom2.js +1 -0
- package/dist/components/inline-toc.d.ts +14 -6
- package/dist/components/inline-toc.d.ts.map +1 -1
- package/dist/components/inline-toc.js +28 -8
- package/dist/components/inline-toc.js.map +1 -0
- package/dist/components/sidebar/base.d.ts +100 -65
- package/dist/components/sidebar/base.d.ts.map +1 -1
- package/dist/components/sidebar/base.js +256 -180
- package/dist/components/sidebar/base.js.map +1 -0
- package/dist/components/sidebar/link-item.d.ts +23 -10
- package/dist/components/sidebar/link-item.d.ts.map +1 -1
- package/dist/components/sidebar/link-item.js +32 -12
- package/dist/components/sidebar/link-item.js.map +1 -0
- package/dist/components/sidebar/page-tree.d.ts +28 -17
- package/dist/components/sidebar/page-tree.d.ts.map +1 -1
- package/dist/components/sidebar/page-tree.js +57 -33
- package/dist/components/sidebar/page-tree.js.map +1 -0
- package/dist/components/sidebar/tabs/dropdown.d.ts +18 -9
- package/dist/components/sidebar/tabs/dropdown.d.ts.map +1 -1
- package/dist/components/sidebar/tabs/dropdown.js +75 -31
- package/dist/components/sidebar/tabs/dropdown.js.map +1 -0
- package/dist/components/sidebar/tabs/index.d.ts +24 -18
- package/dist/components/sidebar/tabs/index.d.ts.map +1 -1
- package/dist/components/sidebar/tabs/index.js +45 -45
- package/dist/components/sidebar/tabs/index.js.map +1 -0
- package/dist/components/steps.d.ts +16 -7
- package/dist/components/steps.d.ts.map +1 -1
- package/dist/components/steps.js +17 -5
- package/dist/components/steps.js.map +1 -0
- package/dist/components/tabs.d.ts +49 -28
- package/dist/components/tabs.d.ts.map +1 -1
- package/dist/components/tabs.js +88 -51
- package/dist/components/tabs.js.map +1 -0
- package/dist/components/toc/clerk.d.ts +1 -2
- package/dist/components/toc/clerk.js +12 -1
- package/dist/components/toc/clerk.js.map +1 -0
- package/dist/components/toc/default.d.ts +1 -2
- package/dist/components/toc/default.js +12 -1
- package/dist/components/toc/default.js.map +1 -0
- package/dist/components/toc/index.d.ts +1 -2
- package/dist/components/toc/index.js +12 -1
- package/dist/components/toc/index.js.map +1 -0
- package/dist/components/type-table.d.ts +36 -29
- package/dist/components/type-table.d.ts.map +1 -1
- package/dist/components/type-table.js +106 -25
- package/dist/components/type-table.js.map +1 -0
- package/dist/components/ui/accordion.d.ts +31 -7
- package/dist/components/ui/accordion.d.ts.map +1 -1
- package/dist/components/ui/accordion.js +40 -14
- package/dist/components/ui/accordion.js.map +1 -0
- package/dist/components/ui/button.d.ts +12 -7
- package/dist/components/ui/button.d.ts.map +1 -1
- package/dist/components/ui/button.js +21 -18
- package/dist/components/ui/button.js.map +1 -0
- package/dist/components/ui/collapsible.d.ts +12 -8
- package/dist/components/ui/collapsible.d.ts.map +1 -1
- package/dist/components/ui/collapsible.js +21 -11
- package/dist/components/ui/collapsible.js.map +1 -0
- package/dist/components/ui/navigation-menu.d.ts +8 -5
- package/dist/components/ui/navigation-menu.d.ts.map +1 -1
- package/dist/components/ui/navigation-menu.js +36 -9
- package/dist/components/ui/navigation-menu.js.map +1 -0
- package/dist/components/ui/popover.d.ts +6 -3
- package/dist/components/ui/popover.d.ts.map +1 -1
- package/dist/components/ui/popover.js +19 -6
- package/dist/components/ui/popover.js.map +1 -0
- package/dist/components/ui/scroll-area.d.ts +7 -4
- package/dist/components/ui/scroll-area.d.ts.map +1 -1
- package/dist/components/ui/scroll-area.js +33 -7
- package/dist/components/ui/scroll-area.js.map +1 -0
- package/dist/components/ui/tabs.d.ts +37 -19
- package/dist/components/ui/tabs.d.ts.map +1 -1
- package/dist/components/ui/tabs.js +75 -73
- package/dist/components/ui/tabs.js.map +1 -0
- package/dist/contexts/i18n.d.ts +1 -2
- package/dist/contexts/i18n.js +12 -1
- package/dist/contexts/i18n.js.map +1 -0
- package/dist/contexts/search.d.ts +7 -1
- package/dist/contexts/search.d.ts.map +1 -1
- package/dist/contexts/search.js +12 -1
- package/dist/contexts/search.js.map +1 -0
- package/dist/contexts/tree.d.ts +1 -2
- package/dist/contexts/tree.js +12 -1
- package/dist/contexts/tree.js.map +1 -0
- package/dist/i18n.d.ts +1 -2
- package/dist/i18n.js +3 -1
- package/dist/layouts/docs/client.d.ts +30 -13
- package/dist/layouts/docs/client.d.ts.map +1 -1
- package/dist/layouts/docs/client.js +61 -34
- package/dist/layouts/docs/client.js.map +1 -0
- package/dist/layouts/docs/index.d.ts +57 -33
- package/dist/layouts/docs/index.d.ts.map +1 -1
- package/dist/layouts/docs/index.js +178 -68
- package/dist/layouts/docs/index.js.map +1 -0
- package/dist/layouts/docs/page/client.d.ts +43 -21
- package/dist/layouts/docs/page/client.d.ts.map +1 -1
- package/dist/layouts/docs/page/client.js +213 -105
- package/dist/layouts/docs/page/client.js.map +1 -0
- package/dist/layouts/docs/page/index.d.ts +82 -46
- package/dist/layouts/docs/page/index.d.ts.map +1 -1
- package/dist/layouts/docs/page/index.js +98 -45
- package/dist/layouts/docs/page/index.js.map +1 -0
- package/dist/layouts/docs/sidebar.d.ts +57 -16
- package/dist/layouts/docs/sidebar.d.ts.map +1 -1
- package/dist/layouts/docs/sidebar.js +135 -82
- package/dist/layouts/docs/sidebar.js.map +1 -0
- package/dist/layouts/home/client.d.ts +18 -5
- package/dist/layouts/home/client.d.ts.map +1 -1
- package/dist/layouts/home/client.js +252 -103
- package/dist/layouts/home/client.js.map +1 -0
- package/dist/layouts/home/index.d.ts +15 -10
- package/dist/layouts/home/index.d.ts.map +1 -1
- package/dist/layouts/home/index.js +24 -7
- package/dist/layouts/home/index.js.map +1 -0
- package/dist/layouts/home/navbar.d.ts +13 -6
- package/dist/layouts/home/navbar.d.ts.map +1 -1
- package/dist/layouts/home/navbar.js +34 -12
- package/dist/layouts/home/navbar.js.map +1 -0
- package/dist/layouts/notebook/client.d.ts +44 -20
- package/dist/layouts/notebook/client.d.ts.map +1 -1
- package/dist/layouts/notebook/client.js +148 -93
- package/dist/layouts/notebook/client.js.map +1 -0
- package/dist/layouts/notebook/index.d.ts +34 -30
- package/dist/layouts/notebook/index.d.ts.map +1 -1
- package/dist/layouts/notebook/index.js +216 -90
- package/dist/layouts/notebook/index.js.map +1 -0
- package/dist/layouts/notebook/page/client.d.ts +43 -21
- package/dist/layouts/notebook/page/client.d.ts.map +1 -1
- package/dist/layouts/notebook/page/client.js +213 -105
- package/dist/layouts/notebook/page/client.js.map +1 -0
- package/dist/layouts/notebook/page/index.d.ts +82 -46
- package/dist/layouts/notebook/page/index.d.ts.map +1 -1
- package/dist/layouts/notebook/page/index.js +98 -45
- package/dist/layouts/notebook/page/index.js.map +1 -0
- package/dist/layouts/notebook/sidebar.d.ts +62 -20
- package/dist/layouts/notebook/sidebar.d.ts.map +1 -1
- package/dist/layouts/notebook/sidebar.js +130 -88
- package/dist/layouts/notebook/sidebar.js.map +1 -0
- package/dist/layouts/shared/index.d.ts +62 -50
- package/dist/layouts/shared/index.d.ts.map +1 -1
- package/dist/layouts/shared/index.js +36 -20
- package/dist/layouts/shared/index.js.map +1 -0
- package/dist/layouts/shared/language-toggle.d.ts +9 -4
- package/dist/layouts/shared/language-toggle.d.ts.map +1 -1
- package/dist/layouts/shared/language-toggle.js +44 -21
- package/dist/layouts/shared/language-toggle.js.map +1 -0
- package/dist/layouts/shared/search-toggle.d.ts +20 -8
- package/dist/layouts/shared/search-toggle.d.ts.map +1 -1
- package/dist/layouts/shared/search-toggle.js +53 -24
- package/dist/layouts/shared/search-toggle.js.map +1 -0
- package/dist/layouts/shared/theme-toggle.d.ts +13 -4
- package/dist/layouts/shared/theme-toggle.d.ts.map +1 -1
- package/dist/layouts/shared/theme-toggle.js +58 -34
- package/dist/layouts/shared/theme-toggle.js.map +1 -0
- package/dist/mdx.d.ts +34 -29
- package/dist/mdx.d.ts.map +1 -1
- package/dist/mdx.js +68 -34
- package/dist/mdx.js.map +1 -0
- package/dist/mdx.server.d.ts +9 -5
- package/dist/mdx.server.d.ts.map +1 -1
- package/dist/mdx.server.js +21 -13
- package/dist/mdx.server.js.map +1 -0
- package/dist/og.d.ts +1 -2
- package/dist/og.js +3 -1
- package/dist/page.d.ts +30 -20
- package/dist/page.d.ts.map +1 -1
- package/dist/page.js +34 -18
- package/dist/page.js.map +1 -0
- package/dist/provider/base.d.ts +43 -33
- package/dist/provider/base.d.ts.map +1 -1
- package/dist/provider/base.js +37 -17
- package/dist/provider/base.js.map +1 -0
- package/dist/provider/next.d.ts +20 -12
- package/dist/provider/next.d.ts.map +1 -1
- package/dist/provider/next.js +19 -5
- package/dist/provider/next.js.map +1 -0
- package/dist/provider/react-router.d.ts +20 -12
- package/dist/provider/react-router.d.ts.map +1 -1
- package/dist/provider/react-router.js +19 -5
- package/dist/provider/react-router.js.map +1 -0
- package/dist/provider/tanstack.d.ts +20 -12
- package/dist/provider/tanstack.d.ts.map +1 -1
- package/dist/provider/tanstack.js +19 -5
- package/dist/provider/tanstack.js.map +1 -0
- package/dist/provider/waku.d.ts +20 -12
- package/dist/provider/waku.d.ts.map +1 -1
- package/dist/provider/waku.js +19 -5
- package/dist/provider/waku.js.map +1 -0
- package/dist/style.css +11 -13
- package/dist/utils/use-copy-button.d.ts +1 -2
- package/dist/utils/use-copy-button.js +3 -1
- package/dist/utils/use-footer-items.d.ts +1 -2
- package/dist/utils/use-footer-items.js +3 -1
- package/dist/utils/use-is-scroll-top.d.ts +1 -2
- package/dist/utils/use-is-scroll-top.js +3 -1
- package/package.json +51 -52
- package/dist/components/toc/clerk.d.ts.map +0 -1
- package/dist/components/toc/default.d.ts.map +0 -1
- package/dist/components/toc/index.d.ts.map +0 -1
- package/dist/contexts/i18n.d.ts.map +0 -1
- package/dist/contexts/tree.d.ts.map +0 -1
- package/dist/i18n.d.ts.map +0 -1
- package/dist/og.d.ts.map +0 -1
- package/dist/utils/use-copy-button.d.ts.map +0 -1
- package/dist/utils/use-footer-items.d.ts.map +0 -1
- package/dist/utils/use-is-scroll-top.d.ts.map +0 -1
package/dist/components/tabs.js
CHANGED
|
@@ -1,64 +1,101 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import * as
|
|
2
|
+
|
|
3
|
+
import { Tabs as Tabs$1, TabsContent as TabsContent$1, TabsList as TabsList$1, TabsTrigger as TabsTrigger$1 } from "./ui/tabs.js";
|
|
4
|
+
import { cn } from "@fumadocs/ui/cn";
|
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
import * as React from "react";
|
|
7
|
+
import { createContext, useContext, useEffect, useId, useMemo, useState } from "react";
|
|
8
|
+
|
|
9
|
+
//#region src/components/tabs.tsx
|
|
7
10
|
const TabsContext = createContext(null);
|
|
8
11
|
function useTabContext() {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
return ctx;
|
|
12
|
+
const ctx = useContext(TabsContext);
|
|
13
|
+
if (!ctx) throw new Error("You must wrap your component in <Tabs>");
|
|
14
|
+
return ctx;
|
|
13
15
|
}
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
16
|
+
const TabsList = React.forwardRef((props, ref) => /* @__PURE__ */ jsx(TabsList$1, {
|
|
17
|
+
ref,
|
|
18
|
+
...props,
|
|
19
|
+
className: cn("flex gap-3.5 text-fd-secondary-foreground overflow-x-auto px-4 not-prose", props.className)
|
|
20
|
+
}));
|
|
21
|
+
TabsList.displayName = "TabsList";
|
|
22
|
+
const TabsTrigger = React.forwardRef((props, ref) => /* @__PURE__ */ jsx(TabsTrigger$1, {
|
|
23
|
+
ref,
|
|
24
|
+
...props,
|
|
25
|
+
className: cn("inline-flex items-center gap-2 whitespace-nowrap text-fd-muted-foreground border-b border-transparent py-2 text-sm font-medium transition-colors [&_svg]:size-4 hover:text-fd-accent-foreground disabled:pointer-events-none disabled:opacity-50 data-[state=active]:border-fd-primary data-[state=active]:text-fd-primary", props.className)
|
|
26
|
+
}));
|
|
27
|
+
TabsTrigger.displayName = "TabsTrigger";
|
|
28
|
+
function Tabs({ ref, className, items, label, defaultIndex = 0, defaultValue = items ? escapeValue(items[defaultIndex]) : void 0, ...props }) {
|
|
29
|
+
const [value, setValue] = useState(defaultValue);
|
|
30
|
+
const collection = useMemo(() => [], []);
|
|
31
|
+
return /* @__PURE__ */ jsxs(Tabs$1, {
|
|
32
|
+
ref,
|
|
33
|
+
className: cn("flex flex-col overflow-hidden rounded-xl border bg-fd-secondary my-4", className),
|
|
34
|
+
value,
|
|
35
|
+
onValueChange: (v) => {
|
|
36
|
+
if (items && !items.some((item) => escapeValue(item) === v)) return;
|
|
37
|
+
setValue(v);
|
|
38
|
+
},
|
|
39
|
+
...props,
|
|
40
|
+
children: [items && /* @__PURE__ */ jsxs(TabsList, { children: [label && /* @__PURE__ */ jsx("span", {
|
|
41
|
+
className: "text-sm font-medium my-auto me-auto",
|
|
42
|
+
children: label
|
|
43
|
+
}), items.map((item) => /* @__PURE__ */ jsx(TabsTrigger, {
|
|
44
|
+
value: escapeValue(item),
|
|
45
|
+
children: item
|
|
46
|
+
}, item))] }), /* @__PURE__ */ jsx(TabsContext.Provider, {
|
|
47
|
+
value: useMemo(() => ({
|
|
48
|
+
items,
|
|
49
|
+
collection
|
|
50
|
+
}), [collection, items]),
|
|
51
|
+
children: props.children
|
|
52
|
+
})]
|
|
53
|
+
});
|
|
26
54
|
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
55
|
+
function Tab({ value, ...props }) {
|
|
56
|
+
const { items } = useTabContext();
|
|
57
|
+
const resolved = value ?? items?.at(useCollectionIndex());
|
|
58
|
+
if (!resolved) throw new Error("Failed to resolve tab `value`, please pass a `value` prop to the Tab component.");
|
|
59
|
+
return /* @__PURE__ */ jsx(TabsContent, {
|
|
60
|
+
value: escapeValue(resolved),
|
|
61
|
+
...props,
|
|
62
|
+
children: props.children
|
|
63
|
+
});
|
|
35
64
|
}
|
|
36
|
-
|
|
37
|
-
|
|
65
|
+
function TabsContent({ value, className, ...props }) {
|
|
66
|
+
return /* @__PURE__ */ jsx(TabsContent$1, {
|
|
67
|
+
value,
|
|
68
|
+
forceMount: true,
|
|
69
|
+
className: cn("p-4 text-[0.9375rem] bg-fd-background rounded-xl outline-none prose-no-margin data-[state=inactive]:hidden [&>figure:only-child]:-m-4 [&>figure:only-child]:border-none", className),
|
|
70
|
+
...props,
|
|
71
|
+
children: props.children
|
|
72
|
+
});
|
|
38
73
|
}
|
|
39
74
|
/**
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
75
|
+
* Inspired by Headless UI.
|
|
76
|
+
*
|
|
77
|
+
* Return the index of children, this is made possible by registering the order of render from children using React context.
|
|
78
|
+
* This is supposed by work with pre-rendering & pure client-side rendering.
|
|
79
|
+
*/
|
|
45
80
|
function useCollectionIndex() {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
collection.push(key);
|
|
57
|
-
return collection.indexOf(key);
|
|
81
|
+
const key = useId();
|
|
82
|
+
const { collection } = useTabContext();
|
|
83
|
+
useEffect(() => {
|
|
84
|
+
return () => {
|
|
85
|
+
const idx = collection.indexOf(key);
|
|
86
|
+
if (idx !== -1) collection.splice(idx, 1);
|
|
87
|
+
};
|
|
88
|
+
}, [key, collection]);
|
|
89
|
+
if (!collection.includes(key)) collection.push(key);
|
|
90
|
+
return collection.indexOf(key);
|
|
58
91
|
}
|
|
59
92
|
/**
|
|
60
|
-
|
|
61
|
-
|
|
93
|
+
* only escape whitespaces in values in simple mode
|
|
94
|
+
*/
|
|
62
95
|
function escapeValue(v) {
|
|
63
|
-
|
|
96
|
+
return v.toLowerCase().replace(/\s/, "-");
|
|
64
97
|
}
|
|
98
|
+
|
|
99
|
+
//#endregion
|
|
100
|
+
export { Tab, Tabs, TabsContent, TabsList, TabsTrigger };
|
|
101
|
+
//# sourceMappingURL=tabs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tabs.js","names":["Unstyled.TabsList","Unstyled.TabsTrigger","Unstyled.Tabs","Unstyled.TabsContent"],"sources":["../../src/components/tabs.tsx"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport {\n type ComponentProps,\n createContext,\n type ReactNode,\n useContext,\n useEffect,\n useId,\n useMemo,\n useState,\n} from 'react';\nimport { cn } from '@fumadocs/ui/cn';\nimport * as Unstyled from './ui/tabs';\n\ntype CollectionKey = string | symbol;\n\nexport interface TabsProps extends Omit<\n ComponentProps<typeof Unstyled.Tabs>,\n 'value' | 'onValueChange'\n> {\n /**\n * Use simple mode instead of advanced usage as documented in https://radix-ui.com/primitives/docs/components/tabs.\n */\n items?: string[];\n\n /**\n * Shortcut for `defaultValue` when `items` is provided.\n *\n * @defaultValue 0\n */\n defaultIndex?: number;\n\n /**\n * Additional label in tabs list when `items` is provided.\n */\n label?: ReactNode;\n}\n\nconst TabsContext = createContext<{\n items?: string[];\n collection: CollectionKey[];\n} | null>(null);\n\nfunction useTabContext() {\n const ctx = useContext(TabsContext);\n if (!ctx) throw new Error('You must wrap your component in <Tabs>');\n return ctx;\n}\n\nexport const TabsList = React.forwardRef<\n React.ComponentRef<typeof Unstyled.TabsList>,\n React.ComponentPropsWithoutRef<typeof Unstyled.TabsList>\n>((props, ref) => (\n <Unstyled.TabsList\n ref={ref}\n {...props}\n className={cn(\n 'flex gap-3.5 text-fd-secondary-foreground overflow-x-auto px-4 not-prose',\n props.className,\n )}\n />\n));\nTabsList.displayName = 'TabsList';\n\nexport const TabsTrigger = React.forwardRef<\n React.ComponentRef<typeof Unstyled.TabsTrigger>,\n React.ComponentPropsWithoutRef<typeof Unstyled.TabsTrigger>\n>((props, ref) => (\n <Unstyled.TabsTrigger\n ref={ref}\n {...props}\n className={cn(\n 'inline-flex items-center gap-2 whitespace-nowrap text-fd-muted-foreground border-b border-transparent py-2 text-sm font-medium transition-colors [&_svg]:size-4 hover:text-fd-accent-foreground disabled:pointer-events-none disabled:opacity-50 data-[state=active]:border-fd-primary data-[state=active]:text-fd-primary',\n props.className,\n )}\n />\n));\nTabsTrigger.displayName = 'TabsTrigger';\n\nexport function Tabs({\n ref,\n className,\n items,\n label,\n defaultIndex = 0,\n defaultValue = items ? escapeValue(items[defaultIndex]) : undefined,\n ...props\n}: TabsProps) {\n const [value, setValue] = useState(defaultValue);\n const collection = useMemo<CollectionKey[]>(() => [], []);\n\n return (\n <Unstyled.Tabs\n ref={ref}\n className={cn(\n 'flex flex-col overflow-hidden rounded-xl border bg-fd-secondary my-4',\n className,\n )}\n value={value}\n onValueChange={(v: string) => {\n if (items && !items.some((item) => escapeValue(item) === v)) return;\n setValue(v);\n }}\n {...props}\n >\n {items && (\n <TabsList>\n {label && <span className=\"text-sm font-medium my-auto me-auto\">{label}</span>}\n {items.map((item) => (\n <TabsTrigger key={item} value={escapeValue(item)}>\n {item}\n </TabsTrigger>\n ))}\n </TabsList>\n )}\n <TabsContext.Provider value={useMemo(() => ({ items, collection }), [collection, items])}>\n {props.children}\n </TabsContext.Provider>\n </Unstyled.Tabs>\n );\n}\n\nexport interface TabProps extends Omit<ComponentProps<typeof Unstyled.TabsContent>, 'value'> {\n /**\n * Value of tab, detect from index if unspecified.\n */\n value?: string;\n}\n\nexport function Tab({ value, ...props }: TabProps) {\n const { items } = useTabContext();\n const resolved =\n value ??\n // eslint-disable-next-line react-hooks/rules-of-hooks -- `value` is not supposed to change\n items?.at(useCollectionIndex());\n if (!resolved)\n throw new Error(\n 'Failed to resolve tab `value`, please pass a `value` prop to the Tab component.',\n );\n\n return (\n <TabsContent value={escapeValue(resolved)} {...props}>\n {props.children}\n </TabsContent>\n );\n}\n\nexport function TabsContent({\n value,\n className,\n ...props\n}: ComponentProps<typeof Unstyled.TabsContent>) {\n return (\n <Unstyled.TabsContent\n value={value}\n forceMount\n className={cn(\n 'p-4 text-[0.9375rem] bg-fd-background rounded-xl outline-none prose-no-margin data-[state=inactive]:hidden [&>figure:only-child]:-m-4 [&>figure:only-child]:border-none',\n className,\n )}\n {...props}\n >\n {props.children}\n </Unstyled.TabsContent>\n );\n}\n\n/**\n * Inspired by Headless UI.\n *\n * Return the index of children, this is made possible by registering the order of render from children using React context.\n * This is supposed by work with pre-rendering & pure client-side rendering.\n */\nfunction useCollectionIndex() {\n const key = useId();\n const { collection } = useTabContext();\n\n useEffect(() => {\n return () => {\n const idx = collection.indexOf(key);\n if (idx !== -1) collection.splice(idx, 1);\n };\n }, [key, collection]);\n\n if (!collection.includes(key)) collection.push(key);\n return collection.indexOf(key);\n}\n\n/**\n * only escape whitespaces in values in simple mode\n */\nfunction escapeValue(v: string): string {\n return v.toLowerCase().replace(/\\s/, '-');\n}\n"],"mappings":";;;;;;;;;AAwCA,MAAM,cAAc,cAGV,KAAK;AAEf,SAAS,gBAAgB;CACvB,MAAM,MAAM,WAAW,YAAY;AACnC,KAAI,CAAC,IAAK,OAAM,IAAI,MAAM,yCAAyC;AACnE,QAAO;;AAGT,MAAa,WAAW,MAAM,YAG3B,OAAO,QACR,oBAACA;CACM;CACL,GAAI;CACJ,WAAW,GACT,4EACA,MAAM,UACP;EACD,CACF;AACF,SAAS,cAAc;AAEvB,MAAa,cAAc,MAAM,YAG9B,OAAO,QACR,oBAACC;CACM;CACL,GAAI;CACJ,WAAW,GACT,8TACA,MAAM,UACP;EACD,CACF;AACF,YAAY,cAAc;AAE1B,SAAgB,KAAK,EACnB,KACA,WACA,OACA,OACA,eAAe,GACf,eAAe,QAAQ,YAAY,MAAM,cAAc,GAAG,QAC1D,GAAG,SACS;CACZ,MAAM,CAAC,OAAO,YAAY,SAAS,aAAa;CAChD,MAAM,aAAa,cAA+B,EAAE,EAAE,EAAE,CAAC;AAEzD,QACE,qBAACC;EACM;EACL,WAAW,GACT,wEACA,UACD;EACM;EACP,gBAAgB,MAAc;AAC5B,OAAI,SAAS,CAAC,MAAM,MAAM,SAAS,YAAY,KAAK,KAAK,EAAE,CAAE;AAC7D,YAAS,EAAE;;EAEb,GAAI;aAEH,SACC,qBAAC,uBACE,SAAS,oBAAC;GAAK,WAAU;aAAuC;IAAa,EAC7E,MAAM,KAAK,SACV,oBAAC;GAAuB,OAAO,YAAY,KAAK;aAC7C;KADe,KAEJ,CACd,IACO,EAEb,oBAAC,YAAY;GAAS,OAAO,eAAe;IAAE;IAAO;IAAY,GAAG,CAAC,YAAY,MAAM,CAAC;aACrF,MAAM;IACc;GACT;;AAWpB,SAAgB,IAAI,EAAE,OAAO,GAAG,SAAmB;CACjD,MAAM,EAAE,UAAU,eAAe;CACjC,MAAM,WACJ,SAEA,OAAO,GAAG,oBAAoB,CAAC;AACjC,KAAI,CAAC,SACH,OAAM,IAAI,MACR,kFACD;AAEH,QACE,oBAAC;EAAY,OAAO,YAAY,SAAS;EAAE,GAAI;YAC5C,MAAM;GACK;;AAIlB,SAAgB,YAAY,EAC1B,OACA,WACA,GAAG,SAC2C;AAC9C,QACE,oBAACC;EACQ;EACP;EACA,WAAW,GACT,2KACA,UACD;EACD,GAAI;YAEH,MAAM;GACc;;;;;;;;AAU3B,SAAS,qBAAqB;CAC5B,MAAM,MAAM,OAAO;CACnB,MAAM,EAAE,eAAe,eAAe;AAEtC,iBAAgB;AACd,eAAa;GACX,MAAM,MAAM,WAAW,QAAQ,IAAI;AACnC,OAAI,QAAQ,GAAI,YAAW,OAAO,KAAK,EAAE;;IAE1C,CAAC,KAAK,WAAW,CAAC;AAErB,KAAI,CAAC,WAAW,SAAS,IAAI,CAAE,YAAW,KAAK,IAAI;AACnD,QAAO,WAAW,QAAQ,IAAI;;;;;AAMhC,SAAS,YAAY,GAAmB;AACtC,QAAO,EAAE,aAAa,CAAC,QAAQ,MAAM,IAAI"}
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
export * from
|
|
2
|
-
//# sourceMappingURL=clerk.d.ts.map
|
|
1
|
+
export * from "@fumadocs/ui/components/toc/clerk";
|
|
@@ -1 +1,12 @@
|
|
|
1
|
-
|
|
1
|
+
import { __reExport } from "../../_virtual/rolldown_runtime.js";
|
|
2
|
+
|
|
3
|
+
export * from "@fumadocs/ui/components/toc/clerk"
|
|
4
|
+
|
|
5
|
+
//#region src/components/toc/clerk.tsx
|
|
6
|
+
var clerk_exports = {};
|
|
7
|
+
import * as import__fumadocs_ui_components_toc_clerk from "@fumadocs/ui/components/toc/clerk";
|
|
8
|
+
__reExport(clerk_exports, import__fumadocs_ui_components_toc_clerk);
|
|
9
|
+
|
|
10
|
+
//#endregion
|
|
11
|
+
export { clerk_exports };
|
|
12
|
+
//# sourceMappingURL=clerk.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clerk.js","names":[],"sources":["../../../src/components/toc/clerk.tsx"],"sourcesContent":["export * from '@fumadocs/ui/components/toc/clerk';\n"],"mappings":""}
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
export * from
|
|
2
|
-
//# sourceMappingURL=default.d.ts.map
|
|
1
|
+
export * from "@fumadocs/ui/components/toc/default";
|
|
@@ -1 +1,12 @@
|
|
|
1
|
-
|
|
1
|
+
import { __reExport } from "../../_virtual/rolldown_runtime.js";
|
|
2
|
+
|
|
3
|
+
export * from "@fumadocs/ui/components/toc/default"
|
|
4
|
+
|
|
5
|
+
//#region src/components/toc/default.tsx
|
|
6
|
+
var default_exports = {};
|
|
7
|
+
import * as import__fumadocs_ui_components_toc_default from "@fumadocs/ui/components/toc/default";
|
|
8
|
+
__reExport(default_exports, import__fumadocs_ui_components_toc_default);
|
|
9
|
+
|
|
10
|
+
//#endregion
|
|
11
|
+
export { default_exports };
|
|
12
|
+
//# sourceMappingURL=default.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"default.js","names":[],"sources":["../../../src/components/toc/default.tsx"],"sourcesContent":["export * from '@fumadocs/ui/components/toc/default';\n"],"mappings":""}
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
export * from
|
|
2
|
-
//# sourceMappingURL=index.d.ts.map
|
|
1
|
+
export * from "@fumadocs/ui/components/toc/index";
|
|
@@ -1 +1,12 @@
|
|
|
1
|
-
|
|
1
|
+
import { __reExport } from "../../_virtual/rolldown_runtime.js";
|
|
2
|
+
|
|
3
|
+
export * from "@fumadocs/ui/components/toc/index"
|
|
4
|
+
|
|
5
|
+
//#region src/components/toc/index.tsx
|
|
6
|
+
var toc_exports = {};
|
|
7
|
+
import * as import__fumadocs_ui_components_toc_index from "@fumadocs/ui/components/toc/index";
|
|
8
|
+
__reExport(toc_exports, import__fumadocs_ui_components_toc_index);
|
|
9
|
+
|
|
10
|
+
//#endregion
|
|
11
|
+
export { toc_exports };
|
|
12
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../src/components/toc/index.tsx"],"sourcesContent":["export * from '@fumadocs/ui/components/toc/index';\n"],"mappings":""}
|
|
@@ -1,32 +1,39 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import * as react_jsx_runtime32 from "react/jsx-runtime";
|
|
2
|
+
import { ReactNode } from "react";
|
|
3
|
+
|
|
4
|
+
//#region src/components/type-table.d.ts
|
|
5
|
+
interface ParameterNode {
|
|
6
|
+
name: string;
|
|
7
|
+
description: ReactNode;
|
|
5
8
|
}
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
9
|
+
interface TypeNode {
|
|
10
|
+
/**
|
|
11
|
+
* Additional description of the field
|
|
12
|
+
*/
|
|
13
|
+
description?: ReactNode;
|
|
14
|
+
/**
|
|
15
|
+
* type signature (short)
|
|
16
|
+
*/
|
|
17
|
+
type: ReactNode;
|
|
18
|
+
/**
|
|
19
|
+
* type signature (full)
|
|
20
|
+
*/
|
|
21
|
+
typeDescription?: ReactNode;
|
|
22
|
+
/**
|
|
23
|
+
* Optional `href` for the type
|
|
24
|
+
*/
|
|
25
|
+
typeDescriptionLink?: string;
|
|
26
|
+
default?: ReactNode;
|
|
27
|
+
required?: boolean;
|
|
28
|
+
deprecated?: boolean;
|
|
29
|
+
parameters?: ParameterNode[];
|
|
30
|
+
returns?: ReactNode;
|
|
28
31
|
}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
}
|
|
32
|
+
declare function TypeTable({
|
|
33
|
+
type
|
|
34
|
+
}: {
|
|
35
|
+
type: Record<string, TypeNode>;
|
|
36
|
+
}): react_jsx_runtime32.JSX.Element;
|
|
37
|
+
//#endregion
|
|
38
|
+
export { ParameterNode, TypeNode, TypeTable };
|
|
32
39
|
//# sourceMappingURL=type-table.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"type-table.d.ts","
|
|
1
|
+
{"version":3,"file":"type-table.d.ts","names":[],"sources":["../../src/components/type-table.tsx"],"sourcesContent":[],"mappings":";;;;UASiB,aAAA;;eAEF;AAFf;AAKiB,UAAA,QAAA,CAAQ;EAIT;;;EAiBJ,WAAA,CAAA,EAjBI,SAiBJ;EAKG;;;EAeC,IAAA,EAhCR,SAgCiB;EAAG;;;EAA0C,eAAA,CAAA,EA3BlD,SA2BkD;EAAA;;;;YApB1D;;;eAKG;YAEH;;iBAaI,SAAA;;;QAA4B,eAAe;IAAW,mBAAA,CAAA,GAAA,CAAA"}
|
|
@@ -1,28 +1,109 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
import Link from
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
2
|
+
|
|
3
|
+
import { Collapsible, CollapsibleContent, CollapsibleTrigger } from "./ui/collapsible.js";
|
|
4
|
+
import Link from "fumadocs-core/link";
|
|
5
|
+
import { cn } from "@fumadocs/ui/cn";
|
|
6
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
import { ChevronDown } from "lucide-react";
|
|
8
|
+
import { useState } from "react";
|
|
9
|
+
import { cva } from "class-variance-authority";
|
|
10
|
+
|
|
11
|
+
//#region src/components/type-table.tsx
|
|
12
|
+
const keyVariants = cva("text-fd-primary", { variants: { deprecated: { true: "line-through text-fd-primary/50" } } });
|
|
13
|
+
const fieldVariants = cva("text-fd-muted-foreground not-prose pe-2");
|
|
14
|
+
function TypeTable({ type }) {
|
|
15
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
16
|
+
className: "@container flex flex-col p-1 bg-fd-card text-fd-card-foreground rounded-2xl border my-6 text-sm overflow-hidden",
|
|
17
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
18
|
+
className: "flex font-medium items-center px-3 py-1 not-prose text-fd-muted-foreground",
|
|
19
|
+
children: [/* @__PURE__ */ jsx("p", {
|
|
20
|
+
className: "w-[25%]",
|
|
21
|
+
children: "Prop"
|
|
22
|
+
}), /* @__PURE__ */ jsx("p", {
|
|
23
|
+
className: "@max-xl:hidden",
|
|
24
|
+
children: "Type"
|
|
25
|
+
})]
|
|
26
|
+
}), Object.entries(type).map(([key, value]) => /* @__PURE__ */ jsx(Item, {
|
|
27
|
+
name: key,
|
|
28
|
+
item: value
|
|
29
|
+
}, key))]
|
|
30
|
+
});
|
|
19
31
|
}
|
|
20
|
-
function Item({ name, item: { parameters = [], description, required = false, deprecated, typeDescription, default: defaultValue, type, typeDescriptionLink, returns
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
32
|
+
function Item({ name, item: { parameters = [], description, required = false, deprecated, typeDescription, default: defaultValue, type, typeDescriptionLink, returns } }) {
|
|
33
|
+
const [open, setOpen] = useState(false);
|
|
34
|
+
return /* @__PURE__ */ jsxs(Collapsible, {
|
|
35
|
+
open,
|
|
36
|
+
onOpenChange: setOpen,
|
|
37
|
+
className: cn("rounded-xl border overflow-hidden transition-all", open ? "shadow-sm bg-fd-background not-last:mb-2" : "border-transparent"),
|
|
38
|
+
children: [/* @__PURE__ */ jsxs(CollapsibleTrigger, {
|
|
39
|
+
className: "relative flex flex-row items-center w-full group text-start px-3 py-2 not-prose hover:bg-fd-accent",
|
|
40
|
+
children: [
|
|
41
|
+
/* @__PURE__ */ jsxs("code", {
|
|
42
|
+
className: cn(keyVariants({
|
|
43
|
+
deprecated,
|
|
44
|
+
className: "min-w-fit w-[25%] font-medium pe-2"
|
|
45
|
+
})),
|
|
46
|
+
children: [name, !required && "?"]
|
|
47
|
+
}),
|
|
48
|
+
typeDescriptionLink ? /* @__PURE__ */ jsx(Link, {
|
|
49
|
+
href: typeDescriptionLink,
|
|
50
|
+
className: "underline @max-xl:hidden",
|
|
51
|
+
children: type
|
|
52
|
+
}) : /* @__PURE__ */ jsx("span", {
|
|
53
|
+
className: "@max-xl:hidden",
|
|
54
|
+
children: type
|
|
55
|
+
}),
|
|
56
|
+
/* @__PURE__ */ jsx(ChevronDown, { className: "absolute end-2 size-4 text-fd-muted-foreground transition-transform group-data-[state=open]:rotate-180" })
|
|
57
|
+
]
|
|
58
|
+
}), /* @__PURE__ */ jsx(CollapsibleContent, { children: /* @__PURE__ */ jsxs("div", {
|
|
59
|
+
className: "grid grid-cols-[1fr_3fr] gap-y-4 text-sm p-3 overflow-auto fd-scroll-container border-t",
|
|
60
|
+
children: [
|
|
61
|
+
/* @__PURE__ */ jsx("div", {
|
|
62
|
+
className: "text-sm prose col-span-full prose-no-margin empty:hidden",
|
|
63
|
+
children: description
|
|
64
|
+
}),
|
|
65
|
+
typeDescription && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("p", {
|
|
66
|
+
className: cn(fieldVariants()),
|
|
67
|
+
children: "Type"
|
|
68
|
+
}), /* @__PURE__ */ jsx("p", {
|
|
69
|
+
className: "my-auto not-prose",
|
|
70
|
+
children: typeDescription
|
|
71
|
+
})] }),
|
|
72
|
+
defaultValue && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("p", {
|
|
73
|
+
className: cn(fieldVariants()),
|
|
74
|
+
children: "Default"
|
|
75
|
+
}), /* @__PURE__ */ jsx("p", {
|
|
76
|
+
className: "my-auto not-prose",
|
|
77
|
+
children: defaultValue
|
|
78
|
+
})] }),
|
|
79
|
+
parameters.length > 0 && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("p", {
|
|
80
|
+
className: cn(fieldVariants()),
|
|
81
|
+
children: "Parameters"
|
|
82
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
83
|
+
className: "flex flex-col gap-2",
|
|
84
|
+
children: parameters.map((param) => /* @__PURE__ */ jsxs("div", {
|
|
85
|
+
className: "inline-flex items-center flex-wrap gap-1",
|
|
86
|
+
children: [/* @__PURE__ */ jsxs("p", {
|
|
87
|
+
className: "font-medium not-prose text-nowrap",
|
|
88
|
+
children: [param.name, " -"]
|
|
89
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
90
|
+
className: "text-sm prose prose-no-margin",
|
|
91
|
+
children: param.description
|
|
92
|
+
})]
|
|
93
|
+
}, param.name))
|
|
94
|
+
})] }),
|
|
95
|
+
returns && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("p", {
|
|
96
|
+
className: cn(fieldVariants()),
|
|
97
|
+
children: "Returns"
|
|
98
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
99
|
+
className: "my-auto text-sm prose prose-no-margin",
|
|
100
|
+
children: returns
|
|
101
|
+
})] })
|
|
102
|
+
]
|
|
103
|
+
}) })]
|
|
104
|
+
});
|
|
28
105
|
}
|
|
106
|
+
|
|
107
|
+
//#endregion
|
|
108
|
+
export { TypeTable };
|
|
109
|
+
//# sourceMappingURL=type-table.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"type-table.js","names":[],"sources":["../../src/components/type-table.tsx"],"sourcesContent":["'use client';\n\nimport { ChevronDown } from 'lucide-react';\nimport Link from 'fumadocs-core/link';\nimport { cva } from 'class-variance-authority';\nimport { cn } from '@fumadocs/ui/cn';\nimport { type ReactNode, useState } from 'react';\nimport { Collapsible, CollapsibleContent, CollapsibleTrigger } from '@/components/ui/collapsible';\n\nexport interface ParameterNode {\n name: string;\n description: ReactNode;\n}\n\nexport interface TypeNode {\n /**\n * Additional description of the field\n */\n description?: ReactNode;\n\n /**\n * type signature (short)\n */\n type: ReactNode;\n\n /**\n * type signature (full)\n */\n typeDescription?: ReactNode;\n\n /**\n * Optional `href` for the type\n */\n typeDescriptionLink?: string;\n\n default?: ReactNode;\n\n required?: boolean;\n deprecated?: boolean;\n\n parameters?: ParameterNode[];\n\n returns?: ReactNode;\n}\n\nconst keyVariants = cva('text-fd-primary', {\n variants: {\n deprecated: {\n true: 'line-through text-fd-primary/50',\n },\n },\n});\n\nconst fieldVariants = cva('text-fd-muted-foreground not-prose pe-2');\n\nexport function TypeTable({ type }: { type: Record<string, TypeNode> }) {\n return (\n <div className=\"@container flex flex-col p-1 bg-fd-card text-fd-card-foreground rounded-2xl border my-6 text-sm overflow-hidden\">\n <div className=\"flex font-medium items-center px-3 py-1 not-prose text-fd-muted-foreground\">\n <p className=\"w-[25%]\">Prop</p>\n <p className=\"@max-xl:hidden\">Type</p>\n </div>\n {Object.entries(type).map(([key, value]) => (\n <Item key={key} name={key} item={value} />\n ))}\n </div>\n );\n}\n\nfunction Item({\n name,\n item: {\n parameters = [],\n description,\n required = false,\n deprecated,\n typeDescription,\n default: defaultValue,\n type,\n typeDescriptionLink,\n returns,\n },\n}: {\n name: string;\n item: TypeNode;\n}) {\n const [open, setOpen] = useState(false);\n\n return (\n <Collapsible\n open={open}\n onOpenChange={setOpen}\n className={cn(\n 'rounded-xl border overflow-hidden transition-all',\n open ? 'shadow-sm bg-fd-background not-last:mb-2' : 'border-transparent',\n )}\n >\n <CollapsibleTrigger className=\"relative flex flex-row items-center w-full group text-start px-3 py-2 not-prose hover:bg-fd-accent\">\n <code\n className={cn(\n keyVariants({\n deprecated,\n className: 'min-w-fit w-[25%] font-medium pe-2',\n }),\n )}\n >\n {name}\n {!required && '?'}\n </code>\n {typeDescriptionLink ? (\n <Link href={typeDescriptionLink} className=\"underline @max-xl:hidden\">\n {type}\n </Link>\n ) : (\n <span className=\"@max-xl:hidden\">{type}</span>\n )}\n <ChevronDown className=\"absolute end-2 size-4 text-fd-muted-foreground transition-transform group-data-[state=open]:rotate-180\" />\n </CollapsibleTrigger>\n <CollapsibleContent>\n <div className=\"grid grid-cols-[1fr_3fr] gap-y-4 text-sm p-3 overflow-auto fd-scroll-container border-t\">\n <div className=\"text-sm prose col-span-full prose-no-margin empty:hidden\">\n {description}\n </div>\n {typeDescription && (\n <>\n <p className={cn(fieldVariants())}>Type</p>\n <p className=\"my-auto not-prose\">{typeDescription}</p>\n </>\n )}\n {defaultValue && (\n <>\n <p className={cn(fieldVariants())}>Default</p>\n <p className=\"my-auto not-prose\">{defaultValue}</p>\n </>\n )}\n {parameters.length > 0 && (\n <>\n <p className={cn(fieldVariants())}>Parameters</p>\n <div className=\"flex flex-col gap-2\">\n {parameters.map((param) => (\n <div key={param.name} className=\"inline-flex items-center flex-wrap gap-1\">\n <p className=\"font-medium not-prose text-nowrap\">{param.name} -</p>\n <div className=\"text-sm prose prose-no-margin\">{param.description}</div>\n </div>\n ))}\n </div>\n </>\n )}\n {returns && (\n <>\n <p className={cn(fieldVariants())}>Returns</p>\n <div className=\"my-auto text-sm prose prose-no-margin\">{returns}</div>\n </>\n )}\n </div>\n </CollapsibleContent>\n </Collapsible>\n );\n}\n"],"mappings":";;;;;;;;;;;AA6CA,MAAM,cAAc,IAAI,mBAAmB,EACzC,UAAU,EACR,YAAY,EACV,MAAM,mCACP,EACF,EACF,CAAC;AAEF,MAAM,gBAAgB,IAAI,0CAA0C;AAEpE,SAAgB,UAAU,EAAE,QAA4C;AACtE,QACE,qBAAC;EAAI,WAAU;aACb,qBAAC;GAAI,WAAU;cACb,oBAAC;IAAE,WAAU;cAAU;KAAQ,EAC/B,oBAAC;IAAE,WAAU;cAAiB;KAAQ;IAClC,EACL,OAAO,QAAQ,KAAK,CAAC,KAAK,CAAC,KAAK,WAC/B,oBAAC;GAAe,MAAM;GAAK,MAAM;KAAtB,IAA+B,CAC1C;GACE;;AAIV,SAAS,KAAK,EACZ,MACA,MAAM,EACJ,aAAa,EAAE,EACf,aACA,WAAW,OACX,YACA,iBACA,SAAS,cACT,MACA,qBACA,aAKD;CACD,MAAM,CAAC,MAAM,WAAW,SAAS,MAAM;AAEvC,QACE,qBAAC;EACO;EACN,cAAc;EACd,WAAW,GACT,oDACA,OAAO,6CAA6C,qBACrD;aAED,qBAAC;GAAmB,WAAU;;IAC5B,qBAAC;KACC,WAAW,GACT,YAAY;MACV;MACA,WAAW;MACZ,CAAC,CACH;gBAEA,MACA,CAAC,YAAY;MACT;IACN,sBACC,oBAAC;KAAK,MAAM;KAAqB,WAAU;eACxC;MACI,GAEP,oBAAC;KAAK,WAAU;eAAkB;MAAY;IAEhD,oBAAC,eAAY,WAAU,2GAA2G;;IAC/G,EACrB,oBAAC,gCACC,qBAAC;GAAI,WAAU;;IACb,oBAAC;KAAI,WAAU;eACZ;MACG;IACL,mBACC,4CACE,oBAAC;KAAE,WAAW,GAAG,eAAe,CAAC;eAAE;MAAQ,EAC3C,oBAAC;KAAE,WAAU;eAAqB;MAAoB,IACrD;IAEJ,gBACC,4CACE,oBAAC;KAAE,WAAW,GAAG,eAAe,CAAC;eAAE;MAAW,EAC9C,oBAAC;KAAE,WAAU;eAAqB;MAAiB,IAClD;IAEJ,WAAW,SAAS,KACnB,4CACE,oBAAC;KAAE,WAAW,GAAG,eAAe,CAAC;eAAE;MAAc,EACjD,oBAAC;KAAI,WAAU;eACZ,WAAW,KAAK,UACf,qBAAC;MAAqB,WAAU;iBAC9B,qBAAC;OAAE,WAAU;kBAAqC,MAAM,MAAK;QAAM,EACnE,oBAAC;OAAI,WAAU;iBAAiC,MAAM;QAAkB;QAFhE,MAAM,KAGV,CACN;MACE,IACL;IAEJ,WACC,4CACE,oBAAC;KAAE,WAAW,GAAG,eAAe,CAAC;eAAE;MAAW,EAC9C,oBAAC;KAAI,WAAU;eAAyC;MAAc,IACrE;;IAED,GACa;GACT"}
|
|
@@ -1,8 +1,32 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import * as react_jsx_runtime67 from "react/jsx-runtime";
|
|
2
|
+
import { ComponentProps } from "react";
|
|
3
|
+
import * as Primitive from "@radix-ui/react-accordion";
|
|
4
|
+
|
|
5
|
+
//#region src/components/ui/accordion.d.ts
|
|
6
|
+
declare function Accordion({
|
|
7
|
+
className,
|
|
8
|
+
...props
|
|
9
|
+
}: ComponentProps<typeof Primitive.Root>): react_jsx_runtime67.JSX.Element;
|
|
10
|
+
declare function AccordionItem({
|
|
11
|
+
className,
|
|
12
|
+
children,
|
|
13
|
+
...props
|
|
14
|
+
}: ComponentProps<typeof Primitive.Item>): react_jsx_runtime67.JSX.Element;
|
|
15
|
+
declare function AccordionHeader({
|
|
16
|
+
className,
|
|
17
|
+
children,
|
|
18
|
+
...props
|
|
19
|
+
}: ComponentProps<typeof Primitive.Header>): react_jsx_runtime67.JSX.Element;
|
|
20
|
+
declare function AccordionTrigger({
|
|
21
|
+
className,
|
|
22
|
+
children,
|
|
23
|
+
...props
|
|
24
|
+
}: ComponentProps<typeof Primitive.Trigger>): react_jsx_runtime67.JSX.Element;
|
|
25
|
+
declare function AccordionContent({
|
|
26
|
+
className,
|
|
27
|
+
children,
|
|
28
|
+
...props
|
|
29
|
+
}: ComponentProps<typeof Primitive.Content>): react_jsx_runtime67.JSX.Element;
|
|
30
|
+
//#endregion
|
|
31
|
+
export { Accordion, AccordionContent, AccordionHeader, AccordionItem, AccordionTrigger };
|
|
8
32
|
//# sourceMappingURL=accordion.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"accordion.d.ts","
|
|
1
|
+
{"version":3,"file":"accordion.d.ts","names":[],"sources":["../../../src/components/ui/accordion.tsx"],"sourcesContent":[],"mappings":";;;;;iBAOgB,SAAA;;;GAAmC,sBAAsB,SAAA,CAAU,QAAK,mBAAA,CAAA,GAAA,CAAA;iBAYxE,aAAA;;;;GAIb,sBAAsB,SAAA,CAAU,QAAK,mBAAA,CAAA,GAAA,CAAA;iBAQxB,eAAA;;;;GAIb,sBAAsB,SAAA,CAAU,UAAO,mBAAA,CAAA,GAAA,CAAA;AA5B1B,iBA0CA,gBAAA,CA1CS;EAAA,SAAA;EAAA,QAAA;EAAA,GAAA;AAAA,CAAA,EA8CtB,cA9CsB,CAAA,OA8CA,SAAA,CAAU,OA9CV,CAAA,CAAA,EA8CkB,mBAAA,CAAA,GAAA,CAAA,OA9ClB;AAAG,iBA6DZ,gBAAA,CA7DY;EAAA,SAAA;EAAA,QAAA;EAAA,GAAA;AAAA,CAAA,EAiEzB,cAjEyB,CAAA,OAiEH,SAAA,CAAU,OAjEP,CAAA,CAAA,EAiEe,mBAAA,CAAA,GAAA,CAAA,OAjEf"}
|
|
@@ -1,20 +1,46 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
2
|
+
|
|
3
|
+
import { cn } from "@fumadocs/ui/cn";
|
|
4
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
import { ChevronRight } from "lucide-react";
|
|
6
|
+
import * as Primitive from "@radix-ui/react-accordion";
|
|
7
|
+
|
|
8
|
+
//#region src/components/ui/accordion.tsx
|
|
9
|
+
function Accordion({ className, ...props }) {
|
|
10
|
+
return /* @__PURE__ */ jsx(Primitive.Root, {
|
|
11
|
+
className: cn("divide-y divide-fd-border overflow-hidden rounded-lg border bg-fd-card", className),
|
|
12
|
+
...props
|
|
13
|
+
});
|
|
8
14
|
}
|
|
9
|
-
|
|
10
|
-
|
|
15
|
+
function AccordionItem({ className, children, ...props }) {
|
|
16
|
+
return /* @__PURE__ */ jsx(Primitive.Item, {
|
|
17
|
+
className: cn("scroll-m-24", className),
|
|
18
|
+
...props,
|
|
19
|
+
children
|
|
20
|
+
});
|
|
11
21
|
}
|
|
12
|
-
|
|
13
|
-
|
|
22
|
+
function AccordionHeader({ className, children, ...props }) {
|
|
23
|
+
return /* @__PURE__ */ jsx(Primitive.Header, {
|
|
24
|
+
className: cn("not-prose flex flex-row items-center text-fd-card-foreground font-medium has-focus-visible:bg-fd-accent", className),
|
|
25
|
+
...props,
|
|
26
|
+
children
|
|
27
|
+
});
|
|
14
28
|
}
|
|
15
|
-
|
|
16
|
-
|
|
29
|
+
function AccordionTrigger({ className, children, ...props }) {
|
|
30
|
+
return /* @__PURE__ */ jsxs(Primitive.Trigger, {
|
|
31
|
+
className: cn("group flex flex-1 items-center gap-2 px-3 py-2.5 text-start focus-visible:outline-none", className),
|
|
32
|
+
...props,
|
|
33
|
+
children: [/* @__PURE__ */ jsx(ChevronRight, { className: "size-4 shrink-0 text-fd-muted-foreground transition-transform duration-200 group-data-[state=open]:rotate-90" }), children]
|
|
34
|
+
});
|
|
17
35
|
}
|
|
18
|
-
|
|
19
|
-
|
|
36
|
+
function AccordionContent({ className, children, ...props }) {
|
|
37
|
+
return /* @__PURE__ */ jsx(Primitive.Content, {
|
|
38
|
+
className: cn("overflow-hidden data-[state=closed]:animate-fd-accordion-up data-[state=open]:animate-fd-accordion-down", className),
|
|
39
|
+
...props,
|
|
40
|
+
children
|
|
41
|
+
});
|
|
20
42
|
}
|
|
43
|
+
|
|
44
|
+
//#endregion
|
|
45
|
+
export { Accordion, AccordionContent, AccordionHeader, AccordionItem, AccordionTrigger };
|
|
46
|
+
//# sourceMappingURL=accordion.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"accordion.js","names":[],"sources":["../../../src/components/ui/accordion.tsx"],"sourcesContent":["'use client';\n\nimport * as Primitive from '@radix-ui/react-accordion';\nimport { ChevronRight } from 'lucide-react';\nimport { type ComponentProps } from 'react';\nimport { cn } from '@fumadocs/ui/cn';\n\nexport function Accordion({ className, ...props }: ComponentProps<typeof Primitive.Root>) {\n return (\n <Primitive.Root\n className={cn(\n 'divide-y divide-fd-border overflow-hidden rounded-lg border bg-fd-card',\n className,\n )}\n {...props}\n />\n );\n}\n\nexport function AccordionItem({\n className,\n children,\n ...props\n}: ComponentProps<typeof Primitive.Item>) {\n return (\n <Primitive.Item className={cn('scroll-m-24', className)} {...props}>\n {children}\n </Primitive.Item>\n );\n}\n\nexport function AccordionHeader({\n className,\n children,\n ...props\n}: ComponentProps<typeof Primitive.Header>) {\n return (\n <Primitive.Header\n className={cn(\n 'not-prose flex flex-row items-center text-fd-card-foreground font-medium has-focus-visible:bg-fd-accent',\n className,\n )}\n {...props}\n >\n {children}\n </Primitive.Header>\n );\n}\n\nexport function AccordionTrigger({\n className,\n children,\n ...props\n}: ComponentProps<typeof Primitive.Trigger>) {\n return (\n <Primitive.Trigger\n className={cn(\n 'group flex flex-1 items-center gap-2 px-3 py-2.5 text-start focus-visible:outline-none',\n className,\n )}\n {...props}\n >\n <ChevronRight className=\"size-4 shrink-0 text-fd-muted-foreground transition-transform duration-200 group-data-[state=open]:rotate-90\" />\n {children}\n </Primitive.Trigger>\n );\n}\n\nexport function AccordionContent({\n className,\n children,\n ...props\n}: ComponentProps<typeof Primitive.Content>) {\n return (\n <Primitive.Content\n className={cn(\n 'overflow-hidden data-[state=closed]:animate-fd-accordion-up data-[state=open]:animate-fd-accordion-down',\n className,\n )}\n {...props}\n >\n {children}\n </Primitive.Content>\n );\n}\n"],"mappings":";;;;;;;;AAOA,SAAgB,UAAU,EAAE,WAAW,GAAG,SAAgD;AACxF,QACE,oBAAC,UAAU;EACT,WAAW,GACT,0EACA,UACD;EACD,GAAI;GACJ;;AAIN,SAAgB,cAAc,EAC5B,WACA,UACA,GAAG,SACqC;AACxC,QACE,oBAAC,UAAU;EAAK,WAAW,GAAG,eAAe,UAAU;EAAE,GAAI;EAC1D;GACc;;AAIrB,SAAgB,gBAAgB,EAC9B,WACA,UACA,GAAG,SACuC;AAC1C,QACE,oBAAC,UAAU;EACT,WAAW,GACT,2GACA,UACD;EACD,GAAI;EAEH;GACgB;;AAIvB,SAAgB,iBAAiB,EAC/B,WACA,UACA,GAAG,SACwC;AAC3C,QACE,qBAAC,UAAU;EACT,WAAW,GACT,0FACA,UACD;EACD,GAAI;aAEJ,oBAAC,gBAAa,WAAU,iHAAiH,EACxI;GACiB;;AAIxB,SAAgB,iBAAiB,EAC/B,WACA,UACA,GAAG,SACwC;AAC3C,QACE,oBAAC,UAAU;EACT,WAAW,GACT,2GACA,UACD;EACD,GAAI;EAEH;GACiB"}
|