@kumix/ui 0.3.17 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (534) hide show
  1. package/README.md +30 -18
  2. package/dist/account-avatar-DILzuuvz.js +23 -0
  3. package/dist/account-avatar-DILzuuvz.js.map +1 -0
  4. package/dist/{cascader-types-BnH6wYD-.d.ts → cascader-types-DVT-znZ-.d.ts} +6 -3
  5. package/dist/cascader-types-DVT-znZ-.d.ts.map +1 -0
  6. package/dist/components/agents/agent-activity/activity-row.js +1 -1
  7. package/dist/components/agents/agent-activity/index.js +1 -1
  8. package/dist/components/agents/agent-code.js +1 -1
  9. package/dist/components/agents/ai-sidebar.js +1 -1
  10. package/dist/components/agents/approval-card/index.js +1 -1
  11. package/dist/components/agents/citations.js +1 -1
  12. package/dist/components/agents/code-block.js +1 -1
  13. package/dist/components/agents/file-diff.js +1 -1
  14. package/dist/components/agents/image-generation.js +1 -1
  15. package/dist/components/agents/message-bubble.js +1 -1
  16. package/dist/components/agents/prompt-input.js +1 -1
  17. package/dist/components/agents/streaming-response.js +1 -1
  18. package/dist/components/agents/todo-list.js +1 -1
  19. package/dist/components/agents/tool-approval.js +1 -1
  20. package/dist/components/agents/tool-result.js +1 -1
  21. package/dist/components/agents/voice-orb.d.ts +19 -0
  22. package/dist/components/agents/voice-orb.d.ts.map +1 -0
  23. package/dist/components/agents/voice-orb.js +389 -0
  24. package/dist/components/agents/voice-orb.js.map +1 -0
  25. package/dist/components/charts/bump-chart/context.d.ts +2 -0
  26. package/dist/components/charts/bump-chart/context.js +3 -0
  27. package/dist/components/charts/bump-chart/legend.d.ts +6 -0
  28. package/dist/components/charts/bump-chart/legend.d.ts.map +1 -0
  29. package/dist/components/charts/bump-chart/legend.js +60 -0
  30. package/dist/components/charts/bump-chart/legend.js.map +1 -0
  31. package/dist/components/charts/bump-chart/plot.d.ts +6 -0
  32. package/dist/components/charts/bump-chart/plot.d.ts.map +1 -0
  33. package/dist/components/charts/bump-chart/plot.js +3 -0
  34. package/dist/components/charts/bump-chart/point.d.ts +10 -0
  35. package/dist/components/charts/bump-chart/point.d.ts.map +1 -0
  36. package/dist/components/charts/bump-chart/point.js +124 -0
  37. package/dist/components/charts/bump-chart/point.js.map +1 -0
  38. package/dist/components/charts/bump-chart/series.d.ts +11 -0
  39. package/dist/components/charts/bump-chart/series.d.ts.map +1 -0
  40. package/dist/components/charts/bump-chart/series.js +101 -0
  41. package/dist/components/charts/bump-chart/series.js.map +1 -0
  42. package/dist/components/charts/bump-chart.d.ts +10 -0
  43. package/dist/components/charts/bump-chart.d.ts.map +1 -0
  44. package/dist/components/charts/bump-chart.js +23 -0
  45. package/dist/components/charts/bump-chart.js.map +1 -0
  46. package/dist/components/charts/composition-chart/context.d.ts +2 -0
  47. package/dist/components/charts/composition-chart/context.js +3 -0
  48. package/dist/components/charts/composition-chart/legend.d.ts +6 -0
  49. package/dist/components/charts/composition-chart/legend.d.ts.map +1 -0
  50. package/dist/components/charts/composition-chart/legend.js +51 -0
  51. package/dist/components/charts/composition-chart/legend.js.map +1 -0
  52. package/dist/components/charts/composition-chart/plot.d.ts +6 -0
  53. package/dist/components/charts/composition-chart/plot.d.ts.map +1 -0
  54. package/dist/components/charts/composition-chart/plot.js +174 -0
  55. package/dist/components/charts/composition-chart/plot.js.map +1 -0
  56. package/dist/components/charts/composition-chart/tooltip-content.d.ts +6 -0
  57. package/dist/components/charts/composition-chart/tooltip-content.d.ts.map +1 -0
  58. package/dist/components/charts/composition-chart/tooltip-content.js +63 -0
  59. package/dist/components/charts/composition-chart/tooltip-content.js.map +1 -0
  60. package/dist/components/charts/composition-chart.d.ts +9 -0
  61. package/dist/components/charts/composition-chart.d.ts.map +1 -0
  62. package/dist/components/charts/composition-chart.js +26 -0
  63. package/dist/components/charts/composition-chart.js.map +1 -0
  64. package/dist/components/charts/funnel-chart.d.ts +50 -0
  65. package/dist/components/charts/funnel-chart.d.ts.map +1 -0
  66. package/dist/components/charts/funnel-chart.js +216 -0
  67. package/dist/components/charts/funnel-chart.js.map +1 -0
  68. package/dist/components/charts/heat-calendar/grid.d.ts +8 -0
  69. package/dist/components/charts/heat-calendar/grid.d.ts.map +1 -0
  70. package/dist/components/charts/heat-calendar/grid.js +127 -0
  71. package/dist/components/charts/heat-calendar/grid.js.map +1 -0
  72. package/dist/components/charts/heat-calendar/legend.d.ts +6 -0
  73. package/dist/components/charts/heat-calendar/legend.d.ts.map +1 -0
  74. package/dist/components/charts/heat-calendar/legend.js +48 -0
  75. package/dist/components/charts/heat-calendar/legend.js.map +1 -0
  76. package/dist/components/charts/heat-calendar/tooltip.d.ts +2 -0
  77. package/dist/components/charts/heat-calendar/tooltip.js +50 -0
  78. package/dist/components/charts/heat-calendar/tooltip.js.map +1 -0
  79. package/dist/components/charts/heat-calendar.d.ts +9 -0
  80. package/dist/components/charts/heat-calendar.d.ts.map +1 -0
  81. package/dist/components/charts/heat-calendar.js +23 -0
  82. package/dist/components/charts/heat-calendar.js.map +1 -0
  83. package/dist/components/charts/liquidity-heatmap.d.ts +51 -0
  84. package/dist/components/charts/liquidity-heatmap.d.ts.map +1 -0
  85. package/dist/components/charts/liquidity-heatmap.js +311 -0
  86. package/dist/components/charts/liquidity-heatmap.js.map +1 -0
  87. package/dist/components/charts/order-book/depth-row.d.ts +13 -0
  88. package/dist/components/charts/order-book/depth-row.d.ts.map +1 -0
  89. package/dist/components/charts/order-book/depth-row.js +99 -0
  90. package/dist/components/charts/order-book/depth-row.js.map +1 -0
  91. package/dist/components/charts/order-book.d.ts +57 -0
  92. package/dist/components/charts/order-book.d.ts.map +1 -0
  93. package/dist/components/charts/order-book.js +207 -0
  94. package/dist/components/charts/order-book.js.map +1 -0
  95. package/dist/components/charts/price-target-fan/header.d.ts +8 -0
  96. package/dist/components/charts/price-target-fan/header.d.ts.map +1 -0
  97. package/dist/components/charts/price-target-fan/header.js +43 -0
  98. package/dist/components/charts/price-target-fan/header.js.map +1 -0
  99. package/dist/components/charts/price-target-fan/plot.d.ts +16 -0
  100. package/dist/components/charts/price-target-fan/plot.d.ts.map +1 -0
  101. package/dist/components/charts/price-target-fan/plot.js +142 -0
  102. package/dist/components/charts/price-target-fan/plot.js.map +1 -0
  103. package/dist/components/charts/price-target-fan/series.d.ts +15 -0
  104. package/dist/components/charts/price-target-fan/series.d.ts.map +1 -0
  105. package/dist/components/charts/price-target-fan/series.js +238 -0
  106. package/dist/components/charts/price-target-fan/series.js.map +1 -0
  107. package/dist/components/charts/price-target-fan/tooltip.d.ts +2 -0
  108. package/dist/components/charts/price-target-fan/tooltip.js +58 -0
  109. package/dist/components/charts/price-target-fan/tooltip.js.map +1 -0
  110. package/dist/components/charts/price-target-fan.d.ts +10 -0
  111. package/dist/components/charts/price-target-fan.d.ts.map +1 -0
  112. package/dist/components/charts/price-target-fan.js +24 -0
  113. package/dist/components/charts/price-target-fan.js.map +1 -0
  114. package/dist/components/charts/returns-calendar/grid.d.ts +8 -0
  115. package/dist/components/charts/returns-calendar/grid.d.ts.map +1 -0
  116. package/dist/components/charts/returns-calendar/grid.js +176 -0
  117. package/dist/components/charts/returns-calendar/grid.js.map +1 -0
  118. package/dist/components/charts/returns-calendar/tooltip.d.ts +2 -0
  119. package/dist/components/charts/returns-calendar/tooltip.js +55 -0
  120. package/dist/components/charts/returns-calendar/tooltip.js.map +1 -0
  121. package/dist/components/charts/returns-calendar.d.ts +48 -0
  122. package/dist/components/charts/returns-calendar.d.ts.map +1 -0
  123. package/dist/components/charts/returns-calendar.js +22 -0
  124. package/dist/components/charts/returns-calendar.js.map +1 -0
  125. package/dist/components/charts/status-bar/legend.d.ts +8 -0
  126. package/dist/components/charts/status-bar/legend.d.ts.map +1 -0
  127. package/dist/components/charts/status-bar/legend.js +37 -0
  128. package/dist/components/charts/status-bar/legend.js.map +1 -0
  129. package/dist/components/charts/status-bar/plot.d.ts +12 -0
  130. package/dist/components/charts/status-bar/plot.d.ts.map +1 -0
  131. package/dist/components/charts/status-bar/plot.js +176 -0
  132. package/dist/components/charts/status-bar/plot.js.map +1 -0
  133. package/dist/components/charts/status-bar/tooltip.d.ts +2 -0
  134. package/dist/components/charts/status-bar/tooltip.js +49 -0
  135. package/dist/components/charts/status-bar/tooltip.js.map +1 -0
  136. package/dist/components/charts/status-bar.d.ts +9 -0
  137. package/dist/components/charts/status-bar.d.ts.map +1 -0
  138. package/dist/components/charts/status-bar.js +64 -0
  139. package/dist/components/charts/status-bar.js.map +1 -0
  140. package/dist/components/charts/treemap/legend.d.ts +8 -0
  141. package/dist/components/charts/treemap/legend.d.ts.map +1 -0
  142. package/dist/components/charts/treemap/legend.js +35 -0
  143. package/dist/components/charts/treemap/legend.js.map +1 -0
  144. package/dist/components/charts/treemap/plot.d.ts +13 -0
  145. package/dist/components/charts/treemap/plot.d.ts.map +1 -0
  146. package/dist/components/charts/treemap/plot.js +123 -0
  147. package/dist/components/charts/treemap/plot.js.map +1 -0
  148. package/dist/components/charts/treemap/tile.d.ts +10 -0
  149. package/dist/components/charts/treemap/tile.d.ts.map +1 -0
  150. package/dist/components/charts/treemap/tile.js +114 -0
  151. package/dist/components/charts/treemap/tile.js.map +1 -0
  152. package/dist/components/charts/treemap/tooltip.d.ts +11 -0
  153. package/dist/components/charts/treemap/tooltip.d.ts.map +1 -0
  154. package/dist/components/charts/treemap/tooltip.js +73 -0
  155. package/dist/components/charts/treemap/tooltip.js.map +1 -0
  156. package/dist/components/charts/treemap.d.ts +56 -0
  157. package/dist/components/charts/treemap.d.ts.map +1 -0
  158. package/dist/components/charts/treemap.js +71 -0
  159. package/dist/components/charts/treemap.js.map +1 -0
  160. package/dist/components/charts/volume-profile/plot.d.ts +12 -0
  161. package/dist/components/charts/volume-profile/plot.d.ts.map +1 -0
  162. package/dist/components/charts/volume-profile/plot.js +211 -0
  163. package/dist/components/charts/volume-profile/plot.js.map +1 -0
  164. package/dist/components/charts/volume-profile/summary.d.ts +6 -0
  165. package/dist/components/charts/volume-profile/summary.d.ts.map +1 -0
  166. package/dist/components/charts/volume-profile/summary.js +76 -0
  167. package/dist/components/charts/volume-profile/summary.js.map +1 -0
  168. package/dist/components/charts/volume-profile/tooltip.d.ts +2 -0
  169. package/dist/components/charts/volume-profile/tooltip.js +84 -0
  170. package/dist/components/charts/volume-profile/tooltip.js.map +1 -0
  171. package/dist/components/charts/volume-profile.d.ts +111 -0
  172. package/dist/components/charts/volume-profile.d.ts.map +1 -0
  173. package/dist/components/charts/volume-profile.js +82 -0
  174. package/dist/components/charts/volume-profile.js.map +1 -0
  175. package/dist/components/custom/confirm-dialog.js +1 -1
  176. package/dist/components/motion/adaptive-stepper.js +1 -1
  177. package/dist/components/motion/alert.d.ts +40 -0
  178. package/dist/components/motion/alert.d.ts.map +1 -0
  179. package/dist/components/motion/alert.js +247 -0
  180. package/dist/components/motion/alert.js.map +1 -0
  181. package/dist/components/motion/animated-badge.js +1 -1
  182. package/dist/components/motion/animated-sidebar.js +1 -1
  183. package/dist/components/motion/animated-sidebar.js.map +1 -1
  184. package/dist/components/motion/animated-toast-stack.js +1 -1
  185. package/dist/components/motion/arc-picker.d.ts +28 -0
  186. package/dist/components/motion/arc-picker.d.ts.map +1 -0
  187. package/dist/components/motion/arc-picker.js +569 -0
  188. package/dist/components/motion/arc-picker.js.map +1 -0
  189. package/dist/components/motion/aspect-ratio.d.ts +23 -0
  190. package/dist/components/motion/aspect-ratio.d.ts.map +1 -0
  191. package/dist/components/motion/aspect-ratio.js +61 -0
  192. package/dist/components/motion/aspect-ratio.js.map +1 -0
  193. package/dist/components/motion/attachment-upload.d.ts.map +1 -1
  194. package/dist/components/motion/attachment-upload.js +2 -2
  195. package/dist/components/motion/attachment-upload.js.map +1 -1
  196. package/dist/components/motion/availability-scheduler/copy-menu.js +1 -1
  197. package/dist/components/motion/availability-scheduler/day-row.js +2 -2
  198. package/dist/components/motion/availability-scheduler/index.js +1 -1
  199. package/dist/components/motion/bloom-menu.js +1 -1
  200. package/dist/components/motion/bottom-sheet.js.map +1 -1
  201. package/dist/components/motion/bouncy-accordion.js +1 -1
  202. package/dist/components/motion/breadcrumb.d.ts +37 -0
  203. package/dist/components/motion/breadcrumb.d.ts.map +1 -0
  204. package/dist/components/motion/breadcrumb.js +259 -0
  205. package/dist/components/motion/breadcrumb.js.map +1 -0
  206. package/dist/components/motion/button/stateful.js +1 -1
  207. package/dist/components/motion/card-folder.js +1 -1
  208. package/dist/components/motion/center-morph-modal.js +1 -1
  209. package/dist/components/motion/collapsible.d.ts +34 -0
  210. package/dist/components/motion/collapsible.d.ts.map +1 -0
  211. package/dist/components/motion/collapsible.js +237 -0
  212. package/dist/components/motion/collapsible.js.map +1 -0
  213. package/dist/components/motion/color-selector.d.ts +28 -0
  214. package/dist/components/motion/color-selector.d.ts.map +1 -0
  215. package/dist/components/motion/color-selector.js +97 -0
  216. package/dist/components/motion/color-selector.js.map +1 -0
  217. package/dist/components/motion/combobox/list.js +1 -1
  218. package/dist/components/motion/combobox/trigger.js +1 -1
  219. package/dist/components/motion/command-palette.js +1 -1
  220. package/dist/components/motion/command-palette.js.map +1 -1
  221. package/dist/components/motion/context-menu.js +1 -1
  222. package/dist/components/motion/date-range-picker.d.ts +107 -0
  223. package/dist/components/motion/date-range-picker.d.ts.map +1 -0
  224. package/dist/components/motion/date-range-picker.js +907 -0
  225. package/dist/components/motion/date-range-picker.js.map +1 -0
  226. package/dist/components/motion/drawer.js.map +1 -1
  227. package/dist/components/motion/feedback-widget.js +1 -1
  228. package/dist/components/motion/file-tree.js +1 -1
  229. package/dist/components/motion/file-upload.js +1 -1
  230. package/dist/components/motion/infinite-masonry.js +1 -1
  231. package/dist/components/motion/knockout-bracket.d.ts +190 -0
  232. package/dist/components/motion/knockout-bracket.d.ts.map +1 -0
  233. package/dist/components/motion/knockout-bracket.js +952 -0
  234. package/dist/components/motion/knockout-bracket.js.map +1 -0
  235. package/dist/components/motion/knockout-wheel.d.ts +183 -0
  236. package/dist/components/motion/knockout-wheel.d.ts.map +1 -0
  237. package/dist/components/motion/knockout-wheel.js +1039 -0
  238. package/dist/components/motion/knockout-wheel.js.map +1 -0
  239. package/dist/components/motion/morphing-lightbox.d.ts +67 -0
  240. package/dist/components/motion/morphing-lightbox.d.ts.map +1 -0
  241. package/dist/components/motion/morphing-lightbox.js +499 -0
  242. package/dist/components/motion/morphing-lightbox.js.map +1 -0
  243. package/dist/components/motion/morphing-modal.js.map +1 -1
  244. package/dist/components/motion/morphing-search.js +1 -1
  245. package/dist/components/motion/morphing-search.js.map +1 -1
  246. package/dist/components/motion/morphing-tabs.js +1 -1
  247. package/dist/components/motion/multi-select/list.js +1 -1
  248. package/dist/components/motion/multi-select/trigger.js +1 -1
  249. package/dist/components/motion/notification-stack.js +1 -1
  250. package/dist/components/motion/overflow-actions.js +1 -1
  251. package/dist/components/motion/popover-morph.d.ts +5 -1
  252. package/dist/components/motion/popover-morph.d.ts.map +1 -1
  253. package/dist/components/motion/popover-morph.js +78 -27
  254. package/dist/components/motion/popover-morph.js.map +1 -1
  255. package/dist/components/motion/prediction-market-card.d.ts +37 -0
  256. package/dist/components/motion/prediction-market-card.d.ts.map +1 -0
  257. package/dist/components/motion/prediction-market-card.js +216 -0
  258. package/dist/components/motion/prediction-market-card.js.map +1 -0
  259. package/dist/components/motion/prediction-market.d.ts +49 -0
  260. package/dist/components/motion/prediction-market.d.ts.map +1 -0
  261. package/dist/components/motion/prediction-market.js +440 -0
  262. package/dist/components/motion/prediction-market.js.map +1 -0
  263. package/dist/components/motion/project-folder.js +1 -1
  264. package/dist/components/motion/project-folder.js.map +1 -1
  265. package/dist/components/motion/select-morph.js +1 -1
  266. package/dist/components/motion/select.js +1 -1
  267. package/dist/components/motion/signup-form.js +1 -1
  268. package/dist/components/motion/sortable-list.d.ts +53 -0
  269. package/dist/components/motion/sortable-list.d.ts.map +1 -0
  270. package/dist/components/motion/sortable-list.js +254 -0
  271. package/dist/components/motion/sortable-list.js.map +1 -0
  272. package/dist/components/motion/sortable-stack.d.ts +2 -0
  273. package/dist/components/motion/sortable-stack.js +3 -0
  274. package/dist/components/motion/swap/controls.d.ts +22 -0
  275. package/dist/components/motion/swap/controls.d.ts.map +1 -0
  276. package/dist/components/motion/swap/controls.js +167 -0
  277. package/dist/components/motion/swap/controls.js.map +1 -0
  278. package/dist/components/motion/swap/field.d.ts +14 -0
  279. package/dist/components/motion/swap/field.d.ts.map +1 -0
  280. package/dist/components/motion/swap/field.js +107 -0
  281. package/dist/components/motion/swap/field.js.map +1 -0
  282. package/dist/components/motion/swap/quote-row.d.ts +13 -0
  283. package/dist/components/motion/swap/quote-row.d.ts.map +1 -0
  284. package/dist/components/motion/swap/quote-row.js +55 -0
  285. package/dist/components/motion/swap/quote-row.js.map +1 -0
  286. package/dist/components/motion/swap/token-badges.d.ts +19 -0
  287. package/dist/components/motion/swap/token-badges.d.ts.map +1 -0
  288. package/dist/components/motion/swap/token-badges.js +54 -0
  289. package/dist/components/motion/swap/token-badges.js.map +1 -0
  290. package/dist/components/motion/swap/token-picker.d.ts +14 -0
  291. package/dist/components/motion/swap/token-picker.d.ts.map +1 -0
  292. package/dist/components/motion/swap/token-picker.js +190 -0
  293. package/dist/components/motion/swap/token-picker.js.map +1 -0
  294. package/dist/components/motion/swap.d.ts +14 -0
  295. package/dist/components/motion/swap.d.ts.map +1 -0
  296. package/dist/components/motion/swap.js +378 -0
  297. package/dist/components/motion/swap.js.map +1 -0
  298. package/dist/components/motion/table/row-handle.js +1 -1
  299. package/dist/components/motion/table/table-header.js +1 -1
  300. package/dist/components/motion/tabs.d.ts +5 -9
  301. package/dist/components/motion/tabs.d.ts.map +1 -1
  302. package/dist/components/motion/tabs.js +14 -5
  303. package/dist/components/motion/tabs.js.map +1 -1
  304. package/dist/components/motion/theme-toggle.js +1 -1
  305. package/dist/components/motion/tooltip/positioner.d.ts +33 -0
  306. package/dist/components/motion/tooltip/positioner.d.ts.map +1 -0
  307. package/dist/components/motion/tooltip/positioner.js +3 -0
  308. package/dist/components/motion/tooltip-surface.d.ts +5 -4
  309. package/dist/components/motion/tooltip-surface.d.ts.map +1 -1
  310. package/dist/components/motion/tooltip-surface.js +22 -73
  311. package/dist/components/motion/tooltip-surface.js.map +1 -1
  312. package/dist/components/motion/tooltip.d.ts +3 -1
  313. package/dist/components/motion/tooltip.d.ts.map +1 -1
  314. package/dist/components/motion/tooltip.js +54 -103
  315. package/dist/components/motion/tooltip.js.map +1 -1
  316. package/dist/components/motion/wallet-card/account-avatar.d.ts +8 -0
  317. package/dist/components/motion/wallet-card/account-avatar.d.ts.map +1 -0
  318. package/dist/components/motion/wallet-card/account-avatar.js +3 -0
  319. package/dist/components/motion/wallet-card/account-switcher.d.ts +14 -0
  320. package/dist/components/motion/wallet-card/account-switcher.d.ts.map +1 -0
  321. package/dist/components/motion/wallet-card/account-switcher.js +153 -0
  322. package/dist/components/motion/wallet-card/account-switcher.js.map +1 -0
  323. package/dist/components/motion/wallet-card/actions.d.ts +12 -0
  324. package/dist/components/motion/wallet-card/actions.d.ts.map +1 -0
  325. package/dist/components/motion/wallet-card/actions.js +58 -0
  326. package/dist/components/motion/wallet-card/actions.js.map +1 -0
  327. package/dist/components/motion/wallet-card/balance-delta.d.ts +12 -0
  328. package/dist/components/motion/wallet-card/balance-delta.d.ts.map +1 -0
  329. package/dist/components/motion/wallet-card/balance-delta.js +72 -0
  330. package/dist/components/motion/wallet-card/balance-delta.js.map +1 -0
  331. package/dist/components/motion/wallet-card/copy-button.d.ts +12 -0
  332. package/dist/components/motion/wallet-card/copy-button.d.ts.map +1 -0
  333. package/dist/components/motion/wallet-card/copy-button.js +41 -0
  334. package/dist/components/motion/wallet-card/copy-button.js.map +1 -0
  335. package/dist/components/motion/wallet-card/index.d.ts +13 -0
  336. package/dist/components/motion/wallet-card/index.d.ts.map +1 -0
  337. package/dist/components/motion/wallet-card/index.js +115 -0
  338. package/dist/components/motion/wallet-card/index.js.map +1 -0
  339. package/dist/components/motion/wallet-card/search-bar.d.ts +17 -0
  340. package/dist/components/motion/wallet-card/search-bar.d.ts.map +1 -0
  341. package/dist/components/motion/wallet-card/search-bar.js +156 -0
  342. package/dist/components/motion/wallet-card/search-bar.js.map +1 -0
  343. package/dist/components/reui/alert.d.ts +1 -1
  344. package/dist/components/reui/alert.js +1 -1
  345. package/dist/components/reui/autocomplete.js +1 -1
  346. package/dist/components/reui/badge.d.ts +1 -1
  347. package/dist/components/reui/cascader/cascader-async.d.ts +3 -2
  348. package/dist/components/reui/cascader/cascader-async.d.ts.map +1 -1
  349. package/dist/components/reui/cascader/cascader-async.js.map +1 -1
  350. package/dist/components/reui/cascader/cascader-columns.js +4 -4
  351. package/dist/components/reui/cascader/cascader-columns.js.map +1 -1
  352. package/dist/components/reui/cascader/cascader-context.d.ts +12 -4
  353. package/dist/components/reui/cascader/cascader-context.d.ts.map +1 -1
  354. package/dist/components/reui/cascader/cascader-context.js.map +1 -1
  355. package/dist/components/reui/cascader/cascader-footer.js +1 -1
  356. package/dist/components/reui/cascader/cascader-i18n.d.ts +1 -1
  357. package/dist/components/reui/cascader/cascader-item.d.ts +2 -2
  358. package/dist/components/reui/cascader/cascader-item.d.ts.map +1 -1
  359. package/dist/components/reui/cascader/cascader-item.js +23 -17
  360. package/dist/components/reui/cascader/cascader-item.js.map +1 -1
  361. package/dist/components/reui/cascader/cascader-lib.d.ts +8 -1
  362. package/dist/components/reui/cascader/cascader-lib.d.ts.map +1 -1
  363. package/dist/components/reui/cascader/cascader-lib.js +19 -11
  364. package/dist/components/reui/cascader/cascader-lib.js.map +1 -1
  365. package/dist/components/reui/cascader/cascader-nav.d.ts +1 -1
  366. package/dist/components/reui/cascader/cascader-nav.d.ts.map +1 -1
  367. package/dist/components/reui/cascader/cascader-nav.js +6 -5
  368. package/dist/components/reui/cascader/cascader-nav.js.map +1 -1
  369. package/dist/components/reui/cascader/cascader-types.d.ts +1 -1
  370. package/dist/components/reui/cascader/cascader-virtual.d.ts.map +1 -1
  371. package/dist/components/reui/cascader/cascader-virtual.js.map +1 -1
  372. package/dist/components/reui/cascader/cascader.d.ts +6 -2
  373. package/dist/components/reui/cascader/cascader.d.ts.map +1 -1
  374. package/dist/components/reui/cascader/cascader.js +59 -21
  375. package/dist/components/reui/cascader/cascader.js.map +1 -1
  376. package/dist/components/reui/data-grid/data-grid-column-filter.js +3 -3
  377. package/dist/components/reui/data-grid/data-grid-column-filter.js.map +1 -1
  378. package/dist/components/reui/data-grid/data-grid-column-header.d.ts.map +1 -1
  379. package/dist/components/reui/data-grid/data-grid-column-header.js +18 -14
  380. package/dist/components/reui/data-grid/data-grid-column-header.js.map +1 -1
  381. package/dist/components/reui/data-grid/data-grid-column-visibility.js +1 -1
  382. package/dist/components/reui/data-grid/data-grid-column-visibility.js.map +1 -1
  383. package/dist/components/reui/data-grid/data-grid-pagination.js +2 -2
  384. package/dist/components/reui/data-grid/data-grid-pagination.js.map +1 -1
  385. package/dist/components/reui/data-grid/data-grid-scroll-area.d.ts.map +1 -1
  386. package/dist/components/reui/data-grid/data-grid-scroll-area.js +85 -61
  387. package/dist/components/reui/data-grid/data-grid-scroll-area.js.map +1 -1
  388. package/dist/components/reui/data-grid/data-grid-table-dnd-rows.d.ts +7 -2
  389. package/dist/components/reui/data-grid/data-grid-table-dnd-rows.d.ts.map +1 -1
  390. package/dist/components/reui/data-grid/data-grid-table-dnd-rows.js +68 -39
  391. package/dist/components/reui/data-grid/data-grid-table-dnd-rows.js.map +1 -1
  392. package/dist/components/reui/data-grid/data-grid-table-dnd.d.ts +7 -2
  393. package/dist/components/reui/data-grid/data-grid-table-dnd.d.ts.map +1 -1
  394. package/dist/components/reui/data-grid/data-grid-table-dnd.js +90 -26
  395. package/dist/components/reui/data-grid/data-grid-table-dnd.js.map +1 -1
  396. package/dist/components/reui/data-grid/data-grid-table-virtual.js +1 -1
  397. package/dist/components/reui/data-grid/data-grid-table-virtual.js.map +1 -1
  398. package/dist/components/reui/data-grid/data-grid-table.d.ts.map +1 -1
  399. package/dist/components/reui/data-grid/data-grid-table.js +157 -38
  400. package/dist/components/reui/data-grid/data-grid-table.js.map +1 -1
  401. package/dist/components/reui/data-grid/data-grid.d.ts +16 -0
  402. package/dist/components/reui/data-grid/data-grid.d.ts.map +1 -1
  403. package/dist/components/reui/data-grid/data-grid.js +81 -51
  404. package/dist/components/reui/data-grid/data-grid.js.map +1 -1
  405. package/dist/components/reui/date-selector.js +1 -1
  406. package/dist/components/reui/event-calendar/event-calendar-agenda-view.js +1 -1
  407. package/dist/components/reui/event-calendar/event-calendar-event.js +1 -1
  408. package/dist/components/reui/event-calendar/event-calendar-month-view.js +1 -1
  409. package/dist/components/reui/event-calendar/event-calendar-nav.js +2 -2
  410. package/dist/components/reui/filters/filters-advanced.js +2 -2
  411. package/dist/components/reui/filters/filters-advanced.js.map +1 -1
  412. package/dist/components/reui/filters/filters-builder.d.ts +1 -1
  413. package/dist/components/reui/filters/filters-builder.js +1 -1
  414. package/dist/components/reui/filters/filters-chip.js +2 -2
  415. package/dist/components/reui/filters/filters-editors.js +1 -1
  416. package/dist/components/reui/filters/filters-lib.d.ts +1 -1
  417. package/dist/components/reui/filters/filters.js +1 -1
  418. package/dist/components/reui/frame.js +1 -1
  419. package/dist/components/reui/gantt/gantt-bar.js +1 -1
  420. package/dist/components/reui/gantt/gantt-nav.js +2 -2
  421. package/dist/components/reui/gantt/gantt-view.js +1 -1
  422. package/dist/components/reui/kanban.d.ts.map +1 -1
  423. package/dist/components/reui/kanban.js +30 -1
  424. package/dist/components/reui/kanban.js.map +1 -1
  425. package/dist/components/reui/number-field.js +1 -1
  426. package/dist/components/reui/phone-input.js +1 -1
  427. package/dist/components/reui/rating.js +1 -1
  428. package/dist/components/reui/signature-pad.d.ts +160 -0
  429. package/dist/components/reui/signature-pad.d.ts.map +1 -0
  430. package/dist/components/reui/signature-pad.js +764 -0
  431. package/dist/components/reui/signature-pad.js.map +1 -0
  432. package/dist/components/reui/time-picker.d.ts +202 -0
  433. package/dist/components/reui/time-picker.d.ts.map +1 -0
  434. package/dist/components/reui/time-picker.js +1002 -0
  435. package/dist/components/reui/time-picker.js.map +1 -0
  436. package/dist/components/reui/tree.js +1 -1
  437. package/dist/components/ui/accordion.js +1 -1
  438. package/dist/components/ui/alert-dialog.js +1 -1
  439. package/dist/components/ui/alert.js +1 -1
  440. package/dist/components/ui/attachment.js +1 -1
  441. package/dist/components/ui/breadcrumb.js +1 -1
  442. package/dist/components/ui/bubble.js +1 -1
  443. package/dist/components/ui/button-group.js +1 -1
  444. package/dist/components/ui/button.d.ts +1 -1
  445. package/dist/components/ui/button.js +1 -1
  446. package/dist/components/ui/calendar.js +1 -1
  447. package/dist/components/ui/carousel.js +1 -1
  448. package/dist/components/ui/checkbox.js +1 -1
  449. package/dist/components/ui/combobox.js +1 -1
  450. package/dist/components/ui/command.js +1 -1
  451. package/dist/components/ui/context-menu.js +1 -1
  452. package/dist/components/ui/dialog.js +1 -1
  453. package/dist/components/ui/dropdown-menu.js +1 -1
  454. package/dist/components/ui/empty.js +1 -1
  455. package/dist/components/ui/field.js +1 -1
  456. package/dist/components/ui/input-group.d.ts +1 -1
  457. package/dist/components/ui/input-group.js +1 -1
  458. package/dist/components/ui/input-otp.js +1 -1
  459. package/dist/components/ui/item.js +1 -1
  460. package/dist/components/ui/marker.d.ts +1 -1
  461. package/dist/components/ui/marker.js +1 -1
  462. package/dist/components/ui/menubar.js +1 -1
  463. package/dist/components/ui/message-scroller.js +1 -1
  464. package/dist/components/ui/native-select.js +1 -1
  465. package/dist/components/ui/navigation-menu.js +1 -1
  466. package/dist/components/ui/pagination.js +1 -1
  467. package/dist/components/ui/questionnaire.js +1 -1
  468. package/dist/components/ui/select.js +1 -1
  469. package/dist/components/ui/sheet.js +1 -1
  470. package/dist/components/ui/sidebar.js +1 -1
  471. package/dist/components/ui/spinner.js +1 -1
  472. package/dist/components/ui/tabs.js +1 -1
  473. package/dist/components/ui/toast.js +1 -1
  474. package/dist/components/ui/toggle.js +1 -1
  475. package/dist/constants-CsKm9sSk.js +30 -0
  476. package/dist/constants-CsKm9sSk.js.map +1 -0
  477. package/dist/context-3_vY1jbv.js +141 -0
  478. package/dist/context-3_vY1jbv.js.map +1 -0
  479. package/dist/context-BE60udRT.js +99 -0
  480. package/dist/context-BE60udRT.js.map +1 -0
  481. package/dist/context-BYXeJQnz.d.ts +150 -0
  482. package/dist/context-BYXeJQnz.d.ts.map +1 -0
  483. package/dist/context-Bc6VC1HA.js +181 -0
  484. package/dist/context-Bc6VC1HA.js.map +1 -0
  485. package/dist/context-BqjZ1Z_w.js +111 -0
  486. package/dist/context-BqjZ1Z_w.js.map +1 -0
  487. package/dist/context-CZfRKkcZ.js +204 -0
  488. package/dist/context-CZfRKkcZ.js.map +1 -0
  489. package/dist/context-Cn-00gfW.js +169 -0
  490. package/dist/context-Cn-00gfW.js.map +1 -0
  491. package/dist/context-Cnlo53sV.d.ts +92 -0
  492. package/dist/context-Cnlo53sV.d.ts.map +1 -0
  493. package/dist/context-Rl5VCYA8.js +257 -0
  494. package/dist/context-Rl5VCYA8.js.map +1 -0
  495. package/dist/context-sD8DQga-.js +122 -0
  496. package/dist/context-sD8DQga-.js.map +1 -0
  497. package/dist/{copy-menu-TIKvPaAZ.js → copy-menu-C5GaT4Z-.js} +2 -2
  498. package/dist/{copy-menu-TIKvPaAZ.js.map → copy-menu-C5GaT4Z-.js.map} +1 -1
  499. package/dist/ease-B82HVmio.d.ts +50 -0
  500. package/dist/ease-B82HVmio.d.ts.map +1 -0
  501. package/dist/hooks/use-modal-scope.d.ts +6 -0
  502. package/dist/hooks/use-modal-scope.d.ts.map +1 -0
  503. package/dist/hooks/use-modal-scope.js +83 -0
  504. package/dist/hooks/use-modal-scope.js.map +1 -0
  505. package/dist/lib/ease.d.ts +2 -49
  506. package/dist/model-DfeFradZ.d.ts +9 -0
  507. package/dist/model-DfeFradZ.d.ts.map +1 -0
  508. package/dist/model-DlbIqCZg.d.ts +41 -0
  509. package/dist/model-DlbIqCZg.d.ts.map +1 -0
  510. package/dist/plot-CdFTbMI_.js +131 -0
  511. package/dist/plot-CdFTbMI_.js.map +1 -0
  512. package/dist/positioner-3mCqiebN.js +204 -0
  513. package/dist/positioner-3mCqiebN.js.map +1 -0
  514. package/dist/tooltip-BarafYiU.d.ts +67 -0
  515. package/dist/tooltip-BarafYiU.d.ts.map +1 -0
  516. package/dist/tooltip-BqxVD6D-.d.ts +64 -0
  517. package/dist/tooltip-BqxVD6D-.d.ts.map +1 -0
  518. package/dist/tooltip-C01qUgsW.d.ts +133 -0
  519. package/dist/tooltip-C01qUgsW.d.ts.map +1 -0
  520. package/dist/tooltip-C6qUs7px.d.ts +36 -0
  521. package/dist/tooltip-C6qUs7px.d.ts.map +1 -0
  522. package/dist/tooltip-DQ4DXgeu.d.ts +94 -0
  523. package/dist/tooltip-DQ4DXgeu.d.ts.map +1 -0
  524. package/dist/types-B_6p3LXz.d.ts +36 -0
  525. package/dist/types-B_6p3LXz.d.ts.map +1 -0
  526. package/dist/types-D6e3gWOA.d.ts +22 -0
  527. package/dist/types-D6e3gWOA.d.ts.map +1 -0
  528. package/dist/use-geometry-CH0foIo7.d.ts +9 -0
  529. package/dist/use-geometry-CH0foIo7.d.ts.map +1 -0
  530. package/dist/utils-B3YXTsDI.js +26 -0
  531. package/dist/utils-B3YXTsDI.js.map +1 -0
  532. package/package.json +14 -9
  533. package/dist/cascader-types-BnH6wYD-.d.ts.map +0 -1
  534. package/dist/lib/ease.d.ts.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"filters-advanced.js","names":["React"],"sources":["../../../../src/components/reui/filters/filters-advanced.tsx"],"sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\nimport {\n ChevronDownIcon,\n CircleAlertIcon,\n CopyIcon,\n EllipsisVerticalIcon,\n FolderPlusIcon,\n GripVerticalIcon,\n ListFilterIcon,\n PlusIcon,\n RefreshCwIcon,\n Trash2Icon,\n UngroupIcon,\n XIcon,\n} from \"lucide-react\";\n\nimport { cn } from \"@kumix/utils\";\nimport { Button } from \"../../ui/button\";\nimport {\n DropdownMenu,\n DropdownMenuContent,\n DropdownMenuItem,\n DropdownMenuSeparator,\n DropdownMenuTrigger,\n} from \"../../ui/dropdown-menu\";\nimport { Input } from \"../../ui/input\";\nimport { Popover, PopoverContent, PopoverTrigger } from \"../../ui/popover\";\nimport { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from \"../../ui/tooltip\";\nimport { FilterFieldPicker } from \"./filters-builder\";\nimport {\n FilterMoveToMenuItems,\n FilterOperatorPopover,\n FilterRuleMenuItems,\n FilterValuePopover,\n useFilterRuleDisplay,\n} from \"./filters-chip\";\nimport {\n type FilterActionsContextValue,\n FilterReorderProvider,\n filterControlSizes,\n filterReadOnlyProps,\n isFilterLocked,\n useFilterActions,\n useFilterChipAutoOpen,\n useFilterChipFocused,\n useFilterFocusEmpty,\n useFilterFocusStore,\n useFilterRender,\n useFilterReorderable,\n useFilterRowPending,\n useFilterRowStateStore,\n useFilterSegmentFocus,\n useFilterState,\n} from \"./filters-context\";\nimport { FILTER_ROW_SELECTOR, useFilterRowDrag } from \"./filters-dnd\";\nimport { filterIssueLabel } from \"./filters-i18n\";\nimport {\n FILTER_FIELD_PICKER_CLASS,\n FILTER_MENU_CLASS,\n FILTER_MENU_LABEL_CLASS,\n filterCombinatorSlot,\n getFilterField,\n isFilterFieldPickable,\n joinFilterPath,\n} from \"./filters-lib\";\nimport { getFilterArity, getFilterOperator, operatorTakesValue } from \"./filters-operators\";\nimport { collectFilterIssues, createFilterRule, isFilterRule } from \"./filters-query\";\nimport type {\n FilterCombinator,\n FilterEmptyStateContext,\n FilterField,\n FilterGroupNode,\n FilterIssue,\n FilterNode,\n FilterOperator,\n FilterQuery,\n FilterRule,\n} from \"./filters-types\";\n\n/* -------------------------------------------------------------------------- */\n/* Columns */\n/* -------------------------------------------------------------------------- */\n\nconst CONTENT_COLUMNS = [\"combinator\", \"field\", \"operator\", \"value\"] as const;\n\nconst ACTION_COLUMNS = [\"drag\", \"menu\", \"add\", \"remove\"] as const;\n\n/** Every column a row may draw, in two bands. Navigation is by COLUMN NAME and\n * never position: the BANDS keep ArrowDown off a group's footer button. */\ntype FilterColumn = (typeof CONTENT_COLUMNS)[number] | (typeof ACTION_COLUMNS)[number];\n\n/** The nearest column in `band` that `available` has; backward wins a tie. */\nfunction nearestColumn(\n band: readonly FilterColumn[],\n from: FilterColumn,\n available: Map<string | null, HTMLElement>,\n): HTMLElement | undefined {\n const at = band.indexOf(from);\n if (at === -1) return undefined;\n for (let step = 0; step < band.length; step++) {\n const before = step === 0 ? undefined : available.get(band[at - step] ?? \"\");\n if (before) return before;\n const after = available.get(band[at + step] ?? \"\");\n if (after) return after;\n }\n return undefined;\n}\n\n/** Marks a focusable cell control, read by the keyboard walker. Not\n * `data-slot`: a cell control is handed to a Base UI trigger through `render`,\n * which stamps its own, so a slot here would be two owners on one attribute. */\nconst CELL_ATTRIBUTE = \"data-filter-cell\";\n\n/** Marks a cell the user TYPES into: the builder claims the arrows, Home, End\n * and Delete, and each means something else in a text box. */\nconst CELL_INPUT_ATTRIBUTE = \"data-filter-cell-input\";\n\nconst ROW_SELECTOR = FILTER_ROW_SELECTOR;\n\n/** Hands every row's handle its pointer wiring: only the panel, which owns the\n * body element, can measure a drop. */\n\nconst FilterDragContext = React.createContext<ReturnType<typeof useFilterRowDrag> | null>(null);\n\n/** What each node is missing, by id. An empty map by default, so a row mounted\n * outside the shipped panel gets \"nothing is wrong\" instead of a throw. */\nconst FilterIssueContext = React.createContext<ReadonlyMap<string, FilterIssue>>(new Map());\n\nfunction cellProps(column: FilterColumn, active: FilterColumn | null) {\n return {\n \"data-filter-cell\": column,\n // ONE tab stop for the whole builder; the arrows move within it.\n tabIndex: active === column ? 0 : -1,\n };\n}\n\n/** What an INVALID cell wears: `aria-invalid` to announce it, `data-invalid`\n * to style it, `aria-description` for the sentence. */\nfunction issueProps(\n issue: FilterIssue | undefined,\n column: FilterIssue[\"column\"],\n message: string,\n) {\n if (!issue || issue.column !== column) return null;\n return {\n \"aria-invalid\": true,\n \"data-invalid\": \"\",\n \"aria-description\": message,\n // NO `title`: the hint icon carries the sentence in a real tooltip, and a\n // native one would clobber the truncation `title` beside it.\n } as const;\n}\n\n/** Sera's uppercase and wide tracking cost about a third of a cell, so where\n * every other style drew \"migration\" sera drew \"MIGRATI...\". */\nconst SERA_TEXT_CLASS = \"\";\n\nconst CELL_CLASS = cn(\n \"w-full min-w-0 justify-between gap-1.5 font-normal\",\n // `>svg` is the caret and only the caret: a field's own type icon sits in a\n // nested span, where it keeps full strength because it is content.\n \"[&>svg]:text-muted-foreground\",\n // WHAT A CELL GIVES UP FIRST: padding, icon and caret cost about 44px before\n // a character is drawn, and the name is what nothing else can reconstruct.\n // Container queries and not a viewport breakpoint: the question is how wide\n // THIS cell is, and one panel holds a 300px cell and a 40px one.\n \"@max-[7rem]/cell:gap-0 @max-[7rem]/cell:[&>svg]:hidden\",\n \"@max-[5rem]/cell:[&_span>svg]:hidden\",\n SERA_TEXT_CLASS,\n);\n\n/** What an invalid cell looks like. A ring, not a border: a border changes the\n * box, so a cell turning invalid would nudge every cell beside it. */\nconst CELL_INVALID_CLASS = \"data-invalid:ring-destructive/40 data-invalid:ring-1\";\n\n/** Width of the leading combinator column. The 58.72px pill put this track at\n * 4rem and it does not shrink now the pill has: it is sized for the longest of\n * the three things in it, \"Where\", 51.44px in every style. */\nconst COMBINATOR_CLASS = cn(\n \"w-16 shrink-0 items-center justify-center\",\n // 6px of its own on TOP of the band's `gap-1.5`: this column is the\n // sentence's connective, not a fourth control butted against the attribute.\n \"me-1.5\",\n);\n\n/** The two static words in that column, CENTRED because the pill's own\n * `justify-center` centres its word. `w-full`, or `truncate` has no box. */\nconst COMBINATOR_TEXT_CLASS = cn(\n \"w-full truncate px-1 text-center text-muted-foreground text-sm\",\n SERA_TEXT_CLASS,\n);\n\n/** A row is TWO BANDS. The trailing pair of every row at every depth shares one\n * vertical axis - 0.00px of spread from 1104px to 240px, eight styles, depth\n * three - and only because the content band may shrink to nothing. */\nconst ROW_BAND_CLASS = \"flex min-w-0 items-center gap-1.5\";\n\nconst CONTENT_BAND_CLASS = \"flex min-w-0 flex-1 items-center gap-1.5\";\n\n/** FLEX and not a block: a `Button` is `inline-flex`, so a block wrapper builds\n * a line box as tall as its font's strut - 28px buttons in 28.141px wrappers. */\nconst CELL_BOX_CLASS = \"@container/cell flex min-w-0 shrink grow-0\";\n\n/** THE DEFAULT WIDTH OF EACH CONTENT CELL. An INLINE FALLBACK and not a\n * declaration on the panel: declared, the panel would beat anything an ANCESTOR\n * set, which is where a consumer sets it in popover mode. So all four work:\n *\n * <Filters variant=\"advanced\" className=\"[--filter-field-width:14rem]\" />\n * <FiltersAdvancedPanel className=\"[--filter-operator-width:7rem]\" />\n * <Card className=\"[--filter-value-width:16rem]\"><Filters … /></Card>\n * [data-slot=\"filters-advanced\"] { --filter-field-width: 14rem } */\nconst FIELD_CELL_CLASS = \"basis-[var(--filter-field-width,11rem)]\";\nconst OPERATOR_CELL_CLASS = \"basis-[var(--filter-operator-width,9rem)]\";\nconst VALUE_CELL_CLASS = \"basis-[var(--filter-value-width,12rem)]\";\n\n/** The trailing band. `pe-1` is on the BAND and not the gutter, since a group\n * card is `pe-0`; the footer and `DROP_SLOT_INDICATOR` restate the same four. */\nconst ACTION_BAND_CLASS = cn(\"flex shrink-0 items-center gap-0.5 pe-1 text-muted-foreground\");\n\n/** What the grip and the kebab wear while open. TWO ATTRIBUTES, because Radix\n * sets `data-state=\"open\"` and Base UI `data-popup-open`, so one selector alone\n * would be dead in one twin, silently, in a byte-locked file. */\nconst ACTION_CONTROL_CLASS = cn(\n \"hover:inset-ring hover:inset-ring-border\",\n // Base UI.\n \"data-popup-open:inset-ring data-popup-open:inset-ring-border\",\n // Radix.\n \"data-[state=open]:inset-ring data-[state=open]:inset-ring-border\",\n);\n\n/** The gap between sibling rows, one third of one measurement:\n * `FILTER_ROW_SEAM_PX` is HALF of it and the footer's `-mt-*` cancels it. */\nconst FILTER_ROW_GAP_CLASS = \"gap-3\";\nconst FILTER_ROW_GAP_CANCEL_CLASS = \"-mt-3\";\nconst FILTER_ROW_HALF_GAP_CLASS = {\n // The slot names the BOUNDARY between two rows, which is the middle of the\n // gap: 6px of it less HALF the rule's own 2px, so its CENTRE lands there.\n before: \"data-[drop-edge=before]:after:mb-[5px]\",\n after: \"data-[drop-edge=after]:after:mt-[5px]\",\n} as const;\n\n/** POPOVER: the popover content is `p-0`, so this IS the popup's own inner\n * padding. INLINE there is no popup, and a panel that pads itself as well is a\n * second inset the page did not ask for. */\nconst PANEL_PAD_VAR = \"--filter-panel-pad\";\nconst PANEL_PAD_POPOVER = \"0.75rem\";\nconst PANEL_PAD_INLINE = \"0px\";\n\n/** The panel's ONE horizontal rhythm: a row's trailing controls sit at the\n * content edge, which IS this padding, so a footer that disagrees breaks it. */\nconst PANEL_GUTTER_CLASS = \"px-(--filter-panel-pad)\";\n\nconst PANEL_CLASS = \"flex w-full min-w-0 flex-col gap-2 py-(--filter-panel-pad)\";\n\n/** A RING and not a border, the whole answer to the staggered trailing\n * controls: a border pushes the content edge inward a pixel per level. */\nconst GROUP_CARD_CLASS = cn(\n \"min-w-0 flex-1 rounded-md bg-muted/40\",\n \"inset-ring inset-ring-border\",\n \"ps-2 pe-0\",\n \"data-invalid:inset-ring-destructive/50\",\n // The DESTINATION of a drop into this group, told apart from the insertion\n // slot by STYLE and not size: dashed is not there yet, solid exists.\n \"data-drop-into:bg-muted/60\",\n \"data-drop-into:outline-1 data-drop-into:outline-solid\",\n \"data-drop-into:outline-border data-drop-into:-outline-offset-2\",\n);\n\n/** THE CONTAINER a row measures its own room against, on the panel body and on\n * every group's list, so a row asks how wide the list it is IN is. */\nconst TRACK_CONTAINER_CLASS = \"@container/track\";\n\n/** When a group stops putting its combinator BESIDE the card. A DEPTH budget\n * was wrong both ways: at 380px the depth-three row painted zero pixels of\n * field, operator and value and fanned the kebab column out by up to 119px.\n * 26rem is what a row MEASURES: 134px of fixed cost plus about 200px of cells. */\nconst GROUP_COMBINATOR_WRAP_CLASS = \"@max-[26rem]/track:w-full\";\n\n/** The combinator itself, once its wrapper has a whole line. Pinned to the\n * same 4rem the gutter track is, so it is the same control at every width. */\nconst GROUP_COMBINATOR_WRAPPED_CLASS = \"@max-[26rem]/track:w-16\";\n\n/** How a row shows where a dragged node would land. `data-drop-edge` is an\n * insertion BETWEEN rows, drawn here; `data-drop-into` is painted on the CARD,\n * so \"inside this group\" and \"after this group\" are not one picture. */\nconst DROP_SLOT_INDICATOR = cn(\n // The SOURCE in flight, faded rather than hidden. THREE FIFTHS is a contrast\n // measurement: at 35 under a `blur-[1px]` the text composited to #a9a9a9,\n // 2.35:1 on the light panel, under even the 3:1 line for a non-text mark.\n \"relative rounded-md\",\n \"data-dragging:opacity-60\",\n // THE INSERTION LINE lives in the gap rather than overlaying a real row.\n // `end-1` and not `end-0`: four pixels of `pe-1` are the kebab column.\n \"data-drop-edge:after:absolute\",\n \"data-drop-edge:after:start-0 data-drop-edge:after:end-1\",\n \"data-drop-edge:after:h-0.5 data-drop-edge:after:rounded-full\",\n \"data-drop-edge:after:bg-primary\",\n \"data-drop-edge:after:z-10\",\n \"data-[drop-edge=before]:after:bottom-full\",\n FILTER_ROW_HALF_GAP_CLASS.before,\n \"data-[drop-edge=after]:after:top-full\",\n FILTER_ROW_HALF_GAP_CLASS.after,\n);\n\n/** What a CONDITION row draws, which is what a group's row draws: the slot and\n * nothing else. It used to add a faint dashed outline of its own, a second\n * dashed rectangle a few pixels from the first saying what it already said. */\nconst DROP_INDICATOR = DROP_SLOT_INDICATOR;\n\n/** How the footer says \"append to the top level\": the same RULE the rows draw.\n * `data-drop-into` and not `data-drop-edge`, because an explicit zone is a\n * DESTINATION. Both ends restate the padding VARIABLE, since `inset` resolves\n * against the PADDING box and `inset-x-0` overran every rule above it. */\nconst FOOTER_DROP_CLASS = cn(\n \"data-drop-into:after:absolute\",\n \"data-drop-into:after:start-(--filter-panel-pad)\",\n \"data-drop-into:after:end-[calc(var(--filter-panel-pad)+4px)]\",\n \"data-drop-into:after:top-0 data-drop-into:after:h-0.5\",\n \"data-drop-into:after:rounded-full data-drop-into:after:bg-primary\",\n);\n\n/** The cells a row owns ITSELF: a group's row contains its children's rows, so\n * a bare `querySelectorAll` would let ArrowRight walk into the first of them. */\nfunction ownCells(row: HTMLElement): HTMLElement[] {\n return Array.from(row.querySelectorAll<HTMLElement>(`[${CELL_ATTRIBUTE}]`)).filter(\n (cell) => cell.closest<HTMLElement>(ROW_SELECTOR) === row,\n );\n}\n\n/* -------------------------------------------------------------------------- */\n/* Shared cells */\n/* -------------------------------------------------------------------------- */\n\ninterface RowPosition {\n index: number;\n parentId: string;\n combinator: FilterCombinator;\n depth: number;\n}\n\n/** The leading and/or slot: one group is joined by ONE operator, and mixing is\n * what a nested group is FOR. */\nfunction CombinatorCell({\n index,\n parentId,\n combinator,\n active,\n onFocus,\n className,\n}: {\n index: number;\n parentId: string;\n combinator: FilterCombinator;\n active: FilterColumn | null;\n onFocus: (column: FilterColumn) => () => void;\n className?: string;\n}) {\n const actions = useFilterActions();\n const sizes = filterControlSizes(actions);\n const slot = filterCombinatorSlot(index);\n const word = combinator === \"and\" ? actions.labels.and : actions.labels.or;\n\n if (slot === \"where\") {\n return <span className={cn(COMBINATOR_TEXT_CLASS, className)}>{actions.labels.where}</span>;\n }\n\n if (slot === \"echo\") {\n return <span className={cn(COMBINATOR_TEXT_CLASS, className)}>{word}</span>;\n }\n\n const name = actions.labels.combinatorLabel(word);\n\n return (\n <Button\n variant=\"outline\"\n size={sizes.button}\n /* The WORD is in the name: the track is fixed, so a locale whose\n word overflows draws \"a...\". */\n aria-label={name}\n title={name}\n disabled={actions.disabled}\n {...filterReadOnlyProps(actions)}\n className={cn(\n \"group/combinator relative w-full min-w-0 justify-center px-1.5 font-normal\",\n SERA_TEXT_CLASS,\n className,\n )}\n {...cellProps(\"combinator\", active)}\n onFocus={onFocus(\"combinator\")}\n onClick={() => actions.toggleCombinator(parentId)}\n >\n <span className=\"truncate\">{word}</span>\n {/* ABSOLUTELY POSITIONED, so the word still centres at 0.00px. */}\n <span\n aria-hidden=\"true\"\n className={cn(\n \"pointer-events-none absolute end-1 opacity-0 transition-opacity\",\n \"group-hover/combinator:opacity-60\",\n \"group-focus-visible/combinator:opacity-60\",\n \"[&_svg]:size-3\",\n )}\n >\n <RefreshCwIcon />\n </span>\n </Button>\n );\n}\n\n/** Whether dragging this node could change the tree at all; the grip is drawn\n * only when it could. Every destination outside the footer zone lives inside\n * some row and the drop layer discards any inside the dragged one, so the sole\n * child of the root is the one case with nowhere to go. A pure function of the\n * QUERY, deliberately blind to `disabled` and `readOnly`: a locked bar keeps\n * its grip, because \"you may not move this\" and \"there is nowhere to move it\"\n * are different sentences. */\nfunction canFilterNodeMove(query: FilterQuery<unknown>, position: { parentId: string }) {\n if (position.parentId !== query.id) return true;\n return query.rules.length > 1;\n}\n\n/** The error, as a QUIET mark the pointer can ask about: ONE per ROW, and\n * `aria-hidden`, since the cell carries it as `aria-description`. */\nfunction RowIssueHint({ message, className }: { message: string; className?: string }) {\n if (!message) return null;\n return (\n <TooltipProvider delay={200}>\n <Tooltip>\n <TooltipTrigger\n render={\n <span\n data-slot=\"filter-row-issue\"\n /* Focusable so a keyboard user can summon it, but OUT of the\n tab order: the sentence is already on the invalid cell. */\n tabIndex={-1}\n aria-hidden=\"true\"\n className={cn(\n \"flex shrink-0 items-center justify-center text-destructive [&_svg]:size-3.5\",\n className,\n )}\n >\n <CircleAlertIcon />\n </span>\n }\n />\n <TooltipContent side=\"top\">{message}</TooltipContent>\n </Tooltip>\n </TooltipProvider>\n );\n}\n\n/** The drag handle: what ARMS the gesture, since arming the row would turn\n * every text selection into a drag, and the only thing a screen reader can be\n * told about, which is why Alt+arrow hangs off it. */\nfunction RowHandle({\n nodeId,\n active,\n onFocus,\n}: {\n nodeId: string;\n active: FilterColumn | null;\n onFocus: (column: FilterColumn) => () => void;\n}) {\n const actions = useFilterActions();\n const sizes = filterControlSizes(actions);\n const dragProps = React.useContext(FilterDragContext);\n const locked = isFilterLocked(actions);\n\n return (\n <Button\n variant=\"ghost\"\n size={sizes.icon}\n aria-label={actions.labels.reorder}\n /* The activation is the DRAG, which no click performs, so without these\n a screen reader finds a \"Reorder\" button that appears broken. */\n aria-keyshortcuts=\"Alt+ArrowUp Alt+ArrowDown\"\n aria-description={actions.labels.reorderHint}\n disabled={actions.disabled}\n {...filterReadOnlyProps(actions)}\n /* `touch-none`, or a finger on the handle becomes a page scroll the\n gesture then fights. Muted at rest, never hidden. */\n className={cn(\n \"cursor-grab touch-none focus-visible:text-foreground\",\n \"active:cursor-grabbing\",\n ACTION_CONTROL_CLASS,\n )}\n {...cellProps(\"drag\", active)}\n onFocus={onFocus(\"drag\")}\n /* Not armed at all while locked; the engine refuses it again. */\n {...(locked ? null : dragProps?.(nodeId))}\n >\n <GripVerticalIcon />\n </Button>\n );\n}\n\n/** Which cell of a row owns the builder's single tab stop. An operator change\n * can take the value column out from under the focus pointing at it. */\nfunction useActiveColumn(\n nodeId: string,\n columns: FilterColumn[],\n isFirstRow: boolean,\n): FilterColumn | null {\n const focused = useFilterChipFocused(nodeId);\n const segment = useFilterSegmentFocus(nodeId);\n const noFocus = useFilterFocusEmpty();\n\n if (focused) {\n return segment && columns.includes(segment as FilterColumn)\n ? (segment as FilterColumn)\n : columns[0];\n }\n return noFocus && isFirstRow ? columns[0] : null;\n}\n\nfunction useFilterIssue(nodeId: string): FilterIssue | undefined {\n return React.useContext(FilterIssueContext).get(nodeId);\n}\n\n/* -------------------------------------------------------------------------- */\n/* Inline free text */\n/* -------------------------------------------------------------------------- */\n\n/** Whether a value is FREE TEXT, and therefore typed in the row itself. The\n * CHIP row keeps its popover for every value, deliberately, which is why this\n * lives here and not in the shared display hook. NUMBER is in: empty clears,\n * and anything unparseable snaps back to the last committed number. */\nfunction usesInlineTextEditor<V, O>(\n field: FilterField<V, O>,\n operator: FilterOperator | undefined,\n hasCustomDisplay: boolean,\n): boolean {\n if (field.editor) return false;\n if (field.options || field.loadOptions) return false;\n if (field.renderValue || field.valueText || hasCustomDisplay) return false;\n const type = field.type ?? \"text\";\n if (type !== \"text\" && type !== \"number\") return false;\n return getFilterArity(operator) === \"one\";\n}\n\n/** The value cell as a real text box. COMMIT IS BLUR AND ENTER: per keystroke\n * makes the ROOT the source of truth for every character, and debouncing only\n * adds a window where the cell and the query disagree with no event. */\nfunction FilterInlineValueCell<V, O>({\n rule,\n field,\n issue,\n issueText,\n active,\n onFocus,\n}: {\n rule: FilterRule<V>;\n field: FilterField<V, O>;\n issue: FilterIssue | undefined;\n issueText: string;\n active: FilterColumn | null;\n onFocus: (column: FilterColumn) => () => void;\n}) {\n const actions = useFilterActions<V, O>();\n const focusStore = useFilterFocusStore();\n const locked = isFilterLocked(actions);\n const numeric = (field.type ?? \"text\") === \"number\";\n // The handoff the value POPOVER honours, answered by taking the caret.\n const autoOpen = useFilterChipAutoOpen(rule.id) === \"value\";\n const inputRef = React.useRef<HTMLInputElement>(null);\n\n const committed = rule.value === undefined || rule.value === null ? \"\" : String(rule.value);\n const [draft, setDraft] = React.useState(committed);\n // STATE and not a ref: the sync below runs during render.\n const [seed, setSeed] = React.useState(committed);\n\n // Adjusting state during render; an effect would paint the stale text.\n if (seed !== committed) {\n setSeed(committed);\n setDraft(committed);\n }\n\n // CONSUMED as it is honoured: a flag left standing is spent by the next row.\n React.useEffect(() => {\n if (!autoOpen) return;\n if (!locked) {\n const input = inputRef.current;\n input?.focus();\n // SELECTED: the condition step may have coerced a value across.\n input?.select();\n }\n focusStore.set({ id: rule.id, segment: \"value\", autoOpen: false });\n }, [autoOpen, locked, focusStore, rule.id]);\n\n const commit = () => {\n if (draft === seed) return;\n\n if (numeric) {\n const text = draft.trim();\n // Empty clears rather than writing 0, which silently matches rows.\n if (text === \"\") {\n actions.updateRule(rule.id, { value: undefined as V });\n return;\n }\n const parsed = Number(text);\n // Revert, do not write: a NaN compares false against every row.\n if (!Number.isFinite(parsed)) {\n setDraft(seed);\n return;\n }\n actions.updateRule(rule.id, { value: parsed as V });\n return;\n }\n\n actions.updateRule(rule.id, { value: draft as V });\n };\n\n return (\n /* A FRAGMENT, not a wrapper: the positioning context for the error mark\n is the CELL itself, which already carries the column's basis. */\n <>\n <Input\n ref={inputRef}\n aria-label={field.label}\n placeholder={field.placeholder ?? actions.labels.valuePlaceholder}\n /* The RIGHT KEYPAD only: `type=\"number\"` brings spinners. */\n inputMode={numeric ? \"decimal\" : undefined}\n value={draft}\n /* `h-full` and no size class: `Input` has ONE height per style, so\n at `size=\"sm\"` it was a pixel taller in nova and two in sera. */\n className={cn(\"h-full\", issueText && \"pe-7\", CELL_INVALID_CLASS)}\n /* Native `readOnly`, not `disabled`: it keeps its tab stop. */\n readOnly={locked}\n disabled={actions.disabled}\n {...filterReadOnlyProps(actions)}\n {...cellProps(\"value\", active)}\n {...{ [CELL_INPUT_ATTRIBUTE]: \"\" }}\n {...issueProps(issue, \"value\", issueText)}\n onFocus={onFocus(\"value\")}\n onChange={(event) => setDraft(event.target.value)}\n onBlur={commit}\n onKeyDown={(event) => {\n if (event.key === \"Enter\" && !event.nativeEvent.isComposing) {\n event.preventDefault();\n commit();\n return;\n }\n if (event.key === \"Escape\") {\n /* Only when there is something to revert; Escape belongs to the\n surface the builder sits in. */\n if (draft === seed) return;\n event.preventDefault();\n event.stopPropagation();\n setDraft(seed);\n }\n }}\n />\n <RowIssueHint\n message={issueText}\n /* `pointer-events-none`, so a click still lands in the input. */\n className=\"pointer-events-none absolute end-2 top-1/2 -translate-y-1/2 *:pointer-events-auto\"\n />\n </>\n );\n}\n\n/* -------------------------------------------------------------------------- */\n/* Rule row */\n/* -------------------------------------------------------------------------- */\n\nexport interface FilterAdvancedRowProps<V = unknown> {\n rule: FilterRule<V>;\n position: RowPosition;\n}\n\nfunction FilterAdvancedRowImpl<V, O>({ rule, position }: FilterAdvancedRowProps<V>) {\n const actions = useFilterActions<V, O>();\n const render = useFilterRender<V, O>();\n const sizes = filterControlSizes(actions);\n const focusStore = useFilterFocusStore();\n const locked = isFilterLocked(actions);\n const { query } = useFilterState<V>();\n\n const field = getFilterField(actions.index, rule.path);\n const operators = field ? actions.resolveOperators(field) : [];\n const operator = getFilterOperator(operators, rule.operator);\n const takesValue = Boolean(rule.operator) && operatorTakesValue(operator);\n const inlineValue =\n takesValue && field\n ? usesInlineTextEditor(field, operator, Boolean(render.renderValue))\n : false;\n\n const issue = useFilterIssue(rule.id);\n const issueText = issue ? filterIssueLabel(issue, actions.labels) : \"\";\n\n const {\n pathText,\n pathLabel,\n pathCollapsed,\n operatorLabel,\n valueLabel,\n valueText,\n valueFullText,\n valueEmpty,\n } = useFilterRuleDisplay<V, O>(rule, field, operator);\n\n /* ------------------------------ field cell ------------------------------ */\n\n const fieldAutoOpen = useFilterChipAutoOpen(rule.id) === \"field\";\n const [pickerOpen, setPickerOpen] = React.useState(false);\n // Controlled so both can REFUSE to open while locked.\n const [menuOpen, setMenuOpen] = React.useState(false);\n // Seeded from the rule's own level, so amending opens beside its siblings.\n const [pickerPath, setPickerPath] = React.useState<string[]>(() => rule.path.slice(0, -1));\n const [pickerQuery, setPickerQuery] = React.useState(\"\");\n\n // A new row arrives with a GUESS at its field, so the one choice not yet the\n // user's own opens itself. CONSUMED as it is honoured: `pickerOpen` is a\n // dependency, so a flag left standing reopened the picker in the frame it\n // closed, a keyboard trap on the one row a user creates most.\n React.useEffect(() => {\n if (!fieldAutoOpen || pickerOpen) return;\n if (!locked) setPickerOpen(true);\n focusStore.set({ id: rule.id, segment: \"field\", autoOpen: false });\n }, [fieldAutoOpen, pickerOpen, locked, focusStore, rule.id]);\n\n // Re-seed on each open, so a browse that was abandoned last time does not\n // decide where this one starts.\n React.useEffect(() => {\n if (!pickerOpen) return;\n setPickerPath(rule.path.slice(0, -1));\n setPickerQuery(\"\");\n }, [pickerOpen, rule.path]);\n\n /* ------------------------------- tab stop ------------------------------- */\n\n const slot = filterCombinatorSlot(position.index);\n const reorderable = useFilterReorderable();\n const canMove = reorderable && canFilterNodeMove(query, position);\n const rowStateStore = useFilterRowStateStore();\n // Still waiting for its attribute, so neither later cell is drawn.\n const pending = useFilterRowPending(rule.id);\n\n const columns = React.useMemo(() => {\n const list: FilterColumn[] = [];\n if (slot === \"toggle\") list.push(\"combinator\");\n list.push(\"field\");\n if (!pending) {\n list.push(\"operator\");\n if (takesValue) list.push(\"value\");\n }\n // The grip is only a tab stop when it is drawn.\n if (canMove) list.push(\"drag\");\n list.push(\"menu\");\n return list;\n }, [slot, takesValue, canMove, pending]);\n\n const active = useActiveColumn(rule.id, columns, position.depth === 1 && position.index === 0);\n\n const onCellFocus = React.useCallback(\n (column: FilterColumn) => () =>\n focusStore.set({ id: rule.id, segment: column, autoOpen: false }),\n [focusStore, rule.id],\n );\n\n /* -------------------------------- render -------------------------------- */\n\n if (!field) return null;\n\n return (\n <div\n /* A GROUP, not a grid row: four depths of grid describes to no\n assistive technology at all. */\n role=\"group\"\n aria-label={actions.labels.rowLabel(`${pathText} ${operatorLabel}`, position.depth)}\n data-slot=\"filter-row\"\n data-node-id={rule.id}\n data-parent-id={position.parentId}\n data-index={position.index}\n data-depth={position.depth}\n className={cn(\"group/row\", ROW_BAND_CLASS, DROP_INDICATOR)}\n >\n <div className={cn(COMBINATOR_CLASS, CELL_BOX_CLASS)}>\n <CombinatorCell\n index={position.index}\n parentId={position.parentId}\n combinator={position.combinator}\n active={active}\n onFocus={onCellFocus}\n />\n </div>\n\n {/* THE CONTENT BAND: sized to itself, not to a share of the row. */}\n <div className={CONTENT_BAND_CLASS}>\n <div className={cn(CELL_BOX_CLASS, FIELD_CELL_CLASS)}>\n <Popover\n open={pickerOpen}\n onOpenChange={(next) => {\n if (next && locked) return;\n setPickerOpen(next);\n }}\n >\n <PopoverTrigger\n disabled={actions.disabled}\n {...filterReadOnlyProps(actions)}\n render={\n <Button\n variant=\"outline\"\n size={sizes.button}\n /* The path is truncated on screen, so the name carries all\n of it: \"Primary loca... > State\" identifies nothing. */\n aria-label={pathText}\n /* And as a `title` - unless the path is COLLAPSED, where the\n ellipsis inside already carries this exact sentence. */\n title={pathCollapsed ? undefined : pathText}\n className={CELL_CLASS}\n {...cellProps(\"field\", active)}\n onFocus={onCellFocus(\"field\")}\n >\n <span className=\"flex min-w-0 items-center gap-1.5 truncate\">\n {field.icon}\n <span className=\"truncate\">{pathLabel}</span>\n </span>\n <ChevronDownIcon />\n </Button>\n }\n />\n <PopoverContent\n align=\"start\"\n className={cn(FILTER_FIELD_PICKER_CLASS, actions.fieldPickerClassName)}\n >\n <FilterFieldPicker<V, O>\n path={pickerPath}\n onPathChange={setPickerPath}\n query={pickerQuery}\n onQueryChange={setPickerQuery}\n onSelect={(path, defaultOperator) => {\n setPickerOpen(false);\n // BUILDING versus AMENDING, the fork of the stepped\n // flow. Naming `operator` retires the field handoff.\n focusStore.set({\n id: rule.id,\n segment: pending ? \"operator\" : \"field\",\n autoOpen: pending,\n });\n // BEFORE the same-path early return, or a row minted\n // on a guessed field the user then picks stays pending.\n rowStateStore.resolvePending(rule.id);\n // Re-picking the field it has is a dismissal.\n if (joinFilterPath(path) === joinFilterPath(rule.path)) return;\n // On the create path the condition stays UNSET, so the\n // menu opening next has nothing selected.\n actions.updateRule(rule.id, {\n path,\n operator: pending ? \"\" : (defaultOperator ?? \"\"),\n value: undefined,\n });\n }}\n />\n </PopoverContent>\n </Popover>\n </div>\n\n {pending ? null : (\n <div className={cn(CELL_BOX_CLASS, OPERATOR_CELL_CLASS)}>\n <FilterOperatorPopover\n rule={rule}\n field={field}\n trigger={\n <Button\n variant=\"outline\"\n size={sizes.button}\n /* No `aria-label`: the label IS the name. */\n title={operatorLabel}\n className={cn(CELL_CLASS, CELL_INVALID_CLASS, \"text-muted-foreground\")}\n {...cellProps(\"operator\", active)}\n {...issueProps(issue, \"operator\", issueText)}\n onFocus={onCellFocus(\"operator\")}\n >\n <span className=\"truncate\">{operatorLabel}</span>\n <ChevronDownIcon />\n </Button>\n }\n />\n </div>\n )}\n\n {/* The cell stays even with no value: dropping it would shift the\n trailing buttons into the value column on that row alone. It goes\n ENTIRELY while the row is PENDING, the one case that argument does\n not cover: a row choosing its attribute has no column count yet. */}\n {pending ? null : (\n <div\n className={cn(\n CELL_BOX_CLASS,\n VALUE_CELL_CLASS,\n /* The positioning context for an inline editor's error mark. */\n \"relative\",\n /* What lets an inline box match the buttons beside it: as tall as\n the row, so `h-full` inside resolves to the button height. */\n \"self-stretch\",\n )}\n >\n {takesValue ? (\n inlineValue ? (\n <FilterInlineValueCell<V, O>\n rule={rule}\n field={field}\n issue={issue}\n issueText={issueText}\n active={active}\n onFocus={onCellFocus}\n />\n ) : (\n <FilterValuePopover\n rule={rule}\n field={field}\n operator={operator}\n trigger={\n <Button\n variant=\"outline\"\n size={sizes.button}\n /* The VALUE is the name, never the attribute.\n Locked, it grows to the whole list. */\n aria-label={locked ? valueFullText : valueText}\n title={valueFullText}\n className={cn(\n CELL_CLASS,\n CELL_INVALID_CLASS,\n \"h-full\",\n valueEmpty && \"text-muted-foreground\",\n )}\n {...cellProps(\"value\", active)}\n {...issueProps(issue, \"value\", issueText)}\n onFocus={onCellFocus(\"value\")}\n >\n {/* FREE OUTPUT: whatever the field draws. */}\n <span className=\"min-w-0 flex-1 truncate text-start\">{valueLabel}</span>\n {/* The error, INSIDE the control that failed. */}\n <RowIssueHint message={issueText} />\n </Button>\n }\n />\n )\n ) : null}\n </div>\n )}\n </div>\n\n {/* The WEIGHT is on the CLUSTER: a `ghost` button names no colour, so\n the kebab took the full `--foreground`. */}\n <div className={ACTION_BAND_CLASS}>\n {canMove ? <RowHandle nodeId={rule.id} active={active} onFocus={onCellFocus} /> : null}\n <DropdownMenu\n open={menuOpen}\n onOpenChange={(next) => {\n if (next && locked) return;\n setMenuOpen(next);\n }}\n >\n <DropdownMenuTrigger\n disabled={actions.disabled}\n {...filterReadOnlyProps(actions)}\n render={\n <Button\n variant=\"ghost\"\n size={sizes.icon}\n aria-label={actions.labels.chipMenu(field.label)}\n className={ACTION_CONTROL_CLASS}\n {...cellProps(\"menu\", active)}\n onFocus={onCellFocus(\"menu\")}\n />\n }\n >\n <EllipsisVerticalIcon />\n </DropdownMenuTrigger>\n <DropdownMenuContent align=\"end\" className={cn(FILTER_MENU_CLASS, actions.menuClassName)}>\n {/* Grouping is HERE, not on a chip: the keyboard path to\n `a AND (b OR c)`. */}\n <FilterRuleMenuItems ruleId={rule.id} allowGrouping />\n </DropdownMenuContent>\n </DropdownMenu>\n </div>\n </div>\n );\n}\n\n/** One rule, as a row, memoized: the query tree shares structure, so editing\n * one row of twenty re-renders one. */\nexport const FilterAdvancedRow = React.memo(FilterAdvancedRowImpl) as typeof FilterAdvancedRowImpl;\n\n/** A rule whose field the schema no longer has: dropping it would lose a saved\n * view's data, rendering nothing would leave it filtering invisibly. */\nfunction FilterUnknownRow<V>({ rule, position }: { rule: FilterRule<V>; position: RowPosition }) {\n const actions = useFilterActions();\n const sizes = filterControlSizes(actions);\n return (\n <div\n role=\"group\"\n aria-label={actions.labels.rowLabel(\n rule.path.join(actions.labels.pathSeparator),\n position.depth,\n )}\n data-slot=\"filter-row\"\n data-node-id={rule.id}\n data-parent-id={position.parentId}\n data-index={position.index}\n data-depth={position.depth}\n data-unknown=\"\"\n /* The DROP language too: the hit test pushes every row carrying\n `data-parent-id` into the surface, and this row carries one. */\n className={cn(ROW_BAND_CLASS, DROP_INDICATOR)}\n >\n <span className=\"min-w-0 flex-1 truncate text-muted-foreground text-sm\">\n {rule.path.join(actions.labels.pathSeparator)}\n </span>\n {/* The same trailing band, so the broken row lands on the kebab column. */}\n <div className={ACTION_BAND_CLASS}>\n <Button\n variant=\"ghost\"\n size={sizes.icon}\n aria-label={actions.labels.remove}\n className={ACTION_CONTROL_CLASS}\n /* Outside the roving scheme: a real tab stop keeps it removable. */\n data-filter-cell=\"remove\"\n /* It had no gate, so the one row whose purpose is to be removed\n could be removed from a read-only bar. */\n disabled={actions.disabled}\n {...filterReadOnlyProps(actions)}\n onClick={() => actions.removeNode(rule.id)}\n >\n <XIcon />\n </Button>\n </div>\n </div>\n );\n}\n\n/* -------------------------------------------------------------------------- */\n/* Group */\n/* -------------------------------------------------------------------------- */\n\n/** A nested group: an indented card, its conditions, and one way to add\n * another. The HEADLINE went; the pill outside already says \"or\". */\nfunction FilterAdvancedGroup<V, O>({\n group,\n position,\n}: {\n group: FilterGroupNode<V>;\n position: RowPosition;\n}) {\n const actions = useFilterActions<V, O>();\n const sizes = filterControlSizes(actions);\n const focusStore = useFilterFocusStore();\n\n const { query } = useFilterState<V>();\n\n const issue = useFilterIssue(group.id);\n const issueText = issue ? filterIssueLabel(issue, actions.labels) : \"\";\n\n const reorderable = useFilterReorderable();\n const canMove = reorderable && canFilterNodeMove(query, position);\n const rowStateStore = useFilterRowStateStore();\n\n const slot = filterCombinatorSlot(position.index);\n const columns = React.useMemo(() => {\n const list: FilterColumn[] = [];\n if (slot === \"toggle\") list.push(\"combinator\");\n // DOM order, which the arrow walker reads: a group's own controls are all\n // in its footer now, add first and the trailing pair after it.\n list.push(\"add\");\n if (canMove) list.push(\"drag\");\n list.push(\"menu\");\n return list;\n }, [slot, canMove]);\n\n const active = useActiveColumn(group.id, columns, position.depth === 1 && position.index === 0);\n\n const onCellFocus = React.useCallback(\n (column: FilterColumn) => () =>\n focusStore.set({ id: group.id, segment: column, autoOpen: false }),\n [focusStore, group.id],\n );\n\n const description =\n group.combinator === \"and\" ? actions.labels.groupAll : actions.labels.groupAny;\n\n const addInto = () => {\n const id = addFilterRow(actions, group.id);\n if (!id) return;\n rowStateStore.markPending(id);\n focusStore.set({ id, segment: \"field\", autoOpen: true });\n };\n\n return (\n <div\n role=\"group\"\n aria-label={actions.labels.groupLabel(description, position.depth)}\n data-slot=\"filter-row\"\n data-node-id={group.id}\n data-parent-id={position.parentId}\n data-index={position.index}\n data-depth={position.depth}\n /* `flex-wrap` is the whole of the narrow-panel fix. `items-center`\n measures the flex line, so the pill centres on the card. */\n className={cn(\"flex flex-wrap items-center gap-1.5\", DROP_SLOT_INDICATOR)}\n >\n <div className={cn(COMBINATOR_CLASS, CELL_BOX_CLASS, GROUP_COMBINATOR_WRAP_CLASS)}>\n <CombinatorCell\n index={position.index}\n parentId={position.parentId}\n combinator={position.combinator}\n active={active}\n onFocus={onCellFocus}\n className={GROUP_COMBINATOR_WRAPPED_CLASS}\n />\n </div>\n\n {/* The CARD lights up as the drop destination, not the header strip the\n engine measured. This `data-invalid` only styles; the announcement\n rides the footer's add button, which is the focusable control. */}\n <div\n data-slot=\"filter-group\"\n data-invalid={issue ? \"\" : undefined}\n className={GROUP_CARD_CLASS}\n >\n {/* Eight pixels, because it is a DROP TARGET and a zone beats a row. */}\n <div\n data-slot=\"filter-group-header\"\n className=\"flex h-2 items-center\"\n /* The TOP of the card means the top of the list: index 0 PREPENDS.\n It used to append, so the one place a pointer can aim to say \"into\n this group\" put the row at the far other end of it. */\n data-drop-parent={group.id}\n data-drop-index={0}\n />\n\n {/* A CONTAINER: the box every child row divides up. */}\n <div className={cn(TRACK_CONTAINER_CLASS, \"flex flex-col\", FILTER_ROW_GAP_CLASS)}>\n {group.rules.length === 0 ? (\n <p\n className={cn(\n /* 70% foreground, not the muted token: on the card's tint the\n muted foreground measured 4.35:1 in light, under 4.5:1 AA. */\n \"rounded-md border border-dashed px-2 py-3 text-foreground/70\",\n \"text-center text-xs\",\n \"data-drop-into:border-primary/60 data-drop-into:bg-primary/5\",\n \"data-drop-into:text-primary\",\n )}\n data-slot=\"filter-group-empty\"\n data-drop-parent={group.id}\n data-drop-index={0}\n >\n {actions.labels.groupPlaceholder}\n </p>\n ) : (\n group.rules.map((node, index) => (\n <FilterAdvancedNode<V, O>\n key={node.id}\n node={node}\n position={{\n index,\n parentId: group.id,\n combinator: group.combinator,\n depth: position.depth + 1,\n }}\n />\n ))\n )}\n </div>\n\n {/* `flex-nowrap`, or the group's kebab leaves the kebab column. */}\n <div\n data-slot=\"filter-group-footer\"\n className=\"flex flex-nowrap items-center gap-2 pt-2 pb-2 text-muted-foreground\"\n data-drop-parent={group.id}\n data-drop-index={group.rules.length}\n >\n <Button\n variant=\"outline\"\n size={sizes.button}\n aria-label={actions.labels.addToGroup}\n className={cn(\n /* `shrink` and not merely `min-w-0`: `shrink-0` is baked into\n the shadcn button's own base class. */\n \"min-w-0 shrink font-normal\",\n \"overflow-hidden\",\n CELL_INVALID_CLASS,\n )}\n disabled={actions.disabled}\n {...filterReadOnlyProps(actions)}\n {...cellProps(\"add\", active)}\n /* An EMPTY group is flagged on the control that fills it. */\n {...issueProps(issue, \"group\", issueText)}\n onFocus={onCellFocus(\"add\")}\n onClick={addInto}\n >\n <PlusIcon />\n {actions.labels.addCondition}\n </Button>\n\n <div className={cn(\"ms-auto\", ACTION_BAND_CLASS)}>\n {canMove ? <RowHandle nodeId={group.id} active={active} onFocus={onCellFocus} /> : null}\n <FilterGroupMenu group={group} active={active} onFocus={onCellFocus} />\n </div>\n </div>\n </div>\n </div>\n );\n}\n\n/** A group's kebab. A menu row affords six words, where two icons said none. */\nfunction FilterGroupMenu<V>({\n group,\n active,\n onFocus,\n}: {\n group: FilterGroupNode<V>;\n active: FilterColumn | null;\n onFocus: (column: FilterColumn) => () => void;\n}) {\n const actions = useFilterActions();\n const sizes = filterControlSizes(actions);\n const locked = isFilterLocked(actions);\n const [open, setOpen] = React.useState(false);\n\n return (\n <DropdownMenu\n open={open}\n onOpenChange={(next) => {\n if (next && locked) return;\n setOpen(next);\n }}\n >\n <DropdownMenuTrigger\n disabled={actions.disabled}\n {...filterReadOnlyProps(actions)}\n render={\n <Button\n variant=\"ghost\"\n size={sizes.icon}\n aria-label={actions.labels.groupMenu}\n className={ACTION_CONTROL_CLASS}\n {...cellProps(\"menu\", active)}\n onFocus={onFocus(\"menu\")}\n />\n }\n >\n <EllipsisVerticalIcon />\n </DropdownMenuTrigger>\n <DropdownMenuContent align=\"end\" className={cn(FILTER_MENU_CLASS, actions.menuClassName)}>\n <DropdownMenuItem disabled={locked} onClick={() => actions.duplicateNode(group.id)}>\n <CopyIcon aria-hidden=\"true\" />\n <span className={FILTER_MENU_LABEL_CLASS}>{actions.labels.duplicate}</span>\n </DropdownMenuItem>\n <DropdownMenuItem disabled={locked} onClick={() => actions.unwrapGroup(group.id)}>\n {/* The inverse of the row menu's layers glyph. */}\n <UngroupIcon aria-hidden=\"true\" />\n <span className={FILTER_MENU_LABEL_CLASS}>{actions.labels.ungroup}</span>\n </DropdownMenuItem>\n <FilterMoveToMenuItems nodeId={group.id} />\n <DropdownMenuSeparator />\n <DropdownMenuItem\n variant=\"destructive\"\n disabled={locked}\n onClick={() => actions.removeNode(group.id)}\n >\n {/* No colour: the destructive variant paints the row's svgs. */}\n <Trash2Icon aria-hidden=\"true\" />\n <span className={FILTER_MENU_LABEL_CLASS}>{actions.labels.removeGroup}</span>\n </DropdownMenuItem>\n </DropdownMenuContent>\n </DropdownMenu>\n );\n}\n\nfunction FilterAdvancedNode<V, O>({\n node,\n position,\n}: {\n node: FilterNode<V>;\n position: RowPosition;\n}) {\n const actions = useFilterActions<V, O>();\n\n if (!isFilterRule(node)) {\n return <FilterAdvancedGroup<V, O> group={node} position={position} />;\n }\n if (!getFilterField(actions.index, node.path)) {\n return <FilterUnknownRow<V> rule={node} position={position} />;\n }\n return <FilterAdvancedRow<V, O> rule={node} position={position} />;\n}\n\n/* -------------------------------------------------------------------------- */\n/* Adding */\n/* -------------------------------------------------------------------------- */\n\n/** Appends a condition on the first attribute anyone may filter on, at any\n * depth. `isFilterFieldPickable` is the picker's own rule. */\nfunction addFilterRow<V, O>(\n actions: FilterActionsContextValue<V, O>,\n parentId?: string,\n): string | null {\n // Before `nextId` and before `addRule`: while the store points at a row that\n // was never created, the whole panel drops out of the tab order.\n if (isFilterLocked(actions)) return null;\n\n const entry = actions.index.all.find((candidate) => isFilterFieldPickable(candidate.field));\n if (!entry) return null;\n\n const id = actions.nextId();\n actions.addRule(\n createFilterRule<V>({\n id,\n path: entry.path,\n // Deliberately empty: the row arrives PENDING, and a seeded default\n // would open the next menu with its own answer highlighted.\n operator: \"\",\n }),\n parentId,\n );\n return id;\n}\n\n/* -------------------------------------------------------------------------- */\n/* Panel */\n/* -------------------------------------------------------------------------- */\n\n/** The panel draws NO border, NO background and NO radius, and takes no\n * element to be drawn as: a surface is the page's decision. */\nexport interface FiltersAdvancedPanelProps {\n /** Which of the two boxes the panel sits in, the only thing deciding whether\n * it pads itself: a popover's content is `p-0`, so this padding IS its\n * inner padding, and `\"inline\"` is a page that owns its own. */\n mode?: \"popover\" | \"inline\";\n /** Replaces the empty state for this panel only. Wins over\n * `Filters.renderEmpty`, the precedence a field has over the root's. */\n renderEmpty?: (context: FilterEmptyStateContext) => React.ReactNode;\n /** Whether rows can be reordered. See `FiltersProps.reorderable`. */\n reorderable?: boolean;\n className?: string;\n}\n\n/** The builder itself: nested groups over the query tree the chips read. A\n * group is a parenthesised list joined by ONE operator, so nesting is a real\n * tree: a flat model cannot represent `a AND (b OR c)` without inventing\n * precedence, and invented precedence returns the wrong rows. */\nexport function FiltersAdvancedPanel<V, O>({\n mode = \"popover\",\n renderEmpty,\n reorderable = false,\n className,\n}: FiltersAdvancedPanelProps) {\n const actions = useFilterActions<V, O>();\n const panelRender = useFilterRender<V, O>();\n const sizes = filterControlSizes(actions);\n const { query, ruleCount, announcement, announcementSeq } = useFilterState<V>();\n const focusStore = useFilterFocusStore();\n const rowStateStore = useFilterRowStateStore();\n const bodyRef = React.useRef<HTMLDivElement>(null);\n const locked = isFilterLocked(actions);\n\n /* ------------------------------ validation ------------------------------ */\n\n /** What is unfinished, computed ONCE: an empty group is a fact about a\n * group, not about any row inside it. */\n const issues = React.useMemo(\n () =>\n collectFilterIssues(\n query,\n (rule) => {\n const field = getFilterField(actions.index, rule.path);\n if (!field) return null;\n return getFilterArity(getFilterOperator(actions.resolveOperators(field), rule.operator));\n },\n // The same normalisation the display callbacks get.\n (rule) => {\n const field = getFilterField(actions.index, rule.path);\n if (!field?.validate) return null;\n const operator = getFilterOperator(actions.resolveOperators(field), rule.operator);\n if (!operator) return null;\n return field.validate({\n value: rule.value,\n values:\n rule.value === undefined || rule.value === null\n ? []\n : Array.isArray(rule.value)\n ? (rule.value as unknown[])\n : [rule.value],\n field,\n operator,\n arity: getFilterArity(operator) ?? \"one\",\n rule,\n labels: actions.labels,\n });\n },\n ),\n [query, actions],\n );\n\n /** The issues a row may DRAW: the ones on a value committed once. */\n const visibleIssueMap = React.useMemo(() => {\n const visible = new Map<string, FilterIssue>();\n for (const issue of issues) {\n // CUSTOM ONLY. The built-in reasons describe a row as HALF BUILT,\n // so every Add filter produced a red row on the happy path.\n if (issue.reason !== \"custom\") continue;\n if (rowStateStore.has(issue.nodeId)) visible.set(issue.nodeId, issue);\n }\n return visible;\n }, [issues, rowStateStore]);\n\n /** Says out loud that a VISIBLE error has appeared, which would\n * otherwise happen in silence. The DRAWN issues, on a RISE only. */\n const announcedIssues = React.useRef({\n count: visibleIssueMap.size,\n seq: announcementSeq,\n });\n React.useEffect(() => {\n const before = announcedIssues.current;\n announcedIssues.current = {\n count: visibleIssueMap.size,\n seq: announcementSeq,\n };\n if (announcementSeq !== before.seq) return;\n if (visibleIssueMap.size <= before.count) return;\n actions.announce(actions.labels.issueSummary(visibleIssueMap.size));\n }, [visibleIssueMap, announcementSeq, actions]);\n\n /* ---------------------------- focus recovery ---------------------------- */\n\n /** Whether the panel, or a menu of its own, held focus a moment ago. A\n * blur WITH a `relatedTarget` is focus arriving somewhere real; a blur\n * with none, or none at all when the element is simply removed, is what\n * this exists to repair. */\n const heldFocus = React.useRef(false);\n const addRowRef = React.useRef<HTMLButtonElement>(null);\n\n /** Puts focus back after a mutation that destroyed the thing holding it:\n * measured at 50, 200, 600 and 1200ms after Convert to group, Remove,\n * Ungroup and Move to group, `document.activeElement` was the BODY,\n * because a menu restores focus to a trigger the action unmounted. */\n const restoreFocus = React.useCallback(() => {\n // A handoff is mid-air and owns focus: between one step being answered\n // and the next opening `document.activeElement` IS the body.\n if (focusStore.getSnapshot().autoOpen) return;\n if (!heldFocus.current) return;\n const active = document.activeElement;\n if (active && active !== document.body) return;\n const rows = Array.from(bodyRef.current?.querySelectorAll<HTMLElement>(ROW_SELECTOR) ?? []);\n const { id, segment } = focusStore.getSnapshot();\n const row = id ? rows.find((candidate) => candidate.dataset.nodeId === id) : undefined;\n const cells = row ? ownCells(row) : [];\n const target =\n cells.find((entry) => entry.getAttribute(CELL_ATTRIBUTE) === segment) ??\n cells[0] ??\n (rows[0] ? ownCells(rows[0])[0] : undefined) ??\n addRowRef.current ??\n undefined;\n target?.focus();\n }, [focusStore]);\n\n // In the passive effect, not a frame later: React removes the control in\n // the mutation phase, so a menu's restore then aims at a detached node.\n React.useEffect(() => {\n restoreFocus();\n }, [restoreFocus]);\n\n /* -------------------------------- adding -------------------------------- */\n\n const addRow = React.useCallback(() => {\n const id = addFilterRow(actions);\n if (!id) return;\n // PENDING until the attribute is chosen, the first of three questions.\n rowStateStore.markPending(id);\n focusStore.set({ id, segment: \"field\", autoOpen: true });\n }, [actions, focusStore, rowStateStore]);\n\n const addGroup = React.useCallback(() => {\n const id = actions.addGroup();\n // An empty id means it refused, and focusing a group never created\n // would strand the tab stop.\n if (!id) return;\n // Onto the group's own chrome, not into it: it arrives empty.\n focusStore.set({ id, segment: \"add\", autoOpen: false });\n }, [actions, focusStore]);\n\n /* ------------------------------- keyboard ------------------------------- */\n\n const onKeyDown = (event: React.KeyboardEvent<HTMLDivElement>) => {\n const cell = (event.target as HTMLElement).closest<HTMLElement>(`[${CELL_ATTRIBUTE}]`);\n // A key pressed inside an open popover belongs to that popover; its\n // content is portaled out, so this is belt and braces.\n //\n // ArrowDown never reaches here: Base UI stops it at the menu trigger.\n if (!cell || event.target !== cell) return;\n\n const body = bodyRef.current;\n const row = cell.closest<HTMLElement>(ROW_SELECTOR);\n if (!body || !row) return;\n\n /* A cell the user TYPES into keeps the keys that edit text; only the\n VERTICAL keys stay. */\n const editing = cell.hasAttribute(CELL_INPUT_ATTRIBUTE);\n\n // DOM order for the two places that mean \"the whole builder\".\n const rows = Array.from(body.querySelectorAll<HTMLElement>(ROW_SELECTOR));\n const cells = ownCells(row);\n const rowIndex = rows.indexOf(row);\n const cellIndex = cells.indexOf(cell);\n\n const rtl = getComputedStyle(cell).direction === \"rtl\";\n const forward = rtl ? \"ArrowLeft\" : \"ArrowRight\";\n const backward = rtl ? \"ArrowRight\" : \"ArrowLeft\";\n\n const focus = (target: HTMLElement | undefined) => {\n if (!target) return;\n event.preventDefault();\n target.focus();\n };\n\n const from = cell.getAttribute(CELL_ATTRIBUTE) as FilterColumn;\n const band = (CONTENT_COLUMNS as readonly FilterColumn[]).includes(from)\n ? CONTENT_COLUMNS\n : ACTION_COLUMNS;\n\n /* The rows that draw a cell in this BAND, in cell order: by ROW it went\n BACKWARDS at +212, -166, +122, -76, +38 pixels once a group's own\n controls moved to its footer. */\n const bandRows: HTMLElement[] = [];\n const seen = new Set<HTMLElement>();\n for (const entry of body.querySelectorAll<HTMLElement>(`[${CELL_ATTRIBUTE}]`)) {\n const column = entry.getAttribute(CELL_ATTRIBUTE) as FilterColumn;\n if (!(band as readonly FilterColumn[]).includes(column)) continue;\n const owner = entry.closest<HTMLElement>(ROW_SELECTOR);\n if (!owner || seen.has(owner)) continue;\n seen.add(owner);\n bandRows.push(owner);\n }\n const bandIndex = bandRows.indexOf(row);\n\n const focusRow = (step: number) => {\n const nextRow = bandRows[bandIndex + step];\n if (!nextRow) return;\n const cellsThere = ownCells(nextRow);\n const byColumn = new Map(\n cellsThere.map((entry) => [entry.getAttribute(CELL_ATTRIBUTE), entry]),\n );\n // The band, then anything at all, which keeps a consumer's cell\n // reachable.\n focus(nearestColumn(band, from, byColumn) ?? cellsThere[0]);\n };\n\n const nodeId = row.dataset.nodeId;\n if (!nodeId) return;\n\n // Alt reorders rather than navigates, within the owning group only:\n // changing depth with an arrow would make one gesture mean two things.\n if (event.altKey && (event.key === \"ArrowUp\" || event.key === \"ArrowDown\")) {\n // Plain arrows, Home and End are deliberately NOT gated.\n if (locked || !reorderable) return;\n event.preventDefault();\n actions.moveNode(nodeId, event.key === \"ArrowDown\" ? 1 : -1);\n return;\n }\n\n if (event.key === \"ArrowDown\") return focusRow(1);\n if (event.key === \"ArrowUp\") return focusRow(-1);\n if (editing) return;\n\n if (event.key === forward) return focus(cells[cellIndex + 1]);\n if (event.key === backward) return focus(cells[cellIndex - 1]);\n if (event.key === \"Home\") {\n return focus(event.ctrlKey ? ownCells(rows[0])[0] : cells[0]);\n }\n if (event.key === \"End\") {\n const scope = event.ctrlKey ? ownCells(rows[rows.length - 1]) : cells;\n return focus(scope[scope.length - 1]);\n }\n\n if (event.key === \"Backspace\" || event.key === \"Delete\") {\n if (locked) return;\n event.preventDefault();\n actions.removeNode(nodeId);\n // Focus the row that takes this one's place, so removing several\n // does not throw focus to the body.\n requestAnimationFrame(() => {\n const remaining = Array.from(\n bodyRef.current?.querySelectorAll<HTMLElement>(ROW_SELECTOR) ?? [],\n );\n const target = remaining[Math.min(rowIndex, remaining.length - 1)];\n if (target) ownCells(target)[0]?.focus();\n });\n }\n };\n\n /* --------------------------------- drag --------------------------------- */\n\n /** Pointer drag, not HTML5 drag and drop: its drag image is a\n * browser-owned snapshot no copy badge can be drawn on, and a nested\n * drop would mean hit-testing on every `dragover`. */\n const dragProps = useFilterRowDrag({\n // THE PANEL, reached through the body, because the top level's append\n // zone is in the FOOTER and the footer is the body's sibling.\n root: () => bodyRef.current?.parentElement ?? null,\n disabled: locked,\n onDrop: (nodeId, drop) => {\n if (drop.copy) actions.copyNodeTo(nodeId, drop.parentId, drop.index);\n else actions.moveNodeTo(nodeId, drop.parentId, drop.index);\n },\n });\n\n /* -------------------------------- render -------------------------------- */\n\n const panelProps = {\n // The panel's programmatic NAME. `group`, because the rows inside are\n // groups too, so the tree reads as a query rather than as a landmark.\n role: \"group\",\n \"aria-label\": actions.labels.advancedFilter,\n // WHAT IS IN IT, on entry, for a reader who did not press the trigger.\n // The read-only half rides along: `aria-readonly` is illegal here.\n \"aria-description\": actions.readOnly\n ? `${actions.labels.countAnnouncement(ruleCount)} ${actions.labels.readOnly}`\n : actions.labels.countAnnouncement(ruleCount),\n \"data-slot\": \"filters-advanced\",\n \"data-readonly\": actions.readOnly || undefined,\n // Capture, and on the PANEL, so portaled menus report too.\n onFocusCapture: () => {\n heldFocus.current = true;\n },\n onBlurCapture: (event: React.FocusEvent) => {\n if (event.relatedTarget) heldFocus.current = false;\n },\n } as const;\n\n /** The empty state, resolved once: the panel's own prop, else the root's.\n * Assembled here so a replacement gets the SAME two actions the footer\n * calls, focus handoff included. */\n const renderEmptyState = renderEmpty ?? panelRender.renderEmpty;\n const emptyState = renderEmptyState\n ? renderEmptyState({\n labels: actions.labels,\n readOnly: Boolean(actions.readOnly),\n mode,\n addFilter: addRow,\n addGroup,\n })\n : null;\n\n const body = (\n <>\n {/* VISIBLE, not an ARIA attribute: `aria-readonly` is illegal on every\n role here, and dimmed controls owe the reader a reason. */}\n {actions.readOnly ? (\n <p\n data-slot=\"filters-readonly\"\n className={cn(\"text-muted-foreground text-xs\", PANEL_GUTTER_CLASS)}\n >\n {actions.labels.readOnly}\n </p>\n ) : null}\n\n {query.rules.length > 0 ? (\n <div\n ref={bodyRef}\n data-slot=\"filters-advanced-body\"\n /* NO `overflow-x`: nothing here is ever wider than its box. */\n className={cn(\n TRACK_CONTAINER_CLASS,\n \"flex min-w-0 flex-col\",\n FILTER_ROW_GAP_CLASS,\n PANEL_GUTTER_CLASS,\n )}\n onKeyDown={onKeyDown}\n >\n <FilterReorderProvider value={reorderable}>\n <FilterDragContext.Provider value={reorderable ? dragProps : null}>\n <FilterIssueContext.Provider value={visibleIssueMap}>\n {query.rules.map((node, index) => (\n <FilterAdvancedNode<V, O>\n key={node.id}\n node={node}\n position={{\n index,\n parentId: query.id,\n combinator: query.combinator,\n depth: 1,\n }}\n />\n ))}\n </FilterIssueContext.Provider>\n </FilterDragContext.Provider>\n </FilterReorderProvider>\n </div>\n ) : /*\n THE EMPTY STATE, a real state and not a missing one: with no rules\n the body renders nothing, so the panel used to open as a footer\n floating in a blank popover. The HINT is withheld when the bar is\n locked, since it points at two disabled buttons.\n */\n // The CALLBACK's presence decides, not its result: a consumer returning\n // null wants a blank panel, and `??` would hand them the default back.\n renderEmptyState ? (\n emptyState\n ) : (\n <div\n data-slot=\"filters-advanced-empty\"\n className={cn(\n \"flex flex-col items-center justify-center gap-1 py-8 text-center\",\n PANEL_GUTTER_CLASS,\n )}\n >\n <span\n aria-hidden=\"true\"\n /* `rounded-full` is the one radius literal safe in every\n style, square or round. */\n className=\"mb-1 flex size-9 items-center justify-center rounded-full bg-muted text-muted-foreground [&_svg]:size-4\"\n >\n <ListFilterIcon />\n </span>\n <p className=\"font-medium text-sm\">{actions.labels.builderEmpty}</p>\n {actions.readOnly ? null : (\n <p className=\"text-muted-foreground text-xs\">{actions.labels.builderEmptyHint}</p>\n )}\n </div>\n )}\n\n {/* `shrink-0` on all three: a button clips its label rather than\n reflowing it, so Clear all read as \"ear all filters\". */}\n <div\n data-slot=\"filters-advanced-footer\"\n /* THE APPEND TARGET FOR THE TOP LEVEL, which every group's footer had\n and the root did not: at depth the strip under the last row is a 48px\n \"put it here\", while at the root it was 47px of `no-drop`. */\n data-drop-parent={query.id}\n data-drop-index={query.rules.length}\n className={cn(\n \"relative flex flex-wrap items-center gap-2\",\n PANEL_GUTTER_CLASS,\n /* FOUR PIXELS MORE than the gutter, which is what a row's action\n band spends after its kebab. */\n \"pe-[calc(var(--filter-panel-pad)+4px)]\",\n FOOTER_DROP_CLASS,\n /* The strip's BOX reaches the body's bottom edge and pads its\n content back down, so the append zone TILES with the last row.\n `pt-5` and not `pt-2`: the row above already grows 4px into this\n strip, so at `pt-2` the toolbar read as the last filter's tail. */\n query.rules.length > 0 && cn(FILTER_ROW_GAP_CANCEL_CLASS, \"pt-5\"),\n )}\n >\n <Button\n /* The last resort of `restoreFocus`: the only control that exists\n at every query. */\n ref={addRowRef}\n /* OUTLINE, and the only pair in the panel with a box: they are\n what the footer is FOR. */\n variant=\"outline\"\n size={sizes.button}\n className=\"shrink-0 font-normal\"\n disabled={actions.disabled}\n {...filterReadOnlyProps(actions)}\n onClick={addRow}\n >\n <PlusIcon />\n {actions.labels.addCondition}\n </Button>\n\n <Button\n variant=\"outline\"\n size={sizes.button}\n className=\"shrink-0 font-normal\"\n disabled={actions.disabled}\n {...filterReadOnlyProps(actions)}\n onClick={addGroup}\n >\n <FolderPlusIcon />\n {actions.labels.addConditionGroup}\n </Button>\n\n {/* NO PANEL-LEVEL SUMMARY: a validator's no belongs on the cell. */}\n {ruleCount > 0 ? (\n <Button\n variant=\"ghost\"\n size={sizes.button}\n className=\"ms-auto shrink-0 text-muted-foreground hover:text-foreground\"\n disabled={actions.disabled}\n {...filterReadOnlyProps(actions)}\n onClick={() => actions.clearQuery()}\n >\n {actions.labels.clearAll}\n </Button>\n ) : null}\n </div>\n\n {/* The `key` is what makes a REPEATED sentence audible: `aria-live`\n fires on a mutation and React writes nothing when the string is\n unchanged, so three presses mutated the region once. */}\n <div aria-live=\"polite\" role=\"status\" className=\"sr-only\">\n <span key={announcementSeq}>{announcement}</span>\n </div>\n </>\n );\n\n return (\n <div\n {...panelProps}\n /* An inline style because it is a VALUE: one declaration to beat\n rather than three classes in three places. */\n style={\n {\n [PANEL_PAD_VAR]: mode === \"inline\" ? PANEL_PAD_INLINE : PANEL_PAD_POPOVER,\n } as React.CSSProperties\n }\n className={cn(PANEL_CLASS, className)}\n >\n {body}\n </div>\n );\n}\n\n/* -------------------------------------------------------------------------- */\n/* Root */\n/* -------------------------------------------------------------------------- */\n\nexport interface FiltersAdvancedProps {\n /** Where the builder lives. `\"popover\"` hangs it off a trigger; `\"inline\"`\n * renders the same panel with no popup, for a sidebar or a settings page. */\n mode?: \"popover\" | \"inline\";\n /** Replaces the default trigger. Ignored inline. */\n trigger?: React.ReactNode;\n /** Whether rows can be reordered. See `FiltersProps.reorderable`. */\n reorderable?: boolean;\n /** Popover placement. */\n align?: \"start\" | \"center\" | \"end\";\n className?: string;\n}\n\nexport function FiltersAdvanced<V, O>({\n mode = \"popover\",\n trigger,\n reorderable = false,\n align = \"start\",\n className,\n}: FiltersAdvancedProps) {\n const actions = useFilterActions<V, O>();\n const sizes = filterControlSizes(actions);\n const { ruleCount } = useFilterState<V>();\n const [open, setOpen] = React.useState(false);\n\n if (mode === \"inline\") {\n return (\n <FiltersAdvancedPanel<V, O> mode=\"inline\" reorderable={reorderable} className={className} />\n );\n }\n\n return (\n <Popover open={open} onOpenChange={setOpen}>\n {/* `actions.disabled` alone, and READ ONLY DELIBERATELY DOES NOT\n GATE IT: opening this panel is reading, not writing. */}\n <PopoverTrigger\n /* On the TRIGGER rather than the button below it, so a consumer's own\n trigger wears the same state. Still `actions.disabled` alone. */\n disabled={actions.disabled}\n render={\n trigger ? (\n (trigger as React.ReactElement)\n ) : (\n <Button\n variant=\"outline\"\n size={sizes.button}\n /* THE COUNT IN THE NAME, not only in the box: a consumer who\n replaces `trigger` never had the badge, which is hidden. */\n aria-label={\n ruleCount > 0\n ? `${actions.labels.advancedFilter}, ${actions.labels.countAnnouncement(ruleCount)}`\n : undefined\n }\n >\n <ListFilterIcon />\n {actions.labels.advancedFilter}\n {ruleCount > 0 ? (\n <span\n aria-hidden=\"true\"\n className=\"rounded-sm bg-muted px-1.5 text-muted-foreground text-xs tabular-nums\"\n >\n {ruleCount}\n </span>\n ) : null}\n </Button>\n )\n }\n />\n {/* Wide enough for a nested group to keep real words at depth three;\n the rows truncate rather than wrap. */}\n <PopoverContent\n align={align}\n /* THE POPUP'S OWN NAME: it is a `role=\"dialog\"`, and the panel's is\n one level in, on its `role=\"group\"`. */\n aria-label={actions.labels.advancedFilter}\n className={cn(\"w-[42rem] max-w-[95vw] p-0\", className)}\n >\n {/* `mode` defaults to \"popover\", which keeps the panel's padding. */}\n <FiltersAdvancedPanel<V, O> reorderable={reorderable} />\n </PopoverContent>\n </Popover>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAqFA,MAAM,kBAAkB;CAAC;CAAc;CAAS;CAAY;AAAO;AAEnE,MAAM,iBAAiB;CAAC;CAA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,UAAU,QAAQ;GAClB,QACE,UACG,UAED,qBAAC,QAAD;IACE,SAAQ;IACR,MAAM,MAAM;IAGZ,cACE,YAAY,IACR,GAAG,QAAQ,OAAO,eAAe,IAAI,QAAQ,OAAO,kBAAkB,SAAS,MAC/E,KAAA;IARR,UAAA;KAWE,oBAAC,gBAAD,CAAiB,CAAA;KAChB,QAAQ,OAAO;KACf,YAAY,IACX,oBAAC,QAAD;MACE,eAAY;MACZ,WAAU;MAET,UAAA;KACG,CAAA,IACJ;IACE;;EAGb,CAAA,GAGD,oBAAC,gBAAD;GACS;GAGP,cAAY,QAAQ,OAAO;GAC3B,WAAW,GAAG,8BAA8B,SAAS;GAGrD,UAAA,oBAAC,sBAAD,EAAyC,YAAc,CAAA;EACzC,CAAA,CACT;;AAEb"}
