@contui/ui 0.0.0-stage → 0.1.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 (427) hide show
  1. package/LICENSE +30 -0
  2. package/README.md +150 -2
  3. package/cli/contui.mjs +250 -0
  4. package/dist/charts/area-chart.d.ts +8 -0
  5. package/dist/charts/area-chart.js +9 -0
  6. package/dist/charts/bar-chart.d.ts +9 -0
  7. package/dist/charts/bar-chart.js +10 -0
  8. package/dist/charts/bubble-chart.d.ts +60 -0
  9. package/dist/charts/bubble-chart.js +392 -0
  10. package/dist/charts/bullet-chart.d.ts +53 -0
  11. package/dist/charts/bullet-chart.js +123 -0
  12. package/dist/charts/candlestick-chart.d.ts +77 -0
  13. package/dist/charts/candlestick-chart.js +558 -0
  14. package/dist/charts/cartesian.d.ts +121 -0
  15. package/dist/charts/cartesian.js +625 -0
  16. package/dist/charts/chart-card.d.ts +80 -0
  17. package/dist/charts/chart-card.js +114 -0
  18. package/dist/charts/donut-chart.d.ts +40 -0
  19. package/dist/charts/donut-chart.js +88 -0
  20. package/dist/charts/funnel-chart.d.ts +16 -0
  21. package/dist/charts/funnel-chart.js +164 -0
  22. package/dist/charts/horizontal-bar-chart.d.ts +67 -0
  23. package/dist/charts/horizontal-bar-chart.js +481 -0
  24. package/dist/charts/index.d.ts +21 -0
  25. package/dist/charts/index.js +32 -0
  26. package/dist/charts/legend.d.ts +23 -0
  27. package/dist/charts/legend.js +22 -0
  28. package/dist/charts/lib/candlestick-window.d.ts +15 -0
  29. package/dist/charts/lib/candlestick-window.js +23 -0
  30. package/dist/charts/lib/color.d.ts +39 -0
  31. package/dist/charts/lib/color.js +83 -0
  32. package/dist/charts/lib/format.d.ts +11 -0
  33. package/dist/charts/lib/format.js +33 -0
  34. package/dist/charts/lib/frame.d.ts +6 -0
  35. package/dist/charts/lib/frame.js +6 -0
  36. package/dist/charts/lib/layout.d.ts +11 -0
  37. package/dist/charts/lib/layout.js +71 -0
  38. package/dist/charts/lib/path.d.ts +35 -0
  39. package/dist/charts/lib/path.js +203 -0
  40. package/dist/charts/lib/scale.d.ts +41 -0
  41. package/dist/charts/lib/scale.js +80 -0
  42. package/dist/charts/lib/use-active.d.ts +18 -0
  43. package/dist/charts/lib/use-active.js +71 -0
  44. package/dist/charts/lib/use-size.d.ts +9 -0
  45. package/dist/charts/lib/use-size.js +40 -0
  46. package/dist/charts/line-chart.d.ts +7 -0
  47. package/dist/charts/line-chart.js +8 -0
  48. package/dist/charts/radar-chart.d.ts +27 -0
  49. package/dist/charts/radar-chart.js +165 -0
  50. package/dist/charts/rose-chart.d.ts +35 -0
  51. package/dist/charts/rose-chart.js +242 -0
  52. package/dist/charts/sparkline.d.ts +35 -0
  53. package/dist/charts/sparkline.js +110 -0
  54. package/dist/charts/tooltip.d.ts +35 -0
  55. package/dist/charts/tooltip.js +22 -0
  56. package/dist/charts/treemap.d.ts +28 -0
  57. package/dist/charts/treemap.js +103 -0
  58. package/dist/charts/uptime-strip.d.ts +40 -0
  59. package/dist/charts/uptime-strip.js +178 -0
  60. package/dist/components/accordion.d.ts +31 -0
  61. package/dist/components/accordion.js +34 -0
  62. package/dist/components/activity-item.d.ts +12 -0
  63. package/dist/components/activity-item.js +6 -0
  64. package/dist/components/alert.d.ts +21 -0
  65. package/dist/components/alert.js +58 -0
  66. package/dist/components/assistant-answer.d.ts +52 -0
  67. package/dist/components/assistant-answer.js +40 -0
  68. package/dist/components/assistant-prompt.d.ts +63 -0
  69. package/dist/components/assistant-prompt.js +122 -0
  70. package/dist/components/avatar.d.ts +28 -0
  71. package/dist/components/avatar.js +75 -0
  72. package/dist/components/badge.d.ts +16 -0
  73. package/dist/components/badge.js +33 -0
  74. package/dist/components/bar-list.d.ts +65 -0
  75. package/dist/components/bar-list.js +119 -0
  76. package/dist/components/block-slider.d.ts +43 -0
  77. package/dist/components/block-slider.js +63 -0
  78. package/dist/components/branch-graph.d.ts +87 -0
  79. package/dist/components/branch-graph.js +231 -0
  80. package/dist/components/breadcrumb.d.ts +41 -0
  81. package/dist/components/breadcrumb.js +53 -0
  82. package/dist/components/button.d.ts +23 -0
  83. package/dist/components/button.js +108 -0
  84. package/dist/components/calendar.d.ts +5 -0
  85. package/dist/components/calendar.js +90 -0
  86. package/dist/components/card.d.ts +65 -0
  87. package/dist/components/card.js +104 -0
  88. package/dist/components/chat-attachment.d.ts +47 -0
  89. package/dist/components/chat-attachment.js +63 -0
  90. package/dist/components/chat-event.d.ts +7 -0
  91. package/dist/components/chat-event.js +7 -0
  92. package/dist/components/chat-message.d.ts +59 -0
  93. package/dist/components/chat-message.js +91 -0
  94. package/dist/components/chat-reference.d.ts +20 -0
  95. package/dist/components/chat-reference.js +41 -0
  96. package/dist/components/chat-shared.d.ts +21 -0
  97. package/dist/components/chat-shared.js +23 -0
  98. package/dist/components/chat-suggestions.d.ts +59 -0
  99. package/dist/components/chat-suggestions.js +88 -0
  100. package/dist/components/chat-thread.d.ts +39 -0
  101. package/dist/components/chat-thread.js +172 -0
  102. package/dist/components/chat-typing.d.ts +35 -0
  103. package/dist/components/chat-typing.js +66 -0
  104. package/dist/components/checkbox.d.ts +18 -0
  105. package/dist/components/checkbox.js +33 -0
  106. package/dist/components/checklist.d.ts +26 -0
  107. package/dist/components/checklist.js +18 -0
  108. package/dist/components/chip.d.ts +29 -0
  109. package/dist/components/chip.js +61 -0
  110. package/dist/components/code-input.d.ts +40 -0
  111. package/dist/components/code-input.js +285 -0
  112. package/dist/components/color-picker.d.ts +38 -0
  113. package/dist/components/color-picker.js +855 -0
  114. package/dist/components/combobox.d.ts +75 -0
  115. package/dist/components/combobox.js +112 -0
  116. package/dist/components/command-menu.d.ts +58 -0
  117. package/dist/components/command-menu.js +166 -0
  118. package/dist/components/copy-button.d.ts +16 -0
  119. package/dist/components/copy-button.js +31 -0
  120. package/dist/components/data-grid.d.ts +50 -0
  121. package/dist/components/data-grid.js +599 -0
  122. package/dist/components/date-picker.d.ts +109 -0
  123. package/dist/components/date-picker.js +268 -0
  124. package/dist/components/description-list.d.ts +12 -0
  125. package/dist/components/description-list.js +10 -0
  126. package/dist/components/dialog.d.ts +57 -0
  127. package/dist/components/dialog.js +140 -0
  128. package/dist/components/dock.d.ts +45 -0
  129. package/dist/components/dock.js +79 -0
  130. package/dist/components/drop-zone.d.ts +46 -0
  131. package/dist/components/drop-zone.js +101 -0
  132. package/dist/components/dropdown-menu.d.ts +50 -0
  133. package/dist/components/dropdown-menu.js +78 -0
  134. package/dist/components/editable-cell.d.ts +34 -0
  135. package/dist/components/editable-cell.js +89 -0
  136. package/dist/components/empty-state.d.ts +17 -0
  137. package/dist/components/empty-state.js +9 -0
  138. package/dist/components/field.d.ts +43 -0
  139. package/dist/components/field.js +75 -0
  140. package/dist/components/filter-condition.d.ts +188 -0
  141. package/dist/components/filter-condition.js +113 -0
  142. package/dist/components/filter-menu.d.ts +57 -0
  143. package/dist/components/filter-menu.js +46 -0
  144. package/dist/components/header-bar.d.ts +84 -0
  145. package/dist/components/header-bar.js +94 -0
  146. package/dist/components/hold-button.d.ts +15 -0
  147. package/dist/components/hold-button.js +88 -0
  148. package/dist/components/icon-tile.d.ts +12 -0
  149. package/dist/components/icon-tile.js +29 -0
  150. package/dist/components/info-tip.d.ts +13 -0
  151. package/dist/components/info-tip.js +26 -0
  152. package/dist/components/input.d.ts +17 -0
  153. package/dist/components/input.js +83 -0
  154. package/dist/components/kbd.d.ts +6 -0
  155. package/dist/components/kbd.js +7 -0
  156. package/dist/components/menu-item.d.ts +56 -0
  157. package/dist/components/menu-item.js +94 -0
  158. package/dist/components/message-composer.d.ts +75 -0
  159. package/dist/components/message-composer.js +199 -0
  160. package/dist/components/nav-rail.d.ts +31 -0
  161. package/dist/components/nav-rail.js +85 -0
  162. package/dist/components/notice.d.ts +45 -0
  163. package/dist/components/notice.js +66 -0
  164. package/dist/components/optimistic-undo.d.ts +28 -0
  165. package/dist/components/optimistic-undo.js +43 -0
  166. package/dist/components/option-row.d.ts +15 -0
  167. package/dist/components/option-row.js +14 -0
  168. package/dist/components/page-content.d.ts +11 -0
  169. package/dist/components/page-content.js +31 -0
  170. package/dist/components/pagination.d.ts +34 -0
  171. package/dist/components/pagination.js +41 -0
  172. package/dist/components/popover.d.ts +27 -0
  173. package/dist/components/popover.js +25 -0
  174. package/dist/components/progress.d.ts +33 -0
  175. package/dist/components/progress.js +75 -0
  176. package/dist/components/radio-group.d.ts +7 -0
  177. package/dist/components/radio-group.js +33 -0
  178. package/dist/components/readonly-field.d.ts +33 -0
  179. package/dist/components/readonly-field.js +80 -0
  180. package/dist/components/segmented-control.d.ts +21 -0
  181. package/dist/components/segmented-control.js +108 -0
  182. package/dist/components/select.d.ts +42 -0
  183. package/dist/components/select.js +86 -0
  184. package/dist/components/separator.d.ts +10 -0
  185. package/dist/components/separator.js +7 -0
  186. package/dist/components/setting-row.d.ts +53 -0
  187. package/dist/components/setting-row.js +93 -0
  188. package/dist/components/sidebar-switcher.d.ts +47 -0
  189. package/dist/components/sidebar-switcher.js +20 -0
  190. package/dist/components/sidebar.d.ts +220 -0
  191. package/dist/components/sidebar.js +327 -0
  192. package/dist/components/skeleton.d.ts +18 -0
  193. package/dist/components/skeleton.js +23 -0
  194. package/dist/components/slider.d.ts +15 -0
  195. package/dist/components/slider.js +28 -0
  196. package/dist/components/spinner.d.ts +14 -0
  197. package/dist/components/spinner.js +19 -0
  198. package/dist/components/status-dot.d.ts +24 -0
  199. package/dist/components/status-dot.js +35 -0
  200. package/dist/components/stepper.d.ts +60 -0
  201. package/dist/components/stepper.js +197 -0
  202. package/dist/components/switch.d.ts +9 -0
  203. package/dist/components/switch.js +26 -0
  204. package/dist/components/table-cell.d.ts +38 -0
  205. package/dist/components/table-cell.js +107 -0
  206. package/dist/components/table-context.d.ts +48 -0
  207. package/dist/components/table-context.js +69 -0
  208. package/dist/components/table-head.d.ts +42 -0
  209. package/dist/components/table-head.js +188 -0
  210. package/dist/components/table-tree.d.ts +96 -0
  211. package/dist/components/table-tree.js +137 -0
  212. package/dist/components/table.d.ts +78 -0
  213. package/dist/components/table.js +119 -0
  214. package/dist/components/tabs.d.ts +27 -0
  215. package/dist/components/tabs.js +79 -0
  216. package/dist/components/textarea.d.ts +3 -0
  217. package/dist/components/textarea.js +20 -0
  218. package/dist/components/theme.d.ts +41 -0
  219. package/dist/components/theme.js +60 -0
  220. package/dist/components/thinking.d.ts +68 -0
  221. package/dist/components/thinking.js +94 -0
  222. package/dist/components/toast.d.ts +39 -0
  223. package/dist/components/toast.js +110 -0
  224. package/dist/components/toolbar.d.ts +25 -0
  225. package/dist/components/toolbar.js +92 -0
  226. package/dist/components/tooltip.d.ts +23 -0
  227. package/dist/components/tooltip.js +27 -0
  228. package/dist/components/top-nav.d.ts +129 -0
  229. package/dist/components/top-nav.js +211 -0
  230. package/dist/components/truncate.d.ts +29 -0
  231. package/dist/components/truncate.js +138 -0
  232. package/dist/deprecated.d.ts +43 -0
  233. package/dist/deprecated.js +47 -0
  234. package/dist/index.d.ts +93 -0
  235. package/dist/index.js +93 -0
  236. package/dist/lib/cn.d.ts +5 -0
  237. package/dist/lib/cn.js +14 -0
  238. package/dist/lib/color.d.ts +136 -0
  239. package/dist/lib/color.js +307 -0
  240. package/dist/lib/contrast.d.ts +53 -0
  241. package/dist/lib/contrast.js +169 -0
  242. package/dist/lib/create-theme.d.ts +240 -0
  243. package/dist/lib/create-theme.js +461 -0
  244. package/dist/lib/harmony.d.ts +102 -0
  245. package/dist/lib/harmony.js +426 -0
  246. package/dist/lib/import-theme.d.ts +22 -0
  247. package/dist/lib/import-theme.js +221 -0
  248. package/dist/lib/overflow-scroll.d.ts +25 -0
  249. package/dist/lib/overflow-scroll.js +66 -0
  250. package/dist/lib/radio-toggle-render.d.ts +3 -0
  251. package/dist/lib/radio-toggle-render.js +9 -0
  252. package/dist/lib/reorder.d.ts +38 -0
  253. package/dist/lib/reorder.js +193 -0
  254. package/dist/lib/spacing.d.ts +101 -0
  255. package/dist/lib/spacing.js +118 -0
  256. package/dist/lib/tailwind-palette.d.ts +5 -0
  257. package/dist/lib/tailwind-palette.js +351 -0
  258. package/dist/lib/truncate.d.ts +18 -0
  259. package/dist/lib/truncate.js +69 -0
  260. package/dist/lib/use-single-value.d.ts +5 -0
  261. package/dist/lib/use-single-value.js +17 -0
  262. package/dist/styles.css +7988 -0
  263. package/mcp/server.mjs +87590 -0
  264. package/package.json +58 -5
  265. package/skills/continuum-fix-padding/SKILL.md +69 -0
  266. package/skills/continuum-fix-padding/scripts/compute.ts +155 -0
  267. package/skills/continuum-fix-padding/scripts/spacing.ts +189 -0
  268. package/skills/continuum-taste/SKILL.md +186 -0
  269. package/skills/continuum-taste/assets/tokens.css +647 -0
  270. package/skills/continuum-taste/references/charts.md +375 -0
  271. package/skills/continuum-taste/references/components.md +1369 -0
  272. package/skills/continuum-taste/references/foundations.md +539 -0
  273. package/skills/continuum-taste/references/media/canvas.md +75 -0
  274. package/skills/continuum-taste/references/media/css.md +61 -0
  275. package/skills/continuum-taste/references/media/react.md +161 -0
  276. package/skills/continuum-taste/references/method.md +87 -0
  277. package/skills/continuum-taste/references/pages.md +391 -0
  278. package/skills/continuum-taste/references/patterns.md +77 -0
  279. package/skills/continuum-taste/references/screens/agent.tsx +450 -0
  280. package/skills/continuum-taste/references/screens/analytics-overview.tsx +377 -0
  281. package/skills/continuum-taste/references/screens/checkout-funnel.tsx +193 -0
  282. package/skills/continuum-taste/references/screens/customer.tsx +475 -0
  283. package/skills/continuum-taste/references/screens/customers.tsx +608 -0
  284. package/skills/continuum-taste/references/screens/index.tsx +72 -0
  285. package/skills/continuum-taste/references/screens/invoice-editor.tsx +558 -0
  286. package/skills/continuum-taste/references/screens/new-customer.tsx +205 -0
  287. package/skills/continuum-taste/references/screens/overview.tsx +196 -0
  288. package/skills/continuum-taste/references/screens/report-generator.tsx +329 -0
  289. package/skills/continuum-taste/references/screens/risk-report.tsx +577 -0
  290. package/skills/continuum-taste/references/screens/sequence-editor.tsx +455 -0
  291. package/skills/continuum-taste/references/screens/settings.tsx +288 -0
  292. package/skills/continuum-taste/references/screens/shared.tsx +204 -0
  293. package/skills/continuum-taste/references/screens/sign-in.tsx +104 -0
  294. package/skills/continuum-taste/references/screens/workspace.tsx +596 -0
  295. package/skills/continuum-taste/references/theming.md +95 -0
  296. package/src/charts/area-chart.tsx +17 -0
  297. package/src/charts/bar-chart.tsx +15 -0
  298. package/src/charts/bubble-chart.tsx +913 -0
  299. package/src/charts/bullet-chart.tsx +419 -0
  300. package/src/charts/candlestick-chart.tsx +1242 -0
  301. package/src/charts/cartesian.tsx +1437 -0
  302. package/src/charts/chart-card.tsx +394 -0
  303. package/src/charts/donut-chart.tsx +299 -0
  304. package/src/charts/funnel-chart.tsx +373 -0
  305. package/src/charts/horizontal-bar-chart.tsx +991 -0
  306. package/src/charts/index.ts +76 -0
  307. package/src/charts/legend.tsx +59 -0
  308. package/src/charts/lib/candlestick-window.ts +42 -0
  309. package/src/charts/lib/color.ts +110 -0
  310. package/src/charts/lib/format.ts +42 -0
  311. package/src/charts/lib/frame.ts +6 -0
  312. package/src/charts/lib/layout.ts +78 -0
  313. package/src/charts/lib/path.ts +225 -0
  314. package/src/charts/lib/scale.ts +91 -0
  315. package/src/charts/lib/use-active.ts +87 -0
  316. package/src/charts/lib/use-size.ts +45 -0
  317. package/src/charts/line-chart.tsx +16 -0
  318. package/src/charts/radar-chart.tsx +485 -0
  319. package/src/charts/rose-chart.tsx +553 -0
  320. package/src/charts/sparkline.tsx +293 -0
  321. package/src/charts/tooltip.tsx +105 -0
  322. package/src/charts/treemap.tsx +271 -0
  323. package/src/charts/uptime-strip.tsx +469 -0
  324. package/src/components/accordion.tsx +136 -0
  325. package/src/components/activity-item.tsx +43 -0
  326. package/src/components/alert.tsx +135 -0
  327. package/src/components/assistant-answer.tsx +185 -0
  328. package/src/components/assistant-prompt.tsx +352 -0
  329. package/src/components/avatar.tsx +157 -0
  330. package/src/components/badge.tsx +55 -0
  331. package/src/components/bar-list.tsx +350 -0
  332. package/src/components/block-slider.tsx +189 -0
  333. package/src/components/branch-graph.tsx +580 -0
  334. package/src/components/breadcrumb.tsx +173 -0
  335. package/src/components/button.tsx +157 -0
  336. package/src/components/calendar.tsx +154 -0
  337. package/src/components/card.tsx +296 -0
  338. package/src/components/chat-attachment.tsx +255 -0
  339. package/src/components/chat-event.tsx +34 -0
  340. package/src/components/chat-message.tsx +332 -0
  341. package/src/components/chat-reference.tsx +100 -0
  342. package/src/components/chat-shared.ts +41 -0
  343. package/src/components/chat-suggestions.tsx +188 -0
  344. package/src/components/chat-thread.tsx +348 -0
  345. package/src/components/chat-typing.tsx +155 -0
  346. package/src/components/checkbox.tsx +83 -0
  347. package/src/components/checklist.tsx +146 -0
  348. package/src/components/chip.tsx +152 -0
  349. package/src/components/code-input.tsx +406 -0
  350. package/src/components/color-picker.tsx +1385 -0
  351. package/src/components/combobox.tsx +420 -0
  352. package/src/components/command-menu.tsx +405 -0
  353. package/src/components/copy-button.tsx +87 -0
  354. package/src/components/data-grid.tsx +965 -0
  355. package/src/components/date-picker.tsx +652 -0
  356. package/src/components/description-list.tsx +39 -0
  357. package/src/components/dialog.tsx +367 -0
  358. package/src/components/dock.tsx +192 -0
  359. package/src/components/drop-zone.tsx +283 -0
  360. package/src/components/dropdown-menu.tsx +323 -0
  361. package/src/components/editable-cell.tsx +219 -0
  362. package/src/components/empty-state.tsx +50 -0
  363. package/src/components/field.tsx +148 -0
  364. package/src/components/filter-condition.tsx +463 -0
  365. package/src/components/filter-menu.tsx +196 -0
  366. package/src/components/header-bar.tsx +220 -0
  367. package/src/components/hold-button.tsx +146 -0
  368. package/src/components/icon-tile.tsx +43 -0
  369. package/src/components/info-tip.tsx +87 -0
  370. package/src/components/input.tsx +136 -0
  371. package/src/components/kbd.tsx +17 -0
  372. package/src/components/menu-item.tsx +216 -0
  373. package/src/components/message-composer.tsx +458 -0
  374. package/src/components/nav-rail.tsx +235 -0
  375. package/src/components/notice.tsx +133 -0
  376. package/src/components/optimistic-undo.ts +68 -0
  377. package/src/components/option-row.tsx +54 -0
  378. package/src/components/page-content.tsx +44 -0
  379. package/src/components/pagination.tsx +182 -0
  380. package/src/components/popover.tsx +113 -0
  381. package/src/components/progress.tsx +222 -0
  382. package/src/components/radio-group.tsx +80 -0
  383. package/src/components/readonly-field.tsx +251 -0
  384. package/src/components/segmented-control.tsx +205 -0
  385. package/src/components/select.tsx +259 -0
  386. package/src/components/separator.tsx +30 -0
  387. package/src/components/setting-row.tsx +277 -0
  388. package/src/components/sidebar-switcher.tsx +134 -0
  389. package/src/components/sidebar.tsx +804 -0
  390. package/src/components/skeleton.tsx +57 -0
  391. package/src/components/slider.tsx +106 -0
  392. package/src/components/spinner.tsx +43 -0
  393. package/src/components/status-dot.tsx +100 -0
  394. package/src/components/stepper.tsx +459 -0
  395. package/src/components/switch.tsx +54 -0
  396. package/src/components/table-cell.tsx +239 -0
  397. package/src/components/table-context.ts +135 -0
  398. package/src/components/table-head.tsx +393 -0
  399. package/src/components/table-tree.tsx +357 -0
  400. package/src/components/table.tsx +295 -0
  401. package/src/components/tabs.tsx +191 -0
  402. package/src/components/textarea.tsx +44 -0
  403. package/src/components/theme.tsx +120 -0
  404. package/src/components/thinking.tsx +295 -0
  405. package/src/components/toast.tsx +308 -0
  406. package/src/components/toolbar.tsx +166 -0
  407. package/src/components/tooltip.tsx +84 -0
  408. package/src/components/top-nav.tsx +660 -0
  409. package/src/components/truncate.tsx +234 -0
  410. package/src/deprecated.ts +61 -0
  411. package/src/index.ts +184 -0
  412. package/src/lib/cn.ts +22 -0
  413. package/src/lib/color.ts +469 -0
  414. package/src/lib/contrast.ts +220 -0
  415. package/src/lib/create-theme.ts +659 -0
  416. package/src/lib/harmony.ts +609 -0
  417. package/src/lib/import-theme.ts +272 -0
  418. package/src/lib/overflow-scroll.tsx +108 -0
  419. package/src/lib/radio-toggle-render.tsx +15 -0
  420. package/src/lib/reorder.ts +222 -0
  421. package/src/lib/spacing.ts +189 -0
  422. package/src/lib/tailwind-palette.ts +355 -0
  423. package/src/lib/truncate.ts +79 -0
  424. package/src/lib/use-single-value.ts +23 -0
  425. package/src/styles/continuum.css +3 -0
  426. package/src/styles/theme.css +524 -0
  427. package/src/styles/tokens.css +647 -0
