fumadocs-ui 8.0.0
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/LICENSE +21 -0
- package/README.md +5 -0
- package/dist/chunk-24NYFO7H.js +31 -0
- package/dist/chunk-2ZR5Z6B2.js +105 -0
- package/dist/chunk-36MVEJ25.js +39 -0
- package/dist/chunk-5EZE3X7G.js +31 -0
- package/dist/chunk-5KW7ATCP.js +23 -0
- package/dist/chunk-6C3VEZWH.js +9 -0
- package/dist/chunk-CBOHU2VN.js +28 -0
- package/dist/chunk-EDUYFB4P.js +43 -0
- package/dist/chunk-F62NYOL5.js +44 -0
- package/dist/chunk-GZQICERS.js +31 -0
- package/dist/chunk-IXYX64FW.js +243 -0
- package/dist/chunk-KCGRUOMD.js +13 -0
- package/dist/chunk-OG3QOLYP.js +43 -0
- package/dist/chunk-PLXR6QNH.js +21 -0
- package/dist/chunk-UIZNMCLD.js +49 -0
- package/dist/chunk-YAHHY62W.js +20 -0
- package/dist/components/accordion.d.mts +11 -0
- package/dist/components/accordion.js +128 -0
- package/dist/components/api.d.mts +20 -0
- package/dist/components/api.js +136 -0
- package/dist/components/callout.d.mts +13 -0
- package/dist/components/callout.js +39 -0
- package/dist/components/card.d.mts +12 -0
- package/dist/components/card.js +10 -0
- package/dist/components/codeblock.d.mts +12 -0
- package/dist/components/codeblock.js +14 -0
- package/dist/components/dialog/search-algolia.d.mts +15 -0
- package/dist/components/dialog/search-algolia.js +39 -0
- package/dist/components/dialog/search-default.d.mts +15 -0
- package/dist/components/dialog/search-default.js +39 -0
- package/dist/components/dialog/search.d.mts +25 -0
- package/dist/components/dialog/search.js +13 -0
- package/dist/components/files.d.mts +20 -0
- package/dist/components/files.js +56 -0
- package/dist/components/heading.d.mts +9 -0
- package/dist/components/heading.js +8 -0
- package/dist/components/image-zoom.d.mts +12 -0
- package/dist/components/image-zoom.js +39 -0
- package/dist/components/inline-toc.d.mts +11 -0
- package/dist/components/inline-toc.js +53 -0
- package/dist/components/roll-button.d.mts +14 -0
- package/dist/components/roll-button.js +54 -0
- package/dist/components/steps.d.mts +10 -0
- package/dist/components/steps.js +14 -0
- package/dist/components/tabs.d.mts +37 -0
- package/dist/components/tabs.js +141 -0
- package/dist/components/type-table.d.mts +23 -0
- package/dist/components/type-table.js +52 -0
- package/dist/i18n-dw7ODAws.d.mts +22 -0
- package/dist/i18n.d.mts +21 -0
- package/dist/i18n.js +146 -0
- package/dist/layout-YB7EFpgW.d.mts +79 -0
- package/dist/layout.client.d.mts +4 -0
- package/dist/layout.client.js +458 -0
- package/dist/layout.d.mts +3 -0
- package/dist/layout.js +97 -0
- package/dist/mdx.client.d.mts +7 -0
- package/dist/mdx.client.js +23 -0
- package/dist/mdx.d.mts +36 -0
- package/dist/mdx.js +51 -0
- package/dist/page.client.d.mts +29 -0
- package/dist/page.client.js +168 -0
- package/dist/page.d.mts +49 -0
- package/dist/page.js +56 -0
- package/dist/provider.d.mts +50 -0
- package/dist/provider.js +51 -0
- package/dist/style.css +1 -0
- package/dist/tailwind-plugin.d.ts +36 -0
- package/dist/tailwind-plugin.js +481 -0
- package/dist/tree-Zwtp9xPv.d.mts +15 -0
- package/package.json +97 -0
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import {
|
|
2
|
+
SearchDialog,
|
|
3
|
+
SearchDialogContent
|
|
4
|
+
} from "../../chunk-IXYX64FW.js";
|
|
5
|
+
import "../../chunk-36MVEJ25.js";
|
|
6
|
+
import "../../chunk-YAHHY62W.js";
|
|
7
|
+
import "../../chunk-5KW7ATCP.js";
|
|
8
|
+
import "../../chunk-KCGRUOMD.js";
|
|
9
|
+
import "../../chunk-6C3VEZWH.js";
|
|
10
|
+
export {
|
|
11
|
+
SearchDialog,
|
|
12
|
+
SearchDialogContent
|
|
13
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { HTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
|
|
3
|
+
declare function Files({ className, ...props }: HTMLAttributes<HTMLDivElement>): JSX.Element;
|
|
4
|
+
interface FileProps {
|
|
5
|
+
title: string;
|
|
6
|
+
icon?: ReactNode;
|
|
7
|
+
/**
|
|
8
|
+
* Open folder by default
|
|
9
|
+
*
|
|
10
|
+
* @defaultValue false
|
|
11
|
+
*/
|
|
12
|
+
defaultOpen?: boolean;
|
|
13
|
+
/**
|
|
14
|
+
* hildren files of the folder, considered as file if empty
|
|
15
|
+
*/
|
|
16
|
+
children?: ReactNode;
|
|
17
|
+
}
|
|
18
|
+
declare function File({ title, icon, defaultOpen, children, }: FileProps): JSX.Element;
|
|
19
|
+
|
|
20
|
+
export { File, Files };
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
Collapsible,
|
|
4
|
+
CollapsibleContent,
|
|
5
|
+
CollapsibleTrigger
|
|
6
|
+
} from "../chunk-5EZE3X7G.js";
|
|
7
|
+
import {
|
|
8
|
+
cn
|
|
9
|
+
} from "../chunk-KCGRUOMD.js";
|
|
10
|
+
import "../chunk-6C3VEZWH.js";
|
|
11
|
+
|
|
12
|
+
// src/components/files.tsx
|
|
13
|
+
import { cva } from "class-variance-authority";
|
|
14
|
+
import { FileIcon, FolderIcon, FolderOpenIcon } from "lucide-react";
|
|
15
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
16
|
+
var item = cva(
|
|
17
|
+
"flex flex-row items-center gap-2 rounded-md px-2 py-1.5 text-sm hover:bg-accent hover:text-accent-foreground [&_svg]:size-4"
|
|
18
|
+
);
|
|
19
|
+
function Files({
|
|
20
|
+
className,
|
|
21
|
+
...props
|
|
22
|
+
}) {
|
|
23
|
+
return /* @__PURE__ */ jsx(
|
|
24
|
+
"div",
|
|
25
|
+
{
|
|
26
|
+
className: cn("not-prose rounded-md border bg-card p-2", className),
|
|
27
|
+
...props,
|
|
28
|
+
children: props.children
|
|
29
|
+
}
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
function File({
|
|
33
|
+
title,
|
|
34
|
+
icon,
|
|
35
|
+
defaultOpen,
|
|
36
|
+
children
|
|
37
|
+
}) {
|
|
38
|
+
if (!children) {
|
|
39
|
+
return /* @__PURE__ */ jsxs("p", { className: cn(item()), children: [
|
|
40
|
+
icon ?? /* @__PURE__ */ jsx(FileIcon, {}),
|
|
41
|
+
title
|
|
42
|
+
] });
|
|
43
|
+
}
|
|
44
|
+
return /* @__PURE__ */ jsxs(Collapsible, { defaultOpen, children: [
|
|
45
|
+
/* @__PURE__ */ jsxs(CollapsibleTrigger, { className: cn(item({ className: "group w-full" })), children: [
|
|
46
|
+
/* @__PURE__ */ jsx(FolderIcon, { className: "group-data-[state=open]:hidden" }),
|
|
47
|
+
/* @__PURE__ */ jsx(FolderOpenIcon, { className: "group-data-[state=closed]:hidden" }),
|
|
48
|
+
title
|
|
49
|
+
] }),
|
|
50
|
+
/* @__PURE__ */ jsx(CollapsibleContent, { children: /* @__PURE__ */ jsx("div", { className: "ml-4 flex flex-col border-l py-2 pl-2", children }) })
|
|
51
|
+
] });
|
|
52
|
+
}
|
|
53
|
+
export {
|
|
54
|
+
File,
|
|
55
|
+
Files
|
|
56
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ComponentPropsWithoutRef } from 'react';
|
|
2
|
+
|
|
3
|
+
type Types = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';
|
|
4
|
+
type HeadingProps<T extends Types> = Omit<ComponentPropsWithoutRef<T>, 'as'> & {
|
|
5
|
+
as?: T;
|
|
6
|
+
};
|
|
7
|
+
declare function Heading<T extends Types = 'h1'>({ as, className, ...props }: HeadingProps<T>): JSX.Element;
|
|
8
|
+
|
|
9
|
+
export { Heading };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ImageProps } from 'next/image';
|
|
2
|
+
import { ImgHTMLAttributes } from 'react';
|
|
3
|
+
|
|
4
|
+
type ImageZoomProps = ImageProps & {
|
|
5
|
+
/**
|
|
6
|
+
* Image props when zoom in
|
|
7
|
+
*/
|
|
8
|
+
zoomInProps?: ImgHTMLAttributes<HTMLImageElement>;
|
|
9
|
+
};
|
|
10
|
+
declare function ImageZoom({ zoomInProps, children, ...props }: ImageZoomProps): JSX.Element;
|
|
11
|
+
|
|
12
|
+
export { ImageZoom, type ImageZoomProps };
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
defaultImageSizes
|
|
4
|
+
} from "../chunk-EDUYFB4P.js";
|
|
5
|
+
import "../chunk-6C3VEZWH.js";
|
|
6
|
+
|
|
7
|
+
// src/components/image-zoom.tsx
|
|
8
|
+
import Image from "next/image";
|
|
9
|
+
import Zoom from "react-medium-image-zoom";
|
|
10
|
+
import { jsx } from "react/jsx-runtime";
|
|
11
|
+
function getImageSrc(src) {
|
|
12
|
+
if (typeof src === "string")
|
|
13
|
+
return src;
|
|
14
|
+
if ("default" in src)
|
|
15
|
+
return src.default.src;
|
|
16
|
+
return src.src;
|
|
17
|
+
}
|
|
18
|
+
function ImageZoom({
|
|
19
|
+
zoomInProps,
|
|
20
|
+
children,
|
|
21
|
+
...props
|
|
22
|
+
}) {
|
|
23
|
+
return /* @__PURE__ */ jsx(
|
|
24
|
+
Zoom,
|
|
25
|
+
{
|
|
26
|
+
zoomMargin: 20,
|
|
27
|
+
wrapElement: "span",
|
|
28
|
+
zoomImg: {
|
|
29
|
+
src: getImageSrc(props.src),
|
|
30
|
+
sizes: void 0,
|
|
31
|
+
...zoomInProps
|
|
32
|
+
},
|
|
33
|
+
children: children ?? /* @__PURE__ */ jsx(Image, { sizes: defaultImageSizes, ...props })
|
|
34
|
+
}
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
export {
|
|
38
|
+
ImageZoom
|
|
39
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { TOCItemType } from 'fumadocs-core/server';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
|
|
4
|
+
interface InlineTocProps {
|
|
5
|
+
items: TOCItemType[];
|
|
6
|
+
defaultOpen?: boolean;
|
|
7
|
+
children?: ReactNode;
|
|
8
|
+
}
|
|
9
|
+
declare function InlineTOC({ items, defaultOpen, children, }: InlineTocProps): JSX.Element;
|
|
10
|
+
|
|
11
|
+
export { InlineTOC, type InlineTocProps };
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
Collapsible,
|
|
4
|
+
CollapsibleContent,
|
|
5
|
+
CollapsibleTrigger
|
|
6
|
+
} from "../chunk-5EZE3X7G.js";
|
|
7
|
+
import "../chunk-KCGRUOMD.js";
|
|
8
|
+
import "../chunk-6C3VEZWH.js";
|
|
9
|
+
|
|
10
|
+
// src/components/inline-toc.tsx
|
|
11
|
+
import { ChevronDown } from "lucide-react";
|
|
12
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
13
|
+
function InlineTOC({
|
|
14
|
+
items,
|
|
15
|
+
defaultOpen,
|
|
16
|
+
children
|
|
17
|
+
}) {
|
|
18
|
+
return /* @__PURE__ */ jsxs(
|
|
19
|
+
Collapsible,
|
|
20
|
+
{
|
|
21
|
+
defaultOpen,
|
|
22
|
+
className: "not-prose rounded-lg border bg-card text-card-foreground",
|
|
23
|
+
children: [
|
|
24
|
+
/* @__PURE__ */ jsx(CollapsibleTrigger, { asChild: true, children: children ?? /* @__PURE__ */ jsxs(
|
|
25
|
+
"button",
|
|
26
|
+
{
|
|
27
|
+
type: "button",
|
|
28
|
+
className: "inline-flex w-full items-center justify-between p-4 text-medium font-medium [&[data-state=open]>svg]:rotate-180",
|
|
29
|
+
children: [
|
|
30
|
+
"Table of Contents",
|
|
31
|
+
/* @__PURE__ */ jsx(ChevronDown, { className: "size-4 transition-transform duration-200" })
|
|
32
|
+
]
|
|
33
|
+
}
|
|
34
|
+
) }),
|
|
35
|
+
/* @__PURE__ */ jsx(CollapsibleContent, { children: /* @__PURE__ */ jsx("div", { className: "flex flex-col px-6 pb-4 text-sm text-muted-foreground", children: items.map((item) => /* @__PURE__ */ jsx(
|
|
36
|
+
"a",
|
|
37
|
+
{
|
|
38
|
+
href: item.url,
|
|
39
|
+
className: "py-1.5 hover:text-accent-foreground",
|
|
40
|
+
style: {
|
|
41
|
+
paddingLeft: 16 * Math.max(item.depth - 2, 0)
|
|
42
|
+
},
|
|
43
|
+
children: item.title
|
|
44
|
+
},
|
|
45
|
+
item.url
|
|
46
|
+
)) }) })
|
|
47
|
+
]
|
|
48
|
+
}
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
export {
|
|
52
|
+
InlineTOC
|
|
53
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
interface RollButtonProps {
|
|
2
|
+
/**
|
|
3
|
+
* Percentage of scroll position to display the roll button
|
|
4
|
+
*
|
|
5
|
+
* @defaultValue 0.2
|
|
6
|
+
*/
|
|
7
|
+
percentage?: number;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* A button that scrolls to the top
|
|
11
|
+
*/
|
|
12
|
+
declare function RollButton({ percentage }: RollButtonProps): JSX.Element;
|
|
13
|
+
|
|
14
|
+
export { RollButton };
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
buttonVariants
|
|
4
|
+
} from "../chunk-5KW7ATCP.js";
|
|
5
|
+
import {
|
|
6
|
+
cn
|
|
7
|
+
} from "../chunk-KCGRUOMD.js";
|
|
8
|
+
import "../chunk-6C3VEZWH.js";
|
|
9
|
+
|
|
10
|
+
// src/components/roll-button.tsx
|
|
11
|
+
import { ChevronUpIcon } from "lucide-react";
|
|
12
|
+
import { useEffect, useState } from "react";
|
|
13
|
+
import { jsx } from "react/jsx-runtime";
|
|
14
|
+
function RollButton({ percentage = 0.2 }) {
|
|
15
|
+
const [show, setShow] = useState(false);
|
|
16
|
+
useEffect(() => {
|
|
17
|
+
const listener = () => {
|
|
18
|
+
const element = document.scrollingElement;
|
|
19
|
+
if (!element)
|
|
20
|
+
return;
|
|
21
|
+
const nearTop = element.scrollTop / (element.scrollHeight - element.clientHeight) < percentage;
|
|
22
|
+
setShow(!nearTop);
|
|
23
|
+
};
|
|
24
|
+
window.addEventListener("scroll", listener);
|
|
25
|
+
return () => {
|
|
26
|
+
window.removeEventListener("scroll", listener);
|
|
27
|
+
};
|
|
28
|
+
}, [percentage]);
|
|
29
|
+
return /* @__PURE__ */ jsx(
|
|
30
|
+
"button",
|
|
31
|
+
{
|
|
32
|
+
type: "button",
|
|
33
|
+
"aria-label": "Scroll to Top",
|
|
34
|
+
className: cn(
|
|
35
|
+
buttonVariants({
|
|
36
|
+
color: "secondary",
|
|
37
|
+
size: "icon",
|
|
38
|
+
className: "fixed bottom-8 p-3 right-8 z-50 shadow-md rounded-full transition-all"
|
|
39
|
+
}),
|
|
40
|
+
!show && "translate-y-20 opacity-0"
|
|
41
|
+
),
|
|
42
|
+
onClick: () => {
|
|
43
|
+
document.scrollingElement?.scrollTo({
|
|
44
|
+
top: 0,
|
|
45
|
+
behavior: "smooth"
|
|
46
|
+
});
|
|
47
|
+
},
|
|
48
|
+
children: /* @__PURE__ */ jsx(ChevronUpIcon, {})
|
|
49
|
+
}
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
export {
|
|
53
|
+
RollButton
|
|
54
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import "../chunk-6C3VEZWH.js";
|
|
2
|
+
|
|
3
|
+
// src/components/steps.tsx
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
5
|
+
function Steps({ children }) {
|
|
6
|
+
return /* @__PURE__ */ jsx("div", { className: "steps", children });
|
|
7
|
+
}
|
|
8
|
+
function Step({ children }) {
|
|
9
|
+
return /* @__PURE__ */ jsx("div", { className: "step", children });
|
|
10
|
+
}
|
|
11
|
+
export {
|
|
12
|
+
Step,
|
|
13
|
+
Steps
|
|
14
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import * as TabsPrimitive from '@radix-ui/react-tabs';
|
|
2
|
+
import { TabsContentProps } from '@radix-ui/react-tabs';
|
|
3
|
+
import * as react from 'react';
|
|
4
|
+
import { ReactNode } from 'react';
|
|
5
|
+
|
|
6
|
+
declare const Tabs$1: react.ForwardRefExoticComponent<TabsPrimitive.TabsProps & react.RefAttributes<HTMLDivElement>>;
|
|
7
|
+
declare const TabsList: react.ForwardRefExoticComponent<Omit<TabsPrimitive.TabsListProps & react.RefAttributes<HTMLDivElement>, "ref"> & react.RefAttributes<HTMLDivElement>>;
|
|
8
|
+
declare const TabsTrigger: react.ForwardRefExoticComponent<Omit<TabsPrimitive.TabsTriggerProps & react.RefAttributes<HTMLButtonElement>, "ref"> & react.RefAttributes<HTMLButtonElement>>;
|
|
9
|
+
declare const TabsContent: react.ForwardRefExoticComponent<Omit<TabsPrimitive.TabsContentProps & react.RefAttributes<HTMLDivElement>, "ref"> & react.RefAttributes<HTMLDivElement>>;
|
|
10
|
+
|
|
11
|
+
declare const tabs_TabsContent: typeof TabsContent;
|
|
12
|
+
declare const tabs_TabsList: typeof TabsList;
|
|
13
|
+
declare const tabs_TabsTrigger: typeof TabsTrigger;
|
|
14
|
+
declare namespace tabs {
|
|
15
|
+
export { Tabs$1 as Tabs, tabs_TabsContent as TabsContent, tabs_TabsList as TabsList, tabs_TabsTrigger as TabsTrigger };
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
interface TabsProps {
|
|
19
|
+
/**
|
|
20
|
+
* Identifier for Sharing value of tabs
|
|
21
|
+
*/
|
|
22
|
+
id?: string;
|
|
23
|
+
/**
|
|
24
|
+
* Enable persistent
|
|
25
|
+
*/
|
|
26
|
+
persist?: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* @defaultValue 0
|
|
29
|
+
*/
|
|
30
|
+
defaultIndex?: number;
|
|
31
|
+
items?: string[];
|
|
32
|
+
children: ReactNode;
|
|
33
|
+
}
|
|
34
|
+
declare function Tabs({ id, items, persist, defaultIndex, children, }: TabsProps): JSX.Element;
|
|
35
|
+
declare function Tab({ value, className, ...props }: TabsContentProps): JSX.Element;
|
|
36
|
+
|
|
37
|
+
export { tabs as Primitive, Tab, Tabs, type TabsProps };
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
cn
|
|
4
|
+
} from "../chunk-KCGRUOMD.js";
|
|
5
|
+
import {
|
|
6
|
+
__export
|
|
7
|
+
} from "../chunk-6C3VEZWH.js";
|
|
8
|
+
|
|
9
|
+
// src/components/tabs.tsx
|
|
10
|
+
import { useEffect, useMemo, useState } from "react";
|
|
11
|
+
|
|
12
|
+
// src/components/ui/tabs.tsx
|
|
13
|
+
var tabs_exports = {};
|
|
14
|
+
__export(tabs_exports, {
|
|
15
|
+
Tabs: () => Tabs,
|
|
16
|
+
TabsContent: () => TabsContent,
|
|
17
|
+
TabsList: () => TabsList,
|
|
18
|
+
TabsTrigger: () => TabsTrigger
|
|
19
|
+
});
|
|
20
|
+
import * as TabsPrimitive from "@radix-ui/react-tabs";
|
|
21
|
+
import * as React from "react";
|
|
22
|
+
import { jsx } from "react/jsx-runtime";
|
|
23
|
+
var Tabs = TabsPrimitive.Root;
|
|
24
|
+
var TabsList = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
25
|
+
TabsPrimitive.List,
|
|
26
|
+
{
|
|
27
|
+
ref,
|
|
28
|
+
className: cn(
|
|
29
|
+
"inline-flex h-9 w-full items-end gap-2 overflow-x-auto text-muted-foreground shadow-[0_-1px_0_var(--tw-shadow)_inset] shadow-border",
|
|
30
|
+
className
|
|
31
|
+
),
|
|
32
|
+
...props
|
|
33
|
+
}
|
|
34
|
+
));
|
|
35
|
+
TabsList.displayName = TabsPrimitive.List.displayName;
|
|
36
|
+
var TabsTrigger = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
37
|
+
TabsPrimitive.Trigger,
|
|
38
|
+
{
|
|
39
|
+
ref,
|
|
40
|
+
className: cn(
|
|
41
|
+
"whitespace-nowrap border-b border-transparent p-1.5 text-sm font-medium hover:text-accent-foreground disabled:pointer-events-none disabled:opacity-50 data-[state=active]:border-primary data-[state=active]:text-primary",
|
|
42
|
+
className
|
|
43
|
+
),
|
|
44
|
+
...props
|
|
45
|
+
}
|
|
46
|
+
));
|
|
47
|
+
TabsTrigger.displayName = TabsPrimitive.Trigger.displayName;
|
|
48
|
+
var TabsContent = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
49
|
+
TabsPrimitive.Content,
|
|
50
|
+
{
|
|
51
|
+
ref,
|
|
52
|
+
className: cn("mt-2 focus-visible:outline-none", className),
|
|
53
|
+
...props
|
|
54
|
+
}
|
|
55
|
+
));
|
|
56
|
+
TabsContent.displayName = TabsPrimitive.Content.displayName;
|
|
57
|
+
|
|
58
|
+
// src/components/tabs.tsx
|
|
59
|
+
import { jsx as jsx2, jsxs } from "react/jsx-runtime";
|
|
60
|
+
var valueMap = /* @__PURE__ */ new Map();
|
|
61
|
+
var listeners = /* @__PURE__ */ new Map();
|
|
62
|
+
function add(id, listener) {
|
|
63
|
+
if (listeners.has(id)) {
|
|
64
|
+
listeners.get(id)?.add(listener);
|
|
65
|
+
} else {
|
|
66
|
+
listeners.set(id, /* @__PURE__ */ new Set([listener]));
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
function remove(id, listener) {
|
|
70
|
+
listeners.get(id)?.delete(listener);
|
|
71
|
+
}
|
|
72
|
+
function update(id, v, persist) {
|
|
73
|
+
valueMap.set(id, v);
|
|
74
|
+
listeners.get(id)?.forEach((item) => {
|
|
75
|
+
item();
|
|
76
|
+
});
|
|
77
|
+
if (persist)
|
|
78
|
+
localStorage.setItem(id, v);
|
|
79
|
+
}
|
|
80
|
+
function Tabs2({
|
|
81
|
+
id,
|
|
82
|
+
items = [],
|
|
83
|
+
persist = false,
|
|
84
|
+
defaultIndex = 0,
|
|
85
|
+
children
|
|
86
|
+
}) {
|
|
87
|
+
const values = useMemo(() => items.map((item) => toValue(item)), [items]);
|
|
88
|
+
const [value, setValue] = useState(values[defaultIndex]);
|
|
89
|
+
useEffect(() => {
|
|
90
|
+
if (!id)
|
|
91
|
+
return;
|
|
92
|
+
const onUpdate = () => {
|
|
93
|
+
const current = valueMap.get(id);
|
|
94
|
+
if (current && values.includes(current))
|
|
95
|
+
setValue(current);
|
|
96
|
+
};
|
|
97
|
+
if (persist) {
|
|
98
|
+
const previous = localStorage.getItem(id);
|
|
99
|
+
if (previous)
|
|
100
|
+
update(id, previous, persist);
|
|
101
|
+
}
|
|
102
|
+
add(id, onUpdate);
|
|
103
|
+
onUpdate();
|
|
104
|
+
return () => {
|
|
105
|
+
remove(id, onUpdate);
|
|
106
|
+
};
|
|
107
|
+
}, [id, persist, values]);
|
|
108
|
+
const onValueChange = (v) => {
|
|
109
|
+
if (id) {
|
|
110
|
+
update(id, v, persist);
|
|
111
|
+
} else {
|
|
112
|
+
setValue(v);
|
|
113
|
+
}
|
|
114
|
+
};
|
|
115
|
+
return /* @__PURE__ */ jsxs(Tabs, { value, onValueChange, children: [
|
|
116
|
+
/* @__PURE__ */ jsx2(TabsList, { children: values.map((v, i) => /* @__PURE__ */ jsx2(TabsTrigger, { value: v, children: items[i] }, v)) }),
|
|
117
|
+
children
|
|
118
|
+
] });
|
|
119
|
+
}
|
|
120
|
+
function toValue(v) {
|
|
121
|
+
return v.toLowerCase().replace(/\s/, "-");
|
|
122
|
+
}
|
|
123
|
+
function Tab({
|
|
124
|
+
value,
|
|
125
|
+
className,
|
|
126
|
+
...props
|
|
127
|
+
}) {
|
|
128
|
+
return /* @__PURE__ */ jsx2(
|
|
129
|
+
TabsContent,
|
|
130
|
+
{
|
|
131
|
+
value: toValue(value),
|
|
132
|
+
className: cn("prose-no-margin", className),
|
|
133
|
+
...props
|
|
134
|
+
}
|
|
135
|
+
);
|
|
136
|
+
}
|
|
137
|
+
export {
|
|
138
|
+
tabs_exports as Primitive,
|
|
139
|
+
Tab,
|
|
140
|
+
Tabs2 as Tabs
|
|
141
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
|
|
3
|
+
declare function Info({ children }: {
|
|
4
|
+
children: ReactNode;
|
|
5
|
+
}): JSX.Element;
|
|
6
|
+
interface ObjectType {
|
|
7
|
+
/**
|
|
8
|
+
* Additional description of the field
|
|
9
|
+
*/
|
|
10
|
+
description?: string;
|
|
11
|
+
type: string;
|
|
12
|
+
typeDescription?: string;
|
|
13
|
+
/**
|
|
14
|
+
* Optional link to the type
|
|
15
|
+
*/
|
|
16
|
+
typeDescriptionLink?: string;
|
|
17
|
+
default?: string;
|
|
18
|
+
}
|
|
19
|
+
declare function TypeTable({ type, }: {
|
|
20
|
+
type: Record<string, ObjectType>;
|
|
21
|
+
}): JSX.Element;
|
|
22
|
+
|
|
23
|
+
export { Info, TypeTable };
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
Popover,
|
|
4
|
+
PopoverContent,
|
|
5
|
+
PopoverTrigger
|
|
6
|
+
} from "../chunk-GZQICERS.js";
|
|
7
|
+
import {
|
|
8
|
+
cn
|
|
9
|
+
} from "../chunk-KCGRUOMD.js";
|
|
10
|
+
import "../chunk-6C3VEZWH.js";
|
|
11
|
+
|
|
12
|
+
// src/components/type-table.tsx
|
|
13
|
+
import { InfoIcon } from "lucide-react";
|
|
14
|
+
import Link from "next/link";
|
|
15
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
16
|
+
function Info({ children }) {
|
|
17
|
+
return /* @__PURE__ */ jsxs(Popover, { children: [
|
|
18
|
+
/* @__PURE__ */ jsx(PopoverTrigger, { children: /* @__PURE__ */ jsx(InfoIcon, { className: "size-4" }) }),
|
|
19
|
+
/* @__PURE__ */ jsx(PopoverContent, { className: "text-sm", children })
|
|
20
|
+
] });
|
|
21
|
+
}
|
|
22
|
+
function TypeTable({
|
|
23
|
+
type
|
|
24
|
+
}) {
|
|
25
|
+
const th = cn("p-2 font-medium first:pl-0 last:pr-0");
|
|
26
|
+
const td = cn("p-2 first:pl-0 last:pr-0");
|
|
27
|
+
const field = cn("inline-flex flex-row items-center gap-1");
|
|
28
|
+
const code = cn("rounded-md bg-secondary p-1 text-secondary-foreground");
|
|
29
|
+
return /* @__PURE__ */ jsx("div", { className: "not-prose overflow-auto whitespace-nowrap", children: /* @__PURE__ */ jsxs("table", { className: "my-4 w-full text-left text-sm text-muted-foreground", children: [
|
|
30
|
+
/* @__PURE__ */ jsx("thead", { className: "border-b", children: /* @__PURE__ */ jsxs("tr", { children: [
|
|
31
|
+
/* @__PURE__ */ jsx("th", { className: cn(th, "w-[45%]"), children: "Prop" }),
|
|
32
|
+
/* @__PURE__ */ jsx("th", { className: cn(th, "w-[30%]"), children: "Type" }),
|
|
33
|
+
/* @__PURE__ */ jsx("th", { className: cn(th, "w-[25%]"), children: "Default" })
|
|
34
|
+
] }) }),
|
|
35
|
+
/* @__PURE__ */ jsx("tbody", { className: "border-collapse divide-y divide-border", children: Object.entries(type).map(([key, value]) => /* @__PURE__ */ jsxs("tr", { children: [
|
|
36
|
+
/* @__PURE__ */ jsx("td", { className: td, children: /* @__PURE__ */ jsxs("div", { className: field, children: [
|
|
37
|
+
/* @__PURE__ */ jsx("code", { className: cn(code, "bg-primary/10 text-primary"), children: key }),
|
|
38
|
+
value.description ? /* @__PURE__ */ jsx(Info, { children: value.description }) : null
|
|
39
|
+
] }) }),
|
|
40
|
+
/* @__PURE__ */ jsx("td", { className: td, children: /* @__PURE__ */ jsxs("div", { className: field, children: [
|
|
41
|
+
/* @__PURE__ */ jsx("code", { className: code, children: value.type }),
|
|
42
|
+
value.typeDescription ? /* @__PURE__ */ jsx(Info, { children: /* @__PURE__ */ jsx("pre", { className: "overflow-auto bg-secondary text-secondary-foreground", children: value.typeDescription }) }) : null,
|
|
43
|
+
value.typeDescriptionLink ? /* @__PURE__ */ jsx(Link, { href: value.typeDescriptionLink, children: /* @__PURE__ */ jsx(InfoIcon, { className: "size-4" }) }) : null
|
|
44
|
+
] }) }),
|
|
45
|
+
/* @__PURE__ */ jsx("td", { className: td, children: value.default ? /* @__PURE__ */ jsx("code", { className: code, children: value.default }) : /* @__PURE__ */ jsx("span", { children: "-" }) })
|
|
46
|
+
] }, key)) })
|
|
47
|
+
] }) });
|
|
48
|
+
}
|
|
49
|
+
export {
|
|
50
|
+
Info,
|
|
51
|
+
TypeTable
|
|
52
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
interface Translations {
|
|
2
|
+
search: string;
|
|
3
|
+
searchNoResult: string;
|
|
4
|
+
toc: string;
|
|
5
|
+
lastUpdate: string;
|
|
6
|
+
chooseLanguage: string;
|
|
7
|
+
}
|
|
8
|
+
interface NamedTranslation extends Partial<Translations> {
|
|
9
|
+
/**
|
|
10
|
+
* The name of translation
|
|
11
|
+
*/
|
|
12
|
+
name: string;
|
|
13
|
+
}
|
|
14
|
+
interface I18nContextType {
|
|
15
|
+
locale?: string;
|
|
16
|
+
onChange?: (v: string) => void;
|
|
17
|
+
text: Translations;
|
|
18
|
+
translations?: Record<string, NamedTranslation>;
|
|
19
|
+
}
|
|
20
|
+
declare function useI18n(): I18nContextType;
|
|
21
|
+
|
|
22
|
+
export { type NamedTranslation as N, type Translations as T, useI18n as u };
|
package/dist/i18n.d.mts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { SelectProps } from '@radix-ui/react-select';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
import { N as NamedTranslation } from './i18n-dw7ODAws.mjs';
|
|
4
|
+
export { T as Translations } from './i18n-dw7ODAws.mjs';
|
|
5
|
+
|
|
6
|
+
type LanguageSelectProps = Omit<SelectProps, 'value' | 'onValueChange'>;
|
|
7
|
+
declare function LanguageSelect({ ...props }: LanguageSelectProps): JSX.Element;
|
|
8
|
+
interface I18nProviderProps {
|
|
9
|
+
/**
|
|
10
|
+
* Force a locale
|
|
11
|
+
*/
|
|
12
|
+
locale?: string;
|
|
13
|
+
/**
|
|
14
|
+
* Translations for each language
|
|
15
|
+
*/
|
|
16
|
+
translations?: Record<string, NamedTranslation>;
|
|
17
|
+
children: ReactNode;
|
|
18
|
+
}
|
|
19
|
+
declare function I18nProvider({ translations, locale: forceLocale, children, }: I18nProviderProps): JSX.Element;
|
|
20
|
+
|
|
21
|
+
export { I18nProvider, LanguageSelect, type LanguageSelectProps };
|