@zonsh/ui 0.0.0-stage → 0.2.0

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 (388) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +76 -2
  3. package/assets/illustrations/drawing/bracket-construction-dark.svg +77 -0
  4. package/assets/illustrations/drawing/bracket-construction-filled-dark.svg +50 -0
  5. package/assets/illustrations/drawing/bracket-construction-filled.svg +50 -0
  6. package/assets/illustrations/drawing/bracket-construction.svg +77 -0
  7. package/assets/illustrations/drawing/crescent-dark.svg +28 -0
  8. package/assets/illustrations/drawing/crescent-guides-dark.svg +33 -0
  9. package/assets/illustrations/drawing/crescent-guides.svg +33 -0
  10. package/assets/illustrations/drawing/crescent.svg +28 -0
  11. package/assets/illustrations/drawing/eclipse-dark.svg +187 -0
  12. package/assets/illustrations/drawing/eclipse-guides-dark.svg +191 -0
  13. package/assets/illustrations/drawing/eclipse-guides.svg +191 -0
  14. package/assets/illustrations/drawing/eclipse.svg +187 -0
  15. package/assets/illustrations/drawing/elevation-guides-dark.svg +31 -0
  16. package/assets/illustrations/drawing/elevation-guides-plain-dark.svg +9 -0
  17. package/assets/illustrations/drawing/elevation-guides-plain.svg +9 -0
  18. package/assets/illustrations/drawing/elevation-guides.svg +31 -0
  19. package/assets/illustrations/drawing/horizon-dark.svg +30 -0
  20. package/assets/illustrations/drawing/horizon.svg +30 -0
  21. package/assets/illustrations/drawing/nib-study-dark.svg +107 -0
  22. package/assets/illustrations/drawing/nib-study-plain-dark.svg +93 -0
  23. package/assets/illustrations/drawing/nib-study-plain.svg +93 -0
  24. package/assets/illustrations/drawing/nib-study.svg +107 -0
  25. package/assets/illustrations/editorial/assistant-640.webp +0 -0
  26. package/assets/illustrations/editorial/assistant.webp +0 -0
  27. package/assets/illustrations/editorial/automation-640.webp +0 -0
  28. package/assets/illustrations/editorial/automation.webp +0 -0
  29. package/assets/illustrations/editorial/bracket-left-640.webp +0 -0
  30. package/assets/illustrations/editorial/bracket-left.webp +0 -0
  31. package/assets/illustrations/editorial/bracket-right-640.webp +0 -0
  32. package/assets/illustrations/editorial/bracket-right.webp +0 -0
  33. package/assets/illustrations/editorial/custom-software-640.webp +0 -0
  34. package/assets/illustrations/editorial/custom-software.webp +0 -0
  35. package/assets/illustrations/editorial/digitalization-640.webp +0 -0
  36. package/assets/illustrations/editorial/digitalization.webp +0 -0
  37. package/assets/illustrations/editorial/integration-640.webp +0 -0
  38. package/assets/illustrations/editorial/integration.webp +0 -0
  39. package/assets/illustrations/editorial/problem-640.webp +0 -0
  40. package/assets/illustrations/editorial/problem.webp +0 -0
  41. package/assets/illustrations/editorial/process-analysis-640.webp +0 -0
  42. package/assets/illustrations/editorial/process-analysis.webp +0 -0
  43. package/assets/illustrations/editorial/process-concept-640.webp +0 -0
  44. package/assets/illustrations/editorial/process-concept.webp +0 -0
  45. package/assets/illustrations/editorial/process-development-640.webp +0 -0
  46. package/assets/illustrations/editorial/process-development.webp +0 -0
  47. package/assets/illustrations/editorial/process-discovery-640.webp +0 -0
  48. package/assets/illustrations/editorial/process-discovery.webp +0 -0
  49. package/assets/illustrations/editorial/process-maintenance-640.webp +0 -0
  50. package/assets/illustrations/editorial/process-maintenance.webp +0 -0
  51. package/assets/illustrations/editorial/process-prototype-640.webp +0 -0
  52. package/assets/illustrations/editorial/process-prototype.webp +0 -0
  53. package/assets/illustrations/editorial/process-testing-640.webp +0 -0
  54. package/assets/illustrations/editorial/process-testing.webp +0 -0
  55. package/assets/illustrations/iso/automation-dark.svg +6 -0
  56. package/assets/illustrations/iso/automation.svg +6 -0
  57. package/assets/illustrations/iso/bar-chart-dark.svg +6 -0
  58. package/assets/illustrations/iso/bar-chart.svg +6 -0
  59. package/assets/illustrations/iso/brackets-classic-dark.svg +6 -0
  60. package/assets/illustrations/iso/brackets-classic.svg +6 -0
  61. package/assets/illustrations/iso/brackets-dark.svg +6 -0
  62. package/assets/illustrations/iso/brackets.svg +6 -0
  63. package/assets/illustrations/iso/city-dark.svg +6 -0
  64. package/assets/illustrations/iso/city.svg +6 -0
  65. package/assets/illustrations/iso/conveyor-dark.svg +6 -0
  66. package/assets/illustrations/iso/conveyor.svg +6 -0
  67. package/assets/illustrations/iso/database-dark.svg +6 -0
  68. package/assets/illustrations/iso/database.svg +6 -0
  69. package/assets/illustrations/iso/documents-dark.svg +6 -0
  70. package/assets/illustrations/iso/documents.svg +6 -0
  71. package/assets/illustrations/iso/inbox-dark.svg +6 -0
  72. package/assets/illustrations/iso/inbox.svg +6 -0
  73. package/assets/illustrations/iso/laptop-dark.svg +6 -0
  74. package/assets/illustrations/iso/laptop.svg +6 -0
  75. package/assets/illustrations/iso/monitor-dark.svg +6 -0
  76. package/assets/illustrations/iso/monitor.svg +6 -0
  77. package/assets/illustrations/iso/pipeline-dark.svg +6 -0
  78. package/assets/illustrations/iso/pipeline.svg +6 -0
  79. package/assets/illustrations/iso/platform-dark.svg +6 -0
  80. package/assets/illustrations/iso/platform.svg +6 -0
  81. package/assets/illustrations/iso/server-dark.svg +6 -0
  82. package/assets/illustrations/iso/server.svg +6 -0
  83. package/assets/illustrations/iso/spreadsheet-dark.svg +6 -0
  84. package/assets/illustrations/iso/spreadsheet.svg +6 -0
  85. package/assets/illustrations/iso/timeline-dark.svg +6 -0
  86. package/assets/illustrations/iso/timeline.svg +6 -0
  87. package/assets/illustrations/sheet/construction.svg +115 -0
  88. package/assets/illustrations/sheet/crescent.svg +40 -0
  89. package/assets/illustrations/sheet/limb.svg +42 -0
  90. package/assets/illustrations/sheet/stress-axis.svg +119 -0
  91. package/assets/illustrations/sheet/totality.svg +215 -0
  92. package/assets/illustrations/sheet/vertical-metrics.svg +43 -0
  93. package/assets/logo-left.svg +1 -0
  94. package/assets/logo-right.svg +1 -0
  95. package/assets/logo.svg +1 -0
  96. package/dist/components/_overlay.d.ts +47 -0
  97. package/dist/components/_overlay.js +59 -0
  98. package/dist/components/accordion.d.ts +32 -0
  99. package/dist/components/accordion.js +39 -0
  100. package/dist/components/alert-dialog.d.ts +45 -0
  101. package/dist/components/alert-dialog.js +56 -0
  102. package/dist/components/alert.d.ts +35 -0
  103. package/dist/components/alert.js +42 -0
  104. package/dist/components/ascii-field.d.ts +34 -0
  105. package/dist/components/ascii-field.js +410 -0
  106. package/dist/components/aspect-ratio.d.ts +14 -0
  107. package/dist/components/aspect-ratio.js +17 -0
  108. package/dist/components/avatar.d.ts +42 -0
  109. package/dist/components/avatar.js +55 -0
  110. package/dist/components/badge.d.ts +70 -0
  111. package/dist/components/badge.js +62 -0
  112. package/dist/components/breadcrumb.d.ts +22 -0
  113. package/dist/components/breadcrumb.js +32 -0
  114. package/dist/components/button-group.d.ts +30 -0
  115. package/dist/components/button-group.js +47 -0
  116. package/dist/components/button.d.ts +53 -0
  117. package/dist/components/button.js +130 -0
  118. package/dist/components/calendar.d.ts +26 -0
  119. package/dist/components/calendar.js +164 -0
  120. package/dist/components/card.d.ts +42 -0
  121. package/dist/components/card.js +76 -0
  122. package/dist/components/carousel.d.ts +90 -0
  123. package/dist/components/carousel.js +213 -0
  124. package/dist/components/chart.d.ts +180 -0
  125. package/dist/components/chart.js +286 -0
  126. package/dist/components/checkbox.d.ts +23 -0
  127. package/dist/components/checkbox.js +43 -0
  128. package/dist/components/code-block.d.ts +45 -0
  129. package/dist/components/code-block.js +58 -0
  130. package/dist/components/code-highlight.d.ts +13 -0
  131. package/dist/components/code-highlight.js +107 -0
  132. package/dist/components/collapsible.d.ts +20 -0
  133. package/dist/components/collapsible.js +32 -0
  134. package/dist/components/color-picker.d.ts +85 -0
  135. package/dist/components/color-picker.js +407 -0
  136. package/dist/components/combobox.d.ts +81 -0
  137. package/dist/components/combobox.js +100 -0
  138. package/dist/components/command.d.ts +112 -0
  139. package/dist/components/command.js +212 -0
  140. package/dist/components/context-menu.d.ts +29 -0
  141. package/dist/components/context-menu.js +35 -0
  142. package/dist/components/conversation.d.ts +27 -0
  143. package/dist/components/conversation.js +293 -0
  144. package/dist/components/copy-button.d.ts +46 -0
  145. package/dist/components/copy-button.js +118 -0
  146. package/dist/components/data-table.d.ts +175 -0
  147. package/dist/components/data-table.js +302 -0
  148. package/dist/components/date-picker.d.ts +91 -0
  149. package/dist/components/date-picker.js +207 -0
  150. package/dist/components/dialog.d.ts +48 -0
  151. package/dist/components/dialog.js +92 -0
  152. package/dist/components/direction.d.ts +16 -0
  153. package/dist/components/direction.js +18 -0
  154. package/dist/components/drawer.d.ts +60 -0
  155. package/dist/components/drawer.js +76 -0
  156. package/dist/components/empty.d.ts +31 -0
  157. package/dist/components/empty.js +50 -0
  158. package/dist/components/feature-list.d.ts +54 -0
  159. package/dist/components/feature-list.js +43 -0
  160. package/dist/components/field.d.ts +15 -0
  161. package/dist/components/field.js +36 -0
  162. package/dist/components/file-drop.d.ts +55 -0
  163. package/dist/components/file-drop.js +197 -0
  164. package/dist/components/filter-bar.d.ts +106 -0
  165. package/dist/components/filter-bar.js +296 -0
  166. package/dist/components/form.d.ts +33 -0
  167. package/dist/components/form.js +34 -0
  168. package/dist/components/graph.d.ts +105 -0
  169. package/dist/components/graph.js +786 -0
  170. package/dist/components/illustration.d.ts +85 -0
  171. package/dist/components/illustration.js +165 -0
  172. package/dist/components/input-group.d.ts +127 -0
  173. package/dist/components/input-group.js +292 -0
  174. package/dist/components/input.d.ts +16 -0
  175. package/dist/components/input.js +25 -0
  176. package/dist/components/item.d.ts +64 -0
  177. package/dist/components/item.js +116 -0
  178. package/dist/components/kbd.d.ts +33 -0
  179. package/dist/components/kbd.js +38 -0
  180. package/dist/components/label.d.ts +12 -0
  181. package/dist/components/label.js +24 -0
  182. package/dist/components/layout.d.ts +136 -0
  183. package/dist/components/layout.js +162 -0
  184. package/dist/components/logo.d.ts +54 -0
  185. package/dist/components/logo.js +96 -0
  186. package/dist/components/menu.d.ts +60 -0
  187. package/dist/components/menu.js +138 -0
  188. package/dist/components/menubar.d.ts +62 -0
  189. package/dist/components/menubar.js +223 -0
  190. package/dist/components/message.d.ts +42 -0
  191. package/dist/components/message.js +56 -0
  192. package/dist/components/meter.d.ts +31 -0
  193. package/dist/components/meter.js +25 -0
  194. package/dist/components/native-select.d.ts +26 -0
  195. package/dist/components/native-select.js +35 -0
  196. package/dist/components/navigation-menu.d.ts +42 -0
  197. package/dist/components/navigation-menu.js +97 -0
  198. package/dist/components/number-field.d.ts +36 -0
  199. package/dist/components/number-field.js +153 -0
  200. package/dist/components/otp-field.d.ts +35 -0
  201. package/dist/components/otp-field.js +94 -0
  202. package/dist/components/pagination.d.ts +31 -0
  203. package/dist/components/pagination.js +70 -0
  204. package/dist/components/pdf-viewer.d.ts +69 -0
  205. package/dist/components/pdf-viewer.js +929 -0
  206. package/dist/components/popover.d.ts +33 -0
  207. package/dist/components/popover.js +48 -0
  208. package/dist/components/preview-card.d.ts +25 -0
  209. package/dist/components/preview-card.js +22 -0
  210. package/dist/components/progress.d.ts +27 -0
  211. package/dist/components/progress.js +23 -0
  212. package/dist/components/prompt-input.d.ts +131 -0
  213. package/dist/components/prompt-input.js +403 -0
  214. package/dist/components/quote.d.ts +22 -0
  215. package/dist/components/quote.js +15 -0
  216. package/dist/components/radio-group.d.ts +18 -0
  217. package/dist/components/radio-group.js +34 -0
  218. package/dist/components/reasoning.d.ts +31 -0
  219. package/dist/components/reasoning.js +70 -0
  220. package/dist/components/resizable.d.ts +38 -0
  221. package/dist/components/resizable.js +41 -0
  222. package/dist/components/response.d.ts +30 -0
  223. package/dist/components/response.js +538 -0
  224. package/dist/components/scroll-area.d.ts +33 -0
  225. package/dist/components/scroll-area.js +31 -0
  226. package/dist/components/select.d.ts +35 -0
  227. package/dist/components/select.js +60 -0
  228. package/dist/components/separator.d.ts +14 -0
  229. package/dist/components/separator.js +17 -0
  230. package/dist/components/sidebar.d.ts +147 -0
  231. package/dist/components/sidebar.js +489 -0
  232. package/dist/components/site-header.d.ts +59 -0
  233. package/dist/components/site-header.js +67 -0
  234. package/dist/components/skeleton.d.ts +31 -0
  235. package/dist/components/skeleton.js +29 -0
  236. package/dist/components/slider.d.ts +24 -0
  237. package/dist/components/slider.js +129 -0
  238. package/dist/components/sources.d.ts +25 -0
  239. package/dist/components/sources.js +35 -0
  240. package/dist/components/spinner.d.ts +36 -0
  241. package/dist/components/spinner.js +72 -0
  242. package/dist/components/suggestions.d.ts +20 -0
  243. package/dist/components/suggestions.js +18 -0
  244. package/dist/components/switch.d.ts +14 -0
  245. package/dist/components/switch.js +26 -0
  246. package/dist/components/table.d.ts +162 -0
  247. package/dist/components/table.js +758 -0
  248. package/dist/components/tabs.d.ts +25 -0
  249. package/dist/components/tabs.js +162 -0
  250. package/dist/components/tag.d.ts +41 -0
  251. package/dist/components/tag.js +88 -0
  252. package/dist/components/tags-input.d.ts +40 -0
  253. package/dist/components/tags-input.js +239 -0
  254. package/dist/components/textarea.d.ts +13 -0
  255. package/dist/components/textarea.js +16 -0
  256. package/dist/components/theme.d.ts +41 -0
  257. package/dist/components/theme.js +112 -0
  258. package/dist/components/time-field.d.ts +51 -0
  259. package/dist/components/time-field.js +437 -0
  260. package/dist/components/timeline.d.ts +76 -0
  261. package/dist/components/timeline.js +99 -0
  262. package/dist/components/toast.d.ts +72 -0
  263. package/dist/components/toast.js +196 -0
  264. package/dist/components/toggle-group.d.ts +41 -0
  265. package/dist/components/toggle-group.js +140 -0
  266. package/dist/components/toggle.d.ts +23 -0
  267. package/dist/components/toggle.js +35 -0
  268. package/dist/components/tool-call.d.ts +52 -0
  269. package/dist/components/tool-call.js +57 -0
  270. package/dist/components/toolbar.d.ts +17 -0
  271. package/dist/components/toolbar.js +34 -0
  272. package/dist/components/tooltip.d.ts +42 -0
  273. package/dist/components/tooltip.js +47 -0
  274. package/dist/components/tree.d.ts +75 -0
  275. package/dist/components/tree.js +636 -0
  276. package/dist/components/typography.d.ts +134 -0
  277. package/dist/components/typography.js +176 -0
  278. package/dist/components/video-player.d.ts +276 -0
  279. package/dist/components/video-player.js +1352 -0
  280. package/dist/components/whiteboard.d.ts +80 -0
  281. package/dist/components/whiteboard.js +389 -0
  282. package/dist/index.d.ts +85 -0
  283. package/dist/index.js +86 -0
  284. package/dist/lib/cn.d.ts +20 -0
  285. package/dist/lib/cn.js +38 -0
  286. package/dist/lib/code-highlight.d.ts +31 -0
  287. package/dist/lib/code-highlight.js +24 -0
  288. package/dist/lib/code-theme.d.ts +19 -0
  289. package/dist/lib/code-theme.js +140 -0
  290. package/dist/lib/collapse-row.d.ts +9 -0
  291. package/dist/lib/collapse-row.js +129 -0
  292. package/dist/lib/digit-roll.d.ts +21 -0
  293. package/dist/lib/digit-roll.js +31 -0
  294. package/dist/lib/editorial-assets.d.ts +16 -0
  295. package/dist/lib/editorial-assets.js +56 -0
  296. package/dist/lib/figure/catalog.d.ts +127 -0
  297. package/dist/lib/figure/catalog.js +130 -0
  298. package/dist/lib/figure/figures/automation.d.ts +7 -0
  299. package/dist/lib/figure/figures/automation.js +143 -0
  300. package/dist/lib/figure/figures/bar-chart.d.ts +7 -0
  301. package/dist/lib/figure/figures/bar-chart.js +99 -0
  302. package/dist/lib/figure/figures/brackets-classic.d.ts +11 -0
  303. package/dist/lib/figure/figures/brackets-classic.js +170 -0
  304. package/dist/lib/figure/figures/brackets.d.ts +8 -0
  305. package/dist/lib/figure/figures/brackets.js +84 -0
  306. package/dist/lib/figure/figures/city.d.ts +7 -0
  307. package/dist/lib/figure/figures/city.js +93 -0
  308. package/dist/lib/figure/figures/conveyor.d.ts +7 -0
  309. package/dist/lib/figure/figures/conveyor.js +97 -0
  310. package/dist/lib/figure/figures/database.d.ts +7 -0
  311. package/dist/lib/figure/figures/database.js +65 -0
  312. package/dist/lib/figure/figures/documents.d.ts +7 -0
  313. package/dist/lib/figure/figures/documents.js +83 -0
  314. package/dist/lib/figure/figures/inbox.d.ts +7 -0
  315. package/dist/lib/figure/figures/inbox.js +92 -0
  316. package/dist/lib/figure/figures/laptop.d.ts +7 -0
  317. package/dist/lib/figure/figures/laptop.js +67 -0
  318. package/dist/lib/figure/figures/monitor.d.ts +7 -0
  319. package/dist/lib/figure/figures/monitor.js +59 -0
  320. package/dist/lib/figure/figures/pipeline.d.ts +8 -0
  321. package/dist/lib/figure/figures/pipeline.js +117 -0
  322. package/dist/lib/figure/figures/platform.d.ts +7 -0
  323. package/dist/lib/figure/figures/platform.js +117 -0
  324. package/dist/lib/figure/figures/server.d.ts +7 -0
  325. package/dist/lib/figure/figures/server.js +115 -0
  326. package/dist/lib/figure/figures/spreadsheet.d.ts +7 -0
  327. package/dist/lib/figure/figures/spreadsheet.js +87 -0
  328. package/dist/lib/figure/figures/timeline.d.ts +7 -0
  329. package/dist/lib/figure/figures/timeline.js +65 -0
  330. package/dist/lib/figure/kernel.d.ts +152 -0
  331. package/dist/lib/figure/kernel.js +576 -0
  332. package/dist/lib/figure/parts.d.ts +42 -0
  333. package/dist/lib/figure/parts.js +126 -0
  334. package/dist/lib/form-reset.d.ts +11 -0
  335. package/dist/lib/form-reset.js +22 -0
  336. package/dist/lib/glide.d.ts +53 -0
  337. package/dist/lib/glide.js +138 -0
  338. package/dist/lib/graph-layout.d.ts +58 -0
  339. package/dist/lib/graph-layout.js +200 -0
  340. package/dist/lib/illustration-drawings.d.ts +89 -0
  341. package/dist/lib/illustration-drawings.js +539 -0
  342. package/dist/lib/illustration-info.d.ts +37 -0
  343. package/dist/lib/illustration-info.js +22 -0
  344. package/dist/lib/illustration-library.d.ts +87 -0
  345. package/dist/lib/illustration-library.js +352 -0
  346. package/dist/lib/logo-geometry.d.ts +29 -0
  347. package/dist/lib/logo-geometry.js +67 -0
  348. package/dist/lib/markdown-guard.d.ts +16 -0
  349. package/dist/lib/markdown-guard.js +123 -0
  350. package/dist/lib/merge-refs.d.ts +10 -0
  351. package/dist/lib/merge-refs.js +26 -0
  352. package/dist/lib/motion.d.ts +6 -0
  353. package/dist/lib/motion.js +12 -0
  354. package/dist/lib/pdf-worker.d.ts +1 -0
  355. package/dist/lib/pdf-worker.js +6 -0
  356. package/dist/lib/pdf.d.ts +19 -0
  357. package/dist/lib/pdf.js +58 -0
  358. package/dist/lib/platform.d.ts +33 -0
  359. package/dist/lib/platform.js +68 -0
  360. package/dist/lib/room.d.ts +25 -0
  361. package/dist/lib/room.js +46 -0
  362. package/dist/lib/table-fit.d.ts +143 -0
  363. package/dist/lib/table-fit.js +577 -0
  364. package/dist/lib/theme-script.d.ts +18 -0
  365. package/dist/lib/theme-script.js +29 -0
  366. package/dist/styles/expressive.css +188 -0
  367. package/dist/styles/fonts.css +145 -0
  368. package/dist/styles/index.css +206 -0
  369. package/dist/styles/material.css +313 -0
  370. package/dist/styles/parts/ai.css +360 -0
  371. package/dist/styles/parts/brand.css +75 -0
  372. package/dist/styles/parts/controls.css +725 -0
  373. package/dist/styles/parts/data.css +222 -0
  374. package/dist/styles/parts/editorial.css +120 -0
  375. package/dist/styles/parts/feedback.css +273 -0
  376. package/dist/styles/parts/foundations.css +166 -0
  377. package/dist/styles/parts/graph.css +214 -0
  378. package/dist/styles/parts/inputs.css +261 -0
  379. package/dist/styles/parts/isometric.css +124 -0
  380. package/dist/styles/parts/navigation.css +232 -0
  381. package/dist/styles/parts/overlays.css +250 -0
  382. package/dist/styles/parts/pdf.css +154 -0
  383. package/dist/styles/parts/react-flow.css +519 -0
  384. package/dist/styles/parts/whiteboard.css +855 -0
  385. package/dist/styles/tokens.css +290 -0
  386. package/dist/vite.d.ts +116 -0
  387. package/dist/vite.js +129 -0
  388. package/package.json +189 -3
