@vx-oss/docs-react 1.0.3

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 (262) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +5 -0
  3. package/css/aspen.css +39 -0
  4. package/css/black.css +39 -0
  5. package/css/catppuccin.css +49 -0
  6. package/css/dusk.css +47 -0
  7. package/css/emerald.css +39 -0
  8. package/css/generated/docs.css +1 -0
  9. package/css/generated/flux.css +1 -0
  10. package/css/generated/glass.css +1 -0
  11. package/css/generated/home.css +1 -0
  12. package/css/generated/notebook.css +1 -0
  13. package/css/generated/shared.css +1 -0
  14. package/css/lib/base.css +296 -0
  15. package/css/lib/default-colors.css +51 -0
  16. package/css/lib/shiki.css +108 -0
  17. package/css/neutral.css +7 -0
  18. package/css/ocean.css +44 -0
  19. package/css/preset-legacy.css +43 -0
  20. package/css/preset.css +11 -0
  21. package/css/purple.css +39 -0
  22. package/css/ruby.css +39 -0
  23. package/css/shadcn.css +36 -0
  24. package/css/solar.css +65 -0
  25. package/css/style.css +9 -0
  26. package/css/vitepress.css +72 -0
  27. package/dist/.translations/index.d.ts +55 -0
  28. package/dist/.translations/keys.js +55 -0
  29. package/dist/_virtual/_rolldown/runtime.js +13 -0
  30. package/dist/components/accordion.d.ts +10 -0
  31. package/dist/components/accordion.js +68 -0
  32. package/dist/components/banner.d.ts +25 -0
  33. package/dist/components/banner.js +85 -0
  34. package/dist/components/callout.d.ts +21 -0
  35. package/dist/components/callout.js +60 -0
  36. package/dist/components/card.d.ts +13 -0
  37. package/dist/components/card.js +39 -0
  38. package/dist/components/codeblock.d.ts +45 -0
  39. package/dist/components/codeblock.js +126 -0
  40. package/dist/components/codeblock.rsc.d.ts +15 -0
  41. package/dist/components/codeblock.rsc.js +22 -0
  42. package/dist/components/dialog/search-algolia.d.ts +27 -0
  43. package/dist/components/dialog/search-algolia.js +64 -0
  44. package/dist/components/dialog/search-default.d.ts +29 -0
  45. package/dist/components/dialog/search-default.js +66 -0
  46. package/dist/components/dialog/search-orama.d.ts +32 -0
  47. package/dist/components/dialog/search-orama.js +69 -0
  48. package/dist/components/dialog/search.d.ts +76 -0
  49. package/dist/components/dialog/search.js +351 -0
  50. package/dist/components/dynamic-codeblock.core.d.ts +26 -0
  51. package/dist/components/dynamic-codeblock.core.js +51 -0
  52. package/dist/components/dynamic-codeblock.d.ts +8 -0
  53. package/dist/components/dynamic-codeblock.js +17 -0
  54. package/dist/components/files.d.ts +21 -0
  55. package/dist/components/files.js +40 -0
  56. package/dist/components/github-info.d.ts +20 -0
  57. package/dist/components/github-info.js +75 -0
  58. package/dist/components/heading.d.ts +9 -0
  59. package/dist/components/heading.js +38 -0
  60. package/dist/components/image-zoom.d.ts +18 -0
  61. package/dist/components/image-zoom.js +32 -0
  62. package/dist/components/image-zoom2.css +71 -0
  63. package/dist/components/inline-toc.d.ts +10 -0
  64. package/dist/components/inline-toc.js +28 -0
  65. package/dist/components/sidebar/base.d.ts +85 -0
  66. package/dist/components/sidebar/base.js +277 -0
  67. package/dist/components/sidebar/link-item.d.ts +12 -0
  68. package/dist/components/sidebar/link-item.js +37 -0
  69. package/dist/components/sidebar/page-tree.d.ts +20 -0
  70. package/dist/components/sidebar/page-tree.js +69 -0
  71. package/dist/components/sidebar/tabs/dropdown.d.ts +15 -0
  72. package/dist/components/sidebar/tabs/dropdown.js +83 -0
  73. package/dist/components/sidebar/tabs/index.d.ts +8 -0
  74. package/dist/components/sidebar/tabs/index.js +46 -0
  75. package/dist/components/steps.d.ts +10 -0
  76. package/dist/components/steps.js +16 -0
  77. package/dist/components/tabs.d.ts +33 -0
  78. package/dist/components/tabs.js +95 -0
  79. package/dist/components/toc/clerk.d.ts +11 -0
  80. package/dist/components/toc/clerk.js +227 -0
  81. package/dist/components/toc/default.d.ts +13 -0
  82. package/dist/components/toc/default.js +260 -0
  83. package/dist/components/toc/index.d.ts +10 -0
  84. package/dist/components/toc/index.js +45 -0
  85. package/dist/components/type-table.d.ts +37 -0
  86. package/dist/components/type-table.js +117 -0
  87. package/dist/components/ui/accordion.d.ts +10 -0
  88. package/dist/components/ui/accordion.js +42 -0
  89. package/dist/components/ui/button.d.ts +10 -0
  90. package/dist/components/ui/button.js +20 -0
  91. package/dist/components/ui/collapsible.d.ts +11 -0
  92. package/dist/components/ui/collapsible.js +21 -0
  93. package/dist/components/ui/navigation-menu.d.ts +14 -0
  94. package/dist/components/ui/navigation-menu.js +41 -0
  95. package/dist/components/ui/popover.d.ts +9 -0
  96. package/dist/components/ui/popover.js +20 -0
  97. package/dist/components/ui/scroll-area.d.ts +9 -0
  98. package/dist/components/ui/scroll-area.js +34 -0
  99. package/dist/components/ui/tabs.d.ts +23 -0
  100. package/dist/components/ui/tabs.js +102 -0
  101. package/dist/contexts/i18n.d.ts +34 -0
  102. package/dist/contexts/i18n.js +37 -0
  103. package/dist/contexts/search.d.ts +64 -0
  104. package/dist/contexts/search.js +68 -0
  105. package/dist/contexts/tree.d.ts +29 -0
  106. package/dist/contexts/tree.js +91 -0
  107. package/dist/i18n.d.ts +15 -0
  108. package/dist/i18n.js +38 -0
  109. package/dist/layouts/docs/client.d.ts +33 -0
  110. package/dist/layouts/docs/client.js +94 -0
  111. package/dist/layouts/docs/index.d.ts +32 -0
  112. package/dist/layouts/docs/index.js +23 -0
  113. package/dist/layouts/docs/page/index.d.ts +76 -0
  114. package/dist/layouts/docs/page/index.js +124 -0
  115. package/dist/layouts/docs/page/slots/breadcrumb.d.ts +7 -0
  116. package/dist/layouts/docs/page/slots/breadcrumb.js +44 -0
  117. package/dist/layouts/docs/page/slots/container.d.ts +5 -0
  118. package/dist/layouts/docs/page/slots/container.js +22 -0
  119. package/dist/layouts/docs/page/slots/footer.d.ts +16 -0
  120. package/dist/layouts/docs/page/slots/footer.js +56 -0
  121. package/dist/layouts/docs/page/slots/toc.d.ts +47 -0
  122. package/dist/layouts/docs/page/slots/toc.js +182 -0
  123. package/dist/layouts/docs/slots/container.d.ts +5 -0
  124. package/dist/layouts/docs/slots/container.js +36 -0
  125. package/dist/layouts/docs/slots/header.d.ts +5 -0
  126. package/dist/layouts/docs/slots/header.js +38 -0
  127. package/dist/layouts/docs/slots/sidebar.d.ts +22 -0
  128. package/dist/layouts/docs/slots/sidebar.js +268 -0
  129. package/dist/layouts/flux/index.d.ts +61 -0
  130. package/dist/layouts/flux/index.js +146 -0
  131. package/dist/layouts/flux/page/index.d.ts +67 -0
  132. package/dist/layouts/flux/page/index.js +104 -0
  133. package/dist/layouts/flux/page/slots/breadcrumb.d.ts +7 -0
  134. package/dist/layouts/flux/page/slots/breadcrumb.js +44 -0
  135. package/dist/layouts/flux/page/slots/container.d.ts +5 -0
  136. package/dist/layouts/flux/page/slots/container.js +22 -0
  137. package/dist/layouts/flux/page/slots/footer.d.ts +16 -0
  138. package/dist/layouts/flux/page/slots/footer.js +56 -0
  139. package/dist/layouts/flux/page/slots/toc.d.ts +29 -0
  140. package/dist/layouts/flux/page/slots/toc.js +181 -0
  141. package/dist/layouts/flux/slots/container.d.ts +5 -0
  142. package/dist/layouts/flux/slots/container.js +13 -0
  143. package/dist/layouts/flux/slots/sidebar.d.ts +16 -0
  144. package/dist/layouts/flux/slots/sidebar.js +243 -0
  145. package/dist/layouts/flux/slots/tab-dropdown.d.ts +10 -0
  146. package/dist/layouts/flux/slots/tab-dropdown.js +88 -0
  147. package/dist/layouts/glass/index.d.ts +39 -0
  148. package/dist/layouts/glass/index.js +70 -0
  149. package/dist/layouts/glass/layout-tabs.js +54 -0
  150. package/dist/layouts/glass/page/index.d.ts +31 -0
  151. package/dist/layouts/glass/page/index.js +92 -0
  152. package/dist/layouts/glass/page/slots/breadcrumb.d.ts +7 -0
  153. package/dist/layouts/glass/page/slots/breadcrumb.js +44 -0
  154. package/dist/layouts/glass/page/slots/footer.d.ts +16 -0
  155. package/dist/layouts/glass/page/slots/footer.js +56 -0
  156. package/dist/layouts/glass/page/slots/toc.d.ts +19 -0
  157. package/dist/layouts/glass/page/slots/toc.js +108 -0
  158. package/dist/layouts/glass/slots/header.d.ts +6 -0
  159. package/dist/layouts/glass/slots/header.js +68 -0
  160. package/dist/layouts/glass/slots/sidebar.d.ts +21 -0
  161. package/dist/layouts/glass/slots/sidebar.js +267 -0
  162. package/dist/layouts/home/index.d.ts +27 -0
  163. package/dist/layouts/home/index.js +40 -0
  164. package/dist/layouts/home/navbar.d.ts +9 -0
  165. package/dist/layouts/home/navbar.js +34 -0
  166. package/dist/layouts/home/not-found.d.ts +7 -0
  167. package/dist/layouts/home/not-found.js +41 -0
  168. package/dist/layouts/home/slots/container.d.ts +5 -0
  169. package/dist/layouts/home/slots/container.js +13 -0
  170. package/dist/layouts/home/slots/header.d.ts +8 -0
  171. package/dist/layouts/home/slots/header.js +239 -0
  172. package/dist/layouts/notebook/client.d.ts +35 -0
  173. package/dist/layouts/notebook/client.js +69 -0
  174. package/dist/layouts/notebook/index.d.ts +26 -0
  175. package/dist/layouts/notebook/index.js +23 -0
  176. package/dist/layouts/notebook/page/index.d.ts +76 -0
  177. package/dist/layouts/notebook/page/index.js +124 -0
  178. package/dist/layouts/notebook/page/slots/breadcrumb.d.ts +7 -0
  179. package/dist/layouts/notebook/page/slots/breadcrumb.js +44 -0
  180. package/dist/layouts/notebook/page/slots/container.d.ts +5 -0
  181. package/dist/layouts/notebook/page/slots/container.js +22 -0
  182. package/dist/layouts/notebook/page/slots/footer.d.ts +16 -0
  183. package/dist/layouts/notebook/page/slots/footer.js +56 -0
  184. package/dist/layouts/notebook/page/slots/toc.d.ts +47 -0
  185. package/dist/layouts/notebook/page/slots/toc.js +181 -0
  186. package/dist/layouts/notebook/slots/container.d.ts +5 -0
  187. package/dist/layouts/notebook/slots/container.js +38 -0
  188. package/dist/layouts/notebook/slots/header.d.ts +5 -0
  189. package/dist/layouts/notebook/slots/header.js +204 -0
  190. package/dist/layouts/notebook/slots/sidebar.d.ts +23 -0
  191. package/dist/layouts/notebook/slots/sidebar.js +240 -0
  192. package/dist/layouts/shared/client.d.ts +37 -0
  193. package/dist/layouts/shared/client.js +85 -0
  194. package/dist/layouts/shared/index.d.ts +169 -0
  195. package/dist/layouts/shared/index.js +98 -0
  196. package/dist/layouts/shared/page-actions.d.ts +27 -0
  197. package/dist/layouts/shared/page-actions.js +199 -0
  198. package/dist/layouts/shared/slots/language-select.d.ts +12 -0
  199. package/dist/layouts/shared/slots/language-select.js +43 -0
  200. package/dist/layouts/shared/slots/search-trigger.d.ts +13 -0
  201. package/dist/layouts/shared/slots/search-trigger.js +53 -0
  202. package/dist/layouts/shared/slots/theme-switch.d.ts +8 -0
  203. package/dist/layouts/shared/slots/theme-switch.js +70 -0
  204. package/dist/legacy/layout.d.ts +29 -0
  205. package/dist/legacy/layout.js +44 -0
  206. package/dist/legacy/sidebar.d.ts +14 -0
  207. package/dist/legacy/sidebar.js +34 -0
  208. package/dist/mdx.d.ts +44 -0
  209. package/dist/mdx.js +70 -0
  210. package/dist/mdx.server.d.ts +14 -0
  211. package/dist/mdx.server.js +20 -0
  212. package/dist/node_modules/.pnpm/react-medium-image-zoom@5.4.9_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/react-medium-image-zoom/dist/controlled.d.ts +30 -0
  213. package/dist/node_modules/.pnpm/react-medium-image-zoom@5.4.9_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/react-medium-image-zoom/dist/controlled.js +461 -0
  214. package/dist/node_modules/.pnpm/react-medium-image-zoom@5.4.9_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/react-medium-image-zoom/dist/index.d.ts +3 -0
  215. package/dist/node_modules/.pnpm/react-medium-image-zoom@5.4.9_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/react-medium-image-zoom/dist/uncontrolled.d.ts +6 -0
  216. package/dist/node_modules/.pnpm/react-medium-image-zoom@5.4.9_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/react-medium-image-zoom/dist/uncontrolled.js +17 -0
  217. package/dist/node_modules/.pnpm/react-medium-image-zoom@5.4.9_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/react-medium-image-zoom/dist/utils/adjust-svg-ids.js +53 -0
  218. package/dist/node_modules/.pnpm/react-medium-image-zoom@5.4.9_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/react-medium-image-zoom/dist/utils/compute-positioned-style.js +25 -0
  219. package/dist/node_modules/.pnpm/react-medium-image-zoom@5.4.9_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/react-medium-image-zoom/dist/utils/element-tests.js +12 -0
  220. package/dist/node_modules/.pnpm/react-medium-image-zoom@5.4.9_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/react-medium-image-zoom/dist/utils/get-div-img-style.js +45 -0
  221. package/dist/node_modules/.pnpm/react-medium-image-zoom@5.4.9_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/react-medium-image-zoom/dist/utils/get-img-alt.js +10 -0
  222. package/dist/node_modules/.pnpm/react-medium-image-zoom@5.4.9_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/react-medium-image-zoom/dist/utils/get-img-object-fit-style.js +57 -0
  223. package/dist/node_modules/.pnpm/react-medium-image-zoom@5.4.9_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/react-medium-image-zoom/dist/utils/get-img-regular-style.js +21 -0
  224. package/dist/node_modules/.pnpm/react-medium-image-zoom@5.4.9_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/react-medium-image-zoom/dist/utils/get-img-src.js +14 -0
  225. package/dist/node_modules/.pnpm/react-medium-image-zoom@5.4.9_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/react-medium-image-zoom/dist/utils/get-modal-img-transform.js +22 -0
  226. package/dist/node_modules/.pnpm/react-medium-image-zoom@5.4.9_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/react-medium-image-zoom/dist/utils/get-scale.js +27 -0
  227. package/dist/node_modules/.pnpm/react-medium-image-zoom@5.4.9_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/react-medium-image-zoom/dist/utils/get-style-ghost.js +31 -0
  228. package/dist/node_modules/.pnpm/react-medium-image-zoom@5.4.9_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/react-medium-image-zoom/dist/utils/get-style-modal-img.js +75 -0
  229. package/dist/node_modules/.pnpm/react-medium-image-zoom@5.4.9_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/react-medium-image-zoom/dist/utils/get-target-dimension.js +4 -0
  230. package/dist/node_modules/.pnpm/react-medium-image-zoom@5.4.9_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/react-medium-image-zoom/dist/utils/parse-position.js +7 -0
  231. package/dist/node_modules/.pnpm/react-medium-image-zoom@5.4.9_react-dom@19.2.8_react@19.2.8__react@19.2.8/node_modules/react-medium-image-zoom/dist/utils/test-has-scalable-src.js +5 -0
  232. package/dist/og/takumi.d.ts +15 -0
  233. package/dist/og/takumi.js +91 -0
  234. package/dist/og.d.ts +16 -0
  235. package/dist/og.js +91 -0
  236. package/dist/page.d.ts +29 -0
  237. package/dist/page.js +33 -0
  238. package/dist/provider/astro.d.ts +29 -0
  239. package/dist/provider/astro.js +20 -0
  240. package/dist/provider/base.d.ts +48 -0
  241. package/dist/provider/base.js +73 -0
  242. package/dist/provider/next.d.ts +16 -0
  243. package/dist/provider/next.js +17 -0
  244. package/dist/provider/react-router.d.ts +16 -0
  245. package/dist/provider/react-router.js +17 -0
  246. package/dist/provider/tanstack.d.ts +16 -0
  247. package/dist/provider/tanstack.js +17 -0
  248. package/dist/provider/waku.d.ts +16 -0
  249. package/dist/provider/waku.js +17 -0
  250. package/dist/style.css +3640 -0
  251. package/dist/tailwind/typography.d.ts +2 -0
  252. package/dist/tailwind/typography.js +2 -0
  253. package/dist/utils/cn.js +2 -0
  254. package/dist/utils/merge-refs.js +11 -0
  255. package/dist/utils/urls.js +15 -0
  256. package/dist/utils/use-copy-button.d.ts +5 -0
  257. package/dist/utils/use-copy-button.js +26 -0
  258. package/dist/utils/use-footer-items.d.ts +8 -0
  259. package/dist/utils/use-footer-items.js +24 -0
  260. package/dist/utils/use-is-scroll-top.d.ts +6 -0
  261. package/dist/utils/use-is-scroll-top.js +20 -0
  262. package/package.json +212 -0
