@kumix/ui 0.2.4 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (358) hide show
  1. package/README.md +32 -10
  2. package/dist/components/motion/action-swap-blur.d.ts +11 -0
  3. package/dist/components/motion/action-swap-blur.d.ts.map +1 -0
  4. package/dist/components/motion/action-swap-blur.js +26 -0
  5. package/dist/components/motion/action-swap-blur.js.map +1 -0
  6. package/dist/components/motion/action-swap-cascade.d.ts +11 -0
  7. package/dist/components/motion/action-swap-cascade.d.ts.map +1 -0
  8. package/dist/components/motion/action-swap-cascade.js +26 -0
  9. package/dist/components/motion/action-swap-cascade.js.map +1 -0
  10. package/dist/components/motion/action-swap-roll.d.ts +11 -0
  11. package/dist/components/motion/action-swap-roll.d.ts.map +1 -0
  12. package/dist/components/motion/action-swap-roll.js +26 -0
  13. package/dist/components/motion/action-swap-roll.js.map +1 -0
  14. package/dist/components/motion/action-swap.d.ts +41 -0
  15. package/dist/components/motion/action-swap.d.ts.map +1 -0
  16. package/dist/components/motion/action-swap.js +261 -0
  17. package/dist/components/motion/action-swap.js.map +1 -0
  18. package/dist/components/motion/animated-badge.d.ts +18 -0
  19. package/dist/components/motion/animated-badge.d.ts.map +1 -0
  20. package/dist/components/motion/animated-badge.js +206 -0
  21. package/dist/components/motion/animated-badge.js.map +1 -0
  22. package/dist/components/motion/animated-number.d.ts +12 -0
  23. package/dist/components/motion/animated-number.d.ts.map +1 -0
  24. package/dist/components/motion/animated-number.js +47 -0
  25. package/dist/components/motion/animated-number.js.map +1 -0
  26. package/dist/components/motion/animated-sidebar.d.ts +97 -0
  27. package/dist/components/motion/animated-sidebar.d.ts.map +1 -0
  28. package/dist/components/motion/animated-sidebar.js +611 -0
  29. package/dist/components/motion/animated-sidebar.js.map +1 -0
  30. package/dist/components/motion/animated-toast-stack.d.ts +65 -0
  31. package/dist/components/motion/animated-toast-stack.d.ts.map +1 -0
  32. package/dist/components/motion/animated-toast-stack.js +303 -0
  33. package/dist/components/motion/animated-toast-stack.js.map +1 -0
  34. package/dist/components/motion/bottom-sheet.d.ts +19 -0
  35. package/dist/components/motion/bottom-sheet.d.ts.map +1 -0
  36. package/dist/components/motion/bottom-sheet.js +146 -0
  37. package/dist/components/motion/bottom-sheet.js.map +1 -0
  38. package/dist/components/motion/bounce-sidebar.d.ts +26 -0
  39. package/dist/components/motion/bounce-sidebar.d.ts.map +1 -0
  40. package/dist/components/motion/bounce-sidebar.js +164 -0
  41. package/dist/components/motion/bounce-sidebar.js.map +1 -0
  42. package/dist/components/motion/bouncy-accordion.d.ts +32 -0
  43. package/dist/components/motion/bouncy-accordion.d.ts.map +1 -0
  44. package/dist/components/motion/bouncy-accordion.js +172 -0
  45. package/dist/components/motion/bouncy-accordion.js.map +1 -0
  46. package/dist/components/motion/button/base.d.ts +17 -0
  47. package/dist/components/motion/button/base.d.ts.map +1 -0
  48. package/dist/components/motion/button/base.js +86 -0
  49. package/dist/components/motion/button/base.js.map +1 -0
  50. package/dist/components/motion/button/magnetic.d.ts +12 -0
  51. package/dist/components/motion/button/magnetic.d.ts.map +1 -0
  52. package/dist/components/motion/button/magnetic.js +21 -0
  53. package/dist/components/motion/button/magnetic.js.map +1 -0
  54. package/dist/components/motion/button/stateful.d.ts +16 -0
  55. package/dist/components/motion/button/stateful.d.ts.map +1 -0
  56. package/dist/components/motion/button/stateful.js +190 -0
  57. package/dist/components/motion/button/stateful.js.map +1 -0
  58. package/dist/components/motion/center-morph-modal.d.ts +43 -0
  59. package/dist/components/motion/center-morph-modal.d.ts.map +1 -0
  60. package/dist/components/motion/center-morph-modal.js +238 -0
  61. package/dist/components/motion/center-morph-modal.js.map +1 -0
  62. package/dist/components/motion/checkbox.d.ts +15 -0
  63. package/dist/components/motion/checkbox.d.ts.map +1 -0
  64. package/dist/components/motion/checkbox.js +81 -0
  65. package/dist/components/motion/checkbox.js.map +1 -0
  66. package/dist/components/motion/chromatic-text-reveal.d.ts +31 -0
  67. package/dist/components/motion/chromatic-text-reveal.d.ts.map +1 -0
  68. package/dist/components/motion/chromatic-text-reveal.js +132 -0
  69. package/dist/components/motion/chromatic-text-reveal.js.map +1 -0
  70. package/dist/components/motion/context-menu.d.ts +71 -0
  71. package/dist/components/motion/context-menu.d.ts.map +1 -0
  72. package/dist/components/motion/context-menu.js +454 -0
  73. package/dist/components/motion/context-menu.js.map +1 -0
  74. package/dist/components/motion/cylinder-carousel.d.ts +40 -0
  75. package/dist/components/motion/cylinder-carousel.d.ts.map +1 -0
  76. package/dist/components/motion/cylinder-carousel.js +274 -0
  77. package/dist/components/motion/cylinder-carousel.js.map +1 -0
  78. package/dist/components/motion/dock.d.ts +24 -0
  79. package/dist/components/motion/dock.d.ts.map +1 -0
  80. package/dist/components/motion/dock.js +62 -0
  81. package/dist/components/motion/dock.js.map +1 -0
  82. package/dist/components/motion/drawer.d.ts +19 -0
  83. package/dist/components/motion/drawer.d.ts.map +1 -0
  84. package/dist/components/motion/drawer.js +58 -0
  85. package/dist/components/motion/drawer.js.map +1 -0
  86. package/dist/components/motion/hold-action-button.d.ts +17 -0
  87. package/dist/components/motion/hold-action-button.d.ts.map +1 -0
  88. package/dist/components/motion/hold-action-button.js +158 -0
  89. package/dist/components/motion/hold-action-button.js.map +1 -0
  90. package/dist/components/motion/input.d.ts +29 -0
  91. package/dist/components/motion/input.d.ts.map +1 -0
  92. package/dist/components/motion/input.js +126 -0
  93. package/dist/components/motion/input.js.map +1 -0
  94. package/dist/components/motion/loader.d.ts +17 -0
  95. package/dist/components/motion/loader.d.ts.map +1 -0
  96. package/dist/components/motion/loader.js +791 -0
  97. package/dist/components/motion/loader.js.map +1 -0
  98. package/dist/components/motion/magnetic.d.ts +11 -0
  99. package/dist/components/motion/magnetic.d.ts.map +1 -0
  100. package/dist/components/motion/magnetic.js +44 -0
  101. package/dist/components/motion/magnetic.js.map +1 -0
  102. package/dist/components/motion/marquee.d.ts +15 -0
  103. package/dist/components/motion/marquee.d.ts.map +1 -0
  104. package/dist/components/motion/marquee.js +35 -0
  105. package/dist/components/motion/marquee.js.map +1 -0
  106. package/dist/components/motion/morphing-modal.d.ts +15 -0
  107. package/dist/components/motion/morphing-modal.d.ts.map +1 -0
  108. package/dist/components/motion/morphing-modal.js +117 -0
  109. package/dist/components/motion/morphing-modal.js.map +1 -0
  110. package/dist/components/motion/number-ticker.d.ts +26 -0
  111. package/dist/components/motion/number-ticker.d.ts.map +1 -0
  112. package/dist/components/motion/number-ticker.js +129 -0
  113. package/dist/components/motion/number-ticker.js.map +1 -0
  114. package/dist/components/motion/parallax.d.ts +21 -0
  115. package/dist/components/motion/parallax.d.ts.map +1 -0
  116. package/dist/components/motion/parallax.js +35 -0
  117. package/dist/components/motion/parallax.js.map +1 -0
  118. package/dist/components/motion/popover-morph.d.ts +38 -0
  119. package/dist/components/motion/popover-morph.d.ts.map +1 -0
  120. package/dist/components/motion/popover-morph.js +167 -0
  121. package/dist/components/motion/popover-morph.js.map +1 -0
  122. package/dist/components/motion/popover.d.ts +40 -0
  123. package/dist/components/motion/popover.d.ts.map +1 -0
  124. package/dist/components/motion/popover.js +393 -0
  125. package/dist/components/motion/popover.js.map +1 -0
  126. package/dist/components/motion/preview-rail.d.ts +26 -0
  127. package/dist/components/motion/preview-rail.d.ts.map +1 -0
  128. package/dist/components/motion/preview-rail.js +134 -0
  129. package/dist/components/motion/preview-rail.js.map +1 -0
  130. package/dist/components/motion/pull-to-refresh.d.ts +28 -0
  131. package/dist/components/motion/pull-to-refresh.d.ts.map +1 -0
  132. package/dist/components/motion/pull-to-refresh.js +389 -0
  133. package/dist/components/motion/pull-to-refresh.js.map +1 -0
  134. package/dist/components/motion/radio.d.ts +22 -0
  135. package/dist/components/motion/radio.d.ts.map +1 -0
  136. package/dist/components/motion/radio.js +79 -0
  137. package/dist/components/motion/radio.js.map +1 -0
  138. package/dist/components/motion/range-slider-bubble.d.ts +16 -0
  139. package/dist/components/motion/range-slider-bubble.d.ts.map +1 -0
  140. package/dist/components/motion/range-slider-bubble.js +117 -0
  141. package/dist/components/motion/range-slider-bubble.js.map +1 -0
  142. package/dist/components/motion/range-slider-fluid.d.ts +18 -0
  143. package/dist/components/motion/range-slider-fluid.d.ts.map +1 -0
  144. package/dist/components/motion/range-slider-fluid.js +63 -0
  145. package/dist/components/motion/range-slider-fluid.js.map +1 -0
  146. package/dist/components/motion/range-slider-ruler.d.ts +19 -0
  147. package/dist/components/motion/range-slider-ruler.d.ts.map +1 -0
  148. package/dist/components/motion/range-slider-ruler.js +142 -0
  149. package/dist/components/motion/range-slider-ruler.js.map +1 -0
  150. package/dist/components/motion/range-slider-wave.d.ts +16 -0
  151. package/dist/components/motion/range-slider-wave.d.ts.map +1 -0
  152. package/dist/components/motion/range-slider-wave.js +57 -0
  153. package/dist/components/motion/range-slider-wave.js.map +1 -0
  154. package/dist/components/motion/range-slider.d.ts +11 -0
  155. package/dist/components/motion/range-slider.d.ts.map +1 -0
  156. package/dist/components/motion/range-slider.js +63 -0
  157. package/dist/components/motion/range-slider.js.map +1 -0
  158. package/dist/components/motion/scroll-progress.d.ts +29 -0
  159. package/dist/components/motion/scroll-progress.d.ts.map +1 -0
  160. package/dist/components/motion/scroll-progress.js +71 -0
  161. package/dist/components/motion/scroll-progress.js.map +1 -0
  162. package/dist/components/motion/scroll-reveal.d.ts +23 -0
  163. package/dist/components/motion/scroll-reveal.d.ts.map +1 -0
  164. package/dist/components/motion/scroll-reveal.js +42 -0
  165. package/dist/components/motion/scroll-reveal.js.map +1 -0
  166. package/dist/components/motion/scroll-to.d.ts +21 -0
  167. package/dist/components/motion/scroll-to.d.ts.map +1 -0
  168. package/dist/components/motion/scroll-to.js +27 -0
  169. package/dist/components/motion/scroll-to.js.map +1 -0
  170. package/dist/components/motion/select-morph.d.ts +41 -0
  171. package/dist/components/motion/select-morph.d.ts.map +1 -0
  172. package/dist/components/motion/select-morph.js +251 -0
  173. package/dist/components/motion/select-morph.js.map +1 -0
  174. package/dist/components/motion/select.d.ts +36 -0
  175. package/dist/components/motion/select.d.ts.map +1 -0
  176. package/dist/components/motion/select.js +319 -0
  177. package/dist/components/motion/select.js.map +1 -0
  178. package/dist/components/motion/shader-background.d.ts +38 -0
  179. package/dist/components/motion/shader-background.d.ts.map +1 -0
  180. package/dist/components/motion/shader-background.js +49 -0
  181. package/dist/components/motion/shader-background.js.map +1 -0
  182. package/dist/components/motion/shared-layout-bg.d.ts +17 -0
  183. package/dist/components/motion/shared-layout-bg.d.ts.map +1 -0
  184. package/dist/components/motion/shared-layout-bg.js +88 -0
  185. package/dist/components/motion/shared-layout-bg.js.map +1 -0
  186. package/dist/components/motion/slide-action-button.d.ts +15 -0
  187. package/dist/components/motion/slide-action-button.d.ts.map +1 -0
  188. package/dist/components/motion/slide-action-button.js +146 -0
  189. package/dist/components/motion/slide-action-button.js.map +1 -0
  190. package/dist/components/motion/smooth-scroll.d.ts +47 -0
  191. package/dist/components/motion/smooth-scroll.d.ts.map +1 -0
  192. package/dist/components/motion/smooth-scroll.js +182 -0
  193. package/dist/components/motion/smooth-scroll.js.map +1 -0
  194. package/dist/components/motion/switch.d.ts +13 -0
  195. package/dist/components/motion/switch.d.ts.map +1 -0
  196. package/dist/components/motion/switch.js +76 -0
  197. package/dist/components/motion/switch.js.map +1 -0
  198. package/dist/components/motion/table/editable-cell.d.ts +9 -0
  199. package/dist/components/motion/table/editable-cell.d.ts.map +1 -0
  200. package/dist/components/motion/table/editable-cell.js +17 -0
  201. package/dist/components/motion/table/editable-cell.js.map +1 -0
  202. package/dist/components/motion/table/index.d.ts +6 -0
  203. package/dist/components/motion/table/index.d.ts.map +1 -0
  204. package/dist/components/motion/table/index.js +420 -0
  205. package/dist/components/motion/table/index.js.map +1 -0
  206. package/dist/components/motion/table/row-handle.d.ts +15 -0
  207. package/dist/components/motion/table/row-handle.d.ts.map +1 -0
  208. package/dist/components/motion/table/row-handle.js +51 -0
  209. package/dist/components/motion/table/row-handle.js.map +1 -0
  210. package/dist/components/motion/table/skeleton-rows.d.ts +11 -0
  211. package/dist/components/motion/table/skeleton-rows.d.ts.map +1 -0
  212. package/dist/components/motion/table/skeleton-rows.js +23 -0
  213. package/dist/components/motion/table/skeleton-rows.js.map +1 -0
  214. package/dist/components/motion/table/table-header.d.ts +35 -0
  215. package/dist/components/motion/table/table-header.d.ts.map +1 -0
  216. package/dist/components/motion/table/table-header.js +167 -0
  217. package/dist/components/motion/table/table-header.js.map +1 -0
  218. package/dist/components/motion/table/table-menu.d.ts +17 -0
  219. package/dist/components/motion/table/table-menu.d.ts.map +1 -0
  220. package/dist/components/motion/table/table-menu.js +92 -0
  221. package/dist/components/motion/table/table-menu.js.map +1 -0
  222. package/dist/components/motion/tabs.d.ts +29 -0
  223. package/dist/components/motion/tabs.d.ts.map +1 -0
  224. package/dist/components/motion/tabs.js +125 -0
  225. package/dist/components/motion/tabs.js.map +1 -0
  226. package/dist/components/motion/text-cascade.d.ts +15 -0
  227. package/dist/components/motion/text-cascade.d.ts.map +1 -0
  228. package/dist/components/motion/text-cascade.js +21 -0
  229. package/dist/components/motion/text-cascade.js.map +1 -0
  230. package/dist/components/motion/text-reveal.d.ts +25 -0
  231. package/dist/components/motion/text-reveal.d.ts.map +1 -0
  232. package/dist/components/motion/text-reveal.js +94 -0
  233. package/dist/components/motion/text-reveal.js.map +1 -0
  234. package/dist/components/motion/text-shimmer.d.ts +12 -0
  235. package/dist/components/motion/text-shimmer.d.ts.map +1 -0
  236. package/dist/components/motion/text-shimmer.js +15 -0
  237. package/dist/components/motion/text-shimmer.js.map +1 -0
  238. package/dist/components/motion/theme-toggle.d.ts +23 -0
  239. package/dist/components/motion/theme-toggle.d.ts.map +1 -0
  240. package/dist/components/motion/theme-toggle.js +160 -0
  241. package/dist/components/motion/theme-toggle.js.map +1 -0
  242. package/dist/components/motion/tilt-card.d.ts +12 -0
  243. package/dist/components/motion/tilt-card.d.ts.map +1 -0
  244. package/dist/components/motion/tilt-card.js +56 -0
  245. package/dist/components/motion/tilt-card.js.map +1 -0
  246. package/dist/components/motion/tooltip.d.ts +17 -0
  247. package/dist/components/motion/tooltip.d.ts.map +1 -0
  248. package/dist/components/motion/tooltip.js +194 -0
  249. package/dist/components/motion/tooltip.js.map +1 -0
  250. package/dist/components/motion/wheel-picker.d.ts +24 -0
  251. package/dist/components/motion/wheel-picker.d.ts.map +1 -0
  252. package/dist/components/motion/wheel-picker.js +442 -0
  253. package/dist/components/motion/wheel-picker.js.map +1 -0
  254. package/dist/components/reui/alert.d.ts +1 -1
  255. package/dist/components/reui/alert.js +1 -1
  256. package/dist/components/reui/autocomplete.js +2 -2
  257. package/dist/components/reui/badge.d.ts +2 -2
  258. package/dist/components/reui/badge.js +10 -9
  259. package/dist/components/reui/badge.js.map +1 -1
  260. package/dist/components/reui/data-grid/data-grid-table-dnd.js +21 -19
  261. package/dist/components/reui/data-grid/data-grid-table-dnd.js.map +1 -1
  262. package/dist/components/reui/data-grid/data-grid-table-virtual.d.ts +1 -1
  263. package/dist/components/reui/data-grid/data-grid-table-virtual.js +1 -1
  264. package/dist/components/reui/data-grid/data-grid-table.js +4 -2
  265. package/dist/components/reui/data-grid/data-grid-table.js.map +1 -1
  266. package/dist/components/reui/event-calendar/event-calendar-agenda-view.js +2 -1
  267. package/dist/components/reui/event-calendar/event-calendar-agenda-view.js.map +1 -1
  268. package/dist/components/reui/event-calendar/event-calendar-content.js +8 -7
  269. package/dist/components/reui/event-calendar/event-calendar-content.js.map +1 -1
  270. package/dist/components/reui/event-calendar/event-calendar-dnd.js +7 -4
  271. package/dist/components/reui/event-calendar/event-calendar-dnd.js.map +1 -1
  272. package/dist/components/reui/event-calendar/event-calendar-event.js +49 -47
  273. package/dist/components/reui/event-calendar/event-calendar-event.js.map +1 -1
  274. package/dist/components/reui/event-calendar/event-calendar-lib.js +3 -2
  275. package/dist/components/reui/event-calendar/event-calendar-lib.js.map +1 -1
  276. package/dist/components/reui/event-calendar/event-calendar-nav.js +37 -31
  277. package/dist/components/reui/event-calendar/event-calendar-nav.js.map +1 -1
  278. package/dist/components/reui/event-calendar/event-calendar-time-grid.js +2 -1
  279. package/dist/components/reui/event-calendar/event-calendar-time-grid.js.map +1 -1
  280. package/dist/components/reui/event-calendar/event-calendar.js +2 -1
  281. package/dist/components/reui/event-calendar/event-calendar.js.map +1 -1
  282. package/dist/components/reui/filters.js +5 -3
  283. package/dist/components/reui/filters.js.map +1 -1
  284. package/dist/components/reui/frame.d.ts +2 -2
  285. package/dist/components/reui/frame.js +1 -1
  286. package/dist/components/reui/gantt/gantt-bar.js +52 -51
  287. package/dist/components/reui/gantt/gantt-bar.js.map +1 -1
  288. package/dist/components/reui/gantt/gantt-lib.js +3 -2
  289. package/dist/components/reui/gantt/gantt-lib.js.map +1 -1
  290. package/dist/components/reui/gantt/gantt-nav.js +34 -30
  291. package/dist/components/reui/gantt/gantt-nav.js.map +1 -1
  292. package/dist/components/reui/gantt/gantt-recurrence.js +2 -2
  293. package/dist/components/reui/gantt/gantt-recurrence.js.map +1 -1
  294. package/dist/components/reui/gantt/gantt-view.js +175 -171
  295. package/dist/components/reui/gantt/gantt-view.js.map +1 -1
  296. package/dist/components/reui/icon-tile.d.ts +1 -1
  297. package/dist/components/reui/icon-tile.js +12 -11
  298. package/dist/components/reui/icon-tile.js.map +1 -1
  299. package/dist/components/reui/kanban.js +42 -37
  300. package/dist/components/reui/kanban.js.map +1 -1
  301. package/dist/components/reui/number-field.js +1 -1
  302. package/dist/components/reui/rating.js +1 -1
  303. package/dist/components/reui/sortable.js +10 -9
  304. package/dist/components/reui/sortable.js.map +1 -1
  305. package/dist/components/reui/stepper.js +16 -16
  306. package/dist/components/reui/stepper.js.map +1 -1
  307. package/dist/components/reui/timeline.js +45 -38
  308. package/dist/components/reui/timeline.js.map +1 -1
  309. package/dist/components/reui/tree.js +2 -1
  310. package/dist/components/reui/tree.js.map +1 -1
  311. package/dist/components/ui/alert.js +1 -1
  312. package/dist/components/ui/attachment.d.ts +1 -1
  313. package/dist/components/ui/attachment.js +1 -1
  314. package/dist/components/ui/badge.d.ts +1 -1
  315. package/dist/components/ui/bubble.d.ts +1 -1
  316. package/dist/components/ui/bubble.js +1 -1
  317. package/dist/components/ui/button-group.js +1 -1
  318. package/dist/components/ui/button.d.ts +2 -2
  319. package/dist/components/ui/button.js +1 -1
  320. package/dist/components/ui/empty.d.ts +1 -1
  321. package/dist/components/ui/empty.js +1 -1
  322. package/dist/components/ui/field.js +1 -1
  323. package/dist/components/ui/input-group.js +1 -1
  324. package/dist/components/ui/item.d.ts +2 -2
  325. package/dist/components/ui/item.js +1 -1
  326. package/dist/components/ui/marker.js +1 -1
  327. package/dist/components/ui/navigation-menu.js +1 -1
  328. package/dist/components/ui/sidebar.d.ts +1 -1
  329. package/dist/components/ui/sidebar.js +2 -2
  330. package/dist/components/ui/sidebar.js.map +1 -1
  331. package/dist/components/ui/tabs.js +1 -1
  332. package/dist/components/ui/toggle.d.ts +1 -1
  333. package/dist/components/ui/toggle.js +1 -1
  334. package/dist/hooks/use-hover-capable.d.ts +10 -0
  335. package/dist/hooks/use-hover-capable.d.ts.map +1 -0
  336. package/dist/hooks/use-hover-capable.js +24 -0
  337. package/dist/hooks/use-hover-capable.js.map +1 -0
  338. package/dist/hooks/use-mobile.js +1 -1
  339. package/dist/hooks/use-mobile.js.map +1 -1
  340. package/dist/hooks/use-slider.d.ts +58 -0
  341. package/dist/hooks/use-slider.d.ts.map +1 -0
  342. package/dist/hooks/use-slider.js +133 -0
  343. package/dist/hooks/use-slider.js.map +1 -0
  344. package/dist/lib/ease.d.ts +50 -0
  345. package/dist/lib/ease.d.ts.map +1 -0
  346. package/dist/lib/ease.js +66 -0
  347. package/dist/lib/ease.js.map +1 -0
  348. package/dist/lib/tick-sound.d.ts +17 -0
  349. package/dist/lib/tick-sound.d.ts.map +1 -0
  350. package/dist/lib/tick-sound.js +120 -0
  351. package/dist/lib/tick-sound.js.map +1 -0
  352. package/dist/popover-position-BUqYCq8X.js +54 -0
  353. package/dist/popover-position-BUqYCq8X.js.map +1 -0
  354. package/dist/types-Bah5NY44.d.ts +81 -0
  355. package/dist/types-Bah5NY44.d.ts.map +1 -0
  356. package/dist/utils-DQ7OpbYQ.js +25 -0
  357. package/dist/utils-DQ7OpbYQ.js.map +1 -0
  358. package/package.json +17 -6
