@kumix/ui 0.3.13 → 0.3.15

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 (541) hide show
  1. package/README.md +12 -12
  2. package/dist/components/agents/agent-activity/activity-row.js +1 -1
  3. package/dist/components/agents/agent-activity/activity-row.js.map +1 -1
  4. package/dist/components/agents/agent-activity/index.js +1 -1
  5. package/dist/components/agents/agent-activity/index.js.map +1 -1
  6. package/dist/components/agents/agent-code.d.ts.map +1 -1
  7. package/dist/components/agents/agent-code.js +1 -1
  8. package/dist/components/agents/agent-code.js.map +1 -1
  9. package/dist/components/agents/agent-disclosure.js +1 -1
  10. package/dist/components/agents/agent-disclosure.js.map +1 -1
  11. package/dist/components/agents/ai-sidebar.js +1 -1
  12. package/dist/components/agents/ai-sidebar.js.map +1 -1
  13. package/dist/components/agents/approval-card/index.js +1 -1
  14. package/dist/components/agents/approval-card/index.js.map +1 -1
  15. package/dist/components/agents/chat-app.js +1 -1
  16. package/dist/components/agents/chat-app.js.map +1 -1
  17. package/dist/components/agents/citations.js +1 -1
  18. package/dist/components/agents/citations.js.map +1 -1
  19. package/dist/components/agents/code-block.js +1 -1
  20. package/dist/components/agents/code-block.js.map +1 -1
  21. package/dist/components/agents/file-diff.js +1 -1
  22. package/dist/components/agents/file-diff.js.map +1 -1
  23. package/dist/components/agents/image-generation.js +1 -1
  24. package/dist/components/agents/image-generation.js.map +1 -1
  25. package/dist/components/agents/loading-states/agent-progress.js +1 -1
  26. package/dist/components/agents/loading-states/agent-progress.js.map +1 -1
  27. package/dist/components/agents/loading-states/reasoning-text.js +1 -1
  28. package/dist/components/agents/loading-states/reasoning-text.js.map +1 -1
  29. package/dist/components/agents/loading-states/thinking-shimmer.js +1 -1
  30. package/dist/components/agents/loading-states/thinking-shimmer.js.map +1 -1
  31. package/dist/components/agents/message-bubble.js +1 -1
  32. package/dist/components/agents/message-bubble.js.map +1 -1
  33. package/dist/components/agents/message-scroller.js +1 -1
  34. package/dist/components/agents/message-scroller.js.map +1 -1
  35. package/dist/components/agents/message.js +1 -1
  36. package/dist/components/agents/message.js.map +1 -1
  37. package/dist/components/agents/prompt-input.js +1 -1
  38. package/dist/components/agents/prompt-input.js.map +1 -1
  39. package/dist/components/agents/streaming-response.js +1 -1
  40. package/dist/components/agents/streaming-response.js.map +1 -1
  41. package/dist/components/agents/todo-list.js +1 -1
  42. package/dist/components/agents/todo-list.js.map +1 -1
  43. package/dist/components/agents/tool-approval.js +1 -1
  44. package/dist/components/agents/tool-approval.js.map +1 -1
  45. package/dist/components/agents/tool-result.js +1 -1
  46. package/dist/components/agents/tool-result.js.map +1 -1
  47. package/dist/components/motion/action-swap.js +1 -1
  48. package/dist/components/motion/action-swap.js.map +1 -1
  49. package/dist/components/motion/adaptive-stepper.js +1 -1
  50. package/dist/components/motion/adaptive-stepper.js.map +1 -1
  51. package/dist/components/motion/animated-badge.js +1 -1
  52. package/dist/components/motion/animated-badge.js.map +1 -1
  53. package/dist/components/motion/animated-number.js +1 -1
  54. package/dist/components/motion/animated-number.js.map +1 -1
  55. package/dist/components/motion/animated-sidebar.js +1 -1
  56. package/dist/components/motion/animated-sidebar.js.map +1 -1
  57. package/dist/components/motion/animated-toast-stack.js +5 -4
  58. package/dist/components/motion/animated-toast-stack.js.map +1 -1
  59. package/dist/components/motion/attachment-upload.js +1 -1
  60. package/dist/components/motion/attachment-upload.js.map +1 -1
  61. package/dist/components/motion/availability-scheduler/icon-button.js +1 -1
  62. package/dist/components/motion/availability-scheduler/icon-button.js.map +1 -1
  63. package/dist/components/motion/availability-scheduler/index.js +1 -1
  64. package/dist/components/motion/availability-scheduler/index.js.map +1 -1
  65. package/dist/components/motion/bloom-menu.js +1 -1
  66. package/dist/components/motion/bloom-menu.js.map +1 -1
  67. package/dist/components/motion/bottom-sheet.js +1 -1
  68. package/dist/components/motion/bottom-sheet.js.map +1 -1
  69. package/dist/components/motion/bounce-sidebar.d.ts.map +1 -1
  70. package/dist/components/motion/bounce-sidebar.js +1 -1
  71. package/dist/components/motion/bounce-sidebar.js.map +1 -1
  72. package/dist/components/motion/bouncy-accordion.js +1 -1
  73. package/dist/components/motion/bouncy-accordion.js.map +1 -1
  74. package/dist/components/motion/button/base.js +1 -1
  75. package/dist/components/motion/button/base.js.map +1 -1
  76. package/dist/components/motion/button/metallic.js +1 -1
  77. package/dist/components/motion/button/metallic.js.map +1 -1
  78. package/dist/components/motion/card-folder.js +1 -1
  79. package/dist/components/motion/card-folder.js.map +1 -1
  80. package/dist/components/motion/center-morph-modal.js +1 -1
  81. package/dist/components/motion/center-morph-modal.js.map +1 -1
  82. package/dist/components/motion/checkbox.js +1 -1
  83. package/dist/components/motion/checkbox.js.map +1 -1
  84. package/dist/components/motion/chromatic-text-reveal.js +1 -1
  85. package/dist/components/motion/chromatic-text-reveal.js.map +1 -1
  86. package/dist/components/motion/combobox/content.js +1 -1
  87. package/dist/components/motion/combobox/content.js.map +1 -1
  88. package/dist/components/motion/combobox/context.js +1 -1
  89. package/dist/components/motion/combobox/context.js.map +1 -1
  90. package/dist/components/motion/combobox/list.js +1 -1
  91. package/dist/components/motion/combobox/list.js.map +1 -1
  92. package/dist/components/motion/combobox/trigger.js +1 -1
  93. package/dist/components/motion/combobox/trigger.js.map +1 -1
  94. package/dist/components/motion/command-palette.d.ts.map +1 -1
  95. package/dist/components/motion/command-palette.js +3 -22
  96. package/dist/components/motion/command-palette.js.map +1 -1
  97. package/dist/components/motion/context-menu.js +1 -1
  98. package/dist/components/motion/context-menu.js.map +1 -1
  99. package/dist/components/motion/cylinder-carousel.js +1 -1
  100. package/dist/components/motion/cylinder-carousel.js.map +1 -1
  101. package/dist/components/motion/digit-swap.js +1 -1
  102. package/dist/components/motion/digit-swap.js.map +1 -1
  103. package/dist/components/motion/dock.js +1 -1
  104. package/dist/components/motion/dock.js.map +1 -1
  105. package/dist/components/motion/drawer.js +1 -1
  106. package/dist/components/motion/drawer.js.map +1 -1
  107. package/dist/components/motion/dynamic-island.js +1 -1
  108. package/dist/components/motion/dynamic-island.js.map +1 -1
  109. package/dist/components/motion/expandable-action-bar.js +1 -1
  110. package/dist/components/motion/expandable-action-bar.js.map +1 -1
  111. package/dist/components/motion/expandable-control.d.ts.map +1 -1
  112. package/dist/components/motion/expandable-control.js +1 -1
  113. package/dist/components/motion/expandable-control.js.map +1 -1
  114. package/dist/components/motion/expandable-tabs.js +1 -1
  115. package/dist/components/motion/expandable-tabs.js.map +1 -1
  116. package/dist/components/motion/expanding-arrow-button.js +1 -1
  117. package/dist/components/motion/expanding-arrow-button.js.map +1 -1
  118. package/dist/components/motion/feedback-widget.js +1 -1
  119. package/dist/components/motion/feedback-widget.js.map +1 -1
  120. package/dist/components/motion/file-tree.js +1 -1
  121. package/dist/components/motion/file-tree.js.map +1 -1
  122. package/dist/components/motion/file-upload.js +1 -1
  123. package/dist/components/motion/file-upload.js.map +1 -1
  124. package/dist/components/motion/hold-action-button.js +1 -1
  125. package/dist/components/motion/hold-action-button.js.map +1 -1
  126. package/dist/components/motion/infinite-masonry.js +1 -1
  127. package/dist/components/motion/infinite-masonry.js.map +1 -1
  128. package/dist/components/motion/input.d.ts.map +1 -1
  129. package/dist/components/motion/input.js +1 -1
  130. package/dist/components/motion/input.js.map +1 -1
  131. package/dist/components/motion/liquid.js +1 -1
  132. package/dist/components/motion/liquid.js.map +1 -1
  133. package/dist/components/motion/loader.js +1 -1
  134. package/dist/components/motion/loader.js.map +1 -1
  135. package/dist/components/motion/magnetic.js +1 -1
  136. package/dist/components/motion/magnetic.js.map +1 -1
  137. package/dist/components/motion/marquee.d.ts.map +1 -1
  138. package/dist/components/motion/marquee.js +1 -1
  139. package/dist/components/motion/marquee.js.map +1 -1
  140. package/dist/components/motion/morphing-modal.js +1 -1
  141. package/dist/components/motion/morphing-modal.js.map +1 -1
  142. package/dist/components/motion/morphing-search.js +1 -1
  143. package/dist/components/motion/morphing-search.js.map +1 -1
  144. package/dist/components/motion/morphing-tabs.js +1 -1
  145. package/dist/components/motion/morphing-tabs.js.map +1 -1
  146. package/dist/components/motion/multi-select/content.js +1 -1
  147. package/dist/components/motion/multi-select/content.js.map +1 -1
  148. package/dist/components/motion/multi-select/context.js +1 -1
  149. package/dist/components/motion/multi-select/context.js.map +1 -1
  150. package/dist/components/motion/multi-select/list.js +1 -1
  151. package/dist/components/motion/multi-select/list.js.map +1 -1
  152. package/dist/components/motion/multi-select/trigger.js +1 -1
  153. package/dist/components/motion/multi-select/trigger.js.map +1 -1
  154. package/dist/components/motion/not-found/magnetic.d.ts.map +1 -1
  155. package/dist/components/motion/not-found/magnetic.js +1 -1
  156. package/dist/components/motion/not-found/magnetic.js.map +1 -1
  157. package/dist/components/motion/not-found/shared.js +1 -1
  158. package/dist/components/motion/not-found/shared.js.map +1 -1
  159. package/dist/components/motion/not-found/spotlight.js +1 -1
  160. package/dist/components/motion/not-found/spotlight.js.map +1 -1
  161. package/dist/components/motion/notification-stack.js +1 -1
  162. package/dist/components/motion/notification-stack.js.map +1 -1
  163. package/dist/components/motion/number-ticker.js +1 -1
  164. package/dist/components/motion/number-ticker.js.map +1 -1
  165. package/dist/components/motion/otp-input.js +1 -1
  166. package/dist/components/motion/otp-input.js.map +1 -1
  167. package/dist/components/motion/overflow-actions.js +1 -1
  168. package/dist/components/motion/overflow-actions.js.map +1 -1
  169. package/dist/components/motion/parallax.d.ts.map +1 -1
  170. package/dist/components/motion/parallax.js +1 -1
  171. package/dist/components/motion/parallax.js.map +1 -1
  172. package/dist/components/motion/popover-morph.js +1 -1
  173. package/dist/components/motion/popover-morph.js.map +1 -1
  174. package/dist/components/motion/popover.js +1 -1
  175. package/dist/components/motion/popover.js.map +1 -1
  176. package/dist/components/motion/preview-rail.js +1 -1
  177. package/dist/components/motion/preview-rail.js.map +1 -1
  178. package/dist/components/motion/project-folder.js +1 -1
  179. package/dist/components/motion/project-folder.js.map +1 -1
  180. package/dist/components/motion/pull-to-refresh.js +1 -1
  181. package/dist/components/motion/pull-to-refresh.js.map +1 -1
  182. package/dist/components/motion/radio.js +1 -1
  183. package/dist/components/motion/radio.js.map +1 -1
  184. package/dist/components/motion/range-slider-bubble.js +1 -1
  185. package/dist/components/motion/range-slider-bubble.js.map +1 -1
  186. package/dist/components/motion/range-slider-fluid.js +1 -1
  187. package/dist/components/motion/range-slider-fluid.js.map +1 -1
  188. package/dist/components/motion/range-slider-inline.d.ts +18 -0
  189. package/dist/components/motion/range-slider-inline.d.ts.map +1 -0
  190. package/dist/components/motion/range-slider-inline.js +267 -0
  191. package/dist/components/motion/range-slider-inline.js.map +1 -0
  192. package/dist/components/motion/range-slider-ruler.js +1 -1
  193. package/dist/components/motion/range-slider-ruler.js.map +1 -1
  194. package/dist/components/motion/range-slider-wave.js +1 -1
  195. package/dist/components/motion/range-slider-wave.js.map +1 -1
  196. package/dist/components/motion/range-slider.d.ts.map +1 -1
  197. package/dist/components/motion/range-slider.js +27 -11
  198. package/dist/components/motion/range-slider.js.map +1 -1
  199. package/dist/components/motion/scroll-progress.js +1 -1
  200. package/dist/components/motion/scroll-progress.js.map +1 -1
  201. package/dist/components/motion/scroll-reveal.js +1 -1
  202. package/dist/components/motion/scroll-reveal.js.map +1 -1
  203. package/dist/components/motion/scroll-to.js +1 -1
  204. package/dist/components/motion/scroll-to.js.map +1 -1
  205. package/dist/components/motion/select-morph.d.ts.map +1 -1
  206. package/dist/components/motion/select-morph.js +1 -1
  207. package/dist/components/motion/select-morph.js.map +1 -1
  208. package/dist/components/motion/select.js +1 -1
  209. package/dist/components/motion/select.js.map +1 -1
  210. package/dist/components/motion/shader-background.d.ts.map +1 -1
  211. package/dist/components/motion/shader-background.js +1 -1
  212. package/dist/components/motion/shader-background.js.map +1 -1
  213. package/dist/components/motion/shared-layout-bg.js +1 -1
  214. package/dist/components/motion/shared-layout-bg.js.map +1 -1
  215. package/dist/components/motion/signup-form.js +1 -1
  216. package/dist/components/motion/signup-form.js.map +1 -1
  217. package/dist/components/motion/slide-action-button.js +1 -1
  218. package/dist/components/motion/slide-action-button.js.map +1 -1
  219. package/dist/components/motion/swipeable-list.js +1 -1
  220. package/dist/components/motion/swipeable-list.js.map +1 -1
  221. package/dist/components/motion/switch.d.ts.map +1 -1
  222. package/dist/components/motion/switch.js +1 -1
  223. package/dist/components/motion/switch.js.map +1 -1
  224. package/dist/components/motion/table/index.js +1 -1
  225. package/dist/components/motion/table/index.js.map +1 -1
  226. package/dist/components/motion/table/skeleton-rows.d.ts.map +1 -1
  227. package/dist/components/motion/table/skeleton-rows.js +1 -1
  228. package/dist/components/motion/table/skeleton-rows.js.map +1 -1
  229. package/dist/components/motion/table/table-header.js +1 -1
  230. package/dist/components/motion/table/table-header.js.map +1 -1
  231. package/dist/components/motion/table/table-menu.js +1 -1
  232. package/dist/components/motion/table/table-menu.js.map +1 -1
  233. package/dist/components/motion/tabs.js +2 -2
  234. package/dist/components/motion/tabs.js.map +1 -1
  235. package/dist/components/motion/text-reveal.js +1 -1
  236. package/dist/components/motion/text-reveal.js.map +1 -1
  237. package/dist/components/motion/text-scramble.d.ts.map +1 -1
  238. package/dist/components/motion/text-scramble.js +1 -1
  239. package/dist/components/motion/text-scramble.js.map +1 -1
  240. package/dist/components/motion/text-shimmer.js +1 -1
  241. package/dist/components/motion/text-shimmer.js.map +1 -1
  242. package/dist/components/motion/theme-toggle.js +1 -1
  243. package/dist/components/motion/theme-toggle.js.map +1 -1
  244. package/dist/components/motion/tilt-card.js +1 -1
  245. package/dist/components/motion/tilt-card.js.map +1 -1
  246. package/dist/components/motion/tooltip-surface.d.ts +12 -0
  247. package/dist/components/motion/tooltip-surface.d.ts.map +1 -0
  248. package/dist/components/motion/tooltip-surface.js +97 -0
  249. package/dist/components/motion/tooltip-surface.js.map +1 -0
  250. package/dist/components/motion/tooltip.d.ts +13 -3
  251. package/dist/components/motion/tooltip.d.ts.map +1 -1
  252. package/dist/components/motion/tooltip.js +75 -104
  253. package/dist/components/motion/tooltip.js.map +1 -1
  254. package/dist/components/motion/wheel-picker.js +1 -1
  255. package/dist/components/motion/wheel-picker.js.map +1 -1
  256. package/dist/components/reui/alert.d.ts +1 -1
  257. package/dist/components/reui/alert.d.ts.map +1 -1
  258. package/dist/components/reui/alert.js +1 -1
  259. package/dist/components/reui/alert.js.map +1 -1
  260. package/dist/components/reui/autocomplete.d.ts +1 -1
  261. package/dist/components/reui/autocomplete.d.ts.map +1 -1
  262. package/dist/components/reui/autocomplete.js +2 -2
  263. package/dist/components/reui/autocomplete.js.map +1 -1
  264. package/dist/components/reui/badge.d.ts +2 -2
  265. package/dist/components/reui/badge.d.ts.map +1 -1
  266. package/dist/components/reui/badge.js +1 -1
  267. package/dist/components/reui/badge.js.map +1 -1
  268. package/dist/components/reui/cascader/cascader-columns.js +1 -1
  269. package/dist/components/reui/cascader/cascader-columns.js.map +1 -1
  270. package/dist/components/reui/cascader/cascader-footer.js +1 -1
  271. package/dist/components/reui/cascader/cascader-footer.js.map +1 -1
  272. package/dist/components/reui/cascader/cascader-item.js +1 -1
  273. package/dist/components/reui/cascader/cascader-item.js.map +1 -1
  274. package/dist/components/reui/cascader/cascader-nav.js +1 -1
  275. package/dist/components/reui/cascader/cascader-nav.js.map +1 -1
  276. package/dist/components/reui/cascader/cascader.js +1 -1
  277. package/dist/components/reui/cascader/cascader.js.map +1 -1
  278. package/dist/components/reui/code-block/code-block.js +1 -1
  279. package/dist/components/reui/code-block/code-block.js.map +1 -1
  280. package/dist/components/reui/data-grid/data-grid-cell-selection.js +1 -1
  281. package/dist/components/reui/data-grid/data-grid-cell-selection.js.map +1 -1
  282. package/dist/components/reui/data-grid/data-grid-column-filter.js +1 -1
  283. package/dist/components/reui/data-grid/data-grid-column-filter.js.map +1 -1
  284. package/dist/components/reui/data-grid/data-grid-column-header.js +1 -1
  285. package/dist/components/reui/data-grid/data-grid-column-header.js.map +1 -1
  286. package/dist/components/reui/data-grid/data-grid-pagination.js +1 -1
  287. package/dist/components/reui/data-grid/data-grid-pagination.js.map +1 -1
  288. package/dist/components/reui/data-grid/data-grid-scroll-area.js +1 -1
  289. package/dist/components/reui/data-grid/data-grid-scroll-area.js.map +1 -1
  290. package/dist/components/reui/data-grid/data-grid-table-dnd-rows.js +1 -1
  291. package/dist/components/reui/data-grid/data-grid-table-dnd-rows.js.map +1 -1
  292. package/dist/components/reui/data-grid/data-grid-table-virtual.js +1 -1
  293. package/dist/components/reui/data-grid/data-grid-table-virtual.js.map +1 -1
  294. package/dist/components/reui/data-grid/data-grid-table.js +1 -1
  295. package/dist/components/reui/data-grid/data-grid-table.js.map +1 -1
  296. package/dist/components/reui/data-grid/data-grid.js +1 -1
  297. package/dist/components/reui/data-grid/data-grid.js.map +1 -1
  298. package/dist/components/reui/date-selector.js +1 -1
  299. package/dist/components/reui/date-selector.js.map +1 -1
  300. package/dist/components/reui/event-calendar/event-calendar-agenda-view.js +1 -1
  301. package/dist/components/reui/event-calendar/event-calendar-agenda-view.js.map +1 -1
  302. package/dist/components/reui/event-calendar/event-calendar-content.js +1 -1
  303. package/dist/components/reui/event-calendar/event-calendar-content.js.map +1 -1
  304. package/dist/components/reui/event-calendar/event-calendar-event.js +1 -1
  305. package/dist/components/reui/event-calendar/event-calendar-event.js.map +1 -1
  306. package/dist/components/reui/event-calendar/event-calendar-month-view.js +1 -1
  307. package/dist/components/reui/event-calendar/event-calendar-month-view.js.map +1 -1
  308. package/dist/components/reui/event-calendar/event-calendar-nav.js +1 -1
  309. package/dist/components/reui/event-calendar/event-calendar-nav.js.map +1 -1
  310. package/dist/components/reui/event-calendar/event-calendar-resource-view.js +1 -1
  311. package/dist/components/reui/event-calendar/event-calendar-resource-view.js.map +1 -1
  312. package/dist/components/reui/event-calendar/event-calendar-time-grid.js +1 -1
  313. package/dist/components/reui/event-calendar/event-calendar-time-grid.js.map +1 -1
  314. package/dist/components/reui/event-calendar/event-calendar.js +1 -1
  315. package/dist/components/reui/event-calendar/event-calendar.js.map +1 -1
  316. package/dist/components/reui/filters/filters-advanced.js +1 -1
  317. package/dist/components/reui/filters/filters-advanced.js.map +1 -1
  318. package/dist/components/reui/filters/filters-builder.js +1 -1
  319. package/dist/components/reui/filters/filters-builder.js.map +1 -1
  320. package/dist/components/reui/filters/filters-chip.js +1 -1
  321. package/dist/components/reui/filters/filters-chip.js.map +1 -1
  322. package/dist/components/reui/filters/filters-editors.js +1 -1
  323. package/dist/components/reui/filters/filters-editors.js.map +1 -1
  324. package/dist/components/reui/filters/filters.js +1 -1
  325. package/dist/components/reui/filters/filters.js.map +1 -1
  326. package/dist/components/reui/frame.d.ts +6 -12
  327. package/dist/components/reui/frame.d.ts.map +1 -1
  328. package/dist/components/reui/frame.js +10 -17
  329. package/dist/components/reui/frame.js.map +1 -1
  330. package/dist/components/reui/gantt/gantt-bar.js +1 -1
  331. package/dist/components/reui/gantt/gantt-bar.js.map +1 -1
  332. package/dist/components/reui/gantt/gantt-nav.js +1 -1
  333. package/dist/components/reui/gantt/gantt-nav.js.map +1 -1
  334. package/dist/components/reui/gantt/gantt-view.js +1 -1
  335. package/dist/components/reui/gantt/gantt-view.js.map +1 -1
  336. package/dist/components/reui/gantt/gantt.js +1 -1
  337. package/dist/components/reui/gantt/gantt.js.map +1 -1
  338. package/dist/components/reui/icon-stack.js +1 -1
  339. package/dist/components/reui/icon-stack.js.map +1 -1
  340. package/dist/components/reui/icon-tile.d.ts +2 -2
  341. package/dist/components/reui/icon-tile.d.ts.map +1 -1
  342. package/dist/components/reui/icon-tile.js +1 -1
  343. package/dist/components/reui/icon-tile.js.map +1 -1
  344. package/dist/components/reui/kanban.d.ts.map +1 -1
  345. package/dist/components/reui/kanban.js +1 -1
  346. package/dist/components/reui/kanban.js.map +1 -1
  347. package/dist/components/reui/number-field.d.ts +3 -3
  348. package/dist/components/reui/number-field.d.ts.map +1 -1
  349. package/dist/components/reui/number-field.js +4 -4
  350. package/dist/components/reui/number-field.js.map +1 -1
  351. package/dist/components/reui/phone-input.js +1 -1
  352. package/dist/components/reui/phone-input.js.map +1 -1
  353. package/dist/components/reui/rating.d.ts +1 -1
  354. package/dist/components/reui/rating.d.ts.map +1 -1
  355. package/dist/components/reui/rating.js +1 -1
  356. package/dist/components/reui/rating.js.map +1 -1
  357. package/dist/components/reui/sortable.d.ts.map +1 -1
  358. package/dist/components/reui/sortable.js +1 -1
  359. package/dist/components/reui/sortable.js.map +1 -1
  360. package/dist/components/reui/stepper.d.ts.map +1 -1
  361. package/dist/components/reui/stepper.js +1 -1
  362. package/dist/components/reui/stepper.js.map +1 -1
  363. package/dist/components/reui/timeline.d.ts.map +1 -1
  364. package/dist/components/reui/timeline.js +1 -1
  365. package/dist/components/reui/timeline.js.map +1 -1
  366. package/dist/components/reui/tree.d.ts.map +1 -1
  367. package/dist/components/reui/tree.js +1 -1
  368. package/dist/components/reui/tree.js.map +1 -1
  369. package/dist/components/ui/accordion.d.ts.map +1 -1
  370. package/dist/components/ui/accordion.js +1 -1
  371. package/dist/components/ui/accordion.js.map +1 -1
  372. package/dist/components/ui/alert-dialog.js +1 -1
  373. package/dist/components/ui/alert-dialog.js.map +1 -1
  374. package/dist/components/ui/alert.d.ts.map +1 -1
  375. package/dist/components/ui/alert.js +1 -1
  376. package/dist/components/ui/alert.js.map +1 -1
  377. package/dist/components/ui/aspect-ratio.js +1 -1
  378. package/dist/components/ui/aspect-ratio.js.map +1 -1
  379. package/dist/components/ui/attachment.d.ts +1 -1
  380. package/dist/components/ui/attachment.js +1 -1
  381. package/dist/components/ui/attachment.js.map +1 -1
  382. package/dist/components/ui/avatar.d.ts.map +1 -1
  383. package/dist/components/ui/avatar.js +1 -1
  384. package/dist/components/ui/avatar.js.map +1 -1
  385. package/dist/components/ui/badge.d.ts +1 -1
  386. package/dist/components/ui/badge.d.ts.map +1 -1
  387. package/dist/components/ui/badge.js +1 -1
  388. package/dist/components/ui/badge.js.map +1 -1
  389. package/dist/components/ui/breadcrumb.d.ts.map +1 -1
  390. package/dist/components/ui/breadcrumb.js +1 -1
  391. package/dist/components/ui/breadcrumb.js.map +1 -1
  392. package/dist/components/ui/bubble.d.ts +1 -1
  393. package/dist/components/ui/bubble.d.ts.map +1 -1
  394. package/dist/components/ui/bubble.js +1 -1
  395. package/dist/components/ui/bubble.js.map +1 -1
  396. package/dist/components/ui/button-group.js +1 -1
  397. package/dist/components/ui/button-group.js.map +1 -1
  398. package/dist/components/ui/button.d.ts +2 -2
  399. package/dist/components/ui/button.d.ts.map +1 -1
  400. package/dist/components/ui/button.js +1 -1
  401. package/dist/components/ui/button.js.map +1 -1
  402. package/dist/components/ui/calendar.js +1 -1
  403. package/dist/components/ui/calendar.js.map +1 -1
  404. package/dist/components/ui/card.d.ts.map +1 -1
  405. package/dist/components/ui/card.js +1 -1
  406. package/dist/components/ui/card.js.map +1 -1
  407. package/dist/components/ui/carousel.js +1 -1
  408. package/dist/components/ui/carousel.js.map +1 -1
  409. package/dist/components/ui/chart.d.ts.map +1 -1
  410. package/dist/components/ui/chart.js +1 -1
  411. package/dist/components/ui/chart.js.map +1 -1
  412. package/dist/components/ui/checkbox.d.ts.map +1 -1
  413. package/dist/components/ui/checkbox.js +1 -1
  414. package/dist/components/ui/checkbox.js.map +1 -1
  415. package/dist/components/ui/combobox.js +1 -1
  416. package/dist/components/ui/combobox.js.map +1 -1
  417. package/dist/components/ui/command.js +1 -1
  418. package/dist/components/ui/command.js.map +1 -1
  419. package/dist/components/ui/context-menu.d.ts.map +1 -1
  420. package/dist/components/ui/context-menu.js +1 -1
  421. package/dist/components/ui/context-menu.js.map +1 -1
  422. package/dist/components/ui/dialog.js +1 -1
  423. package/dist/components/ui/dialog.js.map +1 -1
  424. package/dist/components/ui/drawer.d.ts.map +1 -1
  425. package/dist/components/ui/drawer.js +1 -1
  426. package/dist/components/ui/drawer.js.map +1 -1
  427. package/dist/components/ui/dropdown-menu.d.ts.map +1 -1
  428. package/dist/components/ui/dropdown-menu.js +1 -1
  429. package/dist/components/ui/dropdown-menu.js.map +1 -1
  430. package/dist/components/ui/empty.d.ts.map +1 -1
  431. package/dist/components/ui/empty.js +1 -1
  432. package/dist/components/ui/empty.js.map +1 -1
  433. package/dist/components/ui/field.js +1 -1
  434. package/dist/components/ui/field.js.map +1 -1
  435. package/dist/components/ui/hover-card.d.ts.map +1 -1
  436. package/dist/components/ui/hover-card.js +1 -1
  437. package/dist/components/ui/hover-card.js.map +1 -1
  438. package/dist/components/ui/input-group.d.ts +1 -1
  439. package/dist/components/ui/input-group.js +1 -1
  440. package/dist/components/ui/input-group.js.map +1 -1
  441. package/dist/components/ui/input-otp.d.ts.map +1 -1
  442. package/dist/components/ui/input-otp.js +1 -1
  443. package/dist/components/ui/input-otp.js.map +1 -1
  444. package/dist/components/ui/input.d.ts.map +1 -1
  445. package/dist/components/ui/input.js +1 -1
  446. package/dist/components/ui/input.js.map +1 -1
  447. package/dist/components/ui/item.d.ts +2 -2
  448. package/dist/components/ui/item.js +1 -1
  449. package/dist/components/ui/item.js.map +1 -1
  450. package/dist/components/ui/kbd.js +1 -1
  451. package/dist/components/ui/kbd.js.map +1 -1
  452. package/dist/components/ui/label.d.ts.map +1 -1
  453. package/dist/components/ui/label.js +1 -1
  454. package/dist/components/ui/label.js.map +1 -1
  455. package/dist/components/ui/marker.d.ts +1 -1
  456. package/dist/components/ui/marker.d.ts.map +1 -1
  457. package/dist/components/ui/marker.js +1 -1
  458. package/dist/components/ui/marker.js.map +1 -1
  459. package/dist/components/ui/menubar.js +1 -1
  460. package/dist/components/ui/menubar.js.map +1 -1
  461. package/dist/components/ui/message-scroller.js +1 -1
  462. package/dist/components/ui/message-scroller.js.map +1 -1
  463. package/dist/components/ui/message.d.ts.map +1 -1
  464. package/dist/components/ui/message.js +1 -1
  465. package/dist/components/ui/message.js.map +1 -1
  466. package/dist/components/ui/native-select.d.ts.map +1 -1
  467. package/dist/components/ui/native-select.js +1 -1
  468. package/dist/components/ui/native-select.js.map +1 -1
  469. package/dist/components/ui/navigation-menu.d.ts.map +1 -1
  470. package/dist/components/ui/navigation-menu.js +1 -1
  471. package/dist/components/ui/navigation-menu.js.map +1 -1
  472. package/dist/components/ui/pagination.js +1 -1
  473. package/dist/components/ui/pagination.js.map +1 -1
  474. package/dist/components/ui/popover.d.ts.map +1 -1
  475. package/dist/components/ui/popover.js +1 -1
  476. package/dist/components/ui/popover.js.map +1 -1
  477. package/dist/components/ui/progress.d.ts.map +1 -1
  478. package/dist/components/ui/progress.js +1 -1
  479. package/dist/components/ui/progress.js.map +1 -1
  480. package/dist/components/ui/questionnaire.js +1 -1
  481. package/dist/components/ui/questionnaire.js.map +1 -1
  482. package/dist/components/ui/radio-group.d.ts.map +1 -1
  483. package/dist/components/ui/radio-group.js +1 -1
  484. package/dist/components/ui/radio-group.js.map +1 -1
  485. package/dist/components/ui/resizable.d.ts.map +1 -1
  486. package/dist/components/ui/resizable.js +1 -1
  487. package/dist/components/ui/resizable.js.map +1 -1
  488. package/dist/components/ui/scroll-area.d.ts.map +1 -1
  489. package/dist/components/ui/scroll-area.js +1 -1
  490. package/dist/components/ui/scroll-area.js.map +1 -1
  491. package/dist/components/ui/select.d.ts.map +1 -1
  492. package/dist/components/ui/select.js +1 -1
  493. package/dist/components/ui/select.js.map +1 -1
  494. package/dist/components/ui/separator.d.ts.map +1 -1
  495. package/dist/components/ui/separator.js +1 -1
  496. package/dist/components/ui/separator.js.map +1 -1
  497. package/dist/components/ui/sheet.js +1 -1
  498. package/dist/components/ui/sheet.js.map +1 -1
  499. package/dist/components/ui/sidebar.d.ts +1 -1
  500. package/dist/components/ui/sidebar.js +1 -1
  501. package/dist/components/ui/sidebar.js.map +1 -1
  502. package/dist/components/ui/skeleton.js +1 -1
  503. package/dist/components/ui/skeleton.js.map +1 -1
  504. package/dist/components/ui/slider.d.ts.map +1 -1
  505. package/dist/components/ui/slider.js +1 -1
  506. package/dist/components/ui/slider.js.map +1 -1
  507. package/dist/components/ui/spinner.d.ts.map +1 -1
  508. package/dist/components/ui/spinner.js +1 -1
  509. package/dist/components/ui/spinner.js.map +1 -1
  510. package/dist/components/ui/switch.d.ts.map +1 -1
  511. package/dist/components/ui/switch.js +1 -1
  512. package/dist/components/ui/switch.js.map +1 -1
  513. package/dist/components/ui/table.d.ts.map +1 -1
  514. package/dist/components/ui/table.js +1 -1
  515. package/dist/components/ui/table.js.map +1 -1
  516. package/dist/components/ui/tabs.d.ts +1 -1
  517. package/dist/components/ui/tabs.d.ts.map +1 -1
  518. package/dist/components/ui/tabs.js +1 -1
  519. package/dist/components/ui/tabs.js.map +1 -1
  520. package/dist/components/ui/textarea.d.ts.map +1 -1
  521. package/dist/components/ui/textarea.js +1 -1
  522. package/dist/components/ui/textarea.js.map +1 -1
  523. package/dist/components/ui/toast.js +1 -1
  524. package/dist/components/ui/toast.js.map +1 -1
  525. package/dist/components/ui/toggle-group.js +1 -1
  526. package/dist/components/ui/toggle-group.js.map +1 -1
  527. package/dist/components/ui/toggle.d.ts +1 -1
  528. package/dist/components/ui/toggle.d.ts.map +1 -1
  529. package/dist/components/ui/toggle.js +1 -1
  530. package/dist/components/ui/toggle.js.map +1 -1
  531. package/dist/components/ui/tooltip.d.ts.map +1 -1
  532. package/dist/components/ui/tooltip.js +1 -1
  533. package/dist/components/ui/tooltip.js.map +1 -1
  534. package/dist/hooks/use-dismiss.d.ts +1 -1
  535. package/dist/hooks/use-dismiss.d.ts.map +1 -1
  536. package/dist/hooks/use-dismiss.js.map +1 -1
  537. package/dist/lib/command-search.d.ts +10 -0
  538. package/dist/lib/command-search.d.ts.map +1 -0
  539. package/dist/lib/command-search.js +52 -0
  540. package/dist/lib/command-search.js.map +1 -0
  541. package/package.json +10 -12
