@zonsh/ui 0.4.1 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (562) hide show
  1. package/CHANGELOG.md +639 -0
  2. package/README.md +49 -21
  3. package/dist/brand.d.ts +3 -0
  4. package/dist/brand.js +7 -0
  5. package/dist/components/_breadcrumb-more.d.ts +6 -0
  6. package/dist/components/_breadcrumb-more.js +5 -0
  7. package/dist/components/_drawing-svg.d.ts +11 -0
  8. package/dist/components/_drawing-svg.js +30 -0
  9. package/dist/components/_media.d.ts +159 -0
  10. package/dist/components/_media.js +266 -0
  11. package/dist/components/_overlay.d.ts +8 -5
  12. package/dist/components/_overlay.js +11 -6
  13. package/dist/components/_scheduler-calendar.d.ts +71 -0
  14. package/dist/components/_scheduler-calendar.js +940 -0
  15. package/dist/components/_scheduler-editor.d.ts +29 -0
  16. package/dist/components/_scheduler-editor.js +111 -0
  17. package/dist/components/_scheduler-menu.d.ts +16 -0
  18. package/dist/components/_scheduler-menu.js +18 -0
  19. package/dist/components/_scheduler-parts.d.ts +164 -0
  20. package/dist/components/_scheduler-parts.js +327 -0
  21. package/dist/components/_suggest-list.d.ts +142 -0
  22. package/dist/components/_suggest-list.js +159 -0
  23. package/dist/components/_toolbar-more.d.ts +24 -0
  24. package/dist/components/_toolbar-more.js +25 -0
  25. package/dist/components/accordion.d.ts +1 -1
  26. package/dist/components/accordion.js +7 -7
  27. package/dist/components/action-sheet.d.ts +88 -0
  28. package/dist/components/action-sheet.js +124 -0
  29. package/dist/components/alert-dialog.js +3 -1
  30. package/dist/components/alert.d.ts +11 -18
  31. package/dist/components/alert.js +9 -6
  32. package/dist/components/app-bar.d.ts +93 -0
  33. package/dist/components/app-bar.js +175 -0
  34. package/dist/components/ascii-field.js +2 -1
  35. package/dist/components/audio-player.d.ts +134 -0
  36. package/dist/components/audio-player.js +618 -0
  37. package/dist/components/avatar.d.ts +6 -6
  38. package/dist/components/avatar.js +13 -11
  39. package/dist/components/badge.d.ts +12 -12
  40. package/dist/components/badge.js +7 -5
  41. package/dist/components/bottom-nav.d.ts +53 -11
  42. package/dist/components/bottom-nav.js +389 -24
  43. package/dist/components/breadcrumb.d.ts +11 -2
  44. package/dist/components/breadcrumb.js +60 -6
  45. package/dist/components/button-group.js +5 -1
  46. package/dist/components/button.d.ts +23 -6
  47. package/dist/components/button.js +64 -8
  48. package/dist/components/calendar.js +8 -6
  49. package/dist/components/card.d.ts +10 -8
  50. package/dist/components/card.js +15 -14
  51. package/dist/components/carousel.d.ts +2 -2
  52. package/dist/components/carousel.js +21 -8
  53. package/dist/components/chart.d.ts +38 -1
  54. package/dist/components/chart.js +27 -5
  55. package/dist/components/checkbox.js +2 -2
  56. package/dist/components/code-block.d.ts +9 -2
  57. package/dist/components/code-block.js +26 -7
  58. package/dist/components/collapsible.js +4 -4
  59. package/dist/components/color-picker.d.ts +2 -2
  60. package/dist/components/color-picker.js +5 -5
  61. package/dist/components/combobox.d.ts +26 -7
  62. package/dist/components/combobox.js +32 -13
  63. package/dist/components/command.d.ts +29 -5
  64. package/dist/components/command.js +37 -12
  65. package/dist/components/context-menu.d.ts +5 -2
  66. package/dist/components/context-menu.js +24 -3
  67. package/dist/components/conversation.d.ts +1 -1
  68. package/dist/components/conversation.js +77 -16
  69. package/dist/components/copy-button.d.ts +1 -1
  70. package/dist/components/copy-button.js +8 -6
  71. package/dist/components/data-table.d.ts +6 -6
  72. package/dist/components/data-table.js +41 -15
  73. package/dist/components/date-picker.d.ts +31 -9
  74. package/dist/components/date-picker.js +100 -18
  75. package/dist/components/dialog.d.ts +17 -10
  76. package/dist/components/dialog.js +20 -13
  77. package/dist/components/drawer.d.ts +26 -8
  78. package/dist/components/drawer.js +75 -16
  79. package/dist/components/drawing.d.ts +25 -0
  80. package/dist/components/drawing.js +32 -0
  81. package/dist/components/empty.js +2 -2
  82. package/dist/components/feature-list.d.ts +65 -13
  83. package/dist/components/feature-list.js +116 -15
  84. package/dist/components/field.js +2 -2
  85. package/dist/components/file-drop.d.ts +9 -7
  86. package/dist/components/file-drop.js +8 -43
  87. package/dist/components/filter-bar.d.ts +10 -9
  88. package/dist/components/filter-bar.js +42 -25
  89. package/dist/components/graph.d.ts +19 -3
  90. package/dist/components/graph.js +190 -28
  91. package/dist/components/illustration.js +53 -31
  92. package/dist/components/input-group.d.ts +6 -11
  93. package/dist/components/input-group.js +21 -19
  94. package/dist/components/input.d.ts +2 -2
  95. package/dist/components/input.js +3 -3
  96. package/dist/components/item.d.ts +9 -6
  97. package/dist/components/item.js +13 -8
  98. package/dist/components/kbd.d.ts +1 -1
  99. package/dist/components/kbd.js +1 -1
  100. package/dist/components/layout.d.ts +2 -1
  101. package/dist/components/layout.js +55 -11
  102. package/dist/components/lightbox.d.ts +76 -9
  103. package/dist/components/lightbox.js +354 -48
  104. package/dist/components/locale.d.ts +6 -6
  105. package/dist/components/logo.d.ts +21 -1
  106. package/dist/components/logo.js +32 -2
  107. package/dist/components/markdown-editor.d.ts +275 -0
  108. package/dist/components/markdown-editor.js +831 -0
  109. package/dist/components/mentions.d.ts +153 -0
  110. package/dist/components/mentions.js +507 -0
  111. package/dist/components/menu.d.ts +2 -1
  112. package/dist/components/menu.js +5 -4
  113. package/dist/components/menubar.d.ts +23 -5
  114. package/dist/components/menubar.js +153 -31
  115. package/dist/components/message.d.ts +62 -11
  116. package/dist/components/message.js +51 -14
  117. package/dist/components/meter.js +1 -1
  118. package/dist/components/money-input.d.ts +1 -1
  119. package/dist/components/money-input.js +1 -1
  120. package/dist/components/native-select.d.ts +2 -2
  121. package/dist/components/native-select.js +4 -4
  122. package/dist/components/navigation-menu.d.ts +3 -1
  123. package/dist/components/navigation-menu.js +23 -10
  124. package/dist/components/number-field.d.ts +2 -9
  125. package/dist/components/number-field.js +90 -26
  126. package/dist/components/number-roll.d.ts +26 -0
  127. package/dist/components/number-roll.js +81 -0
  128. package/dist/components/otp-field.d.ts +1 -1
  129. package/dist/components/otp-field.js +24 -3
  130. package/dist/components/pagination.d.ts +11 -3
  131. package/dist/components/pagination.js +59 -13
  132. package/dist/components/pdf-viewer.d.ts +1 -1
  133. package/dist/components/pdf-viewer.js +8 -8
  134. package/dist/components/phone-input.d.ts +1 -1
  135. package/dist/components/phone-input.js +2 -2
  136. package/dist/components/popover.js +5 -3
  137. package/dist/components/preview-card.d.ts +37 -2
  138. package/dist/components/preview-card.js +226 -2
  139. package/dist/components/progress.js +1 -1
  140. package/dist/components/prompt-input.d.ts +1 -1
  141. package/dist/components/prompt-input.js +35 -17
  142. package/dist/components/pull-to-refresh.d.ts +50 -0
  143. package/dist/components/pull-to-refresh.js +189 -0
  144. package/dist/components/quote.d.ts +6 -1
  145. package/dist/components/quote.js +3 -2
  146. package/dist/components/radio-group.js +8 -3
  147. package/dist/components/rating.d.ts +4 -1
  148. package/dist/components/rating.js +131 -10
  149. package/dist/components/reasoning.d.ts +1 -1
  150. package/dist/components/reasoning.js +7 -3
  151. package/dist/components/resizable.d.ts +1 -1
  152. package/dist/components/resizable.js +2 -2
  153. package/dist/components/response.d.ts +4 -3
  154. package/dist/components/response.js +39 -15
  155. package/dist/components/scheduler.d.ts +352 -0
  156. package/dist/components/scheduler.js +1717 -0
  157. package/dist/components/scroll-area.js +1 -1
  158. package/dist/components/select.d.ts +17 -4
  159. package/dist/components/select.js +140 -9
  160. package/dist/components/separator.d.ts +1 -1
  161. package/dist/components/separator.js +3 -3
  162. package/dist/components/sidebar.d.ts +44 -3
  163. package/dist/components/sidebar.js +90 -31
  164. package/dist/components/site-header.d.ts +18 -13
  165. package/dist/components/site-header.js +26 -9
  166. package/dist/components/skeleton.d.ts +18 -8
  167. package/dist/components/skeleton.js +23 -8
  168. package/dist/components/slider.js +2 -2
  169. package/dist/components/sortable.d.ts +55 -4
  170. package/dist/components/sortable.js +187 -94
  171. package/dist/components/sources.d.ts +1 -1
  172. package/dist/components/sources.js +2 -2
  173. package/dist/components/spinner.d.ts +4 -4
  174. package/dist/components/spinner.js +4 -4
  175. package/dist/components/stat.d.ts +21 -4
  176. package/dist/components/stat.js +17 -8
  177. package/dist/components/stepper.d.ts +1 -1
  178. package/dist/components/stepper.js +8 -7
  179. package/dist/components/suggestions.d.ts +11 -3
  180. package/dist/components/suggestions.js +10 -4
  181. package/dist/components/swipe-actions.d.ts +66 -0
  182. package/dist/components/swipe-actions.js +292 -0
  183. package/dist/components/switch.js +1 -1
  184. package/dist/components/table.d.ts +13 -7
  185. package/dist/components/table.js +124 -23
  186. package/dist/components/tabs.js +15 -8
  187. package/dist/components/tag.d.ts +19 -20
  188. package/dist/components/tag.js +9 -5
  189. package/dist/components/tags-input.d.ts +2 -7
  190. package/dist/components/tags-input.js +11 -8
  191. package/dist/components/textarea.d.ts +3 -2
  192. package/dist/components/textarea.js +4 -3
  193. package/dist/components/theme.d.ts +50 -7
  194. package/dist/components/theme.js +168 -12
  195. package/dist/components/time-field.d.ts +6 -10
  196. package/dist/components/time-field.js +19 -9
  197. package/dist/components/timeline.d.ts +19 -3
  198. package/dist/components/timeline.js +21 -9
  199. package/dist/components/tippy.d.ts +17 -1
  200. package/dist/components/tippy.js +95 -15
  201. package/dist/components/toast.d.ts +2 -7
  202. package/dist/components/toast.js +12 -8
  203. package/dist/components/toggle-group.d.ts +7 -1
  204. package/dist/components/toggle-group.js +17 -5
  205. package/dist/components/toggle.d.ts +2 -2
  206. package/dist/components/toggle.js +3 -2
  207. package/dist/components/tool-call.d.ts +1 -1
  208. package/dist/components/tool-call.js +8 -3
  209. package/dist/components/toolbar.d.ts +57 -4
  210. package/dist/components/toolbar.js +219 -16
  211. package/dist/components/tooltip.d.ts +5 -3
  212. package/dist/components/tooltip.js +14 -6
  213. package/dist/components/tour.d.ts +1 -1
  214. package/dist/components/tour.js +70 -24
  215. package/dist/components/tree.js +33 -10
  216. package/dist/components/typography.d.ts +31 -8
  217. package/dist/components/typography.js +21 -10
  218. package/dist/components/video-player.d.ts +7 -2
  219. package/dist/components/video-player.js +182 -225
  220. package/dist/index.d.ts +99 -92
  221. package/dist/index.js +99 -92
  222. package/dist/lib/calendar.d.ts +153 -0
  223. package/dist/lib/calendar.js +312 -0
  224. package/dist/lib/cn.d.ts +3 -1
  225. package/dist/lib/cn.js +5 -0
  226. package/dist/lib/code-highlight.d.ts +14 -0
  227. package/dist/lib/code-highlight.js +81 -18
  228. package/dist/lib/drag.d.ts +39 -0
  229. package/dist/lib/drag.js +96 -0
  230. package/dist/lib/editorial-assets.js +16 -8
  231. package/dist/lib/figure/figures/automation.js +25 -6
  232. package/dist/lib/figure/figures/bar-chart.js +6 -1
  233. package/dist/lib/figure/figures/brackets-classic.js +4 -1
  234. package/dist/lib/figure/figures/city.js +12 -2
  235. package/dist/lib/figure/figures/conveyor.js +17 -4
  236. package/dist/lib/figure/figures/database.js +5 -2
  237. package/dist/lib/figure/figures/documents.js +11 -3
  238. package/dist/lib/figure/figures/inbox.js +5 -2
  239. package/dist/lib/figure/figures/laptop.js +3 -1
  240. package/dist/lib/figure/figures/pipeline.js +45 -10
  241. package/dist/lib/figure/figures/platform.js +62 -7
  242. package/dist/lib/figure/figures/server.js +21 -5
  243. package/dist/lib/figure/figures/spreadsheet.js +29 -5
  244. package/dist/lib/figure/kernel.d.ts +4 -2
  245. package/dist/lib/figure/kernel.js +10 -5
  246. package/dist/lib/figure/parts.js +6 -2
  247. package/dist/lib/files.d.ts +31 -0
  248. package/dist/lib/files.js +60 -0
  249. package/dist/lib/gesture.d.ts +70 -0
  250. package/dist/lib/gesture.js +141 -0
  251. package/dist/lib/glide.d.ts +10 -4
  252. package/dist/lib/glide.js +14 -5
  253. package/dist/lib/icons.d.ts +1 -0
  254. package/dist/lib/icons.js +6 -0
  255. package/dist/lib/illustration-library.js +1 -6
  256. package/dist/lib/markdown-edit.d.ts +112 -0
  257. package/dist/lib/markdown-edit.js +557 -0
  258. package/dist/lib/markdown-rich-editor.d.ts +188 -0
  259. package/dist/lib/markdown-rich-editor.js +1153 -0
  260. package/dist/lib/markdown-rich.d.ts +63 -0
  261. package/dist/lib/markdown-rich.js +534 -0
  262. package/dist/lib/mentions.d.ts +100 -0
  263. package/dist/lib/mentions.js +246 -0
  264. package/dist/lib/motion.d.ts +18 -0
  265. package/dist/lib/motion.js +43 -5
  266. package/dist/lib/number-roll.d.ts +89 -0
  267. package/dist/lib/number-roll.js +391 -0
  268. package/dist/lib/platform.d.ts +6 -0
  269. package/dist/lib/platform.js +14 -0
  270. package/dist/lib/portal-container.d.ts +9 -0
  271. package/dist/lib/portal-container.js +10 -0
  272. package/dist/lib/press.d.ts +5 -0
  273. package/dist/lib/press.js +186 -0
  274. package/dist/lib/scheduler.d.ts +128 -0
  275. package/dist/lib/scheduler.js +272 -0
  276. package/dist/lib/scroll-edges.d.ts +9 -0
  277. package/dist/lib/scroll-edges.js +50 -0
  278. package/dist/lib/table-fit.d.ts +4 -3
  279. package/dist/lib/table-fit.js +92 -25
  280. package/dist/lib/theme-preset.d.ts +267 -0
  281. package/dist/lib/theme-preset.js +1046 -0
  282. package/dist/lib/theme-script.d.ts +23 -3
  283. package/dist/lib/theme-script.js +17 -5
  284. package/dist/lib/tippy/sprite.d.ts +36 -4
  285. package/dist/lib/tippy/sprite.js +188 -15
  286. package/dist/lib/tone.d.ts +4 -0
  287. package/dist/lib/tone.js +1 -0
  288. package/dist/messages/de.d.ts +3 -3
  289. package/dist/messages/de.js +274 -3
  290. package/dist/skills/zon-ui/SKILL.md +279 -0
  291. package/dist/skills/zon-ui/references/authoring.md +265 -0
  292. package/dist/skills/zon-ui/references/brand.md +416 -0
  293. package/dist/skills/zon-ui/references/components/accordion.md +199 -0
  294. package/dist/skills/zon-ui/references/components/action-sheet.md +268 -0
  295. package/dist/skills/zon-ui/references/components/alert-dialog.md +276 -0
  296. package/dist/skills/zon-ui/references/components/alert.md +167 -0
  297. package/dist/skills/zon-ui/references/components/app-bar.md +307 -0
  298. package/dist/skills/zon-ui/references/components/ascii-field.md +121 -0
  299. package/dist/skills/zon-ui/references/components/aspect-ratio.md +112 -0
  300. package/dist/skills/zon-ui/references/components/audio-player.md +231 -0
  301. package/dist/skills/zon-ui/references/components/avatar.md +98 -0
  302. package/dist/skills/zon-ui/references/components/badge.md +227 -0
  303. package/dist/skills/zon-ui/references/components/bottom-nav.md +709 -0
  304. package/dist/skills/zon-ui/references/components/breadcrumb.md +143 -0
  305. package/dist/skills/zon-ui/references/components/button-group.md +216 -0
  306. package/dist/skills/zon-ui/references/components/button.md +309 -0
  307. package/dist/skills/zon-ui/references/components/calendar.md +296 -0
  308. package/dist/skills/zon-ui/references/components/card.md +158 -0
  309. package/dist/skills/zon-ui/references/components/carousel.md +297 -0
  310. package/dist/skills/zon-ui/references/components/chart.md +739 -0
  311. package/dist/skills/zon-ui/references/components/chat.md +417 -0
  312. package/dist/skills/zon-ui/references/components/checkbox.md +219 -0
  313. package/dist/skills/zon-ui/references/components/code-block.md +143 -0
  314. package/dist/skills/zon-ui/references/components/code-highlight.md +118 -0
  315. package/dist/skills/zon-ui/references/components/collapsible.md +146 -0
  316. package/dist/skills/zon-ui/references/components/color-picker.md +200 -0
  317. package/dist/skills/zon-ui/references/components/combobox.md +455 -0
  318. package/dist/skills/zon-ui/references/components/command.md +326 -0
  319. package/dist/skills/zon-ui/references/components/contact-form.md +562 -0
  320. package/dist/skills/zon-ui/references/components/context-menu.md +159 -0
  321. package/dist/skills/zon-ui/references/components/conversation.md +146 -0
  322. package/dist/skills/zon-ui/references/components/copy-button.md +162 -0
  323. package/dist/skills/zon-ui/references/components/crm.md +1022 -0
  324. package/dist/skills/zon-ui/references/components/dashboard.md +612 -0
  325. package/dist/skills/zon-ui/references/components/data-table.md +776 -0
  326. package/dist/skills/zon-ui/references/components/date-picker.md +444 -0
  327. package/dist/skills/zon-ui/references/components/dialog.md +335 -0
  328. package/dist/skills/zon-ui/references/components/direction.md +165 -0
  329. package/dist/skills/zon-ui/references/components/drawer.md +276 -0
  330. package/dist/skills/zon-ui/references/components/drawing.md +94 -0
  331. package/dist/skills/zon-ui/references/components/empty.md +225 -0
  332. package/dist/skills/zon-ui/references/components/feature-list.md +412 -0
  333. package/dist/skills/zon-ui/references/components/field.md +209 -0
  334. package/dist/skills/zon-ui/references/components/file-drop.md +234 -0
  335. package/dist/skills/zon-ui/references/components/filter-bar.md +485 -0
  336. package/dist/skills/zon-ui/references/components/form.md +970 -0
  337. package/dist/skills/zon-ui/references/components/graph.md +339 -0
  338. package/dist/skills/zon-ui/references/components/illustration.md +497 -0
  339. package/dist/skills/zon-ui/references/components/inbox.md +263 -0
  340. package/dist/skills/zon-ui/references/components/input-group.md +339 -0
  341. package/dist/skills/zon-ui/references/components/input.md +189 -0
  342. package/dist/skills/zon-ui/references/components/item.md +277 -0
  343. package/dist/skills/zon-ui/references/components/kanban.md +626 -0
  344. package/dist/skills/zon-ui/references/components/kbd.md +116 -0
  345. package/dist/skills/zon-ui/references/components/label.md +104 -0
  346. package/dist/skills/zon-ui/references/components/layout.md +291 -0
  347. package/dist/skills/zon-ui/references/components/lightbox.md +235 -0
  348. package/dist/skills/zon-ui/references/components/locale.md +279 -0
  349. package/dist/skills/zon-ui/references/components/logo.md +257 -0
  350. package/dist/skills/zon-ui/references/components/markdown-editor.md +558 -0
  351. package/dist/skills/zon-ui/references/components/mentions.md +512 -0
  352. package/dist/skills/zon-ui/references/components/menu.md +218 -0
  353. package/dist/skills/zon-ui/references/components/menubar.md +292 -0
  354. package/dist/skills/zon-ui/references/components/message.md +243 -0
  355. package/dist/skills/zon-ui/references/components/meter.md +105 -0
  356. package/dist/skills/zon-ui/references/components/money-input.md +333 -0
  357. package/dist/skills/zon-ui/references/components/native-select.md +197 -0
  358. package/dist/skills/zon-ui/references/components/navigation-menu.md +253 -0
  359. package/dist/skills/zon-ui/references/components/number-field.md +210 -0
  360. package/dist/skills/zon-ui/references/components/number-roll.md +175 -0
  361. package/dist/skills/zon-ui/references/components/onboarding.md +896 -0
  362. package/dist/skills/zon-ui/references/components/otp-field.md +166 -0
  363. package/dist/skills/zon-ui/references/components/pagination.md +109 -0
  364. package/dist/skills/zon-ui/references/components/pdf-viewer.md +177 -0
  365. package/dist/skills/zon-ui/references/components/phone-input.md +252 -0
  366. package/dist/skills/zon-ui/references/components/popover.md +176 -0
  367. package/dist/skills/zon-ui/references/components/preview-card.md +193 -0
  368. package/dist/skills/zon-ui/references/components/pricing.md +724 -0
  369. package/dist/skills/zon-ui/references/components/progress.md +92 -0
  370. package/dist/skills/zon-ui/references/components/prompt-input.md +307 -0
  371. package/dist/skills/zon-ui/references/components/pull-to-refresh.md +188 -0
  372. package/dist/skills/zon-ui/references/components/quote.md +115 -0
  373. package/dist/skills/zon-ui/references/components/radio-group.md +215 -0
  374. package/dist/skills/zon-ui/references/components/rating.md +260 -0
  375. package/dist/skills/zon-ui/references/components/reasoning.md +102 -0
  376. package/dist/skills/zon-ui/references/components/resizable.md +213 -0
  377. package/dist/skills/zon-ui/references/components/response.md +170 -0
  378. package/dist/skills/zon-ui/references/components/scheduler.md +732 -0
  379. package/dist/skills/zon-ui/references/components/scroll-area.md +122 -0
  380. package/dist/skills/zon-ui/references/components/select.md +351 -0
  381. package/dist/skills/zon-ui/references/components/separator.md +103 -0
  382. package/dist/skills/zon-ui/references/components/settings.md +793 -0
  383. package/dist/skills/zon-ui/references/components/shop.md +1715 -0
  384. package/dist/skills/zon-ui/references/components/sidebar.md +813 -0
  385. package/dist/skills/zon-ui/references/components/sign-in.md +1639 -0
  386. package/dist/skills/zon-ui/references/components/site-header.md +303 -0
  387. package/dist/skills/zon-ui/references/components/skeleton.md +256 -0
  388. package/dist/skills/zon-ui/references/components/slider.md +172 -0
  389. package/dist/skills/zon-ui/references/components/sortable.md +405 -0
  390. package/dist/skills/zon-ui/references/components/sources.md +106 -0
  391. package/dist/skills/zon-ui/references/components/spinner.md +222 -0
  392. package/dist/skills/zon-ui/references/components/stat.md +267 -0
  393. package/dist/skills/zon-ui/references/components/stepper.md +285 -0
  394. package/dist/skills/zon-ui/references/components/suggestions.md +146 -0
  395. package/dist/skills/zon-ui/references/components/swipe-actions.md +344 -0
  396. package/dist/skills/zon-ui/references/components/switch.md +160 -0
  397. package/dist/skills/zon-ui/references/components/table.md +999 -0
  398. package/dist/skills/zon-ui/references/components/tabs.md +258 -0
  399. package/dist/skills/zon-ui/references/components/tag.md +115 -0
  400. package/dist/skills/zon-ui/references/components/tags-input.md +216 -0
  401. package/dist/skills/zon-ui/references/components/textarea.md +95 -0
  402. package/dist/skills/zon-ui/references/components/theme-editor.md +3940 -0
  403. package/dist/skills/zon-ui/references/components/theme.md +362 -0
  404. package/dist/skills/zon-ui/references/components/time-field.md +222 -0
  405. package/dist/skills/zon-ui/references/components/timeline.md +285 -0
  406. package/dist/skills/zon-ui/references/components/tippy.md +243 -0
  407. package/dist/skills/zon-ui/references/components/toast.md +220 -0
  408. package/dist/skills/zon-ui/references/components/toggle-group.md +261 -0
  409. package/dist/skills/zon-ui/references/components/toggle.md +167 -0
  410. package/dist/skills/zon-ui/references/components/tool-call.md +146 -0
  411. package/dist/skills/zon-ui/references/components/toolbar.md +260 -0
  412. package/dist/skills/zon-ui/references/components/tooltip.md +172 -0
  413. package/dist/skills/zon-ui/references/components/tour.md +423 -0
  414. package/dist/skills/zon-ui/references/components/tree.md +481 -0
  415. package/dist/skills/zon-ui/references/components/typography.md +347 -0
  416. package/dist/skills/zon-ui/references/components/video-player.md +386 -0
  417. package/dist/skills/zon-ui/references/marketing.md +467 -0
  418. package/dist/skills/zon-ui/references/motion.md +455 -0
  419. package/dist/skills/zon-ui/references/recipes.md +1232 -0
  420. package/dist/skills/zon-ui/references/tokens.md +866 -0
  421. package/dist/sources/accordion.css +4 -0
  422. package/dist/sources/action-sheet.css +11 -0
  423. package/dist/sources/alert-dialog.css +6 -0
  424. package/dist/sources/alert.css +3 -0
  425. package/dist/sources/app-bar.css +14 -0
  426. package/dist/sources/ascii-field.css +3 -0
  427. package/dist/sources/aspect-ratio.css +3 -0
  428. package/dist/sources/audio-player.css +20 -0
  429. package/dist/sources/avatar.css +3 -0
  430. package/dist/sources/badge.css +3 -0
  431. package/dist/sources/bottom-nav.css +9 -0
  432. package/dist/sources/breadcrumb.css +14 -0
  433. package/dist/sources/button-group.css +3 -0
  434. package/dist/sources/button.css +9 -0
  435. package/dist/sources/calendar.css +13 -0
  436. package/dist/sources/card.css +3 -0
  437. package/dist/sources/carousel.css +11 -0
  438. package/dist/sources/chart.css +5 -0
  439. package/dist/sources/checkbox.css +6 -0
  440. package/dist/sources/code-block.css +13 -0
  441. package/dist/sources/collapsible.css +4 -0
  442. package/dist/sources/color-picker.css +13 -0
  443. package/dist/sources/combobox.css +13 -0
  444. package/dist/sources/command.css +13 -0
  445. package/dist/sources/context-menu.css +12 -0
  446. package/dist/sources/conversation.css +10 -0
  447. package/dist/sources/copy-button.css +10 -0
  448. package/dist/sources/data-table.css +27 -0
  449. package/dist/sources/date-picker.css +20 -0
  450. package/dist/sources/dialog.css +9 -0
  451. package/dist/sources/direction.css +2 -0
  452. package/dist/sources/drawer.css +9 -0
  453. package/dist/sources/drawing.css +5 -0
  454. package/dist/sources/empty.css +3 -0
  455. package/dist/sources/feature-list.css +4 -0
  456. package/dist/sources/field.css +4 -0
  457. package/dist/sources/file-drop.css +15 -0
  458. package/dist/sources/filter-bar.css +30 -0
  459. package/dist/sources/form.css +4 -0
  460. package/dist/sources/graph.css +19 -0
  461. package/dist/sources/illustration.css +28 -0
  462. package/dist/sources/input-group.css +7 -0
  463. package/dist/sources/input.css +3 -0
  464. package/dist/sources/item.css +4 -0
  465. package/dist/sources/kbd.css +5 -0
  466. package/dist/sources/label.css +3 -0
  467. package/dist/sources/layout.css +3 -0
  468. package/dist/sources/lightbox.css +33 -0
  469. package/dist/sources/locale.css +2 -0
  470. package/dist/sources/logo.css +4 -0
  471. package/dist/sources/markdown-editor.css +41 -0
  472. package/dist/sources/mentions.css +13 -0
  473. package/dist/sources/menu.css +11 -0
  474. package/dist/sources/menubar.css +14 -0
  475. package/dist/sources/message.css +16 -0
  476. package/dist/sources/meter.css +4 -0
  477. package/dist/sources/money-input.css +10 -0
  478. package/dist/sources/native-select.css +4 -0
  479. package/dist/sources/navigation-menu.css +8 -0
  480. package/dist/sources/number-field.css +8 -0
  481. package/dist/sources/number-roll.css +6 -0
  482. package/dist/sources/otp-field.css +5 -0
  483. package/dist/sources/pagination.css +11 -0
  484. package/dist/sources/pdf-viewer.css +30 -0
  485. package/dist/sources/phone-input.css +20 -0
  486. package/dist/sources/popover.css +7 -0
  487. package/dist/sources/preview-card.css +7 -0
  488. package/dist/sources/progress.css +4 -0
  489. package/dist/sources/prompt-input.css +15 -0
  490. package/dist/sources/pull-to-refresh.css +14 -0
  491. package/dist/sources/quote.css +3 -0
  492. package/dist/sources/radio-group.css +5 -0
  493. package/dist/sources/rating.css +6 -0
  494. package/dist/sources/reasoning.css +6 -0
  495. package/dist/sources/resizable.css +4 -0
  496. package/dist/sources/response.css +16 -0
  497. package/dist/sources/scheduler.css +44 -0
  498. package/dist/sources/scroll-area.css +3 -0
  499. package/dist/sources/select.css +12 -0
  500. package/dist/sources/separator.css +3 -0
  501. package/dist/sources/sidebar.css +19 -0
  502. package/dist/sources/site-header.css +15 -0
  503. package/dist/sources/skeleton.css +3 -0
  504. package/dist/sources/slider.css +6 -0
  505. package/dist/sources/sortable.css +12 -0
  506. package/dist/sources/sources.css +6 -0
  507. package/dist/sources/spinner.css +6 -0
  508. package/dist/sources/stat.css +9 -0
  509. package/dist/sources/stepper.css +6 -0
  510. package/dist/sources/suggestions.css +10 -0
  511. package/dist/sources/swipe-actions.css +20 -0
  512. package/dist/sources/switch.css +5 -0
  513. package/dist/sources/table.css +7 -0
  514. package/dist/sources/tabs.css +5 -0
  515. package/dist/sources/tag.css +3 -0
  516. package/dist/sources/tags-input.css +6 -0
  517. package/dist/sources/textarea.css +3 -0
  518. package/dist/sources/theme.css +13 -0
  519. package/dist/sources/time-field.css +7 -0
  520. package/dist/sources/timeline.css +7 -0
  521. package/dist/sources/tippy.css +6 -0
  522. package/dist/sources/toast.css +6 -0
  523. package/dist/sources/toggle-group.css +5 -0
  524. package/dist/sources/toggle.css +3 -0
  525. package/dist/sources/tool-call.css +16 -0
  526. package/dist/sources/toolbar.css +14 -0
  527. package/dist/sources/tooltip.css +6 -0
  528. package/dist/sources/tour.css +14 -0
  529. package/dist/sources/tree.css +6 -0
  530. package/dist/sources/typography.css +4 -0
  531. package/dist/sources/video-player.css +21 -0
  532. package/dist/styles/ai.css +3 -0
  533. package/dist/styles/brand.css +98 -0
  534. package/dist/styles/core.css +266 -0
  535. package/dist/styles/editor.css +3 -0
  536. package/dist/styles/expressive.css +75 -77
  537. package/dist/styles/fonts.css +61 -117
  538. package/dist/styles/graph.css +4 -0
  539. package/dist/styles/illustration.css +4 -0
  540. package/dist/styles/index.css +11 -193
  541. package/dist/styles/material.css +177 -31
  542. package/dist/styles/parts/ai.css +20 -14
  543. package/dist/styles/parts/brand.css +2 -2
  544. package/dist/styles/parts/controls.css +51 -38
  545. package/dist/styles/parts/data.css +43 -11
  546. package/dist/styles/parts/editor.css +372 -0
  547. package/dist/styles/parts/feedback.css +75 -15
  548. package/dist/styles/parts/foundations.css +12 -7
  549. package/dist/styles/parts/graph.css +25 -9
  550. package/dist/styles/parts/inputs.css +172 -9
  551. package/dist/styles/parts/isometric.css +6 -5
  552. package/dist/styles/parts/navigation.css +237 -25
  553. package/dist/styles/parts/overlays.css +110 -8
  554. package/dist/styles/parts/pdf.css +15 -9
  555. package/dist/styles/pdf.css +3 -0
  556. package/dist/styles/prose.css +3 -0
  557. package/dist/styles/tokens.css +105 -15
  558. package/dist/theme.d.ts +1 -0
  559. package/dist/theme.js +5 -0
  560. package/dist/vite.d.ts +48 -59
  561. package/dist/vite.js +54 -21
  562. package/package.json +69 -2
