@kumix/ui 0.4.0 → 0.4.2

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 (402) hide show
  1. package/README.md +52 -45
  2. package/dist/{cascader-types-DVT-znZ-.d.ts → cascader-types-zhnUQ4sP.d.ts} +11 -3
  3. package/dist/cascader-types-zhnUQ4sP.d.ts.map +1 -0
  4. package/dist/components/agents/agent-code.js +1 -1
  5. package/dist/components/agents/approval-card/index.d.ts +2 -0
  6. package/dist/components/agents/approval-card/index.d.ts.map +1 -1
  7. package/dist/components/agents/approval-card/index.js +2 -0
  8. package/dist/components/agents/approval-card/index.js.map +1 -1
  9. package/dist/components/agents/citations.d.ts +14 -2
  10. package/dist/components/agents/citations.d.ts.map +1 -1
  11. package/dist/components/agents/citations.js +11 -7
  12. package/dist/components/agents/citations.js.map +1 -1
  13. package/dist/components/agents/loading-states/reasoning-text.d.ts.map +1 -1
  14. package/dist/components/agents/loading-states/reasoning-text.js +3 -0
  15. package/dist/components/agents/loading-states/reasoning-text.js.map +1 -1
  16. package/dist/components/charts/bump-chart/context.js +1 -2
  17. package/dist/components/charts/bump-chart/plot.js +1 -2
  18. package/dist/components/charts/bump-chart/point.js +1 -1
  19. package/dist/components/charts/bump-chart/series.d.ts +1 -0
  20. package/dist/components/charts/candlestick-chart/context.d.ts +79 -0
  21. package/dist/components/charts/candlestick-chart/context.d.ts.map +1 -0
  22. package/dist/components/charts/candlestick-chart/context.js +69 -0
  23. package/dist/components/charts/candlestick-chart/context.js.map +1 -0
  24. package/dist/components/charts/candlestick-chart/legend.d.ts +12 -0
  25. package/dist/components/charts/candlestick-chart/legend.d.ts.map +1 -0
  26. package/dist/components/charts/candlestick-chart/legend.js +56 -0
  27. package/dist/components/charts/candlestick-chart/legend.js.map +1 -0
  28. package/dist/components/charts/candlestick-chart/plot.d.ts +9 -0
  29. package/dist/components/charts/candlestick-chart/plot.d.ts.map +1 -0
  30. package/dist/components/charts/candlestick-chart/plot.js +218 -0
  31. package/dist/components/charts/candlestick-chart/plot.js.map +1 -0
  32. package/dist/components/charts/candlestick-chart.d.ts +18 -0
  33. package/dist/components/charts/candlestick-chart.d.ts.map +1 -0
  34. package/dist/components/charts/candlestick-chart.js +34 -0
  35. package/dist/components/charts/candlestick-chart.js.map +1 -0
  36. package/dist/components/charts/composition-chart/context.js +1 -2
  37. package/dist/components/charts/composition-chart/plot.js +1 -1
  38. package/dist/components/charts/donut-chart/center.d.ts +16 -0
  39. package/dist/components/charts/donut-chart/center.d.ts.map +1 -0
  40. package/dist/components/charts/donut-chart/center.js +78 -0
  41. package/dist/components/charts/donut-chart/center.js.map +1 -0
  42. package/dist/components/charts/donut-chart/context.d.ts +68 -0
  43. package/dist/components/charts/donut-chart/context.d.ts.map +1 -0
  44. package/dist/components/charts/donut-chart/context.js +2 -0
  45. package/dist/components/charts/donut-chart/legend.d.ts +17 -0
  46. package/dist/components/charts/donut-chart/legend.d.ts.map +1 -0
  47. package/dist/components/charts/donut-chart/legend.js +85 -0
  48. package/dist/components/charts/donut-chart/legend.js.map +1 -0
  49. package/dist/components/charts/donut-chart/plot.d.ts +10 -0
  50. package/dist/components/charts/donut-chart/plot.d.ts.map +1 -0
  51. package/dist/components/charts/donut-chart/plot.js +108 -0
  52. package/dist/components/charts/donut-chart/plot.js.map +1 -0
  53. package/dist/components/charts/donut-chart.d.ts +22 -0
  54. package/dist/components/charts/donut-chart.d.ts.map +1 -0
  55. package/dist/components/charts/donut-chart.js +37 -0
  56. package/dist/components/charts/donut-chart.js.map +1 -0
  57. package/dist/components/charts/funnel-chart.d.ts.map +1 -1
  58. package/dist/components/charts/funnel-chart.js +1 -2
  59. package/dist/components/charts/funnel-chart.js.map +1 -1
  60. package/dist/components/charts/heat-calendar/tooltip.js +1 -1
  61. package/dist/components/charts/liquidity-heatmap.d.ts.map +1 -1
  62. package/dist/components/charts/liquidity-heatmap.js +1 -1
  63. package/dist/components/charts/order-book/depth-row.d.ts +8 -2
  64. package/dist/components/charts/order-book/depth-row.d.ts.map +1 -1
  65. package/dist/components/charts/order-book/depth-row.js +11 -3
  66. package/dist/components/charts/order-book/depth-row.js.map +1 -1
  67. package/dist/components/charts/order-book.d.ts +33 -1
  68. package/dist/components/charts/order-book.d.ts.map +1 -1
  69. package/dist/components/charts/order-book.js +92 -17
  70. package/dist/components/charts/order-book.js.map +1 -1
  71. package/dist/components/charts/price-target-fan/tooltip.js +1 -1
  72. package/dist/components/charts/returns-calendar/tooltip.js +1 -1
  73. package/dist/components/charts/status-bar/tooltip.js +1 -1
  74. package/dist/components/charts/treemap/tooltip.js +1 -1
  75. package/dist/components/charts/treemap.d.ts.map +1 -1
  76. package/dist/components/charts/volume-profile/tooltip.js +1 -1
  77. package/dist/components/charts/volume-profile.d.ts.map +1 -1
  78. package/dist/components/custom/confirm-dialog.d.ts +1 -0
  79. package/dist/components/custom/toast.d.ts +1 -0
  80. package/dist/components/motion/action-swap.d.ts +1 -1
  81. package/dist/components/motion/action-swap.d.ts.map +1 -1
  82. package/dist/components/motion/action-swap.js +46 -20
  83. package/dist/components/motion/action-swap.js.map +1 -1
  84. package/dist/components/motion/animated-badge.d.ts +1 -1
  85. package/dist/components/motion/animated-badge.d.ts.map +1 -1
  86. package/dist/components/motion/animated-badge.js +60 -101
  87. package/dist/components/motion/animated-badge.js.map +1 -1
  88. package/dist/components/motion/animated-sidebar.d.ts +1 -0
  89. package/dist/components/motion/animated-sidebar.js +1 -1
  90. package/dist/components/motion/animated-toast-stack.js +1 -1
  91. package/dist/components/motion/attachment-upload.d.ts.map +1 -1
  92. package/dist/components/motion/attachment-upload.js +2 -3
  93. package/dist/components/motion/attachment-upload.js.map +1 -1
  94. package/dist/components/motion/availability-scheduler/copy-menu.js +1 -2
  95. package/dist/components/motion/availability-scheduler/day-row.js +2 -2
  96. package/dist/components/motion/availability-scheduler/index.js +1 -1
  97. package/dist/components/motion/bloom-menu.d.ts +1 -0
  98. package/dist/components/motion/bloom-menu.d.ts.map +1 -1
  99. package/dist/components/motion/bloom-menu.js +73 -8
  100. package/dist/components/motion/bloom-menu.js.map +1 -1
  101. package/dist/components/motion/bottom-sheet.d.ts.map +1 -1
  102. package/dist/components/motion/bottom-sheet.js +6 -10
  103. package/dist/components/motion/bottom-sheet.js.map +1 -1
  104. package/dist/components/motion/bounce-sidebar.d.ts.map +1 -1
  105. package/dist/components/motion/bounce-sidebar.js +34 -42
  106. package/dist/components/motion/bounce-sidebar.js.map +1 -1
  107. package/dist/components/motion/bouncy-accordion.d.ts.map +1 -1
  108. package/dist/components/motion/bouncy-accordion.js +35 -22
  109. package/dist/components/motion/bouncy-accordion.js.map +1 -1
  110. package/dist/components/motion/button/stateful.d.ts.map +1 -1
  111. package/dist/components/motion/button/stateful.js +3 -0
  112. package/dist/components/motion/button/stateful.js.map +1 -1
  113. package/dist/components/motion/card.d.ts +44 -0
  114. package/dist/components/motion/card.d.ts.map +1 -0
  115. package/dist/components/motion/card.js +122 -0
  116. package/dist/components/motion/card.js.map +1 -0
  117. package/dist/components/motion/center-morph-modal.js +1 -1
  118. package/dist/components/motion/checkbox.d.ts +3 -1
  119. package/dist/components/motion/checkbox.d.ts.map +1 -1
  120. package/dist/components/motion/checkbox.js +18 -6
  121. package/dist/components/motion/checkbox.js.map +1 -1
  122. package/dist/components/motion/color-picker.d.ts +110 -0
  123. package/dist/components/motion/color-picker.d.ts.map +1 -0
  124. package/dist/components/motion/color-picker.js +1053 -0
  125. package/dist/components/motion/color-picker.js.map +1 -0
  126. package/dist/components/motion/color-selector.d.ts.map +1 -1
  127. package/dist/components/motion/color-selector.js +9 -2
  128. package/dist/components/motion/color-selector.js.map +1 -1
  129. package/dist/components/motion/combobox/content.d.ts +1 -0
  130. package/dist/components/motion/command-palette.js +3 -3
  131. package/dist/components/motion/command-palette.js.map +1 -1
  132. package/dist/components/motion/context-menu.d.ts +1 -0
  133. package/dist/components/motion/context-menu.js +1 -1
  134. package/dist/components/motion/date-range-picker.d.ts.map +1 -1
  135. package/dist/components/motion/digit-swap.d.ts +9 -1
  136. package/dist/components/motion/digit-swap.d.ts.map +1 -1
  137. package/dist/components/motion/digit-swap.js +18 -7
  138. package/dist/components/motion/digit-swap.js.map +1 -1
  139. package/dist/components/motion/drawer.d.ts +1 -1
  140. package/dist/components/motion/drawer.d.ts.map +1 -1
  141. package/dist/components/motion/drawer.js +10 -10
  142. package/dist/components/motion/drawer.js.map +1 -1
  143. package/dist/components/motion/expandable-action-bar.d.ts.map +1 -1
  144. package/dist/components/motion/expandable-control.d.ts +1 -0
  145. package/dist/components/motion/feedback-widget.js +4 -1
  146. package/dist/components/motion/feedback-widget.js.map +1 -1
  147. package/dist/components/motion/knockout-wheel.d.ts.map +1 -1
  148. package/dist/components/motion/knockout-wheel.js +1 -2
  149. package/dist/components/motion/knockout-wheel.js.map +1 -1
  150. package/dist/components/motion/morphing-lightbox.d.ts.map +1 -1
  151. package/dist/components/motion/morphing-lightbox.js +1 -1
  152. package/dist/components/motion/morphing-modal.d.ts +6 -1
  153. package/dist/components/motion/morphing-modal.d.ts.map +1 -1
  154. package/dist/components/motion/morphing-modal.js +37 -5
  155. package/dist/components/motion/morphing-modal.js.map +1 -1
  156. package/dist/components/motion/morphing-search-chips.d.ts +54 -0
  157. package/dist/components/motion/morphing-search-chips.d.ts.map +1 -0
  158. package/dist/components/motion/morphing-search-chips.js +599 -0
  159. package/dist/components/motion/morphing-search-chips.js.map +1 -0
  160. package/dist/components/motion/morphing-search.js +1 -1
  161. package/dist/components/motion/morphing-tabs.js +1 -1
  162. package/dist/components/motion/multi-select/content.d.ts +1 -0
  163. package/dist/components/motion/not-found/shared.d.ts +1 -0
  164. package/dist/components/motion/number-ticker.d.ts +6 -1
  165. package/dist/components/motion/number-ticker.d.ts.map +1 -1
  166. package/dist/components/motion/number-ticker.js +19 -9
  167. package/dist/components/motion/number-ticker.js.map +1 -1
  168. package/dist/components/motion/otp-input.js +19 -11
  169. package/dist/components/motion/otp-input.js.map +1 -1
  170. package/dist/components/motion/parallax.js.map +1 -1
  171. package/dist/components/motion/popover-morph.d.ts +5 -3
  172. package/dist/components/motion/popover-morph.d.ts.map +1 -1
  173. package/dist/components/motion/popover-morph.js +47 -52
  174. package/dist/components/motion/popover-morph.js.map +1 -1
  175. package/dist/components/motion/popover.d.ts +1 -0
  176. package/dist/components/motion/popover.js +7 -1
  177. package/dist/components/motion/popover.js.map +1 -1
  178. package/dist/components/motion/prediction-market-card.js +2 -3
  179. package/dist/components/motion/prediction-market-card.js.map +1 -1
  180. package/dist/components/motion/prediction-market.js +1 -1
  181. package/dist/components/motion/project-folder.js +1 -1
  182. package/dist/components/motion/radio.d.ts +8 -2
  183. package/dist/components/motion/radio.d.ts.map +1 -1
  184. package/dist/components/motion/radio.js +70 -10
  185. package/dist/components/motion/radio.js.map +1 -1
  186. package/dist/components/motion/scroll-progress.d.ts +1 -0
  187. package/dist/components/motion/select-morph.d.ts +1 -1
  188. package/dist/components/motion/select-morph.d.ts.map +1 -1
  189. package/dist/components/motion/select-morph.js +89 -21
  190. package/dist/components/motion/select-morph.js.map +1 -1
  191. package/dist/components/motion/select.d.ts.map +1 -1
  192. package/dist/components/motion/select.js +153 -135
  193. package/dist/components/motion/select.js.map +1 -1
  194. package/dist/components/motion/shader-background.d.ts +4 -2
  195. package/dist/components/motion/shader-background.d.ts.map +1 -1
  196. package/dist/components/motion/shader-background.js +9 -3
  197. package/dist/components/motion/shader-background.js.map +1 -1
  198. package/dist/components/motion/shared-layout-bg.d.ts.map +1 -1
  199. package/dist/components/motion/shared-layout-bg.js +17 -3
  200. package/dist/components/motion/shared-layout-bg.js.map +1 -1
  201. package/dist/components/motion/sortable-list.d.ts +1 -0
  202. package/dist/components/motion/sortable-stack.js +1 -2
  203. package/dist/components/motion/swipeable-list.d.ts.map +1 -1
  204. package/dist/components/motion/swipeable-list.js +61 -4
  205. package/dist/components/motion/swipeable-list.js.map +1 -1
  206. package/dist/components/motion/table/row-handle.js +1 -1
  207. package/dist/components/motion/table/table-header.js +1 -1
  208. package/dist/components/motion/tabs.d.ts +13 -3
  209. package/dist/components/motion/tabs.d.ts.map +1 -1
  210. package/dist/components/motion/tabs.js +248 -26
  211. package/dist/components/motion/tabs.js.map +1 -1
  212. package/dist/components/motion/text-reveal.d.ts +1 -0
  213. package/dist/components/motion/theme-toggle.js +1 -1
  214. package/dist/components/motion/tooltip/positioner.d.ts +8 -26
  215. package/dist/components/motion/tooltip/positioner.d.ts.map +1 -1
  216. package/dist/components/motion/tooltip/positioner.js +1 -2
  217. package/dist/components/motion/tooltip.d.ts +62 -20
  218. package/dist/components/motion/tooltip.d.ts.map +1 -1
  219. package/dist/components/motion/tooltip.js +1 -135
  220. package/dist/components/motion/wallet-card/account-avatar.js +1 -2
  221. package/dist/components/reui/alert.d.ts +1 -1
  222. package/dist/components/reui/autocomplete.d.ts.map +1 -1
  223. package/dist/components/reui/autocomplete.js +1 -1
  224. package/dist/components/reui/autocomplete.js.map +1 -1
  225. package/dist/components/reui/badge.d.ts +1 -1
  226. package/dist/components/reui/cascader/cascader-async.d.ts +21 -5
  227. package/dist/components/reui/cascader/cascader-async.d.ts.map +1 -1
  228. package/dist/components/reui/cascader/cascader-async.js +61 -34
  229. package/dist/components/reui/cascader/cascader-async.js.map +1 -1
  230. package/dist/components/reui/cascader/cascader-columns.d.ts.map +1 -1
  231. package/dist/components/reui/cascader/cascader-columns.js +5 -2
  232. package/dist/components/reui/cascader/cascader-columns.js.map +1 -1
  233. package/dist/components/reui/cascader/cascader-context.d.ts +3 -1
  234. package/dist/components/reui/cascader/cascader-context.d.ts.map +1 -1
  235. package/dist/components/reui/cascader/cascader-context.js.map +1 -1
  236. package/dist/components/reui/cascader/cascader-i18n.d.ts +1 -1
  237. package/dist/components/reui/cascader/cascader-item.d.ts +1 -1
  238. package/dist/components/reui/cascader/cascader-lib.d.ts +34 -8
  239. package/dist/components/reui/cascader/cascader-lib.d.ts.map +1 -1
  240. package/dist/components/reui/cascader/cascader-lib.js +145 -29
  241. package/dist/components/reui/cascader/cascader-lib.js.map +1 -1
  242. package/dist/components/reui/cascader/cascader-nav.d.ts +1 -1
  243. package/dist/components/reui/cascader/cascader-types.d.ts +1 -1
  244. package/dist/components/reui/cascader/cascader.d.ts +13 -8
  245. package/dist/components/reui/cascader/cascader.d.ts.map +1 -1
  246. package/dist/components/reui/cascader/cascader.js +31 -16
  247. package/dist/components/reui/cascader/cascader.js.map +1 -1
  248. package/dist/components/reui/code-block/code-block.d.ts.map +1 -1
  249. package/dist/components/reui/color-picker.d.ts +280 -0
  250. package/dist/components/reui/color-picker.d.ts.map +1 -0
  251. package/dist/components/reui/color-picker.js +2013 -0
  252. package/dist/components/reui/color-picker.js.map +1 -0
  253. package/dist/components/reui/data-grid/data-grid-cell-selection.d.ts.map +1 -1
  254. package/dist/components/reui/data-grid/data-grid-cell-selection.js +1 -0
  255. package/dist/components/reui/data-grid/data-grid-cell-selection.js.map +1 -1
  256. package/dist/components/reui/data-grid/data-grid-column-filter.d.ts.map +1 -1
  257. package/dist/components/reui/data-grid/data-grid-column-filter.js +1 -0
  258. package/dist/components/reui/data-grid/data-grid-column-filter.js.map +1 -1
  259. package/dist/components/reui/data-grid/data-grid-column-header.d.ts +6 -8
  260. package/dist/components/reui/data-grid/data-grid-column-header.d.ts.map +1 -1
  261. package/dist/components/reui/data-grid/data-grid-column-header.js +50 -29
  262. package/dist/components/reui/data-grid/data-grid-column-header.js.map +1 -1
  263. package/dist/components/reui/data-grid/data-grid-column-visibility.d.ts.map +1 -1
  264. package/dist/components/reui/data-grid/data-grid-column-visibility.js +1 -0
  265. package/dist/components/reui/data-grid/data-grid-column-visibility.js.map +1 -1
  266. package/dist/components/reui/data-grid/data-grid-pagination.d.ts.map +1 -1
  267. package/dist/components/reui/data-grid/data-grid-pagination.js +2 -1
  268. package/dist/components/reui/data-grid/data-grid-pagination.js.map +1 -1
  269. package/dist/components/reui/data-grid/data-grid-scroll-area.d.ts.map +1 -1
  270. package/dist/components/reui/data-grid/data-grid-scroll-area.js +10 -3
  271. package/dist/components/reui/data-grid/data-grid-scroll-area.js.map +1 -1
  272. package/dist/components/reui/data-grid/data-grid-table-dnd-rows.d.ts.map +1 -1
  273. package/dist/components/reui/data-grid/data-grid-table-dnd-rows.js +15 -10
  274. package/dist/components/reui/data-grid/data-grid-table-dnd-rows.js.map +1 -1
  275. package/dist/components/reui/data-grid/data-grid-table-dnd.d.ts +1 -1
  276. package/dist/components/reui/data-grid/data-grid-table-dnd.d.ts.map +1 -1
  277. package/dist/components/reui/data-grid/data-grid-table-dnd.js +54 -14
  278. package/dist/components/reui/data-grid/data-grid-table-dnd.js.map +1 -1
  279. package/dist/components/reui/data-grid/data-grid-table-virtual.d.ts.map +1 -1
  280. package/dist/components/reui/data-grid/data-grid-table-virtual.js +37 -42
  281. package/dist/components/reui/data-grid/data-grid-table-virtual.js.map +1 -1
  282. package/dist/components/reui/data-grid/data-grid-table.d.ts +174 -16
  283. package/dist/components/reui/data-grid/data-grid-table.d.ts.map +1 -1
  284. package/dist/components/reui/data-grid/data-grid-table.js +223 -89
  285. package/dist/components/reui/data-grid/data-grid-table.js.map +1 -1
  286. package/dist/components/reui/data-grid/data-grid.d.ts +55 -1
  287. package/dist/components/reui/data-grid/data-grid.d.ts.map +1 -1
  288. package/dist/components/reui/data-grid/data-grid.js +112 -22
  289. package/dist/components/reui/data-grid/data-grid.js.map +1 -1
  290. package/dist/components/reui/date-selector.d.ts +1 -0
  291. package/dist/components/reui/date-selector.d.ts.map +1 -1
  292. package/dist/components/reui/date-selector.js +22 -16
  293. package/dist/components/reui/date-selector.js.map +1 -1
  294. package/dist/components/reui/emoji-picker.d.ts +367 -0
  295. package/dist/components/reui/emoji-picker.d.ts.map +1 -0
  296. package/dist/components/reui/emoji-picker.js +1768 -0
  297. package/dist/components/reui/emoji-picker.js.map +1 -0
  298. package/dist/components/reui/event-calendar/event-calendar-agenda-view.js +3 -5
  299. package/dist/components/reui/event-calendar/event-calendar-agenda-view.js.map +1 -1
  300. package/dist/components/reui/event-calendar/event-calendar-i18n.d.ts.map +1 -1
  301. package/dist/components/reui/event-calendar/event-calendar-nav.d.ts.map +1 -1
  302. package/dist/components/reui/event-calendar/event-calendar-nav.js +4 -4
  303. package/dist/components/reui/event-calendar/event-calendar-nav.js.map +1 -1
  304. package/dist/components/reui/event-calendar/event-calendar.d.ts.map +1 -1
  305. package/dist/components/reui/event-calendar/event-calendar.js +34 -31
  306. package/dist/components/reui/event-calendar/event-calendar.js.map +1 -1
  307. package/dist/components/reui/file-type.d.ts +792 -0
  308. package/dist/components/reui/file-type.d.ts.map +1 -0
  309. package/dist/components/reui/file-type.js +1367 -0
  310. package/dist/components/reui/file-type.js.map +1 -0
  311. package/dist/components/reui/filters/filters-advanced.d.ts +1 -0
  312. package/dist/components/reui/filters/filters-advanced.js +1 -1
  313. package/dist/components/reui/filters/filters-advanced.js.map +1 -1
  314. package/dist/components/reui/filters/filters-builder.d.ts +1 -1
  315. package/dist/components/reui/filters/filters-chip.d.ts +5 -1
  316. package/dist/components/reui/filters/filters-chip.d.ts.map +1 -1
  317. package/dist/components/reui/filters/filters-chip.js +1 -1
  318. package/dist/components/reui/filters/filters-lib.d.ts +1 -1
  319. package/dist/components/reui/filters/filters-lib.d.ts.map +1 -1
  320. package/dist/components/reui/frame.d.ts.map +1 -1
  321. package/dist/components/reui/frame.js.map +1 -1
  322. package/dist/components/reui/gantt/gantt-nav.d.ts.map +1 -1
  323. package/dist/components/reui/gantt/gantt-nav.js +4 -4
  324. package/dist/components/reui/gantt/gantt-nav.js.map +1 -1
  325. package/dist/components/reui/gantt/gantt.d.ts.map +1 -1
  326. package/dist/components/reui/gantt/gantt.js +5 -2
  327. package/dist/components/reui/gantt/gantt.js.map +1 -1
  328. package/dist/components/reui/icon-tile.d.ts +1 -1
  329. package/dist/components/reui/icon-tile.js +8 -7
  330. package/dist/components/reui/icon-tile.js.map +1 -1
  331. package/dist/components/reui/kanban.d.ts.map +1 -1
  332. package/dist/components/reui/kanban.js +1 -1
  333. package/dist/components/reui/kanban.js.map +1 -1
  334. package/dist/components/reui/number-field.d.ts.map +1 -1
  335. package/dist/components/reui/number-field.js.map +1 -1
  336. package/dist/components/reui/phone-input.js +30 -27
  337. package/dist/components/reui/phone-input.js.map +1 -1
  338. package/dist/components/reui/scrollspy.d.ts +1 -0
  339. package/dist/components/reui/time-picker.js +1 -1
  340. package/dist/components/reui/time-picker.js.map +1 -1
  341. package/dist/components/ui/attachment.d.ts +1 -1
  342. package/dist/components/ui/button-group.d.ts +1 -1
  343. package/dist/components/ui/button.d.ts +1 -1
  344. package/dist/components/ui/chart.d.ts.map +1 -1
  345. package/dist/components/ui/code-block.d.ts +29 -0
  346. package/dist/components/ui/code-block.d.ts.map +1 -0
  347. package/dist/components/ui/code-block.js +124 -0
  348. package/dist/components/ui/code-block.js.map +1 -0
  349. package/dist/components/ui/command.d.ts.map +1 -1
  350. package/dist/components/ui/direction.js +1 -2
  351. package/dist/components/ui/field.d.ts +1 -1
  352. package/dist/components/ui/field.js +1 -1
  353. package/dist/components/ui/input-group.d.ts +1 -1
  354. package/dist/components/ui/marker.d.ts +1 -1
  355. package/dist/components/ui/message-scroller.d.ts.map +1 -1
  356. package/dist/components/ui/questionnaire.d.ts.map +1 -1
  357. package/dist/components/ui/sidebar.js +1 -1
  358. package/dist/components/ui/trace.d.ts +21 -0
  359. package/dist/components/ui/trace.d.ts.map +1 -0
  360. package/dist/components/ui/trace.js +77 -0
  361. package/dist/components/ui/trace.js.map +1 -0
  362. package/dist/context-BYXeJQnz.d.ts.map +1 -1
  363. package/dist/context-tTdLKYNf.js +99 -0
  364. package/dist/context-tTdLKYNf.js.map +1 -0
  365. package/dist/{copy-menu-C5GaT4Z-.js → copy-menu-DOg9Jh-U.js} +2 -2
  366. package/dist/{copy-menu-C5GaT4Z-.js.map → copy-menu-DOg9Jh-U.js.map} +1 -1
  367. package/dist/hooks/use-copy-to-clipboard.d.ts +1 -0
  368. package/dist/hooks/use-focus-trap.d.ts +22 -0
  369. package/dist/hooks/use-focus-trap.d.ts.map +1 -0
  370. package/dist/hooks/use-focus-trap.js +80 -0
  371. package/dist/hooks/use-focus-trap.js.map +1 -0
  372. package/dist/hooks/use-highlighted-code.d.ts +5 -0
  373. package/dist/hooks/use-highlighted-code.d.ts.map +1 -0
  374. package/dist/hooks/use-highlighted-code.js +128 -0
  375. package/dist/hooks/use-highlighted-code.js.map +1 -0
  376. package/dist/hooks/use-hover-gesture.d.ts +1 -0
  377. package/dist/hooks/use-intersection-observer.d.ts +1 -0
  378. package/dist/hooks/use-listbox.d.ts +29 -0
  379. package/dist/hooks/use-listbox.d.ts.map +1 -0
  380. package/dist/hooks/use-listbox.js +75 -0
  381. package/dist/hooks/use-listbox.js.map +1 -0
  382. package/dist/hooks/use-scroll-position.d.ts +1 -0
  383. package/dist/hooks/use-slider-input.d.ts +1 -0
  384. package/dist/hooks/use-viewport.d.ts +1 -0
  385. package/dist/lib/tick-sound.d.ts +1 -0
  386. package/dist/model-NSIg2p7a.d.ts +20 -0
  387. package/dist/model-NSIg2p7a.d.ts.map +1 -0
  388. package/dist/model-_mRyI6V9.d.ts +18 -0
  389. package/dist/model-_mRyI6V9.d.ts.map +1 -0
  390. package/dist/{positioner-3mCqiebN.js → positioner-3r3cfkqT.js} +97 -33
  391. package/dist/positioner-3r3cfkqT.js.map +1 -0
  392. package/dist/tooltip-Bam5KeYe.js +535 -0
  393. package/dist/tooltip-Bam5KeYe.js.map +1 -0
  394. package/dist/tooltip-C01qUgsW.d.ts.map +1 -1
  395. package/dist/use-position-DOi1gVL0.d.ts +32 -0
  396. package/dist/use-position-DOi1gVL0.d.ts.map +1 -0
  397. package/package.json +11 -11
  398. package/dist/cascader-types-DVT-znZ-.d.ts.map +0 -1
  399. package/dist/components/motion/tooltip.js.map +0 -1
  400. package/dist/model-DfeFradZ.d.ts +0 -9
  401. package/dist/model-DfeFradZ.d.ts.map +0 -1
  402. package/dist/positioner-3mCqiebN.js.map +0 -1