@@ -1 +1 @@
1
- {"version":3,"file":"filters.js","names":["React"],"sources":["../../../../src/components/reui/filters/filters.tsx"],"sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\nimport { cva } from \"class-variance-authority\";\nimport { cn } from \"cn\";\n\nimport { Button } from \"../../ui/button\";\nimport { FiltersAdvanced } from \"./filters-advanced\";\nimport { FiltersBuilder } from \"./filters-builder\";\nimport { FilterChip } from \"./filters-chip\";\nimport {\n createFilterFocusStore,\n createFilterResolutionStore,\n createFilterRowStateStore,\n FilterActionsContext,\n type FilterActionsContextValue,\n FilterFocusContext,\n FilterRenderContext,\n FilterRowStateProvider,\n FilterStateContext,\n filterControlSizes,\n filterReadOnlyProps,\n isFilterLocked,\n useFilterActions,\n useFilterFocusStore,\n useFilterState,\n} from \"./filters-context\";\nimport {\n type FilterDraftAction,\n filterDraftReducer,\n isFilterDraftCommittable,\n} from \"./filters-draft\";\nimport {\n DEFAULT_FILTER_EDITORS,\n type FilterEditorRegistry,\n resolveFilterEditor,\n} from \"./filters-editors\";\nimport { resolveFilterLabels } from \"./filters-i18n\";\nimport {\n buildFilterIndex,\n computeFilterSchemaSignature,\n createFilterIdFactory,\n type FilterPathCollapse,\n findFilterSchemaIssues,\n formatFilterPath,\n getFilterField,\n warnFilterOnce,\n} from \"./filters-lib\";\nimport {\n createFilterOperators,\n DEFAULT_FILTER_OPERATOR_LABELS,\n DEFAULT_FILTER_OPERATORS,\n type FilterOperatorLabels,\n getFilterOperator,\n negateFilterOperator,\n operatorTakesValue,\n resolveFilterOperators,\n} from \"./filters-operators\";\nimport {\n clearFilterQuery,\n copyFilterNodeTo,\n countFilterRules,\n createFilterGroup,\n createFilterQuery,\n createFilterRule,\n duplicateFilterNode,\n findFilterNode,\n findFilterRule,\n flattenFilterRules,\n insertFilterNode,\n isFilterRule,\n moveFilterNode,\n moveFilterNodeTo,\n removeFilterNode,\n setFilterCombinator,\n toggleFilterCombinator,\n unwrapFilterGroup,\n updateFilterRule,\n wrapFilterNodeInGroup,\n} from \"./filters-query\";\nimport type {\n FilterChangeDetails,\n FilterCombinator,\n FilterDraft,\n FilterDraftStep,\n FilterEditor,\n FilterEmptyStateContext,\n FilterField,\n FilterLabels,\n FilterQuery,\n FilterRule,\n FilterValueDisplayContext,\n} from \"./filters-types\";\n\n/* -------------------------------------------------------------------------- */\n/* Variants */\n/* -------------------------------------------------------------------------- */\n\nconst filtersBarVariants = cva(\"flex flex-wrap items-center\", {\n variants: {\n // The rungs `FILTER_CONTROL_SIZES` holds, fed the RESOLVED rung at both\n // call sites, which is what keeps the two ladders in step: a cva default\n // only applies to a value nobody passed, so a raw `\"lg\"` reaching here\n // would leave the bar with no gap at all.\n size: {\n sm: \"gap-1.5\",\n default: \"gap-2\",\n },\n },\n defaultVariants: { size: \"default\" },\n});\n\n/* -------------------------------------------------------------------------- */\n/* Controllable */\n/* -------------------------------------------------------------------------- */\n\nfunction useControllableQuery<V, O>(\n controlled: FilterQuery<V> | undefined,\n uncontrolledDefault: FilterQuery<V> | undefined,\n onChange: ((query: FilterQuery<V>, details: FilterChangeDetails<V, O>) => void) | undefined,\n) {\n const isControlled = controlled !== undefined;\n const [internal, setInternal] = React.useState<FilterQuery<V>>(\n () => uncontrolledDefault ?? createFilterQuery<V>(),\n );\n\n const query = isControlled ? controlled : internal;\n const queryRef = React.useRef(query);\n React.useEffect(() => {\n queryRef.current = query;\n });\n\n const setQuery = React.useCallback(\n (next: FilterQuery<V>, details: FilterChangeDetails<V, O>) => {\n if (next === queryRef.current) return;\n queryRef.current = next;\n if (!isControlled) setInternal(next);\n onChange?.(next, details);\n },\n [isControlled, onChange],\n );\n\n return { query, queryRef, setQuery };\n}\n\n/* -------------------------------------------------------------------------- */\n/* Root */\n/* -------------------------------------------------------------------------- */\n\nexport interface FiltersProps<V = unknown, O = unknown> {\n /** The field schema. Nested via each field's own `fields`. */\n fields: FilterField<V, O>[];\n\n query?: FilterQuery<V>;\n defaultQuery?: FilterQuery<V>;\n onQueryChange?: (query: FilterQuery<V>, details: FilterChangeDetails<V, O>) => void;\n\n labels?: Partial<FilterLabels>;\n /** Operator wording, overridden independently of the chrome copy. */\n operatorLabels?: FilterOperatorLabels;\n /** Extra or replacement value editors, resolved by a field's `editor` name. */\n editors?: FilterEditorRegistry;\n\n /**\n * Which chrome draws the query. `\"basic\"` is the flat chip row, joined by an\n * implicit AND and drawing no combinator, because a chip row has nowhere to\n * put a parenthesis, and it draws a nested rule at any depth as a flat chip.\n */\n variant?: \"basic\" | \"advanced\";\n /** Where the advanced builder lives. `\"inline\"` renders the panel in place. */\n advancedMode?: \"popover\" | \"inline\";\n /**\n * Where the panel sits against its trigger. Stating it settles a twin split:\n * on overflow Base UI flips edges, Radix only shifts along the axis.\n */\n advancedAlign?: \"start\" | \"center\" | \"end\";\n /**\n * Whether the advanced builder's rows can be REORDERED. Off by default: a\n * move changes nothing about what the query MEANS, and costs a grip on every\n * row plus a gesture a touch screen starts by accident. On, drag and\n * Alt+Arrow move any row but the lone root.\n */\n reorderable?: boolean;\n\n /**\n * The density of the whole bar, chips included. TWO RUNGS and no `lg`,\n * resolved through `filterControlSizes` to whatever the ACTIVE STYLE calls\n * that rung (nova 7/8, sera 9/10, mira 6/7, maia and luma 8/9, lyra and rhea\n * 7/8, vega 8/9). Chips need no `ButtonGroup` variant: `items-stretch` gives\n * the pill the height of its one definite-height child, the kebab.\n */\n size?: \"sm\" | \"default\";\n disabled?: boolean;\n readOnly?: boolean;\n\n /**\n * ONE VETO POINT for every change the BAR makes to the query, and only those.\n * Return `false` to refuse; anything else commits, and `details.reason` names\n * the action. One hook and not fourteen because every write goes through\n * `emit`: the Delete key, Alt+Arrow and a drag alike. It can only refuse, and\n * it sits BEHIND the lock, so a locked bar never asks it. Returning a\n * REPLACEMENT tree was rejected: the announcement is already computed from\n * the proposed tree, so the bar would say one thing and commit another.\n */\n onBeforeQueryChange?: (\n query: FilterQuery<V>,\n details: FilterChangeDetails<V, O>,\n ) => boolean | undefined;\n\n /**\n * Offers \"Convert to advanced filter\" in every chip's kebab; its presence IS\n * the switch, since `variant` belongs to the consumer. Not drawn in advanced.\n */\n onConvertToAdvanced?: () => void;\n\n /**\n * Classes for the dropdown MENUS and the field PICKER panel, one prop each\n * rather than one per mount point. Merged after the default, so `w-*` wins.\n */\n menuClassName?: string;\n fieldPickerClassName?: string;\n\n /**\n * How a NESTED attribute path is shortened when too deep to read. `\"none\"` is\n * the default, so an upgrade changes nothing under a consumer; the collapser\n * is the cascader's, and the full path survives as the accessible NAME.\n */\n pathCollapse?: FilterPathCollapse;\n /**\n * How many names survive the collapse, the elided run not counted. Inert\n * while `pathCollapse` is `\"none\"`. Three is the cascader's own default.\n */\n maxPathSegments?: number;\n\n /** Replaces the default Add filter button. */\n trigger?: React.ReactNode;\n /** Renders a Clear button once the query holds anything. */\n showClear?: boolean;\n\n renderValue?: (context: FilterValueDisplayContext<V, O>) => React.ReactNode;\n renderChip?: (rule: FilterRule<V>) => React.ReactNode;\n /**\n * Replaces the advanced builder's empty state, which exists at all because a\n * builder with no rows is a footer floating in blank space. `null` for none.\n */\n renderEmpty?: (context: FilterEmptyStateContext) => React.ReactNode;\n\n className?: string;\n children?: React.ReactNode;\n}\n\nexport function Filters<V = unknown, O = unknown>({\n fields,\n query: controlledQuery,\n defaultQuery,\n onQueryChange,\n labels: labelsProp,\n operatorLabels: operatorLabelsProp,\n editors: editorsProp,\n variant = \"basic\",\n advancedMode = \"popover\",\n advancedAlign = \"start\",\n reorderable = false,\n size = \"default\",\n disabled = false,\n readOnly = false,\n onBeforeQueryChange,\n onConvertToAdvanced,\n menuClassName,\n fieldPickerClassName,\n pathCollapse = \"none\",\n maxPathSegments = 3,\n trigger,\n showClear = false,\n renderValue,\n renderChip,\n renderEmpty,\n className,\n children,\n}: FiltersProps<V, O>) {\n const { query, queryRef, setQuery } = useControllableQuery<V, O>(\n controlledQuery,\n defaultQuery,\n onQueryChange,\n );\n\n const [draft, dispatchDraftRaw] = React.useReducer(\n filterDraftReducer<V>,\n null as FilterDraft<V> | null,\n );\n // Text AND a counter: `aria-live` fires on a DOM mutation and React writes\n // nothing when the string is already there, so a repeat was silent. Measured\n // with a MutationObserver: \"Group added\" three times, one mutation.\n const [announced, setAnnounced] = React.useState({ seq: 0, text: \"\" });\n const announcement = announced.text;\n const setAnnouncement = React.useCallback((text: string) => {\n setAnnounced((prev) => ({ seq: prev.seq + 1, text }));\n }, []);\n\n // Seeded from useId: ids from Date.now() plus Math.random() broke hydration.\n const idSeed = React.useId();\n const nextId = React.useMemo(() => createFilterIdFactory(`${idSeed}f`), [idSeed]);\n\n const focusStore = React.useMemo(() => createFilterFocusStore(), []);\n const rowStateStore = React.useMemo(() => createFilterRowStateStore(), []);\n // One per root: the value-to-label store every `useFilterOptions` shares.\n const resolutionStore = React.useMemo(() => createFilterResolutionStore(), []);\n\n /* -------------------------------- derived ------------------------------- */\n\n // `fields` is an inline literal at every real call site, so the CHEAP walk\n // runs every render and the EXPENSIVE index memoizes on its result. Not a\n // ref caching the previous index: writing a ref during render is the\n // impurity this rewrite removed, and it misbehaves under StrictMode.\n const signature = computeFilterSchemaSignature(fields);\n const index = React.useMemo(\n () => buildFilterIndex<V, O>(fields, null, signature),\n // Not `fields`: its identity changes every render at every real call site.\n [signature, fields],\n );\n\n const labels = React.useMemo(() => resolveFilterLabels(labelsProp), [labelsProp]);\n\n const operatorCatalog = React.useMemo(() => {\n if (!operatorLabelsProp) return DEFAULT_FILTER_OPERATORS;\n return createFilterOperators({\n ...DEFAULT_FILTER_OPERATOR_LABELS,\n ...operatorLabelsProp,\n });\n }, [operatorLabelsProp]);\n\n const editors = React.useMemo(\n () => ({ ...DEFAULT_FILTER_EDITORS, ...editorsProp }),\n [editorsProp],\n );\n\n const resolveOperators = React.useCallback(\n (field: FilterField<V, O>) => resolveFilterOperators(field, operatorCatalog),\n [operatorCatalog],\n );\n\n const ruleCount = React.useMemo(() => countFilterRules(query), [query]);\n\n /* --------------------------- latest-props ref --------------------------- */\n\n const latest = React.useRef({\n index,\n labels,\n operatorCatalog,\n resolveOperators,\n draft,\n nextId,\n setQuery,\n queryRef,\n disabled,\n readOnly,\n onBeforeQueryChange,\n });\n React.useEffect(() => {\n latest.current = {\n index,\n labels,\n operatorCatalog,\n resolveOperators,\n draft,\n nextId,\n setQuery,\n queryRef,\n disabled,\n readOnly,\n onBeforeQueryChange,\n };\n });\n\n /* -------------------------------- actions ------------------------------- */\n\n // Every mutator below reads state through `latest`, so no keystroke rebuilds\n // one. The lock flags are the ONE exception, for the reason on `locked`.\n\n /**\n * THE MUTATION BOUNDARY, asked here and not at the nine buttons, because the\n * routes into a query are not only buttons. It needs BOTH the closure and\n * the ref: `latest` is written in a passive effect and effects run\n * child-first, so a consumer effect in the commit that turns `readOnly` on\n * runs BEFORE the ref learns of it, while the ref is what a stale handler\n * reads afterwards.\n */\n const locked = React.useCallback(\n () => disabled || readOnly || isFilterLocked(latest.current),\n [disabled, readOnly],\n );\n\n // Reports whether the write LANDED: `onBeforeQueryChange` is discoverable\n // only here, and a vetoed remove that still announced a count would lie.\n const emit = React.useCallback(\n (\n next: FilterQuery<V>,\n reason: FilterChangeDetails<V, O>[\"reason\"],\n rule: FilterRule<V> | null,\n ): boolean => {\n // The backstop, redundant with each mutator's own early return, and\n // FIRST, so the consumer hook cannot approve what the lock refused.\n if (locked()) return false;\n const field = rule ? (getFilterField(latest.current.index, rule.path) ?? null) : null;\n const details: FilterChangeDetails<V, O> = { reason, rule, field };\n // Strictly `false`, so a handler that forgets to return is not a veto.\n if (latest.current.onBeforeQueryChange?.(next, details) === false) {\n return false;\n }\n latest.current.setQuery(next, details);\n return true;\n },\n [locked],\n );\n\n /**\n * Drops the roving tab stop when the node holding it no longer exists: a cell\n * claims it when the store names it, and the \"row one takes it\" fallback\n * fires only when the store is EMPTY, so a deleted id left twenty cells at\n * `tabindex=\"-1\"` with focus on the BODY. Keyed on the committed `query`, so\n * a consumer's Reset or saved-view load is repaired too: add a condition,\n * press Reset, and 25 cells stayed untabbable in both twins.\n */\n React.useEffect(() => {\n const { id } = focusStore.getSnapshot();\n if (!id || findFilterNode(query, id)) return;\n focusStore.set({ id: null, segment: null, autoOpen: false });\n }, [query, focusStore]);\n\n const addRule = React.useCallback(\n (rule: FilterRule<V>, parentId?: string) => {\n if (locked()) return;\n const next = insertFilterNode(latest.current.queryRef.current, rule, parentId);\n if (!emit(next, \"add\", rule)) return;\n setAnnouncement(latest.current.labels.countAnnouncement(countFilterRules(next)));\n },\n [emit, locked, setAnnouncement],\n );\n\n const addGroup = React.useCallback(\n (parentId?: string, combinator: FilterCombinator = \"or\") => {\n // Before `nextId`, so a LOCKED bar cannot drift the SSR-seeded sequence.\n if (locked()) return \"\";\n const id = latest.current.nextId();\n // `or` by default: `a AND (b AND c)` is just `a AND b AND c`.\n const next = insertFilterNode(\n latest.current.queryRef.current,\n createFilterGroup<V>({ id, combinator }),\n parentId,\n );\n // `\"\"` on a veto: every caller moves focus onto the id it gets back, and\n // focusing a group that was never created strands the tab stop. The id\n // is already burnt, deliberately: a veto is a client-time decision the\n // server never took part in.\n if (!emit(next, \"add\", null)) return \"\";\n setAnnouncement(latest.current.labels.groupAnnouncement(true));\n return id;\n },\n [emit, locked, setAnnouncement],\n );\n\n const updateRule = React.useCallback(\n (id: string, updates: Partial<Omit<FilterRule<V>, \"id\" | \"type\">>) => {\n if (locked()) return;\n const current = latest.current.queryRef.current;\n const next = updateFilterRule(current, id, updates);\n if (next === current) return;\n // THE VALUE, not the field or the operator: picking an attribute leaves\n // the value empty, so arming there reddens the flow the primitive itself\n // walks a user through. A field re-pick sends `value: undefined` in the\n // SAME patch, so `path` and not the presence of `value` tells the two\n // apart. Clearing a typed value still arms it: no `path` in that patch.\n if (\"path\" in updates) rowStateStore.unmark(id);\n else if (\"value\" in updates) rowStateStore.mark(id);\n emit(next, \"update\", findFilterRule(next, id));\n },\n [emit, locked, rowStateStore],\n );\n\n const removeNode = React.useCallback(\n (id: string) => {\n if (locked()) return;\n const current = latest.current.queryRef.current;\n const removed = findFilterRule(current, id);\n const next = removeFilterNode(current, id);\n if (next === current) return;\n if (!emit(next, \"remove\", removed)) return;\n // A rule removal reports the COUNT; a group has no rule to report and\n // takes an unknown number of conditions with it, so it says so instead.\n setAnnouncement(\n removed\n ? latest.current.labels.countAnnouncement(countFilterRules(next))\n : latest.current.labels.groupAnnouncement(false),\n );\n },\n [emit, locked, setAnnouncement],\n );\n\n const duplicateNode = React.useCallback(\n (id: string) => {\n if (locked()) return;\n const current = latest.current.queryRef.current;\n const next = duplicateFilterNode(current, id, latest.current.nextId);\n if (next === current) return;\n if (!emit(next, \"duplicate\", findFilterRule(current, id))) return;\n // The count, not \"duplicated\": a GROUP adds an unknown number of rows.\n setAnnouncement(latest.current.labels.countAnnouncement(countFilterRules(next)));\n },\n [emit, locked, setAnnouncement],\n );\n\n const negateRule = React.useCallback(\n (id: string) => {\n if (locked()) return;\n const current = latest.current.queryRef.current;\n const rule = findFilterRule(current, id);\n if (!rule) return;\n const field = getFilterField(latest.current.index, rule.path);\n if (!field) return;\n const operators = latest.current.resolveOperators(field);\n const flipped = negateFilterOperator(\n getFilterOperator(operators, rule.operator),\n operators,\n rule.negated,\n );\n const next = updateFilterRule(current, id, {\n operator: flipped.operator ?? rule.operator,\n negated: flipped.negated || undefined,\n });\n emit(next, \"negate\", findFilterRule(next, id));\n },\n [emit, locked],\n );\n\n // Says where a node LANDED, the one mutator a screen reader hears nothing\n // else about: focus stays on the handle and the name does not change. Reads\n // the tree AFTER the move: the position and sibling count announced are the\n // ones the user has just arrived at.\n const announceReorder = React.useCallback(\n (next: FilterQuery<V>, id: string, fromParentId: string | null) => {\n const found = findFilterNode(next, id);\n if (!found?.parent) return;\n const label = isFilterRule(found.node)\n ? formatFilterPath(\n latest.current.index,\n found.node.path,\n latest.current.labels.pathSeparator,\n )\n : found.node.combinator === \"and\"\n ? latest.current.labels.groupAll\n : latest.current.labels.groupAny;\n const position = found.index + 1;\n const total = found.parent.rules.length;\n\n // A move that changed the node's CONTAINER is a different event, named by\n // the group's own headline, or the bar's label at the top level.\n if (fromParentId && fromParentId !== found.parent.id) {\n const destination =\n found.parent.id === next.id\n ? latest.current.labels.filtersLabel\n : found.parent.combinator === \"and\"\n ? latest.current.labels.groupAll\n : latest.current.labels.groupAny;\n setAnnouncement(\n latest.current.labels.moveAnnouncement(label, destination, position, total),\n );\n return;\n }\n\n setAnnouncement(latest.current.labels.reorderAnnouncement(label, position, total));\n },\n [setAnnouncement],\n );\n\n const moveNode = React.useCallback(\n (id: string, delta: number) => {\n if (locked()) return;\n const current = latest.current.queryRef.current;\n const next = moveFilterNode(current, id, delta);\n if (next === current) return;\n if (!emit(next, \"reorder\", findFilterRule(next, id))) return;\n // Within the owning group by construction, so there is no destination.\n announceReorder(next, id, null);\n },\n [emit, announceReorder, locked],\n );\n\n // Also the drag layer's drop commit, so a drag and Alt+Arrow say the same.\n const moveNodeTo = React.useCallback(\n (id: string, parentId: string, index: number) => {\n if (locked()) return;\n const current = latest.current.queryRef.current;\n // BEFORE the move: the only place the old parent still exists.\n const fromParentId = findFilterNode(current, id)?.parent?.id ?? null;\n const next = moveFilterNodeTo(current, id, parentId, index);\n if (next === current) return;\n if (!emit(next, \"reorder\", findFilterRule(next, id))) return;\n announceReorder(next, id, fromParentId);\n },\n [emit, announceReorder, locked],\n );\n\n const copyNodeTo = React.useCallback(\n (id: string, parentId: string, index: number) => {\n if (locked()) return;\n const current = latest.current.queryRef.current;\n const next = copyFilterNodeTo(current, id, parentId, index, latest.current.nextId);\n if (next === current) return;\n if (!emit(next, \"duplicate\", findFilterRule(current, id))) return;\n // The count again: an Alt-drag of a GROUP adds an unknown number of rows.\n setAnnouncement(latest.current.labels.countAnnouncement(countFilterRules(next)));\n },\n [emit, locked, setAnnouncement],\n );\n\n const wrapNodeInGroup = React.useCallback(\n (id: string, combinator: FilterCombinator = \"or\") => {\n if (locked()) return;\n const current = latest.current.queryRef.current;\n const next = wrapFilterNodeInGroup(current, id, latest.current.nextId(), combinator);\n if (next === current) return;\n if (!emit(next, \"add\", findFilterRule(next, id))) return;\n setAnnouncement(latest.current.labels.groupAnnouncement(true));\n },\n [emit, locked, setAnnouncement],\n );\n\n const unwrapGroup = React.useCallback(\n (groupId: string) => {\n if (locked()) return;\n const current = latest.current.queryRef.current;\n const next = unwrapFilterGroup(current, groupId);\n if (next === current) return;\n // The conditions survive in place, so the count has not changed.\n if (!emit(next, \"remove\", null)) return;\n setAnnouncement(latest.current.labels.groupAnnouncement(false));\n },\n [emit, locked, setAnnouncement],\n );\n\n // What a combinator change SOUNDS like: the pill's name changes with it, but\n // a name change on the FOCUSED element is not re-announced by NVDA or JAWS.\n // The group's own headline, not the bare word: it says what the query MEANS\n // now, which is the thing that changed.\n const announceCombinator = React.useCallback(\n (combinator: FilterCombinator) => {\n setAnnouncement(\n combinator === \"and\" ? latest.current.labels.groupAll : latest.current.labels.groupAny,\n );\n },\n [setAnnouncement],\n );\n\n const setCombinatorAction = React.useCallback(\n (groupId: string, combinator: FilterCombinator) => {\n if (locked()) return;\n const current = latest.current.queryRef.current;\n const next = setFilterCombinator(current, groupId, combinator);\n if (next === current) return;\n if (!emit(next, \"combinator\", null)) return;\n announceCombinator(combinator);\n },\n [emit, locked, announceCombinator],\n );\n\n const toggleCombinatorAction = React.useCallback(\n (groupId: string) => {\n if (locked()) return;\n const current = latest.current.queryRef.current;\n const next = toggleFilterCombinator(current, groupId);\n if (next === current) return;\n if (!emit(next, \"combinator\", null)) return;\n // Read off the COMMITTED tree, so the sentence cannot disagree with it.\n const group = findFilterNode(next, groupId)?.node;\n if (group && !isFilterRule(group)) announceCombinator(group.combinator);\n },\n [emit, locked, announceCombinator],\n );\n\n const clearQueryAction = React.useCallback(() => {\n if (locked()) return;\n const current = latest.current.queryRef.current;\n const next = clearFilterQuery(current);\n if (next === current) return;\n if (!emit(next, \"clear\", null)) return;\n setAnnouncement(latest.current.labels.countAnnouncement(0));\n }, [emit, locked, setAnnouncement]);\n\n // The live region, opened to the chrome inside the bar. The setter itself is\n // not published: it is a channel anything could write anything to.\n const announce = React.useCallback(\n (message: string) => {\n if (!message) return;\n setAnnouncement(message);\n },\n [setAnnouncement],\n );\n\n // A draft is a MUTATION in progress, so it locks with the rest, except\n // `close`: a panel open when the bar turned read only must still dismiss.\n const dispatchDraft = React.useCallback(\n (action: FilterDraftAction<V>) => {\n if (action.type !== \"close\" && locked()) return;\n dispatchDraftRaw(action);\n },\n [locked],\n );\n\n const openCreate = React.useCallback(() => {\n if (locked()) return;\n dispatchDraftRaw({ type: \"openCreate\" });\n }, [locked]);\n\n const openAmend = React.useCallback(\n (id: string, step: FilterDraftStep) => {\n if (locked()) return;\n const rule = findFilterRule(latest.current.queryRef.current, id);\n if (!rule) return;\n dispatchDraftRaw({\n type: \"openAmend\",\n ruleId: id,\n step,\n path: rule.path,\n operator: rule.operator,\n value: rule.value,\n });\n },\n [locked],\n );\n\n const closeDraft = React.useCallback(() => dispatchDraftRaw({ type: \"close\" }), []);\n\n const getQuery = React.useCallback(() => latest.current.queryRef.current, []);\n const getDraft = React.useCallback(() => latest.current.draft, []);\n\n /* ------------------------- draft -> query commit ------------------------ */\n\n // The draft becomes a rule exactly once, when the reducer says it is ready.\n // Here rather than in each click handler, which is what lets the \"arity none\n // skips the value step\" branch live in the pure reducer.\n React.useEffect(() => {\n if (draft?.status !== \"ready\") return;\n if (!isFilterDraftCommittable(draft)) return;\n\n if (draft.ruleId) {\n updateRule(draft.ruleId, {\n path: draft.path,\n operator: draft.operator ?? \"\",\n value: draft.value,\n });\n } else if (!locked()) {\n // Asked here too: this branch burns an id and points the focus store at\n // it, and a store naming a chip that never existed eats the tab stop.\n const id = nextId();\n addRule(\n createFilterRule<V>({\n id,\n path: draft.path,\n // Empty on purpose: the chip renders \"Select condition\" and opens.\n operator: \"\",\n value: undefined,\n }),\n );\n focusStore.set({ id, segment: \"operator\", autoOpen: true });\n }\n dispatchDraftRaw({ type: \"close\" });\n }, [draft, addRule, updateRule, nextId, focusStore, locked]);\n\n /* ---------------------------- dev diagnostics --------------------------- */\n\n React.useEffect(() => {\n if (process.env.NODE_ENV === \"production\") return;\n const issues = findFilterSchemaIssues(fields, (field) =>\n resolveFilterOperators(field, operatorCatalog),\n );\n if (issues.duplicatePaths.length) {\n warnFilterOnce(\n `dup:${issues.duplicatePaths.join(\",\")}`,\n `duplicate sibling field ids are ignored after the first: ${issues.duplicatePaths.join(\", \")}`,\n );\n }\n if (issues.emptyIds.length) {\n warnFilterOnce(\"empty-id\", \"every field needs a non-empty id\");\n }\n if (issues.unknownDefaultOperators.length) {\n warnFilterOnce(\n `op:${issues.unknownDefaultOperators.join(\",\")}`,\n `defaultOperator names an operator the field does not offer: ${issues.unknownDefaultOperators.join(\", \")}`,\n );\n }\n }, [fields, operatorCatalog]);\n\n /* ------------------------------- contexts ------------------------------- */\n\n const actions = React.useMemo<FilterActionsContextValue<V, O>>(\n () => ({\n index,\n labels,\n operatorCatalog,\n editors,\n size,\n disabled,\n readOnly,\n variant,\n menuClassName,\n fieldPickerClassName,\n convertToAdvanced: onConvertToAdvanced,\n pathCollapse,\n maxPathSegments,\n resolveOperators,\n // The same lookup the chrome uses, so a headless consumer can ask it too.\n resolveEditor: (field, operator) =>\n resolveFilterEditor(field, operator, editors) as FilterEditor<V, O> | undefined,\n resolution: resolutionStore,\n addRule,\n addGroup,\n updateRule,\n removeNode,\n duplicateNode,\n negateRule,\n moveNode,\n moveNodeTo,\n copyNodeTo,\n wrapNodeInGroup,\n unwrapGroup,\n setCombinator: setCombinatorAction,\n toggleCombinator: toggleCombinatorAction,\n clearQuery: clearQueryAction,\n openCreate,\n openAmend,\n closeDraft,\n dispatchDraft,\n announce,\n getQuery,\n getDraft,\n nextId,\n }),\n // Every input is memoized and every action `[]`-stable, so this\n // republishes on a real schema or config change, never on a keystroke.\n [\n index,\n labels,\n operatorCatalog,\n editors,\n size,\n disabled,\n readOnly,\n variant,\n menuClassName,\n fieldPickerClassName,\n onConvertToAdvanced,\n pathCollapse,\n maxPathSegments,\n resolveOperators,\n resolutionStore,\n addRule,\n addGroup,\n updateRule,\n removeNode,\n duplicateNode,\n negateRule,\n moveNode,\n moveNodeTo,\n copyNodeTo,\n wrapNodeInGroup,\n unwrapGroup,\n setCombinatorAction,\n toggleCombinatorAction,\n clearQueryAction,\n openCreate,\n openAmend,\n closeDraft,\n dispatchDraft,\n announce,\n getQuery,\n getDraft,\n nextId,\n ],\n );\n\n const state = React.useMemo(\n () => ({\n query,\n draft,\n ruleCount,\n announcement,\n announcementSeq: announced.seq,\n }),\n [query, draft, ruleCount, announcement, announced.seq],\n );\n\n const renderContext = React.useMemo(\n () => ({ renderValue, renderChip, renderEmpty }),\n [renderValue, renderChip, renderEmpty],\n );\n\n return (\n <FilterActionsContext.Provider value={actions as unknown as FilterActionsContextValue}>\n <FilterStateContext.Provider value={state as never}>\n <FilterRenderContext.Provider value={renderContext as never}>\n <FilterRowStateProvider value={rowStateStore}>\n <FilterFocusContext.Provider value={focusStore}>\n {children ??\n (variant === \"advanced\" ? (\n <FiltersAdvanced<V, O>\n mode={advancedMode}\n align={advancedAlign}\n trigger={trigger}\n reorderable={reorderable}\n className={className}\n />\n ) : (\n <FiltersRow trigger={trigger} showClear={showClear} className={className} />\n ))}\n </FilterFocusContext.Provider>\n </FilterRowStateProvider>\n </FilterRenderContext.Provider>\n </FilterStateContext.Provider>\n </FilterActionsContext.Provider>\n );\n}\n\n/* -------------------------------------------------------------------------- */\n/* Row */\n/* -------------------------------------------------------------------------- */\n\nexport interface FiltersRowProps {\n trigger?: React.ReactNode;\n showClear?: boolean;\n className?: string;\n}\n\n/**\n * The chip row: a toolbar with a roving tabindex, where the predecessor made\n * every segment of every chip its own tab stop. There is NO combinator here,\n * because a chip row can draw a word between two pills but not a parenthesis.\n */\nexport function FiltersRow({ trigger, showClear, className }: FiltersRowProps) {\n const actions = useFilterActions();\n const sizes = filterControlSizes(actions);\n const { query, ruleCount, announcement, announcementSeq } = useFilterState();\n const focusStore = useFilterFocusStore();\n const rootRef = React.useRef<HTMLDivElement>(null);\n // The keys consult this even though the actions already refuse: an ungated\n // Enter would ARM `autoOpen` for a popover that then refuses to open. Gated\n // per branch, never at the top of `onKeyDown`: the arrows, Home and End are\n // how a read-only bar is read.\n const locked = isFilterLocked(actions);\n\n // Flattened, not `query.rules.filter(isFilterRule)`: a query built in the\n // advanced builder would otherwise hide nested conditions that still filter.\n const rules = React.useMemo(() => flattenFilterRules(query), [query]);\n\n const chips = () =>\n Array.from(rootRef.current?.querySelectorAll<HTMLElement>('[data-slot=\"filter-chip\"]') ?? []);\n\n const onKeyDown = (event: React.KeyboardEvent<HTMLDivElement>) => {\n const target = (event.target as HTMLElement).closest<HTMLElement>('[data-slot=\"filter-chip\"]');\n if (!target) return;\n // A key pressed inside an open popover belongs to that popover.\n if (event.target !== target) return;\n\n const all = chips();\n const current = all.indexOf(target);\n if (current === -1) return;\n\n const rtl = getComputedStyle(target).direction === \"rtl\";\n const forward = rtl ? \"ArrowLeft\" : \"ArrowRight\";\n const backward = rtl ? \"ArrowRight\" : \"ArrowLeft\";\n\n const focusAt = (index: number) => {\n const next = all[Math.max(0, Math.min(index, all.length - 1))];\n if (!next) return;\n event.preventDefault();\n next.focus();\n };\n\n const ruleId = target.dataset.ruleId;\n if (!ruleId) return;\n\n if (event.altKey && (event.key === forward || event.key === backward)) {\n if (locked) return;\n event.preventDefault();\n actions.moveNode(ruleId, event.key === forward ? 1 : -1);\n return;\n }\n if (event.key === forward) return focusAt(current + 1);\n if (event.key === backward) return focusAt(current - 1);\n if (event.key === \"Home\") return focusAt(0);\n if (event.key === \"End\") return focusAt(all.length - 1);\n\n if (event.key === \"Backspace\" || event.key === \"Delete\") {\n if (locked) return;\n event.preventDefault();\n actions.removeNode(ruleId);\n // The neighbour taking this chip's place, so a run of deletes keeps focus.\n requestAnimationFrame(() => {\n const remaining = chips();\n remaining[Math.min(current, remaining.length - 1)]?.focus();\n });\n return;\n }\n\n if (event.key === \"Enter\" || event.key === \" \") {\n if (locked) return;\n event.preventDefault();\n // Enter RESUMES the chip: the attribute segment is display only, so the\n // target is whichever step the flow has not reached, never nothing.\n const rule = findFilterRule(actions.getQuery(), ruleId);\n if (!rule) return;\n const field = getFilterField(actions.index, rule.path);\n // No popover to open, so autoOpen would sit armed until another chip\n // spent it. The chip stays reachable and Delete still removes it.\n if (!field) return;\n const operator = getFilterOperator(actions.resolveOperators(field), rule.operator);\n const segment = rule.operator && operatorTakesValue(operator) ? \"value\" : \"operator\";\n focusStore.set({ id: ruleId, segment, autoOpen: true });\n }\n };\n\n return (\n <div\n ref={rootRef}\n data-slot=\"filters\"\n data-empty={rules.length === 0 || undefined}\n /* A presence hook, so a consumer can tint the whole read-only bar. */\n data-readonly={actions.readOnly || undefined}\n className={cn(\n /* `sizes.button` and not `actions.size`: the gap ladder and the control\n ladder must answer for the same rung, normalized in one place. */\n filtersBarVariants({ size: sizes.button }),\n /* An empty toolbar is still a flex child, so it took a gap with no\n width. The gap goes, not the toolbar, which owns the row's name. */\n rules.length === 0 && \"gap-0\",\n className,\n )}\n >\n <div\n role=\"toolbar\"\n aria-label={actions.labels.filtersLabel}\n aria-orientation=\"horizontal\"\n /* `role=toolbar` disallows `aria-readonly`, and `aria-disabled` would\n deny arrowing; a description is legal here and spoken on entry. */\n {...(actions.readOnly ? { \"aria-description\": actions.labels.readOnly } : null)}\n className={cn(filtersBarVariants({ size: sizes.button }))}\n onKeyDown={onKeyDown}\n >\n {rules.map((rule, index) => (\n <FilterChip key={rule.id} rule={rule} index={index} />\n ))}\n </div>\n\n <FiltersBuilder trigger={trigger} />\n\n {showClear && ruleCount > 0 ? (\n // `ms-auto` and not `ml-auto`, so Clear stays on the trailing edge\n // under RTL, where the whole bar mirrors.\n <Button\n variant=\"outline\"\n /* The same rung as the Add filter trigger beside it. */\n size={sizes.button}\n className=\"ms-auto\"\n /* `disabled` for the hard flag, `aria-disabled` for the soft one, so\n a read-only Clear keeps its tab stop and can still be found. */\n disabled={actions.disabled}\n {...filterReadOnlyProps(actions)}\n onClick={() => actions.clearQuery()}\n >\n {actions.labels.clear}\n </Button>\n ) : null}\n\n {/* Keyed on the sequence, so the same sentence twice is two\n announcements (see `announced` for the measurement). A replaced live\n element stops being watched. */}\n <div aria-live=\"polite\" role=\"status\" className=\"sr-only\">\n <span key={announcementSeq}>{announcement}</span>\n </div>\n </div>\n );\n}\n\n/* -------------------------------------------------------------------------- */\n/* Exports */\n/* -------------------------------------------------------------------------- */\n\nexport {\n FilterAdvancedRow,\n FiltersAdvanced,\n FiltersAdvancedPanel,\n} from \"./filters-advanced\";\nexport {\n FilterFieldPicker,\n FiltersBuilder,\n} from \"./filters-builder\";\nexport {\n FilterChip,\n FilterOperatorPopover,\n FilterRuleMenuItems,\n FilterValuePopover,\n useFilterRuleDisplay,\n} from \"./filters-chip\";\nexport {\n // The read-only contract: the gate, and the props a mutating control wears.\n filterReadOnlyProps,\n isFilterLocked,\n useFilterActions,\n // What a custom chip needs to rebuild the roving scheme `renderChip` drops.\n useFilterChipAutoOpen,\n useFilterChipFocused,\n useFilterFocus,\n useFilterFocusEmpty,\n useFilterFocusStore,\n useFilterRender,\n useFilterSegmentFocus,\n useFilterState,\n} from \"./filters-context\";\nexport {\n DEFAULT_FILTER_EDITORS,\n useFilterOptions,\n useFilterValueResolution,\n} from \"./filters-editors\";\nexport { DEFAULT_FILTER_LABELS } from \"./filters-i18n\";\nexport {\n DEFAULT_FILTER_OPERATOR_LABELS,\n DEFAULT_FILTER_OPERATORS,\n} from \"./filters-operators\";\n// The two resolver signatures `collectFilterIssues` takes.\nexport type {\n FilterArityResolver,\n FilterValidateResolver,\n} from \"./filters-query\";\n// The full pure READ surface, so one import reaches everything a predicate, a\n// saved view or a backend query needs. It stops at the query TREE and compiles\n// nothing: `flattenFilterConditions` is the hand-off a server compiles from.\n// No SQL emitter, because a server has to re-validate anything a browser sends\n// and should compile from the tree rather than parse a client's string. SQL is\n// one target of that hand-off beside Prisma, Drizzle, a REST query string and\n// Elasticsearch.\nexport {\n // The panel does not DRAW the built-in reasons, so this is the only way to\n // surface \"missing value\", \"empty group\" and the rest.\n collectFilterIssues,\n copyFilterNodeTo,\n countFilterRules,\n createFilterGroup,\n createFilterQuery,\n createFilterRule,\n flattenFilterConditions,\n flattenFilterRules,\n isFilterQueryEmpty,\n isFilterRuleComplete,\n moveFilterNodeTo,\n pruneFilterQuery,\n unwrapFilterGroup,\n wrapFilterNodeInGroup,\n} from \"./filters-query\";\nexport type * from \"./filters-types\";\n"],"mappings":";;;;;;;;;;;;;;;;;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C,UAAA,oBAAC,QAAD,EAAA,UAA6B,aAAmB,GAArC,eAAqC;GAC7C,CAAA;EACF;;AAET"}
1
+ {"version":3,"file":"filters.js","names":["React"],"sources":["../../../../src/components/reui/filters/filters.tsx"],"sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\nimport { cva } from \"class-variance-authority\";\n\nimport { cn } from \"@kumix/utils\";\nimport { Button } from \"../../ui/button\";\nimport { FiltersAdvanced } from \"./filters-advanced\";\nimport { FiltersBuilder } from \"./filters-builder\";\nimport { FilterChip } from \"./filters-chip\";\nimport {\n createFilterFocusStore,\n createFilterResolutionStore,\n createFilterRowStateStore,\n FilterActionsContext,\n type FilterActionsContextValue,\n FilterFocusContext,\n FilterRenderContext,\n FilterRowStateProvider,\n FilterStateContext,\n filterControlSizes,\n filterReadOnlyProps,\n isFilterLocked,\n useFilterActions,\n useFilterFocusStore,\n useFilterState,\n} from \"./filters-context\";\nimport {\n type FilterDraftAction,\n filterDraftReducer,\n isFilterDraftCommittable,\n} from \"./filters-draft\";\nimport {\n DEFAULT_FILTER_EDITORS,\n type FilterEditorRegistry,\n resolveFilterEditor,\n} from \"./filters-editors\";\nimport { resolveFilterLabels } from \"./filters-i18n\";\nimport {\n buildFilterIndex,\n computeFilterSchemaSignature,\n createFilterIdFactory,\n type FilterPathCollapse,\n findFilterSchemaIssues,\n formatFilterPath,\n getFilterField,\n warnFilterOnce,\n} from \"./filters-lib\";\nimport {\n createFilterOperators,\n DEFAULT_FILTER_OPERATOR_LABELS,\n DEFAULT_FILTER_OPERATORS,\n type FilterOperatorLabels,\n getFilterOperator,\n negateFilterOperator,\n operatorTakesValue,\n resolveFilterOperators,\n} from \"./filters-operators\";\nimport {\n clearFilterQuery,\n copyFilterNodeTo,\n countFilterRules,\n createFilterGroup,\n createFilterQuery,\n createFilterRule,\n duplicateFilterNode,\n findFilterNode,\n findFilterRule,\n flattenFilterRules,\n insertFilterNode,\n isFilterRule,\n moveFilterNode,\n moveFilterNodeTo,\n removeFilterNode,\n setFilterCombinator,\n toggleFilterCombinator,\n unwrapFilterGroup,\n updateFilterRule,\n wrapFilterNodeInGroup,\n} from \"./filters-query\";\nimport type {\n FilterChangeDetails,\n FilterCombinator,\n FilterDraft,\n FilterDraftStep,\n FilterEditor,\n FilterEmptyStateContext,\n FilterField,\n FilterLabels,\n FilterQuery,\n FilterRule,\n FilterValueDisplayContext,\n} from \"./filters-types\";\n\n/* -------------------------------------------------------------------------- */\n/* Variants */\n/* -------------------------------------------------------------------------- */\n\nconst filtersBarVariants = cva(\"flex flex-wrap items-center\", {\n variants: {\n // The rungs `FILTER_CONTROL_SIZES` holds, fed the RESOLVED rung at both\n // call sites, which is what keeps the two ladders in step: a cva default\n // only applies to a value nobody passed, so a raw `\"lg\"` reaching here\n // would leave the bar with no gap at all.\n size: {\n sm: \"gap-1.5\",\n default: \"gap-2\",\n },\n },\n defaultVariants: { size: \"default\" },\n});\n\n/* -------------------------------------------------------------------------- */\n/* Controllable */\n/* -------------------------------------------------------------------------- */\n\nfunction useControllableQuery<V, O>(\n controlled: FilterQuery<V> | undefined,\n uncontrolledDefault: FilterQuery<V> | undefined,\n onChange: ((query: FilterQuery<V>, details: FilterChangeDetails<V, O>) => void) | undefined,\n) {\n const isControlled = controlled !== undefined;\n const [internal, setInternal] = React.useState<FilterQuery<V>>(\n () => uncontrolledDefault ?? createFilterQuery<V>(),\n );\n\n const query = isControlled ? controlled : internal;\n const queryRef = React.useRef(query);\n React.useEffect(() => {\n queryRef.current = query;\n });\n\n const setQuery = React.useCallback(\n (next: FilterQuery<V>, details: FilterChangeDetails<V, O>) => {\n if (next === queryRef.current) return;\n queryRef.current = next;\n if (!isControlled) setInternal(next);\n onChange?.(next, details);\n },\n [isControlled, onChange],\n );\n\n return { query, queryRef, setQuery };\n}\n\n/* -------------------------------------------------------------------------- */\n/* Root */\n/* -------------------------------------------------------------------------- */\n\nexport interface FiltersProps<V = unknown, O = unknown> {\n /** The field schema. Nested via each field's own `fields`. */\n fields: FilterField<V, O>[];\n\n query?: FilterQuery<V>;\n defaultQuery?: FilterQuery<V>;\n onQueryChange?: (query: FilterQuery<V>, details: FilterChangeDetails<V, O>) => void;\n\n labels?: Partial<FilterLabels>;\n /** Operator wording, overridden independently of the chrome copy. */\n operatorLabels?: FilterOperatorLabels;\n /** Extra or replacement value editors, resolved by a field's `editor` name. */\n editors?: FilterEditorRegistry;\n\n /**\n * Which chrome draws the query. `\"basic\"` is the flat chip row, joined by an\n * implicit AND and drawing no combinator, because a chip row has nowhere to\n * put a parenthesis, and it draws a nested rule at any depth as a flat chip.\n */\n variant?: \"basic\" | \"advanced\";\n /** Where the advanced builder lives. `\"inline\"` renders the panel in place. */\n advancedMode?: \"popover\" | \"inline\";\n /**\n * Where the panel sits against its trigger. Stating it settles a twin split:\n * on overflow Base UI flips edges, Radix only shifts along the axis.\n */\n advancedAlign?: \"start\" | \"center\" | \"end\";\n /**\n * Whether the advanced builder's rows can be REORDERED. Off by default: a\n * move changes nothing about what the query MEANS, and costs a grip on every\n * row plus a gesture a touch screen starts by accident. On, drag and\n * Alt+Arrow move any row but the lone root.\n */\n reorderable?: boolean;\n\n /**\n * The density of the whole bar, chips included. TWO RUNGS and no `lg`,\n * resolved through `filterControlSizes` to whatever the ACTIVE STYLE calls\n * that rung (nova 7/8, sera 9/10, mira 6/7, maia and luma 8/9, lyra and rhea\n * 7/8, vega 8/9). Chips need no `ButtonGroup` variant: `items-stretch` gives\n * the pill the height of its one definite-height child, the kebab.\n */\n size?: \"sm\" | \"default\";\n disabled?: boolean;\n readOnly?: boolean;\n\n /**\n * ONE VETO POINT for every change the BAR makes to the query, and only those.\n * Return `false` to refuse; anything else commits, and `details.reason` names\n * the action. One hook and not fourteen because every write goes through\n * `emit`: the Delete key, Alt+Arrow and a drag alike. It can only refuse, and\n * it sits BEHIND the lock, so a locked bar never asks it. Returning a\n * REPLACEMENT tree was rejected: the announcement is already computed from\n * the proposed tree, so the bar would say one thing and commit another.\n */\n onBeforeQueryChange?: (\n query: FilterQuery<V>,\n details: FilterChangeDetails<V, O>,\n ) => boolean | undefined;\n\n /**\n * Offers \"Convert to advanced filter\" in every chip's kebab; its presence IS\n * the switch, since `variant` belongs to the consumer. Not drawn in advanced.\n */\n onConvertToAdvanced?: () => void;\n\n /**\n * Classes for the dropdown MENUS and the field PICKER panel, one prop each\n * rather than one per mount point. Merged after the default, so `w-*` wins.\n */\n menuClassName?: string;\n fieldPickerClassName?: string;\n\n /**\n * How a NESTED attribute path is shortened when too deep to read. `\"none\"` is\n * the default, so an upgrade changes nothing under a consumer; the collapser\n * is the cascader's, and the full path survives as the accessible NAME.\n */\n pathCollapse?: FilterPathCollapse;\n /**\n * How many names survive the collapse, the elided run not counted. Inert\n * while `pathCollapse` is `\"none\"`. Three is the cascader's own default.\n */\n maxPathSegments?: number;\n\n /** Replaces the default Add filter button. */\n trigger?: React.ReactNode;\n /** Renders a Clear button once the query holds anything. */\n showClear?: boolean;\n\n renderValue?: (context: FilterValueDisplayContext<V, O>) => React.ReactNode;\n renderChip?: (rule: FilterRule<V>) => React.ReactNode;\n /**\n * Replaces the advanced builder's empty state, which exists at all because a\n * builder with no rows is a footer floating in blank space. `null` for none.\n */\n renderEmpty?: (context: FilterEmptyStateContext) => React.ReactNode;\n\n className?: string;\n children?: React.ReactNode;\n}\n\nexport function Filters<V = unknown, O = unknown>({\n fields,\n query: controlledQuery,\n defaultQuery,\n onQueryChange,\n labels: labelsProp,\n operatorLabels: operatorLabelsProp,\n editors: editorsProp,\n variant = \"basic\",\n advancedMode = \"popover\",\n advancedAlign = \"start\",\n reorderable = false,\n size = \"default\",\n disabled = false,\n readOnly = false,\n onBeforeQueryChange,\n onConvertToAdvanced,\n menuClassName,\n fieldPickerClassName,\n pathCollapse = \"none\",\n maxPathSegments = 3,\n trigger,\n showClear = false,\n renderValue,\n renderChip,\n renderEmpty,\n className,\n children,\n}: FiltersProps<V, O>) {\n const { query, queryRef, setQuery } = useControllableQuery<V, O>(\n controlledQuery,\n defaultQuery,\n onQueryChange,\n );\n\n const [draft, dispatchDraftRaw] = React.useReducer(\n filterDraftReducer<V>,\n null as FilterDraft<V> | null,\n );\n // Text AND a counter: `aria-live` fires on a DOM mutation and React writes\n // nothing when the string is already there, so a repeat was silent. Measured\n // with a MutationObserver: \"Group added\" three times, one mutation.\n const [announced, setAnnounced] = React.useState({ seq: 0, text: \"\" });\n const announcement = announced.text;\n const setAnnouncement = React.useCallback((text: string) => {\n setAnnounced((prev) => ({ seq: prev.seq + 1, text }));\n }, []);\n\n // Seeded from useId: ids from Date.now() plus Math.random() broke hydration.\n const idSeed = React.useId();\n const nextId = React.useMemo(() => createFilterIdFactory(`${idSeed}f`), [idSeed]);\n\n const focusStore = React.useMemo(() => createFilterFocusStore(), []);\n const rowStateStore = React.useMemo(() => createFilterRowStateStore(), []);\n // One per root: the value-to-label store every `useFilterOptions` shares.\n const resolutionStore = React.useMemo(() => createFilterResolutionStore(), []);\n\n /* -------------------------------- derived ------------------------------- */\n\n // `fields` is an inline literal at every real call site, so the CHEAP walk\n // runs every render and the EXPENSIVE index memoizes on its result. Not a\n // ref caching the previous index: writing a ref during render is the\n // impurity this rewrite removed, and it misbehaves under StrictMode.\n const signature = computeFilterSchemaSignature(fields);\n const index = React.useMemo(\n () => buildFilterIndex<V, O>(fields, null, signature),\n // Not `fields`: its identity changes every render at every real call site.\n [signature, fields],\n );\n\n const labels = React.useMemo(() => resolveFilterLabels(labelsProp), [labelsProp]);\n\n const operatorCatalog = React.useMemo(() => {\n if (!operatorLabelsProp) return DEFAULT_FILTER_OPERATORS;\n return createFilterOperators({\n ...DEFAULT_FILTER_OPERATOR_LABELS,\n ...operatorLabelsProp,\n });\n }, [operatorLabelsProp]);\n\n const editors = React.useMemo(\n () => ({ ...DEFAULT_FILTER_EDITORS, ...editorsProp }),\n [editorsProp],\n );\n\n const resolveOperators = React.useCallback(\n (field: FilterField<V, O>) => resolveFilterOperators(field, operatorCatalog),\n [operatorCatalog],\n );\n\n const ruleCount = React.useMemo(() => countFilterRules(query), [query]);\n\n /* --------------------------- latest-props ref --------------------------- */\n\n const latest = React.useRef({\n index,\n labels,\n operatorCatalog,\n resolveOperators,\n draft,\n nextId,\n setQuery,\n queryRef,\n disabled,\n readOnly,\n onBeforeQueryChange,\n });\n React.useEffect(() => {\n latest.current = {\n index,\n labels,\n operatorCatalog,\n resolveOperators,\n draft,\n nextId,\n setQuery,\n queryRef,\n disabled,\n readOnly,\n onBeforeQueryChange,\n };\n });\n\n /* -------------------------------- actions ------------------------------- */\n\n // Every mutator below reads state through `latest`, so no keystroke rebuilds\n // one. The lock flags are the ONE exception, for the reason on `locked`.\n\n /**\n * THE MUTATION BOUNDARY, asked here and not at the nine buttons, because the\n * routes into a query are not only buttons. It needs BOTH the closure and\n * the ref: `latest` is written in a passive effect and effects run\n * child-first, so a consumer effect in the commit that turns `readOnly` on\n * runs BEFORE the ref learns of it, while the ref is what a stale handler\n * reads afterwards.\n */\n const locked = React.useCallback(\n () => disabled || readOnly || isFilterLocked(latest.current),\n [disabled, readOnly],\n );\n\n // Reports whether the write LANDED: `onBeforeQueryChange` is discoverable\n // only here, and a vetoed remove that still announced a count would lie.\n const emit = React.useCallback(\n (\n next: FilterQuery<V>,\n reason: FilterChangeDetails<V, O>[\"reason\"],\n rule: FilterRule<V> | null,\n ): boolean => {\n // The backstop, redundant with each mutator's own early return, and\n // FIRST, so the consumer hook cannot approve what the lock refused.\n if (locked()) return false;\n const field = rule ? (getFilterField(latest.current.index, rule.path) ?? null) : null;\n const details: FilterChangeDetails<V, O> = { reason, rule, field };\n // Strictly `false`, so a handler that forgets to return is not a veto.\n if (latest.current.onBeforeQueryChange?.(next, details) === false) {\n return false;\n }\n latest.current.setQuery(next, details);\n return true;\n },\n [locked],\n );\n\n /**\n * Drops the roving tab stop when the node holding it no longer exists: a cell\n * claims it when the store names it, and the \"row one takes it\" fallback\n * fires only when the store is EMPTY, so a deleted id left twenty cells at\n * `tabindex=\"-1\"` with focus on the BODY. Keyed on the committed `query`, so\n * a consumer's Reset or saved-view load is repaired too: add a condition,\n * press Reset, and 25 cells stayed untabbable in both twins.\n */\n React.useEffect(() => {\n const { id } = focusStore.getSnapshot();\n if (!id || findFilterNode(query, id)) return;\n focusStore.set({ id: null, segment: null, autoOpen: false });\n }, [query, focusStore]);\n\n const addRule = React.useCallback(\n (rule: FilterRule<V>, parentId?: string) => {\n if (locked()) return;\n const next = insertFilterNode(latest.current.queryRef.current, rule, parentId);\n if (!emit(next, \"add\", rule)) return;\n setAnnouncement(latest.current.labels.countAnnouncement(countFilterRules(next)));\n },\n [emit, locked, setAnnouncement],\n );\n\n const addGroup = React.useCallback(\n (parentId?: string, combinator: FilterCombinator = \"or\") => {\n // Before `nextId`, so a LOCKED bar cannot drift the SSR-seeded sequence.\n if (locked()) return \"\";\n const id = latest.current.nextId();\n // `or` by default: `a AND (b AND c)` is just `a AND b AND c`.\n const next = insertFilterNode(\n latest.current.queryRef.current,\n createFilterGroup<V>({ id, combinator }),\n parentId,\n );\n // `\"\"` on a veto: every caller moves focus onto the id it gets back, and\n // focusing a group that was never created strands the tab stop. The id\n // is already burnt, deliberately: a veto is a client-time decision the\n // server never took part in.\n if (!emit(next, \"add\", null)) return \"\";\n setAnnouncement(latest.current.labels.groupAnnouncement(true));\n return id;\n },\n [emit, locked, setAnnouncement],\n );\n\n const updateRule = React.useCallback(\n (id: string, updates: Partial<Omit<FilterRule<V>, \"id\" | \"type\">>) => {\n if (locked()) return;\n const current = latest.current.queryRef.current;\n const next = updateFilterRule(current, id, updates);\n if (next === current) return;\n // THE VALUE, not the field or the operator: picking an attribute leaves\n // the value empty, so arming there reddens the flow the primitive itself\n // walks a user through. A field re-pick sends `value: undefined` in the\n // SAME patch, so `path` and not the presence of `value` tells the two\n // apart. Clearing a typed value still arms it: no `path` in that patch.\n if (\"path\" in updates) rowStateStore.unmark(id);\n else if (\"value\" in updates) rowStateStore.mark(id);\n emit(next, \"update\", findFilterRule(next, id));\n },\n [emit, locked, rowStateStore],\n );\n\n const removeNode = React.useCallback(\n (id: string) => {\n if (locked()) return;\n const current = latest.current.queryRef.current;\n const removed = findFilterRule(current, id);\n const next = removeFilterNode(current, id);\n if (next === current) return;\n if (!emit(next, \"remove\", removed)) return;\n // A rule removal reports the COUNT; a group has no rule to report and\n // takes an unknown number of conditions with it, so it says so instead.\n setAnnouncement(\n removed\n ? latest.current.labels.countAnnouncement(countFilterRules(next))\n : latest.current.labels.groupAnnouncement(false),\n );\n },\n [emit, locked, setAnnouncement],\n );\n\n const duplicateNode = React.useCallback(\n (id: string) => {\n if (locked()) return;\n const current = latest.current.queryRef.current;\n const next = duplicateFilterNode(current, id, latest.current.nextId);\n if (next === current) return;\n if (!emit(next, \"duplicate\", findFilterRule(current, id))) return;\n // The count, not \"duplicated\": a GROUP adds an unknown number of rows.\n setAnnouncement(latest.current.labels.countAnnouncement(countFilterRules(next)));\n },\n [emit, locked, setAnnouncement],\n );\n\n const negateRule = React.useCallback(\n (id: string) => {\n if (locked()) return;\n const current = latest.current.queryRef.current;\n const rule = findFilterRule(current, id);\n if (!rule) return;\n const field = getFilterField(latest.current.index, rule.path);\n if (!field) return;\n const operators = latest.current.resolveOperators(field);\n const flipped = negateFilterOperator(\n getFilterOperator(operators, rule.operator),\n operators,\n rule.negated,\n );\n const next = updateFilterRule(current, id, {\n operator: flipped.operator ?? rule.operator,\n negated: flipped.negated || undefined,\n });\n emit(next, \"negate\", findFilterRule(next, id));\n },\n [emit, locked],\n );\n\n // Says where a node LANDED, the one mutator a screen reader hears nothing\n // else about: focus stays on the handle and the name does not change. Reads\n // the tree AFTER the move: the position and sibling count announced are the\n // ones the user has just arrived at.\n const announceReorder = React.useCallback(\n (next: FilterQuery<V>, id: string, fromParentId: string | null) => {\n const found = findFilterNode(next, id);\n if (!found?.parent) return;\n const label = isFilterRule(found.node)\n ? formatFilterPath(\n latest.current.index,\n found.node.path,\n latest.current.labels.pathSeparator,\n )\n : found.node.combinator === \"and\"\n ? latest.current.labels.groupAll\n : latest.current.labels.groupAny;\n const position = found.index + 1;\n const total = found.parent.rules.length;\n\n // A move that changed the node's CONTAINER is a different event, named by\n // the group's own headline, or the bar's label at the top level.\n if (fromParentId && fromParentId !== found.parent.id) {\n const destination =\n found.parent.id === next.id\n ? latest.current.labels.filtersLabel\n : found.parent.combinator === \"and\"\n ? latest.current.labels.groupAll\n : latest.current.labels.groupAny;\n setAnnouncement(\n latest.current.labels.moveAnnouncement(label, destination, position, total),\n );\n return;\n }\n\n setAnnouncement(latest.current.labels.reorderAnnouncement(label, position, total));\n },\n [setAnnouncement],\n );\n\n const moveNode = React.useCallback(\n (id: string, delta: number) => {\n if (locked()) return;\n const current = latest.current.queryRef.current;\n const next = moveFilterNode(current, id, delta);\n if (next === current) return;\n if (!emit(next, \"reorder\", findFilterRule(next, id))) return;\n // Within the owning group by construction, so there is no destination.\n announceReorder(next, id, null);\n },\n [emit, announceReorder, locked],\n );\n\n // Also the drag layer's drop commit, so a drag and Alt+Arrow say the same.\n const moveNodeTo = React.useCallback(\n (id: string, parentId: string, index: number) => {\n if (locked()) return;\n const current = latest.current.queryRef.current;\n // BEFORE the move: the only place the old parent still exists.\n const fromParentId = findFilterNode(current, id)?.parent?.id ?? null;\n const next = moveFilterNodeTo(current, id, parentId, index);\n if (next === current) return;\n if (!emit(next, \"reorder\", findFilterRule(next, id))) return;\n announceReorder(next, id, fromParentId);\n },\n [emit, announceReorder, locked],\n );\n\n const copyNodeTo = React.useCallback(\n (id: string, parentId: string, index: number) => {\n if (locked()) return;\n const current = latest.current.queryRef.current;\n const next = copyFilterNodeTo(current, id, parentId, index, latest.current.nextId);\n if (next === current) return;\n if (!emit(next, \"duplicate\", findFilterRule(current, id))) return;\n // The count again: an Alt-drag of a GROUP adds an unknown number of rows.\n setAnnouncement(latest.current.labels.countAnnouncement(countFilterRules(next)));\n },\n [emit, locked, setAnnouncement],\n );\n\n const wrapNodeInGroup = React.useCallback(\n (id: string, combinator: FilterCombinator = \"or\") => {\n if (locked()) return;\n const current = latest.current.queryRef.current;\n const next = wrapFilterNodeInGroup(current, id, latest.current.nextId(), combinator);\n if (next === current) return;\n if (!emit(next, \"add\", findFilterRule(next, id))) return;\n setAnnouncement(latest.current.labels.groupAnnouncement(true));\n },\n [emit, locked, setAnnouncement],\n );\n\n const unwrapGroup = React.useCallback(\n (groupId: string) => {\n if (locked()) return;\n const current = latest.current.queryRef.current;\n const next = unwrapFilterGroup(current, groupId);\n if (next === current) return;\n // The conditions survive in place, so the count has not changed.\n if (!emit(next, \"remove\", null)) return;\n setAnnouncement(latest.current.labels.groupAnnouncement(false));\n },\n [emit, locked, setAnnouncement],\n );\n\n // What a combinator change SOUNDS like: the pill's name changes with it, but\n // a name change on the FOCUSED element is not re-announced by NVDA or JAWS.\n // The group's own headline, not the bare word: it says what the query MEANS\n // now, which is the thing that changed.\n const announceCombinator = React.useCallback(\n (combinator: FilterCombinator) => {\n setAnnouncement(\n combinator === \"and\" ? latest.current.labels.groupAll : latest.current.labels.groupAny,\n );\n },\n [setAnnouncement],\n );\n\n const setCombinatorAction = React.useCallback(\n (groupId: string, combinator: FilterCombinator) => {\n if (locked()) return;\n const current = latest.current.queryRef.current;\n const next = setFilterCombinator(current, groupId, combinator);\n if (next === current) return;\n if (!emit(next, \"combinator\", null)) return;\n announceCombinator(combinator);\n },\n [emit, locked, announceCombinator],\n );\n\n const toggleCombinatorAction = React.useCallback(\n (groupId: string) => {\n if (locked()) return;\n const current = latest.current.queryRef.current;\n const next = toggleFilterCombinator(current, groupId);\n if (next === current) return;\n if (!emit(next, \"combinator\", null)) return;\n // Read off the COMMITTED tree, so the sentence cannot disagree with it.\n const group = findFilterNode(next, groupId)?.node;\n if (group && !isFilterRule(group)) announceCombinator(group.combinator);\n },\n [emit, locked, announceCombinator],\n );\n\n const clearQueryAction = React.useCallback(() => {\n if (locked()) return;\n const current = latest.current.queryRef.current;\n const next = clearFilterQuery(current);\n if (next === current) return;\n if (!emit(next, \"clear\", null)) return;\n setAnnouncement(latest.current.labels.countAnnouncement(0));\n }, [emit, locked, setAnnouncement]);\n\n // The live region, opened to the chrome inside the bar. The setter itself is\n // not published: it is a channel anything could write anything to.\n const announce = React.useCallback(\n (message: string) => {\n if (!message) return;\n setAnnouncement(message);\n },\n [setAnnouncement],\n );\n\n // A draft is a MUTATION in progress, so it locks with the rest, except\n // `close`: a panel open when the bar turned read only must still dismiss.\n const dispatchDraft = React.useCallback(\n (action: FilterDraftAction<V>) => {\n if (action.type !== \"close\" && locked()) return;\n dispatchDraftRaw(action);\n },\n [locked],\n );\n\n const openCreate = React.useCallback(() => {\n if (locked()) return;\n dispatchDraftRaw({ type: \"openCreate\" });\n }, [locked]);\n\n const openAmend = React.useCallback(\n (id: string, step: FilterDraftStep) => {\n if (locked()) return;\n const rule = findFilterRule(latest.current.queryRef.current, id);\n if (!rule) return;\n dispatchDraftRaw({\n type: \"openAmend\",\n ruleId: id,\n step,\n path: rule.path,\n operator: rule.operator,\n value: rule.value,\n });\n },\n [locked],\n );\n\n const closeDraft = React.useCallback(() => dispatchDraftRaw({ type: \"close\" }), []);\n\n const getQuery = React.useCallback(() => latest.current.queryRef.current, []);\n const getDraft = React.useCallback(() => latest.current.draft, []);\n\n /* ------------------------- draft -> query commit ------------------------ */\n\n // The draft becomes a rule exactly once, when the reducer says it is ready.\n // Here rather than in each click handler, which is what lets the \"arity none\n // skips the value step\" branch live in the pure reducer.\n React.useEffect(() => {\n if (draft?.status !== \"ready\") return;\n if (!isFilterDraftCommittable(draft)) return;\n\n if (draft.ruleId) {\n updateRule(draft.ruleId, {\n path: draft.path,\n operator: draft.operator ?? \"\",\n value: draft.value,\n });\n } else if (!locked()) {\n // Asked here too: this branch burns an id and points the focus store at\n // it, and a store naming a chip that never existed eats the tab stop.\n const id = nextId();\n addRule(\n createFilterRule<V>({\n id,\n path: draft.path,\n // Empty on purpose: the chip renders \"Select condition\" and opens.\n operator: \"\",\n value: undefined,\n }),\n );\n focusStore.set({ id, segment: \"operator\", autoOpen: true });\n }\n dispatchDraftRaw({ type: \"close\" });\n }, [draft, addRule, updateRule, nextId, focusStore, locked]);\n\n /* ---------------------------- dev diagnostics --------------------------- */\n\n React.useEffect(() => {\n if (process.env.NODE_ENV === \"production\") return;\n const issues = findFilterSchemaIssues(fields, (field) =>\n resolveFilterOperators(field, operatorCatalog),\n );\n if (issues.duplicatePaths.length) {\n warnFilterOnce(\n `dup:${issues.duplicatePaths.join(\",\")}`,\n `duplicate sibling field ids are ignored after the first: ${issues.duplicatePaths.join(\", \")}`,\n );\n }\n if (issues.emptyIds.length) {\n warnFilterOnce(\"empty-id\", \"every field needs a non-empty id\");\n }\n if (issues.unknownDefaultOperators.length) {\n warnFilterOnce(\n `op:${issues.unknownDefaultOperators.join(\",\")}`,\n `defaultOperator names an operator the field does not offer: ${issues.unknownDefaultOperators.join(\", \")}`,\n );\n }\n }, [fields, operatorCatalog]);\n\n /* ------------------------------- contexts ------------------------------- */\n\n const actions = React.useMemo<FilterActionsContextValue<V, O>>(\n () => ({\n index,\n labels,\n operatorCatalog,\n editors,\n size,\n disabled,\n readOnly,\n variant,\n menuClassName,\n fieldPickerClassName,\n convertToAdvanced: onConvertToAdvanced,\n pathCollapse,\n maxPathSegments,\n resolveOperators,\n // The same lookup the chrome uses, so a headless consumer can ask it too.\n resolveEditor: (field, operator) =>\n resolveFilterEditor(field, operator, editors) as FilterEditor<V, O> | undefined,\n resolution: resolutionStore,\n addRule,\n addGroup,\n updateRule,\n removeNode,\n duplicateNode,\n negateRule,\n moveNode,\n moveNodeTo,\n copyNodeTo,\n wrapNodeInGroup,\n unwrapGroup,\n setCombinator: setCombinatorAction,\n toggleCombinator: toggleCombinatorAction,\n clearQuery: clearQueryAction,\n openCreate,\n openAmend,\n closeDraft,\n dispatchDraft,\n announce,\n getQuery,\n getDraft,\n nextId,\n }),\n // Every input is memoized and every action `[]`-stable, so this\n // republishes on a real schema or config change, never on a keystroke.\n [\n index,\n labels,\n operatorCatalog,\n editors,\n size,\n disabled,\n readOnly,\n variant,\n menuClassName,\n fieldPickerClassName,\n onConvertToAdvanced,\n pathCollapse,\n maxPathSegments,\n resolveOperators,\n resolutionStore,\n addRule,\n addGroup,\n updateRule,\n removeNode,\n duplicateNode,\n negateRule,\n moveNode,\n moveNodeTo,\n copyNodeTo,\n wrapNodeInGroup,\n unwrapGroup,\n setCombinatorAction,\n toggleCombinatorAction,\n clearQueryAction,\n openCreate,\n openAmend,\n closeDraft,\n dispatchDraft,\n announce,\n getQuery,\n getDraft,\n nextId,\n ],\n );\n\n const state = React.useMemo(\n () => ({\n query,\n draft,\n ruleCount,\n announcement,\n announcementSeq: announced.seq,\n }),\n [query, draft, ruleCount, announcement, announced.seq],\n );\n\n const renderContext = React.useMemo(\n () => ({ renderValue, renderChip, renderEmpty }),\n [renderValue, renderChip, renderEmpty],\n );\n\n return (\n <FilterActionsContext.Provider value={actions as unknown as FilterActionsContextValue}>\n <FilterStateContext.Provider value={state as never}>\n <FilterRenderContext.Provider value={renderContext as never}>\n <FilterRowStateProvider value={rowStateStore}>\n <FilterFocusContext.Provider value={focusStore}>\n {children ??\n (variant === \"advanced\" ? (\n <FiltersAdvanced<V, O>\n mode={advancedMode}\n align={advancedAlign}\n trigger={trigger}\n reorderable={reorderable}\n className={className}\n />\n ) : (\n <FiltersRow trigger={trigger} showClear={showClear} className={className} />\n ))}\n </FilterFocusContext.Provider>\n </FilterRowStateProvider>\n </FilterRenderContext.Provider>\n </FilterStateContext.Provider>\n </FilterActionsContext.Provider>\n );\n}\n\n/* -------------------------------------------------------------------------- */\n/* Row */\n/* -------------------------------------------------------------------------- */\n\nexport interface FiltersRowProps {\n trigger?: React.ReactNode;\n showClear?: boolean;\n className?: string;\n}\n\n/**\n * The chip row: a toolbar with a roving tabindex, where the predecessor made\n * every segment of every chip its own tab stop. There is NO combinator here,\n * because a chip row can draw a word between two pills but not a parenthesis.\n */\nexport function FiltersRow({ trigger, showClear, className }: FiltersRowProps) {\n const actions = useFilterActions();\n const sizes = filterControlSizes(actions);\n const { query, ruleCount, announcement, announcementSeq } = useFilterState();\n const focusStore = useFilterFocusStore();\n const rootRef = React.useRef<HTMLDivElement>(null);\n // The keys consult this even though the actions already refuse: an ungated\n // Enter would ARM `autoOpen` for a popover that then refuses to open. Gated\n // per branch, never at the top of `onKeyDown`: the arrows, Home and End are\n // how a read-only bar is read.\n const locked = isFilterLocked(actions);\n\n // Flattened, not `query.rules.filter(isFilterRule)`: a query built in the\n // advanced builder would otherwise hide nested conditions that still filter.\n const rules = React.useMemo(() => flattenFilterRules(query), [query]);\n\n const chips = () =>\n Array.from(rootRef.current?.querySelectorAll<HTMLElement>('[data-slot=\"filter-chip\"]') ?? []);\n\n const onKeyDown = (event: React.KeyboardEvent<HTMLDivElement>) => {\n const target = (event.target as HTMLElement).closest<HTMLElement>('[data-slot=\"filter-chip\"]');\n if (!target) return;\n // A key pressed inside an open popover belongs to that popover.\n if (event.target !== target) return;\n\n const all = chips();\n const current = all.indexOf(target);\n if (current === -1) return;\n\n const rtl = getComputedStyle(target).direction === \"rtl\";\n const forward = rtl ? \"ArrowLeft\" : \"ArrowRight\";\n const backward = rtl ? \"ArrowRight\" : \"ArrowLeft\";\n\n const focusAt = (index: number) => {\n const next = all[Math.max(0, Math.min(index, all.length - 1))];\n if (!next) return;\n event.preventDefault();\n next.focus();\n };\n\n const ruleId = target.dataset.ruleId;\n if (!ruleId) return;\n\n if (event.altKey && (event.key === forward || event.key === backward)) {\n if (locked) return;\n event.preventDefault();\n actions.moveNode(ruleId, event.key === forward ? 1 : -1);\n return;\n }\n if (event.key === forward) return focusAt(current + 1);\n if (event.key === backward) return focusAt(current - 1);\n if (event.key === \"Home\") return focusAt(0);\n if (event.key === \"End\") return focusAt(all.length - 1);\n\n if (event.key === \"Backspace\" || event.key === \"Delete\") {\n if (locked) return;\n event.preventDefault();\n actions.removeNode(ruleId);\n // The neighbour taking this chip's place, so a run of deletes keeps focus.\n requestAnimationFrame(() => {\n const remaining = chips();\n remaining[Math.min(current, remaining.length - 1)]?.focus();\n });\n return;\n }\n\n if (event.key === \"Enter\" || event.key === \" \") {\n if (locked) return;\n event.preventDefault();\n // Enter RESUMES the chip: the attribute segment is display only, so the\n // target is whichever step the flow has not reached, never nothing.\n const rule = findFilterRule(actions.getQuery(), ruleId);\n if (!rule) return;\n const field = getFilterField(actions.index, rule.path);\n // No popover to open, so autoOpen would sit armed until another chip\n // spent it. The chip stays reachable and Delete still removes it.\n if (!field) return;\n const operator = getFilterOperator(actions.resolveOperators(field), rule.operator);\n const segment = rule.operator && operatorTakesValue(operator) ? \"value\" : \"operator\";\n focusStore.set({ id: ruleId, segment, autoOpen: true });\n }\n };\n\n return (\n <div\n ref={rootRef}\n data-slot=\"filters\"\n data-empty={rules.length === 0 || undefined}\n /* A presence hook, so a consumer can tint the whole read-only bar. */\n data-readonly={actions.readOnly || undefined}\n className={cn(\n /* `sizes.button` and not `actions.size`: the gap ladder and the control\n ladder must answer for the same rung, normalized in one place. */\n filtersBarVariants({ size: sizes.button }),\n /* An empty toolbar is still a flex child, so it took a gap with no\n width. The gap goes, not the toolbar, which owns the row's name. */\n rules.length === 0 && \"gap-0\",\n className,\n )}\n >\n <div\n role=\"toolbar\"\n aria-label={actions.labels.filtersLabel}\n aria-orientation=\"horizontal\"\n /* `role=toolbar` disallows `aria-readonly`, and `aria-disabled` would\n deny arrowing; a description is legal here and spoken on entry. */\n {...(actions.readOnly ? { \"aria-description\": actions.labels.readOnly } : null)}\n className={cn(filtersBarVariants({ size: sizes.button }))}\n onKeyDown={onKeyDown}\n >\n {rules.map((rule, index) => (\n <FilterChip key={rule.id} rule={rule} index={index} />\n ))}\n </div>\n\n <FiltersBuilder trigger={trigger} />\n\n {showClear && ruleCount > 0 ? (\n // `ms-auto` and not `ml-auto`, so Clear stays on the trailing edge\n // under RTL, where the whole bar mirrors.\n <Button\n variant=\"outline\"\n /* The same rung as the Add filter trigger beside it. */\n size={sizes.button}\n className=\"ms-auto\"\n /* `disabled` for the hard flag, `aria-disabled` for the soft one, so\n a read-only Clear keeps its tab stop and can still be found. */\n disabled={actions.disabled}\n {...filterReadOnlyProps(actions)}\n onClick={() => actions.clearQuery()}\n >\n {actions.labels.clear}\n </Button>\n ) : null}\n\n {/* Keyed on the sequence, so the same sentence twice is two\n announcements (see `announced` for the measurement). A replaced live\n element stops being watched. */}\n <div aria-live=\"polite\" role=\"status\" className=\"sr-only\">\n <span key={announcementSeq}>{announcement}</span>\n </div>\n </div>\n );\n}\n\n/* -------------------------------------------------------------------------- */\n/* Exports */\n/* -------------------------------------------------------------------------- */\n\nexport {\n FilterAdvancedRow,\n FiltersAdvanced,\n FiltersAdvancedPanel,\n} from \"./filters-advanced\";\nexport {\n FilterFieldPicker,\n FiltersBuilder,\n} from \"./filters-builder\";\nexport {\n FilterChip,\n FilterOperatorPopover,\n FilterRuleMenuItems,\n FilterValuePopover,\n useFilterRuleDisplay,\n} from \"./filters-chip\";\nexport {\n // The read-only contract: the gate, and the props a mutating control wears.\n filterReadOnlyProps,\n isFilterLocked,\n useFilterActions,\n // What a custom chip needs to rebuild the roving scheme `renderChip` drops.\n useFilterChipAutoOpen,\n useFilterChipFocused,\n useFilterFocus,\n useFilterFocusEmpty,\n useFilterFocusStore,\n useFilterRender,\n useFilterSegmentFocus,\n useFilterState,\n} from \"./filters-context\";\nexport {\n DEFAULT_FILTER_EDITORS,\n useFilterOptions,\n useFilterValueResolution,\n} from \"./filters-editors\";\nexport { DEFAULT_FILTER_LABELS } from \"./filters-i18n\";\nexport {\n DEFAULT_FILTER_OPERATOR_LABELS,\n DEFAULT_FILTER_OPERATORS,\n} from \"./filters-operators\";\n// The two resolver signatures `collectFilterIssues` takes.\nexport type {\n FilterArityResolver,\n FilterValidateResolver,\n} from \"./filters-query\";\n// The full pure READ surface, so one import reaches everything a predicate, a\n// saved view or a backend query needs. It stops at the query TREE and compiles\n// nothing: `flattenFilterConditions` is the hand-off a server compiles from.\n// No SQL emitter, because a server has to re-validate anything a browser sends\n// and should compile from the tree rather than parse a client's string. SQL is\n// one target of that hand-off beside Prisma, Drizzle, a REST query string and\n// Elasticsearch.\nexport {\n // The panel does not DRAW the built-in reasons, so this is the only way to\n // surface \"missing value\", \"empty group\" and the rest.\n collectFilterIssues,\n copyFilterNodeTo,\n countFilterRules,\n createFilterGroup,\n createFilterQuery,\n createFilterRule,\n flattenFilterConditions,\n flattenFilterRules,\n isFilterQueryEmpty,\n isFilterRuleComplete,\n moveFilterNodeTo,\n pruneFilterQuery,\n unwrapFilterGroup,\n wrapFilterNodeInGroup,\n} from \"./filters-query\";\nexport type * from \"./filters-types\";\n"],"mappings":";;;;;;;;;;;;;;;;;AAkGA,MAAM,qBAAqB,IAAI,+BAA+B;CAC5D,UAAU,EAKR,MAAM;EACJ,IAAI;EACJ,SAAS;CACX,EACF;CACA,iBAAiB,EAAE,MAAM,UAAU;AACrC,CAAC;AAMD,SAAS,qBACP,YACA,qBACA,UACA;CACA,MAAM,eAAe,eAAe,KAAA;CACpC,MAAM,CAAC,UAAU,eAAeA,QAAM,eAC9B,uBAAuB,kBAAqB,CACpD;CAEA,MAAM,QAAQ,eAAe,aAAa;CAC1C,MAAM,WAAWA,QAAM,OAAO,KAAK;CACnC,QAAM,gBAAgB;EACpB,SAAS,UAAU;CACrB,CAAC;CAYD,OAAO;EAAE;EAAO;EAAU,UAVTA,QAAM,aACpB,MAAsB,YAAuC;GAC5D,IAAI,SAAS,SAAS,SAAS;GAC/B,SAAS,UAAU;GACnB,IAAI,CAAC,cAAc,YAAY,IAAI;GACnC,WAAW,MAAM,OAAO;EAC1B,GACA,CAAC,cAAc,QAAQ,CAGQ;CAAE;AACrC;AA4GA,SAAgB,QAAkC,EAChD,QACA,OAAO,iBACP,cACA,eACA,QAAQ,YACR,gBAAgB,oBAChB,SAAS,aACT,UAAU,SACV,eAAe,WACf,gBAAgB,SAChB,cAAc,OACd,OAAO,WACP,WAAW,OACX,WAAW,OACX,qBACA,qBACA,eACA,sBACA,eAAe,QACf,kBAAkB,GAClB,SACA,YAAY,OAC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zG;CAEJ,GAAG,CAAC,QAAQ,eAAe,CAAC;CAI5B,MAAM,UAAUA,QAAM,eACb;EACL;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,mBAAmB;EACnB;EACA;EACA;EAEA,gBAAgB,OAAO,aACrB,oBAAoB,OAAO,UAAU,OAAO;EAC9C,YAAY;EACZ;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,eAAe;EACf,kBAAkB;EAClB,YAAY;EACZ;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF,IAGA;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF,CACF;CAEA,MAAM,QAAQA,QAAM,eACX;EACL;EACA;EACA;EACA;EACA,iBAAiB,UAAU;CAC7B,IACA;EAAC;EAAO;EAAO;EAAW;EAAc,UAAU;CAAG,CACvD;CAEA,MAAM,gBAAgBA,QAAM,eACnB;EAAE;EAAa;EAAY;CAAY,IAC9C;EAAC;EAAa;EAAY;CAAW,CACvC;CAEA,OACE,oBAAC,qBAAqB,UAAtB;EAA+B,OAAO;EACpC,UAAA,oBAAC,mBAAmB,UAApB;GAA6B,OAAO;GAClC,UAAA,oBAAC,oBAAoB,UAArB;IAA8B,OAAO;IACnC,UAAA,oBAAC,wBAAD;KAAwB,OAAO;KAC7B,UAAA,oBAAC,mBAAmB,UAApB;MAA6B,OAAO;MACjC,UAAA,aACE,YAAY,aACX,oBAAC,iBAAD;OACE,MAAM;OACN,OAAO;OACE;OACI;OACF;MACZ,CAAA,IAED,oBAAC,YAAD;OAAqB;OAAoB;OAAsB;MAAY,CAAA;KAEpD,CAAA;IACP,CAAA;GACI,CAAA;EACH,CAAA;CACA,CAAA;AAEnC;;;;;;AAiBA,SAAgB,WAAW,EA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M,KAAK,MAAM,UAChB,oBAAC,YAAD;KAAgC;KAAa;IAAQ,GAApC,KAAK,EAA+B,CACtD;GACE,CAAA;GAEL,oBAAC,gBAAD,EAAyB,QAAU,CAAA;GAElC,aAAa,YAAY,IAGxB,oBAAC,QAAD;IACE,SAAQ;IAER,MAAM,MAAM;IACZ,WAAU;IAGV,UAAU,QAAQ;IAClB,GAAI,oBAAoB,OAAO;IAC/B,eAAe,QAAQ,WAAW;IAEjC,UAAA,QAAQ,OAAO;GACV,CAAA,IACN;GAKJ,oBAAC,OAAD;IAAK,aAAU;IAAS,MAAK;IAAS,WAAU;IAC9C,UAAA,oBAAC,QAAD,EAAA,UAA6B,aAAmB,GAArC,eAAqC;GAC7C,CAAA;EACF;;AAET"}
@@ -1,20 +1,14 @@
1
1
  import { VariantProps } from "class-variance-authority";
