@42-central/ui-react 0.0.0 β†’ 0.17.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 (1248) hide show
  1. package/README.md +453 -1
  2. package/dist/chunk-2762HZYX.js +284 -0
  3. package/dist/chunk-2762HZYX.js.map +1 -0
  4. package/dist/chunk-2GILNBZW.js +31 -0
  5. package/dist/chunk-2GILNBZW.js.map +1 -0
  6. package/dist/chunk-2H46IXW4.js +264 -0
  7. package/dist/chunk-2H46IXW4.js.map +1 -0
  8. package/dist/chunk-2SVX3MQQ.js +78 -0
  9. package/dist/chunk-2SVX3MQQ.js.map +1 -0
  10. package/dist/chunk-3GYOIQW7.js +242 -0
  11. package/dist/chunk-3GYOIQW7.js.map +1 -0
  12. package/dist/chunk-3NZXWCGF.js +152 -0
  13. package/dist/chunk-3NZXWCGF.js.map +1 -0
  14. package/dist/chunk-44OV3PNH.js +294 -0
  15. package/dist/chunk-44OV3PNH.js.map +1 -0
  16. package/dist/chunk-5FDOOG4J.js +15 -0
  17. package/dist/chunk-5FDOOG4J.js.map +1 -0
  18. package/dist/chunk-6I4R3HR6.js +90 -0
  19. package/dist/chunk-6I4R3HR6.js.map +1 -0
  20. package/dist/chunk-6SWK4XG5.js +128 -0
  21. package/dist/chunk-6SWK4XG5.js.map +1 -0
  22. package/dist/chunk-7NZSTCJO.js +82 -0
  23. package/dist/chunk-7NZSTCJO.js.map +1 -0
  24. package/dist/chunk-7P32XCEU.js +15 -0
  25. package/dist/chunk-7P32XCEU.js.map +1 -0
  26. package/dist/chunk-ACE7FBWE.js +216 -0
  27. package/dist/chunk-ACE7FBWE.js.map +1 -0
  28. package/dist/chunk-AIQG7IIT.js +39 -0
  29. package/dist/chunk-AIQG7IIT.js.map +1 -0
  30. package/dist/chunk-B2LCHXUB.js +26 -0
  31. package/dist/chunk-B2LCHXUB.js.map +1 -0
  32. package/dist/chunk-BEL75C7N.js +35 -0
  33. package/dist/chunk-BEL75C7N.js.map +1 -0
  34. package/dist/chunk-BJZLQTAZ.js +3 -0
  35. package/dist/chunk-BJZLQTAZ.js.map +1 -0
  36. package/dist/chunk-BUIHQJGE.js +8 -0
  37. package/dist/chunk-BUIHQJGE.js.map +1 -0
  38. package/dist/chunk-CHTN5AHI.js +106 -0
  39. package/dist/chunk-CHTN5AHI.js.map +1 -0
  40. package/dist/chunk-CSCVTESP.js +58 -0
  41. package/dist/chunk-CSCVTESP.js.map +1 -0
  42. package/dist/chunk-EEMRRRYS.js +60 -0
  43. package/dist/chunk-EEMRRRYS.js.map +1 -0
  44. package/dist/chunk-FD6P6PLQ.js +153 -0
  45. package/dist/chunk-FD6P6PLQ.js.map +1 -0
  46. package/dist/chunk-FMMKEYHB.js +3 -0
  47. package/dist/chunk-FMMKEYHB.js.map +1 -0
  48. package/dist/chunk-FUWSTUDM.js +219 -0
  49. package/dist/chunk-FUWSTUDM.js.map +1 -0
  50. package/dist/chunk-G52U24GR.js +10 -0
  51. package/dist/chunk-G52U24GR.js.map +1 -0
  52. package/dist/chunk-GTKKRV5N.js +14 -0
  53. package/dist/chunk-GTKKRV5N.js.map +1 -0
  54. package/dist/chunk-HWNPXAEN.js +31 -0
  55. package/dist/chunk-HWNPXAEN.js.map +1 -0
  56. package/dist/chunk-IFWCCAQV.js +222 -0
  57. package/dist/chunk-IFWCCAQV.js.map +1 -0
  58. package/dist/chunk-IG7FBZVM.js +101 -0
  59. package/dist/chunk-IG7FBZVM.js.map +1 -0
  60. package/dist/chunk-IHYFYMHJ.js +167 -0
  61. package/dist/chunk-IHYFYMHJ.js.map +1 -0
  62. package/dist/chunk-IRXZHLUL.js +51 -0
  63. package/dist/chunk-IRXZHLUL.js.map +1 -0
  64. package/dist/chunk-IXKELBJA.js +202 -0
  65. package/dist/chunk-IXKELBJA.js.map +1 -0
  66. package/dist/chunk-J3PELDH3.js +279 -0
  67. package/dist/chunk-J3PELDH3.js.map +1 -0
  68. package/dist/chunk-JBVFWSRQ.js +21 -0
  69. package/dist/chunk-JBVFWSRQ.js.map +1 -0
  70. package/dist/chunk-MOI7B3KH.js +217 -0
  71. package/dist/chunk-MOI7B3KH.js.map +1 -0
  72. package/dist/chunk-NF5JM2YO.js +57 -0
  73. package/dist/chunk-NF5JM2YO.js.map +1 -0
  74. package/dist/chunk-NGAQITWP.js +156 -0
  75. package/dist/chunk-NGAQITWP.js.map +1 -0
  76. package/dist/chunk-NSDM3FEB.js +82 -0
  77. package/dist/chunk-NSDM3FEB.js.map +1 -0
  78. package/dist/chunk-ORTCK34Y.js +3 -0
  79. package/dist/chunk-ORTCK34Y.js.map +1 -0
  80. package/dist/chunk-P3XMBETI.js +26 -0
  81. package/dist/chunk-P3XMBETI.js.map +1 -0
  82. package/dist/chunk-P7A3BCAC.js +93 -0
  83. package/dist/chunk-P7A3BCAC.js.map +1 -0
  84. package/dist/chunk-PJL4ZL5V.js +639 -0
  85. package/dist/chunk-PJL4ZL5V.js.map +1 -0
  86. package/dist/chunk-POKDSVQT.js +223 -0
  87. package/dist/chunk-POKDSVQT.js.map +1 -0
  88. package/dist/chunk-QMW7D5GU.js +207 -0
  89. package/dist/chunk-QMW7D5GU.js.map +1 -0
  90. package/dist/chunk-QP4I37PA.js +14 -0
  91. package/dist/chunk-QP4I37PA.js.map +1 -0
  92. package/dist/chunk-R5GMMWAY.js +3 -0
  93. package/dist/chunk-R5GMMWAY.js.map +1 -0
  94. package/dist/chunk-S53FHWNG.js +30 -0
  95. package/dist/chunk-S53FHWNG.js.map +1 -0
  96. package/dist/chunk-SIG4DMNZ.js +238 -0
  97. package/dist/chunk-SIG4DMNZ.js.map +1 -0
  98. package/dist/chunk-SKPM2FRX.js +44 -0
  99. package/dist/chunk-SKPM2FRX.js.map +1 -0
  100. package/dist/chunk-TCWYBVIL.js +33 -0
  101. package/dist/chunk-TCWYBVIL.js.map +1 -0
  102. package/dist/chunk-TMMEJKLI.js +363 -0
  103. package/dist/chunk-TMMEJKLI.js.map +1 -0
  104. package/dist/chunk-TNNH3FVQ.js +155 -0
  105. package/dist/chunk-TNNH3FVQ.js.map +1 -0
  106. package/dist/chunk-TWGCWKRV.js +44 -0
  107. package/dist/chunk-TWGCWKRV.js.map +1 -0
  108. package/dist/chunk-U5GW5EBR.js +150 -0
  109. package/dist/chunk-U5GW5EBR.js.map +1 -0
  110. package/dist/chunk-UNSAA7YG.js +148 -0
  111. package/dist/chunk-UNSAA7YG.js.map +1 -0
  112. package/dist/chunk-UVYTJQTJ.js +14 -0
  113. package/dist/chunk-UVYTJQTJ.js.map +1 -0
  114. package/dist/chunk-VLUKI3HL.js +120 -0
  115. package/dist/chunk-VLUKI3HL.js.map +1 -0
  116. package/dist/chunk-VZ2TPU4B.js +348 -0
  117. package/dist/chunk-VZ2TPU4B.js.map +1 -0
  118. package/dist/chunk-VZH6TS7M.js +153 -0
  119. package/dist/chunk-VZH6TS7M.js.map +1 -0
  120. package/dist/chunk-WYCMIIRR.js +12 -0
  121. package/dist/chunk-WYCMIIRR.js.map +1 -0
  122. package/dist/chunk-WZB6LPQI.js +47 -0
  123. package/dist/chunk-WZB6LPQI.js.map +1 -0
  124. package/dist/chunk-YBJB7FGE.js +187 -0
  125. package/dist/chunk-YBJB7FGE.js.map +1 -0
  126. package/dist/chunk-YIQI2CF3.js +92 -0
  127. package/dist/chunk-YIQI2CF3.js.map +1 -0
  128. package/dist/chunk-YKUCSV34.js +72 -0
  129. package/dist/chunk-YKUCSV34.js.map +1 -0
  130. package/dist/chunk-ZP6EBROY.js +3 -0
  131. package/dist/chunk-ZP6EBROY.js.map +1 -0
  132. package/dist/colors.css +296 -0
  133. package/dist/components/accordion/accordion-data.d.ts +52 -0
  134. package/dist/components/accordion/accordion-data.d.ts.map +1 -0
  135. package/dist/components/accordion/accordion.d.ts +116 -0
  136. package/dist/components/accordion/accordion.d.ts.map +1 -0
  137. package/dist/components/accordion/index.d.ts +3 -0
  138. package/dist/components/accordion/index.d.ts.map +1 -0
  139. package/dist/components/accordion/index.js +206 -0
  140. package/dist/components/accordion/index.js.map +1 -0
  141. package/dist/components/action-icon/action-icon.d.ts +51 -0
  142. package/dist/components/action-icon/action-icon.d.ts.map +1 -0
  143. package/dist/components/action-icon/index.d.ts +2 -0
  144. package/dist/components/action-icon/index.d.ts.map +1 -0
  145. package/dist/components/action-icon/index.js +8 -0
  146. package/dist/components/action-icon/index.js.map +1 -0
  147. package/dist/components/alert/alert.d.ts +82 -0
  148. package/dist/components/alert/alert.d.ts.map +1 -0
  149. package/dist/components/alert/index.d.ts +2 -0
  150. package/dist/components/alert/index.d.ts.map +1 -0
  151. package/dist/components/alert/index.js +74 -0
  152. package/dist/components/alert/index.js.map +1 -0
  153. package/dist/components/ambient-background/ambient-background.d.ts +47 -0
  154. package/dist/components/ambient-background/ambient-background.d.ts.map +1 -0
  155. package/dist/components/ambient-background/index.d.ts +2 -0
  156. package/dist/components/ambient-background/index.d.ts.map +1 -0
  157. package/dist/components/ambient-background/index.js +35 -0
  158. package/dist/components/ambient-background/index.js.map +1 -0
  159. package/dist/components/app-shell/app-shell.d.ts +185 -0
  160. package/dist/components/app-shell/app-shell.d.ts.map +1 -0
  161. package/dist/components/app-shell/index.d.ts +2 -0
  162. package/dist/components/app-shell/index.d.ts.map +1 -0
  163. package/dist/components/app-shell/index.js +243 -0
  164. package/dist/components/app-shell/index.js.map +1 -0
  165. package/dist/components/autocomplete/autocomplete.d.ts +70 -0
  166. package/dist/components/autocomplete/autocomplete.d.ts.map +1 -0
  167. package/dist/components/autocomplete/index.d.ts +3 -0
  168. package/dist/components/autocomplete/index.d.ts.map +1 -0
  169. package/dist/components/autocomplete/index.js +149 -0
  170. package/dist/components/autocomplete/index.js.map +1 -0
  171. package/dist/components/avatar/avatar.d.ts +105 -0
  172. package/dist/components/avatar/avatar.d.ts.map +1 -0
  173. package/dist/components/avatar/index.d.ts +2 -0
  174. package/dist/components/avatar/index.d.ts.map +1 -0
  175. package/dist/components/avatar/index.js +211 -0
  176. package/dist/components/avatar/index.js.map +1 -0
  177. package/dist/components/badge/badge.d.ts +48 -0
  178. package/dist/components/badge/badge.d.ts.map +1 -0
  179. package/dist/components/badge/index.d.ts +2 -0
  180. package/dist/components/badge/index.d.ts.map +1 -0
  181. package/dist/components/badge/index.js +102 -0
  182. package/dist/components/badge/index.js.map +1 -0
  183. package/dist/components/breadcrumb/breadcrumb.d.ts +64 -0
  184. package/dist/components/breadcrumb/breadcrumb.d.ts.map +1 -0
  185. package/dist/components/breadcrumb/index.d.ts +2 -0
  186. package/dist/components/breadcrumb/index.d.ts.map +1 -0
  187. package/dist/components/breadcrumb/index.js +203 -0
  188. package/dist/components/breadcrumb/index.js.map +1 -0
  189. package/dist/components/button/button.d.ts +72 -0
  190. package/dist/components/button/button.d.ts.map +1 -0
  191. package/dist/components/button/index.d.ts +2 -0
  192. package/dist/components/button/index.d.ts.map +1 -0
  193. package/dist/components/button/index.js +9 -0
  194. package/dist/components/button/index.js.map +1 -0
  195. package/dist/components/button-group/button-group.d.ts +49 -0
  196. package/dist/components/button-group/button-group.d.ts.map +1 -0
  197. package/dist/components/button-group/index.d.ts +2 -0
  198. package/dist/components/button-group/index.d.ts.map +1 -0
  199. package/dist/components/button-group/index.js +5 -0
  200. package/dist/components/button-group/index.js.map +1 -0
  201. package/dist/components/button-multi-select/button-multi-select.d.ts +39 -0
  202. package/dist/components/button-multi-select/button-multi-select.d.ts.map +1 -0
  203. package/dist/components/button-multi-select/index.d.ts +5 -0
  204. package/dist/components/button-multi-select/index.d.ts.map +1 -0
  205. package/dist/components/button-multi-select/index.js +45 -0
  206. package/dist/components/button-multi-select/index.js.map +1 -0
  207. package/dist/components/button-select/button-select-control.d.ts +56 -0
  208. package/dist/components/button-select/button-select-control.d.ts.map +1 -0
  209. package/dist/components/button-select/button-select-data.d.ts +53 -0
  210. package/dist/components/button-select/button-select-data.d.ts.map +1 -0
  211. package/dist/components/button-select/button-select-items.d.ts +72 -0
  212. package/dist/components/button-select/button-select-items.d.ts.map +1 -0
  213. package/dist/components/button-select/button-select.d.ts +98 -0
  214. package/dist/components/button-select/button-select.d.ts.map +1 -0
  215. package/dist/components/button-select/index.d.ts +5 -0
  216. package/dist/components/button-select/index.d.ts.map +1 -0
  217. package/dist/components/button-select/index.js +45 -0
  218. package/dist/components/button-select/index.js.map +1 -0
  219. package/dist/components/calendar/calendar-body.d.ts +48 -0
  220. package/dist/components/calendar/calendar-body.d.ts.map +1 -0
  221. package/dist/components/calendar/calendar.d.ts +88 -0
  222. package/dist/components/calendar/calendar.d.ts.map +1 -0
  223. package/dist/components/calendar/index.d.ts +4 -0
  224. package/dist/components/calendar/index.d.ts.map +1 -0
  225. package/dist/components/calendar/index.js +11 -0
  226. package/dist/components/calendar/index.js.map +1 -0
  227. package/dist/components/card/card.d.ts +69 -0
  228. package/dist/components/card/card.d.ts.map +1 -0
  229. package/dist/components/card/index.d.ts +2 -0
  230. package/dist/components/card/index.d.ts.map +1 -0
  231. package/dist/components/card/index.js +6 -0
  232. package/dist/components/card/index.js.map +1 -0
  233. package/dist/components/chart/chart.d.ts +103 -0
  234. package/dist/components/chart/chart.d.ts.map +1 -0
  235. package/dist/components/chart/index.d.ts +2 -0
  236. package/dist/components/chart/index.d.ts.map +1 -0
  237. package/dist/components/chart/index.js +70 -0
  238. package/dist/components/chart/index.js.map +1 -0
  239. package/dist/components/chart/styles.css +50 -0
  240. package/dist/components/checkbox/checkbox.d.ts +74 -0
  241. package/dist/components/checkbox/checkbox.d.ts.map +1 -0
  242. package/dist/components/checkbox/control.d.ts +28 -0
  243. package/dist/components/checkbox/control.d.ts.map +1 -0
  244. package/dist/components/checkbox/index.d.ts +2 -0
  245. package/dist/components/checkbox/index.d.ts.map +1 -0
  246. package/dist/components/checkbox/index.js +10 -0
  247. package/dist/components/checkbox/index.js.map +1 -0
  248. package/dist/components/choice-card-group/choice-card-group.d.ts +148 -0
  249. package/dist/components/choice-card-group/choice-card-group.d.ts.map +1 -0
  250. package/dist/components/choice-card-group/index.d.ts +2 -0
  251. package/dist/components/choice-card-group/index.d.ts.map +1 -0
  252. package/dist/components/choice-card-group/index.js +280 -0
  253. package/dist/components/choice-card-group/index.js.map +1 -0
  254. package/dist/components/circular-progress/circular-progress.d.ts +49 -0
  255. package/dist/components/circular-progress/circular-progress.d.ts.map +1 -0
  256. package/dist/components/circular-progress/index.d.ts +2 -0
  257. package/dist/components/circular-progress/index.d.ts.map +1 -0
  258. package/dist/components/circular-progress/index.js +133 -0
  259. package/dist/components/circular-progress/index.js.map +1 -0
  260. package/dist/components/clipboard/clipboard.d.ts +95 -0
  261. package/dist/components/clipboard/clipboard.d.ts.map +1 -0
  262. package/dist/components/clipboard/copy.d.ts +67 -0
  263. package/dist/components/clipboard/copy.d.ts.map +1 -0
  264. package/dist/components/clipboard/index.d.ts +3 -0
  265. package/dist/components/clipboard/index.d.ts.map +1 -0
  266. package/dist/components/clipboard/index.js +86 -0
  267. package/dist/components/clipboard/index.js.map +1 -0
  268. package/dist/components/code/code.d.ts +37 -0
  269. package/dist/components/code/code.d.ts.map +1 -0
  270. package/dist/components/code/index.d.ts +2 -0
  271. package/dist/components/code/index.d.ts.map +1 -0
  272. package/dist/components/code/index.js +28 -0
  273. package/dist/components/code/index.js.map +1 -0
  274. package/dist/components/code-block/chrome.d.ts +77 -0
  275. package/dist/components/code-block/chrome.d.ts.map +1 -0
  276. package/dist/components/code-block/chrome.js +15 -0
  277. package/dist/components/code-block/chrome.js.map +1 -0
  278. package/dist/components/code-block/code-block.d.ts +99 -0
  279. package/dist/components/code-block/code-block.d.ts.map +1 -0
  280. package/dist/components/code-block/diff.d.ts +79 -0
  281. package/dist/components/code-block/diff.d.ts.map +1 -0
  282. package/dist/components/code-block/diff.js +23 -0
  283. package/dist/components/code-block/diff.js.map +1 -0
  284. package/dist/components/code-block/gutters.d.ts +100 -0
  285. package/dist/components/code-block/gutters.d.ts.map +1 -0
  286. package/dist/components/code-block/highlighter.d.ts +84 -0
  287. package/dist/components/code-block/highlighter.d.ts.map +1 -0
  288. package/dist/components/code-block/index.d.ts +23 -0
  289. package/dist/components/code-block/index.d.ts.map +1 -0
  290. package/dist/components/code-block/index.js +463 -0
  291. package/dist/components/code-block/index.js.map +1 -0
  292. package/dist/components/code-block/notation.d.ts +126 -0
  293. package/dist/components/code-block/notation.d.ts.map +1 -0
  294. package/dist/components/code-block/presets.d.ts +23 -0
  295. package/dist/components/code-block/presets.d.ts.map +1 -0
  296. package/dist/components/code-block/static.d.ts +65 -0
  297. package/dist/components/code-block/static.d.ts.map +1 -0
  298. package/dist/components/code-block/static.js +380 -0
  299. package/dist/components/code-block/static.js.map +1 -0
  300. package/dist/components/code-block/styles.css +198 -0
  301. package/dist/components/collapse/collapse.d.ts +50 -0
  302. package/dist/components/collapse/collapse.d.ts.map +1 -0
  303. package/dist/components/collapse/index.d.ts +2 -0
  304. package/dist/components/collapse/index.d.ts.map +1 -0
  305. package/dist/components/collapse/index.js +5 -0
  306. package/dist/components/collapse/index.js.map +1 -0
  307. package/dist/components/combobox/combobox.d.ts +78 -0
  308. package/dist/components/combobox/combobox.d.ts.map +1 -0
  309. package/dist/components/combobox/index.d.ts +3 -0
  310. package/dist/components/combobox/index.d.ts.map +1 -0
  311. package/dist/components/combobox/index.js +15 -0
  312. package/dist/components/combobox/index.js.map +1 -0
  313. package/dist/components/combobox-list/combobox-list.d.ts +77 -0
  314. package/dist/components/combobox-list/combobox-list.d.ts.map +1 -0
  315. package/dist/components/combobox-list/index.d.ts +2 -0
  316. package/dist/components/combobox-list/index.d.ts.map +1 -0
  317. package/dist/components/combobox-list/index.js +16 -0
  318. package/dist/components/combobox-list/index.js.map +1 -0
  319. package/dist/components/container/container.d.ts +18 -0
  320. package/dist/components/container/container.d.ts.map +1 -0
  321. package/dist/components/container/index.d.ts +2 -0
  322. package/dist/components/container/index.d.ts.map +1 -0
  323. package/dist/components/container/index.js +40 -0
  324. package/dist/components/container/index.js.map +1 -0
  325. package/dist/components/data-table/data-table-features.d.ts +80 -0
  326. package/dist/components/data-table/data-table-features.d.ts.map +1 -0
  327. package/dist/components/data-table/data-table-filter/data-table-date-filter.d.ts +53 -0
  328. package/dist/components/data-table/data-table-filter/data-table-date-filter.d.ts.map +1 -0
  329. package/dist/components/data-table/data-table-filter/data-table-filter-fns.d.ts +18 -0
  330. package/dist/components/data-table/data-table-filter/data-table-filter-fns.d.ts.map +1 -0
  331. package/dist/components/data-table/data-table-filter/data-table-number-filter.d.ts +7 -0
  332. package/dist/components/data-table/data-table-filter/data-table-number-filter.d.ts.map +1 -0
  333. package/dist/components/data-table/data-table-filter/data-table-select-filter.d.ts +15 -0
  334. package/dist/components/data-table/data-table-filter/data-table-select-filter.d.ts.map +1 -0
  335. package/dist/components/data-table/data-table-filter/data-table-text-filter.d.ts +7 -0
  336. package/dist/components/data-table/data-table-filter/data-table-text-filter.d.ts.map +1 -0
  337. package/dist/components/data-table/data-table-filter/index.d.ts +15 -0
  338. package/dist/components/data-table/data-table-filter/index.d.ts.map +1 -0
  339. package/dist/components/data-table/data-table-filter/utils.d.ts +52 -0
  340. package/dist/components/data-table/data-table-filter/utils.d.ts.map +1 -0
  341. package/dist/components/data-table/data-table-header-cell.d.ts +65 -0
  342. package/dist/components/data-table/data-table-header-cell.d.ts.map +1 -0
  343. package/dist/components/data-table/data-table-meta.d.ts +103 -0
  344. package/dist/components/data-table/data-table-meta.d.ts.map +1 -0
  345. package/dist/components/data-table/data-table-pagination.d.ts +56 -0
  346. package/dist/components/data-table/data-table-pagination.d.ts.map +1 -0
  347. package/dist/components/data-table/data-table-placeholder.d.ts +18 -0
  348. package/dist/components/data-table/data-table-placeholder.d.ts.map +1 -0
  349. package/dist/components/data-table/data-table-schema.d.ts +45 -0
  350. package/dist/components/data-table/data-table-schema.d.ts.map +1 -0
  351. package/dist/components/data-table/data-table-skeleton.d.ts +10 -0
  352. package/dist/components/data-table/data-table-skeleton.d.ts.map +1 -0
  353. package/dist/components/data-table/data-table-stack.d.ts +48 -0
  354. package/dist/components/data-table/data-table-stack.d.ts.map +1 -0
  355. package/dist/components/data-table/data-table-state.d.ts +10 -0
  356. package/dist/components/data-table/data-table-state.d.ts.map +1 -0
  357. package/dist/components/data-table/data-table-toolbar.d.ts +21 -0
  358. package/dist/components/data-table/data-table-toolbar.d.ts.map +1 -0
  359. package/dist/components/data-table/data-table.d.ts +194 -0
  360. package/dist/components/data-table/data-table.d.ts.map +1 -0
  361. package/dist/components/data-table/index.d.ts +14 -0
  362. package/dist/components/data-table/index.d.ts.map +1 -0
  363. package/dist/components/data-table/index.js +1603 -0
  364. package/dist/components/data-table/index.js.map +1 -0
  365. package/dist/components/date-picker/aliases.d.ts +11 -0
  366. package/dist/components/date-picker/aliases.d.ts.map +1 -0
  367. package/dist/components/date-picker/date-picker.d.ts +204 -0
  368. package/dist/components/date-picker/date-picker.d.ts.map +1 -0
  369. package/dist/components/date-picker/date-time-text.d.ts +32 -0
  370. package/dist/components/date-picker/date-time-text.d.ts.map +1 -0
  371. package/dist/components/date-picker/index.d.ts +7 -0
  372. package/dist/components/date-picker/index.d.ts.map +1 -0
  373. package/dist/components/date-picker/index.js +48 -0
  374. package/dist/components/date-picker/index.js.map +1 -0
  375. package/dist/components/divider/divider.d.ts +79 -0
  376. package/dist/components/divider/divider.d.ts.map +1 -0
  377. package/dist/components/divider/index.d.ts +2 -0
  378. package/dist/components/divider/index.d.ts.map +1 -0
  379. package/dist/components/divider/index.js +5 -0
  380. package/dist/components/divider/index.js.map +1 -0
  381. package/dist/components/drawer/drawer.d.ts +103 -0
  382. package/dist/components/drawer/drawer.d.ts.map +1 -0
  383. package/dist/components/drawer/index.d.ts +2 -0
  384. package/dist/components/drawer/index.d.ts.map +1 -0
  385. package/dist/components/drawer/index.js +13 -0
  386. package/dist/components/drawer/index.js.map +1 -0
  387. package/dist/components/field/field.d.ts +79 -0
  388. package/dist/components/field/field.d.ts.map +1 -0
  389. package/dist/components/field/index.d.ts +2 -0
  390. package/dist/components/field/index.d.ts.map +1 -0
  391. package/dist/components/field/index.js +6 -0
  392. package/dist/components/field/index.js.map +1 -0
  393. package/dist/components/file-upload/file-upload.d.ts +68 -0
  394. package/dist/components/file-upload/file-upload.d.ts.map +1 -0
  395. package/dist/components/file-upload/index.d.ts +2 -0
  396. package/dist/components/file-upload/index.d.ts.map +1 -0
  397. package/dist/components/file-upload/index.js +189 -0
  398. package/dist/components/file-upload/index.js.map +1 -0
  399. package/dist/components/flex/flex.d.ts +25 -0
  400. package/dist/components/flex/flex.d.ts.map +1 -0
  401. package/dist/components/flex/index.d.ts +2 -0
  402. package/dist/components/flex/index.d.ts.map +1 -0
  403. package/dist/components/flex/index.js +5 -0
  404. package/dist/components/flex/index.js.map +1 -0
  405. package/dist/components/grid/grid.d.ts +21 -0
  406. package/dist/components/grid/grid.d.ts.map +1 -0
  407. package/dist/components/grid/index.d.ts +2 -0
  408. package/dist/components/grid/index.d.ts.map +1 -0
  409. package/dist/components/grid/index.js +44 -0
  410. package/dist/components/grid/index.js.map +1 -0
  411. package/dist/components/hover-card/hover-card.d.ts +122 -0
  412. package/dist/components/hover-card/hover-card.d.ts.map +1 -0
  413. package/dist/components/hover-card/index.d.ts +2 -0
  414. package/dist/components/hover-card/index.d.ts.map +1 -0
  415. package/dist/components/hover-card/index.js +157 -0
  416. package/dist/components/hover-card/index.js.map +1 -0
  417. package/dist/components/indicator/index.d.ts +2 -0
  418. package/dist/components/indicator/index.d.ts.map +1 -0
  419. package/dist/components/indicator/index.js +152 -0
  420. package/dist/components/indicator/index.js.map +1 -0
  421. package/dist/components/indicator/indicator.d.ts +69 -0
  422. package/dist/components/indicator/indicator.d.ts.map +1 -0
  423. package/dist/components/input/index.d.ts +2 -0
  424. package/dist/components/input/index.d.ts.map +1 -0
  425. package/dist/components/input/index.js +7 -0
  426. package/dist/components/input/index.js.map +1 -0
  427. package/dist/components/input/input.d.ts +116 -0
  428. package/dist/components/input/input.d.ts.map +1 -0
  429. package/dist/components/kbd/index.d.ts +2 -0
  430. package/dist/components/kbd/index.d.ts.map +1 -0
  431. package/dist/components/kbd/index.js +65 -0
  432. package/dist/components/kbd/index.js.map +1 -0
  433. package/dist/components/kbd/kbd.d.ts +43 -0
  434. package/dist/components/kbd/kbd.d.ts.map +1 -0
  435. package/dist/components/mark/index.d.ts +2 -0
  436. package/dist/components/mark/index.d.ts.map +1 -0
  437. package/dist/components/mark/index.js +5 -0
  438. package/dist/components/mark/index.js.map +1 -0
  439. package/dist/components/mark/mark.d.ts +50 -0
  440. package/dist/components/mark/mark.d.ts.map +1 -0
  441. package/dist/components/menu/index.d.ts +3 -0
  442. package/dist/components/menu/index.d.ts.map +1 -0
  443. package/dist/components/menu/index.js +88 -0
  444. package/dist/components/menu/index.js.map +1 -0
  445. package/dist/components/menu/menu-data.d.ts +119 -0
  446. package/dist/components/menu/menu-data.d.ts.map +1 -0
  447. package/dist/components/menu/menu.d.ts +123 -0
  448. package/dist/components/menu/menu.d.ts.map +1 -0
  449. package/dist/components/modal/index.d.ts +2 -0
  450. package/dist/components/modal/index.d.ts.map +1 -0
  451. package/dist/components/modal/index.js +12 -0
  452. package/dist/components/modal/index.js.map +1 -0
  453. package/dist/components/modal/modal.d.ts +100 -0
  454. package/dist/components/modal/modal.d.ts.map +1 -0
  455. package/dist/components/multi-combobox-list/index.d.ts +2 -0
  456. package/dist/components/multi-combobox-list/index.d.ts.map +1 -0
  457. package/dist/components/multi-combobox-list/index.js +16 -0
  458. package/dist/components/multi-combobox-list/index.js.map +1 -0
  459. package/dist/components/multi-combobox-list/multi-combobox-list.d.ts +83 -0
  460. package/dist/components/multi-combobox-list/multi-combobox-list.d.ts.map +1 -0
  461. package/dist/components/multi-select/index.d.ts +3 -0
  462. package/dist/components/multi-select/index.d.ts.map +1 -0
  463. package/dist/components/multi-select/index.js +203 -0
  464. package/dist/components/multi-select/index.js.map +1 -0
  465. package/dist/components/multi-select/multi-select.d.ts +83 -0
  466. package/dist/components/multi-select/multi-select.d.ts.map +1 -0
  467. package/dist/components/nav-link/index.d.ts +3 -0
  468. package/dist/components/nav-link/index.d.ts.map +1 -0
  469. package/dist/components/nav-link/index.js +11 -0
  470. package/dist/components/nav-link/index.js.map +1 -0
  471. package/dist/components/nav-link/nav-link.d.ts +40 -0
  472. package/dist/components/nav-link/nav-link.d.ts.map +1 -0
  473. package/dist/components/nav-link/navigation.d.ts +45 -0
  474. package/dist/components/nav-link/navigation.d.ts.map +1 -0
  475. package/dist/components/nav-link/tanstack.d.ts +38 -0
  476. package/dist/components/nav-link/tanstack.d.ts.map +1 -0
  477. package/dist/components/nav-link/tanstack.js +21 -0
  478. package/dist/components/nav-link/tanstack.js.map +1 -0
  479. package/dist/components/notification/create-notifier.d.ts +117 -0
  480. package/dist/components/notification/create-notifier.d.ts.map +1 -0
  481. package/dist/components/notification/index.d.ts +5 -0
  482. package/dist/components/notification/index.d.ts.map +1 -0
  483. package/dist/components/notification/index.js +388 -0
  484. package/dist/components/notification/index.js.map +1 -0
  485. package/dist/components/notification/notification.d.ts +124 -0
  486. package/dist/components/notification/notification.d.ts.map +1 -0
  487. package/dist/components/notification/store.d.ts +42 -0
  488. package/dist/components/notification/store.d.ts.map +1 -0
  489. package/dist/components/notification/types.d.ts +62 -0
  490. package/dist/components/notification/types.d.ts.map +1 -0
  491. package/dist/components/number-input/index.d.ts +2 -0
  492. package/dist/components/number-input/index.d.ts.map +1 -0
  493. package/dist/components/number-input/index.js +16 -0
  494. package/dist/components/number-input/index.js.map +1 -0
  495. package/dist/components/number-input/number-input.d.ts +105 -0
  496. package/dist/components/number-input/number-input.d.ts.map +1 -0
  497. package/dist/components/overlays/create-overlays.d.ts +77 -0
  498. package/dist/components/overlays/create-overlays.d.ts.map +1 -0
  499. package/dist/components/overlays/index.d.ts +4 -0
  500. package/dist/components/overlays/index.d.ts.map +1 -0
  501. package/dist/components/overlays/index.js +332 -0
  502. package/dist/components/overlays/index.js.map +1 -0
  503. package/dist/components/overlays/renderer.d.ts +30 -0
  504. package/dist/components/overlays/renderer.d.ts.map +1 -0
  505. package/dist/components/overlays/store.d.ts +33 -0
  506. package/dist/components/overlays/store.d.ts.map +1 -0
  507. package/dist/components/overlays/types.d.ts +119 -0
  508. package/dist/components/overlays/types.d.ts.map +1 -0
  509. package/dist/components/password-input/index.d.ts +2 -0
  510. package/dist/components/password-input/index.d.ts.map +1 -0
  511. package/dist/components/password-input/index.js +125 -0
  512. package/dist/components/password-input/index.js.map +1 -0
  513. package/dist/components/password-input/password-input.d.ts +65 -0
  514. package/dist/components/password-input/password-input.d.ts.map +1 -0
  515. package/dist/components/pill/index.d.ts +2 -0
  516. package/dist/components/pill/index.d.ts.map +1 -0
  517. package/dist/components/pill/index.js +8 -0
  518. package/dist/components/pill/index.js.map +1 -0
  519. package/dist/components/pill/pill.d.ts +69 -0
  520. package/dist/components/pill/pill.d.ts.map +1 -0
  521. package/dist/components/pills-input/index.d.ts +2 -0
  522. package/dist/components/pills-input/index.d.ts.map +1 -0
  523. package/dist/components/pills-input/index.js +10 -0
  524. package/dist/components/pills-input/index.js.map +1 -0
  525. package/dist/components/pills-input/pills-input.d.ts +146 -0
  526. package/dist/components/pills-input/pills-input.d.ts.map +1 -0
  527. package/dist/components/pin-input/index.d.ts +2 -0
  528. package/dist/components/pin-input/index.d.ts.map +1 -0
  529. package/dist/components/pin-input/index.js +107 -0
  530. package/dist/components/pin-input/index.js.map +1 -0
  531. package/dist/components/pin-input/pin-input.d.ts +80 -0
  532. package/dist/components/pin-input/pin-input.d.ts.map +1 -0
  533. package/dist/components/popover/icons.d.ts +24 -0
  534. package/dist/components/popover/icons.d.ts.map +1 -0
  535. package/dist/components/popover/index.d.ts +2 -0
  536. package/dist/components/popover/index.d.ts.map +1 -0
  537. package/dist/components/popover/index.js +10 -0
  538. package/dist/components/popover/index.js.map +1 -0
  539. package/dist/components/popover/popover.d.ts +190 -0
  540. package/dist/components/popover/popover.d.ts.map +1 -0
  541. package/dist/components/progress/index.d.ts +2 -0
  542. package/dist/components/progress/index.d.ts.map +1 -0
  543. package/dist/components/progress/index.js +111 -0
  544. package/dist/components/progress/index.js.map +1 -0
  545. package/dist/components/progress/progress.d.ts +47 -0
  546. package/dist/components/progress/progress.d.ts.map +1 -0
  547. package/dist/components/radio-group/index.d.ts +2 -0
  548. package/dist/components/radio-group/index.d.ts.map +1 -0
  549. package/dist/components/radio-group/index.js +104 -0
  550. package/dist/components/radio-group/index.js.map +1 -0
  551. package/dist/components/radio-group/radio-group.d.ts +86 -0
  552. package/dist/components/radio-group/radio-group.d.ts.map +1 -0
  553. package/dist/components/rating/icons.d.ts +19 -0
  554. package/dist/components/rating/icons.d.ts.map +1 -0
  555. package/dist/components/rating/index.d.ts +2 -0
  556. package/dist/components/rating/index.d.ts.map +1 -0
  557. package/dist/components/rating/index.js +194 -0
  558. package/dist/components/rating/index.js.map +1 -0
  559. package/dist/components/rating/rating.d.ts +119 -0
  560. package/dist/components/rating/rating.d.ts.map +1 -0
  561. package/dist/components/schedule/index.d.ts +98 -0
  562. package/dist/components/schedule/index.d.ts.map +1 -0
  563. package/dist/components/schedule/index.js +6582 -0
  564. package/dist/components/schedule/index.js.map +1 -0
  565. package/dist/components/schedule/now-cursor-line.d.ts +97 -0
  566. package/dist/components/schedule/now-cursor-line.d.ts.map +1 -0
  567. package/dist/components/schedule/schedule-agenda-list.d.ts +55 -0
  568. package/dist/components/schedule/schedule-agenda-list.d.ts.map +1 -0
  569. package/dist/components/schedule/schedule-agenda-view.d.ts +48 -0
  570. package/dist/components/schedule/schedule-agenda-view.d.ts.map +1 -0
  571. package/dist/components/schedule/schedule-all-day-row.d.ts +100 -0
  572. package/dist/components/schedule/schedule-all-day-row.d.ts.map +1 -0
  573. package/dist/components/schedule/schedule-create-draft.d.ts +29 -0
  574. package/dist/components/schedule/schedule-create-draft.d.ts.map +1 -0
  575. package/dist/components/schedule/schedule-dates.d.ts +359 -0
  576. package/dist/components/schedule/schedule-dates.d.ts.map +1 -0
  577. package/dist/components/schedule/schedule-day-view.d.ts +24 -0
  578. package/dist/components/schedule/schedule-day-view.d.ts.map +1 -0
  579. package/dist/components/schedule/schedule-days-view.d.ts +60 -0
  580. package/dist/components/schedule/schedule-days-view.d.ts.map +1 -0
  581. package/dist/components/schedule/schedule-disabled-overlay.d.ts +34 -0
  582. package/dist/components/schedule/schedule-disabled-overlay.d.ts.map +1 -0
  583. package/dist/components/schedule/schedule-drag-ghost.d.ts +24 -0
  584. package/dist/components/schedule/schedule-drag-ghost.d.ts.map +1 -0
  585. package/dist/components/schedule/schedule-event-chip.d.ts +101 -0
  586. package/dist/components/schedule/schedule-event-chip.d.ts.map +1 -0
  587. package/dist/components/schedule/schedule-event-details.d.ts +37 -0
  588. package/dist/components/schedule/schedule-event-details.d.ts.map +1 -0
  589. package/dist/components/schedule/schedule-event-list-popover-content.d.ts +41 -0
  590. package/dist/components/schedule/schedule-event-list-popover-content.d.ts.map +1 -0
  591. package/dist/components/schedule/schedule-event-styles.d.ts +58 -0
  592. package/dist/components/schedule/schedule-event-styles.d.ts.map +1 -0
  593. package/dist/components/schedule/schedule-geometry.d.ts +291 -0
  594. package/dist/components/schedule/schedule-geometry.d.ts.map +1 -0
  595. package/dist/components/schedule/schedule-grid-gesture.d.ts +288 -0
  596. package/dist/components/schedule/schedule-grid-gesture.d.ts.map +1 -0
  597. package/dist/components/schedule/schedule-layout.d.ts +83 -0
  598. package/dist/components/schedule/schedule-layout.d.ts.map +1 -0
  599. package/dist/components/schedule/schedule-month-view.d.ts +44 -0
  600. package/dist/components/schedule/schedule-month-view.d.ts.map +1 -0
  601. package/dist/components/schedule/schedule-next-up-grouping.d.ts +37 -0
  602. package/dist/components/schedule/schedule-next-up-grouping.d.ts.map +1 -0
  603. package/dist/components/schedule/schedule-next-up.d.ts +79 -0
  604. package/dist/components/schedule/schedule-next-up.d.ts.map +1 -0
  605. package/dist/components/schedule/schedule-overflow-chip.d.ts +45 -0
  606. package/dist/components/schedule/schedule-overflow-chip.d.ts.map +1 -0
  607. package/dist/components/schedule/schedule-overflow-popover.d.ts +57 -0
  608. package/dist/components/schedule/schedule-overflow-popover.d.ts.map +1 -0
  609. package/dist/components/schedule/schedule-segments.d.ts +89 -0
  610. package/dist/components/schedule/schedule-segments.d.ts.map +1 -0
  611. package/dist/components/schedule/schedule-snap.d.ts +204 -0
  612. package/dist/components/schedule/schedule-snap.d.ts.map +1 -0
  613. package/dist/components/schedule/schedule-timed-grid.d.ts +78 -0
  614. package/dist/components/schedule/schedule-timed-grid.d.ts.map +1 -0
  615. package/dist/components/schedule/schedule-toolbar.d.ts +107 -0
  616. package/dist/components/schedule/schedule-toolbar.d.ts.map +1 -0
  617. package/dist/components/schedule/schedule-types.d.ts +841 -0
  618. package/dist/components/schedule/schedule-types.d.ts.map +1 -0
  619. package/dist/components/schedule/schedule-views.d.ts +197 -0
  620. package/dist/components/schedule/schedule-views.d.ts.map +1 -0
  621. package/dist/components/schedule/schedule-week-view.d.ts +19 -0
  622. package/dist/components/schedule/schedule-week-view.d.ts.map +1 -0
  623. package/dist/components/schedule/schedule-year-view.d.ts +38 -0
  624. package/dist/components/schedule/schedule-year-view.d.ts.map +1 -0
  625. package/dist/components/schedule/schedule.d.ts +163 -0
  626. package/dist/components/schedule/schedule.d.ts.map +1 -0
  627. package/dist/components/schedule/use-event-create.d.ts +54 -0
  628. package/dist/components/schedule/use-event-create.d.ts.map +1 -0
  629. package/dist/components/schedule/use-event-drag.d.ts +95 -0
  630. package/dist/components/schedule/use-event-drag.d.ts.map +1 -0
  631. package/dist/components/schedule/use-event-resize.d.ts +63 -0
  632. package/dist/components/schedule/use-event-resize.d.ts.map +1 -0
  633. package/dist/components/schedule/use-schedule-selection.d.ts +74 -0
  634. package/dist/components/schedule/use-schedule-selection.d.ts.map +1 -0
  635. package/dist/components/schedule/use-schedule.d.ts +78 -0
  636. package/dist/components/schedule/use-schedule.d.ts.map +1 -0
  637. package/dist/components/segment-group/index.d.ts +2 -0
  638. package/dist/components/segment-group/index.d.ts.map +1 -0
  639. package/dist/components/segment-group/index.js +10 -0
  640. package/dist/components/segment-group/index.js.map +1 -0
  641. package/dist/components/segment-group/segment-group.d.ts +187 -0
  642. package/dist/components/segment-group/segment-group.d.ts.map +1 -0
  643. package/dist/components/select/index.d.ts +3 -0
  644. package/dist/components/select/index.d.ts.map +1 -0
  645. package/dist/components/select/index.js +17 -0
  646. package/dist/components/select/index.js.map +1 -0
  647. package/dist/components/select/select.d.ts +83 -0
  648. package/dist/components/select/select.d.ts.map +1 -0
  649. package/dist/components/skeleton/index.d.ts +2 -0
  650. package/dist/components/skeleton/index.d.ts.map +1 -0
  651. package/dist/components/skeleton/index.js +5 -0
  652. package/dist/components/skeleton/index.js.map +1 -0
  653. package/dist/components/skeleton/skeleton.d.ts +83 -0
  654. package/dist/components/skeleton/skeleton.d.ts.map +1 -0
  655. package/dist/components/slider/index.d.ts +2 -0
  656. package/dist/components/slider/index.d.ts.map +1 -0
  657. package/dist/components/slider/index.js +258 -0
  658. package/dist/components/slider/index.js.map +1 -0
  659. package/dist/components/slider/slider.d.ts +90 -0
  660. package/dist/components/slider/slider.d.ts.map +1 -0
  661. package/dist/components/slider/sliderThumb.d.ts +1 -0
  662. package/dist/components/slider/sliderThumb.d.ts.map +1 -0
  663. package/dist/components/spinner/index.d.ts +2 -0
  664. package/dist/components/spinner/index.d.ts.map +1 -0
  665. package/dist/components/spinner/index.js +5 -0
  666. package/dist/components/spinner/index.js.map +1 -0
  667. package/dist/components/spinner/spinner.d.ts +61 -0
  668. package/dist/components/spinner/spinner.d.ts.map +1 -0
  669. package/dist/components/switch/index.d.ts +2 -0
  670. package/dist/components/switch/index.d.ts.map +1 -0
  671. package/dist/components/switch/index.js +140 -0
  672. package/dist/components/switch/index.js.map +1 -0
  673. package/dist/components/switch/switch.d.ts +48 -0
  674. package/dist/components/switch/switch.d.ts.map +1 -0
  675. package/dist/components/table/index.d.ts +2 -0
  676. package/dist/components/table/index.d.ts.map +1 -0
  677. package/dist/components/table/index.js +5 -0
  678. package/dist/components/table/index.js.map +1 -0
  679. package/dist/components/table/table.d.ts +113 -0
  680. package/dist/components/table/table.d.ts.map +1 -0
  681. package/dist/components/tabs/index.d.ts +3 -0
  682. package/dist/components/tabs/index.d.ts.map +1 -0
  683. package/dist/components/tabs/index.js +8 -0
  684. package/dist/components/tabs/index.js.map +1 -0
  685. package/dist/components/tabs/tabs-data.d.ts +67 -0
  686. package/dist/components/tabs/tabs-data.d.ts.map +1 -0
  687. package/dist/components/tabs/tabs.d.ts +96 -0
  688. package/dist/components/tabs/tabs.d.ts.map +1 -0
  689. package/dist/components/tags-input/index.d.ts +2 -0
  690. package/dist/components/tags-input/index.d.ts.map +1 -0
  691. package/dist/components/tags-input/index.js +203 -0
  692. package/dist/components/tags-input/index.js.map +1 -0
  693. package/dist/components/tags-input/tags-input.d.ts +68 -0
  694. package/dist/components/tags-input/tags-input.d.ts.map +1 -0
  695. package/dist/components/text/index.d.ts +2 -0
  696. package/dist/components/text/index.d.ts.map +1 -0
  697. package/dist/components/text/index.js +6 -0
  698. package/dist/components/text/index.js.map +1 -0
  699. package/dist/components/text/text.d.ts +50 -0
  700. package/dist/components/text/text.d.ts.map +1 -0
  701. package/dist/components/text-input/index.d.ts +2 -0
  702. package/dist/components/text-input/index.d.ts.map +1 -0
  703. package/dist/components/text-input/index.js +34 -0
  704. package/dist/components/text-input/index.js.map +1 -0
  705. package/dist/components/text-input/text-input.d.ts +56 -0
  706. package/dist/components/text-input/text-input.d.ts.map +1 -0
  707. package/dist/components/textarea/index.d.ts +2 -0
  708. package/dist/components/textarea/index.d.ts.map +1 -0
  709. package/dist/components/textarea/index.js +116 -0
  710. package/dist/components/textarea/index.js.map +1 -0
  711. package/dist/components/textarea/textarea.d.ts +48 -0
  712. package/dist/components/textarea/textarea.d.ts.map +1 -0
  713. package/dist/components/theme-icon/index.d.ts +2 -0
  714. package/dist/components/theme-icon/index.d.ts.map +1 -0
  715. package/dist/components/theme-icon/index.js +6 -0
  716. package/dist/components/theme-icon/index.js.map +1 -0
  717. package/dist/components/theme-icon/theme-icon.d.ts +34 -0
  718. package/dist/components/theme-icon/theme-icon.d.ts.map +1 -0
  719. package/dist/components/theme-script/index.d.ts +2 -0
  720. package/dist/components/theme-script/index.d.ts.map +1 -0
  721. package/dist/components/theme-script/index.js +29 -0
  722. package/dist/components/theme-script/index.js.map +1 -0
  723. package/dist/components/theme-script/theme-script.d.ts +41 -0
  724. package/dist/components/theme-script/theme-script.d.ts.map +1 -0
  725. package/dist/components/time-input/hour-cycle.d.ts +32 -0
  726. package/dist/components/time-input/hour-cycle.d.ts.map +1 -0
  727. package/dist/components/time-input/index.d.ts +3 -0
  728. package/dist/components/time-input/index.d.ts.map +1 -0
  729. package/dist/components/time-input/index.js +125 -0
  730. package/dist/components/time-input/index.js.map +1 -0
  731. package/dist/components/time-input/time-input.d.ts +63 -0
  732. package/dist/components/time-input/time-input.d.ts.map +1 -0
  733. package/dist/components/time-input/time-row.d.ts +72 -0
  734. package/dist/components/time-input/time-row.d.ts.map +1 -0
  735. package/dist/components/timeline/index.d.ts +2 -0
  736. package/dist/components/timeline/index.d.ts.map +1 -0
  737. package/dist/components/timeline/index.js +372 -0
  738. package/dist/components/timeline/index.js.map +1 -0
  739. package/dist/components/timeline/timeline.d.ts +194 -0
  740. package/dist/components/timeline/timeline.d.ts.map +1 -0
  741. package/dist/components/title/index.d.ts +2 -0
  742. package/dist/components/title/index.d.ts.map +1 -0
  743. package/dist/components/title/index.js +6 -0
  744. package/dist/components/title/index.js.map +1 -0
  745. package/dist/components/title/title.d.ts +47 -0
  746. package/dist/components/title/title.d.ts.map +1 -0
  747. package/dist/components/tooltip/index.d.ts +2 -0
  748. package/dist/components/tooltip/index.d.ts.map +1 -0
  749. package/dist/components/tooltip/index.js +10 -0
  750. package/dist/components/tooltip/index.js.map +1 -0
  751. package/dist/components/tooltip/tooltip.d.ts +70 -0
  752. package/dist/components/tooltip/tooltip.d.ts.map +1 -0
  753. package/dist/components/tree-multi-select/index.d.ts +3 -0
  754. package/dist/components/tree-multi-select/index.d.ts.map +1 -0
  755. package/dist/components/tree-multi-select/index.js +424 -0
  756. package/dist/components/tree-multi-select/index.js.map +1 -0
  757. package/dist/components/tree-multi-select/tree-multi-select.d.ts +72 -0
  758. package/dist/components/tree-multi-select/tree-multi-select.d.ts.map +1 -0
  759. package/dist/components/tree-select/index.d.ts +3 -0
  760. package/dist/components/tree-select/index.d.ts.map +1 -0
  761. package/dist/components/tree-select/index.js +425 -0
  762. package/dist/components/tree-select/index.js.map +1 -0
  763. package/dist/components/tree-select/tree-select.d.ts +68 -0
  764. package/dist/components/tree-select/tree-select.d.ts.map +1 -0
  765. package/dist/index.d.ts +24 -0
  766. package/dist/index.d.ts.map +1 -0
  767. package/dist/index.js +269 -0
  768. package/dist/index.js.map +1 -0
  769. package/dist/lib/align.d.ts +7 -0
  770. package/dist/lib/align.d.ts.map +1 -0
  771. package/dist/lib/available-if.d.ts +114 -0
  772. package/dist/lib/available-if.d.ts.map +1 -0
  773. package/dist/lib/brand.d.ts +22 -0
  774. package/dist/lib/brand.d.ts.map +1 -0
  775. package/dist/lib/cn.d.ts +14 -0
  776. package/dist/lib/cn.d.ts.map +1 -0
  777. package/dist/lib/cn.js +3 -0
  778. package/dist/lib/cn.js.map +1 -0
  779. package/dist/lib/colors.d.ts +14 -0
  780. package/dist/lib/colors.d.ts.map +1 -0
  781. package/dist/lib/control-open.d.ts +28 -0
  782. package/dist/lib/control-open.d.ts.map +1 -0
  783. package/dist/lib/date-predicates.d.ts +28 -0
  784. package/dist/lib/date-predicates.d.ts.map +1 -0
  785. package/dist/lib/date-value.d.ts +45 -0
  786. package/dist/lib/date-value.d.ts.map +1 -0
  787. package/dist/lib/dev-warn.d.ts +2 -0
  788. package/dist/lib/dev-warn.d.ts.map +1 -0
  789. package/dist/lib/focus-styles.d.ts +102 -0
  790. package/dist/lib/focus-styles.d.ts.map +1 -0
  791. package/dist/lib/form-control.d.ts +72 -0
  792. package/dist/lib/form-control.d.ts.map +1 -0
  793. package/dist/lib/gradient.d.ts +31 -0
  794. package/dist/lib/gradient.d.ts.map +1 -0
  795. package/dist/lib/intl.d.ts +77 -0
  796. package/dist/lib/intl.d.ts.map +1 -0
  797. package/dist/lib/link-component.d.ts +13 -0
  798. package/dist/lib/link-component.d.ts.map +1 -0
  799. package/dist/lib/merge-refs.d.ts +12 -0
  800. package/dist/lib/merge-refs.d.ts.map +1 -0
  801. package/dist/lib/overlay-container.d.ts +14 -0
  802. package/dist/lib/overlay-container.d.ts.map +1 -0
  803. package/dist/lib/overlay-layer.d.ts +51 -0
  804. package/dist/lib/overlay-layer.d.ts.map +1 -0
  805. package/dist/lib/placement.d.ts +16 -0
  806. package/dist/lib/placement.d.ts.map +1 -0
  807. package/dist/lib/props.d.ts +40 -0
  808. package/dist/lib/props.d.ts.map +1 -0
  809. package/dist/lib/required-if.d.ts +46 -0
  810. package/dist/lib/required-if.d.ts.map +1 -0
  811. package/dist/lib/schedule-predicates.d.ts +72 -0
  812. package/dist/lib/schedule-predicates.d.ts.map +1 -0
  813. package/dist/lib/select-data.d.ts +135 -0
  814. package/dist/lib/select-data.d.ts.map +1 -0
  815. package/dist/lib/sizes.d.ts +20 -0
  816. package/dist/lib/sizes.d.ts.map +1 -0
  817. package/dist/lib/test-id.d.ts +30 -0
  818. package/dist/lib/test-id.d.ts.map +1 -0
  819. package/dist/lib/theme-init-runtime.d.ts +26 -0
  820. package/dist/lib/theme-init-runtime.d.ts.map +1 -0
  821. package/dist/lib/theme.d.ts +93 -0
  822. package/dist/lib/theme.d.ts.map +1 -0
  823. package/dist/lib/tree-data.d.ts +99 -0
  824. package/dist/lib/tree-data.d.ts.map +1 -0
  825. package/dist/lib/typography-size.d.ts +49 -0
  826. package/dist/lib/typography-size.d.ts.map +1 -0
  827. package/dist/lib/use-container-query.d.ts +19 -0
  828. package/dist/lib/use-container-query.d.ts.map +1 -0
  829. package/dist/lib/use-disclosure.d.ts +35 -0
  830. package/dist/lib/use-disclosure.d.ts.map +1 -0
  831. package/dist/lib/use-isomorphic-layout-effect.d.ts +12 -0
  832. package/dist/lib/use-isomorphic-layout-effect.d.ts.map +1 -0
  833. package/dist/lib/use-local-storage.d.ts +45 -0
  834. package/dist/lib/use-local-storage.d.ts.map +1 -0
  835. package/dist/lib/use-logger.d.ts +2 -0
  836. package/dist/lib/use-logger.d.ts.map +1 -0
  837. package/dist/lib/use-media-query.d.ts +11 -0
  838. package/dist/lib/use-media-query.d.ts.map +1 -0
  839. package/dist/lib/use-now.d.ts +7 -0
  840. package/dist/lib/use-now.d.ts.map +1 -0
  841. package/dist/lib/use-theme.d.ts +101 -0
  842. package/dist/lib/use-theme.d.ts.map +1 -0
  843. package/dist/lib/use-uncontrolled.d.ts +45 -0
  844. package/dist/lib/use-uncontrolled.d.ts.map +1 -0
  845. package/dist/styles.css +17 -0
  846. package/dist/test-setup.d.ts +2 -0
  847. package/dist/test-setup.d.ts.map +1 -0
  848. package/dist/theme-init-script.d.ts +2 -0
  849. package/dist/theme-init-script.d.ts.map +1 -0
  850. package/dist/theme-init.js +2 -0
  851. package/dist/theme-init.js.map +1 -0
  852. package/dist/theme.css +1275 -0
  853. package/package.json +99 -3
  854. package/src/colors.css +296 -0
  855. package/src/components/accordion/accordion-data.tsx +86 -0
  856. package/src/components/accordion/accordion.test.tsx +234 -0
  857. package/src/components/accordion/accordion.tsx +336 -0
  858. package/src/components/accordion/index.ts +18 -0
  859. package/src/components/action-icon/action-icon.test.tsx +57 -0
  860. package/src/components/action-icon/action-icon.tsx +180 -0
  861. package/src/components/action-icon/index.ts +12 -0
  862. package/src/components/alert/alert.test.tsx +125 -0
  863. package/src/components/alert/alert.tsx +158 -0
  864. package/src/components/alert/index.ts +3 -0
  865. package/src/components/ambient-background/ambient-background.test.tsx +64 -0
  866. package/src/components/ambient-background/ambient-background.tsx +76 -0
  867. package/src/components/ambient-background/index.ts +1 -0
  868. package/src/components/app-shell/app-shell.test.tsx +271 -0
  869. package/src/components/app-shell/app-shell.tsx +492 -0
  870. package/src/components/app-shell/index.ts +17 -0
  871. package/src/components/autocomplete/autocomplete.test.tsx +120 -0
  872. package/src/components/autocomplete/autocomplete.tsx +249 -0
  873. package/src/components/autocomplete/index.ts +11 -0
  874. package/src/components/avatar/avatar.test.tsx +345 -0
  875. package/src/components/avatar/avatar.tsx +456 -0
  876. package/src/components/avatar/index.ts +12 -0
  877. package/src/components/badge/badge.test.tsx +51 -0
  878. package/src/components/badge/badge.tsx +148 -0
  879. package/src/components/badge/index.ts +6 -0
  880. package/src/components/breadcrumb/breadcrumb.test.tsx +238 -0
  881. package/src/components/breadcrumb/breadcrumb.tsx +348 -0
  882. package/src/components/breadcrumb/index.ts +9 -0
  883. package/src/components/button/button.test.tsx +87 -0
  884. package/src/components/button/button.tsx +253 -0
  885. package/src/components/button/index.ts +12 -0
  886. package/src/components/button-group/button-group.test.tsx +168 -0
  887. package/src/components/button-group/button-group.tsx +121 -0
  888. package/src/components/button-group/index.ts +1 -0
  889. package/src/components/button-multi-select/button-multi-select.test.tsx +146 -0
  890. package/src/components/button-multi-select/button-multi-select.tsx +76 -0
  891. package/src/components/button-multi-select/index.ts +17 -0
  892. package/src/components/button-select/button-select-control.tsx +153 -0
  893. package/src/components/button-select/button-select-data.tsx +96 -0
  894. package/src/components/button-select/button-select-items.ts +103 -0
  895. package/src/components/button-select/button-select.test.tsx +239 -0
  896. package/src/components/button-select/button-select.tsx +323 -0
  897. package/src/components/button-select/index.ts +14 -0
  898. package/src/components/calendar/calendar-body.tsx +403 -0
  899. package/src/components/calendar/calendar.test.tsx +278 -0
  900. package/src/components/calendar/calendar.tsx +220 -0
  901. package/src/components/calendar/index.ts +10 -0
  902. package/src/components/card/card.tsx +211 -0
  903. package/src/components/card/index.ts +12 -0
  904. package/src/components/chart/chart.test.tsx +98 -0
  905. package/src/components/chart/chart.tsx +192 -0
  906. package/src/components/chart/index.ts +8 -0
  907. package/src/components/chart/styles.css +50 -0
  908. package/src/components/checkbox/checkbox.test.tsx +113 -0
  909. package/src/components/checkbox/checkbox.tsx +182 -0
  910. package/src/components/checkbox/control.ts +76 -0
  911. package/src/components/checkbox/index.ts +3 -0
  912. package/src/components/choice-card-group/choice-card-group.test.tsx +250 -0
  913. package/src/components/choice-card-group/choice-card-group.tsx +549 -0
  914. package/src/components/choice-card-group/index.ts +9 -0
  915. package/src/components/circular-progress/circular-progress.test.tsx +120 -0
  916. package/src/components/circular-progress/circular-progress.tsx +214 -0
  917. package/src/components/circular-progress/index.ts +15 -0
  918. package/src/components/clipboard/clipboard.test.tsx +229 -0
  919. package/src/components/clipboard/clipboard.tsx +128 -0
  920. package/src/components/clipboard/copy.tsx +127 -0
  921. package/src/components/clipboard/index.ts +12 -0
  922. package/src/components/code/code.test.tsx +57 -0
  923. package/src/components/code/code.tsx +54 -0
  924. package/src/components/code/index.ts +1 -0
  925. package/src/components/code-block/chrome.tsx +347 -0
  926. package/src/components/code-block/code-block.test.tsx +252 -0
  927. package/src/components/code-block/code-block.tsx +254 -0
  928. package/src/components/code-block/diff.test.ts +177 -0
  929. package/src/components/code-block/diff.ts +114 -0
  930. package/src/components/code-block/gutters.test.ts +280 -0
  931. package/src/components/code-block/gutters.ts +260 -0
  932. package/src/components/code-block/highlighter.test.ts +261 -0
  933. package/src/components/code-block/highlighter.ts +290 -0
  934. package/src/components/code-block/index.ts +53 -0
  935. package/src/components/code-block/notation.test.ts +166 -0
  936. package/src/components/code-block/notation.ts +233 -0
  937. package/src/components/code-block/presets.test.ts +43 -0
  938. package/src/components/code-block/presets.ts +28 -0
  939. package/src/components/code-block/static.tsx +130 -0
  940. package/src/components/code-block/styles.css +198 -0
  941. package/src/components/collapse/collapse.test.tsx +96 -0
  942. package/src/components/collapse/collapse.tsx +81 -0
  943. package/src/components/collapse/index.ts +1 -0
  944. package/src/components/combobox/combobox.tsx +317 -0
  945. package/src/components/combobox/index.ts +15 -0
  946. package/src/components/combobox-list/combobox-list.test.tsx +148 -0
  947. package/src/components/combobox-list/combobox-list.tsx +276 -0
  948. package/src/components/combobox-list/index.ts +3 -0
  949. package/src/components/container/container.tsx +47 -0
  950. package/src/components/container/index.ts +1 -0
  951. package/src/components/data-table/data-table-features.ts +127 -0
  952. package/src/components/data-table/data-table-filter/data-table-date-filter.tsx +275 -0
  953. package/src/components/data-table/data-table-filter/data-table-filter-fns.ts +126 -0
  954. package/src/components/data-table/data-table-filter/data-table-number-filter.tsx +74 -0
  955. package/src/components/data-table/data-table-filter/data-table-select-filter.tsx +47 -0
  956. package/src/components/data-table/data-table-filter/data-table-text-filter.tsx +29 -0
  957. package/src/components/data-table/data-table-filter/index.tsx +62 -0
  958. package/src/components/data-table/data-table-filter/utils.ts +112 -0
  959. package/src/components/data-table/data-table-filter-fns.test.tsx +145 -0
  960. package/src/components/data-table/data-table-filter.test.tsx +365 -0
  961. package/src/components/data-table/data-table-header-cell.tsx +292 -0
  962. package/src/components/data-table/data-table-meta.ts +102 -0
  963. package/src/components/data-table/data-table-pagination.tsx +175 -0
  964. package/src/components/data-table/data-table-placeholder.tsx +61 -0
  965. package/src/components/data-table/data-table-schema.test.tsx +22 -0
  966. package/src/components/data-table/data-table-schema.ts +23 -0
  967. package/src/components/data-table/data-table-skeleton.ts +9 -0
  968. package/src/components/data-table/data-table-stack.tsx +376 -0
  969. package/src/components/data-table/data-table-state.ts +35 -0
  970. package/src/components/data-table/data-table-toolbar.tsx +81 -0
  971. package/src/components/data-table/data-table.test.tsx +1143 -0
  972. package/src/components/data-table/data-table.tsx +829 -0
  973. package/src/components/data-table/index.ts +46 -0
  974. package/src/components/date-picker/aliases.tsx +15 -0
  975. package/src/components/date-picker/date-picker.test.tsx +699 -0
  976. package/src/components/date-picker/date-picker.tsx +1000 -0
  977. package/src/components/date-picker/date-time-text.test.ts +68 -0
  978. package/src/components/date-picker/date-time-text.ts +103 -0
  979. package/src/components/date-picker/index.ts +32 -0
  980. package/src/components/divider/divider.test.tsx +106 -0
  981. package/src/components/divider/divider.tsx +162 -0
  982. package/src/components/divider/index.ts +8 -0
  983. package/src/components/drawer/drawer.tsx +405 -0
  984. package/src/components/drawer/index.ts +21 -0
  985. package/src/components/field/field.tsx +235 -0
  986. package/src/components/field/index.ts +3 -0
  987. package/src/components/file-upload/file-upload.test.tsx +47 -0
  988. package/src/components/file-upload/file-upload.tsx +280 -0
  989. package/src/components/file-upload/index.ts +3 -0
  990. package/src/components/flex/flex.tsx +81 -0
  991. package/src/components/flex/index.ts +1 -0
  992. package/src/components/grid/grid.tsx +52 -0
  993. package/src/components/grid/index.ts +1 -0
  994. package/src/components/hover-card/hover-card.test.tsx +192 -0
  995. package/src/components/hover-card/hover-card.tsx +376 -0
  996. package/src/components/hover-card/index.ts +9 -0
  997. package/src/components/indicator/index.ts +6 -0
  998. package/src/components/indicator/indicator.test.tsx +241 -0
  999. package/src/components/indicator/indicator.tsx +275 -0
  1000. package/src/components/input/index.ts +12 -0
  1001. package/src/components/input/input.test.tsx +111 -0
  1002. package/src/components/input/input.tsx +320 -0
  1003. package/src/components/kbd/index.ts +1 -0
  1004. package/src/components/kbd/kbd.test.tsx +20 -0
  1005. package/src/components/kbd/kbd.tsx +98 -0
  1006. package/src/components/mark/index.ts +1 -0
  1007. package/src/components/mark/mark.test.tsx +85 -0
  1008. package/src/components/mark/mark.tsx +79 -0
  1009. package/src/components/menu/index.ts +27 -0
  1010. package/src/components/menu/menu-data.tsx +230 -0
  1011. package/src/components/menu/menu.test.tsx +547 -0
  1012. package/src/components/menu/menu.tsx +514 -0
  1013. package/src/components/modal/index.ts +14 -0
  1014. package/src/components/modal/modal.tsx +420 -0
  1015. package/src/components/multi-combobox-list/index.ts +3 -0
  1016. package/src/components/multi-combobox-list/multi-combobox-list.test.tsx +190 -0
  1017. package/src/components/multi-combobox-list/multi-combobox-list.tsx +308 -0
  1018. package/src/components/multi-select/index.ts +12 -0
  1019. package/src/components/multi-select/multi-select.test.tsx +248 -0
  1020. package/src/components/multi-select/multi-select.tsx +355 -0
  1021. package/src/components/nav-link/index.ts +4 -0
  1022. package/src/components/nav-link/nav-link.test.tsx +107 -0
  1023. package/src/components/nav-link/nav-link.tsx +205 -0
  1024. package/src/components/nav-link/navigation.test.tsx +117 -0
  1025. package/src/components/nav-link/navigation.tsx +81 -0
  1026. package/src/components/nav-link/tanstack.tsx +67 -0
  1027. package/src/components/notification/create-notifier.tsx +517 -0
  1028. package/src/components/notification/index.ts +20 -0
  1029. package/src/components/notification/notification.test.tsx +306 -0
  1030. package/src/components/notification/notification.tsx +353 -0
  1031. package/src/components/notification/store.ts +159 -0
  1032. package/src/components/notification/types.ts +67 -0
  1033. package/src/components/number-input/index.ts +3 -0
  1034. package/src/components/number-input/number-input.test.tsx +291 -0
  1035. package/src/components/number-input/number-input.tsx +407 -0
  1036. package/src/components/overlays/create-overlays.tsx +267 -0
  1037. package/src/components/overlays/index.ts +25 -0
  1038. package/src/components/overlays/renderer.tsx +214 -0
  1039. package/src/components/overlays/store.ts +103 -0
  1040. package/src/components/overlays/types.ts +150 -0
  1041. package/src/components/password-input/index.ts +3 -0
  1042. package/src/components/password-input/password-input.test.tsx +94 -0
  1043. package/src/components/password-input/password-input.tsx +191 -0
  1044. package/src/components/pill/index.ts +9 -0
  1045. package/src/components/pill/pill.test.tsx +22 -0
  1046. package/src/components/pill/pill.tsx +221 -0
  1047. package/src/components/pills-input/index.ts +12 -0
  1048. package/src/components/pills-input/pills-input.test.ts +136 -0
  1049. package/src/components/pills-input/pills-input.tsx +422 -0
  1050. package/src/components/pin-input/index.ts +3 -0
  1051. package/src/components/pin-input/pin-input.test.tsx +74 -0
  1052. package/src/components/pin-input/pin-input.tsx +186 -0
  1053. package/src/components/popover/icons.tsx +129 -0
  1054. package/src/components/popover/index.ts +8 -0
  1055. package/src/components/popover/popover.test.tsx +223 -0
  1056. package/src/components/popover/popover.tsx +635 -0
  1057. package/src/components/progress/index.ts +18 -0
  1058. package/src/components/progress/progress.test.tsx +112 -0
  1059. package/src/components/progress/progress.tsx +194 -0
  1060. package/src/components/radio-group/index.ts +9 -0
  1061. package/src/components/radio-group/radio-group.test.tsx +107 -0
  1062. package/src/components/radio-group/radio-group.tsx +207 -0
  1063. package/src/components/rating/icons.tsx +35 -0
  1064. package/src/components/rating/index.ts +9 -0
  1065. package/src/components/rating/rating.test.tsx +288 -0
  1066. package/src/components/rating/rating.tsx +389 -0
  1067. package/src/components/schedule/index.ts +170 -0
  1068. package/src/components/schedule/now-cursor-line.test.tsx +262 -0
  1069. package/src/components/schedule/now-cursor-line.tsx +343 -0
  1070. package/src/components/schedule/schedule-agenda-list.tsx +480 -0
  1071. package/src/components/schedule/schedule-agenda-view.test.tsx +333 -0
  1072. package/src/components/schedule/schedule-agenda-view.tsx +209 -0
  1073. package/src/components/schedule/schedule-all-day-row.test.ts +187 -0
  1074. package/src/components/schedule/schedule-all-day-row.tsx +616 -0
  1075. package/src/components/schedule/schedule-create-draft.tsx +181 -0
  1076. package/src/components/schedule/schedule-dates.test.ts +771 -0
  1077. package/src/components/schedule/schedule-dates.ts +721 -0
  1078. package/src/components/schedule/schedule-day-view.tsx +30 -0
  1079. package/src/components/schedule/schedule-days-view.tsx +277 -0
  1080. package/src/components/schedule/schedule-details-popover.test.tsx +765 -0
  1081. package/src/components/schedule/schedule-disabled-overlay.tsx +51 -0
  1082. package/src/components/schedule/schedule-drag-ghost.tsx +157 -0
  1083. package/src/components/schedule/schedule-event-chip.tsx +1176 -0
  1084. package/src/components/schedule/schedule-event-details.tsx +101 -0
  1085. package/src/components/schedule/schedule-event-list-popover-content.tsx +149 -0
  1086. package/src/components/schedule/schedule-event-styles.ts +60 -0
  1087. package/src/components/schedule/schedule-geometry.test.ts +426 -0
  1088. package/src/components/schedule/schedule-geometry.ts +461 -0
  1089. package/src/components/schedule/schedule-grid-gesture.test.ts +153 -0
  1090. package/src/components/schedule/schedule-grid-gesture.ts +567 -0
  1091. package/src/components/schedule/schedule-layout.test.ts +260 -0
  1092. package/src/components/schedule/schedule-layout.ts +270 -0
  1093. package/src/components/schedule/schedule-month-view.test.tsx +193 -0
  1094. package/src/components/schedule/schedule-month-view.tsx +688 -0
  1095. package/src/components/schedule/schedule-next-up-grouping.test.ts +95 -0
  1096. package/src/components/schedule/schedule-next-up-grouping.ts +69 -0
  1097. package/src/components/schedule/schedule-next-up.test.tsx +189 -0
  1098. package/src/components/schedule/schedule-next-up.tsx +136 -0
  1099. package/src/components/schedule/schedule-overflow-chip.tsx +156 -0
  1100. package/src/components/schedule/schedule-overflow-popover.tsx +173 -0
  1101. package/src/components/schedule/schedule-segments.test.ts +201 -0
  1102. package/src/components/schedule/schedule-segments.ts +120 -0
  1103. package/src/components/schedule/schedule-snap.test.ts +546 -0
  1104. package/src/components/schedule/schedule-snap.ts +380 -0
  1105. package/src/components/schedule/schedule-timed-grid.tsx +1609 -0
  1106. package/src/components/schedule/schedule-toolbar.tsx +264 -0
  1107. package/src/components/schedule/schedule-type-cost.test.ts +104 -0
  1108. package/src/components/schedule/schedule-types.test.ts +64 -0
  1109. package/src/components/schedule/schedule-types.ts +1149 -0
  1110. package/src/components/schedule/schedule-views.test.ts +263 -0
  1111. package/src/components/schedule/schedule-views.ts +293 -0
  1112. package/src/components/schedule/schedule-week-view.tsx +25 -0
  1113. package/src/components/schedule/schedule-year-view.test.tsx +105 -0
  1114. package/src/components/schedule/schedule-year-view.tsx +305 -0
  1115. package/src/components/schedule/schedule.test.tsx +4268 -0
  1116. package/src/components/schedule/schedule.tsx +1038 -0
  1117. package/src/components/schedule/use-event-create.ts +590 -0
  1118. package/src/components/schedule/use-event-drag.ts +504 -0
  1119. package/src/components/schedule/use-event-resize.ts +563 -0
  1120. package/src/components/schedule/use-schedule-selection.ts +119 -0
  1121. package/src/components/schedule/use-schedule.test.ts +91 -0
  1122. package/src/components/schedule/use-schedule.ts +135 -0
  1123. package/src/components/segment-group/index.ts +15 -0
  1124. package/src/components/segment-group/segment-group.test.tsx +172 -0
  1125. package/src/components/segment-group/segment-group.tsx +570 -0
  1126. package/src/components/select/index.ts +12 -0
  1127. package/src/components/select/select.test.tsx +173 -0
  1128. package/src/components/select/select.tsx +405 -0
  1129. package/src/components/skeleton/index.ts +7 -0
  1130. package/src/components/skeleton/skeleton.test.tsx +96 -0
  1131. package/src/components/skeleton/skeleton.tsx +178 -0
  1132. package/src/components/slider/index.ts +3 -0
  1133. package/src/components/slider/slider.test.tsx +136 -0
  1134. package/src/components/slider/slider.tsx +390 -0
  1135. package/src/components/slider/sliderThumb.tsx +0 -0
  1136. package/src/components/spinner/index.ts +6 -0
  1137. package/src/components/spinner/spinner.tsx +136 -0
  1138. package/src/components/switch/index.ts +3 -0
  1139. package/src/components/switch/switch.test.tsx +98 -0
  1140. package/src/components/switch/switch.tsx +234 -0
  1141. package/src/components/table/index.ts +14 -0
  1142. package/src/components/table/table.test.tsx +262 -0
  1143. package/src/components/table/table.tsx +309 -0
  1144. package/src/components/tabs/index.ts +17 -0
  1145. package/src/components/tabs/tabs-data.tsx +125 -0
  1146. package/src/components/tabs/tabs.test.tsx +172 -0
  1147. package/src/components/tabs/tabs.tsx +292 -0
  1148. package/src/components/tags-input/index.ts +3 -0
  1149. package/src/components/tags-input/tags-input.test.tsx +85 -0
  1150. package/src/components/tags-input/tags-input.tsx +294 -0
  1151. package/src/components/text/index.ts +1 -0
  1152. package/src/components/text/text.test.tsx +73 -0
  1153. package/src/components/text/text.tsx +107 -0
  1154. package/src/components/text-input/index.ts +3 -0
  1155. package/src/components/text-input/text-input.test.tsx +129 -0
  1156. package/src/components/text-input/text-input.tsx +88 -0
  1157. package/src/components/textarea/index.ts +3 -0
  1158. package/src/components/textarea/textarea.test.tsx +88 -0
  1159. package/src/components/textarea/textarea.tsx +205 -0
  1160. package/src/components/theme-icon/index.ts +7 -0
  1161. package/src/components/theme-icon/theme-icon.test.tsx +20 -0
  1162. package/src/components/theme-icon/theme-icon.tsx +114 -0
  1163. package/src/components/theme-script/index.ts +1 -0
  1164. package/src/components/theme-script/theme-script.tsx +68 -0
  1165. package/src/components/time-input/hour-cycle.ts +61 -0
  1166. package/src/components/time-input/index.ts +4 -0
  1167. package/src/components/time-input/time-input.test.tsx +292 -0
  1168. package/src/components/time-input/time-input.tsx +196 -0
  1169. package/src/components/time-input/time-row.tsx +305 -0
  1170. package/src/components/timeline/index.ts +11 -0
  1171. package/src/components/timeline/timeline.test.tsx +701 -0
  1172. package/src/components/timeline/timeline.tsx +720 -0
  1173. package/src/components/title/index.ts +1 -0
  1174. package/src/components/title/title.test.tsx +68 -0
  1175. package/src/components/title/title.tsx +95 -0
  1176. package/src/components/tooltip/index.ts +9 -0
  1177. package/src/components/tooltip/tooltip.test.tsx +96 -0
  1178. package/src/components/tooltip/tooltip.tsx +255 -0
  1179. package/src/components/tree-multi-select/index.ts +11 -0
  1180. package/src/components/tree-multi-select/tree-multi-select.test.tsx +327 -0
  1181. package/src/components/tree-multi-select/tree-multi-select.tsx +626 -0
  1182. package/src/components/tree-select/index.ts +11 -0
  1183. package/src/components/tree-select/tree-select.test.tsx +376 -0
  1184. package/src/components/tree-select/tree-select.tsx +634 -0
  1185. package/src/index.ts +64 -0
  1186. package/src/lib/align.ts +6 -0
  1187. package/src/lib/available-if.test.ts +76 -0
  1188. package/src/lib/available-if.ts +114 -0
  1189. package/src/lib/brand.ts +19 -0
  1190. package/src/lib/cn.test.ts +13 -0
  1191. package/src/lib/cn.ts +28 -0
  1192. package/src/lib/colors.ts +31 -0
  1193. package/src/lib/control-open.ts +38 -0
  1194. package/src/lib/date-predicates.test.ts +149 -0
  1195. package/src/lib/date-predicates.ts +83 -0
  1196. package/src/lib/date-value.test.ts +107 -0
  1197. package/src/lib/date-value.ts +76 -0
  1198. package/src/lib/dev-warn.ts +18 -0
  1199. package/src/lib/focus-styles.test.ts +138 -0
  1200. package/src/lib/focus-styles.ts +145 -0
  1201. package/src/lib/form-control.ts +72 -0
  1202. package/src/lib/gradient.ts +81 -0
  1203. package/src/lib/intl-direction.test.tsx +96 -0
  1204. package/src/lib/intl.test.tsx +162 -0
  1205. package/src/lib/intl.tsx +210 -0
  1206. package/src/lib/link-component.test.tsx +46 -0
  1207. package/src/lib/link-component.tsx +32 -0
  1208. package/src/lib/merge-refs.ts +20 -0
  1209. package/src/lib/overlay-container.test.tsx +69 -0
  1210. package/src/lib/overlay-container.tsx +64 -0
  1211. package/src/lib/overlay-layer.test.tsx +139 -0
  1212. package/src/lib/overlay-layer.tsx +81 -0
  1213. package/src/lib/placement.ts +23 -0
  1214. package/src/lib/props.ts +48 -0
  1215. package/src/lib/required-if.ts +57 -0
  1216. package/src/lib/schedule-predicates.test.ts +230 -0
  1217. package/src/lib/schedule-predicates.ts +193 -0
  1218. package/src/lib/select-data.ts +227 -0
  1219. package/src/lib/sizes.ts +20 -0
  1220. package/src/lib/test-id.ts +27 -0
  1221. package/src/lib/theme-init-runtime.test.ts +152 -0
  1222. package/src/lib/theme-init-runtime.ts +79 -0
  1223. package/src/lib/theme.test.ts +223 -0
  1224. package/src/lib/theme.ts +153 -0
  1225. package/src/lib/tree-data.ts +159 -0
  1226. package/src/lib/typography-size.ts +59 -0
  1227. package/src/lib/use-container-query.test.ts +83 -0
  1228. package/src/lib/use-container-query.ts +44 -0
  1229. package/src/lib/use-disclosure.test.ts +85 -0
  1230. package/src/lib/use-disclosure.ts +77 -0
  1231. package/src/lib/use-isomorphic-layout-effect.ts +12 -0
  1232. package/src/lib/use-local-storage.test.ts +165 -0
  1233. package/src/lib/use-local-storage.ts +178 -0
  1234. package/src/lib/use-logger.ts +39 -0
  1235. package/src/lib/use-media-query.test.ts +77 -0
  1236. package/src/lib/use-media-query.ts +35 -0
  1237. package/src/lib/use-now.ts +59 -0
  1238. package/src/lib/use-theme.test.ts +305 -0
  1239. package/src/lib/use-theme.ts +279 -0
  1240. package/src/lib/use-uncontrolled.test.ts +207 -0
  1241. package/src/lib/use-uncontrolled.ts +85 -0
  1242. package/src/styles.css +17 -0
  1243. package/src/test-setup.ts +130 -0
  1244. package/src/theme-init-script.ts +10 -0
  1245. package/src/theme.css +1275 -0
  1246. package/src/theme.forced-colors.test.tsx +215 -0
  1247. package/src/theme.test.ts +221 -0
  1248. package/src/visually-hidden-containment.test.tsx +98 -0
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/lib/schedule-predicates.ts","../../../src/lib/use-now.ts","../../../src/components/schedule/schedule-dates.ts","../../../src/components/schedule/schedule-event-details.tsx","../../../src/components/schedule/use-schedule-selection.ts","../../../src/components/schedule/schedule-agenda-list.tsx","../../../src/components/schedule/schedule-next-up-grouping.ts","../../../src/components/schedule/schedule-types.ts","../../../src/components/schedule/schedule-views.ts","../../../src/components/schedule/schedule-toolbar.tsx","../../../src/components/schedule/schedule-agenda-view.tsx","../../../src/components/schedule/schedule-geometry.ts","../../../src/components/schedule/now-cursor-line.tsx","../../../src/components/schedule/schedule-event-styles.ts","../../../src/components/schedule/schedule-event-list-popover-content.tsx","../../../src/components/schedule/schedule-overflow-popover.tsx","../../../src/components/schedule/schedule-all-day-row.tsx","../../../src/components/schedule/schedule-create-draft.tsx","../../../src/components/schedule/schedule-disabled-overlay.tsx","../../../src/components/schedule/schedule-drag-ghost.tsx","../../../src/components/schedule/schedule-snap.ts","../../../src/components/schedule/schedule-grid-gesture.ts","../../../src/components/schedule/use-event-drag.ts","../../../src/components/schedule/use-event-resize.ts","../../../src/components/schedule/schedule-event-chip.tsx","../../../src/components/schedule/schedule-layout.ts","../../../src/components/schedule/schedule-overflow-chip.tsx","../../../src/components/schedule/schedule-segments.ts","../../../src/components/schedule/use-event-create.ts","../../../src/components/schedule/schedule-timed-grid.tsx","../../../src/components/schedule/schedule-days-view.tsx","../../../src/components/schedule/schedule-month-view.tsx","../../../src/components/schedule/schedule-year-view.tsx","../../../src/components/schedule/schedule.tsx","../../../src/components/schedule/schedule-day-view.tsx","../../../src/components/schedule/schedule-next-up.tsx","../../../src/components/schedule/schedule-week-view.tsx","../../../src/components/schedule/use-schedule.ts","../../../src/components/schedule/index.ts"],"names":["startOfWeek","calendarStartOfWeek","getLocalTimeZone","jsx","jsxs","Fragment","useRef","ark","width","useState","match","range","useCallback","flashRejected","cva","props","isToday","stickySurface","useLayoutEffect","eventCountLabel","useEffect","gutter"],"mappings":";;;;;;;;;;;;;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MACL,KAAA,EAAO,aAAA;AAAA,MACP,IAAA;AAAA,MACA,YAAA,EAAc,OAAA;AAAA,MACd,IAAA;AAAA,MACA,YAAA,EAAc,OAAA;AAAA,MACd,QAAA;AAAA,MACA,UAAU,CAAC,KAAA,KAAU,WAAA,CAAY,KAAA,EAAO,MAAM,IAAI;AAAA,KACpD;AAAA,IACA;AAAA,GACF;AACF;;;ACyBO,IAAM,QAAA,GAAW,MAAA,CAAO,MAAA,CAAO,YAAA,EAAe;AAAA,EACnD,IAAA,EAAM,YAAA;AAAA,EACN,QAAA;AAAA,EACA,OAAA;AAAA,EACA,QAAA;AAAA,EACA,SAAA;AAAA,EACA,QAAA;AAAA,EACA,UAAA;AAAA,EACA,OAAA,EAAS,eAAA;AAAA,EACT,MAAA,EAAQ;AACV,CAAC","file":"index.js","sourcesContent":["import { getLocalTimeZone, isWeekend, type ZonedDateTime } from \"@internationalized/date\"\nimport { calendarValueToDate, dateToCalendarValue } from \"./date-value\"\n\n/**\n * RFC Β§12 (`docs/rfcs/schedule.md`) disabled-slot predicates β€” a range-shaped\n * sibling to `date-predicates.ts`'s day-shaped `(date: Date) => boolean`\n * factories. Kept as a separate module/type rather than an overload of the\n * same exports: the signatures genuinely differ (`(range) => boolean` vs.\n * `(date) => boolean`), so there's nothing to share beyond the naming\n * convention.\n *\n * slotDisabled={anyOf(disablePast(), disableOutsideHours(9, 17), disableWeekends())}\n *\n * The factories stay zero-arg (or value-only) so they read naturally at the\n * call site; the zone every calendar reading is interpreted in arrives as the\n * predicate's *second argument*, which `Schedule`/`DaysView` fill in with the\n * very `timeZone` they were given β€” the same convention, and the same\n * reasoning, as `date-predicates.ts`'s own header. A predicate therefore can't\n * disagree with the grid restricting by it: `<Schedule timeZone=\"UTC\"\n * slotDisabled={disableOutsideHours(9, 17)} />` disables 9–17 *UTC* whatever\n * the host zone is, instead of whichever hours happened to be 9–17 where the\n * code ran.\n *\n * **Multi-day ranges are evaluated per calendar day.** Two-axis create (RFC\n * Β§12c) and cross-day drag both hand these predicates ranges that span more\n * than one day, so a range is disabled when *any* day it touches is disabled,\n * each day judged against that day's own portion of the range. The end stays\n * exclusive throughout: a range ending exactly at midnight does not touch the\n * following day.\n */\n\n/** `isWeekend` needs a locale; these zero-arg helpers don't take one, so the\n * Gregorian Saturday/Sunday convention is the v1 default β€” same rationale as\n * `date-predicates.ts`'s own `WEEKEND_LOCALE`. */\nconst WEEKEND_LOCALE = \"en-US\"\n\nconst MINUTES_PER_DAY = 24 * 60\n\n/**\n * A slot-restriction predicate: the candidate range, plus the `timeZone` to\n * read it in.\n *\n * `Schedule`/`DaysView` always pass their own resolved `timeZone` β€” the\n * argument is optional only so a predicate stays callable on its own (a unit\n * test, filtering a plain array), where it falls back to the host zone exactly\n * as before.\n */\nexport type ScheduleSlotPredicate = (\n range: { start: Date; end: Date },\n timeZone?: string,\n) => boolean\n\n/** `dateToCalendarValue` is `fromDate`, which always produces a\n * `ZonedDateTime`; casting back to the concrete type keeps `.hour`/`.set`\n * on its own overloads rather than the `DateValue` union's β€” the same cast,\n * for the same reason, as `schedule-dates.ts`'s own `toZoned`. */\nconst zoned = (date: Date, timeZone: string): ZonedDateTime =>\n dateToCalendarValue(date, timeZone) as ZonedDateTime\n\nconst minutesOfDay = (date: Date, timeZone: string): number => {\n const value = zoned(date, timeZone)\n return value.hour * 60 + value.minute\n}\n\n/** The local-midnight instant (ms) of the calendar day `date` falls on. */\nconst dayStartMs = (date: Date, timeZone: string): number =>\n calendarValueToDate(\n zoned(date, timeZone).set({ hour: 0, minute: 0, second: 0, millisecond: 0 }),\n timeZone,\n ).getTime()\n\n/** The first and last calendar days a `[start, end)` range touches, as\n * local-midnight instants. The last is read from `end - 1ms`, which is what\n * makes the end exclusive for free: a range ending exactly at midnight stops\n * on the previous day. */\nconst touchedDays = (\n { start, end }: { start: Date; end: Date },\n timeZone: string,\n): { first: number; last: number } => {\n const first = dayStartMs(start, timeZone)\n const last =\n end.getTime() > start.getTime() ? dayStartMs(new Date(end.getTime() - 1), timeZone) : first\n return { first, last }\n}\n\n/**\n * Disable any slot that isn't *entirely* within `[startHour, endHour)` of\n * every calendar day it touches.\n *\n * Both ends are checked, not just `start`, so an event can't be\n * dragged/resized so its end crosses outside the allowed window while its\n * start stays put. `end` is checked with a strict `>` against `endHour:00`\n * (not `>=`): a slot ending exactly at the boundary doesn't overlap the\n * disabled region, the same exclusive-end convention `rangesOverlap` uses\n * everywhere else in Schedule. An `end` landing exactly on a day boundary\n * closes its own day at `24:00` rather than opening the next one at `00:00`,\n * or a 20:00 β†’ 00:00 slot would read as ending before it started.\n *\n * **Why there is no day loop.** A range covering more than two days has\n * intermediate days whose portion is the whole `[00:00, 24:00)`, and a whole\n * day passes only when the window is `(0, 24)` β€” in which case *every* slice\n * passes, the two ends included. So checking the first day's slice and the\n * last day's slice already decides every day in between, whatever the span.\n *\n * Overnight events stay supported: `disableOutsideHours(0, 24)` disables\n * nothing. A *wrapping* window (a 20:00 β†’ 06:00 night shift) is still not\n * expressible here β€” reach for `disableDateRanges` or a hand-written\n * predicate.\n */\nexport const disableOutsideHours =\n (startHour: number, endHour: number): ScheduleSlotPredicate =>\n (range, timeZone = getLocalTimeZone()) => {\n const outside = (from: number, to: number) =>\n from < startHour * 60 || from >= endHour * 60 || to > endHour * 60\n\n const { first, last } = touchedDays(range, timeZone)\n const multiDay = last > first\n const endMinutes =\n dayStartMs(range.end, timeZone) > last ? MINUTES_PER_DAY : minutesOfDay(range.end, timeZone)\n\n // The first day's slice: [start, end) when the range stays put, otherwise\n // [start, midnight-after).\n if (outside(minutesOfDay(range.start, timeZone), multiDay ? MINUTES_PER_DAY : endMinutes)) {\n return true\n }\n if (!multiDay) return false\n // The last day's slice: [midnight, end).\n return outside(0, endMinutes)\n }\n\n/** Disable any slot starting before the current moment β€” for restricting\n * event creation/placement to the future. Reads the live clock on every\n * call rather than once at factory time, so the boundary keeps up as time\n * passes instead of going stale for a predicate created once and reused;\n * pass `now` to pin it for tests/Storybook.\n *\n * Deliberately `start`-only, and deliberately zone-independent: this is an\n * *instant* comparison, not a calendar one, so it gives the same answer in\n * every zone and has no use for the second argument. `start`-only is also the\n * right range semantics β€” a range starting in the past is partly in the past,\n * and one starting in the future is *entirely* in the future since\n * `end > start`. There is no third case for a per-day walk to find. */\nexport const disablePast = (now?: Date): ScheduleSlotPredicate => {\n return ({ start }) => start.getTime() < (now ?? new Date()).getTime()\n}\n\n/** Disable any slot that touches a Saturday/Sunday β€” every calendar day the\n * range covers, not just the one it starts on. A Friday-evening drag that\n * runs past midnight lands on Saturday, and a Friday β†’ Monday span covers a\n * weekend neither of its own ends sits on.\n *\n * The walk is bounded at seven iterations however long the range is: any\n * seven consecutive days contain a Saturday, so a longer range returns on the\n * way through. */\nexport const disableWeekends = (): ScheduleSlotPredicate => {\n return (range, timeZone = getLocalTimeZone()) => {\n const { last } = touchedDays(range, timeZone)\n let day = zoned(range.start, timeZone).set({\n hour: 0,\n minute: 0,\n second: 0,\n millisecond: 0,\n })\n while (calendarValueToDate(day, timeZone).getTime() <= last) {\n if (isWeekend(day, WEEKEND_LOCALE)) return true\n day = day.add({ days: 1 })\n }\n return false\n }\n}\n\n/** Disable any slot that overlaps one of the given ranges. Zone-independent\n * for the same reason as `disablePast` β€” pure instant overlap, no calendar\n * reading to interpret. */\nexport const disableDateRanges = (ranges: { start: Date; end: Date }[]): ScheduleSlotPredicate => {\n return (slot) =>\n ranges.some(\n (range) =>\n slot.start.getTime() < range.end.getTime() && range.start.getTime() < slot.end.getTime(),\n )\n}\n\n/** OR-combine predicates β€” disabled if ANY predicate disables the slot. */\nexport const anyOf =\n (...predicates: ScheduleSlotPredicate[]): ScheduleSlotPredicate =>\n (range, timeZone) =>\n predicates.some((predicate) => predicate(range, timeZone))\n\n/** AND-combine predicates β€” disabled only if EVERY predicate disables the slot. */\nexport const allOf =\n (...predicates: ScheduleSlotPredicate[]): ScheduleSlotPredicate =>\n (range, timeZone) =>\n predicates.every((predicate) => predicate(range, timeZone))\n","\"use client\"\n\nimport { useCallback, useRef, useSyncExternalStore } from \"react\"\n\n/**\n * RFC Β§13 (`docs/rfcs/schedule.md`) now-cursor clock β€” generic and SSR-safe\n * (not Schedule-specific), so it lives here rather than in the component\n * folder. Ticks once a minute, aligned to the minute boundary rather than a\n * plain `setInterval(fn, 60000)` from whenever the component happened to\n * mount, via `useSyncExternalStore`, mirroring `useMediaQuery`/\n * `useContainerQuery`'s subscribe/getSnapshot/getServerSnapshot shape.\n *\n * const now = useNow(props.now) // frozen if `props.now` is set, else live\n */\n\n// A server can't know \"now\" at the moment the client hydrates, so a fixed\n// epoch is the value both server and (pre-mount) client snapshots agree on\n// when there's no `override` β€” same reasoning as `useMediaQuery`'s `false`.\nconst EPOCH = new Date(0)\n\n/**\n * Live-ticking current time, or a frozen `override` when one is passed β€”\n * with genuinely no timers set up in that case, since a fixed time for\n * tests/Storybook shouldn't visually drift or tick.\n */\nexport function useNow(override?: Date): Date {\n // `getSnapshot` must return a stable reference between ticks β€” a fresh\n // `new Date()` on every call trips React's \"the result of getSnapshot\n // should be cached\" infinite-loop guard, since useSyncExternalStore treats\n // every render as \"the store changed\". The clock's current value lives in\n // this ref, mutated only inside the tick itself; getSnapshot only reads it.\n const clockRef = useRef<Date>(override ?? new Date())\n\n const subscribeToClock = useCallback(\n (onStoreChange: () => void) => {\n if (override) return () => {}\n const tick = () => {\n clockRef.current = new Date()\n onStoreChange()\n }\n const msToNextMinute = 60_000 - (Date.now() % 60_000)\n let interval: ReturnType<typeof setInterval> | undefined\n const timeout = setTimeout(() => {\n tick()\n interval = setInterval(tick, 60_000)\n }, msToNextMinute)\n return () => {\n clearTimeout(timeout)\n if (interval) clearInterval(interval)\n }\n },\n [override],\n )\n\n const getSnapshot = useCallback(() => override ?? clockRef.current, [override])\n const getServerSnapshot = useCallback(() => override ?? EPOCH, [override])\n\n return useSyncExternalStore(subscribeToClock, getSnapshot, getServerSnapshot)\n}\n","import {\n startOfWeek as calendarStartOfWeek,\n endOfMonth,\n endOfWeek,\n endOfYear,\n getDayOfWeek,\n startOfMonth,\n startOfYear,\n type ZonedDateTime,\n} from \"@internationalized/date\"\nimport { match } from \"ts-pattern\"\nimport { calendarValueToDate, dateToCalendarValue } from \"../../lib/date-value\"\nimport type { ScheduleSlotPredicate } from \"../../lib/schedule-predicates\"\nimport type {\n FirstDayOfWeek,\n ScheduleAlign,\n ScheduleAnyEvent,\n ScheduleEvent,\n ScheduleOverlapTarget,\n ScheduleStaticEvent,\n ScheduleView,\n} from \"./schedule-types\"\n\n/**\n * RFC Β§5 (`docs/rfcs/schedule.md`) date math. Kept in the component folder,\n * not `lib/` β€” it's keyed on `ScheduleView`, which nothing else in the kit\n * has. All arithmetic goes through `@internationalized/date`'s own `.add()`/\n * `.set()` instance methods on the value `lib/date-value.ts`'s boundary\n * produces β€” never hand-rolled ms/day math β€” so DST and month-length edges\n * are the library's problem, not ours.\n */\n\nexport type DateRange = { start: Date; end: Date }\n\ntype RangeOptions = {\n timeZone: string\n locale: string\n /**\n * `DaysView`/`Root`'s public prop is named `align` (not `startOfWeek` β€”\n * see `ScheduleAlign`'s own doc comment for why), but this option-bag\n * field keeps the lower-level `startOfWeek` name: it's fed into\n * `@internationalized/date`'s own `startOfWeek()` function below for\n * every branch (`\"days\"`, `\"month\"`, `\"year\"` alike), which is still an\n * accurate description of what's being computed here regardless of what\n * the public prop that supplies it is called.\n */\n startOfWeek?: ScheduleAlign\n /** `\"days\"` view's window size, in days. Default `7`. */\n visibleDays?: number\n}\ntype PaginateOptions = { timeZone: string; visibleDays?: number }\n\n/**\n * Narrows `DaysView`/`Root`'s wider `ScheduleAlign` (`FirstDayOfWeek |\n * \"relative\"`) down to what `@internationalized/date`'s own `startOfWeek`\n * accepts β€” `\"relative\"` isn't a real day-of-week, it's Schedule's own\n * \"don't snap, start the window at the anchor itself\" mode, so it resolves\n * to `undefined` (locale default) here rather than being forwarded. Shared\n * by `getVisibleRange`'s month/year branches (which have no `\"relative\"`\n * concept of their own) and `schedule.tsx`'s `Root`-to-`MonthView` forwarding.\n */\nexport function resolveWeekStartDay(\n startOfWeek?: FirstDayOfWeek | \"relative\",\n): FirstDayOfWeek | undefined {\n return startOfWeek === \"relative\" ? undefined : startOfWeek\n}\n\n/**\n * `dateToCalendarValue` is declared to return the general `DateValue` union\n * (so `Calendar`/`DatePicker` never leak a specific subtype), but it's\n * implemented as `fromDate`, which always produces a `ZonedDateTime`. Casting\n * back to that concrete type here keeps every call below (`.set`, `.add`,\n * `startOfWeek`, …) on `ZonedDateTime`'s own overloads instead of the union's\n * β€” a `CalendarDate.set` only accepts `DateFields`, no `hour`/`minute`.\n */\nconst toZoned = (date: Date, timeZone: string): ZonedDateTime =>\n dateToCalendarValue(date, timeZone) as ZonedDateTime\n\nconst midnightOf = (value: ZonedDateTime) =>\n value.set({ hour: 0, minute: 0, second: 0, millisecond: 0 })\n\n/**\n * The visible range for a view anchored at `date`. Month's range is the\n * padded 6-week grid (adjacent-month days are visible and need their events\n * queried too), not the strict calendar-month boundary.\n */\nexport function getVisibleRange(view: ScheduleView, date: Date, options: RangeOptions): DateRange {\n const { timeZone, locale, startOfWeek, visibleDays = 7 } = options\n const value = toZoned(date, timeZone)\n const weekStartDay = resolveWeekStartDay(startOfWeek)\n\n const range = match(view)\n .with(\"days\", () => {\n // \"relative\", OR any single-day window: the window starts at the\n // anchor itself, no calendar snap. A 1-day window has no meaningful\n // \"start of week\" to snap to β€” the old, since-removed `DayView` never\n // even accepted a `firstDayOfWeek` prop β€” so `visibleDays === 1`\n // reproduces its exact anchor-is-the-day behavior regardless of\n // `startOfWeek`, the same way \"relative\" does. Otherwise (a\n // day-of-week number, or undefined for the locale default): snap to\n // that week's start, generalizing today's old week-view logic to an\n // arbitrary `visibleDays` window size β€” then slide forward in whole\n // `visibleDays` tiles until the window actually contains the anchor.\n //\n // That slide is not a refinement, it is what makes the snap correct at\n // all once `visibleDays < 7`. A 5-day, Monday-started window anchored on\n // a Saturday snaps to Mon–Fri, a window whose own anchor day is not\n // rendered β€” which silently breaks drill-down (\"click Saturday in Month,\n // land on a Days view with no Saturday in it\"), leaves the Now button\n // showing a week that doesn't contain today, and strands\n // `isEventInVisibleRange`'s reveal in a predicate that can never become\n // true. It also made Prev/Next a dead button two clicks in seven: the\n // anchor stepped by 5 but re-snapped to the same Monday, so the window,\n // the title and the rendered days were all unchanged.\n //\n // `getDayOfWeek` is the anchor's own 0-based index *within* that week β€”\n // precisely `anchor - weekStart` in days, without doing the subtraction\n // by hand: `@internationalized/date` defines `startOfWeek` as\n // `date.subtract({ days: getDayOfWeek(date, locale, firstDayOfWeek) })`,\n // so the two are the same number by construction and cannot drift. It\n // reads a Julian day count rather than any elapsed-time quantity, so DST\n // never enters into it. The index is always `0..6`, so `visibleDays >= 7`\n // floors to tile 0 and this reduces exactly to the plain week snap it\n // replaces β€” every default-configuration call site is unchanged.\n //\n // `midnightOf` is applied last, after the `.add()`, mirroring the shape\n // this replaces. It is `.set({ hour: 0 })` with the default\n // `\"compatible\"` disambiguation, which maps a *non-existent* midnight\n // (Chile, Cuba, Iran, Lebanon, Jordan and Palestine all have or had\n // midnight DST transitions) to 01:00 β€” midnighting the week start and\n // then adding days would carry that 01:00 onto a target day where 00:00\n // exists perfectly well.\n const tileStart =\n startOfWeek === \"relative\" || visibleDays === 1\n ? value\n : calendarStartOfWeek(value, locale, weekStartDay).add({\n // `visibleDays <= 0` is not validated anywhere and currently\n // degrades to a zero-column grid; `floor(i / 0) * 0` is `NaN`,\n // which would turn that into an Invalid Date instead.\n days:\n visibleDays > 0\n ? Math.floor(getDayOfWeek(value, locale, weekStartDay) / visibleDays) *\n visibleDays\n : 0,\n })\n const start = midnightOf(tileStart)\n return { start, end: start.add({ days: visibleDays }) }\n })\n .with(\"month\", () => {\n const start = calendarStartOfWeek(midnightOf(startOfMonth(value)), locale, weekStartDay)\n const end = endOfWeek(midnightOf(endOfMonth(value)), locale, weekStartDay).add({ days: 1 })\n return { start, end }\n })\n .with(\"year\", () => {\n const start = midnightOf(startOfYear(value))\n const end = midnightOf(endOfYear(value)).add({ days: 1 })\n return { start, end }\n })\n .with(\"agenda\", () => {\n // The **strict** calendar month, deliberately not `\"month\"`'s padded\n // six-week grid. Month pads because the adjacent-month days are real\n // cells on screen whose events have to be queried; the agenda has no\n // cells β€” it lists what the title claims, so padding would open a\n // September list with three late-August rows and double-list every\n // seam day across two consecutive months.\n //\n // The sharper reason it cannot reuse Month's range: `Root`'s reveal\n // asks `isEventInVisibleRange(event, currentView, ...)`, which is a\n // composition over this function. Under the padded range that answers\n // \"yes, already visible\" for an August 31st event the agenda does not\n // list, so `Root` declines to move the anchor and the selected event is\n // nowhere on screen. Strict bounds keep \"is it in range\" and \"is it\n // rendered\" the same predicate over the same range.\n const start = midnightOf(startOfMonth(value))\n const end = midnightOf(endOfMonth(value)).add({ days: 1 })\n return { start, end }\n })\n .exhaustive()\n\n return {\n start: calendarValueToDate(range.start, timeZone),\n end: calendarValueToDate(range.end, timeZone),\n }\n}\n\n/** One step forward/back for the given view β€” \"Today\" needs no special case:\n * it's just `onDateChange?.(now)`, since each view's own `getVisibleRange`\n * snaps any anchor to that view's natural boundary. */\nexport function paginateDate(\n view: ScheduleView,\n date: Date,\n direction: -1 | 1,\n options: PaginateOptions,\n): Date {\n const value = toZoned(date, options.timeZone)\n const duration = match(view)\n .with(\"days\", () => ({ days: options.visibleDays ?? 7 }))\n // One pattern, not two branches: \"the agenda is month-windowed\" is stated\n // once, so the two can never drift into stepping differently.\n // `@internationalized/date`'s `add({ months: 1 })` clamps Jan 31 to Feb\n // 28/29, so Prev/Next never skips a month.\n .with(\"month\", \"agenda\", () => ({ months: 1 }))\n .with(\"year\", () => ({ years: 1 }))\n .exhaustive()\n const next = direction === 1 ? value.add(duration) : value.subtract(duration)\n return calendarValueToDate(next, options.timeZone)\n}\n\n/**\n * The instant at `hour:00` on `day`'s calendar date, **in `timeZone`** β€” the\n * boundary of one day column's painted band (`schedule-segments.ts`).\n *\n * `hour === 24` is the next day's midnight, reached with `.add({ days: 1 })`\n * rather than `+24h`, so it stays correct on a 23- or 25-hour DST day. Every\n * other hour is a wall-clock `.set()`, for the same reason.\n */\nexport function dayBoundary(day: Date, hour: number, timeZone: string): Date {\n const midnight = midnightOf(toZoned(day, timeZone))\n const target = hour >= 24 ? midnight.add({ days: 1 }) : midnight.set({ hour })\n return calendarValueToDate(target, timeZone)\n}\n\n/**\n * The instants at `stepMinutes` intervals across `[fromMinutes, toMinutes]` of\n * `day`'s calendar date, in `timeZone` β€” both ends inclusive, so N slots come\n * back as N+1 boundaries and a caller can walk them pairwise.\n *\n * Exists so the disabled overlay can probe at `slotDuration` granularity\n * without paying a zone conversion per probe: `toZoned` runs once for the whole\n * day and every step after it is a wall-clock `.add({ minutes })`, which is\n * DST-correct for the same reason `dayBoundary` prefers `.add({ days: 1 })`\n * over `+24h`. A 13-hour band at `slotDuration={15}` is 53 boundaries from one\n * conversion, where `dayBoundary`-per-probe would have been 104.\n */\nexport function dayBoundaries(\n day: Date,\n fromMinutes: number,\n toMinutes: number,\n stepMinutes: number,\n timeZone: string,\n): Date[] {\n const midnight = midnightOf(toZoned(day, timeZone))\n const boundaries: Date[] = []\n // `<=` and the final clamp together guarantee the last boundary is exactly\n // `toMinutes`, even when the span isn't a whole number of steps β€” a band\n // ending at 13:00 with a 50-minute slot must still close at 13:00, not 13:20.\n for (let minute = fromMinutes; minute <= toMinutes; minute += stepMinutes) {\n boundaries.push(\n calendarValueToDate(midnight.add({ minutes: Math.min(minute, toMinutes) }), timeZone),\n )\n if (minute + stepMinutes > toMinutes && minute !== toMinutes) {\n boundaries.push(calendarValueToDate(midnight.add({ minutes: toMinutes }), timeZone))\n break\n }\n }\n return boundaries\n}\n\n/**\n * `date` shifted by `days` calendar days, preserving its wall-clock time.\n *\n * Built on `paginateDate` rather than `+ days * 86_400_000`: that arithmetic\n * silently drifts an hour across a DST transition, which is exactly the class\n * of bug the module header's \"never hand-rolled ms arithmetic\" rule exists to\n * prevent. `paginateDate`'s `visibleDays` option *is* its step size for the\n * `\"days\"` view, so an arbitrary delta is one call β€” no new\n * `@internationalized/date` import, and the DST handling is the same code path\n * pagination already trusts.\n */\nexport function addCalendarDays(date: Date, days: number, timeZone: string): Date {\n if (days === 0) return date\n return paginateDate(\"days\", date, days > 0 ? 1 : -1, {\n timeZone,\n visibleDays: Math.abs(days),\n })\n}\n\n/** Whether `event` overlaps the calendar day containing `day`, in `timeZone`. */\nexport function eventOccursOnDay(\n event: { start: Date; end: Date },\n day: Date,\n timeZone: string,\n): boolean {\n const dayStart = midnightOf(toZoned(day, timeZone))\n const dayRange = {\n start: calendarValueToDate(dayStart, timeZone),\n end: calendarValueToDate(dayStart.add({ days: 1 }), timeZone),\n }\n return rangesOverlap(event, dayRange)\n}\n\n/** Exclusive-end overlap test β€” an event ending when another starts doesn't overlap it. */\nexport function rangesOverlap(a: DateRange, b: DateRange): boolean {\n return a.start.getTime() < b.end.getTime() && b.start.getTime() < a.end.getTime()\n}\n\n/**\n * Whether any part of `event`'s range is inside the window `view` is currently\n * showing, anchored at `date` β€” the predicate behind selection's reveal rule\n * (`schedule.tsx`), which moves the anchor only when the selected event is\n * *not* already on screen.\n *\n * Tests the **whole** `[start, end)` range rather than just `start`, which is\n * the entire difficulty: a multi-day event beginning before the window and\n * ending after it is visible on every day of that window, and anchoring to its\n * `start` would page *away* from the thing being revealed.\n *\n * Deliberately a one-line composition of `getVisibleRange` + `rangesOverlap`\n * rather than its own arithmetic β€” the month branch's padded six-week grid and\n * the days branch's `\"relative\"`/`visibleDays` snapping are subtle enough that\n * a second implementation of \"what is on screen\" would drift from the first.\n * The options bag is derived structurally from `getVisibleRange` itself for the\n * same reason, so the two can never disagree about their inputs.\n *\n * Inherits `rangesOverlap`'s strict, exclusive-end comparison, which gives the\n * boundary cases for free: an event ending exactly at the window's start is not\n * visible, one starting exactly at its end likewise, and an all-day event's\n * `end` is already the exclusive midnight-after boundary (see\n * `ScheduleEvent.allDay`).\n *\n * A zero-duration event is in range whenever it falls strictly inside the\n * window β€” `rangesOverlap` compares *across* the two ranges, so a zero-length\n * one still satisfies both halves. Note this deliberately does not agree with\n * `schedule-segments.ts`, which applies `start < end` to the *clipped* range\n * and so paints no chip for it at all. That is the correct disagreement: \"is it\n * inside the dates on screen\" and \"does it draw anything\" are different\n * questions. The reveal relies on exactly that β€” it declines to move the anchor\n * (the event is already in range), then finds no chip to scroll to and stops.\n */\nexport function isEventInVisibleRange(\n event: DateRange,\n view: ScheduleView,\n date: Date,\n options: Parameters<typeof getVisibleRange>[2],\n): boolean {\n return rangesOverlap(event, getVisibleRange(view, date, options))\n}\n\n/**\n * Overlap-prevention (RFC Β§12a) β€” a deliberately separate mechanism from\n * `slotDisabled`, never folded into it (Β§12's own \"occupied and disabled\n * are two different, non-conflated concepts\" principle applies here too).\n *\n * Whether `range` overlaps any of `candidates`, excluding `excludeId` β€” so\n * dragging/resizing an event never rejects against its own pre-gesture self.\n * Assumes `id`s are unique across `data` and `staticEvents` combined; a\n * shared `id` across the two arrays would incorrectly exclude the wrong one\n * when checking against both kinds.\n */\nexport function rangeOverlapsAny(\n range: DateRange,\n candidates: { id: string; start: Date; end: Date }[],\n excludeId?: string,\n): boolean {\n return candidates.some((c) => c.id !== excludeId && rangesOverlap(range, c))\n}\n\n/** Axis-B candidate-pool selection for overlap-prevention β€” pure, so it's\n * independently testable from the gesture wiring that calls it. */\nexport function resolveOverlapCandidates(\n data: ScheduleEvent[],\n staticEvents: ScheduleStaticEvent[],\n against: ScheduleOverlapTarget | \"both\",\n): ScheduleAnyEvent[] {\n if (against === \"event\") return data\n if (against === \"static\") return staticEvents\n return [...data, ...staticEvents]\n}\n\n/** Which of the two independent commit-time gates rejected a range β€”\n * `\"disabled\"` and `\"overlap\"` are deliberately never conflated into one\n * \"unavailable\" reason (RFC Β§12's own non-conflation principle), so a\n * rejection's visual/attribute treatment can tell them apart later even\n * though both currently animate identically. */\nexport type RangeCommitResult = { ok: true } | { ok: false; reason: \"disabled\" | \"overlap\" }\n\n/**\n * The one place `slotDisabled` and overlap-prevention compose β€” both are\n * independent gates, checked identically by drag (pointer + keyboard),\n * resize, and create. Exported for the other schedule-internal modules that\n * call it, but deliberately not re-exported from the public barrel\n * (`index.ts`) β€” internal wiring only, callers build `overlapCandidates`\n * themselves via `resolveOverlapCandidates`.\n */\nexport function checkRangeCommit(\n range: DateRange,\n options: {\n slotDisabled?: ScheduleSlotPredicate\n /** The schedule's own resolved zone, handed to `slotDisabled` as its second\n * argument so a predicate can never disagree with the grid restricting by\n * it (`lib/date-predicates.ts`'s convention, range-shaped).\n *\n * Required rather than optional-with-a-default on purpose: this function is\n * internal wiring, never re-exported from `index.ts`, and every call site\n * already holds the zone. A default here would silently reintroduce\n * host-zone drift at whichever call site forgot it next. */\n timeZone: string\n preventOverlap?: boolean\n overlapCandidates?: { id: string; start: Date; end: Date }[]\n excludeId?: string\n },\n): RangeCommitResult {\n const { slotDisabled, timeZone, preventOverlap, overlapCandidates = [], excludeId } = options\n if (slotDisabled?.(range, timeZone)) return { ok: false, reason: \"disabled\" }\n if (preventOverlap && rangeOverlapsAny(range, overlapCandidates, excludeId)) {\n return { ok: false, reason: \"overlap\" }\n }\n return { ok: true }\n}\n\n/** A stable, timeZone-aware per-day key (`YYYY-MM-DD`) β€” used for React keys\n * and `data-testid`s across `MonthView`/`YearView`'s day grids.\n * `Date#toISOString()` would read the instant's *UTC* calendar day, not the\n * schedule's configured one, so it can't stand in for this near a midnight\n * boundary outside UTC. */\nexport function dayKey(date: Date, timeZone: string): string {\n return new Intl.DateTimeFormat(\"en-CA\", {\n timeZone,\n year: \"numeric\",\n month: \"2-digit\",\n day: \"2-digit\",\n }).format(date)\n}\n\n/**\n * Each calendar day's local-midnight instant from `range.start` up to (not\n * including) `range.end`, stepping via `paginateDate`'s calendar-aware\n * `.add({ days: 1 })` rather than a fixed 86,400,000ms increment β€” a\n * DST-transition day still lands on the correct next midnight.\n */\nexport function enumerateDays(range: DateRange, timeZone: string): Date[] {\n const days: Date[] = []\n let cursor = range.start\n while (cursor.getTime() < range.end.getTime()) {\n days.push(cursor)\n cursor = paginateDate(\"days\", cursor, 1, { timeZone, visibleDays: 1 })\n }\n return days\n}\n\n/**\n * Each month's local-midnight-of-the-1st instant from `range.start` up to\n * (not including) `range.end` β€” `YearView`'s 12 mini-months, the same\n * calendar-aware stepping `enumerateDays` uses for days.\n */\nexport function enumerateMonths(range: DateRange, timeZone: string): Date[] {\n const months: Date[] = []\n let cursor = range.start\n while (cursor.getTime() < range.end.getTime()) {\n months.push(cursor)\n cursor = paginateDate(\"month\", cursor, 1, { timeZone })\n }\n return months\n}\n\n/** Whether `a` and `b` fall in the same calendar month (and year), in `timeZone` β€”\n * `MonthView`'s adjacent-month dimming and `YearView`'s blank-cell padding both\n * key off this rather than comparing native `Date#getMonth()`, which reads the\n * *host's* local time zone instead of the schedule's configured one. */\nexport function isSameMonth(a: Date, b: Date, timeZone: string): boolean {\n const za = toZoned(a, timeZone)\n const zb = toZoned(b, timeZone)\n return za.year === zb.year && za.month === zb.month\n}\n\n/** Whether `day` falls on the same calendar day as `now`, in `timeZone` β€”\n * Month/Year's own \"today\" cell highlight. Compares via `dayKey` (already\n * used for these views' own React keys) rather than `toZoned`'s\n * year/month/day fields like `isSameMonth` above, since a plain string\n * comparison of the two is exactly as timeZone-correct and cheaper than\n * building two full `ZonedDateTime`s just to compare three numbers.\n * `now` is threaded in, not read internally via `new Date()` β€” same\n * \"resolve once per render, stay pure/testable\" reasoning as\n * `ScheduleTimedGrid`'s own `todayRef`. */\nexport function isToday(day: Date, now: Date, timeZone: string): boolean {\n return dayKey(day, timeZone) === dayKey(now, timeZone)\n}\n\n/** An event's start–end time range, e.g. \"09:00 AM – 10:30 AM\" β€” shared by\n * the event chip's subtext and the built-in event-details popover, so\n * there's one definition of how a range reads, not two.\n *\n * `hour: \"2-digit\"`, not `\"numeric\"` β€” a real SSR hydration mismatch,\n * verified in a real browser: `\"numeric\"` leaves zero-padding up to each\n * runtime's own bundled ICU data, which Node and a browser don't\n * necessarily agree on for every locale (observed: `fr-FR` renders\n * \"9:00\" server-side, \"09:00\" client-side). `\"2-digit\"` is the one\n * spec-guaranteed-deterministic option, unlike `formatScheduleTitle`'s\n * separator-glyph mismatch below, which normalization can paper over β€”\n * padding is real digit content, so it has to be pinned instead. */\nexport function timeRangeLabel(\n start: Date,\n end: Date,\n locale?: string,\n /**\n * Optional and trailing, so every existing caller is byte-identical.\n *\n * The timed grid's callers deliberately pass nothing: its hour-axis gutter\n * labels are host-local by construction (see `clockTimeLabel` below), so a\n * chip whose text resolved a different zone would contradict the axis it\n * sits on. The agenda has no such axis β€” its visible time comes from\n * `timeLabel`, which does take a zone β€” so a row's accessible name has to\n * pass one here or it would announce a different clock reading than the one\n * printed next to it.\n */\n timeZone?: string,\n): string {\n const formatter = new Intl.DateTimeFormat(locale, {\n hour: \"2-digit\",\n minute: \"2-digit\",\n timeZone,\n })\n return `${formatter.format(start)} – ${formatter.format(end)}`\n}\n\n/**\n * A single clock time, e.g. \"09:30\" β€” the now-cursor's own label\n * (`now-cursor-line.tsx`). Deliberately **no `timeZone` option**, unlike\n * every other formatter in this file: `schedule-timed-grid.tsx`'s hour-axis\n * gutter labels are host-local by construction (`hourFormatter`, fed a\n * `new Date(2000, 0, 1, hour)` with no timezone conversion involved), and so\n * is the now-line's own pixel position (`nowIndicatorTop`, `schedule-\n * geometry.ts`, via `minutesFromMidnight`'s `.getHours()`/`.getMinutes()`).\n * Threading `timeZone` through here too would let this label disagree with\n * both of those the moment a consumer sets a `timeZone` other than the\n * host's own β€” the line would still point at the host-local hour, but the\n * text next to it would claim a different one. `locale` alone is safe to\n * thread: it only affects digit shape/ordering (and a leading zero via\n * `\"2-digit\"`), never which instant gets read as \"now.\"\n */\nexport function clockTimeLabel(date: Date, locale?: string): string {\n return new Intl.DateTimeFormat(locale, { hour: \"2-digit\", minute: \"2-digit\" }).format(date)\n}\n\n/**\n * An all-day event's date (or date range), e.g. \"July 15, 2026\" or\n * \"July 15 – 17, 2026\" β€” the `allDay` counterpart to `timeRangeLabel` above,\n * shown instead of a time-of-day range since an all-day event's `start`/`end`\n * are day *boundaries*, not meaningful clock times (RFC's all-day addendum:\n * `start` = midnight of the first day, `end` = midnight of the day *after*\n * the last day, exclusive).\n *\n * `end.getTime() - 1` β€” one millisecond before the exclusive boundary β€” reads\n * back the last real day without any calendar-unit arithmetic: it's always\n * inside that day by construction, so `Intl.DateTimeFormat`'s own `timeZone`\n * resolves the correct calendar date directly. This is display formatting on\n * a fixed instant, not the calendar math (pagination, visible-range) the RFC\n * requires going through `@internationalized/date` for β€” there's no day\n * arithmetic here to get wrong across a DST boundary.\n *\n * `formatRange` + `.normalize(\"NFKC\")`, not a hand-rolled `${a} – ${b}` join\n * β€” same real SSR-hydration fix `formatScheduleTitle`'s week title already\n * needs and documents above (a genuine separator-glyph mismatch between\n * Node's and a browser's bundled ICU data).\n */\nexport function allDayRangeLabel(\n start: Date,\n end: Date,\n timeZone: string,\n locale?: string,\n): string {\n const lastDay = new Date(end.getTime() - 1)\n const formatter = new Intl.DateTimeFormat(locale, { dateStyle: \"medium\", timeZone })\n if (dayKey(start, timeZone) === dayKey(lastDay, timeZone)) return formatter.format(start)\n return formatter.formatRange(start, lastDay).normalize(\"NFKC\")\n}\n\n/**\n * The toolbar title for a view anchored at `date` β€” RFC Β§14. Native\n * `Intl.DateTimeFormat` throughout, exactly like this file's own\n * `timeRangeLabel`: this is display formatting, not calendar arithmetic, so\n * it doesn't need the `@internationalized/date` boundary the way pagination\n * math does.\n *\n * Week uses `formatRange` for a locale-correct condensed span (\"Aug 25 – 31,\n * 2026\" vs. \"Aug 25 – Sep 1, 2026\" across a month boundary) β€” CLDR's actual\n * per-locale range phrasing, which a hand-rolled `${start} – ${end}` join\n * can't reproduce for every locale (some don't just dash-join two dates).\n *\n * `.normalize(\"NFKC\")` on the result is load-bearing, not defensive\n * copy-paste: verified in a real browser that `formatRange` produces a\n * genuine SSR hydration mismatch otherwise β€” Node's bundled ICU and a\n * browser's don't necessarily agree on the exact separator glyph for the\n * identical locale/options (observed: a plain space + en dash vs. a *thin*\n * space + en dash), so the server- and client-rendered text differ byte-\n * for-byte while looking identical. NFKC's compatibility decomposition maps\n * typographic space variants (thin space, figure space, …) back to a plain\n * space, which converges exactly that divergence; NFC does not (canonical\n * equivalence doesn't cover compatibility variants like space width).\n */\nexport function formatScheduleTitle(\n view: ScheduleView,\n date: Date,\n options: {\n timeZone: string\n locale?: string\n /** Same low-level-name-kept rationale as `RangeOptions.startOfWeek`\n * above β€” this is what actually gets forwarded into `getVisibleRange`'s\n * own field of the same name below, not the public `align` prop name. */\n startOfWeek?: ScheduleAlign\n visibleDays?: number\n },\n): string {\n const { timeZone, locale, startOfWeek, visibleDays } = options\n return (\n match(view)\n .with(\"days\", () => {\n const days = visibleDays ?? 7\n if (days === 1) {\n return new Intl.DateTimeFormat(locale, { dateStyle: \"long\", timeZone }).format(date)\n }\n const range = getVisibleRange(\"days\", date, {\n timeZone,\n locale: locale ?? \"en-US\",\n startOfWeek,\n visibleDays: days,\n })\n const lastDay = paginateDate(\"days\", range.end, -1, { timeZone, visibleDays: 1 })\n return new Intl.DateTimeFormat(locale, { dateStyle: \"medium\", timeZone })\n .formatRange(range.start, lastDay)\n .normalize(\"NFKC\")\n })\n // Same merge, same reason, as `paginateDate` above: the agenda's title is\n // Month's by construction rather than by a copied format object.\n .with(\"month\", \"agenda\", () =>\n new Intl.DateTimeFormat(locale, { month: \"long\", year: \"numeric\", timeZone }).format(date),\n )\n .with(\"year\", () =>\n new Intl.DateTimeFormat(locale, { year: \"numeric\", timeZone }).format(date),\n )\n .exhaustive()\n )\n}\n\n/** A single clock-reading, e.g. \"09:00\" (or \"09:00 AM\" β€” a locale's own\n * 12h/24h convention, same as `timeRangeLabel`, is never overridden here)\n * β€” `Schedule.NextUp`'s per-slot time label. Reuses `timeRangeLabel`'s own\n * `hour: \"2-digit\"` choice (not \"numeric\") for the same documented\n * Node/browser ICU zero-padding hydration-mismatch reason above. Unlike\n * `timeRangeLabel`, this *does* take `timeZone`: `Schedule.NextUp` exposes\n * its own `timeZone` prop the same way every other view does, and a bare\n * `Intl.DateTimeFormat` call with no `timeZone` silently falls back to the\n * host runtime's local zone instead β€” invisible in a browser whose local\n * zone happens to match, but wrong the moment it doesn't. */\nexport function timeLabel(date: Date, timeZone: string, locale?: string): string {\n return new Intl.DateTimeFormat(locale, { hour: \"2-digit\", minute: \"2-digit\", timeZone }).format(\n date,\n )\n}\n\n/**\n * Compact \"1h 30m\" / \"45m\" duration β€” `Schedule.NextUp`'s per-event badge,\n * shown for every event so same-start-time events (stacked under one shared\n * time label) can still be told apart by how long each one runs. Composed\n * from `Intl.NumberFormat({ style: \"unit\" })`, the same pattern\n * `time-input/hour-cycle.ts`'s `timeUnitLabels` already uses β€” not\n * `Intl.DurationFormat`: there's no existing usage of it anywhere in the\n * kit, and this file already carries two documented SSR-hydration fixes\n * (`.normalize(\"NFKC\")` above, `\"2-digit\"` over `\"numeric\"`) from trusting\n * newer/less-uniform ICU behavior across runtimes β€” composing from the\n * already-proven `NumberFormat` unit style avoids repeating that exact risk\n * for a still-green API.\n */\nexport function durationLabel(start: Date, end: Date, locale?: string): string {\n const totalMinutes = Math.max(0, Math.round((end.getTime() - start.getTime()) / 60_000))\n const hours = Math.floor(totalMinutes / 60)\n const minutes = totalMinutes % 60\n const parts: string[] = []\n if (hours > 0) {\n parts.push(\n new Intl.NumberFormat(locale, { style: \"unit\", unit: \"hour\", unitDisplay: \"narrow\" }).format(\n hours,\n ),\n )\n }\n if (minutes > 0 || hours === 0) {\n parts.push(\n new Intl.NumberFormat(locale, {\n style: \"unit\",\n unit: \"minute\",\n unitDisplay: \"narrow\",\n }).format(minutes),\n )\n }\n return parts.join(\" \")\n}\n\n/**\n * `Schedule.NextUp`'s day-group label β€” \"Today\"/\"Tomorrow\" via\n * `Intl.RelativeTimeFormat`, the same class of Intl-derivable string as this\n * file's own weekday/month names (`ScheduleTranslations`' doc comment:\n * \"Weekday/month names… are Intl-derivable… and deliberately have no key\"),\n * so this needs no translation key either β€” it falls back to a numeric\n * phrase for any locale/unit combination without a dedicated word. Anything\n * further out than tomorrow gets a short weekday+day+month format (e.g.\n * \"Fri, 28 Aug\"; token order is CLDR's own per locale β€” never hand-reorder).\n * Compares `dayKey` strings directly rather than computing a numeric\n * day-offset, since the branch itself already tells us which literal offset\n * (`0`/`1`) applies.\n */\nexport function resolveNextUpDayLabel(\n date: Date,\n now: Date,\n options: { timeZone: string; locale?: string },\n): string {\n const { timeZone, locale } = options\n const dateKey = dayKey(date, timeZone)\n if (dateKey === dayKey(now, timeZone)) {\n return new Intl.RelativeTimeFormat(locale, { numeric: \"auto\" }).format(0, \"day\")\n }\n const tomorrow = paginateDate(\"days\", now, 1, { timeZone, visibleDays: 1 })\n if (dateKey === dayKey(tomorrow, timeZone)) {\n return new Intl.RelativeTimeFormat(locale, { numeric: \"auto\" }).format(1, \"day\")\n }\n return new Intl.DateTimeFormat(locale, {\n weekday: \"short\",\n day: \"numeric\",\n month: \"short\",\n timeZone,\n }).format(date)\n}\n","\"use client\"\n\nimport { getLocalTimeZone } from \"@internationalized/date\"\nimport type { ReactNode } from \"react\"\nimport { Button } from \"../button/button\"\nimport { allDayRangeLabel, timeRangeLabel } from \"./schedule-dates\"\nimport type { ScheduleAnyEvent } from \"./schedule-types\"\n\nexport type ScheduleEventDetailsContentProps<P = unknown> = {\n event: ScheduleAnyEvent<P>\n locale?: string\n /** Only actually read for an `allDay` event, to resolve `allDayRangeLabel`\n * β€” every caller already has a resolved `timeZone` in scope regardless. */\n timeZone?: string\n /** Full override β€” replaces the default content below entirely when set. */\n renderEventDetails?: (event: ScheduleAnyEvent<P>) => ReactNode\n /**\n * Removes this event. Renders a labelled Remove button in the popover when\n * passed, and nothing at all when omitted β€” so the callers that have no\n * removal gesture (`MonthView`'s day-details list, the all-day row, the\n * overflow popover) are unaffected by simply not passing it.\n *\n * This is the *accessible* removal path, not a duplicate of the chip's own\n * inline `(x)`. That button is 16px wide, under WCAG 2.2 SC 2.5.8's 24x24\n * minimum, and on a floored short chip it cannot grow to meet it without\n * overhanging the chip and eating the resize grips' hit strips. A full-size\n * control here satisfies the criterion for the *function* through SC 2.5.8's\n * \"bypass\" exception β€” the same function reachable from a control that does\n * meet the minimum β€” for every chip, however short.\n */\n onRemove?: () => void\n /** Label for the Remove button β€” `ScheduleTranslations.removeEvent`. */\n removeLabel?: string\n}\n\n/**\n * The single source of truth for an event's default popover content β€”\n * reused verbatim by both the standalone event-details popover\n * (`ScheduleEventChip`) and the day-details popover's listβ†’single-event\n * swap (`MonthView`), so there's one definition of \"what an event's details\n * look like,\" not two.\n */\nexport function ScheduleEventDetailsContent<P = unknown>({\n event,\n locale,\n timeZone,\n renderEventDetails,\n onRemove,\n removeLabel,\n}: ScheduleEventDetailsContentProps<P>): ReactNode {\n if (renderEventDetails) return renderEventDetails(event)\n\n return (\n <div\n className=\"flex flex-col gap-1\"\n data-schedule-part=\"event-details\"\n data-color={event.color ?? \"pink\"}\n >\n <div className=\"flex items-start gap-2\">\n {event.icon != null ? (\n <span className=\"mt-0.5 shrink-0 text-(--c-text) [&_svg]:size-4\">{event.icon}</span>\n ) : null}\n <p className=\"min-w-0 flex-1 font-medium text-sm\">{event.title}</p>\n </div>\n <p className=\"text-gray-light-500 text-xs dark:text-gray-dark-400\">\n {event.allDay\n ? allDayRangeLabel(event.start, event.end, timeZone ?? getLocalTimeZone(), locale)\n : timeRangeLabel(event.start, event.end, locale)}\n </p>\n {event.description ? (\n // `div`, not `p` β€” `description` is `ReactNode`, so it can carry\n // block-level content (a list, a nested `div`); a `<p>` can only\n // hold phrasing content, and nesting a block element inside one is\n // invalid HTML that browsers silently \"fix\" by auto-closing the\n // `<p>` early during parsing β€” a real, verified SSR hydration\n // mismatch (server-rendered HTML re-parsed differently than React's\n // own tree), not just a lint nicety.\n <div className=\"text-gray-light-700 text-sm dark:text-gray-dark-300\">\n {event.description}\n </div>\n ) : null}\n {onRemove ? (\n // `mt-1` rather than relying on the wrapper's `gap-1`: this is an\n // action, not another line of detail, so it wants a little more\n // separation from the text above it than the text lines want from\n // each other.\n <Button\n type=\"button\"\n size=\"sm\"\n variant=\"subtle\"\n color=\"red\"\n className=\"mt-1 self-start\"\n data-schedule-part=\"details-remove\"\n onClick={onRemove}\n >\n {removeLabel}\n </Button>\n ) : null}\n </div>\n )\n}\n","import { useState } from \"react\"\nimport { useUncontrolled } from \"../../lib/use-uncontrolled\"\nimport type { ScheduleAnyEvent } from \"./schedule-types\"\n\nexport type UseScheduleSelectionOptions<P> = {\n selected?: string | readonly string[] | null\n defaultSelected?: string | readonly string[] | null\n onSelect?: (event: ScheduleAnyEvent<P> | null) => void\n /** Default `true`. `false` disables selection entirely. */\n withSelection?: boolean\n}\n\nexport type UseScheduleSelectionResult<P> = {\n /** The selected ids, normalised to a list β€” `[]` for none, and always `[]`\n * when selection is off. `selected[0]` is the anchor: the one chip whose\n * details popover opens, and the one a selection change reveals. */\n selected: readonly string[]\n /** Threaded down to every chip, bar and pill. `undefined` when selection is\n * off, so nothing below has to re-check the flag. */\n onEventSelect: ((event: ScheduleAnyEvent<P> | null) => void) | undefined\n}\n\n/**\n * The controlled/uncontrolled selection triple, resolved once.\n *\n * Extracted because `Schedule` (the root), `DaysView` and `MonthView` each need\n * the identical block β€” the same arrangement `AnchorDateProps` already has,\n * where every view runs its own `useUncontrolled` and `Root` simply passes the\n * resolved pair down (making the view's own copy inert, since `value` is then\n * always defined). Keeping it in one place is what stops the three drifting.\n *\n * The interesting part is the id/event mismatch: state has to be the `id` (it\n * is what a consumer can hold across renders and what every chip compares\n * against), but `onSelect` has to report the whole event (the consumer already\n * has the id β€” what they lack is the object). `useUncontrolled`'s second\n * generic is a payload tuple forwarded verbatim to `onChange` in *both* its\n * controlled and uncontrolled branches, which bridges the two with no\n * `data.find()` anywhere on the select path: every call site already holds the\n * event it is selecting.\n *\n * `selected` may name several ids, for one thing drawn as several chips (an\n * offer split around a booking). State keeps whatever shape was passed and is\n * normalised once here, so every renderer below compares against one list.\n * Uncontrolled selection still stores the single pressed id: only the consumer\n * knows which chips belong together.\n */\nexport function useScheduleSelection<P>({\n selected,\n defaultSelected,\n onSelect,\n withSelection = true,\n}: UseScheduleSelectionOptions<P>): UseScheduleSelectionResult<P> {\n const [value, setSelected] = useUncontrolled<\n string | readonly string[] | null,\n [ScheduleAnyEvent<P> | null]\n >({\n value: selected,\n defaultValue: defaultSelected,\n finalValue: null,\n onChange: (_id, event) => onSelect?.(event),\n })\n\n if (!withSelection) return { selected: NONE, onEventSelect: undefined }\n return {\n selected: toIds(value),\n onEventSelect: (event) => setSelected(event?.id ?? null, event),\n }\n}\n\nconst NONE: readonly string[] = []\n\nfunction toIds(value: string | readonly string[] | null): readonly string[] {\n if (value == null) return NONE\n return typeof value === \"string\" ? [value] : value\n}\n\n/**\n * One chip's share of the selection, spread straight onto it. `selected`\n * paints it; `anchor` β€” selected *and* first in the list β€” is what opens its\n * details popover, so a multi-id selection still opens exactly one.\n *\n * `ownsAnchor` is for a surface that draws one event as several pieces (see\n * `usePieceAnchor`): every piece shares the id, so only the one piece that\n * owns the anchor may open it.\n */\nexport function chipSelection(\n selected: readonly string[],\n id: string,\n ownsAnchor = true,\n): { selected: boolean; anchor: boolean } {\n return { selected: selected.includes(id), anchor: ownsAnchor && selected[0] === id }\n}\n\n/**\n * Which piece of the anchor event owns its details popover, for a surface\n * that draws one event as several pieces sharing its id β€” a timed event per\n * day column, a Month event per day cell. Without this every piece matched the\n * selection and opened a popover of its own: three for a three-day event.\n *\n * `keys` names the pieces the anchor event has on screen, in reading order.\n * The piece the user pressed wins while it is still rendered; otherwise β€” a\n * selection from outside, or the pressed piece paged away β€” the first one.\n * `press` records the pressed piece; call it from the piece's own select\n * handler, with the same `null` that clears the selection.\n */\nexport function usePieceAnchor(\n anchorId: string | null,\n keys: readonly string[],\n): { key: string | null; press: (key: string, event: { id: string } | null) => void } {\n const [pressed, setPressed] = useState<{ id: string; key: string } | null>(null)\n const key =\n pressed != null && pressed.id === anchorId && keys.includes(pressed.key)\n ? pressed.key\n : (keys[0] ?? null)\n return {\n key,\n press: (pieceKey, event) => setPressed(event && { id: event.id, key: pieceKey }),\n }\n}\n","\"use client\"\n\nimport { Fragment, type ReactNode, useId } from \"react\"\nimport { cn } from \"../../lib/cn\"\nimport { focusStyles } from \"../../lib/focus-styles\"\nimport { props as dataProps } from \"../../lib/props\"\nimport { Divider } from \"../divider\"\nimport { Popover } from \"../popover/popover\"\nimport { Text } from \"../text/text\"\nimport {\n allDayRangeLabel,\n durationLabel,\n resolveNextUpDayLabel,\n timeLabel,\n timeRangeLabel,\n} from \"./schedule-dates\"\nimport { ScheduleEventDetailsContent } from \"./schedule-event-details\"\nimport type { NextUpDayGroup, NextUpTimeSlot } from \"./schedule-next-up-grouping\"\nimport type {\n ScheduleAgendaListClassNames,\n ScheduleAnyEvent,\n ScheduleTranslations,\n} from \"./schedule-types\"\nimport { chipSelection } from \"./use-schedule-selection\"\n\n/**\n * The agenda list itself β€” day groups, `HH:MM` slots, event rows β€” shared\n * verbatim by `AgendaView` (a calendar month) and `Schedule.NextUp`\n * (everything from now on). The two differ only in *which* events they\n * gather; once grouped, there is exactly one rendering, which is why this\n * takes `groups` already built and never decides what is in range itself.\n *\n * It renders no root element, deliberately. `Schedule.NextUp`'s public type\n * is `Omit<HTMLArkProps<\"section\">, \"children\">` β€” `asChild` included β€” so\n * that `<ark.section>` has to stay its own, and `AgendaView` supplies its own\n * `<ark.div>` plus a toolbar. A shared root here would double-wrap one of\n * them.\n */\n\n/** The only signal a custom row renderer can't trivially recompute from\n * `event` alone: whether this is the single soonest event in the whole list\n * (tie-broken to the first event of the first same-start stack).\n *\n * Only ever `true` under `Schedule.NextUp`. \"Soonest still to come\" is a\n * from-now idea; in a month window anchored on last March there is no such\n * event, so `AgendaView` passes no `nextEventId` and every row gets `false`. */\nexport type AgendaEventRenderState = { isNext: boolean }\n\nexport type AgendaEventRenderer<P> = (\n event: ScheduleAnyEvent<P>,\n state: AgendaEventRenderState,\n) => ReactNode\n\nexport type ScheduleAgendaListProps<P = unknown> = {\n /** Already filtered and grouped β€” see the module comment. */\n groups: NextUpDayGroup<P>[]\n /** Reference instant for the Today/Tomorrow day labels only. */\n now: Date\n locale?: string\n timeZone: string\n /** Already resolved by the caller; `allDay` and `empty` are both read. */\n translations: Required<ScheduleTranslations>\n /** Full override for the \"nothing here\" state. */\n empty?: ReactNode\n /** The row that gets `{ isNext: true }`. Omit for \"nothing is next\". */\n nextEventId?: string\n renderEvent?: AgendaEventRenderer<P>\n /**\n * Present β†’ rows become real `<button>`s. Absent β†’ plain elements, which is\n * `Schedule.NextUp`'s shipped behaviour and what `withSelection={false}`\n * falls back to.\n */\n onEventSelect?: (event: ScheduleAnyEvent<P> | null) => void\n selected?: readonly string[]\n withEventDetails?: boolean\n renderEventDetails?: (event: ScheduleAnyEvent<P>) => ReactNode\n detailsPopoverClassName?: string\n classNames?: ScheduleAgendaListClassNames\n}\n\nexport function ScheduleAgendaList<P = unknown>({\n groups,\n now,\n locale,\n timeZone,\n translations,\n empty,\n nextEventId,\n renderEvent,\n onEventSelect,\n selected,\n withEventDetails = true,\n renderEventDetails,\n detailsPopoverClassName,\n classNames,\n}: ScheduleAgendaListProps<P>) {\n // Scoped per instance rather than `next-up-day-${group.key}`, which the\n // dashboard example already renders twice on one page β€” two lists on the\n // same day produced two elements with the identical id, so half the\n // `aria-labelledby`s resolved to the wrong heading.\n const uid = useId()\n\n if (groups.length === 0) {\n return (\n <div data-schedule-part=\"agenda-empty\" className=\"py-6 text-center\">\n <Text c=\"muted\">{empty ?? translations.empty}</Text>\n </div>\n )\n }\n\n return (\n <ol data-schedule-part=\"agenda-list\" className=\"flex flex-col gap-4\">\n {groups.map((group) => {\n const labelId = `${uid}-${group.key}`\n return (\n <li\n key={group.key}\n data-schedule-part=\"agenda-day-group\"\n aria-labelledby={labelId}\n className={cn(\"flex flex-col gap-2\", classNames?.dayGroup)}\n >\n <Divider\n label={resolveNextUpDayLabel(group.date, now, { timeZone, locale })}\n id={labelId}\n labelPosition=\"start\"\n className={cn(\"uppercase tracking-wide\", classNames?.dayLabel)}\n />\n <ol className=\"grid grid-cols-[max-content_minmax(0,1fr)] items-start gap-x-3 gap-y-3\">\n {group.slots.map((slot) => (\n <AgendaTimeGroupRow\n key={`${group.key}-${slot.start.toISOString()}`}\n slot={slot}\n locale={locale}\n timeZone={timeZone}\n translations={translations}\n nextEventId={nextEventId}\n renderEvent={renderEvent}\n onEventSelect={onEventSelect}\n selected={selected}\n withEventDetails={withEventDetails}\n renderEventDetails={renderEventDetails}\n detailsPopoverClassName={detailsPopoverClassName}\n classNames={classNames}\n />\n ))}\n </ol>\n </li>\n )\n })}\n </ol>\n )\n}\n\ntype RowSharedProps<P> = Pick<\n ScheduleAgendaListProps<P>,\n | \"locale\"\n | \"timeZone\"\n | \"translations\"\n | \"nextEventId\"\n | \"renderEvent\"\n | \"onEventSelect\"\n | \"selected\"\n | \"withEventDetails\"\n | \"renderEventDetails\"\n | \"detailsPopoverClassName\"\n | \"classNames\"\n>\n\n/**\n * One `HH:MM` slot, sharing its 2 columns (time | content) with every other\n * slot in the day via `grid-cols-subgrid` (inherited from the day-level\n * `<ol>` above). A stacked (same-start) slot nests one more\n * `grid-cols-subgrid` level per event β€” its own `<ol>`, then one `<li>` per\n * event β€” so each event gets its own full row (time column + content column)\n * that lines up exactly with that event's own duration, without needing\n * `grid-template-rows: subgrid` or `display: contents`: a subgrid only\n * re-shares the parent's *column* tracks, so each nested `<li>` still lays\n * out its own row height independently, auto-stacking beneath its siblings.\n */\nfunction AgendaTimeGroupRow<P>({\n slot,\n timeZone,\n translations,\n classNames,\n ...shared\n}: RowSharedProps<P> & { slot: NextUpTimeSlot<P>; timeZone: string }) {\n const { locale } = shared\n // `every`, not `slot.events[0]`: an all-day event starts at local midnight\n // by construction (`ScheduleEventBase.allDay`), so the only thing it can\n // share a slot with is a timed event that also starts at 00:00 β€” and in\n // that mixed slot \"00:00\" is still the honest heading for the timed one.\n // The all-day member simply shows no duration.\n const allDaySlot = slot.events.every((event) => event.allDay)\n\n const eventRow = (event: ScheduleAnyEvent<P>, isFirst: boolean) => (\n <>\n <div className=\"col-start-1 flex flex-col h-full items-end justify-center gap-0.5 pt-0.5\">\n {isFirst ? (\n allDaySlot ? (\n // A `<span>`, not `<time>`: \"All day\" denotes no single instant,\n // and `<time dateTime=\"…T00:00:00Z\">All day</time>` would report\n // a precise midnight to assistive tech that the event doesn't\n // mean. Keeps the `time` class hook so both style alike.\n <span\n className={cn(\n \"text-xs text-gray-light-900 tabular-nums dark:text-gray-dark-25 text-end\",\n classNames?.time,\n )}\n >\n {translations.allDay}\n </span>\n ) : (\n <time\n dateTime={slot.start.toISOString()}\n className={cn(\n \"text-xs text-gray-light-900 tabular-nums dark:text-gray-dark-25 text-end\",\n classNames?.time,\n )}\n >\n {timeLabel(slot.start, timeZone, locale)}\n </time>\n )\n ) : null}\n {/* Per event, never per slot: a mixed slot's timed event still owes a\n duration even though its all-day neighbour doesn't. */}\n {event.allDay ? null : (\n <span\n className={cn(\n \"text-xs text-gray-light-500 tabular-nums dark:text-gray-dark-400 text-end\",\n classNames?.duration,\n )}\n >\n {durationLabel(event.start, event.end, locale)}\n </span>\n )}\n </div>\n <div className=\"col-start-2 min-w-0\">\n <AgendaEventRow\n event={event}\n timeZone={timeZone}\n translations={translations}\n classNames={classNames}\n {...shared}\n />\n </div>\n </>\n )\n\n return (\n <li\n data-schedule-part=\"agenda-time-group\"\n className={cn(\"col-span-2 grid grid-cols-subgrid items-start\", classNames?.timeGroup)}\n >\n {slot.events.length > 1 ? (\n <ol className=\"col-span-2 grid grid-cols-subgrid items-start gap-y-2\">\n {slot.events.map((event, i) => (\n <li key={event.id} className=\"col-span-2 grid grid-cols-subgrid items-start\">\n {eventRow(event, i === 0)}\n </li>\n ))}\n </ol>\n ) : (\n // Exactly one event β€” `groupUpcomingEvents` never produces an\n // empty slot, but `.map` (vs. a `[0]` index access) sidesteps\n // `noUncheckedIndexedAccess` without asserting that, and skips the\n // redundant \"list of 1\" nesting a lone event doesn't need.\n slot.events.map((event) => <Fragment key={event.id}>{eventRow(event, true)}</Fragment>)\n )}\n </li>\n )\n}\n\nfunction AgendaEventRow<P>({\n event,\n locale,\n timeZone,\n nextEventId,\n renderEvent,\n onEventSelect,\n selected: selectedIds = [],\n withEventDetails = true,\n renderEventDetails,\n detailsPopoverClassName,\n classNames,\n}: RowSharedProps<P> & { event: ScheduleAnyEvent<P>; timeZone: string }) {\n const { selected, anchor } = chipSelection(selectedIds, event.id)\n /**\n * The row is a real control only when both halves hold.\n *\n * `renderEvent` is the interesting one: the override is free to contain its\n * own buttons and links (the shipped docs demo puts a `Badge` and a\n * `Button` in there), and interactive content inside a `<button>` is\n * invalid HTML that browsers reparse β€” the exact button-inside-button trap\n * `Schedule.NextUp` avoided by refusing an `onEventClick` in the first\n * place. So an overridden row stays inert and its content owns its own\n * interaction. It still receives `data-selected`, so an override can style\n * the selected state even though it cannot set it.\n *\n * `onEventSelect` absent covers `withSelection={false}` and `NextUp`: a\n * focusable control whose activation does nothing is worse for a keyboard\n * user than plain text β€” `MonthView`/`YearView` gate their day cells on\n * exactly this.\n */\n const interactive = onEventSelect != null && renderEvent == null\n const detailsOpen = interactive && withEventDetails && anchor\n\n const icon =\n event.icon != null ? (\n <span\n className={cn(\n \"shrink-0 [&_svg]:size-4.5\",\n event.color ? \"text-(--c-text)\" : \"text-gray-light-400 dark:text-gray-dark-500\",\n classNames?.icon,\n )}\n >\n {event.icon}\n </span>\n ) : null\n\n const description = event.description ? (\n // `div`, not `p` β€” `description` is `ReactNode`, so it can carry\n // block-level content; see `schedule-event-details.tsx`'s own\n // identical comment for why a `<p>` here is a real SSR\n // hydration-mismatch risk, not just a lint nicety.\n <div\n className={cn(\n \"truncate text-gray-light-500 text-start text-xs dark:text-gray-dark-400\",\n classNames?.description,\n )}\n >\n {event.description}\n </div>\n ) : null\n\n const title = (\n <p\n className={cn(\n \"truncate text-start font-semibold text-gray-light-900 dark:text-gray-dark-25\",\n classNames?.title,\n )}\n >\n {event.title}\n </p>\n )\n\n const shared = {\n \"data-schedule-part\": \"agenda-event\",\n \"data-color\": event.color,\n ...dataProps({\n \"data-event-id\": event.id,\n \"data-testid\": event.testId ?? event.id,\n \"data-selected\": selected,\n }),\n }\n\n if (!interactive) {\n return (\n <div {...shared} className={cn(\"flex items-center gap-2\", classNames?.event)}>\n {renderEvent ? (\n renderEvent(event, { isNext: nextEventId != null && event.id === nextEventId })\n ) : (\n <>\n {icon}\n <div className=\"min-w-0 flex-1\">\n {title}\n {description}\n </div>\n </>\n )}\n </div>\n )\n }\n\n /**\n * The control wraps the icon and the title, never the description.\n *\n * `title` is a `string` and the icon is decorative, but `description` is a\n * `ReactNode` whose own doc comment invites \"a list, a link, formatted\n * text\" β€” and a link inside a button is invalid HTML that browsers\n * reparse, which is a hydration error, not a nicety. (The shipped docs demo\n * puts a real `<button>` in one, so this is not hypothetical.) Keeping it a\n * sibling under the same tinted row is what lets a row be both selectable\n * and able to carry its own links.\n */\n const button = (\n <button\n type=\"button\"\n data-schedule-part=\"agenda-event-trigger\"\n onClick={() => onEventSelect?.(event)}\n // The visible row omits the time (it lives in the sibling column, and a\n // stack renders it once for the whole slot), so the name has to carry\n // it β€” same shape as `ScheduleEventChip`'s own label. `allDayRangeLabel`\n // rather than a bare \"All day\" names the actual day(s), which is what\n // the details popover already does for the same event.\n aria-label={`${event.title}, ${\n event.allDay\n ? allDayRangeLabel(event.start, event.end, timeZone, locale)\n : timeRangeLabel(event.start, event.end, locale, timeZone)\n }`}\n {...(withEventDetails\n ? { \"aria-haspopup\": \"dialog\" as const, \"aria-expanded\": detailsOpen }\n : {})}\n className={cn(\n \"flex w-full cursor-pointer items-center gap-2 rounded-xs text-start\",\n // `palette`, like every other event chip in the kit. The test is the\n // *surrounding* surface, not this element's own fill: the trigger sits\n // inside the `agenda-event` wrapper, which carries the event's\n // `data-color` and tints with it, which is exactly the \"control inside\n // an already-accented surface\" case `focusStyles` documents.\n //\n // Safe in every state here, unlike a real chip: the row's selected\n // fill is a neutral `bg-black/8`, never the `--c-solid` surface, so\n // `--c-text` keeps its contrast and needs none of the\n // `data-selected:…ring-(--c-on-solid)` override `schedule-event-styles`\n // has to apply. Flush, though β€” the ring sits inside the row's own\n // tint, and an offset would punch a page-background gap through it.\n focusStyles({ ring: \"palette\", offset: false }),\n )}\n >\n {icon}\n <div className=\"min-w-0 flex-1\">{title}</div>\n </button>\n )\n\n const row = (content: ReactNode) => (\n <div\n {...shared}\n className={cn(\n // Roomier than the inert row's bare content box: the tint has to read\n // as one block around a title *and* its description, and the padding\n // is also click target.\n \"-mx-1.5 rounded-sm px-1.5 py-1\",\n // Tint the whole row, not just the control, so the description reads\n // as part of the thing being selected.\n \"hover:bg-black/5 dark:hover:bg-white/8\",\n // Not `EVENT_SELECTED_CLASSES`: that recipe is written against\n // `EVENT_COLOR_CLASSES`' palette surface (`--c-solid`/`--c-on-solid`),\n // which a bare agenda row doesn't have β€” only its icon reads\n // `--c-text`. A neutral tint, the same one the Month/Year day cells\n // already use for hover, one step stronger.\n \"data-selected:bg-black/8 dark:data-selected:bg-white/12\",\n \"transition-colors duration-150 ease-out motion-reduce:transition-none\",\n classNames?.event,\n )}\n >\n {content}\n {description}\n </div>\n )\n\n if (!withEventDetails) return row(button)\n\n // The trigger is the button, never the row: `asChild` merges Ark's trigger\n // props β€” `aria-haspopup`, `aria-expanded`, the click and focus handlers β€”\n // onto whatever it is given, and all of those belong on a real control.\n return row(\n <Popover.Root\n // `lazyMount`, like every Schedule popover β€” see `StaticEventChip`.\n lazyMount\n open={detailsOpen}\n onOpenChange={(d) => {\n // Closing is a deselect β€” see `StaticEventChip`'s own note.\n if (!d.open) onEventSelect?.(null)\n }}\n width=\"auto\"\n >\n <Popover.Trigger asChild>{button}</Popover.Trigger>\n <Popover.Content className={cn(\"max-w-64\", detailsPopoverClassName)}>\n <Popover.Body>\n <ScheduleEventDetailsContent\n event={event}\n locale={locale}\n timeZone={timeZone}\n renderEventDetails={renderEventDetails}\n />\n </Popover.Body>\n </Popover.Content>\n </Popover.Root>,\n )\n}\n","import { dayKey } from \"./schedule-dates\"\nimport type { ScheduleAnyEvent } from \"./schedule-types\"\n\n/**\n * `Schedule.NextUp`'s filter/group pipeline β€” pure, no React, the same \"small\n * composed functions\" shape `schedule-layout.ts` already uses for its own\n * column-clustering pipeline (a different, heavier problem: full\n * interval-overlap clustering for side-by-side column packing, vs. the much\n * simpler \"bucket by identical `start`\" grouping below).\n */\n\n/** An event stays visible until `pastEventsOffset` minutes after its own\n * `end` β€” an in-progress event (`start <= now < end`) is never excluded by\n * this alone, only `end` (plus the grace window) decides. */\nexport function filterUpcomingEvents<P>(\n events: ScheduleAnyEvent<P>[],\n now: Date,\n pastEventsOffset: number,\n): ScheduleAnyEvent<P>[] {\n const cutoff = now.getTime() - pastEventsOffset * 60_000\n return events.filter((event) => event.end.getTime() > cutoff)\n}\n\nexport type NextUpTimeSlot<P = unknown> = { start: Date; events: ScheduleAnyEvent<P>[] }\nexport type NextUpDayGroup<P = unknown> = { key: string; date: Date; slots: NextUpTimeSlot<P>[] }\n\n/**\n * Single pass over a chronologically-sorted list β€” a day's events are always\n * contiguous in that order, so no separate grouping pass is needed: open a\n * new day group whenever `dayKey` changes, a new slot whenever the exact\n * `start` timestamp changes (this is what stacks same-start-time events\n * together). `group.date` borrows the first event's own `start` as the\n * representative instant for day-label formatting.\n */\nexport function groupUpcomingEvents<P>(\n events: ScheduleAnyEvent<P>[],\n timeZone: string,\n): NextUpDayGroup<P>[] {\n const sorted = [...events].sort((a, b) => a.start.getTime() - b.start.getTime())\n const groups: NextUpDayGroup<P>[] = []\n for (const event of sorted) {\n const key = dayKey(event.start, timeZone)\n let group = groups.at(-1)\n if (!group || group.key !== key) {\n group = { key, date: event.start, slots: [] }\n groups.push(group)\n }\n let slot = group.slots.at(-1)\n if (!slot || slot.start.getTime() !== event.start.getTime()) {\n slot = { start: event.start, events: [] }\n group.slots.push(slot)\n }\n slot.events.push(event)\n }\n return groups\n}\n\n/** Filters then groups β€” the pipeline `Schedule.NextUp` renders from on\n * every tick of its live clock. */\nexport function buildNextUpAgenda<P>(\n events: ScheduleAnyEvent<P>[],\n now: Date,\n options: { pastEventsOffset: number; timeZone: string },\n): NextUpDayGroup<P>[] {\n return groupUpcomingEvents(\n filterUpcomingEvents(events, now, options.pastEventsOffset),\n options.timeZone,\n )\n}\n","import type { startOfWeek } from \"@internationalized/date\"\nimport type { ReactNode } from \"react\"\nimport type { DatePredicate } from \"../../lib/date-predicates\"\nimport type { RequiredIfGranted } from \"../../lib/required-if\"\nimport type { ScheduleSlotPredicate } from \"../../lib/schedule-predicates\"\n\n/**\n * A closed subset of the kit's full palette (`lib/colors.ts`), not the\n * shared `Color` type: `brand` and `gray` are excluded (reserved for chrome),\n * and there's no custom-string escape hatch β€” every allowed value's\n * `--c-text`/`--c-soft` pairing has been checked against a white/near-black\n * grid background, a guarantee an arbitrary custom color couldn't make.\n */\nexport const SCHEDULE_EVENT_COLORS = [\n \"red\",\n \"orange\",\n \"yellow\",\n \"green\",\n \"teal\",\n \"cyan\",\n \"blue\",\n \"purple\",\n \"pink\",\n] as const\nexport type ScheduleEventColor = (typeof SCHEDULE_EVENT_COLORS)[number]\n\n/**\n * RFC Β§4 (`docs/rfcs/schedule.md`) value model. `id`/`start`/`end` are the\n * shared shape; `kind` is required and literal-pinned (not stamped on\n * internally) so passing a static event into `data` β€” or vice versa β€” is a\n * compile error, and so a merged render list stays self-describing.\n *\n * `P` (default `unknown`) is a bare generic β€” the DataTable-shaped pattern,\n * not `SelectItem<P>`'s heavier `const Data extends SelectData` + structural\n * extraction machinery β€” since `data`/`staticEvents` are homogeneous arrays\n * with no value-literal narrowing need. `P` infers from `data` at every\n * component boundary that touches events, all the way through to\n * `renderEventDetails`/`renderDayDetails`.\n */\ntype ScheduleEventBase<P = unknown> = {\n /** Stable identity β€” never derived from array index. */\n id: string\n /** Wall-clock instant, native `Date`, exactly like `DatePicker`'s value. */\n start: Date\n /** Exclusive β€” an event ending exactly when another starts does not overlap it. */\n end: Date\n title: string\n /** Secondary content row in the built-in details popover β€” same role as\n * Field's helper text, but `ReactNode` (not just plain text) so a\n * consumer can render rich content there (a list, a link, formatted\n * text). The popover's `max-w-64` cap still applies, so wide content\n * (a table, an image) will look cramped β€” it's sized for wrapped text. */\n description?: ReactNode\n /** One of `SCHEDULE_EVENT_COLORS` β€” a curated subset of the kit palette\n * chosen for contrast against the grid, not the full `Color` type. */\n color?: ScheduleEventColor\n /** `icon={null}` explicitly suppresses the glyph; `undefined` = none set. */\n icon?: ReactNode\n /** Arbitrary extra data, surfaced to `renderEventDetails`/`renderDayDetails`\n * β€” same role as `SelectItem<P>`'s `payload`. */\n payload?: P\n /** Renders as `data-testid`; defaults to `id` (already a stable, unique\n * identity) β€” the data-driven-array convention every kit component with\n * a `data` prop follows, see `/docs/testing`. */\n testId?: string\n /**\n * RFC's all-day addendum β€” Day/Week only. `start`/`end` stay real `Date`s\n * (no separate date-only value type): build an all-day event as day\n * *boundaries* β€” `start` = midnight of the first day, `end` = midnight of\n * the day *after* the last day (exclusive, same convention every other\n * event already uses). A multi-day all-day event draws one continuous bar\n * spanning the days it covers, not one independent pill per day. Ignored\n * outside Day/Week (Month/Year have no time axis to distinguish \"all day\"\n * from, and already render any event β€” all-day or not β€” as a plain pill).\n */\n allDay?: boolean\n}\n\n/**\n * Draggable, resizable, removable β€” mutation is reported, never applied\n * internally. Whether each of those is actually *possible* is governed by\n * `editable` here composed with `ScheduleTimedProps.editable` β€” see\n * `ScheduleEventEditGesture` below. `undefined` inherits the schedule-level\n * grant entirely; when present, this can only narrow it further, never grant\n * a gesture the schedule level doesn't already allow (same \"once restricted,\n * stays restricted\" composition every other per-item `disabled` in the kit\n * uses β€” RadioGroup, TreeSelect, …).\n */\nexport type ScheduleEvent<P = unknown> = ScheduleEventBase<P> & {\n kind: \"event\"\n editable?: boolean | ScheduleEventEditGesture[]\n}\n\n/** Read-only β€” clickable, but never draggable, resizable, or removable. */\nexport type ScheduleStaticEvent<P = unknown> = ScheduleEventBase<P> & { kind: \"static\" }\n\nexport type ScheduleAnyEvent<P = unknown> = ScheduleEvent<P> | ScheduleStaticEvent<P>\n\n/**\n * The **renderer** union β€” which component draws a view, not which tab is\n * selected (that is a `views` entry's `id`, see `schedule-views.ts`).\n *\n * `\"agenda\"` is a list rather than a grid, but it is a renderer like any\n * other: `Root`'s `match` has to draw it, and `Schedule.Toolbar`'s Title and\n * Prev/Next are fed this value, so `formatScheduleTitle`/`paginateDate` have\n * to answer for it either way. Keeping it in here is what lets all four stay\n * `.exhaustive()`.\n */\nexport type ScheduleView = \"days\" | \"month\" | \"year\" | \"agenda\"\n\n/**\n * RFC Β§12a β€” overlap prevention's two independent axes, both folded into the\n * single `preventOverlap` prop (`ScheduleOverlapPreventionOptions`, below)\n * rather than two separate props. Axis A (which gestures enforce no-overlap):\n * `true` covers all three; an array opts in to a subset; `undefined`/`false`\n * reproduces today's v1 behavior everywhere (unchanged β€” overlapping data\n * still lays out side-by-side via `layoutEventColumns`, which has no opinion\n * on whether an overlap is \"allowed\"). Axis B (which event kind counts as a\n * blocker) is `ScheduleOverlapTarget`, below.\n */\nexport type ScheduleOverlapGesture = \"create\" | \"drag\" | \"resize\"\n\n/** Axis B β€” which event kind(s) count as an overlap blocker; `\"both\"` lives\n * on `ScheduleOverlapPreventionOptions.against`, not here, since a bare\n * event never carries `kind: \"both\"`. */\nexport type ScheduleOverlapTarget = \"event\" | \"static\"\n\n/**\n * The object form of `ScheduleTimedProps.preventOverlap` β€” both axes live\n * on one prop now (a merge of what shipped as two separate props,\n * `preventOverlap`/`preventOverlapAgainst`; see `resolveOverlapPrevention`\n * below for the exact resolution table). `preventOverlap` also still accepts\n * a bare `boolean` directly (`true` = both axes at their defaults, `false`/\n * `undefined` = off) β€” this object form is only needed to reach for a\n * non-default `against`, a gesture subset, or both at once.\n */\nexport type ScheduleOverlapPreventionOptions = {\n /** Which gestures enforce no-overlap. Default `true` (all three) when this\n * key is omitted but the options object itself is passed. */\n gestures?: boolean | ScheduleOverlapGesture[]\n /** Which event kind(s) count as a blocker. Default `\"both\"`. */\n against?: ScheduleOverlapTarget | \"both\"\n}\n\n/**\n * Edit permissions β€” which gestures are possible at all. Reuses the same\n * vocabulary the rest of Schedule's public API already uses for these exact\n * actions: `\"drag\"` (`ScheduleOverlapGesture`, `onEventChange`'s `reason`)\n * and `\"remove\"` (`onEventRemove`, the `removeEvent` translation key) β€” no\n * new synonyms. `\"create\"` has no per-event equivalent (there's no existing\n * event to create *on*), so `ScheduleEventEditGesture` below omits it.\n */\nexport type ScheduleEditGesture = \"create\" | \"drag\" | \"resize\" | \"remove\"\n\n/** Per-event narrowing (`ScheduleEvent.editable`) β€” a subset of\n * `ScheduleEditGesture` excluding `\"create\"`. */\nexport type ScheduleEventEditGesture = \"drag\" | \"resize\" | \"remove\"\n\n/**\n * What happens when a resize grip reaches the event's other edge.\n *\n * - `\"none\"` (default) β€” the grip stops `minDuration` away\n * from the other edge. Excess movement is ignored.\n * - `\"push\"` β€” the grip keeps going and the other edge follows, so the event\n * holds the minimum duration and slides.\n * - `\"swap\"` β€” once the grip travels *past* the other edge, the two exchange\n * roles: the old edge becomes the near one, and the grip now controls the\n * far one.\n *\n * Named after zag's own two-thumb range vocabulary\n * (`@zag-js/slider`'s `thumbCollisionBehavior`), which `Slider` already sits\n * on β€” this is the same problem on a time axis, so it is deliberately not a\n * new set of names. Days view only, and resize only: a *move* shifts both\n * edges identically (`moveRange`) so nothing can collide, and a *create* drag\n * has no second stop to collide with (its two endpoints come from one\n * gesture, already normalised by `Math.min`/`Math.max`).\n */\nexport type ScheduleCollision = \"none\" | \"push\" | \"swap\"\n\n/** Named once so `ScheduleTimedProps` (the always-optional shape) and\n * `EditableCallbacks` (the `editable`-conditioned shape, below) can't drift\n * from each other. */\nexport type ScheduleEventChangeHandler<P> = (\n event: ScheduleEvent<P>,\n next: { start: Date; end: Date },\n reason: \"drag\" | \"resize\",\n) => void\nexport type ScheduleEventRemoveHandler<P> = (event: ScheduleEvent<P>) => void\n/** Always a list β€” one range for a left drag, one per day for a right drag\n * (see `ScheduleTimedProps.onEventCreate`) β€” so a gesture commits atomically\n * and a single state update adds every event it made. */\nexport type ScheduleEventCreateHandler = (ranges: { start: Date; end: Date }[]) => void\n\n/**\n * Compile-time counterpart to the dev-mode warning further down\n * (`eventEditGestureExceedsSchedule`'s call site, in\n * `schedule-timed-grid.tsx`) β€” see `lib/required-if.ts`'s own doc comment for\n * the general idiom and why it's safe. Consumed only by `ScheduleProps`'s\n * `Editable` generic (`schedule.tsx`), i.e. `Schedule`/`Schedule.Root` only.\n * `DaysView`/`DayView`/`WeekView` β€” the standalone, no-`Root`-wrapper views β€”\n * deliberately keep `editable` and its callbacks fully optional on\n * `ScheduleTimedProps` and rely solely on the runtime check: both\n * `DayView`/`WeekView` forward their props to `DaysView` via a `{...props}`\n * spread, and a spread doesn't carry per-field literal information for a\n * generic to infer from, so threading a second generic through that\n * standalone path wouldn't reliably catch anything at compile time β€” not\n * worth the extra API surface for comparatively rare standalone usage.\n */\nexport type EditableCallbacks<\n P,\n Editable extends boolean | readonly ScheduleEditGesture[],\n> = RequiredIfGranted<\n ScheduleEditGesture,\n Editable,\n \"drag\",\n { onEventChange: ScheduleEventChangeHandler<P> }\n> &\n RequiredIfGranted<\n ScheduleEditGesture,\n Editable,\n \"resize\",\n { onEventChange: ScheduleEventChangeHandler<P> }\n > &\n RequiredIfGranted<\n ScheduleEditGesture,\n Editable,\n \"remove\",\n { onEventRemove: ScheduleEventRemoveHandler<P> }\n > &\n RequiredIfGranted<\n ScheduleEditGesture,\n Editable,\n \"create\",\n { onEventCreate: ScheduleEventCreateHandler }\n >\n\n/**\n * `@internationalized/date`'s `DayOfWeek` isn't exported by name, so it's\n * derived structurally from `startOfWeek`'s own third parameter β€” the same\n * `NonNullable<Parameters<...>>` idiom `date-picker.tsx` uses for Ark's own\n * non-exported types.\n */\nexport type FirstDayOfWeek = NonNullable<Parameters<typeof startOfWeek>[2]>\n\n/**\n * `DaysViewProps.align` / `ScheduleProps.align`'s type β€” every\n * `FirstDayOfWeek` day-of-week value, plus `\"relative\"`: the visible\n * window's first day is always the anchor date itself (a rolling window),\n * never snapped to a locale calendar-week boundary. Named `align` (not\n * `startOfWeek`) on those two β€” `DaysView`'s window isn't necessarily a\n * week (`visibleDays` can be anything), so a literal \"start of week\" name\n * would mislead. `MonthView` has no use for a rolling window (a month grid\n * is always calendar-week-aligned, genuinely composed of calendar weeks),\n * so its own field keeps the accurate `startOfWeek` name and stays the\n * narrower `FirstDayOfWeek` β€” passing `\"relative\"` there is a compile\n * error, not just a documented restriction.\n */\nexport type ScheduleAlign = FirstDayOfWeek | \"relative\"\n\n/**\n * Every slot says which renderers honour it. Unlike the prop slices, this bag\n * is **not** gated on `views` β€” a class string that lands nowhere is visible\n * in the browser in about a second, where a dropped behaviour prop is not, and\n * making it conditional would mean a `ScheduleClassNames<V>` threaded through\n * all four view components and every consumer annotation. The labels are the\n * cheaper answer to the same question.\n */\nexport type ScheduleClassNames = {\n /** `Root`'s toolbar row. */\n toolbar?: string\n /** The scrollable grid root β€” Days, Month and Year each have one. */\n grid?: string\n /** Days only. Month's day-cell pills are a different element with a\n * different anatomy (no grip, no remove button, no time line), so they\n * deliberately don't read this. */\n event?: ScheduleEventChipClassNames\n /** Month only β€” the unavailable-day wash (`dayDisabled`). */\n disabledOverlay?: string\n /** Days only. */\n nowIndicator?: string\n /** Days only β€” the click-drag-to-create ghost box. */\n createDraft?: string\n /** Days only β€” the move-drag preview box (RFC Β§6), the sibling of\n * `createDraft` for an event being moved rather than drafted. */\n dragGhost?: string\n /** Days, Month and Agenda β€” the built-in event-details popover's panel. */\n eventDetailsPopover?: string\n /** Days and Month β€” every \"+N\" disclosure: the timed grid's many-way-overlap\n * indicator, the all-day row's per-day one, and Month's day-cell one.\n *\n * Replaces the former `dayDetailsPopover`, which named Month's half of the\n * same panel back when Month hand-rolled its own popover. `content` is that\n * key's replacement. */\n overflow?: ScheduleOverflowClassNames\n /** Agenda β€” `AgendaView`'s rows, and the same list `Schedule.NextUp`\n * renders standalone. */\n agenda?: ScheduleAgendaListClassNames\n}\n\n/**\n * The agenda list's slots β€” shared verbatim between `AgendaView` and\n * `Schedule.NextUp`, which render the same list over two different windows.\n * Lives here rather than beside the component so `ScheduleClassNames` can\n * nest it without `schedule-types.ts` importing from a component file (this\n * module is the graph's root; nothing in the folder may make it a cycle).\n */\nexport type ScheduleAgendaListClassNames = {\n dayGroup?: string\n dayLabel?: string\n timeGroup?: string\n /** The `HH:MM` slot heading β€” and the \"All day\" label that replaces it. */\n time?: string\n event?: string\n icon?: string\n title?: string\n description?: string\n duration?: string\n}\n\nexport type ScheduleEventChipClassNames = {\n root?: string\n icon?: string\n /** The chip's height floor and the threshold that reveals `time` are both\n * derived from `text-xs`'s own line box (exactly `1rem`), so a font-size\n * override here wants a matching `hourHeight` β€” otherwise a taller line\n * can outgrow the box the chip reserved for it. */\n title?: string\n /** Hidden unless the chip's real rendered height fits two lines, via a\n * `@container` size query rather than the event's duration β€” see\n * `title` for the font-size caveat. The full range stays in the chip's\n * `aria-label` and its details popover regardless. */\n time?: string\n grip?: string\n removeButton?: string\n}\n\n/** Formerly `ScheduleOverflowClassNames` β€” it covers the disclosure panel\n * and its rows too, not only the chip. */\nexport type ScheduleOverflowClassNames = {\n /** The \"+N\" button itself. */\n root?: string\n /** The disclosure popover's panel. */\n content?: string\n /** One row of the list inside it. */\n item?: string\n}\n\n/**\n * RFC Β§15 β€” one unified `translations` prop, prop-only (no context), all\n * keys optional, shallow-merged over the English defaults below. Weekday/\n * month names and AM/PM are Intl-derivable from `locale`/`timeZone` and\n * deliberately have no key here.\n */\nexport type ScheduleTranslations = {\n now?: string\n previous?: string\n next?: string\n /** The `\"day\"` view-switcher entry (a one-day window). */\n day?: string\n /** The `\"week\"` view-switcher entry (a seven-day window). */\n week?: string\n /**\n * The `\"days\"` view-switcher entry β€” the one whose window is *variable*\n * (it inherits `ScheduleProps.visibleDays`), which is why its default copy\n * is `\"Week\"` rather than `\"Days\"`: with the default `visibleDays` of `7`\n * that is what it actually shows. The RFC (Β§15) specifies `\"Days\"`; that\n * drift is deliberate and stays, since no static label is correct for a\n * window the consumer sizes. Reach for the fixed-size `day`/`week` entries\n * when you want a label that is honest by construction.\n */\n days?: string\n month?: string\n year?: string\n /** The `\"agenda\"` view-switcher entry β€” the month-windowed event list. */\n agenda?: string\n empty?: string\n removeEvent?: string\n /** `\"{count}\"`-substituted β€” see RFC Β§19 on why this stays a flat template for v1. */\n eventCount?: string\n /** The day-details popover's back-to-list button β€” distinct from\n * `previous` (calendar pagination), not reused for it. */\n back?: string\n /** The Day/Week timed grid's all-day row gutter label. */\n allDay?: string\n /** Screen-reader-only announcement (a visually-hidden `role=\"status\"`\n * region, `schedule-timed-grid.tsx`) fired once a create-drag commits β€”\n * the create/remove chip animations are purely visual otherwise.\n * `\"{range}\"`-substituted with the new event's time range: `onEventCreate`\n * only ever receives `{ start, end }` (Schedule never invents a title),\n * so there's nothing else to announce yet at this point. */\n eventCreated?: string\n /** Same live region as `eventCreated`, fired once a remove's exit\n * animation actually finishes. `\"{title}\"`-substituted β€” the full event\n * (title included) is available by the time this fires. */\n eventRemoved?: string\n}\n\nconst DEFAULT_TRANSLATIONS: Required<ScheduleTranslations> = {\n now: \"Now\",\n previous: \"Previous\",\n next: \"Next\",\n day: \"Day\",\n week: \"Week\",\n days: \"Week\",\n month: \"Month\",\n year: \"Year\",\n agenda: \"Agenda\",\n empty: \"No events\",\n removeEvent: \"Remove event\",\n eventCount: \"{count} events\",\n back: \"Back\",\n allDay: \"All day\",\n eventCreated: \"New event created, {range}\",\n eventRemoved: \"{title} removed\",\n}\n\nexport const resolveScheduleTranslations = (\n overrides?: ScheduleTranslations,\n): Required<ScheduleTranslations> => ({ ...DEFAULT_TRANSLATIONS, ...overrides })\n\n/** Substitutes `translations.eventCount`'s `\"{count}\"` template β€” the \"+N\"\n * aria-label shared by every overflow trigger (the timed grid's and\n * all-day row's `ScheduleOverflowPopover`, Month's own day-cell pill). */\nexport const eventCountLabel = (template: string, count: number) =>\n template.replace(\"{count}\", String(count))\n\n/** Resolves axis A of overlap-prevention (RFC Β§12a) for one gesture. */\nexport function isOverlapGestureEnabled(\n preventOverlap: boolean | ScheduleOverlapGesture[] | undefined,\n gesture: ScheduleOverlapGesture,\n): boolean {\n if (!preventOverlap) return false\n return preventOverlap === true || preventOverlap.includes(gesture)\n}\n\n/**\n * Resolves `ScheduleTimedProps.preventOverlap`'s merged shape into its two\n * independent axes β€” `gestures` (feed to `isOverlapGestureEnabled`, once per\n * gesture) and `against` (feed to `resolveOverlapCandidates`,\n * `schedule-dates.ts`). Pure and cheap enough to call once per render, same\n * \"resolve once, thread the result down\" shape the rest of Schedule's\n * gesture/permission resolution already uses.\n *\n * | `preventOverlap` | β†’ `gestures` | β†’ `against` |\n * |------------------------------------|-----------------|--------------|\n * | `undefined` / `false` | `false` | `\"both\"` (irrelevant β€” `gestures` is `false`) |\n * | `true` | `true` | `\"both\"` |\n * | `{}` | `true` | `\"both\"` |\n * | `{ gestures: [...] }` | that array | `\"both\"` |\n * | `{ against: X }` | `true` | `X` |\n * | `{ gestures: [...], against: X }` | that array | `X` |\n */\nexport function resolveOverlapPrevention(\n preventOverlap: boolean | ScheduleOverlapPreventionOptions | undefined,\n): { gestures: boolean | ScheduleOverlapGesture[]; against: ScheduleOverlapTarget | \"both\" } {\n if (!preventOverlap) return { gestures: false, against: \"both\" }\n if (preventOverlap === true) return { gestures: true, against: \"both\" }\n return {\n gestures: preventOverlap.gestures ?? true,\n against: preventOverlap.against ?? \"both\",\n }\n}\n\n/** Resolves the schedule-level `editable` grant for one gesture β€” same\n * boolean-or-array shape/logic as `isOverlapGestureEnabled`, kept as a\n * separate function since the two props are deliberately independent\n * concepts with different gesture vocabularies. */\nexport function isEditGestureEnabled(\n editable: boolean | readonly ScheduleEditGesture[] | undefined,\n gesture: ScheduleEditGesture,\n): boolean {\n if (!editable) return false\n return editable === true || editable.includes(gesture)\n}\n\n/**\n * The final, composed permission for one event + one gesture. Takes the\n * schedule-level grant *already resolved* for this gesture (via\n * `isEditGestureEnabled`, once per render at the grid level β€” the same\n * \"resolve once, thread a boolean down\" shape `preventOverlapOnDrag`/etc.\n * already use), not the raw `editable` prop β€” the event-level composition\n * below is the only part that varies per event. An event's own `editable`,\n * when present, can only narrow this further, never widen it: if the\n * schedule level doesn't grant a gesture, no per-event `editable` can turn\n * it back on.\n */\nexport function isEventGestureEnabled(\n scheduleGrant: boolean,\n event: Pick<ScheduleEvent, \"editable\">,\n gesture: ScheduleEventEditGesture,\n): boolean {\n if (!scheduleGrant) return false\n if (event.editable === undefined) return true\n if (!event.editable) return false\n return event.editable === true || event.editable.includes(gesture)\n}\n\n/** Whether an event's own `editable` requests a gesture the schedule level\n * doesn't already grant β€” a no-op the event can't actually widen into, and\n * worth a dev-mode warning so that mismatch doesn't fail silently. */\nexport function eventEditGestureExceedsSchedule(\n scheduleEditable: boolean | readonly ScheduleEditGesture[] | undefined,\n event: Pick<ScheduleEvent, \"editable\">,\n): ScheduleEventEditGesture[] {\n if (!event.editable) return []\n const requested: ScheduleEventEditGesture[] =\n event.editable === true ? [\"drag\", \"resize\", \"remove\"] : event.editable\n return requested.filter((gesture) => !isEditGestureEnabled(scheduleEditable, gesture))\n}\n\n// ---------------------------------------------------------------------------\n// Prop slices (RFC Β§17) β€” composed by intersection, never a context provider.\n// ---------------------------------------------------------------------------\n\n/**\n * Every renderer. The floor: if a prop is here, no `views` list can make it\n * meaningless, which is what `ScheduleProps` relies on when it decides which\n * slices to gate (`available-if.ts`).\n *\n * Everything that *some* renderer ignores lives in one of the slices below\n * instead, named for the renderers it serves. Adding a prop here is therefore\n * a claim β€” that all four read it β€” and the one to check first when a prop\n * turns out to be silently dropped.\n */\nexport type ScheduleSharedProps<P = unknown> = {\n /** Draggable, resizable, removable events. Never mutated internally. */\n data: ScheduleEvent<P>[]\n /** Read-only, programmatically-supplied events. Default `[]`. */\n staticEvents?: ScheduleStaticEvent<P>[]\n /**\n * Override for tests/Storybook; a fixed value stops the live tick entirely.\n *\n * Every renderer reads it, but for different amounts of work: Month and Year\n * only pick out which cell gets the today accent, while Days draws a\n * ticking now-line and Agenda derives its Today/Tomorrow day headings β€” so\n * only those two hold a live clock. `Root` additionally seeds the\n * uncontrolled anchor date from it.\n */\n now?: Date\n locale?: string\n /** Default `getLocalTimeZone()` β€” not Ark's own `\"UTC\"` default. */\n timeZone?: string\n translations?: ScheduleTranslations\n classNames?: ScheduleClassNames\n className?: string\n}\n\n/**\n * Days, Month, Year β€” everything with a day to click. Agenda has none: it is\n * a list of events under a group divider, with no day cell and no day header,\n * which is why it takes this slice and not `ScheduleSharedProps`.\n */\nexport type ScheduleDayClickProps = {\n /**\n * Day-cell / day-header click.\n *\n * Its presence decides whether Month's and Year's day cells are focusable\n * controls at all β€” a button whose activation does nothing is worse for a\n * keyboard user than plain text. In Days view the day *header* is always a\n * button, so there this only ever fires.\n *\n * It no longer has anything to do with Month's day-details popover: that\n * moved onto the \"+N\" chip, gated on there actually being hidden events,\n * because the two used to be mutually exclusive β€” wiring `onDayClick` to\n * navigate silently removed the only route to the events behind the cap.\n */\n onDayClick?: (date: Date) => void\n}\n\n/**\n * Days, Month, Agenda β€” the three renderers that draw an individual event a\n * reader can point at. Year draws density dots and month counts, so there is\n * nothing there to select and nothing to open a details popover on.\n *\n * Year used to `Omit` these six names off `ScheduleSharedProps` one by one;\n * naming the set once is what stops that list drifting from this one.\n */\nexport type ScheduleEventProps<P = unknown> = {\n /**\n * The selected event's `id`, several ids, or `null` for none.\n *\n * Replaces the former `onEventClick`, which reported a click *and* silently\n * suppressed the details popover by its mere presence. Those were two jobs:\n * the reporting is this triple, and the popover is `withEventDetails` below.\n *\n * One prop drives three things, deliberately β€” the chip's selected styling,\n * which chip's details popover is open, and which row of a \"+N\" list is\n * expanded. They were four independent `useState(false)` flags plus two\n * local `activeEventId`s before, which is precisely why none of it was\n * reachable from outside.\n *\n * **Several ids** are for one thing drawn as several chips β€” an offer split\n * around a booking, an event interrupted by a break. Every listed chip is\n * painted selected; the **first** id is the anchor, the only chip whose\n * details popover opens and the one a selection change scrolls into view.\n * `onSelect` still reports the single chip that was pressed, so map it to\n * the group yourself and keep the pressed id first:\n *\n * ```tsx\n * selected={offer ? piecesOf(offer) : null}\n * onSelect={(event) => setOffer(event?.payload?.offerId ?? null)}\n * ```\n *\n * `null` (not `undefined`) is the \"nothing selected\" sentinel, per\n * `useUncontrolled`'s own contract. An empty list means the same.\n */\n selected?: string | readonly string[] | null\n defaultSelected?: string | readonly string[] | null\n /** Fires with the whole event, not its id β€” the consumer already has the id\n * they passed; what they don't have is the object it came from. `null` when\n * the selection is cleared, i.e. a plain click on empty space, or the\n * details popover being dismissed. */\n onSelect?: (event: ScheduleAnyEvent<P> | null) => void\n /**\n * Default `true`. `false` turns selection off entirely: no chip is styled\n * selected, no details popover opens, and `onSelect` never fires.\n *\n * Selection being on by default is a deliberate change from the pre-`selected`\n * behaviour β€” a chip click that gives no feedback at all is the odd one.\n */\n withSelection?: boolean\n /**\n * Default `true`. Whether the built-in event-details popover mounts for the\n * selected event.\n *\n * Set `false` when you are rendering the detail yourself (a side panel, a\n * drawer) and only want the selection state β€” the dashboard example does\n * exactly this. Use `renderEventDetails` instead to keep the popover but\n * replace what is inside it.\n */\n withEventDetails?: boolean\n /** Overrides the built-in event-details popover's content entirely, wherever\n * `withEventDetails` mounts one. */\n renderEventDetails?: (event: ScheduleAnyEvent<P>) => ReactNode\n}\n\n/** Which \"+N\" fired. All three behave identically; this only tells you where\n * the reader was looking. */\nexport type ScheduleOverflowSource = \"timed\" | \"allDay\" | \"month\"\n\n/** The second argument every overflow hook receives. */\nexport type ScheduleOverflowContext = {\n /** The day the \"+N\" sits on. For a timed cluster that is the day column it\n * belongs to, not the cluster's own start instant. */\n date: Date\n source: ScheduleOverflowSource\n}\n\n/**\n * Days and Month β€” the two renderers that cap how much of a container they\n * draw and collapse the rest into a \"+N\".\n *\n * All three \"+N\" surfaces (the timed grid's column overflow, the all-day row's\n * per-day overflow, Month's day cell) behave identically: the chip counts the\n * events that did not fit, and the disclosure lists exactly those. Year draws\n * density dots with no cap, and the agenda is an unbounded list, so neither\n * has an overflow to disclose.\n */\nexport type ScheduleOverflowProps<P = unknown> = {\n /**\n * Fires when a \"+N\" is activated, with the events it hides and where it sits.\n *\n * **Reports only β€” it suppresses nothing.** Pass\n * `withOverflowDetails={false}` to take over the disclosure itself. That\n * separation is deliberate: this prop used to double as the suppression\n * switch by its mere presence, which is the same two-jobs-in-one-prop shape\n * `onEventClick` had before `selected`/`withEventDetails` replaced it, and\n * it made the built-in UI impossible to keep while still being told about\n * the click.\n */\n onOverflowClick?: (events: ScheduleAnyEvent<P>[], ctx: ScheduleOverflowContext) => void\n /**\n * Default `true`. Whether the built-in \"+N\" disclosure popover mounts β€” a\n * list of the hidden events, each opening into its own full details.\n *\n * `false` leaves the \"+N\" a plain button that only fires `onOverflowClick`;\n * the twin of `withEventDetails` one level up. Use `renderOverflowDetails`\n * instead to keep the popover and replace what is inside it.\n */\n withOverflowDetails?: boolean\n /**\n * Overrides the disclosure's list content, keeping the popover shell.\n *\n * Replaces the former `renderDayDetails`, which was Month-only and named for\n * a day even though it was only ever reachable from the \"+N\" chip. `events`\n * leads now (the date moved into `ctx`), matching every other list-shaped\n * render prop in the kit, and it works on all three surfaces rather than one.\n *\n * `ctx.onSelectEvent` still drives the built-in listβ†’detail swap, so custom\n * row markup does not have to give that up. An override owns its own empty\n * state β€” `translations.empty` is only used by the default list.\n */\n renderOverflowDetails?: (\n events: ScheduleAnyEvent<P>[],\n ctx: ScheduleOverflowContext & { onSelectEvent: (event: ScheduleAnyEvent<P>) => void },\n ) => ReactNode\n}\n\n/**\n * Days and Agenda β€” the two renderers that can have nothing to show.\n *\n * Month and Year always draw a calendar whatever the data, so they have no\n * empty state to override. `translations.empty` supplies the default copy for\n * both of these, and is also read by Month's day-details list, which is a\n * different surface with a different reason to be empty β€” hence a translation\n * key shared by three places and a node prop taken by two.\n */\nexport type ScheduleEmptyProps = {\n /** Replaces the whole \"nothing here\" placeholder β€” the timed grid's, and the\n * agenda list's. Pass `null` to suppress it entirely. */\n empty?: ReactNode\n}\n\n/**\n * Month and Year β€” the two renderers whose unit is a whole calendar day.\n *\n * The day-granularity twin of `ScheduleTimedProps.slotDisabled`, which judges\n * a time range instead. Two props rather than one because the predicates\n * genuinely differ in shape (`lib/date-predicates.ts` vs\n * `lib/schedule-predicates.ts`, which says so in its own header) β€” but one\n * verb, so they read as the siblings they are.\n */\nexport type ScheduleDayDisabledProps = {\n /** Day-granularity restriction β€” the very same `DatePredicate` as\n * `Calendar`/`DatePicker`'s `isDateUnavailable`, so it pairs with\n * `@42/ui-react/date-picker`'s predicate factories. Note those share names\n * with `@42/ui-react/schedule`'s own range-shaped ones; alias at the import\n * if you need both. The view fills in its own `timeZone` as the second\n * argument, so a `disableWeekends()` here disables the schedule's weekends\n * rather than the host's. */\n dayDisabled?: DatePredicate\n}\n\n/** The slot sizes a timed grid supports, in minutes. */\nexport type ScheduleSlotDuration = 15 | 30 | 60\n\n/*\n * Every multiple of each slot size from one slot up to a day.\n *\n * Spelled out, not computed, because this is paid by every consumer just for\n * importing the schedule. Measured with `tsc --extendedDiagnostics` on the\n * `schedule-type-cost.test.ts` baseline fixture: counting them with a tuple\n * cost ~290k extra types, deriving the 30/60 lists from the 15 one by\n * recursion ~19k, and these three literals ~500.\n */\ntype QuarterHoursInADay =\n | 15\n | 30\n | 45\n | 60\n | 75\n | 90\n | 105\n | 120\n | 135\n | 150\n | 165\n | 180\n | 195\n | 210\n | 225\n | 240\n | 255\n | 270\n | 285\n | 300\n | 315\n | 330\n | 345\n | 360\n | 375\n | 390\n | 405\n | 420\n | 435\n | 450\n | 465\n | 480\n | 495\n | 510\n | 525\n | 540\n | 555\n | 570\n | 585\n | 600\n | 615\n | 630\n | 645\n | 660\n | 675\n | 690\n | 705\n | 720\n | 735\n | 750\n | 765\n | 780\n | 795\n | 810\n | 825\n | 840\n | 855\n | 870\n | 885\n | 900\n | 915\n | 930\n | 945\n | 960\n | 975\n | 990\n | 1005\n | 1020\n | 1035\n | 1050\n | 1065\n | 1080\n | 1095\n | 1110\n | 1125\n | 1140\n | 1155\n | 1170\n | 1185\n | 1200\n | 1215\n | 1230\n | 1245\n | 1260\n | 1275\n | 1290\n | 1305\n | 1320\n | 1335\n | 1350\n | 1365\n | 1380\n | 1395\n | 1410\n | 1425\n | 1440\ntype HalfHoursInADay =\n | 30\n | 60\n | 90\n | 120\n | 150\n | 180\n | 210\n | 240\n | 270\n | 300\n | 330\n | 360\n | 390\n | 420\n | 450\n | 480\n | 510\n | 540\n | 570\n | 600\n | 630\n | 660\n | 690\n | 720\n | 750\n | 780\n | 810\n | 840\n | 870\n | 900\n | 930\n | 960\n | 990\n | 1020\n | 1050\n | 1080\n | 1110\n | 1140\n | 1170\n | 1200\n | 1230\n | 1260\n | 1290\n | 1320\n | 1350\n | 1380\n | 1410\n | 1440\ntype HoursInADay =\n | 60\n | 120\n | 180\n | 240\n | 300\n | 360\n | 420\n | 480\n | 540\n | 600\n | 660\n | 720\n | 780\n | 840\n | 900\n | 960\n | 1020\n | 1080\n | 1140\n | 1200\n | 1260\n | 1320\n | 1380\n | 1440\n\n/** Whole days past the first, up to a week β€” a multiple of every\n * `ScheduleSlotDuration`, so one list serves all three. */\ntype WholeDaysUpToAWeek = 2880 | 4320 | 5760 | 7200 | 8640 | 10080\n\n/**\n * A duration, in minutes, that is a whole number of `S`-minute slots: any\n * multiple up to 24 hours, then whole days up to a week.\n *\n * `SlotMultiple<30>` accepts `30`, `60`, `90`… and rejects `45`. A value\n * computed at runtime is a `number`, which this does not accept β€” narrow it,\n * or let the runtime backstop (`resolveDurationBounds`) round it onto the grid.\n */\nexport type SlotMultiple<S extends ScheduleSlotDuration> =\n | {\n 15: QuarterHoursInADay\n 30: HalfHoursInADay\n 60: HoursInADay\n }[S]\n | WholeDaysUpToAWeek\n\n/** The duration props for one slot size β€” `S` ties all three together. */\ntype SlotPropsFor<S extends ScheduleSlotDuration> = {\n /**\n * Minutes β€” grid spacing AND the drag/resize/create snap increment:\n * `15` (default), `30` or `60`.\n */\n slotDuration?: S\n /**\n * Minutes β€” the shortest event a create or resize may produce. Defaults to\n * one `slotDuration`, and can only be a whole number of them: with\n * `slotDuration={30}`, `minDuration={45}` does not compile.\n *\n * A create drag shorter than this grows to it, from the edge the gesture\n * anchored on; a resize grip stops this far from the other edge. Moving an\n * event never changes its duration, so drag ignores it.\n */\n minDuration?: SlotMultiple<S>\n /**\n * Minutes β€” the longest event a create or resize may produce. Absent, there\n * is no ceiling. Like `minDuration`, a whole number of `slotDuration`s, so a\n * capped edge always lands on a gridline.\n *\n * The draft visibly stops growing at the cap, from the edge the gesture\n * anchored on; a right-drag caps each of its per-day events. Set below\n * `minDuration`, it is raised to it. An event already longer than the cap\n * can still be resized shorter, but never longer. Moving an event never\n * changes its duration, so drag ignores it.\n */\n maxDuration?: SlotMultiple<S>\n}\n\n/**\n * `slotDuration` and the two durations measured in it β€” one member per slot\n * size, so `minDuration`/`maxDuration` are checked against the `slotDuration`\n * written beside them. The 15-minute member leaves `slotDuration` optional:\n * omitting it means 15.\n *\n * Kept out of `ScheduleTimedProps` on purpose: that slice goes through\n * `Omit`, and `Omit` over a union collapses it β€” `slotDuration` and\n * `minDuration` would come out as two independent unions and the check\n * between them would be gone. Compose this one alongside it instead.\n */\nexport type ScheduleSlotProps =\n | SlotPropsFor<15>\n | (SlotPropsFor<30> & { slotDuration: 30 })\n | (SlotPropsFor<60> & { slotDuration: 60 })\n\n/** `ScheduleSlotProps` widened back to plain numbers β€” what an implementation\n * destructures and threads down, after the public signature has checked it. */\nexport type ScheduleSlotValues = {\n slotDuration?: ScheduleSlotDuration\n minDuration?: number\n maxDuration?: number\n}\n\n/**\n * Days only β€” structurally absent from the Month/Year/Agenda props, enforcing\n * the \"no drag/resize outside a timed grid\" rule at the type level rather\n * than with a runtime flag.\n *\n * By far the largest slice, and the reason `ScheduleProps` needs gating at\n * all: on `Root` these are reachable under any `views`, so before\n * `available-if.ts` every one of them typechecked against a month-and-year\n * schedule and then did nothing.\n */\nexport type ScheduleTimedProps<P = unknown> = {\n /** Default `0`. */\n startHour?: number\n /** Default `24`. */\n endHour?: number\n /** What a resize grip does once it reaches the event's **own** other edge β€”\n * `\"none\"` (default) stops it, `\"push\"` carries that edge along, `\"swap\"`\n * exchanges the two. See `ScheduleCollision`.\n *\n * Replaces the former `collision`, which sat one word away from\n * `preventOverlap` and read as a synonym for it. The two are unrelated:\n * this is one event's two edges, that is two different events. */\n resizeCollision?: ScheduleCollision\n /**\n * Row density β€” px per hour, as a **minimum**: the timed area stretches\n * via CSS to fill whatever real vertical space its container gives it,\n * scrolling only once this floor itself exceeds that space (**correction\n * after v1 shipped** β€” this used to be a fixed height, not a floor).\n * Absent: defaults to `defaultHourHeight(slotDuration)`\n * (`schedule-geometry.ts`), which scales with `slotDuration` so a finer\n * slot spacing gets a taller default hour β€” a coarser one, a shorter one,\n * floored so it stays legible. An explicit value here\n * always overrides that default.\n */\n hourHeight?: number\n slotDisabled?: ScheduleSlotPredicate\n /** Default `true`. */\n withNowIndicator?: boolean\n /**\n * Which gestures are possible at all β€” `editable` (below) is the sole\n * authority on that; this fires once a permitted gesture actually\n * commits. Default `undefined`/no `\"drag\"` in `editable` means this never\n * fires β€” a schedule with no `editable` grant has nothing to report.\n */\n onEventChange?: ScheduleEventChangeHandler<P>\n /** Fires when a permitted remove (`editable` including `\"remove\"`) actually\n * happens. Whether the remove button renders is decided by `editable`\n * alone, not by this prop's presence. */\n onEventRemove?: ScheduleEventRemoveHandler<P>\n /**\n * Fires when a permitted click-drag-to-create (`editable` including\n * `\"create\"`) actually commits, with **every range the gesture created**:\n *\n * - **left drag** β€” one range, spanning the two points on the absolute\n * timeline (Sunday 22:00 β†’ Monday 02:00 is one four-hour event);\n * - **right drag** β€” one range per day between the two points, each over\n * the same time of day (Day 1 08:00 β†’ Day 3 16:00 is three 08:00–16:00\n * events). Days `slotDisabled` or `preventOverlap` would reject are\n * skipped; the gesture only fails when every day is rejected.\n *\n * Whether the gesture is possible at all is decided by `editable` alone,\n * not by this prop's presence. Schedule never invents an `id`/`title`; the\n * consumer builds the full events and adds them to `data` themselves, same\n * \"fully consumer-controlled\" contract as `onEventChange`/`onEventRemove`.\n * A plain click (no discernible drag) is a no-op; a drag shorter than\n * `minDuration` (one `slotDuration` by default) grows to it, mirroring the\n * resize floor.\n *\n * @example\n * onEventCreate={(ranges) =>\n * setEvents((events) => [...events, ...ranges.map((range) => ({ id: uid(), title: \"New\", ...range }))])\n * }\n */\n onEventCreate?: ScheduleEventCreateHandler\n /**\n * Fires on a plain click (no discernible drag) that lands on empty\n * day-column space β€” not on an event/overflow chip, and never alongside a\n * committed create-drag (the same click-vs-drag resolution that decides\n * `onEventCreate` decides this too, mutually exclusively). Independent of\n * `editable`'s `\"create\"` grant. Days view only, like `onEventCreate`.\n *\n * Formerly `onEventDismiss`, which took no argument and existed solely to be\n * the clear-half of a selection the consumer hand-rolled β€” a job `onSelect`\n * now does, with the same gesture, so keeping both would have shipped two\n * props firing on one click for one reason. What survives under this name is\n * the part `selected` genuinely does not cover: the raw gesture, which fires\n * whether or not anything was selected, and which can now report *when* on\n * the grid you clicked. Both fire on the same click; they are no longer\n * synonyms.\n */\n onGridClick?: (date: Date) => void\n /**\n * Which gestures are possible on this schedule β€” `undefined` (the\n * default) means **nothing is editable**: no drag, no resize, no create,\n * no remove, regardless of which callbacks below are passed. `true` grants\n * all four; an array opts a subset in. A `kind:\"event\"` item can further\n * narrow (never widen) this via its own `editable` field β€” see\n * `ScheduleEvent`. In development, a console warning fires once if a\n * granted gesture's matching callback (`onEventChange` for `\"drag\"`/\n * `\"resize\"`, `onEventRemove` for `\"remove\"`, `onEventCreate` for\n * `\"create\"`) is missing, since the affordance would render but do\n * nothing when used. On `Schedule`/`Schedule.Root` specifically, passing a\n * literal (or otherwise call-site-resolvable) `editable` also makes this a\n * **compile error**, not just a console warning β€” see `EditableCallbacks`.\n * A non-literal `editable` (a plain `boolean`/`ScheduleEditGesture[]`\n * variable) can't be resolved to specific gestures at compile time, so it\n * conservatively requires every callback instead β€” the console warning\n * above remains the only check for that case, and for the standalone\n * `DaysView`/`DayView`/`WeekView`, which don't get the compile-time layer\n * at all (see `EditableCallbacks`'s own doc comment for why).\n */\n editable?: boolean | readonly ScheduleEditGesture[]\n /**\n * Overlap-prevention β€” keeps a created, dragged, or resized event from\n * landing on another one. Deliberately separate from `slotDisabled` (RFC\n * Β§12's own \"occupied and disabled are two different, non-conflated\n * concepts\" principle applies here too). Default (`undefined`/`false`)\n * reproduces today's v1 behavior everywhere β€” overlapping data still lays\n * out side-by-side via `layoutEventColumns`, unaffected until you opt in.\n *\n * A plain `boolean` covers the common case (`true` enforces it for\n * create, drag, *and* resize, against both event kinds). Pass\n * `ScheduleOverlapPreventionOptions` instead to scope which gestures\n * enforce it (`gestures`, default `true`) and/or which event kind(s) count\n * as a blocker (`against`, default `\"both\"`) β€” see\n * `resolveOverlapPrevention` for the exact resolution table.\n */\n preventOverlap?: boolean | ScheduleOverlapPreventionOptions\n /**\n * Cap on side-by-side columns before further concurrent events collapse\n * into a \"+N\" overflow indicator. Applies to real point-in-time\n * concurrency, not a cluster's historical max, so a brief spike doesn't\n * flatten the cluster's otherwise-uncrowded events into overflow. Default\n * `4`. Pass `Number.POSITIVE_INFINITY` to restore unbounded columns.\n */\n maxOverlapColumns?: number\n /**\n * Cap on visible concurrent all-day lanes before excess all-day events\n * collapse into a per-day \"+N\" overflow indicator β€” same\n * cap-then-overflow shape as `maxOverlapColumns`, just packed by day-index\n * (which day columns a bar spans) instead of by time. Default `2`, lower\n * than `maxOverlapColumns`'s `4` since a day-column is narrow. Ignored\n * when no all-day events are in view β€” the row itself doesn't render then.\n */\n maxAllDayRows?: number\n}\n\nexport type AnchorDateProps = {\n date?: Date\n defaultDate?: Date\n onDateChange?: (date: Date) => void\n}\n\nexport type PaginationChromeProps = {\n withPagination?: boolean\n withNowButton?: boolean\n}\n","import type { ReactNode } from \"react\"\nimport type { ScheduleTranslations, ScheduleView } from \"./schedule-types\"\n\n/**\n * The view-switcher's configurable entry list (`ScheduleProps.views`), and the\n * pure resolvers that turn it into something `Root` and `Schedule.Toolbar`'s\n * `ViewSwitcher` can render.\n *\n * Kept out of `schedule-types.ts` deliberately β€” that file is already past 600\n * lines, and this directory is split strictly one-concern-per-file with a\n * paired test each (`schedule-dates`, `schedule-layout`, `schedule-segments`,\n * `schedule-snap`, `schedule-geometry`). The import graph stays acyclic: this\n * module imports from `schedule-types.ts`, never the other way round.\n *\n * The distinction the whole file turns on: an entry's **`id`** is its\n * *identity* (which tab is active, and what `view`/`defaultView`/\n * `onViewChange` carry), while its **`view`** is its *renderer* (which of the\n * three view components draws it). They coincide for the plain\n * `\"days\"`/`\"month\"`/`\"year\"` entries, which is why a single `ScheduleView`\n * sufficed before this existed β€” but they must not be conflated once one\n * schedule can offer two differently-sized days-windows.\n */\n\n/** The bare-string entries `views` accepts.\n *\n * `\"day\"`/`\"week\"` are **not** `ScheduleView`s β€” there is no \"day\" renderer,\n * they are preconfigured `\"days\"` windows β€” which is exactly why this is a\n * wider union than `ScheduleView` rather than an alias for it. `\"agenda\"`,\n * by contrast, *is* a renderer and rides in on `ScheduleView`. */\nexport type ScheduleViewShorthand = \"day\" | \"week\" | ScheduleView\n\nexport type ScheduleViewOptionObject = {\n /** The entry's identity: the value `view`/`defaultView`/`onViewChange` carry,\n * and the switcher tab's key. Arbitrary β€” only the six\n * `ScheduleViewShorthand` ids come with defaults. */\n id: string\n /** Which renderer draws it. Defaults from `id` when `id` is a known\n * shorthand, otherwise `\"days\"`. */\n view?: ScheduleView\n /** Overrides `ScheduleProps.visibleDays` while this entry is active.\n * Meaningful only for the `\"days\"` renderer; Month, Year and Agenda take no\n * window size. */\n visibleDays?: number\n /** Overrides the `translations`-derived tab label. `ReactNode`, not `string`,\n * so a custom entry can carry an icon or a `<Trans>`-style element. */\n label?: ReactNode\n}\n\nexport type ScheduleViewOption = ScheduleViewShorthand | ScheduleViewOptionObject\n\n/** The `views` array `Schedule` is generic over. `ReadonlyArray`, not `Array`,\n * so an `as const` tuple at the call site is assignable. */\nexport type ScheduleViews = ReadonlyArray<ScheduleViewOption>\n\n/** Reproduces the pre-`views` behaviour exactly, and is `V`'s default type\n * argument β€” see `ScheduleViewId`'s note on why that matters.\n *\n * Deliberately excludes `\"agenda\"`: adding a fourth tab to every schedule\n * that never asked for one is precisely the silent change this list exists\n * to prevent. Opt in with `views`. */\nexport const DEFAULT_SCHEDULE_VIEWS = [\"days\", \"month\", \"year\"] as const satisfies ScheduleViews\nexport type DefaultScheduleViews = typeof DEFAULT_SCHEDULE_VIEWS\n\n/**\n * One entry's id β€” the analogue of `TabsValue<Data>` (`tabs-data.tsx`) and\n * `SelectValue<Data>` (`lib/select-data.ts`), which this whole mechanism is\n * modelled on.\n *\n * **Deliberately distributive β€” do not add the `[T] extends [U]` tuple wrap.**\n * `lib/required-if.ts` documents that idiom as mandatory for *its* shape and\n * that is still true there; this is the opposite shape and the opposite\n * conclusion, so the two rules only look contradictory. There, the type maps a\n * flag onto a *requirement*, and distributing over a `boolean` yields\n * `Required | Partial` β€” a union whose `Partial` half silently accepts a value\n * missing the callback, i.e. it fails **unsafe**. Here the type is a plain\n * projection (union in, union out), and distribution is the only thing that\n * makes a non-literal `ScheduleViewOption[]` collapse to `string`. Tuple-wrap\n * it and both branch checks fail against the union check type, yielding\n * `never` β€” and a `view?: never` prop rejects every value a caller could pass.\n * Verified in both directions against the repo's own tsc.\n */\ntype ScheduleViewIdOf<Option> = Option extends string\n ? Option\n : Option extends { id: infer Id extends string }\n ? Id\n : never\n\nexport type ScheduleViewId<V extends ScheduleViews> = ScheduleViewIdOf<V[number]>\n\n/**\n * Which **renderer** each shorthand expands to β€” the type-level mirror of\n * `SHORTHANDS`' `view` column below. Restated rather than derived from that\n * table because the table is annotated `Record<ScheduleViewShorthand,\n * ResolvedScheduleView>`, which widens every `view` to the full\n * `ScheduleView` union and leaves nothing to read back. `SHORTHANDS` is\n * checked against this map, so adding a seventh shorthand to one without the\n * other is a compile error rather than a silent gap.\n */\ntype ShorthandRenderer = {\n day: \"days\"\n week: \"days\"\n days: \"days\"\n month: \"month\"\n year: \"year\"\n agenda: \"agenda\"\n}\n\n/** Mirrors `resolveScheduleViewOption`'s `base?.view ?? \"days\"` tail.\n *\n * The `[string] extends [Id]` wrap is load-bearing and is *not* the same\n * check as `Id extends ScheduleViewShorthand` below: it asks \"is this id\n * still a widened `string`\", i.e. an id computed at runtime. Such an id\n * could name any shorthand, so it has to answer with every renderer β€” fail\n * **open**. Drop the wrap and it resolves to `\"days\"` instead, which would\n * forbid every Month/Year/Agenda prop on any schedule whose `views` are\n * built dynamically. */\ntype RendererFromId<Id> = [string] extends [Id]\n ? ScheduleView\n : Id extends ScheduleViewShorthand\n ? ShorthandRenderer[Id]\n : \"days\"\n\n/**\n * Normalises an entry to two *always-required* fields before anything is\n * inferred out of it.\n *\n * Necessary because `O extends { view?: infer Vw }` infers `\"month\"`, not\n * `\"month\" | undefined`, from `{ id: \"x\"; view?: \"month\" }` β€” TS drops\n * `undefined` when inferring through an optional target property. That loses\n * the \"the key may be absent, so fall back to the id\" branch entirely, and\n * the type then fails **closed** on exactly the entries that need the\n * fallback most.\n */\ntype NormalizedOption<O> = { [K in \"id\" | \"view\"]: K extends keyof O ? O[K] : undefined }\n\n/**\n * One entry's renderer β€” the renderer-side twin of `ScheduleViewIdOf` above,\n * and a type-level mirror of `resolveScheduleViewOption`'s\n * `option.view ?? base?.view ?? \"days\"` chain, evaluated in that same order.\n *\n * **Deliberately distributive β€” do not add the `[T] extends [U]` tuple\n * wrap.** Same side of that argument as `ScheduleViewIdOf`, and the opposite\n * side from `lib/required-if.ts`; see `ScheduleViewIdOf`'s own note for why\n * the two rules only look contradictory. This is a plain projection (union of\n * entries in, union of renderers out), and distribution is the only thing\n * that resolves a mixed list like `[\"month\", { id: \"fortnight\" }]` at all.\n * Tuple-wrapped, every branch check fails against the union check type and\n * the result is `never` β€” which `ScheduleProps` would read as \"no renderer\n * configured\" and use to strip every renderer-scoped prop off the component.\n * It still answers correctly for a uniform all-shorthand tuple, so a test\n * suite that only covers `[\"days\",\"month\",\"year\"]` would not catch it.\n */\ntype RendererOfOption<O> = O extends ScheduleViewShorthand\n ? ShorthandRenderer[O]\n : NormalizedOption<O> extends { id: infer Id; view: infer Vw }\n ? Extract<Vw, ScheduleView> | (undefined extends Vw ? RendererFromId<Id> : never)\n : never\n\n/**\n * Every renderer a `views` array can put on screen β€” what `ScheduleProps`\n * gates each of its slices on.\n *\n * `views={[]}` answers `\"days\"` rather than `never`, mirroring the runtime's\n * own `FALLBACK_VIEW` (`schedule.tsx`). Without that guard an empty tuple's\n * `V[number]` is `never`, every gate closes, and a caller who already has a\n * `devWarn` telling them the list is empty would additionally be told that\n * every prop they passed does not exist.\n */\nexport type ScheduleRenderers<V extends ScheduleViews> = [V[number]] extends [never]\n ? \"days\"\n : RendererOfOption<V[number]>\n\n/** A fully-defaulted entry. `label` stays optional β€” `scheduleViewLabel`\n * resolves it against `translations`, which this module has no business\n * reaching into. */\nexport type ResolvedScheduleView = {\n id: string\n view: ScheduleView\n /** `undefined` means \"inherit `ScheduleProps.visibleDays`\". */\n visibleDays?: number\n label?: ReactNode\n}\n\n/**\n * The six shorthands, expanded.\n *\n * Note `\"days\"` pins **no** `visibleDays` while `\"day\"` and `\"week\"` do. That\n * asymmetry is the single most load-bearing detail in this file: it is what\n * keeps `<Schedule visibleDays={5} />` behaving exactly as it did before\n * `views` existed, since the default entry list is `[\"days\", \"month\", \"year\"]`\n * and `\"days\"` therefore keeps deferring to the consumer's own prop. Pin a\n * number here and every existing caller's `visibleDays` would be silently\n * overridden.\n */\nconst SHORTHANDS: {\n [K in ScheduleViewShorthand]: ResolvedScheduleView & { view: ShorthandRenderer[K] }\n} = {\n day: { id: \"day\", view: \"days\", visibleDays: 1 },\n week: { id: \"week\", view: \"days\", visibleDays: 7 },\n days: { id: \"days\", view: \"days\" },\n month: { id: \"month\", view: \"month\" },\n year: { id: \"year\", view: \"year\" },\n // Pins no `visibleDays` for the opposite reason `\"days\"` doesn't: not\n // \"inherit the consumer's window\" but \"there is no day window at all\" β€”\n // the agenda is month-scoped, exactly like `month` and `year`.\n agenda: { id: \"agenda\", view: \"agenda\" },\n}\n\n/** Narrows a free-form `id` to a shorthand key. Needed because\n * `noUncheckedIndexedAccess` is on, so indexing `SHORTHANDS` with a bare\n * `string` doesn't typecheck β€” and it keeps the record exhaustive, so adding a\n * shorthand is a compile error until it's listed above. */\nconst isShorthand = (id: string): id is ScheduleViewShorthand => id in SHORTHANDS\n\n/**\n * Expands one entry to its full shape.\n *\n * `{ id: \"day\" }` is exactly equivalent to `\"day\"` β€” the object form inherits\n * `view` *and* `visibleDays` from the shorthand table, so there is one mental\n * model (`{ ...shorthand, ...explicit }`) rather than two. `{ id: \"day\",\n * visibleDays: 2 }` is still an ordinary override of that inherited default.\n *\n * Idempotent: re-resolving a `ResolvedScheduleView` returns an equivalent\n * value, which is what lets `Root` hand its already-resolved array straight to\n * `ViewSwitcher` instead of threading the raw one alongside it.\n */\nexport function resolveScheduleViewOption(option: ScheduleViewOption): ResolvedScheduleView {\n if (typeof option === \"string\") return SHORTHANDS[option]\n const base = isShorthand(option.id) ? SHORTHANDS[option.id] : undefined\n return {\n id: option.id,\n view: option.view ?? base?.view ?? \"days\",\n visibleDays: option.visibleDays ?? base?.visibleDays,\n label: option.label,\n }\n}\n\n/** Not memoized, deliberately: this is a `map` over 3-5 entries, the same cost\n * class as `resolveScheduleTranslations(translations)` which `Root` already\n * calls unmemoized on every render. */\nexport function resolveScheduleViews(\n views: ScheduleViews = DEFAULT_SCHEDULE_VIEWS,\n): ResolvedScheduleView[] {\n return views.map(resolveScheduleViewOption)\n}\n\nexport function findScheduleView(\n views: ResolvedScheduleView[],\n id: string | undefined,\n): ResolvedScheduleView | undefined {\n return id === undefined ? undefined : views.find((v) => v.id === id)\n}\n\n/**\n * The first entry drawn by a given renderer β€” the drill-down's target lookup.\n *\n * Drill-down is specified in terms of renderers (\"a day click lands in the\n * days grid\"), but it has to *set* an id, and with a configurable `views` the\n * two are no longer the same string. Returns `undefined` when the configured\n * entries offer no such renderer at all, which is a real configuration (e.g.\n * `views={[\"month\", \"year\"]}`) and is why callers must handle the miss rather\n * than assume a target exists.\n */\nexport function findScheduleViewByRenderer(\n views: ResolvedScheduleView[],\n view: ScheduleView,\n): ResolvedScheduleView | undefined {\n return views.find((v) => v.view === view)\n}\n\n/** Ties each shorthand to its translations key. `satisfies` keeps it exhaustive\n * and keyed against real `ScheduleTranslations` fields, so a typo or a missing\n * key is a compile error rather than an `undefined` label at runtime. */\nconst LABEL_KEYS = {\n day: \"day\",\n week: \"week\",\n days: \"days\",\n month: \"month\",\n year: \"year\",\n agenda: \"agenda\",\n} as const satisfies Record<ScheduleViewShorthand, keyof ScheduleTranslations>\n\n/** Label precedence: an explicit `label`, then the translation for a shorthand\n * id, then the raw `id`. The last is a deliberate fallback rather than a\n * warning β€” a custom entry's id is the only thing the kit knows about it, and\n * rendering it is more useful than rendering nothing. */\nexport function scheduleViewLabel(\n view: ResolvedScheduleView,\n t: Required<ScheduleTranslations>,\n): ReactNode {\n if (view.label !== undefined) return view.label\n return isShorthand(view.id) ? t[LABEL_KEYS[view.id]] : view.id\n}\n","\"use client\"\n\nimport { ark, type HTMLArkProps } from \"@ark-ui/react\"\nimport { getLocalTimeZone } from \"@internationalized/date\"\nimport { ChevronLeftIcon, ChevronRightIcon } from \"lucide-react\"\nimport { cn } from \"../../lib/cn\"\nimport { props } from \"../../lib/props\"\nimport type { Size } from \"../../lib/sizes\"\nimport type { WithTestId } from \"../../lib/test-id\"\nimport { ActionIcon } from \"../action-icon/action-icon\"\nimport { Button } from \"../button/button\"\nimport type { TabsRootProps } from \"../tabs/tabs\"\nimport { Tabs } from \"../tabs/tabs-data\"\nimport { formatScheduleTitle, paginateDate } from \"./schedule-dates\"\nimport type { ScheduleAlign, ScheduleTranslations, ScheduleView } from \"./schedule-types\"\nimport { resolveScheduleTranslations } from \"./schedule-types\"\nimport type { DefaultScheduleViews, ScheduleViewId, ScheduleViews } from \"./schedule-views\"\nimport { resolveScheduleViews, scheduleViewLabel } from \"./schedule-views\"\n\n/**\n * RFC Β§14 (`docs/rfcs/schedule.md`) β€” `Schedule.Toolbar` is a dumb flex shell\n * (mirrors `Table.Toolbar`'s own border/padding recipe) plus five fully\n * prop-driven parts. No shared context between them β€” Schedule never uses\n * context for props (RFC Β§3) β€” so each part takes exactly the state it needs\n * directly, the same explicit-prop shape `DataTable`'s own toolbar pieces\n * (`DataTableGlobalFilter`, `DataTableColumnVisibilityMenu`) use inside\n * `Table.Toolbar`. `Schedule` (the root) composes these five parts for its\n * own default chrome; nothing stops importing them individually to build a\n * fully custom toolbar around a standalone view.\n */\n\nexport type ScheduleToolbarProps = HTMLArkProps<\"div\"> & WithTestId\n\nconst ScheduleToolbarRoot = ({ className, testId, ...rest }: ScheduleToolbarProps) => (\n <ark.div\n data-schedule-part=\"toolbar\"\n className={cn(\n \"flex shrink-0 flex-wrap items-center justify-between gap-2 bg-white/4\",\n \"border-b border-brand-900/20 px-3 py-3 dark:border-white/15\",\n className,\n )}\n {...props({ \"data-testid\": testId })}\n {...rest}\n />\n)\n\ntype PaginationTriggerProps = WithTestId & {\n view: ScheduleView\n date: Date\n onDateChange?: (date: Date) => void\n timeZone?: string\n translations?: ScheduleTranslations\n size?: Size\n className?: string\n /** `\"days\"` view's window size, in days β€” forwarded to `paginateDate` so\n * Prev/Next step by the same window the grid is actually showing. */\n visibleDays?: number\n}\n\nconst ScheduleToolbarPrevTrigger = ({\n view,\n date,\n onDateChange,\n timeZone = getLocalTimeZone(),\n translations,\n size = \"sm\",\n className,\n testId,\n visibleDays,\n}: PaginationTriggerProps) => {\n const t = resolveScheduleTranslations(translations)\n return (\n <ActionIcon\n variant=\"subtle\"\n color=\"neutral\"\n size={size}\n aria-label={t.previous}\n onClick={() => onDateChange?.(paginateDate(view, date, -1, { timeZone, visibleDays }))}\n className={className}\n testId={testId}\n >\n <ChevronLeftIcon />\n </ActionIcon>\n )\n}\n\nconst ScheduleToolbarNextTrigger = ({\n view,\n date,\n onDateChange,\n timeZone = getLocalTimeZone(),\n translations,\n size = \"sm\",\n className,\n testId,\n visibleDays,\n}: PaginationTriggerProps) => {\n const t = resolveScheduleTranslations(translations)\n return (\n <ActionIcon\n variant=\"subtle\"\n color=\"neutral\"\n size={size}\n aria-label={t.next}\n onClick={() => onDateChange?.(paginateDate(view, date, 1, { timeZone, visibleDays }))}\n className={className}\n testId={testId}\n >\n <ChevronRightIcon />\n </ActionIcon>\n )\n}\n\nexport type ScheduleToolbarNowTriggerProps = WithTestId & {\n onDateChange?: (date: Date) => void\n /** Override for tests β€” mirrors the views' own `now` prop. */\n now?: Date\n translations?: ScheduleTranslations\n size?: Size\n className?: string\n}\n\n/** Now never re-centers (RFC Β§14) β€” it just hands the current instant back\n * to `onDateChange`; each view's own `getVisibleRange` snaps that to its\n * natural boundary. Callers that also hold a grid ref and a now-marker ref\n * (`DaysView`, `Root`) wrap this same `onDateChange` to additionally\n * scroll the timed grid to the now-line (`scrollElementToCenter`,\n * `schedule-geometry.ts`) β€” this component itself stays pagination-only,\n * with no grid/scroll awareness of its own. */\nconst ScheduleToolbarNowTrigger = ({\n onDateChange,\n now,\n translations,\n size = \"sm\",\n className,\n testId,\n}: ScheduleToolbarNowTriggerProps) => {\n const t = resolveScheduleTranslations(translations)\n return (\n <Button\n variant=\"subtle\"\n color=\"neutral\"\n size={size}\n onClick={() => onDateChange?.(now ?? new Date())}\n className={className}\n testId={testId}\n >\n {t.now}\n </Button>\n )\n}\n\nexport type ScheduleToolbarTitleProps = HTMLArkProps<\"h2\"> &\n WithTestId & {\n view: ScheduleView\n date: Date\n timeZone?: string\n locale?: string\n /** `\"days\"` view's window alignment β€” forwarded to `formatScheduleTitle`.\n * Named `align`, not `startOfWeek`, matching `DaysViewProps`/\n * `ScheduleProps` (this is fed by `Root`'s own `align`, whichever view\n * is active β€” `formatScheduleTitle` only actually consults it for\n * `\"days\"`). */\n align?: ScheduleAlign\n /** `\"days\"` view's window size, in days β€” forwarded to `formatScheduleTitle`. */\n visibleDays?: number\n }\n\nconst ScheduleToolbarTitle = ({\n view,\n date,\n timeZone = getLocalTimeZone(),\n locale,\n align,\n visibleDays,\n className,\n testId,\n ...rest\n}: ScheduleToolbarTitleProps) => (\n <ark.h2\n data-schedule-part=\"toolbar-title\"\n className={cn(\"truncate font-semibold text-sm\", className)}\n {...props({ \"data-testid\": testId })}\n {...rest}\n >\n {formatScheduleTitle(view, date, { timeZone, locale, startOfWeek: align, visibleDays })}\n </ark.h2>\n)\n\nexport type ScheduleToolbarViewSwitcherProps<V extends ScheduleViews = DefaultScheduleViews> =\n WithTestId & {\n view: ScheduleViewId<V>\n onViewChange?: (view: ScheduleViewId<V>) => void\n /** Which entries to offer, in order. Default `[\"days\", \"month\", \"year\"]`.\n * Accepts the `\"day\"`/`\"week\"` shorthands and full `{ id, view,\n * visibleDays, label }` objects β€” see `schedule-views.ts`. */\n views?: V\n translations?: ScheduleTranslations\n size?: Size\n className?: string\n }\n\n/**\n * Built on `Tabs`' composable parts (`Root`/`List`/`Indicator`/`Trigger`),\n * deliberately never `Tabs.Content` β€” `Schedule` (the root) is what actually\n * switches the rendered view, so a mounted content panel here would just be\n * empty, dangling DOM. Ark's own `data-part=\"trigger\"` / `data-value`\n * selectors (see `/docs/testing`) already cover this without a bespoke\n * `testId` prop.\n *\n * Generic over `views` the same way `Tabs` itself is generic over `data`\n * (`tabs-data.tsx`), so `onViewChange` reports the caller's own id union\n * rather than a widened `string`. `const` on the parameter is what preserves\n * literal types through an inline object entry.\n *\n * A trigger's `value` is the entry's **id**, not its renderer β€” the two differ\n * as soon as one schedule offers two days-windows (`\"day\"` and `\"week\"` both\n * render `days`). Under the default entries they coincide, so Ark's\n * `data-value` selectors are unchanged for anyone not using the new prop.\n *\n * Renders whatever it is given, including a single entry. Whether a one-tab\n * switcher is worth showing is a layout question β€” `Schedule` answers it for\n * its own chrome by not composing this part at all β€” and not one a leaf should\n * decide by returning `null` from under its caller.\n */\nconst ScheduleToolbarViewSwitcher = <const V extends ScheduleViews = DefaultScheduleViews>({\n view,\n onViewChange,\n views,\n translations,\n size = \"sm\",\n className,\n testId,\n}: ScheduleToolbarViewSwitcherProps<V>) => {\n const t = resolveScheduleTranslations(translations)\n const resolved = resolveScheduleViews(views)\n return (\n <Tabs.Root\n value={view}\n onValueChange={(details: Parameters<NonNullable<TabsRootProps[\"onValueChange\"]>>[0]) =>\n onViewChange?.(details.value as ScheduleViewId<V>)\n }\n className={className}\n testId={testId}\n >\n <Tabs.List size={size}>\n <Tabs.Indicator />\n {resolved.map((entry) => (\n <Tabs.Trigger key={entry.id} value={entry.id}>\n {scheduleViewLabel(entry, t)}\n </Tabs.Trigger>\n ))}\n </Tabs.List>\n </Tabs.Root>\n )\n}\n\nexport const ScheduleToolbar = Object.assign(ScheduleToolbarRoot, {\n PrevTrigger: ScheduleToolbarPrevTrigger,\n NextTrigger: ScheduleToolbarNextTrigger,\n NowTrigger: ScheduleToolbarNowTrigger,\n Title: ScheduleToolbarTitle,\n ViewSwitcher: ScheduleToolbarViewSwitcher,\n})\n","\"use client\"\n\nimport { ark, type HTMLArkProps } from \"@ark-ui/react\"\nimport { getLocalTimeZone } from \"@internationalized/date\"\nimport { useRef } from \"react\"\nimport { cn } from \"../../lib/cn\"\nimport { OverlayContainerProvider } from \"../../lib/overlay-container\"\nimport { props as dataProps } from \"../../lib/props\"\nimport type { WithTestId } from \"../../lib/test-id\"\nimport { useNow } from \"../../lib/use-now\"\nimport { useUncontrolled } from \"../../lib/use-uncontrolled\"\nimport type { AgendaEventRenderer } from \"./schedule-agenda-list\"\nimport { ScheduleAgendaList } from \"./schedule-agenda-list\"\nimport { getVisibleRange, rangesOverlap } from \"./schedule-dates\"\nimport { groupUpcomingEvents } from \"./schedule-next-up-grouping\"\nimport { ScheduleToolbar } from \"./schedule-toolbar\"\nimport type {\n AnchorDateProps,\n PaginationChromeProps,\n ScheduleEmptyProps,\n ScheduleEventProps,\n ScheduleSharedProps,\n} from \"./schedule-types\"\nimport { resolveScheduleTranslations } from \"./schedule-types\"\nimport { useScheduleSelection } from \"./use-schedule-selection\"\n\n/**\n * The agenda: one calendar month of events as a chronological list, and the\n * fourth toolbar-switchable renderer (`views={[\"week\", \"agenda\", \"month\"]}`).\n *\n * It renders the same list as `Schedule.NextUp` (`schedule-agenda-list.tsx`),\n * over a different window β€” a month anchored on the schedule's own date,\n * rather than everything from now on. That is what makes the toolbar's\n * Prev/Next/Title meaningful here at all: they step and label a month,\n * exactly as they do in Month view, which is why `paginateDate` and\n * `formatScheduleTitle` fold `\"agenda\"` into their `\"month\"` pattern rather\n * than growing a branch.\n *\n * `getVisibleRange(\"agenda\", …)` is the one that can't be shared β€” it is the\n * strict calendar month where Month's is the padded six-week grid. See its\n * own comment; the short version is that a list has no adjacent-month cells\n * to justify padding, and `Root`'s reveal would otherwise be told an event\n * the list never renders is already visible.\n *\n * Unlike Month and Year this holds a live clock (`useNow`): its day headings\n * say \"Today\"/\"Tomorrow\", which is the one thing on screen that goes stale\n * while nobody touches it.\n *\n * No `onDayClick`: an agenda has no day cells and no day headers to click β€”\n * only a divider labelling a group β€” so there is no surface for it, and a\n * drill-down from a list of events into the day of one of them is what\n * selecting the event already does.\n */\n// No `ScheduleDayClickProps`: an agenda has no day cells and no day headers to\n// click β€” only a divider labelling a group β€” so there is no surface for\n// `onDayClick`, and a drill-down from a list of events into the day of one of\n// them is what selecting the event already does. It used to say this by\n// `Omit`ing that one name off the shared slice.\nexport type AgendaViewProps<P = unknown> = ScheduleSharedProps<P> &\n ScheduleEventProps<P> &\n ScheduleEmptyProps &\n AnchorDateProps &\n PaginationChromeProps &\n // `ScheduleEventProps` contributes `onSelect`, and React's own DOM props\n // carry an `onSelect` (text-selection) of their own β€” the same `Omit`\n // `ScheduleProps` and `MonthViewProps` already need for the same reason.\n Omit<HTMLArkProps<\"div\">, \"onSelect\"> &\n WithTestId &\n ScheduleAgendaOnlyProps<P>\n\n/** Agenda only. Named so `ScheduleProps` can gate it by name rather than\n * `Pick`ing the key out of `AgendaViewProps` β€” the hand-maintained shape that\n * left `maxEventsPerDay` unreachable from `Root` for two releases. */\nexport type ScheduleAgendaOnlyProps<P = unknown> = {\n /**\n * Overrides one event's row content. **Supplying this makes the row a\n * plain element instead of a `<button>`**, and `withEventDetails`\n * inert with it: an override is free to render its own buttons and\n * links, and interactive content inside a button is invalid HTML.\n * Selection is then yours to wire from inside the override β€” the row\n * still carries `data-selected` so it can at least be styled.\n */\n renderEvent?: AgendaEventRenderer<P>\n}\n\nexport function AgendaView<P = unknown>({\n data,\n staticEvents = [],\n selected,\n defaultSelected,\n onSelect,\n withSelection = true,\n withEventDetails = true,\n renderEventDetails,\n locale,\n timeZone = getLocalTimeZone(),\n translations,\n classNames,\n className,\n date,\n defaultDate,\n onDateChange,\n withPagination = true,\n withNowButton = false,\n now,\n empty,\n renderEvent,\n testId,\n ...rest\n}: AgendaViewProps<P>) {\n const [currentDate, setCurrentDate] = useUncontrolled<Date>({\n value: date,\n defaultValue: defaultDate,\n finalValue: now ?? new Date(),\n onChange: onDateChange,\n })\n const { selected: selectedIds, onEventSelect } = useScheduleSelection<P>({\n selected,\n defaultSelected,\n onSelect,\n withSelection,\n })\n const t = resolveScheduleTranslations(translations)\n const current = useNow(now)\n const range = getVisibleRange(\"agenda\", currentDate, { timeZone, locale: locale ?? \"en-US\" })\n // `rangesOverlap` against the very range `isEventInVisibleRange` asks about\n // β€” not `filterUpcomingEvents`, whose open-ended lower bound is NextUp's\n // alone. The two being the same predicate over the same range is what makes\n // `Root`'s reveal correct here by construction rather than by coincidence:\n // an event this list doesn't render is an event `Root` will page to.\n //\n // A multi-day event that started last month is listed once, under its own\n // real start date β€” which can head a group dated outside the titled month.\n // Clamping it to the window would invent a start it doesn't have, and\n // disagree with the range its own details popover prints.\n const groups = groupUpcomingEvents(\n [...data, ...staticEvents].filter((event) => rangesOverlap(event, range)),\n timeZone,\n )\n // The list is the agenda's scroller, and its rows' popovers portal *into* it\n // (see `OverlayContainerProvider`), the same as the Days and Month grids.\n const scrollerRef = useRef<HTMLDivElement>(null)\n\n return (\n <ark.div\n className={cn(\"flex h-full flex-col\", className)}\n data-schedule-part=\"agenda-view\"\n {...dataProps({ \"data-testid\": testId })}\n {...rest}\n >\n {withPagination || withNowButton ? (\n <div className=\"mb-2 flex items-center gap-1\">\n {withPagination ? (\n <>\n <ScheduleToolbar.PrevTrigger\n view=\"agenda\"\n date={currentDate}\n onDateChange={setCurrentDate}\n timeZone={timeZone}\n translations={t}\n />\n <ScheduleToolbar.NextTrigger\n view=\"agenda\"\n date={currentDate}\n onDateChange={setCurrentDate}\n timeZone={timeZone}\n translations={t}\n />\n </>\n ) : null}\n {withNowButton ? (\n <ScheduleToolbar.NowTrigger\n onDateChange={setCurrentDate}\n now={now}\n translations={t}\n className=\"ms-2\"\n />\n ) : null}\n </div>\n ) : null}\n <div\n ref={scrollerRef}\n // `relative`: the containing block for the popovers portalled in here.\n className={cn(\"relative min-h-0 flex-1 overflow-y-auto p-4\", classNames?.grid)}\n >\n <OverlayContainerProvider value={scrollerRef}>\n <ScheduleAgendaList\n groups={groups}\n now={current}\n locale={locale}\n timeZone={timeZone}\n translations={t}\n empty={empty}\n // Deliberately no `nextEventId`: \"the soonest one still to come\" is\n // a from-now idea, and a month window anchored on last March has no\n // such event. Every row gets `isNext: false` here.\n renderEvent={renderEvent}\n onEventSelect={onEventSelect}\n selected={selectedIds}\n withEventDetails={withEventDetails}\n renderEventDetails={renderEventDetails}\n detailsPopoverClassName={classNames?.eventDetailsPopover}\n classNames={classNames?.agenda}\n />\n </OverlayContainerProvider>\n </div>\n </ark.div>\n )\n}\n","import { devWarn } from \"../../lib/dev-warn\"\nimport type { ScheduleLayoutResult } from \"./schedule-layout\"\nimport type { ScheduleSlotDuration } from \"./schedule-types\"\n\n/**\n * RFC Β§5 (`docs/rfcs/schedule.md`) geometry β€” pure minutes↔pixels/percent\n * helpers plus the DOM-measurement helper the interaction hooks use to\n * derive `pxPerMinute` from the day-column's own real rendered height\n * (see `resolvePxPerMinute`'s own comment β€” corrected after v1 shipped, RFC\n * Β§18).\n */\n\n/** Minutes since local midnight, including fractional seconds. */\nexport function minutesFromMidnight(date: Date): number {\n return date.getHours() * 60 + date.getMinutes() + date.getSeconds() / 60\n}\n\nexport function minutesToPixels(minutes: number, pxPerMinute: number): number {\n return minutes * pxPerMinute\n}\n\n/** Minutes as a percentage (0–100, not clamped β€” callers that need clamping,\n * e.g. `nowIndicatorTop`, do it themselves) of a total window β€” the\n * render-time replacement for `minutesToPixels`'s job wherever the\n * day-column's own rendered height is no longer a fixed function of a known\n * `hourHeight` (it's now only a `min-height` floor CSS can stretch past β€”\n * see `schedule-timed-grid.tsx`). Pure ratio math, no DOM access, fully\n * SSR-safe: a chip/overlay/now-line positioned this way naturally tracks\n * whatever height the day-column ends up rendering at, no re-measurement\n * ever needed. */\nexport function minutesToPercent(minutes: number, totalWindowMinutes: number): number {\n return totalWindowMinutes === 0 ? 0 : (minutes / totalWindowMinutes) * 100\n}\n\nexport function pixelsToMinutes(pixels: number, pxPerMinute: number): number {\n return pxPerMinute === 0 ? 0 : pixels / pxPerMinute\n}\n\n/** Inverse of `minutesFromMidnight` β€” the instant on `day`'s calendar date at\n * `minutes` past midnight, host-local.\n *\n * Host-local is now the *unusual* choice here rather than the house idiom it\n * once was: `disabledHourRuns`, which this comment used to point at for\n * company, builds its instants through `dayBoundary` in the schedule's own\n * `timeZone`, and `use-event-create.ts` no longer routes through this at all.\n * What remains host-local by deliberate decision is the now-line's position\n * (`nowIndicatorTop` below, via `minutesFromMidnight`) and the hour-axis\n * gutter's labels β€” see `clockTimeLabel`'s note in `schedule-dates.ts` for\n * why those two stay that way. This helper is only reachable from its own\n * test today; anything new that needs a day-relative instant should take a\n * `timeZone` and use `dayBoundary` instead. */\nexport function dateAtMinutes(day: Date, minutes: number): Date {\n const base = new Date(day)\n base.setHours(0, 0, 0, 0)\n return new Date(base.getTime() + minutes * 60_000)\n}\n\n/** Smallest a single `slotDuration` increment is allowed to render as, in\n * px, when deriving a default `--sch-hour-height` β€” see `defaultHourHeight`\n * below. Chosen so `defaultHourHeight(15) === 48` exactly (60/15 = 4 slots\n * Γ— 12px = 48px), reproducing `schedule-timed-grid.tsx`'s old hardcoded\n * `DEFAULT_HOUR_HEIGHT_PX` at the default `slotDuration` bit-for-bit β€” the\n * slot-scaling this function adds is invisible to any existing consumer\n * unless they set a non-default `slotDuration`. */\nconst MIN_SLOT_PX = 12\n/** Floor on the derived default itself β€” keeps a coarse `slotDuration`\n * (`30`, `60`) from shrinking the grid down to an illegibly short hour row.\n * There is no matching ceiling: the finest slot is `15`, which lands\n * exactly on the 48px default. */\nconst MIN_HOUR_HEIGHT_PX = 28\n\n/**\n * Default `--sch-hour-height` (px), scaled by `slotDuration` so a finer slot\n * spacing gets a taller default hour β€” more px per slot keeps each slot's\n * row a legible, roughly-constant height regardless of how many slots make\n * up an hour, floored so a coarse slot stays legible. An explicit\n * `hourHeight` prop (`ScheduleTimedProps.hourHeight`) always overrides this.\n */\nexport function defaultHourHeight(slotDuration: ScheduleSlotDuration): number {\n return Math.max(MIN_HOUR_HEIGHT_PX, (60 / slotDuration) * MIN_SLOT_PX)\n}\n\n/** A chip's minimum painted height, in px: one line of content plus the\n * border, `calc(1rem + 2px)` in `schedule-event-chip.tsx`'s `chipShell` and\n * `schedule-overflow-chip.tsx` (the kit assumes a 16px root). Keep the three\n * in step β€” the layout packs against this number. */\nexport const CHIP_FLOOR_PX = 18\n\n/**\n * How much time one floored chip covers on a grid whose hour row is\n * `hourHeight` px β€” the minimum duration `layoutEventColumnsCapped` packs each\n * event as, so chips that would paint over each other get their own columns.\n * `hourHeight` is the row's *floor* (the column can only stretch taller), so\n * this is an upper bound: a stretched column over-reserves slightly, but two\n * floored chips can never collide. No DOM read, so it's identical on the\n * server and the client.\n */\nexport function visualFloorMs(hourHeight: number): number {\n return (CHIP_FLOOR_PX / hourHeight) * 3_600_000\n}\n\n/** Above this, a cascade's own base z-index is capped rather than left to\n * grow unbounded with `column` β€” a consumer-configured `maxOverlapColumns`\n * in the teens would otherwise let a deep, uninteracted column outrank the\n * hover/focus/resizing \"bring to front\" promotion (`z-20`,\n * `schedule-event-chip.tsx`'s `chipShell`), undoing that reachability fix.\n * Still comfortably under it either way, and further under the gutter/\n * header's `z-30`/`z-40`. */\nconst MAX_CASCADE_Z_INDEX = 15\n\n/** `layoutEventColumns`'s `column`/`columnCount` as cascading insets.\n * `columnSpan` (still present on `ScheduleLayoutResult` for\n * `schedule-layout.ts`'s own column-*assignment* purposes) is deliberately\n * NOT consumed here β€” `width` below is a function of `column`/`columnCount`\n * alone, not of how many columns a widen-eligible event could occupy.\n *\n * **Every column's width is `var(--sch-column-fraction, 0.7)` of whatever\n * space remains after that column's own `left`, not a flat fraction of the\n * whole row and not anchored to any fixed right edge β€” except the\n * cluster's *last* column (`column === columnCount - 1`), which takes the\n * *entire* remainder.** `left` shifts further left by\n * `column * var(--sch-column-overlap)` (a custom property, declared\n * alongside `--sch-column-gap` in `schedule-timed-grid.tsx`) for every\n * column beyond the first, same as before β€” but `width` is now always\n * `(100% - left) * fraction` for every non-last column (deliberate,\n * permanent, not a hover/focus-triggered \"reveal\" β€” earlier iterations\n * tried that, see the dated note below for why it was dropped): every\n * overlapping event that has something stacked *after* it leaves roughly\n * 30% of its own remaining space unclaimed, so that later, more-\n * overlapping card always has real room to intrude into and read as \"the\n * front of a stack,\" rather than each column claiming its flat share\n * edge-to-edge. The *last* column has nothing stacked after it β€” there's\n * nothing left to hold room open for β€” so it takes all of `100% - left`\n * instead, the same \"reach the row's own right edge\" rule the cascade\n * always used pre-fraction. A solo, non-overlapping event\n * (`columnCount === 1`) is column `0` *and* the last column at once, so it\n * renders at the full `100%` it always has β€” the fraction only ever\n * narrows an event that's making room for something stacked in front of\n * it. `ScheduleOverflowChip` (`schedule-timed-grid.tsx`) always calls this\n * with `column: maxOverlapColumns, columnCount: maxOverlapColumns + 1` β€”\n * i.e. always the last column β€” so the \"+N\" indicator gets the same\n * full-remainder treatment as any other frontmost card, no special-casing\n * needed.\n *\n * *(Dated note β€” two earlier iterations of this formula, both replaced,\n * not layered on top of what's below: a first pass made every column's\n * `width` reach the row's own right edge unconditionally at rest, relying\n * on the chip shell's `hover:z-20 focus-within:z-20` (still present, see\n * `schedule-event-chip.tsx`) to bring a covered chip's already-wide box to\n * the front on hover β€” but `hover:` is a flat z-index override regardless\n * of the hovered chip's own natural rank, so hovering a lower-column chip\n * could promote it above a naturally-higher-column sibling and swallow it\n * with no escape route, since the pointer was already inside the\n * now-topmost hovered chip's footprint. A second pass split `width` (a\n * narrow, `:hover`-safe rest size) from a separate, wider `revealWidth`\n * gated to `:focus-within` only β€” fixing the swallow bug, but reintroducing\n * confusion of its own (a deeply-cascaded column's rest width, anchored to\n * a fixed right edge, could already reach further than a 70%-of-remaining\n * reveal would add, so focusing it visibly did nothing). The single,\n * always-on formula below is simpler than either: one width, no\n * interaction-dependent state, provably consistent for every column.)*\n *\n * `zIndex` still climbs with `column`, capped at `MAX_CASCADE_Z_INDEX`, and\n * the chip shell's `hover:z-20 focus-within:z-20 data-[resizing-edge]:z-20`\n * promotion is untouched β€” bringing the interacted-with (or resizing)\n * chip to the front is still useful on its own (resize-handle\n * reachability; letting a user see whichever card they're pointed at\n * unobstructed), it just no longer resizes anything while doing it.\n * Setting `--sch-column-fraction: 1` restores full-width, edge-to-edge\n * columns (the very first, pre-cascade layout) with no code change. */\nexport function columnInsets({ column, columnCount }: ScheduleLayoutResult): {\n left: string\n width: string\n zIndex: number\n} {\n const isLastColumn = column === columnCount - 1\n if (column === 0) {\n const width = isLastColumn\n ? \"calc(100% - var(--sch-column-gap, 0px))\"\n : \"calc(100% * var(--sch-column-fraction, 0.7) - var(--sch-column-gap, 0px))\"\n return { left: \"0%\", width, zIndex: 1 }\n }\n const leftPercent = (column / columnCount) * 100\n const overlap = `${column} * var(--sch-column-overlap, 0px)`\n const remaining = `${100 - leftPercent}% + ${overlap}`\n const width = isLastColumn\n ? `calc(${remaining} - var(--sch-column-gap, 0px))`\n : `calc((${remaining}) * var(--sch-column-fraction, 0.7) - var(--sch-column-gap, 0px))`\n return {\n left: `calc(${leftPercent}% - ${overlap})`,\n width,\n zIndex: Math.min(column + 1, MAX_CASCADE_Z_INDEX),\n }\n}\n\n/**\n * Resolves a px-per-minute rate by measuring the day-column's *real*\n * rendered height (`getBoundingClientRect()`), divided by the window's total\n * minutes (`--sch-window-minutes` β€” a bare unitless number written by\n * `schedule-timed-grid.tsx`), rather than a fixed `hourHeight`-derived\n * number. **Correction after v1 shipped (RFC Β§18's \"geometry contract\"):**\n * the day-column's rendered height used to always exactly equal\n * `hourHeight * totalHours`, so probing `--sch-hour-height` on a throwaway\n * element was equivalent to (and cheaper than) measuring the real column β€”\n * that stopped being true once the column's height became a `min-height`\n * floor CSS can stretch past, so this now measures the actual rendered box\n * instead, which is the fix, not a violation, of that documented risk.\n * Call sites measure once at gesture-start and cache the result for that\n * gesture's whole duration (unaffected by a resize mid-gesture, same as\n * before this change). Accepts an optional pre-computed `rect` so a caller\n * that already measured the element for another reason\n * (`use-event-create.ts`'s `rect.top`) isn't forced to measure twice.\n */\nexport function resolvePxPerMinute(dayColumnEl: Element, rect?: DOMRect): number {\n const totalMinutes = Number(\n getComputedStyle(dayColumnEl).getPropertyValue(\"--sch-window-minutes\"),\n )\n if (!(totalMinutes > 0)) {\n devWarn(\n \"Schedule: --sch-window-minutes missing or non-positive on the day-column β€” drag/resize/create geometry will be wrong.\",\n )\n return 0\n }\n return (rect ?? dayColumnEl.getBoundingClientRect()).height / totalMinutes\n}\n\n/**\n * Whether `now` falls inside the window a day-column actually paints. The\n * now-cursor's own visibility gate: `now-cursor-line.tsx` renders nothing at\n * all β€” line, dot, clock label, and the gutter's own current-hour\n * decluttering alike β€” for an instant this returns `false` for.\n *\n * `endHour` exclusive, matching every other hour-window boundary in this\n * component (`rangesOverlap`, `disableOutsideHours`): `now` exactly at\n * `startHour:00` is inside, `now` exactly at `endHour:00` is already out.\n *\n * Deliberately reads the same host-local `minutesFromMidnight` the position\n * below is built from, never a `timeZone`-aware one β€” see `clockTimeLabel`'s\n * own note in `schedule-dates.ts` and RFC Β§14. That's not an oversight to\n * fix later: it's what keeps the gate and the position from ever disagreeing\n * about which instant \"now\" is, which is the whole point of having the gate.\n */\nexport function isNowInBand(now: Date, startHour: number, endHour: number): boolean {\n const minutes = minutesFromMidnight(now)\n return minutes >= startHour * 60 && minutes < endHour * 60\n}\n\n/**\n * The now-line's own `top`, as a percentage (0–100) of the day-column's own\n * total height β€” `now-cursor-line.tsx`'s rendered position for both the line\n * and its label.\n *\n * The `[0, 100]` clamp is a backstop only. It used to be the *whole* answer\n * for an out-of-window `now`, which is exactly the bug `isNowInBand` above\n * fixes: pinning the line to an edge doesn't hide it, it relocates it, so the\n * cursor went on asserting \"now is here\" while pointing at `endHour`. Every\n * call site gates on `isNowInBand` first now, so no in-window `now` ever\n * reaches the clamp β€” it stays purely so a direct caller can't produce a\n * position outside the column.\n */\nexport function nowIndicatorTop(now: Date, startHour: number, endHour: number): number {\n const totalWindowMinutes = (endHour - startHour) * 60\n const rawPercent = minutesToPercent(minutesFromMidnight(now) - startHour * 60, totalWindowMinutes)\n return Math.min(Math.max(rawPercent, 0), 100)\n}\n\n/**\n * Which scroll axis a reveal is allowed to move.\n *\n * `\"inline\"` is what a day column needs. A column is the full height of the\n * timed row, so it is never *fully* inside the block axis and has no\n * meaningful \"already visible\" state there β€” and moving that axis would throw\n * away whatever time of day the reader was looking at, which is not what\n * \"bring this day into view\" asked for.\n */\nexport type ScheduleScrollAxis = \"both\" | \"inline\" | \"block\"\n\nexport interface ScrollToCenterOptions {\n behavior?: ScrollBehavior\n /** Default `\"both\"`. */\n axis?: ScheduleScrollAxis\n}\n\n/**\n * Scrolls `container` so `element` β€” an actual, already-rendered descendant,\n * not a recomputed position β€” sits centered in its viewport.\n * RFC Β§14's \"scroll to now\" (`DaysView`/`Root`, both via their own `nowRef`\n * onto `NowCursorLine`'s `marker` instance) used to derive its target from\n * `nowIndicatorTop`/`resolvePxPerMinute` β€” the same math the line's own\n * `style.top` is built from, so it agreed with the render *in theory*, but\n * a second, independent computation of \"where is now\" is still a second\n * place for that agreement to quietly break. Measuring the real element's\n * `getBoundingClientRect()` instead removes that whole class of drift, and\n * centering on both axes (not vertical-only, as the old approach was) also\n * brings today's own day column into view horizontally on a multi-day\n * grid wide enough to scroll β€” not just the right time of day, but the\n * right day too. Respects `prefers-reduced-motion` β€” a `\"smooth\"` scroll is\n * a motion effect like any other, so it's opted out the same way the rest of\n * the kit already does. `options.behavior` picks the scroll's own behaviour,\n * but it cannot opt *into* motion against a reduced-motion preference: an\n * explicit `\"smooth\"` is still downgraded to `\"auto\"` there, while `\"auto\"`\n * and `\"instant\"` pass through untouched (neither animates). Callers that\n * pass nothing keep the historical `\"smooth\"` default.\n *\n * **Correction after v1 shipped.** This used to reconstruct the element's\n * absolute position in the container's scroll coordinate space and clamp the\n * result to `[0, scrollWidth - clientWidth]`. That origin is the one thing\n * that is not direction-agnostic: under `dir=\"rtl\"` `scrollLeft` runs from `0`\n * at the *right* edge down to `-(scrollWidth - clientWidth)`, so `Math.max(0,\n * ...)` collapsed every RTL target to the far right and the horizontal half of\n * \"scroll to now\" simply did not work there. Expressing the target as\n * `current + delta` needs no origin at all, so RTL is just a negative\n * `scrollLeft`; the browser clamps a `scrollTo` to the scrollable range\n * itself, so the manual clamp goes with it; and it stays correct if two\n * callers aim at the same target mid-animation, since the delta shrinks by\n * exactly as much as the live offset has already grown.\n */\nexport function scrollElementToCenter(\n container: HTMLElement,\n element: HTMLElement,\n options: ScrollToCenterOptions = {},\n): void {\n const reduceMotion = window.matchMedia(\"(prefers-reduced-motion: reduce)\").matches\n const { behavior: requested = \"smooth\", axis = \"both\" } = options\n const behavior = reduceMotion && requested === \"smooth\" ? \"auto\" : requested\n\n const c = container.getBoundingClientRect()\n const e = element.getBoundingClientRect()\n\n // How far the element's centre sits from the viewport's centre, in client\n // pixels β€” which is exactly how far the container has to scroll, on an axis\n // the caller allows.\n const inlineDelta =\n axis === \"block\"\n ? 0\n : e.left - c.left - container.clientLeft - (container.clientWidth - e.width) / 2\n const blockDelta =\n axis === \"inline\"\n ? 0\n : e.top - c.top - container.clientTop - (container.clientHeight - e.height) / 2\n\n container.scrollTo({\n left: container.scrollLeft + inlineDelta,\n top: container.scrollTop + blockDelta,\n behavior,\n })\n}\n\nexport interface ScrollViewportOptions {\n /**\n * Height of the sticky chrome pinned to `container`'s **top** edge β€” the\n * timed grid's `header-block`. Not optional padding: an element sitting\n * level with `container`'s own top edge is inside the scroll box but\n * *behind* that block, and therefore not visible. Callers pass the block's\n * rendered height; anything with no sticky chrome passes nothing.\n */\n topInset?: number\n /**\n * The sticky chrome pinned to `container`'s **inline-start** edge β€” the\n * timed grid's hour gutter, which occludes that edge exactly the way\n * `header-block` occludes the top.\n *\n * Passed as the *element*, deliberately not as a width the way `topInset`\n * is. `inset-s-0` is a logical edge: it resolves to `left` under `dir=\"ltr\"`\n * and `right` under `dir=\"rtl\"`, so a scalar inset would force this function\n * to work out which β€” and reading `getComputedStyle(container).direction` to\n * find out would be the only JS direction read anywhere in the kit, whose\n * RTL story is CSS logical properties and `rtl:` variants throughout. The\n * gutter's own rect already knows which edge it landed on, so an overlap\n * test against it is direction-agnostic by construction.\n */\n inlineOccluder?: HTMLElement | null\n /** Default `\"both\"`. */\n axis?: ScheduleScrollAxis\n}\n\n/**\n * Whether `element` is fully inside `container`'s scroll viewport β€” the\n * \"is it already on screen?\" half of selection's reveal rule, the scroll-axis\n * counterpart to `isEventInVisibleRange`'s date axis.\n *\n * Pairs with `scrollElementToCenter` above rather than a minimal \"scroll just\n * enough\" nudge, precisely because centring is what clears the sticky chrome β€”\n * a minimal scroll would park the revealed element directly under it.\n */\nexport function isElementInScrollViewport(\n container: HTMLElement,\n element: HTMLElement,\n { topInset = 0, inlineOccluder, axis = \"both\" }: ScrollViewportOptions = {},\n): boolean {\n const c = container.getBoundingClientRect()\n const e = element.getBoundingClientRect()\n if (axis !== \"inline\" && !(e.top >= c.top + topInset && e.bottom <= c.bottom)) return false\n if (axis === \"block\") return true\n if (!(e.left >= c.left && e.right <= c.right)) return false\n if (!inlineOccluder) return true\n const o = inlineOccluder.getBoundingClientRect()\n // Exclusive on both sides: an element flush against the gutter's trailing\n // edge sits beside it, not behind it β€” which is exactly where day column 0\n // rests when the grid is scrolled to its start.\n return !(e.left < o.right && o.left < e.right)\n}\n\n/** An edge-based rect: `DOMRect`'s shape without `x`/`y`/`width`/`height`. */\nexport type Edges = Pick<DOMRect, \"top\" | \"right\" | \"bottom\" | \"left\">\n\n/**\n * `scroller` minus the sticky chrome painted over it: `header` covers its top,\n * `gutter` one inline edge. Which edge is read off the gutter's own position,\n * not from `direction`: a gutter left of the scroller's centre is the LTR\n * inline-start one (the same reason `ScrollViewportOptions.inlineOccluder`\n * takes an element). Returns `null` when nothing is left.\n */\nexport function visibleEdges(scroller: Edges, header?: Edges, gutter?: Edges): Edges | null {\n const gutterOnLeft = gutter && gutter.left + gutter.right < scroller.left + scroller.right\n const edges = {\n top: header ? Math.max(scroller.top, header.bottom) : scroller.top,\n bottom: scroller.bottom,\n left: gutterOnLeft ? Math.max(scroller.left, gutter.right) : scroller.left,\n right: gutter && !gutterOnLeft ? Math.min(scroller.right, gutter.left) : scroller.right,\n }\n return edges.right > edges.left && edges.bottom > edges.top ? edges : null\n}\n\n/** An element's client box in viewport coordinates: its border box less the\n * borders and any scrollbar. */\nconst clientEdges = (el: HTMLElement): Edges => {\n const { top, left } = el.getBoundingClientRect()\n const x = left + el.clientLeft\n const y = top + el.clientTop\n return { top: y, left: x, right: x + el.clientWidth, bottom: y + el.clientHeight }\n}\n\n/**\n * The part of the timed grid a floating panel can actually be seen in, as the\n * viewport-relative rect Floating UI takes for a `boundary`: the scroller's\n * client box minus its sticky header and hour gutter (`visibleEdges`). The\n * event details popover uses it so a panel sliding along a tall chip stops at\n * the header instead of tucking under it.\n *\n * Falls back to `\"clippingAncestors\"` (Floating UI's own default) for a chip\n * that isn't inside a timed grid, and for a grid with no layout yet:\n * `hideWhenDetached` measures against this same boundary, and nothing\n * intersects an empty box, so the panel would open `visibility: hidden`.\n */\nexport function timedGridViewport(\n el: Element | null,\n): { x: number; y: number; width: number; height: number } | \"clippingAncestors\" {\n const grid = el?.closest<HTMLElement>(\"[data-schedule-part='timed-grid']\")\n if (!grid) return \"clippingAncestors\"\n const rectOf = (part: string) =>\n grid.querySelector(`[data-schedule-part='${part}']`)?.getBoundingClientRect()\n const edges = visibleEdges(clientEdges(grid), rectOf(\"header-block\"), rectOf(\"hour-gutter\"))\n if (!edges) return \"clippingAncestors\"\n return {\n x: edges.left,\n y: edges.top,\n width: edges.right - edges.left,\n height: edges.bottom - edges.top,\n }\n}\n","\"use client\"\n\nimport { cva } from \"class-variance-authority\"\nimport { ChevronDownIcon, ChevronUpIcon } from \"lucide-react\"\nimport type { Ref } from \"react\"\nimport { cn } from \"../../lib/cn\"\nimport { useNow } from \"../../lib/use-now\"\nimport { clockTimeLabel } from \"./schedule-dates\"\nimport { isNowInBand, minutesFromMidnight, nowIndicatorTop } from \"./schedule-geometry\"\n\n/**\n * RFC Β§13 (`docs/rfcs/schedule.md`) now-cursor β€” an isolated leaf so a\n * per-minute tick re-renders only this line, never the grid or its\n * (potentially many) event chips.\n *\n * Two variants, both anchored at the same `top`, each centering its own\n * mark on that anchor via `-translate-y-1/2` rather than a fixed negative\n * offset (a fixed offset only centers a box of one specific height/border\n * width, so the dot and the line drifted a px or two apart):\n * - `marker` β€” today's own indicator: the solid dot + full-opacity line.\n * - `guide` β€” a fainter, dot-less line spanning the *other* visible days\n * too (placed by the caller via `grid-column`), purely so the hour it\n * lines up with in the gutter stays easy to trace at a glance.\n *\n * The clock-time label lives in its own component below, `NowCursorLabel` β€”\n * mounted once in the shared hour gutter (`schedule-timed-grid.tsx`), not\n * inside either line variant above, so it floats over the gutter's own hour\n * labels instead of over today's event content. See the \"Correction after\n * v1 shipped\" note in RFC Β§13.\n */\nconst nowLineWrapper = cva(\n [\"pointer-events-none absolute inset-x-0\", \"[--sch-now-line-color:var(--color-red-500)]\"],\n // `marker` sits above the sticky hour gutter (z-30, `schedule-timed-grid.tsx`)\n // so its dot β€” deliberately centered on the day column's own left edge,\n // spilling half its width outward β€” isn't clipped by the gutter's opaque\n // surface whenever today is the leftmost visible column. Safe to sit above\n // the header/all-day block's z-40 too: this only ever renders inside a\n // `DayColumn` (row-2), which never shares screen space with that row-1 block.\n { variants: { variant: { marker: \"z-20\", guide: \"z-10\" } } },\n)\n\n/** Each variant owns its own border-width utility (rather than a shared\n * `border-t-2` base overridden per variant) so there's no same-property\n * Tailwind conflict for `cn`'s tailwind-merge to have to resolve. */\nconst nowLineMark = cva(\"absolute inset-x-0 top-0 -translate-y-1/2 rounded-full\", {\n variants: {\n variant: {\n marker: \"border-t-2 border-(--sch-now-line-color)\",\n guide: \"border-t border-(--sch-now-line-color)/30\",\n },\n },\n})\n\nexport function NowCursorLine({\n now,\n nowRef,\n startHour,\n endHour,\n variant = \"marker\",\n hideDot = false,\n className,\n}: {\n /** Override for tests/Storybook β€” a fixed value stops the live tick entirely. */\n now?: Date\n /** `marker` only β€” today's own instance, wherever it falls among the\n * visible days, is the real DOM node backing `ScheduleTimedGrid`'s own\n * `nowRef`, which `DaysView`/`Root` scroll to via `scrollElementToCenter`\n * (`schedule-geometry.ts`) for a measured, not computed, \"center on now\"\n * (RFC Β§14). Nothing reads it off the `guide` variant, so callers simply\n * don't pass one there. */\n nowRef?: Ref<HTMLDivElement>\n /** The rendered window's own top β€” the day-column only paints `[startHour, endHour)`. */\n startHour: number\n /** The rendered window's own bottom, exclusive. Together with `startHour`\n * this is a *visibility* gate, not just a position clamp: a `now` before\n * `startHour` or at/after `endHour` renders nothing at all rather than a\n * line pinned to the column's own top/bottom edge, which would keep\n * asserting \"now is here\" while pointing at an hour it isn't. */\n endHour: number\n variant?: \"marker\" | \"guide\"\n /** `marker` only β€” set when this is the leftmost visible day column, so\n * the dot (which spills half its width toward the gutter) would\n * otherwise land right on top of `NowCursorLabel` instead of a real\n * day column. Dropping it there also reads as more seamless: the line\n * itself already starts flush against the gutter, so the label now\n * looks like where the line originates rather than a disconnected dot\n * sitting in between. */\n hideDot?: boolean\n className?: string\n}) {\n const current = useNow(now)\n // Gated on the ticked `current`, not on the `now` prop or a grid-level\n // decision: this leaf is the only thing that re-renders on the per-minute\n // tick (that isolation being the entire point of the leaf), so it's also\n // the only place a gate can notice `now` crossing `endHour` while the page\n // sits open. Deciding it one level up, where `withNowIndicator`/`isToday`\n // are resolved, would leave a stale line on screen until something\n // unrelated happened to re-render the grid.\n if (!isNowInBand(current, startHour, endHour)) return null\n const top = nowIndicatorTop(current, startHour, endHour)\n\n return (\n <div\n ref={nowRef}\n aria-hidden\n data-schedule-part=\"now-indicator\"\n data-variant={variant}\n className={cn(nowLineWrapper({ variant }), className)}\n style={{ top: `${top}%` }}\n >\n <div className={nowLineMark({ variant })} />\n {variant === \"marker\" && !hideDot ? (\n <div\n data-schedule-part=\"now-indicator-dot\"\n className=\"absolute top-0 inset-s-0 size-2 -translate-x-1/2 -translate-y-1/2 rounded-full bg-(--sch-now-line-color)\"\n />\n ) : null}\n </div>\n )\n}\n\n/**\n * The now-cursor's presence in the hour gutter β€” a leaf on its own, same\n * isolation reasoning as `NowCursorLine` above (a per-minute tick only\n * re-renders this, never the grid). Mounted once inside the sticky hour gutter\n * (`schedule-timed-grid.tsx`), not inside either line variant, so it reads as\n * part of the gutter's own hour axis instead of floating over today's event\n * content β€” see the \"Correction after v1 shipped\" note in RFC Β§13.\n *\n * Renders one of two things, never both and never neither:\n *\n * - **inside the window** β€” the clock-time label, as it always has.\n * - **outside it** β€” a small triangle pinned to the edge `now` lies past,\n * pointing that way. Hiding the cursor outright is correct (it used to\n * clamp, asserting \"now is here\" while pointing at `endHour`), but it\n * leaves the grid silent about *why* there is no line: a window that\n * simply has no cursor and one whose cursor is just off the top look\n * identical. The triangle says \"it's that way\" without a word of text, so\n * it needs no translating and can't collide with the gutter's own hour\n * numbers (they are `text-end` inset by `pe-2`; this sits flush to the\n * edge, in that padding).\n *\n * Both branches read **one** `useNow` value and test **one** predicate, which\n * is what makes them exclusive. Two sibling leaves with a clock each could\n * disagree across a minute boundary and paint both marks, or neither.\n */\nexport function NowCursorLabel({\n now,\n startHour,\n endHour,\n locale,\n className,\n}: {\n /** Override for tests/Storybook β€” a fixed value stops the live tick entirely. */\n now?: Date\n startHour: number\n endHour: number\n /** Threaded into `clockTimeLabel` β€” never a `timeZone`, see that helper's\n * own doc comment. */\n locale?: string\n className?: string\n}) {\n const current = useNow(now)\n // Same window gate, same live reading, same reason as `NowCursorLine`\n // above β€” the label and the line have to appear and disappear together,\n // and sharing one predicate over one clock is what guarantees they do.\n if (!isNowInBand(current, startHour, endHour)) {\n // Which edge `now` lies past. `minutesFromMidnight` is the same host-local\n // reading `isNowInBand` and `nowIndicatorTop` use, so the direction can\n // never disagree with the gate that produced it.\n const before = minutesFromMidnight(current) < startHour * 60\n const Chevron = before ? ChevronUpIcon : ChevronDownIcon\n return (\n <Chevron\n aria-hidden\n data-schedule-part=\"now-indicator-offscreen\"\n data-direction={before ? \"before\" : \"after\"}\n // Lucide, like the toolbar's own paging chevrons β€” the kit already\n // depends on it, and its icons ship `stroke-linecap`/`stroke-linejoin`\n // of `round`, which is the whole reason this isn't the border triangle\n // it started as: that trick draws its shape out of border corners, and\n // `border-radius` has nothing to round on a zero-size box.\n //\n // Still not text, which was the point of the triangle and survives the\n // swap: an inline SVG has nothing a screen reader can announce or a\n // font fallback can substitute, and nothing to translate. Colour comes\n // through `currentColor` from the cursor's own variable, so the mark\n // and the line it stands in for can't drift apart.\n //\n // Centred across the gutter and stacked directly above the first hour\n // number (or below the last), so it reads as a caret on the same axis\n // rather than a sticker in a corner. Pinned to the band's own edges\n // instead of to those labels: the bottom one means \"past `endHour`\",\n // which is not the same instant as \"past the last number shown\" β€”\n // a 7–13 window's last label is 12, and the boundary is 13.\n //\n // The 4px its box shares with the hour number's box is leading, not\n // ink: a 10px font's glyphs sit inside a 12px line box, and lucide\n // insets its path within the viewBox. Measured in a browser, the two\n // marks never touch.\n //\n // Heavier than lucide's default 2: at this size a hairline chevron\n // reads as a smudge next to the solid dot the in-window cursor uses,\n // and this has to carry the same weight of meaning on its own.\n strokeWidth={3}\n className={cn(\n \"pointer-events-none absolute inset-x-0 mx-auto size-3 text-(--sch-now-line-color)\",\n before ? \"top-0\" : \"bottom-1.5\",\n \"[--sch-now-line-color:var(--color-red-500)]\",\n className,\n )}\n />\n )\n }\n const top = nowIndicatorTop(current, startHour, endHour)\n\n return (\n <span\n aria-hidden\n data-schedule-part=\"now-indicator-label\"\n // `end-2`, matching the gutter's own hour labels (`pe-2 text-end` in\n // `schedule-timed-grid.tsx`) β€” right-edge-aligned to the same inset, so\n // this reads as part of the same hour axis rather than a centered\n // island. No `max-w`/`truncate`: a locale whose clock format runs long\n // (e.g. \"3:45 PM\") is allowed to spill past the gutter's own edge\n // rather than get cut off β€” the gutter has no `overflow-hidden`, same\n // reasoning as the marker dot deliberately spilling out of its own\n // column.\n className={cn(\n \"pointer-events-none absolute -inset-e-0.75 -translate-y-1/2 whitespace-nowrap rounded-full bg-(--sch-now-line-color) px-1.5 py-0.5 text-[10px] font-medium leading-none text-white\",\n \"[--sch-now-line-color:var(--color-red-500)]\",\n className,\n )}\n style={{ top: `${top}%` }}\n >\n {clockTimeLabel(current, locale)}\n </span>\n )\n}\n\n/**\n * One row of the hour gutter's own hour axis (`schedule-timed-grid.tsx`),\n * broken out into its own leaf so hiding the current hour's number under\n * `NowCursorLabel` only re-renders this one row on tick, never the grid or\n * every other row. `hideWhenCurrent` gates whether it subscribes to\n * `useNow` at all β€” split into a separate `Live` component below rather\n * than an early `return` before the hook call, since conditionally calling\n * a hook from a prop is a rules-of-hooks violation. When the now-indicator\n * feature isn't in play (or today isn't visible), this renders once,\n * statically, exactly as it did before the label moved into the gutter.\n *\n * `startHour`/`endHour` ride along purely for the same window gate\n * `NowCursorLine`/`NowCursorLabel` apply (`isNowInBand`,\n * `schedule-geometry.ts`): this row only ever hides its number because\n * `NowCursorLabel` is standing in for it, so it must un-hide the moment that\n * label stops rendering. Without the gate, a `now` in the nine minutes\n * before `startHour` blanks the `startHour` row and puts nothing in its\n * place β€” a gutter tick with no line, the exact split this gate exists to\n * make impossible.\n */\nexport function HourGutterTick({\n hour,\n label,\n now,\n startHour,\n endHour,\n hideWhenCurrent,\n className,\n}: {\n hour: number\n label: string\n /** Override for tests/Storybook β€” a fixed value stops the live tick entirely. */\n now?: Date\n /** The rendered window, `endHour` exclusive β€” see the note above. */\n startHour: number\n endHour: number\n className?: string\n hideWhenCurrent: boolean\n}) {\n return hideWhenCurrent ? (\n <HourGutterTickLive\n hour={hour}\n label={label}\n now={now}\n startHour={startHour}\n endHour={endHour}\n className={className}\n />\n ) : (\n <div className={className}>{label}</div>\n )\n}\n\nfunction HourGutterTickLive({\n hour,\n label,\n now,\n startHour,\n endHour,\n className,\n}: {\n hour: number\n label: string\n now?: Date\n startHour: number\n endHour: number\n className?: string\n}) {\n const current = useNow(now)\n // The row itself (and its `flex-1` share of the gutter's own stretched\n // height) always renders β€” only the text inside is conditional. Dropping\n // the row itself would collapse its height in the gutter's `flex\n // flex-col`, shifting every hour below it out of alignment with the\n // actual grid lines.\n // Label is always present for screen readers, only opacity is toyed with\n return (\n <div\n className={cn(className, \"opacity-100 transition-opacity\", {\n \"opacity-0\": hideOverlapHour({ hour, current, startHour, endHour }),\n })}\n >\n {label}\n </div>\n )\n}\n\nfunction hideOverlapHour({\n hour,\n current,\n startHour,\n endHour,\n}: {\n hour: number\n current: Date\n startHour: number\n endHour: number\n}) {\n // Nothing to declutter for once the label itself isn't on screen.\n if (!isNowInBand(current, startHour, endHour)) return false\n const hours = current.getHours()\n const minutes = current.getMinutes()\n return (hours === hour && minutes <= 30) || (hours + 1 === hour && minutes > 50)\n}\n","/**\n * Shared color surface for every rendered event β€” the timed-grid chip\n * (`schedule-event-chip.tsx`), the Month view pill, and the all-day bar all\n * render the same `kind: \"event\" | \"static\"` data through this one\n * definition instead of three independently-duplicated class strings, so\n * they can't drift out of sync with each other. The `--c-text`/`--c-soft`\n * text-on-background pairing itself is already solid (checked by hand\n * against every allowed color's actual hex values β€” yellow is the tightest\n * at ~4.98:1, everything else higher, all clearing WCAG AA's 4.5:1); the\n * border here is just a soft outline, not a contrast fix, hence the low\n * opacity.\n */\nexport const EVENT_COLOR_CLASSES = \"border border-(--c-text)/30 bg-(--c-soft) text-(--c-text)\"\n\n/**\n * The selected treatment β€” the `filled` variant of whatever palette the event\n * already carries. A move on the **variant** axis with the **color** axis\n * untouched, which is the orthogonality `code-style.md` asks for, and why this\n * lives beside `EVENT_COLOR_CLASSES` (literally the `light` variant) rather\n * than as a fourth duplicated string.\n *\n * A ring was the instinct and is unavailable: these chips already spend theirs\n * on focus (`focusStyles({ ring: \"palette\" })`, the documented Schedule\n * exception), and a chip that is selected *and* focused has to read as two\n * distinguishable states. Swapping the fill is the one strong signal left, and\n * it survives a 15-minute chip's ~18px height where a border-weight change\n * would not. `--c-on-solid` on `--c-solid` is the same pairing Button/Badge's\n * own `filled` variant already ships for every palette β€” measured here across\n * every palette a chip can carry, identical in both themes: teal 7.67, green\n * 7.03, cyan 7.40, orange 6.16, blue 5.99, red 5.93, and purple 4.29. Six clear\n * AA outright; purple lands just under it at chip text size, which is a\n * property of that palette's own `filled` pairing rather than anything this\n * treatment introduces, so it is left consistent with Badge rather than\n * special-cased here.\n *\n * Note when querying `data-selected`: Ark's `Tabs` stamps the same attribute on\n * the active view-switcher trigger, so a bare attribute selector inside a\n * schedule root matches both. Scope to `[data-schedule-part=\"event-chip\"]` (or\n * the bar/pill part) when it matters β€” nothing bleeds visually, since these are\n * element-scoped variants rather than descendant selectors.\n *\n * The trailing ring override is load-bearing, not decoration. `focusStyles`\n * paints `--c-text` (700 light / 300 dark), which is legible against\n * `--c-soft` (50/950) and collapses against `--c-solid` (500): measured at\n * 1.69–2.39:1 across the palettes above, against the 3:1 WCAG 2.2 SC 1.4.11\n * asks of a focus indicator. So without this, a focused *and* selected chip\n * would lose its focus ring at exactly the moment it is the one element a\n * keyboard user is looking at. `--c-on-solid` flips with the surface instead. The extra `[data-selected]` attribute in the selector outranks\n * `focusStyles`' own class, so source order is irrelevant.\n */\nexport const EVENT_SELECTED_CLASSES =\n \"data-selected:border-(--c-solid) data-selected:bg-(--c-solid) data-selected:text-(--c-on-solid) data-selected:focus-visible:ring-(--c-on-solid)\"\n\n/** Width cap for an event-details panel portalled into the timed grid: its\n * usual 16rem, or the grid's visible width beside the hour gutter (less a\n * margin) when that is narrower β€” `100cqw` resolves against the grid root,\n * which is an inline-size container for exactly this. Without it a phone-width\n * grid clips the panel's far edge, since the panel now lives inside the\n * scroller rather than over the page. */\nexport const gridPanelMaxWidth = \"max-w-[min(16rem,calc(100cqw_-_var(--sch-gutter-width)_-_1rem))]\"\n","\"use client\"\n\nimport { ArrowLeftIcon } from \"lucide-react\"\nimport type { ReactNode } from \"react\"\nimport { cn } from \"../../lib/cn\"\nimport { Popover } from \"../popover/popover\"\nimport { ScheduleEventDetailsContent } from \"./schedule-event-details\"\nimport type { ScheduleAnyEvent, ScheduleTranslations } from \"./schedule-types\"\n\n/**\n * The list↔detail swap shared by every \"click a list of events, get one\n * event's full details\" popover in this component β€” a compact row per\n * event, each opening into that event's *full* details (title, time, icon,\n * color, and `description`) via `ScheduleEventDetailsContent`, the same\n * content every other event-details popover here already shows. Used by the\n * timed grid's `ScheduleOverflowPopover` (hidden events only), the all-day\n * row's own overflow chip (same), and `MonthView`'s day-details popover\n * (the day's *full* agenda, via `renderList`) β€” despite the \"Overflow\" name\n * this file's history carries, Month's day click isn't an overflow case at\n * all, just the same listβ†’detail shape with a different data source. The\n * caller owns `activeEvent`'s state (reset it to `null` alongside closing\n * the popover) β€” this component is a pure presentational swap between the\n * two views.\n */\nexport type ScheduleEventListPopoverContentProps<P = unknown> = {\n /** The list to show β€” the hidden events for a \"+N\" cluster, or (Month) a\n * day's full, uncapped agenda. */\n events: ScheduleAnyEvent<P>[]\n /** `null` shows the list; a specific event shows that event's own full details. */\n activeEvent: ScheduleAnyEvent<P> | null\n onSelectEvent: (event: ScheduleAnyEvent<P>) => void\n onBack: () => void\n renderEventDetails?: (event: ScheduleAnyEvent<P>) => ReactNode\n /** Overrides the default list rows entirely β€” Month's day-details popover\n * threads its own `renderDayDetails` override through here so it keeps\n * the built-in listβ†’detail swap (via the `onSelectEvent` it's handed)\n * without giving up custom row markup. Absent (the default): the built-in\n * dot + title rows below, including the empty-agenda message. */\n renderList?: (\n events: ScheduleAnyEvent<P>[],\n onSelectEvent: (event: ScheduleAnyEvent<P>) => void,\n ) => ReactNode\n locale?: string\n timeZone?: string\n translations: Required<ScheduleTranslations>\n /** The list rows' own className β€” distinct from the popover panel's own\n * (threaded by the caller onto `Popover.Content` itself). */\n itemClassName?: string\n}\n\n/**\n * Animates the panel's height across the list↔detail swap below, purely in\n * CSS β€” no measurement, no state, no effect. `height` normally can't\n * transition to/from its `auto` value (which is what a swap between two\n * differently-sized branches naturally produces), but `interpolate-size:\n * allow-keywords` opts keyword sizes like `auto` into being interpolatable:\n * paired with a plain `transition-[height]`, the browser animates between\n * whatever `auto` resolves to before and after the swap on its own.\n * `Collapse`'s grid-`fr` trick (`components/collapse/collapse.tsx`) doesn't\n * fit here β€” that one only ever animates toward a *known* endpoint (`0fr`\n * collapsed, `1fr` = \"whatever the content needs\"), never between two\n * different populated states, which is exactly what a listβ†’detail swap is.\n * Same motion language as `Collapse` (duration, easing, `motion-reduce`) for\n * consistency. In a browser without `interpolate-size` support yet, this is\n * a no-op progressive enhancement: the height still changes, just instantly\n * instead of animated β€” never a broken or clipped layout either way.\n */\nconst autoHeightPanel = cn(\n \"flex flex-col overflow-hidden\",\n \"[interpolate-size:allow-keywords] transition-[height] duration-150\",\n \"ease-[cubic-bezier(0.16,1,0.3,1)] motion-reduce:transition-none\",\n)\n\nexport function ScheduleEventListPopoverContent<P = unknown>({\n events,\n activeEvent,\n onSelectEvent,\n onBack,\n renderEventDetails,\n renderList,\n locale,\n timeZone,\n translations,\n itemClassName,\n}: ScheduleEventListPopoverContentProps<P>): ReactNode {\n const body = activeEvent ? (\n <>\n <Popover.Header className=\"flex items-center\">\n <button\n type=\"button\"\n onClick={(e) => {\n // React portals still bubble synthetic events through the\n // *React* tree, not the DOM tree β€” without this, the click\n // would also reach the trigger's own outer click handling.\n e.stopPropagation()\n onBack()\n }}\n aria-label={translations.back}\n className=\"-ms-1 flex items-center gap-1 rounded-sm px-1 py-0.5 text-gray-light-500 text-xs hover:bg-black/5 dark:text-gray-dark-400 dark:hover:bg-white/8\"\n >\n <ArrowLeftIcon className=\"size-3.5\" />\n {translations.back}\n </button>\n </Popover.Header>\n <Popover.Body>\n <ScheduleEventDetailsContent\n event={activeEvent}\n locale={locale}\n timeZone={timeZone}\n renderEventDetails={renderEventDetails}\n />\n </Popover.Body>\n </>\n ) : renderList ? (\n <Popover.Body>{renderList(events, onSelectEvent)}</Popover.Body>\n ) : events.length === 0 ? (\n <Popover.Body>\n <p className=\"px-1 py-2 text-center text-gray-light-500 text-xs dark:text-gray-dark-400\">\n {translations.empty}\n </p>\n </Popover.Body>\n ) : (\n <Popover.Body>\n <div className=\"flex flex-col gap-0.5\">\n {events.map((event) => (\n <button\n key={event.id}\n type=\"button\"\n data-color={event.color ?? \"pink\"}\n onClick={(e) => {\n // See the back button's own comment above β€” same reason.\n e.stopPropagation()\n onSelectEvent(event)\n }}\n className={\n itemClassName ??\n \"flex items-center gap-1.5 rounded-xs px-1.5 py-1 text-start text-xs hover:bg-black/5 dark:hover:bg-white/8\"\n }\n >\n <span className=\"size-1.5 shrink-0 rounded-full bg-(--c-solid)\" />\n <span className=\"truncate\">{event.title}</span>\n </button>\n ))}\n </div>\n </Popover.Body>\n )\n\n return <div className={autoHeightPanel}>{body}</div>\n}\n","\"use client\"\n\nimport type { MouseEvent as ReactMouseEvent, ReactNode } from \"react\"\nimport { useState } from \"react\"\nimport { cn } from \"../../lib/cn\"\nimport { Popover } from \"../popover/popover\"\nimport { ScheduleEventListPopoverContent } from \"./schedule-event-list-popover-content\"\nimport type {\n ScheduleAnyEvent,\n ScheduleOverflowClassNames,\n ScheduleOverflowContext,\n ScheduleOverflowProps,\n ScheduleOverflowSource,\n ScheduleTranslations,\n} from \"./schedule-types\"\nimport { eventCountLabel } from \"./schedule-types\"\n\n/**\n * The \"+N\" overflow disclosure's shared open/active-event state and\n * `Popover.Root`/`Trigger`/`Content` wiring β€” used by all three surfaces that\n * cap a container and collapse the rest: the timed grid's column overflow\n * (`schedule-overflow-chip.tsx`), the all-day row's per-day overflow\n * (`schedule-all-day-row.tsx`), and Month's day cell\n * (`schedule-month-view.tsx`).\n *\n * They differ only in how the trigger button is styled and positioned β€”\n * absolute px in one day-column's local coordinate space for the timed grid,\n * CSS grid placement spanning every day column for the all-day row, a\n * full-width caption line inside a cell for Month. That difference is real and\n * stays with each caller; `renderTrigger` is the seam β€” this component owns\n * every *behavioral* concern (open state, list↔detail swap, click resolution,\n * aria), the caller supplies only the trigger element's markup, style and\n * position, spreading the behavioral props this hands it onto its own\n * `<button>`.\n *\n * Month hand-rolled its own copy of all of that until it grew a `renderList`\n * seam to carry `renderOverflowDetails` through, which was the only thing it\n * needed from here that this did not offer.\n */\n\nexport type ScheduleOverflowTriggerProps = {\n onClick?: (e: ReactMouseEvent<HTMLButtonElement>) => void\n \"aria-label\": string\n \"aria-haspopup\"?: \"dialog\"\n \"aria-expanded\"?: boolean\n}\n\nexport type ScheduleOverflowPopoverProps<P = unknown> = Pick<\n ScheduleOverflowProps<P>,\n \"onOverflowClick\" | \"withOverflowDetails\" | \"renderOverflowDetails\"\n> & {\n /** The hidden events this \"+N\" counts, in start-time order. The chip's label\n * and the disclosure's list are the same set β€” always. */\n events: ScheduleAnyEvent<P>[]\n /** The day this \"+N\" sits on, for `ScheduleOverflowContext`. */\n date: Date\n source: ScheduleOverflowSource\n selectedId?: string | null\n onEventSelect?: (event: ScheduleAnyEvent<P> | null) => void\n withEventDetails?: boolean\n /** Overrides the built-in event-details popover's content, once a hidden\n * event is selected from the list. */\n renderEventDetails?: (event: ScheduleAnyEvent<P>) => ReactNode\n locale?: string\n timeZone?: string\n translations: Required<ScheduleTranslations>\n classNames?: ScheduleOverflowClassNames\n /** Builds the \"+N\" trigger element. Receives every behavioral prop\n * (`onClick`, aria attributes) to spread onto the caller's own button β€”\n * this component decides *what* those are; the caller decides how the\n * button looks and where it sits. A caller needing its own click work\n * (Month stops the day cell's own handler) composes around the `onClick`\n * it is handed rather than replacing it. */\n renderTrigger: (props: ScheduleOverflowTriggerProps) => ReactNode\n}\n\nexport function ScheduleOverflowPopover<P = unknown>({\n events,\n date,\n source,\n selectedId,\n onEventSelect,\n withEventDetails = true,\n onOverflowClick,\n withOverflowDetails = true,\n renderOverflowDetails,\n renderEventDetails,\n locale,\n timeZone,\n translations,\n classNames,\n renderTrigger,\n}: ScheduleOverflowPopoverProps<P>) {\n // The \"+N\" list's own disclosure stays local state, deliberately: a \"+N\" chip\n // is not an event, so there is nothing about it for `selected` to name. Only\n // *which row is expanded* is selection, and that is the schedule's id below.\n const [open, setOpen] = useState(false)\n // The flag alone decides this now. It used to be `onOverflowClick == null`,\n // which meant being told about the click and keeping the built-in UI were\n // mutually exclusive β€” see `ScheduleOverflowProps.onOverflowClick`.\n const showPopover = withOverflowDetails\n const ctx: ScheduleOverflowContext = { date, source }\n const activeEvent =\n withEventDetails && selectedId != null\n ? (events.find((e) => e.id === selectedId) ?? null)\n : null\n\n // The one resolved-select call site β€” funnels through regardless of whether\n // the click came from the list row directly, mirroring `MonthDayCell`'s own\n // \"uniform click rule\" for the same reason.\n const handleSelectEvent = (event: ScheduleAnyEvent<P>) => {\n onEventSelect?.(event)\n // With no built-in detail to swap to, the list has served its purpose.\n if (!withEventDetails) setOpen(false)\n }\n\n const trigger = renderTrigger({\n // Fires whether or not the popover mounts. `stopPropagation` regardless:\n // every surface sits inside something with its own click handling, and a\n // \"+N\" is never also a click on what it sits in.\n onClick: (e) => {\n e.stopPropagation()\n onOverflowClick?.(events, ctx)\n },\n \"aria-label\": eventCountLabel(translations.eventCount, events.length),\n ...(showPopover ? { \"aria-haspopup\": \"dialog\" as const, \"aria-expanded\": open } : {}),\n })\n\n if (!showPopover) return trigger\n\n return (\n <Popover.Root\n lazyMount\n open={open}\n onOpenChange={(d) => {\n setOpen(d.open)\n // Reopening lands back on the list, not on whatever row was expanded.\n if (!d.open) onEventSelect?.(null)\n }}\n width=\"auto\"\n >\n <Popover.Trigger asChild>{trigger}</Popover.Trigger>\n {/* A fixed `w-72` (not `max-w-72`) β€” the list↔detail swap inside would\n otherwise auto-size to whichever branch is showing, jumping the\n panel's width on every swap alongside its height. */}\n <Popover.Content\n // `select-text`: portalled into the `select-none` timed grid. Capped\n // to that grid's visible width the same way `gridPanelMaxWidth` is.\n className={cn(\n \"w-[min(18rem,calc(100cqw_-_var(--sch-gutter-width,0px)_-_1rem))] select-text\",\n classNames?.content,\n )}\n >\n <ScheduleEventListPopoverContent\n events={events}\n activeEvent={activeEvent}\n onSelectEvent={handleSelectEvent}\n onBack={() => onEventSelect?.(null)}\n renderEventDetails={renderEventDetails}\n renderList={\n renderOverflowDetails\n ? (list, onSelectEvent) => renderOverflowDetails(list, { ...ctx, onSelectEvent })\n : undefined\n }\n locale={locale}\n timeZone={timeZone}\n translations={translations}\n itemClassName={classNames?.item}\n />\n </Popover.Content>\n </Popover.Root>\n )\n}\n","\"use client\"\n\nimport type { CSSProperties, ReactNode } from \"react\"\nimport { cn } from \"../../lib/cn\"\nimport { focusStyles } from \"../../lib/focus-styles\"\nimport { props as dataProps } from \"../../lib/props\"\nimport { Popover } from \"../popover/popover\"\nimport { allDayRangeLabel, paginateDate } from \"./schedule-dates\"\nimport { ScheduleEventDetailsContent } from \"./schedule-event-details\"\nimport {\n EVENT_COLOR_CLASSES,\n EVENT_SELECTED_CLASSES,\n gridPanelMaxWidth,\n} from \"./schedule-event-styles\"\nimport { ScheduleOverflowPopover } from \"./schedule-overflow-popover\"\nimport type {\n ScheduleAnyEvent,\n ScheduleClassNames,\n ScheduleOverflowClassNames,\n ScheduleOverflowProps,\n ScheduleTranslations,\n} from \"./schedule-types\"\nimport { chipSelection } from \"./use-schedule-selection\"\n\n/**\n * RFC's all-day addendum β€” the Day/Week timed grid's all-day lanes. Renders\n * directly into `ScheduleTimedGrid`'s own merged header+all-day sticky grid\n * (via `rowOffset`), not into a sticky row of its own β€” one shared sticky\n * surface for the header and the all-day lanes together avoids the\n * `backdrop-blur` seam a second, independently-positioned sticky element\n * would produce at the boundary between them (see `ScheduleTimedGrid`'s own\n * comment). A multi-day all-day event draws one continuous bar spanning the\n * day columns it covers, placed via its own greedy lane-packer below β€” a\n * lighter relative of the timed grid's own `layoutEventColumnsCapped`\n * (`schedule-layout.ts`), but deliberately not that function itself: this\n * row's product requirement is \"the longest event sits at the top (lane 0),\n * and a shorter one overflows first,\" which needs a *duration-first* sweep\n * order, not `layoutEventColumnsCapped`'s chronological one (shortest-first\n * on a tied start) β€” and touching that shared function's own sort would\n * change the timed grid's unrelated time-axis column packing too. See\n * `computeAllDayLayout`'s own comment for why a duration-first sweep is\n * still a *correct* interval-graph coloring, not just a priority hack.\n */\n\n// Matches `ScheduleTimedGrid`'s own private `stickySurface` constant exactly\n// (not imported β€” a two-call-site shared string isn't worth exporting one\n// file's internal constant across another). The \"All day\" label needs it for\n// the identical reason that file's hour gutter does: this label is *also*\n// pinned via `sticky inset-s-0` inside a shared, both-axes-scrolling grid,\n// so a horizontally-scrolled all-day event bar can slide directly behind it\n// without an opaque backdrop of its own. Applying this only here (and not to\n// `ScheduleTimedGrid`'s corner cell directly above it, in the same gutter\n// column) would trade that bug for a visible seam between the two adjacent\n// sticky pieces β€” see the matching comment on that corner cell.\nconst stickySurface = \"bg-brand-50/90 backdrop-blur-lg dark:bg-brand-950/85\"\n\nexport type AllDayBar<P = unknown> = {\n event: ScheduleAnyEvent<P>\n /** 0-based lane (row) index within the all-day area. */\n lane: number\n /** 0-based day-column index, inclusive. */\n colStart: number\n /** 0-based day-column index, exclusive. */\n colEnd: number\n}\n\nexport type AllDayLayout<P = unknown> = {\n /** Total rows to render, already capped at `maxLanes` β€” real event lanes\n * plus, if anything overflowed, one shared row for it (never both\n * simultaneously add up to *more* than `maxLanes`: `maxAllDayRows={2}`\n * means at most 2 rows, full stop, whether that's 2 events, 1 event + a\n * \"+N\", or just a \"+N\" on its own). Never padded up to `maxLanes` when\n * fewer rows are actually needed β€” this is one shared row structure\n * spanning every day column, not an independent per-cell layout like\n * Month's, so there's no \"different cells need different heights\"\n * problem to pad against. */\n rowCount: number\n bars: AllDayBar<P>[]\n /** Day-column index β†’ the events hidden for that specific day. */\n overflowByDay: Map<number, ScheduleAnyEvent<P>[]>\n}\n\ntype ClippedEvent<P> = {\n event: ScheduleAnyEvent<P>\n index: number\n start: Date\n end: Date\n}\n\n/** One greedy sweep at a fixed lane cap β€” see `computeAllDayLayout`'s own\n * comment for the sweep-order/correctness reasoning. Split out so the\n * caller can run it twice: once at the requested cap to see whether\n * anything overflows, and β€” only if so β€” again at `cap - 1`, reserving the\n * freed-up row for a shared overflow indicator instead of letting the\n * overflow row silently push the total past `maxLanes`. */\nfunction sweepLanes<P>(\n sorted: ClippedEvent<P>[],\n maxLanes: number,\n dayIndexOf: (date: Date) => number,\n): { bars: AllDayBar<P>[]; overflowByDay: Map<number, ScheduleAnyEvent<P>[]>; laneCount: number } {\n // Each active lane holds the `end` (ms) of the bar currently occupying it,\n // or `null` once free. Unlike `layoutEventColumnsCapped`'s own sweep, an\n // overflowed event never claims a lane here at all (not even a \"phantom\"\n // one) β€” there's no per-cluster `columnCount` to report, so nothing needs\n // that bookkeeping; every day an overflowed event touches gets it added to\n // that day's own overflow list directly, below.\n const activeLaneEnds: (number | null)[] = []\n const bars: AllDayBar<P>[] = []\n const overflowByDay = new Map<number, ScheduleAnyEvent<P>[]>()\n let laneCount = 0\n\n for (const { event, start, end } of sorted) {\n const startMs = start.getTime()\n for (let i = 0; i < activeLaneEnds.length; i++) {\n if (activeLaneEnds[i] !== null && (activeLaneEnds[i] as number) <= startMs) {\n activeLaneEnds[i] = null\n }\n }\n let lane = activeLaneEnds.indexOf(null)\n if (lane === -1) lane = activeLaneEnds.length\n\n // `end.getTime() - 1`: the last real millisecond this bar covers, same\n // \"read the boundary back without calendar-unit arithmetic\" trick\n // `allDayRangeLabel` uses β€” exclusive `end` may sit exactly on the next\n // day's own boundary, which `dayIndexOf` would otherwise resolve one\n // column too far.\n const colStart = dayIndexOf(start)\n const colEnd = dayIndexOf(new Date(end.getTime() - 1)) + 1\n\n if (lane >= maxLanes) {\n for (let i = colStart; i < colEnd; i++) {\n const existing = overflowByDay.get(i)\n if (existing) existing.push(event)\n else overflowByDay.set(i, [event])\n }\n continue\n }\n\n if (lane === activeLaneEnds.length) activeLaneEnds.push(null)\n activeLaneEnds[lane] = end.getTime()\n bars.push({ event, lane, colStart, colEnd })\n laneCount = Math.max(laneCount, lane + 1)\n }\n\n return { bars, overflowByDay, laneCount }\n}\n\n/**\n * Pure, no React β€” `days` is the visible window's own day list (already\n * timeZone-correct, from `enumerateDays`); `events` must already be filtered\n * to `allDay && rangesOverlap(event, visibleWindow)` by the caller, the same\n * \"caller pre-clips\" contract `layoutEventColumns` documents for its own\n * per-day-column input.\n *\n * **Sweep order: longest event first (by its own true, unclipped duration β€”\n * not the window-clipped span), ties broken by earlier start, then original\n * array order.** The longest event lands in lane 0 (rendered at the row's\n * top); once enough lanes are claimed by longer events, a later (shorter)\n * event overflows instead. Ranking by *true* duration, not the clipped one,\n * keeps an event's lane stable as the visible window pages forward/back β€” a\n * 10-day conference doesn't jump lanes just because only a sliver of it is\n * in view this week.\n *\n * This is *not* simply \"sort differently\" applied to\n * `layoutEventColumnsCapped`'s own sweep β€” it deliberately reimplements the\n * greedy free-lane bookkeeping locally, because that shared function's sort\n * is baked into its own private sweep and changing it would also change the\n * timed grid's unrelated time-axis column packing. Reimplementing here is\n * still provably a *correct* interval-graph coloring, not just a priority\n * hack: the free-a-lane check compares real `start`/`end` timestamps, not\n * sweep-processing order, so two events that genuinely overlap in time can\n * never land in the same lane regardless of which one gets swept first β€”\n * sweep order only ever decides *which* lane (and therefore whether an\n * event survives the cap), never whether an assignment is valid.\n *\n * **`maxLanes` bounds the *total* row count, overflow row included.**\n * `sweepLanes` runs once at `maxLanes`; if that leaves anything overflowed,\n * it re-runs at `maxLanes - 1` instead, so the freed-up row can carry a\n * shared overflow indicator without pushing the grand total past `maxLanes`\n * β€” `maxAllDayRows={2}` always means at most 2 rows, never 2 real lanes\n * *plus* a 3rd for \"+N\".\n */\nexport function computeAllDayLayout<P = unknown>(\n days: Date[],\n events: ScheduleAnyEvent<P>[],\n maxLanes: number,\n timeZone: string,\n): AllDayLayout<P> {\n if (days.length === 0 || events.length === 0) {\n return { rowCount: 0, bars: [], overflowByDay: new Map() }\n }\n\n const windowStart = days[0] as Date\n const windowEnd = paginateDate(\"days\", days[days.length - 1] as Date, 1, {\n timeZone,\n visibleDays: 1,\n })\n\n // Which day-column index a (window-clipped) instant falls into β€” the last\n // day whose own midnight is at or before it. Robust to a consumer's\n // `start`/`end` not landing on an exact `days[i]` millisecond (e.g. a\n // slightly different midnight resolution), unlike an exact `getTime()`\n // equality lookup would be.\n const dayIndexOf = (date: Date): number => {\n for (let i = days.length - 1; i >= 0; i--) {\n if (date.getTime() >= (days[i] as Date).getTime()) return i\n }\n return 0\n }\n\n const clipped: ClippedEvent<P>[] = events.map((event, index) => ({\n event,\n index, // stable tie-break β€” Array#sort's own stability already gives us\n // this for equal-key pairs, but a duration+start tie is genuinely\n // possible (two same-day events), so the key needs it explicitly.\n start: event.start.getTime() < windowStart.getTime() ? windowStart : event.start,\n end: event.end.getTime() > windowEnd.getTime() ? windowEnd : event.end,\n }))\n\n const sorted = [...clipped].sort((a, b) => {\n const durationA = a.event.end.getTime() - a.event.start.getTime()\n const durationB = b.event.end.getTime() - b.event.start.getTime()\n return durationB - durationA || a.start.getTime() - b.start.getTime() || a.index - b.index\n })\n\n const safeMaxLanes = Math.max(1, maxLanes)\n const atFullCap = sweepLanes(sorted, safeMaxLanes, dayIndexOf)\n if (atFullCap.overflowByDay.size === 0) {\n return { rowCount: atFullCap.laneCount, bars: atFullCap.bars, overflowByDay: new Map() }\n }\n\n // Something overflowed at the full cap β€” redo with one fewer real lane so\n // the reserved overflow row is *inside* the `maxLanes` budget, not on top\n // of it. `safeMaxLanes - 1` can be 0 (maxAllDayRows={1} with any overlap\n // at all): `sweepLanes` handles that correctly β€” every event immediately\n // overflows, `bars` stays empty, and the single reserved row (below)\n // carries either a promoted lone event or a genuine \"+N\" per day.\n const reduced = sweepLanes(sorted, safeMaxLanes - 1, dayIndexOf)\n return { rowCount: safeMaxLanes, bars: reduced.bars, overflowByDay: reduced.overflowByDay }\n}\n\n/**\n * What marks a node as belonging to the outgoing copy of a page turn.\n *\n * `data-page-exiting` is the queryable half β€” `isLive` (`schedule-grid-gesture.ts`)\n * filters on it, so anything that looks an event up by `data-event-id` finds\n * the live band's node rather than the ghost's duplicate. `inert` +\n * `aria-hidden` are the user-facing half: without them the outgoing copy stays\n * focusable and announced for the ~220ms it is on screen, and its\n * `data-testid`s collide with the incoming band's.\n *\n * Mirrors what the outgoing day-header buttons already carry in\n * `schedule-timed-grid.tsx`.\n */\nconst EXITING_PROPS = { inert: true, \"aria-hidden\": true, \"data-page-exiting\": \"true\" } as const\n\nfunction AllDayEventBar<P>({\n event,\n colStart,\n colEnd,\n lane,\n selected = false,\n onEventSelect,\n withEventDetails = true,\n renderEventDetails,\n locale,\n timeZone,\n detailsPopoverClassName,\n className,\n pageExiting,\n}: {\n event: ScheduleAnyEvent<P>\n colStart: number\n colEnd: number\n lane: number\n selected?: boolean\n onEventSelect?: (event: ScheduleAnyEvent<P> | null) => void\n withEventDetails?: boolean\n renderEventDetails?: (event: ScheduleAnyEvent<P>) => ReactNode\n locale?: string\n timeZone: string\n detailsPopoverClassName?: string\n /** The page-turn animation class, when one is running. */\n className?: string\n /** This bar belongs to the outgoing copy of a page turn. */\n pageExiting?: boolean\n}) {\n const showDetailsPopover = withEventDetails\n const detailsOpen = showDetailsPopover && selected\n const style: CSSProperties = { gridColumn: `${colStart + 2} / ${colEnd + 2}`, gridRow: lane + 1 }\n\n const button = (\n <button\n type=\"button\"\n data-schedule-part=\"all-day-event\"\n data-kind={event.kind}\n data-color={event.color ?? \"pink\"}\n {...dataProps({\n \"data-event-id\": event.id,\n \"data-testid\": event.testId ?? event.id,\n \"data-selected\": selected,\n })}\n {...(pageExiting ? EXITING_PROPS : {})}\n onClick={(e) => {\n e.stopPropagation()\n onEventSelect?.(event)\n }}\n aria-label={`${event.title}, ${allDayRangeLabel(event.start, event.end, timeZone, locale)}`}\n {...(showDetailsPopover\n ? { \"aria-haspopup\": \"dialog\" as const, \"aria-expanded\": detailsOpen }\n : {})}\n style={style}\n className={cn(\n \"mx-0.5 my-px block truncate rounded-xs px-1.5 py-0.5 text-start text-xs\",\n EVENT_COLOR_CLASSES,\n EVENT_SELECTED_CLASSES,\n // So selecting a bar fades between the light and filled variants,\n // matching the timed grid's chips.\n \"transition-colors duration-150 ease-out motion-reduce:transition-none\",\n className,\n )}\n >\n {event.icon != null ? (\n <span className=\"mr-1 inline-flex align-[-1px] [&_svg]:size-3\">{event.icon}</span>\n ) : null}\n {event.title}\n </button>\n )\n\n if (!showDetailsPopover) return button\n\n return (\n <Popover.Root\n lazyMount\n open={detailsOpen}\n onOpenChange={(d) => {\n // Closing is a deselect β€” see `StaticEventChip`'s own note.\n if (!d.open) onEventSelect?.(null)\n }}\n width=\"auto\"\n >\n <Popover.Trigger asChild>{button}</Popover.Trigger>\n <Popover.Content\n // `select-text`: portalled into the `select-none` timed grid.\n className={cn(\"select-text\", gridPanelMaxWidth, detailsPopoverClassName)}\n >\n <Popover.Body>\n <ScheduleEventDetailsContent\n event={event}\n locale={locale}\n timeZone={timeZone}\n renderEventDetails={renderEventDetails}\n />\n </Popover.Body>\n </Popover.Content>\n </Popover.Root>\n )\n}\n\n/** One day's \"+N\" all-day overflow disclosure β€” same shared\n * `ScheduleOverflowPopover` the timed grid's `ScheduleOverflowChip` uses;\n * only this trigger button's own markup/position is local here (CSS grid\n * placement spanning every day column, unlike the timed grid's absolute-px\n * positioning within one day-column's local coordinate space). */\nfunction AllDayOverflowChip<P>({\n dayIndex,\n date,\n lane,\n events,\n selectedId,\n onEventSelect,\n withEventDetails,\n onOverflowClick,\n withOverflowDetails,\n renderOverflowDetails,\n renderEventDetails,\n locale,\n timeZone,\n translations,\n classNames,\n pageExiting,\n}: Pick<\n ScheduleOverflowProps<P>,\n \"onOverflowClick\" | \"withOverflowDetails\" | \"renderOverflowDetails\"\n> & {\n dayIndex: number\n /** The day column this \"+N\" sits in β€” `days[dayIndex]`. */\n date: Date\n lane: number\n events: ScheduleAnyEvent<P>[]\n selectedId?: string | null\n onEventSelect?: (event: ScheduleAnyEvent<P> | null) => void\n withEventDetails?: boolean\n renderEventDetails?: (event: ScheduleAnyEvent<P>) => ReactNode\n locale?: string\n timeZone: string\n translations: Required<ScheduleTranslations>\n classNames?: ScheduleOverflowClassNames\n pageExiting?: boolean\n}) {\n const style: CSSProperties = { gridColumn: dayIndex + 2, gridRow: lane + 1 }\n\n return (\n <ScheduleOverflowPopover\n events={events}\n date={date}\n source=\"allDay\"\n selectedId={selectedId}\n onEventSelect={onEventSelect}\n withEventDetails={withEventDetails}\n onOverflowClick={onOverflowClick}\n withOverflowDetails={withOverflowDetails}\n renderOverflowDetails={renderOverflowDetails}\n renderEventDetails={renderEventDetails}\n locale={locale}\n timeZone={timeZone}\n translations={translations}\n classNames={classNames}\n renderTrigger={(triggerProps) => (\n <button\n type=\"button\"\n data-schedule-part=\"all-day-overflow-chip\"\n {...dataProps({ \"data-testid\": `overflow-allday-${dayIndex}` })}\n {...triggerProps}\n {...(pageExiting ? EXITING_PROPS : {})}\n style={style}\n className={cn(\n \"mx-0.5 my-px truncate rounded-xs px-1.5 py-0.5 text-start text-xs\",\n \"bg-(--c-soft) text-(--c-text) hover:bg-(--c-soft-hover)\",\n focusStyles({ ring: \"palette\", offset: false }),\n classNames?.root,\n )}\n >\n {`+${events.length}`}\n </button>\n )}\n />\n )\n}\n\nexport type ScheduleAllDayRowProps<P = unknown> = Pick<\n ScheduleOverflowProps<P>,\n \"onOverflowClick\" | \"withOverflowDetails\" | \"renderOverflowDetails\"\n> & {\n days: Date[]\n /** Pre-filtered by the caller: `allDay && rangesOverlap(event, visibleWindow)`. */\n events: ScheduleAnyEvent<P>[]\n maxAllDayRows: number\n /** Which row of the *caller's* grid lane 0 maps to β€” this component places\n * its cells directly into that shared grid (via `gridRow`/`gridColumn`\n * on each child), rather than building a nested grid of its own, so it\n * needs to know where its own row-space actually starts. `ScheduleTimedGrid`\n * passes `2`, since its header occupies row 1. */\n rowOffset: number\n timeZone: string\n selected?: readonly string[]\n onEventSelect?: (event: ScheduleAnyEvent<P> | null) => void\n withEventDetails?: boolean\n renderEventDetails?: (event: ScheduleAnyEvent<P>) => ReactNode\n locale?: string\n translations: Required<ScheduleTranslations>\n classNames?: ScheduleClassNames\n /** Applied to every bar and overflow chip for the duration of a page turn\n * (`schedule-timed-grid.tsx`), so the all-day lanes travel with the day\n * columns instead of swapping under them. */\n pageClassName?: string\n /** This whole copy of the row belongs to the outgoing half of a page turn,\n * so every bar and chip it renders is marked `inert`/`aria-hidden`/\n * `data-page-exiting`. Previously only the animation class was applied, which\n * left a keyboard-reachable ghost with duplicate `data-testid`s. */\n pageExiting?: boolean\n /** The outgoing copy during a page turn suppresses the sticky \"All day\"\n * label: both copies place it in the same cell, and two identical labels\n * stacked read as a rendering fault rather than as motion. */\n hideLabel?: boolean\n}\n\n/** Renders nothing when there's no all-day event in the visible window β€”\n * schedules with none pay no visual cost, and the caller's grid (which has\n * no explicit row count of its own) simply grows no implicit rows. */\nexport function ScheduleAllDayRow<P = unknown>({\n days,\n events,\n maxAllDayRows,\n rowOffset,\n timeZone,\n selected = [],\n onEventSelect,\n withEventDetails,\n onOverflowClick,\n withOverflowDetails,\n renderOverflowDetails,\n renderEventDetails,\n locale,\n translations,\n classNames,\n pageClassName,\n pageExiting,\n hideLabel,\n}: ScheduleAllDayRowProps<P>) {\n if (events.length === 0) return null\n\n const { rowCount, bars, overflowByDay } = computeAllDayLayout(\n days,\n events,\n maxAllDayRows,\n timeZone,\n )\n const hasOverflow = overflowByDay.size > 0\n // The overflow row is always the *last* of the already-capped `rowCount`\n // rows β€” `computeAllDayLayout` reserves it by construction whenever\n // `hasOverflow`, never as an extra row beyond `rowCount`.\n const overflowLane = rowCount - 1\n // `AllDayEventBar`/`AllDayOverflowChip` both compute `gridRow: lane + 1`\n // internally (lane 0 β†’ row 1) β€” passing an already-shifted lane here keeps\n // those two components unaware of `rowOffset` entirely.\n const laneOffset = rowOffset - 1\n\n // Sorted COPIES for rendering only β€” `bars`' own duration-descending sweep\n // order (`computeAllDayLayout`'s own contract, pinned by\n // `schedule-all-day-row.test.ts`) stays untouched; every bar below is its\n // own independently-focusable `<button>`, positioned by explicit\n // `gridRow`/`gridColumn` rather than DOM order, so DOM order (which native\n // Tab/screen-reader order always follows) has to be derived from that same\n // visual position instead β€” top-to-bottom by `lane`, then left-to-right by\n // `colStart` β€” same reasoning as `DayColumn`'s own chip merge in\n // `schedule-timed-grid.tsx`. All overflow entries share one lane\n // (`overflowLane`), varying only by `dayIndex`, so sorting by that alone\n // fully determines their left-to-right order.\n const visualBars = [...bars].sort((a, b) => a.lane - b.lane || a.colStart - b.colStart)\n const overflowEntries = Array.from(overflowByDay.entries()).sort(([a], [b]) => a - b)\n\n return (\n <>\n {hideLabel ? null : (\n <div\n className={cn(\n \"sticky inset-s-0 flex items-center justify-end pe-2 py-0.5 text-[10px]\",\n \"text-gray-light-500 dark:text-gray-dark-500\",\n stickySurface,\n )}\n style={{ gridColumn: 1, gridRow: `${rowOffset} / ${rowOffset + rowCount}` }}\n >\n {translations.allDay}\n </div>\n )}\n {visualBars.map(({ event, lane, colStart, colEnd }) => (\n <AllDayEventBar\n key={event.id}\n event={event}\n colStart={colStart}\n colEnd={colEnd}\n lane={lane + laneOffset}\n {...chipSelection(selected, event.id)}\n onEventSelect={onEventSelect}\n withEventDetails={withEventDetails}\n renderEventDetails={renderEventDetails}\n locale={locale}\n timeZone={timeZone}\n detailsPopoverClassName={classNames?.eventDetailsPopover}\n className={pageClassName}\n pageExiting={pageExiting}\n />\n ))}\n {hasOverflow\n ? overflowEntries.map(([dayIndex, hidden]) =>\n // A \"+1\" chip costs exactly the same row space as just showing\n // that one event would β€” there's nothing to disclose a lone\n // hidden event *behind*, so render it as a real (single-day)\n // pill instead. Only 2+ genuinely benefits from collapsing.\n hidden.length === 1 ? (\n <AllDayEventBar\n key={hidden[0]?.id}\n event={hidden[0] as ScheduleAnyEvent<P>}\n colStart={dayIndex}\n colEnd={dayIndex + 1}\n lane={overflowLane + laneOffset}\n {...chipSelection(selected, hidden[0]?.id ?? \"\")}\n onEventSelect={onEventSelect}\n withEventDetails={withEventDetails}\n renderEventDetails={renderEventDetails}\n locale={locale}\n timeZone={timeZone}\n detailsPopoverClassName={classNames?.eventDetailsPopover}\n className={pageClassName}\n pageExiting={pageExiting}\n />\n ) : (\n <AllDayOverflowChip\n key={dayIndex}\n dayIndex={dayIndex}\n date={days[dayIndex] ?? days[0] ?? new Date()}\n lane={overflowLane + laneOffset}\n events={hidden}\n selectedId={selected[0] ?? null}\n onEventSelect={onEventSelect}\n withEventDetails={withEventDetails}\n onOverflowClick={onOverflowClick}\n withOverflowDetails={withOverflowDetails}\n renderOverflowDetails={renderOverflowDetails}\n renderEventDetails={renderEventDetails}\n locale={locale}\n timeZone={timeZone}\n translations={translations}\n pageExiting={pageExiting}\n classNames={{\n ...classNames?.overflow,\n root: cn(classNames?.overflow?.root, pageClassName),\n }}\n />\n ),\n )\n : null}\n </>\n )\n}\n","import { cn } from \"../../lib/cn\"\n\n/**\n * The click-drag-to-create ghost box. RSC β€” owns no state, only reads the\n * `--sch-create-top`/`--sch-create-height` CSS vars `use-event-create.ts`\n * writes imperatively during a gesture, the same \"permanently-mounted leaf,\n * driven by an external imperative write\" shape `schedule-disabled-overlay.tsx`\n * uses for its own decorative overlay β€” never a `useState` re-render per\n * `pointermove`, matching the module's \"refs are not state\" discipline for\n * in-flight gesture coordinates.\n *\n * One of these is mounted per day column, and a single gesture writes to all\n * of them: a create drag has two axes, so its candidate is clipped to each\n * column's own painted band exactly the way `segmentEvents` clips a real\n * event. A cross-day draft is therefore several of these boxes, one per day,\n * not one box drawn past the bottom of its column.\n *\n * `data-invalid` (also written imperatively, live on every `pointermove`)\n * swaps the brand tint for red whenever the *currently snapped* candidate\n * would be rejected by `checkRangeCommit` β€” a separate, additive signal from\n * the unsnapped visual position, which never snaps live.\n *\n * `data-continues-before`/`-after` square off a cut edge, the identical\n * treatment `schedule-event-chip.tsx` gives a real clipped piece, so a draft\n * that runs past the day (or past the window) visibly runs off the end of its\n * column rather than reading as a self-contained event.\n */\nexport function ScheduleCreateDraft({ className }: { className?: string }) {\n return (\n <div\n aria-hidden\n data-schedule-part=\"create-draft\"\n className={cn(\n \"group pointer-events-none absolute inset-x-0 hidden rounded-sm border-2\",\n // `select-none`, like every other chip surface in the grid. The label\n // rides the box's top edge, which during an upward drag *is* the\n // pointer position β€” so the browser extended a text selection straight\n // through the readout and highlighted it mid-gesture.\n // `pointer-events-none` does not prevent this: it stops hit-testing,\n // not selection.\n \"select-none\",\n // Above the events it is drawn over. Without a `z-index` at all this\n // was `auto`, i.e. *below* every chip (`z-(--sch-chip-z)`, 10-15), so a\n // draft spanning a busy day was mostly hidden behind the very events\n // it is being positioned against. `26` clears the chips' own\n // hover/focus/resize promotion (25) and the drag ghost (25), while\n // staying under the sticky hour gutter (30) and header (40) β€” a\n // preview must never paint over the chrome that is pinned on top.\n \"z-26\",\n // The piece carrying the readout paints above its siblings.\n //\n // The label is deliberately allowed to be wider than its own column (a\n // cross-day range is day-qualified, and clamping it truncated the end\n // day away), so it reaches into the next column β€” where the *next*\n // piece, at the same z-index and later in DOM order, drew its left\n // border straight through the text. Measured on a 7-day grid: a 144px\n // column against a 156px label, so 19px of the readout sat under the\n // neighbouring border.\n //\n // Scoped by `:has()` to the piece that actually has a label β€”\n // `paintPieces` writes one onto each candidate's first visible piece\n // only (a repeat create has one candidate per day), and the rest keep\n // an empty span (`empty:hidden`). Raising every piece would\n // just move the collision to whichever one happened to be last.\n \"[&:has([data-schedule-part=create-draft-label]:not(:empty))]:z-27\",\n // Solid, and the same weight/alpha the drag ghost carries. The two are\n // the same kind of object β€” \"this is the box you are about to commit\" β€”\n // and they never appear at once, so giving them one look costs no\n // ambiguity. The dashes this replaces were a 2px stroke broken into\n // long segments, which at chip size read as busier than the thing being\n // previewed.\n \"border-brand-500/70 bg-brand-500/15 data-active:block\",\n // The same fade `schedule-drag-ghost.tsx` carries, and for the same\n // reason β€” this is the box a press-drag on empty space raises, so it is\n // the preview most people meet first.\n //\n // `display` is what `data-active` toggles, which a transition normally\n // cannot touch, so it is named in the property list and paired with\n // `transition-discrete` (`transition-behavior: allow-discrete`) to keep\n // the element rendered through the leave. `starting:` supplies the\n // `@starting-style` the enter needs.\n //\n // Easing per direction, taken from whichever state the transition heads\n // *to*. Deliberately NOT the `cubic-bezier(0.16, 1, 0.3, 1)` the chip\n // entrances share: that is an expo-out tuned for a small transform and\n // on an opacity it front-loads so hard the fade reads as a blink.\n //\n // The resting scale is >1 so the leave expands outward, where it can be\n // seen past the committed chip that lands in the same place, rather\n // than shrinking away behind it. `scale`, not `transform`, because\n // Tailwind v4's `scale-*` drives the standalone property.\n \"opacity-0 scale-105 data-active:opacity-100 data-active:scale-100\",\n \"starting:data-active:opacity-0 starting:data-active:scale-105\",\n /**\n * One `transition` shorthand rather than the utilities, because\n * `transition-property` can only be set once and these want different\n * timings: the fade is 200ms, the geometry 90ms.\n *\n * `top`/`height` are in here deliberately, against the rule the chip\n * states for its own β€” the draft's box *snaps* to the slot grid, so it\n * changes in discrete one-slot jumps rather than tracking the pointer\n * continuously, and easing those steps takes the hard edge off them.\n *\n * `ease-out` at 45ms. A first pass used a steep ease-in-out on the\n * reasoning that lingering at each end keeps the box reading as *on* a\n * gridline β€” but measured over a single slot jump that curve moves only\n * 4% of the distance on its first frame before whipping across, which\n * feels like the box is stuck to the slot it is leaving. `ease-out`\n * covers 73% on the first frame and is done by the second, and it\n * actually sits on a resting position slightly more of the time (77% of\n * frames vs 73%). Keep it short regardless: this is the one property\n * pair the pointer is actively driving, and anything longer is lag.\n *\n * Easing per direction comes from whichever state the transition heads\n * *to*, so the base carries `ease-in` (the leave) and `data-active` the\n * `ease-out` (the enter). `allow-discrete` rides on `display` alone.\n */\n \"[transition:opacity_200ms_ease-in,scale_200ms_ease-in,display_200ms_ease-in_allow-discrete,top_45ms_ease-out,height_45ms_ease-out]\",\n \"data-active:[transition:opacity_200ms_ease-out,scale_200ms_ease-out,display_200ms_ease-out_allow-discrete,top_45ms_ease-out,height_45ms_ease-out]\",\n // `!` and the full shorthand, not `transition-none`: the `data-active`\n // rule above is a class *and* an attribute selector, so a plain\n // `motion-reduce:transition-none` loses to it and the preview kept\n // animating for a user who asked it not to β€” measured, the active ghost\n // still reported all five properties under `prefers-reduced-motion`.\n \"motion-reduce:[transition:none]!\",\n \"data-invalid:border-red-500/60 data-invalid:bg-red-500/10\",\n \"data-continues-before:rounded-t-none data-continues-before:border-t-0\",\n \"data-continues-after:rounded-b-none data-continues-after:border-b-0\",\n className,\n )}\n style={{\n top: \"var(--sch-create-top, 0px)\",\n // Floored to the same `calc(1rem + 2px)` a real chip is, so the draft\n // is the box the commit produces rather than a smaller one that jumps\n // on release β€” on a grid where one slot renders shorter than a line of\n // content (a 13-hour day in 624px puts a 15-minute slot at 12px against\n // an 18px floor) a minimum-duration draft was drawn 6px short.\n // Safe for the inactive pieces this component also renders: they are\n // `display: none` without `data-active`, so their height never paints.\n height: \"max(var(--sch-create-height, 0px), calc(1rem + 2px))\",\n }}\n >\n {/* The live drop-time readout, the same one `schedule-drag-ghost.tsx`\n * carries and for the same reason: once the view can page under the\n * pointer, the grid behind it stops answering \"where will this land\".\n * It is also the only thing that names the *day* a cross-day candidate\n * ends on, since that day may not even be rendered. Written by direct\n * `textContent`, only when the snapped value actually changes, and only\n * onto the first visible piece. */}\n <span\n data-schedule-part=\"create-draft-label\"\n className={cn(\n \"pointer-events-none absolute start-1 top-0 truncate rounded-xs px-1 py-px\",\n \"font-medium text-[0.6875rem] text-brand-950 leading-none dark:text-white\",\n // Fully opaque, deliberately β€” this was `/85` with a `backdrop-blur`,\n // on the reasoning the grid's own sticky chrome uses. That is right\n // for a large surface and wrong for a small readout: blurring spreads\n // what is behind, it does not remove it, so the box's own top border\n // (which the label straddles) still crossed the digits as a soft\n // bright band, and the chip's resize grip did the same. At a pill\n // this size there is nothing to gain from letting anything through,\n // and this is a value the user reads mid-gesture.\n \"bg-brand-500 group-data-invalid:bg-red-500 group-data-invalid:text-white\",\n // Sits just above a box that is too short to hold it, so a\n // 15-minute draft's label never overflows into the slot below.\n \"-translate-y-1/2\",\n // Sized to its own text, not to the column. A day-qualified range\n // (\"Tue 12:15 AM – Thu 03:00 AM\") is far wider than one day column,\n // and clamping it to `100%` truncated it at exactly the half that\n // carries the new information β€” the day it ends on. It may reach\n // over the next column for the duration of the gesture; it is\n // `pointer-events-none`, and the grid clips it at its own edge.\n \"w-max max-w-[calc(250%-0.5rem)]\",\n // An empty label (every piece after the first) must not paint its\n // own background chip.\n \"empty:hidden\",\n )}\n />\n </div>\n )\n}\n","import type { CSSProperties } from \"react\"\nimport { cn } from \"../../lib/cn\"\n\n/**\n * RFC Β§12 (`docs/rfcs/schedule.md`) disabled-slot visual, shared by the timed\n * grid (Day/Week)'s per-run overlay and Month's whole-day cells. A flat\n * neutral tint at rest, `cursor-not-allowed` on hover (`pointer-events-auto`\n * is what lets it actually receive that hover instead of passing it through)\n * β€” the tint is load-bearing, not decorative flourish: `cursor` alone is a\n * hover-only affordance, invisible to a touch/mobile user who never hovers\n * anything, so a disabled slot needs an at-rest visual regardless of input\n * method. Year deliberately doesn't render this component at all β€” a flat\n * fill would read as a smudge at its much smaller mini-month cell size, so it\n * uses a muted day-number instead ([Β§10](../../../docs/rfcs/schedule.md)).\n *\n * `pointer-events-auto` here is still safe for the click-drag-to-create\n * gesture on the timed grid: its handlers read `e.currentTarget` (the\n * day-column) for all geometry, and its one `e.target`-based check just looks\n * for an ancestor event-chip, which this overlay never is β€” a pointerdown\n * landing on the overlay still bubbles to and arms the gesture normally. On\n * Month, a click here still bubbles to the day-cell's own `onClick`.\n *\n * DOM order matters: this renders *before* any chip at the same call site,\n * so an occupied portion of an otherwise-disabled range paints (and\n * hit-tests) as the chip, not this overlay β€” hovering an event never shows\n * `not-allowed`, only the empty disabled space around it does.\n */\nexport function ScheduleDisabledOverlay({\n className,\n style,\n}: {\n className?: string\n /** An explicit `top`/`height` (a partial run within a day-column) wins\n * over the base `inset-0`'s `top: 0; bottom: 0` per the CSS box-model\n * rule that a specified `height` overrides `bottom` β€” no `!important`\n * override needed. */\n style?: CSSProperties\n}) {\n return (\n <div\n aria-hidden\n data-schedule-part=\"disabled-overlay\"\n style={style}\n className={cn(\n \"pointer-events-auto absolute inset-0 cursor-not-allowed\",\n \"bg-black/4 dark:bg-white/6\",\n className,\n )}\n />\n )\n}\n","import { cn } from \"../../lib/cn\"\n\n/**\n * The move-drag preview. Same shape and same geometry as\n * `schedule-create-draft.tsx` β€” a permanently-mounted, `aria-hidden`,\n * pointer-events-none leaf driven purely by imperative CSS-var writes, never a\n * `useState` re-render per `pointermove` β€” and, like it, **one per day\n * column**.\n *\n * It used to be a single element at the grid level, placed by writing\n * `gridColumn`, which needed no horizontal pixel math. That was elegant and it\n * was wrong for one case: an event dragged across a day boundary occupies two\n * days, and one box can only ever draw one of them. Its own comment admitted\n * as much (\"the ghost shows the *first* day's piece\"), so dragging an event up\n * through midnight drew the piece on the previous day and simply omitted the\n * piece under the pointer. Per-column leaves draw every piece, exactly the way\n * a committed multi-day event already renders.\n *\n * `--sch-ghost-top`/`--sch-ghost-height` are percentages of the day column's\n * own height, exactly like a chip's `--sch-base-top`/`--sch-base-height`, so\n * the ghost lines up with the hour grid without knowing the hour height.\n */\nexport function ScheduleDragGhost({ className }: { className?: string }) {\n return (\n <div\n aria-hidden\n data-schedule-part=\"drag-ghost\"\n // `hidden` until a gesture arms it: `data-active` is written alongside\n // the position vars, so there is exactly one signal to clear on release.\n // `select-none` because the readout sits under the moving pointer, and\n // `pointer-events-none` stops hit-testing, not text selection.\n // `z-26` clears the chips it is drawn over (10-15, 25 on hover/focus)\n // while staying under the sticky gutter (30) β€” same band, and same\n // reasoning, as the create draft's own.\n className={cn(\n \"group pointer-events-none absolute inset-x-0 z-26 hidden select-none rounded-sm\",\n // The piece carrying the readout paints above its siblings β€” same\n // collision the create draft has, for the same reason: the label is\n // deliberately wider than its own column so a cross-day range is not\n // truncated, which puts it under the next piece's left border. Scoped\n // by `:has()` to the piece that actually has a label, since\n // `paintPieces` writes one onto the candidate's first visible piece only.\n \"[&:has([data-schedule-part=drag-ghost-label]:not(:empty))]:z-27\",\n \"border-2 border-brand-500/70 bg-brand-500/15 data-active:block\",\n // Fades in and out rather than blinking. `data-active` toggles\n // `display`, which a transition normally cannot touch, so `display` is\n // named in the property list and `transition-discrete`\n // (`transition-behavior: allow-discrete`) keeps the element rendered\n // for the duration of the leave β€” without it the fade-out has nothing\n // to paint, because `display: none` applies the instant the attribute\n // clears. `starting:` supplies the `@starting-style` the enter needs;\n // without it the element is already at full opacity on its first\n // rendered frame and only the leave animates.\n //\n // Opacity *and* scale, the same pairing `schedule-chip-in` uses, on the\n // same expo curve the chip/popover/toast entrances share β€” a 150ms\n // opacity-only fade measured correctly and was still imperceptible,\n // because it plays exactly where the eye already is and lasts less\n // than a fifth of a second.\n //\n // The resting scale is >1, not <1, which is what makes the *leave*\n // visible at all: the committed chip lands at the drop the instant the\n // pointer lifts, at the ghost's own position and size, so a ghost\n // shrinking inward fades entirely behind it. Growing outward puts the\n // fading rim outside the chip's edges where it can actually be seen,\n // and reads as a release rather than a disappearance. A transition\n // returns to one base value in both directions, so this single number\n // gives the enter a settle-inward and the leave an expand-outward.\n \"opacity-0 scale-105 data-active:opacity-100 data-active:scale-100\",\n /**\n * One `transition` shorthand rather than the utilities, because\n * `transition-property` can only be set once and these want different\n * timings β€” the fade 200ms, the geometry 70ms.\n *\n * `scale`, not `transform`: Tailwind v4's `scale-*` drives the\n * standalone `scale` property, so naming `transform` transitions\n * nothing and the ghost jumps between the two sizes.\n *\n * NOT the `cubic-bezier(0.16, 1, 0.3, 1)` the chip/popover entrances\n * share, for the opacity. That is an expo-out tuned for a small\n * transform, and on an opacity it front-loads so hard the fade is ~70%\n * done in the first 15% of its duration β€” measured, at 2000ms, still\n * effectively gone by 300ms. It reads as a blink at any duration, the\n * same trap the RFC records for the page-turn slide. Easing per\n * direction instead, which a transition takes from whichever state it\n * heads *to*: `ease-out` in so the ghost arrives promptly, `ease-in`\n * out so it holds opacity long enough to be seen leaving.\n *\n * `top`/`height` ease the slot-to-slot jumps, matching the create\n * draft. `ease-out` at 45ms, *not* a steep ease-in-out: measured over a\n * single slot jump, the steep curve moved only 4% of the distance on\n * its first frame before whipping across, which reads as the ghost\n * clinging to the slot it is leaving. `ease-out` covers 73% on the\n * first frame and is done by the second β€” and it sits on a resting\n * position slightly *more* of the time (77% of frames vs 73%), so it\n * is both snappier and more obviously snapped. `height` never changes\n * during a move (a move preserves duration) and is listed only so the\n * two previews stay one declaration apart.\n *\n * Only the vertical smooths. Moving to another day swaps to a different\n * element β€” one ghost piece per day column β€” so a CSS transition has\n * nothing to interpolate across that axis.\n */\n \"[transition:opacity_200ms_ease-in,scale_200ms_ease-in,display_200ms_ease-in_allow-discrete,top_45ms_ease-out,height_45ms_ease-out]\",\n \"data-active:[transition:opacity_200ms_ease-out,scale_200ms_ease-out,display_200ms_ease-out_allow-discrete,top_45ms_ease-out,height_45ms_ease-out]\",\n \"starting:data-active:opacity-0 starting:data-active:scale-105\",\n // `!` and the full shorthand, not `transition-none`: the `data-active`\n // rule above is a class *and* an attribute selector, so a plain\n // `motion-reduce:transition-none` loses to it and the preview kept\n // animating for a user who asked it not to β€” measured, the active ghost\n // still reported all five properties under `prefers-reduced-motion`.\n \"motion-reduce:[transition:none]!\",\n // Mirrors the chip's own rejection tint, so \"this won't stick\" reads\n // identically whether the feedback is on a chip or on this preview.\n \"data-invalid:border-red-500/70 data-invalid:bg-red-500/15\",\n // Squared off where the event continues past this day, the same cue a\n // real clipped chip and the create draft both use.\n \"data-continues-before:rounded-t-none data-continues-before:border-t-0\",\n \"data-continues-after:rounded-b-none data-continues-after:border-b-0\",\n className,\n )}\n style={{ top: \"var(--sch-ghost-top, 0%)\", height: \"var(--sch-ghost-height, 0%)\" }}\n >\n {/* The live drop-time readout. Both products that ship drag-to-page pair\n * the gesture with one, and for the same reason: once the view can move\n * under you, the grid behind the pointer stops answering \"where is this\n * going to land\". Written by direct `textContent`, only when the\n * snapped value actually changes, and only onto the first visible\n * piece. */}\n <span\n data-schedule-part=\"drag-ghost-label\"\n className={cn(\n \"pointer-events-none absolute start-1 top-0 truncate rounded-xs px-1 py-px\",\n \"font-medium text-[0.6875rem] text-brand-950 leading-none dark:text-white\",\n // Fully opaque, deliberately β€” this was `/85` with a `backdrop-blur`,\n // on the reasoning the grid's own sticky chrome uses. That is right\n // for a large surface and wrong for a small readout: blurring spreads\n // what is behind, it does not remove it, so the box's own top border\n // (which the label straddles) still crossed the digits as a soft\n // bright band, and the chip's resize grip did the same. At a pill\n // this size there is nothing to gain from letting anything through,\n // and this is a value the user reads mid-gesture.\n \"bg-brand-500 group-data-invalid:bg-red-500 group-data-invalid:text-white\",\n // Sits just above a box that is too short to hold it, so a 15-minute\n // event's label never overflows into the slot below.\n \"-translate-y-1/2\",\n // Sized to its own text: a cross-day range is day-qualified and far\n // wider than one column, and clamping it truncated away the end day.\n \"w-max max-w-[calc(250%-0.5rem)]\",\n // An empty label (every piece after the first) must not paint its\n // own background chip.\n \"empty:hidden\",\n )}\n />\n </div>\n )\n}\n","/**\n * RFC Β§7 (`docs/rfcs/schedule.md`) snapping β€” applied only at drag/resize\n * commit, never live (a smooth 1:1 drag with a live-updating snapped-time\n * label is tactile; snapping the chip's actual position on every\n * `pointermove` would visibly jump).\n */\n\nimport { match } from \"ts-pattern\"\nimport { addCalendarDays, dayBoundary } from \"./schedule-dates\"\nimport type { ScheduleCollision, ScheduleSlotDuration, ScheduleSlotProps } from \"./schedule-types\"\n\n/** Round `minutes` to the nearest multiple of `incrementMinutes`. */\nexport function snapToIncrement(minutes: number, incrementMinutes: number): number {\n if (incrementMinutes <= 0) return minutes\n return Math.round(minutes / incrementMinutes) * incrementMinutes\n}\n\n/** `date` shifted by `deltaMinutes`, snapped to `incrementMinutes` first. */\nexport function addSnappedMinutes(\n date: Date,\n deltaMinutes: number,\n incrementMinutes: number,\n): Date {\n const snapped = snapToIncrement(deltaMinutes, incrementMinutes)\n return new Date(date.getTime() + snapped * 60_000)\n}\n\n/**\n * A whole range displaced by `days` calendar days and `minutes` minutes, with\n * the minute component snapped to `slotDuration`.\n *\n * **Both edges take the identical shift**, which is what makes \"a move never\n * changes an event's duration\" true by construction rather than by a check β€”\n * including for a multi-day event, which stays exactly as long as it was and\n * simply re-segments across whatever days it now covers.\n *\n * This replaces the older per-edge `addSnappedMinutes`, which required every\n * caller to remember to move the *other* edge by the same amount. That was the\n * shape that made a two-axis drag easy to get wrong, so it is gone rather than\n * kept alongside.\n */\nexport function moveRange(\n range: { start: Date; end: Date },\n delta: { days: number; minutes: number },\n options: { timeZone: string; slotDuration: number },\n): { start: Date; end: Date } {\n const minutes = snapToIncrement(delta.minutes, options.slotDuration)\n const shift = (date: Date) =>\n new Date(addCalendarDays(date, delta.days, options.timeZone).getTime() + minutes * 60_000)\n return { start: shift(range.start), end: shift(range.end) }\n}\n\n/**\n * One edge of a range displaced by `days` calendar days and `minutes`\n * minutes, with the minute component snapped to `slotDuration` β€” the resize\n * counterpart to `moveRange`, and the reason resize can reach another day at\n * all.\n *\n * The day component goes through `addCalendarDays` for the same reason\n * `moveRange`'s does: `+ n * 86_400_000` silently drifts an hour across a DST\n * boundary.\n *\n * The duration floor clamps the **result**, not the proposed delta. Clamping\n * the delta is what the vertical-only version did, and it can't express the\n * floor once a whole-day component exists β€” but the two agree exactly on the\n * same-day path, since the clamped result (`start + floor`, or `end - floor`)\n * is itself an exact instant rather than a rounded one.\n *\n * **`collision` decides what happens once the grip reaches that floor**\n * (`ScheduleCollision`, modelled on zag's `thumbCollisionBehavior` β€” see\n * `handleNone`/`handlePush`/`handleSwap` in `@zag-js/slider`'s\n * `slider.utils`). `\"none\"` is the original behaviour and the default, so an\n * unqualified call is unchanged.\n *\n * Two deliberate differences from zag, both consequences of this being a pure\n * function rather than a live state machine:\n *\n * - zag's `handleSwap` needs the gesture's origin value to tell a real\n * crossing from jitter (`value >= nextThumb && value > startValue`). No\n * equivalent is needed here: `displaced` is derived from the edge's own\n * *pre-gesture* value, so for the start edge `displaced >= end` already\n * implies it travelled forward past where it began. No gesture state, and\n * nothing for a caller to thread through.\n * - zag documents `\"push\"` as pushing \"without restoring their previous\n * positions when dragged back\", because it mutates live state and commits\n * continuously. This computes every frame from the pre-gesture range and\n * only commits on release, so dragging back *does* restore exactly β€” which\n * is the right behaviour for a preview the user hasn't committed to yet.\n */\nexport function resizeRange(\n range: { start: Date; end: Date },\n edge: \"start\" | \"end\",\n delta: { days: number; minutes: number },\n options: {\n timeZone: string\n slotDuration: number\n minDurationMinutes: number\n maxDurationMinutes?: number\n collision?: ScheduleCollision\n },\n): { start: Date; end: Date } {\n const next = resizeWithinFloor(range, edge, delta, options)\n // An event already longer than the cap may shrink but never grow β€” capping\n // it outright would snap it short on the first pixel of movement.\n const capMs = Math.max(\n durationBounds(options).max * 60_000,\n range.end.getTime() - range.start.getTime(),\n )\n if (next.end.getTime() - next.start.getTime() <= capMs) return next\n // Past the cap, the edge that wasn't grabbed is always one of the two ends β€”\n // even after a `\"swap\"`, which only outgrows the floor once the grip has run\n // past it, leaving the old far edge as the near one. Keep it put and pull\n // the other back.\n const fixed = edge === \"start\" ? range.end.getTime() : range.start.getTime()\n const moving = next.start.getTime() === fixed ? next.end.getTime() : next.start.getTime()\n const [low, high] = boundDuration(fixed, moving, { min: 0, max: capMs })\n return { start: new Date(low), end: new Date(high) }\n}\n\nfunction resizeWithinFloor(\n range: { start: Date; end: Date },\n edge: \"start\" | \"end\",\n delta: { days: number; minutes: number },\n options: {\n timeZone: string\n slotDuration: number\n minDurationMinutes: number\n collision?: ScheduleCollision\n },\n): { start: Date; end: Date } {\n const minutes = snapToIncrement(delta.minutes, options.slotDuration)\n const shifted = (date: Date) =>\n addCalendarDays(date, delta.days, options.timeZone).getTime() + minutes * 60_000\n const floorMs = options.minDurationMinutes * 60_000\n const start = range.start.getTime()\n const end = range.end.getTime()\n const displaced = shifted(edge === \"start\" ? range.start : range.end)\n\n // The furthest the dragged edge may travel before it is closer to the other\n // edge than the floor allows, and the point past which the two have actually\n // crossed. Between them lies the band where `\"swap\"` has not triggered yet\n // and still clamps β€” zag's `handleSwap` falls through to `handleNone` there.\n const limit = edge === \"start\" ? end - floorMs : start + floorMs\n const crossed = edge === \"start\" ? displaced > limit : displaced < limit\n if (!crossed) {\n return edge === \"start\"\n ? { start: new Date(displaced), end: range.end }\n : { start: range.start, end: new Date(displaced) }\n }\n\n const at = (low: number, high: number) => ({ start: new Date(low), end: new Date(high) })\n\n return (\n match(options.collision ?? \"none\")\n .with(\"none\", () => (edge === \"start\" ? at(limit, end) : at(start, limit)))\n // The grip keeps its value and the other edge follows, so the event holds\n // exactly the floor and slides as one.\n .with(\"push\", () =>\n edge === \"start\" ? at(displaced, displaced + floorMs) : at(displaced - floorMs, displaced),\n )\n .with(\"swap\", () => {\n if (edge === \"start\") {\n // Still short of the other edge: clamp, exactly as `\"none\"` would.\n if (displaced < end) return at(limit, end)\n // Crossed. The old `end` becomes the near edge and the grip now drives\n // the far one; the floor is then re-applied to the pair, which is what\n // keeps the degenerate \"released exactly on the other edge\" case a\n // valid range rather than a zero-length one.\n const high = Math.max(displaced, start + floorMs)\n return at(Math.min(end, high - floorMs), high)\n }\n if (displaced > start) return at(start, limit)\n const low = Math.min(displaced, end - floorMs)\n return at(low, Math.max(start, low + floorMs))\n })\n .exhaustive()\n )\n}\n\n/**\n * The `[min, max]` duration a gesture may produce, in minutes.\n *\n * The ceiling is floored to a whole number of slots, so a capped edge still\n * lands on a gridline the user can see, and it never drops below the floor β€”\n * a cap under one slot (or `<= 0`) simply means \"exactly the floor\". Absent,\n * there is no ceiling.\n */\nexport function durationBounds(options: {\n slotDuration: number\n minDurationMinutes: number\n maxDurationMinutes?: number\n}): { min: number; max: number } {\n const { slotDuration, minDurationMinutes: min, maxDurationMinutes } = options\n if (maxDurationMinutes === undefined) return { min, max: Number.POSITIVE_INFINITY }\n const onGrid =\n slotDuration > 0\n ? Math.floor(maxDurationMinutes / slotDuration) * slotDuration\n : maxDurationMinutes\n return { min, max: Math.max(min, onGrid) }\n}\n\nconst SLOT_DURATIONS = [15, 30, 60] as const satisfies readonly ScheduleSlotDuration[]\n\nconst DAY_MINUTES = 24 * 60\n\n/** The runtime twin of `SlotMultiple`: a whole number of slots up to a day,\n * then whole days up to a week. */\nconst isSlotMultiple = (minutes: number, slot: number) =>\n Number.isInteger(minutes) &&\n minutes > 0 &&\n minutes % slot === 0 &&\n (minutes <= DAY_MINUTES || (minutes % DAY_MINUTES === 0 && minutes <= 7 * DAY_MINUTES))\n\n/**\n * Narrows slot values read at runtime β€” from an API, a settings form β€” to the\n * `ScheduleSlotProps` the compiler checks a literal against. It checks the\n * three together, so `minDuration` and `maxDuration` are judged against the\n * `slotDuration` passed with them, and an absent `slotDuration` means 15.\n *\n * @example\n * const slots = { slotDuration: rules.granularity, minDuration: rules.minimum }\n * <Schedule {...(isScheduleSlotProps(slots) ? slots : {})} />\n */\nexport function isScheduleSlotProps(values: {\n slotDuration?: number\n minDuration?: number\n maxDuration?: number\n}): values is ScheduleSlotProps {\n const slot = values.slotDuration ?? 15\n return (\n SLOT_DURATIONS.some((allowed) => allowed === slot) &&\n [values.minDuration, values.maxDuration].every(\n (minutes) => minutes === undefined || isSlotMultiple(minutes, slot),\n )\n )\n}\n\n/**\n * The slot size and the duration bounds a timed grid actually runs with β€” the\n * runtime backstop for `ScheduleSlotProps`, which already rejects every value\n * this corrects at compile time. It only does anything for a value that got\n * past the types: a widened `number`, a cast, or a plain-JS consumer.\n *\n * - `slotDuration` outside `15 | 30 | 60` snaps to the nearest one.\n * - `minDuration` rounds **up** to a whole number of slots and is never less\n * than one β€” rounding down could allow an event shorter than asked for.\n * - `maxDuration` rounds **down**, so a capped edge lands on a gridline, and\n * is never less than `minDuration`.\n *\n * `issues` says what was corrected, for the caller to warn about; this stays\n * pure so it can run on every render.\n */\nexport function resolveSlotDurations(options: {\n slotDuration: number\n minDuration?: number\n maxDuration?: number\n}): {\n slotDuration: ScheduleSlotDuration\n minDuration: number\n maxDuration?: number\n issues: string[]\n} {\n const issues: string[] = []\n const slot = SLOT_DURATIONS.reduce((best, candidate) =>\n Math.abs(candidate - options.slotDuration) < Math.abs(best - options.slotDuration)\n ? candidate\n : best,\n )\n if (slot !== options.slotDuration) {\n issues.push(\n `\\`slotDuration={${options.slotDuration}}\\` is not one of 15, 30 or 60 β€” using ${slot}.`,\n )\n }\n const min = Math.max(slot, Math.ceil((options.minDuration ?? slot) / slot) * slot)\n if (options.minDuration !== undefined && min !== options.minDuration) {\n issues.push(\n `\\`minDuration={${options.minDuration}}\\` is not a whole number of ${slot}-minute slots β€” using ${min}.`,\n )\n }\n if (options.maxDuration === undefined) return { slotDuration: slot, minDuration: min, issues }\n const max = Math.max(min, Math.floor(options.maxDuration / slot) * slot)\n if (max !== options.maxDuration) {\n issues.push(\n options.maxDuration < min\n ? `\\`maxDuration={${options.maxDuration}}\\` is below \\`minDuration\\` β€” using ${max}.`\n : `\\`maxDuration={${options.maxDuration}}\\` is not a whole number of ${slot}-minute slots β€” using ${max}.`,\n )\n }\n return { slotDuration: slot, minDuration: min, maxDuration: max, issues }\n}\n\n/**\n * `[low, high]` from a fixed point and a moving one, with the distance between\n * them held within `bounds` by moving only the moving end β€” the fixed one is\n * where the gesture was anchored, and never jumps. Unit-agnostic: callers pass\n * ms or minutes, as long as `bounds` uses the same unit.\n *\n * A zero distance grows forward, which is what a press-and-release inside one\n * slot has always drafted.\n */\nexport function boundDuration(\n fixed: number,\n moving: number,\n bounds: { min: number; max: number },\n): [number, number] {\n const direction = moving < fixed ? -1 : 1\n const length = Math.min(Math.max(Math.abs(moving - fixed), bounds.min), bounds.max)\n const other = fixed + direction * length\n return direction < 0 ? [other, fixed] : [fixed, other]\n}\n\n/**\n * How a create drag turns its two endpoints into events.\n *\n * - `\"span\"` β€” one event over the absolute timeline between them, so pressing\n * Sunday 22:00 and releasing Monday 02:00 drafts four hours (left button).\n * - `\"repeat\"` β€” one event per day between them, each over the same time of\n * day, so Day 1 08:00 β†’ Day 3 16:00 drafts three 08:00–16:00 events (right\n * button).\n */\nexport type ScheduleCreateMode = \"span\" | \"repeat\"\n\n/**\n * The snapped candidate events for a create drag.\n *\n * Both endpoints are expressed as an unsnapped minute offset into a day\n * column's band, and a column as a calendar-day offset from the anchor's β€” the\n * same space the grid is painted in, so every range lands exactly where its\n * draft is drawn. Each end snaps within its *own* column's band.\n *\n * `\"repeat\"` normalises the two axes separately β€” the days to `[lo, hi]`, the\n * times to `[earlier, later]` β€” so dragging \"backwards\" from Day 3 16:00 to\n * Day 1 08:00 is the same gesture as the forward one. Its times are also held\n * inside the band: a per-day event belongs to its day by definition, so unlike\n * `\"span\"` it never rolls past the column's bottom into the next day, and a\n * floor that would overhang the band's end is slid back inside it instead.\n */\nexport function createRanges(\n anchor: { day: Date; minutes: number },\n cursor: { dayOffset: number; minutes: number },\n options: {\n mode: ScheduleCreateMode\n timeZone: string\n startHour: number\n endHour: number\n slotDuration: number\n minDurationMinutes: number\n maxDurationMinutes?: number\n },\n): { start: Date; end: Date }[] {\n const { timeZone, startHour, endHour, slotDuration } = options\n const bounds = durationBounds(options)\n const bandStart = (dayOffset: number) =>\n dayBoundary(addCalendarDays(anchor.day, dayOffset, timeZone), startHour, timeZone).getTime()\n const snap = (minutes: number) => snapToIncrement(minutes, slotDuration)\n const toRange = (low: number, high: number) => ({ start: new Date(low), end: new Date(high) })\n\n return match(options.mode)\n .with(\"span\", () => {\n const fixed = bandStart(0) + snap(anchor.minutes) * 60_000\n const moving = bandStart(cursor.dayOffset) + snap(cursor.minutes) * 60_000\n const [low, high] = boundDuration(fixed, moving, {\n min: bounds.min * 60_000,\n max: bounds.max * 60_000,\n })\n return [toRange(low, high)]\n })\n .with(\"repeat\", () => {\n const bandMinutes = (endHour - startHour) * 60\n const inBand = (minutes: number) => Math.min(Math.max(snap(minutes), 0), bandMinutes)\n const [low, high] = boundDuration(inBand(anchor.minutes), inBand(cursor.minutes), bounds)\n const overhang = Math.max(0, high - bandMinutes)\n const first = Math.min(0, cursor.dayOffset)\n return Array.from({ length: Math.abs(cursor.dayOffset) + 1 }, (_, i) => {\n const start = bandStart(first + i)\n return toRange(start + (low - overhang) * 60_000, start + (high - overhang) * 60_000)\n })\n })\n .exhaustive()\n}\n","\"use client\"\n\nimport { devWarn } from \"../../lib/dev-warn\"\n\n/**\n * The parts of a timed-grid pointer gesture that are the *same* for moving,\n * resizing and creating an event: resolving which day column the pointer is\n * over, and what happens when it reaches the grid's edge.\n *\n * All of this began as module-private helpers inside `use-event-drag.ts`,\n * which was the only two-axis gesture. Once create and resize grew a day axis\n * of their own they needed the identical logic, and a second copy is exactly\n * the shape the four browser-only bugs recorded in RFC Β§19 came from β€” each of\n * them passed the whole test suite in a version where it was wrong. One copy,\n * one place to fix.\n *\n * Nothing here holds React state. A gesture owns a plain object (a ref, never\n * `useState` β€” RFC Β§6's sanctioned exception for in-flight coordinates) and\n * passes it back in; these functions only read and mutate that object.\n */\n\n/** px of pointer movement under which a press counts as a click, not a drag\n * β€” the same value the toast notifier's `CLICK_SLOP` uses. */\nexport const CLICK_SLOP = 5\n\n/** How close to the grid's edge the pointer must be for auto-scroll to kick\n * in. Roughly a finger's width, so it is reachable without being easy to\n * enter by accident mid-drag. */\nexport const EDGE_BAND_PX = 48\n\n/** Cap on auto-scroll speed, px per frame. Ramped by how deep into the band\n * the pointer is, so easing toward the edge gives fine control and pinning\n * against it moves quickly. */\nexport const MAX_SCROLL_PX_PER_FRAME = 18\n\n/**\n * How long the pointer must be held at an edge that can no longer scroll\n * before the view pages to the next range.\n *\n * Deliberately long. Syncfusion β€” the one component library that ships this\n * gesture β€” defaults to 2000ms on web and ~1000ms on Flutter, and the only\n * other shipped precedent uses a comparable dwell. A short delay turns \"I\n * overshot slightly\" into a silent week-long jump, which is the failure this\n * whole feature has to avoid.\n */\nexport const PAGINATE_DWELL_MS = 1500\n\n/**\n * The outgoing band a page turn keeps mounted for one animation is a real,\n * fully-rendered copy of the *previous* range β€” same `data-day-index` values,\n * same `data-event-id`s. Every gesture query has to skip it, or a drag that\n * paged mid-gesture would re-measure a doubled, non-monotonic column list,\n * `measureColumns`'s ordering guard would reject the whole layout, and the\n * gesture would silently degrade to one axis at exactly the moment it is\n * supposed to keep working.\n */\nconst isLive = (el: Element) => el.closest(\"[data-page-exiting]\") === null\n\n/** Every chip belonging to one event, across columns, excluding the outgoing\n * band. Shared by drag and resize, which both re-adopt their chips after a\n * page turn remounts them. */\nexport const liveChipsFor = (grid: HTMLElement, eventId: string): HTMLElement[] =>\n [\n ...grid.querySelectorAll<HTMLElement>(\n `[data-schedule-part='event-chip'][data-event-id=\"${CSS.escape(eventId)}\"]`,\n ),\n ].filter(isLive)\n\n/**\n * The live day column for one calendar day (`data-day-key`), or `null`.\n *\n * The sibling of `liveChipsFor` above, and filtered the same way β€” through\n * `isLive` rather than a `:not([data-page-exiting])` selector, since `closest`\n * also catches a column whose *ancestor* carries the flag.\n *\n * Keyed on the day, not on `data-day-index`: an index is relative to whatever\n * range happens to be rendered, which is the thing a reveal is trying to\n * resolve in the first place.\n */\nexport const liveDayColumnFor = (grid: HTMLElement, key: string): HTMLElement | null =>\n [\n ...grid.querySelectorAll<HTMLElement>(\n `[data-schedule-part='day-column'][data-day-key=\"${CSS.escape(key)}\"]`,\n ),\n ].filter(isLive)[0] ?? null\n\n/** One day column's horizontal extent, in client coordinates. */\nexport type ColumnBox = { index: number; left: number; right: number }\n\n/** A rejected layout is always a bug outside a test environment, and the\n * failure is otherwise completely silent β€” see `measureColumns`. Warned once\n * per session rather than per `pointerdown`: the check runs on every gesture\n * and, now that an unusable snapshot is re-measured, several times within one. */\nlet warnedUnusableColumns = false\n\n/**\n * The day columns' horizontal extents, or `[]` when they can't be trusted.\n *\n * The emptiness check is not defensive padding β€” it is what decides whether a\n * gesture has a horizontal axis at all. A layout is usable when every column\n * has real width: anything else (a display:none grid, a detached subtree, or\n * an environment with no layout engine at all β€” jsdom reports the *same*\n * all-zero box for every element) would otherwise resolve every pointer\n * position to whichever column happens to be first, and silently commit a\n * multi-day jump the user never asked for. Returning `[]` makes\n * `resolveDayIndex` fall through to \"the day doesn't change\", which degrades a\n * two-axis gesture to the one-axis gesture this component has always had.\n *\n * **Order is deliberately not asserted.** This used to also require\n * `c.left >= columns[i - 1].right` β€” DOM order rising left-to-right β€” which\n * quietly made the whole component LTR-only: under `dir=\"rtl\"` the columns\n * keep DOM order `0..N` (they are grid items with an explicit `gridColumn`)\n * while `rect.left` *decreases*, so the check failed at column 1 and the\n * entire list was thrown away. Create, drag and resize all measure through\n * here, which is why three independent gestures lost the same axis at once.\n *\n * Nothing downstream ever needed the order: `resolveDayIndex` scans with\n * `.find()`, and `paintPieces` consumes `columns.map(c => c.index)` as a set.\n * The ordering clause was carrying a requirement no caller had, at the cost of\n * every right-to-left locale. Dropping it also removes the missing-epsilon\n * fragility that clause had β€” a sub-pixel overlap between adjacent boxes would\n * have discarded the axis just as completely.\n *\n * `columns.length > 0` is now explicit: an empty list passed `.every`\n * vacuously and returned `[]` by accident rather than by decision.\n */\nexport const measureColumns = (grid: HTMLElement): ColumnBox[] => {\n const columns = [\n ...grid.querySelectorAll<HTMLElement>(\"[data-schedule-part='day-column'][data-day-index]\"),\n ]\n .filter(isLive)\n .map((el) => {\n const rect = el.getBoundingClientRect()\n return { index: Number(el.dataset[\"dayIndex\"]), left: rect.left, right: rect.right }\n })\n const usable = columns.length > 0 && columns.every((c) => c.right > c.left)\n if (!usable && !warnedUnusableColumns) {\n warnedUnusableColumns = true\n devWarn(\n \"Schedule: could not measure the day columns, so gestures will not cross days \" +\n \"(create, drag and resize all keep their starting day). This is expected in a test \" +\n \"environment with no layout engine; in a browser it means the grid was hidden, \" +\n \"detached, or had zero-width columns when the gesture began.\",\n )\n }\n return usable ? columns : []\n}\n\n/**\n * The gesture's column list, re-measured if the snapshot it is holding is\n * unusable.\n *\n * Every gesture snapshots `measureColumns` once at `pointerdown` and never\n * re-reads it (the sole exception being the pagination path below, which\n * re-measures because the columns genuinely changed). That makes a single bad\n * measurement *permanent*: `resolveDayIndex` falls back to \"the day doesn't\n * change\" for the entire life of the gesture, so a grid that was merely not\n * laid out yet at the instant of the press stays one-axis until the pointer is\n * released β€” even once the layout is perfectly fine a frame later.\n *\n * Re-measuring only when the list is empty keeps the normal path at exactly\n * one measurement per gesture, and costs a `getBoundingClientRect` per column\n * per move only in the case that is already broken.\n */\nexport const liveColumns = <S extends { grid: HTMLElement; columns: ColumnBox[] }>(\n state: S,\n): ColumnBox[] => {\n if (state.columns.length > 0) return state.columns\n state.columns = measureColumns(state.grid)\n return state.columns\n}\n\n/**\n * Which column contains `clientX`, or `fallbackIndex` when none does.\n *\n * Half-open `[left, right)` is load-bearing rather than stylistic: jsdom's\n * default rect is all zeros, so an inclusive test would match `clientX: 0`\n * against a zero-width rect and fabricate a drop onto day 0. It also matches\n * the exclusive-end convention Schedule uses everywhere else.\n *\n * The fallback is the single rule that absorbs every \"the pointer isn't over a\n * day\" case at once β€” over the gutter, over the sticky header, over the all-day\n * row, past the last column, outside the grid entirely, or in a test\n * environment with no layout. \"The day doesn't change\" is right for all of\n * them; clamping to the nearest column instead would make a gesture over the\n * gutter silently commit to day 0.\n */\nexport const resolveDayIndex = (\n columns: ColumnBox[],\n fallbackIndex: number,\n clientX: number,\n): number => columns.find((c) => clientX >= c.left && clientX < c.right)?.index ?? fallbackIndex\n\n/** How far, and which way, the pointer sits into an edge band: -1..1 scaled by\n * depth, or 0 when it is clear of both edges. */\nexport const edgePressure = (position: number, min: number, max: number): number => {\n if (position < min + EDGE_BAND_PX) {\n return -Math.min(1, (min + EDGE_BAND_PX - position) / EDGE_BAND_PX)\n }\n if (position > max - EDGE_BAND_PX) {\n return Math.min(1, (position - (max - EDGE_BAND_PX)) / EDGE_BAND_PX)\n }\n return 0\n}\n\n/** The candidate range, day-qualified only when it needs to be. A same-day\n * move reads \"12:00 – 13:00\"; anything crossing a date boundary gains the\n * weekday, because \"12:00 – 02:00\" is not a range anyone can parse.\n *\n * This readout is not decoration. Both products that ship drag-to-page pair\n * the gesture with one, and for the same reason: once the view can move under\n * the pointer, the grid behind it stops answering \"where will this land\".\n *\n * Formatted in the schedule's own `timeZone`, **unlike** `timeRangeLabel` and\n * the now-cursor's label, which are deliberately host-local (see\n * `schedule-dates.ts`). The difference is not an inconsistency: this readout\n * floats over a draft box whose position was derived from `dayBoundary` in\n * that same `timeZone`, so a host-local reading of it would name a different\n * day than the box it sits in β€” on a UTC+13 host, a `timeZone=\"UTC\"` schedule\n * rendered \"Thu 11:00\" as \"Fri 12:00 AM\". The whole point of the readout is\n * to answer \"which day does this land on\", so it has to answer in the\n * schedule's own clock.\n *\n * `hour: \"2-digit\"`, not `\"numeric\"` β€” the same SSR/ICU reasoning as\n * `schedule-dates.ts`'s own `timeRangeLabel`. */\nexport const formatCandidate = (\n next: { start: Date; end: Date },\n locale: string | undefined,\n timeZone: string | undefined,\n): string => {\n // Compared through a formatter rather than `toDateString()`, which reads the\n // host's calendar date and would call a UTC Thursday a Friday.\n const dateOnly = new Intl.DateTimeFormat(locale, {\n timeZone,\n year: \"numeric\",\n month: \"2-digit\",\n day: \"2-digit\",\n })\n const sameDay = dateOnly.format(next.start) === dateOnly.format(next.end)\n const time = new Intl.DateTimeFormat(locale, { timeZone, hour: \"2-digit\", minute: \"2-digit\" })\n const dayTime = new Intl.DateTimeFormat(locale, {\n timeZone,\n weekday: \"short\",\n hour: \"2-digit\",\n minute: \"2-digit\",\n })\n const fmt = sameDay ? time : dayTime\n return `${fmt.format(next.start)} – ${fmt.format(next.end)}`\n}\n\n/** The edge-behaviour half of a gesture's state. A gesture's own state object\n * extends this with whatever else it tracks. */\nexport type EdgeState = {\n grid: HTMLElement\n /** Latest pointer position, so the auto-scroll ticker can keep resolving a\n * candidate while the pointer itself is stationary. */\n clientX: number\n clientY: number\n scrollRaf: number | null\n paginateTimer: ReturnType<typeof setTimeout> | null\n /** Which edge the dwell timer is currently counting against, so moving to\n * the other edge restarts it rather than inheriting its progress. */\n paginateDirection: -1 | 1 | null\n /** Days the view has paged during this gesture. Column indices are relative\n * to whatever range is currently rendered, so a resolved index has to be\n * shifted back into the range the gesture started in β€” otherwise paging\n * forward would read as \"the user dragged backwards\". */\n paginationOffset: number\n /** Measured once at pointerdown; re-measured after a pagination, the only\n * thing that invalidates them. */\n columns: ColumnBox[]\n /**\n * The grid's own scrollable extent, frozen for the gesture (re-measured\n * only after a pagination, alongside `columns`).\n *\n * Recomputing this per frame let auto-scroll chase its own tail. A live\n * preview that grows the grid's `scrollHeight` β€” which an unclamped resize\n * stretch did β€” raises the ceiling, so the ticker scrolls further, which\n * enlarges the gesture's `dy` (every gesture measures it in *scroll* space,\n * so a stationary pointer over a moving grid still accumulates), which grows\n * the preview, which raises the ceiling again. Measured live it ran away:\n * a 900px drag produced a 4580px delta and took `scrollHeight` from 812 to\n * 5075. Frozen, the loop cannot close, whatever grows the container.\n */\n maxScrollLeft: number\n maxScrollTop: number\n}\n\n/** The scrollable extent of `grid` right now β€” snapshotted into `EdgeState`\n * at pointerdown, and again after a page turn. */\nexport const measureScrollExtent = (grid: HTMLElement) => ({\n maxScrollLeft: Math.max(0, grid.scrollWidth - grid.clientWidth),\n maxScrollTop: Math.max(0, grid.scrollHeight - grid.clientHeight),\n})\n\nexport type EdgeBehaviourOptions = {\n /** Repaint the preview from the last known pointer position. Called every\n * frame β€” the pointer can be stationary while the grid moves under it. */\n paint: () => void\n /** Whether this gesture is still the live one. Guards the two async hops\n * (the dwell timer and the post-pagination frame) against a gesture that\n * ended, or was replaced, while they were pending. */\n isLive: () => boolean\n /** Page the view by one range. Omitting it leaves auto-scroll working and\n * simply never pages. */\n onPaginate?: (direction: -1 | 1) => void\n /** Runs on the frame after a pagination has rendered, once `columns` has\n * been re-measured β€” for re-adopting DOM nodes that remounted with the new\n * range. */\n onAfterPaginate?: () => void\n}\n\nexport const stopEdgeBehaviours = (state: EdgeState) => {\n if (state.scrollRaf !== null) cancelAnimationFrame(state.scrollRaf)\n if (state.paginateTimer !== null) clearTimeout(state.paginateTimer)\n state.scrollRaf = null\n state.paginateTimer = null\n state.paginateDirection = null\n}\n\n/**\n * One frame of edge behaviour: scroll while the grid still can, and once it\n * cannot, start (or keep) the dwell that pages the view.\n *\n * The two are sequential rather than simultaneous on purpose β€” paging while\n * there is still un-scrolled range left would skip over days the user can\n * simply scroll to, which is both surprising and irreversible-feeling. It is\n * also the split the prior art draws (Syncfusion's `allowScroll` /\n * `allowNavigation`), and the one place the two differ in precedent: auto-\n * scrolling during a *create* drag is well precedented (FullCalendar's\n * `dragScroll` covers \"date selecting\" and defaults to `true`), while auto-\n * paging during one is not documented anywhere. Keeping them as separate\n * stages is what lets the unprecedented half stay behind a deliberate dwell.\n */\nexport const tickEdges = (state: EdgeState, options: EdgeBehaviourOptions) => {\n const grid = state.grid\n const rect = grid.getBoundingClientRect()\n const hx = edgePressure(state.clientX, rect.left, rect.right)\n const vy = edgePressure(state.clientY, rect.top, rect.bottom)\n\n // Frozen at pointerdown, deliberately not re-read here β€” see\n // `EdgeState.maxScrollLeft`.\n const maxLeft = state.maxScrollLeft\n const maxTop = state.maxScrollTop\n const beforeLeft = grid.scrollLeft\n if (hx !== 0) {\n grid.scrollLeft = Math.max(0, Math.min(maxLeft, grid.scrollLeft + hx * MAX_SCROLL_PX_PER_FRAME))\n }\n if (vy !== 0) {\n grid.scrollTop = Math.max(0, Math.min(maxTop, grid.scrollTop + vy * MAX_SCROLL_PX_PER_FRAME))\n }\n\n // Horizontal only: there is no \"next range\" vertically β€” the day is already\n // fully rendered, so the vertical edge just scrolls.\n const direction: -1 | 1 | null = hx < 0 ? -1 : hx > 0 ? 1 : null\n const stuck = hx !== 0 && grid.scrollLeft === beforeLeft\n if (direction !== null && stuck && options.onPaginate) {\n if (state.paginateDirection !== direction) {\n if (state.paginateTimer !== null) clearTimeout(state.paginateTimer)\n state.paginateDirection = direction\n state.paginateTimer = setTimeout(() => {\n if (!options.isLive()) return\n const columnCount = state.columns.length || 1\n // Column indices are relative to whatever range is rendered, so record\n // the shift before the DOM changes underneath us.\n state.paginationOffset += direction * columnCount\n state.paginateTimer = null\n state.paginateDirection = null\n options.onPaginate?.(direction)\n // The new range renders on the next frame; re-measure then, and\n // repaint from the same stationary pointer position.\n requestAnimationFrame(() => {\n if (!options.isLive()) return\n state.columns = measureColumns(state.grid)\n // A page turn is the one thing that legitimately changes the extent,\n // and by this frame the outgoing band is gone β€” measuring here rather\n // than per frame also avoids the dual-rendered band briefly doubling\n // it.\n Object.assign(state, measureScrollExtent(state.grid))\n options.onAfterPaginate?.()\n options.paint()\n })\n }, PAGINATE_DWELL_MS)\n }\n } else if (state.paginateTimer !== null) {\n // Left the edge, or the grid can still scroll β€” the dwell restarts from\n // zero rather than resuming where it left off.\n clearTimeout(state.paginateTimer)\n state.paginateTimer = null\n state.paginateDirection = null\n }\n\n options.paint()\n state.scrollRaf =\n hx !== 0 || vy !== 0 ? requestAnimationFrame(() => tickEdges(state, options)) : null\n}\n\n/* ── The draft preview ──────────────────────────────────────────────────────\n *\n * One `schedule-create-draft.tsx` leaf is mounted per day column, and a single\n * gesture writes to all of them. Both authoring gestures need this: a create\n * drag uses it for its whole preview, and a resize falls back to it the moment\n * its edge leaves the chip's own day, where the chip's `--sch-resize-delta-y`\n * stretch stops being able to represent the candidate at all.\n */\n\n/** Which per-column preview leaf a gesture paints into. Create and resize paint\n * the draft; a move paints the ghost. Same geometry, and since the draft lost\n * its dashes the same skin too β€” they are the same kind of object (\"the box\n * you are about to commit\") and never appear at once. */\nexport type PiecePreview = {\n /** `data-schedule-part` of the leaf, one per day column. */\n part: string\n topVar: string\n heightVar: string\n labelPart: string\n}\n\nexport const CREATE_DRAFT: PiecePreview = {\n part: \"create-draft\",\n topVar: \"--sch-create-top\",\n heightVar: \"--sch-create-height\",\n labelPart: \"create-draft-label\",\n}\n\nexport const DRAG_GHOST: PiecePreview = {\n part: \"drag-ghost\",\n topVar: \"--sch-ghost-top\",\n heightVar: \"--sch-ghost-height\",\n labelPart: \"drag-ghost-label\",\n}\n\nexport const collectPieces = (\n grid: HTMLElement,\n preview: PiecePreview,\n): Map<number, HTMLElement> => {\n const drafts = new Map<number, HTMLElement>()\n for (const column of grid.querySelectorAll<HTMLElement>(\n \"[data-schedule-part='day-column'][data-day-index]\",\n )) {\n if (!isLive(column)) continue\n const draft = column.querySelector<HTMLElement>(`[data-schedule-part='${preview.part}']`)\n if (draft) drafts.set(Number(column.dataset[\"dayIndex\"]), draft)\n }\n return drafts\n}\n\nconst pieceLabel = (piece: HTMLElement, preview: PiecePreview) =>\n piece.querySelector<HTMLElement>(`[data-schedule-part='${preview.labelPart}']`)\n\nconst clearDraft = (draft: HTMLElement) => {\n delete draft.dataset[\"active\"]\n delete draft.dataset[\"invalid\"]\n delete draft.dataset[\"continuesBefore\"]\n delete draft.dataset[\"continuesAfter\"]\n}\n\nexport const hidePieces = (pieces: Map<number, HTMLElement>, preview: PiecePreview) => {\n for (const piece of pieces.values()) {\n clearDraft(piece)\n // The geometry vars are deliberately *left in place*. Clearing them\n // collapsed the piece to a 0% height the instant `data-active` went, which\n // left the leave transition (`schedule-drag-ghost.tsx`) nothing to paint β€”\n // the piece was already invisible before it began fading. They are\n // overwritten by `paintPieces` before the piece is ever shown again, and a\n // hidden piece is `display: none`, so stale values cost nothing.\n const label = pieceLabel(piece, preview)\n if (label) label.textContent = \"\"\n }\n}\n\n/** The same scale-pulse the chip gestures use, applied to every visible piece. */\nexport const flashPieces = (drafts: Map<number, HTMLElement>, reason: \"disabled\" | \"overlap\") => {\n for (const draft of drafts.values()) {\n if (draft.dataset[\"active\"] !== \"true\") continue\n draft.style.transition = \"transform 120ms ease-out\"\n draft.style.transform = \"scale(0.98)\"\n draft.dataset[\"scheduleRejectReason\"] = reason\n requestAnimationFrame(() => {\n draft.style.transition = \"\"\n draft.style.transform = \"\"\n delete draft.dataset[\"scheduleRejectReason\"]\n })\n }\n}\n\n/** One candidate the painter draws: a range, whether it would be rejected,\n * and its readout. */\nexport type PieceCandidate = {\n /** Epoch ms. */\n range: { start: number; end: number }\n invalid: boolean\n /** Already formatted by `formatCandidate`; rides the candidate's first\n * visible piece. */\n label: string\n}\n\nexport type PiecePaintOptions = {\n pieces: Map<number, HTMLElement>\n preview: PiecePreview\n /** The day indices to consider, in ascending order. */\n columnIndices: number[]\n /** That column's painted band, as epoch ms. */\n bandOfColumn: (index: number) => { start: number; end: number }\n /** Non-overlapping, so a column shows at most one of them. A single-event\n * gesture passes one; a repeat create passes one per day. */\n candidates: PieceCandidate[]\n totalWindowMinutes: number\n}\n\n/**\n * Draw candidates as one piece per day, each clipped to that column's band β€”\n * the same single intersection `segmentEvents` performs, done imperatively so\n * a `pointermove` never costs a React render.\n *\n * A piece that doesn't reach its candidate's real start or end is marked\n * `data-continues-before`/`-after`, which is what gives it the squared-off cut\n * edge a real clipped chip already gets. A candidate running past the last\n * rendered day therefore reads as running off the end of the window, rather\n * than as a self-contained event that happens to stop at the edge.\n */\nexport const paintPieces = ({\n pieces,\n preview,\n columnIndices,\n bandOfColumn,\n candidates,\n totalWindowMinutes,\n}: PiecePaintOptions) => {\n const labelled = new Set<PieceCandidate>()\n for (const index of columnIndices) {\n const draft = pieces.get(index)\n if (!draft) continue\n const band = bandOfColumn(index)\n // Strict `<`, matching `segmentEvents` β€” a candidate ending exactly when a\n // band starts draws no phantom piece on that day.\n const candidate = candidates.find(\n ({ range }) => Math.max(range.start, band.start) < Math.min(range.end, band.end),\n )\n if (!candidate) {\n clearDraft(draft)\n continue\n }\n const { range } = candidate\n const pieceStart = Math.max(range.start, band.start)\n const pieceEnd = Math.min(range.end, band.end)\n const top = ((pieceStart - band.start) / 60_000 / totalWindowMinutes) * 100\n const height = ((pieceEnd - pieceStart) / 60_000 / totalWindowMinutes) * 100\n draft.style.setProperty(preview.topVar, `${top}%`)\n draft.style.setProperty(preview.heightVar, `${height}%`)\n draft.dataset[\"active\"] = \"true\"\n if (candidate.invalid) draft.dataset[\"invalid\"] = \"true\"\n else delete draft.dataset[\"invalid\"]\n if (pieceStart > range.start) draft.dataset[\"continuesBefore\"] = \"true\"\n else delete draft.dataset[\"continuesBefore\"]\n if (pieceEnd < range.end) draft.dataset[\"continuesAfter\"] = \"true\"\n else delete draft.dataset[\"continuesAfter\"]\n\n const labelEl = pieceLabel(draft, preview)\n if (labelEl) {\n const text = labelled.has(candidate) ? \"\" : candidate.label\n // Only on change: this runs every frame while auto-scrolling.\n if (labelEl.textContent !== text) labelEl.textContent = text\n labelled.add(candidate)\n }\n }\n}\n","\"use client\"\n\nimport type { PointerEvent as ReactPointerEvent } from \"react\"\nimport { useCallback, useRef } from \"react\"\nimport type { ScheduleSlotPredicate } from \"../../lib/schedule-predicates\"\nimport { addCalendarDays, checkRangeCommit, dayBoundary } from \"./schedule-dates\"\nimport { pixelsToMinutes } from \"./schedule-geometry\"\nimport {\n CLICK_SLOP,\n collectPieces,\n DRAG_GHOST,\n type EdgeState,\n formatCandidate,\n hidePieces,\n liveChipsFor,\n liveColumns,\n measureColumns,\n measureScrollExtent,\n paintPieces,\n resolveDayIndex,\n stopEdgeBehaviours,\n tickEdges,\n} from \"./schedule-grid-gesture\"\nimport { moveRange } from \"./schedule-snap\"\nimport type { ScheduleEvent } from \"./schedule-types\"\n\n/**\n * RFC Β§6 (`docs/rfcs/schedule.md`) move-drag, extended to two axes β€” vertical\n * moves the time, horizontal moves the day. Still modeled on the toast\n * notifier's swipe-to-dismiss (`notification/create-notifier.tsx`): a plain ref\n * (not state) tracks the in-flight gesture, and a movement under `CLICK_SLOP`\n * is a click rather than a drag.\n *\n * Three things differ from the single-axis version, all forced by the second\n * axis:\n *\n * **Listeners live on the grid, not the chip.** `setPointerCapture` targets the\n * grid element and `pointermove`/`pointerup` are attached to it imperatively\n * for the gesture's duration. A chip-owned gesture dies the moment its chip\n * unmounts β€” which now genuinely happens mid-drag, because holding at the\n * grid's edge pages the view and the dragged event's own day can leave the\n * window. The listeners are removed on every terminating path, including\n * `lostpointercapture`, so nothing leaks if the element goes away underneath.\n *\n * **The preview is a grid-level ghost, not a transform on the chip** β€” see\n * `schedule-drag-ghost.tsx` for why. The chip itself only dims.\n *\n * **The target day comes from measured column rects, not `elementFromPoint`.**\n * The obvious approach is wrong here: the preview and the chip both sit under\n * the pointer for the whole gesture, so hit-testing would keep resolving to\n * the source column. Rects are also deterministic, and mockable in jsdom,\n * which is what makes a cross-day commit unit-testable at all.\n */\n\nexport type UseEventDragOptions = {\n event: ScheduleEvent\n /** 0-based index of the column this chip is painted in. A drag's day delta\n * is measured from the **grabbed piece**, not from the event's start: grab\n * the Tuesday half of a Monβ†’Tue event, drop it on Wednesday, and that means\n * \"+1 day\", not \"move the start to Wednesday\". */\n dayIndex: number\n /** That column's date. The preview needs a real day to measure the\n * candidate's band against β€” a vertical drag can move the event to another\n * day without the pointer ever leaving its column. */\n day: Date\n timeZone: string\n /** Minutes from midnight at which the rendered window starts β€” the ghost's\n * own percentage math is relative to it, exactly like a chip's `top`. */\n startHour: number\n /** `(endHour - startHour) * 60`, the percent denominator. */\n totalWindowMinutes: number\n /** The band's own end hour, for clipping the preview to a partial window. */\n endHour: number\n /**\n * Whether this event can actually be dragged (the caller's already-\n * resolved `editable` grant for `\"drag\"`). When `false`, pointer down/up\n * are still tracked so click-to-open-details keeps working, but nothing\n * previews and a drag past `CLICK_SLOP` is silently ignored β€” not a\n * rejected commit, just not draggable at all.\n */\n enabled?: boolean\n /** Minutes β€” both the grid's slot spacing and the drag snap increment. */\n slotDuration: number\n slotDisabled?: ScheduleSlotPredicate\n /** RFC Β§12a, axis A already resolved for this gesture by the caller. */\n preventOverlap?: boolean\n /** RFC Β§12a, axis B already resolved by the caller β€” resolved over the whole\n * visible window, so a cross-day drop validates against its *target* day.\n * The event's own pre-drag range is excluded via `event.id`. */\n overlapCandidates?: { id: string; start: Date; end: Date }[]\n onEventChange?: (\n event: ScheduleEvent,\n next: { start: Date; end: Date },\n reason: \"drag\" | \"resize\",\n ) => void\n onEventClick?: (event: ScheduleEvent) => void\n /**\n * Page the view by one range. Called only when the pointer is held against\n * an edge the grid can no longer scroll past, for `PAGINATE_DWELL_MS`.\n *\n * Auto-**scroll** and auto-**navigate** are deliberately separate concerns\n * (Syncfusion splits them as `allowScroll`/`allowNavigation` for the same\n * reason): scrolling only reveals what is already in the range, while paging\n * changes the range itself. Omitting this leaves auto-scroll working and\n * simply never pages β€” a consumer holding `date` controlled decides for\n * itself, degrading to \"no pagination\" rather than to a broken gesture.\n */\n onPaginate?: (direction: -1 | 1) => void\n locale?: string\n}\n\n/** The gesture's own state, on top of the shared edge-behaviour fields\n * (`grid`, `clientX`/`clientY`, the scroll/paginate bookkeeping and the\n * measured `columns`) that `schedule-grid-gesture.ts` reads and mutates. */\ntype DragState = EdgeState & {\n pointerId: number\n startClientX: number\n startClientY: number\n /** Scroll offsets at gesture start. Auto-scroll moves the grid under a\n * stationary pointer, which produces *zero* client delta β€” without these\n * the preview would freeze while the grid slid beneath it. */\n startScrollLeft: number\n startScrollTop: number\n maxAbsDelta: number\n pxPerMinute: number\n sourceDayIndex: number\n ghosts: Map<number, HTMLElement>\n /** Every chip belonging to this event, across columns β€” they all dim\n * together, so a multi-day event never looks half-grabbed. */\n chips: HTMLElement[]\n cleanup: () => void\n}\n\nconst setChipsDragging = (chips: HTMLElement[], dragging: boolean) => {\n for (const chip of chips) {\n if (dragging) chip.dataset[\"dragging\"] = \"true\"\n else delete chip.dataset[\"dragging\"]\n }\n}\n\nconst setInvalid = (els: (HTMLElement | null)[], invalid: boolean) => {\n for (const el of els) {\n if (!el) continue\n if (invalid) el.dataset[\"invalid\"] = \"true\"\n else delete el.dataset[\"invalid\"]\n }\n}\n\n/** A brief scale pulse distinguishing a rejected drop from a normal settle β€”\n * both otherwise animate back to the same resting position identically. The\n * transient `data-schedule-reject-reason` is a CSS/differentiation hook for\n * later β€” `\"disabled\"` and `\"overlap\"` currently animate identically, but\n * RFC Β§12's \"two different, non-conflated concepts\" principle means they\n * might not always. */\nconst flashRejected = (els: HTMLElement[], reason: \"disabled\" | \"overlap\") => {\n for (const el of els) {\n el.style.transition = \"transform 120ms ease-out\"\n el.style.transform = \"scale(0.98)\"\n el.dataset[\"scheduleRejectReason\"] = reason\n requestAnimationFrame(() => {\n el.style.transform = \"\"\n // Reset, not left dangling: an inline `transition` beats any class-based\n // one for the same property, so leaving this set would silently kill\n // `chipShell`'s own `transition-[left,width]` on this chip from its\n // first rejected gesture onward.\n el.style.transition = \"\"\n delete el.dataset[\"scheduleRejectReason\"]\n })\n }\n}\n\nexport function useEventDrag({\n event,\n dayIndex,\n day,\n timeZone,\n startHour,\n totalWindowMinutes,\n endHour,\n enabled = true,\n slotDuration,\n slotDisabled,\n preventOverlap,\n overlapCandidates,\n onEventChange,\n onEventClick,\n onPaginate,\n locale,\n}: UseEventDragOptions) {\n const dragRef = useRef<DragState | null>(null)\n // Every value the imperative listeners read, kept fresh without re-binding\n // them mid-gesture (which would drop the listener the browser is currently\n // dispatching to).\n const latest = useRef({\n event,\n dayIndex,\n day,\n timeZone,\n startHour,\n totalWindowMinutes,\n endHour,\n enabled,\n slotDuration,\n slotDisabled,\n preventOverlap,\n overlapCandidates,\n onEventChange,\n onEventClick,\n onPaginate,\n locale,\n })\n latest.current = {\n event,\n dayIndex,\n day,\n timeZone,\n startHour,\n totalWindowMinutes,\n endHour,\n enabled,\n slotDuration,\n slotDisabled,\n preventOverlap,\n overlapCandidates,\n onEventChange,\n onEventClick,\n onPaginate,\n locale,\n }\n\n /** The snapped candidate a given pointer position would commit to, plus\n * whether it would be accepted. Shared by the live preview and the commit,\n * so the red tint can never disagree with what release actually does. */\n const resolveCandidate = useCallback((state: DragState, clientX: number, clientY: number) => {\n const o = latest.current\n // Scroll-space, not client-space: see `startScrollLeft`'s own comment.\n const dy = clientY - state.startClientY + (state.grid.scrollTop - state.startScrollTop)\n const deltaMinutes = pixelsToMinutes(dy, state.pxPerMinute)\n const renderedIndex = resolveDayIndex(liveColumns(state), state.sourceDayIndex, clientX)\n const days = renderedIndex + state.paginationOffset - state.sourceDayIndex\n const next = moveRange(\n { start: o.event.start, end: o.event.end },\n { days, minutes: deltaMinutes },\n { timeZone: o.timeZone, slotDuration: o.slotDuration },\n )\n const result = checkRangeCommit(next, {\n slotDisabled: o.slotDisabled,\n timeZone: o.timeZone,\n preventOverlap: o.preventOverlap,\n overlapCandidates: o.overlapCandidates,\n excludeId: o.event.id,\n })\n return { next, result, days, renderedIndex }\n }, [])\n\n /** The painted band of the day `dayOffset` calendar days from the grabbed\n * piece's own column, in the schedule's `timeZone` β€” the same band\n * `segmentEvents` clips a real chip against. */\n const bandOf = useCallback((dayOffset: number) => {\n const o = latest.current\n const date = dayOffset === 0 ? o.day : addCalendarDays(o.day, dayOffset, o.timeZone)\n return {\n start: dayBoundary(date, o.startHour, o.timeZone).getTime(),\n end: dayBoundary(date, o.endHour, o.timeZone).getTime(),\n }\n }, [])\n\n const end = useCallback((state: DragState) => {\n stopEdgeBehaviours(state)\n state.cleanup()\n setChipsDragging(state.chips, false)\n hidePieces(state.ghosts, DRAG_GHOST)\n dragRef.current = null\n }, [])\n\n /** Repaint the preview from the last known pointer position. Called on every\n * `pointermove` *and* from the auto-scroll ticker, where the pointer is\n * stationary but the grid is moving underneath it. */\n const paint = useCallback(\n (state: DragState) => {\n const o = latest.current\n const { next, result } = resolveCandidate(state, state.clientX, state.clientY)\n setChipsDragging(state.chips, true)\n\n // One piece per day, each clipped to that column's own band β€” the same\n // single intersection `segmentEvents` performs for a committed event, so\n // a move that crosses a day boundary previews as the two pieces it will\n // actually become. A single box could only ever draw one of them, which\n // is why dragging up through midnight appeared to lose the preview: it\n // drew the piece on the previous day and omitted the one under the\n // pointer.\n paintPieces({\n pieces: state.ghosts,\n preview: DRAG_GHOST,\n columnIndices:\n state.columns.length > 0\n ? state.columns.map((c) => c.index)\n : [...state.ghosts.keys()].sort((a, b) => a - b),\n // A column's index is relative to the currently rendered range; `days`\n // is relative to the range the gesture started in, so both are brought\n // into the same space before asking which day a column shows.\n bandOfColumn: (index) => bandOf(index + state.paginationOffset - state.sourceDayIndex),\n candidates: [\n {\n range: { start: next.start.getTime(), end: next.end.getTime() },\n invalid: !result.ok,\n label: formatCandidate(next, o.locale, o.timeZone),\n },\n ],\n totalWindowMinutes: o.totalWindowMinutes,\n })\n setInvalid(state.chips, !result.ok)\n },\n [resolveCandidate, bandOf],\n )\n\n /** Drive the shared edge behaviour for this gesture. The chip re-adoption\n * in `onAfterPaginate` is the drag-specific half: paging can unmount the\n * very chips this gesture is dimming, so the dimming has to follow the\n * event back into view rather than keep writing to detached nodes. */\n const runEdges = useCallback(\n (state: DragState) => {\n tickEdges(state, {\n paint: () => paint(state),\n isLive: () => dragRef.current === state,\n onPaginate: (direction) => latest.current.onPaginate?.(direction),\n onAfterPaginate: () => {\n const refreshed = liveChipsFor(state.grid, latest.current.event.id)\n setChipsDragging(state.chips, false)\n state.chips = refreshed\n // The per-column ghosts remounted with the new range too.\n hidePieces(state.ghosts, DRAG_GHOST)\n state.ghosts = collectPieces(state.grid, DRAG_GHOST)\n },\n })\n },\n [paint],\n )\n\n const handleMove = useCallback(\n (e: PointerEvent) => {\n const state = dragRef.current\n if (!state || e.pointerId !== state.pointerId) return\n const o = latest.current\n state.clientX = e.clientX\n state.clientY = e.clientY\n state.maxAbsDelta = Math.max(\n state.maxAbsDelta,\n Math.abs(e.clientY - state.startClientY),\n Math.abs(e.clientX - state.startClientX),\n )\n // A non-draggable event never previews β€” an immediate, honest cue that\n // this gesture won't do anything, rather than animating a move that then\n // silently reverts.\n if (!o.enabled || state.maxAbsDelta < CLICK_SLOP) return\n\n paint(state)\n // Re-arm the ticker only when it isn't already running; it reschedules\n // itself for as long as the pointer stays in a band.\n if (state.scrollRaf === null) runEdges(state)\n },\n [paint, runEdges],\n )\n\n const handleUp = useCallback(\n (e: PointerEvent) => {\n const state = dragRef.current\n if (!state || e.pointerId !== state.pointerId) return\n const o = latest.current\n const chips = state.chips\n // Freeze the edge behaviours before resolving, so the commit uses the\n // scroll position the user actually released at.\n stopEdgeBehaviours(state)\n state.clientX = e.clientX\n state.clientY = e.clientY\n\n if (state.maxAbsDelta < CLICK_SLOP) {\n end(state)\n setInvalid(chips, false)\n o.onEventClick?.(o.event)\n return\n }\n // Not a rejected commit β€” this event simply can't be dragged at all, so\n // there's nothing to validate or flash; just settle back silently.\n if (!o.enabled) {\n end(state)\n setInvalid(chips, false)\n return\n }\n\n const { next, result } = resolveCandidate(state, e.clientX, e.clientY)\n end(state)\n setInvalid(chips, false)\n if (!result.ok) {\n flashRejected(chips, result.reason)\n return\n }\n o.onEventChange?.(o.event, next, \"drag\")\n },\n [end, resolveCandidate],\n )\n\n const handleCancel = useCallback(\n (e: PointerEvent) => {\n const state = dragRef.current\n if (!state || e.pointerId !== state.pointerId) return\n const chips = state.chips\n end(state)\n setInvalid(chips, false)\n },\n [end],\n )\n\n const onPointerDown = useCallback(\n (e: ReactPointerEvent<HTMLElement>) => {\n if (e.button !== 0) return\n const target = e.target as Element\n if (target.closest(\"[data-schedule-part='resize-handle'],[data-schedule-part='remove']\")) {\n return\n }\n const chip = e.currentTarget\n const grid = chip.closest<HTMLElement>(\"[data-schedule-part='timed-grid']\")\n // The day column, not the scrollable viewport: `resolvePxPerMinute`\n // measures a real rendered box, and the viewport's height is the visible\n // *scrolled* area, not the column's own (possibly stretched) height.\n const dayColumnEl = chip.closest<HTMLElement>(\"[data-schedule-part='day-column']\")\n if (!grid || !dayColumnEl) return\n\n const windowMinutes = Number(\n getComputedStyle(dayColumnEl).getPropertyValue(\"--sch-window-minutes\"),\n )\n const pxPerMinute =\n windowMinutes > 0 ? dayColumnEl.getBoundingClientRect().height / windowMinutes : 0\n\n const onMove = (ev: PointerEvent) => handleMove(ev)\n const onUp = (ev: PointerEvent) => handleUp(ev)\n const onCancel = (ev: PointerEvent) => handleCancel(ev)\n const state: DragState = {\n pointerId: e.pointerId,\n startClientX: e.clientX,\n startClientY: e.clientY,\n startScrollLeft: grid.scrollLeft,\n startScrollTop: grid.scrollTop,\n maxAbsDelta: 0,\n pxPerMinute,\n paginationOffset: 0,\n clientX: e.clientX,\n clientY: e.clientY,\n scrollRaf: null,\n paginateTimer: null,\n paginateDirection: null,\n sourceDayIndex: latest.current.dayIndex,\n columns: measureColumns(grid),\n ...measureScrollExtent(grid),\n grid,\n ghosts: collectPieces(grid, DRAG_GHOST),\n chips: liveChipsFor(grid, event.id),\n cleanup: () => {\n grid.removeEventListener(\"pointermove\", onMove)\n grid.removeEventListener(\"pointerup\", onUp)\n grid.removeEventListener(\"pointercancel\", onCancel)\n grid.removeEventListener(\"lostpointercapture\", onCancel)\n },\n }\n // Fall back to the chip itself when the querySelectorAll found nothing β€”\n // a consumer could have re-rendered between paint and this press.\n if (state.chips.length === 0) state.chips = [chip]\n dragRef.current = state\n\n // Deliberately native listeners on the grid rather than React handlers on\n // the chip: React would tear these down when the chip unmounts, which is\n // exactly what a mid-drag pagination causes.\n grid.addEventListener(\"pointermove\", onMove)\n grid.addEventListener(\"pointerup\", onUp)\n grid.addEventListener(\"pointercancel\", onCancel)\n grid.addEventListener(\"lostpointercapture\", onCancel)\n grid.setPointerCapture(e.pointerId)\n },\n [event.id, handleMove, handleUp, handleCancel],\n )\n\n // Deliberately **no unmount cleanup**. A chip genuinely does unmount\n // mid-gesture β€” holding at an edge pages the view, and the dragged event's\n // own day can leave the window β€” and tearing the listeners down there would\n // silently kill the gesture at exactly the moment it is supposed to keep\n // working. (It did: the first version of this hook had that effect, and the\n // drop after a paginate never committed.)\n //\n // The listeners' lifetime is the *gesture's*, not this component's. They\n // live on the grid element, which outlives any one chip, and every\n // terminating path β€” `pointerup`, `pointercancel`, `lostpointercapture` β€”\n // removes them. If the grid itself goes away they are collected with it.\n\n // No `style` here, deliberately. The chip body sets its own `style` for the\n // geometry custom properties, and a later `style` prop replaces an earlier\n // one wholesale rather than merging β€” so a `touchAction` returned from here\n // was silently dropped, and a touch drag on the chip body could still be\n // stolen by the scroller. The chip carries `touch-none` as a class instead,\n // the way the resize grips already do, and gates it on the same `canDrag`\n // this hook gets as `enabled` (an ungrabbable chip must stay scrollable).\n return {\n getBodyProps: () => ({ onPointerDown }),\n }\n}\n","\"use client\"\n\nimport type {\n CSSProperties,\n KeyboardEvent as ReactKeyboardEvent,\n PointerEvent as ReactPointerEvent,\n} from \"react\"\nimport { useCallback, useRef } from \"react\"\nimport { match } from \"ts-pattern\"\nimport type { ScheduleSlotPredicate } from \"../../lib/schedule-predicates\"\nimport { addCalendarDays, checkRangeCommit, dayBoundary } from \"./schedule-dates\"\nimport { pixelsToMinutes, resolvePxPerMinute } from \"./schedule-geometry\"\nimport {\n CREATE_DRAFT,\n collectPieces,\n type EdgeState,\n flashPieces,\n formatCandidate,\n hidePieces,\n liveChipsFor,\n liveColumns,\n measureColumns,\n measureScrollExtent,\n paintPieces,\n resolveDayIndex,\n stopEdgeBehaviours,\n tickEdges,\n} from \"./schedule-grid-gesture\"\nimport { resizeRange } from \"./schedule-snap\"\nimport type { ScheduleCollision, ScheduleEvent } from \"./schedule-types\"\n\n/**\n * RFC Β§7 (`docs/rfcs/schedule.md`) edge-resize. Live preview writes only a\n * raw pixel delta (`--sch-resize-delta-y`) + `data-resizing-edge` β€” never\n * `top`/`height` directly, so this hook can't fight the chip's own settled\n * positioning (its CSS does the `calc()` arithmetic against those two\n * signals). ARIA + the keyboard nudge follow `DataTableColumnResizeHandle`'s\n * shape (`data-table/data-table-header-cell.tsx`).\n *\n * **Two axes, two previews.** Vertical still drives the chip's own stretch,\n * unchanged. Horizontal moves the edge onto another calendar day β€” which the\n * `--sch-resize-delta-y` contract simply cannot represent: dragging the grip\n * sideways at the same height produces a delta of zero, so the chip would show\n * no change at all while the candidate silently moved a day. So the moment the\n * edge leaves its own column the chip dims and the per-day draft pieces take\n * over (`schedule-grid-gesture.ts`), carrying the day-qualified readout. Cross\n * back and the stretch resumes. The same-day path β€” every ordinary resize β€” is\n * byte-identical to before, which is the whole point of the split.\n *\n * Like the other two gestures, the listeners live on the **grid** and are not\n * torn down on unmount, since holding at an edge pages the view and unmounts\n * the handle this gesture started on.\n */\n\nconst MINUTES_IN_DAY = 24 * 60\n\ntype Edge = \"start\" | \"end\"\n\nexport type UseEventResizeOptions = {\n event: ScheduleEvent\n edge: Edge\n /** The date of the column this handle is painted in β€” the day the edge\n * currently sits on, and the origin every other day is offset from. */\n day: Date\n /** 0-based index of that column in the range rendered at pointerdown. */\n dayIndex: number\n timeZone: string\n startHour: number\n endHour: number\n /** Minutes β€” both the grid's slot spacing and the resize snap increment. */\n slotDuration: number\n /** Minutes. Defaults to `slotDuration` β€” a resize can never shrink an\n * event below one snap unit. */\n minDurationMinutes?: number\n /** Minutes. The ceiling a resize may grow an event to β€” see\n * `resizeRange`, which lets an event already past it shrink but not grow. */\n maxDurationMinutes?: number\n /** What happens once the grip reaches the other edge. Default `\"none\"`\n * (clamp) β€” see `ScheduleCollision`. */\n collision?: ScheduleCollision\n slotDisabled?: ScheduleSlotPredicate\n /** RFC Β§12a, axis A already resolved for this gesture by the caller. */\n preventOverlap?: boolean\n /** RFC Β§12a, axis B already resolved by the caller β€” excludes the event's\n * own pre-resize range via `event.id`. */\n overlapCandidates?: { id: string; start: Date; end: Date }[]\n onEventChange?: (\n event: ScheduleEvent,\n next: { start: Date; end: Date },\n reason: \"drag\" | \"resize\",\n ) => void\n /** Page the view by one range, after the pointer has been held against an\n * edge the grid can no longer scroll. */\n onPaginate?: (direction: -1 | 1) => void\n locale?: string\n}\n\ntype ResizeState = EdgeState & {\n pointerId: number\n startClientX: number\n startClientY: number\n /** Scroll offsets at gesture start β€” auto-scroll moves the grid under a\n * stationary pointer, producing zero client delta. */\n startScrollLeft: number\n startScrollTop: number\n pxPerMinute: number\n sourceDayIndex: number\n /** Every chip belonging to this event, across columns: they dim together\n * once the preview hands over to the draft pieces. */\n chips: HTMLElement[]\n /** The chip this handle belongs to β€” the one that stretches on the same-day\n * path. `null` once a pagination has taken it out of the window. */\n chip: HTMLElement | null\n drafts: Map<number, HTMLElement>\n cleanup: () => void\n}\n\nconst minutesSinceMidnight = (date: Date) => date.getHours() * 60 + date.getMinutes()\n\n/** Dim every chip of the event while the draft preview has taken over β€” the\n * same `data-dragging` treatment a dragged chip gets, so \"this chip is no\n * longer showing you the truth\" reads identically across both gestures. */\nconst setChipsDimmed = (chips: HTMLElement[], dimmed: boolean) => {\n for (const chip of chips) {\n if (dimmed) chip.dataset[\"dragging\"] = \"true\"\n else delete chip.dataset[\"dragging\"]\n }\n}\n\nconst findChip = (el: Element) => el.closest<HTMLElement>(\"[data-schedule-part='event-chip']\")\n\nconst resetVisual = (chip: HTMLElement | null) => {\n if (!chip) return\n chip.style.transition = \"\"\n delete chip.dataset[\"resizing\"]\n delete chip.dataset[\"resizingEdge\"]\n chip.style.removeProperty(\"--sch-resize-delta-start\")\n chip.style.removeProperty(\"--sch-resize-delta-end\")\n delete chip.dataset[\"invalid\"]\n}\n\nconst flashRejected = (chip: HTMLElement | null, reason: \"disabled\" | \"overlap\") => {\n if (!chip) return\n chip.style.transition = \"transform 120ms ease-out\"\n chip.style.transform = \"scale(0.98)\"\n chip.dataset[\"scheduleRejectReason\"] = reason\n requestAnimationFrame(() => {\n chip.style.transform = \"\"\n // Reset, not left dangling: an inline `transition` beats any class-based\n // one for the same property, so leaving this set would silently kill\n // `chipShell`'s own `transition-[left,width]` on this chip from its\n // first rejected gesture onward.\n chip.style.transition = \"\"\n delete chip.dataset[\"scheduleRejectReason\"]\n })\n}\n\nexport function useEventResize({\n event,\n edge,\n day,\n dayIndex,\n timeZone,\n startHour,\n endHour,\n slotDuration,\n minDurationMinutes = slotDuration,\n maxDurationMinutes,\n collision = \"none\",\n slotDisabled,\n preventOverlap,\n overlapCandidates,\n onEventChange,\n onPaginate,\n locale,\n}: UseEventResizeOptions) {\n const resizeRef = useRef<ResizeState | null>(null)\n\n // Every value the imperative listeners read, kept fresh without re-binding\n // them mid-gesture. Stops updating once a pagination unmounts the owning\n // chip β€” which is why the candidate below is a calendar-day *offset* from\n // `day`, never a lookup into a rendered `days` array.\n const options = {\n event,\n edge,\n day,\n dayIndex,\n timeZone,\n startHour,\n endHour,\n slotDuration,\n minDurationMinutes,\n maxDurationMinutes,\n collision,\n slotDisabled,\n preventOverlap,\n overlapCandidates,\n onEventChange,\n onPaginate,\n locale,\n }\n const latest = useRef(options)\n latest.current = options\n\n /** The band `[startHour, endHour)` of the day `dayOffset` calendar days from\n * this handle's own column, in the schedule's `timeZone` β€” the same band\n * `segmentEvents` clips against. */\n const bandOf = useCallback((dayOffset: number) => {\n const o = latest.current\n const date = dayOffset === 0 ? o.day : addCalendarDays(o.day, dayOffset, o.timeZone)\n return {\n start: dayBoundary(date, o.startHour, o.timeZone).getTime(),\n end: dayBoundary(date, o.endHour, o.timeZone).getTime(),\n }\n }, [])\n\n /** Snap, clamp and validate a displacement of the dragged edge. Shared by\n * the pointer path, the live preview and the keyboard nudge, so the red\n * tint can never disagree with what releasing would actually do. */\n const resolveFor = useCallback((delta: { days: number; minutes: number }) => {\n const o = latest.current\n const next = resizeRange({ start: o.event.start, end: o.event.end }, o.edge, delta, {\n timeZone: o.timeZone,\n slotDuration: o.slotDuration,\n minDurationMinutes: o.minDurationMinutes,\n maxDurationMinutes: o.maxDurationMinutes,\n collision: o.collision,\n })\n const result = checkRangeCommit(next, {\n slotDisabled: o.slotDisabled,\n timeZone: o.timeZone,\n preventOverlap: o.preventOverlap,\n overlapCandidates: o.overlapCandidates,\n excludeId: o.event.id,\n })\n return { next, result }\n }, [])\n\n const commit = useCallback(\n (delta: { days: number; minutes: number }) => {\n const o = latest.current\n const { next, result } = resolveFor(delta)\n if (!result.ok) return result\n o.onEventChange?.(o.event, next, \"resize\")\n return { ok: true } as const\n },\n [resolveFor],\n )\n\n /** The displacement a pointer position represents, in scroll space. */\n const deltaAt = useCallback((state: ResizeState, clientX: number, clientY: number) => {\n const dy = clientY - state.startClientY + (state.grid.scrollTop - state.startScrollTop)\n return {\n days:\n resolveDayIndex(liveColumns(state), state.sourceDayIndex, clientX) +\n state.paginationOffset -\n state.sourceDayIndex,\n minutes: pixelsToMinutes(dy, state.pxPerMinute),\n }\n }, [])\n\n /**\n * The two-preview split, and the reason the chip can no longer overflow.\n *\n * **Stretch** while the candidate still needs exactly the columns the\n * settled event already occupies, and the pointer is still in this one. The\n * chip then draws its own band's slice via the two `--sch-resize-delta-*`\n * vars, which are derived from instants **clipped to that band** β€” so the\n * box provably cannot leave the day column. That is what kills the\n * scroll-feedback runaway at its source: an unclamped `height` grew the\n * `overflow-auto` grid's own `scrollHeight`, which raised the auto-scroll\n * ceiling, which enlarged `dy` (measured in scroll space), which grew the\n * box again.\n *\n * **Hand over** to the per-day pieces the moment the candidate needs a\n * column this chip cannot reach β€” the pointer moved to another day, or the\n * candidate now runs past a band edge the settled event did not. Both are\n * cases a single chip can only misrepresent, and the pieces already draw\n * them correctly: one clipped piece per day, with `data-continues-before`/\n * `-after` squaring off the cut edges. Crossing back restores the stretch.\n *\n * The condition is deliberately \"does it cross the *same* band edges as\n * before\", not \"is it inside the band\": an already-multi-day event's grip\n * nudge must keep stretching, since it always crosses a band edge and\n * always did.\n */\n const paint = useCallback(\n (state: ResizeState) => {\n const o = latest.current\n const { days, minutes } = deltaAt(state, state.clientX, state.clientY)\n const { next, result } = resolveFor({ days, minutes })\n const chip = state.chip\n\n // The box snaps to the slot grid *live*, so the edge the user is dragging\n // always sits on a gridline they can see and the chip is never a shape\n // that releasing would not produce.\n //\n // This reverses RFC Β§18's \"never snap the visual live\", which had the box\n // track the raw displacement while only the readout and the tint used the\n // snapped candidate. In practice that meant the preview could promise a\n // size the commit would not honour, by up to half a slot β€” and the drag\n // gesture already resolves its own candidate through `moveRange` at the\n // real `slotDuration`, so resize was the odd one out.\n //\n // `minDurationMinutes` is unchanged and still enforced here: `resizeRange`\n // clamps to the floor independently of the snap, so the edge stops one\n // grid unit from the other regardless.\n const raw = resizeRange(\n { start: o.event.start, end: o.event.end },\n o.edge,\n { days, minutes },\n {\n timeZone: o.timeZone,\n slotDuration: o.slotDuration,\n minDurationMinutes: o.minDurationMinutes,\n maxDurationMinutes: o.maxDurationMinutes,\n collision: o.collision,\n },\n )\n\n const band = bandOf(0)\n const eventStart = o.event.start.getTime()\n const eventEnd = o.event.end.getTime()\n const rawStart = raw.start.getTime()\n const rawEnd = raw.end.getTime()\n const sameCrossings =\n rawStart < band.start === eventStart < band.start &&\n rawEnd > band.end === eventEnd > band.end\n\n if (days === 0 && sameCrossings) {\n hidePieces(state.drafts, CREATE_DRAFT)\n setChipsDimmed(state.chips, false)\n if (!chip) return\n // This chip's settled box is the event clipped to its own band (grips\n // only render on the piece owning a real edge, but the piece's *other*\n // edge can be a band boundary), so both deltas are measured against\n // the clipped span β€” never against the raw event.\n const pxPerMs = state.pxPerMinute / 60_000\n const settledTop = Math.max(eventStart, band.start)\n const settledBottom = Math.min(eventEnd, band.end)\n const nextTop = Math.min(Math.max(rawStart, band.start), band.end)\n const nextBottom = Math.max(Math.min(rawEnd, band.end), band.start)\n chip.style.transition = \"none\"\n chip.dataset[\"resizing\"] = \"true\"\n chip.dataset[\"resizingEdge\"] = o.edge\n chip.style.setProperty(\"--sch-resize-delta-start\", `${(nextTop - settledTop) * pxPerMs}px`)\n chip.style.setProperty(\n \"--sch-resize-delta-end\",\n `${(nextBottom - settledBottom) * pxPerMs}px`,\n )\n if (result.ok) delete chip.dataset[\"invalid\"]\n else chip.dataset[\"invalid\"] = \"true\"\n return\n }\n\n // Handed over to the pieces. The chip returns to its settled position\n // rather than holding a stale stretch, and dims like a dragged one.\n resetVisual(chip)\n setChipsDimmed(state.chips, true)\n paintPieces({\n pieces: state.drafts,\n preview: CREATE_DRAFT,\n columnIndices:\n state.columns.length > 0\n ? state.columns.map((c) => c.index)\n : [...state.drafts.keys()].sort((a, b) => a - b),\n bandOfColumn: (index) => bandOf(index + state.paginationOffset - state.sourceDayIndex),\n candidates: [\n {\n range: { start: rawStart, end: rawEnd },\n invalid: !result.ok,\n label: formatCandidate(next, o.locale, o.timeZone),\n },\n ],\n totalWindowMinutes: (o.endHour - o.startHour) * 60,\n })\n },\n [bandOf, deltaAt, resolveFor],\n )\n\n const runEdges = useCallback(\n (state: ResizeState) => {\n tickEdges(state, {\n paint: () => paint(state),\n isLive: () => resizeRef.current === state,\n onPaginate: (direction) => latest.current.onPaginate?.(direction),\n onAfterPaginate: () => {\n hidePieces(state.drafts, CREATE_DRAFT)\n state.drafts = collectPieces(state.grid, CREATE_DRAFT)\n setChipsDimmed(state.chips, false)\n const refreshed = liveChipsFor(state.grid, latest.current.event.id)\n state.chips = refreshed\n // The handle's own chip may have left the window entirely; the\n // stretch path is unreachable from here on if so, which is correct β€”\n // the edge is by definition on another day at that point.\n state.chip = refreshed[0] ?? null\n },\n })\n },\n [paint],\n )\n\n const end = useCallback((state: ResizeState) => {\n stopEdgeBehaviours(state)\n state.cleanup()\n hidePieces(state.drafts, CREATE_DRAFT)\n setChipsDimmed(state.chips, false)\n resetVisual(state.chip)\n resizeRef.current = null\n }, [])\n\n const handleMove = useCallback(\n (e: PointerEvent) => {\n const state = resizeRef.current\n if (!state || e.pointerId !== state.pointerId) return\n state.clientX = e.clientX\n state.clientY = e.clientY\n paint(state)\n if (state.scrollRaf === null) runEdges(state)\n },\n [paint, runEdges],\n )\n\n const handleUp = useCallback(\n (e: PointerEvent) => {\n const state = resizeRef.current\n if (!state || e.pointerId !== state.pointerId) return\n // Freeze the edge behaviours first, so the commit uses the scroll\n // position the user actually released at.\n stopEdgeBehaviours(state)\n state.clientX = e.clientX\n state.clientY = e.clientY\n const { days, minutes } = deltaAt(state, e.clientX, e.clientY)\n const chip = state.chip\n const drafts = state.drafts\n // Which preview was actually on screen decides which one pulses β€” a\n // handover can happen without the day changing (a candidate run past a\n // band edge), so `days !== 0` is no longer the same question.\n const onPieces = chip === null || chip.dataset[\"resizing\"] !== \"true\"\n const result = commit({ days, minutes })\n end(state)\n if (!result.ok) {\n if (onPieces) flashPieces(drafts, result.reason)\n else flashRejected(chip, result.reason)\n }\n },\n [commit, deltaAt, end],\n )\n\n const handleCancel = useCallback(\n (e: PointerEvent) => {\n const state = resizeRef.current\n if (!state || e.pointerId !== state.pointerId) return\n end(state)\n },\n [end],\n )\n\n const onPointerDown = useCallback(\n (e: ReactPointerEvent<HTMLElement>) => {\n if (e.button !== 0) return\n e.stopPropagation()\n const handle = e.currentTarget\n const grid = handle.closest<HTMLElement>(\"[data-schedule-part='timed-grid']\")\n // The day-column, not the scrollable viewport: `resolvePxPerMinute`\n // measures a real rendered box, and the viewport's height is the visible\n // *scrolled* area, not the column's own (possibly stretched) height.\n const dayColumnEl = handle.closest<HTMLElement>(\"[data-schedule-part='day-column']\")\n if (!grid || !dayColumnEl) return\n\n const onMove = (ev: PointerEvent) => handleMove(ev)\n const onUp = (ev: PointerEvent) => handleUp(ev)\n const onCancel = (ev: PointerEvent) => handleCancel(ev)\n const chips = liveChipsFor(grid, latest.current.event.id)\n resizeRef.current = {\n pointerId: e.pointerId,\n startClientX: e.clientX,\n startClientY: e.clientY,\n startScrollLeft: grid.scrollLeft,\n startScrollTop: grid.scrollTop,\n pxPerMinute: resolvePxPerMinute(dayColumnEl),\n sourceDayIndex: latest.current.dayIndex,\n clientX: e.clientX,\n clientY: e.clientY,\n scrollRaf: null,\n paginateTimer: null,\n paginateDirection: null,\n paginationOffset: 0,\n columns: measureColumns(grid),\n ...measureScrollExtent(grid),\n drafts: collectPieces(grid, CREATE_DRAFT),\n chip: findChip(handle),\n chips,\n grid,\n cleanup: () => {\n grid.removeEventListener(\"pointermove\", onMove)\n grid.removeEventListener(\"pointerup\", onUp)\n grid.removeEventListener(\"pointercancel\", onCancel)\n grid.removeEventListener(\"lostpointercapture\", onCancel)\n },\n }\n // Deliberately native listeners on the grid rather than React handlers on\n // the handle: React would tear these down when the handle unmounts, which\n // is exactly what a mid-gesture pagination causes.\n grid.addEventListener(\"pointermove\", onMove)\n grid.addEventListener(\"pointerup\", onUp)\n grid.addEventListener(\"pointercancel\", onCancel)\n grid.addEventListener(\"lostpointercapture\", onCancel)\n grid.setPointerCapture(e.pointerId)\n },\n [handleMove, handleUp, handleCancel],\n )\n\n const onKeyDown = useCallback(\n (e: ReactKeyboardEvent<HTMLElement>) => {\n if (e.key !== \"ArrowUp\" && e.key !== \"ArrowDown\") return\n e.preventDefault()\n // Without this, the keydown bubbles from the handle up to the chip\n // body's own `handleBodyKeyDown` (`schedule-event-chip.tsx`), which\n // also treats ArrowUp/ArrowDown as a move β€” so a resize would also\n // shift the *other* edge. `onPointerDown` below already does the same\n // for the pointer path; this is its keyboard equivalent.\n e.stopPropagation()\n const step = match({ shiftKey: e.shiftKey, altKey: e.altKey })\n .with({ shiftKey: true, altKey: false }, () => slotDuration * 4)\n .with({ altKey: true, shiftKey: false }, () => 1)\n .otherwise(() => slotDuration)\n const result = commit({ days: 0, minutes: e.key === \"ArrowUp\" ? -step : step })\n // A discrete keyboard step needs the same rejection feedback a pointer\n // resize gets β€” silently doing nothing on a blocked step (e.g. an\n // overlap) would read as a dead key, not a rejection.\n if (!result.ok) flashRejected(findChip(e.currentTarget), result.reason)\n },\n [commit, slotDuration],\n )\n\n return {\n getHandleProps: () => {\n const value = edge === \"start\" ? event.start : event.end\n return {\n role: \"separator\" as const,\n \"aria-orientation\": \"horizontal\" as const,\n tabIndex: 0,\n \"aria-valuenow\": minutesSinceMidnight(value),\n \"aria-valuemin\": 0,\n \"aria-valuemax\": MINUTES_IN_DAY,\n // `hour: \"2-digit\"`, not `\"numeric\"` β€” same SSR-hydration reasoning\n // as `schedule-dates.ts`'s `timeRangeLabel`: `\"numeric\"`'s\n // zero-padding isn't guaranteed identical between Node's and a\n // browser's bundled ICU data.\n \"aria-valuetext\": new Intl.DateTimeFormat(locale, {\n hour: \"2-digit\",\n minute: \"2-digit\",\n }).format(value),\n \"aria-label\": `${edge === \"start\" ? \"Adjust start time\" : \"Adjust end time\"} of ${event.title}`,\n \"data-schedule-part\": \"resize-handle\" as const,\n onPointerDown,\n onKeyDown,\n style: { touchAction: \"none\" } as CSSProperties,\n }\n },\n }\n}\n","\"use client\"\n\nimport { usePresence } from \"@ark-ui/react/presence\"\nimport { cva } from \"class-variance-authority\"\nimport { XIcon } from \"lucide-react\"\nimport type {\n CSSProperties,\n AnimationEvent as ReactAnimationEvent,\n KeyboardEvent as ReactKeyboardEvent,\n ReactNode,\n RefObject,\n} from \"react\"\nimport { useLayoutEffect, useRef, useState } from \"react\"\nimport { cn } from \"../../lib/cn\"\nimport { focusStyles } from \"../../lib/focus-styles\"\nimport { mergeRefs } from \"../../lib/merge-refs\"\nimport { props as dataProps } from \"../../lib/props\"\nimport type { ScheduleSlotPredicate } from \"../../lib/schedule-predicates\"\nimport { Popover, type PopoverProps } from \"../popover/popover\"\nimport { checkRangeCommit, timeRangeLabel } from \"./schedule-dates\"\nimport { ScheduleEventDetailsContent } from \"./schedule-event-details\"\nimport {\n EVENT_COLOR_CLASSES,\n EVENT_SELECTED_CLASSES,\n gridPanelMaxWidth,\n} from \"./schedule-event-styles\"\nimport { timedGridViewport } from \"./schedule-geometry\"\nimport { moveRange } from \"./schedule-snap\"\nimport type {\n ScheduleAnyEvent,\n ScheduleCollision,\n ScheduleEvent,\n ScheduleEventChipClassNames,\n ScheduleStaticEvent,\n ScheduleTranslations,\n} from \"./schedule-types\"\nimport { isEventGestureEnabled } from \"./schedule-types\"\nimport { useEventDrag } from \"./use-event-drag\"\nimport { useEventResize } from \"./use-event-resize\"\n\n/**\n * RFC Β§11 (`docs/rfcs/schedule.md`) event chip. `kind === \"static\"` is a hard\n * structural gate: `ScheduleEventChip` dispatches to one of two genuinely\n * separate components below, so a static event's render never calls the\n * drag/resize hooks at all (not just \"calls them but never wires the\n * result\") β€” the only way to honor that literally, since React's rules of\n * hooks require a single component instance to call the same hooks on every\n * render.\n *\n * Both chip kinds own a built-in event-details popover, gated by\n * `withEventDetails` and opened for whichever chip is the selection's anchor\n * (see `ScheduleEventProps.selected`'s own doc β€” no local open state).\n * `StaticEventChip` fires a single real click, so it wraps its button\n * in `Popover.Trigger` β€” the same per-instance controlled-open shape\n * `DataTableHeaderFilter` already uses. `InteractiveEventChip` can't: its\n * drag preview is a CSS transform only, so a genuine native `click` fires on\n * *every* pointer release regardless of drag distance, which would make\n * `Popover.Trigger`'s own click-toggle open the popover on every drag too.\n * It uses `Popover.Anchor` (pure positioning, no click semantics) instead,\n * driving `open` imperatively from the gesture's own already-correct\n * click-vs-drag resolution (`use-event-drag.ts`'s `CLICK_SLOP` check and the\n * keyboard Enter/Space branch below).\n *\n * `editable` is a separate, orthogonal restriction layered on top of\n * `kind` β€” never conflated with it. `kind:\"static\"` stays the hard\n * structural gate it always was (a genuinely different, externally-supplied\n * data source that never even calls the drag/resize hooks); a `kind:\"event\"`\n * item with every gesture currently disallowed by `editable` still goes\n * through `InteractiveEventChip` (the hooks are still called, per Rules of\n * Hooks β€” they just aren't wired to any rendered affordance) and keeps its\n * normal look β€” it is still the consumer's own event, just not editable right\n * now. (This used to say \"not the dashed/reduced-opacity static treatment\";\n * `chipShell`'s `kind` variant has only ever differed by `cursor-default`, so\n * there is no such treatment to contrast with.)\n */\n\n/**\n * The chip's whole vertical box math, stated once. Every threshold below is a\n * *content-box* figure because that is what a `@container` size query\n * measures β€” with no `py-*` on the chip root, the queried box is exactly\n * `height - 2px` of border, independent of `ChipContent`'s own padding, so\n * there is no circularity.\n *\n * one line of content = 1rem (`text-xs` is 0.75rem at Tailwind's paired\n * 1.3333 ratio -> exactly 1rem at *any*\n * root font-size; measured at root 12/16/20px)\n * two lines of content = 2rem\n * chip border = 2px (1px each side, from `EVENT_COLOR_CLASSES`,\n * inside the box β€” preflight is `border-box`)\n *\n * so the floor is `calc(1rem + 2px)` (18px at a 16px root) and the time row\n * needs `calc(2rem + 8px)` of content box once `py-1` is back on.\n *\n * These are literals in the class strings on purpose and cannot be hoisted\n * into a custom property: CSS never substitutes `var()` inside an at-rule\n * prelude, and Tailwind additionally rejects arbitrary values containing\n * `var(`. `rem` rather than `px` so the whole scale tracks the root font-size\n * β€” the old hard-coded `18px` floor clipped the title outright on a page with\n * a 20px root.\n */\n\n/** Same scale-pulse `use-event-drag.ts`/`use-event-resize.ts` each keep their\n * own private copy of β€” `handleBodyKeyDown` below is an independent\n * keyboard-move commit path that doesn't go through either hook, so it\n * can't reuse theirs. */\nconst flashRejected = (el: HTMLElement, reason: \"disabled\" | \"overlap\") => {\n el.style.transition = \"transform 120ms ease-out\"\n el.style.transform = \"scale(0.98)\"\n el.dataset[\"scheduleRejectReason\"] = reason\n requestAnimationFrame(() => {\n el.style.transform = \"\"\n // Reset, not left dangling: an inline `transition` beats any class-based\n // one for the same property, so leaving this set would silently kill\n // `chipShell`'s own `transition-[left,width]` on this chip from its\n // first rejected gesture onward.\n el.style.transition = \"\"\n delete el.dataset[\"scheduleRejectReason\"]\n })\n}\n\n/** Grip hit area: ~8px on a fine pointer, 44px (WCAG 2.5.5 / Apple HIG) on a\n * coarse one β€” CSS-only via `[@media(pointer:coarse)]`, never resized by\n * JS, and the small/precise size is the default for ambiguous/hybrid input.\n * The hit area itself straddles the chip's edge (half in, half out, so a\n * coarse pointer gets a bigger target than the chip's own edge), but the\n * *visible* dash is aligned to whichever half sits inside the chip β€” see\n * `top`/`bottom` variants below β€” so nothing appears to float outside the\n * chip's own box. */\nconst gripBase = cn(\n \"absolute inset-x-0 z-10 flex h-(--sch-handle-hit-size) touch-none justify-center select-none\",\n \"[--sch-handle-hit-size:8px] [@media(pointer:coarse)]:[--sch-handle-hit-size:44px]\",\n \"cursor-ns-resize\",\n\n \"before:h-0.5 before:w-16 before:max-w-[70%] before:rounded-full\",\n // `--c-text`, not `current`. The strip sits entirely OUTSIDE the chip's box\n // (its bottom edge is the chip's top edge, and focus translates the dash a\n // further 2px away), so the dash is always drawn on the grid, never on the\n // chip. Inheriting `color` therefore breaks the moment the chip is selected:\n // the fill flips the chip's text to `--c-on-solid` for legibility *on* the\n // fill, which is near-black, and the dash would take that colour out onto a\n // dark grid and vanish. The palette's `--c-text` is the value that tracks the\n // surface the dash actually sits on.\n \"before:bg-(--c-text)/50 before:opacity-0 before:transition-[opacity,transform]\",\n\n \"group-hover:before:opacity-100\",\n \"group-focus-within:before:opacity-100\",\n \"focus-visible:before:opacity-100\",\n // Opaque on focus, against the resting 50% above. This used to read\n // `bg-primary`, which is not a color this kit defines β€” Tailwind emitted\n // nothing for it, so a focused grip silently kept the resting fill.\n \"focus-visible:before:bg-(--c-text)\",\n /**\n * The ring is deliberately a hand-written mirror of\n * `focusStyles({ ring: \"palette\" })` rather than a call to it: that helper\n * rings the *element*, and this element is an invisible full-width hit strip\n * (`inset-x-0`, 8px / 44px coarse) β€” ringing it would draw a rectangle across\n * the whole chip instead of around the dash, which is the actual affordance.\n * So the ring has to live on `::before`, and the helper's strings cannot be\n * mechanically prefixed (its own doc explains why they must stay whole\n * literals for Tailwind's scanner).\n *\n * Everything else is kept in lockstep with it on purpose β€” 2px, same offset\n * colors, `outline-none`, and `--c-text` rather than `--c-solid`. That last\n * one was the drift: `focusStyles` rejects `--c-solid` explicitly (it is 500\n * in both themes, so it has nowhere to go), and measured on these chips it\n * ringed 2.69:1 against the grid and 1.80:1 against the chip border, versus\n * `--c-text`'s 5.41:1 and 3.62:1. One of the hand-inlined declarations #148\n * tracks; corrected here because the selected state below made it acute.\n */\n \"focus-visible:before:ring-2 focus-visible:before:ring-(--c-text) focus-visible:before:ring-offset-2 focus-visible:before:ring-offset-brand-50 dark:focus-visible:before:ring-offset-brand-950\",\n // Deliberately no `data-selected` override here, unlike the chip itself: the\n // chip's own ring needs one because a selected chip fills with `--c-solid`\n // and is the surface its ring is drawn on, whereas this ring is drawn on the\n // grid in both states. `--c-text` against the page background is exactly the\n // case `focusStyles({ ring: \"palette\" })` is specified for.\n \"focus-visible:outline-none\",\n)\n// The dash sits flush at the edge (opacity-0) at rest; on hover/focus it\n// fades in *and* slides further outward from the chip β€” up for the top\n// handle, down for the bottom one β€” so it reads as emerging from the\n// border rather than just appearing in place. Uses an arbitrary\n// `transform-[translateY(...)]` rather than Tailwind's own `translate-y-*`\n// utility: that utility drives the standalone `translate` CSS property via\n// a `--tw-translate-y` custom property registered with `syntax: \"*\"`, which\n// is non-interpolable β€” a transition on it (or on `transform`, which it\n// never touches) doesn't tween, it just jumps partway through the\n// duration. Same reason `chipShell`'s drag preview above already goes\n// through `transform-[translateY(...)]` instead.\nconst gripTop =\n \"-top-0.25 -translate-y-full items-end pb-px group-hover:before:transform-[translateY(-2px)] group-focus-within:before:transform-[translateY(-2px)] focus-visible:before:transform-[translateY(-2px)]\"\nconst gripBottom =\n \"-bottom-0.25 translate-y-full items-start pt-px group-hover:before:transform-[translateY(2px)] group-focus-within:before:transform-[translateY(2px)] focus-visible:before:transform-[translateY(2px)]\"\n\n// Deliberately no `overflow-hidden` on the root: the resize grips straddle\n// the chip's own top/bottom edge (half in, half out) so their touch hitbox\n// can be bigger than the visible chip on a coarse pointer β€” clipping the\n// root would silently make that outer half unclickable. Title/time text\n// truncate individually via their own `truncate` class instead.\nconst chipShell = cva(\n [\n // No `py-*` here on purpose β€” the vertical padding lives on `ChipContent`'s\n // own row so a container query can collapse it as the chip shrinks (a\n // query may never style its own container). Keeping it here would also\n // make the queried *content* box depend on the very padding being set,\n // which is circular. `@container-size/sch-chip` makes the chip a size\n // container so those queries read its real rendered height instead of the\n // floor-derived estimate this file used to guess with β€” matching\n // `DataTable`'s own `@container` precedent. Size containment has no\n // clipping clause (only `contain: paint` clips), so the grips below still\n // straddle the edge; verified in a browser, see the note above.\n \"@container-size/sch-chip absolute select-none rounded-sm px-2 text-start text-xs\",\n // An explicit display, because the two kinds are different elements: the\n // static chip is a native `<button>`, and a button centres its content\n // box vertically inside whatever height it is given, so a tall static\n // chip floated its title mid-block while the `<div role=\"button\">` beside\n // it kept its own at the top. A flex container has no such centring, and\n // for the interactive chip it changes nothing β€” `ChipContent` is the only\n // in-flow child and still stretches to full width; the grips and the\n // remove button are absolute and pinned on both axes they care about.\n \"flex flex-col\",\n EVENT_COLOR_CLASSES,\n // A soft card-like shadow β€” cheap depth cue that reads as \"layered\" once\n // `--sch-chip-z`/`columnInsets` below actually overlap two chips'\n // boxes; harmless (barely visible) on a lone, non-overlapping event.\n // Lifts slightly further on hover β€” the kit's own micro-interaction\n // idiom elsewhere is a background/border-color shift (Button, ActionIcon,\n // ChoiceCardGroup), never geometry, so a shadow bump (not a scale/\n // translate) is what stays \"classy and sober\" here while still reading\n // as a distinct hover cue.\n EVENT_SELECTED_CLASSES,\n \"shadow-sm shadow-black/10 dark:shadow-black/30\",\n \"hover:shadow-md hover:shadow-black/15 dark:hover:shadow-black/40\",\n // Scoped to `left`/`width` only β€” the overlap-cascade's own outputs\n // (`columnInsets`, recomputed fresh every render whenever a sibling\n // event is created/removed/moved). Deliberately excludes `top`/`height`\n // (driven *live*, every pointermove, by drag/resize's own transform/\n // calc() preview vars below β€” a transition there would lag the pointer)\n // and z-index (paint-order only, not worth animating). Reuses the same\n // ease-out curve `schedule-chip-in`/`popover-in`/`toast-in` already\n // share, so this reads as the same family of motion, not a mismatched\n // one-off.\n //\n // One declaration, in the CSS shorthand, because `transition-property` can\n // only be set once: this used to be a `transition-[left,width]` utility\n // *plus* a `transition-shadow duration-150` one a few lines up, and\n // tailwind-merge (correctly) collapsed them to the last β€” so the hover\n // shadow lift documented above has never actually animated. Writing every\n // property here keeps that from silently recurring, and lets the geometry\n // keep its own 200ms expo while the colors take the kit's usual 150ms.\n //\n // The color half is what the selected state needs: `EVENT_SELECTED_CLASSES`\n // swaps `bg`/`border`/`text` between the palette's light and filled\n // variants, and without this the chip would snap between them.\n //\n // `top`/`height` stay excluded for the reason above, and so does anything\n // written live during a gesture β€” see the `data-dragging`/`data-resizing`\n // escape below, which is the same \"never animate what the pointer is\n // driving\" rule applied to the invalid tint.\n \"[transition:left_200ms_cubic-bezier(0.16,1,0.3,1),width_200ms_cubic-bezier(0.16,1,0.3,1),box-shadow_150ms_ease-out,background-color_150ms_ease-out,border-color_150ms_ease-out,color_150ms_ease-out]\",\n // `data-invalid` repaints the chip red on *every* pointermove while a drag\n // or resize is live. Fading that in would blur a validity signal the user\n // is actively steering, so gestures opt out of the transition entirely β€”\n // exactly the call the comment above makes for `top`/`height`.\n \"data-dragging:transition-none data-resizing:transition-none\",\n \"motion-reduce:transition-none\",\n \"transform-[translateY(var(--sch-drag-offset-y,0px))] top-(--sch-base-top)\",\n \"h-[max(var(--sch-base-height),calc(1rem+2px))]\",\n // One delta per edge, not one delta plus \"which edge is moving\".\n //\n // The old contract was `--sch-resize-delta-y` + `data-resizing-edge`,\n // with a separate `calc()` per edge. It assumed exactly one edge moves,\n // which `resizeCollision: \"push\"`/`\"swap\"` breaks outright: a push slides both\n // edges, and a swap needs `top` to stop while `height` keeps growing past\n // where the other edge used to be. Neither is expressible as a signed\n // delta on one edge.\n //\n // Two vars, both defaulting to `0px`, subsume the old behaviour exactly\n // rather than sitting beside it: an ordinary start resize writes only\n // `--sch-resize-delta-start` and reduces to `top + dy` / `height - dy`;\n // an ordinary end resize writes only `--sch-resize-delta-end` and reduces\n // to `height + dy`. Push and swap are then simply \"both are set\".\n //\n // `data-resizing` gates the pair. `data-resizing-edge` survives, but now\n // means only \"which grip the user grabbed\" β€” it no longer implies which\n // edge is *moving*, since under `\"push\"`/`\"swap\"` both do.\n \"data-resizing:top-[calc(var(--sch-base-top)+var(--sch-resize-delta-start,0px))]\",\n // The floor is applied *here*, to the result, and never to the input.\n //\n // `--sch-base-height` is the chip's true height; the deltas below are true\n // pixel displacements (`use-event-resize.ts` measures them against the real\n // clipped span). Mixing a floored base with true deltas is wrong in both\n // directions wherever one slot renders shorter than a line of content β€” on\n // a 624px column showing 13 hours a 15-minute slot is 12px against an 18px\n // floor, so a chip already at the minimum starts 6px inflated and every\n // subsequent size inherits that error. Shrinking drew a box that jumped up\n // on release; growing drew one that jumped down.\n \"data-resizing:h-[max(calc(var(--sch-base-height)-var(--sch-resize-delta-start,0px)+var(--sch-resize-delta-end,0px)),calc(1rem+2px))]\",\n focusStyles({ ring: \"palette\", offset: false }),\n // `columnInsets` (`schedule-geometry.ts`) hands every chip a cascade\n // z-index via `--sch-chip-z` (higher `column` = further overlapping =\n // painted in front) instead of relying on DOM order, since overlapping\n // columns now genuinely intrude on each other's boxes instead of\n // sitting flush side by side.\n \"z-(--sch-chip-z)\",\n // The always-on `transform` above already makes every chip its own\n // stacking context (regardless of whether it's actually mid-drag), so a\n // later-starting event that begins right where an earlier one ends\n // paints entirely on top of it in plain DOM order β€” including that\n // earlier chip's resize-handle hit area, which straddles past its own\n // edge into exactly that shared boundary (see `gripBase`'s comment).\n // Promote the chip whenever it's actually being interacted with, so its\n // handles are always reachable regardless of the cascade's own z-index\n // (`MAX_CASCADE_Z_INDEX` in `schedule-geometry.ts` stays under this).\n // Still well under the gutter/header's z-30/z-40, so sticky chrome stays\n // on top.\n \"hover:z-25 focus-within:z-25 data-resizing:z-25 data-selected:z-25\",\n \"w-(--sch-chip-w)\",\n // Live drag/resize invalidity (`use-event-drag.ts`/`use-event-resize.ts`\n // write this on every `pointermove`) β€” overrides the event's own\n // `data-color` tint with red regardless of which color it is, the same\n // \"one status signal\" role `schedule-create-draft.tsx`'s own\n // `data-invalid:` variant plays for the create-drag ghost box.\n \"data-invalid:bg-red-500/10 data-invalid:text-red-700 dark:data-invalid:text-red-400\",\n // Continuation cue for an event drawn as several per-day pieces: square\n // off the cut edge and drop its border, so the piece visibly runs off the\n // end of its own day instead of reading as a self-contained event that\n // happens to sit at 22:00. Rounded corners are a chip's strongest \"this\n // object is complete\" signal, so removing them on exactly one side reads\n // instantly with no legend β€” and the chip has no room for a glyph (it is\n // `text-xs`, 18px minimum, with `pe-5` already reserved for the remove\n // button). FullCalendar draws the same distinction structurally, via its\n // own `fc-event-start`/`fc-event-end` classes.\n // While its event is being dragged, every piece of it dims together β€” a\n // half-moving multi-day event would visibly contradict \"this is one\n // event\" at the exact moment that matters most. The ghost carries the\n // live position; these stay put until the commit re-renders them.\n \"data-dragging:opacity-40\",\n \"data-continues-before:rounded-t-none data-continues-before:border-t-0\",\n \"data-continues-after:rounded-b-none data-continues-after:border-b-0\",\n ],\n {\n // Static and data chips are meant to look identical (see the `color` note\n // in `schedule-types.ts`) β€” the only intended distinction is behavioral: a\n // static event is read-only, so it never shows a grab cursor. They are\n // still different elements, though, which is what the `flex flex-col`\n // above is for.\n variants: {\n kind: {\n // No cursor class here β€” an interactive chip's cursor depends on\n // whether it's actually draggable right now (`editable`), not on\n // `kind` alone, so `InteractiveEventChip` applies it separately.\n event: \"\",\n static: \"cursor-default\",\n },\n },\n },\n)\n\nconst chipShellStyle = (\n top: number,\n height: number,\n insets: { left: string; width: string; zIndex: number },\n): CSSProperties =>\n ({\n \"--sch-base-top\": `${top}%`,\n // `max(...)`, not a JS `Math.max` on a px number (correction after v1\n // shipped) β€” `height` is a percentage of the day-column's own real\n // (possibly-stretched) height now, so \"at least one line of content\" can\n // only be expressed as a CSS floor, not a flat number computed once at\n // render time. `calc()` throughout this file's own resize-preview formulas\n // (`chipShell`'s `data-[resizing-edge=...]` variants) already mix\n // `%`/`px` operands freely, so nesting `max()` inside them needs no\n // further change there.\n //\n // The floor is one line of content plus the border (see the box-math note\n // at the top of this file) β€” it used to be a bare `18px`, which is the\n // same number at a 16px root but broke on any other, and which the fixed\n // `py-1` then ate 8px of, leaving 8px of content box for a 16px line. That\n // is what painted a 15-minute event's title *below* its own bottom border\n // (the root is deliberately `overflow: visible`, so nothing clipped it).\n //\n // Deliberately cosmetic-only: `resolvePxPerMinute` (`schedule-geometry.ts`)\n // and both gesture hooks measure the *day column*, never the chip, so a\n // 15-minute chip drawn taller than its true duration still commits exact\n // minutes, and its `top` edge β€” the one a user reads a start time off the\n // gutter with β€” stays pixel-honest. Only the bottom edge inflates.\n // The chip's *true* height, unfloored. The `max(..., calc(1rem + 2px))`\n // floor lives at each use site above instead, because the resize preview\n // has to do its arithmetic on the real value and floor the result β€” see its\n // own comment. Baking the floor in here made the preview compound the\n // error whenever a chip was already at or under one line of content.\n \"--sch-base-height\": `${height}%`,\n \"--sch-chip-z\": insets.zIndex,\n \"--sch-chip-w\": insets.width,\n left: insets.left,\n }) as CSSProperties\n\n/** The details popover's panel width is content-driven, not trigger-matched\n * β€” an event chip can be a narrow sliver, which would make a `\"target\"`-\n * width panel absurdly cramped. Capped so a long description can't sprawl,\n * and so it fits the grid it portals into (`gridPanelMaxWidth`).\n * `select-text` because the panel portals into the timed grid, which is\n * `select-none` as a whole. */\nconst detailsPopoverContent = cn(\"select-text\", gridPanelMaxWidth)\n\n/**\n * Where the details panel opens: *beside* the chip, top-aligned, never above\n * or below it. A timed chip can be as tall as the whole grid (a whole-day\n * event), and then neither end has any room β€” a `bottom` panel landed below\n * 24:00, off the bottom of the scroll area.\n *\n * - `flip` to the other side when this one is full (the last day columns).\n * - `slide` keeps the panel inside the visible grid along the chip's length,\n * so a whole-day event's panel stays in view while the grid scrolls;\n * Floating UI's `limitShift` stops it at the chip's own ends.\n * - `overlap` covers the case where neither side fits (Day view, or any\n * column as wide as the grid): the panel is pushed back inside the grid,\n * over the chip's visible part, rather than off its edge.\n * - `boundary` is the grid minus its sticky header and gutter, so sliding\n * stops where the panel would tuck under them.\n */\n/** The duration (ms) and easing CSS would transition `property` with, from\n * the element's computed `transition` lists β€” `undefined` when it wouldn't\n * (`transition-none`: dragging, resizing, reduced motion). */\nconst cssTransitionOf = (el: Element, property: string) => {\n const style = getComputedStyle(el)\n const index = style.transitionProperty.split(\", \").indexOf(property)\n if (index < 0) return undefined\n // The lists repeat to the property list's length; commas inside\n // `cubic-bezier(...)` are not separators.\n const at = (list: string[]) => list[index % list.length] ?? \"\"\n const duration = Number.parseFloat(at(style.transitionDuration.split(\", \"))) * 1000\n const easing = at(style.transitionTimingFunction.split(/,\\s*(?![^(]*\\))/))\n return duration > 0 ? { duration, easing } : undefined\n}\n\n/**\n * Keeps a chip's CSS motion working when React *moves* its node.\n *\n * The timed grid orders chips by start (so tab order follows the picture), and\n * when two chips swap order React `insertBefore`s one of them. A browser treats\n * that as a re-insertion: it restarts the node's CSS animations and drops its\n * transitions (#237). So the moved chip used to replay its entrance β€” popping\n * in from 92% scale, its open details popover flinching along β€” and never got\n * the `left`/`width` slide its sibling did.\n *\n * - **Entrance**: dropped once it has played, so a move has nothing to\n * restart. Only the chip's own `animationend` counts (React bubbles it\n * through portals, so a child's or the popover's would end it early), and\n * under any name β€” reduced motion swaps the keyframes for `fade-in`.\n * - **Slide**: when `left`/`width` changed but the browser started no\n * transition for it, the node was moved; the same slide is played from the\n * old values instead, with the duration and easing read off the chip's own\n * CSS, so `chipShell` stays the one place they are defined.\n */\nfunction useChipMotion(\n ref: RefObject<HTMLElement | null>,\n insets: { left: string; width: string },\n) {\n const [entered, setEntered] = useState(false)\n const onAnimationEnd = (e: ReactAnimationEvent<HTMLElement>) => {\n if (e.target === e.currentTarget) setEntered(true)\n }\n\n const { left, width } = insets\n const previous = useRef({ left, width })\n useLayoutEffect(() => {\n const from = previous.current\n previous.current = { left, width }\n const el = ref.current\n if (!el || (from.left === left && from.width === width)) return\n // `getAnimations()` flushes style first, so a node that stayed put already\n // shows the transition CSS started for it.\n const transitioned = el\n .getAnimations()\n .some(\n (a) =>\n a instanceof CSSTransition &&\n (a.transitionProperty === \"left\" || a.transitionProperty === \"width\"),\n )\n const slide = cssTransitionOf(el, \"left\")\n if (transitioned || !slide) return\n el.animate([{ left: from.left, width: from.width }, {}], slide)\n }, [ref, left, width])\n\n return { entered, onAnimationEnd }\n}\n\nconst detailsPositioning = (anchor: RefObject<Element | null>): PopoverProps[\"positioning\"] => ({\n placement: \"right-start\",\n flip: [\"left-start\"],\n slide: true,\n overlap: true,\n boundary: () => timedGridViewport(anchor.current),\n})\n\nfunction ChipContent<P>({\n event,\n locale,\n classNames,\n reserveRemoveSpace,\n}: {\n event: ScheduleAnyEvent<P>\n locale?: string\n classNames?: ScheduleEventChipClassNames\n /** The remove button (`InteractiveEventChip`, whenever `editable` grants\n * `\"remove\"` for this event) is absolutely positioned over the chip's own\n * content instead of laid out beside it β€” so a title/time line long enough\n * to truncate at the chip's full width would otherwise render right under\n * it, unreadable. Reserves just enough end-inset to clear the button's\n * *hit* area before text starts truncating: 24px wide, ending 0px from the\n * padding box's inline end, against which the root's own `px-2` already\n * supplies 8px β€” hence `pe-5` (20px) on this column rather than the 24px\n * the hit area itself spans.\n *\n * Must be driven by the same condition that renders the button, i.e.\n * `canRemove`, and NOT by `onEventRemove != null`: every chip is handed\n * `ScheduleTimedGrid`'s own `handleEventRemove` (an unconditional\n * `useCallback` that announces, then optional-chains the consumer's\n * handler), so that test is a constant `true` and used to reserve 20px on\n * every interactive chip for a button that a default, read-only\n * `Schedule` never renders. */\n reserveRemoveSpace?: boolean\n}) {\n return (\n // The chip root's vertical padding lives here (see `chipShell`), stepping\n // 0 -> 2px -> 4px as the chip's own content box clears one line, one line\n // plus half the padding, then one line plus all of it. A 15-minute event\n // at the default density only has ~16px of content box to work with, so\n // giving that box entirely to the single title line is what makes it read;\n // anything taller gets the normal `py-1` back.\n <div\n className={cn(\n \"flex items-start gap-1 py-0\",\n \"[@container_sch-chip_(height>=calc(1rem+4px))]:py-0.5\",\n \"[@container_sch-chip_(height>=calc(1rem+8px))]:py-1\",\n )}\n >\n {event.icon != null ? (\n <span className={cn(\"mt-0.5 shrink-0 [&_svg]:size-3\", classNames?.icon)}>{event.icon}</span>\n ) : null}\n <div className={cn(\"min-w-0 flex-1\", reserveRemoveSpace && \"pe-5\")}>\n <p className={cn(\"truncate font-medium\", classNames?.title)}>{event.title}</p>\n {/* Always rendered, revealed by a size query on the chip's *real*\n height rather than the floor-derived estimate this used to guess\n with β€” which under-read a stretched column and so withheld the row\n from chips that had room, and over-read nothing, which is why a\n 45-minute event used to render a second line ~6px past its own\n bottom border. `hidden` is the default so an engine without\n container queries fails *closed*, with the title still readable.\n Hiding it costs assistive tech nothing: the chip's own `aria-label`\n always carries the full range. */}\n <p\n className={cn(\n // `group-data-selected:` tracks the chip's filled state β€” the\n // plain `--c-text` below is dark-on-dark once the root paints\n // `--c-solid`.\n \"hidden truncate text-(--c-text)/80 group-data-selected:text-(--c-on-solid)/80\",\n // Follows the root's own color transition, or the label would snap\n // while the fill behind it fades.\n \"transition-colors duration-150 ease-out motion-reduce:transition-none\",\n \"[@container_sch-chip_(height>=calc(2rem+8px))]:block\",\n classNames?.time,\n )}\n >\n {timeRangeLabel(event.start, event.end, locale)}\n </p>\n </div>\n </div>\n )\n}\n\nexport type ScheduleEventChipProps<P = unknown> = {\n event: ScheduleAnyEvent<P>\n /** Whether this chip is the piece carrying the event's **real** start β€”\n * false for a piece that begins at a midnight cut, at `startHour`, or at\n * the visible window's first day (`ScheduleSegment.isFirst`). Only the\n * piece that owns an edge renders that edge's resize grip: a grip on a\n * clipped edge would drag a boundary that isn't on screen. */\n isFirst?: boolean\n /** As `isFirst`, for the end edge. */\n isLast?: boolean\n /** 0-based column this piece is painted in β€” a drag's day delta is measured\n * from the grabbed piece, not from the event's own start. */\n dayIndex?: number\n /** The date of that column β€” the origin a resize offsets calendar days from\n * once its edge leaves the column. Required rather than derived: for a\n * multi-day event's later pieces, neither `event.start` nor anything else\n * on the event identifies the column this particular piece is painted in. */\n day: Date\n timeZone?: string\n /** The rendered window, for the drag ghost's own percentage math. */\n startHour?: number\n totalWindowMinutes?: number\n /** Page the view by one range, while a drag is held against a grid edge\n * that can no longer scroll. Internal β€” never a public Schedule prop. */\n onPaginate?: (direction: -1 | 1) => void\n /** Percentage (0–100) of the day-column's own total height. */\n top: number\n /** Percentage (0–100) of the day-column's own total height. Consumers\n * apply a `max(height%, calc(1rem + 2px))` CSS floor, not a JS one β€” a\n * percentage can't express \"at least one line of content\" as a flat number\n * once the column's real rendered height can vary. */\n height: number\n insets: { left: string; width: string; zIndex: number }\n slotDuration: number\n /** Already resolved to a whole number of slots β€” see `resolveSlotDurations`. */\n minDuration: number\n resizeCollision: ScheduleCollision\n maxDuration?: number\n slotDisabled?: ScheduleSlotPredicate\n /** Schedule-level `editable` grant, already resolved per-gesture by the\n * caller (`isEditGestureEnabled`) β€” composed here with the event's own\n * `editable` (narrow-only) via `isEventGestureEnabled`. */\n editableDrag?: boolean\n editableResize?: boolean\n editableRemove?: boolean\n /** RFC Β§12a, axis A already resolved per-gesture by the caller. */\n preventOverlapOnDrag?: boolean\n preventOverlapOnResize?: boolean\n /** RFC Β§12a, axis B already resolved by the caller for this day. */\n overlapCandidates?: { id: string; start: Date; end: Date }[]\n /** Already resolved by the caller against the schedule's `selected` ids. */\n selected?: boolean\n /** Selected *and* first in the list β€” the one chip whose details popover\n * opens. Defaults to `selected`, the single-id case. */\n anchor?: boolean\n /** Fires with the event on a resolved click, or `null` when the details\n * popover is dismissed. Named `onEventSelect`, not `onSelect`, so it can\n * never collide with the DOM prop of that name if a chip ever moves onto an\n * `ark.*` root. */\n onEventSelect?: (event: ScheduleAnyEvent<P> | null) => void\n /** Whether the built-in details popover mounts for this chip when selected. */\n withEventDetails?: boolean\n /**\n * Whether this chip is still in `data`, or is an outgoing copy playing its\n * exit.\n *\n * Derived by `ScheduleTimedGrid` from `data` itself β€” an event that was there\n * last render and is not there now β€” so removal animates however it happened:\n * the `x`, a consumer's own delete button, a server push. The chip is told,\n * it never decides.\n */\n present?: boolean\n /** The exit animation finished, so this outgoing copy can be dropped. */\n onExitComplete?: (event: ScheduleEvent<P>) => void\n onEventChange?: (\n event: ScheduleEvent<P>,\n next: { start: Date; end: Date },\n reason: \"drag\" | \"resize\",\n ) => void\n onEventRemove?: (event: ScheduleEvent<P>) => void\n /** Overrides the built-in event-details popover's content. */\n renderEventDetails?: (event: ScheduleAnyEvent<P>) => ReactNode\n locale?: string\n translations: Required<ScheduleTranslations>\n classNames?: ScheduleEventChipClassNames\n /** `ScheduleClassNames.eventDetailsPopover` β€” the popover panel itself,\n * not a chip part, so it's threaded separately from `classNames` above. */\n detailsPopoverClassName?: string\n}\n\n/** Read-only: a plain, real `<button>` (no nested interactive children, so\n * the native element is valid) β€” native keyboard/click semantics for free,\n * no drag/resize hooks called at all. */\nfunction StaticEventChip<P = unknown>({\n event,\n isFirst = true,\n isLast = true,\n top,\n height,\n insets,\n selected = false,\n anchor = selected,\n onEventSelect,\n withEventDetails = true,\n renderEventDetails,\n locale,\n classNames,\n detailsPopoverClassName,\n}: Omit<\n ScheduleEventChipProps<P>,\n | \"slotDuration\"\n | \"minDuration\"\n | \"slotDisabled\"\n | \"editableDrag\"\n | \"editableResize\"\n | \"editableRemove\"\n | \"preventOverlapOnDrag\"\n | \"preventOverlapOnResize\"\n | \"overlapCandidates\"\n | \"onEventChange\"\n | \"onEventRemove\"\n | \"translations\"\n> & { event: ScheduleStaticEvent<P> }) {\n // The selection decides both, so there is no local open state to drift from\n // it: a chip's popover is open exactly when that chip is the anchor.\n const showDetailsPopover = withEventDetails\n const detailsOpen = showDetailsPopover && anchor\n const buttonRef = useRef<HTMLButtonElement>(null)\n const motion = useChipMotion(buttonRef, insets)\n\n const button = (\n <button\n ref={buttonRef}\n type=\"button\"\n data-schedule-part=\"event-chip\"\n data-kind={event.kind}\n data-color={event.color ?? \"pink\"}\n {...dataProps({\n \"data-testid\": event.testId ?? event.id,\n // Stable identity for the drag gesture, which collects every piece of\n // one event across columns. Can't reuse `data-testid` β€” a consumer can\n // override that per event via `event.testId`.\n \"data-event-id\": event.id,\n // `props()` drops JS-falsy entries, so an ordinary single-day chip\n // (isFirst && isLast) emits neither attribute and its DOM stays\n // byte-identical to before segmentation.\n \"data-continues-before\": !isFirst,\n \"data-continues-after\": !isLast,\n \"data-selected\": selected,\n })}\n onClick={() => onEventSelect?.(event)}\n onAnimationEnd={motion.onAnimationEnd}\n aria-label={`${event.title}, ${timeRangeLabel(event.start, event.end, locale)}`}\n {...(showDetailsPopover\n ? { \"aria-haspopup\": \"dialog\" as const, \"aria-expanded\": detailsOpen }\n : {})}\n className={cn(\n chipShell({ kind: \"static\" }),\n // `group` so `ChipContent`'s own descendants can track the selected\n // fill (`group-data-selected:`); the interactive chip already has one.\n \"group\",\n !motion.entered && \"animate-schedule-chip-in\",\n classNames?.root,\n )}\n style={chipShellStyle(top, height, insets)}\n >\n <ChipContent event={event} locale={locale} classNames={classNames} />\n </button>\n )\n\n if (!showDetailsPopover) return button\n\n return (\n <Popover.Root\n // Every Schedule popover is `lazyMount`: a grid holds one per chip, and\n // mounting them all closed cost a hidden panel each. It is also what\n // lets the panel portal straight into the scroller on its first render\n // β€” by the time one opens, the grid's ref is attached (see\n // `lib/overlay-container.tsx`).\n lazyMount\n open={detailsOpen}\n onOpenChange={(d) => {\n // Closing is a deselect: dismissing the popover (outside click, Escape)\n // has to clear the state that opened it, or the chip would stay painted\n // selected with nothing showing and be unable to reopen.\n if (!d.open) onEventSelect?.(null)\n }}\n width=\"auto\"\n positioning={detailsPositioning(buttonRef)}\n >\n <Popover.Trigger asChild>{button}</Popover.Trigger>\n <Popover.Content\n className={cn(detailsPopoverContent, detailsPopoverClassName)}\n // React portals propagate events through the *React* tree, not the DOM\n // tree, so a pointerdown anywhere in this popover still reaches the day\n // column's own `onPointerDown` β€” which arms click-drag-to-create and\n // calls `setPointerCapture`. The capture then retargets pointerup and\n // click to the column, and the control the user actually pressed never\n // receives its click. (Verified in Chromium: pointerdown lands on the\n // button, pointerup and click on `[data-schedule-part=\"day-column\"]`.)\n // The inline remove button already stops propagation for exactly this\n // reason; doing it here covers every interactive thing the popover can\n // contain β€” the Remove action, a link inside `description`, and\n // whatever a consumer renders through `renderEventDetails`.\n onPointerDown={(e) => e.stopPropagation()}\n >\n <Popover.Body>\n <ScheduleEventDetailsContent\n event={event}\n locale={locale}\n renderEventDetails={renderEventDetails}\n />\n </Popover.Body>\n </Popover.Content>\n </Popover.Root>\n )\n}\n\n/** Draggable, resizable, removable. */\nfunction InteractiveEventChip<P = unknown>({\n event,\n onPaginate,\n dayIndex = 0,\n day,\n timeZone = \"UTC\",\n startHour = 0,\n totalWindowMinutes = 1440,\n isFirst = true,\n isLast = true,\n top,\n height,\n insets,\n slotDuration,\n minDuration,\n resizeCollision,\n maxDuration,\n slotDisabled,\n editableDrag,\n editableResize,\n editableRemove,\n preventOverlapOnDrag,\n preventOverlapOnResize,\n overlapCandidates,\n selected = false,\n anchor = selected,\n onEventSelect,\n withEventDetails = true,\n present = true,\n onExitComplete,\n onEventChange,\n onEventRemove,\n renderEventDetails,\n locale,\n translations,\n classNames,\n detailsPopoverClassName,\n}: ScheduleEventChipProps<P> & { event: ScheduleEvent<P> }) {\n const showDetailsPopover = withEventDetails\n const detailsOpen = showDetailsPopover && anchor\n const chipRef = useRef<HTMLDivElement>(null)\n const motion = useChipMotion(chipRef, insets)\n // The remove button commits immediately; the *animation* is driven by `data`\n // afterwards. `ScheduleTimedGrid` keeps an outgoing copy of any event that\n // has left `data` and renders it with `present: false`, so Ark's presence\n // machine plays `data-[state=closed]:animate-schedule-chip-out`, waits for\n // that animation's real `animationend`, and reports back so the copy can be\n // dropped.\n //\n // This used to be inverted β€” the button deferred `onEventRemove` until the\n // exit finished β€” which meant only the built-in button could animate a\n // removal, and a consumer who ignored the callback left the chip invisible\n // forever. Schedule never mutates `data` (`schedule-types.ts`), so an\n // outgoing copy is still the only way to animate an exit at all; it is just\n // derived from the data now rather than from who clicked what. No\n // `unmountOnExit`/`lazyMount`: `presence.unmounted` is never read.\n const presence = usePresence({ present, onExitComplete: () => onExitComplete?.(event) })\n // The event's own `editable`, composed with the already-resolved\n // schedule-level grant β€” narrow-only, see `isEventGestureEnabled`.\n const canDrag = isEventGestureEnabled(editableDrag ?? false, event, \"drag\")\n const canResize = isEventGestureEnabled(editableResize ?? false, event, \"resize\")\n const canRemove = isEventGestureEnabled(editableRemove ?? false, event, \"remove\")\n // The one resolved-click call site both the pointer gesture and the keyboard\n // path below funnel through β€” so selection behaves identically per input\n // method. Crucially this is NOT a DOM `onClick`: the pointer path only\n // reaches it from `use-event-drag.ts`'s `maxAbsDelta < CLICK_SLOP` branch, so\n // hanging selection here inherits that already-correct click-vs-drag\n // resolution for free. A real drag takes the commit branch and never selects.\n const resolvedOnEventClick = ((selectedEvent: ScheduleEvent<P>) =>\n onEventSelect?.(selectedEvent)) as (event: ScheduleEvent<P>) => void\n // `use-event-drag.ts`/`use-event-resize.ts` are non-generic (their\n // `event`/`onEventChange` are typed `ScheduleEvent` = `ScheduleEvent<unknown>`)\n // β€” safe in practice, since each hook only ever forwards back the same\n // `ScheduleEvent<P>` object it was given, but not provable structurally\n // through a contravariant function-parameter position. Cast once, same\n // precedent as the resolved click handler above.\n const resolvedOnEventChange = onEventChange as\n | ((event: ScheduleEvent, next: { start: Date; end: Date }, reason: \"drag\" | \"resize\") => void)\n | undefined\n\n const drag = useEventDrag({\n event,\n dayIndex,\n day,\n endHour: startHour + totalWindowMinutes / 60,\n timeZone,\n startHour,\n totalWindowMinutes,\n onPaginate,\n locale,\n enabled: canDrag,\n slotDuration,\n slotDisabled,\n preventOverlap: preventOverlapOnDrag,\n overlapCandidates,\n onEventChange: resolvedOnEventChange,\n onEventClick: resolvedOnEventClick as (event: ScheduleEvent) => void,\n })\n const resizeStart = useEventResize({\n event,\n edge: \"start\",\n day,\n dayIndex,\n timeZone,\n startHour,\n endHour: startHour + totalWindowMinutes / 60,\n onPaginate,\n slotDuration,\n // `useEventResize` only ever resizes, so the prefix is redundant inside it.\n collision: resizeCollision,\n minDurationMinutes: minDuration,\n maxDurationMinutes: maxDuration,\n slotDisabled,\n preventOverlap: preventOverlapOnResize,\n overlapCandidates,\n onEventChange: resolvedOnEventChange,\n locale,\n })\n const resizeEnd = useEventResize({\n event,\n edge: \"end\",\n day,\n dayIndex,\n timeZone,\n startHour,\n endHour: startHour + totalWindowMinutes / 60,\n onPaginate,\n slotDuration,\n // `useEventResize` only ever resizes, so the prefix is redundant inside it.\n collision: resizeCollision,\n minDurationMinutes: minDuration,\n maxDurationMinutes: maxDuration,\n slotDisabled,\n preventOverlap: preventOverlapOnResize,\n overlapCandidates,\n onEventChange: resolvedOnEventChange,\n locale,\n })\n\n const handleBodyKeyDown = (e: ReactKeyboardEvent<HTMLDivElement>) => {\n if (!present) return\n if (e.key === \"Enter\" || e.key === \" \") {\n e.preventDefault()\n resolvedOnEventClick(event)\n return\n }\n if (!canDrag) return\n const isVertical = e.key === \"ArrowUp\" || e.key === \"ArrowDown\"\n const isHorizontal = e.key === \"ArrowLeft\" || e.key === \"ArrowRight\"\n if (!isVertical && !isHorizontal) return\n // Mandatory: the grid root is `overflow-auto`, so an unhandled arrow\n // scrolls it instead of moving anything.\n e.preventDefault()\n // Left/Right move by a whole day, with no modifier variants β€” the\n // keyboard counterpart of dragging sideways. Up/Down keep their existing\n // `slotDuration` step (Shift Γ—4). Both go through the same displacement\n // primitive as the pointer path, so \"a move never changes duration\" is one\n // rule rather than two implementations of it.\n const step = e.shiftKey ? slotDuration * 4 : slotDuration\n const delta = isHorizontal\n ? { days: e.key === \"ArrowLeft\" ? -1 : 1, minutes: 0 }\n : { days: 0, minutes: e.key === \"ArrowUp\" ? -step : step }\n const next = { ...moveRange(event, delta, { timeZone, slotDuration }) }\n const result = checkRangeCommit(next, {\n slotDisabled,\n timeZone,\n preventOverlap: preventOverlapOnDrag,\n overlapCandidates,\n excludeId: event.id,\n })\n if (!result.ok) {\n flashRejected(e.currentTarget, result.reason)\n return\n }\n onEventChange?.(event, next, \"drag\")\n }\n\n const chipBody = (\n // biome-ignore lint/a11y/useSemanticElements: no native element supports both a drag/resize gesture and a nested remove <button> β€” a <button> can't contain interactive children\n <div\n ref={mergeRefs(presence.ref, chipRef)}\n {...drag.getBodyProps()}\n {...presence.getPresenceProps()}\n data-schedule-part=\"event-chip\"\n data-kind={event.kind}\n data-color={event.color ?? \"pink\"}\n {...dataProps({\n \"data-testid\": event.testId ?? event.id,\n // Stable identity for the drag gesture, which collects every piece of\n // one event across columns. Can't reuse `data-testid` β€” a consumer can\n // override that per event via `event.testId`.\n \"data-event-id\": event.id,\n // `props()` drops JS-falsy entries, so an ordinary single-day chip\n // (isFirst && isLast) emits neither attribute and its DOM stays\n // byte-identical to before segmentation.\n \"data-continues-before\": !isFirst,\n \"data-continues-after\": !isLast,\n \"data-selected\": selected,\n })}\n tabIndex={present ? 0 : -1}\n role=\"button\"\n aria-label={`${event.title}, ${timeRangeLabel(event.start, event.end, locale)}`}\n {...(showDetailsPopover\n ? { \"aria-haspopup\": \"dialog\" as const, \"aria-expanded\": detailsOpen }\n : {})}\n onKeyDown={handleBodyKeyDown}\n onAnimationEnd={motion.onAnimationEnd}\n className={cn(\n \"group\",\n chipShell({ kind: \"event\" }),\n canDrag ? \"cursor-grab active:cursor-grabbing touch-none\" : \"cursor-default\",\n !motion.entered && \"data-[state=open]:animate-schedule-chip-in\",\n \"data-[state=closed]:animate-schedule-chip-out data-[state=closed]:pointer-events-none\",\n classNames?.root,\n )}\n style={chipShellStyle(top, height, insets)}\n >\n <ChipContent\n event={event}\n locale={locale}\n classNames={classNames}\n reserveRemoveSpace={canRemove}\n />\n\n {/* A grip renders only on the piece that actually owns that edge, so a\n * three-day event shows a top grip on day 1, a bottom grip on day 3,\n * and none at all on day 2. The same rule covers a piece clipped by\n * `startHour`/`endHour` or by the window's edge β€” `isFirst`/`isLast`\n * make all of those one fact, not three cases. */}\n {canResize && isFirst ? (\n <div\n {...resizeStart.getHandleProps()}\n className={cn(gripBase, gripTop, classNames?.grip)}\n />\n ) : null}\n {canResize && isLast ? (\n <div\n {...resizeEnd.getHandleProps()}\n className={cn(gripBase, gripBottom, classNames?.grip)}\n />\n ) : null}\n\n {canRemove ? (\n <button\n type=\"button\"\n data-schedule-part=\"remove\"\n aria-label={translations.removeEvent}\n onClick={(e) => {\n e.stopPropagation()\n onEventRemove?.(event)\n }}\n onPointerDown={(e) => e.stopPropagation()}\n className={cn(\n // The button's own box is exactly one line tall β€” `p-0.5` (0.125rem\n // x2) around a `size-3` (0.75rem) icon is `1rem`, the same height\n // as a `text-xs` line box β€” so it belongs on the *same* baseline\n // grid as the title's first line, and its top offset has to track\n // `ChipContent`'s `py-*` bands rather than sit at a fixed `top-1`.\n // Each band's lower bound is `1rem + 2*py`, so with `top == py` the\n // button ends at `py + 1rem <= 1rem + 2*py <= H` at *every* height,\n // fractional ones included β€” where the old fixed `top-1` needed\n // `1.25rem` of content box and a floored 15-minute chip only has\n // `1rem`, leaving the button hanging 3px past the bottom border\n // (the root is `overflow: visible`, so it painted outside).\n // Keep these two thresholds byte-identical to the `py-*` pair on\n // `ChipContent`'s row above β€” `schedule.test.tsx` asserts the two\n // encode the same bands, since Tailwind orders equal-specificity\n // at-rule variants by source order alone.\n \"absolute top-0 inset-e-1 z-10 rounded-full p-0.5 text-(--c-text)\",\n // Same reason as `ChipContent`'s time row: both the glyph and its\n // hover fill have to follow the selected chip's own surface.\n \"group-data-selected:text-(--c-on-solid) group-data-selected:hover:bg-(--c-solid-hover)\",\n \"transition-colors duration-150 ease-out motion-reduce:transition-none\",\n \"[@container_sch-chip_(height>=calc(1rem+4px))]:top-0.5\",\n \"[@container_sch-chip_(height>=calc(1rem+8px))]:top-1\",\n \"hover:bg-(--c-soft-hover)\",\n // Hit area, not visual: the circle the user sees is this button's\n // own `hover:bg-*`, so growing the button would grow the circle.\n // A pseudo-element instead β€” 24px wide always (`-inset-x-1` lands\n // its outer edge exactly on the padding box's inline end, and the\n // root's `px-2` keeps it clear of the `pe-5` text column), and\n // 24px tall once the chip can actually hold that.\n //\n // It must never reach outside the chip. `gripTop`/`gripBottom`\n // park their own hit strips immediately above and below the chip\n // across its full width β€” 44px of them under `pointer: coarse` β€”\n // at the same `z-10`, and this button renders after them, so any\n // vertical overhang here would win the hit test and quietly eat\n // the resize targets. Trading a resize gesture for a bigger\n // *destructive* target, on a strip that sits over a neighbouring\n // event, is a bad bargain in both directions.\n //\n // Hence both halves of the condition, neither redundant: the\n // `calc(1rem+8px)` band is what puts the button at `top-1`, i.e.\n // guarantees the 0.25rem above it that `-inset-y-1` spends, while\n // `1.5rem` is the total the expander occupies. They coincide at a\n // 16px root and diverge either side of it β€” `calc(1rem+8px)` is\n // the larger below 16px, `1.5rem` above β€” so requiring both is\n // what keeps this correct at 12/16/20px alike.\n \"after:absolute after:-inset-x-1 after:inset-y-0 after:content-['']\",\n \"[@container_sch-chip_(height>=1.5rem)_and_(height>=calc(1rem+8px))]:after:-inset-y-1\",\n focusStyles({ ring: \"palette\", offset: false }),\n // A small, isolated scale micro-interaction β€” safe here (unlike\n // the chip root) since this button has no other `transform` to\n // compose with or fight.\n \"transition-transform duration-150 motion-reduce:transition-none\",\n \"hover:transform-[scale(1.08)] active:transform-[scale(0.92)]\",\n classNames?.removeButton,\n )}\n >\n <XIcon className=\"size-3\" />\n </button>\n ) : null}\n </div>\n )\n\n if (!showDetailsPopover) return chipBody\n\n return (\n <Popover.Root\n lazyMount\n open={detailsOpen}\n onOpenChange={(d) => {\n // Closing is a deselect β€” see `StaticEventChip`'s own note.\n if (!d.open) onEventSelect?.(null)\n }}\n finalFocusEl={() => chipRef.current}\n width=\"auto\"\n positioning={detailsPositioning(chipRef)}\n >\n <Popover.Anchor asChild>{chipBody}</Popover.Anchor>\n <Popover.Content\n className={cn(detailsPopoverContent, detailsPopoverClassName)}\n // React portals propagate events through the *React* tree, not the DOM\n // tree, so a pointerdown anywhere in this popover still reaches the day\n // column's own `onPointerDown` β€” which arms click-drag-to-create and\n // calls `setPointerCapture`. The capture then retargets pointerup and\n // click to the column, and the control the user actually pressed never\n // receives its click. (Verified in Chromium: pointerdown lands on the\n // button, pointerup and click on `[data-schedule-part=\"day-column\"]`.)\n // The inline remove button already stops propagation for exactly this\n // reason; doing it here covers every interactive thing the popover can\n // contain β€” the Remove action, a link inside `description`, and\n // whatever a consumer renders through `renderEventDetails`.\n onPointerDown={(e) => e.stopPropagation()}\n >\n <Popover.Body>\n <ScheduleEventDetailsContent\n event={event}\n locale={locale}\n renderEventDetails={renderEventDetails}\n // The full-size removal path. The inline `(x)` is 16px wide and\n // cannot reach WCAG 2.2 SC 2.5.8's 24x24 on a floored short chip\n // without overhanging the chip and eating the resize grips' hit\n // strips, so the criterion is met for the *function* instead, via\n // its \"bypass\" exception: the same removal reachable from a\n // control that does clear the minimum. Routed through the same\n // callback the inline button uses, not a second one β€” closing the\n // popover first so focus returns to the chip before `data` drops it\n // and the exit starts.\n onRemove={\n canRemove\n ? () => {\n // Deselect to close β€” the popover's open state IS the\n // selection now, so there is no separate flag to lower.\n onEventSelect?.(null)\n onEventRemove?.(event)\n }\n : undefined\n }\n removeLabel={translations.removeEvent}\n />\n </Popover.Body>\n </Popover.Content>\n </Popover.Root>\n )\n}\n\nexport function ScheduleEventChip<P = unknown>(props: ScheduleEventChipProps<P>): ReactNode {\n return props.event.kind === \"event\" ? (\n <InteractiveEventChip {...props} event={props.event} />\n ) : (\n <StaticEventChip {...props} event={props.event} />\n )\n}\n","/**\n * RFC Β§5 (`docs/rfcs/schedule.md`) concurrent-event layout β€” the \"Google\n * Calendar\" interval-graph greedy column-packing algorithm, plus a\n * width-maximizing pass and an optional per-cluster column cap with\n * overflow reporting. Pure, no React, no day-boundary awareness: the\n * caller pre-clips `events` to one rendered day-column (via\n * `eventOccursOnDay`) before calling either export below.\n *\n * \"Overlap\" here means *visual* overlap: with a `floorMs`, every event is\n * packed as if it ended no earlier than `start + floorMs` β€” the time one\n * floored chip covers (`visualFloorMs`, `schedule-geometry.ts`). Without it,\n * a burst of second-long events never conflicts in time, so each gets the\n * full width and their floored chips paint on top of each other.\n */\n\nexport type ScheduleLayoutResult = {\n column: number\n /** Contiguous columns (from `column`, rightward) this event may occupy β€”\n * widened up to (not touching) the nearest column, among columns to its\n * right, containing an event that visually overlaps it (see the header). Always\n * `>= 1` and never wide enough to cover a reserved overflow-indicator\n * column when the cluster has one. Optional in the type only so\n * hand-built literals (tests, mocks) don't need it; `layoutEventColumns`\n * and `layoutEventColumnsCapped` always populate it. */\n columnSpan?: number\n columnCount: number\n}\n\ntype LayoutInput = { id: string; start: Date; end: Date }\n/** An input normalised once to epoch ms, `end` already floored β€” so the sort,\n * sweep and span passes compare numbers instead of calling `getTime()` on\n * every comparison. */\ntype Interval = { id: string; start: number; end: number }\ntype ClusterRecord = Interval & { column: number }\n\n/** One overflowing cluster's hidden events, collapsed into a single \"+N\"\n * indicator (`ids.length` is the \"N\") β€” not one entry per instant-by-instant\n * change in exactly which events are hidden. `start`/`end` are the union of\n * the hidden events' own ranges (their earliest start to their latest end),\n * not a precise per-instant window: time-slicing by exactly who's hidden\n * when sounds more precise, but for a cluster of several staggered\n * short-lived events it fragments into many awkwardly-short spans that,\n * once each is floored to a legible minimum height, visually collide with\n * their neighbors. One coarse-but-clickable indicator per cluster β€” the\n * same \"don't try to convey timing, just disclose who's hidden\" shape\n * Month view's own \"+N\" pill already uses β€” reads far better and loses\n * nothing a click-through doesn't already recover (each hidden event still\n * shows its own real time range once disclosed). */\nexport type ScheduleOverflowSpan = { start: Date; end: Date; ids: string[] }\n\nexport type ScheduleCappedLayout = {\n layout: Map<string, ScheduleLayoutResult>\n overflow: ScheduleOverflowSpan[]\n}\n\n/** Widens `e` rightward from its own column, stopping at (not including)\n * the first column, within `[e.column + 1, bound)`, holding another\n * cluster event that genuinely overlaps `e` in time. Checking real time\n * overlap β€” not mere column occupancy β€” makes the result independent of\n * which specific valid minimal column assignment produced `clusterVisible`:\n * a column that happens to hold a freed-and-reused, non-conflicting\n * neighbor is correctly skipped rather than treated as a blocker. `bound`\n * excludes any reserved overflow column so a widening event can never\n * visually cover the \"+N\" indicator. */\nfunction computeSpan(e: ClusterRecord, clusterVisible: ClusterRecord[], bound: number): number {\n let span = 1\n for (let col = e.column + 1; col < bound; col++) {\n const blocked = clusterVisible.some(\n (o) => o.column === col && o.start < e.end && e.start < o.end,\n )\n if (blocked) break\n span++\n }\n return span\n}\n\n/** Splits chronologically-sorted `events` into overlap clusters β€” maximal\n * runs of temporally-connected events, with a gap (no event active) between\n * any two clusters. Independent of `maxColumns`: an event's real `end`\n * determines when a cluster drains regardless of whether that event ends up\n * visible or overflowed, so cluster boundaries never depend on the cap. */\nfunction groupIntoClusters(sorted: Interval[]): Interval[][] {\n const clusters: Interval[][] = []\n let current: Interval[] = []\n let clusterEnd = Number.NEGATIVE_INFINITY\n for (const event of sorted) {\n if (current.length > 0 && event.start >= clusterEnd) {\n clusters.push(current)\n current = []\n clusterEnd = Number.NEGATIVE_INFINITY\n }\n current.push(event)\n clusterEnd = Math.max(clusterEnd, event.end)\n }\n if (current.length > 0) clusters.push(current)\n return clusters\n}\n\n/** Places one cluster's already-chronologically-sorted events at a fixed\n * column cap β€” sweeps left to right assigning the lowest free column\n * (exclusive-end: a column frees the moment its occupant ends). An event's\n * greedy `column` already equals how many other events were genuinely\n * concurrent with it at its own start instant, so `column >= maxColumns` is\n * a one-time, per-event overflow decision at placement time β€” a brief spike\n * only overflows its own excess arrivals, not the whole cluster. */\nfunction placeCluster(\n clusterEvents: Interval[],\n maxColumns: number,\n): {\n visible: Map<string, ScheduleLayoutResult>\n overflowRaw: Interval[]\n} {\n const activeColumnEnds: (number | null)[] = []\n const clusterVisible: ClusterRecord[] = []\n const clusterOverflow: Interval[] = []\n\n for (const event of clusterEvents) {\n for (let i = 0; i < activeColumnEnds.length; i++) {\n if (activeColumnEnds[i] !== null && (activeColumnEnds[i] as number) <= event.start) {\n activeColumnEnds[i] = null\n }\n }\n\n let column = activeColumnEnds.indexOf(null)\n if (column === -1) {\n column = activeColumnEnds.length\n activeColumnEnds.push(null)\n }\n activeColumnEnds[column] = event.end\n\n const record = { id: event.id, start: event.start, end: event.end, column }\n if (column < maxColumns) {\n clusterVisible.push(record)\n } else {\n clusterOverflow.push(record)\n }\n }\n\n const visibleColumnCount = clusterVisible.length\n ? Math.max(...clusterVisible.map((e) => e.column)) + 1\n : 1\n const hasOverflow = clusterOverflow.length > 0\n // A cluster can only overflow once every visible slot up to maxColumns is\n // filled, so its visible high-water mark is exactly maxColumns β€” reserve\n // one trailing column for the overflow indicator in that case. Whether\n // that reservation lands *within* or *beyond* the caller's own original\n // budget is the caller's call (`runLayout` below retries at\n // `maxColumns - 1` when this first return already overflowed), not this\n // function's β€” `placeCluster` only ever reserves relative to whatever\n // `maxColumns` it was actually given.\n const columnCount = hasOverflow ? maxColumns + 1 : visibleColumnCount\n const spanBound = hasOverflow ? maxColumns : visibleColumnCount\n\n const visible = new Map<string, ScheduleLayoutResult>()\n for (const e of clusterVisible) {\n visible.set(e.id, {\n column: e.column,\n columnSpan: computeSpan(e, clusterVisible, spanBound),\n columnCount,\n })\n }\n\n return { visible, overflowRaw: clusterOverflow }\n}\n\n/**\n * Shared sweep behind both `layoutEventColumns` and\n * `layoutEventColumnsCapped`. Sorts by start (ties by end, relying on\n * `Array.prototype.sort`'s stability β€” for identical instants, whichever\n * event comes first in `events` wins the lower column; callers merging\n * kinds should order accordingly, e.g. real events before static ones so\n * an exact-tie pair splits with the real event on top), groups into\n * clusters, and places each cluster independently.\n *\n * **Column budget includes the overflow indicator, never adds to it.**\n * Each cluster is first placed at `maxColumns`; if that leaves anything\n * overflowed, it's re-placed at `maxColumns - 1` instead, so the reserved\n * \"+N\" column lands *inside* the caller's own column budget rather than\n * pushing the total past it β€” `maxOverlapColumns={4}` always means at most\n * 4 rendered columns, never 4 real columns plus a 5th for \"+N\". One\n * reduction is always enough: a single reserved column can represent\n * arbitrarily many overflowing events for that cluster regardless of count,\n * so there's never a need to cascade further. This is a per-cluster\n * decision, not a whole-day-column one β€” an unrelated, non-overflowing\n * cluster elsewhere in the same day-column keeps its own natural column\n * count untouched. `maxColumns = Infinity` (the plain export below) never\n * triggers a retry, so `layoutEventColumns` is unaffected and fully\n * backward compatible.\n *\n * A cluster's own overflow (if any) collapses into exactly one\n * `ScheduleOverflowSpan` β€” see that type's own comment for why not one span\n * per instant-by-instant change in who's hidden. Its `end` is the floored\n * one, so the \"+N\" indicator covers the hidden events' painted extent.\n */\nfunction runLayout(\n events: LayoutInput[],\n maxColumns: number,\n floorMs: number,\n): { visible: Map<string, ScheduleLayoutResult>; overflow: ScheduleOverflowSpan[] } {\n const sorted = events\n .map(({ id, start, end }) => {\n const startMs = start.getTime()\n return { id, start: startMs, end: Math.max(end.getTime(), startMs + floorMs) }\n })\n .sort((a, b) => a.start - b.start || a.end - b.end)\n const clusters = groupIntoClusters(sorted)\n\n const visible = new Map<string, ScheduleLayoutResult>()\n const overflow: ScheduleOverflowSpan[] = []\n\n for (const cluster of clusters) {\n let result = placeCluster(cluster, maxColumns)\n if (result.overflowRaw.length > 0) {\n result = placeCluster(cluster, Math.max(0, maxColumns - 1))\n }\n for (const [id, entry] of result.visible) visible.set(id, entry)\n if (result.overflowRaw.length > 0) {\n const starts = result.overflowRaw.map((e) => e.start)\n const ends = result.overflowRaw.map((e) => e.end)\n overflow.push({\n start: new Date(Math.min(...starts)),\n end: new Date(Math.max(...ends)),\n ids: result.overflowRaw.map((e) => e.id),\n })\n }\n }\n\n return { visible, overflow }\n}\n\n/**\n * Assigns each event a `column` (0-based), a `columnSpan` (how many\n * contiguous columns it may occupy, widened up to the nearest real\n * conflict to its right), and the `columnCount` of the overlap cluster it\n * belongs to, so overlapping events can render side by side instead of\n * stacked. Returns a `Map` (not an array in input order) since callers\n * look up by `event.id` while iterating their own already-ordered render\n * list. Unbounded β€” every event is visible, matching the column count of\n * the classic (uncapped) side-by-side layout. See `layoutEventColumnsCapped`\n * for a version that collapses many-way overlap into an overflow report.\n */\nexport function layoutEventColumns<T extends LayoutInput>(\n events: T[],\n): Map<string, ScheduleLayoutResult> {\n return runLayout(events, Number.POSITIVE_INFINITY, 0).visible\n}\n\n/**\n * Like `layoutEventColumns`, but once a cluster's point-in-time\n * concurrency would exceed `maxColumns`, the excess events are left out of\n * `layout` entirely and reported instead β€” one `ScheduleOverflowSpan` per\n * overflowing cluster, not one per instant-by-instant change in who's\n * hidden (see that type's own comment) β€” so a rendering layer resolves\n * `overflow`'s ids back to real events and draws its own overflow\n * indicator; this module stays decoupled from any event/UI type.\n * `maxColumns` bounds the *total* rendered column count for an overflowing\n * cluster, overflow indicator included β€” see `runLayout`'s own comment.\n * `maxColumns` is clamped to at least 1 so a misconfigured `0`/negative\n * value can never force a lone, non-conflicting event into overflow.\n * `floorMs` (default `0`, real-time overlap) is the minimum duration each\n * event is packed as β€” see the file header.\n */\nexport function layoutEventColumnsCapped<T extends LayoutInput>(\n events: T[],\n maxColumns: number,\n floorMs = 0,\n): ScheduleCappedLayout {\n const { visible, overflow } = runLayout(events, Math.max(1, maxColumns), floorMs)\n return { layout: visible, overflow }\n}\n","\"use client\"\n\nimport type { CSSProperties, ReactNode } from \"react\"\nimport { cn } from \"../../lib/cn\"\nimport { focusStyles } from \"../../lib/focus-styles\"\nimport { props as dataProps } from \"../../lib/props\"\nimport type { WithTestId } from \"../../lib/test-id\"\nimport { ScheduleOverflowPopover } from \"./schedule-overflow-popover\"\nimport type {\n ScheduleAnyEvent,\n ScheduleOverflowClassNames,\n ScheduleOverflowProps,\n ScheduleTranslations,\n} from \"./schedule-types\"\n\n/**\n * RFC Β§5 many-way-overlap indicator for the Day/Week timed grid β€” once\n * `layoutEventColumnsCapped` collapses excess concurrent events into a\n * `ScheduleOverflowSpan`, the caller resolves its ids back to real events\n * and renders one of these in the reserved trailing column. Unlike Month\n * view's \"+N\" pill (which navigates via `onDayClick` β€” there's nowhere more\n * detailed to jump to from here, since Day/Week are already the most\n * granular view), this discloses the hidden events itself via the shared\n * `ScheduleOverflowPopover`, so each hidden event's *full* details\n * (including `description`) are one click away, not just a compact one-line\n * summary. Only this trigger button's own markup/position is local to Day/\n * Week β€” `ScheduleOverflowPopover` owns everything behavioral.\n */\nexport type ScheduleOverflowChipProps<P = unknown> = WithTestId &\n Pick<\n ScheduleOverflowProps<P>,\n \"onOverflowClick\" | \"withOverflowDetails\" | \"renderOverflowDetails\"\n > & {\n /** The day column this cluster sits in. */\n date: Date\n /** Percentage (0–100) of the day-column's own total height β€” same\n * convention as `ScheduleEventChipProps`. */\n top: number\n /** Percentage (0–100) of the day-column's own total height. A CSS\n * `max(height%, calc(1rem + 2px))` floor β€” one line of content plus the\n * border β€” is applied at render time, not a JS one. Same convention and\n * same box math as `ScheduleEventChipProps`. */\n height: number\n insets: { left: string; width: string; zIndex: number }\n /** The hidden events for this cluster, in start-time order. */\n events: ScheduleAnyEvent<P>[]\n selectedId?: string | null\n onEventSelect?: (event: ScheduleAnyEvent<P> | null) => void\n withEventDetails?: boolean\n renderEventDetails?: (event: ScheduleAnyEvent<P>) => ReactNode\n locale?: string\n timeZone?: string\n translations: Required<ScheduleTranslations>\n classNames?: ScheduleOverflowClassNames\n }\n\nexport function ScheduleOverflowChip<P = unknown>({\n top,\n height,\n insets,\n events,\n selectedId,\n onEventSelect,\n withEventDetails,\n date,\n onOverflowClick,\n withOverflowDetails,\n renderOverflowDetails,\n renderEventDetails,\n locale,\n timeZone,\n translations,\n classNames,\n testId,\n}: ScheduleOverflowChipProps<P>) {\n return (\n <ScheduleOverflowPopover\n events={events}\n date={date}\n source=\"timed\"\n selectedId={selectedId}\n onEventSelect={onEventSelect}\n withEventDetails={withEventDetails}\n onOverflowClick={onOverflowClick}\n withOverflowDetails={withOverflowDetails}\n renderOverflowDetails={renderOverflowDetails}\n renderEventDetails={renderEventDetails}\n locale={locale}\n timeZone={timeZone}\n translations={translations}\n classNames={classNames}\n renderTrigger={(triggerProps) => (\n <button\n type=\"button\"\n data-schedule-part=\"overflow-chip\"\n {...dataProps({ \"data-testid\": testId })}\n {...triggerProps}\n className={cn(\n // `py-*` lives on the label span below, not here, so a container\n // query can collapse it as the chip shrinks β€” a query may never\n // style its own container. Same structure and same thresholds as\n // `ScheduleEventChip`; see the box-math note in that file.\n \"@container-size/sch-chip absolute select-none truncate rounded-sm text-xs text-end px-3\",\n \"border\",\n \"dark:border-white/15 dark:text-brand-50\",\n \"dark:bg-brand-950/85 dark:hover:bg-brand-950/95\",\n \"border-brand-900/20\",\n \"bg-brand-50/90 hover:bg-brand-50\",\n \"transition-colors cursor-pointer\",\n // Same cascade depth cue `ScheduleEventChip`'s `chipShell` uses β€”\n // the \"+N\" chip reuses `columnInsets`' full output (`left`/`width`/\n // `zIndex`), same as a real event chip, so it sits at the right\n // stack position and width in its own overflowing cluster.\n \"shadow-sm shadow-black/10 dark:shadow-black/30\",\n focusStyles({ ring: \"palette\", offset: false }),\n // `z-(--sch-chip-z)` + `hover:z-20 focus-within:z-20`, not an inline\n // `zIndex` β€” same reasoning as `ScheduleEventChip`'s `chipShell`\n // (an inline z-index always wins over a same-property class,\n // regardless of source order, so the hover/focus promotion below\n // would never fire against one). `focus-within`, not `focus-visible`\n // β€” matching `chipShell` again β€” so a mouse click (which focuses\n // this button but usually doesn't trigger a visible focus ring)\n // still promotes it, not just keyboard Tab.\n \"z-(--sch-chip-z) hover:z-20 focus-within:z-20\",\n \"w-(--sch-chip-w)\",\n classNames?.root,\n )}\n style={\n {\n top: `${top}%`,\n // `max(...)`, not a JS `Math.max` on a px number β€” same\n // reasoning as `ScheduleEventChip`'s own `chipShellStyle`, and\n // the same one-line-of-content floor. At the old bare `18px`\n // the fixed `py-1` left 8px of content box for a 16px line, so\n // `truncate`'s own `overflow: hidden` shaved the \"+N\" digits.\n height: `max(${height}%, calc(1rem + 2px))`,\n left: insets.left,\n \"--sch-chip-z\": insets.zIndex,\n \"--sch-chip-w\": insets.width,\n } as CSSProperties\n }\n >\n <span\n className={cn(\n \"block py-0\",\n \"[@container_sch-chip_(height>=calc(1rem+4px))]:py-0.5\",\n \"[@container_sch-chip_(height>=calc(1rem+8px))]:py-1\",\n )}\n >\n {`+${events.length}`}\n </span>\n </button>\n )}\n />\n )\n}\n","import { dayBoundary } from \"./schedule-dates\"\nimport type { ScheduleAnyEvent } from \"./schedule-types\"\n\n/**\n * RFC Β§5 (`docs/rfcs/schedule.md`) day-boundary clipping β€” the primitive the\n * timed grid renders from, added when cross-day drag landed (see Β§19's\n * correction block).\n *\n * The grid paints one *band* per day column β€” `[startHour, endHour)` on that\n * calendar day β€” and an event is drawn as its intersection with each band, one\n * rendered piece per day it touches. Before this module existed, `renderChip`\n * positioned every chip from the event's own absolute `start`/`end`, so an\n * event crossing midnight painted at `minutesFromMidnight(event.start)` with\n * its *full* duration in **every** column it overlapped β€” two identical 4h\n * chips at 22:00 for a 22:00β†’02:00 event, both spilling past the column's own\n * bottom edge.\n *\n * Clipping happens **once**, against the band β€” not to the calendar day and\n * then again to the window. One intersection absorbs, with no branches:\n *\n * - crossing midnight β†’ one piece per day\n * - spanning N days β†’ N pieces; the middles own neither edge\n * - ending *exactly* at midnight β†’ the next day's intersection is empty\n * (`start < end` is strict, the same\n * exclusive-end convention `rangesOverlap`\n * uses) so no phantom piece is emitted\n * - partly outside the window β†’ clipped, and the clipped edge loses its\n * resize grip because `isFirst`/`isLast`\n * goes false\n * - entirely outside the window β†’ no pieces at all, rather than the old\n * negative `top`\n *\n * so `top`/`height` computed from a segment are provably within the column,\n * and `schedule-layout.ts` finally receives the pre-clipped input its own file\n * header has always documented (\"the caller pre-clips `events` to one rendered\n * day-column\").\n *\n * **The band is built in the schedule's own `timeZone`**, not the host's. It\n * has to be: the day columns themselves come from `enumerateDays(range,\n * timeZone)`, so a host-local band would cover a *different* 24 hours than the\n * column it is clipping for β€” and, because clipping can now remove an event\n * entirely, that does not merely offset a chip, it makes it vanish. (It did:\n * with `timeZone=\"UTC\"` on a UTC-5 host, a 09:00Z event fell outside the\n * host-local band and rendered nothing.)\n *\n * Each segment therefore also carries `offsetMinutes`, its distance from the\n * band's own start, so the renderer positions chips from that rather than from\n * host-local `minutesFromMidnight` β€” which would reintroduce exactly the same\n * disagreement one layer up.\n */\n\nexport type ScheduleSegment<P = unknown> = {\n /** `event.id`, not a synthesised key. An event has at most one segment per\n * column and `layoutEventColumnsCapped` runs per column, so this can never\n * collide inside a single layout call β€” which is what lets segments be\n * passed to it directly, with no mapping and no change to that module. */\n id: string\n event: ScheduleAnyEvent<P>\n /** Index into the `days` array this piece paints in. */\n dayIndex: number\n /** Clipped to this column's band. */\n start: Date\n /** Clipped to this column's band; exclusive. */\n end: Date\n /** The clip left the event's real start intact β€” so this piece, and only\n * this piece, owns the start resize grip. False for a piece cut by\n * midnight, by `startHour`, *or* by the window's first day: all three are\n * the same fact, which is why there is no separate \"scrolled out\" case. */\n isFirst: boolean\n /** As `isFirst`, for the end edge. */\n isLast: boolean\n /** Minutes from the band's own start β€” i.e. from `startHour` on this day, in\n * the schedule's `timeZone`. The renderer's `top` comes from this, so chip\n * positions never depend on the host's clock. */\n offsetMinutes: number\n /** Minutes this piece covers. */\n durationMinutes: number\n}\n\n/**\n * Clip every event to every day's painted band.\n *\n * Returns **one array per entry in `days`, aligned by index**, rather than a\n * flat list β€” the caller renders per column, so grouping here saves it a pass.\n * Input order is preserved within each day, which keeps the\n * static-events-before-data tie-break `layoutEventColumnsCapped` relies on.\n */\nexport function segmentEvents<P>(\n events: ScheduleAnyEvent<P>[],\n days: Date[],\n options: { startHour: number; endHour: number; timeZone: string },\n): ScheduleSegment<P>[][] {\n const { startHour, endHour, timeZone } = options\n return days.map((day, dayIndex) => {\n const bandStart = dayBoundary(day, startHour, timeZone).getTime()\n const bandEnd = dayBoundary(day, endHour, timeZone).getTime()\n return events.flatMap((event) => {\n const eventStart = event.start.getTime()\n const eventEnd = event.end.getTime()\n const start = Math.max(eventStart, bandStart)\n const end = Math.min(eventEnd, bandEnd)\n // Strict `<`, so an event ending exactly when the band starts (or\n // starting exactly when it ends) contributes nothing here.\n if (!(start < end)) return []\n return [\n {\n id: event.id,\n event,\n dayIndex,\n start: new Date(start),\n end: new Date(end),\n isFirst: start === eventStart,\n isLast: end === eventEnd,\n offsetMinutes: (start - bandStart) / 60_000,\n durationMinutes: (end - start) / 60_000,\n },\n ]\n })\n })\n}\n","\"use client\"\n\nimport type { CSSProperties, PointerEvent as ReactPointerEvent } from \"react\"\nimport { useCallback, useRef } from \"react\"\nimport type { ScheduleSlotPredicate } from \"../../lib/schedule-predicates\"\nimport { addCalendarDays, checkRangeCommit, dayBoundary } from \"./schedule-dates\"\nimport { pixelsToMinutes, resolvePxPerMinute } from \"./schedule-geometry\"\nimport {\n CLICK_SLOP,\n CREATE_DRAFT,\n collectPieces,\n type EdgeState,\n flashPieces,\n formatCandidate,\n hidePieces,\n liveColumns,\n measureColumns,\n measureScrollExtent,\n paintPieces,\n resolveDayIndex,\n stopEdgeBehaviours,\n tickEdges,\n} from \"./schedule-grid-gesture\"\nimport { createRanges, type ScheduleCreateMode, snapToIncrement } from \"./schedule-snap\"\nimport type { ScheduleEventCreateHandler } from \"./schedule-types\"\n\n/**\n * Click-drag-to-create on empty grid space (RFC Β§6a), on two axes: vertical\n * drags the time, horizontal drags the day.\n *\n * The range is `[min, max]` over two absolute instants β€” the one pressed on\n * and the one under the pointer now β€” so pressing Sunday 22:00 and releasing\n * on Monday 02:00 drafts a single four-hour event, not two. That is the\n * majority model in the field: Apple Calendar (\"you can drag across multiple\n * days\") and Notion Calendar document it, and it is the default in\n * FullCalendar, Bryntum and Syncfusion. Only react-big-calendar clamps to the\n * origin column, and it closed the request to change that as `wontfix`.\n *\n * **The right button repeats instead of spanning** (`ScheduleCreateMode`):\n * Day 1 08:00 β†’ Day 3 16:00 drafts three 08:00–16:00 events, one per day.\n * Both modes resolve through the one `createRanges`, so everything else here β€”\n * the painter, the validity check, the commit β€” just walks a list of ranges;\n * a left drag is the one-item case. Days that would be rejected are tinted\n * and skipped rather than failing the whole gesture, which is what makes\n * \"Mon β†’ Sun with the weekend disabled\" produce five events. It never arms\n * without the `\"create\"` grant, so a read-only schedule keeps the browser's\n * own context menu.\n *\n * Three things follow from the second axis, all of them the same conclusions\n * `use-event-drag.ts` reached first (see `schedule-grid-gesture.ts`):\n *\n * **Listeners live on the grid, not the column, and are not torn down on\n * unmount.** Holding at the grid's edge pages the view, which unmounts the\n * very column the gesture started in. The listeners' lifetime is the\n * gesture's; every terminating path removes them.\n *\n * **The target day comes from measured column rects**, never\n * `elementFromPoint` β€” the draft sits under the pointer for the whole gesture.\n *\n * **Deltas are computed in scroll space**, because auto-scroll moves the grid\n * under a stationary pointer and produces zero client delta.\n *\n * The preview stays a permanently-mounted sibling leaf per column\n * (`schedule-create-draft.tsx`), but the gesture now writes to **all** of\n * them: a candidate is clipped to each column's own painted band exactly the\n * way `segmentEvents` clips a real event, so a cross-day draft draws as one\n * piece per day and a piece that runs past the window is squared off rather\n * than drawn past 100% of its column.\n *\n * Touch still arms via a short long-press rather than immediately β€” the day\n * column spans nearly the whole grid, so `touchAction: \"none\"` here would kill\n * both native pan directions. Only a stationary hold steals the gesture.\n *\n * Also owns `onGridClick` (a plain click on empty grid space) β€” precise by\n * construction, since it is the other branch of the same click-vs-drag\n * resolution `onEventCreate` uses, and so can never fire alongside a\n * successful create. Pointer tracking is attached regardless of\n * `editableCreate`; that flag gates only the draft visuals and the commit.\n */\n\n/** ms a touch/pen press must hold still before the create-gesture arms. */\nconst LONG_PRESS_MS = 450\n\n/** px of movement during the long-press window that cancels arming entirely,\n * letting the touch become a native scroll instead. Larger than `CLICK_SLOP`\n * since touch input is inherently less precise than a mouse. */\nconst JITTER_PX = 10\n\nexport type UseEventCreateOptions = {\n /** The column the gesture anchors in. Every other day it reaches is derived\n * from this one by a calendar-day offset, never by indexing a `days` array\n * β€” that array belongs to a render this gesture can outlive, since paging\n * mid-gesture unmounts the component that supplied it. */\n day: Date\n /** 0-based index of this column in the range rendered at pointerdown. */\n dayIndex: number\n timeZone: string\n startHour: number\n endHour: number\n /** Minutes β€” both the grid's slot spacing and the create snap increment. */\n slotDuration: number\n /** Minutes. Defaults to `slotDuration` β€” a draft can never be shorter than\n * one snap unit, mirroring `use-event-resize.ts`'s own floor. */\n minDurationMinutes?: number\n /** Minutes. The ceiling on each drafted event β€” see `durationBounds`. */\n maxDurationMinutes?: number\n slotDisabled?: ScheduleSlotPredicate\n /** Whether `\"create\"` is granted β€” gates the draft-preview visuals and the\n * actual `onEventCreate` commit, but *not* pointer tracking itself (needed\n * regardless, to resolve click-vs-drag for `onGridClick`). */\n editableCreate: boolean\n /** RFC Β§12a, axis A already resolved for this gesture by the caller. */\n preventOverlap?: boolean\n /** RFC Β§12a, axis B already resolved by the caller, window-wide and\n * unclipped β€” so a draft crossing midnight validates against whatever sits\n * on the far side of the boundary. */\n overlapCandidates?: { id: string; start: Date; end: Date }[]\n onEventCreate?: ScheduleEventCreateHandler\n onGridClick?: (date: Date) => void\n /** Page the view by one range, after the pointer has been held against an\n * edge the grid can no longer scroll. Omitting it leaves auto-scroll\n * working and simply never pages. */\n onPaginate?: (direction: -1 | 1) => void\n locale?: string\n}\n\ntype CreateState = EdgeState & {\n pointerId: number\n mode: ScheduleCreateMode\n startClientX: number\n startClientY: number\n startScrollLeft: number\n startScrollTop: number\n /** Minutes from the anchor column's band start to the press point,\n * unsnapped. */\n anchorOffsetMinutes: number\n maxAbsDelta: number\n pxPerMinute: number\n sourceDayIndex: number\n /** The per-column draft leaves, keyed by the day index they sit in.\n * Re-collected after a pagination, which remounts every column. */\n drafts: Map<number, HTMLElement>\n cleanup: () => void\n}\n\n/** Touch/pen presses that haven't held still long enough to arm yet. */\ntype PendingLongPress = {\n pointerId: number\n startClientX: number\n startClientY: number\n}\n\n/** Which create a button starts β€” `undefined` for one that starts none. */\nconst modeOfButton = (button: number): ScheduleCreateMode | undefined =>\n button === 0 ? \"span\" : button === 2 ? \"repeat\" : undefined\n\n/**\n * Keep the browser's context menu from opening over a right-button create.\n *\n * Platforms disagree on *when* it fires: macOS and Linux on press, Windows on\n * release β€” by which point the pointer may be over a chip, another column or\n * off the grid entirely. So the listener is window-wide, and it outlives the\n * gesture by exactly one `contextmenu`: the returned `release` (called when the\n * gesture ends) only arms its removal, which then happens on the next\n * `contextmenu` (Windows' trailing one) or the next press/keypress anywhere\n * (macOS/Linux, whose one already fired) β€” so no later, unrelated right-click\n * ever loses its menu.\n */\nconst suppressContextMenu = () => {\n let released = false\n const onContextMenu = (e: Event) => {\n e.preventDefault()\n if (released) remove()\n }\n const remove = () => {\n window.removeEventListener(\"contextmenu\", onContextMenu, true)\n window.removeEventListener(\"pointerdown\", remove, true)\n window.removeEventListener(\"keydown\", remove, true)\n }\n window.addEventListener(\"contextmenu\", onContextMenu, true)\n return () => {\n if (released) return\n released = true\n window.addEventListener(\"pointerdown\", remove, true)\n window.addEventListener(\"keydown\", remove, true)\n }\n}\n\nexport function useEventCreate({\n day,\n dayIndex,\n timeZone,\n startHour,\n endHour,\n slotDuration,\n minDurationMinutes = slotDuration,\n maxDurationMinutes,\n slotDisabled,\n editableCreate,\n preventOverlap,\n overlapCandidates,\n onEventCreate,\n onGridClick,\n onPaginate,\n locale,\n}: UseEventCreateOptions) {\n const stateRef = useRef<CreateState | null>(null)\n const pendingRef = useRef<PendingLongPress | null>(null)\n const armTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null)\n\n // Every value the imperative listeners read, kept fresh without re-binding\n // them mid-gesture. Note this ref stops updating once a pagination unmounts\n // the owning column β€” which is exactly why the candidate math below is\n // expressed as an offset from `day`, never as a lookup into a `days` array.\n const latest = useRef({\n day,\n dayIndex,\n timeZone,\n startHour,\n endHour,\n slotDuration,\n minDurationMinutes,\n maxDurationMinutes,\n slotDisabled,\n editableCreate,\n preventOverlap,\n overlapCandidates,\n onEventCreate,\n onGridClick,\n onPaginate,\n locale,\n })\n latest.current = {\n day,\n dayIndex,\n timeZone,\n startHour,\n endHour,\n slotDuration,\n minDurationMinutes,\n maxDurationMinutes,\n slotDisabled,\n editableCreate,\n preventOverlap,\n overlapCandidates,\n onEventCreate,\n onGridClick,\n onPaginate,\n locale,\n }\n\n const clearPending = useCallback(() => {\n if (armTimerRef.current != null) clearTimeout(armTimerRef.current)\n armTimerRef.current = null\n pendingRef.current = null\n }, [])\n\n /** The band `[startHour, endHour)` of the day `dayOffset` calendar days from\n * the anchor column, in the schedule's own `timeZone` β€” the same band\n * `segmentEvents` clips against, so a draft and a committed chip can never\n * disagree about where a piece sits. */\n const bandOf = useCallback((dayOffset: number) => {\n const o = latest.current\n const date = dayOffset === 0 ? o.day : addCalendarDays(o.day, dayOffset, o.timeZone)\n return {\n start: dayBoundary(date, o.startHour, o.timeZone).getTime(),\n end: dayBoundary(date, o.endHour, o.timeZone).getTime(),\n }\n }, [])\n\n /**\n * The snapped candidate events for a pointer position, each with its own\n * validity β€” see `createRanges` for the math.\n *\n * The draft is drawn from these same snapped ranges, so it is never a shape\n * releasing would not produce. Click-vs-drag is decided separately, by\n * `state.maxAbsDelta` against `CLICK_SLOP` β€” real pointer displacement.\n */\n const resolveCandidates = useCallback((state: CreateState, clientX: number, clientY: number) => {\n const o = latest.current\n // Scroll space, not client space β€” auto-scroll moves the grid under a\n // stationary pointer.\n const dy = clientY - state.startClientY + (state.grid.scrollTop - state.startScrollTop)\n const dayOffset =\n resolveDayIndex(liveColumns(state), state.sourceDayIndex, clientX) +\n state.paginationOffset -\n state.sourceDayIndex\n\n const ranges = createRanges(\n { day: o.day, minutes: state.anchorOffsetMinutes },\n { dayOffset, minutes: state.anchorOffsetMinutes + pixelsToMinutes(dy, state.pxPerMinute) },\n {\n mode: state.mode,\n timeZone: o.timeZone,\n startHour: o.startHour,\n endHour: o.endHour,\n slotDuration: o.slotDuration,\n minDurationMinutes: o.minDurationMinutes,\n maxDurationMinutes: o.maxDurationMinutes,\n },\n )\n // Each range is validated alone: a repeat's ranges sit on different days,\n // so they can never overlap one another.\n return ranges.map((range) => ({\n range,\n result: checkRangeCommit(range, {\n slotDisabled: o.slotDisabled,\n timeZone: o.timeZone,\n preventOverlap: o.preventOverlap,\n overlapCandidates: o.overlapCandidates,\n }),\n }))\n }, [])\n\n /**\n * Draw the draft as one piece per day, each clipped to that column's band β€”\n * the same single intersection `segmentEvents` performs, done imperatively\n * so a `pointermove` never costs a React render.\n *\n * A piece that doesn't reach the candidate's real start or end is marked\n * `data-continues-before` / `-after`, which is what gives it the squared-off\n * cut edge an actual clipped chip already gets.\n */\n const paint = useCallback(\n (state: CreateState) => {\n const o = latest.current\n const candidates = resolveCandidates(state, state.clientX, state.clientY)\n // Column indices are relative to the currently rendered range; the\n // anchor's own index was measured in the range the gesture started in,\n // so both are brought into the same space via `paginationOffset`.\n paintPieces({\n pieces: state.drafts,\n preview: CREATE_DRAFT,\n columnIndices:\n state.columns.length > 0\n ? state.columns.map((c) => c.index)\n : [...state.drafts.keys()].sort((a, b) => a - b),\n bandOfColumn: (index) => bandOf(index + state.paginationOffset - state.sourceDayIndex),\n // `range` is `Date`s; the painter wants epoch ms.\n candidates: candidates.map(({ range, result }) => ({\n range: { start: range.start.getTime(), end: range.end.getTime() },\n invalid: !result.ok,\n label: formatCandidate(range, o.locale, o.timeZone),\n })),\n totalWindowMinutes: (o.endHour - o.startHour) * 60,\n })\n },\n [bandOf, resolveCandidates],\n )\n\n /** Drive the shared edge behaviour. Paging remounts every column, so the\n * draft leaves this gesture writes to have to be re-collected. */\n const runEdges = useCallback(\n (state: CreateState) => {\n tickEdges(state, {\n paint: () => paint(state),\n isLive: () => stateRef.current === state,\n onPaginate: (direction) => latest.current.onPaginate?.(direction),\n onAfterPaginate: () => {\n hidePieces(state.drafts, CREATE_DRAFT)\n state.drafts = collectPieces(state.grid, CREATE_DRAFT)\n },\n })\n },\n [paint],\n )\n\n const end = useCallback((state: CreateState) => {\n stopEdgeBehaviours(state)\n state.cleanup()\n hidePieces(state.drafts, CREATE_DRAFT)\n stateRef.current = null\n }, [])\n\n const handleMove = useCallback(\n (e: PointerEvent) => {\n const state = stateRef.current\n if (!state || e.pointerId !== state.pointerId) return\n state.clientX = e.clientX\n state.clientY = e.clientY\n state.maxAbsDelta = Math.max(\n state.maxAbsDelta,\n Math.abs(e.clientY - state.startClientY),\n Math.abs(e.clientX - state.startClientX),\n )\n // A schedule with `\"create\"` not granted still tracks the gesture (needed\n // to resolve click-vs-drag for `onGridClick` on release) but never\n // shows a draft, and never moves the view under the user.\n if (!latest.current.editableCreate) return\n paint(state)\n // Re-arm the ticker only when it isn't already running; it reschedules\n // itself for as long as the pointer stays in a band.\n if (state.scrollRaf === null) runEdges(state)\n },\n [paint, runEdges],\n )\n\n const handleUp = useCallback(\n (e: PointerEvent) => {\n const state = stateRef.current\n if (!state || e.pointerId !== state.pointerId) return\n const o = latest.current\n // Freeze the edge behaviours before resolving, so the commit uses the\n // scroll position the user actually released at.\n stopEdgeBehaviours(state)\n state.clientX = e.clientX\n state.clientY = e.clientY\n\n // A plain click, no discernible drag β€” the \"clicked empty grid\" signal,\n // fired regardless of `editableCreate`. Can never fire alongside a\n // successful create below: they are mutually exclusive branches of this\n // one check. Reports the instant pressed, snapped to the grid the same\n // way a committed create is, so the time it hands back is one the user\n // can actually see a line for.\n if (state.maxAbsDelta < CLICK_SLOP) {\n end(state)\n // Only the primary button clicks the grid; a still right-click does\n // nothing (and its context menu was already suppressed at arm).\n if (state.mode !== \"span\") return\n const band = bandOf(0)\n const pressedMs =\n band.start + snapToIncrement(state.anchorOffsetMinutes, o.slotDuration) * 60_000\n o.onGridClick?.(new Date(pressedMs))\n return\n }\n if (!o.editableCreate) {\n end(state)\n return\n }\n\n // Rejected days are dropped, not fatal: only a gesture with nothing\n // left to create is rejected as a whole.\n const candidates = resolveCandidates(state, e.clientX, e.clientY)\n const created = candidates.flatMap(({ range, result }) => (result.ok ? [range] : []))\n const [reason] = candidates.flatMap(({ result }) => (result.ok ? [] : [result.reason]))\n if (created.length === 0 && reason) flashPieces(state.drafts, reason)\n end(state)\n if (created.length > 0) o.onEventCreate?.(created)\n },\n [end, resolveCandidates, bandOf],\n )\n\n const handleCancel = useCallback(\n (e: PointerEvent) => {\n const state = stateRef.current\n if (!state || e.pointerId !== state.pointerId) return\n end(state)\n },\n [end],\n )\n\n const onPointerDown = useCallback(\n (e: ReactPointerEvent<HTMLElement>) => {\n const mode = modeOfButton(e.button)\n if (!mode) return\n // Nothing to track without the grant: a right-click has no `onGridClick`\n // counterpart, so leave the browser's context menu alone.\n if (mode === \"repeat\" && !latest.current.editableCreate) return\n const target = e.target as Element\n if (target.closest(\"[data-schedule-part='event-chip'],[data-schedule-part='overflow-chip']\"))\n return\n\n const columnEl = e.currentTarget\n const grid = columnEl.closest<HTMLElement>(\"[data-schedule-part='timed-grid']\")\n if (!grid) return\n\n const pointerId = e.pointerId\n const startClientX = e.clientX\n const startClientY = e.clientY\n // Reuses this same rect for `resolvePxPerMinute` instead of letting it\n // re-measure β€” already needed here for `rect.top`.\n const rect = columnEl.getBoundingClientRect()\n const pxPerMinute = resolvePxPerMinute(columnEl, rect)\n const anchorOffsetMinutes = pixelsToMinutes(startClientY - rect.top, pxPerMinute)\n\n const arm = () => {\n // On the touch path this runs from a `setTimeout`, not synchronously\n // inside the triggering event like every other gesture in this module\n // β€” so unlike them, the browser may no longer consider this pointer\n // active by the time it fires (the touch ended without a pointerup or\n // pointercancel this hook ever saw). `setPointerCapture` throws in\n // that case; there's nothing to arm, so just bail.\n try {\n grid.setPointerCapture(pointerId)\n } catch {\n return\n }\n const onMove = (ev: PointerEvent) => handleMove(ev)\n const onUp = (ev: PointerEvent) => handleUp(ev)\n const onCancel = (ev: PointerEvent) => handleCancel(ev)\n const releaseContextMenu = mode === \"repeat\" ? suppressContextMenu() : undefined\n stateRef.current = {\n pointerId,\n mode,\n startClientX,\n startClientY,\n startScrollLeft: grid.scrollLeft,\n startScrollTop: grid.scrollTop,\n anchorOffsetMinutes,\n maxAbsDelta: 0,\n pxPerMinute,\n sourceDayIndex: latest.current.dayIndex,\n clientX: startClientX,\n clientY: startClientY,\n scrollRaf: null,\n paginateTimer: null,\n paginateDirection: null,\n paginationOffset: 0,\n columns: measureColumns(grid),\n ...measureScrollExtent(grid),\n drafts: collectPieces(grid, CREATE_DRAFT),\n grid,\n cleanup: () => {\n releaseContextMenu?.()\n grid.removeEventListener(\"pointermove\", onMove)\n grid.removeEventListener(\"pointerup\", onUp)\n grid.removeEventListener(\"pointercancel\", onCancel)\n grid.removeEventListener(\"lostpointercapture\", onCancel)\n },\n }\n // Deliberately native listeners on the grid rather than React handlers\n // on the column: React would tear these down when the column unmounts,\n // which is exactly what a mid-gesture pagination causes.\n grid.addEventListener(\"pointermove\", onMove)\n grid.addEventListener(\"pointerup\", onUp)\n grid.addEventListener(\"pointercancel\", onCancel)\n grid.addEventListener(\"lostpointercapture\", onCancel)\n }\n\n if (e.pointerType === \"mouse\") {\n arm()\n return\n }\n\n pendingRef.current = { pointerId, startClientX, startClientY }\n armTimerRef.current = setTimeout(() => {\n armTimerRef.current = null\n pendingRef.current = null\n arm()\n }, LONG_PRESS_MS)\n },\n [handleMove, handleUp, handleCancel],\n )\n\n // The React handlers below serve only the *pending* long-press window, before\n // `arm()` has moved the gesture onto the grid. Once armed, `setPointerCapture`\n // retargets every subsequent event to the grid and `pendingRef` is null, so\n // these no-op.\n const onPointerMovePending = useCallback(\n (e: ReactPointerEvent<HTMLElement>) => {\n const pending = pendingRef.current\n if (!pending || e.pointerId !== pending.pointerId) return\n const dx = e.clientX - pending.startClientX\n const dy = e.clientY - pending.startClientY\n if (Math.hypot(dx, dy) > JITTER_PX) clearPending()\n },\n [clearPending],\n )\n\n const onPointerEndPending = useCallback(\n (e: ReactPointerEvent<HTMLElement>) => {\n const pending = pendingRef.current\n if (!pending || e.pointerId !== pending.pointerId) return\n clearPending()\n },\n [clearPending],\n )\n\n // Deliberately **no unmount cleanup** β€” same reasoning as `use-event-drag.ts`:\n // paging the view mid-gesture unmounts this very column, and tearing the\n // listeners down there would silently kill the gesture at exactly the moment\n // it is supposed to keep working.\n\n return {\n getColumnProps: () => ({\n onPointerDown,\n onPointerMove: onPointerMovePending,\n onPointerUp: onPointerEndPending,\n onPointerCancel: onPointerEndPending,\n // Deliberately `\"auto\"` β€” unlike the chip/handle gestures, which set\n // `\"none\"` since they're small, deliberate targets that should never\n // concede to a native scroll. The day-column spans nearly the whole grid\n // and needs both native pan directions available by default; a fast\n // swipe should start a real scroll immediately (the browser fires\n // `pointercancel` once it does), and only a stationary long-press should\n // ever call `setPointerCapture`.\n style: { touchAction: \"auto\" } as CSSProperties,\n }),\n }\n}\n","\"use client\"\n\nimport type { CSSProperties, ReactNode, Ref } from \"react\"\nimport { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from \"react\"\nimport { cn } from \"../../lib/cn\"\nimport { devWarn } from \"../../lib/dev-warn\"\nimport { mergeRefs } from \"../../lib/merge-refs\"\nimport { OverlayContainerProvider } from \"../../lib/overlay-container\"\nimport type { ScheduleSlotPredicate } from \"../../lib/schedule-predicates\"\nimport { useNow } from \"../../lib/use-now\"\nimport { HourGutterTick, NowCursorLabel, NowCursorLine } from \"./now-cursor-line\"\nimport { ScheduleAllDayRow } from \"./schedule-all-day-row\"\nimport { ScheduleCreateDraft } from \"./schedule-create-draft\"\nimport {\n dayBoundaries,\n dayBoundary,\n dayKey,\n eventOccursOnDay,\n paginateDate,\n rangesOverlap,\n resolveOverlapCandidates,\n timeRangeLabel,\n} from \"./schedule-dates\"\nimport { ScheduleDisabledOverlay } from \"./schedule-disabled-overlay\"\nimport { ScheduleDragGhost } from \"./schedule-drag-ghost\"\nimport { ScheduleEventChip } from \"./schedule-event-chip\"\nimport {\n columnInsets,\n defaultHourHeight,\n minutesToPercent,\n visualFloorMs,\n} from \"./schedule-geometry\"\nimport { layoutEventColumnsCapped } from \"./schedule-layout\"\nimport { ScheduleOverflowChip } from \"./schedule-overflow-chip\"\nimport { type ScheduleSegment, segmentEvents } from \"./schedule-segments\"\nimport { resolveSlotDurations } from \"./schedule-snap\"\nimport type {\n ScheduleAnyEvent,\n ScheduleClassNames,\n ScheduleCollision,\n ScheduleEditGesture,\n ScheduleEvent,\n ScheduleEventChangeHandler,\n ScheduleEventCreateHandler,\n ScheduleEventRemoveHandler,\n ScheduleOverflowProps,\n ScheduleOverlapPreventionOptions,\n ScheduleStaticEvent,\n ScheduleTranslations,\n} from \"./schedule-types\"\nimport {\n eventEditGestureExceedsSchedule,\n isEditGestureEnabled,\n isOverlapGestureEnabled,\n resolveOverlapPrevention,\n} from \"./schedule-types\"\nimport { useEventCreate } from \"./use-event-create\"\nimport { chipSelection, usePieceAnchor } from \"./use-schedule-selection\"\n\n/**\n * RFC Β§5 (`docs/rfcs/schedule.md`) shared timed-grid primitive β€” `DaysView`\n * wraps this for any window size (1 day, 7 days, or anything else) so\n * coordinate math is written once. `hourHeight` is a *floor*, not a fixed\n * height: it sets the timed row's `minmax(floor, 1fr)` track size, so the\n * row (and every day-column stretched to match it via the grid's default\n * `align-self: stretch`) fills whatever space its own definite-height\n * ancestor actually gives it, scrolling only once the floor itself exceeds\n * that space β€” **correction after v1 shipped**: this used to be a plain\n * fixed px height (`(endHour-startHour) * hourHeight`, no CSS involvement),\n * with chip/overlay/now-line positions baked to matching fixed pixels at\n * render time. Absent, `hourHeight` defaults to `defaultHourHeight\n * (slotDuration)` (`schedule-geometry.ts`) β€” scaled by `slotDuration` rather\n * than a flat constant, so a finer slot spacing renders as a taller hour by\n * default; this floor-vs-fixed change doesn't affect that default at all.\n * Chip/overlay/overflow/now-line positions are percentages of the\n * day-column's own (possibly-stretched) height instead, via\n * `minutesToPercent` β€” see that function's own comment.\n */\n\nconst DEFAULT_MAX_OVERLAP_COLUMNS = 4\nconst DEFAULT_MAX_ALL_DAY_ROWS = 2\n\n/** `--sch-column-overlap` default for a single day-column (`DaysView` with\n * `visibleDays={1}`, or a standalone `ScheduleTimedGrid` given one day) β€”\n * plenty of width to spare per column already, so a modest cascade is\n * enough. */\nconst DEFAULT_COLUMN_OVERLAP_PX = 10\n/** Bigger cascade once multiple day-columns share the width (`DaysView`\n * with `visibleDays > 1`, `days.length > 1`) β€” each column starts out much narrower (down to a few\n * dozen px on a busy cluster at the default `--sch-day-min-width: 9rem`),\n * so leaning further into the cascade recovers more legible title/time text\n * on the frontmost, most-overlapping card than the single-day default\n * would. Tuned by hand against a real 5-way overlap cluster at the default\n * day-min-width: high enough to matter, short of letting a deep cascade\n * spill past its own day-column's edge into the next one. */\nconst DEFAULT_COLUMN_OVERLAP_PX_MULTI_DAY = 20\n\nexport type ScheduleTimedGridProps<P = unknown> = Pick<\n ScheduleOverflowProps<P>,\n \"onOverflowClick\" | \"withOverflowDetails\" | \"renderOverflowDetails\"\n> & {\n /** Page the visible range by one step, requested while a drag is held\n * against an edge the grid can no longer scroll. Internal β€” `DaysView`\n * supplies it from the same anchor-date state the toolbar's Prev/Next\n * triggers use, so there is no new public prop. Omitted (e.g. a bare\n * `ScheduleTimedGrid`) simply means the gesture never pages. */\n onPaginate?: (direction: -1 | 1) => void\n days: Date[]\n data: ScheduleEvent<P>[]\n staticEvents: ScheduleStaticEvent<P>[]\n startHour: number\n endHour: number\n slotDuration: number\n minDuration?: number\n resizeCollision: ScheduleCollision\n maxDuration?: number\n slotDisabled?: ScheduleSlotPredicate\n now?: Date\n withNowIndicator: boolean\n selected?: readonly string[]\n onEventSelect?: (event: ScheduleAnyEvent<P> | null) => void\n withEventDetails?: boolean\n onEventChange?: ScheduleEventChangeHandler<P>\n onEventRemove?: ScheduleEventRemoveHandler<P>\n /** RFC β€” click-drag-to-create on empty grid space. */\n onEventCreate?: ScheduleEventCreateHandler\n /**\n * Fires on a plain click (no discernible drag) that lands on empty\n * day-column space β€” not on an event/overflow chip, and never alongside a\n * committed create-drag (the same click-vs-drag resolution that decides\n * `onEventCreate` decides this too, mutually exclusively). Independent of\n * `editable`'s `\"create\"` grant. Formerly `onEventDismiss` β€” see\n * `ScheduleTimedProps.onGridClick` for why it was renamed and what it no\n * longer does.\n */\n onGridClick?: (date: Date) => void\n /** Which gestures are possible at all β€” see `ScheduleTimedProps.editable`. */\n editable?: boolean | readonly ScheduleEditGesture[]\n /** See `ScheduleTimedProps.preventOverlap`. */\n preventOverlap?: boolean | ScheduleOverlapPreventionOptions\n /** Cap on side-by-side columns before excess concurrent events collapse\n * into a \"+N\" overflow indicator. Default `4`. */\n maxOverlapColumns?: number\n /** Cap on visible concurrent all-day lanes before excess all-day events\n * collapse into a per-day \"+N\" overflow indicator. Default `2`. */\n maxAllDayRows?: number\n /**\n * Overrides the built-in \"+N\" overflow disclosure popover entirely β€”\n * gated by presence, like `onDayClick`. Applies to both\n * the timed grid's own column overflow and the all-day row's per-day\n * overflow. Absent (default): clicking \"+N\" opens the built-in popover\n * (a list of hidden events, each opening into its own full details).\n */\n onDayClick?: (date: Date) => void\n renderEventDetails?: (event: ScheduleAnyEvent<P>) => ReactNode\n locale?: string\n timeZone: string\n translations: Required<ScheduleTranslations>\n classNames?: ScheduleClassNames\n empty?: ReactNode\n /** Absent: defaults to `defaultHourHeight(slotDuration)`. */\n hourHeight?: number\n /** Exposes the scrollable root (`data-schedule-part=\"timed-grid\"`) β€”\n * `DaysView`'s own scroll-to-now wiring (RFC Β§14) needs a real DOM node\n * to call `scrollElementToCenter` (`schedule-geometry.ts`) on. Plain\n * `ref` prop, no `forwardRef` β€” same idiom `alert.tsx`/`tree-select.tsx`\n * already use on React 19. */\n ref?: Ref<HTMLDivElement>\n /** Forwarded to today's own `NowCursorLine` `marker` instance (via\n * `DayColumn`) β€” the other DOM node that same scroll-to-now wiring\n * needs, alongside `ref` above. */\n nowRef?: Ref<HTMLDivElement>\n}\n\n/**\n * Disabled slots merged into contiguous runs, at `slotDuration` granularity.\n *\n * Deliberately the *same* unit the grid snaps gestures to, which is what makes\n * the tint and the commit gate agree: a boundary finer than `slotDuration` is\n * one no gesture can land on anyway, so there is nothing left for the shading\n * to round away. This used to walk whole hours β€” a v1 simplification that was\n * invisible while every example disabled a round number of hours, and plainly\n * wrong as soon as one didn't. A schedule that opens at 08:45 painted its tint\n * to 09:00, so the 08:45-09:00 strip looked blocked while booking perfectly\n * well; enforcement was exact the whole time, only the picture of it was not.\n *\n * Probed in the schedule's own `timeZone` rather than host-local: these runs\n * are positioned against `bandStart`, itself `dayBoundary(day, startHour,\n * timeZone)`, so a host-local probe would ask about one time and paint the\n * answer at another. `dayBoundaries` walks the whole band from one zone\n * conversion, and closes exactly on `endHour` even when the band isn't a whole\n * number of slots.\n */\nfunction disabledSlotRuns(\n day: Date,\n startHour: number,\n endHour: number,\n slotDuration: number,\n timeZone: string,\n slotDisabled: ScheduleSlotPredicate,\n): { startMinute: number; endMinute: number }[] {\n const fromMinute = startHour * 60\n const toMinute = endHour * 60\n const boundaries = dayBoundaries(day, fromMinute, toMinute, slotDuration, timeZone)\n const runs: { startMinute: number; endMinute: number }[] = []\n let runStart: number | null = null\n for (let i = 0; i < boundaries.length - 1; i++) {\n const start = boundaries[i] as Date\n const end = boundaries[i + 1] as Date\n const startMinute = Math.min(fromMinute + i * slotDuration, toMinute)\n const disabled = slotDisabled({ start, end }, timeZone)\n if (disabled && runStart === null) runStart = startMinute\n if (!disabled && runStart !== null) {\n runs.push({ startMinute: runStart, endMinute: startMinute })\n runStart = null\n }\n }\n if (runStart !== null) runs.push({ startMinute: runStart, endMinute: toMinute })\n return runs\n}\n\ntype DayColumnProps<P = unknown> = Pick<\n ScheduleOverflowProps<P>,\n \"onOverflowClick\" | \"withOverflowDetails\" | \"renderOverflowDetails\"\n> & {\n day: Date\n /** This column's pieces of `data`, already clipped to its own painted band\n * by `segmentEvents` β€” never whole events. A chip's `top`/`height` come\n * from the piece; every gesture still reads `segment.event`. */\n /** Ids of events that have left `data` and are playing their exit β€” excluded\n * from the packing below so the survivors reflow *while* they fade. */\n exitingIds?: ReadonlySet<string>\n onExitComplete?: (event: ScheduleEvent<P>) => void\n daySegments: ScheduleSegment<P>[]\n /** As `daySegments`, for `staticEvents`. */\n dayStaticSegments: ScheduleSegment<P>[]\n startHour: number\n endHour: number\n /** `(endHour - startHour) * 60` β€” the percent-math denominator for every\n * chip/overlay/overflow-chip position in this column. */\n totalWindowMinutes: number\n slotDuration: number\n /** Already resolved to a whole number of slots β€” see `resolveSlotDurations`. */\n minDuration: number\n resizeCollision: ScheduleCollision\n maxDuration?: number\n slotDisabled?: ScheduleSlotPredicate\n editableCreate: boolean\n editableDrag: boolean\n editableResize: boolean\n editableRemove: boolean\n preventOverlapOnCreate: boolean\n preventOverlapOnDrag: boolean\n preventOverlapOnResize: boolean\n /** RFC Β§12a axis B, already applied β€” the grid resolves this **once over the\n * whole visible window** rather than per column. A candidate on another day\n * simply never overlaps the proposed range (`rangeOverlapsAny` compares real\n * `Date`s), so the old per-day narrowing was a no-op for correctness; it\n * only mattered as a micro-optimisation over a trivial array scan. Resolving\n * window-wide is also what keeps these candidates **unclipped** β€” a segment\n * stops at midnight, so validating a commit against segments would let an\n * overnight event silently overlap whatever sits across the boundary. */\n overlapCandidates: { id: string; start: Date; end: Date }[]\n maxOverlapColumns: number\n /** Minimum duration each event is packed as β€” `visualFloorMs`. */\n layoutFloorMs: number\n selected?: readonly string[]\n /** This column holds the piece of the anchor event that owns its details\n * popover β€” see `usePieceAnchor`. The event's other pieces, in other\n * columns, are painted selected but never open one. */\n ownsAnchor?: boolean\n onEventSelect?: (event: ScheduleAnyEvent<P> | null) => void\n withEventDetails?: boolean\n onEventChange?: (\n event: ScheduleEvent<P>,\n next: { start: Date; end: Date },\n reason: \"drag\" | \"resize\",\n ) => void\n onEventRemove?: (event: ScheduleEvent<P>) => void\n onEventCreate?: ScheduleEventCreateHandler\n onGridClick?: (date: Date) => void\n renderEventDetails?: (event: ScheduleAnyEvent<P>) => ReactNode\n locale?: string\n timeZone: string\n translations: Required<ScheduleTranslations>\n classNames?: ScheduleClassNames\n isToday: boolean\n /** Whether `day` is the leftmost visible column β€” no other day column\n * sits between it and the gutter, so its own now-marker's dot (which\n * otherwise spills half its width into whatever's to its start) would\n * spill straight into `NowCursorLabel` instead. */\n isFirstDayColumn: boolean\n now?: Date\n nowRef?: Ref<HTMLDivElement>\n withNowIndicator: boolean\n /** 0-based position among `days` β€” resolves to an explicit\n * `gridColumn: columnIndex + 2` (column 1 is the gutter). Previously\n * left to auto-placement, which was fine until the now-guide-line's own\n * wrapper (`ScheduleTimedGrid`, see its own comment) needed an *explicit*\n * `col-[2/-1]` span for correct height resolution β€” an explicitly-placed\n * item reserves its cells for the auto-placement algorithm, which pushed\n * every auto-placed day-column that used to land in those same cells\n * into new implicit (unsized, ~0px) columns instead. Making day-columns\n * explicit too avoids the conflict outright: explicit-vs-explicit\n * placements are allowed to (intentionally) overlap the same cells. */\n columnIndex: number\n onPaginate?: (direction: -1 | 1) => void\n /** Which side of a page turn this column belongs to, while one is running.\n * The outgoing copy is fully inert: it is a picture of the range you just\n * left, not something to interact with. */\n pageState?: \"entering\" | \"exiting\"\n}\n\n/**\n * One day's column β€” its own component (not inlined in a `.map()` callback\n * the way it was before click-drag-to-create) because `useEventCreate` is a\n * hook: calling it inside a bare loop callback in `ScheduleTimedGrid` would\n * violate the Rules of Hooks (a hook must be called from a real component\n * instance, once per mount, not once per loop iteration of a parent render).\n */\nfunction DayColumn<P = unknown>({\n day,\n columnIndex,\n onPaginate,\n pageState,\n exitingIds,\n onExitComplete,\n daySegments,\n dayStaticSegments,\n startHour,\n endHour,\n totalWindowMinutes,\n slotDuration,\n minDuration,\n resizeCollision,\n maxDuration,\n slotDisabled,\n editableCreate,\n editableDrag,\n editableResize,\n editableRemove,\n preventOverlapOnCreate,\n preventOverlapOnDrag,\n preventOverlapOnResize,\n overlapCandidates,\n maxOverlapColumns,\n layoutFloorMs,\n selected = [],\n ownsAnchor = false,\n onEventSelect,\n withEventDetails,\n onEventChange,\n onEventRemove,\n onEventCreate,\n onGridClick,\n onOverflowClick,\n withOverflowDetails,\n renderOverflowDetails,\n renderEventDetails,\n locale,\n timeZone,\n translations,\n classNames,\n isToday,\n isFirstDayColumn,\n now,\n nowRef,\n withNowIndicator,\n}: DayColumnProps<P>) {\n // Events and static events are packed into ONE shared column space (not\n // two independent ones) so a real event and a static event overlapping in\n // time get distinct columns instead of silently rendering at the same\n // position. Events first in the input array: `layoutEventColumnsCapped`'s\n // sort is stable, so a tie at the exact same instant gives the real event\n // the lower (and, once overflow exists, the visible) column.\n const byId = new Map<string, ScheduleAnyEvent<P>>()\n for (const segment of daySegments) byId.set(segment.id, segment.event)\n for (const segment of dayStaticSegments) byId.set(segment.id, segment.event)\n // Segments are structurally `LayoutInput` (`{ id, start, end }`) and an event\n // has at most one piece per column, so they feed the packer directly β€” no\n // mapping, and no change to `schedule-layout.ts`, whose own file header has\n // always documented that the caller pre-clips to one day-column. Until\n // `segmentEvents` existed that contract was aspirational: the caller passed\n // whole events, so a spanning event was packed against a range mostly\n // outside this column.\n // The exiting event is packed out immediately, so every neighbour takes its\n // new width/offset on the same frame the fade starts β€” `chipShell`'s own\n // `left`/`width` transition then carries them there. Leaving it in until the\n // consumer's `data` update landed is what made a removal read as two beats:\n // ~140ms of fade, *then* a slide.\n const hasExiting = exitingIds != null && exitingIds.size > 0\n const activeSegments = hasExiting ? daySegments.filter((s) => !exitingIds.has(s.id)) : daySegments\n // Packed by *painted* extent, not real duration (`layoutFloorMs`): a burst\n // of second-long events never overlaps in time, yet each chip is floored to\n // a line of text, so packing by time alone stacks them on one another.\n const { layout, overflow } = layoutEventColumnsCapped(\n [...activeSegments, ...dayStaticSegments],\n maxOverlapColumns,\n layoutFloorMs,\n )\n // ...and a second pass *including* it, purely to recover the geometry it had\n // before it was packed out, so the fading chip holds its position instead of\n // jumping to wherever the reflowed layout would now put it β€” or vanishing\n // outright, since a piece with no layout entry renders nothing at all.\n const exitingLayout = hasExiting\n ? layoutEventColumnsCapped(\n [...daySegments, ...dayStaticSegments],\n maxOverlapColumns,\n layoutFloorMs,\n ).layout\n : null\n const layoutFor = (id: string) =>\n layout.get(id) ?? (exitingIds?.has(id) ? exitingLayout?.get(id) : undefined)\n // This column's own band start, in the schedule's `timeZone` β€” the origin\n // every position in this column is measured from.\n const bandStart = dayBoundary(day, startHour, timeZone).getTime()\n const disabledRuns = slotDisabled\n ? disabledSlotRuns(day, startHour, endHour, slotDuration, timeZone, slotDisabled)\n : []\n const create = useEventCreate({\n day,\n dayIndex: columnIndex,\n timeZone,\n startHour,\n endHour,\n slotDuration,\n minDurationMinutes: minDuration,\n maxDurationMinutes: maxDuration,\n slotDisabled,\n editableCreate,\n preventOverlap: preventOverlapOnCreate,\n overlapCandidates,\n onEventCreate,\n onGridClick,\n onPaginate,\n locale,\n })\n\n const renderChip = (\n segment: ScheduleSegment<P>,\n insets: { left: string; width: string; zIndex: number },\n ) => {\n const event = segment.event\n // Straight from the piece's own distance into the band, which\n // `segmentEvents` measured in the schedule's `timeZone`. Deliberately not\n // `minutesFromMidnight`, which reads the *host's* clock β€” that would put a\n // chip at a different offset than the band it was clipped against whenever\n // `timeZone` isn't the host's. Both values are within [0, 100] by\n // construction, so the negative `top` and past-the-bottom `height` an\n // unclipped event used to produce are no longer representable.\n const top = minutesToPercent(segment.offsetMinutes, totalWindowMinutes)\n const durationMinutes = segment.durationMinutes\n const height = minutesToPercent(durationMinutes, totalWindowMinutes)\n return (\n <ScheduleEventChip\n key={event.id}\n event={event}\n isFirst={segment.isFirst}\n isLast={segment.isLast}\n dayIndex={columnIndex}\n day={day}\n onPaginate={onPaginate}\n timeZone={timeZone}\n startHour={startHour}\n totalWindowMinutes={totalWindowMinutes}\n top={top}\n height={height}\n insets={insets}\n slotDuration={slotDuration}\n minDuration={minDuration}\n resizeCollision={resizeCollision}\n maxDuration={maxDuration}\n slotDisabled={slotDisabled}\n editableDrag={editableDrag}\n editableResize={editableResize}\n editableRemove={editableRemove}\n preventOverlapOnDrag={preventOverlapOnDrag}\n preventOverlapOnResize={preventOverlapOnResize}\n overlapCandidates={overlapCandidates}\n {...chipSelection(selected, event.id, ownsAnchor)}\n onEventSelect={onEventSelect}\n withEventDetails={withEventDetails}\n present={!exitingIds?.has(segment.id)}\n onExitComplete={onExitComplete}\n onEventChange={onEventChange}\n onEventRemove={onEventRemove}\n renderEventDetails={renderEventDetails}\n locale={locale}\n translations={translations}\n classNames={classNames?.event}\n detailsPopoverClassName={classNames?.eventDetailsPopover}\n />\n )\n }\n\n const totalHours = endHour - startHour\n\n // Every chip below is its own independent `tabIndex={0}` stop\n // (`schedule-event-chip.tsx`), and native Tab/screen-reader order always\n // follows DOM order β€” never a chip's own percent-based `top`/`left`. So\n // DOM order has to be *derived* from the same visual position each chip is\n // painted at (top-to-bottom by `start`, then left-to-right by `column`),\n // not inherited from `dayStatic`/`dayEvents`' own caller-supplied array\n // order or `overflow`'s own append-last position β€” same \"sort what you're\n // about to `.map()` into JSX by its own visual key\" move\n // `schedule-month-view.tsx`'s day-cell pill order already uses.\n // `layoutEventColumnsCapped`'s own column-packing order (and\n // `dayEvents`/`dayStatic`'s tie-break priority within it) is untouched β€”\n // only the render order of its already-computed output changes here.\n const eventChips = [...dayStaticSegments, ...daySegments].flatMap((segment) => {\n // A missing entry means this piece overflowed β€” it's rendered via the\n // \"+N\" indicator below instead, never with a stale fallback position\n // (that would silently re-stack it under something else).\n const entry = layoutFor(segment.id)\n if (!entry) return []\n return [\n {\n key: segment.id,\n // The *clipped* start, so DOM order follows the position this piece is\n // actually painted at. A spanning event's later pieces start at the\n // band's top, which is exactly where they appear.\n start: segment.start.getTime(),\n column: entry.column,\n node: renderChip(segment, columnInsets(entry)),\n },\n ]\n })\n const overflowChips = overflow.map((segment) => {\n const insets = columnInsets({\n column: maxOverlapColumns,\n columnSpan: 1,\n columnCount: maxOverlapColumns + 1,\n })\n const overflowEvents = segment.ids\n .map((id) => byId.get(id))\n .filter((event): event is ScheduleAnyEvent<P> => event != null)\n // Same band-relative measure the chips use β€” `layoutEventColumnsCapped`\n // was fed segments, so these spans are already clipped to it.\n const top = minutesToPercent((segment.start.getTime() - bandStart) / 60_000, totalWindowMinutes)\n const height = minutesToPercent(\n (segment.end.getTime() - segment.start.getTime()) / 60_000,\n totalWindowMinutes,\n )\n const key = `${segment.start.getTime()}-${segment.end.getTime()}`\n return {\n key,\n start: segment.start.getTime(),\n // Always the reserved last column (see `insets` above) β€” the \"+N\"\n // indicator is always the rightmost card in its own cluster.\n column: maxOverlapColumns,\n node: (\n // No \"lone overflow renders as a real chip instead of a wasteful\n // +1\" special case here (unlike the all-day row's own overflow,\n // which keeps one): `layoutEventColumnsCapped` only ever overflows a\n // cluster by retrying at one fewer real column once *any* overflow\n // occurs at the original cap, and that retry's own overflow count\n // is provably always >= 2 (never exactly 1) β€” reducing by exactly\n // one column can only free up room for one *fewer* real event, so\n // whichever event the un-reduced pass had already overflowed stays\n // overflowed, plus whichever one the reduction just displaced joins\n // it. A \"+1\" here would mean this branch is literally unreachable,\n // not just rare.\n <ScheduleOverflowChip\n key={key}\n top={top}\n height={height}\n insets={insets}\n events={overflowEvents}\n date={day}\n selectedId={ownsAnchor ? (selected[0] ?? null) : null}\n onEventSelect={onEventSelect}\n withEventDetails={withEventDetails}\n onOverflowClick={onOverflowClick}\n withOverflowDetails={withOverflowDetails}\n renderOverflowDetails={renderOverflowDetails}\n renderEventDetails={renderEventDetails}\n locale={locale}\n timeZone={timeZone}\n translations={translations}\n classNames={classNames?.overflow}\n testId={`overflow-${key}`}\n />\n ),\n }\n })\n const chips = [...eventChips, ...overflowChips].sort(\n (a, b) => a.start - b.start || a.column - b.column,\n )\n\n return (\n <div\n {...create.getColumnProps()}\n data-schedule-part=\"day-column\"\n data-day-index={columnIndex}\n // This column's own calendar day, in the schedule's `timeZone`. How the\n // day reveal (`schedule.tsx`) finds the column it was pointed at without\n // re-deriving `getVisibleRange` + `enumerateDays` a second time β€” the\n // exact duplication `isEventInVisibleRange`'s own comment argues against.\n // `data-day-index` cannot stand in for it: an index is relative to\n // whatever range happens to be rendered, which is the thing being\n // resolved. Also gives Days the day-addressability Month and Year\n // already have through their `data-testid=\"day-<key>\"` cells.\n data-day-key={dayKey(day, timeZone)}\n {...(pageState === \"exiting\"\n ? // `data-page-exiting` is both the animation hook and the predicate\n // every gesture query filters on (`schedule-grid-gesture.ts`).\n // Deliberately not `data-state=\"closed\"` β€” see `theme.css`.\n { \"data-page-exiting\": \"true\", inert: true, \"aria-hidden\": true }\n : {})}\n className={cn(\n // `h-full` β€” stretches to fill the shared timed row's own resolved\n // height (the row's `minmax(floor, 1fr)` track, see\n // `ScheduleTimedGrid`'s inner grid wrapper), not a fixed height of\n // its own; `align-self: stretch` (the grid default) is what makes\n // that stretch actually apply here.\n \"relative row-2 h-full\",\n // `overflow-y-clip` contains the create draft's own scale overshoot.\n // The draft rests at `scale-105` and transitions to `scale-100` on\n // enter (see `schedule-create-draft.tsx` β€” the >1 resting scale is\n // deliberate, so its *leave* expands outward where it can be seen\n // instead of shrinking away behind the grid). A transform still\n // contributes to an ancestor's scrollable overflow, so for the ~11\n // frames of that transition a full-height draft stood 15px proud of\n // the column at each end and the grid grew a vertical scrollbar that\n // flashed and vanished. Measured: `scrollHeight` 885 -> 900 on a grid\n // that fits exactly at rest.\n //\n // `y` only, and on the column rather than the grid: the now-cursor's\n // marker dot is deliberately centred on the column's own inline-start\n // edge and spills half its width outward, so clipping x would cut it\n // in half. Measured during a gesture, `create-draft` is the only part\n // that exceeds a column vertically (11px top, 21px bottom) β€” the\n // draft's own time readout and every chip stay inside, so nothing\n // else loses paint to this.\n \"overflow-y-clip\",\n // Only *between* day columns, not on the first one β€” that edge\n // borders the gutter, not a sibling cell, and the gutter already\n // reads as its own distinct region (sticky, opaque surface) without\n // a redundant hairline restating the boundary.\n !isFirstDayColumn && \"border-s border-brand-900/20 dark:border-white/15\",\n pageState === \"entering\" && \"animate-schedule-page-enter\",\n pageState === \"exiting\" && \"pointer-events-none animate-schedule-page-leave\",\n )}\n style={{ gridColumn: columnIndex + 2 }}\n >\n {/* Hour gridlines β€” a repeating background naturally draws a line at\n * the *start* of every period, so applied directly to this column\n * (from its own y=0) the first one would land exactly on the seam\n * with the sticky header above, not between two peer rows. Offset\n * onto its own element starting one hour's percentage-of-column-\n * height down instead (spanning to the column's own bottom, no\n * further offset needed there β€” a repeating pattern never draws a\n * line at the *end* of its own painting area, only at each period's\n * start, so the column's bottom edge stays clean on its own): the\n * same repeat then lands its lines exactly on every remaining\n * internal hour boundary and nowhere else. Percentage-based (not\n * `--sch-hour-height`-driven, as it used to be β€” correction after v1\n * shipped): `top` is a fraction of *this* column's own height, but\n * the gradient's own repeat-length is a fraction of the *shorter* box\n * this element itself occupies (column height minus that same `top`\n * offset) β€” one hour's share of `totalHours - 1` equal parts, not\n * `totalHours`, since this element doesn't include the first hour's\n * worth of space at all. Skipped below 2 hours entirely: there's no\n * internal boundary to draw in a 1-hour window, and this element's\n * own height would be exactly 0 anyway. */}\n <div\n aria-hidden\n data-schedule-part=\"hour-gridlines\"\n className={cn(\n \"pointer-events-none absolute inset-x-0 bottom-0\",\n \"[--sch-gridline-color:color-mix(in_oklab,var(--color-brand-900)_10%,transparent)]\",\n \"dark:[--sch-gridline-color:rgb(255_255_255/0.08)]\",\n )}\n style={{\n top: `calc(100% / ${totalHours})`,\n backgroundImage:\n totalHours > 1\n ? `repeating-linear-gradient(to bottom, var(--sch-gridline-color) 0 1px, transparent 1px calc(100% / ${totalHours - 1}))`\n : undefined,\n }}\n />\n {disabledRuns.map((run) => (\n <ScheduleDisabledOverlay\n key={run.startMinute}\n style={{\n top: `${minutesToPercent(run.startMinute - startHour * 60, totalWindowMinutes)}%`,\n height: `${minutesToPercent(run.endMinute - run.startMinute, totalWindowMinutes)}%`,\n }}\n />\n ))}\n <ScheduleCreateDraft className={classNames?.createDraft} />\n <ScheduleDragGhost className={classNames?.dragGhost} />\n {chips.map((chip) => chip.node)}\n {withNowIndicator && isToday ? (\n <NowCursorLine\n now={now}\n nowRef={nowRef}\n startHour={startHour}\n endHour={endHour}\n hideDot={isFirstDayColumn}\n className={classNames?.nowIndicator}\n />\n ) : null}\n </div>\n )\n}\n\n// Sticky background for anything pinned by `position: sticky` (the corner\n// cell, the day headers, the hour gutter) β€” needs to be opaque(-ish) so\n// scrolled content doesn't show through underneath it as the grid scrolls\n// past. Matches AppShell's own sticky-chrome recipe (Header/Sidebar) β€” the\n// kit's own precedent for \"a pinned bar over scrolled content\" already\n// accepts 90%/85% alpha as opaque enough for this purpose. `backdrop-blur`\n// on top mirrors `Table`'s own sticky thead/tfoot treatment, so scrolled\n// event chips read as a soft blur rather than a flat tint showing through.\nconst stickySurface = \"bg-brand-50/90 backdrop-blur-lg dark:bg-brand-950/85\"\n\n/**\n * A page turn keeps the outgoing range mounted for one animation so the day\n * band can travel rather than swap β€” the approach Vanilla Calendar Pro takes\n * (an `inert` ghost layer) rather than the View Transitions API, which cannot\n * clip a snapshot to a scroll container and is only stable in React 19.3.\n *\n * Only the band is duplicated. The hour gutter, the gridlines and the\n * now-cursor are outside it and stay put by construction, which is what makes\n * a page turn read as the days moving rather than the whole view lurching.\n */\ntype PageTransition = { days: Date[]; key: string; direction: -1 | 1 }\n\n/** Roughly the token duration (220ms) plus headroom, as a backstop for the\n * `animationend` that normally clears the outgoing band. */\nconst PAGE_ANIMATION_MS = 400\n\nconst bandKeyOf = (days: Date[]) =>\n days.length > 0 ? `${(days[0] as Date).getTime()}:${days.length}` : \"\"\n\n/** Live, not cached β€” a consumer can toggle the OS setting mid-session, and\n * reading it here is the same thing `scrollElementToCenter` already does. */\nconst prefersReducedMotion = () =>\n typeof window !== \"undefined\" &&\n typeof window.matchMedia === \"function\" &&\n window.matchMedia(\"(prefers-reduced-motion: reduce)\").matches\n\nexport function ScheduleTimedGrid<P = unknown>({\n days,\n data,\n staticEvents,\n startHour,\n endHour,\n slotDuration: slotDurationProp,\n minDuration: minDurationProp,\n resizeCollision,\n maxDuration: maxDurationProp,\n slotDisabled,\n now,\n withNowIndicator,\n selected = [],\n onEventSelect,\n withEventDetails,\n onEventChange,\n onEventRemove,\n onEventCreate,\n onGridClick,\n editable,\n preventOverlap,\n maxOverlapColumns = DEFAULT_MAX_OVERLAP_COLUMNS,\n maxAllDayRows = DEFAULT_MAX_ALL_DAY_ROWS,\n onOverflowClick,\n withOverflowDetails,\n renderOverflowDetails,\n onDayClick,\n renderEventDetails,\n locale,\n timeZone,\n translations,\n classNames,\n empty,\n hourHeight,\n ref,\n nowRef,\n onPaginate,\n}: ScheduleTimedGridProps<P>) {\n // The one place the slot props are normalised; everything below β€” the\n // create hook, every chip's resize β€” reads these resolved values.\n const {\n slotDuration,\n minDuration,\n maxDuration,\n issues: slotIssues,\n } = resolveSlotDurations({\n slotDuration: slotDurationProp,\n minDuration: minDurationProp,\n maxDuration: maxDurationProp,\n })\n const slotIssueKey = slotIssues.join(\"\\n\")\n useEffect(() => {\n for (const issue of slotIssueKey ? slotIssueKey.split(\"\\n\") : []) devWarn(`Schedule: ${issue}`)\n }, [slotIssueKey])\n // Screen-reader announcer for create/remove: the chip's own fade/scale\n // animation (`schedule-event-chip.tsx`) is purely visual, so a non-sighted\n // user gets nothing today without this. Wraps `onEventRemove`/\n // `onEventCreate` right here β€” the one place that already owns both and\n // forwards them straight down to `DayColumn` β€” rather than threading a new\n // prop through `ScheduleEventChip`/`use-event-create.ts`.\n const [announcement, setAnnouncement] = useState(\"\")\n const announce = useCallback((text: string) => {\n setAnnouncement(\"\")\n // Clear, then set on the next frame: if the same text is announced twice\n // in a row (e.g. removing two same-titled events back to back), a\n // screen reader only re-announces a live region on an actual content\n // change β€” without the intermediate empty frame, the second, identical\n // announcement would silently be swallowed.\n requestAnimationFrame(() => setAnnouncement(text))\n }, [])\n /**\n * A plain click on empty grid space clears the selection, and separately\n * reports the gesture.\n *\n * Composed here rather than inside `use-event-create.ts` because that hook\n * already owns the one thing that is hard β€” resolving click-vs-drag β€” and\n * layering a second responsibility into it would put selection behind the\n * same `CLICK_SLOP` logic it has no business knowing about. This is the same\n * place `handleEventRemove`/`handleEventCreate` below wrap a consumer\n * callback with internal behaviour, for the same reason.\n *\n * Both fire: `onSelect(null)` reports the state change, `onGridClick` the raw\n * gesture. They are not synonyms β€” `onGridClick` fires whether or not\n * anything was selected, which is the one thing the former `onEventDismiss`\n * did that selection does not cover.\n */\n const handleGridClick = useCallback(\n (date: Date) => {\n onEventSelect?.(null)\n onGridClick?.(date)\n },\n [onEventSelect, onGridClick],\n )\n /**\n * Events that were in `data` last render and are not in it now β€” kept\n * mounted just long enough to play their exit.\n *\n * Derived from `data` rather than from who clicked what, which is the whole\n * point: a removal animates however it happened. The built-in `x`, a\n * consumer's own delete button, an undo, a server push β€” all of them are\n * \"the event left `data`\", and all of them now animate. The previous design\n * knew only about its own button.\n *\n * State is unavoidable here and is not redundant: once React unmounts a node\n * no CSS can animate it, so *something* has to outlive `data`, and this is\n * the only record of an event that by definition is no longer in it. It is\n * the same thing `AnimatePresence` holds, for the same reason. React 19.3's\n * `<ViewTransition>` could do it with no state at all, but the RFC already\n * rejected that API for this surface (Β§14): it cannot handle an element\n * clipped by an `overflow` ancestor, which is exactly what this grid is.\n */\n const [exiting, setExiting] = useState<ScheduleEvent<P>[]>([])\n const [previousData, setPreviousData] = useState(data)\n // Derived **during render**, not in an effect β€” React's documented \"adjust\n // state when a prop changes\" escape hatch, and the same call the page-turn\n // animation makes for the same reason. An effect runs a commit too late: the\n // render that drops the event from `data` would unmount its chips, and the\n // outgoing copy would then *remount* on the next commit already closed, with\n // no open state to animate away from. Measured in a browser β€” the copy came\n // back `display: none` at full opacity and simply sat there.\n if (previousData !== data) {\n const gone = previousData.filter((event) => !data.some((live) => live.id === event.id))\n setPreviousData(data)\n if (gone.length > 0) {\n setExiting((current) => [\n // An event can leave, be restored, and leave again before the first\n // exit has finished; keying by id keeps one outgoing copy, not two.\n ...current.filter((event) => !gone.some((g) => g.id === event.id)),\n ...gone,\n ])\n }\n }\n // An event that comes *back* must stop being an outgoing copy, or it would\n // render twice β€” once live, once mid-fade.\n const exitingIds = useMemo(() => {\n const live = new Set(data.map((event) => event.id))\n return new Set(exiting.map((event) => event.id).filter((id) => !live.has(id)))\n }, [exiting, data])\n const handleExitComplete = useCallback((event: ScheduleEvent<P>) => {\n setExiting((current) => current.filter((e) => e.id !== event.id))\n }, [])\n\n const handleEventRemove = useCallback(\n (event: ScheduleEvent<P>) => {\n // Fired straight from the click now, not after the exit β€” the consumer\n // drops it from `data`, and the animation follows from that.\n announce(translations.eventRemoved.replace(\"{title}\", event.title))\n onEventRemove?.(event)\n },\n [onEventRemove, translations, announce],\n )\n const handleEventCreate = useCallback<ScheduleEventCreateHandler>(\n (ranges) => {\n // One announcement per gesture, however many events it made.\n announce(\n translations.eventCreated.replace(\n \"{range}\",\n ranges.map((range) => timeRangeLabel(range.start, range.end, locale)).join(\", \"),\n ),\n )\n onEventCreate?.(ranges)\n },\n [onEventCreate, translations, locale, announce],\n )\n\n // An explicit `hourHeight` prop always wins; absent, it scales with\n // `slotDuration` (see `defaultHourHeight`'s own comment).\n const resolvedHourHeight = hourHeight ?? defaultHourHeight(slotDuration)\n const layoutFloorMs = visualFloorMs(resolvedHourHeight)\n const internalGridRef = useRef<HTMLDivElement>(null)\n /** Set by the gesture-driven `onPaginate` below, read and cleared by the\n * next band swap. A page turn the user reached by *holding a drag at the\n * edge* must not animate: `measureColumns` re-measures one frame later\n * (`schedule-grid-gesture.ts`), and mid-animation columns would hand it\n * transformed rects to cache for the rest of the gesture. */\n const pagedByGestureRef = useRef(false)\n /** The band's rendered width, refreshed every commit. Read during the\n * render that *starts* an animation, so the offset is already in the DOM on\n * the animation's first frame rather than one layout effect too late. */\n const bandWidthRef = useRef(0)\n\n const [band, setBand] = useState<{ key: string; days: Date[] }>(() => ({\n key: bandKeyOf(days),\n days,\n }))\n const [pageOut, setPageOut] = useState<PageTransition | null>(null)\n\n // Adjusting state directly during render when a prop changes β€” React's own\n // documented escape hatch, and the only way the outgoing copy can mount in\n // the *same* commit as the incoming one. A frame later would show the new\n // band alone before the old one appeared to leave.\n const daysKey = bandKeyOf(days)\n if (band.key !== daysKey) {\n const previous = band.days\n const byGesture = pagedByGestureRef.current\n pagedByGestureRef.current = false\n // Only a real page turn slides. `paginateDate` always steps by exactly\n // `visibleDays`, so anything else β€” the Now button, a consumer setting\n // `date` to an arbitrary day β€” is a jump, and sliding it one band's width\n // would claim a distance it did not travel.\n const stepDays = Math.round(\n (((days[0] as Date | undefined)?.getTime() ?? 0) -\n ((previous[0] as Date | undefined)?.getTime() ?? 0)) /\n 86_400_000,\n )\n const isOnePageTurn =\n previous.length === days.length && days.length > 0 && Math.abs(stepDays) === days.length\n setPageOut(\n isOnePageTurn && !byGesture && !prefersReducedMotion()\n ? { days: previous, key: band.key, direction: stepDays > 0 ? 1 : -1 }\n : null,\n )\n setBand({ key: daysKey, days })\n }\n\n useLayoutEffect(() => {\n const column = internalGridRef.current?.querySelector<HTMLElement>(\n \"[data-schedule-part='day-column'][data-day-index]:not([data-page-exiting])\",\n )\n if (column) bandWidthRef.current = column.getBoundingClientRect().width * days.length\n })\n\n useEffect(() => {\n if (!pageOut) return\n const timer = setTimeout(() => setPageOut(null), PAGE_ANIMATION_MS)\n return () => clearTimeout(timer)\n }, [pageOut])\n\n /** Wraps the gesture-driven page turn so the swap above can tell it apart\n * from a toolbar click. */\n const handlePaginate = useCallback(\n (direction: -1 | 1) => {\n pagedByGestureRef.current = true\n onPaginate?.(direction)\n },\n [onPaginate],\n )\n\n /**\n * One band of day columns. Rendered twice while a page turn runs: the\n * incoming range, and a fully inert copy of the one it replaced.\n *\n * The outgoing copy deliberately carries **no now-cursor** β€” `nowRef` is a\n * merged ref pointing at a single rendered marker, and a second marker would\n * clobber whichever one `Now` later scrolls to.\n */\n const renderBand = (\n bandDays: Date[],\n segs: ScheduleSegment<P>[][],\n staticSegs: ScheduleSegment<P>[][],\n role: \"entering\" | \"exiting\" | undefined,\n keyPrefix: string,\n ) =>\n bandDays.map((day, columnIndex) => {\n const isToday = eventOccursOnDay(\n { start: todayRef, end: new Date(todayRef.getTime() + 1) },\n day,\n timeZone,\n )\n return (\n <DayColumn\n key={`${keyPrefix}${day.toISOString()}`}\n day={day}\n pageState={role}\n columnIndex={columnIndex}\n onPaginate={role === \"exiting\" ? undefined : handlePaginate}\n isFirstDayColumn={columnIndex === 0}\n daySegments={segs[columnIndex] ?? []}\n dayStaticSegments={staticSegs[columnIndex] ?? []}\n startHour={startHour}\n endHour={endHour}\n totalWindowMinutes={totalWindowMinutes}\n slotDuration={slotDuration}\n minDuration={minDuration}\n resizeCollision={resizeCollision}\n maxDuration={maxDuration}\n slotDisabled={slotDisabled}\n editableCreate={editableCreate}\n editableDrag={editableDrag}\n editableResize={editableResize}\n editableRemove={editableRemove}\n preventOverlapOnCreate={preventOverlapOnCreate}\n preventOverlapOnDrag={preventOverlapOnDrag}\n preventOverlapOnResize={preventOverlapOnResize}\n overlapCandidates={overlapCandidates}\n maxOverlapColumns={maxOverlapColumns}\n layoutFloorMs={layoutFloorMs}\n selected={selected}\n // The outgoing band is an inert copy: it keeps the selected fill so\n // nothing flickers mid-slide, but never a second popover.\n ownsAnchor={role !== \"exiting\" && anchorPiece.key === day.toISOString()}\n onEventSelect={\n onEventSelect &&\n ((event: ScheduleAnyEvent<P> | null) => {\n anchorPiece.press(day.toISOString(), event)\n onEventSelect(event)\n })\n }\n withEventDetails={withEventDetails}\n exitingIds={exitingIds}\n onExitComplete={handleExitComplete}\n onEventChange={onEventChange}\n onEventRemove={handleEventRemove}\n onEventCreate={handleEventCreate}\n onGridClick={handleGridClick}\n onOverflowClick={onOverflowClick}\n withOverflowDetails={withOverflowDetails}\n renderOverflowDetails={renderOverflowDetails}\n renderEventDetails={renderEventDetails}\n locale={locale}\n timeZone={timeZone}\n translations={translations}\n classNames={classNames}\n isToday={role === \"exiting\" ? false : isToday}\n now={now}\n nowRef={role === \"exiting\" ? undefined : nowRef}\n withNowIndicator={role === \"exiting\" ? false : withNowIndicator}\n />\n )\n })\n\n const paging = pageOut !== null\n const enterClass = paging ? \"animate-schedule-page-enter\" : undefined\n\n const totalWindowMinutes = (endHour - startHour) * 60\n // The timed row's own floor β€” `minmax(minTimedHeightPx, 1fr)` below lets it\n // stretch past this to fill real leftover space, scrolling only once this\n // floor itself exceeds what's available.\n const minTimedHeightPx = (endHour - startHour) * resolvedHourHeight\n const hours = Array.from({ length: endHour - startHour }, (_, i) => startHour + i)\n const hasAnyEvent = data.length > 0 || staticEvents.length > 0\n const dayFormatter = new Intl.DateTimeFormat(locale, { weekday: \"short\", day: \"numeric\" })\n // `\"2-digit\"`, not `\"numeric\"` β€” same SSR-hydration reasoning as\n // `schedule-dates.ts`'s `timeRangeLabel`.\n const hourFormatter = new Intl.DateTimeFormat(locale, { hour: \"2-digit\" })\n // `useNow`, not a bare `new Date()`: this feeds `isToday` below and\n // `anyDayIsToday`, which is the gate on `NowCursorLine` β€” and that line\n // reads the clock through `useNow` itself. A raw `new Date()` here made the\n // gate and the thing it gates disagree during SSR: the gate opened on the\n // server's real date while the cursor rendered `useNow`'s epoch server\n // snapshot, painting a now-marker at 01:00 on a day that isn't today. Going\n // through the same hook means both sides see the epoch on the server and the\n // first client render (so hydration matches), then the real time together.\n // It also costs a re-render a minute, which is what moves the today column\n // across midnight rather than leaving it on yesterday.\n const todayRef = useNow(now)\n const columnsTemplate = `var(--sch-gutter-width) repeat(${days.length}, minmax(var(--sch-day-min-width), 1fr))`\n const anyDayIsToday = days.some((day) =>\n eventOccursOnDay({ start: todayRef, end: new Date(todayRef.getTime() + 1) }, day, timeZone),\n )\n // The all-day row's own input: every all-day event overlapping the whole\n // visible window (not per-day β€” a multi-day bar needs the events it spans\n // even where it doesn't literally start/end), day-columns' own timed\n // events excluded below via `!event.allDay`.\n const visibleWindowEnd = paginateDate(\"days\", days[days.length - 1] as Date, 1, {\n timeZone,\n visibleDays: 1,\n })\n const allDayEvents = [...data, ...staticEvents].filter(\n (event) =>\n event.allDay && rangesOverlap(event, { start: days[0] as Date, end: visibleWindowEnd }),\n )\n const outDays = pageOut?.days ?? []\n const outAllDayEvents = pageOut\n ? [...data, ...staticEvents].filter(\n (event) =>\n event.allDay &&\n rangesOverlap(event, {\n start: outDays[0] as Date,\n end: paginateDate(\"days\", outDays[outDays.length - 1] as Date, 1, { timeZone }),\n }),\n )\n : []\n // Resolved once β€” doesn't vary per day-column. `gestures` feeds axis A\n // (`isOverlapGestureEnabled`, per gesture below); `against` feeds axis B,\n // consumed immediately below.\n const { gestures: preventOverlapGestures, against: overlapAgainst } =\n resolveOverlapPrevention(preventOverlap)\n // The timed events, split into one piece per day column. Hoisted out of\n // `days.map` below β€” which used to re-filter `data`/`staticEvents` once per\n // column β€” and computed for the whole window at once, so a column's pieces\n // are just `[columnIndex]`. `!event.allDay`: all-day events render in the\n // sticky spanning row above, never positioned by time-of-day here.\n // Outgoing copies ride along through segmentation and layout so a fading chip\n // still has real geometry β€” but never through `overlapCandidates` below: an\n // event that has left `data` no longer occupies its slot, so a drag landing\n // where it used to be must not be rejected.\n const liveTimedData = data.filter((event) => !event.allDay)\n const timedData =\n exiting.length === 0\n ? liveTimedData\n : [...liveTimedData, ...exiting.filter((event) => !event.allDay && exitingIds.has(event.id))]\n const timedStatic = staticEvents.filter((event) => !event.allDay)\n // The outgoing band is a real render of the *previous* range, so it needs\n // its own segmentation β€” the same events, clipped to different days. Only\n // computed while a page turn is actually running.\n const outDataSegments = pageOut\n ? segmentEvents(timedData, outDays, { startHour, endHour, timeZone })\n : []\n const outStaticSegments = pageOut\n ? segmentEvents(timedStatic, outDays, { startHour, endHour, timeZone })\n : []\n const dataSegments = segmentEvents(timedData, days, { startHour, endHour, timeZone })\n const staticSegments = segmentEvents(timedStatic, days, { startHour, endHour, timeZone })\n // A multi-day event has a piece in every column it touches, all sharing its\n // id; exactly one of them may open the details popover.\n const anchorId = selected[0] ?? null\n const anchorPiece = usePieceAnchor(\n anchorId,\n days\n .filter((_, i) =>\n [...(dataSegments[i] ?? []), ...(staticSegments[i] ?? [])].some((s) => s.id === anchorId),\n )\n .map((day) => day.toISOString()),\n )\n // RFC Β§12a axis B, resolved **window-wide** rather than per day-column β€” see\n // `DayColumnProps.overlapCandidates`. Built from the *unclipped* events on\n // purpose: a segment stops at midnight, so validating against segments would\n // let an overnight event overlap whatever sits across the boundary.\n const overlapCandidates = resolveOverlapCandidates(liveTimedData, timedStatic, overlapAgainst)\n const preventOverlapOnCreate = isOverlapGestureEnabled(preventOverlapGestures, \"create\")\n const preventOverlapOnDrag = isOverlapGestureEnabled(preventOverlapGestures, \"drag\")\n const preventOverlapOnResize = isOverlapGestureEnabled(preventOverlapGestures, \"resize\")\n // The schedule-level `editable` grant, resolved once β€” a per-event\n // `editable` can only narrow this further (`isEventGestureEnabled`,\n // applied inside `ScheduleEventChip`), never widen it.\n const editableCreate = isEditGestureEnabled(editable, \"create\")\n const editableDrag = isEditGestureEnabled(editable, \"drag\")\n const editableResize = isEditGestureEnabled(editable, \"resize\")\n const editableRemove = isEditGestureEnabled(editable, \"remove\")\n\n // Dev-mode only: warn on every render a mismatch is present, so a\n // granted-but-inert gesture (or an event trying to widen past the\n // schedule-level grant) doesn't fail silently. `devWarn` strips itself\n // entirely in production builds.\n useEffect(() => {\n if (editableDrag && !onEventChange) {\n devWarn(\n 'Schedule: `editable` grants \"drag\" but `onEventChange` is missing β€” the affordance will render but committing it will do nothing.',\n )\n }\n if (editableResize && !onEventChange) {\n devWarn(\n 'Schedule: `editable` grants \"resize\" but `onEventChange` is missing β€” the affordance will render but committing it will do nothing.',\n )\n }\n if (editableRemove && !onEventRemove) {\n devWarn(\n 'Schedule: `editable` grants \"remove\" but `onEventRemove` is missing β€” the affordance will render but committing it will do nothing.',\n )\n }\n if (editableCreate && !onEventCreate) {\n devWarn(\n 'Schedule: `editable` grants \"create\" but `onEventCreate` is missing β€” the affordance will render but committing it will do nothing.',\n )\n }\n // Segmentation makes an event outside `[startHour, endHour)` render\n // *nothing* β€” the right outcome for the user (it used to draw at a\n // negative `top`, i.e. off-grid), but the one clipping result a developer\n // can't diagnose from the screen. Only reachable with a partial window;\n // silent under the default `0..24`.\n if (startHour > 0 || endHour < 24) {\n const rendered = new Set<string>()\n for (const column of [...dataSegments, ...staticSegments]) {\n for (const segment of column) rendered.add(segment.id)\n }\n for (const event of [...timedData, ...timedStatic]) {\n if (\n !rendered.has(event.id) &&\n rangesOverlap(event, { start: days[0] as Date, end: visibleWindowEnd })\n ) {\n devWarn(\n `Schedule: event \"${event.id}\" falls on a visible day but entirely outside ` +\n `[startHour, endHour) (${startHour}..${endHour}) on every one of them, so it ` +\n \"renders nothing. Widen the window, or check the event's start/end.\",\n )\n }\n }\n }\n for (const event of data) {\n for (const gesture of eventEditGestureExceedsSchedule(editable, event)) {\n devWarn(\n `Schedule: event \"${event.id}\" sets editable to include \"${gesture}\", but the ` +\n \"schedule-level `editable` doesn't grant it β€” an event's `editable` can only narrow \" +\n \"the schedule-level grant, never widen it, so this has no effect.\",\n )\n }\n }\n }, [\n editableDrag,\n editableResize,\n editableRemove,\n editableCreate,\n onEventChange,\n onEventRemove,\n onEventCreate,\n editable,\n data,\n dataSegments,\n staticSegments,\n timedData,\n timedStatic,\n days,\n visibleWindowEnd,\n startHour,\n endHour,\n ])\n const columnOverlapPx =\n days.length > 1 ? DEFAULT_COLUMN_OVERLAP_PX_MULTI_DAY : DEFAULT_COLUMN_OVERLAP_PX\n\n return (\n <div\n ref={mergeRefs(ref, internalGridRef)}\n data-schedule-part=\"timed-grid\"\n className={cn(\n // `relative` so the popovers portalled in here (see the provider\n // below) take this scroller as their containing block: they scroll\n // with the grid and are clipped by it. Without it their absolute\n // positioner resolves against an ancestor outside the scroller and\n // floats over the page as if it were still portalled to the body.\n \"relative h-full min-w-0 overflow-auto\",\n // An inline-size container so those same popovers can cap their width\n // at what the grid can actually show (`100cqw` in their classes) β€” on\n // a phone the visible band beside the gutter is narrower than a\n // panel's usual 16rem, and the scroller would clip the rest. The root\n // already takes its width from its parent (`min-w-0`, never from its\n // `min-w-max` content), so containment changes nothing about its size.\n \"@container\",\n // The whole grid, not just the chips. Every surface a gesture starts\n // on was already `select-none` individually (chips, grips, the ghost,\n // the create draft) β€” but press-dragging on *empty* space, which is\n // exactly how an event is created, began a text selection that ran\n // through the hour labels and day headers as the pointer moved. One\n // declaration here covers every current and future child. The\n // details popovers are portalled *into* this subtree, so their panels\n // opt back in with `select-text`.\n \"select-none\",\n classNames?.grid,\n )}\n style={\n {\n \"--sch-window-minutes\": `${totalWindowMinutes}`,\n \"--sch-gutter-width\": \"3.5rem\",\n \"--sch-day-min-width\": \"9rem\",\n \"--sch-column-gap\": \"3px\",\n \"--sch-column-overlap\": `${columnOverlapPx}px`,\n \"--sch-column-fraction\": 0.7,\n // How far the band travels, as one measured length for every piece\n // of it β€” see the `schedule-page-*` keyframes in `theme.css` for why\n // this can't be a percentage. Written only while a page turn runs.\n ...(pageOut\n ? {\n \"--sch-page-from\": `${pageOut.direction === 1 ? bandWidthRef.current : -bandWidthRef.current}px`,\n \"--sch-page-to\": `${pageOut.direction === 1 ? -bandWidthRef.current : bandWidthRef.current}px`,\n }\n : {}),\n } as CSSProperties\n }\n >\n <OverlayContainerProvider value={internalGridRef}>\n <div\n // `relative` so this grid is the containing block for the\n // full-width now-guide below β€” an absolutely-positioned grid item\n // resolves its containing block to its own grid area (per the CSS\n // Grid spec) only when the grid container itself is positioned;\n // without it, `top` was resolving against the page instead. `h-full`\n // gives this grid a real, definite height (resolving against this\n // component's own `h-full overflow-auto` root, itself resolving\n // against a definite-height ancestor further up β€” the same chain\n // that already makes scrolling work today) β€” without it, the timed\n // row's `1fr` track below has nothing to distribute and is sized as\n // `auto` instead (CSS Grid: an indefinite container gives `fr` tracks\n // nothing to fill). `minmax(floor, 1fr)` is the actual \"min-height\n // for the slot, CSS resizes to fill\" behavior: at least the floor,\n // else however much real space is left.\n // `min-w-max` is what lets the hour gutter (and the header block's\n // corner cell) stay pinned across a horizontal scroll. Without it this\n // wrapper is `width: 100%` of the scrollport while its own tracks\n // overflow it, so a `position: sticky` grid item can only travel to\n // the edge of *this box* β€” the gutter detached and scrolled away the\n // moment `scrollLeft` passed `clientWidth - gutterWidth`, leaving the\n // hour axis behind the day columns. Sizing the wrapper to its content\n // makes the sticky containing block the full scrollable width. It\n // changes nothing when the band already fits: `min-width` cannot cap\n // the box, so the `1fr` half of `minmax(var(--sch-day-min-width), 1fr)`\n // still expands the columns to fill a wider container exactly as\n // before.\n // `overflow-clip` contains the page-turn animation's own overflow.\n // `schedule-page-enter` starts the incoming band a whole band-width\n // away under `translateX`, and a transform still contributes to an\n // ancestor's *scrollable* overflow even though it changes no layout β€”\n // so the scroller's `scrollWidth` inflated for the length of every\n // page turn (measured: 1064 -> 2041 -> 1064 over ~14 frames at 1440px)\n // and the horizontal scrollbar appeared and vanished with it. Worse\n // than the flicker, that resizes the scrollport mid-gesture, which\n // moves every day column out from under a drag that measured them at\n // `pointerdown`.\n //\n // `clip` rather than `hidden` on purpose: `hidden` would make this a\n // scroll container, and the hour gutter's `position: sticky` resolves\n // against the *outer* `overflow-auto` root β€” the `min-w-max` above is\n // what lets it pin across a horizontal scroll, and a nested scrollport\n // here would take that away. `clip` establishes no scrollport, so the\n // gutter keeps sticking to the real one and only the painting is cut.\n //\n // `overflow-x` alone, not both axes: this wrapper is `h-full`, so the\n // hours overflow it vertically by design and the outer root scrolls\n // them. Clipping both axes silently removed the grid's vertical\n // scrollbar (measured: `scrollHeight` collapsed to `clientHeight`),\n // which is the entire timed grid. `clip` on one axis and `visible` on\n // the other is well-defined and stays scrollport-free β€” unlike\n // `hidden`, where a `visible` counterpart would compute to `auto`.\n //\n // The animation itself is unchanged: the band still travels the same\n // distance on the same curve. It is only clipped at the edge it was\n // already sliding in from, which is what it looked like anyway.\n className=\"relative grid h-full min-w-max overflow-x-clip\"\n style={{\n gridTemplateColumns: columnsTemplate,\n gridTemplateRows: `auto minmax(${minTimedHeightPx}px, 1fr)`,\n }}\n >\n {/* Header + all-day block β€” ONE sticky, ONE blurred surface for both\n * the day-header row and the all-day lanes underneath it, not two\n * (or N+1) separately-positioned pieces: `backdrop-blur` samples\n * only the pixels directly behind its own element and can't borrow\n * samples across an element boundary, so blurring the day-header\n * buttons individually β€” or blurring the header and the all-day row\n * as two stacked-but-separate elements β€” both produced a visible\n * seam right at the boundary. Folding everything into one `sticky\n * top-0` wrapper with an inner grid (same `columnsTemplate`, so\n * columns line up exactly with the timed grid below) also drops the\n * old `--sch-header-height` bookkeeping entirely: with one sticky\n * block instead of two independently-positioned ones, there's no\n * second element that needs to know where the first one ends β€”\n * ordinary grid flow stacks the header row and each all-day lane\n * (both left `auto`-sized) for free. `row-1`/`col-[1/-1]` place this\n * block in the *outer* grid; `gridTemplateColumns` only (no\n * `gridTemplateRows`) on the inner grid lets it grow implicit\n * `auto` rows as `ScheduleAllDayRow` below adds lanes.\n * z-40 ties the top sticky tier β€” above the gutter's z-30 (which\n * does scroll into this block's screen space, see the gutter's own\n * comment below), below nothing. */}\n <div\n // Measured by the reveal (`schedule.tsx`) to know how much of the\n // scroll viewport this block occludes: an element level with the\n // grid's top edge is inside the scroll box but behind this.\n data-schedule-part=\"header-block\"\n className={cn(\n \"sticky top-0 z-40 col-span-full row-1 grid border-b border-brand-900/20 dark:border-white/15\",\n stickySurface,\n )}\n style={{ gridTemplateColumns: columnsTemplate }}\n >\n {/* Corner cell β€” additionally pinned on the inline axis, so it\n * never scrolls under the day headers or the gutter as the grid\n * scrolls horizontally (this block's own `sticky` above only\n * pins the vertical axis). `stickySurface` matches the hour\n * gutter and the all-day label directly below it β€” without it,\n * a horizontally-scrolled day-header button could show through\n * this cell exactly the way an all-day event bar used to show\n * through the unstyled label (see that file's own comment);\n * applying it to only one of these adjacent sticky pieces reads\n * as a seam, so all three share the identical treatment. */}\n <div className={cn(\"sticky inset-s-0\", stickySurface)} />\n {/* Explicitly placed, not auto-flowed: during a page turn there are\n * two sets of headers in this grid, and auto-placement would push\n * the second set into the all-day lanes' rows below. */}\n {days.map((day, columnIndex) => (\n <button\n key={day.toISOString()}\n type=\"button\"\n onClick={() => onDayClick?.(day)}\n style={{ gridColumn: columnIndex + 2, gridRow: 1 }}\n className={cn(\n \"truncate px-2 py-2 text-center text-sm font-medium hover:bg-black/5 dark:hover:bg-white/8\",\n enterClass,\n )}\n >\n {dayFormatter.format(day)}\n </button>\n ))}\n {outDays.map((day, columnIndex) => (\n <button\n key={`exit-${day.toISOString()}`}\n type=\"button\"\n inert\n aria-hidden\n data-page-exiting=\"true\"\n style={{ gridColumn: columnIndex + 2, gridRow: 1 }}\n className={cn(\n \"truncate px-2 py-2 text-center text-sm font-medium\",\n \"pointer-events-none animate-schedule-page-leave\",\n )}\n >\n {dayFormatter.format(day)}\n </button>\n ))}\n {/* All-day lanes β€” RFC's all-day addendum. Its own component (not\n * inlined here) since it needs its own lane-packing/overflow\n * logic, but it renders directly into *this* grid (via\n * `rowOffset`, starting right after the header's own row 1), not\n * a nested grid of its own β€” one shared grid means one shared\n * sticky/blurred surface, the whole point of merging the two.\n * Renders nothing when there's no all-day event in view, so this\n * block cleanly collapses to just the header's own height. */}\n <ScheduleAllDayRow\n days={days}\n events={allDayEvents}\n maxAllDayRows={maxAllDayRows}\n rowOffset={2}\n timeZone={timeZone}\n selected={selected}\n onEventSelect={onEventSelect}\n withEventDetails={withEventDetails}\n onOverflowClick={onOverflowClick}\n withOverflowDetails={withOverflowDetails}\n renderOverflowDetails={renderOverflowDetails}\n renderEventDetails={renderEventDetails}\n locale={locale}\n translations={translations}\n classNames={classNames}\n pageClassName={enterClass}\n />\n {pageOut ? (\n <ScheduleAllDayRow\n days={outDays}\n events={outAllDayEvents}\n maxAllDayRows={maxAllDayRows}\n rowOffset={2}\n timeZone={timeZone}\n renderEventDetails={renderEventDetails}\n locale={locale}\n translations={translations}\n classNames={classNames}\n hideLabel\n pageExiting\n pageClassName=\"pointer-events-none animate-schedule-page-leave\"\n />\n ) : null}\n </div>\n\n {/* Hour gutter β€” pinned to the start edge, so it stays visible while\n * the days scroll horizontally; z-30, above both now-line variants\n * (z-10/z-20), so the hour labels always stay legible over a\n * horizontally-scrolled-under now-line or day column. But *below*\n * the header/all-day block's z-40: on any vertical scroll, the\n * gutter (unpinned on that axis, unlike that block) visually creeps\n * up into its screen space by however many pixels you've scrolled β€”\n * without a lower z-index here, that scrolled-up sliver would paint\n * over the sticky header/all-day block instead of staying tucked\n * behind it. Explicit `row-2`, same reasoning as `DayColumn`'s own\n * comment. */}\n <div\n // Measured by the reveal (`schedule.tsx`) exactly the way\n // `header-block` above is: `inset-s-0` pins this over the scroll\n // viewport's inline-start edge, so a day column level with the grid's\n // own start edge is inside the scroll box but behind this.\n data-schedule-part=\"hour-gutter\"\n className={cn(\"sticky inset-s-0 z-30 row-2 flex flex-col border-e\", stickySurface)}\n >\n {hours.map((hour) => (\n <HourGutterTick\n key={hour}\n hour={hour}\n label={hourFormatter.format(new Date(2000, 0, 1, hour))}\n now={now}\n startHour={startHour}\n endHour={endHour}\n // Declutters the hour that `NowCursorLabel` already covers β€”\n // same gate as the label itself, so the number only ever\n // disappears while its stand-in is actually on screen.\n hideWhenCurrent={withNowIndicator && anyDayIsToday}\n // `flex-1` (not a fixed `h-(--sch-hour-height)`, correction\n // after v1 shipped) β€” the gutter is already `flex flex-col` and\n // stretches to match the shared timed row's own resolved\n // height (same as `DayColumn`'s `h-full`), so evenly splitting\n // *that* across N ticks inherits the row's own floor \"for\n // free,\" with no separate per-tick minimum needed.\n className=\"flex-1 shrink-0 pe-2 text-end text-[10px] text-gray-light-500 dark:text-gray-dark-500\"\n />\n ))}\n {/* The now-cursor's own clock-time label β€” floats over this\n * gutter's hour axis, not over today's event content. Gated on\n * `anyDayIsToday` (not a per-column `isToday`): the gutter is one\n * shared column regardless of which day column today is, so its\n * visibility should match the cross-day `guide` line below, not\n * any single `DayColumn`. `position: sticky` above already forms\n * the containing block this `absolute`-positioned label resolves\n * against, same as `position: relative` would. */}\n {withNowIndicator && anyDayIsToday ? (\n <NowCursorLabel\n now={now}\n startHour={startHour}\n endHour={endHour}\n locale={locale}\n className={classNames?.nowIndicator}\n />\n ) : null}\n </div>\n\n {/* Spans every day column (not the gutter) at today's current-time\n * row, so the hour it lines up with stays easy to trace even when\n * today isn't the column you're looking at β€” faint on purpose, the\n * real indicator is the opaque marker in today's own column below.\n * Explicit `row-2`, same reasoning as `DayColumn`'s own comment.\n *\n * Wrapped in a plain, non-positioned `col-[2/-1] row-2` div rather\n * than putting that grid placement directly on `NowCursorLine`'s own\n * (`position: absolute`) root β€” correction after the fill-height\n * refactor shipped: an absolutely-positioned grid item's containing\n * block resolves against the grid *container's own* definite size\n * (this grid's `h-full`, which stays pinned to whatever's actually\n * visible), not the row's real `minmax(floor, 1fr)`-resolved track\n * size that in-flow items (`DayColumn`, the gutter) correctly\n * stretch to and can overflow past β€” so once the floor exceeds the\n * visible area (forcing a scroll), the guide line drifted to a\n * different `top%` basis than the marker/label inside those in-flow\n * items, even though all three call the exact same\n * `nowIndicatorTop`. This wrapper is itself a normal, in-flow grid\n * item (default `align-self: stretch`, same as `DayColumn`/the\n * gutter), so it resolves to the row's real height too β€” and being\n * `position: relative`, it becomes `NowCursorLine`'s containing\n * block instead of the grid container. `min-w-0` is load-bearing,\n * not decorative: an in-flow grid item's default `min-width: auto`\n * still contributes to how the multiple `1fr` day-column tracks it\n * spans (`col-[2/-1]`) get sized β€” without it, its (empty but for\n * an absolutely-positioned child) auto min-content size distorted\n * that distribution, collapsing every spanned column past the\n * first one to 0 width. */}\n {withNowIndicator && anyDayIsToday ? (\n <div className=\"relative col-[2/-1] row-2 min-w-0\">\n <NowCursorLine\n now={now}\n startHour={startHour}\n endHour={endHour}\n variant=\"guide\"\n className={classNames?.nowIndicator}\n />\n </div>\n ) : null}\n\n {renderBand(days, dataSegments, staticSegments, paging ? \"entering\" : undefined, \"\")}\n {pageOut\n ? renderBand(outDays, outDataSegments, outStaticSegments, \"exiting\", \"exit-\")\n : null}\n </div>\n\n {!hasAnyEvent && empty !== null ? (\n <div className=\"p-6 text-center text-sm text-gray-light-500 dark:text-gray-dark-500\">\n {empty ?? translations.empty}\n </div>\n ) : null}\n\n {/* Visually-hidden create/remove announcer β€” `role=\"status\"` implies\n * `aria-live=\"polite\"` + `aria-atomic=\"true\"`, so a screen-reader\n * user hears what the chip's own fade/scale animation otherwise only\n * shows. */}\n <div role=\"status\" className=\"sr-only\">\n {announcement}\n </div>\n </OverlayContainerProvider>\n </div>\n )\n}\n","\"use client\"\n\nimport { ark, type HTMLArkProps } from \"@ark-ui/react\"\nimport { getLocalTimeZone } from \"@internationalized/date\"\nimport type { Ref } from \"react\"\nimport { useRef } from \"react\"\nimport { cn } from \"../../lib/cn\"\nimport { mergeRefs } from \"../../lib/merge-refs\"\nimport { props } from \"../../lib/props\"\nimport type { WithTestId } from \"../../lib/test-id\"\nimport { useUncontrolled } from \"../../lib/use-uncontrolled\"\nimport { enumerateDays, getVisibleRange, paginateDate } from \"./schedule-dates\"\nimport { scrollElementToCenter } from \"./schedule-geometry\"\nimport { ScheduleTimedGrid } from \"./schedule-timed-grid\"\nimport { ScheduleToolbar } from \"./schedule-toolbar\"\nimport type {\n AnchorDateProps,\n PaginationChromeProps,\n ScheduleAlign,\n ScheduleDayClickProps,\n ScheduleEmptyProps,\n ScheduleEventProps,\n ScheduleOverflowProps,\n ScheduleSharedProps,\n ScheduleSlotProps,\n ScheduleSlotValues,\n ScheduleTimedProps,\n} from \"./schedule-types\"\nimport { resolveScheduleTranslations } from \"./schedule-types\"\nimport { useScheduleSelection } from \"./use-schedule-selection\"\n\n/**\n * RFC Β§1/Β§17 (`docs/rfcs/schedule.md`) β€” standalone Days view: mountable with\n * no `<Schedule.Root>` wrapper, its own uncontrolled anchor date, and its own\n * (optional) pagination chrome. Replaces the old, separately-mountable\n * `DayView`/`WeekView` pair with one `visibleDays`-sized rolling/calendar\n * window β€” `visibleDays={1}` reproduces the old `DayView`, `visibleDays={7}`\n * (the default) reproduces the old `WeekView`, and any other size is now a\n * real, first-class option.\n */\n/**\n * Every `DaysView` prop except the slot ones β€” what `DayView`/`WeekView` can\n * safely `Omit` from. `ScheduleSlotProps` is a union, and an `Omit` over it\n * would collapse the check between `slotDuration` and `minDuration`, so each\n * public props type adds it back *after* its own `Omit`.\n */\nexport type DaysViewBaseProps<P = unknown> = ScheduleSharedProps<P> &\n ScheduleEventProps<P> &\n ScheduleDayClickProps &\n ScheduleTimedProps<P> &\n ScheduleEmptyProps &\n ScheduleOverflowProps<P> &\n AnchorDateProps &\n PaginationChromeProps &\n // `ScheduleEventProps` contributes `onSelect`, and React's own DOM props\n // carry an `onSelect` (text-selection) of their own. Without this `Omit` the\n // two intersect into a handler that has to satisfy *both* signatures, so the\n // declaration compiles and every call site fails. The kit already uses this\n // treatment for other redefined natives.\n Omit<HTMLArkProps<\"div\">, \"onSelect\"> &\n WithTestId & {\n /** How many day-columns to show at once. Default `7`. */\n visibleDays?: number\n /** Locale default when omitted; `\"relative\"` starts the window at the\n * anchor date itself instead of snapping to a calendar-week boundary β€”\n * see `ScheduleAlign`. */\n align?: ScheduleAlign\n /**\n * Exposes the underlying `ScheduleTimedGrid`'s scrollable root DOM node\n * β€” merged (via `mergeRefs`) with this view's own internal ref, which\n * it needs regardless of whether a caller passes this, to scroll the\n * grid to the now-line when its own built-in Now button is clicked\n * (`withNowButton`, RFC Β§14's scroll-to-now addendum). Not part of\n * `ScheduleTimedProps` β€” `Root` also composes that shared slice for\n * its own public props and must not gain a raw DOM-ref field there; it\n * manages its own ref privately instead (see `schedule.tsx`).\n */\n gridRef?: Ref<HTMLDivElement>\n /**\n * Exposes today's own rendered now-marker DOM node (`NowCursorLine`'s\n * `marker` instance) β€” same \"merged with an internal ref this view\n * needs regardless\" and \"kept off `ScheduleTimedProps`\" reasoning as\n * `gridRef` above. Paired with `gridRef`, this is what\n * `scrollElementToCenter` (`schedule-geometry.ts`) needs to center the\n * scroll on the *actual rendered* marker rather than a recomputed pixel\n * position β€” a real measurement stays correct even if something about\n * the grid's layout math ever drifts from what's actually on screen.\n */\n nowRef?: Ref<HTMLDivElement>\n }\n\nexport type DaysViewProps<P = unknown> = DaysViewBaseProps<P> & ScheduleSlotProps\n\n/**\n * The view itself, over plain slot values. `DaysView` below is the public,\n * checked entry point; `Root` renders this one directly, since by the time it\n * forwards `slotDuration`/`minDuration` its own signature has already checked\n * them and only plain numbers are left. Internal β€” not exported from the\n * barrel.\n */\nexport function DaysViewBody<P = unknown>({\n data,\n staticEvents = [],\n selected,\n defaultSelected,\n onSelect,\n withSelection = true,\n withEventDetails = true,\n onDayClick,\n renderEventDetails,\n locale,\n timeZone = getLocalTimeZone(),\n translations,\n classNames,\n className,\n startHour = 0,\n endHour = 24,\n slotDuration = 15,\n minDuration,\n resizeCollision = \"none\",\n maxDuration,\n hourHeight,\n slotDisabled,\n now,\n withNowIndicator = true,\n onEventChange,\n onEventRemove,\n onEventCreate,\n onGridClick,\n editable,\n preventOverlap,\n maxOverlapColumns,\n maxAllDayRows,\n onOverflowClick,\n withOverflowDetails,\n renderOverflowDetails,\n empty,\n date,\n defaultDate,\n onDateChange,\n withPagination = true,\n withNowButton = false,\n visibleDays = 7,\n align,\n gridRef,\n nowRef,\n testId,\n ...rest\n}: DaysViewBaseProps<P> & ScheduleSlotValues) {\n const [anchorDate, setAnchorDate] = useUncontrolled<Date>({\n value: date,\n defaultValue: defaultDate,\n finalValue: now ?? new Date(),\n onChange: onDateChange,\n })\n const { selected: selectedIds, onEventSelect } = useScheduleSelection<P>({\n selected,\n defaultSelected,\n onSelect,\n withSelection,\n })\n const internalGridRef = useRef<HTMLDivElement>(null)\n const nowCursorRef = useRef<HTMLDivElement>(null)\n const t = resolveScheduleTranslations(translations)\n const range = getVisibleRange(\"days\", anchorDate, {\n timeZone,\n locale: locale ?? \"en-US\",\n startOfWeek: align,\n visibleDays,\n })\n const days = enumerateDays(range, timeZone)\n\n return (\n <ark.div\n className={cn(\"flex h-full flex-col\", className)}\n data-schedule-part=\"days-view\"\n {...props({ \"data-testid\": testId })}\n {...rest}\n >\n {withPagination || withNowButton ? (\n <div className=\"mb-2 flex items-center gap-1\">\n {withPagination ? (\n <>\n <ScheduleToolbar.PrevTrigger\n view=\"days\"\n date={anchorDate}\n onDateChange={setAnchorDate}\n timeZone={timeZone}\n translations={t}\n visibleDays={visibleDays}\n />\n <ScheduleToolbar.NextTrigger\n view=\"days\"\n date={anchorDate}\n onDateChange={setAnchorDate}\n timeZone={timeZone}\n translations={t}\n visibleDays={visibleDays}\n />\n </>\n ) : null}\n {withNowButton ? (\n <ScheduleToolbar.NowTrigger\n onDateChange={(d) => {\n setAnchorDate(d)\n // Anchor-date update and scroll fire synchronously in the\n // same click handler β€” the timed row's own height (a floor\n // of `(endHour - startHour) * hourHeight`, or taller once\n // stretched) is independent of which date is showing, so\n // there's no need to wait for a re-render before scrolling.\n if (internalGridRef.current && nowCursorRef.current) {\n scrollElementToCenter(internalGridRef.current, nowCursorRef.current)\n }\n }}\n now={now}\n translations={t}\n className=\"ms-2\"\n />\n ) : null}\n </div>\n ) : null}\n <div className=\"min-h-0 flex-1\">\n <ScheduleTimedGrid\n ref={mergeRefs(gridRef, internalGridRef)}\n // Holding a drag against an edge the grid can no longer scroll pages\n // the view. Reuses the exact anchor-date step `ScheduleToolbar`'s\n // Prev/Next triggers take, so a paged-by-drag range is\n // indistinguishable from a clicked one β€” and, because the anchor is\n // `useUncontrolled`, this works without the consumer wiring anything.\n // A controlled `date` just receives `onDateChange` and decides.\n onPaginate={(direction) => {\n setAnchorDate(paginateDate(\"days\", anchorDate, direction, { timeZone, visibleDays }))\n }}\n days={days}\n data={data}\n staticEvents={staticEvents}\n startHour={startHour}\n endHour={endHour}\n slotDuration={slotDuration}\n minDuration={minDuration}\n resizeCollision={resizeCollision}\n maxDuration={maxDuration}\n hourHeight={hourHeight}\n slotDisabled={slotDisabled}\n now={now}\n nowRef={mergeRefs(nowRef, nowCursorRef)}\n withNowIndicator={withNowIndicator}\n selected={selectedIds}\n onEventSelect={onEventSelect}\n withEventDetails={withEventDetails}\n onEventChange={onEventChange}\n onEventRemove={onEventRemove}\n onEventCreate={onEventCreate}\n onGridClick={onGridClick}\n editable={editable}\n preventOverlap={preventOverlap}\n maxOverlapColumns={maxOverlapColumns}\n maxAllDayRows={maxAllDayRows}\n onOverflowClick={onOverflowClick}\n withOverflowDetails={withOverflowDetails}\n renderOverflowDetails={renderOverflowDetails}\n onDayClick={onDayClick}\n renderEventDetails={renderEventDetails}\n locale={locale}\n timeZone={timeZone}\n translations={t}\n classNames={classNames}\n empty={empty}\n />\n </div>\n </ark.div>\n )\n}\n\nexport function DaysView<P = unknown>(props: DaysViewProps<P>) {\n return <DaysViewBody {...props} />\n}\n","\"use client\"\n\nimport { ark, type HTMLArkProps } from \"@ark-ui/react\"\nimport { getLocalTimeZone } from \"@internationalized/date\"\nimport type { ReactNode } from \"react\"\nimport { useRef } from \"react\"\nimport { cn } from \"../../lib/cn\"\nimport { focusStyles } from \"../../lib/focus-styles\"\nimport { OverlayContainerProvider } from \"../../lib/overlay-container\"\nimport { props as dataProps } from \"../../lib/props\"\nimport type { WithTestId } from \"../../lib/test-id\"\nimport { useUncontrolled } from \"../../lib/use-uncontrolled\"\nimport { Popover } from \"../popover/popover\"\nimport {\n dayKey,\n enumerateDays,\n eventOccursOnDay,\n getVisibleRange,\n isSameMonth,\n isToday,\n} from \"./schedule-dates\"\nimport { ScheduleDisabledOverlay } from \"./schedule-disabled-overlay\"\nimport { ScheduleEventDetailsContent } from \"./schedule-event-details\"\nimport { EVENT_COLOR_CLASSES, EVENT_SELECTED_CLASSES } from \"./schedule-event-styles\"\nimport { ScheduleOverflowPopover } from \"./schedule-overflow-popover\"\nimport { ScheduleToolbar } from \"./schedule-toolbar\"\nimport type {\n AnchorDateProps,\n FirstDayOfWeek,\n PaginationChromeProps,\n ScheduleAnyEvent,\n ScheduleClassNames,\n ScheduleDayClickProps,\n ScheduleDayDisabledProps,\n ScheduleEventProps,\n ScheduleOverflowProps,\n ScheduleSharedProps,\n ScheduleTranslations,\n} from \"./schedule-types\"\nimport { resolveScheduleTranslations } from \"./schedule-types\"\nimport { chipSelection, usePieceAnchor, useScheduleSelection } from \"./use-schedule-selection\"\n\n/**\n * RFC Β§9 (`docs/rfcs/schedule.md`) β€” the read-only month grid. Standalone\n * pagination reuses `Schedule.Toolbar`'s own `PrevTrigger`/`NextTrigger`/\n * `NowTrigger` parts (retrofitted onto `DaysView` alongside this\n * view, so every view shares one button implementation).\n *\n * Note on RSC: unlike the RFC's original \"pure Server Component, no hooks\"\n * plan, this file uses `useUncontrolled` for standalone anchor-date state β€”\n * matching `DaysView`'s already-shipped standalone behavior (RFC\n * Β§1: \"every view individually importable and usable\"). A day-cell without\n * a hook has nowhere to hold the anchor date across a Prev/Next click, so\n * the two goals were incompatible; parity with the sibling views won out.\n */\n/** Month only. Named so `ScheduleProps` can gate it by name rather than\n * `Pick`ing keys out of `MonthViewProps` β€” the hand-maintained shape that\n * left `maxEventsPerDay` unreachable from `Root` for two releases. */\nexport type ScheduleMonthOnlyProps = {\n /**\n * Chips shown per day before a \"+N more\" pill β€” RFC Β§9. Same for every\n * cell, computed at render time (no `ResizeObserver`), so this stays\n * SSR-safe. Default `3`.\n *\n * Also on `Schedule` itself, where β€” like `onMonthClick` on Year β€” it\n * reaches the Month view and nothing else. That is the composition that actually needs it: `Root` spends a\n * row of its own height on the toolbar, so the cap that fits a bare\n * `MonthView` in a given container is often one too many under `Root`.\n *\n * Tune it against the height the cells really get, because it is not\n * only a `.slice()`: it also sets each row's height floor\n * (`monthRowMinHeight` below). Too high for the container and the cell's\n * `overflow-hidden` clips the last pill *and* the \"+N\" chip that was\n * supposed to account for it.\n */\n maxEventsPerDay?: number\n}\n\nexport type MonthViewProps<P = unknown> = ScheduleSharedProps<P> &\n ScheduleEventProps<P> &\n ScheduleDayClickProps &\n ScheduleDayDisabledProps &\n ScheduleMonthOnlyProps &\n ScheduleOverflowProps<P> &\n AnchorDateProps &\n PaginationChromeProps &\n // `ScheduleEventProps` contributes `onSelect`, and React's own DOM props\n // carry an `onSelect` (text-selection) of their own. Without this `Omit` the\n // two intersect into a handler that has to satisfy *both* signatures, so the\n // declaration compiles and every call site fails. The kit already uses this\n // treatment for other redefined natives.\n Omit<HTMLArkProps<\"div\">, \"onSelect\"> &\n WithTestId & {\n /** Locale default when omitted. */\n startOfWeek?: FirstDayOfWeek\n }\n\n/**\n * A day-row's minimum height, computed from `maxEventsPerDay` rather than a\n * fixed guess β€” the row must always have room for its own worst case (every\n * cell showing up to `maxEventsPerDay` pills *and* the \"+N\" overflow line,\n * since any cell in the row could need it) or the pills get clipped by the\n * cell's own `overflow-hidden` before ever reaching the cap they're supposed\n * to show. Every term is the rendered height of the matching class below β€”\n * `text-xs` is Tailwind's fixed 1rem line box:\n * - the cell's own `p-1` padding, top + bottom β†’ 0.5rem\n * - the day number: `text-xs`, no vertical padding, no border β†’ 1rem\n * - one gap (`gap-0.5`) between the day number and the events area\n * - each line in the events area β€” a **pill** or the **\"+N\" chip** alike:\n * `text-xs` (1rem) + `py-0.5` (0.25rem) + a 1px top and bottom `border`\n * β†’ `1.25rem + 2px`. The pill's border comes from `EVENT_COLOR_CLASSES`;\n * the \"+N\" chip's is a `border-transparent` it carries for exactly this\n * reason β€” it buys the chip a pill's hit target, and a pill's box math,\n * without a pill's appearance.\n * - `maxEventsPerDay` gaps (`gap-0.5`) between those lines (N+1 lines have N gaps)\n *\n * **History.** Two earlier versions got the events area wrong. The first\n * billed every line as a flat `1.25rem`, omitting the pills' border entirely;\n * the second fixed that but kept the \"+N\" line at a bare `1rem`, which was\n * right only while that line really was an unpadded, borderless text button.\n * It no longer is β€” the \"+N\" chip now matches a pill's box exactly β€” so the\n * events area is finally uniform: `N + 1` identical lines. Coming up short\n * here is not cosmetic: the cell's `overflow-hidden` then clips the very last\n * pill the cap promises, the exact failure this function exists to prevent.\n *\n * Returns a CSS length, not a bare number, because the borders are the one\n * term that does **not** scale with the root font-size: mixing `rem` and `px`\n * in a `calc()` is the only way to stay exact at any root size (the same\n * reason `ScheduleEventChip`'s own floor is `calc(1rem + 2px)`).\n *\n * The `rem` terms deliberately reserve each line's full **strut** (1rem),\n * which is an upper bound rather than an exact match: `truncate` makes a line\n * a scroll container, and a scroll container is sized by its scrollable\n * overflow β€” the text's own ink extent β€” so with a font whose ink is shorter\n * than the strut a line renders a fraction *under* 1rem (Lato at 12px\n * measures 15.25px against a 16px strut). Reserving the strut is the safe\n * direction for a floor: it can only ever over-reserve slightly, never clip,\n * and it keeps the result independent of whatever font a consumer loads.\n */\nfunction monthRowMinHeight(maxEventsPerDay: number): string {\n const gap = 0.125 // gap-0.5\n const dayNumber = 1 // text-xs line box\n const cellPaddingY = 0.5 // p-1, top + bottom\n const lineText = 1.25 // text-xs line box + a chip's py-0.5\n const lineBorderPx = 2 // the chip's own `border`, top + bottom\n const lines = maxEventsPerDay + 1 // N pills + the \"+N\" chip, worst case\n const rem = cellPaddingY + dayNumber + gap + lines * lineText + (lines - 1) * gap\n return `calc(${rem}rem + ${lines * lineBorderPx}px)`\n}\n\n/** A visible pill inside a day cell β€” like `StaticEventChip`/`InteractiveEventChip`\n * in the timed grid, gains its own event-details popover, gated by\n * `withEventDetails` and opened for whichever pill is `selected`. Month never distinguishes `kind` for\n * interaction (no drag/resize here regardless of kind), so this is the\n * timed grid's Pattern 1 (plain single click β†’ `Popover.Trigger`) for\n * every pill, not just static ones. */\nfunction MonthEventPill<P>({\n event,\n selected = false,\n anchor = selected,\n onEventSelect,\n withEventDetails = true,\n renderEventDetails,\n locale,\n timeZone,\n detailsPopoverClassName,\n}: {\n event: ScheduleAnyEvent<P>\n selected?: boolean\n /** Selected and first in the list: owns the details popover. */\n anchor?: boolean\n onEventSelect?: (event: ScheduleAnyEvent<P> | null) => void\n withEventDetails?: boolean\n renderEventDetails?: (event: ScheduleAnyEvent<P>) => ReactNode\n locale?: string\n timeZone: string\n detailsPopoverClassName?: string\n}) {\n const showDetailsPopover = withEventDetails\n const detailsOpen = showDetailsPopover && anchor\n\n const button = (\n <button\n type=\"button\"\n data-schedule-part=\"event-chip\"\n data-kind={event.kind}\n data-color={event.color ?? \"pink\"}\n {...dataProps({\n \"data-event-id\": event.id,\n \"data-testid\": event.testId ?? event.id,\n \"data-selected\": selected,\n })}\n onClick={(e) => {\n // Keeps a pill click from also reading as a day click.\n e.stopPropagation()\n onEventSelect?.(event)\n }}\n {...(showDetailsPopover\n ? { \"aria-haspopup\": \"dialog\" as const, \"aria-expanded\": detailsOpen }\n : {})}\n className={cn(\n \"block w-full truncate rounded-xs px-1 py-0.5 text-start text-xs\",\n EVENT_COLOR_CLASSES,\n EVENT_SELECTED_CLASSES,\n \"transition-colors duration-150 ease-out motion-reduce:transition-none\",\n // `ScheduleEventChip`'s own treatment, which Month's pill never\n // picked up β€” without it, tabbing through a cell would now ring the\n // \"+N\" chip below and nothing else. `palette`/flush for the same two\n // reasons the timed grid's chips use them: the pill already carries a\n // palette surface, and the cell clips an offset ring.\n focusStyles({ ring: \"palette\", offset: false }),\n )}\n >\n {event.icon != null ? (\n <span className=\"mr-1 inline-flex align-[-1px] [&_svg]:size-3\">{event.icon}</span>\n ) : null}\n {event.title}\n </button>\n )\n\n if (!showDetailsPopover) return button\n\n return (\n <Popover.Root\n lazyMount\n open={detailsOpen}\n onOpenChange={(d) => {\n // Closing is a deselect β€” see `StaticEventChip`'s own note.\n if (!d.open) onEventSelect?.(null)\n }}\n width=\"auto\"\n >\n <Popover.Trigger asChild>{button}</Popover.Trigger>\n <Popover.Content className={cn(\"max-w-64\", detailsPopoverClassName)}>\n <Popover.Body>\n <ScheduleEventDetailsContent\n event={event}\n locale={locale}\n timeZone={timeZone}\n renderEventDetails={renderEventDetails}\n />\n </Popover.Body>\n </Popover.Content>\n </Popover.Root>\n )\n}\n\ntype MonthDayCellProps<P> = Pick<\n ScheduleOverflowProps<P>,\n \"onOverflowClick\" | \"withOverflowDetails\" | \"renderOverflowDetails\"\n> & {\n day: Date\n cellKey: string\n /** Capped to `maxEventsPerDay` β€” what renders inline in the cell. */\n visible: ScheduleAnyEvent<P>[]\n /** The rest β€” what the \"+N\" counts and what its disclosure lists. The two\n * are the same set on every surface. */\n hidden: ScheduleAnyEvent<P>[]\n inMonth: boolean\n disabled: boolean\n today: boolean\n dayNumber: string\n isLastColumn: boolean\n isLastRow: boolean\n onDayClick?: (date: Date) => void\n selected?: readonly string[]\n /** This cell holds the piece of the anchor event that owns its details\n * popover β€” see `usePieceAnchor`. */\n ownsAnchor?: boolean\n onEventSelect?: (event: ScheduleAnyEvent<P> | null) => void\n withEventDetails?: boolean\n renderEventDetails?: (event: ScheduleAnyEvent<P>) => ReactNode\n locale?: string\n timeZone: string\n translations: Required<ScheduleTranslations>\n classNames?: ScheduleClassNames\n}\n\n/**\n * One day's cell β€” its own component rather than inlined in the grid's\n * `.map()`, the same reason `DayColumn` was pulled out of\n * `schedule-timed-grid.tsx`'s own map. (It used to need that for the day\n * popover's own `useState`; that state lives in `ScheduleOverflowPopover`\n * now, shared with the two Days surfaces.)\n *\n * Three click surfaces, three distinct jobs, and none of them overlap:\n * - a **pill** β†’ selects that event, opening its details popover;\n * - the **\"+N\" chip** β†’ the hidden events' popover (list↔detail);\n * - the **day number** and the **cell background** β†’ `onDayClick`, which\n * under `Schedule`/`Schedule.Root` defaults to drilling into Days view on\n * that date (RFC Β§9's \"day-cell click navigates to Day view\").\n * The first two `stopPropagation`, so a chip click is never also a day click.\n */\nfunction MonthDayCell<P>({\n day,\n cellKey,\n visible,\n hidden,\n inMonth,\n disabled,\n today,\n dayNumber,\n isLastColumn,\n isLastRow,\n onDayClick,\n selected = [],\n ownsAnchor = false,\n onEventSelect,\n withEventDetails = true,\n renderEventDetails,\n onOverflowClick,\n withOverflowDetails,\n renderOverflowDetails,\n locale,\n timeZone,\n translations,\n classNames,\n}: MonthDayCellProps<P>) {\n // The disclosure hangs off the \"+N\" chip, not off a day click gated on\n // `onDayClick`'s absence. The two used to be mutually exclusive: wiring\n // `onDayClick` (to navigate, say) silently removed the only route to the\n // hidden events β€” the exact dead end the popover exists to close. So a day\n // click is navigation, unconditionally, and the disclosure belongs to the\n // affordance that announces there is something to disclose. Gated on\n // `hidden` alone: with nothing hidden, the visible pills (each with its own\n // details popover) already show everything.\n //\n // Everything else about it β€” open state, the list↔detail swap, the aria β€”\n // lives in `ScheduleOverflowPopover`, shared with the two Days surfaces.\n // This used to be a hand-rolled copy of all of it.\n\n const dayNumberClassName = cn(\n \"relative w-fit rounded-full px-1 text-xs\",\n inMonth && !disabled\n ? \"font-medium text-gray-light-900 dark:text-gray-dark-25\"\n : \"text-gray-light-400 dark:text-gray-dark-600\",\n // Same \"today\" convention `Calendar`/`DatePicker` already use\n // (`calendar-body.tsx`'s `dayCellTrigger`) β€” bold + brand accent,\n // no background/ring, so it stays a subtle, secondary signal next\n // to a day's own events. Skipped when `disabled`: an unavailable\n // day being \"today\" is still unavailable, and accenting it would\n // read as more clickable than it actually is.\n today && !disabled && \"font-semibold text-brand-500\",\n )\n\n // A `<button>` only when there is somewhere for it to go. A standalone\n // `MonthView` with no `onDayClick` has no view to drill into, and a\n // focusable control whose activation does nothing is worse for a keyboard\n // user than plain text β€” the same conditional-element shape `YearView`'s\n // own day cells already use for exactly this reason.\n const dayNumberSection = onDayClick ? (\n <button\n type=\"button\"\n data-schedule-part=\"month-day-number\"\n // `stopPropagation` so the cell's own background click-through below\n // doesn't double-fire the very same navigation.\n onClick={(e) => {\n e.stopPropagation()\n onDayClick(day)\n }}\n {...dataProps({ \"data-today\": today })}\n className={cn(\n dayNumberClassName,\n \"cursor-pointer hover:bg-black/5 dark:hover:bg-white/8\",\n focusStyles({ ring: \"brand\", offset: false }),\n )}\n >\n {dayNumber}\n </button>\n ) : (\n <span\n data-schedule-part=\"month-day-number\"\n {...dataProps({ \"data-today\": today })}\n className={dayNumberClassName}\n >\n {dayNumber}\n </span>\n )\n\n return (\n // biome-ignore lint/a11y/useKeyWithClickEvents lint/a11y/noStaticElementInteractions: mouse-only convenience click-through β€” the day-number button is the real keyboard-focusable trigger for the same action, so this outer cell is deliberately not itself a focusable/keyboard-operable control. Wired only when `onDayClick` is, so a view with nowhere to navigate has no phantom click target either.\n <div\n key={cellKey}\n {...dataProps({\n \"data-testid\": `day-${cellKey}`,\n \"data-disabled\": disabled,\n \"data-today\": today,\n })}\n onClick={onDayClick ? () => onDayClick(day) : undefined}\n className={cn(\n // `overflow-hidden` (+ `min-h-0`) is load-bearing, not\n // decorative: a grid item's automatic minimum height is its\n // own content size by default, so a day packed with pills\n // would otherwise refuse to shrink to its 1fr track's real\n // height and visually spill into the row below β€” breaking\n // every other row's alignment for the whole grid, not just\n // this one cell. `overflow-hidden` resets that automatic\n // minimum to 0 (it establishes a new formatting context),\n // which is what actually makes `maxEventsPerDay` + the \"+N\"\n // pill a real cap instead of just a lower bound.\n \"relative flex min-h-0 flex-col gap-0.5 overflow-hidden p-1\",\n onDayClick ? \"cursor-pointer\" : null,\n !isLastColumn ? \"border-e border-brand-900/20 dark:border-white/15\" : null,\n !isLastRow ? \"border-b border-brand-900/20 dark:border-white/15\" : null,\n disabled ? \"cursor-not-allowed\" : null,\n )}\n >\n {disabled ? <ScheduleDisabledOverlay className={classNames?.disabledOverlay} /> : null}\n {dayNumberSection}\n <div className=\"relative flex min-h-0 flex-1 flex-col gap-0.5\">\n {visible.map((event) => (\n <MonthEventPill\n key={event.id}\n event={event}\n {...chipSelection(selected, event.id, ownsAnchor)}\n onEventSelect={onEventSelect}\n withEventDetails={withEventDetails}\n renderEventDetails={renderEventDetails}\n locale={locale}\n timeZone={timeZone}\n detailsPopoverClassName={classNames?.eventDetailsPopover}\n />\n ))}\n {hidden.length > 0 ? (\n <ScheduleOverflowPopover\n events={hidden}\n date={day}\n source=\"month\"\n selectedId={ownsAnchor ? (selected[0] ?? null) : null}\n onEventSelect={onEventSelect}\n withEventDetails={withEventDetails}\n onOverflowClick={onOverflowClick}\n withOverflowDetails={withOverflowDetails}\n renderOverflowDetails={renderOverflowDetails}\n renderEventDetails={renderEventDetails}\n locale={locale}\n timeZone={timeZone}\n translations={translations}\n classNames={classNames?.overflow}\n renderTrigger={(triggerProps) => (\n <button\n type=\"button\"\n data-schedule-part=\"month-overflow-chip\"\n {...dataProps({ \"data-testid\": `overflow-${cellKey}` })}\n {...triggerProps}\n // Composed around the handler above, not in place of it: the\n // day cell has its own `onClick` for `onDayClick`, and\n // disclosing the hidden events must never also navigate.\n // Same `stopPropagation` `MonthEventPill` does.\n onClick={(e) => {\n e.stopPropagation()\n triggerProps.onClick?.(e)\n }}\n className={cn(\n // Deliberately the *same box* as `MonthEventPill` β€” `block\n // w-full`, `px-1 py-0.5`, `rounded-xs`, a 1px border β€” with\n // none of its paint: a full-width, pill-height hit target\n // that still reads as a caption rather than a fourth event.\n // `border-transparent` rather than an extra 1px of padding,\n // because the pill's border is what makes the two boxes\n // equal at *any* root font-size; faking it with\n // `py-[calc(0.125rem+1px)]` would fold that rem/px mixing\n // into a single value, which is precisely what\n // `monthRowMinHeight` keeps in a `calc()` instead.\n \"block w-full truncate rounded-xs border border-transparent px-1 py-0.5 text-start text-xs\",\n \"cursor-pointer text-gray-light-500 hover:underline dark:text-gray-dark-400\",\n // `palette`, matching both Days \"+N\" chips. None of the\n // three carries a `data-color`, so `--c-text` resolves the\n // same way for all of them; what matters is that one\n // affordance does not focus two different ways depending on\n // which view you are in. Flush (`offset: false`): the cell's\n // own `overflow-hidden` would clip an offset ring.\n focusStyles({ ring: \"palette\", offset: false }),\n )}\n >\n {`+${hidden.length}`}\n </button>\n )}\n />\n ) : null}\n </div>\n </div>\n )\n}\n\nexport function MonthView<P = unknown>({\n data,\n staticEvents = [],\n selected,\n defaultSelected,\n onSelect,\n withSelection = true,\n withEventDetails = true,\n onDayClick,\n renderEventDetails,\n onOverflowClick,\n withOverflowDetails,\n renderOverflowDetails,\n locale,\n timeZone = getLocalTimeZone(),\n translations,\n classNames,\n className,\n date,\n defaultDate,\n onDateChange,\n withPagination = true,\n withNowButton = false,\n startOfWeek,\n now,\n dayDisabled,\n maxEventsPerDay = 3,\n testId,\n ...rest\n}: MonthViewProps<P>) {\n const [currentDate, setCurrentDate] = useUncontrolled<Date>({\n value: date,\n defaultValue: defaultDate,\n finalValue: new Date(),\n onChange: onDateChange,\n })\n const { selected: selectedIds, onEventSelect } = useScheduleSelection<P>({\n selected,\n defaultSelected,\n onSelect,\n withSelection,\n })\n const t = resolveScheduleTranslations(translations)\n const todayRef = now ?? new Date()\n const range = getVisibleRange(\"month\", currentDate, {\n timeZone,\n locale: locale ?? \"en-US\",\n startOfWeek,\n })\n const days = enumerateDays(range, timeZone)\n const weeks = days.length / 7\n const weekdayLabels = days\n .slice(0, 7)\n .map((d) => new Intl.DateTimeFormat(locale, { weekday: \"short\", timeZone }).format(d))\n const allEvents: ScheduleAnyEvent<P>[] = [...data, ...staticEvents]\n // A multi-day event has a pill (or a \"+N\" row) in every cell it touches, all\n // sharing its id; exactly one of them may open the details popover.\n const anchorEvent = allEvents.find((event) => event.id === selectedIds[0])\n const anchorPiece = usePieceAnchor(\n anchorEvent?.id ?? null,\n anchorEvent\n ? days\n .filter((day) => eventOccursOnDay(anchorEvent, day, timeZone))\n .map((day) => dayKey(day, timeZone))\n : [],\n )\n const rowMinHeight = monthRowMinHeight(maxEventsPerDay)\n // The grid is the month's scroller, and every popover in it portals *into*\n // it (see `OverlayContainerProvider`) so a panel scrolls with the weeks and\n // is clipped by them instead of floating over the page.\n const gridRef = useRef<HTMLDivElement>(null)\n\n return (\n <ark.div\n className={cn(\"flex h-full flex-col\", className)}\n data-schedule-part=\"month-view\"\n {...dataProps({ \"data-testid\": testId })}\n {...rest}\n >\n {withPagination || withNowButton ? (\n <div className=\"mb-2 flex items-center gap-1\">\n {withPagination ? (\n <>\n <ScheduleToolbar.PrevTrigger\n view=\"month\"\n date={currentDate}\n onDateChange={setCurrentDate}\n timeZone={timeZone}\n translations={t}\n />\n <ScheduleToolbar.NextTrigger\n view=\"month\"\n date={currentDate}\n onDateChange={setCurrentDate}\n timeZone={timeZone}\n translations={t}\n />\n </>\n ) : null}\n {withNowButton ? (\n <ScheduleToolbar.NowTrigger\n onDateChange={setCurrentDate}\n translations={t}\n className=\"ms-2\"\n />\n ) : null}\n </div>\n ) : null}\n <div\n ref={gridRef}\n className={cn(\n // `relative`: the containing block for the popovers portalled in\n // here β€” without it they resolve against an ancestor outside this\n // scroller and neither scroll with it nor get clipped by it.\n //\n // `overflow-y-auto`: if a consumer's container is shorter than\n // `weeks * rowMinHeight` genuinely needs, the calendar scrolls\n // internally instead of either clipping pills (the cells' own\n // `overflow-hidden` would otherwise do that) or silently\n // overflowing whatever comes after it on the page.\n //\n // No border on this container itself β€” only the internal `border-e`/\n // `border-b` dividers below (each one skipped on the grid's own last\n // column/row) organize the cells. A full perimeter here would nest a\n // second bordered box directly inside whatever already-bordered\n // surface a consumer wraps the view in (e.g. this doc's own preview\n // card), reading as a redundant \"double border\".\n \"relative grid min-h-0 flex-1 grid-cols-7 overflow-y-auto\",\n classNames?.grid,\n )}\n style={{ gridTemplateRows: `auto repeat(${weeks}, minmax(${rowMinHeight}, 1fr))` }}\n >\n <OverlayContainerProvider value={gridRef}>\n {weekdayLabels.map((label, i) => (\n <div\n key={label}\n className={cn(\n \"border-b border-brand-900/20 bg-brand-50/90 px-1.5 py-1 text-center font-medium text-gray-light-500 text-xs dark:border-white/15 dark:bg-brand-950/85 dark:text-gray-dark-400\",\n i % 7 !== 6 ? \"border-e border-brand-900/20 dark:border-white/15\" : null,\n )}\n >\n {label}\n </div>\n ))}\n {days.map((day, i) => {\n const isLastColumn = i % 7 === 6\n const isLastRow = i >= days.length - 7\n const inMonth = isSameMonth(day, currentDate, timeZone)\n const today = isToday(day, todayRef, timeZone)\n const dayEvents = allEvents\n .filter((event) => eventOccursOnDay(event, day, timeZone))\n .sort((a, b) => a.start.getTime() - b.start.getTime())\n const visible = dayEvents.slice(0, maxEventsPerDay)\n // The hidden tail itself, not just its length: the \"+N\" counts it\n // and its disclosure lists it, which is the same rule the two Days\n // surfaces already follow.\n const hidden = dayEvents.slice(maxEventsPerDay)\n const disabled = dayDisabled?.(day, timeZone) ?? false\n const cellKey = dayKey(day, timeZone)\n const dayNumber = new Intl.DateTimeFormat(locale, { day: \"numeric\", timeZone }).format(\n day,\n )\n\n return (\n <MonthDayCell\n key={cellKey}\n day={day}\n cellKey={cellKey}\n visible={visible}\n hidden={hidden}\n inMonth={inMonth}\n disabled={disabled}\n today={today}\n dayNumber={dayNumber}\n isLastColumn={isLastColumn}\n isLastRow={isLastRow}\n onDayClick={onDayClick}\n selected={selectedIds}\n ownsAnchor={anchorPiece.key === cellKey}\n onEventSelect={\n onEventSelect &&\n ((event: ScheduleAnyEvent<P> | null) => {\n anchorPiece.press(cellKey, event)\n onEventSelect(event)\n })\n }\n withEventDetails={withEventDetails}\n renderEventDetails={renderEventDetails}\n onOverflowClick={onOverflowClick}\n withOverflowDetails={withOverflowDetails}\n renderOverflowDetails={renderOverflowDetails}\n locale={locale}\n timeZone={timeZone}\n translations={t}\n classNames={classNames}\n />\n )\n })}\n </OverlayContainerProvider>\n </div>\n </ark.div>\n )\n}\n","\"use client\"\n\nimport { ark, type HTMLArkProps } from \"@ark-ui/react\"\nimport { getLocalTimeZone } from \"@internationalized/date\"\nimport { cn } from \"../../lib/cn\"\nimport { focusStyles } from \"../../lib/focus-styles\"\nimport { props as dataProps } from \"../../lib/props\"\nimport type { WithTestId } from \"../../lib/test-id\"\nimport { useUncontrolled } from \"../../lib/use-uncontrolled\"\nimport {\n dayKey,\n enumerateDays,\n enumerateMonths,\n eventOccursOnDay,\n getVisibleRange,\n isToday,\n} from \"./schedule-dates\"\nimport { ScheduleToolbar } from \"./schedule-toolbar\"\nimport type {\n AnchorDateProps,\n PaginationChromeProps,\n ScheduleDayClickProps,\n ScheduleDayDisabledProps,\n ScheduleSharedProps,\n} from \"./schedule-types\"\nimport { resolveScheduleTranslations } from \"./schedule-types\"\n\n/**\n * RFC Β§10 (`docs/rfcs/schedule.md`) β€” the year overview: 12 mini-months, no\n * per-event rendering, ever. A day shows a neutral dot for exactly one\n * event, a capped numeral (\"9+\") for more, and nothing for zero β€” mixing up\n * to 9 event colors into ~2px dots at this cell size would read as\n * noise, not signal. Disabled days get a muted day-number only (Month's\n * diagonal-stripe overlay is illegible at mini-month scale).\n *\n * Each mini-month renders only its own real days β€” adjacent-month padding\n * is blank cells (no number, no dot), not `MonthView`'s dimmed-but-real\n * adjacent days, since duplicating a day's dot across two neighboring\n * mini-months (the seam) would be genuinely confusing at a glance.\n *\n * `repeat(4, 1fr)` is the RFC's specified desktop shape; a fixed 4-column\n * grid of 12 mini-calendars is illegible on a narrow viewport, and nothing\n * in the RFC forbids stepping that down responsively, so this falls back to\n * fewer columns below `sm`/`lg`.\n */\n// Year renders density dots and counts, never an event chip β€” so it simply\n// does not take `ScheduleEventProps`: there is nothing here to select, nothing\n// to open a details popover on, and therefore no `HTMLArkProps` `onSelect`\n// collision to `Omit` either. It used to subtract those six names off\n// `ScheduleSharedProps` one at a time, which was the same statement in a form\n// that could drift from the slice it was tracking.\nexport type YearViewProps<P = unknown> = ScheduleSharedProps<P> &\n ScheduleDayClickProps &\n ScheduleDayDisabledProps &\n AnchorDateProps &\n PaginationChromeProps &\n HTMLArkProps<\"div\"> &\n WithTestId &\n ScheduleYearOnlyProps\n\n/** Year only. Named so `ScheduleProps` can gate it by name rather than\n * `Pick`ing the key out of `YearViewProps` β€” the hand-maintained shape that\n * left `maxEventsPerDay` unreachable from `Root` for two releases. */\nexport type ScheduleYearOnlyProps = {\n /**\n * Mini-month header click, with that month's own start instant β€” the\n * month-granularity twin of `onDayClick`, and gated by presence the same\n * way: absent, the header is inert text and isn't focusable; present, it\n * becomes a real button. RFC Β§10 calls this out as the sanctioned\n * drill-down, and `Schedule`/`Schedule.Root` defaults it to switching to\n * Month view for that month.\n */\n onMonthClick?: (date: Date) => void\n}\n\nconst eventCountLabel = (template: string, count: number) =>\n template.replace(\"{count}\", String(count))\n\nexport function YearView<P = unknown>({\n data,\n staticEvents = [],\n onDayClick,\n onMonthClick,\n locale,\n timeZone = getLocalTimeZone(),\n translations,\n classNames,\n className,\n date,\n defaultDate,\n onDateChange,\n withPagination = true,\n withNowButton = false,\n now,\n dayDisabled,\n testId,\n ...rest\n}: YearViewProps<P>) {\n const [currentDate, setCurrentDate] = useUncontrolled<Date>({\n value: date,\n defaultValue: defaultDate,\n finalValue: new Date(),\n onChange: onDateChange,\n })\n const t = resolveScheduleTranslations(translations)\n const todayRef = now ?? new Date()\n const yearRange = getVisibleRange(\"year\", currentDate, { timeZone, locale: locale ?? \"en-US\" })\n const monthStarts = enumerateMonths(yearRange, timeZone)\n const allEvents = [...data, ...staticEvents]\n\n return (\n <ark.div\n className={cn(\"flex h-full flex-col\", className)}\n data-schedule-part=\"year-view\"\n {...dataProps({ \"data-testid\": testId })}\n {...rest}\n >\n {withPagination || withNowButton ? (\n <div className=\"mb-2 flex items-center gap-1\">\n {withPagination ? (\n <>\n <ScheduleToolbar.PrevTrigger\n view=\"year\"\n date={currentDate}\n onDateChange={setCurrentDate}\n timeZone={timeZone}\n translations={t}\n />\n <ScheduleToolbar.NextTrigger\n view=\"year\"\n date={currentDate}\n onDateChange={setCurrentDate}\n timeZone={timeZone}\n translations={t}\n />\n </>\n ) : null}\n {withNowButton ? (\n <ScheduleToolbar.NowTrigger\n onDateChange={setCurrentDate}\n translations={t}\n className=\"ms-2\"\n />\n ) : null}\n </div>\n ) : null}\n <div\n className={cn(\n \"grid min-h-0 flex-1 auto-rows-min grid-cols-2 gap-4 overflow-auto sm:grid-cols-3 lg:grid-cols-4 p-4\",\n classNames?.grid,\n )}\n >\n {monthStarts.map((monthStart) => {\n const monthGrid = getVisibleRange(\"month\", monthStart, {\n timeZone,\n locale: locale ?? \"en-US\",\n })\n const nextMonthStart = monthStarts.find((m) => m.getTime() > monthStart.getTime())\n const monthEnd = nextMonthStart ?? yearRange.end\n const daysInMonth = enumerateDays({ start: monthStart, end: monthEnd }, timeZone)\n const leadingBlanks = enumerateDays(\n { start: monthGrid.start, end: monthStart },\n timeZone,\n ).length\n const trailingBlanks = (7 - ((leadingBlanks + daysInMonth.length) % 7)) % 7\n const monthName = new Intl.DateTimeFormat(locale, { month: \"long\", timeZone }).format(\n monthStart,\n )\n // A stable, locale-independent key/test hook β€” `monthName` alone is\n // the *localized* label, which is neither guaranteed unique (some\n // locales abbreviate two months the same way) nor stable across a\n // `locale` change.\n const monthKey = dayKey(monthStart, timeZone).slice(0, 7)\n // Hoisted so the two branches below can't drift apart visually;\n // only the interactive affordances differ between them.\n const monthLabelClassName =\n \"text-center font-medium text-gray-light-700 text-xs dark:text-gray-dark-300\"\n\n return (\n <div key={monthKey} className=\"flex flex-col gap-1\">\n {onMonthClick ? (\n <button\n type=\"button\"\n data-schedule-part=\"year-month-header\"\n {...dataProps({ \"data-testid\": `month-${monthKey}` })}\n onClick={() => onMonthClick(monthStart)}\n className={cn(\n monthLabelClassName,\n \"cursor-pointer rounded-xs hover:bg-black/5 dark:hover:bg-white/8\",\n focusStyles({ ring: \"brand\" }),\n )}\n >\n {monthName}\n </button>\n ) : (\n // Same reasoning as the day cells right below: with no\n // handler there is nothing to activate, so this stays plain\n // text rather than a focusable control that does nothing.\n <p data-schedule-part=\"year-month-header\" className={monthLabelClassName}>\n {monthName}\n </p>\n )}\n <div className=\"grid grid-cols-7 gap-px\">\n {Array.from({ length: leadingBlanks }, (_, i) => (\n // biome-ignore lint/suspicious/noArrayIndexKey: fixed-length blank padding, never reordered.\n <div key={i} />\n ))}\n {daysInMonth.map((day) => {\n const count = allEvents.filter((event) =>\n eventOccursOnDay(event, day, timeZone),\n ).length\n const disabled = dayDisabled?.(day, timeZone) ?? false\n const today = isToday(day, todayRef, timeZone)\n const dayNumber = new Intl.DateTimeFormat(locale, {\n day: \"numeric\",\n timeZone,\n }).format(day)\n const fullLabel = new Intl.DateTimeFormat(locale, {\n dateStyle: \"long\",\n timeZone,\n }).format(day)\n const label =\n count > 0 ? `${fullLabel}, ${eventCountLabel(t.eventCount, count)}` : fullLabel\n const key = dayKey(day, timeZone)\n const cellClassName = cn(\n \"flex aspect-square flex-col items-center justify-center gap-px rounded-xs text-[10px] leading-none\",\n disabled\n ? \"text-gray-light-300 dark:text-gray-dark-700\"\n : \"text-gray-light-700 dark:text-gray-dark-300\",\n )\n const indicator =\n count === 1 ? (\n <span key={`${key}-dot`} className=\"size-1 rounded-full bg-current\" />\n ) : count > 1 ? (\n <span key={`${key}-count`} className=\"text-[8px]\">\n {count > 9 ? \"9+\" : count}\n </span>\n ) : null\n // Scoped to just the day-number, not `cellClassName` β€” the\n // event-count indicator above stays neutral even on\n // today's own cell (RFC Β§10: \"kept neutral rather than\n // palette-colored\"), same \"today\" convention `Calendar`/\n // `DatePicker` already use (`calendar-body.tsx`'s\n // `dayCellTrigger`). Skipped when `disabled` for the same\n // reason `MonthView`'s own day-number skips it.\n const dayNumberSpan = (\n <span\n key={`${key}-number`}\n className={cn(today && !disabled && \"font-semibold text-brand-500\")}\n >\n {dayNumber}\n </span>\n )\n\n return onDayClick ? (\n <button\n key={key}\n type=\"button\"\n onClick={() => onDayClick(day)}\n aria-label={label}\n {...dataProps({\n \"data-testid\": `day-${key}`,\n \"data-disabled\": disabled,\n \"data-today\": today,\n })}\n className={cn(\n cellClassName,\n \"cursor-pointer hover:bg-black/5 dark:hover:bg-white/8\",\n focusStyles({ ring: \"brand\", offset: false }),\n )}\n >\n {dayNumberSpan}\n {indicator}\n </button>\n ) : (\n // No `onDayClick`: a plain, non-interactive cell. No `aria-label`\n // either β€” a generic `<div>`'s implicit role doesn't support one,\n // and the visible day-number/indicator text is already exposed to\n // assistive tech via normal document flow.\n <div\n key={key}\n {...dataProps({\n \"data-testid\": `day-${key}`,\n \"data-disabled\": disabled,\n \"data-today\": today,\n })}\n className={cellClassName}\n >\n {dayNumberSpan}\n {indicator}\n </div>\n )\n })}\n {Array.from({ length: trailingBlanks }, (_, i) => (\n // biome-ignore lint/suspicious/noArrayIndexKey: fixed-length blank padding, never reordered.\n <div key={i} />\n ))}\n </div>\n </div>\n )\n })}\n </div>\n </ark.div>\n )\n}\n","\"use client\"\n\nimport { ark, type HTMLArkProps } from \"@ark-ui/react\"\nimport { getLocalTimeZone } from \"@internationalized/date\"\nimport { type ReactNode, useEffect, useRef } from \"react\"\nimport { match } from \"ts-pattern\"\nimport type { AvailableIf, UnavailableProps } from \"../../lib/available-if\"\nimport { cn } from \"../../lib/cn\"\nimport { devWarn } from \"../../lib/dev-warn\"\nimport { props } from \"../../lib/props\"\nimport type { WithTestId } from \"../../lib/test-id\"\nimport { useUncontrolled } from \"../../lib/use-uncontrolled\"\nimport { AgendaView, type ScheduleAgendaOnlyProps } from \"./schedule-agenda-view\"\nimport { dayKey, isEventInVisibleRange, resolveWeekStartDay } from \"./schedule-dates\"\nimport { DaysViewBody } from \"./schedule-days-view\"\nimport { isElementInScrollViewport, scrollElementToCenter } from \"./schedule-geometry\"\nimport { liveChipsFor, liveDayColumnFor } from \"./schedule-grid-gesture\"\nimport { MonthView, type ScheduleMonthOnlyProps } from \"./schedule-month-view\"\nimport { ScheduleToolbar } from \"./schedule-toolbar\"\nimport type {\n AnchorDateProps,\n EditableCallbacks,\n FirstDayOfWeek,\n ScheduleAlign,\n ScheduleDayClickProps,\n ScheduleDayDisabledProps,\n ScheduleEditGesture,\n ScheduleEmptyProps,\n ScheduleEventProps,\n ScheduleOverflowProps,\n ScheduleSharedProps,\n ScheduleSlotProps,\n ScheduleSlotValues,\n ScheduleTimedProps,\n ScheduleView,\n} from \"./schedule-types\"\nimport { resolveScheduleTranslations } from \"./schedule-types\"\nimport type {\n DefaultScheduleViews,\n ResolvedScheduleView,\n ScheduleRenderers,\n ScheduleViewId,\n ScheduleViews,\n} from \"./schedule-views\"\nimport {\n findScheduleView,\n findScheduleViewByRenderer,\n resolveScheduleViews,\n} from \"./schedule-views\"\nimport { type ScheduleYearOnlyProps, YearView } from \"./schedule-year-view\"\nimport { useScheduleSelection } from \"./use-schedule-selection\"\n\n/** Only reachable via `views={[]}`, which `devWarn` flags. Rendering the\n * historical default beats rendering nothing at all. */\nconst FALLBACK_VIEW: ResolvedScheduleView = { id: \"days\", view: \"days\" }\n\n/**\n * Which renderers can act on each view-scoped prop β€” the runtime twin of\n * `ScheduleProps`' `AvailableIf` gates, and the only check that reaches the\n * case the compile layer deliberately gives up on: a `views` array built at\n * runtime, where `ScheduleRenderers` widens to every renderer so that working\n * code keeps compiling.\n *\n * `satisfies` keys it against the real prop names, so renaming a prop without\n * updating this table is a compile error rather than a warning that quietly\n * stops firing. Props every renderer reads are deliberately absent.\n */\nconst PROP_RENDERERS = {\n onDayClick: [\"days\", \"month\", \"year\"],\n selected: [\"days\", \"month\", \"agenda\"],\n defaultSelected: [\"days\", \"month\", \"agenda\"],\n onSelect: [\"days\", \"month\", \"agenda\"],\n withSelection: [\"days\", \"month\", \"agenda\"],\n withEventDetails: [\"days\", \"month\", \"agenda\"],\n renderEventDetails: [\"days\", \"month\", \"agenda\"],\n empty: [\"days\", \"agenda\"],\n align: [\"days\", \"month\"],\n startHour: [\"days\"],\n endHour: [\"days\"],\n slotDuration: [\"days\"],\n minDuration: [\"days\"],\n resizeCollision: [\"days\"],\n maxDuration: [\"days\"],\n hourHeight: [\"days\"],\n slotDisabled: [\"days\"],\n withNowIndicator: [\"days\"],\n onGridClick: [\"days\"],\n preventOverlap: [\"days\"],\n maxOverlapColumns: [\"days\"],\n maxAllDayRows: [\"days\"],\n onOverflowClick: [\"days\", \"month\"],\n withOverflowDetails: [\"days\", \"month\"],\n renderOverflowDetails: [\"days\", \"month\"],\n visibleDays: [\"days\"],\n revealBehavior: [\"days\"],\n editable: [\"days\"],\n onEventChange: [\"days\"],\n onEventRemove: [\"days\"],\n onEventCreate: [\"days\"],\n maxEventsPerDay: [\"month\"],\n dayDisabled: [\"month\", \"year\"],\n onMonthClick: [\"year\"],\n renderEvent: [\"agenda\"],\n} as const satisfies Partial<Record<keyof ScheduleAllProps, readonly ScheduleView[]>>\n\nconst SCOPED_PROP_NAMES = Object.keys(PROP_RENDERERS) as (keyof typeof PROP_RENDERERS)[]\n\n/** English list: \"a\", \"a and b\", \"a, b and c\". */\nconst listPhrase = (items: string[]) =>\n items.length < 2 ? (items[0] ?? \"\") : `${items.slice(0, -1).join(\", \")} and ${items.at(-1)}`\n\n/**\n * What the reveal effect is currently armed to bring into view. One slot, two\n * kinds: a selected event (its date axis, then both scroll axes onto its\n * chip), or a day that was navigated to (the inline axis only β€” a day column\n * is the full height of the timed row, so the block axis has no meaningful\n * \"already visible\" state, and moving it would throw away whatever time of day\n * the reader was looking at).\n */\ntype ScheduleReveal = { kind: \"event\"; id: string } | { kind: \"day\"; date: Date }\n\n/**\n * RFC Β§1/Β§3 (`docs/rfcs/schedule.md`) β€” `Schedule` (`Root`): orchestrates\n * view-switching and the shared anchor date via `Schedule.Toolbar`,\n * delegating all rendering to whichever view is active\n * (`ts-pattern match(view).exhaustive()`). Composed by intersection from the\n * views' own prop slices, never a context provider β€” the same \"share\n * via a superset type, not context\" mechanism the RFC establishes\n * throughout. Passes `withPagination={false} withNowButton={false}` to\n * whichever view it renders, since `Root`'s own toolbar already covers both\n * β€” a standalone view keeps its own built-in chrome exactly as before.\n *\n * `Editable` (inferred from a literal `editable` at the call site β€” see\n * `EditableCallbacks`) makes a granted gesture's matching callback a compile\n * error to omit, on top of the existing dev-mode runtime warning\n * (`ScheduleTimedProps.editable`'s own doc comment). `Root`-only: the\n * standalone `DaysView`/`DayView`/`WeekView` don't get this generic, for the\n * reason `EditableCallbacks` explains.\n */\n/**\n * Is any renderer in `R` among the ones `V` actually puts on screen?\n *\n * Three distribution decisions, each load-bearing and each proved against the\n * repo's own tsc before this shipped:\n *\n * - `Extract<R, …>` **distributes over `R`**, which is what makes this \"any\n * of\" rather than \"all of\". `[R] extends [ScheduleRenderers<V>]` reads as\n * ALL of `R` and would forbid `dayDisabled` under `views={[\"days\",\"month\"]}`\n * β€” Month is rendering, so it is plainly legal there.\n * - `[…] extends [never]` **must** be tuple-wrapped. A naked\n * `Active extends never` distributes, `never` in gives `never` out, and\n * `X & never` is `never` β€” collapsing the whole props type so that every\n * attribute errors, including the ones the caller got right.\n * - `ScheduleRenderers<V>` must itself stay distributive; see its own note.\n */\ntype HasRenderer<V extends ScheduleViews, R extends ScheduleView> = [\n Extract<R, ScheduleRenderers<V>>,\n] extends [never]\n ? false\n : true\n\n/** `align`'s type narrows with `V` as well as its availability: `\"relative\"`\n * is a rolling *days* window, and `MonthView` has no use for one β€”\n * `resolveWeekStartDay` drops it on the floor. With `views={[\"month\"]}`,\n * `align=\"relative\"` is therefore a compile error rather than a silent\n * no-op, which is the one silent drop that lives inside a prop's value\n * rather than in the prop itself. */\ntype ScheduleAlignFor<V extends ScheduleViews> =\n HasRenderer<V, \"days\"> extends true ? ScheduleAlign : FirstDayOfWeek\n\n/**\n * RFC Β§1/Β§3 (`docs/rfcs/schedule.md`) β€” `Schedule` (`Root`): orchestrates\n * view-switching and the shared anchor date via `Schedule.Toolbar`,\n * delegating all rendering to whichever view is active\n * (`ts-pattern match(view).exhaustive()`). Composed by intersection from the\n * views' own prop slices, never a context provider β€” the same \"share via a\n * superset type, not context\" mechanism the RFC establishes throughout.\n * Passes `withPagination={false} withNowButton={false}` to whichever view it\n * renders, since `Root`'s own toolbar already covers both β€” a standalone view\n * keeps its own built-in chrome exactly as before.\n *\n * **Each slice is gated on `views` actually configuring a renderer that reads\n * it** (`lib/available-if.ts`). `<Schedule views={[\"month\",\"year\"]}\n * slotDuration={30} />` used to typecheck and do nothing; it is now a compile\n * error that says which renderer it wanted. The RFC already claimed this\n * invariant β€” \"structurally absent elsewhere, enforcing the view restriction\n * at the type level\" β€” and it held for every view *except* `Root`, which\n * intersected the days slice unconditionally.\n *\n * Omitting `views` leaves `V` at `DefaultScheduleViews`, which configures\n * days, month and year, so the default call site keeps every prop it had.\n * Anything `views` cannot be resolved to β€” a `ScheduleViewOption[]` variable,\n * a ternary between two tuples β€” widens to every renderer and likewise\n * changes nothing; see `ScheduleRenderers`.\n *\n * `Editable` (inferred from a literal `editable` at the call site β€” see\n * `EditableCallbacks`) makes a granted gesture's matching callback a compile\n * error to omit, on top of the existing dev-mode runtime warning\n * (`ScheduleTimedProps.editable`'s own doc comment). `Root`-only: the\n * standalone `DaysView`/`DayView`/`WeekView` don't get this generic, for the\n * reason `EditableCallbacks` explains.\n */\nexport type ScheduleProps<\n P = unknown,\n Editable extends boolean | readonly ScheduleEditGesture[] = false,\n V extends ScheduleViews = DefaultScheduleViews,\n> = ScheduleSharedProps<P> &\n AnchorDateProps &\n // `ScheduleEventProps` contributes `onSelect`, and React's own DOM props\n // carry an `onSelect` (text-selection) of their own. Without this `Omit` the\n // two intersect into a handler that has to satisfy *both* signatures, so the\n // declaration compiles and every call site fails. The kit already uses this\n // treatment for other redefined natives.\n Omit<HTMLArkProps<\"div\">, \"onSelect\"> &\n WithTestId &\n // ─── days Β· month Β· year ───────────────────────────────────────────────\n AvailableIf<\n HasRenderer<V, \"days\" | \"month\" | \"year\">,\n ScheduleDayClickProps,\n \"requires a days, month or year renderer in `views` β€” an agenda has no day to click\"\n > &\n // ─── days Β· month Β· agenda ─────────────────────────────────────────────\n AvailableIf<\n HasRenderer<V, \"days\" | \"month\" | \"agenda\">,\n ScheduleEventProps<P>,\n \"requires a days, month or agenda renderer in `views` β€” year draws density dots, never an event to select\"\n > &\n // ─── days Β· agenda ─────────────────────────────────────────────────────\n AvailableIf<\n HasRenderer<V, \"days\" | \"agenda\">,\n ScheduleEmptyProps,\n \"requires a days or agenda renderer in `views` β€” month and year always draw a calendar, so they have no empty state\"\n > &\n // ─── days Β· month ──────────────────────────────────────────────────────\n AvailableIf<\n HasRenderer<V, \"days\" | \"month\">,\n ScheduleOverflowProps<P>,\n 'requires a days or month renderer in `views` β€” year and agenda cap nothing, so they have no \"+N\" to disclose'\n > &\n AvailableIf<\n HasRenderer<V, \"days\" | \"month\">,\n {\n /**\n * Locale default when omitted; `\"relative\"` starts the days-window at\n * the anchor date itself instead of snapping to a calendar-week\n * boundary. Named `align`, not `startOfWeek` β€” this same value also\n * governs Month's window, and Root's own days-window isn't necessarily\n * a week (`visibleDays` can be anything), so a literal \"start of week\"\n * name would mislead here. Declared on `Root` rather than reused from\n * `MonthViewProps.startOfWeek`, which is both narrower and differently\n * named; it is narrowed via `resolveWeekStartDay` when forwarded to\n * `MonthView` below.\n *\n * Its **type** follows `views` as well as its availability:\n * `\"relative\"` is a rolling days window, so with no days renderer\n * configured this is `FirstDayOfWeek` and `align=\"relative\"` is a\n * compile error rather than a silent no-op β€” see `ScheduleAlignFor`.\n */\n align?: ScheduleAlignFor<V>\n },\n \"requires a days or month renderer in `views`\"\n > &\n // ─── days ──────────────────────────────────────────────────────────────\n AvailableIf<\n HasRenderer<V, \"days\">,\n Omit<\n ScheduleTimedProps<P>,\n \"editable\" | \"onEventChange\" | \"onEventRemove\" | \"onEventCreate\"\n > & {\n /** Fallback window size, in days, for the `\"days\"` renderer. Default `7`.\n * An active entry that pins its own `visibleDays` (`\"day\"` and `\"week\"`\n * do) overrides this; `\"days\"` deliberately does not, so this prop keeps\n * working exactly as before under the default entries. */\n visibleDays?: number\n /**\n * How a **reveal** scrolls the days grid β€” the day brought into view by\n * navigating to it, and the chip brought into view by selecting it.\n * Default `\"auto\"`, i.e. no animation.\n *\n * Replaces the former `scrollBehavior`, which borrowed the name of a CSS\n * property whose job it does not do β€” it never governed the Now button\n * (which always animates) nor a page turn (CSS keyframes), only reveals.\n *\n * A reveal is a side effect of going somewhere, not a gesture of its own,\n * and an animated one reads as the grid drifting rather than as feedback\n * β€” so it is opt-in, unlike the Now button, whose scroll answers a press\n * and keeps animating. `\"auto\"` defers to the platform (and to any CSS\n * `scroll-behavior` you have set, which is the right way to turn this on\n * globally); `\"instant\"` refuses to animate whatever the CSS says.\n *\n * `\"smooth\"` still yields to `prefers-reduced-motion` β€” this can ask for\n * motion, it cannot override someone asking for none.\n */\n revealBehavior?: ScrollBehavior\n },\n \"requires a days renderer in `views` β€” only a timed grid has hours, slots and gestures\"\n > &\n // Its own gate, not part of the slice above: `ScheduleSlotProps` is a union\n // keyed on `slotDuration`, which that slice's `Omit` would collapse.\n // `AvailableIf` maps over it member by member, so the union survives.\n AvailableIf<\n HasRenderer<V, \"days\">,\n ScheduleSlotProps,\n \"requires a days renderer in `views` β€” only a timed grid has slots\"\n > &\n // `editable` and its three callbacks are gated **as one unit**, and the\n // forbidden branch deliberately drops `EditableCallbacks` rather than\n // keeping it alongside a forbidden `editable`. `RequiredIfGranted` can make\n // `onEventChange` *required*, and a required property intersected with a\n // forbid-shape reduces the entire props object to `never` β€” at which point\n // every attribute errors, `data` included. Splitting them is the trap.\n (HasRenderer<V, \"days\"> extends true\n ? { editable?: Editable } & EditableCallbacks<P, Editable>\n : UnavailableProps<\n Record<\"editable\" | \"onEventChange\" | \"onEventRemove\" | \"onEventCreate\", unknown>,\n \"requires a days renderer in `views` β€” only a timed grid has gestures to permit\"\n >) &\n // ─── month ─────────────────────────────────────────────────────────────\n AvailableIf<\n HasRenderer<V, \"month\">,\n ScheduleMonthOnlyProps,\n \"requires a month renderer in `views`\"\n > &\n // ─── month Β· year ──────────────────────────────────────────────────────\n AvailableIf<\n HasRenderer<V, \"month\" | \"year\">,\n ScheduleDayDisabledProps,\n \"requires a month or year renderer in `views` β€” the days grid restricts by time range, via `slotDisabled`\"\n > &\n // ─── year ──────────────────────────────────────────────────────────────\n AvailableIf<\n HasRenderer<V, \"year\">,\n ScheduleYearOnlyProps,\n \"requires a year renderer in `views`\"\n > &\n // ─── agenda ────────────────────────────────────────────────────────────\n AvailableIf<\n HasRenderer<V, \"agenda\">,\n ScheduleAgendaOnlyProps<P>,\n \"requires an agenda renderer in `views` β€” note the default `views` does not include one\"\n > & {\n /**\n * Which entries the view switcher offers, in order. Default\n * `[\"days\", \"month\", \"year\"]` β€” exactly the pre-`views` behaviour.\n *\n * Entries are `\"day\"`/`\"week\"`/`\"days\"`/`\"month\"`/`\"year\"` shorthands or\n * `{ id, view, visibleDays, label }` objects; see `schedule-views.ts` for\n * the id-vs-renderer distinction. `Schedule` is generic over this array,\n * so `view`/`defaultView`/`onViewChange` below carry the exact union of\n * ids you pass β€” hoist it with `as const` to keep that narrowing.\n */\n views?: V\n /** The active entry's **id**. Note an entry's own `view` field names its\n * *renderer*; these three props carry the *identity*. They coincide under\n * the default entries. */\n view?: ScheduleViewId<V>\n defaultView?: ScheduleViewId<V>\n onViewChange?: (view: ScheduleViewId<V>) => void\n /** Default `true` β€” the standalone-view default is `false`, since a bare\n * `DaysView`/... has no toolbar row of its own to put it in unless\n * `withPagination` is also on; `Root` always has one. */\n withNowButton?: boolean\n /** Fallback window size, in days, for the `\"days\"` renderer. Default `7`.\n * An active entry that pins its own `visibleDays` (`\"day\"` and `\"week\"`\n * do) overrides this; `\"days\"` deliberately does not, so this prop keeps\n * working exactly as before under the default entries. */\n }\n\n/**\n * Every prop, flat and fully optional β€” what the implementation destructures.\n *\n * `ScheduleProps` is a pile of conditionals in `V`, and inside the body `V` is\n * an unresolved type parameter, so none of them can be evaluated to find a\n * property. The public overload above keeps the gating; this is what the\n * function actually sees. Internal, and deliberately not exported from the\n * barrel.\n */\ntype ScheduleAllProps<P = unknown> = ScheduleSharedProps<P> &\n ScheduleEventProps<P> &\n ScheduleDayClickProps &\n ScheduleEmptyProps &\n ScheduleOverflowProps<P> &\n ScheduleTimedProps<P> &\n ScheduleSlotValues &\n ScheduleDayDisabledProps &\n ScheduleMonthOnlyProps &\n ScheduleYearOnlyProps &\n ScheduleAgendaOnlyProps<P> &\n AnchorDateProps &\n Omit<HTMLArkProps<\"div\">, \"onSelect\"> &\n WithTestId & {\n views?: ScheduleViews\n view?: string\n defaultView?: string\n onViewChange?: (view: string) => void\n withNowButton?: boolean\n visibleDays?: number\n align?: ScheduleAlign\n revealBehavior?: ScrollBehavior\n }\n\n/**\n * The public, view-gated signature. `const Editable`/`const V` are what let a\n * call site's own literals narrow β€” an inline `views={[\"month\",\"year\"]}` in\n * JSX narrows `V` with no `as const` needed (a *hoisted* variable still does;\n * see the docs page).\n */\nexport function ScheduleRoot<\n P = unknown,\n const Editable extends boolean | readonly ScheduleEditGesture[] = false,\n const V extends ScheduleViews = DefaultScheduleViews,\n>(props: ScheduleProps<P, Editable, V>): ReactNode\n/** Implementation signature β€” the flat superset (`ScheduleAllProps`), so the\n * body never has to resolve a conditional against an unbound `V`. Not part\n * of the public type: only the overload above is emitted. */\nexport function ScheduleRoot<P = unknown>(allProps: ScheduleAllProps<P>) {\n const {\n data,\n staticEvents = [],\n selected,\n defaultSelected,\n onSelect,\n withSelection = true,\n withEventDetails = true,\n onDayClick,\n renderEventDetails,\n locale,\n timeZone = getLocalTimeZone(),\n translations,\n classNames,\n className,\n startHour = 0,\n endHour = 24,\n slotDuration = 15,\n minDuration,\n resizeCollision = \"none\",\n maxDuration,\n hourHeight,\n slotDisabled,\n now,\n withNowIndicator = true,\n onEventChange,\n onEventRemove,\n onEventCreate,\n onGridClick,\n editable,\n preventOverlap,\n maxOverlapColumns,\n maxAllDayRows,\n onOverflowClick,\n withOverflowDetails,\n renderOverflowDetails,\n empty,\n date,\n defaultDate,\n onDateChange,\n views,\n view,\n defaultView,\n onViewChange,\n withNowButton = true,\n align,\n revealBehavior = \"auto\",\n visibleDays = 7,\n dayDisabled,\n maxEventsPerDay,\n onMonthClick,\n renderEvent,\n testId,\n ...rest\n } = allProps\n\n const [currentDate, setCurrentDate] = useUncontrolled<Date>({\n value: date,\n defaultValue: defaultDate,\n finalValue: now ?? new Date(),\n onChange: onDateChange,\n })\n const { selected: selectedIds, onEventSelect } = useScheduleSelection<P>({\n selected,\n defaultSelected,\n onSelect,\n withSelection,\n })\n // The one id the reveal below chases: the popover's chip. Keyed on this\n // rather than the list, which a consumer re-creates on every render β€” a\n // list compare would re-arm the reveal each commit.\n const selectedId = selectedIds[0] ?? null\n const resolvedViews = resolveScheduleViews(views)\n // State is a plain `string`: the generic id union exists only at the public\n // boundary (the cast below, and `ScheduleProps`' own fields), exactly as\n // `Tabs` does with `d.value as TabsValue<Data>`. Threading `ScheduleViewId<V>`\n // through the internals would buy nothing and fight every resolver, which all\n // legitimately work in plain strings.\n const [currentId, setCurrentId] = useUncontrolled<string>({\n value: view,\n defaultValue: defaultView,\n // `views[0]`, not a hard-coded `\"days\"` β€” with `views={[\"month\",\"year\"]}`\n // the old default named a view that has no tab, so the switcher would show\n // nothing selected while Month rendered.\n finalValue: resolvedViews[0]?.id ?? \"days\",\n onChange: onViewChange,\n })\n // Chain: the id the consumer asked for, else the first configured entry, else\n // a hard fallback for the degenerate `views={[]}` (warned about below β€”\n // rendering *something* beats rendering nothing).\n const active: ResolvedScheduleView =\n findScheduleView(resolvedViews, currentId) ?? resolvedViews[0] ?? FALLBACK_VIEW\n // The *renderer* β€” what `match` switches on, and what every date helper wants.\n const currentView = active.view\n // An entry that pins a window wins; otherwise the consumer's own prop. Only\n // `\"day\"`/`\"week\"` pin one, so under the default entries this is always just\n // `visibleDays` β€” which is what keeps existing call sites identical.\n const activeVisibleDays = active.visibleDays ?? visibleDays\n\n const viewIds = resolvedViews.map((v) => v.id)\n const viewIdKey = viewIds.join(\"\\u0000\")\n const activeRenderers = new Set<ScheduleView>(resolvedViews.map((v) => v.view))\n const activeRendererKey = [...activeRenderers].sort().join(\"\\u0000\")\n const presentScopedKey = SCOPED_PROP_NAMES.filter((n) => allProps[n] !== undefined).join(\"\\u0000\")\n /**\n * Dev-only configuration checks, the runtime half of the same two-layer\n * scheme `editable` uses (`code-style.md`, \"Capability flag + required\n * callback\"). The `view`/`defaultView` check in particular can *only* fire\n * where the compile layer provably cannot reach: for a literal `views` it is\n * already a type error, so this is for the genuinely dynamic\n * `ScheduleViewOption[]` case, where `ScheduleViewId<V>` degrades to\n * `string`.\n *\n * Keyed on the joined id list rather than `resolvedViews`' identity: an\n * inline `views` literal is a fresh array every render, which would re-fire\n * every warning below on each one.\n */\n // biome-ignore lint/correctness/useExhaustiveDependencies: keyed on the joined id list, not the per-render array identity β€” see the comment above.\n useEffect(() => {\n if (viewIds.length === 0) {\n devWarn(\n 'Schedule: `views` is empty β€” falling back to the \"days\" view, and no view switcher will render.',\n )\n return\n }\n const duplicates = [...new Set(viewIds.filter((id, i) => viewIds.indexOf(id) !== i))]\n if (duplicates.length > 0) {\n devWarn(\n `Schedule: duplicate \\`views\\` id${duplicates.length > 1 ? \"s\" : \"\"} ${duplicates\n .map((id) => `\"${id}\"`)\n .join(\n \", \",\n )} β€” only the first entry with each id is reachable, and the switcher's indicator cannot track the rest.`,\n )\n }\n for (const [prop, value] of [\n [\"view\", view],\n [\"defaultView\", defaultView],\n ] as const) {\n if (value != null && !viewIds.includes(value)) {\n devWarn(\n `Schedule: \\`${prop}\\` is \"${value}\", which is not one of \\`views\\` (${viewIds\n .map((id) => `\"${id}\"`)\n .join(\", \")}) β€” falling back to \"${viewIds[0]}\".`,\n )\n }\n }\n // Props no configured renderer can act on. A literal `views` makes these a\n // type error already (`ScheduleProps`), so in practice this fires for a\n // `views` array built at runtime β€” exactly the case the gates widen open\n // for, on purpose, so that working code keeps compiling.\n const ignoredByRenderers = new Map<string, string[]>()\n for (const name of SCOPED_PROP_NAMES) {\n if (allProps[name] === undefined) continue\n const needed = PROP_RENDERERS[name]\n if (needed.some((renderer) => activeRenderers.has(renderer))) continue\n const key = needed.join(\"|\")\n ignoredByRenderers.set(key, [...(ignoredByRenderers.get(key) ?? []), `\\`${name}\\``])\n }\n for (const [key, names] of ignoredByRenderers) {\n const renderers = key.split(\"|\")\n devWarn(\n `Schedule: ${listPhrase(names)} ${names.length > 1 ? \"are\" : \"is\"} ignored β€” no \\`views\\` entry renders the ${listPhrase(\n renderers.map((r) => `\\`${r}\\``),\n )} view${renderers.length > 1 ? \"s\" : \"\"}, which ${renderers.length > 1 ? \"are\" : \"is\"} what reads ${names.length > 1 ? \"them\" : \"it\"}.`,\n )\n }\n // Keyed on which scoped props are *present*, not on `allProps` itself: an\n // inline object prop makes that a fresh reference every render, and\n // `devWarn` does not dedupe.\n }, [viewIdKey, view, defaultView, activeRendererKey, presentScopedKey])\n\n /**\n * Reveal: bring the thing that was just asked for into view, but only when\n * it isn't already there.\n *\n * Two arming sources, one slot (`revealRef`). A **selection** change arms the\n * selected event. A **date** change that is not navigation arms the anchor\n * day β€” which is what makes drill-down work with no new props at all: the\n * anchor already *is* the day that was clicked, whether it got there through\n * the built-in `drillTo(\"days\")` below or a consumer's own\n * `useSchedule().goTo(\"days\")`.\n *\n * Neither is armed by the view moving on its own, and the date axis is armed\n * only for a *jump* β€” paging away and being dragged back would be exactly\n * the yank this rule exists to avoid.\n *\n * DOM focus is deliberately never moved here: a chip click focuses on its\n * own, and stealing focus in response to a *prop* change would fight\n * whatever the user is actually doing.\n */\n const revealRef = useRef<ScheduleReveal | null>(\n selectedId == null ? null : { kind: \"event\", id: selectedId },\n )\n /** Previous *committed* values, for the arming effect below. Refs rather\n * than a dependency array: the effect has to run on every commit to clear\n * `navigatedRef`, and `currentDate` is an object a controlled consumer is\n * free to re-create on every render. */\n const previousSelectedRef = useRef(selectedId)\n /** `null` until the first commit records one, which is what keeps a day\n * reveal from firing on mount: the grid opens at `scrollLeft: 0` having\n * been asked to go nowhere. The *event* reveal deliberately does fire on\n * mount (`revealRef` is seeded from `selectedId` above) β€” a `selected` id\n * is an explicit target, an anchor date is just where the calendar starts. */\n const previousDateRef = useRef<Date | null>(null)\n /** Seeded with the view we mount on, so the first commit never counts as a\n * change β€” the same \"mount is silent\" reasoning as `previousDateRef`. */\n const previousViewRef = useRef(currentView)\n /**\n * Set immediately before a `setCurrentDate` that came from a control which\n * already owns its own scroll behaviour: Prev/Next, the Now button, and\n * `DaysView`'s drag-to-edge pagination. None of those may arm a day reveal.\n *\n * The Now button is the one that actively breaks without this β€” it calls\n * `scrollElementToCenter` on both axes synchronously, and a competing reveal\n * on the next commit would abort that smooth scroll partway through.\n *\n * Cleared unconditionally on every commit, not only on those where the date\n * actually moved: a controlled consumer may clamp or reject an\n * `onDateChange`, and a flag whose date change never arrives would stay\n * stuck and silently swallow the next genuine drill-down. (A consumer\n * wrapping their `setDate` in `startTransition` can still lose the\n * suppression, since React may commit an intermediate tree first; the cost\n * is one unwanted re-centre on a page turn.)\n */\n const navigatedRef = useRef(false)\n /** Marks a date change as navigation, then performs it. */\n const navigateTo = (target: Date) => {\n navigatedRef.current = true\n setCurrentDate(target)\n }\n\n useEffect(() => {\n const previousSelected = previousSelectedRef.current\n const previousDate = previousDateRef.current\n const previousView = previousViewRef.current\n const navigated = navigatedRef.current\n previousSelectedRef.current = selectedId\n previousDateRef.current = currentDate\n previousViewRef.current = currentView\n navigatedRef.current = false\n\n // Selection wins outright, and returns. It is the more specific target β€” a\n // chip, not the whole column it sits in β€” and it carries a date axis of\n // its own, so a `goTo` that sets `selected` + `date` + `view` in one commit\n // must reveal the chip rather than the day underneath it.\n if (selectedId !== previousSelected) {\n revealRef.current = selectedId == null ? null : { kind: \"event\", id: selectedId }\n return\n }\n if (navigated || currentView !== \"days\") return\n // Never clobber a reveal still in flight: the event branch's own date axis\n // moves the anchor and deliberately *stays* armed for the commit that\n // renders the new band, as does its page-turn re-arm. Both land here on the\n // very next commit with the date changed, and this effect runs first.\n if (revealRef.current !== null) return\n // Two independent reasons to reveal, and the second is not optional: a\n // Schedule anchors on *today* by default, so drilling into today β€” the\n // likeliest first click there is β€” moves no date at all. Arming on the\n // date alone left that case, and every \"click the day we are already\n // anchored on\", silently doing nothing while the column sat off screen.\n // Arriving in the days view is itself the event worth reacting to, because\n // the grid mounts at `scrollLeft: 0` regardless of which column the anchor\n // is.\n //\n // The day comparison is by calendar day, never by identity: a controlled\n // consumer may hand back a fresh object every render (`date={new\n // Date(iso)}`), and re-arming on that would re-scroll on every parent\n // render. `getTime()` short-circuits before `dayKey` builds an `Intl`\n // formatter.\n const arrivedInDays = previousView !== \"days\"\n const dayChanged =\n previousDate !== null &&\n previousDate.getTime() !== currentDate.getTime() &&\n dayKey(previousDate, timeZone) !== dayKey(currentDate, timeZone)\n if (!arrivedInDays && !dayChanged) return\n revealRef.current = { kind: \"day\", date: currentDate }\n })\n\n // biome-ignore lint/correctness/useExhaustiveDependencies: armed by the effect above; `data`/`staticEvents` are read through the ref-gated branch below and must not re-trigger a reveal on every parent render.\n useEffect(() => {\n const reveal = revealRef.current\n if (reveal == null) return\n const grid = gridRef.current\n\n if (reveal.kind === \"day\") {\n // Consumed up front: a day reveal that lands anywhere but a mounted days\n // grid is dropped, never left armed to fire the next time one opens.\n revealRef.current = null\n if (currentView !== \"days\" || !grid) return\n // A page turn is mid-flight β€” same guard, same reason, as the event\n // branch below.\n if (grid.querySelector(\"[data-page-exiting]\")) {\n revealRef.current = reveal\n return\n }\n const column = liveDayColumnFor(grid, dayKey(reveal.date, timeZone))\n // No column: nothing on screen to centre. Reachable when a consumer\n // anchors outside the rendered window by other means; a no-op, not an\n // error, exactly as a missing chip is below.\n if (!column) return\n const gutter = grid.querySelector<HTMLElement>(\"[data-schedule-part='hour-gutter']\")\n if (isElementInScrollViewport(grid, column, { axis: \"inline\", inlineOccluder: gutter })) {\n return\n }\n scrollElementToCenter(grid, column, { axis: \"inline\", behavior: revealBehavior })\n return\n }\n\n const { id } = reveal\n const event = [...data, ...staticEvents].find((e) => e.id === id)\n // A `selected` id naming nothing is a no-op, not an error β€” the consumer\n // may be mid-fetch, or have removed the event while it was selected.\n if (!event) {\n revealRef.current = null\n return\n }\n\n // Date axis. Testing the whole range, not just `start`, is what makes a\n // long multi-day event behave: it is on screen every day of the window, so\n // anchoring to its start would page *away* from what we are revealing.\n if (\n !isEventInVisibleRange(event, currentView, currentDate, {\n timeZone,\n locale: locale ?? \"en-US\",\n // The wide `align` value, deliberately un-narrowed: `getVisibleRange`\n // calls `resolveWeekStartDay` itself and the days branch needs the raw\n // `\"relative\"`.\n startOfWeek: align,\n visibleDays: activeVisibleDays,\n })\n ) {\n // Deliberately not `navigateTo`: the armed-reveal guard above already\n // stops this from arming a day reveal, and calling it navigation would\n // be a lie.\n setCurrentDate(event.start)\n return // stay armed; the next commit scrolls\n }\n\n revealRef.current = null\n // Month/Year have no scrollable grid β€” they get the date axis only.\n if (currentView !== \"days\" || !grid) return\n // A page turn is mid-flight: the incoming band is itself under a\n // `translateX`, so its rects describe a position it is only passing\n // through. Vertical would still be right (the keyframes are X-only) but\n // horizontal would land a full band off. Leave it armed and let the commit\n // that clears the animation do it.\n if (grid.querySelector(\"[data-page-exiting]\")) {\n revealRef.current = reveal\n return\n }\n\n const chip =\n liveChipsFor(grid, id)[0] ??\n grid.querySelector<HTMLElement>(\n `[data-schedule-part='all-day-event'][data-event-id=\"${CSS.escape(id)}\"]:not([data-page-exiting])`,\n )\n // No chip: clipped by `startHour`/`endHour`, or collapsed into a \"+N\".\n if (!chip) return\n // The grid's own sticky header occludes the top of its scroll viewport, and\n // its hour gutter the inline-start edge, so \"inside the scroll box\" is not\n // the same as \"visible\" on either axis.\n const topInset =\n grid\n .querySelector<HTMLElement>(\"[data-schedule-part='header-block']\")\n ?.getBoundingClientRect().height ?? 0\n const gutter = grid.querySelector<HTMLElement>(\"[data-schedule-part='hour-gutter']\")\n if (isElementInScrollViewport(grid, chip, { topInset, inlineOccluder: gutter })) return\n scrollElementToCenter(grid, chip, { behavior: revealBehavior })\n }, [\n selectedId,\n currentDate,\n currentView,\n activeVisibleDays,\n align,\n timeZone,\n locale,\n revealBehavior,\n ])\n // Private β€” never surfaced on `ScheduleProps` (see `DaysViewProps.gridRef`'s\n // own doc comment for why `ScheduleTimedProps` itself can't carry this).\n // Only meaningful while `currentView === \"days\"`; Month/Year get date-change\n // only, no scroll, since neither has a timed grid to scroll.\n const gridRef = useRef<HTMLDivElement>(null)\n // Paired with `gridRef` above for `scrollElementToCenter` below β€” same\n // \"private, DaysView's own `nowRef` doc comment explains why\" reasoning.\n const nowRef = useRef<HTMLDivElement>(null)\n const t = resolveScheduleTranslations(translations)\n\n /**\n * RFC Β§9/Β§10's drill-down, finally wired: a day click in Month or Year\n * lands on that date in Days, a Year month-header click on that month in\n * Month β€” the Google/Apple Calendar default, and the only place in the\n * component tree where both the anchor date *and* the view are in scope\n * (Schedule has no context, by RFC Β§3, so a view can't reach these itself).\n *\n * Presence-gated like every other Schedule callback: a consumer's own\n * `onDayClick`/`onMonthClick` replaces the drill-down rather than firing\n * alongside it. Both setters come from `useUncontrolled`, so this works\n * identically whether `date`/`view` are controlled or not.\n *\n * `visibleDays` is deliberately untouched β€” drilling in moves the anchor,\n * it doesn't resize the window, so a 5-day Schedule stays a 5-day Schedule\n * with the clicked day inside it rather than silently becoming a Day view.\n */\n const drillTo = (renderer: ScheduleView) => (target: Date) => {\n setCurrentDate(target)\n // Drill-down is specified in renderers (\"a day click lands in the days\n // grid\"), but it has to *set* an id, and with a configurable `views` those\n // are no longer the same string β€” `views={[\"day\",\"week\",\"month\"]}` has no\n // entry called \"days\" at all. Resolve to the first entry using that\n // renderer; `views={[\"month\",\"year\"]}` legitimately has none, in which case\n // the anchor still moves and the view does not.\n const entry = findScheduleViewByRenderer(resolvedViews, renderer)\n if (entry) {\n setCurrentId(entry.id)\n return\n }\n devWarn(\n `Schedule: a drill-down targeted the \"${renderer}\" view, but no \\`views\\` entry renders it β€” the date moved and the view did not.`,\n )\n }\n\n return (\n <ark.div\n className={cn(\n \"flex h-full flex-col overflow-hidden rounded-sm\",\n // Days already closes its own frame β€” a `border-b` under the\n // header+all-day block and a `border-s` on each day column (which\n // also separates the hour gutter from day column 0) β€” so a second,\n // wrapping card border here would just be a redundant outer box.\n // Month/Year don't: `MonthView` deliberately skips its own outer-edge\n // cell borders and relies on this wrapper border to close its frame\n // (see its own comment), so only they keep it.\n \"border border-brand-900/20 dark:border-white/15\",\n className,\n )}\n data-schedule-part=\"root\"\n {...props({ \"data-testid\": testId })}\n {...rest}\n >\n <ScheduleToolbar className={classNames?.toolbar}>\n <ScheduleToolbar.Title\n view={currentView}\n date={currentDate}\n timeZone={timeZone}\n locale={locale}\n align={align}\n visibleDays={activeVisibleDays}\n />\n <div className=\"flex items-center gap-1\">\n {withNowButton ? (\n <ScheduleToolbar.NowTrigger\n onDateChange={(d) => {\n // Navigation: this button does its own scrolling, both axes,\n // onto the now-marker itself β€” which also brings today's\n // column into view. A day reveal armed by the same date change\n // would fire on the next commit and abort that scroll partway.\n navigateTo(d)\n if (currentView === \"days\" && gridRef.current && nowRef.current) {\n scrollElementToCenter(gridRef.current, nowRef.current)\n }\n }}\n now={now}\n translations={t}\n />\n ) : null}\n <ScheduleToolbar.PrevTrigger\n view={currentView}\n date={currentDate}\n onDateChange={navigateTo}\n timeZone={timeZone}\n translations={t}\n visibleDays={activeVisibleDays}\n />\n <ScheduleToolbar.NextTrigger\n view={currentView}\n date={currentDate}\n onDateChange={navigateTo}\n timeZone={timeZone}\n translations={t}\n visibleDays={activeVisibleDays}\n />\n {/* Composed only when there is a choice to offer. A one-tab tablist\n is dead chrome, and announcing a tablist a user cannot move within\n is worse than announcing none β€” but that is this layout's call to\n make, not something `ViewSwitcher` should decide by returning\n `null` from under whoever placed it. */}\n {resolvedViews.length > 1 ? (\n <ScheduleToolbar.ViewSwitcher\n view={currentId}\n views={resolvedViews}\n onViewChange={setCurrentId}\n translations={t}\n className=\"ms-1\"\n />\n ) : null}\n </div>\n </ScheduleToolbar>\n <div className=\"min-h-0 flex-1\">\n {match(currentView)\n .with(\"days\", () => (\n <DaysViewBody\n data={data}\n staticEvents={staticEvents}\n selected={selectedIds}\n onSelect={(event) => onEventSelect?.(event)}\n withSelection={withSelection}\n withEventDetails={withEventDetails}\n onDayClick={onDayClick}\n renderEventDetails={renderEventDetails}\n locale={locale}\n timeZone={timeZone}\n translations={t}\n classNames={classNames}\n startHour={startHour}\n endHour={endHour}\n slotDuration={slotDuration}\n minDuration={minDuration}\n resizeCollision={resizeCollision}\n maxDuration={maxDuration}\n hourHeight={hourHeight}\n slotDisabled={slotDisabled}\n now={now}\n withNowIndicator={withNowIndicator}\n onEventChange={onEventChange}\n onEventRemove={onEventRemove}\n onEventCreate={onEventCreate}\n onGridClick={onGridClick}\n editable={editable}\n preventOverlap={preventOverlap}\n maxOverlapColumns={maxOverlapColumns}\n maxAllDayRows={maxAllDayRows}\n onOverflowClick={onOverflowClick}\n withOverflowDetails={withOverflowDetails}\n renderOverflowDetails={renderOverflowDetails}\n empty={empty}\n date={currentDate}\n // Under `Root`, `withPagination`/`withNowButton` are both off, so\n // drag-to-edge pagination is the only thing that reaches this β€”\n // navigation, and not a request to re-centre anything.\n onDateChange={navigateTo}\n withPagination={false}\n withNowButton={false}\n visibleDays={activeVisibleDays}\n align={align}\n gridRef={gridRef}\n nowRef={nowRef}\n />\n ))\n .with(\"month\", () => (\n <MonthView\n data={data}\n staticEvents={staticEvents}\n selected={selectedIds}\n onSelect={(event) => onEventSelect?.(event)}\n withSelection={withSelection}\n withEventDetails={withEventDetails}\n onDayClick={onDayClick ?? drillTo(\"days\")}\n renderEventDetails={renderEventDetails}\n locale={locale}\n timeZone={timeZone}\n translations={t}\n classNames={classNames}\n date={currentDate}\n onDateChange={setCurrentDate}\n withPagination={false}\n withNowButton={false}\n startOfWeek={resolveWeekStartDay(align)}\n now={now}\n dayDisabled={dayDisabled}\n maxEventsPerDay={maxEventsPerDay}\n />\n ))\n .with(\"year\", () => (\n <YearView\n data={data}\n staticEvents={staticEvents}\n onDayClick={onDayClick ?? drillTo(\"days\")}\n onMonthClick={onMonthClick ?? drillTo(\"month\")}\n locale={locale}\n timeZone={timeZone}\n translations={t}\n classNames={classNames}\n date={currentDate}\n onDateChange={setCurrentDate}\n withPagination={false}\n withNowButton={false}\n now={now}\n dayDisabled={dayDisabled}\n />\n ))\n .with(\"agenda\", () => (\n <AgendaView\n data={data}\n staticEvents={staticEvents}\n selected={selectedIds}\n onSelect={(event) => onEventSelect?.(event)}\n withSelection={withSelection}\n withEventDetails={withEventDetails}\n renderEventDetails={renderEventDetails}\n renderEvent={renderEvent}\n locale={locale}\n timeZone={timeZone}\n translations={t}\n classNames={classNames}\n empty={empty}\n date={currentDate}\n // `setCurrentDate`, not `navigateTo`: like Month and Year, the\n // agenda has no scroll of its own for a competing day-reveal to\n // abort, so there is nothing to suppress.\n onDateChange={setCurrentDate}\n withPagination={false}\n withNowButton={false}\n now={now}\n />\n ))\n .exhaustive()}\n </div>\n </ark.div>\n )\n}\n","\"use client\"\n\nimport { DaysView, type DaysViewBaseProps } from \"./schedule-days-view\"\nimport type { ScheduleSlotProps } from \"./schedule-types\"\n\n/**\n * RFC Β§17a (`docs/rfcs/schedule.md`) β€” a thin, preconfigured `DaysView` with\n * `visibleDays` fixed to `1`, reinstated as a convenience wrapper (not a\n * reimplementation β€” the whole point of the `DaysView` merge was one\n * underlying engine) for the common single-day case.\n *\n * `align` is omitted from the public surface entirely, matching the\n * old, pre-merge `DayView`'s shape exactly (it never accepted a\n * `firstDayOfWeek` prop β€” a single day has no week-start concept to snap\n * to). This isn't just an API-cleanliness choice: `getVisibleRange`'s\n * `\"days\"` branch special-cases `visibleDays === 1` to always anchor on the\n * date itself, the same as `align: \"relative\"`, regardless of what\n * `align` would otherwise resolve to β€” so the prop is provably\n * meaningless here, not just conventionally hidden.\n *\n * Renders `data-schedule-part=\"days-view\"`, same as `DaysView` itself β€”\n * this genuinely mounts one, so there's exactly one source of truth for\n * that attribute rather than a second value to keep in sync.\n */\nexport type DayViewProps<P = unknown> = Omit<DaysViewBaseProps<P>, \"visibleDays\" | \"align\"> &\n ScheduleSlotProps\n\nexport function DayView<P = unknown>(props: DayViewProps<P>) {\n return <DaysView {...props} visibleDays={1} />\n}\n","\"use client\"\n\nimport { ark, type HTMLArkProps } from \"@ark-ui/react\"\nimport { getLocalTimeZone } from \"@internationalized/date\"\nimport type { ReactNode } from \"react\"\nimport { cn } from \"../../lib/cn\"\nimport { props } from \"../../lib/props\"\nimport type { WithTestId } from \"../../lib/test-id\"\nimport { useNow } from \"../../lib/use-now\"\nimport { type AgendaEventRenderState, ScheduleAgendaList } from \"./schedule-agenda-list\"\nimport { buildNextUpAgenda } from \"./schedule-next-up-grouping\"\nimport type {\n ScheduleAgendaListClassNames,\n ScheduleAnyEvent,\n ScheduleTranslations,\n} from \"./schedule-types\"\nimport { resolveScheduleTranslations } from \"./schedule-types\"\n\n/**\n * RFC β€” `Schedule.NextUp`: a chronological upcoming-events list, grouped by\n * day then by exact start time (same-start events stack under one shared\n * time label).\n *\n * It renders the very same list `AgendaView` does (`schedule-agenda-list.tsx`)\n * over a different window: `AgendaView` shows one calendar month and is a\n * toolbar-switchable view; this shows everything from now on, unbounded, and\n * is not. That makes it the standalone preset β€” a sidebar/dashboard \"what's\n * next\" panel β€” rather than a fourth grid.\n *\n * Its rows are deliberately **not** interactive. `AgendaView` turns them into\n * real buttons because it has a `selected`/`onSelect` contract to honour;\n * this has none, so every row stays plain text and all interactivity is\n * `renderEvent`'s to add β€” which is what keeps a caller's own buttons out of\n * a wrapping button.\n *\n * Live-ticking by default via `useNow` (RFC Β§13's own clock primitive):\n * which events are shown, and their Today/Tomorrow/date grouping, re-derive\n * automatically as real time passes, unless a fixed `now` is passed for\n * tests/Storybook.\n *\n * Unstyled chrome β€” no built-in card/border/background, unlike `Root`/\n * `MonthView`/`YearView`'s own wrapping surface. A bare agenda list is a\n * layout primitive meant to sit inside whatever the consumer already has\n * (a sidebar, a dashboard card, a panel); wrap it in `Card` (or any other\n * surface) at the call site instead.\n */\n\n/** @deprecated-in-name only β€” the canonical name is\n * `ScheduleAgendaListClassNames`, since `AgendaView` styles the same slots.\n * Kept as an alias so this component's published type is unchanged. */\nexport type ScheduleNextUpClassNames = ScheduleAgendaListClassNames\n\n/** Alias of `AgendaEventRenderState`, kept for the same reason as\n * `ScheduleNextUpClassNames` above. */\nexport type NextUpEventRenderState = AgendaEventRenderState\n\nexport type ScheduleNextUpProps<P = unknown> = Omit<HTMLArkProps<\"section\">, \"children\"> &\n WithTestId & {\n /** Both interactive and read-only events, merged β€” `NextUp` never\n * drags, resizes, or removes anything, so there's no reason to force\n * callers to split one upcoming-events list into `data`/`staticEvents`\n * the way the editable views do. */\n data: ScheduleAnyEvent<P>[]\n /** Override for tests/Storybook; a fixed value stops the live tick\n * entirely β€” identical contract to the grid views' own `now`. */\n now?: Date\n /** Minutes an event stays visible past its own `end` before this list\n * drops it. */\n pastEventsOffset?: number\n locale?: string\n timeZone?: string\n /** Day-group labels are fully `Intl`-derived (see `resolveNextUpDayLabel`),\n * so only the two genuinely arbitrary strings this list can show are\n * reachable: the nothing-upcoming message, and the label an `allDay`\n * event shows in place of a clock time. Same field names and types the\n * grid views' `ScheduleTranslations` already carries, rather than a\n * parallel vocabulary. */\n translations?: Pick<ScheduleTranslations, \"empty\" | \"allDay\">\n /** Full override for the \"nothing upcoming\" state; `translations.empty`\n * is just this slot's default copy β€” same `empty` prop +\n * `translations.empty`-default split the grid views already use. */\n empty?: ReactNode\n /**\n * Overrides one event's own row content entirely. The shared `HH:MM`\n * slot heading and each event's own duration both stay owned by\n * `NextUp` itself β€” like the time, duration always renders (in the\n * time column, under the `HH:MM` label) regardless of `renderEvent`;\n * this only replaces the title/icon/description content next to it.\n * Absent (the default): icon + bold title + muted description,\n * mirroring the built-in event-details popover's own default content.\n */\n renderEvent?: (event: ScheduleAnyEvent<P>, state: NextUpEventRenderState) => ReactNode\n classNames?: ScheduleNextUpClassNames\n }\n\nexport function ScheduleNextUp<P = unknown>({\n data,\n now,\n pastEventsOffset = 30,\n locale,\n timeZone = getLocalTimeZone(),\n translations,\n empty,\n renderEvent,\n classNames,\n className,\n testId,\n ...rest\n}: ScheduleNextUpProps<P>) {\n const current = useNow(now)\n const agenda = buildNextUpAgenda(data, current, { pastEventsOffset, timeZone })\n const t = resolveScheduleTranslations(translations)\n\n return (\n <ark.section\n data-schedule-part=\"next-up-root\"\n className={cn(\"flex flex-col gap-4\", className)}\n {...props({ \"data-testid\": testId })}\n {...rest}\n >\n <ScheduleAgendaList\n groups={agenda}\n now={current}\n locale={locale}\n timeZone={timeZone}\n translations={t}\n empty={empty}\n // Only meaningful here: this list starts at \"now\", so its first row\n // genuinely is the next thing coming up.\n nextEventId={agenda[0]?.slots[0]?.events[0]?.id}\n renderEvent={renderEvent}\n classNames={classNames}\n />\n </ark.section>\n )\n}\n","\"use client\"\n\nimport { DaysView, type DaysViewBaseProps } from \"./schedule-days-view\"\nimport type { ScheduleSlotProps } from \"./schedule-types\"\n\n/**\n * RFC Β§17a (`docs/rfcs/schedule.md`) β€” a thin, preconfigured `DaysView` with\n * `visibleDays` fixed to `7`, reinstated as a convenience wrapper (not a\n * reimplementation β€” the whole point of the `DaysView` merge was one\n * underlying engine) for the common full-week case.\n *\n * Unlike `DayView`, `align` stays on the public surface β€” matching the\n * old, pre-merge `WeekView`'s `firstDayOfWeek` prop, a week genuinely has a\n * start-of-week concept to configure (unlike a single day, see `DayView`).\n *\n * Renders `data-schedule-part=\"days-view\"`, same as `DaysView` itself β€”\n * this genuinely mounts one, so there's exactly one source of truth for\n * that attribute rather than a second value to keep in sync.\n */\nexport type WeekViewProps<P = unknown> = Omit<DaysViewBaseProps<P>, \"visibleDays\"> &\n ScheduleSlotProps\n\nexport function WeekView<P = unknown>(props: WeekViewProps<P>) {\n return <DaysView {...props} visibleDays={7} />\n}\n","\"use client\"\n\nimport { useCallback, useState } from \"react\"\nimport type { DefaultScheduleViews, ScheduleViewId, ScheduleViews } from \"./schedule-views\"\nimport { DEFAULT_SCHEDULE_VIEWS } from \"./schedule-views\"\n\n/** What `goTo`'s handler accepts. Structural rather than `ScheduleAnyEvent<P>`\n * so one handler satisfies `onSelect`, `onDayClick` and `onMonthClick` alike\n * without this hook needing a payload generic it can't infer β€” it never sees\n * `data`. */\nexport type ScheduleGoToTarget = Date | { id: string; start: Date } | null\n\nexport type UseScheduleOptions<V extends ScheduleViews> = {\n /** The switcher entries. Hoist with `as const` to keep the id narrowing. */\n views?: V\n /** Defaults to the first entry's id. */\n defaultView?: ScheduleViewId<V>\n defaultDate?: Date\n defaultSelected?: string | null\n}\n\nexport type UseScheduleResult<V extends ScheduleViews> = {\n view: ScheduleViewId<V>\n setView: (view: ScheduleViewId<V>) => void\n date: Date\n setDate: (date: Date) => void\n /** The pressed event's id. Deliberately one id: `Schedule` also accepts a\n * list, but which chips form a group is yours to know β€” pass\n * `selected={piecesOf(selected)}` after the spread to show one. */\n selected: string | null\n setSelected: (selected: string | null) => void\n /** Spread onto `<Schedule>`. Carries `views`, the `view`/`date`/`selected`\n * controlled pairs, and nothing else β€” every other prop stays yours. */\n props: {\n views: V\n view: ScheduleViewId<V>\n onViewChange: (view: ScheduleViewId<V>) => void\n date: Date\n onDateChange: (date: Date) => void\n selected: string | null\n onSelect: (event: { id: string } | null) => void\n }\n /**\n * A handler that moves to `view`, anchored on whatever it is given β€” and, for\n * an event, selects it too.\n *\n * One handler covers all four click sources, because the argument is\n * structural: an event chip (`onSelect`), a day cell or Days day-header\n * (`onDayClick`), and a Year month header (`onMonthClick`).\n */\n goTo: (view: ScheduleViewId<V>) => (target: ScheduleGoToTarget) => void\n}\n\n/**\n * Holds the state `Schedule` exposes as controlled pairs, and hands back\n * ready-made navigation handlers β€” so the common \"click a thing, go there\" case\n * is two lines instead of three `useState`s and three callbacks.\n *\n * Deliberately not a policy prop on `Schedule` itself. What a click *means* is\n * the consumer's decision (open a panel, route to a URL, navigate, nothing at\n * all), and a `drillDown={[...]}`-style prop would enumerate three of the\n * infinite answers while duplicating state `view`/`date`/`selected` already\n * own. This hook is sugar over those props, never a second authority: it is\n * plain state plus handlers, the same shape `lib/use-disclosure.ts` has, with\n * no context and nothing `Schedule` can't be driven without.\n *\n * Generic over `views` so `setView`/`goTo` are checked against your own ids.\n *\n * @example\n * const schedule = useSchedule({ views: VIEWS, defaultView: \"week\" })\n *\n * <Schedule\n * {...schedule.props}\n * data={events}\n * onSelect={schedule.goTo(\"day\")} // chip -> the Day tab, revealed\n * onDayClick={schedule.goTo(\"day\")} // day cell or Days day-header\n * onMonthClick={schedule.goTo(\"month\")}\n * />\n */\nexport function useSchedule<const V extends ScheduleViews = DefaultScheduleViews>({\n views,\n defaultView,\n defaultDate,\n defaultSelected = null,\n}: UseScheduleOptions<V> = {}): UseScheduleResult<V> {\n const resolvedViews = (views ?? DEFAULT_SCHEDULE_VIEWS) as V\n const firstId = (() => {\n const first = resolvedViews[0]\n return (typeof first === \"string\" ? first : first?.id) as ScheduleViewId<V>\n })()\n const [view, setView] = useState<ScheduleViewId<V>>(defaultView ?? firstId)\n const [date, setDate] = useState<Date>(() => defaultDate ?? new Date())\n const [selected, setSelected] = useState<string | null>(defaultSelected)\n\n const goTo = useCallback(\n (target: ScheduleViewId<V>) => (to: ScheduleGoToTarget) => {\n if (to === null) {\n setSelected(null)\n return\n }\n if (to instanceof Date) {\n setDate(to)\n setView(target)\n return\n }\n // An event: select it as well as navigating. This is what makes the\n // handler safe to pass as `onSelect` β€” it is spread *after*\n // `props.onSelect`, so it replaces rather than augments it, and dropping\n // the selection here would silently lose it.\n setSelected(to.id)\n setDate(to.start)\n setView(target)\n },\n [],\n )\n\n return {\n view,\n setView,\n date,\n setDate,\n selected,\n setSelected,\n props: {\n views: resolvedViews,\n view,\n onViewChange: setView,\n date,\n onDateChange: setDate,\n selected,\n onSelect: (event) => setSelected(event?.id ?? null),\n },\n goTo,\n }\n}\n","\"use client\"\n\n/**\n * RFC (`docs/rfcs/schedule.md`) β€” full v1 scope: the core engine, all four\n * views, `Schedule.Toolbar`, and the orchestrating `Schedule` root. Every\n * view stays independently importable (RFC Β§1) in addition to hanging off\n * the compound `Schedule` namespace below, the same \"usable standalone or\n * composed\" shape `Calendar`/`DatePicker` establish for the date-picker\n * family.\n */\n\nexport type { ScheduleSlotPredicate } from \"../../lib/schedule-predicates\"\n// Mirrors `date-picker/index.ts` re-exporting `lib/date-predicates.ts`.\nexport {\n allOf,\n anyOf,\n disableDateRanges,\n disableOutsideHours,\n disablePast,\n disableWeekends,\n} from \"../../lib/schedule-predicates\"\nexport type { ScheduleProps } from \"./schedule\"\nexport { ScheduleRoot } from \"./schedule\"\nexport type {\n AgendaEventRenderer,\n AgendaEventRenderState,\n} from \"./schedule-agenda-list\"\nexport type { AgendaViewProps } from \"./schedule-agenda-view\"\nexport { AgendaView } from \"./schedule-agenda-view\"\nexport type { DateRange } from \"./schedule-dates\"\nexport {\n dayKey,\n durationLabel,\n enumerateDays,\n enumerateMonths,\n eventOccursOnDay,\n formatScheduleTitle,\n getVisibleRange,\n isSameMonth,\n isToday,\n paginateDate,\n rangeOverlapsAny,\n rangesOverlap,\n resolveNextUpDayLabel,\n resolveOverlapCandidates,\n timeLabel,\n} from \"./schedule-dates\"\nexport type { DayViewProps } from \"./schedule-day-view\"\nexport { DayView } from \"./schedule-day-view\"\nexport type { DaysViewBaseProps, DaysViewProps } from \"./schedule-days-view\"\nexport { DaysView } from \"./schedule-days-view\"\nexport type {\n ScheduleCappedLayout,\n ScheduleLayoutResult,\n ScheduleOverflowSpan,\n} from \"./schedule-layout\"\nexport { layoutEventColumns, layoutEventColumnsCapped } from \"./schedule-layout\"\nexport type { MonthViewProps } from \"./schedule-month-view\"\nexport { MonthView } from \"./schedule-month-view\"\nexport type {\n NextUpEventRenderState,\n ScheduleNextUpClassNames,\n ScheduleNextUpProps,\n} from \"./schedule-next-up\"\nexport { ScheduleNextUp } from \"./schedule-next-up\"\nexport type {\n NextUpDayGroup,\n NextUpTimeSlot,\n} from \"./schedule-next-up-grouping\"\nexport {\n buildNextUpAgenda,\n filterUpcomingEvents,\n groupUpcomingEvents,\n} from \"./schedule-next-up-grouping\"\nexport { isScheduleSlotProps } from \"./schedule-snap\"\nexport type {\n ScheduleToolbarNowTriggerProps,\n ScheduleToolbarProps,\n ScheduleToolbarTitleProps,\n ScheduleToolbarViewSwitcherProps,\n} from \"./schedule-toolbar\"\nexport { ScheduleToolbar } from \"./schedule-toolbar\"\nexport type {\n FirstDayOfWeek,\n ScheduleAgendaListClassNames,\n ScheduleAlign,\n ScheduleAnyEvent,\n ScheduleClassNames,\n ScheduleCollision,\n ScheduleEvent,\n ScheduleEventChipClassNames,\n ScheduleOverflowClassNames,\n ScheduleOverflowContext,\n ScheduleOverflowSource,\n ScheduleOverlapGesture,\n ScheduleOverlapPreventionOptions,\n ScheduleOverlapTarget,\n ScheduleSlotDuration,\n ScheduleSlotProps,\n ScheduleStaticEvent,\n ScheduleTranslations,\n ScheduleView,\n SlotMultiple,\n} from \"./schedule-types\"\nexport type {\n DefaultScheduleViews,\n ResolvedScheduleView,\n ScheduleRenderers,\n ScheduleViewId,\n ScheduleViewOption,\n ScheduleViewOptionObject,\n ScheduleViewShorthand,\n ScheduleViews,\n} from \"./schedule-views\"\nexport {\n DEFAULT_SCHEDULE_VIEWS,\n findScheduleView,\n findScheduleViewByRenderer,\n resolveScheduleViewOption,\n resolveScheduleViews,\n scheduleViewLabel,\n} from \"./schedule-views\"\nexport type { WeekViewProps } from \"./schedule-week-view\"\nexport { WeekView } from \"./schedule-week-view\"\nexport type { YearViewProps } from \"./schedule-year-view\"\nexport { YearView } from \"./schedule-year-view\"\nexport type {\n ScheduleGoToTarget,\n UseScheduleOptions,\n UseScheduleResult,\n} from \"./use-schedule\"\nexport { useSchedule } from \"./use-schedule\"\nexport type {\n UseScheduleSelectionOptions,\n UseScheduleSelectionResult,\n} from \"./use-schedule-selection\"\nexport { useScheduleSelection } from \"./use-schedule-selection\"\n\nimport { ScheduleRoot as _ScheduleRoot } from \"./schedule\"\nimport { AgendaView as _AgendaView } from \"./schedule-agenda-view\"\nimport { DayView as _DayView } from \"./schedule-day-view\"\nimport { DaysView as _DaysView } from \"./schedule-days-view\"\nimport { MonthView as _MonthView } from \"./schedule-month-view\"\nimport { ScheduleNextUp as _ScheduleNextUp } from \"./schedule-next-up\"\nimport { ScheduleToolbar as _ScheduleToolbar } from \"./schedule-toolbar\"\nimport { WeekView as _WeekView } from \"./schedule-week-view\"\nimport { YearView as _YearView } from \"./schedule-year-view\"\n\n/** RFC Β§3 β€” the compound export, the same `Object.assign` namespace shape\n * as `Modal`/`Tooltip`. `EventChip` and the disabled-overlay/now-cursor\n * internals stay unexported (RFC Β§3/Β§19) β€” nothing stops adding them to the\n * namespace later without a breaking change. `DayView`/`WeekView` are thin\n * preconfigured `DaysView` wrappers (RFC Β§17a), not independent\n * implementations β€” reinstated for convenience after the `DaysView` merge.\n * `AgendaView` is the month-windowed agenda and *is* toolbar-switchable β€”\n * put `\"agenda\"` in `views` to give it a tab. `NextUp` renders the same list\n * (`schedule-agenda-list.tsx`) over an unbounded from-now window, with no\n * chrome and no selection, and is deliberately still not a switcher entry:\n * it has no anchor date, so there would be nothing for Prev/Next to page. */\nexport const Schedule = Object.assign(_ScheduleRoot, {\n Root: _ScheduleRoot,\n DaysView: _DaysView,\n DayView: _DayView,\n WeekView: _WeekView,\n MonthView: _MonthView,\n YearView: _YearView,\n AgendaView: _AgendaView,\n Toolbar: _ScheduleToolbar,\n NextUp: _ScheduleNextUp,\n})\n"]}