@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,181 +1 @@
1
- "use client";
2
- import { cn } from "../../../../utils/cn.js";
3
- import { TOCProvider as TOCProvider$1, TOCScrollArea, useItems, useTOCItems } from "../../../../components/toc/index.js";
4
- import { default_exports } from "../../../../components/toc/default.js";
5
- import { clerk_exports } from "../../../../components/toc/clerk.js";
6
- import { useTreePath } from "../../../../contexts/tree.js";
7
- import { Collapsible, CollapsibleContent, CollapsibleTrigger } from "../../../../components/ui/collapsible.js";
8
- import { useNotebookLayout } from "../../client.js";
9
- import { jsx, jsxs } from "react/jsx-runtime";
10
- import { ChevronDown, Text } from "lucide-react";
11
- import { createContext, use, useEffect, useEffectEvent, useMemo, useRef, useState } from "react";
12
- import { useTranslations } from "@fuma-translate/react";
13
- //#region src/layouts/notebook/page/slots/toc.tsx
14
- function TOCProvider(props) {
15
- return /* @__PURE__ */ jsx(TOCProvider$1, { ...props });
16
- }
17
- function TOC({ container, header, footer, style = "normal", list }) {
18
- const items = useTOCItems();
19
- const t = useTranslations({ note: "table of contents" });
20
- const { TOCItems, TOCEmpty, TOCItem } = style === "clerk" ? clerk_exports : default_exports;
21
- if (items.length === 0 && !footer && !header) return /* @__PURE__ */ jsx("div", {
22
- id: "nd-toc-placeholder",
23
- className: "hidden xl:layout:[--fd-toc-width:268px]"
24
- });
25
- return /* @__PURE__ */ jsxs("div", {
26
- id: "nd-toc",
27
- ...container,
28
- className: cn("sticky top-(--fd-docs-row-3) [grid-area:toc] h-[calc(var(--fd-docs-height)-var(--fd-docs-row-3))] flex flex-col w-(--fd-toc-width) pt-12 pe-4 pb-2 xl:layout:[--fd-toc-width:268px] max-xl:hidden", container?.className),
29
- children: [
30
- header,
31
- /* @__PURE__ */ jsxs("h3", {
32
- id: "toc-title",
33
- className: "inline-flex items-center gap-1.5 text-sm text-fd-muted-foreground",
34
- children: [/* @__PURE__ */ jsx(Text, { className: "size-4" }), t("On this page")]
35
- }),
36
- /* @__PURE__ */ jsx(TOCScrollArea, { children: /* @__PURE__ */ jsxs(TOCItems, {
37
- ...list,
38
- children: [items.length === 0 && /* @__PURE__ */ jsx(TOCEmpty, {}), items.map((item) => /* @__PURE__ */ jsx(TOCItem, { item }, item.url))]
39
- }) }),
40
- footer
41
- ]
42
- });
43
- }
44
- const TocPopoverContext = createContext(null);
45
- function TOCPopover({ container, trigger, content, header, footer, style = "normal", list }) {
46
- const items = useTOCItems();
47
- const ref = useRef(null);
48
- const [open, setOpen] = useState(false);
49
- const { isNavTransparent } = useNotebookLayout();
50
- const { TOCItems, TOCItem, TOCEmpty } = style === "clerk" ? clerk_exports : default_exports;
51
- const onClickOutside = useEffectEvent((e) => {
52
- if (!open || !(e.target instanceof HTMLElement)) return;
53
- if (ref.current && !ref.current.contains(e.target)) setOpen(false);
54
- });
55
- const onClickItem = () => {
56
- setOpen(false);
57
- };
58
- useEffect(() => {
59
- window.addEventListener("click", onClickOutside);
60
- return () => {
61
- window.removeEventListener("click", onClickOutside);
62
- };
63
- }, []);
64
- return /* @__PURE__ */ jsx(TocPopoverContext, {
65
- value: useMemo(() => ({
66
- open,
67
- setOpen
68
- }), [setOpen, open]),
69
- children: /* @__PURE__ */ jsx(Collapsible, {
70
- open,
71
- onOpenChange: setOpen,
72
- "data-toc-popover": "",
73
- ...container,
74
- className: cn("sticky top-(--fd-docs-row-2) z-10 [grid-area:toc-popover] h-(--fd-toc-popover-height) xl:hidden max-xl:layout:[--fd-toc-popover-height:--spacing(10)]", container?.className),
75
- children: /* @__PURE__ */ jsxs("header", {
76
- ref,
77
- className: cn("border-b backdrop-blur-sm transition-colors", (!isNavTransparent || open) && "bg-fd-background/80", open && "shadow-lg"),
78
- children: [/* @__PURE__ */ jsx(PageTOCPopoverTrigger, { ...trigger }), /* @__PURE__ */ jsxs(PageTOCPopoverContent, {
79
- ...content,
80
- children: [
81
- header,
82
- /* @__PURE__ */ jsx(TOCScrollArea, { children: /* @__PURE__ */ jsxs(TOCItems, {
83
- ...list,
84
- children: [items.length === 0 && /* @__PURE__ */ jsx(TOCEmpty, {}), items.map((item) => /* @__PURE__ */ jsx(TOCItem, {
85
- item,
86
- onClick: onClickItem
87
- }, item.url))]
88
- }) }),
89
- footer
90
- ]
91
- })]
92
- })
93
- })
94
- });
95
- }
96
- function PageTOCPopoverTrigger({ className, ...props }) {
97
- const t = useTranslations({ note: "table of contents" });
98
- const { open } = use(TocPopoverContext);
99
- const items = useItems();
100
- const selectedIdx = items.findIndex((item) => item.active);
101
- const path = useTreePath().at(-1);
102
- const showItem = selectedIdx !== -1 && !open;
103
- return /* @__PURE__ */ jsxs(CollapsibleTrigger, {
104
- className: cn("flex w-full h-10 items-center text-sm text-fd-muted-foreground gap-2.5 px-4 py-2.5 text-start focus-visible:outline-none [&_svg]:size-4 md:px-6", className),
105
- "data-toc-popover-trigger": "",
106
- ...props,
107
- children: [
108
- /* @__PURE__ */ jsx(ProgressCircle, {
109
- value: (items.findLastIndex((item) => item.active) + 1) / Math.max(1, items.length),
110
- max: 1,
111
- className: cn("shrink-0", open && "text-fd-primary")
112
- }),
113
- /* @__PURE__ */ jsxs("span", {
114
- className: "grid flex-1 *:my-auto *:row-start-1 *:col-start-1",
115
- children: [/* @__PURE__ */ jsx("span", {
116
- className: cn("truncate transition-[opacity,translate,color]", open && "text-fd-foreground", showItem && "opacity-0 -translate-y-full pointer-events-none"),
117
- children: path?.name ?? t("On this page")
118
- }), /* @__PURE__ */ jsx("span", {
119
- className: cn("truncate transition-[opacity,translate]", !showItem && "opacity-0 translate-y-full pointer-events-none"),
120
- children: items[selectedIdx]?.original.title
121
- })]
122
- }),
123
- /* @__PURE__ */ jsx(ChevronDown, { className: cn("shrink-0 transition-transform mx-0.5", open && "rotate-180") })
124
- ]
125
- });
126
- }
127
- function clamp(input, min, max) {
128
- if (input < min) return min;
129
- if (input > max) return max;
130
- return input;
131
- }
132
- function ProgressCircle({ value, strokeWidth = 1.5, size = 18, min = 0, max = 100, style, ...restSvgProps }) {
133
- const normalizedValue = clamp(value, min, max);
134
- const radius = size / 2 - strokeWidth;
135
- const circumference = 2 * Math.PI * radius;
136
- const progress = normalizedValue / max * circumference;
137
- const circleProps = {
138
- cx: size / 2,
139
- cy: size / 2,
140
- r: radius,
141
- fill: "none",
142
- strokeWidth
143
- };
144
- return /* @__PURE__ */ jsxs("svg", {
145
- role: "progressbar",
146
- viewBox: `0 0 ${size} ${size}`,
147
- "aria-valuenow": normalizedValue,
148
- "aria-valuemin": min,
149
- "aria-valuemax": max,
150
- style: {
151
- width: size,
152
- height: size,
153
- ...style
154
- },
155
- ...restSvgProps,
156
- children: [/* @__PURE__ */ jsx("circle", {
157
- ...circleProps,
158
- className: "stroke-current/25"
159
- }), /* @__PURE__ */ jsx("circle", {
160
- ...circleProps,
161
- stroke: "currentColor",
162
- strokeDasharray: circumference,
163
- strokeDashoffset: circumference - progress,
164
- strokeLinecap: "round",
165
- transform: `rotate(-90 ${size / 2} ${size / 2})`,
166
- className: "transition-all"
167
- })]
168
- });
169
- }
170
- function PageTOCPopoverContent(props) {
171
- return /* @__PURE__ */ jsx(CollapsibleContent, {
172
- "data-toc-popover-content": "",
173
- ...props,
174
- children: /* @__PURE__ */ jsx("div", {
175
- className: "flex flex-col px-4 max-h-[50vh] md:px-6",
176
- children: props.children
177
- })
178
- });
179
- }
180
- //#endregion
181
- export { TOC, TOCPopover, TOCProvider };
1
+ export * from '@vx-oss/docs-vezham-ui/layouts/notebook/page/slots/toc';
@@ -1,38 +1 @@
1
- "use client";
2
- import { cn } from "../../../utils/cn.js";
3
- import { useNotebookLayout } from "../client.js";
4
- import { jsx } from "react/jsx-runtime";
5
- import { useEffect, useState } from "react";
6
- //#region src/layouts/notebook/slots/container.tsx
7
- function Container(props) {
8
- const { props: { nav }, slots } = useNotebookLayout();
9
- const pageCol = "calc(var(--fd-layout-width,97rem) - var(--fd-sidebar-col) - var(--fd-toc-width))";
10
- const { collapsed } = slots.sidebar?.useSidebar?.() ?? {};
11
- const [previousCollapsed, setPreviousCollapsed] = useState(collapsed);
12
- const isCollapseChanged = previousCollapsed !== collapsed;
13
- useEffect(() => {
14
- if (isCollapseChanged) setPreviousCollapsed(collapsed);
15
- }, [collapsed, isCollapseChanged]);
16
- return /* @__PURE__ */ jsx("div", {
17
- id: "nd-notebook-layout",
18
- "data-sidebar-collapsed": collapsed,
19
- "data-column-changed": isCollapseChanged,
20
- ...props,
21
- style: {
22
- gridTemplate: nav?.mode === "top" ? `". header header header ."
23
- "sidebar sidebar toc-popover toc-popover ."
24
- "sidebar sidebar main toc ." 1fr / minmax(min-content, 1fr) var(--fd-sidebar-col) minmax(0, ${pageCol}) var(--fd-toc-width) minmax(min-content, 1fr)` : `"sidebar sidebar header header ."
25
- "sidebar sidebar toc-popover toc-popover ."
26
- "sidebar sidebar main toc ." 1fr / minmax(min-content, 1fr) var(--fd-sidebar-col) minmax(0, ${pageCol}) var(--fd-toc-width) minmax(min-content, 1fr)`,
27
- "--fd-docs-row-1": "var(--fd-banner-height, 0px)",
28
- "--fd-docs-row-2": "calc(var(--fd-docs-row-1) + var(--fd-header-height))",
29
- "--fd-docs-row-3": "calc(var(--fd-docs-row-2) + var(--fd-toc-popover-height))",
30
- "--fd-sidebar-col": collapsed ? "0px" : "var(--fd-sidebar-width)",
31
- ...props.style
32
- },
33
- className: cn("grid overflow-x-clip min-h-(--fd-docs-height) auto-cols-auto auto-rows-auto [--fd-docs-height:100dvh] [--fd-header-height:0px] [--fd-toc-popover-height:0px] [--fd-sidebar-width:0px] [--fd-toc-width:0px] data-[column-changed=true]:transition-[grid-template-columns]", props.className),
34
- children: props.children
35
- });
36
- }
37
- //#endregion
38
- export { Container };
1
+ export * from '@vx-oss/docs-vezham-ui/layouts/notebook/slots/container';
@@ -1,204 +1 @@
1
- "use client";
2
- import { cn } from "../../../utils/cn.js";
3
- import { buttonVariants } from "../../../components/ui/button.js";
4
- import { useTabsGroups } from "../../../contexts/tree.js";
5
- import { Popover, PopoverContent, PopoverTrigger } from "../../../components/ui/popover.js";
6
- import { LinkItem } from "../../shared/client.js";
7
- import { isLayoutTabActive } from "../../shared/index.js";
8
- import { SidebarTabsDropdown } from "../../../components/sidebar/tabs/dropdown.js";
9
- import { useNotebookLayout } from "../client.js";
10
- import Link from "@vx-oss/docs-core/link";
11
- import { usePathname } from "@vx-oss/docs-core/framework";
12
- import { jsx, jsxs } from "react/jsx-runtime";
13
- import { ChevronDown, Languages, Sidebar } from "lucide-react";
14
- import { Fragment as Fragment$1, useMemo, useRef, useState } from "react";
15
- //#region src/layouts/notebook/slots/header.tsx
16
- function Header(props) {
17
- const { slots, navItems, isNavTransparent, props: { tabMode, nav, tabs, sidebar } } = useNotebookLayout();
18
- const { open } = slots.sidebar?.useSidebar?.() ?? {};
19
- const navMode = nav?.mode ?? "auto";
20
- const sidebarCollapsible = sidebar.collapsible ?? true;
21
- const groups = useTabsGroups(tabs);
22
- const showLayoutTabs = tabMode === "navbar" && groups.length > 0;
23
- if (nav?.component) return nav.component;
24
- return /* @__PURE__ */ jsxs("header", {
25
- id: "nd-subnav",
26
- "data-transparent": isNavTransparent && !open,
27
- ...props,
28
- className: cn("sticky [grid-area:header] flex flex-col top-(--fd-docs-row-1) z-10 backdrop-blur-sm transition-colors data-[transparent=false]:bg-fd-background/80 layout:[--fd-header-height:--spacing(14)]", showLayoutTabs && "lg:layout:[--fd-header-height:--spacing(24)]", props.className),
29
- children: [/* @__PURE__ */ jsxs("div", {
30
- "data-header-body": "",
31
- className: cn("flex border-b px-4 gap-2 h-14", navMode === "top" && "md:px-6"),
32
- children: [
33
- /* @__PURE__ */ jsxs("div", {
34
- className: cn("items-center", navMode === "top" && "flex flex-1", navMode === "auto" && "hidden has-data-[collapsed=true]:md:flex max-md:flex"),
35
- children: [
36
- sidebarCollapsible && slots.sidebar && navMode === "auto" && /* @__PURE__ */ jsx(slots.sidebar.collapseTrigger, {
37
- className: cn(buttonVariants({
38
- color: "ghost",
39
- size: "icon-sm"
40
- }), "-ms-1.5 text-fd-muted-foreground data-[collapsed=false]:hidden max-md:hidden"),
41
- children: /* @__PURE__ */ jsx(Sidebar, {})
42
- }),
43
- slots.navTitle && /* @__PURE__ */ jsx(slots.navTitle, { className: cn("inline-flex items-center gap-2.5 font-semibold", navMode === "auto" && "md:hidden") }),
44
- nav?.children
45
- ]
46
- }),
47
- slots.searchTrigger && /* @__PURE__ */ jsx(slots.searchTrigger.full, {
48
- hideIfDisabled: true,
49
- className: cn("w-full my-auto max-md:hidden", navMode === "top" ? "ps-2.5 rounded-xl max-w-sm" : "max-w-[240px]")
50
- }),
51
- /* @__PURE__ */ jsxs("div", {
52
- className: "flex flex-1 items-center justify-end md:gap-2",
53
- children: [
54
- /* @__PURE__ */ jsx("div", {
55
- className: "flex items-center gap-6 empty:hidden max-lg:hidden",
56
- children: navItems.filter((item) => item.type !== "icon").map((item, i) => /* @__PURE__ */ jsx(NavbarLinkItem, { item }, i))
57
- }),
58
- navItems.filter((item) => item.type === "icon").map((item, i) => /* @__PURE__ */ jsx(LinkItem, {
59
- item,
60
- className: cn(buttonVariants({
61
- size: "icon-sm",
62
- color: "ghost"
63
- }), "text-fd-muted-foreground max-lg:hidden"),
64
- "aria-label": item.label,
65
- children: item.icon
66
- }, i)),
67
- /* @__PURE__ */ jsxs("div", {
68
- className: "flex items-center md:hidden",
69
- children: [slots.searchTrigger && /* @__PURE__ */ jsx(slots.searchTrigger.sm, {
70
- hideIfDisabled: true,
71
- className: "p-2"
72
- }), slots.sidebar && /* @__PURE__ */ jsx(slots.sidebar.trigger, {
73
- className: cn(buttonVariants({
74
- color: "ghost",
75
- size: "icon-sm",
76
- className: "p-2 -me-1.5"
77
- })),
78
- children: /* @__PURE__ */ jsx(Sidebar, {})
79
- })]
80
- }),
81
- /* @__PURE__ */ jsxs("div", {
82
- className: "flex items-center gap-2 max-md:hidden",
83
- children: [
84
- slots.languageSelect && /* @__PURE__ */ jsx(slots.languageSelect.root, { children: /* @__PURE__ */ jsx(Languages, { className: "size-4.5 text-fd-muted-foreground" }) }),
85
- slots.themeSwitch && /* @__PURE__ */ jsx(slots.themeSwitch, {}),
86
- sidebarCollapsible && slots.sidebar && navMode === "top" && /* @__PURE__ */ jsx(slots.sidebar.collapseTrigger, {
87
- className: cn(buttonVariants({
88
- color: "secondary",
89
- size: "icon-sm"
90
- }), "text-fd-muted-foreground rounded-full -me-1.5"),
91
- children: /* @__PURE__ */ jsx(Sidebar, {})
92
- })
93
- ]
94
- })
95
- ]
96
- })
97
- ]
98
- }), showLayoutTabs && /* @__PURE__ */ jsx(LayoutHeaderTabs, {
99
- "data-header-tabs": "",
100
- className: "overflow-x-auto border-b px-6 h-10 max-lg:hidden",
101
- tabs
102
- })]
103
- });
104
- }
105
- function LayoutHeaderTabs({ tabs: allTabs, className, ...props }) {
106
- const pathname = usePathname();
107
- const tabs = useTabsGroups(allTabs).findLast((group) => typeof group.active?.root !== "string")?.options;
108
- const typedTabs = useMemo(() => {
109
- return allTabs.filter((tab) => typeof tab.$folder?.root === "string");
110
- }, [allTabs]);
111
- const selectedIdx = useMemo(() => {
112
- return tabs?.findLastIndex((option) => isLayoutTabActive(option, pathname)) ?? -1;
113
- }, [tabs, pathname]);
114
- return /* @__PURE__ */ jsxs("div", {
115
- className: cn("flex flex-row items-end gap-6", className),
116
- ...props,
117
- children: [typedTabs.length > 0 && /* @__PURE__ */ jsx(SidebarTabsDropdown, {
118
- options: typedTabs,
119
- className: "my-auto p-1"
120
- }), tabs?.map((option, i) => {
121
- const { title, url, unlisted, props: { className, ...rest } = {} } = option;
122
- const isSelected = selectedIdx === i;
123
- return /* @__PURE__ */ jsx(Link, {
124
- href: url,
125
- className: cn("inline-flex border-b-2 border-transparent transition-colors items-center pb-1.5 font-medium gap-2 text-fd-muted-foreground text-sm text-nowrap hover:text-fd-accent-foreground", unlisted && !isSelected && "hidden", isSelected && "border-fd-primary text-fd-primary", className),
126
- ...rest,
127
- children: title
128
- }, i);
129
- })]
130
- });
131
- }
132
- function NavbarLinkItem({ item, className, ...props }) {
133
- if (item.type === "custom") return item.children;
134
- if (item.type === "menu") return /* @__PURE__ */ jsx(NavbarLinkItemMenu, {
135
- item,
136
- className,
137
- ...props
138
- });
139
- return /* @__PURE__ */ jsx(LinkItem, {
140
- item,
141
- className: cn("text-sm text-fd-muted-foreground transition-colors hover:text-fd-accent-foreground data-[active=true]:text-fd-primary", className),
142
- ...props,
143
- children: item.text
144
- });
145
- }
146
- function NavbarLinkItemMenu({ item, hoverDelay = 50, className, ...props }) {
147
- const [open, setOpen] = useState(false);
148
- const timeoutRef = useRef(null);
149
- const freezeUntil = useRef(null);
150
- const delaySetOpen = (value) => {
151
- if (timeoutRef.current) {
152
- clearTimeout(timeoutRef.current);
153
- timeoutRef.current = null;
154
- }
155
- timeoutRef.current = window.setTimeout(() => {
156
- setOpen(value);
157
- freezeUntil.current = Date.now() + 300;
158
- }, hoverDelay);
159
- };
160
- const onPointerEnter = (e) => {
161
- if (e.pointerType === "touch") return;
162
- delaySetOpen(true);
163
- };
164
- const onPointerLeave = (e) => {
165
- if (e.pointerType === "touch") return;
166
- delaySetOpen(false);
167
- };
168
- function isTouchDevice() {
169
- return "ontouchstart" in window || navigator.maxTouchPoints > 0;
170
- }
171
- return /* @__PURE__ */ jsxs(Popover, {
172
- open,
173
- onOpenChange: (value) => {
174
- if (freezeUntil.current === null || Date.now() >= freezeUntil.current) setOpen(value);
175
- },
176
- children: [/* @__PURE__ */ jsxs(PopoverTrigger, {
177
- className: cn("inline-flex items-center gap-1.5 p-1 text-sm text-fd-muted-foreground transition-colors has-data-[active=true]:text-fd-primary data-[state=open]:text-fd-accent-foreground focus-visible:outline-none", className),
178
- onPointerEnter,
179
- onPointerLeave,
180
- ...props,
181
- children: [item.url ? /* @__PURE__ */ jsx(LinkItem, {
182
- item,
183
- children: item.text
184
- }) : item.text, /* @__PURE__ */ jsx(ChevronDown, { className: "size-3" })]
185
- }), /* @__PURE__ */ jsx(PopoverContent, {
186
- className: "flex flex-col p-1 text-fd-muted-foreground text-start",
187
- onPointerEnter,
188
- onPointerLeave,
189
- children: item.items.map((child, i) => {
190
- if (child.type === "custom") return /* @__PURE__ */ jsx(Fragment$1, { children: child.children }, i);
191
- return /* @__PURE__ */ jsxs(LinkItem, {
192
- item: child,
193
- className: "inline-flex items-center gap-2 rounded-md p-2 transition-colors hover:bg-fd-accent hover:text-fd-accent-foreground data-[active=true]:text-fd-primary [&_svg]:size-4",
194
- onClick: () => {
195
- if (isTouchDevice()) setOpen(false);
196
- },
197
- children: [child.icon, child.text]
198
- }, i);
199
- })
200
- })]
201
- });
202
- }
203
- //#endregion
204
- export { Header };
1
+ export * from '@vx-oss/docs-vezham-ui/layouts/notebook/slots/header';
@@ -1,240 +1 @@
1
- "use client";
2
- import { cn } from "../../../utils/cn.js";
3
- import { buttonVariants } from "../../../components/ui/button.js";
4
- import { mergeRefs } from "../../../utils/merge-refs.js";
5
- import { LinkItem } from "../../shared/client.js";
6
- import "../../shared/index.js";
7
- import { SidebarCollapseTrigger as SidebarCollapseTrigger$1, SidebarContent as SidebarContent$1, SidebarDrawerContent, SidebarDrawerOverlay, SidebarFolder as SidebarFolder$1, SidebarFolderContent as SidebarFolderContent$1, SidebarFolderLink as SidebarFolderLink$1, SidebarFolderTrigger as SidebarFolderTrigger$1, SidebarItem as SidebarItem$1, SidebarProvider as SidebarProvider$1, SidebarSeparator as SidebarSeparator$1, SidebarTrigger as SidebarTrigger$1, SidebarViewport, base_exports, useFolder, useFolderDepth } from "../../../components/sidebar/base.js";
8
- import { createPageTreeRenderer } from "../../../components/sidebar/page-tree.js";
9
- import { createLinkItemRenderer } from "../../../components/sidebar/link-item.js";
10
- import { SidebarTabsDropdown } from "../../../components/sidebar/tabs/dropdown.js";
11
- import { useNotebookLayout } from "../client.js";
12
- import { Fragment, jsx, jsxs } from "react/jsx-runtime";
13
- import { Languages, SidebarIcon, X } from "lucide-react";
14
- import { cva } from "class-variance-authority";
15
- import { createElement, useRef } from "react";
16
- //#region src/layouts/notebook/slots/sidebar.tsx
17
- const itemVariants = cva("relative flex flex-row items-center gap-2 rounded-lg p-2 text-start text-fd-muted-foreground wrap-anywhere [&_svg]:size-4 [&_svg]:shrink-0", { variants: {
18
- variant: {
19
- link: "transition-colors hover:bg-fd-accent/50 hover:text-fd-accent-foreground/80 hover:transition-none data-[active=true]:bg-fd-primary/10 data-[active=true]:text-fd-primary data-[active=true]:hover:transition-colors",
20
- button: "transition-colors hover:bg-fd-accent/50 hover:text-fd-accent-foreground/80 hover:transition-none"
21
- },
22
- highlight: { true: "data-[active=true]:before:content-[''] data-[active=true]:before:bg-fd-primary data-[active=true]:before:absolute data-[active=true]:before:w-px data-[active=true]:before:inset-y-2.5 data-[active=true]:before:inset-s-2.5" }
23
- } });
24
- function getItemOffset(depth) {
25
- return `calc(${2 + 3 * depth} * var(--spacing))`;
26
- }
27
- const { useSidebar } = base_exports;
28
- function SidebarProvider(props) {
29
- return /* @__PURE__ */ jsx(SidebarProvider$1, { ...props });
30
- }
31
- function SidebarTrigger(props) {
32
- return /* @__PURE__ */ jsx(SidebarTrigger$1, { ...props });
33
- }
34
- function SidebarCollapseTrigger(props) {
35
- return /* @__PURE__ */ jsx(SidebarCollapseTrigger$1, { ...props });
36
- }
37
- function SidebarContent({ ref: refProp, className, children, ...props }) {
38
- const { props: { nav } } = useNotebookLayout();
39
- const navMode = nav?.mode ?? "auto";
40
- const ref = useRef(null);
41
- return /* @__PURE__ */ jsx(SidebarContent$1, { children: ({ collapsed, hovered, ref: asideRef, ...rest }) => /* @__PURE__ */ jsxs("div", {
42
- "data-sidebar-placeholder": "",
43
- className: cn("sticky z-20 [grid-area:sidebar] pointer-events-none *:pointer-events-auto md:layout:[--fd-sidebar-width:268px] max-md:hidden", navMode === "auto" ? "top-(--fd-docs-row-1) h-[calc(var(--fd-docs-height)-var(--fd-docs-row-1))]" : "top-(--fd-docs-row-2) h-[calc(var(--fd-docs-height)-var(--fd-docs-row-2))]"),
44
- children: [collapsed && /* @__PURE__ */ jsx("div", {
45
- className: "absolute inset-s-0 inset-y-0 w-4",
46
- ...rest
47
- }), /* @__PURE__ */ jsx("aside", {
48
- id: "nd-sidebar",
49
- ref: mergeRefs(ref, refProp, asideRef),
50
- "data-collapsed": collapsed,
51
- "data-hovered": collapsed && hovered,
52
- className: cn("absolute flex flex-col w-full inset-s-0 inset-y-0 items-end text-sm duration-250 *:w-(--fd-sidebar-width)", navMode === "auto" && "bg-fd-card border-e", collapsed && ["inset-y-2 rounded-xl bg-fd-card transition-transform border w-(--fd-sidebar-width)", hovered ? "shadow-lg translate-x-2 rtl:-translate-x-2" : "-translate-x-(--fd-sidebar-width) rtl:translate-x-full"], ref.current && ref.current.getAttribute("data-collapsed") === "true" !== collapsed && "transition-[width,inset-block,translate,background-color]", className),
53
- ...props,
54
- ...rest,
55
- children
56
- })]
57
- }) });
58
- }
59
- function SidebarDrawer({ children, className, ...props }) {
60
- return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(SidebarDrawerOverlay, { className: "fixed z-40 inset-0 backdrop-blur-xs data-[state=open]:animate-fd-fade-in data-[state=closed]:animate-fd-fade-out" }), /* @__PURE__ */ jsx(SidebarDrawerContent, {
61
- className: cn("fixed text-[0.9375rem] flex flex-col shadow-lg border-s inset-e-0 inset-y-0 w-[85%] max-w-[380px] z-40 bg-fd-background data-[state=open]:animate-fd-sidebar-in data-[state=closed]:animate-fd-sidebar-out", className),
62
- ...props,
63
- children
64
- })] });
65
- }
66
- function SidebarFolder(props) {
67
- return /* @__PURE__ */ jsx(SidebarFolder$1, { ...props });
68
- }
69
- function SidebarSeparator({ className, style, children, ...props }) {
70
- const depth = useFolderDepth();
71
- return /* @__PURE__ */ jsx(SidebarSeparator$1, {
72
- className: cn("inline-flex items-center gap-2 mb-1.5 px-2 mt-6 empty:mb-0 [&_svg]:size-4 [&_svg]:shrink-0", depth === 0 && "first:mt-0", className),
73
- style: {
74
- paddingInlineStart: getItemOffset(depth),
75
- ...style
76
- },
77
- ...props,
78
- children
79
- });
80
- }
81
- function SidebarItem({ className, style, children, ...props }) {
82
- const depth = useFolderDepth();
83
- return /* @__PURE__ */ jsx(SidebarItem$1, {
84
- className: cn(itemVariants({
85
- variant: "link",
86
- highlight: depth >= 1
87
- }), className),
88
- style: {
89
- paddingInlineStart: getItemOffset(depth),
90
- ...style
91
- },
92
- ...props,
93
- children
94
- });
95
- }
96
- function SidebarFolderTrigger({ className, style, ...props }) {
97
- const { depth, collapsible } = useFolder();
98
- return /* @__PURE__ */ jsx(SidebarFolderTrigger$1, {
99
- className: cn(itemVariants({ variant: collapsible ? "button" : null }), "w-full", className),
100
- style: {
101
- paddingInlineStart: getItemOffset(depth - 1),
102
- ...style
103
- },
104
- ...props,
105
- children: props.children
106
- });
107
- }
108
- function SidebarFolderLink({ className, style, ...props }) {
109
- const depth = useFolderDepth();
110
- return /* @__PURE__ */ jsx(SidebarFolderLink$1, {
111
- className: cn(itemVariants({
112
- variant: "link",
113
- highlight: depth > 1
114
- }), "w-full", className),
115
- style: {
116
- paddingInlineStart: getItemOffset(depth - 1),
117
- ...style
118
- },
119
- ...props,
120
- children: props.children
121
- });
122
- }
123
- function SidebarFolderContent({ className, children, ...props }) {
124
- const depth = useFolderDepth();
125
- return /* @__PURE__ */ jsx(SidebarFolderContent$1, {
126
- className: cn("relative", depth === 1 && "before:content-[''] before:absolute before:w-px before:inset-y-1 before:bg-fd-border before:inset-s-2.5", className),
127
- ...props,
128
- children: /* @__PURE__ */ jsx("div", {
129
- className: "flex flex-col gap-0.5 pt-0.5",
130
- children
131
- })
132
- });
133
- }
134
- const SidebarPageTree = createPageTreeRenderer({
135
- SidebarFolder,
136
- SidebarFolderContent,
137
- SidebarFolderLink,
138
- SidebarFolderTrigger,
139
- SidebarItem,
140
- SidebarSeparator
141
- });
142
- const SidebarLinkItem = createLinkItemRenderer({
143
- SidebarFolder,
144
- SidebarFolderContent,
145
- SidebarFolderLink,
146
- SidebarFolderTrigger,
147
- SidebarItem
148
- });
149
- function Sidebar({ banner, footer, components, collapsible = true, ...rest }) {
150
- const { menuItems, slots, props: { nav, tabs, tabMode } } = useNotebookLayout();
151
- const navMode = nav?.mode ?? "auto";
152
- const iconLinks = menuItems.filter((item) => item.type === "icon");
153
- function renderHeader(props) {
154
- if (typeof banner === "function") return createElement(banner, props);
155
- return /* @__PURE__ */ jsxs("div", {
156
- ...props,
157
- className: cn("flex flex-col gap-3 p-4 pb-2 empty:hidden", props.className),
158
- children: [props.children, banner]
159
- });
160
- }
161
- function renderFooter(props) {
162
- if (typeof footer === "function") return createElement(footer, props);
163
- return /* @__PURE__ */ jsxs("div", {
164
- ...props,
165
- children: [props.children, footer]
166
- });
167
- }
168
- const viewport = /* @__PURE__ */ jsxs(SidebarViewport, { children: [menuItems.filter((item) => item.type !== "icon").map((item, i, arr) => /* @__PURE__ */ jsx(SidebarLinkItem, {
169
- item,
170
- className: cn("lg:hidden", i === arr.length - 1 && "mb-3")
171
- }, i)), /* @__PURE__ */ jsx(SidebarPageTree, { ...components })] });
172
- return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs(SidebarContent, {
173
- ...rest,
174
- children: [
175
- renderHeader({ children: /* @__PURE__ */ jsxs(Fragment, { children: [navMode === "auto" && /* @__PURE__ */ jsxs("div", {
176
- className: "flex justify-between",
177
- children: [
178
- slots.navTitle && /* @__PURE__ */ jsx(slots.navTitle, { className: "inline-flex items-center gap-2.5 font-medium" }),
179
- nav?.children,
180
- collapsible && /* @__PURE__ */ jsx(SidebarCollapseTrigger, {
181
- className: cn(buttonVariants({
182
- color: "ghost",
183
- size: "icon-sm",
184
- className: "mt-px mb-auto text-fd-muted-foreground"
185
- })),
186
- children: /* @__PURE__ */ jsx(SidebarIcon, {})
187
- })
188
- ]
189
- }), tabs.length > 0 && /* @__PURE__ */ jsx(SidebarTabsDropdown, {
190
- options: tabs,
191
- className: cn(tabMode === "navbar" && "lg:hidden")
192
- })] }) }),
193
- viewport,
194
- renderFooter({
195
- className: cn("hidden flex-row text-fd-muted-foreground items-center border-t px-4 py-2.5", iconLinks.length > 0 && "max-lg:flex"),
196
- children: iconLinks.map((item, i) => /* @__PURE__ */ jsx(LinkItem, {
197
- item,
198
- className: cn(buttonVariants({
199
- size: "icon-sm",
200
- color: "ghost",
201
- className: "lg:hidden"
202
- })),
203
- "aria-label": item.label,
204
- children: item.icon
205
- }, i))
206
- })
207
- ]
208
- }), /* @__PURE__ */ jsxs(SidebarDrawer, {
209
- ...rest,
210
- children: [
211
- renderHeader({ children: /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(SidebarTrigger, {
212
- className: cn(buttonVariants({
213
- size: "icon-sm",
214
- color: "ghost",
215
- className: "ms-auto text-fd-muted-foreground"
216
- })),
217
- children: /* @__PURE__ */ jsx(X, {})
218
- }), tabs.length > 0 && /* @__PURE__ */ jsx(SidebarTabsDropdown, { options: tabs })] }) }),
219
- viewport,
220
- renderFooter({
221
- className: cn("hidden flex-row text-fd-muted-foreground items-center border-t p-4 pt-2 justify-end", (slots.languageSelect || slots.themeSwitch) && "flex", iconLinks.length > 0 && "max-lg:flex"),
222
- children: /* @__PURE__ */ jsxs(Fragment, { children: [
223
- iconLinks.map((item, i) => /* @__PURE__ */ jsx(LinkItem, {
224
- item,
225
- className: cn(buttonVariants({
226
- size: "icon-sm",
227
- color: "ghost"
228
- }), "text-fd-muted-foreground lg:hidden", i === iconLinks.length - 1 && "me-auto"),
229
- "aria-label": item.label,
230
- children: item.icon
231
- }, i)),
232
- slots.languageSelect && /* @__PURE__ */ jsx(slots.languageSelect.root, { children: /* @__PURE__ */ jsx(Languages, { className: "size-4.5 text-fd-muted-foreground" }) }),
233
- slots.themeSwitch && /* @__PURE__ */ jsx(slots.themeSwitch, {})
234
- ] })
235
- })
236
- ]
237
- })] });
238
- }
239
- //#endregion
240
- export { Sidebar, SidebarCollapseTrigger, SidebarProvider, SidebarTrigger, useSidebar };
1
+ export * from '@vx-oss/docs-vezham-ui/layouts/notebook/slots/sidebar';