@vx-oss/docs-react 1.0.4 → 1.0.5

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 (255) hide show
  1. package/README.md +3 -3
  2. package/css/generated/docs.css +1 -1
  3. package/css/generated/flux.css +1 -1
  4. package/css/generated/glass.css +1 -1
  5. package/css/generated/home.css +1 -1
  6. package/css/generated/notebook.css +1 -1
  7. package/css/generated/shared.css +1 -1
  8. package/css/lib/base.css +0 -127
  9. package/css/preset.css +1 -2
  10. package/css/style.css +1 -0
  11. package/dist/components/accordion.js +1 -68
  12. package/dist/components/banner.js +1 -85
  13. package/dist/components/callout.js +1 -60
  14. package/dist/components/card.js +1 -39
  15. package/dist/components/codeblock.js +1 -126
  16. package/dist/components/codeblock.rsc.js +1 -22
  17. package/dist/components/dialog/search-algolia.js +2 -64
  18. package/dist/components/dialog/search-default.js +2 -66
  19. package/dist/components/dialog/search-orama.js +2 -69
  20. package/dist/components/dialog/search.js +1 -351
  21. package/dist/components/dynamic-codeblock.core.js +1 -51
  22. package/dist/components/dynamic-codeblock.js +1 -17
  23. package/dist/components/files.js +1 -40
  24. package/dist/components/github-info.js +1 -75
  25. package/dist/components/heading.js +1 -38
  26. package/dist/components/image-zoom.js +1 -32
  27. package/dist/components/inline-toc.js +1 -28
  28. package/dist/components/sidebar/base.js +1 -277
  29. package/dist/components/sidebar/link-item.js +1 -37
  30. package/dist/components/sidebar/page-tree.js +1 -69
  31. package/dist/components/sidebar/tabs/dropdown.js +1 -83
  32. package/dist/components/sidebar/tabs/index.js +1 -46
  33. package/dist/components/steps.js +1 -16
  34. package/dist/components/tabs.js +1 -95
  35. package/dist/components/toc/clerk.js +1 -227
  36. package/dist/components/toc/default.js +1 -260
  37. package/dist/components/toc/index.js +1 -45
  38. package/dist/components/type-table.js +1 -117
  39. package/dist/components/ui/accordion.js +1 -42
  40. package/dist/components/ui/button.js +1 -20
  41. package/dist/components/ui/collapsible.js +1 -21
  42. package/dist/components/ui/popover.js +1 -20
  43. package/dist/components/ui/scroll-area.js +1 -34
  44. package/dist/components/ui/tabs.js +1 -102
  45. package/dist/contexts/i18n.js +1 -37
  46. package/dist/contexts/search.js +1 -68
  47. package/dist/contexts/tree.js +1 -91
  48. package/dist/i18n.js +1 -38
  49. package/dist/index.js +1 -0
  50. package/dist/layouts/docs/index.js +1 -23
  51. package/dist/layouts/docs/page/index.js +1 -124
  52. package/dist/layouts/docs/page/slots/breadcrumb.js +1 -44
  53. package/dist/layouts/docs/page/slots/container.js +1 -22
  54. package/dist/layouts/docs/page/slots/footer.js +1 -56
  55. package/dist/layouts/docs/page/slots/toc.js +1 -182
  56. package/dist/layouts/docs/slots/container.js +1 -36
  57. package/dist/layouts/docs/slots/header.js +1 -38
  58. package/dist/layouts/docs/slots/sidebar.js +1 -268
  59. package/dist/layouts/flux/index.js +1 -146
  60. package/dist/layouts/flux/page/index.js +1 -104
  61. package/dist/layouts/flux/page/slots/breadcrumb.js +1 -44
  62. package/dist/layouts/flux/page/slots/container.js +1 -22
  63. package/dist/layouts/flux/page/slots/footer.js +1 -56
  64. package/dist/layouts/flux/page/slots/toc.js +1 -181
  65. package/dist/layouts/flux/slots/container.js +1 -13
  66. package/dist/layouts/flux/slots/sidebar.js +1 -243
  67. package/dist/layouts/flux/slots/tab-dropdown.js +1 -88
  68. package/dist/layouts/glass/index.js +1 -70
  69. package/dist/layouts/glass/page/index.js +1 -92
  70. package/dist/layouts/glass/page/slots/breadcrumb.js +1 -44
  71. package/dist/layouts/glass/page/slots/footer.js +1 -56
  72. package/dist/layouts/glass/page/slots/toc.js +1 -108
  73. package/dist/layouts/glass/slots/header.js +1 -68
  74. package/dist/layouts/glass/slots/sidebar.js +1 -267
  75. package/dist/layouts/home/index.js +1 -40
  76. package/dist/layouts/home/navbar.js +1 -34
  77. package/dist/layouts/home/not-found.js +1 -41
  78. package/dist/layouts/home/slots/container.js +1 -13
  79. package/dist/layouts/home/slots/header.js +1 -239
  80. package/dist/layouts/notebook/index.js +1 -23
  81. package/dist/layouts/notebook/page/index.js +1 -124
  82. package/dist/layouts/notebook/page/slots/breadcrumb.js +1 -44
  83. package/dist/layouts/notebook/page/slots/container.js +1 -22
  84. package/dist/layouts/notebook/page/slots/footer.js +1 -56
  85. package/dist/layouts/notebook/page/slots/toc.js +1 -181
  86. package/dist/layouts/notebook/slots/container.js +1 -38
  87. package/dist/layouts/notebook/slots/header.js +1 -204
  88. package/dist/layouts/notebook/slots/sidebar.js +1 -240
  89. package/dist/layouts/shared/index.js +1 -98
  90. package/dist/layouts/shared/slots/language-select.js +1 -43
  91. package/dist/layouts/shared/slots/search-trigger.js +1 -53
  92. package/dist/layouts/shared/slots/theme-switch.js +1 -70
  93. package/dist/mdx.d.ts +2 -44
  94. package/dist/mdx.js +2 -70
  95. package/dist/mdx.server.js +2 -20
  96. package/dist/og/takumi.js +1 -91
  97. package/dist/og.js +1 -91
  98. package/dist/page.js +1 -33
  99. package/dist/primitives/accordion.js +1 -0
  100. package/dist/primitives/collapsible.js +1 -0
  101. package/dist/primitives/dialog.js +1 -0
  102. package/dist/primitives/direction-provider.js +1 -0
  103. package/dist/primitives/drawer.js +1 -0
  104. package/dist/primitives/navigation-menu.js +1 -0
  105. package/dist/primitives/popover.js +1 -0
  106. package/dist/primitives/scroll-area.js +1 -0
  107. package/dist/primitives/shared.js +1 -0
  108. package/dist/primitives/tabs.js +1 -0
  109. package/dist/provider/astro.js +1 -20
  110. package/dist/provider/base.js +1 -73
  111. package/dist/provider/next.js +1 -17
  112. package/dist/provider/react-router.js +1 -17
  113. package/dist/provider/tanstack.js +1 -17
  114. package/dist/provider/waku.js +1 -17
  115. package/dist/style.css +11577 -310
  116. package/dist/utils/use-copy-button.js +1 -26
  117. package/dist/utils/use-footer-items.js +1 -24
  118. package/dist/utils/use-is-scroll-top.js +1 -20
  119. package/package.json +28 -66
  120. package/css/preset-legacy.css +0 -43
  121. package/dist/.translations/index.d.ts +0 -55
  122. package/dist/.translations/keys.js +0 -55
  123. package/dist/_virtual/_rolldown/runtime.js +0 -13
  124. package/dist/components/accordion.d.ts +0 -10
  125. package/dist/components/banner.d.ts +0 -25
  126. package/dist/components/callout.d.ts +0 -21
  127. package/dist/components/card.d.ts +0 -13
  128. package/dist/components/codeblock.d.ts +0 -45
  129. package/dist/components/codeblock.rsc.d.ts +0 -15
  130. package/dist/components/dialog/search-algolia.d.ts +0 -27
  131. package/dist/components/dialog/search-default.d.ts +0 -29
  132. package/dist/components/dialog/search-orama.d.ts +0 -32
  133. package/dist/components/dialog/search.d.ts +0 -76
  134. package/dist/components/dynamic-codeblock.core.d.ts +0 -26
  135. package/dist/components/dynamic-codeblock.d.ts +0 -8
  136. package/dist/components/files.d.ts +0 -21
  137. package/dist/components/github-info.d.ts +0 -20
  138. package/dist/components/heading.d.ts +0 -9
  139. package/dist/components/image-zoom.d.ts +0 -18
  140. package/dist/components/inline-toc.d.ts +0 -10
  141. package/dist/components/sidebar/base.d.ts +0 -85
  142. package/dist/components/sidebar/link-item.d.ts +0 -12
  143. package/dist/components/sidebar/page-tree.d.ts +0 -20
  144. package/dist/components/sidebar/tabs/dropdown.d.ts +0 -15
  145. package/dist/components/sidebar/tabs/index.d.ts +0 -8
  146. package/dist/components/steps.d.ts +0 -10
  147. package/dist/components/tabs.d.ts +0 -33
  148. package/dist/components/toc/clerk.d.ts +0 -11
  149. package/dist/components/toc/default.d.ts +0 -13
  150. package/dist/components/toc/index.d.ts +0 -10
  151. package/dist/components/type-table.d.ts +0 -37
  152. package/dist/components/ui/accordion.d.ts +0 -10
  153. package/dist/components/ui/button.d.ts +0 -10
  154. package/dist/components/ui/collapsible.d.ts +0 -11
  155. package/dist/components/ui/navigation-menu.d.ts +0 -14
  156. package/dist/components/ui/navigation-menu.js +0 -41
  157. package/dist/components/ui/popover.d.ts +0 -9
  158. package/dist/components/ui/scroll-area.d.ts +0 -9
  159. package/dist/components/ui/tabs.d.ts +0 -23
  160. package/dist/contexts/i18n.d.ts +0 -34
  161. package/dist/contexts/search.d.ts +0 -64
  162. package/dist/contexts/tree.d.ts +0 -29
  163. package/dist/i18n.d.ts +0 -15
  164. package/dist/layouts/docs/client.d.ts +0 -33
  165. package/dist/layouts/docs/client.js +0 -94
  166. package/dist/layouts/docs/index.d.ts +0 -32
  167. package/dist/layouts/docs/page/index.d.ts +0 -76
  168. package/dist/layouts/docs/page/slots/breadcrumb.d.ts +0 -7
  169. package/dist/layouts/docs/page/slots/container.d.ts +0 -5
  170. package/dist/layouts/docs/page/slots/footer.d.ts +0 -16
  171. package/dist/layouts/docs/page/slots/toc.d.ts +0 -47
  172. package/dist/layouts/docs/slots/container.d.ts +0 -5
  173. package/dist/layouts/docs/slots/header.d.ts +0 -5
  174. package/dist/layouts/docs/slots/sidebar.d.ts +0 -22
  175. package/dist/layouts/flux/index.d.ts +0 -61
  176. package/dist/layouts/flux/page/index.d.ts +0 -67
  177. package/dist/layouts/flux/page/slots/breadcrumb.d.ts +0 -7
  178. package/dist/layouts/flux/page/slots/container.d.ts +0 -5
  179. package/dist/layouts/flux/page/slots/footer.d.ts +0 -16
  180. package/dist/layouts/flux/page/slots/toc.d.ts +0 -29
  181. package/dist/layouts/flux/slots/container.d.ts +0 -5
  182. package/dist/layouts/flux/slots/sidebar.d.ts +0 -16
  183. package/dist/layouts/flux/slots/tab-dropdown.d.ts +0 -10
  184. package/dist/layouts/glass/index.d.ts +0 -39
  185. package/dist/layouts/glass/layout-tabs.js +0 -54
  186. package/dist/layouts/glass/page/index.d.ts +0 -31
  187. package/dist/layouts/glass/page/slots/breadcrumb.d.ts +0 -7
  188. package/dist/layouts/glass/page/slots/footer.d.ts +0 -16
  189. package/dist/layouts/glass/page/slots/toc.d.ts +0 -19
  190. package/dist/layouts/glass/slots/header.d.ts +0 -6
  191. package/dist/layouts/glass/slots/sidebar.d.ts +0 -21
  192. package/dist/layouts/home/index.d.ts +0 -27
  193. package/dist/layouts/home/navbar.d.ts +0 -9
  194. package/dist/layouts/home/not-found.d.ts +0 -7
  195. package/dist/layouts/home/slots/container.d.ts +0 -5
  196. package/dist/layouts/home/slots/header.d.ts +0 -8
  197. package/dist/layouts/notebook/client.d.ts +0 -35
  198. package/dist/layouts/notebook/client.js +0 -69
  199. package/dist/layouts/notebook/index.d.ts +0 -26
  200. package/dist/layouts/notebook/page/index.d.ts +0 -76
  201. package/dist/layouts/notebook/page/slots/breadcrumb.d.ts +0 -7
  202. package/dist/layouts/notebook/page/slots/container.d.ts +0 -5
  203. package/dist/layouts/notebook/page/slots/footer.d.ts +0 -16
  204. package/dist/layouts/notebook/page/slots/toc.d.ts +0 -47
  205. package/dist/layouts/notebook/slots/container.d.ts +0 -5
  206. package/dist/layouts/notebook/slots/header.d.ts +0 -5
  207. package/dist/layouts/notebook/slots/sidebar.d.ts +0 -23
  208. package/dist/layouts/shared/client.d.ts +0 -37
  209. package/dist/layouts/shared/client.js +0 -85
  210. package/dist/layouts/shared/index.d.ts +0 -169
  211. package/dist/layouts/shared/page-actions.d.ts +0 -27
  212. package/dist/layouts/shared/page-actions.js +0 -199
  213. package/dist/layouts/shared/slots/language-select.d.ts +0 -12
  214. package/dist/layouts/shared/slots/search-trigger.d.ts +0 -13
  215. package/dist/layouts/shared/slots/theme-switch.d.ts +0 -8
  216. package/dist/legacy/layout.d.ts +0 -29
  217. package/dist/legacy/layout.js +0 -44
  218. package/dist/legacy/sidebar.d.ts +0 -14
  219. package/dist/legacy/sidebar.js +0 -34
  220. package/dist/mdx.server.d.ts +0 -14
  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/controlled.d.ts +0 -30
  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/controlled.js +0 -461
  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/index.d.ts +0 -3
  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/uncontrolled.d.ts +0 -6
  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/uncontrolled.js +0 -17
  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/adjust-svg-ids.js +0 -53
  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/compute-positioned-style.js +0 -25
  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/element-tests.js +0 -12
  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-div-img-style.js +0 -45
  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/get-img-alt.js +0 -10
  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/get-img-object-fit-style.js +0 -57
  232. 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 +0 -21
  233. 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 +0 -14
  234. 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 +0 -22
  235. 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 +0 -27
  236. 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 +0 -31
  237. 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 +0 -75
  238. 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 +0 -4
  239. 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 +0 -7
  240. 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 +0 -5
  241. package/dist/og/takumi.d.ts +0 -15
  242. package/dist/og.d.ts +0 -16
  243. package/dist/page.d.ts +0 -29
  244. package/dist/provider/astro.d.ts +0 -29
  245. package/dist/provider/base.d.ts +0 -48
  246. package/dist/provider/next.d.ts +0 -16
  247. package/dist/provider/react-router.d.ts +0 -16
  248. package/dist/provider/tanstack.d.ts +0 -16
  249. package/dist/provider/waku.d.ts +0 -16
  250. package/dist/utils/cn.js +0 -2
  251. package/dist/utils/merge-refs.js +0 -11
  252. package/dist/utils/urls.js +0 -15
  253. package/dist/utils/use-copy-button.d.ts +0 -5
  254. package/dist/utils/use-footer-items.d.ts +0 -8
  255. package/dist/utils/use-is-scroll-top.d.ts +0 -6
