@kumix/ui 0.3.6 → 0.3.8

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 (305) hide show
  1. package/README.md +25 -24
  2. package/dist/cascader-types-BnH6wYD-.d.ts +183 -0
  3. package/dist/cascader-types-BnH6wYD-.d.ts.map +1 -0
  4. package/dist/components/agents/ai-sidebar.d.ts +17 -1
  5. package/dist/components/agents/ai-sidebar.d.ts.map +1 -1
  6. package/dist/components/agents/ai-sidebar.js +90 -14
  7. package/dist/components/agents/ai-sidebar.js.map +1 -1
  8. package/dist/components/agents/chat-app.d.ts +10 -5
  9. package/dist/components/agents/chat-app.d.ts.map +1 -1
  10. package/dist/components/agents/chat-app.js +54 -5
  11. package/dist/components/agents/chat-app.js.map +1 -1
  12. package/dist/components/agents/citations.d.ts.map +1 -1
  13. package/dist/components/agents/citations.js +5 -6
  14. package/dist/components/agents/citations.js.map +1 -1
  15. package/dist/components/agents/tool-approval.d.ts.map +1 -1
  16. package/dist/components/agents/tool-approval.js +1 -1
  17. package/dist/components/agents/tool-approval.js.map +1 -1
  18. package/dist/components/motion/action-swap.d.ts.map +1 -1
  19. package/dist/components/motion/action-swap.js +2 -2
  20. package/dist/components/motion/action-swap.js.map +1 -1
  21. package/dist/components/motion/animated-sidebar.d.ts.map +1 -1
  22. package/dist/components/motion/animated-sidebar.js +13 -3
  23. package/dist/components/motion/animated-sidebar.js.map +1 -1
  24. package/dist/components/motion/attachment-upload.d.ts.map +1 -1
  25. package/dist/components/motion/attachment-upload.js +9 -5
  26. package/dist/components/motion/attachment-upload.js.map +1 -1
  27. package/dist/components/motion/availability-scheduler/copy-menu.js +1 -1
  28. package/dist/components/motion/availability-scheduler/day-row.d.ts +5 -2
  29. package/dist/components/motion/availability-scheduler/day-row.d.ts.map +1 -1
  30. package/dist/components/motion/availability-scheduler/day-row.js +18 -8
  31. package/dist/components/motion/availability-scheduler/day-row.js.map +1 -1
  32. package/dist/components/motion/availability-scheduler/index.d.ts.map +1 -1
  33. package/dist/components/motion/availability-scheduler/index.js +27 -5
  34. package/dist/components/motion/availability-scheduler/index.js.map +1 -1
  35. package/dist/components/motion/availability-scheduler/time-select.d.ts +3 -1
  36. package/dist/components/motion/availability-scheduler/time-select.d.ts.map +1 -1
  37. package/dist/components/motion/availability-scheduler/time-select.js +3 -1
  38. package/dist/components/motion/availability-scheduler/time-select.js.map +1 -1
  39. package/dist/components/motion/bottom-sheet.d.ts.map +1 -1
  40. package/dist/components/motion/bottom-sheet.js +78 -74
  41. package/dist/components/motion/bottom-sheet.js.map +1 -1
  42. package/dist/components/motion/center-morph-modal.d.ts.map +1 -1
  43. package/dist/components/motion/center-morph-modal.js +82 -88
  44. package/dist/components/motion/center-morph-modal.js.map +1 -1
  45. package/dist/components/motion/command-palette.d.ts.map +1 -1
  46. package/dist/components/motion/command-palette.js +51 -27
  47. package/dist/components/motion/command-palette.js.map +1 -1
  48. package/dist/components/motion/context-menu.d.ts.map +1 -1
  49. package/dist/components/motion/context-menu.js +16 -6
  50. package/dist/components/motion/context-menu.js.map +1 -1
  51. package/dist/components/motion/cylinder-carousel.d.ts.map +1 -1
  52. package/dist/components/motion/cylinder-carousel.js +4 -3
  53. package/dist/components/motion/cylinder-carousel.js.map +1 -1
  54. package/dist/components/motion/drawer.d.ts.map +1 -1
  55. package/dist/components/motion/drawer.js +30 -30
  56. package/dist/components/motion/drawer.js.map +1 -1
  57. package/dist/components/motion/expandable-action-bar.d.ts +6 -0
  58. package/dist/components/motion/expandable-action-bar.d.ts.map +1 -1
  59. package/dist/components/motion/expandable-action-bar.js +38 -9
  60. package/dist/components/motion/expandable-action-bar.js.map +1 -1
  61. package/dist/components/motion/hold-action-button.d.ts +1 -1
  62. package/dist/components/motion/hold-action-button.d.ts.map +1 -1
  63. package/dist/components/motion/hold-action-button.js +64 -50
  64. package/dist/components/motion/hold-action-button.js.map +1 -1
  65. package/dist/components/motion/loader.js +20 -22
  66. package/dist/components/motion/loader.js.map +1 -1
  67. package/dist/components/motion/morphing-modal.d.ts.map +1 -1
  68. package/dist/components/motion/morphing-modal.js +83 -83
  69. package/dist/components/motion/morphing-modal.js.map +1 -1
  70. package/dist/components/motion/morphing-search.d.ts +28 -0
  71. package/dist/components/motion/morphing-search.d.ts.map +1 -0
  72. package/dist/components/motion/morphing-search.js +418 -0
  73. package/dist/components/motion/morphing-search.js.map +1 -0
  74. package/dist/components/motion/morphing-tabs.d.ts.map +1 -1
  75. package/dist/components/motion/morphing-tabs.js +59 -18
  76. package/dist/components/motion/morphing-tabs.js.map +1 -1
  77. package/dist/components/motion/notification-stack.d.ts.map +1 -1
  78. package/dist/components/motion/notification-stack.js +28 -11
  79. package/dist/components/motion/notification-stack.js.map +1 -1
  80. package/dist/components/motion/popover-morph.d.ts.map +1 -1
  81. package/dist/components/motion/popover-morph.js +26 -11
  82. package/dist/components/motion/popover-morph.js.map +1 -1
  83. package/dist/components/motion/popover.d.ts.map +1 -1
  84. package/dist/components/motion/popover.js +39 -28
  85. package/dist/components/motion/popover.js.map +1 -1
  86. package/dist/components/motion/preview-rail.d.ts.map +1 -1
  87. package/dist/components/motion/preview-rail.js +42 -13
  88. package/dist/components/motion/preview-rail.js.map +1 -1
  89. package/dist/components/motion/project-folder.js +20 -20
  90. package/dist/components/motion/project-folder.js.map +1 -1
  91. package/dist/components/motion/pull-to-refresh.d.ts.map +1 -1
  92. package/dist/components/motion/pull-to-refresh.js +8 -7
  93. package/dist/components/motion/pull-to-refresh.js.map +1 -1
  94. package/dist/components/motion/range-slider-bubble.d.ts.map +1 -1
  95. package/dist/components/motion/range-slider-bubble.js +2 -1
  96. package/dist/components/motion/range-slider-bubble.js.map +1 -1
  97. package/dist/components/motion/range-slider-fluid.d.ts.map +1 -1
  98. package/dist/components/motion/range-slider-fluid.js +2 -1
  99. package/dist/components/motion/range-slider-fluid.js.map +1 -1
  100. package/dist/components/motion/range-slider-ruler.d.ts.map +1 -1
  101. package/dist/components/motion/range-slider-ruler.js +2 -1
  102. package/dist/components/motion/range-slider-ruler.js.map +1 -1
  103. package/dist/components/motion/range-slider-wave.d.ts.map +1 -1
  104. package/dist/components/motion/range-slider-wave.js +2 -1
  105. package/dist/components/motion/range-slider-wave.js.map +1 -1
  106. package/dist/components/motion/range-slider.d.ts.map +1 -1
  107. package/dist/components/motion/range-slider.js +2 -1
  108. package/dist/components/motion/range-slider.js.map +1 -1
  109. package/dist/components/motion/select.d.ts +15 -1
  110. package/dist/components/motion/select.d.ts.map +1 -1
  111. package/dist/components/motion/select.js +15 -4
  112. package/dist/components/motion/select.js.map +1 -1
  113. package/dist/components/motion/slide-action-button.d.ts.map +1 -1
  114. package/dist/components/motion/slide-action-button.js +3 -2
  115. package/dist/components/motion/slide-action-button.js.map +1 -1
  116. package/dist/components/motion/swipeable-list.d.ts.map +1 -1
  117. package/dist/components/motion/swipeable-list.js +2 -1
  118. package/dist/components/motion/swipeable-list.js.map +1 -1
  119. package/dist/components/motion/table/index.d.ts.map +1 -1
  120. package/dist/components/motion/table/index.js +64 -6
  121. package/dist/components/motion/table/index.js.map +1 -1
  122. package/dist/components/motion/table/table-header.d.ts.map +1 -1
  123. package/dist/components/motion/table/table-header.js +3 -2
  124. package/dist/components/motion/table/table-header.js.map +1 -1
  125. package/dist/components/motion/text-reveal.d.ts.map +1 -1
  126. package/dist/components/motion/text-reveal.js +72 -48
  127. package/dist/components/motion/text-reveal.js.map +1 -1
  128. package/dist/components/motion/tooltip.d.ts.map +1 -1
  129. package/dist/components/motion/tooltip.js +35 -15
  130. package/dist/components/motion/tooltip.js.map +1 -1
  131. package/dist/components/motion/wheel-picker.d.ts.map +1 -1
  132. package/dist/components/motion/wheel-picker.js +4 -3
  133. package/dist/components/motion/wheel-picker.js.map +1 -1
  134. package/dist/components/reui/badge.d.ts +1 -1
  135. package/dist/components/reui/cascader/cascader-async.d.ts +90 -0
  136. package/dist/components/reui/cascader/cascader-async.d.ts.map +1 -0
  137. package/dist/components/reui/cascader/cascader-async.js +549 -0
  138. package/dist/components/reui/cascader/cascader-async.js.map +1 -0
  139. package/dist/components/reui/cascader/cascader-columns.d.ts +29 -0
  140. package/dist/components/reui/cascader/cascader-columns.d.ts.map +1 -0
  141. package/dist/components/reui/cascader/cascader-columns.js +135 -0
  142. package/dist/components/reui/cascader/cascader-columns.js.map +1 -0
  143. package/dist/components/reui/cascader/cascader-context.d.ts +193 -0
  144. package/dist/components/reui/cascader/cascader-context.d.ts.map +1 -0
  145. package/dist/components/reui/cascader/cascader-context.js +59 -0
  146. package/dist/components/reui/cascader/cascader-context.js.map +1 -0
  147. package/dist/components/reui/cascader/cascader-footer.d.ts +85 -0
  148. package/dist/components/reui/cascader/cascader-footer.d.ts.map +1 -0
  149. package/dist/components/reui/cascader/cascader-footer.js +456 -0
  150. package/dist/components/reui/cascader/cascader-footer.js.map +1 -0
  151. package/dist/components/reui/cascader/cascader-i18n.d.ts +17 -0
  152. package/dist/components/reui/cascader/cascader-i18n.d.ts.map +1 -0
  153. package/dist/components/reui/cascader/cascader-i18n.js +68 -0
  154. package/dist/components/reui/cascader/cascader-i18n.js.map +1 -0
  155. package/dist/components/reui/cascader/cascader-item.d.ts +115 -0
  156. package/dist/components/reui/cascader/cascader-item.d.ts.map +1 -0
  157. package/dist/components/reui/cascader/cascader-item.js +530 -0
  158. package/dist/components/reui/cascader/cascader-item.js.map +1 -0
  159. package/dist/components/reui/cascader/cascader-lib.d.ts +141 -0
  160. package/dist/components/reui/cascader/cascader-lib.d.ts.map +1 -0
  161. package/dist/components/reui/cascader/cascader-lib.js +576 -0
  162. package/dist/components/reui/cascader/cascader-lib.js.map +1 -0
  163. package/dist/components/reui/cascader/cascader-nav.d.ts +59 -0
  164. package/dist/components/reui/cascader/cascader-nav.d.ts.map +1 -0
  165. package/dist/components/reui/cascader/cascader-nav.js +312 -0
  166. package/dist/components/reui/cascader/cascader-nav.js.map +1 -0
  167. package/dist/components/reui/cascader/cascader-types.d.ts +2 -0
  168. package/dist/components/reui/cascader/cascader-types.js +2 -0
  169. package/dist/components/reui/cascader/cascader-virtual.d.ts +65 -0
  170. package/dist/components/reui/cascader/cascader-virtual.d.ts.map +1 -0
  171. package/dist/components/reui/cascader/cascader-virtual.js +240 -0
  172. package/dist/components/reui/cascader/cascader-virtual.js.map +1 -0
  173. package/dist/components/reui/cascader/cascader.d.ts +322 -0
  174. package/dist/components/reui/cascader/cascader.d.ts.map +1 -0
  175. package/dist/components/reui/cascader/cascader.js +1459 -0
  176. package/dist/components/reui/cascader/cascader.js.map +1 -0
  177. package/dist/components/reui/event-calendar/event-calendar-event.d.ts +28 -47
  178. package/dist/components/reui/event-calendar/event-calendar-event.d.ts.map +1 -1
  179. package/dist/components/reui/event-calendar/event-calendar-event.js +26 -44
  180. package/dist/components/reui/event-calendar/event-calendar-event.js.map +1 -1
  181. package/dist/components/reui/event-calendar/event-calendar-nav.js +1 -1
  182. package/dist/components/reui/event-calendar/event-calendar-types.d.ts +19 -57
  183. package/dist/components/reui/event-calendar/event-calendar-types.d.ts.map +1 -1
  184. package/dist/components/reui/filters/filters-advanced.d.ts +52 -0
  185. package/dist/components/reui/filters/filters-advanced.d.ts.map +1 -0
  186. package/dist/components/reui/filters/filters-advanced.js +1191 -0
  187. package/dist/components/reui/filters/filters-advanced.js.map +1 -0
  188. package/dist/components/reui/filters/filters-builder.d.ts +43 -0
  189. package/dist/components/reui/filters/filters-builder.d.ts.map +1 -0
  190. package/dist/components/reui/filters/filters-builder.js +152 -0
  191. package/dist/components/reui/filters/filters-builder.js.map +1 -0
  192. package/dist/components/reui/filters/filters-chip.d.ts +79 -0
  193. package/dist/components/reui/filters/filters-chip.d.ts.map +1 -0
  194. package/dist/components/reui/filters/filters-chip.js +553 -0
  195. package/dist/components/reui/filters/filters-chip.js.map +1 -0
  196. package/dist/components/reui/filters/filters-context.d.ts +290 -0
  197. package/dist/components/reui/filters/filters-context.d.ts.map +1 -0
  198. package/dist/components/reui/filters/filters-context.js +277 -0
  199. package/dist/components/reui/filters/filters-context.js.map +1 -0
  200. package/dist/components/reui/filters/filters-date.d.ts +43 -0
  201. package/dist/components/reui/filters/filters-date.d.ts.map +1 -0
  202. package/dist/components/reui/filters/filters-date.js +143 -0
  203. package/dist/components/reui/filters/filters-date.js.map +1 -0
  204. package/dist/components/reui/filters/filters-dnd.d.ts +101 -0
  205. package/dist/components/reui/filters/filters-dnd.d.ts.map +1 -0
  206. package/dist/components/reui/filters/filters-dnd.js +454 -0
  207. package/dist/components/reui/filters/filters-dnd.js.map +1 -0
  208. package/dist/components/reui/filters/filters-draft.d.ts +2 -0
  209. package/dist/components/reui/filters/filters-draft.js +128 -0
  210. package/dist/components/reui/filters/filters-draft.js.map +1 -0
  211. package/dist/components/reui/filters/filters-editors.d.ts +91 -0
  212. package/dist/components/reui/filters/filters-editors.d.ts.map +1 -0
  213. package/dist/components/reui/filters/filters-editors.js +773 -0
  214. package/dist/components/reui/filters/filters-editors.js.map +1 -0
  215. package/dist/components/reui/filters/filters-i18n.d.ts +24 -0
  216. package/dist/components/reui/filters/filters-i18n.d.ts.map +1 -0
  217. package/dist/components/reui/filters/filters-i18n.js +127 -0
  218. package/dist/components/reui/filters/filters-i18n.js.map +1 -0
  219. package/dist/components/reui/filters/filters-lib.d.ts +171 -0
  220. package/dist/components/reui/filters/filters-lib.d.ts.map +1 -0
  221. package/dist/components/reui/filters/filters-lib.js +336 -0
  222. package/dist/components/reui/filters/filters-lib.js.map +1 -0
  223. package/dist/components/reui/filters/filters-operators.d.ts +49 -0
  224. package/dist/components/reui/filters/filters-operators.d.ts.map +1 -0
  225. package/dist/components/reui/filters/filters-operators.js +300 -0
  226. package/dist/components/reui/filters/filters-operators.js.map +1 -0
  227. package/dist/components/reui/filters/filters-query.d.ts +132 -0
  228. package/dist/components/reui/filters/filters-query.d.ts.map +1 -0
  229. package/dist/components/reui/filters/filters-query.js +476 -0
  230. package/dist/components/reui/filters/filters-query.js.map +1 -0
  231. package/dist/components/reui/filters/filters-types.d.ts +452 -0
  232. package/dist/components/reui/filters/filters-types.d.ts.map +1 -0
  233. package/dist/components/reui/filters/filters-types.js +2 -0
  234. package/dist/components/reui/filters/filters.d.ts +114 -0
  235. package/dist/components/reui/filters/filters.d.ts.map +1 -0
  236. package/dist/components/reui/filters/filters.js +638 -0
  237. package/dist/components/reui/filters/filters.js.map +1 -0
  238. package/dist/components/reui/frame.d.ts +1 -1
  239. package/dist/components/reui/gantt/gantt-bar.js +1 -1
  240. package/dist/components/reui/gantt/gantt-nav.js +1 -1
  241. package/dist/components/reui/gantt/gantt-types.d.ts +25 -71
  242. package/dist/components/reui/gantt/gantt-types.d.ts.map +1 -1
  243. package/dist/components/reui/gantt/gantt-view.js +1 -1
  244. package/dist/components/reui/icon-tile.d.ts +1 -1
  245. package/dist/components/ui/badge.d.ts +1 -1
  246. package/dist/components/ui/bubble.d.ts +1 -1
  247. package/dist/components/ui/button.d.ts +2 -2
  248. package/dist/components/ui/checkbox.js +1 -1
  249. package/dist/components/ui/checkbox.js.map +1 -1
  250. package/dist/components/ui/field.js +2 -2
  251. package/dist/components/ui/field.js.map +1 -1
  252. package/dist/components/ui/item.d.ts +2 -2
  253. package/dist/components/ui/marker.d.ts +1 -1
  254. package/dist/components/ui/radio-group.js +1 -1
  255. package/dist/components/ui/radio-group.js.map +1 -1
  256. package/dist/components/ui/sidebar.d.ts +1 -1
  257. package/dist/components/ui/sidebar.js +1 -1
  258. package/dist/components/ui/switch.js +1 -1
  259. package/dist/components/ui/switch.js.map +1 -1
  260. package/dist/components/ui/tabs.d.ts +1 -1
  261. package/dist/components/ui/toggle.d.ts +1 -1
  262. package/dist/{copy-menu-Bk5GP9Gp.js → copy-menu-1FKoMc9o.js} +9 -2
  263. package/dist/copy-menu-1FKoMc9o.js.map +1 -0
  264. package/dist/filters-draft-DEAl3TO-.d.ts +70 -0
  265. package/dist/filters-draft-DEAl3TO-.d.ts.map +1 -0
  266. package/dist/hooks/use-dismiss.d.ts +34 -0
  267. package/dist/hooks/use-dismiss.d.ts.map +1 -0
  268. package/dist/hooks/use-dismiss.js +78 -0
  269. package/dist/hooks/use-dismiss.js.map +1 -0
  270. package/dist/hooks/use-favicon.d.ts +17 -0
  271. package/dist/hooks/use-favicon.d.ts.map +1 -0
  272. package/dist/hooks/use-favicon.js +35 -0
  273. package/dist/hooks/use-favicon.js.map +1 -0
  274. package/dist/hooks/use-hover-gesture.d.ts +38 -0
  275. package/dist/hooks/use-hover-gesture.d.ts.map +1 -0
  276. package/dist/hooks/use-hover-gesture.js +46 -0
  277. package/dist/hooks/use-hover-gesture.js.map +1 -0
  278. package/dist/hooks/use-slider.d.ts.map +1 -1
  279. package/dist/hooks/use-slider.js +3 -2
  280. package/dist/hooks/use-slider.js.map +1 -1
  281. package/dist/hooks/use-tap-gesture.d.ts +47 -0
  282. package/dist/hooks/use-tap-gesture.d.ts.map +1 -0
  283. package/dist/hooks/use-tap-gesture.js +51 -0
  284. package/dist/hooks/use-tap-gesture.js.map +1 -0
  285. package/dist/hooks/use-touch-capable.d.ts +15 -0
  286. package/dist/hooks/use-touch-capable.d.ts.map +1 -0
  287. package/dist/hooks/use-touch-capable.js +29 -0
  288. package/dist/hooks/use-touch-capable.js.map +1 -0
  289. package/dist/lib/text-shimmer.d.ts +2 -2
  290. package/dist/lib/text-shimmer.d.ts.map +1 -1
  291. package/dist/lib/text-shimmer.js +2 -2
  292. package/dist/lib/text-shimmer.js.map +1 -1
  293. package/dist/lib/touch.d.ts +66 -0
  294. package/dist/lib/touch.d.ts.map +1 -0
  295. package/dist/lib/touch.js +79 -0
  296. package/dist/lib/touch.js.map +1 -0
  297. package/dist/presence-gate-BekdC4Bo.js +24 -0
  298. package/dist/presence-gate-BekdC4Bo.js.map +1 -0
  299. package/dist/types-smkWN_7x.d.ts.map +1 -1
  300. package/package.json +9 -9
  301. package/dist/components/reui/filters.d.ts +0 -176
  302. package/dist/components/reui/filters.d.ts.map +0 -1
  303. package/dist/components/reui/filters.js +0 -1223
  304. package/dist/components/reui/filters.js.map +0 -1
  305. package/dist/copy-menu-Bk5GP9Gp.js.map +0 -1
