@fumadocs/base-ui 16.4.1 → 16.4.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.
- package/dist/_virtual/rolldown_runtime.js +36 -0
- package/dist/components/accordion.d.ts +23 -7
- package/dist/components/accordion.d.ts.map +1 -1
- package/dist/components/accordion.js +66 -36
- 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 +66 -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 +107 -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 +15 -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 +105 -65
- package/dist/components/sidebar/base.d.ts.map +1 -1
- package/dist/components/sidebar/base.js +278 -191
- 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 +30 -7
- package/dist/components/ui/accordion.d.ts.map +1 -1
- package/dist/components/ui/accordion.js +39 -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 +19 -8
- package/dist/components/ui/collapsible.d.ts.map +1 -1
- package/dist/components/ui/collapsible.js +18 -7
- package/dist/components/ui/collapsible.js.map +1 -0
- package/dist/components/ui/navigation-menu.d.ts +15 -11
- package/dist/components/ui/navigation-menu.d.ts.map +1 -1
- package/dist/components/ui/navigation-menu.js +33 -14
- package/dist/components/ui/navigation-menu.js.map +1 -0
- package/dist/components/ui/popover.d.ts +11 -7
- package/dist/components/ui/popover.d.ts.map +1 -1
- package/dist/components/ui/popover.js +26 -10
- package/dist/components/ui/popover.js.map +1 -0
- package/dist/components/ui/scroll-area.d.ts +11 -7
- package/dist/components/ui/scroll-area.d.ts.map +1 -1
- package/dist/components/ui/scroll-area.js +35 -10
- package/dist/components/ui/scroll-area.js.map +1 -0
- package/dist/components/ui/tabs.d.ts +39 -20
- 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 +55 -32
- package/dist/layouts/docs/index.d.ts.map +1 -1
- package/dist/layouts/docs/index.js +177 -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 +62 -20
- package/dist/layouts/docs/sidebar.d.ts.map +1 -1
- package/dist/layouts/docs/sidebar.js +145 -91
- 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 +273 -126
- package/dist/layouts/home/client.js.map +1 -0
- package/dist/layouts/home/index.d.ts +10 -5
- 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 +19 -6
- package/dist/layouts/home/navbar.d.ts.map +1 -1
- package/dist/layouts/home/navbar.js +31 -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 +58 -16
- package/dist/layouts/notebook/sidebar.d.ts.map +1 -1
- package/dist/layouts/notebook/sidebar.js +121 -79
- 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 +44 -34
- 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 +15 -9
- 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 +47 -48
- 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
|
@@ -1,31 +1,52 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import * as
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
1
|
+
import { Tabs as Tabs$1, TabsContent as TabsContent$1 } from "./ui/tabs.js";
|
|
2
|
+
import * as react_jsx_runtime43 from "react/jsx-runtime";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { ComponentProps, ReactNode } from "react";
|
|
5
|
+
import * as _base_ui_react0 from "@base-ui/react";
|
|
6
|
+
|
|
7
|
+
//#region src/components/tabs.d.ts
|
|
8
|
+
interface TabsProps extends Omit<ComponentProps<typeof Tabs$1>, 'value' | 'onValueChange'> {
|
|
9
|
+
/**
|
|
10
|
+
* Use simple mode instead of advanced usage as documented in https://radix-ui.com/primitives/docs/components/tabs.
|
|
11
|
+
*/
|
|
12
|
+
items?: string[];
|
|
13
|
+
/**
|
|
14
|
+
* Shortcut for `defaultValue` when `items` is provided.
|
|
15
|
+
*
|
|
16
|
+
* @defaultValue 0
|
|
17
|
+
*/
|
|
18
|
+
defaultIndex?: number;
|
|
19
|
+
/**
|
|
20
|
+
* Additional label in tabs list when `items` is provided.
|
|
21
|
+
*/
|
|
22
|
+
label?: ReactNode;
|
|
19
23
|
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
24
|
+
declare const TabsList: React.ForwardRefExoticComponent<Omit<_base_ui_react0.TabsListProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
25
|
+
declare const TabsTrigger: React.ForwardRefExoticComponent<Omit<_base_ui_react0.TabsTabProps & React.RefAttributes<Element>, "ref"> & React.RefAttributes<Element>>;
|
|
26
|
+
declare function Tabs({
|
|
27
|
+
ref,
|
|
28
|
+
className,
|
|
29
|
+
items,
|
|
30
|
+
label,
|
|
31
|
+
defaultIndex,
|
|
32
|
+
defaultValue,
|
|
33
|
+
...props
|
|
34
|
+
}: TabsProps): react_jsx_runtime43.JSX.Element;
|
|
35
|
+
interface TabProps extends Omit<ComponentProps<typeof TabsContent$1>, 'value'> {
|
|
36
|
+
/**
|
|
37
|
+
* Value of tab, detect from index if unspecified.
|
|
38
|
+
*/
|
|
39
|
+
value?: string;
|
|
28
40
|
}
|
|
29
|
-
|
|
30
|
-
|
|
41
|
+
declare function Tab({
|
|
42
|
+
value,
|
|
43
|
+
...props
|
|
44
|
+
}: TabProps): react_jsx_runtime43.JSX.Element;
|
|
45
|
+
declare function TabsContent({
|
|
46
|
+
value,
|
|
47
|
+
className,
|
|
48
|
+
...props
|
|
49
|
+
}: ComponentProps<typeof TabsContent$1>): react_jsx_runtime43.JSX.Element;
|
|
50
|
+
//#endregion
|
|
51
|
+
export { Tab, TabProps, Tabs, TabsContent, TabsList, TabsProps, TabsTrigger };
|
|
31
52
|
//# sourceMappingURL=tabs.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tabs.d.ts","
|
|
1
|
+
{"version":3,"file":"tabs.d.ts","names":[],"sources":["../../src/components/tabs.tsx"],"sourcesContent":[],"mappings":";;;;;;;UAkBiB,SAAA,SAAkB,KACjC,sBAAsB;;;;EADP,KAAA,CAAA,EAAA,MAAU,EAAA;EACH;;;;;EAgCX,YAcX,CAAA,EAAA,MAAA;EAAA;;;EAdmB,KAAA,CAAA,EAdX,SAcW;;AAAA,cAAR,QAAQ,EAAA,KAAA,CAAA,yBAAA,CAAA,IAAA,CAcnB,eAAA,CAdmB,aAAA,GAAA,KAAA,CAAA,aAAA,CAAA,cAAA,CAAA,EAAA,KAAA,CAAA,GAAA,KAAA,CAAA,aAAA,CAAA,cAAA,CAAA,CAAA;AAAA,cAiBR,WAjBQ,EAiBG,KAAA,CAAA,yBAjBH,CAiBG,IAjBH,CA+BnB,eAAA,CAdsB,YAAA,GAAA,KAAA,CAAA,aAjBH,CAiBG,OAjBH,CAAA,EAAA,KAAA,CAAA,GAiBG,KAAA,CAAA,aAjBH,CAiBG,OAjBH,CAAA,CAAA;AAAA,iBAkCL,IAAA,CAlCK;EAAA,GAAA;EAAA,SAAA;EAAA,KAAA;EAAA,KAAA;EAAA,YAAA;EAAA,YAAA;EAAA,GAAA;AAAA,CAAA,EA0ClB,SA1CkB,CAAA,EA0CT,mBAAA,CAAA,GAAA,CAAA,OA1CS;AAiBR,UA8DI,QAAA,SAAiB,IAhDhC,CAgDqC,cAhDrC,CAAA,OAgD2D,aAhD3D,CAAA,EAAA,OAAA,CAAA,CAAA;EAAA;;;EAdsB,KAAA,CAAA,EAAA,MAAA;;AAAA,iBAqER,GAAA,CArEQ;EAAA,KAAA;EAAA,GAAA;AAAA,CAAA,EAqEiB,QArEjB,CAAA,EAqEyB,mBAAA,CAAA,GAAA,CAAA,OArEzB;AAAA,iBAuFR,WAAA,CAvFQ;EAAA,KAAA;EAAA,SAAA;EAAA,GAAA;AAAA,CAAA,EA2FrB,cA3FqB,CAAA,OA2FC,aA3FD,CAAA,CAAA,EA2FsB,mBAAA,CAAA,GAAA,CAAA,OA3FtB"}
|
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(({ className, ...props }, ref) => /* @__PURE__ */ jsx(TabsList$1, {
|
|
17
|
+
ref,
|
|
18
|
+
...props,
|
|
19
|
+
className: (s) => cn("flex gap-3.5 text-fd-secondary-foreground overflow-x-auto px-4 not-prose", typeof className === "function" ? className(s) : className)
|
|
20
|
+
}));
|
|
21
|
+
TabsList.displayName = "TabsList";
|
|
22
|
+
const TabsTrigger = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(TabsTrigger$1, {
|
|
23
|
+
ref,
|
|
24
|
+
...props,
|
|
25
|
+
className: (s) => 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-[active]:border-fd-primary data-[active]:text-fd-primary", typeof className === "function" ? className(s) : 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: (s) => cn("flex flex-col overflow-hidden rounded-xl border bg-fd-secondary my-4", typeof className === "function" ? className(s) : 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
|
+
keepMounted: true,
|
|
69
|
+
className: (s) => cn("p-4 text-[0.9375rem] bg-fd-background rounded-xl outline-none prose-no-margin data-[inactive]:hidden [&>figure:only-child]:-m-4 [&>figure:only-child]:border-none", typeof className === "function" ? className(s) : 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>(({ className, ...props }, ref) => (\n <Unstyled.TabsList\n ref={ref}\n {...props}\n className={(s) =>\n cn(\n 'flex gap-3.5 text-fd-secondary-foreground overflow-x-auto px-4 not-prose',\n typeof className === 'function' ? className(s) : className,\n )\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>(({ className, ...props }, ref) => (\n <Unstyled.TabsTrigger\n ref={ref}\n {...props}\n className={(s) =>\n 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-[active]:border-fd-primary data-[active]:text-fd-primary',\n typeof className === 'function' ? className(s) : className,\n )\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={(s) =>\n cn(\n 'flex flex-col overflow-hidden rounded-xl border bg-fd-secondary my-4',\n typeof className === 'function' ? className(s) : className,\n )\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 keepMounted\n className={(s) =>\n cn(\n 'p-4 text-[0.9375rem] bg-fd-background rounded-xl outline-none prose-no-margin data-[inactive]:hidden [&>figure:only-child]:-m-4 [&>figure:only-child]:border-none',\n typeof className === 'function' ? className(s) : className,\n )\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,EAAE,WAAW,GAAG,SAAS,QAC1B,oBAACA;CACM;CACL,GAAI;CACJ,YAAY,MACV,GACE,4EACA,OAAO,cAAc,aAAa,UAAU,EAAE,GAAG,UAClD;EAEH,CACF;AACF,SAAS,cAAc;AAEvB,MAAa,cAAc,MAAM,YAG9B,EAAE,WAAW,GAAG,SAAS,QAC1B,oBAACC;CACM;CACL,GAAI;CACJ,YAAY,MACV,GACE,kTACA,OAAO,cAAc,aAAa,UAAU,EAAE,GAAG,UAClD;EAEH,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,YAAY,MACV,GACE,wEACA,OAAO,cAAc,aAAa,UAAU,EAAE,GAAG,UAClD;EAEI;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,YAAY,MACV,GACE,qKACA,OAAO,cAAc,aAAa,UAAU,EAAE,GAAG,UAClD;EAEH,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_runtime46 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_runtime46.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-[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-[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,qGAAqG;;IACzG,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,31 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import * as react_jsx_runtime137 from "react/jsx-runtime";
|
|
2
|
+
import { ComponentProps } from "react";
|
|
3
|
+
import { Accordion as Accordion$1 } from "@base-ui/react/accordion";
|
|
4
|
+
|
|
5
|
+
//#region src/components/ui/accordion.d.ts
|
|
6
|
+
declare function Accordion({
|
|
7
|
+
className,
|
|
8
|
+
...props
|
|
9
|
+
}: ComponentProps<typeof Accordion$1.Root>): react_jsx_runtime137.JSX.Element;
|
|
10
|
+
declare function AccordionItem({
|
|
11
|
+
children,
|
|
12
|
+
...props
|
|
13
|
+
}: ComponentProps<typeof Accordion$1.Item>): react_jsx_runtime137.JSX.Element;
|
|
14
|
+
declare function AccordionHeader({
|
|
15
|
+
className,
|
|
16
|
+
children,
|
|
17
|
+
...props
|
|
18
|
+
}: ComponentProps<typeof Accordion$1.Header>): react_jsx_runtime137.JSX.Element;
|
|
19
|
+
declare function AccordionTrigger({
|
|
20
|
+
className,
|
|
21
|
+
children,
|
|
22
|
+
...props
|
|
23
|
+
}: ComponentProps<typeof Accordion$1.Trigger>): react_jsx_runtime137.JSX.Element;
|
|
24
|
+
declare function AccordionContent({
|
|
25
|
+
className,
|
|
26
|
+
children,
|
|
27
|
+
...props
|
|
28
|
+
}: ComponentProps<typeof Accordion$1.Panel>): react_jsx_runtime137.JSX.Element;
|
|
29
|
+
//#endregion
|
|
30
|
+
export { Accordion, AccordionContent, AccordionHeader, AccordionItem, AccordionTrigger };
|
|
8
31
|
//# sourceMappingURL=accordion.d.ts.map
|