@kumix/ui 0.3.18 → 0.4.1

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 (584) hide show
  1. package/README.md +28 -17
  2. package/dist/account-avatar-DILzuuvz.js +23 -0
  3. package/dist/account-avatar-DILzuuvz.js.map +1 -0
  4. package/dist/{cascader-types-BnH6wYD-.d.ts → cascader-types-DVT-znZ-.d.ts} +6 -3
  5. package/dist/cascader-types-DVT-znZ-.d.ts.map +1 -0
  6. package/dist/components/agents/approval-card/index.d.ts +2 -0
  7. package/dist/components/agents/approval-card/index.d.ts.map +1 -1
  8. package/dist/components/agents/approval-card/index.js +2 -0
  9. package/dist/components/agents/approval-card/index.js.map +1 -1
  10. package/dist/components/agents/citations.d.ts +14 -2
  11. package/dist/components/agents/citations.d.ts.map +1 -1
  12. package/dist/components/agents/citations.js +11 -7
  13. package/dist/components/agents/citations.js.map +1 -1
  14. package/dist/components/agents/loading-states/reasoning-text.d.ts.map +1 -1
  15. package/dist/components/agents/loading-states/reasoning-text.js +3 -0
  16. package/dist/components/agents/loading-states/reasoning-text.js.map +1 -1
  17. package/dist/components/agents/voice-orb.d.ts +19 -0
  18. package/dist/components/agents/voice-orb.d.ts.map +1 -0
  19. package/dist/components/agents/voice-orb.js +389 -0
  20. package/dist/components/agents/voice-orb.js.map +1 -0
  21. package/dist/components/charts/bump-chart/context.d.ts +2 -0
  22. package/dist/components/charts/bump-chart/context.js +2 -0
  23. package/dist/components/charts/bump-chart/legend.d.ts +6 -0
  24. package/dist/components/charts/bump-chart/legend.d.ts.map +1 -0
  25. package/dist/components/charts/bump-chart/legend.js +60 -0
  26. package/dist/components/charts/bump-chart/legend.js.map +1 -0
  27. package/dist/components/charts/bump-chart/plot.d.ts +6 -0
  28. package/dist/components/charts/bump-chart/plot.d.ts.map +1 -0
  29. package/dist/components/charts/bump-chart/plot.js +2 -0
  30. package/dist/components/charts/bump-chart/point.d.ts +10 -0
  31. package/dist/components/charts/bump-chart/point.d.ts.map +1 -0
  32. package/dist/components/charts/bump-chart/point.js +124 -0
  33. package/dist/components/charts/bump-chart/point.js.map +1 -0
  34. package/dist/components/charts/bump-chart/series.d.ts +12 -0
  35. package/dist/components/charts/bump-chart/series.d.ts.map +1 -0
  36. package/dist/components/charts/bump-chart/series.js +101 -0
  37. package/dist/components/charts/bump-chart/series.js.map +1 -0
  38. package/dist/components/charts/bump-chart.d.ts +10 -0
  39. package/dist/components/charts/bump-chart.d.ts.map +1 -0
  40. package/dist/components/charts/bump-chart.js +23 -0
  41. package/dist/components/charts/bump-chart.js.map +1 -0
  42. package/dist/components/charts/candlestick-chart/context.d.ts +79 -0
  43. package/dist/components/charts/candlestick-chart/context.d.ts.map +1 -0
  44. package/dist/components/charts/candlestick-chart/context.js +69 -0
  45. package/dist/components/charts/candlestick-chart/context.js.map +1 -0
  46. package/dist/components/charts/candlestick-chart/legend.d.ts +12 -0
  47. package/dist/components/charts/candlestick-chart/legend.d.ts.map +1 -0
  48. package/dist/components/charts/candlestick-chart/legend.js +56 -0
  49. package/dist/components/charts/candlestick-chart/legend.js.map +1 -0
  50. package/dist/components/charts/candlestick-chart/plot.d.ts +9 -0
  51. package/dist/components/charts/candlestick-chart/plot.d.ts.map +1 -0
  52. package/dist/components/charts/candlestick-chart/plot.js +218 -0
  53. package/dist/components/charts/candlestick-chart/plot.js.map +1 -0
  54. package/dist/components/charts/candlestick-chart.d.ts +18 -0
  55. package/dist/components/charts/candlestick-chart.d.ts.map +1 -0
  56. package/dist/components/charts/candlestick-chart.js +34 -0
  57. package/dist/components/charts/candlestick-chart.js.map +1 -0
  58. package/dist/components/charts/composition-chart/context.d.ts +2 -0
  59. package/dist/components/charts/composition-chart/context.js +2 -0
  60. package/dist/components/charts/composition-chart/legend.d.ts +6 -0
  61. package/dist/components/charts/composition-chart/legend.d.ts.map +1 -0
  62. package/dist/components/charts/composition-chart/legend.js +51 -0
  63. package/dist/components/charts/composition-chart/legend.js.map +1 -0
  64. package/dist/components/charts/composition-chart/plot.d.ts +6 -0
  65. package/dist/components/charts/composition-chart/plot.d.ts.map +1 -0
  66. package/dist/components/charts/composition-chart/plot.js +174 -0
  67. package/dist/components/charts/composition-chart/plot.js.map +1 -0
  68. package/dist/components/charts/composition-chart/tooltip-content.d.ts +6 -0
  69. package/dist/components/charts/composition-chart/tooltip-content.d.ts.map +1 -0
  70. package/dist/components/charts/composition-chart/tooltip-content.js +63 -0
  71. package/dist/components/charts/composition-chart/tooltip-content.js.map +1 -0
  72. package/dist/components/charts/composition-chart.d.ts +9 -0
  73. package/dist/components/charts/composition-chart.d.ts.map +1 -0
  74. package/dist/components/charts/composition-chart.js +26 -0
  75. package/dist/components/charts/composition-chart.js.map +1 -0
  76. package/dist/components/charts/donut-chart/center.d.ts +16 -0
  77. package/dist/components/charts/donut-chart/center.d.ts.map +1 -0
  78. package/dist/components/charts/donut-chart/center.js +78 -0
  79. package/dist/components/charts/donut-chart/center.js.map +1 -0
  80. package/dist/components/charts/donut-chart/context.d.ts +68 -0
  81. package/dist/components/charts/donut-chart/context.d.ts.map +1 -0
  82. package/dist/components/charts/donut-chart/context.js +2 -0
  83. package/dist/components/charts/donut-chart/legend.d.ts +17 -0
  84. package/dist/components/charts/donut-chart/legend.d.ts.map +1 -0
  85. package/dist/components/charts/donut-chart/legend.js +85 -0
  86. package/dist/components/charts/donut-chart/legend.js.map +1 -0
  87. package/dist/components/charts/donut-chart/plot.d.ts +10 -0
  88. package/dist/components/charts/donut-chart/plot.d.ts.map +1 -0
  89. package/dist/components/charts/donut-chart/plot.js +108 -0
  90. package/dist/components/charts/donut-chart/plot.js.map +1 -0
  91. package/dist/components/charts/donut-chart.d.ts +22 -0
  92. package/dist/components/charts/donut-chart.d.ts.map +1 -0
  93. package/dist/components/charts/donut-chart.js +37 -0
  94. package/dist/components/charts/donut-chart.js.map +1 -0
  95. package/dist/components/charts/funnel-chart.d.ts +50 -0
  96. package/dist/components/charts/funnel-chart.d.ts.map +1 -0
  97. package/dist/components/charts/funnel-chart.js +215 -0
  98. package/dist/components/charts/funnel-chart.js.map +1 -0
  99. package/dist/components/charts/heat-calendar/grid.d.ts +8 -0
  100. package/dist/components/charts/heat-calendar/grid.d.ts.map +1 -0
  101. package/dist/components/charts/heat-calendar/grid.js +127 -0
  102. package/dist/components/charts/heat-calendar/grid.js.map +1 -0
  103. package/dist/components/charts/heat-calendar/legend.d.ts +6 -0
  104. package/dist/components/charts/heat-calendar/legend.d.ts.map +1 -0
  105. package/dist/components/charts/heat-calendar/legend.js +48 -0
  106. package/dist/components/charts/heat-calendar/legend.js.map +1 -0
  107. package/dist/components/charts/heat-calendar/tooltip.d.ts +2 -0
  108. package/dist/components/charts/heat-calendar/tooltip.js +50 -0
  109. package/dist/components/charts/heat-calendar/tooltip.js.map +1 -0
  110. package/dist/components/charts/heat-calendar.d.ts +9 -0
  111. package/dist/components/charts/heat-calendar.d.ts.map +1 -0
  112. package/dist/components/charts/heat-calendar.js +23 -0
  113. package/dist/components/charts/heat-calendar.js.map +1 -0
  114. package/dist/components/charts/liquidity-heatmap.d.ts +51 -0
  115. package/dist/components/charts/liquidity-heatmap.d.ts.map +1 -0
  116. package/dist/components/charts/liquidity-heatmap.js +311 -0
  117. package/dist/components/charts/liquidity-heatmap.js.map +1 -0
  118. package/dist/components/charts/order-book/depth-row.d.ts +19 -0
  119. package/dist/components/charts/order-book/depth-row.d.ts.map +1 -0
  120. package/dist/components/charts/order-book/depth-row.js +107 -0
  121. package/dist/components/charts/order-book/depth-row.js.map +1 -0
  122. package/dist/components/charts/order-book.d.ts +89 -0
  123. package/dist/components/charts/order-book.d.ts.map +1 -0
  124. package/dist/components/charts/order-book.js +282 -0
  125. package/dist/components/charts/order-book.js.map +1 -0
  126. package/dist/components/charts/price-target-fan/header.d.ts +8 -0
  127. package/dist/components/charts/price-target-fan/header.d.ts.map +1 -0
  128. package/dist/components/charts/price-target-fan/header.js +43 -0
  129. package/dist/components/charts/price-target-fan/header.js.map +1 -0
  130. package/dist/components/charts/price-target-fan/plot.d.ts +16 -0
  131. package/dist/components/charts/price-target-fan/plot.d.ts.map +1 -0
  132. package/dist/components/charts/price-target-fan/plot.js +142 -0
  133. package/dist/components/charts/price-target-fan/plot.js.map +1 -0
  134. package/dist/components/charts/price-target-fan/series.d.ts +15 -0
  135. package/dist/components/charts/price-target-fan/series.d.ts.map +1 -0
  136. package/dist/components/charts/price-target-fan/series.js +238 -0
  137. package/dist/components/charts/price-target-fan/series.js.map +1 -0
  138. package/dist/components/charts/price-target-fan/tooltip.d.ts +2 -0
  139. package/dist/components/charts/price-target-fan/tooltip.js +58 -0
  140. package/dist/components/charts/price-target-fan/tooltip.js.map +1 -0
  141. package/dist/components/charts/price-target-fan.d.ts +10 -0
  142. package/dist/components/charts/price-target-fan.d.ts.map +1 -0
  143. package/dist/components/charts/price-target-fan.js +24 -0
  144. package/dist/components/charts/price-target-fan.js.map +1 -0
  145. package/dist/components/charts/returns-calendar/grid.d.ts +8 -0
  146. package/dist/components/charts/returns-calendar/grid.d.ts.map +1 -0
  147. package/dist/components/charts/returns-calendar/grid.js +176 -0
  148. package/dist/components/charts/returns-calendar/grid.js.map +1 -0
  149. package/dist/components/charts/returns-calendar/tooltip.d.ts +2 -0
  150. package/dist/components/charts/returns-calendar/tooltip.js +55 -0
  151. package/dist/components/charts/returns-calendar/tooltip.js.map +1 -0
  152. package/dist/components/charts/returns-calendar.d.ts +48 -0
  153. package/dist/components/charts/returns-calendar.d.ts.map +1 -0
  154. package/dist/components/charts/returns-calendar.js +22 -0
  155. package/dist/components/charts/returns-calendar.js.map +1 -0
  156. package/dist/components/charts/status-bar/legend.d.ts +8 -0
  157. package/dist/components/charts/status-bar/legend.d.ts.map +1 -0
  158. package/dist/components/charts/status-bar/legend.js +37 -0
  159. package/dist/components/charts/status-bar/legend.js.map +1 -0
  160. package/dist/components/charts/status-bar/plot.d.ts +12 -0
  161. package/dist/components/charts/status-bar/plot.d.ts.map +1 -0
  162. package/dist/components/charts/status-bar/plot.js +176 -0
  163. package/dist/components/charts/status-bar/plot.js.map +1 -0
  164. package/dist/components/charts/status-bar/tooltip.d.ts +2 -0
  165. package/dist/components/charts/status-bar/tooltip.js +49 -0
  166. package/dist/components/charts/status-bar/tooltip.js.map +1 -0
  167. package/dist/components/charts/status-bar.d.ts +9 -0
  168. package/dist/components/charts/status-bar.d.ts.map +1 -0
  169. package/dist/components/charts/status-bar.js +64 -0
  170. package/dist/components/charts/status-bar.js.map +1 -0
  171. package/dist/components/charts/treemap/legend.d.ts +8 -0
  172. package/dist/components/charts/treemap/legend.d.ts.map +1 -0
  173. package/dist/components/charts/treemap/legend.js +35 -0
  174. package/dist/components/charts/treemap/legend.js.map +1 -0
  175. package/dist/components/charts/treemap/plot.d.ts +13 -0
  176. package/dist/components/charts/treemap/plot.d.ts.map +1 -0
  177. package/dist/components/charts/treemap/plot.js +123 -0
  178. package/dist/components/charts/treemap/plot.js.map +1 -0
  179. package/dist/components/charts/treemap/tile.d.ts +10 -0
  180. package/dist/components/charts/treemap/tile.d.ts.map +1 -0
  181. package/dist/components/charts/treemap/tile.js +114 -0
  182. package/dist/components/charts/treemap/tile.js.map +1 -0
  183. package/dist/components/charts/treemap/tooltip.d.ts +11 -0
  184. package/dist/components/charts/treemap/tooltip.d.ts.map +1 -0
  185. package/dist/components/charts/treemap/tooltip.js +73 -0
  186. package/dist/components/charts/treemap/tooltip.js.map +1 -0
  187. package/dist/components/charts/treemap.d.ts +56 -0
  188. package/dist/components/charts/treemap.d.ts.map +1 -0
  189. package/dist/components/charts/treemap.js +71 -0
  190. package/dist/components/charts/treemap.js.map +1 -0
  191. package/dist/components/charts/volume-profile/plot.d.ts +12 -0
  192. package/dist/components/charts/volume-profile/plot.d.ts.map +1 -0
  193. package/dist/components/charts/volume-profile/plot.js +211 -0
  194. package/dist/components/charts/volume-profile/plot.js.map +1 -0
  195. package/dist/components/charts/volume-profile/summary.d.ts +6 -0
  196. package/dist/components/charts/volume-profile/summary.d.ts.map +1 -0
  197. package/dist/components/charts/volume-profile/summary.js +76 -0
  198. package/dist/components/charts/volume-profile/summary.js.map +1 -0
  199. package/dist/components/charts/volume-profile/tooltip.d.ts +2 -0
  200. package/dist/components/charts/volume-profile/tooltip.js +84 -0
  201. package/dist/components/charts/volume-profile/tooltip.js.map +1 -0
  202. package/dist/components/charts/volume-profile.d.ts +111 -0
  203. package/dist/components/charts/volume-profile.d.ts.map +1 -0
  204. package/dist/components/charts/volume-profile.js +82 -0
  205. package/dist/components/charts/volume-profile.js.map +1 -0
  206. package/dist/components/custom/confirm-dialog.d.ts +1 -0
  207. package/dist/components/custom/toast.d.ts +1 -0
  208. package/dist/components/motion/action-swap.d.ts.map +1 -1
  209. package/dist/components/motion/action-swap.js +3 -0
  210. package/dist/components/motion/action-swap.js.map +1 -1
  211. package/dist/components/motion/alert.d.ts +40 -0
  212. package/dist/components/motion/alert.d.ts.map +1 -0
  213. package/dist/components/motion/alert.js +247 -0
  214. package/dist/components/motion/alert.js.map +1 -0
  215. package/dist/components/motion/animated-sidebar.d.ts +1 -0
  216. package/dist/components/motion/arc-picker.d.ts +28 -0
  217. package/dist/components/motion/arc-picker.d.ts.map +1 -0
  218. package/dist/components/motion/arc-picker.js +569 -0
  219. package/dist/components/motion/arc-picker.js.map +1 -0
  220. package/dist/components/motion/aspect-ratio.d.ts +23 -0
  221. package/dist/components/motion/aspect-ratio.d.ts.map +1 -0
  222. package/dist/components/motion/aspect-ratio.js +61 -0
  223. package/dist/components/motion/aspect-ratio.js.map +1 -0
  224. package/dist/components/motion/attachment-upload.d.ts.map +1 -1
  225. package/dist/components/motion/attachment-upload.js +1 -2
  226. package/dist/components/motion/attachment-upload.js.map +1 -1
  227. package/dist/components/motion/availability-scheduler/copy-menu.js +1 -2
  228. package/dist/components/motion/availability-scheduler/day-row.js +2 -2
  229. package/dist/components/motion/availability-scheduler/index.js +1 -1
  230. package/dist/components/motion/bloom-menu.d.ts +1 -0
  231. package/dist/components/motion/bounce-sidebar.d.ts.map +1 -1
  232. package/dist/components/motion/bounce-sidebar.js +34 -42
  233. package/dist/components/motion/bounce-sidebar.js.map +1 -1
  234. package/dist/components/motion/button/stateful.d.ts.map +1 -1
  235. package/dist/components/motion/button/stateful.js +3 -0
  236. package/dist/components/motion/button/stateful.js.map +1 -1
  237. package/dist/components/motion/card.d.ts +44 -0
  238. package/dist/components/motion/card.d.ts.map +1 -0
  239. package/dist/components/motion/card.js +122 -0
  240. package/dist/components/motion/card.js.map +1 -0
  241. package/dist/components/motion/checkbox.d.ts +3 -1
  242. package/dist/components/motion/checkbox.d.ts.map +1 -1
  243. package/dist/components/motion/checkbox.js +18 -6
  244. package/dist/components/motion/checkbox.js.map +1 -1
  245. package/dist/components/motion/collapsible.d.ts +34 -0
  246. package/dist/components/motion/collapsible.d.ts.map +1 -0
  247. package/dist/components/motion/collapsible.js +237 -0
  248. package/dist/components/motion/collapsible.js.map +1 -0
  249. package/dist/components/motion/color-picker.d.ts +110 -0
  250. package/dist/components/motion/color-picker.d.ts.map +1 -0
  251. package/dist/components/motion/color-picker.js +1053 -0
  252. package/dist/components/motion/color-picker.js.map +1 -0
  253. package/dist/components/motion/color-selector.d.ts.map +1 -1
  254. package/dist/components/motion/color-selector.js +9 -2
  255. package/dist/components/motion/color-selector.js.map +1 -1
  256. package/dist/components/motion/combobox/content.d.ts +1 -0
  257. package/dist/components/motion/command-palette.js +2 -2
  258. package/dist/components/motion/command-palette.js.map +1 -1
  259. package/dist/components/motion/context-menu.d.ts +1 -0
  260. package/dist/components/motion/date-range-picker.d.ts +107 -0
  261. package/dist/components/motion/date-range-picker.d.ts.map +1 -0
  262. package/dist/components/motion/date-range-picker.js +907 -0
  263. package/dist/components/motion/date-range-picker.js.map +1 -0
  264. package/dist/components/motion/digit-swap.d.ts +9 -1
  265. package/dist/components/motion/digit-swap.d.ts.map +1 -1
  266. package/dist/components/motion/digit-swap.js +18 -7
  267. package/dist/components/motion/digit-swap.js.map +1 -1
  268. package/dist/components/motion/expandable-control.d.ts +1 -0
  269. package/dist/components/motion/knockout-bracket.d.ts +190 -0
  270. package/dist/components/motion/knockout-bracket.d.ts.map +1 -0
  271. package/dist/components/motion/knockout-bracket.js +952 -0
  272. package/dist/components/motion/knockout-bracket.js.map +1 -0
  273. package/dist/components/motion/knockout-wheel.d.ts +183 -0
  274. package/dist/components/motion/knockout-wheel.d.ts.map +1 -0
  275. package/dist/components/motion/knockout-wheel.js +1038 -0
  276. package/dist/components/motion/knockout-wheel.js.map +1 -0
  277. package/dist/components/motion/morphing-lightbox.d.ts +67 -0
  278. package/dist/components/motion/morphing-lightbox.d.ts.map +1 -0
  279. package/dist/components/motion/morphing-lightbox.js +499 -0
  280. package/dist/components/motion/morphing-lightbox.js.map +1 -0
  281. package/dist/components/motion/morphing-search-chips.d.ts +54 -0
  282. package/dist/components/motion/morphing-search-chips.d.ts.map +1 -0
  283. package/dist/components/motion/morphing-search-chips.js +599 -0
  284. package/dist/components/motion/morphing-search-chips.js.map +1 -0
  285. package/dist/components/motion/multi-select/content.d.ts +1 -0
  286. package/dist/components/motion/not-found/shared.d.ts +1 -0
  287. package/dist/components/motion/number-ticker.d.ts +6 -1
  288. package/dist/components/motion/number-ticker.d.ts.map +1 -1
  289. package/dist/components/motion/number-ticker.js +19 -9
  290. package/dist/components/motion/number-ticker.js.map +1 -1
  291. package/dist/components/motion/parallax.js.map +1 -1
  292. package/dist/components/motion/popover-morph.d.ts +5 -0
  293. package/dist/components/motion/popover-morph.d.ts.map +1 -1
  294. package/dist/components/motion/popover-morph.js +34 -8
  295. package/dist/components/motion/popover-morph.js.map +1 -1
  296. package/dist/components/motion/popover.d.ts +1 -0
  297. package/dist/components/motion/prediction-market-card.d.ts +37 -0
  298. package/dist/components/motion/prediction-market-card.d.ts.map +1 -0
  299. package/dist/components/motion/prediction-market-card.js +215 -0
  300. package/dist/components/motion/prediction-market-card.js.map +1 -0
  301. package/dist/components/motion/prediction-market.d.ts +49 -0
  302. package/dist/components/motion/prediction-market.d.ts.map +1 -0
  303. package/dist/components/motion/prediction-market.js +440 -0
  304. package/dist/components/motion/prediction-market.js.map +1 -0
  305. package/dist/components/motion/radio.d.ts +3 -1
  306. package/dist/components/motion/radio.d.ts.map +1 -1
  307. package/dist/components/motion/radio.js +17 -5
  308. package/dist/components/motion/radio.js.map +1 -1
  309. package/dist/components/motion/scroll-progress.d.ts +1 -0
  310. package/dist/components/motion/shader-background.d.ts +1 -0
  311. package/dist/components/motion/sortable-list.d.ts +54 -0
  312. package/dist/components/motion/sortable-list.d.ts.map +1 -0
  313. package/dist/components/motion/sortable-list.js +254 -0
  314. package/dist/components/motion/sortable-list.js.map +1 -0
  315. package/dist/components/motion/sortable-stack.d.ts +2 -0
  316. package/dist/components/motion/sortable-stack.js +2 -0
  317. package/dist/components/motion/swap/controls.d.ts +22 -0
  318. package/dist/components/motion/swap/controls.d.ts.map +1 -0
  319. package/dist/components/motion/swap/controls.js +167 -0
  320. package/dist/components/motion/swap/controls.js.map +1 -0
  321. package/dist/components/motion/swap/field.d.ts +14 -0
  322. package/dist/components/motion/swap/field.d.ts.map +1 -0
  323. package/dist/components/motion/swap/field.js +107 -0
  324. package/dist/components/motion/swap/field.js.map +1 -0
  325. package/dist/components/motion/swap/quote-row.d.ts +13 -0
  326. package/dist/components/motion/swap/quote-row.d.ts.map +1 -0
  327. package/dist/components/motion/swap/quote-row.js +55 -0
  328. package/dist/components/motion/swap/quote-row.js.map +1 -0
  329. package/dist/components/motion/swap/token-badges.d.ts +19 -0
  330. package/dist/components/motion/swap/token-badges.d.ts.map +1 -0
  331. package/dist/components/motion/swap/token-badges.js +54 -0
  332. package/dist/components/motion/swap/token-badges.js.map +1 -0
  333. package/dist/components/motion/swap/token-picker.d.ts +14 -0
  334. package/dist/components/motion/swap/token-picker.d.ts.map +1 -0
  335. package/dist/components/motion/swap/token-picker.js +190 -0
  336. package/dist/components/motion/swap/token-picker.js.map +1 -0
  337. package/dist/components/motion/swap.d.ts +14 -0
  338. package/dist/components/motion/swap.d.ts.map +1 -0
  339. package/dist/components/motion/swap.js +378 -0
  340. package/dist/components/motion/swap.js.map +1 -0
  341. package/dist/components/motion/tabs.d.ts +6 -9
  342. package/dist/components/motion/tabs.d.ts.map +1 -1
  343. package/dist/components/motion/tabs.js +13 -4
  344. package/dist/components/motion/tabs.js.map +1 -1
  345. package/dist/components/motion/text-reveal.d.ts +1 -0
  346. package/dist/components/motion/tooltip/positioner.d.ts +8 -26
  347. package/dist/components/motion/tooltip/positioner.d.ts.map +1 -1
  348. package/dist/components/motion/tooltip/positioner.js +1 -2
  349. package/dist/components/motion/tooltip.d.ts +62 -20
  350. package/dist/components/motion/tooltip.d.ts.map +1 -1
  351. package/dist/components/motion/tooltip.js +1 -135
  352. package/dist/components/motion/wallet-card/account-avatar.d.ts +8 -0
  353. package/dist/components/motion/wallet-card/account-avatar.d.ts.map +1 -0
  354. package/dist/components/motion/wallet-card/account-avatar.js +2 -0
  355. package/dist/components/motion/wallet-card/account-switcher.d.ts +14 -0
  356. package/dist/components/motion/wallet-card/account-switcher.d.ts.map +1 -0
  357. package/dist/components/motion/wallet-card/account-switcher.js +153 -0
  358. package/dist/components/motion/wallet-card/account-switcher.js.map +1 -0
  359. package/dist/components/motion/wallet-card/actions.d.ts +12 -0
  360. package/dist/components/motion/wallet-card/actions.d.ts.map +1 -0
  361. package/dist/components/motion/wallet-card/actions.js +58 -0
  362. package/dist/components/motion/wallet-card/actions.js.map +1 -0
  363. package/dist/components/motion/wallet-card/balance-delta.d.ts +12 -0
  364. package/dist/components/motion/wallet-card/balance-delta.d.ts.map +1 -0
  365. package/dist/components/motion/wallet-card/balance-delta.js +72 -0
  366. package/dist/components/motion/wallet-card/balance-delta.js.map +1 -0
  367. package/dist/components/motion/wallet-card/copy-button.d.ts +12 -0
  368. package/dist/components/motion/wallet-card/copy-button.d.ts.map +1 -0
  369. package/dist/components/motion/wallet-card/copy-button.js +41 -0
  370. package/dist/components/motion/wallet-card/copy-button.js.map +1 -0
  371. package/dist/components/motion/wallet-card/index.d.ts +13 -0
  372. package/dist/components/motion/wallet-card/index.d.ts.map +1 -0
  373. package/dist/components/motion/wallet-card/index.js +115 -0
  374. package/dist/components/motion/wallet-card/index.js.map +1 -0
  375. package/dist/components/motion/wallet-card/search-bar.d.ts +17 -0
  376. package/dist/components/motion/wallet-card/search-bar.d.ts.map +1 -0
  377. package/dist/components/motion/wallet-card/search-bar.js +156 -0
  378. package/dist/components/motion/wallet-card/search-bar.js.map +1 -0
  379. package/dist/components/reui/alert.d.ts +1 -1
  380. package/dist/components/reui/autocomplete.d.ts +1 -1
  381. package/dist/components/reui/autocomplete.d.ts.map +1 -1
  382. package/dist/components/reui/autocomplete.js.map +1 -1
  383. package/dist/components/reui/badge.d.ts +2 -2
  384. package/dist/components/reui/cascader/cascader-async.d.ts +3 -2
  385. package/dist/components/reui/cascader/cascader-async.d.ts.map +1 -1
  386. package/dist/components/reui/cascader/cascader-async.js.map +1 -1
  387. package/dist/components/reui/cascader/cascader-columns.js +3 -3
  388. package/dist/components/reui/cascader/cascader-columns.js.map +1 -1
  389. package/dist/components/reui/cascader/cascader-context.d.ts +12 -4
  390. package/dist/components/reui/cascader/cascader-context.d.ts.map +1 -1
  391. package/dist/components/reui/cascader/cascader-context.js.map +1 -1
  392. package/dist/components/reui/cascader/cascader-i18n.d.ts +1 -1
  393. package/dist/components/reui/cascader/cascader-item.d.ts +2 -2
  394. package/dist/components/reui/cascader/cascader-item.d.ts.map +1 -1
  395. package/dist/components/reui/cascader/cascader-item.js +22 -16
  396. package/dist/components/reui/cascader/cascader-item.js.map +1 -1
  397. package/dist/components/reui/cascader/cascader-lib.d.ts +8 -1
  398. package/dist/components/reui/cascader/cascader-lib.d.ts.map +1 -1
  399. package/dist/components/reui/cascader/cascader-lib.js +19 -11
  400. package/dist/components/reui/cascader/cascader-lib.js.map +1 -1
  401. package/dist/components/reui/cascader/cascader-nav.d.ts +1 -1
  402. package/dist/components/reui/cascader/cascader-nav.d.ts.map +1 -1
  403. package/dist/components/reui/cascader/cascader-nav.js +5 -4
  404. package/dist/components/reui/cascader/cascader-nav.js.map +1 -1
  405. package/dist/components/reui/cascader/cascader-types.d.ts +1 -1
  406. package/dist/components/reui/cascader/cascader-virtual.d.ts.map +1 -1
  407. package/dist/components/reui/cascader/cascader-virtual.js.map +1 -1
  408. package/dist/components/reui/cascader/cascader.d.ts +6 -2
  409. package/dist/components/reui/cascader/cascader.d.ts.map +1 -1
  410. package/dist/components/reui/cascader/cascader.js +58 -20
  411. package/dist/components/reui/cascader/cascader.js.map +1 -1
  412. package/dist/components/reui/color-picker.d.ts +280 -0
  413. package/dist/components/reui/color-picker.d.ts.map +1 -0
  414. package/dist/components/reui/color-picker.js +2013 -0
  415. package/dist/components/reui/color-picker.js.map +1 -0
  416. package/dist/components/reui/data-grid/data-grid-cell-selection.d.ts.map +1 -1
  417. package/dist/components/reui/data-grid/data-grid-column-filter.js +2 -2
  418. package/dist/components/reui/data-grid/data-grid-column-filter.js.map +1 -1
  419. package/dist/components/reui/data-grid/data-grid-column-header.d.ts.map +1 -1
  420. package/dist/components/reui/data-grid/data-grid-column-header.js +59 -33
  421. package/dist/components/reui/data-grid/data-grid-column-header.js.map +1 -1
  422. package/dist/components/reui/data-grid/data-grid-column-visibility.js +1 -1
  423. package/dist/components/reui/data-grid/data-grid-column-visibility.js.map +1 -1
  424. package/dist/components/reui/data-grid/data-grid-pagination.js +2 -2
  425. package/dist/components/reui/data-grid/data-grid-pagination.js.map +1 -1
  426. package/dist/components/reui/data-grid/data-grid-scroll-area.d.ts.map +1 -1
  427. package/dist/components/reui/data-grid/data-grid-scroll-area.js +94 -64
  428. package/dist/components/reui/data-grid/data-grid-scroll-area.js.map +1 -1
  429. package/dist/components/reui/data-grid/data-grid-table-dnd-rows.d.ts +7 -2
  430. package/dist/components/reui/data-grid/data-grid-table-dnd-rows.d.ts.map +1 -1
  431. package/dist/components/reui/data-grid/data-grid-table-dnd-rows.js +74 -41
  432. package/dist/components/reui/data-grid/data-grid-table-dnd-rows.js.map +1 -1
  433. package/dist/components/reui/data-grid/data-grid-table-dnd.d.ts +7 -2
  434. package/dist/components/reui/data-grid/data-grid-table-dnd.d.ts.map +1 -1
  435. package/dist/components/reui/data-grid/data-grid-table-dnd.js +135 -32
  436. package/dist/components/reui/data-grid/data-grid-table-dnd.js.map +1 -1
  437. package/dist/components/reui/data-grid/data-grid-table-virtual.d.ts.map +1 -1
  438. package/dist/components/reui/data-grid/data-grid-table-virtual.js +36 -42
  439. package/dist/components/reui/data-grid/data-grid-table-virtual.js.map +1 -1
  440. package/dist/components/reui/data-grid/data-grid-table.d.ts +168 -5
  441. package/dist/components/reui/data-grid/data-grid-table.d.ts.map +1 -1
  442. package/dist/components/reui/data-grid/data-grid-table.js +354 -101
  443. package/dist/components/reui/data-grid/data-grid-table.js.map +1 -1
  444. package/dist/components/reui/data-grid/data-grid.d.ts +55 -0
  445. package/dist/components/reui/data-grid/data-grid.d.ts.map +1 -1
  446. package/dist/components/reui/data-grid/data-grid.js +114 -52
  447. package/dist/components/reui/data-grid/data-grid.js.map +1 -1
  448. package/dist/components/reui/date-selector.d.ts +1 -0
  449. package/dist/components/reui/date-selector.js +1 -1
  450. package/dist/components/reui/emoji-picker.d.ts +367 -0
  451. package/dist/components/reui/emoji-picker.d.ts.map +1 -0
  452. package/dist/components/reui/emoji-picker.js +1768 -0
  453. package/dist/components/reui/emoji-picker.js.map +1 -0
  454. package/dist/components/reui/event-calendar/event-calendar-i18n.d.ts.map +1 -1
  455. package/dist/components/reui/event-calendar/event-calendar-nav.js +1 -1
  456. package/dist/components/reui/file-type.d.ts +496 -0
  457. package/dist/components/reui/file-type.d.ts.map +1 -0
  458. package/dist/components/reui/file-type.js +964 -0
  459. package/dist/components/reui/file-type.js.map +1 -0
  460. package/dist/components/reui/filters/filters-advanced.d.ts +1 -0
  461. package/dist/components/reui/filters/filters-advanced.js +1 -1
  462. package/dist/components/reui/filters/filters-advanced.js.map +1 -1
  463. package/dist/components/reui/filters/filters-builder.d.ts +1 -1
  464. package/dist/components/reui/filters/filters-chip.d.ts +5 -1
  465. package/dist/components/reui/filters/filters-chip.d.ts.map +1 -1
  466. package/dist/components/reui/filters/filters-chip.js +1 -1
  467. package/dist/components/reui/filters/filters-lib.d.ts +1 -1
  468. package/dist/components/reui/filters/filters-lib.d.ts.map +1 -1
  469. package/dist/components/reui/frame.d.ts +2 -2
  470. package/dist/components/reui/frame.d.ts.map +1 -1
  471. package/dist/components/reui/frame.js.map +1 -1
  472. package/dist/components/reui/gantt/gantt-nav.js +1 -1
  473. package/dist/components/reui/icon-tile.d.ts +1 -1
  474. package/dist/components/reui/icon-tile.js +8 -7
  475. package/dist/components/reui/icon-tile.js.map +1 -1
  476. package/dist/components/reui/kanban.d.ts.map +1 -1
  477. package/dist/components/reui/kanban.js +1 -1
  478. package/dist/components/reui/kanban.js.map +1 -1
  479. package/dist/components/reui/number-field.d.ts +3 -3
  480. package/dist/components/reui/number-field.d.ts.map +1 -1
  481. package/dist/components/reui/number-field.js.map +1 -1
  482. package/dist/components/reui/rating.d.ts +1 -1
  483. package/dist/components/reui/scrollspy.d.ts +1 -0
  484. package/dist/components/reui/signature-pad.d.ts +160 -0
  485. package/dist/components/reui/signature-pad.d.ts.map +1 -0
  486. package/dist/components/reui/signature-pad.js +764 -0
  487. package/dist/components/reui/signature-pad.js.map +1 -0
  488. package/dist/components/reui/time-picker.d.ts +202 -0
  489. package/dist/components/reui/time-picker.d.ts.map +1 -0
  490. package/dist/components/reui/time-picker.js +1002 -0
  491. package/dist/components/reui/time-picker.js.map +1 -0
  492. package/dist/components/ui/attachment.d.ts +2 -2
  493. package/dist/components/ui/badge.d.ts +1 -1
  494. package/dist/components/ui/bubble.d.ts +1 -1
  495. package/dist/components/ui/button.d.ts +2 -2
  496. package/dist/components/ui/command.d.ts.map +1 -1
  497. package/dist/components/ui/direction.js +1 -2
  498. package/dist/components/ui/empty.d.ts +1 -1
  499. package/dist/components/ui/field.js +1 -1
  500. package/dist/components/ui/input-group.d.ts +1 -1
  501. package/dist/components/ui/item.d.ts +3 -3
  502. package/dist/components/ui/message-scroller.d.ts.map +1 -1
  503. package/dist/components/ui/questionnaire.d.ts.map +1 -1
  504. package/dist/components/ui/sidebar.d.ts +2 -2
  505. package/dist/components/ui/sidebar.js +1 -1
  506. package/dist/components/ui/tabs.d.ts +1 -1
  507. package/dist/components/ui/toggle.d.ts +2 -2
  508. package/dist/constants-CsKm9sSk.js +30 -0
  509. package/dist/constants-CsKm9sSk.js.map +1 -0
  510. package/dist/context-3_vY1jbv.js +141 -0
  511. package/dist/context-3_vY1jbv.js.map +1 -0
  512. package/dist/context-BE60udRT.js +99 -0
  513. package/dist/context-BE60udRT.js.map +1 -0
  514. package/dist/context-BYXeJQnz.d.ts +150 -0
  515. package/dist/context-BYXeJQnz.d.ts.map +1 -0
  516. package/dist/context-Bc6VC1HA.js +181 -0
  517. package/dist/context-Bc6VC1HA.js.map +1 -0
  518. package/dist/context-BqjZ1Z_w.js +111 -0
  519. package/dist/context-BqjZ1Z_w.js.map +1 -0
  520. package/dist/context-CZfRKkcZ.js +204 -0
  521. package/dist/context-CZfRKkcZ.js.map +1 -0
  522. package/dist/context-Cn-00gfW.js +169 -0
  523. package/dist/context-Cn-00gfW.js.map +1 -0
  524. package/dist/context-Cnlo53sV.d.ts +92 -0
  525. package/dist/context-Cnlo53sV.d.ts.map +1 -0
  526. package/dist/context-Rl5VCYA8.js +257 -0
  527. package/dist/context-Rl5VCYA8.js.map +1 -0
  528. package/dist/context-sD8DQga-.js +122 -0
  529. package/dist/context-sD8DQga-.js.map +1 -0
  530. package/dist/context-tTdLKYNf.js +99 -0
  531. package/dist/context-tTdLKYNf.js.map +1 -0
  532. package/dist/{copy-menu-C5GaT4Z-.js → copy-menu-BXUh52bu.js} +2 -2
  533. package/dist/{copy-menu-C5GaT4Z-.js.map → copy-menu-BXUh52bu.js.map} +1 -1
  534. package/dist/ease-B82HVmio.d.ts +50 -0
  535. package/dist/ease-B82HVmio.d.ts.map +1 -0
  536. package/dist/hooks/use-copy-to-clipboard.d.ts +1 -0
  537. package/dist/hooks/use-hover-gesture.d.ts +1 -0
  538. package/dist/hooks/use-intersection-observer.d.ts +1 -0
  539. package/dist/hooks/use-modal-scope.d.ts +6 -0
  540. package/dist/hooks/use-modal-scope.d.ts.map +1 -0
  541. package/dist/hooks/use-modal-scope.js +83 -0
  542. package/dist/hooks/use-modal-scope.js.map +1 -0
  543. package/dist/hooks/use-scroll-position.d.ts +1 -0
  544. package/dist/hooks/use-slider-input.d.ts +1 -0
  545. package/dist/hooks/use-viewport.d.ts +1 -0
  546. package/dist/lib/ease.d.ts +2 -49
  547. package/dist/lib/tick-sound.d.ts +1 -0
  548. package/dist/model-DlbIqCZg.d.ts +41 -0
  549. package/dist/model-DlbIqCZg.d.ts.map +1 -0
  550. package/dist/model-NSIg2p7a.d.ts +20 -0
  551. package/dist/model-NSIg2p7a.d.ts.map +1 -0
  552. package/dist/model-_mRyI6V9.d.ts +18 -0
  553. package/dist/model-_mRyI6V9.d.ts.map +1 -0
  554. package/dist/plot-CdFTbMI_.js +131 -0
  555. package/dist/plot-CdFTbMI_.js.map +1 -0
  556. package/dist/{positioner-3mCqiebN.js → positioner-3r3cfkqT.js} +97 -33
  557. package/dist/positioner-3r3cfkqT.js.map +1 -0
  558. package/dist/tooltip-Bam5KeYe.js +535 -0
  559. package/dist/tooltip-Bam5KeYe.js.map +1 -0
  560. package/dist/tooltip-BarafYiU.d.ts +67 -0
  561. package/dist/tooltip-BarafYiU.d.ts.map +1 -0
  562. package/dist/tooltip-BqxVD6D-.d.ts +64 -0
  563. package/dist/tooltip-BqxVD6D-.d.ts.map +1 -0
  564. package/dist/tooltip-C01qUgsW.d.ts +133 -0
  565. package/dist/tooltip-C01qUgsW.d.ts.map +1 -0
  566. package/dist/tooltip-C6qUs7px.d.ts +36 -0
  567. package/dist/tooltip-C6qUs7px.d.ts.map +1 -0
  568. package/dist/tooltip-DQ4DXgeu.d.ts +94 -0
  569. package/dist/tooltip-DQ4DXgeu.d.ts.map +1 -0
  570. package/dist/types-B_6p3LXz.d.ts +36 -0
  571. package/dist/types-B_6p3LXz.d.ts.map +1 -0
  572. package/dist/types-D6e3gWOA.d.ts +22 -0
  573. package/dist/types-D6e3gWOA.d.ts.map +1 -0
  574. package/dist/use-geometry-CH0foIo7.d.ts +9 -0
  575. package/dist/use-geometry-CH0foIo7.d.ts.map +1 -0
  576. package/dist/use-position-DOi1gVL0.d.ts +32 -0
  577. package/dist/use-position-DOi1gVL0.d.ts.map +1 -0
  578. package/dist/utils-B3YXTsDI.js +26 -0
  579. package/dist/utils-B3YXTsDI.js.map +1 -0
  580. package/package.json +12 -12
  581. package/dist/cascader-types-BnH6wYD-.d.ts.map +0 -1
  582. package/dist/components/motion/tooltip.js.map +0 -1
  583. package/dist/lib/ease.d.ts.map +0 -1
  584. package/dist/positioner-3mCqiebN.js.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"morphing-search-chips.js","names":[],"sources":["../../../src/components/motion/morphing-search-chips.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n type KeyboardEvent as ReactKeyboardEvent,\n type ReactNode,\n type PointerEvent as ReactPointerEvent,\n useCallback,\n useEffect,\n useId,\n useLayoutEffect,\n useMemo,\n useRef,\n useState,\n} from \"react\";\nimport { Clock, LoaderCircle, Search, X } from \"lucide-react\";\nimport { AnimatePresence, motion, type Transition, useReducedMotion } from \"motion/react\";\n\nimport { cn } from \"@kumix/utils\";\nimport { useDismiss } from \"../../hooks/use-dismiss\";\nimport { useOnOpen } from \"../../hooks/use-on-open\";\nimport { useRowCursor } from \"../../hooks/use-row-cursor\";\nimport { EASE_OUT, SPRING_LAYOUT, SPRING_SWAP } from \"../../lib/ease\";\nimport { PresenceGate } from \"../../lib/presence-gate\";\n\n// The panel's glass grows out of the bar on a spring with a little give: the\n// shared tokens are critically damped, and this one is meant to land with a\n// soft overshoot, so it stays local. It folds back faster than it grew.\nconst SPRING_MORPH = { type: \"spring\", stiffness: 380, damping: 28, mass: 0.8 } as const;\nconst MORPH_ENTER: Transition = { ...SPRING_MORPH, opacity: { duration: 0.1 } };\nconst MORPH_EXIT: Transition = {\n type: \"spring\",\n stiffness: 520,\n damping: 40,\n mass: 0.6,\n opacity: { duration: 0.12, delay: 0.1 },\n};\n// The pill the panel starts from and returns to: centred, and tucked halfway\n// behind the bar (across the 8px gap) so it emerges from the bar's edge.\nconst SEED = { width: 112, height: 40 };\nconst SEED_TUCK = 28;\n// Content fades in once the shape has mostly arrived and leaves before it goes.\nconst CONTENT_IN: Transition = { duration: 0.18, ease: EASE_OUT, delay: 0.12 };\nconst CONTENT_OUT: Transition = { duration: 0.08, ease: EASE_OUT };\n// Glass: a thin tint of the page colour over a saturated blur, a hairline edge,\n// a top highlight and a soft drop. Written inline so the install carries it\n// without the site's stylesheet.\nconst GLASS =\n \"border border-foreground/[0.08] bg-background/55 backdrop-blur-[20px] backdrop-saturate-[1.6] shadow-[inset_0_1px_0_0_rgb(255_255_255/0.06),0_24px_60px_-24px_rgb(0_0_0/0.45)]\";\n// Chips arrive on a soft spring with a touch of blur and leave on a short tween,\n// faster than they came.\nconst CHIP_HIDDEN = { opacity: 0, scale: 0.6, filter: \"blur(4px)\" };\nconst CHIP_SHOWN = { opacity: 1, scale: 1, filter: \"blur(0px)\" };\nconst CHIP_ENTER: Transition = {\n ...SPRING_SWAP,\n opacity: { duration: 0.16 },\n filter: { duration: 0.2 },\n};\nconst CHIP_EXIT: Transition = { duration: 0.16, ease: EASE_OUT };\n// Half the 56px bar: a pill, and the panel shares its corners.\nconst SURFACE_RADIUS = 28;\n// Room the panel wants above the bar before \"auto\" sends it below instead.\nconst PANEL_ROOM = 320;\n\ntype Row = { id: string; label: string; kind: \"query\" | \"recent\" | \"suggestion\" };\ntype Side = \"top\" | \"bottom\";\n\nexport interface MorphingSearchChipsProps {\n /** Active filters shown as chips inside the bar. */\n chips?: string[];\n defaultChips?: string[];\n onChipsChange?: (chips: string[]) => void;\n /** Text in the field. */\n query?: string;\n defaultQuery?: string;\n onQueryChange?: (query: string) => void;\n /** Recent searches, newest first. */\n recents?: string[];\n defaultRecents?: string[];\n onRecentsChange?: (recents: string[]) => void;\n /** Persist uncontrolled recents in localStorage under this key. */\n storageKey?: string;\n /** How many recent searches to keep. Default 5. */\n maxRecents?: number;\n /** Terms offered while typing. */\n suggestions?: string[];\n /**\n * How suggestions match the query. Default: case-insensitive substring.\n * Pass `false` when `suggestions` already arrive filtered, e.g. from a server.\n */\n filter?: ((term: string, query: string) => boolean) | false;\n /** How many matches to list under the typed query. Default 6. */\n maxSuggestions?: number;\n /** Suggestions are being fetched. */\n loading?: boolean;\n /** Most chips allowed at once. */\n maxChips?: number;\n /** Clean a term before it becomes a chip; return null to reject it. */\n normalize?: (term: string) => string | null;\n /** Shown when the field is empty and there are no recent searches. */\n emptyState?: ReactNode;\n /** Which way the surface grows. \"auto\" grows up unless there is no room. Default \"top\". */\n side?: \"top\" | \"bottom\" | \"auto\";\n open?: boolean;\n defaultOpen?: boolean;\n onOpenChange?: (open: boolean) => void;\n disabled?: boolean;\n /** Submit each chip with a form under this name. */\n name?: string;\n placeholder?: string;\n /** Accessible name for the search field. */\n label?: string;\n /** Trailing controls inside the bar, such as filter buttons. */\n actions?: ReactNode;\n className?: string;\n}\n\nfunction useControllable<T>(value: T | undefined, initial: T, onChange?: (next: T) => void) {\n const [internal, setInternal] = useState(initial);\n const current = value ?? internal;\n const set = useCallback(\n (next: T) => {\n if (value === undefined) setInternal(next);\n onChange?.(next);\n },\n [value, onChange],\n );\n return [current, set, setInternal] as const;\n}\n\nconst sameTerm = (a: string, b: string) => a.trim().toLowerCase() === b.trim().toLowerCase();\nconst contains = (term: string, query: string) => term.toLowerCase().includes(query.toLowerCase());\n\nfunction Highlight({ text, query }: { text: string; query: string }) {\n const at = query ? text.toLowerCase().indexOf(query.toLowerCase()) : -1;\n if (at < 0) return text;\n return (\n <>\n {text.slice(0, at)}\n <span className=\"font-semibold\">{text.slice(at, at + query.length)}</span>\n {text.slice(at + query.length)}\n </>\n );\n}\n\nexport function MorphingSearchChips({\n chips: chipsProp,\n defaultChips = [],\n onChipsChange,\n query: queryProp,\n defaultQuery = \"\",\n onQueryChange,\n recents: recentsProp,\n defaultRecents = [],\n onRecentsChange,\n storageKey,\n maxRecents = 5,\n suggestions = [],\n filter,\n maxSuggestions = 6,\n loading = false,\n maxChips,\n normalize,\n emptyState,\n side = \"top\",\n open: openProp,\n defaultOpen = false,\n onOpenChange,\n disabled = false,\n name,\n placeholder = \"Search\",\n label = \"Search\",\n actions,\n className,\n}: MorphingSearchChipsProps) {\n const reduce = useReducedMotion();\n const [chips, setChips] = useControllable(chipsProp, defaultChips, onChipsChange);\n const [query, setQuery] = useControllable(queryProp, defaultQuery, onQueryChange);\n const [recents, setRecentsState, setStoredRecents] = useControllable(\n recentsProp,\n defaultRecents,\n onRecentsChange,\n );\n const [openState, setOpen] = useControllable(openProp, defaultOpen, onOpenChange);\n const open = openState && !disabled;\n const [announcement, setAnnouncement] = useState({ text: \"\", count: 0 });\n const [markedChip, setMarkedChip] = useState<string | null>(null);\n const [placed, setPlaced] = useState<Side>(side === \"bottom\" ? \"bottom\" : \"top\");\n const [rtl, setRtl] = useState(false);\n const rootRef = useRef<HTMLDivElement>(null);\n const inputRef = useRef<HTMLInputElement>(null);\n const chipsRef = useRef<HTMLDivElement>(null);\n const id = useId();\n const listId = `${id}-list`;\n const hintId = `${id}-hint`;\n const optionId = (index: number) => `${id}-option-${index}`;\n\n // The same message twice is still news; the count makes each one a change.\n const announce = useCallback(\n (text: string) => setAnnouncement((current) => ({ text, count: current.count + 1 })),\n [],\n );\n\n // A chip the keyboard has marked for removal, held by identity. Cleared rather\n // than ignored once it leaves, so the same term added back is not born marked.\n const marked = markedChip !== null && chips.includes(markedChip) ? markedChip : null;\n if (markedChip !== null && marked === null) setMarkedChip(null);\n\n // The glass grows toward the measured size of the panel's content.\n const [panelSize, setPanelSize] = useState({ width: 0, height: 0 });\n const panelObserver = useRef<ResizeObserver | null>(null);\n const measurePanel = useCallback((node: HTMLDivElement | null) => {\n panelObserver.current?.disconnect();\n panelObserver.current = null;\n if (!node) return;\n const read = () => setPanelSize({ width: node.offsetWidth, height: node.offsetHeight });\n read();\n panelObserver.current = new ResizeObserver(read);\n panelObserver.current.observe(node);\n }, []);\n\n const chipsLatest = useRef(chips);\n useLayoutEffect(() => {\n chipsLatest.current = chips;\n });\n\n // Direction decides which way chips unroll and which arrow walks back into them.\n useLayoutEffect(() => {\n if (rootRef.current) setRtl(getComputedStyle(rootRef.current).direction === \"rtl\");\n }, []);\n\n // Recents persist only when the component owns them.\n const persist = storageKey && recentsProp === undefined ? storageKey : null;\n useEffect(() => {\n if (!persist) return;\n try {\n const stored = JSON.parse(window.localStorage.getItem(persist) ?? \"null\");\n if (Array.isArray(stored)) {\n setStoredRecents(\n stored.filter((term): term is string => typeof term === \"string\").slice(0, maxRecents),\n );\n }\n } catch {\n // Storage can be blocked or hold something else; recents simply start empty.\n }\n }, [persist, maxRecents, setStoredRecents]);\n\n const setRecents = (next: string[]) => {\n setRecentsState(next);\n if (!persist) return;\n try {\n window.localStorage.setItem(persist, JSON.stringify(next));\n } catch {\n // A full or blocked store keeps this session's recents in memory only.\n }\n };\n\n const trimmed = query.trim();\n const rows = useMemo<Row[]>(() => {\n if (!trimmed) {\n return recents.map((term) => ({ id: `recent:${term}`, label: term, kind: \"recent\" }));\n }\n const seen = new Set([trimmed.toLowerCase(), ...chips.map((chip) => chip.toLowerCase())]);\n const matches: Row[] = [];\n const pools = [\n [\"recent\", recents, contains],\n [\"suggestion\", suggestions, filter === false ? () => true : (filter ?? contains)],\n ] as const;\n for (const [kind, pool, matchFn] of pools) {\n for (const term of pool) {\n const key = term.toLowerCase();\n if (seen.has(key) || !matchFn(term, trimmed)) continue;\n seen.add(key);\n matches.push({ id: `${kind}:${term}`, label: term, kind });\n }\n }\n return [\n { id: `query:${trimmed}`, label: trimmed, kind: \"query\" },\n ...matches.slice(0, maxSuggestions),\n ];\n }, [trimmed, recents, suggestions, chips, filter, maxSuggestions]);\n\n const { activeIndex, moveTo, moveActive } = useRowCursor(rows, trimmed);\n const active = rows[activeIndex];\n const showList = rows.length > 0;\n // Nothing to say means nothing to grow for: the bar still widens on focus.\n const hasPanel = showList || loading || (!trimmed && emptyState != null);\n const panelOpen = open && hasPanel;\n\n // A fresh session each time the panel opens: the highlight starts at the top.\n useOnOpen(open, () => moveTo(null));\n\n // The tallest the panel has been since it opened. Typing can grow the card but\n // never shrink it; each new session starts from its own content again.\n const [panelFloor, setPanelFloor] = useState(0);\n useOnOpen(panelOpen, () => setPanelFloor(0));\n const rowsObserver = useRef<ResizeObserver | null>(null);\n const measureRows = useCallback((node: HTMLDivElement | null) => {\n rowsObserver.current?.disconnect();\n rowsObserver.current = null;\n if (!node) return;\n // The wrapper's p-2 adds 16px around the rows.\n const read = () => setPanelFloor((floor) => Math.max(floor, node.offsetHeight + 16));\n read();\n rowsObserver.current = new ResizeObserver(read);\n rowsObserver.current.observe(node);\n }, []);\n\n // \"auto\" picks a side as the panel opens and keeps it until it closes.\n useLayoutEffect(() => {\n if (!panelOpen) return;\n if (side !== \"auto\") {\n setPlaced(side);\n return;\n }\n const rect = rootRef.current?.getBoundingClientRect();\n if (!rect) return;\n const above = rect.top;\n const below = window.innerHeight - rect.bottom;\n setPlaced(above < PANEL_ROOM && below > above ? \"bottom\" : \"top\");\n }, [panelOpen, side]);\n\n // Arrow keys can walk past the visible rows of a capped list.\n const activeOptionId = panelOpen && showList ? optionId(activeIndex) : undefined;\n useEffect(() => {\n if (activeOptionId)\n document.getElementById(activeOptionId)?.scrollIntoView({ block: \"nearest\" });\n }, [activeOptionId]);\n\n const close = useCallback(() => setOpen(false), [setOpen]);\n useDismiss(open, close, rootRef);\n\n // A chip added past the visible edge of a crowded row scrolls into view.\n const chipCount = useRef(chips.length);\n useEffect(() => {\n const row = chipsRef.current;\n const added = chips.length > chipCount.current;\n chipCount.current = chips.length;\n if (!row || !added || row.scrollWidth <= row.clientWidth) return;\n row.scrollTo({\n left: rtl ? -row.scrollWidth : row.scrollWidth,\n behavior: reduce ? \"auto\" : \"smooth\",\n });\n }, [chips.length, reduce, rtl]);\n\n const full = maxChips !== undefined && chips.length >= maxChips;\n\n const addChip = (term: string) => {\n const value = normalize ? normalize(term) : term.trim();\n if (!value) return;\n const exists = chips.some((chip) => sameTerm(chip, value));\n if (!exists && full) {\n announce(`Up to ${maxChips} filters`);\n return;\n }\n if (!exists) {\n setChips([...chips, value]);\n announce(`Added filter ${value}`);\n }\n setRecents(\n [value, ...recents.filter((recent) => !sameTerm(recent, value))].slice(0, maxRecents),\n );\n setQuery(\"\");\n };\n\n const removeChip = (term: string) => {\n setChips(chips.filter((chip) => chip !== term));\n announce(`Removed filter ${term}`);\n inputRef.current?.focus();\n };\n\n const removeRecent = (term: string) => {\n setRecents(recents.filter((recent) => recent !== term));\n announce(`Removed ${term} from recent searches`);\n };\n\n // Steps the marked chip from the one it is on now, inside the update, so two\n // presses in one batch move two chips.\n const stepMark = (direction: 1 | -1) =>\n setMarkedChip((current) => {\n const list = chipsLatest.current;\n if (list.length === 0) return null;\n const at = current === null ? list.length : list.indexOf(current);\n const next = at + direction;\n if (next >= list.length) return null;\n return list[Math.max(next, 0)];\n });\n\n const onKeyDown = (event: ReactKeyboardEvent<HTMLInputElement>) => {\n // An input method is still composing; Enter and arrows belong to it.\n if (event.nativeEvent.isComposing || event.keyCode === 229) return;\n const field = event.currentTarget;\n const atStart = field.selectionStart === 0 && field.selectionEnd === 0;\n const back = rtl ? \"ArrowRight\" : \"ArrowLeft\";\n const forward = rtl ? \"ArrowLeft\" : \"ArrowRight\";\n\n if (marked !== null) {\n if (event.key === \"Backspace\" || event.key === \"Delete\") {\n event.preventDefault();\n setMarkedChip(null);\n removeChip(marked);\n return;\n }\n if (event.key === back || event.key === forward) {\n event.preventDefault();\n stepMark(event.key === back ? -1 : 1);\n return;\n }\n if (event.key === \"Escape\") {\n event.preventDefault();\n event.stopPropagation();\n setMarkedChip(null);\n return;\n }\n setMarkedChip(null);\n }\n\n if (event.key === \"Escape\" && query !== \"\") {\n // Clear before closing: one press undoes typing, the next leaves.\n event.preventDefault();\n event.stopPropagation();\n setQuery(\"\");\n return;\n }\n if (event.key === \"ArrowDown\" || event.key === \"ArrowUp\") {\n event.preventDefault();\n if (!open) setOpen(true);\n else moveActive(event.key === \"ArrowDown\" ? 1 : -1);\n return;\n }\n if (event.key === \"Enter\") {\n if (!panelOpen || !active) return;\n event.preventDefault();\n addChip(active.label);\n return;\n }\n if (event.key === \"Delete\" && panelOpen && active?.kind === \"recent\") {\n event.preventDefault();\n removeRecent(active.label);\n return;\n }\n if (event.key === \"Backspace\" && atStart && chips.length > 0) {\n // Mark first, remove on the second press: one stray key never loses a filter.\n event.preventDefault();\n const last = chips[chips.length - 1];\n setMarkedChip(last);\n announce(`${last} selected. Press Backspace again to remove it.`);\n return;\n }\n if (event.key === back && atStart && chips.length > 0) {\n event.preventDefault();\n stepMark(-1);\n }\n };\n\n // A press anywhere on the bar that is not its own control lands in the field.\n const focusField = (event: ReactPointerEvent) => {\n if (disabled || (event.target as Element).closest(\"button, input, a\")) return;\n event.preventDefault();\n inputRef.current?.focus();\n setOpen(true);\n };\n\n const layout = reduce ? { duration: 0 } : SPRING_LAYOUT;\n const below = placed === \"bottom\";\n const seed = { ...SEED, y: below ? -SEED_TUCK : SEED_TUCK };\n\n const panel = (\n <>\n <div className=\"flex h-9 items-center justify-between px-3\">\n <span className=\"font-medium text-muted-foreground text-xs\">\n {trimmed ? \"Suggestions\" : \"Recent\"}\n </span>\n {!trimmed && recents.length > 0 ? (\n <button\n type=\"button\"\n onClick={() => {\n setRecents([]);\n announce(\"Cleared recent searches\");\n inputRef.current?.focus();\n }}\n className=\"rounded-md px-1.5 py-0.5 text-muted-foreground text-xs outline-none transition-colors hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring\"\n >\n Clear\n </button>\n ) : null}\n </div>\n {showList ? (\n <div\n id={listId}\n role=\"listbox\"\n aria-label={trimmed ? \"Suggestions\" : \"Recent searches\"}\n aria-busy={loading || undefined}\n className=\"max-h-[min(20rem,45vh)] overflow-y-auto overscroll-contain [scrollbar-width:thin]\"\n >\n {rows.map((row, index) => {\n const selected = index === activeIndex;\n return (\n // Options are driven from the combobox field (arrows, Enter) and\n // never take focus themselves, as aria-activedescendant expects.\n <motion.div\n key={row.id}\n id={optionId(index)}\n role=\"option\"\n aria-selected={selected}\n onPointerDown={(event) => event.preventDefault()}\n onPointerMove={() => moveTo(row.id)}\n onClick={() => addChip(row.label)}\n className=\"relative flex h-11 cursor-pointer items-center gap-3 rounded-2xl px-3 text-foreground text-sm\"\n >\n {selected ? (\n <motion.span\n layoutId={`${id}-active`}\n transition={layout}\n className=\"absolute inset-0 rounded-2xl bg-foreground/6\"\n />\n ) : null}\n {row.kind === \"recent\" ? (\n <Clock\n aria-hidden=\"true\"\n className=\"relative size-4 shrink-0 text-muted-foreground\"\n />\n ) : (\n <Search\n aria-hidden=\"true\"\n className=\"relative size-4 shrink-0 text-muted-foreground\"\n />\n )}\n <span className=\"relative min-w-0 flex-1 truncate\">\n {row.kind === \"query\" ? (\n row.label\n ) : (\n <Highlight text={row.label} query={trimmed} />\n )}\n </span>\n {row.kind === \"recent\" ? (\n // Pointer shortcut only: the option cannot hold a second control,\n // and Delete removes the highlighted recent from the keyboard.\n <span\n aria-hidden=\"true\"\n onClick={(event) => {\n event.stopPropagation();\n removeRecent(row.label);\n }}\n className=\"relative grid size-7 shrink-0 place-items-center rounded-full text-muted-foreground transition-colors hover:bg-foreground/10 hover:text-foreground\"\n >\n <X className=\"size-3.5\" />\n </span>\n ) : null}\n </motion.div>\n );\n })}\n </div>\n ) : !trimmed && emptyState != null ? (\n <div className=\"px-3 pt-1 pb-2 text-muted-foreground text-sm\">{emptyState}</div>\n ) : null}\n {loading ? (\n <div className=\"flex h-11 items-center gap-3 px-3 text-muted-foreground text-sm\">\n <LoaderCircle aria-hidden=\"true\" className=\"size-4 motion-safe:animate-spin\" />\n Searching…\n </div>\n ) : null}\n </>\n );\n\n return (\n // The root keeps the bar's footprint; the panel floats over the page beside it.\n <div\n ref={rootRef}\n className={cn(\n \"relative flex h-14 w-full max-w-xl justify-center\",\n disabled && \"opacity-60\",\n className,\n )}\n onBlur={(event) => {\n if (rootRef.current?.contains(event.relatedTarget as Node | null)) return;\n setMarkedChip(null);\n close();\n }}\n >\n <AnimatePresence>\n {panelOpen ? (\n <PresenceGate key=\"panel\">\n {({ gate }) => (\n <div\n {...gate}\n className={cn(\n \"absolute inset-x-0 z-10\",\n below ? \"top-full mt-2\" : \"bottom-full mb-2\",\n )}\n >\n {/* The card's glass starts as a small pill on the bar's edge and\n springs out to the size of what it holds, then back on close.\n Width and height animate rather than scale so the corners stay\n true; the layer is absolute and decorative, so nothing reflows. */}\n <motion.div\n aria-hidden=\"true\"\n initial={reduce ? { opacity: 0 } : { ...seed, opacity: 0 }}\n animate={{\n width: panelSize.width || SEED.width,\n height: panelSize.height || SEED.height,\n y: 0,\n opacity: 1,\n }}\n exit={\n reduce\n ? { opacity: 0, transition: { duration: 0.12 } }\n : { ...seed, opacity: 0, transition: MORPH_EXIT }\n }\n transition={reduce ? { duration: 0 } : MORPH_ENTER}\n style={{ borderRadius: SURFACE_RADIUS, x: \"-50%\" }}\n className={cn(\"absolute left-1/2\", below ? \"top-0\" : \"bottom-0\", GLASS)}\n />\n {/* Content waits for the shape to arrive and leaves before it goes. */}\n <motion.div\n initial={{ opacity: 0, y: reduce ? 0 : below ? -6 : 6 }}\n animate={{\n opacity: 1,\n y: 0,\n transition: reduce ? { duration: 0.15 } : CONTENT_IN,\n }}\n exit={{ opacity: 0, transition: CONTENT_OUT }}\n ref={measurePanel}\n // Never shorter than this session's tallest list, so narrowing a\n // search leaves empty glass instead of pulling the card down.\n style={{ minHeight: panelFloor || undefined }}\n className=\"relative p-2\"\n >\n <div ref={measureRows}>{panel}</div>\n </motion.div>\n </div>\n )}\n </PresenceGate>\n ) : null}\n </AnimatePresence>\n\n <motion.div\n layout\n transition={layout}\n onPointerDown={focusField}\n style={{ borderRadius: SURFACE_RADIUS }}\n className={cn(\n // Raised over the panel so the growing shape emerges from behind it.\n \"relative z-20 flex h-14 min-w-0 items-center gap-2 ps-4\",\n GLASS,\n disabled ? \"cursor-not-allowed\" : \"cursor-text\",\n // Trailing buttons carry their own inset; bare text needs the full one.\n actions ? \"pe-2\" : \"pe-4\",\n open ? \"w-full\" : \"w-fit max-w-full\",\n )}\n >\n <Search aria-hidden=\"true\" className=\"size-5 shrink-0 text-muted-foreground\" />\n <div\n ref={chipsRef}\n // The padding at each end is where a scrolled chip fades out; with\n // nothing scrolled under it the padding is empty, so the fade is\n // invisible. Relative, so a leaving chip popped out of flow stays\n // inside the scrolling row.\n className={cn(\n \"relative flex min-w-0 items-center gap-1.5 overflow-x-auto [scrollbar-width:none]\",\n chips.length > 0 &&\n \"mask-[linear-gradient(to_right,transparent,#000_12px,#000_calc(100%-12px),transparent)] -mx-1.5 px-3\",\n )}\n >\n <AnimatePresence initial={false} mode=\"popLayout\">\n {chips.map((chip) => (\n <motion.span\n key={chip}\n layout={reduce ? false : \"position\"}\n initial={reduce ? { opacity: 0 } : CHIP_HIDDEN}\n animate={reduce ? { opacity: 1 } : CHIP_SHOWN}\n exit={\n reduce\n ? { opacity: 0, transition: { duration: 0.1 } }\n : { ...CHIP_HIDDEN, transition: CHIP_EXIT }\n }\n transition={reduce ? { duration: 0.12 } : CHIP_ENTER}\n // Grown from and folded back into the edge it is attached to, so a\n // chip reads as unrolling out of the one before it.\n style={{ transformOrigin: rtl ? \"right center\" : \"left center\" }}\n className={cn(\n \"flex h-9 shrink-0 items-center gap-1 rounded-full ps-3 pe-1 text-foreground text-sm transition-[background-color,box-shadow] duration-150\",\n marked === chip\n ? // Inset: the chip fills its scrolling row, which clips anything drawn outside it.\n \"bg-foreground/12 ring-2 ring-foreground/40 ring-inset\"\n : \"bg-foreground/[0.07]\",\n )}\n >\n <span className=\"max-w-40 truncate\" title={chip}>\n {chip}\n </span>\n <button\n type=\"button\"\n disabled={disabled}\n aria-label={`Remove filter ${chip}`}\n onClick={() => removeChip(chip)}\n className=\"grid size-7 shrink-0 place-items-center rounded-full text-muted-foreground outline-none transition-colors hover:bg-foreground/10 hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring disabled:pointer-events-none\"\n >\n <X aria-hidden=\"true\" className=\"size-3.5\" />\n </button>\n </motion.span>\n ))}\n </AnimatePresence>\n </div>\n <motion.input\n ref={inputRef}\n // Glides aside as chips arrive and back as they leave.\n layout={reduce ? false : \"position\"}\n transition={layout}\n type=\"text\"\n role=\"combobox\"\n aria-label={label}\n aria-expanded={panelOpen}\n aria-controls={panelOpen && showList ? listId : undefined}\n aria-autocomplete=\"list\"\n aria-activedescendant={activeOptionId}\n aria-describedby={hintId}\n autoComplete=\"off\"\n spellCheck={false}\n enterKeyHint=\"search\"\n disabled={disabled}\n value={query}\n placeholder={placeholder}\n onChange={(event) => {\n setQuery(event.target.value);\n if (!open) setOpen(true);\n }}\n onFocus={() => setOpen(true)}\n // Escape closes the panel but leaves focus here; a click brings it back.\n onClick={() => setOpen(true)}\n onKeyDown={onKeyDown}\n // At rest the field is as wide as its placeholder, so the bar hugs its content.\n style={open ? undefined : { width: `${Math.max(placeholder.length, 6) + 2}ch` }}\n className={cn(\n // On a narrow screen the chips scroll first; the field keeps room to type.\n \"h-9 min-w-24 text-ellipsis bg-transparent text-base text-foreground outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed\",\n open && \"flex-1\",\n )}\n />\n {actions ? <div className=\"flex shrink-0 items-center gap-1\">{actions}</div> : null}\n </motion.div>\n\n {name\n ? chips.map((chip) => <input key={chip} type=\"hidden\" name={name} value={chip} />)\n : null}\n <span id={hintId} className=\"sr-only\">\n Enter adds a filter. Backspace at the start of the field selects the last filter, and again\n removes it. Delete removes the highlighted recent search.\n </span>\n <span aria-live=\"polite\" className=\"sr-only\">\n {announcement.text}\n {/* Alternates an invisible character so a repeated message still changes. */}\n {announcement.count % 2 ? \" \" : \"\"}\n </span>\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;AA4BA,MAAM,cAA0B;CADT,MAAM;CAAU,WAAW;CAAK,SAAS;CAAI,MAAM;CACvB,SAAS,EAAE,UAAU,GAAI;AAAE;AAC9E,MAAM,aAAyB;CAC7B,MAAM;CACN,WAAW;CACX,SAAS;CACT,MAAM;CACN,SAAS;EAAE,UAAU;EAAM,OAAO;CAAI;AACxC;AAGA,MAAM,OAAO;CAAE,OAAO;CAAK,QAAQ;AAAG;AACtC,MAAM,YAAY;AAElB,MAAM,aAAyB;CAAE,UAAU;CAAM,MAAM;CAAU,OAAO;AAAK;AAC7E,MAAM,cAA0B;CAAE,UAAU;CAAM,MAAM;AAAS;AAIjE,MAAM,QACJ;AAGF,MAAM,cAAc;CAAE,SAAS;CAAG,OAAO;CAAK,QAAQ;AAAY;AAClE,MAAM,aAAa;CAAE,SAAS;CAAG,OAAO;CAAG,QAAQ;AAAY;AAC/D,MAAM,aAAyB;CAC7B,GAAG;CACH,SAAS,EAAE,UAAU,IAAK;CAC1B,QAAQ,EAAE,UAAU,GAAI;AAC1B;AACA,MAAM,YAAwB;CAAE,UAAU;CAAM,MAAM;AAAS;AAE/D,MAAM,iBAAiB;AAEvB,MAAM,aAAa;AAuDnB,SAAS,gBAAmB,OAAsB,SAAY,UAA8B;CAC1F,MAAM,CAAC,UAAU,eAAe,SAAS,OAAO;CAShD,OAAO;EARS,SAAS;EACb,aACT,SAAY;GACX,IAAI,UAAU,KAAA,GAAW,YAAY,IAAI;GACzC,WAAW,IAAI;EACjB,GACA,CAAC,OAAO,QAAQ,CAEC;EAAG;CAAW;AACnC;AAEA,MAAM,YAAY,GAAW,MAAc,EAAE,KAAK,CAAC,CAAC,YAAY,MAAM,EAAE,KAAK,CAAC,CAAC,YAAY;AAC3F,MAAM,YAAY,MAAc,UAAkB,KAAK,YAAY,CAAC,CAAC,SAAS,MAAM,YA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AM,OAAO;GAAO,GAA9C,IAA8C,CAAC,IAC/E;GACJ,oBAAC,QAAD;IAAM,IAAI;IAAQ,WAAU;IAAU,UAAA;GAGhC,CAAA;GACN,qBAAC,QAAD;IAAM,aAAU;IAAS,WAAU;IAAnC,UAAA,CACG,aAAa,MAEb,aAAa,QAAQ,IAAI,SAAM,EAC5B;;EACH;;AAET"}
