@zonsh/ui 0.0.0 → 0.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (425) hide show
  1. package/LICENSE +43 -0
  2. package/README.md +81 -1
  3. package/assets/illustrations/drawing/bracket-construction-dark.svg +77 -0
  4. package/assets/illustrations/drawing/bracket-construction-filled-dark.svg +50 -0
  5. package/assets/illustrations/drawing/bracket-construction-filled.svg +50 -0
  6. package/assets/illustrations/drawing/bracket-construction.svg +77 -0
  7. package/assets/illustrations/drawing/crescent-dark.svg +28 -0
  8. package/assets/illustrations/drawing/crescent-guides-dark.svg +33 -0
  9. package/assets/illustrations/drawing/crescent-guides.svg +33 -0
  10. package/assets/illustrations/drawing/crescent.svg +28 -0
  11. package/assets/illustrations/drawing/eclipse-dark.svg +187 -0
  12. package/assets/illustrations/drawing/eclipse-guides-dark.svg +191 -0
  13. package/assets/illustrations/drawing/eclipse-guides.svg +191 -0
  14. package/assets/illustrations/drawing/eclipse.svg +187 -0
  15. package/assets/illustrations/drawing/elevation-guides-dark.svg +31 -0
  16. package/assets/illustrations/drawing/elevation-guides-plain-dark.svg +9 -0
  17. package/assets/illustrations/drawing/elevation-guides-plain.svg +9 -0
  18. package/assets/illustrations/drawing/elevation-guides.svg +31 -0
  19. package/assets/illustrations/drawing/horizon-dark.svg +30 -0
  20. package/assets/illustrations/drawing/horizon.svg +30 -0
  21. package/assets/illustrations/drawing/nib-study-dark.svg +107 -0
  22. package/assets/illustrations/drawing/nib-study-plain-dark.svg +93 -0
  23. package/assets/illustrations/drawing/nib-study-plain.svg +93 -0
  24. package/assets/illustrations/drawing/nib-study.svg +107 -0
  25. package/assets/illustrations/editorial/assistant-640.webp +0 -0
  26. package/assets/illustrations/editorial/assistant.webp +0 -0
  27. package/assets/illustrations/editorial/automation-640.webp +0 -0
  28. package/assets/illustrations/editorial/automation.webp +0 -0
  29. package/assets/illustrations/editorial/bracket-left-640.webp +0 -0
  30. package/assets/illustrations/editorial/bracket-left.webp +0 -0
  31. package/assets/illustrations/editorial/bracket-right-640.webp +0 -0
  32. package/assets/illustrations/editorial/bracket-right.webp +0 -0
  33. package/assets/illustrations/editorial/custom-software-640.webp +0 -0
  34. package/assets/illustrations/editorial/custom-software.webp +0 -0
  35. package/assets/illustrations/editorial/digitalization-640.webp +0 -0
  36. package/assets/illustrations/editorial/digitalization.webp +0 -0
  37. package/assets/illustrations/editorial/integration-640.webp +0 -0
  38. package/assets/illustrations/editorial/integration.webp +0 -0
  39. package/assets/illustrations/editorial/problem-640.webp +0 -0
  40. package/assets/illustrations/editorial/problem.webp +0 -0
  41. package/assets/illustrations/editorial/process-analysis-640.webp +0 -0
  42. package/assets/illustrations/editorial/process-analysis.webp +0 -0
  43. package/assets/illustrations/editorial/process-concept-640.webp +0 -0
  44. package/assets/illustrations/editorial/process-concept.webp +0 -0
  45. package/assets/illustrations/editorial/process-development-640.webp +0 -0
  46. package/assets/illustrations/editorial/process-development.webp +0 -0
  47. package/assets/illustrations/editorial/process-discovery-640.webp +0 -0
  48. package/assets/illustrations/editorial/process-discovery.webp +0 -0
  49. package/assets/illustrations/editorial/process-maintenance-640.webp +0 -0
  50. package/assets/illustrations/editorial/process-maintenance.webp +0 -0
  51. package/assets/illustrations/editorial/process-prototype-640.webp +0 -0
  52. package/assets/illustrations/editorial/process-prototype.webp +0 -0
  53. package/assets/illustrations/editorial/process-testing-640.webp +0 -0
  54. package/assets/illustrations/editorial/process-testing.webp +0 -0
  55. package/assets/illustrations/iso/automation-dark.svg +6 -0
  56. package/assets/illustrations/iso/automation.svg +6 -0
  57. package/assets/illustrations/iso/bar-chart-dark.svg +6 -0
  58. package/assets/illustrations/iso/bar-chart.svg +6 -0
  59. package/assets/illustrations/iso/brackets-classic-dark.svg +6 -0
  60. package/assets/illustrations/iso/brackets-classic.svg +6 -0
  61. package/assets/illustrations/iso/brackets-dark.svg +6 -0
  62. package/assets/illustrations/iso/brackets.svg +6 -0
  63. package/assets/illustrations/iso/city-dark.svg +6 -0
  64. package/assets/illustrations/iso/city.svg +6 -0
  65. package/assets/illustrations/iso/conveyor-dark.svg +6 -0
  66. package/assets/illustrations/iso/conveyor.svg +6 -0
  67. package/assets/illustrations/iso/database-dark.svg +6 -0
  68. package/assets/illustrations/iso/database.svg +6 -0
  69. package/assets/illustrations/iso/documents-dark.svg +6 -0
  70. package/assets/illustrations/iso/documents.svg +6 -0
  71. package/assets/illustrations/iso/inbox-dark.svg +6 -0
  72. package/assets/illustrations/iso/inbox.svg +6 -0
  73. package/assets/illustrations/iso/laptop-dark.svg +6 -0
  74. package/assets/illustrations/iso/laptop.svg +6 -0
  75. package/assets/illustrations/iso/monitor-dark.svg +6 -0
  76. package/assets/illustrations/iso/monitor.svg +6 -0
  77. package/assets/illustrations/iso/pipeline-dark.svg +6 -0
  78. package/assets/illustrations/iso/pipeline.svg +6 -0
  79. package/assets/illustrations/iso/platform-dark.svg +6 -0
  80. package/assets/illustrations/iso/platform.svg +6 -0
  81. package/assets/illustrations/iso/server-dark.svg +6 -0
  82. package/assets/illustrations/iso/server.svg +6 -0
  83. package/assets/illustrations/iso/spreadsheet-dark.svg +6 -0
  84. package/assets/illustrations/iso/spreadsheet.svg +6 -0
  85. package/assets/illustrations/iso/timeline-dark.svg +6 -0
  86. package/assets/illustrations/iso/timeline.svg +6 -0
  87. package/assets/illustrations/sheet/construction.svg +115 -0
  88. package/assets/illustrations/sheet/crescent.svg +40 -0
  89. package/assets/illustrations/sheet/limb.svg +42 -0
  90. package/assets/illustrations/sheet/stress-axis.svg +119 -0
  91. package/assets/illustrations/sheet/totality.svg +215 -0
  92. package/assets/illustrations/sheet/vertical-metrics.svg +43 -0
  93. package/assets/logo-left.svg +1 -0
  94. package/assets/logo-right.svg +1 -0
  95. package/assets/logo.svg +1 -0
  96. package/dist/components/_overlay.d.ts +47 -0
  97. package/dist/components/_overlay.js +59 -0
  98. package/dist/components/accordion.d.ts +32 -0
  99. package/dist/components/accordion.js +39 -0
  100. package/dist/components/alert-dialog.d.ts +45 -0
  101. package/dist/components/alert-dialog.js +56 -0
  102. package/dist/components/alert.d.ts +35 -0
  103. package/dist/components/alert.js +42 -0
  104. package/dist/components/ascii-field.d.ts +34 -0
  105. package/dist/components/ascii-field.js +410 -0
  106. package/dist/components/aspect-ratio.d.ts +14 -0
  107. package/dist/components/aspect-ratio.js +17 -0
  108. package/dist/components/avatar.d.ts +42 -0
  109. package/dist/components/avatar.js +55 -0
  110. package/dist/components/badge.d.ts +70 -0
  111. package/dist/components/badge.js +62 -0
  112. package/dist/components/bottom-nav.d.ts +86 -0
  113. package/dist/components/bottom-nav.js +175 -0
  114. package/dist/components/breadcrumb.d.ts +31 -0
  115. package/dist/components/breadcrumb.js +37 -0
  116. package/dist/components/button-group.d.ts +30 -0
  117. package/dist/components/button-group.js +47 -0
  118. package/dist/components/button.d.ts +53 -0
  119. package/dist/components/button.js +130 -0
  120. package/dist/components/calendar.d.ts +26 -0
  121. package/dist/components/calendar.js +179 -0
  122. package/dist/components/card.d.ts +42 -0
  123. package/dist/components/card.js +76 -0
  124. package/dist/components/carousel.d.ts +109 -0
  125. package/dist/components/carousel.js +231 -0
  126. package/dist/components/chart.d.ts +189 -0
  127. package/dist/components/chart.js +323 -0
  128. package/dist/components/checkbox.d.ts +23 -0
  129. package/dist/components/checkbox.js +43 -0
  130. package/dist/components/code-block.d.ts +55 -0
  131. package/dist/components/code-block.js +100 -0
  132. package/dist/components/collapsible.d.ts +20 -0
  133. package/dist/components/collapsible.js +32 -0
  134. package/dist/components/color-picker.d.ts +107 -0
  135. package/dist/components/color-picker.js +428 -0
  136. package/dist/components/combobox.d.ts +99 -0
  137. package/dist/components/combobox.js +172 -0
  138. package/dist/components/command.d.ts +132 -0
  139. package/dist/components/command.js +257 -0
  140. package/dist/components/context-menu.d.ts +29 -0
  141. package/dist/components/context-menu.js +35 -0
  142. package/dist/components/conversation.d.ts +36 -0
  143. package/dist/components/conversation.js +303 -0
  144. package/dist/components/copy-button.d.ts +55 -0
  145. package/dist/components/copy-button.js +133 -0
  146. package/dist/components/data-table.d.ts +235 -0
  147. package/dist/components/data-table.js +655 -0
  148. package/dist/components/date-picker.d.ts +160 -0
  149. package/dist/components/date-picker.js +338 -0
  150. package/dist/components/dialog.d.ts +57 -0
  151. package/dist/components/dialog.js +95 -0
  152. package/dist/components/direction.d.ts +16 -0
  153. package/dist/components/direction.js +18 -0
  154. package/dist/components/drawer.d.ts +69 -0
  155. package/dist/components/drawer.js +79 -0
  156. package/dist/components/empty.d.ts +31 -0
  157. package/dist/components/empty.js +50 -0
  158. package/dist/components/feature-list.d.ts +54 -0
  159. package/dist/components/feature-list.js +43 -0
  160. package/dist/components/field.d.ts +34 -0
  161. package/dist/components/field.js +81 -0
  162. package/dist/components/file-drop.d.ts +77 -0
  163. package/dist/components/file-drop.js +258 -0
  164. package/dist/components/filter-bar.d.ts +153 -0
  165. package/dist/components/filter-bar.js +334 -0
  166. package/dist/components/form.d.ts +35 -0
  167. package/dist/components/form.js +56 -0
  168. package/dist/components/graph.d.ts +146 -0
  169. package/dist/components/graph.js +825 -0
  170. package/dist/components/illustration.d.ts +85 -0
  171. package/dist/components/illustration.js +165 -0
  172. package/dist/components/input-group.d.ts +138 -0
  173. package/dist/components/input-group.js +312 -0
  174. package/dist/components/input.d.ts +16 -0
  175. package/dist/components/input.js +25 -0
  176. package/dist/components/item.d.ts +64 -0
  177. package/dist/components/item.js +116 -0
  178. package/dist/components/kbd.d.ts +50 -0
  179. package/dist/components/kbd.js +45 -0
  180. package/dist/components/label.d.ts +12 -0
  181. package/dist/components/label.js +24 -0
  182. package/dist/components/layout.d.ts +136 -0
  183. package/dist/components/layout.js +162 -0
  184. package/dist/components/lightbox.d.ts +100 -0
  185. package/dist/components/lightbox.js +439 -0
  186. package/dist/components/locale.d.ts +44 -0
  187. package/dist/components/locale.js +37 -0
  188. package/dist/components/logo.d.ts +54 -0
  189. package/dist/components/logo.js +96 -0
  190. package/dist/components/menu.d.ts +60 -0
  191. package/dist/components/menu.js +140 -0
  192. package/dist/components/menubar.d.ts +62 -0
  193. package/dist/components/menubar.js +223 -0
  194. package/dist/components/message.d.ts +42 -0
  195. package/dist/components/message.js +59 -0
  196. package/dist/components/meter.d.ts +31 -0
  197. package/dist/components/meter.js +27 -0
  198. package/dist/components/money-input.d.ts +80 -0
  199. package/dist/components/money-input.js +253 -0
  200. package/dist/components/native-select.d.ts +26 -0
  201. package/dist/components/native-select.js +35 -0
  202. package/dist/components/navigation-menu.d.ts +42 -0
  203. package/dist/components/navigation-menu.js +97 -0
  204. package/dist/components/number-field.d.ts +55 -0
  205. package/dist/components/number-field.js +164 -0
  206. package/dist/components/otp-field.d.ts +48 -0
  207. package/dist/components/otp-field.js +102 -0
  208. package/dist/components/pagination.d.ts +37 -0
  209. package/dist/components/pagination.js +81 -0
  210. package/dist/components/pdf-viewer.d.ts +134 -0
  211. package/dist/components/pdf-viewer.js +996 -0
  212. package/dist/components/phone-input.d.ts +79 -0
  213. package/dist/components/phone-input.js +282 -0
  214. package/dist/components/popover.d.ts +33 -0
  215. package/dist/components/popover.js +48 -0
  216. package/dist/components/preview-card.d.ts +25 -0
  217. package/dist/components/preview-card.js +22 -0
  218. package/dist/components/progress.d.ts +27 -0
  219. package/dist/components/progress.js +25 -0
  220. package/dist/components/prompt-input.d.ts +156 -0
  221. package/dist/components/prompt-input.js +415 -0
  222. package/dist/components/quote.d.ts +22 -0
  223. package/dist/components/quote.js +15 -0
  224. package/dist/components/radio-group.d.ts +18 -0
  225. package/dist/components/radio-group.js +34 -0
  226. package/dist/components/rating.d.ts +73 -0
  227. package/dist/components/rating.js +124 -0
  228. package/dist/components/reasoning.d.ts +46 -0
  229. package/dist/components/reasoning.js +73 -0
  230. package/dist/components/resizable.d.ts +47 -0
  231. package/dist/components/resizable.js +44 -0
  232. package/dist/components/response.d.ts +41 -0
  233. package/dist/components/response.js +566 -0
  234. package/dist/components/scroll-area.d.ts +33 -0
  235. package/dist/components/scroll-area.js +31 -0
  236. package/dist/components/select.d.ts +35 -0
  237. package/dist/components/select.js +71 -0
  238. package/dist/components/separator.d.ts +14 -0
  239. package/dist/components/separator.js +17 -0
  240. package/dist/components/sidebar.d.ts +163 -0
  241. package/dist/components/sidebar.js +505 -0
  242. package/dist/components/site-header.d.ts +93 -0
  243. package/dist/components/site-header.js +121 -0
  244. package/dist/components/skeleton.d.ts +31 -0
  245. package/dist/components/skeleton.js +29 -0
  246. package/dist/components/slider.d.ts +24 -0
  247. package/dist/components/slider.js +131 -0
  248. package/dist/components/sortable.d.ts +178 -0
  249. package/dist/components/sortable.js +1258 -0
  250. package/dist/components/sources.d.ts +40 -0
  251. package/dist/components/sources.js +42 -0
  252. package/dist/components/spinner.d.ts +48 -0
  253. package/dist/components/spinner.js +75 -0
  254. package/dist/components/stat.d.ts +91 -0
  255. package/dist/components/stat.js +141 -0
  256. package/dist/components/stepper.d.ts +71 -0
  257. package/dist/components/stepper.js +101 -0
  258. package/dist/components/suggestions.d.ts +20 -0
  259. package/dist/components/suggestions.js +18 -0
  260. package/dist/components/switch.d.ts +14 -0
  261. package/dist/components/switch.js +26 -0
  262. package/dist/components/table.d.ts +172 -0
  263. package/dist/components/table.js +895 -0
  264. package/dist/components/tabs.d.ts +25 -0
  265. package/dist/components/tabs.js +162 -0
  266. package/dist/components/tag.d.ts +41 -0
  267. package/dist/components/tag.js +88 -0
  268. package/dist/components/tags-input.d.ts +56 -0
  269. package/dist/components/tags-input.js +271 -0
  270. package/dist/components/textarea.d.ts +13 -0
  271. package/dist/components/textarea.js +16 -0
  272. package/dist/components/theme.d.ts +55 -0
  273. package/dist/components/theme.js +120 -0
  274. package/dist/components/time-field.d.ts +70 -0
  275. package/dist/components/time-field.js +450 -0
  276. package/dist/components/timeline.d.ts +92 -0
  277. package/dist/components/timeline.js +108 -0
  278. package/dist/components/tippy.d.ts +48 -0
  279. package/dist/components/tippy.js +648 -0
  280. package/dist/components/toast.d.ts +88 -0
  281. package/dist/components/toast.js +205 -0
  282. package/dist/components/toggle-group.d.ts +41 -0
  283. package/dist/components/toggle-group.js +140 -0
  284. package/dist/components/toggle.d.ts +23 -0
  285. package/dist/components/toggle.js +35 -0
  286. package/dist/components/tool-call.d.ts +63 -0
  287. package/dist/components/tool-call.js +68 -0
  288. package/dist/components/toolbar.d.ts +17 -0
  289. package/dist/components/toolbar.js +39 -0
  290. package/dist/components/tooltip.d.ts +42 -0
  291. package/dist/components/tooltip.js +47 -0
  292. package/dist/components/tour.d.ts +127 -0
  293. package/dist/components/tour.js +648 -0
  294. package/dist/components/tree.d.ts +75 -0
  295. package/dist/components/tree.js +649 -0
  296. package/dist/components/typography.d.ts +134 -0
  297. package/dist/components/typography.js +176 -0
  298. package/dist/components/video-player.d.ts +284 -0
  299. package/dist/components/video-player.js +1392 -0
  300. package/dist/illustration.d.ts +2 -0
  301. package/dist/illustration.js +7 -0
  302. package/dist/index.d.ts +93 -0
  303. package/dist/index.js +94 -0
  304. package/dist/lib/cn.d.ts +20 -0
  305. package/dist/lib/cn.js +38 -0
  306. package/dist/lib/code-highlight.d.ts +18 -0
  307. package/dist/lib/code-highlight.js +174 -0
  308. package/dist/lib/code-theme.d.ts +19 -0
  309. package/dist/lib/code-theme.js +140 -0
  310. package/dist/lib/collapse-row.d.ts +9 -0
  311. package/dist/lib/collapse-row.js +129 -0
  312. package/dist/lib/digit-roll.d.ts +21 -0
  313. package/dist/lib/digit-roll.js +31 -0
  314. package/dist/lib/editorial-assets.d.ts +16 -0
  315. package/dist/lib/editorial-assets.js +56 -0
  316. package/dist/lib/field-errors.d.ts +28 -0
  317. package/dist/lib/field-errors.js +24 -0
  318. package/dist/lib/field-value.d.ts +13 -0
  319. package/dist/lib/field-value.js +44 -0
  320. package/dist/lib/figure/catalog.d.ts +127 -0
  321. package/dist/lib/figure/catalog.js +130 -0
  322. package/dist/lib/figure/figures/automation.d.ts +7 -0
  323. package/dist/lib/figure/figures/automation.js +143 -0
  324. package/dist/lib/figure/figures/bar-chart.d.ts +7 -0
  325. package/dist/lib/figure/figures/bar-chart.js +99 -0
  326. package/dist/lib/figure/figures/brackets-classic.d.ts +11 -0
  327. package/dist/lib/figure/figures/brackets-classic.js +170 -0
  328. package/dist/lib/figure/figures/brackets.d.ts +8 -0
  329. package/dist/lib/figure/figures/brackets.js +84 -0
  330. package/dist/lib/figure/figures/city.d.ts +7 -0
  331. package/dist/lib/figure/figures/city.js +93 -0
  332. package/dist/lib/figure/figures/conveyor.d.ts +7 -0
  333. package/dist/lib/figure/figures/conveyor.js +97 -0
  334. package/dist/lib/figure/figures/database.d.ts +7 -0
  335. package/dist/lib/figure/figures/database.js +65 -0
  336. package/dist/lib/figure/figures/documents.d.ts +7 -0
  337. package/dist/lib/figure/figures/documents.js +83 -0
  338. package/dist/lib/figure/figures/inbox.d.ts +7 -0
  339. package/dist/lib/figure/figures/inbox.js +92 -0
  340. package/dist/lib/figure/figures/laptop.d.ts +7 -0
  341. package/dist/lib/figure/figures/laptop.js +67 -0
  342. package/dist/lib/figure/figures/monitor.d.ts +7 -0
  343. package/dist/lib/figure/figures/monitor.js +59 -0
  344. package/dist/lib/figure/figures/pipeline.d.ts +8 -0
  345. package/dist/lib/figure/figures/pipeline.js +117 -0
  346. package/dist/lib/figure/figures/platform.d.ts +7 -0
  347. package/dist/lib/figure/figures/platform.js +117 -0
  348. package/dist/lib/figure/figures/server.d.ts +7 -0
  349. package/dist/lib/figure/figures/server.js +115 -0
  350. package/dist/lib/figure/figures/spreadsheet.d.ts +7 -0
  351. package/dist/lib/figure/figures/spreadsheet.js +87 -0
  352. package/dist/lib/figure/figures/timeline.d.ts +7 -0
  353. package/dist/lib/figure/figures/timeline.js +65 -0
  354. package/dist/lib/figure/kernel.d.ts +152 -0
  355. package/dist/lib/figure/kernel.js +576 -0
  356. package/dist/lib/figure/parts.d.ts +42 -0
  357. package/dist/lib/figure/parts.js +126 -0
  358. package/dist/lib/form-reset.d.ts +11 -0
  359. package/dist/lib/form-reset.js +22 -0
  360. package/dist/lib/glide.d.ts +53 -0
  361. package/dist/lib/glide.js +138 -0
  362. package/dist/lib/graph-layout.d.ts +58 -0
  363. package/dist/lib/graph-layout.js +209 -0
  364. package/dist/lib/illustration-drawings.d.ts +89 -0
  365. package/dist/lib/illustration-drawings.js +539 -0
  366. package/dist/lib/illustration-info.d.ts +37 -0
  367. package/dist/lib/illustration-info.js +22 -0
  368. package/dist/lib/illustration-library.d.ts +87 -0
  369. package/dist/lib/illustration-library.js +352 -0
  370. package/dist/lib/logo-geometry.d.ts +29 -0
  371. package/dist/lib/logo-geometry.js +67 -0
  372. package/dist/lib/markdown-guard.d.ts +16 -0
  373. package/dist/lib/markdown-guard.js +123 -0
  374. package/dist/lib/merge-refs.d.ts +10 -0
  375. package/dist/lib/merge-refs.js +26 -0
  376. package/dist/lib/money.d.ts +73 -0
  377. package/dist/lib/money.js +343 -0
  378. package/dist/lib/motion.d.ts +6 -0
  379. package/dist/lib/motion.js +12 -0
  380. package/dist/lib/pdf-worker.d.ts +1 -0
  381. package/dist/lib/pdf-worker.js +6 -0
  382. package/dist/lib/pdf.d.ts +19 -0
  383. package/dist/lib/pdf.js +58 -0
  384. package/dist/lib/phone-countries.d.ts +1 -0
  385. package/dist/lib/phone-countries.js +281 -0
  386. package/dist/lib/phone.d.ts +90 -0
  387. package/dist/lib/phone.js +286 -0
  388. package/dist/lib/platform.d.ts +38 -0
  389. package/dist/lib/platform.js +75 -0
  390. package/dist/lib/room.d.ts +25 -0
  391. package/dist/lib/room.js +46 -0
  392. package/dist/lib/row-index.d.ts +15 -0
  393. package/dist/lib/row-index.js +136 -0
  394. package/dist/lib/table-fit.d.ts +143 -0
  395. package/dist/lib/table-fit.js +596 -0
  396. package/dist/lib/theme-script.d.ts +31 -0
  397. package/dist/lib/theme-script.js +49 -0
  398. package/dist/lib/tippy/pixels.d.ts +47 -0
  399. package/dist/lib/tippy/pixels.js +187 -0
  400. package/dist/lib/tippy/sprite.d.ts +86 -0
  401. package/dist/lib/tippy/sprite.js +753 -0
  402. package/dist/messages/de.d.ts +12 -0
  403. package/dist/messages/de.js +326 -0
  404. package/dist/styles/expressive.css +203 -0
  405. package/dist/styles/fonts.css +145 -0
  406. package/dist/styles/index.css +207 -0
  407. package/dist/styles/material.css +317 -0
  408. package/dist/styles/parts/ai.css +361 -0
  409. package/dist/styles/parts/brand.css +75 -0
  410. package/dist/styles/parts/controls.css +774 -0
  411. package/dist/styles/parts/data.css +222 -0
  412. package/dist/styles/parts/editorial.css +120 -0
  413. package/dist/styles/parts/feedback.css +340 -0
  414. package/dist/styles/parts/foundations.css +166 -0
  415. package/dist/styles/parts/graph.css +214 -0
  416. package/dist/styles/parts/inputs.css +261 -0
  417. package/dist/styles/parts/isometric.css +124 -0
  418. package/dist/styles/parts/navigation.css +424 -0
  419. package/dist/styles/parts/overlays.css +250 -0
  420. package/dist/styles/parts/pdf.css +154 -0
  421. package/dist/styles/parts/react-flow.css +519 -0
  422. package/dist/styles/tokens.css +299 -0
  423. package/dist/vite.d.ts +66 -0
  424. package/dist/vite.js +29 -0
  425. package/package.json +183 -5