1
+ {"version":3,"file":"filters-advanced.js","names":["React"],"sources":["../../../../src/components/reui/filters/filters-advanced.tsx"],"sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\nimport {\n ChevronDownIcon,\n CircleAlertIcon,\n CopyIcon,\n EllipsisVerticalIcon,\n FolderPlusIcon,\n GripVerticalIcon,\n ListFilterIcon,\n PlusIcon,\n RefreshCwIcon,\n Trash2Icon,\n UngroupIcon,\n XIcon,\n} from \"lucide-react\";\n\nimport { cn } from \"@kumix/utils\";\nimport { Button } from \"../../ui/button\";\nimport {\n DropdownMenu,\n DropdownMenuContent,\n DropdownMenuItem,\n DropdownMenuSeparator,\n DropdownMenuTrigger,\n} from \"../../ui/dropdown-menu\";\nimport { Input } from \"../../ui/input\";\nimport { Popover, PopoverContent, PopoverTrigger } from \"../../ui/popover\";\nimport { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from \"../../ui/tooltip\";\nimport { FilterFieldPicker } from \"./filters-builder\";\nimport {\n FilterMoveToMenuItems,\n FilterOperatorPopover,\n FilterRuleMenuItems,\n FilterValuePopover,\n useFilterRuleDisplay,\n} from \"./filters-chip\";\nimport {\n type FilterActionsContextValue,\n FilterReorderProvider,\n filterControlSizes,\n filterReadOnlyProps,\n isFilterLocked,\n useFilterActions,\n useFilterChipAutoOpen,\n useFilterChipFocused,\n useFilterFocusEmpty,\n useFilterFocusStore,\n useFilterRender,\n useFilterReorderable,\n useFilterRowPending,\n useFilterRowStateStore,\n useFilterSegmentFocus,\n useFilterState,\n} from \"./filters-context\";\nimport { FILTER_ROW_SELECTOR, useFilterRowDrag } from \"./filters-dnd\";\nimport { filterIssueLabel } from \"./filters-i18n\";\nimport {\n FILTER_FIELD_PICKER_CLASS,\n FILTER_MENU_CLASS,\n FILTER_MENU_LABEL_CLASS,\n filterCombinatorSlot,\n getFilterField,\n isFilterFieldPickable,\n joinFilterPath,\n} from \"./filters-lib\";\nimport { getFilterArity, getFilterOperator, operatorTakesValue } from \"./filters-operators\";\nimport { collectFilterIssues, createFilterRule, isFilterRule } from \"./filters-query\";\nimport type {\n FilterCombinator,\n FilterEmptyStateContext,\n FilterField,\n FilterGroupNode,\n FilterIssue,\n FilterNode,\n FilterOperator,\n FilterQuery,\n FilterRule,\n} from \"./filters-types\";\n\n/* -------------------------------------------------------------------------- */\n/* Columns */\n/* -------------------------------------------------------------------------- */\n\nconst CONTENT_COLUMNS = [\"combinator\", \"field\", \"operator\", \"value\"] as const;\n\nconst ACTION_COLUMNS = [\"drag\", \"menu\", \"add\", \"remove\"] as const;\n\n/** Every column a row may draw, in two bands. Navigation is by COLUMN NAME and\n * never position: the BANDS keep ArrowDown off a group's footer button. */\ntype FilterColumn = (typeof CONTENT_COLUMNS)[number] | (typeof ACTION_COLUMNS)[number];\n\n/** The nearest column in `band` that `available` has; backward wins a tie. */\nfunction nearestColumn(\n band: readonly FilterColumn[],\n from: FilterColumn,\n available: Map<string | null, HTMLElement>,\n): HTMLElement | undefined {\n const at = band.indexOf(from);\n if (at === -1) return undefined;\n for (let step = 0; step < band.length; step++) {\n const before = step === 0 ? undefined : available.get(band[at - step] ?? \"\");\n if (before) return before;\n const after = available.get(band[at + step] ?? \"\");\n if (after) return after;\n }\n return undefined;\n}\n\n/** Marks a focusable cell control, read by the keyboard walker. Not\n * `data-slot`: a cell control is handed to a Base UI trigger through `render`,\n * which stamps its own, so a slot here would be two owners on one attribute. */\nconst CELL_ATTRIBUTE = \"data-filter-cell\";\n\n/** Marks a cell the user TYPES into: the builder claims the arrows, Home, End\n * and Delete, and each means something else in a text box. */\nconst CELL_INPUT_ATTRIBUTE = \"data-filter-cell-input\";\n\nconst ROW_SELECTOR = FILTER_ROW_SELECTOR;\n\n/** Hands every row's handle its pointer wiring: only the panel, which owns the\n * body element, can measure a drop. */\n\nconst FilterDragContext = React.createContext<ReturnType<typeof useFilterRowDrag> | null>(null);\n\n/** What each node is missing, by id. An empty map by default, so a row mounted\n * outside the shipped panel gets \"nothing is wrong\" instead of a throw. */\nconst FilterIssueContext = React.createContext<ReadonlyMap<string, FilterIssue>>(new Map());\n\nfunction cellProps(column: FilterColumn, active: FilterColumn | null) {\n return {\n \"data-filter-cell\": column,\n // ONE tab stop for the whole builder; the arrows move within it.\n tabIndex: active === column ? 0 : -1,\n };\n}\n\n/** What an INVALID cell wears: `aria-invalid` to announce it, `data-invalid`\n * to style it, `aria-description` for the sentence. */\nfunction issueProps(\n issue: FilterIssue | undefined,\n column: FilterIssue[\"column\"],\n message: string,\n) {\n if (!issue || issue.column !== column) return null;\n return {\n \"aria-invalid\": true,\n \"data-invalid\": \"\",\n \"aria-description\": message,\n // NO `title`: the hint icon carries the sentence in a real tooltip, and a\n // native one would clobber the truncation `title` beside it.\n } as const;\n}\n\n/** Sera's uppercase and wide tracking cost about a third of a cell, so where\n * every other style drew \"migration\" sera drew \"MIGRATI...\". */\nconst SERA_TEXT_CLASS = \"\";\n\nconst CELL_CLASS = cn(\n \"w-full min-w-0 justify-between gap-1.5 font-normal\",\n // `>svg` is the caret and only the caret: a field's own type icon sits in a\n // nested span, where it keeps full strength because it is content.\n \"[&>svg]:text-muted-foreground\",\n // WHAT A CELL GIVES UP FIRST: padding, icon and caret cost about 44px before\n // a character is drawn, and the name is what nothing else can reconstruct.\n // Container queries and not a viewport breakpoint: the question is how wide\n // THIS cell is, and one panel holds a 300px cell and a 40px one.\n \"@max-[7rem]/cell:gap-0 @max-[7rem]/cell:[&>svg]:hidden\",\n \"@max-[5rem]/cell:[&_span>svg]:hidden\",\n SERA_TEXT_CLASS,\n);\n\n/** What an invalid cell looks like. A ring, not a border: a border changes the\n * box, so a cell turning invalid would nudge every cell beside it. */\nconst CELL_INVALID_CLASS = \"data-invalid:ring-destructive/40 data-invalid:ring-1\";\n\n/** Width of the leading combinator column. The 58.72px pill put this track at\n * 4rem and it does not shrink now the pill has: it is sized for the longest of\n * the three things in it, \"Where\", 51.44px in every style. */\nconst COMBINATOR_CLASS = cn(\n \"w-16 shrink-0 items-center justify-center\",\n // 6px of its own on TOP of the band's `gap-1.5`: this column is the\n // sentence's connective, not a fourth control butted against the attribute.\n \"me-1.5\",\n);\n\n/** The two static words in that column, CENTRED because the pill's own\n * `justify-center` centres its word. `w-full`, or `truncate` has no box. */\nconst COMBINATOR_TEXT_CLASS = cn(\n \"w-full truncate px-1 text-center text-muted-foreground text-sm\",\n SERA_TEXT_CLASS,\n);\n\n/** A row is TWO BANDS. The trailing pair of every row at every depth shares one\n * vertical axis - 0.00px of spread from 1104px to 240px, eight styles, depth\n * three - and only because the content band may shrink to nothing. */\nconst ROW_BAND_CLASS = \"flex min-w-0 items-center gap-1.5\";\n\nconst CONTENT_BAND_CLASS = \"flex min-w-0 flex-1 items-center gap-1.5\";\n\n/** FLEX and not a block: a `Button` is `inline-flex`, so a block wrapper builds\n * a line box as tall as its font's strut - 28px buttons in 28.141px wrappers. */\nconst CELL_BOX_CLASS = \"@container/cell flex min-w-0 shrink grow-0\";\n\n/** THE DEFAULT WIDTH OF EACH CONTENT CELL. An INLINE FALLBACK and not a\n * declaration on the panel: declared, the panel would beat anything an ANCESTOR\n * set, which is where a consumer sets it in popover mode. So all four work:\n *\n * <Filters variant=\"advanced\" className=\"[--filter-field-width:14rem]\" />\n * <FiltersAdvancedPanel className=\"[--filter-operator-width:7rem]\" />\n * <Card className=\"[--filter-value-width:16rem]\"><Filters … /></Card>\n * [data-slot=\"filters-advanced\"] { --filter-field-width: 14rem } */\nconst FIELD_CELL_CLASS = \"basis-[var(--filter-field-width,11rem)]\";\nconst OPERATOR_CELL_CLASS = \"basis-[var(--filter-operator-width,9rem)]\";\nconst VALUE_CELL_CLASS = \"basis-[var(--filter-value-width,12rem)]\";\n\n/** The trailing band. `pe-1` is on the BAND and not the gutter, since a group\n * card is `pe-0`; the footer and `DROP_SLOT_INDICATOR` restate the same four. */\nconst ACTION_BAND_CLASS = cn(\"flex shrink-0 items-center gap-0.5 pe-1 text-muted-foreground\");\n\n/** What the grip and the kebab wear while open. TWO ATTRIBUTES, because Radix\n * sets `data-state=\"open\"` and Base UI `data-popup-open`, so one selector alone\n * would be dead in one twin, silently, in a byte-locked file. */\nconst ACTION_CONTROL_CLASS = cn(\n \"hover:inset-ring hover:inset-ring-border\",\n // Base UI.\n \"data-popup-open:inset-ring data-popup-open:inset-ring-border\",\n // Radix.\n \"data-[state=open]:inset-ring data-[state=open]:inset-ring-border\",\n);\n\n/** The gap between sibling rows, one third of one measurement:\n * `FILTER_ROW_SEAM_PX` is HALF of it and the footer's `-mt-*` cancels it. */\nconst FILTER_ROW_GAP_CLASS = \"gap-3\";\nconst FILTER_ROW_GAP_CANCEL_CLASS = \"-mt-3\";\nconst FILTER_ROW_HALF_GAP_CLASS = {\n // The slot names the BOUNDARY between two rows, which is the middle of the\n // gap: 6px of it less HALF the rule's own 2px, so its CENTRE lands there.\n before: \"data-[drop-edge=before]:after:mb-[5px]\",\n after: \"data-[drop-edge=after]:after:mt-[5px]\",\n} as const;\n\n/** POPOVER: the popover content is `p-0`, so this IS the popup's own inner\n * padding. INLINE there is no popup, and a panel that pads itself as well is a\n * second inset the page did not ask for. */\nconst PANEL_PAD_VAR = \"--filter-panel-pad\";\nconst PANEL_PAD_POPOVER = \"0.75rem\";\nconst PANEL_PAD_INLINE = \"0px\";\n\n/** The panel's ONE horizontal rhythm: a row's trailing controls sit at the\n * content edge, which IS this padding, so a footer that disagrees breaks it. */\nconst PANEL_GUTTER_CLASS = \"px-(--filter-panel-pad)\";\n\nconst PANEL_CLASS = \"flex w-full min-w-0 flex-col gap-2 py-(--filter-panel-pad)\";\n\n/** A RING and not a border, the whole answer to the staggered trailing\n * controls: a border pushes the content edge inward a pixel per level. */\nconst GROUP_CARD_CLASS = cn(\n \"min-w-0 flex-1 rounded-md bg-muted/40\",\n \"inset-ring inset-ring-border\",\n \"ps-2 pe-0\",\n \"data-invalid:inset-ring-destructive/50\",\n // The DESTINATION of a drop into this group, told apart from the insertion\n // slot by STYLE and not size: dashed is not there yet, solid exists.\n \"data-drop-into:bg-muted/60\",\n \"data-drop-into:outline-1 data-drop-into:outline-solid\",\n \"data-drop-into:outline-border data-drop-into:-outline-offset-2\",\n);\n\n/** THE CONTAINER a row measures its own room against, on the panel body and on\n * every group's list, so a row asks how wide the list it is IN is. */\nconst TRACK_CONTAINER_CLASS = \"@container/track\";\n\n/** When a group stops putting its combinator BESIDE the card. A DEPTH budget\n * was wrong both ways: at 380px the depth-three row painted zero pixels of\n * field, operator and value and fanned the kebab column out by up to 119px.\n * 26rem is what a row MEASURES: 134px of fixed cost plus about 200px of cells. */\nconst GROUP_COMBINATOR_WRAP_CLASS = \"@max-[26rem]/track:w-full\";\n\n/** The combinator itself, once its wrapper has a whole line. Pinned to the\n * same 4rem the gutter track is, so it is the same control at every width. */\nconst GROUP_COMBINATOR_WRAPPED_CLASS = \"@max-[26rem]/track:w-16\";\n\n/** How a row shows where a dragged node would land. `data-drop-edge` is an\n * insertion BETWEEN rows, drawn here; `data-drop-into` is painted on the CARD,\n * so \"inside this group\" and \"after this group\" are not one picture. */\nconst DROP_SLOT_INDICATOR = cn(\n // The SOURCE in flight, faded rather than hidden. THREE FIFTHS is a contrast\n // measurement: at 35 under a `blur-[1px]` the text composited to #a9a9a9,\n // 2.35:1 on the light panel, under even the 3:1 line for a non-text mark.\n \"relative rounded-md\",\n \"data-dragging:opacity-60\",\n // THE INSERTION LINE lives in the gap rather than overlaying a real row.\n // `end-1` and not `end-0`: four pixels of `pe-1` are the kebab column.\n \"data-drop-edge:after:absolute\",\n \"data-drop-edge:after:start-0 data-drop-edge:after:end-1\",\n \"data-drop-edge:after:h-0.5 data-drop-edge:after:rounded-full\",\n \"data-drop-edge:after:bg-primary\",\n \"data-drop-edge:after:z-10\",\n \"data-[drop-edge=before]:after:bottom-full\",\n FILTER_ROW_HALF_GAP_CLASS.before,\n \"data-[drop-edge=after]:after:top-full\",\n FILTER_ROW_HALF_GAP_CLASS.after,\n);\n\n/** What a CONDITION row draws, which is what a group's row draws: the slot and\n * nothing else. It used to add a faint dashed outline of its own, a second\n * dashed rectangle a few pixels from the first saying what it already said. */\nconst DROP_INDICATOR = DROP_SLOT_INDICATOR;\n\n/** How the footer says \"append to the top level\": the same RULE the rows draw.\n * `data-drop-into` and not `data-drop-edge`, because an explicit zone is a\n * DESTINATION. Both ends restate the padding VARIABLE, since `inset` resolves\n * against the PADDING box and `inset-x-0` overran every rule above it. */\nconst FOOTER_DROP_CLASS = cn(\n \"data-drop-into:after:absolute\",\n \"data-drop-into:after:start-(--filter-panel-pad)\",\n \"data-drop-into:after:end-[calc(var(--filter-panel-pad)+4px)]\",\n \"data-drop-into:after:top-0 data-drop-into:after:h-0.5\",\n \"data-drop-into:after:rounded-full data-drop-into:after:bg-primary\",\n);\n\n/** The cells a row owns ITSELF: a group's row contains its children's rows, so\n * a bare `querySelectorAll` would let ArrowRight walk into the first of them. */\nfunction ownCells(row: HTMLElement): HTMLElement[] {\n return Array.from(row.querySelectorAll<HTMLElement>(`[${CELL_ATTRIBUTE}]`)).filter(\n (cell) => cell.closest<HTMLElement>(ROW_SELECTOR) === row,\n );\n}\n\n/* -------------------------------------------------------------------------- */\n/* Shared cells */\n/* -------------------------------------------------------------------------- */\n\ninterface RowPosition {\n index: number;\n parentId: string;\n combinator: FilterCombinator;\n depth: number;\n}\n\n/** The leading and/or slot: one group is joined by ONE operator, and mixing is\n * what a nested group is FOR. */\nfunction CombinatorCell({\n index,\n parentId,\n combinator,\n active,\n onFocus,\n className,\n}: {\n index: number;\n parentId: string;\n combinator: FilterCombinator;\n active: FilterColumn | null;\n onFocus: (column: FilterColumn) => () => void;\n className?: string;\n}) {\n const actions = useFilterActions();\n const sizes = filterControlSizes(actions);\n const slot = filterCombinatorSlot(index);\n const word = combinator === \"and\" ? actions.labels.and : actions.labels.or;\n\n if (slot === \"where\") {\n return <span className={cn(COMBINATOR_TEXT_CLASS, className)}>{actions.labels.where}</span>;\n }\n\n if (slot === \"echo\") {\n return <span className={cn(COMBINATOR_TEXT_CLASS, className)}>{word}</span>;\n }\n\n const name = actions.labels.combinatorLabel(word);\n\n return (\n <Button\n variant=\"outline\"\n size={sizes.button}\n /* The WORD is in the name: the track is fixed, so a locale whose\n word overflows draws \"a...\". */\n aria-label={name}\n title={name}\n disabled={actions.disabled}\n {...filterReadOnlyProps(actions)}\n className={cn(\n \"group/combinator relative w-full min-w-0 justify-center px-1.5 font-normal\",\n SERA_TEXT_CLASS,\n className,\n )}\n {...cellProps(\"combinator\", active)}\n onFocus={onFocus(\"combinator\")}\n onClick={() => actions.toggleCombinator(parentId)}\n >\n <span className=\"truncate\">{word}</span>\n {/* ABSOLUTELY POSITIONED, so the word still centres at 0.00px. */}\n <span\n aria-hidden=\"true\"\n className={cn(\n \"pointer-events-none absolute end-1 opacity-0 transition-opacity\",\n \"group-hover/combinator:opacity-60\",\n \"group-focus-visible/combinator:opacity-60\",\n \"[&_svg]:size-3\",\n )}\n >\n <RefreshCwIcon />\n </span>\n </Button>\n );\n}\n\n/** Whether dragging this node could change the tree at all; the grip is drawn\n * only when it could. Every destination outside the footer zone lives inside\n * some row and the drop layer discards any inside the dragged one, so the sole\n * child of the root is the one case with nowhere to go. A pure function of the\n * QUERY, deliberately blind to `disabled` and `readOnly`: a locked bar keeps\n * its grip, because \"you may not move this\" and \"there is nowhere to move it\"\n * are different sentences. */\nfunction canFilterNodeMove(query: FilterQuery<unknown>, position: { parentId: string }) {\n if (position.parentId !== query.id) return true;\n return query.rules.length > 1;\n}\n\n/** The error, as a QUIET mark the pointer can ask about: ONE per ROW, and\n * `aria-hidden`, since the cell carries it as `aria-description`. */\nfunction RowIssueHint({ message, className }: { message: string; className?: string }) {\n if (!message) return null;\n return (\n <TooltipProvider delay={200}>\n <Tooltip>\n <TooltipTrigger\n render={\n <span\n data-slot=\"filter-row-issue\"\n /* Focusable so a keyboard user can summon it, but OUT of the\n tab order: the sentence is already on the invalid cell. */\n tabIndex={-1}\n aria-hidden=\"true\"\n className={cn(\n \"flex shrink-0 items-center justify-center text-destructive [&_svg]:size-3.5\",\n className,\n )}\n >\n <CircleAlertIcon />\n </span>\n }\n />\n <TooltipContent side=\"top\">{message}</TooltipContent>\n </Tooltip>\n </TooltipProvider>\n );\n}\n\n/** The drag handle: what ARMS the gesture, since arming the row would turn\n * every text selection into a drag, and the only thing a screen reader can be\n * told about, which is why Alt+arrow hangs off it. */\nfunction RowHandle({\n nodeId,\n active,\n onFocus,\n}: {\n nodeId: string;\n active: FilterColumn | null;\n onFocus: (column: FilterColumn) => () => void;\n}) {\n const actions = useFilterActions();\n const sizes = filterControlSizes(actions);\n const dragProps = React.useContext(FilterDragContext);\n const locked = isFilterLocked(actions);\n\n return (\n <Button\n variant=\"ghost\"\n size={sizes.icon}\n aria-label={actions.labels.reorder}\n /* The activation is the DRAG, which no click performs, so without these\n a screen reader finds a \"Reorder\" button that appears broken. */\n aria-keyshortcuts=\"Alt+ArrowUp Alt+ArrowDown\"\n aria-description={actions.labels.reorderHint}\n disabled={actions.disabled}\n {...filterReadOnlyProps(actions)}\n /* `touch-none`, or a finger on the handle becomes a page scroll the\n gesture then fights. Muted at rest, never hidden. */\n className={cn(\n \"cursor-grab touch-none focus-visible:text-foreground\",\n \"active:cursor-grabbing\",\n ACTION_CONTROL_CLASS,\n )}\n {...cellProps(\"drag\", active)}\n onFocus={onFocus(\"drag\")}\n /* Not armed at all while locked; the engine refuses it again. */\n {...(locked ? null : dragProps?.(nodeId))}\n >\n <GripVerticalIcon />\n </Button>\n );\n}\n\n/** Which cell of a row owns the builder's single tab stop. An operator change\n * can take the value column out from under the focus pointing at it. */\nfunction useActiveColumn(\n nodeId: string,\n columns: FilterColumn[],\n isFirstRow: boolean,\n): FilterColumn | null {\n const focused = useFilterChipFocused(nodeId);\n const segment = useFilterSegmentFocus(nodeId);\n const noFocus = useFilterFocusEmpty();\n\n if (focused) {\n return segment && columns.includes(segment as FilterColumn)\n ? (segment as FilterColumn)\n : columns[0];\n }\n return noFocus && isFirstRow ? columns[0] : null;\n}\n\nfunction useFilterIssue(nodeId: string): FilterIssue | undefined {\n return React.useContext(FilterIssueContext).get(nodeId);\n}\n\n/* -------------------------------------------------------------------------- */\n/* Inline free text */\n/* -------------------------------------------------------------------------- */\n\n/** Whether a value is FREE TEXT, and therefore typed in the row itself. The\n * CHIP row keeps its popover for every value, deliberately, which is why this\n * lives here and not in the shared display hook. NUMBER is in: empty clears,\n * and anything unparseable snaps back to the last committed number. */\nfunction usesInlineTextEditor<V, O>(\n field: FilterField<V, O>,\n operator: FilterOperator | undefined,\n hasCustomDisplay: boolean,\n): boolean {\n if (field.editor) return false;\n if (field.options || field.loadOptions) return false;\n if (field.renderValue || field.valueText || hasCustomDisplay) return false;\n const type = field.type ?? \"text\";\n if (type !== \"text\" && type !== \"number\") return false;\n return getFilterArity(operator) === \"one\";\n}\n\n/** The value cell as a real text box. COMMIT IS BLUR AND ENTER: per keystroke\n * makes the ROOT the source of truth for every character, and debouncing only\n * adds a window where the cell and the query disagree with no event. */\nfunction FilterInlineValueCell<V, O>({\n rule,\n field,\n issue,\n issueText,\n active,\n onFocus,\n}: {\n rule: FilterRule<V>;\n field: FilterField<V, O>;\n issue: FilterIssue | undefined;\n issueText: string;\n active: FilterColumn | null;\n onFocus: (column: FilterColumn) => () => void;\n}) {\n const actions = useFilterActions<V, O>();\n const focusStore = useFilterFocusStore();\n const locked = isFilterLocked(actions);\n const numeric = (field.type ?? \"text\") === \"number\";\n // The handoff the value POPOVER honours, answered by taking the caret.\n const autoOpen = useFilterChipAutoOpen(rule.id) === \"value\";\n const inputRef = React.useRef<HTMLInputElement>(null);\n\n const committed = rule.value === undefined || rule.value === null ? \"\" : String(rule.value);\n const [draft, setDraft] = React.useState(committed);\n // STATE and not a ref: the sync below runs during render.\n const [seed, setSeed] = React.useState(committed);\n\n // Adjusting state during render; an effect would paint the stale text.\n if (seed !== committed) {\n setSeed(committed);\n setDraft(committed);\n }\n\n // CONSUMED as it is honoured: a flag left standing is spent by the next row.\n React.useEffect(() => {\n if (!autoOpen) return;\n if (!locked) {\n const input = inputRef.current;\n input?.focus();\n // SELECTED: the condition step may have coerced a value across.\n input?.select();\n }\n focusStore.set({ id: rule.id, segment: \"value\", autoOpen: false });\n }, [autoOpen, locked, focusStore, rule.id]);\n\n const commit = () => {\n if (draft === seed) return;\n\n if (numeric) {\n const text = draft.trim();\n // Empty clears rather than writing 0, which silently matches rows.\n if (text === \"\") {\n actions.updateRule(rule.id, { value: undefined as V });\n return;\n }\n const parsed = Number(text);\n // Revert, do not write: a NaN compares false against every row.\n if (!Number.isFinite(parsed)) {\n setDraft(seed);\n return;\n }\n actions.updateRule(rule.id, { value: parsed as V });\n return;\n }\n\n actions.updateRule(rule.id, { value: draft as V });\n };\n\n return (\n /* A FRAGMENT, not a wrapper: the positioning context for the error mark\n is the CELL itself, which already carries the column's basis. */\n <>\n <Input\n ref={inputRef}\n aria-label={field.label}\n placeholder={field.placeholder ?? actions.labels.valuePlaceholder}\n /* The RIGHT KEYPAD only: `type=\"number\"` brings spinners. */\n inputMode={numeric ? \"decimal\" : undefined}\n value={draft}\n /* `h-full` and no size class: `Input` has ONE height per style, so\n at `size=\"sm\"` it was a pixel taller in nova and two in sera. */\n className={cn(\"h-full\", issueText && \"pe-7\", CELL_INVALID_CLASS)}\n /* Native `readOnly`, not `disabled`: it keeps its tab stop. */\n readOnly={locked}\n disabled={actions.disabled}\n {...filterReadOnlyProps(actions)}\n {...cellProps(\"value\", active)}\n {...{ [CELL_INPUT_ATTRIBUTE]: \"\" }}\n {...issueProps(issue, \"value\", issueText)}\n onFocus={onFocus(\"value\")}\n onChange={(event) => setDraft(event.target.value)}\n onBlur={commit}\n onKeyDown={(event) => {\n if (event.key === \"Enter\" && !event.nativeEvent.isComposing) {\n event.preventDefault();\n commit();\n return;\n }\n if (event.key === \"Escape\") {\n /* Only when there is something to revert; Escape belongs to the\n surface the builder sits in. */\n if (draft === seed) return;\n event.preventDefault();\n event.stopPropagation();\n setDraft(seed);\n }\n }}\n />\n <RowIssueHint\n message={issueText}\n /* `pointer-events-none`, so a click still lands in the input. */\n className=\"pointer-events-none absolute end-2 top-1/2 -translate-y-1/2 *:pointer-events-auto\"\n />\n </>\n );\n}\n\n/* -------------------------------------------------------------------------- */\n/* Rule row */\n/* -------------------------------------------------------------------------- */\n\nexport interface FilterAdvancedRowProps<V = unknown> {\n rule: FilterRule<V>;\n position: RowPosition;\n}\n\nfunction FilterAdvancedRowImpl<V, O>({ rule, position }: FilterAdvancedRowProps<V>) {\n const actions = useFilterActions<V, O>();\n const render = useFilterRender<V, O>();\n const sizes = filterControlSizes(actions);\n const focusStore = useFilterFocusStore();\n const locked = isFilterLocked(actions);\n const { query } = useFilterState<V>();\n\n const field = getFilterField(actions.index, rule.path);\n const operators = field ? actions.resolveOperators(field) : [];\n const operator = getFilterOperator(operators, rule.operator);\n const takesValue = Boolean(rule.operator) && operatorTakesValue(operator);\n const inlineValue =\n takesValue && field\n ? usesInlineTextEditor(field, operator, Boolean(render.renderValue))\n : false;\n\n const issue = useFilterIssue(rule.id);\n const issueText = issue ? filterIssueLabel(issue, actions.labels) : \"\";\n\n const {\n pathText,\n pathLabel,\n pathCollapsed,\n operatorLabel,\n valueLabel,\n valueText,\n valueFullText,\n valueEmpty,\n } = useFilterRuleDisplay<V, O>(rule, field, operator);\n\n /* ------------------------------ field cell ------------------------------ */\n\n const fieldAutoOpen = useFilterChipAutoOpen(rule.id) === \"field\";\n const [pickerOpen, setPickerOpen] = React.useState(false);\n // Controlled so both can REFUSE to open while locked.\n const [menuOpen, setMenuOpen] = React.useState(false);\n // Seeded from the rule's own level, so amending opens beside its siblings.\n const [pickerPath, setPickerPath] = React.useState<string[]>(() => rule.path.slice(0, -1));\n const [pickerQuery, setPickerQuery] = React.useState(\"\");\n\n // A new row arrives with a GUESS at its field, so the one choice not yet the\n // user's own opens itself. CONSUMED as it is honoured: `pickerOpen` is a\n // dependency, so a flag left standing reopened the picker in the frame it\n // closed, a keyboard trap on the one row a user creates most.\n React.useEffect(() => {\n if (!fieldAutoOpen || pickerOpen) return;\n if (!locked) setPickerOpen(true);\n focusStore.set({ id: rule.id, segment: \"field\", autoOpen: false });\n }, [fieldAutoOpen, pickerOpen, locked, focusStore, rule.id]);\n\n // Re-seed on each open, so a browse that was abandoned last time does not\n // decide where this one starts.\n React.useEffect(() => {\n if (!pickerOpen) return;\n setPickerPath(rule.path.slice(0, -1));\n setPickerQuery(\"\");\n }, [pickerOpen, rule.path]);\n\n /* ------------------------------- tab stop ------------------------------- */\n\n const slot = filterCombinatorSlot(position.index);\n const reorderable = useFilterReorderable();\n const canMove = reorderable && canFilterNodeMove(query, position);\n const rowStateStore = useFilterRowStateStore();\n // Still waiting for its attribute, so neither later cell is drawn.\n const pending = useFilterRowPending(rule.id);\n\n const columns = React.useMemo(() => {\n const list: FilterColumn[] = [];\n if (slot === \"toggle\") list.push(\"combinator\");\n list.push(\"field\");\n if (!pending) {\n list.push(\"operator\");\n if (takesValue) list.push(\"value\");\n }\n // The grip is only a tab stop when it is drawn.\n if (canMove) list.push(\"drag\");\n list.push(\"menu\");\n return list;\n }, [slot, takesValue, canMove, pending]);\n\n const active = useActiveColumn(rule.id, columns, position.depth === 1 && position.index === 0);\n\n const onCellFocus = React.useCallback(\n (column: FilterColumn) => () =>\n focusStore.set({ id: rule.id, segment: column, autoOpen: false }),\n [focusStore, rule.id],\n );\n\n /* -------------------------------- render -------------------------------- */\n\n if (!field) return null;\n\n return (\n <div\n /* A GROUP, not a grid row: four depths of grid describes to no\n assistive technology at all. */\n role=\"group\"\n aria-label={actions.labels.rowLabel(`${pathText} ${operatorLabel}`, position.depth)}\n data-slot=\"filter-row\"\n data-node-id={rule.id}\n data-parent-id={position.parentId}\n data-index={position.index}\n data-depth={position.depth}\n className={cn(\"group/row\", ROW_BAND_CLASS, DROP_INDICATOR)}\n >\n <div className={cn(COMBINATOR_CLASS, CELL_BOX_CLASS)}>\n <CombinatorCell\n index={position.index}\n parentId={position.parentId}\n combinator={position.combinator}\n active={active}\n onFocus={onCellFocus}\n />\n </div>\n\n {/* THE CONTENT BAND: sized to itself, not to a share of the row. */}\n <div className={CONTENT_BAND_CLASS}>\n <div className={cn(CELL_BOX_CLASS, FIELD_CELL_CLASS)}>\n <Popover\n open={pickerOpen}\n onOpenChange={(next) => {\n if (next && locked) return;\n setPickerOpen(next);\n }}\n >\n <PopoverTrigger\n disabled={actions.disabled}\n {...filterReadOnlyProps(actions)}\n render={\n <Button\n variant=\"outline\"\n size={sizes.button}\n /* The path is truncated on screen, so the name carries all\n of it: \"Primary loca... > State\" identifies nothing. */\n aria-label={pathText}\n /* And as a `title` - unless the path is COLLAPSED, where the\n ellipsis inside already carries this exact sentence. */\n title={pathCollapsed ? undefined : pathText}\n className={CELL_CLASS}\n {...cellProps(\"field\", active)}\n onFocus={onCellFocus(\"field\")}\n >\n <span className=\"flex min-w-0 items-center gap-1.5 truncate\">\n {field.icon}\n <span className=\"truncate\">{pathLabel}</span>\n </span>\n <ChevronDownIcon />\n </Button>\n }\n />\n <PopoverContent\n align=\"start\"\n className={cn(FILTER_FIELD_PICKER_CLASS, actions.fieldPickerClassName)}\n >\n <FilterFieldPicker<V, O>\n path={pickerPath}\n onPathChange={setPickerPath}\n query={pickerQuery}\n onQueryChange={setPickerQuery}\n onSelect={(path, defaultOperator) => {\n setPickerOpen(false);\n // BUILDING versus AMENDING, the fork of the stepped\n // flow. Naming `operator` retires the field handoff.\n focusStore.set({\n id: rule.id,\n segment: pending ? \"operator\" : \"field\",\n autoOpen: pending,\n });\n // BEFORE the same-path early return, or a row minted\n // on a guessed field the user then picks stays pending.\n rowStateStore.resolvePending(rule.id);\n // Re-picking the field it has is a dismissal.\n if (joinFilterPath(path) === joinFilterPath(rule.path)) return;\n // On the create path the condition stays UNSET, so the\n // menu opening next has nothing selected.\n actions.updateRule(rule.id, {\n path,\n operator: pending ? \"\" : (defaultOperator ?? \"\"),\n value: undefined,\n });\n }}\n />\n </PopoverContent>\n </Popover>\n </div>\n\n {pending ? null : (\n <div className={cn(CELL_BOX_CLASS, OPERATOR_CELL_CLASS)}>\n <FilterOperatorPopover\n rule={rule}\n field={field}\n trigger={\n <Button\n variant=\"outline\"\n size={sizes.button}\n /* No `aria-label`: the label IS the name. */\n title={operatorLabel}\n className={cn(CELL_CLASS, CELL_INVALID_CLASS, \"text-muted-foreground\")}\n {...cellProps(\"operator\", active)}\n {...issueProps(issue, \"operator\", issueText)}\n onFocus={onCellFocus(\"operator\")}\n >\n <span className=\"truncate\">{operatorLabel}</span>\n <ChevronDownIcon />\n </Button>\n }\n />\n </div>\n )}\n\n {/* The cell stays even with no value: dropping it would shift the\n trailing buttons into the value column on that row alone. It goes\n ENTIRELY while the row is PENDING, the one case that argument does\n not cover: a row choosing its attribute has no column count yet. */}\n {pending ? null : (\n <div\n className={cn(\n CELL_BOX_CLASS,\n VALUE_CELL_CLASS,\n /* The positioning context for an inline editor's error mark. */\n \"relative\",\n /* What lets an inline box match the buttons beside it: as tall as\n the row, so `h-full` inside resolves to the button height. */\n \"self-stretch\",\n )}\n >\n {takesValue ? (\n inlineValue ? (\n <FilterInlineValueCell<V, O>\n rule={rule}\n field={field}\n issue={issue}\n issueText={issueText}\n active={active}\n onFocus={onCellFocus}\n />\n ) : (\n <FilterValuePopover\n rule={rule}\n field={field}\n operator={operator}\n trigger={\n <Button\n variant=\"outline\"\n size={sizes.button}\n /* The VALUE is the name, never the attribute.\n Locked, it grows to the whole list. */\n aria-label={locked ? valueFullText : valueText}\n title={valueFullText}\n className={cn(\n CELL_CLASS,\n CELL_INVALID_CLASS,\n \"h-full\",\n valueEmpty && \"text-muted-foreground\",\n )}\n {...cellProps(\"value\", active)}\n {...issueProps(issue, \"value\", issueText)}\n onFocus={onCellFocus(\"value\")}\n >\n {/* FREE OUTPUT: whatever the field draws. */}\n <span className=\"min-w-0 flex-1 truncate text-start\">{valueLabel}</span>\n {/* The error, INSIDE the control that failed. */}\n <RowIssueHint message={issueText} />\n </Button>\n }\n />\n )\n ) : null}\n </div>\n )}\n </div>\n\n {/* The WEIGHT is on the CLUSTER: a `ghost` button names no colour, so\n the kebab took the full `--foreground`. */}\n <div className={ACTION_BAND_CLASS}>\n {canMove ? <RowHandle nodeId={rule.id} active={active} onFocus={onCellFocus} /> : null}\n <DropdownMenu\n open={menuOpen}\n onOpenChange={(next) => {\n if (next && locked) return;\n setMenuOpen(next);\n }}\n >\n <DropdownMenuTrigger\n disabled={actions.disabled}\n {...filterReadOnlyProps(actions)}\n render={\n <Button\n variant=\"ghost\"\n size={sizes.icon}\n aria-label={actions.labels.chipMenu(field.label)}\n className={ACTION_CONTROL_CLASS}\n {...cellProps(\"menu\", active)}\n onFocus={onCellFocus(\"menu\")}\n />\n }\n >\n <EllipsisVerticalIcon />\n </DropdownMenuTrigger>\n <DropdownMenuContent align=\"end\" className={cn(FILTER_MENU_CLASS, actions.menuClassName)}>\n {/* Grouping is HERE, not on a chip: the keyboard path to\n `a AND (b OR c)`. */}\n <FilterRuleMenuItems ruleId={rule.id} allowGrouping />\n </DropdownMenuContent>\n </DropdownMenu>\n </div>\n </div>\n );\n}\n\n/** One rule, as a row, memoized: the query tree shares structure, so editing\n * one row of twenty re-renders one. */\nexport const FilterAdvancedRow = React.memo(FilterAdvancedRowImpl) as typeof FilterAdvancedRowImpl;\n\n/** A rule whose field the schema no longer has: dropping it would lose a saved\n * view's data, rendering nothing would leave it filtering invisibly. */\nfunction FilterUnknownRow<V>({ rule, position }: { rule: FilterRule<V>; position: RowPosition }) {\n const actions = useFilterActions();\n const sizes = filterControlSizes(actions);\n return (\n <div\n role=\"group\"\n aria-label={actions.labels.rowLabel(\n rule.path.join(actions.labels.pathSeparator),\n position.depth,\n )}\n data-slot=\"filter-row\"\n data-node-id={rule.id}\n data-parent-id={position.parentId}\n data-index={position.index}\n data-depth={position.depth}\n data-unknown=\"\"\n /* The DROP language too: the hit test pushes every row carrying\n `data-parent-id` into the surface, and this row carries one. */\n className={cn(ROW_BAND_CLASS, DROP_INDICATOR)}\n >\n <span className=\"min-w-0 flex-1 truncate text-muted-foreground text-sm\">\n {rule.path.join(actions.labels.pathSeparator)}\n </span>\n {/* The same trailing band, so the broken row lands on the kebab column. */}\n <div className={ACTION_BAND_CLASS}>\n <Button\n variant=\"ghost\"\n size={sizes.icon}\n aria-label={actions.labels.remove}\n className={ACTION_CONTROL_CLASS}\n /* Outside the roving scheme: a real tab stop keeps it removable. */\n data-filter-cell=\"remove\"\n /* It had no gate, so the one row whose purpose is to be removed\n could be removed from a read-only bar. */\n disabled={actions.disabled}\n {...filterReadOnlyProps(actions)}\n onClick={() => actions.removeNode(rule.id)}\n >\n <XIcon />\n </Button>\n </div>\n </div>\n );\n}\n\n/* -------------------------------------------------------------------------- */\n/* Group */\n/* -------------------------------------------------------------------------- */\n\n/** A nested group: an indented card, its conditions, and one way to add\n * another. The HEADLINE went; the pill outside already says \"or\". */\nfunction FilterAdvancedGroup<V, O>({\n group,\n position,\n}: {\n group: FilterGroupNode<V>;\n position: RowPosition;\n}) {\n const actions = useFilterActions<V, O>();\n const sizes = filterControlSizes(actions);\n const focusStore = useFilterFocusStore();\n\n const { query } = useFilterState<V>();\n\n const issue = useFilterIssue(group.id);\n const issueText = issue ? filterIssueLabel(issue, actions.labels) : \"\";\n\n const reorderable = useFilterReorderable();\n const canMove = reorderable && canFilterNodeMove(query, position);\n const rowStateStore = useFilterRowStateStore();\n\n const slot = filterCombinatorSlot(position.index);\n const columns = React.useMemo(() => {\n const list: FilterColumn[] = [];\n if (slot === \"toggle\") list.push(\"combinator\");\n // DOM order, which the arrow walker reads: a group's own controls are all\n // in its footer now, add first and the trailing pair after it.\n list.push(\"add\");\n if (canMove) list.push(\"drag\");\n list.push(\"menu\");\n return list;\n }, [slot, canMove]);\n\n const active = useActiveColumn(group.id, columns, position.depth === 1 && position.index === 0);\n\n const onCellFocus = React.useCallback(\n (column: FilterColumn) => () =>\n focusStore.set({ id: group.id, segment: column, autoOpen: false }),\n [focusStore, group.id],\n );\n\n const description =\n group.combinator === \"and\" ? actions.labels.groupAll : actions.labels.groupAny;\n\n const addInto = () => {\n const id = addFilterRow(actions, group.id);\n if (!id) return;\n rowStateStore.markPending(id);\n focusStore.set({ id, segment: \"field\", autoOpen: true });\n };\n\n return (\n <div\n role=\"group\"\n aria-label={actions.labels.groupLabel(description, position.depth)}\n data-slot=\"filter-row\"\n data-node-id={group.id}\n data-parent-id={position.parentId}\n data-index={position.index}\n data-depth={position.depth}\n /* `flex-wrap` is the whole of the narrow-panel fix. `items-center`\n measures the flex line, so the pill centres on the card. */\n className={cn(\"flex flex-wrap items-center gap-1.5\", DROP_SLOT_INDICATOR)}\n >\n <div className={cn(COMBINATOR_CLASS, CELL_BOX_CLASS, GROUP_COMBINATOR_WRAP_CLASS)}>\n <CombinatorCell\n index={position.index}\n parentId={position.parentId}\n combinator={position.combinator}\n active={active}\n onFocus={onCellFocus}\n className={GROUP_COMBINATOR_WRAPPED_CLASS}\n />\n </div>\n\n {/* The CARD lights up as the drop destination, not the header strip the\n engine measured. This `data-invalid` only styles; the announcement\n rides the footer's add button, which is the focusable control. */}\n <div\n data-slot=\"filter-group\"\n data-invalid={issue ? \"\" : undefined}\n className={GROUP_CARD_CLASS}\n >\n {/* Eight pixels, because it is a DROP TARGET and a zone beats a row. */}\n <div\n data-slot=\"filter-group-header\"\n className=\"flex h-2 items-center\"\n /* The TOP of the card means the top of the list: index 0 PREPENDS.\n It used to append, so the one place a pointer can aim to say \"into\n this group\" put the row at the far other end of it. */\n data-drop-parent={group.id}\n data-drop-index={0}\n />\n\n {/* A CONTAINER: the box every child row divides up. */}\n <div className={cn(TRACK_CONTAINER_CLASS, \"flex flex-col\", FILTER_ROW_GAP_CLASS)}>\n {group.rules.length === 0 ? (\n <p\n className={cn(\n /* 70% foreground, not the muted token: on the card's tint the\n muted foreground measured 4.35:1 in light, under 4.5:1 AA. */\n \"rounded-md border border-dashed px-2 py-3 text-foreground/70\",\n \"text-center text-xs\",\n \"data-drop-into:border-primary/60 data-drop-into:bg-primary/5\",\n \"data-drop-into:text-primary\",\n )}\n data-slot=\"filter-group-empty\"\n data-drop-parent={group.id}\n data-drop-index={0}\n >\n {actions.labels.groupPlaceholder}\n </p>\n ) : (\n group.rules.map((node, index) => (\n <FilterAdvancedNode<V, O>\n key={node.id}\n node={node}\n position={{\n index,\n parentId: group.id,\n combinator: group.combinator,\n depth: position.depth + 1,\n }}\n />\n ))\n )}\n </div>\n\n {/* `flex-nowrap`, or the group's kebab leaves the kebab column. */}\n <div\n data-slot=\"filter-group-footer\"\n className=\"flex flex-nowrap items-center gap-2 pt-2 pb-2 text-muted-foreground\"\n data-drop-parent={group.id}\n data-drop-index={group.rules.length}\n >\n <Button\n variant=\"outline\"\n size={sizes.button}\n aria-label={actions.labels.addToGroup}\n className={cn(\n /* `shrink` and not merely `min-w-0`: `shrink-0` is baked into\n the shadcn button's own base class. */\n \"min-w-0 shrink font-normal\",\n \"overflow-hidden\",\n CELL_INVALID_CLASS,\n )}\n disabled={actions.disabled}\n {...filterReadOnlyProps(actions)}\n {...cellProps(\"add\", active)}\n /* An EMPTY group is flagged on the control that fills it. */\n {...issueProps(issue, \"group\", issueText)}\n onFocus={onCellFocus(\"add\")}\n onClick={addInto}\n >\n <PlusIcon />\n {actions.labels.addCondition}\n </Button>\n\n <div className={cn(\"ms-auto\", ACTION_BAND_CLASS)}>\n {canMove ? <RowHandle nodeId={group.id} active={active} onFocus={onCellFocus} /> : null}\n <FilterGroupMenu group={group} active={active} onFocus={onCellFocus} />\n </div>\n </div>\n </div>\n </div>\n );\n}\n\n/** A group's kebab. A menu row affords six words, where two icons said none. */\nfunction FilterGroupMenu<V>({\n group,\n active,\n onFocus,\n}: {\n group: FilterGroupNode<V>;\n active: FilterColumn | null;\n onFocus: (column: FilterColumn) => () => void;\n}) {\n const actions = useFilterActions();\n const sizes = filterControlSizes(actions);\n const locked = isFilterLocked(actions);\n const [open, setOpen] = React.useState(false);\n\n return (\n <DropdownMenu\n open={open}\n onOpenChange={(next) => {\n if (next && locked) return;\n setOpen(next);\n }}\n >\n <DropdownMenuTrigger\n disabled={actions.disabled}\n {...filterReadOnlyProps(actions)}\n render={\n <Button\n variant=\"ghost\"\n size={sizes.icon}\n aria-label={actions.labels.groupMenu}\n className={ACTION_CONTROL_CLASS}\n {...cellProps(\"menu\", active)}\n onFocus={onFocus(\"menu\")}\n />\n }\n >\n <EllipsisVerticalIcon />\n </DropdownMenuTrigger>\n <DropdownMenuContent align=\"end\" className={cn(FILTER_MENU_CLASS, actions.menuClassName)}>\n <DropdownMenuItem disabled={locked} onClick={() => actions.duplicateNode(group.id)}>\n <CopyIcon aria-hidden=\"true\" />\n <span className={FILTER_MENU_LABEL_CLASS}>{actions.labels.duplicate}</span>\n </DropdownMenuItem>\n <DropdownMenuItem disabled={locked} onClick={() => actions.unwrapGroup(group.id)}>\n {/* The inverse of the row menu's layers glyph. */}\n <UngroupIcon aria-hidden=\"true\" />\n <span className={FILTER_MENU_LABEL_CLASS}>{actions.labels.ungroup}</span>\n </DropdownMenuItem>\n <FilterMoveToMenuItems nodeId={group.id} />\n <DropdownMenuSeparator />\n <DropdownMenuItem\n variant=\"destructive\"\n disabled={locked}\n onClick={() => actions.removeNode(group.id)}\n >\n {/* No colour: the destructive variant paints the row's svgs. */}\n <Trash2Icon aria-hidden=\"true\" />\n <span className={FILTER_MENU_LABEL_CLASS}>{actions.labels.removeGroup}</span>\n </DropdownMenuItem>\n </DropdownMenuContent>\n </DropdownMenu>\n );\n}\n\nfunction FilterAdvancedNode<V, O>({\n node,\n position,\n}: {\n node: FilterNode<V>;\n position: RowPosition;\n}) {\n const actions = useFilterActions<V, O>();\n\n if (!isFilterRule(node)) {\n return <FilterAdvancedGroup<V, O> group={node} position={position} />;\n }\n if (!getFilterField(actions.index, node.path)) {\n return <FilterUnknownRow<V> rule={node} position={position} />;\n }\n return <FilterAdvancedRow<V, O> rule={node} position={position} />;\n}\n\n/* -------------------------------------------------------------------------- */\n/* Adding */\n/* -------------------------------------------------------------------------- */\n\n/** Appends a condition on the first attribute anyone may filter on, at any\n * depth. `isFilterFieldPickable` is the picker's own rule. */\nfunction addFilterRow<V, O>(\n actions: FilterActionsContextValue<V, O>,\n parentId?: string,\n): string | null {\n // Before `nextId` and before `addRule`: while the store points at a row that\n // was never created, the whole panel drops out of the tab order.\n if (isFilterLocked(actions)) return null;\n\n const entry = actions.index.all.find((candidate) => isFilterFieldPickable(candidate.field));\n if (!entry) return null;\n\n const id = actions.nextId();\n actions.addRule(\n createFilterRule<V>({\n id,\n path: entry.path,\n // Deliberately empty: the row arrives PENDING, and a seeded default\n // would open the next menu with its own answer highlighted.\n operator: \"\",\n }),\n parentId,\n );\n return id;\n}\n\n/* -------------------------------------------------------------------------- */\n/* Panel */\n/* -------------------------------------------------------------------------- */\n\n/** The panel draws NO border, NO background and NO radius, and takes no\n * element to be drawn as: a surface is the page's decision. */\nexport interface FiltersAdvancedPanelProps {\n /** Which of the two boxes the panel sits in, the only thing deciding whether\n * it pads itself: a popover's content is `p-0`, so this padding IS its\n * inner padding, and `\"inline\"` is a page that owns its own. */\n mode?: \"popover\" | \"inline\";\n /** Replaces the empty state for this panel only. Wins over\n * `Filters.renderEmpty`, the precedence a field has over the root's. */\n renderEmpty?: (context: FilterEmptyStateContext) => React.ReactNode;\n /** Whether rows can be reordered. See `FiltersProps.reorderable`. */\n reorderable?: boolean;\n className?: string;\n}\n\n/** The builder itself: nested groups over the query tree the chips read. A\n * group is a parenthesised list joined by ONE operator, so nesting is a real\n * tree: a flat model cannot represent `a AND (b OR c)` without inventing\n * precedence, and invented precedence returns the wrong rows. */\nexport function FiltersAdvancedPanel<V, O>({\n mode = \"popover\",\n renderEmpty,\n reorderable = false,\n className,\n}: FiltersAdvancedPanelProps) {\n const actions = useFilterActions<V, O>();\n const panelRender = useFilterRender<V, O>();\n const sizes = filterControlSizes(actions);\n const { query, ruleCount, announcement, announcementSeq } = useFilterState<V>();\n const focusStore = useFilterFocusStore();\n const rowStateStore = useFilterRowStateStore();\n const bodyRef = React.useRef<HTMLDivElement>(null);\n const locked = isFilterLocked(actions);\n\n /* ------------------------------ validation ------------------------------ */\n\n /** What is unfinished, computed ONCE: an empty group is a fact about a\n * group, not about any row inside it. */\n const issues = React.useMemo(\n () =>\n collectFilterIssues(\n query,\n (rule) => {\n const field = getFilterField(actions.index, rule.path);\n if (!field) return null;\n return getFilterArity(getFilterOperator(actions.resolveOperators(field), rule.operator));\n },\n // The same normalisation the display callbacks get.\n (rule) => {\n const field = getFilterField(actions.index, rule.path);\n if (!field?.validate) return null;\n const operator = getFilterOperator(actions.resolveOperators(field), rule.operator);\n if (!operator) return null;\n return field.validate({\n value: rule.value,\n values:\n rule.value === undefined || rule.value === null\n ? []\n : Array.isArray(rule.value)\n ? (rule.value as unknown[])\n : [rule.value],\n field,\n operator,\n arity: getFilterArity(operator) ?? \"one\",\n rule,\n labels: actions.labels,\n });\n },\n ),\n [query, actions],\n );\n\n /** The issues a row may DRAW: the ones on a value committed once. */\n const visibleIssueMap = React.useMemo(() => {\n const visible = new Map<string, FilterIssue>();\n for (const issue of issues) {\n // CUSTOM ONLY. The built-in reasons describe a row as HALF BUILT,\n // so every Add filter produced a red row on the happy path.\n if (issue.reason !== \"custom\") continue;\n if (rowStateStore.has(issue.nodeId)) visible.set(issue.nodeId, issue);\n }\n return visible;\n }, [issues, rowStateStore]);\n\n /** Says out loud that a VISIBLE error has appeared, which would\n * otherwise happen in silence. The DRAWN issues, on a RISE only. */\n const announcedIssues = React.useRef({\n count: visibleIssueMap.size,\n seq: announcementSeq,\n });\n React.useEffect(() => {\n const before = announcedIssues.current;\n announcedIssues.current = {\n count: visibleIssueMap.size,\n seq: announcementSeq,\n };\n if (announcementSeq !== before.seq) return;\n if (visibleIssueMap.size <= before.count) return;\n actions.announce(actions.labels.issueSummary(visibleIssueMap.size));\n }, [visibleIssueMap, announcementSeq, actions]);\n\n /* ---------------------------- focus recovery ---------------------------- */\n\n /** Whether the panel, or a menu of its own, held focus a moment ago. A\n * blur WITH a `relatedTarget` is focus arriving somewhere real; a blur\n * with none, or none at all when the element is simply removed, is what\n * this exists to repair. */\n const heldFocus = React.useRef(false);\n const addRowRef = React.useRef<HTMLButtonElement>(null);\n\n /** Puts focus back after a mutation that destroyed the thing holding it:\n * measured at 50, 200, 600 and 1200ms after Convert to group, Remove,\n * Ungroup and Move to group, `document.activeElement` was the BODY,\n * because a menu restores focus to a trigger the action unmounted. */\n const restoreFocus = React.useCallback(() => {\n // A handoff is mid-air and owns focus: between one step being answered\n // and the next opening `document.activeElement` IS the body.\n if (focusStore.getSnapshot().autoOpen) return;\n if (!heldFocus.current) return;\n const active = document.activeElement;\n if (active && active !== document.body) return;\n const rows = Array.from(bodyRef.current?.querySelectorAll<HTMLElement>(ROW_SELECTOR) ?? []);\n const { id, segment } = focusStore.getSnapshot();\n const row = id ? rows.find((candidate) => candidate.dataset.nodeId === id) : undefined;\n const cells = row ? ownCells(row) : [];\n const target =\n cells.find((entry) => entry.getAttribute(CELL_ATTRIBUTE) === segment) ??\n cells[0] ??\n (rows[0] ? ownCells(rows[0])[0] : undefined) ??\n addRowRef.current ??\n undefined;\n target?.focus();\n }, [focusStore]);\n\n // In the passive effect, not a frame later: React removes the control in\n // the mutation phase, so a menu's restore then aims at a detached node.\n React.useEffect(() => {\n restoreFocus();\n }, [restoreFocus]);\n\n /* -------------------------------- adding -------------------------------- */\n\n const addRow = React.useCallback(() => {\n const id = addFilterRow(actions);\n if (!id) return;\n // PENDING until the attribute is chosen, the first of three questions.\n rowStateStore.markPending(id);\n focusStore.set({ id, segment: \"field\", autoOpen: true });\n }, [actions, focusStore, rowStateStore]);\n\n const addGroup = React.useCallback(() => {\n const id = actions.addGroup();\n // An empty id means it refused, and focusing a group never created\n // would strand the tab stop.\n if (!id) return;\n // Onto the group's own chrome, not into it: it arrives empty.\n focusStore.set({ id, segment: \"add\", autoOpen: false });\n }, [actions, focusStore]);\n\n /* ------------------------------- keyboard ------------------------------- */\n\n const onKeyDown = (event: React.KeyboardEvent<HTMLDivElement>) => {\n const cell = (event.target as HTMLElement).closest<HTMLElement>(`[${CELL_ATTRIBUTE}]`);\n // A key pressed inside an open popover belongs to that popover; its\n // content is portaled out, so this is belt and braces.\n //\n // ArrowDown never reaches here: Base UI stops it at the menu trigger.\n if (!cell || event.target !== cell) return;\n\n const body = bodyRef.current;\n const row = cell.closest<HTMLElement>(ROW_SELECTOR);\n if (!body || !row) return;\n\n /* A cell the user TYPES into keeps the keys that edit text; only the\n VERTICAL keys stay. */\n const editing = cell.hasAttribute(CELL_INPUT_ATTRIBUTE);\n\n // DOM order for the two places that mean \"the whole builder\".\n const rows = Array.from(body.querySelectorAll<HTMLElement>(ROW_SELECTOR));\n const cells = ownCells(row);\n const rowIndex = rows.indexOf(row);\n const cellIndex = cells.indexOf(cell);\n\n const rtl = getComputedStyle(cell).direction === \"rtl\";\n const forward = rtl ? \"ArrowLeft\" : \"ArrowRight\";\n const backward = rtl ? \"ArrowRight\" : \"ArrowLeft\";\n\n const focus = (target: HTMLElement | undefined) => {\n if (!target) return;\n event.preventDefault();\n target.focus();\n };\n\n const from = cell.getAttribute(CELL_ATTRIBUTE) as FilterColumn;\n const band = (CONTENT_COLUMNS as readonly FilterColumn[]).includes(from)\n ? CONTENT_COLUMNS\n : ACTION_COLUMNS;\n\n /* The rows that draw a cell in this BAND, in cell order: by ROW it went\n BACKWARDS at +212, -166, +122, -76, +38 pixels once a group's own\n controls moved to its footer. */\n const bandRows: HTMLElement[] = [];\n const seen = new Set<HTMLElement>();\n for (const entry of body.querySelectorAll<HTMLElement>(`[${CELL_ATTRIBUTE}]`)) {\n const column = entry.getAttribute(CELL_ATTRIBUTE) as FilterColumn;\n if (!(band as readonly FilterColumn[]).includes(column)) continue;\n const owner = entry.closest<HTMLElement>(ROW_SELECTOR);\n if (!owner || seen.has(owner)) continue;\n seen.add(owner);\n bandRows.push(owner);\n }\n const bandIndex = bandRows.indexOf(row);\n\n const focusRow = (step: number) => {\n const nextRow = bandRows[bandIndex + step];\n if (!nextRow) return;\n const cellsThere = ownCells(nextRow);\n const byColumn = new Map(\n cellsThere.map((entry) => [entry.getAttribute(CELL_ATTRIBUTE), entry]),\n );\n // The band, then anything at all, which keeps a consumer's cell\n // reachable.\n focus(nearestColumn(band, from, byColumn) ?? cellsThere[0]);\n };\n\n const nodeId = row.dataset.nodeId;\n if (!nodeId) return;\n\n // Alt reorders rather than navigates, within the owning group only:\n // changing depth with an arrow would make one gesture mean two things.\n if (event.altKey && (event.key === \"ArrowUp\" || event.key === \"ArrowDown\")) {\n // Plain arrows, Home and End are deliberately NOT gated.\n if (locked || !reorderable) return;\n event.preventDefault();\n actions.moveNode(nodeId, event.key === \"ArrowDown\" ? 1 : -1);\n return;\n }\n\n if (event.key === \"ArrowDown\") return focusRow(1);\n if (event.key === \"ArrowUp\") return focusRow(-1);\n if (editing) return;\n\n if (event.key === forward) return focus(cells[cellIndex + 1]);\n if (event.key === backward) return focus(cells[cellIndex - 1]);\n if (event.key === \"Home\") {\n return focus(event.ctrlKey ? ownCells(rows[0])[0] : cells[0]);\n }\n if (event.key === \"End\") {\n const scope = event.ctrlKey ? ownCells(rows[rows.length - 1]) : cells;\n return focus(scope[scope.length - 1]);\n }\n\n if (event.key === \"Backspace\" || event.key === \"Delete\") {\n if (locked) return;\n event.preventDefault();\n actions.removeNode(nodeId);\n // Focus the row that takes this one's place, so removing several\n // does not throw focus to the body.\n requestAnimationFrame(() => {\n const remaining = Array.from(\n bodyRef.current?.querySelectorAll<HTMLElement>(ROW_SELECTOR) ?? [],\n );\n const target = remaining[Math.min(rowIndex, remaining.length - 1)];\n if (target) ownCells(target)[0]?.focus();\n });\n }\n };\n\n /* --------------------------------- drag --------------------------------- */\n\n /** Pointer drag, not HTML5 drag and drop: its drag image is a\n * browser-owned snapshot no copy badge can be drawn on, and a nested\n * drop would mean hit-testing on every `dragover`. */\n const dragProps = useFilterRowDrag({\n // THE PANEL, reached through the body, because the top level's append\n // zone is in the FOOTER and the footer is the body's sibling.\n root: () => bodyRef.current?.parentElement ?? null,\n disabled: locked,\n onDrop: (nodeId, drop) => {\n if (drop.copy) actions.copyNodeTo(nodeId, drop.parentId, drop.index);\n else actions.moveNodeTo(nodeId, drop.parentId, drop.index);\n },\n });\n\n /* -------------------------------- render -------------------------------- */\n\n const panelProps = {\n // The panel's programmatic NAME. `group`, because the rows inside are\n // groups too, so the tree reads as a query rather than as a landmark.\n role: \"group\",\n \"aria-label\": actions.labels.advancedFilter,\n // WHAT IS IN IT, on entry, for a reader who did not press the trigger.\n // The read-only half rides along: `aria-readonly` is illegal here.\n \"aria-description\": actions.readOnly\n ? `${actions.labels.countAnnouncement(ruleCount)} ${actions.labels.readOnly}`\n : actions.labels.countAnnouncement(ruleCount),\n \"data-slot\": \"filters-advanced\",\n \"data-readonly\": actions.readOnly || undefined,\n // Capture, and on the PANEL, so portaled menus report too.\n onFocusCapture: () => {\n heldFocus.current = true;\n },\n onBlurCapture: (event: React.FocusEvent) => {\n if (event.relatedTarget) heldFocus.current = false;\n },\n } as const;\n\n /** The empty state, resolved once: the panel's own prop, else the root's.\n * Assembled here so a replacement gets the SAME two actions the footer\n * calls, focus handoff included. */\n const renderEmptyState = renderEmpty ?? panelRender.renderEmpty;\n const emptyState = renderEmptyState\n ? renderEmptyState({\n labels: actions.labels,\n readOnly: Boolean(actions.readOnly),\n mode,\n addFilter: addRow,\n addGroup,\n })\n : null;\n\n const body = (\n <>\n {/* VISIBLE, not an ARIA attribute: `aria-readonly` is illegal on every\n role here, and dimmed controls owe the reader a reason. */}\n {actions.readOnly ? (\n <p\n data-slot=\"filters-readonly\"\n className={cn(\"text-muted-foreground text-xs\", PANEL_GUTTER_CLASS)}\n >\n {actions.labels.readOnly}\n </p>\n ) : null}\n\n {query.rules.length > 0 ? (\n <div\n ref={bodyRef}\n data-slot=\"filters-advanced-body\"\n /* NO `overflow-x`: nothing here is ever wider than its box. */\n className={cn(\n TRACK_CONTAINER_CLASS,\n \"flex min-w-0 flex-col\",\n FILTER_ROW_GAP_CLASS,\n PANEL_GUTTER_CLASS,\n )}\n onKeyDown={onKeyDown}\n >\n <FilterReorderProvider value={reorderable}>\n <FilterDragContext.Provider value={reorderable ? dragProps : null}>\n <FilterIssueContext.Provider value={visibleIssueMap}>\n {query.rules.map((node, index) => (\n <FilterAdvancedNode<V, O>\n key={node.id}\n node={node}\n position={{\n index,\n parentId: query.id,\n combinator: query.combinator,\n depth: 1,\n }}\n />\n ))}\n </FilterIssueContext.Provider>\n </FilterDragContext.Provider>\n </FilterReorderProvider>\n </div>\n ) : /*\n THE EMPTY STATE, a real state and not a missing one: with no rules\n the body renders nothing, so the panel used to open as a footer\n floating in a blank popover. The HINT is withheld when the bar is\n locked, since it points at two disabled buttons.\n */\n // The CALLBACK's presence decides, not its result: a consumer returning\n // null wants a blank panel, and `??` would hand them the default back.\n renderEmptyState ? (\n emptyState\n ) : (\n <div\n data-slot=\"filters-advanced-empty\"\n className={cn(\n \"flex flex-col items-center justify-center gap-1 py-8 text-center\",\n PANEL_GUTTER_CLASS,\n )}\n >\n <span\n aria-hidden=\"true\"\n /* `rounded-full` is the one radius literal safe in every\n style, square or round. */\n className=\"mb-1 flex size-9 items-center justify-center rounded-full bg-muted text-muted-foreground [&_svg]:size-4\"\n >\n <ListFilterIcon />\n </span>\n <p className=\"font-medium text-sm\">{actions.labels.builderEmpty}</p>\n {actions.readOnly ? null : (\n <p className=\"text-muted-foreground text-xs\">{actions.labels.builderEmptyHint}</p>\n )}\n </div>\n )}\n\n {/* `shrink-0` on all three: a button clips its label rather than\n reflowing it, so Clear all read as \"ear all filters\". */}\n <div\n data-slot=\"filters-advanced-footer\"\n /* THE APPEND TARGET FOR THE TOP LEVEL, which every group's footer had\n and the root did not: at depth the strip under the last row is a 48px\n \"put it here\", while at the root it was 47px of `no-drop`. */\n data-drop-parent={query.id}\n data-drop-index={query.rules.length}\n className={cn(\n \"relative flex flex-wrap items-center gap-2\",\n PANEL_GUTTER_CLASS,\n /* FOUR PIXELS MORE than the gutter, which is what a row's action\n band spends after its kebab. */\n \"pe-[calc(var(--filter-panel-pad)+4px)]\",\n FOOTER_DROP_CLASS,\n /* The strip's BOX reaches the body's bottom edge and pads its\n content back down, so the append zone TILES with the last row.\n `pt-5` and not `pt-2`: the row above already grows 4px into this\n strip, so at `pt-2` the toolbar read as the last filter's tail. */\n query.rules.length > 0 && cn(FILTER_ROW_GAP_CANCEL_CLASS, \"pt-5\"),\n )}\n >\n <Button\n /* The last resort of `restoreFocus`: the only control that exists\n at every query. */\n ref={addRowRef}\n /* OUTLINE, and the only pair in the panel with a box: they are\n what the footer is FOR. */\n variant=\"outline\"\n size={sizes.button}\n className=\"shrink-0 font-normal\"\n disabled={actions.disabled}\n {...filterReadOnlyProps(actions)}\n onClick={addRow}\n >\n <PlusIcon />\n {actions.labels.addCondition}\n </Button>\n\n <Button\n variant=\"outline\"\n size={sizes.button}\n className=\"shrink-0 font-normal\"\n disabled={actions.disabled}\n {...filterReadOnlyProps(actions)}\n onClick={addGroup}\n >\n <FolderPlusIcon />\n {actions.labels.addConditionGroup}\n </Button>\n\n {/* NO PANEL-LEVEL SUMMARY: a validator's no belongs on the cell. */}\n {ruleCount > 0 ? (\n <Button\n variant=\"ghost\"\n size={sizes.button}\n className=\"ms-auto shrink-0 text-muted-foreground hover:text-foreground\"\n disabled={actions.disabled}\n {...filterReadOnlyProps(actions)}\n onClick={() => actions.clearQuery()}\n >\n {actions.labels.clearAll}\n </Button>\n ) : null}\n </div>\n\n {/* The `key` is what makes a REPEATED sentence audible: `aria-live`\n fires on a mutation and React writes nothing when the string is\n unchanged, so three presses mutated the region once. */}\n <div aria-live=\"polite\" role=\"status\" className=\"sr-only\">\n <span key={announcementSeq}>{announcement}</span>\n </div>\n </>\n );\n\n return (\n <div\n {...panelProps}\n /* An inline style because it is a VALUE: one declaration to beat\n rather than three classes in three places. */\n style={\n {\n [PANEL_PAD_VAR]: mode === \"inline\" ? PANEL_PAD_INLINE : PANEL_PAD_POPOVER,\n } as React.CSSProperties\n }\n className={cn(PANEL_CLASS, className)}\n >\n {body}\n </div>\n );\n}\n\n/* -------------------------------------------------------------------------- */\n/* Root */\n/* -------------------------------------------------------------------------- */\n\nexport interface FiltersAdvancedProps {\n /** Where the builder lives. `\"popover\"` hangs it off a trigger; `\"inline\"`\n * renders the same panel with no popup, for a sidebar or a settings page. */\n mode?: \"popover\" | \"inline\";\n /** Replaces the default trigger. Ignored inline. */\n trigger?: React.ReactNode;\n /** Whether rows can be reordered. See `FiltersProps.reorderable`. */\n reorderable?: boolean;\n /** Popover placement. */\n align?: \"start\" | \"center\" | \"end\";\n className?: string;\n}\n\nexport function FiltersAdvanced<V, O>({\n mode = \"popover\",\n trigger,\n reorderable = false,\n align = \"start\",\n className,\n}: FiltersAdvancedProps) {\n const actions = useFilterActions<V, O>();\n const sizes = filterControlSizes(actions);\n const { ruleCount } = useFilterState<V>();\n const [open, setOpen] = React.useState(false);\n\n if (mode === \"inline\") {\n return (\n <FiltersAdvancedPanel<V, O> mode=\"inline\" reorderable={reorderable} className={className} />\n );\n }\n\n return (\n <Popover open={open} onOpenChange={setOpen}>\n {/* `actions.disabled` alone, and READ ONLY DELIBERATELY DOES NOT\n GATE IT: opening this panel is reading, not writing. */}\n <PopoverTrigger\n /* On the TRIGGER rather than the button below it, so a consumer's own\n trigger wears the same state. Still `actions.disabled` alone. */\n disabled={actions.disabled}\n render={\n trigger ? (\n (trigger as React.ReactElement)\n ) : (\n <Button\n variant=\"outline\"\n size={sizes.button}\n /* THE COUNT IN THE NAME, not only in the box: a consumer who\n replaces `trigger` never had the badge, which is hidden. */\n aria-label={\n ruleCount > 0\n ? `${actions.labels.advancedFilter}, ${actions.labels.countAnnouncement(ruleCount)}`\n : undefined\n }\n >\n <ListFilterIcon />\n {actions.labels.advancedFilter}\n {ruleCount > 0 ? (\n <span\n aria-hidden=\"true\"\n className=\"rounded-sm bg-muted px-1.5 text-muted-foreground text-xs tabular-nums\"\n >\n {ruleCount}\n </span>\n ) : null}\n </Button>\n )\n }\n />\n {/* Wide enough for a nested group to keep real words at depth three;\n the rows truncate rather than wrap. */}\n <PopoverContent\n align={align}\n /* THE POPUP'S OWN NAME: it is a `role=\"dialog\"`, and the panel's is\n one level in, on its `role=\"group\"`. */\n aria-label={actions.labels.advancedFilter}\n className={cn(\"w-[42rem] max-w-[95vw] p-0\", className)}\n >\n {/* `mode` defaults to \"popover\", which keeps the panel's padding. */}\n <FiltersAdvancedPanel<V, O> reorderable={reorderable} />\n </PopoverContent>\n </Popover>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAqFA,MAAM,kBAAkB;CAAC;CAAc;CAAS;CAAY;AAAO;AAEnE,MAAM,iBAAiB;CAAC;CAAQ;CAAQ;CAAO;AAAQ;;AAOvD,SAAS,cACP,MACA,MACA,WACyB;CACzB,MAAM,KAAK,KAAK,QAAQ,IAAI;CAC5B,IAAI,OAAO,IAAI,OAAO,KAAA;CACtB,KAAK,IAAI,OAAO,GAAG,OAAO,KAAK,QAAQ,QAAQ;EAC7C,MAAM,SAAS,SAAS,IAAI,KAAA,IAAY,UAAU,IAAI,KAAK,KAAK,SAAS,EAAE;EAC3E,IAAI,QAAQ,OAAO;EACnB,MAAM,QAAQ,UAAU,IAAI,KAAK,KAAK,SAAS,EAAE;EACj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ACS;GAGP,cAAY,QAAQ,OAAO;GAC3B,WAAW,GAAG,8BAA8B,SAAS;GAGrD,UAAA,oBAAC,sBAAD,EAAyC,YAAc,CAAA;EACzC,CAAA,CACT;;AAEb"}
@@ -1,4 +1,4 @@
1
- import { p as CascaderNode, s as CascaderLabels, t as CascaderActionItem } from "../../../cascader-types-BnH6wYD-.js";
1
+ import { p as CascaderNode, s as CascaderLabels, t as CascaderActionItem } from "../../../cascader-types-DVT-znZ-.js";
2
2
  import { FilterField } from "./filters-types.js";