@@ -12,4 +12,5 @@ export interface MultiSelectContentProps {
12
12
  }
13
13
  export declare function MultiSelectContent({ children, side, align, sideOffset, avoidCollisions, className }: MultiSelectContentProps): import("react").ReactPortal | null;
14
14
  //#endregion
15
+ export {};
15
16
  //# sourceMappingURL=content.d.ts.map
@@ -28,4 +28,5 @@ export declare function NotFoundStage({ className, children }: {
28
28
  children: React.ReactNode;
29
29
  }): import("react").JSX.Element;
30
30
  //#endregion
31
+ export {};
31
32
  //# sourceMappingURL=shared.d.ts.map
@@ -3,6 +3,11 @@ export interface NumberTickerProps {
3
3
  value: number;
4
4
  /** Digits to pad to (left). */
5
5
  pad?: number;
6
+ /**
7
+ * Fraction digits to keep. The value is rounded to this many places before
8
+ * `format` runs (default 0, whole numbers).
9
+ */
10
+ decimals?: number;
6
11
  /** Per-digit roll duration in seconds. */
7
12
  duration?: number;
8
13
  /** Stagger between digits. */
@@ -20,6 +25,6 @@ export interface NumberTickerProps {
20
25
  /** Custom formatter. Client-only — server components must use `locale` instead. */
21
26
  format?: (value: number) => string;
22
27
  }
23
- export declare function NumberTicker({ value, pad, duration, stagger, startOnView, prefix, suffix, blur, className, digitClassName, locale, format }: NumberTickerProps): import("react").JSX.Element;
28
+ export declare function NumberTicker({ value, pad, decimals, duration, stagger, startOnView, prefix, suffix, blur, className, digitClassName, locale, format }: NumberTickerProps): import("react").JSX.Element;
24
29
  //#endregion
25
30
  //# sourceMappingURL=number-ticker.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"number-ticker.d.ts","names":[],"sources":["../../../src/components/motion/number-ticker.tsx"],"mappings":";iBAQiB;EACf;;EAEA;;EAEA;;EAEA;;EAEA;EACA;EACA;;EAEA;EACA;EACA;;EAEA;;EAEA,UAAU;;wBAMI,eACd,OACA,KACA,UACA,SACA,aACA,QACA,QACA,MACA,WACA,gBACA,QACA,UACC,oCAAiB,IAAA"}
1
+ {"version":3,"file":"number-ticker.d.ts","names":[],"sources":["../../../src/components/motion/number-ticker.tsx"],"mappings":";iBAQiB;EACf;;EAEA;;;;;EAKA;;EAEA;;EAEA;;EAEA;EACA;EACA;;EAEA;EACA;EACA;;EAEA;;EAEA,UAAU;;wBAMI,eACd,OACA,KACA,UACA,UACA,SACA,aACA,QACA,QACA,MACA,WACA,gBACA,QACA,UACC,oCAAiB,IAAA"}
@@ -7,7 +7,7 @@ import { animate, motion, useInView, useReducedMotion } from "motion/react";
7
7
  //#region src/components/motion/number-ticker.tsx
8
8
  const DIGIT_HEIGHT_EM = 1.1;
9
9
  const DIGITS = Array.from({ length: 10 }, (_, n) => n);
10
- function NumberTicker({ value, pad, duration = .9, stagger = .04, startOnView = true, prefix, suffix, blur = false, className, digitClassName, locale, format }) {
10
+ function NumberTicker({ value, pad, decimals = 0, duration = .9, stagger = .04, startOnView = true, prefix, suffix, blur = false, className, digitClassName, locale, format }) {
11
11
  const containerRef = useRef(null);
12
12
  const inView = useInView(containerRef, {
13
13
  once: true,
@@ -18,12 +18,18 @@ function NumberTicker({ value, pad, duration = .9, stagger = .04, startOnView =
18
18
  if (startOnView && inView) setArmed(true);
19
19
  }, [startOnView, inView]);
20
20
  const text = useMemo(() => {
21
- const rounded = Math.round(value);
22
- const formatted = format ? format(rounded) : locale ? rounded.toLocaleString() : rounded.toString();
21
+ const places = Math.max(0, Math.floor(decimals));
22
+ const factor = 10 ** places;
23
+ const rounded = Math.round(value * factor) / factor;
24
+ const formatted = format ? format(rounded) : locale ? rounded.toLocaleString(void 0, {
25
+ minimumFractionDigits: places,
26
+ maximumFractionDigits: places
27
+ }) : rounded.toFixed(places);
23
28
  return pad ? formatted.padStart(pad, "0") : formatted;
24
29
  }, [
25
30
  value,
26
31
  pad,
32
+ decimals,
27
33
  format,
28
34
  locale
29
35
  ]);
@@ -50,13 +56,13 @@ function NumberTicker({ value, pad, duration = .9, stagger = .04, startOnView =
50
56
  ]);
51
57
  return /* @__PURE__ */ jsxs("span", {
52
58
  ref: containerRef,
53
- className: cn("inline-flex items-center tabular-nums", className),
59
+ className: cn("inline-flex items-baseline tabular-nums", className),
54
60
  children: [/* @__PURE__ */ jsx("span", {
55
61
  className: "sr-only",
56
62
  children: readableText
57
63
  }), /* @__PURE__ */ jsxs("span", {
58
64
  "aria-hidden": "true",
59
- className: "inline-flex items-center",
65
+ className: "inline-flex items-baseline",
60
66
  children: [
61
67
  prefix ? /* @__PURE__ */ jsx("span", { children: prefix }) : null,
62
68
  glyphs.map(({ char, id }, i) => {
@@ -100,13 +106,17 @@ function Digit({ digit, delay, duration, blur, className }) {
100
106
  duration,
101
107
  reduce
102
108
  ]);
103
- return /* @__PURE__ */ jsx("span", {
104
- className: cn("relative inline-block overflow-hidden", className),
109
+ return /* @__PURE__ */ jsxs("span", {
110
+ className: cn("relative inline-block text-center [clip-path:inset(0)]", className),
105
111
  style: {
106
112
  height: `${DIGIT_HEIGHT_EM}em`,
113
+ lineHeight: `${DIGIT_HEIGHT_EM}em`,
107
114
  width: "1ch"
108
115
  },
109
- children: /* @__PURE__ */ jsx(motion.span, {
116
+ children: [/* @__PURE__ */ jsx("span", {
117
+ className: "invisible",
118
+ children: digit
119
+ }), /* @__PURE__ */ jsx(motion.span, {
110
120
  ref: columnRef,
111
121
  initial: { y: 0 },
112
122
  animate: { y: `-${digit * DIGIT_HEIGHT_EM}em` },
@@ -120,7 +130,7 @@ function Digit({ digit, delay, duration, blur, className }) {
120
130
  className: "flex h-[1.1em] items-center justify-center leading-none",
121
131
  children: n
122
132
  }, n))
123
- })
133
+ })]
124
134
  });
125
135
  }
126
136
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"number-ticker.js","names":[],"sources":["../../../src/components/motion/number-ticker.tsx"],"sourcesContent":["\"use client\";\n\nimport { useEffect, useMemo, useRef, useState } from \"react\";\nimport { animate, motion, useInView, useReducedMotion } from \"motion/react\";\n\nimport { cn } from \"@kumix/utils\";\nimport { EASE_OUT } from \"../../lib/ease\";\n\nexport interface NumberTickerProps {\n value: number;\n /** Digits to pad to (left). */\n pad?: number;\n /** Per-digit roll duration in seconds. */\n duration?: number;\n /** Stagger between digits. */\n stagger?: number;\n /** Render only after the element enters the viewport. */\n startOnView?: boolean;\n prefix?: string;\n suffix?: string;\n /** Add a small blur during digit rolls. */\n blur?: boolean;\n className?: string;\n digitClassName?: string;\n /** Insert locale group separators (commas). Server-component safe. */\n locale?: boolean;\n /** Custom formatter. Client-only — server components must use `locale` instead. */\n format?: (value: number) => string;\n}\n\nconst DIGIT_HEIGHT_EM = 1.1;\nconst DIGITS = Array.from({ length: 10 }, (_, n) => n);\n\nexport function NumberTicker({\n value,\n pad,\n duration = 0.9,\n stagger = 0.04,\n startOnView = true,\n prefix,\n suffix,\n blur = false,\n className,\n digitClassName,\n locale,\n format,\n}: NumberTickerProps) {\n const containerRef = useRef<HTMLSpanElement>(null);\n const inView = useInView(containerRef, { once: true, amount: 0.6 });\n const [armed, setArmed] = useState(!startOnView);\n\n useEffect(() => {\n if (startOnView && inView) setArmed(true);\n }, [startOnView, inView]);\n\n const text = useMemo(() => {\n const rounded = Math.round(value);\n const formatted = format\n ? format(rounded)\n : locale\n ? rounded.toLocaleString()\n : rounded.toString();\n return pad ? formatted.padStart(pad, \"0\") : formatted;\n }, [value, pad, format, locale]);\n const glyphs = useMemo(() => {\n const chars = text.split(\"\");\n // Key by place value (position from the right): a changing digit keeps its\n // identity and rolls to the new value instead of remounting and replaying\n // from 0. Growing numbers add glyphs on the left without re-keying the\n // ones, tens, hundreds already on screen.\n return chars.map((char, i) => ({ char, id: `g-${chars.length - 1 - i}` }));\n }, [text]);\n const readableText = `${prefix ?? \"\"}${text}${suffix ?? \"\"}`;\n\n // Stagger is an entrance flourish. Once the reveal has played, value\n // changes roll every digit immediately — a per-digit delay on live updates\n // reads as lag.\n const [entered, setEntered] = useState(false);\n useEffect(() => {\n if (!armed || entered) return;\n const total = (duration + glyphs.length * stagger) * 1000;\n const t = window.setTimeout(() => setEntered(true), total);\n return () => window.clearTimeout(t);\n }, [armed, entered, duration, stagger, glyphs.length]);\n\n return (\n <span ref={containerRef} className={cn(\"inline-flex items-center tabular-nums\", className)}>\n <span className=\"sr-only\">{readableText}</span>\n <span aria-hidden=\"true\" className=\"inline-flex items-center\">\n {prefix ? <span>{prefix}</span> : null}\n {glyphs.map(({ char, id }, i) => {\n const isDigit = /\\d/.test(char);\n if (!isDigit) {\n return (\n <span key={id} className=\"inline-block\">\n {char}\n </span>\n );\n }\n const digit = Number(char);\n return (\n <Digit\n key={id}\n digit={armed ? digit : 0}\n delay={entered ? 0 : i * stagger}\n duration={duration}\n blur={blur}\n className={digitClassName}\n />\n );\n })}\n {suffix ? <span>{suffix}</span> : null}\n </span>\n </span>\n );\n}\n\nfunction Digit({\n digit,\n delay,\n duration,\n blur,\n className,\n}: {\n digit: number;\n delay: number;\n duration: number;\n blur: boolean;\n className?: string;\n}) {\n const reduce = useReducedMotion();\n const columnRef = useRef<HTMLSpanElement>(null);\n\n useEffect(() => {\n if (reduce || !blur || !columnRef.current || !Number.isFinite(digit)) {\n return;\n }\n\n const node = columnRef.current;\n const controls = animate(\n node,\n { filter: [\"blur(10px)\", \"blur(0px)\"] },\n {\n duration: Math.min(duration * 0.75, 0.32),\n delay,\n ease: EASE_OUT,\n },\n );\n\n return () => {\n controls.stop();\n node.style.filter = \"blur(0px)\";\n };\n }, [blur, delay, digit, duration, reduce]);\n\n return (\n <span\n className={cn(\"relative inline-block overflow-hidden\", className)}\n style={{ height: `${DIGIT_HEIGHT_EM}em`, width: \"1ch\" }}\n >\n <motion.span\n ref={columnRef}\n initial={{ y: 0 }}\n animate={{ y: `-${digit * DIGIT_HEIGHT_EM}em` }}\n transition={reduce ? { duration: 0 } : { duration, delay, ease: EASE_OUT }}\n className=\"absolute inset-x-0 top-0 flex flex-col items-center will-change-[transform,filter]\"\n >\n {DIGITS.map((n) => (\n <span key={n} className=\"flex h-[1.1em] items-center justify-center leading-none\">\n {n}\n </span>\n ))}\n </motion.span>\n </span>\n );\n}\n"],"mappings":";;;;;;;AA8BA,MAAM,kBAAkB;AACxB,MAAM,SAAS,MAAM,KAAK,EAAE,QAAQ,GAAG,IAAI,GAAG,MAAM,CAAC;AAErD,SAAgB,aAAa,EAC3B,OACA,KACA,WAAW,IACX,UAAU,KACV,cAAc,MACd,QACA,QACA,OAAO,OACP,WACA,gBACA,QACA,UACoB;CACpB,MAAM,eAAe,OAAwB,IAAI;CACjD,MAAM,SAAS,UAAU,cAAc;EAAE,MAAM;EAAM,QAAQ;CAAI,CAAC;CAClE,MAAM,CAAC,OAAO,YAAY,SAAS,CAAC,WAAW;CAE/C,gBAAgB;EACd,IAAI,eAAe,QAAQ,SAAS,IAAI;CAC1C,GAAG,CAAC,aAAa,MAAM,CAAC;CAExB,MAAM,OAAO,cAAc;EACzB,MAAM,UAAU,KAAK,MAAM,KAAK;EAChC,MAAM,YAAY,SACd,OAAO,OAAO,IACd,SACE,QAAQ,eAAe,IACvB,QAAQ,SAAS;EACvB,OAAO,MAAM,UAAU,SAAS,KAAK,GAAG,IAAI;CAC9C,GAAG;EAAC;EAAO;EAAK;EAAQ;CAAM,CAAC;CAC/B,MAAM,SAAS,cAAc;EAC3B,MAAM,QAAQ,KAAK,MAAM,EAAE;EAK3B,OAAO,MAAM,KAAK,MAAM,OAAO;GAAE;GAAM,IAAI,KAAK,MAAM,SAAS,IAAI;EAAI,EAAE;CAC3E,GAAG,CAAC,IAAI,CAAC;CACT,MAAM,eAAe,GAAG,UAAU,KAAK,OAAO,UAAU;CAKxD,MAAM,CAAC,SAAS,cAAc,SAAS,KAAK;CAC5C,gBAAgB;EACd,IAAI,CAAC,SAAS,SAAS;EACvB,MAAM,SAAS,W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AAG;EAAC;EAAM;EAAO;EAAO;EAAU;CAAM,CAAC;CAEzC,OACE,oBAAC,QAAD;EACE,WAAW,GAAG,yCAAyC,SAAS;EAChE,OAAO;GAAE,QAAQ,GAAG,gBAAgB;GAAK,OAAO;EAAM;EAEtD,UAAA,oBAAC,OAAO,MAAR;GACE,KAAK;GACL,SAAS,EAAE,GAAG,EAAE;GAChB,SAAS,EAAE,GAAG,IAAI,QAAQ,gBAAgB,IAAI;GAC9C,YAAY,SAAS,EAAE,UAAU,EAAE,IAAI;IAAE;IAAU;IAAO,MAAM;GAAS;GACzE,WAAU;GAET,UAAA,OAAO,KAAK,MACX,oBAAC,QAAD;IAAc,WAAU;IACrB,UAAA;GACG,GAFK,CAEL,CACP;EACU,CAAA;CACT,CAAA;AAEV"}
1
+ {"version":3,"file":"number-ticker.js","names":[],"sources":["../../../src/components/motion/number-ticker.tsx"],"sourcesContent":["\"use client\";\n\nimport { useEffect, useMemo, useRef, useState } from \"react\";\nimport { animate, motion, useInView, useReducedMotion } from \"motion/react\";\n\nimport { cn } from \"@kumix/utils\";\nimport { EASE_OUT } from \"../../lib/ease\";\n\nexport interface NumberTickerProps {\n value: number;\n /** Digits to pad to (left). */\n pad?: number;\n /**\n * Fraction digits to keep. The value is rounded to this many places before\n * `format` runs (default 0, whole numbers).\n */\n decimals?: number;\n /** Per-digit roll duration in seconds. */\n duration?: number;\n /** Stagger between digits. */\n stagger?: number;\n /** Render only after the element enters the viewport. */\n startOnView?: boolean;\n prefix?: string;\n suffix?: string;\n /** Add a small blur during digit rolls. */\n blur?: boolean;\n className?: string;\n digitClassName?: string;\n /** Insert locale group separators (commas). Server-component safe. */\n locale?: boolean;\n /** Custom formatter. Client-only — server components must use `locale` instead. */\n format?: (value: number) => string;\n}\n\nconst DIGIT_HEIGHT_EM = 1.1;\nconst DIGITS = Array.from({ length: 10 }, (_, n) => n);\n\nexport function NumberTicker({\n value,\n pad,\n decimals = 0,\n duration = 0.9,\n stagger = 0.04,\n startOnView = true,\n prefix,\n suffix,\n blur = false,\n className,\n digitClassName,\n locale,\n format,\n}: NumberTickerProps) {\n const containerRef = useRef<HTMLSpanElement>(null);\n const inView = useInView(containerRef, { once: true, amount: 0.6 });\n const [armed, setArmed] = useState(!startOnView);\n\n useEffect(() => {\n if (startOnView && inView) setArmed(true);\n }, [startOnView, inView]);\n\n const text = useMemo(() => {\n const places = Math.max(0, Math.floor(decimals));\n const factor = 10 ** places;\n const rounded = Math.round(value * factor) / factor;\n const formatted = format\n ? format(rounded)\n : locale\n ? rounded.toLocaleString(undefined, {\n minimumFractionDigits: places,\n maximumFractionDigits: places,\n })\n : rounded.toFixed(places);\n return pad ? formatted.padStart(pad, \"0\") : formatted;\n }, [value, pad, decimals, format, locale]);\n const glyphs = useMemo(() => {\n const chars = text.split(\"\");\n // Key by place value (position from the right): a changing digit keeps its\n // identity and rolls to the new value instead of remounting and replaying\n // from 0. Growing numbers add glyphs on the left without re-keying the\n // ones, tens, hundreds already on screen.\n return chars.map((char, i) => ({ char, id: `g-${chars.length - 1 - i}` }));\n }, [text]);\n const readableText = `${prefix ?? \"\"}${text}${suffix ?? \"\"}`;\n\n // Stagger is an entrance flourish. Once the reveal has played, value\n // changes roll every digit immediately — a per-digit delay on live updates\n // reads as lag.\n const [entered, setEntered] = useState(false);\n useEffect(() => {\n if (!armed || entered) return;\n const total = (duration + glyphs.length * stagger) * 1000;\n const t = window.setTimeout(() => setEntered(true), total);\n return () => window.clearTimeout(t);\n }, [armed, entered, duration, stagger, glyphs.length]);\n\n return (\n <span ref={containerRef} className={cn(\"inline-flex items-baseline tabular-nums\", className)}>\n <span className=\"sr-only\">{readableText}</span>\n <span aria-hidden=\"true\" className=\"inline-flex items-baseline\">\n {prefix ? <span>{prefix}</span> : null}\n {glyphs.map(({ char, id }, i) => {\n const isDigit = /\\d/.test(char);\n if (!isDigit) {\n return (\n <span key={id} className=\"inline-block\">\n {char}\n </span>\n );\n }\n const digit = Number(char);\n return (\n <Digit\n key={id}\n digit={armed ? digit : 0}\n delay={entered ? 0 : i * stagger}\n duration={duration}\n blur={blur}\n className={digitClassName}\n />\n );\n })}\n {suffix ? <span>{suffix}</span> : null}\n </span>\n </span>\n );\n}\n\nfunction Digit({\n digit,\n delay,\n duration,\n blur,\n className,\n}: {\n digit: number;\n delay: number;\n duration: number;\n blur: boolean;\n className?: string;\n}) {\n const reduce = useReducedMotion();\n const columnRef = useRef<HTMLSpanElement>(null);\n\n useEffect(() => {\n if (reduce || !blur || !columnRef.current || !Number.isFinite(digit)) {\n return;\n }\n\n const node = columnRef.current;\n const controls = animate(\n node,\n { filter: [\"blur(10px)\", \"blur(0px)\"] },\n {\n duration: Math.min(duration * 0.75, 0.32),\n delay,\n ease: EASE_OUT,\n },\n );\n\n return () => {\n controls.stop();\n node.style.filter = \"blur(0px)\";\n };\n }, [blur, delay, digit, duration, reduce]);\n\n return (\n // The invisible in-flow digit gives the slot a real text baseline so it\n // lines up with surrounding text; clip-path clips the rolling column\n // without moving that baseline the way overflow: hidden would.\n <span\n className={cn(\"relative inline-block text-center [clip-path:inset(0)]\", className)}\n style={{\n height: `${DIGIT_HEIGHT_EM}em`,\n lineHeight: `${DIGIT_HEIGHT_EM}em`,\n width: \"1ch\",\n }}\n >\n <span className=\"invisible\">{digit}</span>\n <motion.span\n ref={columnRef}\n initial={{ y: 0 }}\n animate={{ y: `-${digit * DIGIT_HEIGHT_EM}em` }}\n transition={reduce ? { duration: 0 } : { duration, delay, ease: EASE_OUT }}\n className=\"absolute inset-x-0 top-0 flex flex-col items-center will-change-[transform,filter]\"\n >\n {DIGITS.map((n) => (\n <span key={n} className=\"flex h-[1.1em] items-center justify-center leading-none\">\n {n}\n </span>\n ))}\n </motion.span>\n </span>\n );\n}\n"],"mappings":";;;;;;;AAmCA,MAAM,kBAAkB;AACxB,MAAM,SAAS,MAAM,KAAK,EAAE,QAAQ,GAAG,IAAI,GAAG,MAAM,CAAC;AAErD,SAAgB,aAAa,EAC3B,OACA,KACA,WAAW,GAC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,OAAO;EACT;EANF,UAAA,CAQE,oBAAC,QAAD;GAAM,WAAU;GAAa,UAAA;EAAY,CAAA,GACzC,oBAAC,OAAO,MAAR;GACE,KAAK;GACL,SAAS,EAAE,GAAG,EAAE;GAChB,SAAS,EAAE,GAAG,IAAI,QAAQ,gBAAgB,IAAI;GAC9C,YAAY,SAAS,EAAE,UAAU,EAAE,IAAI;IAAE;IAAU;IAAO,MAAM;GAAS;GACzE,WAAU;GAET,UAAA,OAAO,KAAK,MACX,oBAAC,QAAD;IAAc,WAAU;IACrB,UAAA;GACG,GAFK,CAEL,CACP;EACU,CAAA,CACT;;AAEV"}
@@ -1 +1 @@
1
- {"version":3,"file":"parallax.js","names":[],"sources":["../../../src/components/motion/parallax.tsx"],"sourcesContent":["\"use client\";\n\nimport { type ReactNode, type RefObject, useRef } from \"react\";\nimport {\n type MotionStyle,\n motion,\n useReducedMotion,\n useScroll,\n useSpring,\n useTransform,\n} from \"motion/react\";\n\nimport { cn } from \"@kumix/utils\";\n\n// Soft follow so the drift trails the scroll smoothly; looser than the UI\n// springs in lib/ease.ts on purpose.\nconst PARALLAX_SPRING = { stiffness: 120, damping: 30, mass: 0.6 };\n\nexport interface ParallaxProps {\n children: ReactNode;\n /**\n * Drift as a fraction of the element's travel through the viewport.\n * Positive moves with the scroll (foreground), negative against it\n * (background). ~0.1–0.5 reads best.\n */\n speed?: number;\n axis?: \"x\" | \"y\";\n /** Scroll container for contained scroll areas. Defaults to the viewport. */\n container?: RefObject<HTMLElement | null>;\n /** Spring-smooth the drift. Disabled automatically under reduced motion. */\n spring?: boolean;\n className?: string;\n}\n\nexport function Parallax({\n children,\n speed = 0.3,\n axis = \"y\",\n container,\n spring = true,\n className,\n}: ParallaxProps) {\n const reduce = useReducedMotion();\n const ref = useRef<HTMLDivElement>(null);\n const { scrollYProgress } = useScroll({\n target: ref,\n container,\n offset: [\"start end\", \"end start\"],\n // Run after paint so a container ref defined higher in the tree is hydrated;\n // otherwise framer falls back to the document and only the page scroll works.\n // layoutEffect: false,\n });\n\n // progress 0→1 as the element crosses the viewport; map to a symmetric drift.\n const travel = speed * 100;\n const drift = useTransform(scrollYProgress, [0, 1], [travel, -travel]);\n const smoothed = useSpring(drift, PARALLAX_SPRING);\n const value = spring && !reduce ? smoothed : drift;\n\n const style: MotionStyle = reduce ? {} : axis === \"x\" ? { x: value } : { y: value };\n\n return (\n <motion.div ref={ref} style={style} className={cn(className)}>\n {children}\n </motion.div>\n );\n}\n"],"mappings":";;;;;;AAgBA,MAAM,kBAAkB;CAAE,WAAW;CAAK,SAAS;CAAI,MAAM;AAAI;AAkBjE,SAAgB,SAAS,EACvB,UACA,QAAQ,IACR,OAAO,KACP,WACA,SAAS,MACT,aACgB;CAChB,MAAM,SAAS,iBAAiB;CAChC,MAAM,MAAM,OAAuB,IAAI;CACvC,MAAM,EAAE,oBAAoB,UAAU;EACpC,QAAQ;EACR;EACA,QAAQ,CAAC,aAAa,WAAW;CAInC,CAAC;CAGD,MAAM,SAAS,QAAQ;CACvB,MAAM,QAAQ,aAAa,iBAAiB,CAAC,GAAG,CAAC,GAAG,CAAC,QAAQ,CAAC,MAAM,CAAC;CACrE,MAAM,WAAW,UAAU,OAAO,eAAe;CACjD,MAAM,QAAQ,UAAU,CAAC,SAAS,WAAW;CAE7C,MAAM,QAAqB,SAAS,CAAC,IAAI,SAAS,MAAM,EAAE,GAAG,MAAM,IAAI,EAAE,GAAG,MAAM;CAElF,OACE,oBAAC,OAAO,KAAR;EAAiB;EAAY;EAAO,WAAW,GAAG,SAAS;EACxD;CACS,CAAA;AAEhB"}
1
+ {"version":3,"file":"parallax.js","names":[],"sources":["../../../src/components/motion/parallax.tsx"],"sourcesContent":["\"use client\";\n\nimport { type ReactNode, type RefObject, useRef } from \"react\";\nimport {\n type MotionStyle,\n motion,\n useReducedMotion,\n useScroll,\n useSpring,\n useTransform,\n} from \"motion/react\";\n\nimport { cn } from \"@kumix/utils\";\n\n// Soft follow so the drift trails the scroll smoothly; looser than the UI\n// springs in lib/ease.ts on purpose.\nconst PARALLAX_SPRING = { stiffness: 120, damping: 30, mass: 0.6 };\n\nexport interface ParallaxProps {\n children: ReactNode;\n /**\n * Drift as a fraction of the element's travel through the viewport.\n * Positive moves with the scroll (foreground), negative against it\n * (background). ~0.1–0.5 reads best.\n */\n speed?: number;\n axis?: \"x\" | \"y\";\n /** Scroll container for contained scroll areas. Defaults to the viewport. */\n container?: RefObject<HTMLElement | null>;\n /** Spring-smooth the drift. Disabled automatically under reduced motion. */\n spring?: boolean;\n className?: string;\n}\n\nexport function Parallax({\n children,\n speed = 0.3,\n axis = \"y\",\n container,\n spring = true,\n className,\n}: ParallaxProps) {\n const reduce = useReducedMotion();\n const ref = useRef<HTMLDivElement>(null);\n const { scrollYProgress } = useScroll({\n target: ref,\n container,\n // A container ref defined higher in the tree may attach after this hook\n // runs; useScroll waits for it rather than falling back to the page.\n offset: [\"start end\", \"end start\"],\n });\n\n // progress 0→1 as the element crosses the viewport; map to a symmetric drift.\n const travel = speed * 100;\n const drift = useTransform(scrollYProgress, [0, 1], [travel, -travel]);\n const smoothed = useSpring(drift, PARALLAX_SPRING);\n const value = spring && !reduce ? smoothed : drift;\n\n const style: MotionStyle = reduce ? {} : axis === \"x\" ? { x: value } : { y: value };\n\n return (\n <motion.div ref={ref} style={style} className={cn(className)}>\n {children}\n </motion.div>\n );\n}\n"],"mappings":";;;;;;AAgBA,MAAM,kBAAkB;CAAE,WAAW;CAAK,SAAS;CAAI,MAAM;AAAI;AAkBjE,SAAgB,SAAS,EACvB,UACA,QAAQ,IACR,OAAO,KACP,WACA,SAAS,MACT,aACgB;CAChB,MAAM,SAAS,iBAAiB;CAChC,MAAM,MAAM,OAAuB,IAAI;CACvC,MAAM,EAAE,oBAAoB,UAAU;EACpC,QAAQ;EACR;EAGA,QAAQ,CAAC,aAAa,WAAW;CACnC,CAAC;CAGD,MAAM,SAAS,QAAQ;CACvB,MAAM,QAAQ,aAAa,iBAAiB,CAAC,GAAG,CAAC,GAAG,CAAC,QAAQ,CAAC,MAAM,CAAC;CACrE,MAAM,WAAW,UAAU,OAAO,eAAe;CACjD,MAAM,QAAQ,UAAU,CAAC,SAAS,WAAW;CAE7C,MAAM,QAAqB,SAAS,CAAC,IAAI,SAAS,MAAM,EAAE,GAAG,MAAM,IAAI,EAAE,GAAG,MAAM;CAElF,OACE,oBAAC,OAAO,KAAR;EAAiB;EAAY;EAAO,WAAW,GAAG,SAAS;EACxD;CACS,CAAA;AAEhB"}
@@ -30,8 +30,13 @@ export interface MorphPopoverContentProps {
30
30
  sideOffset?: number;
31
31
  /** Panel corner radius, in px. Default 16. */
32
32
  radius?: number;
33
+ /** Draw the surface shadow. Default true. */
34
+ shadow?: boolean;
35
+ /** Runs after the portalled surface is positioned and visible. */
36
+ onOpenAutoFocus?: (content: HTMLDivElement) => void;
33
37
  className?: string;
34
38
  }
35
39
  export declare function MorphPopoverContent(props: MorphPopoverContentProps): import("react").ReactPortal | null;
36
40
  //#endregion
41
+ export {};
37
42
  //# sourceMappingURL=popover-morph.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"popover-morph.d.ts","names":[],"sources":["../../../src/components/motion/popover-morph.tsx"],"mappings":";;KA+BK;KACA;iBAsBY;EACf,UAAU;;EAEV;;EAEA;EACA,gBAAgB;EAChB;;;;;;;wBAQc,eACd,UACA,MAAM,gBACN,aACA,cACA,aACC,oCAAiB,IAAA;iBAoFH;EACf,UAAU;;;wBAcI,sBAAsB,YAAY,2BAAwB,aAAA,kDAAA;iBA0CzD;EACf,UAAU;EACV,OAAO;EACP,QAAQ;;EAER;;EAEA;EACA;;wBAGc,oBAAoB,OAAO,2CAAwB"}
1
+ {"version":3,"file":"popover-morph.d.ts","names":[],"sources":["../../../src/components/motion/popover-morph.tsx"],"mappings":";;KA+BK;KACA;iBAsBY;EACf,UAAU;;EAEV;;EAEA;EACA,gBAAgB;EAChB;;;;;;;wBAQc,eACd,UACA,MAAM,gBACN,aACA,cACA,aACC,oCAAiB,IAAA;iBAoFH;EACf,UAAU;;;wBAcI,sBAAsB,YAAY,2BAAwB,aAAA,kDAAA;iBA0CzD;EACf,UAAU;EACV,OAAO;EACP,QAAQ;;EAER;;EAEA;;EAEA;;EAEA,mBAAmB,SAAS;EAC5B;;wBAGc,oBAAoB,OAAO,2CAAwB"}
@@ -128,13 +128,21 @@ function MorphPopoverContent(props) {
128
128
  if (!portalReady) return null;
129
129
  return createPortal(/* @__PURE__ */ jsx(AnimatePresence, { children: ctx.open && /* @__PURE__ */ jsx(MorphPopoverSurface, { ...props }) }), document.body);
130
130
  }
131
- function MorphPopoverSurface({ children, side = "bottom", align = "end", sideOffset = 8, radius = 16, className }) {
131
+ function MorphPopoverSurface({ children, side = "bottom", align = "end", sideOffset = 8, radius = 16, shadow = true, onOpenAutoFocus, className }) {
132
132
  const ctx = useMorphContext("MorphPopoverContent");
133
133
  const reduce = useReducedMotion() ?? false;
134
134
  const [isPresent, safeToRemove] = usePresence();
135
135
  const layout = usePopoverPortalPosition(ctx.triggerRef, ctx.contentRef, isPresent);
136
- const left = layout ? align === "end" ? layout.trigger.left + layout.trigger.width - layout.content.width : layout.trigger.left : 0;
137
- const top = layout ? side === "bottom" ? layout.trigger.top + layout.trigger.height + sideOffset : layout.trigger.top - layout.content.height - sideOffset : 0;
136
+ const preferredLeft = layout ? align === "end" ? layout.trigger.left + layout.trigger.width - layout.content.width : layout.trigger.left : 0;
137
+ const gutter = 12;
138
+ const below = layout ? Math.max(0, window.innerHeight - layout.trigger.top - layout.trigger.height - sideOffset - gutter) : 0;
139
+ const above = layout ? Math.max(0, layout.trigger.top - sideOffset - gutter) : 0;
140
+ const requestedSpace = side === "bottom" ? below : above;
141
+ const otherSpace = side === "bottom" ? above : below;
142
+ const resolvedSide = layout && layout.content.height > requestedSpace && otherSpace > requestedSpace ? side === "bottom" ? "top" : "bottom" : side;
143
+ const availableHeight = resolvedSide === "bottom" ? below : above;
144
+ const left = layout ? Math.max(gutter, Math.min(preferredLeft, window.innerWidth - layout.content.width - gutter)) : 0;
145
+ const top = layout ? resolvedSide === "bottom" ? layout.trigger.top + layout.trigger.height + sideOffset : Math.max(gutter, layout.trigger.top - layout.content.height - sideOffset) : 0;
138
146
  const wrap = reduce ? void 0 : {
139
147
  hidden: {
140
148
  scale: .96,
@@ -147,16 +155,27 @@ function MorphPopoverSurface({ children, side = "bottom", align = "end", sideOff
147
155
  };
148
156
  const clip = reduce ? void 0 : {
149
157
  hidden: {
150
- clipPath: clipAt(side, align, radius, 92),
158
+ clipPath: clipAt(resolvedSide, align, radius, 92),
151
159
  transition: MORPH_CLIP_TRANSITION
152
160
  },
153
161
  show: {
154
- clipPath: clipAt(side, align, radius, 0),
162
+ clipPath: clipAt(resolvedSide, align, radius, 0),
155
163
  transition: MORPH_CLIP_TRANSITION
156
164
  }
157
165
  };
158
166
  const opacity = useMotionValue(0);
159
167
  const ready = layout !== null;
168
+ const focusedOnOpen = useRef(false);
169
+ useEffect(() => {
170
+ if (!ready || !isPresent || focusedOnOpen.current || !ctx.contentRef.current) return;
171
+ focusedOnOpen.current = true;
172
+ onOpenAutoFocus?.(ctx.contentRef.current);
173
+ }, [
174
+ ready,
175
+ isPresent,
176
+ ctx.contentRef,
177
+ onOpenAutoFocus
178
+ ]);
160
179
  useEffect(() => {
161
180
  if (!ready) {
162
181
  if (!isPresent) safeToRemove?.();
@@ -189,16 +208,23 @@ function MorphPopoverSurface({ children, side = "bottom", align = "end", sideOff
189
208
  opacity,
190
209
  pointerEvents: isPresent ? "auto" : "none",
191
210
  visibility: layout ? "visible" : "hidden",
192
- transformOrigin: originFor(side, align)
211
+ transformOrigin: originFor(resolvedSide, align)
193
212
  },
194
- className: "filter-[drop-shadow(0_10px_18px_rgba(0,0,0,0.14))] fixed z-9999",
213
+ className: cn("fixed z-9999", shadow && "filter-[drop-shadow(0_10px_18px_rgba(0,0,0,0.14))]"),
195
214
  children: /* @__PURE__ */ jsx(motion.div, {
196
215
  ref: ctx.contentRef,
197
216
  id: ctx.contentId,
198
217
  role: "dialog",
199
218
  "aria-labelledby": ctx.triggerId,
200
219
  variants: clip,
201
- style: { borderRadius: radius },
220
+ initial: "hidden",
221
+ animate: layout ? "show" : "hidden",
222
+ exit: "hidden",
223
+ style: {
224
+ borderRadius: radius,
225
+ maxHeight: layout ? availableHeight : void 0,
226
+ overflowY: "auto"
227
+ },
202
228
  className: cn("overflow-hidden border border-border bg-background", className),
203
229
  children
204
230
  })
@@ -1 +1 @@
1
- {"version":3,"file":"popover-morph.js","names":[],"sources":["../../../src/components/motion/popover-morph.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n cloneElement,\n createContext,\n isValidElement,\n type ReactElement,\n type ReactNode,\n type Ref,\n useCallback,\n useContext,\n useEffect,\n useId,\n useMemo,\n useRef,\n useState,\n} from \"react\";\nimport {\n AnimatePresence,\n animate,\n motion,\n useMotionValue,\n usePresence,\n useReducedMotion,\n} from \"motion/react\";\nimport { createPortal } from \"react-dom\";\n\nimport { cn } from \"@kumix/utils\";\nimport { EASE_OUT, SPRING_PANEL } from \"../../lib/ease\";\nimport { usePopoverPortalPosition } from \"./popover-position\";\n\ntype Side = \"top\" | \"bottom\";\ntype Align = \"start\" | \"end\";\n\ntype MorphContextValue = {\n open: boolean;\n setOpen: (open: boolean) => void;\n toggle: () => void;\n triggerId: string;\n contentId: string;\n /** The element the panel measures against — see `registerTrigger`. */\n triggerRef: React.MutableRefObject<HTMLElement | null>;\n registerTrigger: (node: HTMLElement | null) => void;\n contentRef: React.MutableRefObject<HTMLDivElement | null>;\n};\n\nconst MorphContext = createContext<MorphContextValue | null>(null);\n\nfunction useMorphContext(component: string) {\n const ctx = useContext(MorphContext);\n if (!ctx) throw new Error(`${component} must be used within <MorphPopover>`);\n return ctx;\n}\n\nexport interface MorphPopoverProps {\n children: ReactNode;\n /** Controlled open state. */\n open?: boolean;\n /** Uncontrolled initial open state. */\n defaultOpen?: boolean;\n onOpenChange?: (open: boolean) => void;\n className?: string;\n}\n\n/**\n * A popover whose panel morphs open from the trigger corner: it's laid out at\n * full size but clipped to the corner nearest the trigger, then unclips as one\n * piece. Closes on outside pointer / Escape. Controlled or uncontrolled.\n */\nexport function MorphPopover({\n children,\n open: controlledOpen,\n defaultOpen = false,\n onOpenChange,\n className,\n}: MorphPopoverProps) {\n const baseId = useId();\n const [root, setRoot] = useState<HTMLDivElement | null>(null);\n const [trigger, setTrigger] = useState<HTMLElement | null>(null);\n const contentRef = useRef<HTMLDivElement | null>(null);\n const [internalOpen, setInternalOpen] = useState(defaultOpen);\n const controlled = controlledOpen !== undefined;\n const open = controlled ? controlledOpen : internalOpen;\n\n const setOpen = useCallback(\n (next: boolean) => {\n if (!controlled) setInternalOpen(next);\n onOpenChange?.(next);\n },\n [controlled, onOpenChange],\n );\n const toggle = useCallback(() => setOpen(!open), [setOpen, open]);\n\n // A trigger normally registers itself through MorphPopoverTrigger. It can't\n // when something else already clones the element — a Tooltip wrapping the\n // button, say — and an unregistered trigger leaves the panel with nothing to\n // measure against, so it renders permanently invisible. The root boxes the\n // trigger exactly (the content portals out of it), so it stands in until a\n // real trigger registers, and stands in again if that one unmounts. Both are\n // state, so a trigger arriving while the panel is open re-anchors it.\n const anchorRef = useMemo<React.MutableRefObject<HTMLElement | null>>(\n () => ({ current: trigger ?? root }),\n [root, trigger],\n );\n\n // The panel is a `role=\"dialog\"` and goes inert the moment it closes, so\n // focus cannot be left sitting inside it: a dismissal hands it back to the\n // trigger, the way the ARIA dialog pattern asks. A pointer dismissal takes\n // the focus onward itself when it lands on something focusable — this only\n // catches the case where it would otherwise be stranded. When no trigger has\n // registered, the root anchor stands in only if it can actually hold focus;\n // there is nowhere better than where the keyboard already is, so leave it.\n const close = useCallback(() => {\n setOpen(false);\n const focused = document.activeElement;\n const inPanel = focused instanceof HTMLElement && contentRef.current?.contains(focused);\n if (!inPanel) return;\n const restore = trigger ?? (root && root.tabIndex >= 0 ? root : null);\n restore?.focus();\n }, [root, setOpen, trigger]);\n\n useEffect(() => {\n if (!open) return;\n const onKey = (e: KeyboardEvent) => e.key === \"Escape\" && close();\n const onPointer = (e: PointerEvent) => {\n const target = e.target as Node;\n if (root && !root.contains(target) && !contentRef.current?.contains(target)) close();\n };\n window.addEventListener(\"keydown\", onKey);\n window.addEventListener(\"pointerdown\", onPointer);\n return () => {\n window.removeEventListener(\"keydown\", onKey);\n window.removeEventListener(\"pointerdown\", onPointer);\n };\n }, [open, root, close]);\n\n const ctx = useMemo<MorphContextValue>(\n () => ({\n open,\n setOpen,\n toggle,\n triggerId: `${baseId}-trigger`,\n contentId: `${baseId}-content`,\n triggerRef: anchorRef,\n registerTrigger: setTrigger,\n contentRef,\n }),\n [open, setOpen, toggle, baseId, anchorRef],\n );\n\n return (\n <MorphContext.Provider value={ctx}>\n <div ref={setRoot} className={cn(\"relative inline-flex\", className)}>\n {children}\n </div>\n </MorphContext.Provider>\n );\n}\n\nexport interface MorphPopoverTriggerProps {\n children: ReactElement;\n}\n\nfunction mergeRefs<T>(...refs: Array<Ref<T> | undefined>) {\n return (node: T | null) => {\n for (const ref of refs) {\n if (typeof ref === \"function\") ref(node);\n else if (ref && typeof ref === \"object\")\n (ref as React.MutableRefObject<T | null>).current = node;\n }\n };\n}\n\n/** Wraps a single element, toggling the popover on click. */\nexport function MorphPopoverTrigger({ children }: MorphPopoverTriggerProps) {\n const ctx = useMorphContext(\"MorphPopoverTrigger\");\n const child = children as ReactElement<Record<string, unknown>>;\n const childOnClick = child?.props?.onClick as ((e: unknown) => void) | undefined;\n const childRef = (child?.props as { ref?: Ref<HTMLElement> } | undefined)?.ref;\n // Register once per actual ref change, not once per open-state render.\n const mergedRef = useMemo(\n () => mergeRefs(childRef, ctx.registerTrigger),\n [childRef, ctx.registerTrigger],\n );\n if (!isValidElement(children)) return children;\n\n return cloneElement(child, {\n id: ctx.triggerId,\n ref: mergedRef,\n onClick: (e: unknown) => {\n childOnClick?.(e);\n ctx.toggle();\n },\n \"aria-haspopup\": \"dialog\",\n \"aria-expanded\": ctx.open,\n \"aria-controls\": ctx.open ? ctx.contentId : undefined,\n });\n}\n\nconst originFor = (side: Side, align: Align) =>\n `${side === \"bottom\" ? \"top\" : \"bottom\"} ${align === \"end\" ? \"right\" : \"left\"}`;\n\n// A clip that hides everything but the corner nearest the trigger, so the\n// panel appears to grow out of it. inset(top right bottom left).\nfunction clipAt(side: Side, align: Align, radius: number, inset: number) {\n const top = side === \"bottom\" ? \"0%\" : `${inset}%`;\n const bottom = side === \"bottom\" ? `${inset}%` : \"0%\";\n const right = align === \"end\" ? \"0%\" : `${inset}%`;\n const left = align === \"end\" ? `${inset}%` : \"0%\";\n return `inset(${top} ${right} ${bottom} ${left} round ${radius}px)`;\n}\n\n// Preserve the original spring character on the wrapper, but tween the complex\n// clip-path so it cannot snap when the spring resolves its final distance.\nconst MORPH_CLIP_TRANSITION = { duration: 0.32, ease: EASE_OUT } as const;\n\nexport interface MorphPopoverContentProps {\n children: ReactNode;\n side?: Side;\n align?: Align;\n /** Gap between trigger and panel, in px. Default 8. */\n sideOffset?: number;\n /** Panel corner radius, in px. Default 16. */\n radius?: number;\n className?: string;\n}\n\nexport function MorphPopoverContent(props: MorphPopoverContentProps) {\n const ctx = useMorphContext(\"MorphPopoverContent\");\n const [portalReady, setPortalReady] = useState(false);\n useEffect(() => setPortalReady(true), []);\n if (!portalReady) return null;\n return createPortal(\n <AnimatePresence>{ctx.open && <MorphPopoverSurface {...props} />}</AnimatePresence>,\n document.body,\n );\n}\n\n// Measurement belongs to the mounted portal session: reopening must not start\n// an entrance at the previous session's coordinates before measuring this one.\nfunction MorphPopoverSurface({\n children,\n side = \"bottom\",\n align = \"end\",\n sideOffset = 8,\n radius = 16,\n className,\n}: MorphPopoverContentProps) {\n const ctx = useMorphContext(\"MorphPopoverContent\");\n const reduce = useReducedMotion() ?? false;\n const [isPresent, safeToRemove] = usePresence();\n const layout = usePopoverPortalPosition(ctx.triggerRef, ctx.contentRef, isPresent);\n\n const left = layout\n ? align === \"end\"\n ? layout.trigger.left + layout.trigger.width - layout.content.width\n : layout.trigger.left\n : 0;\n const top = layout\n ? side === \"bottom\"\n ? layout.trigger.top + layout.trigger.height + sideOffset\n : layout.trigger.top - layout.content.height - sideOffset\n : 0;\n\n // Both directions travel between the exact same hidden/show states. Exit\n // targets \"hidden\" directly instead of introducing separate choreography.\n const wrap = reduce\n ? undefined\n : {\n hidden: { scale: 0.96, transition: SPRING_PANEL },\n show: { scale: 1, transition: SPRING_PANEL },\n };\n const clip = reduce\n ? undefined\n : {\n hidden: {\n clipPath: clipAt(side, align, radius, 92),\n transition: MORPH_CLIP_TRANSITION,\n },\n show: {\n clipPath: clipAt(side, align, radius, 0),\n transition: MORPH_CLIP_TRANSITION,\n },\n };\n // Animate the value directly so opacity stays in the inline style throughout\n // the entrance. A native opacity animation can expose the initial inline 0\n // for a frame when it finishes, before Motion writes the final value.\n const opacity = useMotionValue(0);\n const ready = layout !== null;\n useEffect(() => {\n if (!ready) {\n if (!isPresent) safeToRemove?.();\n return;\n }\n const animation = animate(opacity, isPresent ? 1 : 0, {\n ...(reduce ? { duration: 0.12 } : SPRING_PANEL),\n onComplete: () => {\n if (!isPresent) safeToRemove?.();\n },\n });\n return () => animation.stop();\n }, [opacity, ready, isPresent, reduce, safeToRemove]);\n\n return (\n <motion.div\n data-morph-popover-portal=\"\"\n inert={!isPresent}\n // Wrapper carries the shadow as a drop-shadow filter, which hugs the\n // clipped shape below (box-shadow would just get clipped away).\n variants={wrap}\n initial=\"hidden\"\n animate={layout ? \"show\" : \"hidden\"}\n exit=\"hidden\"\n style={{\n left,\n top,\n opacity,\n pointerEvents: isPresent ? \"auto\" : \"none\",\n visibility: layout ? \"visible\" : \"hidden\",\n transformOrigin: originFor(side, align),\n }}\n className=\"filter-[drop-shadow(0_10px_18px_rgba(0,0,0,0.14))] fixed z-9999\"\n >\n <motion.div\n ref={ctx.contentRef}\n id={ctx.contentId}\n role=\"dialog\"\n aria-labelledby={ctx.triggerId}\n variants={clip}\n style={{ borderRadius: radius }}\n className={cn(\"overflow-hidden border border-border bg-background\", className)}\n >\n {children}\n </motion.div>\n </motion.div>\n );\n}\n"],"mappings":";;;;;;;;;AA8CA,MAAM,eAAe,cAAwC,IAAI;AAEjE,SAAS,gBAAgB,WAAmB;CAC1C,MAAM,MAAM,WAAW,YAAY;CACnC,IAAI,CAAC,KAAK,MAAM,IAAI,MAAM,GAAG,UAAU,oCAAoC;CAC3E,OAAO;AACT;;;;;;AAiBA,SAAgB,aAAa,EAC3B,UACA,MAAM,gBACN,cAAc,OACd,cACA,aACoB;CACpB,MAAM,SAAS,MAAM;CACrB,MAAM,CAAC,MAAM,WAAW,SAAgC,IAAI;CAC5D,MAAM,CAAC,SAAS,cAAc,SAA6B,IAAI;CAC/D,MAAM,aAAa,OAA8B,IAAI;CACrD,MAAM,CAAC,cAAc,mBAAmB,SAAS,WAAW;CAC5D,MAAM,aAAa,mBAAmB,KAAA;CACtC,MAAM,OAAO,aAAa,iBAAiB;CAE3C,MAAM,UAAU,aACb,SAAkB;EACjB,IAAI,CAAC,YAAY,gBAAgB,IAAI;EACrC,eAAe,IAAI;CACrB,GACA,CAAC,YAAY,YAAY,CAC3B;CACA,MAAM,SAAS,kBAAkB,QAAQ,CAAC,IAAI,GAAG,CAAC,SAAS,IAAI,CAAC;CAShE,MAAM,YAAY,eACT,EAAE,SAAS,WAAW,KAAK,IAClC,CAAC,MAAM,OAAO,CAChB;CASA,MAAM,QAAQ,kBAAkB;EAC9B,QAAQ,KAAK;EACb,MAAM,UAAU,SAAS;EAEzB,IAAI,EADY,mBAAmB,eAAe,WAAW,SAAS,SAAS,OAAO,IACxE;EAEd,CADgB,YAAY,QAAQ,KAAK,YAAY,IAAI,OAAO,MAAA,EACvD,MAAM;CACjB,GAAG;EAAC;EAAM;EAAS;CAAO,CAAC;CAE3B,gBAAgB;EACd,IAAI,CAAC,MAAM;EACX,MAAM,SAAS,MAAqB,EAAE,QAAQ,YAAY,MAAM;EAChE,MAAM,aAAa,MAAoB;GACrC,MAAM,SAAS,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popover-morph.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n cloneElement,\n createContext,\n isValidElement,\n type ReactElement,\n type ReactNode,\n type Ref,\n useCallback,\n useContext,\n useEffect,\n useId,\n useMemo,\n useRef,\n useState,\n} from \"react\";\nimport {\n AnimatePresence,\n animate,\n motion,\n useMotionValue,\n usePresence,\n useReducedMotion,\n} from \"motion/react\";\nimport { createPortal } from \"react-dom\";\n\nimport { cn } from \"@kumix/utils\";\nimport { EASE_OUT, SPRING_PANEL } from \"../../lib/ease\";\nimport { usePopoverPortalPosition } from \"./popover-position\";\n\ntype Side = \"top\" | \"bottom\";\ntype Align = \"start\" | \"end\";\n\ntype MorphContextValue = {\n open: boolean;\n setOpen: (open: boolean) => void;\n toggle: () => void;\n triggerId: string;\n contentId: string;\n /** The element the panel measures against — see `registerTrigger`. */\n triggerRef: React.MutableRefObject<HTMLElement | null>;\n registerTrigger: (node: HTMLElement | null) => void;\n contentRef: React.MutableRefObject<HTMLDivElement | null>;\n};\n\nconst MorphContext = createContext<MorphContextValue | null>(null);\n\nfunction useMorphContext(component: string) {\n const ctx = useContext(MorphContext);\n if (!ctx) throw new Error(`${component} must be used within <MorphPopover>`);\n return ctx;\n}\n\nexport interface MorphPopoverProps {\n children: ReactNode;\n /** Controlled open state. */\n open?: boolean;\n /** Uncontrolled initial open state. */\n defaultOpen?: boolean;\n onOpenChange?: (open: boolean) => void;\n className?: string;\n}\n\n/**\n * A popover whose panel morphs open from the trigger corner: it's laid out at\n * full size but clipped to the corner nearest the trigger, then unclips as one\n * piece. Closes on outside pointer / Escape. Controlled or uncontrolled.\n */\nexport function MorphPopover({\n children,\n open: controlledOpen,\n defaultOpen = false,\n onOpenChange,\n className,\n}: MorphPopoverProps) {\n const baseId = useId();\n const [root, setRoot] = useState<HTMLDivElement | null>(null);\n const [trigger, setTrigger] = useState<HTMLElement | null>(null);\n const contentRef = useRef<HTMLDivElement | null>(null);\n const [internalOpen, setInternalOpen] = useState(defaultOpen);\n const controlled = controlledOpen !== undefined;\n const open = controlled ? controlledOpen : internalOpen;\n\n const setOpen = useCallback(\n (next: boolean) => {\n if (!controlled) setInternalOpen(next);\n onOpenChange?.(next);\n },\n [controlled, onOpenChange],\n );\n const toggle = useCallback(() => setOpen(!open), [setOpen, open]);\n\n // A trigger normally registers itself through MorphPopoverTrigger. It can't\n // when something else already clones the element — a Tooltip wrapping the\n // button, say — and an unregistered trigger leaves the panel with nothing to\n // measure against, so it renders permanently invisible. The root boxes the\n // trigger exactly (the content portals out of it), so it stands in until a\n // real trigger registers, and stands in again if that one unmounts. Both are\n // state, so a trigger arriving while the panel is open re-anchors it.\n const anchorRef = useMemo<React.MutableRefObject<HTMLElement | null>>(\n () => ({ current: trigger ?? root }),\n [root, trigger],\n );\n\n // The panel is a `role=\"dialog\"` and goes inert the moment it closes, so\n // focus cannot be left sitting inside it: a dismissal hands it back to the\n // trigger, the way the ARIA dialog pattern asks. A pointer dismissal takes\n // the focus onward itself when it lands on something focusable — this only\n // catches the case where it would otherwise be stranded. When no trigger has\n // registered, the root anchor stands in only if it can actually hold focus;\n // there is nowhere better than where the keyboard already is, so leave it.\n const close = useCallback(() => {\n setOpen(false);\n const focused = document.activeElement;\n const inPanel = focused instanceof HTMLElement && contentRef.current?.contains(focused);\n if (!inPanel) return;\n const restore = trigger ?? (root && root.tabIndex >= 0 ? root : null);\n restore?.focus();\n }, [root, setOpen, trigger]);\n\n useEffect(() => {\n if (!open) return;\n const onKey = (e: KeyboardEvent) => e.key === \"Escape\" && close();\n const onPointer = (e: PointerEvent) => {\n const target = e.target as Node;\n if (root && !root.contains(target) && !contentRef.current?.contains(target)) close();\n };\n window.addEventListener(\"keydown\", onKey);\n window.addEventListener(\"pointerdown\", onPointer);\n return () => {\n window.removeEventListener(\"keydown\", onKey);\n window.removeEventListener(\"pointerdown\", onPointer);\n };\n }, [open, root, close]);\n\n const ctx = useMemo<MorphContextValue>(\n () => ({\n open,\n setOpen,\n toggle,\n triggerId: `${baseId}-trigger`,\n contentId: `${baseId}-content`,\n triggerRef: anchorRef,\n registerTrigger: setTrigger,\n contentRef,\n }),\n [open, setOpen, toggle, baseId, anchorRef],\n );\n\n return (\n <MorphContext.Provider value={ctx}>\n <div ref={setRoot} className={cn(\"relative inline-flex\", className)}>\n {children}\n </div>\n </MorphContext.Provider>\n );\n}\n\nexport interface MorphPopoverTriggerProps {\n children: ReactElement;\n}\n\nfunction mergeRefs<T>(...refs: Array<Ref<T> | undefined>) {\n return (node: T | null) => {\n for (const ref of refs) {\n if (typeof ref === \"function\") ref(node);\n else if (ref && typeof ref === \"object\")\n (ref as React.MutableRefObject<T | null>).current = node;\n }\n };\n}\n\n/** Wraps a single element, toggling the popover on click. */\nexport function MorphPopoverTrigger({ children }: MorphPopoverTriggerProps) {\n const ctx = useMorphContext(\"MorphPopoverTrigger\");\n const child = children as ReactElement<Record<string, unknown>>;\n const childOnClick = child?.props?.onClick as ((e: unknown) => void) | undefined;\n const childRef = (child?.props as { ref?: Ref<HTMLElement> } | undefined)?.ref;\n // Register once per actual ref change, not once per open-state render.\n const mergedRef = useMemo(\n () => mergeRefs(childRef, ctx.registerTrigger),\n [childRef, ctx.registerTrigger],\n );\n if (!isValidElement(children)) return children;\n\n return cloneElement(child, {\n id: ctx.triggerId,\n ref: mergedRef,\n onClick: (e: unknown) => {\n childOnClick?.(e);\n ctx.toggle();\n },\n \"aria-haspopup\": \"dialog\",\n \"aria-expanded\": ctx.open,\n \"aria-controls\": ctx.open ? ctx.contentId : undefined,\n });\n}\n\nconst originFor = (side: Side, align: Align) =>\n `${side === \"bottom\" ? \"top\" : \"bottom\"} ${align === \"end\" ? \"right\" : \"left\"}`;\n\n// A clip that hides everything but the corner nearest the trigger, so the\n// panel appears to grow out of it. inset(top right bottom left).\nfunction clipAt(side: Side, align: Align, radius: number, inset: number) {\n const top = side === \"bottom\" ? \"0%\" : `${inset}%`;\n const bottom = side === \"bottom\" ? `${inset}%` : \"0%\";\n const right = align === \"end\" ? \"0%\" : `${inset}%`;\n const left = align === \"end\" ? `${inset}%` : \"0%\";\n return `inset(${top} ${right} ${bottom} ${left} round ${radius}px)`;\n}\n\n// Preserve the original spring character on the wrapper, but tween the complex\n// clip-path so it cannot snap when the spring resolves its final distance.\nconst MORPH_CLIP_TRANSITION = { duration: 0.32, ease: EASE_OUT } as const;\n\nexport interface MorphPopoverContentProps {\n children: ReactNode;\n side?: Side;\n align?: Align;\n /** Gap between trigger and panel, in px. Default 8. */\n sideOffset?: number;\n /** Panel corner radius, in px. Default 16. */\n radius?: number;\n /** Draw the surface shadow. Default true. */\n shadow?: boolean;\n /** Runs after the portalled surface is positioned and visible. */\n onOpenAutoFocus?: (content: HTMLDivElement) => void;\n className?: string;\n}\n\nexport function MorphPopoverContent(props: MorphPopoverContentProps) {\n const ctx = useMorphContext(\"MorphPopoverContent\");\n const [portalReady, setPortalReady] = useState(false);\n useEffect(() => setPortalReady(true), []);\n if (!portalReady) return null;\n return createPortal(\n <AnimatePresence>{ctx.open && <MorphPopoverSurface {...props} />}</AnimatePresence>,\n document.body,\n );\n}\n\n// Measurement belongs to the mounted portal session: reopening must not start\n// an entrance at the previous session's coordinates before measuring this one.\nfunction MorphPopoverSurface({\n children,\n side = \"bottom\",\n align = \"end\",\n sideOffset = 8,\n radius = 16,\n shadow = true,\n onOpenAutoFocus,\n className,\n}: MorphPopoverContentProps) {\n const ctx = useMorphContext(\"MorphPopoverContent\");\n const reduce = useReducedMotion() ?? false;\n const [isPresent, safeToRemove] = usePresence();\n const layout = usePopoverPortalPosition(ctx.triggerRef, ctx.contentRef, isPresent);\n\n const preferredLeft = layout\n ? align === \"end\"\n ? layout.trigger.left + layout.trigger.width - layout.content.width\n : layout.trigger.left\n : 0;\n // Keep larger compositions, such as calendars, inside the viewport. Prefer\n // the requested side, then use the roomier side when it cannot fit there.\n const gutter = 12;\n const below = layout\n ? Math.max(\n 0,\n window.innerHeight - layout.trigger.top - layout.trigger.height - sideOffset - gutter,\n )\n : 0;\n const above = layout ? Math.max(0, layout.trigger.top - sideOffset - gutter) : 0;\n const requestedSpace = side === \"bottom\" ? below : above;\n const otherSpace = side === \"bottom\" ? above : below;\n const resolvedSide =\n layout && layout.content.height > requestedSpace && otherSpace > requestedSpace\n ? side === \"bottom\"\n ? \"top\"\n : \"bottom\"\n : side;\n const availableHeight = resolvedSide === \"bottom\" ? below : above;\n const left = layout\n ? Math.max(gutter, Math.min(preferredLeft, window.innerWidth - layout.content.width - gutter))\n : 0;\n const top = layout\n ? resolvedSide === \"bottom\"\n ? layout.trigger.top + layout.trigger.height + sideOffset\n : Math.max(gutter, layout.trigger.top - layout.content.height - sideOffset)\n : 0;\n\n // Both directions travel between the exact same hidden/show states. Exit\n // targets \"hidden\" directly instead of introducing separate choreography.\n const wrap = reduce\n ? undefined\n : {\n hidden: { scale: 0.96, transition: SPRING_PANEL },\n show: { scale: 1, transition: SPRING_PANEL },\n };\n const clip = reduce\n ? undefined\n : {\n hidden: {\n clipPath: clipAt(resolvedSide, align, radius, 92),\n transition: MORPH_CLIP_TRANSITION,\n },\n show: {\n clipPath: clipAt(resolvedSide, align, radius, 0),\n transition: MORPH_CLIP_TRANSITION,\n },\n };\n // Animate the value directly so opacity stays in the inline style throughout\n // the entrance. A native opacity animation can expose the initial inline 0\n // for a frame when it finishes, before Motion writes the final value.\n const opacity = useMotionValue(0);\n const ready = layout !== null;\n const focusedOnOpen = useRef(false);\n useEffect(() => {\n if (!ready || !isPresent || focusedOnOpen.current || !ctx.contentRef.current) return;\n focusedOnOpen.current = true;\n onOpenAutoFocus?.(ctx.contentRef.current);\n }, [ready, isPresent, ctx.contentRef, onOpenAutoFocus]);\n useEffect(() => {\n if (!ready) {\n if (!isPresent) safeToRemove?.();\n return;\n }\n const animation = animate(opacity, isPresent ? 1 : 0, {\n ...(reduce ? { duration: 0.12 } : SPRING_PANEL),\n onComplete: () => {\n if (!isPresent) safeToRemove?.();\n },\n });\n return () => animation.stop();\n }, [opacity, ready, isPresent, reduce, safeToRemove]);\n\n return (\n <motion.div\n data-morph-popover-portal=\"\"\n inert={!isPresent}\n // Wrapper carries the shadow as a drop-shadow filter, which hugs the\n // clipped shape below (box-shadow would just get clipped away).\n variants={wrap}\n initial=\"hidden\"\n animate={layout ? \"show\" : \"hidden\"}\n exit=\"hidden\"\n style={{\n left,\n top,\n opacity,\n pointerEvents: isPresent ? \"auto\" : \"none\",\n visibility: layout ? \"visible\" : \"hidden\",\n transformOrigin: originFor(resolvedSide, align),\n }}\n className={cn(\"fixed z-9999\", shadow && \"filter-[drop-shadow(0_10px_18px_rgba(0,0,0,0.14))]\")}\n >\n <motion.div\n ref={ctx.contentRef}\n id={ctx.contentId}\n role=\"dialog\"\n aria-labelledby={ctx.triggerId}\n // Own states rather than inherited ones: reopening during the close\n // cancels the exit per element, and only an element that owns its\n // target returns to it. Inherited, the clip stayed at its hidden corner.\n variants={clip}\n initial=\"hidden\"\n animate={layout ? \"show\" : \"hidden\"}\n exit=\"hidden\"\n style={{\n borderRadius: radius,\n maxHeight: layout ? availableHeight : undefined,\n overflowY: \"auto\",\n }}\n className={cn(\"overflow-hidden border border-border bg-background\", className)}\n >\n {children}\n </motion.div>\n </motion.div>\n );\n}\n"],"mappings":";;;;;;;;;AA8CA,MAAM,eAAe,cAAwC,IAAI;AAEjE,SAAS,gBAAgB,WAAmB;CAC1C,MAAM,MAAM,WAAW,YAAY;CACnC,IAAI,CAAC,KAAK,MAAM,IAAI,MAAM,GAAG,UAAU,oCAAoC;CAC3E,OAAO;AACT;;;;;;AAiBA,SAAgB,aAAa,EAC3B,UACA,MAAM,gBACN,cAAc,OACd,cACA,aACoB;CACpB,MAAM,SAAS,MAAM;CACrB,MAAM,CAAC,MAAM,WAAW,SAAgC,IAAI;CAC5D,MAAM,CAAC,SAAS,cAAc,SAA6B,IAAI;CAC/D,MAAM,aAAa,OAA8B,IAAI;CACrD,MAAM,CAAC,cAAc,mBAAmB,SAAS,WAAW;CAC5D,MAAM,aAAa,mBAAmB,KAAA;CACtC,MAAM,OA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DAAoD;EAE5F,UAAA,oBAAC,OAAO,KAAR;GACE,KAAK,IAAI;GACT,IAAI,IAAI;GACR,MAAK;GACL,mBAAiB,IAAI;GAIrB,UAAU;GACV,SAAQ;GACR,SAAS,SAAS,SAAS;GAC3B,MAAK;GACL,OAAO;IACL,cAAc;IACd,WAAW,SAAS,kBAAkB,KAAA;IACtC,WAAW;GACb;GACA,WAAW,GAAG,sDAAsD,SAAS;GAE5E;EACS,CAAA;CACF,CAAA;AAEhB"}
@@ -36,4 +36,5 @@ export interface PopoverContentProps {
36
36
  }
37
37
  export declare function PopoverContent({ children, className }: PopoverContentProps): import("react").ReactPortal | null;
38
38
  //#endregion
39
+ export {};
39
40
  //# sourceMappingURL=popover.d.ts.map
@@ -0,0 +1,37 @@
1
+ import { ReactNode } from "react";
2
+ //#region src/components/motion/prediction-market-card.d.ts
3
+ export interface PredictionMarketCardOutcome {
4
+ id: string;
5
+ label: string;
6
+ /** Probability between 0 and 1. */
7
+ probability: number;
8
+ icon?: ReactNode;
9
+ /** Optional team color for the compact probability line. */
10
+ color?: string;
11
+ }
12
+ export interface PredictionMarketCardSelection {
13
+ outcomeId: string;
14
+ side: "yes" | "no";
15
+ }
16
+ export interface PredictionMarketCardProps {
17
+ title: string;
18
+ icon?: ReactNode;
19
+ category?: string;
20
+ volume: string;
21
+ /** Chronological volume samples for the optional footer sparkline. */
22
+ volumeHistory?: number[];
23
+ /** A scheduled time or live match status. */
24
+ status?: string;
25
+ live?: boolean;
26
+ outcomes: PredictionMarketCardOutcome[];
27
+ /** Called on each outcome CTA click; the card keeps no selected state. */
28
+ onOutcomeClick?: (value: PredictionMarketCardSelection) => void;
29
+ bookmarked?: boolean;
30
+ defaultBookmarked?: boolean;
31
+ onBookmarkChange?: (bookmarked: boolean) => void;
32
+ className?: string;
33
+ }
34
+ /** A listing surface with outcome CTAs and an independent bookmark toggle. */
35
+ export declare function PredictionMarketCard({ title, icon, category, volume, volumeHistory, status, live, outcomes, onOutcomeClick, bookmarked, defaultBookmarked, onBookmarkChange, className }: PredictionMarketCardProps): import("react").JSX.Element;
36
+ //#endregion
37
+ //# sourceMappingURL=prediction-market-card.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prediction-market-card.d.ts","names":[],"sources":["../../../src/components/motion/prediction-market-card.tsx"],"mappings":";;iBAYiB;EACf;EACA;;EAEA;EACA,OAAO;;EAEP;;iBAGe;EACf;EACA;;iBAGe;EACf;EACA,OAAO;EACP;EACA;;EAEA;;EAEA;EACA;EACA,UAAU;;EAEV,kBAAkB,OAAO;EACzB;EACA;EACA,oBAAoB;EACpB;;;wBAQc,uBACd,OACA,MACA,UACA,QACA,eACA,QACA,MACA,UACA,gBACA,YACA,mBACA,kBACA,aACC,4CAAyB,IAAA"}