@42-central/ui-react 0.0.0 → 0.17.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (1248) hide show
  1. package/README.md +315 -2
  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-AIQG7IIT.js +39 -0
  27. package/dist/chunk-AIQG7IIT.js.map +1 -0
  28. package/dist/chunk-B2LCHXUB.js +26 -0
  29. package/dist/chunk-B2LCHXUB.js.map +1 -0
  30. package/dist/chunk-BEL75C7N.js +35 -0
  31. package/dist/chunk-BEL75C7N.js.map +1 -0
  32. package/dist/chunk-BJZLQTAZ.js +3 -0
  33. package/dist/chunk-BJZLQTAZ.js.map +1 -0
  34. package/dist/chunk-BUIHQJGE.js +8 -0
  35. package/dist/chunk-BUIHQJGE.js.map +1 -0
  36. package/dist/chunk-CHTN5AHI.js +106 -0
  37. package/dist/chunk-CHTN5AHI.js.map +1 -0
  38. package/dist/chunk-CSCVTESP.js +58 -0
  39. package/dist/chunk-CSCVTESP.js.map +1 -0
  40. package/dist/chunk-EEMRRRYS.js +60 -0
  41. package/dist/chunk-EEMRRRYS.js.map +1 -0
  42. package/dist/chunk-EVVMHTCL.js +216 -0
  43. package/dist/chunk-EVVMHTCL.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-NSOA3GMZ.js +376 -0
  79. package/dist/chunk-NSOA3GMZ.js.map +1 -0
  80. package/dist/chunk-ORTCK34Y.js +3 -0
  81. package/dist/chunk-ORTCK34Y.js.map +1 -0
  82. package/dist/chunk-P3XMBETI.js +26 -0
  83. package/dist/chunk-P3XMBETI.js.map +1 -0
  84. package/dist/chunk-P7A3BCAC.js +93 -0
  85. package/dist/chunk-P7A3BCAC.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-TNNH3FVQ.js +155 -0
  103. package/dist/chunk-TNNH3FVQ.js.map +1 -0
  104. package/dist/chunk-TWGCWKRV.js +44 -0
  105. package/dist/chunk-TWGCWKRV.js.map +1 -0
  106. package/dist/chunk-U5GW5EBR.js +150 -0
  107. package/dist/chunk-U5GW5EBR.js.map +1 -0
  108. package/dist/chunk-UNSAA7YG.js +148 -0
  109. package/dist/chunk-UNSAA7YG.js.map +1 -0
  110. package/dist/chunk-UVYTJQTJ.js +14 -0
  111. package/dist/chunk-UVYTJQTJ.js.map +1 -0
  112. package/dist/chunk-VLUKI3HL.js +120 -0
  113. package/dist/chunk-VLUKI3HL.js.map +1 -0
  114. package/dist/chunk-VZ2TPU4B.js +348 -0
  115. package/dist/chunk-VZ2TPU4B.js.map +1 -0
  116. package/dist/chunk-VZH6TS7M.js +153 -0
  117. package/dist/chunk-VZH6TS7M.js.map +1 -0
  118. package/dist/chunk-WYCMIIRR.js +12 -0
  119. package/dist/chunk-WYCMIIRR.js.map +1 -0
  120. package/dist/chunk-WZB6LPQI.js +47 -0
  121. package/dist/chunk-WZB6LPQI.js.map +1 -0
  122. package/dist/chunk-YBJB7FGE.js +187 -0
  123. package/dist/chunk-YBJB7FGE.js.map +1 -0
  124. package/dist/chunk-YIQI2CF3.js +92 -0
  125. package/dist/chunk-YIQI2CF3.js.map +1 -0
  126. package/dist/chunk-YKUCSV34.js +72 -0
  127. package/dist/chunk-YKUCSV34.js.map +1 -0
  128. package/dist/chunk-YON5Y336.js +639 -0
  129. package/dist/chunk-YON5Y336.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 +90 -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 +6656 -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 +30 -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 +31 -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 +307 -0
  594. package/dist/components/schedule/schedule-geometry.d.ts.map +1 -0
  595. package/dist/components/schedule/schedule-grid-gesture.d.ts +311 -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 +844 -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 +1281 -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 +131 -0
  863. package/src/components/alert/alert.tsx +165 -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 +410 -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 +518 -0
  1028. package/src/components/notification/index.ts +20 -0
  1029. package/src/components/notification/notification.test.tsx +321 -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 +211 -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 +190 -0
  1076. package/src/components/schedule/schedule-dates.test.ts +771 -0
  1077. package/src/components/schedule/schedule-dates.ts +722 -0
  1078. package/src/components/schedule/schedule-day-view.tsx +30 -0
  1079. package/src/components/schedule/schedule-days-view.tsx +279 -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 +172 -0
  1083. package/src/components/schedule/schedule-event-chip.tsx +1183 -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 +482 -0
  1089. package/src/components/schedule/schedule-grid-gesture.test.ts +235 -0
  1090. package/src/components/schedule/schedule-grid-gesture.ts +606 -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 +690 -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 +138 -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 +1647 -0
  1106. package/src/components/schedule/schedule-toolbar.tsx +270 -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 +1152 -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 +307 -0
  1115. package/src/components/schedule/schedule.test.tsx +4386 -0
  1116. package/src/components/schedule/schedule.tsx +1040 -0
  1117. package/src/components/schedule/use-event-create.ts +591 -0
  1118. package/src/components/schedule/use-event-drag.ts +510 -0
  1119. package/src/components/schedule/use-event-resize.ts +565 -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 +1281 -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,4386 @@