3
3
  import * as React$1 from "react";
4
4
  //#region src/components/reui/filters/filters-builder.d.ts
@@ -10,8 +10,8 @@ import { FILTER_FIELD_PICKER_CLASS, getFilterField, getFilterFieldCount, joinFil
10
10
  import { getDefaultFilterOperator } from "./filters-operators.js";
11
11
  import * as React$1 from "react";
12
12
  import { cn } from "@kumix/utils";
13
- import { ListFilterPlusIcon } from "lucide-react";
14
13
  import { jsx, jsxs } from "react/jsx-runtime";
14
+ import { ListFilterPlusIcon } from "lucide-react";
15
15
  //#region src/components/reui/filters/filters-builder.tsx
16
16
  /**
17
17
  * Projects ONLY the field tree: operators or values as nodes would force the
@@ -1,8 +1,8 @@
1
1
  "use client";
2
2
  import { Button } from "../../ui/button.js";
3
+ import { Popover, PopoverContent, PopoverTrigger } from "../../ui/popover.js";
3
4
  import { ButtonGroup, ButtonGroupText } from "../../ui/button-group.js";
4
5
  import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuTrigger } from "../../ui/dropdown-menu.js";
5
- import { Popover, PopoverContent, PopoverTrigger } from "../../ui/popover.js";
6
6
  import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "../../ui/tooltip.js";
7
7
  import { filterControlSizes, filterReadOnlyProps, isFilterLocked, useFilterActions, useFilterChipAutoOpen, useFilterChipFocused, useFilterFocusEmpty, useFilterFocusStore, useFilterRender, useFilterReorderable } from "./filters-context.js";
8
8
  import { FILTER_MENU_CLASS, FILTER_MENU_LABEL_CLASS, collapseFilterPath, formatFilterPath, getFilterField, getFilterFieldChain } from "./filters-lib.js";
@@ -11,8 +11,8 @@ import { FilterMenu, useFilterOptions, useFilterValueResolution } from "./filter
11
11
  import { findFilterNode, isFilterGroup } from "./filters-query.js";
12
12
  import * as React$1 from "react";
13
13
  import { cn } from "@kumix/utils";
14
- import { ArrowLeftRightIcon, ChevronRightIcon, CopyIcon, CornerDownRightIcon, EllipsisVerticalIcon, LayersIcon, SlidersHorizontalIcon, Trash2Icon, XIcon } from "lucide-react";
15
14
  import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
15
+ import { ArrowLeftRightIcon, ChevronRightIcon, CopyIcon, CornerDownRightIcon, EllipsisVerticalIcon, LayersIcon, SlidersHorizontalIcon, Trash2Icon, XIcon } from "lucide-react";
16
16
  //#region src/components/reui/filters/filters-chip.tsx
17
17
  /** The ref half of `autoFocusProps`: a CALLBACK ref, the one shape an editor
18
18
  * can spread onto any element without a cast, and a no-op here. */
@@ -11,8 +11,8 @@ import { FilterActionsContext, filterControlSizes } from "./filters-context.js";
11
11
  import { applyFilterExclusiveSelection, filterFilterOptions, joinFilterPath, normalizeFilterQuery, warnFilterOnce } from "./filters-lib.js";
12
12
  import * as React$1 from "react";
13
13
  import { cn } from "@kumix/utils";
14
- import { CheckIcon, XIcon } from "lucide-react";
15
14
  import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
15
+ import { CheckIcon, XIcon } from "lucide-react";
16
16
  //#region src/components/reui/filters/filters-editors.tsx
17
17
  const IDLE = {
18
18
  items: [],
@@ -1,4 +1,4 @@
1
- import { i as CascaderCollapse } from "../../../cascader-types-BnH6wYD-.js";
1
+ import { i as CascaderCollapse } from "../../../cascader-types-DVT-znZ-.js";
2
2
  import { FilterField, FilterIndex, FilterOperator, FilterOption } from "./filters-types.js";
3
3
  //#region src/components/reui/filters/filters-lib.d.ts
4
4
  /**
@@ -12,8 +12,8 @@ import { FilterAdvancedRow, FiltersAdvanced, FiltersAdvancedPanel } from "./filt
12
12
  import { filterDraftReducer, isFilterDraftCommittable } from "./filters-draft.js";
13
13
  import * as React$1 from "react";
14
14
  import { cn } from "@kumix/utils";
15
- import { cva } from "class-variance-authority";
16
15
  import { jsx, jsxs } from "react/jsx-runtime";
16
+ import { cva } from "class-variance-authority";
17
17
  //#region src/components/reui/filters/filters.tsx
18
18
  const filtersBarVariants = cva("flex flex-wrap items-center", {
19
19
  variants: { size: {
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import { cn } from "@kumix/utils";
3
- import { cva } from "class-variance-authority";
4
3
  import { jsx } from "react/jsx-runtime";
4
+ import { cva } from "class-variance-authority";
5
5
  //#region src/components/reui/frame.tsx
6
6
  /**
7
7
  * Frame sets --frame-panel-bg and --frame-panel-border-color; FramePanel reads
@@ -6,8 +6,8 @@ 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
8
  import { cn } from "@kumix/utils";
9
- import { CheckIcon, RepeatIcon } from "lucide-react";
10
9
  import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
10
+ import { CheckIcon, RepeatIcon } from "lucide-react";
11
11
  import { mergeProps } from "@base-ui/react/merge-props";
12
12
  import { useRender } from "@base-ui/react/use-render";
13
13
  //#region src/components/reui/gantt/gantt-bar.tsx