2
2
  //#region src/components/reui/frame.d.ts
3
3
  /**
4
- * CSS variable architecture for FramePanel theming:
5
- *
6
- * The Frame parent sets --frame-panel-bg and --frame-panel-border-color.
7
- * FramePanel consumes them directly via bg-(--frame-panel-bg) and
8
- * border-(--frame-panel-border-color). This means:
9
- *
10
- * - variant="inverse" overrides those vars on Frame → all panels pick it up
11
- * - <FramePanel className="bg-blue-50"> adds a direct utility on the element
12
- * which wins over bg-(--frame-panel-bg) by Tailwind source order — no
13
- * :not() or !important needed
4
+ * Frame sets --frame-panel-bg and --frame-panel-border-color; FramePanel reads
5
+ * them back as bg-(--frame-panel-bg) and border-(--frame-panel-border-color).
6
+ * So variant="inverse" re-points every panel from one place, and a consumer's
7
+ * own bg-* on a panel still wins on source order, with no :not() and no `!`.
14
8
  */
15
9
  declare const frameVariants: (props?: ({
16
- variant?: "ghost" | "default" | "inverse" | null | undefined;
17
- spacing?: "default" | "sm" | "lg" | "xs" | null | undefined;
10
+ variant?: "default" | "inverse" | "ghost" | null | undefined;
11
+ spacing?: "xs" | "sm" | "default" | "lg" | null | undefined;
18
12
  stacked?: boolean | null | undefined;
19
13
  dense?: boolean | null | undefined;
20
14
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
@@ -1 +1 @@
1
- {"version":3,"file":"frame.d.ts","names":[],"sources":["../../../src/components/reui/frame.tsx"],"mappings":";;;;;;;;;;;;;;cAiBM,gBAAa;;;;;6CAwElB;iBAEQ,QACP,WACA,SACA,SACA,SACA,UACG,SACF,MAAM,wBAAwB,oBAAoB,iCAAc,IAAA;iBAW1D,aAAa,WAAW,QAAQ,SAAS,MAAM;EAA0B;oBAAe,IAAA;iBAqBxF,cAAc,cAAc,SAAS,MAAM,2CAAwB,IAAA;iBAanE,aAAa,cAAc,SAAS,MAAM,wCAAqB,IAAA;iBAU/D,mBAAmB,cAAc,SAAS,MAAM,wCAAqB,IAAA;iBAUrE,cAAc,cAAc,SAAS,MAAM,2CAAwB,IAAA"}
1
+ {"version":3,"file":"frame.d.ts","names":[],"sources":["../../../src/components/reui/frame.tsx"],"mappings":";;;;;;;;cAYM,gBAAa;;;;;6CAkElB;iBAEQ,QACP,WACA,SACA,SACA,SACA,UACG,SACF,MAAM,wBAAwB,oBAAoB,iCAAc,IAAA;iBAW1D,aAAa,WAAW,QAAQ,SAAS,MAAM;EAA0B;oBAAe,IAAA;iBAkBxF,cAAc,cAAc,SAAS,MAAM,2CAAwB,IAAA;iBAanE,aAAa,cAAc,SAAS,MAAM,wCAAqB,IAAA;iBAU/D,mBAAmB,cAAc,SAAS,MAAM,wCAAqB,IAAA;iBAUrE,cAAc,cAAc,SAAS,MAAM,2CAAwB,IAAA"}
@@ -1,36 +1,29 @@
1
1
  "use client";
2
- import { cn } from "cn";
2
+ import { cn } from "@kumix/utils";
3
3
  import { jsx } from "react/jsx-runtime";
4
4
  import { cva } from "class-variance-authority";
5
5
  //#region src/components/reui/frame.tsx
6
6
  /**
7
- * CSS variable architecture for FramePanel theming:
8
- *
9
- * The Frame parent sets --frame-panel-bg and --frame-panel-border-color.
10
- * FramePanel consumes them directly via bg-(--frame-panel-bg) and
11
- * border-(--frame-panel-border-color). This means:
12
- *
13
- * - variant="inverse" overrides those vars on Frame → all panels pick it up
14
- * - <FramePanel className="bg-blue-50"> adds a direct utility on the element
15
- * which wins over bg-(--frame-panel-bg) by Tailwind source order — no
16
- * :not() or !important needed
7
+ * Frame sets --frame-panel-bg and --frame-panel-border-color; FramePanel reads
8
+ * them back as bg-(--frame-panel-bg) and border-(--frame-panel-border-color).
9
+ * So variant="inverse" re-points every panel from one place, and a consumer's
10
+ * own bg-* on a panel still wins on source order, with no :not() and no `!`.
17
11
  */
18
12
  const frameVariants = cva([
19
13
  "relative flex flex-col gap-(--frame-gap) rounded-(--frame-radius) bg-muted/50 px-(--frame-px) py-(--frame-py)",
20
- "(--radius-xl)] [--frame-radius:var(--radius-xl)]",
21
- "(--radius-none)] (--radius-2xl)] (--radius-lg)] (--radius-none)]",
14
+ "[--frame-radius:var(--radius-xl)]",
22
15
  "[--frame-gap:--spacing(0.75)] [--frame-panel-footer-gap:--spacing(1)] [--frame-panel-header-gap:0rem] [--frame-px:--spacing(0.75)] [--frame-py:--spacing(0.75)]",
23
16
  "[--frame-panel-footer-px-adjust:0px] [--frame-panel-footer-py-adjust:0px] [--frame-panel-header-px-adjust:0px] [--frame-panel-header-py-adjust:0px] [--frame-panel-px-adjust:0px] [--frame-panel-py-adjust:0px]",
24
- "[--frame-panel-footer-px:calc(var(--frame-panel-footer-px-base)_+_var(--frame-panel-footer-px-adjust))] [--frame-panel-footer-py:calc(var(--frame-panel-footer-py-base)_+_var(--frame-panel-footer-py-adjust))] [--frame-panel-header-px:calc(var(--frame-panel-header-px-base)_+_var(--frame-panel-header-px-adjust))] [--frame-panel-header-py:calc(var(--frame-panel-header-py-base)_+_var(--frame-panel-header-py-adjust))] [--frame-panel-px:calc(var(--frame-panel-px-base)_+_var(--frame-panel-px-adjust))] [--frame-panel-py:calc(var(--frame-panel-py-base)_+_var(--frame-panel-py-adjust))]",
25
- "(1)] (1)] (1.25)] (1.5)] (1.5)] (0.5)] (1)] (1)]",
17
+ "[--frame-panel-footer-px:calc(var(--frame-panel-footer-px-base)+var(--frame-panel-footer-px-adjust))] [--frame-panel-footer-py:calc(var(--frame-panel-footer-py-base)+var(--frame-panel-footer-py-adjust))] [--frame-panel-header-px:calc(var(--frame-panel-header-px-base)+var(--frame-panel-header-px-adjust))] [--frame-panel-header-py:calc(var(--frame-panel-header-py-base)+var(--frame-panel-header-py-adjust))] [--frame-panel-px:calc(var(--frame-panel-px-base)+var(--frame-panel-px-adjust))] [--frame-panel-py:calc(var(--frame-panel-py-base)+var(--frame-panel-py-adjust))]",
18
+ "",
26
19
  "[--frame-border-color:var(--color-border)] [--frame-panel-bg:var(--color-card)] [--frame-panel-border-color:var(--color-border)]",
27
- "[--frame-panel-radius:calc(var(--frame-radius)_-_var(--frame-px)_-_1px)]"
20
+ "[--frame-panel-radius:calc(var(--frame-radius)-var(--frame-px)-1px)]"
28
21
  ], {
29
22
  variants: {
30
23
  variant: {
31
24
  default: "border border-[var(--frame-border-color)] bg-clip-padding",
32
25
  inverse: "border border-[var(--frame-border-color)] bg-background bg-clip-padding [--frame-panel-bg:color-mix(in_oklch,var(--color-muted)_40%,transparent)]",
33
- ghost: "[--frame-panel-radius:calc(var(--frame-radius)_-_var(--frame-px))]"
26
+ ghost: "[--frame-panel-radius:calc(var(--frame-radius)-var(--frame-px))]"
34
27
  },
35
28
  spacing: {
36
29
  xs: "[--frame-panel-footer-px-base:--spacing(2)] [--frame-panel-footer-py-base:--spacing(0.5)] [--frame-panel-header-px-base:--spacing(2)] [--frame-panel-header-py-base:--spacing(0.5)] [--frame-panel-px-base:--spacing(2)] [--frame-panel-py-base:--spacing(2)]",
@@ -1 +1 @@
1
- {"version":3,"file":"frame.js","names":[],"sources":["../../../src/components/reui/frame.tsx"],"sourcesContent":["\"use client\";\n\nimport { cva, type VariantProps } from \"class-variance-authority\";\nimport { cn } from \"cn\";\n\n/**\n * CSS variable architecture for FramePanel theming:\n *\n * The Frame parent sets --frame-panel-bg and --frame-panel-border-color.\n * FramePanel consumes them directly via bg-(--frame-panel-bg) and\n * border-(--frame-panel-border-color). This means:\n *\n * - variant=\"inverse\" overrides those vars on Frame → all panels pick it up\n * - <FramePanel className=\"bg-blue-50\"> adds a direct utility on the element\n * which wins over bg-(--frame-panel-bg) by Tailwind source order — no\n * :not() or !important needed\n */\nconst frameVariants = cva(\n [\n \"relative flex flex-col gap-(--frame-gap) rounded-(--frame-radius) bg-muted/50 px-(--frame-px) py-(--frame-py)\",\n \"(--radius-xl)] [--frame-radius:var(--radius-xl)]\",\n \"(--radius-none)] (--radius-2xl)] (--radius-lg)] (--radius-none)]\",\n \"[--frame-gap:--spacing(0.75)] [--frame-panel-footer-gap:--spacing(1)] [--frame-panel-header-gap:0rem] [--frame-px:--spacing(0.75)] [--frame-py:--spacing(0.75)]\",\n \"[--frame-panel-footer-px-adjust:0px] [--frame-panel-footer-py-adjust:0px] [--frame-panel-header-px-adjust:0px] [--frame-panel-header-py-adjust:0px] [--frame-panel-px-adjust:0px] [--frame-panel-py-adjust:0px]\",\n \"[--frame-panel-footer-px:calc(var(--frame-panel-footer-px-base)_+_var(--frame-panel-footer-px-adjust))] [--frame-panel-footer-py:calc(var(--frame-panel-footer-py-base)_+_var(--frame-panel-footer-py-adjust))] [--frame-panel-header-px:calc(var(--frame-panel-header-px-base)_+_var(--frame-panel-header-px-adjust))] [--frame-panel-header-py:calc(var(--frame-panel-header-py-base)_+_var(--frame-panel-header-py-adjust))] [--frame-panel-px:calc(var(--frame-panel-px-base)_+_var(--frame-panel-px-adjust))] [--frame-panel-py:calc(var(--frame-panel-py-base)_+_var(--frame-panel-py-adjust))]\",\n \"(1)] (1)] (1.25)] (1.5)] (1.5)] (0.5)] (1)] (1)]\",\n // Default panel token values — overridden per-variant below\n \"[--frame-border-color:var(--color-border)] [--frame-panel-bg:var(--color-card)] [--frame-panel-border-color:var(--color-border)]\",\n // Concentric inner radius: the panel corner nests smoothly inside the frame\n // corner instead of matching it. The panel sits inset from the frame's outer\n // edge by the frame's 1px border + --frame-px padding, so its radius is\n // reduced by that same gap (radius − gap keeps the two arcs parallel). This\n // base value assumes the bordered default/inverse frame; `ghost` drops the\n // 1px border term and `dense` pins it back to the frame radius (its panels\n // are pulled flush to the edge).\n \"[--frame-panel-radius:calc(var(--frame-radius)_-_var(--frame-px)_-_1px)]\",\n ],\n {\n variants: {\n variant: {\n default: \"border border-[var(--frame-border-color)] bg-clip-padding\",\n inverse:\n \"border border-[var(--frame-border-color)] bg-background bg-clip-padding [--frame-panel-bg:color-mix(in_oklch,var(--color-muted)_40%,transparent)]\",\n // No frame border, so the panel is inset by --frame-px padding only.\n ghost: \"[--frame-panel-radius:calc(var(--frame-radius)_-_var(--frame-px))]\",\n },\n // Header/footer vertical rhythm is tighter than the panel body's, and\n // the gap widens as the frame grows: the bars read as chrome rather than\n // as another content block. py ladder is 0.5 / 1.5 / 2 / 2.5 against a\n // body py of 2 / 3.5 / 4 / 5. These vars are style-agnostic - no\n // style-*.css overrides them - so this single ladder drives all shadcn\n // styles. `px` is deliberately left level with the body so header,\n // content and footer stay left-aligned. `xs` holds at 0.5 (2px): it is\n // the practical floor, since anything lower stops reading as padding.\n spacing: {\n xs: \"[--frame-panel-footer-px-base:--spacing(2)] [--frame-panel-footer-py-base:--spacing(0.5)] [--frame-panel-header-px-base:--spacing(2)] [--frame-panel-header-py-base:--spacing(0.5)] [--frame-panel-px-base:--spacing(2)] [--frame-panel-py-base:--spacing(2)]\",\n sm: \"[--frame-panel-footer-px-base:--spacing(3)] [--frame-panel-footer-py-base:--spacing(1.5)] [--frame-panel-header-px-base:--spacing(3)] [--frame-panel-header-py-base:--spacing(1.5)] [--frame-panel-px-base:--spacing(3)] [--frame-panel-py-base:--spacing(3.5)]\",\n default:\n \"[--frame-panel-footer-px-base:--spacing(4)] [--frame-panel-footer-py-base:--spacing(2)] [--frame-panel-header-px-base:--spacing(4)] [--frame-panel-header-py-base:--spacing(2)] [--frame-panel-px-base:--spacing(4)] [--frame-panel-py-base:--spacing(4)]\",\n lg: \"[--frame-panel-footer-px-base:--spacing(5)] [--frame-panel-footer-py-base:--spacing(2.5)] [--frame-panel-header-px-base:--spacing(5)] [--frame-panel-header-py-base:--spacing(2.5)] [--frame-panel-px-base:--spacing(5)] [--frame-panel-py-base:--spacing(5)]\",\n },\n stacked: {\n true: [\n \"gap-0 *:has-[+[data-slot=frame-panel]]:rounded-b-none\",\n \"*:has-[+[data-slot=frame-panel]]:before:hidden\",\n \"*:[[data-slot=frame-panel]+[data-slot=frame-panel]]:rounded-t-none\",\n \"*:[[data-slot=frame-panel]+[data-slot=frame-panel]]:border-t-0\",\n ],\n false: [\n \"data-[spacing=sm]:*:[[data-slot=frame-panel]+[data-slot=frame-panel]]:mt-0.5\",\n \"data-[spacing=default]:*:[[data-slot=frame-panel]+[data-slot=frame-panel]]:mt-1\",\n \"data-[spacing=lg]:*:[[data-slot=frame-panel]+[data-slot=frame-panel]]:mt-2\",\n ],\n },\n dense: {\n // Positional rules must stay as parent selectors — cannot be expressed via CSS vars.\n // Padding is 0 and panels are pulled flush to the frame edge (-mx-px), so\n // their corners align with the frame radius rather than nesting inside it.\n true: \"gap-0 border-[var(--frame-border-color)] p-0 [--frame-panel-radius:var(--frame-radius)] [&:not(:has([data-slot=frame-panel-header]))_[data-slot=frame-panel]:is(:first-child)]:-mt-px [&_[data-slot=frame-panel]:last-child]:-mb-px [&_[data-slot=frame-panel]]:-mx-px [&_[data-slot=frame-panel]]:before:hidden\",\n false: \"\",\n },\n },\n defaultVariants: {\n variant: \"default\",\n spacing: \"default\",\n stacked: false,\n dense: false,\n },\n },\n);\n\nfunction Frame({\n className,\n variant,\n spacing,\n stacked,\n dense,\n ...props\n}: React.ComponentProps<\"div\"> & VariantProps<typeof frameVariants>) {\n return (\n <div\n className={cn(frameVariants({ variant, spacing, stacked, dense }), className)}\n data-slot=\"frame\"\n data-spacing={spacing}\n {...props}\n />\n );\n}\n\nfunction FramePanel({ className, fit, ...props }: React.ComponentProps<\"div\"> & { fit?: boolean }) {\n return (\n <div\n className={cn(\n // bg-(--frame-panel-bg) and border-(--frame-panel-border-color) consume the\n // CSS vars set by the Frame parent. Any explicit bg-* or border-* class passed\n // via className overrides these by Tailwind source order - no ! needed.\n \"relative overflow-hidden rounded-(--frame-panel-radius) border border-(--frame-panel-border-color) bg-(--frame-panel-bg) bg-clip-padding shadow-xs\",\n // `fit` sizes the panel to its content; otherwise it grows to fill the frame.\n !fit && \"grow\",\n \"before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--frame-panel-radius)-1px)] before:shadow-black/5\",\n \"dark:bg-clip-border dark:before:shadow-white/5\",\n \"px-(--frame-panel-px) py-(--frame-panel-py)\",\n className,\n )}\n data-slot=\"frame-panel\"\n {...props}\n />\n );\n}\n\nfunction FrameHeader({ className, ...props }: React.ComponentProps<\"header\">) {\n return (\n <header\n className={cn(\n \"flex flex-col gap-(--frame-panel-header-gap) px-(--frame-panel-header-px) py-(--frame-panel-header-py)\",\n className,\n )}\n data-slot=\"frame-panel-header\"\n {...props}\n />\n );\n}\n\nfunction FrameTitle({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n className={cn(\"font-semibold text-sm\", className)}\n data-slot=\"frame-panel-title\"\n {...props}\n />\n );\n}\n\nfunction FrameDescription({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n className={cn(\"text-muted-foreground text-sm\", className)}\n data-slot=\"frame-panel-description\"\n {...props}\n />\n );\n}\n\nfunction FrameFooter({ className, ...props }: React.ComponentProps<\"footer\">) {\n return (\n <footer\n className={cn(\n \"flex flex-col gap-(--frame-panel-footer-gap) px-(--frame-panel-footer-px) py-(--frame-panel-footer-py)\",\n className,\n )}\n data-slot=\"frame-panel-footer\"\n {...props}\n />\n );\n}\n\nexport { Frame, FrameDescription, FrameFooter, FrameHeader, FramePanel, FrameTitle, frameVariants };\n"],"mappings":";;;;;;;;;;;;;;;;;AAiBA,MAAM,gBAAgB,IACpB;CACE;CACA;CACA;CACA;CACA;CACA;CACA;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,aAAU;EACV,GAAI;CACL,CAAA;AAEL"}
1
+ {"version":3,"file":"frame.js","names":[],"sources":["../../../src/components/reui/frame.tsx"],"sourcesContent":["\"use client\";\n\nimport { cva, type VariantProps } from \"class-variance-authority\";\n\nimport { cn } from \"@kumix/utils\";\n\n/**\n * Frame sets --frame-panel-bg and --frame-panel-border-color; FramePanel reads\n * them back as bg-(--frame-panel-bg) and border-(--frame-panel-border-color).\n * So variant=\"inverse\" re-points every panel from one place, and a consumer's\n * own bg-* on a panel still wins on source order, with no :not() and no `!`.\n */\nconst frameVariants = cva(\n [\n \"relative flex flex-col gap-(--frame-gap) rounded-(--frame-radius) bg-muted/50 px-(--frame-px) py-(--frame-py)\",\n // Each rung is the radius that style's own .cn-card resolves through, so a\n // Frame and a Card side by side agree. lyra/sera are 0px, NOT\n // var(--radius-none): no such token exists, and it only reached 0 by being\n // invalid, which also left --frame-radius empty for anything reading it.\n \"[--frame-radius:var(--radius-xl)]\",\n \"[--frame-gap:--spacing(0.75)] [--frame-panel-footer-gap:--spacing(1)] [--frame-panel-header-gap:0rem] [--frame-px:--spacing(0.75)] [--frame-py:--spacing(0.75)]\",\n \"[--frame-panel-footer-px-adjust:0px] [--frame-panel-footer-py-adjust:0px] [--frame-panel-header-px-adjust:0px] [--frame-panel-header-py-adjust:0px] [--frame-panel-px-adjust:0px] [--frame-panel-py-adjust:0px]\",\n \"[--frame-panel-footer-px:calc(var(--frame-panel-footer-px-base)+var(--frame-panel-footer-px-adjust))] [--frame-panel-footer-py:calc(var(--frame-panel-footer-py-base)+var(--frame-panel-footer-py-adjust))] [--frame-panel-header-px:calc(var(--frame-panel-header-px-base)+var(--frame-panel-header-px-adjust))] [--frame-panel-header-py:calc(var(--frame-panel-header-py-base)+var(--frame-panel-header-py-adjust))] [--frame-panel-px:calc(var(--frame-panel-px-base)+var(--frame-panel-px-adjust))] [--frame-panel-py:calc(var(--frame-panel-py-base)+var(--frame-panel-py-adjust))]\",\n // Luma alone re-times the frame: wider gap and padding, roomier bars.\n \"\",\n \"[--frame-border-color:var(--color-border)] [--frame-panel-bg:var(--color-card)] [--frame-panel-border-color:var(--color-border)]\",\n // Concentric: the panel nests inside the frame's corner rather than copying\n // it. It is inset by the 1px border plus --frame-px, so subtracting exactly\n // that keeps the two arcs parallel. `ghost` drops the border term (no\n // border), `dense` pins it to the frame radius (panels sit flush).\n \"[--frame-panel-radius:calc(var(--frame-radius)-var(--frame-px)-1px)]\",\n ],\n {\n variants: {\n variant: {\n default: \"border border-[var(--frame-border-color)] bg-clip-padding\",\n inverse:\n \"border border-[var(--frame-border-color)] bg-background bg-clip-padding [--frame-panel-bg:color-mix(in_oklch,var(--color-muted)_40%,transparent)]\",\n ghost: \"[--frame-panel-radius:calc(var(--frame-radius)-var(--frame-px))]\",\n },\n // Bars read as chrome, not a second content block: py runs 0.5/1.5/2/2.5\n // against a body py of 2/3.5/4/5, while px stays level with the body so\n // header, content and footer left-align. xs floors at 0.5 (2px), below\n // which it stops reading as padding. No style-*.css overrides these.\n spacing: {\n xs: \"[--frame-panel-footer-px-base:--spacing(2)] [--frame-panel-footer-py-base:--spacing(0.5)] [--frame-panel-header-px-base:--spacing(2)] [--frame-panel-header-py-base:--spacing(0.5)] [--frame-panel-px-base:--spacing(2)] [--frame-panel-py-base:--spacing(2)]\",\n sm: \"[--frame-panel-footer-px-base:--spacing(3)] [--frame-panel-footer-py-base:--spacing(1.5)] [--frame-panel-header-px-base:--spacing(3)] [--frame-panel-header-py-base:--spacing(1.5)] [--frame-panel-px-base:--spacing(3)] [--frame-panel-py-base:--spacing(3.5)]\",\n default:\n \"[--frame-panel-footer-px-base:--spacing(4)] [--frame-panel-footer-py-base:--spacing(2)] [--frame-panel-header-px-base:--spacing(4)] [--frame-panel-header-py-base:--spacing(2)] [--frame-panel-px-base:--spacing(4)] [--frame-panel-py-base:--spacing(4)]\",\n lg: \"[--frame-panel-footer-px-base:--spacing(5)] [--frame-panel-footer-py-base:--spacing(2.5)] [--frame-panel-header-px-base:--spacing(5)] [--frame-panel-header-py-base:--spacing(2.5)] [--frame-panel-px-base:--spacing(5)] [--frame-panel-py-base:--spacing(5)]\",\n },\n stacked: {\n true: [\n \"gap-0 *:has-[+[data-slot=frame-panel]]:rounded-b-none\",\n \"*:has-[+[data-slot=frame-panel]]:before:hidden\",\n \"*:[[data-slot=frame-panel]+[data-slot=frame-panel]]:rounded-t-none\",\n \"*:[[data-slot=frame-panel]+[data-slot=frame-panel]]:border-t-0\",\n ],\n false: [\n \"data-[spacing=sm]:*:[[data-slot=frame-panel]+[data-slot=frame-panel]]:mt-0.5\",\n \"data-[spacing=default]:*:[[data-slot=frame-panel]+[data-slot=frame-panel]]:mt-1\",\n \"data-[spacing=lg]:*:[[data-slot=frame-panel]+[data-slot=frame-panel]]:mt-2\",\n ],\n },\n dense: {\n // Parent selectors, not CSS vars: these are positional. Panels are\n // pulled flush (-mx-px), so corners align with the frame's own radius.\n true: \"gap-0 border-[var(--frame-border-color)] p-0 [--frame-panel-radius:var(--frame-radius)] [&:not(:has([data-slot=frame-panel-header]))_[data-slot=frame-panel]:is(:first-child)]:-mt-px [&_[data-slot=frame-panel]:last-child]:-mb-px [&_[data-slot=frame-panel]]:-mx-px [&_[data-slot=frame-panel]]:before:hidden\",\n false: \"\",\n },\n },\n defaultVariants: {\n variant: \"default\",\n spacing: \"default\",\n stacked: false,\n dense: false,\n },\n },\n);\n\nfunction Frame({\n className,\n variant,\n spacing,\n stacked,\n dense,\n ...props\n}: React.ComponentProps<\"div\"> & VariantProps<typeof frameVariants>) {\n return (\n <div\n className={cn(frameVariants({ variant, spacing, stacked, dense }), className)}\n data-slot=\"frame\"\n data-spacing={spacing}\n {...props}\n />\n );\n}\n\nfunction FramePanel({ className, fit, ...props }: React.ComponentProps<\"div\"> & { fit?: boolean }) {\n return (\n <div\n className={cn(\n \"relative overflow-hidden rounded-(--frame-panel-radius) border border-(--frame-panel-border-color) bg-(--frame-panel-bg) bg-clip-padding shadow-xs\",\n // `fit` sizes the panel to its content; otherwise it grows to fill the frame.\n !fit && \"grow\",\n \"before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--frame-panel-radius)-1px)] before:shadow-black/5\",\n \"dark:bg-clip-border dark:before:shadow-white/5\",\n \"px-(--frame-panel-px) py-(--frame-panel-py)\",\n className,\n )}\n data-slot=\"frame-panel\"\n {...props}\n />\n );\n}\n\nfunction FrameHeader({ className, ...props }: React.ComponentProps<\"header\">) {\n return (\n <header\n className={cn(\n \"flex flex-col gap-(--frame-panel-header-gap) px-(--frame-panel-header-px) py-(--frame-panel-header-py)\",\n className,\n )}\n data-slot=\"frame-panel-header\"\n {...props}\n />\n );\n}\n\nfunction FrameTitle({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n className={cn(\"font-semibold text-sm\", className)}\n data-slot=\"frame-panel-title\"\n {...props}\n />\n );\n}\n\nfunction FrameDescription({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n className={cn(\"text-muted-foreground text-sm\", className)}\n data-slot=\"frame-panel-description\"\n {...props}\n />\n );\n}\n\nfunction FrameFooter({ className, ...props }: React.ComponentProps<\"footer\">) {\n return (\n <footer\n className={cn(\n \"flex flex-col gap-(--frame-panel-footer-gap) px-(--frame-panel-footer-px) py-(--frame-panel-footer-py)\",\n className,\n )}\n data-slot=\"frame-panel-footer\"\n {...props}\n />\n );\n}\n\nexport { Frame, FrameDescription, FrameFooter, FrameHeader, FramePanel, FrameTitle, frameVariants };\n"],"mappings":";;;;;;;;;;;AAYA,MAAM,gBAAgB,IACpB;CACE;CAKA;CACA;CACA;CACA;CAEA;CACA;CAKA;AACF,GACA;CACE,UAAU;EACR,SAAS;GACP,SAAS;GACT,SACE;GACF,OAAO;EACT;EAKA,SAAS;GACP,IAAI;GACJ,IAAI;GACJ,SACE;GACF,IAAI;EACN;EACA,SAAS;GACP,MAAM;IACJ;IACA;IACA;IACA;GACF;GACA,OAAO;IACL;IACA;IACA;GACF;EACF;EACA,OAAO;GAGL,MAAM;GACN,OAAO;EACT;CACF;CACA,iBAAiB;EACf,SAAS;EACT,SAAS;EACT,SAAS;EACT,OAAO;CACT;AACF,CACF;AAEA,SAAS,MAAM,EACb,WACA,SACA,SACA,SACA,OACA,GAAG,SACgE;CACnE,OACE,oBAAC,OAAD;EACE,WAAW,GAAG,cAAc;GAAE;GAAS;GAAS;GAAS;EAAM,CAAC,GAAG,SAAS;EAC5E,aAAU;EACV,gBAAc;EACd,GAAI;CACL,CAAA;AAEL;AAEA,SAAS,WAAW,EAAE,WAAW,KAAK,GAAG,SAA0D;CACjG,OACE,oBAAC,OAAD;EACE,WAAW,GACT,sJAEA,CAAC,OAAO,QACR,wIACA,kDACA,+CACA,SACF;EACA,aAAU;EACV,GAAI;CACL,CAAA;AAEL;AAEA,SAAS,YAAY,EAAE,WAAW,GAAG,SAAyC;CAC5E,OACE,oBAAC,UAAD;EACE,WAAW,GACT,0GACA,SACF;EACA,aAAU;EACV,GAAI;CACL,CAAA;AAEL;AAEA,SAAS,WAAW,EAAE,WAAW,GAAG,SAAsC;CACxE,OACE,oBAAC,OAAD;EACE,WAAW,GAAG,yBAAyB,SAAS;EAChD,aAAU;EACV,GAAI;CACL,CAAA;AAEL;AAEA,SAAS,iBAAiB,EAAE,WAAW,GAAG,SAAsC;CAC9E,OACE,oBAAC,OAAD;EACE,WAAW,GAAG,iCAAiC,SAAS;EACxD,aAAU;EACV,GAAI;CACL,CAAA;AAEL;AAEA,SAAS,YAAY,EAAE,WAAW,GAAG,SAAyC;CAC5E,OACE,oBAAC,UAAD;EACE,WAAW,GACT,0GACA,SACF;EACA,aAAU;EACV,GAAI;CACL,CAAA;AAEL"}
@@ -5,7 +5,7 @@ import { flattenResources, getBaselineVariance, resolveEventBaseline, toZoned }
5
5
  import { useGantt, useGanttSelector, useGanttViewConfig } from "./gantt.js";
6
6
  import { useGanttGestures, wasRecentDrag } from "./gantt-dnd.js";
7
7
  import { createContext, useContext, useMemo, useState } from "react";
8
- import { cn } from "cn";
8
+ import { cn } from "@kumix/utils";
9
9
  import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
10
10
  import { CheckIcon, RepeatIcon } from "lucide-react";
11
11
  import { mergeProps } from "@base-ui/react/merge-props";
@@ -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 { cn } from \"cn\";\nimport { CheckIcon, RepeatIcon } from \"lucide-react\";\n\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, getBaselineVariance, resolveEventBaseline, 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 // A zero-duration occurrence is a MILESTONE: the button stays the\n // interactive shell (click, select, menu, move), the diamond replaces the\n // tinted bar body, and the view keeps the title outside.\n const milestone = occurrence.end.getTime() === occurrence.start.getTime();\n\n // The bar only LABELS its baseline (attributes, tooltip, aria); the ghost\n // itself is view-owned chrome, because its range differs from this bar's.\n const baseline = viewConfig.baselineBars ? resolveEventBaseline(event) : null;\n const baselineVariance = baseline ? getBaselineVariance(event) : 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 ??\n viewConfig.renderEvent?.(renderProps) ??\n (labelOutside || milestone ? 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 // Memoized: a second full formatEventTime per render would double the\n // bar's formatting cost, and it cannot wait for the tooltip because the\n // label also feeds aria-label. Keyed on the instants, not the baseline\n // object - resolveEventBaseline allocates a fresh one every render.\n const baselineStartMs = baseline?.start.getTime();\n const baselineEndMs = baseline?.end.getTime();\n const plannedLabel = useMemo(\n () =>\n baselineStartMs === undefined || baselineEndMs === undefined\n ? undefined\n : settings.i18n.labels.planned(\n settings.i18n.functions.formatEventTime(\n toZoned(new Date(baselineStartMs), settings.timeZone),\n toZoned(new Date(baselineEndMs), settings.timeZone),\n occurrence.allDay,\n settings.locale,\n ),\n ),\n [\n baselineStartMs,\n baselineEndMs,\n occurrence.allDay,\n settings.i18n,\n settings.timeZone,\n settings.locale,\n ],\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-milestone\": milestone || undefined,\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 \"data-baseline\": !!baseline || undefined,\n \"data-baseline-variance\": baselineVariance ?? undefined,\n \"aria-label\": settings.i18n.functions.formatEventAriaLabel({\n title: event.title,\n timeLabel,\n milestoneLabel: milestone ? settings.i18n.labels.milestone : undefined,\n rowTitle,\n progressLabel: progress !== null ? settings.i18n.labels.progress(progress) : undefined,\n plannedLabel,\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 /* the diamond is the milestone's body, so the shell sheds its own\n tinted fill and centers the glyph on the instant */\n milestone &&\n \"justify-center bg-transparent px-0 hover:bg-transparent data-selected:bg-transparent\",\n segment.continuesBefore && \"rounded-s-none\",\n segment.continuesAfter && \"rounded-e-none\",\n viewConfig.classNames?.event,\n className,\n ),\n children: (\n <>\n {milestone && !consumerOwnsContent && (\n // the filled diamond IS the milestone's body - chrome, so a custom\n // renderEvent still starts from a blank canvas (data-milestone\n // keeps the fact readable there)\n <span\n aria-hidden\n data-slot=\"gantt-bar-milestone\"\n className={cn(\n \"size-2.5 shrink-0 rotate-45 rounded-[2px] border border-(--gantt-event-color) bg-(--gantt-event-color)/80\",\n isSelected && \"ring-2 ring-ring/50\",\n )}\n />\n )}\n {progress !== null && !milestone && (\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 && !milestone && (\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 {plannedLabel && <div className=\"opacity-80\">{plannedLabel}</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":";;;;;;;;;;;;;;;;;A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AA,CAAA;CAEN;CAEA,MAAM,YAAY,UAAU;EAC1B,gBAAgB;EAChB;EACA,OAAO,WAAqB,cAAc,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;KACE,oBAAC,OAAD;MAAK,WAAU;MAAe,UAAA,MAAM;KAAW,CAAA;KAC/C,oBAAC,OAAD;MAAK,WAAU;MAAc,UAAA;KAAe,CAAA;KAC3C,gBAAgB,oBAAC,OAAD;MAAK,WAAU;MAAc,UAAA;KAAkB,CAAA;IAClD;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, getBaselineVariance, resolveEventBaseline, 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 // A zero-duration occurrence is a MILESTONE: the button stays the\n // interactive shell (click, select, menu, move), the diamond replaces the\n // tinted bar body, and the view keeps the title outside.\n const milestone = occurrence.end.getTime() === occurrence.start.getTime();\n\n // The bar only LABELS its baseline (attributes, tooltip, aria); the ghost\n // itself is view-owned chrome, because its range differs from this bar's.\n const baseline = viewConfig.baselineBars ? resolveEventBaseline(event) : null;\n const baselineVariance = baseline ? getBaselineVariance(event) : 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 ??\n viewConfig.renderEvent?.(renderProps) ??\n (labelOutside || milestone ? 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 // Memoized: a second full formatEventTime per render would double the\n // bar's formatting cost, and it cannot wait for the tooltip because the\n // label also feeds aria-label. Keyed on the instants, not the baseline\n // object - resolveEventBaseline allocates a fresh one every render.\n const baselineStartMs = baseline?.start.getTime();\n const baselineEndMs = baseline?.end.getTime();\n const plannedLabel = useMemo(\n () =>\n baselineStartMs === undefined || baselineEndMs === undefined\n ? undefined\n : settings.i18n.labels.planned(\n settings.i18n.functions.formatEventTime(\n toZoned(new Date(baselineStartMs), settings.timeZone),\n toZoned(new Date(baselineEndMs), settings.timeZone),\n occurrence.allDay,\n settings.locale,\n ),\n ),\n [\n baselineStartMs,\n baselineEndMs,\n occurrence.allDay,\n settings.i18n,\n settings.timeZone,\n settings.locale,\n ],\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-milestone\": milestone || undefined,\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 \"data-baseline\": !!baseline || undefined,\n \"data-baseline-variance\": baselineVariance ?? undefined,\n \"aria-label\": settings.i18n.functions.formatEventAriaLabel({\n title: event.title,\n timeLabel,\n milestoneLabel: milestone ? settings.i18n.labels.milestone : undefined,\n rowTitle,\n progressLabel: progress !== null ? settings.i18n.labels.progress(progress) : undefined,\n plannedLabel,\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 /* the diamond is the milestone's body, so the shell sheds its own\n tinted fill and centers the glyph on the instant */\n milestone &&\n \"justify-center bg-transparent px-0 hover:bg-transparent data-selected:bg-transparent\",\n segment.continuesBefore && \"rounded-s-none\",\n segment.continuesAfter && \"rounded-e-none\",\n viewConfig.classNames?.event,\n className,\n ),\n children: (\n <>\n {milestone && !consumerOwnsContent && (\n // the filled diamond IS the milestone's body - chrome, so a custom\n // renderEvent still starts from a blank canvas (data-milestone\n // keeps the fact readable there)\n <span\n aria-hidden\n data-slot=\"gantt-bar-milestone\"\n className={cn(\n \"size-2.5 shrink-0 rotate-45 rounded-[2px] border border-(--gantt-event-color) bg-(--gantt-event-color)/80\",\n isSelected && \"ring-2 ring-ring/50\",\n )}\n />\n )}\n {progress !== null && !milestone && (\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 && !milestone && (\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 {plannedLabel && <div className=\"opacity-80\">{plannedLabel}</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,M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I;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;KACE,oBAAC,OAAD;MAAK,WAAU;MAAe,UAAA,MAAM;KAAW,CAAA;KAC/C,oBAAC,OAAD;MAAK,WAAU;MAAc,UAAA;KAAe,CAAA;KAC3C,gBAAgB,oBAAC,OAAD;MAAK,WAAU;MAAc,UAAA;KAAkB,CAAA;IAClD;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"}
@@ -7,7 +7,7 @@ import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "../../
7
7
  import { toZoned } from "./gantt-lib.js";
8
8
  import { useGanttNavigation, useGanttScale, useGanttSettings, useGanttViewConfig } from "./gantt.js";
9
9
  import { useState } from "react";
10
- import { cn } from "cn";
10
+ import { cn } from "@kumix/utils";
11
11
  import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
12
12
  import { CalendarIcon, ChevronDownIcon, ChevronLeftIcon, ChevronRightIcon } from "lucide-react";
13
13
  import { mergeProps } from "@base-ui/react/merge-props";