@@ -0,0 +1,489 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { useRender } from "@base-ui/react/use-render";
4
+ import { PanelLeftIcon } from "lucide-react";
5
+ import * as React from "react";
6
+ import { cn } from "../lib/cn.js";
7
+ import { modPressed } from "../lib/platform.js";
8
+ import { Button } from "./button.js";
9
+ import { Drawer, DrawerContent, DrawerTitle } from "./drawer.js";
10
+ import { ScrollArea } from "./scroll-area.js";
11
+ import { Separator } from "./separator.js";
12
+ import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "./tooltip.js";
13
+ const SidebarContext = React.createContext(null);
14
+ /** The sidebar's density: `default` 38px rows, `sm` 30px rows (`Sidebar size`). */
15
+ const SidebarSizeContext = React.createContext("default");
16
+ /** Where a `Sidebar` is rendered: the desktop panel or the mobile sheet. */
17
+ const SidebarSurfaceContext = React.createContext("panel");
18
+ /**
19
+ * useSidebar — the app shell's state, for building your own trigger or reacting to collapse:
20
+ * `{ state, open, setOpen, openMobile, setOpenMobile, isMobile, toggleSidebar, collapsible }`.
21
+ * Must be used inside a `SidebarProvider`.
22
+ */
23
+ export function useSidebar() {
24
+ const context = React.useContext(SidebarContext);
25
+ if (!context)
26
+ throw new Error("useSidebar must be used within a <SidebarProvider />");
27
+ return context;
28
+ }
29
+ const MOBILE_QUERY = "(width < 48rem)";
30
+ const subscribeMobile = (onChange) => {
31
+ const mq = window.matchMedia(MOBILE_QUERY);
32
+ mq.addEventListener("change", onChange);
33
+ return () => mq.removeEventListener("change", onChange);
34
+ };
35
+ const useIsMobile = () => React.useSyncExternalStore(subscribeMobile, () => window.matchMedia(MOBILE_QUERY).matches, () => false);
36
+ function readStored(key) {
37
+ try {
38
+ const value = window.localStorage.getItem(key);
39
+ if (value === "true")
40
+ return true;
41
+ if (value === "false")
42
+ return false;
43
+ }
44
+ catch {
45
+ // Storage can be unavailable (private mode, blocked site data). The default stands.
46
+ }
47
+ return undefined;
48
+ }
49
+ function writeStored(key, open) {
50
+ try {
51
+ window.localStorage.setItem(key, String(open));
52
+ }
53
+ catch {
54
+ // Ignore: persistence is a convenience.
55
+ }
56
+ try {
57
+ // A cookie as well, so a server can read it and render the right state first time.
58
+ document.cookie = `${encodeURIComponent(key)}=${open}; path=/; max-age=${60 * 60 * 24 * 365}; SameSite=Lax`;
59
+ }
60
+ catch {
61
+ // Ignore.
62
+ }
63
+ }
64
+ /**
65
+ * SidebarProvider — turns a `Sidebar` into an app shell: open state, collapse (`offcanvas`,
66
+ * `icon` or `none`), ⌘B on a Mac and Ctrl+B elsewhere, a sheet on mobile and a remembered state.
67
+ *
68
+ * It renders the shell's flex row; put the `Sidebar` and a `SidebarInset` inside. The shell is
69
+ * at least the viewport tall (`min-h-svh`) — give it a fixed height (`h-[560px] min-h-0`) to
70
+ * embed it in a page. Widths come from `--sidebar-width` (16rem) and `--sidebar-width-icon`.
71
+ */
72
+ export function SidebarProvider({ defaultOpen = true, open: openProp, onOpenChange, collapsible = "offcanvas", storageKey = "zon-sidebar", keyboardShortcut = "b", className, style, children, ...props }) {
73
+ const isMobile = useIsMobile();
74
+ const [openMobile, setOpenMobile] = React.useState(false);
75
+ const [openState, setOpenState] = React.useState(defaultOpen);
76
+ const open = openProp ?? openState;
77
+ const openRef = React.useRef(open);
78
+ openRef.current = open;
79
+ const setOpen = React.useCallback((value) => {
80
+ if (openProp === undefined)
81
+ setOpenState(value);
82
+ onOpenChange?.(value);
83
+ if (storageKey)
84
+ writeStored(storageKey, value);
85
+ }, [openProp, onOpenChange, storageKey]);
86
+ // Restore the remembered state after hydration (uncontrolled only).
87
+ React.useEffect(() => {
88
+ if (openProp !== undefined || !storageKey)
89
+ return;
90
+ const stored = readStored(storageKey);
91
+ if (stored !== undefined)
92
+ setOpenState(stored);
93
+ }, [openProp, storageKey]);
94
+ const toggleSidebar = React.useCallback(() => {
95
+ if (isMobile)
96
+ setOpenMobile((value) => !value);
97
+ else
98
+ setOpen(!openRef.current);
99
+ }, [isMobile, setOpen]);
100
+ // Leaving the mobile layout closes the sheet: narrowing the window again must not reopen it.
101
+ if (!isMobile && openMobile)
102
+ setOpenMobile(false);
103
+ React.useEffect(() => {
104
+ if (!keyboardShortcut || collapsible === "none")
105
+ return;
106
+ const onKeyDown = (event) => {
107
+ // Autofill sends keydowns without a key. A key something else handled (an editor's bold),
108
+ // composing text, or held down is not the shortcut, nor is ⌘B / Ctrl+B in a contenteditable,
109
+ // where it is bold.
110
+ if (event.key?.toLowerCase() !== keyboardShortcut.toLowerCase())
111
+ return;
112
+ // ⌘ on Apple devices, Ctrl elsewhere, and not both: a Mac's Ctrl+B moves the caret back.
113
+ if (!modPressed(event) || event.altKey || event.shiftKey)
114
+ return;
115
+ if (event.defaultPrevented || event.isComposing || event.repeat)
116
+ return;
117
+ if (event.target instanceof HTMLElement && event.target.isContentEditable)
118
+ return;
119
+ event.preventDefault();
120
+ toggleSidebar();
121
+ };
122
+ window.addEventListener("keydown", onKeyDown);
123
+ return () => window.removeEventListener("keydown", onKeyDown);
124
+ }, [keyboardShortcut, collapsible, toggleSidebar]);
125
+ const value = React.useMemo(() => ({
126
+ state: open || collapsible === "none" ? "expanded" : "collapsed",
127
+ open,
128
+ setOpen,
129
+ openMobile,
130
+ setOpenMobile,
131
+ isMobile,
132
+ toggleSidebar,
133
+ collapsible,
134
+ }), [open, setOpen, openMobile, isMobile, toggleSidebar, collapsible]);
135
+ return (_jsx(SidebarContext.Provider, { value: value, children: _jsx(TooltipProvider, { children: _jsx("div", { "data-slot": "sidebar-wrapper", className: cn("flex min-h-svh w-full", className), style: {
136
+ "--sidebar-width": "16rem",
137
+ "--sidebar-width-icon": "calc(var(--control-h) + 25px)",
138
+ ...style,
139
+ }, ...props, children: children }) }) }));
140
+ }
141
+ /* ── The current row glides ──────────────────────────────────────────────── */
142
+ const ROW = '[data-slot="sidebar-item"]';
143
+ const CURRENT_ROW = `${ROW}[aria-current="page"]`;
144
+ /** An element's box relative to the nav's padding box, scrolled and transformed as it is on screen. */
145
+ function boxIn(nav, el) {
146
+ const r = el.getBoundingClientRect();
147
+ const n = nav.getBoundingClientRect();
148
+ return {
149
+ x: r.left - n.left - nav.clientLeft,
150
+ y: r.top - n.top - nav.clientTop,
151
+ w: r.width,
152
+ h: r.height,
153
+ };
154
+ }
155
+ /**
156
+ * When the current page changes, its raised row glides from the old row to the new one — across
157
+ * groups, and from the scrolling list to the footer. A copy of the row's material (this span,
158
+ * under the rows in the nav's own stacking context) makes the trip while the two real rows stay
159
+ * flat; on arrival the new row takes its own material again in the same frame. The first
160
+ * placement, a current row that was not on screen, and reduced motion set it in place.
161
+ */
162
+ function CurrentGlide() {
163
+ const ref = React.useRef(null);
164
+ React.useLayoutEffect(() => {
165
+ const ghost = ref.current;
166
+ const nav = ghost?.parentElement;
167
+ if (!ghost || !nav)
168
+ return;
169
+ let last = nav.querySelector(CURRENT_ROW);
170
+ let running = null;
171
+ const rows = new Set();
172
+ const box = (el) => boxIn(nav, el);
173
+ const shown = (el) => !!el && el.isConnected && el.offsetWidth > 0 && el.offsetHeight > 0;
174
+ const land = () => {
175
+ running = null;
176
+ ghost.style.visibility = "hidden";
177
+ // Back to their own material, without a transition: the copy is gone in the same frame.
178
+ for (const row of rows)
179
+ row.dataset.glide = "landing";
180
+ const landed = [...rows];
181
+ rows.clear();
182
+ requestAnimationFrame(() => requestAnimationFrame(() => landed.forEach((row) => row.dataset.glide === "landing" && delete row.dataset.glide)));
183
+ };
184
+ const move = () => {
185
+ const next = nav.querySelector(CURRENT_ROW);
186
+ if (next === last)
187
+ return;
188
+ const from = running ? box(ghost) : shown(last) ? box(last) : null;
189
+ const prev = last;
190
+ last = next;
191
+ running?.cancel();
192
+ if (!from || !shown(next) || window.matchMedia("(prefers-reduced-motion: reduce)").matches) {
193
+ if (running)
194
+ land();
195
+ return;
196
+ }
197
+ const to = box(next);
198
+ for (const row of [prev, next]) {
199
+ if (row) {
200
+ row.dataset.glide = "hidden";
201
+ rows.add(row);
202
+ }
203
+ }
204
+ ghost.style.visibility = "visible";
205
+ const duration = parseFloat(getComputedStyle(nav).getPropertyValue("--duration")) || 150;
206
+ const at = (b) => ({
207
+ translate: `${b.x}px ${b.y}px`,
208
+ width: `${b.w}px`,
209
+ height: `${b.h}px`,
210
+ });
211
+ running = ghost.animate([at(from), at(to)], {
212
+ duration: duration * 2,
213
+ easing: getComputedStyle(nav).getPropertyValue("--ease").trim() || "ease-out",
214
+ fill: "forwards",
215
+ });
216
+ running.onfinish = land;
217
+ };
218
+ const watch = new MutationObserver(move);
219
+ watch.observe(nav, {
220
+ subtree: true,
221
+ childList: true,
222
+ attributes: true,
223
+ attributeFilter: ["aria-current"],
224
+ });
225
+ return () => {
226
+ watch.disconnect();
227
+ running?.cancel();
228
+ for (const row of rows)
229
+ delete row.dataset.glide;
230
+ };
231
+ }, []);
232
+ return (_jsx("span", { ref: ref, "aria-hidden": true, "data-slot": "sidebar-current-glide", "data-current": "", className: "pointer-events-none invisible absolute top-0 left-0 -z-1 rounded-button material-row" }));
233
+ }
234
+ /**
235
+ * Hover is one soft fill that follows the pointer up and down the list instead of each row lighting
236
+ * on its own. It appears in place where the pointer comes in, glides from row to row (across the
237
+ * gap between groups too, within a short linger), and fades where it is when the pointer leaves.
238
+ * It sits under the rows and under the current row's material. Touch never shows it.
239
+ */
240
+ function HoverGlide() {
241
+ const ref = React.useRef(null);
242
+ React.useLayoutEffect(() => {
243
+ const fill = ref.current;
244
+ const nav = fill?.parentElement;
245
+ if (!fill || !nav)
246
+ return;
247
+ let row = null;
248
+ let linger = 0;
249
+ let frame = 0;
250
+ const hide = () => {
251
+ clearTimeout(linger);
252
+ linger = 0;
253
+ row = null;
254
+ // Fades out where it is.
255
+ delete fill.dataset.visible;
256
+ };
257
+ const place = () => {
258
+ if (!row)
259
+ return;
260
+ if (!row.isConnected || row.offsetWidth === 0)
261
+ return hide();
262
+ const b = boxIn(nav, row);
263
+ fill.style.translate = `${b.x}px ${b.y}px`;
264
+ fill.style.width = `${b.w}px`;
265
+ fill.style.height = `${b.h}px`;
266
+ };
267
+ const show = (next) => {
268
+ clearTimeout(linger);
269
+ linger = 0;
270
+ if (next === row)
271
+ return;
272
+ row = next;
273
+ if (fill.dataset.visible !== undefined)
274
+ return place();
275
+ // Coming in: jump to the row with no transition, then fade in there.
276
+ fill.dataset.instant = "";
277
+ place();
278
+ void fill.offsetWidth;
279
+ delete fill.dataset.instant;
280
+ fill.dataset.visible = "";
281
+ };
282
+ const over = (event) => {
283
+ if (event.pointerType === "touch")
284
+ return;
285
+ const next = event.target.closest(ROW);
286
+ if (next && nav.contains(next))
287
+ show(next);
288
+ else if (row && !linger)
289
+ linger = window.setTimeout(hide, 120);
290
+ };
291
+ const follow = () => {
292
+ cancelAnimationFrame(frame);
293
+ frame = requestAnimationFrame(place);
294
+ };
295
+ const resize = new ResizeObserver(follow);
296
+ resize.observe(nav);
297
+ nav.addEventListener("pointerover", over);
298
+ nav.addEventListener("pointerleave", hide);
299
+ // A scrolling list carries the row away; the fill goes with it.
300
+ nav.addEventListener("scroll", follow, true);
301
+ return () => {
302
+ clearTimeout(linger);
303
+ cancelAnimationFrame(frame);
304
+ resize.disconnect();
305
+ nav.removeEventListener("pointerover", over);
306
+ nav.removeEventListener("pointerleave", hide);
307
+ nav.removeEventListener("scroll", follow, true);
308
+ };
309
+ }, []);
310
+ return (_jsx("span", { ref: ref, "aria-hidden": true, "data-slot": "sidebar-hover-glide", className: cn("pointer-events-none absolute top-0 left-0 -z-1 rounded-button bg-(--ink-ghost) opacity-0 data-visible:opacity-100", "transition-[translate,width,height,opacity] duration-[calc(var(--duration)*1.4)] ease-brand data-instant:transition-none") }));
311
+ }
312
+ /**
313
+ * Sidebar — section navigation for docs, settings and dashboards.
314
+ *
315
+ * A `<nav>` of `SidebarGroup`s, each with an eyebrow `SidebarGroupLabel` and 38px
316
+ * `SidebarItem` rows at 12px radius. Rows are flat at rest, share one soft hover fill that glides
317
+ * with the pointer, and take the raised material when current. The rule people break: marking the current page with a flat fill or
318
+ * a bold weight. Set `current` (it writes `aria-current="page"`) and let the material show it.
319
+ * A sidebar never shows a scrollbar: a long one goes in `<ScrollArea scrollbar={false}>`.
320
+ *
321
+ * Inside a `SidebarProvider` it becomes the app shell's panel: a full-height column divided from
322
+ * the page by a hairline, holding `SidebarHeader`, `SidebarContent` and `SidebarFooter`. It
323
+ * collapses on desktop and turns into a sheet on mobile.
324
+ */
325
+ export function Sidebar({ side = "left", variant = "sidebar", size = "default", className, children, ...props }) {
326
+ const shell = React.useContext(SidebarContext);
327
+ const dense = size === "sm";
328
+ // Dense: every control inside (the rows, a search field, a header button) is 30px.
329
+ const sizeClass = dense ? "[--control-h:var(--control-h-sm)]" : undefined;
330
+ const content = (_jsxs(SidebarSizeContext.Provider, { value: size, children: [_jsx(HoverGlide, {}), _jsx(CurrentGlide, {}), children] }));
331
+ if (!shell) {
332
+ return (_jsx("nav", { "data-slot": "sidebar", "data-size": size, className: cn("relative isolate flex w-full flex-col", dense ? "gap-5" : "gap-7", sizeClass, className), ...props, children: content }));
333
+ }
334
+ const { state, collapsible, isMobile, openMobile, setOpenMobile } = shell;
335
+ // No fill beside the page: the page ground (the body's grain) runs under the sidebar too.
336
+ // isolate: the gliding current row paints under the rows but over the panel's own fill.
337
+ const panelClass = "isolate flex h-full flex-col font-body text-foreground";
338
+ if (collapsible === "none") {
339
+ return (_jsx("nav", { "data-slot": "sidebar", "data-side": side, "data-variant": variant, "data-size": size, "data-state": "expanded", className: cn(panelClass, sizeClass, "sticky top-0 h-svh max-h-full w-(--sidebar-width) shrink-0 border-border/60", variant !== "sidebar" ? undefined : side === "left" ? "border-e" : "border-s", className), ...props, children: content }));
340
+ }
341
+ if (isMobile) {
342
+ return (_jsx(Drawer, { side: side, open: openMobile, onOpenChange: setOpenMobile, children: _jsx(DrawerContent, { "data-slot": "sidebar-sheet", className: cn("w-[min(18rem,calc(100vw-3rem))] **:data-[slot=drawer-body]:gap-0 **:data-[slot=drawer-body]:p-0"), children: _jsxs(SidebarSurfaceContext.Provider, { value: "sheet", children: [_jsx(DrawerTitle, { className: "sr-only", children: props["aria-label"] ?? "Navigation" }), _jsx("nav", { "data-slot": "sidebar", "data-side": side, "data-size": size, className: cn(panelClass, "relative min-h-0 flex-1 bg-background", sizeClass, className), ...props, children: content })] }) }) }));
343
+ }
344
+ const offcanvas = state === "collapsed" && collapsible === "offcanvas";
345
+ return (_jsx("div", { "data-slot": "sidebar-shell", "data-variant": variant, "data-size": size, style: dense
346
+ ? { "--sidebar-width-icon": "calc(var(--control-h-sm) + 25px)" }
347
+ : undefined, "data-state": state, "data-collapsible": state === "collapsed" ? collapsible : undefined, "data-side": side, className: cn("group/sidebar sticky top-0 hidden h-svh max-h-full w-(--sidebar-width) shrink-0 overflow-clip md:block", "transition-[width] duration-(--duration) ease-brand", "data-[collapsible=icon]:w-(--sidebar-width-icon) data-[collapsible=offcanvas]:w-0"), children: _jsx("nav", { "data-slot": "sidebar", "data-side": side, "data-size": size, inert: offcanvas || undefined, className: cn(panelClass, sizeClass, "absolute inset-y-0 w-(--sidebar-width) border-border/60 transition-[width] duration-(--duration) ease-brand", "group-data-[collapsible=icon]/sidebar:w-(--sidebar-width-icon)", side === "left" ? "left-0" : "right-0", variant !== "sidebar" ? undefined : side === "left" ? "border-e" : "border-s", className), ...props, children: content }) }));
348
+ }
349
+ /** The top of an app-shell sidebar: a logo, a workspace switcher, a search row. Never scrolls. */
350
+ export function SidebarHeader({ className, ...props }) {
351
+ const dense = React.useContext(SidebarSizeContext) === "sm";
352
+ return (_jsx("div", { "data-slot": "sidebar-header", className: cn("flex shrink-0 flex-col px-3", dense ? "gap-1.5 pt-3 pb-1.5" : "gap-2 pt-4 pb-2", className), ...props }));
353
+ }
354
+ /** The bottom of an app-shell sidebar: the account, settings, help. Never scrolls. */
355
+ export function SidebarFooter({ className, ...props }) {
356
+ const dense = React.useContext(SidebarSizeContext) === "sm";
357
+ return (_jsx("div", { "data-slot": "sidebar-footer", className: cn("mt-auto flex shrink-0 flex-col px-3", dense ? "gap-1.5 pt-1.5 pb-3" : "gap-2 pt-2 pb-4", className), ...props }));
358
+ }
359
+ /**
360
+ * The scrolling middle of an app-shell sidebar, holding the `SidebarGroup`s 28px apart. It is a
361
+ * `ScrollArea` with `scrollbar={false}`: it scrolls, never shows a bar, and fades at the edges.
362
+ */
363
+ export function SidebarContent({ className, contentClassName, ...props }) {
364
+ const dense = React.useContext(SidebarSizeContext) === "sm";
365
+ return (_jsx(ScrollArea, { "data-slot": "sidebar-content", scrollbar: false, className: cn("min-h-0 flex-1", className), contentClassName: cn("flex flex-col px-3", dense ? "gap-5 py-2" : "gap-7 py-3", contentClassName), ...props }));
366
+ }
367
+ /** A hairline between the header, content and footer, inset 12px to line up with the rows. Inside `SidebarContent` pass `mx-0`. */
368
+ export function SidebarSeparator({ className, ...props }) {
369
+ return (_jsx(Separator, { "data-slot": "sidebar-separator", className: cn("mx-3 my-1 data-[orientation=horizontal]:w-auto", className), ...props }));
370
+ }
371
+ /* ── Groups and rows ───────────────────────────────────────────────────────── */
372
+ /** A labelled group of rows. Pair it with a `SidebarGroupLabel`. */
373
+ export function SidebarGroup({ className, ...props }) {
374
+ return _jsx("div", { "data-slot": "sidebar-group", className: cn("flex flex-col gap-0.5", className), ...props });
375
+ }
376
+ /**
377
+ * The eyebrow above a group: 12px mono, uppercase, 0.18em tracking. In the icon rail it fades
378
+ * and folds away with the panel's width (a negative margin of its own fixed height), so the rows
379
+ * glide up instead of jumping; screen readers still hear it.
380
+ */
381
+ export function SidebarGroupLabel({ className, ...props }) {
382
+ const dense = React.useContext(SidebarSizeContext) === "sm";
383
+ return (_jsx("div", { "data-slot": "sidebar-group-label", className: cn("overflow-hidden eyebrow whitespace-nowrap transition-[margin,opacity] duration-(--duration) ease-brand", "group-data-[collapsible=icon]/sidebar:pointer-events-none group-data-[collapsible=icon]/sidebar:opacity-0",
384
+ // Fixed heights (line + padding) so the fold is exact: 16 + 8 = 24px, dense 14 + 6 = 20px.
385
+ dense
386
+ ? "px-2.5 pb-1.5 text-[11px] leading-[14px] group-data-[collapsible=icon]/sidebar:-mt-5"
387
+ : "px-3 pb-2 leading-4 group-data-[collapsible=icon]/sidebar:-mt-6", className), ...props }));
388
+ }
389
+ function textOf(node) {
390
+ if (typeof node === "string" || typeof node === "number")
391
+ return String(node);
392
+ if (Array.isArray(node))
393
+ return node.map(textOf).join("");
394
+ return "";
395
+ }
396
+ /**
397
+ * One navigation row. Renders an `<a>`; pass `render={<Link to="…" />}` for router links.
398
+ * Leading icons are 16px; a trailing `Kbd`, `Tag` or `SidebarMenuBadge` is pushed to the end
399
+ * with `ml-auto`. In an icon-collapsed app shell it shrinks to a 38px square with a tooltip.
400
+ */
401
+ export function SidebarItem({ current, tooltip, render, ref, className, children, onClick, ...props }) {
402
+ const shell = React.useContext(SidebarContext);
403
+ const surface = React.useContext(SidebarSurfaceContext);
404
+ const dense = React.useContext(SidebarSizeContext) === "sm";
405
+ const inShell = shell !== null;
406
+ const element = useRender({
407
+ defaultTagName: "a",
408
+ render,
409
+ ref,
410
+ props: {
411
+ "data-slot": "sidebar-item",
412
+ "aria-current": current ? "page" : undefined,
413
+ ...props,
414
+ onClick: (event) => {
415
+ onClick?.(event);
416
+ // A link chosen in the mobile sheet closes it — also when its handler prevented the
417
+ // default to route on the client. Another row (a button that opens a menu) keeps the
418
+ // sheet open by preventing the default.
419
+ const link = event.currentTarget instanceof HTMLAnchorElement && event.currentTarget.hasAttribute("href");
420
+ if ((link || !event.defaultPrevented) && surface === "sheet" && shell)
421
+ shell.setOpenMobile(false);
422
+ },
423
+ className: cn(
424
+ // cursor-pointer: rows may render as a <button> (theme switch, account menu), which has no pointer by default.
425
+ "flex min-h-(--control-h) w-full cursor-pointer items-center rounded-button material-row font-body leading-none no-underline focus-ring select-none", dense ? "gap-2 px-2.5 text-[13px]" : "gap-2.5 px-3 text-sm", "aria-disabled:pointer-events-none aria-disabled:opacity-50",
426
+ // Hover is quieter than current: the label brightens over the sidebar's gliding fill (HoverGlide),
427
+ // the row itself takes no fill, edge or shadow. The raised row means "you are here".
428
+ "hover:not-aria-[current=page]:bg-transparent! hover:not-aria-[current=page]:bg-none! hover:not-aria-[current=page]:shadow-none!",
429
+ // While the current row glides (CurrentGlide), the old and new rows stay flat.
430
+ "data-glide:transition-none! data-[glide=hidden]:bg-transparent! data-[glide=hidden]:bg-none! data-[glide=hidden]:shadow-none!", "[&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", inShell && "overflow-hidden whitespace-nowrap", inShell &&
431
+ // A square in the icon rail with the 16px icon centred: (row - icon - border) / 2 a side.
432
+ "group-data-[collapsible=icon]/sidebar:size-(--control-h) group-data-[collapsible=icon]/sidebar:px-[calc((var(--control-h)-18px)/2)]", className),
433
+ children,
434
+ },
435
+ });
436
+ if (!shell || tooltip === false)
437
+ return element;
438
+ const iconRail = !shell.isMobile && shell.state === "collapsed" && shell.collapsible === "icon";
439
+ const label = tooltip ?? textOf(children);
440
+ if (!label)
441
+ return element;
442
+ return (_jsxs(Tooltip, { disabled: !iconRail, children: [_jsx(TooltipTrigger, { render: element }), _jsx(TooltipContent, { side: "right", align: "center", sideOffset: 10, children: label })] }));
443
+ }
444
+ /** A count at the end of a row ("12"): mono, tabular, muted. Hidden in the icon rail. */
445
+ export function SidebarMenuBadge({ className, ...props }) {
446
+ return (_jsx("span", { "data-slot": "sidebar-menu-badge", className: cn("ml-auto pl-2 font-mono text-xs leading-none text-muted-foreground tabular-nums group-data-[collapsible=icon]/sidebar:hidden", className), ...props }));
447
+ }
448
+ /* ── Controls ──────────────────────────────────────────────────────────────── */
449
+ /**
450
+ * The button that opens and closes the sidebar: a circular ghost icon button, usually first in
451
+ * the inset's toolbar. On mobile it opens the sheet. Shows the ⌘B / Ctrl+B shortcut's action.
452
+ */
453
+ export function SidebarTrigger({ variant = "ghost", size = "icon", className, children, onClick, ...props }) {
454
+ const { toggleSidebar, isMobile, open, openMobile } = useSidebar();
455
+ return (_jsx(Button, { "data-slot": "sidebar-trigger", variant: variant, size: size, "aria-label": "Toggle sidebar", "aria-expanded": isMobile ? openMobile : open, className: cn("text-muted-foreground",
456
+ // The circle pads its glyph by ~10px; pull what follows in, and give a separator after
457
+ // it a little more room, so the gaps either side of the separator read the same.
458
+ size === "icon" && "-mr-1.5 [&+[data-slot=separator]]:mr-1", size === "icon-sm" && "-mr-1 [&+[data-slot=separator]]:mr-0.75", className), onClick: (event) => {
459
+ onClick?.(event);
460
+ if (!event.defaultPrevented)
461
+ toggleSidebar();
462
+ }, ...props, children: children ?? _jsx(PanelLeftIcon, { "aria-hidden": true }) }));
463
+ }
464
+ /**
465
+ * A thin strip along the sidebar's inner edge: hover shows the hairline in `--control-focus`,
466
+ * click toggles the sidebar. A pointer convenience — keyboard users have the trigger and ⌘B.
467
+ */
468
+ export function SidebarRail({ className, onClick, ...props }) {
469
+ const { toggleSidebar, state, isMobile, collapsible } = useSidebar();
470
+ const surface = React.useContext(SidebarSurfaceContext);
471
+ if (isMobile || surface === "sheet" || collapsible === "none")
472
+ return null;
473
+ return (_jsx("button", { type: "button", "data-slot": "sidebar-rail", "aria-label": "Toggle sidebar", title: "Toggle sidebar", tabIndex: -1, onClick: (event) => {
474
+ onClick?.(event);
475
+ if (!event.defaultPrevented)
476
+ toggleSidebar();
477
+ }, className: cn("absolute inset-y-0 z-20 w-2 border-0 bg-transparent p-0 outline-none", "after:absolute after:inset-y-0 after:w-px after:bg-transparent after:transition-[background-color] after:duration-(--duration) after:ease-brand after:content-[''] hover:after:bg-control-focus", "group-data-[side=left]/sidebar:right-0 group-data-[side=right]/sidebar:left-0 group-data-[side=left]/sidebar:after:right-[-1px] group-data-[side=right]/sidebar:after:left-[-1px]", state === "expanded"
478
+ ? "group-data-[side=left]/sidebar:cursor-w-resize group-data-[side=right]/sidebar:cursor-e-resize"
479
+ : "group-data-[side=left]/sidebar:cursor-e-resize group-data-[side=right]/sidebar:cursor-w-resize", className), ...props }));
480
+ }
481
+ /**
482
+ * The main area beside an app-shell sidebar: a `<main>` column that takes the remaining width.
483
+ * Put a toolbar row (with `SidebarTrigger`) first, then the page. Beside a `variant="inset"`
484
+ * sidebar it becomes a raised 20px panel with an 8px margin (styles in parts/navigation.css).
485
+ * Otherwise it has no fill of its own: the page ground shows through.
486
+ */
487
+ export function SidebarInset({ className, ...props }) {
488
+ return (_jsx("main", { "data-slot": "sidebar-inset", className: cn("relative flex min-w-0 flex-1 flex-col", className), ...props }));
489
+ }
@@ -0,0 +1,59 @@
1
+ import * as React from "react";
2
+ /** A page inside a `SiteHeaderLink`'s dropdown panel. */
3
+ export interface SiteHeaderLinkItem {
4
+ label: React.ReactNode;
5
+ /** Where the page is. */
6
+ href: string;
7
+ /** One short line under the label in the panel. */
8
+ description?: React.ReactNode;
9
+ /** Marks the current page (`aria-current="page"`). */
10
+ current?: boolean;
11
+ /** A router link element, e.g. `<Link to="/pricing" />`, for client-side navigation. */
12
+ render?: React.ReactElement;
13
+ }
14
+ /** One top-level entry: a link (`href`), or a dropdown panel of pages (`items`). */
15
+ export interface SiteHeaderLink {
16
+ label: React.ReactNode;
17
+ /** Where the entry goes. Required unless the entry opens a panel of `items`. */
18
+ href?: string;
19
+ /** Marks the current page (`aria-current="page"`). */
20
+ current?: boolean;
21
+ /** Pages shown in a `NavigationMenu` panel. The entry becomes a trigger instead of a link. */
22
+ items?: SiteHeaderLinkItem[];
23
+ /** A router link element, e.g. `<Link to="/pricing" />`, for client-side navigation. */
24
+ render?: React.ReactElement;
25
+ }
26
+ export interface SiteHeaderProps extends Omit<React.ComponentProps<"header">, "children"> {
27
+ /** The lockup at the start: left, or right on a right-to-left page. Link it to the home page yourself. */
28
+ logo: React.ReactNode;
29
+ /** Primary navigation, in order, about five links: e.g. "Product", "Docs", "Pricing", "Blog", "About". */
30
+ links: SiteHeaderLink[];
31
+ /** Right-most slot, after the hairline divider: locale switch, theme toggle, one CTA at most. */
32
+ actions?: React.ReactNode;
33
+ /**
34
+ * Force the scrolled treatment (background/80, blur, hairline). By default it switches on
35
+ * once the window scrolls past `scrollThreshold`.
36
+ */
37
+ scrolled?: boolean;
38
+ /** Pixels of scroll before the header gains its background. Defaults to 8. */
39
+ scrollThreshold?: number;
40
+ /** Accessible name of the `<nav>`. Defaults to "Main". */
41
+ navLabel?: string;
42
+ /** Accessible names for the mobile menu buttons. */
43
+ menuLabels?: {
44
+ open?: string;
45
+ close?: string;
46
+ title?: string;
47
+ };
48
+ }
49
+ /**
50
+ * SiteHeader — the sticky top bar of an zon site, composed from `NavigationMenu`.
51
+ *
52
+ * `NavigationMenu` is the primitive (links, triggers, the shared dropdown popup); SiteHeader
53
+ * is the pattern around it: logo left; the menu, a hairline divider and an actions slot right;
54
+ * transparent at the top of the page, `background/80` with a backdrop blur and a hairline once
55
+ * the page scrolls; and below `md` a full-height panel opened by a menu button. Give an entry
56
+ * `items` and it opens a dropdown panel. The rule people break: filling the bar with buttons.
57
+ * One CTA at most — the links are the navigation, the actions slot is for locale and theme.
58
+ */
59
+ export declare function SiteHeader({ logo, links, actions, scrolled: scrolledProp, scrollThreshold, navLabel, menuLabels, className, dir, ...props }: SiteHeaderProps): React.JSX.Element;
@@ -0,0 +1,67 @@
1
+ "use client";
2
+ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { Dialog as BaseDialog } from "@base-ui/react/dialog";
4
+ import { useRender } from "@base-ui/react/use-render";
5
+ import { MenuIcon, XIcon } from "lucide-react";
6
+ import * as React from "react";
7
+ import { cn } from "../lib/cn.js";
8
+ import { usePopupDir } from "./_overlay.js";
9
+ import { Button } from "./button.js";
10
+ import { NavigationMenu, NavigationMenuContent, NavigationMenuItem, NavigationMenuLink, NavigationMenuList, NavigationMenuTrigger, } from "./navigation-menu.js";
11
+ /** A link in the mobile panel: a plain `<a>`, or the entry's router link through `render`. */
12
+ function PanelLink({ render, href, ...props }) {
13
+ return useRender({
14
+ defaultTagName: "a",
15
+ render,
16
+ props: { ...props, href: render ? undefined : href },
17
+ });
18
+ }
19
+ function useScrolled(threshold, forced) {
20
+ const [scrolled, setScrolled] = React.useState(false);
21
+ React.useEffect(() => {
22
+ if (forced !== undefined || typeof window === "undefined")
23
+ return;
24
+ const update = () => setScrolled(window.scrollY > threshold);
25
+ update();
26
+ window.addEventListener("scroll", update, { passive: true });
27
+ return () => window.removeEventListener("scroll", update);
28
+ }, [threshold, forced]);
29
+ return forced ?? scrolled;
30
+ }
31
+ /**
32
+ * SiteHeader — the sticky top bar of an zon site, composed from `NavigationMenu`.
33
+ *
34
+ * `NavigationMenu` is the primitive (links, triggers, the shared dropdown popup); SiteHeader
35
+ * is the pattern around it: logo left; the menu, a hairline divider and an actions slot right;
36
+ * transparent at the top of the page, `background/80` with a backdrop blur and a hairline once
37
+ * the page scrolls; and below `md` a full-height panel opened by a menu button. Give an entry
38
+ * `items` and it opens a dropdown panel. The rule people break: filling the bar with buttons.
39
+ * One CTA at most — the links are the navigation, the actions slot is for locale and theme.
40
+ */
41
+ export function SiteHeader({ logo, links, actions, scrolled: scrolledProp, scrollThreshold = 8, navLabel = "Main", menuLabels, className, dir, ...props }) {
42
+ const scrolled = useScrolled(scrollThreshold, scrolledProp);
43
+ const [open, setOpen] = React.useState(false);
44
+ // The phone panel is portalled out of the page: it takes the header's direction itself.
45
+ const panelDir = usePopupDir(dir);
46
+ const headerRef = React.useRef(null);
47
+ const menuButtonRef = React.useRef(null);
48
+ // The header switches by its own width, not the window's: a container query hides the menu
49
+ // button from 48rem of header up. Close the panel once the header grows past that and the
50
+ // button is gone.
51
+ React.useEffect(() => {
52
+ const header = headerRef.current;
53
+ if (!open || !header || typeof ResizeObserver === "undefined")
54
+ return;
55
+ const observer = new ResizeObserver(() => {
56
+ const button = menuButtonRef.current;
57
+ if (button && getComputedStyle(button).display === "none")
58
+ setOpen(false);
59
+ });
60
+ observer.observe(header);
61
+ return () => observer.disconnect();
62
+ }, [open]);
63
+ return (_jsx("header", { ref: headerRef, "data-slot": "site-header", "data-scrolled": scrolled ? "" : undefined, dir: dir, className: cn("@container/site-header sticky top-0 z-40 w-full border-b border-transparent", "transition-[background-color,border-color,backdrop-filter] duration-(--duration) ease-(--ease)", "data-scrolled:border-border/60 data-scrolled:bg-background/80 data-scrolled:backdrop-blur-md", className), ...props, children: _jsxs("div", { className: "container-page flex min-h-16 items-center justify-between gap-6", children: [_jsx("div", { "data-slot": "site-header-logo", className: "flex shrink-0 items-center", children: logo }), _jsxs("div", { className: "hidden items-center gap-4 @3xl/site-header:flex", children: [_jsx(NavigationMenu, { "aria-label": navLabel, children: _jsx(NavigationMenuList, { children: links.map((link, i) => (_jsx(NavigationMenuItem, { children: link.items?.length ? (_jsxs(_Fragment, { children: [_jsx(NavigationMenuTrigger, { children: link.label }), _jsx(NavigationMenuContent, { children: _jsx("ul", { className: "m-0 grid list-none gap-1 p-0 sm:w-[400px]", children: link.items.map((item, j) => (_jsx("li", { children: _jsxs(NavigationMenuLink, { variant: "row", href: item.render ? undefined : item.href, render: item.render, active: item.current, children: [item.label, item.description != null && _jsx("small", { children: item.description })] }) }, j))) }) })] })) : (_jsx(NavigationMenuLink, { href: link.render ? undefined : link.href, render: link.render, active: link.current, children: link.label })) }, i))) }) }), actions != null && (_jsxs(_Fragment, { children: [_jsx("span", { "aria-hidden": true, className: "h-5 w-px bg-border" }), _jsx("div", { "data-slot": "site-header-actions", className: "flex items-center gap-2", children: actions })] }))] }), _jsxs(BaseDialog.Root, { open: open, onOpenChange: setOpen, children: [_jsx(BaseDialog.Trigger, { ref: menuButtonRef, render: _jsx(Button, { variant: "ghost", size: "icon", className: "@3xl/site-header:hidden" }), "aria-label": menuLabels?.open ?? "Open menu", children: _jsx(MenuIcon, {}) }), _jsx(BaseDialog.Portal, { children: _jsxs(BaseDialog.Popup, { "data-slot": "site-header-panel", dir: panelDir, className: cn("fixed inset-0 z-50 flex flex-col overflow-y-auto bg-background text-foreground outline-none", "transition-[opacity,translate] duration-(--duration) ease-(--ease)", "data-ending-style:-translate-y-2 data-ending-style:opacity-0 data-starting-style:-translate-y-2 data-starting-style:opacity-0"), children: [_jsx(BaseDialog.Title, { className: "sr-only", children: menuLabels?.title ?? "Menu" }), _jsxs("div", { className: "container-page flex min-h-16 items-center justify-between gap-6 border-b border-border/60", children: [_jsx("div", { className: "flex shrink-0 items-center", children: logo }), _jsx(BaseDialog.Close, { render: _jsx(Button, { variant: "ghost", size: "icon" }), "aria-label": menuLabels?.close ?? "Close menu", children: _jsx(XIcon, {}) })] }), _jsx("nav", { "aria-label": navLabel, className: "container-page flex-1", children: _jsx("ul", { className: "m-0 list-none p-0", children: links.map((link, i) => {
64
+ const index = (_jsx("span", { className: "w-6 shrink-0 font-mono text-[12px] text-muted-foreground tabular-nums", children: String(i + 1).padStart(2, "0") }));
65
+ return (_jsxs("li", { className: "border-b border-border/60", children: [link.href != null || link.render != null ? (_jsxs(PanelLink, { render: link.render, href: link.href, "aria-current": link.current ? "page" : undefined, onClick: () => setOpen(false), className: "flex items-baseline gap-5 py-5 text-foreground no-underline focus-ring", children: [index, _jsx("span", { className: "display text-[32px]", children: link.label })] })) : (_jsxs("div", { className: "flex items-baseline gap-5 pt-5 pb-2 text-foreground", children: [index, _jsx("span", { className: "display text-[32px]", children: link.label })] })), link.items?.length ? (_jsx("ul", { className: "m-0 -mt-1 list-none ps-11 pb-4", children: link.items.map((item, j) => (_jsx("li", { children: _jsx(PanelLink, { render: item.render, href: item.href, "aria-current": item.current ? "page" : undefined, onClick: () => setOpen(false), className: "flex min-h-(--control-h) items-center text-[17px] text-foreground-soft no-underline focus-ring aria-[current=page]:text-foreground", children: item.label }) }, j))) })) : null] }, i));
66
+ }) }) }), actions != null && (_jsx("div", { className: "container-page flex items-center gap-3 py-6", children: actions }))] }) })] })] }) }));
67
+ }
@@ -0,0 +1,31 @@
1
+ import type * as React from "react";
2
+ declare const skeletonShapes: {
3
+ /** A line of text: square ends, 1em tall by default. Set the width per line. */
4
+ readonly text: "h-[1em] rounded-none";
5
+ /** Stands in for an input, select trigger or textarea: 10px corners, 38px tall. */
6
+ readonly field: "min-h-(--control-h) w-full rounded-control";
7
+ /** Stands in for a button: 12px corners, 38px tall. */
8
+ readonly button: "min-h-(--control-h) w-28 rounded-button";
9
+ /** Stands in for a tag, a menu item or a thumbnail: 7px corners. */
10
+ readonly item: "rounded-item";
11
+ /** Stands in for an avatar or an icon button. Set the size. */
12
+ readonly circle: "aspect-square rounded-full";
13
+ /** Stands in for a whole card: 20px corners. */
14
+ readonly card: "rounded-card";
15
+ };
16
+ export type SkeletonShape = keyof typeof skeletonShapes;
17
+ export interface SkeletonProps extends React.ComponentProps<"div"> {
18
+ /** Match the radius (and default height) of what the skeleton stands in for. */
19
+ shape?: SkeletonShape;
20
+ }
21
+ /**
22
+ * Skeleton — a placeholder in `--control-surface` that holds the place of content while it
23
+ * loads, with one soft highlight sweeping across it every 1.6s (static under reduced motion).
24
+ *
25
+ * The radius follows what it stands in for: `text` lines are square, `field` is 10px, `button`
26
+ * is 12px, `circle` is round, `card` is 20px. Skeletons are `aria-hidden`; announce loading on
27
+ * the container (`aria-busy`) instead. The rule people break: skeletons that do not match the
28
+ * real layout, so the page jumps when the content arrives.
29
+ */
30
+ export declare function Skeleton({ shape, className, ...props }: SkeletonProps): React.JSX.Element;
31
+ export {};