@@ -1,351 +1 @@
1
- "use client";
2
- import { cn } from "../../utils/cn.js";
3
- import { buttonVariants } from "../ui/button.js";
4
- import { useRouter } from "@vx-oss/docs-core/framework";
5
- import { Fragment, jsx, jsxs } from "react/jsx-runtime";
6
- import { ChevronRight, Hash, SearchIcon } from "lucide-react";
7
- import { cva } from "class-variance-authority";
8
- import { Fragment as Fragment$1, createContext, use, useCallback, useEffect, useEffectEvent, useMemo, useRef, useState } from "react";
9
- import { T, useTranslations } from "@fuma-translate/react";
10
- import { useOnChange } from "@vx-oss/docs-core/utils/use-on-change";
11
- import scrollIntoView from "scroll-into-view-if-needed";
12
- import { Dialog, DialogContent, DialogOverlay, DialogTitle } from "@radix-ui/react-dialog";
13
- import { createMarkdownRenderer } from "@vx-oss/docs-core/content/md";
14
- import rehypeRaw from "rehype-raw";
15
- import { visit } from "unist-util-visit";
16
- //#region src/components/dialog/search.tsx
17
- const RootContext = createContext(null);
18
- const ListContext = createContext(null);
19
- const TagsListContext = createContext(null);
20
- const PreContext = createContext(false);
21
- const mdRenderer = createMarkdownRenderer({
22
- remarkRehypeOptions: { allowDangerousHtml: true },
23
- rehypePlugins: [rehypeRaw, rehypeCustomElements]
24
- });
25
- const mdComponents = {
26
- mark(props) {
27
- return /* @__PURE__ */ jsx("span", {
28
- ...props,
29
- className: "text-fd-primary underline"
30
- });
31
- },
32
- a: "span",
33
- p(props) {
34
- return /* @__PURE__ */ jsx("p", {
35
- ...props,
36
- className: "min-w-0"
37
- });
38
- },
39
- strong(props) {
40
- return /* @__PURE__ */ jsx("strong", {
41
- ...props,
42
- className: "text-fd-accent-foreground font-medium"
43
- });
44
- },
45
- code(props) {
46
- if (use(PreContext)) return /* @__PURE__ */ jsx("code", {
47
- ...props,
48
- className: "mask-[linear-gradient(to_bottom,white,white_30px,transparent_80px)]"
49
- });
50
- return /* @__PURE__ */ jsx("code", {
51
- ...props,
52
- className: "border rounded-md px-px bg-fd-secondary text-fd-secondary-foreground"
53
- });
54
- },
55
- custom({ _tagName = "fragment", children, ...rest }) {
56
- return /* @__PURE__ */ jsxs("span", {
57
- className: "inline-flex max-w-full items-center border p-0.5 rounded-md bg-fd-card text-fd-card-foreground divide-x divide-fd-border",
58
- children: [
59
- /* @__PURE__ */ jsx("code", {
60
- className: "rounded-sm px-0.5 me-1 bg-fd-primary font-medium text-xs text-fd-primary-foreground border-none",
61
- children: _tagName
62
- }),
63
- Object.entries(rest).map(([k, v]) => {
64
- if (typeof v !== "string") return;
65
- return /* @__PURE__ */ jsxs("code", {
66
- className: "truncate text-xs text-fd-muted-foreground px-1",
67
- children: [/* @__PURE__ */ jsxs("span", {
68
- className: "text-fd-card-foreground",
69
- children: [k, ": "]
70
- }), v]
71
- }, k);
72
- }),
73
- children && /* @__PURE__ */ jsx("span", {
74
- className: "ps-1",
75
- children
76
- })
77
- ]
78
- });
79
- },
80
- pre(props) {
81
- return /* @__PURE__ */ jsx("pre", {
82
- ...props,
83
- className: cn("flex flex-col border rounded-md my-0.5 p-2 bg-fd-secondary text-fd-secondary-foreground max-h-20 overflow-hidden", props.className),
84
- children: /* @__PURE__ */ jsx(PreContext, {
85
- value: true,
86
- children: props.children
87
- })
88
- });
89
- }
90
- };
91
- function rehypeCustomElements() {
92
- return (tree) => {
93
- visit(tree, (node) => {
94
- if (node.type === "element" && document.createElement(node.tagName) instanceof HTMLUnknownElement) {
95
- node.properties._tagName = node.tagName;
96
- node.tagName = "custom";
97
- }
98
- });
99
- };
100
- }
101
- function SearchDialog({ open, onOpenChange, search, onSearchChange, isLoading = false, onSelect: onSelectProp, children }) {
102
- const router = useRouter();
103
- const onOpenChangeCallback = useRef(onOpenChange);
104
- onOpenChangeCallback.current = onOpenChange;
105
- const onSearchChangeCallback = useRef(onSearchChange);
106
- onSearchChangeCallback.current = onSearchChange;
107
- const onSelect = (item) => {
108
- if (item.type === "action") item.onSelect();
109
- else if (item.external) window.open(item.url, "_blank")?.focus();
110
- else router.push(item.url);
111
- onOpenChange(false);
112
- onSelectProp?.(item);
113
- };
114
- const onSelectCallback = useRef(onSelect);
115
- onSelectCallback.current = onSelect;
116
- return /* @__PURE__ */ jsx(Dialog, {
117
- open,
118
- onOpenChange,
119
- children: /* @__PURE__ */ jsx(RootContext, {
120
- value: useMemo(() => ({
121
- open,
122
- search,
123
- isLoading,
124
- onOpenChange: (v) => onOpenChangeCallback.current(v),
125
- onSearchChange: (v) => onSearchChangeCallback.current(v),
126
- onSelect: (v) => onSelectCallback.current(v)
127
- }), [
128
- isLoading,
129
- open,
130
- search
131
- ]),
132
- children
133
- })
134
- });
135
- }
136
- function SearchDialogHeader(props) {
137
- return /* @__PURE__ */ jsx("div", {
138
- ...props,
139
- className: cn("flex flex-row items-center gap-2 p-3", props.className)
140
- });
141
- }
142
- function SearchDialogInput(props) {
143
- const t = useTranslations({ note: "search dialog" });
144
- const { search, onSearchChange } = useSearch();
145
- return /* @__PURE__ */ jsx("input", {
146
- ...props,
147
- value: search,
148
- onChange: (e) => onSearchChange(e.target.value),
149
- placeholder: t("Search"),
150
- className: "w-0 flex-1 bg-transparent text-lg placeholder:text-fd-muted-foreground focus-visible:outline-none"
151
- });
152
- }
153
- function SearchDialogClose({ children = "ESC", className, ...props }) {
154
- const { onOpenChange } = useSearch();
155
- const t = useTranslations({ note: "search dialog" });
156
- return /* @__PURE__ */ jsx("button", {
157
- type: "button",
158
- "aria-label": t("Close Search", { note: "aria-label" }),
159
- onClick: () => onOpenChange(false),
160
- className: cn(buttonVariants({
161
- color: "outline",
162
- size: "sm",
163
- className: "font-mono text-fd-muted-foreground"
164
- }), className),
165
- ...props,
166
- children
167
- });
168
- }
169
- function SearchDialogFooter(props) {
170
- return /* @__PURE__ */ jsx("div", {
171
- ...props,
172
- className: cn("bg-fd-secondary/50 p-3 empty:hidden", props.className)
173
- });
174
- }
175
- function SearchDialogOverlay(props) {
176
- return /* @__PURE__ */ jsx(DialogOverlay, {
177
- ...props,
178
- className: cn("fixed inset-0 z-50 backdrop-blur-xs bg-fd-overlay data-[state=open]:animate-fd-fade-in data-[state=closed]:animate-fd-fade-out", props.className)
179
- });
180
- }
181
- function SearchDialogContent({ children, ...props }) {
182
- const t = useTranslations({ note: "search dialog" });
183
- return /* @__PURE__ */ jsxs(DialogContent, {
184
- "aria-describedby": void 0,
185
- ...props,
186
- className: cn("fixed left-1/2 top-4 md:top-[calc(50%-250px)] z-50 w-[calc(100%-1rem)] max-w-screen-sm -translate-x-1/2 rounded-xl border bg-fd-popover text-fd-popover-foreground shadow-2xl shadow-black/50 overflow-hidden data-[state=closed]:animate-fd-dialog-out data-[state=open]:animate-fd-dialog-in", "*:border-b *:has-[+:last-child[data-empty=true]]:border-b-0 *:data-[empty=true]:border-b-0 *:last:border-b-0", props.className),
187
- children: [/* @__PURE__ */ jsx(DialogTitle, {
188
- className: "hidden",
189
- children: t("Search")
190
- }), children]
191
- });
192
- }
193
- function SearchDialogList({ items = null, Empty = () => /* @__PURE__ */ jsx("div", {
194
- className: "py-12 text-center text-sm text-fd-muted-foreground",
195
- children: /* @__PURE__ */ jsx(T, {
196
- text: "No results found",
197
- note: "search dialog"
198
- })
199
- }), Item = (props) => /* @__PURE__ */ jsx(SearchDialogListItem, { ...props }), ...props }) {
200
- const ref = useRef(null);
201
- const { onSelect } = useSearch();
202
- const [active, setActive] = useState(() => items && items.length > 0 ? items[0].id : null);
203
- const onKey = useEffectEvent((e) => {
204
- if (!items || e.isComposing || e.keyCode === 229) return;
205
- if (e.key === "ArrowDown" || e.key == "ArrowUp") {
206
- let idx = items.findIndex((item) => item.id === active);
207
- if (idx === -1) idx = 0;
208
- else if (e.key === "ArrowDown") idx++;
209
- else idx--;
210
- setActive(items.at(idx % items.length)?.id ?? null);
211
- e.preventDefault();
212
- }
213
- if (e.key === "Enter") {
214
- const selected = items.find((item) => item.id === active);
215
- if (selected) onSelect(selected);
216
- e.preventDefault();
217
- }
218
- });
219
- useEffect(() => {
220
- const element = ref.current;
221
- if (!element) return;
222
- const observer = new ResizeObserver(() => {
223
- const viewport = element.firstElementChild;
224
- element.style.setProperty("--fd-animated-height", `${viewport.clientHeight}px`);
225
- });
226
- const viewport = element.firstElementChild;
227
- if (viewport) observer.observe(viewport);
228
- window.addEventListener("keydown", onKey);
229
- return () => {
230
- observer.disconnect();
231
- window.removeEventListener("keydown", onKey);
232
- };
233
- }, []);
234
- useOnChange(items, () => {
235
- if (items && items.length > 0) setActive(items[0].id);
236
- });
237
- return /* @__PURE__ */ jsx("div", {
238
- ...props,
239
- ref,
240
- "data-empty": items === null,
241
- className: cn("overflow-hidden h-(--fd-animated-height) transition-[height]", props.className),
242
- children: /* @__PURE__ */ jsx("div", {
243
- className: cn("w-full flex flex-col overflow-y-auto max-h-[460px] p-1", !items && "hidden"),
244
- children: /* @__PURE__ */ jsxs(ListContext, {
245
- value: useMemo(() => ({
246
- active,
247
- setActive
248
- }), [active]),
249
- children: [items?.length === 0 && Empty(), items?.map((item) => /* @__PURE__ */ jsx(Fragment$1, { children: Item({
250
- item,
251
- onClick: () => onSelect(item)
252
- }) }, item.id))]
253
- })
254
- })
255
- });
256
- }
257
- function SearchDialogListItem({ item, className, children, renderMarkdown = (s) => /* @__PURE__ */ jsx(mdRenderer.Markdown, {
258
- components: mdComponents,
259
- children: s
260
- }), renderHighlights: _, ...props }) {
261
- const { active: activeId, setActive } = useSearchList();
262
- const active = item.id === activeId;
263
- if (item.type === "action") children ??= item.node;
264
- else children ??= /* @__PURE__ */ jsxs(Fragment, { children: [
265
- /* @__PURE__ */ jsx("div", {
266
- className: "inline-flex items-center text-fd-muted-foreground text-xs empty:hidden",
267
- children: item.breadcrumbs?.map((item, i) => /* @__PURE__ */ jsxs(Fragment$1, { children: [i > 0 && /* @__PURE__ */ jsx(ChevronRight, { className: "size-4 rtl:rotate-180" }), item] }, i))
268
- }),
269
- item.type !== "page" && /* @__PURE__ */ jsx("div", {
270
- role: "none",
271
- className: "absolute inset-s-3 inset-y-0 w-px bg-fd-border"
272
- }),
273
- item.type === "heading" && /* @__PURE__ */ jsx(Hash, { className: "absolute inset-s-6 top-2.5 size-4 text-fd-muted-foreground" }),
274
- /* @__PURE__ */ jsx("div", {
275
- className: cn("min-w-0", item.type === "text" && "ps-4", item.type === "heading" && "ps-8", item.type === "page" || item.type === "heading" ? "font-medium" : "text-fd-popover-foreground/80"),
276
- children: typeof item.content === "string" ? renderMarkdown(item.content) : item.content
277
- })
278
- ] });
279
- return /* @__PURE__ */ jsx("button", {
280
- type: "button",
281
- ref: useCallback((element) => {
282
- if (active && element) scrollIntoView(element, {
283
- scrollMode: "if-needed",
284
- block: "nearest",
285
- boundary: element.parentElement
286
- });
287
- }, [active]),
288
- "aria-selected": active,
289
- className: cn("relative select-none shrink-0 px-2.5 py-2 text-start text-sm overflow-hidden rounded-lg", active && "bg-fd-accent text-fd-accent-foreground", className),
290
- onPointerMove: () => setActive(item.id),
291
- ...props,
292
- children
293
- });
294
- }
295
- function SearchDialogIcon(props) {
296
- const { isLoading } = useSearch();
297
- return /* @__PURE__ */ jsx(SearchIcon, {
298
- ...props,
299
- className: cn("size-5 text-fd-muted-foreground", isLoading && "animate-pulse duration-400", props.className)
300
- });
301
- }
302
- const itemVariants = cva("rounded-md border px-2 py-0.5 text-xs font-medium text-fd-muted-foreground transition-colors", { variants: { active: { true: "bg-fd-accent text-fd-accent-foreground" } } });
303
- function TagsList({ tag, onTagChange, allowClear = false, ...props }) {
304
- const onTagChangeCallback = useRef(onTagChange);
305
- onTagChangeCallback.current = onTagChange;
306
- return /* @__PURE__ */ jsx("div", {
307
- ...props,
308
- className: cn("flex items-center gap-1 flex-wrap", props.className),
309
- children: /* @__PURE__ */ jsx(TagsListContext, {
310
- value: useMemo(() => ({
311
- value: tag,
312
- onValueChange: (v) => onTagChangeCallback.current(v),
313
- allowClear
314
- }), [allowClear, tag]),
315
- children: props.children
316
- })
317
- });
318
- }
319
- function TagsListItem({ value, className, ...props }) {
320
- const { onValueChange, value: selectedValue, allowClear } = useTagsList();
321
- const selected = value === selectedValue;
322
- return /* @__PURE__ */ jsx("button", {
323
- type: "button",
324
- "data-active": selected,
325
- className: cn(itemVariants({
326
- active: selected,
327
- className
328
- })),
329
- onClick: () => onValueChange(selected && allowClear ? void 0 : value),
330
- tabIndex: -1,
331
- ...props,
332
- children: props.children
333
- });
334
- }
335
- function useSearch() {
336
- const ctx = use(RootContext);
337
- if (!ctx) throw new Error("Missing <SearchDialog />");
338
- return ctx;
339
- }
340
- function useTagsList() {
341
- const ctx = use(TagsListContext);
342
- if (!ctx) throw new Error("Missing <TagsList />");
343
- return ctx;
344
- }
345
- function useSearchList() {
346
- const ctx = use(ListContext);
347
- if (!ctx) throw new Error("Missing <SearchDialogList />");
348
- return ctx;
349
- }
350
- //#endregion
351
- export { SearchDialog, SearchDialogClose, SearchDialogContent, SearchDialogFooter, SearchDialogHeader, SearchDialogIcon, SearchDialogInput, SearchDialogList, SearchDialogListItem, SearchDialogOverlay, TagsList, TagsListItem, useSearch, useSearchList, useTagsList };
1
+ export * from '@vx-oss/docs-vezham-ui/components/dialog/search';
@@ -1,51 +1 @@
1
- "use client";
2
- import { cn } from "../utils/cn.js";
3
- import { CodeBlock, Pre } from "./codeblock.js";
4
- import { jsx } from "react/jsx-runtime";
5
- import { createContext, use, useId } from "react";
6
- import { useShikiDynamic } from "@vx-oss/docs-core/highlight/shiki/react";
7
- //#region src/components/dynamic-codeblock.core.tsx
8
- const PropsContext = createContext(void 0);
9
- function DefaultPre(props) {
10
- const extraProps = use(PropsContext);
11
- return /* @__PURE__ */ jsx(CodeBlock, {
12
- ...props,
13
- ...extraProps,
14
- className: cn("my-0", props.className, extraProps?.className),
15
- children: /* @__PURE__ */ jsx(Pre, { children: props.children })
16
- });
17
- }
18
- function DynamicCodeBlock({ lang, code, codeblock, options, wrapInSuspense = true, highlighter }) {
19
- const id = useId();
20
- const shikiOptions = {
21
- lang,
22
- defaultColor: false,
23
- ...options,
24
- components: {
25
- pre: DefaultPre,
26
- ...options?.components
27
- }
28
- };
29
- let node = useShikiDynamic(highlighter, code, shikiOptions, [
30
- id,
31
- lang,
32
- code
33
- ]);
34
- if (wrapInSuspense) node ??= /* @__PURE__ */ jsx(Placeholder, {
35
- code,
36
- components: shikiOptions.components
37
- });
38
- return /* @__PURE__ */ jsx(PropsContext, {
39
- value: codeblock,
40
- children: node
41
- });
42
- }
43
- function Placeholder({ code, components = {} }) {
44
- const { pre: Pre = "pre", code: Code = "code" } = components;
45
- return /* @__PURE__ */ jsx(Pre, { children: /* @__PURE__ */ jsx(Code, { children: code.split("\n").map((line, i) => /* @__PURE__ */ jsx("span", {
46
- className: "line",
47
- children: line
48
- }, i)) }) });
49
- }
50
- //#endregion
51
- export { DynamicCodeBlock };
1
+ export * from '@vx-oss/docs-vezham-ui/components/dynamic-codeblock.core';
@@ -1,17 +1 @@
1
- "use client";
2
- import { DynamicCodeBlock as DynamicCodeBlock$1 } from "./dynamic-codeblock.core.js";
3
- import { jsx } from "react/jsx-runtime";
4
- import { defaultShikiFactory } from "@vx-oss/docs-core/highlight/shiki/full";
5
- //#region src/components/dynamic-codeblock.tsx
6
- function DynamicCodeBlock(props) {
7
- return /* @__PURE__ */ jsx(DynamicCodeBlock$1, {
8
- highlighter: () => defaultShikiFactory.getOrInit(),
9
- options: { themes: {
10
- light: "github-light",
11
- dark: "github-dark"
12
- } },
13
- ...props
14
- });
15
- }
16
- //#endregion
17
- export { DynamicCodeBlock };
1
+ export * from '@vx-oss/docs-vezham-ui/components/dynamic-codeblock';
@@ -1,40 +1 @@
1
- "use client";
2
- import { cn } from "../utils/cn.js";
3
- import { Collapsible, CollapsibleContent, CollapsibleTrigger } from "./ui/collapsible.js";
4
- import { jsx, jsxs } from "react/jsx-runtime";
5
- import { FileIcon, FolderIcon, FolderOpen } from "lucide-react";
6
- import { cva } from "class-variance-authority";
7
- import { useState } from "react";
8
- //#region src/components/files.tsx
9
- const itemVariants = cva("flex flex-row items-center gap-2 rounded-md px-2 py-1.5 text-sm hover:bg-fd-accent hover:text-fd-accent-foreground [&_svg]:size-4");
10
- function Files({ className, ...props }) {
11
- return /* @__PURE__ */ jsx("div", {
12
- className: cn("not-prose rounded-md border bg-fd-card p-2", className),
13
- ...props,
14
- children: props.children
15
- });
16
- }
17
- function File({ name, icon = /* @__PURE__ */ jsx(FileIcon, {}), className, ...rest }) {
18
- return /* @__PURE__ */ jsxs("div", {
19
- className: cn(itemVariants({ className })),
20
- ...rest,
21
- children: [icon, name]
22
- });
23
- }
24
- function Folder({ name, defaultOpen = false, ...props }) {
25
- const [open, setOpen] = useState(defaultOpen);
26
- return /* @__PURE__ */ jsxs(Collapsible, {
27
- open,
28
- onOpenChange: setOpen,
29
- ...props,
30
- children: [/* @__PURE__ */ jsxs(CollapsibleTrigger, {
31
- className: cn(itemVariants({ className: "w-full" })),
32
- children: [open ? /* @__PURE__ */ jsx(FolderOpen, {}) : /* @__PURE__ */ jsx(FolderIcon, {}), name]
33
- }), /* @__PURE__ */ jsx(CollapsibleContent, { children: /* @__PURE__ */ jsx("div", {
34
- className: "ms-2 flex flex-col border-l ps-2",
35
- children: props.children
36
- }) })]
37
- });
38
- }
39
- //#endregion
40
- export { File, Files, Folder };
1
+ export * from '@vx-oss/docs-vezham-ui/components/files';
@@ -1,75 +1 @@
1
- import { cn } from "../utils/cn.js";
2
- import { jsx, jsxs } from "react/jsx-runtime";
3
- import { GitFork, Star } from "lucide-react";
4
- import { use } from "react";
5
- //#region src/components/github-info.tsx
6
- async function fetchRepositoryInfo({ owner, repo, token, baseUrl = "https://api.github.com", fetchOptions = { next: { revalidate: 60 } } }) {
7
- const endpoint = `${baseUrl}/repos/${owner}/${repo}`;
8
- const headers = new Headers(fetchOptions.headers);
9
- headers.set("Content-Type", "application/json");
10
- if (token) headers.set("Authorization", `Bearer ${token}`);
11
- const response = await fetch(endpoint, {
12
- ...fetchOptions,
13
- headers
14
- });
15
- if (!response.ok) {
16
- const message = await response.text();
17
- throw new Error(`Failed to fetch repository data: ${message}`);
18
- }
19
- const data = await response.json();
20
- return {
21
- stars: data.stargazers_count,
22
- forks: data.forks_count
23
- };
24
- }
25
- /**
26
- * Uses compact notation (e.g., 1.5K, 2.3M).
27
- */
28
- const formatterOptions = {
29
- notation: "compact",
30
- maximumFractionDigits: 1
31
- };
32
- const defaultFormatter = new Intl.NumberFormat(void 0, formatterOptions);
33
- const promises = {};
34
- function GithubInfo({ repo, owner, token, baseUrl, fetchOptions, locale, ...props }) {
35
- const options = {
36
- repo,
37
- owner,
38
- token,
39
- baseUrl,
40
- fetchOptions
41
- };
42
- const { stars, forks } = use(promises[JSON.stringify(options)] ??= fetchRepositoryInfo(options));
43
- const formatter = locale ? new Intl.NumberFormat(locale, formatterOptions) : defaultFormatter;
44
- return /* @__PURE__ */ jsxs("a", {
45
- href: `https://github.com/${owner}/${repo}`,
46
- rel: "noreferrer noopener",
47
- target: "_blank",
48
- ...props,
49
- className: cn("flex flex-col gap-1.5 p-2 rounded-lg text-sm text-fd-foreground/80 transition-colors hover:text-fd-accent-foreground hover:bg-fd-accent", props.className),
50
- children: [/* @__PURE__ */ jsxs("p", {
51
- className: "flex items-center gap-2 truncate",
52
- children: [
53
- /* @__PURE__ */ jsxs("svg", {
54
- fill: "currentColor",
55
- viewBox: "0 0 24 24",
56
- className: "size-3.5",
57
- children: [/* @__PURE__ */ jsx("title", { children: "GitHub" }), /* @__PURE__ */ jsx("path", { d: "M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12" })]
58
- }),
59
- owner,
60
- "/",
61
- repo
62
- ]
63
- }), /* @__PURE__ */ jsxs("div", {
64
- className: "flex text-xs items-center gap-1 text-fd-muted-foreground",
65
- children: [
66
- /* @__PURE__ */ jsx(Star, { className: "size-3" }),
67
- /* @__PURE__ */ jsx("span", { children: formatter.format(stars) }),
68
- /* @__PURE__ */ jsx(GitFork, { className: "size-3 ms-2" }),
69
- /* @__PURE__ */ jsx("span", { children: formatter.format(forks) })
70
- ]
71
- })]
72
- });
73
- }
74
- //#endregion
75
- export { GithubInfo, fetchRepositoryInfo };
1
+ export * from '@vx-oss/docs-vezham-ui/components/github-info';
@@ -1,38 +1 @@
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 { jsx, jsxs } from "react/jsx-runtime";
6
- import { CopyCheckIcon, LinkIcon } from "lucide-react";
7
- import { useTranslations } from "@fuma-translate/react";
8
- //#region src/components/heading.tsx
9
- function Heading({ as, ...props }) {
10
- const As = as ?? "h1";
11
- const t = useTranslations({ note: "heading anchor" });
12
- const [isChecked, onCopy] = useCopyButton(() => {
13
- if (!props.id) return;
14
- const url = new URL(window.location.href);
15
- url.hash = props.id;
16
- return navigator.clipboard.writeText(url.href);
17
- });
18
- if (!props.id) return /* @__PURE__ */ jsx(As, { ...props });
19
- return /* @__PURE__ */ jsxs(As, {
20
- ...props,
21
- className: cn("group/heading flex scroll-m-28 flex-row items-center gap-1", props.className),
22
- children: [/* @__PURE__ */ jsx("a", {
23
- "data-card": "",
24
- href: `#${props.id}`,
25
- children: props.children
26
- }), /* @__PURE__ */ jsx("button", {
27
- "aria-label": t("Copy Anchor Link", { note: "aria-label" }),
28
- className: cn(buttonVariants({
29
- variant: "ghost",
30
- size: "icon-xs"
31
- }), "not-prose shrink-0 text-fd-muted-foreground opacity-0 transition-opacity group-hover/heading:opacity-100"),
32
- onClick: onCopy,
33
- children: isChecked ? /* @__PURE__ */ jsx(CopyCheckIcon, {}) : /* @__PURE__ */ jsx(LinkIcon, {})
34
- })]
35
- });
36
- }
37
- //#endregion
38
- export { Heading };
1
+ export * from '@vx-oss/docs-vezham-ui/components/heading';
@@ -1,32 +1 @@
1
- "use client";
2
- import { Uncontrolled } from "../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";
3
- import "./image-zoom2.css";
4
- import { Image } from "@vx-oss/docs-core/framework";
5
- import { jsx } from "react/jsx-runtime";
6
- //#region src/components/image-zoom.tsx
7
- function getImageSrc(src) {
8
- if (typeof src === "string") return src;
9
- if (typeof src === "object") {
10
- if ("default" in src) return src.default.src;
11
- return src.src;
12
- }
13
- return "";
14
- }
15
- function ImageZoom({ zoomInProps, children, rmiz, ...props }) {
16
- return /* @__PURE__ */ jsx(Uncontrolled, {
17
- zoomMargin: 20,
18
- wrapElement: "span",
19
- ...rmiz,
20
- zoomImg: {
21
- src: getImageSrc(props.src),
22
- sizes: void 0,
23
- ...zoomInProps
24
- },
25
- children: children ?? /* @__PURE__ */ jsx(Image, {
26
- sizes: "(max-width: 768px) 100vw, (max-width: 1200px) 70vw, 900px",
27
- ...props
28
- })
29
- });
30
- }
31
- //#endregion
32
- export { ImageZoom };
1
+ export * from '@vx-oss/docs-vezham-ui/components/image-zoom';
@@ -1,28 +1 @@
1
- "use client";
2
- import { cn } from "../utils/cn.js";
3
- import { Collapsible, CollapsibleContent, CollapsibleTrigger } from "./ui/collapsible.js";
4
- import { jsx, jsxs } from "react/jsx-runtime";
5
- import { ChevronDown } from "lucide-react";
6
- import { useTranslations } from "@fuma-translate/react";
7
- //#region src/components/inline-toc.tsx
8
- function InlineTOC({ items, ...props }) {
9
- const t = useTranslations({ note: "inline table of contents" });
10
- return /* @__PURE__ */ jsxs(Collapsible, {
11
- ...props,
12
- className: cn("not-prose rounded-lg border bg-fd-card text-fd-card-foreground", props.className),
13
- children: [/* @__PURE__ */ jsxs(CollapsibleTrigger, {
14
- className: "group inline-flex w-full items-center justify-between px-4 py-2.5 font-medium",
15
- children: [props.children ?? t("Table of Contents"), /* @__PURE__ */ jsx(ChevronDown, { className: "size-4 transition-transform duration-200 group-data-[state=open]:rotate-180" })]
16
- }), /* @__PURE__ */ jsx(CollapsibleContent, { children: /* @__PURE__ */ jsx("div", {
17
- className: "flex flex-col p-4 pt-0 text-sm text-fd-muted-foreground",
18
- children: items.map((item) => /* @__PURE__ */ jsx("a", {
19
- href: item.url,
20
- className: "border-s py-1.5 hover:text-fd-accent-foreground",
21
- style: { paddingInlineStart: 12 * Math.max(item.depth - 1, 0) },
22
- children: item.title
23
- }, item.url))
24
- }) })]
25
- });
26
- }
27
- //#endregion
28
- export { InlineTOC };
1
+ export * from '@vx-oss/docs-vezham-ui/components/inline-toc';