@nanisoft/prism-ui 0.10.2 → 0.13.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 (334) hide show
  1. package/LICENSE +21 -21
  2. package/dist/.tsbuildinfo +1 -1
  3. package/dist/blocks/app-shell-01/app-shell.js +4 -4
  4. package/dist/blocks/app-shell-01/index.d.ts +2 -2
  5. package/dist/blocks/app-shell-01/index.js +1 -1
  6. package/dist/blocks/auth-form-01/auth-form.d.ts +11 -1
  7. package/dist/blocks/auth-form-01/auth-form.d.ts.map +1 -1
  8. package/dist/blocks/auth-form-01/auth-form.js +11 -8
  9. package/dist/blocks/auth-form-01/index.d.ts +2 -2
  10. package/dist/blocks/auth-form-01/index.js +1 -1
  11. package/dist/blocks/cta-01/cta.d.ts +26 -21
  12. package/dist/blocks/cta-01/cta.d.ts.map +1 -1
  13. package/dist/blocks/cta-01/cta.js +2 -2
  14. package/dist/blocks/cta-01/index.d.ts +2 -2
  15. package/dist/blocks/cta-01/index.js +1 -1
  16. package/dist/blocks/data-table-01/data-table.js +7 -7
  17. package/dist/blocks/data-table-01/index.d.ts +2 -2
  18. package/dist/blocks/data-table-01/index.js +1 -1
  19. package/dist/blocks/empty-state-01/empty-state.d.ts +143 -0
  20. package/dist/blocks/empty-state-01/empty-state.d.ts.map +1 -0
  21. package/dist/blocks/empty-state-01/empty-state.js +104 -0
  22. package/dist/blocks/empty-state-01/index.d.ts +3 -0
  23. package/dist/blocks/empty-state-01/index.d.ts.map +1 -0
  24. package/dist/blocks/empty-state-01/index.js +1 -0
  25. package/dist/blocks/feature-grid-01/feature-grid.d.ts +28 -1
  26. package/dist/blocks/feature-grid-01/feature-grid.d.ts.map +1 -1
  27. package/dist/blocks/feature-grid-01/feature-grid.js +34 -3
  28. package/dist/blocks/feature-grid-01/index.d.ts +2 -2
  29. package/dist/blocks/feature-grid-01/index.js +1 -1
  30. package/dist/blocks/hero-01/hero.d.ts +35 -15
  31. package/dist/blocks/hero-01/hero.d.ts.map +1 -1
  32. package/dist/blocks/hero-01/hero.js +14 -9
  33. package/dist/blocks/hero-01/index.d.ts +2 -1
  34. package/dist/blocks/hero-01/index.d.ts.map +1 -1
  35. package/dist/blocks/hero-01/index.js +1 -1
  36. package/dist/blocks/index.d.ts +20 -20
  37. package/dist/blocks/index.js +19 -19
  38. package/dist/blocks/instrument-panel-01/index.d.ts +2 -2
  39. package/dist/blocks/instrument-panel-01/index.js +1 -1
  40. package/dist/blocks/instrument-panel-01/instrument-panel.js +1 -1
  41. package/dist/blocks/logo-strip-01/index.d.ts +2 -2
  42. package/dist/blocks/logo-strip-01/index.js +1 -1
  43. package/dist/blocks/logo-strip-01/logo-strip.d.ts +1 -1
  44. package/dist/blocks/logo-strip-01/logo-strip.js +2 -2
  45. package/dist/blocks/note-grid-01/index.d.ts +2 -2
  46. package/dist/blocks/note-grid-01/index.js +1 -1
  47. package/dist/blocks/note-grid-01/note-grid.d.ts +1 -1
  48. package/dist/blocks/note-grid-01/note-grid.js +1 -1
  49. package/dist/blocks/page-header-01/index.d.ts +2 -2
  50. package/dist/blocks/page-header-01/index.js +1 -1
  51. package/dist/blocks/page-header-01/page-header.d.ts +1 -1
  52. package/dist/blocks/page-header-01/page-header.js +4 -4
  53. package/dist/blocks/pricing-01/index.d.ts +1 -1
  54. package/dist/blocks/pricing-01/index.js +1 -1
  55. package/dist/blocks/pricing-01/pricing.d.ts +8 -1
  56. package/dist/blocks/pricing-01/pricing.d.ts.map +1 -1
  57. package/dist/blocks/pricing-01/pricing.js +15 -5
  58. package/dist/blocks/process-flow-01/index.d.ts +3 -0
  59. package/dist/blocks/process-flow-01/index.d.ts.map +1 -0
  60. package/dist/blocks/process-flow-01/index.js +1 -0
  61. package/dist/blocks/process-flow-01/process-flow.d.ts +118 -0
  62. package/dist/blocks/process-flow-01/process-flow.d.ts.map +1 -0
  63. package/dist/blocks/process-flow-01/process-flow.js +71 -0
  64. package/dist/blocks/process-rail-01/index.d.ts +2 -2
  65. package/dist/blocks/process-rail-01/index.js +1 -1
  66. package/dist/blocks/process-rail-01/process-rail.d.ts +1 -1
  67. package/dist/blocks/process-rail-01/process-rail.js +2 -2
  68. package/dist/blocks/product-grid-01/index.d.ts +2 -2
  69. package/dist/blocks/product-grid-01/index.js +1 -1
  70. package/dist/blocks/product-grid-01/product-grid.d.ts +37 -5
  71. package/dist/blocks/product-grid-01/product-grid.d.ts.map +1 -1
  72. package/dist/blocks/product-grid-01/product-grid.js +20 -6
  73. package/dist/blocks/run-console-01/index.d.ts +3 -0
  74. package/dist/blocks/run-console-01/index.d.ts.map +1 -0
  75. package/dist/blocks/run-console-01/index.js +1 -0
  76. package/dist/blocks/run-console-01/run-console.d.ts +111 -0
  77. package/dist/blocks/run-console-01/run-console.d.ts.map +1 -0
  78. package/dist/blocks/run-console-01/run-console.js +48 -0
  79. package/dist/blocks/settings-panel-01/index.d.ts +2 -2
  80. package/dist/blocks/settings-panel-01/index.js +1 -1
  81. package/dist/blocks/settings-panel-01/settings-panel.d.ts +11 -1
  82. package/dist/blocks/settings-panel-01/settings-panel.d.ts.map +1 -1
  83. package/dist/blocks/settings-panel-01/settings-panel.js +15 -10
  84. package/dist/blocks/site-footer/index.d.ts +2 -2
  85. package/dist/blocks/site-footer/index.js +1 -1
  86. package/dist/blocks/site-footer/site-footer.d.ts +1 -1
  87. package/dist/blocks/site-footer/site-footer.js +2 -2
  88. package/dist/blocks/site-header/index.d.ts +2 -2
  89. package/dist/blocks/site-header/index.js +1 -1
  90. package/dist/blocks/site-header/site-header.d.ts +2 -2
  91. package/dist/blocks/site-header/site-header.js +3 -3
  92. package/dist/blocks/site-navbar/index.d.ts +3 -0
  93. package/dist/blocks/site-navbar/index.d.ts.map +1 -0
  94. package/dist/blocks/site-navbar/index.js +1 -0
  95. package/dist/blocks/site-navbar/mobile-nav.d.ts +48 -0
  96. package/dist/blocks/site-navbar/mobile-nav.d.ts.map +1 -0
  97. package/dist/blocks/site-navbar/mobile-nav.js +35 -0
  98. package/dist/blocks/site-navbar/mode-toggle.d.ts +39 -0
  99. package/dist/blocks/site-navbar/mode-toggle.d.ts.map +1 -0
  100. package/dist/blocks/site-navbar/mode-toggle.js +39 -0
  101. package/dist/blocks/site-navbar/navbar-controls.d.ts +79 -0
  102. package/dist/blocks/site-navbar/navbar-controls.d.ts.map +1 -0
  103. package/dist/blocks/site-navbar/navbar-controls.js +40 -0
  104. package/dist/blocks/site-navbar/search-entry.d.ts +29 -0
  105. package/dist/blocks/site-navbar/search-entry.d.ts.map +1 -0
  106. package/dist/blocks/site-navbar/search-entry.js +52 -0
  107. package/dist/blocks/site-navbar/site-navbar.d.ts +212 -0
  108. package/dist/blocks/site-navbar/site-navbar.d.ts.map +1 -0
  109. package/dist/blocks/site-navbar/site-navbar.js +61 -0
  110. package/dist/blocks/site-navbar/sites-menu.d.ts +40 -0
  111. package/dist/blocks/site-navbar/sites-menu.d.ts.map +1 -0
  112. package/dist/blocks/site-navbar/sites-menu.js +48 -0
  113. package/dist/blocks/site-navbar/theme-menu.d.ts +47 -0
  114. package/dist/blocks/site-navbar/theme-menu.d.ts.map +1 -0
  115. package/dist/blocks/site-navbar/theme-menu.js +55 -0
  116. package/dist/blocks/stack-grid-01/index.d.ts +2 -2
  117. package/dist/blocks/stack-grid-01/index.js +1 -1
  118. package/dist/blocks/stack-grid-01/stack-grid.d.ts +42 -11
  119. package/dist/blocks/stack-grid-01/stack-grid.d.ts.map +1 -1
  120. package/dist/blocks/stack-grid-01/stack-grid.js +15 -7
  121. package/dist/blocks/stats-01/index.d.ts +9 -1
  122. package/dist/blocks/stats-01/index.d.ts.map +1 -1
  123. package/dist/blocks/stats-01/index.js +8 -1
  124. package/dist/blocks/stats-01/stats.d.ts +1 -1
  125. package/dist/blocks/stats-01/stats.js +2 -2
  126. package/dist/blocks/status-ledger-01/index.d.ts +2 -2
  127. package/dist/blocks/status-ledger-01/index.js +1 -1
  128. package/dist/blocks/status-ledger-01/status-ledger.d.ts +1 -1
  129. package/dist/blocks/status-ledger-01/status-ledger.js +2 -2
  130. package/dist/catalog.d.ts +1 -1
  131. package/dist/catalog.d.ts.map +1 -1
  132. package/dist/catalog.js +473 -1
  133. package/dist/components/index.d.ts +104 -66
  134. package/dist/components/index.d.ts.map +1 -1
  135. package/dist/components/index.js +74 -40
  136. package/dist/components/ui/accordion.js +1 -1
  137. package/dist/components/ui/alert-dialog.d.ts +119 -0
  138. package/dist/components/ui/alert-dialog.d.ts.map +1 -0
  139. package/dist/components/ui/alert-dialog.js +82 -0
  140. package/dist/components/ui/alert.js +1 -1
  141. package/dist/components/ui/aspect-ratio.d.ts +60 -0
  142. package/dist/components/ui/aspect-ratio.d.ts.map +1 -0
  143. package/dist/components/ui/aspect-ratio.js +61 -0
  144. package/dist/components/ui/avatar.js +1 -1
  145. package/dist/components/ui/badge.js +1 -1
  146. package/dist/components/ui/breadcrumb.js +1 -1
  147. package/dist/components/ui/button-group.d.ts +68 -0
  148. package/dist/components/ui/button-group.d.ts.map +1 -0
  149. package/dist/components/ui/button-group.js +54 -0
  150. package/dist/components/ui/button.js +1 -1
  151. package/dist/components/ui/calendar.d.ts +158 -0
  152. package/dist/components/ui/calendar.d.ts.map +1 -0
  153. package/dist/components/ui/calendar.js +216 -0
  154. package/dist/components/ui/card.d.ts +18 -6
  155. package/dist/components/ui/card.d.ts.map +1 -1
  156. package/dist/components/ui/card.js +23 -8
  157. package/dist/components/ui/carousel.d.ts +118 -0
  158. package/dist/components/ui/carousel.d.ts.map +1 -0
  159. package/dist/components/ui/carousel.js +152 -0
  160. package/dist/components/ui/chart-frame.d.ts +216 -0
  161. package/dist/components/ui/chart-frame.d.ts.map +1 -0
  162. package/dist/components/ui/chart-frame.js +286 -0
  163. package/dist/components/ui/checkbox.js +1 -1
  164. package/dist/components/ui/collapsible.d.ts +97 -0
  165. package/dist/components/ui/collapsible.d.ts.map +1 -0
  166. package/dist/components/ui/collapsible.js +54 -0
  167. package/dist/components/ui/combobox.d.ts +141 -0
  168. package/dist/components/ui/combobox.d.ts.map +1 -0
  169. package/dist/components/ui/combobox.js +243 -0
  170. package/dist/components/ui/command-palette.d.ts +106 -0
  171. package/dist/components/ui/command-palette.d.ts.map +1 -0
  172. package/dist/components/ui/command-palette.js +176 -0
  173. package/dist/components/ui/command.d.ts +82 -0
  174. package/dist/components/ui/command.d.ts.map +1 -0
  175. package/dist/components/ui/command.js +37 -0
  176. package/dist/components/ui/context-menu.d.ts +151 -0
  177. package/dist/components/ui/context-menu.d.ts.map +1 -0
  178. package/dist/components/ui/context-menu.js +97 -0
  179. package/dist/components/ui/cta-link.js +1 -1
  180. package/dist/components/ui/date-picker.d.ts +111 -0
  181. package/dist/components/ui/date-picker.d.ts.map +1 -0
  182. package/dist/components/ui/date-picker.js +74 -0
  183. package/dist/components/ui/diagram.d.ts +84 -15
  184. package/dist/components/ui/diagram.d.ts.map +1 -1
  185. package/dist/components/ui/diagram.js +77 -7
  186. package/dist/components/ui/dialog.js +1 -1
  187. package/dist/components/ui/diff.d.ts +105 -0
  188. package/dist/components/ui/diff.d.ts.map +1 -0
  189. package/dist/components/ui/diff.js +113 -0
  190. package/dist/components/ui/dropdown-menu.d.ts +18 -0
  191. package/dist/components/ui/dropdown-menu.d.ts.map +1 -1
  192. package/dist/components/ui/dropdown-menu.js +1 -1
  193. package/dist/components/ui/fact-list.js +1 -1
  194. package/dist/components/ui/field.js +1 -1
  195. package/dist/components/ui/form.d.ts +151 -0
  196. package/dist/components/ui/form.d.ts.map +1 -0
  197. package/dist/components/ui/form.js +73 -0
  198. package/dist/components/ui/hover-card.d.ts +105 -0
  199. package/dist/components/ui/hover-card.d.ts.map +1 -0
  200. package/dist/components/ui/hover-card.js +49 -0
  201. package/dist/components/ui/input-group.d.ts +99 -0
  202. package/dist/components/ui/input-group.d.ts.map +1 -0
  203. package/dist/components/ui/input-group.js +83 -0
  204. package/dist/components/ui/input.js +1 -1
  205. package/dist/components/ui/item.d.ts +113 -0
  206. package/dist/components/ui/item.d.ts.map +1 -0
  207. package/dist/components/ui/item.js +61 -0
  208. package/dist/components/ui/kbd.js +1 -1
  209. package/dist/components/ui/label.d.ts +58 -0
  210. package/dist/components/ui/label.d.ts.map +1 -0
  211. package/dist/components/ui/label.js +29 -0
  212. package/dist/components/ui/live-region.d.ts +9 -0
  213. package/dist/components/ui/live-region.d.ts.map +1 -1
  214. package/dist/components/ui/live-region.js +10 -2
  215. package/dist/components/ui/mark.js +1 -1
  216. package/dist/components/ui/menubar.d.ts +197 -0
  217. package/dist/components/ui/menubar.d.ts.map +1 -0
  218. package/dist/components/ui/menubar.js +109 -0
  219. package/dist/components/ui/meter.d.ts +121 -0
  220. package/dist/components/ui/meter.d.ts.map +1 -0
  221. package/dist/components/ui/meter.js +82 -0
  222. package/dist/components/ui/native-select.d.ts +72 -0
  223. package/dist/components/ui/native-select.d.ts.map +1 -0
  224. package/dist/components/ui/native-select.js +55 -0
  225. package/dist/components/ui/navigation-menu.d.ts +186 -0
  226. package/dist/components/ui/navigation-menu.d.ts.map +1 -0
  227. package/dist/components/ui/navigation-menu.js +94 -0
  228. package/dist/components/ui/number-field.d.ts +111 -0
  229. package/dist/components/ui/number-field.d.ts.map +1 -0
  230. package/dist/components/ui/number-field.js +84 -0
  231. package/dist/components/ui/one-time-code.d.ts +127 -0
  232. package/dist/components/ui/one-time-code.d.ts.map +1 -0
  233. package/dist/components/ui/one-time-code.js +57 -0
  234. package/dist/components/ui/pagination.js +1 -1
  235. package/dist/components/ui/popover.js +1 -1
  236. package/dist/components/ui/product-mark.d.ts +1 -1
  237. package/dist/components/ui/product-mark.js +1 -1
  238. package/dist/components/ui/product-switcher.d.ts +1 -1
  239. package/dist/components/ui/product-switcher.js +2 -2
  240. package/dist/components/ui/progress.js +1 -1
  241. package/dist/components/ui/prose.js +1 -1
  242. package/dist/components/ui/pulse-graph.js +1 -1
  243. package/dist/components/ui/pulse-series.js +1 -1
  244. package/dist/components/ui/radio-group.js +1 -1
  245. package/dist/components/ui/resizable.d.ts +129 -0
  246. package/dist/components/ui/resizable.d.ts.map +1 -0
  247. package/dist/components/ui/resizable.js +205 -0
  248. package/dist/components/ui/scroll-area.d.ts +97 -0
  249. package/dist/components/ui/scroll-area.d.ts.map +1 -0
  250. package/dist/components/ui/scroll-area.js +68 -0
  251. package/dist/components/ui/search-dialog.d.ts +139 -0
  252. package/dist/components/ui/search-dialog.d.ts.map +1 -0
  253. package/dist/components/ui/search-dialog.js +178 -0
  254. package/dist/components/ui/section.d.ts +26 -0
  255. package/dist/components/ui/section.d.ts.map +1 -1
  256. package/dist/components/ui/section.js +32 -1
  257. package/dist/components/ui/select.js +1 -1
  258. package/dist/components/ui/separator.js +1 -1
  259. package/dist/components/ui/sheet.d.ts +103 -0
  260. package/dist/components/ui/sheet.d.ts.map +1 -0
  261. package/dist/components/ui/sheet.js +58 -0
  262. package/dist/components/ui/sidebar.d.ts +228 -0
  263. package/dist/components/ui/sidebar.d.ts.map +1 -0
  264. package/dist/components/ui/sidebar.js +172 -0
  265. package/dist/components/ui/signal-field.js +1 -1
  266. package/dist/components/ui/skeleton.js +1 -1
  267. package/dist/components/ui/slider.js +1 -1
  268. package/dist/components/ui/spinner.d.ts +79 -0
  269. package/dist/components/ui/spinner.d.ts.map +1 -0
  270. package/dist/components/ui/spinner.js +79 -0
  271. package/dist/components/ui/switch.js +1 -1
  272. package/dist/components/ui/table-sort.d.ts +97 -0
  273. package/dist/components/ui/table-sort.d.ts.map +1 -0
  274. package/dist/components/ui/table-sort.js +102 -0
  275. package/dist/components/ui/table.js +1 -1
  276. package/dist/components/ui/tabs.js +1 -1
  277. package/dist/components/ui/textarea.js +1 -1
  278. package/dist/components/ui/timeline.d.ts +106 -0
  279. package/dist/components/ui/timeline.d.ts.map +1 -0
  280. package/dist/components/ui/timeline.js +111 -0
  281. package/dist/components/ui/toast.d.ts +219 -0
  282. package/dist/components/ui/toast.d.ts.map +1 -0
  283. package/dist/components/ui/toast.js +270 -0
  284. package/dist/components/ui/toggle-group.d.ts +118 -0
  285. package/dist/components/ui/toggle-group.d.ts.map +1 -0
  286. package/dist/components/ui/toggle-group.js +194 -0
  287. package/dist/components/ui/toggle.d.ts +73 -0
  288. package/dist/components/ui/toggle.d.ts.map +1 -0
  289. package/dist/components/ui/toggle.js +44 -0
  290. package/dist/components/ui/tooltip.js +1 -1
  291. package/dist/components/ui/tree.js +1 -1
  292. package/dist/components/ui/typography.js +1 -1
  293. package/dist/fonts/Inter-OFL.txt +93 -93
  294. package/dist/index.d.ts +72 -70
  295. package/dist/index.d.ts.map +1 -1
  296. package/dist/index.js +61 -60
  297. package/dist/lib/rank.d.ts +69 -0
  298. package/dist/lib/rank.d.ts.map +1 -0
  299. package/dist/lib/rank.js +77 -0
  300. package/dist/live/index.d.ts +22 -0
  301. package/dist/live/index.d.ts.map +1 -0
  302. package/dist/live/index.js +20 -0
  303. package/dist/live/run-stream-01/index.d.ts +3 -0
  304. package/dist/live/run-stream-01/index.d.ts.map +1 -0
  305. package/dist/live/run-stream-01/index.js +1 -0
  306. package/dist/live/run-stream-01/run-stream.d.ts +125 -0
  307. package/dist/live/run-stream-01/run-stream.d.ts.map +1 -0
  308. package/dist/live/run-stream-01/run-stream.js +111 -0
  309. package/dist/pages/auth-page/index.d.ts +15 -2
  310. package/dist/pages/auth-page/index.d.ts.map +1 -1
  311. package/dist/pages/auth-page/index.js +8 -4
  312. package/dist/pages/blog-post-page/index.js +5 -5
  313. package/dist/pages/dashboard-page/index.d.ts +4 -4
  314. package/dist/pages/dashboard-page/index.js +4 -4
  315. package/dist/pages/docs-shell/docs-shell.d.ts +37 -4
  316. package/dist/pages/docs-shell/docs-shell.d.ts.map +1 -1
  317. package/dist/pages/docs-shell/docs-shell.js +107 -16
  318. package/dist/pages/docs-shell/index.d.ts +2 -2
  319. package/dist/pages/docs-shell/index.js +1 -1
  320. package/dist/pages/index.d.ts +14 -14
  321. package/dist/pages/index.js +7 -7
  322. package/dist/pages/marketing-page/index.d.ts +6 -6
  323. package/dist/pages/marketing-page/index.js +5 -5
  324. package/dist/pages/not-found-page/index.js +4 -4
  325. package/dist/pages/settings-page/index.d.ts +3 -3
  326. package/dist/pages/settings-page/index.js +4 -4
  327. package/dist/provider/index.d.ts +4 -4
  328. package/dist/provider/index.js +2 -2
  329. package/dist/provider/provider.d.ts +1 -1
  330. package/dist/provider/provider.js +1 -1
  331. package/dist/provider/theme-script.d.ts +1 -1
  332. package/dist/provider/theme-script.js +1 -1
  333. package/dist/styles.css +689 -0
  334. package/package.json +9 -1