@@ -0,0 +1,940 @@
1
+ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ /*
3
+ * The Scheduler's calendar: days across and the hours down (a day, a few days, a week, the working
4
+ * week), with an all-day row on top, or a month of weeks. Private to the Scheduler, which holds the
5
+ * items and the view and hands them in.
6
+ */
7
+ import * as React from "react";
8
+ import { calendarKeyAction, daySegments, draftSpan, fitWeek, isAllDay, layoutDay, monthWeeks, packWeek, shiftSpan, snapTime, stepDate, timeAt, viewDays, wholeDays, } from "../lib/calendar.js";
9
+ import { cn } from "../lib/cn.js";
10
+ import { autoScroll, DRAG_THRESHOLD, LONG_PRESS, scrollersOf, TOUCH_SLOP, useAnnouncer, } from "../lib/drag.js";
11
+ import { ChevronLeftIcon, ChevronRightIcon } from "../lib/icons.js";
12
+ import { DAY, fromWall, HOUR, MINUTE, startOfDay, startOfMonth, toWall, weekdayOf, } from "../lib/scheduler.js";
13
+ import { categoriesOf, categoryOf, clamp, defaultMessages, editedItem, newId, preloadEditor, SchedulerEditorHost, SchedulerMenuHost, describeSpan, formatRange, formats, markTones, SchedulerDetails, eventLook, stripeClass, toneVars, weekInfo, } from "./_scheduler-parts.js";
14
+ import { Button } from "./button.js";
15
+ import { useLocale, useMessages } from "./locale.js";
16
+ import { Popover, PopoverContent, PopoverTitle, PopoverTrigger } from "./popover.js";
17
+ import { ScrollArea } from "./scroll-area.js";
18
+ import { Skeleton } from "./skeleton.js";
19
+ /** The shortest an event is laid out in the time grid, in minutes: half an hour, 24px. */
20
+ const MIN_EVENT = 30;
21
+ /** An event's line of 12px type. */
22
+ const LINE = 15;
23
+ /** Shorter than this, the name and the time share one line. */
24
+ const TWO_LINES = 2 * LINE + 8;
25
+ /**
26
+ * Events that start closer than this in px sit side by side; a line and more apart, the later one
27
+ * cascades over the earlier, whose name stays in view above it.
28
+ */
29
+ const NEAR_PX = LINE + 9;
30
+ /** The narrowest an event is drawn beside others: room for a short word of its name. */
31
+ const MIN_WIDTH = 64;
32
+ /*
33
+ * How much of its time an event shows, by its width (a container query on the event, so it
34
+ * follows the layout without measuring): the whole range where it fits, its start where only
35
+ * that does (up to 3.5rem: "10:30 AM"), nothing on a sliver — the name read out says it all. Picked by the text's length
36
+ * in Licht Mono's 0.6em cells at 11px, plus the event's padding; spelled out for Tailwind.
37
+ */
38
+ const TIME_FITS = {
39
+ 5: {
40
+ range: "@max-[5rem]/event:hidden",
41
+ start: "hidden @max-[5rem]/event:block @max-[3.5rem]/event:hidden",
42
+ },
43
+ 6: {
44
+ range: "@max-[6rem]/event:hidden",
45
+ start: "hidden @max-[6rem]/event:block @max-[3.5rem]/event:hidden",
46
+ },
47
+ 7: {
48
+ range: "@max-[7rem]/event:hidden",
49
+ start: "hidden @max-[7rem]/event:block @max-[3.5rem]/event:hidden",
50
+ },
51
+ 8: {
52
+ range: "@max-[8rem]/event:hidden",
53
+ start: "hidden @max-[8rem]/event:block @max-[3.5rem]/event:hidden",
54
+ },
55
+ 9: {
56
+ range: "@max-[9rem]/event:hidden",
57
+ start: "hidden @max-[9rem]/event:block @max-[3.5rem]/event:hidden",
58
+ },
59
+ };
60
+ /** The rem a time needs: its length in 6.6px cells, rounded up. */
61
+ const fitOf = (time) => clamp(Math.ceil((time.length * 6.6) / 16), 5, 9);
62
+ /**
63
+ * Where an event of a day's cluster is drawn, as inline styles. Its columns share the day, but
64
+ * never narrower than MIN_WIDTH: then they cascade, each the same step on from the one before,
65
+ * the last at MIN_WIDTH. One that reaches the day's end leaves a strip free to draw a new event in.
66
+ */
67
+ function eventBox(day, days, place, top, height) {
68
+ const { column, columns, end, stacked } = place;
69
+ const D = `(100% / ${days})`;
70
+ const step = columns > 1 ? `max(0px, min(${D} / ${columns}, (${D} - ${MIN_WIDTH}px) / ${columns - 1}))` : "0px";
71
+ // One that cascades over an earlier event reaches back a third of a column, for room to be read.
72
+ const at = stacked ? `(${step} * ${column - 1 / 3})` : `(${step} * ${column})`;
73
+ const left = `(${D} * ${day} + ${at})`;
74
+ const room = `(${D} - ${at} - 6px)`;
75
+ const width = end >= columns ? room : `min(${room}, max(${MIN_WIDTH}px, ${step} * ${end} - ${at} - 2px))`;
76
+ return { insetInlineStart: `calc(${left} + 1px)`, width: `calc(${width})`, top, height };
77
+ }
78
+ /**
79
+ * A time or weekday beside a name, drawn but not part of the text: the item's or heading's name
80
+ * says it in full, and text that shows must be part of the name it is read with (WCAG 2.5.3).
81
+ */
82
+ function TimeText({ time, className }) {
83
+ return (_jsx("span", { "aria-hidden": true, "data-time": time, className: cn(
84
+ // Its own direction: "9 AM" stays in that order on a page that runs right to left.
85
+ "font-mono text-11 text-muted-foreground tabular-nums [unicode-bidi:plaintext] after:content-[attr(data-time)]", className) }));
86
+ }
87
+ /** The calendar. See `Scheduler`. */
88
+ export function SchedulerCalendar({ view, items, onItemsChange, date, onDate, onShowDay, viewSwitch, today: todayProp, weekStartsOn: weekStartsOnProp, days: dayCount = 3, step = 15, workHours = { start: 8, end: 18 }, hour12, readOnly = false, loading = false, toolbar, controls = true, renderDetails, onItemOpen, onItemCreate, editor = false, categories: categoriesProp, createId = newId, rows, size = "default", variant = "region", labels, className, style, ...props }) {
89
+ const text = useMessages("scheduler", defaultMessages, labels);
90
+ const locale = useLocale();
91
+ const fmt = React.useMemo(() => formats(locale, hour12), [locale, hour12]);
92
+ const week = React.useMemo(() => weekInfo(locale), [locale]);
93
+ const weekStartsOn = weekStartsOnProp ?? week.firstDay;
94
+ // Now, for the now line: given, or the clock, read again each minute.
95
+ const [clock, setClock] = React.useState(() => Date.now());
96
+ React.useEffect(() => {
97
+ if (todayProp)
98
+ return;
99
+ const id = window.setInterval(() => setClock(Date.now()), MINUTE);
100
+ return () => window.clearInterval(id);
101
+ }, [todayProp]);
102
+ const nowWall = toWall(todayProp ?? new Date(clock));
103
+ const dateWall = toWall(date ?? todayProp ?? new Date(clock));
104
+ const month = view === "month";
105
+ const days = React.useMemo(() => viewDays(view, dateWall, { weekStartsOn, weekend: week.weekend, days: dayCount }), [view, dateWall, weekStartsOn, week.weekend, dayCount]);
106
+ const weeks = React.useMemo(() => (month ? monthWeeks(dateWall, weekStartsOn) : [days]), [month, dateWall, weekStartsOn, days]);
107
+ const shownSpan = { start: days[0] ?? 0, end: (days[days.length - 1] ?? 0) + DAY };
108
+ const rootRef = React.useRef(null);
109
+ const gridRef = React.useRef(null);
110
+ const allDayRef = React.useRef(null);
111
+ const weeksRef = React.useRef(null);
112
+ const probeRef = React.useRef(null);
113
+ const timeInstructions = React.useId();
114
+ const dayInstructions = React.useId();
115
+ const [message, announce] = useAnnouncer();
116
+ const [rtl, setRtl] = React.useState(false);
117
+ const [narrow, setNarrow] = React.useState(false);
118
+ /** The px an hour is tall and a lane of the all-day row or month, from the theme. */
119
+ const [metrics, setMetrics] = React.useState({ hour: 48, lane: 26 });
120
+ const [monthLanes, setMonthLanes] = React.useState(3);
121
+ const [drag, setDrag] = React.useState(null);
122
+ const [openId, setOpenId] = React.useState(null);
123
+ const [moreDay, setMoreDay] = React.useState(null);
124
+ /** On a phone's month, the day whose events are listed under the weeks. */
125
+ const [pickedDay, setPickedDay] = React.useState(null);
126
+ /** The editor, open on an event or on a new one drawn (`pending`, drawn dashed until saved). */
127
+ const [editing, setEditing] = React.useState(null);
128
+ const [pending, setPending] = React.useState(null);
129
+ /** A slot's or an event's menu, at a point or beside the event. */
130
+ const [menu, setMenu] = React.useState(null);
131
+ const canCreate = !readOnly && (editor || !!onItemCreate);
132
+ const categories = React.useMemo(() => categoriesOf(categoriesProp, text), [categoriesProp, text]);
133
+ React.useEffect(() => {
134
+ if (editor && !readOnly)
135
+ preloadEditor();
136
+ }, [editor, readOnly]);
137
+ const ppm = metrics.hour / 60;
138
+ React.useLayoutEffect(() => {
139
+ const root = rootRef.current;
140
+ if (!root)
141
+ return;
142
+ setRtl(getComputedStyle(root).direction === "rtl");
143
+ const probe = probeRef.current;
144
+ if (!probe)
145
+ return;
146
+ const measure = () => {
147
+ const [hour, lane] = [...probe.children].map((c) => c.offsetHeight);
148
+ if (hour && lane)
149
+ setMetrics((m) => (m.hour === hour && m.lane === lane ? m : { hour, lane }));
150
+ };
151
+ measure();
152
+ if (typeof ResizeObserver === "undefined")
153
+ return;
154
+ const observer = new ResizeObserver(() => {
155
+ measure();
156
+ setNarrow(root.offsetWidth > 0 && root.offsetWidth < 640);
157
+ });
158
+ observer.observe(root);
159
+ for (const child of probe.children)
160
+ observer.observe(child);
161
+ return () => observer.disconnect();
162
+ }, []);
163
+ // A month's rows share the height: as many lanes as fit under the day's number.
164
+ React.useLayoutEffect(() => {
165
+ const el = weeksRef.current;
166
+ if (!month || !el || typeof ResizeObserver === "undefined")
167
+ return;
168
+ const measure = () => {
169
+ const row = el.firstElementChild;
170
+ if (!row)
171
+ return;
172
+ const room = row.offsetHeight - metrics.lane - 8;
173
+ setMonthLanes(Math.max(1, Math.floor(room / metrics.lane)));
174
+ };
175
+ measure();
176
+ const observer = new ResizeObserver(measure);
177
+ observer.observe(el);
178
+ return () => observer.disconnect();
179
+ }, [month, metrics.lane, weeks.length]);
180
+ /* ── The items ───────────────────────────────────────────────────────────── */
181
+ const entries = React.useMemo(() => {
182
+ const out = new Map();
183
+ for (const item of items) {
184
+ const start = toWall(item.start);
185
+ const end = item.milestone ? start : Math.max(toWall(item.end), start);
186
+ const span = { start, end };
187
+ out.set(item.id, {
188
+ item,
189
+ span,
190
+ allDay: !item.milestone && isAllDay(span, item.allDay),
191
+ locked: readOnly || !!item.disabled,
192
+ });
193
+ }
194
+ return out;
195
+ }, [items, readOnly]);
196
+ /** An entry as drawn now: where a drag has it. */
197
+ const live = (entry) => drag && drag.id === entry.item.id ? { ...entry, span: drag.span, allDay: drag.allDay } : entry;
198
+ const liveEntries = [...entries.values()].map(live);
199
+ const inView = (e) => {
200
+ const s = e.allDay ? wholeDays(e.span) : e.span;
201
+ const span = month ? { start: weeks[0][0], end: weeks[weeks.length - 1][6] + DAY } : shownSpan;
202
+ return s.start < span.end && Math.max(s.end, s.start + 1) > span.start;
203
+ };
204
+ const visible = liveEntries
205
+ .filter(inView)
206
+ .sort((a, b) => a.span.start - b.span.start || b.span.end - a.span.end);
207
+ /* ── Words ────────────────────────────────────────────────────────────────── */
208
+ const when = (e) => e.allDay ? describeSpan(fmt, wholeDays(e.span), false) : describeSpan(fmt, e.span, !!e.item?.milestone);
209
+ /** A time as short as it can be said: "9 AM" on the hour, "9:30 AM" otherwise. */
210
+ const clockTime = (wall) => (wall % HOUR === 0 ? fmt.hour : fmt.time).format(wall);
211
+ const timeRange = (span) => span.end <= span.start ? fmt.time.format(span.start) : formatRange(fmt.time, span.start, span.end);
212
+ const title = month
213
+ ? fmt.month.format(startOfMonth(dateWall))
214
+ : days.length === 1
215
+ ? fmt.dayTitle.format(days[0])
216
+ : formatRange(narrow ? fmt.dayShort : fmt.rangeTitle, days[0], days[days.length - 1]);
217
+ // On a phone a day is said short: "Thu, Oct 1".
218
+ const shownTitle = narrow && !month && days.length === 1 ? fmt.dayLong.format(days[0]) : title;
219
+ /* ── Changing items ───────────────────────────────────────────────────────── */
220
+ const itemsRef = React.useRef(items);
221
+ itemsRef.current = items;
222
+ const entriesRef = React.useRef(entries);
223
+ entriesRef.current = entries;
224
+ /** After a change, the item to keep focus on (it may be drawn somewhere else now). */
225
+ const refocus = React.useRef(null);
226
+ const commit = (entry, span, change, source) => {
227
+ if (span.start === entry.span.start && span.end === entry.span.end)
228
+ return false;
229
+ const previous = entry.item;
230
+ const item = {
231
+ ...previous,
232
+ start: fromWall(span.start),
233
+ end: fromWall(previous.milestone ? span.start : span.end),
234
+ };
235
+ onItemsChange(itemsRef.current.map((i) => (i.id === item.id ? item : i)), { item, previous, change, source });
236
+ return true;
237
+ };
238
+ const itemEl = (id) => rootRef.current?.querySelector(`[data-slot=scheduler-item][data-id="${CSS.escape(id)}"]:not([data-continued])`) ?? null;
239
+ React.useLayoutEffect(() => {
240
+ const id = refocus.current;
241
+ if (!id)
242
+ return;
243
+ const el = itemEl(id);
244
+ if (!el)
245
+ return;
246
+ refocus.current = null;
247
+ if (document.activeElement !== el)
248
+ el.focus({ preventScroll: true });
249
+ el.scrollIntoView?.({ block: "nearest", inline: "nearest" });
250
+ });
251
+ /** The editor's view of an item. */
252
+ const editorValue = (item, allDay) => ({
253
+ title: item.title,
254
+ start: item.start,
255
+ end: item.end,
256
+ allDay,
257
+ row: item.row,
258
+ category: categoryOf(item, categories),
259
+ });
260
+ const open = (id) => {
261
+ const entry = entriesRef.current.get(id);
262
+ if (!entry)
263
+ return;
264
+ onItemOpen?.(entry.item);
265
+ // With the editor, an event that can change opens in it; a locked one shows its details.
266
+ if (editor && !entry.locked)
267
+ return setEditing({
268
+ kind: "event",
269
+ id,
270
+ milestone: !!entry.item.milestone,
271
+ value: editorValue(entry.item, entry.allDay),
272
+ });
273
+ if (renderDetails)
274
+ setOpenId(id);
275
+ };
276
+ /** A new event over `span`: to the editor, or to the app. */
277
+ const create = (span, allDay) => {
278
+ const draft = { start: fromWall(span.start), end: fromWall(span.end), allDay };
279
+ if (editor) {
280
+ setPending({ id: "", span, allDay });
281
+ setEditing({ kind: "event", value: { title: "", ...draft, row: undefined, category: undefined } });
282
+ return;
283
+ }
284
+ onItemCreate?.(draft);
285
+ announce(text.creating(allDay ? when({ span, allDay: true }) : describeSpan(fmt, span, false)));
286
+ };
287
+ const closeEditor = () => {
288
+ setEditing(null);
289
+ setPending(null);
290
+ };
291
+ /** Where an item is, said as it is read out. */
292
+ const whenOf = (item) => {
293
+ const start = toWall(item.start);
294
+ const span = { start, end: item.milestone ? start : Math.max(toWall(item.end), start) };
295
+ return when({ span, allDay: !item.milestone && isAllDay(span, item.allDay), item });
296
+ };
297
+ const saveEditor = (value) => {
298
+ const state = editing;
299
+ if (!state)
300
+ return;
301
+ const base = state.id ? entriesRef.current.get(state.id)?.item : undefined;
302
+ const id = base?.id ?? createId();
303
+ const item = editedItem(base, id, state, value, categories, !!categoriesProp);
304
+ const next = base ? itemsRef.current.map((i) => (i.id === id ? item : i)) : [...itemsRef.current, item];
305
+ onItemsChange(next, {
306
+ item,
307
+ previous: base ?? item,
308
+ change: base ? "edit" : "create",
309
+ source: "editor",
310
+ });
311
+ announce((base ? text.saved : text.created)(item.title, whenOf(item)));
312
+ closeEditor();
313
+ refocus.current = id;
314
+ const start = toWall(item.start);
315
+ follow({ start, end: start });
316
+ };
317
+ const deleteItem = (id, source) => {
318
+ const entry = entriesRef.current.get(id);
319
+ if (!entry || entry.locked)
320
+ return;
321
+ // Focus goes to the event after it (or before), not to the page.
322
+ const all = [
323
+ ...(rootRef.current?.querySelectorAll("[data-slot=scheduler-item][role=button]:not([data-continued])") ?? []),
324
+ ];
325
+ const at = all.findIndex((el) => el.dataset.id === id);
326
+ const neighbour = (all[at + 1] ?? all[at - 1])?.dataset.id;
327
+ onItemsChange(itemsRef.current.filter((i) => i.id !== id), { item: entry.item, previous: entry.item, change: "delete", source });
328
+ announce(text.deleted(entry.item.title));
329
+ closeEditor();
330
+ if (neighbour && source !== "pointer")
331
+ refocus.current = neighbour;
332
+ };
333
+ /** The menu of an event: edit it or delete it. */
334
+ const itemMenu = (id, anchor, returnFocus) => {
335
+ const entry = entriesRef.current.get(id);
336
+ if (!entry || !editor || entry.locked)
337
+ return false;
338
+ setMenu({
339
+ anchor,
340
+ label: text.itemMenu(entry.item.title),
341
+ returnFocus,
342
+ entries: [
343
+ { label: text.edit, onSelect: () => open(id) },
344
+ { label: text.delete, destructive: true, onSelect: () => deleteItem(id, "keyboard") },
345
+ ],
346
+ });
347
+ return true;
348
+ };
349
+ /** The menu of an empty slot: a new event there. */
350
+ const slotMenu = (span, allDay, at) => setMenu({
351
+ anchor: at,
352
+ label: text.slotMenu,
353
+ entries: [{ label: text.newEventHere, onSelect: () => create(span, allDay) }],
354
+ });
355
+ /** A change that takes an item out of the days shown brings its days into view. */
356
+ const follow = (span) => {
357
+ const start = startOfDay(span.start);
358
+ const range = month ? { start: weeks[0][0], end: weeks[weeks.length - 1][6] + DAY } : shownSpan;
359
+ if (start < range.start || start >= range.end)
360
+ onDate(fromWall(start));
361
+ };
362
+ const onKeyDown = (event) => {
363
+ const el = event.target.closest("[data-slot=scheduler-item]");
364
+ const id = el?.dataset.id;
365
+ const entry = id ? entries.get(id) : undefined;
366
+ if (!entry || !id || drag)
367
+ return;
368
+ if (editor && !entry.locked && (event.key === "Delete" || event.key === "Backspace")) {
369
+ event.preventDefault();
370
+ return deleteItem(id, "keyboard");
371
+ }
372
+ const grid = month || entry.allDay ? "days" : "time";
373
+ const action = calendarKeyAction(event, { grid, step, rtl, locked: entry.locked });
374
+ if (!action)
375
+ return;
376
+ event.preventDefault();
377
+ if (action.type === "open")
378
+ return open(id);
379
+ if (action.type === "focus") {
380
+ const all = [
381
+ ...(rootRef.current?.querySelectorAll("[data-slot=scheduler-item][role=button]:not([data-continued])") ?? []),
382
+ ];
383
+ (action.by === "first" ? all[0] : all[all.length - 1])?.focus();
384
+ return;
385
+ }
386
+ if (entry.item.milestone && action.type === "resize")
387
+ return;
388
+ const min = grid === "time" ? step * MINUTE : DAY;
389
+ const span = shiftSpan(entry.span, action, min);
390
+ const name = entry.item.title;
391
+ const change = action.type === "move" ? "move" : action.edge;
392
+ if (!commit(entry, span, change, "keyboard"))
393
+ return announce(text.unchanged(name, when(entry)));
394
+ announce((change === "move" ? text.moved : text.resized)(name, when({ ...entry, span })));
395
+ refocus.current = id;
396
+ // On a phone's month the list follows the event to its new day.
397
+ if (month && narrow)
398
+ setPickedDay(startOfDay(span.start));
399
+ follow(span);
400
+ };
401
+ /* ── Dragging ─────────────────────────────────────────────────────────────── */
402
+ const dragCleanup = React.useRef(null);
403
+ React.useEffect(() => () => dragCleanup.current?.(), []);
404
+ /** The moment under a point of the time grid, or the day under a point of the day cells. */
405
+ const hitTime = (x, y) => {
406
+ const el = gridRef.current;
407
+ if (!el)
408
+ return null;
409
+ const r = el.getBoundingClientRect();
410
+ const col = clamp(Math.floor(((rtl ? r.right - x : x - r.left) / r.width) * days.length), 0, days.length - 1);
411
+ return timeAt(days, col, y - r.top, ppm);
412
+ };
413
+ const hitDay = (x, y, surface) => {
414
+ const el = surface === "month" ? weeksRef.current : allDayRef.current;
415
+ if (!el)
416
+ return null;
417
+ const r = el.getBoundingClientRect();
418
+ const cols = surface === "month" ? 7 : days.length;
419
+ const col = clamp(Math.floor(((rtl ? r.right - x : x - r.left) / r.width) * cols), 0, cols - 1);
420
+ if (surface === "all-day")
421
+ return days[col] ?? null;
422
+ const row = clamp(Math.floor(((y - r.top) / r.height) * weeks.length), 0, weeks.length - 1);
423
+ return weeks[row]?.[col] ?? null;
424
+ };
425
+ /** The slot a point is in: its half hour, an hour long, or its day. */
426
+ const slotAt = (t, surface) => {
427
+ if (surface !== "time")
428
+ return { start: startOfDay(t), end: startOfDay(t) + DAY };
429
+ const start = snapTime(t, 30, "floor");
430
+ return { start, end: Math.min(start + HOUR, startOfDay(t) + DAY) };
431
+ };
432
+ /** A right click (or the menu key): an event's menu, or an empty slot's. */
433
+ const onContextMenu = (event, surface) => {
434
+ if (dragCleanup.current || loading)
435
+ return;
436
+ const native = event.nativeEvent;
437
+ // A long press is handled where the finger lifts.
438
+ if (native.pointerType === "touch")
439
+ return;
440
+ const target = event.target;
441
+ if (target.closest("button"))
442
+ return;
443
+ const point = { x: event.clientX, y: event.clientY };
444
+ const el = target.closest("[data-slot=scheduler-item]");
445
+ if (el) {
446
+ const r = el.getBoundingClientRect();
447
+ // From the keyboard the point is wherever the browser puts it: open beside the event.
448
+ const inside = point.x >= r.left - 1 && point.x <= r.right + 1 && point.y >= r.top - 1 && point.y <= r.bottom + 1;
449
+ if (el.dataset.id && itemMenu(el.dataset.id, inside ? point : el, el))
450
+ event.preventDefault();
451
+ return;
452
+ }
453
+ if (!canCreate)
454
+ return;
455
+ const t = surface === "time" ? hitTime(point.x, point.y) : hitDay(point.x, point.y, surface);
456
+ if (t === null)
457
+ return;
458
+ event.preventDefault();
459
+ slotMenu(slotAt(t, surface), surface !== "time", point);
460
+ };
461
+ const onPointerDown = (event, surface) => {
462
+ if (event.pointerType === "mouse" && event.button !== 0)
463
+ return;
464
+ if (dragCleanup.current || loading)
465
+ return;
466
+ const target = event.target;
467
+ // The "more" button and a day's heading do their own thing.
468
+ if (target.closest("button"))
469
+ return;
470
+ const el = target.closest("[data-slot=scheduler-item]");
471
+ const id = el?.dataset.id;
472
+ const entry = id ? entries.get(id) : undefined;
473
+ if (el && !entry)
474
+ return;
475
+ const creating = !entry;
476
+ if (creating && !canCreate)
477
+ return;
478
+ const touch = event.pointerType === "touch";
479
+ if (!touch) {
480
+ event.preventDefault();
481
+ (el ?? undefined)?.focus({ preventScroll: true });
482
+ }
483
+ const editable = creating || !entry.locked;
484
+ const edge = target.closest("[data-slot=scheduler-item-handle]")?.dataset.edge;
485
+ const kind = creating
486
+ ? "create"
487
+ : edge === "start"
488
+ ? "start"
489
+ : edge === "end"
490
+ ? "end"
491
+ : "move";
492
+ const hit = (x, y) => (surface === "time" ? hitTime(x, y) : hitDay(x, y, surface));
493
+ const t0 = hit(event.clientX, event.clientY);
494
+ if (t0 === null)
495
+ return;
496
+ const origin = entry?.span ?? { start: t0, end: t0 };
497
+ const allDay = surface !== "time" ? (entry ? entry.allDay || month : true) : false;
498
+ const startX = event.clientX;
499
+ const startY = event.clientY;
500
+ let pointer = { x: startX, y: startY };
501
+ let active = false;
502
+ /** The farthest the pointer went from where it went down. */
503
+ let travelled = 0;
504
+ let span = origin;
505
+ let frame = 0;
506
+ let last = 0;
507
+ let timer = 0;
508
+ let scrollers = [];
509
+ const scrollSurface = (surface === "month" ? weeksRef.current : gridRef.current) ?? rootRef.current;
510
+ const compute = () => {
511
+ const t = hit(pointer.x, pointer.y) ?? t0;
512
+ if (surface === "time") {
513
+ if (kind === "create")
514
+ return draftSpan(t0, t, step);
515
+ if (kind === "move") {
516
+ const start = snapTime(origin.start + (t - t0), step);
517
+ return { start, end: start + (origin.end - origin.start) };
518
+ }
519
+ if (kind === "end")
520
+ return { start: origin.start, end: Math.max(snapTime(t, step), origin.start + step * MINUTE) };
521
+ return { start: Math.min(snapTime(t, step), origin.end - step * MINUTE), end: origin.end };
522
+ }
523
+ // Whole days: in the all-day row, and on the month.
524
+ const day = startOfDay(t);
525
+ const from = startOfDay(t0);
526
+ if (kind === "create")
527
+ return { start: Math.min(day, from), end: Math.max(day, from) + DAY };
528
+ const days = Math.round((day - from) / DAY) * DAY;
529
+ if (kind === "move")
530
+ return { start: origin.start + days, end: origin.end + days };
531
+ const whole = entry?.allDay ? wholeDays(origin) : origin;
532
+ if (kind === "end")
533
+ return { start: origin.start, end: Math.max(whole.end + days, whole.start + DAY) };
534
+ return { start: Math.min(whole.start + days, whole.end - DAY), end: origin.end };
535
+ };
536
+ const tick = (time) => {
537
+ const dt = last ? Math.min(time - last, 32) : 16;
538
+ last = time;
539
+ autoScroll(scrollers, pointer.x, pointer.y, dt);
540
+ const next = compute();
541
+ if (next.start !== span.start || next.end !== span.end) {
542
+ span = next;
543
+ setDrag({ id: id ?? "", span, allDay: entry ? entry.allDay : allDay });
544
+ }
545
+ frame = requestAnimationFrame(tick);
546
+ };
547
+ const begin = () => {
548
+ active = true;
549
+ scrollers = scrollersOf(scrollSurface);
550
+ document.body.style.userSelect = "none";
551
+ document.body.style.cursor =
552
+ kind === "move" ? "grabbing" : surface === "time" ? "ns-resize" : "ew-resize";
553
+ span = compute();
554
+ setDrag({ id: id ?? "", span, allDay: entry ? entry.allDay : allDay });
555
+ if (entry)
556
+ announce(text.pickedUp(entry.item.title, when(entry)));
557
+ if (touch)
558
+ navigator.vibrate?.(10);
559
+ frame = requestAnimationFrame(tick);
560
+ };
561
+ const detach = () => {
562
+ clearTimeout(timer);
563
+ cancelAnimationFrame(frame);
564
+ window.removeEventListener("pointermove", onMove);
565
+ window.removeEventListener("pointerup", onUp);
566
+ window.removeEventListener("pointercancel", onCancel);
567
+ window.removeEventListener("touchmove", onTouchMove);
568
+ window.removeEventListener("keydown", onKey, true);
569
+ window.removeEventListener("contextmenu", onContextMenu, true);
570
+ document.body.style.userSelect = "";
571
+ document.body.style.cursor = "";
572
+ dragCleanup.current = null;
573
+ };
574
+ const end = (drop) => {
575
+ const was = active;
576
+ detach();
577
+ if (!was)
578
+ return;
579
+ span = compute();
580
+ setDrag(null);
581
+ if (!entry) {
582
+ if (!drop)
583
+ return;
584
+ // A long press let go where it began is a touch's right click: the slot's menu.
585
+ if (touch && travelled < TOUCH_SLOP) {
586
+ return slotMenu(slotAt(t0, surface), surface !== "time", pointer);
587
+ }
588
+ return create(span, surface !== "time");
589
+ }
590
+ const name = entry.item.title;
591
+ if (!drop)
592
+ return announce(text.cancelled(name, when(entry)));
593
+ const change = kind === "move" ? "move" : kind === "start" ? "start" : "end";
594
+ if (!commit(entry, span, change, "pointer"))
595
+ return announce(text.unchanged(name, when(entry)));
596
+ announce((change === "move" ? text.moved : text.resized)(name, when({ ...entry, span })));
597
+ refocus.current = entry.item.id;
598
+ };
599
+ const onMove = (e) => {
600
+ if (e.pointerId !== event.pointerId)
601
+ return;
602
+ if (e.pointerType === "mouse" && e.buttons === 0)
603
+ return end(false);
604
+ pointer = { x: e.clientX, y: e.clientY };
605
+ const moved = Math.hypot(pointer.x - startX, pointer.y - startY);
606
+ travelled = Math.max(travelled, moved);
607
+ if (active)
608
+ return;
609
+ if (touch) {
610
+ if (moved > TOUCH_SLOP)
611
+ detach(); // a scroll, not a drag
612
+ return;
613
+ }
614
+ if (moved >= DRAG_THRESHOLD) {
615
+ if (editable)
616
+ begin();
617
+ else
618
+ detach();
619
+ }
620
+ };
621
+ const onUp = (e) => {
622
+ if (e.pointerId !== event.pointerId)
623
+ return;
624
+ pointer = { x: e.clientX, y: e.clientY };
625
+ if (active)
626
+ return end(true);
627
+ detach();
628
+ const still = Math.hypot(pointer.x - startX, pointer.y - startY) < (touch ? TOUCH_SLOP : DRAG_THRESHOLD);
629
+ if (!still)
630
+ return;
631
+ // A click on an item opens it. One on empty space does nothing: a new event is drawn, or
632
+ // made from the slot's menu (a right click, or a long press).
633
+ if (entry)
634
+ return open(entry.item.id);
635
+ };
636
+ const onCancel = (e) => {
637
+ if (e.pointerId === event.pointerId)
638
+ end(false);
639
+ };
640
+ const onTouchMove = (e) => {
641
+ if (active && e.cancelable)
642
+ e.preventDefault();
643
+ };
644
+ const onContextMenu = (e) => {
645
+ if (touch)
646
+ e.preventDefault();
647
+ };
648
+ const onKey = (e) => {
649
+ if (e.key !== "Escape" || !active)
650
+ return;
651
+ e.preventDefault();
652
+ e.stopPropagation();
653
+ end(false);
654
+ };
655
+ window.addEventListener("pointermove", onMove);
656
+ window.addEventListener("pointerup", onUp);
657
+ window.addEventListener("pointercancel", onCancel);
658
+ window.addEventListener("touchmove", onTouchMove, { passive: false });
659
+ window.addEventListener("keydown", onKey, true);
660
+ window.addEventListener("contextmenu", onContextMenu, true);
661
+ dragCleanup.current = () => end(false);
662
+ if (touch && editable)
663
+ timer = window.setTimeout(begin, LONG_PRESS);
664
+ };
665
+ /* ── Scroll to the working day ───────────────────────────────────────────── */
666
+ const viewportOf = () => rootRef.current?.querySelector("[data-slot=scroll-area-viewport]") ?? null;
667
+ React.useLayoutEffect(() => {
668
+ if (month)
669
+ return;
670
+ const vp = viewportOf();
671
+ if (!vp)
672
+ return;
673
+ // The start of the working day, or the first event before it.
674
+ let hour = workHours.start;
675
+ for (const e of visible)
676
+ if (!e.allDay)
677
+ hour = Math.min(hour, ((e.span.start - startOfDay(e.span.start)) / HOUR) | 0);
678
+ vp.scrollTop = Math.max(0, hour * metrics.hour - 8);
679
+ // Only when the grid appears and when its hour changes size, not as items move.
680
+ // eslint-disable-next-line react-hooks/exhaustive-deps
681
+ }, [month, metrics.hour, loading]);
682
+ /* ── Drawing ──────────────────────────────────────────────────────────────── */
683
+ const role = text.eventRole;
684
+ const describedBy = (grid) => readOnly ? timeInstructions : grid === "time" ? timeInstructions : dayInstructions;
685
+ const label = (e) => [e.item.title, when(e), e.item.disabled ? text.locked : undefined].filter(Boolean).join(", ");
686
+ const openEntry = openId ? entries.get(openId) : undefined;
687
+ const isToday = (day) => nowWall >= day && nowWall < day + DAY;
688
+ const isWeekend = (day) => week.weekend.includes(weekdayOf(day));
689
+ const draft = drag && drag.id === "" ? drag : pending;
690
+ /** The frame's look, shared by the views. */
691
+ const frame = cn("@container/scheduler relative flex h-[min(36rem,80svh)] w-full min-w-0 flex-col overflow-hidden font-body", variant === "card" ? "surface-card [--card-padding:0]" : "surface-container", className);
692
+ /*
693
+ * The header: the period in Licht, then the way through time (‹ Today ›) and the views. On a
694
+ * phone the period and the arrows share the first line and the views take the second.
695
+ */
696
+ const header = (_jsxs("div", { "data-slot": "scheduler-toolbar", className: "flex flex-wrap items-center gap-x-3 gap-y-2 border-b border-border/(--hairline-opacity) px-3 py-2", children: [toolbar && (_jsx("div", { className: "flex min-w-0 items-center gap-2 @max-[40rem]/scheduler:basis-full", children: toolbar })), _jsx("h2", { "data-slot": "scheduler-title", "aria-live": "polite", className: "min-w-0 flex-1 truncate ps-1 font-heading text-22 leading-tight text-foreground @max-[40rem]/scheduler:text-20", children: shownTitle }), controls && (_jsxs("div", { "data-slot": "scheduler-nav", className: "flex items-center gap-1", children: [_jsx(Button, { "data-slot": "scheduler-previous", variant: "ghost", size: "icon", "aria-label": text.previous, onClick: () => onDate(fromWall(stepDate(view, dateWall, -1, dayCount))), children: _jsx(ChevronLeftIcon, { className: "rtl:-scale-x-100" }) }), _jsx(Button, { "data-slot": "scheduler-today", variant: "secondary", onClick: () => onDate(fromWall(startOfDay(nowWall))), children: text.today }), _jsx(Button, { "data-slot": "scheduler-next", variant: "ghost", size: "icon", "aria-label": text.next, onClick: () => onDate(fromWall(stepDate(view, dateWall, 1, dayCount))), children: _jsx(ChevronRightIcon, { className: "rtl:-scale-x-100" }) })] })), viewSwitch && (_jsx("div", { className: "flex max-w-full min-w-0 items-center @max-[40rem]/scheduler:basis-full [&>*]:max-w-full", children: viewSwitch }))] }));
697
+ /* ── An event ─────────────────────────────────────────────────────────────── */
698
+ /** Over before now: drawn a little quieter. */
699
+ const isPast = (e) => (e.allDay ? wholeDays(e.span).end : Math.max(e.span.end, e.span.start + 1)) <= nowWall;
700
+ const eventClasses = (e, dragging) => cn("group/item absolute flex touch-manipulation overflow-hidden rounded-item outline-none select-none [-webkit-touch-callout:none]", "focus-visible:z-30 focus-visible:outline-2 focus-visible:outline-offset-0 focus-visible:outline-control-focus focus-visible:outline-solid", !e.locked && "cursor-grab active:cursor-grabbing", eventLook({ tone: e.item.tone, disabled: e.item.disabled, past: isPast(e) && !dragging }),
701
+ // Open, or in hand: lifted off the grid.
702
+ (dragging || openId === e.item.id || editing?.id === e.item.id) && "z-20 shadow-overlay");
703
+ /** The stripe of a coloured event, quieter in the past. */
704
+ const stripe = (e) => e.item.tone && (_jsx("span", { "aria-hidden": true, "data-slot": "scheduler-item-stripe", className: cn(stripeClass, isPast(e) && "opacity-50") }));
705
+ /** Its name: the ink, a little softer once it is over, muted when locked. */
706
+ const nameInk = (e) => e.item.disabled
707
+ ? "text-muted-foreground forced-colors:text-[GrayText]"
708
+ : isPast(e)
709
+ ? "text-foreground-soft"
710
+ : "text-foreground";
711
+ const handles = (e, axis, first, lastPart) => !e.locked &&
712
+ !e.item.milestone && (_jsxs(_Fragment, { children: [first && (_jsx("span", { "aria-hidden": true, "data-slot": "scheduler-item-handle", "data-edge": "start", className: axis === "y"
713
+ ? "absolute inset-x-0 top-0 h-1.5 cursor-ns-resize pointer-coarse:h-3"
714
+ : "absolute inset-y-0 start-0 w-2 cursor-ew-resize pointer-coarse:w-3" })), lastPart && (_jsx("span", { "aria-hidden": true, "data-slot": "scheduler-item-handle", "data-edge": "end", className: axis === "y"
715
+ ? "absolute inset-x-0 bottom-0 h-1.5 cursor-ns-resize pointer-coarse:h-3"
716
+ : "absolute inset-y-0 end-0 w-2 cursor-ew-resize pointer-coarse:w-3" }))] }));
717
+ const itemProps = (e, grid, continued) => continued
718
+ ? { "aria-hidden": true, "data-continued": "", tabIndex: -1 }
719
+ : {
720
+ role: "button",
721
+ tabIndex: 0,
722
+ "aria-roledescription": role,
723
+ "aria-label": label(e),
724
+ "aria-describedby": describedBy(grid),
725
+ "aria-disabled": e.item.disabled || undefined,
726
+ };
727
+ /** A bar across days: the all-day row and the month's long events. */
728
+ const dayBar = (e, from, to, cols, top, key, rowStart) => {
729
+ const dragging = drag?.id === e.item.id;
730
+ // A timed event over several days says its time where it starts.
731
+ const startsHere = startOfDay(e.span.start) === rowStart + from * DAY;
732
+ const timed = !e.allDay;
733
+ // On the month, a bar carried over from the week before is the same event again: one is enough
734
+ // for the keyboard and the screen reader.
735
+ const continued = month && startOfDay(e.span.start) < rowStart;
736
+ return (_jsxs("div", { ...itemProps(e, "days", continued), "data-slot": "scheduler-item", "data-id": e.item.id, "data-tone": e.item.tone, "data-all-day": "", "data-disabled": e.item.disabled ? "" : undefined, "data-dragging": dragging ? "" : undefined, className: cn(eventClasses(e, dragging), "items-center gap-1.5 pe-2 text-12", e.item.tone && !continued ? "ps-2.5" : "ps-2"), style: {
737
+ insetInlineStart: `calc(${(from / cols) * 100}% + 2px)`,
738
+ width: `calc(${((to - from + 1) / cols) * 100}% - 5px)`,
739
+ top,
740
+ height: metrics.lane - 3,
741
+ }, children: [!continued && stripe(e), _jsx("span", { className: cn("min-w-0 truncate font-medium", nameInk(e)), children: e.item.title }), timed && startsHere && _jsx(TimeText, { className: "shrink-0", time: clockTime(e.span.start) }), handles(e, "x", true, true)] }, key));
742
+ };
743
+ /** An event within a day on the month: a dot, its time and its name, no fill. */
744
+ const monthChip = (e, from, top, key) => {
745
+ const dragging = drag?.id === e.item.id;
746
+ return (_jsxs("div", { ...itemProps(e, "days", false), "data-slot": "scheduler-item", "data-id": e.item.id, "data-tone": e.item.tone, "data-disabled": e.item.disabled ? "" : undefined, "data-dragging": dragging ? "" : undefined, className: cn("group/item absolute flex touch-manipulation items-center gap-1.5 overflow-hidden rounded-item px-1.5 text-12 outline-none select-none [-webkit-touch-callout:none]", "transition-colors duration-(--duration-fade) ease-(--ease) hover:bg-control-hover", "focus-visible:z-30 focus-visible:outline-2 focus-visible:outline-control-focus focus-visible:outline-solid", !e.locked && "cursor-grab active:cursor-grabbing", dragging && "z-20 bg-field-surface shadow-overlay"), style: {
747
+ insetInlineStart: `calc(${(from / 7) * 100}% + 2px)`,
748
+ width: `calc(${100 / 7}% - 5px)`,
749
+ top,
750
+ height: metrics.lane - 2,
751
+ }, children: [_jsx("span", { "aria-hidden": true, className: cn("size-1.5 shrink-0 rounded-full", e.item.tone ? markTones[e.item.tone] : "bg-foreground/60") }), !narrow && _jsx(TimeText, { className: "shrink-0", time: clockTime(e.span.start) }), _jsx("span", { className: cn("min-w-0 flex-1 truncate", e.item.disabled ? "text-muted-foreground forced-colors:text-[GrayText]" : "text-foreground"), children: e.item.title })] }, key));
752
+ };
753
+ /* ── The time grid ────────────────────────────────────────────────────────── */
754
+ const timeGrid = () => {
755
+ const n = days.length;
756
+ const allDays = visible.filter((e) => e.allDay);
757
+ const allPlaces = packWeek(days, allDays.map((e) => ({ id: e.item.id, span: e.span, allDay: true })));
758
+ const allLanes = Math.max(1, ...[...allPlaces.values()].map((p) => p.lane + 1));
759
+ const draftAllDay = draft?.allDay ? draft : null;
760
+ const draftTime = draft && !draft.allDay ? draft : null;
761
+ // Timed events, a part a day, laid side by side where they overlap.
762
+ const timed = visible.filter((e) => !e.allDay);
763
+ const parts = [];
764
+ for (const e of timed)
765
+ for (const seg of daySegments(e.span, days, MIN_EVENT))
766
+ parts.push({ e, ...seg });
767
+ const byDay = new Map();
768
+ for (const p of parts)
769
+ byDay.set(p.day, [...(byDay.get(p.day) ?? []), p]);
770
+ const place = new Map();
771
+ // Beside one another when they start within this of each other: room for a name above the next.
772
+ const near = Math.ceil(NEAR_PX / ppm);
773
+ for (const list of byDay.values()) {
774
+ const placed = layoutDay(list.map((p, i) => ({ id: String(i), start: p.top, end: p.bottom })), near);
775
+ list.forEach((p, i) => place.set(p, placed.get(String(i))));
776
+ }
777
+ const columns = `var(--scheduler-gutter) repeat(${n}, minmax(${n > 1 ? "5.5rem" : "0"}, 1fr))`;
778
+ const todayIndex = days.findIndex(isToday);
779
+ const nowY = ((nowWall - startOfDay(nowWall)) / MINUTE) * ppm;
780
+ return (_jsx(ScrollArea, { orientation: "both", fade: false, className: "size-full", children: _jsxs("div", { "data-slot": "scheduler-calendar", className: "min-w-fit", onKeyDown: onKeyDown, children: [_jsxs("div", { className: "sticky top-0 z-20 border-b border-border/(--hairline-opacity) bg-field-surface", children: [_jsxs("div", { className: "grid", style: { gridTemplateColumns: columns }, children: [_jsx("div", { className: "sticky start-0 z-10 bg-field-surface" }), days.map((day) => {
781
+ const today = isToday(day);
782
+ const heading = (_jsxs(_Fragment, { children: [_jsx(TimeText, { className: "eyebrow text-11 tracking-[0.12em]", time: fmt.weekday.format(day) }), _jsx("span", { className: cn("grid min-w-7 place-items-center rounded-full px-1 font-mono text-17 leading-7 tabular-nums", today ? "bg-foreground text-background" : "text-foreground"), children: fmt.dayNumber.format(day) })] }));
783
+ return (_jsx("div", { "data-slot": "scheduler-day", "data-today": today ? "" : undefined, className: "flex min-w-0 items-center justify-center border-s border-border/(--hairline-opacity) py-1.5", children: onShowDay && n > 1 ? (_jsx("button", { type: "button", "aria-label": text.showDay(fmt.dayFull.format(day)), "aria-current": today ? "date" : undefined, onClick: () => onShowDay(fromWall(day)), className: "flex items-center gap-2 rounded-item px-2 py-0.5 transition-colors duration-(--duration-fade) ease-(--ease) hover:bg-control-hover", children: heading })) : (_jsx("div", { className: "flex items-center gap-2 px-2 py-0.5", "aria-current": today ? "date" : undefined, children: heading })) }, day));
784
+ })] }), _jsxs("div", { className: "grid border-t border-border/(--hairline-opacity)", style: { gridTemplateColumns: columns }, children: [_jsx("div", { className: "sticky start-0 z-10 flex items-start justify-end bg-field-surface pe-2 pt-1.5", children: _jsx("span", { className: "font-mono text-11 leading-none text-muted-foreground", children: text.allDay }) }), _jsxs("div", { ref: allDayRef, "data-slot": "scheduler-all-day", className: "relative", style: { gridColumn: `span ${n}`, height: allLanes * metrics.lane + 6 }, onPointerDown: (e) => onPointerDown(e, "all-day"), onContextMenu: (e) => onContextMenu(e, "all-day"), children: [days.map((day, i) => (_jsx("div", { "aria-hidden": true, className: cn("absolute inset-y-0 border-s border-border/(--hairline-opacity)", isWeekend(day) && n > 1 && "bg-control-surface"), style: { insetInlineStart: `${(i / n) * 100}%`, width: `${100 / n}%` } }, day))), allDays.map((e) => {
785
+ const p = allPlaces.get(e.item.id);
786
+ return p
787
+ ? dayBar(e, p.from, p.to, n, 3 + p.lane * metrics.lane, e.item.id, days[0])
788
+ : null;
789
+ }), draftAllDay &&
790
+ (() => {
791
+ const p = packWeek(days, [{ id: "", span: draftAllDay.span, allDay: true }]).get("");
792
+ return p ? (_jsx("div", { "aria-hidden": true, "data-slot": "scheduler-draft", className: "absolute z-20 flex items-center rounded-item border border-dashed border-control-focus bg-control-hover px-2 text-12 text-foreground", style: {
793
+ insetInlineStart: `calc(${(p.from / n) * 100}% + 2px)`,
794
+ width: `calc(${((p.to - p.from + 1) / n) * 100}% - 5px)`,
795
+ top: 3,
796
+ height: metrics.lane - 2,
797
+ }, children: _jsx("span", { className: "truncate", children: text.newItem }) })) : null;
798
+ })()] })] })] }), _jsxs("div", { className: "grid", style: { gridTemplateColumns: columns }, children: [_jsxs("div", { "aria-hidden": true, className: "sticky start-0 z-10 bg-field-surface", style: { height: 24 * metrics.hour }, children: [Array.from({ length: 23 }, (_, i) => (_jsx("span", { className: cn("absolute end-2 -translate-y-1/2 font-mono text-11 whitespace-nowrap text-muted-foreground tabular-nums [unicode-bidi:plaintext]",
799
+ // The now label takes the place of an hour it would cover.
800
+ todayIndex >= 0 && Math.abs(nowY - (i + 1) * metrics.hour) < 12 && "invisible"), style: { top: (i + 1) * metrics.hour }, children: fmt.hour.format((i + 1) * HOUR) }, i))), todayIndex >= 0 && (_jsx("span", { "data-slot": "scheduler-now-label", className: "absolute end-1 z-10 -translate-y-1/2 bg-field-surface px-1 font-mono text-11 leading-4 font-medium whitespace-nowrap text-foreground tabular-nums [unicode-bidi:plaintext]", style: { top: nowY }, children: fmt.time.format(nowWall) }))] }), _jsxs("div", { ref: gridRef, "data-slot": "scheduler-time-grid", className: "relative isolate", style: { gridColumn: `span ${n}`, height: 24 * metrics.hour }, onPointerDown: (e) => onPointerDown(e, "time"), onContextMenu: (e) => onContextMenu(e, "time"), children: [_jsxs("div", { "aria-hidden": true, className: "pointer-events-none absolute inset-0", children: [days.map((day, i) => (_jsx("div", { className: cn("absolute inset-y-0 border-s border-border/(--hairline-opacity)", isWeekend(day) && n > 1 && "bg-control-surface"), style: { insetInlineStart: `${(i / n) * 100}%`, width: `${100 / n}%` }, children: !isWeekend(day) && (_jsxs(_Fragment, { children: [_jsx("div", { "data-slot": "scheduler-off-hours", className: "absolute inset-x-0 top-0 bg-control-surface/70", style: { height: workHours.start * metrics.hour } }), _jsx("div", { "data-slot": "scheduler-off-hours", className: "absolute inset-x-0 bottom-0 bg-control-surface/70", style: { top: workHours.end * metrics.hour } })] })) }, day))), Array.from({ length: 23 }, (_, i) => (_jsx("div", { className: "absolute inset-x-0 h-px bg-border/(--hairline-opacity)", style: { top: (i + 1) * metrics.hour } }, i)))] }), loading
801
+ ? days.slice(0, 5).map((day, i) => (_jsx(Skeleton, { shape: "item", className: "absolute", style: {
802
+ insetInlineStart: `calc(${(i / n) * 100}% + 2px)`,
803
+ width: `calc(${100 / n}% - 8px)`,
804
+ top: (workHours.start + 1 + ((i * 3) % 5)) * metrics.hour,
805
+ height: metrics.hour * (1 + (i % 2)),
806
+ } }, day)))
807
+ : parts.map((p) => {
808
+ const pl = place.get(p);
809
+ const { e } = p;
810
+ const dragging = drag?.id === e.item.id;
811
+ const minutes = p.bottom - p.top;
812
+ // A pixel apart from the next one: at least 24px, a target a finger or a
813
+ // pointer can take (WCAG 2.5.8).
814
+ const height = Math.max(minutes * ppm - 1, 24);
815
+ const short = height < TWO_LINES;
816
+ const continued = !p.first;
817
+ // How many lines the name may take above its time.
818
+ const lines = Math.max(1, Math.floor((height - 9 - LINE) / LINE));
819
+ return (_jsxs("div", { ...itemProps(e, "time", continued), "data-slot": "scheduler-item", "data-id": e.item.id, "data-tone": e.item.tone, "data-disabled": e.item.disabled ? "" : undefined, "data-dragging": dragging ? "" : undefined, "data-stacked": pl.stacked && !dragging ? "" : undefined, "data-past": isPast(e) ? "" : undefined, className: cn(eventClasses(e, dragging),
820
+ // Its width decides what shows of its time (see below).
821
+ "@container/event text-12 leading-[15px]",
822
+ // Drawn over another: a line of the ground between them.
823
+ "data-stacked:outline-1 data-stacked:outline-offset-0 data-stacked:outline-field-surface data-stacked:outline-solid", e.item.tone ? "ps-2" : "ps-1.5", "pe-1.5", short ? "items-center" : "flex-col items-stretch pt-1"), style: eventBox(p.day, n, pl, p.top * ppm + 1, height), children: [stripe(e), short ? (_jsxs("span", { className: "flex h-[15px] min-w-0 flex-1 flex-wrap items-baseline overflow-hidden", children: [_jsx("span", { className: cn("max-w-full min-w-0 truncate font-medium [unicode-bidi:plaintext]", nameInk(e)), children: e.item.title }), _jsx("span", { "aria-hidden": true, className: "whitespace-pre text-muted-foreground before:content-[',_']", children: _jsx(TimeText, { time: clockTime(e.span.start) }) })] })) : (_jsxs(_Fragment, { children: [_jsx("span", { className: cn("min-w-0 font-medium text-ellipsis [unicode-bidi:plaintext]", lines === 1 ? "truncate" : "overflow-hidden", nameInk(e)), style: lines > 1
824
+ ? {
825
+ display: "-webkit-box",
826
+ WebkitBoxOrient: "vertical",
827
+ WebkitLineClamp: lines,
828
+ }
829
+ : undefined, children: e.item.title }), _jsx(TimeText, { className: cn("truncate", TIME_FITS[fitOf(timeRange(e.span))].range), time: timeRange(e.span) }), _jsx(TimeText, { className: cn("truncate", TIME_FITS[fitOf(timeRange(e.span))].start), time: clockTime(e.span.start) })] })), handles(e, "y", p.first, p.last)] }, `${e.item.id}:${p.first ? "first" : p.day}`));
830
+ }), todayIndex >= 0 && n > 1 && (_jsx("div", { "aria-hidden": true, className: "pointer-events-none absolute inset-x-0 z-10 h-px bg-foreground/25", style: { top: nowY } })), todayIndex >= 0 && (_jsx("div", { "aria-hidden": true, "data-slot": "scheduler-now-line", className: "pointer-events-none absolute z-10 h-[1.5px] -translate-y-1/2 bg-foreground forced-colors:bg-[CanvasText]", style: { top: nowY, insetInlineStart: `${(todayIndex / n) * 100}%`, width: `${100 / n}%` }, children: _jsx("span", { className: "absolute -start-1 top-1/2 size-2 -translate-y-1/2 rounded-full bg-foreground ring-2 ring-field-surface forced-colors:bg-[CanvasText]" }) })), draftTime &&
831
+ daySegments(draftTime.span, days).map((seg) => (_jsxs("div", { "aria-hidden": true, "data-slot": "scheduler-draft", className: "absolute z-20 flex flex-col gap-0.5 overflow-hidden rounded-item border border-dashed border-control-focus bg-control-hover px-1.5 py-1 text-12 leading-tight", style: {
832
+ insetInlineStart: `calc(${(seg.day / n) * 100}% + 1px)`,
833
+ width: `calc(${100 / n}% - 6px)`,
834
+ top: seg.top * ppm + 1,
835
+ height: Math.max((seg.bottom - seg.top) * ppm - 2, 14),
836
+ }, children: [_jsx("span", { className: "font-medium text-foreground", children: text.newItem }), _jsx("span", { className: "font-mono text-11 text-muted-foreground tabular-nums", children: timeRange(draftTime.span) })] }, seg.day)))] })] })] }) }));
837
+ };
838
+ /* ── The month ────────────────────────────────────────────────────────────── */
839
+ /*
840
+ * A phone's month: the weeks as numbers with a dot for each event (up to three), and under them
841
+ * the picked day's events as a list, as a phone's own calendar does. A day is picked with a tap;
842
+ * an event opens with one. Events move from the keyboard as on the month; dragging is left to
843
+ * the wider views.
844
+ */
845
+ const compactMonth = () => {
846
+ const shownMonth = startOfMonth(dateWall);
847
+ const all = weeks.flat();
848
+ // Today, when it is in the month shown; else the day the view went to.
849
+ const fallback = startOfMonth(nowWall) === shownMonth ? startOfDay(nowWall) : startOfDay(dateWall);
850
+ const picked = pickedDay !== null && all.includes(pickedDay) ? pickedDay : fallback;
851
+ const on = (day) => visible.filter((e) => {
852
+ const s = e.allDay ? wholeDays(e.span) : e.span;
853
+ return s.start < day + DAY && Math.max(s.end, s.start + 1) > day;
854
+ });
855
+ const listed = on(picked).sort((a, b) => Number(b.allDay) - Number(a.allDay) || a.span.start - b.span.start);
856
+ return (_jsxs("div", { "data-slot": "scheduler-calendar", className: "flex size-full flex-col", onKeyDown: onKeyDown, children: [_jsx("div", { "aria-hidden": true, className: "grid grid-cols-7 border-b border-border/(--hairline-opacity)", children: weeks[0].map((day) => (_jsx("div", { className: "truncate py-1.5 text-center eyebrow text-11 tracking-[0.12em]", children: fmt.weekday.format(day) }, day))) }), _jsx("div", { "data-slot": "scheduler-month", className: "grid shrink-0 grid-cols-7 px-1 py-1", children: all.map((day) => {
857
+ const outside = startOfMonth(day) !== shownMonth;
858
+ const today = isToday(day);
859
+ const chosen = day === picked;
860
+ const dots = on(day);
861
+ return (_jsxs("button", { type: "button", "data-slot": "scheduler-day", "data-today": today ? "" : undefined, "data-outside": outside ? "" : undefined, "data-picked": chosen ? "" : undefined, "aria-label": fmt.dayFull.format(day), "aria-pressed": chosen, "aria-current": today ? "date" : undefined, onClick: () => setPickedDay(day), className: "group/day flex h-11 flex-col items-center justify-start gap-1 rounded-item pt-1 outline-none focus-visible:outline-2 focus-visible:outline-offset-0 focus-visible:outline-control-focus focus-visible:outline-solid", children: [_jsx("span", { className: cn("grid size-7 place-items-center rounded-full font-mono text-13 tabular-nums transition-colors duration-(--duration-fade) ease-(--ease)", today
862
+ ? "bg-foreground text-background"
863
+ : chosen
864
+ ? "bg-control-hover text-foreground ring-1 ring-field-edge"
865
+ : outside
866
+ ? "text-muted-foreground"
867
+ : "text-foreground group-hover/day:bg-control-hover"), children: fmt.dayNumber.format(day) }), _jsx("span", { "aria-hidden": true, className: "flex h-1.5 items-center gap-0.5", children: dots.slice(0, 3).map((e) => (_jsx("span", { className: cn("size-1.5 rounded-full forced-colors:bg-[CanvasText]", e.item.tone ? markTones[e.item.tone] : "bg-foreground/45") }, e.item.id))) })] }, day));
868
+ }) }), _jsxs("div", { className: "flex min-h-0 flex-1 flex-col border-t border-border/(--hairline-opacity)", children: [_jsxs("div", { className: "flex items-center justify-between gap-2 ps-3 pe-1.5 pt-2 pb-1", children: [_jsx("h3", { "data-slot": "scheduler-day-title", className: "truncate eyebrow text-11 tracking-[0.12em]", children: fmt.dayFull.format(picked) }), onShowDay && (_jsx(Button, { variant: "ghost", size: "icon-sm", "aria-label": text.showDay(fmt.dayFull.format(picked)), onClick: () => onShowDay(fromWall(picked)), children: _jsx(ChevronRightIcon, { className: "rtl:-scale-x-100" }) }))] }), _jsx(ScrollArea, { className: "min-h-0 flex-1", children: listed.length === 0 ? (_jsx("p", { className: "px-3 py-2 text-13 text-muted-foreground", children: text.nothingOnDay })) : (_jsx("ul", { "data-slot": "scheduler-day-list", className: "flex flex-col px-1.5 pb-2", children: listed.map((e) => (_jsx("li", { children: _jsxs("div", { ...itemProps(e, "days", false), "data-slot": "scheduler-item", "data-id": e.item.id, "data-tone": e.item.tone, "data-disabled": e.item.disabled ? "" : undefined, "data-past": isPast(e) ? "" : undefined, onClick: () => open(e.item.id), className: cn("relative flex min-h-(--control-h) cursor-pointer touch-manipulation items-center gap-3 rounded-item px-2 py-1.5 text-13 outline-none select-none", "transition-colors duration-(--duration-fade) ease-(--ease) hover:bg-control-hover", "focus-visible:outline-2 focus-visible:outline-offset-0 focus-visible:outline-control-focus focus-visible:outline-solid", e.item.tone && toneVars[e.item.tone]), children: [_jsx(TimeText, { className: "w-16 shrink-0 text-11", time: e.allDay ? text.allDay : clockTime(e.span.start) }), _jsx("span", { "aria-hidden": true, className: cn("h-5 w-[3px] shrink-0 rounded-full forced-colors:bg-[CanvasText]", e.item.tone ? "bg-(--event)" : "bg-foreground/30", isPast(e) && "opacity-50", e.item.disabled && "bg-transparent outline-1 outline-field-edge outline-dashed") }), _jsx("span", { className: cn("min-w-0 flex-1 truncate font-medium", nameInk(e)), children: e.item.title })] }) }, e.item.id))) })) })] })] }));
869
+ };
870
+ const monthGrid = () => {
871
+ if (narrow)
872
+ return compactMonth();
873
+ const shownMonth = startOfMonth(dateWall);
874
+ const top = metrics.lane + 6;
875
+ return (_jsxs("div", { "data-slot": "scheduler-calendar", className: "flex size-full flex-col", onKeyDown: onKeyDown, children: [_jsx("div", { "aria-hidden": true, className: "grid grid-cols-7 border-b border-border/(--hairline-opacity)", children: weeks[0].map((day) => (_jsx("div", { className: "truncate px-2 py-1.5 eyebrow text-11 tracking-[0.12em]", children: fmt.weekday.format(day) }, day))) }), _jsx("div", { ref: weeksRef, "data-slot": "scheduler-month", className: "grid min-h-0 flex-1", style: { gridTemplateRows: `repeat(${weeks.length}, minmax(0, 1fr))` }, onPointerDown: (e) => onPointerDown(e, "month"), onContextMenu: (e) => onContextMenu(e, "month"), children: weeks.map((wk) => {
876
+ const events = visible.filter((e) => {
877
+ const s = e.allDay ? wholeDays(e.span) : e.span;
878
+ return s.start < wk[6] + DAY && Math.max(s.end, s.start + 1) > wk[0];
879
+ });
880
+ const places = packWeek(wk, events.map((e) => ({ id: e.item.id, span: e.span, allDay: e.allDay })));
881
+ const { shown, more } = fitWeek(places, 7, monthLanes);
882
+ const draftPlace = draft
883
+ ? packWeek(wk, [{ id: "", span: draft.span, allDay: true }]).get("")
884
+ : undefined;
885
+ return (_jsxs("div", { "data-slot": "scheduler-week", className: "relative min-h-0 overflow-hidden border-b border-border/(--hairline-opacity) last:border-b-0", children: [wk.map((day, i) => {
886
+ const outside = startOfMonth(day) !== shownMonth;
887
+ const today = isToday(day);
888
+ const number = (_jsx("span", { className: cn("grid min-w-6 place-items-center rounded-full px-1 font-mono text-12 leading-6 tabular-nums", today
889
+ ? "bg-foreground text-background"
890
+ : outside
891
+ ? "text-muted-foreground"
892
+ : "text-foreground"), children: fmt.dayNumber.format(day) }));
893
+ return (_jsxs("div", { "data-slot": "scheduler-day", "data-today": today ? "" : undefined, "data-outside": outside ? "" : undefined, className: cn("absolute inset-y-0 border-s border-border/(--hairline-opacity) first:border-s-0",
894
+ // The weekend a quieter ground; days of the months either side only a
895
+ // muted number.
896
+ isWeekend(day) && "bg-control-surface/60"), style: { insetInlineStart: `${(i / 7) * 100}%`, width: `${100 / 7}%` }, children: [_jsx("div", { className: "flex items-center justify-between gap-1 p-1", children: onShowDay ? (_jsx("button", { type: "button", "aria-label": text.showDay(fmt.dayFull.format(day)), "aria-current": today ? "date" : undefined, onClick: () => onShowDay(fromWall(day)), className: "rounded-full transition-colors duration-(--duration-fade) ease-(--ease) hover:bg-control-hover", children: number })) : (_jsx("span", { "aria-current": today ? "date" : undefined, children: number })) }), more[i] > 0 && (_jsxs(Popover, { open: moreDay === day, onOpenChange: (next) => setMoreDay(next ? day : null), children: [_jsx(PopoverTrigger, { "data-slot": "scheduler-more", "aria-label": text.moreLabel(more[i], fmt.dayFull.format(day)), className: "absolute start-0.5 end-1 truncate rounded-item px-1.5 text-start font-mono text-11 text-muted-foreground tabular-nums transition-colors duration-(--duration-fade) ease-(--ease) hover:bg-control-hover hover:text-foreground", style: {
897
+ top: top + (monthLanes - 1) * metrics.lane,
898
+ height: metrics.lane - 2,
899
+ }, children: narrow ? `+${more[i]}` : text.more(more[i]) }), _jsxs(PopoverContent, { side: "bottom", align: "start", className: "w-64", children: [_jsx(PopoverTitle, { className: "mb-2 font-mono text-12 font-normal tracking-[0.12em] text-muted-foreground uppercase", children: fmt.dayFull.format(day) }), _jsx("ul", { className: "flex flex-col gap-0.5", children: events
900
+ .filter((e) => {
901
+ const p = places.get(e.item.id);
902
+ return p && p.from <= i && p.to >= i;
903
+ })
904
+ .map((e) => (_jsx("li", { children: _jsxs("button", { type: "button", "data-slot": "scheduler-more-item", onClick: () => {
905
+ setMoreDay(null);
906
+ open(e.item.id);
907
+ }, className: "flex min-h-(--control-h-sm) w-full items-center gap-2 rounded-item px-2 text-start text-13 transition-colors duration-(--duration-fade) ease-(--ease) hover:bg-control-hover", children: [_jsx("span", { "aria-hidden": true, className: cn("size-1.5 shrink-0 rounded-full", e.item.tone ? markTones[e.item.tone] : "bg-foreground/60") }), _jsx("span", { className: "shrink-0 font-mono text-11 text-muted-foreground tabular-nums", children: e.allDay ? text.allDay : fmt.time.format(e.span.start) }), _jsx("span", { className: "min-w-0 flex-1 truncate", children: e.item.title })] }) }, e.item.id))) })] })] }))] }, day));
908
+ }), loading
909
+ ? wk.slice(1, 4).map((day, i) => (_jsx(Skeleton, { shape: "item", className: "absolute", style: {
910
+ insetInlineStart: `calc(${((i * 2 + 1) / 7) * 100}% + 4px)`,
911
+ width: `calc(${100 / 7}% - 12px)`,
912
+ top,
913
+ height: metrics.lane - 4,
914
+ } }, day)))
915
+ : events.map((e) => {
916
+ const p = places.get(e.item.id);
917
+ if (!p || !shown.has(e.item.id))
918
+ return null;
919
+ const y = top + p.lane * metrics.lane;
920
+ return e.allDay || p.to > p.from
921
+ ? dayBar(e, p.from, p.to, 7, y, `${e.item.id}:${wk[0]}`, wk[0])
922
+ : monthChip(e, p.from, y, `${e.item.id}:${wk[0]}`);
923
+ }), draftPlace && (_jsx("div", { "aria-hidden": true, "data-slot": "scheduler-draft", className: "absolute z-20 flex items-center rounded-item border border-dashed border-control-focus bg-control-hover px-2 text-12 text-foreground", style: {
924
+ insetInlineStart: `calc(${(draftPlace.from / 7) * 100}% + 2px)`,
925
+ width: `calc(${((draftPlace.to - draftPlace.from + 1) / 7) * 100}% - 5px)`,
926
+ top,
927
+ height: metrics.lane - 2,
928
+ }, children: _jsx("span", { className: "truncate", children: text.newItem }) }))] }, wk[0]));
929
+ }) })] }));
930
+ };
931
+ return (_jsxs("div", { ref: rootRef, "data-slot": "scheduler", "data-layout": "calendar", "data-view": view, "data-size": size, "data-variant": variant, "data-readonly": readOnly ? "" : undefined, "data-dragging": drag ? "" : undefined, "data-narrow": narrow ? "" : undefined, role: "group", "aria-busy": loading || undefined, className: frame, style: {
932
+ // Room for "10:00 AM" beside the grid, or "10:00".
933
+ "--scheduler-gutter": fmt.hour12 ? (narrow ? "4.25rem" : "4.5rem") : narrow ? "3.25rem" : "3.75rem",
934
+ ...style,
935
+ }, ...props, children: [_jsxs("div", { ref: probeRef, "aria-hidden": true, className: "pointer-events-none invisible absolute -z-10 flex", children: [_jsx("span", { className: "h-12" }), _jsx("span", { className: "h-6.5" })] }), (toolbar || controls) && header, _jsx("div", { className: "relative min-h-0 flex-1", children: month ? monthGrid() : timeGrid() }), _jsx("span", { id: timeInstructions, "data-slot": "scheduler-instructions", className: "sr-only", children: readOnly ? text.instructionsCalendarReadOnly : text.instructionsTime }), _jsx("span", { id: dayInstructions, className: "sr-only", children: readOnly ? text.instructionsCalendarReadOnly : text.instructionsDays }), _jsx("span", { "data-slot": "scheduler-announcer", "aria-live": "polite", "aria-atomic": "true", className: "sr-only", children: loading ? text.loading : message }), renderDetails && openEntry && (_jsx(SchedulerDetails, { narrow: narrow, item: openEntry.item, anchor: () => itemEl(openEntry.item.id), onClose: () => setOpenId(null), children: renderDetails(openEntry.item) })), editing && (_jsx(SchedulerEditorHost, { narrow: narrow,
936
+ // Beside the event in the time grid; under it on the month.
937
+ side: month ? "bottom" : "inline-end", state: editing, anchor: () => editing.id
938
+ ? itemEl(editing.id)
939
+ : (rootRef.current?.querySelector("[data-slot=scheduler-draft]") ?? null), text: text, hour12: fmt.hour12, rows: rows, rowLabel: text.resourceColumn, categories: categories, onSave: saveEditor, onCancel: closeEditor, onDelete: editing.id ? () => deleteItem(editing.id, "editor") : undefined })), menu && (_jsx(SchedulerMenuHost, { anchor: menu.anchor, label: menu.label, entries: menu.entries, returnFocus: menu.returnFocus, onClose: () => setMenu(null) }))] }));
940
+ }