fumadocs-ui 14.1.0 → 14.2.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/chunk-45REPLUI.js +259 -0
- package/dist/chunk-DGKCMOIC.js +56 -0
- package/dist/components/callout.d.ts +1 -1
- package/dist/components/dialog/search-algolia.d.ts +7 -6
- package/dist/components/dialog/search-algolia.js +7 -3
- package/dist/components/dialog/search-default.d.ts +4 -2
- package/dist/components/dialog/search-default.js +4 -2
- package/dist/components/dialog/search-orama.d.ts +32 -0
- package/dist/components/dialog/search-orama.js +82 -0
- package/dist/components/dialog/search.d.ts +9 -17
- package/dist/components/dialog/search.js +4 -5
- package/dist/layouts/docs.client.js +4 -4
- package/dist/layouts/home.client.js +1 -1
- package/dist/mdx.d.ts +1 -1
- package/dist/provider.d.ts +2 -0
- package/dist/style.css +1 -1
- package/dist/tag-list-BsEgfE3x.d.ts +6 -0
- package/package.json +11 -13
- package/dist/chunk-TYZZJ335.js +0 -295
|
@@ -0,0 +1,259 @@
|
|
|
1
|
+
import {
|
|
2
|
+
buttonVariants
|
|
3
|
+
} from "./chunk-QKOA6KEZ.js";
|
|
4
|
+
import {
|
|
5
|
+
FileText,
|
|
6
|
+
Hash,
|
|
7
|
+
LoaderCircle,
|
|
8
|
+
Search,
|
|
9
|
+
Text
|
|
10
|
+
} from "./chunk-5QPVK7QM.js";
|
|
11
|
+
import {
|
|
12
|
+
twMerge
|
|
13
|
+
} from "./chunk-TK3TM3MR.js";
|
|
14
|
+
import {
|
|
15
|
+
useSearchContext
|
|
16
|
+
} from "./chunk-ET4TW6M5.js";
|
|
17
|
+
import {
|
|
18
|
+
useSidebar
|
|
19
|
+
} from "./chunk-27HFSL7N.js";
|
|
20
|
+
import {
|
|
21
|
+
useI18n
|
|
22
|
+
} from "./chunk-EFMHXXHW.js";
|
|
23
|
+
|
|
24
|
+
// src/components/dialog/search.tsx
|
|
25
|
+
import { useRouter } from "next/navigation";
|
|
26
|
+
import {
|
|
27
|
+
useMemo,
|
|
28
|
+
useEffect,
|
|
29
|
+
useState,
|
|
30
|
+
useRef
|
|
31
|
+
} from "react";
|
|
32
|
+
import {
|
|
33
|
+
Dialog,
|
|
34
|
+
DialogContent,
|
|
35
|
+
DialogOverlay,
|
|
36
|
+
DialogTitle
|
|
37
|
+
} from "@radix-ui/react-dialog";
|
|
38
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
39
|
+
function SearchDialog({
|
|
40
|
+
open,
|
|
41
|
+
onOpenChange,
|
|
42
|
+
footer,
|
|
43
|
+
links = [],
|
|
44
|
+
...props
|
|
45
|
+
}) {
|
|
46
|
+
const { text } = useI18n();
|
|
47
|
+
const defaultItems = useMemo(
|
|
48
|
+
() => links.map(([name, link]) => ({
|
|
49
|
+
type: "page",
|
|
50
|
+
id: name,
|
|
51
|
+
content: name,
|
|
52
|
+
url: link
|
|
53
|
+
})),
|
|
54
|
+
[links]
|
|
55
|
+
);
|
|
56
|
+
return /* @__PURE__ */ jsxs(Dialog, { open, onOpenChange, children: [
|
|
57
|
+
/* @__PURE__ */ jsx(DialogOverlay, { className: "fixed inset-0 z-50 bg-fd-background/50 backdrop-blur-sm data-[state=closed]:animate-fd-fade-out data-[state=open]:animate-fd-fade-in" }),
|
|
58
|
+
/* @__PURE__ */ jsxs(
|
|
59
|
+
DialogContent,
|
|
60
|
+
{
|
|
61
|
+
"aria-describedby": text.search,
|
|
62
|
+
className: "fixed left-1/2 top-[10vh] z-50 w-[98vw] max-w-screen-sm origin-left -translate-x-1/2 rounded-lg border bg-fd-popover text-fd-popover-foreground shadow-lg data-[state=closed]:animate-fd-dialog-out data-[state=open]:animate-fd-dialog-in",
|
|
63
|
+
children: [
|
|
64
|
+
/* @__PURE__ */ jsx(DialogTitle, { className: "hidden", children: text.search }),
|
|
65
|
+
/* @__PURE__ */ jsx(
|
|
66
|
+
SearchInput,
|
|
67
|
+
{
|
|
68
|
+
search: props.search,
|
|
69
|
+
onSearchChange: props.onSearchChange,
|
|
70
|
+
isLoading: props.isLoading
|
|
71
|
+
}
|
|
72
|
+
),
|
|
73
|
+
/* @__PURE__ */ jsx(
|
|
74
|
+
SearchList,
|
|
75
|
+
{
|
|
76
|
+
items: props.results === "empty" ? defaultItems : props.results,
|
|
77
|
+
hideResults: props.results === "empty" && defaultItems.length === 0
|
|
78
|
+
}
|
|
79
|
+
),
|
|
80
|
+
footer ? /* @__PURE__ */ jsx("div", { className: "mt-auto flex flex-col border-t p-3", children: footer }) : null
|
|
81
|
+
]
|
|
82
|
+
}
|
|
83
|
+
)
|
|
84
|
+
] });
|
|
85
|
+
}
|
|
86
|
+
var icons = {
|
|
87
|
+
text: /* @__PURE__ */ jsx(Text, { className: "size-4 text-fd-muted-foreground" }),
|
|
88
|
+
heading: /* @__PURE__ */ jsx(Hash, { className: "size-4 text-fd-muted-foreground" }),
|
|
89
|
+
page: /* @__PURE__ */ jsx(FileText, { className: "size-4 text-fd-muted-foreground" })
|
|
90
|
+
};
|
|
91
|
+
function SearchInput({ search, onSearchChange, isLoading }) {
|
|
92
|
+
const { text } = useI18n();
|
|
93
|
+
const { setOpenSearch } = useSearchContext();
|
|
94
|
+
return /* @__PURE__ */ jsxs("div", { className: "flex flex-row items-center gap-2 px-3", children: [
|
|
95
|
+
/* @__PURE__ */ jsx(LoadingIndicator, { isLoading: isLoading ?? false }),
|
|
96
|
+
/* @__PURE__ */ jsx(
|
|
97
|
+
"input",
|
|
98
|
+
{
|
|
99
|
+
value: search,
|
|
100
|
+
onChange: (e) => {
|
|
101
|
+
onSearchChange(e.target.value);
|
|
102
|
+
},
|
|
103
|
+
placeholder: text.search,
|
|
104
|
+
className: "w-0 flex-1 bg-transparent py-3 text-base placeholder:text-fd-muted-foreground focus-visible:outline-none"
|
|
105
|
+
}
|
|
106
|
+
),
|
|
107
|
+
/* @__PURE__ */ jsx(
|
|
108
|
+
"button",
|
|
109
|
+
{
|
|
110
|
+
type: "button",
|
|
111
|
+
"aria-label": "Close Search",
|
|
112
|
+
onClick: () => {
|
|
113
|
+
setOpenSearch(false);
|
|
114
|
+
},
|
|
115
|
+
className: twMerge(
|
|
116
|
+
buttonVariants({
|
|
117
|
+
color: "outline",
|
|
118
|
+
className: "text-xs p-1.5"
|
|
119
|
+
})
|
|
120
|
+
),
|
|
121
|
+
children: "Esc"
|
|
122
|
+
}
|
|
123
|
+
)
|
|
124
|
+
] });
|
|
125
|
+
}
|
|
126
|
+
function SearchList({ items, hideResults = false }) {
|
|
127
|
+
const [active, setActive] = useState();
|
|
128
|
+
const { text } = useI18n();
|
|
129
|
+
const router = useRouter();
|
|
130
|
+
const sidebar = useSidebar();
|
|
131
|
+
const { setOpenSearch } = useSearchContext();
|
|
132
|
+
if (items.length > 0 && (!active || items.every((item) => item.id !== active))) {
|
|
133
|
+
setActive(items[0].id);
|
|
134
|
+
}
|
|
135
|
+
const listenerRef = useRef();
|
|
136
|
+
listenerRef.current = (e) => {
|
|
137
|
+
if (e.key === "ArrowDown" || e.key == "ArrowUp") {
|
|
138
|
+
setActive((cur) => {
|
|
139
|
+
const idx = items.findIndex((item) => item.id === cur);
|
|
140
|
+
if (idx === -1) return items.at(0)?.id;
|
|
141
|
+
return items.at(
|
|
142
|
+
(e.key === "ArrowDown" ? idx + 1 : idx - 1) % items.length
|
|
143
|
+
)?.id;
|
|
144
|
+
});
|
|
145
|
+
e.preventDefault();
|
|
146
|
+
}
|
|
147
|
+
if (e.key === "Enter") {
|
|
148
|
+
const selected = items.find((item) => item.id === active);
|
|
149
|
+
if (selected) onOpen(selected.url);
|
|
150
|
+
e.preventDefault();
|
|
151
|
+
}
|
|
152
|
+
};
|
|
153
|
+
useEffect(() => {
|
|
154
|
+
const listener = (e) => {
|
|
155
|
+
listenerRef.current?.(e);
|
|
156
|
+
};
|
|
157
|
+
window.addEventListener("keydown", listener);
|
|
158
|
+
return () => {
|
|
159
|
+
window.removeEventListener("keydown", listener);
|
|
160
|
+
};
|
|
161
|
+
}, []);
|
|
162
|
+
const onOpen = (url) => {
|
|
163
|
+
router.push(url);
|
|
164
|
+
setOpenSearch(false);
|
|
165
|
+
sidebar.setOpen(false);
|
|
166
|
+
};
|
|
167
|
+
return /* @__PURE__ */ jsxs(
|
|
168
|
+
"div",
|
|
169
|
+
{
|
|
170
|
+
className: twMerge(
|
|
171
|
+
"flex max-h-[460px] flex-col overflow-y-auto border-t p-2",
|
|
172
|
+
hideResults && "hidden"
|
|
173
|
+
),
|
|
174
|
+
children: [
|
|
175
|
+
items.length === 0 ? /* @__PURE__ */ jsx("div", { className: "py-12 text-center text-sm", children: text.searchNoResult }) : null,
|
|
176
|
+
items.map((item) => /* @__PURE__ */ jsxs(
|
|
177
|
+
CommandItem,
|
|
178
|
+
{
|
|
179
|
+
value: item.id,
|
|
180
|
+
active,
|
|
181
|
+
onActiveChange: setActive,
|
|
182
|
+
onClick: () => {
|
|
183
|
+
onOpen(item.url);
|
|
184
|
+
},
|
|
185
|
+
children: [
|
|
186
|
+
item.type !== "page" ? /* @__PURE__ */ jsx(
|
|
187
|
+
"div",
|
|
188
|
+
{
|
|
189
|
+
role: "none",
|
|
190
|
+
className: "ms-2 h-full min-h-10 w-px bg-fd-border"
|
|
191
|
+
}
|
|
192
|
+
) : null,
|
|
193
|
+
icons[item.type],
|
|
194
|
+
/* @__PURE__ */ jsx("p", { className: "w-0 flex-1 truncate", children: item.content })
|
|
195
|
+
]
|
|
196
|
+
},
|
|
197
|
+
item.id
|
|
198
|
+
))
|
|
199
|
+
]
|
|
200
|
+
}
|
|
201
|
+
);
|
|
202
|
+
}
|
|
203
|
+
function LoadingIndicator({ isLoading }) {
|
|
204
|
+
return /* @__PURE__ */ jsxs("div", { className: "relative size-4", children: [
|
|
205
|
+
/* @__PURE__ */ jsx(
|
|
206
|
+
LoaderCircle,
|
|
207
|
+
{
|
|
208
|
+
className: twMerge(
|
|
209
|
+
"absolute size-full animate-spin text-fd-primary transition-opacity",
|
|
210
|
+
!isLoading && "opacity-0"
|
|
211
|
+
)
|
|
212
|
+
}
|
|
213
|
+
),
|
|
214
|
+
/* @__PURE__ */ jsx(
|
|
215
|
+
Search,
|
|
216
|
+
{
|
|
217
|
+
className: twMerge(
|
|
218
|
+
"absolute size-full text-fd-muted-foreground transition-opacity",
|
|
219
|
+
isLoading && "opacity-0"
|
|
220
|
+
)
|
|
221
|
+
}
|
|
222
|
+
)
|
|
223
|
+
] });
|
|
224
|
+
}
|
|
225
|
+
function CommandItem({
|
|
226
|
+
active,
|
|
227
|
+
onActiveChange,
|
|
228
|
+
value,
|
|
229
|
+
...props
|
|
230
|
+
}) {
|
|
231
|
+
const ref = useRef(null);
|
|
232
|
+
useEffect(() => {
|
|
233
|
+
const element = ref.current;
|
|
234
|
+
if (active === value && element) {
|
|
235
|
+
element.scrollIntoView({
|
|
236
|
+
block: "nearest"
|
|
237
|
+
});
|
|
238
|
+
}
|
|
239
|
+
}, [active, value]);
|
|
240
|
+
return /* @__PURE__ */ jsx(
|
|
241
|
+
"button",
|
|
242
|
+
{
|
|
243
|
+
ref,
|
|
244
|
+
type: "button",
|
|
245
|
+
"aria-selected": active === value,
|
|
246
|
+
onPointerMove: () => onActiveChange(value),
|
|
247
|
+
...props,
|
|
248
|
+
className: twMerge(
|
|
249
|
+
"flex min-h-10 select-none flex-row items-center gap-2.5 rounded-lg px-2 text-start text-sm aria-disabled:pointer-events-none aria-disabled:opacity-50 aria-selected:bg-fd-accent aria-selected:text-fd-accent-foreground",
|
|
250
|
+
props.className
|
|
251
|
+
),
|
|
252
|
+
children: props.children
|
|
253
|
+
}
|
|
254
|
+
);
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
export {
|
|
258
|
+
SearchDialog
|
|
259
|
+
};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import {
|
|
2
|
+
twMerge
|
|
3
|
+
} from "./chunk-TK3TM3MR.js";
|
|
4
|
+
|
|
5
|
+
// src/components/dialog/tag-list.tsx
|
|
6
|
+
import { cva } from "class-variance-authority";
|
|
7
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
var itemVariants = cva(
|
|
9
|
+
"rounded-md border px-2 py-0.5 text-xs font-medium text-fd-muted-foreground transition-colors",
|
|
10
|
+
{
|
|
11
|
+
variants: {
|
|
12
|
+
active: {
|
|
13
|
+
true: "bg-fd-accent text-fd-accent-foreground"
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
);
|
|
18
|
+
function TagsList({
|
|
19
|
+
tag,
|
|
20
|
+
onTagChange,
|
|
21
|
+
items,
|
|
22
|
+
allowClear,
|
|
23
|
+
...props
|
|
24
|
+
}) {
|
|
25
|
+
return /* @__PURE__ */ jsxs(
|
|
26
|
+
"div",
|
|
27
|
+
{
|
|
28
|
+
...props,
|
|
29
|
+
className: twMerge("flex flex-row items-center gap-1", props.className),
|
|
30
|
+
children: [
|
|
31
|
+
items.map((item) => /* @__PURE__ */ jsx(
|
|
32
|
+
"button",
|
|
33
|
+
{
|
|
34
|
+
type: "button",
|
|
35
|
+
className: twMerge(itemVariants({ active: tag === item.value })),
|
|
36
|
+
onClick: () => {
|
|
37
|
+
if (tag === item.value && allowClear) {
|
|
38
|
+
onTagChange(void 0);
|
|
39
|
+
} else {
|
|
40
|
+
onTagChange(item.value);
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
tabIndex: -1,
|
|
44
|
+
children: item.name
|
|
45
|
+
},
|
|
46
|
+
item.value
|
|
47
|
+
)),
|
|
48
|
+
props.children
|
|
49
|
+
]
|
|
50
|
+
}
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export {
|
|
55
|
+
TagsList
|
|
56
|
+
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import { HTMLAttributes, ReactNode } from 'react';
|
|
3
3
|
|
|
4
|
-
declare const Callout: react.ForwardRefExoticComponent<Omit<HTMLAttributes<HTMLDivElement>, "title" | "
|
|
4
|
+
declare const Callout: react.ForwardRefExoticComponent<Omit<HTMLAttributes<HTMLDivElement>, "title" | "type" | "icon"> & {
|
|
5
5
|
title?: ReactNode;
|
|
6
6
|
/**
|
|
7
7
|
* @defaultValue info
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { AlgoliaOptions } from 'fumadocs-core/search/client';
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { SharedProps } from './search.js';
|
|
4
|
+
import { T as TagItem } from '../../tag-list-BsEgfE3x.js';
|
|
5
|
+
import 'react/jsx-runtime';
|
|
5
6
|
import 'fumadocs-core/server';
|
|
6
7
|
|
|
7
8
|
interface AlgoliaSearchDialogProps extends SharedProps {
|
|
8
|
-
index:
|
|
9
|
-
searchOptions?:
|
|
9
|
+
index: AlgoliaOptions['index'];
|
|
10
|
+
searchOptions?: Omit<AlgoliaOptions, 'index'>;
|
|
10
11
|
footer?: ReactNode;
|
|
11
12
|
defaultTag?: string;
|
|
12
13
|
tags?: TagItem[];
|
|
@@ -23,6 +24,6 @@ interface AlgoliaSearchDialogProps extends SharedProps {
|
|
|
23
24
|
*/
|
|
24
25
|
allowClear?: boolean;
|
|
25
26
|
}
|
|
26
|
-
declare function AlgoliaSearchDialog({ index, searchOptions, tags, defaultTag, showAlgolia, allowClear, ...props }: AlgoliaSearchDialogProps):
|
|
27
|
+
declare function AlgoliaSearchDialog({ index, searchOptions, tags, defaultTag, showAlgolia, allowClear, ...props }: AlgoliaSearchDialogProps): ReactNode;
|
|
27
28
|
|
|
28
29
|
export { type AlgoliaSearchDialogProps, AlgoliaSearchDialog as default };
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
|
-
SearchDialog,
|
|
4
3
|
TagsList
|
|
5
|
-
} from "../../chunk-
|
|
4
|
+
} from "../../chunk-DGKCMOIC.js";
|
|
5
|
+
import {
|
|
6
|
+
SearchDialog
|
|
7
|
+
} from "../../chunk-45REPLUI.js";
|
|
6
8
|
import "../../chunk-QKOA6KEZ.js";
|
|
7
9
|
import "../../chunk-5QPVK7QM.js";
|
|
8
10
|
import "../../chunk-TK3TM3MR.js";
|
|
@@ -12,7 +14,9 @@ import "../../chunk-EFMHXXHW.js";
|
|
|
12
14
|
import "../../chunk-MLKGABMK.js";
|
|
13
15
|
|
|
14
16
|
// src/components/dialog/search-algolia.tsx
|
|
15
|
-
import {
|
|
17
|
+
import {
|
|
18
|
+
useDocsSearch
|
|
19
|
+
} from "fumadocs-core/search/client";
|
|
16
20
|
import { useState } from "react";
|
|
17
21
|
import { useOnChange } from "fumadocs-core/utils/use-on-change";
|
|
18
22
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
-
import { SharedProps
|
|
2
|
+
import { SharedProps } from './search.js';
|
|
3
|
+
import { T as TagItem } from '../../tag-list-BsEgfE3x.js';
|
|
4
|
+
import 'react/jsx-runtime';
|
|
3
5
|
import 'fumadocs-core/server';
|
|
4
6
|
|
|
5
7
|
interface DefaultSearchDialogProps extends SharedProps {
|
|
@@ -25,6 +27,6 @@ interface DefaultSearchDialogProps extends SharedProps {
|
|
|
25
27
|
*/
|
|
26
28
|
allowClear?: boolean;
|
|
27
29
|
}
|
|
28
|
-
declare function DefaultSearchDialog({ defaultTag, tags, api, delayMs, type, allowClear, ...props }: DefaultSearchDialogProps):
|
|
30
|
+
declare function DefaultSearchDialog({ defaultTag, tags, api, delayMs, type, allowClear, ...props }: DefaultSearchDialogProps): ReactNode;
|
|
29
31
|
|
|
30
32
|
export { type DefaultSearchDialogProps, DefaultSearchDialog as default };
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
|
-
SearchDialog,
|
|
4
3
|
TagsList
|
|
5
|
-
} from "../../chunk-
|
|
4
|
+
} from "../../chunk-DGKCMOIC.js";
|
|
5
|
+
import {
|
|
6
|
+
SearchDialog
|
|
7
|
+
} from "../../chunk-45REPLUI.js";
|
|
6
8
|
import "../../chunk-QKOA6KEZ.js";
|
|
7
9
|
import "../../chunk-5QPVK7QM.js";
|
|
8
10
|
import "../../chunk-TK3TM3MR.js";
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { OramaCloudOptions } from 'fumadocs-core/search/client';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
import { SharedProps } from './search.js';
|
|
4
|
+
import { T as TagItem } from '../../tag-list-BsEgfE3x.js';
|
|
5
|
+
import 'react/jsx-runtime';
|
|
6
|
+
import 'fumadocs-core/server';
|
|
7
|
+
|
|
8
|
+
interface OramaSearchDialogProps extends SharedProps {
|
|
9
|
+
client: OramaCloudOptions['client'];
|
|
10
|
+
searchOptions?: OramaCloudOptions['params'];
|
|
11
|
+
footer?: ReactNode;
|
|
12
|
+
defaultTag?: string;
|
|
13
|
+
tags?: TagItem[];
|
|
14
|
+
/**
|
|
15
|
+
* Add the "Powered by Orama" label
|
|
16
|
+
*
|
|
17
|
+
* @defaultValue false
|
|
18
|
+
*/
|
|
19
|
+
showOrama?: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Allow to clear tag filters
|
|
22
|
+
*
|
|
23
|
+
* @defaultValue false
|
|
24
|
+
*/
|
|
25
|
+
allowClear?: boolean;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Orama Cloud integration
|
|
29
|
+
*/
|
|
30
|
+
declare function OramaSearchDialog({ client, searchOptions, tags, defaultTag, showOrama, allowClear, ...props }: OramaSearchDialogProps): ReactNode;
|
|
31
|
+
|
|
32
|
+
export { type OramaSearchDialogProps, OramaSearchDialog as default };
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import {
|
|
3
|
+
TagsList
|
|
4
|
+
} from "../../chunk-DGKCMOIC.js";
|
|
5
|
+
import {
|
|
6
|
+
SearchDialog
|
|
7
|
+
} from "../../chunk-45REPLUI.js";
|
|
8
|
+
import "../../chunk-QKOA6KEZ.js";
|
|
9
|
+
import "../../chunk-5QPVK7QM.js";
|
|
10
|
+
import "../../chunk-TK3TM3MR.js";
|
|
11
|
+
import "../../chunk-ET4TW6M5.js";
|
|
12
|
+
import "../../chunk-27HFSL7N.js";
|
|
13
|
+
import "../../chunk-EFMHXXHW.js";
|
|
14
|
+
import "../../chunk-MLKGABMK.js";
|
|
15
|
+
|
|
16
|
+
// src/components/dialog/search-orama.tsx
|
|
17
|
+
import {
|
|
18
|
+
useDocsSearch
|
|
19
|
+
} from "fumadocs-core/search/client";
|
|
20
|
+
import { useState } from "react";
|
|
21
|
+
import { useOnChange } from "fumadocs-core/utils/use-on-change";
|
|
22
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
23
|
+
function OramaSearchDialog({
|
|
24
|
+
client,
|
|
25
|
+
searchOptions,
|
|
26
|
+
tags,
|
|
27
|
+
defaultTag,
|
|
28
|
+
showOrama = false,
|
|
29
|
+
allowClear = false,
|
|
30
|
+
...props
|
|
31
|
+
}) {
|
|
32
|
+
const [tag, setTag] = useState(defaultTag);
|
|
33
|
+
const { search, setSearch, query } = useDocsSearch(
|
|
34
|
+
{
|
|
35
|
+
type: "orama-cloud",
|
|
36
|
+
client,
|
|
37
|
+
params: searchOptions
|
|
38
|
+
},
|
|
39
|
+
void 0,
|
|
40
|
+
tag
|
|
41
|
+
);
|
|
42
|
+
useOnChange(defaultTag, (v) => {
|
|
43
|
+
setTag(v);
|
|
44
|
+
});
|
|
45
|
+
return /* @__PURE__ */ jsx(
|
|
46
|
+
SearchDialog,
|
|
47
|
+
{
|
|
48
|
+
search,
|
|
49
|
+
onSearchChange: setSearch,
|
|
50
|
+
results: query.data ?? [],
|
|
51
|
+
isLoading: query.isLoading,
|
|
52
|
+
...props,
|
|
53
|
+
footer: tags ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
54
|
+
/* @__PURE__ */ jsx(
|
|
55
|
+
TagsList,
|
|
56
|
+
{
|
|
57
|
+
tag,
|
|
58
|
+
onTagChange: setTag,
|
|
59
|
+
items: tags,
|
|
60
|
+
allowClear,
|
|
61
|
+
children: showOrama ? /* @__PURE__ */ jsx(Label, {}) : null
|
|
62
|
+
}
|
|
63
|
+
),
|
|
64
|
+
props.footer
|
|
65
|
+
] }) : props.footer
|
|
66
|
+
}
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
function Label() {
|
|
70
|
+
return /* @__PURE__ */ jsx(
|
|
71
|
+
"a",
|
|
72
|
+
{
|
|
73
|
+
href: "https://orama.com",
|
|
74
|
+
rel: "noreferrer noopener",
|
|
75
|
+
className: "ms-auto text-xs text-fd-muted-foreground",
|
|
76
|
+
children: "Search powered by Orama"
|
|
77
|
+
}
|
|
78
|
+
);
|
|
79
|
+
}
|
|
80
|
+
export {
|
|
81
|
+
OramaSearchDialog as default
|
|
82
|
+
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
1
2
|
import { SortedResult } from 'fumadocs-core/server';
|
|
2
|
-
import {
|
|
3
|
+
import { ReactNode } from 'react';
|
|
3
4
|
|
|
4
5
|
type SearchLink = [name: string, href: string];
|
|
5
6
|
interface SharedProps {
|
|
@@ -10,28 +11,19 @@ interface SharedProps {
|
|
|
10
11
|
*/
|
|
11
12
|
links?: SearchLink[];
|
|
12
13
|
}
|
|
13
|
-
|
|
14
|
+
type SearchDialogProps = SharedProps & SearchValueProps & Omit<SearchResultProps, 'items'> & {
|
|
14
15
|
results: SortedResult[] | 'empty';
|
|
15
16
|
footer?: ReactNode;
|
|
16
|
-
}
|
|
17
|
-
interface
|
|
17
|
+
};
|
|
18
|
+
interface SearchValueProps {
|
|
18
19
|
search: string;
|
|
19
20
|
onSearchChange: (v: string) => void;
|
|
20
21
|
isLoading?: boolean;
|
|
22
|
+
}
|
|
23
|
+
interface SearchResultProps {
|
|
21
24
|
items: SortedResult[];
|
|
22
25
|
hideResults?: boolean;
|
|
23
26
|
}
|
|
24
|
-
declare function SearchDialog({ open, onOpenChange, footer, links, ...props }: SearchDialogProps):
|
|
25
|
-
interface TagItem {
|
|
26
|
-
name: string;
|
|
27
|
-
value: string | undefined;
|
|
28
|
-
}
|
|
29
|
-
interface TagsListProps extends HTMLAttributes<HTMLDivElement> {
|
|
30
|
-
tag?: string;
|
|
31
|
-
onTagChange: (tag: string | undefined) => void;
|
|
32
|
-
allowClear?: boolean;
|
|
33
|
-
items: TagItem[];
|
|
34
|
-
}
|
|
35
|
-
declare function TagsList({ tag, onTagChange, items, allowClear, ...props }: TagsListProps): ReactNode;
|
|
27
|
+
declare function SearchDialog({ open, onOpenChange, footer, links, ...props }: SearchDialogProps): react_jsx_runtime.JSX.Element;
|
|
36
28
|
|
|
37
|
-
export { SearchDialog, type SearchLink, type SharedProps
|
|
29
|
+
export { SearchDialog, type SearchLink, type SharedProps };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
"use client";
|
|
1
2
|
import {
|
|
2
|
-
SearchDialog
|
|
3
|
-
|
|
4
|
-
} from "../../chunk-TYZZJ335.js";
|
|
3
|
+
SearchDialog
|
|
4
|
+
} from "../../chunk-45REPLUI.js";
|
|
5
5
|
import "../../chunk-QKOA6KEZ.js";
|
|
6
6
|
import "../../chunk-5QPVK7QM.js";
|
|
7
7
|
import "../../chunk-TK3TM3MR.js";
|
|
@@ -10,6 +10,5 @@ import "../../chunk-27HFSL7N.js";
|
|
|
10
10
|
import "../../chunk-EFMHXXHW.js";
|
|
11
11
|
import "../../chunk-MLKGABMK.js";
|
|
12
12
|
export {
|
|
13
|
-
SearchDialog
|
|
14
|
-
TagsList
|
|
13
|
+
SearchDialog
|
|
15
14
|
};
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
|
+
import {
|
|
3
|
+
RootToggle
|
|
4
|
+
} from "../chunk-WRBUXI2A.js";
|
|
2
5
|
import {
|
|
3
6
|
Sidebar,
|
|
4
7
|
itemVariants
|
|
@@ -12,14 +15,11 @@ import {
|
|
|
12
15
|
import {
|
|
13
16
|
SearchToggle
|
|
14
17
|
} from "../chunk-V6RONFCQ.js";
|
|
18
|
+
import "../chunk-CDPVENXR.js";
|
|
15
19
|
import {
|
|
16
20
|
LanguageToggle,
|
|
17
21
|
LanguageToggleText
|
|
18
22
|
} from "../chunk-KZTWSBYY.js";
|
|
19
|
-
import {
|
|
20
|
-
RootToggle
|
|
21
|
-
} from "../chunk-WRBUXI2A.js";
|
|
22
|
-
import "../chunk-CDPVENXR.js";
|
|
23
23
|
import {
|
|
24
24
|
Collapsible,
|
|
25
25
|
CollapsibleContent,
|
|
@@ -9,11 +9,11 @@ import {
|
|
|
9
9
|
LargeSearchToggle,
|
|
10
10
|
SearchToggle
|
|
11
11
|
} from "../chunk-V6RONFCQ.js";
|
|
12
|
+
import "../chunk-CDPVENXR.js";
|
|
12
13
|
import {
|
|
13
14
|
LanguageToggle,
|
|
14
15
|
LanguageToggleText
|
|
15
16
|
} from "../chunk-KZTWSBYY.js";
|
|
16
|
-
import "../chunk-CDPVENXR.js";
|
|
17
17
|
import {
|
|
18
18
|
buttonVariants
|
|
19
19
|
} from "../chunk-QKOA6KEZ.js";
|
package/dist/mdx.d.ts
CHANGED
|
@@ -18,7 +18,7 @@ declare const defaultMdxComponents: {
|
|
|
18
18
|
h5: (props: React.HTMLAttributes<HTMLHeadingElement>) => react_jsx_runtime.JSX.Element;
|
|
19
19
|
h6: (props: React.HTMLAttributes<HTMLHeadingElement>) => react_jsx_runtime.JSX.Element;
|
|
20
20
|
table: typeof Table;
|
|
21
|
-
Callout: react.ForwardRefExoticComponent<Omit<HTMLAttributes<HTMLDivElement>, "title" | "
|
|
21
|
+
Callout: react.ForwardRefExoticComponent<Omit<HTMLAttributes<HTMLDivElement>, "title" | "type" | "icon"> & {
|
|
22
22
|
title?: react.ReactNode;
|
|
23
23
|
type?: "info" | "warn" | "error";
|
|
24
24
|
icon?: react.ReactNode;
|
package/dist/provider.d.ts
CHANGED
|
@@ -5,6 +5,8 @@ import { DefaultSearchDialogProps } from './components/dialog/search-default.js'
|
|
|
5
5
|
import { SearchLink, SharedProps } from './components/dialog/search.js';
|
|
6
6
|
export { u as useI18n } from './i18n-Db2HAPOu.js';
|
|
7
7
|
export { u as useTreeContext } from './tree-06ley65N.js';
|
|
8
|
+
import './tag-list-BsEgfE3x.js';
|
|
9
|
+
import 'react/jsx-runtime';
|
|
8
10
|
import 'fumadocs-core/server';
|
|
9
11
|
|
|
10
12
|
interface HotKey {
|