@@ -0,0 +1,25 @@
1
+ import { HTMLAttributes } from "react";
2
+ //#region src/components/banner.d.ts
3
+ type BannerVariant = 'rainbow' | 'normal';
4
+ declare function Banner({ id, variant, changeLayout, height, rainbowColors, ...props }: HTMLAttributes<HTMLDivElement> & {
5
+ /**
6
+ * @defaultValue 3rem
7
+ */
8
+ height?: string;
9
+ /**
10
+ * @defaultValue 'normal'
11
+ */
12
+ variant?: BannerVariant;
13
+ /**
14
+ * For rainbow variant only, customize the colors
15
+ */
16
+ rainbowColors?: string[];
17
+ /**
18
+ * Change Fumadocs layout styles
19
+ *
20
+ * @defaultValue true
21
+ */
22
+ changeLayout?: boolean;
23
+ }): import("react").JSX.Element | null;
24
+ //#endregion
25
+ export { Banner };
@@ -0,0 +1,85 @@
1
+ "use client";
2
+ import { cn } from "../utils/cn.js";
3
+ import { buttonVariants } from "./ui/button.js";
4
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
5
+ import { X } from "lucide-react";
6
+ import { useEffect, useState } from "react";
7
+ import { useTranslations } from "@fuma-translate/react";
8
+ //#region src/components/banner.tsx
9
+ function Banner({ id, variant = "normal", changeLayout = true, height = "3rem", rainbowColors = [
10
+ "rgba(0,149,255,0.56)",
11
+ "rgba(231,77,255,0.77)",
12
+ "rgba(255,0,0,0.73)",
13
+ "rgba(131,255,166,0.66)"
14
+ ], ...props }) {
15
+ const t = useTranslations({ note: "banner" });
16
+ const [open, setOpen] = useState(true);
17
+ const globalKey = id ? `nd-banner-${encodeBase32(id)}` : null;
18
+ useEffect(() => {
19
+ if (globalKey && localStorage.getItem(globalKey) === "true") setOpen(false);
20
+ }, [globalKey]);
21
+ function onClose() {
22
+ setOpen(false);
23
+ if (globalKey) localStorage.setItem(globalKey, "true");
24
+ }
25
+ if (!open) return null;
26
+ return /* @__PURE__ */ jsxs("div", {
27
+ id,
28
+ ...props,
29
+ 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),
30
+ style: { height },
31
+ children: [
32
+ changeLayout && open ? /* @__PURE__ */ jsx("style", { children: globalKey ? `:root:not(.${globalKey}) { --fd-banner-height: ${height}; }` : `:root { --fd-banner-height: ${height}; }` }) : null,
33
+ globalKey ? /* @__PURE__ */ jsx("style", { children: `.${globalKey} #${id} { display: none; }` }) : null,
34
+ globalKey ? /* @__PURE__ */ jsx("script", { dangerouslySetInnerHTML: { __html: `if (localStorage.getItem('${globalKey}') === 'true') document.documentElement.classList.add('${globalKey}');` } }) : null,
35
+ variant === "rainbow" ? flow({ colors: rainbowColors }) : null,
36
+ props.children,
37
+ id ? /* @__PURE__ */ jsx("button", {
38
+ type: "button",
39
+ "aria-label": t("Close Banner", { note: "aria-label" }),
40
+ onClick: onClose,
41
+ className: cn(buttonVariants({
42
+ color: "ghost",
43
+ className: "absolute inset-e-2 top-1/2 -translate-y-1/2 text-fd-muted-foreground/50",
44
+ size: "icon-sm"
45
+ })),
46
+ children: /* @__PURE__ */ jsx(X, {})
47
+ }) : null
48
+ ]
49
+ });
50
+ }
51
+ const maskImage = "linear-gradient(to bottom,white,transparent), radial-gradient(circle at top center, white, transparent)";
52
+ function flow({ colors }) {
53
+ return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("div", {
54
+ className: "absolute inset-0 -z-1",
55
+ style: {
56
+ maskImage,
57
+ maskComposite: "intersect",
58
+ animation: "fd-moving-banner 20s linear infinite",
59
+ backgroundImage: `repeating-linear-gradient(70deg, ${[...colors, colors[0]].map((color, i) => `${color} ${i * 50 / colors.length}%`).join(", ")})`,
60
+ backgroundSize: "200% 100%",
61
+ filter: "saturate(2)"
62
+ }
63
+ }), /* @__PURE__ */ jsx("style", { children: `@keyframes fd-moving-banner {
64
+ from { background-position: 0% 0; }
65
+ to { background-position: 100% 0; }
66
+ }` })] });
67
+ }
68
+ function encodeBase32(str) {
69
+ const alphabet = "abcdefghijklmnopqrstuvwxyz234567";
70
+ let encoded = "";
71
+ let buffer = 0;
72
+ let bitsLeft = 0;
73
+ for (let i = 0; i < str.length; i++) {
74
+ buffer = buffer << 8 | str.charCodeAt(i);
75
+ bitsLeft += 8;
76
+ while (bitsLeft >= 5) {
77
+ bitsLeft -= 5;
78
+ encoded += alphabet[buffer >> bitsLeft & 31];
79
+ }
80
+ }
81
+ if (bitsLeft > 0) encoded += alphabet[buffer << 5 - bitsLeft & 31];
82
+ return encoded;
83
+ }
84
+ //#endregion
85
+ export { Banner };
@@ -0,0 +1,21 @@
1
+ import { ComponentProps, ReactNode } from "react";
2
+ //#region src/components/callout.d.ts
3
+ type CalloutType = 'info' | 'warn' | 'error' | 'success' | 'warning' | 'idea';
4
+ declare function Callout({ children, title, ...props }: {
5
+ title?: ReactNode;
6
+ } & Omit<CalloutContainerProps, 'title'>): import("react").JSX.Element;
7
+ interface CalloutContainerProps extends ComponentProps<'div'> {
8
+ /**
9
+ * @defaultValue info
10
+ */
11
+ type?: CalloutType;
12
+ /**
13
+ * Force an icon
14
+ */
15
+ icon?: ReactNode;
16
+ }
17
+ declare function CalloutContainer({ type: inputType, icon, children, className, style, ...props }: CalloutContainerProps): import("react").JSX.Element;
18
+ declare function CalloutTitle({ children, className, ...props }: ComponentProps<'p'>): import("react").JSX.Element;
19
+ declare function CalloutDescription({ children, className, ...props }: ComponentProps<'p'>): import("react").JSX.Element;
20
+ //#endregion
21
+ export { Callout, CalloutContainer, CalloutContainerProps, CalloutDescription, CalloutTitle, CalloutType };
@@ -0,0 +1,60 @@
1
+ import { cn } from "../utils/cn.js";
2
+ import { jsx, jsxs } from "react/jsx-runtime";
3
+ import { CircleCheck, CircleX, Info, Lightbulb, TriangleAlert } from "lucide-react";
4
+ //#region src/components/callout.tsx
5
+ const iconClass = "size-5 -me-0.5 fill-(--callout-color) text-fd-card";
6
+ function Callout({ children, title, ...props }) {
7
+ return /* @__PURE__ */ jsxs(CalloutContainer, {
8
+ ...props,
9
+ children: [title && /* @__PURE__ */ jsx(CalloutTitle, { children: title }), /* @__PURE__ */ jsx(CalloutDescription, { children })]
10
+ });
11
+ }
12
+ function resolveAlias(type) {
13
+ if (type === "warn") return "warning";
14
+ if (type === "tip") return "info";
15
+ return type;
16
+ }
17
+ function CalloutContainer({ type: inputType = "info", icon, children, className, style, ...props }) {
18
+ const type = resolveAlias(inputType);
19
+ return /* @__PURE__ */ jsxs("div", {
20
+ 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),
21
+ style: {
22
+ "--callout-color": `var(--color-fd-${type}, var(--color-fd-muted))`,
23
+ ...style
24
+ },
25
+ ...props,
26
+ children: [
27
+ /* @__PURE__ */ jsx("div", {
28
+ role: "none",
29
+ className: "w-0.5 bg-(--callout-color)/50 rounded-sm"
30
+ }),
31
+ icon ?? {
32
+ info: /* @__PURE__ */ jsx(Info, { className: iconClass }),
33
+ warning: /* @__PURE__ */ jsx(TriangleAlert, { className: iconClass }),
34
+ error: /* @__PURE__ */ jsx(CircleX, { className: iconClass }),
35
+ success: /* @__PURE__ */ jsx(CircleCheck, { className: iconClass }),
36
+ idea: /* @__PURE__ */ jsx(Lightbulb, { className: "size-5 -me-0.5 fill-(--callout-color) text-(--callout-color)" })
37
+ }[type],
38
+ /* @__PURE__ */ jsx("div", {
39
+ className: "flex flex-col gap-2 min-w-0 flex-1",
40
+ children
41
+ })
42
+ ]
43
+ });
44
+ }
45
+ function CalloutTitle({ children, className, ...props }) {
46
+ return /* @__PURE__ */ jsx("p", {
47
+ className: cn("font-medium my-0!", className),
48
+ ...props,
49
+ children
50
+ });
51
+ }
52
+ function CalloutDescription({ children, className, ...props }) {
53
+ return /* @__PURE__ */ jsx("div", {
54
+ className: cn("text-fd-muted-foreground prose-no-margin empty:hidden", className),
55
+ ...props,
56
+ children
57
+ });
58
+ }
59
+ //#endregion
60
+ export { Callout, CalloutContainer, CalloutDescription, CalloutTitle };
@@ -0,0 +1,13 @@
1
+ import { HTMLAttributes, ReactNode } from "react";
2
+ //#region src/components/card.d.ts
3
+ declare function Cards(props: HTMLAttributes<HTMLDivElement>): import("react").JSX.Element;
4
+ type CardProps = Omit<HTMLAttributes<HTMLElement>, 'title'> & {
5
+ icon?: ReactNode;
6
+ title: ReactNode;
7
+ description?: ReactNode;
8
+ href?: string;
9
+ external?: boolean;
10
+ };
11
+ declare function Card({ icon, title, description, ...props }: CardProps): import("react").JSX.Element;
12
+ //#endregion
13
+ export { Card, CardProps, Cards };
@@ -0,0 +1,39 @@
1
+ import { cn } from "../utils/cn.js";
2
+ import Link from "@vx-oss/docs-core/link";
3
+ import { jsx, jsxs } from "react/jsx-runtime";
4
+ //#region src/components/card.tsx
5
+ function Cards(props) {
6
+ return /* @__PURE__ */ jsx("div", {
7
+ ...props,
8
+ className: cn("grid grid-cols-2 gap-3 @container", props.className),
9
+ children: props.children
10
+ });
11
+ }
12
+ function Card({ icon, title, description, ...props }) {
13
+ const E = props.href ? Link : "div";
14
+ return /* @__PURE__ */ jsxs(E, {
15
+ ...props,
16
+ "data-card": true,
17
+ 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),
18
+ children: [
19
+ icon ? /* @__PURE__ */ jsx("div", {
20
+ 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",
21
+ children: icon
22
+ }) : null,
23
+ /* @__PURE__ */ jsx("h3", {
24
+ className: "not-prose mb-1 text-sm font-medium",
25
+ children: title
26
+ }),
27
+ description ? /* @__PURE__ */ jsx("p", {
28
+ className: "my-0! text-sm text-fd-muted-foreground",
29
+ children: description
30
+ }) : null,
31
+ /* @__PURE__ */ jsx("div", {
32
+ className: "text-sm text-fd-muted-foreground prose-no-margin empty:hidden",
33
+ children: props.children
34
+ })
35
+ ]
36
+ });
37
+ }
38
+ //#endregion
39
+ export { Card, Cards };
@@ -0,0 +1,45 @@
1
+ import { Tabs, TabsContent, TabsList, TabsTrigger } from "./ui/tabs.js";
2
+ import { ComponentProps, HTMLAttributes, ReactNode } from "react";
3
+ //#region src/components/codeblock.d.ts
4
+ interface CodeBlockProps extends Omit<ComponentProps<'figure'>, 'title'> {
5
+ title?: ReactNode;
6
+ /**
7
+ * Icon of code block
8
+ *
9
+ * When passed as a string, it assumes the value is the HTML of icon
10
+ */
11
+ icon?: ReactNode;
12
+ /**
13
+ * Allow to copy code with copy button
14
+ *
15
+ * @defaultValue true
16
+ */
17
+ allowCopy?: boolean | 'true' | 'false';
18
+ /**
19
+ * Keep original background color generated by Shiki or Rehype Code
20
+ *
21
+ * @defaultValue false
22
+ */
23
+ keepBackground?: boolean;
24
+ viewportProps?: HTMLAttributes<HTMLElement>;
25
+ /**
26
+ * show line numbers
27
+ */
28
+ 'data-line-numbers'?: boolean;
29
+ /**
30
+ * @defaultValue 1
31
+ */
32
+ 'data-line-numbers-start'?: number;
33
+ Actions?: (props: {
34
+ className?: string;
35
+ children?: ReactNode;
36
+ }) => ReactNode;
37
+ }
38
+ declare function Pre(props: ComponentProps<'pre'>): import("react").JSX.Element;
39
+ declare function CodeBlock({ ref, title, allowCopy, keepBackground, icon, viewportProps, children, Actions, ...props }: CodeBlockProps): import("react").JSX.Element;
40
+ declare function CodeBlockTabs({ ref, ...props }: ComponentProps<typeof Tabs>): import("react").JSX.Element;
41
+ declare function CodeBlockTabsList(props: ComponentProps<typeof TabsList>): import("react").JSX.Element;
42
+ declare function CodeBlockTabsTrigger({ children, ...props }: ComponentProps<typeof TabsTrigger>): import("react").JSX.Element;
43
+ declare function CodeBlockTab(props: ComponentProps<typeof TabsContent>): import("react").JSX.Element;
44
+ //#endregion
45
+ export { CodeBlock, CodeBlockProps, CodeBlockTab, CodeBlockTabs, CodeBlockTabsList, CodeBlockTabsTrigger, Pre };
@@ -0,0 +1,126 @@
1
+ "use client";
2
+ import { cn } from "../utils/cn.js";
3
+ import { buttonVariants } from "./ui/button.js";
4
+ import { useCopyButton } from "../utils/use-copy-button.js";
5
+ import { mergeRefs } from "../utils/merge-refs.js";
6
+ import { Tabs, TabsContent, TabsList, TabsTrigger } from "./ui/tabs.js";
7
+ import { jsx, jsxs } from "react/jsx-runtime";
8
+ import { Check, Clipboard } from "lucide-react";
9
+ import { createContext, use, useMemo, useRef } from "react";
10
+ import { useTranslations } from "@fuma-translate/react";
11
+ //#region src/components/codeblock.tsx
12
+ const TabsContext = createContext(null);
13
+ function Pre(props) {
14
+ return /* @__PURE__ */ jsx("pre", {
15
+ ...props,
16
+ className: cn("min-w-full w-max *:flex *:flex-col", props.className),
17
+ children: props.children
18
+ });
19
+ }
20
+ function CodeBlock({ ref, title, allowCopy = true, keepBackground = false, icon, viewportProps = {}, children, Actions = (props) => /* @__PURE__ */ jsx("div", {
21
+ ...props,
22
+ className: cn("empty:hidden", props.className)
23
+ }), ...props }) {
24
+ const inTab = use(TabsContext) !== null;
25
+ const areaRef = useRef(null);
26
+ if (allowCopy === "true") allowCopy = true;
27
+ else if (allowCopy === "false") allowCopy = false;
28
+ return /* @__PURE__ */ jsxs("figure", {
29
+ ref,
30
+ dir: "ltr",
31
+ ...props,
32
+ tabIndex: -1,
33
+ className: cn(inTab ? "bg-fd-secondary -mx-px -mb-px last:rounded-b-xl" : "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),
34
+ children: [title ? /* @__PURE__ */ jsxs("div", {
35
+ className: "flex text-fd-muted-foreground items-center gap-2 h-9.5 border-b px-4",
36
+ children: [
37
+ typeof icon === "string" ? /* @__PURE__ */ jsx("div", {
38
+ className: "[&_svg]:size-3.5",
39
+ dangerouslySetInnerHTML: { __html: icon }
40
+ }) : icon,
41
+ /* @__PURE__ */ jsx("figcaption", {
42
+ className: "flex-1 truncate",
43
+ children: title
44
+ }),
45
+ Actions({
46
+ className: "-me-2",
47
+ children: allowCopy && /* @__PURE__ */ jsx(CopyButton, { containerRef: areaRef })
48
+ })
49
+ ]
50
+ }) : Actions({
51
+ className: "absolute top-3 right-2 z-2 backdrop-blur-lg rounded-lg text-fd-muted-foreground",
52
+ children: allowCopy && /* @__PURE__ */ jsx(CopyButton, { containerRef: areaRef })
53
+ }), /* @__PURE__ */ jsx("div", {
54
+ ref: areaRef,
55
+ ...viewportProps,
56
+ role: "region",
57
+ tabIndex: 0,
58
+ 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),
59
+ style: {
60
+ "--padding-right": !title ? "calc(var(--spacing) * 8)" : void 0,
61
+ counterSet: props["data-line-numbers"] ? `line ${Number(props["data-line-numbers-start"] ?? 1) - 1}` : void 0,
62
+ ...viewportProps.style
63
+ },
64
+ children
65
+ })]
66
+ });
67
+ }
68
+ function CopyButton({ className, containerRef, ...props }) {
69
+ const t = useTranslations({ note: "code block" });
70
+ const [checked, onClick] = useCopyButton(() => {
71
+ const pre = containerRef.current?.getElementsByTagName("pre").item(0);
72
+ if (!pre) return;
73
+ const clone = pre.cloneNode(true);
74
+ clone.querySelectorAll(".nd-copy-ignore").forEach((node) => {
75
+ node.replaceWith("\n");
76
+ });
77
+ navigator.clipboard.writeText(clone.textContent ?? "");
78
+ });
79
+ return /* @__PURE__ */ jsx("button", {
80
+ type: "button",
81
+ "data-checked": checked || void 0,
82
+ className: cn(buttonVariants({
83
+ className: "hover:text-fd-accent-foreground data-checked:text-fd-accent-foreground",
84
+ size: "icon-xs"
85
+ }), className),
86
+ "aria-label": checked ? t("Copied Text", { note: "aria-label" }) : t("Copy Text", { note: "aria-label" }),
87
+ onClick,
88
+ ...props,
89
+ children: checked ? /* @__PURE__ */ jsx(Check, {}) : /* @__PURE__ */ jsx(Clipboard, {})
90
+ });
91
+ }
92
+ function CodeBlockTabs({ ref, ...props }) {
93
+ const containerRef = useRef(null);
94
+ const nested = use(TabsContext) !== null;
95
+ return /* @__PURE__ */ jsx(Tabs, {
96
+ ref: mergeRefs(containerRef, ref),
97
+ ...props,
98
+ className: cn("bg-fd-card rounded-xl border", !nested && "my-4", props.className),
99
+ children: /* @__PURE__ */ jsx(TabsContext, {
100
+ value: useMemo(() => ({
101
+ containerRef,
102
+ nested
103
+ }), [nested]),
104
+ children: props.children
105
+ })
106
+ });
107
+ }
108
+ function CodeBlockTabsList(props) {
109
+ return /* @__PURE__ */ jsx(TabsList, {
110
+ ...props,
111
+ className: cn("flex flex-row px-2 overflow-x-auto text-fd-muted-foreground", props.className),
112
+ children: props.children
113
+ });
114
+ }
115
+ function CodeBlockTabsTrigger({ children, ...props }) {
116
+ return /* @__PURE__ */ jsxs(TabsTrigger, {
117
+ ...props,
118
+ className: cn("relative group inline-flex text-sm font-medium text-nowrap items-center transition-colors gap-2 px-2 py-1.5 hover:text-fd-accent-foreground data-[state=active]:text-fd-primary [&_svg]:size-3.5", props.className),
119
+ children: [/* @__PURE__ */ jsx("div", { className: "absolute inset-x-2 bottom-0 h-px group-data-[state=active]:bg-fd-primary" }), children]
120
+ });
121
+ }
122
+ function CodeBlockTab(props) {
123
+ return /* @__PURE__ */ jsx(TabsContent, { ...props });
124
+ }
125
+ //#endregion
126
+ export { CodeBlock, CodeBlockTab, CodeBlockTabs, CodeBlockTabsList, CodeBlockTabsTrigger, Pre };
@@ -0,0 +1,15 @@
1
+ import { CodeBlockProps } from "./codeblock.js";
2
+ import { HighlightOptions } from "@vx-oss/docs-core/highlight";
3
+ //#region src/components/codeblock.rsc.d.ts
4
+ type ServerCodeBlockProps = HighlightOptions & {
5
+ code: string;
6
+ /**
7
+ * Extra props for the underlying `<CodeBlock />` component.
8
+ *
9
+ * Ignored if you defined your own `pre` component in `components`.
10
+ */
11
+ codeblock?: CodeBlockProps;
12
+ };
13
+ declare function ServerCodeBlock({ code, codeblock, ...options }: ServerCodeBlockProps): Promise<import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<import("react").ReactNode> | (string | number | bigint | boolean | import("react").ReactPortal | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<import("react").ReactNode> | null | undefined)>;
14
+ //#endregion
15
+ export { ServerCodeBlock, ServerCodeBlockProps };
@@ -0,0 +1,22 @@
1
+ import { cn } from "../utils/cn.js";
2
+ import { CodeBlock, Pre } from "./codeblock.js";
3
+ import { jsx } from "react/jsx-runtime";
4
+ import { highlight } from "@vx-oss/docs-core/highlight";
5
+ //#region src/components/codeblock.rsc.tsx
6
+ async function ServerCodeBlock({ code, codeblock, ...options }) {
7
+ return await highlight(code, {
8
+ defaultColor: false,
9
+ ...options,
10
+ components: {
11
+ pre: (props) => /* @__PURE__ */ jsx(CodeBlock, {
12
+ ...props,
13
+ ...codeblock,
14
+ className: cn("my-0", props.className, codeblock?.className),
15
+ children: /* @__PURE__ */ jsx(Pre, { children: props.children })
16
+ }),
17
+ ...options.components
18
+ }
19
+ });
20
+ }
21
+ //#endregion
22
+ export { ServerCodeBlock };
@@ -0,0 +1,27 @@
1
+ import { SearchLink, SharedProps, TagItem } from "../../contexts/search.js";
2
+ import "./search.js";
3
+ import { ReactNode } from "react";
4
+ import { AlgoliaOptions } from "@vx-oss/docs-core/search/client";
5
+ //#region src/components/dialog/search-algolia.d.ts
6
+ interface AlgoliaSearchDialogProps extends SharedProps {
7
+ searchOptions: AlgoliaOptions;
8
+ links?: SearchLink[];
9
+ footer?: ReactNode;
10
+ defaultTag?: string;
11
+ tags?: TagItem[];
12
+ /**
13
+ * Add the "Powered by Algolia" label, this is useful for free tier users
14
+ *
15
+ * @defaultValue false
16
+ */
17
+ showAlgolia?: boolean;
18
+ /**
19
+ * Allow to clear tag filters
20
+ *
21
+ * @defaultValue false
22
+ */
23
+ allowClear?: boolean;
24
+ }
25
+ declare function AlgoliaSearchDialog({ searchOptions, tags, defaultTag, showAlgolia, allowClear, links, footer, ...props }: AlgoliaSearchDialogProps): import("react").JSX.Element;
26
+ //#endregion
27
+ export { AlgoliaSearchDialogProps, AlgoliaSearchDialog as default };
@@ -0,0 +1,64 @@
1
+ "use client";
2
+ import { useI18n } from "../../contexts/i18n.js";
3
+ import { SearchDialog, SearchDialogClose, SearchDialogContent, SearchDialogFooter, SearchDialogHeader, SearchDialogIcon, SearchDialogInput, SearchDialogList, SearchDialogOverlay, TagsList, TagsListItem } from "./search.js";
4
+ import { jsx, jsxs } from "react/jsx-runtime";
5
+ import { useMemo, useState } from "react";
6
+ import { useOnChange } from "@vx-oss/docs-core/utils/use-on-change";
7
+ import { useDocsSearch } from "@vx-oss/docs-core/search/client";
8
+ import { algoliaClient } from "@vx-oss/docs-core/search/client/algolia";
9
+ //#region src/components/dialog/search-algolia.tsx
10
+ function AlgoliaSearchDialog({ searchOptions, tags = [], defaultTag, showAlgolia = false, allowClear = false, links = [], footer, ...props }) {
11
+ const [tag, setTag] = useState(defaultTag);
12
+ const { locale } = useI18n();
13
+ const { search, setSearch, query } = useDocsSearch({ client: algoliaClient({
14
+ tag,
15
+ locale,
16
+ ...searchOptions
17
+ }) });
18
+ const defaultItems = useMemo(() => {
19
+ if (links.length === 0) 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 && /* @__PURE__ */ jsx(AlgoliaTitle, {});
31
+ return /* @__PURE__ */ jsxs(SearchDialog, {
32
+ search,
33
+ onSearchChange: setSearch,
34
+ isLoading: query.isLoading,
35
+ ...props,
36
+ children: [
37
+ /* @__PURE__ */ jsx(SearchDialogOverlay, {}),
38
+ /* @__PURE__ */ jsxs(SearchDialogContent, { children: [/* @__PURE__ */ jsxs(SearchDialogHeader, { children: [
39
+ /* @__PURE__ */ jsx(SearchDialogIcon, {}),
40
+ /* @__PURE__ */ jsx(SearchDialogInput, {}),
41
+ /* @__PURE__ */ jsx(SearchDialogClose, {})
42
+ ] }), /* @__PURE__ */ jsx(SearchDialogList, { items: query.data !== "empty" ? query.data : defaultItems })] }),
43
+ /* @__PURE__ */ jsxs(SearchDialogFooter, { children: [tags.length > 0 ? /* @__PURE__ */ jsxs(TagsList, {
44
+ tag,
45
+ onTagChange: setTag,
46
+ allowClear,
47
+ children: [tags.map((tag) => /* @__PURE__ */ jsx(TagsListItem, {
48
+ value: tag.value,
49
+ children: tag.name
50
+ }, tag.value)), label]
51
+ }) : label, footer] })
52
+ ]
53
+ });
54
+ }
55
+ function AlgoliaTitle() {
56
+ return /* @__PURE__ */ jsx("a", {
57
+ href: "https://algolia.com",
58
+ rel: "noreferrer noopener",
59
+ className: "ms-auto text-xs text-fd-muted-foreground",
60
+ children: "Search powered by Algolia"
61
+ });
62
+ }
63
+ //#endregion
64
+ export { AlgoliaSearchDialog as default };
@@ -0,0 +1,29 @@
1
+ import { SearchLink, SharedProps, TagItem } from "../../contexts/search.js";
2
+ import "./search.js";
3
+ import { ReactNode } from "react";
4
+ //#region src/components/dialog/search-default.d.ts
5
+ interface DefaultSearchDialogProps extends SharedProps {
6
+ /** @deprecated re-create the dialog instead for other clients, see https://fumadocs.dev/docs/search/orama */
7
+ type?: 'static';
8
+ links?: SearchLink[];
9
+ defaultTag?: string;
10
+ tags?: TagItem[];
11
+ /**
12
+ * Search API URL
13
+ */
14
+ api?: string;
15
+ /**
16
+ * The debounced delay for performing a search.
17
+ */
18
+ delayMs?: number;
19
+ footer?: ReactNode;
20
+ /**
21
+ * Allow to clear tag filters
22
+ *
23
+ * @defaultValue false
24
+ */
25
+ allowClear?: boolean;
26
+ }
27
+ declare function DefaultSearchDialog({ type, defaultTag, tags, api, delayMs, allowClear, links, footer, ...props }: DefaultSearchDialogProps): import("react").JSX.Element;
28
+ //#endregion
29
+ export { DefaultSearchDialogProps, DefaultSearchDialog as default };
@@ -0,0 +1,66 @@
1
+ "use client";
2
+ import { useI18n } from "../../contexts/i18n.js";
3
+ import { SearchDialog, SearchDialogClose, SearchDialogContent, SearchDialogFooter, SearchDialogHeader, SearchDialogIcon, SearchDialogInput, SearchDialogList, SearchDialogOverlay, TagsList, TagsListItem } from "./search.js";
4
+ import { jsx, jsxs } from "react/jsx-runtime";
5
+ import { use, useMemo, useState } from "react";
6
+ import { useOnChange } from "@vx-oss/docs-core/utils/use-on-change";
7
+ import { useDocsSearch } from "@vx-oss/docs-core/search/client";
8
+ import { fetchClient } from "@vx-oss/docs-core/search/client/fetch";
9
+ //#region src/components/dialog/search-default.tsx
10
+ let STATIC;
11
+ function DefaultSearchDialog({ type, defaultTag, tags = [], api, delayMs, allowClear = false, links = [], footer, ...props }) {
12
+ const { locale } = useI18n();
13
+ const [tag, setTag] = useState(defaultTag);
14
+ let client;
15
+ if (type === "static") client = use(STATIC ??= import("@vx-oss/docs-core/search/client/orama-static")).staticClient({
16
+ from: api,
17
+ locale,
18
+ tag
19
+ });
20
+ else client = fetchClient({
21
+ api,
22
+ locale,
23
+ tag
24
+ });
25
+ const { search, setSearch, query } = useDocsSearch({
26
+ client,
27
+ delayMs
28
+ });
29
+ const defaultItems = useMemo(() => {
30
+ if (links.length === 0) return null;
31
+ return links.map(([name, link]) => ({
32
+ type: "page",
33
+ id: name,
34
+ content: name,
35
+ url: link
36
+ }));
37
+ }, [links]);
38
+ useOnChange(defaultTag, (v) => {
39
+ setTag(v);
40
+ });
41
+ return /* @__PURE__ */ jsxs(SearchDialog, {
42
+ search,
43
+ onSearchChange: setSearch,
44
+ isLoading: query.isLoading,
45
+ ...props,
46
+ children: [
47
+ /* @__PURE__ */ jsx(SearchDialogOverlay, {}),
48
+ /* @__PURE__ */ jsxs(SearchDialogContent, { children: [/* @__PURE__ */ jsxs(SearchDialogHeader, { children: [
49
+ /* @__PURE__ */ jsx(SearchDialogIcon, {}),
50
+ /* @__PURE__ */ jsx(SearchDialogInput, {}),
51
+ /* @__PURE__ */ jsx(SearchDialogClose, {})
52
+ ] }), /* @__PURE__ */ jsx(SearchDialogList, { items: query.data !== "empty" ? query.data : defaultItems })] }),
53
+ /* @__PURE__ */ jsxs(SearchDialogFooter, { children: [tags.length > 0 && /* @__PURE__ */ jsx(TagsList, {
54
+ tag,
55
+ onTagChange: setTag,
56
+ allowClear,
57
+ children: tags.map((tag) => /* @__PURE__ */ jsx(TagsListItem, {
58
+ value: tag.value,
59
+ children: tag.name
60
+ }, tag.value))
61
+ }), footer] })
62
+ ]
63
+ });
64
+ }
65
+ //#endregion
66
+ export { DefaultSearchDialog as default };