@@ -0,0 +1,172 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { Combobox as BaseCombobox } from "@base-ui/react/combobox";
4
+ import { useVirtualizer } from "@tanstack/react-virtual";
5
+ import { CheckIcon, ChevronsUpDownIcon, XIcon } from "lucide-react";
6
+ import * as React from "react";
7
+ import { cn, sx } from "../lib/cn.js";
8
+ import { useFormReset } from "../lib/form-reset.js";
9
+ import { mergeRefs } from "../lib/merge-refs.js";
10
+ import { usePopupDir } from "./_overlay.js";
11
+ import { useMessages } from "./locale.js";
12
+ import { ScrollArea } from "./scroll-area.js";
13
+ const defaultMessages = {
14
+ clear: "Clear selection",
15
+ showOptions: "Show options",
16
+ remove: (label) => (label ? `Remove ${label}` : "Remove"),
17
+ };
18
+ /**
19
+ * Combobox — a `Select` you can type into: the input filters a fixed list of options.
20
+ *
21
+ * Pass `items` (flat, or grouped as `{ value, items }[]`) and render them with a function child
22
+ * of `<ComboboxList>`. Add `multiple` and `<ComboboxChips>` for several values. Use it once a list
23
+ * is long enough that scrolling hurts (roughly 15+ options). The rule people break: using it for
24
+ * free-text search — a combobox only accepts listed values.
25
+ */
26
+ export function Combobox({ inputRef, onItemHighlighted, ...props }) {
27
+ // A form's reset remounts it from its defaults (lib/form-reset); its hidden input finds the form.
28
+ const [resetKey, formRef] = useFormReset();
29
+ const refs = React.useMemo(() => mergeRefs(formRef, inputRef), [formRef, inputRef]);
30
+ // A long flat list renders only the options in view (ComboboxList), unless it says otherwise.
31
+ const items = props.items;
32
+ const virtual = props.virtualized === undefined &&
33
+ !!items &&
34
+ items.length > VIRTUAL_FROM &&
35
+ !(items[0] !== null &&
36
+ typeof items[0] === "object" &&
37
+ Array.isArray(items[0].items));
38
+ const virtualizerRef = React.useRef(null);
39
+ const highlighted = (item, details) => {
40
+ onItemHighlighted?.(item, details);
41
+ const virtualizer = virtualizerRef.current;
42
+ if (!virtual || !virtualizer || item === undefined)
43
+ return;
44
+ // The highlighted option may not be rendered: the first or last by key, or the selected one.
45
+ const { reason, index } = details;
46
+ const edge = index === 0 || index === virtualizer.options.count - 1;
47
+ if (reason === "none" || (reason === "keyboard" && edge))
48
+ queueMicrotask(() => virtualizer.scrollToIndex(index, { align: edge && index > 0 ? "start" : "auto" }));
49
+ };
50
+ return (_jsx(VirtualContext.Provider, { value: virtual ? virtualizerRef : null, children: _jsx(BaseCombobox.Root, { inputRef: refs, virtualized: virtual || undefined, onItemHighlighted: highlighted, ...props }, resetKey) }));
51
+ }
52
+ /** Flat lists of more options than this render only those in view. */
53
+ const VIRTUAL_FROM = 200;
54
+ /** Set by `Combobox` when its list is virtual; `ComboboxList` hands it the virtualizer. */
55
+ const VirtualContext = React.createContext(null);
56
+ /** True inside `<ComboboxChips>`: `ComboboxInput` then renders bare, inside the chips field. */
57
+ const ChipsContext = React.createContext(false);
58
+ const fieldGroup = "flex w-full items-center rounded-control material-field font-body";
59
+ const groupSizes = {
60
+ sm: "min-h-(--control-h-sm) gap-0.5 py-0.5 ps-2.5 pe-0.5 text-[13px]",
61
+ default: "min-h-(--control-h) gap-0.5 py-[3px] ps-3.5 pe-[3px] text-base sm:text-[15px]",
62
+ };
63
+ const iconButtonSizes = {
64
+ sm: "size-(--control-inset-sm)",
65
+ default: "size-(--control-inset)",
66
+ };
67
+ const iconButton = "inline-flex shrink-0 cursor-pointer items-center justify-center rounded-full material-row text-muted-foreground focus-ring [&_svg]:size-4";
68
+ /**
69
+ * ComboboxInput — the recessed field the user types into, with an optional clear button and
70
+ * a chevron trigger. Inside `<ComboboxChips>` it renders as the bare text input after the chips.
71
+ */
72
+ export function ComboboxInput({ size = "default", showTrigger = true, showClear = false, className, labels, ...props }) {
73
+ const inChips = React.useContext(ChipsContext);
74
+ const text = useMessages("combobox", defaultMessages, labels);
75
+ if (inChips) {
76
+ return (_jsx(BaseCombobox.Input, { "data-slot": "combobox-input", className: cn("min-h-(--control-h-sm) min-w-16 flex-1 bg-transparent px-1.5 text-base outline-none placeholder:text-control-muted sm:text-[15px]", className), ...props }));
77
+ }
78
+ return (_jsxs(BaseCombobox.InputGroup, { "data-slot": "combobox-input-group", "data-size": size, className: cn(fieldGroup, groupSizes[size], className), children: [_jsx(BaseCombobox.Input, { "data-slot": "combobox-input", className: "min-w-0 flex-1 self-stretch bg-transparent outline-none placeholder:text-control-muted", ...props }), showClear && (_jsx(BaseCombobox.Clear, { "data-slot": "combobox-clear", "aria-label": text.clear, className: cn(iconButton, iconButtonSizes[size]), children: _jsx(XIcon, {}) })), showTrigger && (_jsx(BaseCombobox.Trigger, { "data-slot": "combobox-trigger", "aria-label": text.showOptions, "aria-labelledby": undefined, className: cn(iconButton, iconButtonSizes[size]), children: _jsx(ChevronsUpDownIcon, {}) }))] }));
79
+ }
80
+ /**
81
+ * ComboboxChips — the field for a `multiple` combobox: selected values as raised 30px chips,
82
+ * followed by the text input. Backspace at the start of the input removes the last chip.
83
+ */
84
+ export function ComboboxChips({ className, children, ...props }) {
85
+ return (_jsx(ChipsContext.Provider, { value: true, children: _jsx(BaseCombobox.InputGroup, { "data-slot": "combobox-chips-group", className: cn(fieldGroup, "min-h-(--control-h) cursor-text p-[3px]"), children: _jsx(BaseCombobox.Chips, { "data-slot": "combobox-chips", className: sx("flex w-full flex-wrap items-center gap-[3px]", className), ...props, children: typeof children === "function" ? (_jsx(BaseCombobox.Value, { children: (value) => children(value) })) : (children) }) }) }));
86
+ }
87
+ /** ComboboxChip — one selected value, with a remove button. */
88
+ export function ComboboxChip({ className, children, removeLabel, ...props }) {
89
+ const text = useMessages("combobox", defaultMessages);
90
+ const label = removeLabel ?? text.remove(typeof children === "string" ? children : undefined);
91
+ return (_jsxs(BaseCombobox.Chip, { "data-slot": "combobox-chip", className: sx([
92
+ "inline-flex min-h-(--control-h-sm) max-w-full cursor-default items-center gap-1 rounded-item border border-transparent ps-2.5 pe-[3px] text-[13px] leading-none font-medium text-foreground",
93
+ "bg-control-surface bg-linear-to-b from-control-inner-edge to-transparent shadow-raised",
94
+ ], className), ...props, children: [_jsx("span", { className: "truncate", children: children }), _jsx(BaseCombobox.ChipRemove, { "data-slot": "combobox-chip-remove", "aria-label": label, className: "inline-flex size-(--control-inset-sm) shrink-0 cursor-pointer items-center justify-center rounded-full text-muted-foreground transition-[background-color,color] duration-(--duration) ease-brand hover:bg-control-hover hover:text-foreground [&_svg]:size-3.5", children: _jsx(XIcon, {}) })] }));
95
+ }
96
+ /**
97
+ * ComboboxContent — the popup: menu material, 12px corners, as wide as the field. Place
98
+ * `<ComboboxEmpty>` and `<ComboboxList>` inside it.
99
+ */
100
+ export function ComboboxContent({ className, children, positioner, dir, ...props }) {
101
+ const popupDir = usePopupDir(dir);
102
+ return (_jsx(BaseCombobox.Portal, { children: _jsx(BaseCombobox.Positioner, { sideOffset: 6, dir: popupDir, ...positioner, className: "z-50 outline-none", children: _jsx(BaseCombobox.Popup, { "data-slot": "combobox-content", className: sx("w-(--anchor-width) max-w-(--available-width) popup-motion overflow-hidden rounded-button material-menu p-1 font-body outline-none", className), ...props, children: children }) }) }));
103
+ }
104
+ export function ComboboxList({ className, children, ...props }) {
105
+ const virtual = React.useContext(VirtualContext);
106
+ const [viewport, setViewport] = React.useState(null);
107
+ return (_jsx(ScrollArea, { className: "max-h-[min(23rem,calc(var(--available-height)-0.5rem))] has-[[data-slot=combobox-list][data-empty]]:hidden", viewportRender: _jsx(BaseCombobox.List, { "data-slot": "combobox-list", ref: virtual ? setViewport : undefined, role: "listbox", className: cn("scroll-py-1 outline-none data-has-overflow-y:pe-3", className), ...props }), children: typeof children === "function" ? (virtual ? (_jsx(VirtualOptions, { virtualizerRef: virtual, scroller: viewport, children: children })) : (_jsx(BaseCombobox.Collection, { children: children }))) : (children) }));
108
+ }
109
+ /**
110
+ * The filtered options in view and a few beyond, over the space of all of them. Each option takes
111
+ * its index in the filtered list, which a virtual combobox navigates by.
112
+ */
113
+ function VirtualOptions({ children, scroller, virtualizerRef, }) {
114
+ const items = BaseCombobox.useFilteredItems();
115
+ // Options are the control height (a long one wraps, and is measured).
116
+ const rowHeight = React.useMemo(() => (scroller ? parseFloat(getComputedStyle(scroller).getPropertyValue("--control-h")) || 38 : 38), [scroller]);
117
+ const virtualizer = useVirtualizer({
118
+ count: items.length,
119
+ getScrollElement: () => scroller,
120
+ estimateSize: () => rowHeight,
121
+ overscan: 10,
122
+ });
123
+ virtualizerRef.current = virtualizer;
124
+ React.useEffect(() => () => {
125
+ virtualizerRef.current = null;
126
+ }, [virtualizerRef]);
127
+ return (_jsx("div", { role: "presentation", className: "relative w-full", style: { height: virtualizer.getTotalSize() }, children: virtualizer.getVirtualItems().map((row) => {
128
+ const option = children(items[row.index], row.index);
129
+ if (!React.isValidElement(option))
130
+ return option;
131
+ return React.cloneElement(option, {
132
+ key: row.key,
133
+ index: row.index,
134
+ "data-index": row.index,
135
+ ref: virtualizer.measureElement,
136
+ style: {
137
+ ...option.props.style,
138
+ position: "absolute",
139
+ top: 0,
140
+ insetInline: 0,
141
+ translate: `0 ${row.start}px`,
142
+ },
143
+ });
144
+ }) }));
145
+ }
146
+ /** ComboboxItem — a 38px option with a 7px radius and a check when selected, like `SelectItem`. */
147
+ export function ComboboxItem({ className, children, ...props }) {
148
+ return (_jsxs(BaseCombobox.Item, { "data-slot": "combobox-item", className: sx([
149
+ "grid min-h-(--control-h) cursor-pointer grid-cols-[1fr_1rem] items-center gap-3 rounded-item border border-transparent px-2.5 py-[clamp(0px,calc((var(--control-h)-22px)/2),6px)] text-sm text-foreground-soft outline-none select-none",
150
+ "data-highlighted:border-control-inner-edge data-highlighted:bg-control-hover data-highlighted:text-foreground data-highlighted:shadow-highlight",
151
+ "data-disabled:pointer-events-none data-disabled:opacity-50 data-selected:text-foreground",
152
+ ], className), ...props, children: [_jsx("span", { className: "col-start-1 line-clamp-2 [overflow-wrap:anywhere]", children: children }), _jsx(BaseCombobox.ItemIndicator, { "data-slot": "combobox-item-indicator", className: "col-start-2 flex", children: _jsx(CheckIcon, { className: "size-4" }) })] }));
153
+ }
154
+ /**
155
+ * ComboboxEmpty — shown only when nothing matches the query. Say what to do next
156
+ * ("No service matches. Try a broader word."), not just "No results".
157
+ */
158
+ export function ComboboxEmpty({ className, ...props }) {
159
+ return (_jsx(BaseCombobox.Empty, { "data-slot": "combobox-empty", className: sx("px-2.5 py-2.5 text-sm text-muted-foreground empty:p-0", className), ...props }));
160
+ }
161
+ /** ComboboxGroup — a labelled section. Pair with `<ComboboxGroupLabel>` and `<ComboboxCollection>`. */
162
+ export function ComboboxGroup({ className, ...props }) {
163
+ return (_jsx(BaseCombobox.Group, { "data-slot": "combobox-group", className: sx("not-last:pb-1", className), ...props }));
164
+ }
165
+ export function ComboboxGroupLabel({ className, ...props }) {
166
+ return (_jsx(BaseCombobox.GroupLabel, { "data-slot": "combobox-group-label", className: sx("px-2.5 pt-2.5 pb-1.5 eyebrow text-[11px] [overflow-wrap:anywhere]", className), ...props }));
167
+ }
168
+ /** ComboboxCollection — renders a group's filtered items (function child), inside `<ComboboxGroup>`. */
169
+ export const ComboboxCollection = BaseCombobox.Collection;
170
+ export function ComboboxSeparator({ className, ...props }) {
171
+ return (_jsx(BaseCombobox.Separator, { "data-slot": "combobox-separator", className: sx("-mx-1 my-1 h-px bg-border", className), ...props }));
172
+ }
@@ -0,0 +1,132 @@
1
+ import { Autocomplete as BaseAutocomplete } from "@base-ui/react/autocomplete";
2
+ import { Dialog as BaseDialog } from "@base-ui/react/dialog";
3
+ import * as React from "react";
4
+ export interface CommandMessages {
5
+ /** The palette's name. */
6
+ label: string;
7
+ placeholder: string;
8
+ /** Shown when nothing matches. */
9
+ empty: string;
10
+ /** The `Esc` key that closes the palette. */
11
+ close: string;
12
+ /** The footer's hints, after ↑ ↓ and ↵. */
13
+ navigate: string;
14
+ open: string;
15
+ }
16
+ declare module "./locale" {
17
+ interface Messages {
18
+ command: CommandMessages;
19
+ }
20
+ }
21
+ /** One entry in the palette. `value` must be unique; `keywords` widen the match. */
22
+ export interface CommandEntry {
23
+ value: string;
24
+ label: string;
25
+ /** Group heading the entry is listed under. Entries without a group come first. */
26
+ group?: string;
27
+ /** Extra words that should match: synonyms, the section a page lives in, an old name. */
28
+ keywords?: readonly string[];
29
+ /** Longer text that may match (a summary). Searched with the lowest weight; not shown. */
30
+ description?: string;
31
+ /** Runs when the entry is chosen (click or Enter). The palette then closes. */
32
+ onSelect?: () => void;
33
+ /** A 16px lucide icon shown before the label. */
34
+ icon?: React.ReactNode;
35
+ /** Muted trailing text: a section name, a shortcut. */
36
+ hint?: React.ReactNode;
37
+ disabled?: boolean;
38
+ }
39
+ /** A heading plus its entries, as `CommandList` hands them to its render function. */
40
+ export type CommandGroupData = {
41
+ value: string;
42
+ items: CommandEntry[];
43
+ };
44
+ /**
45
+ * How well an entry matches the query; 0 is no match. Every query word has to match somewhere,
46
+ * and where it matches decides the weight: the label first (whole label, its start, the start of
47
+ * one of its words, anywhere in it), then keywords, then the group, and the description last.
48
+ * A label equal to the whole query wins outright.
49
+ */
50
+ export declare function scoreCommandEntry(entry: CommandEntry, query: string): number;
51
+ export interface CommandDialogProps extends Pick<BaseDialog.Root.Props, "open" | "defaultOpen" | "onOpenChange" | "onOpenChangeComplete"> {
52
+ /**
53
+ * The entries to search. Grouped by `group`; while searching they are ranked by
54
+ * `scoreCommandEntry` (label, then keywords, group and description) and the best match is first.
55
+ */
56
+ items: readonly CommandEntry[];
57
+ /** Custom matcher. Replaces the ranking: matching entries keep their original order. */
58
+ filter?: (entry: CommandEntry, query: string) => boolean;
59
+ /** Accessible name of the palette. Default `labels.label`. */
60
+ label?: string;
61
+ /** Default `labels.placeholder`. */
62
+ placeholder?: string;
63
+ /** Shown when nothing matches. Default `labels.empty`. */
64
+ emptyMessage?: React.ReactNode;
65
+ /** The palette's words, for its parts too; a LocaleProvider sets them for every palette. */
66
+ labels?: Partial<CommandMessages>;
67
+ /** An element that opens the palette, e.g. `<Button variant="secondary" />`. */
68
+ trigger?: React.ReactElement;
69
+ /** Replace the default input / list / footer composition with your own command parts. */
70
+ children?: React.ReactNode;
71
+ className?: string;
72
+ }
73
+ /**
74
+ * CommandDialog — the ⌘K command palette: a dialog holding a search field and a filtered list of
75
+ * entries (pages, actions, settings). Use it as the global search of a site or app; open it with
76
+ * `useCommandShortcut` and a visible trigger.
77
+ *
78
+ * Pass `items`; each entry's `onSelect` runs on click or Enter and the palette closes.
79
+ * The rule people break: making the palette the only way to reach something. It is a shortcut;
80
+ * every entry must also be reachable from the visible navigation.
81
+ */
82
+ export declare function CommandDialog({ items, filter, label, placeholder, emptyMessage, labels, trigger, children, className, onOpenChangeComplete, ...rootProps }: CommandDialogProps): React.JSX.Element;
83
+ /**
84
+ * The search field: borderless, 46px, a search icon before it and an `Esc` hint after it.
85
+ * The hint is the palette's close button, so touch and screen-reader users have one too.
86
+ */
87
+ export declare function CommandInput({ className, ...props }: BaseAutocomplete.Input.Props): React.JSX.Element;
88
+ /**
89
+ * The scrollable result list, in a ScrollArea. Its child is a render function receiving each
90
+ * `CommandGroupData`.
91
+ */
92
+ export interface CommandListProps extends Omit<BaseAutocomplete.List.Props, "className"> {
93
+ /** A class string: the list is rendered as ScrollArea's viewport, which merges strings only. */
94
+ className?: string;
95
+ }
96
+ export declare function CommandList({ className, children, ...props }: CommandListProps): React.JSX.Element;
97
+ export interface CommandGroupProps extends Omit<BaseAutocomplete.Group.Props, "children" | "items"> {
98
+ /** The group's entries, from `CommandGroupData.items`. */
99
+ items: readonly CommandEntry[];
100
+ /** Heading rendered as a `CommandGroupLabel`. Empty strings render no heading. */
101
+ label?: React.ReactNode;
102
+ /** Render function for each entry. */
103
+ children: (entry: CommandEntry, index: number) => React.ReactNode;
104
+ }
105
+ /** A labelled group of entries inside `CommandList`. */
106
+ export declare function CommandGroup({ items, label, children, className, ...props }: CommandGroupProps): React.JSX.Element;
107
+ /** An eyebrow above a group: 11px mono, uppercase, tracked. */
108
+ export declare function CommandGroupLabel({ className, ...props }: BaseAutocomplete.GroupLabel.Props): React.JSX.Element;
109
+ export interface CommandItemProps extends Omit<BaseAutocomplete.Item.Props, "value" | "onSelect"> {
110
+ value: CommandEntry;
111
+ /** Runs after the entry's own `onSelect`. */
112
+ onItemSelect?: (entry: CommandEntry) => void;
113
+ /** Close the palette after selecting. */
114
+ closeOnSelect?: boolean;
115
+ }
116
+ /**
117
+ * One result: 38px, 7px radius, raised when highlighted. Renders the entry's icon, label and hint
118
+ * unless you pass children.
119
+ */
120
+ export declare function CommandItem({ value, onItemSelect, closeOnSelect, className, children, onClick, ...props }: CommandItemProps): React.JSX.Element;
121
+ /** Shown when nothing matches. Stays mounted (it is a live region); only its children toggle. */
122
+ export declare function CommandEmpty({ className, ...props }: BaseAutocomplete.Empty.Props): React.JSX.Element;
123
+ /** Keyboard hints along the bottom edge: "↑↓ navigate · ↵ open". */
124
+ export declare function CommandFooter({ className, children, ...props }: React.ComponentProps<"div">): React.JSX.Element;
125
+ /**
126
+ * useCommandShortcut — call `onOpen` on ⌘K (macOS) or Ctrl+K (elsewhere).
127
+ *
128
+ * useCommandShortcut(() => setOpen((open) => !open));
129
+ * useCommandShortcut("/", openSearch);
130
+ */
131
+ export declare function useCommandShortcut(onOpen: (event: KeyboardEvent) => void): void;
132
+ export declare function useCommandShortcut(key: string | undefined, onOpen: (event: KeyboardEvent) => void): void;
@@ -0,0 +1,257 @@
1
+ "use client";
2
+ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { Autocomplete as BaseAutocomplete } from "@base-ui/react/autocomplete";
4
+ import { Dialog as BaseDialog } from "@base-ui/react/dialog";
5
+ import { SearchIcon } from "lucide-react";
6
+ import * as React from "react";
7
+ import { cn, sx } from "../lib/cn.js";
8
+ import { modPressed } from "../lib/platform.js";
9
+ import { ScrollArea } from "./scroll-area.js";
10
+ import { Kbd, kbdClassName } from "./kbd.js";
11
+ import { overlayBackdrop, overlayCard, usePopupDir } from "./_overlay.js";
12
+ import { useMessages } from "./locale.js";
13
+ const defaultMessages = {
14
+ label: "Search",
15
+ placeholder: "Search pages and actions…",
16
+ empty: "Nothing matches that search.",
17
+ close: "Close search",
18
+ navigate: "navigate",
19
+ open: "open",
20
+ };
21
+ /** Group a flat list by `group`, keeping first-seen order. */
22
+ function groupEntries(entries) {
23
+ const groups = new Map();
24
+ for (const entry of entries) {
25
+ const key = entry.group ?? "";
26
+ const list = groups.get(key);
27
+ if (list)
28
+ list.push(entry);
29
+ else
30
+ groups.set(key, [entry]);
31
+ }
32
+ return [...groups].map(([value, items]) => ({ value, items }));
33
+ }
34
+ const normalize = (text) => text
35
+ .normalize("NFD")
36
+ .replace(/\p{Diacritic}/gu, "")
37
+ .toLowerCase();
38
+ const wordsOf = (text) => text.split(/[^\p{L}\p{N}]+/u).filter(Boolean);
39
+ /** An entry's text, normalised once: a palette of thousands is searched again at every key. */
40
+ const searchText = new WeakMap();
41
+ function readSearchable(entry) {
42
+ const label = normalize(entry.label);
43
+ const description = normalize(entry.description ?? "");
44
+ return {
45
+ label,
46
+ labelWords: wordsOf(label),
47
+ keywords: (entry.keywords ?? []).map(normalize),
48
+ group: normalize(entry.group ?? ""),
49
+ description,
50
+ descriptionWords: wordsOf(description),
51
+ };
52
+ }
53
+ function searchable(entry) {
54
+ let text = searchText.get(entry);
55
+ if (!text)
56
+ searchText.set(entry, (text = readSearchable(entry)));
57
+ return text;
58
+ }
59
+ /**
60
+ * How well an entry matches the query; 0 is no match. Every query word has to match somewhere,
61
+ * and where it matches decides the weight: the label first (whole label, its start, the start of
62
+ * one of its words, anywhere in it), then keywords, then the group, and the description last.
63
+ * A label equal to the whole query wins outright.
64
+ */
65
+ export function scoreCommandEntry(entry, query) {
66
+ const q = normalize(query).trim();
67
+ const words = q.split(/\s+/).filter(Boolean);
68
+ if (words.length === 0)
69
+ return 1;
70
+ const { label, labelWords, keywords, group, description, descriptionWords } = searchable(entry);
71
+ let total = 0;
72
+ for (const word of words) {
73
+ let best = 0;
74
+ if (label === word)
75
+ best = 700;
76
+ else if (label.startsWith(word))
77
+ best = 600;
78
+ else if (labelWords.some((w) => w.startsWith(word)))
79
+ best = 450;
80
+ else if (label.includes(word))
81
+ best = 300;
82
+ for (const keyword of keywords) {
83
+ if (best >= 400)
84
+ break;
85
+ if (keyword === word)
86
+ best = Math.max(best, 400);
87
+ else if (keyword.startsWith(word))
88
+ best = Math.max(best, 250);
89
+ else if (wordsOf(keyword).some((w) => w.startsWith(word)))
90
+ best = Math.max(best, 200);
91
+ else if (keyword.includes(word))
92
+ best = Math.max(best, 100);
93
+ }
94
+ if (best < 60 && group.includes(word))
95
+ best = 60;
96
+ if (best < 40 && descriptionWords.some((w) => w.startsWith(word)))
97
+ best = 40;
98
+ if (best < 10 && description.includes(word))
99
+ best = 10;
100
+ if (best === 0)
101
+ return 0;
102
+ total += best;
103
+ }
104
+ if (label === q)
105
+ total += 1000;
106
+ else if (label.startsWith(q))
107
+ total += 200;
108
+ return total;
109
+ }
110
+ /**
111
+ * The palette's results for a query: matching entries ranked by `scoreCommandEntry`, still under
112
+ * their group headings, with the groups ordered by their best entry — so the top hit is always
113
+ * the first row. Ties keep the shorter label, then the original order. An empty query keeps the
114
+ * original grouping.
115
+ */
116
+ function rankEntries(entries, query, filter) {
117
+ if (!query.trim())
118
+ return groupEntries(entries.slice(0, MAX_RESULTS));
119
+ // A custom matcher filters only; it keeps the original order.
120
+ if (filter) {
121
+ const matches = [];
122
+ for (const entry of entries) {
123
+ if (filter(entry, query))
124
+ matches.push(entry);
125
+ if (matches.length === MAX_RESULTS)
126
+ break;
127
+ }
128
+ return groupEntries(matches);
129
+ }
130
+ const ranked = entries
131
+ .map((entry, index) => ({ entry, index, score: scoreCommandEntry(entry, query) }))
132
+ .filter((r) => r.score > 0)
133
+ .sort((a, b) => b.score - a.score || a.entry.label.length - b.entry.label.length || a.index - b.index)
134
+ .slice(0, MAX_RESULTS)
135
+ .map((r) => r.entry);
136
+ return groupEntries(ranked);
137
+ }
138
+ /**
139
+ * The most results the palette lists: the best matches, or the first entries before anything is
140
+ * typed. Past a few hundred, a list is scrolled through instead of narrowed, and each row costs
141
+ * time to draw.
142
+ */
143
+ const MAX_RESULTS = 200;
144
+ const CommandContext = React.createContext({
145
+ close: () => { },
146
+ });
147
+ const useCommandText = () => useMessages("command", defaultMessages, React.useContext(CommandContext).labels);
148
+ /**
149
+ * CommandDialog — the ⌘K command palette: a dialog holding a search field and a filtered list of
150
+ * entries (pages, actions, settings). Use it as the global search of a site or app; open it with
151
+ * `useCommandShortcut` and a visible trigger.
152
+ *
153
+ * Pass `items`; each entry's `onSelect` runs on click or Enter and the palette closes.
154
+ * The rule people break: making the palette the only way to reach something. It is a shortcut;
155
+ * every entry must also be reachable from the visible navigation.
156
+ */
157
+ export function CommandDialog({ items, filter, label, placeholder, emptyMessage, labels, trigger, children, className, onOpenChangeComplete, ...rootProps }) {
158
+ const text = useMessages("command", defaultMessages, labels);
159
+ const actionsRef = React.useRef(null);
160
+ const [query, setQuery] = React.useState("");
161
+ const groups = React.useMemo(() => groupEntries(items), [items]);
162
+ const results = React.useMemo(() => rankEntries(items, query, filter), [items, query, filter]);
163
+ // Closing through Base UI's imperative action keeps controlled and uncontrolled use working:
164
+ // onOpenChange fires with reason "imperative-action".
165
+ const context = React.useMemo(() => ({ close: () => actionsRef.current?.close(), labels }), [labels]);
166
+ const popupDir = usePopupDir();
167
+ return (_jsxs(BaseDialog.Root, { actionsRef: actionsRef, onOpenChangeComplete: (open) => {
168
+ // Every opening starts from an empty search. Cleared once the palette has closed — also
169
+ // when its owner closes it through `open` — so the results don't flash back while it
170
+ // fades, and a close the owner refuses keeps what was typed.
171
+ if (!open)
172
+ setQuery("");
173
+ onOpenChangeComplete?.(open);
174
+ }, ...rootProps, children: [trigger && _jsx(BaseDialog.Trigger, { render: trigger }), _jsxs(BaseDialog.Portal, { children: [_jsx(BaseDialog.Backdrop, { "data-slot": "command-backdrop", className: overlayBackdrop }), _jsx(BaseDialog.Viewport, { "data-slot": "command-viewport", className: "fixed inset-0 z-50 flex items-start justify-center px-4 pt-[12dvh] pb-4 sm:pt-[16dvh]", children: _jsx(BaseDialog.Popup, { "data-slot": "command-dialog", "aria-label": label ?? text.label, dir: popupDir, className: cn("relative flex max-h-[min(34rem,calc(84dvh-1rem))] w-full max-w-[40rem] flex-col overflow-hidden rounded-card font-body outline-none", overlayCard, "popup-motion", className), children: _jsx(CommandContext.Provider, { value: context, children: _jsx(BaseAutocomplete.Root, { open: true, inline: true, items: groups, filteredItems: results, value: query, onValueChange: setQuery, itemToStringValue: (item) => item.label, autoHighlight: "always", keepHighlight: true, children: children ?? (_jsxs(_Fragment, { children: [_jsx(CommandInput, { placeholder: placeholder ?? text.placeholder }), _jsx(CommandEmpty, { children: emptyMessage === undefined ? text.empty : emptyMessage }), _jsx(CommandList, { children: (group) => (_jsx(CommandGroup, { items: group.items, label: group.value, children: (entry) => _jsx(CommandItem, { value: entry }, entry.value) }, group.value)) }), _jsx(CommandFooter, {})] })) }) }) }) })] })] }));
175
+ }
176
+ /**
177
+ * The search field: borderless, 46px, a search icon before it and an `Esc` hint after it.
178
+ * The hint is the palette's close button, so touch and screen-reader users have one too.
179
+ */
180
+ export function CommandInput({ className, ...props }) {
181
+ const text = useCommandText();
182
+ return (_jsxs(BaseAutocomplete.InputGroup, { "data-slot": "command-input-group", className: "flex min-h-(--control-h-lg) shrink-0 cursor-text items-center gap-3 border-b border-border px-4", children: [_jsx(SearchIcon, { "aria-hidden": true, className: "size-4 shrink-0 text-muted-foreground" }), _jsx(BaseAutocomplete.Input, { "data-slot": "command-input", className: sx("min-h-(--control-h-lg) w-full min-w-0 flex-1 border-0 bg-transparent text-base text-foreground outline-none placeholder:text-control-muted sm:text-[15px]", className), ...props }), _jsxs(BaseDialog.Close, { "data-slot": "command-close", className: cn(kbdClassName, "cursor-pointer focus-ring"), children: ["Esc", _jsxs("span", { className: "sr-only", children: [", ", text.close] })] })] }));
183
+ }
184
+ export function CommandList({ className, children, ...props }) {
185
+ return (_jsx(ScrollArea
186
+ // A flex column, so the list takes the room the palette leaves it (the palette has only a
187
+ // max height, which a viewport's height: 100% cannot resolve against).
188
+ , {
189
+ // A flex column, so the list takes the room the palette leaves it (the palette has only a
190
+ // max height, which a viewport's height: 100% cannot resolve against).
191
+ className: "flex min-h-0 flex-1 flex-col has-[[data-slot=command-list][data-empty]]:hidden", viewportClassName: "h-auto min-h-0 flex-1",
192
+ // Rows are as wide as the palette, so a long label truncates. Base UI sizes the content to
193
+ // fit its widest line, which would push the row, its hint and its edge out of view.
194
+ contentClassName: "min-w-0!", viewportRender: _jsx(BaseAutocomplete.List, { "data-slot": "command-list", role: "listbox", className: cn("scroll-py-2 p-2 data-has-overflow-y:pe-3", className), ...props }), children: typeof children === "function" ? (_jsx(BaseAutocomplete.Collection, { children: children })) : (children) }));
195
+ }
196
+ /** A labelled group of entries inside `CommandList`. */
197
+ export function CommandGroup({ items, label, children, className, ...props }) {
198
+ return (_jsxs(BaseAutocomplete.Group, { "data-slot": "command-group", items: items, className: sx("not-last:mb-1", className), ...props, children: [label ? _jsx(CommandGroupLabel, { children: label }) : null, _jsx(BaseAutocomplete.Collection, { children: children })] }));
199
+ }
200
+ /** An eyebrow above a group: 11px mono, uppercase, tracked. */
201
+ export function CommandGroupLabel({ className, ...props }) {
202
+ return (_jsx(BaseAutocomplete.GroupLabel, { "data-slot": "command-group-label", className: sx("px-2.5 pt-2.5 pb-1.5 eyebrow text-[11px] [overflow-wrap:anywhere] select-none", className), ...props }));
203
+ }
204
+ /**
205
+ * One result: 38px, 7px radius, raised when highlighted. Renders the entry's icon, label and hint
206
+ * unless you pass children.
207
+ */
208
+ export function CommandItem({ value, onItemSelect, closeOnSelect = true, className, children, onClick, ...props }) {
209
+ const { close } = React.useContext(CommandContext);
210
+ return (_jsx(BaseAutocomplete.Item, { "data-slot": "command-item", value: value, disabled: value.disabled, onClick: (event) => {
211
+ onClick?.(event);
212
+ value.onSelect?.();
213
+ onItemSelect?.(value);
214
+ if (closeOnSelect)
215
+ close();
216
+ }, className: sx([
217
+ "flex min-h-(--control-h) cursor-pointer scroll-my-2 items-center gap-3 rounded-item border border-transparent px-2.5 text-sm text-foreground-soft outline-none select-none",
218
+ // The raised treatment, on the highlight only: the pointer moves the highlight, so a CSS
219
+ // :hover lift (as in material-row) would show two raised rows while typing.
220
+ "transition-[background-color,color,box-shadow] duration-(--duration) ease-brand",
221
+ "data-highlighted:bg-control-hover data-highlighted:bg-[linear-gradient(180deg,var(--control-inner-edge),transparent)] data-highlighted:text-foreground data-highlighted:shadow-raised",
222
+ "data-disabled:pointer-events-none data-disabled:opacity-50",
223
+ "[&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&>svg]:text-muted-foreground data-highlighted:[&>svg]:text-foreground",
224
+ ], className), ...props, children: children ??
225
+ (value.hint ? (_jsxs(_Fragment, { children: [value.icon, _jsxs("span", { className: "grid min-w-0 flex-1 grid-cols-[minmax(0,max-content)_minmax(0,max-content)] items-center justify-between gap-3", children: [_jsx("span", { className: "truncate", children: value.label }), _jsx("span", { className: "truncate font-mono text-xs text-muted-foreground [unicode-bidi:plaintext]", children: value.hint })] })] })) : (_jsxs(_Fragment, { children: [value.icon, _jsx("span", { className: "min-w-0 flex-1 truncate", children: value.label })] }))) }));
226
+ }
227
+ /** Shown when nothing matches. Stays mounted (it is a live region); only its children toggle. */
228
+ export function CommandEmpty({ className, ...props }) {
229
+ return (_jsx(BaseAutocomplete.Empty, { "data-slot": "command-empty", className: sx("text-center text-sm text-muted-foreground [&:not(:empty)]:px-4 [&:not(:empty)]:py-10", className), ...props }));
230
+ }
231
+ /** Keyboard hints along the bottom edge: "↑↓ navigate · ↵ open". */
232
+ export function CommandFooter({ className, children, ...props }) {
233
+ const text = useCommandText();
234
+ return (_jsx("div", { "data-slot": "command-footer", className: cn("flex min-h-(--control-h) shrink-0 items-center gap-4 border-t border-border px-4 font-mono text-[11px] text-muted-foreground select-none", className), ...props, children: children ?? (_jsxs(_Fragment, { children: [_jsxs("span", { className: "inline-flex items-center gap-1.5", children: [_jsx(Kbd, { children: "\u2191" }), _jsx(Kbd, { children: "\u2193" }), text.navigate] }), _jsx("span", { "aria-hidden": true, children: "\u00B7" }), _jsxs("span", { className: "inline-flex items-center gap-1.5", children: [_jsx(Kbd, { children: "\u21B5" }), text.open] })] })) }));
235
+ }
236
+ export function useCommandShortcut(keyOrHandler, maybeHandler) {
237
+ const key = (typeof keyOrHandler === "string" ? keyOrHandler : "k").toLowerCase();
238
+ const handler = typeof keyOrHandler === "function" ? keyOrHandler : maybeHandler;
239
+ const handlerRef = React.useRef(handler);
240
+ React.useEffect(() => {
241
+ handlerRef.current = handler;
242
+ });
243
+ React.useEffect(() => {
244
+ function onKeyDown(event) {
245
+ if (event.defaultPrevented || event.repeat || event.altKey || event.shiftKey)
246
+ return;
247
+ // `key` is missing on the keydown Chrome fires for autofill. ⌘ on Apple devices, Ctrl
248
+ // elsewhere, and not both: in a Mac's text field Ctrl+K deletes to the end of the line.
249
+ if (!modPressed(event) || event.key?.toLowerCase() !== key)
250
+ return;
251
+ event.preventDefault();
252
+ handlerRef.current?.(event);
253
+ }
254
+ window.addEventListener("keydown", onKeyDown);
255
+ return () => window.removeEventListener("keydown", onKeyDown);
256
+ }, [key]);
257
+ }
@@ -0,0 +1,29 @@
1
+ import { ContextMenu as BaseContextMenu } from "@base-ui/react/context-menu";
2
+ import { type MenuFrameProps } from "./_overlay.js";
3
+ import { MenuCheckboxItem, MenuGroup, MenuGroupLabel, MenuItem, MenuLinkItem, MenuRadioGroup, MenuRadioItem, MenuSeparator, MenuShortcut, MenuSubContent, MenuSubTrigger } from "./menu.js";
4
+ /**
5
+ * ContextMenu — the actions for a thing, opened on right click or long press at the pointer.
6
+ * Shares the `Menu` material and items: the `ContextMenu*` item parts are the `Menu*` parts.
7
+ *
8
+ * The rule people break: hiding the only way to do something in it. A context menu is a
9
+ * shortcut; every action in it must also be reachable from a visible control.
10
+ */
11
+ export declare const ContextMenu: typeof BaseContextMenu.Root;
12
+ /** The area that opens the menu on right click or long press. Renders a `<div>`. */
13
+ export declare function ContextMenuTrigger({ className, ...props }: BaseContextMenu.Trigger.Props): import("react").JSX.Element;
14
+ export type ContextMenuContentProps = Omit<MenuFrameProps, "slot">;
15
+ /** Portal + Positioner + Popup, placed at the pointer. Same surface as `MenuContent`. */
16
+ export declare function ContextMenuContent(props: ContextMenuContentProps): import("react").JSX.Element;
17
+ /** Aliases of the `Menu` item parts, for symmetry with `ContextMenu`. */
18
+ export declare const ContextMenuItem: typeof MenuItem;
19
+ export declare const ContextMenuLinkItem: typeof MenuLinkItem;
20
+ export declare const ContextMenuCheckboxItem: typeof MenuCheckboxItem;
21
+ export declare const ContextMenuRadioGroup: typeof MenuRadioGroup;
22
+ export declare const ContextMenuRadioItem: typeof MenuRadioItem;
23
+ export declare const ContextMenuGroup: typeof MenuGroup;
24
+ export declare const ContextMenuGroupLabel: typeof MenuGroupLabel;
25
+ export declare const ContextMenuSeparator: typeof MenuSeparator;
26
+ export declare const ContextMenuShortcut: typeof MenuShortcut;
27
+ export declare const ContextMenuSub: typeof BaseContextMenu.SubmenuRoot;
28
+ export declare const ContextMenuSubTrigger: typeof MenuSubTrigger;
29
+ export declare const ContextMenuSubContent: typeof MenuSubContent;
@@ -0,0 +1,35 @@
1
+ "use client";
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import { ContextMenu as BaseContextMenu } from "@base-ui/react/context-menu";
4
+ import { sx } from "../lib/cn.js";
5
+ import { MenuFrame } from "./_overlay.js";
6
+ import { MenuCheckboxItem, MenuGroup, MenuGroupLabel, MenuItem, MenuLinkItem, MenuRadioGroup, MenuRadioItem, MenuSeparator, MenuShortcut, MenuSub, MenuSubContent, MenuSubTrigger, } from "./menu.js";
7
+ /**
8
+ * ContextMenu — the actions for a thing, opened on right click or long press at the pointer.
9
+ * Shares the `Menu` material and items: the `ContextMenu*` item parts are the `Menu*` parts.
10
+ *
11
+ * The rule people break: hiding the only way to do something in it. A context menu is a
12
+ * shortcut; every action in it must also be reachable from a visible control.
13
+ */
14
+ export const ContextMenu = BaseContextMenu.Root;
15
+ /** The area that opens the menu on right click or long press. Renders a `<div>`. */
16
+ export function ContextMenuTrigger({ className, ...props }) {
17
+ return (_jsx(BaseContextMenu.Trigger, { "data-slot": "context-menu-trigger", className: sx("select-none", className), ...props }));
18
+ }
19
+ /** Portal + Positioner + Popup, placed at the pointer. Same surface as `MenuContent`. */
20
+ export function ContextMenuContent(props) {
21
+ return _jsx(MenuFrame, { slot: "context-menu-content", ...props });
22
+ }
23
+ /** Aliases of the `Menu` item parts, for symmetry with `ContextMenu`. */
24
+ export const ContextMenuItem = MenuItem;
25
+ export const ContextMenuLinkItem = MenuLinkItem;
26
+ export const ContextMenuCheckboxItem = MenuCheckboxItem;
27
+ export const ContextMenuRadioGroup = MenuRadioGroup;
28
+ export const ContextMenuRadioItem = MenuRadioItem;
29
+ export const ContextMenuGroup = MenuGroup;
30
+ export const ContextMenuGroupLabel = MenuGroupLabel;
31
+ export const ContextMenuSeparator = MenuSeparator;
32
+ export const ContextMenuShortcut = MenuShortcut;
33
+ export const ContextMenuSub = MenuSub;
34
+ export const ContextMenuSubTrigger = MenuSubTrigger;
35
+ export const ContextMenuSubContent = MenuSubContent;