@@ -0,0 +1,135 @@
1
+ "use client";
2
+ import { ScrollArea } from "../../ui/scroll-area.js";
3
+ import { useCascaderActions, useCascaderState } from "./cascader-context.js";
4
+ import { CASCADER_LIST_HEIGHT_CLASS, CASCADER_LIST_PAD_CLASS, CASCADER_ROWS_CLASS, CASCADER_SCROLL_CLASS, warnCascaderOnce } from "./cascader-lib.js";
5
+ import { CascaderItem, getCascaderMoreProps } from "./cascader-item.js";
6
+ import * as React$1 from "react";
7
+ import { cn } from "@kumix/utils";
8
+ import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
9
+ import { LoaderCircleIcon } from "lucide-react";
10
+ import { Combobox } from "@base-ui/react";
11
+ //#region src/components/reui/cascader/cascader-columns.tsx
12
+ /**
13
+ * Miller columns: the open trail side by side, one panel per level. Only the
14
+ * DEEPEST column is a real listbox (Base UI owns exactly one list); the trail
15
+ * behind is plain buttons, which keeps one state machine instead of a second,
16
+ * 2D one. `CascaderInput` moves between columns with ArrowLeft/ArrowRight.
17
+ */
18
+ function CascaderColumns({ className, columnWidth = 220, maxHeight: maxHeightProp, children, ...props }) {
19
+ const { maxHeight, mode, labels } = useCascaderActions();
20
+ const { columns } = useCascaderState();
21
+ React$1.useEffect(() => {
22
+ if (process.env.NODE_ENV === "production") return;
23
+ if (mode === "columns") return;
24
+ warnCascaderOnce(`columns-outside-columns-mode:${mode}`, `\`CascaderColumns\` renders nothing in \`mode="${mode}"\`, so \`columnWidth\` and everything else on it does nothing. Set \`mode="columns"\` on the root, or render \`CascaderList\` instead.`);
25
+ }, [mode]);
26
+ if (mode !== "columns") return null;
27
+ const height = maxHeightProp ?? maxHeight;
28
+ const toCss = (value) => typeof value === "number" ? `${value}px` : value;
29
+ return /* @__PURE__ */ jsx("div", {
30
+ "data-slot": "cascader-columns",
31
+ role: "group",
32
+ "aria-label": labels.columnsLabel,
33
+ style: {
34
+ "--cascader-column-width": toCss(columnWidth),
35
+ ...height != null ? { "--cascader-max-height": toCss(height) } : null
36
+ },
37
+ className: cn("flex max-h-full min-h-0 items-stretch overflow-x-auto overscroll-x-contain", CASCADER_LIST_PAD_CLASS, className),
38
+ ...props,
39
+ children: columns.map((column) => children ? /* @__PURE__ */ jsx(React$1.Fragment, { children: children(column) }, column.depth) : /* @__PURE__ */ jsx(CascaderColumnPanel, { column }, column.depth))
40
+ });
41
+ }
42
+ /**
43
+ * One column's box. `columnWidth` is the width of the LIST, not the box: under
44
+ * `border-box` the 1px inline-start divider on every column but the first would
45
+ * come out of the rows, so bordered columns are widened by that pixel. The box
46
+ * is also the BOUND, the same `min(--available-height, cap)` the single list
47
+ * uses, and the `ScrollArea` inside scrolls, so every column shows a thumb.
48
+ */
49
+ const PANEL_CLASS = `flex w-(--cascader-column-width) shrink-0 flex-col overscroll-contain not-first:w-[calc(var(--cascader-column-width)_+_1px)] not-first:border-border/60 not-first:border-s ${CASCADER_LIST_HEIGHT_CLASS}`;
50
+ function CascaderColumnPanel({ column, children, virtualized }) {
51
+ const { labels, baseId, isBranch, isSelectable, isSelected, isIndeterminate, retryLevel } = useCascaderActions();
52
+ const { loadStates } = useCascaderState();
53
+ const columnKey = column.parent?.value ?? "\0root";
54
+ const loadState = loadStates.get(columnKey);
55
+ let emptyBody = labels.empty;
56
+ if (loadState?.error) emptyBody = /* @__PURE__ */ jsxs(Fragment$1, { children: [
57
+ labels.error,
58
+ " ",
59
+ /* @__PURE__ */ jsx("button", {
60
+ type: "button",
61
+ "data-slot": "cascader-retry",
62
+ onClick: () => retryLevel(columnKey),
63
+ className: "rounded-md px-1 font-medium text-foreground outline-hidden transition-colors hover:bg-accent focus-visible:ring-2 focus-visible:ring-ring/50",
64
+ children: labels.retry
65
+ })
66
+ ] });
67
+ else if (loadState?.loading) emptyBody = /* @__PURE__ */ jsxs("span", {
68
+ className: "flex items-center gap-1.5",
69
+ children: [/* @__PURE__ */ jsx(LoaderCircleIcon, {
70
+ className: "size-3.5 animate-spin",
71
+ "aria-hidden": true
72
+ }), labels.loading]
73
+ });
74
+ const rows = column.items.length === 0 ? /* @__PURE__ */ jsx("p", {
75
+ "data-slot": "cascader-column-empty",
76
+ "data-state": loadState?.error ? "error" : loadState?.loading ? "loading" : "empty",
77
+ className: "px-2 py-1.5 text-muted-foreground text-sm",
78
+ children: emptyBody
79
+ }) : children ?? column.items.map((node, i) => {
80
+ const open = node.value === column.activeValue;
81
+ return /* @__PURE__ */ jsx(CascaderItem, {
82
+ node,
83
+ as: column.active ? "option" : "button",
84
+ depth: column.depth,
85
+ branch: isBranch(node),
86
+ selectable: isSelectable(node),
87
+ selected: isSelected(node),
88
+ indeterminate: isIndeterminate(node),
89
+ ...getCascaderMoreProps(node, loadStates),
90
+ "data-open": open || void 0,
91
+ className: open ? "bg-accent/60 text-accent-foreground" : void 0,
92
+ ...column.active ? {
93
+ "aria-setsize": column.items.length,
94
+ "aria-posinset": i + 1
95
+ } : null,
96
+ ...!column.active && open ? {
97
+ "aria-expanded": true,
98
+ "aria-controls": `${baseId}-column-${column.depth + 1}`
99
+ } : null
100
+ }, node.value);
101
+ });
102
+ const shared = {
103
+ "data-slot": "cascader-column",
104
+ "data-active": column.active || void 0,
105
+ "data-depth": column.depth,
106
+ id: `${baseId}-column-${column.depth}`,
107
+ "aria-label": column.parent?.label ?? labels.rootLevel,
108
+ ...virtualized ? { "data-virtualized": true } : null
109
+ };
110
+ const rowsClass = cn(CASCADER_ROWS_CLASS, virtualized && "relative");
111
+ const body = column.active ? /* @__PURE__ */ jsx(Combobox.List, {
112
+ ...shared,
113
+ className: rowsClass,
114
+ children: rows
115
+ }) : /* @__PURE__ */ jsx("div", {
116
+ ...shared,
117
+ role: "group",
118
+ className: rowsClass,
119
+ children: rows
120
+ });
121
+ return /* @__PURE__ */ jsx("div", {
122
+ "data-slot": "cascader-column-bounds",
123
+ "data-active": column.active || void 0,
124
+ "data-depth": column.depth,
125
+ className: PANEL_CLASS,
126
+ children: /* @__PURE__ */ jsx(ScrollArea, {
127
+ className: CASCADER_SCROLL_CLASS,
128
+ children: body
129
+ })
130
+ });
131
+ }
132
+ //#endregion
133
+ export { CascaderColumnPanel, CascaderColumns };
134
+
135
+ //# sourceMappingURL=cascader-columns.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cascader-columns.js","names":["React","ComboboxPrimitive"],"sources":["../../../../src/components/reui/cascader/cascader-columns.tsx"],"sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\nimport { Combobox as ComboboxPrimitive } from \"@base-ui/react\";\nimport { LoaderCircleIcon } from \"lucide-react\";\n\nimport { cn } from \"@kumix/utils\";\nimport { ScrollArea } from \"../../ui/scroll-area\";\nimport type { CascaderColumn } from \"./cascader-context\";\nimport { useCascaderActions, useCascaderState } from \"./cascader-context\";\nimport { CascaderItem, getCascaderMoreProps } from \"./cascader-item\";\nimport {\n CASCADER_LIST_HEIGHT_CLASS,\n CASCADER_LIST_PAD_CLASS,\n CASCADER_ROOT_KEY,\n CASCADER_ROWS_CLASS,\n CASCADER_SCROLL_CLASS,\n warnCascaderOnce,\n} from \"./cascader-lib\";\n\nexport interface CascaderColumnsProps extends Omit<React.ComponentProps<\"div\">, \"children\"> {\n /** Width of each column. */\n columnWidth?: number | string;\n /** Height CAP per column. Falls back to the root `maxHeight`, then 24rem. */\n maxHeight?: number | string;\n /** Replaces the default panel; the seam a windowed column plugs into. */\n children?: (column: CascaderColumn) => React.ReactNode;\n}\n\n/**\n * Miller columns: the open trail side by side, one panel per level. Only the\n * DEEPEST column is a real listbox (Base UI owns exactly one list); the trail\n * behind is plain buttons, which keeps one state machine instead of a second,\n * 2D one. `CascaderInput` moves between columns with ArrowLeft/ArrowRight.\n */\nfunction CascaderColumns({\n className,\n columnWidth = 220,\n maxHeight: maxHeightProp,\n children,\n ...props\n}: CascaderColumnsProps) {\n const { maxHeight, mode, labels } = useCascaderActions();\n const { columns } = useCascaderState();\n\n // Before the early return, so the hook count is the same in both modes.\n React.useEffect(() => {\n if (process.env.NODE_ENV === \"production\") return;\n if (mode === \"columns\") return;\n warnCascaderOnce(\n `columns-outside-columns-mode:${mode}`,\n `\\`CascaderColumns\\` renders nothing in \\`mode=\"${mode}\"\\`, so \\`columnWidth\\` and everything else on it does nothing. Set \\`mode=\"columns\"\\` on the root, or render \\`CascaderList\\` instead.`,\n );\n }, [mode]);\n\n if (mode !== \"columns\") return null;\n\n const height = maxHeightProp ?? maxHeight;\n const toCss = (value: number | string) => (typeof value === \"number\" ? `${value}px` : value);\n\n return (\n <div\n data-slot=\"cascader-columns\"\n role=\"group\"\n aria-label={labels.columnsLabel}\n style={\n {\n \"--cascader-column-width\": toCss(columnWidth),\n /* Set only from an EXPLICIT cap: unset means \"24rem or what the\n viewport leaves\", via the `min()` fallback on the panel. A `?? 280`\n default here ignored short viewports and wasted tall ones. */\n ...(height != null ? { \"--cascader-max-height\": toCss(height) } : null),\n } as React.CSSProperties\n }\n className={cn(\n /* `max-h-full` with `min-h-0`: the trail is the panel's shrinking\n child, and the columns inside it size against this box. */\n \"flex max-h-full min-h-0 items-stretch overflow-x-auto overscroll-x-contain\",\n CASCADER_LIST_PAD_CLASS,\n className,\n )}\n {...props}\n >\n {columns.map((column) =>\n children ? (\n <React.Fragment key={column.depth}>{children(column)}</React.Fragment>\n ) : (\n <CascaderColumnPanel key={column.depth} column={column} />\n ),\n )}\n </div>\n );\n}\n\n/**\n * One column's box. `columnWidth` is the width of the LIST, not the box: under\n * `border-box` the 1px inline-start divider on every column but the first would\n * come out of the rows, so bordered columns are widened by that pixel. The box\n * is also the BOUND, the same `min(--available-height, cap)` the single list\n * uses, and the `ScrollArea` inside scrolls, so every column shows a thumb.\n */\nconst PANEL_CLASS = `flex w-(--cascader-column-width) shrink-0 flex-col overscroll-contain not-first:w-[calc(var(--cascader-column-width)_+_1px)] not-first:border-border/60 not-first:border-s ${CASCADER_LIST_HEIGHT_CLASS}`;\n\nexport interface CascaderColumnPanelProps {\n column: CascaderColumn;\n /** Replaces the panel's rows; the empty state still wins on an empty column. */\n children?: React.ReactNode;\n /** Containing block for the windowed column's absolutely positioned rows. */\n virtualized?: boolean;\n}\n\nfunction CascaderColumnPanel({ column, children, virtualized }: CascaderColumnPanelProps) {\n const { labels, baseId, isBranch, isSelectable, isSelected, isIndeterminate, retryLevel } =\n useCascaderActions();\n const { loadStates } = useCascaderState();\n\n // Keyed per level, not one global flag: columns load and land independently.\n const columnKey = column.parent?.value ?? CASCADER_ROOT_KEY;\n const loadState = loadStates.get(columnKey);\n\n let emptyBody: React.ReactNode = labels.empty;\n if (loadState?.error) {\n emptyBody = (\n <>\n {labels.error}{\" \"}\n <button\n type=\"button\"\n data-slot=\"cascader-retry\"\n onClick={() => retryLevel(columnKey)}\n className=\"rounded-md px-1 font-medium text-foreground outline-hidden transition-colors hover:bg-accent focus-visible:ring-2 focus-visible:ring-ring/50\"\n >\n {labels.retry}\n </button>\n </>\n );\n } else if (loadState?.loading) {\n emptyBody = (\n <span className=\"flex items-center gap-1.5\">\n <LoaderCircleIcon className=\"size-3.5 animate-spin\" aria-hidden />\n {labels.loading}\n </span>\n );\n }\n\n const rows =\n column.items.length === 0 ? (\n <p\n data-slot=\"cascader-column-empty\"\n data-state={loadState?.error ? \"error\" : loadState?.loading ? \"loading\" : \"empty\"}\n className=\"px-2 py-1.5 text-muted-foreground text-sm\"\n >\n {emptyBody}\n </p>\n ) : (\n (children ??\n column.items.map((node, i) => {\n const open = node.value === column.activeValue;\n return (\n <CascaderItem\n key={node.value}\n node={node}\n /* A trail row must not compete for `aria-activedescendant`. */\n as={column.active ? \"option\" : \"button\"}\n depth={column.depth}\n /* Answered here, not in the row: the trail rows are memoised too. */\n branch={isBranch(node)}\n selectable={isSelectable(node)}\n selected={isSelected(node)}\n indeterminate={isIndeterminate(node)}\n {...getCascaderMoreProps(node, loadStates)}\n data-open={open || undefined}\n className={open ? \"bg-accent/60 text-accent-foreground\" : undefined}\n /* Set metadata is option-only; a trail row is a `role=\"button\"`. */\n {...(column.active\n ? {\n \"aria-setsize\": column.items.length,\n \"aria-posinset\": i + 1,\n }\n : null)}\n {...(!column.active && open\n ? {\n \"aria-expanded\": true,\n \"aria-controls\": `${baseId}-column-${column.depth + 1}`,\n }\n : null)}\n />\n );\n }))\n );\n\n const shared = {\n \"data-slot\": \"cascader-column\",\n \"data-active\": column.active || undefined,\n \"data-depth\": column.depth,\n // Addressable so the opening trail row can point `aria-controls` here, and\n // named even at the root, which has no parent label to borrow.\n id: `${baseId}-column-${column.depth}`,\n \"aria-label\": column.parent?.label ?? labels.rootLevel,\n // Conditional spread, never an explicit `undefined`: the active column is a\n // Base UI element, and its `mergeProps` iterates own keys.\n ...(virtualized ? { \"data-virtualized\": true } : null),\n };\n\n // A windowed row is absolutely positioned, so the ROWS' box is the containing\n // block, not the scrollport: it carries the padding the geometry is measured\n // against.\n const rowsClass = cn(CASCADER_ROWS_CLASS, virtualized && \"relative\");\n\n // The active column IS the Combobox list: only rows inside `Combobox.List`\n // reach the CompositeList, arrow-key navigation and `aria-activedescendant`.\n const body = column.active ? (\n <ComboboxPrimitive.List {...shared} className={rowsClass}>\n {rows}\n </ComboboxPrimitive.List>\n ) : (\n // A named `group`, not a second listbox competing with the active column.\n <div {...shared} role=\"group\" className={rowsClass}>\n {rows}\n </div>\n );\n\n return (\n <div\n data-slot=\"cascader-column-bounds\"\n /* Repeated from `shared`: this box, not the semantic element, owns the\n width, the divider and the height, so style hooks must reach it, and\n `:first-child` on the semantic element no longer means \"first column\"\n (it is its own scrollport's only child). */\n data-active={column.active || undefined}\n data-depth={column.depth}\n className={PANEL_CLASS}\n >\n <ScrollArea className={CASCADER_SCROLL_CLASS}>{body}</ScrollArea>\n </div>\n );\n}\n\nexport { CascaderColumnPanel, CascaderColumns };\n"],"mappings":";;;;;;;;;;;;;;;;;AAmCA,SAAS,gBAAgB,EACvB,WACA,cAAc,KACd,WAAW,eACX,UACA,GAAG,SACoB;CACvB,MAAM,EAAE,WAAW,MAAM,WAAW,mBAAmB;CACvD,MAAM,EAAE,YAAY,iBAAiB;CAGrC,QAAM,gBAAgB;EACpB,IAAI,QAAQ,IAAI,aAAa,cAAc;EAC3C,IAAI,SAAS,WAAW;EACxB,iBACE,gCAAgC,QAChC,kDAAkD,KAAK,wIACzD;CACF,GAAG,CAAC,IAAI,CAAC;CAET,IAAI,SAAS,WAAW,OAAO;CAE/B,MAAM,SAAS,iBAAiB;CAChC,MAAM,SAAS,UAA4B,OAAO,UAAU,WAAW,GAAG,MAAM,MAAM;CAEtF,OACE,oBAAC,OAAD;EACE,aAAU;EACV,MAAK;EACL,cAAY,OAAO;EACnB,OACE;GACE,2BAA2B,MAAM,WAAW;GAI5C,GAAI,UAAU,OAAO,EAAE,yBAAyB,MAAM,MAAM,EAAE,IAAI;EACpE;EAEF,WAAW,GAGT,8EACA,yBACA,SACF;EACA,GAAI;EAEH,UAAA,QAAQ,KAAK,WACZ,WACE,oBAACA,QAAM,UAAP,EAAA,UAAoC,SAAS,MAAM,EAAkB,GAAhD,OAAO,KAAyC,IAErE,oBAAC,qBAAD,EAAgD,OAAS,GAA/B,OAAO,KAAwB,CAE7D;CACG,CAAA;AAET;;;;;;;;AASA,MAAM,cAAc,8KAA8K;AAUlM,SAAS,oBAAoB,EAAE,QAAQ,UAAU,eAAyC;CACxF,MAAM,EAAE,QAAQ,QAAQ,UAAU,cAAc,YAAY,iBAAiB,eAC3E,mBAAmB;CACrB,MAAM,EAAE,eAAe,iBAAiB;CAGxC,MAAM,YAAY,OAAO,QAAQ,SAAA;CACjC,MAAM,YAAY,WAAW,IAAI,SAAS;CAE1C,IAAI,YAA6B,OAAO;CACxC,IAAI,WAAW,OACb,YACE,qBAAA,YAAA,EAAA,UAAA;EACG,OAAO;EAAO;EACf,oBAAC,UAAD;GACE,MAAK;GACL,aAAU;GACV,eAAe,WAAW,SAAS;GACnC,WAAU;GAET,UAAA,OAAO;EACF,CAAA;CACR,EAAA,CAAA;MAEC,IAAI,WAAW,SACpB,YACE,qBAAC,QAAD;EAAM,WAAU;EAAhB,UAAA,CACE,oBAAC,kBAAD;GAAkB,WAAU;GAAwB,eAAA;EAAa,CAAA,GAChE,OAAO,OACJ;;CAIV,MAAM,OACJ,OAAO,MAAM,WAAW,IACtB,oBAAC,KAAD;EACE,aAAU;EACV,cAAY,WAAW,QAAQ,UAAU,WAAW,UAAU,YAAY;EAC1E,WAAU;EAET,UAAA;CACA,CAAA,IAEF,YACD,OAAO,MAAM,KAAK,MAAM,MAAM;EAC5B,MAAM,OAAO,KAAK,UAAU,OAAO;EACnC,OACE,oBAAC,cAAD;GAEQ;GAEN,IAAI,OAAO,SAAS,WAAW;GAC/B,OAAO,OAAO;GAEd,QAAQ,SAAS,IAAI;GACrB,YAAY,aAAa,IAAI;GAC7B,UAAU,WAAW,IAAI;GACzB,eAAe,gBAAgB,IAAI;GACnC,GAAI,qBAAqB,MAAM,UAAU;GACzC,aAAW,QAAQ,KAAA;GACnB,WAAW,OAAO,wCAAwC,KAAA;GAE1D,GAAK,OAAO,SACR;IACE,gBAAgB,OAAO,MAAM;IAC7B,iBAAiB,IAAI;GACvB,IACA;GACJ,GAAK,CAAC,OAAO,UAAU,OACnB;IACE,iBAAiB;IACjB,iBAAiB,GAAG,OAAO,UAAU,OAAO,QAAQ;GACtD,IACA;EACL,GA1BM,KAAK,KA0BX;CAEL,CAAC;CAGL,MAAM,SAAS;EACb,aAAa;EACb,eAAe,OAAO,UAAU,KAAA;EAChC,cAAc,OAAO;EAGrB,IAAI,GAAG,OAAO,UAAU,OAAO;EAC/B,cAAc,OAAO,QAAQ,SAAS,OAAO;EAG7C,GAAI,cAAc,EAAE,oBAAoB,KAAK,IAAI;CACnD;CAKA,MAAM,YAAY,GAAG,qBAAqB,eAAe,UAAU;CAInE,MAAM,OAAO,OAAO,SAClB,oBAACC,SAAkB,MAAnB;EAAwB,GAAI;EAAQ,WAAW;EAC5C,UAAA;CACqB,CAAA,IAGxB,oBAAC,OAAD;EAAK,GAAI;EAAQ,MAAK;EAAQ,WAAW;EACtC,UAAA;CACE,CAAA;CAGP,OACE,oBAAC,OAAD;EACE,aAAU;EAKV,eAAa,OAAO,UAAU,KAAA;EAC9B,cAAY,OAAO;EACnB,WAAW;EAEX,UAAA,oBAAC,YAAD;GAAY,WAAW;GAAwB,UAAA;EAAiB,CAAA;CAC7D,CAAA;AAET"}
@@ -0,0 +1,193 @@
1
+ import { a as CascaderFlatNode, d as CascaderLoadState, f as CascaderMode, g as CascaderSearchScope, o as CascaderIndex, p as CascaderNode, r as CascaderChangeReason, s as CascaderLabels, t as CascaderActionItem } from "../../../cascader-types-BnH6wYD-.js";
2
+ import * as React$1 from "react";
3
+ //#region src/components/reui/cascader/cascader-context.d.ts
4
+ /**
5
+ * Four contexts, not one: actions (config and callbacks, near-stable), state
6
+ * (every keystroke), render (`renderItem` identity) and highlight (every arrow
7
+ * key and pointer move). One combined context re-rendered every row on every
8
+ * keystroke, which is what made `React.memo` on the row worth nothing.
9
+ */
10
+ interface CascaderColumn<T = unknown> {
11
+ parent: CascaderNode<T> | null;
12
+ items: CascaderNode<T>[];
13
+ depth: number;
14
+ /** The node in this column that is drilled into, if any. */
15
+ activeValue: string | null;
16
+ /** Whether this is the deepest column, the one Base UI owns. */
17
+ active: boolean;
18
+ }
19
+ interface CascaderItemState<T = unknown> {
20
+ branch: boolean;
21
+ selected: boolean;
22
+ disabled: boolean;
23
+ depth: number;
24
+ count: number;
25
+ /** Ancestor chain, root first. Populated for deep-search rows. */
26
+ path: CascaderNode<T>[];
27
+ }
28
+ /**
29
+ * Everything derived from the query, the path and the selection. One keystroke
30
+ * rebuilds most of it, so never subscribe to it from a row.
31
+ */
32
+ interface CascaderStateContextValue<T = unknown> {
33
+ /** Same `useMemo` identity as the actions context's `index`. */
34
+ index: CascaderIndex<T>;
35
+ path: string[];
36
+ expanded: ReadonlySet<string>;
37
+ query: string;
38
+ currentParent: CascaderNode<T> | null;
39
+ /** Rows for the current level, already filtered. */
40
+ levelItems: CascaderNode<T>[];
41
+ deepResults: CascaderNode<T>[] | null;
42
+ /** What `Combobox.Root` is currently rendering, in render order. */
43
+ renderedItems: CascaderNode<T>[];
44
+ columns: CascaderColumn<T>[];
45
+ treeRows: CascaderFlatNode<T>[];
46
+ selectedValues: string[];
47
+ /** Selected nodes below each value, at any depth. Absent means zero. */
48
+ selectedDescendants: ReadonlyMap<string, number>;
49
+ /**
50
+ * Per level, keyed by parent value or `CASCADER_ROOT_KEY`. MEMBERSHIP is the
51
+ * discriminator: no entry means never fetched, an entry with no `loading`, no
52
+ * `error` and no children means fetched and genuinely empty.
53
+ */
54
+ loadStates: ReadonlyMap<string, CascaderLoadState>;
55
+ /** Async search, `null` when idle. Separate: a search belongs to no level. */
56
+ searchState: CascaderLoadState | null;
57
+ announcement: string;
58
+ }
59
+ declare const CascaderStateContext: React$1.Context<CascaderStateContextValue<unknown> | undefined>;
60
+ /**
61
+ * One provider serves every `T`, so the context holds an erased `unknown` value
62
+ * and this cast restores it. The primitive never inspects the payload.
63
+ */
64
+ declare function useCascaderState<T = unknown>(): CascaderStateContextValue<T>;
65
+ /**
66
+ * Config and callbacks, slow enough that a memoised row can subscribe: the
67
+ * mutators are `[]`-dep callbacks over a latest-props ref. The three predicates
68
+ * are the exception, read DURING RENDER where a ref written in an effect would
69
+ * return the previous commit's answer, so each is memoised on its own input.
70
+ */
71
+ interface CascaderActionsContextValue<T = unknown> {
72
+ index: CascaderIndex<T>;
73
+ mode: CascaderMode;
74
+ multiple: boolean;
75
+ /** Multi-select only: a commit propagates over the LOADED subtree. */
76
+ cascade: boolean;
77
+ /** Whether a BRANCH is committable. Per-LIST: the check gutter is a COLUMN. */
78
+ branchesSelectable: boolean;
79
+ /** Draws the SINGLE-SELECT check and its gutter. Ignored in multi-select. */
80
+ indicator: boolean;
81
+ expandTrigger?: "click" | "hover";
82
+ actions: CascaderActionItem[];
83
+ searchScope: CascaderSearchScope;
84
+ maxHeight?: number | string;
85
+ inline: boolean;
86
+ invalid: boolean;
87
+ /**
88
+ * Id prefix; columns are `${baseId}-column-${depth}`. The SCHEME is contract:
89
+ * the filters primitive's `FilterMenuPinKeeper` restores its highlight across
90
+ * a live re-pin through `${baseId}-column-0` and the `cascader-item` slot.
91
+ */
92
+ baseId: string;
93
+ labels: CascaderLabels;
94
+ /**
95
+ * Whether rows are WINDOWED. Also handed to `Combobox.Root`, which is what
96
+ * makes an explicit row `index` legal: forwarding one while this is false
97
+ * makes `aria-activedescendant` resolve to nothing. Latched per level.
98
+ */
99
+ virtualized: boolean;
100
+ /** Mounts a windowing renderer, returns its unregister. LAYOUT effect only. */
101
+ registerVirtualRenderer: () => () => void;
102
+ /** The root's `virtualize` prop. `undefined` means "decide by count". */
103
+ virtualize?: boolean;
104
+ virtualizeThreshold: number;
105
+ estimateRowSize: number;
106
+ overscan: number;
107
+ /** Tells "this level is empty" from "not fetched yet" before a load state. */
108
+ hasLoader: boolean;
109
+ /** Next page of a level. Latched: a page with nothing new is not re-asked. */
110
+ loadMore: (parentKey: string) => void;
111
+ retryLevel: (parentKey: string) => void;
112
+ /**
113
+ * Evicts one level's async cache, `null` for the root, so membership reads
114
+ * never-loaded. A level that is on screen when evicted refetches at once.
115
+ */
116
+ invalidateLevel: (value: string | null) => void;
117
+ /** Index as of the last commit. Use in the stable callbacks, not `index`. */
118
+ getIndex: () => CascaderIndex<T>;
119
+ getState: () => CascaderStateContextValue<T>;
120
+ /** Highlighted row or null. A getter: the highlight moves per arrow key. */
121
+ getHighlighted: () => CascaderNode<T> | null;
122
+ setPath: (next: string[] | ((prev: string[]) => string[])) => void;
123
+ pushLevel: (value: string) => void;
124
+ popLevel: () => void;
125
+ goToDepth: (depth: number) => void;
126
+ toggleExpanded: (value: string) => void;
127
+ /**
128
+ * Registers a footer submenu as open or closed. `Combobox` has no
129
+ * `FloatingTree`, so one Escape would dismiss the flyout AND the cascader;
130
+ * the root's `onOpenChange` guard cancels the close while any is open, from a
131
+ * ref so it reads as of that event without re-rendering the root.
132
+ */
133
+ setFlyoutOpen: (key: string, open: boolean) => void;
134
+ hasOpenFlyout: () => boolean;
135
+ setQuery: (next: string) => void;
136
+ /**
137
+ * Replaces the selection. `onValueChange` diffs it against the current one
138
+ * for its node and reason; pass `reason` only when the caller knows better.
139
+ */
140
+ setSelection: (values: string[], reason?: CascaderChangeReason) => void;
141
+ /** Commits a node, for rows outside the listbox such as ancestor columns. */
142
+ commit: (node: CascaderNode<T>) => void;
143
+ navigate: (node: CascaderNode<T>) => void;
144
+ /** Into `node` as a child of `depth`, replacing anything deeper. */
145
+ navigateAt: (node: CascaderNode<T>, depth: number) => void;
146
+ /** Never undefined: falls back to a remembered label, then a synthetic node. */
147
+ resolveNode: (value: string) => CascaderNode<T>;
148
+ isBranch: (node: CascaderNode<T>) => boolean;
149
+ isSelectable: (node: CascaderNode<T>) => boolean;
150
+ isSelected: (node: CascaderNode<T>) => boolean;
151
+ /** Always `false` without `cascade`: partial selection needs propagation. */
152
+ isIndeterminate: (node: CascaderNode<T>) => boolean;
153
+ /**
154
+ * O(1) read of `selectedDescendants`; a memoised row may not subscribe.
155
+ * Unlike `isIndeterminate` this answers in every mode.
156
+ */
157
+ selectedDescendantCount: (node: CascaderNode<T>) => number;
158
+ }
159
+ declare const CascaderActionsContext: React$1.Context<CascaderActionsContextValue<unknown> | undefined>;
160
+ declare function useCascaderActions<T = unknown>(): CascaderActionsContextValue<T>;
161
+ /**
162
+ * Their own context, republished every render. They cannot ride on the actions
163
+ * context: an inline closure read off a memoised object is whichever closure
164
+ * that object captured, so the row would call a stale prop over stale state.
165
+ */
166
+ interface CascaderRenderContextValue<T = unknown> {
167
+ renderItem?: (node: CascaderNode<T>, state: CascaderItemState<T>) => React$1.ReactNode;
168
+ renderLabel?: (node: CascaderNode<T>, state: CascaderItemState<T>) => React$1.ReactNode;
169
+ }
170
+ declare const CascaderRenderContext: React$1.Context<CascaderRenderContextValue<unknown>>;
171
+ declare function useCascaderRender<T = unknown>(): CascaderRenderContextValue<T>;
172
+ interface CascaderHighlight {
173
+ index: number;
174
+ value: string | null;
175
+ }
176
+ /**
177
+ * An external store, deliberately NOT React state: `onItemHighlighted` fires on
178
+ * every arrow key AND every pointer move over the list, so `setState` would
179
+ * re-render the whole root at mousemove rate. A store re-renders subscribers
180
+ * only, which inside the primitive is the virtualizer.
181
+ */
182
+ interface CascaderHighlightStore {
183
+ subscribe: (onStoreChange: () => void) => () => void;
184
+ getSnapshot: () => CascaderHighlight;
185
+ set: (next: CascaderHighlight) => void;
186
+ }
187
+ declare function createCascaderHighlightStore(): CascaderHighlightStore;
188
+ declare const CascaderHighlightContext: React$1.Context<CascaderHighlightStore>;
189
+ /** Subscribes to the highlight. Re-renders ONLY the calling component. */
190
+ declare function useCascaderHighlight(): CascaderHighlight;
191
+ //#endregion
192
+ export { CascaderActionsContext, CascaderActionsContextValue, CascaderColumn, CascaderHighlight, CascaderHighlightContext, CascaderHighlightStore, CascaderItemState, CascaderRenderContext, CascaderRenderContextValue, CascaderStateContext, CascaderStateContextValue, createCascaderHighlightStore, useCascaderActions, useCascaderHighlight, useCascaderRender, useCascaderState };
193
+ //# sourceMappingURL=cascader-context.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cascader-context.d.ts","names":[],"sources":["../../../../src/components/reui/cascader/cascader-context.tsx"],"mappings":";;;;;;;;;UA2BiB,eAAe;EAC9B,QAAQ,aAAa;EACrB,OAAO,aAAa;EACpB;;EAEA;;EAEA;;UAGe,kBAAkB;EACjC;EACA;EACA;EACA;EACA;;EAEA,MAAM,aAAa;;;;;;UAWJ,0BAA0B;;EAEzC,OAAO,cAAc;EACrB;EACA,UAAU;EACV;EACA,eAAe,aAAa;;EAE5B,YAAY,aAAa;EACzB,aAAa,aAAa;;EAE1B,eAAe,aAAa;EAC5B,SAAS,eAAe;EACxB,UAAU,iBAAiB;EAC3B;;EAEA,qBAAqB;;;;;;EAMrB,YAAY,oBAAoB;;EAEhC,aAAa;EACb;;cAGI,sBAAoB,QAAA,QAAA;;;;;iBAMV,iBAAiB,gBAAgB,0BAA0B;;;;;;;UAkB1D,4BAA4B;EAC3C,OAAO,cAAc;EACrB,MAAM;EACN;;EAEA;;EAEA;;EAEA;EACA;EACA,SAAS;EACT,aAAa;EACb;EACA;EACA;;;;;;EAMA;EACA,QAAQ;;;;;;EAOR;;EAEA;;EAEA;EACA;EACA;EACA;;EAGA;;EAEA,WAAW;EACX,aAAa;;;;;EAKb,kBAAkB;;EAGlB,gBAAgB,cAAc;EAC9B,gBAAgB,0BAA0B;;EAE1C,sBAAsB,aAAa;EAEnC,UAAU,mBAAmB;EAC7B,YAAY;EACZ;EACA,YAAY;EACZ,iBAAiB;;;;;;;EAOjB,gBAAgB,aAAa;EAC7B;EACA,WAAW;;;;;EAKX,eAAe,kBAAkB,SAAS;;EAE1C,SAAS,MAAM,aAAa;EAC5B,WAAW,MAAM,aAAa;;EAE9B,aAAa,MAAM,aAAa,IAAI;;EAEpC,cAAc,kBAAkB,aAAa;EAC7C,WAAW,MAAM,aAAa;EAC9B,eAAe,MAAM,aAAa;EAClC,aAAa,MAAM,aAAa;;EAEhC,kBAAkB,MAAM,aAAa;;;;;EAKrC,0BAA0B,MAAM,aAAa;;cAGzC,wBAAsB,QAAA,QAAA;iBAIZ,mBAAmB,gBAAgB,4BAA4B;;;;;;UAiB9D,2BAA2B;EAC1C,cAAc,MAAM,aAAa,IAAI,OAAO,kBAAkB,OAAO,QAAM;EAC3E,eAAe,MAAM,aAAa,IAAI,OAAO,kBAAkB,OAAO,QAAM;;cAGxE,uBAAqB,QAAA,QAAA;iBAEX,kBAAkB,gBAAgB,2BAA2B;UAQ5D;EACf;EACA;;;;;;;;UASe;EACf,YAAY;EACZ,mBAAmB;EACnB,MAAM,MAAM;;iBAKE,gCAAgC;cA0B1C,0BAAwB,QAAA,QAAA;;iBAId,wBAAwB"}
@@ -0,0 +1,59 @@
1
+ "use client";
2
+ import * as React$1 from "react";
3
+ //#region src/components/reui/cascader/cascader-context.tsx
4
+ const CascaderStateContext = React$1.createContext(void 0);
5
+ /**
6
+ * One provider serves every `T`, so the context holds an erased `unknown` value
7
+ * and this cast restores it. The primitive never inspects the payload.
8
+ */
9
+ function useCascaderState() {
10
+ const context = React$1.useContext(CascaderStateContext);
11
+ if (!context) throw new Error("useCascaderState must be used within a Cascader");
12
+ return context;
13
+ }
14
+ const CascaderActionsContext = React$1.createContext(void 0);
15
+ function useCascaderActions() {
16
+ const context = React$1.useContext(CascaderActionsContext);
17
+ if (!context) throw new Error("useCascaderActions must be used within a Cascader");
18
+ return context;
19
+ }
20
+ const CascaderRenderContext = React$1.createContext({});
21
+ function useCascaderRender() {
22
+ return React$1.useContext(CascaderRenderContext);
23
+ }
24
+ const NO_HIGHLIGHT = {
25
+ index: -1,
26
+ value: null
27
+ };
28
+ function createCascaderHighlightStore() {
29
+ let snapshot = NO_HIGHLIGHT;
30
+ const listeners = /* @__PURE__ */ new Set();
31
+ return {
32
+ subscribe(onStoreChange) {
33
+ listeners.add(onStoreChange);
34
+ return () => {
35
+ listeners.delete(onStoreChange);
36
+ };
37
+ },
38
+ getSnapshot() {
39
+ return snapshot;
40
+ },
41
+ set(next) {
42
+ if (next.index === snapshot.index && next.value === snapshot.value) return;
43
+ snapshot = next;
44
+ for (const listener of listeners) listener();
45
+ }
46
+ };
47
+ }
48
+ /** Shared and permanently empty, so the hook degrades outside a `Cascader`. */
49
+ const FALLBACK_HIGHLIGHT_STORE = createCascaderHighlightStore();
50
+ const CascaderHighlightContext = React$1.createContext(FALLBACK_HIGHLIGHT_STORE);
51
+ /** Subscribes to the highlight. Re-renders ONLY the calling component. */
52
+ function useCascaderHighlight() {
53
+ const store = React$1.useContext(CascaderHighlightContext);
54
+ return React$1.useSyncExternalStore(store.subscribe, store.getSnapshot, store.getSnapshot);
55
+ }
56
+ //#endregion
57
+ export { CascaderActionsContext, CascaderHighlightContext, CascaderRenderContext, CascaderStateContext, createCascaderHighlightStore, useCascaderActions, useCascaderHighlight, useCascaderRender, useCascaderState };
58
+
59
+ //# sourceMappingURL=cascader-context.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cascader-context.js","names":["React"],"sources":["../../../../src/components/reui/cascader/cascader-context.tsx"],"sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\n\nimport type {\n CascaderActionItem,\n CascaderChangeReason,\n CascaderFlatNode,\n CascaderIndex,\n CascaderLabels,\n CascaderLoadState,\n CascaderMode,\n CascaderNode,\n CascaderSearchScope,\n} from \"./cascader-types\";\n\n/**\n * Four contexts, not one: actions (config and callbacks, near-stable), state\n * (every keystroke), render (`renderItem` identity) and highlight (every arrow\n * key and pointer move). One combined context re-rendered every row on every\n * keystroke, which is what made `React.memo` on the row worth nothing.\n */\n\n/* -------------------------------------------------------------------------- */\n/* Shared types */\n/* -------------------------------------------------------------------------- */\n\nexport interface CascaderColumn<T = unknown> {\n parent: CascaderNode<T> | null;\n items: CascaderNode<T>[];\n depth: number;\n /** The node in this column that is drilled into, if any. */\n activeValue: string | null;\n /** Whether this is the deepest column, the one Base UI owns. */\n active: boolean;\n}\n\nexport interface CascaderItemState<T = unknown> {\n branch: boolean;\n selected: boolean;\n disabled: boolean;\n depth: number;\n count: number;\n /** Ancestor chain, root first. Populated for deep-search rows. */\n path: CascaderNode<T>[];\n}\n\n/* -------------------------------------------------------------------------- */\n/* State */\n/* -------------------------------------------------------------------------- */\n\n/**\n * Everything derived from the query, the path and the selection. One keystroke\n * rebuilds most of it, so never subscribe to it from a row.\n */\nexport interface CascaderStateContextValue<T = unknown> {\n /** Same `useMemo` identity as the actions context's `index`. */\n index: CascaderIndex<T>;\n path: string[];\n expanded: ReadonlySet<string>;\n query: string;\n currentParent: CascaderNode<T> | null;\n /** Rows for the current level, already filtered. */\n levelItems: CascaderNode<T>[];\n deepResults: CascaderNode<T>[] | null;\n /** What `Combobox.Root` is currently rendering, in render order. */\n renderedItems: CascaderNode<T>[];\n columns: CascaderColumn<T>[];\n treeRows: CascaderFlatNode<T>[];\n selectedValues: string[];\n /** Selected nodes below each value, at any depth. Absent means zero. */\n selectedDescendants: ReadonlyMap<string, number>;\n /**\n * Per level, keyed by parent value or `CASCADER_ROOT_KEY`. MEMBERSHIP is the\n * discriminator: no entry means never fetched, an entry with no `loading`, no\n * `error` and no children means fetched and genuinely empty.\n */\n loadStates: ReadonlyMap<string, CascaderLoadState>;\n /** Async search, `null` when idle. Separate: a search belongs to no level. */\n searchState: CascaderLoadState | null;\n announcement: string;\n}\n\nconst CascaderStateContext = React.createContext<CascaderStateContextValue | undefined>(undefined);\n\n/**\n * One provider serves every `T`, so the context holds an erased `unknown` value\n * and this cast restores it. The primitive never inspects the payload.\n */\nexport function useCascaderState<T = unknown>(): CascaderStateContextValue<T> {\n const context = React.useContext(CascaderStateContext);\n if (!context) {\n throw new Error(\"useCascaderState must be used within a Cascader\");\n }\n return context as unknown as CascaderStateContextValue<T>;\n}\n\n/* -------------------------------------------------------------------------- */\n/* Actions */\n/* -------------------------------------------------------------------------- */\n\n/**\n * Config and callbacks, slow enough that a memoised row can subscribe: the\n * mutators are `[]`-dep callbacks over a latest-props ref. The three predicates\n * are the exception, read DURING RENDER where a ref written in an effect would\n * return the previous commit's answer, so each is memoised on its own input.\n */\nexport interface CascaderActionsContextValue<T = unknown> {\n index: CascaderIndex<T>;\n mode: CascaderMode;\n multiple: boolean;\n /** Multi-select only: a commit propagates over the LOADED subtree. */\n cascade: boolean;\n /** Whether a BRANCH is committable. Per-LIST: the check gutter is a COLUMN. */\n branchesSelectable: boolean;\n /** Draws the SINGLE-SELECT check and its gutter. Ignored in multi-select. */\n indicator: boolean;\n expandTrigger?: \"click\" | \"hover\";\n actions: CascaderActionItem[];\n searchScope: CascaderSearchScope;\n maxHeight?: number | string;\n inline: boolean;\n invalid: boolean;\n /**\n * Id prefix; columns are `${baseId}-column-${depth}`. The SCHEME is contract:\n * the filters primitive's `FilterMenuPinKeeper` restores its highlight across\n * a live re-pin through `${baseId}-column-0` and the `cascader-item` slot.\n */\n baseId: string;\n labels: CascaderLabels;\n\n /**\n * Whether rows are WINDOWED. Also handed to `Combobox.Root`, which is what\n * makes an explicit row `index` legal: forwarding one while this is false\n * makes `aria-activedescendant` resolve to nothing. Latched per level.\n */\n virtualized: boolean;\n /** Mounts a windowing renderer, returns its unregister. LAYOUT effect only. */\n registerVirtualRenderer: () => () => void;\n /** The root's `virtualize` prop. `undefined` means \"decide by count\". */\n virtualize?: boolean;\n virtualizeThreshold: number;\n estimateRowSize: number;\n overscan: number;\n\n /** Tells \"this level is empty\" from \"not fetched yet\" before a load state. */\n hasLoader: boolean;\n /** Next page of a level. Latched: a page with nothing new is not re-asked. */\n loadMore: (parentKey: string) => void;\n retryLevel: (parentKey: string) => void;\n /**\n * Evicts one level's async cache, `null` for the root, so membership reads\n * never-loaded. A level that is on screen when evicted refetches at once.\n */\n invalidateLevel: (value: string | null) => void;\n\n /** Index as of the last commit. Use in the stable callbacks, not `index`. */\n getIndex: () => CascaderIndex<T>;\n getState: () => CascaderStateContextValue<T>;\n /** Highlighted row or null. A getter: the highlight moves per arrow key. */\n getHighlighted: () => CascaderNode<T> | null;\n\n setPath: (next: string[] | ((prev: string[]) => string[])) => void;\n pushLevel: (value: string) => void;\n popLevel: () => void;\n goToDepth: (depth: number) => void;\n toggleExpanded: (value: string) => void;\n /**\n * Registers a footer submenu as open or closed. `Combobox` has no\n * `FloatingTree`, so one Escape would dismiss the flyout AND the cascader;\n * the root's `onOpenChange` guard cancels the close while any is open, from a\n * ref so it reads as of that event without re-rendering the root.\n */\n setFlyoutOpen: (key: string, open: boolean) => void;\n hasOpenFlyout: () => boolean;\n setQuery: (next: string) => void;\n /**\n * Replaces the selection. `onValueChange` diffs it against the current one\n * for its node and reason; pass `reason` only when the caller knows better.\n */\n setSelection: (values: string[], reason?: CascaderChangeReason) => void;\n /** Commits a node, for rows outside the listbox such as ancestor columns. */\n commit: (node: CascaderNode<T>) => void;\n navigate: (node: CascaderNode<T>) => void;\n /** Into `node` as a child of `depth`, replacing anything deeper. */\n navigateAt: (node: CascaderNode<T>, depth: number) => void;\n /** Never undefined: falls back to a remembered label, then a synthetic node. */\n resolveNode: (value: string) => CascaderNode<T>;\n isBranch: (node: CascaderNode<T>) => boolean;\n isSelectable: (node: CascaderNode<T>) => boolean;\n isSelected: (node: CascaderNode<T>) => boolean;\n /** Always `false` without `cascade`: partial selection needs propagation. */\n isIndeterminate: (node: CascaderNode<T>) => boolean;\n /**\n * O(1) read of `selectedDescendants`; a memoised row may not subscribe.\n * Unlike `isIndeterminate` this answers in every mode.\n */\n selectedDescendantCount: (node: CascaderNode<T>) => number;\n}\n\nconst CascaderActionsContext = React.createContext<CascaderActionsContextValue | undefined>(\n undefined,\n);\n\nexport function useCascaderActions<T = unknown>(): CascaderActionsContextValue<T> {\n const context = React.useContext(CascaderActionsContext);\n if (!context) {\n throw new Error(\"useCascaderActions must be used within a Cascader\");\n }\n return context as unknown as CascaderActionsContextValue<T>;\n}\n\n/* -------------------------------------------------------------------------- */\n/* Render props */\n/* -------------------------------------------------------------------------- */\n\n/**\n * Their own context, republished every render. They cannot ride on the actions\n * context: an inline closure read off a memoised object is whichever closure\n * that object captured, so the row would call a stale prop over stale state.\n */\nexport interface CascaderRenderContextValue<T = unknown> {\n renderItem?: (node: CascaderNode<T>, state: CascaderItemState<T>) => React.ReactNode;\n renderLabel?: (node: CascaderNode<T>, state: CascaderItemState<T>) => React.ReactNode;\n}\n\nconst CascaderRenderContext = React.createContext<CascaderRenderContextValue>({});\n\nexport function useCascaderRender<T = unknown>(): CascaderRenderContextValue<T> {\n return React.useContext(CascaderRenderContext) as CascaderRenderContextValue<T>;\n}\n\n/* -------------------------------------------------------------------------- */\n/* Highlight store */\n/* -------------------------------------------------------------------------- */\n\nexport interface CascaderHighlight {\n index: number;\n value: string | null;\n}\n\n/**\n * An external store, deliberately NOT React state: `onItemHighlighted` fires on\n * every arrow key AND every pointer move over the list, so `setState` would\n * re-render the whole root at mousemove rate. A store re-renders subscribers\n * only, which inside the primitive is the virtualizer.\n */\nexport interface CascaderHighlightStore {\n subscribe: (onStoreChange: () => void) => () => void;\n getSnapshot: () => CascaderHighlight;\n set: (next: CascaderHighlight) => void;\n}\n\nconst NO_HIGHLIGHT: CascaderHighlight = { index: -1, value: null };\n\nexport function createCascaderHighlightStore(): CascaderHighlightStore {\n let snapshot: CascaderHighlight = NO_HIGHLIGHT;\n const listeners = new Set<() => void>();\n\n return {\n subscribe(onStoreChange) {\n listeners.add(onStoreChange);\n return () => {\n listeners.delete(onStoreChange);\n };\n },\n // The SAME object until something changes; `useSyncExternalStore` needs it.\n getSnapshot() {\n return snapshot;\n },\n set(next) {\n if (next.index === snapshot.index && next.value === snapshot.value) return;\n snapshot = next;\n for (const listener of listeners) listener();\n },\n };\n}\n\n/** Shared and permanently empty, so the hook degrades outside a `Cascader`. */\nconst FALLBACK_HIGHLIGHT_STORE = createCascaderHighlightStore();\n\nconst CascaderHighlightContext =\n React.createContext<CascaderHighlightStore>(FALLBACK_HIGHLIGHT_STORE);\n\n/** Subscribes to the highlight. Re-renders ONLY the calling component. */\nexport function useCascaderHighlight(): CascaderHighlight {\n const store = React.useContext(CascaderHighlightContext);\n return React.useSyncExternalStore(store.subscribe, store.getSnapshot, store.getSnapshot);\n}\n\nexport {\n CascaderActionsContext,\n CascaderHighlightContext,\n CascaderRenderContext,\n CascaderStateContext,\n};\n"],"mappings":";;;AAmFA,MAAM,uBAAuBA,QAAM,cAAqD,KAAA,CAAS;;;;;AAMjG,SAAgB,mBAA8D;CAC5E,MAAM,UAAUA,QAAM,WAAW,oBAAoB;CACrD,IAAI,CAAC,SACH,MAAM,IAAI,MAAM,iDAAiD;CAEnE,OAAO;AACT;AAyGA,MAAM,yBAAyBA,QAAM,cACnC,KAAA,CACF;AAEA,SAAgB,qBAAkE;CAChF,MAAM,UAAUA,QAAM,WAAW,sBAAsB;CACvD,IAAI,CAAC,SACH,MAAM,IAAI,MAAM,mDAAmD;CAErE,OAAO;AACT;AAgBA,MAAM,wBAAwBA,QAAM,cAA0C,CAAC,CAAC;AAEhF,SAAgB,oBAAgE;CAC9E,OAAOA,QAAM,WAAW,qBAAqB;AAC/C;AAuBA,MAAM,eAAkC;CAAE,OAAO;CAAI,OAAO;AAAK;AAEjE,SAAgB,+BAAuD;CACrE,IAAI,WAA8B;CAClC,MAAM,4BAAY,IAAI,IAAgB;CAEtC,OAAO;EACL,UAAU,eAAe;GACvB,UAAU,IAAI,aAAa;GAC3B,aAAa;IACX,UAAU,OAAO,aAAa;GAChC;EACF;EAEA,cAAc;GACZ,OAAO;EACT;EACA,IAAI,MAAM;GACR,IAAI,KAAK,UAAU,SAAS,SAAS,KAAK,UAAU,SAAS,OAAO;GACpE,WAAW;GACX,KAAK,MAAM,YAAY,WAAW,SAAS;EAC7C;CACF;AACF;;AAGA,MAAM,2BAA2B,6BAA6B;AAE9D,MAAM,2BACJA,QAAM,cAAsC,wBAAwB;;AAGtE,SAAgB,uBAA0C;CACxD,MAAM,QAAQA,QAAM,WAAW,wBAAwB;CACvD,OAAOA,QAAM,qBAAqB,MAAM,WAAW,MAAM,aAAa,MAAM,WAAW;AACzF"}
@@ -0,0 +1,85 @@
1
+ import * as React$1 from "react";
2
+ import { Popover } from "@base-ui/react";
3
+ //#region src/components/reui/cascader/cascader-footer.d.ts
4
+ type CascaderFooterProps = React$1.ComponentProps<"div">;
5
+ /**
6
+ * Actions pinned below the list, a SIBLING of `CascaderList`. Children win
7
+ * over the root's `actions` prop; with neither it renders nothing.
8
+ */
9
+ declare function CascaderFooter({ className, children, onKeyDown, ...props }: CascaderFooterProps): React$1.JSX.Element | null;
10
+ interface CascaderActionProps extends Omit<React$1.ComponentProps<"button">, "onSelect"> {
11
+ icon?: React$1.ReactNode;
12
+ /** Fires on press, after `onClick`, and not at all when disabled. */
13
+ onSelect?: () => void;
14
+ }
15
+ /**
16
+ * One footer command, shaped like a row and deliberately NOT one. A real
17
+ * `<button>`, never a `Combobox.Item`: an item would join the arrow-key ring,
18
+ * appear in `filteredItems`, and vanish the moment a query matched nothing -
19
+ * exactly when "Create new attribute" is most useful. Disabled is
20
+ * `aria-disabled`, never the native attribute: that one is not a tab stop and
21
+ * the panel's Tab order reads `button:not([disabled])`, so a footer whose ONLY
22
+ * row is a disabled command had no stop after the search field (measured on
23
+ * `c-cascader-8`). Staying focusable costs the guards below, plus the
24
+ * greyed-out look: `CASCADER_ACTION_CLASS` keys that off `aria-disabled`
25
+ * instead of `:disabled`.
26
+ */
27
+ declare function CascaderAction({ className, icon, children, onSelect, onClick, onKeyDown, disabled, ...props }: CascaderActionProps): React$1.JSX.Element;
28
+ interface CascaderSubmenuContextValue {
29
+ rowRef: React$1.RefObject<HTMLButtonElement | null>;
30
+ open: boolean;
31
+ setOpen: (open: boolean) => void;
32
+ close: () => void;
33
+ /** Names the flyout: a menu is labelled by the control that opens it. */
34
+ triggerId: string;
35
+ /**
36
+ * Whether the pending open came from the KEYBOARD. Base UI's own `openType`
37
+ * calls the opening arrow a POINTER open, because the trigger intercepts it
38
+ * and calls `setOpen` (measured: focus landed on the popup, not the first
39
+ * entry). A ref, so reading it in the focus phase cannot render.
40
+ */
41
+ keyboardRef: React$1.RefObject<boolean>;
42
+ }
43
+ /** The flyout's own state. `close()` is the one a custom entry usually wants. */
44
+ declare function useCascaderSubmenu(): CascaderSubmenuContextValue;
45
+ interface CascaderSubmenuProps {
46
+ open?: boolean;
47
+ defaultOpen?: boolean;
48
+ onOpenChange?: (open: boolean) => void;
49
+ children?: React$1.ReactNode;
50
+ }
51
+ /**
52
+ * A footer row plus the flyout it opens. Registers with the cascader root
53
+ * while open, which turns one Escape into two. Cleared in an EFFECT, so the
54
+ * flyout still reads as open during the event that closed it.
55
+ */
56
+ declare function CascaderSubmenu({ open: openProp, defaultOpen, onOpenChange, children }: CascaderSubmenuProps): React$1.JSX.Element;
57
+ interface CascaderSubmenuTriggerProps extends Omit<React$1.ComponentProps<"button">, "onSelect"> {
58
+ icon?: React$1.ReactNode;
59
+ }
60
+ /**
61
+ * The footer row that opens the flyout, and its anchor. `aria-haspopup="menu"`
62
+ * rather than the `dialog` Base UI would announce: what opens is a list of
63
+ * commands with roving focus. `disabled` is intercepted, not forwarded:
64
+ * `Popover.Trigger` runs it through `useButton`, which writes the NATIVE
65
+ * attribute for a native `<button>` and takes the row out of the panel's Tab
66
+ * ring, the defect `CascaderAction` documents, and this component exposes no
67
+ * `focusableWhenDisabled` to opt out. Published as `aria-disabled`, with the
68
+ * arrow keys, Enter and Space, and the click closed by hand (`useClick`
69
+ * ignores `defaultPrevented`).
70
+ */
71
+ declare function CascaderSubmenuTrigger({ className, icon, children, onKeyDown, onClick, disabled, ...props }: CascaderSubmenuTriggerProps): React$1.JSX.Element;
72
+ interface CascaderSubmenuContentProps extends Popover.Popup.Props, Pick<Popover.Positioner.Props, "side" | "align" | "sideOffset" | "alignOffset"> {}
73
+ /**
74
+ * The flyout itself. `Portal` with NO `container`: a nested portal resolves to
75
+ * the parent portal node, the mechanism the file header describes.
76
+ */
77
+ declare function CascaderSubmenuContent({ className, children, onKeyDown, side, align, sideOffset, alignOffset, ...props }: CascaderSubmenuContentProps): React$1.JSX.Element;
78
+ /**
79
+ * Whether the footer would render anything, for a wrapper (a separator, a grid
80
+ * row) that has to make the same call `CascaderFooter` already makes.
81
+ */
82
+ declare function useCascaderHasActions(): boolean;
83
+ //#endregion
84
+ export { CascaderAction, CascaderActionProps, CascaderFooter, CascaderFooterProps, CascaderSubmenu, CascaderSubmenuContent, CascaderSubmenuContentProps, CascaderSubmenuProps, CascaderSubmenuTrigger, CascaderSubmenuTriggerProps, useCascaderHasActions, useCascaderSubmenu };
85
+ //# sourceMappingURL=cascader-footer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cascader-footer.d.ts","names":[],"sources":["../../../../src/components/reui/cascader/cascader-footer.tsx"],"mappings":";;;KAgDY,sBAAsB,QAAM;;;;;iBAM/B,iBAAiB,WAAW,UAAU,cAAc,SAAS,sBAAmB,QAAA,IAAA;UA2JxE,4BAA4B,KAAK,QAAM;EACtD,OAAO,QAAM;;EAEb;;;;;;;;;;;;;;iBAsBO,iBACP,WACA,MACA,UACA,UACA,SACA,WACA,aACG,SACF,sBAAmB,QAAA,IAAA;UA6DZ;EACR,QAAQ,QAAM,UAAU;EACxB;EACA,UAAU;EACV;;EAEA;;;;;;;EAOA,aAAa,QAAM;;;iBAuBL,sBAAsB;UAQrB;EACf;EACA;EACA,gBAAgB;EAChB,WAAW,QAAM;;;;;;;iBAQV,kBACP,MAAM,UACN,aACA,cACA,YACC,uBAAoB,QAAA,IAAA;UA2CN,oCACP,KAAK,QAAM;EACnB,OAAO,QAAM;;;;;;;;;;;;;iBAmBN,yBACP,WACA,MACA,UACA,WACA,SACA,aACG,SACF,8BAA2B,QAAA,IAAA;UAuFb,oCACP,QAAiB,MAAM,OAC7B,KAAK,QAAiB,WAAW;;;;;iBAW5B,yBACP,WACA,UACA,WACA,MACA,OACA,YACA,gBACG,SACF,8BAA2B,QAAA,IAAA;;;;;iBAwId"}