@kumix/ui 0.2.4 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (358) hide show
  1. package/README.md +32 -10
  2. package/dist/components/motion/action-swap-blur.d.ts +11 -0
  3. package/dist/components/motion/action-swap-blur.d.ts.map +1 -0
  4. package/dist/components/motion/action-swap-blur.js +26 -0
  5. package/dist/components/motion/action-swap-blur.js.map +1 -0
  6. package/dist/components/motion/action-swap-cascade.d.ts +11 -0
  7. package/dist/components/motion/action-swap-cascade.d.ts.map +1 -0
  8. package/dist/components/motion/action-swap-cascade.js +26 -0
  9. package/dist/components/motion/action-swap-cascade.js.map +1 -0
  10. package/dist/components/motion/action-swap-roll.d.ts +11 -0
  11. package/dist/components/motion/action-swap-roll.d.ts.map +1 -0
  12. package/dist/components/motion/action-swap-roll.js +26 -0
  13. package/dist/components/motion/action-swap-roll.js.map +1 -0
  14. package/dist/components/motion/action-swap.d.ts +41 -0
  15. package/dist/components/motion/action-swap.d.ts.map +1 -0
  16. package/dist/components/motion/action-swap.js +261 -0
  17. package/dist/components/motion/action-swap.js.map +1 -0
  18. package/dist/components/motion/animated-badge.d.ts +18 -0
  19. package/dist/components/motion/animated-badge.d.ts.map +1 -0
  20. package/dist/components/motion/animated-badge.js +206 -0
  21. package/dist/components/motion/animated-badge.js.map +1 -0
  22. package/dist/components/motion/animated-number.d.ts +12 -0
  23. package/dist/components/motion/animated-number.d.ts.map +1 -0
  24. package/dist/components/motion/animated-number.js +47 -0
  25. package/dist/components/motion/animated-number.js.map +1 -0
  26. package/dist/components/motion/animated-sidebar.d.ts +97 -0
  27. package/dist/components/motion/animated-sidebar.d.ts.map +1 -0
  28. package/dist/components/motion/animated-sidebar.js +611 -0
  29. package/dist/components/motion/animated-sidebar.js.map +1 -0
  30. package/dist/components/motion/animated-toast-stack.d.ts +65 -0
  31. package/dist/components/motion/animated-toast-stack.d.ts.map +1 -0
  32. package/dist/components/motion/animated-toast-stack.js +303 -0
  33. package/dist/components/motion/animated-toast-stack.js.map +1 -0
  34. package/dist/components/motion/bottom-sheet.d.ts +19 -0
  35. package/dist/components/motion/bottom-sheet.d.ts.map +1 -0
  36. package/dist/components/motion/bottom-sheet.js +146 -0
  37. package/dist/components/motion/bottom-sheet.js.map +1 -0
  38. package/dist/components/motion/bounce-sidebar.d.ts +26 -0
  39. package/dist/components/motion/bounce-sidebar.d.ts.map +1 -0
  40. package/dist/components/motion/bounce-sidebar.js +164 -0
  41. package/dist/components/motion/bounce-sidebar.js.map +1 -0
  42. package/dist/components/motion/bouncy-accordion.d.ts +32 -0
  43. package/dist/components/motion/bouncy-accordion.d.ts.map +1 -0
  44. package/dist/components/motion/bouncy-accordion.js +172 -0
  45. package/dist/components/motion/bouncy-accordion.js.map +1 -0
  46. package/dist/components/motion/button/base.d.ts +17 -0
  47. package/dist/components/motion/button/base.d.ts.map +1 -0
  48. package/dist/components/motion/button/base.js +86 -0
  49. package/dist/components/motion/button/base.js.map +1 -0
  50. package/dist/components/motion/button/magnetic.d.ts +12 -0
  51. package/dist/components/motion/button/magnetic.d.ts.map +1 -0
  52. package/dist/components/motion/button/magnetic.js +21 -0
  53. package/dist/components/motion/button/magnetic.js.map +1 -0
  54. package/dist/components/motion/button/stateful.d.ts +16 -0
  55. package/dist/components/motion/button/stateful.d.ts.map +1 -0
  56. package/dist/components/motion/button/stateful.js +190 -0
  57. package/dist/components/motion/button/stateful.js.map +1 -0
  58. package/dist/components/motion/center-morph-modal.d.ts +43 -0
  59. package/dist/components/motion/center-morph-modal.d.ts.map +1 -0
  60. package/dist/components/motion/center-morph-modal.js +238 -0
  61. package/dist/components/motion/center-morph-modal.js.map +1 -0
  62. package/dist/components/motion/checkbox.d.ts +15 -0
  63. package/dist/components/motion/checkbox.d.ts.map +1 -0
  64. package/dist/components/motion/checkbox.js +81 -0
  65. package/dist/components/motion/checkbox.js.map +1 -0
  66. package/dist/components/motion/chromatic-text-reveal.d.ts +31 -0
  67. package/dist/components/motion/chromatic-text-reveal.d.ts.map +1 -0
  68. package/dist/components/motion/chromatic-text-reveal.js +132 -0
  69. package/dist/components/motion/chromatic-text-reveal.js.map +1 -0
  70. package/dist/components/motion/context-menu.d.ts +71 -0
  71. package/dist/components/motion/context-menu.d.ts.map +1 -0
  72. package/dist/components/motion/context-menu.js +454 -0
  73. package/dist/components/motion/context-menu.js.map +1 -0
  74. package/dist/components/motion/cylinder-carousel.d.ts +40 -0
  75. package/dist/components/motion/cylinder-carousel.d.ts.map +1 -0
  76. package/dist/components/motion/cylinder-carousel.js +274 -0
  77. package/dist/components/motion/cylinder-carousel.js.map +1 -0
  78. package/dist/components/motion/dock.d.ts +24 -0
  79. package/dist/components/motion/dock.d.ts.map +1 -0
  80. package/dist/components/motion/dock.js +62 -0
  81. package/dist/components/motion/dock.js.map +1 -0
  82. package/dist/components/motion/drawer.d.ts +19 -0
  83. package/dist/components/motion/drawer.d.ts.map +1 -0
  84. package/dist/components/motion/drawer.js +58 -0
  85. package/dist/components/motion/drawer.js.map +1 -0
  86. package/dist/components/motion/hold-action-button.d.ts +17 -0
  87. package/dist/components/motion/hold-action-button.d.ts.map +1 -0
  88. package/dist/components/motion/hold-action-button.js +158 -0
  89. package/dist/components/motion/hold-action-button.js.map +1 -0
  90. package/dist/components/motion/input.d.ts +29 -0
  91. package/dist/components/motion/input.d.ts.map +1 -0
  92. package/dist/components/motion/input.js +126 -0
  93. package/dist/components/motion/input.js.map +1 -0
  94. package/dist/components/motion/loader.d.ts +17 -0
  95. package/dist/components/motion/loader.d.ts.map +1 -0
  96. package/dist/components/motion/loader.js +791 -0
  97. package/dist/components/motion/loader.js.map +1 -0
  98. package/dist/components/motion/magnetic.d.ts +11 -0
  99. package/dist/components/motion/magnetic.d.ts.map +1 -0
  100. package/dist/components/motion/magnetic.js +44 -0
  101. package/dist/components/motion/magnetic.js.map +1 -0
  102. package/dist/components/motion/marquee.d.ts +15 -0
  103. package/dist/components/motion/marquee.d.ts.map +1 -0
  104. package/dist/components/motion/marquee.js +35 -0
  105. package/dist/components/motion/marquee.js.map +1 -0
  106. package/dist/components/motion/morphing-modal.d.ts +15 -0
  107. package/dist/components/motion/morphing-modal.d.ts.map +1 -0
  108. package/dist/components/motion/morphing-modal.js +117 -0
  109. package/dist/components/motion/morphing-modal.js.map +1 -0
  110. package/dist/components/motion/number-ticker.d.ts +26 -0
  111. package/dist/components/motion/number-ticker.d.ts.map +1 -0
  112. package/dist/components/motion/number-ticker.js +129 -0
  113. package/dist/components/motion/number-ticker.js.map +1 -0
  114. package/dist/components/motion/parallax.d.ts +21 -0
  115. package/dist/components/motion/parallax.d.ts.map +1 -0
  116. package/dist/components/motion/parallax.js +35 -0
  117. package/dist/components/motion/parallax.js.map +1 -0
  118. package/dist/components/motion/popover-morph.d.ts +38 -0
  119. package/dist/components/motion/popover-morph.d.ts.map +1 -0
  120. package/dist/components/motion/popover-morph.js +167 -0
  121. package/dist/components/motion/popover-morph.js.map +1 -0
  122. package/dist/components/motion/popover.d.ts +40 -0
  123. package/dist/components/motion/popover.d.ts.map +1 -0
  124. package/dist/components/motion/popover.js +393 -0
  125. package/dist/components/motion/popover.js.map +1 -0
  126. package/dist/components/motion/preview-rail.d.ts +26 -0
  127. package/dist/components/motion/preview-rail.d.ts.map +1 -0
  128. package/dist/components/motion/preview-rail.js +134 -0
  129. package/dist/components/motion/preview-rail.js.map +1 -0
  130. package/dist/components/motion/pull-to-refresh.d.ts +28 -0
  131. package/dist/components/motion/pull-to-refresh.d.ts.map +1 -0
  132. package/dist/components/motion/pull-to-refresh.js +389 -0
  133. package/dist/components/motion/pull-to-refresh.js.map +1 -0
  134. package/dist/components/motion/radio.d.ts +22 -0
  135. package/dist/components/motion/radio.d.ts.map +1 -0
  136. package/dist/components/motion/radio.js +79 -0
  137. package/dist/components/motion/radio.js.map +1 -0
  138. package/dist/components/motion/range-slider-bubble.d.ts +16 -0
  139. package/dist/components/motion/range-slider-bubble.d.ts.map +1 -0
  140. package/dist/components/motion/range-slider-bubble.js +117 -0
  141. package/dist/components/motion/range-slider-bubble.js.map +1 -0
  142. package/dist/components/motion/range-slider-fluid.d.ts +18 -0
  143. package/dist/components/motion/range-slider-fluid.d.ts.map +1 -0
  144. package/dist/components/motion/range-slider-fluid.js +63 -0
  145. package/dist/components/motion/range-slider-fluid.js.map +1 -0
  146. package/dist/components/motion/range-slider-ruler.d.ts +19 -0
  147. package/dist/components/motion/range-slider-ruler.d.ts.map +1 -0
  148. package/dist/components/motion/range-slider-ruler.js +142 -0
  149. package/dist/components/motion/range-slider-ruler.js.map +1 -0
  150. package/dist/components/motion/range-slider-wave.d.ts +16 -0
  151. package/dist/components/motion/range-slider-wave.d.ts.map +1 -0
  152. package/dist/components/motion/range-slider-wave.js +57 -0
  153. package/dist/components/motion/range-slider-wave.js.map +1 -0
  154. package/dist/components/motion/range-slider.d.ts +11 -0
  155. package/dist/components/motion/range-slider.d.ts.map +1 -0
  156. package/dist/components/motion/range-slider.js +63 -0
  157. package/dist/components/motion/range-slider.js.map +1 -0
  158. package/dist/components/motion/scroll-progress.d.ts +29 -0
  159. package/dist/components/motion/scroll-progress.d.ts.map +1 -0
  160. package/dist/components/motion/scroll-progress.js +71 -0
  161. package/dist/components/motion/scroll-progress.js.map +1 -0
  162. package/dist/components/motion/scroll-reveal.d.ts +23 -0
  163. package/dist/components/motion/scroll-reveal.d.ts.map +1 -0
  164. package/dist/components/motion/scroll-reveal.js +42 -0
  165. package/dist/components/motion/scroll-reveal.js.map +1 -0
  166. package/dist/components/motion/scroll-to.d.ts +21 -0
  167. package/dist/components/motion/scroll-to.d.ts.map +1 -0
  168. package/dist/components/motion/scroll-to.js +27 -0
  169. package/dist/components/motion/scroll-to.js.map +1 -0
  170. package/dist/components/motion/select-morph.d.ts +41 -0
  171. package/dist/components/motion/select-morph.d.ts.map +1 -0
  172. package/dist/components/motion/select-morph.js +251 -0
  173. package/dist/components/motion/select-morph.js.map +1 -0
  174. package/dist/components/motion/select.d.ts +36 -0
  175. package/dist/components/motion/select.d.ts.map +1 -0
  176. package/dist/components/motion/select.js +319 -0
  177. package/dist/components/motion/select.js.map +1 -0
  178. package/dist/components/motion/shader-background.d.ts +38 -0
  179. package/dist/components/motion/shader-background.d.ts.map +1 -0
  180. package/dist/components/motion/shader-background.js +49 -0
  181. package/dist/components/motion/shader-background.js.map +1 -0
  182. package/dist/components/motion/shared-layout-bg.d.ts +17 -0
  183. package/dist/components/motion/shared-layout-bg.d.ts.map +1 -0
  184. package/dist/components/motion/shared-layout-bg.js +88 -0
  185. package/dist/components/motion/shared-layout-bg.js.map +1 -0
  186. package/dist/components/motion/slide-action-button.d.ts +15 -0
  187. package/dist/components/motion/slide-action-button.d.ts.map +1 -0
  188. package/dist/components/motion/slide-action-button.js +146 -0
  189. package/dist/components/motion/slide-action-button.js.map +1 -0
  190. package/dist/components/motion/smooth-scroll.d.ts +47 -0
  191. package/dist/components/motion/smooth-scroll.d.ts.map +1 -0
  192. package/dist/components/motion/smooth-scroll.js +182 -0
  193. package/dist/components/motion/smooth-scroll.js.map +1 -0
  194. package/dist/components/motion/switch.d.ts +13 -0
  195. package/dist/components/motion/switch.d.ts.map +1 -0
  196. package/dist/components/motion/switch.js +76 -0
  197. package/dist/components/motion/switch.js.map +1 -0
  198. package/dist/components/motion/table/editable-cell.d.ts +9 -0
  199. package/dist/components/motion/table/editable-cell.d.ts.map +1 -0
  200. package/dist/components/motion/table/editable-cell.js +17 -0
  201. package/dist/components/motion/table/editable-cell.js.map +1 -0
  202. package/dist/components/motion/table/index.d.ts +6 -0
  203. package/dist/components/motion/table/index.d.ts.map +1 -0
  204. package/dist/components/motion/table/index.js +420 -0
  205. package/dist/components/motion/table/index.js.map +1 -0
  206. package/dist/components/motion/table/row-handle.d.ts +15 -0
  207. package/dist/components/motion/table/row-handle.d.ts.map +1 -0
  208. package/dist/components/motion/table/row-handle.js +51 -0
  209. package/dist/components/motion/table/row-handle.js.map +1 -0
  210. package/dist/components/motion/table/skeleton-rows.d.ts +11 -0
  211. package/dist/components/motion/table/skeleton-rows.d.ts.map +1 -0
  212. package/dist/components/motion/table/skeleton-rows.js +23 -0
  213. package/dist/components/motion/table/skeleton-rows.js.map +1 -0
  214. package/dist/components/motion/table/table-header.d.ts +35 -0
  215. package/dist/components/motion/table/table-header.d.ts.map +1 -0
  216. package/dist/components/motion/table/table-header.js +167 -0
  217. package/dist/components/motion/table/table-header.js.map +1 -0
  218. package/dist/components/motion/table/table-menu.d.ts +17 -0
  219. package/dist/components/motion/table/table-menu.d.ts.map +1 -0
  220. package/dist/components/motion/table/table-menu.js +92 -0
  221. package/dist/components/motion/table/table-menu.js.map +1 -0
  222. package/dist/components/motion/tabs.d.ts +29 -0
  223. package/dist/components/motion/tabs.d.ts.map +1 -0
  224. package/dist/components/motion/tabs.js +125 -0
  225. package/dist/components/motion/tabs.js.map +1 -0
  226. package/dist/components/motion/text-cascade.d.ts +15 -0
  227. package/dist/components/motion/text-cascade.d.ts.map +1 -0
  228. package/dist/components/motion/text-cascade.js +21 -0
  229. package/dist/components/motion/text-cascade.js.map +1 -0
  230. package/dist/components/motion/text-reveal.d.ts +25 -0
  231. package/dist/components/motion/text-reveal.d.ts.map +1 -0
  232. package/dist/components/motion/text-reveal.js +94 -0
  233. package/dist/components/motion/text-reveal.js.map +1 -0
  234. package/dist/components/motion/text-shimmer.d.ts +12 -0
  235. package/dist/components/motion/text-shimmer.d.ts.map +1 -0
  236. package/dist/components/motion/text-shimmer.js +15 -0
  237. package/dist/components/motion/text-shimmer.js.map +1 -0
  238. package/dist/components/motion/theme-toggle.d.ts +23 -0
  239. package/dist/components/motion/theme-toggle.d.ts.map +1 -0
  240. package/dist/components/motion/theme-toggle.js +160 -0
  241. package/dist/components/motion/theme-toggle.js.map +1 -0
  242. package/dist/components/motion/tilt-card.d.ts +12 -0
  243. package/dist/components/motion/tilt-card.d.ts.map +1 -0
  244. package/dist/components/motion/tilt-card.js +56 -0
  245. package/dist/components/motion/tilt-card.js.map +1 -0
  246. package/dist/components/motion/tooltip.d.ts +17 -0
  247. package/dist/components/motion/tooltip.d.ts.map +1 -0
  248. package/dist/components/motion/tooltip.js +194 -0
  249. package/dist/components/motion/tooltip.js.map +1 -0
  250. package/dist/components/motion/wheel-picker.d.ts +24 -0
  251. package/dist/components/motion/wheel-picker.d.ts.map +1 -0
  252. package/dist/components/motion/wheel-picker.js +442 -0
  253. package/dist/components/motion/wheel-picker.js.map +1 -0
  254. package/dist/components/reui/alert.d.ts +1 -1
  255. package/dist/components/reui/alert.js +1 -1
  256. package/dist/components/reui/autocomplete.js +2 -2
  257. package/dist/components/reui/badge.d.ts +2 -2
  258. package/dist/components/reui/badge.js +10 -9
  259. package/dist/components/reui/badge.js.map +1 -1
  260. package/dist/components/reui/data-grid/data-grid-table-dnd.js +21 -19
  261. package/dist/components/reui/data-grid/data-grid-table-dnd.js.map +1 -1
  262. package/dist/components/reui/data-grid/data-grid-table-virtual.d.ts +1 -1
  263. package/dist/components/reui/data-grid/data-grid-table-virtual.js +1 -1
  264. package/dist/components/reui/data-grid/data-grid-table.js +4 -2
  265. package/dist/components/reui/data-grid/data-grid-table.js.map +1 -1
  266. package/dist/components/reui/event-calendar/event-calendar-agenda-view.js +2 -1
  267. package/dist/components/reui/event-calendar/event-calendar-agenda-view.js.map +1 -1
  268. package/dist/components/reui/event-calendar/event-calendar-content.js +8 -7
  269. package/dist/components/reui/event-calendar/event-calendar-content.js.map +1 -1
  270. package/dist/components/reui/event-calendar/event-calendar-dnd.js +7 -4
  271. package/dist/components/reui/event-calendar/event-calendar-dnd.js.map +1 -1
  272. package/dist/components/reui/event-calendar/event-calendar-event.js +49 -47
  273. package/dist/components/reui/event-calendar/event-calendar-event.js.map +1 -1
  274. package/dist/components/reui/event-calendar/event-calendar-lib.js +3 -2
  275. package/dist/components/reui/event-calendar/event-calendar-lib.js.map +1 -1
  276. package/dist/components/reui/event-calendar/event-calendar-nav.js +37 -31
  277. package/dist/components/reui/event-calendar/event-calendar-nav.js.map +1 -1
  278. package/dist/components/reui/event-calendar/event-calendar-time-grid.js +2 -1
  279. package/dist/components/reui/event-calendar/event-calendar-time-grid.js.map +1 -1
  280. package/dist/components/reui/event-calendar/event-calendar.js +2 -1
  281. package/dist/components/reui/event-calendar/event-calendar.js.map +1 -1
  282. package/dist/components/reui/filters.js +5 -3
  283. package/dist/components/reui/filters.js.map +1 -1
  284. package/dist/components/reui/frame.d.ts +2 -2
  285. package/dist/components/reui/frame.js +1 -1
  286. package/dist/components/reui/gantt/gantt-bar.js +52 -51
  287. package/dist/components/reui/gantt/gantt-bar.js.map +1 -1
  288. package/dist/components/reui/gantt/gantt-lib.js +3 -2
  289. package/dist/components/reui/gantt/gantt-lib.js.map +1 -1
  290. package/dist/components/reui/gantt/gantt-nav.js +34 -30
  291. package/dist/components/reui/gantt/gantt-nav.js.map +1 -1
  292. package/dist/components/reui/gantt/gantt-recurrence.js +2 -2
  293. package/dist/components/reui/gantt/gantt-recurrence.js.map +1 -1
  294. package/dist/components/reui/gantt/gantt-view.js +175 -171
  295. package/dist/components/reui/gantt/gantt-view.js.map +1 -1
  296. package/dist/components/reui/icon-tile.d.ts +1 -1
  297. package/dist/components/reui/icon-tile.js +12 -11
  298. package/dist/components/reui/icon-tile.js.map +1 -1
  299. package/dist/components/reui/kanban.js +42 -37
  300. package/dist/components/reui/kanban.js.map +1 -1
  301. package/dist/components/reui/number-field.js +1 -1
  302. package/dist/components/reui/rating.js +1 -1
  303. package/dist/components/reui/sortable.js +10 -9
  304. package/dist/components/reui/sortable.js.map +1 -1
  305. package/dist/components/reui/stepper.js +16 -16
  306. package/dist/components/reui/stepper.js.map +1 -1
  307. package/dist/components/reui/timeline.js +45 -38
  308. package/dist/components/reui/timeline.js.map +1 -1
  309. package/dist/components/reui/tree.js +2 -1
  310. package/dist/components/reui/tree.js.map +1 -1
  311. package/dist/components/ui/alert.js +1 -1
  312. package/dist/components/ui/attachment.d.ts +1 -1
  313. package/dist/components/ui/attachment.js +1 -1
  314. package/dist/components/ui/badge.d.ts +1 -1
  315. package/dist/components/ui/bubble.d.ts +1 -1
  316. package/dist/components/ui/bubble.js +1 -1
  317. package/dist/components/ui/button-group.js +1 -1
  318. package/dist/components/ui/button.d.ts +2 -2
  319. package/dist/components/ui/button.js +1 -1
  320. package/dist/components/ui/empty.d.ts +1 -1
  321. package/dist/components/ui/empty.js +1 -1
  322. package/dist/components/ui/field.js +1 -1
  323. package/dist/components/ui/input-group.js +1 -1
  324. package/dist/components/ui/item.d.ts +2 -2
  325. package/dist/components/ui/item.js +1 -1
  326. package/dist/components/ui/marker.js +1 -1
  327. package/dist/components/ui/navigation-menu.js +1 -1
  328. package/dist/components/ui/sidebar.d.ts +1 -1
  329. package/dist/components/ui/sidebar.js +2 -2
  330. package/dist/components/ui/sidebar.js.map +1 -1
  331. package/dist/components/ui/tabs.js +1 -1
  332. package/dist/components/ui/toggle.d.ts +1 -1
  333. package/dist/components/ui/toggle.js +1 -1
  334. package/dist/hooks/use-hover-capable.d.ts +10 -0
  335. package/dist/hooks/use-hover-capable.d.ts.map +1 -0
  336. package/dist/hooks/use-hover-capable.js +24 -0
  337. package/dist/hooks/use-hover-capable.js.map +1 -0
  338. package/dist/hooks/use-mobile.js +1 -1
  339. package/dist/hooks/use-mobile.js.map +1 -1
  340. package/dist/hooks/use-slider.d.ts +58 -0
  341. package/dist/hooks/use-slider.d.ts.map +1 -0
  342. package/dist/hooks/use-slider.js +133 -0
  343. package/dist/hooks/use-slider.js.map +1 -0
  344. package/dist/lib/ease.d.ts +50 -0
  345. package/dist/lib/ease.d.ts.map +1 -0
  346. package/dist/lib/ease.js +66 -0
  347. package/dist/lib/ease.js.map +1 -0
  348. package/dist/lib/tick-sound.d.ts +17 -0
  349. package/dist/lib/tick-sound.d.ts.map +1 -0
  350. package/dist/lib/tick-sound.js +120 -0
  351. package/dist/lib/tick-sound.js.map +1 -0
  352. package/dist/popover-position-BUqYCq8X.js +54 -0
  353. package/dist/popover-position-BUqYCq8X.js.map +1 -0
  354. package/dist/types-Bah5NY44.d.ts +81 -0
  355. package/dist/types-Bah5NY44.d.ts.map +1 -0
  356. package/dist/utils-DQ7OpbYQ.js +25 -0
  357. package/dist/utils-DQ7OpbYQ.js.map +1 -0
  358. package/package.json +17 -6