1
+ import { act, fireEvent, render, screen, waitFor, within } from "@testing-library/react"
2
+ import { useState } from "react"
3
+ import { describe, expect, it, vi } from "vitest"
4
+ import { IntlProvider } from "../../lib/intl"
5
+ import { disableOutsideHours } from "../../lib/schedule-predicates"
6
+ import { Schedule } from "./index"
7
+ import { ScheduleRoot } from "./schedule"
8
+ import { timeRangeLabel } from "./schedule-dates"
9
+ import { DayView } from "./schedule-day-view"
10
+ import { isScheduleSlotProps } from "./schedule-snap"
11
+ import type {
12
+ ScheduleEvent,
13
+ ScheduleEventCreateHandler,
14
+ ScheduleStaticEvent,
15
+ ScheduleTimedProps,
16
+ SlotMultiple,
17
+ } from "./schedule-types"
18
+ import type { ScheduleViewOption } from "./schedule-views"
19
+ import { WeekView } from "./schedule-week-view"
20
+
21
+ /**
22
+ * Component-level coverage for `Schedule`'s root — the pure-logic modules
23
+ * (`schedule-dates`, `-geometry`, `-layout`, `-snap`, `-types`) already have
24
+ * their own `.test.ts`; this is the rendering/interaction layer those don't
25
+ * touch. Real pointer-based drag/resize/click-drag-to-create gestures aren't
26
+ * covered here — jsdom doesn't meaningfully implement `setPointerCapture` or
27
+ * `getBoundingClientRect`, so those need a real browser (Playwright) to test
28
+ * honestly. The keyboard-driven move path below doesn't need either.
29
+ */
30
+
31
+ const day = (y: number, m: number, d: number, h = 0, min = 0) => new Date(Date.UTC(y, m, d, h, min))
32
+ const NOW = day(2026, 0, 15, 12) // a fixed Thursday, at noon UTC
33
+
34
+ const EVENTS: ScheduleEvent[] = [
35
+ {
36
+ kind: "event",
37
+ id: "e1",
38
+ title: "Standup",
39
+ start: day(2026, 0, 15, 9),
40
+ end: day(2026, 0, 15, 9, 30),
41
+ },
42
+ ]
43
+ const STATIC_EVENTS: ScheduleStaticEvent[] = [
44
+ {
45
+ kind: "static",
46
+ id: "s1",
47
+ title: "Class",
48
+ start: day(2026, 0, 15, 11),
49
+ end: day(2026, 0, 15, 12),
50
+ },
51
+ ]
52
+
53
+ describe("ScheduleRoot — rendering", () => {
54
+ it("renders the toolbar and defaults to the days (timed-grid) view", () => {
55
+ render(<ScheduleRoot data={[]} now={NOW} timeZone="UTC" />)
56
+ expect(document.querySelector('[data-schedule-part="timed-grid"]')).not.toBeNull()
57
+ expect(document.querySelector('[data-schedule-part="month-view"]')).toBeNull()
58
+ })
59
+
60
+ it("shows the empty message when data and staticEvents are both empty", () => {
61
+ render(<ScheduleRoot data={[]} now={NOW} timeZone="UTC" />)
62
+ expect(screen.getByText("No events")).toBeTruthy()
63
+ })
64
+
65
+ it("renders data and staticEvents as chips, each keyed by its own testId default (id)", () => {
66
+ render(<ScheduleRoot data={EVENTS} staticEvents={STATIC_EVENTS} now={NOW} timeZone="UTC" />)
67
+ expect(screen.getByTestId("e1")).toBeTruthy()
68
+ expect(screen.getByTestId("s1")).toBeTruthy()
69
+ })
70
+ })
71
+
72
+ describe("ScheduleRoot — text direction", () => {
73
+ // #243: direction comes from the locale. Under an RTL locale, every part that stamps a `dir` —
74
+ // both chip kinds and the view switcher's Ark parts — must agree with the RTL page around it.
75
+ it("renders every dir-stamped part rtl under an rtl locale", () => {
76
+ const { container } = render(
77
+ <div dir="rtl">
78
+ <IntlProvider locale="ar">
79
+ <ScheduleRoot data={EVENTS} staticEvents={STATIC_EVENTS} now={NOW} timeZone="UTC" />
80
+ </IntlProvider>
81
+ </div>,
82
+ )
83
+ const chips = container.querySelectorAll('[data-schedule-part="event-chip"]')
84
+ const stamped = [...container.querySelectorAll("[dir]")].map((el) => el.getAttribute("dir"))
85
+
86
+ expect(chips).toHaveLength(2)
87
+ expect([...chips].map((chip) => chip.getAttribute("dir"))).toEqual(["rtl", "rtl"])
88
+ expect(stamped.filter((dir) => dir !== "rtl")).toEqual([])
89
+ })
90
+ })
91
+
92
+ describe("ScheduleRoot — IntlProvider", () => {
93
+ const title = () => document.querySelector('[data-schedule-part="toolbar-title"]')?.textContent
94
+
95
+ it("formats with the provider's locale", () => {
96
+ render(
97
+ <IntlProvider locale="fr-FR">
98
+ <ScheduleRoot data={[]} now={NOW} timeZone="UTC" />
99
+ </IntlProvider>,
100
+ )
101
+ expect(title()).toContain("janv.")
102
+ })
103
+
104
+ it("defaults to en-US without a provider, never the host's locale", () => {
105
+ render(<ScheduleRoot data={[]} now={NOW} timeZone="UTC" />)
106
+ expect(title()).toContain("Jan")
107
+ })
108
+
109
+ it("lets its own locale prop win over the provider", () => {
110
+ render(
111
+ <IntlProvider locale="fr-FR">
112
+ <ScheduleRoot data={[]} now={NOW} timeZone="UTC" locale="en-US" />
113
+ </IntlProvider>,
114
+ )
115
+ expect(title()).toContain("Jan")
116
+ })
117
+
118
+ it("resolves dates in the provider's time zone", () => {
119
+ // Sunday 03:00 UTC is still Saturday evening in Los Angeles, so the week
120
+ // view opens on the week that Saturday closes — where the host (UTC in CI,
121
+ // Paris locally) would already be on the next one.
122
+ const sundayMorning = day(2026, 0, 18, 3)
123
+ render(
124
+ <IntlProvider timeZone="America/Los_Angeles">
125
+ <ScheduleRoot data={[]} now={sundayMorning} />
126
+ </IntlProvider>,
127
+ )
128
+ expect(title()).toBe("Jan 11 – 17, 2026")
129
+ })
130
+ })
131
+
132
+ describe("ScheduleRoot — view switching", () => {
133
+ it("switches to Month view on its tab and back to Week", async () => {
134
+ render(<ScheduleRoot data={[]} now={NOW} timeZone="UTC" />)
135
+ // Ark binds the trigger handlers after the machine reaches ready (a
136
+ // macrotask); flush it before driving the click (same gotcha as Tabs'
137
+ // own test suite hits).
138
+ await new Promise((resolve) => setTimeout(resolve, 0))
139
+
140
+ fireEvent.click(screen.getByRole("tab", { name: "Month" }))
141
+ await waitFor(() =>
142
+ expect(document.querySelector('[data-schedule-part="month-view"]')).not.toBeNull(),
143
+ )
144
+ expect(document.querySelector('[data-schedule-part="timed-grid"]')).toBeNull()
145
+
146
+ fireEvent.click(screen.getByRole("tab", { name: "Week" }))
147
+ await waitFor(() =>
148
+ expect(document.querySelector('[data-schedule-part="timed-grid"]')).not.toBeNull(),
149
+ )
150
+ })
151
+ })
152
+
153
+ /**
154
+ * RFC §9/§10's drill-down. `Schedule` is the only place where both the anchor
155
+ * date and the view are in scope (no context, by RFC §3), so this is where a
156
+ * day or month click turns into navigation — the Google/Apple Calendar
157
+ * default, and previously left entirely to the consumer.
158
+ *
159
+ * Titles are compared against a *second* `ScheduleRoot` rendered directly at
160
+ * the expected view + date rather than against a hard-coded string, so these
161
+ * assert "it landed where the toolbar itself would put it" without also
162
+ * pinning `formatScheduleTitle`'s locale formatting.
163
+ */
164
+ describe("ScheduleRoot — drill-down", () => {
165
+ const title = (root: ParentNode = document) =>
166
+ root.querySelector('[data-schedule-part="toolbar-title"]')?.textContent
167
+
168
+ /** What the toolbar reads when `Schedule` is put there directly. */
169
+ const titleAt = (view: "days" | "month", date: Date, visibleDays?: number) => {
170
+ const { container, unmount } = render(
171
+ <ScheduleRoot
172
+ data={[]}
173
+ defaultView={view}
174
+ defaultDate={date}
175
+ now={NOW}
176
+ timeZone="UTC"
177
+ visibleDays={visibleDays}
178
+ />,
179
+ )
180
+ const text = title(container)
181
+ unmount()
182
+ return text
183
+ }
184
+
185
+ it("lands on the clicked day in Days view, from Month", () => {
186
+ const target = day(2026, 0, 22)
187
+ const expected = titleAt("days", target)
188
+
189
+ const { container } = render(
190
+ <ScheduleRoot data={[]} defaultView="month" now={NOW} timeZone="UTC" />,
191
+ )
192
+ fireEvent.click(container.querySelector('[data-testid="day-2026-01-22"]') as HTMLElement)
193
+
194
+ expect(container.querySelector('[data-schedule-part="days-view"]')).not.toBeNull()
195
+ expect(container.querySelector('[data-schedule-part="month-view"]')).toBeNull()
196
+ expect(title(container)).toBe(expected)
197
+ })
198
+
199
+ it("lands on the clicked month in Month view, from Year", () => {
200
+ const expected = titleAt("month", day(2026, 2, 1))
201
+
202
+ const { container } = render(
203
+ <ScheduleRoot data={[]} defaultView="year" now={NOW} timeZone="UTC" />,
204
+ )
205
+ fireEvent.click(container.querySelector('[data-testid="month-2026-03"]') as HTMLElement)
206
+
207
+ expect(container.querySelector('[data-schedule-part="month-view"]')).not.toBeNull()
208
+ expect(title(container)).toBe(expected)
209
+ })
210
+
211
+ it("lands on the clicked day in Days view, from Year", () => {
212
+ const expected = titleAt("days", day(2026, 6, 4))
213
+
214
+ const { container } = render(
215
+ <ScheduleRoot data={[]} defaultView="year" now={NOW} timeZone="UTC" />,
216
+ )
217
+ fireEvent.click(container.querySelector('[data-testid="day-2026-07-04"]') as HTMLElement)
218
+
219
+ expect(container.querySelector('[data-schedule-part="days-view"]')).not.toBeNull()
220
+ expect(title(container)).toBe(expected)
221
+ })
222
+
223
+ // Drilling in moves the anchor; it does not resize the window. A 3-day
224
+ // Schedule stays a 3-day Schedule with the clicked day inside it.
225
+ //
226
+ // Asserted against a literal title and the rendered columns, deliberately
227
+ // NOT against `titleAt(...)`: comparing one `formatScheduleTitle` result to
228
+ // another is a tautology that moves with whatever the window rule happens to
229
+ // be, and it hid a real bug — before the sub-week window slide this rendered
230
+ // "Jan 18 - 20, 2026", a window that does not contain the 22nd at all.
231
+ it("keeps the consumer's visibleDays window, with the clicked day inside it", () => {
232
+ const { container } = render(
233
+ <ScheduleRoot data={[]} defaultView="month" now={NOW} timeZone="UTC" visibleDays={3} />,
234
+ )
235
+ fireEvent.click(container.querySelector('[data-testid="day-2026-01-22"]') as HTMLElement)
236
+
237
+ // Thu 22 Jan 2026 is index 4 of its Sunday-started week, so a 3-day window
238
+ // is tile 1: Wed 21 .. Fri 23.
239
+ expect(title(container)).toBe("Jan 21 – 23, 2026")
240
+ const columns = [
241
+ ...container.querySelectorAll('[data-schedule-part="day-column"][data-day-key]'),
242
+ ].map((el) => el.getAttribute("data-day-key"))
243
+ expect(columns).toEqual(["2026-01-21", "2026-01-22", "2026-01-23"])
244
+ })
245
+
246
+ // Presence-gated like every other Schedule callback — a consumer's own
247
+ // handler replaces the drill-down rather than firing alongside it.
248
+ it("defers to a consumer onDayClick / onMonthClick instead of navigating", () => {
249
+ const onDayClick = vi.fn()
250
+ const onMonthClick = vi.fn()
251
+
252
+ const month = render(
253
+ <ScheduleRoot
254
+ data={[]}
255
+ defaultView="month"
256
+ now={NOW}
257
+ timeZone="UTC"
258
+ onDayClick={onDayClick}
259
+ />,
260
+ )
261
+ fireEvent.click(month.container.querySelector('[data-testid="day-2026-01-22"]') as HTMLElement)
262
+ expect(onDayClick).toHaveBeenCalledTimes(1)
263
+ expect(month.container.querySelector('[data-schedule-part="month-view"]')).not.toBeNull()
264
+ month.unmount()
265
+
266
+ const year = render(
267
+ <ScheduleRoot
268
+ data={[]}
269
+ defaultView="year"
270
+ now={NOW}
271
+ timeZone="UTC"
272
+ onMonthClick={onMonthClick}
273
+ />,
274
+ )
275
+ fireEvent.click(year.container.querySelector('[data-testid="month-2026-03"]') as HTMLElement)
276
+ expect(onMonthClick).toHaveBeenCalledTimes(1)
277
+ expect(year.container.querySelector('[data-schedule-part="year-view"]')).not.toBeNull()
278
+ })
279
+
280
+ // Controlled roots get the same navigation through their own callbacks.
281
+ it("reports both halves of the move through onDateChange/onViewChange", () => {
282
+ const onDateChange = vi.fn()
283
+ const onViewChange = vi.fn()
284
+
285
+ const { container } = render(
286
+ <ScheduleRoot
287
+ data={[]}
288
+ view="month"
289
+ date={day(2026, 0, 15)}
290
+ onViewChange={onViewChange}
291
+ onDateChange={onDateChange}
292
+ now={NOW}
293
+ timeZone="UTC"
294
+ />,
295
+ )
296
+ fireEvent.click(container.querySelector('[data-testid="day-2026-01-22"]') as HTMLElement)
297
+
298
+ expect(onViewChange).toHaveBeenCalledWith("days")
299
+ expect(onDateChange).toHaveBeenCalledWith(day(2026, 0, 22))
300
+ // Fully controlled: nothing moves until the consumer feeds it back.
301
+ expect(container.querySelector('[data-schedule-part="month-view"]')).not.toBeNull()
302
+ })
303
+ })
304
+
305
+ describe("ScheduleRoot — pagination", () => {
306
+ const title = () => document.querySelector('[data-schedule-part="toolbar-title"]')?.textContent
307
+
308
+ it("Next/Prev are inverses and Now resets to the anchor `now`", () => {
309
+ render(<ScheduleRoot data={[]} now={NOW} timeZone="UTC" />)
310
+ const initial = title()
311
+
312
+ fireEvent.click(screen.getByRole("button", { name: "Next" }))
313
+ const afterNext = title()
314
+ expect(afterNext).not.toBe(initial)
315
+
316
+ fireEvent.click(screen.getByRole("button", { name: "Previous" }))
317
+ expect(title()).toBe(initial)
318
+
319
+ fireEvent.click(screen.getByRole("button", { name: "Next" }))
320
+ fireEvent.click(screen.getByRole("button", { name: "Now" }))
321
+ expect(title()).toBe(initial)
322
+ })
323
+ })
324
+
325
+ /**
326
+ * Reveal-on-navigate: the day half of the reveal rule.
327
+ *
328
+ * What is and is not observable here matters. jsdom does no layout, so
329
+ * `test-setup.ts` hands every element the same constant rect — which makes the
330
+ * hour gutter always "cover" a day column, so a day reveal that gets as far as
331
+ * the geometry always scrolls. That makes *whether the reveal was armed at all*
332
+ * the real assertion, which is exactly what separates a drill-down from a page
333
+ * turn. Whether a genuinely visible column is correctly left alone is a
334
+ * question only a browser can answer, and is verified there instead; the
335
+ * geometry itself is unit-tested in `schedule-geometry.test.ts`.
336
+ */
337
+ describe("ScheduleRoot — reveal on navigate", () => {
338
+ const mockScroll = () => {
339
+ Object.defineProperty(window, "matchMedia", {
340
+ writable: true,
341
+ value: vi.fn().mockReturnValue({ matches: false }),
342
+ })
343
+ const scrollTo = vi.fn()
344
+ HTMLElement.prototype.scrollTo = scrollTo
345
+ return scrollTo
346
+ }
347
+
348
+ it("scrolls the drilled-into day's column into view", () => {
349
+ const scrollTo = mockScroll()
350
+ const { container } = render(
351
+ <ScheduleRoot data={[]} defaultView="month" now={NOW} timeZone="UTC" />,
352
+ )
353
+ fireEvent.click(container.querySelector('[data-testid="day-2026-01-22"]') as HTMLElement)
354
+
355
+ // Inline axis only — the time of day the reader was on must survive.
356
+ expect(scrollTo).toHaveBeenCalledTimes(1)
357
+ expect(scrollTo).toHaveBeenCalledWith(expect.objectContaining({ top: 0 }))
358
+ })
359
+
360
+ it("reveals the day even when the anchor was already on it", () => {
361
+ // The case that shipped broken. A Schedule anchors on today by default, so
362
+ // drilling into today moves no date at all — and arming on the date alone
363
+ // meant the likeliest first click in any month view did nothing while the
364
+ // column sat off screen. Arriving in the days view is the event here, not
365
+ // the date.
366
+ const scrollTo = mockScroll()
367
+ const { container } = render(
368
+ <ScheduleRoot data={[]} defaultView="month" now={NOW} timeZone="UTC" />,
369
+ )
370
+ // NOW is 15 Jan 2026, which is also the anchor.
371
+ fireEvent.click(container.querySelector('[data-testid="day-2026-01-15"]') as HTMLElement)
372
+
373
+ expect(scrollTo).toHaveBeenCalledTimes(1)
374
+ })
375
+
376
+ it("reveals the anchor on any arrival in the days view, not just a drill-down", () => {
377
+ // Same reasoning: the grid mounts at `scrollLeft: 0` however you got here,
378
+ // so switching views is as much an arrival as a drill-down is. Driven
379
+ // through the controlled `view` prop rather than the switcher — Ark's tabs
380
+ // don't respond to a bare `fireEvent.click` under jsdom.
381
+ const scrollTo = mockScroll()
382
+ const props = { data: [], now: NOW, timeZone: "UTC" }
383
+ const { rerender } = render(<ScheduleRoot {...props} view="month" />)
384
+ expect(scrollTo).not.toHaveBeenCalled()
385
+
386
+ rerender(<ScheduleRoot {...props} view="days" />)
387
+
388
+ expect(scrollTo).toHaveBeenCalledTimes(1)
389
+ })
390
+
391
+ it("does not animate a reveal by default", () => {
392
+ const scrollTo = mockScroll() // matchMedia says motion is fine
393
+ const { container } = render(
394
+ <ScheduleRoot data={[]} defaultView="month" now={NOW} timeZone="UTC" />,
395
+ )
396
+ fireEvent.click(container.querySelector('[data-testid="day-2026-01-22"]') as HTMLElement)
397
+
398
+ // A reveal is a side effect of navigating, not a gesture — animating it
399
+ // reads as the grid drifting.
400
+ expect(scrollTo).toHaveBeenCalledWith(expect.objectContaining({ behavior: "auto" }))
401
+ })
402
+
403
+ it("animates a reveal when revealBehavior asks for it", () => {
404
+ const scrollTo = mockScroll()
405
+ const { container } = render(
406
+ <ScheduleRoot
407
+ data={[]}
408
+ defaultView="month"
409
+ now={NOW}
410
+ timeZone="UTC"
411
+ revealBehavior="smooth"
412
+ />,
413
+ )
414
+ fireEvent.click(container.querySelector('[data-testid="day-2026-01-22"]') as HTMLElement)
415
+
416
+ expect(scrollTo).toHaveBeenCalledWith(expect.objectContaining({ behavior: "smooth" }))
417
+ })
418
+
419
+ it("lets prefers-reduced-motion win over an explicit revealBehavior", () => {
420
+ Object.defineProperty(window, "matchMedia", {
421
+ writable: true,
422
+ value: vi.fn().mockReturnValue({ matches: true }),
423
+ })
424
+ const scrollTo = vi.fn()
425
+ HTMLElement.prototype.scrollTo = scrollTo
426
+ const { container } = render(
427
+ <ScheduleRoot
428
+ data={[]}
429
+ defaultView="month"
430
+ now={NOW}
431
+ timeZone="UTC"
432
+ revealBehavior="smooth"
433
+ />,
434
+ )
435
+ fireEvent.click(container.querySelector('[data-testid="day-2026-01-22"]') as HTMLElement)
436
+
437
+ // The prop can ask for motion; it cannot override someone asking for none.
438
+ expect(scrollTo).toHaveBeenCalledWith(expect.objectContaining({ behavior: "auto" }))
439
+ })
440
+
441
+ it("does not scroll on a page turn", () => {
442
+ // Under reduced motion the grid renders no outgoing band, so the reveal's
443
+ // own `[data-page-exiting]` guard is out of the picture and the navigation
444
+ // flag is the only thing left that can suppress this. Without that
445
+ // isolation the test would pass for the wrong reason.
446
+ Object.defineProperty(window, "matchMedia", {
447
+ writable: true,
448
+ value: vi.fn().mockReturnValue({ matches: true }),
449
+ })
450
+ const scrollTo = vi.fn()
451
+ HTMLElement.prototype.scrollTo = scrollTo
452
+ render(<ScheduleRoot data={[]} now={NOW} timeZone="UTC" view="days" />)
453
+
454
+ fireEvent.click(screen.getByRole("button", { name: "Next" }))
455
+ fireEvent.click(screen.getByRole("button", { name: "Previous" }))
456
+
457
+ // Paging away and being dragged back is the exact yank the reveal rule
458
+ // exists to avoid.
459
+ expect(scrollTo).not.toHaveBeenCalled()
460
+ })
461
+
462
+ it("lets the Now button do its own scrolling, exactly once", () => {
463
+ const scrollTo = mockScroll()
464
+ // Anchored a day off today, so the Now click is a real date change — the
465
+ // shape that would arm a day reveal if the button were not marked as
466
+ // navigation. The now-marker is rendered (today is in this window), so
467
+ // Now's own both-axis scroll onto it runs.
468
+ render(
469
+ <ScheduleRoot
470
+ data={[]}
471
+ now={NOW}
472
+ timeZone="UTC"
473
+ view="days"
474
+ defaultDate={day(2026, 0, 13)}
475
+ />,
476
+ )
477
+ scrollTo.mockClear()
478
+
479
+ fireEvent.click(screen.getByRole("button", { name: "Now" }))
480
+
481
+ // Exactly one: a second, competing inline scroll on the next commit would
482
+ // abort this one partway through its smooth animation.
483
+ expect(scrollTo).toHaveBeenCalledTimes(1)
484
+ })
485
+
486
+ it("does not scroll when a controlled `date` is re-created on every render", () => {
487
+ const scrollTo = mockScroll()
488
+ const Harness = () => {
489
+ const [, force] = useState(0)
490
+ return (
491
+ <>
492
+ <button type="button" onClick={() => force((n) => n + 1)}>
493
+ rerender
494
+ </button>
495
+ {/* A fresh `Date` object every render, same calendar day — the shape
496
+ a consumer writing `date={new Date(iso)}` produces. */}
497
+ <ScheduleRoot
498
+ data={[]}
499
+ now={NOW}
500
+ timeZone="UTC"
501
+ view="days"
502
+ date={new Date(NOW.getTime())}
503
+ />
504
+ </>
505
+ )
506
+ }
507
+ render(<Harness />)
508
+ fireEvent.click(screen.getByRole("button", { name: "rerender" }))
509
+ fireEvent.click(screen.getByRole("button", { name: "rerender" }))
510
+
511
+ expect(scrollTo).not.toHaveBeenCalled()
512
+ })
513
+
514
+ it("lets a selection in the same commit win over the day underneath it", () => {
515
+ // `goTo("day")(event)` moves `selected`, `date` and `view` at once. The
516
+ // event is the more specific target, so its own date axis must still run —
517
+ // if the day reveal had clobbered it, the anchor would never move.
518
+ const onDateChange = vi.fn()
519
+ const far: ScheduleEvent[] = [
520
+ {
521
+ kind: "event",
522
+ id: "far",
523
+ title: "Far away",
524
+ start: day(2026, 2, 3, 9),
525
+ end: day(2026, 2, 3, 10),
526
+ },
527
+ ]
528
+ const { rerender } = render(
529
+ <ScheduleRoot data={far} now={NOW} timeZone="UTC" view="days" onDateChange={onDateChange} />,
530
+ )
531
+ rerender(
532
+ <ScheduleRoot
533
+ data={far}
534
+ now={NOW}
535
+ timeZone="UTC"
536
+ view="days"
537
+ date={day(2026, 0, 20)}
538
+ selected="far"
539
+ onDateChange={onDateChange}
540
+ />,
541
+ )
542
+
543
+ expect(onDateChange).toHaveBeenCalledWith(far[0]?.start)
544
+ })
545
+ })
546
+
547
+ describe("ScheduleRoot — scroll-to-now", () => {
548
+ // jsdom implements neither `Element#scrollTo` nor `window.matchMedia` (same
549
+ // limitation this file's own top-of-file comment notes for
550
+ // `setPointerCapture`/`getBoundingClientRect`) — both stubbed locally here,
551
+ // matching `lib/use-media-query.test.ts`'s own `matchMedia` mock shape.
552
+ it("scrolls the Days view's timed grid when the Now button is clicked", () => {
553
+ Object.defineProperty(window, "matchMedia", {
554
+ writable: true,
555
+ value: vi.fn().mockReturnValue({ matches: false }),
556
+ })
557
+ const scrollTo = vi.fn()
558
+ HTMLElement.prototype.scrollTo = scrollTo
559
+
560
+ render(<ScheduleRoot data={[]} now={NOW} timeZone="UTC" view="days" />)
561
+ fireEvent.click(screen.getByRole("button", { name: "Now" }))
562
+
563
+ expect(scrollTo).toHaveBeenCalledWith(
564
+ expect.objectContaining({ top: expect.any(Number), behavior: "smooth" }),
565
+ )
566
+ })
567
+
568
+ it("respects prefers-reduced-motion — an instant jump, not a smooth scroll", () => {
569
+ Object.defineProperty(window, "matchMedia", {
570
+ writable: true,
571
+ value: vi.fn().mockReturnValue({ matches: true }),
572
+ })
573
+ const scrollTo = vi.fn()
574
+ HTMLElement.prototype.scrollTo = scrollTo
575
+
576
+ render(<ScheduleRoot data={[]} now={NOW} timeZone="UTC" view="days" />)
577
+ fireEvent.click(screen.getByRole("button", { name: "Now" }))
578
+
579
+ expect(scrollTo).toHaveBeenCalledWith(expect.objectContaining({ behavior: "auto" }))
580
+ })
581
+
582
+ it("does not scroll when the active view has no timed grid (Month)", () => {
583
+ Object.defineProperty(window, "matchMedia", {
584
+ writable: true,
585
+ value: vi.fn().mockReturnValue({ matches: false }),
586
+ })
587
+ const scrollTo = vi.fn()
588
+ HTMLElement.prototype.scrollTo = scrollTo
589
+
590
+ render(<ScheduleRoot data={[]} now={NOW} timeZone="UTC" view="month" />)
591
+ fireEvent.click(screen.getByRole("button", { name: "Now" }))
592
+
593
+ expect(scrollTo).not.toHaveBeenCalled()
594
+ })
595
+ })
596
+
597
+ describe("ScheduleRoot — the now-cursor is scoped to the painted window", () => {
598
+ // Host-local by construction, unlike this file's UTC-based `day()` helper,
599
+ // and with no `timeZone` prop: the now-cursor's position and its window
600
+ // gate both read the host's own clock by design (RFC §14, and
601
+ // `clockTimeLabel`'s note in `schedule-dates.ts`), so a UTC-built instant
602
+ // would mean a different wall-clock hour on a UTC CI box than on a Paris
603
+ // laptop and this whole block would pass or fail by timezone.
604
+ const localAt = (h: number, m = 0) => new Date(2026, 0, 15, h, m)
605
+ const LINE = '[data-schedule-part="now-indicator"]'
606
+ const LABEL = '[data-schedule-part="now-indicator-label"]'
607
+
608
+ it("draws the marker, the cross-day guide and the clock label inside [startHour, endHour)", () => {
609
+ render(<ScheduleRoot data={[]} now={localAt(9, 30)} view="days" startHour={7} endHour={13} />)
610
+ expect(document.querySelectorAll(`${LINE}[data-variant="marker"]`).length).toBe(1)
611
+ expect(document.querySelectorAll(`${LINE}[data-variant="guide"]`).length).toBe(1)
612
+ expect(document.querySelector(LABEL)).not.toBeNull()
613
+ })
614
+
615
+ it("draws none of the three when now is past endHour", () => {
616
+ render(<ScheduleRoot data={[]} now={localAt(18, 50)} view="days" startHour={7} endHour={13} />)
617
+ expect(document.querySelector(LINE)).toBeNull()
618
+ expect(document.querySelector(LABEL)).toBeNull()
619
+ })
620
+
621
+ it("draws none of the three when now is before startHour", () => {
622
+ render(<ScheduleRoot data={[]} now={localAt(5, 20)} view="days" startHour={7} endHour={13} />)
623
+ expect(document.querySelector(LINE)).toBeNull()
624
+ expect(document.querySelector(LABEL)).toBeNull()
625
+ })
626
+
627
+ it("leaves the Now button working — it still navigates, it just has nothing to scroll to", () => {
628
+ // Both Now handlers (`Schedule.Root` here, `DaysView` for the standalone
629
+ // view) already guard on their own `nowRef.current`, so a cursor that
630
+ // doesn't render degrades to "navigate without re-centering" rather than
631
+ // throwing on a null node — pinned here so that guard can't be dropped.
632
+ Object.defineProperty(window, "matchMedia", {
633
+ writable: true,
634
+ value: vi.fn().mockReturnValue({ matches: false }),
635
+ })
636
+ const scrollTo = vi.fn()
637
+ HTMLElement.prototype.scrollTo = scrollTo
638
+ const onDateChange = vi.fn()
639
+
640
+ render(
641
+ <ScheduleRoot
642
+ data={[]}
643
+ now={localAt(18, 50)}
644
+ view="days"
645
+ startHour={7}
646
+ endHour={13}
647
+ onDateChange={onDateChange}
648
+ />,
649
+ )
650
+ expect(() => fireEvent.click(screen.getByRole("button", { name: "Now" }))).not.toThrow()
651
+
652
+ expect(onDateChange).toHaveBeenCalledTimes(1)
653
+ expect(scrollTo).not.toHaveBeenCalled()
654
+ expect(document.querySelector(LINE)).toBeNull()
655
+ })
656
+ })
657
+
658
+ describe("ScheduleRoot — event interaction", () => {
659
+ // The static chip is a plain `<button onClick>` (no drag hook, no pointer
660
+ // capture) — jsdom doesn't implement `setPointerCapture`, which the
661
+ // interactive chip's click-detection goes through, so this is the
662
+ // jsdom-safe way to exercise `onSelect` without faking a full gesture.
663
+ it("fires onSelect when a static chip is clicked", () => {
664
+ const onSelect = vi.fn()
665
+ render(
666
+ <ScheduleRoot
667
+ data={[]}
668
+ staticEvents={STATIC_EVENTS}
669
+ now={NOW}
670
+ timeZone="UTC"
671
+ onSelect={onSelect}
672
+ />,
673
+ )
674
+ fireEvent.click(screen.getByTestId("s1"))
675
+ expect(onSelect).toHaveBeenCalledWith(expect.objectContaining({ id: "s1" }))
676
+ })
677
+
678
+ it("fires onDayClick when a day header is clicked", () => {
679
+ const onDayClick = vi.fn()
680
+ render(<ScheduleRoot data={[]} now={NOW} timeZone="UTC" onDayClick={onDayClick} />)
681
+ const headers = document.querySelectorAll('[data-schedule-part="timed-grid"] button')
682
+ expect(headers.length).toBeGreaterThan(0)
683
+ fireEvent.click(headers[0] as HTMLElement)
684
+ expect(onDayClick).toHaveBeenCalledTimes(1)
685
+ })
686
+
687
+ it("fires onEventRemove on the click itself, not after the exit", () => {
688
+ // Deliberately synchronous. This used to be deferred until Ark Presence
689
+ // reported the exit animation finished, which meant the consumer learned
690
+ // about a removal ~140ms late and only ever for the built-in button. The
691
+ // exit is now driven by the event leaving `data`, so the callback is free
692
+ // to fire immediately.
693
+ const onEventRemove = vi.fn()
694
+ render(
695
+ <ScheduleRoot
696
+ data={EVENTS}
697
+ now={NOW}
698
+ timeZone="UTC"
699
+ editable={["remove"]}
700
+ onEventRemove={onEventRemove}
701
+ />,
702
+ )
703
+ fireEvent.click(screen.getByRole("button", { name: "Remove event" }))
704
+ expect(onEventRemove).toHaveBeenCalledWith(expect.objectContaining({ id: "e1" }))
705
+ })
706
+
707
+ /** The flip side of driving the exit from `data`: a consumer that ignores
708
+ * `onEventRemove` keeps its event, rather than being left with an invisible
709
+ * chip the way the old deferred path did. */
710
+ it("keeps the event when the consumer does not remove it", () => {
711
+ render(
712
+ <ScheduleRoot
713
+ data={EVENTS}
714
+ now={NOW}
715
+ timeZone="UTC"
716
+ editable={["remove"]}
717
+ onEventRemove={() => {}}
718
+ />,
719
+ )
720
+ fireEvent.click(screen.getByRole("button", { name: "Remove event" }))
721
+ const chip = screen.getByTestId("e1")
722
+ expect(chip.getAttribute("data-state")).not.toBe("closed")
723
+ })
724
+
725
+ /**
726
+ * Regression: `present` used to be local `useState` on each chip, and a
727
+ * multi-day event renders one chip *per day column* — so clicking one `x`
728
+ * animated that piece while its siblings vanished the moment the consumer's
729
+ * `data` update landed. The state lives on the grid now, keyed by event id.
730
+ *
731
+ * The second assertion is the other half of that move: every piece reports a
732
+ * completed exit, so without a guard the removal would commit once per piece.
733
+ */
734
+ it("exits every piece of a multi-day event together", async () => {
735
+ const spanning: ScheduleEvent[] = [
736
+ {
737
+ kind: "event",
738
+ id: "span",
739
+ title: "Conference",
740
+ start: day(2026, 0, 15, 22),
741
+ end: day(2026, 0, 16, 2),
742
+ },
743
+ ]
744
+ const onEventRemove = vi.fn()
745
+ // A real consumer: the exit is driven by the event leaving `data`, so the
746
+ // removal has to actually happen for anything to animate.
747
+ const Host = () => {
748
+ const [data, setData] = useState(spanning)
749
+ return (
750
+ <ScheduleRoot
751
+ data={data}
752
+ now={NOW}
753
+ timeZone="UTC"
754
+ editable={["remove"]}
755
+ onEventRemove={(event) => {
756
+ onEventRemove(event)
757
+ setData((current) => current.filter((e) => e.id !== event.id))
758
+ }}
759
+ />
760
+ )
761
+ }
762
+ render(<Host />)
763
+ const pieces = () => [
764
+ ...document.querySelectorAll('[data-schedule-part="event-chip"][data-event-id="span"]'),
765
+ ]
766
+ expect(pieces()).toHaveLength(2)
767
+
768
+ fireEvent.click(screen.getAllByRole("button", { name: "Remove event" })[0] as HTMLElement)
769
+ expect(onEventRemove).toHaveBeenCalledTimes(1)
770
+
771
+ // Both pieces are kept mounted as outgoing copies and exit together — the
772
+ // regression this guards is one piece animating while its siblings vanish.
773
+ await waitFor(() => {
774
+ const p = pieces()
775
+ expect(p).toHaveLength(2)
776
+ expect(p.every((el) => el.getAttribute("data-state") === "closed")).toBe(true)
777
+ })
778
+ })
779
+ })
780
+
781
+ describe("ScheduleRoot — all-day row", () => {
782
+ const midnightUtc = (y: number, m: number, d: number) => new Date(Date.UTC(y, m, d))
783
+
784
+ it("renders no all-day row when there's no all-day event", () => {
785
+ render(<ScheduleRoot data={EVENTS} now={NOW} timeZone="UTC" />)
786
+ expect(document.querySelector('[data-schedule-part="all-day-row"]')).toBeNull()
787
+ })
788
+
789
+ it("renders a single-day all-day event as a one-column bar", () => {
790
+ const conference: ScheduleEvent = {
791
+ kind: "event",
792
+ id: "ad1",
793
+ title: "Conference",
794
+ allDay: true,
795
+ start: midnightUtc(2026, 0, 15),
796
+ end: midnightUtc(2026, 0, 16),
797
+ }
798
+ render(<ScheduleRoot data={[conference]} now={NOW} timeZone="UTC" />)
799
+ const bar = screen.getByTestId("ad1") as HTMLElement
800
+ const [start, end] = bar.style.gridColumn.split("/").map((s) => Number.parseInt(s.trim(), 10))
801
+ expect((end as number) - (start as number)).toBe(1)
802
+ })
803
+
804
+ it("spans a multi-day all-day event across every day column it covers", () => {
805
+ const conference: ScheduleEvent = {
806
+ kind: "event",
807
+ id: "ad1",
808
+ title: "Conference",
809
+ allDay: true,
810
+ start: midnightUtc(2026, 0, 15),
811
+ end: midnightUtc(2026, 0, 17), // two days: Jan 15 – 16
812
+ }
813
+ render(<ScheduleRoot data={[conference]} now={NOW} timeZone="UTC" />)
814
+ const bar = screen.getByTestId("ad1") as HTMLElement
815
+ const [start, end] = bar.style.gridColumn.split("/").map((s) => Number.parseInt(s.trim(), 10))
816
+ expect((end as number) - (start as number)).toBe(2)
817
+ })
818
+
819
+ it("fires onSelect when an all-day bar is clicked", () => {
820
+ const onSelect = vi.fn()
821
+ const conference: ScheduleEvent = {
822
+ kind: "event",
823
+ id: "ad1",
824
+ title: "Conference",
825
+ allDay: true,
826
+ start: midnightUtc(2026, 0, 15),
827
+ end: midnightUtc(2026, 0, 16),
828
+ }
829
+ render(<ScheduleRoot data={[conference]} now={NOW} timeZone="UTC" onSelect={onSelect} />)
830
+ fireEvent.click(screen.getByTestId("ad1"))
831
+ expect(onSelect).toHaveBeenCalledWith(expect.objectContaining({ id: "ad1" }))
832
+ })
833
+
834
+ it('caps the total row count at maxAllDayRows, promoting a lone daily overflow to a real bar and collapsing 2+ into a "+N"', () => {
835
+ // `blocker` (3 days, longest) is the sole survivor once maxAllDayRows=2
836
+ // forces a reduction to 1 real lane. Jan 15 then has only "p" left over
837
+ // (promoted to a real bar, not a wasteful "+1"); Jan 16 has both "q" and
838
+ // "r" left over (a genuine "+2").
839
+ const blocker: ScheduleEvent = {
840
+ kind: "event",
841
+ id: "blocker",
842
+ title: "Blocker",
843
+ allDay: true,
844
+ start: midnightUtc(2026, 0, 15),
845
+ end: midnightUtc(2026, 0, 18),
846
+ }
847
+ const p: ScheduleEvent = {
848
+ kind: "event",
849
+ id: "p",
850
+ title: "P",
851
+ allDay: true,
852
+ start: midnightUtc(2026, 0, 15),
853
+ end: midnightUtc(2026, 0, 16),
854
+ }
855
+ const q: ScheduleEvent = {
856
+ kind: "event",
857
+ id: "q",
858
+ title: "Q",
859
+ allDay: true,
860
+ start: midnightUtc(2026, 0, 16),
861
+ end: midnightUtc(2026, 0, 17),
862
+ }
863
+ const r: ScheduleEvent = { ...q, id: "r", title: "R" }
864
+ render(<ScheduleRoot data={[blocker, p, q, r]} now={NOW} timeZone="UTC" maxAllDayRows={2} />)
865
+
866
+ expect(
867
+ document.querySelector('[data-schedule-part="all-day-event"][data-testid="blocker"]'),
868
+ ).not.toBeNull()
869
+ // "p" is the only thing left over on its day — promoted to a real bar,
870
+ // not a wasteful "+1".
871
+ expect(
872
+ document.querySelector('[data-schedule-part="all-day-event"][data-testid="p"]'),
873
+ ).not.toBeNull()
874
+ expect(screen.queryByText("+1")).toBeNull()
875
+ // "q" and "r" share a day, so together they collapse into a real "+2" —
876
+ // never rendered as their own bars, only inside the "+N" menu's (closed)
877
+ // content, so excluded by scoping to the bar part.
878
+ expect(
879
+ document.querySelector('[data-schedule-part="all-day-event"][data-testid="q"]'),
880
+ ).toBeNull()
881
+ expect(
882
+ document.querySelector('[data-schedule-part="all-day-event"][data-testid="r"]'),
883
+ ).toBeNull()
884
+ expect(screen.getByText("+2")).toBeTruthy()
885
+ // Row count itself must never exceed maxAllDayRows (2): the "All day"
886
+ // gutter label spans exactly that many grid rows. Offset by 1 (starts at
887
+ // row 2, not row 1) since the all-day lanes now render into the same
888
+ // shared grid as the header row above them, not a grid of their own.
889
+ const label = screen.getByText("All day")
890
+ expect((label as HTMLElement).style.gridRow).toBe("2 / 4")
891
+ })
892
+ })
893
+
894
+ describe("ScheduleRoot — overlap overflow", () => {
895
+ // maxOverlapColumns bounds the TOTAL column count (see schedule-layout.ts's
896
+ // own comment): a cluster whose natural need exceeds it is re-placed at
897
+ // one fewer real column, reserving the last one for a single overflow
898
+ // indicator spanning the *union* of every hidden event's own range — not
899
+ // one indicator per instant-by-instant change in exactly who's hidden,
900
+ // which used to fragment a cluster of staggered short events into several
901
+ // awkwardly-short, visually-colliding chips. One consequence: reducing by
902
+ // exactly one column can only free up room for one *fewer* real event, so
903
+ // a cluster's overflow is always either empty or >= 2 events — never
904
+ // exactly 1 — so unlike the all-day row (which sub-buckets overflow by
905
+ // day and can genuinely have a lone hidden event on a given day), the
906
+ // timed grid never renders a "+1"; that branch would be unreachable.
907
+ it('collapses an entire overflowing cluster into one real "+N", spanning every hidden event\'s own time range', () => {
908
+ const blocker: ScheduleEvent = {
909
+ kind: "event",
910
+ id: "blocker",
911
+ title: "Blocker",
912
+ start: day(2026, 0, 15, 9),
913
+ end: day(2026, 0, 15, 12),
914
+ }
915
+ const p: ScheduleEvent = {
916
+ kind: "event",
917
+ id: "p",
918
+ title: "P",
919
+ start: day(2026, 0, 15, 9, 5),
920
+ end: day(2026, 0, 15, 10, 30),
921
+ }
922
+ const q: ScheduleEvent = {
923
+ kind: "event",
924
+ id: "q",
925
+ title: "Q",
926
+ start: day(2026, 0, 15, 10), // overlaps both blocker and p — genuine 3-way concurrency
927
+ end: day(2026, 0, 15, 10, 35),
928
+ }
929
+ render(<ScheduleRoot data={[blocker, p, q]} now={NOW} timeZone="UTC" maxOverlapColumns={2} />)
930
+ // "blocker" is the sole real survivor once the cluster is reduced to 1
931
+ // real column (2 - 1 reserved for the overflow indicator).
932
+ expect(
933
+ document.querySelector('[data-schedule-part="event-chip"][data-testid="blocker"]'),
934
+ ).not.toBeNull()
935
+ // "p" and "q" never overlap each other directly, but both overflow the
936
+ // same (blocker's) cluster — they collapse into one shared "+2", never
937
+ // rendered as their own chips, only inside the "+N" menu's (closed)
938
+ // content.
939
+ expect(document.querySelector('[data-schedule-part="event-chip"][data-testid="p"]')).toBeNull()
940
+ expect(document.querySelector('[data-schedule-part="event-chip"][data-testid="q"]')).toBeNull()
941
+ expect(screen.queryByText("+1")).toBeNull()
942
+ expect(screen.getByText("+2")).toBeTruthy()
943
+ })
944
+ })
945
+
946
+ describe("ScheduleRoot — chip DOM order matches visual order (tab order)", () => {
947
+ // Every chip is its own independent `tabIndex={0}` stop
948
+ // (`schedule-event-chip.tsx`) — native Tab/screen-reader order always
949
+ // follows DOM order, so these lock in that DOM order tracks visual
950
+ // position (top-to-bottom, then left-to-right), not `data`/`staticEvents`'
951
+ // own array order or a layout algorithm's own internal sort priority.
952
+ const midnightUtc = (y: number, m: number, d: number) => new Date(Date.UTC(y, m, d))
953
+
954
+ it("renders timed-grid chips in start-time order regardless of the data array's own order", () => {
955
+ const early: ScheduleEvent = {
956
+ kind: "event",
957
+ id: "early",
958
+ title: "Early",
959
+ start: day(2026, 0, 15, 9),
960
+ end: day(2026, 0, 15, 9, 30),
961
+ }
962
+ const late: ScheduleEvent = {
963
+ kind: "event",
964
+ id: "late",
965
+ title: "Late",
966
+ start: day(2026, 0, 15, 11),
967
+ end: day(2026, 0, 15, 11, 30),
968
+ }
969
+ // Deliberately reversed relative to start time.
970
+ render(<ScheduleRoot data={[late, early]} now={NOW} timeZone="UTC" />)
971
+ const chips = Array.from(
972
+ document.querySelectorAll('[data-schedule-part="event-chip"]'),
973
+ ) as HTMLElement[]
974
+ expect(chips.map((el) => el.dataset["testid"])).toEqual(["early", "late"])
975
+ })
976
+
977
+ it("renders same-start real and static chips in column order, not static-before-real DOM order", () => {
978
+ const realEvent: ScheduleEvent = {
979
+ kind: "event",
980
+ id: "real",
981
+ title: "Real",
982
+ start: day(2026, 0, 15, 9),
983
+ end: day(2026, 0, 15, 10),
984
+ }
985
+ const staticEvent: ScheduleStaticEvent = {
986
+ kind: "static",
987
+ id: "static",
988
+ title: "Static",
989
+ start: day(2026, 0, 15, 9),
990
+ end: day(2026, 0, 15, 10),
991
+ }
992
+ render(
993
+ <ScheduleRoot data={[realEvent]} staticEvents={[staticEvent]} now={NOW} timeZone="UTC" />,
994
+ )
995
+ // Real events tie-break ahead of static ones at an identical instant
996
+ // (`schedule-layout.ts`'s documented rule) — "real" gets column 0
997
+ // (left), "static" gets column 1 (right). DOM order must follow that
998
+ // column order, not the old dayStatic-then-dayEvents render order, which
999
+ // used to put "static" first despite it being the visually rightmost
1000
+ // (higher-column) chip.
1001
+ const chips = Array.from(
1002
+ document.querySelectorAll('[data-schedule-part="event-chip"]'),
1003
+ ) as HTMLElement[]
1004
+ expect(chips.map((el) => el.dataset["testid"])).toEqual(["real", "static"])
1005
+ })
1006
+
1007
+ it("renders all-day bars in lane-then-column order, not computeAllDayLayout's own duration-first order", () => {
1008
+ // `computeAllDayLayout` sweeps longest-duration first: "a" (4 days)
1009
+ // placed before "b" (3 days) before "c" (1 day). "a" and "b" genuinely
1010
+ // overlap (both start Jan 15), so "b" is bumped to lane 1; "c" starts
1011
+ // exactly when both "a" and "b" end, so it freely reuses the lowest
1012
+ // open lane — lane 0, alongside "a". `bars`' own sweep-order array is
1013
+ // therefore `[a, b, c]`, but the correct top-to-bottom/left-to-right
1014
+ // visual order is `[a, c, b]` — lane 0's "a" then "c" (a is left of c
1015
+ // within that shared lane), only then lane 1's "b". This is a real
1016
+ // divergence a "just sort by duration" render (the old behavior) gets
1017
+ // wrong: it would render "b" before "c" despite "b" sitting one row
1018
+ // below.
1019
+ const a: ScheduleEvent = {
1020
+ kind: "event",
1021
+ id: "a",
1022
+ title: "A",
1023
+ allDay: true,
1024
+ start: midnightUtc(2026, 0, 15),
1025
+ end: midnightUtc(2026, 0, 19),
1026
+ }
1027
+ const b: ScheduleEvent = {
1028
+ kind: "event",
1029
+ id: "b",
1030
+ title: "B",
1031
+ allDay: true,
1032
+ start: midnightUtc(2026, 0, 15),
1033
+ end: midnightUtc(2026, 0, 18),
1034
+ }
1035
+ const c: ScheduleEvent = {
1036
+ kind: "event",
1037
+ id: "c",
1038
+ title: "C",
1039
+ allDay: true,
1040
+ start: midnightUtc(2026, 0, 19),
1041
+ end: midnightUtc(2026, 0, 20),
1042
+ }
1043
+ // `align="relative"` anchors the window at `now` itself (Jan 15) rather
1044
+ // than snapping back to the locale's own start-of-week — otherwise the
1045
+ // default week-start snap could exclude "c" (Jan 19-20) from the visible
1046
+ // window entirely.
1047
+ render(
1048
+ <ScheduleRoot
1049
+ data={[a, b, c]}
1050
+ now={NOW}
1051
+ timeZone="UTC"
1052
+ view="days"
1053
+ visibleDays={7}
1054
+ align="relative"
1055
+ />,
1056
+ )
1057
+ const bars = Array.from(
1058
+ document.querySelectorAll('[data-schedule-part="all-day-event"]'),
1059
+ ) as HTMLElement[]
1060
+ expect(bars.map((el) => el.dataset["testid"])).toEqual(["a", "c", "b"])
1061
+ })
1062
+ })
1063
+
1064
+ /**
1065
+ * #237: a browser restarts a node's CSS animations when it is re-inserted, and
1066
+ * the DOM-order sort above re-inserts a chip whenever two of them swap order.
1067
+ * The entrance class must be gone by then. jsdom plays no animations, so the
1068
+ * end of the entrance is fired by hand — under its WebKit name, because jsdom
1069
+ * has no `AnimationEvent` and React then listens for `webkitAnimationEnd`
1070
+ * instead, which a plain `fireEvent.animationEnd` never reaches.
1071
+ */
1072
+ describe("ScheduleEventChip — entrance plays once per mount", () => {
1073
+ const ENTRANCE = "animate-schedule-chip-in"
1074
+ const animationEnd = (el: Element) =>
1075
+ fireEvent(el, new Event("webkitAnimationEnd", { bubbles: true }))
1076
+ const pair = <K extends "event" | "static">(kind: K, bStart: number) => [
1077
+ { kind, id: "a", title: "A", start: day(2026, 0, 15, 14), end: day(2026, 0, 15, 16) },
1078
+ {
1079
+ kind,
1080
+ id: "b",
1081
+ title: "B",
1082
+ start: day(2026, 0, 15, 14, bStart),
1083
+ end: day(2026, 0, 15, 14, 45),
1084
+ },
1085
+ ]
1086
+ const order = () =>
1087
+ (
1088
+ Array.from(document.querySelectorAll('[data-schedule-part="event-chip"]')) as HTMLElement[]
1089
+ ).map((el) => el.dataset["testid"])
1090
+
1091
+ it.each([
1092
+ ["interactive", "event"],
1093
+ ["static", "static"],
1094
+ ] as const)("the %s chip does not replay its entrance when a reorder moves it", (_, kind) => {
1095
+ const at = (bStart: number) =>
1096
+ kind === "event"
1097
+ ? { data: pair("event", bStart) as ScheduleEvent[] }
1098
+ : { data: [], staticEvents: pair("static", bStart) as ScheduleStaticEvent[] }
1099
+ const props = { now: NOW, timeZone: "UTC", view: "days", visibleDays: 1 } as const
1100
+ const { rerender } = render(<ScheduleRoot {...props} {...at(30)} />)
1101
+ const a = screen.getByTestId("a")
1102
+ expect(a.className).toContain(ENTRANCE)
1103
+
1104
+ animationEnd(a)
1105
+ animationEnd(screen.getByTestId("b"))
1106
+ expect(a.className).not.toContain(ENTRANCE)
1107
+
1108
+ // B now starts with A and, being shorter, takes column 0 — the order
1109
+ // flips and React moves A's node.
1110
+ rerender(<ScheduleRoot {...props} {...at(0)} />)
1111
+ expect(order()).toEqual(["b", "a"])
1112
+ expect(screen.getByTestId("a")).toBe(a)
1113
+ expect(a.className).not.toContain(ENTRANCE)
1114
+ })
1115
+
1116
+ it("ignores an animation that ends inside the chip", () => {
1117
+ render(<ScheduleRoot data={pair("event", 30) as ScheduleEvent[]} now={NOW} timeZone="UTC" />)
1118
+ const a = screen.getByTestId("a")
1119
+ animationEnd(within(a).getByText("A"))
1120
+ expect(a.className).toContain(ENTRANCE)
1121
+ })
1122
+
1123
+ it("still plays the entrance for an event added later", () => {
1124
+ const both = pair("event", 30) as ScheduleEvent[]
1125
+ const { rerender } = render(<ScheduleRoot data={both.slice(0, 1)} now={NOW} timeZone="UTC" />)
1126
+ animationEnd(screen.getByTestId("a"))
1127
+ rerender(<ScheduleRoot data={both} now={NOW} timeZone="UTC" />)
1128
+ expect(screen.getByTestId("b").className).toContain(ENTRANCE)
1129
+ })
1130
+ })
1131
+
1132
+ describe("ScheduleRoot — cascading overlap depth", () => {
1133
+ // A multi-day window's day-columns are much narrower than a single-day
1134
+ // window's one full-width column, so its cascade leans further in for
1135
+ // legibility on a busy cluster (see `schedule-timed-grid.tsx`'s
1136
+ // `DEFAULT_COLUMN_OVERLAP_PX_MULTI_DAY`) — `visibleDays={1}` keeps the
1137
+ // original, more modest default.
1138
+ it("gives a multi-day window a deeper cascade than a single-day one", () => {
1139
+ const { rerender } = render(
1140
+ <ScheduleRoot data={EVENTS} now={NOW} timeZone="UTC" view="days" visibleDays={7} />,
1141
+ )
1142
+ const weekGrid = document.querySelector('[data-schedule-part="timed-grid"]') as HTMLElement
1143
+ expect(weekGrid.style.getPropertyValue("--sch-column-overlap")).toBe("20px")
1144
+
1145
+ rerender(<ScheduleRoot data={EVENTS} now={NOW} timeZone="UTC" view="days" visibleDays={1} />)
1146
+ const dayGrid = document.querySelector('[data-schedule-part="timed-grid"]') as HTMLElement
1147
+ expect(dayGrid.style.getPropertyValue("--sch-column-overlap")).toBe("10px")
1148
+ })
1149
+ })
1150
+
1151
+ describe("ScheduleRoot — disabled slots", () => {
1152
+ it("renders the disabled overlay and blocks a keyboard-driven move", () => {
1153
+ const onEventChange = vi.fn()
1154
+ render(
1155
+ <ScheduleRoot
1156
+ data={EVENTS}
1157
+ now={NOW}
1158
+ timeZone="UTC"
1159
+ slotDisabled={() => true}
1160
+ editable={["drag"]}
1161
+ onEventChange={onEventChange}
1162
+ />,
1163
+ )
1164
+ expect(document.querySelector('[data-schedule-part="disabled-overlay"]')).not.toBeNull()
1165
+
1166
+ fireEvent.keyDown(screen.getByTestId("e1"), { key: "ArrowDown" })
1167
+ expect(onEventChange).not.toHaveBeenCalled()
1168
+ })
1169
+
1170
+ it("probes the disabled overlay in the schedule's own timeZone, not the host's", () => {
1171
+ // Deliberately a spy on the *instants probed*, not on the overlay's
1172
+ // geometry. A host-local probe paired with a host-local predicate drifts
1173
+ // together — `disableOutsideHours` would report the same 0-9/17-24 runs
1174
+ // either way — so geometry cannot tell the two apart, and a test asserting
1175
+ // it would pass on the bug. What the bug actually gets wrong is *which
1176
+ // hour* each run stands for, and that is visible only here.
1177
+ const probes: Date[] = []
1178
+ render(
1179
+ <ScheduleRoot
1180
+ data={[]}
1181
+ now={NOW}
1182
+ timeZone="Pacific/Kiritimati"
1183
+ startHour={0}
1184
+ endHour={24}
1185
+ visibleDays={1}
1186
+ slotDisabled={({ start }) => {
1187
+ probes.push(start)
1188
+ return false
1189
+ }}
1190
+ />,
1191
+ )
1192
+ const hourIn = (date: Date, timeZone: string) =>
1193
+ new Intl.DateTimeFormat("en-US", { timeZone, hour: "2-digit", hour12: false }).format(date)
1194
+ // The band starts at the schedule's own midnight, so the first hour probed
1195
+ // must read 00 in the schedule's zone — whatever the host's happens to be.
1196
+ expect(probes.length).toBeGreaterThan(0)
1197
+ expect(hourIn(probes[0] as Date, "Pacific/Kiritimati")).toBe("00")
1198
+ })
1199
+
1200
+ it("paints the overlay to a sub-hour boundary, not the enclosing hour", () => {
1201
+ // The whole point of probing at `slotDuration`: a schedule that opens at
1202
+ // 08:45 used to tint through to 09:00, so a bookable 15-minute strip looked
1203
+ // blocked. Enforcement was always exact — only the picture of it was not.
1204
+ const OPENS_AT = 8 * 60 + 45
1205
+ render(
1206
+ <ScheduleRoot
1207
+ data={[]}
1208
+ now={NOW}
1209
+ timeZone="UTC"
1210
+ startHour={7}
1211
+ endHour={13}
1212
+ slotDuration={15}
1213
+ visibleDays={1}
1214
+ slotDisabled={({ start }) => start.getUTCHours() * 60 + start.getUTCMinutes() < OPENS_AT}
1215
+ />,
1216
+ )
1217
+ const overlays = [
1218
+ ...document.querySelectorAll<HTMLElement>('[data-schedule-part="disabled-overlay"]'),
1219
+ ]
1220
+ expect(overlays).toHaveLength(1)
1221
+ // 07:00 to 08:45 of a 07:00-13:00 band = the first 1h45m of 6h.
1222
+ expect(overlays[0]?.style.top).toBe("0%")
1223
+ expect(overlays[0]?.style.height).toBe(`${(105 / 360) * 100}%`)
1224
+ })
1225
+
1226
+ it("refuses a create drag that rolls into the next day", () => {
1227
+ // The end-to-end shape of the reported bug: two-axis create hands
1228
+ // `checkRangeCommit` a range spanning midnight, which `disableOutsideHours`
1229
+ // used to wave through because both of its ends read as inside 9-17.
1230
+ HTMLElement.prototype.setPointerCapture = vi.fn()
1231
+ HTMLElement.prototype.releasePointerCapture = vi.fn()
1232
+ const onEventCreate = vi.fn()
1233
+ render(
1234
+ <ScheduleRoot
1235
+ data={[]}
1236
+ now={NOW}
1237
+ timeZone="UTC"
1238
+ startHour={0}
1239
+ endHour={24}
1240
+ editable={["create"]}
1241
+ slotDisabled={disableOutsideHours(9, 17)}
1242
+ onEventCreate={onEventCreate}
1243
+ />,
1244
+ )
1245
+ for (const column of document.querySelectorAll<HTMLElement>(
1246
+ "[data-schedule-part='day-column'][data-day-index]",
1247
+ )) {
1248
+ const index = Number(column.dataset["dayIndex"])
1249
+ vi.spyOn(column, "getBoundingClientRect").mockReturnValue({
1250
+ top: 0,
1251
+ bottom: 2880,
1252
+ height: 2880,
1253
+ left: index * 100,
1254
+ right: index * 100 + 100,
1255
+ width: 100,
1256
+ } as DOMRect)
1257
+ }
1258
+ const columns = document.querySelectorAll<HTMLElement>("[data-schedule-part='day-column']")
1259
+ const col = columns[4] as HTMLElement
1260
+ // Thu 11:00 (1320px / 2px-per-min) in column 4, released at Fri 12:00 in
1261
+ // column 5 — inside 9-17 at both ends, and a whole night in between.
1262
+ fireEvent.pointerDown(col, {
1263
+ clientX: 450,
1264
+ clientY: 1320,
1265
+ pointerId: 1,
1266
+ button: 0,
1267
+ pointerType: "mouse",
1268
+ })
1269
+ fireEvent.pointerMove(col, { clientX: 550, clientY: 1440, pointerId: 1 })
1270
+ fireEvent.pointerUp(col, { clientX: 550, clientY: 1440, pointerId: 1 })
1271
+
1272
+ expect(onEventCreate).not.toHaveBeenCalled()
1273
+ })
1274
+
1275
+ it("hands the keyboard drag path the schedule's timeZone", () => {
1276
+ // `schedule-event-chip.tsx` is the one `checkRangeCommit` call site not
1277
+ // reached by a pointer gesture, so it gets its own guard.
1278
+ const seen: (string | undefined)[] = []
1279
+ render(
1280
+ <ScheduleRoot
1281
+ data={EVENTS}
1282
+ now={NOW}
1283
+ timeZone="Pacific/Kiritimati"
1284
+ editable={["drag"]}
1285
+ slotDisabled={(_range, timeZone) => {
1286
+ seen.push(timeZone)
1287
+ return false
1288
+ }}
1289
+ onEventChange={vi.fn(() => {})}
1290
+ />,
1291
+ )
1292
+ seen.length = 0 // drop what the disabled-overlay probe already asked
1293
+ fireEvent.keyDown(screen.getByTestId("e1"), { key: "ArrowDown" })
1294
+ expect(seen).toContain("Pacific/Kiritimati")
1295
+ expect(seen.every((zone) => zone === "Pacific/Kiritimati")).toBe(true)
1296
+ })
1297
+ })
1298
+
1299
+ describe("ScheduleRoot — slotDuration default", () => {
1300
+ it("defaults slotDuration to 15 minutes (the keyboard move step)", () => {
1301
+ const onEventChange = vi.fn()
1302
+ render(
1303
+ <ScheduleRoot
1304
+ data={EVENTS}
1305
+ now={NOW}
1306
+ timeZone="UTC"
1307
+ editable={["drag"]}
1308
+ onEventChange={onEventChange}
1309
+ />,
1310
+ )
1311
+
1312
+ fireEvent.keyDown(screen.getByTestId("e1"), { key: "ArrowDown" })
1313
+
1314
+ expect(onEventChange).toHaveBeenCalledWith(
1315
+ expect.objectContaining({ id: "e1" }),
1316
+ { start: day(2026, 0, 15, 9, 15), end: day(2026, 0, 15, 9, 45) },
1317
+ "drag",
1318
+ )
1319
+ })
1320
+ })
1321
+
1322
+ describe("ScheduleRoot — resize handle keyboard", () => {
1323
+ it("resizes only the focused edge, not also moving the whole event", () => {
1324
+ const onEventChange = vi.fn()
1325
+ // Both "drag" and "resize" granted: if propagation weren't stopped, the
1326
+ // chip body's own arrow-key move handler (gated on "drag") would also
1327
+ // fire on bubble — this needs both permissions to actually exercise
1328
+ // that failure mode, not just resize alone.
1329
+ render(
1330
+ <ScheduleRoot
1331
+ data={EVENTS}
1332
+ now={NOW}
1333
+ timeZone="UTC"
1334
+ editable={["drag", "resize"]}
1335
+ onEventChange={onEventChange}
1336
+ />,
1337
+ )
1338
+
1339
+ const endHandle = screen.getByRole("separator", { name: /Adjust end time of Standup/ })
1340
+ fireEvent.keyDown(endHandle, { key: "ArrowDown" })
1341
+
1342
+ // Only the resize handle's own commit should fire — not also the chip
1343
+ // body's keyboard-move handler via bubbling.
1344
+ expect(onEventChange).toHaveBeenCalledTimes(1)
1345
+ expect(onEventChange).toHaveBeenCalledWith(
1346
+ expect.objectContaining({ id: "e1" }),
1347
+ expect.objectContaining({ start: EVENTS[0]?.start }),
1348
+ "resize",
1349
+ )
1350
+ })
1351
+ })
1352
+
1353
+ describe("ScheduleRoot — percentage-based geometry (correction after v1 shipped)", () => {
1354
+ // Structural regression coverage for the fill-height refactor: the timed
1355
+ // row's height is now a CSS `minmax(floor, 1fr)` (not a fixed inline px
1356
+ // style on each day-column), and every chip's position is a CSS
1357
+ // percentage/`max()` expression (not a baked px number) — both readable
1358
+ // straight off inline style strings, no real layout engine needed.
1359
+ it("gives the timed row a minmax(floor, 1fr) track, not a fixed px row", () => {
1360
+ render(<ScheduleRoot data={EVENTS} now={NOW} timeZone="UTC" />)
1361
+ const innerGrid = document.querySelector(
1362
+ '[data-schedule-part="timed-grid"] > div',
1363
+ ) as HTMLElement
1364
+ expect(innerGrid.style.gridTemplateRows).toMatch(/^auto minmax\(\d+px, 1fr\)$/)
1365
+ })
1366
+
1367
+ it("no longer sets a fixed inline height on the day-column itself", () => {
1368
+ render(<ScheduleRoot data={EVENTS} now={NOW} timeZone="UTC" />)
1369
+ const col = screen.getByTestId("e1").closest('[data-schedule-part="day-column"]') as HTMLElement
1370
+ expect(col.style.height).toBe("")
1371
+ })
1372
+
1373
+ it("positions a chip with a percentage top and a content-derived one-line height floor", () => {
1374
+ render(<ScheduleRoot data={EVENTS} now={NOW} timeZone="UTC" />)
1375
+ const chip = screen.getByTestId("e1") as HTMLElement
1376
+ expect(chip.style.getPropertyValue("--sch-base-top")).toMatch(/^-?[\d.]+%$/)
1377
+ // The var carries the chip's *true* height, unfloored — the resize preview
1378
+ // does its arithmetic on it and has to start from the real value.
1379
+ expect(chip.style.getPropertyValue("--sch-base-height")).toMatch(/^[\d.]+%$/)
1380
+ // The floor lives at the use site instead: one `text-xs` line (exactly
1381
+ // 1rem at any root font-size) plus the chip's own 2px border. Was a bare
1382
+ // `18px` — the same number at a 16px root, but wrong at any other, and the
1383
+ // fixed `py-1` then ate 8px of it.
1384
+ expect(chip.className).toContain("h-[max(var(--sch-base-height),calc(1rem+2px))]")
1385
+ })
1386
+
1387
+ /**
1388
+ * Regression: the floor used to be baked into `--sch-base-height` itself,
1389
+ * and the resize preview then subtracted true pixel deltas from that already
1390
+ * floored value. Wherever one slot renders shorter than a line of content
1391
+ * (a 13-hour day in a 624px column puts a 15-minute slot at 12px against an
1392
+ * 18px floor) the preview started 6px inflated and every size after it
1393
+ * inherited the error — shrinking drew a box that jumped up on release,
1394
+ * growing one that jumped down.
1395
+ *
1396
+ * What makes it correct is that the arithmetic reads the *raw* var and the
1397
+ * `max()` wraps the result, so the preview is exactly the box the commit
1398
+ * produces. Only the formula is assertable here; that the two actually agree
1399
+ * on screen is browser-only.
1400
+ */
1401
+ it("floors the resize preview on its result, never on its input", () => {
1402
+ render(
1403
+ <ScheduleRoot
1404
+ data={EVENTS}
1405
+ now={NOW}
1406
+ timeZone="UTC"
1407
+ editable={["resize"]}
1408
+ onEventChange={() => {}}
1409
+ />,
1410
+ )
1411
+ const chip = screen.getByTestId("e1") as HTMLElement
1412
+ const preview = chip.className.split(" ").find((c) => c.startsWith("data-resizing:h-["))
1413
+ expect(preview).toBeDefined()
1414
+ // The deltas apply to the raw height...
1415
+ expect(preview).toContain(
1416
+ "calc(var(--sch-base-height)-var(--sch-resize-delta-start,0px)+var(--sch-resize-delta-end,0px))",
1417
+ )
1418
+ // ...and the floor wraps the whole thing.
1419
+ expect(preview).toMatch(/^data-resizing:h-\[max\(calc\(.*\),calc\(1rem\+2px\)\)\]$/)
1420
+ })
1421
+ })
1422
+
1423
+ /**
1424
+ * The chip decides how much of itself to show from its own *rendered* height,
1425
+ * via `@container` size queries, rather than from the floor-derived px
1426
+ * estimate it used to be passed. jsdom evaluates no container queries (same
1427
+ * caveat `data-table.test.tsx` already carries), so what is assertable here is
1428
+ * that the component ships the right containers, defaults and thresholds —
1429
+ * whether the row actually appears at the right height is browser-only.
1430
+ */
1431
+ describe("ScheduleEventChip — vertical fit", () => {
1432
+ const chipOf = (testId: string) => screen.getByTestId(testId) as HTMLElement
1433
+ const timeRowOf = (chip: HTMLElement) => chip.querySelectorAll("p")[1] as HTMLElement | undefined
1434
+
1435
+ it("makes the chip a named size container so the queries read its real height", () => {
1436
+ render(<ScheduleRoot data={EVENTS} now={NOW} timeZone="UTC" />)
1437
+ expect(chipOf("e1").className).toContain("@container-size/sch-chip")
1438
+ })
1439
+
1440
+ it("gives both chip kinds a flex column, so a static <button> can't centre its title (#236)", () => {
1441
+ render(<ScheduleRoot data={EVENTS} staticEvents={STATIC_EVENTS} now={NOW} timeZone="UTC" />)
1442
+ // The static chip stays a native button; the display is what keeps the
1443
+ // browser's vertical centring of button content off it. jsdom has no
1444
+ // layout, so the class is the most this can check — the title offsets
1445
+ // themselves were measured in Chromium (see #236's PR).
1446
+ expect(chipOf("s1").tagName).toBe("BUTTON")
1447
+ expect(chipOf("e1").tagName).toBe("DIV")
1448
+ for (const chip of [chipOf("s1"), chipOf("e1")]) {
1449
+ const tokens = chip.className.split(/\s+/)
1450
+ expect(tokens).toContain("flex")
1451
+ expect(tokens).toContain("flex-col")
1452
+ }
1453
+ })
1454
+
1455
+ it("carries no vertical padding on the root, so the queried content box can't depend on it", () => {
1456
+ render(<ScheduleRoot data={EVENTS} now={NOW} timeZone="UTC" />)
1457
+ const cls = chipOf("e1").className
1458
+ // `px-2` stays; any `py-*`/`p-*` here would make the query circular.
1459
+ expect(cls).toContain("px-2")
1460
+ expect(cls).not.toMatch(/(^|\s)-?py-/)
1461
+ expect(cls).not.toMatch(/(^|\s)-?p-\d/)
1462
+ })
1463
+
1464
+ it("renders the time row always, hidden by default, revealed only by the query", () => {
1465
+ render(<ScheduleRoot data={EVENTS} now={NOW} timeZone="UTC" />)
1466
+ const row = timeRowOf(chipOf("e1"))
1467
+ // Always in the DOM now — `hidden` is the default so an engine without
1468
+ // container-query support fails *closed*, with the title still readable.
1469
+ expect(row).toBeTruthy()
1470
+ expect(row?.className).toContain("hidden")
1471
+ expect(row?.className).toContain("[@container_sch-chip_(height>=calc(2rem+8px))]:block")
1472
+ })
1473
+
1474
+ it("keeps the full time range in the accessible name whether or not the row is shown", () => {
1475
+ render(<ScheduleRoot data={EVENTS} now={NOW} timeZone="UTC" />)
1476
+ const event = EVENTS[0] as ScheduleEvent
1477
+ // Derived, never hardcoded: `timeRangeLabel` formats host-local and the
1478
+ // suite does not pin `TZ`.
1479
+ const range = timeRangeLabel(event.start, event.end)
1480
+ expect(chipOf("e1").getAttribute("aria-label")).toBe(`${event.title}, ${range}`)
1481
+ })
1482
+
1483
+ it("keeps the one-line floor and the two-line time threshold in step", () => {
1484
+ render(<ScheduleRoot data={EVENTS} now={NOW} timeZone="UTC" />)
1485
+ const chip = chipOf("e1")
1486
+
1487
+ // The floor moved off `--sch-base-height` onto the height utilities, so
1488
+ // that is where its `rem` term is read from now.
1489
+ const floorRem = Number(/calc\((\d*\.?\d+)rem\+2px\)/.exec(chip.className)?.[1])
1490
+
1491
+ const timeCls = timeRowOf(chip)?.className ?? ""
1492
+ const [, timeRem, timePx] =
1493
+ /height>=calc\((\d*\.?\d+)rem\+(\d+)px\)/.exec(timeCls)?.map(Number) ?? []
1494
+
1495
+ const rowCls = (chip.querySelector("div") as HTMLElement).className
1496
+ const padPx = [...rowCls.matchAll(/height>=calc\(\d*\.?\d+rem\+(\d+)px\)/g)].map((m) =>
1497
+ Number(m[1]),
1498
+ )
1499
+
1500
+ // The time row needs exactly twice the text of the floor…
1501
+ expect(timeRem).toBe(2 * floorRem)
1502
+ // …plus the full vertical padding the widest band puts back on.
1503
+ expect(timePx).toBe(Math.max(...padPx))
1504
+ // And the bands must climb, never collide.
1505
+ expect(padPx).toEqual([...padPx].sort((a, b) => a - b))
1506
+ expect(new Set(padPx).size).toBe(padPx.length)
1507
+ })
1508
+
1509
+ /** Reads a `prop-<n>` utility and its `@container sch-chip` banded variants
1510
+ * off one class string, as `{ base, steps }`. The base must be preceded by
1511
+ * whitespace so a banded `…]:top-0.5` can't be mistaken for it. */
1512
+ const bandsOf = (cls: string, prop: string) => ({
1513
+ base: Number(new RegExp(`(?:^|\\s)${prop}-(\\d*\\.?\\d+)(?=\\s|$)`).exec(cls)?.[1]),
1514
+ steps: [
1515
+ ...cls.matchAll(
1516
+ new RegExp(
1517
+ `height>=calc\\((\\d*\\.?\\d+)rem\\+(\\d+)px\\)\\)\\]:${prop}-(\\d*\\.?\\d+)`,
1518
+ "g",
1519
+ ),
1520
+ ),
1521
+ ].map((m) => ({ rem: Number(m[1]), px: Number(m[2]), value: Number(m[3]) })),
1522
+ })
1523
+
1524
+ it("keeps the remove button's top offset in step with the content row's padding", () => {
1525
+ render(
1526
+ <ScheduleRoot
1527
+ data={EVENTS}
1528
+ now={NOW}
1529
+ timeZone="UTC"
1530
+ editable={["remove"]}
1531
+ onEventRemove={() => {}}
1532
+ />,
1533
+ )
1534
+ const chip = chipOf("e1")
1535
+ const row = chip.querySelector("div") as HTMLElement
1536
+ const button = chip.querySelector('[data-schedule-part="remove"]') as HTMLElement
1537
+
1538
+ const py = bandsOf(row.className, "py")
1539
+ const top = bandsOf(button.className, "top")
1540
+
1541
+ // The button's own box is exactly one line tall (`p-0.5` x2 + `size-3` =
1542
+ // 1rem), and each band's lower bound is `1rem + 2*py`. So `top === py` at
1543
+ // every band is precisely the condition under which the button ends at
1544
+ // `py + 1rem <= 1rem + 2*py <= H` — i.e. never past the chip's own bottom,
1545
+ // at any height, fractional ones inside a band included. A fixed `top-1`
1546
+ // (what this replaced) needed 1.25rem and overhung a floored chip by 3px.
1547
+ expect(top.base).toBe(py.base)
1548
+ expect(top.steps).toEqual(py.steps)
1549
+ // Guard the guard: if the bands ever stop being parsed, the equality above
1550
+ // would pass vacuously on two empty lists.
1551
+ expect(py.steps.length).toBeGreaterThan(0)
1552
+ })
1553
+ })
1554
+
1555
+ /**
1556
+ * The remove button's *presence* and the title column's `pe-5` reservation for
1557
+ * it have to be driven by the same condition. They weren't: the reservation
1558
+ * tested `onEventRemove != null`, which is never false, because every chip is
1559
+ * handed `ScheduleTimedGrid`'s own `handleEventRemove` (an unconditional
1560
+ * `useCallback` that announces, then optional-chains the consumer's handler).
1561
+ */
1562
+ describe("ScheduleEventChip — remove button space reservation", () => {
1563
+ const titleColumnOf = (chip: HTMLElement) =>
1564
+ (chip.querySelector("p") as HTMLElement).parentElement as HTMLElement
1565
+ const removeButtonOf = (chip: HTMLElement) => chip.querySelector('[data-schedule-part="remove"]')
1566
+
1567
+ it("reserves nothing on a read-only schedule, even with onEventRemove passed", () => {
1568
+ // The default configuration: no `editable` grant at all, so no button —
1569
+ // and so no reason to give up 20px of a single truncating title line.
1570
+ render(<ScheduleRoot data={EVENTS} now={NOW} timeZone="UTC" onEventRemove={() => {}} />)
1571
+ const chip = screen.getByTestId("e1") as HTMLElement
1572
+ expect(removeButtonOf(chip)).toBeNull()
1573
+ expect(titleColumnOf(chip).className).not.toContain("pe-5")
1574
+ })
1575
+
1576
+ it("reserves space whenever the button renders", () => {
1577
+ // `editable` including "remove" makes `onEventRemove` required at the type
1578
+ // level (`requiredIf`), so "granted, but no handler" isn't reachable from
1579
+ // typed code — the divergence that mattered is the other direction, above.
1580
+ render(
1581
+ <ScheduleRoot
1582
+ data={EVENTS}
1583
+ now={NOW}
1584
+ timeZone="UTC"
1585
+ editable={["remove"]}
1586
+ onEventRemove={() => {}}
1587
+ />,
1588
+ )
1589
+ const chip = screen.getByTestId("e1") as HTMLElement
1590
+ expect(removeButtonOf(chip)).not.toBeNull()
1591
+ expect(titleColumnOf(chip).className).toContain("pe-5")
1592
+ })
1593
+
1594
+ it("follows per-event narrowing, not just the schedule-level grant", () => {
1595
+ render(
1596
+ <ScheduleRoot
1597
+ data={[{ ...(EVENTS[0] as ScheduleEvent), editable: false }]}
1598
+ now={NOW}
1599
+ timeZone="UTC"
1600
+ editable={["remove"]}
1601
+ onEventRemove={() => {}}
1602
+ />,
1603
+ )
1604
+ const chip = screen.getByTestId("e1") as HTMLElement
1605
+ expect(removeButtonOf(chip)).toBeNull()
1606
+ expect(titleColumnOf(chip).className).not.toContain("pe-5")
1607
+ })
1608
+ })
1609
+
1610
+ describe("ScheduleRoot — day-boundary segmentation", () => {
1611
+ // Host-local fixtures, and no `timeZone` override, because that is what real
1612
+ // usage looks like: `ScheduleRoot` defaults to `getLocalTimeZone()` and the
1613
+ // hour axis is host-local wall-clock throughout (see `segmentEvents`' own
1614
+ // comment). Building these in UTC on a non-UTC host would test a mismatch
1615
+ // between the day buckets and the painted band rather than the clipping.
1616
+ const local = (y: number, m: number, d: number, h = 0, min = 0) => new Date(y, m, d, h, min, 0, 0)
1617
+ const MONDAY = local(2026, 0, 12, 12)
1618
+
1619
+ const overnight: ScheduleEvent[] = [
1620
+ {
1621
+ kind: "event",
1622
+ id: "night",
1623
+ title: "Night shift",
1624
+ start: local(2026, 0, 12, 22),
1625
+ end: local(2026, 0, 13, 2),
1626
+ },
1627
+ ]
1628
+
1629
+ it("renders an event crossing midnight as one piece per day, each clipped to its own column", () => {
1630
+ render(<ScheduleRoot data={overnight} now={MONDAY} view="days" />)
1631
+
1632
+ // Two pieces, not the single full-duration chip repeated per column that
1633
+ // this component rendered before `segmentEvents` existed.
1634
+ const chips = screen.getAllByTestId("night")
1635
+ expect(chips).toHaveLength(2)
1636
+
1637
+ // Monday 22:00 -> 24:00: starts at 22/24 of the day, two hours tall.
1638
+ expect(chips[0]?.style.getPropertyValue("--sch-base-top")).toBe("91.66666666666666%")
1639
+ // A bare percentage: the legibility floor is applied by the height utility,
1640
+ // not baked into the var.
1641
+ expect(chips[0]?.style.getPropertyValue("--sch-base-height")).toBe("8.333333333333332%")
1642
+ // Tuesday 00:00 -> 02:00: starts at the very top, same two hours. Before
1643
+ // segmentation this piece was drawn at 22:00 as well, with the event's
1644
+ // whole four-hour duration, overflowing its column.
1645
+ expect(chips[1]?.style.getPropertyValue("--sch-base-top")).toBe("0%")
1646
+ expect(chips[1]?.style.getPropertyValue("--sch-base-height")).toBe("8.333333333333332%")
1647
+ })
1648
+
1649
+ it("marks only the cut edges as continuing, leaving a same-day event unmarked", () => {
1650
+ render(
1651
+ <ScheduleRoot
1652
+ data={[
1653
+ ...overnight,
1654
+ {
1655
+ kind: "event",
1656
+ id: "solo",
1657
+ title: "Standup",
1658
+ start: local(2026, 0, 12, 9),
1659
+ end: local(2026, 0, 12, 10),
1660
+ },
1661
+ ]}
1662
+ now={MONDAY}
1663
+ view="days"
1664
+ />,
1665
+ )
1666
+
1667
+ const [first, second] = screen.getAllByTestId("night")
1668
+ expect(first?.dataset["continuesBefore"]).toBeUndefined()
1669
+ expect(first?.dataset["continuesAfter"]).toBe("true")
1670
+ expect(second?.dataset["continuesBefore"]).toBe("true")
1671
+ expect(second?.dataset["continuesAfter"]).toBeUndefined()
1672
+
1673
+ // `props()` drops falsy entries, so an ordinary chip's DOM is untouched.
1674
+ const solo = screen.getByTestId("solo")
1675
+ expect(solo.dataset["continuesBefore"]).toBeUndefined()
1676
+ expect(solo.dataset["continuesAfter"]).toBeUndefined()
1677
+ })
1678
+
1679
+ it("puts each resize grip only on the piece that owns that real edge", () => {
1680
+ render(
1681
+ <ScheduleRoot
1682
+ data={overnight}
1683
+ now={MONDAY}
1684
+ view="days"
1685
+ editable={["resize"]}
1686
+ onEventChange={vi.fn(() => {})}
1687
+ />,
1688
+ )
1689
+
1690
+ // The start grip lives on the first piece, the end grip on the last — so
1691
+ // neither piece offers a handle for a boundary that isn't on screen.
1692
+ expect(
1693
+ screen.getAllByRole("separator", { name: /Adjust start time of Night shift/ }),
1694
+ ).toHaveLength(1)
1695
+ expect(
1696
+ screen.getAllByRole("separator", { name: /Adjust end time of Night shift/ }),
1697
+ ).toHaveLength(1)
1698
+
1699
+ const [first, second] = screen.getAllByTestId("night")
1700
+ expect(first?.querySelectorAll("[data-schedule-part='resize-handle']")).toHaveLength(1)
1701
+ expect(second?.querySelectorAll("[data-schedule-part='resize-handle']")).toHaveLength(1)
1702
+ })
1703
+
1704
+ it("gives a three-day event a middle piece with no grips at all", () => {
1705
+ render(
1706
+ <ScheduleRoot
1707
+ data={[
1708
+ {
1709
+ kind: "event",
1710
+ id: "span",
1711
+ title: "Piscine",
1712
+ start: local(2026, 0, 12, 14),
1713
+ end: local(2026, 0, 14, 11),
1714
+ },
1715
+ ]}
1716
+ now={MONDAY}
1717
+ view="days"
1718
+ editable={["resize"]}
1719
+ onEventChange={vi.fn(() => {})}
1720
+ />,
1721
+ )
1722
+
1723
+ const [first, middle, last] = screen.getAllByTestId("span")
1724
+ expect(screen.getAllByTestId("span")).toHaveLength(3)
1725
+ expect(first?.querySelectorAll("[data-schedule-part='resize-handle']")).toHaveLength(1)
1726
+ // Owns neither real edge, so there is nothing here to grab.
1727
+ expect(middle?.querySelectorAll("[data-schedule-part='resize-handle']")).toHaveLength(0)
1728
+ expect(middle?.dataset["continuesBefore"]).toBe("true")
1729
+ expect(middle?.dataset["continuesAfter"]).toBe("true")
1730
+ expect(last?.querySelectorAll("[data-schedule-part='resize-handle']")).toHaveLength(1)
1731
+ })
1732
+
1733
+ it("renders no phantom piece for an event ending exactly at midnight", () => {
1734
+ render(
1735
+ <ScheduleRoot
1736
+ data={[
1737
+ {
1738
+ kind: "event",
1739
+ id: "exam",
1740
+ title: "Exam",
1741
+ start: local(2026, 0, 12, 21),
1742
+ end: local(2026, 0, 13, 0),
1743
+ },
1744
+ ]}
1745
+ now={MONDAY}
1746
+ view="days"
1747
+ />,
1748
+ )
1749
+ // Exclusive end: the next day's band starts exactly where this stops.
1750
+ expect(screen.getAllByTestId("exam")).toHaveLength(1)
1751
+ })
1752
+
1753
+ it("renders nothing at all for an event outside the visible hour window", () => {
1754
+ render(
1755
+ <ScheduleRoot
1756
+ data={[
1757
+ {
1758
+ kind: "event",
1759
+ id: "early",
1760
+ title: "Early",
1761
+ start: local(2026, 0, 12, 2),
1762
+ end: local(2026, 0, 12, 3),
1763
+ },
1764
+ ]}
1765
+ now={MONDAY}
1766
+ view="days"
1767
+ startHour={6}
1768
+ endHour={22}
1769
+ />,
1770
+ )
1771
+ // Previously this rendered at a negative `top`, i.e. above the grid.
1772
+ expect(screen.queryByTestId("early")).toBeNull()
1773
+ })
1774
+ })
1775
+
1776
+ describe("ScheduleRoot — keyboard day move", () => {
1777
+ const renderChip = (onEventChange: () => void, extra = {}) =>
1778
+ render(
1779
+ <ScheduleRoot
1780
+ data={EVENTS}
1781
+ now={NOW}
1782
+ timeZone="UTC"
1783
+ editable={["drag"]}
1784
+ onEventChange={onEventChange}
1785
+ {...extra}
1786
+ />,
1787
+ )
1788
+
1789
+ it("moves an event one day later on ArrowRight", () => {
1790
+ const onEventChange = vi.fn()
1791
+ renderChip(onEventChange)
1792
+ fireEvent.keyDown(screen.getByTestId("e1"), { key: "ArrowRight" })
1793
+
1794
+ expect(onEventChange).toHaveBeenCalledWith(
1795
+ expect.objectContaining({ id: "e1" }),
1796
+ { start: day(2026, 0, 16, 9), end: day(2026, 0, 16, 9, 30) },
1797
+ "drag",
1798
+ )
1799
+ })
1800
+
1801
+ it("moves an event one day earlier on ArrowLeft, keeping the time", () => {
1802
+ const onEventChange = vi.fn()
1803
+ renderChip(onEventChange)
1804
+ fireEvent.keyDown(screen.getByTestId("e1"), { key: "ArrowLeft" })
1805
+
1806
+ expect(onEventChange).toHaveBeenCalledWith(
1807
+ expect.objectContaining({ id: "e1" }),
1808
+ { start: day(2026, 0, 14, 9), end: day(2026, 0, 14, 9, 30) },
1809
+ "drag",
1810
+ )
1811
+ })
1812
+
1813
+ // Days run right-to-left under an RTL locale, so the arrow keys follow the
1814
+ // columns: Left is the next day, Right the previous one.
1815
+ it.each([
1816
+ ["ArrowLeft", 16],
1817
+ ["ArrowRight", 14],
1818
+ ])("mirrors %s under an rtl locale", (key, date) => {
1819
+ const onEventChange = vi.fn()
1820
+ render(
1821
+ <div dir="rtl">
1822
+ <IntlProvider locale="ar">
1823
+ <ScheduleRoot
1824
+ data={EVENTS}
1825
+ now={NOW}
1826
+ timeZone="UTC"
1827
+ editable={["drag"]}
1828
+ onEventChange={onEventChange}
1829
+ />
1830
+ </IntlProvider>
1831
+ </div>,
1832
+ )
1833
+ fireEvent.keyDown(screen.getByTestId("e1"), { key })
1834
+
1835
+ expect(onEventChange).toHaveBeenCalledWith(
1836
+ expect.objectContaining({ id: "e1" }),
1837
+ { start: day(2026, 0, date, 9), end: day(2026, 0, date, 9, 30) },
1838
+ "drag",
1839
+ )
1840
+ })
1841
+
1842
+ it("ignores Shift on a day move — one press is one day", () => {
1843
+ const onEventChange = vi.fn()
1844
+ renderChip(onEventChange)
1845
+ fireEvent.keyDown(screen.getByTestId("e1"), { key: "ArrowRight", shiftKey: true })
1846
+
1847
+ expect(onEventChange).toHaveBeenCalledWith(
1848
+ expect.objectContaining({ id: "e1" }),
1849
+ { start: day(2026, 0, 16, 9), end: day(2026, 0, 16, 9, 30) },
1850
+ "drag",
1851
+ )
1852
+ })
1853
+
1854
+ it("rejects a day move onto a disabled slot instead of committing it", () => {
1855
+ const onEventChange = vi.fn()
1856
+ renderChip(onEventChange, {
1857
+ slotDisabled: ({ start }: { start: Date }) => start.getUTCDate() === 16,
1858
+ })
1859
+ fireEvent.keyDown(screen.getByTestId("e1"), { key: "ArrowRight" })
1860
+
1861
+ expect(onEventChange).not.toHaveBeenCalled()
1862
+ })
1863
+
1864
+ it("leaves a day move to the chip body when the resize handle has focus", () => {
1865
+ // The handle stops propagation for Up/Down only, so Left/Right still
1866
+ // reaches the body — changing the day, not one edge.
1867
+ const onEventChange = vi.fn()
1868
+ render(
1869
+ <ScheduleRoot
1870
+ data={EVENTS}
1871
+ now={NOW}
1872
+ timeZone="UTC"
1873
+ editable={["drag", "resize"]}
1874
+ onEventChange={onEventChange}
1875
+ />,
1876
+ )
1877
+ fireEvent.keyDown(screen.getByRole("separator", { name: /Adjust end time of Standup/ }), {
1878
+ key: "ArrowRight",
1879
+ })
1880
+
1881
+ expect(onEventChange).toHaveBeenCalledWith(
1882
+ expect.objectContaining({ id: "e1" }),
1883
+ { start: day(2026, 0, 16, 9), end: day(2026, 0, 16, 9, 30) },
1884
+ "drag",
1885
+ )
1886
+ })
1887
+ })
1888
+
1889
+ describe("ScheduleRoot — cross-day drag", () => {
1890
+ /** jsdom has no layout, so the horizontal axis has to be furnished by hand:
1891
+ * give every day column a distinct, strictly-ordered 100px box. Without
1892
+ * this the columns are indistinguishable and `measureColumns` deliberately
1893
+ * reports no usable layout, which is what the last test here pins. */
1894
+ const layOutColumns = () => {
1895
+ const columns = document.querySelectorAll<HTMLElement>(
1896
+ "[data-schedule-part='day-column'][data-day-index]",
1897
+ )
1898
+ for (const column of columns) {
1899
+ const index = Number(column.dataset["dayIndex"])
1900
+ vi.spyOn(column, "getBoundingClientRect").mockReturnValue({
1901
+ height: 2880, // 2880px / 1440min = 2px per minute
1902
+ left: index * 100,
1903
+ right: index * 100 + 100,
1904
+ width: 100,
1905
+ } as DOMRect)
1906
+ }
1907
+ }
1908
+
1909
+ const dragTo = (clientX: number, clientY: number) => {
1910
+ const chip = screen.getByTestId("e1")
1911
+ fireEvent.pointerDown(chip, { clientX: 400, clientY: 100, pointerId: 1, button: 0 })
1912
+ layOutColumns()
1913
+ fireEvent.pointerMove(chip, { clientX, clientY, pointerId: 1 })
1914
+ fireEvent.pointerUp(chip, { clientX, clientY, pointerId: 1 })
1915
+ }
1916
+
1917
+ const renderGrid = (onEventChange: () => void) => {
1918
+ HTMLElement.prototype.setPointerCapture = vi.fn()
1919
+ HTMLElement.prototype.releasePointerCapture = vi.fn()
1920
+ render(
1921
+ <ScheduleRoot
1922
+ data={EVENTS}
1923
+ now={NOW}
1924
+ timeZone="UTC"
1925
+ editable={["drag"]}
1926
+ onEventChange={onEventChange}
1927
+ />,
1928
+ )
1929
+ layOutColumns()
1930
+ }
1931
+
1932
+ it("commits a day change when the pointer ends over another column", () => {
1933
+ const onEventChange = vi.fn()
1934
+ renderGrid(onEventChange)
1935
+ // "e1" sits on Thu Jan 15 — column index 4, i.e. x in [400, 500). Drop it
1936
+ // at x = 550: column 5, Fri Jan 16. Vertically unmoved.
1937
+ dragTo(550, 100)
1938
+
1939
+ expect(onEventChange).toHaveBeenCalledWith(
1940
+ expect.objectContaining({ id: "e1" }),
1941
+ { start: day(2026, 0, 16, 9), end: day(2026, 0, 16, 9, 30) },
1942
+ "drag",
1943
+ )
1944
+ })
1945
+
1946
+ it("applies both axes in one gesture, preserving duration", () => {
1947
+ const onEventChange = vi.fn()
1948
+ renderGrid(onEventChange)
1949
+ // Two columns left (Tue Jan 13) and 60px down (+30min at 2px/min).
1950
+ dragTo(250, 160)
1951
+
1952
+ expect(onEventChange).toHaveBeenCalledWith(
1953
+ expect.objectContaining({ id: "e1" }),
1954
+ { start: day(2026, 0, 13, 9, 30), end: day(2026, 0, 13, 10, 0) },
1955
+ "drag",
1956
+ )
1957
+ })
1958
+
1959
+ it("leaves the day unchanged when the pointer is over no column", () => {
1960
+ const onEventChange = vi.fn()
1961
+ renderGrid(onEventChange)
1962
+ // x = 5000 is past the last column — over nothing. The single fallback rule
1963
+ // is "the day doesn't change", never "clamp to the nearest".
1964
+ dragTo(5000, 160)
1965
+
1966
+ expect(onEventChange).toHaveBeenCalledWith(
1967
+ expect.objectContaining({ id: "e1" }),
1968
+ { start: day(2026, 0, 15, 9, 30), end: day(2026, 0, 15, 10, 0) },
1969
+ "drag",
1970
+ )
1971
+ })
1972
+
1973
+ it("keeps a rejected cross-day drop from committing", () => {
1974
+ const onEventChange = vi.fn()
1975
+ HTMLElement.prototype.setPointerCapture = vi.fn()
1976
+ render(
1977
+ <ScheduleRoot
1978
+ data={EVENTS}
1979
+ now={NOW}
1980
+ timeZone="UTC"
1981
+ editable={["drag"]}
1982
+ onEventChange={onEventChange}
1983
+ slotDisabled={({ start }) => start.getUTCDay() === 5}
1984
+ />,
1985
+ )
1986
+ layOutColumns()
1987
+ dragTo(550, 100) // Friday — disabled
1988
+
1989
+ expect(onEventChange).not.toHaveBeenCalled()
1990
+ })
1991
+
1992
+ it("falls back to a single-axis drag when the columns have no usable layout", () => {
1993
+ // No `layOutColumns()` here: every jsdom rect is identical, so a
1994
+ // naive hit-test would resolve any x to the first column and silently
1995
+ // commit a multi-day jump. `measureColumns` reports no usable layout
1996
+ // instead, and only the time changes.
1997
+ const onEventChange = vi.fn()
1998
+ HTMLElement.prototype.setPointerCapture = vi.fn()
1999
+ render(
2000
+ <ScheduleRoot
2001
+ data={EVENTS}
2002
+ now={NOW}
2003
+ timeZone="UTC"
2004
+ editable={["drag"]}
2005
+ onEventChange={onEventChange}
2006
+ />,
2007
+ )
2008
+ const chip = screen.getByTestId("e1")
2009
+ const column = chip.closest("[data-schedule-part='day-column']") as HTMLElement
2010
+ vi.spyOn(column, "getBoundingClientRect").mockReturnValue({ height: 2880 } as DOMRect)
2011
+
2012
+ fireEvent.pointerDown(chip, { clientX: 0, clientY: 100, pointerId: 1, button: 0 })
2013
+ fireEvent.pointerMove(chip, { clientX: 0, clientY: 160, pointerId: 1 })
2014
+ fireEvent.pointerUp(chip, { clientX: 0, clientY: 160, pointerId: 1 })
2015
+
2016
+ expect(onEventChange).toHaveBeenCalledWith(
2017
+ expect.objectContaining({ id: "e1" }),
2018
+ { start: day(2026, 0, 15, 9, 30), end: day(2026, 0, 15, 10, 0) },
2019
+ "drag",
2020
+ )
2021
+ })
2022
+ })
2023
+
2024
+ describe("ScheduleRoot — pointer gesture geometry measures the day-column", () => {
2025
+ // jsdom doesn't implement real layout, but `getBoundingClientRect` and
2026
+ // `setPointerCapture` are both mockable enough to exercise the actual
2027
+ // pixel→minute conversion a real drag/resize commits — the numeric
2028
+ // regression risk of the fill-height refactor (visual verification still
2029
+ // needs a real browser, per this file's own top comment).
2030
+ it("derives drag distance from the day-column's own rendered height, not the outer scrollable viewport", () => {
2031
+ HTMLElement.prototype.setPointerCapture = vi.fn()
2032
+ const onEventChange = vi.fn()
2033
+ render(
2034
+ <ScheduleRoot
2035
+ data={EVENTS}
2036
+ now={NOW}
2037
+ timeZone="UTC"
2038
+ editable={["drag"]}
2039
+ onEventChange={onEventChange}
2040
+ />,
2041
+ )
2042
+ const chip = screen.getByTestId("e1")
2043
+ const dayColumnEl = chip.closest('[data-schedule-part="day-column"]') as HTMLElement
2044
+ const timedGridEl = document.querySelector('[data-schedule-part="timed-grid"]') as HTMLElement
2045
+
2046
+ // Deliberately different, deliberately wrong-if-used heights: if drag
2047
+ // physics ever regressed back to measuring the outer scrollable
2048
+ // viewport instead of the day-column (the exact bug this fix corrects
2049
+ // — both used to resolve identically since the old `resolvePxPerMinute`
2050
+ // only ever probed a shared CSS var, never a real rendered box), this
2051
+ // test would compute a different, wrong committed time.
2052
+ vi.spyOn(timedGridEl, "getBoundingClientRect").mockReturnValue({ height: 999_999 } as DOMRect)
2053
+ vi.spyOn(dayColumnEl, "getBoundingClientRect").mockReturnValue({ height: 2880 } as DOMRect)
2054
+ // 2880px / 1440min (the default 0-24 window) = 2px/min.
2055
+
2056
+ fireEvent.pointerDown(chip, { clientY: 100, pointerId: 1, button: 0 })
2057
+ fireEvent.pointerMove(chip, { clientY: 160, pointerId: 1 }) // 60px = 30min at 2px/min
2058
+ fireEvent.pointerUp(chip, { clientY: 160, pointerId: 1 })
2059
+
2060
+ expect(onEventChange).toHaveBeenCalledWith(
2061
+ expect.objectContaining({ id: "e1" }),
2062
+ { start: day(2026, 0, 15, 9, 30), end: day(2026, 0, 15, 10, 0) },
2063
+ "drag",
2064
+ )
2065
+ })
2066
+
2067
+ it("derives resize distance from the day-column's own rendered height too", () => {
2068
+ HTMLElement.prototype.setPointerCapture = vi.fn()
2069
+ const onEventChange = vi.fn()
2070
+ render(
2071
+ <ScheduleRoot
2072
+ data={EVENTS}
2073
+ now={NOW}
2074
+ timeZone="UTC"
2075
+ editable={["resize"]}
2076
+ onEventChange={onEventChange}
2077
+ />,
2078
+ )
2079
+ const dayColumnEl = screen
2080
+ .getByTestId("e1")
2081
+ .closest('[data-schedule-part="day-column"]') as HTMLElement
2082
+ vi.spyOn(dayColumnEl, "getBoundingClientRect").mockReturnValue({ height: 2880 } as DOMRect)
2083
+
2084
+ const endHandle = screen.getByRole("separator", { name: /Adjust end time of Standup/ })
2085
+ fireEvent.pointerDown(endHandle, { clientY: 100, pointerId: 1, button: 0 })
2086
+ fireEvent.pointerMove(endHandle, { clientY: 160, pointerId: 1 }) // +30min at 2px/min
2087
+ fireEvent.pointerUp(endHandle, { clientY: 160, pointerId: 1 })
2088
+
2089
+ expect(onEventChange).toHaveBeenCalledWith(
2090
+ expect.objectContaining({ id: "e1" }),
2091
+ { start: EVENTS[0]?.start, end: day(2026, 0, 15, 10, 0) },
2092
+ "resize",
2093
+ )
2094
+ })
2095
+ })
2096
+
2097
+ describe("ScheduleRoot — onGridClick", () => {
2098
+ it("fires on a plain click (no discernible drag) on empty grid space", () => {
2099
+ HTMLElement.prototype.setPointerCapture = vi.fn()
2100
+ const onGridClick = vi.fn()
2101
+ render(<ScheduleRoot data={EVENTS} now={NOW} timeZone="UTC" onGridClick={onGridClick} />)
2102
+ const col = document.querySelector('[data-schedule-part="day-column"]') as HTMLElement
2103
+ fireEvent.pointerDown(col, { clientY: 100, pointerId: 1, button: 0, pointerType: "mouse" })
2104
+ fireEvent.pointerUp(col, { clientY: 100, pointerId: 1 })
2105
+ expect(onGridClick).toHaveBeenCalledTimes(1)
2106
+ })
2107
+
2108
+ it("does not fire when the click lands on an event chip", () => {
2109
+ HTMLElement.prototype.setPointerCapture = vi.fn()
2110
+ const onGridClick = vi.fn()
2111
+ render(<ScheduleRoot data={EVENTS} now={NOW} timeZone="UTC" onGridClick={onGridClick} />)
2112
+ const chip = screen.getByTestId("e1")
2113
+ fireEvent.pointerDown(chip, { clientY: 100, pointerId: 1, button: 0 })
2114
+ fireEvent.pointerUp(chip, { clientY: 100, pointerId: 1 })
2115
+ expect(onGridClick).not.toHaveBeenCalled()
2116
+ })
2117
+
2118
+ it("does not fire alongside a committed create-drag — mutually exclusive branches of the same click-vs-drag check", () => {
2119
+ HTMLElement.prototype.setPointerCapture = vi.fn()
2120
+ const onGridClick = vi.fn()
2121
+ const onEventCreate = vi.fn()
2122
+ render(
2123
+ <ScheduleRoot
2124
+ data={[]}
2125
+ now={NOW}
2126
+ timeZone="UTC"
2127
+ editable={["create"]}
2128
+ onEventCreate={onEventCreate}
2129
+ onGridClick={onGridClick}
2130
+ />,
2131
+ )
2132
+ const col = document.querySelector('[data-schedule-part="day-column"]') as HTMLElement
2133
+ fireEvent.pointerDown(col, { clientY: 100, pointerId: 1, button: 0, pointerType: "mouse" })
2134
+ fireEvent.pointerMove(col, { clientY: 140, pointerId: 1 }) // past CLICK_SLOP — a real drag
2135
+ fireEvent.pointerUp(col, { clientY: 140, pointerId: 1 })
2136
+ expect(onEventCreate).toHaveBeenCalledTimes(1)
2137
+ expect(onGridClick).not.toHaveBeenCalled()
2138
+ })
2139
+
2140
+ it('fires even when editable doesn\'t include "create" — dismiss is independent of create permission', () => {
2141
+ HTMLElement.prototype.setPointerCapture = vi.fn()
2142
+ const onGridClick = vi.fn()
2143
+ render(
2144
+ <ScheduleRoot
2145
+ data={EVENTS}
2146
+ now={NOW}
2147
+ timeZone="UTC"
2148
+ editable={["drag"]}
2149
+ onEventChange={() => {}}
2150
+ onGridClick={onGridClick}
2151
+ />,
2152
+ )
2153
+ const col = document.querySelector('[data-schedule-part="day-column"]') as HTMLElement
2154
+ fireEvent.pointerDown(col, { clientY: 100, pointerId: 1, button: 0, pointerType: "mouse" })
2155
+ fireEvent.pointerUp(col, { clientY: 100, pointerId: 1 })
2156
+ expect(onGridClick).toHaveBeenCalledTimes(1)
2157
+ })
2158
+ })
2159
+
2160
+ describe("DayView / WeekView — thin DaysView prefabs", () => {
2161
+ it("DayView renders exactly 1 day column, regardless of visibleDays not being settable", () => {
2162
+ render(<DayView data={EVENTS} now={NOW} timeZone="UTC" />)
2163
+ expect(document.querySelectorAll('[data-schedule-part="day-column"]')).toHaveLength(1)
2164
+ })
2165
+
2166
+ it("WeekView renders exactly 7 day columns", () => {
2167
+ render(<WeekView data={EVENTS} now={NOW} timeZone="UTC" />)
2168
+ expect(document.querySelectorAll('[data-schedule-part="day-column"]')).toHaveLength(7)
2169
+ })
2170
+
2171
+ it('both prefabs still mount as data-schedule-part="days-view" — one DaysView underneath, no separate identity', () => {
2172
+ const { unmount } = render(<DayView data={EVENTS} now={NOW} timeZone="UTC" testId="day" />)
2173
+ expect(screen.getByTestId("day").getAttribute("data-schedule-part")).toBe("days-view")
2174
+ unmount()
2175
+
2176
+ render(<WeekView data={EVENTS} now={NOW} timeZone="UTC" testId="week" />)
2177
+ expect(screen.getByTestId("week").getAttribute("data-schedule-part")).toBe("days-view")
2178
+ })
2179
+
2180
+ it("WeekView still accepts align to anchor its window", () => {
2181
+ // Thursday 2026-01-15, UTC. Monday-start week containing it is 01-12..01-18.
2182
+ const onDayClick = vi.fn()
2183
+ render(<WeekView data={EVENTS} now={NOW} timeZone="UTC" align="mon" onDayClick={onDayClick} />)
2184
+ const headers = document.querySelectorAll('[data-schedule-part="timed-grid"] button')
2185
+ fireEvent.click(headers[0] as HTMLElement)
2186
+ expect(onDayClick).toHaveBeenCalledWith(day(2026, 0, 12))
2187
+ })
2188
+
2189
+ it("DayView has no align in its public props — always anchors on the date itself", () => {
2190
+ // visibleDays===1 always behaves like align: "relative" internally
2191
+ // (schedule-dates.ts), so DayView never needs (or accepts) align —
2192
+ // it always shows `now`'s own day, matching the old standalone DayView.
2193
+ const onDayClick = vi.fn()
2194
+ render(<DayView data={EVENTS} now={NOW} timeZone="UTC" onDayClick={onDayClick} />)
2195
+ const headers = document.querySelectorAll('[data-schedule-part="timed-grid"] button')
2196
+ expect(headers).toHaveLength(1)
2197
+ fireEvent.click(headers[0] as HTMLElement)
2198
+ expect(onDayClick).toHaveBeenCalledWith(day(2026, 0, 15))
2199
+ })
2200
+
2201
+ // Pinned because `cva` composes with clsx, not tailwind-merge: a second ring
2202
+ // colour introduced here would ship alongside this one rather than replace it.
2203
+ it("rings a chip in the palette, at the kit's single tinted strength", () => {
2204
+ const { container } = render(
2205
+ <ScheduleRoot data={EVENTS} now={NOW} timeZone="UTC" view="days" visibleDays={1} />,
2206
+ )
2207
+ const chip = container.querySelector('[class*="focus-visible:ring-(--c-text)"]')
2208
+ expect(chip).not.toBeNull()
2209
+ expect(chip?.className).toContain("focus-visible:ring-(--c-text)")
2210
+ expect(chip?.className).toContain("focus-visible:ring-2")
2211
+ expect(chip?.className).not.toContain("focus-visible:ring-brand-500")
2212
+ })
2213
+ })
2214
+
2215
+ describe("ScheduleRoot — cross-day create", () => {
2216
+ /** jsdom has no layout, so the horizontal axis has to be furnished by hand —
2217
+ * the same trick the cross-day drag suite uses. `top`/`bottom` matter here
2218
+ * where they don't for a drag: a create anchors on an absolute position
2219
+ * inside the column, not on a delta. 2880px over 1440 minutes = 2px/min. */
2220
+ const layOutColumns = () => {
2221
+ for (const column of document.querySelectorAll<HTMLElement>(
2222
+ "[data-schedule-part='day-column'][data-day-index]",
2223
+ )) {
2224
+ const index = Number(column.dataset["dayIndex"])
2225
+ vi.spyOn(column, "getBoundingClientRect").mockReturnValue({
2226
+ top: 0,
2227
+ bottom: 2880,
2228
+ height: 2880,
2229
+ left: index * 100,
2230
+ right: index * 100 + 100,
2231
+ width: 100,
2232
+ } as DOMRect)
2233
+ }
2234
+ }
2235
+
2236
+ const renderGrid = (
2237
+ onEventCreate: ScheduleEventCreateHandler,
2238
+ props: Pick<ScheduleTimedProps, "slotDisabled" | "onGridClick"> & {
2239
+ maxDuration?: SlotMultiple<15>
2240
+ editable?: false
2241
+ } = {},
2242
+ ) => {
2243
+ HTMLElement.prototype.setPointerCapture = vi.fn()
2244
+ HTMLElement.prototype.releasePointerCapture = vi.fn()
2245
+ render(
2246
+ <ScheduleRoot
2247
+ data={[]}
2248
+ now={NOW}
2249
+ timeZone="UTC"
2250
+ startHour={0}
2251
+ endHour={24}
2252
+ editable={["create"]}
2253
+ onEventCreate={onEventCreate}
2254
+ {...props}
2255
+ />,
2256
+ )
2257
+ layOutColumns()
2258
+ }
2259
+
2260
+ const columnAt = (index: number) =>
2261
+ document.querySelectorAll<HTMLElement>("[data-schedule-part='day-column']")[
2262
+ index
2263
+ ] as HTMLElement
2264
+
2265
+ /** A create/resize draft piece is keyed by its own column, so the pool's
2266
+ * slot `index` is always the piece drawn over day column `index`. */
2267
+ const draftIn = (index: number) =>
2268
+ document.querySelectorAll<HTMLElement>("[data-schedule-part='create-draft']")[
2269
+ index
2270
+ ] as HTMLElement
2271
+
2272
+ it("commits one continuous range when the drag ends over a later column", () => {
2273
+ const onEventCreate = vi.fn()
2274
+ renderGrid(onEventCreate)
2275
+ // Thu Jan 15 is column 4 (x in [400, 500)); 1320px / 2 = 660min = 11:00.
2276
+ const col = columnAt(4)
2277
+ fireEvent.pointerDown(col, {
2278
+ clientX: 450,
2279
+ clientY: 1320,
2280
+ pointerId: 1,
2281
+ button: 0,
2282
+ pointerType: "mouse",
2283
+ })
2284
+ // x = 550 is column 5 (Fri Jan 16); 1440px / 2 = 720min = 12:00.
2285
+ fireEvent.pointerMove(col, { clientX: 550, clientY: 1440, pointerId: 1 })
2286
+ fireEvent.pointerUp(col, { clientX: 550, clientY: 1440, pointerId: 1 })
2287
+
2288
+ expect(onEventCreate).toHaveBeenCalledWith([
2289
+ { start: day(2026, 0, 15, 11), end: day(2026, 0, 16, 12) },
2290
+ ])
2291
+ })
2292
+
2293
+ it("commits a backwards drag as the same range, low-to-high", () => {
2294
+ const onEventCreate = vi.fn()
2295
+ renderGrid(onEventCreate)
2296
+ // Press on Fri at 12:00, release on Thu at 11:00 — the mirror of the
2297
+ // previous case, and the range must come out identical.
2298
+ const col = columnAt(5)
2299
+ fireEvent.pointerDown(col, {
2300
+ clientX: 550,
2301
+ clientY: 1440,
2302
+ pointerId: 1,
2303
+ button: 0,
2304
+ pointerType: "mouse",
2305
+ })
2306
+ fireEvent.pointerMove(col, { clientX: 450, clientY: 1320, pointerId: 1 })
2307
+ fireEvent.pointerUp(col, { clientX: 450, clientY: 1320, pointerId: 1 })
2308
+
2309
+ expect(onEventCreate).toHaveBeenCalledWith([
2310
+ { start: day(2026, 0, 15, 11), end: day(2026, 0, 16, 12) },
2311
+ ])
2312
+ })
2313
+
2314
+ it("rolls past the bottom of a column into the next day", () => {
2315
+ const onEventCreate = vi.fn()
2316
+ renderGrid(onEventCreate)
2317
+ // 2760px / 2 = 1380min = 23:00, dragged 240px (= 120min) below the band.
2318
+ const col = columnAt(4)
2319
+ fireEvent.pointerDown(col, {
2320
+ clientX: 450,
2321
+ clientY: 2760,
2322
+ pointerId: 1,
2323
+ button: 0,
2324
+ pointerType: "mouse",
2325
+ })
2326
+ fireEvent.pointerMove(col, { clientX: 450, clientY: 3000, pointerId: 1 })
2327
+ fireEvent.pointerUp(col, { clientX: 450, clientY: 3000, pointerId: 1 })
2328
+
2329
+ expect(onEventCreate).toHaveBeenCalledWith([
2330
+ { start: day(2026, 0, 15, 23), end: day(2026, 0, 16, 1) },
2331
+ ])
2332
+ })
2333
+
2334
+ it("draws one draft piece per day, squared off on the cut edges", () => {
2335
+ renderGrid(vi.fn())
2336
+ const col = columnAt(4)
2337
+ fireEvent.pointerDown(col, {
2338
+ clientX: 450,
2339
+ clientY: 2760,
2340
+ pointerId: 1,
2341
+ button: 0,
2342
+ pointerType: "mouse",
2343
+ })
2344
+ fireEvent.pointerMove(col, { clientX: 450, clientY: 3000, pointerId: 1 })
2345
+
2346
+ const thursday = draftIn(4)
2347
+ const friday = draftIn(5)
2348
+ expect(thursday.dataset["active"]).toBe("true")
2349
+ expect(friday.dataset["active"]).toBe("true")
2350
+ // Thursday holds 23:00 → midnight and continues; Friday starts at midnight
2351
+ // as a continuation and ends at the candidate's real end.
2352
+ expect(thursday.dataset["continuesAfter"]).toBe("true")
2353
+ expect(thursday.dataset["continuesBefore"]).toBeUndefined()
2354
+ expect(friday.dataset["continuesBefore"]).toBe("true")
2355
+ expect(friday.dataset["continuesAfter"]).toBeUndefined()
2356
+ expect(thursday.style.getPropertyValue("--sch-create-top")).toBe(`${(1380 / 1440) * 100}%`)
2357
+ expect(friday.style.getPropertyValue("--sch-create-top")).toBe("0%")
2358
+
2359
+ fireEvent.pointerUp(col, { clientX: 450, clientY: 3000, pointerId: 1 })
2360
+ // Every piece is cleared on release, not just the one that was pressed in.
2361
+ expect(thursday.dataset["active"]).toBeUndefined()
2362
+ expect(friday.dataset["active"]).toBeUndefined()
2363
+ })
2364
+
2365
+ it("day-qualifies the readout only once the candidate crosses a boundary", () => {
2366
+ renderGrid(vi.fn())
2367
+ const col = columnAt(4)
2368
+ const label = () =>
2369
+ draftIn(4).querySelector<HTMLElement>("[data-schedule-part='create-draft-label']")
2370
+ ?.textContent
2371
+
2372
+ fireEvent.pointerDown(col, {
2373
+ clientX: 450,
2374
+ clientY: 1320,
2375
+ pointerId: 1,
2376
+ button: 0,
2377
+ pointerType: "mouse",
2378
+ })
2379
+ fireEvent.pointerMove(col, { clientX: 450, clientY: 1440, pointerId: 1 })
2380
+ // Formatted in the schedule's own `timeZone`, so this assertion holds on
2381
+ // any host zone — which is exactly what it is here to pin.
2382
+ expect(label()).toBe("11:00 AM – 12:00 PM")
2383
+
2384
+ // Same press, now dragged onto the next column — the label has to name the
2385
+ // day, since "11:00 – 12:00" would read as a one-hour event.
2386
+ fireEvent.pointerMove(col, { clientX: 550, clientY: 1440, pointerId: 1 })
2387
+ expect(label()).toMatch(/Thu/)
2388
+ expect(label()).toMatch(/Fri/)
2389
+ })
2390
+
2391
+ it("recovers the day axis when a column is only measurable after the press", () => {
2392
+ // Every gesture snapshots `measureColumns` once at pointerdown, and one
2393
+ // zero-width column rejects the whole list. That used to pin the gesture to
2394
+ // its starting day for its entire life, even once the layout was fine a
2395
+ // frame later — the only thing that could re-measure was a page turn.
2396
+ //
2397
+ // The pressed column is laid out throughout, so the vertical anchor is
2398
+ // sound and the *only* thing under test is the day axis recovering.
2399
+ const onEventCreate = vi.fn()
2400
+ renderGrid(onEventCreate)
2401
+ let hiddenColumnLaidOut = false
2402
+ const hidden = columnAt(0)
2403
+ vi.spyOn(hidden, "getBoundingClientRect").mockImplementation(
2404
+ () =>
2405
+ ({
2406
+ top: 0,
2407
+ bottom: 2880,
2408
+ height: 2880,
2409
+ left: 0,
2410
+ right: hiddenColumnLaidOut ? 100 : 0,
2411
+ width: hiddenColumnLaidOut ? 100 : 0,
2412
+ }) as DOMRect,
2413
+ )
2414
+
2415
+ const col = columnAt(4)
2416
+ fireEvent.pointerDown(col, {
2417
+ clientX: 450,
2418
+ clientY: 1320,
2419
+ pointerId: 1,
2420
+ button: 0,
2421
+ pointerType: "mouse",
2422
+ })
2423
+ // The layout settles between the press and the first move.
2424
+ hiddenColumnLaidOut = true
2425
+ fireEvent.pointerMove(col, { clientX: 550, clientY: 1440, pointerId: 1 })
2426
+ fireEvent.pointerUp(col, { clientX: 550, clientY: 1440, pointerId: 1 })
2427
+
2428
+ expect(onEventCreate).toHaveBeenCalledWith([
2429
+ { start: day(2026, 0, 15, 11), end: day(2026, 0, 16, 12) },
2430
+ ])
2431
+ })
2432
+
2433
+ it("falls back to a single-axis create when the columns have no usable layout", () => {
2434
+ const onEventCreate = vi.fn()
2435
+ HTMLElement.prototype.setPointerCapture = vi.fn()
2436
+ render(
2437
+ <ScheduleRoot
2438
+ data={[]}
2439
+ now={NOW}
2440
+ timeZone="UTC"
2441
+ startHour={0}
2442
+ endHour={24}
2443
+ editable={["create"]}
2444
+ onEventCreate={onEventCreate}
2445
+ />,
2446
+ )
2447
+ // No `layOutColumns()` — every column reports the same box, which
2448
+ // `measureColumns` deliberately rejects rather than resolving every x to
2449
+ // column 0 and fabricating a multi-day range.
2450
+ const col = columnAt(4)
2451
+ fireEvent.pointerDown(col, {
2452
+ clientX: 450,
2453
+ clientY: 10,
2454
+ pointerId: 1,
2455
+ button: 0,
2456
+ pointerType: "mouse",
2457
+ })
2458
+ fireEvent.pointerMove(col, { clientX: 5000, clientY: 20, pointerId: 1 })
2459
+ fireEvent.pointerUp(col, { clientX: 5000, clientY: 20, pointerId: 1 })
2460
+
2461
+ const range = onEventCreate.mock.calls[0]?.[0]?.[0] as { start: Date; end: Date } | undefined
2462
+ expect(range?.start.getUTCDate()).toBe(15)
2463
+ expect(range?.end.getUTCDate()).toBe(15)
2464
+ })
2465
+
2466
+ it("stops growing at `maxDuration`, from the anchor", () => {
2467
+ const onEventCreate = vi.fn()
2468
+ renderGrid(onEventCreate, { maxDuration: 120 })
2469
+ const col = columnAt(4)
2470
+ fireEvent.pointerDown(col, {
2471
+ clientX: 450,
2472
+ clientY: 1320,
2473
+ pointerId: 1,
2474
+ button: 0,
2475
+ pointerType: "mouse",
2476
+ })
2477
+ fireEvent.pointerMove(col, { clientX: 550, clientY: 1440, pointerId: 1 })
2478
+ // The draft stops too, so it never promises what releasing won't make.
2479
+ expect(draftIn(5).dataset["active"]).toBeUndefined()
2480
+ fireEvent.pointerUp(col, { clientX: 550, clientY: 1440, pointerId: 1 })
2481
+
2482
+ expect(onEventCreate).toHaveBeenCalledWith([
2483
+ { start: day(2026, 0, 15, 11), end: day(2026, 0, 15, 13) },
2484
+ ])
2485
+ })
2486
+
2487
+ describe("with the right button", () => {
2488
+ /** Press at (x, y), drag to (toX, toY) and release — one gesture. */
2489
+ const rightDrag = (from: [number, number], to: [number, number]) => {
2490
+ const col = columnAt(Math.floor(from[0] / 100))
2491
+ fireEvent.pointerDown(col, {
2492
+ clientX: from[0],
2493
+ clientY: from[1],
2494
+ pointerId: 1,
2495
+ button: 2,
2496
+ pointerType: "mouse",
2497
+ })
2498
+ fireEvent.pointerMove(col, { clientX: to[0], clientY: to[1], pointerId: 1 })
2499
+ fireEvent.pointerUp(col, { clientX: to[0], clientY: to[1], pointerId: 1 })
2500
+ }
2501
+ /** Whether a `contextmenu` fired now would open the browser's menu. */
2502
+ const contextMenuOpens = () => fireEvent.contextMenu(window)
2503
+
2504
+ it("commits one range per day, each over the same time of day", () => {
2505
+ const onEventCreate = vi.fn()
2506
+ renderGrid(onEventCreate)
2507
+ // Thu 08:00 (960px) → Sat 16:00 (1920px).
2508
+ rightDrag([450, 960], [650, 1920])
2509
+
2510
+ expect(onEventCreate).toHaveBeenCalledTimes(1)
2511
+ expect(onEventCreate).toHaveBeenCalledWith([
2512
+ { start: day(2026, 0, 15, 8), end: day(2026, 0, 15, 16) },
2513
+ { start: day(2026, 0, 16, 8), end: day(2026, 0, 16, 16) },
2514
+ { start: day(2026, 0, 17, 8), end: day(2026, 0, 17, 16) },
2515
+ ])
2516
+ })
2517
+
2518
+ it("commits a backwards drag as the same ranges", () => {
2519
+ const onEventCreate = vi.fn()
2520
+ renderGrid(onEventCreate)
2521
+ rightDrag([650, 1920], [450, 960])
2522
+
2523
+ expect(onEventCreate).toHaveBeenCalledWith([
2524
+ { start: day(2026, 0, 15, 8), end: day(2026, 0, 15, 16) },
2525
+ { start: day(2026, 0, 16, 8), end: day(2026, 0, 16, 16) },
2526
+ { start: day(2026, 0, 17, 8), end: day(2026, 0, 17, 16) },
2527
+ ])
2528
+ })
2529
+
2530
+ it("skips the days that would be rejected", () => {
2531
+ const onEventCreate = vi.fn()
2532
+ const friday = day(2026, 0, 16)
2533
+ renderGrid(onEventCreate, {
2534
+ slotDisabled: ({ start }) => start.getUTCDate() === friday.getUTCDate(),
2535
+ })
2536
+ rightDrag([450, 960], [650, 1920])
2537
+
2538
+ expect(onEventCreate).toHaveBeenCalledWith([
2539
+ { start: day(2026, 0, 15, 8), end: day(2026, 0, 15, 16) },
2540
+ { start: day(2026, 0, 17, 8), end: day(2026, 0, 17, 16) },
2541
+ ])
2542
+ })
2543
+
2544
+ it("tints only the rejected day's draft", () => {
2545
+ const friday = day(2026, 0, 16)
2546
+ renderGrid(vi.fn(), {
2547
+ slotDisabled: ({ start }) => start.getUTCDate() === friday.getUTCDate(),
2548
+ })
2549
+ const col = columnAt(4)
2550
+ fireEvent.pointerDown(col, {
2551
+ clientX: 450,
2552
+ clientY: 960,
2553
+ pointerId: 1,
2554
+ button: 2,
2555
+ pointerType: "mouse",
2556
+ })
2557
+ fireEvent.pointerMove(col, { clientX: 650, clientY: 1920, pointerId: 1 })
2558
+
2559
+ expect([4, 5, 6].map((i) => draftIn(i).dataset["active"])).toEqual(["true", "true", "true"])
2560
+ expect([4, 5, 6].map((i) => draftIn(i).dataset["invalid"])).toEqual([
2561
+ undefined,
2562
+ "true",
2563
+ undefined,
2564
+ ])
2565
+ // Every day carries its own readout, not just the first.
2566
+ const label = (i: number) =>
2567
+ draftIn(i).querySelector("[data-schedule-part='create-draft-label']")?.textContent
2568
+ expect([4, 5, 6].map(label)).toEqual(Array(3).fill("08:00 AM – 04:00 PM"))
2569
+ fireEvent.pointerUp(col, { clientX: 650, clientY: 1920, pointerId: 1 })
2570
+ })
2571
+
2572
+ it("rejects the gesture only when every day is rejected", () => {
2573
+ const onEventCreate = vi.fn()
2574
+ renderGrid(onEventCreate, { slotDisabled: () => true })
2575
+ rightDrag([450, 960], [650, 1920])
2576
+ expect(onEventCreate).not.toHaveBeenCalled()
2577
+ })
2578
+
2579
+ it("does nothing on a still right-click", () => {
2580
+ const onEventCreate = vi.fn()
2581
+ const onGridClick = vi.fn()
2582
+ renderGrid(onEventCreate, { onGridClick })
2583
+ rightDrag([450, 960], [450, 960])
2584
+ expect(onEventCreate).not.toHaveBeenCalled()
2585
+ expect(onGridClick).not.toHaveBeenCalled()
2586
+ })
2587
+
2588
+ it("suppresses the context menu for the gesture and its trailing event only", () => {
2589
+ renderGrid(vi.fn())
2590
+ const col = columnAt(4)
2591
+ fireEvent.pointerDown(col, {
2592
+ clientX: 450,
2593
+ clientY: 960,
2594
+ pointerId: 1,
2595
+ button: 2,
2596
+ pointerType: "mouse",
2597
+ })
2598
+ // macOS/Linux: fired on press.
2599
+ expect(contextMenuOpens()).toBe(false)
2600
+ fireEvent.pointerUp(col, { clientX: 450, clientY: 1920, pointerId: 1 })
2601
+ // Windows: fired on release.
2602
+ expect(contextMenuOpens()).toBe(false)
2603
+ // A later, unrelated right-click keeps its menu.
2604
+ expect(contextMenuOpens()).toBe(true)
2605
+ })
2606
+
2607
+ it("stops suppressing at the next press when no trailing event came", () => {
2608
+ renderGrid(vi.fn())
2609
+ rightDrag([450, 960], [450, 1920])
2610
+ fireEvent.pointerDown(document.body, { button: 2, pointerId: 2 })
2611
+ expect(contextMenuOpens()).toBe(true)
2612
+ })
2613
+
2614
+ it("leaves the context menu alone without the create grant", () => {
2615
+ const onEventCreate = vi.fn()
2616
+ renderGrid(onEventCreate, { editable: false })
2617
+ const col = columnAt(4)
2618
+ fireEvent.pointerDown(col, {
2619
+ clientX: 450,
2620
+ clientY: 960,
2621
+ pointerId: 1,
2622
+ button: 2,
2623
+ pointerType: "mouse",
2624
+ })
2625
+ expect(contextMenuOpens()).toBe(true)
2626
+ fireEvent.pointerUp(col, { clientX: 450, clientY: 1920, pointerId: 1 })
2627
+ expect(onEventCreate).not.toHaveBeenCalled()
2628
+ })
2629
+ })
2630
+ })
2631
+
2632
+ describe("ScheduleRoot — cross-day resize", () => {
2633
+ const layOutColumns = () => {
2634
+ for (const column of document.querySelectorAll<HTMLElement>(
2635
+ "[data-schedule-part='day-column'][data-day-index]",
2636
+ )) {
2637
+ const index = Number(column.dataset["dayIndex"])
2638
+ vi.spyOn(column, "getBoundingClientRect").mockReturnValue({
2639
+ top: 0,
2640
+ bottom: 2880,
2641
+ height: 2880,
2642
+ left: index * 100,
2643
+ right: index * 100 + 100,
2644
+ width: 100,
2645
+ } as DOMRect)
2646
+ }
2647
+ }
2648
+
2649
+ const renderGrid = (onEventChange: () => void, maxDuration?: SlotMultiple<15>) => {
2650
+ HTMLElement.prototype.setPointerCapture = vi.fn()
2651
+ HTMLElement.prototype.releasePointerCapture = vi.fn()
2652
+ render(
2653
+ <ScheduleRoot
2654
+ data={EVENTS}
2655
+ now={NOW}
2656
+ timeZone="UTC"
2657
+ startHour={0}
2658
+ endHour={24}
2659
+ editable={["resize"]}
2660
+ onEventChange={onEventChange}
2661
+ maxDuration={maxDuration}
2662
+ />,
2663
+ )
2664
+ layOutColumns()
2665
+ }
2666
+
2667
+ /** "e1" runs 09:00–09:30, so it has both grips; the second is the end. */
2668
+ const endHandle = () =>
2669
+ screen
2670
+ .getByTestId("e1")
2671
+ .querySelectorAll<HTMLElement>("[data-schedule-part='resize-handle']")[1] as HTMLElement
2672
+
2673
+ const draftIn = (index: number) =>
2674
+ document.querySelectorAll<HTMLElement>("[data-schedule-part='create-draft']")[
2675
+ index
2676
+ ] as HTMLElement
2677
+
2678
+ it("carries the dragged edge onto another day", () => {
2679
+ const onEventChange = vi.fn()
2680
+ renderGrid(onEventChange)
2681
+ const handle = endHandle()
2682
+ // 09:30 is 570min → 1140px at 2px/min. Move to Friday (x in [500, 600)),
2683
+ // same height: a pure day change, which the vertical-only gesture could
2684
+ // not express at all.
2685
+ fireEvent.pointerDown(handle, { clientX: 450, clientY: 1140, pointerId: 1, button: 0 })
2686
+ fireEvent.pointerMove(handle, { clientX: 550, clientY: 1140, pointerId: 1 })
2687
+ fireEvent.pointerUp(handle, { clientX: 550, clientY: 1140, pointerId: 1 })
2688
+
2689
+ expect(onEventChange).toHaveBeenCalledWith(
2690
+ expect.objectContaining({ id: "e1" }),
2691
+ { start: day(2026, 0, 15, 9), end: day(2026, 0, 16, 9, 30) },
2692
+ "resize",
2693
+ )
2694
+ })
2695
+
2696
+ it("stops the dragged edge at `maxDuration`", () => {
2697
+ const onEventChange = vi.fn()
2698
+ renderGrid(onEventChange, 60)
2699
+ const handle = endHandle()
2700
+ fireEvent.pointerDown(handle, { clientX: 450, clientY: 1140, pointerId: 1, button: 0 })
2701
+ fireEvent.pointerMove(handle, { clientX: 550, clientY: 1140, pointerId: 1 })
2702
+ fireEvent.pointerUp(handle, { clientX: 550, clientY: 1140, pointerId: 1 })
2703
+
2704
+ expect(onEventChange).toHaveBeenCalledWith(
2705
+ expect.objectContaining({ id: "e1" }),
2706
+ { start: day(2026, 0, 15, 9), end: day(2026, 0, 15, 10) },
2707
+ "resize",
2708
+ )
2709
+ })
2710
+
2711
+ it("keeps the chip-stretch preview while the edge stays on its own day", () => {
2712
+ renderGrid(vi.fn())
2713
+ const handle = endHandle()
2714
+ const chip = screen.getByTestId("e1")
2715
+ fireEvent.pointerDown(handle, { clientX: 450, clientY: 1140, pointerId: 1, button: 0 })
2716
+ fireEvent.pointerMove(handle, { clientX: 450, clientY: 1260, pointerId: 1 })
2717
+
2718
+ // One delta per edge: an ordinary end resize moves only the end, so the
2719
+ // pair reduces to exactly the single-delta stretch this always was.
2720
+ expect(chip.dataset["resizing"]).toBe("true")
2721
+ expect(chip.dataset["resizingEdge"]).toBe("end")
2722
+ expect(chip.style.getPropertyValue("--sch-resize-delta-end")).toBe("120px")
2723
+ expect(chip.style.getPropertyValue("--sch-resize-delta-start")).toBe("0px")
2724
+ expect(chip.dataset["dragging"]).toBeUndefined()
2725
+ expect(draftIn(4).dataset["active"]).toBeUndefined()
2726
+ })
2727
+
2728
+ it("clamps the stretch to the day column instead of overflowing it", () => {
2729
+ // The regression this pair of vars exists for. "e1" ends 09:30; dragging
2730
+ // its end grip down by 40 hours' worth of pixels used to write that whole
2731
+ // raw delta, so the chip rendered ~4.6k px tall inside a 2880px column,
2732
+ // grew the `overflow-auto` grid's own scrollHeight, and fed the auto-
2733
+ // scroll that produced the delta in the first place.
2734
+ renderGrid(vi.fn())
2735
+ const handle = endHandle()
2736
+ const chip = screen.getByTestId("e1")
2737
+ fireEvent.pointerDown(handle, { clientX: 450, clientY: 1140, pointerId: 1, button: 0 })
2738
+ fireEvent.pointerMove(handle, { clientX: 450, clientY: 1140 + 2880 * 2, pointerId: 1 })
2739
+
2740
+ // Past the band edge, so the pieces take over and the chip holds nothing
2741
+ // — which is the strongest form of "the stretch cannot overflow".
2742
+ expect(chip.dataset["resizing"]).toBeUndefined()
2743
+ expect(chip.style.getPropertyValue("--sch-resize-delta-end")).toBe("")
2744
+ expect(chip.dataset["dragging"]).toBe("true")
2745
+ expect(draftIn(4).dataset["active"]).toBe("true")
2746
+ expect(draftIn(4).dataset["continuesAfter"]).toBe("true")
2747
+ })
2748
+
2749
+ it("keeps stretching a candidate that crosses the same band edges as before", () => {
2750
+ // A multi-day event always crosses a band edge, so "is it inside the band"
2751
+ // would hand every one of its grip nudges over to the pieces. The real
2752
+ // question is whether it crosses the *same* edges it already did.
2753
+ const onEventChange = vi.fn()
2754
+ HTMLElement.prototype.setPointerCapture = vi.fn()
2755
+ HTMLElement.prototype.releasePointerCapture = vi.fn()
2756
+ render(
2757
+ <ScheduleRoot
2758
+ data={[
2759
+ {
2760
+ kind: "event",
2761
+ id: "m1",
2762
+ title: "Retreat",
2763
+ start: day(2026, 0, 15, 9),
2764
+ end: day(2026, 0, 17, 9),
2765
+ },
2766
+ ]}
2767
+ now={NOW}
2768
+ timeZone="UTC"
2769
+ startHour={0}
2770
+ endHour={24}
2771
+ editable={["resize"]}
2772
+ onEventChange={onEventChange}
2773
+ />,
2774
+ )
2775
+ layOutColumns()
2776
+ // The Thursday piece owns the real start, so it carries the only start grip.
2777
+ const startGrip = screen.getAllByRole("separator", {
2778
+ name: /Adjust start time of Retreat/,
2779
+ })[0] as HTMLElement
2780
+ const chip = startGrip.closest<HTMLElement>("[data-schedule-part='event-chip']") as HTMLElement
2781
+ fireEvent.pointerDown(startGrip, { clientX: 450, clientY: 1080, pointerId: 1, button: 0 })
2782
+ fireEvent.pointerMove(startGrip, { clientX: 450, clientY: 1140, pointerId: 1 })
2783
+
2784
+ expect(chip.dataset["resizing"]).toBe("true")
2785
+ expect(chip.style.getPropertyValue("--sch-resize-delta-start")).toBe("60px")
2786
+ // Its own piece is clipped at midnight, so the bottom never moves.
2787
+ expect(chip.style.getPropertyValue("--sch-resize-delta-end")).toBe("0px")
2788
+ expect(chip.dataset["dragging"]).toBeUndefined()
2789
+ })
2790
+
2791
+ it("commits each resizeCollision mode's own answer at the other edge", () => {
2792
+ // Same gesture three times over: drag "e1"'s end grip up past its start.
2793
+ // 09:30 is 1140px; 08:00 is 960px, well past the 09:15 floor.
2794
+ for (const [resizeCollision, expected] of [
2795
+ ["none", { start: day(2026, 0, 15, 9), end: day(2026, 0, 15, 9, 15) }],
2796
+ ["push", { start: day(2026, 0, 15, 7, 45), end: day(2026, 0, 15, 8) }],
2797
+ ["swap", { start: day(2026, 0, 15, 8), end: day(2026, 0, 15, 9) }],
2798
+ ] as const) {
2799
+ const onEventChange = vi.fn()
2800
+ HTMLElement.prototype.setPointerCapture = vi.fn()
2801
+ HTMLElement.prototype.releasePointerCapture = vi.fn()
2802
+ const { unmount } = render(
2803
+ <ScheduleRoot
2804
+ data={EVENTS}
2805
+ now={NOW}
2806
+ timeZone="UTC"
2807
+ startHour={0}
2808
+ endHour={24}
2809
+ editable={["resize"]}
2810
+ resizeCollision={resizeCollision}
2811
+ onEventChange={onEventChange}
2812
+ />,
2813
+ )
2814
+ layOutColumns()
2815
+ const handle = endHandle()
2816
+ fireEvent.pointerDown(handle, { clientX: 450, clientY: 1140, pointerId: 1, button: 0 })
2817
+ fireEvent.pointerMove(handle, { clientX: 450, clientY: 960, pointerId: 1 })
2818
+ fireEvent.pointerUp(handle, { clientX: 450, clientY: 960, pointerId: 1 })
2819
+
2820
+ expect(onEventChange, resizeCollision).toHaveBeenCalledWith(
2821
+ expect.objectContaining({ id: "e1" }),
2822
+ expected,
2823
+ "resize",
2824
+ )
2825
+ unmount()
2826
+ }
2827
+ })
2828
+
2829
+ it("applies the resizeCollision mode to the keyboard nudge too", () => {
2830
+ // The grip's ArrowUp/Down routes through the same commit, so parity is
2831
+ // structural rather than a second implementation.
2832
+ const onEventChange = vi.fn()
2833
+ HTMLElement.prototype.setPointerCapture = vi.fn()
2834
+ render(
2835
+ <ScheduleRoot
2836
+ data={EVENTS}
2837
+ now={NOW}
2838
+ timeZone="UTC"
2839
+ startHour={0}
2840
+ endHour={24}
2841
+ editable={["resize"]}
2842
+ resizeCollision="push"
2843
+ onEventChange={onEventChange}
2844
+ />,
2845
+ )
2846
+ layOutColumns()
2847
+ const handle = endHandle()
2848
+ // `data` is uncontrolled here, so every nudge recomputes from the same
2849
+ // 09:00–09:30 — one Shift step (×4 = 60min) is what actually clears the
2850
+ // floor, where a plain 15-minute step lands exactly on it.
2851
+ fireEvent.keyDown(handle, { key: "ArrowUp", shiftKey: true })
2852
+ expect(onEventChange).toHaveBeenLastCalledWith(
2853
+ expect.objectContaining({ id: "e1" }),
2854
+ { start: day(2026, 0, 15, 8, 15), end: day(2026, 0, 15, 8, 30) },
2855
+ "resize",
2856
+ )
2857
+ })
2858
+
2859
+ it("hands the preview over to the draft pieces once the edge leaves its day", () => {
2860
+ renderGrid(vi.fn())
2861
+ const handle = endHandle()
2862
+ const chip = screen.getByTestId("e1")
2863
+ fireEvent.pointerDown(handle, { clientX: 450, clientY: 1140, pointerId: 1, button: 0 })
2864
+ fireEvent.pointerMove(handle, { clientX: 550, clientY: 1140, pointerId: 1 })
2865
+
2866
+ // The stretch can't represent a day change, so it steps back entirely
2867
+ // rather than holding a stale — and here zero — delta.
2868
+ expect(chip.dataset["resizingEdge"]).toBeUndefined()
2869
+ expect(chip.dataset["dragging"]).toBe("true")
2870
+ expect(draftIn(4).dataset["active"]).toBe("true")
2871
+ expect(draftIn(5).dataset["active"]).toBe("true")
2872
+ expect(draftIn(4).dataset["continuesAfter"]).toBe("true")
2873
+
2874
+ // Crossing back restores it — the handover is not one-way.
2875
+ fireEvent.pointerMove(handle, { clientX: 450, clientY: 1140, pointerId: 1 })
2876
+ expect(chip.dataset["resizingEdge"]).toBe("end")
2877
+ expect(chip.dataset["dragging"]).toBeUndefined()
2878
+ expect(draftIn(5).dataset["active"]).toBeUndefined()
2879
+ })
2880
+ })
2881
+
2882
+ describe("ScheduleRoot — page-turn animation", () => {
2883
+ const columns = (selector = "") =>
2884
+ document.querySelectorAll(`[data-schedule-part="day-column"][data-day-index]${selector}`).length
2885
+
2886
+ const live = () => columns(":not([data-page-exiting])")
2887
+ const exiting = () => columns("[data-page-exiting]")
2888
+
2889
+ /** jsdom's default stub never matches; a test that needs the reduced-motion
2890
+ * branch has to say so explicitly. */
2891
+ const setReducedMotion = (matches: boolean) => {
2892
+ window.matchMedia = vi.fn().mockImplementation((query: string) => ({
2893
+ matches,
2894
+ media: query,
2895
+ onchange: null,
2896
+ addListener: vi.fn(),
2897
+ removeListener: vi.fn(),
2898
+ addEventListener: vi.fn(),
2899
+ removeEventListener: vi.fn(),
2900
+ dispatchEvent: vi.fn(),
2901
+ })) as unknown as typeof window.matchMedia
2902
+ }
2903
+
2904
+ it("keeps the outgoing range mounted for one animation, then drops it", () => {
2905
+ vi.useFakeTimers()
2906
+ try {
2907
+ setReducedMotion(false)
2908
+ render(<ScheduleRoot data={EVENTS} now={NOW} timeZone="UTC" />)
2909
+ expect(live()).toBe(7)
2910
+ expect(exiting()).toBe(0)
2911
+
2912
+ fireEvent.click(screen.getByRole("button", { name: "Next" }))
2913
+ // Both bands are in the DOM together — that is the whole mechanism.
2914
+ expect(live()).toBe(7)
2915
+ expect(exiting()).toBe(7)
2916
+
2917
+ act(() => {
2918
+ vi.advanceTimersByTime(500)
2919
+ })
2920
+ expect(exiting()).toBe(0)
2921
+ expect(live()).toBe(7)
2922
+ } finally {
2923
+ vi.useRealTimers()
2924
+ }
2925
+ })
2926
+
2927
+ it("marks the outgoing band inert and hidden from assistive tech", () => {
2928
+ setReducedMotion(false)
2929
+ render(<ScheduleRoot data={EVENTS} now={NOW} timeZone="UTC" />)
2930
+ fireEvent.click(screen.getByRole("button", { name: "Next" }))
2931
+ const ghost = document.querySelector('[data-schedule-part="day-column"][data-page-exiting]')
2932
+ expect(ghost?.getAttribute("aria-hidden")).toBe("true")
2933
+ // The attribute, not the IDL property: jsdom does not reflect `inert`.
2934
+ expect(ghost?.hasAttribute("inert")).toBe(true)
2935
+ })
2936
+
2937
+ /**
2938
+ * Regression: the outgoing day-header buttons and day columns were marked
2939
+ * correctly, but the outgoing *all-day row* only ever received the leave
2940
+ * animation class — so its bars stayed focusable, announced, and carrying
2941
+ * `data-testid`s that collided with the incoming band's, for the ~220ms the
2942
+ * ghost was on screen. Only caught because looking an event up by
2943
+ * `data-event-id` needs `isLive` to be able to filter these out.
2944
+ */
2945
+ it("marks the outgoing all-day bars inert and hidden too", () => {
2946
+ setReducedMotion(false)
2947
+ const allDay: ScheduleEvent[] = [
2948
+ {
2949
+ kind: "event",
2950
+ id: "ad1",
2951
+ title: "Conference",
2952
+ // Spans the page boundary deliberately, so BOTH bands render a bar for
2953
+ // it — which is the only arrangement that tests whether a lookup by id
2954
+ // can tell the live copy from the ghost.
2955
+ start: day(2026, 0, 12),
2956
+ end: day(2026, 0, 26),
2957
+ allDay: true,
2958
+ },
2959
+ ]
2960
+ render(<ScheduleRoot data={allDay} now={NOW} timeZone="UTC" />)
2961
+ expect(document.querySelectorAll('[data-schedule-part="all-day-event"]').length).toBe(1)
2962
+
2963
+ fireEvent.click(screen.getByRole("button", { name: "Next" }))
2964
+
2965
+ const bars = [...document.querySelectorAll('[data-schedule-part="all-day-event"]')]
2966
+ const ghosts = bars.filter((el) => el.hasAttribute("data-page-exiting"))
2967
+ expect(ghosts.length).toBeGreaterThan(0)
2968
+ for (const ghost of ghosts) {
2969
+ expect(ghost.getAttribute("aria-hidden")).toBe("true")
2970
+ // The attribute, not the IDL property: jsdom does not reflect `inert`.
2971
+ expect(ghost.hasAttribute("inert")).toBe(true)
2972
+ }
2973
+ // ...and `isLive`'s selector can now tell the two copies apart by id:
2974
+ // both bands carry a bar for this event, and exactly one of them is live.
2975
+ const byId = [...document.querySelectorAll('[data-event-id="ad1"]')]
2976
+ expect(byId.length).toBeGreaterThan(1)
2977
+ expect(byId.filter((el) => el.closest("[data-page-exiting]") === null)).toHaveLength(1)
2978
+ })
2979
+
2980
+ it("does not animate a jump that isn't one page — Now, or a consumer-set date", () => {
2981
+ setReducedMotion(false)
2982
+ render(<ScheduleRoot data={EVENTS} now={NOW} timeZone="UTC" />)
2983
+ // Three pages forward, then Now: the return trip is 21 days, not 7.
2984
+ fireEvent.click(screen.getByRole("button", { name: "Next" }))
2985
+ fireEvent.click(screen.getByRole("button", { name: "Next" }))
2986
+ fireEvent.click(screen.getByRole("button", { name: "Next" }))
2987
+ fireEvent.click(screen.getByRole("button", { name: "Now" }))
2988
+ expect(exiting()).toBe(0)
2989
+ })
2990
+
2991
+ it("does not animate when the user asked for reduced motion", () => {
2992
+ setReducedMotion(true)
2993
+ render(<ScheduleRoot data={EVENTS} now={NOW} timeZone="UTC" />)
2994
+ fireEvent.click(screen.getByRole("button", { name: "Next" }))
2995
+ expect(exiting()).toBe(0)
2996
+ })
2997
+
2998
+ it("leaves exactly one live band for the gesture layer to measure", () => {
2999
+ setReducedMotion(false)
3000
+ render(<ScheduleRoot data={EVENTS} now={NOW} timeZone="UTC" />)
3001
+ fireEvent.click(screen.getByRole("button", { name: "Next" }))
3002
+ // `measureColumns` rejects a non-monotonic column list outright, so a
3003
+ // doubled band would silently degrade every two-axis gesture to one axis.
3004
+ expect(live()).toBe(7)
3005
+ const indices = [
3006
+ ...document.querySelectorAll<HTMLElement>(
3007
+ '[data-schedule-part="day-column"][data-day-index]:not([data-page-exiting])',
3008
+ ),
3009
+ ].map((el) => Number(el.dataset["dayIndex"]))
3010
+ expect(indices).toEqual([0, 1, 2, 3, 4, 5, 6])
3011
+ })
3012
+ })
3013
+
3014
+ describe("ScheduleRoot — drag preview across a day boundary", () => {
3015
+ const layOutColumns = () => {
3016
+ for (const column of document.querySelectorAll<HTMLElement>(
3017
+ "[data-schedule-part='day-column'][data-day-index]",
3018
+ )) {
3019
+ const index = Number(column.dataset["dayIndex"])
3020
+ vi.spyOn(column, "getBoundingClientRect").mockReturnValue({
3021
+ top: 0,
3022
+ bottom: 2880,
3023
+ height: 2880, // 2880px / 1440min = 2px per minute
3024
+ left: index * 100,
3025
+ right: index * 100 + 100,
3026
+ width: 100,
3027
+ } as DOMRect)
3028
+ }
3029
+ }
3030
+
3031
+ /** Every pooled ghost piece. There is one per rendered day, so a move that
3032
+ * spans two days can draw both of its pieces — but a piece is keyed by its
3033
+ * offset from the pointer's column, not by the column it is drawn over. */
3034
+ const ghosts = () => [
3035
+ ...document.querySelectorAll<HTMLElement>("[data-schedule-part='drag-ghost']"),
3036
+ ]
3037
+
3038
+ /** The active ghost piece drawn over day column `index`. */
3039
+ const ghostIn = (index: number) =>
3040
+ ghosts().find(
3041
+ (el) =>
3042
+ el.dataset["active"] === "true" &&
3043
+ el.style.getPropertyValue("--sch-ghost-col") === `${index}`,
3044
+ ) as HTMLElement
3045
+
3046
+ /** The day columns the active ghost pieces are drawn over, ascending. */
3047
+ const activeGhosts = () =>
3048
+ ghosts()
3049
+ .filter((el) => el.dataset["active"] === "true")
3050
+ .map((el) => Number(el.style.getPropertyValue("--sch-ghost-col")))
3051
+ .sort((a, b) => a - b)
3052
+
3053
+ const renderGrid = (data: ScheduleEvent[] = EVENTS) => {
3054
+ HTMLElement.prototype.setPointerCapture = vi.fn()
3055
+ HTMLElement.prototype.releasePointerCapture = vi.fn()
3056
+ render(
3057
+ <ScheduleRoot
3058
+ data={data}
3059
+ now={NOW}
3060
+ timeZone="UTC"
3061
+ startHour={0}
3062
+ endHour={24}
3063
+ editable={["drag"]}
3064
+ onEventChange={() => {}}
3065
+ />,
3066
+ )
3067
+ layOutColumns()
3068
+ }
3069
+
3070
+ it("moves the preview onto the previous day when a drag crosses the band's start", () => {
3071
+ renderGrid()
3072
+ const chip = screen.getByTestId("e1") // Thu Jan 15, 09:00 — column 4
3073
+ // 1200px up at 2px/min is 600 minutes: 09:00 back to 23:00 on *Wednesday*.
3074
+ fireEvent.pointerDown(chip, { clientX: 450, clientY: 1080, pointerId: 1, button: 0 })
3075
+ layOutColumns()
3076
+ fireEvent.pointerMove(chip, { clientX: 450, clientY: -120, pointerId: 1 })
3077
+
3078
+ // Wednesday is column 3. Reading the *host's* clock instead of the day's
3079
+ // own band put this at 96% of column 4 — the column it started in.
3080
+ expect(activeGhosts()).toEqual([3])
3081
+ expect(ghostIn(3).style.getPropertyValue("--sch-ghost-top")).toBe(`${(1380 / 1440) * 100}%`)
3082
+
3083
+ fireEvent.pointerUp(chip, { clientX: 450, clientY: -120, pointerId: 1 })
3084
+ })
3085
+
3086
+ it("draws a piece on *both* days when the move straddles midnight", () => {
3087
+ renderGrid()
3088
+ const chip = screen.getByTestId("e1") // 09:00–09:30 Thursday
3089
+ // +885 minutes puts it at 23:45–00:15, i.e. across into Friday.
3090
+ fireEvent.pointerDown(chip, { clientX: 450, clientY: 1080, pointerId: 1, button: 0 })
3091
+ layOutColumns()
3092
+ fireEvent.pointerMove(chip, { clientX: 450, clientY: 1080 + 885 * 2, pointerId: 1 })
3093
+
3094
+ // A single grid-level box could only ever draw one of these, which is what
3095
+ // made a move through midnight look like it lost its preview.
3096
+ expect(activeGhosts()).toEqual([4, 5])
3097
+ expect(ghostIn(4).dataset["continuesAfter"]).toBe("true")
3098
+ expect(ghostIn(4).dataset["continuesBefore"]).toBeUndefined()
3099
+ expect(ghostIn(5).dataset["continuesBefore"]).toBe("true")
3100
+ expect(ghostIn(5).style.getPropertyValue("--sch-ghost-top")).toBe("0%")
3101
+
3102
+ fireEvent.pointerUp(chip, { clientX: 450, clientY: 1080 + 885 * 2, pointerId: 1 })
3103
+ })
3104
+
3105
+ it("keeps the same ghost element when the move changes day", () => {
3106
+ // One element per column made every day change a fade-out on one piece and
3107
+ // a fade-in on another. Keyed by its offset from the pointer, the piece
3108
+ // the user holds stays one element and only its column var changes — the
3109
+ // property its `inset-inline-start` transition slides on.
3110
+ renderGrid()
3111
+ const chip = screen.getByTestId("e1") // Thu Jan 15, 09:00 — column 4
3112
+ fireEvent.pointerDown(chip, { clientX: 450, clientY: 1080, pointerId: 1, button: 0 })
3113
+ layOutColumns()
3114
+ fireEvent.pointerMove(chip, { clientX: 450, clientY: 1100, pointerId: 1 })
3115
+ const held = ghostIn(4)
3116
+ expect(held).toBeDefined()
3117
+
3118
+ fireEvent.pointerMove(chip, { clientX: 650, clientY: 1100, pointerId: 1 })
3119
+ expect(activeGhosts()).toEqual([6])
3120
+ expect(ghostIn(6)).toBe(held)
3121
+
3122
+ fireEvent.pointerUp(chip, { clientX: 650, clientY: 1100, pointerId: 1 })
3123
+ })
3124
+
3125
+ it("slides both pieces of a cross-midnight move together", () => {
3126
+ renderGrid()
3127
+ const chip = screen.getByTestId("e1")
3128
+ fireEvent.pointerDown(chip, { clientX: 450, clientY: 1080, pointerId: 1, button: 0 })
3129
+ layOutColumns()
3130
+ fireEvent.pointerMove(chip, { clientX: 450, clientY: 1080 + 885 * 2, pointerId: 1 })
3131
+ const [before, after] = [ghostIn(4), ghostIn(5)]
3132
+
3133
+ // One day earlier: the pair lands on Wed/Thu, each piece on its own element.
3134
+ fireEvent.pointerMove(chip, { clientX: 350, clientY: 1080 + 885 * 2, pointerId: 1 })
3135
+ expect(activeGhosts()).toEqual([3, 4])
3136
+ expect(ghostIn(3)).toBe(before)
3137
+ expect(ghostIn(4)).toBe(after)
3138
+
3139
+ fireEvent.pointerUp(chip, { clientX: 350, clientY: 1080 + 885 * 2, pointerId: 1 })
3140
+ })
3141
+
3142
+ it("paints into the live band, not the copy a page turn is animating out", () => {
3143
+ // The outgoing band a page turn keeps mounted is a full second set of
3144
+ // columns carrying the *same* `data-day-index` values, later in the DOM —
3145
+ // so collecting the pieces without skipping it hands every one of them to
3146
+ // the copy that is sliding away, and the preview is drawn where it can
3147
+ // never be seen.
3148
+ const nextWeek: ScheduleEvent = {
3149
+ kind: "event",
3150
+ id: "e2",
3151
+ title: "Standup",
3152
+ start: day(2026, 0, 22, 9),
3153
+ end: day(2026, 0, 22, 9, 30),
3154
+ }
3155
+ renderGrid([...EVENTS, nextWeek])
3156
+ fireEvent.click(screen.getByRole("button", { name: "Next" }))
3157
+ layOutColumns()
3158
+ // Precondition: the turn is actually animating, so both bands are mounted.
3159
+ expect(
3160
+ document.querySelectorAll("[data-schedule-part='day-column'][data-page-exiting]"),
3161
+ ).toHaveLength(7)
3162
+
3163
+ const chip = screen.getByTestId("e2")
3164
+ fireEvent.pointerDown(chip, { clientX: 450, clientY: 1080, pointerId: 1, button: 0 })
3165
+ layOutColumns()
3166
+ fireEvent.pointerMove(chip, { clientX: 450, clientY: 1080 + 885 * 2, pointerId: 1 })
3167
+
3168
+ const painted = [
3169
+ ...document.querySelectorAll<HTMLElement>("[data-schedule-part='drag-ghost']"),
3170
+ ].filter((el) => el.dataset["active"] === "true")
3171
+ expect(painted).toHaveLength(2)
3172
+ expect(painted.every((el) => el.closest("[data-page-exiting]") === null)).toBe(true)
3173
+
3174
+ fireEvent.pointerUp(chip, { clientX: 450, clientY: 1080 + 885 * 2, pointerId: 1 })
3175
+ })
3176
+
3177
+ it("clips each piece to its own band instead of overflowing the column", () => {
3178
+ renderGrid()
3179
+ const chip = screen.getByTestId("e1")
3180
+ fireEvent.pointerDown(chip, { clientX: 450, clientY: 1080, pointerId: 1, button: 0 })
3181
+ layOutColumns()
3182
+ fireEvent.pointerMove(chip, { clientX: 450, clientY: 1080 + 885 * 2, pointerId: 1 })
3183
+
3184
+ for (const index of activeGhosts()) {
3185
+ const el = ghostIn(index)
3186
+ const top = Number.parseFloat(el.style.getPropertyValue("--sch-ghost-top"))
3187
+ const height = Number.parseFloat(el.style.getPropertyValue("--sch-ghost-height"))
3188
+ expect(top).toBeGreaterThanOrEqual(0)
3189
+ expect(top + height).toBeLessThanOrEqual(100.0001)
3190
+ }
3191
+
3192
+ fireEvent.pointerUp(chip, { clientX: 450, clientY: 1080 + 885 * 2, pointerId: 1 })
3193
+ })
3194
+ })
3195
+
3196
+ /**
3197
+ * `views` — the configurable view-switcher entries. Type-level narrowing is
3198
+ * verified separately with a tsc harness (see the PR); these cover the runtime
3199
+ * half: what renders, what the switcher offers, and how drill-down resolves a
3200
+ * renderer to an entry id.
3201
+ */
3202
+ describe("ScheduleRoot — views", () => {
3203
+ const tabNames = () => screen.queryAllByRole("tab").map((el) => el.textContent?.trim() ?? "")
3204
+
3205
+ it("offers days/month/year by default, unchanged", async () => {
3206
+ render(<ScheduleRoot data={[]} now={NOW} timeZone="UTC" />)
3207
+ await new Promise((r) => setTimeout(r, 0))
3208
+ expect(tabNames()).toEqual(["Week", "Month", "Year"])
3209
+ })
3210
+
3211
+ it("offers exactly the configured entries, in order", async () => {
3212
+ render(<ScheduleRoot data={[]} now={NOW} timeZone="UTC" views={["month", "day", "week"]} />)
3213
+ await new Promise((r) => setTimeout(r, 0))
3214
+ expect(tabNames()).toEqual(["Month", "Day", "Week"])
3215
+ })
3216
+
3217
+ it("renders no switcher at all for a single entry", async () => {
3218
+ render(<ScheduleRoot data={[]} now={NOW} timeZone="UTC" views={["week"]} />)
3219
+ await new Promise((r) => setTimeout(r, 0))
3220
+ expect(screen.queryAllByRole("tab")).toHaveLength(0)
3221
+ // ...and still renders that view.
3222
+ expect(document.querySelector('[data-schedule-part="timed-grid"]')).not.toBeNull()
3223
+ })
3224
+
3225
+ it("labels a custom entry from its own `label`, falling back to the id", async () => {
3226
+ render(
3227
+ <ScheduleRoot
3228
+ data={[]}
3229
+ now={NOW}
3230
+ timeZone="UTC"
3231
+ views={[
3232
+ { id: "fortnight", visibleDays: 14, label: "2 weeks" },
3233
+ { id: "quarter", visibleDays: 90 },
3234
+ ]}
3235
+ />,
3236
+ )
3237
+ await new Promise((r) => setTimeout(r, 0))
3238
+ expect(tabNames()).toEqual(["2 weeks", "quarter"])
3239
+ })
3240
+
3241
+ it("starts on the first entry when `defaultView` is omitted", () => {
3242
+ render(<ScheduleRoot data={[]} now={NOW} timeZone="UTC" views={["month", "week"]} />)
3243
+ // Month, not the historical hard-coded "days" — which would have rendered a
3244
+ // view with no tab selected.
3245
+ expect(document.querySelector('[data-schedule-part="month-view"]')).not.toBeNull()
3246
+ })
3247
+
3248
+ it("sizes the days window from the active entry, overriding `visibleDays`", () => {
3249
+ render(
3250
+ <ScheduleRoot data={[]} now={NOW} timeZone="UTC" visibleDays={5} views={["day", "week"]} />,
3251
+ )
3252
+ expect(
3253
+ document.querySelectorAll('[data-schedule-part="day-column"][data-day-index]'),
3254
+ ).toHaveLength(1)
3255
+ })
3256
+
3257
+ /** The backwards-compatibility guarantee: `"days"` pins no window of its own,
3258
+ * so a consumer's `visibleDays` still wins under the default entries. */
3259
+ it("leaves `visibleDays` alone for the `days` entry", () => {
3260
+ render(<ScheduleRoot data={[]} now={NOW} timeZone="UTC" visibleDays={5} />)
3261
+ expect(
3262
+ document.querySelectorAll('[data-schedule-part="day-column"][data-day-index]'),
3263
+ ).toHaveLength(5)
3264
+ })
3265
+
3266
+ it("drills into the first entry using the days renderer, by id", async () => {
3267
+ const onViewChange = vi.fn()
3268
+ render(
3269
+ <ScheduleRoot
3270
+ data={[]}
3271
+ now={NOW}
3272
+ timeZone="UTC"
3273
+ defaultView="month"
3274
+ views={["day", "week", "month"]}
3275
+ onViewChange={onViewChange}
3276
+ />,
3277
+ )
3278
+ fireEvent.click(
3279
+ document.querySelector('[data-schedule-part="month-day-number"]') as HTMLElement,
3280
+ )
3281
+ // "day" — the first days-renderer entry — not the literal string "days",
3282
+ // which is not an id here at all.
3283
+ expect(onViewChange).toHaveBeenCalledWith("day")
3284
+ })
3285
+
3286
+ it("moves the date but not the view when no entry offers the target renderer", () => {
3287
+ const onViewChange = vi.fn()
3288
+ const onDateChange = vi.fn()
3289
+ render(
3290
+ <ScheduleRoot
3291
+ data={[]}
3292
+ now={NOW}
3293
+ timeZone="UTC"
3294
+ views={["month", "year"]}
3295
+ onViewChange={onViewChange}
3296
+ onDateChange={onDateChange}
3297
+ />,
3298
+ )
3299
+ fireEvent.click(
3300
+ document.querySelector('[data-schedule-part="month-day-number"]') as HTMLElement,
3301
+ )
3302
+ expect(onDateChange).toHaveBeenCalled()
3303
+ expect(onViewChange).not.toHaveBeenCalled()
3304
+ })
3305
+ })
3306
+
3307
+ describe("ScheduleRoot — selection", () => {
3308
+ const chip = (id: string) => screen.getByTestId(id)
3309
+
3310
+ /**
3311
+ * An interactive chip has no DOM `onClick`: its click is resolved at
3312
+ * pointerup by `use-event-drag.ts`'s `maxAbsDelta < CLICK_SLOP` check, which
3313
+ * is precisely why selection inherits a correct drag-vs-click answer for
3314
+ * free. So a plain `fireEvent.click` would (correctly) do nothing here.
3315
+ */
3316
+ const clickChip = (id: string) => {
3317
+ HTMLElement.prototype.setPointerCapture = vi.fn()
3318
+ const el = chip(id)
3319
+ fireEvent.pointerDown(el, { clientX: 0, clientY: 100, pointerId: 1, button: 0 })
3320
+ fireEvent.pointerUp(el, { clientX: 0, clientY: 100, pointerId: 1 })
3321
+ }
3322
+
3323
+ it("selects an interactive event on click and reports the whole event", () => {
3324
+ const onSelect = vi.fn()
3325
+ render(<ScheduleRoot data={EVENTS} now={NOW} timeZone="UTC" onSelect={onSelect} />)
3326
+ clickChip("e1")
3327
+ expect(onSelect).toHaveBeenCalledWith(expect.objectContaining({ id: "e1" }))
3328
+ expect(chip("e1").hasAttribute("data-selected")).toBe(true)
3329
+ })
3330
+
3331
+ it("selects a static event on a plain click", () => {
3332
+ const onSelect = vi.fn()
3333
+ render(
3334
+ <ScheduleRoot
3335
+ data={[]}
3336
+ staticEvents={STATIC_EVENTS}
3337
+ now={NOW}
3338
+ timeZone="UTC"
3339
+ onSelect={onSelect}
3340
+ />,
3341
+ )
3342
+ fireEvent.click(chip("s1"))
3343
+ expect(onSelect).toHaveBeenCalledWith(expect.objectContaining({ id: "s1" }))
3344
+ })
3345
+
3346
+ /** The drag-vs-click guarantee, stated as a test: a real drag commits a
3347
+ * change and must never also select. */
3348
+ it("does not select when the gesture resolves to a drag", () => {
3349
+ HTMLElement.prototype.setPointerCapture = vi.fn()
3350
+ const onSelect = vi.fn()
3351
+ render(
3352
+ <ScheduleRoot
3353
+ data={EVENTS}
3354
+ now={NOW}
3355
+ timeZone="UTC"
3356
+ editable={["drag"]}
3357
+ onEventChange={() => {}}
3358
+ onSelect={onSelect}
3359
+ />,
3360
+ )
3361
+ const el = chip("e1")
3362
+ fireEvent.pointerDown(el, { clientX: 0, clientY: 100, pointerId: 1, button: 0 })
3363
+ fireEvent.pointerMove(el, { clientX: 0, clientY: 160, pointerId: 1 })
3364
+ fireEvent.pointerUp(el, { clientX: 0, clientY: 160, pointerId: 1 })
3365
+ expect(onSelect).not.toHaveBeenCalled()
3366
+ })
3367
+
3368
+ it("stamps data-selected only on the selected chip", () => {
3369
+ render(
3370
+ <ScheduleRoot
3371
+ data={[
3372
+ ...EVENTS,
3373
+ {
3374
+ kind: "event",
3375
+ id: "e2",
3376
+ title: "Other",
3377
+ start: day(2026, 0, 15, 14),
3378
+ end: day(2026, 0, 15, 15),
3379
+ },
3380
+ ]}
3381
+ now={NOW}
3382
+ timeZone="UTC"
3383
+ defaultSelected="e1"
3384
+ />,
3385
+ )
3386
+ expect(chip("e1").hasAttribute("data-selected")).toBe(true)
3387
+ expect(chip("e2").hasAttribute("data-selected")).toBe(false)
3388
+ })
3389
+
3390
+ it("clears the selection on a plain click on empty grid space, alongside onGridClick", () => {
3391
+ HTMLElement.prototype.setPointerCapture = vi.fn()
3392
+ const onSelect = vi.fn()
3393
+ const onGridClick = vi.fn()
3394
+ render(
3395
+ <ScheduleRoot
3396
+ data={EVENTS}
3397
+ now={NOW}
3398
+ timeZone="UTC"
3399
+ defaultSelected="e1"
3400
+ onSelect={onSelect}
3401
+ onGridClick={onGridClick}
3402
+ />,
3403
+ )
3404
+ const col = document.querySelector('[data-schedule-part="day-column"]') as HTMLElement
3405
+ fireEvent.pointerDown(col, { clientY: 100, pointerId: 1, button: 0, pointerType: "mouse" })
3406
+ fireEvent.pointerUp(col, { clientY: 100, pointerId: 1 })
3407
+ // Both fire, and they are not synonyms: one reports the state change, the
3408
+ // other the raw gesture with the instant pressed.
3409
+ expect(onSelect).toHaveBeenCalledWith(null)
3410
+ expect(onGridClick).toHaveBeenCalledTimes(1)
3411
+ expect(onGridClick.mock.calls[0]?.[0]).toBeInstanceOf(Date)
3412
+ })
3413
+
3414
+ it("honours a controlled `selected` and does not move on its own", () => {
3415
+ const onSelect = vi.fn()
3416
+ const { rerender } = render(
3417
+ <ScheduleRoot data={EVENTS} now={NOW} timeZone="UTC" selected={null} onSelect={onSelect} />,
3418
+ )
3419
+ clickChip("e1")
3420
+ expect(onSelect).toHaveBeenCalledWith(expect.objectContaining({ id: "e1" }))
3421
+ // Controlled and unchanged by the parent: nothing is selected.
3422
+ expect(chip("e1").hasAttribute("data-selected")).toBe(false)
3423
+
3424
+ rerender(
3425
+ <ScheduleRoot data={EVENTS} now={NOW} timeZone="UTC" selected="e1" onSelect={onSelect} />,
3426
+ )
3427
+ expect(chip("e1").hasAttribute("data-selected")).toBe(true)
3428
+ })
3429
+
3430
+ it("does nothing at all with withSelection={false}", () => {
3431
+ const onSelect = vi.fn()
3432
+ render(
3433
+ <ScheduleRoot
3434
+ data={EVENTS}
3435
+ now={NOW}
3436
+ timeZone="UTC"
3437
+ withSelection={false}
3438
+ defaultSelected="e1"
3439
+ onSelect={onSelect}
3440
+ />,
3441
+ )
3442
+ expect(chip("e1").hasAttribute("data-selected")).toBe(false)
3443
+ clickChip("e1")
3444
+ expect(onSelect).not.toHaveBeenCalled()
3445
+ })
3446
+
3447
+ it("mounts no details popover with withEventDetails={false}", () => {
3448
+ render(
3449
+ <ScheduleRoot
3450
+ data={EVENTS}
3451
+ now={NOW}
3452
+ timeZone="UTC"
3453
+ withEventDetails={false}
3454
+ defaultSelected="e1"
3455
+ />,
3456
+ )
3457
+ expect(chip("e1").hasAttribute("data-selected")).toBe(true)
3458
+ expect(screen.queryByRole("dialog")).toBeNull()
3459
+ // No popover means no disclosure semantics to announce either.
3460
+ expect(chip("e1").getAttribute("aria-haspopup")).toBeNull()
3461
+ })
3462
+
3463
+ it("ignores a `selected` id that matches no event", () => {
3464
+ const onDateChange = vi.fn()
3465
+ render(
3466
+ <ScheduleRoot
3467
+ data={EVENTS}
3468
+ now={NOW}
3469
+ timeZone="UTC"
3470
+ selected="nope"
3471
+ onDateChange={onDateChange}
3472
+ />,
3473
+ )
3474
+ expect(onDateChange).not.toHaveBeenCalled()
3475
+ expect(chip("e1").hasAttribute("data-selected")).toBe(false)
3476
+ })
3477
+ })
3478
+
3479
+ /**
3480
+ * #240: one thing drawn as several chips — an offer split around the booking
3481
+ * that bites into it. `selected` takes the list; the first id is the anchor.
3482
+ */
3483
+ describe("ScheduleRoot — several selected chips", () => {
3484
+ const OFFER: ScheduleEvent[] = [
3485
+ {
3486
+ kind: "event",
3487
+ id: "offer:before",
3488
+ title: "Offer",
3489
+ start: day(2026, 0, 15, 9),
3490
+ end: day(2026, 0, 15, 10),
3491
+ },
3492
+ {
3493
+ kind: "event",
3494
+ id: "offer:after",
3495
+ title: "Offer",
3496
+ start: day(2026, 0, 15, 11),
3497
+ end: day(2026, 0, 15, 12),
3498
+ },
3499
+ ]
3500
+ const chip = (id: string) => screen.getByTestId(id)
3501
+
3502
+ it("paints every listed chip and opens one popover, on the first", () => {
3503
+ render(
3504
+ <ScheduleRoot
3505
+ data={OFFER}
3506
+ now={NOW}
3507
+ timeZone="UTC"
3508
+ selected={["offer:before", "offer:after"]}
3509
+ />,
3510
+ )
3511
+ expect(chip("offer:before").hasAttribute("data-selected")).toBe(true)
3512
+ expect(chip("offer:after").hasAttribute("data-selected")).toBe(true)
3513
+ expect(screen.getAllByRole("dialog")).toHaveLength(1)
3514
+ expect(chip("offer:before").getAttribute("aria-expanded")).toBe("true")
3515
+ expect(chip("offer:after").getAttribute("aria-expanded")).toBe("false")
3516
+ })
3517
+
3518
+ it("moves the popover when the order changes", () => {
3519
+ const { rerender } = render(
3520
+ <ScheduleRoot
3521
+ data={OFFER}
3522
+ now={NOW}
3523
+ timeZone="UTC"
3524
+ selected={["offer:before", "offer:after"]}
3525
+ />,
3526
+ )
3527
+ rerender(
3528
+ <ScheduleRoot
3529
+ data={OFFER}
3530
+ now={NOW}
3531
+ timeZone="UTC"
3532
+ selected={["offer:after", "offer:before"]}
3533
+ />,
3534
+ )
3535
+ expect(screen.getAllByRole("dialog")).toHaveLength(1)
3536
+ expect(chip("offer:after").getAttribute("aria-expanded")).toBe("true")
3537
+ expect(chip("offer:before").getAttribute("aria-expanded")).toBe("false")
3538
+ })
3539
+
3540
+ it("still reports the one chip that was pressed", () => {
3541
+ const onSelect = vi.fn()
3542
+ HTMLElement.prototype.setPointerCapture = vi.fn()
3543
+ render(
3544
+ <ScheduleRoot
3545
+ data={OFFER}
3546
+ now={NOW}
3547
+ timeZone="UTC"
3548
+ selected={["offer:before", "offer:after"]}
3549
+ onSelect={onSelect}
3550
+ />,
3551
+ )
3552
+ const el = chip("offer:after")
3553
+ fireEvent.pointerDown(el, { clientX: 0, clientY: 100, pointerId: 1, button: 0 })
3554
+ fireEvent.pointerUp(el, { clientX: 0, clientY: 100, pointerId: 1 })
3555
+ expect(onSelect).toHaveBeenCalledTimes(1)
3556
+ expect(onSelect).toHaveBeenCalledWith(expect.objectContaining({ id: "offer:after" }))
3557
+ })
3558
+
3559
+ it("treats an empty list as nothing selected", () => {
3560
+ render(<ScheduleRoot data={OFFER} now={NOW} timeZone="UTC" selected={[]} />)
3561
+ expect(document.querySelector('[data-schedule-part="event-chip"][data-selected]')).toBeNull()
3562
+ expect(screen.queryByRole("dialog")).toBeNull()
3563
+ })
3564
+
3565
+ it("ignores the list with withSelection={false}", () => {
3566
+ render(
3567
+ <ScheduleRoot
3568
+ data={OFFER}
3569
+ now={NOW}
3570
+ timeZone="UTC"
3571
+ withSelection={false}
3572
+ selected={["offer:before", "offer:after"]}
3573
+ />,
3574
+ )
3575
+ expect(document.querySelector('[data-schedule-part="event-chip"][data-selected]')).toBeNull()
3576
+ })
3577
+
3578
+ it("does not re-arm the reveal when the same list is passed again as a fresh array", () => {
3579
+ // A consumer deriving `selected` builds a new array every render. The
3580
+ // reveal keys on the anchor id, so paging away and re-rendering must not
3581
+ // yank the view back to the selection.
3582
+ const far: ScheduleEvent[] = [
3583
+ {
3584
+ kind: "event",
3585
+ id: "far:a",
3586
+ title: "Far",
3587
+ start: day(2026, 2, 3, 9),
3588
+ end: day(2026, 2, 3, 10),
3589
+ },
3590
+ {
3591
+ kind: "event",
3592
+ id: "far:b",
3593
+ title: "Far",
3594
+ start: day(2026, 2, 3, 11),
3595
+ end: day(2026, 2, 3, 12),
3596
+ },
3597
+ ]
3598
+ const onDateChange = vi.fn()
3599
+ const { rerender } = render(
3600
+ <ScheduleRoot
3601
+ data={far}
3602
+ now={NOW}
3603
+ timeZone="UTC"
3604
+ selected={["far:a", "far:b"]}
3605
+ onDateChange={onDateChange}
3606
+ />,
3607
+ )
3608
+ expect(onDateChange).toHaveBeenCalledTimes(1)
3609
+ fireEvent.click(screen.getByRole("button", { name: "Next" }))
3610
+ expect(onDateChange).toHaveBeenCalledTimes(2)
3611
+ rerender(
3612
+ <ScheduleRoot
3613
+ data={far}
3614
+ now={NOW}
3615
+ timeZone="UTC"
3616
+ selected={["far:a", "far:b"]}
3617
+ onDateChange={onDateChange}
3618
+ />,
3619
+ )
3620
+ expect(onDateChange).toHaveBeenCalledTimes(2)
3621
+ })
3622
+
3623
+ it("paints several pills in Month and opens one popover", () => {
3624
+ render(
3625
+ <ScheduleRoot
3626
+ data={OFFER}
3627
+ now={NOW}
3628
+ timeZone="UTC"
3629
+ view="month"
3630
+ selected={["offer:before", "offer:after"]}
3631
+ />,
3632
+ )
3633
+ expect(chip("offer:before").hasAttribute("data-selected")).toBe(true)
3634
+ expect(chip("offer:after").hasAttribute("data-selected")).toBe(true)
3635
+ expect(screen.getAllByRole("dialog")).toHaveLength(1)
3636
+ })
3637
+
3638
+ it("paints several rows in the agenda and opens one popover", () => {
3639
+ render(
3640
+ <ScheduleRoot
3641
+ data={OFFER}
3642
+ now={NOW}
3643
+ timeZone="UTC"
3644
+ views={["days", "agenda"]}
3645
+ view="agenda"
3646
+ selected={["offer:before", "offer:after"]}
3647
+ />,
3648
+ )
3649
+ const rows = document.querySelectorAll('[data-schedule-part="agenda-event"][data-selected]')
3650
+ expect(rows).toHaveLength(2)
3651
+ expect(screen.getAllByRole("dialog")).toHaveLength(1)
3652
+ })
3653
+ })
3654
+
3655
+ /**
3656
+ * A multi-day event is several pieces sharing one id. Every piece is painted
3657
+ * selected, but only one may open the details popover: the pressed piece,
3658
+ * else the first on screen. Each used to open its own.
3659
+ */
3660
+ describe("ScheduleRoot — one popover per multi-piece event", () => {
3661
+ // Monday 22:00 UTC → Wednesday 02:00 UTC: a piece on Mon, Tue and Wed.
3662
+ const LONG: ScheduleEvent[] = [
3663
+ {
3664
+ kind: "event",
3665
+ id: "long",
3666
+ title: "Night watch",
3667
+ start: day(2026, 0, 12, 22),
3668
+ end: day(2026, 0, 14, 2),
3669
+ },
3670
+ ]
3671
+ const MONDAY = day(2026, 0, 12, 12)
3672
+ const expanded = (id: string) =>
3673
+ screen.getAllByTestId(id).map((el) => el.getAttribute("aria-expanded"))
3674
+ const press = (el: HTMLElement) => {
3675
+ HTMLElement.prototype.setPointerCapture = vi.fn()
3676
+ fireEvent.pointerDown(el, { clientX: 0, clientY: 100, pointerId: 1, button: 0 })
3677
+ fireEvent.pointerUp(el, { clientX: 0, clientY: 100, pointerId: 1 })
3678
+ }
3679
+
3680
+ it("opens one popover, on the first piece, for a selection from outside", () => {
3681
+ render(<ScheduleRoot data={LONG} now={MONDAY} timeZone="UTC" view="days" selected="long" />)
3682
+ expect(screen.getAllByTestId("long")).toHaveLength(3)
3683
+ expect(screen.getAllByRole("dialog")).toHaveLength(1)
3684
+ expect(expanded("long")).toEqual(["true", "false", "false"])
3685
+ })
3686
+
3687
+ it("opens it on the piece that was pressed", async () => {
3688
+ render(<ScheduleRoot data={LONG} now={MONDAY} timeZone="UTC" view="days" />)
3689
+ press(screen.getAllByTestId("long")[1] as HTMLElement)
3690
+ for (const el of screen.getAllByTestId("long")) {
3691
+ expect(el.hasAttribute("data-selected")).toBe(true)
3692
+ }
3693
+ // The panel is lazy-mounted, so it lands a tick after the press.
3694
+ expect(await screen.findAllByRole("dialog")).toHaveLength(1)
3695
+ expect(expanded("long")).toEqual(["false", "true", "false"])
3696
+ })
3697
+
3698
+ it("keeps it on the pressed piece under a controlled selection", async () => {
3699
+ function Controlled() {
3700
+ const [selected, setSelected] = useState<string | null>(null)
3701
+ return (
3702
+ <ScheduleRoot
3703
+ data={LONG}
3704
+ now={MONDAY}
3705
+ timeZone="UTC"
3706
+ view="days"
3707
+ selected={selected}
3708
+ onSelect={(event) => setSelected(event?.id ?? null)}
3709
+ />
3710
+ )
3711
+ }
3712
+ render(<Controlled />)
3713
+ press(screen.getAllByTestId("long")[2] as HTMLElement)
3714
+ expect(await screen.findAllByRole("dialog")).toHaveLength(1)
3715
+ expect(expanded("long")).toEqual(["false", "false", "true"])
3716
+ })
3717
+
3718
+ it("still opens one when the event is also part of a multi-id selection", () => {
3719
+ render(
3720
+ <ScheduleRoot
3721
+ data={[...LONG, ...EVENTS]}
3722
+ now={MONDAY}
3723
+ timeZone="UTC"
3724
+ view="days"
3725
+ selected={["long", "e1"]}
3726
+ />,
3727
+ )
3728
+ expect(screen.getAllByRole("dialog")).toHaveLength(1)
3729
+ expect(expanded("long")).toEqual(["true", "false", "false"])
3730
+ })
3731
+
3732
+ it("opens one popover in Month, on the pressed pill", async () => {
3733
+ const fortnight: ScheduleEvent[] = [
3734
+ {
3735
+ kind: "event",
3736
+ id: "piscine",
3737
+ title: "Piscine",
3738
+ start: day(2026, 0, 5),
3739
+ end: day(2026, 0, 17),
3740
+ allDay: true,
3741
+ },
3742
+ ]
3743
+ render(<ScheduleRoot data={fortnight} now={MONDAY} timeZone="UTC" view="month" />)
3744
+ const pills = screen.getAllByTestId("piscine")
3745
+ expect(pills.length).toBeGreaterThan(2)
3746
+ fireEvent.click(pills[3] as HTMLElement)
3747
+ expect(await screen.findAllByRole("dialog")).toHaveLength(1)
3748
+ expect(expanded("piscine").indexOf("true")).toBe(3)
3749
+ })
3750
+ })
3751
+
3752
+ /**
3753
+ * The reveal rule's date axis. The scroll axis is invisible to jsdom —
3754
+ * `test-setup.ts` stubs every rect to a constant and `scrollTo` to a no-op —
3755
+ * so it is verified in a real browser instead.
3756
+ */
3757
+ describe("ScheduleRoot — reveal on select", () => {
3758
+ const FAR: ScheduleEvent[] = [
3759
+ {
3760
+ kind: "event",
3761
+ id: "far",
3762
+ title: "Far away",
3763
+ start: day(2026, 2, 3, 9),
3764
+ end: day(2026, 2, 3, 10),
3765
+ },
3766
+ ]
3767
+
3768
+ it("moves the anchor to an event that is not in the visible range", () => {
3769
+ const onDateChange = vi.fn()
3770
+ render(
3771
+ <ScheduleRoot
3772
+ data={FAR}
3773
+ now={NOW}
3774
+ timeZone="UTC"
3775
+ selected="far"
3776
+ onDateChange={onDateChange}
3777
+ />,
3778
+ )
3779
+ expect(onDateChange).toHaveBeenCalledWith(FAR[0]?.start)
3780
+ })
3781
+
3782
+ it("leaves the anchor alone for an event already in range", () => {
3783
+ const onDateChange = vi.fn()
3784
+ render(
3785
+ <ScheduleRoot
3786
+ data={EVENTS}
3787
+ now={NOW}
3788
+ timeZone="UTC"
3789
+ selected="e1"
3790
+ onDateChange={onDateChange}
3791
+ />,
3792
+ )
3793
+ expect(onDateChange).not.toHaveBeenCalled()
3794
+ })
3795
+
3796
+ /** The case an `event.start` test gets wrong: the event is on screen every
3797
+ * day of the window, so anchoring to its start would page *away* from it. */
3798
+ it("leaves the anchor alone for a long event that merely starts before the window", () => {
3799
+ const onDateChange = vi.fn()
3800
+ const spanning: ScheduleEvent[] = [
3801
+ {
3802
+ kind: "event",
3803
+ id: "span",
3804
+ title: "Long haul",
3805
+ start: day(2025, 11, 20),
3806
+ end: day(2026, 1, 20),
3807
+ allDay: true,
3808
+ },
3809
+ ]
3810
+ render(
3811
+ <ScheduleRoot
3812
+ data={spanning}
3813
+ now={NOW}
3814
+ timeZone="UTC"
3815
+ selected="span"
3816
+ onDateChange={onDateChange}
3817
+ />,
3818
+ )
3819
+ expect(onDateChange).not.toHaveBeenCalled()
3820
+ })
3821
+
3822
+ /** Armed by selection alone — otherwise paging away from a selected event
3823
+ * would drag the user straight back to it. */
3824
+ it("does not re-reveal when the date changes on its own", () => {
3825
+ const onDateChange = vi.fn()
3826
+ render(
3827
+ <ScheduleRoot
3828
+ data={EVENTS}
3829
+ now={NOW}
3830
+ timeZone="UTC"
3831
+ defaultSelected="e1"
3832
+ onDateChange={onDateChange}
3833
+ />,
3834
+ )
3835
+ onDateChange.mockClear()
3836
+ fireEvent.click(screen.getByRole("button", { name: "Next" }))
3837
+ // Exactly one call: the page turn itself. No second, corrective one.
3838
+ expect(onDateChange).toHaveBeenCalledTimes(1)
3839
+ })
3840
+ })
3841
+
3842
+ /**
3843
+ * The agenda renderer under `Root` — that it is a switcher entry at all, and
3844
+ * that the month-windowed chrome `Root` feeds it is coherent. The view's own
3845
+ * rendering is covered in `schedule-agenda-view.test.tsx`.
3846
+ */
3847
+ describe("ScheduleRoot — the agenda view", () => {
3848
+ const tabNames = () => screen.queryAllByRole("tab").map((el) => el.textContent?.trim() ?? "")
3849
+ const title = () =>
3850
+ document.querySelector('[data-schedule-part="toolbar-title"]')?.textContent ?? ""
3851
+ const agenda = () => document.querySelector('[data-schedule-part="agenda-view"]')
3852
+ const rowIds = () =>
3853
+ Array.from(
3854
+ document.querySelectorAll<HTMLElement>(
3855
+ '[data-schedule-part="agenda-list"] [data-schedule-part="agenda-event"]',
3856
+ ),
3857
+ ).map((el) => el.dataset["eventId"])
3858
+
3859
+ const SEPT: ScheduleEvent[] = [
3860
+ {
3861
+ kind: "event",
3862
+ id: "sept",
3863
+ title: "Sept planning",
3864
+ start: day(2026, 8, 10, 9),
3865
+ end: day(2026, 8, 10, 10),
3866
+ },
3867
+ {
3868
+ kind: "event",
3869
+ id: "oct",
3870
+ title: "Oct retro",
3871
+ start: day(2026, 9, 10, 9),
3872
+ end: day(2026, 9, 10, 10),
3873
+ },
3874
+ ]
3875
+ const SEPT_NOW = day(2026, 8, 15, 12)
3876
+
3877
+ it("offers an Agenda tab when `views` asks for one", async () => {
3878
+ render(<ScheduleRoot data={[]} now={NOW} timeZone="UTC" views={["week", "agenda", "month"]} />)
3879
+ await new Promise((r) => setTimeout(r, 0))
3880
+ expect(tabNames()).toEqual(["Week", "Agenda", "Month"])
3881
+ })
3882
+
3883
+ it("renders the agenda, titled and windowed by month", () => {
3884
+ render(
3885
+ <ScheduleRoot
3886
+ data={SEPT}
3887
+ now={SEPT_NOW}
3888
+ timeZone="UTC"
3889
+ locale="en-GB"
3890
+ views={["agenda", "month"]}
3891
+ />,
3892
+ )
3893
+ expect(agenda()).not.toBeNull()
3894
+ expect(title()).toBe("September 2026")
3895
+ expect(rowIds()).toEqual(["sept"])
3896
+ })
3897
+
3898
+ it("steps a month per Prev/Next from Root's own toolbar", () => {
3899
+ render(
3900
+ <ScheduleRoot
3901
+ data={SEPT}
3902
+ now={SEPT_NOW}
3903
+ timeZone="UTC"
3904
+ locale="en-GB"
3905
+ views={["agenda", "month"]}
3906
+ />,
3907
+ )
3908
+ fireEvent.click(screen.getByRole("button", { name: "Next" }))
3909
+ expect(title()).toBe("October 2026")
3910
+ expect(rowIds()).toEqual(["oct"])
3911
+ })
3912
+
3913
+ it("suppresses the view's own pagination chrome", () => {
3914
+ render(<ScheduleRoot data={[]} now={SEPT_NOW} timeZone="UTC" views={["agenda", "month"]} />)
3915
+ // Root's toolbar supplies exactly one of each.
3916
+ expect(screen.getAllByRole("button", { name: "Next" })).toHaveLength(1)
3917
+ expect(screen.getAllByRole("button", { name: "Previous" })).toHaveLength(1)
3918
+ })
3919
+
3920
+ it("reports a row click through Root's own onSelect", () => {
3921
+ const onSelect = vi.fn()
3922
+ render(
3923
+ <ScheduleRoot
3924
+ data={SEPT}
3925
+ now={SEPT_NOW}
3926
+ timeZone="UTC"
3927
+ locale="en-GB"
3928
+ views={["agenda"]}
3929
+ onSelect={onSelect}
3930
+ />,
3931
+ )
3932
+ const control = document.querySelector<HTMLElement>(
3933
+ '[data-schedule-part="agenda-event-trigger"]',
3934
+ )
3935
+ if (control) fireEvent.click(control)
3936
+ expect(onSelect).toHaveBeenCalledWith(expect.objectContaining({ id: "sept" }))
3937
+ })
3938
+
3939
+ /**
3940
+ * The load-bearing integration: `Root`'s reveal effect asks
3941
+ * `isEventInVisibleRange`, which resolves the agenda's strict month — so a
3942
+ * selection outside the window pages to it with no agenda-specific code in
3943
+ * `Root` at all. It is tested precisely *because* nothing implements it.
3944
+ */
3945
+ it("pages to a selection outside the current month", () => {
3946
+ const onDateChange = vi.fn()
3947
+ render(
3948
+ <ScheduleRoot
3949
+ data={SEPT}
3950
+ now={SEPT_NOW}
3951
+ timeZone="UTC"
3952
+ views={["agenda"]}
3953
+ selected="oct"
3954
+ onDateChange={onDateChange}
3955
+ />,
3956
+ )
3957
+ expect(onDateChange).toHaveBeenCalledWith(SEPT[1]?.start)
3958
+ })
3959
+
3960
+ it("leaves the anchor alone for a selection already in the month", () => {
3961
+ const onDateChange = vi.fn()
3962
+ render(
3963
+ <ScheduleRoot
3964
+ data={SEPT}
3965
+ now={SEPT_NOW}
3966
+ timeZone="UTC"
3967
+ views={["agenda"]}
3968
+ selected="sept"
3969
+ onDateChange={onDateChange}
3970
+ />,
3971
+ )
3972
+ expect(onDateChange).not.toHaveBeenCalled()
3973
+ })
3974
+
3975
+ it("carries a custom entry id rather than the renderer name", async () => {
3976
+ const onViewChange = vi.fn()
3977
+ render(
3978
+ <ScheduleRoot
3979
+ data={[]}
3980
+ now={SEPT_NOW}
3981
+ timeZone="UTC"
3982
+ views={["month", { id: "upcoming", view: "agenda", label: "Upcoming" }]}
3983
+ onViewChange={onViewChange}
3984
+ />,
3985
+ )
3986
+ await new Promise((r) => setTimeout(r, 0))
3987
+ fireEvent.click(screen.getByRole("tab", { name: "Upcoming" }))
3988
+ await waitFor(() => expect(agenda()).not.toBeNull())
3989
+ // The *id*, never the renderer name — the whole point of the id/renderer
3990
+ // split once one schedule can name its agenda whatever it likes.
3991
+ expect(onViewChange).toHaveBeenCalledWith("upcoming")
3992
+ })
3993
+ })
3994
+
3995
+ /**
3996
+ * `maxEventsPerDay` reaching Month *through* `Root`. Month-only, and `Root` is
3997
+ * the only composition with a view switcher, so before this was forwarded the
3998
+ * common case was pinned to the default `3` — the escape hatch was to abandon
3999
+ * `Root` and hand-compose `Schedule.Toolbar` around a standalone `MonthView`.
4000
+ *
4001
+ * Both halves matter, and the second is the one that actually unclips a short
4002
+ * container: the cap slices the chip list, *and* it sets each row's height
4003
+ * floor (`monthRowMinHeight`), which is what keeps the cell's own
4004
+ * `overflow-hidden` from eating the last pill and the "+N" chip with it.
4005
+ */
4006
+ describe("ScheduleRoot — month chip cap", () => {
4007
+ const FIVE: ScheduleStaticEvent[] = [8, 9, 10, 11, 12].map((h) => ({
4008
+ kind: "static",
4009
+ id: `m${h}`,
4010
+ title: `M${h}`,
4011
+ start: day(2026, 0, 15, h),
4012
+ end: day(2026, 0, 15, h + 1),
4013
+ }))
4014
+
4015
+ const renderMonth = (maxEventsPerDay?: number) =>
4016
+ render(
4017
+ <ScheduleRoot
4018
+ data={[]}
4019
+ staticEvents={FIVE}
4020
+ now={NOW}
4021
+ timeZone="UTC"
4022
+ defaultView="month"
4023
+ maxEventsPerDay={maxEventsPerDay}
4024
+ />,
4025
+ ).container
4026
+
4027
+ it("caps the day's chip list and counts the rest into the '+N' chip", () => {
4028
+ const container = renderMonth(2)
4029
+ const cell = container.querySelector('[data-testid="day-2026-01-15"]')
4030
+ expect(cell?.querySelectorAll('[data-schedule-part="event-chip"]')).toHaveLength(2)
4031
+ expect(cell?.querySelector('[data-schedule-part="month-overflow-chip"]')?.textContent).toBe(
4032
+ "+3",
4033
+ )
4034
+ })
4035
+
4036
+ it("carries the cap into the row-height floor, so the cap it promises fits", () => {
4037
+ const rows = (container: Element) =>
4038
+ container.querySelector<HTMLElement>('[style*="grid-template-rows"]')?.style
4039
+ .gridTemplateRows ?? ""
4040
+ // Two pills + the "+N" chip, against three + it: exactly one pill's box
4041
+ // (1rem line + py-0.5 + a 2px border + one gap-0.5) shorter.
4042
+ expect(rows(renderMonth(2))).toBe("auto repeat(5, minmax(calc(5.625rem + 6px), 1fr))")
4043
+ expect(rows(renderMonth(3))).toBe("auto repeat(5, minmax(calc(7rem + 8px), 1fr))")
4044
+ })
4045
+
4046
+ it("leaves the default where it already lives — MonthView's own `3`", () => {
4047
+ // `Root` destructures the prop without a default of its own, so omitting
4048
+ // it here must be indistinguishable from the standalone default. A second
4049
+ // default on `Root` would silently fork the two.
4050
+ const omitted = renderMonth(undefined)
4051
+ const explicit = renderMonth(3)
4052
+ const chips = (container: Element) =>
4053
+ container
4054
+ .querySelector('[data-testid="day-2026-01-15"]')
4055
+ ?.querySelectorAll('[data-schedule-part="event-chip"]').length
4056
+ expect(chips(omitted)).toBe(3)
4057
+ expect(chips(omitted)).toBe(chips(explicit))
4058
+ })
4059
+ })
4060
+
4061
+ /**
4062
+ * Prop scoping — `ScheduleProps` gates each slice on `views` actually
4063
+ * configuring a renderer that reads it (`lib/available-if.ts`).
4064
+ *
4065
+ * Most of this block is type-level: the elements are constructed and never
4066
+ * rendered, and `pnpm typecheck` is what enforces them. A bare
4067
+ * `@ts-expect-error` passes if the line errors for *any* reason, so every
4068
+ * negative case is paired with a positive twin — the same element with the
4069
+ * offending prop removed — which fails the typecheck if the rest of the line
4070
+ * ever stops being well-formed.
4071
+ *
4072
+ * Two of the cases exist specifically to catch traps that compile clean while
4073
+ * being wrong: a mixed `views` literal (which a tuple-wrapped renderer
4074
+ * projection resolves to `never`, silently forbidding everything), and
4075
+ * `dayDisabled` under `views={["days","month"]}` (which an "all of" gate
4076
+ * wrongly rejects even though Month is rendering). A suite that only covered
4077
+ * the uniform all-shorthand tuples would pass with either bug in place.
4078
+ */
4079
+ describe("ScheduleRoot — prop scoping", () => {
4080
+ const noop = () => {}
4081
+
4082
+ it("keeps every prop when `views` is omitted — the default call site is untouched", () => {
4083
+ const el = (
4084
+ <ScheduleRoot
4085
+ data={[]}
4086
+ slotDuration={30}
4087
+ editable={["drag"]}
4088
+ onEventChange={noop}
4089
+ onMonthClick={noop}
4090
+ maxEventsPerDay={4}
4091
+ dayDisabled={() => false}
4092
+ onDayClick={noop}
4093
+ align="relative"
4094
+ />
4095
+ )
4096
+ expect(el).toBeTruthy()
4097
+ })
4098
+
4099
+ it("rejects a days-only prop when no entry renders the days grid", () => {
4100
+ const ok = <ScheduleRoot data={[]} views={["month", "year"]} dayDisabled={() => false} />
4101
+ // @ts-expect-error `slotDuration` needs a days/day/week entry — ScheduleRenderers
4102
+ const bad = <ScheduleRoot data={[]} views={["month", "year"]} slotDuration={30} />
4103
+ // @ts-expect-error `maxDuration` caps days-grid gestures only
4104
+ const noCap = <ScheduleRoot data={[]} views={["month"]} maxDuration={120} />
4105
+ // @ts-expect-error `minDuration` floors days-grid gestures only
4106
+ const noFloor = <ScheduleRoot data={[]} views={["month"]} minDuration={60} />
4107
+ expect([ok, bad, noCap, noFloor]).toHaveLength(4)
4108
+ })
4109
+
4110
+ it("checks `minDuration`/`maxDuration` against the `slotDuration` beside them", () => {
4111
+ const ok = <ScheduleRoot data={[]} slotDuration={30} minDuration={60} maxDuration={240} />
4112
+ const defaultSlot = <ScheduleRoot data={[]} minDuration={45} />
4113
+ const pastADay = <ScheduleRoot data={[]} slotDuration={60} maxDuration={2880} />
4114
+ // @ts-expect-error only 15, 30 or 60
4115
+ const oddSlot = <ScheduleRoot data={[]} slotDuration={5} />
4116
+ // @ts-expect-error 45 is not a whole number of 30-minute slots
4117
+ const offGrid = <ScheduleRoot data={[]} slotDuration={30} minDuration={45} />
4118
+ // @ts-expect-error nor is 90 of 60-minute ones
4119
+ const offGridCap = <ScheduleRoot data={[]} slotDuration={60} maxDuration={90} />
4120
+ // @ts-expect-error the default slot is 15, and 20 is not a multiple of it
4121
+ const offDefault = <ScheduleRoot data={[]} minDuration={20} />
4122
+ // The standalone views carry the same check through their own `Omit`.
4123
+ const day = <DayView data={[]} slotDuration={30} minDuration={90} />
4124
+ // @ts-expect-error `DayViewProps` must not collapse the union
4125
+ const dayOffGrid = <DayView data={[]} slotDuration={30} minDuration={45} />
4126
+ // @ts-expect-error nor may `WeekViewProps`
4127
+ const weekOffGrid = <WeekView data={[]} slotDuration={60} minDuration={30} />
4128
+ // Values read at runtime are `number`s: refused as they are, accepted once
4129
+ // the guard has checked them together.
4130
+ const rules = { slotDuration: 15 as number, minDuration: 30 as number }
4131
+ // @ts-expect-error a bare `number` could be anything
4132
+ const unchecked = <ScheduleRoot data={[]} {...rules} />
4133
+ const checked = isScheduleSlotProps(rules) ? <ScheduleRoot data={[]} {...rules} /> : null
4134
+ expect([unchecked, checked]).toHaveLength(2)
4135
+ expect([
4136
+ ok,
4137
+ defaultSlot,
4138
+ pastADay,
4139
+ oddSlot,
4140
+ offGrid,
4141
+ offGridCap,
4142
+ offDefault,
4143
+ day,
4144
+ dayOffGrid,
4145
+ weekOffGrid,
4146
+ ]).toHaveLength(10)
4147
+ })
4148
+
4149
+ it("rejects `onMonthClick` without a year entry, and `renderDayDetails` without a month one", () => {
4150
+ const ok = <ScheduleRoot data={[]} views={["year"]} onMonthClick={noop} />
4151
+ // @ts-expect-error no year entry
4152
+ const noYear = <ScheduleRoot data={[]} views={["days"]} onMonthClick={noop} />
4153
+ // @ts-expect-error no month entry
4154
+ const noMonth = <ScheduleRoot data={[]} views={["days"]} renderDayDetails={() => null} />
4155
+ // @ts-expect-error no month entry
4156
+ const noCap = <ScheduleRoot data={[]} views={["days"]} maxEventsPerDay={4} />
4157
+ expect([ok, noYear, noMonth, noCap]).toHaveLength(4)
4158
+ })
4159
+
4160
+ it("rejects `renderEvent` under the default views, which exclude the agenda", () => {
4161
+ const ok = <ScheduleRoot data={[]} views={["days", "agenda"]} renderEvent={() => null} />
4162
+ // @ts-expect-error `DEFAULT_SCHEDULE_VIEWS` has no agenda entry
4163
+ const bad = <ScheduleRoot data={[]} renderEvent={() => null} />
4164
+ expect([ok, bad]).toHaveLength(2)
4165
+ })
4166
+
4167
+ it("allows `dayDisabled` when only one of month/year is configured — the gate is 'any of'", () => {
4168
+ // Guards the trap: `[R] extends [ScheduleRenderers<V>]` would read as "all
4169
+ // of R" and reject this, even though Month is rendering and reads it.
4170
+ const el = <ScheduleRoot data={[]} views={["days", "month"]} dayDisabled={() => false} />
4171
+ expect(el).toBeTruthy()
4172
+ })
4173
+
4174
+ it("resolves a mixed literal rather than collapsing it to `never`", () => {
4175
+ // Guards the trap: tuple-wrapping the renderer projection makes this
4176
+ // `never`, which forbids *every* scoped prop while still answering
4177
+ // correctly for the uniform tuples above.
4178
+ const el = (
4179
+ <ScheduleRoot
4180
+ data={[]}
4181
+ views={["day", { id: "quarter", view: "year" }]}
4182
+ slotDuration={30}
4183
+ onMonthClick={noop}
4184
+ />
4185
+ )
4186
+ const bad = (
4187
+ <ScheduleRoot
4188
+ data={[]}
4189
+ views={["day", { id: "quarter", view: "year" }]}
4190
+ // @ts-expect-error neither entry renders a month
4191
+ maxEventsPerDay={4}
4192
+ />
4193
+ )
4194
+ expect([el, bad]).toHaveLength(2)
4195
+ })
4196
+
4197
+ it("narrows `align`'s own type, not just its availability", () => {
4198
+ const ok = <ScheduleRoot data={[]} views={["month"]} align="mon" />
4199
+ // @ts-expect-error `"relative"` is a rolling days window; Month has no use for one
4200
+ const bad = <ScheduleRoot data={[]} views={["month"]} align="relative" />
4201
+ expect([ok, bad]).toHaveLength(2)
4202
+ })
4203
+
4204
+ it("still requires a granted gesture's callback, and forbids the pair without a days grid", () => {
4205
+ const ok = <ScheduleRoot data={[]} views={["days"]} editable={["drag"]} onEventChange={noop} />
4206
+ // @ts-expect-error `editable: ["drag"]` makes `onEventChange` required
4207
+ const missing = <ScheduleRoot data={[]} views={["days"]} editable={["drag"]} />
4208
+ // @ts-expect-error nothing is editable without a timed grid
4209
+ const noGrid = <ScheduleRoot data={[]} views={["month"]} editable onEventChange={noop} />
4210
+ expect([ok, missing, noGrid]).toHaveLength(3)
4211
+ })
4212
+
4213
+ it("accepts the overflow trio under month, and rejects it under year", () => {
4214
+ const ok = (
4215
+ <ScheduleRoot
4216
+ data={[]}
4217
+ views={["month"]}
4218
+ onOverflowClick={noop}
4219
+ withOverflowDetails={false}
4220
+ renderOverflowDetails={() => null}
4221
+ />
4222
+ )
4223
+ // @ts-expect-error Year caps nothing, so it has no "+N" to disclose
4224
+ const bad = <ScheduleRoot data={[]} views={["year"]} onOverflowClick={noop} />
4225
+ // @ts-expect-error same — the agenda is an unbounded list
4226
+ const alsoBad = <ScheduleRoot data={[]} views={["agenda"]} withOverflowDetails={false} />
4227
+ expect([ok, bad, alsoBad]).toHaveLength(3)
4228
+ })
4229
+
4230
+ it("keeps every prop for a `views` array it cannot resolve — it fails open", () => {
4231
+ const dynamic: ScheduleViewOption[] = ["month", "year"]
4232
+ const el = (
4233
+ <ScheduleRoot
4234
+ data={[]}
4235
+ views={dynamic}
4236
+ slotDuration={30}
4237
+ onMonthClick={noop}
4238
+ maxEventsPerDay={4}
4239
+ />
4240
+ )
4241
+ const empty = <ScheduleRoot data={[]} views={[]} slotDuration={30} />
4242
+ expect([el, empty]).toHaveLength(2)
4243
+ })
4244
+
4245
+ it("keeps the generic through the Object.assign namespace", () => {
4246
+ // Nothing else in this package renders through the barrel, and an erased
4247
+ // call signature would pin `V` to the default and only show up here.
4248
+ const ok = <Schedule data={[]} views={["month", "year"]} view="month" />
4249
+ // @ts-expect-error `"days"` is not one of the configured ids
4250
+ const bad = <Schedule data={[]} views={["month", "year"]} view="days" />
4251
+ expect([ok, bad]).toHaveLength(2)
4252
+ })
4253
+
4254
+ it("warns at runtime for a `views` array the type layer had to widen open", () => {
4255
+ const warn = vi.spyOn(console, "warn").mockImplementation(() => {})
4256
+ // A `ScheduleViewOption[]` can't be resolved at compile time, so the gates
4257
+ // permit everything — this is the only layer left that can say anything.
4258
+ const dynamic: ScheduleViewOption[] = ["month", "year"]
4259
+ render(
4260
+ <ScheduleRoot
4261
+ data={[]}
4262
+ now={NOW}
4263
+ timeZone="UTC"
4264
+ views={dynamic}
4265
+ slotDuration={30}
4266
+ onGridClick={noop}
4267
+ />,
4268
+ )
4269
+ expect(warn).toHaveBeenCalledWith(
4270
+ expect.stringContaining("`slotDuration` and `onGridClick` are ignored"),
4271
+ )
4272
+ expect(warn).toHaveBeenCalledWith(
4273
+ expect.stringContaining("no `views` entry renders the `days` view"),
4274
+ )
4275
+ warn.mockRestore()
4276
+ })
4277
+
4278
+ it("does not warn when every passed prop has a renderer that reads it", () => {
4279
+ const warn = vi.spyOn(console, "warn").mockImplementation(() => {})
4280
+ const dynamic: ScheduleViewOption[] = ["month", "year"]
4281
+ render(
4282
+ <ScheduleRoot data={[]} now={NOW} timeZone="UTC" views={dynamic} dayDisabled={() => false} />,
4283
+ )
4284
+ expect(warn).not.toHaveBeenCalledWith(expect.stringContaining("ignored"))
4285
+ warn.mockRestore()
4286
+ })
4287
+ })
4288
+
4289
+ describe("ScheduleRoot — minDuration", () => {
4290
+ /** 2880px over 1440 minutes = 2px/min, one 100px column per day. */
4291
+ const layOutColumns = () => {
4292
+ for (const column of document.querySelectorAll<HTMLElement>(
4293
+ "[data-schedule-part='day-column'][data-day-index]",
4294
+ )) {
4295
+ const index = Number(column.dataset["dayIndex"])
4296
+ vi.spyOn(column, "getBoundingClientRect").mockReturnValue({
4297
+ top: 0,
4298
+ bottom: 2880,
4299
+ height: 2880,
4300
+ left: index * 100,
4301
+ right: index * 100 + 100,
4302
+ width: 100,
4303
+ } as DOMRect)
4304
+ }
4305
+ }
4306
+
4307
+ const columnAt = (index: number) =>
4308
+ document.querySelectorAll<HTMLElement>("[data-schedule-part='day-column']")[
4309
+ index
4310
+ ] as HTMLElement
4311
+
4312
+ const setUp = () => {
4313
+ HTMLElement.prototype.setPointerCapture = vi.fn()
4314
+ HTMLElement.prototype.releasePointerCapture = vi.fn()
4315
+ }
4316
+
4317
+ it("grows a create shorter than the floor up to it", () => {
4318
+ setUp()
4319
+ const onEventCreate = vi.fn()
4320
+ render(
4321
+ <ScheduleRoot
4322
+ data={[]}
4323
+ now={NOW}
4324
+ timeZone="UTC"
4325
+ slotDuration={30}
4326
+ minDuration={60}
4327
+ editable={["create"]}
4328
+ onEventCreate={onEventCreate}
4329
+ />,
4330
+ )
4331
+ layOutColumns()
4332
+ // Thu Jan 15 is column 4. 10:00 → 10:20 is a 20-minute drag.
4333
+ const col = columnAt(4)
4334
+ fireEvent.pointerDown(col, {
4335
+ clientX: 450,
4336
+ clientY: 1200,
4337
+ pointerId: 1,
4338
+ button: 0,
4339
+ pointerType: "mouse",
4340
+ })
4341
+ fireEvent.pointerMove(col, { clientX: 450, clientY: 1240, pointerId: 1 })
4342
+ fireEvent.pointerUp(col, { clientX: 450, clientY: 1240, pointerId: 1 })
4343
+
4344
+ expect(onEventCreate).toHaveBeenCalledWith([
4345
+ { start: day(2026, 0, 15, 10), end: day(2026, 0, 15, 11) },
4346
+ ])
4347
+ })
4348
+
4349
+ it("stops a resize grip a whole floor away from the other edge", () => {
4350
+ setUp()
4351
+ const onEventChange = vi.fn()
4352
+ render(
4353
+ <ScheduleRoot
4354
+ data={[
4355
+ {
4356
+ kind: "event",
4357
+ id: "long",
4358
+ title: "Long",
4359
+ start: day(2026, 0, 15, 9),
4360
+ end: day(2026, 0, 15, 11),
4361
+ },
4362
+ ]}
4363
+ now={NOW}
4364
+ timeZone="UTC"
4365
+ slotDuration={30}
4366
+ minDuration={60}
4367
+ editable={["resize"]}
4368
+ onEventChange={onEventChange}
4369
+ />,
4370
+ )
4371
+ layOutColumns()
4372
+ const handle = screen
4373
+ .getByTestId("long")
4374
+ .querySelectorAll<HTMLElement>("[data-schedule-part='resize-handle']")[1] as HTMLElement
4375
+ // Drag the 11:00 end up to 09:00 (1320px → 1080px): it must stop at 10:00.
4376
+ fireEvent.pointerDown(handle, { clientX: 450, clientY: 1320, pointerId: 1, button: 0 })
4377
+ fireEvent.pointerMove(handle, { clientX: 450, clientY: 1080, pointerId: 1 })
4378
+ fireEvent.pointerUp(handle, { clientX: 450, clientY: 1080, pointerId: 1 })
4379
+
4380
+ expect(onEventChange).toHaveBeenCalledWith(
4381
+ expect.objectContaining({ id: "long" }),
4382
+ { start: day(2026, 0, 15, 9), end: day(2026, 0, 15, 10) },
4383
+ "resize",
4384
+ )
4385
+ })
4386
+ })