@@ -1 +1 @@
1
- {"version":3,"file":"event-calendar-dnd.js","names":[],"sources":["../../../../src/components/reui/event-calendar/event-calendar-dnd.tsx"],"sourcesContent":["\"use client\";\n\nimport { useCallback, useEffect, useMemo } from \"react\";\nimport { addDays, addMinutes, differenceInCalendarDays } from \"date-fns\";\n\nimport {\n type EventCalendarInstance,\n useEventCalendar,\n useEventCalendarViewConfig,\n} from \"./event-calendar\";\nimport { snapMinutes, toZoned, zonedStartOfDay } from \"./event-calendar-lib\";\nimport type { EventCalendarProposedUpdate, EventCalendarSegment } from \"./event-calendar-types\";\n\n/**\n * Activation policy (dnd-kit parity where proven):\n * mouse move 5px before a drag starts (below = click), create 4px;\n * touch long-press 250ms with 5px tolerance (movement past tolerance\n * before the delay cancels the drag so taps stay taps).\n */\nconst EVENT_CALENDAR_ACTIVATION = {\n moveDistancePx: 5,\n createDistancePx: 4,\n touchDelayMs: 250,\n touchTolerancePx: 5,\n autoScrollEdgePx: 48,\n autoScrollMaxStepPx: 15,\n} as const;\n\ntype GestureKind = \"move\" | \"resize-start\" | \"resize-end\" | \"create\";\n\ninterface TimeColumnRect {\n day: Date;\n rect: DOMRect;\n boundsStartMin: number;\n boundsEndMin: number;\n resourceId?: string;\n}\n\ninterface DayCellRect {\n day: Date;\n rect: DOMRect;\n}\n\ninterface Surface {\n /** Minute-precise day columns (week/day/days) or resource columns. */\n columns: TimeColumnRect[];\n /** Day-precise cells (month grid, all-day row). */\n cells: DayCellRect[];\n viewport: HTMLElement | null;\n /**\n * Viewport rect captured ONCE at gesture start. The scroll container does\n * not move on screen while a pointer drag is captured (auto-scroll changes\n * its scrollTop, not its box), so reusing this avoids a per-pointermove\n * getBoundingClientRect - that read forces a synchronous full-document\n * reflow, which is cheap on a bare demo page but ~200ms on a long docs page\n * (big prop tables re-lay-out on every flush), turning drag into a slideshow.\n */\n viewportRect: DOMRect | null;\n viewportStartScrollTop: number;\n /**\n * Live scrollTop, seeded from the start value and advanced by auto-scroll\n * itself. Tracking it here lets pointerMinutes read a number instead of the\n * DOM `scrollTop` property every move (another forced reflow).\n */\n scrollTop: number;\n}\n\n/** Module flag so chip onClick can ignore the click that ends a drag. */\nlet lastGestureEndedAt = 0;\nfunction wasRecentDrag(): boolean {\n return performance.now() - lastGestureEndedAt < 250;\n}\n\n/**\n * A press that started on an event chip. Slot-create clicks consult this so a\n * refused drag (e.g. a locked chip that never registers a gesture) whose\n * trailing native click retargets to the empty grid does NOT open a create\n * dialog. Refreshed on release so it covers long presses; the chip's own\n * click-to-edit is unaffected (only grid slot-clicks check it).\n */\nlet lastChipPressAt = 0;\nfunction markChipPress(): void {\n lastChipPressAt = performance.now();\n window.addEventListener(\n \"pointerup\",\n () => {\n lastChipPressAt = performance.now();\n },\n { once: true, capture: true },\n );\n}\nfunction wasRecentChipPress(): boolean {\n return performance.now() - lastChipPressAt < 300;\n}\n\n/**\n * Registry of in-flight gesture cancels. A gesture measures its surface (day\n * columns and cells) once at activation and then lives on window listeners, so\n * the CALENDAR - not the chip, chips legitimately unmount mid-gesture (lane\n * repacking, a \"+N more\" popover closing) - is what must be able to abort it.\n * Cancel fully reverts: listeners, overlays and the body drag state all clear,\n * and no update is committed.\n */\nconst activeGestureCancels = new Set<() => void>();\n\n/** Cancel (and fully revert) every in-flight event calendar pointer gesture. */\nfunction cancelActiveEventCalendarGestures(): void {\n for (const cancel of [...activeGestureCancels]) cancel();\n}\n\n/**\n * Mounted-consumer count for the gestures hook. Every chip holds one, so only\n * the LAST consumer leaving means the calendar itself is gone; aborting when\n * any single chip unmounts would kill a drag the user is still holding.\n */\nlet gestureConsumers = 0;\n\n/**\n * Snap a translate offset to the device pixel grid. The cursor-following\n * overlays (carry clone, drop hint) are their own `will-change: transform`\n * compositing layers: the GPU rasterizes their text once and repositions that\n * texture each frame, so a subpixel translate (getBoundingClientRect and raw\n * clientX/Y are routinely fractional) resamples the texture and blurs the\n * text. Rounding each offset to a whole device pixel lands the layer on the\n * grid so glyphs stay crisp, without giving up the per-frame GPU transform.\n */\nfunction snapToPixel(value: number): number {\n const dpr = typeof window !== \"undefined\" ? window.devicePixelRatio || 1 : 1;\n return Math.round(value * dpr) / dpr;\n}\n\nfunction collectSurface(origin: HTMLElement, fallbackRoot?: HTMLElement | null): Surface {\n // A gesture from a portaled surface (the \"+N more\" popover) has no calendar\n // ancestor, so fall back to the root the host registered on the instance.\n const root =\n origin.closest<HTMLElement>(\"[data-slot=event-calendar-time-grid]\") ??\n origin.closest<HTMLElement>(\"[data-slot=event-calendar-resource-view]\") ??\n origin.closest<HTMLElement>(\"[data-slot=event-calendar-month-view]\") ??\n origin.closest<HTMLElement>(\"[data-slot=event-calendar]\") ??\n fallbackRoot ??\n null;\n\n const columns: TimeColumnRect[] = [];\n const cells: DayCellRect[] = [];\n if (root) {\n for (const el of root.querySelectorAll<HTMLElement>(\"[data-ec-day]\")) {\n const day = new Date(Number(el.dataset.ecDay));\n if (el.dataset.ecBoundsStart !== undefined) {\n columns.push({\n day,\n rect: el.getBoundingClientRect(),\n boundsStartMin: Number(el.dataset.ecBoundsStart),\n boundsEndMin: Number(el.dataset.ecBoundsEnd),\n resourceId: el.dataset.ecResource,\n });\n } else {\n cells.push({ day, rect: el.getBoundingClientRect() });\n }\n }\n }\n const viewport = root?.querySelector<HTMLElement>(\"[data-slot=scroll-area-viewport]\") ?? null;\n const viewportStartScrollTop = viewport?.scrollTop ?? 0;\n return {\n columns,\n cells,\n viewport,\n viewportRect: viewport?.getBoundingClientRect() ?? null,\n viewportStartScrollTop,\n scrollTop: viewportStartScrollTop,\n };\n}\n\nfunction findColumn(surface: Surface, clientX: number): TimeColumnRect | undefined {\n const scrollAdjusted = surface.columns;\n let best: TimeColumnRect | undefined;\n for (const col of scrollAdjusted) {\n if (clientX >= col.rect.left && clientX < col.rect.right) return col;\n if (!best) best = col;\n // clamp to nearest horizontal column\n const bestDist = Math.min(\n Math.abs(clientX - best.rect.left),\n Math.abs(clientX - best.rect.right),\n );\n const dist = Math.min(Math.abs(clientX - col.rect.left), Math.abs(clientX - col.rect.right));\n if (dist < bestDist) best = col;\n }\n return best;\n}\n\nfunction findCell(surface: Surface, x: number, y: number): DayCellRect | undefined {\n return surface.cells.find(\n (cell) =>\n x >= cell.rect.left && x < cell.rect.right && y >= cell.rect.top && y < cell.rect.bottom,\n );\n}\n\nfunction pointerMinutes(surface: Surface, col: TimeColumnRect, clientY: number): number {\n const scrollDelta = surface.scrollTop - surface.viewportStartScrollTop;\n const boundsMinutes = col.boundsEndMin - col.boundsStartMin;\n const pxPerMinute = col.rect.height / Math.max(1, boundsMinutes);\n const y = clientY - col.rect.top + scrollDelta;\n return col.boundsStartMin + y / pxPerMinute;\n}\n\ninterface BeginGestureConfig<TData> {\n instance: EventCalendarInstance<TData>;\n kind: GestureKind;\n origin: HTMLElement;\n startEvent: PointerEvent;\n segment?: EventCalendarSegment<TData>;\n /** create only */\n createDay?: Date;\n createAllDay?: boolean;\n /**\n * Consumer classNames for the engine's vanilla-DOM overlays (carry clone,\n * validation hint pill), forwarded by the gestures hook - the engine itself\n * must never import from the React chip module.\n */\n ui?: {\n dragCarry?: string;\n dragCarryInvalid?: string;\n dropHint?: string;\n };\n}\n\n/**\n * A move/resize was refused (locked, per-event disabled, or interaction off).\n * Rather than silently swallow the press, track the pointer: once it crosses\n * the activation threshold - i.e. the user genuinely tried to drag - show a\n * not-allowed cursor and broadcast once via onDragBlocked so the consumer can\n * explain it. The calendar picks no message. Fires at most once per gesture.\n */\nfunction beginBlockedGesture<TData>(\n instance: EventCalendarInstance<TData>,\n startEvent: PointerEvent,\n segment: EventCalendarSegment<TData>,\n gesture: \"move\" | \"resize\",\n) {\n const startX = startEvent.clientX;\n const startY = startEvent.clientY;\n const activation = {\n ...EVENT_CALENDAR_ACTIVATION,\n ...instance.settings.activation,\n };\n const event = segment.occurrence.event;\n const reason: \"readOnly\" | \"disabled\" | \"interactions-off\" = event.readOnly\n ? \"readOnly\"\n : (gesture === \"move\" ? event.draggable : event.resizable) === false\n ? \"disabled\"\n : \"interactions-off\";\n const pointerId = startEvent.pointerId;\n let activated = false;\n let finished = false;\n const onMove = (e: PointerEvent) => {\n if (e.pointerId !== pointerId || activated) return;\n if (Math.hypot(e.clientX - startX, e.clientY - startY) < activation.moveDistancePx) {\n return;\n }\n activated = true;\n document.body.style.cursor = \"not-allowed\";\n // body class alongside the inline cursor so consumer CSS can restyle or\n // detect the blocked-drag state (mirrors \"ec-dragging\")\n document.body.classList.add(\"ec-drag-blocked\");\n // only now is there anything to get stuck: focus loss means the release\n // may never be delivered, leaving the cursor not-allowed document-wide\n window.addEventListener(\"blur\", cleanup);\n instance.settings.onDragBlocked?.(segment.occurrence, { gesture, reason });\n };\n const cleanup = () => {\n if (finished) return;\n finished = true;\n window.removeEventListener(\"pointermove\", onMove);\n window.removeEventListener(\"pointerup\", onRelease);\n window.removeEventListener(\"pointercancel\", onRelease);\n window.removeEventListener(\"blur\", cleanup);\n if (activated) {\n document.body.style.cursor = \"\";\n document.body.classList.remove(\"ec-drag-blocked\");\n // the pointer travelled: suppress the trailing click so the event's own\n // dialog does not open on top of the rejection message\n lastGestureEndedAt = performance.now();\n }\n };\n // only the pointer that started the press may end it: a second finger\n // lifting must not clear the not-allowed cursor out from under it\n const onRelease = (e: PointerEvent) => {\n if (e.pointerId !== pointerId) return;\n cleanup();\n };\n window.addEventListener(\"pointermove\", onMove);\n window.addEventListener(\"pointerup\", onRelease);\n window.addEventListener(\"pointercancel\", onRelease);\n}\n\nfunction beginGesture<TData>(config: BeginGestureConfig<TData>) {\n const { instance, kind, origin, startEvent, segment, ui } = config;\n const { settings, internals, api } = instance;\n const timeZone = settings.timeZone;\n const snap = settings.snapDuration;\n // per-calendar tuning shallow-merged over the module defaults\n const activation = { ...EVENT_CALENDAR_ACTIVATION, ...settings.activation };\n const startX = startEvent.clientX;\n const startY = startEvent.clientY;\n const pointerId = startEvent.pointerId;\n // Resolved once: the chip can be re-rendered away mid-gesture. A gesture\n // from a portaled surface (the \"+N more\" popover) has no calendar ancestor,\n // so fall back to the registered root - same reason as collectSurface.\n const announcer =\n origin\n .closest<HTMLElement>(\"[data-slot=event-calendar]\")\n ?.querySelector<HTMLElement>(\"[data-slot=event-calendar-announcer]\") ??\n internals.getRootEl()?.querySelector<HTMLElement>(\"[data-slot=event-calendar-announcer]\") ??\n null;\n\n const isTouch = startEvent.pointerType === \"touch\";\n // resize activates immediately on precise pointers; on touch it waits for\n // the same long-press as a move, so a finger landing on the (invisible on\n // touch) handle strip can never start a resize the user never asked for\n let active = kind.startsWith(\"resize\") && !isTouch;\n let surface: Surface | null = active ? collectSurface(origin, internals.getRootEl()) : null;\n let rafScroll: number | null = null;\n let lastProposalKey = \"\";\n let touchTimer: ReturnType<typeof setTimeout> | null = null;\n let hintEl: HTMLDivElement | null = null;\n let lastValid = true;\n // Drag-create anchor minute, frozen at the first proposal: re-deriving it\n // from the stale startY client coordinate + the CURRENT scroll delta would\n // make the anchor drift with auto-scroll instead of staying pinned.\n let createAnchorMin: number | null = null;\n let lastPointer: PointerEvent = startEvent;\n\n const occurrence = segment?.occurrence;\n const isBar = occurrence\n ? occurrence.allDay ||\n occurrence.end.getTime() - occurrence.start.getTime() > 24 * 60 * 60 * 1000\n : false;\n\n // Preserve the grab offset so the event does not jump to the pointer\n let grabOffsetMin = 0;\n /**\n * The grabbed CHIP, not the whole occurrence. A cross-midnight event renders\n * one chip per day, so the offset above is measured in the grabbed chip's own\n * day frame (mixing the two frames jumps a tail chip a full day on grab) and\n * these two carry that chip back to the occurrence. For a chip that fits in\n * one day the lead is 0 and the duration is the occurrence's, i.e. unchanged.\n */\n let grabLeadMs = 0;\n let grabSegDurationMs = occurrence ? occurrence.end.getTime() - occurrence.start.getTime() : 0;\n /**\n * Which day of a multi-day bar was grabbed. Without it the day-granular move\n * slides the bar's START under the pointer, so a Mon-Fri bar grabbed on\n * Wednesday teleports two days forward on the first nudge.\n */\n let grabDayOffset = 0;\n\n const activationDistance =\n kind === \"create\" ? activation.createDistancePx : activation.moveDistancePx;\n\n // Each gesture keeps its own cursor: a resize must stay ns/ew-resize for\n // the whole drag (flipping to grabbing reads as a move) - vertical for\n // timed blocks, horizontal for day-granular bars. Moves grab.\n const gestureCursor = kind.startsWith(\"resize\")\n ? isBar\n ? \"ew-resize\"\n : \"ns-resize\"\n : \"grabbing\";\n const setBodyDragging = (on: boolean, invalid = false) => {\n document.body.classList.toggle(\"ec-dragging\", on);\n document.body.style.cursor = on ? (invalid ? \"not-allowed\" : gestureCursor) : \"\";\n document.body.style.userSelect = on ? \"none\" : \"\";\n if (!on) document.body.style.removeProperty(\"-webkit-user-select\");\n };\n\n const activate = () => {\n if (active) return;\n active = true;\n // armed with the gesture, not with the press: a press that never activates\n // holds no drag state, no overlay and no body class to strand\n window.addEventListener(\"blur\", onWindowBlur);\n surface = collectSurface(origin, internals.getRootEl());\n if (kind === \"move\" && occurrence) {\n const grabCell = findCell(surface, startX, startY);\n if (grabCell) {\n const originDay = zonedStartOfDay(occurrence.start, timeZone);\n // end is exclusive, so step back an instant for the last covered day\n const lastDay = zonedStartOfDay(\n new Date(Math.max(occurrence.end.getTime() - 1, occurrence.start.getTime())),\n timeZone,\n );\n const offset = differenceInCalendarDays(zonedStartOfDay(grabCell.day, timeZone), originDay);\n // A gesture from the \"+N more\" popover grabs over whatever cell that\n // floating surface happens to cover, so only a day the event actually\n // spans can be the grabbed day.\n if (offset >= 0 && offset <= differenceInCalendarDays(lastDay, originDay)) {\n grabDayOffset = offset;\n }\n }\n if (surface.columns.length > 0 && !isBar) {\n const col = findColumn(surface, startX);\n if (col) {\n const colDayStart = zonedStartOfDay(col.day, timeZone);\n const segStartMs = Math.max(occurrence.start.getTime(), colDayStart.getTime());\n grabLeadMs = segStartMs - occurrence.start.getTime();\n grabSegDurationMs =\n Math.min(occurrence.end.getTime(), addDays(colDayStart, 1).getTime()) - segStartMs;\n grabOffsetMin =\n pointerMinutes(surface, col, startY) - (segStartMs - colDayStart.getTime()) / 60000;\n }\n }\n }\n setBodyDragging(true);\n createCarry();\n };\n\n const computeProposal = (\n e: PointerEvent,\n ): {\n start: Date;\n end: Date;\n allDay: boolean;\n dayGranular?: boolean;\n resourceId?: string;\n } | null => {\n if (!surface) return null;\n\n // ---- create: select a slot range\n if (kind === \"create\") {\n if (config.createAllDay || surface.columns.length === 0) {\n const anchor = zonedStartOfDay(config.createDay!, timeZone);\n const cell = findCell(surface, e.clientX, e.clientY);\n const target = cell ? zonedStartOfDay(cell.day, timeZone) : anchor;\n const start = anchor <= target ? anchor : target;\n const end = addDays(anchor <= target ? target : anchor, 1);\n return { start, end, allDay: true, dayGranular: true };\n }\n const col = findColumn(surface, startX);\n if (!col) return null;\n if (createAnchorMin === null) {\n createAnchorMin = snapMinutes(pointerMinutes(surface, col, startY), snap);\n }\n const anchorMin = createAnchorMin;\n const curMin = snapMinutes(pointerMinutes(surface, col, e.clientY), snap);\n const lo = Math.max(col.boundsStartMin, Math.min(anchorMin, curMin));\n const hi = Math.min(col.boundsEndMin, Math.max(anchorMin, curMin, lo + snap));\n const dayStart = zonedStartOfDay(col.day, timeZone);\n return {\n start: addMinutes(dayStart, lo),\n end: addMinutes(dayStart, hi),\n allDay: false,\n resourceId: col.resourceId,\n };\n }\n\n if (!occurrence) return null;\n const durationMs = occurrence.end.getTime() - occurrence.start.getTime();\n\n // ---- day-granularity: month cells and bars in the all-day row\n const overCell = findCell(surface, e.clientX, e.clientY);\n\n // A timed event dropped on the all-day lane (a day cell inside a surface\n // that also has time columns) converts to a full-day event on that day.\n if (kind === \"move\" && !isBar && surface.columns.length > 0 && overCell !== undefined) {\n const targetDay = zonedStartOfDay(overCell.day, timeZone);\n return {\n start: targetDay,\n end: addDays(targetDay, 1),\n allDay: true,\n dayGranular: true,\n };\n }\n\n const useCells = surface.columns.length === 0 || (isBar && overCell !== undefined);\n\n if (useCells) {\n const cell = overCell ?? findCell(surface, startX, startY);\n if (!cell) return null;\n const targetDay = zonedStartOfDay(cell.day, timeZone);\n if (kind === \"move\") {\n const originDay = zonedStartOfDay(occurrence.start, timeZone);\n // minus the grabbed day: the bar follows the pointer by the distance\n // travelled, it does not re-anchor its start under the pointer\n const delta = differenceInCalendarDays(targetDay, originDay) - grabDayOffset;\n const start = addDays(toZoned(occurrence.start, timeZone), delta);\n return {\n start,\n end: new Date(start.getTime() + durationMs),\n allDay: occurrence.allDay,\n dayGranular: true,\n };\n }\n // bar edge resize: day granularity\n if (kind === \"resize-start\") {\n const time =\n occurrence.start.getTime() - zonedStartOfDay(occurrence.start, timeZone).getTime();\n const start = new Date(targetDay.getTime() + time);\n if (start >= occurrence.end) return null;\n return {\n start,\n end: occurrence.end,\n allDay: occurrence.allDay,\n dayGranular: true,\n };\n }\n const time = occurrence.allDay\n ? 0\n : occurrence.end.getTime() - zonedStartOfDay(occurrence.end, timeZone).getTime();\n const end = occurrence.allDay\n ? addDays(targetDay, 1)\n : new Date(addDays(targetDay, time > 0 ? 0 : 1).getTime() + time);\n if (end <= occurrence.start) return null;\n return {\n start: occurrence.start,\n end,\n allDay: occurrence.allDay,\n dayGranular: true,\n };\n }\n\n // ---- minute-granularity: time-grid columns\n const col = findColumn(surface, e.clientX);\n if (!col) return null;\n const dayStart = zonedStartOfDay(col.day, timeZone);\n const rawMin = pointerMinutes(surface, col, e.clientY);\n\n if (kind === \"move\") {\n const newStartMin = snapMinutes(rawMin - grabOffsetMin, snap);\n // the clamp keeps the grabbed CHIP inside the column it is over; the\n // lead then carries the rest of a cross-midnight occurrence with it\n const chipDurationMin = Math.round(grabSegDurationMs / 60000);\n const clamped = Math.min(\n Math.max(newStartMin, col.boundsStartMin),\n col.boundsEndMin - chipDurationMin,\n );\n const start = new Date(addMinutes(dayStart, clamped).getTime() - grabLeadMs);\n return {\n start,\n end: new Date(start.getTime() + durationMs),\n allDay: false,\n resourceId: col.resourceId,\n };\n }\n\n const min = snapMinutes(rawMin, snap);\n // Both endpoints expressed in the POINTED column's day coordinates.\n // Anchoring each endpoint to its OWN day breaks cross-midnight events:\n // a 23:30 pointer in the start day's column would apply 1410 minutes to\n // the end's next-day anchor and jump the end a full day late (and a\n // midnight-ending event computes occEndMin 0 against its own day).\n const occStartMinInCol = Math.round((occurrence.start.getTime() - dayStart.getTime()) / 60000);\n const occEndMinInCol = Math.round((occurrence.end.getTime() - dayStart.getTime()) / 60000);\n if (kind === \"resize-start\") {\n const clamped = Math.min(\n Math.max(min, col.boundsStartMin),\n Math.min(occEndMinInCol - snap, col.boundsEndMin),\n );\n const start = addMinutes(dayStart, clamped);\n if (start >= occurrence.end) return null;\n return { start, end: occurrence.end, allDay: false };\n }\n const clamped = Math.max(\n Math.min(min, col.boundsEndMin),\n Math.max(occStartMinInCol + snap, col.boundsStartMin),\n );\n const end = addMinutes(dayStart, clamped);\n if (end <= occurrence.start) return null;\n return { start: occurrence.start, end, allDay: false };\n };\n\n const applyProposal = (e: PointerEvent) => {\n const proposal = computeProposal(e);\n if (!proposal) return;\n const key = `${proposal.start.getTime()}-${proposal.end.getTime()}-${proposal.allDay}-${proposal.resourceId ?? \"\"}`;\n if (key === lastProposalKey) return;\n lastProposalKey = key;\n\n if (kind === \"create\") {\n const draft = { ...proposal, view: instance.getState().view };\n if (settings.canSelectSlot && !settings.canSelectSlot(draft)) return;\n internals.setSlotDraft(draft);\n return;\n }\n const update: EventCalendarProposedUpdate<TData> = {\n event: occurrence!.event,\n occurrence: occurrence!,\n ...proposal,\n source: kind as \"drag\" | \"resize-start\" | \"resize-end\",\n };\n if (kind === \"move\") update.source = \"drag\";\n const valid = settings.canDropEvent ? settings.canDropEvent(update) : true;\n lastValid = valid;\n setBodyDragging(true, !valid);\n internals.setDrag({\n kind: kind === \"move\" ? \"move\" : (kind as \"resize-start\" | \"resize-end\"),\n occurrence: occurrence!,\n proposedStart: proposal.start,\n proposedEnd: proposal.end,\n proposedAllDay: proposal.allDay,\n proposedDayGranular: proposal.dayGranular ?? false,\n proposedResourceId: proposal.resourceId,\n valid,\n });\n };\n\n // Cursor-attached carry clone for MOVE gestures: the event travels freely\n // with the pointer, like an absolutely positioned overlay, while the\n // in-grid ghost renders only a faint dashed placeholder at the snapped\n // drop slot (EVENT_CALENDAR_GHOST.move). Vanilla DOM: cloned once at\n // activation, transformed per pointermove, zero React work per frame.\n let carryEl: HTMLDivElement | null = null;\n let carryDX = 0;\n let carryDY = 0;\n const CARRY_CLASS =\n \"bg-background pointer-events-none fixed top-0 left-0 z-100 overflow-hidden rounded-sm opacity-90 shadow-md will-change-transform\" +\n (ui?.dragCarry ? ` ${ui.dragCarry}` : \"\");\n const CARRY_INVALID_CLASS =\n `${CARRY_CLASS} ring-destructive/60 ring-1` +\n (ui?.dragCarryInvalid ? ` ${ui.dragCarryInvalid}` : \"\");\n\n const createCarry = () => {\n if (kind !== \"move\") return;\n const chip = origin.closest<HTMLElement>(\"[data-slot=event-calendar-event]\") ?? origin;\n const rect = chip.getBoundingClientRect();\n // The clone is re-parented to <body>, escaping the calendar's inherited\n // font-size, so copy the source chip's resolved type - this keeps the carry\n // matching the grid at any consumer text scale (e.g. root text-sm).\n const chipFont = getComputedStyle(chip);\n carryDX = startX - rect.left;\n carryDY = startY - rect.top;\n carryEl = document.createElement(\"div\");\n carryEl.setAttribute(\"data-slot\", \"event-calendar-drag-carry\");\n carryEl.setAttribute(\"aria-hidden\", \"true\");\n carryEl.className = CARRY_CLASS;\n carryEl.style.width = `${rect.width}px`;\n carryEl.style.height = `${rect.height}px`;\n carryEl.style.fontSize = chipFont.fontSize;\n carryEl.style.lineHeight = chipFont.lineHeight;\n carryEl.style.transform = `translate3d(${snapToPixel(rect.left)}px, ${snapToPixel(rect.top)}px, 0)`;\n const clone = chip.cloneNode(true) as HTMLElement;\n clone.removeAttribute(\"data-dragging\");\n clone.style.width = \"100%\";\n clone.style.height = \"100%\";\n carryEl.appendChild(clone);\n document.body.appendChild(carryEl);\n };\n\n const positionCarry = (e: PointerEvent) => {\n if (!carryEl) return;\n carryEl.style.transform = `translate3d(${snapToPixel(e.clientX - carryDX)}px, ${snapToPixel(e.clientY - carryDY)}px, 0)`;\n const cls = lastValid ? CARRY_CLASS : CARRY_INVALID_CLASS;\n if (carryEl.className !== cls) carryEl.className = cls;\n };\n\n // Cursor-following validation hint, visible ONLY while the proposal is\n // rejected (canDropEvent / bounds). Vanilla DOM: zero React work per frame;\n // pairs with the not-allowed cursor and the ghost's destructive marking.\n const updateHint = (e: PointerEvent) => {\n if (lastValid || !active) {\n hintEl?.remove();\n hintEl = null;\n return;\n }\n if (!hintEl) {\n hintEl = document.createElement(\"div\");\n hintEl.setAttribute(\"data-slot\", \"event-calendar-drop-hint\");\n // physical left-0 anchor: translate3d positions in physical clientX\n // coordinates, so a logical start-0 anchor would fling it off-screen\n // in RTL documents\n hintEl.className =\n \"bg-background text-destructive border-destructive/40 pointer-events-none fixed top-0 left-0 z-100 rounded-md border px-2 py-0.5 text-xs font-medium shadow-sm\" +\n (ui?.dropHint ? ` ${ui.dropHint}` : \"\");\n hintEl.textContent = settings.i18n.labels.dropNotAllowed;\n document.body.appendChild(hintEl);\n }\n hintEl.style.transform = `translate3d(${snapToPixel(e.clientX + 12)}px, ${snapToPixel(e.clientY + 16)}px, 0)`;\n };\n\n const autoScroll = (e: PointerEvent) => {\n // Cached rect (see Surface.viewportRect) - never getBoundingClientRect per\n // move; the box is stable while the pointer is captured.\n const rect = surface?.viewportRect;\n if (!surface?.viewport || !rect) return;\n const edge = activation.autoScrollEdgePx;\n const step = activation.autoScrollMaxStepPx;\n let delta = 0;\n if (e.clientY < rect.top + edge) {\n delta = -step * ((rect.top + edge - e.clientY) / edge);\n } else if (e.clientY > rect.bottom - edge) {\n delta = step * ((e.clientY - (rect.bottom - edge)) / edge);\n }\n if (rafScroll) cancelAnimationFrame(rafScroll);\n if (delta !== 0) {\n const tick = () => {\n // Write-then-readback: the browser clamps scrollTop at the scroll\n // extent, so mirror only the APPLIED delta - otherwise parking the\n // pointer in the edge zone at the limit keeps inflating the tracked\n // value past reality and poisons every later minute mapping. When\n // parked (nothing applied), stop the loop; the next pointermove\n // restarts it.\n const before = surface!.viewport!.scrollTop;\n surface!.viewport!.scrollTop = before + delta;\n const applied = surface!.viewport!.scrollTop - before;\n if (applied === 0) return;\n // keep the tracked scrollTop in step so pointerMinutes stays a pure\n // number read (no DOM scrollTop, no forced reflow)\n surface!.scrollTop += applied;\n applyProposal(e);\n rafScroll = requestAnimationFrame(tick);\n };\n rafScroll = requestAnimationFrame(tick);\n }\n };\n\n // idempotent: pointerup, pointercancel, Escape, blur and the calendar-level\n // teardown can race; whichever lands first wins and the rest no-op\n let finished = false;\n const cleanup = () => {\n if (finished) return;\n finished = true;\n activeGestureCancels.delete(cancel);\n window.removeEventListener(\"pointermove\", onPointerMove);\n window.removeEventListener(\"pointerup\", onPointerUp);\n window.removeEventListener(\"pointercancel\", onCancel);\n window.removeEventListener(\"blur\", onWindowBlur);\n window.removeEventListener(\"keydown\", onKeyDown, true);\n if (rafScroll) cancelAnimationFrame(rafScroll);\n if (touchTimer) clearTimeout(touchTimer);\n hintEl?.remove();\n hintEl = null;\n carryEl?.remove();\n carryEl = null;\n setBodyDragging(false);\n };\n\n const cancel = () => {\n cleanup();\n if (active) {\n lastGestureEndedAt = performance.now();\n internals.setDrag(null);\n internals.setSlotDraft(null);\n }\n };\n\n const onKeyDown = (e: KeyboardEvent) => {\n if (e.key === \"Escape\") {\n e.stopPropagation();\n cancel();\n }\n };\n\n // focus loss mid-gesture (alt-tab, OS dialogs) means the release may never\n // be delivered; treat it as a cancel so the gesture cannot get stuck and\n // commit its stale proposal on the next click\n const onWindowBlur = () => cancel();\n\n const onPointerMove = (e: PointerEvent) => {\n // a second finger must not drive - or cancel the pending long press of -\n // the gesture this pointer started\n if (e.pointerId !== pointerId) return;\n lastPointer = e;\n if (!active) {\n const distance = Math.hypot(e.clientX - startX, e.clientY - startY);\n if (isTouch) {\n // Long-press pending: moving past tolerance means scroll, not drag\n if (distance > activation.touchTolerancePx) cancel();\n return;\n }\n if (distance < activationDistance) return;\n activate();\n }\n applyProposal(e);\n autoScroll(e);\n updateHint(e);\n positionCarry(e);\n };\n\n const onPointerUp = (e: PointerEvent) => {\n if (e.pointerId !== pointerId) return;\n cleanup();\n if (!active) return;\n lastGestureEndedAt = performance.now();\n\n const state = instance.getState();\n if (kind === \"create\") {\n const draft = state.slotDraft;\n internals.setSlotDraft(null);\n if (draft) {\n api.select({\n slot: { start: draft.start, end: draft.end, allDay: draft.allDay },\n });\n settings.onSelectSlot?.(draft);\n }\n return;\n }\n const drag = state.drag;\n internals.setDrag(null);\n if (!drag || !occurrence) return;\n const unchanged =\n drag.proposedStart.getTime() === occurrence.start.getTime() &&\n drag.proposedEnd.getTime() === occurrence.end.getTime() &&\n (drag.proposedResourceId === undefined ||\n drag.proposedResourceId === occurrence.event.resourceId);\n if (unchanged) return;\n // Commit through the one validation funnel; consumer reject = automatic\n // revert because the calendar never mutated during the gesture.\n const accepted = internals.applyProposedUpdate({\n event: occurrence.event,\n occurrence,\n start: drag.proposedStart,\n end: drag.proposedEnd,\n allDay: drag.proposedAllDay,\n resourceId: drag.proposedResourceId,\n source: kind === \"move\" ? \"drag\" : (kind as \"resize-start\" | \"resize-end\"),\n });\n // the polite live region is the only feedback a screen-reader user gets\n // that the drop landed, and on what; a vetoed commit stays silent\n if (accepted && announcer) {\n announcer.textContent = `${occurrence.event.title}, ${settings.i18n.functions.formatEventTime(\n toZoned(drag.proposedStart, timeZone),\n toZoned(drag.proposedEnd, timeZone),\n drag.proposedAllDay,\n { locale: settings.locale },\n )}`;\n }\n };\n\n const onCancel = (e: PointerEvent) => {\n if (e.pointerId !== pointerId) return;\n cancel();\n };\n\n window.addEventListener(\"pointermove\", onPointerMove);\n window.addEventListener(\"pointerup\", onPointerUp);\n window.addEventListener(\"pointercancel\", onCancel);\n // a resize on a precise pointer is live from the first frame, so it never\n // reaches activate() to arm its own blur cancel\n if (active) window.addEventListener(\"blur\", onWindowBlur);\n window.addEventListener(\"keydown\", onKeyDown, true);\n activeGestureCancels.add(cancel);\n\n // Touch: long-press activation (movement past tolerance cancels above)\n if (isTouch && !active) {\n touchTimer = setTimeout(() => {\n activate();\n applyProposal(lastPointer);\n }, activation.touchDelayMs);\n }\n}\n\n/** Per-chip / per-surface pointer gesture wiring. */\nfunction useEventCalendarGestures<TData = unknown>() {\n const instance = useEventCalendar<TData>();\n // Overlay classNames bridged from React config into the vanilla-DOM engine\n // (which must never import from the chip module - circular).\n const { classNames } = useEventCalendarViewConfig<TData>();\n const ui = useMemo(\n () => ({\n dragCarry: classNames?.dragCarry,\n dragCarryInvalid: classNames?.dragCarryInvalid,\n dropHint: classNames?.dropHint,\n }),\n [classNames],\n );\n\n // An in-flight gesture lives on window listeners and body-appended overlays,\n // so it must never outlive the calendar. Chips hold this hook too and they\n // legitimately unmount mid-gesture, so only the LAST consumer leaving - the\n // calendar itself going away - aborts.\n useEffect(() => {\n gestureConsumers += 1;\n return () => {\n gestureConsumers -= 1;\n if (gestureConsumers === 0) cancelActiveEventCalendarGestures();\n };\n }, []);\n\n const canDrag = useCallback(\n (segment: EventCalendarSegment<TData>) => {\n const { interactions } = instance.getState();\n const event = segment.occurrence.event;\n return interactions.drag && !event.readOnly && event.draggable !== false;\n },\n [instance],\n );\n\n const canResize = useCallback(\n (segment: EventCalendarSegment<TData>) => {\n const { interactions } = instance.getState();\n const event = segment.occurrence.event;\n return interactions.resize && !event.readOnly && event.resizable !== false;\n },\n [instance],\n );\n\n const beginMove = useCallback(\n (e: React.PointerEvent, segment: EventCalendarSegment<TData>) => {\n if (e.button !== 0) return;\n if (!canDrag(segment)) {\n // refused, but still give feedback + broadcast on a real drag attempt\n beginBlockedGesture(instance, e.nativeEvent, segment, \"move\");\n return;\n }\n beginGesture({\n instance,\n kind: \"move\",\n origin: e.currentTarget as HTMLElement,\n startEvent: e.nativeEvent,\n segment,\n ui,\n });\n },\n [instance, canDrag, ui],\n );\n\n const beginResize = useCallback(\n (e: React.PointerEvent, segment: EventCalendarSegment<TData>, edge: \"start\" | \"end\") => {\n if (e.button !== 0) return;\n if (!canResize(segment)) {\n e.stopPropagation();\n beginBlockedGesture(instance, e.nativeEvent, segment, \"resize\");\n return;\n }\n e.stopPropagation();\n e.preventDefault();\n beginGesture({\n instance,\n kind: edge === \"start\" ? \"resize-start\" : \"resize-end\",\n origin: e.currentTarget as HTMLElement,\n startEvent: e.nativeEvent,\n segment,\n ui,\n });\n },\n [instance, canResize, ui],\n );\n\n const beginCreate = useCallback(\n (e: React.PointerEvent, day: Date, allDay: boolean) => {\n if (e.button !== 0) return;\n if (!instance.getState().interactions.selectSlot) return;\n beginGesture({\n instance,\n kind: \"create\",\n origin: e.currentTarget as HTMLElement,\n startEvent: e.nativeEvent,\n createDay: day,\n createAllDay: allDay,\n ui,\n });\n },\n [instance, ui],\n );\n\n return { beginMove, beginResize, beginCreate, canDrag, canResize };\n}\n\nexport {\n cancelActiveEventCalendarGestures,\n EVENT_CALENDAR_ACTIVATION,\n markChipPress,\n useEventCalendarGestures,\n wasRecentChipPress,\n wasRecentDrag,\n};\n"],"mappings":";;;;;;;;;;;;AAmBA,MAAM,4BAA4B;CAChC,gBAAgB;CAChB,kBAAkB;CAClB,cAAc;CACd,kBAAkB;CAClB,kBAAkB;CAClB,qBAAqB;AACvB;;AA0CA,IAAI,qBAAqB;AACzB,SAAS,gBAAyB;CAChC,OAAO,YAAY,IAAI,IAAI,qBAAqB;AAClD;;;;;;;;AASA,IAAI,kBAAkB;AACtB,SAAS,gBAAsB;CAC7B,kBAAkB,YAAY,IAAI;CAClC,OAAO,iBACL,mBACM;EACJ,kBAAkB,YAAY,IAAI;CACpC,GACA;EAAE,MAAM;EAAM,SAAS;CAAK,CAC9B;AACF;AACA,SAAS,qBAA8B;CACrC,OAAO,YAAY,IAAI,IAAI,kBAAkB;AAC/C;;;;;;;;;AAUA,MAA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B,IAAI,CAAC,SAAS,SAAS,CAAC,CAAC,aAAa,YAAY;GAClD,aAAa;IACX;IACA,MAAM;IACN,QAAQ,EAAE;IACV,YAAY,EAAE;IACd,WAAW;IACX,cAAc;IACd;GACF,CAAC;EACH,GACA,CAAC,UAAU,EAAE,CAG4B;EAAG;EAAS;CAAU;AACnE"}
1
+ {"version":3,"file":"event-calendar-dnd.js","names":[],"sources":["../../../../src/components/reui/event-calendar/event-calendar-dnd.tsx"],"sourcesContent":["\"use client\";\n\nimport { useCallback, useEffect, useMemo } from \"react\";\nimport { addDays, addMinutes, differenceInCalendarDays } from \"date-fns\";\n\nimport {\n type EventCalendarInstance,\n useEventCalendar,\n useEventCalendarViewConfig,\n} from \"./event-calendar\";\nimport { snapMinutes, toZoned, zonedStartOfDay } from \"./event-calendar-lib\";\nimport type { EventCalendarProposedUpdate, EventCalendarSegment } from \"./event-calendar-types\";\n\n/**\n * Activation policy (dnd-kit parity where proven):\n * mouse move 5px before a drag starts (below = click), create 4px;\n * touch long-press 250ms with 5px tolerance (movement past tolerance\n * before the delay cancels the drag so taps stay taps).\n */\nconst EVENT_CALENDAR_ACTIVATION = {\n moveDistancePx: 5,\n createDistancePx: 4,\n touchDelayMs: 250,\n touchTolerancePx: 5,\n autoScrollEdgePx: 48,\n autoScrollMaxStepPx: 15,\n} as const;\n\ntype GestureKind = \"move\" | \"resize-start\" | \"resize-end\" | \"create\";\n\ninterface TimeColumnRect {\n day: Date;\n rect: DOMRect;\n boundsStartMin: number;\n boundsEndMin: number;\n resourceId?: string;\n}\n\ninterface DayCellRect {\n day: Date;\n rect: DOMRect;\n}\n\ninterface Surface {\n /** Minute-precise day columns (week/day/days) or resource columns. */\n columns: TimeColumnRect[];\n /** Day-precise cells (month grid, all-day row). */\n cells: DayCellRect[];\n viewport: HTMLElement | null;\n /**\n * Viewport rect captured ONCE at gesture start. The scroll container does\n * not move on screen while a pointer drag is captured (auto-scroll changes\n * its scrollTop, not its box), so reusing this avoids a per-pointermove\n * getBoundingClientRect - that read forces a synchronous full-document\n * reflow, which is cheap on a bare demo page but ~200ms on a long docs page\n * (big prop tables re-lay-out on every flush), turning drag into a slideshow.\n */\n viewportRect: DOMRect | null;\n viewportStartScrollTop: number;\n /**\n * Live scrollTop, seeded from the start value and advanced by auto-scroll\n * itself. Tracking it here lets pointerMinutes read a number instead of the\n * DOM `scrollTop` property every move (another forced reflow).\n */\n scrollTop: number;\n}\n\n/** Module flag so chip onClick can ignore the click that ends a drag. */\nlet lastGestureEndedAt = 0;\nfunction wasRecentDrag(): boolean {\n return performance.now() - lastGestureEndedAt < 250;\n}\n\n/**\n * A press that started on an event chip. Slot-create clicks consult this so a\n * refused drag (e.g. a locked chip that never registers a gesture) whose\n * trailing native click retargets to the empty grid does NOT open a create\n * dialog. Refreshed on release so it covers long presses; the chip's own\n * click-to-edit is unaffected (only grid slot-clicks check it).\n */\nlet lastChipPressAt = 0;\nfunction markChipPress(): void {\n lastChipPressAt = performance.now();\n window.addEventListener(\n \"pointerup\",\n () => {\n lastChipPressAt = performance.now();\n },\n { once: true, capture: true },\n );\n}\nfunction wasRecentChipPress(): boolean {\n return performance.now() - lastChipPressAt < 300;\n}\n\n/**\n * Registry of in-flight gesture cancels. A gesture measures its surface (day\n * columns and cells) once at activation and then lives on window listeners, so\n * the CALENDAR - not the chip, chips legitimately unmount mid-gesture (lane\n * repacking, a \"+N more\" popover closing) - is what must be able to abort it.\n * Cancel fully reverts: listeners, overlays and the body drag state all clear,\n * and no update is committed.\n */\nconst activeGestureCancels = new Set<() => void>();\n\n/** Cancel (and fully revert) every in-flight event calendar pointer gesture. */\nfunction cancelActiveEventCalendarGestures(): void {\n for (const cancel of [...activeGestureCancels]) cancel();\n}\n\n/**\n * Mounted-consumer count for the gestures hook. Every chip holds one, so only\n * the LAST consumer leaving means the calendar itself is gone; aborting when\n * any single chip unmounts would kill a drag the user is still holding.\n */\nlet gestureConsumers = 0;\n\n/**\n * Snap a translate offset to the device pixel grid. The cursor-following\n * overlays (carry clone, drop hint) are their own `will-change: transform`\n * compositing layers: the GPU rasterizes their text once and repositions that\n * texture each frame, so a subpixel translate (getBoundingClientRect and raw\n * clientX/Y are routinely fractional) resamples the texture and blurs the\n * text. Rounding each offset to a whole device pixel lands the layer on the\n * grid so glyphs stay crisp, without giving up the per-frame GPU transform.\n */\nfunction snapToPixel(value: number): number {\n const dpr = typeof window !== \"undefined\" ? window.devicePixelRatio || 1 : 1;\n return Math.round(value * dpr) / dpr;\n}\n\nfunction collectSurface(origin: HTMLElement, fallbackRoot?: HTMLElement | null): Surface {\n // A gesture from a portaled surface (the \"+N more\" popover) has no calendar\n // ancestor, so fall back to the root the host registered on the instance.\n const root =\n origin.closest<HTMLElement>(\"[data-slot=event-calendar-time-grid]\") ??\n origin.closest<HTMLElement>(\"[data-slot=event-calendar-resource-view]\") ??\n origin.closest<HTMLElement>(\"[data-slot=event-calendar-month-view]\") ??\n origin.closest<HTMLElement>(\"[data-slot=event-calendar]\") ??\n fallbackRoot ??\n null;\n\n const columns: TimeColumnRect[] = [];\n const cells: DayCellRect[] = [];\n if (root) {\n for (const el of root.querySelectorAll<HTMLElement>(\"[data-ec-day]\")) {\n const day = new Date(Number(el.dataset.ecDay));\n if (el.dataset.ecBoundsStart !== undefined) {\n columns.push({\n day,\n rect: el.getBoundingClientRect(),\n boundsStartMin: Number(el.dataset.ecBoundsStart),\n boundsEndMin: Number(el.dataset.ecBoundsEnd),\n resourceId: el.dataset.ecResource,\n });\n } else {\n cells.push({ day, rect: el.getBoundingClientRect() });\n }\n }\n }\n const viewport = root?.querySelector<HTMLElement>(\"[data-slot=scroll-area-viewport]\") ?? null;\n const viewportStartScrollTop = viewport?.scrollTop ?? 0;\n return {\n columns,\n cells,\n viewport,\n viewportRect: viewport?.getBoundingClientRect() ?? null,\n viewportStartScrollTop,\n scrollTop: viewportStartScrollTop,\n };\n}\n\nfunction findColumn(surface: Surface, clientX: number): TimeColumnRect | undefined {\n const scrollAdjusted = surface.columns;\n let best: TimeColumnRect | undefined;\n for (const col of scrollAdjusted) {\n if (clientX >= col.rect.left && clientX < col.rect.right) return col;\n if (!best) best = col;\n // clamp to nearest horizontal column\n const bestDist = Math.min(\n Math.abs(clientX - best.rect.left),\n Math.abs(clientX - best.rect.right),\n );\n const dist = Math.min(Math.abs(clientX - col.rect.left), Math.abs(clientX - col.rect.right));\n if (dist < bestDist) best = col;\n }\n return best;\n}\n\nfunction findCell(surface: Surface, x: number, y: number): DayCellRect | undefined {\n return surface.cells.find(\n (cell) =>\n x >= cell.rect.left && x < cell.rect.right && y >= cell.rect.top && y < cell.rect.bottom,\n );\n}\n\nfunction pointerMinutes(surface: Surface, col: TimeColumnRect, clientY: number): number {\n const scrollDelta = surface.scrollTop - surface.viewportStartScrollTop;\n const boundsMinutes = col.boundsEndMin - col.boundsStartMin;\n const pxPerMinute = col.rect.height / Math.max(1, boundsMinutes);\n const y = clientY - col.rect.top + scrollDelta;\n return col.boundsStartMin + y / pxPerMinute;\n}\n\ninterface BeginGestureConfig<TData> {\n instance: EventCalendarInstance<TData>;\n kind: GestureKind;\n origin: HTMLElement;\n startEvent: PointerEvent;\n segment?: EventCalendarSegment<TData>;\n /** create only */\n createDay?: Date;\n createAllDay?: boolean;\n /**\n * Consumer classNames for the engine's vanilla-DOM overlays (carry clone,\n * validation hint pill), forwarded by the gestures hook - the engine itself\n * must never import from the React chip module.\n */\n ui?: {\n dragCarry?: string;\n dragCarryInvalid?: string;\n dropHint?: string;\n };\n}\n\n/**\n * A move/resize was refused (locked, per-event disabled, or interaction off).\n * Rather than silently swallow the press, track the pointer: once it crosses\n * the activation threshold - i.e. the user genuinely tried to drag - show a\n * not-allowed cursor and broadcast once via onDragBlocked so the consumer can\n * explain it. The calendar picks no message. Fires at most once per gesture.\n */\nfunction beginBlockedGesture<TData>(\n instance: EventCalendarInstance<TData>,\n startEvent: PointerEvent,\n segment: EventCalendarSegment<TData>,\n gesture: \"move\" | \"resize\",\n) {\n const startX = startEvent.clientX;\n const startY = startEvent.clientY;\n const activation = {\n ...EVENT_CALENDAR_ACTIVATION,\n ...instance.settings.activation,\n };\n const event = segment.occurrence.event;\n const reason: \"readOnly\" | \"disabled\" | \"interactions-off\" = event.readOnly\n ? \"readOnly\"\n : (gesture === \"move\" ? event.draggable : event.resizable) === false\n ? \"disabled\"\n : \"interactions-off\";\n const pointerId = startEvent.pointerId;\n let activated = false;\n let finished = false;\n const onMove = (e: PointerEvent) => {\n if (e.pointerId !== pointerId || activated) return;\n if (Math.hypot(e.clientX - startX, e.clientY - startY) < activation.moveDistancePx) {\n return;\n }\n activated = true;\n document.body.style.cursor = \"not-allowed\";\n // body class alongside the inline cursor so consumer CSS can restyle or\n // detect the blocked-drag state (mirrors \"ec-dragging\")\n document.body.classList.add(\"ec-drag-blocked\");\n // only now is there anything to get stuck: focus loss means the release\n // may never be delivered, leaving the cursor not-allowed document-wide\n window.addEventListener(\"blur\", cleanup);\n instance.settings.onDragBlocked?.(segment.occurrence, { gesture, reason });\n };\n const cleanup = () => {\n if (finished) return;\n finished = true;\n window.removeEventListener(\"pointermove\", onMove);\n window.removeEventListener(\"pointerup\", onRelease);\n window.removeEventListener(\"pointercancel\", onRelease);\n window.removeEventListener(\"blur\", cleanup);\n if (activated) {\n document.body.style.cursor = \"\";\n document.body.classList.remove(\"ec-drag-blocked\");\n // the pointer travelled: suppress the trailing click so the event's own\n // dialog does not open on top of the rejection message\n lastGestureEndedAt = performance.now();\n }\n };\n // only the pointer that started the press may end it: a second finger\n // lifting must not clear the not-allowed cursor out from under it\n const onRelease = (e: PointerEvent) => {\n if (e.pointerId !== pointerId) return;\n cleanup();\n };\n window.addEventListener(\"pointermove\", onMove);\n window.addEventListener(\"pointerup\", onRelease);\n window.addEventListener(\"pointercancel\", onRelease);\n}\n\nfunction beginGesture<TData>(config: BeginGestureConfig<TData>) {\n const { instance, kind, origin, startEvent, segment, ui } = config;\n const { settings, internals, api } = instance;\n const timeZone = settings.timeZone;\n const snap = settings.snapDuration;\n // per-calendar tuning shallow-merged over the module defaults\n const activation = { ...EVENT_CALENDAR_ACTIVATION, ...settings.activation };\n const startX = startEvent.clientX;\n const startY = startEvent.clientY;\n const pointerId = startEvent.pointerId;\n // Resolved once: the chip can be re-rendered away mid-gesture. A gesture\n // from a portaled surface (the \"+N more\" popover) has no calendar ancestor,\n // so fall back to the registered root - same reason as collectSurface.\n const announcer =\n origin\n .closest<HTMLElement>(\"[data-slot=event-calendar]\")\n ?.querySelector<HTMLElement>(\"[data-slot=event-calendar-announcer]\") ??\n internals.getRootEl()?.querySelector<HTMLElement>(\"[data-slot=event-calendar-announcer]\") ??\n null;\n\n const isTouch = startEvent.pointerType === \"touch\";\n // resize activates immediately on precise pointers; on touch it waits for\n // the same long-press as a move, so a finger landing on the (invisible on\n // touch) handle strip can never start a resize the user never asked for\n let active = kind.startsWith(\"resize\") && !isTouch;\n let surface: Surface | null = active ? collectSurface(origin, internals.getRootEl()) : null;\n let rafScroll: number | null = null;\n let lastProposalKey = \"\";\n let touchTimer: ReturnType<typeof setTimeout> | null = null;\n let hintEl: HTMLDivElement | null = null;\n let lastValid = true;\n // Drag-create anchor minute, frozen at the first proposal: re-deriving it\n // from the stale startY client coordinate + the CURRENT scroll delta would\n // make the anchor drift with auto-scroll instead of staying pinned.\n let createAnchorMin: number | null = null;\n let lastPointer: PointerEvent = startEvent;\n\n const occurrence = segment?.occurrence;\n const isBar = occurrence\n ? occurrence.allDay ||\n occurrence.end.getTime() - occurrence.start.getTime() > 24 * 60 * 60 * 1000\n : false;\n\n // Preserve the grab offset so the event does not jump to the pointer\n let grabOffsetMin = 0;\n /**\n * The grabbed CHIP, not the whole occurrence. A cross-midnight event renders\n * one chip per day, so the offset above is measured in the grabbed chip's own\n * day frame (mixing the two frames jumps a tail chip a full day on grab) and\n * these two carry that chip back to the occurrence. For a chip that fits in\n * one day the lead is 0 and the duration is the occurrence's, i.e. unchanged.\n */\n let grabLeadMs = 0;\n let grabSegDurationMs = occurrence ? occurrence.end.getTime() - occurrence.start.getTime() : 0;\n /**\n * Which day of a multi-day bar was grabbed. Without it the day-granular move\n * slides the bar's START under the pointer, so a Mon-Fri bar grabbed on\n * Wednesday teleports two days forward on the first nudge.\n */\n let grabDayOffset = 0;\n\n const activationDistance =\n kind === \"create\" ? activation.createDistancePx : activation.moveDistancePx;\n\n // Each gesture keeps its own cursor: a resize must stay ns/ew-resize for\n // the whole drag (flipping to grabbing reads as a move) - vertical for\n // timed blocks, horizontal for day-granular bars. Moves grab.\n const gestureCursor = kind.startsWith(\"resize\")\n ? isBar\n ? \"ew-resize\"\n : \"ns-resize\"\n : \"grabbing\";\n const setBodyDragging = (on: boolean, invalid = false) => {\n document.body.classList.toggle(\"ec-dragging\", on);\n document.body.style.cursor = on ? (invalid ? \"not-allowed\" : gestureCursor) : \"\";\n document.body.style.userSelect = on ? \"none\" : \"\";\n if (!on) document.body.style.removeProperty(\"-webkit-user-select\");\n };\n\n const activate = () => {\n if (active) return;\n active = true;\n // armed with the gesture, not with the press: a press that never activates\n // holds no drag state, no overlay and no body class to strand\n window.addEventListener(\"blur\", onWindowBlur);\n surface = collectSurface(origin, internals.getRootEl());\n if (kind === \"move\" && occurrence) {\n const grabCell = findCell(surface, startX, startY);\n if (grabCell) {\n const originDay = zonedStartOfDay(occurrence.start, timeZone);\n // end is exclusive, so step back an instant for the last covered day\n const lastDay = zonedStartOfDay(\n new Date(Math.max(occurrence.end.getTime() - 1, occurrence.start.getTime())),\n timeZone,\n );\n const offset = differenceInCalendarDays(zonedStartOfDay(grabCell.day, timeZone), originDay);\n // A gesture from the \"+N more\" popover grabs over whatever cell that\n // floating surface happens to cover, so only a day the event actually\n // spans can be the grabbed day.\n if (offset >= 0 && offset <= differenceInCalendarDays(lastDay, originDay)) {\n grabDayOffset = offset;\n }\n }\n if (surface.columns.length > 0 && !isBar) {\n const col = findColumn(surface, startX);\n if (col) {\n const colDayStart = zonedStartOfDay(col.day, timeZone);\n const segStartMs = Math.max(occurrence.start.getTime(), colDayStart.getTime());\n grabLeadMs = segStartMs - occurrence.start.getTime();\n grabSegDurationMs =\n Math.min(occurrence.end.getTime(), addDays(colDayStart, 1).getTime()) - segStartMs;\n grabOffsetMin =\n pointerMinutes(surface, col, startY) - (segStartMs - colDayStart.getTime()) / 60000;\n }\n }\n }\n setBodyDragging(true);\n createCarry();\n };\n\n const computeProposal = (\n e: PointerEvent,\n ): {\n start: Date;\n end: Date;\n allDay: boolean;\n dayGranular?: boolean;\n resourceId?: string;\n } | null => {\n if (!surface) return null;\n\n // ---- create: select a slot range\n if (kind === \"create\") {\n if (config.createAllDay || surface.columns.length === 0) {\n const anchor = zonedStartOfDay(config.createDay!, timeZone);\n const cell = findCell(surface, e.clientX, e.clientY);\n const target = cell ? zonedStartOfDay(cell.day, timeZone) : anchor;\n const start = anchor <= target ? anchor : target;\n const end = addDays(anchor <= target ? target : anchor, 1);\n return { start, end, allDay: true, dayGranular: true };\n }\n const col = findColumn(surface, startX);\n if (!col) return null;\n if (createAnchorMin === null) {\n createAnchorMin = snapMinutes(pointerMinutes(surface, col, startY), snap);\n }\n const anchorMin = createAnchorMin;\n const curMin = snapMinutes(pointerMinutes(surface, col, e.clientY), snap);\n const lo = Math.max(col.boundsStartMin, Math.min(anchorMin, curMin));\n const hi = Math.min(col.boundsEndMin, Math.max(anchorMin, curMin, lo + snap));\n const dayStart = zonedStartOfDay(col.day, timeZone);\n return {\n start: addMinutes(dayStart, lo),\n end: addMinutes(dayStart, hi),\n allDay: false,\n resourceId: col.resourceId,\n };\n }\n\n if (!occurrence) return null;\n const durationMs = occurrence.end.getTime() - occurrence.start.getTime();\n\n // ---- day-granularity: month cells and bars in the all-day row\n const overCell = findCell(surface, e.clientX, e.clientY);\n\n // A timed event dropped on the all-day lane (a day cell inside a surface\n // that also has time columns) converts to a full-day event on that day.\n if (kind === \"move\" && !isBar && surface.columns.length > 0 && overCell !== undefined) {\n const targetDay = zonedStartOfDay(overCell.day, timeZone);\n return {\n start: targetDay,\n end: addDays(targetDay, 1),\n allDay: true,\n dayGranular: true,\n };\n }\n\n const useCells = surface.columns.length === 0 || (isBar && overCell !== undefined);\n\n if (useCells) {\n const cell = overCell ?? findCell(surface, startX, startY);\n if (!cell) return null;\n const targetDay = zonedStartOfDay(cell.day, timeZone);\n if (kind === \"move\") {\n const originDay = zonedStartOfDay(occurrence.start, timeZone);\n // minus the grabbed day: the bar follows the pointer by the distance\n // travelled, it does not re-anchor its start under the pointer\n const delta = differenceInCalendarDays(targetDay, originDay) - grabDayOffset;\n const start = addDays(toZoned(occurrence.start, timeZone), delta);\n return {\n start,\n end: new Date(start.getTime() + durationMs),\n allDay: occurrence.allDay,\n dayGranular: true,\n };\n }\n // bar edge resize: day granularity\n if (kind === \"resize-start\") {\n const time =\n occurrence.start.getTime() - zonedStartOfDay(occurrence.start, timeZone).getTime();\n const start = new Date(targetDay.getTime() + time);\n if (start >= occurrence.end) return null;\n return {\n start,\n end: occurrence.end,\n allDay: occurrence.allDay,\n dayGranular: true,\n };\n }\n const time = occurrence.allDay\n ? 0\n : occurrence.end.getTime() - zonedStartOfDay(occurrence.end, timeZone).getTime();\n const end = occurrence.allDay\n ? addDays(targetDay, 1)\n : new Date(addDays(targetDay, time > 0 ? 0 : 1).getTime() + time);\n if (end <= occurrence.start) return null;\n return {\n start: occurrence.start,\n end,\n allDay: occurrence.allDay,\n dayGranular: true,\n };\n }\n\n // ---- minute-granularity: time-grid columns\n const col = findColumn(surface, e.clientX);\n if (!col) return null;\n const dayStart = zonedStartOfDay(col.day, timeZone);\n const rawMin = pointerMinutes(surface, col, e.clientY);\n\n if (kind === \"move\") {\n const newStartMin = snapMinutes(rawMin - grabOffsetMin, snap);\n // the clamp keeps the grabbed CHIP inside the column it is over; the\n // lead then carries the rest of a cross-midnight occurrence with it\n const chipDurationMin = Math.round(grabSegDurationMs / 60000);\n const clamped = Math.min(\n Math.max(newStartMin, col.boundsStartMin),\n col.boundsEndMin - chipDurationMin,\n );\n const start = new Date(addMinutes(dayStart, clamped).getTime() - grabLeadMs);\n return {\n start,\n end: new Date(start.getTime() + durationMs),\n allDay: false,\n resourceId: col.resourceId,\n };\n }\n\n const min = snapMinutes(rawMin, snap);\n // Both endpoints expressed in the POINTED column's day coordinates.\n // Anchoring each endpoint to its OWN day breaks cross-midnight events:\n // a 23:30 pointer in the start day's column would apply 1410 minutes to\n // the end's next-day anchor and jump the end a full day late (and a\n // midnight-ending event computes occEndMin 0 against its own day).\n const occStartMinInCol = Math.round((occurrence.start.getTime() - dayStart.getTime()) / 60000);\n const occEndMinInCol = Math.round((occurrence.end.getTime() - dayStart.getTime()) / 60000);\n if (kind === \"resize-start\") {\n const clamped = Math.min(\n Math.max(min, col.boundsStartMin),\n Math.min(occEndMinInCol - snap, col.boundsEndMin),\n );\n const start = addMinutes(dayStart, clamped);\n if (start >= occurrence.end) return null;\n return { start, end: occurrence.end, allDay: false };\n }\n const clamped = Math.max(\n Math.min(min, col.boundsEndMin),\n Math.max(occStartMinInCol + snap, col.boundsStartMin),\n );\n const end = addMinutes(dayStart, clamped);\n if (end <= occurrence.start) return null;\n return { start: occurrence.start, end, allDay: false };\n };\n\n const applyProposal = (e: PointerEvent) => {\n const proposal = computeProposal(e);\n if (!proposal) return;\n const key = `${proposal.start.getTime()}-${proposal.end.getTime()}-${proposal.allDay}-${proposal.resourceId ?? \"\"}`;\n if (key === lastProposalKey) return;\n lastProposalKey = key;\n\n if (kind === \"create\") {\n const draft = { ...proposal, view: instance.getState().view };\n if (settings.canSelectSlot && !settings.canSelectSlot(draft)) return;\n internals.setSlotDraft(draft);\n return;\n }\n const update: EventCalendarProposedUpdate<TData> = {\n event: occurrence!.event,\n occurrence: occurrence!,\n ...proposal,\n source: kind as \"drag\" | \"resize-start\" | \"resize-end\",\n };\n if (kind === \"move\") update.source = \"drag\";\n const valid = settings.canDropEvent ? settings.canDropEvent(update) : true;\n lastValid = valid;\n setBodyDragging(true, !valid);\n internals.setDrag({\n kind: kind === \"move\" ? \"move\" : (kind as \"resize-start\" | \"resize-end\"),\n occurrence: occurrence!,\n proposedStart: proposal.start,\n proposedEnd: proposal.end,\n proposedAllDay: proposal.allDay,\n proposedDayGranular: proposal.dayGranular ?? false,\n proposedResourceId: proposal.resourceId,\n valid,\n });\n };\n\n // Cursor-attached carry clone for MOVE gestures: the event travels freely\n // with the pointer, like an absolutely positioned overlay, while the\n // in-grid ghost renders only a faint dashed placeholder at the snapped\n // drop slot (EVENT_CALENDAR_GHOST.move). Vanilla DOM: cloned once at\n // activation, transformed per pointermove, zero React work per frame.\n let carryEl: HTMLDivElement | null = null;\n let carryDX = 0;\n let carryDY = 0;\n const CARRY_CLASS =\n \"bg-background pointer-events-none fixed top-0 left-0 z-100 overflow-hidden rounded-sm opacity-90 shadow-md will-change-transform\" +\n (ui?.dragCarry ? ` ${ui.dragCarry}` : \"\");\n const CARRY_INVALID_CLASS =\n `${CARRY_CLASS} ring-destructive/60 ring-1` +\n (ui?.dragCarryInvalid ? ` ${ui.dragCarryInvalid}` : \"\");\n\n const createCarry = () => {\n if (kind !== \"move\") return;\n const chip = origin.closest<HTMLElement>(\"[data-slot=event-calendar-event]\") ?? origin;\n const rect = chip.getBoundingClientRect();\n // The clone is re-parented to <body>, escaping the calendar's inherited\n // font-size, so copy the source chip's resolved type - this keeps the carry\n // matching the grid at any consumer text scale (e.g. root text-sm).\n const chipFont = getComputedStyle(chip);\n carryDX = startX - rect.left;\n carryDY = startY - rect.top;\n carryEl = document.createElement(\"div\");\n carryEl.setAttribute(\"data-slot\", \"event-calendar-drag-carry\");\n carryEl.setAttribute(\"aria-hidden\", \"true\");\n carryEl.className = CARRY_CLASS;\n carryEl.style.width = `${rect.width}px`;\n carryEl.style.height = `${rect.height}px`;\n carryEl.style.fontSize = chipFont.fontSize;\n carryEl.style.lineHeight = chipFont.lineHeight;\n carryEl.style.transform = `translate3d(${snapToPixel(rect.left)}px, ${snapToPixel(rect.top)}px, 0)`;\n const clone = chip.cloneNode(true) as HTMLElement;\n clone.removeAttribute(\"data-dragging\");\n clone.style.width = \"100%\";\n clone.style.height = \"100%\";\n carryEl.appendChild(clone);\n document.body.appendChild(carryEl);\n };\n\n const positionCarry = (e: PointerEvent) => {\n if (!carryEl) return;\n carryEl.style.transform = `translate3d(${snapToPixel(e.clientX - carryDX)}px, ${snapToPixel(e.clientY - carryDY)}px, 0)`;\n const cls = lastValid ? CARRY_CLASS : CARRY_INVALID_CLASS;\n if (carryEl.className !== cls) carryEl.className = cls;\n };\n\n // Cursor-following validation hint, visible ONLY while the proposal is\n // rejected (canDropEvent / bounds). Vanilla DOM: zero React work per frame;\n // pairs with the not-allowed cursor and the ghost's destructive marking.\n const updateHint = (e: PointerEvent) => {\n if (lastValid || !active) {\n hintEl?.remove();\n hintEl = null;\n return;\n }\n if (!hintEl) {\n hintEl = document.createElement(\"div\");\n hintEl.setAttribute(\"data-slot\", \"event-calendar-drop-hint\");\n // physical left-0 anchor: translate3d positions in physical clientX\n // coordinates, so a logical start-0 anchor would fling it off-screen\n // in RTL documents\n hintEl.className =\n \"bg-background text-destructive border-destructive/40 pointer-events-none fixed top-0 left-0 z-100 rounded-md border px-2 py-0.5 text-xs font-medium shadow-sm\" +\n (ui?.dropHint ? ` ${ui.dropHint}` : \"\");\n hintEl.textContent = settings.i18n.labels.dropNotAllowed;\n document.body.appendChild(hintEl);\n }\n hintEl.style.transform = `translate3d(${snapToPixel(e.clientX + 12)}px, ${snapToPixel(e.clientY + 16)}px, 0)`;\n };\n\n const autoScroll = (e: PointerEvent) => {\n // Cached rect (see Surface.viewportRect) - never getBoundingClientRect per\n // move; the box is stable while the pointer is captured.\n const rect = surface?.viewportRect;\n if (!surface?.viewport || !rect) return;\n const edge = activation.autoScrollEdgePx;\n const step = activation.autoScrollMaxStepPx;\n let delta = 0;\n if (e.clientY < rect.top + edge) {\n delta = -step * ((rect.top + edge - e.clientY) / edge);\n } else if (e.clientY > rect.bottom - edge) {\n delta = step * ((e.clientY - (rect.bottom - edge)) / edge);\n }\n if (rafScroll) cancelAnimationFrame(rafScroll);\n if (delta !== 0) {\n const tick = () => {\n // Write-then-readback: the browser clamps scrollTop at the scroll\n // extent, so mirror only the APPLIED delta - otherwise parking the\n // pointer in the edge zone at the limit keeps inflating the tracked\n // value past reality and poisons every later minute mapping. When\n // parked (nothing applied), stop the loop; the next pointermove\n // restarts it.\n const before = surface!.viewport!.scrollTop;\n surface!.viewport!.scrollTop = before + delta;\n const applied = surface!.viewport!.scrollTop - before;\n if (applied === 0) return;\n // keep the tracked scrollTop in step so pointerMinutes stays a pure\n // number read (no DOM scrollTop, no forced reflow)\n surface!.scrollTop += applied;\n applyProposal(e);\n rafScroll = requestAnimationFrame(tick);\n };\n rafScroll = requestAnimationFrame(tick);\n }\n };\n\n // idempotent: pointerup, pointercancel, Escape, blur and the calendar-level\n // teardown can race; whichever lands first wins and the rest no-op\n let finished = false;\n const cleanup = () => {\n if (finished) return;\n finished = true;\n activeGestureCancels.delete(cancel);\n window.removeEventListener(\"pointermove\", onPointerMove);\n window.removeEventListener(\"pointerup\", onPointerUp);\n window.removeEventListener(\"pointercancel\", onCancel);\n window.removeEventListener(\"blur\", onWindowBlur);\n window.removeEventListener(\"keydown\", onKeyDown, true);\n if (rafScroll) cancelAnimationFrame(rafScroll);\n if (touchTimer) clearTimeout(touchTimer);\n hintEl?.remove();\n hintEl = null;\n carryEl?.remove();\n carryEl = null;\n setBodyDragging(false);\n };\n\n const cancel = () => {\n cleanup();\n if (active) {\n lastGestureEndedAt = performance.now();\n internals.setDrag(null);\n internals.setSlotDraft(null);\n }\n };\n\n const onKeyDown = (e: KeyboardEvent) => {\n if (e.key === \"Escape\") {\n e.stopPropagation();\n cancel();\n }\n };\n\n // focus loss mid-gesture (alt-tab, OS dialogs) means the release may never\n // be delivered; treat it as a cancel so the gesture cannot get stuck and\n // commit its stale proposal on the next click\n const onWindowBlur = () => cancel();\n\n const onPointerMove = (e: PointerEvent) => {\n // a second finger must not drive - or cancel the pending long press of -\n // the gesture this pointer started\n if (e.pointerId !== pointerId) return;\n lastPointer = e;\n if (!active) {\n const distance = Math.hypot(e.clientX - startX, e.clientY - startY);\n if (isTouch) {\n // Long-press pending: moving past tolerance means scroll, not drag\n if (distance > activation.touchTolerancePx) cancel();\n return;\n }\n if (distance < activationDistance) return;\n activate();\n }\n applyProposal(e);\n autoScroll(e);\n updateHint(e);\n positionCarry(e);\n };\n\n const onPointerUp = (e: PointerEvent) => {\n if (e.pointerId !== pointerId) return;\n cleanup();\n if (!active) return;\n lastGestureEndedAt = performance.now();\n\n const state = instance.getState();\n if (kind === \"create\") {\n const draft = state.slotDraft;\n internals.setSlotDraft(null);\n if (draft) {\n api.select({\n slot: { start: draft.start, end: draft.end, allDay: draft.allDay },\n });\n settings.onSelectSlot?.(draft);\n }\n return;\n }\n const drag = state.drag;\n internals.setDrag(null);\n if (!drag || !occurrence) return;\n const unchanged =\n drag.proposedStart.getTime() === occurrence.start.getTime() &&\n drag.proposedEnd.getTime() === occurrence.end.getTime() &&\n (drag.proposedResourceId === undefined ||\n drag.proposedResourceId === occurrence.event.resourceId);\n if (unchanged) return;\n // Commit through the one validation funnel; consumer reject = automatic\n // revert because the calendar never mutated during the gesture.\n const accepted = internals.applyProposedUpdate({\n event: occurrence.event,\n occurrence,\n start: drag.proposedStart,\n end: drag.proposedEnd,\n allDay: drag.proposedAllDay,\n resourceId: drag.proposedResourceId,\n source: kind === \"move\" ? \"drag\" : (kind as \"resize-start\" | \"resize-end\"),\n });\n // the polite live region is the only feedback a screen-reader user gets\n // that the drop landed, and on what; a vetoed commit stays silent\n if (accepted && announcer) {\n announcer.textContent = `${occurrence.event.title}, ${settings.i18n.functions.formatEventTime(\n toZoned(drag.proposedStart, timeZone),\n toZoned(drag.proposedEnd, timeZone),\n drag.proposedAllDay,\n { locale: settings.locale },\n )}`;\n }\n };\n\n const onCancel = (e: PointerEvent) => {\n if (e.pointerId !== pointerId) return;\n cancel();\n };\n\n window.addEventListener(\"pointermove\", onPointerMove);\n window.addEventListener(\"pointerup\", onPointerUp);\n window.addEventListener(\"pointercancel\", onCancel);\n // a resize on a precise pointer is live from the first frame, so it never\n // reaches activate() to arm its own blur cancel\n if (active) window.addEventListener(\"blur\", onWindowBlur);\n window.addEventListener(\"keydown\", onKeyDown, true);\n activeGestureCancels.add(cancel);\n\n // Touch: long-press activation (movement past tolerance cancels above)\n if (isTouch && !active) {\n touchTimer = setTimeout(() => {\n activate();\n applyProposal(lastPointer);\n }, activation.touchDelayMs);\n }\n}\n\n/** Per-chip / per-surface pointer gesture wiring. */\nfunction useEventCalendarGestures<TData = unknown>() {\n const instance = useEventCalendar<TData>();\n // Overlay classNames bridged from React config into the vanilla-DOM engine\n // (which must never import from the chip module - circular).\n const { classNames } = useEventCalendarViewConfig<TData>();\n const ui = useMemo(\n () => ({\n dragCarry: classNames?.dragCarry,\n dragCarryInvalid: classNames?.dragCarryInvalid,\n dropHint: classNames?.dropHint,\n }),\n [classNames],\n );\n\n // An in-flight gesture lives on window listeners and body-appended overlays,\n // so it must never outlive the calendar. Chips hold this hook too and they\n // legitimately unmount mid-gesture, so only the LAST consumer leaving - the\n // calendar itself going away - aborts.\n useEffect(() => {\n gestureConsumers += 1;\n return () => {\n gestureConsumers -= 1;\n if (gestureConsumers === 0) cancelActiveEventCalendarGestures();\n };\n }, []);\n\n const canDrag = useCallback(\n (segment: EventCalendarSegment<TData>) => {\n const { interactions } = instance.getState();\n const event = segment.occurrence.event;\n return interactions.drag && !event.readOnly && event.draggable !== false;\n },\n [instance],\n );\n\n const canResize = useCallback(\n (segment: EventCalendarSegment<TData>) => {\n const { interactions } = instance.getState();\n const event = segment.occurrence.event;\n return interactions.resize && !event.readOnly && event.resizable !== false;\n },\n [instance],\n );\n\n const beginMove = useCallback(\n (e: React.PointerEvent, segment: EventCalendarSegment<TData>) => {\n if (e.button !== 0) return;\n if (!canDrag(segment)) {\n // refused, but still give feedback + broadcast on a real drag attempt\n beginBlockedGesture(instance, e.nativeEvent, segment, \"move\");\n return;\n }\n beginGesture({\n instance,\n kind: \"move\",\n origin: e.currentTarget as HTMLElement,\n startEvent: e.nativeEvent,\n segment,\n ui,\n });\n },\n [instance, canDrag, ui],\n );\n\n const beginResize = useCallback(\n (e: React.PointerEvent, segment: EventCalendarSegment<TData>, edge: \"start\" | \"end\") => {\n if (e.button !== 0) return;\n if (!canResize(segment)) {\n e.stopPropagation();\n beginBlockedGesture(instance, e.nativeEvent, segment, \"resize\");\n return;\n }\n e.stopPropagation();\n e.preventDefault();\n beginGesture({\n instance,\n kind: edge === \"start\" ? \"resize-start\" : \"resize-end\",\n origin: e.currentTarget as HTMLElement,\n startEvent: e.nativeEvent,\n segment,\n ui,\n });\n },\n [instance, canResize, ui],\n );\n\n const beginCreate = useCallback(\n (e: React.PointerEvent, day: Date, allDay: boolean) => {\n if (e.button !== 0) return;\n if (!instance.getState().interactions.selectSlot) return;\n beginGesture({\n instance,\n kind: \"create\",\n origin: e.currentTarget as HTMLElement,\n startEvent: e.nativeEvent,\n createDay: day,\n createAllDay: allDay,\n ui,\n });\n },\n [instance, ui],\n );\n\n return { beginMove, beginResize, beginCreate, canDrag, canResize };\n}\n\nexport {\n cancelActiveEventCalendarGestures,\n EVENT_CALENDAR_ACTIVATION,\n markChipPress,\n useEventCalendarGestures,\n wasRecentChipPress,\n wasRecentDrag,\n};\n"],"mappings":";;;;;;;;;;;;AAmBA,MAAM,4BAA4B;CAChC,gBAAgB;CAChB,kBAAkB;CAClB,cAAc;CACd,kBAAkB;CAClB,kBAAkB;CAClB,qBAAqB;AACvB;;AA0CA,IAAI,qBAAqB;AACzB,SAAS,gBAAyB;CAChC,OAAO,YAAY,IAAI,IAAI,qBAAqB;AAClD;;;;;;;;AASA,IAAI,kBAAkB;AACtB,SAAS,gBAAsB;CAC7B,kBAAkB,YAAY,IAAI;CAClC,OAAO,iBACL,mBACM;EACJ,kBAAkB,YAAY,IAAI;CACpC,GACA;EAAE,MAAM;EAAM,SAAS;CAAK,CAC9B;AACF;AACA,SAAS,qBAA8B;CACrC,OAAO,YAAY,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;EAAE,CAoBI;EAAG,aAjBb,aACjB,GAAuB,KAAW,WAAoB;GACrD,IAAI,EAAE,WAAW,GAAG;GACpB,IAAI,CAAC,SAAS,SAAS,CAAC,CAAC,aAAa,YAAY;GAClD,aAAa;IACX;IACA,MAAM;IACN,QAAQ,EAAE;IACV,YAAY,EAAE;IACd,WAAW;IACX,cAAc;IACd;GACF,CAAC;EACH,GACA,CAAC,UAAU,EAAE,CAG4B;EAAG;EAAS;CAAU;AACnE"}
@@ -143,21 +143,22 @@ function EventCalendarEvent({ segment, className, render, children, preview = fa
143
143
  children: settings.i18n.functions.formatEventTime(toZoned(occurrence.start, settings.timeZone), toZoned(occurrence.end, settings.timeZone), occurrence.allDay, { locale: settings.locale })
144
144
  }))
