fumadocs-ui 14.2.1 → 14.3.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/dist/components/accordion.d.ts +4 -7
- package/dist/components/accordion.d.ts.map +1 -0
- package/dist/components/accordion.js +32 -104
- package/dist/components/api.d.ts +4 -13
- package/dist/components/api.d.ts.map +1 -0
- package/dist/components/api.js +3 -16
- package/dist/components/banner.d.ts +3 -5
- package/dist/components/banner.d.ts.map +1 -0
- package/dist/components/banner.js +53 -120
- package/dist/components/callout.d.ts +4 -7
- package/dist/components/callout.d.ts.map +1 -0
- package/dist/components/callout.js +13 -9
- package/dist/components/card.d.ts +5 -7
- package/dist/components/card.d.ts.map +1 -0
- package/dist/components/card.js +10 -10
- package/dist/components/codeblock.d.ts +6 -9
- package/dist/components/codeblock.d.ts.map +1 -0
- package/dist/components/codeblock.js +41 -15
- package/dist/components/dialog/search-algolia.d.ts +7 -11
- package/dist/components/dialog/search-algolia.d.ts.map +1 -0
- package/dist/components/dialog/search-algolia.js +19 -79
- package/dist/components/dialog/search-default.d.ts +6 -10
- package/dist/components/dialog/search-default.d.ts.map +1 -0
- package/dist/components/dialog/search-default.js +24 -73
- package/dist/components/dialog/search-orama.d.ts +7 -11
- package/dist/components/dialog/search-orama.d.ts.map +1 -0
- package/dist/components/dialog/search-orama.js +22 -79
- package/dist/components/dialog/search.d.ts +7 -9
- package/dist/components/dialog/search.d.ts.map +1 -0
- package/dist/components/dialog/search.js +98 -13
- package/dist/components/dialog/tag-list.d.ts +13 -0
- package/dist/components/dialog/tag-list.d.ts.map +1 -0
- package/dist/components/dialog/tag-list.js +20 -0
- package/dist/components/files.d.ts +7 -9
- package/dist/components/files.d.ts.map +1 -0
- package/dist/components/files.js +15 -63
- package/dist/components/heading.d.ts +4 -5
- package/dist/components/heading.d.ts.map +1 -0
- package/dist/components/heading.js +9 -9
- package/dist/components/image-zoom.d.ts +7 -8
- package/dist/components/image-zoom.d.ts.map +1 -0
- package/dist/components/image-zoom.js +16 -40
- package/dist/components/inline-toc.d.ts +4 -6
- package/dist/components/inline-toc.d.ts.map +1 -0
- package/dist/components/inline-toc.js +8 -46
- package/dist/components/layout/breadcrumb.d.ts +11 -0
- package/dist/components/layout/breadcrumb.d.ts.map +1 -0
- package/dist/components/layout/breadcrumb.js +20 -0
- package/dist/components/layout/language-toggle.d.ts +5 -7
- package/dist/components/layout/language-toggle.d.ts.map +1 -0
- package/dist/components/layout/language-toggle.js +24 -14
- package/dist/components/layout/nav.d.ts +28 -0
- package/dist/components/layout/nav.d.ts.map +1 -0
- package/dist/components/layout/nav.js +29 -0
- package/dist/components/layout/root-toggle.d.ts +5 -7
- package/dist/components/layout/root-toggle.d.ts.map +1 -0
- package/dist/components/layout/root-toggle.js +28 -13
- package/dist/components/layout/search-toggle.d.ts +4 -0
- package/dist/components/layout/search-toggle.d.ts.map +1 -0
- package/dist/components/layout/search-toggle.js +24 -0
- package/dist/components/layout/theme-toggle.d.ts +3 -0
- package/dist/components/layout/theme-toggle.d.ts.map +1 -0
- package/dist/components/layout/theme-toggle.js +21 -0
- package/dist/components/layout/toc-clerk.d.ts +6 -0
- package/dist/components/layout/toc-clerk.d.ts.map +1 -0
- package/dist/components/layout/toc-clerk.js +76 -0
- package/dist/components/layout/toc-popover.d.ts +8 -0
- package/dist/components/layout/toc-popover.d.ts.map +1 -0
- package/dist/components/layout/toc-popover.js +20 -0
- package/dist/components/layout/toc-thumb.d.ts +6 -0
- package/dist/components/layout/toc-thumb.d.ts.map +1 -0
- package/dist/components/layout/toc-thumb.js +53 -0
- package/dist/components/layout/toc.d.ts +19 -0
- package/dist/components/layout/toc.d.ts.map +1 -0
- package/dist/components/layout/toc.js +25 -0
- package/dist/components/registry.d.ts +3 -0
- package/dist/components/registry.d.ts.map +1 -0
- package/dist/components/registry.js +70 -0
- package/dist/components/steps.d.ts +4 -6
- package/dist/components/steps.d.ts.map +1 -0
- package/dist/components/steps.js +5 -16
- package/dist/components/tabs.d.ts +7 -21
- package/dist/components/tabs.d.ts.map +1 -0
- package/dist/components/tabs.js +61 -171
- package/dist/components/type-table.d.ts +5 -6
- package/dist/components/type-table.d.ts.map +1 -0
- package/dist/components/type-table.js +18 -59
- package/dist/components/ui/button.d.ts +5 -0
- package/dist/components/ui/button.d.ts.map +1 -0
- package/dist/components/ui/button.js +14 -0
- package/dist/components/ui/collapsible.d.ts +6 -0
- package/dist/components/ui/collapsible.d.ts.map +1 -0
- package/dist/components/ui/collapsible.js +12 -0
- package/dist/components/ui/navigation-menu.d.ts +11 -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 +7 -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 +8 -0
- package/dist/components/ui/tabs.d.ts.map +1 -0
- package/dist/components/ui/tabs.js +16 -0
- package/dist/{i18n-Db2HAPOu.d.ts → contexts/i18n.d.ts} +9 -5
- package/dist/contexts/i18n.d.ts.map +1 -0
- package/dist/contexts/i18n.js +23 -0
- package/dist/contexts/search.d.ts +50 -0
- package/dist/contexts/search.d.ts.map +1 -0
- package/dist/contexts/search.js +50 -0
- package/dist/contexts/sidebar.d.ts +18 -0
- package/dist/contexts/sidebar.d.ts.map +1 -0
- package/dist/contexts/sidebar.js +31 -0
- package/dist/contexts/tree.d.ts +13 -0
- package/dist/contexts/tree.d.ts.map +1 -0
- package/dist/contexts/tree.js +25 -0
- package/dist/i18n.d.ts +5 -6
- package/dist/i18n.d.ts.map +1 -0
- package/dist/i18n.js +31 -49
- package/dist/layouts/docs/navbar.d.ts +4 -0
- package/dist/layouts/docs/navbar.d.ts.map +1 -0
- package/dist/layouts/docs/navbar.js +22 -0
- package/dist/layouts/docs/sidebar.d.ts +40 -0
- package/dist/layouts/docs/sidebar.d.ts.map +1 -0
- package/dist/layouts/docs/sidebar.js +146 -0
- package/dist/layouts/docs.client.d.ts +14 -25
- package/dist/layouts/docs.client.d.ts.map +1 -0
- package/dist/layouts/docs.client.js +53 -195
- package/dist/layouts/docs.d.ts +34 -19
- package/dist/layouts/docs.d.ts.map +1 -0
- package/dist/layouts/docs.js +67 -202
- package/dist/layouts/home/menu.d.ts +6 -0
- package/dist/layouts/home/menu.d.ts.map +1 -0
- package/dist/layouts/home/menu.js +33 -0
- package/dist/layouts/home/navbar.d.ts +16 -0
- package/dist/layouts/home/navbar.d.ts.map +1 -0
- package/dist/layouts/home/navbar.js +48 -0
- package/dist/layouts/home.d.ts +5 -7
- package/dist/layouts/home.d.ts.map +1 -0
- package/dist/layouts/home.js +51 -59
- package/dist/layouts/links.d.ts +80 -0
- package/dist/layouts/links.d.ts.map +1 -0
- package/dist/layouts/links.js +14 -0
- package/dist/layouts/shared.d.ts +48 -2
- package/dist/layouts/shared.d.ts.map +1 -0
- package/dist/layouts/shared.js +27 -9
- package/dist/mdx.client.d.ts +3 -6
- package/dist/mdx.client.d.ts.map +1 -0
- package/dist/mdx.client.js +12 -19
- package/dist/mdx.d.ts +18 -20
- package/dist/mdx.d.ts.map +1 -0
- package/dist/mdx.js +47 -56
- package/dist/og.d.ts +6 -7
- package/dist/og.d.ts.map +1 -0
- package/dist/og.js +43 -102
- package/dist/page.client.d.ts +8 -41
- package/dist/page.client.d.ts.map +1 -0
- package/dist/page.client.js +71 -261
- package/dist/page.d.ts +28 -30
- package/dist/page.d.ts.map +1 -0
- package/dist/page.js +80 -168
- package/dist/provider.d.ts +12 -72
- package/dist/provider.d.ts.map +1 -0
- package/dist/provider.js +19 -55
- package/dist/style.css +1 -1
- package/dist/tailwind-plugin.d.ts +9 -20
- package/dist/tailwind-plugin.d.ts.map +1 -0
- package/dist/tailwind-plugin.js +191 -699
- package/dist/theme/animations.d.ts +170 -0
- package/dist/theme/animations.d.ts.map +1 -0
- package/dist/theme/animations.js +95 -0
- package/dist/theme/colors.d.ts +11 -0
- package/dist/theme/colors.d.ts.map +1 -0
- package/dist/theme/colors.js +327 -0
- package/dist/theme/typography.d.ts +70 -0
- package/dist/theme/typography.d.ts.map +1 -0
- package/dist/theme/typography.js +71 -0
- package/dist/utils/cn.d.ts +2 -0
- package/dist/utils/cn.d.ts.map +1 -0
- package/dist/utils/cn.js +1 -0
- package/dist/utils/get-sidebar-tabs.d.ts +7 -0
- package/dist/utils/get-sidebar-tabs.d.ts.map +1 -0
- package/dist/utils/get-sidebar-tabs.js +20 -0
- package/dist/utils/is-active.d.ts +2 -0
- package/dist/utils/is-active.d.ts.map +1 -0
- package/dist/utils/is-active.js +3 -0
- package/dist/utils/use-copy-button.d.ts +3 -0
- package/dist/utils/use-copy-button.d.ts.map +1 -0
- package/dist/utils/use-copy-button.js +25 -0
- package/package.json +9 -9
- package/dist/chunk-27HFSL7N.js +0 -53
- package/dist/chunk-2FLZOPQN.js +0 -54
- package/dist/chunk-2KMKNVSN.js +0 -29
- package/dist/chunk-AFMXKA2S.js +0 -125
- package/dist/chunk-CDPVENXR.js +0 -8
- package/dist/chunk-CLF6ZVYS.js +0 -259
- package/dist/chunk-DGKCMOIC.js +0 -56
- package/dist/chunk-DN6Z5VW6.js +0 -61
- package/dist/chunk-E3VO2QQT.js +0 -29
- package/dist/chunk-EFMHXXHW.js +0 -24
- package/dist/chunk-F534DZID.js +0 -43
- package/dist/chunk-GHOAONNQ.js +0 -48
- package/dist/chunk-IL64LMKR.js +0 -82
- package/dist/chunk-ILBYBJ5C.js +0 -38
- package/dist/chunk-IVBHRX3O.js +0 -31
- package/dist/chunk-J6XGK6ZG.js +0 -212
- package/dist/chunk-KZTWSBYY.js +0 -68
- package/dist/chunk-MCX7E6ZW.js +0 -57
- package/dist/chunk-MLKGABMK.js +0 -9
- package/dist/chunk-QKOA6KEZ.js +0 -22
- package/dist/chunk-TK3TM3MR.js +0 -6
- package/dist/chunk-TQJ6YPJ3.js +0 -31
- package/dist/chunk-UUGCW3UP.js +0 -84
- package/dist/chunk-VPJMNIJX.js +0 -542
- package/dist/chunk-W36BQGMB.js +0 -69
- package/dist/chunk-YL3MZH7N.js +0 -66
- package/dist/chunk-ZBOI25UW.js +0 -139
- package/dist/components/api.client.d.ts +0 -5
- package/dist/components/api.client.js +0 -8
- package/dist/dynamic-sidebar-SYEETGZL.js +0 -129
- package/dist/edit-on-github-FIYOWWPQ.js +0 -49
- package/dist/layouts/home.client.d.ts +0 -11
- package/dist/layouts/home.client.js +0 -274
- package/dist/shared-SScCiV7b.d.ts +0 -152
- package/dist/sidebar-CQ4HmzQl.d.ts +0 -50
- package/dist/tag-list-BsEgfE3x.d.ts +0 -6
- package/dist/toc-clerk-SKE4LBT7.js +0 -158
- package/dist/tree-06ley65N.d.ts +0 -21
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
import * as react from 'react';
|
|
2
1
|
import * as AccordionPrimitive from '@radix-ui/react-accordion';
|
|
3
|
-
|
|
4
|
-
declare const
|
|
5
|
-
declare const Accordion: react.ForwardRefExoticComponent<Omit<Omit<AccordionPrimitive.AccordionItemProps & react.RefAttributes<HTMLDivElement>, "ref">, "value"> & {
|
|
2
|
+
export declare const Accordions: import("react").ForwardRefExoticComponent<(Omit<AccordionPrimitive.AccordionSingleProps, "value" | "onValueChange"> | Omit<AccordionPrimitive.AccordionMultipleProps, "value" | "onValueChange">) & import("react").RefAttributes<HTMLDivElement>>;
|
|
3
|
+
export declare const Accordion: import("react").ForwardRefExoticComponent<Omit<Omit<AccordionPrimitive.AccordionItemProps & import("react").RefAttributes<HTMLDivElement>, "ref">, "value"> & {
|
|
6
4
|
title: string;
|
|
7
|
-
} & react.RefAttributes<HTMLDivElement>>;
|
|
8
|
-
|
|
9
|
-
export { Accordion, Accordions };
|
|
5
|
+
} & import("react").RefAttributes<HTMLDivElement>>;
|
|
6
|
+
//# sourceMappingURL=accordion.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"accordion.d.ts","sourceRoot":"","sources":["../../src/components/accordion.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,kBAAkB,MAAM,2BAA2B,CAAC;AAgBhE,eAAO,MAAM,UAAU,oPA+BrB,CAAC;AAIH,eAAO,MAAM,SAAS;WAGX,MAAM;kDA0Bf,CAAC"}
|
|
@@ -1,109 +1,37 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
} from
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
} from
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
// src/components/accordion.tsx
|
|
19
|
-
import * as AccordionPrimitive from "@radix-ui/react-accordion";
|
|
20
|
-
import {
|
|
21
|
-
forwardRef,
|
|
22
|
-
useState,
|
|
23
|
-
useEffect
|
|
24
|
-
} from "react";
|
|
25
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
26
|
-
var Accordions = forwardRef(({ type = "single", className, defaultValue, ...props }, ref) => {
|
|
27
|
-
const [value, setValue] = useState(
|
|
28
|
-
type === "single" ? defaultValue ?? "" : defaultValue ?? []
|
|
29
|
-
);
|
|
30
|
-
useEffect(() => {
|
|
31
|
-
const id = window.location.hash.substring(1);
|
|
32
|
-
if (id.length > 0)
|
|
33
|
-
setValue((prev) => typeof prev === "string" ? id : [id, ...prev]);
|
|
34
|
-
}, []);
|
|
35
|
-
return (
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import * as AccordionPrimitive from '@radix-ui/react-accordion';
|
|
4
|
+
import { Check, ChevronRight, LinkIcon } from 'lucide-react';
|
|
5
|
+
import { forwardRef, useState, useEffect, } from 'react';
|
|
6
|
+
import { cn } from '../utils/cn';
|
|
7
|
+
import { useCopyButton } from '../utils/use-copy-button';
|
|
8
|
+
import { buttonVariants } from '../components/ui/button';
|
|
9
|
+
export const Accordions = forwardRef(({ type = 'single', className, defaultValue, ...props }, ref) => {
|
|
10
|
+
const [value, setValue] = useState(type === 'single' ? (defaultValue ?? '') : (defaultValue ?? []));
|
|
11
|
+
useEffect(() => {
|
|
12
|
+
const id = window.location.hash.substring(1);
|
|
13
|
+
if (id.length > 0)
|
|
14
|
+
setValue((prev) => (typeof prev === 'string' ? id : [id, ...prev]));
|
|
15
|
+
}, []);
|
|
16
|
+
return (
|
|
36
17
|
// @ts-expect-error -- Multiple types
|
|
37
|
-
|
|
38
|
-
AccordionPrimitive.Root,
|
|
39
|
-
{
|
|
40
|
-
type,
|
|
41
|
-
ref,
|
|
42
|
-
value,
|
|
43
|
-
onValueChange: setValue,
|
|
44
|
-
collapsible: type === "single" ? true : void 0,
|
|
45
|
-
className: twMerge(
|
|
46
|
-
"divide-y divide-fd-border overflow-hidden rounded-lg border bg-fd-card",
|
|
47
|
-
className
|
|
48
|
-
),
|
|
49
|
-
...props
|
|
50
|
-
}
|
|
51
|
-
)
|
|
52
|
-
);
|
|
18
|
+
_jsx(AccordionPrimitive.Root, { type: type, ref: ref, value: value, onValueChange: setValue, collapsible: type === 'single' ? true : undefined, className: cn('divide-y divide-fd-border overflow-hidden rounded-lg border bg-fd-card', className), ...props }));
|
|
53
19
|
});
|
|
54
|
-
Accordions.displayName =
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
ref,
|
|
60
|
-
value: id ?? title,
|
|
61
|
-
className: twMerge("group/accordion relative scroll-m-20", className),
|
|
62
|
-
...props,
|
|
63
|
-
children: [
|
|
64
|
-
/* @__PURE__ */ jsxs(
|
|
65
|
-
AccordionPrimitive.Header,
|
|
66
|
-
{
|
|
67
|
-
id,
|
|
68
|
-
className: "not-prose flex flex-row items-center font-medium text-fd-foreground",
|
|
69
|
-
children: [
|
|
70
|
-
/* @__PURE__ */ jsxs(AccordionPrimitive.Trigger, { className: "flex flex-1 items-center gap-2 p-4 text-start focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-fd-ring", children: [
|
|
71
|
-
/* @__PURE__ */ jsx(ChevronRight, { className: "-ms-1 size-4 shrink-0 text-fd-muted-foreground transition-transform duration-200 group-data-[state=open]/accordion:rotate-90" }),
|
|
72
|
-
title
|
|
73
|
-
] }),
|
|
74
|
-
id ? /* @__PURE__ */ jsx(CopyButton, { id }) : null
|
|
75
|
-
]
|
|
76
|
-
}
|
|
77
|
-
),
|
|
78
|
-
/* @__PURE__ */ jsx(AccordionPrimitive.Content, { className: "overflow-hidden data-[state=closed]:animate-fd-accordion-up data-[state=open]:animate-fd-accordion-down", children: /* @__PURE__ */ jsx("div", { className: "p-4 pt-0 prose-no-margin", children }) })
|
|
79
|
-
]
|
|
80
|
-
}
|
|
81
|
-
);
|
|
20
|
+
Accordions.displayName = 'Accordions';
|
|
21
|
+
export const Accordion = forwardRef(({ title, className, id, children, ...props }, ref) => {
|
|
22
|
+
return (_jsxs(AccordionPrimitive.Item, { ref: ref,
|
|
23
|
+
// Use `id` instead if presents
|
|
24
|
+
value: id ?? title, className: cn('group/accordion relative scroll-m-20', className), ...props, children: [_jsxs(AccordionPrimitive.Header, { id: id, className: "not-prose flex flex-row items-center font-medium text-fd-foreground", children: [_jsxs(AccordionPrimitive.Trigger, { className: "flex flex-1 items-center gap-2 p-4 text-start focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-fd-ring", children: [_jsx(ChevronRight, { className: "-ms-1 size-4 shrink-0 text-fd-muted-foreground transition-transform duration-200 group-data-[state=open]/accordion:rotate-90" }), title] }), id ? _jsx(CopyButton, { id: id }) : null] }), _jsx(AccordionPrimitive.Content, { className: "overflow-hidden data-[state=closed]:animate-fd-accordion-up data-[state=open]:animate-fd-accordion-down", children: _jsx("div", { className: "p-4 pt-0 prose-no-margin", children: children }) })] }));
|
|
82
25
|
});
|
|
83
26
|
function CopyButton({ id }) {
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
"aria-label": "Copy Link",
|
|
94
|
-
className: twMerge(
|
|
95
|
-
buttonVariants({
|
|
96
|
-
color: "ghost",
|
|
97
|
-
className: "text-fd-muted-foreground me-2"
|
|
98
|
-
})
|
|
99
|
-
),
|
|
100
|
-
onClick,
|
|
101
|
-
children: checked ? /* @__PURE__ */ jsx(Check, { className: "size-3.5" }) : /* @__PURE__ */ jsx(Link, { className: "size-3.5" })
|
|
102
|
-
}
|
|
103
|
-
);
|
|
27
|
+
const [checked, onClick] = useCopyButton(() => {
|
|
28
|
+
const url = new URL(window.location.href);
|
|
29
|
+
url.hash = id;
|
|
30
|
+
void navigator.clipboard.writeText(url.toString());
|
|
31
|
+
});
|
|
32
|
+
return (_jsx("button", { type: "button", "aria-label": "Copy Link", className: cn(buttonVariants({
|
|
33
|
+
color: 'ghost',
|
|
34
|
+
className: 'text-fd-muted-foreground me-2',
|
|
35
|
+
})), onClick: onClick, children: checked ? (_jsx(Check, { className: "size-3.5" })) : (_jsx(LinkIcon, { className: "size-3.5" })) }));
|
|
104
36
|
}
|
|
105
|
-
Accordion.displayName =
|
|
106
|
-
export {
|
|
107
|
-
Accordion,
|
|
108
|
-
Accordions
|
|
109
|
-
};
|
|
37
|
+
Accordion.displayName = 'Accordion';
|
package/dist/components/api.d.ts
CHANGED
|
@@ -1,13 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
export
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
declare const buttonVariants: (props?: ({
|
|
7
|
-
color?: "outline" | "ghost" | "secondary" | null | undefined;
|
|
8
|
-
size?: "icon" | "sm" | null | undefined;
|
|
9
|
-
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
10
|
-
|
|
11
|
-
declare const useCopyButton: typeof useCopyButton$1;
|
|
12
|
-
|
|
13
|
-
export { buttonVariants, useCopyButton };
|
|
1
|
+
export * from '../utils/cn';
|
|
2
|
+
export * from '../components/ui/button';
|
|
3
|
+
export { useCopyButton } from '../utils/use-copy-button';
|
|
4
|
+
//# sourceMappingURL=api.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../src/components/api.tsx"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,wBAAwB,CAAC;AACvC,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC"}
|
package/dist/components/api.js
CHANGED
|
@@ -1,16 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
} from "../chunk-QKOA6KEZ.js";
|
|
5
|
-
import {
|
|
6
|
-
twMerge
|
|
7
|
-
} from "../chunk-TK3TM3MR.js";
|
|
8
|
-
import "../chunk-MLKGABMK.js";
|
|
9
|
-
|
|
10
|
-
// src/components/api.tsx
|
|
11
|
-
var useCopyButton = _useCopyButton;
|
|
12
|
-
export {
|
|
13
|
-
buttonVariants,
|
|
14
|
-
twMerge as cn,
|
|
15
|
-
useCopyButton
|
|
16
|
-
};
|
|
1
|
+
export * from '../utils/cn';
|
|
2
|
+
export * from '../components/ui/button';
|
|
3
|
+
export { useCopyButton } from '../utils/use-copy-button';
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { HTMLAttributes } from 'react';
|
|
2
|
-
|
|
3
|
-
declare function Banner({ id, variant, changeLayout, ...props }: HTMLAttributes<HTMLDivElement> & {
|
|
1
|
+
import { type HTMLAttributes } from 'react';
|
|
2
|
+
export declare function Banner({ id, variant, changeLayout, ...props }: HTMLAttributes<HTMLDivElement> & {
|
|
4
3
|
/**
|
|
5
4
|
* @defaultValue 'normal'
|
|
6
5
|
*/
|
|
@@ -12,5 +11,4 @@ declare function Banner({ id, variant, changeLayout, ...props }: HTMLAttributes<
|
|
|
12
11
|
*/
|
|
13
12
|
changeLayout?: boolean;
|
|
14
13
|
}): React.ReactElement;
|
|
15
|
-
|
|
16
|
-
export { Banner };
|
|
14
|
+
//# 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,EAAoC,MAAM,OAAO,CAAC;AAK9E,wBAAgB,MAAM,CAAC,EACrB,EAAE,EACF,OAAkB,EAClB,YAAmB,EACnB,GAAG,KAAK,EACT,EAAE,cAAc,CAAC,cAAc,CAAC,GAAG;IAClC;;OAEG;IACH,OAAO,CAAC,EAAE,SAAS,GAAG,QAAQ,CAAC;IAE/B;;;;OAIG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB,GAAG,KAAK,CAAC,YAAY,CA6DrB"}
|
|
@@ -1,123 +1,56 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
} from
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
}) {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
setOpen(false);
|
|
29
|
-
if (globalKey) localStorage.setItem(globalKey, "true");
|
|
30
|
-
}, [globalKey]);
|
|
31
|
-
return /* @__PURE__ */ jsxs(
|
|
32
|
-
"div",
|
|
33
|
-
{
|
|
34
|
-
id,
|
|
35
|
-
...props,
|
|
36
|
-
className: twMerge(
|
|
37
|
-
"sticky top-0 z-40 flex h-12 flex-row items-center justify-center bg-fd-secondary px-4 text-center text-sm font-medium",
|
|
38
|
-
variant === "rainbow" && "bg-fd-background",
|
|
39
|
-
!open && "hidden",
|
|
40
|
-
props.className
|
|
41
|
-
),
|
|
42
|
-
children: [
|
|
43
|
-
changeLayout && open ? /* @__PURE__ */ jsx("style", { children: `
|
|
44
|
-
:root:not(.${globalKey ?? "nd-banner-never"}) { --fd-banner-height: 3rem; }
|
|
45
|
-
` }) : null,
|
|
46
|
-
globalKey ? /* @__PURE__ */ jsx("style", { children: `.${globalKey} #${id} { display: none; }` }) : null,
|
|
47
|
-
id ? /* @__PURE__ */ jsx(
|
|
48
|
-
"script",
|
|
49
|
-
{
|
|
50
|
-
dangerouslySetInnerHTML: {
|
|
51
|
-
__html: `if (localStorage.getItem('${globalKey}') === 'true') document.documentElement.classList.add('${globalKey}');`
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
) : null,
|
|
55
|
-
variant === "rainbow" ? rainbowLayer : null,
|
|
56
|
-
props.children,
|
|
57
|
-
id ? /* @__PURE__ */ jsx(
|
|
58
|
-
"button",
|
|
59
|
-
{
|
|
60
|
-
type: "button",
|
|
61
|
-
"aria-label": "Close Banner",
|
|
62
|
-
onClick,
|
|
63
|
-
className: twMerge(
|
|
64
|
-
buttonVariants({
|
|
65
|
-
color: "ghost",
|
|
66
|
-
className: "absolute end-2 top-1/2 -translate-y-1/2 text-fd-muted-foreground",
|
|
67
|
-
size: "icon"
|
|
68
|
-
})
|
|
69
|
-
),
|
|
70
|
-
children: /* @__PURE__ */ jsx(X, {})
|
|
71
|
-
}
|
|
72
|
-
) : null
|
|
73
|
-
]
|
|
74
|
-
}
|
|
75
|
-
);
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
+
import { useCallback, useEffect, useState } from 'react';
|
|
4
|
+
import { X } from 'lucide-react';
|
|
5
|
+
import { cn } from '../utils/cn';
|
|
6
|
+
import { buttonVariants } from '../components/ui/button';
|
|
7
|
+
export function Banner({ id, variant = 'normal', changeLayout = true, ...props }) {
|
|
8
|
+
const [open, setOpen] = useState(true);
|
|
9
|
+
const globalKey = id ? `nd-banner-${id}` : undefined;
|
|
10
|
+
useEffect(() => {
|
|
11
|
+
if (globalKey)
|
|
12
|
+
setOpen(localStorage.getItem(globalKey) !== 'true');
|
|
13
|
+
}, [globalKey]);
|
|
14
|
+
const onClick = useCallback(() => {
|
|
15
|
+
setOpen(false);
|
|
16
|
+
if (globalKey)
|
|
17
|
+
localStorage.setItem(globalKey, 'true');
|
|
18
|
+
}, [globalKey]);
|
|
19
|
+
return (_jsxs("div", { id: id, ...props, className: cn('sticky top-0 z-40 flex h-12 flex-row items-center justify-center bg-fd-secondary px-4 text-center text-sm font-medium', variant === 'rainbow' && 'bg-fd-background', !open && 'hidden', props.className), children: [changeLayout && open ? (_jsx("style", { children: `
|
|
20
|
+
:root:not(.${globalKey ?? 'nd-banner-never'}) { --fd-banner-height: 3rem; }
|
|
21
|
+
` })) : null, globalKey ? (_jsx("style", { children: `.${globalKey} #${id} { display: none; }` })) : null, id ? (_jsx("script", { dangerouslySetInnerHTML: {
|
|
22
|
+
__html: `if (localStorage.getItem('${globalKey}') === 'true') document.documentElement.classList.add('${globalKey}');`,
|
|
23
|
+
} })) : null, variant === 'rainbow' ? rainbowLayer : null, props.children, id ? (_jsx("button", { type: "button", "aria-label": "Close Banner", onClick: onClick, className: cn(buttonVariants({
|
|
24
|
+
color: 'ghost',
|
|
25
|
+
className: 'absolute end-2 top-1/2 -translate-y-1/2 text-fd-muted-foreground',
|
|
26
|
+
size: 'icon',
|
|
27
|
+
})), children: _jsx(X, {}) })) : null] }));
|
|
76
28
|
}
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
style: {
|
|
103
|
-
maskImage,
|
|
104
|
-
maskComposite: "intersect",
|
|
105
|
-
animation: "fd-moving-banner 20s linear infinite",
|
|
106
|
-
"--start": "rgba(255,120,120,0.5)",
|
|
107
|
-
"--mid": "rgba(36,188,255,0.4)",
|
|
108
|
-
"--end": "rgba(64,0,255,0.51)",
|
|
109
|
-
"--via": "rgba(255,89,0,0.56)",
|
|
110
|
-
backgroundImage: "repeating-linear-gradient(45deg, var(--end), var(--start) 4%, var(--start) 8%, transparent 9%, transparent 14%, var(--mid) 16%, var(--mid) 20%, transparent, var(--via) 36%, var(--via) 40%, transparent 42%, var(--end) 46%, var(--end) calc(50% - 16.8px))",
|
|
111
|
-
backgroundSize: "200% 100%",
|
|
112
|
-
mixBlendMode: "color-dodge"
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
),
|
|
116
|
-
/* @__PURE__ */ jsx("style", { children: `@keyframes fd-moving-banner {
|
|
29
|
+
const maskImage = 'linear-gradient(to bottom,white,transparent), radial-gradient(circle at top center, white, transparent)';
|
|
30
|
+
const rainbowLayer = (_jsxs(_Fragment, { children: [_jsx("div", { className: "absolute inset-0 z-[-1]", style: {
|
|
31
|
+
maskImage,
|
|
32
|
+
maskComposite: 'intersect',
|
|
33
|
+
animation: 'fd-moving-banner 16s linear infinite',
|
|
34
|
+
'--start': 'rgba(0,87,255,0.5)',
|
|
35
|
+
'--mid': 'rgba(255,0,166,0.77)',
|
|
36
|
+
'--end': 'rgba(255,77,0,0.4)',
|
|
37
|
+
'--via': 'rgba(164,255,68,0.4)',
|
|
38
|
+
animationDirection: 'reverse',
|
|
39
|
+
backgroundImage: 'repeating-linear-gradient(60deg, var(--end), var(--start) 2%, var(--start) 5%, transparent 8%, transparent 14%, var(--via) 18%, var(--via) 22%, var(--mid) 28%, var(--mid) 30%, var(--via) 34%, var(--via) 36%, transparent, var(--end) calc(50% - 12px))',
|
|
40
|
+
backgroundSize: '200% 100%',
|
|
41
|
+
mixBlendMode: 'difference',
|
|
42
|
+
} }), _jsx("div", { className: "absolute inset-0 z-[-1]", style: {
|
|
43
|
+
maskImage,
|
|
44
|
+
maskComposite: 'intersect',
|
|
45
|
+
animation: 'fd-moving-banner 20s linear infinite',
|
|
46
|
+
'--start': 'rgba(255,120,120,0.5)',
|
|
47
|
+
'--mid': 'rgba(36,188,255,0.4)',
|
|
48
|
+
'--end': 'rgba(64,0,255,0.51)',
|
|
49
|
+
'--via': 'rgba(255,89,0,0.56)',
|
|
50
|
+
backgroundImage: 'repeating-linear-gradient(45deg, var(--end), var(--start) 4%, var(--start) 8%, transparent 9%, transparent 14%, var(--mid) 16%, var(--mid) 20%, transparent, var(--via) 36%, var(--via) 40%, transparent 42%, var(--end) 46%, var(--end) calc(50% - 16.8px))',
|
|
51
|
+
backgroundSize: '200% 100%',
|
|
52
|
+
mixBlendMode: 'color-dodge',
|
|
53
|
+
} }), _jsx("style", { children: `@keyframes fd-moving-banner {
|
|
117
54
|
from { background-position: 0% 0; }
|
|
118
55
|
to { background-position: 100% 0; }
|
|
119
|
-
}` })
|
|
120
|
-
] });
|
|
121
|
-
export {
|
|
122
|
-
Banner
|
|
123
|
-
};
|
|
56
|
+
}` })] }));
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
declare const Callout: react.ForwardRefExoticComponent<Omit<HTMLAttributes<HTMLDivElement>, "title" | "icon" | "type"> & {
|
|
1
|
+
import { type HTMLAttributes, type ReactNode } from 'react';
|
|
2
|
+
export declare const Callout: import("react").ForwardRefExoticComponent<Omit<HTMLAttributes<HTMLDivElement>, "title" | "type" | "icon"> & {
|
|
5
3
|
title?: ReactNode;
|
|
6
4
|
/**
|
|
7
5
|
* @defaultValue info
|
|
@@ -11,6 +9,5 @@ declare const Callout: react.ForwardRefExoticComponent<Omit<HTMLAttributes<HTMLD
|
|
|
11
9
|
* Force an icon
|
|
12
10
|
*/
|
|
13
11
|
icon?: ReactNode;
|
|
14
|
-
} & react.RefAttributes<HTMLDivElement>>;
|
|
15
|
-
|
|
16
|
-
export { Callout };
|
|
12
|
+
} & import("react").RefAttributes<HTMLDivElement>>;
|
|
13
|
+
//# sourceMappingURL=callout.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"callout.d.ts","sourceRoot":"","sources":["../../src/components/callout.tsx"],"names":[],"mappings":"AACA,OAAO,EAAc,KAAK,cAAc,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAmBxE,eAAO,MAAM,OAAO;YAZV,SAAS;IACjB;;OAEG;WACI,MAAM,GAAG,MAAM,GAAG,OAAO;IAEhC;;OAEG;WACI,SAAS;kDA+BjB,CAAC"}
|
|
@@ -1,9 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
} from
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
}
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { AlertTriangle, CircleX, Info } from 'lucide-react';
|
|
3
|
+
import { forwardRef } from 'react';
|
|
4
|
+
import { cn } from '../utils/cn';
|
|
5
|
+
export const Callout = forwardRef(({ className, children, title, type = 'info', icon, ...props }, ref) => {
|
|
6
|
+
return (_jsxs("div", { ref: ref, className: cn('my-6 flex flex-row gap-2 rounded-lg border bg-fd-card p-3 text-sm text-fd-card-foreground shadow-md', className), ...props, children: [icon ??
|
|
7
|
+
{
|
|
8
|
+
info: _jsx(Info, { className: "size-5 fill-blue-500 text-fd-card" }),
|
|
9
|
+
warn: (_jsx(AlertTriangle, { className: "size-5 fill-orange-500 text-fd-card" })),
|
|
10
|
+
error: _jsx(CircleX, { className: "size-5 fill-red-500 text-fd-card" }),
|
|
11
|
+
}[type], _jsxs("div", { className: "min-w-0 flex-1", children: [title ? _jsx("p", { className: "not-prose mb-2 font-medium", children: title }) : null, _jsx("div", { className: "text-fd-muted-foreground prose-no-margin", children: children })] })] }));
|
|
12
|
+
});
|
|
13
|
+
Callout.displayName = 'Callout';
|
|
@@ -1,13 +1,11 @@
|
|
|
1
|
-
import { HTMLAttributes, ReactNode } from 'react';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
type CardProps = HTMLAttributes<HTMLElement> & {
|
|
1
|
+
import type { HTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
export declare function Cards(props: HTMLAttributes<HTMLDivElement>): React.ReactElement;
|
|
3
|
+
export type CardProps = HTMLAttributes<HTMLElement> & {
|
|
5
4
|
icon?: ReactNode;
|
|
6
5
|
title: ReactNode;
|
|
7
6
|
description?: ReactNode;
|
|
8
7
|
href?: string;
|
|
9
8
|
external?: boolean;
|
|
10
9
|
};
|
|
11
|
-
declare function Card({ icon, title, description, ...props }: CardProps): React.ReactElement;
|
|
12
|
-
|
|
13
|
-
export { Card, type CardProps, Cards };
|
|
10
|
+
export declare function Card({ icon, title, description, ...props }: CardProps): React.ReactElement;
|
|
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,CACnB,KAAK,EAAE,cAAc,CAAC,cAAc,CAAC,GACpC,KAAK,CAAC,YAAY,CASpB;AAED,MAAM,MAAM,SAAS,GAAG,cAAc,CAAC,WAAW,CAAC,GAAG;IACpD,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,EACnB,IAAI,EACJ,KAAK,EACL,WAAW,EACX,GAAG,KAAK,EACT,EAAE,SAAS,GAAG,KAAK,CAAC,YAAY,CA6BhC"}
|
package/dist/components/card.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
export {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
}
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import Link from 'fumadocs-core/link';
|
|
3
|
+
import { cn } from '../utils/cn';
|
|
4
|
+
export function Cards(props) {
|
|
5
|
+
return (_jsx("div", { ...props, className: cn('grid grid-cols-1 gap-4 sm:grid-cols-2', 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-lg border bg-fd-card p-4 text-fd-card-foreground shadow-md transition-colors', props.href && 'hover:bg-fd-accent/80', props.className), children: [icon ? (_jsx("div", { className: "not-prose mb-2 w-fit rounded-md 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, props.children ? (_jsx("div", { className: "text-sm text-fd-muted-foreground prose-no-margin", children: props.children })) : null] }));
|
|
10
|
+
}
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
type CodeBlockProps = HTMLAttributes<HTMLElement> & {
|
|
1
|
+
import { type HTMLAttributes, type ReactNode } from 'react';
|
|
2
|
+
export type CodeBlockProps = HTMLAttributes<HTMLElement> & {
|
|
5
3
|
/**
|
|
6
4
|
* Icon of code block
|
|
7
5
|
*
|
|
@@ -21,8 +19,8 @@ type CodeBlockProps = HTMLAttributes<HTMLElement> & {
|
|
|
21
19
|
*/
|
|
22
20
|
keepBackground?: boolean;
|
|
23
21
|
};
|
|
24
|
-
declare const Pre: react.ForwardRefExoticComponent<HTMLAttributes<HTMLPreElement> & react.RefAttributes<HTMLPreElement>>;
|
|
25
|
-
declare const CodeBlock: react.ForwardRefExoticComponent<HTMLAttributes<HTMLElement> & {
|
|
22
|
+
export declare const Pre: import("react").ForwardRefExoticComponent<HTMLAttributes<HTMLPreElement> & import("react").RefAttributes<HTMLPreElement>>;
|
|
23
|
+
export declare const CodeBlock: import("react").ForwardRefExoticComponent<HTMLAttributes<HTMLElement> & {
|
|
26
24
|
/**
|
|
27
25
|
* Icon of code block
|
|
28
26
|
*
|
|
@@ -41,6 +39,5 @@ declare const CodeBlock: react.ForwardRefExoticComponent<HTMLAttributes<HTMLElem
|
|
|
41
39
|
* @defaultValue false
|
|
42
40
|
*/
|
|
43
41
|
keepBackground?: boolean;
|
|
44
|
-
} & react.RefAttributes<HTMLElement>>;
|
|
45
|
-
|
|
46
|
-
export { CodeBlock, type CodeBlockProps, Pre };
|
|
42
|
+
} & import("react").RefAttributes<HTMLElement>>;
|
|
43
|
+
//# 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,EAEL,KAAK,cAAc,EAEnB,KAAK,SAAS,EAIf,MAAM,OAAO,CAAC;AAUf,MAAM,MAAM,cAAc,GAAG,cAAc,CAAC,WAAW,CAAC,GAAG;IACzD;;;;OAIG;IACH,IAAI,CAAC,EAAE,SAAS,CAAC;IAEjB;;;;OAIG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB;;;;OAIG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B,CAAC;AAEF,eAAO,MAAM,GAAG,2HAQf,CAAC;AAIF,eAAO,MAAM,SAAS;IAlCpB;;;;OAIG;WACI,SAAS;IAEhB;;;;OAIG;gBACS,OAAO;IAEnB;;;;OAIG;qBACc,OAAO;+CAwFzB,CAAC"}
|
|
@@ -1,15 +1,41 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
} from
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { Check, Copy } from 'lucide-react';
|
|
4
|
+
import { forwardRef, useCallback, useRef, } from 'react';
|
|
5
|
+
import { cn } from '../utils/cn';
|
|
6
|
+
import { ScrollArea, ScrollBar, ScrollViewport, } from '../components/ui/scroll-area';
|
|
7
|
+
import { useCopyButton } from '../utils/use-copy-button';
|
|
8
|
+
import { buttonVariants } from '../components/ui/button';
|
|
9
|
+
export const Pre = forwardRef(({ className, ...props }, ref) => {
|
|
10
|
+
return (_jsx("pre", { ref: ref, className: cn('max-h-[400px] p-4', className), ...props, children: props.children }));
|
|
11
|
+
});
|
|
12
|
+
Pre.displayName = 'Pre';
|
|
13
|
+
export const CodeBlock = forwardRef(({ title, allowCopy = true, keepBackground = false, icon, className, ...props }, ref) => {
|
|
14
|
+
const areaRef = useRef(null);
|
|
15
|
+
const onCopy = useCallback(() => {
|
|
16
|
+
const pre = areaRef.current?.getElementsByTagName('pre').item(0);
|
|
17
|
+
if (!pre)
|
|
18
|
+
return;
|
|
19
|
+
const clone = pre.cloneNode(true);
|
|
20
|
+
clone.querySelectorAll('.nd-copy-ignore').forEach((node) => {
|
|
21
|
+
node.remove();
|
|
22
|
+
});
|
|
23
|
+
void navigator.clipboard.writeText(clone.textContent ?? '');
|
|
24
|
+
}, []);
|
|
25
|
+
return (_jsxs("figure", { ref: ref, className: cn('not-prose group fd-codeblock relative my-6 overflow-hidden rounded-lg border bg-fd-secondary/50 text-sm', keepBackground &&
|
|
26
|
+
'bg-[var(--shiki-light-bg)] dark:bg-[var(--shiki-dark-bg)]', className), ...props, children: [title ? (_jsxs("div", { className: "flex flex-row items-center gap-2 border-b bg-fd-muted px-4 py-1.5", children: [icon ? (_jsx("div", { className: "text-fd-muted-foreground [&_svg]:size-3.5", ...(typeof icon === 'string'
|
|
27
|
+
? {
|
|
28
|
+
dangerouslySetInnerHTML: { __html: icon },
|
|
29
|
+
}
|
|
30
|
+
: {
|
|
31
|
+
children: icon,
|
|
32
|
+
}) })) : null, _jsx("figcaption", { className: "flex-1 truncate text-fd-muted-foreground", children: title }), allowCopy ? (_jsx(CopyButton, { className: "-me-2", onCopy: onCopy })) : null] })) : (allowCopy && (_jsx(CopyButton, { className: "absolute right-2 top-2 z-[2] backdrop-blur-md", onCopy: onCopy }))), _jsxs(ScrollArea, { ref: areaRef, dir: "ltr", children: [_jsx(ScrollViewport, { children: props.children }), _jsx(ScrollBar, { orientation: "horizontal" })] })] }));
|
|
33
|
+
});
|
|
34
|
+
CodeBlock.displayName = 'CodeBlock';
|
|
35
|
+
function CopyButton({ className, onCopy, ...props }) {
|
|
36
|
+
const [checked, onClick] = useCopyButton(onCopy);
|
|
37
|
+
return (_jsxs("button", { type: "button", className: cn(buttonVariants({
|
|
38
|
+
color: 'ghost',
|
|
39
|
+
className: 'transition-all group-hover:opacity-100',
|
|
40
|
+
}), !checked && 'opacity-0', className), "aria-label": "Copy Text", onClick: onClick, ...props, children: [_jsx(Check, { className: cn('size-3.5 transition-transform', !checked && 'scale-0') }), _jsx(Copy, { className: cn('absolute size-3.5 transition-transform', checked && 'scale-0') })] }));
|
|
41
|
+
}
|
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
import { AlgoliaOptions } from 'fumadocs-core/search/client';
|
|
2
|
-
import { ReactNode } from 'react';
|
|
3
|
-
import { SharedProps } from './search
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
import 'fumadocs-core/server';
|
|
7
|
-
|
|
8
|
-
interface AlgoliaSearchDialogProps extends SharedProps {
|
|
1
|
+
import { type AlgoliaOptions } from 'fumadocs-core/search/client';
|
|
2
|
+
import { type ReactNode } from 'react';
|
|
3
|
+
import { type SharedProps } from './search';
|
|
4
|
+
import { type TagItem } from './tag-list';
|
|
5
|
+
export interface AlgoliaSearchDialogProps extends SharedProps {
|
|
9
6
|
index: AlgoliaOptions['index'];
|
|
10
7
|
searchOptions?: Omit<AlgoliaOptions, 'index'>;
|
|
11
8
|
footer?: ReactNode;
|
|
@@ -24,6 +21,5 @@ interface AlgoliaSearchDialogProps extends SharedProps {
|
|
|
24
21
|
*/
|
|
25
22
|
allowClear?: boolean;
|
|
26
23
|
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
export { type AlgoliaSearchDialogProps, AlgoliaSearchDialog as default };
|
|
24
|
+
export default function AlgoliaSearchDialog({ index, searchOptions, tags, defaultTag, showAlgolia, allowClear, ...props }: AlgoliaSearchDialogProps): ReactNode;
|
|
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,EAEL,KAAK,cAAc,EACpB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,KAAK,SAAS,EAAY,MAAM,OAAO,CAAC;AAEjD,OAAO,EAAgB,KAAK,WAAW,EAAE,MAAM,UAAU,CAAC;AAC1D,OAAO,EAAE,KAAK,OAAO,EAAY,MAAM,YAAY,CAAC;AAEpD,MAAM,WAAW,wBAAyB,SAAQ,WAAW;IAC3D,KAAK,EAAE,cAAc,CAAC,OAAO,CAAC,CAAC;IAC/B,aAAa,CAAC,EAAE,IAAI,CAAC,cAAc,EAAE,OAAO,CAAC,CAAC;IAC9C,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,KAAK,EACL,aAAa,EACb,IAAI,EACJ,UAAU,EACV,WAAmB,EACnB,UAAkB,EAClB,GAAG,KAAK,EACT,EAAE,wBAAwB,GAAG,SAAS,CA0CtC"}
|