@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,160 @@
1
+ import * as React from "react";
2
+ import type { DateRange, DayPickerLocale, PropsBase } from "react-day-picker";
3
+ import { type CalendarProps } from "./calendar.js";
4
+ import { type PopoverContentProps } from "./popover.js";
5
+ export interface DatePickerMessages {
6
+ /** DatePicker's trigger while no date is picked. */
7
+ placeholder: string;
8
+ /** DateRangePicker's trigger while no range is picked. */
9
+ rangePlaceholder: string;
10
+ }
11
+ declare module "./locale" {
12
+ interface Messages {
13
+ datePicker: DatePickerMessages;
14
+ }
15
+ }
16
+ declare const triggerSizes: {
17
+ readonly sm: "min-h-(--control-h-sm) gap-2 px-2.5 text-[13px] [&_svg]:size-3.5";
18
+ readonly default: "min-h-(--control-h) gap-3 pe-3 ps-3.5 text-[15px] [&_svg]:size-4";
19
+ };
20
+ /** Calendar props a picker passes through: `disabled` days, `captionLayout` + `dropdown`, `startMonth`, `weekStartsOn` … */
21
+ export type DatePickerCalendarProps = Pick<CalendarProps, "dropdown"> & Omit<PropsBase, "mode" | "required" | "locale" | "month" | "defaultMonth" | "onMonthChange">;
22
+ interface PickerBaseProps {
23
+ /** Shown while no date is picked. Default `messages.datePicker.placeholder` (`rangePlaceholder`). */
24
+ placeholder?: string;
25
+ /**
26
+ * A date-fns locale (or one from `react-day-picker/locale`, which also translates labels). A
27
+ * LocaleProvider does not set it: pass the date-fns locale for the provider's language.
28
+ */
29
+ locale?: DayPickerLocale;
30
+ /** A date-fns format string for the trigger. Default `"PP"`: "Oct 5, 2026", "05.10.2026". */
31
+ format?: string;
32
+ /** `sm` (30px) for dense surfaces; `default` (38px) everywhere else. */
33
+ size?: keyof typeof triggerSizes;
34
+ disabled?: boolean;
35
+ /**
36
+ * A date must be picked (a range: both its ends): until it is, the picker is `valueMissing`,
37
+ * which stops a form's submit and marks the `Field` invalid.
38
+ */
39
+ required?: boolean;
40
+ /** Submits the value as an ISO date (`2026-10-05`) in a hidden input. Default: the `Field`'s name. */
41
+ name?: string;
42
+ id?: string;
43
+ /** Controlled open state. */
44
+ open?: boolean;
45
+ defaultOpen?: boolean;
46
+ onOpenChange?: (open: boolean) => void;
47
+ /** Classes for the trigger. */
48
+ className?: string;
49
+ /** Props forwarded to the `Calendar`. */
50
+ calendar?: DatePickerCalendarProps;
51
+ /** Props for the popover panel: `side`, `align`, `className` … */
52
+ popover?: Omit<PopoverContentProps, "children">;
53
+ "aria-label"?: string;
54
+ "aria-labelledby"?: string;
55
+ "aria-describedby"?: string;
56
+ /** The trigger: what a form library focuses to show an error (React Hook Form's `field.ref`). */
57
+ ref?: React.Ref<HTMLButtonElement>;
58
+ /** Called when focus leaves the picker — its trigger and calendar — as a form library's `onBlur`. */
59
+ onBlur?: () => void;
60
+ }
61
+ export interface DatePickerPreset {
62
+ label: string;
63
+ value: Date;
64
+ }
65
+ export interface DatePickerProps extends PickerBaseProps {
66
+ /** The picked date. `null` is empty; leave `undefined` for an uncontrolled picker. */
67
+ value?: Date | null;
68
+ defaultValue?: Date | null;
69
+ onValueChange?: (value: Date | null) => void;
70
+ /** Quick picks shown in a column beside the calendar ("Today", "In a week" …). */
71
+ presets?: DatePickerPreset[];
72
+ /** Close the popover once a day is picked. Default `true`. */
73
+ closeOnSelect?: boolean;
74
+ }
75
+ /**
76
+ * DatePicker — a trigger like a `Select` trigger, with a calendar icon and the formatted date
77
+ * or a placeholder, that opens a popover holding a `Calendar`. Optional presets sit in a
78
+ * column beside it. Controlled (`value` + `onValueChange`) or uncontrolled (`defaultValue`).
79
+ *
80
+ * The rule people break: a picker for dates people know by heart (a birthday, a passport's
81
+ * date of issue). Those are faster typed into an `Input`.
82
+ */
83
+ export declare function DatePicker({ value: valueProp, defaultValue, onValueChange, presets, closeOnSelect, placeholder, locale, format, name, open: openProp, defaultOpen, onOpenChange, calendar, popover, ref, ...trigger }: DatePickerProps): React.JSX.Element;
84
+ export interface DateRangePickerPreset {
85
+ label: string;
86
+ value: DateRange;
87
+ }
88
+ export interface DateRangePickerProps extends PickerBaseProps {
89
+ /** The picked range. `null` is empty; leave `undefined` for an uncontrolled picker. */
90
+ value?: DateRange | null;
91
+ defaultValue?: DateRange | null;
92
+ onValueChange?: (value: DateRange | null) => void;
93
+ /** Quick picks shown in a column beside the calendars ("Last 7 days", "This month" …). */
94
+ presets?: DateRangePickerPreset[];
95
+ /**
96
+ * Months shown side by side. Default `2`. With less than 640px of room around the field (a
97
+ * phone, a side panel) the picker shows one month: two stacked would be taller than a phone.
98
+ */
99
+ numberOfMonths?: number;
100
+ }
101
+ /**
102
+ * DateRangePicker — the same trigger showing "from – to", opening two months side by side
103
+ * (one in a narrow space).
104
+ * The popover stays open while the range is adjusted; it closes on a preset, Escape or an
105
+ * outside click. With `name`, submits an ISO 8601 interval (`2026-10-05/2026-10-12`) once both
106
+ * ends are picked.
107
+ */
108
+ export declare function DateRangePicker({ value: valueProp, defaultValue, onValueChange, presets, numberOfMonths, placeholder, locale, format, name, open: openProp, defaultOpen, onOpenChange, calendar, popover, ref, ...trigger }: DateRangePickerProps): React.JSX.Element;
109
+ export interface DateTimePickerMessages {
110
+ /** The trigger's text while no date is picked. */
111
+ placeholder: string;
112
+ /** The label of the time field under the calendar. */
113
+ time: string;
114
+ }
115
+ declare module "./locale" {
116
+ interface Messages {
117
+ dateTimePicker: DateTimePickerMessages;
118
+ }
119
+ }
120
+ export interface DateTimePickerProps extends Omit<PickerBaseProps, "format" | "placeholder"> {
121
+ /** The picked moment. `null` is empty; leave `undefined` for an uncontrolled picker. */
122
+ value?: Date | null;
123
+ defaultValue?: Date | null;
124
+ /**
125
+ * Called with the date at the picked time once both are there, and with `null` when either is
126
+ * cleared — as a native `datetime-local` input has no value until it is whole.
127
+ */
128
+ onValueChange?: (value: Date | null) => void;
129
+ /** The earliest moment. Days before it can't be picked, and on its day the time can't go earlier. */
130
+ min?: Date;
131
+ /** The latest moment. */
132
+ max?: Date;
133
+ /** `12` or `24` hours, in the field and on the trigger. Default: the locale's own clock. */
134
+ hourCycle?: 12 | 24;
135
+ /** Minutes moved by one arrow press in the time field: `15` for quarter hours. */
136
+ step?: number;
137
+ /**
138
+ * The time a picked day takes while none is set yet, `"HH:mm"` — `"09:00"` for a meeting. Without
139
+ * one, the time field waits to be filled and the picker has no value until it is.
140
+ */
141
+ defaultTime?: string;
142
+ /** `Intl.DateTimeFormat` options for the trigger. Default `{ dateStyle: "medium", timeStyle: "short" }`. */
143
+ format?: Intl.DateTimeFormatOptions;
144
+ /** Shown while no date is picked. Default from the locale messages: "Pick a date and time". */
145
+ placeholder?: string;
146
+ /** Interface text; a LocaleProvider sets it for every DateTimePicker. */
147
+ labels?: Partial<DateTimePickerMessages>;
148
+ }
149
+ /**
150
+ * DateTimePicker — a date and a time of day in one field: the DatePicker's trigger showing the
151
+ * moment formatted for the locale ("Oct 5, 2026, 2:30 PM", "05.10.2026, 14:30"), opening a
152
+ * `Calendar` with a `TimeField` under it. Picking a day keeps the time, and moves on to the time
153
+ * while it is empty; Enter in the time field closes the popover.
154
+ *
155
+ * The value is a `Date`, in local time; a form gets it as `2026-10-05T14:30`. The rule people
156
+ * break: a date and time for something that lasts all day (a deadline, a holiday). That is a
157
+ * `DatePicker`.
158
+ */
159
+ export declare function DateTimePicker({ value: valueProp, defaultValue, onValueChange, min, max, hourCycle, step, defaultTime, format, placeholder, locale, name, open: openProp, defaultOpen, onOpenChange, calendar, popover, labels, ref, ...trigger }: DateTimePickerProps): React.JSX.Element;
160
+ export {};
@@ -0,0 +1,338 @@
1
+ "use client";
2
+ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { Field as BaseField } from "@base-ui/react/field";
4
+ import { format as formatDate, formatISO, isSameDay } from "date-fns";
5
+ import { CalendarIcon } from "lucide-react";
6
+ import * as React from "react";
7
+ import { cn, sx } from "../lib/cn.js";
8
+ import { mergeRefs } from "../lib/merge-refs.js";
9
+ import { roomOf } from "../lib/room.js";
10
+ import { Calendar } from "./calendar.js";
11
+ import { useLocale, useMessages } from "./locale.js";
12
+ import { Popover, PopoverContent, PopoverTrigger } from "./popover.js";
13
+ import { TimeField } from "./time-field.js";
14
+ const defaultMessages = {
15
+ placeholder: "Pick a date",
16
+ rangePlaceholder: "Pick a date range",
17
+ };
18
+ /* ── Shared pieces ─────────────────────────────────────────────────────────── */
19
+ const triggerSizes = {
20
+ sm: "min-h-(--control-h-sm) gap-2 px-2.5 text-[13px] [&_svg]:size-3.5",
21
+ default: "min-h-(--control-h) gap-3 pe-3 ps-3.5 text-[15px] [&_svg]:size-4",
22
+ };
23
+ function useControllable(value, defaultValue) {
24
+ const [inner, setInner] = React.useState(defaultValue);
25
+ const controlled = value !== undefined;
26
+ const current = controlled ? value : inner;
27
+ const set = React.useCallback((next) => {
28
+ if (!controlled)
29
+ setInner(next);
30
+ }, [controlled]);
31
+ return [current, set];
32
+ }
33
+ /** The popup of a picker: focus moving into it hasn't left the field. */
34
+ const PICKER_POPUP = '[data-slot="date-picker-content"], [data-slot="date-range-picker-content"], [data-slot="date-time-picker-content"]';
35
+ /**
36
+ * The trigger looks like a Select trigger with a calendar for its indicator. It is what the Field's
37
+ * label names and `Field invalid` marks; its name is the label and the value, so the date is read
38
+ * out with it.
39
+ *
40
+ * The value is the Field's own input's, out of sight beside the trigger, as in Base UI's Select: a
41
+ * native form submits it under the picker's name (or the Field's), a `Form` reads it for
42
+ * `onFormSubmit`, and its `required` blocks a submit while it is empty. A submit that finds it so
43
+ * focuses it, and it hands focus on to the trigger.
44
+ */
45
+ function PickerTrigger({ slot, size = "default", empty, value, name, required, className, children, ref, leaveRef, onBlur, ...props }) {
46
+ const valueId = React.useId();
47
+ const trigger = React.useRef(null);
48
+ const refs = React.useMemo(() => mergeRefs(trigger, ref), [ref]);
49
+ const fieldInput = React.useRef(null);
50
+ return (_jsxs(BaseField.Control, { ref: fieldInput, "data-slot": slot, "data-size": size, "data-placeholder": empty || undefined, value: value, name: name, render: (control) => {
51
+ const { ref: fieldRef, name: formName, value: formValue, onChange: fieldChange, onBlur: fieldBlur, ...button } = control;
52
+ const labelledBy = button["aria-labelledby"] ?? (button["aria-label"] ? button.id : undefined);
53
+ // The Field validates the value in its input.
54
+ leaveRef.current = () => {
55
+ if (fieldInput.current)
56
+ fieldBlur?.({ currentTarget: fieldInput.current });
57
+ onBlur?.();
58
+ };
59
+ return (_jsxs(_Fragment, { children: [_jsx(PopoverTrigger, { ...button, ref: refs, "aria-labelledby": labelledBy ? `${labelledBy} ${valueId}` : undefined, onBlur: (event) => {
60
+ if (!event.relatedTarget?.closest(PICKER_POPUP))
61
+ leaveRef.current();
62
+ } }), _jsx("input", { ref: fieldRef, name: formName, value: formValue ?? "", onChange: fieldChange, required: required, disabled: button.disabled, "aria-hidden": true, tabIndex: -1, autoComplete: "off", onFocus: () => trigger.current?.focus(), className: "sr-only" })] }));
63
+ }, className: cn("group/trigger inline-flex w-full min-w-40 material-field cursor-pointer items-center justify-between rounded-control text-start font-body leading-none whitespace-nowrap outline-none select-none", "disabled:cursor-not-allowed", triggerSizes[size], className), ...props, children: [_jsx("span", { id: valueId, "data-slot": `${slot}-value`, className: cn("truncate tabular-nums", empty && "text-control-muted"), children: children }), _jsx(CalendarIcon, { "aria-hidden": true, className: "shrink-0 text-muted-foreground transition-colors duration-(--duration) ease-brand group-hover/trigger:not-group-data-disabled/trigger:text-foreground" })] }));
64
+ }
65
+ /** Below this much room around the field, the pickers lay out for a narrow space. */
66
+ const NARROW_ROOM = 640;
67
+ /**
68
+ * Whether the room around the field — its nearest scrolling ancestor (a scrolling panel, a
69
+ * dialog body), or the window — is narrow, following its width as it changes so a picker adapts
70
+ * as a panel is resized. (The popover keeps inside the same room through PopoverContent.)
71
+ */
72
+ function useRoom(ref) {
73
+ const [room, setRoom] = React.useState(null);
74
+ React.useLayoutEffect(() => {
75
+ const el = ref.current;
76
+ if (!el)
77
+ return;
78
+ const box = roomOf(el);
79
+ const measure = () => setRoom(box ? box.clientWidth : window.innerWidth);
80
+ measure();
81
+ if (box) {
82
+ const observer = new ResizeObserver(measure);
83
+ observer.observe(box);
84
+ return () => observer.disconnect();
85
+ }
86
+ window.addEventListener("resize", measure);
87
+ return () => window.removeEventListener("resize", measure);
88
+ }, [ref]);
89
+ return room != null && room < NARROW_ROOM;
90
+ }
91
+ function PresetList({ slot, items, narrow }) {
92
+ return (_jsx("div", { "data-slot": slot, className: cn("flex gap-0.5 border-border/60 p-2", narrow ? "flex-row flex-wrap border-b" : "w-40 flex-col flex-nowrap border-e"), children: items.map((item) => (_jsx("button", { type: "button", "data-slot": "date-picker-preset", "data-current": item.current || undefined, "aria-pressed": item.current, onClick: item.onSelect, className: "inline-flex min-h-(--control-h) cursor-pointer items-center rounded-item material-row px-2.5 text-start font-body text-sm whitespace-nowrap focus-ring", children: item.label }, item.label))) }));
93
+ }
94
+ const panelClassName = "w-auto max-w-(--available-width) gap-0 overflow-hidden p-0";
95
+ /** A form's reset calls `reset`, which puts back the value an uncontrolled picker started with. */
96
+ function useFormReset(trigger, reset) {
97
+ const latest = React.useRef(reset);
98
+ latest.current = reset;
99
+ React.useEffect(() => {
100
+ const form = trigger.current?.form;
101
+ if (!form)
102
+ return;
103
+ const onReset = () => latest.current();
104
+ form.addEventListener("reset", onReset);
105
+ return () => form.removeEventListener("reset", onReset);
106
+ }, [trigger]);
107
+ }
108
+ const isoDate = (date) => formatISO(date, { representation: "date" });
109
+ /**
110
+ * When focus leaves a picker, for a Field that validates on blur: the trigger reports focus going
111
+ * anywhere but into the popup (see PickerTrigger), the popup focus going anywhere but the trigger.
112
+ */
113
+ function usePickerLeave(trigger, onBlur) {
114
+ const leaveRef = React.useRef(() => { });
115
+ const popupBlur = (event) => {
116
+ onBlur?.(event);
117
+ const to = event.relatedTarget;
118
+ if (!event.currentTarget.contains(to) && to !== trigger.current)
119
+ leaveRef.current();
120
+ };
121
+ return { leaveRef, popupBlur };
122
+ }
123
+ /**
124
+ * DatePicker — a trigger like a `Select` trigger, with a calendar icon and the formatted date
125
+ * or a placeholder, that opens a popover holding a `Calendar`. Optional presets sit in a
126
+ * column beside it. Controlled (`value` + `onValueChange`) or uncontrolled (`defaultValue`).
127
+ *
128
+ * The rule people break: a picker for dates people know by heart (a birthday, a passport's
129
+ * date of issue). Those are faster typed into an `Input`.
130
+ */
131
+ export function DatePicker({ value: valueProp, defaultValue = null, onValueChange, presets, closeOnSelect = true, placeholder, locale, format = "PP", name, open: openProp, defaultOpen = false, onOpenChange, calendar, popover, ref, ...trigger }) {
132
+ const text = useMessages("datePicker", defaultMessages);
133
+ const [value, setValue] = useControllable(valueProp, defaultValue);
134
+ const triggerRef = React.useRef(null);
135
+ const triggerRefs = React.useMemo(() => mergeRefs(triggerRef, ref), [ref]);
136
+ const narrow = useRoom(triggerRef);
137
+ const [open, setOpen] = useControllable(openProp, defaultOpen);
138
+ const [month, setMonth] = React.useState(() => value ?? new Date());
139
+ useFormReset(triggerRef, () => setValue(defaultValue));
140
+ const leave = usePickerLeave(triggerRef, popover?.onBlur);
141
+ const commit = (next) => {
142
+ setValue(next);
143
+ onValueChange?.(next);
144
+ };
145
+ const changeOpen = (next) => {
146
+ if (next)
147
+ setMonth(value ?? new Date());
148
+ setOpen(next);
149
+ onOpenChange?.(next);
150
+ };
151
+ return (_jsxs(Popover, { open: open, onOpenChange: (next) => changeOpen(next), children: [_jsx(PickerTrigger, { slot: "date-picker-trigger", empty: !value, value: value ? isoDate(value) : "", name: name, ...trigger, ref: triggerRefs, leaveRef: leave.leaveRef, children: value ? formatDate(value, format, { locale }) : (placeholder ?? text.placeholder) }), _jsx(PopoverContent, { align: "start", ...popover, "data-slot": "date-picker-content", className: sx(panelClassName, popover?.className), onBlur: leave.popupBlur, children: _jsxs("div", { className: cn("flex", narrow ? "flex-col" : "flex-row"), children: [presets && presets.length > 0 && (_jsx(PresetList, { slot: "date-picker-presets", narrow: narrow, items: presets.map((preset) => ({
152
+ label: preset.label,
153
+ current: !!value && isSameDay(value, preset.value),
154
+ onSelect: () => {
155
+ commit(preset.value);
156
+ setMonth(preset.value);
157
+ if (closeOnSelect)
158
+ changeOpen(false);
159
+ },
160
+ })) })), _jsx(Calendar, { autoFocus: true, ...calendar, mode: "single", required: true, locale: locale, selected: value ?? undefined, onSelect: (next) => {
161
+ commit(next ?? null);
162
+ if (closeOnSelect)
163
+ changeOpen(false);
164
+ }, month: month, onMonthChange: setMonth })] }) })] }));
165
+ }
166
+ /**
167
+ * DateRangePicker — the same trigger showing "from – to", opening two months side by side
168
+ * (one in a narrow space).
169
+ * The popover stays open while the range is adjusted; it closes on a preset, Escape or an
170
+ * outside click. With `name`, submits an ISO 8601 interval (`2026-10-05/2026-10-12`) once both
171
+ * ends are picked.
172
+ */
173
+ export function DateRangePicker({ value: valueProp, defaultValue = null, onValueChange, presets, numberOfMonths = 2, placeholder, locale, format = "PP", name, open: openProp, defaultOpen = false, onOpenChange, calendar, popover, ref, ...trigger }) {
174
+ const text = useMessages("datePicker", defaultMessages);
175
+ const [value, setValue] = useControllable(valueProp, defaultValue);
176
+ const [open, setOpen] = useControllable(openProp, defaultOpen);
177
+ const [month, setMonth] = React.useState(() => value?.from ?? new Date());
178
+ const triggerRef = React.useRef(null);
179
+ const triggerRefs = React.useMemo(() => mergeRefs(triggerRef, ref), [ref]);
180
+ const narrow = useRoom(triggerRef);
181
+ const months = narrow ? 1 : numberOfMonths;
182
+ useFormReset(triggerRef, () => setValue(defaultValue));
183
+ const leave = usePickerLeave(triggerRef, popover?.onBlur);
184
+ const commit = (next) => {
185
+ setValue(next);
186
+ onValueChange?.(next);
187
+ };
188
+ const changeOpen = (next) => {
189
+ if (next)
190
+ setMonth(value?.from ?? new Date());
191
+ setOpen(next);
192
+ onOpenChange?.(next);
193
+ };
194
+ const from = value?.from;
195
+ const to = value?.to;
196
+ const label = from
197
+ ? `${formatDate(from, format, { locale })} – ${to ? formatDate(to, format, { locale }) : ""}`.trim()
198
+ : (placeholder ?? text.rangePlaceholder);
199
+ return (_jsxs(Popover, { open: open, onOpenChange: (next) => changeOpen(next), children: [_jsx(PickerTrigger, { slot: "date-range-picker-trigger", empty: !from,
200
+ // A range is a value once both its ends are picked: until then a form gets nothing.
201
+ value: from && to ? `${isoDate(from)}/${isoDate(to)}` : "", name: name, ...trigger, ref: triggerRefs, leaveRef: leave.leaveRef, children: label }), _jsx(PopoverContent, { align: "start", ...popover, "data-slot": "date-range-picker-content", className: sx(panelClassName, popover?.className), onBlur: leave.popupBlur, children: _jsxs("div", { className: cn("flex", narrow ? "flex-col" : "flex-row"), children: [presets && presets.length > 0 && (_jsx(PresetList, { slot: "date-range-picker-presets", narrow: narrow, items: presets.map((preset) => ({
202
+ label: preset.label,
203
+ current: !!from &&
204
+ !!to &&
205
+ !!preset.value.from &&
206
+ !!preset.value.to &&
207
+ isSameDay(from, preset.value.from) &&
208
+ isSameDay(to, preset.value.to),
209
+ onSelect: () => {
210
+ commit(preset.value);
211
+ if (preset.value.from)
212
+ setMonth(preset.value.from);
213
+ changeOpen(false);
214
+ },
215
+ })) })), _jsx(Calendar, { autoFocus: true,
216
+ // Side by side, outside days would show the same dates twice.
217
+ showOutsideDays: months === 1, ...calendar, mode: "range", locale: locale, numberOfMonths: months, selected: value ?? undefined, onSelect: (next) => commit(next ?? null), month: month, onMonthChange: setMonth })] }) })] }));
218
+ }
219
+ const defaultDateTimeMessages = {
220
+ placeholder: "Pick a date and time",
221
+ time: "Time",
222
+ };
223
+ const pad2 = (n) => String(n).padStart(2, "0");
224
+ /** A date's time of day as the TimeField's `"HH:mm"`. */
225
+ const timeOf = (date) => `${pad2(date.getHours())}:${pad2(date.getMinutes())}`;
226
+ /** The day of `day` at `time` ("HH:mm"), local time. */
227
+ const atTime = (day, time) => {
228
+ const [h = 0, m = 0] = time.split(":").map(Number);
229
+ const next = new Date(day);
230
+ next.setHours(h, m, 0, 0);
231
+ return next;
232
+ };
233
+ const startOfDayOf = (date) => {
234
+ const next = new Date(date);
235
+ next.setHours(0, 0, 0, 0);
236
+ return next;
237
+ };
238
+ /** A local date-time as a form gets it from a native `datetime-local` input: `2026-10-05T14:30`. */
239
+ const isoLocal = (date) => `${isoDate(date)}T${timeOf(date)}`;
240
+ const timeValue = (date) => date?.getTime() ?? null;
241
+ const noSubscribe = () => () => { };
242
+ /**
243
+ * DateTimePicker — a date and a time of day in one field: the DatePicker's trigger showing the
244
+ * moment formatted for the locale ("Oct 5, 2026, 2:30 PM", "05.10.2026, 14:30"), opening a
245
+ * `Calendar` with a `TimeField` under it. Picking a day keeps the time, and moves on to the time
246
+ * while it is empty; Enter in the time field closes the popover.
247
+ *
248
+ * The value is a `Date`, in local time; a form gets it as `2026-10-05T14:30`. The rule people
249
+ * break: a date and time for something that lasts all day (a deadline, a holiday). That is a
250
+ * `DatePicker`.
251
+ */
252
+ export function DateTimePicker({ value: valueProp, defaultValue = null, onValueChange, min, max, hourCycle, step, defaultTime, format, placeholder, locale, name, open: openProp, defaultOpen = false, onOpenChange, calendar, popover, labels, ref, ...trigger }) {
253
+ const text = useMessages("dateTimePicker", defaultDateTimeMessages, labels);
254
+ const [value, setValue] = useControllable(valueProp, defaultValue);
255
+ const [open, setOpen] = useControllable(openProp, defaultOpen);
256
+ const triggerRef = React.useRef(null);
257
+ const triggerRefs = React.useMemo(() => mergeRefs(triggerRef, ref), [ref]);
258
+ const timeRef = React.useRef(null);
259
+ const leave = usePickerLeave(triggerRef, popover?.onBlur);
260
+ // Formatted for the date-fns locale passed in, or the LocaleProvider's; without either, the
261
+ // browser's — which a server can't know, so the server and the hydrating render use en-US.
262
+ const providerLocale = useLocale();
263
+ const hydrated = React.useSyncExternalStore(noSubscribe, () => true, () => false);
264
+ const tag = locale?.code ?? providerLocale ?? (hydrated ? undefined : "en-US");
265
+ // A day picked before its time (or a time before its day) is kept here until the other comes.
266
+ const [draft, setDraft] = React.useState(() => ({
267
+ day: value,
268
+ time: value ? timeOf(value) : null,
269
+ }));
270
+ // A controlled value that changes from outside resets the draft; one we emitted does not.
271
+ const [synced, setSynced] = React.useState(timeValue(value));
272
+ if (timeValue(value) !== synced) {
273
+ setSynced(timeValue(value));
274
+ const whole = draft.day && draft.time ? atTime(draft.day, draft.time).getTime() : null;
275
+ if (timeValue(value) !== whole)
276
+ setDraft({ day: value, time: value ? timeOf(value) : null });
277
+ }
278
+ const [month, setMonth] = React.useState(() => value ?? new Date());
279
+ useFormReset(triggerRef, () => {
280
+ setValue(defaultValue);
281
+ setDraft({ day: defaultValue, time: defaultValue ? timeOf(defaultValue) : null });
282
+ });
283
+ const clamp = (date) => min && date < min ? new Date(min) : max && date > max ? new Date(max) : date;
284
+ const emit = (day, time) => {
285
+ const next = day && time ? clamp(atTime(day, time)) : null;
286
+ setDraft({ day: next ?? day, time: next ? timeOf(next) : time });
287
+ if (timeValue(next) === timeValue(value))
288
+ return;
289
+ setSynced(timeValue(next));
290
+ setValue(next);
291
+ onValueChange?.(next);
292
+ };
293
+ const changeOpen = (next) => {
294
+ if (next)
295
+ setMonth(draft.day ?? value ?? min ?? new Date());
296
+ setOpen(next);
297
+ onOpenChange?.(next);
298
+ };
299
+ const fmt = React.useMemo(() => {
300
+ const options = {
301
+ ...(format ?? { dateStyle: "medium", timeStyle: "short" }),
302
+ ...(hourCycle ? { hourCycle: hourCycle === 12 ? "h12" : "h23" } : {}),
303
+ };
304
+ const make = (o) => {
305
+ try {
306
+ return new Intl.DateTimeFormat(tag, o);
307
+ }
308
+ catch {
309
+ return new Intl.DateTimeFormat("en-US", o);
310
+ }
311
+ };
312
+ return { full: make(options), day: make({ dateStyle: "medium" }) };
313
+ }, [tag, format, hourCycle]);
314
+ const onDayOf = (bound) => bound && draft.day && isSameDay(bound, draft.day) ? timeOf(bound) : undefined;
315
+ const ownDisabled = calendar?.disabled;
316
+ const disabledDays = [
317
+ ...(min ? [{ before: startOfDayOf(min) }] : []),
318
+ ...(max ? [{ after: startOfDayOf(max) }] : []),
319
+ ...(Array.isArray(ownDisabled) ? ownDisabled : ownDisabled ? [ownDisabled] : []),
320
+ ];
321
+ let label = placeholder ?? text.placeholder;
322
+ if (value)
323
+ label = fmt.full.format(value);
324
+ else if (draft.day)
325
+ label = `${fmt.day.format(draft.day)}, ––:––`;
326
+ return (_jsxs(Popover, { open: open, onOpenChange: (next) => changeOpen(next), children: [_jsx(PickerTrigger, { slot: "date-time-picker-trigger", empty: !value, value: value ? isoLocal(value) : "", name: name, ...trigger, ref: triggerRefs, leaveRef: leave.leaveRef, children: label }), _jsxs(PopoverContent, { align: "start", ...popover, "data-slot": "date-time-picker-content", className: sx(panelClassName, popover?.className), onBlur: leave.popupBlur, children: [_jsx(Calendar, { autoFocus: true, ...calendar, disabled: disabledDays.length ? disabledDays : undefined, mode: "single", required: true, locale: locale, selected: draft.day ?? undefined, onSelect: (day) => {
327
+ const time = draft.time ?? defaultTime ?? null;
328
+ emit(day ?? null, time);
329
+ // The day is there; the time comes next while it is empty.
330
+ if (!time)
331
+ requestAnimationFrame(() => timeRef.current?.querySelector("[data-slot=time-field-segment]")?.focus());
332
+ }, month: month, onMonthChange: setMonth }), _jsxs(BaseField.Root, { ref: timeRef, disabled: trigger.disabled, "data-slot": "date-time-picker-time", className: "flex items-center gap-3 border-t border-border/60 p-3", onKeyDown: (event) => {
333
+ if (event.key === "Enter") {
334
+ event.preventDefault();
335
+ changeOpen(false);
336
+ }
337
+ }, children: [_jsx(BaseField.Label, { className: "shrink-0 text-sm font-medium text-foreground select-none", children: text.time }), _jsx(TimeField, { value: draft.time, onValueChange: (time) => emit(draft.day, time), hourCycle: hourCycle, locale: tag, step: step, min: onDayOf(min), max: onDayOf(max) })] })] })] }));
338
+ }
@@ -0,0 +1,57 @@
1
+ import { Dialog as BaseDialog } from "@base-ui/react/dialog";
2
+ import * as React from "react";
3
+ export interface DialogMessages {
4
+ /** The close button's name. */
5
+ close: string;
6
+ }
7
+ declare module "./locale" {
8
+ interface Messages {
9
+ dialog: DialogMessages;
10
+ }
11
+ }
12
+ /**
13
+ * Dialog — a focused task on top of the page: a short form, a decision, a detail view.
14
+ * A dialog is an *object*, so its popup takes the card geometry (20px, the card material).
15
+ *
16
+ * Compose `DialogTrigger` → `DialogContent` → `DialogHeader` / `DialogBody` / `DialogFooter`.
17
+ * The rule people break: using a dialog for content that deserves a page. Keep it short; for a
18
+ * confirmation use `AlertDialog`, for a panel with gestures use `Drawer`.
19
+ */
20
+ export declare const Dialog: <Payload>(props: BaseDialog.Root.Props<Payload>) => React.JSX.Element;
21
+ /** Opens the dialog. Compose with a button: `render={<Button variant="secondary" />}`. */
22
+ export declare function DialogTrigger(props: BaseDialog.Trigger.Props): React.JSX.Element;
23
+ declare const dialogSizes: {
24
+ readonly sm: "max-w-[26rem]";
25
+ readonly default: "max-w-[32rem]";
26
+ readonly lg: "max-w-[44rem]";
27
+ readonly xl: "max-w-[56rem]";
28
+ };
29
+ export type DialogSize = keyof typeof dialogSizes;
30
+ export interface DialogContentProps extends BaseDialog.Popup.Props {
31
+ /** Max width: `sm` 416px · `default` 512px · `lg` 704px · `xl` 896px. Always full width minus 16px gutters on mobile. */
32
+ size?: DialogSize;
33
+ /** Render the circular close button in the top-right corner. */
34
+ showCloseButton?: boolean;
35
+ /** Accessible name of the close button. Default "Close", or `messages.dialog.close` from a LocaleProvider. */
36
+ closeLabel?: string;
37
+ /** Props for the portal (e.g. `container`, `keepMounted`). */
38
+ portal?: Omit<BaseDialog.Portal.Props, "children">;
39
+ }
40
+ /**
41
+ * The dialog itself: Portal + Backdrop + Viewport + Popup. Enters and exits with opacity and a
42
+ * 0.97 scale; the viewport keeps a 16px gutter on every side so it never touches the screen edge.
43
+ */
44
+ export declare function DialogContent({ size, showCloseButton, closeLabel, portal, className, children, dir, ...props }: DialogContentProps): React.JSX.Element;
45
+ /** Title + description block. Leaves room at the end for the close button. */
46
+ export declare function DialogHeader({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
47
+ /** The dialog's name, in Licht 300 at 26px. Lead with the outcome: "Rename this project". */
48
+ export declare function DialogTitle({ className, ...props }: BaseDialog.Title.Props): React.JSX.Element;
49
+ /** One or two specific sentences under the title. */
50
+ export declare function DialogDescription({ className, ...props }: BaseDialog.Description.Props): React.JSX.Element;
51
+ /** The scrollable middle. Header and footer stay put while long content scrolls here. */
52
+ export declare function DialogBody({ className, ref, ...props }: React.ComponentProps<"div">): React.JSX.Element;
53
+ /** Actions, right-aligned on desktop, stacked full-width on mobile (primary on top). */
54
+ export declare function DialogFooter({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
55
+ /** Closes the dialog. Compose with a button: `render={<Button variant="secondary" />}`. */
56
+ export declare function DialogClose(props: BaseDialog.Close.Props): React.JSX.Element;
57
+ export {};
@@ -0,0 +1,95 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { Dialog as BaseDialog } from "@base-ui/react/dialog";
4
+ import { XIcon } from "lucide-react";
5
+ import * as React from "react";
6
+ import { cn, sx, triggerSlot } from "../lib/cn.js";
7
+ import { mergeRefs } from "../lib/merge-refs.js";
8
+ import { overlayBackdrop, overlayCard, overlayCloseButton, overlayDescription, overlayFooter, overlayHeader, overlayTitle, usePopupDir, } from "./_overlay.js";
9
+ import { useMessages } from "./locale.js";
10
+ const defaultMessages = { close: "Close" };
11
+ /**
12
+ * Dialog — a focused task on top of the page: a short form, a decision, a detail view.
13
+ * A dialog is an *object*, so its popup takes the card geometry (20px, the card material).
14
+ *
15
+ * Compose `DialogTrigger` → `DialogContent` → `DialogHeader` / `DialogBody` / `DialogFooter`.
16
+ * The rule people break: using a dialog for content that deserves a page. Keep it short; for a
17
+ * confirmation use `AlertDialog`, for a panel with gestures use `Drawer`.
18
+ */
19
+ export const Dialog = BaseDialog.Root;
20
+ /** Opens the dialog. Compose with a button: `render={<Button variant="secondary" />}`. */
21
+ export function DialogTrigger(props) {
22
+ return _jsx(BaseDialog.Trigger, { ...triggerSlot("dialog-trigger", props.render), ...props });
23
+ }
24
+ const dialogSizes = {
25
+ sm: "max-w-[26rem]",
26
+ default: "max-w-[32rem]",
27
+ lg: "max-w-[44rem]",
28
+ xl: "max-w-[56rem]",
29
+ };
30
+ /**
31
+ * The dialog itself: Portal + Backdrop + Viewport + Popup. Enters and exits with opacity and a
32
+ * 0.97 scale; the viewport keeps a 16px gutter on every side so it never touches the screen edge.
33
+ */
34
+ export function DialogContent({ size = "default", showCloseButton = true, closeLabel, portal, className, children, dir, ...props }) {
35
+ const popupDir = usePopupDir(dir);
36
+ const text = useMessages("dialog", defaultMessages);
37
+ return (_jsxs(BaseDialog.Portal, { ...portal, children: [_jsx(BaseDialog.Backdrop, { "data-slot": "dialog-backdrop", className: overlayBackdrop }), _jsx(BaseDialog.Viewport, { "data-slot": "dialog-viewport", className: "fixed inset-0 z-50 flex items-center justify-center p-4 sm:p-6", children: _jsxs(BaseDialog.Popup, { "data-slot": "dialog-content", "data-size": size, dir: popupDir, className: sx([
38
+ "relative flex max-h-full w-full min-w-0 flex-col gap-6 overflow-hidden rounded-card p-6 font-body outline-none sm:p-8",
39
+ overlayCard,
40
+ "popup-motion",
41
+ dialogSizes[size],
42
+ ], className), ...props, children: [children, showCloseButton && (_jsx(BaseDialog.Close, { "data-slot": "dialog-close-button", "aria-label": closeLabel ?? text.close, className: overlayCloseButton, children: _jsx(XIcon, { "aria-hidden": true }) }))] }) })] }));
43
+ }
44
+ /** Title + description block. Leaves room at the end for the close button. */
45
+ export function DialogHeader({ className, ...props }) {
46
+ return _jsx("div", { "data-slot": "dialog-header", className: cn(overlayHeader, "pe-10", className), ...props });
47
+ }
48
+ /** The dialog's name, in Licht 300 at 26px. Lead with the outcome: "Rename this project". */
49
+ export function DialogTitle({ className, ...props }) {
50
+ return _jsx(BaseDialog.Title, { "data-slot": "dialog-title", className: sx(overlayTitle, className), ...props });
51
+ }
52
+ /** One or two specific sentences under the title. */
53
+ export function DialogDescription({ className, ...props }) {
54
+ return (_jsx(BaseDialog.Description, { "data-slot": "dialog-description", className: sx(overlayDescription, className), ...props }));
55
+ }
56
+ /** The scrollable middle. Header and footer stay put while long content scrolls here. */
57
+ export function DialogBody({ className, ref, ...props }) {
58
+ const own = React.useRef(null);
59
+ const refs = React.useMemo(() => mergeRefs(own, ref), [ref]);
60
+ // While it scrolls, the body is a tab stop, so the keyboard can scroll text that holds nothing
61
+ // focusable (Safari doesn't make a scrolling region focusable on its own).
62
+ const [scrolls, setScrolls] = React.useState(false);
63
+ React.useEffect(() => {
64
+ const body = own.current;
65
+ if (!body)
66
+ return;
67
+ const check = () => setScrolls(body.scrollHeight > body.clientHeight + 1);
68
+ const resize = new ResizeObserver(check);
69
+ const observe = () => {
70
+ resize.disconnect();
71
+ resize.observe(body);
72
+ for (const child of body.children)
73
+ resize.observe(child);
74
+ };
75
+ const mutations = new MutationObserver(() => {
76
+ observe();
77
+ check();
78
+ });
79
+ mutations.observe(body, { childList: true });
80
+ observe();
81
+ return () => {
82
+ resize.disconnect();
83
+ mutations.disconnect();
84
+ };
85
+ }, []);
86
+ return (_jsx("div", { ref: refs, "data-slot": "dialog-body", tabIndex: scrolls ? 0 : undefined, className: cn("-mx-6 -my-0.5 min-h-0 flex-1 overflow-y-auto overscroll-contain px-6 py-0.5 text-[15px] leading-relaxed break-words text-foreground-soft focus-ring sm:-mx-8 sm:px-8", className), ...props }));
87
+ }
88
+ /** Actions, right-aligned on desktop, stacked full-width on mobile (primary on top). */
89
+ export function DialogFooter({ className, ...props }) {
90
+ return _jsx("div", { "data-slot": "dialog-footer", className: cn(overlayFooter, className), ...props });
91
+ }
92
+ /** Closes the dialog. Compose with a button: `render={<Button variant="secondary" />}`. */
93
+ export function DialogClose(props) {
94
+ return _jsx(BaseDialog.Close, { ...triggerSlot("dialog-close", props.render), ...props });
95
+ }