@@ -1,10 +1,10 @@
1
1
  "use client";
2
- import { EASE_OUT, SPRING_PANEL } from "../../lib/ease.js";
2
+ import { EASE_OUT } from "../../lib/ease.js";
3
3
  import { t as usePopoverPortalPosition } from "../../popover-position-BUqYCq8X.js";
4
- import { cloneElement, createContext, isValidElement, useCallback, useContext, useEffect, useId, useMemo, useRef, useState } from "react";
4
+ import { cloneElement, createContext, isValidElement, useCallback, useContext, useEffect, useId, useLayoutEffect, useMemo, useRef, useState } from "react";
5
5
  import { cn } from "@kumix/utils";
6
6
  import { jsx } from "react/jsx-runtime";
7
- import { AnimatePresence, animate, motion, useMotionValue, usePresence, useReducedMotion } from "motion/react";
7
+ import { AnimatePresence, animate, motion, useMotionValue, usePresence, useReducedMotion, useTransform } from "motion/react";
8
8
  import { createPortal } from "react-dom";
9
9
  //#region src/components/motion/popover-morph.tsx
10
10
  const MorphContext = createContext(null);
@@ -14,9 +14,10 @@ function useMorphContext(component) {
14
14
  return ctx;
15
15
  }
16
16
  /**
17
- * A popover whose panel morphs open from the trigger corner: it's laid out at
18
- * full size but clipped to the corner nearest the trigger, then unclips as one
19
- * piece. Closes on outside pointer / Escape. Controlled or uncontrolled.
17
+ * A popover whose full-size panel reveals from the corner nearest the trigger
18
+ * on one spring, then retraces the same clip on close. Content and surface
19
+ * edges keep their size throughout. Closes on outside pointer / Escape.
20
+ * Controlled or uncontrolled.
20
21
  */