@@ -0,0 +1,327 @@
1
+ 'use client';
2
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
+ import { Collapsible as CollapsiblePrimitive } from '@base-ui/react/collapsible';
4
+ import { useRender } from '@base-ui/react/use-render';
5
+ import { ChevronDown, ChevronLeft, PanelLeft } from 'lucide-react';
6
+ import { createContext, useCallback, useContext, useEffect, useId, useMemo, useRef, useState, } from 'react';
7
+ import { cn } from '../lib/cn.js';
8
+ import { Badge } from './badge.js';
9
+ import { focusRing, touchTarget } from './button.js';
10
+ const AppShellContext = createContext(null);
11
+ /*
12
+ * Whether a part sits inside an AppPanel. The shell's own navigation is the panel's sibling; a
13
+ * Sidebar or a TopNav drawn inside the panel (a preview of one, say) is content, so it never
14
+ * becomes the shell's drawer.
15
+ */
16
+ const InPanelContext = createContext(false);
17
+ /**
18
+ * The shell's drawer, for a custom bar's own toggle; null outside an `AppShell`. `inPanel` says
19
+ * whether the caller sits inside the panel: the shell's own navigation is the panel's sibling.
20
+ */
21
+ export const useAppShellNav = () => {
22
+ const shell = useContext(AppShellContext);
23
+ const inPanel = useContext(InPanelContext);
24
+ return shell && { ...shell, inPanel };
25
+ };
26
+ /** The shell, for a part that may be its navigation: null for one drawn inside the panel. */
27
+ const useShellNavigation = () => {
28
+ const shell = useContext(AppShellContext);
29
+ return useContext(InPanelContext) ? null : shell;
30
+ };
31
+ const assignRef = (ref, node) => {
32
+ if (typeof ref === 'function')
33
+ ref(node);
34
+ else if (ref)
35
+ ref.current = node;
36
+ };
37
+ /** One callback ref that sets both, so a part keeps the caller's ref while the shell holds it too. */
38
+ const useBothRefs = (a, b) => useCallback((node) => {
39
+ assignRef(a, node);
40
+ assignRef(b, node);
41
+ }, [a, b]);
42
+ const focusable = 'a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';
43
+ /**
44
+ * The navigation on a shell too narrow for it: it leaves the canvas and slides in over the panel
45
+ * from the left, on the canvas's colour with the sheet's shadow, 256px and never closer than 48px
46
+ * to the far edge, so the page still shows beside it. Closed, it is hidden, which also takes it out
47
+ * of the tab order; under reduced motion it appears without sliding. On a wide shell none of it
48
+ * applies. A sidebar goes under the sidebar's width (1024); a top nav, whose sections scroll along
49
+ * the bar rather than take width from the panel, only under the compact width (640).
50
+ */
51
+ export const navDrawerClasses = (open, nav = 'side') => nav === 'top'
52
+ ? cn('@max-shell-compact/shell:absolute @max-shell-compact/shell:inset-y-0 @max-shell-compact/shell:left-0 @max-shell-compact/shell:z-50 @max-shell-compact/shell:w-sidebar @max-shell-compact/shell:max-w-[calc(100%-48px)]', '@max-shell-compact/shell:bg-neutral-100 @max-shell-compact/shell:shadow-sheet @max-shell-compact/shell:outline-none', '@max-shell-compact/shell:duration-200 @max-shell-compact/shell:ease-out-strong @max-shell-compact/shell:motion-reduce:transition-none', open
53
+ ? '@max-shell-compact/shell:transition-[translate]'
54
+ : '@max-shell-compact/shell:invisible @max-shell-compact/shell:-translate-x-full @max-shell-compact/shell:transition-[translate,visibility]')
55
+ : cn('@max-shell-sidebar/shell:absolute @max-shell-sidebar/shell:inset-y-0 @max-shell-sidebar/shell:left-0 @max-shell-sidebar/shell:z-50 @max-shell-sidebar/shell:w-sidebar @max-shell-sidebar/shell:max-w-[calc(100%-48px)]', '@max-shell-sidebar/shell:bg-neutral-100 @max-shell-sidebar/shell:shadow-sheet @max-shell-sidebar/shell:outline-none',
56
+ // Visibility switches at once on open, so focus can move in, and waits for the slide on close.
57
+ '@max-shell-sidebar/shell:duration-200 @max-shell-sidebar/shell:ease-out-strong @max-shell-sidebar/shell:motion-reduce:transition-none', open
58
+ ? '@max-shell-sidebar/shell:transition-[translate]'
59
+ : '@max-shell-sidebar/shell:invisible @max-shell-sidebar/shell:-translate-x-full @max-shell-sidebar/shell:transition-[translate,visibility]');
60
+ /**
61
+ * The canvas-and-panel shell: the navigation sits straight on the canvas, the
62
+ * page on an inset panel with an 8px gutter.
63
+ *
64
+ * It is the container its parts answer to, so they follow the shell's width rather than the
65
+ * screen's, and a shell shown narrow inside a page or an embed behaves as it would on a phone.
66
+ * Below the sidebar's width the sidebar becomes a drawer, opened from a toggle at the start of the
67
+ * header bar, over a 40% scrim; a top nav's sections do the same below the compact width. Escape, the scrim or choosing a page closes it,
68
+ * and focus goes back to the toggle. The panel keeps its gutter, corners and hairline at every
69
+ * width, so a phone shows the same shell as a desktop, only without the sidebar beside it.
70
+ */
71
+ export const AppShell = ({ nav = 'side', navOpen, defaultNavOpen = false, onNavOpenChange, className, children, ref, ...props }) => {
72
+ const [shell, setShell] = useState(null);
73
+ const [drawer, setDrawer] = useState(null);
74
+ // Unknown until measured, so a drawer asked to start open isn't closed before the shell is.
75
+ const [narrow, setNarrow] = useState();
76
+ const [ownOpen, setOwnOpen] = useState(defaultNavOpen);
77
+ const open = navOpen ?? ownOpen;
78
+ const opener = useRef(null);
79
+ const latest = useRef({ open, onNavOpenChange });
80
+ latest.current = { open, onNavOpenChange };
81
+ const shellRef = useBothRefs(ref, setShell);
82
+ const setOpen = useCallback((next) => {
83
+ if (next === latest.current.open)
84
+ return;
85
+ setOwnOpen(next);
86
+ latest.current.onNavOpenChange?.(next);
87
+ }, []);
88
+ // The same width the parts' container queries use, read from the token so the two agree.
89
+ useEffect(() => {
90
+ if (!shell)
91
+ return;
92
+ const measure = () => {
93
+ const limit = Number.parseFloat(getComputedStyle(shell).getPropertyValue(nav === 'top' ? '--container-shell-compact' : '--container-shell-sidebar')) || (nav === 'top' ? 640 : 1024);
94
+ setNarrow(shell.clientWidth < limit);
95
+ };
96
+ measure();
97
+ const observer = new ResizeObserver(measure);
98
+ observer.observe(shell);
99
+ return () => observer.disconnect();
100
+ }, [shell, nav]);
101
+ // A shell that grows wide enough for the sidebar shuts the drawer, so it doesn't spring open
102
+ // again the next time the shell narrows.
103
+ useEffect(() => {
104
+ if (open && narrow === false)
105
+ setOpen(false);
106
+ }, [open, narrow, setOpen]);
107
+ const shown = open && narrow === true && drawer !== null;
108
+ // Open, the drawer is the only thing to use: the rest of the shell goes inert, focus moves in
109
+ // (to the current page if it can be seen), Escape closes it, and focus goes back on close.
110
+ useEffect(() => {
111
+ if (!shown || !shell || !drawer)
112
+ return;
113
+ const rest = Array.from(shell.children).filter((child) => child instanceof HTMLElement &&
114
+ !child.contains(drawer) &&
115
+ child.dataset.slot !== 'app-shell-scrim');
116
+ for (const child of rest)
117
+ child.inert = true;
118
+ const active = document.activeElement;
119
+ if (!opener.current && active instanceof HTMLElement && active !== document.body) {
120
+ opener.current = active;
121
+ }
122
+ const first = [
123
+ drawer.querySelector('[aria-current=page]'),
124
+ ...drawer.querySelectorAll(focusable),
125
+ ].find((node) => node instanceof HTMLElement && node.checkVisibility?.() !== false);
126
+ (first ?? drawer).focus({ preventScroll: true });
127
+ const onKeyDown = (event) => {
128
+ if (event.key !== 'Escape' || event.defaultPrevented)
129
+ return;
130
+ // A menu portalled out of the drawer handles its own Escape.
131
+ const focused = document.activeElement;
132
+ if (focused && focused !== document.body && !drawer.contains(focused))
133
+ return;
134
+ setOpen(false);
135
+ };
136
+ document.addEventListener('keydown', onKeyDown);
137
+ return () => {
138
+ document.removeEventListener('keydown', onKeyDown);
139
+ for (const child of rest)
140
+ child.inert = false;
141
+ const focused = document.activeElement;
142
+ if (!focused || focused === document.body || drawer.contains(focused)) {
143
+ opener.current?.focus({ preventScroll: true });
144
+ }
145
+ opener.current = null;
146
+ };
147
+ }, [shown, shell, drawer, setOpen]);
148
+ const value = useMemo(() => ({
149
+ nav,
150
+ open,
151
+ setOpen,
152
+ hasDrawer: drawer !== null,
153
+ drawerId: drawer?.id || undefined,
154
+ opener,
155
+ setDrawer,
156
+ }), [nav, open, setOpen, drawer]);
157
+ return (_jsx(AppShellContext.Provider, { value: value, children: _jsx(InPanelContext.Provider, { value: false, children: _jsxs("div", { className: cn(
158
+ // Positioned and isolated, so the drawer and its scrim lie over this shell alone.
159
+ '@container/shell relative isolate flex min-h-screen bg-neutral-100',
160
+ // Under a top nav the page is one surface from the bar down: no canvas round it.
161
+ nav === 'top' && 'flex-col bg-neutral-50', className), "data-nav": nav, "data-slot": "app-shell", ref: shellRef, ...props, children: [children, drawer && (
162
+ // Black rather than a neutral step, as a dialog's scrim: the ramp flips in dark mode.
163
+ _jsx("div", { "aria-hidden": true, className: cn('absolute inset-0 z-40 hidden bg-black/40 transition-[opacity,visibility] duration-200 ease-out-strong motion-reduce:transition-none', nav === 'top'
164
+ ? '@max-shell-compact/shell:block'
165
+ : '@max-shell-sidebar/shell:block', !open && 'invisible opacity-0'), "data-slot": "app-shell-scrim", onClick: () => setOpen(false) }))] }) }) }));
166
+ };
167
+ export const AppPanel = ({ className, ...props }) => {
168
+ const shell = useShellNavigation();
169
+ return (_jsx(InPanelContext.Provider, { value: true, children: _jsx("main", { className: cn(
170
+ // The gutter opens on every side but the navigation's.
171
+ 'relative m-2 ml-0 flex min-w-0 flex-1 flex-col overflow-hidden rounded-panel border border-neutral-200 bg-neutral-50',
172
+ // Under a top nav the page lies flat under the bar's hairline: no gutter, corners or frame.
173
+ '[[data-nav=top]>&]:m-0 [[data-nav=top]>&]:rounded-none [[data-nav=top]>&]:border-0',
174
+ // With the sidebar gone to a drawer, the gutter opens on its side too.
175
+ shell?.hasDrawer && shell.nav === 'side' && '@max-shell-sidebar/shell:ml-2', className), "data-slot": "app-panel", ...props }) }));
176
+ };
177
+ /**
178
+ * The email sequencing sidebar: no fill of its own, so it shares the canvas,
179
+ * with a logo row, blocks of navigation and an account footer. In an `AppShell` narrower than
180
+ * the sidebar's width it becomes the shell's drawer.
181
+ */
182
+ export const Sidebar = ({ className, id, ref, bordered = false, ...props }) => {
183
+ const shell = useShellNavigation();
184
+ const ownId = useId();
185
+ const drawerRef = useBothRefs(ref, shell?.setDrawer);
186
+ return (_jsx("aside", { className: cn('flex w-sidebar shrink-0 flex-col overflow-hidden', bordered && 'm-2 rounded-panel border border-neutral-200', shell && navDrawerClasses(shell.open), className), "data-bordered": bordered || undefined, "data-slot": "sidebar", id: shell ? (id ?? ownId) : id, ref: shell ? drawerRef : ref,
187
+ // Open, it can take focus itself, for when nothing in it can.
188
+ tabIndex: shell?.open ? -1 : undefined, ...props }));
189
+ };
190
+ /** The 56px logo row: a logo on the left, the collapse toggle on the right. */
191
+ export const SidebarHeader = ({ className, ...props }) => (_jsx("div", { className: cn(
192
+ // Centred in the row with the logo 2px low, so a theme's height scale never squeezes it out.
193
+ 'flex h-nav shrink-0 items-center justify-between pt-1 pr-3.5 pl-2', className), "data-slot": "sidebar-header", ...props }));
194
+ /** A 26px mark in ink, on no tile, centred in a 36px box. */
195
+ export const SidebarLogo = ({ className, children, ...props }) => (_jsx("span", { className: cn('grid size-9 shrink-0 place-items-center', className), "data-slot": "sidebar-logo", ...props, children: _jsx("span", { className: "grid size-6.5 place-items-center text-neutral-950 [&_svg:not([class*=size-])]:size-4", children: children }) }));
196
+ /**
197
+ * Opens and closes the sidebar; give it `expanded` and `aria-controls` so its state is announced.
198
+ * Inside an `AppShell`, without an `onClick` of its own, it opens and closes the shell's drawer, so
199
+ * the one in the drawer's header closes it.
200
+ */
201
+ export const SidebarToggle = ({ className, type = 'button', expanded, collapseLabel = 'Collapse sidebar', expandLabel = 'Expand sidebar', 'aria-label': label = expanded === false ? expandLabel : collapseLabel, onClick, ...props }) => {
202
+ const shell = useContext(AppShellContext);
203
+ const drives = !onClick && shell?.hasDrawer;
204
+ return (_jsx("button", { "aria-controls": drives ? shell.drawerId : undefined, "aria-expanded": expanded, "aria-label": label, className: cn('grid size-7 cursor-pointer place-items-center rounded-chip text-neutral-300 transition-colors duration-150 hover:text-neutral-600', touchTarget, focusRing, className), "data-slot": "sidebar-toggle", onClick: drives
205
+ ? (event) => {
206
+ if (!shell.open)
207
+ shell.opener.current = event.currentTarget;
208
+ shell.setOpen(!shell.open);
209
+ }
210
+ : onClick, type: type, ...props, children: _jsx(PanelLeft, { className: "size-4", strokeWidth: 2 }) }));
211
+ };
212
+ /**
213
+ * A group's or a section's count: how many it holds. A plain figure in `neutral-500`, in the type
214
+ * of its row, tabular, at the row's end: a fact about the group, not something waiting.
215
+ */
216
+ const SidebarCount = ({ children }) => (_jsx("span", { className: "shrink-0 font-normal text-neutral-500 tabular-nums", "data-slot": "sidebar-count", children: children }));
217
+ /**
218
+ * An item's count: how many wait for the reader there (an inbox's new mail, invoices to send). A
219
+ * primary count badge, so what waits stands out from the rows around it.
220
+ */
221
+ const SidebarItemCount = ({ children }) => (_jsx(Badge, { "data-slot": "sidebar-count", tone: "primary", variant: "count", children: children }));
222
+ /**
223
+ * A block of navigation. Items sit 2px apart, inset 8px left and 12px right.
224
+ * Blocks are told apart by space, not a hairline: one that follows another
225
+ * starts 24px down.
226
+ */
227
+ export const SidebarGroup = ({ label, count, className, children, ...props }) => (_jsxs("nav", { className: cn('flex shrink-0 flex-col gap-1 pt-2 pr-3 pl-2 [[data-slot=sidebar-group]+&]:pt-6', className), "data-slot": "sidebar-group", ...props, children: [label && (_jsxs("p", { className: "flex items-center gap-2 py-1 pr-2 pl-2.5 font-normal text-neutral-600 text-xs", "data-slot": "sidebar-label", children: [_jsx("span", { className: "min-w-0 flex-1 truncate", children: label }), count !== undefined && _jsx(SidebarCount, { children: count })] })), _jsx("div", { className: "flex flex-col gap-0.5", children: children })] }));
228
+ export const sidebarItemClasses = [
229
+ 'flex w-full cursor-pointer select-none items-center gap-2 rounded-item py-2 pr-2 pl-2.5 text-left font-normal transition-[background-color,color] duration-150',
230
+ 'hover:bg-neutral-950/5',
231
+ // The active item as the theme draws it: the wash by default, tinted, filled or raised.
232
+ 'aria-[current=page]:bg-nav-active aria-[current=page]:text-nav-active-fg aria-[current=page]:hover:bg-nav-active',
233
+ 'aria-[current=page]:[box-shadow:inset_0_0_0_1px_var(--color-nav-active-border),var(--shadow-nav-active)] aria-[current=page]:[background-image:var(--nav-active-image)]',
234
+ // In a foldout, the piece of its guide line beside the page you are on, in the text's colour.
235
+ 'in-data-[slot=sidebar-section-rows]:relative in-data-[slot=sidebar-section-rows]:aria-[current=page]:before:absolute in-data-[slot=sidebar-section-rows]:aria-[current=page]:before:inset-y-1.5 in-data-[slot=sidebar-section-rows]:aria-[current=page]:before:-left-1.5 in-data-[slot=sidebar-section-rows]:aria-[current=page]:before:w-px in-data-[slot=sidebar-section-rows]:aria-[current=page]:before:bg-neutral-950 in-data-[slot=sidebar-section-rows]:aria-[current=page]:before:content-[""]',
236
+ '[&_svg:not([class*=size-])]:size-icon [&_svg]:shrink-0',
237
+ focusRing,
238
+ ];
239
+ /**
240
+ * A sidebar row, on the control row's 34px. The selected row gets a 5% wash
241
+ * rather than colour, set via aria-current so router links that set it
242
+ * themselves work too. Chosen in the shell's drawer, it closes the drawer.
243
+ */
244
+ export const SidebarItem = ({ render, active, icon, count, trailing, variant = 'default', className, children, type = 'button', onClick, ...props }) => {
245
+ const shell = useShellNavigation();
246
+ return useRender({
247
+ defaultTagName: 'button',
248
+ render,
249
+ props: {
250
+ 'aria-current': active ? 'page' : undefined,
251
+ className: cn(sidebarItemClasses, variant === 'default' && 'h-control text-neutral-950 text-xs', variant === 'project' && 'h-control text-neutral-950 text-sm', variant === 'inset' &&
252
+ 'h-control text-neutral-700 text-sm aria-[current=page]:text-nav-active-fg', variant === 'primary' &&
253
+ 'mb-3.5 h-control bg-action text-on-action text-xs shadow-action [background-image:var(--action-gradient)] hover:bg-action-hover hover:[background-image:none]', className),
254
+ 'data-slot': 'sidebar-item',
255
+ 'data-variant': variant,
256
+ // A rendered link or router element is not a button, so it gets no type.
257
+ type: render ? undefined : type,
258
+ ...props,
259
+ onClick: (event) => {
260
+ onClick?.(event);
261
+ if (shell && !event.defaultPrevented)
262
+ shell.setOpen(false);
263
+ },
264
+ children: (_jsxs(_Fragment, { children: [icon, _jsx("span", { className: "min-w-0 flex-1 truncate", children: children }), (count !== undefined || trailing) && (_jsxs("span", { className: "ml-auto flex shrink-0 items-center gap-2", children: [count !== undefined && _jsx(SidebarItemCount, { children: count }), trailing] }))] })),
265
+ },
266
+ });
267
+ };
268
+ /** @deprecated Use `SidebarItem`. */
269
+ export const NavItem = SidebarItem;
270
+ /** @deprecated Use `sidebarItemClasses`. */
271
+ export const navItemClasses = sidebarItemClasses;
272
+ /**
273
+ * One level of a sidebar that drills down: the top level's places, or the index of one of them
274
+ * under a `SidebarBack`. Render the level that is open; it comes in 8px from its side as it fades
275
+ * in, and only fades under reduced motion. Give each level a key, so a change of level enters anew.
276
+ */
277
+ export const SidebarLevel = ({ from = 'end', className, ...props }) => (_jsx("div", { className: cn('flex min-w-0 flex-col starting:opacity-0 transition-[opacity,translate] duration-200 ease-out-strong motion-reduce:transition-none', from === 'end'
278
+ ? 'motion-safe:starting:translate-x-2'
279
+ : 'motion-safe:starting:-translate-x-2', className), "data-slot": "sidebar-level", ...props }));
280
+ /**
281
+ * The head of a nested level: its `SidebarBack`, then anything that works on the whole level (a
282
+ * search). It stays at the top while the level's list scrolls under it, on the sidebar's canvas,
283
+ * with a hairline at its foot; 12 above, 8 between its rows and 12 below, in a group's insets.
284
+ */
285
+ export const SidebarLevelHead = ({ className, ...props }) => (_jsx("div", { className: cn('sticky top-0 z-10 flex shrink-0 flex-col gap-2 border-neutral-200 border-b bg-neutral-100 pt-3 pr-3 pb-3 pl-2', className), "data-slot": "sidebar-level-head", ...props }));
286
+ /**
287
+ * The head of a nested level: a chevron back and the level's name, on a sidebar item's row.
288
+ * It takes the reader back to the level above; the page that is open stays.
289
+ */
290
+ export const SidebarBack = ({ backLabel = 'Back', className, children, type = 'button', ...props }) => (_jsxs("button", { className: cn(sidebarItemClasses, 'h-control text-neutral-950 text-xs', className), "data-slot": "sidebar-back", type: type, ...props, children: [_jsx(ChevronLeft, { "aria-hidden": true, strokeWidth: 2 }), _jsxs("span", { className: "sr-only", children: [backLabel, ": "] }), _jsx("span", { className: "min-w-0 flex-1 truncate", children: children })] }));
291
+ /*
292
+ * Where the guide line runs: down the middle of the section's 14px icon, 16px into its row (the
293
+ * row's 10 and half the icon's 14, less half the line). The rows hang 5px off it, so a page's label
294
+ * starts 32px in, where the section's own label does (10 + 14 + 8).
295
+ */
296
+ const guide = 'ml-4 border-neutral-200 border-l pl-1.25';
297
+ /**
298
+ * A section that folds open to its pages, as deep as it needs: a foldout's rows can be foldouts
299
+ * too. Each level hangs off a guide line from the icon above it, one icon's width further in.
300
+ *
301
+ * Open or closed, the row stays a plain row: open is told by the chevron and the rows under it.
302
+ * A background always means "you are here": the page you are on takes the theme's active look,
303
+ * every foldout that holds it the theme's quieter section look, and the guide line beside the
304
+ * page darkens, so the way from a section to its page can be followed. The chevron shows on
305
+ * hover when closed (always on a touch screen, which has none) and turns as the group opens.
306
+ */
307
+ export const SidebarSection = ({ icon, label, count, current, className, children, ...props }) => (_jsxs(CollapsiblePrimitive.Root, { className: cn('flex flex-col', className), "data-current": current || undefined, "data-slot": "sidebar-section", ...props, children: [_jsxs(CollapsiblePrimitive.Trigger, { className: cn(sidebarItemClasses, 'group h-control text-neutral-700 text-sm data-panel-open:text-neutral-950',
308
+ // The section that holds the page: set, or found among its rows, open or closed.
309
+ '[[data-current]>&]:bg-nav-section [[data-current]>&]:text-nav-section-fg', '[[data-slot=sidebar-section]:has([aria-current=page])>&]:bg-nav-section', '[[data-slot=sidebar-section]:has([aria-current=page])>&]:text-nav-section-fg', '[[data-slot=sidebar-section]:has([aria-current=page])>&]:hover:bg-nav-section',
310
+ // A foldout inside a foldout that holds the page darkens its piece of the guide line too.
311
+ '[[data-slot=sidebar-section-rows]>[data-slot=sidebar-section]:has([aria-current=page])>&]:relative [[data-slot=sidebar-section-rows]>[data-slot=sidebar-section]:has([aria-current=page])>&]:before:absolute [[data-slot=sidebar-section-rows]>[data-slot=sidebar-section]:has([aria-current=page])>&]:before:inset-y-1.5 [[data-slot=sidebar-section-rows]>[data-slot=sidebar-section]:has([aria-current=page])>&]:before:-left-1.5 [[data-slot=sidebar-section-rows]>[data-slot=sidebar-section]:has([aria-current=page])>&]:before:w-px [[data-slot=sidebar-section-rows]>[data-slot=sidebar-section]:has([aria-current=page])>&]:before:bg-neutral-950 [[data-slot=sidebar-section-rows]>[data-slot=sidebar-section]:has([aria-current=page])>&]:before:content-[""]'), "data-slot": "sidebar-section-trigger", children: [icon && (_jsx("span", { className: "grid size-icon shrink-0 place-items-center text-xs", children: icon })), _jsx("span", { className: "min-w-0 flex-1 truncate", children: label }), _jsx(ChevronDown, { className: "-rotate-90 opacity-0 pointer-coarse:opacity-100 transition-[opacity,rotate] duration-200 ease-out-strong group-hover:opacity-100 group-data-panel-open:rotate-0 group-data-panel-open:opacity-100 motion-reduce:transition-none", strokeWidth: 2 }), count !== undefined && _jsx(SidebarCount, { children: count })] }), _jsx(CollapsiblePrimitive.Panel, { className: cn(
312
+ // Opens to its own height and closes back, the rows fading with it.
313
+ 'h-(--collapsible-panel-height) overflow-hidden transition-[height,opacity] duration-200 ease-out-strong', 'data-ending-style:h-0 data-starting-style:h-0 data-ending-style:opacity-0 data-starting-style:opacity-0', 'motion-reduce:transition-opacity'), "data-slot": "sidebar-section-content",
314
+ // Kept in the page while closed, so a closed section still knows it holds the page.
315
+ keepMounted: true, children: _jsx("div", { className: cn('my-1 flex flex-col gap-0.5', guide), "data-slot": "sidebar-section-rows", children: children }) })] }));
316
+ /** @deprecated Use `SidebarSection`. */
317
+ export const NavGroup = SidebarSection;
318
+ /**
319
+ * Pushed to the bottom: who is signed in, and a bell. Inset 18px on the left, the group's 8px and a
320
+ * row's 10px, so the avatar's edge lines up with the logo, the switcher's mark and the item icons
321
+ * above it; 14px on the right, so a 28 icon button's icon centres on the column the switcher's
322
+ * chevron and the items' chevrons and counts share.
323
+ */
324
+ export const SidebarFooter = ({ className, ...props }) => (_jsx("div", { className: cn('mt-auto flex shrink-0 items-center gap-3 pt-4 pr-3.5 pb-6 pl-4.5', className), "data-slot": "sidebar-footer", ...props }));
325
+ export const SidebarAccount = ({ avatar, name, detail, className, ...props }) => (_jsxs("div", {
326
+ // The switcher's row again: a 28 mark, 10 to the name, so the two names start on one line.
327
+ className: cn('flex min-w-0 flex-1 items-center gap-2.5', className), "data-slot": "sidebar-account", ...props, children: [avatar && (_jsx("span", { className: "grid size-7 shrink-0 place-items-center overflow-hidden rounded-chip *:size-full [&>img]:object-cover", children: avatar })), _jsxs("span", { className: "flex min-w-0 flex-1 flex-col", children: [_jsx("span", { className: "truncate font-medium text-neutral-600 text-xs", children: name }), detail && _jsx("span", { className: "truncate text-neutral-600 text-xxs", children: detail })] })] }));
@@ -0,0 +1,18 @@
1
+ import type { ComponentProps } from 'react';
2
+ /**
3
+ * A quiet placeholder at the real element's size while its data loads: the 5% wash that sits on
4
+ * the canvas and the surface alike, with a band of light crossing it. One band crosses every
5
+ * skeleton on the page at once, so they read as one surface loading. Size it with classes (`h-control w-40`, `size-8`)
6
+ * and give the region that loads `aria-busy`; the blocks themselves are hidden from screen readers.
7
+ */
8
+ export declare const Skeleton: ({ className, ...props }: ComponentProps<"div">) => import("react").JSX.Element;
9
+ export type SkeletonTextProps = ComponentProps<'div'> & {
10
+ /** How many lines; the last one is always short. */
11
+ lines?: number;
12
+ };
13
+ /**
14
+ * Lines of text as 10px bars on the 13px text's rhythm, the last one short. The gap and padding are
15
+ * read from the text's line height, so the block is as tall as the lines it stands in for at any
16
+ * type size or spacing unit.
17
+ */
18
+ export declare const SkeletonText: ({ lines, className, ...props }: SkeletonTextProps) => import("react").JSX.Element;
@@ -0,0 +1,23 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { cn } from '../lib/cn.js';
3
+ /**
4
+ * A quiet placeholder at the real element's size while its data loads: the 5% wash that sits on
5
+ * the canvas and the surface alike, with a band of light crossing it. One band crosses every
6
+ * skeleton on the page at once, so they read as one surface loading. Size it with classes (`h-control w-40`, `size-8`)
7
+ * and give the region that loads `aria-busy`; the blocks themselves are hidden from screen readers.
8
+ */
9
+ export const Skeleton = ({ className, ...props }) => (_jsx("div", { "aria-hidden": true, className: cn('skeleton rounded-item', className), "data-slot": "skeleton", ...props }));
10
+ /** Widths that read as a paragraph: full lines, then a short last one. */
11
+ const lineWidths = ['100%', '94%', '88%', '97%', '62%'];
12
+ /**
13
+ * Lines of text as 10px bars on the 13px text's rhythm, the last one short. The gap and padding are
14
+ * read from the text's line height, so the block is as tall as the lines it stands in for at any
15
+ * type size or spacing unit.
16
+ */
17
+ export const SkeletonText = ({ lines = 3, className, ...props }) => (_jsx("div", { "aria-hidden": true, className: cn(
18
+ // The bar is 10px at 13px type and follows the type size; the gaps take the rest of each line.
19
+ 'flex flex-col gap-[calc(var(--text-xs--line-height)-var(--bar))] py-[calc((var(--text-xs--line-height)-var(--bar))/2)] [--bar:round(nearest,calc(var(--text-xs)*0.77),1px)]', className), "data-slot": "skeleton-text", ...props, children: Array.from({ length: lines }, (_, i) => (_jsx(Skeleton, { className: "h-(--bar) rounded-chip", style: {
20
+ width: i === lines - 1 && lines > 1
21
+ ? '62%'
22
+ : lineWidths[i % (lineWidths.length - 1)],
23
+ } }, i))) }));
@@ -0,0 +1,15 @@
1
+ import { Slider as SliderPrimitive } from '@base-ui/react/slider';
2
+ import { type WithClassName } from '../lib/cn.js';
3
+ type SliderProps = Omit<WithClassName<SliderPrimitive.Root.Props<readonly number[]>>, 'value' | 'defaultValue' | 'onValueChange' | 'onValueCommitted'> & {
4
+ /** One entry per knob, so a range is two values. */
5
+ value?: readonly number[];
6
+ defaultValue?: readonly number[];
7
+ onValueChange?: (value: number[], details: SliderPrimitive.Root.ChangeEventDetails) => void;
8
+ onValueCommitted?: (value: number[], details: SliderPrimitive.Root.CommitEventDetails) => void;
9
+ };
10
+ /**
11
+ * A range on Base UI Slider: a 4px track in the hairline colour, filled with the
12
+ * action colour up to a 16px knob on the surface colour. One knob per value.
13
+ */
14
+ export declare const Slider: ({ className, id, disabled, value, defaultValue, onValueChange, onValueCommitted, "aria-label": ariaLabel, "aria-labelledby": labelledBy, "aria-describedby": describedBy, "aria-invalid": ariaInvalid, ...props }: SliderProps) => import("react").JSX.Element;
15
+ export {};
@@ -0,0 +1,28 @@
1
+ 'use client';
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { Slider as SliderPrimitive } from '@base-ui/react/slider';
4
+ import { cn } from '../lib/cn.js';
5
+ import { useField, useFieldControl } from './field.js';
6
+ /** Base UI hands back a bare number for one knob; callers always get an array. */
7
+ const toArray = (value) => typeof value === 'number' ? [value] : [...value];
8
+ /**
9
+ * A range on Base UI Slider: a 4px track in the hairline colour, filled with the
10
+ * action colour up to a 16px knob on the surface colour. One knob per value.
11
+ */
12
+ export const Slider = ({ className, id, disabled, value, defaultValue, onValueChange, onValueCommitted, 'aria-label': ariaLabel, 'aria-labelledby': labelledBy, 'aria-describedby': describedBy, 'aria-invalid': ariaInvalid, ...props }) => {
13
+ const field = useField();
14
+ const { invalid: _invalid, ...control } = useFieldControl({
15
+ id,
16
+ disabled,
17
+ 'aria-describedby': describedBy,
18
+ 'aria-invalid': ariaInvalid,
19
+ });
20
+ const thumbs = (value ?? defaultValue ?? [0]).length;
21
+ return (_jsx(SliderPrimitive.Root, { className: cn('w-full data-disabled:cursor-not-allowed data-disabled:opacity-50', className), "data-slot": "slider", defaultValue: defaultValue, disabled: control.disabled, id: control.id, "aria-labelledby": labelledBy ?? (ariaLabel ? undefined : field?.labelId), "aria-invalid": control['aria-invalid'],
22
+ // Edge alignment keeps the knob inside the track at min and max, as before.
23
+ thumbAlignment: "edge", value: value, onValueChange: onValueChange && ((next, details) => onValueChange(toArray(next), details)), onValueCommitted: onValueCommitted && ((next, details) => onValueCommitted(toArray(next), details)), ...props, children: _jsxs(SliderPrimitive.Control, { className: "relative flex h-5 w-full touch-none select-none items-center", "data-slot": "slider-control", children: [_jsx(SliderPrimitive.Track, { className: "relative h-1 grow overflow-hidden rounded-full bg-neutral-200", "data-slot": "slider-track", children: _jsx(SliderPrimitive.Indicator, { className: "h-full bg-action [background-image:var(--action-gradient)]", "data-slot": "slider-range" }) }), Array.from({ length: thumbs }, (_, index) => (_jsx(SliderPrimitive.Thumb
24
+ // A label on the slider names each knob's input, which is what takes focus.
25
+ , { "aria-describedby": control['aria-describedby'], "aria-label": ariaLabel, className: cn('block size-4 cursor-grab rounded-full border border-neutral-300 bg-neutral-50 shadow-float transition-[border-color] duration-150 not-data-disabled:hover:border-neutral-500 active:cursor-grabbing data-dragging:cursor-grabbing', 'data-disabled:cursor-not-allowed',
26
+ // Focus lands on the hidden input inside the knob, so the ring follows it.
27
+ 'outline-none has-focus-visible:outline-2 has-focus-visible:outline-focus has-focus-visible:outline-solid has-focus-visible:outline-offset-2'), "data-slot": "slider-thumb", index: index }, index)))] }) }));
28
+ };
@@ -0,0 +1,14 @@
1
+ import { type VariantProps } from 'class-variance-authority';
2
+ import type { ComponentProps } from 'react';
3
+ export declare const spinnerVariants: (props?: ({
4
+ size?: "sm" | "md" | null | undefined;
5
+ } & import("class-variance-authority/types").ClassProp) | undefined) => string;
6
+ export type SpinnerProps = Omit<ComponentProps<'svg'>, 'children'> & VariantProps<typeof spinnerVariants> & {
7
+ /** Names it for screen readers; leave it off inside a button, which says it is busy itself. */
8
+ label?: string;
9
+ };
10
+ /**
11
+ * A quarter arc turning on a faint ring, in the text colour. It belongs inside the button that is
12
+ * busy (`<Button loading>`); a page that loads shows skeletons instead.
13
+ */
14
+ export declare const Spinner: ({ size, label, className, ...props }: SpinnerProps) => import("react").JSX.Element;
@@ -0,0 +1,19 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { cva } from 'class-variance-authority';
3
+ import { cn } from '../lib/cn.js';
4
+ export const spinnerVariants = cva(
5
+ // Reduced motion keeps it turning, slowly: a frozen arc would read as stuck rather than busy.
6
+ 'shrink-0 animate-spin motion-reduce:animate-[spin_1.6s_linear_infinite]', {
7
+ variants: {
8
+ size: {
9
+ sm: 'size-3',
10
+ md: 'size-4',
11
+ },
12
+ },
13
+ defaultVariants: { size: 'md' },
14
+ });
15
+ /**
16
+ * A quarter arc turning on a faint ring, in the text colour. It belongs inside the button that is
17
+ * busy (`<Button loading>`); a page that loads shows skeletons instead.
18
+ */
19
+ export const Spinner = ({ size, label, className, ...props }) => (_jsxs("svg", { "aria-hidden": label ? undefined : true, "aria-label": label, className: cn(spinnerVariants({ size }), className), "data-slot": "spinner", fill: "none", role: label ? 'status' : undefined, viewBox: "0 0 16 16", ...props, children: [_jsx("circle", { cx: "8", cy: "8", opacity: "0.25", r: "6", stroke: "currentColor", strokeWidth: "2" }), _jsx("path", { d: "M8 2a6 6 0 0 1 6 6", stroke: "currentColor", strokeLinecap: "round", strokeWidth: "2" })] }));
@@ -0,0 +1,24 @@
1
+ import { type VariantProps } from 'class-variance-authority';
2
+ import type { ComponentProps, ReactNode } from 'react';
3
+ export declare const statusDotVariants: (props?: ({
4
+ size?: "sm" | "md" | null | undefined;
5
+ tone?: "primary" | "neutral" | "success" | "warning" | "error" | null | undefined;
6
+ } & import("class-variance-authority/types").ClassProp) | undefined) => string;
7
+ export type StatusDotTone = NonNullable<VariantProps<typeof statusDotVariants>['tone']>;
8
+ export type StatusDotProps = Omit<ComponentProps<'span'>, 'children'> & VariantProps<typeof statusDotVariants> & {
9
+ /** A slow halo for something live; it stays still for people who ask for reduced motion. */
10
+ pulse?: boolean;
11
+ /** Names the status for screen readers; without it the dot is decoration beside its text. */
12
+ label?: string;
13
+ };
14
+ /** A small dot in a status tone, optionally pulsing for a live state. */
15
+ export declare const StatusDot: ({ size, tone, pulse, label, className, ...props }: StatusDotProps) => import("react").JSX.Element;
16
+ export type LiveCountProps = Omit<ComponentProps<'span'>, 'children'> & {
17
+ count: number;
18
+ /** What is being counted, after the number. */
19
+ label?: ReactNode;
20
+ /** Formats the number; defaults to en-GB grouping ("1,234"), the same on the server and in the browser. */
21
+ format?: (count: number) => string;
22
+ };
23
+ /** "129 Active now": a pulsing dot, the live number and what it counts; still and grey at zero. */
24
+ export declare const LiveCount: ({ count, label, format, className, ...props }: LiveCountProps) => import("react").JSX.Element;
@@ -0,0 +1,35 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { cva } from 'class-variance-authority';
3
+ import { cn } from '../lib/cn.js';
4
+ export const statusDotVariants = cva('relative inline-flex shrink-0 rounded-full', {
5
+ variants: {
6
+ size: {
7
+ sm: 'size-1.5',
8
+ md: 'size-2',
9
+ },
10
+ // Step 500 is the badge dot's colour too, so a dot and a badge in one tone match.
11
+ tone: {
12
+ neutral: 'bg-neutral-500',
13
+ success: 'bg-success-500',
14
+ warning: 'bg-warning-500',
15
+ error: 'bg-error-500',
16
+ primary: 'bg-primary-500',
17
+ },
18
+ },
19
+ defaultVariants: {
20
+ size: 'md',
21
+ tone: 'success',
22
+ },
23
+ });
24
+ /** A small dot in a status tone, optionally pulsing for a live state. */
25
+ export const StatusDot = ({ size, tone, pulse = false, label, className, ...props }) => (_jsxs("span", { "aria-hidden": label ? undefined : true, className: cn(statusDotVariants({ size, tone }), className), "data-pulse": pulse || undefined, "data-slot": "status-dot", "data-tone": tone ?? 'success', ...props, children: [label && _jsx("span", { className: "sr-only", children: label }), pulse && (
26
+ // Tailwind's ping runs at 1s, which reads as an alarm; two seconds reads as a heartbeat.
27
+ _jsx("span", { className: "absolute inset-0 animate-ping rounded-full bg-inherit opacity-60 [animation-duration:2s] motion-reduce:hidden", "data-slot": "status-dot-pulse" }))] }));
28
+ // A fixed locale: the runtime's own would let a server render "1,234" and the browser hydrate "1.234".
29
+ const numberFormat = new Intl.NumberFormat('en-GB');
30
+ const defaultFormat = (count) => numberFormat.format(count);
31
+ /** "129 Active now": a pulsing dot, the live number and what it counts; still and grey at zero. */
32
+ export const LiveCount = ({ count, label = 'Active now', format = defaultFormat, className, ...props }) => {
33
+ const live = count > 0;
34
+ return (_jsxs("span", { className: cn('inline-flex min-w-0 items-center gap-2 text-xs', className), "data-live": live || undefined, "data-slot": "live-count", ...props, children: [_jsx(StatusDot, { pulse: live, tone: live ? 'success' : 'neutral' }), _jsxs("span", { className: "min-w-0 truncate", children: [_jsx("span", { className: "font-medium text-neutral-950 tabular-nums", children: format(count) }), ' ', _jsx("span", { className: "font-normal text-neutral-600", children: label })] })] }));
35
+ };
@@ -0,0 +1,60 @@
1
+ import { type ComponentProps, type ReactNode } from 'react';
2
+ type Orientation = 'horizontal' | 'vertical';
3
+ export type StepStatus = 'done' | 'current' | 'upcoming';
4
+ /**
5
+ * How a step is marked. `number` and `dot` are small round marks on a hairline, `icon` a bordered
6
+ * square holding the step's own icon, `line` a bar under each label with no rule between them.
7
+ */
8
+ export type StepperMarker = 'number' | 'dot' | 'icon' | 'line';
9
+ /** In a row: the text centred under its marker, or beside it. */
10
+ export type StepperLayout = 'centered' | 'inline';
11
+ /** What a screen reader hears after each label: a step's status, and that it needs attention. */
12
+ export type StepperStatusLabels = Record<StepStatus | 'invalid', string>;
13
+ export type StepperProps = ComponentProps<'ol'> & {
14
+ /** A row over the form, or a column beside a long one. */
15
+ orientation?: Orientation;
16
+ /** In a row, the text beside each marker (the default) or centred under it. */
17
+ layout?: StepperLayout;
18
+ /** How each step is marked; see `StepperMarker`. */
19
+ marker?: StepperMarker;
20
+ /** The current step's number; the steps before it are done, the ones after it upcoming. */
21
+ value?: number;
22
+ /** Makes every done step a button that goes back to it. */
23
+ onValueChange?: (step: number) => void;
24
+ /** The status words read after each label, for another language; any left out keep the English. */
25
+ statusLabels?: Partial<StepperStatusLabels>;
26
+ };
27
+ /**
28
+ * The steps of a long form: what is done, where you are and what is left. Give it the current step
29
+ * as `value` and each item works out its own status; an item's `status` still wins, for forms whose
30
+ * steps are not done in order. A row gives way as it narrows rather than truncating: under 576px
31
+ * only the current step keeps its description, under 448px only its label.
32
+ */
33
+ export declare const Stepper: ({ orientation, layout, marker, value, onValueChange, statusLabels, className, style, ...props }: StepperProps) => import("react").JSX.Element;
34
+ export declare const stepMarkerVariants: (props?: ({
35
+ marker?: "number" | "icon" | "dot" | null | undefined;
36
+ status?: "done" | "current" | "upcoming" | null | undefined;
37
+ invalid?: boolean | null | undefined;
38
+ } & import("class-variance-authority/types").ClassProp) | undefined) => string;
39
+ export type StepperItemProps = Omit<ComponentProps<'li'>, 'title' | 'onClick'> & {
40
+ /** The step's number, shown in a `number` marker until it is done. */
41
+ step: number;
42
+ label: ReactNode;
43
+ /** A line under the label: what the step asks for, what was answered, or what needs fixing. */
44
+ description?: ReactNode;
45
+ /** The 16px icon an `icon` marker holds; without one it shows the step's number. */
46
+ icon?: ReactNode;
47
+ /** Worked out from the stepper's `value` when left out. */
48
+ status?: StepStatus;
49
+ /** How far through the current step is, 0 to 1, for a `line` marker's bar. Full when left out. */
50
+ progress?: number;
51
+ /** Something in this step needs fixing: the marker, number and description turn to the error ramp. */
52
+ invalid?: boolean;
53
+ /** Makes the step a button; done steps get one from the stepper's `onValueChange` already. */
54
+ onSelect?: () => void;
55
+ /** In a vertical stepper, what the step holds, under its label: its fields while it is current. */
56
+ children?: ReactNode;
57
+ };
58
+ /** One step: its marker, label and description, and the rule to the next step. */
59
+ export declare const StepperItem: ({ step, label, description, icon, status: statusProp, progress, invalid, onSelect: onSelectProp, className, children, ...props }: StepperItemProps) => import("react").JSX.Element;
60
+ export {};