@@ -0,0 +1,197 @@
1
+ import type { ComponentProps } from 'react';
2
+ /**
3
+ * The props Menubar forwards to Base UI.
4
+ *
5
+ * Declared here rather than re-exported from Base UI so no upstream type
6
+ * crosses the package seam (ticket 07 section 6).
7
+ */
8
+ export interface MenubarProps extends Omit<ComponentProps<'div'>, 'onChange'> {
9
+ /**
10
+ * The accessible name of the bar, read before its menus.
11
+ *
12
+ * Required rather than defaulted, because a menubar is a single Tab stop and
13
+ * nothing on the page tells a screen reader it is there until focus lands on
14
+ * it. A bar named "menu" beside a row of buttons named "menu" is a page where
15
+ * a reader cannot tell which is which. The name is the caller's word, and it
16
+ * is usually the application's own name, because that is what the bar acts on.
17
+ */
18
+ label: string;
19
+ /** Whether the bar is vertical rather than horizontal. @defaultValue horizontal */
20
+ orientation?: 'horizontal' | 'vertical';
21
+ /** Whether every menu in the bar ignores user interaction. @defaultValue false */
22
+ disabled?: boolean;
23
+ /**
24
+ * Whether an open menu makes the rest of the page inert.
25
+ *
26
+ * `true` by default, and the default is the right one for a bar: a menu that
27
+ * leaves the page live is a menu a pointer reader can click straight through,
28
+ * and an application menu bar is the one menu where the reader is expected to
29
+ * be somewhere else while it is open.
30
+ */
31
+ modal?: boolean;
32
+ /** Whether the arrow keys wrap past the end of the bar. @defaultValue true */
33
+ loopFocus?: boolean;
34
+ }
35
+ /** The props MenubarMenu forwards to Base UI. */
36
+ export interface MenubarMenuProps {
37
+ /** The controlled open state. */
38
+ open?: boolean;
39
+ /** The initially open state, for an uncontrolled menu. */
40
+ defaultOpen?: boolean;
41
+ /** Called when the open state changes. */
42
+ onOpenChange?: (open: boolean) => void;
43
+ /** Whether this menu ignores user interaction. @defaultValue false */
44
+ disabled?: boolean;
45
+ /** The trigger and the menu content. */
46
+ children?: React.ReactNode;
47
+ }
48
+ /** The props MenubarTrigger forwards to Base UI. */
49
+ export interface MenubarTriggerProps extends ComponentProps<'button'> {
50
+ }
51
+ /**
52
+ * The props MenubarContent forwards to Base UI.
53
+ *
54
+ * Declared here rather than re-exported from Base UI so no upstream type
55
+ * crosses the package seam (ticket 07 section 6).
56
+ */
57
+ export interface MenubarContentProps extends ComponentProps<'div'> {
58
+ /** The distance in pixels between the trigger and the menu. @defaultValue 4 */
59
+ sideOffset?: number;
60
+ /** The offset in pixels along the alignment axis. @defaultValue 0 */
61
+ alignOffset?: number;
62
+ }
63
+ /** The props MenubarItem forwards to Base UI. */
64
+ export interface MenubarItemProps extends ComponentProps<'div'> {
65
+ /** Whether the item reads as a destructive action. @defaultValue default */
66
+ variant?: 'default' | 'destructive';
67
+ /** Whether the item ignores user interaction. */
68
+ disabled?: boolean;
69
+ }
70
+ /** The props MenubarLinkItem forwards to Base UI. */
71
+ export interface MenubarLinkItemProps extends ComponentProps<'a'> {
72
+ /** Whether the link reads as a destructive action. @defaultValue default */
73
+ variant?: 'default' | 'destructive';
74
+ }
75
+ /**
76
+ * The props MenubarCheckboxItem forwards to Base UI.
77
+ *
78
+ * Declared here rather than re-exported from Base UI so no upstream type
79
+ * crosses the package seam (ticket 07 section 6). An unchecked item needs this
80
+ * group to hold its state, and without it a tick in a menu has nowhere to live.
81
+ */
82
+ export interface MenubarCheckboxItemProps extends Omit<ComponentProps<'div'>, 'onChange'> {
83
+ /** The controlled ticked state. */
84
+ checked?: boolean;
85
+ /** The initially ticked state, for an uncontrolled item. */
86
+ defaultChecked?: boolean;
87
+ /** Called when the ticked state changes. */
88
+ onCheckedChange?: (checked: boolean) => void;
89
+ /** Whether the item ignores user interaction. */
90
+ disabled?: boolean;
91
+ /** Whether the menu closes when the item is chosen. @defaultValue false */
92
+ closeOnClick?: boolean;
93
+ }
94
+ /** The props MenubarLabel forwards to Base UI. */
95
+ export interface MenubarLabelProps extends ComponentProps<'div'> {
96
+ }
97
+ /** The props MenubarSeparator forwards to Base UI. */
98
+ export interface MenubarSeparatorProps extends ComponentProps<'div'> {
99
+ }
100
+ /** The props MenubarGroup forwards to Base UI. */
101
+ export interface MenubarGroupProps extends ComponentProps<'div'> {
102
+ }
103
+ /** The props MenubarSub forwards to Base UI. */
104
+ export interface MenubarSubProps {
105
+ /** The controlled open state of the submenu. */
106
+ open?: boolean;
107
+ /** The initially open state of the submenu. */
108
+ defaultOpen?: boolean;
109
+ /** Called when the submenu opens or closes. */
110
+ onOpenChange?: (open: boolean) => void;
111
+ /** The submenu trigger and its content. */
112
+ children?: React.ReactNode;
113
+ }
114
+ /** The props MenubarSubTrigger forwards to Base UI. */
115
+ export interface MenubarSubTriggerProps extends ComponentProps<'div'> {
116
+ }
117
+ /** The props MenubarSubContent forwards to Base UI. */
118
+ export interface MenubarSubContentProps extends ComponentProps<'div'> {
119
+ /** The distance in pixels between the submenu and the trigger. @defaultValue 0 */
120
+ sideOffset?: number;
121
+ /** The offset in pixels along the alignment axis. @defaultValue 0 */
122
+ alignOffset?: number;
123
+ }
124
+ /**
125
+ * The bar at the top of an application window that owns its commands.
126
+ *
127
+ * **A menubar is one Tab stop, and that is the whole difference from a row of
128
+ * dropdowns.** Arrow keys move along the bar and open a menu; Tab leaves the bar
129
+ * and enters the page. A consumer who composes the same set of menus as a row of
130
+ * buttons gets the Tab order of the document instead, which is every button in
131
+ * the bar and none of the arrows, and the bar becomes a keyboard trap that
132
+ * happens to sit at the top of the page. That is why this Component ships the
133
+ * bar as a part rather than leaving it to a wrapper: the one-Tab-stop model is
134
+ * the reason the parts exist.
135
+ *
136
+ * **Every menu in a bar is modal while it is open.** A menu that leaves the page
137
+ * live is a menu a pointer reader clicks straight through, and an application
138
+ * menu bar is the one menu where the reader is elsewhere while it is open. Pass
139
+ * `modal={false}` on the bar when that is not the case.
140
+ *
141
+ * **`label` is required.** A bar is one Tab stop and nothing announces it until
142
+ * focus lands there, so two unnamed bars are two things a screen reader calls
143
+ * "menu". Use the DropdownMenu for a menu attached to a control rather than to
144
+ * the application, and the NavigationMenu for links rather than commands.
145
+ */
146
+ declare function Menubar({ className, label, orientation, ...props }: MenubarProps): import("react").JSX.Element;
147
+ /**
148
+ * One menu in the bar, holding its trigger and its rows.
149
+ *
150
+ * It is a menu root rather than a bare element because the bar needs to know
151
+ * which menu is open, and the arrow keys only work between menus that share a
152
+ * parent. A consumer who drops the trigger and the content inside a plain `div`
153
+ * gets two independent dropdowns and no bar.
154
+ */
155
+ declare function MenubarMenu({ ...props }: MenubarMenuProps): import("react").JSX.Element;
156
+ /**
157
+ * The control that opens one menu in the bar.
158
+ *
159
+ * It is a real button and it is a menu item in the bar's own model, so Enter and
160
+ * Arrow Down open the menu and the arrows along the bar move between triggers.
161
+ */
162
+ declare function MenubarTrigger({ className, ...props }: MenubarTriggerProps): import("react").JSX.Element;
163
+ /** The floating menu surface. */
164
+ declare function MenubarContent({ className, sideOffset, alignOffset, ...props }: MenubarContentProps): import("react").JSX.Element;
165
+ /** One command in the menu. It does something rather than going somewhere. */
166
+ declare function MenubarItem({ className, variant, ...props }: MenubarItemProps): import("react").JSX.Element;
167
+ /**
168
+ * One destination in the menu, rendered as a native anchor.
169
+ *
170
+ * `File > Recent` is a list of places rather than a list of things to do, and a
171
+ * `div` styled like a link cannot be opened in a new tab or copied by address.
172
+ * A command belongs in `MenubarItem`; a place belongs here.
173
+ */
174
+ declare function MenubarLinkItem({ className, variant, ...props }: MenubarLinkItemProps): import("react").JSX.Element;
175
+ /**
176
+ * A menu row that toggles a setting, and leaves the menu open while it does.
177
+ *
178
+ * `closeOnClick` defaults to false here, and that is the decision: a setting is
179
+ * something a reader turns on, checks, and turns off again in the same visit, so
180
+ * a menu that closes on the tick makes the second of those impossible without a
181
+ * round trip through the bar. A command still closes.
182
+ */
183
+ declare function MenubarCheckboxItem({ className, children, checked, ...props }: MenubarCheckboxItemProps): import("react").JSX.Element;
184
+ /** A non-interactive heading inside a group of rows. */
185
+ declare function MenubarLabel({ className, ...props }: MenubarLabelProps): import("react").JSX.Element;
186
+ /** A rule between groups of rows. */
187
+ declare function MenubarSeparator({ className, ...props }: MenubarSeparatorProps): import("react").JSX.Element;
188
+ /** A labelled set of related rows. */
189
+ declare function MenubarGroup({ className, ...props }: MenubarGroupProps): import("react").JSX.Element;
190
+ /** A group of rows that opens into a second menu. */
191
+ declare function MenubarSub({ ...props }: MenubarSubProps): import("react").JSX.Element;
192
+ /** The row that opens a submenu. */
193
+ declare function MenubarSubTrigger({ className, children, ...props }: MenubarSubTriggerProps): import("react").JSX.Element;
194
+ /** The nested menu surface. */
195
+ declare function MenubarSubContent({ className, sideOffset, alignOffset, ...props }: MenubarSubContentProps): import("react").JSX.Element;
196
+ export { Menubar, MenubarMenu, MenubarTrigger, MenubarContent, MenubarItem, MenubarLinkItem, MenubarCheckboxItem, MenubarLabel, MenubarSeparator, MenubarGroup, MenubarSub, MenubarSubTrigger, MenubarSubContent, };
197
+ //# sourceMappingURL=menubar.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"menubar.d.ts","sourceRoot":"","sources":["../../../src/components/ui/menubar.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAA;AAY3C;;;;;GAKG;AACH,MAAM,WAAW,YAAa,SAAQ,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,EAAE,UAAU,CAAC;IAC3E;;;;;;;;OAQG;IACH,KAAK,EAAE,MAAM,CAAA;IACb,mFAAmF;IACnF,WAAW,CAAC,EAAE,YAAY,GAAG,UAAU,CAAA;IACvC,kFAAkF;IAClF,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB;;;;;;;OAOG;IACH,KAAK,CAAC,EAAE,OA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B,EACnB,YAAY,EACZ,gBAAgB,EAChB,YAAY,EACZ,UAAU,EACV,iBAAiB,EACjB,iBAAiB,GAClB,CAAA"}
@@ -0,0 +1,109 @@
1
+ 'use client';
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { Menubar as MenubarPrimitive } from '@base-ui/react/menubar';
4
+ import { Menu as MenuPrimitive } from '@base-ui/react/menu';
5
+ import { CheckIcon, ChevronRightIcon } from 'lucide-react';
6
+ import { cn } from '../../lib/utils.js';
7
+ /** The menu surface's own class string, shared by a top-level menu and a submenu. */
8
+ const POPUP = 'bg-popover text-popover-foreground z-50 max-h-(--available-height) min-w-48 overflow-x-hidden overflow-y-auto rounded-md border p-1 shadow-md outline-none transition-[opacity,transform] duration-fast ease-out focus-visible:ring-ring focus-visible:ring-[3px] data-[starting-style]:scale-95 data-[starting-style]:opacity-0 data-[ending-style]:scale-95 data-[ending-style]:opacity-0';
9
+ /** One row in a menubar menu, whether it is a command or a link. */
10
+ const ROW = 'focus:bg-accent focus:text-accent-foreground data-[highlighted]:bg-accent data-[highlighted]:text-accent-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*="size-"])]:size-4';
11
+ /**
12
+ * The bar at the top of an application window that owns its commands.
13
+ *
14
+ * **A menubar is one Tab stop, and that is the whole difference from a row of
15
+ * dropdowns.** Arrow keys move along the bar and open a menu; Tab leaves the bar
16
+ * and enters the page. A consumer who composes the same set of menus as a row of
17
+ * buttons gets the Tab order of the document instead, which is every button in
18
+ * the bar and none of the arrows, and the bar becomes a keyboard trap that
19
+ * happens to sit at the top of the page. That is why this Component ships the
20
+ * bar as a part rather than leaving it to a wrapper: the one-Tab-stop model is
21
+ * the reason the parts exist.
22
+ *
23
+ * **Every menu in a bar is modal while it is open.** A menu that leaves the page
24
+ * live is a menu a pointer reader clicks straight through, and an application
25
+ * menu bar is the one menu where the reader is elsewhere while it is open. Pass
26
+ * `modal={false}` on the bar when that is not the case.
27
+ *
28
+ * **`label` is required.** A bar is one Tab stop and nothing announces it until
29
+ * focus lands there, so two unnamed bars are two things a screen reader calls
30
+ * "menu". Use the DropdownMenu for a menu attached to a control rather than to
31
+ * the application, and the NavigationMenu for links rather than commands.
32
+ */
33
+ function Menubar({ className, label, orientation = 'horizontal', ...props }) {
34
+ return (_jsx(MenubarPrimitive, { "data-slot": "menubar", "aria-label": label, orientation: orientation, className: cn('bg-background flex items-center gap-1 rounded-md border p-1', 'data-[orientation=vertical]:flex-col data-[orientation=vertical]:items-stretch', className), ...props }));
35
+ }
36
+ /**
37
+ * One menu in the bar, holding its trigger and its rows.
38
+ *
39
+ * It is a menu root rather than a bare element because the bar needs to know
40
+ * which menu is open, and the arrow keys only work between menus that share a
41
+ * parent. A consumer who drops the trigger and the content inside a plain `div`
42
+ * gets two independent dropdowns and no bar.
43
+ */
44
+ function MenubarMenu({ ...props }) {
45
+ return _jsx(MenuPrimitive.Root, { ...props });
46
+ }
47
+ /**
48
+ * The control that opens one menu in the bar.
49
+ *
50
+ * It is a real button and it is a menu item in the bar's own model, so Enter and
51
+ * Arrow Down open the menu and the arrows along the bar move between triggers.
52
+ */
53
+ function MenubarTrigger({ className, ...props }) {
54
+ return (_jsx(MenuPrimitive.Trigger, { "data-slot": "menubar-trigger", className: cn('text-foreground inline-flex h-8 items-center gap-1.5 rounded-sm px-3 text-sm font-medium whitespace-nowrap outline-none', 'transition-[color,background-color,box-shadow] duration-fast ease-out', 'hover:bg-accent hover:text-accent-foreground focus-visible:ring-ring focus-visible:ring-[3px]', 'data-[popup-open]:bg-accent data-[popup-open]:text-accent-foreground', 'data-[disabled]:pointer-events-none data-[disabled]:opacity-50', className), ...props }));
55
+ }
56
+ /** The floating menu surface. */
57
+ function MenubarContent({ className, sideOffset = 4, alignOffset = 0, ...props }) {
58
+ return (_jsx(MenuPrimitive.Portal, { children: _jsx(MenuPrimitive.Positioner, { sideOffset: sideOffset, alignOffset: alignOffset, children: _jsx(MenuPrimitive.Popup, { "data-slot": "menubar-content", className: cn(POPUP, className), ...props }) }) }));
59
+ }
60
+ /** One command in the menu. It does something rather than going somewhere. */
61
+ function MenubarItem({ className, variant = 'default', ...props }) {
62
+ return (_jsx(MenuPrimitive.Item, { "data-slot": "menubar-item", "data-variant": variant, className: cn(ROW, 'data-[variant=destructive]:text-destructive data-[variant=destructive]:data-[highlighted]:bg-destructive/10', className), ...props }));
63
+ }
64
+ /**
65
+ * One destination in the menu, rendered as a native anchor.
66
+ *
67
+ * `File > Recent` is a list of places rather than a list of things to do, and a
68
+ * `div` styled like a link cannot be opened in a new tab or copied by address.
69
+ * A command belongs in `MenubarItem`; a place belongs here.
70
+ */
71
+ function MenubarLinkItem({ className, variant = 'default', ...props }) {
72
+ return (_jsx(MenuPrimitive.LinkItem, { "data-slot": "menubar-link-item", "data-variant": variant, className: cn(ROW, 'data-[variant=destructive]:text-destructive data-[variant=destructive]:data-[highlighted]:bg-destructive/10', className), ...props }));
73
+ }
74
+ /**
75
+ * A menu row that toggles a setting, and leaves the menu open while it does.
76
+ *
77
+ * `closeOnClick` defaults to false here, and that is the decision: a setting is
78
+ * something a reader turns on, checks, and turns off again in the same visit, so
79
+ * a menu that closes on the tick makes the second of those impossible without a
80
+ * round trip through the bar. A command still closes.
81
+ */
82
+ function MenubarCheckboxItem({ className, children, checked, ...props }) {
83
+ return (_jsxs(MenuPrimitive.CheckboxItem, { "data-slot": "menubar-checkbox-item", checked: checked, className: cn(ROW, 'pr-8 pl-8', className), ...props, children: [_jsx(MenuPrimitive.CheckboxItemIndicator, { className: "absolute left-2 flex size-4 items-center justify-center", children: _jsx(CheckIcon, { className: "size-4" }) }), children] }));
84
+ }
85
+ /** A non-interactive heading inside a group of rows. */
86
+ function MenubarLabel({ className, ...props }) {
87
+ return (_jsx(MenuPrimitive.GroupLabel, { "data-slot": "menubar-label", className: cn('px-2 py-1.5 text-xs font-medium', className), ...props }));
88
+ }
89
+ /** A rule between groups of rows. */
90
+ function MenubarSeparator({ className, ...props }) {
91
+ return (_jsx(MenuPrimitive.Separator, { "data-slot": "menubar-separator", className: cn('bg-border -mx-1 my-1 h-px', className), ...props }));
92
+ }
93
+ /** A labelled set of related rows. */
94
+ function MenubarGroup({ className, ...props }) {
95
+ return _jsx(MenuPrimitive.Group, { "data-slot": "menubar-group", className: cn(className), ...props });
96
+ }
97
+ /** A group of rows that opens into a second menu. */
98
+ function MenubarSub({ ...props }) {
99
+ return _jsx(MenuPrimitive.SubmenuRoot, { ...props });
100
+ }
101
+ /** The row that opens a submenu. */
102
+ function MenubarSubTrigger({ className, children, ...props }) {
103
+ return (_jsxs(MenuPrimitive.SubmenuTrigger, { "data-slot": "menubar-sub-trigger", className: cn(ROW, className), ...props, children: [children, _jsx(ChevronRightIcon, { className: "ml-auto size-4" })] }));
104
+ }
105
+ /** The nested menu surface. */
106
+ function MenubarSubContent({ className, sideOffset = 0, alignOffset = 0, ...props }) {
107
+ return (_jsx(MenuPrimitive.Portal, { children: _jsx(MenuPrimitive.Positioner, { sideOffset: sideOffset, alignOffset: alignOffset, children: _jsx(MenuPrimitive.Popup, { "data-slot": "menubar-sub-content", className: cn(POPUP, className), ...props }) }) }));
108
+ }
109
+ export { Menubar, MenubarMenu, MenubarTrigger, MenubarContent, MenubarItem, MenubarLinkItem, MenubarCheckboxItem, MenubarLabel, MenubarSeparator, MenubarGroup, MenubarSub, MenubarSubTrigger, MenubarSubContent, };
@@ -0,0 +1,121 @@
1
+ import type { ComponentProps, ReactNode } from 'react';
2
+ /**
3
+ * The tones a Meter's fill can take, and what each one is for.
4
+ *
5
+ * A tone is a judgement the caller makes, not something the Component infers. The
6
+ * Component can see that a value is 95 percent of a maximum; it cannot see that
7
+ * 95 percent is a problem. The same number is routine on a latency budget and
8
+ * urgent on a disk quota, so a Component that coloured itself would be making a
9
+ * claim about the caller's product on the caller's behalf.
10
+ */
11
+ export type MeterTone = 'neutral' | 'success' | 'warning' | 'destructive';
12
+ /**
13
+ * A line on the scale, and the tone the fill takes once the value is past it.
14
+ *
15
+ * Thresholds are how a bounded measure earns its keep. A fill alone says "this
16
+ * much"; a fill with a notch on it says "this much, and the limit is there". That
17
+ * is the information a quota, a budget and a usage limit actually need, and it is
18
+ * the reason this is a Meter rather than a Progress.
19
+ *
20
+ * The list is sorted and the last threshold that `value` has passed wins, so a
21
+ * caller does not have to get the order right. Equal thresholds resolve to the
22
+ * later one, which is the same rule a ladder of limits follows.
23
+ */
24
+ export type MeterThreshold = {
25
+ /** The value at which this threshold begins to apply. */
26
+ at: number;
27
+ /** The tone the fill takes from here up to the next threshold. */
28
+ tone: MeterTone;
29
+ };
30
+ /** The props the Meter accepts. */
31
+ export interface MeterProps extends Omit<ComponentProps<'div'>, 'children'> {
32
+ /**
33
+ * The measured value.
34
+ *
35
+ * There is no default. A meter with no value is a scale with no reading, which
36
+ * is a picture rather than a measurement, and the caller states the number.
37
+ */
38
+ value: number;
39
+ /**
40
+ * The upper bound of the scale. @defaultValue 100
41
+ *
42
+ * A percentage is a special case of a bounded measure, not the general one, so
43
+ * `max` exists and a meter of 4096 gigabytes is as ordinary as one of 100
44
+ * percent.
45
+ */
46
+ max?: number;
47
+ /** The lower bound of the scale. @defaultValue 0 */
48
+ min?: number;
49
+ /**
50
+ * The accessible name of the meter, read before its value.
51
+ *
52
+ * Required rather than defaulted, because a page with two meters is a page where
53
+ * a reader cannot tell which is which, and the name is the caller's word. A
54
+ * meter that ships its own name is a meter every consumer inherits in English.
55
+ */
56
+ label: string;
57
+ /**
58
+ * The words for the value, read instead of the number.
59
+ *
60
+ * A bare number is a poor announcement: "72" says nothing about what is being
61
+ * measured or in what unit. A caller with a formatted value passes it here, and
62
+ * a caller whose number is self-describing leaves it unset.
63
+ */
64
+ valueText?: string;
65
+ /**
66
+ * The lines on the scale, in any order.
67
+ *
68
+ * Each is a notch the reader can see and the tone the fill takes past it. A
69
+ * meter with no thresholds is a neutral fill, which is the honest default: most
70
+ * measurements are not near a limit.
71
+ */
72
+ thresholds?: readonly MeterThreshold[];
73
+ /**
74
+ * The tone of the fill when no threshold applies, or above the last one.
75
+ *
76
+ * Left unset the fill is the foreground colour, which is the neutral reading.
77
+ * Set it when the high end of the scale is itself the alarm.
78
+ */
79
+ tone?: MeterTone;
80
+ /**
81
+ * The text under the scale, which is where the reading goes.
82
+ *
83
+ * The visible value belongs beside the track rather than inside it, because a
84
+ * number printed on a two-pixel bar is unreadable at any size worth reading. A
85
+ * caller that wants no text passes nothing and gets the track alone, which is
86
+ * correct for a meter inside a dense row where the number is in the row.
87
+ */
88
+ children?: ReactNode;
89
+ }
90
+ /**
91
+ * A bounded measure, drawn as a scale with its limits on it.
92
+ *
93
+ * A Meter and a Progress both show a value against a maximum, and the difference
94
+ * is the whole reason this is a separate Component. A Progress is a task moving
95
+ * toward an end whose length is not known in advance, and it is read while it
96
+ * moves. A Meter is a quantity that already has an answer, bounded by a limit the
97
+ * caller knows, and it is read as a standing measurement. A disk at 95 percent, a
98
+ * token budget, a score out of a hundred, a queue depth against its ceiling.
99
+ *
100
+ * **The thresholds are the design.** A fill on its own is one number, and a number
101
+ * with no limit beside it cannot be acted on: 72 percent of what, and is that
102
+ * much? Drawing the caller's own limits as notches on the track puts the answer
103
+ * next to the reading, and a consumer who passes a latency budget gets a latency
104
+ * budget rather than a generic bar that happens to be filled to a similar
105
+ * fraction. The Component has no opinion about which numbers matter; the notches
106
+ * are the caller's.
107
+ *
108
+ * **It is drawn as a hairline, not a bar.** The Progress in this system is a
109
+ * two-pixel rounded bar, and a Meter that looked like one would be read as one.
110
+ * The difference is visible before it is read: a Meter is a scale, drawn on a rule
111
+ * with ticks, where a Progress is a task, drawn as a fill in a trough.
112
+ *
113
+ * **It is not a live region.** A meter's value changing is usually the result of
114
+ * something else happening, and that something else is what should be announced. A
115
+ * consumer that wants the reading announced wraps it in a LiveRegion, which is
116
+ * the same split every other Component here makes between the thing that changed
117
+ * and the thing that reports it.
118
+ */
119
+ declare function Meter({ className, value, max, min, label, valueText, thresholds, tone, children, ...props }: MeterProps): import("react").JSX.Element;
120
+ export { Meter };
121
+ //# sourceMappingURL=meter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"meter.d.ts","sourceRoot":"","sources":["../../../src/components/ui/meter.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAItD;;;;;;;;GAQG;AACH,MAAM,MAAM,SAAS,GAAG,SAAS,GAAG,SAAS,GAAG,SAAS,GAAG,aAAa,CAAA;AAEzE;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,cAAc,GAAG;IAC3B,yDAAyD;IACzD,EAAE,EAAE,MAAM,CAAA;IACV,kEAAkE;IAClE,IAAI,EAAE,SAAS,CAAA;CAChB,CAAA;AAED,mCAAmC;AACnC,MAAM,WAAW,UAAW,SAAQ,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,EAAE,UAAU,CAAC;IACzE;;;;;OAKG;IACH,KAAK,EAAE,MAAM,CAAA;IACb;;;;;;OAMG;IACH,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,oDAAoD;IACpD,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ;;;;;;OAMG;IACH,KAAK,EAAE,MAAM,CAAA;IACb;;;;;;OAMG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB;;;;;;OAMG;IACH,UAAU,CAAC,EAAE,SAAS,cAAc,EAAE,CAAA;IACtC;;;;;OAKG;IACH,IAAI,CAAC,EAAE,SAAS,CAAA;IAChB;;;;;;;OAOG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAA;CACrB;AAuCD;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,iBAAS,KAAK,CAAC,EACb,SAAS,EACT,KAAK,EACL,GAAS,EACT,GAAO,EACP,KAAK,EACL,SAAS,EACT,UAAe,EACf,IAAI,EACJ,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,UAAU,+BA0DZ;AAED,OAAO,EAAE,KAAK,EAAE,CAAA"}
@@ -0,0 +1,82 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { cn } from '../../lib/utils.js';
3
+ /** The fill and the ring, per tone, from the existing semantic roles. */
4
+ const TONE_FILL = {
5
+ neutral: 'bg-foreground',
6
+ success: 'bg-success',
7
+ warning: 'bg-warning',
8
+ destructive: 'bg-destructive',
9
+ };
10
+ const TONE_NOTCH = {
11
+ // A neutral notch is the border colour, because a notch that is the same weight
12
+ // as the fill disappears into it, and a scale whose own ticks cannot be seen is
13
+ // a scale with no limit on it.
14
+ neutral: 'bg-border',
15
+ success: 'bg-success',
16
+ warning: 'bg-warning',
17
+ destructive: 'bg-destructive',
18
+ };
19
+ /** The value clamped into the scale, so a reading outside the bounds is not drawn outside the track. */
20
+ function clamp(value, min, max) {
21
+ if (!Number.isFinite(value))
22
+ return min;
23
+ return Math.min(Math.max(value, min), max);
24
+ }
25
+ /** The tone the fill takes, which is the last threshold passed and then the caller's default. */
26
+ function toneFor(value, thresholds, fallback) {
27
+ const passed = [...thresholds]
28
+ .filter((threshold) => Number.isFinite(threshold.at) && value >= threshold.at)
29
+ .sort((a, b) => a.at - b.at)
30
+ .at(-1);
31
+ return passed?.tone ?? fallback ?? 'neutral';
32
+ }
33
+ /**
34
+ * A bounded measure, drawn as a scale with its limits on it.
35
+ *
36
+ * A Meter and a Progress both show a value against a maximum, and the difference
37
+ * is the whole reason this is a separate Component. A Progress is a task moving
38
+ * toward an end whose length is not known in advance, and it is read while it
39
+ * moves. A Meter is a quantity that already has an answer, bounded by a limit the
40
+ * caller knows, and it is read as a standing measurement. A disk at 95 percent, a
41
+ * token budget, a score out of a hundred, a queue depth against its ceiling.
42
+ *
43
+ * **The thresholds are the design.** A fill on its own is one number, and a number
44
+ * with no limit beside it cannot be acted on: 72 percent of what, and is that
45
+ * much? Drawing the caller's own limits as notches on the track puts the answer
46
+ * next to the reading, and a consumer who passes a latency budget gets a latency
47
+ * budget rather than a generic bar that happens to be filled to a similar
48
+ * fraction. The Component has no opinion about which numbers matter; the notches
49
+ * are the caller's.
50
+ *
51
+ * **It is drawn as a hairline, not a bar.** The Progress in this system is a
52
+ * two-pixel rounded bar, and a Meter that looked like one would be read as one.
53
+ * The difference is visible before it is read: a Meter is a scale, drawn on a rule
54
+ * with ticks, where a Progress is a task, drawn as a fill in a trough.
55
+ *
56
+ * **It is not a live region.** A meter's value changing is usually the result of
57
+ * something else happening, and that something else is what should be announced. A
58
+ * consumer that wants the reading announced wraps it in a LiveRegion, which is
59
+ * the same split every other Component here makes between the thing that changed
60
+ * and the thing that reports it.
61
+ */
62
+ function Meter({ className, value, max = 100, min = 0, label, valueText, thresholds = [], tone, children, ...props }) {
63
+ const reading = clamp(value, min, max);
64
+ const span = max - min;
65
+ // A zero-width scale has no fraction, and dividing by it yields a NaN that
66
+ // reaches the DOM as a width. A degenerate scale draws empty and still
67
+ // announces, because a Component that renders nothing is worse than one that
68
+ // renders an empty track.
69
+ const percent = span === 0 ? 0 : ((reading - min) / span) * 100;
70
+ const resolved = toneFor(reading, thresholds, tone);
71
+ return (_jsxs("div", { "data-slot": "meter", className: cn('flex w-full flex-col gap-1.5', className), ...props, children: [_jsxs("div", { "data-slot": "meter-track",
72
+ // `role="meter"` and not `role="progressbar"`: the two are distinguished
73
+ // by exactly the distinction this Component exists for, and assistive
74
+ // technology reports them differently. A meter is a standing measurement.
75
+ role: "meter", "aria-label": label, "aria-valuenow": reading, "aria-valuemin": min, "aria-valuemax": max, ...(valueText === undefined ? null : { 'aria-valuetext': valueText }), className: "bg-border relative block h-px w-full", children: [_jsx("div", { "data-slot": "meter-fill", className: cn('absolute inset-y-0 left-0', TONE_FILL[resolved]), style: { width: `${percent}%` } }), thresholds.map((threshold, index) => {
76
+ const at = clamp(threshold.at, min, max);
77
+ if (span === 0)
78
+ return null;
79
+ return (_jsx("span", { "data-slot": "meter-threshold", "aria-hidden": "true", className: cn('absolute inset-y-0 w-px', TONE_NOTCH[threshold.tone]), style: { left: `${((at - min) / span) * 100}%` } }, `${threshold.at}-${index}`));
80
+ })] }), children === undefined ? null : (_jsx("div", { "data-slot": "meter-caption", className: "text-muted-foreground flex items-baseline justify-between gap-3 text-xs", children: children }))] }));
81
+ }
82
+ export { Meter };
@@ -0,0 +1,72 @@
1
+ import type { ComponentProps, ReactNode } from 'react';
2
+ /** The props the NativeSelect accepts. */
3
+ /**
4
+ * The props the NativeSelect accepts.
5
+ *
6
+ * `size` is this Component's own height in the package's scale, which is why the
7
+ * native `size` attribute is omitted from the props it forwards. The two mean
8
+ * different things: the native one is how many rows of the list the platform shows
9
+ * at once, which on a single-selection select is a way of drawing a taller control,
10
+ * and a single prop cannot be both without lying about which one a caller is
11
+ * setting. A list box several rows tall is `Select`, or a `NativeSelect` inside a
12
+ * `ScrollArea`.
13
+ */
14
+ export interface NativeSelectProps extends Omit<ComponentProps<'select'>, 'children' | 'size'> {
15
+ /** The options, as `option` or `optgroup` elements. */
16
+ children?: ReactNode;
17
+ /**
18
+ * The control's accessible name, when no visible label is used.
19
+ *
20
+ * A native select takes its name from an associated `label` like any other form
21
+ * control, and Prism's `Field` puts one there. This is for the case where there
22
+ * is no `Field` around it, and it is a prop for the reason every accessible name
23
+ * in this package is one.
24
+ */
25
+ 'aria-label'?: string;
26
+ /** The control's height. @defaultValue 'default' */
27
+ size?: 'sm' | 'default';
28
+ /** Layout only. */
29
+ className?: string;
30
+ }
31
+ /**
32
+ * A native `<select>`, styled to match the rest of this package.
33
+ *
34
+ * **This is not a second Select, and the difference is which element is on the
35
+ * page.** The `Select` in this package is Base UI's: a `<button>` carrying
36
+ * `role="combobox"` and a popup list Base UI positions, types into and manages the
37
+ * keyboard for. It is a custom control, and everything it offers over the platform
38
+ * is the price of being one: it needs JavaScript to open, it cannot be operated by
39
+ * the mobile picker a reader expects when they tap a select on a phone, it is
40
+ * invisible to a right-click menu that offers "Save as", and it is a set of `div`s
41
+ * where the browser's own is one element with thirty years of platform behaviour
42
+ * behind it.
43
+ *
44
+ * So this Component renders the platform element. Everything the browser does with
45
+ * a `<select>` it still does: the wheel on Windows, the wheel on macOS and iOS,
46
+ * type-ahead on the first letter, the mobile picker, the form submission, and the
47
+ * context menu. The styling is the package's, so the control looks like its
48
+ * neighbours, and the appearance is suppressed so the drawn chevron is Prism's
49
+ * rather than the platform's.
50
+ *
51
+ * **When this is the right answer rather than the compromise it sounds like.** A
52
+ * native select is right when the platform's picker is better than anything this
53
+ * package could draw: a long list of plain strings on a phone, a form that must
54
+ * submit without JavaScript, a control inside a page that is already a form and
55
+ * gains nothing from a popup that is portalled and dismissed. It is wrong when the
56
+ * option needs to be more than a string, because an `<option>` holds text and
57
+ * nothing else: no description, no count, no state, no nested markup. That is the
58
+ * line, and the `Select` is on the other side of it.
59
+ *
60
+ * **The chevron is decoration and says so.** It is `aria-hidden` and it is not
61
+ * focusable, because the value is already announced by the platform control and a
62
+ * reader hearing "graphic" after every option set is a reader being told something
63
+ * about the drawing rather than about the value. The control is one tab stop and
64
+ * the browser owns its key handling entirely, which is the point.
65
+ *
66
+ * It is a server Component. A native select holds no state, runs no effect and
67
+ * attaches no handler, so a form of twenty of them costs no JavaScript at all,
68
+ * which is a real answer to the argument above rather than a footnote to it.
69
+ */
70
+ declare function NativeSelect({ className, size, children, ...props }: NativeSelectProps): import("react").JSX.Element;
71
+ export { NativeSelect };
72
+ //# sourceMappingURL=native-select.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"native-select.d.ts","sourceRoot":"","sources":["../../../src/components/ui/native-select.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAItD,0CAA0C;AAC1C;;;;;;;;;;GAUG;AACH,MAAM,WAAW,iBAAkB,SAAQ,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,EAAE,UAAU,GAAG,MAAM,CAAC;IAC5F,uDAAuD;IACvD,QAAQ,CAAC,EAAE,SAAS,CAAA;IACpB;;;;;;;OAOG;IACH,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,oDAAoD;IACpD,IAAI,CAAC,EAAE,IAAI,GAAG,SAAS,CAAA;IACvB,mBAAmB;IACnB,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,iBAAS,YAAY,CAAC,EACpB,SAAS,EACT,IAAgB,EAChB,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,iBAAiB,+BAgDnB;AAED,OAAO,EAAE,YAAY,EAAE,CAAA"}