@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
@@ -130,60 +130,61 @@ function GanttBar({ segment, className, render, children, labelOutside, rowTitle
130
130
  className: "h-2.5 w-0.5 rounded-full bg-foreground/40"
131
131
  })
132
132
  })] });
133
+ const defaultProps = {
134
+ type: "button",
135
+ "data-slot": "gantt-bar",
136
+ "data-all-day": occurrence.allDay || void 0,
137
+ "data-recurring": occurrence.isRecurring || void 0,
138
+ "data-selected": isSelected || void 0,
139
+ "data-dragging": isDragging || void 0,
140
+ "data-drag-kind": dragKind ?? void 0,
141
+ "data-past": occurrence.end.getTime() < Date.now() || void 0,
142
+ "data-label-outside": labelOutside || void 0,
143
+ "data-progress": progress ?? void 0,
144
+ "data-completed": progress === 100 || void 0,
145
+ "aria-label": settings.i18n.functions.formatEventAriaLabel({
146
+ title: event.title,
147
+ timeLabel,
148
+ rowTitle,
149
+ progressLabel: progress !== null ? settings.i18n.labels.progress(progress) : void 0,
150
+ continues: segment.continuesBefore || segment.continuesAfter
151
+ }),
152
+ style: { "--gantt-event-color": event.color ?? "var(--color-primary)" },
153
+ onPointerDown: (e) => {
154
+ e.stopPropagation();
155
+ gestures.beginMove(e, segment);
156
+ },
157
+ onClick: (e) => {
158
+ e.stopPropagation();
159
+ if (wasRecentDrag()) return;
160
+ instance.api.selectEvent(occurrence.key);
161
+ settings.onEventClick?.(occurrence, e);
162
+ },
163
+ onDoubleClick: (e) => {
164
+ e.stopPropagation();
165
+ settings.onEventDoubleClick?.(occurrence, e);
166
+ },
167
+ className: cn("group/gantt-bar-group @container relative flex w-full min-w-0 cursor-pointer touch-none select-none items-center gap-1.5 overflow-hidden rounded-sm px-1.5 py-0.5 text-start text-foreground leading-normal", "outline-none focus-visible:ring-2 focus-visible:ring-ring/50", "bg-(--gantt-event-color)/20 hover:bg-(--gantt-event-color)/30", "data-[drag-kind=move]:opacity-0", "data-[drag-kind=resize-end]:opacity-40 data-[drag-kind=resize-start]:opacity-40", "data-selected:bg-(--gantt-event-color)/30", segment.continuesBefore && "rounded-s-none", segment.continuesAfter && "rounded-e-none", viewConfig.classNames?.event, className),
168
+ children: /* @__PURE__ */ jsxs(Fragment$1, { children: [
169
+ progress !== null && /* @__PURE__ */ jsx("span", {
170
+ "aria-hidden": true,
171
+ "data-slot": "gantt-bar-progress",
172
+ className: "pointer-events-none absolute inset-y-0 start-0 border-(--gantt-event-color)/65 border-e bg-(--gantt-event-color)/40 data-full:border-e-0",
173
+ "data-full": progress === 100 || void 0,
174
+ style: { width: `${progress}%` }
175
+ }),
176
+ progress === 100 && !consumerOwnsContent && /* @__PURE__ */ jsx(CheckIcon, {
177
+ className: "relative size-2.5 shrink-0 opacity-80",
178
+ "aria-hidden": "true"
179
+ }),
180
+ content,
181
+ resizeHandles
182
+ ] })
183
+ };
133
184
  const barButton = useRender({
134
185
  defaultTagName: "button",
135
186
  render,
136
- props: mergeProps({
137
- type: "button",
138
- "data-slot": "gantt-bar",
139
- "data-all-day": occurrence.allDay || void 0,
140
- "data-recurring": occurrence.isRecurring || void 0,
141
- "data-selected": isSelected || void 0,
142
- "data-dragging": isDragging || void 0,
143
- "data-drag-kind": dragKind ?? void 0,
144
- "data-past": occurrence.end.getTime() < Date.now() || void 0,
145
- "data-label-outside": labelOutside || void 0,
146
- "data-progress": progress ?? void 0,
147
- "data-completed": progress === 100 || void 0,
148
- "aria-label": settings.i18n.functions.formatEventAriaLabel({
149
- title: event.title,
150
- timeLabel,
151
- rowTitle,
152
- progressLabel: progress !== null ? settings.i18n.labels.progress(progress) : void 0,
153
- continues: segment.continuesBefore || segment.continuesAfter
154
- }),
155
- style: { "--gantt-event-color": event.color ?? "var(--color-primary)" },
156
- onPointerDown: (e) => {
157
- e.stopPropagation();
158
- gestures.beginMove(e, segment);
159
- },
160
- onClick: (e) => {
161
- e.stopPropagation();
162
- if (wasRecentDrag()) return;
163
- instance.api.selectEvent(occurrence.key);
164
- settings.onEventClick?.(occurrence, e);
165
- },
166
- onDoubleClick: (e) => {
167
- e.stopPropagation();
168
- settings.onEventDoubleClick?.(occurrence, e);
169
- },
170
- className: cn("group/gantt-bar-group @container relative flex w-full min-w-0 cursor-pointer touch-none select-none items-center gap-1.5 overflow-hidden rounded-sm px-1.5 py-0.5 text-start text-foreground leading-normal", "outline-none focus-visible:ring-2 focus-visible:ring-ring/50", "bg-(--gantt-event-color)/20 hover:bg-(--gantt-event-color)/30", "data-[drag-kind=move]:opacity-0", "data-[drag-kind=resize-end]:opacity-40 data-[drag-kind=resize-start]:opacity-40", "data-selected:bg-(--gantt-event-color)/30", segment.continuesBefore && "rounded-s-none", segment.continuesAfter && "rounded-e-none", viewConfig.classNames?.event, className),
171
- children: /* @__PURE__ */ jsxs(Fragment$1, { children: [
172
- progress !== null && /* @__PURE__ */ jsx("span", {
173
- "aria-hidden": true,
174
- "data-slot": "gantt-bar-progress",
175
- className: "pointer-events-none absolute inset-y-0 start-0 border-(--gantt-event-color)/65 border-e bg-(--gantt-event-color)/40 data-full:border-e-0",
176
- "data-full": progress === 100 || void 0,
177
- style: { width: `${progress}%` }
178
- }),
179
- progress === 100 && !consumerOwnsContent && /* @__PURE__ */ jsx(CheckIcon, {
180
- className: "relative size-2.5 shrink-0 opacity-80",
181
- "aria-hidden": "true"
182
- }),
183
- content,
184
- resizeHandles
185
- ] })
186
- }, props)
187
+ props: mergeProps(defaultProps, props)
187
188
  });
188
189
  const menu = viewConfig.renderEventMenu?.(renderProps);
