opin-ui 0.0.1

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 (243) hide show
  1. package/README.md +5 -0
  2. package/css/aspen.css +39 -0
  3. package/css/black.css +39 -0
  4. package/css/catppuccin.css +49 -0
  5. package/css/dusk.css +47 -0
  6. package/css/emerald.css +39 -0
  7. package/css/generated/docs.css +1 -0
  8. package/css/generated/flux.css +1 -0
  9. package/css/generated/home.css +1 -0
  10. package/css/generated/notebook.css +1 -0
  11. package/css/generated/shared.css +1 -0
  12. package/css/lib/base.css +314 -0
  13. package/css/lib/default-colors.css +51 -0
  14. package/css/lib/shiki.css +108 -0
  15. package/css/neutral.css +7 -0
  16. package/css/ocean.css +44 -0
  17. package/css/preset-legacy.css +43 -0
  18. package/css/preset.css +11 -0
  19. package/css/purple.css +39 -0
  20. package/css/ruby.css +39 -0
  21. package/css/shadcn.css +36 -0
  22. package/css/solar.css +75 -0
  23. package/css/style.css +9 -0
  24. package/css/vitepress.css +65 -0
  25. package/dist/.translations/index.d.ts +49 -0
  26. package/dist/.translations/keys.js +49 -0
  27. package/dist/_virtual/_rolldown/runtime.js +13 -0
  28. package/dist/components/accordion.d.ts +23 -0
  29. package/dist/components/accordion.js +68 -0
  30. package/dist/components/banner.d.ts +33 -0
  31. package/dist/components/banner.js +85 -0
  32. package/dist/components/callout.d.ts +41 -0
  33. package/dist/components/callout.js +53 -0
  34. package/dist/components/card.d.ts +19 -0
  35. package/dist/components/card.js +38 -0
  36. package/dist/components/codeblock.d.ts +61 -0
  37. package/dist/components/codeblock.js +173 -0
  38. package/dist/components/codeblock.rsc.d.ts +20 -0
  39. package/dist/components/codeblock.rsc.js +22 -0
  40. package/dist/components/dialog/search-algolia.d.ts +36 -0
  41. package/dist/components/dialog/search-algolia.js +64 -0
  42. package/dist/components/dialog/search-default.d.ts +36 -0
  43. package/dist/components/dialog/search-default.js +58 -0
  44. package/dist/components/dialog/search-orama.d.ts +43 -0
  45. package/dist/components/dialog/search-orama.js +69 -0
  46. package/dist/components/dialog/search.d.ts +112 -0
  47. package/dist/components/dialog/search.js +350 -0
  48. package/dist/components/dynamic-codeblock.core.d.ts +34 -0
  49. package/dist/components/dynamic-codeblock.core.js +51 -0
  50. package/dist/components/dynamic-codeblock.d.ts +9 -0
  51. package/dist/components/dynamic-codeblock.js +17 -0
  52. package/dist/components/files.d.ts +34 -0
  53. package/dist/components/files.js +40 -0
  54. package/dist/components/github-info.d.ts +35 -0
  55. package/dist/components/github-info.js +75 -0
  56. package/dist/components/heading.d.ts +13 -0
  57. package/dist/components/heading.js +38 -0
  58. package/dist/components/image-zoom.d.ts +23 -0
  59. package/dist/components/image-zoom.js +32 -0
  60. package/dist/components/image-zoom2.css +71 -0
  61. package/dist/components/inline-toc.d.ts +14 -0
  62. package/dist/components/inline-toc.js +28 -0
  63. package/dist/components/sidebar/base.d.ts +131 -0
  64. package/dist/components/sidebar/base.js +274 -0
  65. package/dist/components/sidebar/link-item.d.ts +22 -0
  66. package/dist/components/sidebar/link-item.js +38 -0
  67. package/dist/components/sidebar/page-tree.d.ts +28 -0
  68. package/dist/components/sidebar/page-tree.js +71 -0
  69. package/dist/components/sidebar/tabs/dropdown.d.ts +16 -0
  70. package/dist/components/sidebar/tabs/dropdown.js +71 -0
  71. package/dist/components/sidebar/tabs/index.d.ts +11 -0
  72. package/dist/components/sidebar/tabs/index.js +46 -0
  73. package/dist/components/steps.d.ts +15 -0
  74. package/dist/components/steps.js +16 -0
  75. package/dist/components/tabs.d.ts +49 -0
  76. package/dist/components/tabs.js +88 -0
  77. package/dist/components/toc/clerk.d.ts +20 -0
  78. package/dist/components/toc/clerk.js +226 -0
  79. package/dist/components/toc/default.d.ts +23 -0
  80. package/dist/components/toc/default.js +259 -0
  81. package/dist/components/toc/index.d.ts +19 -0
  82. package/dist/components/toc/index.js +45 -0
  83. package/dist/components/type-table.d.ts +43 -0
  84. package/dist/components/type-table.js +117 -0
  85. package/dist/components/ui/accordion.d.ts +30 -0
  86. package/dist/components/ui/accordion.js +42 -0
  87. package/dist/components/ui/button.d.ts +11 -0
  88. package/dist/components/ui/button.js +20 -0
  89. package/dist/components/ui/collapsible.d.ts +15 -0
  90. package/dist/components/ui/collapsible.js +21 -0
  91. package/dist/components/ui/navigation-menu.d.ts +30 -0
  92. package/dist/components/ui/navigation-menu.js +41 -0
  93. package/dist/components/ui/popover.d.ts +15 -0
  94. package/dist/components/ui/popover.js +20 -0
  95. package/dist/components/ui/scroll-area.d.ts +22 -0
  96. package/dist/components/ui/scroll-area.js +34 -0
  97. package/dist/components/ui/tabs.d.ts +36 -0
  98. package/dist/components/ui/tabs.js +77 -0
  99. package/dist/contexts/i18n.d.ts +41 -0
  100. package/dist/contexts/i18n.js +37 -0
  101. package/dist/contexts/search.d.ts +73 -0
  102. package/dist/contexts/search.js +68 -0
  103. package/dist/contexts/tree.d.ts +20 -0
  104. package/dist/contexts/tree.js +38 -0
  105. package/dist/i18n.d.ts +16 -0
  106. package/dist/i18n.js +38 -0
  107. package/dist/layouts/docs/client.d.ts +34 -0
  108. package/dist/layouts/docs/client.js +92 -0
  109. package/dist/layouts/docs/index.d.ts +44 -0
  110. package/dist/layouts/docs/index.js +22 -0
  111. package/dist/layouts/docs/page/index.d.ts +115 -0
  112. package/dist/layouts/docs/page/index.js +124 -0
  113. package/dist/layouts/docs/page/slots/breadcrumb.d.ts +13 -0
  114. package/dist/layouts/docs/page/slots/breadcrumb.js +44 -0
  115. package/dist/layouts/docs/page/slots/container.d.ts +6 -0
  116. package/dist/layouts/docs/page/slots/container.js +17 -0
  117. package/dist/layouts/docs/page/slots/footer.d.ts +22 -0
  118. package/dist/layouts/docs/page/slots/footer.js +56 -0
  119. package/dist/layouts/docs/page/slots/toc.d.ts +62 -0
  120. package/dist/layouts/docs/page/slots/toc.js +182 -0
  121. package/dist/layouts/docs/slots/container.d.ts +6 -0
  122. package/dist/layouts/docs/slots/container.js +36 -0
  123. package/dist/layouts/docs/slots/header.d.ts +6 -0
  124. package/dist/layouts/docs/slots/header.js +38 -0
  125. package/dist/layouts/docs/slots/sidebar.d.ts +29 -0
  126. package/dist/layouts/docs/slots/sidebar.js +326 -0
  127. package/dist/layouts/flux/index.d.ts +73 -0
  128. package/dist/layouts/flux/index.js +146 -0
  129. package/dist/layouts/flux/page/index.d.ts +102 -0
  130. package/dist/layouts/flux/page/index.js +104 -0
  131. package/dist/layouts/flux/page/slots/breadcrumb.d.ts +13 -0
  132. package/dist/layouts/flux/page/slots/breadcrumb.js +44 -0
  133. package/dist/layouts/flux/page/slots/container.d.ts +6 -0
  134. package/dist/layouts/flux/page/slots/container.js +17 -0
  135. package/dist/layouts/flux/page/slots/footer.d.ts +22 -0
  136. package/dist/layouts/flux/page/slots/footer.js +56 -0
  137. package/dist/layouts/flux/page/slots/toc.d.ts +38 -0
  138. package/dist/layouts/flux/page/slots/toc.js +181 -0
  139. package/dist/layouts/flux/slots/container.d.ts +6 -0
  140. package/dist/layouts/flux/slots/container.js +13 -0
  141. package/dist/layouts/flux/slots/sidebar.d.ts +22 -0
  142. package/dist/layouts/flux/slots/sidebar.js +237 -0
  143. package/dist/layouts/flux/slots/tab-dropdown.d.ts +16 -0
  144. package/dist/layouts/flux/slots/tab-dropdown.js +85 -0
  145. package/dist/layouts/home/index.d.ts +28 -0
  146. package/dist/layouts/home/index.js +40 -0
  147. package/dist/layouts/home/navbar.d.ts +10 -0
  148. package/dist/layouts/home/navbar.js +34 -0
  149. package/dist/layouts/home/not-found.d.ts +7 -0
  150. package/dist/layouts/home/not-found.js +41 -0
  151. package/dist/layouts/home/slots/container.d.ts +6 -0
  152. package/dist/layouts/home/slots/container.js +13 -0
  153. package/dist/layouts/home/slots/header.d.ts +9 -0
  154. package/dist/layouts/home/slots/header.js +239 -0
  155. package/dist/layouts/notebook/client.d.ts +36 -0
  156. package/dist/layouts/notebook/client.js +69 -0
  157. package/dist/layouts/notebook/index.d.ts +37 -0
  158. package/dist/layouts/notebook/index.js +22 -0
  159. package/dist/layouts/notebook/page/index.d.ts +115 -0
  160. package/dist/layouts/notebook/page/index.js +124 -0
  161. package/dist/layouts/notebook/page/slots/breadcrumb.d.ts +13 -0
  162. package/dist/layouts/notebook/page/slots/breadcrumb.js +44 -0
  163. package/dist/layouts/notebook/page/slots/container.d.ts +6 -0
  164. package/dist/layouts/notebook/page/slots/container.js +17 -0
  165. package/dist/layouts/notebook/page/slots/footer.d.ts +22 -0
  166. package/dist/layouts/notebook/page/slots/footer.js +56 -0
  167. package/dist/layouts/notebook/page/slots/toc.d.ts +62 -0
  168. package/dist/layouts/notebook/page/slots/toc.js +181 -0
  169. package/dist/layouts/notebook/slots/container.d.ts +6 -0
  170. package/dist/layouts/notebook/slots/container.js +38 -0
  171. package/dist/layouts/notebook/slots/header.d.ts +6 -0
  172. package/dist/layouts/notebook/slots/header.js +194 -0
  173. package/dist/layouts/notebook/slots/sidebar.d.ts +30 -0
  174. package/dist/layouts/notebook/slots/sidebar.js +298 -0
  175. package/dist/layouts/shared/client.d.ts +44 -0
  176. package/dist/layouts/shared/client.js +84 -0
  177. package/dist/layouts/shared/index.d.ts +178 -0
  178. package/dist/layouts/shared/index.js +98 -0
  179. package/dist/layouts/shared/page-actions.d.ts +35 -0
  180. package/dist/layouts/shared/page-actions.js +195 -0
  181. package/dist/layouts/shared/slots/language-select.d.ts +18 -0
  182. package/dist/layouts/shared/slots/language-select.js +43 -0
  183. package/dist/layouts/shared/slots/search-trigger.d.ts +22 -0
  184. package/dist/layouts/shared/slots/search-trigger.js +53 -0
  185. package/dist/layouts/shared/slots/theme-switch.d.ts +13 -0
  186. package/dist/layouts/shared/slots/theme-switch.js +65 -0
  187. package/dist/legacy/layout.d.ts +36 -0
  188. package/dist/legacy/layout.js +44 -0
  189. package/dist/legacy/sidebar.d.ts +17 -0
  190. package/dist/legacy/sidebar.js +33 -0
  191. package/dist/mdx.d.ts +45 -0
  192. package/dist/mdx.js +70 -0
  193. package/dist/mdx.server.d.ts +15 -0
  194. package/dist/mdx.server.js +20 -0
  195. package/dist/node_modules/.bun/react-medium-image-zoom@5.4.8_7492c01c6988791b/node_modules/react-medium-image-zoom/dist/controlled.d.ts +31 -0
  196. package/dist/node_modules/.bun/react-medium-image-zoom@5.4.8_7492c01c6988791b/node_modules/react-medium-image-zoom/dist/controlled.js +461 -0
  197. package/dist/node_modules/.bun/react-medium-image-zoom@5.4.8_7492c01c6988791b/node_modules/react-medium-image-zoom/dist/index.d.ts +2 -0
  198. package/dist/node_modules/.bun/react-medium-image-zoom@5.4.8_7492c01c6988791b/node_modules/react-medium-image-zoom/dist/uncontrolled.d.ts +7 -0
  199. package/dist/node_modules/.bun/react-medium-image-zoom@5.4.8_7492c01c6988791b/node_modules/react-medium-image-zoom/dist/uncontrolled.js +17 -0
  200. package/dist/node_modules/.bun/react-medium-image-zoom@5.4.8_7492c01c6988791b/node_modules/react-medium-image-zoom/dist/utils/adjust-svg-ids.js +53 -0
  201. package/dist/node_modules/.bun/react-medium-image-zoom@5.4.8_7492c01c6988791b/node_modules/react-medium-image-zoom/dist/utils/compute-positioned-style.js +25 -0
  202. package/dist/node_modules/.bun/react-medium-image-zoom@5.4.8_7492c01c6988791b/node_modules/react-medium-image-zoom/dist/utils/element-tests.js +12 -0
  203. package/dist/node_modules/.bun/react-medium-image-zoom@5.4.8_7492c01c6988791b/node_modules/react-medium-image-zoom/dist/utils/get-div-img-style.js +45 -0
  204. package/dist/node_modules/.bun/react-medium-image-zoom@5.4.8_7492c01c6988791b/node_modules/react-medium-image-zoom/dist/utils/get-img-alt.js +8 -0
  205. package/dist/node_modules/.bun/react-medium-image-zoom@5.4.8_7492c01c6988791b/node_modules/react-medium-image-zoom/dist/utils/get-img-object-fit-style.js +55 -0
  206. package/dist/node_modules/.bun/react-medium-image-zoom@5.4.8_7492c01c6988791b/node_modules/react-medium-image-zoom/dist/utils/get-img-regular-style.js +21 -0
  207. package/dist/node_modules/.bun/react-medium-image-zoom@5.4.8_7492c01c6988791b/node_modules/react-medium-image-zoom/dist/utils/get-img-src.js +14 -0
  208. package/dist/node_modules/.bun/react-medium-image-zoom@5.4.8_7492c01c6988791b/node_modules/react-medium-image-zoom/dist/utils/get-modal-img-transform.js +22 -0
  209. package/dist/node_modules/.bun/react-medium-image-zoom@5.4.8_7492c01c6988791b/node_modules/react-medium-image-zoom/dist/utils/get-scale.js +27 -0
  210. package/dist/node_modules/.bun/react-medium-image-zoom@5.4.8_7492c01c6988791b/node_modules/react-medium-image-zoom/dist/utils/get-style-ghost.js +31 -0
  211. package/dist/node_modules/.bun/react-medium-image-zoom@5.4.8_7492c01c6988791b/node_modules/react-medium-image-zoom/dist/utils/get-style-modal-img.js +75 -0
  212. package/dist/node_modules/.bun/react-medium-image-zoom@5.4.8_7492c01c6988791b/node_modules/react-medium-image-zoom/dist/utils/get-target-dimension.js +4 -0
  213. package/dist/node_modules/.bun/react-medium-image-zoom@5.4.8_7492c01c6988791b/node_modules/react-medium-image-zoom/dist/utils/parse-position.js +7 -0
  214. package/dist/node_modules/.bun/react-medium-image-zoom@5.4.8_7492c01c6988791b/node_modules/react-medium-image-zoom/dist/utils/test-has-scalable-src.js +5 -0
  215. package/dist/og/takumi.d.ts +21 -0
  216. package/dist/og/takumi.js +91 -0
  217. package/dist/og.d.ts +22 -0
  218. package/dist/og.js +91 -0
  219. package/dist/page.d.ts +35 -0
  220. package/dist/page.js +33 -0
  221. package/dist/provider/base.d.ts +49 -0
  222. package/dist/provider/base.js +32 -0
  223. package/dist/provider/next.d.ts +20 -0
  224. package/dist/provider/next.js +17 -0
  225. package/dist/provider/react-router.d.ts +20 -0
  226. package/dist/provider/react-router.js +17 -0
  227. package/dist/provider/tanstack.d.ts +20 -0
  228. package/dist/provider/tanstack.js +17 -0
  229. package/dist/provider/waku.d.ts +20 -0
  230. package/dist/provider/waku.js +17 -0
  231. package/dist/style.css +3534 -0
  232. package/dist/tailwind/typography.d.ts +2 -0
  233. package/dist/tailwind/typography.js +2 -0
  234. package/dist/utils/cn.js +2 -0
  235. package/dist/utils/merge-refs.js +11 -0
  236. package/dist/utils/urls.js +15 -0
  237. package/dist/utils/use-copy-button.d.ts +6 -0
  238. package/dist/utils/use-copy-button.js +26 -0
  239. package/dist/utils/use-footer-items.d.ts +9 -0
  240. package/dist/utils/use-footer-items.js +24 -0
  241. package/dist/utils/use-is-scroll-top.d.ts +8 -0
  242. package/dist/utils/use-is-scroll-top.js +20 -0
  243. package/package.json +200 -0
