@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,334 @@
1
+ "use client";
2
+ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { Combobox as BaseCombobox } from "@base-ui/react/combobox";
4
+ import { PlusIcon, XIcon } from "lucide-react";
5
+ import * as React from "react";
6
+ import { cn } from "../lib/cn.js";
7
+ import { Button } from "./button.js";
8
+ import { ButtonGroup } from "./button-group.js";
9
+ import { Calendar } from "./calendar.js";
10
+ import { ComboboxEmpty, ComboboxInput, ComboboxItem, ComboboxList } from "./combobox.js";
11
+ import { Input } from "./input.js";
12
+ import { useLocale, useMessages } from "./locale.js";
13
+ import { Menu, MenuContent, MenuItem, MenuTrigger } from "./menu.js";
14
+ import { NumberField } from "./number-field.js";
15
+ import { Popover, PopoverContent, PopoverTitle, PopoverTrigger } from "./popover.js";
16
+ import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "./select.js";
17
+ const defaultMessages = {
18
+ group: "Filters",
19
+ add: "Filter",
20
+ clearAll: "Clear all",
21
+ chip: (field) => `${field} filter`,
22
+ remove: (field) => `Remove ${field} filter`,
23
+ condition: (field) => `${field}: condition`,
24
+ searchPlaceholder: (field) => `Search ${field.toLowerCase()}…`,
25
+ search: (field) => `Search ${field.toLowerCase()}`,
26
+ noMatch: (field) => `No ${field.toLowerCase()} matches.`,
27
+ textPlaceholder: (field) => `${field}…`,
28
+ quote: (text) => `“${text}”`,
29
+ from: "from",
30
+ until: "until",
31
+ is: "is",
32
+ isNot: "is not",
33
+ contains: "contains",
34
+ doesNotContain: "does not contain",
35
+ gte: "at least",
36
+ lte: "at most",
37
+ gt: "more than",
38
+ lt: "less than",
39
+ eq: "is",
40
+ neq: "is not",
41
+ between: "between",
42
+ };
43
+ /* ── Matching ──────────────────────────────────────────────────────────────── */
44
+ /**
45
+ * Each kind's operators, by the message that names them. A number's chip shows its `symbol`;
46
+ * the others show their name.
47
+ */
48
+ const operators = {
49
+ select: [
50
+ { value: "is", key: "is" },
51
+ { value: "is-not", key: "isNot" },
52
+ ],
53
+ text: [
54
+ { value: "contains", key: "contains" },
55
+ { value: "does-not-contain", key: "doesNotContain" },
56
+ ],
57
+ number: [
58
+ { value: "gte", key: "gte", symbol: "≥" },
59
+ { value: "lte", key: "lte", symbol: "≤" },
60
+ { value: "gt", key: "gt", symbol: ">" },
61
+ { value: "lt", key: "lt", symbol: "<" },
62
+ { value: "eq", key: "eq", symbol: "=" },
63
+ { value: "neq", key: "neq", symbol: "≠" },
64
+ ],
65
+ date: [{ value: "between", key: "between", symbol: "" }],
66
+ };
67
+ function emptyValue(kind) {
68
+ return kind === "select" ? [] : kind === "text" ? "" : kind === "number" ? null : {};
69
+ }
70
+ /** An end of a range as an ISO day, or nothing: a value from a URL may be any text. */
71
+ const dayOf = (iso) => typeof iso === "string" && /^\d{4}-\d{2}-\d{2}/.test(iso) ? iso.slice(0, 10) : undefined;
72
+ /** A date filter's range with only real days in it, in order: "15 Oct – 1 Oct" is 1–15 Oct. */
73
+ function rangeOf(value) {
74
+ const range = value && typeof value === "object" && !Array.isArray(value) ? value : {};
75
+ const from = dayOf(range.from);
76
+ const to = dayOf(range.to);
77
+ return from && to && from > to ? { from: to, to: from } : { from, to };
78
+ }
79
+ /** True when a filter has nothing to compare yet, so it matches every row. */
80
+ function isEmpty(filter) {
81
+ const v = filter.value;
82
+ if (v == null)
83
+ return true;
84
+ if (Array.isArray(v))
85
+ return v.length === 0;
86
+ if (typeof v === "string")
87
+ return v.trim() === "";
88
+ if (typeof v === "number")
89
+ return Number.isNaN(v);
90
+ const { from, to } = rangeOf(v);
91
+ return !from && !to;
92
+ }
93
+ const pad = (n) => String(n).padStart(2, "0");
94
+ /** A row's date as a local ISO day, so it compares with the range as text. */
95
+ function isoDay(value) {
96
+ if (value instanceof Date) {
97
+ if (Number.isNaN(value.getTime()))
98
+ return null;
99
+ return `${value.getFullYear()}-${pad(value.getMonth() + 1)}-${pad(value.getDate())}`;
100
+ }
101
+ if (typeof value === "number")
102
+ return isoDay(new Date(value));
103
+ if (typeof value === "string" && /^\d{4}-\d{2}-\d{2}/.test(value))
104
+ return value.slice(0, 10);
105
+ return null;
106
+ }
107
+ function matchOne(raw, filter) {
108
+ switch (filter.operator) {
109
+ case "is":
110
+ case "is-not": {
111
+ const wanted = filter.value;
112
+ const values = (Array.isArray(raw) ? raw : [raw]).map(String);
113
+ const hit = values.some((v) => wanted.includes(v));
114
+ return filter.operator === "is" ? hit : !hit;
115
+ }
116
+ case "contains":
117
+ case "does-not-contain": {
118
+ const hit = String(raw ?? "")
119
+ .toLowerCase()
120
+ .includes(filter.value.trim().toLowerCase());
121
+ return filter.operator === "contains" ? hit : !hit;
122
+ }
123
+ case "between": {
124
+ const day = isoDay(raw);
125
+ const { from, to } = rangeOf(filter.value);
126
+ if (!day)
127
+ return false;
128
+ return (!from || day >= from) && (!to || day <= to);
129
+ }
130
+ default: {
131
+ if (raw == null || raw === "")
132
+ return false;
133
+ const n = Number(raw);
134
+ const v = filter.value;
135
+ if (Number.isNaN(n))
136
+ return false;
137
+ if (filter.operator === "eq")
138
+ return n === v;
139
+ if (filter.operator === "neq")
140
+ return n !== v;
141
+ if (filter.operator === "gt")
142
+ return n > v;
143
+ if (filter.operator === "gte")
144
+ return n >= v;
145
+ if (filter.operator === "lt")
146
+ return n < v;
147
+ return n <= v;
148
+ }
149
+ }
150
+ }
151
+ /**
152
+ * Whether a row passes every filter — for filtering on the client:
153
+ * `rows.filter((row) => matchesFilters(row, filters, fields))`. Filters without a value yet, and
154
+ * filters on fields not in `fields`, are skipped. Text compares case-insensitively; dates compare
155
+ * as local days, from `Date`s, timestamps or ISO strings.
156
+ */
157
+ export function matchesFilters(row, filters, fields) {
158
+ return filters.every((filter) => {
159
+ const field = fields.find((f) => f.id === filter.field);
160
+ if (!field || isEmpty(filter))
161
+ return true;
162
+ const raw = field.accessor ? field.accessor(row) : row[field.id];
163
+ return matchOne(raw, filter);
164
+ });
165
+ }
166
+ /* ── Chip text ─────────────────────────────────────────────────────────────── */
167
+ function formatDay(iso, locale) {
168
+ const [y, m, d] = iso.split("-").map(Number);
169
+ return new Intl.DateTimeFormat(locale, { day: "numeric", month: "short", year: "numeric" }).format(new Date(y, m - 1, d));
170
+ }
171
+ /** What the chip says after the field's name: the operator and the value, or null while empty. */
172
+ function describe(filter, field, text, locale) {
173
+ if (isEmpty(filter))
174
+ return null;
175
+ const entry = operators[field.kind].find((o) => o.value === filter.operator);
176
+ const op = entry && { symbol: entry.symbol ?? text[entry.key] };
177
+ switch (field.kind) {
178
+ case "select": {
179
+ // In the options' order, not the order they were picked in; a value no option has (from a
180
+ // URL, or an option since removed) as it is, after them.
181
+ const picked = new Set(filter.value);
182
+ const known = new Set(field.options.map((o) => o.value));
183
+ const labels = [
184
+ ...field.options.filter((o) => picked.has(o.value)).map((o) => o.label),
185
+ ...[...picked].filter((v) => !known.has(v)).map(String),
186
+ ];
187
+ const shown = labels.length > 2 ? `${labels.slice(0, 2).join(", ")} +${labels.length - 2}` : labels.join(", ");
188
+ return [op?.symbol ?? text.is, shown];
189
+ }
190
+ case "text":
191
+ return [op?.symbol ?? text.contains, text.quote(filter.value.trim())];
192
+ case "number":
193
+ return [op?.symbol ?? "=", new Intl.NumberFormat(locale, field.format).format(filter.value)];
194
+ case "date": {
195
+ const { from, to } = rangeOf(filter.value);
196
+ if (from && to)
197
+ return ["", `${formatDay(from, locale)} – ${formatDay(to, locale)}`];
198
+ return from ? [text.from, formatDay(from, locale)] : [text.until, formatDay(to, locale)];
199
+ }
200
+ }
201
+ }
202
+ function OperatorSelect({ field, filter, onChange, text }) {
203
+ const ops = operators[field.kind];
204
+ if (ops.length < 2)
205
+ return null;
206
+ return (_jsxs(Select, { value: filter.operator, onValueChange: (operator) => operator && onChange({ ...filter, operator: operator }), items: ops.map((o) => ({ value: o.value, label: text[o.key] })), children: [_jsx(SelectTrigger, { size: "sm", "aria-label": text.condition(field.label), className: "w-auto min-w-0 gap-1.5", children: _jsx(SelectValue, {}) }), _jsx(SelectContent, { children: ops.map((o) => (_jsx(SelectItem, { value: o.value, children: text[o.key] }, o.value))) })] }));
207
+ }
208
+ /** The options as an inline Combobox: a search field over them when the list is long, checks for the picked. */
209
+ function SelectEditor({ field, filter, onChange, text }) {
210
+ const searchable = field.searchable ?? field.options.length >= 8;
211
+ const byValue = React.useMemo(() => new Map(field.options.map((o) => [o.value, o])), [field.options]);
212
+ return (_jsxs(BaseCombobox.Root, { inline: true, open: true, multiple: true, items: field.options.map((o) => o.value), value: filter.value, onValueChange: (value) => onChange({ ...filter, value }), itemToStringLabel: (value) => byValue.get(value)?.label ?? value, autoHighlight: true, children: [searchable ? (_jsx(ComboboxInput, { size: "sm", showTrigger: false, placeholder: text.searchPlaceholder(field.label), "aria-label": text.search(field.label) })) : (_jsx(BaseCombobox.Input, { "data-slot": "filter-bar-list-focus", "aria-label": field.label, className: "sr-only", readOnly: true })), _jsx(ComboboxEmpty, { children: text.noMatch(field.label) }), _jsx(ComboboxList, { children: (value) => {
213
+ const option = byValue.get(value);
214
+ return (_jsx(ComboboxItem, { value: value, children: _jsxs("span", { className: "flex items-center gap-2.5 [&_svg]:size-4 [&_svg]:text-muted-foreground", children: [option.icon, option.label] }) }, value));
215
+ } })] }));
216
+ }
217
+ function TextEditor({ field, filter, onChange, onDone, text }) {
218
+ return (_jsx(Input, { size: "sm", value: filter.value, onValueChange: (value) => onChange({ ...filter, value }), onKeyDown: (event) => event.key === "Enter" && onDone(), placeholder: field.placeholder ?? text.textPlaceholder(field.label), "aria-label": field.label }));
219
+ }
220
+ function NumberEditor({ field, filter, onChange, onDone }) {
221
+ // NumberField puts its `id` on the input; a hidden label names it (the popover's title shows it).
222
+ const id = React.useId();
223
+ return (_jsxs(_Fragment, { children: [_jsx("label", { htmlFor: id, className: "sr-only", children: field.label }), _jsx(NumberField, { id: id, size: "sm", steppers: "stacked", value: filter.value, onValueChange: (value) => onChange({ ...filter, value }), onKeyDown: (event) => event.key === "Enter" && onDone(), min: field.min, max: field.max, step: field.step, format: field.format, className: "w-full [&>[data-slot]]:w-full" })] }));
224
+ }
225
+ /** An ISO day as a local date, and back: the range is stored as text, the Calendar takes dates. */
226
+ const toDate = (iso) => {
227
+ if (!iso)
228
+ return undefined;
229
+ const [y, m, d] = iso.split("-").map(Number);
230
+ return new Date(y, m - 1, d);
231
+ };
232
+ const toIso = (date) => (date ? (isoDay(date) ?? undefined) : undefined);
233
+ function DateEditor({ field, filter, onChange }) {
234
+ const range = rangeOf(filter.value);
235
+ const set = (next) => onChange({ ...filter, value: { from: next.from || undefined, to: next.to || undefined } });
236
+ if (field.editor)
237
+ return _jsx(_Fragment, { children: field.editor({ value: range, onChange: set }) });
238
+ return (_jsx(Calendar, { mode: "range", defaultMonth: toDate(range.from ?? range.to), selected: { from: toDate(range.from), to: toDate(range.to) }, onSelect: (next) => set({ from: toIso(next?.from), to: toIso(next?.to) }), className: "p-0" }));
239
+ }
240
+ function Editor(props) {
241
+ const { field } = props;
242
+ if (field.kind === "select")
243
+ return _jsx(SelectEditor, { ...props, field: field });
244
+ if (field.kind === "text")
245
+ return _jsx(TextEditor, { ...props, field: field });
246
+ if (field.kind === "number")
247
+ return _jsx(NumberEditor, { ...props, field: field });
248
+ return _jsx(DateEditor, { ...props, field: field });
249
+ }
250
+ /**
251
+ * FilterBar — faceted filters above a list or a table: each applied filter is a raised chip
252
+ * ("Status is Active, Paused") that opens a popover to edit it, with × to remove it; "Filter"
253
+ * opens a menu of the fields to add one, and "Clear all" removes them all.
254
+ *
255
+ * It holds filters, not rows: filter your data with `matchesFilters` on the client, or send the
256
+ * value to a server. The rule people break: a filter bar for one or two fixed choices — that is a
257
+ * `ToggleGroup` or a `Select` beside the table, always visible.
258
+ */
259
+ export function FilterBar({ fields, value: valueProp, defaultValue = [], onValueChange, size = "sm", locale: localeProp, addLabel, labels, className, ...props }) {
260
+ const messages = useMessages("filterBar", defaultMessages, labels);
261
+ const providedLocale = useLocale();
262
+ const locale = localeProp ?? providedLocale;
263
+ const [inner, setInner] = React.useState(defaultValue);
264
+ const value = valueProp ?? inner;
265
+ const setValue = (next) => {
266
+ if (valueProp === undefined)
267
+ setInner(next);
268
+ onValueChange?.(next);
269
+ };
270
+ const [open, setOpen] = React.useState(null);
271
+ const pending = React.useRef(null);
272
+ const addRef = React.useRef(null);
273
+ // Scopes each chip's editor to this bar: two bars on a page may each filter a field of one id.
274
+ const uid = React.useId();
275
+ const editorKey = (field) => `${uid}:${field}`;
276
+ const fieldOf = (id) => fields.find((f) => f.id === id);
277
+ const update = (filter) => setValue(value.map((f) => (f.field === filter.field ? filter : f)));
278
+ const remove = (id) => {
279
+ setValue(value.filter((f) => f.field !== id));
280
+ addRef.current?.focus();
281
+ };
282
+ const add = (field) => {
283
+ if (!value.some((f) => f.field === field.id))
284
+ setValue([
285
+ ...value,
286
+ { field: field.id, operator: operators[field.kind][0].value, value: emptyValue(field.kind) },
287
+ ]);
288
+ // Open its editor once the menu has closed and handed the focus back.
289
+ pending.current = field.id;
290
+ };
291
+ const onOpenChange = (id, next) => {
292
+ setOpen(next ? id : null);
293
+ // A filter closed without a value is not kept.
294
+ const filter = value.find((f) => f.field === id);
295
+ if (!next && filter && isEmpty(filter))
296
+ setValue(value.filter((f) => f.field !== id));
297
+ };
298
+ const chipSize = size === "sm" ? "sm" : "default";
299
+ const applied = value.filter((f) => fieldOf(f.field));
300
+ return (_jsxs("div", { role: "group", "aria-label": messages.group, "data-slot": "filter-bar", "data-size": size, className: cn("flex flex-wrap items-center gap-2 font-body", className), ...props, children: [applied.map((filter) => {
301
+ const field = fieldOf(filter.field);
302
+ const text = describe(filter, field, messages, locale);
303
+ return (_jsxs(ButtonGroup, { "data-slot": "filter-bar-chip", "aria-label": messages.chip(field.label),
304
+ // In a narrow bar a long value ends in an ellipsis; the chip never runs past the bar.
305
+ className: "max-w-full min-w-0", children: [_jsxs(Popover, { open: open === filter.field, onOpenChange: (next) => onOpenChange(filter.field, next), children: [_jsxs(PopoverTrigger, { render: _jsx(Button, { variant: "secondary", size: chipSize }), "data-slot": "filter-bar-chip-trigger", className: "max-w-[22rem] min-w-0 shrink gap-1.5 font-normal", children: [_jsx("span", { className: "shrink-0 text-muted-foreground", children: field.label }), " ", text ? (_jsxs(_Fragment, { children: [text[0] && _jsx("span", { className: "shrink-0 text-muted-foreground", children: text[0] }), " ", _jsx("span", { className: "truncate font-medium text-foreground", children: text[1] })] })) : (_jsx("span", { className: "text-muted-foreground", children: "\u2026" }))] }), _jsxs(PopoverContent, { "data-slot": "filter-bar-editor", align: "start", sideOffset: 6, className: cn("gap-2 p-2", field.kind === "date" ? "w-auto" : "w-64"),
306
+ // Straight to the value — the search, the list, the text, the number, the calendar's
307
+ // day — not the condition.
308
+ initialFocus: () => {
309
+ const editor = `[data-filter-editor="${CSS.escape(editorKey(filter.field))}"]`;
310
+ return (document.querySelector(`${editor} input:not([type=hidden]), ${editor} [data-slot=calendar-day-button][tabindex="0"]`) ?? true);
311
+ },
312
+ // Back to the chip, or to "Filter" for a filter that is not kept — unless the focus
313
+ // has moved on: into another chip's editor, or to a field elsewhere that was clicked.
314
+ finalFocus: () => {
315
+ const active = document.activeElement;
316
+ const own = active
317
+ ?.closest('[data-slot="filter-bar-editor"]')
318
+ ?.querySelector(`[data-filter-editor="${CSS.escape(editorKey(filter.field))}"]`);
319
+ if (active && active !== document.body && !own)
320
+ return false;
321
+ return isEmpty(filter) ? addRef.current : true;
322
+ }, children: [_jsxs("div", { className: "flex min-h-(--control-h-sm) items-center justify-between gap-2 ps-1", children: [_jsx(PopoverTitle, { className: "eyebrow text-[11px]", children: field.label }), _jsx(OperatorSelect, { field: field, filter: filter, onChange: update, text: messages })] }), _jsx("div", { "data-filter-editor": editorKey(filter.field),
323
+ // The options scroll within 15rem, and within the room below the chip less the header.
324
+ className: "flex flex-col gap-1 [&_[data-slot=scroll-area]]:max-h-[min(15rem,calc(var(--available-height)-6rem))]", children: _jsx(Editor, { field: field, filter: filter, onChange: update, onDone: () => onOpenChange(filter.field, false), text: messages }) })] })] }), _jsx(Button, { variant: "secondary", size: chipSize, "data-slot": "filter-bar-chip-remove", "aria-label": messages.remove(field.label), onClick: () => remove(filter.field), className: cn("text-muted-foreground hover:text-foreground", size === "sm" ? "px-2" : "px-2.5"), children: _jsx(XIcon, { className: "size-3.5" }) })] }, filter.field));
325
+ }), _jsxs(Menu, { onOpenChangeComplete: (next) => {
326
+ if (next || !pending.current)
327
+ return;
328
+ setOpen(pending.current);
329
+ pending.current = null;
330
+ }, children: [_jsxs(MenuTrigger, { ref: addRef, render: _jsx(Button, { variant: "ghost", size: chipSize }), "data-slot": "filter-bar-add", className: "text-foreground-soft", children: [_jsx(PlusIcon, {}), addLabel ?? messages.add] }), _jsx(MenuContent, { className: "min-w-48", children: fields.map((field) => (_jsxs(MenuItem, { onClick: () => add(field), children: [field.icon, field.label] }, field.id))) })] }), applied.length > 0 && (_jsx(Button, { variant: "ghost", size: chipSize, "data-slot": "filter-bar-clear", onClick: () => {
331
+ setValue([]);
332
+ addRef.current?.focus();
333
+ }, className: "text-muted-foreground", children: messages.clearAll }))] }));
334
+ }
@@ -0,0 +1,35 @@
1
+ import { Form as BaseForm } from "@base-ui/react/form";
2
+ import * as React from "react";
3
+ /**
4
+ * Form — a native `<form>` that collects `Field` validation and shows server errors.
5
+ *
6
+ * Fields stack with 20px between them. Pass `errors` (keyed by each `Field`'s `name`) to show
7
+ * errors returned by the server, and use `onFormSubmit` to receive the values as an object.
8
+ * End the form with `FormActions`, which puts the submit button on the right.
9
+ * With React Hook Form or TanStack Form, pass the library's submit handler to `onSubmit` and each
10
+ * field's error to `Field error`: the library validates every submit, the Form lays it out.
11
+ * The rule people break: validating only on the server — add `required`, `type` and
12
+ * `pattern` to the controls so people see what is wrong before they submit.
13
+ */
14
+ export declare function Form<FormValues extends Record<string, any> = Record<string, any>>({ className, onSubmit, onSubmitCapture, ...props }: BaseForm.Props<FormValues>): React.JSX.Element;
15
+ declare const actionAlign: {
16
+ /** Actions on the right, the primary last. The default. */
17
+ readonly end: "justify-end";
18
+ /** A note or a quiet link on the left, the actions on the right. */
19
+ readonly between: "justify-between";
20
+ /** Actions on the left — only for forms that read as a single column of steps. */
21
+ readonly start: "justify-start";
22
+ };
23
+ export interface FormActionsProps extends React.ComponentProps<"div"> {
24
+ /** `end` (default) puts the actions on the right; `between` adds a note on the left. */
25
+ align?: keyof typeof actionAlign;
26
+ }
27
+ /**
28
+ * FormActions — the footer row of a form: the submit button on the right, any secondary
29
+ * action (Cancel, Back) to its left, and with `align="between"` a short note at the start.
30
+ * It sits 8px further from the last field than the fields sit from each other.
31
+ *
32
+ * The rule people break: more than one primary — Cancel and Back are `secondary` or `ghost`.
33
+ */
34
+ export declare function FormActions({ align, className, ...props }: FormActionsProps): React.JSX.Element;
35
+ export {};
@@ -0,0 +1,56 @@
1
+ "use client";
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import { Form as BaseForm } from "@base-ui/react/form";
4
+ import * as React from "react";
5
+ import { cn, sx } from "../lib/cn.js";
6
+ import { LibraryErrorsContext } from "../lib/field-errors.js";
7
+ /**
8
+ * Form — a native `<form>` that collects `Field` validation and shows server errors.
9
+ *
10
+ * Fields stack with 20px between them. Pass `errors` (keyed by each `Field`'s `name`) to show
11
+ * errors returned by the server, and use `onFormSubmit` to receive the values as an object.
12
+ * End the form with `FormActions`, which puts the submit button on the right.
13
+ * With React Hook Form or TanStack Form, pass the library's submit handler to `onSubmit` and each
14
+ * field's error to `Field error`: the library validates every submit, the Form lays it out.
15
+ * The rule people break: validating only on the server — add `required`, `type` and
16
+ * `pattern` to the controls so people see what is wrong before they submit.
17
+ */
18
+ export function Form({ className, onSubmit, onSubmitCapture, ...props }) {
19
+ /*
20
+ * Base UI stops a submit while a field is marked invalid, before `onSubmit` runs. A field marked
21
+ * by a library (`Field error`) could then stay so: the library never sees the submit that would
22
+ * check it again (React Hook Form checks an error that depends on another field only then). While
23
+ * any field shows such an error, the submit goes to `onSubmit` first, and the library decides.
24
+ */
25
+ const [libraryErrors] = React.useState(() => new Set());
26
+ const handled = React.useRef(false);
27
+ return (_jsx(LibraryErrorsContext.Provider, { value: libraryErrors, children: _jsx(BaseForm, { "data-slot": "form", className: sx("flex flex-col gap-5", className), onSubmitCapture: (event) => {
28
+ onSubmitCapture?.(event);
29
+ handled.current = !!onSubmit && libraryErrors.size > 0;
30
+ if (handled.current)
31
+ onSubmit?.(event);
32
+ }, onSubmit: (event) => {
33
+ if (handled.current)
34
+ handled.current = false;
35
+ else
36
+ onSubmit?.(event);
37
+ }, ...props }) }));
38
+ }
39
+ const actionAlign = {
40
+ /** Actions on the right, the primary last. The default. */
41
+ end: "justify-end",
42
+ /** A note or a quiet link on the left, the actions on the right. */
43
+ between: "justify-between",
44
+ /** Actions on the left — only for forms that read as a single column of steps. */
45
+ start: "justify-start",
46
+ };
47
+ /**
48
+ * FormActions — the footer row of a form: the submit button on the right, any secondary
49
+ * action (Cancel, Back) to its left, and with `align="between"` a short note at the start.
50
+ * It sits 8px further from the last field than the fields sit from each other.
51
+ *
52
+ * The rule people break: more than one primary — Cancel and Back are `secondary` or `ghost`.
53
+ */
54
+ export function FormActions({ align = "end", className, ...props }) {
55
+ return (_jsx("div", { "data-slot": "form-actions", "data-align": align, className: cn("flex flex-wrap items-center gap-3 pt-2", actionAlign[align], className), ...props }));
56
+ }
@@ -0,0 +1,146 @@
1
+ import * as React from "react";
2
+ import { type LayoutDirection } from "../lib/graph-layout.js";
3
+ /**
4
+ * What a node is, and so how it is drawn:
5
+ * - flows (BPMN): `task`, `start`, `end`, `event` (intermediate), `gateway`, `note` (annotation);
6
+ * - relations and trees: `person` (an avatar), `entity` (a pill: a show, a topic, a system);
7
+ * - `group`: a lane or a cluster that holds other nodes (`parent`).
8
+ */
9
+ export type GraphNodeKind = "task" | "start" | "end" | "event" | "gateway" | "note" | "person" | "entity" | "group";
10
+ export interface GraphNode {
11
+ id: string;
12
+ label: string;
13
+ /** Default `task`, or `entity` in a network. */
14
+ kind?: GraphNodeKind;
15
+ /** A second line under the label (tasks, people): a role, an owner, a duration. Mono. */
16
+ meta?: string;
17
+ /** A lucide icon before the label (tasks, entities). */
18
+ icon?: React.ReactNode;
19
+ /** A person's photo. Without it, their initials. */
20
+ image?: string;
21
+ /** Gateways: `exclusive` ×, `parallel` +, `inclusive` ○. Default `exclusive`. */
22
+ gateway?: "exclusive" | "parallel" | "inclusive";
23
+ /** The group this node sits in (flows and trees). */
24
+ parent?: string;
25
+ /**
26
+ * Where the node stands (top left). Pass positions for every node to keep them; leave them out
27
+ * to lay the graph out. Inside a group, relative to the group.
28
+ */
29
+ position?: {
30
+ x: number;
31
+ y: number;
32
+ };
33
+ /** A group's size, when it is positioned by hand. */
34
+ size?: {
35
+ width: number;
36
+ height: number;
37
+ };
38
+ }
39
+ /**
40
+ * A connection: `flow` (sequence, an arrow), `message` (dashed, an arrow), `association`
41
+ * (dotted, no arrow) or `relation` (a plain link, the network default).
42
+ */
43
+ export type GraphEdgeKind = "flow" | "message" | "association" | "relation";
44
+ export interface GraphEdge {
45
+ id?: string;
46
+ source: string;
47
+ target: string;
48
+ label?: string;
49
+ /** Default `flow`, or `relation` in a network. */
50
+ kind?: GraphEdgeKind;
51
+ /** An arrowhead at the target. Default: on for flows and messages, off otherwise. */
52
+ directed?: boolean;
53
+ /** Dashes travel along the edge: something moving through it now. Still under reduced motion. */
54
+ animated?: boolean;
55
+ }
56
+ export interface GraphValue {
57
+ nodes: GraphNode[];
58
+ edges: GraphEdge[];
59
+ }
60
+ /** `flow`: layered along `direction`. `tree`: tiers from the root. `network`: forces. `none`: as positioned. */
61
+ export type GraphLayout = "flow" | "tree" | "network" | "none";
62
+ export interface GraphMessages {
63
+ /** The text field that renames a node, or a connection. */
64
+ nodeLabel: string;
65
+ edgeLabel: string;
66
+ /** What a new node of each kind is called until it is renamed. */
67
+ newNode: (kind: GraphNodeKind) => string;
68
+ /** A kind of node in the canvas menu's "Add here" list. */
69
+ kind: (kind: GraphNodeKind) => string;
70
+ addHere: string;
71
+ tidy: string;
72
+ fit: string;
73
+ zoomIn: string;
74
+ zoomOut: string;
75
+ addNode: string;
76
+ rename: string;
77
+ delete: string;
78
+ renameLabel: string;
79
+ addLabel: string;
80
+ reverse: string;
81
+ removeConnection: string;
82
+ /** The keys the menu shows beside Rename and Delete. */
83
+ enterKey: string;
84
+ deleteKey: string;
85
+ /** A connection as text, for screen readers: "Review to Ship: approved". */
86
+ connection: (from: string, to: string, directed: boolean) => string;
87
+ /** The controls' toolbar and the minimap. */
88
+ controls: string;
89
+ minimap: string;
90
+ /** What React Flow tells a screen reader on a focused node, edge or handle, and after a move. */
91
+ nodeHelp: string;
92
+ edgeHelp: string;
93
+ handle: string;
94
+ moved: (direction: string, x: number, y: number) => string;
95
+ }
96
+ declare module "./locale" {
97
+ interface Messages {
98
+ graph: GraphMessages;
99
+ }
100
+ }
101
+ export interface GraphProps extends Omit<React.ComponentProps<"div">, "onChange" | "onSelect" | "children"> {
102
+ nodes: GraphNode[];
103
+ edges: GraphEdge[];
104
+ /** How the graph is arranged. Default `flow`. */
105
+ layout?: GraphLayout;
106
+ /** Flows and trees: the direction they read in. Default `right` for flows, `down` for trees. */
107
+ direction?: LayoutDirection;
108
+ /**
109
+ * Edit the graph: connect nodes from their handles, and right-click (or long-press) the canvas,
110
+ * a node or a connection for what you can do there — add, rename, reverse, remove. Enter
111
+ * renames the focused node; Delete removes what is selected.
112
+ */
113
+ editable?: boolean;
114
+ /** Called with the graph after each change: a move, a connection, a rename, a removal. */
115
+ onChange?: (value: GraphValue) => void;
116
+ /** Called with the ids of the selected nodes and edges. */
117
+ onSelect?: (selection: {
118
+ nodes: string[];
119
+ edges: string[];
120
+ }) => void;
121
+ /** The kind of node the "Add a node" control adds. Default `task`, or `entity` in a network. */
122
+ newNodeKind?: GraphNodeKind;
123
+ /** A small map of the whole graph, bottom right. */
124
+ minimap?: boolean;
125
+ /** The zoom and fit controls (and, editable, add and tidy). Default `true`. */
126
+ controls?: boolean;
127
+ /** The canvas pattern. Default `dots`. */
128
+ background?: "dots" | "lines" | "none";
129
+ /** `region` (default): a square surface; `card`: the 20px object. */
130
+ variant?: "region" | "card";
131
+ /** The editor's and the controls' words; a LocaleProvider sets them for every Graph. */
132
+ labels?: Partial<GraphMessages>;
133
+ }
134
+ /**
135
+ * Graph — things and how they connect, on a canvas that pans and zooms: a flow of steps (BPMN
136
+ * tasks, events and gateways), an org chart or tree, or a network of relations (people, shows,
137
+ * systems). Pass `nodes` and `edges`; the layout places them — layered for flows and trees, by
138
+ * forces for networks — or keeps the positions you give.
139
+ *
140
+ * Hover or select a node to light up its connections. In a network, drag a node and its
141
+ * neighbours follow. With `editable`, it is a small diagram editor that reports every change
142
+ * through `onChange`. It needs `@xyflow/react`, `@dagrejs/dagre` and `d3-force`, and is
143
+ * imported from `@zonsh/ui/graph`. The rule people break: a hairball. Past a few dozen nodes,
144
+ * show a part of the graph, or group it.
145
+ */
146
+ export declare function Graph(props: GraphProps): React.JSX.Element;