21
22
  function MorphPopover({ children, open: controlledOpen, defaultOpen = false, onOpenChange, className }) {
22
23
  const baseId = useId();
@@ -111,16 +112,18 @@ function MorphPopoverTrigger({ children }) {
111
112
  "aria-controls": ctx.open ? ctx.contentId : void 0
112
113
  });
113
114
  }
114
- const originFor = (side, align) => `${side === "bottom" ? "top" : "bottom"} ${align === "end" ? "right" : "left"}`;
115
- function clipAt(side, align, radius, inset) {
116
- const top = side === "bottom" ? "0%" : `${inset}%`;
117
- const bottom = side === "bottom" ? `${inset}%` : "0%";
118
- return `inset(${top} ${align === "end" ? "0%" : `${inset}%`} ${bottom} ${align === "end" ? `${inset}%` : "0%"} round ${radius}px)`;
119
- }
120
- const MORPH_CLIP_TRANSITION = {
121
- duration: .32,
115
+ const MORPH_ENTER = {
116
+ type: "spring",
117
+ duration: .26,
118
+ bounce: 0
119
+ };
120
+ const MORPH_EXIT = {
121
+ duration: .2,
122
122
  ease: EASE_OUT
123
123
  };
124
+ function clipAt(side, align, radius, inset) {
125
+ return `inset(${side === "top" ? inset : 0}% ${align === "start" ? inset : 0}% ${side === "bottom" ? inset : 0}% ${align === "end" ? inset : 0}% round ${radius}px)`;
126
+ }
124
127
  function MorphPopoverContent(props) {
125
128
  const ctx = useMorphContext("MorphPopoverContent");
126
129
  const [portalReady, setPortalReady] = useState(false);
@@ -143,27 +146,10 @@ function MorphPopoverSurface({ children, side = "bottom", align = "end", sideOff
143
146
  const availableHeight = resolvedSide === "bottom" ? below : above;
144
147
  const left = layout ? Math.max(gutter, Math.min(preferredLeft, window.innerWidth - layout.content.width - gutter)) : 0;
145
148
  const top = layout ? resolvedSide === "bottom" ? layout.trigger.top + layout.trigger.height + sideOffset : Math.max(gutter, layout.trigger.top - layout.content.height - sideOffset) : 0;
146
- const wrap = reduce ? void 0 : {
147
- hidden: {
148
- scale: .96,
149
- transition: SPRING_PANEL
150
- },
151
- show: {
152
- scale: 1,
153
- transition: SPRING_PANEL
154
- }
155
- };
156
- const clip = reduce ? void 0 : {
157
- hidden: {
158
- clipPath: clipAt(resolvedSide, align, radius, 92),
159
- transition: MORPH_CLIP_TRANSITION
160
- },
161
- show: {
162
- clipPath: clipAt(resolvedSide, align, radius, 0),
163
- transition: MORPH_CLIP_TRANSITION
164
- }
165
- };
166
- const opacity = useMotionValue(0);
149
+ const progress = useMotionValue(0);
150
+ const clipPath = useTransform(progress, (p) => clipAt(resolvedSide, align, radius, 92 * (1 - p)));
151
+ const surfaceOpacity = useTransform(progress, [0, .15], [0, 1]);
152
+ const fade = useMotionValue(reduce ? 0 : 1);
167
153
  const ready = layout !== null;
168
154
  const focusedOnOpen = useRef(false);
169
155
  useEffect(() => {
@@ -176,39 +162,47 @@ function MorphPopoverSurface({ children, side = "bottom", align = "end", sideOff
176
162
  ctx.contentRef,
177
163
  onOpenAutoFocus
178
164
  ]);
165
+ const safeToRemoveRef = useRef(safeToRemove);
166
+ useLayoutEffect(() => {
167
+ safeToRemoveRef.current = safeToRemove;
168
+ });
179
169
  useEffect(() => {
180
170
  if (!ready) {
181
- if (!isPresent) safeToRemove?.();
171
+ if (!isPresent) safeToRemoveRef.current?.();
182
172
  return;
183
173
  }
184
- const animation = animate(opacity, isPresent ? 1 : 0, {
185
- ...reduce ? { duration: .12 } : SPRING_PANEL,
186
- onComplete: () => {
187
- if (!isPresent) safeToRemove?.();
188
- }
174
+ const settle = () => {
175
+ if (!isPresent) safeToRemoveRef.current?.();
176
+ };
177
+ if (reduce) {
178
+ progress.jump(1);
179
+ const animation = animate(fade, isPresent ? 1 : 0, {
180
+ duration: .12,
181
+ onComplete: settle
182
+ });
183
+ return () => animation.stop();
184
+ }
185
+ const animation = animate(progress, isPresent ? 1 : 0, {
186
+ ...isPresent ? MORPH_ENTER : MORPH_EXIT,
187
+ onComplete: settle
189
188
  });
190
189
  return () => animation.stop();
191
190
  }, [
192
- opacity,
191
+ fade,
192
+ progress,
193
193
  ready,
194
194
  isPresent,
195
- reduce,
196
- safeToRemove
195
+ reduce
197
196
  ]);
198
197
  return /* @__PURE__ */ jsx(motion.div, {
199
198
  "data-morph-popover-portal": "",
200
199
  inert: !isPresent,
201
- variants: wrap,
202
- initial: "hidden",
203
- animate: layout ? "show" : "hidden",
204
- exit: "hidden",
205
200
  style: {
206
201
  left,
207
202
  top,
208
- opacity,
203
+ opacity: reduce ? fade : surfaceOpacity,
209
204
  pointerEvents: isPresent ? "auto" : "none",
210
- visibility: layout ? "visible" : "hidden",
211
- transformOrigin: originFor(resolvedSide, align)
205
+ visibility: layout ? "visible" : "hidden"
212
206
  },
213
207
  className: cn("fixed z-9999", shadow && "filter-[drop-shadow(0_10px_18px_rgba(0,0,0,0.14))]"),
214
208
  children: /* @__PURE__ */ jsx(motion.div, {
@@ -216,10 +210,11 @@ function MorphPopoverSurface({ children, side = "bottom", align = "end", sideOff
216
210
  id: ctx.contentId,
217
211
  role: "dialog",
218
212
  "aria-labelledby": ctx.triggerId,
219
- variants: clip,
220
213
  style: {
214
+ clipPath: reduce ? void 0 : clipPath,
221
215
  borderRadius: radius,
222
216
  maxHeight: layout ? availableHeight : void 0,
217
+ overflowX: "hidden",
223
218
  overflowY: "auto"
224
219
  },
225
220
  className: cn("overflow-hidden border border-border bg-background", className),
@@ -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 /** 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 variants={clip}\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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AEpD,OACE,oBAAC,OAAO,KAAR;EACE,6BAA0B;EAC1B,OAAO,CAAC;EAGR,UAAU;EACV,SAAQ;EACR,SAAS,SAAS,SAAS;EAC3B,MAAK;EACL,OAAO;GACL;GACA;GACA;GACA,eAAe,YAAY,SAAS;GACpC,YAAY,SAAS,YAAY;GACjC,iBAAiB,UAAU,cAAc,KAAK;EAChD;EACA,WAAW,GAAG,gBAAgB,UAAU,oDAAoD;EAE5F,UAAA,oBAAC,OAAO,KAAR;GACE,KAAK,IAAI;GACT,IAAI,IAAI;GACR,MAAK;GACL,mBAAiB,IAAI;GACrB,UAAU;GACV,OAAO;IACL,cAAc;IACd,WAAW,SAAS,kBAAkB,KAAA;IACtC,WAAW;GACb;GACA,WAAW,GAAG,sDAAsD,SAAS;GAE5E;EACS,CAAA;CACF,CAAA;AAEhB"}
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 useLayoutEffect,\n useMemo,\n useRef,\n useState,\n} from \"react\";\nimport {\n AnimatePresence,\n animate,\n motion,\n useMotionValue,\n usePresence,\n useReducedMotion,\n useTransform,\n} from \"motion/react\";\nimport { createPortal } from \"react-dom\";\n\nimport { cn } from \"@kumix/utils\";\nimport { EASE_OUT } 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 full-size panel reveals from the corner nearest the trigger\n * on one spring, then retraces the same clip on close. Content and surface\n * edges keep their size throughout. Closes on outside pointer / Escape.\n * 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\n// Full-distance clip travel needs a shorter curve than SPRING_PANEL's slow\n// overdamped tail. A non-bouncing spring reaches its rest within 260 ms.\nconst MORPH_ENTER = { type: \"spring\", duration: 0.26, bounce: 0 } as const;\nconst MORPH_EXIT = { duration: 0.2, ease: EASE_OUT } as const;\n\n// Keep the panel and content at their final size. An inset clip reveals the\n// nearest corner without scaling borders, shadows or keyboard-focus geometry.\n// A full-size clip keeps content at its final coordinates without box-to-box\n// scale correction. One progress value keeps clip and opacity synchronized;\n// clip-path and the shadow may paint, so this is not a compositor-only morph.\nfunction clipAt(side: Side, align: Align, radius: number, inset: number) {\n return `inset(${side === \"top\" ? inset : 0}% ${align === \"start\" ? inset : 0}% ${side === \"bottom\" ? inset : 0}% ${align === \"end\" ? inset : 0}% round ${radius}px)`;\n}\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 const progress = useMotionValue(0);\n const clipPath = useTransform(progress, (p) => clipAt(resolvedSide, align, radius, 92 * (1 - p)));\n const surfaceOpacity = useTransform(progress, [0, 0.15], [0, 1]);\n // Reduced motion has no travel, so a short fade carries the whole entrance\n // and exit on its own.\n const fade = useMotionValue(reduce ? 0 : 1);\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 // `safeToRemove` is a new function on every render: AnimatePresence\n // rebuilds its context each time its parent renders. Read it through a ref\n // so a render during the exit (a consumer's state change, a list streaming\n // in) does not restart the exit from where it got to — restarted every\n // render, it would close in ever smaller steps and never report completion,\n // leaving an inert, invisible panel mounted for good.\n const safeToRemoveRef = useRef(safeToRemove);\n useLayoutEffect(() => {\n safeToRemoveRef.current = safeToRemove;\n });\n useEffect(() => {\n if (!ready) {\n if (!isPresent) safeToRemoveRef.current?.();\n return;\n }\n const settle = () => {\n if (!isPresent) safeToRemoveRef.current?.();\n };\n if (reduce) {\n progress.jump(1);\n const animation = animate(fade, isPresent ? 1 : 0, {\n duration: 0.12,\n onComplete: settle,\n });\n return () => animation.stop();\n }\n const animation = animate(progress, isPresent ? 1 : 0, {\n ...(isPresent ? MORPH_ENTER : MORPH_EXIT),\n onComplete: settle,\n });\n return () => animation.stop();\n }, [fade, progress, ready, isPresent, reduce]);\n\n return (\n <motion.div\n data-morph-popover-portal=\"\"\n inert={!isPresent}\n style={{\n left,\n top,\n opacity: reduce ? fade : surfaceOpacity,\n pointerEvents: isPresent ? \"auto\" : \"none\",\n visibility: layout ? \"visible\" : \"hidden\",\n }}\n // A drop-shadow follows the clipped surface; box-shadow would be cut\n // off by its own clip. Caller surface classes retain their old target.\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 style={{\n clipPath: reduce ? undefined : clipPath,\n borderRadius: radius,\n maxHeight: layout ? availableHeight : undefined,\n overflowX: \"hidden\",\n overflowY: \"auto\",\n }}\n className={cn(\"overflow-hidden border border-border bg-background\", className)}\n >\n {children}\n </motion.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AAK,CAAC;GACf,MAAM,YAAY,QAAQ,MAAM,YAAY,IAAI,GAAG;IACjD,UAAU;IACV,YAAY;GACd,CAAC;GACD,aAAa,UAAU,KAAK;EAC9B;EACA,MAAM,YAAY,QAAQ,UAAU,YAAY,IAAI,GAAG;GACrD,GAAI,YAAY,cAAc;GAC9B,YAAY;EACd,CAAC;EACD,aAAa,UAAU,KAAK;CAC9B,GAAG;EAAC;EAAM;EAAU;EAAO;EAAW;CAAM,CAAC;CAE7C,OACE,oBAAC,OAAO,KAAR;EACE,6BAA0B;EAC1B,OAAO,CAAC;EACR,OAAO;GACL;GACA;GACA,SAAS,SAAS,OAAO;GACzB,eAAe,YAAY,SAAS;GACpC,YAAY,SAAS,YAAY;EACnC;EAGA,WAAW,GAAG,gBAAgB,UAAU,oDAAoD;EAE5F,UAAA,oBAAC,OAAO,KAAR;GACE,KAAK,IAAI;GACT,IAAI,IAAI;GACR,MAAK;GACL,mBAAiB,IAAI;GACrB,OAAO;IACL,UAAU,SAAS,KAAA,IAAY;IAC/B,cAAc;IACd,WAAW,SAAS,kBAAkB,KAAA;IACtC,WAAW;IACX,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
@@ -293,13 +293,19 @@ function PopoverContent({ children, className }) {
293
293
  render
294
294
  ]);
295
295
  useMotionValueEvent(progress, "change", (p) => render(geoRef.current, p));
296
+ const [closedAtRest, setClosedAtRest] = useState(() => !open && progress.get() === 0);
297
+ if (open && closedAtRest) setClosedAtRest(false);
298
+ const handleAnimationComplete = useCallback(() => {
299
+ if (!open && progress.get() === 0) setClosedAtRest(true);
300
+ }, [open, progress]);
301
+ useMotionValueEvent(progress, "animationComplete", handleAnimationComplete);
296
302
  const hoverHandlers = triggerMode === "hover" ? makeHoverHandlers(panelHover, openHover, scheduleClose) : {};
297
303
  if (!portalReady) return null;
298
304
  return createPortal(/* @__PURE__ */ jsxs("div", {
299
305
  "data-popover-portal": "",
300
306
  className: "pointer-events-none fixed top-0 left-0 isolate z-9999 size-0",
301
307
  style: {
302
- visibility: layout ? "visible" : "hidden",
308
+ visibility: layout && !closedAtRest ? "visible" : "hidden",
303
309
  transform: `translate3d(${layout?.trigger.left ?? 0}px, ${layout?.trigger.top ?? 0}px, 0)`
304
310
  },
305
311
  children: [
@@ -1 +1 @@
1
- {"version":3,"file":"popover.js","names":[],"sources":["../../../src/components/motion/popover.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 useLayoutEffect,\n useMemo,\n useRef,\n useState,\n} from \"react\";\nimport {\n animate,\n type MotionValue,\n useMotionValue,\n useMotionValueEvent,\n useReducedMotion,\n} from \"motion/react\";\nimport { createPortal } from \"react-dom\";\n\nimport { cn } from \"@kumix/utils\";\nimport { useDismiss } from \"../../hooks/use-dismiss\";\nimport { type HoverGesture, useHoverGesture } from \"../../hooks/use-hover-gesture\";\nimport { useTapGesture } from \"../../hooks/use-tap-gesture\";\nimport { usePopoverPortalPosition } from \"./popover-position\";\n\ntype Side = \"top\" | \"bottom\";\ntype Align = \"start\" | \"center\" | \"end\";\ntype TriggerMode = \"click\" | \"hover\";\n\n// This morph needs less bounce than layout motion: too much overshoot makes\n// the liquid neck balloon past the final panel edges.\nconst GOO_OPEN_SPRING = {\n type: \"spring\",\n visualDuration: 0.3,\n bounce: 0.15,\n} as const;\nconst GOO_CLOSE_SPRING = {\n type: \"spring\",\n visualDuration: 0.21,\n bounce: 0.15,\n} as const;\nconst HOVER_CLOSE_DELAY = 120;\nconst CIRCLE_KAPPA = 0.5523;\n\n// `onPointerEnter`/`onPointerLeave` rather than the mouse pair: a tap fires\n// compatibility mouseenter/mouseleave that carry no pointerType at all, and\n// they are what made the panel flicker open and shut under a finger. The\n// gesture pairs the two, so the panel a pen tap opened is not closed again by\n// the boundary event that ends the same tap.\nfunction makeHoverHandlers(hover: HoverGesture, enter: () => void, leave: () => void) {\n return {\n onPointerEnter: (event: React.PointerEvent) => {\n if (hover.enter(event)) enter();\n },\n onPointerLeave: (event: React.PointerEvent) => {\n if (hover.leave(event)) leave();\n },\n };\n}\n\nconst lerp = (a: number, b: number, t: number) => a + (b - a) * t;\n\ninterface Rect {\n x: number;\n y: number;\n w: number;\n h: number;\n r: number;\n}\ninterface Geo {\n layerW: number;\n layerH: number;\n left: number;\n top: number;\n trigger: Rect;\n panel: Rect;\n}\n\n// Trigger rect and panel rect in a shared local coordinate box.\nfunction buildGeo(\n tW: number,\n tH: number,\n cW: number,\n cH: number,\n side: Side,\n align: Align,\n gap: number,\n panelRadius: number,\n): Geo {\n const py = side === \"bottom\" ? tH + gap : -(gap + cH);\n const px = align === \"start\" ? 0 : align === \"end\" ? tW - cW : (tW - cW) / 2;\n\n const left = Math.min(0, px);\n const top = Math.min(0, py);\n const layerW = Math.max(tW, px + cW) - left;\n const layerH = Math.max(tH, py + cH) - top;\n\n const triggerRadius = Math.min(tH / 2, panelRadius);\n\n return {\n layerW,\n layerH,\n left,\n top,\n trigger: { x: -left, y: -top, w: tW, h: tH, r: triggerRadius },\n panel: { x: px - left, y: py - top, w: cW, h: cH, r: panelRadius },\n };\n}\n\nfunction rectAtProgress(geo: Geo, progress: number): Rect {\n const trigger = geo.trigger;\n const panel = geo.panel;\n\n return {\n x: lerp(trigger.x, panel.x, progress),\n y: lerp(trigger.y, panel.y, progress),\n w: lerp(trigger.w, panel.w, progress),\n h: lerp(trigger.h, panel.h, progress),\n r: lerp(trigger.r, panel.r, progress),\n };\n}\n\nfunction insetFor(rect: Rect, layerW: number, layerH: number) {\n const top = rect.y;\n const right = layerW - (rect.x + rect.w);\n const bottom = layerH - (rect.y + rect.h);\n const left = rect.x;\n return `inset(${top}px ${right}px ${bottom}px ${left}px round ${rect.r}px)`;\n}\n\nfunction roundedRectShape(rect: Rect) {\n const radius = Math.max(0, Math.min(rect.r, rect.w / 2, rect.h / 2));\n const control = radius * CIRCLE_KAPPA;\n const x1 = rect.x;\n const y1 = rect.y;\n const x2 = rect.x + rect.w;\n const y2 = rect.y + rect.h;\n const px = (value: number) => `${value.toFixed(3)}px`;\n\n return (\n `shape(from ${px(x1 + radius)} ${px(y1)}, ` +\n `line to ${px(x2 - radius)} ${px(y1)}, ` +\n `curve to ${px(x2)} ${px(y1 + radius)} with ${px(x2 - radius + control)} ${px(y1)} / ${px(x2)} ${px(y1 + radius - control)}, ` +\n `line to ${px(x2)} ${px(y2 - radius)}, ` +\n `curve to ${px(x2 - radius)} ${px(y2)} with ${px(x2)} ${px(y2 - radius + control)} / ${px(x2 - radius + control)} ${px(y2)}, ` +\n `line to ${px(x1 + radius)} ${px(y2)}, ` +\n `curve to ${px(x1)} ${px(y2 - radius)} with ${px(x1 + radius - control)} ${px(y2)} / ${px(x1)} ${px(y2 - radius + control)}, ` +\n `line to ${px(x1)} ${px(y1 + radius)}, ` +\n `curve to ${px(x1 + radius)} ${px(y1)} with ${px(x1)} ${px(y1 + radius - control)} / ${px(x1 + radius - control)} ${px(y1)}, ` +\n \"close)\"\n );\n}\n\nfunction clipForProgress(geo: Geo, progress: number, supportsShape: boolean) {\n const rect = rectAtProgress(geo, progress);\n return supportsShape ? roundedRectShape(rect) : insetFor(rect, geo.layerW, geo.layerH);\n}\n\nfunction roundedRectPath(rect: Rect) {\n const radius = Math.max(0, Math.min(rect.r, rect.w / 2, rect.h / 2));\n const n = (value: number) => value.toFixed(3);\n const x1 = rect.x;\n const y1 = rect.y;\n const x2 = rect.x + rect.w;\n const y2 = rect.y + rect.h;\n const arc = `A${n(radius)} ${n(radius)} 0 0 1`;\n\n // A zero radius makes every arc degenerate to a line, so this also draws\n // plain rectangles.\n return (\n `M${n(x1 + radius)} ${n(y1)}` +\n `H${n(x2 - radius)}${arc} ${n(x2)} ${n(y1 + radius)}` +\n `V${n(y2 - radius)}${arc} ${n(x2 - radius)} ${n(y2)}` +\n `H${n(x1 + radius)}${arc} ${n(x1)} ${n(y2 - radius)}` +\n `V${n(y1 + radius)}${arc} ${n(x1 + radius)} ${n(y1)}Z`\n );\n}\n\n// The goo layer is portalled above the page, so its copy of the trigger pill\n// would cover the real trigger's label and focus ring. Punching the trigger\n// back out keeps the real one visible and clips the blur to the layer box.\n// This is a clip path rather than a CSS mask on purpose: WebKit silently\n// ignores `mask: url(#id)` pointing at an SVG <mask> element, which left the\n// label hidden behind the goo in Safari.\nfunction triggerCutout(geo: Geo) {\n const layer = { x: 0, y: 0, w: geo.layerW, h: geo.layerH, r: 0 };\n return `path(evenodd, \"${roundedRectPath(layer)} ${roundedRectPath(geo.trigger)}\")`;\n}\n\ninterface PopoverContextValue {\n open: boolean;\n setOpen: (open: boolean) => void;\n toggle: () => void;\n openHover: () => void;\n scheduleClose: () => void;\n triggerMode: TriggerMode;\n side: Side;\n align: Align;\n gap: number;\n panelRadius: number;\n gooStrength: number;\n reduce: boolean;\n gooId: string;\n contentId: string;\n progress: MotionValue<number>;\n triggerRef: React.MutableRefObject<HTMLElement | null>;\n contentRef: React.MutableRefObject<HTMLDivElement | null>;\n}\n\nconst PopoverContext = createContext<PopoverContextValue | null>(null);\n\nfunction usePopoverContext(component: string) {\n const ctx = useContext(PopoverContext);\n if (!ctx) throw new Error(`${component} must be used within <Popover>`);\n return ctx;\n}\n\nexport interface PopoverProps {\n children: ReactNode;\n /** Controlled open state. */\n open?: boolean;\n /** Uncontrolled initial open state. */\n defaultOpen?: boolean;\n onOpenChange?: (open: boolean) => void;\n /** How the popover is summoned. Default \"click\". */\n trigger?: TriggerMode;\n /** Which side of the trigger the panel oozes out of. Default \"bottom\". */\n side?: Side;\n /** Alignment along the trigger's edge. Default \"center\". */\n align?: Align;\n /** Gap between trigger and panel, in px — the length of the gooey neck. Default 14. */\n sideOffset?: number;\n /** Corner radius of the open panel, in px. Default 16. */\n panelRadius?: number;\n /** Blur radius feeding the goo filter — higher melts more. Default 8. */\n gooStrength?: number;\n className?: string;\n}\n\nexport function Popover({\n children,\n open: controlledOpen,\n defaultOpen = false,\n onOpenChange,\n trigger = \"click\",\n side = \"bottom\",\n align = \"center\",\n sideOffset = 14,\n panelRadius = 16,\n gooStrength = 8,\n className,\n}: PopoverProps) {\n const reduce = useReducedMotion() ?? false;\n const gooId = useId().replace(/:/g, \"\");\n const contentId = useId();\n const rootRef = useRef<HTMLDivElement>(null);\n const triggerRef = useRef<HTMLElement | null>(null);\n const contentRef = useRef<HTMLDivElement | null>(null);\n const closeTimer = useRef<ReturnType<typeof setTimeout> | null>(null);\n const rootHover = useHoverGesture();\n const progress = useMotionValue(defaultOpen ? 1 : 0);\n\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\n const cancelClose = useCallback(() => {\n if (closeTimer.current) {\n clearTimeout(closeTimer.current);\n closeTimer.current = null;\n }\n }, []);\n\n const openHover = useCallback(() => {\n cancelClose();\n setOpen(true);\n }, [cancelClose, setOpen]);\n\n const scheduleClose = useCallback(() => {\n cancelClose();\n closeTimer.current = setTimeout(() => setOpen(false), HOVER_CLOSE_DELAY);\n }, [cancelClose, setOpen]);\n\n const toggle = useCallback(() => setOpen(!open), [setOpen, open]);\n\n useEffect(() => () => cancelClose(), [cancelClose]);\n\n useEffect(() => {\n const animation = animate(\n progress,\n open ? 1 : 0,\n reduce ? { duration: 0 } : open ? GOO_OPEN_SPRING : GOO_CLOSE_SPRING,\n );\n return () => animation.stop();\n }, [open, progress, reduce]);\n\n // The panel is a `role=\"dialog\"` and goes inert the moment it closes, so\n // focus cannot be left sitting inside it: Escape 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.\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) triggerRef.current?.focus();\n }, [setOpen]);\n // The panel is portalled, so both trees participate in outside detection.\n const ignoreContent = useCallback(\n (target: Element) => Boolean(contentRef.current?.contains(target)),\n [],\n );\n // A hover trigger opens on tap as well now, so it needs the same outside\n // dismissal the click trigger always had. The gesture passes through to\n // whatever it landed on, which is the light-dismiss bargain the platform's\n // own popovers strike.\n useDismiss(open, close, rootRef, { ignore: ignoreContent });\n\n const ctx = useMemo<PopoverContextValue>(\n () => ({\n open,\n setOpen,\n toggle,\n openHover,\n scheduleClose,\n triggerMode: trigger,\n side,\n align,\n gap: sideOffset,\n panelRadius,\n gooStrength,\n reduce,\n gooId,\n contentId,\n progress,\n triggerRef,\n contentRef,\n }),\n [\n open,\n setOpen,\n toggle,\n openHover,\n scheduleClose,\n trigger,\n side,\n align,\n sideOffset,\n panelRadius,\n gooStrength,\n reduce,\n gooId,\n contentId,\n progress,\n ],\n );\n\n const hoverHandlers =\n trigger === \"hover\" ? makeHoverHandlers(rootHover, openHover, scheduleClose) : {};\n\n return (\n <PopoverContext.Provider value={ctx}>\n <div\n ref={rootRef}\n className={cn(\"relative isolate inline-flex\", className)}\n {...hoverHandlers}\n >\n {children}\n </div>\n </PopoverContext.Provider>\n );\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\nexport interface PopoverTriggerProps {\n /** A single focusable element (e.g. a Button) that opens the popover. */\n children: ReactElement;\n}\n\nexport function PopoverTrigger({ children }: PopoverTriggerProps) {\n const ctx = usePopoverContext(\"PopoverTrigger\");\n // What the last gesture on the trigger was, and whether the panel was\n // already open when it started. A click reports neither.\n const tap = useTapGesture<boolean>();\n\n if (!isValidElement(children)) return children;\n\n const child = children as ReactElement<Record<string, unknown>>;\n const childProps = child.props;\n const childRef = (childProps as { ref?: Ref<HTMLElement> }).ref;\n\n const compose =\n <E extends { defaultPrevented?: boolean }>(name: string, handler: (event: E) => void) =>\n (event: E) => {\n (childProps[name] as ((e: unknown) => void) | undefined)?.(event);\n if (!event.defaultPrevented) handler(event);\n };\n\n // Observation, not action. `compose` steps aside for a child that handled\n // the event itself, which is right for anything that *does* something — but\n // a child preventing the pointerdown default (to hold focus, say) has not\n // said the gesture didn't happen. Skipping the record there left the panel\n // reading whatever the gesture before it had put in.\n const observe =\n <E,>(name: string, handler: (event: E) => void) =>\n (event: E) => {\n (childProps[name] as ((e: unknown) => void) | undefined)?.(event);\n handler(event);\n };\n\n // The hover trigger keeps its hover path and *adds* a tap one, rather than\n // swapping mode on a device that reports a touchscreen: a touchscreen laptop\n // has both inputs and the mouse must keep working. A hovering pointer has\n // already opened the panel on its way in, and a keyboard press arrives with\n // no pointerdown behind it, so only a tap toggles here. Which panel state\n // the tap acts on is read from the gesture's start, because a browser that\n // focuses the trigger on contact would otherwise open it mid-gesture and let\n // the click close it again.\n const handlers: Record<string, unknown> =\n ctx.triggerMode === \"hover\"\n ? {\n onFocus: compose(\"onFocus\", ctx.openHover),\n onBlur: compose(\"onBlur\", ctx.scheduleClose),\n onPointerDown: observe<React.PointerEvent>(\"onPointerDown\", (event) =>\n tap.start(event, ctx.open),\n ),\n onPointerCancel: observe(\"onPointerCancel\", tap.drop),\n onKeyDown: observe(\"onKeyDown\", tap.drop),\n onClick: compose(\"onClick\", () => {\n const gesture = tap.take();\n if (!gesture || gesture.pointerType === \"mouse\") return;\n ctx.setOpen(!gesture.state);\n }),\n }\n : { onClick: compose(\"onClick\", ctx.toggle) };\n\n return cloneElement(child, {\n ...handlers,\n ref: mergeRefs(childRef, (node: HTMLElement | null) => {\n ctx.triggerRef.current = node;\n }),\n // Above the goo layer (z-[-1]) so the neck reads behind it.\n className: cn(\"relative z-0\", childProps.className as string | undefined),\n \"aria-haspopup\": \"dialog\",\n \"aria-expanded\": ctx.open,\n \"aria-controls\": ctx.open ? ctx.contentId : undefined,\n \"data-state\": ctx.open ? \"open\" : \"closed\",\n });\n}\n\nconst ALIGN_ORIGIN: Record<Align, string> = {\n start: \"left\",\n center: \"center\",\n end: \"right\",\n};\n\nexport interface PopoverContentProps {\n children: ReactNode;\n className?: string;\n}\n\nexport function PopoverContent({ children, className }: PopoverContentProps) {\n const ctx = usePopoverContext(\"PopoverContent\");\n const [portalReady, setPortalReady] = useState(false);\n const {\n side,\n align,\n gap,\n panelRadius,\n gooStrength,\n reduce,\n gooId,\n contentId,\n progress,\n triggerRef,\n contentRef,\n open,\n triggerMode,\n openHover,\n scheduleClose,\n } = ctx;\n\n const measureRef = contentRef;\n const panelHover = useHoverGesture();\n const blobRef = useRef<HTMLDivElement>(null);\n const clipRef = useRef<HTMLDivElement>(null);\n const geoRef = useRef<Geo | null>(null);\n const supportsShapeRef = useRef(false);\n const layout = usePopoverPortalPosition(triggerRef, measureRef, portalReady);\n\n useEffect(() => setPortalReady(true), []);\n\n const geo = useMemo(\n () =>\n buildGeo(\n layout?.trigger.width ?? 0,\n layout?.trigger.height ?? 0,\n layout?.content.width ?? 0,\n layout?.content.height ?? 0,\n side,\n align,\n gap,\n panelRadius,\n ),\n [layout, side, align, gap, panelRadius],\n );\n\n // Morph the same clip on the goo body and the content, so the whole popover\n // oozes as one and the text reveals with it.\n const render = useCallback((g: Geo | null, p: number) => {\n if (!g || g.layerW === 0) return;\n const clip = clipForProgress(g, p, supportsShapeRef.current);\n if (blobRef.current) blobRef.current.style.clipPath = clip;\n if (clipRef.current) clipRef.current.style.clipPath = clip;\n }, []);\n\n useLayoutEffect(() => {\n supportsShapeRef.current =\n typeof CSS !== \"undefined\" &&\n typeof CSS.supports === \"function\" &&\n CSS.supports(\"clip-path\", \"shape(from 0px 0px, line to 1px 1px, close)\");\n geoRef.current = geo;\n render(geo, progress.get());\n }, [geo, progress, render]);\n\n useMotionValueEvent(progress, \"change\", (p) => render(geoRef.current, p));\n\n const hoverHandlers =\n triggerMode === \"hover\" ? makeHoverHandlers(panelHover, openHover, scheduleClose) : {};\n\n // Match the server and first client render, then attach the portal after\n // hydration. This preserves SSR without regenerating the page on the client.\n if (!portalReady) return null;\n\n return createPortal(\n <div\n data-popover-portal=\"\"\n className=\"pointer-events-none fixed top-0 left-0 isolate z-9999 size-0\"\n style={{\n visibility: layout ? \"visible\" : \"hidden\",\n transform: `translate3d(${layout?.trigger.left ?? 0}px, ${layout?.trigger.top ?? 0}px, 0)`,\n }}\n >\n {/* Goo filter: blur, sharpen the alpha back into solid shapes, then lay\n the crisp original on top so blobs merge with liquid edges. */}\n <svg aria-hidden width=\"0\" height=\"0\" className=\"absolute\">\n <title>Popover visual effects</title>\n <defs>\n <filter id={gooId} x=\"-50%\" y=\"-50%\" width=\"200%\" height=\"200%\">\n <feGaussianBlur in=\"SourceGraphic\" stdDeviation={gooStrength} result=\"blur\" />\n <feColorMatrix\n in=\"blur\"\n mode=\"matrix\"\n values=\"1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 22 -10\"\n result=\"goo\"\n />\n <feComposite in=\"SourceGraphic\" in2=\"goo\" operator=\"atop\" />\n </filter>\n </defs>\n </svg>\n\n {/* Goo body: static trigger pill + morphing blob. */}\n <div\n aria-hidden\n className=\"pointer-events-none absolute z-[-1]\"\n style={{\n left: geo.left,\n top: geo.top,\n width: geo.layerW,\n height: geo.layerH,\n filter: reduce ? undefined : `url(#${gooId})`,\n clipPath: triggerCutout(geo),\n }}\n >\n <div\n className=\"absolute bg-popover\"\n style={{\n left: geo.trigger.x,\n top: geo.trigger.y,\n width: geo.trigger.w,\n height: geo.trigger.h,\n borderRadius: geo.trigger.r,\n }}\n />\n <div\n ref={blobRef}\n className=\"absolute inset-0 bg-popover\"\n style={{\n clipPath: clipForProgress(geo, progress.get(), false),\n }}\n />\n </div>\n\n {/* Content is clipped by the same morph. The portal wrapper stays\n pointer-transparent; only the fully open panel accepts interaction. */}\n <div\n className=\"pointer-events-none absolute z-10\"\n style={{\n left: geo.left,\n top: geo.top,\n width: geo.layerW,\n height: geo.layerH,\n }}\n >\n <div\n ref={clipRef}\n inert={!open}\n className=\"absolute inset-0\"\n style={{\n clipPath: clipForProgress(geo, progress.get(), false),\n pointerEvents: open ? \"auto\" : \"none\",\n }}\n >\n <div\n ref={measureRef}\n id={contentId}\n role=\"dialog\"\n {...hoverHandlers}\n style={{\n position: \"absolute\",\n left: geo.panel.x,\n top: geo.panel.y,\n transformOrigin: `${ALIGN_ORIGIN[align]} ${side === \"bottom\" ? \"top\" : \"bottom\"}`,\n }}\n className={cn(\n \"w-max max-w-[min(92vw,20rem)] p-4 text-popover-foreground outline-none\",\n className,\n )}\n >\n {children}\n </div>\n </div>\n </div>\n </div>,\n document.body,\n );\n}\n"],"mappings":";;;;;;;;;;;AAuCA,MAAM,kBAAkB;CACtB,MAAM;CACN,gBAAgB;CAChB,QAAQ;AACV;AACA,MAAM,mBAAmB;CACvB,MAAM;CACN,gBAAgB;CAChB,QAAQ;AACV;AACA,MAAM,oBAAoB;AAC1B,MAAM,eAAe;AAOrB,SAAS,kBAAkB,OAAqB,OAAmB,OAAmB;CACpF,OAAO;EACL,iBAAiB,UAA8B;GAC7C,IAAI,MAAM,MAAM,KAAK,GAAG,MAAM;EAChC;EACA,iBAAiB,UAA8B;GAC7C,IAAI,MAAM,MAAM,KAAK,GAAG,MAAM;EAChC;CACF;AACF;AAEA,MAAM,QAAQ,GAAW,GAAW,MAAc,KAAK,IAAI,KAAK;AAmBhE,SAAS,SACP,IACA,IACA,IACA,IACA,MACA,OACA,KACA,aACK;CACL,MAAM,KAAK,SAAS,WAAW,KAAK,MAAM,EAAE,MAAM;CAClD,MAAM,KAAK,UAAU,UAA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AAC;KACR,WAAU;KACV,OAAO;MACL,UAAU,gBAAgB,KAAK,SAAS,IAAI,GAAG,KAAK;MACpD,eAAe,OAAO,SAAS;KACjC;KAEA,UAAA,oBAAC,OAAD;MACE,KAAK;MACL,IAAI;MACJ,MAAK;MACL,GAAI;MACJ,OAAO;OACL,UAAU;OACV,MAAM,IAAI,MAAM;OAChB,KAAK,IAAI,MAAM;OACf,iBAAiB,GAAG,aAAa,OAAO,GAAG,SAAS,WAAW,QAAQ;MACzE;MACA,WAAW,GACT,0EACA,SACF;MAEC;KACE,CAAA;IACF,CAAA;GACF,CAAA;EACF;CACL,CAAA,GAAA,SAAS,IACX;AACF"}
1
+ {"version":3,"file":"popover.js","names":[],"sources":["../../../src/components/motion/popover.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 useLayoutEffect,\n useMemo,\n useRef,\n useState,\n} from \"react\";\nimport {\n animate,\n type MotionValue,\n useMotionValue,\n useMotionValueEvent,\n useReducedMotion,\n} from \"motion/react\";\nimport { createPortal } from \"react-dom\";\n\nimport { cn } from \"@kumix/utils\";\nimport { useDismiss } from \"../../hooks/use-dismiss\";\nimport { type HoverGesture, useHoverGesture } from \"../../hooks/use-hover-gesture\";\nimport { useTapGesture } from \"../../hooks/use-tap-gesture\";\nimport { usePopoverPortalPosition } from \"./popover-position\";\n\ntype Side = \"top\" | \"bottom\";\ntype Align = \"start\" | \"center\" | \"end\";\ntype TriggerMode = \"click\" | \"hover\";\n\n// This morph needs less bounce than layout motion: too much overshoot makes\n// the liquid neck balloon past the final panel edges.\nconst GOO_OPEN_SPRING = {\n type: \"spring\",\n visualDuration: 0.3,\n bounce: 0.15,\n} as const;\nconst GOO_CLOSE_SPRING = {\n type: \"spring\",\n visualDuration: 0.21,\n bounce: 0.15,\n} as const;\nconst HOVER_CLOSE_DELAY = 120;\nconst CIRCLE_KAPPA = 0.5523;\n\n// `onPointerEnter`/`onPointerLeave` rather than the mouse pair: a tap fires\n// compatibility mouseenter/mouseleave that carry no pointerType at all, and\n// they are what made the panel flicker open and shut under a finger. The\n// gesture pairs the two, so the panel a pen tap opened is not closed again by\n// the boundary event that ends the same tap.\nfunction makeHoverHandlers(hover: HoverGesture, enter: () => void, leave: () => void) {\n return {\n onPointerEnter: (event: React.PointerEvent) => {\n if (hover.enter(event)) enter();\n },\n onPointerLeave: (event: React.PointerEvent) => {\n if (hover.leave(event)) leave();\n },\n };\n}\n\nconst lerp = (a: number, b: number, t: number) => a + (b - a) * t;\n\ninterface Rect {\n x: number;\n y: number;\n w: number;\n h: number;\n r: number;\n}\ninterface Geo {\n layerW: number;\n layerH: number;\n left: number;\n top: number;\n trigger: Rect;\n panel: Rect;\n}\n\n// Trigger rect and panel rect in a shared local coordinate box.\nfunction buildGeo(\n tW: number,\n tH: number,\n cW: number,\n cH: number,\n side: Side,\n align: Align,\n gap: number,\n panelRadius: number,\n): Geo {\n const py = side === \"bottom\" ? tH + gap : -(gap + cH);\n const px = align === \"start\" ? 0 : align === \"end\" ? tW - cW : (tW - cW) / 2;\n\n const left = Math.min(0, px);\n const top = Math.min(0, py);\n const layerW = Math.max(tW, px + cW) - left;\n const layerH = Math.max(tH, py + cH) - top;\n\n const triggerRadius = Math.min(tH / 2, panelRadius);\n\n return {\n layerW,\n layerH,\n left,\n top,\n trigger: { x: -left, y: -top, w: tW, h: tH, r: triggerRadius },\n panel: { x: px - left, y: py - top, w: cW, h: cH, r: panelRadius },\n };\n}\n\nfunction rectAtProgress(geo: Geo, progress: number): Rect {\n const trigger = geo.trigger;\n const panel = geo.panel;\n\n return {\n x: lerp(trigger.x, panel.x, progress),\n y: lerp(trigger.y, panel.y, progress),\n w: lerp(trigger.w, panel.w, progress),\n h: lerp(trigger.h, panel.h, progress),\n r: lerp(trigger.r, panel.r, progress),\n };\n}\n\nfunction insetFor(rect: Rect, layerW: number, layerH: number) {\n const top = rect.y;\n const right = layerW - (rect.x + rect.w);\n const bottom = layerH - (rect.y + rect.h);\n const left = rect.x;\n return `inset(${top}px ${right}px ${bottom}px ${left}px round ${rect.r}px)`;\n}\n\nfunction roundedRectShape(rect: Rect) {\n const radius = Math.max(0, Math.min(rect.r, rect.w / 2, rect.h / 2));\n const control = radius * CIRCLE_KAPPA;\n const x1 = rect.x;\n const y1 = rect.y;\n const x2 = rect.x + rect.w;\n const y2 = rect.y + rect.h;\n const px = (value: number) => `${value.toFixed(3)}px`;\n\n return (\n `shape(from ${px(x1 + radius)} ${px(y1)}, ` +\n `line to ${px(x2 - radius)} ${px(y1)}, ` +\n `curve to ${px(x2)} ${px(y1 + radius)} with ${px(x2 - radius + control)} ${px(y1)} / ${px(x2)} ${px(y1 + radius - control)}, ` +\n `line to ${px(x2)} ${px(y2 - radius)}, ` +\n `curve to ${px(x2 - radius)} ${px(y2)} with ${px(x2)} ${px(y2 - radius + control)} / ${px(x2 - radius + control)} ${px(y2)}, ` +\n `line to ${px(x1 + radius)} ${px(y2)}, ` +\n `curve to ${px(x1)} ${px(y2 - radius)} with ${px(x1 + radius - control)} ${px(y2)} / ${px(x1)} ${px(y2 - radius + control)}, ` +\n `line to ${px(x1)} ${px(y1 + radius)}, ` +\n `curve to ${px(x1 + radius)} ${px(y1)} with ${px(x1)} ${px(y1 + radius - control)} / ${px(x1 + radius - control)} ${px(y1)}, ` +\n \"close)\"\n );\n}\n\nfunction clipForProgress(geo: Geo, progress: number, supportsShape: boolean) {\n const rect = rectAtProgress(geo, progress);\n return supportsShape ? roundedRectShape(rect) : insetFor(rect, geo.layerW, geo.layerH);\n}\n\nfunction roundedRectPath(rect: Rect) {\n const radius = Math.max(0, Math.min(rect.r, rect.w / 2, rect.h / 2));\n const n = (value: number) => value.toFixed(3);\n const x1 = rect.x;\n const y1 = rect.y;\n const x2 = rect.x + rect.w;\n const y2 = rect.y + rect.h;\n const arc = `A${n(radius)} ${n(radius)} 0 0 1`;\n\n // A zero radius makes every arc degenerate to a line, so this also draws\n // plain rectangles.\n return (\n `M${n(x1 + radius)} ${n(y1)}` +\n `H${n(x2 - radius)}${arc} ${n(x2)} ${n(y1 + radius)}` +\n `V${n(y2 - radius)}${arc} ${n(x2 - radius)} ${n(y2)}` +\n `H${n(x1 + radius)}${arc} ${n(x1)} ${n(y2 - radius)}` +\n `V${n(y1 + radius)}${arc} ${n(x1 + radius)} ${n(y1)}Z`\n );\n}\n\n// The goo layer is portalled above the page, so its copy of the trigger pill\n// would cover the real trigger's label and focus ring. Punching the trigger\n// back out keeps the real one visible and clips the blur to the layer box.\n// This is a clip path rather than a CSS mask on purpose: WebKit silently\n// ignores `mask: url(#id)` pointing at an SVG <mask> element, which left the\n// label hidden behind the goo in Safari.\nfunction triggerCutout(geo: Geo) {\n const layer = { x: 0, y: 0, w: geo.layerW, h: geo.layerH, r: 0 };\n return `path(evenodd, \"${roundedRectPath(layer)} ${roundedRectPath(geo.trigger)}\")`;\n}\n\ninterface PopoverContextValue {\n open: boolean;\n setOpen: (open: boolean) => void;\n toggle: () => void;\n openHover: () => void;\n scheduleClose: () => void;\n triggerMode: TriggerMode;\n side: Side;\n align: Align;\n gap: number;\n panelRadius: number;\n gooStrength: number;\n reduce: boolean;\n gooId: string;\n contentId: string;\n progress: MotionValue<number>;\n triggerRef: React.MutableRefObject<HTMLElement | null>;\n contentRef: React.MutableRefObject<HTMLDivElement | null>;\n}\n\nconst PopoverContext = createContext<PopoverContextValue | null>(null);\n\nfunction usePopoverContext(component: string) {\n const ctx = useContext(PopoverContext);\n if (!ctx) throw new Error(`${component} must be used within <Popover>`);\n return ctx;\n}\n\nexport interface PopoverProps {\n children: ReactNode;\n /** Controlled open state. */\n open?: boolean;\n /** Uncontrolled initial open state. */\n defaultOpen?: boolean;\n onOpenChange?: (open: boolean) => void;\n /** How the popover is summoned. Default \"click\". */\n trigger?: TriggerMode;\n /** Which side of the trigger the panel oozes out of. Default \"bottom\". */\n side?: Side;\n /** Alignment along the trigger's edge. Default \"center\". */\n align?: Align;\n /** Gap between trigger and panel, in px — the length of the gooey neck. Default 14. */\n sideOffset?: number;\n /** Corner radius of the open panel, in px. Default 16. */\n panelRadius?: number;\n /** Blur radius feeding the goo filter — higher melts more. Default 8. */\n gooStrength?: number;\n className?: string;\n}\n\nexport function Popover({\n children,\n open: controlledOpen,\n defaultOpen = false,\n onOpenChange,\n trigger = \"click\",\n side = \"bottom\",\n align = \"center\",\n sideOffset = 14,\n panelRadius = 16,\n gooStrength = 8,\n className,\n}: PopoverProps) {\n const reduce = useReducedMotion() ?? false;\n const gooId = useId().replace(/:/g, \"\");\n const contentId = useId();\n const rootRef = useRef<HTMLDivElement>(null);\n const triggerRef = useRef<HTMLElement | null>(null);\n const contentRef = useRef<HTMLDivElement | null>(null);\n const closeTimer = useRef<ReturnType<typeof setTimeout> | null>(null);\n const rootHover = useHoverGesture();\n const progress = useMotionValue(defaultOpen ? 1 : 0);\n\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\n const cancelClose = useCallback(() => {\n if (closeTimer.current) {\n clearTimeout(closeTimer.current);\n closeTimer.current = null;\n }\n }, []);\n\n const openHover = useCallback(() => {\n cancelClose();\n setOpen(true);\n }, [cancelClose, setOpen]);\n\n const scheduleClose = useCallback(() => {\n cancelClose();\n closeTimer.current = setTimeout(() => setOpen(false), HOVER_CLOSE_DELAY);\n }, [cancelClose, setOpen]);\n\n const toggle = useCallback(() => setOpen(!open), [setOpen, open]);\n\n useEffect(() => () => cancelClose(), [cancelClose]);\n\n useEffect(() => {\n const animation = animate(\n progress,\n open ? 1 : 0,\n reduce ? { duration: 0 } : open ? GOO_OPEN_SPRING : GOO_CLOSE_SPRING,\n );\n return () => animation.stop();\n }, [open, progress, reduce]);\n\n // The panel is a `role=\"dialog\"` and goes inert the moment it closes, so\n // focus cannot be left sitting inside it: Escape 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.\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) triggerRef.current?.focus();\n }, [setOpen]);\n // The panel is portalled, so both trees participate in outside detection.\n const ignoreContent = useCallback(\n (target: Element) => Boolean(contentRef.current?.contains(target)),\n [],\n );\n // A hover trigger opens on tap as well now, so it needs the same outside\n // dismissal the click trigger always had. The gesture passes through to\n // whatever it landed on, which is the light-dismiss bargain the platform's\n // own popovers strike.\n useDismiss(open, close, rootRef, { ignore: ignoreContent });\n\n const ctx = useMemo<PopoverContextValue>(\n () => ({\n open,\n setOpen,\n toggle,\n openHover,\n scheduleClose,\n triggerMode: trigger,\n side,\n align,\n gap: sideOffset,\n panelRadius,\n gooStrength,\n reduce,\n gooId,\n contentId,\n progress,\n triggerRef,\n contentRef,\n }),\n [\n open,\n setOpen,\n toggle,\n openHover,\n scheduleClose,\n trigger,\n side,\n align,\n sideOffset,\n panelRadius,\n gooStrength,\n reduce,\n gooId,\n contentId,\n progress,\n ],\n );\n\n const hoverHandlers =\n trigger === \"hover\" ? makeHoverHandlers(rootHover, openHover, scheduleClose) : {};\n\n return (\n <PopoverContext.Provider value={ctx}>\n <div\n ref={rootRef}\n className={cn(\"relative isolate inline-flex\", className)}\n {...hoverHandlers}\n >\n {children}\n </div>\n </PopoverContext.Provider>\n );\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\nexport interface PopoverTriggerProps {\n /** A single focusable element (e.g. a Button) that opens the popover. */\n children: ReactElement;\n}\n\nexport function PopoverTrigger({ children }: PopoverTriggerProps) {\n const ctx = usePopoverContext(\"PopoverTrigger\");\n // What the last gesture on the trigger was, and whether the panel was\n // already open when it started. A click reports neither.\n const tap = useTapGesture<boolean>();\n\n if (!isValidElement(children)) return children;\n\n const child = children as ReactElement<Record<string, unknown>>;\n const childProps = child.props;\n const childRef = (childProps as { ref?: Ref<HTMLElement> }).ref;\n\n const compose =\n <E extends { defaultPrevented?: boolean }>(name: string, handler: (event: E) => void) =>\n (event: E) => {\n (childProps[name] as ((e: unknown) => void) | undefined)?.(event);\n if (!event.defaultPrevented) handler(event);\n };\n\n // Observation, not action. `compose` steps aside for a child that handled\n // the event itself, which is right for anything that *does* something — but\n // a child preventing the pointerdown default (to hold focus, say) has not\n // said the gesture didn't happen. Skipping the record there left the panel\n // reading whatever the gesture before it had put in.\n const observe =\n <E,>(name: string, handler: (event: E) => void) =>\n (event: E) => {\n (childProps[name] as ((e: unknown) => void) | undefined)?.(event);\n handler(event);\n };\n\n // The hover trigger keeps its hover path and *adds* a tap one, rather than\n // swapping mode on a device that reports a touchscreen: a touchscreen laptop\n // has both inputs and the mouse must keep working. A hovering pointer has\n // already opened the panel on its way in, and a keyboard press arrives with\n // no pointerdown behind it, so only a tap toggles here. Which panel state\n // the tap acts on is read from the gesture's start, because a browser that\n // focuses the trigger on contact would otherwise open it mid-gesture and let\n // the click close it again.\n const handlers: Record<string, unknown> =\n ctx.triggerMode === \"hover\"\n ? {\n onFocus: compose(\"onFocus\", ctx.openHover),\n onBlur: compose(\"onBlur\", ctx.scheduleClose),\n onPointerDown: observe<React.PointerEvent>(\"onPointerDown\", (event) =>\n tap.start(event, ctx.open),\n ),\n onPointerCancel: observe(\"onPointerCancel\", tap.drop),\n onKeyDown: observe(\"onKeyDown\", tap.drop),\n onClick: compose(\"onClick\", () => {\n const gesture = tap.take();\n if (!gesture || gesture.pointerType === \"mouse\") return;\n ctx.setOpen(!gesture.state);\n }),\n }\n : { onClick: compose(\"onClick\", ctx.toggle) };\n\n return cloneElement(child, {\n ...handlers,\n ref: mergeRefs(childRef, (node: HTMLElement | null) => {\n ctx.triggerRef.current = node;\n }),\n // Above the goo layer (z-[-1]) so the neck reads behind it.\n className: cn(\"relative z-0\", childProps.className as string | undefined),\n \"aria-haspopup\": \"dialog\",\n \"aria-expanded\": ctx.open,\n \"aria-controls\": ctx.open ? ctx.contentId : undefined,\n \"data-state\": ctx.open ? \"open\" : \"closed\",\n });\n}\n\nconst ALIGN_ORIGIN: Record<Align, string> = {\n start: \"left\",\n center: \"center\",\n end: \"right\",\n};\n\nexport interface PopoverContentProps {\n children: ReactNode;\n className?: string;\n}\n\nexport function PopoverContent({ children, className }: PopoverContentProps) {\n const ctx = usePopoverContext(\"PopoverContent\");\n const [portalReady, setPortalReady] = useState(false);\n const {\n side,\n align,\n gap,\n panelRadius,\n gooStrength,\n reduce,\n gooId,\n contentId,\n progress,\n triggerRef,\n contentRef,\n open,\n triggerMode,\n openHover,\n scheduleClose,\n } = ctx;\n\n const measureRef = contentRef;\n const panelHover = useHoverGesture();\n const blobRef = useRef<HTMLDivElement>(null);\n const clipRef = useRef<HTMLDivElement>(null);\n const geoRef = useRef<Geo | null>(null);\n const supportsShapeRef = useRef(false);\n const layout = usePopoverPortalPosition(triggerRef, measureRef, portalReady);\n\n useEffect(() => setPortalReady(true), []);\n\n const geo = useMemo(\n () =>\n buildGeo(\n layout?.trigger.width ?? 0,\n layout?.trigger.height ?? 0,\n layout?.content.width ?? 0,\n layout?.content.height ?? 0,\n side,\n align,\n gap,\n panelRadius,\n ),\n [layout, side, align, gap, panelRadius],\n );\n\n // Morph the same clip on the goo body and the content, so the whole popover\n // oozes as one and the text reveals with it.\n const render = useCallback((g: Geo | null, p: number) => {\n if (!g || g.layerW === 0) return;\n const clip = clipForProgress(g, p, supportsShapeRef.current);\n if (blobRef.current) blobRef.current.style.clipPath = clip;\n if (clipRef.current) clipRef.current.style.clipPath = clip;\n }, []);\n\n useLayoutEffect(() => {\n supportsShapeRef.current =\n typeof CSS !== \"undefined\" &&\n typeof CSS.supports === \"function\" &&\n CSS.supports(\"clip-path\", \"shape(from 0px 0px, line to 1px 1px, close)\");\n geoRef.current = geo;\n render(geo, progress.get());\n }, [geo, progress, render]);\n\n useMotionValueEvent(progress, \"change\", (p) => render(geoRef.current, p));\n\n // While closed, the layer still paints its copy of the trigger pill, and the\n // cutout's antialiased edge leaves a faint rim around the real trigger. It\n // matches the page, but shows as hairlines over any dimmed backdrop below\n // the layer. Hide it once the close has settled, and show it again in the\n // render that opens.\n const [closedAtRest, setClosedAtRest] = useState(() => !open && progress.get() === 0);\n if (open && closedAtRest) setClosedAtRest(false);\n const handleAnimationComplete = useCallback(() => {\n if (!open && progress.get() === 0) setClosedAtRest(true);\n }, [open, progress]);\n useMotionValueEvent(progress, \"animationComplete\", handleAnimationComplete);\n\n const hoverHandlers =\n triggerMode === \"hover\" ? makeHoverHandlers(panelHover, openHover, scheduleClose) : {};\n\n // Match the server and first client render, then attach the portal after\n // hydration. This preserves SSR without regenerating the page on the client.\n if (!portalReady) return null;\n\n return createPortal(\n <div\n data-popover-portal=\"\"\n className=\"pointer-events-none fixed top-0 left-0 isolate z-9999 size-0\"\n style={{\n visibility: layout && !closedAtRest ? \"visible\" : \"hidden\",\n transform: `translate3d(${layout?.trigger.left ?? 0}px, ${layout?.trigger.top ?? 0}px, 0)`,\n }}\n >\n {/* Goo filter: blur, sharpen the alpha back into solid shapes, then lay\n the crisp original on top so blobs merge with liquid edges. */}\n <svg aria-hidden width=\"0\" height=\"0\" className=\"absolute\">\n <title>Popover visual effects</title>\n <defs>\n <filter id={gooId} x=\"-50%\" y=\"-50%\" width=\"200%\" height=\"200%\">\n <feGaussianBlur in=\"SourceGraphic\" stdDeviation={gooStrength} result=\"blur\" />\n <feColorMatrix\n in=\"blur\"\n mode=\"matrix\"\n values=\"1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 22 -10\"\n result=\"goo\"\n />\n <feComposite in=\"SourceGraphic\" in2=\"goo\" operator=\"atop\" />\n </filter>\n </defs>\n </svg>\n\n {/* Goo body: static trigger pill + morphing blob. */}\n <div\n aria-hidden\n className=\"pointer-events-none absolute z-[-1]\"\n style={{\n left: geo.left,\n top: geo.top,\n width: geo.layerW,\n height: geo.layerH,\n filter: reduce ? undefined : `url(#${gooId})`,\n clipPath: triggerCutout(geo),\n }}\n >\n <div\n className=\"absolute bg-popover\"\n style={{\n left: geo.trigger.x,\n top: geo.trigger.y,\n width: geo.trigger.w,\n height: geo.trigger.h,\n borderRadius: geo.trigger.r,\n }}\n />\n <div\n ref={blobRef}\n className=\"absolute inset-0 bg-popover\"\n style={{\n clipPath: clipForProgress(geo, progress.get(), false),\n }}\n />\n </div>\n\n {/* Content is clipped by the same morph. The portal wrapper stays\n pointer-transparent; only the fully open panel accepts interaction. */}\n <div\n className=\"pointer-events-none absolute z-10\"\n style={{\n left: geo.left,\n top: geo.top,\n width: geo.layerW,\n height: geo.layerH,\n }}\n >\n <div\n ref={clipRef}\n inert={!open}\n className=\"absolute inset-0\"\n style={{\n clipPath: clipForProgress(geo, progress.get(), false),\n pointerEvents: open ? \"auto\" : \"none\",\n }}\n >\n <div\n ref={measureRef}\n id={contentId}\n role=\"dialog\"\n {...hoverHandlers}\n style={{\n position: \"absolute\",\n left: geo.panel.x,\n top: geo.panel.y,\n transformOrigin: `${ALIGN_ORIGIN[align]} ${side === \"bottom\" ? \"top\" : \"bottom\"}`,\n }}\n className={cn(\n \"w-max max-w-[min(92vw,20rem)] p-4 text-popover-foreground outline-none\",\n className,\n )}\n >\n {children}\n </div>\n </div>\n </div>\n </div>,\n document.body,\n );\n}\n"],"mappings":";;;;;;;;;;;AAuCA,MAAM,kBAAkB;CACtB,MAAM;CACN,gBAAgB;CAChB,QAAQ;AACV;AACA,MAAM,mBAAmB;CACvB,MAAM;CACN,gBAAgB;CAChB,QAAQ;AACV;AACA,MAAM,oBAAoB;AAC1B,MAAM,eAAe;AAOrB,SAAS,kBAAkB,O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qBAAC,OAAD;IACE,eAAA;IACA,WAAU;IACV,OAAO;KACL,MAAM,IAAI;KACV,KAAK,IAAI;KACT,OAAO,IAAI;KACX,QAAQ,IAAI;KACZ,QAAQ,SAAS,KAAA,IAAY,QAAQ,MAAM;KAC3C,UAAU,cAAc,GAAG;IAC7B;IAVF,UAAA,CAYE,oBAAC,OAAD;KACE,WAAU;KACV,OAAO;MACL,MAAM,IAAI,QAAQ;MAClB,KAAK,IAAI,QAAQ;MACjB,OAAO,IAAI,QAAQ;MACnB,QAAQ,IAAI,QAAQ;MACpB,cAAc,IAAI,QAAQ;KAC5B;IACD,CAAA,GACD,oBAAC,OAAD;KACE,KAAK;KACL,WAAU;KACV,OAAO,EACL,UAAU,gBAAgB,KAAK,SAAS,IAAI,GAAG,KAAK,EACtD;IACD,CAAA,CACE;;GAIL,oBAAC,OAAD;IACE,WAAU;IACV,OAAO;KACL,MAAM,IAAI;KACV,KAAK,IAAI;KACT,OAAO,IAAI;KACX,QAAQ,IAAI;IACd;IAEA,UAAA,oBAAC,OAAD;KACE,KAAK;KACL,OAAO,CAAC;KACR,WAAU;KACV,OAAO;MACL,UAAU,gBAAgB,KAAK,SAAS,IAAI,GAAG,KAAK;MACpD,eAAe,OAAO,SAAS;KACjC;KAEA,UAAA,oBAAC,OAAD;MACE,KAAK;MACL,IAAI;MACJ,MAAK;MACL,GAAI;MACJ,OAAO;OACL,UAAU;OACV,MAAM,IAAI,MAAM;OAChB,KAAK,IAAI,MAAM;OACf,iBAAiB,GAAG,aAAa,OAAO,GAAG,SAAS,WAAW,QAAQ;MACzE;MACA,WAAW,GACT,0EACA,SACF;MAEC;KACE,CAAA;IACF,CAAA;GACF,CAAA;EACF;CACL,CAAA,GAAA,SAAS,IACX;AACF"}
@@ -1,8 +1,8 @@
1
1
  "use client";
2
2
  import { useHoverCapable } from "../../hooks/use-hover-capable.js";
3
3
  import { EASE_OUT, SPRING_PRESS } from "../../lib/ease.js";
4
+ import { t as Tooltip } from "../../tooltip-Bam5KeYe.js";
4
5
  import { ActionSwapText } from "./action-swap.js";
5
- import { Tooltip } from "./tooltip.js";
6
6
  import { useId, useState } from "react";
7
7
  import { cn } from "@kumix/utils";
8
8
  import { jsx, jsxs } from "react/jsx-runtime";
@@ -76,12 +76,11 @@ function PredictionMarketCard({ title, icon, category, volume, volumeHistory, st
76
76
  }),
77
77
  /* @__PURE__ */ jsx(Tooltip, {
78
78
  content: "Potential payout per $1 if this outcome wins, including your stake. Before fees; based on the displayed price.",
79
- wrapperClassName: "shrink-0",
80
79
  className: "w-44 whitespace-normal text-center leading-relaxed",
81
80
  children: /* @__PURE__ */ jsx("button", {
82
81
  type: "button",
83
82
  "aria-label": `Potential payout for ${outcome.label}`,
84
- className: "rounded-md py-2 text-muted-foreground text-sm tabular-nums focus-visible:outline-2 focus-visible:outline-ring",
83
+ className: "shrink-0 rounded-md py-2 text-muted-foreground text-sm tabular-nums focus-visible:outline-2 focus-visible:outline-ring",
85
84
  children: probability(outcome.probability) > 0 ? `${(1 / probability(outcome.probability)).toFixed(1)}×` : "—"
86
85
  })
87
86
  }),
@@ -1 +1 @@
1
- {"version":3,"file":"prediction-market-card.js","names":[],"sources":["../../../src/components/motion/prediction-market-card.tsx"],"sourcesContent":["\"use client\";\n\nimport { type ReactNode, useId, useState } from \"react\";\nimport { Bookmark } from \"lucide-react\";\nimport { motion, useReducedMotion } from \"motion/react\";\n\nimport { cn } from \"@kumix/utils\";\nimport { useHoverCapable } from \"../../hooks/use-hover-capable\";\nimport { EASE_OUT, SPRING_PRESS } from \"../../lib/ease\";\nimport { ActionSwapText } from \"./action-swap\";\nimport { Tooltip } from \"./tooltip\";\n\nexport interface PredictionMarketCardOutcome {\n id: string;\n label: string;\n /** Probability between 0 and 1. */\n probability: number;\n icon?: ReactNode;\n /** Optional team color for the compact probability line. */\n color?: string;\n}\n\nexport interface PredictionMarketCardSelection {\n outcomeId: string;\n side: \"yes\" | \"no\";\n}\n\nexport interface PredictionMarketCardProps {\n title: string;\n icon?: ReactNode;\n category?: string;\n volume: string;\n /** Chronological volume samples for the optional footer sparkline. */\n volumeHistory?: number[];\n /** A scheduled time or live match status. */\n status?: string;\n live?: boolean;\n outcomes: PredictionMarketCardOutcome[];\n /** Called on each outcome CTA click; the card keeps no selected state. */\n onOutcomeClick?: (value: PredictionMarketCardSelection) => void;\n bookmarked?: boolean;\n defaultBookmarked?: boolean;\n onBookmarkChange?: (bookmarked: boolean) => void;\n className?: string;\n}\n\nfunction probability(value: number) {\n return Number.isFinite(value) ? Math.max(0, Math.min(1, value)) : 0;\n}\n\n/** A listing surface with outcome CTAs and an independent bookmark toggle. */\nexport function PredictionMarketCard({\n title,\n icon,\n category,\n volume,\n volumeHistory,\n status,\n live = false,\n outcomes,\n onOutcomeClick,\n bookmarked,\n defaultBookmarked = false,\n onBookmarkChange,\n className,\n}: PredictionMarketCardProps) {\n const titleId = useId();\n const chartId = useId();\n const samples = volumeHistory?.filter(Number.isFinite) ?? [];\n const low = Math.min(...samples);\n const range = Math.max(...samples) - low;\n const chartPoints =\n samples.length > 1\n ? samples\n .map(\n (sample, index) =>\n `${2 + (index / (samples.length - 1)) * 44},${18 - (range ? (sample - low) / range : 0.5) * 14}`,\n )\n .join(\" \")\n : null;\n const reduce = useReducedMotion();\n const [internalBookmark, setInternalBookmark] = useState(defaultBookmarked);\n const saved = bookmarked ?? internalBookmark;\n\n return (\n <article\n aria-labelledby={titleId}\n className={cn(\n \"flex h-full w-full min-w-0 flex-col overflow-hidden rounded-3xl bg-card text-foreground\",\n className,\n )}\n >\n <header className=\"flex shrink-0 items-center gap-3 px-4 py-3\">\n {icon && (\n <div\n aria-hidden\n className=\"flex size-12 shrink-0 items-center justify-center overflow-hidden rounded-full border border-border bg-background text-foreground\"\n >\n {icon}\n </div>\n )}\n <div className=\"min-w-0 flex-1\">\n <h3\n id={titleId}\n className=\"wrap-break-word font-display font-medium text-base leading-snug tracking-tight\"\n >\n {title}\n </h3>\n <p className=\"mt-1 flex flex-wrap items-center gap-1.5 text-muted-foreground text-xs\">\n {status && (\n <span className={cn(\"inline-flex items-center gap-1.5\", live && \"text-rose-500\")}>\n {live && <span aria-hidden className=\"size-1.5 rounded-full bg-current\" />}\n {status}\n </span>\n )}\n {status && category && <span aria-hidden>·</span>}\n {category && <span>{category}</span>}\n </p>\n </div>\n </header>\n\n <div className=\"mx-2 mb-2 flex flex-1 flex-col rounded-3xl bg-background px-4 py-3\">\n <div className=\"flex flex-1 flex-col justify-center gap-3\">\n {outcomes.map((outcome, index) => (\n <div key={outcome.id} className=\"space-y-1\">\n <div className=\"flex min-h-10 items-center gap-2\">\n {outcome.icon && (\n <span\n aria-hidden\n className=\"flex size-8 shrink-0 items-center justify-center overflow-hidden rounded-full bg-muted\"\n >\n {outcome.icon}\n </span>\n )}\n <span className=\"wrap-break-word min-w-0 flex-1 font-medium text-sm\">\n {outcome.label}\n </span>\n <Tooltip\n content=\"Potential payout per $1 if this outcome wins, including your stake. Before fees; based on the displayed price.\"\n wrapperClassName=\"shrink-0\"\n className=\"w-44 whitespace-normal text-center leading-relaxed\"\n >\n <button\n type=\"button\"\n aria-label={`Potential payout for ${outcome.label}`}\n className=\"rounded-md py-2 text-muted-foreground text-sm tabular-nums focus-visible:outline-2 focus-visible:outline-ring\"\n >\n {probability(outcome.probability) > 0\n ? `${(1 / probability(outcome.probability)).toFixed(1)}×`\n : \"—\"}\n </button>\n </Tooltip>\n <MarketOddsButton\n positive={index % 2 === 0}\n outcome={outcome}\n onClick={() => onOutcomeClick?.({ outcomeId: outcome.id, side: \"yes\" })}\n />\n </div>\n <div aria-hidden className=\"h-0.5 w-24 overflow-hidden rounded-full\">\n <motion.div\n initial={false}\n animate={{ scaleX: probability(outcome.probability) }}\n transition={reduce ? { duration: 0 } : { duration: 0.25, ease: EASE_OUT }}\n className=\"h-full origin-left rounded-full bg-emerald-300/70 dark:bg-emerald-400/40\"\n style={outcome.color ? { backgroundColor: outcome.color } : undefined}\n />\n </div>\n </div>\n ))}\n </div>\n\n <footer className=\"mt-2 flex shrink-0 items-center gap-2 text-muted-foreground text-xs\">\n {chartPoints && (\n <svg\n aria-hidden=\"true\"\n viewBox=\"0 0 48 22\"\n className=\"h-5 w-12 shrink-0 text-emerald-500 dark:text-emerald-400\"\n fill=\"none\"\n >\n <defs>\n <linearGradient id={chartId} x1=\"0\" y1=\"0\" x2=\"0\" y2=\"1\">\n <stop offset=\"0%\" stopColor=\"currentColor\" stopOpacity=\"0.22\" />\n <stop offset=\"100%\" stopColor=\"currentColor\" stopOpacity=\"0\" />\n </linearGradient>\n </defs>\n <polygon points={`2,22 ${chartPoints} 46,22`} fill={`url(#${chartId})`} />\n <polyline\n points={chartPoints}\n stroke=\"currentColor\"\n strokeWidth=\"1.75\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n />\n </svg>\n )}\n <span className=\"shrink-0\">{volume} vol.</span>\n <motion.button\n type=\"button\"\n aria-label={`Bookmark ${title}`}\n aria-pressed={saved}\n onClick={() => {\n if (bookmarked === undefined) setInternalBookmark(!saved);\n onBookmarkChange?.(!saved);\n }}\n whileTap={reduce ? undefined : { scale: 0.85 }}\n transition={SPRING_PRESS}\n className={cn(\n \"ml-auto flex size-9 shrink-0 items-center justify-center rounded-xl transition-colors hover:bg-muted focus-visible:outline-2 focus-visible:outline-ring\",\n saved && \"text-foreground\",\n )}\n >\n <motion.span\n animate={{ scale: saved && !reduce ? [1, 1.2, 1] : 1 }}\n transition={{ duration: 0.22, ease: EASE_OUT }}\n >\n <Bookmark aria-hidden className={cn(\"size-4\", saved && \"fill-current\")} />\n </motion.span>\n </motion.button>\n </footer>\n </div>\n </article>\n );\n}\n\nfunction MarketOddsButton({\n positive,\n outcome,\n onClick,\n}: {\n outcome: PredictionMarketCardOutcome;\n positive: boolean;\n onClick: () => void;\n}) {\n const reduce = useReducedMotion();\n const cents = Math.round(probability(outcome.probability) * 100);\n const canHover = useHoverCapable();\n const [hovered, setHovered] = useState(false);\n const [focused, setFocused] = useState(false);\n const showAction = (canHover && hovered) || focused;\n return (\n <motion.button\n type=\"button\"\n aria-label={`Trade ${outcome.label} at ${cents}%`}\n onClick={onClick}\n onPointerEnter={(event) => {\n if (event.pointerType !== \"touch\") setHovered(true);\n }}\n onPointerLeave={() => setHovered(false)}\n onFocus={(event) => setFocused(event.currentTarget.matches(\":focus-visible\"))}\n onBlur={() => setFocused(false)}\n whileTap={reduce ? undefined : { scale: 0.96 }}\n transition={SPRING_PRESS}\n className={cn(\n \"relative flex min-h-10 min-w-16 shrink-0 items-center justify-center overflow-hidden rounded-xl border border-border bg-background px-3 font-semibold text-foreground text-sm shadow-[0_3px_0] transition-colors hover:bg-muted focus-visible:outline-2 focus-visible:outline-ring focus-visible:outline-offset-2\",\n positive &&\n \"border-emerald-500/25 bg-emerald-500/10 text-emerald-700 shadow-emerald-500/20 hover:bg-emerald-500/15 dark:text-emerald-400\",\n !positive &&\n \"border-rose-500/25 bg-rose-500/10 text-rose-700 shadow-rose-500/20 hover:bg-rose-500/15 dark:text-rose-400\",\n )}\n >\n <ActionSwapText value={showAction ? \"action\" : String(cents)} animation=\"roll\">\n {showAction ? (positive ? \"Yes\" : \"No\") : `${cents}%`}\n </ActionSwapText>\n </motion.button>\n );\n}\n"],"mappings":";;;;;;;;;;;AA8CA,SAAS,YAAY,OAAe;CAClC,OAAO,OAAO,SAAS,KAAK,IAAI,KAAK,IAAI,GAAG,KAAK,IAAI,GAAG,KAAK,CAAC,IAAI;AACpE;;AAGA,SAAgB,qBAAqB,EACnC,OACA,MACA,UACA,QACA,eACA,QACA,OAAO,OACP,UACA,gBACA,YACA,oBAAoB,OACpB,kBACA,aAC4B;CAC5B,MAAM,UAAU,MAAM;CACtB,MAAM,UAAU,MAAM;CACtB,MAAM,UAAU,eAAe,OAAO,OAAO,QAAQ,KAAK,CAAC;CAC3D,MAAM,MAAM,KAAK,IAAI,GAAG,OAAO;CAC/B,MAAM,QAAQ,KAAK,IAAI,GAAG,OAAO,IAAI;CACrC,MAAM,cACJ,QAA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,WAAW,MAAM,cAAc,QAAQ,gBAAgB,CAAC;EAC5E,cAAc,WAAW,KAAK;EAC9B,UAAU,SAAS,KAAA,IAAY,EAAE,OAAO,IAAK;EAC7C,YAAY;EACZ,WAAW,GACT,qTACA,YACE,gIACF,CAAC,YACC,4GACJ;EAEA,UAAA,oBAAC,gBAAD;GAAgB,OAAO,aAAa,WAAW,OAAO,KAAK;GAAG,WAAU;GACrE,UAAA,aAAc,WAAW,QAAQ,OAAQ,GAAG,MAAM;EACrC,CAAA;CACH,CAAA;AAEnB"}
1
+ {"version":3,"file":"prediction-market-card.js","names":[],"sources":["../../../src/components/motion/prediction-market-card.tsx"],"sourcesContent":["\"use client\";\n\nimport { type ReactNode, useId, useState } from \"react\";\nimport { Bookmark } from \"lucide-react\";\nimport { motion, useReducedMotion } from \"motion/react\";\n\nimport { cn } from \"@kumix/utils\";\nimport { useHoverCapable } from \"../../hooks/use-hover-capable\";\nimport { EASE_OUT, SPRING_PRESS } from \"../../lib/ease\";\nimport { ActionSwapText } from \"./action-swap\";\nimport { Tooltip } from \"./tooltip\";\n\nexport interface PredictionMarketCardOutcome {\n id: string;\n label: string;\n /** Probability between 0 and 1. */\n probability: number;\n icon?: ReactNode;\n /** Optional team color for the compact probability line. */\n color?: string;\n}\n\nexport interface PredictionMarketCardSelection {\n outcomeId: string;\n side: \"yes\" | \"no\";\n}\n\nexport interface PredictionMarketCardProps {\n title: string;\n icon?: ReactNode;\n category?: string;\n volume: string;\n /** Chronological volume samples for the optional footer sparkline. */\n volumeHistory?: number[];\n /** A scheduled time or live match status. */\n status?: string;\n live?: boolean;\n outcomes: PredictionMarketCardOutcome[];\n /** Called on each outcome CTA click; the card keeps no selected state. */\n onOutcomeClick?: (value: PredictionMarketCardSelection) => void;\n bookmarked?: boolean;\n defaultBookmarked?: boolean;\n onBookmarkChange?: (bookmarked: boolean) => void;\n className?: string;\n}\n\nfunction probability(value: number) {\n return Number.isFinite(value) ? Math.max(0, Math.min(1, value)) : 0;\n}\n\n/** A listing surface with outcome CTAs and an independent bookmark toggle. */\nexport function PredictionMarketCard({\n title,\n icon,\n category,\n volume,\n volumeHistory,\n status,\n live = false,\n outcomes,\n onOutcomeClick,\n bookmarked,\n defaultBookmarked = false,\n onBookmarkChange,\n className,\n}: PredictionMarketCardProps) {\n const titleId = useId();\n const chartId = useId();\n const samples = volumeHistory?.filter(Number.isFinite) ?? [];\n const low = Math.min(...samples);\n const range = Math.max(...samples) - low;\n const chartPoints =\n samples.length > 1\n ? samples\n .map(\n (sample, index) =>\n `${2 + (index / (samples.length - 1)) * 44},${18 - (range ? (sample - low) / range : 0.5) * 14}`,\n )\n .join(\" \")\n : null;\n const reduce = useReducedMotion();\n const [internalBookmark, setInternalBookmark] = useState(defaultBookmarked);\n const saved = bookmarked ?? internalBookmark;\n\n return (\n <article\n aria-labelledby={titleId}\n className={cn(\n \"flex h-full w-full min-w-0 flex-col overflow-hidden rounded-3xl bg-card text-foreground\",\n className,\n )}\n >\n <header className=\"flex shrink-0 items-center gap-3 px-4 py-3\">\n {icon && (\n <div\n aria-hidden\n className=\"flex size-12 shrink-0 items-center justify-center overflow-hidden rounded-full border border-border bg-background text-foreground\"\n >\n {icon}\n </div>\n )}\n <div className=\"min-w-0 flex-1\">\n <h3\n id={titleId}\n className=\"wrap-break-word font-display font-medium text-base leading-snug tracking-tight\"\n >\n {title}\n </h3>\n <p className=\"mt-1 flex flex-wrap items-center gap-1.5 text-muted-foreground text-xs\">\n {status && (\n <span className={cn(\"inline-flex items-center gap-1.5\", live && \"text-rose-500\")}>\n {live && <span aria-hidden className=\"size-1.5 rounded-full bg-current\" />}\n {status}\n </span>\n )}\n {status && category && <span aria-hidden>·</span>}\n {category && <span>{category}</span>}\n </p>\n </div>\n </header>\n\n <div className=\"mx-2 mb-2 flex flex-1 flex-col rounded-3xl bg-background px-4 py-3\">\n <div className=\"flex flex-1 flex-col justify-center gap-3\">\n {outcomes.map((outcome, index) => (\n <div key={outcome.id} className=\"space-y-1\">\n <div className=\"flex min-h-10 items-center gap-2\">\n {outcome.icon && (\n <span\n aria-hidden\n className=\"flex size-8 shrink-0 items-center justify-center overflow-hidden rounded-full bg-muted\"\n >\n {outcome.icon}\n </span>\n )}\n <span className=\"wrap-break-word min-w-0 flex-1 font-medium text-sm\">\n {outcome.label}\n </span>\n <Tooltip\n content=\"Potential payout per $1 if this outcome wins, including your stake. Before fees; based on the displayed price.\"\n className=\"w-44 whitespace-normal text-center leading-relaxed\"\n >\n <button\n type=\"button\"\n aria-label={`Potential payout for ${outcome.label}`}\n className=\"shrink-0 rounded-md py-2 text-muted-foreground text-sm tabular-nums focus-visible:outline-2 focus-visible:outline-ring\"\n >\n {probability(outcome.probability) > 0\n ? `${(1 / probability(outcome.probability)).toFixed(1)}×`\n : \"—\"}\n </button>\n </Tooltip>\n <MarketOddsButton\n positive={index % 2 === 0}\n outcome={outcome}\n onClick={() => onOutcomeClick?.({ outcomeId: outcome.id, side: \"yes\" })}\n />\n </div>\n <div aria-hidden className=\"h-0.5 w-24 overflow-hidden rounded-full\">\n <motion.div\n initial={false}\n animate={{ scaleX: probability(outcome.probability) }}\n transition={reduce ? { duration: 0 } : { duration: 0.25, ease: EASE_OUT }}\n className=\"h-full origin-left rounded-full bg-emerald-300/70 dark:bg-emerald-400/40\"\n style={outcome.color ? { backgroundColor: outcome.color } : undefined}\n />\n </div>\n </div>\n ))}\n </div>\n\n <footer className=\"mt-2 flex shrink-0 items-center gap-2 text-muted-foreground text-xs\">\n {chartPoints && (\n <svg\n aria-hidden=\"true\"\n viewBox=\"0 0 48 22\"\n className=\"h-5 w-12 shrink-0 text-emerald-500 dark:text-emerald-400\"\n fill=\"none\"\n >\n <defs>\n <linearGradient id={chartId} x1=\"0\" y1=\"0\" x2=\"0\" y2=\"1\">\n <stop offset=\"0%\" stopColor=\"currentColor\" stopOpacity=\"0.22\" />\n <stop offset=\"100%\" stopColor=\"currentColor\" stopOpacity=\"0\" />\n </linearGradient>\n </defs>\n <polygon points={`2,22 ${chartPoints} 46,22`} fill={`url(#${chartId})`} />\n <polyline\n points={chartPoints}\n stroke=\"currentColor\"\n strokeWidth=\"1.75\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n />\n </svg>\n )}\n <span className=\"shrink-0\">{volume} vol.</span>\n <motion.button\n type=\"button\"\n aria-label={`Bookmark ${title}`}\n aria-pressed={saved}\n onClick={() => {\n if (bookmarked === undefined) setInternalBookmark(!saved);\n onBookmarkChange?.(!saved);\n }}\n whileTap={reduce ? undefined : { scale: 0.85 }}\n transition={SPRING_PRESS}\n className={cn(\n \"ml-auto flex size-9 shrink-0 items-center justify-center rounded-xl transition-colors hover:bg-muted focus-visible:outline-2 focus-visible:outline-ring\",\n saved && \"text-foreground\",\n )}\n >\n <motion.span\n animate={{ scale: saved && !reduce ? [1, 1.2, 1] : 1 }}\n transition={{ duration: 0.22, ease: EASE_OUT }}\n >\n <Bookmark aria-hidden className={cn(\"size-4\", saved && \"fill-current\")} />\n </motion.span>\n </motion.button>\n </footer>\n </div>\n </article>\n );\n}\n\nfunction MarketOddsButton({\n positive,\n outcome,\n onClick,\n}: {\n outcome: PredictionMarketCardOutcome;\n positive: boolean;\n onClick: () => void;\n}) {\n const reduce = useReducedMotion();\n const cents = Math.round(probability(outcome.probability) * 100);\n const canHover = useHoverCapable();\n const [hovered, setHovered] = useState(false);\n const [focused, setFocused] = useState(false);\n const showAction = (canHover && hovered) || focused;\n return (\n <motion.button\n type=\"button\"\n aria-label={`Trade ${outcome.label} at ${cents}%`}\n onClick={onClick}\n onPointerEnter={(event) => {\n if (event.pointerType !== \"touch\") setHovered(true);\n }}\n onPointerLeave={() => setHovered(false)}\n onFocus={(event) => setFocused(event.currentTarget.matches(\":focus-visible\"))}\n onBlur={() => setFocused(false)}\n whileTap={reduce ? undefined : { scale: 0.96 }}\n transition={SPRING_PRESS}\n className={cn(\n \"relative flex min-h-10 min-w-16 shrink-0 items-center justify-center overflow-hidden rounded-xl border border-border bg-background px-3 font-semibold text-foreground text-sm shadow-[0_3px_0] transition-colors hover:bg-muted focus-visible:outline-2 focus-visible:outline-ring focus-visible:outline-offset-2\",\n positive &&\n \"border-emerald-500/25 bg-emerald-500/10 text-emerald-700 shadow-emerald-500/20 hover:bg-emerald-500/15 dark:text-emerald-400\",\n !positive &&\n \"border-rose-500/25 bg-rose-500/10 text-rose-700 shadow-rose-500/20 hover:bg-rose-500/15 dark:text-rose-400\",\n )}\n >\n <ActionSwapText value={showAction ? \"action\" : String(cents)} animation=\"roll\">\n {showAction ? (positive ? \"Yes\" : \"No\") : `${cents}%`}\n </ActionSwapText>\n </motion.button>\n );\n}\n"],"mappings":";;;;;;;;;;;AA8CA,SAAS,YAAY,OAAe;CAClC,OAAO,OAAO,SAAS,KAAK,IAAI,KAAK,IAAI,GAAG,KAAK,IAAI,GAAG,KAAK,CAAC,IAAI;AACpE;;AAGA,SAAgB,qBAAqB,EACnC,OACA,MACA,UACA,QACA,eACA,QACA,OAAO,OACP,UACA,gBACA,YACA,oBAAoB,OACpB,kBACA,aAC4B;CAC5B,MAAM,UAAU,MAAM;CACtB,MAAM,UAAU,MAAM;CACtB,MAAM,UAAU,eAAe,OAAO,OAAO,QAAQ,KAAK,CAAC;CAC3D,MAAM,MAAM,KAAK,IAAI,GAAG,OAAO;CAC/B,MAAM,QAAQ,KAAK,IAAI,GAAG,OAAO,IAAI;CACrC,MAAM,cACJ,QAAQ,SAAS,IACb,QACG,KACE,QAAQ,UACP,GAAG,IAAK,SAAS,QAAQ,SAAS,KAAM,GAAG,GAAG,MAAM,SAAS,SAAS,OAAO,QAAQ,MAAO,IAChG,CAAC,CACA,KAAK,GAAG,IACX;CACN,MAAM,SAAS,iBAAiB;CAChC,MAAM,CAAC,kBAAkB,uBAAuB,SAAS,iBAAiB;CAC1E,MAAM,QAAQ,cAAc;CAE5B,OACE,qBAAC,WAAD;EACE,mBAAiB;EACjB,WAAW,GACT,2FACA,SACF;EALF,UAAA,CAOE,qBAAC,UAAD;GAAQ,WAAU;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E_OUT } from "../../lib/ease.js";
3
- import { StatefulButton } from "./button/stateful.js";
4
3
  import { NumberTicker } from "./number-ticker.js";
4
+ import { StatefulButton } from "./button/stateful.js";
5
5
  import { Tabs, TabsList, TabsTrigger } from "./tabs.js";
6
6
  import { useCallback, useEffect, useId, useMemo, useRef, useState } from "react";
7
7
  import { cn } from "@kumix/utils";
@@ -5,8 +5,8 @@ import { useCallback, useEffect, useId, useRef, useState } from "react";
5
5
  import { cn } from "@kumix/utils";
6
6
  import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
7
7
  import { AnimatePresence, LayoutGroup, motion, useReducedMotion } from "motion/react";
8
- import { X } from "lucide-react";
9
8
  import { createPortal } from "react-dom";
9
+ import { X } from "lucide-react";
10
10
  //#region src/components/motion/project-folder.tsx
11
11
  const MAX_PREVIEWS = 5;
12
12
  const FOCUSABLE_SELECTOR = [
@@ -7,15 +7,21 @@ export interface RadioGroupProps {
7
7
  children: ReactNode;
8
8
  className?: string;
9
9
  orientation?: "vertical" | "horizontal";
10
+ /** Accessible name for the group when no visible label names it. */
11
+ "aria-label"?: string;
12
+ /** Id of a visible element that names the group. */
13
+ "aria-labelledby"?: string;
10
14
  }
11
- export declare function RadioGroup({ value, defaultValue, onValueChange, children, className, orientation }: RadioGroupProps): import("react").JSX.Element;
15
+ export declare function RadioGroup({ value, defaultValue, onValueChange, children, className, orientation, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy }: RadioGroupProps): import("react").JSX.Element;
12
16
  export interface RadioGroupItemProps {
13
17
  value: string;
14
18
  label?: string;
19
+ /** Supporting text under the label, announced as the description rather than the name. */
20
+ description?: string;
15
21
  disabled?: boolean;
16
22
  className?: string;
17
23
  id?: string;
18
24
  }
19
- export declare function RadioGroupItem({ value, label, disabled, className, id: idProp }: RadioGroupItemProps): import("react").JSX.Element;
25
+ export declare function RadioGroupItem({ value, label, description, disabled, className, id: idProp }: RadioGroupItemProps): import("react").JSX.Element;
20
26
  //#endregion
21
27
  //# sourceMappingURL=radio.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"radio.d.ts","names":[],"sources":["../../../src/components/motion/radio.tsx"],"mappings":";;iBAgCiB;EACf;EACA;EACA,iBAAiB;EACjB,UAAU;EACV;EACA;;wBAGc,aACd,OACA,cACA,eACA,UACA,WACA,eACC,kCAAe,IAAA;iBAoCD;EACf;EACA;EACA;EACA;EACA;;wBAGc,iBACd,OACA,OACA,UACA,WACA,IAAI,UACH,sCAAmB,IAAA"}
1
+ {"version":3,"file":"radio.d.ts","names":[],"sources":["../../../src/components/motion/radio.tsx"],"mappings":";;iBA0CiB;EACf;EACA;EACA,iBAAiB;EACjB,UAAU;EACV;EACA;;EAEA;;EAEA;;wBAGc,aACd,OACA,cACA,eACA,UACA,WACA,2BACc,8BACK,kBAClB,kCAAe,IAAA;iBAyDD;EACf;EACA;;EAEA;EACA;EACA;EACA;;wBAGc,iBACd,OACA,OACA,aACA,UACA,WACA,IAAI,UACH,sCAAmB,IAAA"}