189
190
  const barTree = /* @__PURE__ */ jsx(TooltipProvider, {
@@ -1 +1 @@
1
- {"version":3,"file":"gantt-bar.js","names":[],"sources":["../../../../src/components/reui/gantt/gantt-bar.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n type CSSProperties,\n createContext,\n type ReactNode,\n useContext,\n useMemo,\n useState,\n} from \"react\";\nimport { mergeProps } from \"@base-ui/react/merge-props\";\nimport { useRender } from \"@base-ui/react/use-render\";\nimport { CheckIcon, RepeatIcon } from \"lucide-react\";\n\nimport { cn } from \"@kumix/utils\";\nimport { ContextMenu, ContextMenuContent, ContextMenuTrigger } from \"../../ui/context-menu\";\nimport { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from \"../../ui/tooltip\";\nimport { useGantt, useGanttSelector, useGanttViewConfig } from \"./gantt\";\nimport { useGanttGestures, wasRecentDrag } from \"./gantt-dnd\";\nimport { flattenResources, toZoned } from \"./gantt-lib\";\nimport type { GanttOccurrence, GanttSegment } from \"./gantt-types\";\n\n/**\n * Effective Tailwind palette presets for bar colors; every entry works on\n * light and dark surfaces through the bar's alpha background + accent border.\n */\nconst GANTT_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\ninterface GanttBarContextValue<TData = unknown> {\n occurrence: GanttOccurrence<TData>;\n segment: GanttSegment<TData>;\n isDragging: boolean;\n isSelected: boolean;\n}\n\nconst GanttBarContext =\n // biome-ignore lint/suspicious/noExplicitAny: <>\n createContext<GanttBarContextValue<any> | null>(null);\n\n/** The bar's subject; usable inside renderEvent content and bar children. */\nfunction useGanttBarContext<TData = unknown>(): GanttBarContextValue<TData> {\n const ctx = useContext(GanttBarContext);\n if (!ctx) {\n throw new Error(\"useGanttBarContext must be used within <GanttBar>\");\n }\n return ctx as GanttBarContextValue<TData>;\n}\n\ninterface GanttBarProps<TData = unknown>\n extends Omit<useRender.ComponentProps<\"button\">, \"children\"> {\n segment: GanttSegment<TData>;\n /** Replaces the default bar CONTENT; the wrapper stays gantt-owned. */\n children?: ReactNode;\n /**\n * The title renders beside the bar (view-owned), so the default inner\n * content is suppressed. Explicit children and renderEvent still win.\n */\n labelOutside?: boolean;\n /**\n * The owning row's title for the aria-label. Pass it when the row is in\n * scope (the internal view does); omitting falls back to a tree lookup.\n */\n rowTitle?: string;\n}\n\n/**\n * The one interactive bar element. The wrapper owns positioning hooks, a11y,\n * selection, drag/resize listeners, and data attributes; content comes from\n * children, the root renderEvent override, or the built-in default.\n */\nfunction GanttBar<TData = unknown>({\n segment,\n className,\n render,\n children,\n labelOutside,\n rowTitle: rowTitleProp,\n ...props\n}: GanttBarProps<TData>) {\n const instance = useGantt<TData>();\n const viewConfig = useGanttViewConfig<TData>();\n const gestures = useGanttGestures<TData>();\n const { settings } = instance;\n const occurrence = segment.occurrence;\n const event = occurrence.event;\n\n const isSelected = useGanttSelector<TData, boolean>(\n (state) => state.selection.eventKeys.includes(occurrence.key),\n { calendar: instance },\n );\n const isDragging = useGanttSelector<TData, boolean>(\n (state) => state.drag?.occurrence.key === occurrence.key,\n { calendar: instance },\n );\n // Which gesture owns this bar: a move hides the original (the smooth clone\n // stands in for it); a resize keeps it as a faint placeholder behind the\n // dashed preview so you can see the original extent.\n const dragKind = useGanttSelector<TData, string | null>(\n (state) => (state.drag?.occurrence.key === occurrence.key ? state.drag.kind : null),\n { calendar: instance },\n );\n // Hover-only range tooltip. Focus opens are ignored (the known button+\n // tooltip flash: clicking a bar opens a dialog, focus returns, and a\n // focus-triggered tooltip would pop). Hidden while dragging/resizing.\n const [tipOpen, setTipOpen] = useState(false);\n // Gated on tipOpen: with the tooltip closed the selector returns a stable\n // false, so gesture start/end doesn't re-render every mounted bar.\n const anyInteracting = useGanttSelector<TData, boolean>(\n (state) => tipOpen && (state.drag !== null || state.slotDraft !== null),\n { calendar: instance },\n );\n\n const progress =\n typeof event.progress === \"number\"\n ? Math.min(Math.max(Math.round(event.progress), 0), 100)\n : null;\n\n const defaultContent = (\n <>\n {occurrence.isRecurring && (\n <RepeatIcon className=\"size-2.5 shrink-0 opacity-70\" aria-hidden=\"true\" />\n )}\n <span className=\"truncate font-medium\">{event.title}</span>\n {!occurrence.allDay && segment.isStart && (\n <span className=\"@[8rem]:inline hidden truncate text-muted-foreground\">\n {settings.i18n.functions.formatEventTime(\n toZoned(occurrence.start, settings.timeZone),\n toZoned(occurrence.end, settings.timeZone),\n occurrence.allDay,\n settings.locale,\n )}\n </span>\n )}\n </>\n );\n\n const renderProps = { occurrence, segment, isDragging, isSelected };\n const content =\n children ?? viewConfig.renderEvent?.(renderProps) ?? (labelOutside ? null : defaultContent);\n // Consumer-owned content owns the WHOLE inner visualization: the built-in\n // progress fill and done mark yield so custom bars start from a blank\n // canvas (progress stays readable via data-progress/data-completed).\n const consumerOwnsContent = children !== undefined || !!viewConfig.renderEvent;\n\n const timeLabel = settings.i18n.functions.formatEventTime(\n toZoned(occurrence.start, settings.timeZone),\n toZoned(occurrence.end, settings.timeZone),\n occurrence.allDay,\n settings.locale,\n );\n // name the row too: the split-pane layout carries no grid semantics.\n // The prop path is O(1); the lookup fallback is memoized so external\n // GanttBar usage never flattens the tree per render.\n const fallbackRowTitle = useMemo(\n () =>\n rowTitleProp === undefined && event.resourceId\n ? flattenResources(settings.resources).find(\n ({ resource }) => resource.id === event.resourceId,\n )?.resource.title\n : undefined,\n [rowTitleProp, event.resourceId, settings.resources],\n );\n const rowTitle = rowTitleProp ?? fallbackRowTitle;\n\n const showResize = gestures.canResize(segment);\n const resizeHandles = showResize && (\n <>\n {segment.isStart && (\n <span\n data-slot=\"gantt-resize-handle\"\n data-edge=\"start\"\n // grip hugs the start edge (justify-start + tight inset) so the\n // indicator reads as \"resize this end\", not a centered pill.\n // pointer-coarse keeps it visible on touch, where hover never fires\n className=\"absolute inset-y-0 start-0.5 flex w-2 cursor-ew-resize items-center justify-start opacity-0 pointer-coarse:opacity-100 group-hover/gantt-bar-group:opacity-100\"\n onPointerDown={(e) => gestures.beginResize(e, segment, \"start\")}\n >\n <span aria-hidden className=\"h-2.5 w-0.5 rounded-full bg-foreground/40\" />\n </span>\n )}\n {segment.isEnd && (\n <span\n data-slot=\"gantt-resize-handle\"\n data-edge=\"end\"\n // grip hugs the end edge (justify-end + tight inset) so the\n // indicator reads as \"resize this end\", not a centered pill.\n // pointer-coarse keeps it visible on touch, where hover never fires\n className=\"absolute inset-y-0 end-0.5 flex w-2 cursor-ew-resize items-center justify-end opacity-0 pointer-coarse:opacity-100 group-hover/gantt-bar-group:opacity-100\"\n onPointerDown={(e) => gestures.beginResize(e, segment, \"end\")}\n >\n <span aria-hidden className=\"h-2.5 w-0.5 rounded-full bg-foreground/40\" />\n </span>\n )}\n </>\n );\n\n const defaultProps = {\n type: \"button\" as const,\n \"data-slot\": \"gantt-bar\",\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-drag-kind\": dragKind ?? undefined,\n \"data-past\": occurrence.end.getTime() < Date.now() || undefined,\n \"data-label-outside\": labelOutside || undefined,\n \"data-progress\": progress ?? undefined,\n \"data-completed\": progress === 100 || undefined,\n \"aria-label\": settings.i18n.functions.formatEventAriaLabel({\n title: event.title,\n timeLabel,\n rowTitle,\n progressLabel: progress !== null ? settings.i18n.labels.progress(progress) : undefined,\n continues: segment.continuesBefore || segment.continuesAfter,\n }),\n style: {\n \"--gantt-event-color\": event.color ?? \"var(--color-primary)\",\n } as CSSProperties,\n onPointerDown: (e: React.PointerEvent) => {\n e.stopPropagation();\n gestures.beginMove(e, segment);\n },\n onClick: (e: React.MouseEvent) => {\n e.stopPropagation();\n if (wasRecentDrag()) return;\n instance.api.selectEvent(occurrence.key);\n settings.onEventClick?.(occurrence, e);\n },\n onDoubleClick: (e: React.MouseEvent) => {\n e.stopPropagation();\n settings.onEventDoubleClick?.(occurrence, e);\n },\n className: cn(\n \"group/gantt-bar-group @container relative flex w-full min-w-0 cursor-pointer touch-none select-none items-center gap-1.5 overflow-hidden rounded-sm px-1.5 py-0.5 text-start text-foreground leading-normal\",\n \"outline-none focus-visible:ring-2 focus-visible:ring-ring/50\",\n // the unfilled remainder has to be legible on its own - at /12 a bar\n // with a progress fill read as a floating segment with no basement\n \"bg-(--gantt-event-color)/20 hover:bg-(--gantt-event-color)/30\",\n // move: hide the original (the smooth cursor clone represents it)\n \"data-[drag-kind=move]:opacity-0\",\n // resize: keep the original event exactly, just fade it to a soft\n // placeholder behind the dashed preview - no dramatic restyle\n \"data-[drag-kind=resize-end]:opacity-40 data-[drag-kind=resize-start]:opacity-40\",\n \"data-selected:bg-(--gantt-event-color)/30\",\n segment.continuesBefore && \"rounded-s-none\",\n segment.continuesAfter && \"rounded-e-none\",\n viewConfig.classNames?.event,\n className,\n ),\n children: (\n <>\n {progress !== null && (\n // Chrome, not content: it is an absolutely-positioned layer BEHIND\n // whatever the bar renders, so a consumer bar (renderEvent) keeps\n // its completion fill instead of silently losing it. The inline\n // done-mark below stays gated, because that one really is content.\n <span\n aria-hidden\n data-slot=\"gantt-bar-progress\"\n className=\"pointer-events-none absolute inset-y-0 start-0 border-(--gantt-event-color)/65 border-e bg-(--gantt-event-color)/40 data-full:border-e-0\"\n data-full={progress === 100 || undefined}\n style={{ width: `${progress}%` }}\n />\n )}\n {progress === 100 && !consumerOwnsContent && (\n // done mark: completion chrome like the fill itself, so it shows\n // for outside-label bars too (where the inner content is empty)\n <CheckIcon className=\"relative size-2.5 shrink-0 opacity-80\" aria-hidden=\"true\" />\n )}\n {content}\n {resizeHandles}\n </>\n ),\n };\n\n const barButton = useRender({\n defaultTagName: \"button\",\n render,\n props: mergeProps<\"button\">(defaultProps, props),\n });\n\n // Consumer-owned right-click menu (headless): the primitive only wires the\n // ContextMenu; the items and their handlers come entirely from the block.\n const menu = viewConfig.renderEventMenu?.(renderProps);\n\n // The bar is simultaneously the tooltip trigger and (when a menu exists)\n // the context-menu trigger; Base UI composes both via render props.\n const trigger = menu ? (\n <ContextMenuTrigger render={<TooltipTrigger render={barButton} />} />\n ) : (\n <TooltipTrigger render={barButton} />\n );\n\n const barTree = (\n <TooltipProvider delay={500} closeDelay={0} timeout={300}>\n <Tooltip\n open={tipOpen && !anyInteracting}\n onOpenChange={(next: boolean, details: { reason?: string }) => {\n // opens only on hover; focus/press opens are dropped\n if (next && details?.reason !== \"trigger-hover\") return;\n setTipOpen(next);\n }}\n >\n {trigger}\n {tipOpen && !anyInteracting && (\n <TooltipContent side=\"top\" className=\"pointer-events-none\">\n <div className=\"font-medium\">{event.title}</div>\n <div className=\"opacity-80\">{timeLabel}</div>\n </TooltipContent>\n )}\n </Tooltip>\n </TooltipProvider>\n );\n\n return (\n <GanttBarContext.Provider value={{ occurrence, segment, isDragging, isSelected }}>\n {menu ? (\n <ContextMenu>\n {barTree}\n <ContextMenuContent data-slot=\"gantt-bar-menu\" className=\"min-w-44\">\n {menu}\n </ContextMenuContent>\n </ContextMenu>\n ) : (\n barTree\n )}\n </GanttBarContext.Provider>\n );\n}\n\nexport type { GanttBarContextValue, GanttBarProps };\nexport { GANTT_COLORS, GanttBar, useGanttBarContext };\n"],"mappings":";;;;;;;;;;;;;;;;;AA0BA,MAAM,eAAuD;CAC3D;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;EAAQ,OAAO;CAAwB;CAC/C;EAAE,MAAM;EAAU,OAAO;CAA0B;AACrD;AASA,MAAM,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AOmC,GAAG,KAAK;CACjD,CAAC;CAID,MAAM,OAAO,WAAW,kBAAkB,WAAW;CAUrD,MAAM,UACJ,oBAAC,iBAAD;EAAiB,OAAO;EAAK,YAAY;EAAG,SAAS;EACnD,UAAA,qBAAC,SAAD;GACE,MAAM,WAAW,CAAC;GAClB,eAAe,MAAe,YAAiC;IAE7D,IAAI,QAAQ,SAAS,WAAW,iBAAiB;IACjD,WAAW,IAAI;GACjB;GANF,UAAA,CARY,OACd,oBAAC,oBAAD,EAAoB,QAAQ,oBAAC,gBAAD,EAAgB,QAAQ,UAAY,CAAA,EAAI,CAAA,IAEpE,oBAAC,gBAAD,EAAgB,QAAQ,UAAY,CAAA,GAc/B,WAAW,CAAC,kBACX,qBAAC,gBAAD;IAAgB,MAAK;IAAM,WAAU;IAArC,UAAA,CACE,oBAAC,OAAD;KAAK,WAAU;KAAe,UAAA,MAAM;IAAW,CAAA,GAC/C,oBAAC,OAAD;KAAK,WAAU;KAAc,UAAA;IAAe,CAAA,CAC9B;GAEX,CAAA,CAAA;;CACM,CAAA;CAGnB,OACE,oBAAC,gBAAgB,UAAjB;EAA0B,OAAO;GAAE;GAAY;GAAS;GAAY;EAAW;EAC5E,UAAA,OACC,qBAAC,aAAD,EAAA,UAAA,CACG,SACD,oBAAC,oBAAD;GAAoB,aAAU;GAAiB,WAAU;GACtD,UAAA;EACiB,CAAA,CACT,EAAA,CAAA,IAEb;CAEsB,CAAA;AAE9B"}
1
+ {"version":3,"file":"gantt-bar.js","names":[],"sources":["../../../../src/components/reui/gantt/gantt-bar.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n type CSSProperties,\n createContext,\n type ReactNode,\n useContext,\n useMemo,\n useState,\n} from \"react\";\nimport { mergeProps } from \"@base-ui/react/merge-props\";\nimport { useRender } from \"@base-ui/react/use-render\";\nimport { CheckIcon, RepeatIcon } from \"lucide-react\";\n\nimport { cn } from \"@kumix/utils\";\nimport { ContextMenu, ContextMenuContent, ContextMenuTrigger } from \"../../ui/context-menu\";\nimport { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from \"../../ui/tooltip\";\nimport { useGantt, useGanttSelector, useGanttViewConfig } from \"./gantt\";\nimport { useGanttGestures, wasRecentDrag } from \"./gantt-dnd\";\nimport { flattenResources, toZoned } from \"./gantt-lib\";\nimport type { GanttOccurrence, GanttSegment } from \"./gantt-types\";\n\n/**\n * Effective Tailwind palette presets for bar colors; every entry works on\n * light and dark surfaces through the bar's alpha background + accent border.\n */\nconst GANTT_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\ninterface GanttBarContextValue<TData = unknown> {\n occurrence: GanttOccurrence<TData>;\n segment: GanttSegment<TData>;\n isDragging: boolean;\n isSelected: boolean;\n}\n\nconst GanttBarContext =\n // biome-ignore lint/suspicious/noExplicitAny: <>\n createContext<GanttBarContextValue<any> | null>(null);\n\n/** The bar's subject; usable inside renderEvent content and bar children. */\nfunction useGanttBarContext<TData = unknown>(): GanttBarContextValue<TData> {\n const ctx = useContext(GanttBarContext);\n if (!ctx) {\n throw new Error(\"useGanttBarContext must be used within <GanttBar>\");\n }\n return ctx as GanttBarContextValue<TData>;\n}\n\ninterface GanttBarProps<TData = unknown>\n extends Omit<useRender.ComponentProps<\"button\">, \"children\"> {\n segment: GanttSegment<TData>;\n /** Replaces the default bar CONTENT; the wrapper stays gantt-owned. */\n children?: ReactNode;\n /**\n * The title renders beside the bar (view-owned), so the default inner\n * content is suppressed. Explicit children and renderEvent still win.\n */\n labelOutside?: boolean;\n /**\n * The owning row's title for the aria-label. Pass it when the row is in\n * scope (the internal view does); omitting falls back to a tree lookup.\n */\n rowTitle?: string;\n}\n\n/**\n * The one interactive bar element. The wrapper owns positioning hooks, a11y,\n * selection, drag/resize listeners, and data attributes; content comes from\n * children, the root renderEvent override, or the built-in default.\n */\nfunction GanttBar<TData = unknown>({\n segment,\n className,\n render,\n children,\n labelOutside,\n rowTitle: rowTitleProp,\n ...props\n}: GanttBarProps<TData>) {\n const instance = useGantt<TData>();\n const viewConfig = useGanttViewConfig<TData>();\n const gestures = useGanttGestures<TData>();\n const { settings } = instance;\n const occurrence = segment.occurrence;\n const event = occurrence.event;\n\n const isSelected = useGanttSelector<TData, boolean>(\n (state) => state.selection.eventKeys.includes(occurrence.key),\n { calendar: instance },\n );\n const isDragging = useGanttSelector<TData, boolean>(\n (state) => state.drag?.occurrence.key === occurrence.key,\n { calendar: instance },\n );\n // Which gesture owns this bar: a move hides the original (the smooth clone\n // stands in for it); a resize keeps it as a faint placeholder behind the\n // dashed preview so you can see the original extent.\n const dragKind = useGanttSelector<TData, string | null>(\n (state) => (state.drag?.occurrence.key === occurrence.key ? state.drag.kind : null),\n { calendar: instance },\n );\n // Hover-only range tooltip. Focus opens are ignored (the known button+\n // tooltip flash: clicking a bar opens a dialog, focus returns, and a\n // focus-triggered tooltip would pop). Hidden while dragging/resizing.\n const [tipOpen, setTipOpen] = useState(false);\n // Gated on tipOpen: with the tooltip closed the selector returns a stable\n // false, so gesture start/end doesn't re-render every mounted bar.\n const anyInteracting = useGanttSelector<TData, boolean>(\n (state) => tipOpen && (state.drag !== null || state.slotDraft !== null),\n { calendar: instance },\n );\n\n const progress =\n typeof event.progress === \"number\"\n ? Math.min(Math.max(Math.round(event.progress), 0), 100)\n : null;\n\n const defaultContent = (\n <>\n {occurrence.isRecurring && (\n <RepeatIcon className=\"size-2.5 shrink-0 opacity-70\" aria-hidden=\"true\" />\n )}\n <span className=\"truncate font-medium\">{event.title}</span>\n {!occurrence.allDay && segment.isStart && (\n <span className=\"@[8rem]:inline hidden truncate text-muted-foreground\">\n {settings.i18n.functions.formatEventTime(\n toZoned(occurrence.start, settings.timeZone),\n toZoned(occurrence.end, settings.timeZone),\n occurrence.allDay,\n settings.locale,\n )}\n </span>\n )}\n </>\n );\n\n const renderProps = { occurrence, segment, isDragging, isSelected };\n const content =\n children ?? viewConfig.renderEvent?.(renderProps) ?? (labelOutside ? null : defaultContent);\n // Consumer-owned content owns the WHOLE inner visualization: the built-in\n // progress fill and done mark yield so custom bars start from a blank\n // canvas (progress stays readable via data-progress/data-completed).\n const consumerOwnsContent = children !== undefined || !!viewConfig.renderEvent;\n\n const timeLabel = settings.i18n.functions.formatEventTime(\n toZoned(occurrence.start, settings.timeZone),\n toZoned(occurrence.end, settings.timeZone),\n occurrence.allDay,\n settings.locale,\n );\n // name the row too: the split-pane layout carries no grid semantics.\n // The prop path is O(1); the lookup fallback is memoized so external\n // GanttBar usage never flattens the tree per render.\n const fallbackRowTitle = useMemo(\n () =>\n rowTitleProp === undefined && event.resourceId\n ? flattenResources(settings.resources).find(\n ({ resource }) => resource.id === event.resourceId,\n )?.resource.title\n : undefined,\n [rowTitleProp, event.resourceId, settings.resources],\n );\n const rowTitle = rowTitleProp ?? fallbackRowTitle;\n\n const showResize = gestures.canResize(segment);\n const resizeHandles = showResize && (\n <>\n {segment.isStart && (\n <span\n data-slot=\"gantt-resize-handle\"\n data-edge=\"start\"\n // grip hugs the start edge (justify-start + tight inset) so the\n // indicator reads as \"resize this end\", not a centered pill.\n // pointer-coarse keeps it visible on touch, where hover never fires\n className=\"absolute inset-y-0 start-0.5 flex w-2 cursor-ew-resize items-center justify-start opacity-0 pointer-coarse:opacity-100 group-hover/gantt-bar-group:opacity-100\"\n onPointerDown={(e) => gestures.beginResize(e, segment, \"start\")}\n >\n <span aria-hidden className=\"h-2.5 w-0.5 rounded-full bg-foreground/40\" />\n </span>\n )}\n {segment.isEnd && (\n <span\n data-slot=\"gantt-resize-handle\"\n data-edge=\"end\"\n // grip hugs the end edge (justify-end + tight inset) so the\n // indicator reads as \"resize this end\", not a centered pill.\n // pointer-coarse keeps it visible on touch, where hover never fires\n className=\"absolute inset-y-0 end-0.5 flex w-2 cursor-ew-resize items-center justify-end opacity-0 pointer-coarse:opacity-100 group-hover/gantt-bar-group:opacity-100\"\n onPointerDown={(e) => gestures.beginResize(e, segment, \"end\")}\n >\n <span aria-hidden className=\"h-2.5 w-0.5 rounded-full bg-foreground/40\" />\n </span>\n )}\n </>\n );\n\n const defaultProps = {\n type: \"button\" as const,\n \"data-slot\": \"gantt-bar\",\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-drag-kind\": dragKind ?? undefined,\n \"data-past\": occurrence.end.getTime() < Date.now() || undefined,\n \"data-label-outside\": labelOutside || undefined,\n \"data-progress\": progress ?? undefined,\n \"data-completed\": progress === 100 || undefined,\n \"aria-label\": settings.i18n.functions.formatEventAriaLabel({\n title: event.title,\n timeLabel,\n rowTitle,\n progressLabel: progress !== null ? settings.i18n.labels.progress(progress) : undefined,\n continues: segment.continuesBefore || segment.continuesAfter,\n }),\n style: {\n \"--gantt-event-color\": event.color ?? \"var(--color-primary)\",\n } as CSSProperties,\n onPointerDown: (e: React.PointerEvent) => {\n e.stopPropagation();\n gestures.beginMove(e, segment);\n },\n onClick: (e: React.MouseEvent) => {\n e.stopPropagation();\n if (wasRecentDrag()) return;\n instance.api.selectEvent(occurrence.key);\n settings.onEventClick?.(occurrence, e);\n },\n onDoubleClick: (e: React.MouseEvent) => {\n e.stopPropagation();\n settings.onEventDoubleClick?.(occurrence, e);\n },\n className: cn(\n \"group/gantt-bar-group @container relative flex w-full min-w-0 cursor-pointer touch-none select-none items-center gap-1.5 overflow-hidden rounded-sm px-1.5 py-0.5 text-start text-foreground leading-normal\",\n \"outline-none focus-visible:ring-2 focus-visible:ring-ring/50\",\n // the unfilled remainder has to be legible on its own - at /12 a bar\n // with a progress fill read as a floating segment with no basement\n \"bg-(--gantt-event-color)/20 hover:bg-(--gantt-event-color)/30\",\n // move: hide the original (the smooth cursor clone represents it)\n \"data-[drag-kind=move]:opacity-0\",\n // resize: keep the original event exactly, just fade it to a soft\n // placeholder behind the dashed preview - no dramatic restyle\n \"data-[drag-kind=resize-end]:opacity-40 data-[drag-kind=resize-start]:opacity-40\",\n \"data-selected:bg-(--gantt-event-color)/30\",\n segment.continuesBefore && \"rounded-s-none\",\n segment.continuesAfter && \"rounded-e-none\",\n viewConfig.classNames?.event,\n className,\n ),\n children: (\n <>\n {progress !== null && (\n // Chrome, not content: it is an absolutely-positioned layer BEHIND\n // whatever the bar renders, so a consumer bar (renderEvent) keeps\n // its completion fill instead of silently losing it. The inline\n // done-mark below stays gated, because that one really is content.\n <span\n aria-hidden\n data-slot=\"gantt-bar-progress\"\n className=\"pointer-events-none absolute inset-y-0 start-0 border-(--gantt-event-color)/65 border-e bg-(--gantt-event-color)/40 data-full:border-e-0\"\n data-full={progress === 100 || undefined}\n style={{ width: `${progress}%` }}\n />\n )}\n {progress === 100 && !consumerOwnsContent && (\n // done mark: completion chrome like the fill itself, so it shows\n // for outside-label bars too (where the inner content is empty)\n <CheckIcon className=\"relative size-2.5 shrink-0 opacity-80\" aria-hidden=\"true\" />\n )}\n {content}\n {resizeHandles}\n </>\n ),\n };\n\n const barButton = useRender({\n defaultTagName: \"button\",\n render,\n props: mergeProps<\"button\">(defaultProps, props),\n });\n\n // Consumer-owned right-click menu (headless): the primitive only wires the\n // ContextMenu; the items and their handlers come entirely from the block.\n const menu = viewConfig.renderEventMenu?.(renderProps);\n\n // The bar is simultaneously the tooltip trigger and (when a menu exists)\n // the context-menu trigger; Base UI composes both via render props.\n const trigger = menu ? (\n <ContextMenuTrigger render={<TooltipTrigger render={barButton} />} />\n ) : (\n <TooltipTrigger render={barButton} />\n );\n\n const barTree = (\n <TooltipProvider delay={500} closeDelay={0} timeout={300}>\n <Tooltip\n open={tipOpen && !anyInteracting}\n onOpenChange={(next: boolean, details: { reason?: string }) => {\n // opens only on hover; focus/press opens are dropped\n if (next && details?.reason !== \"trigger-hover\") return;\n setTipOpen(next);\n }}\n >\n {trigger}\n {tipOpen && !anyInteracting && (\n <TooltipContent side=\"top\" className=\"pointer-events-none\">\n <div className=\"font-medium\">{event.title}</div>\n <div className=\"opacity-80\">{timeLabel}</div>\n </TooltipContent>\n )}\n </Tooltip>\n </TooltipProvider>\n );\n\n return (\n <GanttBarContext.Provider value={{ occurrence, segment, isDragging, isSelected }}>\n {menu ? (\n <ContextMenu>\n {barTree}\n <ContextMenuContent data-slot=\"gantt-bar-menu\" className=\"min-w-44\">\n {menu}\n </ContextMenuContent>\n </ContextMenu>\n ) : (\n barTree\n )}\n </GanttBarContext.Provider>\n );\n}\n\nexport type { GanttBarContextValue, GanttBarProps };\nexport { GANTT_COLORS, GanttBar, useGanttBarContext };\n"],"mappings":";;;;;;;;;;;;;;;;;AA0BA,MAAM,eAAuD;CAC3D;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;EAAQ,OAAO;CAAwB;CAC/C;EAAE,MAAM;EAAU,OAAO;CAA0B;AACrD;AASA,MAAM,kBAEJ,cAAgD,IAAI;;AAGtD,SAAS,qBAAmE;CAC1E,MAAM,MAAM,WAAW,eAAe;CACtC,IAAI,CAAC,KACH,MAAM,IAAI,MAAM,mDAAmD;CAErE,OAAO;AACT;;;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,SAAS;EACnD,UAAA,qBAAC,SAAD;GACE,MAAM,WAAW,CAAC;GAClB,eAAe,MAAe,YAAiC;IAE7D,IAAI,QAAQ,SAAS,WAAW,iBAAiB;IACjD,WAAW,IAAI;GACjB;GANF,UAAA,CARY,OACd,oBAAC,oBAAD,EAAoB,QAAQ,oBAAC,gBAAD,EAAgB,QAAQ,UAAY,CAAA,EAAI,CAAA,IAEpE,oBAAC,gBAAD,EAAgB,QAAQ,UAAY,CAAA,GAc/B,WAAW,CAAC,kBACX,qBAAC,gBAAD;IAAgB,MAAK;IAAM,WAAU;IAArC,UAAA,CACE,oBAAC,OAAD;KAAK,WAAU;KAAe,UAAA,MAAM;IAAW,CAAA,GAC/C,oBAAC,OAAD;KAAK,WAAU;KAAc,UAAA;IAAe,CAAA,CAC9B;GAEX,CAAA,CAAA;;CACM,CAAA;CAGnB,OACE,oBAAC,gBAAgB,UAAjB;EAA0B,OAAO;GAAE;GAAY;GAAS;GAAY;EAAW;EAC5E,UAAA,OACC,qBAAC,aAAD,EAAA,UAAA,CACG,SACD,oBAAC,oBAAD;GAAoB,aAAU;GAAiB,WAAU;GACtD,UAAA;EACiB,CAAA,CACT,EAAA,CAAA,IAEb;CAEsB,CAAA;AAE9B"}
@@ -24,7 +24,8 @@ function getDayKey(date, timeZone) {
24
24
  }
25
25
  /** Day length in minutes; 1380/1500 on DST transition days - never assume 1440. */
26
26
  function getDayTotalMinutes(dayStart, timeZone) {
27
- return differenceInMinutes(zonedStartOfDay(addDays(toZoned(dayStart, timeZone), 1), timeZone), dayStart);
27
+ const next = zonedStartOfDay(addDays(toZoned(dayStart, timeZone), 1), timeZone);
28
+ return differenceInMinutes(next, dayStart);
28
29
  }
29
30
  function snapMinutes(minutes, snap) {
30
31
  return Math.round(minutes / snap) * snap;
@@ -107,7 +108,7 @@ function eventsOverlap(a, b) {
107
108
  return a.start < b.end && a.end > b.start;
108
109
  }
109
110
  function spansMultipleDays(occ) {
110
- return occ.end.getTime() - occ.start.getTime() > 1440 * 60 * 1e3;
111
+ return occ.end.getTime() - occ.start.getTime() > 864e5;
111
112
  }
112
113
  /**
113
114
  * Identity of a schedule ACROSS time edits. `occurrence.key` embeds the start
@@ -1 +1 @@
1
- {"version":3,"file":"gantt-lib.js","names":[],"sources":["../../../../src/components/reui/gantt/gantt-lib.tsx"],"sourcesContent":["\"use client\";\n\nimport { TZDate } from \"@date-fns/tz\";\nimport {\n addDays,\n addMonths,\n addWeeks,\n addYears,\n differenceInMinutes,\n format,\n startOfDay,\n startOfMonth,\n startOfQuarter,\n startOfWeek,\n startOfYear,\n} from \"date-fns\";\n\nimport { expandRecurrence } from \"./gantt-recurrence\";\nimport type {\n GanttDateRange,\n GanttEvent,\n GanttOccurrence,\n GanttOffDaysConfig,\n GanttResource,\n GanttScale,\n GanttSegment,\n} from \"./gantt-types\";\n\ntype WeekStartsOn = 0 | 1 | 2 | 3 | 4 | 5 | 6;\n\n/**\n * Packing-effective minimum in minutes so tiny events do not stack invisibly.\n * It is a packing FOOTPRINT, not a render size: two schedules less than this\n * apart are treated as concurrent and split into separate lanes even though\n * their real ranges do not touch.\n */\nconst MIN_PACK_SLOT = 30;\n\n/** The instant re-expressed in the display time zone (TZDate extends Date). */\nfunction toZoned(date: Date, timeZone: string): TZDate {\n return new TZDate(date.getTime(), timeZone);\n}\n\n/** Zoned midnight of the day containing the instant. */\nfunction zonedStartOfDay(date: Date, timeZone: string): TZDate {\n return startOfDay(toZoned(date, timeZone));\n}\n\n/** Stable per-day key in the display time zone. */\nfunction getDayKey(date: Date, timeZone: string): string {\n return format(toZoned(date, timeZone), \"yyyy-MM-dd\");\n}\n\n/** Day length in minutes; 1380/1500 on DST transition days - never assume 1440. */\nfunction getDayTotalMinutes(dayStart: Date, timeZone: string): number {\n const next = zonedStartOfDay(addDays(toZoned(dayStart, timeZone), 1), timeZone);\n return differenceInMinutes(next, dayStart);\n}\n\nfunction snapMinutes(minutes: number, snap: number): number {\n return Math.round(minutes / snap) * snap;\n}\n\ninterface ViewRangeOptions {\n timeZone: string;\n weekStartsOn: WeekStartsOn;\n}\n\ninterface ViewDateRanges {\n visibleRange: GanttDateRange;\n activeRange: GanttDateRange;\n}\n\n/** Axis range for the anchor date at the given scale. */\nfunction getGanttDateRange(scale: GanttScale, date: Date, opts: ViewRangeOptions): ViewDateRanges {\n const { timeZone, weekStartsOn } = opts;\n const zoned = toZoned(date, timeZone);\n\n if (scale === \"week\") {\n const start = startOfWeek(zoned, { weekStartsOn });\n const range = { start, end: addWeeks(start, 1) };\n return { activeRange: range, visibleRange: range };\n }\n if (scale === \"month\") {\n // exact month: no outside days on the horizontal axis\n const start = startOfMonth(zoned);\n const range = { start, end: startOfMonth(addMonths(zoned, 1)) };\n return { activeRange: range, visibleRange: range };\n }\n if (scale === \"quarter\") {\n // week-aligned so the axis partitions into uniform week units\n const quarterStart = startOfQuarter(zoned);\n const quarterEnd = startOfQuarter(addMonths(zoned, 3));\n const start = startOfWeek(quarterStart, { weekStartsOn });\n let end = startOfWeek(quarterEnd, { weekStartsOn });\n if (end < quarterEnd) end = addWeeks(end, 1);\n return {\n activeRange: { start: quarterStart, end: quarterEnd },\n visibleRange: { start, end },\n };\n }\n if (scale === \"year\") {\n const start = startOfYear(zoned);\n const range = { start, end: startOfYear(addYears(zoned, 1)) };\n return { activeRange: range, visibleRange: range };\n }\n const start = startOfDay(zoned);\n const range = { start, end: addDays(start, 1) };\n return { activeRange: range, visibleRange: range };\n}\n\n/** The anchor date stepped one period forward or backward for the scale. */\nfunction stepGanttDate(\n scale: GanttScale,\n date: Date,\n direction: 1 | -1,\n opts: Pick<ViewRangeOptions, \"timeZone\">,\n): Date {\n const zoned = toZoned(date, opts.timeZone);\n if (scale === \"week\") return addWeeks(zoned, direction);\n if (scale === \"month\") return addMonths(zoned, direction);\n if (scale === \"quarter\") return addMonths(zoned, direction * 3);\n if (scale === \"year\") return addYears(zoned, direction);\n return addDays(zoned, direction);\n}\n\nfunction rangesIntersect(a: GanttDateRange, b: GanttDateRange): boolean {\n return a.start < b.end && a.end > b.start;\n}\n\nfunction eventsOverlap(a: { start: Date; end: Date }, b: { start: Date; end: Date }): boolean {\n return a.start < b.end && a.end > b.start;\n}\n\nfunction spansMultipleDays(occ: { start: Date; end: Date }): boolean {\n // An event ending exactly at the next midnight is still single-day\n // (exclusive end), so compare against a strictly-later instant.\n return occ.end.getTime() - occ.start.getTime() > 24 * 60 * 60 * 1000;\n}\n\n/**\n * Identity of a schedule ACROSS time edits. `occurrence.key` embeds the start\n * instant, so it changes the moment a schedule is moved or start-resized -\n * useless as lane memory. This key survives the edit: the event id plus, for a\n * recurring series, the occurrence's position in it.\n */\nfunction getLaneKey(occurrence: { eventId: string; recurrenceIndex?: number }): string {\n return `${occurrence.eventId}::${occurrence.recurrenceIndex ?? 0}`;\n}\n\n/**\n * What one schedule held on the previous layout pass. The TIMES are what make\n * this more than a lane number: they are how the packer tells the schedule the\n * user just edited apart from the ones that merely sat still.\n */\ninterface GanttLaneMemo {\n lane: number;\n startMs: number;\n endMs: number;\n}\n\ninterface PackOptions {\n /**\n * Where each schedule sat on the previous pass, by getLaneKey.\n *\n * A schedule whose times are UNCHANGED keeps its lane if that lane is still\n * free, so editing one schedule never re-indexes the ones around it. A\n * schedule whose times CHANGED - the one the user just dragged or resized -\n * deliberately forfeits its pin and re-seeks the lowest free lane. That is\n * what makes the arrangement live rather than frozen: a schedule dragged\n * onto its neighbours stacks DOWN into the first free lane, and one dragged\n * clear of them comes back UP inline. Only the edited schedule moves.\n */\n preferredLanes?: Map<string, GanttLaneMemo>;\n /** \"single\" collapses the row to one track; see GanttScheduleMode. */\n mode?: \"single\" | \"multiple\";\n}\n\n/**\n * Overlap packing for one row's timed segments.\n * Mutates column/columnCount/columnSpan on the segments, in place.\n * z resolution happens at render: event.zIndex verbatim, else 10 + column.\n */\nfunction packTimedSegments<TData>(\n segments: GanttSegment<TData>[],\n options: PackOptions = {},\n): void {\n if (segments.length === 0) return;\n\n if (options.mode === \"single\") {\n // one track: every schedule shares lane 0 and the row never grows\n for (const seg of segments) {\n seg.column = 0;\n seg.columnCount = 1;\n seg.columnSpan = 1;\n }\n return;\n }\n\n const preferredLanes = options.preferredLanes;\n\n type Working = {\n seg: GanttSegment<TData>;\n startMin: number;\n effEnd: number;\n lane: number;\n /** The occupancy entry this item added, so a settle can take it back. */\n interval?: { from: number; to: number };\n };\n\n const items: Working[] = segments\n .map((seg) => {\n const startMin = seg.startMin ?? 0;\n const endMin = seg.endMin ?? startMin;\n return {\n seg,\n startMin,\n effEnd: Math.max(endMin, startMin + MIN_PACK_SLOT),\n lane: -1,\n };\n })\n .sort(\n (a, b) =>\n a.startMin - b.startMin ||\n b.effEnd - b.startMin - (a.effEnd - a.startMin) ||\n a.seg.occurrence.key.localeCompare(b.seg.occurrence.key),\n );\n\n // Sweep into connected clusters\n const clusters: Working[][] = [];\n let current: Working[] = [];\n let clusterEnd = -Infinity;\n for (const item of items) {\n if (item.startMin >= clusterEnd) {\n current = [];\n clusters.push(current);\n clusterEnd = -Infinity;\n }\n current.push(item);\n clusterEnd = Math.max(clusterEnd, item.effEnd);\n }\n\n for (const cluster of clusters) {\n // Per-lane occupancy INTERVALS, not a single running end: pass 1 claims\n // remembered lanes out of time order, so a lane can be free before an\n // occupant and busy after it.\n const laneIntervals: Array<Array<{ from: number; to: number }>> = [];\n const isFree = (lane: number, item: Working) =>\n !(laneIntervals[lane] ?? []).some((iv) => iv.from < item.effEnd && iv.to > item.startMin);\n const claim = (lane: number, item: Working) => {\n while (laneIntervals.length <= lane) laneIntervals.push([]);\n const interval = { from: item.startMin, to: item.effEnd };\n laneIntervals[lane].push(interval);\n item.lane = lane;\n item.interval = interval;\n };\n const release = (item: Working) => {\n const occupants = laneIntervals[item.lane] ?? [];\n const at = occupants.indexOf(item.interval!);\n if (at >= 0) occupants.splice(at, 1);\n };\n\n // pass 1: schedules that did not move keep the lane they had. The one the\n // user just edited is NOT pinned - its times differ from the memo, so it\n // falls through to pass 2 and re-seeks a lane against its new span.\n const pending: Working[] = [];\n for (const item of cluster) {\n const memo = preferredLanes?.get(getLaneKey(item.seg.occurrence));\n const untouched =\n memo !== undefined &&\n memo.startMs === item.seg.occurrence.start.getTime() &&\n memo.endMs === item.seg.occurrence.end.getTime();\n if (untouched && memo.lane >= 0 && isFree(memo.lane, item)) {\n claim(memo.lane, item);\n } else {\n pending.push(item);\n }\n }\n // pass 2: the rest take the lowest free lane - overlapping goes DOWN into\n // the first lane with room, fitting comes back UP to lane 0\n for (const item of pending) {\n let lane = 0;\n while (!isFree(lane, item)) lane++;\n claim(lane, item);\n }\n\n // pass 3: nothing floats above an empty lane. A pin only survives while\n // something above it still needs the space - once the schedule that was\n // there moves away or is deleted, its neighbour settles down into the\n // gap. Without this a row keeps a permanently blank top lane and never\n // shrinks back. Settling in lane order, and only ever DOWNWARD into space\n // that is genuinely free, means two schedules can never trade places -\n // so an edit still moves at most the schedule it touched.\n const byLane = [...cluster].sort((a, b) => a.lane - b.lane || a.startMin - b.startMin);\n for (const item of byLane) {\n if (item.lane === 0) continue;\n let lane = 0;\n while (lane < item.lane && !isFree(lane, item)) lane++;\n if (lane < item.lane) {\n release(item);\n claim(lane, item);\n }\n }\n }\n\n // Lane memory can leave holes (the schedule that held lane 0 was deleted or\n // moved away). Collapse the row's USED lanes onto 0..n-1: relative stacking\n // order survives, so nothing reshuffles, but the row cannot creep taller\n // than the lanes it actually needs.\n const used = [...new Set(items.map((item) => item.lane))].sort((a, b) => a - b);\n const compacted = new Map(used.map((lane, index) => [lane, index]));\n const columnCount = used.length;\n for (const item of items) {\n item.lane = compacted.get(item.lane) ?? 0;\n item.seg.column = item.lane;\n item.seg.columnCount = columnCount;\n }\n\n // Partial-overlap expansion: widen rightward into free lanes\n for (const cluster of clusters) {\n for (const item of cluster) {\n let span = 1;\n while (item.lane + span < columnCount) {\n const blocked = cluster.some(\n (other) =>\n other !== item &&\n other.lane === item.lane + span &&\n other.startMin < item.effEnd &&\n other.effEnd > item.startMin,\n );\n if (blocked) break;\n span++;\n }\n item.seg.columnSpan = span;\n }\n }\n}\n\nfunction defaultEventOrder(a: GanttOccurrence, b: GanttOccurrence): number {\n return (\n a.start.getTime() - b.start.getTime() ||\n b.end.getTime() - b.start.getTime() - (a.end.getTime() - a.start.getTime()) ||\n a.key.localeCompare(b.key)\n );\n}\n\ninterface BuildIndexOptions<TData = unknown> {\n timeZone: string;\n /** Escape hatch for exotic recurrence: return the expanded occurrences. */\n getOccurrences?: (\n event: GanttEvent<TData>,\n range: GanttDateRange,\n ctx: { timeZone: string },\n ) => Array<{ start: Date; end: Date }> | null | undefined;\n eventOrder?: (a: GanttOccurrence<TData>, b: GanttOccurrence<TData>) => number;\n}\n\ninterface GanttIndex<TData = unknown> {\n occurrences: GanttOccurrence<TData>[];\n}\n\nfunction buildEventIndex<TData>(\n events: GanttEvent<TData>[],\n visibleRange: GanttDateRange,\n opts: BuildIndexOptions<TData>,\n): GanttIndex<TData> {\n const { timeZone } = opts;\n const order = opts.eventOrder ?? defaultEventOrder;\n\n // RECURRENCE-ID override replacement: an event carrying recurringEventId +\n // originalStart is an edited single occurrence of that series. The parent's\n // expansion drops the replaced instant; the override renders as its own\n // occurrence through the normal path below.\n const overrideTimes = new Map<string, Set<number>>();\n for (const event of events) {\n if (!event.recurringEventId || !event.originalStart) continue;\n let times = overrideTimes.get(event.recurringEventId);\n if (!times) {\n times = new Set();\n overrideTimes.set(event.recurringEventId, times);\n }\n times.add(event.originalStart.getTime());\n }\n\n const occurrences: GanttOccurrence<TData>[] = [];\n for (const event of events) {\n const replaced = overrideTimes.get(event.id);\n const custom = opts.getOccurrences?.(event, visibleRange, { timeZone });\n if (custom) {\n custom.forEach((occ, i) => {\n if (replaced?.has(occ.start.getTime())) return;\n if (!rangesIntersect({ start: occ.start, end: occ.end }, visibleRange)) return;\n occurrences.push({\n key: `${event.id}::${occ.start.toISOString()}`,\n eventId: event.id,\n event,\n start: occ.start,\n end: occ.end,\n allDay: event.allDay ?? false,\n isRecurring: true,\n recurrenceIndex: i,\n });\n });\n continue;\n }\n const expanded = expandRecurrence(event, visibleRange, { timeZone });\n occurrences.push(\n ...(replaced ? expanded.filter((occ) => !replaced.has(occ.start.getTime())) : expanded),\n );\n }\n occurrences.sort(order);\n return { occurrences };\n}\n\n/** Cache key for index memoization; cheap string compare. */\nfunction getRangeKey(range: GanttDateRange): string {\n return `${range.start.getTime()}-${range.end.getTime()}`;\n}\n\n/** Depth-first flatten of the resource tree (parents included). */\nfunction flattenResources(\n resources: GanttResource[],\n depth = 0,\n): Array<{ resource: GanttResource; depth: number }> {\n const rows: Array<{ resource: GanttResource; depth: number }> = [];\n for (const resource of resources) {\n rows.push({ resource, depth });\n if (resource.children?.length) {\n rows.push(...flattenResources(resource.children, depth + 1));\n }\n }\n return rows;\n}\n\n/** Depth-first lookup of one node in the tree. */\nfunction findResource(resources: GanttResource[], id: string): GanttResource | null {\n for (const resource of resources) {\n if (resource.id === id) return resource;\n const found = resource.children?.length ? findResource(resource.children, id) : null;\n if (found) return found;\n }\n return null;\n}\n\n/**\n * Pure tree move: removes `resourceId` from wherever it sits and reinserts it\n * under `parentId` (null = root) at `index`. Returns a new tree; the original\n * is untouched. Returns null for impossible moves (unknown ids, or dropping a\n * node into its own subtree).\n */\nfunction reorderResources(\n resources: GanttResource[],\n resourceId: string,\n parentId: string | null,\n index: number,\n): GanttResource[] | null {\n let moved: GanttResource | null = null;\n\n const strip = (nodes: GanttResource[]): GanttResource[] =>\n nodes.flatMap((node) => {\n if (node.id === resourceId) {\n moved = node;\n return [];\n }\n if (!node.children?.length) return [node];\n return [{ ...node, children: strip(node.children) }];\n });\n\n const stripped = strip(resources);\n if (!moved) return null;\n\n const contains = (node: GanttResource, id: string): boolean =>\n node.id === id || !!node.children?.some((child) => contains(child, id));\n if (parentId !== null && contains(moved, parentId)) return null;\n\n const insert = (nodes: GanttResource[]): GanttResource[] => {\n if (parentId === null) {\n const next = [...nodes];\n next.splice(Math.min(Math.max(index, 0), next.length), 0, moved!);\n return next;\n }\n return nodes.map((node) => {\n if (node.id === parentId) {\n const children = [...(node.children ?? [])];\n children.splice(Math.min(Math.max(index, 0), children.length), 0, moved!);\n return { ...node, children };\n }\n if (!node.children?.length) return node;\n return { ...node, children: insert(node.children) };\n });\n };\n\n const next = insert(stripped);\n // unknown parentId: the node vanished - reject\n if (parentId !== null) {\n const flat = flattenResources(next);\n if (!flat.some(({ resource }) => resource.id === resourceId)) return null;\n }\n return next;\n}\n\nconst DEFAULT_WEEKEND_DAYS = [0, 6];\n\n/** Resolves whether a day is an off day (non-working) in the display zone. */\nfunction resolveOffDay(\n day: Date,\n timeZone: string,\n config: boolean | GanttOffDaysConfig | undefined,\n): boolean {\n if (!config) return false;\n const resolved: GanttOffDaysConfig = config === true ? {} : config;\n const weekendDays = resolved.weekendDays ?? DEFAULT_WEEKEND_DAYS;\n const zoned = toZoned(day, timeZone);\n if (weekendDays.includes(zoned.getDay())) return true;\n if (resolved.dates?.length) {\n const key = getDayKey(day, timeZone);\n if (resolved.dates.some((date) => getDayKey(date, timeZone) === key)) {\n return true;\n }\n }\n return resolved.isOffDay?.(day) ?? false;\n}\n\nexport type {\n BuildIndexOptions,\n GanttIndex,\n GanttLaneMemo,\n PackOptions,\n ViewDateRanges,\n ViewRangeOptions,\n WeekStartsOn,\n};\nexport {\n buildEventIndex,\n defaultEventOrder,\n eventsOverlap,\n findResource,\n flattenResources,\n getDayKey,\n getDayTotalMinutes,\n getGanttDateRange,\n getLaneKey,\n getRangeKey,\n MIN_PACK_SLOT,\n packTimedSegments,\n rangesIntersect,\n reorderResources,\n resolveOffDay,\n snapMinutes,\n spansMultipleDays,\n stepGanttDate,\n toZoned,\n zonedStartOfDay,\n};\n"],"mappings":";;;;;;;;;;;AAoCA,MAAM,gBAAgB;;AAGtB,SAAS,QAAQ,MAAY,UAA0B;CACrD,OAAO,IAAI,OAAO,KAAK,QAAQ,GAAG,QAAQ;AAC5C;;AAGA,SAAS,gBAAgB,MAAY,UAA0B;CAC7D,OAAO,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AAI,SAAS,OAAO,QAAQ;EAC1B,MAAM,MAAM,UAAU,KAAK,QAAQ;EACnC,IAAI,SAAS,MAAM,MAAM,SAAS,UAAU,MAAM,QAAQ,MAAM,GAAG,GACjE,OAAO;CAEX;CACA,OAAO,SAAS,WAAW,GAAG,KAAK;AACrC"}
1
+ {"version":3,"file":"gantt-lib.js","names":[],"sources":["../../../../src/components/reui/gantt/gantt-lib.tsx"],"sourcesContent":["\"use client\";\n\nimport { TZDate } from \"@date-fns/tz\";\nimport {\n addDays,\n addMonths,\n addWeeks,\n addYears,\n differenceInMinutes,\n format,\n startOfDay,\n startOfMonth,\n startOfQuarter,\n startOfWeek,\n startOfYear,\n} from \"date-fns\";\n\nimport { expandRecurrence } from \"./gantt-recurrence\";\nimport type {\n GanttDateRange,\n GanttEvent,\n GanttOccurrence,\n GanttOffDaysConfig,\n GanttResource,\n GanttScale,\n GanttSegment,\n} from \"./gantt-types\";\n\ntype WeekStartsOn = 0 | 1 | 2 | 3 | 4 | 5 | 6;\n\n/**\n * Packing-effective minimum in minutes so tiny events do not stack invisibly.\n * It is a packing FOOTPRINT, not a render size: two schedules less than this\n * apart are treated as concurrent and split into separate lanes even though\n * their real ranges do not touch.\n */\nconst MIN_PACK_SLOT = 30;\n\n/** The instant re-expressed in the display time zone (TZDate extends Date). */\nfunction toZoned(date: Date, timeZone: string): TZDate {\n return new TZDate(date.getTime(), timeZone);\n}\n\n/** Zoned midnight of the day containing the instant. */\nfunction zonedStartOfDay(date: Date, timeZone: string): TZDate {\n return startOfDay(toZoned(date, timeZone));\n}\n\n/** Stable per-day key in the display time zone. */\nfunction getDayKey(date: Date, timeZone: string): string {\n return format(toZoned(date, timeZone), \"yyyy-MM-dd\");\n}\n\n/** Day length in minutes; 1380/1500 on DST transition days - never assume 1440. */\nfunction getDayTotalMinutes(dayStart: Date, timeZone: string): number {\n const next = zonedStartOfDay(addDays(toZoned(dayStart, timeZone), 1), timeZone);\n return differenceInMinutes(next, dayStart);\n}\n\nfunction snapMinutes(minutes: number, snap: number): number {\n return Math.round(minutes / snap) * snap;\n}\n\ninterface ViewRangeOptions {\n timeZone: string;\n weekStartsOn: WeekStartsOn;\n}\n\ninterface ViewDateRanges {\n visibleRange: GanttDateRange;\n activeRange: GanttDateRange;\n}\n\n/** Axis range for the anchor date at the given scale. */\nfunction getGanttDateRange(scale: GanttScale, date: Date, opts: ViewRangeOptions): ViewDateRanges {\n const { timeZone, weekStartsOn } = opts;\n const zoned = toZoned(date, timeZone);\n\n if (scale === \"week\") {\n const start = startOfWeek(zoned, { weekStartsOn });\n const range = { start, end: addWeeks(start, 1) };\n return { activeRange: range, visibleRange: range };\n }\n if (scale === \"month\") {\n // exact month: no outside days on the horizontal axis\n const start = startOfMonth(zoned);\n const range = { start, end: startOfMonth(addMonths(zoned, 1)) };\n return { activeRange: range, visibleRange: range };\n }\n if (scale === \"quarter\") {\n // week-aligned so the axis partitions into uniform week units\n const quarterStart = startOfQuarter(zoned);\n const quarterEnd = startOfQuarter(addMonths(zoned, 3));\n const start = startOfWeek(quarterStart, { weekStartsOn });\n let end = startOfWeek(quarterEnd, { weekStartsOn });\n if (end < quarterEnd) end = addWeeks(end, 1);\n return {\n activeRange: { start: quarterStart, end: quarterEnd },\n visibleRange: { start, end },\n };\n }\n if (scale === \"year\") {\n const start = startOfYear(zoned);\n const range = { start, end: startOfYear(addYears(zoned, 1)) };\n return { activeRange: range, visibleRange: range };\n }\n const start = startOfDay(zoned);\n const range = { start, end: addDays(start, 1) };\n return { activeRange: range, visibleRange: range };\n}\n\n/** The anchor date stepped one period forward or backward for the scale. */\nfunction stepGanttDate(\n scale: GanttScale,\n date: Date,\n direction: 1 | -1,\n opts: Pick<ViewRangeOptions, \"timeZone\">,\n): Date {\n const zoned = toZoned(date, opts.timeZone);\n if (scale === \"week\") return addWeeks(zoned, direction);\n if (scale === \"month\") return addMonths(zoned, direction);\n if (scale === \"quarter\") return addMonths(zoned, direction * 3);\n if (scale === \"year\") return addYears(zoned, direction);\n return addDays(zoned, direction);\n}\n\nfunction rangesIntersect(a: GanttDateRange, b: GanttDateRange): boolean {\n return a.start < b.end && a.end > b.start;\n}\n\nfunction eventsOverlap(a: { start: Date; end: Date }, b: { start: Date; end: Date }): boolean {\n return a.start < b.end && a.end > b.start;\n}\n\nfunction spansMultipleDays(occ: { start: Date; end: Date }): boolean {\n // An event ending exactly at the next midnight is still single-day\n // (exclusive end), so compare against a strictly-later instant.\n return occ.end.getTime() - occ.start.getTime() > 24 * 60 * 60 * 1000;\n}\n\n/**\n * Identity of a schedule ACROSS time edits. `occurrence.key` embeds the start\n * instant, so it changes the moment a schedule is moved or start-resized -\n * useless as lane memory. This key survives the edit: the event id plus, for a\n * recurring series, the occurrence's position in it.\n */\nfunction getLaneKey(occurrence: { eventId: string; recurrenceIndex?: number }): string {\n return `${occurrence.eventId}::${occurrence.recurrenceIndex ?? 0}`;\n}\n\n/**\n * What one schedule held on the previous layout pass. The TIMES are what make\n * this more than a lane number: they are how the packer tells the schedule the\n * user just edited apart from the ones that merely sat still.\n */\ninterface GanttLaneMemo {\n lane: number;\n startMs: number;\n endMs: number;\n}\n\ninterface PackOptions {\n /**\n * Where each schedule sat on the previous pass, by getLaneKey.\n *\n * A schedule whose times are UNCHANGED keeps its lane if that lane is still\n * free, so editing one schedule never re-indexes the ones around it. A\n * schedule whose times CHANGED - the one the user just dragged or resized -\n * deliberately forfeits its pin and re-seeks the lowest free lane. That is\n * what makes the arrangement live rather than frozen: a schedule dragged\n * onto its neighbours stacks DOWN into the first free lane, and one dragged\n * clear of them comes back UP inline. Only the edited schedule moves.\n */\n preferredLanes?: Map<string, GanttLaneMemo>;\n /** \"single\" collapses the row to one track; see GanttScheduleMode. */\n mode?: \"single\" | \"multiple\";\n}\n\n/**\n * Overlap packing for one row's timed segments.\n * Mutates column/columnCount/columnSpan on the segments, in place.\n * z resolution happens at render: event.zIndex verbatim, else 10 + column.\n */\nfunction packTimedSegments<TData>(\n segments: GanttSegment<TData>[],\n options: PackOptions = {},\n): void {\n if (segments.length === 0) return;\n\n if (options.mode === \"single\") {\n // one track: every schedule shares lane 0 and the row never grows\n for (const seg of segments) {\n seg.column = 0;\n seg.columnCount = 1;\n seg.columnSpan = 1;\n }\n return;\n }\n\n const preferredLanes = options.preferredLanes;\n\n type Working = {\n seg: GanttSegment<TData>;\n startMin: number;\n effEnd: number;\n lane: number;\n /** The occupancy entry this item added, so a settle can take it back. */\n interval?: { from: number; to: number };\n };\n\n const items: Working[] = segments\n .map((seg) => {\n const startMin = seg.startMin ?? 0;\n const endMin = seg.endMin ?? startMin;\n return {\n seg,\n startMin,\n effEnd: Math.max(endMin, startMin + MIN_PACK_SLOT),\n lane: -1,\n };\n })\n .sort(\n (a, b) =>\n a.startMin - b.startMin ||\n b.effEnd - b.startMin - (a.effEnd - a.startMin) ||\n a.seg.occurrence.key.localeCompare(b.seg.occurrence.key),\n );\n\n // Sweep into connected clusters\n const clusters: Working[][] = [];\n let current: Working[] = [];\n let clusterEnd = -Infinity;\n for (const item of items) {\n if (item.startMin >= clusterEnd) {\n current = [];\n clusters.push(current);\n clusterEnd = -Infinity;\n }\n current.push(item);\n clusterEnd = Math.max(clusterEnd, item.effEnd);\n }\n\n for (const cluster of clusters) {\n // Per-lane occupancy INTERVALS, not a single running end: pass 1 claims\n // remembered lanes out of time order, so a lane can be free before an\n // occupant and busy after it.\n const laneIntervals: Array<Array<{ from: number; to: number }>> = [];\n const isFree = (lane: number, item: Working) =>\n !(laneIntervals[lane] ?? []).some((iv) => iv.from < item.effEnd && iv.to > item.startMin);\n const claim = (lane: number, item: Working) => {\n while (laneIntervals.length <= lane) laneIntervals.push([]);\n const interval = { from: item.startMin, to: item.effEnd };\n laneIntervals[lane].push(interval);\n item.lane = lane;\n item.interval = interval;\n };\n const release = (item: Working) => {\n const occupants = laneIntervals[item.lane] ?? [];\n const at = occupants.indexOf(item.interval!);\n if (at >= 0) occupants.splice(at, 1);\n };\n\n // pass 1: schedules that did not move keep the lane they had. The one the\n // user just edited is NOT pinned - its times differ from the memo, so it\n // falls through to pass 2 and re-seeks a lane against its new span.\n const pending: Working[] = [];\n for (const item of cluster) {\n const memo = preferredLanes?.get(getLaneKey(item.seg.occurrence));\n const untouched =\n memo !== undefined &&\n memo.startMs === item.seg.occurrence.start.getTime() &&\n memo.endMs === item.seg.occurrence.end.getTime();\n if (untouched && memo.lane >= 0 && isFree(memo.lane, item)) {\n claim(memo.lane, item);\n } else {\n pending.push(item);\n }\n }\n // pass 2: the rest take the lowest free lane - overlapping goes DOWN into\n // the first lane with room, fitting comes back UP to lane 0\n for (const item of pending) {\n let lane = 0;\n while (!isFree(lane, item)) lane++;\n claim(lane, item);\n }\n\n // pass 3: nothing floats above an empty lane. A pin only survives while\n // something above it still needs the space - once the schedule that was\n // there moves away or is deleted, its neighbour settles down into the\n // gap. Without this a row keeps a permanently blank top lane and never\n // shrinks back. Settling in lane order, and only ever DOWNWARD into space\n // that is genuinely free, means two schedules can never trade places -\n // so an edit still moves at most the schedule it touched.\n const byLane = [...cluster].sort((a, b) => a.lane - b.lane || a.startMin - b.startMin);\n for (const item of byLane) {\n if (item.lane === 0) continue;\n let lane = 0;\n while (lane < item.lane && !isFree(lane, item)) lane++;\n if (lane < item.lane) {\n release(item);\n claim(lane, item);\n }\n }\n }\n\n // Lane memory can leave holes (the schedule that held lane 0 was deleted or\n // moved away). Collapse the row's USED lanes onto 0..n-1: relative stacking\n // order survives, so nothing reshuffles, but the row cannot creep taller\n // than the lanes it actually needs.\n const used = [...new Set(items.map((item) => item.lane))].sort((a, b) => a - b);\n const compacted = new Map(used.map((lane, index) => [lane, index]));\n const columnCount = used.length;\n for (const item of items) {\n item.lane = compacted.get(item.lane) ?? 0;\n item.seg.column = item.lane;\n item.seg.columnCount = columnCount;\n }\n\n // Partial-overlap expansion: widen rightward into free lanes\n for (const cluster of clusters) {\n for (const item of cluster) {\n let span = 1;\n while (item.lane + span < columnCount) {\n const blocked = cluster.some(\n (other) =>\n other !== item &&\n other.lane === item.lane + span &&\n other.startMin < item.effEnd &&\n other.effEnd > item.startMin,\n );\n if (blocked) break;\n span++;\n }\n item.seg.columnSpan = span;\n }\n }\n}\n\nfunction defaultEventOrder(a: GanttOccurrence, b: GanttOccurrence): number {\n return (\n a.start.getTime() - b.start.getTime() ||\n b.end.getTime() - b.start.getTime() - (a.end.getTime() - a.start.getTime()) ||\n a.key.localeCompare(b.key)\n );\n}\n\ninterface BuildIndexOptions<TData = unknown> {\n timeZone: string;\n /** Escape hatch for exotic recurrence: return the expanded occurrences. */\n getOccurrences?: (\n event: GanttEvent<TData>,\n range: GanttDateRange,\n ctx: { timeZone: string },\n ) => Array<{ start: Date; end: Date }> | null | undefined;\n eventOrder?: (a: GanttOccurrence<TData>, b: GanttOccurrence<TData>) => number;\n}\n\ninterface GanttIndex<TData = unknown> {\n occurrences: GanttOccurrence<TData>[];\n}\n\nfunction buildEventIndex<TData>(\n events: GanttEvent<TData>[],\n visibleRange: GanttDateRange,\n opts: BuildIndexOptions<TData>,\n): GanttIndex<TData> {\n const { timeZone } = opts;\n const order = opts.eventOrder ?? defaultEventOrder;\n\n // RECURRENCE-ID override replacement: an event carrying recurringEventId +\n // originalStart is an edited single occurrence of that series. The parent's\n // expansion drops the replaced instant; the override renders as its own\n // occurrence through the normal path below.\n const overrideTimes = new Map<string, Set<number>>();\n for (const event of events) {\n if (!event.recurringEventId || !event.originalStart) continue;\n let times = overrideTimes.get(event.recurringEventId);\n if (!times) {\n times = new Set();\n overrideTimes.set(event.recurringEventId, times);\n }\n times.add(event.originalStart.getTime());\n }\n\n const occurrences: GanttOccurrence<TData>[] = [];\n for (const event of events) {\n const replaced = overrideTimes.get(event.id);\n const custom = opts.getOccurrences?.(event, visibleRange, { timeZone });\n if (custom) {\n custom.forEach((occ, i) => {\n if (replaced?.has(occ.start.getTime())) return;\n if (!rangesIntersect({ start: occ.start, end: occ.end }, visibleRange)) return;\n occurrences.push({\n key: `${event.id}::${occ.start.toISOString()}`,\n eventId: event.id,\n event,\n start: occ.start,\n end: occ.end,\n allDay: event.allDay ?? false,\n isRecurring: true,\n recurrenceIndex: i,\n });\n });\n continue;\n }\n const expanded = expandRecurrence(event, visibleRange, { timeZone });\n occurrences.push(\n ...(replaced ? expanded.filter((occ) => !replaced.has(occ.start.getTime())) : expanded),\n );\n }\n occurrences.sort(order);\n return { occurrences };\n}\n\n/** Cache key for index memoization; cheap string compare. */\nfunction getRangeKey(range: GanttDateRange): string {\n return `${range.start.getTime()}-${range.end.getTime()}`;\n}\n\n/** Depth-first flatten of the resource tree (parents included). */\nfunction flattenResources(\n resources: GanttResource[],\n depth = 0,\n): Array<{ resource: GanttResource; depth: number }> {\n const rows: Array<{ resource: GanttResource; depth: number }> = [];\n for (const resource of resources) {\n rows.push({ resource, depth });\n if (resource.children?.length) {\n rows.push(...flattenResources(resource.children, depth + 1));\n }\n }\n return rows;\n}\n\n/** Depth-first lookup of one node in the tree. */\nfunction findResource(resources: GanttResource[], id: string): GanttResource | null {\n for (const resource of resources) {\n if (resource.id === id) return resource;\n const found = resource.children?.length ? findResource(resource.children, id) : null;\n if (found) return found;\n }\n return null;\n}\n\n/**\n * Pure tree move: removes `resourceId` from wherever it sits and reinserts it\n * under `parentId` (null = root) at `index`. Returns a new tree; the original\n * is untouched. Returns null for impossible moves (unknown ids, or dropping a\n * node into its own subtree).\n */\nfunction reorderResources(\n resources: GanttResource[],\n resourceId: string,\n parentId: string | null,\n index: number,\n): GanttResource[] | null {\n let moved: GanttResource | null = null;\n\n const strip = (nodes: GanttResource[]): GanttResource[] =>\n nodes.flatMap((node) => {\n if (node.id === resourceId) {\n moved = node;\n return [];\n }\n if (!node.children?.length) return [node];\n return [{ ...node, children: strip(node.children) }];\n });\n\n const stripped = strip(resources);\n if (!moved) return null;\n\n const contains = (node: GanttResource, id: string): boolean =>\n node.id === id || !!node.children?.some((child) => contains(child, id));\n if (parentId !== null && contains(moved, parentId)) return null;\n\n const insert = (nodes: GanttResource[]): GanttResource[] => {\n if (parentId === null) {\n const next = [...nodes];\n next.splice(Math.min(Math.max(index, 0), next.length), 0, moved!);\n return next;\n }\n return nodes.map((node) => {\n if (node.id === parentId) {\n const children = [...(node.children ?? [])];\n children.splice(Math.min(Math.max(index, 0), children.length), 0, moved!);\n return { ...node, children };\n }\n if (!node.children?.length) return node;\n return { ...node, children: insert(node.children) };\n });\n };\n\n const next = insert(stripped);\n // unknown parentId: the node vanished - reject\n if (parentId !== null) {\n const flat = flattenResources(next);\n if (!flat.some(({ resource }) => resource.id === resourceId)) return null;\n }\n return next;\n}\n\nconst DEFAULT_WEEKEND_DAYS = [0, 6];\n\n/** Resolves whether a day is an off day (non-working) in the display zone. */\nfunction resolveOffDay(\n day: Date,\n timeZone: string,\n config: boolean | GanttOffDaysConfig | undefined,\n): boolean {\n if (!config) return false;\n const resolved: GanttOffDaysConfig = config === true ? {} : config;\n const weekendDays = resolved.weekendDays ?? DEFAULT_WEEKEND_DAYS;\n const zoned = toZoned(day, timeZone);\n if (weekendDays.includes(zoned.getDay())) return true;\n if (resolved.dates?.length) {\n const key = getDayKey(day, timeZone);\n if (resolved.dates.some((date) => getDayKey(date, timeZone) === key)) {\n return true;\n }\n }\n return resolved.isOffDay?.(day) ?? false;\n}\n\nexport type {\n BuildIndexOptions,\n GanttIndex,\n GanttLaneMemo,\n PackOptions,\n ViewDateRanges,\n ViewRangeOptions,\n WeekStartsOn,\n};\nexport {\n buildEventIndex,\n defaultEventOrder,\n eventsOverlap,\n findResource,\n flattenResources,\n getDayKey,\n getDayTotalMinutes,\n getGanttDateRange,\n getLaneKey,\n getRangeKey,\n MIN_PACK_SLOT,\n packTimedSegments,\n rangesIntersect,\n reorderResources,\n resolveOffDay,\n snapMinutes,\n spansMultipleDays,\n stepGanttDate,\n toZoned,\n zonedStartOfDay,\n};\n"],"mappings":";;;;;;;;;;;AAoCA,MAAM,gBAAgB;;AAGtB,SAAS,QAAQ,MAAY,UAA0B;CACrD,OAAO,IAAI,OAAO,KAAK,QAAQ,GAAG,QAA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QAAQ;CACnC,IAAI,YAAY,SAAS,MAAM,OAAO,CAAC,GAAG,OAAO;CACjD,IAAI,SAAS,OAAO,QAAQ;EAC1B,MAAM,MAAM,UAAU,KAAK,QAAQ;EACnC,IAAI,SAAS,MAAM,MAAM,SAAS,UAAU,MAAM,QAAQ,MAAM,GAAG,GACjE,OAAO;CAEX;CACA,OAAO,SAAS,WAAW,GAAG,KAAK;AACrC"}
@@ -104,15 +104,16 @@ function GanttNavNext({ className, render, children, tooltip, ...props }) {
104
104
  }
105
105
  function GanttTitle({ className, render, format: formatTitle, ...props }) {
106
106
  const { title } = useGanttNavigation();
107
+ const defaultProps = {
108
+ "data-slot": "gantt-title",
109
+ "aria-live": "polite",
110
+ className: cn("min-w-0 truncate font-semibold text-sm", className),
111
+ children: formatTitle?.({ title }) ?? title
112
+ };
107
113
  return useRender({
108
114
  defaultTagName: "div",
109
115
  render,
110
- props: mergeProps({
111
- "data-slot": "gantt-title",
112
- "aria-live": "polite",
113
- className: cn("min-w-0 truncate font-semibold text-sm", className),
114
- children: formatTitle?.({ title }) ?? title
115
- }, props)
116
+ props: mergeProps(defaultProps, props)
116
117
  });
117
118
  }
118
119
  /**
@@ -219,14 +220,16 @@ function GanttDatePicker({ className }) {
219
220
  }
220
221
  /** Free slot for consumer toolbar buttons; pure layout shell. */
221
222
  function GanttToolbar({ className, render, ...props }) {
223
+ const viewConfig = useGanttViewConfig();
224
+ const defaultProps = {
225
+ "data-slot": "gantt-toolbar",
226
+ className: cn("flex items-center gap-2", viewConfig.classNames?.toolbar, className),
227
+ children: props.children
228
+ };
222
229
  return useRender({
223
230
  defaultTagName: "div",
224
231
  render,
225
- props: mergeProps({
226
- "data-slot": "gantt-toolbar",
227
- className: cn("flex items-center gap-2", useGanttViewConfig().classNames?.toolbar, className),
228
- children: props.children
229
- }, props)
232
+ props: mergeProps(defaultProps, props)
230
233
  });
231
234
  }
232
235
  /**
@@ -236,28 +239,29 @@ function GanttToolbar({ className, render, ...props }) {
236
239
  */
237
240
  function GanttNav({ className, render, children, ...props }) {
238
241
  const viewConfig = useGanttViewConfig();
242
+ const defaultProps = {
243
+ "data-slot": "gantt-nav",
244
+ className: cn("flex min-w-0 flex-wrap items-center gap-2 border-b px-3 py-2", viewConfig.stickyNav && "sticky top-0 z-30 bg-background", viewConfig.classNames?.nav, className),
245
+ children: children ?? /* @__PURE__ */ jsxs(TooltipProvider, {
246
+ delay: 600,
247
+ closeDelay: 0,
248
+ timeout: 300,
249
+ children: [
250
+ /* @__PURE__ */ jsx(GanttNavToday, {}),
251
+ /* @__PURE__ */ jsx(GanttScaleSwitcher, {}),
252
+ /* @__PURE__ */ jsxs("div", {
253
+ className: "flex items-center",
254
+ children: [/* @__PURE__ */ jsx(GanttNavPrev, {}), /* @__PURE__ */ jsx(GanttNavNext, {})]
255
+ }),
256
+ /* @__PURE__ */ jsx(GanttTitle, {}),
257
+ /* @__PURE__ */ jsx("div", { className: "grow" })
258
+ ]
259
+ })
260
+ };
239
261
  return useRender({
240
262
  defaultTagName: "div",
241
263
  render,
242
- props: mergeProps({
243
- "data-slot": "gantt-nav",
244
- className: cn("flex min-w-0 flex-wrap items-center gap-2 border-b px-3 py-2", viewConfig.stickyNav && "sticky top-0 z-30 bg-background", viewConfig.classNames?.nav, className),
245
- children: children ?? /* @__PURE__ */ jsxs(TooltipProvider, {
246
- delay: 600,
247
- closeDelay: 0,
248
- timeout: 300,
249
- children: [
250
- /* @__PURE__ */ jsx(GanttNavToday, {}),
251
- /* @__PURE__ */ jsx(GanttScaleSwitcher, {}),
252
- /* @__PURE__ */ jsxs("div", {
253
- className: "flex items-center",
254
- children: [/* @__PURE__ */ jsx(GanttNavPrev, {}), /* @__PURE__ */ jsx(GanttNavNext, {})]
255
- }),
256
- /* @__PURE__ */ jsx(GanttTitle, {}),
257
- /* @__PURE__ */ jsx("div", { className: "grow" })
258
- ]
259
- })
260
- }, props)
264
+ props: mergeProps(defaultProps, props)
261
265
  });
262
266
  }
263
267
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"gantt-nav.js","names":[],"sources":["../../../../src/components/reui/gantt/gantt-nav.tsx"],"sourcesContent":["\"use client\";\n\nimport { type ReactNode, useState } from \"react\";\nimport { mergeProps } from \"@base-ui/react/merge-props\";\nimport { useRender } from \"@base-ui/react/use-render\";\nimport { format } from \"date-fns\";\nimport { CalendarIcon, ChevronDownIcon, ChevronLeftIcon, ChevronRightIcon } from \"lucide-react\";\n\nimport { cn } from \"@kumix/utils\";\nimport { Button } from \"../../ui/button\";\nimport { Calendar } from \"../../ui/calendar\";\nimport {\n DropdownMenu,\n DropdownMenuContent,\n DropdownMenuGroup,\n DropdownMenuItem,\n DropdownMenuLabel,\n DropdownMenuTrigger,\n} from \"../../ui/dropdown-menu\";\nimport { Popover, PopoverContent, PopoverTrigger } from \"../../ui/popover\";\nimport { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from \"../../ui/tooltip\";\nimport { useGanttNavigation, useGanttScale, useGanttSettings, useGanttViewConfig } from \"./gantt\";\nimport { toZoned } from \"./gantt-lib\";\nimport type { GanttScale } from \"./gantt-types\";\n\nconst GANTT_SCALES: GanttScale[] = [\"day\", \"week\", \"month\", \"quarter\", \"year\"];\n\n/** Configured nav button variant/size (viewConfig.navButtonVariant/Size). */\nfunction useNavButtonProps(): {\n variant: \"ghost\" | \"outline\" | \"secondary\" | \"default\";\n size: \"sm\" | \"default\";\n iconSize: \"icon-sm\" | \"icon\";\n} {\n const viewConfig = useGanttViewConfig();\n return {\n variant: viewConfig.navButtonVariant,\n size: viewConfig.navButtonSize,\n iconSize: viewConfig.navButtonSize === \"sm\" ? \"icon-sm\" : \"icon\",\n };\n}\n\ntype NavButtonProps = Omit<useRender.ComponentProps<\"button\">, \"children\"> & {\n children?: ReactNode;\n /**\n * Tooltip policy (the part that usually goes wrong on clickable elements):\n * tooltips appear ONLY on hover or keyboard focus-visible - a pointer click\n * never re-triggers them, and buttons that open overlays (the period\n * selector, consumer dialog buttons) get NO tooltip at all so nothing\n * flashes when focus returns. Icon-only buttons default to their accessible\n * label; Today defaults to the actual current date. Pass null to disable.\n */\n tooltip?: ReactNode | null;\n};\n\n/** Hover/focus-visible tooltip wrapper; renders the bare button when disabled. */\nfunction NavTooltip({\n content,\n children,\n}: {\n content: ReactNode | null;\n children: React.ReactElement;\n}) {\n if (content === null || content === undefined) return children;\n return (\n <Tooltip>\n <TooltipTrigger render={children} />\n <TooltipContent side=\"bottom\">{content}</TooltipContent>\n </Tooltip>\n );\n}\n\nfunction GanttNavToday({ className, render, children, tooltip, ...props }: NavButtonProps) {\n const { today, isToday } = useGanttNavigation();\n const settings = useGanttSettings();\n const nav = useNavButtonProps();\n // zoned: a system-zone new Date() can name a different day than Today opens\n const defaultTooltip = format(\n toZoned(new Date(), settings.timeZone),\n settings.i18n.formats.dayTitle,\n { locale: settings.locale },\n );\n return (\n <NavTooltip content={tooltip === undefined ? defaultTooltip : tooltip}>\n <Button\n variant={nav.variant}\n size={nav.size}\n data-slot=\"gantt-nav-today\"\n data-active={isToday || undefined}\n className={cn(className)}\n onClick={today}\n render={render}\n {...props}\n >\n {children ?? settings.i18n.labels.today}\n </Button>\n </NavTooltip>\n );\n}\n\nfunction GanttNavPrev({ className, render, children, tooltip, ...props }: NavButtonProps) {\n const { prev } = useGanttNavigation();\n const settings = useGanttSettings();\n const nav = useNavButtonProps();\n return (\n <NavTooltip content={tooltip === undefined ? settings.i18n.labels.previous : tooltip}>\n <Button\n variant={nav.variant}\n size={nav.iconSize}\n data-slot=\"gantt-nav-prev\"\n aria-label={settings.i18n.labels.previous}\n className={cn(className)}\n onClick={prev}\n render={render}\n {...props}\n >\n {children ?? <ChevronLeftIcon className=\"size-4\" aria-hidden=\"true\" />}\n </Button>\n </NavTooltip>\n );\n}\n\nfunction GanttNavNext({ className, render, children, tooltip, ...props }: NavButtonProps) {\n const { next } = useGanttNavigation();\n const settings = useGanttSettings();\n const nav = useNavButtonProps();\n return (\n <NavTooltip content={tooltip === undefined ? settings.i18n.labels.next : tooltip}>\n <Button\n variant={nav.variant}\n size={nav.iconSize}\n data-slot=\"gantt-nav-next\"\n aria-label={settings.i18n.labels.next}\n className={cn(className)}\n onClick={next}\n render={render}\n {...props}\n >\n {children ?? <ChevronRightIcon className=\"size-4\" aria-hidden=\"true\" />}\n </Button>\n </NavTooltip>\n );\n}\n\ninterface GanttTitleProps extends useRender.ComponentProps<\"div\"> {\n format?: (ctx: { title: string }) => ReactNode;\n}\n\nfunction GanttTitle({ className, render, format: formatTitle, ...props }: GanttTitleProps) {\n const { title } = useGanttNavigation();\n const defaultProps = {\n \"data-slot\": \"gantt-title\",\n \"aria-live\": \"polite\" as const,\n className: cn(\"min-w-0 truncate font-semibold text-sm\", className),\n children: formatTitle?.({ title }) ?? title,\n };\n return useRender({\n defaultTagName: \"div\",\n render,\n props: mergeProps<\"div\">(defaultProps, props),\n });\n}\n\ninterface GanttScaleSwitcherProps extends Omit<useRender.ComponentProps<\"button\">, \"children\"> {\n children?: ReactNode;\n /** Hover/focus-visible hint; defaults to the \"Select view\" label. Pass\n * null to disable (overlay-opener policy). */\n tooltip?: ReactNode | null;\n /** The offered scales, in menu order. Default: all five. */\n scales?: GanttScale[];\n}\n\n/**\n * Scale switcher (\"Select view\"): Day / Week / Month / Quarter / Year, a ghost\n * dropdown button (same shape as the event-calendar view switcher).\n */\nfunction GanttScaleSwitcher({\n className,\n render,\n children,\n tooltip,\n scales = GANTT_SCALES,\n ...props\n}: GanttScaleSwitcherProps) {\n const { scale, setScale } = useGanttScale();\n const settings = useGanttSettings();\n const nav = useNavButtonProps();\n const labels = settings.i18n.labels;\n // Controlled open: selecting a scale swaps the whole track subtree in the\n // same click, so closing must not depend on the menu's internal handler.\n const [open, setOpen] = useState(false);\n // Hover-only tooltip: when the menu closes, Base UI focuses the trigger\n // again and a focus-opened tooltip would flash - ignore focus opens.\n const [tipOpen, setTipOpen] = useState(false);\n\n const selectScale = (next: GanttScale) => {\n setOpen(false);\n setScale(next);\n };\n\n return (\n <DropdownMenu\n open={open}\n onOpenChange={(next: boolean) => {\n setOpen(next);\n if (next) setTipOpen(false);\n }}\n >\n {/* Tooltip on an overlay-opener: hover-only (focus opens ignored) and\n force-closed while the menu is up, so it never lingers or flashes\n when focus returns on close. */}\n <Tooltip\n open={tipOpen && !open}\n onOpenChange={(next: boolean, details: { reason?: string }) => {\n // opens are hover-only; the trigger-focus open that follows a\n // menu close is ignored, closes always land\n if (next && details?.reason !== \"trigger-hover\") return;\n setTipOpen(next);\n }}\n >\n <DropdownMenuTrigger\n render={\n <TooltipTrigger\n render={\n <Button\n variant={nav.variant}\n size={nav.size}\n data-slot=\"gantt-scale-switcher\"\n aria-label={labels.selectView}\n className={cn(\"gap-1\", className)}\n />\n }\n />\n }\n {...props}\n >\n {children ?? (\n <>\n {labels.scales[scale]}\n <ChevronDownIcon className=\"size-4 opacity-60\" aria-hidden=\"true\" />\n </>\n )}\n </DropdownMenuTrigger>\n {tipOpen && !open && tooltip !== null && (\n <TooltipContent side=\"bottom\">{tooltip ?? labels.selectView}</TooltipContent>\n )}\n </Tooltip>\n <DropdownMenuContent align=\"start\" className=\"min-w-36\">\n {/* Base UI contract: GroupLabel must live inside Menu.Group */}\n <DropdownMenuGroup>\n <DropdownMenuLabel className=\"font-normal text-muted-foreground\">\n {labels.selectView}\n </DropdownMenuLabel>\n {scales.map((value) => (\n <DropdownMenuItem\n key={value}\n data-active={scale === value || undefined}\n onClick={() => selectScale(value)}\n >\n {labels.scales[value]}\n </DropdownMenuItem>\n ))}\n </DropdownMenuGroup>\n </DropdownMenuContent>\n </DropdownMenu>\n );\n}\n\ninterface GanttDatePickerProps {\n className?: string;\n}\n\n/**\n * Compact go-to-date picker (shadcn Calendar in a popover). No tooltip by\n * design: it opens an overlay (see the NavButtonProps tooltip policy).\n */\nfunction GanttDatePicker({ className }: GanttDatePickerProps) {\n const { date, goTo } = useGanttNavigation();\n const settings = useGanttSettings();\n const nav = useNavButtonProps();\n const [open, setOpen] = useState(false);\n const zoned = toZoned(date, settings.timeZone);\n\n return (\n <Popover open={open} onOpenChange={setOpen}>\n <PopoverTrigger\n render={\n <Button\n variant={nav.variant}\n size={nav.iconSize}\n data-slot=\"gantt-date-picker\"\n aria-label={settings.i18n.labels.goToDate}\n className={cn(className)}\n />\n }\n >\n <CalendarIcon className=\"size-4\" aria-hidden=\"true\" />\n </PopoverTrigger>\n <PopoverContent align=\"start\" className=\"w-auto p-0!\">\n <Calendar\n mode=\"single\"\n selected={zoned}\n defaultMonth={zoned}\n locale={settings.locale}\n weekStartsOn={settings.weekStartsOn}\n onSelect={(next: Date | undefined) => {\n if (next) {\n goTo(next);\n setOpen(false);\n }\n }}\n />\n </PopoverContent>\n </Popover>\n );\n}\n\ntype GanttToolbarProps = useRender.ComponentProps<\"div\">;\n\n/** Free slot for consumer toolbar buttons; pure layout shell. */\nfunction GanttToolbar({ className, render, ...props }: GanttToolbarProps) {\n const viewConfig = useGanttViewConfig();\n const defaultProps = {\n \"data-slot\": \"gantt-toolbar\",\n className: cn(\"flex items-center gap-2\", viewConfig.classNames?.toolbar, className),\n children: props.children,\n };\n return useRender({\n defaultTagName: \"div\",\n render,\n props: mergeProps<\"div\">(defaultProps, props),\n });\n}\n\ntype GanttNavProps = useRender.ComponentProps<\"div\">;\n\n/**\n * Default composed nav (event-calendar parity): Today, time-period switcher,\n * prev/next, title, spacer. GanttDatePicker stays available for custom\n * compositions. Pass children to use it as a pure layout shell instead.\n */\nfunction GanttNav({ className, render, children, ...props }: GanttNavProps) {\n const viewConfig = useGanttViewConfig();\n const defaultProps = {\n \"data-slot\": \"gantt-nav\",\n className: cn(\n // px so the toolbar controls do not hug the container edge; border-b\n // separates the toolbar from the column header below it\n \"flex min-w-0 flex-wrap items-center gap-2 border-b px-3 py-2\",\n viewConfig.stickyNav && \"sticky top-0 z-30 bg-background\",\n viewConfig.classNames?.nav,\n className,\n ),\n children: children ?? (\n // Shared provider: first tooltip waits, moving between buttons is instant\n <TooltipProvider delay={600} closeDelay={0} timeout={300}>\n <GanttNavToday />\n <GanttScaleSwitcher />\n <div className=\"flex items-center\">\n <GanttNavPrev />\n <GanttNavNext />\n </div>\n <GanttTitle />\n <div className=\"grow\" />\n </TooltipProvider>\n ),\n };\n return useRender({\n defaultTagName: \"div\",\n render,\n props: mergeProps<\"div\">(defaultProps, props),\n });\n}\n\nexport type { GanttNavProps, GanttScaleSwitcherProps, GanttTitleProps, GanttToolbarProps };\nexport {\n GANTT_SCALES,\n GanttDatePicker,\n GanttNav,\n GanttNavNext,\n GanttNavPrev,\n GanttNavToday,\n GanttScaleSwitcher,\n GanttTitle,\n GanttToolbar,\n};\n"],"mappings":";;;;;;;;;;;;;;;;AAyBA,MAAM,eAA6B;CAAC;CAAO;CAAQ;CAAS;CAAW;AAAM;;AAG7E,SAAS,oBAIP;CACA,MAAM,aAAa,mBAAmB;CACtC,OAAO;EACL,SAAS,WAAW;EACpB,MAAM,WAAW;EACjB,UAAU,WAAW,kBAAkB,OAAO,YAAY;CAC5D;AACF;;AAgBA,SAAS,WAAW,EAClB,SACA,YAIC;CACD,IAAI,YAAY,QAAQ,YAAY,KAAA,GAAW,OAAO;CACtD,OACE,qBAAC,SAAD,EAAA,UAAA,CACE,oBAAC,gBAAD,EAAgB,QAAQ,SAAW,CAAA,GACnC,oBAAC,gBAAD;EAAgB,MAAK;EAAU,UAAA;CAAwB,CAAA,CAChD,EAAA,CAAA;AAEb;AAEA,SAAS,cAAc,EAAE,WAAW,QAAQ,UAAU,SAAS,GAAG,SAAyB;CACzF,MAAM,EAAE,OAAO,YAAY,mBAAmB;CAC9C,MAAM,WAAW,iBAAiB;CAClC,MAAM,MAAM,kBAAkB;CAE9B,MAAM,iBAAiB,OACrB,wBAAQ,IAAI,KAAK,GAAG,SAAS,QAAQ,GACrC,SAAS,KAAK,QAAQ,UACtB,EAAE,QAAQ,SAAS,OAAO,CAC5B;CACA,OACE,oBAAC,YAAD;EAAY,SAAS,YAAY,KAAA,IAAY,iBAAiB;EAC5D,UAAA,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AChB;EACA,OAAO,WAAkB;GAPzB,aAAa;GACb,WAAW,GAAG,2BAHG,mBAGiC,CAAC,CAAC,YAAY,SAAS,SAAS;GAClF,UAAU,MAAM;EAKoB,GAAG,KAAK;CAC9C,CAAC;AACH;;;;;;AASA,SAAS,SAAS,EAAE,WAAW,QAAQ,UAAU,GAAG,SAAwB;CAC1E,MAAM,aAAa,mBAAmB;CAyBtC,OAAO,UAAU;EACf,gBAAgB;EAChB;EACA,OAAO,WAAkB;GA1BzB,aAAa;GACb,WAAW,GAGT,gEACA,WAAW,aAAa,mCACxB,WAAW,YAAY,KACvB,SACF;GACA,UAAU,YAER,qBAAC,iBAAD;IAAiB,OAAO;IAAK,YAAY;IAAG,SAAS;IAArD,UAAA;KACE,oBAAC,eAAD,CAAgB,CAAA;KAChB,oBAAC,oBAAD,CAAqB,CAAA;KACrB,qBAAC,OAAD;MAAK,WAAU;MAAf,UAAA,CACE,oBAAC,cAAD,CAAe,CAAA,GACf,oBAAC,cAAD,CAAe,CAAA,CACZ;;KACL,oBAAC,YAAD,CAAa,CAAA;KACb,oBAAC,OAAD,EAAK,WAAU,OAAQ,CAAA;IACR;;EAMiB,GAAG,KAAK;CAC9C,CAAC;AACH"}
1
+ {"version":3,"file":"gantt-nav.js","names":[],"sources":["../../../../src/components/reui/gantt/gantt-nav.tsx"],"sourcesContent":["\"use client\";\n\nimport { type ReactNode, useState } from \"react\";\nimport { mergeProps } from \"@base-ui/react/merge-props\";\nimport { useRender } from \"@base-ui/react/use-render\";\nimport { format } from \"date-fns\";\nimport { CalendarIcon, ChevronDownIcon, ChevronLeftIcon, ChevronRightIcon } from \"lucide-react\";\n\nimport { cn } from \"@kumix/utils\";\nimport { Button } from \"../../ui/button\";\nimport { Calendar } from \"../../ui/calendar\";\nimport {\n DropdownMenu,\n DropdownMenuContent,\n DropdownMenuGroup,\n DropdownMenuItem,\n DropdownMenuLabel,\n DropdownMenuTrigger,\n} from \"../../ui/dropdown-menu\";\nimport { Popover, PopoverContent, PopoverTrigger } from \"../../ui/popover\";\nimport { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from \"../../ui/tooltip\";\nimport { useGanttNavigation, useGanttScale, useGanttSettings, useGanttViewConfig } from \"./gantt\";\nimport { toZoned } from \"./gantt-lib\";\nimport type { GanttScale } from \"./gantt-types\";\n\nconst GANTT_SCALES: GanttScale[] = [\"day\", \"week\", \"month\", \"quarter\", \"year\"];\n\n/** Configured nav button variant/size (viewConfig.navButtonVariant/Size). */\nfunction useNavButtonProps(): {\n variant: \"ghost\" | \"outline\" | \"secondary\" | \"default\";\n size: \"sm\" | \"default\";\n iconSize: \"icon-sm\" | \"icon\";\n} {\n const viewConfig = useGanttViewConfig();\n return {\n variant: viewConfig.navButtonVariant,\n size: viewConfig.navButtonSize,\n iconSize: viewConfig.navButtonSize === \"sm\" ? \"icon-sm\" : \"icon\",\n };\n}\n\ntype NavButtonProps = Omit<useRender.ComponentProps<\"button\">, \"children\"> & {\n children?: ReactNode;\n /**\n * Tooltip policy (the part that usually goes wrong on clickable elements):\n * tooltips appear ONLY on hover or keyboard focus-visible - a pointer click\n * never re-triggers them, and buttons that open overlays (the period\n * selector, consumer dialog buttons) get NO tooltip at all so nothing\n * flashes when focus returns. Icon-only buttons default to their accessible\n * label; Today defaults to the actual current date. Pass null to disable.\n */\n tooltip?: ReactNode | null;\n};\n\n/** Hover/focus-visible tooltip wrapper; renders the bare button when disabled. */\nfunction NavTooltip({\n content,\n children,\n}: {\n content: ReactNode | null;\n children: React.ReactElement;\n}) {\n if (content === null || content === undefined) return children;\n return (\n <Tooltip>\n <TooltipTrigger render={children} />\n <TooltipContent side=\"bottom\">{content}</TooltipContent>\n </Tooltip>\n );\n}\n\nfunction GanttNavToday({ className, render, children, tooltip, ...props }: NavButtonProps) {\n const { today, isToday } = useGanttNavigation();\n const settings = useGanttSettings();\n const nav = useNavButtonProps();\n // zoned: a system-zone new Date() can name a different day than Today opens\n const defaultTooltip = format(\n toZoned(new Date(), settings.timeZone),\n settings.i18n.formats.dayTitle,\n { locale: settings.locale },\n );\n return (\n <NavTooltip content={tooltip === undefined ? defaultTooltip : tooltip}>\n <Button\n variant={nav.variant}\n size={nav.size}\n data-slot=\"gantt-nav-today\"\n data-active={isToday || undefined}\n className={cn(className)}\n onClick={today}\n render={render}\n {...props}\n >\n {children ?? settings.i18n.labels.today}\n </Button>\n </NavTooltip>\n );\n}\n\nfunction GanttNavPrev({ className, render, children, tooltip, ...props }: NavButtonProps) {\n const { prev } = useGanttNavigation();\n const settings = useGanttSettings();\n const nav = useNavButtonProps();\n return (\n <NavTooltip content={tooltip === undefined ? settings.i18n.labels.previous : tooltip}>\n <Button\n variant={nav.variant}\n size={nav.iconSize}\n data-slot=\"gantt-nav-prev\"\n aria-label={settings.i18n.labels.previous}\n className={cn(className)}\n onClick={prev}\n render={render}\n {...props}\n >\n {children ?? <ChevronLeftIcon className=\"size-4\" aria-hidden=\"true\" />}\n </Button>\n </NavTooltip>\n );\n}\n\nfunction GanttNavNext({ className, render, children, tooltip, ...props }: NavButtonProps) {\n const { next } = useGanttNavigation();\n const settings = useGanttSettings();\n const nav = useNavButtonProps();\n return (\n <NavTooltip content={tooltip === undefined ? settings.i18n.labels.next : tooltip}>\n <Button\n variant={nav.variant}\n size={nav.iconSize}\n data-slot=\"gantt-nav-next\"\n aria-label={settings.i18n.labels.next}\n className={cn(className)}\n onClick={next}\n render={render}\n {...props}\n >\n {children ?? <ChevronRightIcon className=\"size-4\" aria-hidden=\"true\" />}\n </Button>\n </NavTooltip>\n );\n}\n\ninterface GanttTitleProps extends useRender.ComponentProps<\"div\"> {\n format?: (ctx: { title: string }) => ReactNode;\n}\n\nfunction GanttTitle({ className, render, format: formatTitle, ...props }: GanttTitleProps) {\n const { title } = useGanttNavigation();\n const defaultProps = {\n \"data-slot\": \"gantt-title\",\n \"aria-live\": \"polite\" as const,\n className: cn(\"min-w-0 truncate font-semibold text-sm\", className),\n children: formatTitle?.({ title }) ?? title,\n };\n return useRender({\n defaultTagName: \"div\",\n render,\n props: mergeProps<\"div\">(defaultProps, props),\n });\n}\n\ninterface GanttScaleSwitcherProps extends Omit<useRender.ComponentProps<\"button\">, \"children\"> {\n children?: ReactNode;\n /** Hover/focus-visible hint; defaults to the \"Select view\" label. Pass\n * null to disable (overlay-opener policy). */\n tooltip?: ReactNode | null;\n /** The offered scales, in menu order. Default: all five. */\n scales?: GanttScale[];\n}\n\n/**\n * Scale switcher (\"Select view\"): Day / Week / Month / Quarter / Year, a ghost\n * dropdown button (same shape as the event-calendar view switcher).\n */\nfunction GanttScaleSwitcher({\n className,\n render,\n children,\n tooltip,\n scales = GANTT_SCALES,\n ...props\n}: GanttScaleSwitcherProps) {\n const { scale, setScale } = useGanttScale();\n const settings = useGanttSettings();\n const nav = useNavButtonProps();\n const labels = settings.i18n.labels;\n // Controlled open: selecting a scale swaps the whole track subtree in the\n // same click, so closing must not depend on the menu's internal handler.\n const [open, setOpen] = useState(false);\n // Hover-only tooltip: when the menu closes, Base UI focuses the trigger\n // again and a focus-opened tooltip would flash - ignore focus opens.\n const [tipOpen, setTipOpen] = useState(false);\n\n const selectScale = (next: GanttScale) => {\n setOpen(false);\n setScale(next);\n };\n\n return (\n <DropdownMenu\n open={open}\n onOpenChange={(next: boolean) => {\n setOpen(next);\n if (next) setTipOpen(false);\n }}\n >\n {/* Tooltip on an overlay-opener: hover-only (focus opens ignored) and\n force-closed while the menu is up, so it never lingers or flashes\n when focus returns on close. */}\n <Tooltip\n open={tipOpen && !open}\n onOpenChange={(next: boolean, details: { reason?: string }) => {\n // opens are hover-only; the trigger-focus open that follows a\n // menu close is ignored, closes always land\n if (next && details?.reason !== \"trigger-hover\") return;\n setTipOpen(next);\n }}\n >\n <DropdownMenuTrigger\n render={\n <TooltipTrigger\n render={\n <Button\n variant={nav.variant}\n size={nav.size}\n data-slot=\"gantt-scale-switcher\"\n aria-label={labels.selectView}\n className={cn(\"gap-1\", className)}\n />\n }\n />\n }\n {...props}\n >\n {children ?? (\n <>\n {labels.scales[scale]}\n <ChevronDownIcon className=\"size-4 opacity-60\" aria-hidden=\"true\" />\n </>\n )}\n </DropdownMenuTrigger>\n {tipOpen && !open && tooltip !== null && (\n <TooltipContent side=\"bottom\">{tooltip ?? labels.selectView}</TooltipContent>\n )}\n </Tooltip>\n <DropdownMenuContent align=\"start\" className=\"min-w-36\">\n {/* Base UI contract: GroupLabel must live inside Menu.Group */}\n <DropdownMenuGroup>\n <DropdownMenuLabel className=\"font-normal text-muted-foreground\">\n {labels.selectView}\n </DropdownMenuLabel>\n {scales.map((value) => (\n <DropdownMenuItem\n key={value}\n data-active={scale === value || undefined}\n onClick={() => selectScale(value)}\n >\n {labels.scales[value]}\n </DropdownMenuItem>\n ))}\n </DropdownMenuGroup>\n </DropdownMenuContent>\n </DropdownMenu>\n );\n}\n\ninterface GanttDatePickerProps {\n className?: string;\n}\n\n/**\n * Compact go-to-date picker (shadcn Calendar in a popover). No tooltip by\n * design: it opens an overlay (see the NavButtonProps tooltip policy).\n */\nfunction GanttDatePicker({ className }: GanttDatePickerProps) {\n const { date, goTo } = useGanttNavigation();\n const settings = useGanttSettings();\n const nav = useNavButtonProps();\n const [open, setOpen] = useState(false);\n const zoned = toZoned(date, settings.timeZone);\n\n return (\n <Popover open={open} onOpenChange={setOpen}>\n <PopoverTrigger\n render={\n <Button\n variant={nav.variant}\n size={nav.iconSize}\n data-slot=\"gantt-date-picker\"\n aria-label={settings.i18n.labels.goToDate}\n className={cn(className)}\n />\n }\n >\n <CalendarIcon className=\"size-4\" aria-hidden=\"true\" />\n </PopoverTrigger>\n <PopoverContent align=\"start\" className=\"w-auto p-0!\">\n <Calendar\n mode=\"single\"\n selected={zoned}\n defaultMonth={zoned}\n locale={settings.locale}\n weekStartsOn={settings.weekStartsOn}\n onSelect={(next: Date | undefined) => {\n if (next) {\n goTo(next);\n setOpen(false);\n }\n }}\n />\n </PopoverContent>\n </Popover>\n );\n}\n\ntype GanttToolbarProps = useRender.ComponentProps<\"div\">;\n\n/** Free slot for consumer toolbar buttons; pure layout shell. */\nfunction GanttToolbar({ className, render, ...props }: GanttToolbarProps) {\n const viewConfig = useGanttViewConfig();\n const defaultProps = {\n \"data-slot\": \"gantt-toolbar\",\n className: cn(\"flex items-center gap-2\", viewConfig.classNames?.toolbar, className),\n children: props.children,\n };\n return useRender({\n defaultTagName: \"div\",\n render,\n props: mergeProps<\"div\">(defaultProps, props),\n });\n}\n\ntype GanttNavProps = useRender.ComponentProps<\"div\">;\n\n/**\n * Default composed nav (event-calendar parity): Today, time-period switcher,\n * prev/next, title, spacer. GanttDatePicker stays available for custom\n * compositions. Pass children to use it as a pure layout shell instead.\n */\nfunction GanttNav({ className, render, children, ...props }: GanttNavProps) {\n const viewConfig = useGanttViewConfig();\n const defaultProps = {\n \"data-slot\": \"gantt-nav\",\n className: cn(\n // px so the toolbar controls do not hug the container edge; border-b\n // separates the toolbar from the column header below it\n \"flex min-w-0 flex-wrap items-center gap-2 border-b px-3 py-2\",\n viewConfig.stickyNav && \"sticky top-0 z-30 bg-background\",\n viewConfig.classNames?.nav,\n className,\n ),\n children: children ?? (\n // Shared provider: first tooltip waits, moving between buttons is instant\n <TooltipProvider delay={600} closeDelay={0} timeout={300}>\n <GanttNavToday />\n <GanttScaleSwitcher />\n <div className=\"flex items-center\">\n <GanttNavPrev />\n <GanttNavNext />\n </div>\n <GanttTitle />\n <div className=\"grow\" />\n </TooltipProvider>\n ),\n };\n return useRender({\n defaultTagName: \"div\",\n render,\n props: mergeProps<\"div\">(defaultProps, props),\n });\n}\n\nexport type { GanttNavProps, GanttScaleSwitcherProps, GanttTitleProps, GanttToolbarProps };\nexport {\n GANTT_SCALES,\n GanttDatePicker,\n GanttNav,\n GanttNavNext,\n GanttNavPrev,\n GanttNavToday,\n GanttScaleSwitcher,\n GanttTitle,\n GanttToolbar,\n};\n"],"mappings":";;;;;;;;;;;;;;;;AAyBA,MAAM,eAA6B;CAAC;CAAO;CAAQ;CAAS;CAAW;AAAM;;AAG7E,S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AAA;IAChB,oBAAC,oBAAD,CAAqB,CAAA;IACrB,qBAAC,OAAD;KAAK,WAAU;KAAf,UAAA,CACE,oBAAC,cAAD,CAAe,CAAA,GACf,oBAAC,cAAD,CAAe,CAAA,CACZ;;IACL,oBAAC,YAAD,CAAa,CAAA;IACb,oBAAC,OAAD,EAAK,WAAU,OAAQ,CAAA;GACR;;CAErB;CACA,OAAO,UAAU;EACf,gBAAgB;EAChB;EACA,OAAO,WAAkB,cAAc,KAAK;CAC9C,CAAC;AACH"}
@@ -150,8 +150,8 @@ function expandRecurrence(event, range, ctx) {
150
150
  let cursor = zonedStart;
151
151
  const advance = (from, steps) => rule.freq === "daily" ? addDays(from, steps * interval) : rule.freq === "weekly" ? addWeeks(from, steps * interval) : rule.freq === "monthly" ? addMonths(from, steps * interval) : addYears(from, steps * interval);
152
152
  const canFastForward = rule.freq === "daily" || rule.freq === "weekly";
153
- const weekSlackMs = weeklyDays ? 6 * 864e5 : 0;
154
- const maxStepMs = (rule.freq === "daily" ? 24 : rule.freq === "weekly" ? 168 : rule.freq === "monthly" ? 744 : 366 * 24) * 36e5 * interval + 36e5;
153
+ const weekSlackMs = weeklyDays ? 5184e5 : 0;
154
+ const maxStepMs = (rule.freq === "daily" ? 24 : rule.freq === "weekly" ? 168 : rule.freq === "monthly" ? 744 : 8784) * 36e5 * interval + 36e5;
155
155
  for (let pass = 0; canFastForward && pass < 2; pass++) {
156
156
  const gap = range.start.getTime() - durationMs - weekSlackMs - cursor.getTime();
157
157
  const skip = Math.floor(gap / maxStepMs);