@@ -1 +1 @@
1
- {"version":3,"file":"filters.js","names":[],"sources":["../../../src/components/reui/filters.tsx"],"sourcesContent":["\"use client\";\n\"use no memo\";\n\nimport type React from \"react\";\nimport {\n createContext,\n useCallback,\n useContext,\n useEffect,\n useId,\n useMemo,\n useRef,\n useState,\n} from \"react\";\nimport { useRender } from \"@base-ui/react/use-render\";\nimport { cva } from \"class-variance-authority\";\nimport { AlertCircleIcon, CheckIcon, PlusIcon, XIcon } from \"lucide-react\";\n\nimport { cn } from \"@kumix/utils\";\nimport { Button } from \"../ui/button\";\nimport { ButtonGroup, ButtonGroupText } from \"../ui/button-group\";\nimport {\n DropdownMenu,\n DropdownMenuCheckboxItem,\n DropdownMenuContent,\n DropdownMenuGroup,\n DropdownMenuItem,\n DropdownMenuSeparator,\n DropdownMenuSub,\n DropdownMenuSubContent,\n DropdownMenuSubTrigger,\n DropdownMenuTrigger,\n} from \"../ui/dropdown-menu\";\nimport { Input } from \"../ui/input\";\nimport {\n InputGroup,\n InputGroupAddon,\n InputGroupButton,\n InputGroupInput,\n InputGroupText,\n} from \"../ui/input-group\";\nimport { Kbd } from \"../ui/kbd\";\nimport { ScrollArea } from \"../ui/scroll-area\";\nimport { Tooltip, TooltipContent, TooltipTrigger } from \"../ui/tooltip\";\n\n// i18n Configuration Interface\nexport interface FilterI18nConfig {\n // UI Labels\n addFilter: string;\n searchFields: string;\n noFieldsFound: string;\n noResultsFound: string;\n select: string;\n true: string;\n false: string;\n min: string;\n max: string;\n to: string;\n typeAndPressEnter: string;\n selected: string;\n selectedCount: string;\n percent: string;\n defaultCurrency: string;\n defaultColor: string;\n addFilterTitle: string;\n // Async option loading states (optional; fall back to sensible defaults)\n loadingOptions?: string;\n errorLoadingOptions?: string;\n\n // Operators\n operators: {\n is: string;\n isNot: string;\n isAnyOf: string;\n isNotAnyOf: string;\n includesAll: string;\n excludesAll: string;\n before: string;\n after: string;\n between: string;\n notBetween: string;\n contains: string;\n notContains: string;\n startsWith: string;\n endsWith: string;\n isExactly: string;\n equals: string;\n notEquals: string;\n greaterThan: string;\n lessThan: string;\n overlaps: string;\n includes: string;\n excludes: string;\n includesAllOf: string;\n includesAnyOf: string;\n empty: string;\n notEmpty: string;\n };\n\n // Placeholders\n placeholders: {\n enterField: (fieldType: string) => string;\n selectField: string;\n searchField: (fieldName: string) => string;\n enterKey: string;\n enterValue: string;\n };\n\n // Helper functions\n helpers: {\n formatOperator: (operator: string) => string;\n };\n\n // Validation\n validation: {\n invalidEmail: string;\n invalidUrl: string;\n invalidTel: string;\n invalid: string;\n };\n}\n\n// Default English i18n configuration\nexport const DEFAULT_I18N: FilterI18nConfig = {\n // UI Labels\n addFilter: \"Filter\",\n searchFields: \"Filter...\",\n noFieldsFound: \"No filters found.\",\n noResultsFound: \"No results found.\",\n select: \"Select...\",\n true: \"True\",\n false: \"False\",\n min: \"Min\",\n max: \"Max\",\n to: \"to\",\n typeAndPressEnter: \"Type and press Enter to add tag\",\n selected: \"selected\",\n selectedCount: \"selected\",\n percent: \"%\",\n defaultCurrency: \"$\",\n defaultColor: \"#000000\",\n addFilterTitle: \"Add filter\",\n loadingOptions: \"Loading...\",\n errorLoadingOptions: \"Failed to load options.\",\n\n // Operators\n operators: {\n is: \"is\",\n isNot: \"is not\",\n isAnyOf: \"is any of\",\n isNotAnyOf: \"is not any of\",\n includesAll: \"includes all\",\n excludesAll: \"excludes all\",\n before: \"before\",\n after: \"after\",\n between: \"between\",\n notBetween: \"not between\",\n contains: \"contains\",\n notContains: \"does not contain\",\n startsWith: \"starts with\",\n endsWith: \"ends with\",\n isExactly: \"is exactly\",\n equals: \"equals\",\n notEquals: \"not equals\",\n greaterThan: \"greater than\",\n lessThan: \"less than\",\n overlaps: \"overlaps\",\n includes: \"includes\",\n excludes: \"excludes\",\n includesAllOf: \"includes all of\",\n includesAnyOf: \"includes any of\",\n empty: \"is empty\",\n notEmpty: \"is not empty\",\n },\n\n // Placeholders\n placeholders: {\n enterField: (fieldType: string) => `Enter ${fieldType}...`,\n selectField: \"Select...\",\n searchField: (fieldName: string) => `Search ${fieldName.toLowerCase()}...`,\n enterKey: \"Enter key...\",\n enterValue: \"Enter value...\",\n },\n\n // Helper functions\n helpers: {\n formatOperator: (operator: string) => operator.replace(/_/g, \" \"),\n },\n\n // Validation\n validation: {\n invalidEmail: \"Invalid email format\",\n invalidUrl: \"Invalid URL format\",\n invalidTel: \"Invalid phone format\",\n invalid: \"Invalid input format\",\n },\n};\n\n// Context for all Filter component props\ninterface FilterContextValue {\n variant: \"solid\" | \"default\";\n size: \"sm\" | \"default\" | \"lg\";\n radius: \"default\" | \"full\";\n i18n: FilterI18nConfig;\n className?: string;\n showSearchInput?: boolean;\n trigger?: React.ReactNode;\n allowMultiple?: boolean;\n}\n\nconst FilterContext = createContext<FilterContextValue>({\n variant: \"default\",\n size: \"default\",\n radius: \"default\",\n i18n: DEFAULT_I18N,\n className: undefined,\n showSearchInput: true,\n trigger: undefined,\n allowMultiple: true,\n});\n\nconst useFilterContext = () => useContext(FilterContext);\n\n// Container variant for filters wrapper\nconst filtersContainerVariants = cva(\"flex flex-wrap items-center\", {\n variants: {\n variant: {\n solid: \"gap-2\",\n default: \"\",\n },\n size: {\n sm: \"gap-1.5\",\n default: \"gap-2.5\",\n lg: \"gap-3.5\",\n },\n },\n defaultVariants: {\n variant: \"default\",\n size: \"default\",\n },\n});\n\nfunction FilterInput<T = unknown>({\n field,\n onBlur,\n onKeyDown,\n className,\n ...props\n}: React.InputHTMLAttributes<HTMLInputElement> & {\n className?: string;\n field?: FilterFieldConfig<T>;\n}) {\n const context = useFilterContext();\n const [isValid, setIsValid] = useState(true);\n const [validationMessage, setValidationMessage] = useState(\"\");\n const inputRef = useRef<HTMLInputElement>(null);\n\n useEffect(() => {\n if (props.autoFocus) {\n const timer = setTimeout(() => {\n inputRef.current?.focus();\n }, 300);\n return () => clearTimeout(timer);\n }\n }, [props.autoFocus]);\n\n // Validation function to check if input matches pattern\n const validateInput = (value: string, pattern?: string): boolean => {\n if (!pattern || !value) return true;\n const regex = new RegExp(pattern);\n return regex.test(value);\n };\n\n // Get validation message for field type\n const getValidationMessage = (): string => {\n return context.i18n.validation.invalid;\n };\n\n // Handle blur event - validate when user leaves input\n const handleBlur = (e: React.FocusEvent<HTMLInputElement>) => {\n const value = e.target.value;\n const pattern = field?.pattern || props.pattern;\n\n // Only validate if there's a value and (pattern or validation function)\n if (value && (pattern || field?.validation)) {\n let valid = true;\n let customMessage = \"\";\n\n // If there's a custom validation function, use it\n if (field?.validation) {\n const result = field.validation(value);\n // Handle both boolean and object return types\n if (typeof result === \"boolean\") {\n valid = result;\n } else {\n valid = result.valid;\n customMessage = result.message || \"\";\n }\n } else if (pattern) {\n // Use pattern validation\n valid = validateInput(value, pattern);\n }\n\n setIsValid(valid);\n setValidationMessage(valid ? \"\" : customMessage || getValidationMessage());\n } else {\n // Reset validation state for empty values or no validation\n setIsValid(true);\n setValidationMessage(\"\");\n }\n\n // Call the original onBlur if provided\n onBlur?.(e);\n };\n\n // Handle keydown event - hide validation error when user starts typing\n const handleKeyDown = (e: React.KeyboardEvent<HTMLInputElement>) => {\n // Hide validation error when user starts typing (any key except special keys)\n if (\n !isValid &&\n ![\"Tab\", \"Escape\", \"Enter\", \"ArrowUp\", \"ArrowDown\", \"ArrowLeft\", \"ArrowRight\"].includes(e.key)\n ) {\n setIsValid(true);\n setValidationMessage(\"\");\n }\n\n // Call the original onKeyDown if provided\n onKeyDown?.(e);\n };\n\n return (\n <InputGroup\n className={cn(\n \"w-36\",\n // Height follows each style's own control ladder. `default` sets no\n // height on purpose so the style's `.cn-input-group` applies (h-8 nova,\n // h-9 maia/luma, h-7 mira, h-10 sera); sm/lg step down/up from it.\n // Base covers nova/lyra/rhea/vega; only deviating styles are listed.\n context.size === \"sm\" && \"h-7!\",\n context.size === \"lg\" && \"h-9!\",\n // Sera's `.cn-input` is `px-0` (underline inputs sit flush); inside a\n // segmented chip that collides with the neighbouring segment, so give\n // the value input the same inline padding sera uses elsewhere.\n \"\",\n className,\n )}\n >\n {field?.prefix && (\n <InputGroupAddon>\n <InputGroupText>{field.prefix}</InputGroupText>\n </InputGroupAddon>\n )}\n <InputGroupInput\n ref={inputRef}\n aria-invalid={!isValid}\n aria-describedby={\n !isValid && validationMessage ? `${field?.key || \"input\"}-error` : undefined\n }\n onBlur={handleBlur}\n onKeyDown={handleKeyDown}\n className={cn(context.size === \"sm\" && \"h-7! text-xs\", context.size === \"lg\" && \"h-9!\")}\n {...props}\n />\n {!isValid && validationMessage && (\n <InputGroupAddon align=\"inline-end\">\n <Tooltip>\n <TooltipTrigger render={<InputGroupButton size=\"icon-xs\" />}>\n <AlertCircleIcon className=\"size-3.5 text-destructive\" />\n </TooltipTrigger>\n <TooltipContent>\n <p className=\"text-sm\">{validationMessage}</p>\n </TooltipContent>\n </Tooltip>\n </InputGroupAddon>\n )}\n\n {field?.suffix && (\n <InputGroupAddon align=\"inline-end\">\n <InputGroupText>{field.suffix}</InputGroupText>\n </InputGroupAddon>\n )}\n </InputGroup>\n );\n}\n\ninterface FilterRemoveButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {\n icon?: React.ReactNode;\n}\n\nfunction FilterRemoveButton({ className, icon = <XIcon />, ...props }: FilterRemoveButtonProps) {\n const context = useFilterContext();\n\n return (\n <Button\n variant=\"outline\"\n size={context.size === \"sm\" ? \"icon-sm\" : context.size === \"lg\" ? \"icon-lg\" : \"icon\"}\n className={className}\n {...props}\n >\n {icon}\n </Button>\n );\n}\n\n// Generic types for flexible filter system\nexport interface FilterOption<T = unknown> {\n value: T;\n label: string;\n icon?: React.ReactNode;\n metadata?: Record<string, unknown>;\n className?: string;\n}\n\nexport interface FilterOperator {\n value: string;\n label: string;\n supportsMultiple?: boolean;\n}\n\n// Custom renderer props interface\nexport interface CustomRendererProps<T = unknown> {\n field: FilterFieldConfig<T>;\n values: T[];\n onChange: (values: T[]) => void;\n operator: string;\n}\n\n// Props passed to a field's `renderOptionList` slot. Lets a consumer render the\n// options list however they like (e.g. windowing / virtualization with a\n// library of their choice) while staying bound to the primitive's selection and\n// keyboard behavior.\nexport interface FilterOptionListRenderProps<T = unknown> {\n // Options to render: already resolved, query-filtered, and selected-first.\n options: FilterOption<T>[];\n // Index into `options` of the keyboard-highlighted row (-1 if none). A\n // virtualized implementation should scroll this row into view and keep it\n // mounted so the combobox's aria-activedescendant stays valid.\n highlightedIndex: number;\n // Renders one option row with the correct id, selection state, highlight, and\n // toggle handler wired to the primitive. Call it for each row you render.\n renderOption: (option: FilterOption<T>, index: number) => React.ReactNode;\n}\n\n// Grouped field configuration interface\nexport interface FilterFieldGroup<T = unknown> {\n group?: string;\n fields: FilterFieldConfig<T>[];\n}\n\n// Union type for both flat and grouped field configurations\nexport type FilterFieldsConfig<T = unknown> = FilterFieldConfig<T>[] | FilterFieldGroup<T>[];\n\nexport interface FilterFieldConfig<T = unknown> {\n key?: string;\n label?: string;\n icon?: React.ReactNode;\n type?: \"select\" | \"multiselect\" | \"text\" | \"custom\" | \"separator\";\n // Group-level configuration\n group?: string;\n fields?: FilterFieldConfig<T>[];\n // Field-specific options\n options?: FilterOption<T>[];\n // Async / large-list options loader. Receives the current search query and\n // may return a Promise. Use it to prefetch a remote list once (ignore the\n // query) or to run server-side search (filter by the query). When both\n // `options` and `loadOptions` are provided, `options` seeds the initial view\n // and the value->label cache while `loadOptions` supplies live results.\n loadOptions?: (query: string) => FilterOption<T>[] | Promise<FilterOption<T>[]>;\n // Bring-your-own rendering for the options list (e.g. virtualization with a\n // windowing library of your choice). Return the full scrollable list, call\n // `renderOption` for each row, and scroll `highlightedIndex` into view. When\n // omitted, the options render as a plain scrollable list.\n renderOptionList?: (props: FilterOptionListRenderProps<T>) => React.ReactNode;\n operators?: FilterOperator[];\n customRenderer?: (props: CustomRendererProps<T>) => React.ReactNode;\n customValueRenderer?: (values: T[], options: FilterOption<T>[]) => React.ReactNode;\n placeholder?: string;\n searchable?: boolean;\n maxSelections?: number;\n min?: number;\n max?: number;\n step?: number;\n prefix?: string | React.ReactNode;\n suffix?: string | React.ReactNode;\n pattern?: string;\n validation?: (value: unknown) => boolean | { valid: boolean; message?: string };\n allowCustomValues?: boolean;\n className?: string;\n menuPopupClassName?: string;\n // Grouping options (legacy support)\n groupLabel?: string;\n // Boolean field options\n onLabel?: string;\n offLabel?: string;\n // Input event handlers\n onInputChange?: (e: React.ChangeEvent<HTMLInputElement>) => void;\n // Default operator to use when creating a filter for this field\n defaultOperator?: string;\n // Controlled values support for this field\n value?: T[];\n onValueChange?: (values: T[]) => void;\n}\n\n// Helper functions to handle both flat and grouped field configurations\nconst isFieldGroup = <T = unknown>(\n item: FilterFieldConfig<T> | FilterFieldGroup<T>,\n): item is FilterFieldGroup<T> => {\n return \"fields\" in item && Array.isArray(item.fields);\n};\n\n// Helper function to check if a FilterFieldConfig is a group-level configuration\nconst isGroupLevelField = <T = unknown>(field: FilterFieldConfig<T>): boolean => {\n return Boolean(field.group && field.fields);\n};\n\nconst flattenFields = <T = unknown>(fields: FilterFieldsConfig<T>): FilterFieldConfig<T>[] => {\n const acc: FilterFieldConfig<T>[] = [];\n for (const item of fields) {\n if (isFieldGroup(item)) {\n acc.push(...item.fields);\n } else if (isGroupLevelField(item)) {\n acc.push(...item.fields!);\n } else {\n acc.push(item);\n }\n }\n return acc;\n};\n\nconst getFieldsMap = <T = unknown>(\n fields: FilterFieldsConfig<T>,\n): Record<string, FilterFieldConfig<T>> => {\n const flatFields = flattenFields(fields);\n return flatFields.reduce(\n (acc, field) => {\n // Only add fields that have a key (skip group-level configurations)\n if (field.key) {\n acc[field.key] = field;\n }\n return acc;\n },\n {} as Record<string, FilterFieldConfig<T>>,\n );\n};\n\n// Whether a field exposes any option source (a static list or an async loader).\n// IMPORTANT: never gate on `field.options?.length` once `loadOptions` exists —\n// a function's `.length` is its arity, not an option count, which silently\n// breaks the submenu gate for async fields.\nconst fieldHasOptions = <T = unknown>(field: FilterFieldConfig<T>): boolean =>\n (field.options?.length ?? 0) > 0 || typeof field.loadOptions === \"function\";\n\ninterface ResolvedFieldOptions<T = unknown> {\n isAsync: boolean;\n options: FilterOption<T>[];\n loading: boolean;\n error: boolean;\n // Resolve selected values to full options using an accumulating value->option\n // cache, so async/controlled selections keep their label and icon even when\n // absent from the latest result page.\n resolveSelected: (values: T[]) => FilterOption<T>[];\n}\n\n// Value->option cache shared across every component instance rendering the\n// SAME field object (the Add Filter submenu and the active-filter chip both\n// receive the same config reference from the fields map). Keyed by the field\n// object so it is shared when fields are memoized and garbage-collected\n// otherwise. This keeps a value selected in the submenu labelled in the chip.\nconst fieldOptionCaches = new WeakMap<object, Map<unknown, FilterOption>>();\n\nconst getFieldOptionCache = <T = unknown>(field: FilterFieldConfig<T>): Map<T, FilterOption<T>> => {\n let cache = fieldOptionCaches.get(field as object);\n if (!cache) {\n cache = new Map();\n fieldOptionCaches.set(field as object, cache);\n }\n return cache as Map<T, FilterOption<T>>;\n};\n\n// Resolves a field's options for a popover/submenu. Static fields return their\n// list verbatim (unchanged legacy behavior). Async fields (`loadOptions`)\n// debounce the query, guard against out-of-order responses, and expose\n// loading/error state plus a value->label cache.\nfunction useFieldOptions<T = unknown>(\n field: FilterFieldConfig<T>,\n searchInput: string,\n enabled: boolean,\n): ResolvedFieldOptions<T> {\n const isAsync = typeof field.loadOptions === \"function\";\n\n // Seed the shared cache from any static options an async field also provides\n // (static fields never read this cache, so skip the work for them).\n if (isAsync && field.options) {\n const cache = getFieldOptionCache(field);\n for (const opt of field.options) {\n cache.set(opt.value, opt);\n }\n }\n\n const [state, setState] = useState<{\n options: FilterOption<T>[];\n loading: boolean;\n error: boolean;\n }>(() => ({ options: field.options ?? [], loading: false, error: false }));\n\n // Debounce the query for async fields to avoid a request per keystroke.\n const [debouncedQuery, setDebouncedQuery] = useState(searchInput);\n useEffect(() => {\n if (!isAsync) return;\n const timer = setTimeout(() => setDebouncedQuery(searchInput), 250);\n return () => clearTimeout(timer);\n }, [searchInput, isAsync]);\n\n const requestIdRef = useRef(0);\n // Keep the latest loader in a ref so an unmemoized `loadOptions` identity does\n // not cancel and refire the in-flight request on every parent re-render.\n const loaderRef = useRef(field.loadOptions);\n loaderRef.current = field.loadOptions;\n useEffect(() => {\n if (!isAsync || !enabled) return;\n const loader = loaderRef.current;\n if (!loader) return;\n\n const requestId = ++requestIdRef.current;\n let cancelled = false;\n setState((prev) => ({ ...prev, loading: true, error: false }));\n\n Promise.resolve()\n .then(() => loader(debouncedQuery))\n .then((result) => {\n // Ignore stale responses (out-of-order guard).\n if (cancelled || requestId !== requestIdRef.current) return;\n const cache = getFieldOptionCache(field);\n for (const opt of result) cache.set(opt.value, opt);\n setState({ options: result, loading: false, error: false });\n })\n .catch(() => {\n if (cancelled || requestId !== requestIdRef.current) return;\n setState((prev) => ({ ...prev, loading: false, error: true }));\n });\n\n return () => {\n cancelled = true;\n };\n }, [isAsync, enabled, debouncedQuery, field]);\n\n const resolveSelected = useCallback(\n (values: T[]): FilterOption<T>[] => {\n const cache = getFieldOptionCache(field);\n return values.map((value) => cache.get(value) ?? { value, label: String(value) });\n },\n [field],\n );\n\n if (!isAsync) {\n return {\n isAsync: false,\n options: field.options ?? [],\n loading: false,\n error: false,\n resolveSelected,\n };\n }\n\n return {\n isAsync: true,\n options: state.options,\n loading: state.loading,\n error: state.error,\n resolveSelected,\n };\n}\n\n// Helper function to create operators from i18n config\nconst createOperatorsFromI18n = (i18n: FilterI18nConfig): Record<string, FilterOperator[]> => ({\n select: [\n { value: \"is\", label: i18n.operators.is },\n { value: \"is_not\", label: i18n.operators.isNot },\n { value: \"empty\", label: i18n.operators.empty },\n { value: \"not_empty\", label: i18n.operators.notEmpty },\n ],\n multiselect: [\n { value: \"is_any_of\", label: i18n.operators.isAnyOf },\n { value: \"is_not_any_of\", label: i18n.operators.isNotAnyOf },\n { value: \"includes_all\", label: i18n.operators.includesAll },\n { value: \"excludes_all\", label: i18n.operators.excludesAll },\n { value: \"empty\", label: i18n.operators.empty },\n { value: \"not_empty\", label: i18n.operators.notEmpty },\n ],\n text: [\n { value: \"contains\", label: i18n.operators.contains },\n { value: \"not_contains\", label: i18n.operators.notContains },\n { value: \"starts_with\", label: i18n.operators.startsWith },\n { value: \"ends_with\", label: i18n.operators.endsWith },\n { value: \"is\", label: i18n.operators.isExactly },\n { value: \"empty\", label: i18n.operators.empty },\n { value: \"not_empty\", label: i18n.operators.notEmpty },\n ],\n custom: [\n { value: \"is\", label: i18n.operators.is },\n { value: \"after\", label: i18n.operators.after },\n { value: \"between\", label: i18n.operators.between },\n { value: \"empty\", label: i18n.operators.empty },\n { value: \"not_empty\", label: i18n.operators.notEmpty },\n ],\n});\n\n// Default operators for different field types (using default i18n)\nexport const DEFAULT_OPERATORS: Record<string, FilterOperator[]> =\n createOperatorsFromI18n(DEFAULT_I18N);\n\n// Helper function to get operators for a field\nconst getOperatorsForField = <T = unknown>(\n field: FilterFieldConfig<T>,\n values: T[],\n i18n: FilterI18nConfig,\n): FilterOperator[] => {\n if (field.operators) return field.operators;\n\n const operators = createOperatorsFromI18n(i18n);\n\n // Determine field type for operator selection\n let fieldType = field.type || \"select\";\n\n // If it's a select field but has multiple values, treat as multiselect\n if (fieldType === \"select\" && values.length > 1) {\n fieldType = \"multiselect\";\n }\n\n // If it's a multiselect field or has multiselect operators, use multiselect operators\n if (fieldType === \"multiselect\" || field.type === \"multiselect\") {\n return operators.multiselect;\n }\n\n return operators[fieldType] || operators.select;\n};\n\ninterface FilterOperatorDropdownProps<T = unknown> {\n field: FilterFieldConfig<T>;\n operator: string;\n values: T[];\n onChange: (operator: string) => void;\n}\n\nfunction FilterOperatorDropdown<T = unknown>({\n field,\n operator,\n values,\n onChange,\n}: FilterOperatorDropdownProps<T>) {\n const context = useFilterContext();\n const operators = useMemo(\n () => getOperatorsForField(field, values, context.i18n),\n [field, values, context.i18n],\n );\n\n // Find the operator label, with fallback to formatted operator name\n const operatorLabel =\n operators.find((op) => op.value === operator)?.label ||\n context.i18n.helpers.formatOperator(operator);\n\n return (\n <DropdownMenu>\n <DropdownMenuTrigger\n render={\n <Button\n variant=\"outline\"\n size={context.size}\n className=\"text-muted-foreground hover:text-foreground\"\n >\n {operatorLabel}\n </Button>\n }\n />\n <DropdownMenuContent align=\"start\" className=\"w-fit min-w-fit\">\n {operators.map((op) => (\n <DropdownMenuItem\n key={op.value}\n onClick={() => onChange(op.value)}\n className={cn(\n \"flex items-center justify-between data-highlighted:bg-accent data-highlighted:text-accent-foreground\",\n )}\n >\n <span>{op.label}</span>\n <CheckIcon\n className={cn(\n \"ms-auto text-primary\",\n op.value === operator ? \"opacity-100\" : \"opacity-0\",\n )}\n />\n </DropdownMenuItem>\n ))}\n </DropdownMenuContent>\n </DropdownMenu>\n );\n}\n\ninterface FilterValueSelectorProps<T = unknown> {\n field: FilterFieldConfig<T>;\n values: T[];\n onChange: (values: T[]) => void;\n operator: string;\n autoFocus?: boolean;\n}\n\ninterface SelectOptionsPopoverProps<T = unknown> {\n field: FilterFieldConfig<T>;\n values: T[];\n onChange: (values: T[]) => void;\n onClose?: () => void;\n inline?: boolean;\n}\n\nfunction SelectOptionsPopover<T = unknown>({\n field,\n values,\n onChange,\n onClose,\n inline = false,\n}: SelectOptionsPopoverProps<T>) {\n const [open, setOpen] = useState(false);\n const [searchInput, setSearchInput] = useState(\"\");\n const [highlightedIndex, setHighlightedIndex] = useState(-1);\n const inputRef = useRef<HTMLInputElement>(null);\n const context = useFilterContext();\n const baseId = useId();\n\n useEffect(() => {\n if (open) {\n inputRef.current?.focus();\n }\n }, [open]);\n\n useEffect(() => {\n setHighlightedIndex(-1);\n }, []);\n\n useEffect(() => {\n if (highlightedIndex >= 0 && open) {\n const element = document.getElementById(`${baseId}-item-${highlightedIndex}`);\n element?.scrollIntoView({ block: \"nearest\" });\n }\n }, [highlightedIndex, open, baseId]);\n\n const {\n isAsync,\n options: resolvedOptions,\n loading,\n error,\n resolveSelected,\n } = useFieldOptions(field, searchInput, inline || open);\n\n const isMultiSelect = field.type === \"multiselect\" || values.length > 1;\n const effectiveValues = (field.value !== undefined ? (field.value as T[]) : values) || [];\n\n // Static fields read their list verbatim (unchanged legacy behavior). Async\n // fields resolve selected values from the value->label cache and take the\n // loader's (already query-filtered) result as the unselected list.\n const selectedOptions = isAsync\n ? resolveSelected(effectiveValues)\n : field.options?.filter((opt) => effectiveValues.includes(opt.value)) || [];\n const unselectedOptions = isAsync\n ? resolvedOptions.filter((opt) => !effectiveValues.includes(opt.value))\n : field.options?.filter((opt) => !effectiveValues.includes(opt.value)) || [];\n\n // Filter options based on search input (client-side for static lists; async\n // loaders have already filtered by the query).\n const filteredSelectedOptions = selectedOptions; // Keep all selected visible\n const filteredUnselectedOptions = isAsync\n ? unselectedOptions\n : unselectedOptions.filter((opt) =>\n opt.label.toLowerCase().includes(searchInput.toLowerCase()),\n );\n\n const allFilteredOptions = useMemo(\n () => [...filteredSelectedOptions, ...filteredUnselectedOptions],\n [filteredSelectedOptions, filteredUnselectedOptions],\n );\n\n const handleClose = () => {\n setOpen(false);\n onClose?.();\n };\n\n // Toggle a single option, shared by the plain and custom (renderOptionList)\n // renderers so both behave identically.\n const toggleOption = (option: FilterOption<T>) => {\n const isSelected = effectiveValues.includes(option.value);\n const next = isSelected\n ? (effectiveValues.filter((v) => v !== option.value) as T[])\n : isMultiSelect\n ? ([...effectiveValues, option.value] as T[])\n : ([option.value] as T[]);\n\n if (!isSelected && isMultiSelect && field.maxSelections && next.length > field.maxSelections) {\n return;\n }\n\n if (field.onValueChange) {\n field.onValueChange(next);\n } else {\n onChange(next);\n }\n if (!isMultiSelect) handleClose();\n };\n\n const renderOptionItem = (option: FilterOption<T>, overallIndex: number) => {\n const isSelected = effectiveValues.includes(option.value);\n const isHighlighted = highlightedIndex === overallIndex;\n const itemId = `${baseId}-item-${overallIndex}`;\n\n return (\n <DropdownMenuCheckboxItem\n key={String(option.value)}\n id={itemId}\n role=\"option\"\n aria-selected={isHighlighted}\n data-highlighted={isHighlighted || undefined}\n onMouseEnter={() => setHighlightedIndex(overallIndex)}\n checked={isSelected}\n className={cn(\n \"data-highlighted:bg-accent data-highlighted:text-accent-foreground\",\n option.className,\n )}\n onSelect={(e) => {\n if (isMultiSelect) e.preventDefault();\n }}\n onCheckedChange={() => toggleOption(option)}\n >\n {option.icon && option.icon}\n <span className=\"truncate\">{option.label}</span>\n </DropdownMenuCheckboxItem>\n );\n };\n\n const renderMenuContent = () => (\n <>\n {field.searchable !== false && (\n <>\n <Input\n ref={inputRef}\n role=\"combobox\"\n aria-autocomplete=\"list\"\n aria-expanded={true}\n aria-haspopup=\"listbox\"\n aria-controls={`${baseId}-listbox`}\n aria-activedescendant={\n highlightedIndex >= 0 ? `${baseId}-item-${highlightedIndex}` : undefined\n }\n placeholder={context.i18n.placeholders.searchField(field.label || \"\")}\n className={cn(\n \"h-8 rounded-none border-0 border-input bg-transparent! px-2 text-sm shadow-none\",\n \"focus-visible:border-border focus-visible:ring-0 focus-visible:ring-offset-0\",\n open && \"placeholder:text-foreground\",\n )}\n value={searchInput}\n onChange={(e) => setSearchInput(e.target.value)}\n onBlur={() => open && inputRef.current?.focus()}\n onClick={(e) => e.stopPropagation()}\n onKeyDown={(e) => {\n if (e.key === \"ArrowDown\") {\n e.preventDefault();\n if (allFilteredOptions.length > 0) {\n setHighlightedIndex((prev) =>\n prev < allFilteredOptions.length - 1 ? prev + 1 : 0,\n );\n }\n } else if (e.key === \"ArrowUp\") {\n e.preventDefault();\n if (allFilteredOptions.length > 0) {\n setHighlightedIndex((prev) =>\n prev > 0 ? prev - 1 : allFilteredOptions.length - 1,\n );\n }\n } else if (e.key === \"ArrowLeft\") {\n e.preventDefault();\n setOpen(false);\n } else if (e.key === \"Enter\" && highlightedIndex >= 0) {\n e.preventDefault();\n const option = allFilteredOptions[highlightedIndex];\n if (option) {\n const isSelected = effectiveValues.includes(option.value as T);\n const next = isSelected\n ? (effectiveValues.filter((v) => v !== option.value) as T[])\n : isMultiSelect\n ? ([...effectiveValues, option.value] as T[])\n : ([option.value] as T[]);\n\n if (\n !isSelected &&\n isMultiSelect &&\n field.maxSelections &&\n next.length > field.maxSelections\n ) {\n return;\n }\n\n if (field.onValueChange) {\n field.onValueChange(next);\n } else {\n onChange(next);\n }\n if (!isMultiSelect) handleClose();\n }\n }\n e.stopPropagation();\n }}\n />\n <DropdownMenuSeparator />\n </>\n )}\n <div className=\"relative flex max-h-full\">\n <div\n className=\"flex max-h-[min(var(--available-height),24rem)] w-full scroll-pt-2 scroll-pb-2 flex-col overscroll-contain\"\n role=\"listbox\"\n id={`${baseId}-listbox`}\n >\n {isAsync && loading && allFilteredOptions.length === 0 ? (\n <div className=\"py-2 text-center text-muted-foreground text-sm\">\n {context.i18n.loadingOptions ?? DEFAULT_I18N.loadingOptions}\n </div>\n ) : isAsync && error ? (\n <div className=\"py-2 text-center text-muted-foreground text-sm\">\n {context.i18n.errorLoadingOptions ?? DEFAULT_I18N.errorLoadingOptions}\n </div>\n ) : allFilteredOptions.length === 0 ? (\n <div className=\"py-2 text-center text-muted-foreground text-sm\">\n {context.i18n.noResultsFound}\n </div>\n ) : field.renderOptionList ? (\n field.renderOptionList({\n options: allFilteredOptions,\n highlightedIndex,\n renderOption: renderOptionItem,\n })\n ) : (\n <ScrollArea className=\"size-full min-h-0 **:data-[slot=scroll-area-scrollbar]:m-0 **:data-[slot=scroll-area-viewport]:h-full **:data-[slot=scroll-area-viewport]:overscroll-contain\">\n {/* Selected items */}\n {filteredSelectedOptions.length > 0 && (\n <DropdownMenuGroup className=\"px-1\">\n {filteredSelectedOptions.map((option, index) => renderOptionItem(option, index))}\n </DropdownMenuGroup>\n )}\n\n {/* Separator */}\n {filteredSelectedOptions.length > 0 && filteredUnselectedOptions.length > 0 && (\n <DropdownMenuSeparator className=\"mx-0\" />\n )}\n\n {/* Available items */}\n {filteredUnselectedOptions.length > 0 && (\n <DropdownMenuGroup className=\"px-1\">\n {filteredUnselectedOptions.map((option, index) =>\n renderOptionItem(option, index + filteredSelectedOptions.length),\n )}\n </DropdownMenuGroup>\n )}\n </ScrollArea>\n )}\n </div>\n </div>\n </>\n );\n\n if (inline) {\n return <div className=\"w-full\">{renderMenuContent()}</div>;\n }\n\n return (\n <DropdownMenu\n open={open}\n onOpenChange={(open) => {\n setOpen(open);\n if (!open) {\n setTimeout(() => setSearchInput(\"\"), 200);\n }\n }}\n >\n <DropdownMenuTrigger\n render={\n <Button variant=\"outline\" size={context.size}>\n <div className=\"flex items-center gap-1.5\">\n {field.customValueRenderer ? (\n field.customValueRenderer(\n values,\n isAsync ? resolveSelected(values) : field.options || [],\n )\n ) : (\n <>\n {selectedOptions.length > 0 && (\n <div className=\"flex items-center -space-x-1.5\">\n {selectedOptions.slice(0, 3).map((option) => (\n <div key={String(option.value)}>{option.icon}</div>\n ))}\n </div>\n )}\n {selectedOptions.length === 1\n ? selectedOptions[0].label\n : selectedOptions.length > 1\n ? `${selectedOptions.length} ${context.i18n.selectedCount}`\n : context.i18n.select}\n </>\n )}\n </div>\n </Button>\n }\n />\n <DropdownMenuContent align=\"start\" className={cn(\"w-[200px] px-0\", field.className)}>\n {renderMenuContent()}\n </DropdownMenuContent>\n </DropdownMenu>\n );\n}\n\nfunction FilterValueSelector<T = unknown>({\n field,\n values,\n onChange,\n operator,\n autoFocus,\n}: FilterValueSelectorProps<T>) {\n if (operator === \"empty\" || operator === \"not_empty\") {\n return null;\n }\n\n if (field.customRenderer) {\n return (\n <ButtonGroupText className=\"whitespace-nowrap bg-background text-start outline-hidden hover:bg-accent aria-expanded:bg-accent dark:bg-input/30\">\n {field.customRenderer({ field, values, onChange, operator })}\n </ButtonGroupText>\n );\n }\n\n if (field.type === \"text\") {\n return (\n <FilterInput\n type=\"text\"\n value={(values[0] as string) || \"\"}\n onChange={(e) => onChange([e.target.value] as T[])}\n placeholder={field.placeholder}\n pattern={field.pattern}\n field={field}\n className={cn(\"w-36\", field.className)}\n autoFocus={autoFocus}\n />\n );\n }\n\n if (field.type === \"select\" || field.type === \"multiselect\") {\n return <SelectOptionsPopover field={field} values={values} onChange={onChange} />;\n }\n\n return <SelectOptionsPopover field={field} values={values} onChange={onChange} />;\n}\nexport interface Filter<T = unknown> {\n id: string;\n field: string;\n operator: string;\n values: T[];\n}\n\nexport interface FilterGroup<T = unknown> {\n id: string;\n label?: string;\n filters: Filter<T>[];\n fields: FilterFieldConfig<T>[];\n}\n\ninterface FiltersContentProps<T = unknown> {\n filters: Filter<T>[];\n fields: FilterFieldsConfig<T>;\n onChange: (filters: Filter<T>[]) => void;\n}\n\nexport const FiltersContent = <T = unknown>({\n filters,\n fields,\n onChange,\n}: FiltersContentProps<T>) => {\n const context = useFilterContext();\n const fieldsMap = useMemo(() => getFieldsMap(fields), [fields]);\n\n const updateFilter = useCallback(\n (filterId: string, updates: Partial<Filter<T>>) => {\n onChange(\n filters.map((filter) => {\n if (filter.id === filterId) {\n const updatedFilter = { ...filter, ...updates };\n if (updates.operator === \"empty\" || updates.operator === \"not_empty\") {\n updatedFilter.values = [] as T[];\n }\n return updatedFilter;\n }\n return filter;\n }),\n );\n },\n [filters, onChange],\n );\n\n const removeFilter = useCallback(\n (filterId: string) => {\n onChange(filters.filter((filter) => filter.id !== filterId));\n },\n [filters, onChange],\n );\n\n return (\n <div\n className={cn(\n filtersContainerVariants({\n variant: context.variant,\n size: context.size,\n }),\n context.className,\n )}\n >\n {filters.map((filter) => {\n const field = fieldsMap[filter.field];\n if (!field) return null;\n\n return (\n <ButtonGroup\n key={filter.id}\n // Sera is an underline style: its group text and input group carry\n // only a bottom border. Normalise the boxed segments (the operator,\n // value and remove buttons) to the same treatment so the whole chip\n // reads as one underlined group instead of mixing boxes and rules.\n className=\"\"\n >\n <ButtonGroupText>\n {field.icon && field.icon}\n {field.label}\n </ButtonGroupText>\n\n <FilterOperatorDropdown<T>\n field={field}\n operator={filter.operator}\n values={filter.values}\n onChange={(operator) => updateFilter(filter.id, { operator })}\n />\n\n <FilterValueSelector<T>\n field={field}\n values={filter.values}\n onChange={(values) => updateFilter(filter.id, { values })}\n operator={filter.operator}\n autoFocus={false}\n />\n\n <FilterRemoveButton onClick={() => removeFilter(filter.id)} />\n </ButtonGroup>\n );\n })}\n </div>\n );\n};\n\ninterface FiltersProps<T = unknown> {\n filters: Filter<T>[];\n fields: FilterFieldsConfig<T>;\n onChange: (filters: Filter<T>[]) => void;\n className?: string;\n variant?: \"solid\" | \"default\";\n size?: \"sm\" | \"default\" | \"lg\";\n radius?: \"default\" | \"full\";\n i18n?: Partial<FilterI18nConfig>;\n showSearchInput?: boolean;\n trigger?: React.ReactNode;\n allowMultiple?: boolean;\n menuPopupClassName?: string;\n collapseAddButton?: boolean;\n enableShortcut?: boolean;\n shortcutKey?: string;\n shortcutLabel?: string;\n}\n\ninterface FilterSubmenuContentProps<T = unknown> {\n field: FilterFieldConfig<T>;\n currentValues: T[];\n isMultiSelect: boolean;\n onToggle: (value: T, isSelected: boolean) => void;\n i18n: FilterI18nConfig;\n isActive?: boolean;\n onActive?: () => void;\n onBack?: () => void;\n onClose?: () => void;\n}\n\nfunction FilterSubmenuContent<T = unknown>({\n field,\n currentValues,\n isMultiSelect,\n onToggle,\n i18n,\n isActive,\n onActive,\n onBack,\n onClose,\n}: FilterSubmenuContentProps<T>) {\n const [searchInput, setSearchInput] = useState(\"\");\n const [highlightedIndex, setHighlightedIndex] = useState(-1);\n const inputRef = useRef<HTMLInputElement>(null);\n const baseId = useId();\n\n const {\n isAsync,\n options: resolvedOptions,\n loading,\n error,\n resolveSelected,\n } = useFieldOptions(field, searchInput, true);\n\n useEffect(() => {\n if (isActive) {\n if (field.searchable !== false) {\n inputRef.current?.focus();\n } else {\n const listbox = document.getElementById(`${baseId}-listbox`);\n listbox?.focus();\n }\n }\n }, [isActive, field.searchable, baseId]);\n\n useEffect(() => {\n setHighlightedIndex(-1);\n }, []);\n\n useEffect(() => {\n if (highlightedIndex >= 0 && isActive) {\n const element = document.getElementById(`${baseId}-item-${highlightedIndex}`);\n element?.scrollIntoView({ block: \"nearest\" });\n }\n }, [highlightedIndex, isActive, baseId]);\n\n const filteredOptions = useMemo(() => {\n // Async fields: keep selected values first (resolved from cache so they\n // stay labelled), then the loader's already-query-filtered results.\n if (isAsync) {\n const selectedSet = new Set(currentValues);\n return [\n ...resolveSelected(currentValues),\n ...resolvedOptions.filter((option) => !selectedSet.has(option.value)),\n ];\n }\n return (\n field.options?.filter((option) => {\n const isSelected = currentValues.includes(option.value);\n if (isSelected) return true;\n if (!searchInput) return true;\n return option.label.toLowerCase().includes(searchInput.toLowerCase());\n }) || []\n );\n }, [isAsync, resolvedOptions, resolveSelected, field.options, searchInput, currentValues]);\n\n const renderOptionItem = (option: FilterOption<T>, index: number) => {\n const isSelected = currentValues.includes(option.value);\n const isHighlighted = highlightedIndex === index;\n const itemId = `${baseId}-item-${index}`;\n\n return (\n <DropdownMenuCheckboxItem\n key={String(option.value)}\n id={itemId}\n role=\"option\"\n aria-selected={isHighlighted}\n data-highlighted={isHighlighted || undefined}\n onMouseEnter={() => setHighlightedIndex(index)}\n checked={isSelected}\n className={cn(\n \"data-highlighted:bg-accent data-highlighted:text-accent-foreground\",\n option.className,\n )}\n onSelect={(e) => {\n if (isMultiSelect) e.preventDefault();\n }}\n onCheckedChange={() => onToggle(option.value as T, isSelected)}\n >\n {option.icon && option.icon}\n <span className=\"truncate\">{option.label}</span>\n </DropdownMenuCheckboxItem>\n );\n };\n\n useEffect(() => {\n if (isActive && filteredOptions.length > 0) {\n setHighlightedIndex(0);\n }\n }, [isActive, filteredOptions.length]);\n\n return (\n <div className=\"flex flex-col\" onMouseEnter={onActive}>\n {field.searchable !== false && (\n <>\n <Input\n ref={inputRef}\n role=\"combobox\"\n aria-autocomplete=\"list\"\n aria-expanded={true}\n aria-haspopup=\"listbox\"\n aria-controls={`${baseId}-listbox`}\n aria-activedescendant={\n highlightedIndex >= 0 ? `${baseId}-item-${highlightedIndex}` : undefined\n }\n placeholder={i18n.placeholders.searchField(field.label || \"\")}\n className={cn(\n \"h-8 rounded-none border-0 bg-transparent! px-2 text-sm shadow-none\",\n \"focus-visible:border-border focus-visible:ring-0 focus-visible:ring-offset-0\",\n isActive && \"placeholder:text-foreground\",\n )}\n value={searchInput}\n onBlur={() => isActive && inputRef.current?.focus()}\n onChange={(e) => setSearchInput(e.target.value)}\n onFocus={() => onActive?.()}\n onMouseEnter={(e) => {\n onActive?.();\n e.stopPropagation();\n }}\n onClick={(e) => e.stopPropagation()}\n onKeyDown={(e) => {\n if (e.key === \"ArrowDown\") {\n e.preventDefault();\n if (filteredOptions.length > 0) {\n setHighlightedIndex((prev) => (prev < filteredOptions.length - 1 ? prev + 1 : 0));\n }\n } else if (e.key === \"ArrowUp\") {\n e.preventDefault();\n if (filteredOptions.length > 0) {\n setHighlightedIndex((prev) => (prev > 0 ? prev - 1 : filteredOptions.length - 1));\n }\n } else if (e.key === \"ArrowLeft\") {\n e.preventDefault();\n onBack?.();\n } else if (e.key === \"Enter\" && highlightedIndex >= 0) {\n e.preventDefault();\n const option = filteredOptions[highlightedIndex];\n if (option) {\n onToggle(option.value as T, currentValues.includes(option.value));\n if (!isMultiSelect) {\n onBack?.();\n }\n }\n } else if (e.key === \"Escape\") {\n e.preventDefault();\n onClose?.();\n }\n e.stopPropagation();\n }}\n />\n <DropdownMenuSeparator />\n </>\n )}\n <div className=\"relative flex max-h-full\">\n <div\n className=\"flex max-h-[min(var(--available-height),24rem)] w-full scroll-pt-2 scroll-pb-2 flex-col overscroll-contain outline-hidden\"\n role=\"listbox\"\n id={`${baseId}-listbox`}\n tabIndex={field.searchable === false ? 0 : -1}\n onKeyDown={(e) => {\n if (field.searchable === false) {\n if (e.key === \"ArrowDown\") {\n e.preventDefault();\n if (filteredOptions.length > 0) {\n setHighlightedIndex((prev) => (prev < filteredOptions.length - 1 ? prev + 1 : 0));\n }\n } else if (e.key === \"ArrowUp\") {\n e.preventDefault();\n if (filteredOptions.length > 0) {\n setHighlightedIndex((prev) => (prev > 0 ? prev - 1 : filteredOptions.length - 1));\n }\n } else if (e.key === \"ArrowLeft\") {\n e.preventDefault();\n onBack?.();\n } else if (e.key === \"Enter\" && highlightedIndex >= 0) {\n e.preventDefault();\n const option = filteredOptions[highlightedIndex];\n if (option) {\n onToggle(option.value as T, currentValues.includes(option.value));\n if (!isMultiSelect) {\n onBack?.();\n }\n }\n } else if (e.key === \"Escape\") {\n e.preventDefault();\n onClose?.();\n }\n e.stopPropagation();\n }\n }}\n >\n {isAsync && loading && filteredOptions.length === 0 ? (\n <div className=\"py-2 text-center text-muted-foreground text-sm\">\n {i18n.loadingOptions ?? DEFAULT_I18N.loadingOptions}\n </div>\n ) : isAsync && error ? (\n <div className=\"py-2 text-center text-muted-foreground text-sm\">\n {i18n.errorLoadingOptions ?? DEFAULT_I18N.errorLoadingOptions}\n </div>\n ) : filteredOptions.length === 0 ? (\n <div className=\"py-2 text-center text-muted-foreground text-sm\">\n {i18n.noResultsFound}\n </div>\n ) : field.renderOptionList ? (\n field.renderOptionList({\n options: filteredOptions,\n highlightedIndex,\n renderOption: renderOptionItem,\n })\n ) : (\n <ScrollArea className=\"size-full min-h-0 **:data-[slot=scroll-area-scrollbar]:m-0 **:data-[slot=scroll-area-viewport]:h-full **:data-[slot=scroll-area-viewport]:overscroll-contain\">\n <DropdownMenuGroup>\n {filteredOptions.map((option, index) => renderOptionItem(option, index))}\n </DropdownMenuGroup>\n </ScrollArea>\n )}\n </div>\n </div>\n </div>\n );\n}\n\nexport function Filters<T = unknown>({\n filters,\n fields,\n onChange,\n className,\n variant = \"default\",\n size = \"default\",\n radius = \"default\",\n i18n,\n showSearchInput = true,\n trigger,\n allowMultiple = true,\n menuPopupClassName,\n enableShortcut = false,\n shortcutKey = \"f\",\n shortcutLabel = \"F\",\n}: FiltersProps<T>) {\n const [addFilterOpen, setAddFilterOpen] = useState(false);\n const [menuSearchInput, setMenuSearchInput] = useState(\"\");\n const [activeMenu, setActiveMenu] = useState<string>(\"root\");\n const [openSubMenu, setOpenSubMenu] = useState<string | null>(null);\n const [highlightedIndex, setHighlightedIndex] = useState(-1);\n const [lastAddedFilterId, setLastAddedFilterId] = useState<string | null>(null);\n const rootInputRef = useRef<HTMLInputElement>(null);\n const rootId = useId();\n\n useEffect(() => {\n if (!enableShortcut) return;\n\n const handleKeyDown = (e: KeyboardEvent) => {\n if (\n e.key.toLowerCase() === shortcutKey.toLowerCase() &&\n !addFilterOpen &&\n !(\n document.activeElement instanceof HTMLInputElement ||\n document.activeElement instanceof HTMLTextAreaElement\n )\n ) {\n e.preventDefault();\n setAddFilterOpen(true);\n }\n };\n\n window.addEventListener(\"keydown\", handleKeyDown);\n return () => window.removeEventListener(\"keydown\", handleKeyDown);\n }, [enableShortcut, shortcutKey, addFilterOpen]);\n\n useEffect(() => {\n if (addFilterOpen && activeMenu === \"root\") {\n rootInputRef.current?.focus();\n }\n }, [addFilterOpen, activeMenu]);\n\n useEffect(() => {\n setHighlightedIndex(-1);\n }, []);\n\n useEffect(() => {\n if (highlightedIndex >= 0 && addFilterOpen) {\n const element = document.getElementById(`${rootId}-item-${highlightedIndex}`);\n element?.scrollIntoView({ block: \"nearest\" });\n }\n }, [highlightedIndex, addFilterOpen, rootId]);\n\n useEffect(() => {\n if (!addFilterOpen) {\n setOpenSubMenu(null);\n }\n }, [addFilterOpen]);\n\n // Track which filter instance is being built in the current Add Filter menu session\n // Maps fieldKey -> unique filterId created during this open session\n const [sessionFilterIds, setSessionFilterIds] = useState<Record<string, string>>({});\n\n useEffect(() => {\n if (lastAddedFilterId) {\n const timer = setTimeout(() => {\n setLastAddedFilterId(null);\n }, 1000);\n return () => clearTimeout(timer);\n }\n }, [lastAddedFilterId]);\n\n const mergedI18n: FilterI18nConfig = useMemo(\n () => ({\n ...DEFAULT_I18N,\n ...i18n,\n operators: { ...DEFAULT_I18N.operators, ...i18n?.operators },\n placeholders: { ...DEFAULT_I18N.placeholders, ...i18n?.placeholders },\n validation: { ...DEFAULT_I18N.validation, ...i18n?.validation },\n }),\n [i18n],\n );\n\n const fieldsMap = useMemo(() => getFieldsMap(fields), [fields]);\n\n const updateFilter = useCallback(\n (filterId: string, updates: Partial<Filter<T>>) => {\n onChange(\n filters.map((filter) => {\n if (filter.id === filterId) {\n const updatedFilter = { ...filter, ...updates };\n if (updates.operator === \"empty\" || updates.operator === \"not_empty\") {\n updatedFilter.values = [] as T[];\n }\n return updatedFilter;\n }\n return filter;\n }),\n );\n },\n [filters, onChange],\n );\n\n const removeFilter = useCallback(\n (filterId: string) => {\n onChange(filters.filter((filter) => filter.id !== filterId));\n },\n [filters, onChange],\n );\n\n const addFilter = useCallback(\n (fieldKey: string) => {\n const field = fieldsMap[fieldKey];\n if (field?.key) {\n const defaultOperator =\n field.defaultOperator || (field.type === \"multiselect\" ? \"is_any_of\" : \"is\");\n const defaultValues: unknown[] = field.type === \"text\" ? [\"\"] : [];\n const newFilter = createFilter<T>(fieldKey, defaultOperator, defaultValues as T[]);\n setLastAddedFilterId(newFilter.id);\n onChange([...filters, newFilter]);\n setAddFilterOpen(false);\n setMenuSearchInput(\"\");\n }\n },\n [fieldsMap, filters, onChange],\n );\n\n const selectableFields = useMemo(() => {\n const flatFields = flattenFields(fields);\n return flatFields.filter((field) => {\n if (!field.key || field.type === \"separator\") return false;\n if (allowMultiple) return true;\n return !filters.some((filter) => filter.field === field.key);\n });\n }, [fields, filters, allowMultiple]);\n\n const filteredFields = useMemo(() => {\n return selectableFields.filter(\n (f) => !menuSearchInput || f.label?.toLowerCase().includes(menuSearchInput.toLowerCase()),\n );\n }, [selectableFields, menuSearchInput]);\n\n useEffect(() => {\n if (addFilterOpen && filteredFields.length > 0) {\n setHighlightedIndex(0);\n }\n }, [addFilterOpen, filteredFields.length]);\n\n const triggerButton = useRender({\n render: (trigger as React.ReactElement) ?? (\n <Button variant=\"outline\">\n <PlusIcon />\n {mergedI18n.addFilter}\n </Button>\n ),\n defaultTagName: \"button\",\n });\n\n const contextValue = useMemo<FilterContextValue>(\n () => ({\n variant,\n size,\n radius,\n i18n: mergedI18n,\n className,\n trigger,\n allowMultiple,\n }),\n [variant, size, radius, mergedI18n, className, trigger, allowMultiple],\n );\n\n return (\n <FilterContext.Provider value={contextValue}>\n <div className={cn(filtersContainerVariants({ variant, size }), className)}>\n {selectableFields.length > 0 && (\n <DropdownMenu\n open={addFilterOpen}\n onOpenChange={(open) => {\n setAddFilterOpen(open);\n if (!open) {\n setMenuSearchInput(\"\");\n setSessionFilterIds({});\n } else {\n setActiveMenu(\"root\");\n }\n }}\n >\n <DropdownMenuTrigger render={triggerButton} />\n <DropdownMenuContent className={cn(\"w-[220px]\", menuPopupClassName)} align=\"start\">\n {showSearchInput && (\n <>\n <div className=\"relative\">\n <Input\n ref={rootInputRef}\n role=\"combobox\"\n aria-controls={`${rootId}-listbox`}\n aria-activedescendant={\n highlightedIndex >= 0 ? `${rootId}-item-${highlightedIndex}` : undefined\n }\n placeholder={mergedI18n.searchFields}\n className={cn(\n \"h-8 rounded-none border-0 bg-transparent! px-2 text-sm shadow-none\",\n \"focus-visible:border-border focus-visible:ring-0 focus-visible:ring-offset-0\",\n activeMenu === \"root\" && \"placeholder:text-foreground\",\n )}\n value={menuSearchInput}\n onFocus={() => setActiveMenu(\"root\")}\n onMouseEnter={() => setActiveMenu(\"root\")}\n onBlur={() => activeMenu === \"root\" && rootInputRef.current?.focus()}\n onChange={(e) => setMenuSearchInput(e.target.value)}\n onClick={(e) => e.stopPropagation()}\n onKeyDown={(e) => {\n if (e.key === \"ArrowDown\") {\n e.preventDefault();\n if (filteredFields.length > 0) {\n setHighlightedIndex((prev) =>\n prev < filteredFields.length - 1 ? prev + 1 : 0,\n );\n }\n } else if (e.key === \"ArrowUp\") {\n e.preventDefault();\n if (filteredFields.length > 0) {\n setHighlightedIndex((prev) =>\n prev > 0 ? prev - 1 : filteredFields.length - 1,\n );\n }\n } else if (\n (e.key === \"ArrowRight\" || e.key === \"ArrowLeft\") &&\n highlightedIndex >= 0\n ) {\n const field = filteredFields[highlightedIndex];\n const hasSubMenu =\n field &&\n (field.type === \"select\" || field.type === \"multiselect\") &&\n fieldHasOptions(field);\n\n if (e.key === \"ArrowRight\" && hasSubMenu) {\n e.preventDefault();\n setOpenSubMenu(field.key || null);\n setActiveMenu(field.key || \"root\");\n } else if (e.key === \"ArrowLeft\") {\n e.preventDefault();\n if (openSubMenu) {\n setOpenSubMenu(null);\n setActiveMenu(\"root\");\n }\n }\n } else if (e.key === \"Enter\" && highlightedIndex >= 0) {\n e.preventDefault();\n const field = filteredFields[highlightedIndex];\n if (field.key) {\n const hasSubMenu =\n (field.type === \"select\" || field.type === \"multiselect\") &&\n fieldHasOptions(field);\n if (!hasSubMenu) {\n addFilter(field.key);\n } else {\n if (openSubMenu === field.key) {\n setOpenSubMenu(null);\n setActiveMenu(\"root\");\n } else {\n setOpenSubMenu(field.key);\n setActiveMenu(field.key);\n }\n }\n }\n } else if (e.key === \"Escape\") {\n setAddFilterOpen(false);\n }\n e.stopPropagation();\n }}\n />\n {enableShortcut && shortcutLabel && (\n <Kbd className=\"absolute top-1/2 right-2 -translate-y-1/2 border bg-background\">\n {shortcutLabel}\n </Kbd>\n )}\n </div>\n <DropdownMenuSeparator />\n </>\n )}\n\n <div className=\"relative flex max-h-full\">\n <div\n className=\"flex max-h-[min(var(--available-height),24rem)] w-full scroll-pt-2 scroll-pb-2 flex-col overscroll-contain\"\n role=\"listbox\"\n id={`${rootId}-listbox`}\n onMouseEnter={() => setActiveMenu(\"root\")}\n >\n <ScrollArea className=\"**:data-[slot=scroll-area-scrollbar]:m-0\">\n {(() => {\n if (filteredFields.length === 0) {\n return (\n <div className=\"py-2 text-center text-muted-foreground text-sm\">\n {mergedI18n.noFieldsFound}\n </div>\n );\n }\n\n return filteredFields.map((field, index) => {\n const isHighlighted = highlightedIndex === index;\n const itemId = `${rootId}-item-${index}`;\n const hasSubMenu =\n (field.type === \"select\" || field.type === \"multiselect\") &&\n fieldHasOptions(field);\n\n if (hasSubMenu) {\n const isMultiSelect = field.type === \"multiselect\";\n const fieldKey = field.key as string;\n const sessionFilterId = sessionFilterIds[fieldKey];\n const sessionFilter = sessionFilterId\n ? filters.find((f) => f.id === sessionFilterId)\n : null;\n const currentValues = sessionFilter?.values || [];\n\n return (\n <DropdownMenuSub\n key={fieldKey}\n open={openSubMenu === fieldKey}\n onOpenChange={(open) => {\n if (open) {\n setOpenSubMenu(fieldKey);\n } else {\n if (openSubMenu === fieldKey) {\n setOpenSubMenu(null);\n setActiveMenu(\"root\");\n }\n }\n }}\n >\n <DropdownMenuSubTrigger\n id={itemId}\n role=\"option\"\n aria-selected={isHighlighted}\n data-highlighted={isHighlighted || undefined}\n onMouseEnter={() => {\n setHighlightedIndex(index);\n setActiveMenu(\"root\");\n }}\n className=\"data-highlighted:bg-accent data-popup-open:bg-accent data-highlighted:text-accent-foreground data-popup-open:text-accent-foreground\"\n >\n {field.icon}\n <span>{field.label}</span>\n </DropdownMenuSubTrigger>\n <DropdownMenuSubContent className=\"w-[200px]\" side=\"right\">\n <FilterSubmenuContent\n field={field}\n currentValues={currentValues}\n isMultiSelect={isMultiSelect}\n i18n={mergedI18n}\n isActive={activeMenu === fieldKey}\n onActive={() => {\n if (field.searchable !== false) {\n setActiveMenu(fieldKey);\n }\n }}\n onBack={() => {\n setOpenSubMenu(null);\n setActiveMenu(\"root\");\n }}\n onClose={() => setAddFilterOpen(false)}\n onToggle={(value, isSelected) => {\n if (isMultiSelect) {\n const nextValues = isSelected\n ? (currentValues.filter((v) => v !== value) as T[])\n : ([...currentValues, value] as T[]);\n\n if (sessionFilter) {\n if (nextValues.length === 0) {\n onChange(\n filters.filter((f) => f.id !== sessionFilter.id),\n );\n setSessionFilterIds((prev) => ({\n ...prev,\n [fieldKey]: \"\",\n }));\n } else {\n onChange(\n filters.map((f) =>\n f.id === sessionFilter.id\n ? { ...f, values: nextValues }\n : f,\n ),\n );\n }\n } else {\n const newFilter = createFilter<T>(\n fieldKey,\n field.defaultOperator || \"is_any_of\",\n nextValues,\n );\n onChange([...filters, newFilter]);\n setSessionFilterIds((prev) => ({\n ...prev,\n [fieldKey]: newFilter.id,\n }));\n }\n } else {\n const newFilter = createFilter<T>(\n fieldKey,\n field.defaultOperator || \"is\",\n [value] as T[],\n );\n setLastAddedFilterId(newFilter.id);\n onChange([...filters, newFilter]);\n setAddFilterOpen(false);\n }\n }}\n />\n </DropdownMenuSubContent>\n </DropdownMenuSub>\n );\n }\n\n return (\n <DropdownMenuItem\n key={field.key}\n id={itemId}\n role=\"option\"\n aria-selected={isHighlighted}\n data-highlighted={isHighlighted || undefined}\n onMouseEnter={() => setHighlightedIndex(index)}\n onClick={() => field.key && addFilter(field.key)}\n className=\"data-highlighted:bg-accent data-highlighted:text-accent-foreground\"\n >\n {field.icon}\n <span>{field.label}</span>\n </DropdownMenuItem>\n );\n });\n })()}\n </ScrollArea>\n </div>\n </div>\n </DropdownMenuContent>\n </DropdownMenu>\n )}\n\n {filters.map((filter) => {\n const field = fieldsMap[filter.field];\n if (!field) return null;\n return (\n <ButtonGroup\n key={filter.id}\n // Sera is an underline style: its group text and input group carry\n // only a bottom border. Normalise the boxed segments (operator,\n // value, remove) to the same treatment so the whole chip reads as\n // one underlined group instead of mixing boxes and rules.\n className=\"\"\n >\n <ButtonGroupText className=\"bg-background dark:bg-input/30\">\n {field.icon && field.icon}\n {field.label}\n </ButtonGroupText>\n <FilterOperatorDropdown<T>\n field={field}\n operator={filter.operator}\n values={filter.values}\n onChange={(operator) => updateFilter(filter.id, { operator })}\n />\n <FilterValueSelector<T>\n field={field}\n values={filter.values}\n operator={filter.operator}\n onChange={(values) => updateFilter(filter.id, { values })}\n autoFocus={filter.id === lastAddedFilterId}\n />\n <FilterRemoveButton onClick={() => removeFilter(filter.id)} />\n </ButtonGroup>\n );\n })}\n </div>\n </FilterContext.Provider>\n );\n}\n\nexport const createFilter = <T = unknown>(\n field: string,\n operator?: string,\n values: T[] = [],\n): Filter<T> => ({\n id: `${Date.now()}-${Math.random().toString(36).substring(2, 11)}`,\n field,\n operator: operator || \"is\",\n values,\n});\n\nexport const createFilterGroup = <T = unknown>(\n id: string,\n label: string,\n fields: FilterFieldConfig<T>[],\n initialFilters: Filter<T>[] = [],\n): FilterGroup<T> => ({\n id,\n label,\n filters: initialFilters,\n fields,\n});\n"],"mappings":";;;;;;;;;;;;;;;;;AA2HA,MAAa,eAAiC;CAE5C,WAAW;CACX,cAAc;CACd,eAAe;CACf,gBAAgB;CAChB,QAAQ;CACR,MAAM;CACN,OAAO;CACP,KAAK;CACL,KAAK;CACL,IAAI;CACJ,mBAAmB;CACnB,UAAU;CACV,eAAe;CACf,SAAS;CACT,iBAAiB;CACjB,cAAc;CACd,gBAAgB;CAChB,gBAAgB;CAChB,qBAAqB;CAGrB,WAAW;EACT,IAAI;EACJ,OAAO;EACP,SAAS;EACT,YAAY;EACZ,aAAa;EACb,aAAa;EACb,QAAQ;EACR,OAAO;EACP,SAAS;EACT,YAAY;EACZ,UAAU;EACV,aAAa;EACb,YAAY;EACZ,UAAU;EACV,WAAW;EACX,QAAQ;EACR,WAAW;EACX,aAAa;EACb,UAAU;EACV,UAAU;EACV,UAAU;EACV,UAAU;EACV,eAAe;EACf,eAAe;EACf,OAAO;EACP,UAAU;CACZ;CAGA,cAAc;EACZ,aAAa,cAAsB,SAAS,UAAU;EACtD,aAAa;EACb,cAAc,cAAsB,UAAU,UAAU,YAAY,EAAE;EACtE,UAAU;EACV,YAAY;CACd;CAGA,SAAS,EACP,iBAAiB,aAAqB,SAAS,QAAQ,MAAM,GAAG,EAClE;CAGA,YAAY;EACV,cAAc;EACd,YAAY;EACZ,YAAY;EACZ,SAAS;CACX;AACF;AAcA,MAAM,gBAAgB,cAAkC;CACtD,SAAS;CACT,MAAM;CACN,QAAQ;CACR,MAAM;CACN,WAAW,KAAA;CACX,iBAAiB;CACjB,SAAS,KAAA;CACT,eAAe;AACjB,CAAC;AAED,MAAM,yBAAyB,WAAW,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;IAzBN,GAAA,OAAO,EAyBD;GAEjB,CAAC,CACE;;CACiB,CAAA;AAE5B;AAEA,MAAa,gBACX,OACA,UACA,SAAc,CAAC,OACA;CACf,IAAI,GAAG,KAAK,IAAI,EAAE,GAAG,KAAK,OAAO,CAAC,CAAC,SAAS,EAAE,CAAC,CAAC,UAAU,GAAG,EAAE;CAC/D;CACA,UAAU,YAAY;CACtB;AACF;AAEA,MAAa,qBACX,IACA,OACA,QACA,iBAA8B,CAAC,OACX;CACpB;CACA;CACA,SAAS;CACT;AACF"}
1
+ {"version":3,"file":"filters.js","names":[],"sources":["../../../src/components/reui/filters.tsx"],"sourcesContent":["\"use client\";\n\"use no memo\";\n\nimport type React from \"react\";\nimport {\n createContext,\n useCallback,\n useContext,\n useEffect,\n useId,\n useMemo,\n useRef,\n useState,\n} from \"react\";\nimport { useRender } from \"@base-ui/react/use-render\";\nimport { cva } from \"class-variance-authority\";\nimport { AlertCircleIcon, CheckIcon, PlusIcon, XIcon } from \"lucide-react\";\n\nimport { cn } from \"@kumix/utils\";\nimport { Button } from \"../ui/button\";\nimport { ButtonGroup, ButtonGroupText } from \"../ui/button-group\";\nimport {\n DropdownMenu,\n DropdownMenuCheckboxItem,\n DropdownMenuContent,\n DropdownMenuGroup,\n DropdownMenuItem,\n DropdownMenuSeparator,\n DropdownMenuSub,\n DropdownMenuSubContent,\n DropdownMenuSubTrigger,\n DropdownMenuTrigger,\n} from \"../ui/dropdown-menu\";\nimport { Input } from \"../ui/input\";\nimport {\n InputGroup,\n InputGroupAddon,\n InputGroupButton,\n InputGroupInput,\n InputGroupText,\n} from \"../ui/input-group\";\nimport { Kbd } from \"../ui/kbd\";\nimport { ScrollArea } from \"../ui/scroll-area\";\nimport { Tooltip, TooltipContent, TooltipTrigger } from \"../ui/tooltip\";\n\n// i18n Configuration Interface\nexport interface FilterI18nConfig {\n // UI Labels\n addFilter: string;\n searchFields: string;\n noFieldsFound: string;\n noResultsFound: string;\n select: string;\n true: string;\n false: string;\n min: string;\n max: string;\n to: string;\n typeAndPressEnter: string;\n selected: string;\n selectedCount: string;\n percent: string;\n defaultCurrency: string;\n defaultColor: string;\n addFilterTitle: string;\n // Async option loading states (optional; fall back to sensible defaults)\n loadingOptions?: string;\n errorLoadingOptions?: string;\n\n // Operators\n operators: {\n is: string;\n isNot: string;\n isAnyOf: string;\n isNotAnyOf: string;\n includesAll: string;\n excludesAll: string;\n before: string;\n after: string;\n between: string;\n notBetween: string;\n contains: string;\n notContains: string;\n startsWith: string;\n endsWith: string;\n isExactly: string;\n equals: string;\n notEquals: string;\n greaterThan: string;\n lessThan: string;\n overlaps: string;\n includes: string;\n excludes: string;\n includesAllOf: string;\n includesAnyOf: string;\n empty: string;\n notEmpty: string;\n };\n\n // Placeholders\n placeholders: {\n enterField: (fieldType: string) => string;\n selectField: string;\n searchField: (fieldName: string) => string;\n enterKey: string;\n enterValue: string;\n };\n\n // Helper functions\n helpers: {\n formatOperator: (operator: string) => string;\n };\n\n // Validation\n validation: {\n invalidEmail: string;\n invalidUrl: string;\n invalidTel: string;\n invalid: string;\n };\n}\n\n// Default English i18n configuration\nexport const DEFAULT_I18N: FilterI18nConfig = {\n // UI Labels\n addFilter: \"Filter\",\n searchFields: \"Filter...\",\n noFieldsFound: \"No filters found.\",\n noResultsFound: \"No results found.\",\n select: \"Select...\",\n true: \"True\",\n false: \"False\",\n min: \"Min\",\n max: \"Max\",\n to: \"to\",\n typeAndPressEnter: \"Type and press Enter to add tag\",\n selected: \"selected\",\n selectedCount: \"selected\",\n percent: \"%\",\n defaultCurrency: \"$\",\n defaultColor: \"#000000\",\n addFilterTitle: \"Add filter\",\n loadingOptions: \"Loading...\",\n errorLoadingOptions: \"Failed to load options.\",\n\n // Operators\n operators: {\n is: \"is\",\n isNot: \"is not\",\n isAnyOf: \"is any of\",\n isNotAnyOf: \"is not any of\",\n includesAll: \"includes all\",\n excludesAll: \"excludes all\",\n before: \"before\",\n after: \"after\",\n between: \"between\",\n notBetween: \"not between\",\n contains: \"contains\",\n notContains: \"does not contain\",\n startsWith: \"starts with\",\n endsWith: \"ends with\",\n isExactly: \"is exactly\",\n equals: \"equals\",\n notEquals: \"not equals\",\n greaterThan: \"greater than\",\n lessThan: \"less than\",\n overlaps: \"overlaps\",\n includes: \"includes\",\n excludes: \"excludes\",\n includesAllOf: \"includes all of\",\n includesAnyOf: \"includes any of\",\n empty: \"is empty\",\n notEmpty: \"is not empty\",\n },\n\n // Placeholders\n placeholders: {\n enterField: (fieldType: string) => `Enter ${fieldType}...`,\n selectField: \"Select...\",\n searchField: (fieldName: string) => `Search ${fieldName.toLowerCase()}...`,\n enterKey: \"Enter key...\",\n enterValue: \"Enter value...\",\n },\n\n // Helper functions\n helpers: {\n formatOperator: (operator: string) => operator.replace(/_/g, \" \"),\n },\n\n // Validation\n validation: {\n invalidEmail: \"Invalid email format\",\n invalidUrl: \"Invalid URL format\",\n invalidTel: \"Invalid phone format\",\n invalid: \"Invalid input format\",\n },\n};\n\n// Context for all Filter component props\ninterface FilterContextValue {\n variant: \"solid\" | \"default\";\n size: \"sm\" | \"default\" | \"lg\";\n radius: \"default\" | \"full\";\n i18n: FilterI18nConfig;\n className?: string;\n showSearchInput?: boolean;\n trigger?: React.ReactNode;\n allowMultiple?: boolean;\n}\n\nconst FilterContext = createContext<FilterContextValue>({\n variant: \"default\",\n size: \"default\",\n radius: \"default\",\n i18n: DEFAULT_I18N,\n className: undefined,\n showSearchInput: true,\n trigger: undefined,\n allowMultiple: true,\n});\n\nconst useFilterContext = () => useContext(FilterContext);\n\n// Container variant for filters wrapper\nconst filtersContainerVariants = cva(\"flex flex-wrap items-center\", {\n variants: {\n variant: {\n solid: \"gap-2\",\n default: \"\",\n },\n size: {\n sm: \"gap-1.5\",\n default: \"gap-2.5\",\n lg: \"gap-3.5\",\n },\n },\n defaultVariants: {\n variant: \"default\",\n size: \"default\",\n },\n});\n\nfunction FilterInput<T = unknown>({\n field,\n onBlur,\n onKeyDown,\n className,\n ...props\n}: React.InputHTMLAttributes<HTMLInputElement> & {\n className?: string;\n field?: FilterFieldConfig<T>;\n}) {\n const context = useFilterContext();\n const [isValid, setIsValid] = useState(true);\n const [validationMessage, setValidationMessage] = useState(\"\");\n const inputRef = useRef<HTMLInputElement>(null);\n\n useEffect(() => {\n if (props.autoFocus) {\n const timer = setTimeout(() => {\n inputRef.current?.focus();\n }, 300);\n return () => clearTimeout(timer);\n }\n }, [props.autoFocus]);\n\n // Validation function to check if input matches pattern\n const validateInput = (value: string, pattern?: string): boolean => {\n if (!pattern || !value) return true;\n const regex = new RegExp(pattern);\n return regex.test(value);\n };\n\n // Get validation message for field type\n const getValidationMessage = (): string => {\n return context.i18n.validation.invalid;\n };\n\n // Handle blur event - validate when user leaves input\n const handleBlur = (e: React.FocusEvent<HTMLInputElement>) => {\n const value = e.target.value;\n const pattern = field?.pattern || props.pattern;\n\n // Only validate if there's a value and (pattern or validation function)\n if (value && (pattern || field?.validation)) {\n let valid = true;\n let customMessage = \"\";\n\n // If there's a custom validation function, use it\n if (field?.validation) {\n const result = field.validation(value);\n // Handle both boolean and object return types\n if (typeof result === \"boolean\") {\n valid = result;\n } else {\n valid = result.valid;\n customMessage = result.message || \"\";\n }\n } else if (pattern) {\n // Use pattern validation\n valid = validateInput(value, pattern);\n }\n\n setIsValid(valid);\n setValidationMessage(valid ? \"\" : customMessage || getValidationMessage());\n } else {\n // Reset validation state for empty values or no validation\n setIsValid(true);\n setValidationMessage(\"\");\n }\n\n // Call the original onBlur if provided\n onBlur?.(e);\n };\n\n // Handle keydown event - hide validation error when user starts typing\n const handleKeyDown = (e: React.KeyboardEvent<HTMLInputElement>) => {\n // Hide validation error when user starts typing (any key except special keys)\n if (\n !isValid &&\n ![\"Tab\", \"Escape\", \"Enter\", \"ArrowUp\", \"ArrowDown\", \"ArrowLeft\", \"ArrowRight\"].includes(e.key)\n ) {\n setIsValid(true);\n setValidationMessage(\"\");\n }\n\n // Call the original onKeyDown if provided\n onKeyDown?.(e);\n };\n\n return (\n <InputGroup\n className={cn(\n \"w-36\",\n // Height follows each style's own control ladder. `default` sets no\n // height on purpose so the style's `.cn-input-group` applies (h-8 nova,\n // h-9 maia/luma, h-7 mira, h-10 sera); sm/lg step down/up from it.\n // Base covers nova/lyra/rhea/vega; only deviating styles are listed.\n context.size === \"sm\" && \"h-7!\",\n context.size === \"lg\" && \"h-9!\",\n // Sera's `.cn-input` is `px-0` (underline inputs sit flush); inside a\n // segmented chip that collides with the neighbouring segment, so give\n // the value input the same inline padding sera uses elsewhere.\n \"\",\n className,\n )}\n >\n {field?.prefix && (\n <InputGroupAddon>\n <InputGroupText>{field.prefix}</InputGroupText>\n </InputGroupAddon>\n )}\n <InputGroupInput\n ref={inputRef}\n aria-invalid={!isValid}\n aria-describedby={\n !isValid && validationMessage ? `${field?.key || \"input\"}-error` : undefined\n }\n onBlur={handleBlur}\n onKeyDown={handleKeyDown}\n className={cn(context.size === \"sm\" && \"h-7! text-xs\", context.size === \"lg\" && \"h-9!\")}\n {...props}\n />\n {!isValid && validationMessage && (\n <InputGroupAddon align=\"inline-end\">\n <Tooltip>\n <TooltipTrigger render={<InputGroupButton size=\"icon-xs\" />}>\n <AlertCircleIcon className=\"size-3.5 text-destructive\" />\n </TooltipTrigger>\n <TooltipContent>\n <p className=\"text-sm\">{validationMessage}</p>\n </TooltipContent>\n </Tooltip>\n </InputGroupAddon>\n )}\n\n {field?.suffix && (\n <InputGroupAddon align=\"inline-end\">\n <InputGroupText>{field.suffix}</InputGroupText>\n </InputGroupAddon>\n )}\n </InputGroup>\n );\n}\n\ninterface FilterRemoveButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {\n icon?: React.ReactNode;\n}\n\nfunction FilterRemoveButton({ className, icon = <XIcon />, ...props }: FilterRemoveButtonProps) {\n const context = useFilterContext();\n\n return (\n <Button\n variant=\"outline\"\n size={context.size === \"sm\" ? \"icon-sm\" : context.size === \"lg\" ? \"icon-lg\" : \"icon\"}\n className={className}\n {...props}\n >\n {icon}\n </Button>\n );\n}\n\n// Generic types for flexible filter system\nexport interface FilterOption<T = unknown> {\n value: T;\n label: string;\n icon?: React.ReactNode;\n metadata?: Record<string, unknown>;\n className?: string;\n}\n\nexport interface FilterOperator {\n value: string;\n label: string;\n supportsMultiple?: boolean;\n}\n\n// Custom renderer props interface\nexport interface CustomRendererProps<T = unknown> {\n field: FilterFieldConfig<T>;\n values: T[];\n onChange: (values: T[]) => void;\n operator: string;\n}\n\n// Props passed to a field's `renderOptionList` slot. Lets a consumer render the\n// options list however they like (e.g. windowing / virtualization with a\n// library of their choice) while staying bound to the primitive's selection and\n// keyboard behavior.\nexport interface FilterOptionListRenderProps<T = unknown> {\n // Options to render: already resolved, query-filtered, and selected-first.\n options: FilterOption<T>[];\n // Index into `options` of the keyboard-highlighted row (-1 if none). A\n // virtualized implementation should scroll this row into view and keep it\n // mounted so the combobox's aria-activedescendant stays valid.\n highlightedIndex: number;\n // Renders one option row with the correct id, selection state, highlight, and\n // toggle handler wired to the primitive. Call it for each row you render.\n renderOption: (option: FilterOption<T>, index: number) => React.ReactNode;\n}\n\n// Grouped field configuration interface\nexport interface FilterFieldGroup<T = unknown> {\n group?: string;\n fields: FilterFieldConfig<T>[];\n}\n\n// Union type for both flat and grouped field configurations\nexport type FilterFieldsConfig<T = unknown> = FilterFieldConfig<T>[] | FilterFieldGroup<T>[];\n\nexport interface FilterFieldConfig<T = unknown> {\n key?: string;\n label?: string;\n icon?: React.ReactNode;\n type?: \"select\" | \"multiselect\" | \"text\" | \"custom\" | \"separator\";\n // Group-level configuration\n group?: string;\n fields?: FilterFieldConfig<T>[];\n // Field-specific options\n options?: FilterOption<T>[];\n // Async / large-list options loader. Receives the current search query and\n // may return a Promise. Use it to prefetch a remote list once (ignore the\n // query) or to run server-side search (filter by the query). When both\n // `options` and `loadOptions` are provided, `options` seeds the initial view\n // and the value->label cache while `loadOptions` supplies live results.\n loadOptions?: (query: string) => FilterOption<T>[] | Promise<FilterOption<T>[]>;\n // Bring-your-own rendering for the options list (e.g. virtualization with a\n // windowing library of your choice). Return the full scrollable list, call\n // `renderOption` for each row, and scroll `highlightedIndex` into view. When\n // omitted, the options render as a plain scrollable list.\n renderOptionList?: (props: FilterOptionListRenderProps<T>) => React.ReactNode;\n operators?: FilterOperator[];\n customRenderer?: (props: CustomRendererProps<T>) => React.ReactNode;\n customValueRenderer?: (values: T[], options: FilterOption<T>[]) => React.ReactNode;\n placeholder?: string;\n searchable?: boolean;\n maxSelections?: number;\n min?: number;\n max?: number;\n step?: number;\n prefix?: string | React.ReactNode;\n suffix?: string | React.ReactNode;\n pattern?: string;\n validation?: (value: unknown) => boolean | { valid: boolean; message?: string };\n allowCustomValues?: boolean;\n className?: string;\n menuPopupClassName?: string;\n // Grouping options (legacy support)\n groupLabel?: string;\n // Boolean field options\n onLabel?: string;\n offLabel?: string;\n // Input event handlers\n onInputChange?: (e: React.ChangeEvent<HTMLInputElement>) => void;\n // Default operator to use when creating a filter for this field\n defaultOperator?: string;\n // Controlled values support for this field\n value?: T[];\n onValueChange?: (values: T[]) => void;\n}\n\n// Helper functions to handle both flat and grouped field configurations\nconst isFieldGroup = <T = unknown>(\n item: FilterFieldConfig<T> | FilterFieldGroup<T>,\n): item is FilterFieldGroup<T> => {\n return \"fields\" in item && Array.isArray(item.fields);\n};\n\n// Helper function to check if a FilterFieldConfig is a group-level configuration\nconst isGroupLevelField = <T = unknown>(field: FilterFieldConfig<T>): boolean => {\n return Boolean(field.group && field.fields);\n};\n\nconst flattenFields = <T = unknown>(fields: FilterFieldsConfig<T>): FilterFieldConfig<T>[] => {\n const acc: FilterFieldConfig<T>[] = [];\n for (const item of fields) {\n if (isFieldGroup(item)) {\n acc.push(...item.fields);\n } else if (isGroupLevelField(item)) {\n acc.push(...item.fields!);\n } else {\n acc.push(item);\n }\n }\n return acc;\n};\n\nconst getFieldsMap = <T = unknown>(\n fields: FilterFieldsConfig<T>,\n): Record<string, FilterFieldConfig<T>> => {\n const flatFields = flattenFields(fields);\n return flatFields.reduce(\n (acc, field) => {\n // Only add fields that have a key (skip group-level configurations)\n if (field.key) {\n acc[field.key] = field;\n }\n return acc;\n },\n {} as Record<string, FilterFieldConfig<T>>,\n );\n};\n\n// Whether a field exposes any option source (a static list or an async loader).\n// IMPORTANT: never gate on `field.options?.length` once `loadOptions` exists —\n// a function's `.length` is its arity, not an option count, which silently\n// breaks the submenu gate for async fields.\nconst fieldHasOptions = <T = unknown>(field: FilterFieldConfig<T>): boolean =>\n (field.options?.length ?? 0) > 0 || typeof field.loadOptions === \"function\";\n\ninterface ResolvedFieldOptions<T = unknown> {\n isAsync: boolean;\n options: FilterOption<T>[];\n loading: boolean;\n error: boolean;\n // Resolve selected values to full options using an accumulating value->option\n // cache, so async/controlled selections keep their label and icon even when\n // absent from the latest result page.\n resolveSelected: (values: T[]) => FilterOption<T>[];\n}\n\n// Value->option cache shared across every component instance rendering the\n// SAME field object (the Add Filter submenu and the active-filter chip both\n// receive the same config reference from the fields map). Keyed by the field\n// object so it is shared when fields are memoized and garbage-collected\n// otherwise. This keeps a value selected in the submenu labelled in the chip.\nconst fieldOptionCaches = new WeakMap<object, Map<unknown, FilterOption>>();\n\nconst getFieldOptionCache = <T = unknown>(field: FilterFieldConfig<T>): Map<T, FilterOption<T>> => {\n let cache = fieldOptionCaches.get(field as object);\n if (!cache) {\n cache = new Map();\n fieldOptionCaches.set(field as object, cache);\n }\n return cache as Map<T, FilterOption<T>>;\n};\n\n// Resolves a field's options for a popover/submenu. Static fields return their\n// list verbatim (unchanged legacy behavior). Async fields (`loadOptions`)\n// debounce the query, guard against out-of-order responses, and expose\n// loading/error state plus a value->label cache.\nfunction useFieldOptions<T = unknown>(\n field: FilterFieldConfig<T>,\n searchInput: string,\n enabled: boolean,\n): ResolvedFieldOptions<T> {\n const isAsync = typeof field.loadOptions === \"function\";\n\n // Seed the shared cache from any static options an async field also provides\n // (static fields never read this cache, so skip the work for them).\n if (isAsync && field.options) {\n const cache = getFieldOptionCache(field);\n for (const opt of field.options) {\n cache.set(opt.value, opt);\n }\n }\n\n const [state, setState] = useState<{\n options: FilterOption<T>[];\n loading: boolean;\n error: boolean;\n }>(() => ({ options: field.options ?? [], loading: false, error: false }));\n\n // Debounce the query for async fields to avoid a request per keystroke.\n const [debouncedQuery, setDebouncedQuery] = useState(searchInput);\n useEffect(() => {\n if (!isAsync) return;\n const timer = setTimeout(() => setDebouncedQuery(searchInput), 250);\n return () => clearTimeout(timer);\n }, [searchInput, isAsync]);\n\n const requestIdRef = useRef(0);\n // Keep the latest loader in a ref so an unmemoized `loadOptions` identity does\n // not cancel and refire the in-flight request on every parent re-render.\n const loaderRef = useRef(field.loadOptions);\n loaderRef.current = field.loadOptions;\n useEffect(() => {\n if (!isAsync || !enabled) return;\n const loader = loaderRef.current;\n if (!loader) return;\n\n const requestId = ++requestIdRef.current;\n let cancelled = false;\n setState((prev) => ({ ...prev, loading: true, error: false }));\n\n Promise.resolve()\n .then(() => loader(debouncedQuery))\n .then((result) => {\n // Ignore stale responses (out-of-order guard).\n if (cancelled || requestId !== requestIdRef.current) return;\n const cache = getFieldOptionCache(field);\n for (const opt of result) cache.set(opt.value, opt);\n setState({ options: result, loading: false, error: false });\n })\n .catch(() => {\n if (cancelled || requestId !== requestIdRef.current) return;\n setState((prev) => ({ ...prev, loading: false, error: true }));\n });\n\n return () => {\n cancelled = true;\n };\n }, [isAsync, enabled, debouncedQuery, field]);\n\n const resolveSelected = useCallback(\n (values: T[]): FilterOption<T>[] => {\n const cache = getFieldOptionCache(field);\n return values.map((value) => cache.get(value) ?? { value, label: String(value) });\n },\n [field],\n );\n\n if (!isAsync) {\n return {\n isAsync: false,\n options: field.options ?? [],\n loading: false,\n error: false,\n resolveSelected,\n };\n }\n\n return {\n isAsync: true,\n options: state.options,\n loading: state.loading,\n error: state.error,\n resolveSelected,\n };\n}\n\n// Helper function to create operators from i18n config\nconst createOperatorsFromI18n = (i18n: FilterI18nConfig): Record<string, FilterOperator[]> => ({\n select: [\n { value: \"is\", label: i18n.operators.is },\n { value: \"is_not\", label: i18n.operators.isNot },\n { value: \"empty\", label: i18n.operators.empty },\n { value: \"not_empty\", label: i18n.operators.notEmpty },\n ],\n multiselect: [\n { value: \"is_any_of\", label: i18n.operators.isAnyOf },\n { value: \"is_not_any_of\", label: i18n.operators.isNotAnyOf },\n { value: \"includes_all\", label: i18n.operators.includesAll },\n { value: \"excludes_all\", label: i18n.operators.excludesAll },\n { value: \"empty\", label: i18n.operators.empty },\n { value: \"not_empty\", label: i18n.operators.notEmpty },\n ],\n text: [\n { value: \"contains\", label: i18n.operators.contains },\n { value: \"not_contains\", label: i18n.operators.notContains },\n { value: \"starts_with\", label: i18n.operators.startsWith },\n { value: \"ends_with\", label: i18n.operators.endsWith },\n { value: \"is\", label: i18n.operators.isExactly },\n { value: \"empty\", label: i18n.operators.empty },\n { value: \"not_empty\", label: i18n.operators.notEmpty },\n ],\n custom: [\n { value: \"is\", label: i18n.operators.is },\n { value: \"after\", label: i18n.operators.after },\n { value: \"between\", label: i18n.operators.between },\n { value: \"empty\", label: i18n.operators.empty },\n { value: \"not_empty\", label: i18n.operators.notEmpty },\n ],\n});\n\n// Default operators for different field types (using default i18n)\nexport const DEFAULT_OPERATORS: Record<string, FilterOperator[]> =\n createOperatorsFromI18n(DEFAULT_I18N);\n\n// Helper function to get operators for a field\nconst getOperatorsForField = <T = unknown>(\n field: FilterFieldConfig<T>,\n values: T[],\n i18n: FilterI18nConfig,\n): FilterOperator[] => {\n if (field.operators) return field.operators;\n\n const operators = createOperatorsFromI18n(i18n);\n\n // Determine field type for operator selection\n let fieldType = field.type || \"select\";\n\n // If it's a select field but has multiple values, treat as multiselect\n if (fieldType === \"select\" && values.length > 1) {\n fieldType = \"multiselect\";\n }\n\n // If it's a multiselect field or has multiselect operators, use multiselect operators\n if (fieldType === \"multiselect\" || field.type === \"multiselect\") {\n return operators.multiselect;\n }\n\n return operators[fieldType] || operators.select;\n};\n\ninterface FilterOperatorDropdownProps<T = unknown> {\n field: FilterFieldConfig<T>;\n operator: string;\n values: T[];\n onChange: (operator: string) => void;\n}\n\nfunction FilterOperatorDropdown<T = unknown>({\n field,\n operator,\n values,\n onChange,\n}: FilterOperatorDropdownProps<T>) {\n const context = useFilterContext();\n const operators = useMemo(\n () => getOperatorsForField(field, values, context.i18n),\n [field, values, context.i18n],\n );\n\n // Find the operator label, with fallback to formatted operator name\n const operatorLabel =\n operators.find((op) => op.value === operator)?.label ||\n context.i18n.helpers.formatOperator(operator);\n\n return (\n <DropdownMenu>\n <DropdownMenuTrigger\n render={\n <Button\n variant=\"outline\"\n size={context.size}\n className=\"text-muted-foreground hover:text-foreground\"\n >\n {operatorLabel}\n </Button>\n }\n />\n <DropdownMenuContent align=\"start\" className=\"w-fit min-w-fit\">\n {operators.map((op) => (\n <DropdownMenuItem\n key={op.value}\n onClick={() => onChange(op.value)}\n className={cn(\n \"flex items-center justify-between data-highlighted:bg-accent data-highlighted:text-accent-foreground\",\n )}\n >\n <span>{op.label}</span>\n <CheckIcon\n className={cn(\n \"ms-auto text-primary\",\n op.value === operator ? \"opacity-100\" : \"opacity-0\",\n )}\n />\n </DropdownMenuItem>\n ))}\n </DropdownMenuContent>\n </DropdownMenu>\n );\n}\n\ninterface FilterValueSelectorProps<T = unknown> {\n field: FilterFieldConfig<T>;\n values: T[];\n onChange: (values: T[]) => void;\n operator: string;\n autoFocus?: boolean;\n}\n\ninterface SelectOptionsPopoverProps<T = unknown> {\n field: FilterFieldConfig<T>;\n values: T[];\n onChange: (values: T[]) => void;\n onClose?: () => void;\n inline?: boolean;\n}\n\nfunction SelectOptionsPopover<T = unknown>({\n field,\n values,\n onChange,\n onClose,\n inline = false,\n}: SelectOptionsPopoverProps<T>) {\n const [open, setOpen] = useState(false);\n const [searchInput, setSearchInput] = useState(\"\");\n const [highlightedIndex, setHighlightedIndex] = useState(-1);\n const inputRef = useRef<HTMLInputElement>(null);\n const context = useFilterContext();\n const baseId = useId();\n\n useEffect(() => {\n if (open) {\n inputRef.current?.focus();\n }\n }, [open]);\n\n useEffect(() => {\n setHighlightedIndex(-1);\n }, []);\n\n useEffect(() => {\n if (highlightedIndex >= 0 && open) {\n const element = document.getElementById(`${baseId}-item-${highlightedIndex}`);\n element?.scrollIntoView({ block: \"nearest\" });\n }\n }, [highlightedIndex, open, baseId]);\n\n const {\n isAsync,\n options: resolvedOptions,\n loading,\n error,\n resolveSelected,\n } = useFieldOptions(field, searchInput, inline || open);\n\n const isMultiSelect = field.type === \"multiselect\" || values.length > 1;\n const effectiveValues = (field.value !== undefined ? (field.value as T[]) : values) || [];\n\n // Static fields read their list verbatim (unchanged legacy behavior). Async\n // fields resolve selected values from the value->label cache and take the\n // loader's (already query-filtered) result as the unselected list.\n const selectedOptions = isAsync\n ? resolveSelected(effectiveValues)\n : field.options?.filter((opt) => effectiveValues.includes(opt.value)) || [];\n const unselectedOptions = isAsync\n ? resolvedOptions.filter((opt) => !effectiveValues.includes(opt.value))\n : field.options?.filter((opt) => !effectiveValues.includes(opt.value)) || [];\n\n // Filter options based on search input (client-side for static lists; async\n // loaders have already filtered by the query).\n const filteredSelectedOptions = selectedOptions; // Keep all selected visible\n const filteredUnselectedOptions = isAsync\n ? unselectedOptions\n : unselectedOptions.filter((opt) =>\n opt.label.toLowerCase().includes(searchInput.toLowerCase()),\n );\n\n const allFilteredOptions = useMemo(\n () => [...filteredSelectedOptions, ...filteredUnselectedOptions],\n [filteredSelectedOptions, filteredUnselectedOptions],\n );\n\n const handleClose = () => {\n setOpen(false);\n onClose?.();\n };\n\n // Toggle a single option, shared by the plain and custom (renderOptionList)\n // renderers so both behave identically.\n const toggleOption = (option: FilterOption<T>) => {\n const isSelected = effectiveValues.includes(option.value);\n const next = isSelected\n ? (effectiveValues.filter((v) => v !== option.value) as T[])\n : isMultiSelect\n ? ([...effectiveValues, option.value] as T[])\n : ([option.value] as T[]);\n\n if (!isSelected && isMultiSelect && field.maxSelections && next.length > field.maxSelections) {\n return;\n }\n\n if (field.onValueChange) {\n field.onValueChange(next);\n } else {\n onChange(next);\n }\n if (!isMultiSelect) handleClose();\n };\n\n const renderOptionItem = (option: FilterOption<T>, overallIndex: number) => {\n const isSelected = effectiveValues.includes(option.value);\n const isHighlighted = highlightedIndex === overallIndex;\n const itemId = `${baseId}-item-${overallIndex}`;\n\n return (\n <DropdownMenuCheckboxItem\n key={String(option.value)}\n id={itemId}\n role=\"option\"\n aria-selected={isHighlighted}\n data-highlighted={isHighlighted || undefined}\n onMouseEnter={() => setHighlightedIndex(overallIndex)}\n checked={isSelected}\n className={cn(\n \"data-highlighted:bg-accent data-highlighted:text-accent-foreground\",\n option.className,\n )}\n onSelect={(e) => {\n if (isMultiSelect) e.preventDefault();\n }}\n onCheckedChange={() => toggleOption(option)}\n >\n {option.icon && option.icon}\n <span className=\"truncate\">{option.label}</span>\n </DropdownMenuCheckboxItem>\n );\n };\n\n const renderMenuContent = () => (\n <>\n {field.searchable !== false && (\n <>\n <Input\n ref={inputRef}\n role=\"combobox\"\n aria-autocomplete=\"list\"\n aria-expanded={true}\n aria-haspopup=\"listbox\"\n aria-controls={`${baseId}-listbox`}\n aria-activedescendant={\n highlightedIndex >= 0 ? `${baseId}-item-${highlightedIndex}` : undefined\n }\n placeholder={context.i18n.placeholders.searchField(field.label || \"\")}\n className={cn(\n \"h-8 rounded-none border-0 border-input bg-transparent! px-2 text-sm shadow-none\",\n \"focus-visible:border-border focus-visible:ring-0 focus-visible:ring-offset-0\",\n open && \"placeholder:text-foreground\",\n )}\n value={searchInput}\n onChange={(e) => setSearchInput(e.target.value)}\n onBlur={() => open && inputRef.current?.focus()}\n onClick={(e) => e.stopPropagation()}\n onKeyDown={(e) => {\n if (e.key === \"ArrowDown\") {\n e.preventDefault();\n if (allFilteredOptions.length > 0) {\n setHighlightedIndex((prev) =>\n prev < allFilteredOptions.length - 1 ? prev + 1 : 0,\n );\n }\n } else if (e.key === \"ArrowUp\") {\n e.preventDefault();\n if (allFilteredOptions.length > 0) {\n setHighlightedIndex((prev) =>\n prev > 0 ? prev - 1 : allFilteredOptions.length - 1,\n );\n }\n } else if (e.key === \"ArrowLeft\") {\n e.preventDefault();\n setOpen(false);\n } else if (e.key === \"Enter\" && highlightedIndex >= 0) {\n e.preventDefault();\n const option = allFilteredOptions[highlightedIndex];\n if (option) {\n const isSelected = effectiveValues.includes(option.value as T);\n const next = isSelected\n ? (effectiveValues.filter((v) => v !== option.value) as T[])\n : isMultiSelect\n ? ([...effectiveValues, option.value] as T[])\n : ([option.value] as T[]);\n\n if (\n !isSelected &&\n isMultiSelect &&\n field.maxSelections &&\n next.length > field.maxSelections\n ) {\n return;\n }\n\n if (field.onValueChange) {\n field.onValueChange(next);\n } else {\n onChange(next);\n }\n if (!isMultiSelect) handleClose();\n }\n }\n e.stopPropagation();\n }}\n />\n <DropdownMenuSeparator />\n </>\n )}\n <div className=\"relative flex max-h-full\">\n <div\n className=\"flex max-h-[min(var(--available-height),24rem)] w-full scroll-pt-2 scroll-pb-2 flex-col overscroll-contain\"\n role=\"listbox\"\n id={`${baseId}-listbox`}\n >\n {isAsync && loading && allFilteredOptions.length === 0 ? (\n <div className=\"py-2 text-center text-muted-foreground text-sm\">\n {context.i18n.loadingOptions ?? DEFAULT_I18N.loadingOptions}\n </div>\n ) : isAsync && error ? (\n <div className=\"py-2 text-center text-muted-foreground text-sm\">\n {context.i18n.errorLoadingOptions ?? DEFAULT_I18N.errorLoadingOptions}\n </div>\n ) : allFilteredOptions.length === 0 ? (\n <div className=\"py-2 text-center text-muted-foreground text-sm\">\n {context.i18n.noResultsFound}\n </div>\n ) : field.renderOptionList ? (\n field.renderOptionList({\n options: allFilteredOptions,\n highlightedIndex,\n renderOption: renderOptionItem,\n })\n ) : (\n <ScrollArea className=\"size-full min-h-0 **:data-[slot=scroll-area-scrollbar]:m-0 **:data-[slot=scroll-area-viewport]:h-full **:data-[slot=scroll-area-viewport]:overscroll-contain\">\n {/* Selected items */}\n {filteredSelectedOptions.length > 0 && (\n <DropdownMenuGroup className=\"px-1\">\n {filteredSelectedOptions.map((option, index) => renderOptionItem(option, index))}\n </DropdownMenuGroup>\n )}\n\n {/* Separator */}\n {filteredSelectedOptions.length > 0 && filteredUnselectedOptions.length > 0 && (\n <DropdownMenuSeparator className=\"mx-0\" />\n )}\n\n {/* Available items */}\n {filteredUnselectedOptions.length > 0 && (\n <DropdownMenuGroup className=\"px-1\">\n {filteredUnselectedOptions.map((option, index) =>\n renderOptionItem(option, index + filteredSelectedOptions.length),\n )}\n </DropdownMenuGroup>\n )}\n </ScrollArea>\n )}\n </div>\n </div>\n </>\n );\n\n if (inline) {\n return <div className=\"w-full\">{renderMenuContent()}</div>;\n }\n\n return (\n <DropdownMenu\n open={open}\n onOpenChange={(open) => {\n setOpen(open);\n if (!open) {\n setTimeout(() => setSearchInput(\"\"), 200);\n }\n }}\n >\n <DropdownMenuTrigger\n render={\n <Button variant=\"outline\" size={context.size}>\n <div className=\"flex items-center gap-1.5\">\n {field.customValueRenderer ? (\n field.customValueRenderer(\n values,\n isAsync ? resolveSelected(values) : field.options || [],\n )\n ) : (\n <>\n {selectedOptions.length > 0 && (\n <div className=\"flex items-center -space-x-1.5\">\n {selectedOptions.slice(0, 3).map((option) => (\n <div key={String(option.value)}>{option.icon}</div>\n ))}\n </div>\n )}\n {selectedOptions.length === 1\n ? selectedOptions[0].label\n : selectedOptions.length > 1\n ? `${selectedOptions.length} ${context.i18n.selectedCount}`\n : context.i18n.select}\n </>\n )}\n </div>\n </Button>\n }\n />\n <DropdownMenuContent align=\"start\" className={cn(\"w-[200px] px-0\", field.className)}>\n {renderMenuContent()}\n </DropdownMenuContent>\n </DropdownMenu>\n );\n}\n\nfunction FilterValueSelector<T = unknown>({\n field,\n values,\n onChange,\n operator,\n autoFocus,\n}: FilterValueSelectorProps<T>) {\n if (operator === \"empty\" || operator === \"not_empty\") {\n return null;\n }\n\n if (field.customRenderer) {\n return (\n <ButtonGroupText className=\"whitespace-nowrap bg-background text-start outline-hidden hover:bg-accent aria-expanded:bg-accent dark:bg-input/30\">\n {field.customRenderer({ field, values, onChange, operator })}\n </ButtonGroupText>\n );\n }\n\n if (field.type === \"text\") {\n return (\n <FilterInput\n type=\"text\"\n value={(values[0] as string) || \"\"}\n onChange={(e) => onChange([e.target.value] as T[])}\n placeholder={field.placeholder}\n pattern={field.pattern}\n field={field}\n className={cn(\"w-36\", field.className)}\n autoFocus={autoFocus}\n />\n );\n }\n\n if (field.type === \"select\" || field.type === \"multiselect\") {\n return <SelectOptionsPopover field={field} values={values} onChange={onChange} />;\n }\n\n return <SelectOptionsPopover field={field} values={values} onChange={onChange} />;\n}\nexport interface Filter<T = unknown> {\n id: string;\n field: string;\n operator: string;\n values: T[];\n}\n\nexport interface FilterGroup<T = unknown> {\n id: string;\n label?: string;\n filters: Filter<T>[];\n fields: FilterFieldConfig<T>[];\n}\n\ninterface FiltersContentProps<T = unknown> {\n filters: Filter<T>[];\n fields: FilterFieldsConfig<T>;\n onChange: (filters: Filter<T>[]) => void;\n}\n\nexport const FiltersContent = <T = unknown>({\n filters,\n fields,\n onChange,\n}: FiltersContentProps<T>) => {\n const context = useFilterContext();\n const fieldsMap = useMemo(() => getFieldsMap(fields), [fields]);\n\n const updateFilter = useCallback(\n (filterId: string, updates: Partial<Filter<T>>) => {\n onChange(\n filters.map((filter) => {\n if (filter.id === filterId) {\n const updatedFilter = { ...filter, ...updates };\n if (updates.operator === \"empty\" || updates.operator === \"not_empty\") {\n updatedFilter.values = [] as T[];\n }\n return updatedFilter;\n }\n return filter;\n }),\n );\n },\n [filters, onChange],\n );\n\n const removeFilter = useCallback(\n (filterId: string) => {\n onChange(filters.filter((filter) => filter.id !== filterId));\n },\n [filters, onChange],\n );\n\n return (\n <div\n className={cn(\n filtersContainerVariants({\n variant: context.variant,\n size: context.size,\n }),\n context.className,\n )}\n >\n {filters.map((filter) => {\n const field = fieldsMap[filter.field];\n if (!field) return null;\n\n return (\n <ButtonGroup\n key={filter.id}\n // Sera is an underline style: its group text and input group carry\n // only a bottom border. Normalise the boxed segments (the operator,\n // value and remove buttons) to the same treatment so the whole chip\n // reads as one underlined group instead of mixing boxes and rules.\n className=\"\"\n >\n <ButtonGroupText>\n {field.icon && field.icon}\n {field.label}\n </ButtonGroupText>\n\n <FilterOperatorDropdown<T>\n field={field}\n operator={filter.operator}\n values={filter.values}\n onChange={(operator) => updateFilter(filter.id, { operator })}\n />\n\n <FilterValueSelector<T>\n field={field}\n values={filter.values}\n onChange={(values) => updateFilter(filter.id, { values })}\n operator={filter.operator}\n autoFocus={false}\n />\n\n <FilterRemoveButton onClick={() => removeFilter(filter.id)} />\n </ButtonGroup>\n );\n })}\n </div>\n );\n};\n\ninterface FiltersProps<T = unknown> {\n filters: Filter<T>[];\n fields: FilterFieldsConfig<T>;\n onChange: (filters: Filter<T>[]) => void;\n className?: string;\n variant?: \"solid\" | \"default\";\n size?: \"sm\" | \"default\" | \"lg\";\n radius?: \"default\" | \"full\";\n i18n?: Partial<FilterI18nConfig>;\n showSearchInput?: boolean;\n trigger?: React.ReactNode;\n allowMultiple?: boolean;\n menuPopupClassName?: string;\n collapseAddButton?: boolean;\n enableShortcut?: boolean;\n shortcutKey?: string;\n shortcutLabel?: string;\n}\n\ninterface FilterSubmenuContentProps<T = unknown> {\n field: FilterFieldConfig<T>;\n currentValues: T[];\n isMultiSelect: boolean;\n onToggle: (value: T, isSelected: boolean) => void;\n i18n: FilterI18nConfig;\n isActive?: boolean;\n onActive?: () => void;\n onBack?: () => void;\n onClose?: () => void;\n}\n\nfunction FilterSubmenuContent<T = unknown>({\n field,\n currentValues,\n isMultiSelect,\n onToggle,\n i18n,\n isActive,\n onActive,\n onBack,\n onClose,\n}: FilterSubmenuContentProps<T>) {\n const [searchInput, setSearchInput] = useState(\"\");\n const [highlightedIndex, setHighlightedIndex] = useState(-1);\n const inputRef = useRef<HTMLInputElement>(null);\n const baseId = useId();\n\n const {\n isAsync,\n options: resolvedOptions,\n loading,\n error,\n resolveSelected,\n } = useFieldOptions(field, searchInput, true);\n\n useEffect(() => {\n if (isActive) {\n if (field.searchable !== false) {\n inputRef.current?.focus();\n } else {\n const listbox = document.getElementById(`${baseId}-listbox`);\n listbox?.focus();\n }\n }\n }, [isActive, field.searchable, baseId]);\n\n useEffect(() => {\n setHighlightedIndex(-1);\n }, []);\n\n useEffect(() => {\n if (highlightedIndex >= 0 && isActive) {\n const element = document.getElementById(`${baseId}-item-${highlightedIndex}`);\n element?.scrollIntoView({ block: \"nearest\" });\n }\n }, [highlightedIndex, isActive, baseId]);\n\n const filteredOptions = useMemo(() => {\n // Async fields: keep selected values first (resolved from cache so they\n // stay labelled), then the loader's already-query-filtered results.\n if (isAsync) {\n const selectedSet = new Set(currentValues);\n return [\n ...resolveSelected(currentValues),\n ...resolvedOptions.filter((option) => !selectedSet.has(option.value)),\n ];\n }\n return (\n field.options?.filter((option) => {\n const isSelected = currentValues.includes(option.value);\n if (isSelected) return true;\n if (!searchInput) return true;\n return option.label.toLowerCase().includes(searchInput.toLowerCase());\n }) || []\n );\n }, [isAsync, resolvedOptions, resolveSelected, field.options, searchInput, currentValues]);\n\n const renderOptionItem = (option: FilterOption<T>, index: number) => {\n const isSelected = currentValues.includes(option.value);\n const isHighlighted = highlightedIndex === index;\n const itemId = `${baseId}-item-${index}`;\n\n return (\n <DropdownMenuCheckboxItem\n key={String(option.value)}\n id={itemId}\n role=\"option\"\n aria-selected={isHighlighted}\n data-highlighted={isHighlighted || undefined}\n onMouseEnter={() => setHighlightedIndex(index)}\n checked={isSelected}\n className={cn(\n \"data-highlighted:bg-accent data-highlighted:text-accent-foreground\",\n option.className,\n )}\n onSelect={(e) => {\n if (isMultiSelect) e.preventDefault();\n }}\n onCheckedChange={() => onToggle(option.value as T, isSelected)}\n >\n {option.icon && option.icon}\n <span className=\"truncate\">{option.label}</span>\n </DropdownMenuCheckboxItem>\n );\n };\n\n useEffect(() => {\n if (isActive && filteredOptions.length > 0) {\n setHighlightedIndex(0);\n }\n }, [isActive, filteredOptions.length]);\n\n return (\n <div className=\"flex flex-col\" onMouseEnter={onActive}>\n {field.searchable !== false && (\n <>\n <Input\n ref={inputRef}\n role=\"combobox\"\n aria-autocomplete=\"list\"\n aria-expanded={true}\n aria-haspopup=\"listbox\"\n aria-controls={`${baseId}-listbox`}\n aria-activedescendant={\n highlightedIndex >= 0 ? `${baseId}-item-${highlightedIndex}` : undefined\n }\n placeholder={i18n.placeholders.searchField(field.label || \"\")}\n className={cn(\n \"h-8 rounded-none border-0 bg-transparent! px-2 text-sm shadow-none\",\n \"focus-visible:border-border focus-visible:ring-0 focus-visible:ring-offset-0\",\n isActive && \"placeholder:text-foreground\",\n )}\n value={searchInput}\n onBlur={() => isActive && inputRef.current?.focus()}\n onChange={(e) => setSearchInput(e.target.value)}\n onFocus={() => onActive?.()}\n onMouseEnter={(e) => {\n onActive?.();\n e.stopPropagation();\n }}\n onClick={(e) => e.stopPropagation()}\n onKeyDown={(e) => {\n if (e.key === \"ArrowDown\") {\n e.preventDefault();\n if (filteredOptions.length > 0) {\n setHighlightedIndex((prev) => (prev < filteredOptions.length - 1 ? prev + 1 : 0));\n }\n } else if (e.key === \"ArrowUp\") {\n e.preventDefault();\n if (filteredOptions.length > 0) {\n setHighlightedIndex((prev) => (prev > 0 ? prev - 1 : filteredOptions.length - 1));\n }\n } else if (e.key === \"ArrowLeft\") {\n e.preventDefault();\n onBack?.();\n } else if (e.key === \"Enter\" && highlightedIndex >= 0) {\n e.preventDefault();\n const option = filteredOptions[highlightedIndex];\n if (option) {\n onToggle(option.value as T, currentValues.includes(option.value));\n if (!isMultiSelect) {\n onBack?.();\n }\n }\n } else if (e.key === \"Escape\") {\n e.preventDefault();\n onClose?.();\n }\n e.stopPropagation();\n }}\n />\n <DropdownMenuSeparator />\n </>\n )}\n <div className=\"relative flex max-h-full\">\n <div\n className=\"flex max-h-[min(var(--available-height),24rem)] w-full scroll-pt-2 scroll-pb-2 flex-col overscroll-contain outline-hidden\"\n role=\"listbox\"\n id={`${baseId}-listbox`}\n tabIndex={field.searchable === false ? 0 : -1}\n onKeyDown={(e) => {\n if (field.searchable === false) {\n if (e.key === \"ArrowDown\") {\n e.preventDefault();\n if (filteredOptions.length > 0) {\n setHighlightedIndex((prev) => (prev < filteredOptions.length - 1 ? prev + 1 : 0));\n }\n } else if (e.key === \"ArrowUp\") {\n e.preventDefault();\n if (filteredOptions.length > 0) {\n setHighlightedIndex((prev) => (prev > 0 ? prev - 1 : filteredOptions.length - 1));\n }\n } else if (e.key === \"ArrowLeft\") {\n e.preventDefault();\n onBack?.();\n } else if (e.key === \"Enter\" && highlightedIndex >= 0) {\n e.preventDefault();\n const option = filteredOptions[highlightedIndex];\n if (option) {\n onToggle(option.value as T, currentValues.includes(option.value));\n if (!isMultiSelect) {\n onBack?.();\n }\n }\n } else if (e.key === \"Escape\") {\n e.preventDefault();\n onClose?.();\n }\n e.stopPropagation();\n }\n }}\n >\n {isAsync && loading && filteredOptions.length === 0 ? (\n <div className=\"py-2 text-center text-muted-foreground text-sm\">\n {i18n.loadingOptions ?? DEFAULT_I18N.loadingOptions}\n </div>\n ) : isAsync && error ? (\n <div className=\"py-2 text-center text-muted-foreground text-sm\">\n {i18n.errorLoadingOptions ?? DEFAULT_I18N.errorLoadingOptions}\n </div>\n ) : filteredOptions.length === 0 ? (\n <div className=\"py-2 text-center text-muted-foreground text-sm\">\n {i18n.noResultsFound}\n </div>\n ) : field.renderOptionList ? (\n field.renderOptionList({\n options: filteredOptions,\n highlightedIndex,\n renderOption: renderOptionItem,\n })\n ) : (\n <ScrollArea className=\"size-full min-h-0 **:data-[slot=scroll-area-scrollbar]:m-0 **:data-[slot=scroll-area-viewport]:h-full **:data-[slot=scroll-area-viewport]:overscroll-contain\">\n <DropdownMenuGroup>\n {filteredOptions.map((option, index) => renderOptionItem(option, index))}\n </DropdownMenuGroup>\n </ScrollArea>\n )}\n </div>\n </div>\n </div>\n );\n}\n\nexport function Filters<T = unknown>({\n filters,\n fields,\n onChange,\n className,\n variant = \"default\",\n size = \"default\",\n radius = \"default\",\n i18n,\n showSearchInput = true,\n trigger,\n allowMultiple = true,\n menuPopupClassName,\n enableShortcut = false,\n shortcutKey = \"f\",\n shortcutLabel = \"F\",\n}: FiltersProps<T>) {\n const [addFilterOpen, setAddFilterOpen] = useState(false);\n const [menuSearchInput, setMenuSearchInput] = useState(\"\");\n const [activeMenu, setActiveMenu] = useState<string>(\"root\");\n const [openSubMenu, setOpenSubMenu] = useState<string | null>(null);\n const [highlightedIndex, setHighlightedIndex] = useState(-1);\n const [lastAddedFilterId, setLastAddedFilterId] = useState<string | null>(null);\n const rootInputRef = useRef<HTMLInputElement>(null);\n const rootId = useId();\n\n useEffect(() => {\n if (!enableShortcut) return;\n\n const handleKeyDown = (e: KeyboardEvent) => {\n if (\n e.key.toLowerCase() === shortcutKey.toLowerCase() &&\n !addFilterOpen &&\n !(\n document.activeElement instanceof HTMLInputElement ||\n document.activeElement instanceof HTMLTextAreaElement\n )\n ) {\n e.preventDefault();\n setAddFilterOpen(true);\n }\n };\n\n window.addEventListener(\"keydown\", handleKeyDown);\n return () => window.removeEventListener(\"keydown\", handleKeyDown);\n }, [enableShortcut, shortcutKey, addFilterOpen]);\n\n useEffect(() => {\n if (addFilterOpen && activeMenu === \"root\") {\n rootInputRef.current?.focus();\n }\n }, [addFilterOpen, activeMenu]);\n\n useEffect(() => {\n setHighlightedIndex(-1);\n }, []);\n\n useEffect(() => {\n if (highlightedIndex >= 0 && addFilterOpen) {\n const element = document.getElementById(`${rootId}-item-${highlightedIndex}`);\n element?.scrollIntoView({ block: \"nearest\" });\n }\n }, [highlightedIndex, addFilterOpen, rootId]);\n\n useEffect(() => {\n if (!addFilterOpen) {\n setOpenSubMenu(null);\n }\n }, [addFilterOpen]);\n\n // Track which filter instance is being built in the current Add Filter menu session\n // Maps fieldKey -> unique filterId created during this open session\n const [sessionFilterIds, setSessionFilterIds] = useState<Record<string, string>>({});\n\n useEffect(() => {\n if (lastAddedFilterId) {\n const timer = setTimeout(() => {\n setLastAddedFilterId(null);\n }, 1000);\n return () => clearTimeout(timer);\n }\n }, [lastAddedFilterId]);\n\n const mergedI18n: FilterI18nConfig = useMemo(\n () => ({\n ...DEFAULT_I18N,\n ...i18n,\n operators: { ...DEFAULT_I18N.operators, ...i18n?.operators },\n placeholders: { ...DEFAULT_I18N.placeholders, ...i18n?.placeholders },\n validation: { ...DEFAULT_I18N.validation, ...i18n?.validation },\n }),\n [i18n],\n );\n\n const fieldsMap = useMemo(() => getFieldsMap(fields), [fields]);\n\n const updateFilter = useCallback(\n (filterId: string, updates: Partial<Filter<T>>) => {\n onChange(\n filters.map((filter) => {\n if (filter.id === filterId) {\n const updatedFilter = { ...filter, ...updates };\n if (updates.operator === \"empty\" || updates.operator === \"not_empty\") {\n updatedFilter.values = [] as T[];\n }\n return updatedFilter;\n }\n return filter;\n }),\n );\n },\n [filters, onChange],\n );\n\n const removeFilter = useCallback(\n (filterId: string) => {\n onChange(filters.filter((filter) => filter.id !== filterId));\n },\n [filters, onChange],\n );\n\n const addFilter = useCallback(\n (fieldKey: string) => {\n const field = fieldsMap[fieldKey];\n if (field?.key) {\n const defaultOperator =\n field.defaultOperator || (field.type === \"multiselect\" ? \"is_any_of\" : \"is\");\n const defaultValues: unknown[] = field.type === \"text\" ? [\"\"] : [];\n const newFilter = createFilter<T>(fieldKey, defaultOperator, defaultValues as T[]);\n setLastAddedFilterId(newFilter.id);\n onChange([...filters, newFilter]);\n setAddFilterOpen(false);\n setMenuSearchInput(\"\");\n }\n },\n [fieldsMap, filters, onChange],\n );\n\n const selectableFields = useMemo(() => {\n const flatFields = flattenFields(fields);\n return flatFields.filter((field) => {\n if (!field.key || field.type === \"separator\") return false;\n if (allowMultiple) return true;\n return !filters.some((filter) => filter.field === field.key);\n });\n }, [fields, filters, allowMultiple]);\n\n const filteredFields = useMemo(() => {\n return selectableFields.filter(\n (f) => !menuSearchInput || f.label?.toLowerCase().includes(menuSearchInput.toLowerCase()),\n );\n }, [selectableFields, menuSearchInput]);\n\n useEffect(() => {\n if (addFilterOpen && filteredFields.length > 0) {\n setHighlightedIndex(0);\n }\n }, [addFilterOpen, filteredFields.length]);\n\n const triggerButton = useRender({\n render: (trigger as React.ReactElement) ?? (\n <Button variant=\"outline\">\n <PlusIcon />\n {mergedI18n.addFilter}\n </Button>\n ),\n defaultTagName: \"button\",\n });\n\n const contextValue = useMemo<FilterContextValue>(\n () => ({\n variant,\n size,\n radius,\n i18n: mergedI18n,\n className,\n trigger,\n allowMultiple,\n }),\n [variant, size, radius, mergedI18n, className, trigger, allowMultiple],\n );\n\n return (\n <FilterContext.Provider value={contextValue}>\n <div className={cn(filtersContainerVariants({ variant, size }), className)}>\n {selectableFields.length > 0 && (\n <DropdownMenu\n open={addFilterOpen}\n onOpenChange={(open) => {\n setAddFilterOpen(open);\n if (!open) {\n setMenuSearchInput(\"\");\n setSessionFilterIds({});\n } else {\n setActiveMenu(\"root\");\n }\n }}\n >\n <DropdownMenuTrigger render={triggerButton} />\n <DropdownMenuContent className={cn(\"w-[220px]\", menuPopupClassName)} align=\"start\">\n {showSearchInput && (\n <>\n <div className=\"relative\">\n <Input\n ref={rootInputRef}\n role=\"combobox\"\n aria-controls={`${rootId}-listbox`}\n aria-activedescendant={\n highlightedIndex >= 0 ? `${rootId}-item-${highlightedIndex}` : undefined\n }\n placeholder={mergedI18n.searchFields}\n className={cn(\n \"h-8 rounded-none border-0 bg-transparent! px-2 text-sm shadow-none\",\n \"focus-visible:border-border focus-visible:ring-0 focus-visible:ring-offset-0\",\n activeMenu === \"root\" && \"placeholder:text-foreground\",\n )}\n value={menuSearchInput}\n onFocus={() => setActiveMenu(\"root\")}\n onMouseEnter={() => setActiveMenu(\"root\")}\n onBlur={() => activeMenu === \"root\" && rootInputRef.current?.focus()}\n onChange={(e) => setMenuSearchInput(e.target.value)}\n onClick={(e) => e.stopPropagation()}\n onKeyDown={(e) => {\n if (e.key === \"ArrowDown\") {\n e.preventDefault();\n if (filteredFields.length > 0) {\n setHighlightedIndex((prev) =>\n prev < filteredFields.length - 1 ? prev + 1 : 0,\n );\n }\n } else if (e.key === \"ArrowUp\") {\n e.preventDefault();\n if (filteredFields.length > 0) {\n setHighlightedIndex((prev) =>\n prev > 0 ? prev - 1 : filteredFields.length - 1,\n );\n }\n } else if (\n (e.key === \"ArrowRight\" || e.key === \"ArrowLeft\") &&\n highlightedIndex >= 0\n ) {\n const field = filteredFields[highlightedIndex];\n const hasSubMenu =\n field &&\n (field.type === \"select\" || field.type === \"multiselect\") &&\n fieldHasOptions(field);\n\n if (e.key === \"ArrowRight\" && hasSubMenu) {\n e.preventDefault();\n setOpenSubMenu(field.key || null);\n setActiveMenu(field.key || \"root\");\n } else if (e.key === \"ArrowLeft\") {\n e.preventDefault();\n if (openSubMenu) {\n setOpenSubMenu(null);\n setActiveMenu(\"root\");\n }\n }\n } else if (e.key === \"Enter\" && highlightedIndex >= 0) {\n e.preventDefault();\n const field = filteredFields[highlightedIndex];\n if (field.key) {\n const hasSubMenu =\n (field.type === \"select\" || field.type === \"multiselect\") &&\n fieldHasOptions(field);\n if (!hasSubMenu) {\n addFilter(field.key);\n } else {\n if (openSubMenu === field.key) {\n setOpenSubMenu(null);\n setActiveMenu(\"root\");\n } else {\n setOpenSubMenu(field.key);\n setActiveMenu(field.key);\n }\n }\n }\n } else if (e.key === \"Escape\") {\n setAddFilterOpen(false);\n }\n e.stopPropagation();\n }}\n />\n {enableShortcut && shortcutLabel && (\n <Kbd className=\"absolute top-1/2 right-2 -translate-y-1/2 border bg-background\">\n {shortcutLabel}\n </Kbd>\n )}\n </div>\n <DropdownMenuSeparator />\n </>\n )}\n\n <div className=\"relative flex max-h-full\">\n <div\n className=\"flex max-h-[min(var(--available-height),24rem)] w-full scroll-pt-2 scroll-pb-2 flex-col overscroll-contain\"\n role=\"listbox\"\n id={`${rootId}-listbox`}\n onMouseEnter={() => setActiveMenu(\"root\")}\n >\n <ScrollArea className=\"**:data-[slot=scroll-area-scrollbar]:m-0\">\n {(() => {\n if (filteredFields.length === 0) {\n return (\n <div className=\"py-2 text-center text-muted-foreground text-sm\">\n {mergedI18n.noFieldsFound}\n </div>\n );\n }\n\n return filteredFields.map((field, index) => {\n const isHighlighted = highlightedIndex === index;\n const itemId = `${rootId}-item-${index}`;\n const hasSubMenu =\n (field.type === \"select\" || field.type === \"multiselect\") &&\n fieldHasOptions(field);\n\n if (hasSubMenu) {\n const isMultiSelect = field.type === \"multiselect\";\n const fieldKey = field.key as string;\n const sessionFilterId = sessionFilterIds[fieldKey];\n const sessionFilter = sessionFilterId\n ? filters.find((f) => f.id === sessionFilterId)\n : null;\n const currentValues = sessionFilter?.values || [];\n\n return (\n <DropdownMenuSub\n key={fieldKey}\n open={openSubMenu === fieldKey}\n onOpenChange={(open) => {\n if (open) {\n setOpenSubMenu(fieldKey);\n } else {\n if (openSubMenu === fieldKey) {\n setOpenSubMenu(null);\n setActiveMenu(\"root\");\n }\n }\n }}\n >\n <DropdownMenuSubTrigger\n id={itemId}\n role=\"option\"\n aria-selected={isHighlighted}\n data-highlighted={isHighlighted || undefined}\n onMouseEnter={() => {\n setHighlightedIndex(index);\n setActiveMenu(\"root\");\n }}\n className=\"data-highlighted:bg-accent data-popup-open:bg-accent data-highlighted:text-accent-foreground data-popup-open:text-accent-foreground\"\n >\n {field.icon}\n <span>{field.label}</span>\n </DropdownMenuSubTrigger>\n <DropdownMenuSubContent className=\"w-[200px]\" side=\"right\">\n <FilterSubmenuContent\n field={field}\n currentValues={currentValues}\n isMultiSelect={isMultiSelect}\n i18n={mergedI18n}\n isActive={activeMenu === fieldKey}\n onActive={() => {\n if (field.searchable !== false) {\n setActiveMenu(fieldKey);\n }\n }}\n onBack={() => {\n setOpenSubMenu(null);\n setActiveMenu(\"root\");\n }}\n onClose={() => setAddFilterOpen(false)}\n onToggle={(value, isSelected) => {\n if (isMultiSelect) {\n const nextValues = isSelected\n ? (currentValues.filter((v) => v !== value) as T[])\n : ([...currentValues, value] as T[]);\n\n if (sessionFilter) {\n if (nextValues.length === 0) {\n onChange(\n filters.filter((f) => f.id !== sessionFilter.id),\n );\n setSessionFilterIds((prev) => ({\n ...prev,\n [fieldKey]: \"\",\n }));\n } else {\n onChange(\n filters.map((f) =>\n f.id === sessionFilter.id\n ? { ...f, values: nextValues }\n : f,\n ),\n );\n }\n } else {\n const newFilter = createFilter<T>(\n fieldKey,\n field.defaultOperator || \"is_any_of\",\n nextValues,\n );\n onChange([...filters, newFilter]);\n setSessionFilterIds((prev) => ({\n ...prev,\n [fieldKey]: newFilter.id,\n }));\n }\n } else {\n const newFilter = createFilter<T>(\n fieldKey,\n field.defaultOperator || \"is\",\n [value] as T[],\n );\n setLastAddedFilterId(newFilter.id);\n onChange([...filters, newFilter]);\n setAddFilterOpen(false);\n }\n }}\n />\n </DropdownMenuSubContent>\n </DropdownMenuSub>\n );\n }\n\n return (\n <DropdownMenuItem\n key={field.key}\n id={itemId}\n role=\"option\"\n aria-selected={isHighlighted}\n data-highlighted={isHighlighted || undefined}\n onMouseEnter={() => setHighlightedIndex(index)}\n onClick={() => field.key && addFilter(field.key)}\n className=\"data-highlighted:bg-accent data-highlighted:text-accent-foreground\"\n >\n {field.icon}\n <span>{field.label}</span>\n </DropdownMenuItem>\n );\n });\n })()}\n </ScrollArea>\n </div>\n </div>\n </DropdownMenuContent>\n </DropdownMenu>\n )}\n\n {filters.map((filter) => {\n const field = fieldsMap[filter.field];\n if (!field) return null;\n return (\n <ButtonGroup\n key={filter.id}\n // Sera is an underline style: its group text and input group carry\n // only a bottom border. Normalise the boxed segments (operator,\n // value, remove) to the same treatment so the whole chip reads as\n // one underlined group instead of mixing boxes and rules.\n className=\"\"\n >\n <ButtonGroupText className=\"bg-background dark:bg-input/30\">\n {field.icon && field.icon}\n {field.label}\n </ButtonGroupText>\n <FilterOperatorDropdown<T>\n field={field}\n operator={filter.operator}\n values={filter.values}\n onChange={(operator) => updateFilter(filter.id, { operator })}\n />\n <FilterValueSelector<T>\n field={field}\n values={filter.values}\n operator={filter.operator}\n onChange={(values) => updateFilter(filter.id, { values })}\n autoFocus={filter.id === lastAddedFilterId}\n />\n <FilterRemoveButton onClick={() => removeFilter(filter.id)} />\n </ButtonGroup>\n );\n })}\n </div>\n </FilterContext.Provider>\n );\n}\n\nexport const createFilter = <T = unknown>(\n field: string,\n operator?: string,\n values: T[] = [],\n): Filter<T> => ({\n id: `${Date.now()}-${Math.random().toString(36).substring(2, 11)}`,\n field,\n operator: operator || \"is\",\n values,\n});\n\nexport const createFilterGroup = <T = unknown>(\n id: string,\n label: string,\n fields: FilterFieldConfig<T>[],\n initialFilters: Filter<T>[] = [],\n): FilterGroup<T> => ({\n id,\n label,\n filters: initialFilters,\n fields,\n});\n"],"mappings":";;;;;;;;;;;;;;;;;AA2HA,MAAa,eAAiC;CAE5C,WAAW;CACX,cAAc;CACd,eAAe;CACf,gBAAgB;CAChB,QAAQ;CACR,MAAM;CACN,OAAO;CACP,KAAK;CACL,KAAK;CACL,IAAI;CACJ,mBAAmB;CACnB,UAAU;CACV,eAAe;CACf,SAAS;CACT,iBAAiB;CACjB,cAAc;CACd,gBAAgB;CAChB,gBAAgB;CAChB,qBAAqB;CAGrB,WAAW;EACT,IAAI;EACJ,OAAO;EACP,SAAS;EACT,YAAY;EACZ,aAAa;EACb,aAAa;EACb,QAAQ;EACR,OAAO;EACP,SAAS;EACT,YAAY;EACZ,UAAU;EACV,aAAa;EACb,YAAY;EACZ,UAAU;EACV,WAAW;EACX,QAAQ;EACR,WAAW;EACX,aAAa;EACb,UAAU;EACV,UAAU;EACV,UAAU;EACV,UAAU;EACV,eAAe;EACf,eAAe;EACf,OAAO;EACP,UAAU;CACZ;CAGA,cAAc;EACZ,aAAa,cAAsB,SAAS,UAAU;EACtD,aAAa;EACb,cAAc,cAAsB,UAAU,UAAU,YAAY,EAAE;EACtE,UAAU;EACV,YAAY;CACd;CAGA,SAAS,EACP,iBAAiB,aAAqB,SAAS,QAAQ,MAAM,GAAG,EAClE;CAGA,YAAY;EACV,cAAc;EACd,YAAY;EACZ,YAAY;EACZ,SAAS;CACX;A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BAAC,qBAAD;OACS;OACP,QAAQ,OAAO;OACf,UAAU,OAAO;OACjB,WAAW,WAAW,aAAa,OAAO,IAAI,EAAE,OAAO,CAAC;OACxD,WAAW,OAAO,OAAO;MAC1B,CAAA;MACD,oBAAC,oBAAD,EAAoB,eAAe,aAAa,OAAO,EAAE,EAAI,CAAA;KAClD;IAzBN,GAAA,OAAO,EAyBD;GAEjB,CAAC,CACE;;CACiB,CAAA;AAE5B;AAEA,MAAa,gBACX,OACA,UACA,SAAc,CAAC,OACA;CACf,IAAI,GAAG,KAAK,IAAI,EAAE,GAAG,KAAK,OAAO,CAAC,CAAC,SAAS,EAAE,CAAC,CAAC,UAAU,GAAG,EAAE;CAC/D;CACA,UAAU,YAAY;CACtB;AACF;AAEA,MAAa,qBACX,IACA,OACA,QACA,iBAA8B,CAAC,OACX;CACpB;CACA;CACA,SAAS;CACT;AACF"}
@@ -13,8 +13,8 @@ import { VariantProps } from "class-variance-authority";
13
13
  * :not() or !important needed
14
14
  */
15
15
  declare const frameVariants: (props?: ({
16
- variant?: "ghost" | "default" | "inverse" | null | undefined;
17
- spacing?: "default" | "sm" | "xs" | "lg" | null | undefined;
16
+ variant?: "default" | "inverse" | "ghost" | null | undefined;
17
+ spacing?: "default" | "sm" | "lg" | "xs" | null | undefined;
18
18
  stacked?: boolean | null | undefined;
19
19
  dense?: boolean | null | undefined;
20
20
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
@@ -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
  * CSS variable architecture for FramePanel theming: