fumadocs-ui 13.4.10 → 14.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (92) hide show
  1. package/dist/{chunk-774JT2B6.js → chunk-5KVEK5A7.js} +11 -8
  2. package/dist/chunk-5QPVK7QM.js +542 -0
  3. package/dist/chunk-BN7HGCQ4.js +212 -0
  4. package/dist/chunk-CDPVENXR.js +8 -0
  5. package/dist/{chunk-KWZZNVSY.js → chunk-CPGKWLLV.js} +7 -3
  6. package/dist/chunk-DN6Z5VW6.js +61 -0
  7. package/dist/chunk-GHOAONNQ.js +48 -0
  8. package/dist/{chunk-ERUVE5R6.js → chunk-IHIFNFRB.js} +4 -2
  9. package/dist/{chunk-CP67AHDD.js → chunk-IVBHRX3O.js} +1 -1
  10. package/dist/{chunk-NSEJBI4V.js → chunk-KZTWSBYY.js} +28 -16
  11. package/dist/chunk-MCX7E6ZW.js +57 -0
  12. package/dist/chunk-PZTQPB4U.js +125 -0
  13. package/dist/{chunk-EDNTYBXS.js → chunk-QKOA6KEZ.js} +2 -17
  14. package/dist/{chunk-YIOV4KEY.js → chunk-TYZZJ335.js} +26 -16
  15. package/dist/{chunk-HOIRMHZT.js → chunk-UQIRU7MP.js} +8 -2
  16. package/dist/chunk-V6RONFCQ.js +69 -0
  17. package/dist/chunk-WRBUXI2A.js +82 -0
  18. package/dist/chunk-YL3MZH7N.js +66 -0
  19. package/dist/components/accordion.js +7 -3
  20. package/dist/components/api.d.ts +2 -5
  21. package/dist/components/api.js +2 -4
  22. package/dist/components/banner.js +5 -6
  23. package/dist/components/callout.d.ts +1 -1
  24. package/dist/components/callout.js +2 -1
  25. package/dist/components/card.d.ts +6 -5
  26. package/dist/components/card.js +1 -1
  27. package/dist/components/codeblock.js +4 -3
  28. package/dist/components/dialog/search-algolia.d.ts +10 -4
  29. package/dist/components/dialog/search-algolia.js +25 -15
  30. package/dist/components/dialog/search-default.d.ts +10 -6
  31. package/dist/components/dialog/search-default.js +27 -5
  32. package/dist/components/dialog/search.d.ts +7 -7
  33. package/dist/components/dialog/search.js +4 -3
  34. package/dist/components/files.js +15 -11
  35. package/dist/components/heading.js +2 -1
  36. package/dist/components/image-zoom.js +8 -5
  37. package/dist/components/inline-toc.js +3 -1
  38. package/dist/components/layout/language-toggle.d.ts +4 -3
  39. package/dist/components/layout/language-toggle.js +8 -6
  40. package/dist/components/layout/root-toggle.d.ts +3 -3
  41. package/dist/components/layout/root-toggle.js +7 -73
  42. package/dist/components/tabs.js +30 -13
  43. package/dist/components/type-table.d.ts +7 -5
  44. package/dist/components/type-table.js +11 -11
  45. package/dist/dynamic-sidebar-QWGMOUMS.js +129 -0
  46. package/dist/{edit-on-github-YFVYCMB7.js → edit-on-github-PCTRDRD6.js} +10 -8
  47. package/dist/layouts/docs.client.d.ts +26 -0
  48. package/dist/layouts/docs.client.js +200 -0
  49. package/dist/layouts/docs.d.ts +29 -0
  50. package/dist/layouts/docs.js +187 -0
  51. package/dist/layouts/home.client.d.ts +11 -0
  52. package/dist/layouts/home.client.js +274 -0
  53. package/dist/layouts/home.d.ts +7 -0
  54. package/dist/layouts/home.js +55 -0
  55. package/dist/layouts/shared.d.ts +2 -0
  56. package/dist/layouts/shared.js +9 -0
  57. package/dist/mdx.client.js +4 -3
  58. package/dist/mdx.d.ts +0 -1
  59. package/dist/mdx.js +8 -10
  60. package/dist/og.d.ts +1 -7
  61. package/dist/og.js +5 -15
  62. package/dist/page.client.d.ts +2 -1
  63. package/dist/page.client.js +91 -63
  64. package/dist/page.d.ts +6 -5
  65. package/dist/page.js +63 -51
  66. package/dist/provider.d.ts +1 -2
  67. package/dist/provider.js +3 -4
  68. package/dist/shared-ElIzX-sQ.d.ts +152 -0
  69. package/dist/{sidebar-DwBSl7jC.d.ts → sidebar-HwpSmOKR.d.ts} +7 -9
  70. package/dist/style.css +1 -1
  71. package/dist/tailwind-plugin.js +86 -39
  72. package/dist/{toc-clerk-CAID2WGC.js → toc-clerk-SKE4LBT7.js} +40 -50
  73. package/dist/{tree-CrKzI9Nz.d.ts → tree-06ley65N.d.ts} +9 -3
  74. package/package.json +31 -68
  75. package/dist/chunk-KCZRDPB4.js +0 -308
  76. package/dist/chunk-LSTPTAZ5.js +0 -58
  77. package/dist/chunk-P4HLRHHV.js +0 -36
  78. package/dist/chunk-UOD2T27N.js +0 -27
  79. package/dist/chunk-WLTWFYQA.js +0 -44
  80. package/dist/docs-layout.client.d.ts +0 -18
  81. package/dist/docs-layout.client.js +0 -406
  82. package/dist/home-layout.client.d.ts +0 -9
  83. package/dist/home-layout.client.js +0 -88
  84. package/dist/home-layout.d.ts +0 -7
  85. package/dist/home-layout.js +0 -30
  86. package/dist/layout.d.ts +0 -19
  87. package/dist/layout.js +0 -127
  88. package/dist/layout.shared-DEQFTB9M.d.ts +0 -117
  89. package/dist/twoslash/popup.d.ts +0 -11
  90. package/dist/twoslash/popup.js +0 -97
  91. package/dist/twoslash.css +0 -1
  92. /package/dist/{image-zoom.css → components/image-zoom.css} +0 -0
@@ -1,3 +1,16 @@
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";
1
14
  import {
2
15
  useSearchContext
3
16
  } from "./chunk-ET4TW6M5.js";
@@ -7,19 +20,11 @@ import {
7
20
  import {
8
21
  useI18n
9
22
  } from "./chunk-EFMHXXHW.js";
10
- import {
11
- buttonVariants
12
- } from "./chunk-EDNTYBXS.js";
13
- import {
14
- twMerge
15
- } from "./chunk-TK3TM3MR.js";
16
23
 
17
24
  // src/components/dialog/search.tsx
18
- import { FileText, Hash, Loader2, SearchIcon, Text } from "lucide-react";
19
25
  import { useRouter } from "next/navigation";
20
26
  import {
21
- useMemo,
22
- useCallback
27
+ useMemo
23
28
  } from "react";
24
29
  import { cva } from "class-variance-authority";
25
30
 
@@ -155,7 +160,7 @@ function SearchDialog({
155
160
  );
156
161
  return /* @__PURE__ */ jsxs2(CommandDialog, { open, onOpenChange, children: [
157
162
  /* @__PURE__ */ jsx2(
158
- Search,
163
+ Search2,
159
164
  {
160
165
  ...props,
161
166
  items: props.results === "empty" ? defaultItems : props.results,
@@ -170,7 +175,7 @@ var icons = {
170
175
  heading: /* @__PURE__ */ jsx2(Hash, {}),
171
176
  page: /* @__PURE__ */ jsx2(FileText, {})
172
177
  };
173
- function Search({
178
+ function Search2({
174
179
  search,
175
180
  onSearchChange,
176
181
  items,
@@ -194,13 +199,13 @@ function Search({
194
199
  {
195
200
  value: search,
196
201
  onValueChange: onSearchChange,
197
- onClose: useCallback(() => {
202
+ onClose: () => {
198
203
  setOpenSearch(false);
199
- }, [setOpenSearch]),
204
+ },
200
205
  placeholder: text.search,
201
206
  children: /* @__PURE__ */ jsxs2("div", { className: "relative size-4", children: [
202
207
  /* @__PURE__ */ jsx2(
203
- Loader2,
208
+ LoaderCircle,
204
209
  {
205
210
  className: twMerge(
206
211
  "absolute size-full animate-spin text-fd-primary transition-opacity",
@@ -209,7 +214,7 @@ function Search({
209
214
  }
210
215
  ),
211
216
  /* @__PURE__ */ jsx2(
212
- SearchIcon,
217
+ Search,
213
218
  {
214
219
  className: twMerge(
215
220
  "absolute size-full text-fd-muted-foreground transition-opacity",
@@ -252,6 +257,7 @@ function TagsList({
252
257
  tag,
253
258
  onTagChange,
254
259
  items,
260
+ allowClear,
255
261
  ...props
256
262
  }) {
257
263
  return /* @__PURE__ */ jsxs2(
@@ -266,7 +272,11 @@ function TagsList({
266
272
  type: "button",
267
273
  className: twMerge(itemVariants({ active: tag === item.value })),
268
274
  onClick: () => {
269
- onTagChange(item.value);
275
+ if (tag === item.value && allowClear) {
276
+ onTagChange(void 0);
277
+ } else {
278
+ onTagChange(item.value);
279
+ }
270
280
  },
271
281
  tabIndex: -1,
272
282
  children: item.name
@@ -1,4 +1,4 @@
1
- // src/layout.shared.tsx
1
+ // src/layouts/shared.tsx
2
2
  import { jsx } from "react/jsx-runtime";
3
3
  function getLinks(links, githubUrl) {
4
4
  let result = links ?? [];
@@ -15,7 +15,13 @@ function getLinks(links, githubUrl) {
15
15
  ];
16
16
  return result;
17
17
  }
18
+ function replaceOrDefault(obj, def, disabled) {
19
+ if (obj?.enabled === false) return disabled;
20
+ if (obj?.component !== void 0) return obj.component;
21
+ return def;
22
+ }
18
23
 
19
24
  export {
20
- getLinks
25
+ getLinks,
26
+ replaceOrDefault
21
27
  };
@@ -0,0 +1,69 @@
1
+ import {
2
+ buttonVariants
3
+ } from "./chunk-QKOA6KEZ.js";
4
+ import {
5
+ Search
6
+ } from "./chunk-5QPVK7QM.js";
7
+ import {
8
+ twMerge
9
+ } from "./chunk-TK3TM3MR.js";
10
+ import {
11
+ useSearchContext
12
+ } from "./chunk-ET4TW6M5.js";
13
+ import {
14
+ useI18n
15
+ } from "./chunk-EFMHXXHW.js";
16
+
17
+ // src/components/layout/search-toggle.tsx
18
+ import { jsx, jsxs } from "react/jsx-runtime";
19
+ function SearchToggle(props) {
20
+ const { setOpenSearch } = useSearchContext();
21
+ return /* @__PURE__ */ jsx(
22
+ "button",
23
+ {
24
+ type: "button",
25
+ className: twMerge(
26
+ buttonVariants({
27
+ size: "icon",
28
+ color: "ghost",
29
+ className: props.className
30
+ })
31
+ ),
32
+ "data-search": "",
33
+ "aria-label": "Open Search",
34
+ onClick: () => {
35
+ setOpenSearch(true);
36
+ },
37
+ children: /* @__PURE__ */ jsx(Search, {})
38
+ }
39
+ );
40
+ }
41
+ function LargeSearchToggle(props) {
42
+ const { hotKey, setOpenSearch } = useSearchContext();
43
+ const { text } = useI18n();
44
+ return /* @__PURE__ */ jsxs(
45
+ "button",
46
+ {
47
+ type: "button",
48
+ "data-search-full": "",
49
+ ...props,
50
+ className: twMerge(
51
+ "inline-flex items-center gap-2 rounded-full border bg-fd-secondary/50 p-1.5 text-sm text-fd-muted-foreground transition-colors hover:bg-fd-accent hover:text-fd-accent-foreground",
52
+ props.className
53
+ ),
54
+ onClick: () => {
55
+ setOpenSearch(true);
56
+ },
57
+ children: [
58
+ /* @__PURE__ */ jsx(Search, { className: "ms-1 size-4" }),
59
+ text.search,
60
+ /* @__PURE__ */ jsx("div", { className: "ms-auto inline-flex gap-0.5", children: hotKey.map((k, i) => /* @__PURE__ */ jsx("kbd", { className: "rounded-md border bg-fd-background px-1.5", children: k.display }, i)) })
61
+ ]
62
+ }
63
+ );
64
+ }
65
+
66
+ export {
67
+ SearchToggle,
68
+ LargeSearchToggle
69
+ };
@@ -0,0 +1,82 @@
1
+ import {
2
+ isActive
3
+ } from "./chunk-CDPVENXR.js";
4
+ import {
5
+ Popover,
6
+ PopoverContent,
7
+ PopoverTrigger
8
+ } from "./chunk-IVBHRX3O.js";
9
+ import {
10
+ ChevronDown
11
+ } from "./chunk-5QPVK7QM.js";
12
+ import {
13
+ twMerge
14
+ } from "./chunk-TK3TM3MR.js";
15
+ import {
16
+ useSidebar
17
+ } from "./chunk-27HFSL7N.js";
18
+
19
+ // src/components/layout/root-toggle.tsx
20
+ import { useMemo, useState } from "react";
21
+ import Link from "next/link";
22
+ import { usePathname } from "next/navigation";
23
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
24
+ function RootToggle({
25
+ options,
26
+ ...props
27
+ }) {
28
+ const [open, setOpen] = useState(false);
29
+ const { closeOnRedirect } = useSidebar();
30
+ const pathname = usePathname();
31
+ const selected = useMemo(() => {
32
+ return options.find((item) => isActive(item.url, pathname, true));
33
+ }, [options, pathname]);
34
+ const onClick = () => {
35
+ closeOnRedirect.current = false;
36
+ setOpen(false);
37
+ };
38
+ return /* @__PURE__ */ jsxs(Popover, { open, onOpenChange: setOpen, children: [
39
+ /* @__PURE__ */ jsxs(
40
+ PopoverTrigger,
41
+ {
42
+ ...props,
43
+ className: twMerge(
44
+ "flex flex-row items-center gap-2.5 rounded-lg p-1 hover:bg-fd-accent/50 hover:text-fd-accent-foreground",
45
+ props.className
46
+ ),
47
+ children: [
48
+ selected ? /* @__PURE__ */ jsx(Item, { ...selected }) : null,
49
+ /* @__PURE__ */ jsx(ChevronDown, { className: "size-4 text-fd-muted-foreground md:me-1.5" })
50
+ ]
51
+ }
52
+ ),
53
+ /* @__PURE__ */ jsx(PopoverContent, { className: "w-[var(--radix-popover-trigger-width)] overflow-hidden p-0", children: options.map((item) => /* @__PURE__ */ jsx(
54
+ Link,
55
+ {
56
+ href: item.url,
57
+ onClick,
58
+ ...item.props,
59
+ className: twMerge(
60
+ "flex w-full flex-row items-center gap-2.5 p-1.5",
61
+ selected === item ? "bg-fd-accent text-fd-accent-foreground" : "hover:bg-fd-accent/50",
62
+ item.props?.className
63
+ ),
64
+ children: /* @__PURE__ */ jsx(Item, { ...item })
65
+ },
66
+ item.url
67
+ )) })
68
+ ] });
69
+ }
70
+ function Item(props) {
71
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
72
+ props.icon,
73
+ /* @__PURE__ */ jsxs("div", { className: "flex-1 text-left", children: [
74
+ /* @__PURE__ */ jsx("p", { className: "text-sm font-medium", children: props.title }),
75
+ props.description ? /* @__PURE__ */ jsx("p", { className: "text-xs text-fd-muted-foreground", children: props.description }) : null
76
+ ] })
77
+ ] });
78
+ }
79
+
80
+ export {
81
+ RootToggle
82
+ };
@@ -0,0 +1,66 @@
1
+ // src/contexts/tree.tsx
2
+ import { usePathname } from "next/navigation";
3
+ import {
4
+ createContext,
5
+ useContext,
6
+ useMemo,
7
+ useRef
8
+ } from "react";
9
+ import { searchPath } from "fumadocs-core/breadcrumb";
10
+ import { jsx } from "react/jsx-runtime";
11
+ var TreeContext = createContext(void 0);
12
+ function scanNavigationList(tree, list) {
13
+ tree.forEach((node) => {
14
+ if (node.type === "folder") {
15
+ if (node.index) {
16
+ list.push(node.index);
17
+ }
18
+ scanNavigationList(node.children, list);
19
+ return;
20
+ }
21
+ if (node.type === "page" && !node.external) {
22
+ list.push(node);
23
+ }
24
+ });
25
+ }
26
+ function TreeContextProvider({
27
+ children,
28
+ tree
29
+ }) {
30
+ const pathname = usePathname();
31
+ const cache = useRef();
32
+ const value = useMemo(() => {
33
+ const path = searchPath(tree.children, pathname) ?? [];
34
+ const root = path.findLast(
35
+ (item) => item.type === "folder" && item.root
36
+ ) ?? tree;
37
+ return {
38
+ path,
39
+ root,
40
+ getNeighbours() {
41
+ cache.current ??= /* @__PURE__ */ new WeakMap();
42
+ let result = cache.current.get(root);
43
+ if (!result) {
44
+ result = [];
45
+ scanNavigationList(root.children, result);
46
+ cache.current.set(root, result);
47
+ }
48
+ const idx = result.findIndex((item) => item.url === pathname);
49
+ if (idx === -1) return [void 0, void 0];
50
+ return [result[idx - 1], result[idx + 1]];
51
+ }
52
+ };
53
+ }, [pathname, tree]);
54
+ return /* @__PURE__ */ jsx(TreeContext.Provider, { value, children });
55
+ }
56
+ function useTreeContext() {
57
+ const ctx = useContext(TreeContext);
58
+ if (!ctx)
59
+ throw new Error("You must wrap this component under <DocsLayout />");
60
+ return ctx;
61
+ }
62
+
63
+ export {
64
+ TreeContextProvider,
65
+ useTreeContext
66
+ };
@@ -4,7 +4,12 @@ import {
4
4
  } from "../chunk-2KMKNVSN.js";
5
5
  import {
6
6
  buttonVariants
7
- } from "../chunk-EDNTYBXS.js";
7
+ } from "../chunk-QKOA6KEZ.js";
8
+ import {
9
+ Check,
10
+ ChevronRight,
11
+ Link
12
+ } from "../chunk-5QPVK7QM.js";
8
13
  import {
9
14
  twMerge
10
15
  } from "../chunk-TK3TM3MR.js";
@@ -12,7 +17,6 @@ import "../chunk-MLKGABMK.js";
12
17
 
13
18
  // src/components/accordion.tsx
14
19
  import * as AccordionPrimitive from "@radix-ui/react-accordion";
15
- import { Check, ChevronRight, LinkIcon } from "lucide-react";
16
20
  import {
17
21
  forwardRef,
18
22
  useState,
@@ -94,7 +98,7 @@ function CopyButton({ id }) {
94
98
  })
95
99
  ),
96
100
  onClick,
97
- children: checked ? /* @__PURE__ */ jsx(Check, { className: "size-3.5" }) : /* @__PURE__ */ jsx(LinkIcon, { className: "size-3.5" })
101
+ children: checked ? /* @__PURE__ */ jsx(Check, { className: "size-3.5" }) : /* @__PURE__ */ jsx(Link, { className: "size-3.5" })
98
102
  }
99
103
  );
100
104
  }
@@ -5,12 +5,9 @@ import 'react';
5
5
 
6
6
  declare const buttonVariants: (props?: ({
7
7
  color?: "outline" | "ghost" | "secondary" | null | undefined;
8
- size?: "sm" | "icon" | null | undefined;
9
- } & class_variance_authority_types.ClassProp) | undefined) => string;
10
- declare const itemVariants: (props?: ({
11
- active?: boolean | null | undefined;
8
+ size?: "icon" | "sm" | null | undefined;
12
9
  } & class_variance_authority_types.ClassProp) | undefined) => string;
13
10
 
14
11
  declare const useCopyButton: typeof useCopyButton$1;
15
12
 
16
- export { buttonVariants, itemVariants, useCopyButton };
13
+ export { buttonVariants, useCopyButton };
@@ -1,8 +1,7 @@
1
1
  import { _useCopyButton } from "./api.client"
2
2
  import {
3
- buttonVariants,
4
- itemVariants
5
- } from "../chunk-EDNTYBXS.js";
3
+ buttonVariants
4
+ } from "../chunk-QKOA6KEZ.js";
6
5
  import {
7
6
  twMerge
8
7
  } from "../chunk-TK3TM3MR.js";
@@ -13,6 +12,5 @@ var useCopyButton = _useCopyButton;
13
12
  export {
14
13
  buttonVariants,
15
14
  twMerge as cn,
16
- itemVariants,
17
15
  useCopyButton
18
16
  };
@@ -1,7 +1,10 @@
1
1
  "use client";
2
2
  import {
3
3
  buttonVariants
4
- } from "../chunk-EDNTYBXS.js";
4
+ } from "../chunk-QKOA6KEZ.js";
5
+ import {
6
+ X
7
+ } from "../chunk-5QPVK7QM.js";
5
8
  import {
6
9
  twMerge
7
10
  } from "../chunk-TK3TM3MR.js";
@@ -9,7 +12,6 @@ import "../chunk-MLKGABMK.js";
9
12
 
10
13
  // src/components/banner.tsx
11
14
  import { useCallback, useEffect, useState } from "react";
12
- import { X } from "lucide-react";
13
15
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
14
16
  function Banner({
15
17
  id,
@@ -19,7 +21,6 @@ function Banner({
19
21
  }) {
20
22
  const [open, setOpen] = useState(true);
21
23
  const globalKey = id ? `nd-banner-${id}` : void 0;
22
- const cssFilter = `:not(.${globalKey ?? "nd-banner-never"} *)`;
23
24
  useEffect(() => {
24
25
  if (globalKey) setOpen(localStorage.getItem(globalKey) !== "true");
25
26
  }, [globalKey]);
@@ -40,9 +41,7 @@ function Banner({
40
41
  ),
41
42
  children: [
42
43
  changeLayout && open ? /* @__PURE__ */ jsx("style", { children: `
43
- #nd-sidebar${cssFilter}, #nd-nav${cssFilter}, #nd-subnav${cssFilter}, [data-toc]${cssFilter} { top: 3rem; }
44
- #nd-tocnav${cssFilter} { top: 6.5rem; }
45
- #nd-sidebar${cssFilter}, [data-toc]${cssFilter} { height: calc(100dvh - 3rem); }
44
+ :root:not(.${globalKey ?? "nd-banner-never"}) { --fd-banner-height: 3rem; }
46
45
  ` }) : null,
47
46
  globalKey ? /* @__PURE__ */ jsx("style", { children: `.${globalKey} #${id} { display: none; }` }) : null,
48
47
  id ? /* @__PURE__ */ jsx(
@@ -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" | "type" | "icon"> & {
4
+ declare const Callout: react.ForwardRefExoticComponent<Omit<HTMLAttributes<HTMLDivElement>, "title" | "icon" | "type"> & {
5
5
  title?: ReactNode;
6
6
  /**
7
7
  * @defaultValue info
@@ -1,6 +1,7 @@
1
1
  import {
2
2
  Callout
3
- } from "../chunk-KWZZNVSY.js";
3
+ } from "../chunk-CPGKWLLV.js";
4
+ import "../chunk-5QPVK7QM.js";
4
5
  import "../chunk-TK3TM3MR.js";
5
6
  import "../chunk-MLKGABMK.js";
6
7
  export {
@@ -1,12 +1,13 @@
1
- import { LinkProps } from 'fumadocs-core/link';
2
1
  import { HTMLAttributes, ReactNode } from 'react';
3
2
 
4
3
  declare function Cards(props: HTMLAttributes<HTMLDivElement>): React.ReactElement;
5
- type CardProps = {
4
+ type CardProps = HTMLAttributes<HTMLElement> & {
6
5
  icon?: ReactNode;
7
- title: string;
8
- description?: string;
9
- } & Omit<LinkProps, 'title'>;
6
+ title: ReactNode;
7
+ description?: ReactNode;
8
+ href?: string;
9
+ external?: boolean;
10
+ };
10
11
  declare function Card({ icon, title, description, ...props }: CardProps): React.ReactElement;
11
12
 
12
13
  export { Card, type CardProps, Cards };
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  Card,
3
3
  Cards
4
- } from "../chunk-WLTWFYQA.js";
4
+ } from "../chunk-GHOAONNQ.js";
5
5
  import "../chunk-TK3TM3MR.js";
6
6
  import "../chunk-MLKGABMK.js";
7
7
  export {
@@ -2,10 +2,11 @@
2
2
  import {
3
3
  CodeBlock,
4
4
  Pre
5
- } from "../chunk-774JT2B6.js";
6
- import "../chunk-2FLZOPQN.js";
5
+ } from "../chunk-5KVEK5A7.js";
7
6
  import "../chunk-2KMKNVSN.js";
8
- import "../chunk-EDNTYBXS.js";
7
+ import "../chunk-QKOA6KEZ.js";
8
+ import "../chunk-2FLZOPQN.js";
9
+ import "../chunk-5QPVK7QM.js";
9
10
  import "../chunk-TK3TM3MR.js";
10
11
  import "../chunk-MLKGABMK.js";
11
12
  export {
@@ -1,12 +1,12 @@
1
1
  import { SearchIndex } from 'algoliasearch/lite';
2
- import { Options } from 'fumadocs-core/search-algolia/client';
3
2
  import { ReactNode } from 'react';
3
+ import { SearchOptions } from '@algolia/client-search';
4
4
  import { SharedProps, TagItem } from './search.js';
5
- import 'fumadocs-core/search/shared';
5
+ import 'fumadocs-core/server';
6
6
 
7
7
  interface AlgoliaSearchDialogProps extends SharedProps {
8
8
  index: SearchIndex;
9
- searchOptions?: Options;
9
+ searchOptions?: SearchOptions;
10
10
  footer?: ReactNode;
11
11
  defaultTag?: string;
12
12
  tags?: TagItem[];
@@ -16,7 +16,13 @@ interface AlgoliaSearchDialogProps extends SharedProps {
16
16
  * @defaultValue false
17
17
  */
18
18
  showAlgolia?: boolean;
19
+ /**
20
+ * Allow to clear tag filters
21
+ *
22
+ * @defaultValue false
23
+ */
24
+ allowClear?: boolean;
19
25
  }
20
- declare function AlgoliaSearchDialog({ index, searchOptions, tags, defaultTag, showAlgolia, ...props }: AlgoliaSearchDialogProps): React.ReactElement;
26
+ declare function AlgoliaSearchDialog({ index, searchOptions, tags, defaultTag, showAlgolia, allowClear, ...props }: AlgoliaSearchDialogProps): React.ReactElement;
21
27
 
22
28
  export { type AlgoliaSearchDialogProps, AlgoliaSearchDialog as default };
@@ -2,18 +2,17 @@
2
2
  import {
3
3
  SearchDialog,
4
4
  TagsList
5
- } from "../../chunk-YIOV4KEY.js";
5
+ } from "../../chunk-TYZZJ335.js";
6
+ import "../../chunk-QKOA6KEZ.js";
7
+ import "../../chunk-5QPVK7QM.js";
8
+ import "../../chunk-TK3TM3MR.js";
6
9
  import "../../chunk-ET4TW6M5.js";
7
10
  import "../../chunk-27HFSL7N.js";
8
11
  import "../../chunk-EFMHXXHW.js";
9
- import "../../chunk-EDNTYBXS.js";
10
- import "../../chunk-TK3TM3MR.js";
11
12
  import "../../chunk-MLKGABMK.js";
12
13
 
13
14
  // src/components/dialog/search-algolia.tsx
14
- import {
15
- useAlgoliaSearch
16
- } from "fumadocs-core/search-algolia/client";
15
+ import { useDocsSearch } from "fumadocs-core/search/client";
17
16
  import { useState } from "react";
18
17
  import { useOnChange } from "fumadocs-core/utils/use-on-change";
19
18
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
@@ -23,17 +22,19 @@ function AlgoliaSearchDialog({
23
22
  tags,
24
23
  defaultTag,
25
24
  showAlgolia = false,
25
+ allowClear = false,
26
26
  ...props
27
27
  }) {
28
28
  const [tag, setTag] = useState(defaultTag);
29
- let filters = searchOptions?.filters;
30
- if (tag) {
31
- filters = filters ? `tag:${tag} AND (${filters})` : `tag:${tag}`;
32
- }
33
- const { search, setSearch, query } = useAlgoliaSearch(index, {
34
- ...searchOptions,
35
- filters
36
- });
29
+ const { search, setSearch, query } = useDocsSearch(
30
+ {
31
+ type: "algolia",
32
+ index,
33
+ ...searchOptions
34
+ },
35
+ void 0,
36
+ tag
37
+ );
37
38
  useOnChange(defaultTag, (v) => {
38
39
  setTag(v);
39
40
  });
@@ -46,7 +47,16 @@ function AlgoliaSearchDialog({
46
47
  isLoading: query.isLoading,
47
48
  ...props,
48
49
  footer: tags ? /* @__PURE__ */ jsxs(Fragment, { children: [
49
- /* @__PURE__ */ jsx(TagsList, { tag, onTagChange: setTag, items: tags, children: showAlgolia ? /* @__PURE__ */ jsx(AlgoliaTitle, {}) : null }),
50
+ /* @__PURE__ */ jsx(
51
+ TagsList,
52
+ {
53
+ tag,
54
+ onTagChange: setTag,
55
+ items: tags,
56
+ allowClear,
57
+ children: showAlgolia ? /* @__PURE__ */ jsx(AlgoliaTitle, {}) : null
58
+ }
59
+ ),
50
60
  props.footer
51
61
  ] }) : props.footer
52
62
  }
@@ -1,14 +1,12 @@
1
1
  import { ReactNode } from 'react';
2
2
  import { SharedProps, TagItem } from './search.js';
3
- import 'fumadocs-core/search/shared';
3
+ import 'fumadocs-core/server';
4
4
 
5
5
  interface DefaultSearchDialogProps extends SharedProps {
6
6
  /**
7
- * Search tag
8
- *
9
- * @deprecated Use Tags API instead
7
+ * @defaultValue 'fetch'
10
8
  */
11
- tag?: string;
9
+ type?: 'fetch' | 'static';
12
10
  defaultTag?: string;
13
11
  tags?: TagItem[];
14
12
  /**
@@ -20,7 +18,13 @@ interface DefaultSearchDialogProps extends SharedProps {
20
18
  */
21
19
  delayMs?: number;
22
20
  footer?: ReactNode;
21
+ /**
22
+ * Allow to clear tag filters
23
+ *
24
+ * @defaultValue false
25
+ */
26
+ allowClear?: boolean;
23
27
  }
24
- declare function DefaultSearchDialog({ defaultTag, tags, api, delayMs, ...props }: DefaultSearchDialogProps): React.ReactElement;
28
+ declare function DefaultSearchDialog({ defaultTag, tags, api, delayMs, type, allowClear, ...props }: DefaultSearchDialogProps): React.ReactElement;
25
29
 
26
30
  export { type DefaultSearchDialogProps, DefaultSearchDialog as default };