@@ -0,0 +1,182 @@
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 { useDocsLayout } from "../../client.js";
9
+ import "../../index.js";
10
+ import { jsx, jsxs } from "react/jsx-runtime";
11
+ import { ChevronDown, Text } from "lucide-react";
12
+ import { createContext, use, useEffect, useEffectEvent, useMemo, useRef, useState } from "react";
13
+ import { useTranslations } from "@fuma-translate/react";
14
+ //#region src/layouts/docs/page/slots/toc.tsx
15
+ function TOCProvider(props) {
16
+ return /* @__PURE__ */ jsx(TOCProvider$1, { ...props });
17
+ }
18
+ function TOC({ container, header, footer, style = "normal", list }) {
19
+ const items = useTOCItems();
20
+ const t = useTranslations({ note: "table of contents" });
21
+ const { TOCItems, TOCEmpty, TOCItem } = style === "clerk" ? clerk_exports : default_exports;
22
+ if (items.length === 0 && !header && !footer) return /* @__PURE__ */ jsx("div", {
23
+ id: "nd-toc-placeholder",
24
+ className: "hidden xl:layout:[--fd-toc-width:268px]"
25
+ });
26
+ return /* @__PURE__ */ jsxs("div", {
27
+ id: "nd-toc",
28
+ ...container,
29
+ className: cn("sticky top-(--fd-docs-row-1) h-[calc(var(--fd-docs-height)-var(--fd-docs-row-1))] flex flex-col [grid-area:toc] w-(--fd-toc-width) pt-12 pe-4 pb-2 xl:layout:[--fd-toc-width:268px] max-xl:hidden", container?.className),
30
+ children: [
31
+ header,
32
+ /* @__PURE__ */ jsxs("h3", {
33
+ id: "toc-title",
34
+ className: "inline-flex items-center gap-1.5 text-sm text-fd-muted-foreground",
35
+ children: [/* @__PURE__ */ jsx(Text, { className: "size-4" }), t("On this page")]
36
+ }),
37
+ /* @__PURE__ */ jsx(TOCScrollArea, { children: /* @__PURE__ */ jsxs(TOCItems, {
38
+ ...list,
39
+ children: [items.length === 0 && /* @__PURE__ */ jsx(TOCEmpty, {}), items.map((item) => /* @__PURE__ */ jsx(TOCItem, { item }, item.url))]
40
+ }) }),
41
+ footer
42
+ ]
43
+ });
44
+ }
45
+ const TocPopoverContext = createContext(null);
46
+ function TOCPopover({ container, trigger, content, header, footer, style = "normal", list }) {
47
+ const items = useTOCItems();
48
+ const ref = useRef(null);
49
+ const [open, setOpen] = useState(false);
50
+ const { isNavTransparent } = useDocsLayout();
51
+ const { TOCItems, TOCItem, TOCEmpty } = style === "clerk" ? clerk_exports : default_exports;
52
+ const onClickOutside = useEffectEvent((e) => {
53
+ if (!open || !(e.target instanceof HTMLElement)) return;
54
+ if (ref.current && !ref.current.contains(e.target)) setOpen(false);
55
+ });
56
+ const onClickItem = () => {
57
+ setOpen(false);
58
+ };
59
+ useEffect(() => {
60
+ window.addEventListener("click", onClickOutside);
61
+ return () => {
62
+ window.removeEventListener("click", onClickOutside);
63
+ };
64
+ }, []);
65
+ return /* @__PURE__ */ jsx(TocPopoverContext, {
66
+ value: useMemo(() => ({
67
+ open,
68
+ setOpen
69
+ }), [setOpen, open]),
70
+ children: /* @__PURE__ */ jsx(Collapsible, {
71
+ open,
72
+ onOpenChange: setOpen,
73
+ "data-toc-popover": "",
74
+ ...container,
75
+ 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),
76
+ children: /* @__PURE__ */ jsxs("header", {
77
+ ref,
78
+ className: cn("border-b backdrop-blur-sm transition-colors", (!isNavTransparent || open) && "bg-fd-background/80", open && "shadow-lg"),
79
+ children: [/* @__PURE__ */ jsx(PageTOCPopoverTrigger, { ...trigger }), /* @__PURE__ */ jsxs(PageTOCPopoverContent, {
80
+ ...content,
81
+ children: [
82
+ header,
83
+ /* @__PURE__ */ jsx(TOCScrollArea, { children: /* @__PURE__ */ jsxs(TOCItems, {
84
+ ...list,
85
+ children: [items.length === 0 && /* @__PURE__ */ jsx(TOCEmpty, {}), items.map((item) => /* @__PURE__ */ jsx(TOCItem, {
86
+ item,
87
+ onClick: onClickItem
88
+ }, item.url))]
89
+ }) }),
90
+ footer
91
+ ]
92
+ })]
93
+ })
94
+ })
95
+ });
96
+ }
97
+ function PageTOCPopoverTrigger({ className, ...props }) {
98
+ const t = useTranslations({ note: "table of contents" });
99
+ const { open } = use(TocPopoverContext);
100
+ const items = useItems();
101
+ const selectedIdx = items.findIndex((item) => item.active);
102
+ const path = useTreePath().at(-1);
103
+ const showItem = selectedIdx !== -1 && !open;
104
+ return /* @__PURE__ */ jsxs(CollapsibleTrigger, {
105
+ 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),
106
+ "data-toc-popover-trigger": "",
107
+ ...props,
108
+ children: [
109
+ /* @__PURE__ */ jsx(ProgressCircle, {
110
+ value: (items.findLastIndex((item) => item.active) + 1) / Math.max(1, items.length),
111
+ max: 1,
112
+ className: cn("shrink-0", open && "text-fd-primary")
113
+ }),
114
+ /* @__PURE__ */ jsxs("span", {
115
+ className: "grid flex-1 *:my-auto *:row-start-1 *:col-start-1",
116
+ children: [/* @__PURE__ */ jsx("span", {
117
+ className: cn("truncate transition-[opacity,translate,color]", open && "text-fd-foreground", showItem && "opacity-0 -translate-y-full pointer-events-none"),
118
+ children: path?.name ?? t("On this page")
119
+ }), /* @__PURE__ */ jsx("span", {
120
+ className: cn("truncate transition-[opacity,translate]", !showItem && "opacity-0 translate-y-full pointer-events-none"),
121
+ children: items[selectedIdx]?.original.title
122
+ })]
123
+ }),
124
+ /* @__PURE__ */ jsx(ChevronDown, { className: cn("shrink-0 transition-transform mx-0.5", open && "rotate-180") })
125
+ ]
126
+ });
127
+ }
128
+ function clamp(input, min, max) {
129
+ if (input < min) return min;
130
+ if (input > max) return max;
131
+ return input;
132
+ }
133
+ function ProgressCircle({ value, strokeWidth = 1.5, size = 18, min = 0, max = 100, style, ...restSvgProps }) {
134
+ const normalizedValue = clamp(value, min, max);
135
+ const radius = size / 2 - strokeWidth;
136
+ const circumference = 2 * Math.PI * radius;
137
+ const progress = normalizedValue / max * circumference;
138
+ const circleProps = {
139
+ cx: size / 2,
140
+ cy: size / 2,
141
+ r: radius,
142
+ fill: "none",
143
+ strokeWidth
144
+ };
145
+ return /* @__PURE__ */ jsxs("svg", {
146
+ role: "progressbar",
147
+ viewBox: `0 0 ${size} ${size}`,
148
+ "aria-valuenow": normalizedValue,
149
+ "aria-valuemin": min,
150
+ "aria-valuemax": max,
151
+ style: {
152
+ width: size,
153
+ height: size,
154
+ ...style
155
+ },
156
+ ...restSvgProps,
157
+ children: [/* @__PURE__ */ jsx("circle", {
158
+ ...circleProps,
159
+ className: "stroke-current/25"
160
+ }), /* @__PURE__ */ jsx("circle", {
161
+ ...circleProps,
162
+ stroke: "currentColor",
163
+ strokeDasharray: circumference,
164
+ strokeDashoffset: circumference - progress,
165
+ strokeLinecap: "round",
166
+ transform: `rotate(-90 ${size / 2} ${size / 2})`,
167
+ className: "transition-all"
168
+ })]
169
+ });
170
+ }
171
+ function PageTOCPopoverContent(props) {
172
+ return /* @__PURE__ */ jsx(CollapsibleContent, {
173
+ "data-toc-popover-content": "",
174
+ ...props,
175
+ children: /* @__PURE__ */ jsx("div", {
176
+ className: "flex flex-col px-4 max-h-[50vh] md:px-6",
177
+ children: props.children
178
+ })
179
+ });
180
+ }
181
+ //#endregion
182
+ export { TOC, TOCPopover, TOCProvider };
@@ -0,0 +1,6 @@
1
+ import { ComponentProps } from "react";
2
+
3
+ //#region src/layouts/docs/slots/container.d.ts
4
+ declare function Container(props: ComponentProps<'div'>): import("react").JSX.Element;
5
+ //#endregion
6
+ export { Container };
@@ -0,0 +1,36 @@
1
+ "use client";
2
+ import { cn } from "../../../utils/cn.js";
3
+ import { useDocsLayout } from "../client.js";
4
+ import "../index.js";
5
+ import { jsx } from "react/jsx-runtime";
6
+ import { useEffect, useState } from "react";
7
+ //#region src/layouts/docs/slots/container.tsx
8
+ function Container(props) {
9
+ const { slots } = useDocsLayout();
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-docs-layout",
18
+ "data-sidebar-collapsed": collapsed,
19
+ "data-column-changed": isCollapseChanged,
20
+ ...props,
21
+ style: {
22
+ gridTemplate: `"sidebar sidebar header toc toc"
23
+ "sidebar sidebar toc-popover toc toc"
24
+ "sidebar sidebar main toc toc" 1fr / minmax(min-content, 1fr) var(--fd-sidebar-col) minmax(0, calc(var(--fd-layout-width,97rem) - var(--fd-sidebar-width) - var(--fd-toc-width))) var(--fd-toc-width) minmax(min-content, 1fr)`,
25
+ "--fd-docs-row-1": "var(--fd-banner-height, 0px)",
26
+ "--fd-docs-row-2": "calc(var(--fd-docs-row-1) + var(--fd-header-height))",
27
+ "--fd-docs-row-3": "calc(var(--fd-docs-row-2) + var(--fd-toc-popover-height))",
28
+ "--fd-sidebar-col": collapsed ? "0px" : "var(--fd-sidebar-width)",
29
+ ...props.style
30
+ },
31
+ className: cn("grid overflow-x-clip min-h-(--fd-docs-height) [--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),
32
+ children: props.children
33
+ });
34
+ }
35
+ //#endregion
36
+ export { Container };
@@ -0,0 +1,6 @@
1
+ import { ComponentProps } from "react";
2
+
3
+ //#region src/layouts/docs/slots/header.d.ts
4
+ declare function Header(props: ComponentProps<'header'>): string | number | bigint | true | import("react").JSX.Element | Iterable<import("react").ReactNode> | Promise<string | number | bigint | boolean | import("react").ReactPortal | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<import("react").ReactNode> | null | undefined>;
5
+ //#endregion
6
+ export { Header };
@@ -0,0 +1,38 @@
1
+ "use client";
2
+ import { cn } from "../../../utils/cn.js";
3
+ import { buttonVariants } from "../../../components/ui/button.js";
4
+ import { useDocsLayout } from "../client.js";
5
+ import { jsx, jsxs } from "react/jsx-runtime";
6
+ import { SidebarIcon } from "lucide-react";
7
+ //#region src/layouts/docs/slots/header.tsx
8
+ function Header(props) {
9
+ const { isNavTransparent, slots, props: { nav } } = useDocsLayout();
10
+ if (nav?.component) return nav.component;
11
+ return /* @__PURE__ */ jsxs("header", {
12
+ id: "nd-subnav",
13
+ "data-transparent": isNavTransparent,
14
+ ...props,
15
+ className: cn("[grid-area:header] sticky top-(--fd-docs-row-1) z-30 flex items-center ps-4 pe-2.5 border-b transition-colors backdrop-blur-sm h-(--fd-header-height) md:hidden max-md:layout:[--fd-header-height:--spacing(14)] data-[transparent=false]:bg-fd-background/80", props.className),
16
+ children: [
17
+ slots.navTitle && /* @__PURE__ */ jsx(slots.navTitle, { className: "inline-flex items-center gap-2.5 font-semibold" }),
18
+ /* @__PURE__ */ jsx("div", {
19
+ className: "flex-1",
20
+ children: nav?.children
21
+ }),
22
+ slots.searchTrigger && /* @__PURE__ */ jsx(slots.searchTrigger.sm, {
23
+ hideIfDisabled: true,
24
+ className: "p-2"
25
+ }),
26
+ slots.sidebar && /* @__PURE__ */ jsx(slots.sidebar.trigger, {
27
+ className: cn(buttonVariants({
28
+ color: "ghost",
29
+ size: "icon-sm",
30
+ className: "p-2"
31
+ })),
32
+ children: /* @__PURE__ */ jsx(SidebarIcon, {})
33
+ })
34
+ ]
35
+ });
36
+ }
37
+ //#endregion
38
+ export { Header };
@@ -0,0 +1,29 @@
1
+ import { SidebarProviderProps as SidebarProviderProps$1, useSidebar as useSidebar$1 } from "../../../components/sidebar/base.js";
2
+ import { SidebarPageTreeComponents } from "../../../components/sidebar/page-tree.js";
3
+ import { ComponentProps, ReactNode } from "react";
4
+
5
+ //#region src/layouts/docs/slots/sidebar.d.ts
6
+ interface SidebarProps extends ComponentProps<'aside'> {
7
+ components?: Partial<SidebarPageTreeComponents>;
8
+ banner?: ReactNode;
9
+ footer?: ReactNode;
10
+ /**
11
+ * Support collapsing the sidebar on desktop mode
12
+ *
13
+ * @defaultValue true
14
+ */
15
+ collapsible?: boolean;
16
+ }
17
+ type SidebarProviderProps = SidebarProviderProps$1;
18
+ declare const useSidebar: typeof useSidebar$1;
19
+ declare function SidebarProvider(props: SidebarProviderProps): import("react").JSX.Element;
20
+ declare function Sidebar({
21
+ footer,
22
+ banner,
23
+ collapsible,
24
+ components,
25
+ ...rest
26
+ }: SidebarProps): import("react").JSX.Element;
27
+ declare function SidebarTrigger(props: ComponentProps<'button'>): import("react").JSX.Element;
28
+ //#endregion
29
+ export { Sidebar, SidebarProps, SidebarProvider, SidebarProviderProps, SidebarTrigger, useSidebar };
@@ -0,0 +1,326 @@
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 { Popover, PopoverContent, PopoverTrigger } from "../../../components/ui/popover.js";
6
+ import { SearchTrigger } from "../../shared/slots/search-trigger.js";
7
+ import { LinkItem } from "../../shared/client.js";
8
+ import { isLayoutTabActive } from "../../shared/index.js";
9
+ 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";
10
+ import { createPageTreeRenderer } from "../../../components/sidebar/page-tree.js";
11
+ import { createLinkItemRenderer } from "../../../components/sidebar/link-item.js";
12
+ import { useDocsLayout } from "../client.js";
13
+ import Link from "fumadocs-core/link";
14
+ import { usePathname } from "fumadocs-core/framework";
15
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
16
+ import { Check, ChevronDown, ChevronsUpDown, Languages, SidebarIcon } from "lucide-react";
17
+ import { cva } from "class-variance-authority";
18
+ import { useMemo, useRef, useState } from "react";
19
+ //#region src/layouts/docs/slots/sidebar.tsx
20
+ 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: {
21
+ variant: {
22
+ 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",
23
+ button: "transition-colors hover:bg-fd-accent/50 hover:text-fd-accent-foreground/80 hover:transition-none"
24
+ },
25
+ 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" }
26
+ } });
27
+ const { useSidebar } = base_exports;
28
+ function SidebarProvider(props) {
29
+ return /* @__PURE__ */ jsx(SidebarProvider$1, { ...props });
30
+ }
31
+ function Sidebar({ footer, banner, collapsible = true, components, ...rest }) {
32
+ const { menuItems, slots, props: { tabs, nav, tabMode } } = useDocsLayout();
33
+ const iconLinks = menuItems.filter((item) => item.type === "icon");
34
+ const viewport = /* @__PURE__ */ jsxs(SidebarViewport, { children: [menuItems.filter((v) => v.type !== "icon").map((item, i, list) => /* @__PURE__ */ jsx(SidebarLinkItem, {
35
+ item,
36
+ className: cn(i === list.length - 1 && "mb-4")
37
+ }, i)), /* @__PURE__ */ jsx(SidebarPageTree, { ...components })] });
38
+ return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs(SidebarContent, {
39
+ ...rest,
40
+ children: [
41
+ /* @__PURE__ */ jsxs("div", {
42
+ className: "flex flex-col gap-3 p-4 pb-2",
43
+ children: [
44
+ /* @__PURE__ */ jsxs("div", {
45
+ className: "flex",
46
+ children: [
47
+ slots.navTitle && /* @__PURE__ */ jsx(slots.navTitle, { className: "inline-flex text-[0.9375rem] items-center gap-2.5 font-medium me-auto" }),
48
+ nav?.children,
49
+ collapsible && /* @__PURE__ */ jsx(SidebarCollapseTrigger, {
50
+ className: cn(buttonVariants({
51
+ color: "ghost",
52
+ size: "icon-sm",
53
+ className: "mb-auto text-fd-muted-foreground"
54
+ })),
55
+ children: /* @__PURE__ */ jsx(SidebarIcon, {})
56
+ })
57
+ ]
58
+ }),
59
+ slots.searchTrigger && /* @__PURE__ */ jsx(slots.searchTrigger.full, { hideIfDisabled: true }),
60
+ tabs.length > 0 && tabMode === "auto" && /* @__PURE__ */ jsx(SidebarTabsDropdown, { tabs }),
61
+ banner
62
+ ]
63
+ }),
64
+ viewport,
65
+ (slots.languageSelect || iconLinks.length > 0 || slots.themeSwitch || footer) && /* @__PURE__ */ jsxs("div", {
66
+ className: "flex flex-col p-4 pt-2",
67
+ children: [
68
+ slots.languageSelect && /* @__PURE__ */ jsxs(slots.languageSelect.root, {
69
+ variant: "secondary",
70
+ className: "text-fd-muted-foreground text-start justify-start bg-fd-secondary/50 mb-2",
71
+ children: [
72
+ /* @__PURE__ */ jsx(Languages, { className: "size-4.5" }),
73
+ /* @__PURE__ */ jsx(slots.languageSelect.text, {}),
74
+ /* @__PURE__ */ jsx(ChevronDown, { className: "ms-auto size-3.5" })
75
+ ]
76
+ }),
77
+ /* @__PURE__ */ jsxs("div", {
78
+ className: "flex text-fd-muted-foreground items-center border bg-fd-secondary/50 p-0.5 pe-0 rounded-lg empty:hidden",
79
+ children: [iconLinks.map((item, i) => /* @__PURE__ */ jsx(LinkItem, {
80
+ item,
81
+ className: cn(buttonVariants({
82
+ size: "icon-sm",
83
+ color: "ghost"
84
+ })),
85
+ "aria-label": item.label,
86
+ children: item.icon
87
+ }, i)), slots.themeSwitch && /* @__PURE__ */ jsx(slots.themeSwitch, { className: "px-1 py-0 border-y-0 border-e-0 rounded-none ms-auto *:rounded-md" })]
88
+ }),
89
+ footer
90
+ ]
91
+ })
92
+ ]
93
+ }), /* @__PURE__ */ jsxs(SidebarDrawer, { children: [
94
+ /* @__PURE__ */ jsxs("div", {
95
+ className: "flex flex-col gap-3 p-4 pb-2",
96
+ children: [
97
+ /* @__PURE__ */ jsxs("div", {
98
+ className: "flex text-fd-muted-foreground items-center gap-1.5",
99
+ children: [
100
+ /* @__PURE__ */ jsx("div", {
101
+ className: "flex flex-1",
102
+ children: iconLinks.map((item, i) => /* @__PURE__ */ jsx(LinkItem, {
103
+ item,
104
+ className: cn(buttonVariants({
105
+ size: "icon-sm",
106
+ color: "ghost",
107
+ className: "p-2"
108
+ })),
109
+ "aria-label": item.label,
110
+ children: item.icon
111
+ }, i))
112
+ }),
113
+ slots.languageSelect && /* @__PURE__ */ jsxs(slots.languageSelect.root, { children: [/* @__PURE__ */ jsx(Languages, { className: "size-4.5" }), /* @__PURE__ */ jsx(slots.languageSelect.text, {})] }),
114
+ slots.themeSwitch && /* @__PURE__ */ jsx(slots.themeSwitch, { className: "p-0" }),
115
+ /* @__PURE__ */ jsx(SidebarTrigger, {
116
+ className: cn(buttonVariants({
117
+ color: "ghost",
118
+ size: "icon-sm",
119
+ className: "p-2"
120
+ })),
121
+ children: /* @__PURE__ */ jsx(SidebarIcon, {})
122
+ })
123
+ ]
124
+ }),
125
+ tabs.length > 0 && /* @__PURE__ */ jsx(SidebarTabsDropdown, { tabs }),
126
+ banner
127
+ ]
128
+ }),
129
+ viewport,
130
+ /* @__PURE__ */ jsx("div", {
131
+ className: "flex flex-col border-t p-4 pt-2 empty:hidden",
132
+ children: footer
133
+ })
134
+ ] })] });
135
+ }
136
+ function SidebarFolder(props) {
137
+ return /* @__PURE__ */ jsx(SidebarFolder$1, { ...props });
138
+ }
139
+ function SidebarCollapseTrigger(props) {
140
+ return /* @__PURE__ */ jsx(SidebarCollapseTrigger$1, { ...props });
141
+ }
142
+ function SidebarTrigger(props) {
143
+ return /* @__PURE__ */ jsx(SidebarTrigger$1, { ...props });
144
+ }
145
+ function SidebarContent({ ref: refProp, className, children, ...props }) {
146
+ const ref = useRef(null);
147
+ return /* @__PURE__ */ jsx(SidebarContent$1, { children: ({ collapsed, hovered, ref: asideRef, ...rest }) => /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs("div", {
148
+ "data-sidebar-placeholder": "",
149
+ className: "sticky top-(--fd-docs-row-1) z-20 [grid-area:sidebar] pointer-events-none *:pointer-events-auto h-[calc(var(--fd-docs-height)-var(--fd-docs-row-1))] md:layout:[--fd-sidebar-width:268px] max-md:hidden",
150
+ children: [collapsed && /* @__PURE__ */ jsx("div", {
151
+ className: "absolute inset-s-0 inset-y-0 w-4",
152
+ ...rest
153
+ }), /* @__PURE__ */ jsx("aside", {
154
+ id: "nd-sidebar",
155
+ ref: mergeRefs(ref, refProp, asideRef),
156
+ "data-collapsed": collapsed,
157
+ "data-hovered": collapsed && hovered,
158
+ className: cn("absolute flex flex-col w-full inset-s-0 inset-y-0 items-end bg-fd-card text-sm border-e duration-250 *:w-(--fd-sidebar-width)", collapsed && ["inset-y-2 rounded-xl 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),
159
+ ...props,
160
+ ...rest,
161
+ children
162
+ })]
163
+ }), /* @__PURE__ */ jsxs("div", {
164
+ "data-sidebar-panel": "",
165
+ className: cn("fixed flex top-[calc(--spacing(4)+var(--fd-docs-row-3))] inset-s-4 shadow-lg transition-opacity rounded-xl p-0.5 border bg-fd-muted text-fd-muted-foreground z-10", (!collapsed || hovered) && "pointer-events-none opacity-0"),
166
+ children: [/* @__PURE__ */ jsx(SidebarCollapseTrigger$1, {
167
+ className: cn(buttonVariants({
168
+ color: "ghost",
169
+ size: "icon-sm",
170
+ className: "rounded-lg"
171
+ })),
172
+ children: /* @__PURE__ */ jsx(SidebarIcon, {})
173
+ }), /* @__PURE__ */ jsx(SearchTrigger, {
174
+ className: "rounded-lg",
175
+ hideIfDisabled: true
176
+ })]
177
+ })] }) });
178
+ }
179
+ function SidebarDrawer({ children, className, ...props }) {
180
+ 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, {
181
+ 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),
182
+ ...props,
183
+ children
184
+ })] });
185
+ }
186
+ function SidebarSeparator({ className, style, children, ...props }) {
187
+ const depth = useFolderDepth();
188
+ return /* @__PURE__ */ jsx(SidebarSeparator$1, {
189
+ className: cn("inline-flex items-center gap-2 mb-1 px-2 mt-6 empty:mb-0 [&_svg]:size-4 [&_svg]:shrink-0", depth === 0 && "first:mt-0", className),
190
+ style: {
191
+ paddingInlineStart: getItemOffset(depth),
192
+ ...style
193
+ },
194
+ ...props,
195
+ children
196
+ });
197
+ }
198
+ function SidebarItem({ className, style, children, ...props }) {
199
+ const depth = useFolderDepth();
200
+ return /* @__PURE__ */ jsx(SidebarItem$1, {
201
+ className: cn(itemVariants({
202
+ variant: "link",
203
+ highlight: depth >= 1
204
+ }), className),
205
+ style: {
206
+ paddingInlineStart: getItemOffset(depth),
207
+ ...style
208
+ },
209
+ ...props,
210
+ children
211
+ });
212
+ }
213
+ function SidebarFolderTrigger({ className, style, ...props }) {
214
+ const { depth, collapsible } = useFolder();
215
+ return /* @__PURE__ */ jsx(SidebarFolderTrigger$1, {
216
+ className: cn(itemVariants({ variant: collapsible ? "button" : null }), "w-full", className),
217
+ style: {
218
+ paddingInlineStart: getItemOffset(depth - 1),
219
+ ...style
220
+ },
221
+ ...props,
222
+ children: props.children
223
+ });
224
+ }
225
+ function SidebarFolderLink({ className, style, ...props }) {
226
+ const depth = useFolderDepth();
227
+ return /* @__PURE__ */ jsx(SidebarFolderLink$1, {
228
+ className: cn(itemVariants({
229
+ variant: "link",
230
+ highlight: depth > 1
231
+ }), "w-full", className),
232
+ style: {
233
+ paddingInlineStart: getItemOffset(depth - 1),
234
+ ...style
235
+ },
236
+ ...props,
237
+ children: props.children
238
+ });
239
+ }
240
+ function SidebarFolderContent({ className, children, ...props }) {
241
+ return /* @__PURE__ */ jsx(SidebarFolderContent$1, {
242
+ className: cn("relative", useFolderDepth() === 1 && "before:content-[''] before:absolute before:w-px before:inset-y-1 before:bg-fd-border before:inset-s-2.5", className),
243
+ ...props,
244
+ children: /* @__PURE__ */ jsx("div", {
245
+ className: "flex flex-col gap-0.5 pt-0.5",
246
+ children
247
+ })
248
+ });
249
+ }
250
+ function SidebarTabsDropdown({ tabs, placeholder, ...props }) {
251
+ const [open, setOpen] = useState(false);
252
+ const { closeOnRedirect } = useSidebar();
253
+ const pathname = usePathname();
254
+ const selected = useMemo(() => {
255
+ return tabs.findLast((item) => isLayoutTabActive(item, pathname));
256
+ }, [tabs, pathname]);
257
+ const onClick = () => {
258
+ closeOnRedirect.current = false;
259
+ setOpen(false);
260
+ };
261
+ const item = selected ? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("div", {
262
+ className: "size-9 shrink-0 empty:hidden md:size-5",
263
+ children: selected.icon
264
+ }), /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("p", {
265
+ className: "text-sm font-medium",
266
+ children: selected.title
267
+ }), /* @__PURE__ */ jsx("p", {
268
+ className: "text-sm text-fd-muted-foreground empty:hidden md:hidden",
269
+ children: selected.description
270
+ })] })] }) : placeholder;
271
+ return /* @__PURE__ */ jsxs(Popover, {
272
+ open,
273
+ onOpenChange: setOpen,
274
+ children: [item && /* @__PURE__ */ jsxs(PopoverTrigger, {
275
+ ...props,
276
+ className: cn("flex items-center gap-2 rounded-lg p-2 border bg-fd-secondary/50 text-start text-fd-secondary-foreground transition-colors hover:bg-fd-accent data-[state=open]:bg-fd-accent data-[state=open]:text-fd-accent-foreground", props.className),
277
+ children: [item, /* @__PURE__ */ jsx(ChevronsUpDown, { className: "shrink-0 ms-auto size-4 text-fd-muted-foreground" })]
278
+ }), /* @__PURE__ */ jsx(PopoverContent, {
279
+ className: "flex flex-col gap-1 w-(--radix-popover-trigger-width) p-1 fd-scroll-container",
280
+ children: tabs.map((item) => {
281
+ const isActive = selected && item.url === selected.url;
282
+ if (!isActive && item.unlisted) return;
283
+ return /* @__PURE__ */ jsxs(Link, {
284
+ href: item.url,
285
+ onClick,
286
+ ...item.props,
287
+ className: cn("flex items-center gap-2 rounded-lg p-1.5 hover:bg-fd-accent hover:text-fd-accent-foreground", item.props?.className),
288
+ children: [
289
+ /* @__PURE__ */ jsx("div", {
290
+ className: "shrink-0 size-9 md:mb-auto md:size-5 empty:hidden",
291
+ children: item.icon
292
+ }),
293
+ /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("p", {
294
+ className: "text-sm font-medium leading-none",
295
+ children: item.title
296
+ }), /* @__PURE__ */ jsx("p", {
297
+ className: "text-[0.8125rem] text-fd-muted-foreground mt-1 empty:hidden",
298
+ children: item.description
299
+ })] }),
300
+ /* @__PURE__ */ jsx(Check, { className: cn("shrink-0 ms-auto size-3.5 text-fd-primary", !isActive && "invisible") })
301
+ ]
302
+ }, item.url);
303
+ })
304
+ })]
305
+ });
306
+ }
307
+ function getItemOffset(depth) {
308
+ return `calc(${2 + 3 * depth} * var(--spacing))`;
309
+ }
310
+ const SidebarPageTree = createPageTreeRenderer({
311
+ SidebarFolder,
312
+ SidebarFolderContent,
313
+ SidebarFolderLink,
314
+ SidebarFolderTrigger,
315
+ SidebarItem,
316
+ SidebarSeparator
317
+ });
318
+ const SidebarLinkItem = createLinkItemRenderer({
319
+ SidebarFolder,
320
+ SidebarFolderContent,
321
+ SidebarFolderLink,
322
+ SidebarFolderTrigger,
323
+ SidebarItem
324
+ });
325
+ //#endregion
326
+ export { Sidebar, SidebarProvider, SidebarTrigger, useSidebar };