@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,37 @@
1
+ import { ComponentProps, ReactNode } from "react";
2
+ //#region src/components/type-table.d.ts
3
+ interface ParameterNode {
4
+ name: string;
5
+ description: ReactNode;
6
+ }
7
+ interface TypeNode {
8
+ /**
9
+ * Additional description of the field
10
+ */
11
+ description?: ReactNode;
12
+ /**
13
+ * type signature (short)
14
+ */
15
+ type: ReactNode;
16
+ /**
17
+ * type signature (full)
18
+ */
19
+ typeDescription?: ReactNode;
20
+ /**
21
+ * Optional `href` for the type
22
+ */
23
+ typeDescriptionLink?: string;
24
+ default?: ReactNode;
25
+ required?: boolean;
26
+ deprecated?: boolean;
27
+ /**
28
+ * a list of parameters info if the type is a function.
29
+ */
30
+ parameters?: ParameterNode[];
31
+ returns?: ReactNode;
32
+ }
33
+ declare function TypeTable({ id, type, className, ...props }: {
34
+ type: Record<string, TypeNode>;
35
+ } & ComponentProps<'div'>): import("react").JSX.Element;
36
+ //#endregion
37
+ export { ParameterNode, TypeNode, TypeTable };
@@ -0,0 +1,117 @@
1
+ "use client";
2
+ import { cn } from "../utils/cn.js";
3
+ import { Collapsible, CollapsibleContent, CollapsibleTrigger } from "./ui/collapsible.js";
4
+ import Link from "@vx-oss/docs-core/link";
5
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
6
+ import { ChevronDown } from "lucide-react";
7
+ import { cva } from "class-variance-authority";
8
+ import { useEffect, useState } from "react";
9
+ import { useTranslations } from "@fuma-translate/react";
10
+ //#region src/components/type-table.tsx
11
+ const fieldVariants = cva("text-fd-muted-foreground not-prose pe-2");
12
+ function TypeTable({ id, type, className, ...props }) {
13
+ const t = useTranslations({ note: "type table" });
14
+ return /* @__PURE__ */ jsxs("div", {
15
+ id,
16
+ className: cn("@container flex flex-col p-1 bg-fd-card text-fd-card-foreground rounded-2xl border my-6 text-sm overflow-hidden", className),
17
+ ...props,
18
+ children: [/* @__PURE__ */ jsxs("div", {
19
+ className: "flex font-medium items-center px-3 py-1 not-prose text-fd-muted-foreground",
20
+ children: [/* @__PURE__ */ jsx("p", {
21
+ className: "w-1/4",
22
+ children: t("Prop")
23
+ }), /* @__PURE__ */ jsx("p", {
24
+ className: "@max-xl:hidden",
25
+ children: t("Type")
26
+ })]
27
+ }), Object.entries(type).map(([key, value]) => /* @__PURE__ */ jsx(Item, {
28
+ parentId: id,
29
+ name: key,
30
+ item: value
31
+ }, key))]
32
+ });
33
+ }
34
+ function Item({ parentId, name, item: { parameters = [], description, required = false, deprecated, typeDescription, default: defaultValue, type, typeDescriptionLink, returns } }) {
35
+ const t = useTranslations({ note: "type table" });
36
+ const [open, setOpen] = useState(false);
37
+ const id = parentId ? `${parentId}-${name}` : void 0;
38
+ useEffect(() => {
39
+ const hash = window.location.hash;
40
+ if (!id || !hash) return;
41
+ if (`#${id}` === hash) setOpen(true);
42
+ }, [id]);
43
+ return /* @__PURE__ */ jsxs(Collapsible, {
44
+ id,
45
+ open,
46
+ onOpenChange: (v) => {
47
+ if (v && id) window.history.replaceState(null, "", `#${id}`);
48
+ setOpen(v);
49
+ },
50
+ className: cn("rounded-xl border overflow-hidden scroll-m-20 transition-all", open ? "shadow-sm bg-fd-background not-last:mb-2" : "border-transparent"),
51
+ children: [/* @__PURE__ */ jsxs(CollapsibleTrigger, {
52
+ className: "relative flex flex-row items-center w-full group text-start px-3 py-2 not-prose hover:bg-fd-accent",
53
+ children: [
54
+ /* @__PURE__ */ jsxs("code", {
55
+ className: cn("text-fd-primary min-w-fit w-1/4 font-mono font-medium pe-2", deprecated && "line-through text-fd-primary/50"),
56
+ children: [name, !required && "?"]
57
+ }),
58
+ typeDescriptionLink ? /* @__PURE__ */ jsx(Link, {
59
+ href: typeDescriptionLink,
60
+ className: "underline @max-xl:hidden",
61
+ children: type
62
+ }) : /* @__PURE__ */ jsx("span", {
63
+ className: "@max-xl:hidden",
64
+ children: type
65
+ }),
66
+ /* @__PURE__ */ jsx(ChevronDown, { className: "absolute end-2 size-4 text-fd-muted-foreground transition-transform group-data-[state=open]:rotate-180" })
67
+ ]
68
+ }), /* @__PURE__ */ jsx(CollapsibleContent, { children: /* @__PURE__ */ jsxs("div", {
69
+ className: "grid grid-cols-[1fr_3fr] gap-y-4 text-sm p-3 overflow-auto fd-scroll-container border-t",
70
+ children: [
71
+ /* @__PURE__ */ jsx("div", {
72
+ className: "text-sm prose col-span-full prose-no-margin empty:hidden",
73
+ children: description
74
+ }),
75
+ typeDescription && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("p", {
76
+ className: cn(fieldVariants()),
77
+ children: t("Type")
78
+ }), /* @__PURE__ */ jsx("p", {
79
+ className: "my-auto not-prose",
80
+ children: typeDescription
81
+ })] }),
82
+ defaultValue && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("p", {
83
+ className: cn(fieldVariants()),
84
+ children: t("Default")
85
+ }), /* @__PURE__ */ jsx("p", {
86
+ className: "my-auto not-prose",
87
+ children: defaultValue
88
+ })] }),
89
+ parameters.length > 0 && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("p", {
90
+ className: cn(fieldVariants()),
91
+ children: t("Parameters")
92
+ }), /* @__PURE__ */ jsx("div", {
93
+ className: "flex flex-col gap-2",
94
+ children: parameters.map((param) => /* @__PURE__ */ jsxs("div", {
95
+ className: "inline-flex items-center flex-wrap gap-1",
96
+ children: [/* @__PURE__ */ jsxs("p", {
97
+ className: "font-medium not-prose text-nowrap",
98
+ children: [param.name, " -"]
99
+ }), /* @__PURE__ */ jsx("div", {
100
+ className: "text-sm prose prose-no-margin",
101
+ children: param.description
102
+ })]
103
+ }, param.name))
104
+ })] }),
105
+ returns && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("p", {
106
+ className: cn(fieldVariants()),
107
+ children: t("Returns")
108
+ }), /* @__PURE__ */ jsx("div", {
109
+ className: "my-auto text-sm prose prose-no-margin",
110
+ children: returns
111
+ })] })
112
+ ]
113
+ }) })]
114
+ });
115
+ }
116
+ //#endregion
117
+ export { TypeTable };
@@ -0,0 +1,10 @@
1
+ import { ComponentProps } from "react";
2
+ import * as Primitive from "@radix-ui/react-accordion";
3
+ //#region src/components/ui/accordion.d.ts
4
+ declare function Accordion({ className, ...props }: ComponentProps<typeof Primitive.Root>): import("react").JSX.Element;
5
+ declare function AccordionItem({ className, children, ...props }: ComponentProps<typeof Primitive.Item>): import("react").JSX.Element;
6
+ declare function AccordionHeader({ className, children, ...props }: ComponentProps<typeof Primitive.Header>): import("react").JSX.Element;
7
+ declare function AccordionTrigger({ className, children, ...props }: ComponentProps<typeof Primitive.Trigger>): import("react").JSX.Element;
8
+ declare function AccordionContent({ className, children, ...props }: ComponentProps<typeof Primitive.Content>): import("react").JSX.Element;
9
+ //#endregion
10
+ export { Accordion, AccordionContent, AccordionHeader, AccordionItem, AccordionTrigger };
@@ -0,0 +1,42 @@
1
+ "use client";
2
+ import { cn } from "../../utils/cn.js";
3
+ import { jsx, jsxs } from "react/jsx-runtime";
4
+ import { ChevronRight } from "lucide-react";
5
+ import * as Primitive from "@radix-ui/react-accordion";
6
+ //#region src/components/ui/accordion.tsx
7
+ function Accordion({ className, ...props }) {
8
+ return /* @__PURE__ */ jsx(Primitive.Root, {
9
+ className: cn("divide-y divide-fd-border overflow-hidden rounded-lg border bg-fd-card", className),
10
+ ...props
11
+ });
12
+ }
13
+ function AccordionItem({ className, children, ...props }) {
14
+ return /* @__PURE__ */ jsx(Primitive.Item, {
15
+ className: cn("scroll-m-24", className),
16
+ ...props,
17
+ children
18
+ });
19
+ }
20
+ function AccordionHeader({ className, children, ...props }) {
21
+ return /* @__PURE__ */ jsx(Primitive.Header, {
22
+ className: cn("not-prose flex flex-row items-center text-fd-card-foreground font-medium has-focus-visible:bg-fd-accent", className),
23
+ ...props,
24
+ children
25
+ });
26
+ }
27
+ function AccordionTrigger({ className, children, ...props }) {
28
+ return /* @__PURE__ */ jsxs(Primitive.Trigger, {
29
+ className: cn("group flex flex-1 items-center gap-2 px-3 py-2.5 text-start focus-visible:outline-none", className),
30
+ ...props,
31
+ children: [/* @__PURE__ */ jsx(ChevronRight, { className: "size-4 shrink-0 text-fd-muted-foreground transition-transform duration-200 group-data-[state=open]:rotate-90" }), children]
32
+ });
33
+ }
34
+ function AccordionContent({ className, children, ...props }) {
35
+ return /* @__PURE__ */ jsx(Primitive.Content, {
36
+ className: cn("overflow-hidden data-[state=closed]:animate-fd-accordion-up data-[state=open]:animate-fd-accordion-down", className),
37
+ ...props,
38
+ children
39
+ });
40
+ }
41
+ //#endregion
42
+ export { Accordion, AccordionContent, AccordionHeader, AccordionItem, AccordionTrigger };
@@ -0,0 +1,10 @@
1
+ import { VariantProps } from "class-variance-authority";
2
+ //#region src/components/ui/button.d.ts
3
+ declare const buttonVariants: (props?: ({
4
+ variant?: "primary" | "outline" | "ghost" | "secondary" | null | undefined;
5
+ color?: "primary" | "outline" | "ghost" | "secondary" | null | undefined;
6
+ size?: "sm" | "icon" | "icon-sm" | "icon-xs" | null | undefined;
7
+ } & import("class-variance-authority/types").ClassProp) | undefined) => string;
8
+ type ButtonProps = VariantProps<typeof buttonVariants>;
9
+ //#endregion
10
+ export { ButtonProps, buttonVariants };
@@ -0,0 +1,20 @@
1
+ import { cva } from "class-variance-authority";
2
+ //#region src/components/ui/button.tsx
3
+ const variants = {
4
+ primary: "bg-fd-primary text-fd-primary-foreground hover:bg-fd-primary/80 disabled:bg-fd-secondary disabled:text-fd-secondary-foreground",
5
+ outline: "border hover:bg-fd-accent hover:text-fd-accent-foreground",
6
+ ghost: "hover:bg-fd-accent hover:text-fd-accent-foreground",
7
+ secondary: "border bg-fd-secondary text-fd-secondary-foreground hover:bg-fd-accent hover:text-fd-accent-foreground"
8
+ };
9
+ const buttonVariants = cva("inline-flex items-center justify-center rounded-md p-2 text-sm font-medium transition-colors duration-100 disabled:pointer-events-none disabled:opacity-50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-fd-ring", { variants: {
10
+ variant: variants,
11
+ color: variants,
12
+ size: {
13
+ sm: "gap-1 px-2 py-1.5 text-xs",
14
+ icon: "p-1.5 [&_svg]:size-5",
15
+ "icon-sm": "p-1.5 [&_svg]:size-4.5",
16
+ "icon-xs": "p-1 [&_svg]:size-4"
17
+ }
18
+ } });
19
+ //#endregion
20
+ export { buttonVariants };
@@ -0,0 +1,11 @@
1
+ import * as React$1 from "react";
2
+ import * as Primitive from "@radix-ui/react-collapsible";
3
+ //#region src/components/ui/collapsible.d.ts
4
+ declare const Collapsible: React$1.ForwardRefExoticComponent<Primitive.CollapsibleProps & React$1.RefAttributes<HTMLDivElement>>;
5
+ declare const CollapsibleTrigger: React$1.ForwardRefExoticComponent<Primitive.CollapsibleTriggerProps & React$1.RefAttributes<HTMLButtonElement>>;
6
+ declare function CollapsibleContent({ children, ...props }: React$1.ComponentProps<typeof Primitive.CollapsibleContent>): React$1.JSX.Element;
7
+ type CollapsibleProps = Primitive.CollapsibleProps;
8
+ type CollapsibleContentProps = Primitive.CollapsibleContentProps;
9
+ type CollapsibleTriggerProps = Primitive.CollapsibleTriggerProps;
10
+ //#endregion
11
+ export { Collapsible, CollapsibleContent, CollapsibleContentProps, CollapsibleProps, CollapsibleTrigger, CollapsibleTriggerProps };
@@ -0,0 +1,21 @@
1
+ "use client";
2
+ import { cn } from "../../utils/cn.js";
3
+ import { jsx } from "react/jsx-runtime";
4
+ import { useEffect, useState } from "react";
5
+ import * as Primitive from "@radix-ui/react-collapsible";
6
+ //#region src/components/ui/collapsible.tsx
7
+ const Collapsible = Primitive.Root;
8
+ const CollapsibleTrigger = Primitive.CollapsibleTrigger;
9
+ function CollapsibleContent({ children, ...props }) {
10
+ const [mounted, setMounted] = useState(false);
11
+ useEffect(() => {
12
+ setMounted(true);
13
+ }, []);
14
+ return /* @__PURE__ */ jsx(Primitive.CollapsibleContent, {
15
+ ...props,
16
+ className: cn("overflow-hidden", mounted && "data-[state=closed]:animate-fd-collapsible-up data-[state=open]:animate-fd-collapsible-down", props.className),
17
+ children
18
+ });
19
+ }
20
+ //#endregion
21
+ export { Collapsible, CollapsibleContent, CollapsibleTrigger };
@@ -0,0 +1,14 @@
1
+ import * as React$1 from "react";
2
+ import * as Primitive from "@radix-ui/react-navigation-menu";
3
+ //#region src/components/ui/navigation-menu.d.ts
4
+ type NavigationMenuContentProps = Primitive.NavigationMenuContentProps;
5
+ type NavigationMenuTriggerProps = Primitive.NavigationMenuTriggerProps;
6
+ declare const NavigationMenu: React$1.ForwardRefExoticComponent<Primitive.NavigationMenuProps & React$1.RefAttributes<HTMLElement>>;
7
+ declare const NavigationMenuList: React$1.ForwardRefExoticComponent<Primitive.NavigationMenuListProps & React$1.RefAttributes<HTMLUListElement>>;
8
+ declare function NavigationMenuItem({ className, children, ...props }: React$1.ComponentProps<typeof Primitive.NavigationMenuItem>): React$1.JSX.Element;
9
+ declare function NavigationMenuTrigger({ className, children, ...props }: React$1.ComponentProps<typeof Primitive.Trigger>): React$1.JSX.Element;
10
+ declare function NavigationMenuContent({ className, ...props }: React$1.ComponentProps<typeof Primitive.Content>): React$1.JSX.Element;
11
+ declare const NavigationMenuLink: React$1.ForwardRefExoticComponent<Primitive.NavigationMenuLinkProps & React$1.RefAttributes<HTMLAnchorElement>>;
12
+ declare function NavigationMenuViewport({ className, ref, ...props }: React$1.ComponentProps<typeof Primitive.Viewport>): React$1.JSX.Element;
13
+ //#endregion
14
+ export { NavigationMenu, NavigationMenuContent, NavigationMenuContentProps, NavigationMenuItem, NavigationMenuLink, NavigationMenuList, NavigationMenuTrigger, NavigationMenuTriggerProps, NavigationMenuViewport };
@@ -0,0 +1,41 @@
1
+ "use client";
2
+ import { cn } from "../../utils/cn.js";
3
+ import { jsx } from "react/jsx-runtime";
4
+ import "react";
5
+ import * as Primitive from "@radix-ui/react-navigation-menu";
6
+ //#region src/components/ui/navigation-menu.tsx
7
+ const NavigationMenu = Primitive.Root;
8
+ const NavigationMenuList = Primitive.List;
9
+ function NavigationMenuItem({ className, children, ...props }) {
10
+ return /* @__PURE__ */ jsx(Primitive.NavigationMenuItem, {
11
+ className: cn("list-none", className),
12
+ ...props,
13
+ children
14
+ });
15
+ }
16
+ function NavigationMenuTrigger({ className, children, ...props }) {
17
+ return /* @__PURE__ */ jsx(Primitive.Trigger, {
18
+ className: cn("data-[state=open]:bg-fd-accent/50", className),
19
+ ...props,
20
+ children
21
+ });
22
+ }
23
+ function NavigationMenuContent({ className, ...props }) {
24
+ return /* @__PURE__ */ jsx(Primitive.Content, {
25
+ className: cn("absolute inset-x-0 top-0 overflow-auto fd-scroll-container max-h-[80svh] data-[motion=from-end]:animate-fd-enterFromRight data-[motion=from-start]:animate-fd-enterFromLeft data-[motion=to-end]:animate-fd-exitToRight data-[motion=to-start]:animate-fd-exitToLeft", className),
26
+ ...props
27
+ });
28
+ }
29
+ const NavigationMenuLink = Primitive.Link;
30
+ function NavigationMenuViewport({ className, ref, ...props }) {
31
+ return /* @__PURE__ */ jsx("div", {
32
+ ref,
33
+ className: "flex w-full justify-center",
34
+ children: /* @__PURE__ */ jsx(Primitive.Viewport, {
35
+ ...props,
36
+ className: cn("relative h-(--radix-navigation-menu-viewport-height) w-full origin-[top_center] overflow-hidden transition-[width,height] duration-300 data-[state=closed]:animate-fd-nav-menu-out data-[state=open]:animate-fd-nav-menu-in", className)
37
+ })
38
+ });
39
+ }
40
+ //#endregion
41
+ export { NavigationMenu, NavigationMenuContent, NavigationMenuItem, NavigationMenuLink, NavigationMenuList, NavigationMenuTrigger, NavigationMenuViewport };
@@ -0,0 +1,9 @@
1
+ import * as React$1 from "react";
2
+ import * as PopoverPrimitive from "@radix-ui/react-popover";
3
+ //#region src/components/ui/popover.d.ts
4
+ declare const Popover: React$1.FC<PopoverPrimitive.PopoverProps>;
5
+ declare const PopoverTrigger: React$1.ForwardRefExoticComponent<PopoverPrimitive.PopoverTriggerProps & React$1.RefAttributes<HTMLButtonElement>>;
6
+ declare function PopoverContent({ className, align, sideOffset, ...props }: React$1.ComponentProps<typeof PopoverPrimitive.Content>): React$1.JSX.Element;
7
+ declare const PopoverClose: React$1.ForwardRefExoticComponent<PopoverPrimitive.PopoverCloseProps & React$1.RefAttributes<HTMLButtonElement>>;
8
+ //#endregion
9
+ export { Popover, PopoverClose, PopoverContent, PopoverTrigger };
@@ -0,0 +1,20 @@
1
+ "use client";
2
+ import { cn } from "../../utils/cn.js";
3
+ import { jsx } from "react/jsx-runtime";
4
+ import "react";
5
+ import * as PopoverPrimitive from "@radix-ui/react-popover";
6
+ //#region src/components/ui/popover.tsx
7
+ const Popover = PopoverPrimitive.Root;
8
+ const PopoverTrigger = PopoverPrimitive.Trigger;
9
+ function PopoverContent({ className, align = "center", sideOffset = 4, ...props }) {
10
+ return /* @__PURE__ */ jsx(PopoverPrimitive.Portal, { children: /* @__PURE__ */ jsx(PopoverPrimitive.Content, {
11
+ align,
12
+ sideOffset,
13
+ side: "bottom",
14
+ className: cn("z-50 origin-(--radix-popover-content-transform-origin) overflow-y-auto max-h-(--radix-popover-content-available-height) min-w-[240px] max-w-[98vw] rounded-xl border bg-fd-popover/60 backdrop-blur-lg p-2 text-sm text-fd-popover-foreground shadow-lg focus-visible:outline-none data-[state=closed]:animate-fd-popover-out data-[state=open]:animate-fd-popover-in", className),
15
+ ...props
16
+ }) });
17
+ }
18
+ const PopoverClose = PopoverPrimitive.PopoverClose;
19
+ //#endregion
20
+ export { Popover, PopoverClose, PopoverContent, PopoverTrigger };
@@ -0,0 +1,9 @@
1
+ import * as React$1 from "react";
2
+ import * as Primitive from "@radix-ui/react-scroll-area";
3
+ //#region src/components/ui/scroll-area.d.ts
4
+ declare function ScrollArea({ className, children, ...props }: React$1.ComponentProps<typeof Primitive.Root>): React$1.JSX.Element;
5
+ declare function ScrollViewport({ className, children, ...props }: React$1.ComponentProps<typeof Primitive.Viewport>): React$1.JSX.Element;
6
+ declare function ScrollBar({ className, orientation, ...props }: React$1.ComponentProps<typeof Primitive.Scrollbar>): React$1.JSX.Element;
7
+ type ScrollAreaProps = Primitive.ScrollAreaProps;
8
+ //#endregion
9
+ export { ScrollArea, ScrollAreaProps, ScrollBar, ScrollViewport };
@@ -0,0 +1,34 @@
1
+ import { cn } from "../../utils/cn.js";
2
+ import { jsx, jsxs } from "react/jsx-runtime";
3
+ import "react";
4
+ import * as Primitive from "@radix-ui/react-scroll-area";
5
+ //#region src/components/ui/scroll-area.tsx
6
+ function ScrollArea({ className, children, ...props }) {
7
+ return /* @__PURE__ */ jsxs(Primitive.Root, {
8
+ type: "scroll",
9
+ className: cn("overflow-hidden", className),
10
+ ...props,
11
+ children: [
12
+ children,
13
+ /* @__PURE__ */ jsx(Primitive.Corner, {}),
14
+ /* @__PURE__ */ jsx(ScrollBar, { orientation: "vertical" })
15
+ ]
16
+ });
17
+ }
18
+ function ScrollViewport({ className, children, ...props }) {
19
+ return /* @__PURE__ */ jsx(Primitive.Viewport, {
20
+ className: cn("size-full rounded-[inherit]", className),
21
+ ...props,
22
+ children
23
+ });
24
+ }
25
+ function ScrollBar({ className, orientation = "vertical", ...props }) {
26
+ return /* @__PURE__ */ jsx(Primitive.Scrollbar, {
27
+ orientation,
28
+ className: cn("flex select-none data-[state=hidden]:animate-fd-fade-out", orientation === "vertical" && "h-full w-1.5", orientation === "horizontal" && "h-1.5 flex-col", className),
29
+ ...props,
30
+ children: /* @__PURE__ */ jsx(Primitive.ScrollAreaThumb, { className: "relative flex-1 rounded-full bg-fd-border" })
31
+ });
32
+ }
33
+ //#endregion
34
+ export { ScrollArea, ScrollBar, ScrollViewport };
@@ -0,0 +1,23 @@
1
+ import { ComponentProps } from "react";
2
+ import * as Primitive from "@radix-ui/react-tabs";
3
+ //#region src/components/ui/tabs.d.ts
4
+ interface TabsProps extends ComponentProps<typeof Primitive.Tabs> {
5
+ /**
6
+ * Identifier for Sharing value of tabs
7
+ */
8
+ groupId?: string;
9
+ /**
10
+ * Enable persistent
11
+ */
12
+ persist?: boolean;
13
+ /**
14
+ * If true, updates the URL hash based on the tab's id
15
+ */
16
+ updateAnchor?: boolean;
17
+ }
18
+ declare const TabsList: import("react").ForwardRefExoticComponent<Primitive.TabsListProps & import("react").RefAttributes<HTMLDivElement>>;
19
+ declare const TabsTrigger: import("react").ForwardRefExoticComponent<Primitive.TabsTriggerProps & import("react").RefAttributes<HTMLButtonElement>>;
20
+ declare function Tabs({ ref, groupId, persist, updateAnchor, defaultValue, value: _value, onValueChange: _onValueChange, ...props }: TabsProps): import("react").JSX.Element;
21
+ declare function TabsContent({ value, ref, ...props }: ComponentProps<typeof Primitive.TabsContent>): import("react").JSX.Element;
22
+ //#endregion
23
+ export { Tabs, TabsContent, TabsList, TabsProps, TabsTrigger };
@@ -0,0 +1,102 @@
1
+ "use client";
2
+ import { mergeRefs } from "../../utils/merge-refs.js";
3
+ import { jsx } from "react/jsx-runtime";
4
+ import { createContext, use, useEffectEvent, useLayoutEffect, useMemo, useRef, useState } from "react";
5
+ import * as Primitive from "@radix-ui/react-tabs";
6
+ //#region src/components/ui/tabs.tsx
7
+ const listeners = /* @__PURE__ */ new Map();
8
+ const TabsContext = createContext(null);
9
+ function useTabContext() {
10
+ const ctx = use(TabsContext);
11
+ if (!ctx) throw new Error("You must wrap your component in <Tabs>");
12
+ return ctx;
13
+ }
14
+ const TabsList = Primitive.TabsList;
15
+ const TabsTrigger = Primitive.TabsTrigger;
16
+ function Tabs({ ref, groupId, persist = false, updateAnchor = false, defaultValue, value: _value, onValueChange: _onValueChange, ...props }) {
17
+ const tabsRef = useRef(null);
18
+ const valueToIdMap = useMemo(() => /* @__PURE__ */ new Map(), []);
19
+ const panels = useMemo(() => /* @__PURE__ */ new Map(), []);
20
+ const [value, setValue] = _value === void 0 ? useState(defaultValue) : [_value, useEffectEvent((v) => _onValueChange?.(v))];
21
+ useLayoutEffect(() => {
22
+ if (!groupId) return;
23
+ let previous = sessionStorage.getItem(groupId);
24
+ if (persist) previous ??= localStorage.getItem(groupId);
25
+ if (previous) setValue(previous);
26
+ const groupListeners = listeners.get(groupId) ?? /* @__PURE__ */ new Set();
27
+ groupListeners.add(setValue);
28
+ listeners.set(groupId, groupListeners);
29
+ return () => {
30
+ groupListeners.delete(setValue);
31
+ };
32
+ }, [
33
+ groupId,
34
+ persist,
35
+ setValue
36
+ ]);
37
+ useLayoutEffect(() => {
38
+ const openFromHash = () => {
39
+ const hash = window.location.hash.slice(1);
40
+ if (!hash) return;
41
+ for (const [value, id] of valueToIdMap.entries()) if (id === hash) {
42
+ setValue(value);
43
+ tabsRef.current?.scrollIntoView();
44
+ return;
45
+ }
46
+ const target = document.getElementById(hash);
47
+ if (!target) return;
48
+ for (const [value, panel] of panels.entries()) {
49
+ if (!panel.contains(target)) continue;
50
+ setValue(value);
51
+ requestAnimationFrame(() => target.scrollIntoView());
52
+ return;
53
+ }
54
+ };
55
+ openFromHash();
56
+ window.addEventListener("hashchange", openFromHash);
57
+ return () => window.removeEventListener("hashchange", openFromHash);
58
+ }, [
59
+ setValue,
60
+ valueToIdMap,
61
+ panels
62
+ ]);
63
+ return /* @__PURE__ */ jsx(Primitive.Tabs, {
64
+ ref: mergeRefs(ref, tabsRef),
65
+ value,
66
+ onValueChange: (v) => {
67
+ if (updateAnchor) {
68
+ const id = valueToIdMap.get(v);
69
+ if (id) window.history.replaceState(null, "", `#${id}`);
70
+ }
71
+ if (groupId) {
72
+ const groupListeners = listeners.get(groupId);
73
+ if (groupListeners) for (const listener of groupListeners) listener(v);
74
+ sessionStorage.setItem(groupId, v);
75
+ if (persist) localStorage.setItem(groupId, v);
76
+ } else setValue(v);
77
+ },
78
+ ...props,
79
+ children: /* @__PURE__ */ jsx(TabsContext, {
80
+ value: useMemo(() => ({
81
+ valueToIdMap,
82
+ panels
83
+ }), [valueToIdMap, panels]),
84
+ children: props.children
85
+ })
86
+ });
87
+ }
88
+ function TabsContent({ value, ref, ...props }) {
89
+ const { valueToIdMap, panels } = useTabContext();
90
+ if (props.id) valueToIdMap.set(value, props.id);
91
+ return /* @__PURE__ */ jsx(Primitive.TabsContent, {
92
+ ref: mergeRefs(ref, (element) => {
93
+ if (element) panels.set(value, element);
94
+ else panels.delete(value);
95
+ }),
96
+ value,
97
+ ...props,
98
+ children: props.children
99
+ });
100
+ }
101
+ //#endregion
102
+ export { Tabs, TabsContent, TabsList, TabsTrigger };
@@ -0,0 +1,34 @@
1
+ import { ReactNode } from "react";
2
+ //#region src/contexts/i18n.d.ts
3
+ interface LocaleItem {
4
+ name: string;
5
+ locale: string;
6
+ }
7
+ interface LocaleContextType {
8
+ locale?: string;
9
+ onChange?: (v: string) => void;
10
+ locales?: LocaleItem[];
11
+ }
12
+ declare function useI18n(): LocaleContextType;
13
+ interface I18nProviderProps {
14
+ /**
15
+ * Current locale
16
+ */
17
+ locale?: string;
18
+ /**
19
+ * Handle changes to the locale, redirect user when not specified.
20
+ */
21
+ onLocaleChange?: (v: string) => void;
22
+ /**
23
+ * Translations of current locale
24
+ */
25
+ translations?: Partial<Record<string, string>>;
26
+ /**
27
+ * Available languages
28
+ */
29
+ locales?: LocaleItem[];
30
+ children?: ReactNode;
31
+ }
32
+ declare function I18nProvider({ locales, locale, onLocaleChange, children, translations }: I18nProviderProps): import("react").JSX.Element;
33
+ //#endregion
34
+ export { I18nProvider, I18nProviderProps, useI18n };
@@ -0,0 +1,37 @@
1
+ "use client";
2
+ import { usePathname, useRouter } from "@vx-oss/docs-core/framework";
3
+ import { jsx } from "react/jsx-runtime";
4
+ import { createContext, use, useMemo, useRef } from "react";
5
+ import { TranslationProvider } from "@fuma-translate/react";
6
+ //#region src/contexts/i18n.tsx
7
+ const LocaleContext = createContext({});
8
+ function useI18n() {
9
+ return use(LocaleContext);
10
+ }
11
+ const Empty = {};
12
+ function I18nProvider({ locales = [], locale, onLocaleChange, children, translations = Empty }) {
13
+ const router = useRouter();
14
+ const pathname = usePathname();
15
+ const onChange = (value) => {
16
+ if (onLocaleChange) return onLocaleChange(value);
17
+ const segments = pathname.split("/").filter((v) => v.length > 0);
18
+ if (segments.length === 0 || segments[0] !== locale) segments.unshift(value);
19
+ else segments[0] = value;
20
+ router.push(`/${segments.join("/")}`);
21
+ };
22
+ const onChangeRef = useRef(onChange);
23
+ onChangeRef.current = onChange;
24
+ return /* @__PURE__ */ jsx(LocaleContext, {
25
+ value: useMemo(() => ({
26
+ locale,
27
+ locales,
28
+ onChange: (v) => onChangeRef.current(v)
29
+ }), [locale, locales]),
30
+ children: /* @__PURE__ */ jsx(TranslationProvider, {
31
+ translations,
32
+ children
33
+ })
34
+ });
35
+ }
36
+ //#endregion
37
+ export { I18nProvider, useI18n };