145
145
  ] });
146
+ const agendaTimeText = (() => {
147
+ if (view !== "agenda") return "";
148
+ if (occurrence.allDay) return settings.i18n.labels.allDay;
149
+ const dayStart = zonedStartOfDay(segment.day, settings.timeZone);
150
+ const dayEnd = addDays(toZoned(dayStart, settings.timeZone), 1);
151
+ const startsBefore = occurrence.start < dayStart;
152
+ const endsAfter = occurrence.end > dayEnd;
153
+ if (startsBefore && endsAfter) return settings.i18n.labels.allDay;
154
+ if (endsAfter) return settings.i18n.labels.timeFrom(format(toZoned(occurrence.start, settings.timeZone), settings.i18n.formats.eventTime, { locale: settings.locale }));
155
+ if (startsBefore) return settings.i18n.labels.timeUntil(format(toZoned(occurrence.end, settings.timeZone), settings.i18n.formats.eventTime, { locale: settings.locale }));
156
+ return settings.i18n.functions.formatEventTime(toZoned(occurrence.start, settings.timeZone), toZoned(occurrence.end, settings.timeZone), false, { locale: settings.locale });
157
+ })();
146
158
  const agendaDefaultContent = /* @__PURE__ */ jsxs(Fragment$1, { children: [
147
159
  /* @__PURE__ */ jsx("span", {
148
160
  className: "w-40 shrink-0 truncate text-muted-foreground tabular-nums",
149
- children: (() => {
150
- if (view !== "agenda") return "";
151
- if (occurrence.allDay) return settings.i18n.labels.allDay;
152
- const dayStart = zonedStartOfDay(segment.day, settings.timeZone);
153
- const dayEnd = addDays(toZoned(dayStart, settings.timeZone), 1);
154
- const startsBefore = occurrence.start < dayStart;
155
- const endsAfter = occurrence.end > dayEnd;
156
- if (startsBefore && endsAfter) return settings.i18n.labels.allDay;
157
- if (endsAfter) return settings.i18n.labels.timeFrom(format(toZoned(occurrence.start, settings.timeZone), settings.i18n.formats.eventTime, { locale: settings.locale }));
158
- if (startsBefore) return settings.i18n.labels.timeUntil(format(toZoned(occurrence.end, settings.timeZone), settings.i18n.formats.eventTime, { locale: settings.locale }));
159
- return settings.i18n.functions.formatEventTime(toZoned(occurrence.start, settings.timeZone), toZoned(occurrence.end, settings.timeZone), false, { locale: settings.locale });
160
- })()
161
+ children: agendaTimeText
161
162
  }),
162
163
  /* @__PURE__ */ jsx("span", {
163
164
  "aria-hidden": true,
@@ -238,44 +239,45 @@ function EventCalendarEvent({ segment, className, render, children, preview = fa
238
239
  children: grip
239
240
  })
240
241
  ] });
242
+ const defaultProps = {
243
+ type: "button",
244
+ "data-slot": "event-calendar-event",
245
+ "data-view": view,
246
+ "data-all-day": occurrence.allDay || void 0,
247
+ "data-recurring": occurrence.isRecurring || void 0,
248
+ "data-selected": isSelected || void 0,
249
+ "data-dragging": isDragging || void 0,
250
+ "data-preview": preview || void 0,
251
+ "data-past": occurrence.end.getTime() < Date.now() || void 0,
252
+ title: preview || tooltipOn ? void 0 : label,
253
+ "aria-label": settings.i18n.functions.formatEventAriaLabel?.(event.title, timeLabel, segment.continuesBefore || segment.continuesAfter) ?? `${event.title}, ${timeLabel}${segment.continuesBefore || segment.continuesAfter ? `, ${settings.i18n.labels.continues}` : ""}`,
254
+ "aria-pressed": interactive ? isSelected : void 0,
255
+ "aria-hidden": preview || void 0,
256
+ tabIndex: preview ? -1 : void 0,
257
+ style: { "--ec-event-color": event.color ?? "var(--color-primary)" },
258
+ onPointerDown: (e) => {
259
+ e.stopPropagation();
260
+ markChipPress();
261
+ if (interactive) gestures.beginMove(e, segment);
262
+ },
263
+ onClick: (e) => {
264
+ e.stopPropagation();
265
+ if (wasRecentDrag()) return;
266
+ settings.onEventClick?.(occurrence, e);
267
+ if (e.defaultPrevented || view === "agenda") return;
268
+ instance.api.selectEvent(occurrence.key);
269
+ },
270
+ onDoubleClick: (e) => {
271
+ e.stopPropagation();
272
+ settings.onEventDoubleClick?.(occurrence, e);
273
+ },
274
+ className: cn("group/ec-event relative flex w-full min-w-0 cursor-pointer touch-none select-none items-center overflow-hidden text-start text-foreground", "outline-none focus-visible:ring-2 focus-visible:ring-ring/50", preview && "pointer-events-none", view === "agenda" ? "gap-3 rounded-md text-sm" : cn("@container gap-1.5 rounded-sm px-1.5 py-1 leading-normal", "bg-(--ec-event-color)/15 hover:bg-(--ec-event-color)/25", "dark:bg-(--ec-event-color)/20 dark:hover:bg-(--ec-event-color)/30", "inset-ring inset-ring-(--ec-event-color)/15", "transition-[background-color,box-shadow] duration-150", "data-dragging:opacity-40", "data-selected:inset-ring-(--ec-event-color)/40 data-selected:bg-(--ec-event-color)/30", segment.continuesBefore && "rounded-s-none", segment.continuesAfter && "rounded-e-none"), viewConfig.classNames?.event, className),
275
+ children: /* @__PURE__ */ jsxs(Fragment$1, { children: [content, resizeHandles] })
276
+ };
241
277
  const chip = useRender({
242
278
  defaultTagName: "button",
243
279
  render,
244
- props: mergeProps({
245
- type: "button",
246
- "data-slot": "event-calendar-event",
247
- "data-view": view,
248
- "data-all-day": occurrence.allDay || void 0,
249
- "data-recurring": occurrence.isRecurring || void 0,
250
- "data-selected": isSelected || void 0,
251
- "data-dragging": isDragging || void 0,
252
- "data-preview": preview || void 0,
253
- "data-past": occurrence.end.getTime() < Date.now() || void 0,
254
- title: preview || tooltipOn ? void 0 : label,
255
- "aria-label": settings.i18n.functions.formatEventAriaLabel?.(event.title, timeLabel, segment.continuesBefore || segment.continuesAfter) ?? `${event.title}, ${timeLabel}${segment.continuesBefore || segment.continuesAfter ? `, ${settings.i18n.labels.continues}` : ""}`,
256
- "aria-pressed": interactive ? isSelected : void 0,
257
- "aria-hidden": preview || void 0,
258
- tabIndex: preview ? -1 : void 0,
259
- style: { "--ec-event-color": event.color ?? "var(--color-primary)" },
260
- onPointerDown: (e) => {
261
- e.stopPropagation();
262
- markChipPress();
263
- if (interactive) gestures.beginMove(e, segment);
264
- },
265
- onClick: (e) => {
266
- e.stopPropagation();
267
- if (wasRecentDrag()) return;
268
- settings.onEventClick?.(occurrence, e);
269
- if (e.defaultPrevented || view === "agenda") return;
270
- instance.api.selectEvent(occurrence.key);
271
- },
272
- onDoubleClick: (e) => {
273
- e.stopPropagation();
274
- settings.onEventDoubleClick?.(occurrence, e);
275
- },
276
- className: cn("group/ec-event relative flex w-full min-w-0 cursor-pointer touch-none select-none items-center overflow-hidden text-start text-foreground", "outline-none focus-visible:ring-2 focus-visible:ring-ring/50", preview && "pointer-events-none", view === "agenda" ? "gap-3 rounded-md text-sm" : cn("@container gap-1.5 rounded-sm px-1.5 py-1 leading-normal", "bg-(--ec-event-color)/15 hover:bg-(--ec-event-color)/25", "dark:bg-(--ec-event-color)/20 dark:hover:bg-(--ec-event-color)/30", "inset-ring inset-ring-(--ec-event-color)/15", "transition-[background-color,box-shadow] duration-150", "data-dragging:opacity-40", "data-selected:inset-ring-(--ec-event-color)/40 data-selected:bg-(--ec-event-color)/30", segment.continuesBefore && "rounded-s-none", segment.continuesAfter && "rounded-e-none"), viewConfig.classNames?.event, className),
277
- children: /* @__PURE__ */ jsxs(Fragment$1, { children: [content, resizeHandles] })
278
- }, props)
280
+ props: mergeProps(defaultProps, props)
279
281
  });
280
282
  return /* @__PURE__ */ jsx(EventCalendarChipContext.Provider, {
281
283
  value: {
@@ -1 +1 @@
1
- {"version":3,"file":"event-calendar-event.js","names":[],"sources":["../../../../src/components/reui/event-calendar/event-calendar-event.tsx"],"sourcesContent":["\"use client\";\n\nimport { type CSSProperties, createContext, type ReactNode, useContext, useMemo } from \"react\";\nimport { mergeProps } from \"@base-ui/react/merge-props\";\nimport { useRender } from \"@base-ui/react/use-render\";\nimport { addDays, format } from \"date-fns\";\nimport { RepeatIcon } from \"lucide-react\";\n\nimport { cn } from \"@kumix/utils\";\nimport { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from \"../../ui/tooltip\";\nimport {\n useEventCalendar,\n useEventCalendarSelector,\n useEventCalendarViewConfig,\n useEventCalendarViewContext,\n} from \"./event-calendar\";\nimport { markChipPress, useEventCalendarGestures, wasRecentDrag } from \"./event-calendar-dnd\";\nimport { spansMultipleDays, toZoned, zonedStartOfDay } from \"./event-calendar-lib\";\nimport type { EventCalendarOccurrence, EventCalendarSegment } from \"./event-calendar-types\";\n\n/**\n * Effective Tailwind palette presets for event colors; every entry works on\n * light and dark surfaces through the chip's alpha background + accent border.\n */\nconst EVENT_CALENDAR_COLORS: Array<{ name: string; value: string }> = [\n { name: \"Blue\", value: \"var(--color-blue-500)\" },\n { name: \"Emerald\", value: \"var(--color-emerald-500)\" },\n { name: \"Violet\", value: \"var(--color-violet-500)\" },\n { name: \"Rose\", value: \"var(--color-rose-500)\" },\n { name: \"Amber\", value: \"var(--color-amber-500)\" },\n { name: \"Cyan\", value: \"var(--color-cyan-500)\" },\n { name: \"Orange\", value: \"var(--color-orange-500)\" },\n { name: \"Pink\", value: \"var(--color-pink-500)\" },\n { name: \"Teal\", value: \"var(--color-teal-500)\" },\n { name: \"Indigo\", value: \"var(--color-indigo-500)\" },\n];\n\n/**\n * Standardized drag-ghost surface treatment, shared verbatim by every view\n * (month, week/day/N-days, resource). One visual language for interactions:\n * - move: the event is CARRIED FREELY - a cursor-attached full clone (built\n * by the dnd engine, data-slot=event-calendar-drag-carry) travels with the\n * pointer; the in-grid ghost is only this faint dashed placeholder marking\n * the snapped drop slot. The source stays dimmed in place.\n * - resize: the event is STRETCHED - the chip itself at the proposed extent\n * with a dashed boundary instead of solid (slight indicator, no elevation).\n * - invalid: destructive tint on the placeholder / dashed clone; the engine\n * adds the not-allowed cursor, a destructive ring on the carry clone, and\n * a cursor-following validation hint.\n */\nconst EVENT_CALENDAR_GHOST = {\n move: \"rounded-sm border border-dashed border-(--ec-event-color)/50 bg-(--ec-event-color)/8\",\n resize: \"rounded-sm border border-dashed border-(--ec-event-color)/70 overflow-hidden\",\n invalid: \"border-destructive/70 bg-destructive/10\",\n invalidResize: \"border-destructive/70\",\n /** Applied to the clone inside an invalid resize ghost. */\n invalidContent: \"opacity-60\",\n} as const;\n\n/**\n * Fade-out truncation for stacked timed blocks: squeezed cascade columns\n * hard-clip titles into a mash of adjacent glyphs; a right-edge mask fade\n * reads cleaner than an ellipsis at those tiny widths. The mask applies ONLY\n * below a 10rem container width - mask-image forces text off subpixel\n * antialiasing onto a grayscale raster layer, so masking every wide chip\n * makes the whole grid read bolder/blurry and shimmer while the window\n * resizes. Wide chips keep a plain ellipsis. Consumer renderEvent content\n * can import and reuse it.\n */\nconst EVENT_CALENDAR_FADE_TRUNCATE =\n \"w-full truncate @max-[10rem]:text-clip @max-[10rem]:[mask-image:linear-gradient(to_right,#000_calc(100%-0.75rem),transparent)] @max-[10rem]:rtl:[mask-image:linear-gradient(to_left,#000_calc(100%-0.75rem),transparent)]\";\n\ninterface EventCalendarChipContextValue<TData = unknown> {\n occurrence: EventCalendarOccurrence<TData>;\n segment: EventCalendarSegment<TData>;\n isDragging: boolean;\n isSelected: boolean;\n}\n\nconst EventCalendarChipContext =\n // biome-ignore lint/suspicious/noExplicitAny: <>\n createContext<EventCalendarChipContextValue<any> | null>(null);\n\n/** The chip's subject; usable inside renderEvent content and chip children. */\nfunction useEventCalendarEventChip<TData = unknown>(): EventCalendarChipContextValue<TData> {\n const ctx = useContext(EventCalendarChipContext);\n if (!ctx) {\n throw new Error(\"useEventCalendarEventChip must be used within <EventCalendarEvent>\");\n }\n return ctx as EventCalendarChipContextValue<TData>;\n}\n\ninterface EventCalendarEventProps<TData = unknown>\n extends Omit<useRender.ComponentProps<\"button\">, \"children\"> {\n segment: EventCalendarSegment<TData>;\n /** Replaces the default chip CONTENT; the wrapper stays calendar-owned. */\n children?: ReactNode;\n /**\n * Static drag clone: renders the chip exactly as-is but inert - no gestures,\n * resize handles, selection/drag state, focus, or pointer events. Used for\n * the full-fidelity ghost that tracks the proposed slot during a move.\n */\n preview?: boolean;\n}\n\n/**\n * The one interactive event element used by every view. The wrapper owns\n * positioning hooks, a11y, selection, drag/resize listeners, and data\n * attributes; content comes from children, the root renderEvent override,\n * or the built-in default.\n */\nfunction EventCalendarEvent<TData = unknown>({\n segment,\n className,\n render,\n children,\n preview = false,\n ...props\n}: EventCalendarEventProps<TData>) {\n const instance = useEventCalendar<TData>();\n const viewConfig = useEventCalendarViewConfig<TData>();\n const { view } = useEventCalendarViewContext();\n const gestures = useEventCalendarGestures<TData>();\n const { settings } = instance;\n const occurrence = segment.occurrence;\n const event = occurrence.event;\n\n const isSelectedRaw = useEventCalendarSelector<TData, boolean>(\n (state) => state.selection.eventKeys.includes(occurrence.key),\n { calendar: instance },\n );\n const isDraggingRaw = useEventCalendarSelector<TData, boolean>(\n (state) => state.drag?.occurrence.key === occurrence.key,\n { calendar: instance },\n );\n // reactive, unlike gestures.canResize: api.setInteractions({ resize })\n // must add/remove the handles without waiting for an unrelated re-render\n const resizeOn = useEventCalendarSelector<TData, boolean>((state) => state.interactions.resize, {\n calendar: instance,\n });\n // A preview clone must never inherit the source's selected/dragging state\n // (the drag key matches, which would dim the clone itself).\n const isSelected = preview ? false : isSelectedRaw;\n const isDragging = preview ? false : isDraggingRaw;\n\n const isBar = occurrence.allDay || spansMultipleDays(occurrence, settings.timeZone);\n const inTimeGrid = view === \"week\" || view === \"day\" || view === \"days\" || view === \"resource\";\n const interactive = view !== \"agenda\" && !preview;\n const timedBlock = inTimeGrid && !isBar;\n const horizontalBar = isBar && !inTimeGrid;\n // >= compactEventMinutes renders the stacked (title over time) layout;\n // squeezed cascade columns there fade-truncate instead of hard-clipping\n // into neighbors\n const stackedBlock =\n timedBlock && (segment.endMin ?? 0) - (segment.startMin ?? 0) >= viewConfig.compactEventMinutes;\n\n const defaultContent = (\n <>\n {/* leading color dot for single-row chips (month cells, all-day bars);\n time-grid blocks read their color from the tinted surface instead -\n in the stacked layout a dot would sit alone on the first line */}\n {!timedBlock && (\n <span\n aria-hidden\n data-slot=\"event-calendar-event-dot\"\n // -me-0.5 tightens just the dot-to-title gap (the chip keeps gap-1.5\n // between the title and the trailing time)\n className=\"-me-0.5 size-1.5 shrink-0 rounded-full bg-(--ec-event-color)\"\n />\n )}\n {occurrence.isRecurring && (\n <RepeatIcon className=\"size-2.5 shrink-0 opacity-70\" aria-hidden=\"true\" />\n )}\n <span className={cn(\"font-medium\", stackedBlock ? EVENT_CALENDAR_FADE_TRUNCATE : \"truncate\")}>\n {event.title}\n </span>\n {/* month cells are narrow: a compact never-shrinking start time keeps\n the title readable; grid views show the full range */}\n {!occurrence.allDay &&\n segment.isStart &&\n (view === \"month\" ? (\n <span className=\"shrink-0 text-muted-foreground\">\n {format(toZoned(occurrence.start, settings.timeZone), settings.i18n.formats.eventTime, {\n locale: settings.locale,\n })}\n </span>\n ) : (\n <span\n className={cn(\n \"@[8rem]:inline hidden text-muted-foreground\",\n stackedBlock ? EVENT_CALENDAR_FADE_TRUNCATE : \"truncate\",\n )}\n >\n {settings.i18n.functions.formatEventTime(\n toZoned(occurrence.start, settings.timeZone),\n toZoned(occurrence.end, settings.timeZone),\n occurrence.allDay,\n { locale: settings.locale },\n )}\n </span>\n ))}\n </>\n );\n\n // Agenda time text is per-day for multi-day events: the first day reads\n // \"From 9:00 AM\", middle days \"All day\", the last day \"Until 5:00 PM\".\n // Boundaries derive from the occurrence vs segment.day (never the packing\n // flags - lane merging rewrites those on shared segment objects).\n const agendaTimeText = (() => {\n if (view !== \"agenda\") return \"\";\n if (occurrence.allDay) return settings.i18n.labels.allDay;\n const dayStart = zonedStartOfDay(segment.day, settings.timeZone);\n const dayEnd = addDays(toZoned(dayStart, settings.timeZone), 1);\n const startsBefore = occurrence.start < dayStart;\n const endsAfter = occurrence.end > dayEnd;\n if (startsBefore && endsAfter) return settings.i18n.labels.allDay;\n if (endsAfter) {\n return settings.i18n.labels.timeFrom(\n format(toZoned(occurrence.start, settings.timeZone), settings.i18n.formats.eventTime, {\n locale: settings.locale,\n }),\n );\n }\n if (startsBefore) {\n return settings.i18n.labels.timeUntil(\n format(toZoned(occurrence.end, settings.timeZone), settings.i18n.formats.eventTime, {\n locale: settings.locale,\n }),\n );\n }\n return settings.i18n.functions.formatEventTime(\n toZoned(occurrence.start, settings.timeZone),\n toZoned(occurrence.end, settings.timeZone),\n false,\n { locale: settings.locale },\n );\n })();\n\n // Agenda default row: time column, color-dot badge, plain title\n const agendaDefaultContent = (\n <>\n <span className=\"w-40 shrink-0 truncate text-muted-foreground tabular-nums\">\n {agendaTimeText}\n </span>\n <span\n aria-hidden\n data-slot=\"event-calendar-agenda-dot\"\n className=\"size-2 shrink-0 rounded-full bg-(--ec-event-color)\"\n />\n <span className=\"truncate text-sm\">{event.title}</span>\n {occurrence.isRecurring && (\n <RepeatIcon className=\"size-2.5 shrink-0 text-muted-foreground\" aria-hidden=\"true\" />\n )}\n </>\n );\n\n // Custom chip content is memoized so a drag - which re-renders the lane on\n // every pointer move - never re-invokes the consumer's renderEvent per frame.\n // The element stays referentially stable across those re-renders, so React\n // skips the custom subtree and it doesn't flicker; on drop only the moved\n // chip's inputs change and recompute. Deps are exactly renderProps' inputs\n // plus the render fns (all stable during an internal drag).\n const customContent = useMemo(() => {\n const renderProps = { occurrence, segment, view, isDragging, isSelected };\n return view === \"agenda\"\n ? viewConfig.renderAgendaEvent?.(renderProps)\n : viewConfig.renderEvent?.(renderProps);\n }, [\n occurrence,\n segment,\n view,\n isDragging,\n isSelected,\n viewConfig.renderAgendaEvent,\n viewConfig.renderEvent,\n ]);\n const content =\n children ?? customContent ?? (view === \"agenda\" ? agendaDefaultContent : defaultContent);\n\n const timeLabel = settings.i18n.functions.formatEventTime(\n toZoned(occurrence.start, settings.timeZone),\n toZoned(occurrence.end, settings.timeZone),\n occurrence.allDay,\n { locale: settings.locale },\n );\n // native hover tooltip text; a consumer formatter returning undefined\n // drops the title attribute entirely (e.g. when it renders its own tooltip)\n const label = settings.i18n.functions.formatEventLabel\n ? settings.i18n.functions.formatEventLabel(event.title, timeLabel)\n : `${event.title}, ${timeLabel}`;\n\n // Optional styled tooltip on hover / keyboard focus (viewConfig.eventTooltip,\n // default off). When on, the native title is dropped so the two never stack;\n // a preview clone never gets one. Content defaults to the label and can be\n // overridden with renderEventTooltip - a falsy result (null/undefined, or\n // the `false`/\"\" that `cond && <node>` yields) falls back to the label, and\n // an empty label (i18n opt-out) leaves no content so the tooltip is skipped.\n const tooltipOpts = typeof viewConfig.eventTooltip === \"object\" ? viewConfig.eventTooltip : null;\n const tooltipContent =\n !preview && viewConfig.eventTooltip\n ? viewConfig.renderEventTooltip?.({\n occurrence,\n segment,\n view,\n label,\n }) || label\n : null;\n const tooltipOn = Boolean(tooltipContent);\n\n const showResize = interactive && resizeOn && !event.readOnly && event.resizable !== false;\n // Hover grip pill (mirrors the gantt bars): a tiny bar inside each resize\n // handle signals the direction. Shown on every resizable chip - compact\n // sub-compactEventMinutes timed blocks included - because the chip\n // min-height (1.5rem) leaves room at the very top/bottom edges without\n // colliding with the vertically-centered title.\n const grip = (\n <span\n aria-hidden\n data-slot=\"event-calendar-resize-grip\"\n className={cn(\n \"rounded-full bg-foreground/40\",\n timedBlock ? \"h-0.5 w-2.5\" : \"h-2.5 w-0.5\",\n viewConfig.classNames?.resizeGrip,\n )}\n />\n );\n const resizeHandles = showResize && (\n <>\n {timedBlock && segment.isStart && (\n <span\n data-slot=\"event-calendar-resize-handle\"\n data-edge=\"start\"\n className={cn(\n \"absolute inset-x-1 top-0 flex h-1.5 cursor-ns-resize items-center justify-center opacity-0 transition-opacity duration-150 group-hover/ec-event:opacity-100\",\n viewConfig.classNames?.resizeHandle,\n )}\n onPointerDown={(e) => gestures.beginResize(e, segment, \"start\")}\n >\n {grip}\n </span>\n )}\n {timedBlock && segment.isEnd && (\n <span\n data-slot=\"event-calendar-resize-handle\"\n data-edge=\"end\"\n className={cn(\n \"absolute inset-x-1 bottom-0 flex h-1.5 cursor-ns-resize items-center justify-center opacity-0 transition-opacity duration-150 group-hover/ec-event:opacity-100\",\n viewConfig.classNames?.resizeHandle,\n )}\n onPointerDown={(e) => gestures.beginResize(e, segment, \"end\")}\n >\n {grip}\n </span>\n )}\n {(horizontalBar || (isBar && inTimeGrid)) && segment.isStart && (\n <span\n data-slot=\"event-calendar-resize-handle\"\n data-edge=\"start\"\n className={cn(\n \"absolute inset-y-0 start-0 flex w-2 cursor-ew-resize items-center justify-center opacity-0 transition-opacity duration-150 group-hover/ec-event:opacity-100\",\n viewConfig.classNames?.resizeHandle,\n )}\n onPointerDown={(e) => gestures.beginResize(e, segment, \"start\")}\n >\n {grip}\n </span>\n )}\n {(horizontalBar || (isBar && inTimeGrid)) && segment.isEnd && (\n <span\n data-slot=\"event-calendar-resize-handle\"\n data-edge=\"end\"\n className={cn(\n \"absolute inset-y-0 end-0 flex w-2 cursor-ew-resize items-center justify-center opacity-0 transition-opacity duration-150 group-hover/ec-event:opacity-100\",\n viewConfig.classNames?.resizeHandle,\n )}\n onPointerDown={(e) => gestures.beginResize(e, segment, \"end\")}\n >\n {grip}\n </span>\n )}\n </>\n );\n\n const defaultProps = {\n type: \"button\" as const,\n \"data-slot\": \"event-calendar-event\",\n \"data-view\": view,\n \"data-all-day\": occurrence.allDay || undefined,\n \"data-recurring\": occurrence.isRecurring || undefined,\n \"data-selected\": isSelected || undefined,\n \"data-dragging\": isDragging || undefined,\n \"data-preview\": preview || undefined,\n \"data-past\": occurrence.end.getTime() < Date.now() || undefined,\n // native hover reveal for squeezed/faded chips: full title + time (dropped\n // when the styled eventTooltip is on so the two never stack)\n title: preview || tooltipOn ? undefined : label,\n \"aria-label\":\n settings.i18n.functions.formatEventAriaLabel?.(\n event.title,\n timeLabel,\n segment.continuesBefore || segment.continuesAfter,\n ) ??\n `${event.title}, ${timeLabel}${\n segment.continuesBefore || segment.continuesAfter\n ? `, ${settings.i18n.labels.continues}`\n : \"\"\n }`,\n // Selection is otherwise conveyed by a background tint alone; the chip is a\n // real toggle in every interactive view, so a screen reader hears the state\n // (agenda rows never select, previews are inert - both stay unpressed).\n \"aria-pressed\": interactive ? isSelected : undefined,\n \"aria-hidden\": preview || undefined,\n tabIndex: preview ? -1 : undefined,\n style: {\n \"--ec-event-color\": event.color ?? \"var(--color-primary)\",\n } as CSSProperties,\n onPointerDown: (e: React.PointerEvent) => {\n e.stopPropagation();\n // suppress the trailing slot-create click if this press does not turn\n // into a drag (e.g. a locked chip) - see markChipPress\n markChipPress();\n if (interactive) gestures.beginMove(e, segment);\n },\n onClick: (e: React.MouseEvent) => {\n e.stopPropagation();\n if (wasRecentDrag()) return;\n // consumer first: e.preventDefault() opts out of built-in selection\n // (e.g. click = open dialog only, no selected tint)\n settings.onEventClick?.(occurrence, e);\n // the agenda is a read-only list: a click never selects/focuses a row\n if (e.defaultPrevented || view === \"agenda\") return;\n instance.api.selectEvent(occurrence.key);\n },\n onDoubleClick: (e: React.MouseEvent) => {\n e.stopPropagation();\n settings.onEventDoubleClick?.(occurrence, e);\n },\n className: cn(\n \"group/ec-event relative flex w-full min-w-0 cursor-pointer touch-none select-none items-center overflow-hidden text-start text-foreground\",\n \"outline-none focus-visible:ring-2 focus-visible:ring-ring/50\",\n preview && \"pointer-events-none\",\n view === \"agenda\"\n ? // plain list row: color lives in the dot badge, not a tinted pill;\n // hover AND selection surfaces are owned by the agenda row wrapper\n \"gap-3 rounded-md text-sm\"\n : cn(\n // @container removes intrinsic sizing; only grid chips are containers\n // py-1: room above/below inline badges (attendee pill etc.)\n \"@container gap-1.5 rounded-sm px-1.5 py-1 leading-normal\",\n // soft tint + hairline inset ring: color reads from the surface\n // itself (no accent border), stays legible in light and dark\n \"bg-(--ec-event-color)/15 hover:bg-(--ec-event-color)/25\",\n // a flat tint reads darker over a dark surface, so lift it a little\n // in dark mode to keep a lighter, softer chip tone\n \"dark:bg-(--ec-event-color)/20 dark:hover:bg-(--ec-event-color)/30\",\n \"inset-ring inset-ring-(--ec-event-color)/15\",\n \"transition-[background-color,box-shadow] duration-150\",\n \"data-dragging:opacity-40\",\n \"data-selected:inset-ring-(--ec-event-color)/40 data-selected:bg-(--ec-event-color)/30\",\n segment.continuesBefore && \"rounded-s-none\",\n segment.continuesAfter && \"rounded-e-none\",\n ),\n viewConfig.classNames?.event,\n className,\n ),\n children: (\n <>\n {content}\n {resizeHandles}\n </>\n ),\n };\n\n const chip = useRender({\n defaultTagName: \"button\",\n render,\n props: mergeProps<\"button\">(defaultProps, props),\n });\n\n return (\n <EventCalendarChipContext.Provider value={{ occurrence, segment, isDragging, isSelected }}>\n {tooltipOn ? (\n <TooltipProvider delay={tooltipOpts?.delay ?? 600}>\n <Tooltip>\n <TooltipTrigger render={chip} />\n <TooltipContent\n side={tooltipOpts?.side ?? \"top\"}\n className={viewConfig.classNames?.eventTooltip}\n >\n {tooltipContent}\n </TooltipContent>\n </Tooltip>\n </TooltipProvider>\n ) : (\n chip\n )}\n </EventCalendarChipContext.Provider>\n );\n}\n\nexport type { EventCalendarChipContextValue, EventCalendarEventProps };\nexport {\n EVENT_CALENDAR_COLORS,\n EVENT_CALENDAR_FADE_TRUNCATE,\n EVENT_CALENDAR_GHOST,\n EventCalendarEvent,\n useEventCalendarEventChip,\n};\n"],"mappings":";;;;;;;;;;;;;;;;;AAwBA,MAAM,wBAAgE;CACpE;EAAE,MAAM;EAAQ,OAAO;CAAwB;CAC/C;EAAE,MAAM;EAAW,OAAO;CAA2B;CACrD;EAAE,MAAM;EAAU,OAAO;CAA0B;CACnD;EAAE,MAAM;EAAQ,OAAO;CAAwB;CAC/C;EAAE,MAAM;EAAS,OAAO;CAAyB;CACjD;EAAE,MAAM;EAAQ,OAAO;CAAwB;CAC/C;EAAE,MAAM;EAAU,OAAO;CAA0B;CACnD;EAAE,MAAM;EAAQ,OAAO;CAAwB;CAC/C;EAAE,MAAM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AAY;GAAS;GAAY;EAAW;EACrF,UAAA,YACC,oBAAC,iBAAD;GAAiB,OAAO,aAAa,SAAS;GAC5C,UAAA,qBAAC,SAAD,EAAA,UAAA,CACE,oBAAC,gBAAD,EAAgB,QAAQ,KAAO,CAAA,GAC/B,oBAAC,gBAAD;IACE,MAAM,aAAa,QAAQ;IAC3B,WAAW,WAAW,YAAY;IAEjC,UAAA;GACa,CAAA,CACT,EAAA,CAAA;EACM,CAAA,IAEjB;CAE+B,CAAA;AAEvC"}
1
+ {"version":3,"file":"event-calendar-event.js","names":[],"sources":["../../../../src/components/reui/event-calendar/event-calendar-event.tsx"],"sourcesContent":["\"use client\";\n\nimport { type CSSProperties, createContext, type ReactNode, useContext, useMemo } from \"react\";\nimport { mergeProps } from \"@base-ui/react/merge-props\";\nimport { useRender } from \"@base-ui/react/use-render\";\nimport { addDays, format } from \"date-fns\";\nimport { RepeatIcon } from \"lucide-react\";\n\nimport { cn } from \"@kumix/utils\";\nimport { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from \"../../ui/tooltip\";\nimport {\n useEventCalendar,\n useEventCalendarSelector,\n useEventCalendarViewConfig,\n useEventCalendarViewContext,\n} from \"./event-calendar\";\nimport { markChipPress, useEventCalendarGestures, wasRecentDrag } from \"./event-calendar-dnd\";\nimport { spansMultipleDays, toZoned, zonedStartOfDay } from \"./event-calendar-lib\";\nimport type { EventCalendarOccurrence, EventCalendarSegment } from \"./event-calendar-types\";\n\n/**\n * Effective Tailwind palette presets for event colors; every entry works on\n * light and dark surfaces through the chip's alpha background + accent border.\n */\nconst EVENT_CALENDAR_COLORS: Array<{ name: string; value: string }> = [\n { name: \"Blue\", value: \"var(--color-blue-500)\" },\n { name: \"Emerald\", value: \"var(--color-emerald-500)\" },\n { name: \"Violet\", value: \"var(--color-violet-500)\" },\n { name: \"Rose\", value: \"var(--color-rose-500)\" },\n { name: \"Amber\", value: \"var(--color-amber-500)\" },\n { name: \"Cyan\", value: \"var(--color-cyan-500)\" },\n { name: \"Orange\", value: \"var(--color-orange-500)\" },\n { name: \"Pink\", value: \"var(--color-pink-500)\" },\n { name: \"Teal\", value: \"var(--color-teal-500)\" },\n { name: \"Indigo\", value: \"var(--color-indigo-500)\" },\n];\n\n/**\n * Standardized drag-ghost surface treatment, shared verbatim by every view\n * (month, week/day/N-days, resource). One visual language for interactions:\n * - move: the event is CARRIED FREELY - a cursor-attached full clone (built\n * by the dnd engine, data-slot=event-calendar-drag-carry) travels with the\n * pointer; the in-grid ghost is only this faint dashed placeholder marking\n * the snapped drop slot. The source stays dimmed in place.\n * - resize: the event is STRETCHED - the chip itself at the proposed extent\n * with a dashed boundary instead of solid (slight indicator, no elevation).\n * - invalid: destructive tint on the placeholder / dashed clone; the engine\n * adds the not-allowed cursor, a destructive ring on the carry clone, and\n * a cursor-following validation hint.\n */\nconst EVENT_CALENDAR_GHOST = {\n move: \"rounded-sm border border-dashed border-(--ec-event-color)/50 bg-(--ec-event-color)/8\",\n resize: \"rounded-sm border border-dashed border-(--ec-event-color)/70 overflow-hidden\",\n invalid: \"border-destructive/70 bg-destructive/10\",\n invalidResize: \"border-destructive/70\",\n /** Applied to the clone inside an invalid resize ghost. */\n invalidContent: \"opacity-60\",\n} as const;\n\n/**\n * Fade-out truncation for stacked timed blocks: squeezed cascade columns\n * hard-clip titles into a mash of adjacent glyphs; a right-edge mask fade\n * reads cleaner than an ellipsis at those tiny widths. The mask applies ONLY\n * below a 10rem container width - mask-image forces text off subpixel\n * antialiasing onto a grayscale raster layer, so masking every wide chip\n * makes the whole grid read bolder/blurry and shimmer while the window\n * resizes. Wide chips keep a plain ellipsis. Consumer renderEvent content\n * can import and reuse it.\n */\nconst EVENT_CALENDAR_FADE_TRUNCATE =\n \"w-full truncate @max-[10rem]:text-clip @max-[10rem]:[mask-image:linear-gradient(to_right,#000_calc(100%-0.75rem),transparent)] @max-[10rem]:rtl:[mask-image:linear-gradient(to_left,#000_calc(100%-0.75rem),transparent)]\";\n\ninterface EventCalendarChipContextValue<TData = unknown> {\n occurrence: EventCalendarOccurrence<TData>;\n segment: EventCalendarSegment<TData>;\n isDragging: boolean;\n isSelected: boolean;\n}\n\nconst EventCalendarChipContext =\n // biome-ignore lint/suspicious/noExplicitAny: <>\n createContext<EventCalendarChipContextValue<any> | null>(null);\n\n/** The chip's subject; usable inside renderEvent content and chip children. */\nfunction useEventCalendarEventChip<TData = unknown>(): EventCalendarChipContextValue<TData> {\n const ctx = useContext(EventCalendarChipContext);\n if (!ctx) {\n throw new Error(\"useEventCalendarEventChip must be used within <EventCalendarEvent>\");\n }\n return ctx as EventCalendarChipContextValue<TData>;\n}\n\ninterface EventCalendarEventProps<TData = unknown>\n extends Omit<useRender.ComponentProps<\"button\">, \"children\"> {\n segment: EventCalendarSegment<TData>;\n /** Replaces the default chip CONTENT; the wrapper stays calendar-owned. */\n children?: ReactNode;\n /**\n * Static drag clone: renders the chip exactly as-is but inert - no gestures,\n * resize handles, selection/drag state, focus, or pointer events. Used for\n * the full-fidelity ghost that tracks the proposed slot during a move.\n */\n preview?: boolean;\n}\n\n/**\n * The one interactive event element used by every view. The wrapper owns\n * positioning hooks, a11y, selection, drag/resize listeners, and data\n * attributes; content comes from children, the root renderEvent override,\n * or the built-in default.\n */\nfunction EventCalendarEvent<TData = unknown>({\n segment,\n className,\n render,\n children,\n preview = false,\n ...props\n}: EventCalendarEventProps<TData>) {\n const instance = useEventCalendar<TData>();\n const viewConfig = useEventCalendarViewConfig<TData>();\n const { view } = useEventCalendarViewContext();\n const gestures = useEventCalendarGestures<TData>();\n const { settings } = instance;\n const occurrence = segment.occurrence;\n const event = occurrence.event;\n\n const isSelectedRaw = useEventCalendarSelector<TData, boolean>(\n (state) => state.selection.eventKeys.includes(occurrence.key),\n { calendar: instance },\n );\n const isDraggingRaw = useEventCalendarSelector<TData, boolean>(\n (state) => state.drag?.occurrence.key === occurrence.key,\n { calendar: instance },\n );\n // reactive, unlike gestures.canResize: api.setInteractions({ resize })\n // must add/remove the handles without waiting for an unrelated re-render\n const resizeOn = useEventCalendarSelector<TData, boolean>((state) => state.interactions.resize, {\n calendar: instance,\n });\n // A preview clone must never inherit the source's selected/dragging state\n // (the drag key matches, which would dim the clone itself).\n const isSelected = preview ? false : isSelectedRaw;\n const isDragging = preview ? false : isDraggingRaw;\n\n const isBar = occurrence.allDay || spansMultipleDays(occurrence, settings.timeZone);\n const inTimeGrid = view === \"week\" || view === \"day\" || view === \"days\" || view === \"resource\";\n const interactive = view !== \"agenda\" && !preview;\n const timedBlock = inTimeGrid && !isBar;\n const horizontalBar = isBar && !inTimeGrid;\n // >= compactEventMinutes renders the stacked (title over time) layout;\n // squeezed cascade columns there fade-truncate instead of hard-clipping\n // into neighbors\n const stackedBlock =\n timedBlock && (segment.endMin ?? 0) - (segment.startMin ?? 0) >= viewConfig.compactEventMinutes;\n\n const defaultContent = (\n <>\n {/* leading color dot for single-row chips (month cells, all-day bars);\n time-grid blocks read their color from the tinted surface instead -\n in the stacked layout a dot would sit alone on the first line */}\n {!timedBlock && (\n <span\n aria-hidden\n data-slot=\"event-calendar-event-dot\"\n // -me-0.5 tightens just the dot-to-title gap (the chip keeps gap-1.5\n // between the title and the trailing time)\n className=\"-me-0.5 size-1.5 shrink-0 rounded-full bg-(--ec-event-color)\"\n />\n )}\n {occurrence.isRecurring && (\n <RepeatIcon className=\"size-2.5 shrink-0 opacity-70\" aria-hidden=\"true\" />\n )}\n <span className={cn(\"font-medium\", stackedBlock ? EVENT_CALENDAR_FADE_TRUNCATE : \"truncate\")}>\n {event.title}\n </span>\n {/* month cells are narrow: a compact never-shrinking start time keeps\n the title readable; grid views show the full range */}\n {!occurrence.allDay &&\n segment.isStart &&\n (view === \"month\" ? (\n <span className=\"shrink-0 text-muted-foreground\">\n {format(toZoned(occurrence.start, settings.timeZone), settings.i18n.formats.eventTime, {\n locale: settings.locale,\n })}\n </span>\n ) : (\n <span\n className={cn(\n \"@[8rem]:inline hidden text-muted-foreground\",\n stackedBlock ? EVENT_CALENDAR_FADE_TRUNCATE : \"truncate\",\n )}\n >\n {settings.i18n.functions.formatEventTime(\n toZoned(occurrence.start, settings.timeZone),\n toZoned(occurrence.end, settings.timeZone),\n occurrence.allDay,\n { locale: settings.locale },\n )}\n </span>\n ))}\n </>\n );\n\n // Agenda time text is per-day for multi-day events: the first day reads\n // \"From 9:00 AM\", middle days \"All day\", the last day \"Until 5:00 PM\".\n // Boundaries derive from the occurrence vs segment.day (never the packing\n // flags - lane merging rewrites those on shared segment objects).\n const agendaTimeText = (() => {\n if (view !== \"agenda\") return \"\";\n if (occurrence.allDay) return settings.i18n.labels.allDay;\n const dayStart = zonedStartOfDay(segment.day, settings.timeZone);\n const dayEnd = addDays(toZoned(dayStart, settings.timeZone), 1);\n const startsBefore = occurrence.start < dayStart;\n const endsAfter = occurrence.end > dayEnd;\n if (startsBefore && endsAfter) return settings.i18n.labels.allDay;\n if (endsAfter) {\n return settings.i18n.labels.timeFrom(\n format(toZoned(occurrence.start, settings.timeZone), settings.i18n.formats.eventTime, {\n locale: settings.locale,\n }),\n );\n }\n if (startsBefore) {\n return settings.i18n.labels.timeUntil(\n format(toZoned(occurrence.end, settings.timeZone), settings.i18n.formats.eventTime, {\n locale: settings.locale,\n }),\n );\n }\n return settings.i18n.functions.formatEventTime(\n toZoned(occurrence.start, settings.timeZone),\n toZoned(occurrence.end, settings.timeZone),\n false,\n { locale: settings.locale },\n );\n })();\n\n // Agenda default row: time column, color-dot badge, plain title\n const agendaDefaultContent = (\n <>\n <span className=\"w-40 shrink-0 truncate text-muted-foreground tabular-nums\">\n {agendaTimeText}\n </span>\n <span\n aria-hidden\n data-slot=\"event-calendar-agenda-dot\"\n className=\"size-2 shrink-0 rounded-full bg-(--ec-event-color)\"\n />\n <span className=\"truncate text-sm\">{event.title}</span>\n {occurrence.isRecurring && (\n <RepeatIcon className=\"size-2.5 shrink-0 text-muted-foreground\" aria-hidden=\"true\" />\n )}\n </>\n );\n\n // Custom chip content is memoized so a drag - which re-renders the lane on\n // every pointer move - never re-invokes the consumer's renderEvent per frame.\n // The element stays referentially stable across those re-renders, so React\n // skips the custom subtree and it doesn't flicker; on drop only the moved\n // chip's inputs change and recompute. Deps are exactly renderProps' inputs\n // plus the render fns (all stable during an internal drag).\n const customContent = useMemo(() => {\n const renderProps = { occurrence, segment, view, isDragging, isSelected };\n return view === \"agenda\"\n ? viewConfig.renderAgendaEvent?.(renderProps)\n : viewConfig.renderEvent?.(renderProps);\n }, [\n occurrence,\n segment,\n view,\n isDragging,\n isSelected,\n viewConfig.renderAgendaEvent,\n viewConfig.renderEvent,\n ]);\n const content =\n children ?? customContent ?? (view === \"agenda\" ? agendaDefaultContent : defaultContent);\n\n const timeLabel = settings.i18n.functions.formatEventTime(\n toZoned(occurrence.start, settings.timeZone),\n toZoned(occurrence.end, settings.timeZone),\n occurrence.allDay,\n { locale: settings.locale },\n );\n // native hover tooltip text; a consumer formatter returning undefined\n // drops the title attribute entirely (e.g. when it renders its own tooltip)\n const label = settings.i18n.functions.formatEventLabel\n ? settings.i18n.functions.formatEventLabel(event.title, timeLabel)\n : `${event.title}, ${timeLabel}`;\n\n // Optional styled tooltip on hover / keyboard focus (viewConfig.eventTooltip,\n // default off). When on, the native title is dropped so the two never stack;\n // a preview clone never gets one. Content defaults to the label and can be\n // overridden with renderEventTooltip - a falsy result (null/undefined, or\n // the `false`/\"\" that `cond && <node>` yields) falls back to the label, and\n // an empty label (i18n opt-out) leaves no content so the tooltip is skipped.\n const tooltipOpts = typeof viewConfig.eventTooltip === \"object\" ? viewConfig.eventTooltip : null;\n const tooltipContent =\n !preview && viewConfig.eventTooltip\n ? viewConfig.renderEventTooltip?.({\n occurrence,\n segment,\n view,\n label,\n }) || label\n : null;\n const tooltipOn = Boolean(tooltipContent);\n\n const showResize = interactive && resizeOn && !event.readOnly && event.resizable !== false;\n // Hover grip pill (mirrors the gantt bars): a tiny bar inside each resize\n // handle signals the direction. Shown on every resizable chip - compact\n // sub-compactEventMinutes timed blocks included - because the chip\n // min-height (1.5rem) leaves room at the very top/bottom edges without\n // colliding with the vertically-centered title.\n const grip = (\n <span\n aria-hidden\n data-slot=\"event-calendar-resize-grip\"\n className={cn(\n \"rounded-full bg-foreground/40\",\n timedBlock ? \"h-0.5 w-2.5\" : \"h-2.5 w-0.5\",\n viewConfig.classNames?.resizeGrip,\n )}\n />\n );\n const resizeHandles = showResize && (\n <>\n {timedBlock && segment.isStart && (\n <span\n data-slot=\"event-calendar-resize-handle\"\n data-edge=\"start\"\n className={cn(\n \"absolute inset-x-1 top-0 flex h-1.5 cursor-ns-resize items-center justify-center opacity-0 transition-opacity duration-150 group-hover/ec-event:opacity-100\",\n viewConfig.classNames?.resizeHandle,\n )}\n onPointerDown={(e) => gestures.beginResize(e, segment, \"start\")}\n >\n {grip}\n </span>\n )}\n {timedBlock && segment.isEnd && (\n <span\n data-slot=\"event-calendar-resize-handle\"\n data-edge=\"end\"\n className={cn(\n \"absolute inset-x-1 bottom-0 flex h-1.5 cursor-ns-resize items-center justify-center opacity-0 transition-opacity duration-150 group-hover/ec-event:opacity-100\",\n viewConfig.classNames?.resizeHandle,\n )}\n onPointerDown={(e) => gestures.beginResize(e, segment, \"end\")}\n >\n {grip}\n </span>\n )}\n {(horizontalBar || (isBar && inTimeGrid)) && segment.isStart && (\n <span\n data-slot=\"event-calendar-resize-handle\"\n data-edge=\"start\"\n className={cn(\n \"absolute inset-y-0 start-0 flex w-2 cursor-ew-resize items-center justify-center opacity-0 transition-opacity duration-150 group-hover/ec-event:opacity-100\",\n viewConfig.classNames?.resizeHandle,\n )}\n onPointerDown={(e) => gestures.beginResize(e, segment, \"start\")}\n >\n {grip}\n </span>\n )}\n {(horizontalBar || (isBar && inTimeGrid)) && segment.isEnd && (\n <span\n data-slot=\"event-calendar-resize-handle\"\n data-edge=\"end\"\n className={cn(\n \"absolute inset-y-0 end-0 flex w-2 cursor-ew-resize items-center justify-center opacity-0 transition-opacity duration-150 group-hover/ec-event:opacity-100\",\n viewConfig.classNames?.resizeHandle,\n )}\n onPointerDown={(e) => gestures.beginResize(e, segment, \"end\")}\n >\n {grip}\n </span>\n )}\n </>\n );\n\n const defaultProps = {\n type: \"button\" as const,\n \"data-slot\": \"event-calendar-event\",\n \"data-view\": view,\n \"data-all-day\": occurrence.allDay || undefined,\n \"data-recurring\": occurrence.isRecurring || undefined,\n \"data-selected\": isSelected || undefined,\n \"data-dragging\": isDragging || undefined,\n \"data-preview\": preview || undefined,\n \"data-past\": occurrence.end.getTime() < Date.now() || undefined,\n // native hover reveal for squeezed/faded chips: full title + time (dropped\n // when the styled eventTooltip is on so the two never stack)\n title: preview || tooltipOn ? undefined : label,\n \"aria-label\":\n settings.i18n.functions.formatEventAriaLabel?.(\n event.title,\n timeLabel,\n segment.continuesBefore || segment.continuesAfter,\n ) ??\n `${event.title}, ${timeLabel}${\n segment.continuesBefore || segment.continuesAfter\n ? `, ${settings.i18n.labels.continues}`\n : \"\"\n }`,\n // Selection is otherwise conveyed by a background tint alone; the chip is a\n // real toggle in every interactive view, so a screen reader hears the state\n // (agenda rows never select, previews are inert - both stay unpressed).\n \"aria-pressed\": interactive ? isSelected : undefined,\n \"aria-hidden\": preview || undefined,\n tabIndex: preview ? -1 : undefined,\n style: {\n \"--ec-event-color\": event.color ?? \"var(--color-primary)\",\n } as CSSProperties,\n onPointerDown: (e: React.PointerEvent) => {\n e.stopPropagation();\n // suppress the trailing slot-create click if this press does not turn\n // into a drag (e.g. a locked chip) - see markChipPress\n markChipPress();\n if (interactive) gestures.beginMove(e, segment);\n },\n onClick: (e: React.MouseEvent) => {\n e.stopPropagation();\n if (wasRecentDrag()) return;\n // consumer first: e.preventDefault() opts out of built-in selection\n // (e.g. click = open dialog only, no selected tint)\n settings.onEventClick?.(occurrence, e);\n // the agenda is a read-only list: a click never selects/focuses a row\n if (e.defaultPrevented || view === \"agenda\") return;\n instance.api.selectEvent(occurrence.key);\n },\n onDoubleClick: (e: React.MouseEvent) => {\n e.stopPropagation();\n settings.onEventDoubleClick?.(occurrence, e);\n },\n className: cn(\n \"group/ec-event relative flex w-full min-w-0 cursor-pointer touch-none select-none items-center overflow-hidden text-start text-foreground\",\n \"outline-none focus-visible:ring-2 focus-visible:ring-ring/50\",\n preview && \"pointer-events-none\",\n view === \"agenda\"\n ? // plain list row: color lives in the dot badge, not a tinted pill;\n // hover AND selection surfaces are owned by the agenda row wrapper\n \"gap-3 rounded-md text-sm\"\n : cn(\n // @container removes intrinsic sizing; only grid chips are containers\n // py-1: room above/below inline badges (attendee pill etc.)\n \"@container gap-1.5 rounded-sm px-1.5 py-1 leading-normal\",\n // soft tint + hairline inset ring: color reads from the surface\n // itself (no accent border), stays legible in light and dark\n \"bg-(--ec-event-color)/15 hover:bg-(--ec-event-color)/25\",\n // a flat tint reads darker over a dark surface, so lift it a little\n // in dark mode to keep a lighter, softer chip tone\n \"dark:bg-(--ec-event-color)/20 dark:hover:bg-(--ec-event-color)/30\",\n \"inset-ring inset-ring-(--ec-event-color)/15\",\n \"transition-[background-color,box-shadow] duration-150\",\n \"data-dragging:opacity-40\",\n \"data-selected:inset-ring-(--ec-event-color)/40 data-selected:bg-(--ec-event-color)/30\",\n segment.continuesBefore && \"rounded-s-none\",\n segment.continuesAfter && \"rounded-e-none\",\n ),\n viewConfig.classNames?.event,\n className,\n ),\n children: (\n <>\n {content}\n {resizeHandles}\n </>\n ),\n };\n\n const chip = useRender({\n defaultTagName: \"button\",\n render,\n props: mergeProps<\"button\">(defaultProps, props),\n });\n\n return (\n <EventCalendarChipContext.Provider value={{ occurrence, segment, isDragging, isSelected }}>\n {tooltipOn ? (\n <TooltipProvider delay={tooltipOpts?.delay ?? 600}>\n <Tooltip>\n <TooltipTrigger render={chip} />\n <TooltipContent\n side={tooltipOpts?.side ?? \"top\"}\n className={viewConfig.classNames?.eventTooltip}\n >\n {tooltipContent}\n </TooltipContent>\n </Tooltip>\n </TooltipProvider>\n ) : (\n chip\n )}\n </EventCalendarChipContext.Provider>\n );\n}\n\nexport type { EventCalendarChipContextValue, EventCalendar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,SAAS,UAAU;GAC7C,SAAS,IAAI,YAAY,WAAW,GAAG;EACzC;EACA,gBAAgB,MAAwB;GACtC,EAAE,gBAAgB;GAClB,SAAS,qBAAqB,YAAY,CAAC;EAC7C;EACA,WAAW,GACT,6IACA,gEACA,WAAW,uBACX,SAAS,WAGL,6BACA,GAGE,4DAGA,2DAGA,qEACA,+CACA,yDACA,4BACA,yFACA,QAAQ,mBAAmB,kBAC3B,QAAQ,kBAAkB,gBAC5B,GACJ,WAAW,YAAY,OACvB,SACF;EACA,UACE,qBAAA,YAAA,EAAA,UAAA,CACG,SACA,aACD,EAAA,CAAA;CAEN;CAEA,MAAM,OAAO,UAAU;EACrB,gBAAgB;EAChB;EACA,OAAO,WAAqB,cAAc,KAAK;CACjD,CAAC;CAED,OACE,oBAAC,yBAAyB,UAA1B;EAAmC,OAAO;GAAE;GAAY;GAAS;GAAY;EAAW;EACrF,UAAA,YACC,oBAAC,iBAAD;GAAiB,OAAO,aAAa,SAAS;GAC5C,UAAA,qBAAC,SAAD,EAAA,UAAA,CACE,oBAAC,gBAAD,EAAgB,QAAQ,KAAO,CAAA,GAC/B,oBAAC,gBAAD;IACE,MAAM,aAAa,QAAQ;IAC3B,WAAW,WAAW,YAAY;IAEjC,UAAA;GACa,CAAA,CACT,EAAA,CAAA;EACM,CAAA,IAEjB;CAE+B,CAAA;AAEvC"}
@@ -19,7 +19,8 @@ function getDayKey(date, timeZone) {
19
19
  }
20
20
  /** Day length in minutes; 1380/1500 on DST transition days - never assume 1440. */
21
21
  function getDayTotalMinutes(dayStart, timeZone) {
22
- return differenceInMinutes(zonedStartOfDay(addDays(toZoned(dayStart, timeZone), 1), timeZone), dayStart);
22
+ const next = zonedStartOfDay(addDays(toZoned(dayStart, timeZone), 1), timeZone);
23
+ return differenceInMinutes(next, dayStart);
23
24
  }
24
25
  function snapMinutes(minutes, snap) {
25
26
  return Math.round(minutes / snap) * snap;
@@ -236,7 +237,7 @@ function packTimedSegments(segments) {
236
237
  */
237
238
  function packWeekRowLanes(segments, rowIndex, rowStart, timeZone) {
238
239
  const bars = segments.map((seg) => {
239
- const dayIndex = Math.round((zonedStartOfDay(seg.day, timeZone).getTime() - zonedStartOfDay(rowStart, timeZone).getTime()) / (1440 * 60 * 1e3));
240
+ const dayIndex = Math.round((zonedStartOfDay(seg.day, timeZone).getTime() - zonedStartOfDay(rowStart, timeZone).getTime()) / 864e5);
240
241
  return {
241
242
  seg,
242
243
  colStart: Math.max(0, Math.min(6, dayIndex)),