@fumadocs/base-ui 16.2.5
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/css/black.css +1 -0
- package/css/catppuccin.css +1 -0
- package/css/dusk.css +1 -0
- package/css/layouts/docs.css +1 -0
- package/css/layouts/home.css +1 -0
- package/css/layouts/notebook.css +1 -0
- package/css/neutral.css +1 -0
- package/css/ocean.css +1 -0
- package/css/preset.css +10 -0
- package/css/purple.css +1 -0
- package/css/shadcn.css +1 -0
- package/css/solar.css +1 -0
- package/css/style.css +9 -0
- package/css/vitepress.css +1 -0
- package/dist/components/accordion.d.ts +8 -0
- package/dist/components/accordion.d.ts.map +1 -0
- package/dist/components/accordion.js +41 -0
- package/dist/components/banner.d.ts +24 -0
- package/dist/components/banner.d.ts.map +1 -0
- package/dist/components/banner.js +54 -0
- package/dist/components/callout.d.ts +19 -0
- package/dist/components/callout.d.ts.map +1 -0
- package/dist/components/callout.js +34 -0
- package/dist/components/card.d.ts +11 -0
- package/dist/components/card.d.ts.map +1 -0
- package/dist/components/card.js +10 -0
- package/dist/components/codeblock.d.ts +42 -0
- package/dist/components/codeblock.d.ts.map +1 -0
- package/dist/components/codeblock.js +68 -0
- package/dist/components/dialog/search-algolia.d.ts +25 -0
- package/dist/components/dialog/search-algolia.d.ts.map +1 -0
- package/dist/components/dialog/search-algolia.js +35 -0
- package/dist/components/dialog/search-default.d.ts +29 -0
- package/dist/components/dialog/search-default.d.ts.map +1 -0
- package/dist/components/dialog/search-default.js +40 -0
- package/dist/components/dialog/search-orama.d.ts +30 -0
- package/dist/components/dialog/search-orama.d.ts.map +1 -0
- package/dist/components/dialog/search-orama.js +40 -0
- package/dist/components/dialog/search.d.ts +72 -0
- package/dist/components/dialog/search.d.ts.map +1 -0
- package/dist/components/dialog/search.js +192 -0
- package/dist/components/dynamic-codeblock.d.ts +21 -0
- package/dist/components/dynamic-codeblock.d.ts.map +1 -0
- package/dist/components/dynamic-codeblock.js +33 -0
- package/dist/components/files.d.ts +19 -0
- package/dist/components/files.d.ts.map +1 -0
- package/dist/components/files.js +18 -0
- package/dist/components/github-info.d.ts +8 -0
- package/dist/components/github-info.d.ts.map +1 -0
- package/dist/components/github-info.js +53 -0
- package/dist/components/heading.d.ts +8 -0
- package/dist/components/heading.d.ts.map +1 -0
- package/dist/components/heading.js +9 -0
- package/dist/components/image-zoom.css +77 -0
- package/dist/components/image-zoom.d.ts +16 -0
- package/dist/components/image-zoom.d.ts.map +1 -0
- package/dist/components/image-zoom.js +23 -0
- package/dist/components/inline-toc.d.ts +8 -0
- package/dist/components/inline-toc.d.ts.map +1 -0
- package/dist/components/inline-toc.js +10 -0
- package/dist/components/sidebar/base.d.ts +72 -0
- package/dist/components/sidebar/base.d.ts.map +1 -0
- package/dist/components/sidebar/base.js +197 -0
- package/dist/components/sidebar/link-item.d.ts +11 -0
- package/dist/components/sidebar/link-item.d.ts.map +1 -0
- package/dist/components/sidebar/link-item.js +13 -0
- package/dist/components/sidebar/page-tree.d.ts +19 -0
- package/dist/components/sidebar/page-tree.d.ts.map +1 -0
- package/dist/components/sidebar/page-tree.js +34 -0
- package/dist/components/sidebar/tabs/dropdown.d.ts +11 -0
- package/dist/components/sidebar/tabs/dropdown.d.ts.map +1 -0
- package/dist/components/sidebar/tabs/dropdown.js +34 -0
- package/dist/components/sidebar/tabs/index.d.ts +21 -0
- package/dist/components/sidebar/tabs/index.d.ts.map +1 -0
- package/dist/components/sidebar/tabs/index.js +49 -0
- package/dist/components/steps.d.ts +8 -0
- package/dist/components/steps.d.ts.map +1 -0
- package/dist/components/steps.js +7 -0
- package/dist/components/tabs.d.ts +31 -0
- package/dist/components/tabs.d.ts.map +1 -0
- package/dist/components/tabs.js +64 -0
- package/dist/components/toc/clerk.d.ts +2 -0
- package/dist/components/toc/clerk.d.ts.map +1 -0
- package/dist/components/toc/clerk.js +1 -0
- package/dist/components/toc/default.d.ts +2 -0
- package/dist/components/toc/default.d.ts.map +1 -0
- package/dist/components/toc/default.js +1 -0
- package/dist/components/toc/index.d.ts +2 -0
- package/dist/components/toc/index.d.ts.map +1 -0
- package/dist/components/toc/index.js +1 -0
- package/dist/components/type-table.d.ts +32 -0
- package/dist/components/type-table.d.ts.map +1 -0
- package/dist/components/type-table.js +28 -0
- package/dist/components/ui/accordion.d.ts +8 -0
- package/dist/components/ui/accordion.d.ts.map +1 -0
- package/dist/components/ui/accordion.js +20 -0
- package/dist/components/ui/button.d.ts +8 -0
- package/dist/components/ui/button.d.ts.map +1 -0
- package/dist/components/ui/button.js +20 -0
- package/dist/components/ui/collapsible.d.ts +9 -0
- package/dist/components/ui/collapsible.d.ts.map +1 -0
- package/dist/components/ui/collapsible.js +9 -0
- package/dist/components/ui/navigation-menu.d.ts +12 -0
- package/dist/components/ui/navigation-menu.d.ts.map +1 -0
- package/dist/components/ui/navigation-menu.js +15 -0
- package/dist/components/ui/popover.d.ts +8 -0
- package/dist/components/ui/popover.d.ts.map +1 -0
- package/dist/components/ui/popover.js +11 -0
- package/dist/components/ui/scroll-area.d.ts +8 -0
- package/dist/components/ui/scroll-area.d.ts.map +1 -0
- package/dist/components/ui/scroll-area.js +11 -0
- package/dist/components/ui/tabs.d.ts +22 -0
- package/dist/components/ui/tabs.d.ts.map +1 -0
- package/dist/components/ui/tabs.js +79 -0
- package/dist/contexts/i18n.d.ts +2 -0
- package/dist/contexts/i18n.d.ts.map +1 -0
- package/dist/contexts/i18n.js +1 -0
- package/dist/contexts/search.d.ts +2 -0
- package/dist/contexts/search.d.ts.map +1 -0
- package/dist/contexts/search.js +1 -0
- package/dist/contexts/tree.d.ts +2 -0
- package/dist/contexts/tree.d.ts.map +1 -0
- package/dist/contexts/tree.js +1 -0
- package/dist/i18n.d.ts +2 -0
- package/dist/i18n.d.ts.map +1 -0
- package/dist/i18n.js +1 -0
- package/dist/layouts/docs/client.d.ts +15 -0
- package/dist/layouts/docs/client.d.ts.map +1 -0
- package/dist/layouts/docs/client.js +41 -0
- package/dist/layouts/docs/index.d.ts +36 -0
- package/dist/layouts/docs/index.d.ts.map +1 -0
- package/dist/layouts/docs/index.js +66 -0
- package/dist/layouts/docs/page/client.d.ts +24 -0
- package/dist/layouts/docs/page/client.d.ts.map +1 -0
- package/dist/layouts/docs/page/client.js +119 -0
- package/dist/layouts/docs/page/index.d.ts +58 -0
- package/dist/layouts/docs/page/index.d.ts.map +1 -0
- package/dist/layouts/docs/page/index.js +51 -0
- package/dist/layouts/docs/sidebar.d.ts +17 -0
- package/dist/layouts/docs/sidebar.d.ts.map +1 -0
- package/dist/layouts/docs/sidebar.js +94 -0
- package/dist/layouts/home/client.d.ts +6 -0
- package/dist/layouts/home/client.d.ts.map +1 -0
- package/dist/layouts/home/client.js +136 -0
- package/dist/layouts/home/index.d.ts +7 -0
- package/dist/layouts/home/index.d.ts.map +1 -0
- package/dist/layouts/home/index.js +8 -0
- package/dist/layouts/home/navbar.d.ts +7 -0
- package/dist/layouts/home/navbar.d.ts.map +1 -0
- package/dist/layouts/home/navbar.js +16 -0
- package/dist/layouts/notebook/client.d.ts +23 -0
- package/dist/layouts/notebook/client.d.ts.map +1 -0
- package/dist/layouts/notebook/client.js +104 -0
- package/dist/layouts/notebook/index.d.ts +34 -0
- package/dist/layouts/notebook/index.d.ts.map +1 -0
- package/dist/layouts/notebook/index.js +89 -0
- package/dist/layouts/notebook/page/client.d.ts +24 -0
- package/dist/layouts/notebook/page/client.d.ts.map +1 -0
- package/dist/layouts/notebook/page/client.js +119 -0
- package/dist/layouts/notebook/page/index.d.ts +58 -0
- package/dist/layouts/notebook/page/index.d.ts.map +1 -0
- package/dist/layouts/notebook/page/index.js +51 -0
- package/dist/layouts/notebook/sidebar.d.ts +17 -0
- package/dist/layouts/notebook/sidebar.d.ts.map +1 -0
- package/dist/layouts/notebook/sidebar.js +91 -0
- package/dist/layouts/shared/index.d.ts +56 -0
- package/dist/layouts/shared/index.d.ts.map +1 -0
- package/dist/layouts/shared/index.js +17 -0
- package/dist/layouts/shared/language-toggle.d.ts +5 -0
- package/dist/layouts/shared/language-toggle.d.ts.map +1 -0
- package/dist/layouts/shared/language-toggle.js +24 -0
- package/dist/layouts/shared/search-toggle.d.ts +11 -0
- package/dist/layouts/shared/search-toggle.d.ts.map +1 -0
- package/dist/layouts/shared/search-toggle.js +27 -0
- package/dist/layouts/shared/theme-toggle.d.ts +5 -0
- package/dist/layouts/shared/theme-toggle.d.ts.map +1 -0
- package/dist/layouts/shared/theme-toggle.js +38 -0
- package/dist/mdx.d.ts +33 -0
- package/dist/mdx.d.ts.map +1 -0
- package/dist/mdx.js +40 -0
- package/dist/mdx.server.d.ts +13 -0
- package/dist/mdx.server.d.ts.map +1 -0
- package/dist/mdx.server.js +15 -0
- package/dist/og.d.ts +2 -0
- package/dist/og.d.ts.map +1 -0
- package/dist/og.js +1 -0
- package/dist/page.d.ts +27 -0
- package/dist/page.d.ts.map +1 -0
- package/dist/page.js +22 -0
- package/dist/provider/base.d.ts +40 -0
- package/dist/provider/base.d.ts.map +1 -0
- package/dist/provider/base.js +19 -0
- package/dist/provider/next.d.ts +14 -0
- package/dist/provider/next.d.ts.map +1 -0
- package/dist/provider/next.js +7 -0
- package/dist/provider/react-router.d.ts +14 -0
- package/dist/provider/react-router.d.ts.map +1 -0
- package/dist/provider/react-router.js +7 -0
- package/dist/provider/tanstack.d.ts +14 -0
- package/dist/provider/tanstack.d.ts.map +1 -0
- package/dist/provider/tanstack.js +7 -0
- package/dist/provider/waku.d.ts +14 -0
- package/dist/provider/waku.d.ts.map +1 -0
- package/dist/provider/waku.js +7 -0
- package/dist/style.css +3159 -0
- package/dist/utils/use-copy-button.d.ts +2 -0
- package/dist/utils/use-copy-button.d.ts.map +1 -0
- package/dist/utils/use-copy-button.js +1 -0
- package/dist/utils/use-footer-items.d.ts +2 -0
- package/dist/utils/use-footer-items.d.ts.map +1 -0
- package/dist/utils/use-footer-items.js +1 -0
- package/dist/utils/use-is-scroll-top.d.ts +2 -0
- package/dist/utils/use-is-scroll-top.d.ts.map +1 -0
- package/dist/utils/use-is-scroll-top.js +1 -0
- package/package.json +133 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2023 Fuma
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
package/css/black.css
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@import '@fumadocs/ui/css/colors/black.css';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@import '@fumadocs/ui/css/colors/catppuccin.css';
|
package/css/dusk.css
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@import '@fumadocs/ui/css/colors/dusk.css';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@source '../../dist/layouts/docs/**/*.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@source '../../dist/layouts/home/**/*.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@source '../../dist/layouts/notebook/**/*.js';
|
package/css/neutral.css
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@import '@fumadocs/ui/css/colors/neutral.css';
|
package/css/ocean.css
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@import '@fumadocs/ui/css/colors/ocean.css';
|
package/css/preset.css
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
@import '@fumadocs/ui/css/base.css';
|
|
2
|
+
|
|
3
|
+
/* TODO: remove them on next major */
|
|
4
|
+
@import './layouts/docs.css';
|
|
5
|
+
@import './layouts/home.css';
|
|
6
|
+
@import './layouts/notebook.css';
|
|
7
|
+
|
|
8
|
+
@source '../dist/*.js';
|
|
9
|
+
@source '../dist/{components,contexts,provider,utils}/**/*.js';
|
|
10
|
+
@source '../dist/layouts/shared/**/*.js';
|
package/css/purple.css
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@import '@fumadocs/ui/css/colors/purple.css';
|
package/css/shadcn.css
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@import '@fumadocs/ui/css/colors/shadcn.css';
|
package/css/solar.css
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@import '@fumadocs/ui/css/colors/solar.css';
|
package/css/style.css
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@import '@fumadocs/ui/css/colors/vitepress.css';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ComponentProps, type ReactNode } from 'react';
|
|
2
|
+
import { Accordion as Root, AccordionItem } from '../components/ui/accordion.js';
|
|
3
|
+
export declare function Accordions({ ref, className, defaultValue, ...props }: ComponentProps<typeof Root>): import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
export declare function Accordion({ title, id, value, children, ...props }: Omit<ComponentProps<typeof AccordionItem>, 'value' | 'title'> & {
|
|
5
|
+
title: string | ReactNode;
|
|
6
|
+
value?: string;
|
|
7
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
//# sourceMappingURL=accordion.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"accordion.d.ts","sourceRoot":"","sources":["../../src/components/accordion.tsx"],"names":[],"mappings":"AAGA,OAAO,EACL,cAAc,EACd,KAAK,SAAS,EAIf,MAAM,OAAO,CAAC;AAKf,OAAO,EACL,SAAS,IAAI,IAAI,EAGjB,aAAa,EAEd,MAAM,2BAA2B,CAAC;AAEnC,wBAAgB,UAAU,CAAC,EACzB,GAAG,EACH,SAAS,EACT,YAAY,EACZ,GAAG,KAAK,EACT,EAAE,cAAc,CAAC,OAAO,IAAI,CAAC,2CA+B7B;AAED,wBAAgB,SAAS,CAAC,EACxB,KAAK,EACL,EAAE,EACF,KAAqB,EACrB,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,IAAI,CAAC,cAAc,CAAC,OAAO,aAAa,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,GAAG;IACjE,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,2CAcA"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { Check, Link as LinkIcon } from '@fumadocs/ui/icons';
|
|
4
|
+
import { useEffect, useRef, useState, } from 'react';
|
|
5
|
+
import { cn } from '@fumadocs/ui/cn';
|
|
6
|
+
import { useCopyButton } from '@fumadocs/ui/hooks/use-copy-button';
|
|
7
|
+
import { buttonVariants } from '../components/ui/button.js';
|
|
8
|
+
import { mergeRefs } from '@fumadocs/ui/merge-refs';
|
|
9
|
+
import { Accordion as Root, AccordionContent, AccordionHeader, AccordionItem, AccordionTrigger, } from '../components/ui/accordion.js';
|
|
10
|
+
export function Accordions({ ref, className, defaultValue, ...props }) {
|
|
11
|
+
const rootRef = useRef(null);
|
|
12
|
+
const composedRef = mergeRefs(ref, rootRef);
|
|
13
|
+
const [value, setValue] = useState(defaultValue ?? []);
|
|
14
|
+
useEffect(() => {
|
|
15
|
+
const id = window.location.hash.substring(1);
|
|
16
|
+
const element = rootRef.current;
|
|
17
|
+
if (!element || id.length === 0)
|
|
18
|
+
return;
|
|
19
|
+
const selected = document.getElementById(id);
|
|
20
|
+
if (!selected || !element.contains(selected))
|
|
21
|
+
return;
|
|
22
|
+
const value = selected.getAttribute('data-accordion-value');
|
|
23
|
+
if (value)
|
|
24
|
+
setValue((prev) => [value, ...prev]);
|
|
25
|
+
}, []);
|
|
26
|
+
return (_jsx(Root, { ref: composedRef, value: value, onValueChange: setValue, className: (s) => cn('divide-y divide-fd-border overflow-hidden rounded-lg border bg-fd-card', typeof className === 'function' ? className(s) : className), ...props }));
|
|
27
|
+
}
|
|
28
|
+
export function Accordion({ title, id, value = String(title), children, ...props }) {
|
|
29
|
+
return (_jsxs(AccordionItem, { value: value, ...props, children: [_jsxs(AccordionHeader, { id: id, "data-accordion-value": value, children: [_jsx(AccordionTrigger, { children: title }), id ? _jsx(CopyButton, { id: id }) : null] }), _jsx(AccordionContent, { hiddenUntilFound: true, children: _jsx("div", { className: "px-4 pb-2 text-[0.9375rem] prose-no-margin [&[hidden]:not([hidden='until-found'])]:hidden", children: children }) })] }));
|
|
30
|
+
}
|
|
31
|
+
function CopyButton({ id }) {
|
|
32
|
+
const [checked, onClick] = useCopyButton(() => {
|
|
33
|
+
const url = new URL(window.location.href);
|
|
34
|
+
url.hash = id;
|
|
35
|
+
return navigator.clipboard.writeText(url.toString());
|
|
36
|
+
});
|
|
37
|
+
return (_jsx("button", { type: "button", "aria-label": "Copy Link", className: cn(buttonVariants({
|
|
38
|
+
color: 'ghost',
|
|
39
|
+
className: 'text-fd-muted-foreground me-2',
|
|
40
|
+
})), onClick: onClick, children: checked ? (_jsx(Check, { className: "size-3.5" })) : (_jsx(LinkIcon, { className: "size-3.5" })) }));
|
|
41
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { type HTMLAttributes } from 'react';
|
|
2
|
+
type BannerVariant = 'rainbow' | 'normal';
|
|
3
|
+
export declare function Banner({ id, variant, changeLayout, height, rainbowColors, ...props }: HTMLAttributes<HTMLDivElement> & {
|
|
4
|
+
/**
|
|
5
|
+
* @defaultValue 3rem
|
|
6
|
+
*/
|
|
7
|
+
height?: string;
|
|
8
|
+
/**
|
|
9
|
+
* @defaultValue 'normal'
|
|
10
|
+
*/
|
|
11
|
+
variant?: BannerVariant;
|
|
12
|
+
/**
|
|
13
|
+
* For rainbow variant only, customise the colors
|
|
14
|
+
*/
|
|
15
|
+
rainbowColors?: string[];
|
|
16
|
+
/**
|
|
17
|
+
* Change Fumadocs layout styles
|
|
18
|
+
*
|
|
19
|
+
* @defaultValue true
|
|
20
|
+
*/
|
|
21
|
+
changeLayout?: boolean;
|
|
22
|
+
}): import("react/jsx-runtime").JSX.Element | null;
|
|
23
|
+
export {};
|
|
24
|
+
//# sourceMappingURL=banner.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"banner.d.ts","sourceRoot":"","sources":["../../src/components/banner.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,cAAc,EAAuB,MAAM,OAAO,CAAC;AAKjE,KAAK,aAAa,GAAG,SAAS,GAAG,QAAQ,CAAC;AAE1C,wBAAgB,MAAM,CAAC,EACrB,EAAE,EACF,OAAkB,EAClB,YAAmB,EACnB,MAAe,EACf,aAKC,EACD,GAAG,KAAK,EACT,EAAE,cAAc,CAAC,cAAc,CAAC,GAAG;IAClC;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;OAEG;IACH,OAAO,CAAC,EAAE,aAAa,CAAC;IAExB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;IAEzB;;;;OAIG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB,kDAuEA"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
+
import { useEffect, useState } from 'react';
|
|
4
|
+
import { X } from '@fumadocs/ui/icons';
|
|
5
|
+
import { cn } from '@fumadocs/ui/cn';
|
|
6
|
+
import { buttonVariants } from '../components/ui/button.js';
|
|
7
|
+
export function Banner({ id, variant = 'normal', changeLayout = true, height = '3rem', rainbowColors = [
|
|
8
|
+
'rgba(0,149,255,0.56)',
|
|
9
|
+
'rgba(231,77,255,0.77)',
|
|
10
|
+
'rgba(255,0,0,0.73)',
|
|
11
|
+
'rgba(131,255,166,0.66)',
|
|
12
|
+
], ...props }) {
|
|
13
|
+
const [open, setOpen] = useState(true);
|
|
14
|
+
const globalKey = id ? `nd-banner-${id}` : null;
|
|
15
|
+
useEffect(() => {
|
|
16
|
+
if (globalKey)
|
|
17
|
+
setOpen(localStorage.getItem(globalKey) !== 'true');
|
|
18
|
+
}, [globalKey]);
|
|
19
|
+
if (!open)
|
|
20
|
+
return null;
|
|
21
|
+
return (_jsxs("div", { id: id, ...props, className: cn('sticky top-0 z-40 flex flex-row items-center justify-center px-4 text-center text-sm font-medium', variant === 'normal' && 'bg-fd-secondary', variant === 'rainbow' && 'bg-fd-background', !open && 'hidden', props.className), style: {
|
|
22
|
+
height,
|
|
23
|
+
}, children: [changeLayout && open ? (_jsx("style", { children: globalKey
|
|
24
|
+
? `:root:not(.${globalKey}) { --fd-banner-height: ${height}; }`
|
|
25
|
+
: `:root { --fd-banner-height: ${height}; }` })) : null, globalKey ? (_jsx("style", { children: `.${globalKey} #${id} { display: none; }` })) : null, globalKey ? (_jsx("script", { dangerouslySetInnerHTML: {
|
|
26
|
+
__html: `if (localStorage.getItem('${globalKey}') === 'true') document.documentElement.classList.add('${globalKey}');`,
|
|
27
|
+
} })) : null, variant === 'rainbow'
|
|
28
|
+
? flow({
|
|
29
|
+
colors: rainbowColors,
|
|
30
|
+
})
|
|
31
|
+
: null, props.children, id ? (_jsx("button", { type: "button", "aria-label": "Close Banner", onClick: () => {
|
|
32
|
+
setOpen(false);
|
|
33
|
+
if (globalKey)
|
|
34
|
+
localStorage.setItem(globalKey, 'true');
|
|
35
|
+
}, className: cn(buttonVariants({
|
|
36
|
+
color: 'ghost',
|
|
37
|
+
className: 'absolute end-2 top-1/2 -translate-y-1/2 text-fd-muted-foreground/50',
|
|
38
|
+
size: 'icon-sm',
|
|
39
|
+
})), children: _jsx(X, {}) })) : null] }));
|
|
40
|
+
}
|
|
41
|
+
const maskImage = 'linear-gradient(to bottom,white,transparent), radial-gradient(circle at top center, white, transparent)';
|
|
42
|
+
function flow({ colors }) {
|
|
43
|
+
return (_jsxs(_Fragment, { children: [_jsx("div", { className: "absolute inset-0 z-[-1]", style: {
|
|
44
|
+
maskImage,
|
|
45
|
+
maskComposite: 'intersect',
|
|
46
|
+
animation: 'fd-moving-banner 20s linear infinite',
|
|
47
|
+
backgroundImage: `repeating-linear-gradient(70deg, ${[...colors, colors[0]].map((color, i) => `${color} ${(i * 50) / colors.length}%`).join(', ')})`,
|
|
48
|
+
backgroundSize: '200% 100%',
|
|
49
|
+
filter: 'saturate(2)',
|
|
50
|
+
} }), _jsx("style", { children: `@keyframes fd-moving-banner {
|
|
51
|
+
from { background-position: 0% 0; }
|
|
52
|
+
to { background-position: 100% 0; }
|
|
53
|
+
}` })] }));
|
|
54
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { ComponentProps, ReactNode } from 'react';
|
|
2
|
+
export type CalloutType = 'info' | 'warn' | 'error' | 'success' | 'warning' | 'idea';
|
|
3
|
+
export declare function Callout({ children, title, ...props }: {
|
|
4
|
+
title?: ReactNode;
|
|
5
|
+
} & Omit<CalloutContainerProps, 'title'>): import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
export interface CalloutContainerProps extends ComponentProps<'div'> {
|
|
7
|
+
/**
|
|
8
|
+
* @defaultValue info
|
|
9
|
+
*/
|
|
10
|
+
type?: CalloutType;
|
|
11
|
+
/**
|
|
12
|
+
* Force an icon
|
|
13
|
+
*/
|
|
14
|
+
icon?: ReactNode;
|
|
15
|
+
}
|
|
16
|
+
export declare function CalloutContainer({ type: inputType, icon, children, className, style, ...props }: CalloutContainerProps): import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
export declare function CalloutTitle({ children, className, ...props }: ComponentProps<'p'>): import("react/jsx-runtime").JSX.Element;
|
|
18
|
+
export declare function CalloutDescription({ children, className, ...props }: ComponentProps<'p'>): import("react/jsx-runtime").JSX.Element;
|
|
19
|
+
//# sourceMappingURL=callout.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"callout.d.ts","sourceRoot":"","sources":["../../src/components/callout.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGvD,MAAM,MAAM,WAAW,GACnB,MAAM,GACN,MAAM,GACN,OAAO,GACP,SAAS,GACT,SAAS,GACT,MAAM,CAAC;AAIX,wBAAgB,OAAO,CAAC,EACtB,QAAQ,EACR,KAAK,EACL,GAAG,KAAK,EACT,EAAE;IAAE,KAAK,CAAC,EAAE,SAAS,CAAA;CAAE,GAAG,IAAI,CAAC,qBAAqB,EAAE,OAAO,CAAC,2CAO9D;AAED,MAAM,WAAW,qBAAsB,SAAQ,cAAc,CAAC,KAAK,CAAC;IAClE;;OAEG;IACH,IAAI,CAAC,EAAE,WAAW,CAAC;IAEnB;;OAEG;IACH,IAAI,CAAC,EAAE,SAAS,CAAC;CAClB;AAQD,wBAAgB,gBAAgB,CAAC,EAC/B,IAAI,EAAE,SAAkB,EACxB,IAAI,EACJ,QAAQ,EACR,SAAS,EACT,KAAK,EACL,GAAG,KAAK,EACT,EAAE,qBAAqB,2CA6BvB;AAED,wBAAgB,YAAY,CAAC,EAC3B,QAAQ,EACR,SAAS,EACT,GAAG,KAAK,EACT,EAAE,cAAc,CAAC,GAAG,CAAC,2CAMrB;AAED,wBAAgB,kBAAkB,CAAC,EACjC,QAAQ,EACR,SAAS,EACT,GAAG,KAAK,EACT,EAAE,cAAc,CAAC,GAAG,CAAC,2CAYrB"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { CircleCheck, CircleX, Info, Sun, TriangleAlert, } from '@fumadocs/ui/icons';
|
|
3
|
+
import { cn } from '@fumadocs/ui/cn';
|
|
4
|
+
const iconClass = 'size-5 -me-0.5 fill-(--callout-color) text-fd-card';
|
|
5
|
+
export function Callout({ children, title, ...props }) {
|
|
6
|
+
return (_jsxs(CalloutContainer, { ...props, children: [title && _jsx(CalloutTitle, { children: title }), _jsx(CalloutDescription, { children: children })] }));
|
|
7
|
+
}
|
|
8
|
+
function resolveAlias(type) {
|
|
9
|
+
if (type === 'warn')
|
|
10
|
+
return 'warning';
|
|
11
|
+
if (type === 'tip')
|
|
12
|
+
return 'info';
|
|
13
|
+
return type;
|
|
14
|
+
}
|
|
15
|
+
export function CalloutContainer({ type: inputType = 'info', icon, children, className, style, ...props }) {
|
|
16
|
+
const type = resolveAlias(inputType);
|
|
17
|
+
return (_jsxs("div", { className: cn('flex gap-2 my-4 rounded-xl border bg-fd-card p-3 ps-1 text-sm text-fd-card-foreground shadow-md', className), style: {
|
|
18
|
+
'--callout-color': `var(--color-fd-${type}, var(--color-fd-muted))`,
|
|
19
|
+
...style,
|
|
20
|
+
}, ...props, children: [_jsx("div", { role: "none", className: "w-0.5 bg-(--callout-color)/50 rounded-sm" }), icon ??
|
|
21
|
+
{
|
|
22
|
+
info: _jsx(Info, { className: iconClass }),
|
|
23
|
+
warning: _jsx(TriangleAlert, { className: iconClass }),
|
|
24
|
+
error: _jsx(CircleX, { className: iconClass }),
|
|
25
|
+
success: _jsx(CircleCheck, { className: iconClass }),
|
|
26
|
+
idea: _jsx(Sun, { className: iconClass }),
|
|
27
|
+
}[type], _jsx("div", { className: "flex flex-col gap-2 min-w-0 flex-1", children: children })] }));
|
|
28
|
+
}
|
|
29
|
+
export function CalloutTitle({ children, className, ...props }) {
|
|
30
|
+
return (_jsx("p", { className: cn('font-medium my-0!', className), ...props, children: children }));
|
|
31
|
+
}
|
|
32
|
+
export function CalloutDescription({ children, className, ...props }) {
|
|
33
|
+
return (_jsx("div", { className: cn('text-fd-muted-foreground prose-no-margin empty:hidden', className), ...props, children: children }));
|
|
34
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { HTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
export declare function Cards(props: HTMLAttributes<HTMLDivElement>): import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
export type CardProps = Omit<HTMLAttributes<HTMLElement>, 'title'> & {
|
|
4
|
+
icon?: ReactNode;
|
|
5
|
+
title: ReactNode;
|
|
6
|
+
description?: ReactNode;
|
|
7
|
+
href?: string;
|
|
8
|
+
external?: boolean;
|
|
9
|
+
};
|
|
10
|
+
export declare function Card({ icon, title, description, ...props }: CardProps): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
//# sourceMappingURL=card.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"card.d.ts","sourceRoot":"","sources":["../../src/components/card.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGvD,wBAAgB,KAAK,CAAC,KAAK,EAAE,cAAc,CAAC,cAAc,CAAC,2CAS1D;AAED,MAAM,MAAM,SAAS,GAAG,IAAI,CAAC,cAAc,CAAC,WAAW,CAAC,EAAE,OAAO,CAAC,GAAG;IACnE,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,KAAK,EAAE,SAAS,CAAC;IACjB,WAAW,CAAC,EAAE,SAAS,CAAC;IAExB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;AAEF,wBAAgB,IAAI,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,WAAW,EAAE,GAAG,KAAK,EAAE,EAAE,SAAS,2CA2BrE"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import Link from 'fumadocs-core/link';
|
|
3
|
+
import { cn } from '@fumadocs/ui/cn';
|
|
4
|
+
export function Cards(props) {
|
|
5
|
+
return (_jsx("div", { ...props, className: cn('grid grid-cols-2 gap-3 @container', props.className), children: props.children }));
|
|
6
|
+
}
|
|
7
|
+
export function Card({ icon, title, description, ...props }) {
|
|
8
|
+
const E = props.href ? Link : 'div';
|
|
9
|
+
return (_jsxs(E, { ...props, "data-card": true, className: cn('block rounded-xl border bg-fd-card p-4 text-fd-card-foreground transition-colors @max-lg:col-span-full', props.href && 'hover:bg-fd-accent/80', props.className), children: [icon ? (_jsx("div", { className: "not-prose mb-2 w-fit shadow-md rounded-lg border bg-fd-muted p-1.5 text-fd-muted-foreground [&_svg]:size-4", children: icon })) : null, _jsx("h3", { className: "not-prose mb-1 text-sm font-medium", children: title }), description ? (_jsx("p", { className: "my-0! text-sm text-fd-muted-foreground", children: description })) : null, _jsx("div", { className: "text-sm text-fd-muted-foreground prose-no-margin empty:hidden", children: props.children })] }));
|
|
10
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { type ComponentProps, type HTMLAttributes, type ReactNode } from 'react';
|
|
2
|
+
import { Tabs, TabsContent, TabsList, TabsTrigger } from '../components/ui/tabs.js';
|
|
3
|
+
export interface CodeBlockProps extends ComponentProps<'figure'> {
|
|
4
|
+
/**
|
|
5
|
+
* Icon of code block
|
|
6
|
+
*
|
|
7
|
+
* When passed as a string, it assumes the value is the HTML of icon
|
|
8
|
+
*/
|
|
9
|
+
icon?: ReactNode;
|
|
10
|
+
/**
|
|
11
|
+
* Allow to copy code with copy button
|
|
12
|
+
*
|
|
13
|
+
* @defaultValue true
|
|
14
|
+
*/
|
|
15
|
+
allowCopy?: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Keep original background color generated by Shiki or Rehype Code
|
|
18
|
+
*
|
|
19
|
+
* @defaultValue false
|
|
20
|
+
*/
|
|
21
|
+
keepBackground?: boolean;
|
|
22
|
+
viewportProps?: HTMLAttributes<HTMLElement>;
|
|
23
|
+
/**
|
|
24
|
+
* show line numbers
|
|
25
|
+
*/
|
|
26
|
+
'data-line-numbers'?: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* @defaultValue 1
|
|
29
|
+
*/
|
|
30
|
+
'data-line-numbers-start'?: number;
|
|
31
|
+
Actions?: (props: {
|
|
32
|
+
className?: string;
|
|
33
|
+
children?: ReactNode;
|
|
34
|
+
}) => ReactNode;
|
|
35
|
+
}
|
|
36
|
+
export declare function Pre(props: ComponentProps<'pre'>): import("react/jsx-runtime").JSX.Element;
|
|
37
|
+
export declare function CodeBlock({ ref, title, allowCopy, keepBackground, icon, viewportProps, children, Actions, ...props }: CodeBlockProps): import("react/jsx-runtime").JSX.Element;
|
|
38
|
+
export declare function CodeBlockTabs({ ref, className, ...props }: ComponentProps<typeof Tabs>): import("react/jsx-runtime").JSX.Element;
|
|
39
|
+
export declare function CodeBlockTabsList({ className, ...props }: ComponentProps<typeof TabsList>): import("react/jsx-runtime").JSX.Element;
|
|
40
|
+
export declare function CodeBlockTabsTrigger({ children, className, ...props }: ComponentProps<typeof TabsTrigger>): import("react/jsx-runtime").JSX.Element;
|
|
41
|
+
export declare function CodeBlockTab(props: ComponentProps<typeof TabsContent>): import("react/jsx-runtime").JSX.Element;
|
|
42
|
+
//# sourceMappingURL=codeblock.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"codeblock.d.ts","sourceRoot":"","sources":["../../src/components/codeblock.tsx"],"names":[],"mappings":"AAEA,OAAO,EACL,KAAK,cAAc,EAEnB,KAAK,cAAc,EACnB,KAAK,SAAS,EAKf,MAAM,OAAO,CAAC;AAIf,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAGhF,MAAM,WAAW,cAAe,SAAQ,cAAc,CAAC,QAAQ,CAAC;IAC9D;;;;OAIG;IACH,IAAI,CAAC,EAAE,SAAS,CAAC;IAEjB;;;;OAIG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB;;;;OAIG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;IAEzB,aAAa,CAAC,EAAE,cAAc,CAAC,WAAW,CAAC,CAAC;IAE5C;;OAEG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAE9B;;OAEG;IACH,yBAAyB,CAAC,EAAE,MAAM,CAAC;IAEnC,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE;QAAE,SAAS,CAAC,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,SAAS,CAAA;KAAE,KAAK,SAAS,CAAC;CAC9E;AAOD,wBAAgB,GAAG,CAAC,KAAK,EAAE,cAAc,CAAC,KAAK,CAAC,2CAS/C;AAED,wBAAgB,SAAS,CAAC,EACxB,GAAG,EACH,KAAK,EACL,SAAgB,EAChB,cAAsB,EACtB,IAAI,EACJ,aAAkB,EAClB,QAAQ,EACR,OAEC,EACD,GAAG,KAAK,EACT,EAAE,cAAc,2CAqEhB;AA0CD,wBAAgB,aAAa,CAAC,EAC5B,GAAG,EACH,SAAS,EACT,GAAG,KAAK,EACT,EAAE,cAAc,CAAC,OAAO,IAAI,CAAC,2CA6B7B;AAED,wBAAgB,iBAAiB,CAAC,EAChC,SAAS,EACT,GAAG,KAAK,EACT,EAAE,cAAc,CAAC,OAAO,QAAQ,CAAC,2CAcjC;AAED,wBAAgB,oBAAoB,CAAC,EACnC,QAAQ,EACR,SAAS,EACT,GAAG,KAAK,EACT,EAAE,cAAc,CAAC,OAAO,WAAW,CAAC,2CAgBpC;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,cAAc,CAAC,OAAO,WAAW,CAAC,2CAErE"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { Check, Clipboard } from '@fumadocs/ui/icons';
|
|
4
|
+
import { createContext, use, useMemo, useRef, } from 'react';
|
|
5
|
+
import { cn } from '@fumadocs/ui/cn';
|
|
6
|
+
import { useCopyButton } from '@fumadocs/ui/hooks/use-copy-button';
|
|
7
|
+
import { buttonVariants } from '../components/ui/button.js';
|
|
8
|
+
import { Tabs, TabsContent, TabsList, TabsTrigger } from '../components/ui/tabs.js';
|
|
9
|
+
import { mergeRefs } from '@fumadocs/ui/merge-refs';
|
|
10
|
+
const TabsContext = createContext(null);
|
|
11
|
+
export function Pre(props) {
|
|
12
|
+
return (_jsx("pre", { ...props, className: cn('min-w-full w-max *:flex *:flex-col', props.className), children: props.children }));
|
|
13
|
+
}
|
|
14
|
+
export function CodeBlock({ ref, title, allowCopy = true, keepBackground = false, icon, viewportProps = {}, children, Actions = (props) => (_jsx("div", { ...props, className: cn('empty:hidden', props.className) })), ...props }) {
|
|
15
|
+
const inTab = use(TabsContext) !== null;
|
|
16
|
+
const areaRef = useRef(null);
|
|
17
|
+
return (_jsxs("figure", { ref: ref, dir: "ltr", ...props, tabIndex: -1, className: cn(inTab
|
|
18
|
+
? 'bg-fd-secondary -mx-px -mb-px last:rounded-b-xl'
|
|
19
|
+
: 'my-4 bg-fd-card rounded-xl', keepBackground && 'bg-(--shiki-light-bg) dark:bg-(--shiki-dark-bg)', 'shiki relative border shadow-sm not-prose overflow-hidden text-sm', props.className), children: [title ? (_jsxs("div", { className: "flex text-fd-muted-foreground items-center gap-2 h-9.5 border-b px-4", children: [typeof icon === 'string' ? (_jsx("div", { className: "[&_svg]:size-3.5", dangerouslySetInnerHTML: {
|
|
20
|
+
__html: icon,
|
|
21
|
+
} })) : (icon), _jsx("figcaption", { className: "flex-1 truncate", children: title }), Actions({
|
|
22
|
+
className: '-me-2',
|
|
23
|
+
children: allowCopy && _jsx(CopyButton, { containerRef: areaRef }),
|
|
24
|
+
})] })) : (Actions({
|
|
25
|
+
className: 'absolute top-2 right-2 z-2 backdrop-blur-lg rounded-lg text-fd-muted-foreground',
|
|
26
|
+
children: allowCopy && _jsx(CopyButton, { containerRef: areaRef }),
|
|
27
|
+
})), _jsx("div", { ref: areaRef, ...viewportProps, role: "region", tabIndex: 0, className: cn('text-[0.8125rem] py-3.5 overflow-auto max-h-[600px] fd-scroll-container focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-fd-ring', viewportProps.className), style: {
|
|
28
|
+
// space for toolbar
|
|
29
|
+
'--padding-right': !title ? 'calc(var(--spacing) * 8)' : undefined,
|
|
30
|
+
counterSet: props['data-line-numbers']
|
|
31
|
+
? `line ${Number(props['data-line-numbers-start'] ?? 1) - 1}`
|
|
32
|
+
: undefined,
|
|
33
|
+
...viewportProps.style,
|
|
34
|
+
}, children: children })] }));
|
|
35
|
+
}
|
|
36
|
+
function CopyButton({ className, containerRef, ...props }) {
|
|
37
|
+
const [checked, onClick] = useCopyButton(() => {
|
|
38
|
+
const pre = containerRef.current?.getElementsByTagName('pre').item(0);
|
|
39
|
+
if (!pre)
|
|
40
|
+
return;
|
|
41
|
+
const clone = pre.cloneNode(true);
|
|
42
|
+
clone.querySelectorAll('.nd-copy-ignore').forEach((node) => {
|
|
43
|
+
node.replaceWith('\n');
|
|
44
|
+
});
|
|
45
|
+
void navigator.clipboard.writeText(clone.textContent ?? '');
|
|
46
|
+
});
|
|
47
|
+
return (_jsx("button", { type: "button", "data-checked": checked || undefined, className: cn(buttonVariants({
|
|
48
|
+
className: 'hover:text-fd-accent-foreground data-checked:text-fd-accent-foreground',
|
|
49
|
+
size: 'icon-xs',
|
|
50
|
+
}), className), "aria-label": checked ? 'Copied Text' : 'Copy Text', onClick: onClick, ...props, children: checked ? _jsx(Check, {}) : _jsx(Clipboard, {}) }));
|
|
51
|
+
}
|
|
52
|
+
export function CodeBlockTabs({ ref, className, ...props }) {
|
|
53
|
+
const containerRef = useRef(null);
|
|
54
|
+
const nested = use(TabsContext) !== null;
|
|
55
|
+
return (_jsx(Tabs, { ref: mergeRefs(containerRef, ref), ...props, className: (s) => cn('bg-fd-card rounded-xl border', !nested && 'my-4', typeof className === 'function' ? className(s) : className), children: _jsx(TabsContext, { value: useMemo(() => ({
|
|
56
|
+
containerRef,
|
|
57
|
+
nested,
|
|
58
|
+
}), [nested]), children: props.children }) }));
|
|
59
|
+
}
|
|
60
|
+
export function CodeBlockTabsList({ className, ...props }) {
|
|
61
|
+
return (_jsx(TabsList, { ...props, className: (s) => cn('flex flex-row px-2 overflow-x-auto text-fd-muted-foreground', typeof className === 'function' ? className(s) : className), children: props.children }));
|
|
62
|
+
}
|
|
63
|
+
export function CodeBlockTabsTrigger({ children, className, ...props }) {
|
|
64
|
+
return (_jsxs(TabsTrigger, { ...props, className: (s) => cn('relative group inline-flex text-sm font-medium text-nowrap items-center transition-colors gap-2 px-2 py-1.5 [&_svg]:size-3.5', s.active ? 'text-fd-primary' : 'hover:text-fd-accent-foreground', typeof className === 'function' ? className(s) : className), children: [_jsx("div", { className: "absolute inset-x-2 bottom-0 h-px group-data-[active]:bg-fd-primary" }), children] }));
|
|
65
|
+
}
|
|
66
|
+
export function CodeBlockTab(props) {
|
|
67
|
+
return _jsx(TabsContent, { ...props });
|
|
68
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { type AlgoliaOptions } from 'fumadocs-core/search/client';
|
|
2
|
+
import { type ReactNode } from 'react';
|
|
3
|
+
import { type SharedProps } from './search.js';
|
|
4
|
+
import type { SearchLink, TagItem } from '../../contexts/search.js';
|
|
5
|
+
export interface AlgoliaSearchDialogProps extends SharedProps {
|
|
6
|
+
searchOptions: AlgoliaOptions;
|
|
7
|
+
links?: SearchLink[];
|
|
8
|
+
footer?: ReactNode;
|
|
9
|
+
defaultTag?: string;
|
|
10
|
+
tags?: TagItem[];
|
|
11
|
+
/**
|
|
12
|
+
* Add the "Powered by Algolia" label, this is useful for free tier users
|
|
13
|
+
*
|
|
14
|
+
* @defaultValue false
|
|
15
|
+
*/
|
|
16
|
+
showAlgolia?: boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Allow to clear tag filters
|
|
19
|
+
*
|
|
20
|
+
* @defaultValue false
|
|
21
|
+
*/
|
|
22
|
+
allowClear?: boolean;
|
|
23
|
+
}
|
|
24
|
+
export default function AlgoliaSearchDialog({ searchOptions, tags, defaultTag, showAlgolia, allowClear, links, footer, ...props }: AlgoliaSearchDialogProps): import("react/jsx-runtime").JSX.Element;
|
|
25
|
+
//# sourceMappingURL=search-algolia.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"search-algolia.d.ts","sourceRoot":"","sources":["../../../src/components/dialog/search-algolia.tsx"],"names":[],"mappings":"AAEA,OAAO,EACL,KAAK,cAAc,EAEpB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,KAAK,SAAS,EAAqB,MAAM,OAAO,CAAC;AAE1D,OAAO,EAUL,KAAK,WAAW,EAGjB,MAAM,UAAU,CAAC;AAElB,OAAO,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAG7D,MAAM,WAAW,wBAAyB,SAAQ,WAAW;IAC3D,aAAa,EAAE,cAAc,CAAC;IAC9B,KAAK,CAAC,EAAE,UAAU,EAAE,CAAC;IAErB,MAAM,CAAC,EAAE,SAAS,CAAC;IAEnB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,IAAI,CAAC,EAAE,OAAO,EAAE,CAAC;IAEjB;;;;OAIG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IAEtB;;;;OAIG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,MAAM,CAAC,OAAO,UAAU,mBAAmB,CAAC,EAC1C,aAAa,EACb,IAAS,EACT,UAAU,EACV,WAAmB,EACnB,UAAkB,EAClB,KAAU,EACV,MAAM,EACN,GAAG,KAAK,EACT,EAAE,wBAAwB,2CA4D1B"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useDocsSearch, } from 'fumadocs-core/search/client';
|
|
4
|
+
import { useMemo, useState } from 'react';
|
|
5
|
+
import { useOnChange } from 'fumadocs-core/utils/use-on-change';
|
|
6
|
+
import { SearchDialog, SearchDialogClose, SearchDialogContent, SearchDialogFooter, SearchDialogHeader, SearchDialogIcon, SearchDialogInput, SearchDialogList, SearchDialogOverlay, TagsList, TagsListItem, } from './search.js';
|
|
7
|
+
import { useI18n } from '../../contexts/i18n.js';
|
|
8
|
+
export default function AlgoliaSearchDialog({ searchOptions, tags = [], defaultTag, showAlgolia = false, allowClear = false, links = [], footer, ...props }) {
|
|
9
|
+
const [tag, setTag] = useState(defaultTag);
|
|
10
|
+
const { locale } = useI18n();
|
|
11
|
+
const { search, setSearch, query } = useDocsSearch({
|
|
12
|
+
type: 'algolia',
|
|
13
|
+
tag,
|
|
14
|
+
locale,
|
|
15
|
+
...searchOptions,
|
|
16
|
+
});
|
|
17
|
+
const defaultItems = useMemo(() => {
|
|
18
|
+
if (links.length === 0)
|
|
19
|
+
return null;
|
|
20
|
+
return links.map(([name, link]) => ({
|
|
21
|
+
type: 'page',
|
|
22
|
+
id: name,
|
|
23
|
+
content: name,
|
|
24
|
+
url: link,
|
|
25
|
+
}));
|
|
26
|
+
}, [links]);
|
|
27
|
+
useOnChange(defaultTag, (v) => {
|
|
28
|
+
setTag(v);
|
|
29
|
+
});
|
|
30
|
+
const label = showAlgolia && _jsx(AlgoliaTitle, {});
|
|
31
|
+
return (_jsxs(SearchDialog, { search: search, onSearchChange: setSearch, isLoading: query.isLoading, ...props, children: [_jsx(SearchDialogOverlay, {}), _jsxs(SearchDialogContent, { children: [_jsxs(SearchDialogHeader, { children: [_jsx(SearchDialogIcon, {}), _jsx(SearchDialogInput, {}), _jsx(SearchDialogClose, {})] }), _jsx(SearchDialogList, { items: query.data !== 'empty' ? query.data : defaultItems })] }), _jsxs(SearchDialogFooter, { children: [tags.length > 0 ? (_jsxs(TagsList, { tag: tag, onTagChange: setTag, allowClear: allowClear, children: [tags.map((tag) => (_jsx(TagsListItem, { value: tag.value, children: tag.name }, tag.value))), label] })) : (label), footer] })] }));
|
|
32
|
+
}
|
|
33
|
+
function AlgoliaTitle() {
|
|
34
|
+
return (_jsx("a", { href: "https://algolia.com", rel: "noreferrer noopener", className: "ms-auto text-xs text-fd-muted-foreground", children: "Search powered by Algolia" }));
|
|
35
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import { type SharedProps } from './search.js';
|
|
3
|
+
import type { SearchLink, TagItem } from '../../contexts/search.js';
|
|
4
|
+
export interface DefaultSearchDialogProps extends SharedProps {
|
|
5
|
+
links?: SearchLink[];
|
|
6
|
+
/**
|
|
7
|
+
* @defaultValue 'fetch'
|
|
8
|
+
*/
|
|
9
|
+
type?: 'fetch' | 'static';
|
|
10
|
+
defaultTag?: string;
|
|
11
|
+
tags?: TagItem[];
|
|
12
|
+
/**
|
|
13
|
+
* Search API URL
|
|
14
|
+
*/
|
|
15
|
+
api?: string;
|
|
16
|
+
/**
|
|
17
|
+
* The debounced delay for performing a search.
|
|
18
|
+
*/
|
|
19
|
+
delayMs?: number;
|
|
20
|
+
footer?: ReactNode;
|
|
21
|
+
/**
|
|
22
|
+
* Allow to clear tag filters
|
|
23
|
+
*
|
|
24
|
+
* @defaultValue false
|
|
25
|
+
*/
|
|
26
|
+
allowClear?: boolean;
|
|
27
|
+
}
|
|
28
|
+
export default function DefaultSearchDialog({ defaultTag, tags, api, delayMs, type, allowClear, links, footer, ...props }: DefaultSearchDialogProps): import("react/jsx-runtime").JSX.Element;
|
|
29
|
+
//# sourceMappingURL=search-default.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"search-default.d.ts","sourceRoot":"","sources":["../../../src/components/dialog/search-default.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,SAAS,EAAqB,MAAM,OAAO,CAAC;AAG1D,OAAO,EAUL,KAAK,WAAW,EAGjB,MAAM,UAAU,CAAC;AAElB,OAAO,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAE7D,MAAM,WAAW,wBAAyB,SAAQ,WAAW;IAC3D,KAAK,CAAC,EAAE,UAAU,EAAE,CAAC;IAErB;;OAEG;IACH,IAAI,CAAC,EAAE,OAAO,GAAG,QAAQ,CAAC;IAE1B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,IAAI,CAAC,EAAE,OAAO,EAAE,CAAC;IAEjB;;OAEG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB,MAAM,CAAC,EAAE,SAAS,CAAC;IAEnB;;;;OAIG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,MAAM,CAAC,OAAO,UAAU,mBAAmB,CAAC,EAC1C,UAAU,EACV,IAAS,EACT,GAAG,EACH,OAAO,EACP,IAAc,EACd,UAAkB,EAClB,KAAU,EACV,MAAM,EACN,GAAG,KAAK,EACT,EAAE,wBAAwB,2CAkE1B"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useDocsSearch } from 'fumadocs-core/search/client';
|
|
4
|
+
import { useMemo, useState } from 'react';
|
|
5
|
+
import { useOnChange } from 'fumadocs-core/utils/use-on-change';
|
|
6
|
+
import { useI18n } from '../../contexts/i18n.js';
|
|
7
|
+
import { SearchDialog, SearchDialogClose, SearchDialogContent, SearchDialogFooter, SearchDialogHeader, SearchDialogIcon, SearchDialogInput, SearchDialogList, SearchDialogOverlay, TagsList, TagsListItem, } from './search.js';
|
|
8
|
+
export default function DefaultSearchDialog({ defaultTag, tags = [], api, delayMs, type = 'fetch', allowClear = false, links = [], footer, ...props }) {
|
|
9
|
+
const { locale } = useI18n();
|
|
10
|
+
const [tag, setTag] = useState(defaultTag);
|
|
11
|
+
const { search, setSearch, query } = useDocsSearch(type === 'fetch'
|
|
12
|
+
? {
|
|
13
|
+
type: 'fetch',
|
|
14
|
+
api,
|
|
15
|
+
locale,
|
|
16
|
+
tag,
|
|
17
|
+
delayMs,
|
|
18
|
+
}
|
|
19
|
+
: {
|
|
20
|
+
type: 'static',
|
|
21
|
+
from: api,
|
|
22
|
+
locale,
|
|
23
|
+
tag,
|
|
24
|
+
delayMs,
|
|
25
|
+
});
|
|
26
|
+
const defaultItems = useMemo(() => {
|
|
27
|
+
if (links.length === 0)
|
|
28
|
+
return null;
|
|
29
|
+
return links.map(([name, link]) => ({
|
|
30
|
+
type: 'page',
|
|
31
|
+
id: name,
|
|
32
|
+
content: name,
|
|
33
|
+
url: link,
|
|
34
|
+
}));
|
|
35
|
+
}, [links]);
|
|
36
|
+
useOnChange(defaultTag, (v) => {
|
|
37
|
+
setTag(v);
|
|
38
|
+
});
|
|
39
|
+
return (_jsxs(SearchDialog, { search: search, onSearchChange: setSearch, isLoading: query.isLoading, ...props, children: [_jsx(SearchDialogOverlay, {}), _jsxs(SearchDialogContent, { children: [_jsxs(SearchDialogHeader, { children: [_jsx(SearchDialogIcon, {}), _jsx(SearchDialogInput, {}), _jsx(SearchDialogClose, {})] }), _jsx(SearchDialogList, { items: query.data !== 'empty' ? query.data : defaultItems })] }), _jsxs(SearchDialogFooter, { children: [tags.length > 0 && (_jsx(TagsList, { tag: tag, onTagChange: setTag, allowClear: allowClear, children: tags.map((tag) => (_jsx(TagsListItem, { value: tag.value, children: tag.name }, tag.value))) })), footer] })] }));
|
|
40
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { type OramaCloudOptions } from 'fumadocs-core/search/client';
|
|
2
|
+
import { type ReactNode } from 'react';
|
|
3
|
+
import { type SharedProps } from './search.js';
|
|
4
|
+
import type { SearchLink, TagItem } from '../../contexts/search.js';
|
|
5
|
+
export interface OramaSearchDialogProps extends SharedProps {
|
|
6
|
+
links?: SearchLink[];
|
|
7
|
+
client: OramaCloudOptions['client'];
|
|
8
|
+
searchOptions?: OramaCloudOptions['params'];
|
|
9
|
+
index?: OramaCloudOptions['index'];
|
|
10
|
+
footer?: ReactNode;
|
|
11
|
+
defaultTag?: string;
|
|
12
|
+
tags?: TagItem[];
|
|
13
|
+
/**
|
|
14
|
+
* Add the "Powered by Orama" label
|
|
15
|
+
*
|
|
16
|
+
* @defaultValue true
|
|
17
|
+
*/
|
|
18
|
+
showOrama?: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Allow to clear tag filters
|
|
21
|
+
*
|
|
22
|
+
* @defaultValue false
|
|
23
|
+
*/
|
|
24
|
+
allowClear?: boolean;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Orama Cloud integration
|
|
28
|
+
*/
|
|
29
|
+
export default function OramaSearchDialog({ client, searchOptions, tags, defaultTag, showOrama, allowClear, index, footer, links, ...props }: OramaSearchDialogProps): import("react/jsx-runtime").JSX.Element;
|
|
30
|
+
//# sourceMappingURL=search-orama.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"search-orama.d.ts","sourceRoot":"","sources":["../../../src/components/dialog/search-orama.tsx"],"names":[],"mappings":"AAEA,OAAO,EACL,KAAK,iBAAiB,EAEvB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,KAAK,SAAS,EAAqB,MAAM,OAAO,CAAC;AAE1D,OAAO,EAUL,KAAK,WAAW,EAGjB,MAAM,UAAU,CAAC;AAElB,OAAO,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAG7D,MAAM,WAAW,sBAAuB,SAAQ,WAAW;IACzD,KAAK,CAAC,EAAE,UAAU,EAAE,CAAC;IACrB,MAAM,EAAE,iBAAiB,CAAC,QAAQ,CAAC,CAAC;IACpC,aAAa,CAAC,EAAE,iBAAiB,CAAC,QAAQ,CAAC,CAAC;IAC5C,KAAK,CAAC,EAAE,iBAAiB,CAAC,OAAO,CAAC,CAAC;IAEnC,MAAM,CAAC,EAAE,SAAS,CAAC;IAEnB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,IAAI,CAAC,EAAE,OAAO,EAAE,CAAC;IAEjB;;;;OAIG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB;;;;OAIG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED;;GAEG;AACH,MAAM,CAAC,OAAO,UAAU,iBAAiB,CAAC,EACxC,MAAM,EACN,aAAa,EACb,IAAS,EACT,UAAU,EACV,SAAgB,EAChB,UAAkB,EAClB,KAAK,EACL,MAAM,EACN,KAAU,EACV,GAAG,KAAK,EACT,EAAE,sBAAsB,2CAgExB"}
|