@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 +1 @@
1
- {"version":3,"file":"bottom-sheet.js","names":[],"sources":["../../../src/components/motion/bottom-sheet.tsx"],"sourcesContent":["\"use client\";\n\nimport { type ReactNode, useEffect, useId, useRef, useState } from \"react\";\nimport {\n AnimatePresence,\n motion,\n type PanInfo,\n useDragControls,\n useReducedMotion,\n} from \"motion/react\";\nimport { createPortal } from \"react-dom\";\n\nimport { cn } from \"@kumix/utils\";\nimport { EASE_DRAWER } from \"../../lib/ease\";\nimport { PresenceGate } from \"../../lib/presence-gate\";\nimport { TOUCH_GESTURE_CONTENT_CLASS } from \"../../lib/touch\";\n\n// Vaul-style glide: a long, fully-damped tween reads smoother than a spring on\n// open — no settle/overshoot, just one clean decel. Same curve drives the\n// backdrop fade so the surface and scrim move as one.\nconst DRAWER = { duration: 0.5, ease: EASE_DRAWER } as const;\n\nexport interface BottomSheetProps {\n open: boolean;\n onOpenChange: (open: boolean) => void;\n /** Heights (0-1 = fraction of viewport, or \"auto\"). First entry is default. */\n snapPoints?: (number | \"auto\")[];\n defaultSnap?: number;\n title?: string;\n description?: string;\n children?: ReactNode;\n className?: string;\n /** Min drag distance (px) past current snap to dismiss. */\n dismissThreshold?: number;\n}\n\nexport function BottomSheet({\n open,\n onOpenChange,\n snapPoints = [0.5, 0.92],\n defaultSnap = 0,\n title,\n description,\n children,\n className,\n dismissThreshold = 120,\n}: BottomSheetProps) {\n const [snap, setSnap] = useState(defaultSnap);\n const [mounted, setMounted] = useState(false);\n const dragControls = useDragControls();\n const sheetRef = useRef<HTMLDivElement>(null);\n const reduce = useReducedMotion();\n const heightRef = useRef(0);\n const uid = useId();\n const titleId = `${uid}-title`;\n const descriptionId = `${uid}-description`;\n\n useEffect(() => {\n setMounted(true);\n }, []);\n\n useEffect(() => {\n if (open) setSnap(defaultSnap);\n }, [open, defaultSnap]);\n\n // Lock background scroll while open. overflow:hidden alone is ignored by\n // iOS Safari — boundary scrolls inside the sheet chain to the page, which\n // scrolls underneath and ends up somewhere else on close. position:fixed\n // is the lock that actually holds; restore the scroll position after.\n useEffect(() => {\n if (!open) return;\n const body = document.body;\n const scrollY = window.scrollY;\n const prev = {\n position: body.style.position,\n top: body.style.top,\n left: body.style.left,\n right: body.style.right,\n overflow: body.style.overflow,\n };\n body.style.position = \"fixed\";\n body.style.top = `-${scrollY}px`;\n body.style.left = \"0\";\n body.style.right = \"0\";\n body.style.overflow = \"hidden\";\n\n const onKey = (event: KeyboardEvent) => {\n if (event.key === \"Escape\") {\n event.preventDefault();\n onOpenChange(false);\n }\n };\n window.addEventListener(\"keydown\", onKey);\n\n return () => {\n window.removeEventListener(\"keydown\", onKey);\n body.style.position = prev.position;\n body.style.top = prev.top;\n body.style.left = prev.left;\n body.style.right = prev.right;\n body.style.overflow = prev.overflow;\n window.scrollTo(0, scrollY);\n };\n }, [open, onOpenChange]);\n\n const onDragEnd = (_: unknown, info: PanInfo) => {\n const velocity = info.velocity.y;\n const offset = info.offset.y;\n\n // Strong downward fling or large drag → dismiss.\n if (velocity > 600 || offset > dismissThreshold) {\n const smaller = snapPoints.map((_, i) => i).filter((i) => i < snap);\n if (smaller.length && velocity < 800 && offset < dismissThreshold * 1.6) {\n setSnap(smaller[smaller.length - 1]);\n } else {\n onOpenChange(false);\n }\n return;\n }\n\n // Strong upward fling → next snap.\n if (velocity < -500) {\n setSnap((current) => Math.min(snapPoints.length - 1, current + 1));\n return;\n }\n\n // Otherwise snap to nearest by current offset.\n setSnap((current) => {\n if (offset > 80 && current > 0) return current - 1;\n if (offset < -80 && current < snapPoints.length - 1) return current + 1;\n return current;\n });\n };\n\n const snapValue = snapPoints[snap];\n const heightStyle =\n snapValue === \"auto\" ? { maxHeight: \"92vh\" } : { height: `${snapValue * 100}vh` };\n\n // Portal to <body>: an ancestor with backdrop-filter or transform becomes\n // the containing block for fixed descendants, which would position the\n // sheet against that ancestor instead of the viewport.\n if (!mounted) return null;\n\n // Two fixed siblings, no wrapper: the scrim spans the viewport edges but\n // carries a colour, and the sheet is pinned to the bottom, stops short of the\n // top edge at every snap point the component ships, and paints an opaque\n // surface either way. Both hang off `PresenceGate`, so interaction releases in\n // the same commit that starts the exit rather than when it ends.\n return createPortal(\n <AnimatePresence>\n {open ? (\n <PresenceGate key=\"backdrop\">\n {({ gate }) => (\n <motion.button\n type=\"button\"\n aria-label=\"Close bottom sheet\"\n initial={{ opacity: 0 }}\n animate={{ opacity: 1 }}\n exit={{ opacity: 0 }}\n transition={DRAWER}\n {...gate}\n onClick={() => onOpenChange(false)}\n // A dim scrim with a light blur. backdrop-blur is GPU-expensive and\n // re-rasterizes every frame the sheet drags over it; a small radius\n // plus more opacity keeps the glass look without the jank.\n className=\"pointer-events-auto fixed inset-0 z-50 bg-background/40 backdrop-blur-sm\"\n />\n )}\n </PresenceGate>\n ) : null}\n {open ? (\n <PresenceGate key=\"sheet\">\n {({ gate }) => (\n <motion.div\n ref={sheetRef}\n drag=\"y\"\n dragControls={dragControls}\n dragListener={false}\n dragConstraints={{ top: 0, bottom: 0 }}\n dragElastic={{ top: 0.02, bottom: 0.4 }}\n dragMomentum={false}\n onDragEnd={onDragEnd}\n initial={reduce ? { y: 0, opacity: 0 } : { y: \"100%\" }}\n animate={reduce ? { y: 0, opacity: 1 } : { y: 0 }}\n exit={reduce ? { y: 0, opacity: 0 } : { y: \"100%\" }}\n transition={reduce ? { duration: 0.18, ease: EASE_DRAWER } : DRAWER}\n onAnimationComplete={() => {\n if (sheetRef.current) heightRef.current = sheetRef.current.offsetHeight;\n }}\n {...gate}\n style={{ ...heightStyle, ...gate.style }}\n className={cn(\n \"pointer-events-auto fixed right-0 bottom-0 left-0 z-50 mx-auto flex max-w-2xl flex-col overflow-hidden rounded-t-3xl will-change-transform\",\n \"border border-border bg-background shadow-xl\",\n className,\n )}\n role=\"dialog\"\n aria-modal=\"true\"\n aria-labelledby={title ? titleId : undefined}\n aria-describedby={description ? descriptionId : undefined}\n aria-label={title ? undefined : \"Bottom sheet\"}\n >\n <div className=\"flex flex-col items-center px-4 pt-3 pb-2\">\n {/* Drag only the pill so the title and description stay selectable. */}\n <div\n onPointerDown={(event) => dragControls.start(event)}\n // A slow pull must not hand the gesture to iOS's callout,\n // which would leave the sheet frozen mid-drag.\n className={cn(\n \"flex cursor-grab touch-none items-center justify-center py-1 active:cursor-grabbing\",\n TOUCH_GESTURE_CONTENT_CLASS,\n )}\n >\n <div className=\"h-1.5 w-10 rounded-full bg-muted-foreground/40\" />\n </div>\n {title || description ? (\n <div className=\"mt-2 w-full\">\n {title ? (\n <h2 id={titleId} className=\"font-semibold text-base text-foreground\">\n {title}\n </h2>\n ) : null}\n {description ? (\n <p id={descriptionId} className=\"mt-0.5 text-muted-foreground text-sm\">\n {description}\n </p>\n ) : null}\n </div>\n ) : null}\n </div>\n {/* overscroll-contain stops boundary scrolls from chaining to the page. */}\n <div className=\"flex-1 overflow-y-auto overscroll-contain px-4 pb-6\">{children}</div>\n </motion.div>\n )}\n </PresenceGate>\n ) : null}\n </AnimatePresence>,\n document.body,\n );\n}\n"],"mappings":";;;;;;;;;;AAoBA,MAAM,SAAS;CAAE,UAAU;CAAK,MAAM;AAAY;AAgBlD,SAAgB,YAAY,EAC1B,MACA,cACA,aAAa,CAAC,IAAK,GAAI,GACvB,cAAc,GACd,OACA,aACA,UACA,WACA,mBAAmB,OACA;CACnB,MAAM,CAAC,MAAM,WAAW,SAAS,WAAW;CAC5C,MAAM,CAAC,SAAS,cAAc,SAAS,KAAK;CAC5C,MAAM,eAAe,gBAAgB;CACrC,MAAM,WAAW,OAAuB,IAAI;CAC5C,MAAM,SAAS,iBAAiB;CAChC,MAAM,YAAY,OAAO,CAAC;CAC1B,MAAM,MAAM,MAAM;CAClB,MAAM,UAAU,GAAG,IAAI;CACvB,MAAM,gBAAgB,GAAG,IAAI;CAE7B,gBAAgB;EACd,WAAW,IAAI;CACjB,GAAG,CAAC,CAAC;CAEL,gBAAgB;EACd,IAAI,MAAM,QAAQ,WAAW;CAC/B,GAAG,CAAC,MAAM,WAAW,CAAC;CAMtB,gBAAgB;EACd,IAAI,CAAC,MAAM;E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BAAiB,QAAQ,UAAU,KAAA;EACnC,oBAAkB,cAAc,gBAAgB,KAAA;EAChD,cAAY,QAAQ,KAAA,IAAY;EA3BlC,UAAA,CA6BE,qBAAC,OAAD;GAAK,WAAU;GAAf,UAAA,CAEE,oBAAC,OAAD;IACE,gBAAgB,UAAU,aAAa,MAAM,KAAK;IAGlD,WAAW,GACT,uFACA,2BACF;IAEA,UAAA,oBAAC,OAAD,EAAK,WAAU,iDAAkD,CAAA;GAC9D,CAAA,GACJ,SAAS,cACR,qBAAC,OAAD;IAAK,WAAU;IAAf,UAAA,CACG,QACC,oBAAC,MAAD;KAAI,IAAI;KAAS,WAAU;KACxB,UAAA;IACC,CAAA,IACF,MACH,cACC,oBAAC,KAAD;KAAG,IAAI;KAAe,WAAU;KAC7B,UAAA;IACA,CAAA,IACD,IACD;GACH,CAAA,IAAA,IACD;EAEL,CAAA,GAAA,oBAAC,OAAD;GAAK,WAAU;GAAuD;EAAc,CAAA,CAC1E;CAEF,CAAA,EAAA,GA/DI,OA+DJ,IACZ,IACW,EAAA,CAAA,GACjB,SAAS,IACX;AACF"}
1
+ {"version":3,"file":"bottom-sheet.js","names":[],"sources":["../../../src/components/motion/bottom-sheet.tsx"],"sourcesContent":["\"use client\";\n\nimport { type ReactNode, useEffect, useId, useRef, useState } from \"react\";\nimport {\n AnimatePresence,\n motion,\n type PanInfo,\n useDragControls,\n useReducedMotion,\n} from \"motion/react\";\nimport { createPortal } from \"react-dom\";\n\nimport { cn } from \"@kumix/utils\";\nimport { useFocusTrap } from \"../../hooks/use-focus-trap\";\nimport { EASE_DRAWER } from \"../../lib/ease\";\nimport { PresenceGate } from \"../../lib/presence-gate\";\nimport { TOUCH_GESTURE_CONTENT_CLASS } from \"../../lib/touch\";\n\n// Vaul-style glide: a long, fully-damped tween reads smoother than a spring on\n// open — no settle/overshoot, just one clean decel. Same curve drives the\n// backdrop fade so the surface and scrim move as one.\nconst DRAWER = { duration: 0.5, ease: EASE_DRAWER } as const;\n\nexport interface BottomSheetProps {\n open: boolean;\n onOpenChange: (open: boolean) => void;\n /** Heights (0-1 = fraction of viewport, or \"auto\"). First entry is default. */\n snapPoints?: (number | \"auto\")[];\n defaultSnap?: number;\n title?: string;\n description?: string;\n children?: ReactNode;\n className?: string;\n /** Min drag distance (px) past current snap to dismiss. */\n dismissThreshold?: number;\n}\n\nexport function BottomSheet({\n open,\n onOpenChange,\n snapPoints = [0.5, 0.92],\n defaultSnap = 0,\n title,\n description,\n children,\n className,\n dismissThreshold = 120,\n}: BottomSheetProps) {\n const [snap, setSnap] = useState(defaultSnap);\n const [mounted, setMounted] = useState(false);\n const dragControls = useDragControls();\n const sheetRef = useRef<HTMLDivElement>(null);\n const reduce = useReducedMotion();\n const heightRef = useRef(0);\n const uid = useId();\n const titleId = `${uid}-title`;\n const descriptionId = `${uid}-description`;\n\n useEffect(() => {\n setMounted(true);\n }, []);\n\n useEffect(() => {\n if (open) setSnap(defaultSnap);\n }, [open, defaultSnap]);\n\n // Focus moves into the sheet on open, Tab stays inside it, and focus returns\n // to the opener on close. `mounted` gates it because the sheet only exists\n // once the portal can render.\n useFocusTrap(open && mounted, sheetRef, {\n onEscape: () => onOpenChange(false),\n });\n\n // Lock background scroll while open. overflow:hidden alone is ignored by\n // iOS Safari — boundary scrolls inside the sheet chain to the page, which\n // scrolls underneath and ends up somewhere else on close. position:fixed\n // is the lock that actually holds; restore the scroll position after.\n useEffect(() => {\n if (!open) return;\n const body = document.body;\n const scrollY = window.scrollY;\n const prev = {\n position: body.style.position,\n top: body.style.top,\n left: body.style.left,\n right: body.style.right,\n overflow: body.style.overflow,\n };\n body.style.position = \"fixed\";\n body.style.top = `-${scrollY}px`;\n body.style.left = \"0\";\n body.style.right = \"0\";\n body.style.overflow = \"hidden\";\n\n return () => {\n body.style.position = prev.position;\n body.style.top = prev.top;\n body.style.left = prev.left;\n body.style.right = prev.right;\n body.style.overflow = prev.overflow;\n window.scrollTo(0, scrollY);\n };\n }, [open]);\n\n const onDragEnd = (_: unknown, info: PanInfo) => {\n const velocity = info.velocity.y;\n const offset = info.offset.y;\n\n // Strong downward fling or large drag → dismiss.\n if (velocity > 600 || offset > dismissThreshold) {\n const smaller = snapPoints.map((_, i) => i).filter((i) => i < snap);\n if (smaller.length && velocity < 800 && offset < dismissThreshold * 1.6) {\n setSnap(smaller[smaller.length - 1]);\n } else {\n onOpenChange(false);\n }\n return;\n }\n\n // Strong upward fling → next snap.\n if (velocity < -500) {\n setSnap((current) => Math.min(snapPoints.length - 1, current + 1));\n return;\n }\n\n // Otherwise snap to nearest by current offset.\n setSnap((current) => {\n if (offset > 80 && current > 0) return current - 1;\n if (offset < -80 && current < snapPoints.length - 1) return current + 1;\n return current;\n });\n };\n\n const snapValue = snapPoints[snap];\n const heightStyle =\n snapValue === \"auto\" ? { maxHeight: \"92vh\" } : { height: `${snapValue * 100}vh` };\n\n // Portal to <body>: an ancestor with backdrop-filter or transform becomes\n // the containing block for fixed descendants, which would position the\n // sheet against that ancestor instead of the viewport.\n if (!mounted) return null;\n\n // Two fixed siblings, no wrapper: the scrim spans the viewport edges but\n // carries a colour, and the sheet is pinned to the bottom, stops short of the\n // top edge at every snap point the component ships, and paints an opaque\n // surface either way. Both hang off `PresenceGate`, so interaction releases in\n // the same commit that starts the exit rather than when it ends.\n return createPortal(\n <AnimatePresence>\n {open ? (\n <PresenceGate key=\"backdrop\">\n {({ gate }) => (\n <motion.button\n type=\"button\"\n aria-label=\"Close bottom sheet\"\n // Outside the sheet, so the focus trap never lands on it; it is\n // a pointer target, and Escape closes from the keyboard.\n tabIndex={-1}\n initial={{ opacity: 0 }}\n animate={{ opacity: 1 }}\n exit={{ opacity: 0 }}\n transition={DRAWER}\n {...gate}\n onClick={() => onOpenChange(false)}\n // A dim scrim with a light blur. backdrop-blur is GPU-expensive and\n // re-rasterizes every frame the sheet drags over it; a small radius\n // plus more opacity keeps the glass look without the jank.\n className=\"pointer-events-auto fixed inset-0 z-50 bg-background/40 backdrop-blur-sm\"\n />\n )}\n </PresenceGate>\n ) : null}\n {open ? (\n <PresenceGate key=\"sheet\">\n {({ gate }) => (\n <motion.div\n ref={sheetRef}\n drag=\"y\"\n dragControls={dragControls}\n dragListener={false}\n dragConstraints={{ top: 0, bottom: 0 }}\n dragElastic={{ top: 0.02, bottom: 0.4 }}\n dragMomentum={false}\n onDragEnd={onDragEnd}\n initial={reduce ? { y: 0, opacity: 0 } : { y: \"100%\" }}\n animate={reduce ? { y: 0, opacity: 1 } : { y: 0 }}\n exit={reduce ? { y: 0, opacity: 0 } : { y: \"100%\" }}\n transition={reduce ? { duration: 0.18, ease: EASE_DRAWER } : DRAWER}\n onAnimationComplete={() => {\n if (sheetRef.current) heightRef.current = sheetRef.current.offsetHeight;\n }}\n {...gate}\n style={{ ...heightStyle, ...gate.style }}\n className={cn(\n \"pointer-events-auto fixed right-0 bottom-0 left-0 z-50 mx-auto flex max-w-2xl flex-col overflow-hidden rounded-t-3xl outline-none will-change-transform\",\n \"border border-border bg-background shadow-xl\",\n className,\n )}\n role=\"dialog\"\n aria-modal=\"true\"\n tabIndex={-1}\n aria-labelledby={title ? titleId : undefined}\n aria-describedby={description ? descriptionId : undefined}\n aria-label={title ? undefined : \"Bottom sheet\"}\n >\n <div className=\"flex flex-col items-center px-4 pt-3 pb-2\">\n {/* Drag only the pill so the title and description stay selectable. */}\n <div\n onPointerDown={(event) => dragControls.start(event)}\n // A slow pull must not hand the gesture to iOS's callout,\n // which would leave the sheet frozen mid-drag.\n className={cn(\n \"flex cursor-grab touch-none items-center justify-center py-1 active:cursor-grabbing\",\n TOUCH_GESTURE_CONTENT_CLASS,\n )}\n >\n <div className=\"h-1.5 w-10 rounded-full bg-muted-foreground/40\" />\n </div>\n {title || description ? (\n <div className=\"mt-2 w-full\">\n {title ? (\n <h2 id={titleId} className=\"font-semibold text-base text-foreground\">\n {title}\n </h2>\n ) : null}\n {description ? (\n <p id={descriptionId} className=\"mt-0.5 text-muted-foreground text-sm\">\n {description}\n </p>\n ) : null}\n </div>\n ) : null}\n </div>\n {/* overscroll-contain stops boundary scrolls from chaining to the page. */}\n <div className=\"flex-1 overflow-y-auto overscroll-contain px-4 pb-6\">{children}</div>\n </motion.div>\n )}\n </PresenceGate>\n ) : null}\n </AnimatePresence>,\n document.body,\n );\n}\n"],"mappings":";;;;;;;;;;;AAqBA,MAAM,SAAS;CAAE,UAAU;CAAK,MAAM;AAAY;AAgBlD,SAAgB,YAAY,EAC1B,MACA,cACA,aAAa,CAAC,IAAK,GAAI,GACvB,cAAc,GACd,OACA,aACA,UACA,WACA,mBAAmB,OACA;CACnB,MAAM,CAAC,MAAM,WAAW,SAAS,WAAW;CAC5C,MAAM,CAAC,SAAS,cAAc,SAAS,KAAK;CAC5C,MAAM,eAAe,gBAAgB;CACrC,MAAM,WAAW,OAAuB,IAAI;CAC5C,MAAM,SAAS,iBAAiB;CAChC,MAAM,YAAY,OAAO,CAAC;CAC1B,MAAM,MAAM,MAAM;CAClB,MAAM,UAAU,GAAG,IAAI;CACvB,MAAM,gBAAgB,GAAG,IAAI;CAE7B,gBAAgB;EACd,WAAW,IAAI;CACjB,GAAG,CAAC,CAAC;CAEL,gBAAgB;EACd,IAAI,MAAM,QAAQ,WAAW;CAC/B,GAAG,CAAC,MAAM,WAAW,CAAC;CAKtB,aAAa,QAAQ,SAAS,UAAU,EACtC,gBAAgB,aAAa,KAAK,EACpC,CAAC;CAMD,gBAAgB;EACd,IAAI,CAAC,MAAM;EACX,MAAM,OAAO,SAAS;EACtB,MAAM,UAAU,OAAO;EACvB,MAAM,OAAO;GACX,UAAU,KAAK,MAAM;GACrB,KAAK,KAAK,MAAM;GAChB,MAAM,KAAK,MAAM;GACjB,OAAO,KAAK,MAAM;GAClB,UAAU,KAAK,MAAM;EACvB;EACA,KAAK,MAAM,WAAW;EACtB,KAAK,MAAM,MAAM,IAAI,QAAQ;EAC7B,KAAK,MAAM,OAAO;EAClB,KAAK,MAAM,QAAQ;EACnB,KAAK,MAAM,WAAW;EAEtB,aAAa;G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A,CAAA,IACD,IACD;GACH,CAAA,IAAA,IACD;EAEL,CAAA,GAAA,oBAAC,OAAD;GAAK,WAAU;GAAuD;EAAc,CAAA,CAC1E;CAEF,CAAA,EAAA,GAhEI,OAgEJ,IACZ,IACW,EAAA,CAAA,GACjB,SAAS,IACX;AACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"bounce-sidebar.d.ts","names":[],"sources":["../../../src/components/motion/bounce-sidebar.tsx"],"mappings":";;iBAOiB;EACf;EACA,OAAO;EACP;EACA,OAAO;EACP;EACA;EACA;;iBAGe;EACf,OAAO;EACP;EACA;EACA,iBAAiB;EACjB;EACA;EACA;EACA;EACA;;wBAqBc,gBACd,OACA,OACA,cACA,eACA,WACA,WACA,eACA,eACA,sBACC,qCAAkB,IAAA"}
1
+ {"version":3,"file":"bounce-sidebar.d.ts","names":[],"sources":["../../../src/components/motion/bounce-sidebar.tsx"],"mappings":";;iBAOiB;EACf;EACA,OAAO;EACP;EACA,OAAO;EACP;EACA;EACA;;iBAGe;EACf,OAAO;EACP;EACA;EACA,iBAAiB;EACjB;EACA;EACA;EACA;EACA;;wBAoBc,gBACd,OACA,OACA,cACA,eACA,WACA,WACA,eACA,eACA,sBACC,qCAAkB,IAAA"}
@@ -2,7 +2,7 @@
2
2
  import { useCallback, useLayoutEffect, useRef, useState } from "react";
3
3
  import { cn } from "@kumix/utils";
4
4
  import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
5
- import { animate, motion, useMotionValue, useReducedMotion } from "motion/react";
5
+ import { arc, useAnimate, useReducedMotion } from "motion/react";
6
6
  //#region src/components/motion/bounce-sidebar.tsx
7
7
  const DOT_SIZE = 6;
8
8
  const BOUNCE_SPRING = {
@@ -11,10 +11,8 @@ const BOUNCE_SPRING = {
11
11
  damping: 18,
12
12
  mass: .3
13
13
  };
14
- function quadraticBezier(start, control, end, progress) {
15
- const remaining = 1 - progress;
16
- return remaining * remaining * start + 2 * remaining * progress * control + progress * progress * end;
17
- }
14
+ const ARC_MAX_STRENGTH = .26;
15
+ const ARC_MAX_BULGE = 40;
18
16
  function BounceSidebar({ items, value, defaultValue, onValueChange, ariaLabel = "Sidebar navigation", className, listClassName, itemClassName, indicatorClassName }) {
19
17
  const reduce = useReducedMotion();
20
18
  const [internalValue, setInternalValue] = useState(defaultValue ?? items[0]?.id ?? "");
@@ -26,57 +24,57 @@ function BounceSidebar({ items, value, defaultValue, onValueChange, ariaLabel =
26
24
  const selectedValueRef = useRef(selectedValue);
27
25
  const previousIndexRef = useRef(selectedIndex);
28
26
  const hasPositionRef = useRef(false);
29
- const animationRef = useRef(null);
30
- const x = useMotionValue(0);
31
- const y = useMotionValue(0);
27
+ const dotYRef = useRef(0);
28
+ const [dot, animateDot] = useAnimate();
32
29
  selectedValueRef.current = selectedValue;
30
+ const placeDot = useCallback((destinationY) => {
31
+ if (!dot.current) return;
32
+ animateDot(dot.current, {
33
+ x: 0,
34
+ y: destinationY
35
+ }, { duration: 0 });
36
+ dotYRef.current = destinationY;
37
+ hasPositionRef.current = true;
38
+ }, [animateDot, dot]);
33
39
  const snapIndicator = useCallback(() => {
34
40
  const selectedItem = itemRefs.current.get(selectedValueRef.current);
35
41
  if (!selectedItem) return;
36
- animationRef.current?.stop();
37
- x.set(0);
38
- y.set(selectedItem.offsetTop + (selectedItem.offsetHeight - DOT_SIZE) / 2);
39
- hasPositionRef.current = true;
40
- }, [x, y]);
42
+ placeDot(selectedItem.offsetTop + (selectedItem.offsetHeight - DOT_SIZE) / 2);
43
+ }, [placeDot]);
41
44
  const positionIndicator = useCallback((shouldAnimate) => {
42
45
  const selectedItem = itemRefs.current.get(selectedValue);
43
46
  if (!selectedItem) return;
44
47
  const destinationY = selectedItem.offsetTop + (selectedItem.offsetHeight - DOT_SIZE) / 2;
45
- animationRef.current?.stop();
46
- if (!hasPositionRef.current || reduce || !shouldAnimate) {
47
- x.set(0);
48
- y.set(destinationY);
49
- hasPositionRef.current = true;
48
+ if (!hasPositionRef.current || reduce || !shouldAnimate || !dot.current) {
49
+ placeDot(destinationY);
50
50
  previousIndexRef.current = selectedIndex;
51
51
  return;
52
52
  }
53
- const startY = y.get();
54
- const distance = destinationY - startY;
53
+ const distance = destinationY - dotYRef.current;
55
54
  const travel = Math.abs(distance);
56
55
  const longJumpProgress = Math.min(1, Math.max(0, (travel - 48) / 120));
57
- const controlX = -Math.min(40, Math.max(8, travel * .25));
58
- const controlY = destinationY + ((startY + destinationY) / 2 - destinationY) * longJumpProgress;
59
- animationRef.current = animate(0, 1, {
56
+ dotYRef.current = destinationY;
57
+ animateDot(dot.current, {
58
+ x: 0,
59
+ y: destinationY
60
+ }, {
60
61
  ...BOUNCE_SPRING,
61
62
  stiffness: BOUNCE_SPRING.stiffness - 60 * longJumpProgress,
62
63
  damping: BOUNCE_SPRING.damping + longJumpProgress,
63
64
  mass: BOUNCE_SPRING.mass + .15 * longJumpProgress,
64
- onUpdate: (progress) => {
65
- x.set(quadraticBezier(0, controlX, 0, progress));
66
- y.set(quadraticBezier(startY, controlY, destinationY, progress));
67
- },
68
- onComplete: () => {
69
- x.set(0);
70
- y.set(destinationY);
71
- }
65
+ path: arc({
66
+ strength: Math.min(ARC_MAX_STRENGTH, ARC_MAX_BULGE / travel),
67
+ direction: distance > 0 ? "ccw" : "cw"
68
+ })
72
69
  });
73
70
  previousIndexRef.current = selectedIndex;
74
71
  }, [
72
+ animateDot,
73
+ dot,
74
+ placeDot,
75
75
  reduce,
76
76
  selectedIndex,
77
- selectedValue,
78
- x,
79
- y
77
+ selectedValue
80
78
  ]);
81
79
  useLayoutEffect(() => {
82
80
  const shouldAnimate = hasPositionRef.current && previousIndexRef.current !== selectedIndex;
@@ -89,9 +87,6 @@ function BounceSidebar({ items, value, defaultValue, onValueChange, ariaLabel =
89
87
  observer.observe(list);
90
88
  return () => observer.disconnect();
91
89
  }, [snapIndicator]);
92
- useLayoutEffect(() => () => {
93
- animationRef.current?.stop();
94
- }, []);
95
90
  const selectItem = (id) => {
96
91
  if (value === void 0) setInternalValue(id);
97
92
  onValueChange?.(id);
@@ -106,11 +101,8 @@ function BounceSidebar({ items, value, defaultValue, onValueChange, ariaLabel =
106
101
  "aria-hidden": "true",
107
102
  role: "presentation",
108
103
  className: "pointer-events-none absolute inset-0",
109
- children: /* @__PURE__ */ jsx(motion.span, {
110
- style: {
111
- x,
112
- y
113
- },
104
+ children: /* @__PURE__ */ jsx("span", {
105
+ ref: dot,
114
106
  className: cn("absolute top-0 left-3 h-1.5 w-1.5 rounded-full bg-primary", indicatorClassName)
115
107
  })
116
108
  }) : null, items.map((item) => {
@@ -1 +1 @@
1
- {"version":3,"file":"bounce-sidebar.js","names":[],"sources":["../../../src/components/motion/bounce-sidebar.tsx"],"sourcesContent":["\"use client\";\n\nimport { type ReactNode, useCallback, useLayoutEffect, useRef, useState } from \"react\";\nimport { animate, motion, useMotionValue, useReducedMotion } from \"motion/react\";\n\nimport { cn } from \"@kumix/utils\";\n\nexport interface BounceSidebarItem {\n id: string;\n label: ReactNode;\n href?: string;\n icon?: ReactNode;\n disabled?: boolean;\n target?: \"_blank\" | \"_self\" | \"_parent\" | \"_top\";\n rel?: string;\n}\n\nexport interface BounceSidebarProps {\n items: BounceSidebarItem[];\n value?: string;\n defaultValue?: string;\n onValueChange?: (value: string) => void;\n ariaLabel?: string;\n className?: string;\n listClassName?: string;\n itemClassName?: string;\n indicatorClassName?: string;\n}\n\nconst DOT_SIZE = 6;\n\n// A compact, lightly underdamped spring gives the dot a quick landing without\n// turning the sidebar into a playful toy. The sideways arc carries the bounce.\nconst BOUNCE_SPRING = {\n type: \"spring\",\n stiffness: 280,\n damping: 18,\n mass: 0.3,\n} as const;\n\nfunction quadraticBezier(start: number, control: number, end: number, progress: number) {\n const remaining = 1 - progress;\n return (\n remaining * remaining * start + 2 * remaining * progress * control + progress * progress * end\n );\n}\n\nexport function BounceSidebar({\n items,\n value,\n defaultValue,\n onValueChange,\n ariaLabel = \"Sidebar navigation\",\n className,\n listClassName,\n itemClassName,\n indicatorClassName,\n}: BounceSidebarProps) {\n const reduce = useReducedMotion();\n const [internalValue, setInternalValue] = useState(defaultValue ?? items[0]?.id ?? \"\");\n const requestedValue = value ?? internalValue;\n const selectedValue = items.some((item) => item.id === requestedValue)\n ? requestedValue\n : (items[0]?.id ?? \"\");\n const selectedIndex = items.findIndex((item) => item.id === selectedValue);\n const listRef = useRef<HTMLUListElement>(null);\n const itemRefs = useRef(new Map<string, HTMLLIElement>());\n const selectedValueRef = useRef(selectedValue);\n const previousIndexRef = useRef(selectedIndex);\n const hasPositionRef = useRef(false);\n const animationRef = useRef<ReturnType<typeof animate> | null>(null);\n const x = useMotionValue(0);\n const y = useMotionValue(0);\n selectedValueRef.current = selectedValue;\n\n const snapIndicator = useCallback(() => {\n const selectedItem = itemRefs.current.get(selectedValueRef.current);\n if (!selectedItem) return;\n\n animationRef.current?.stop();\n x.set(0);\n y.set(selectedItem.offsetTop + (selectedItem.offsetHeight - DOT_SIZE) / 2);\n hasPositionRef.current = true;\n }, [x, y]);\n\n const positionIndicator = useCallback(\n (shouldAnimate: boolean) => {\n const selectedItem = itemRefs.current.get(selectedValue);\n if (!selectedItem) return;\n\n const destinationY = selectedItem.offsetTop + (selectedItem.offsetHeight - DOT_SIZE) / 2;\n\n animationRef.current?.stop();\n\n if (!hasPositionRef.current || reduce || !shouldAnimate) {\n x.set(0);\n y.set(destinationY);\n hasPositionRef.current = true;\n previousIndexRef.current = selectedIndex;\n return;\n }\n\n const startY = y.get();\n const distance = destinationY - startY;\n const travel = Math.abs(distance);\n const longJumpProgress = Math.min(1, Math.max(0, (travel - 48) / 120));\n const controlX = -Math.min(40, Math.max(8, travel * 0.25));\n const midpointY = (startY + destinationY) / 2;\n const controlY = destinationY + (midpointY - destinationY) * longJumpProgress;\n\n animationRef.current = animate(0, 1, {\n ...BOUNCE_SPRING,\n stiffness: BOUNCE_SPRING.stiffness - 60 * longJumpProgress,\n damping: BOUNCE_SPRING.damping + longJumpProgress,\n mass: BOUNCE_SPRING.mass + 0.15 * longJumpProgress,\n onUpdate: (progress) => {\n x.set(quadraticBezier(0, controlX, 0, progress));\n y.set(quadraticBezier(startY, controlY, destinationY, progress));\n },\n onComplete: () => {\n x.set(0);\n y.set(destinationY);\n },\n });\n\n previousIndexRef.current = selectedIndex;\n },\n [reduce, selectedIndex, selectedValue, x, y],\n );\n\n useLayoutEffect(() => {\n const shouldAnimate = hasPositionRef.current && previousIndexRef.current !== selectedIndex;\n positionIndicator(shouldAnimate);\n }, [positionIndicator, selectedIndex]);\n\n useLayoutEffect(() => {\n const list = listRef.current;\n if (!list || typeof ResizeObserver === \"undefined\") return;\n\n const observer = new ResizeObserver(snapIndicator);\n observer.observe(list);\n return () => observer.disconnect();\n }, [snapIndicator]);\n\n useLayoutEffect(\n () => () => {\n animationRef.current?.stop();\n },\n [],\n );\n\n const selectItem = (id: string) => {\n if (value === undefined) setInternalValue(id);\n onValueChange?.(id);\n };\n\n return (\n <nav aria-label={ariaLabel} className={cn(\"relative\", className)}>\n <ul\n ref={listRef}\n className={cn(\"relative flex list-none flex-col gap-1.5 pl-6\", listClassName)}\n >\n {selectedIndex >= 0 ? (\n <li\n aria-hidden=\"true\"\n role=\"presentation\"\n className=\"pointer-events-none absolute inset-0\"\n >\n <motion.span\n style={{ x, y }}\n className={cn(\n \"absolute top-0 left-3 h-1.5 w-1.5 rounded-full bg-primary\",\n indicatorClassName,\n )}\n />\n </li>\n ) : null}\n\n {items.map((item) => {\n const active = item.id === selectedValue;\n const content = (\n <>\n {item.icon ? (\n <span aria-hidden=\"true\" className=\"shrink-0\">\n {item.icon}\n </span>\n ) : null}\n <span>{item.label}</span>\n </>\n );\n const interactiveClasses = cn(\n \"flex min-h-9 w-full items-center gap-2 rounded-lg px-2 text-left font-medium text-sm outline-none transition-colors\",\n \"focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background\",\n active ? \"text-foreground\" : \"text-muted-foreground hover:text-foreground\",\n item.disabled ? \"cursor-not-allowed opacity-40\" : undefined,\n itemClassName,\n );\n\n return (\n <li\n key={item.id}\n ref={(node) => {\n if (node) itemRefs.current.set(item.id, node);\n else itemRefs.current.delete(item.id);\n }}\n className=\"relative\"\n >\n {item.href ? (\n <a\n href={item.href}\n target={item.target}\n rel={item.rel ?? (item.target === \"_blank\" ? \"noreferrer noopener\" : undefined)}\n aria-current={active ? \"page\" : undefined}\n aria-disabled={item.disabled || undefined}\n data-active={active || undefined}\n tabIndex={item.disabled ? -1 : undefined}\n onClick={(event) => {\n if (item.disabled) {\n event.preventDefault();\n return;\n }\n selectItem(item.id);\n }}\n className={interactiveClasses}\n >\n {content}\n </a>\n ) : (\n <button\n type=\"button\"\n disabled={item.disabled}\n aria-current={active ? \"page\" : undefined}\n data-active={active || undefined}\n onClick={() => selectItem(item.id)}\n className={interactiveClasses}\n >\n {content}\n </button>\n )}\n </li>\n );\n })}\n </ul>\n </nav>\n );\n}\n"],"mappings":";;;;;;AA6BA,MAAM,WAAW;AAIjB,MAAM,gBAAgB;CACpB,MAAM;CACN,WAAW;CACX,SAAS;CACT,MAAM;AACR;AAEA,SAAS,gBAAgB,OAAe,SAAiB,KAAa,UAAkB;CACtF,MAAM,YAAY,IAAI;CACtB,OACE,YAAY,YAAY,QAAQ,IAAI,YAAY,WAAW,UAAU,WAAW,WAAW;AAE/F;AAEA,SAAgB,cAAc,EAC5B,OACA,OACA,cACA,eACA,YAAY,sBACZ,WACA,eACA,eACA,sBACqB;CACrB,MAAM,SAAS,iBAAiB;CAChC,MAAM,CAAC,eAAe,oBAAoB,SAAS,gBAAgB,MAAM,EAAE,EAAE,MAAM,EAAE;CACrF,MAAM,iBAAiB,SAAS;CAChC,MAAM,gBAAgB,MAAM,MAAM,SAAS,KAAK,OAAO,cAAc,IACjE,iBACC,MAAM,EAAE,EAAE,MAAM;CACrB,MAAM,gBAAgB,MAAM,WAAW,SAAS,KAAK,OAAO,aAAa;CACzE,MAAM,UAAU,OAAyB,IAAI;CAC7C,MAAM,WAAW,uB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,CACG,KAAK,OACJ,oBAAC,QAAD;KAAM,eAAY;KAAO,WAAU;KAChC,UAAA,KAAK;IACF,CAAA,IACJ,MACJ,oBAAC,QAAD,EAAA,UAAO,KAAK,MAAY,CAAA,CACxB,EAAA,CAAA;IAEJ,MAAM,qBAAqB,GACzB,uHACA,iHACA,SAAS,oBAAoB,+CAC7B,KAAK,WAAW,kCAAkC,KAAA,GAClD,aACF;IAEA,OACE,oBAAC,MAAD;KAEE,MAAM,SAAS;MACb,IAAI,MAAM,SAAS,QAAQ,IAAI,KAAK,IAAI,IAAI;WACvC,SAAS,QAAQ,OAAO,KAAK,EAAE;KACtC;KACA,WAAU;KAET,UAAA,KAAK,OACJ,oBAAC,KAAD;MACE,MAAM,KAAK;MACX,QAAQ,KAAK;MACb,KAAK,KAAK,QAAQ,KAAK,WAAW,WAAW,wBAAwB,KAAA;MACrE,gBAAc,SAAS,SAAS,KAAA;MAChC,iBAAe,KAAK,YAAY,KAAA;MAChC,eAAa,UAAU,KAAA;MACvB,UAAU,KAAK,WAAW,KAAK,KAAA;MAC/B,UAAU,UAAU;OAClB,IAAI,KAAK,UAAU;QACjB,MAAM,eAAe;QACrB;OACF;OACA,WAAW,KAAK,EAAE;MACpB;MACA,WAAW;MAEV,UAAA;KACA,CAAA,IAEH,oBAAC,UAAD;MACE,MAAK;MACL,UAAU,KAAK;MACf,gBAAc,SAAS,SAAS,KAAA;MAChC,eAAa,UAAU,KAAA;MACvB,eAAe,WAAW,KAAK,EAAE;MACjC,WAAW;MAEV,UAAA;KACK,CAAA;IAER,GAvCG,KAAK,EAuCR;GAER,CAAC,CACC;;CACD,CAAA;AAET"}
1
+ {"version":3,"file":"bounce-sidebar.js","names":[],"sources":["../../../src/components/motion/bounce-sidebar.tsx"],"sourcesContent":["\"use client\";\n\nimport { type ReactNode, useCallback, useLayoutEffect, useRef, useState } from \"react\";\nimport { arc, useAnimate, useReducedMotion } from \"motion/react\";\n\nimport { cn } from \"@kumix/utils\";\n\nexport interface BounceSidebarItem {\n id: string;\n label: ReactNode;\n href?: string;\n icon?: ReactNode;\n disabled?: boolean;\n target?: \"_blank\" | \"_self\" | \"_parent\" | \"_top\";\n rel?: string;\n}\n\nexport interface BounceSidebarProps {\n items: BounceSidebarItem[];\n value?: string;\n defaultValue?: string;\n onValueChange?: (value: string) => void;\n ariaLabel?: string;\n className?: string;\n listClassName?: string;\n itemClassName?: string;\n indicatorClassName?: string;\n}\n\nconst DOT_SIZE = 6;\n\n// A compact, lightly underdamped spring gives the dot a quick landing without\n// turning the sidebar into a playful toy. The sideways arc carries the bounce.\nconst BOUNCE_SPRING = {\n type: \"spring\",\n stiffness: 280,\n damping: 18,\n mass: 0.3,\n} as const;\n\n// The dot hops sideways, away from the labels. arc() bends proportionally to\n// the distance travelled, so cap it: adjacent rows get a ~5px hop and a long\n// jump peaks near 20px instead of swinging out of the sidebar.\nconst ARC_MAX_STRENGTH = 0.26;\nconst ARC_MAX_BULGE = 40;\n\nexport function BounceSidebar({\n items,\n value,\n defaultValue,\n onValueChange,\n ariaLabel = \"Sidebar navigation\",\n className,\n listClassName,\n itemClassName,\n indicatorClassName,\n}: BounceSidebarProps) {\n const reduce = useReducedMotion();\n const [internalValue, setInternalValue] = useState(defaultValue ?? items[0]?.id ?? \"\");\n const requestedValue = value ?? internalValue;\n const selectedValue = items.some((item) => item.id === requestedValue)\n ? requestedValue\n : (items[0]?.id ?? \"\");\n const selectedIndex = items.findIndex((item) => item.id === selectedValue);\n const listRef = useRef<HTMLUListElement>(null);\n const itemRefs = useRef(new Map<string, HTMLLIElement>());\n const selectedValueRef = useRef(selectedValue);\n const previousIndexRef = useRef(selectedIndex);\n const hasPositionRef = useRef(false);\n const dotYRef = useRef(0);\n const [dot, animateDot] = useAnimate<HTMLSpanElement>();\n selectedValueRef.current = selectedValue;\n\n const placeDot = useCallback(\n (destinationY: number) => {\n if (!dot.current) return;\n animateDot(dot.current, { x: 0, y: destinationY }, { duration: 0 });\n dotYRef.current = destinationY;\n hasPositionRef.current = true;\n },\n [animateDot, dot],\n );\n\n const snapIndicator = useCallback(() => {\n const selectedItem = itemRefs.current.get(selectedValueRef.current);\n if (!selectedItem) return;\n placeDot(selectedItem.offsetTop + (selectedItem.offsetHeight - DOT_SIZE) / 2);\n }, [placeDot]);\n\n const positionIndicator = useCallback(\n (shouldAnimate: boolean) => {\n const selectedItem = itemRefs.current.get(selectedValue);\n if (!selectedItem) return;\n\n const destinationY = selectedItem.offsetTop + (selectedItem.offsetHeight - DOT_SIZE) / 2;\n\n if (!hasPositionRef.current || reduce || !shouldAnimate || !dot.current) {\n placeDot(destinationY);\n previousIndexRef.current = selectedIndex;\n return;\n }\n\n const distance = destinationY - dotYRef.current;\n const travel = Math.abs(distance);\n const longJumpProgress = Math.min(1, Math.max(0, (travel - 48) / 120));\n dotYRef.current = destinationY;\n\n animateDot(\n dot.current,\n { x: 0, y: destinationY },\n {\n ...BOUNCE_SPRING,\n stiffness: BOUNCE_SPRING.stiffness - 60 * longJumpProgress,\n damping: BOUNCE_SPRING.damping + longJumpProgress,\n mass: BOUNCE_SPRING.mass + 0.15 * longJumpProgress,\n path: arc({\n strength: Math.min(ARC_MAX_STRENGTH, ARC_MAX_BULGE / travel),\n // Relative to the direction of travel, so both directions\n // bulge to the screen left, away from the labels.\n direction: distance > 0 ? \"ccw\" : \"cw\",\n }),\n },\n );\n\n previousIndexRef.current = selectedIndex;\n },\n [animateDot, dot, placeDot, reduce, selectedIndex, selectedValue],\n );\n\n useLayoutEffect(() => {\n const shouldAnimate = hasPositionRef.current && previousIndexRef.current !== selectedIndex;\n positionIndicator(shouldAnimate);\n }, [positionIndicator, selectedIndex]);\n\n useLayoutEffect(() => {\n const list = listRef.current;\n if (!list || typeof ResizeObserver === \"undefined\") return;\n\n const observer = new ResizeObserver(snapIndicator);\n observer.observe(list);\n return () => observer.disconnect();\n }, [snapIndicator]);\n\n const selectItem = (id: string) => {\n if (value === undefined) setInternalValue(id);\n onValueChange?.(id);\n };\n\n return (\n <nav aria-label={ariaLabel} className={cn(\"relative\", className)}>\n <ul\n ref={listRef}\n className={cn(\"relative flex list-none flex-col gap-1.5 pl-6\", listClassName)}\n >\n {selectedIndex >= 0 ? (\n <li\n aria-hidden=\"true\"\n role=\"presentation\"\n className=\"pointer-events-none absolute inset-0\"\n >\n <span\n ref={dot}\n className={cn(\n \"absolute top-0 left-3 h-1.5 w-1.5 rounded-full bg-primary\",\n indicatorClassName,\n )}\n />\n </li>\n ) : null}\n\n {items.map((item) => {\n const active = item.id === selectedValue;\n const content = (\n <>\n {item.icon ? (\n <span aria-hidden=\"true\" className=\"shrink-0\">\n {item.icon}\n </span>\n ) : null}\n <span>{item.label}</span>\n </>\n );\n const interactiveClasses = cn(\n \"flex min-h-9 w-full items-center gap-2 rounded-lg px-2 text-left font-medium text-sm outline-none transition-colors\",\n \"focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background\",\n active ? \"text-foreground\" : \"text-muted-foreground hover:text-foreground\",\n item.disabled ? \"cursor-not-allowed opacity-40\" : undefined,\n itemClassName,\n );\n\n return (\n <li\n key={item.id}\n ref={(node) => {\n if (node) itemRefs.current.set(item.id, node);\n else itemRefs.current.delete(item.id);\n }}\n className=\"relative\"\n >\n {item.href ? (\n <a\n href={item.href}\n target={item.target}\n rel={item.rel ?? (item.target === \"_blank\" ? \"noreferrer noopener\" : undefined)}\n aria-current={active ? \"page\" : undefined}\n aria-disabled={item.disabled || undefined}\n data-active={active || undefined}\n tabIndex={item.disabled ? -1 : undefined}\n onClick={(event) => {\n if (item.disabled) {\n event.preventDefault();\n return;\n }\n selectItem(item.id);\n }}\n className={interactiveClasses}\n >\n {content}\n </a>\n ) : (\n <button\n type=\"button\"\n disabled={item.disabled}\n aria-current={active ? \"page\" : undefined}\n data-active={active || undefined}\n onClick={() => selectItem(item.id)}\n className={interactiveClasses}\n >\n {content}\n </button>\n )}\n </li>\n );\n })}\n </ul>\n </nav>\n );\n}\n"],"mappings":";;;;;;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K,EAAE;MACjC,WAAW;MAEV,UAAA;KACK,CAAA;IAER,GAvCG,KAAK,EAuCR;GAER,CAAC,CACC;;CACD,CAAA;AAET"}
@@ -1 +1 @@
1
- {"version":3,"file":"bouncy-accordion.d.ts","names":[],"sources":["../../../src/components/motion/bouncy-accordion.tsx"],"mappings":";;YASY;EACV;EACA,OAAO;EACP,cAAc;EACd,OAAO;EACP;;YAGU;EACV;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;iBAGe;EACf,OAAO;EACP;EACA;EACA,iBAAiB;EACjB;EACA;EACA,aAAa;;wBAiNC,kBACd,OACA,OACA,cACA,eACA,aACA,WACA,cACC,uCAAoB,IAAA"}
1
+ {"version":3,"file":"bouncy-accordion.d.ts","names":[],"sources":["../../../src/components/motion/bouncy-accordion.tsx"],"mappings":";;YASY;EACV;EACA,OAAO;EACP,cAAc;EACd,OAAO;EACP;;YAGU;EACV;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;iBAGe;EACf,OAAO;EACP;EACA;EACA,iBAAiB;EACjB;EACA;EACA,aAAa;;wBAwNC,kBACd,OACA,OACA,cACA,eACA,aACA,WACA,cACC,uCAAoB,IAAA"}
@@ -6,20 +6,15 @@ import { jsx, jsxs } from "react/jsx-runtime";
6
6
  import { motion, useReducedMotion } from "motion/react";
7
7
  import { ChevronDown } from "lucide-react";
8
8
  //#region src/components/motion/bouncy-accordion.tsx
9
- const ROW_TRANSITION = {
10
- type: "spring",
11
- duration: .55,
12
- bounce: .38
13
- };
14
- const CONTENT_OPEN_TRANSITION = {
9
+ const EXPAND_TRANSITION = {
15
10
  type: "spring",
16
11
  duration: .58,
17
12
  bounce: .32
18
13
  };
19
- const CONTENT_CLOSE_TRANSITION = {
14
+ const COLLAPSE_TRANSITION = {
20
15
  type: "spring",
21
16
  duration: .46,
22
- bounce: .26
17
+ bounce: 0
23
18
  };
24
19
  const DESCRIPTION_TRANSITION = {
25
20
  duration: .18,
@@ -33,12 +28,12 @@ const CHEVRON_TRANSITION = {
33
28
  function useControllableAccordionValue({ value, defaultValue, onValueChange }) {
34
29
  const [internalValue, setInternalValue] = useState(defaultValue ?? null);
35
30
  const isControlled = value !== void 0;
36
- return [value ?? internalValue, useCallback((next) => {
31
+ return [isControlled ? value : internalValue, useCallback((next) => {
37
32
  if (!isControlled) setInternalValue(next);
38
33
  onValueChange?.(next);
39
34
  }, [isControlled, onValueChange])];
40
35
  }
41
- function BouncyAccordionRow({ item, open, startsGroup, endsGroup, separatedFromPrevious, contentId, triggerId, reduce, classNames, onToggle }) {
36
+ function BouncyAccordionRow({ item, open, startsGroup, endsGroup, separatedFromPrevious, contentId, triggerId, reduce, layoutTransition, layoutDependency, classNames, onToggle }) {
42
37
  const contentRef = useRef(null);
43
38
  const [contentHeight, setContentHeight] = useState(0);
44
39
  useLayoutEffect(() => {
@@ -55,12 +50,15 @@ function BouncyAccordionRow({ item, open, startsGroup, endsGroup, separatedFromP
55
50
  };
56
51
  }, []);
57
52
  return /* @__PURE__ */ jsx(motion.div, {
58
- layout: "position",
53
+ layout: reduce ? false : "position",
54
+ layoutDependency,
59
55
  initial: false,
60
56
  style: { marginTop: separatedFromPrevious ? 12 : 0 },
61
- transition: reduce ? { duration: 0 } : ROW_TRANSITION,
57
+ transition: { layout: layoutTransition },
62
58
  children: /* @__PURE__ */ jsxs(motion.div, {
63
59
  "data-state": open ? "open" : "closed",
60
+ layout: !reduce,
61
+ layoutDependency,
64
62
  initial: false,
65
63
  animate: {
66
64
  borderTopLeftRadius: startsGroup ? 28 : 0,
@@ -68,15 +66,20 @@ function BouncyAccordionRow({ item, open, startsGroup, endsGroup, separatedFromP
68
66
  borderBottomLeftRadius: endsGroup ? 28 : 0,
69
67
  borderBottomRightRadius: endsGroup ? 28 : 0
70
68
  },
71
- transition: reduce ? { duration: 0 } : ROW_TRANSITION,
69
+ transition: reduce ? { duration: 0 } : layoutTransition,
70
+ style: { originY: 0 },
72
71
  className: cn("overflow-hidden bg-card text-card-foreground", item.disabled && "opacity-50", classNames?.item),
73
- children: [/* @__PURE__ */ jsxs("button", {
72
+ children: [/* @__PURE__ */ jsxs(motion.button, {
74
73
  id: triggerId,
75
74
  type: "button",
76
75
  disabled: item.disabled,
77
76
  "aria-expanded": open,
78
77
  "aria-controls": contentId,
79
78
  onClick: onToggle,
79
+ layout: reduce ? false : "position",
80
+ layoutDependency,
81
+ transition: { layout: layoutTransition },
82
+ style: { originY: 0 },
80
83
  className: cn("flex min-h-[54px] w-full items-center gap-4 px-5 text-left outline-none transition-colors", "focus-visible:bg-muted/25", "disabled:pointer-events-none", classNames?.trigger),
81
84
  children: [
82
85
  item.icon ? /* @__PURE__ */ jsx("span", {
@@ -95,21 +98,24 @@ function BouncyAccordionRow({ item, open, startsGroup, endsGroup, separatedFromP
95
98
  children: /* @__PURE__ */ jsx(ChevronDown, { className: "h-4 w-4" })
96
99
  })
97
100
  ]
98
- }), /* @__PURE__ */ jsx(motion.div, {
99
- layout: "size",
101
+ }), /* @__PURE__ */ jsx("section", {
100
102
  id: contentId,
101
- role: "region",
102
103
  "aria-labelledby": triggerId,
103
104
  "aria-hidden": !open,
104
105
  inert: !open,
105
- initial: false,
106
- style: { height: open && item.description ? contentHeight : 0 },
107
- transition: reduce ? { duration: 0 } : open ? CONTENT_OPEN_TRANSITION : CONTENT_CLOSE_TRANSITION,
108
- className: cn("overflow-hidden", classNames?.content),
106
+ style: { height: open && item.description ? contentHeight || "auto" : 0 },
107
+ className: cn(classNames?.content),
109
108
  children: /* @__PURE__ */ jsx(motion.div, {
110
109
  ref: contentRef,
110
+ layout: reduce ? false : "position",
111
+ layoutDependency,
112
+ initial: false,
111
113
  animate: { opacity: open ? 1 : 0 },
112
- transition: reduce ? { duration: 0 } : DESCRIPTION_TRANSITION,
114
+ transition: {
115
+ opacity: reduce ? { duration: 0 } : DESCRIPTION_TRANSITION,
116
+ layout: layoutTransition
117
+ },
118
+ style: { originY: 0 },
113
119
  className: "px-5 pb-5",
114
120
  children: /* @__PURE__ */ jsx("div", {
115
121
  className: cn("text-[15px] text-muted-foreground leading-6", classNames?.description),
@@ -129,6 +135,11 @@ function BouncyAccordion({ items, value, defaultValue = null, onValueChange, col
129
135
  onValueChange
130
136
  });
131
137
  const activeIndex = items.findIndex((item) => item.id === activeValue);
138
+ const previousValue = useRef(activeValue);
139
+ const layoutTransition = activeValue === null || previousValue.current !== null ? COLLAPSE_TRANSITION : EXPAND_TRANSITION;
140
+ useLayoutEffect(() => {
141
+ previousValue.current = activeValue;
142
+ }, [activeValue]);
132
143
  const toggleItem = useCallback((id) => {
133
144
  if (activeValue === id) {
134
145
  if (collapsible) setActiveValue(null);
@@ -160,6 +171,8 @@ function BouncyAccordion({ items, value, defaultValue = null, onValueChange, col
160
171
  contentId,
161
172
  triggerId,
162
173
  reduce,
174
+ layoutTransition,
175
+ layoutDependency: activeValue,
163
176
  classNames,
164
177
  onToggle: () => toggleItem(item.id)
165
178
  }, item.id);
@@ -1 +1 @@
1
- {"version":3,"file":"bouncy-accordion.js","names":[],"sources":["../../../src/components/motion/bouncy-accordion.tsx"],"sourcesContent":["\"use client\";\n\nimport { type ReactNode, useCallback, useId, useLayoutEffect, useRef, useState } from \"react\";\nimport { ChevronDown } from \"lucide-react\";\nimport { motion, type Transition, useReducedMotion } from \"motion/react\";\n\nimport { cn } from \"@kumix/utils\";\nimport { EASE_OUT } from \"../../lib/ease\";\n\nexport type BouncyAccordionItem = {\n id: string;\n title: ReactNode;\n description?: ReactNode;\n icon?: ReactNode;\n disabled?: boolean;\n};\n\nexport type BouncyAccordionClassNames = {\n root?: string;\n item?: string;\n trigger?: string;\n icon?: string;\n title?: string;\n chevron?: string;\n content?: string;\n description?: string;\n};\n\nexport interface BouncyAccordionProps {\n items: BouncyAccordionItem[];\n value?: string | null;\n defaultValue?: string | null;\n onValueChange?: (value: string | null) => void;\n collapsible?: boolean;\n className?: string;\n classNames?: BouncyAccordionClassNames;\n}\n\n// Local springs keep the accordion's connected groups moving together while\n// avoiding scale projection on text-heavy row contents.\n// Gap spring: must not overshoot y — positive y overshoot drifts items below\n// their mt-3 resting point and briefly overlaps the next item.\nconst ROW_TRANSITION: Transition = {\n type: \"spring\",\n duration: 0.55,\n bounce: 0.38,\n};\n\nconst CONTENT_OPEN_TRANSITION: Transition = {\n type: \"spring\",\n duration: 0.58,\n bounce: 0.32,\n};\n\nconst CONTENT_CLOSE_TRANSITION: Transition = {\n type: \"spring\",\n duration: 0.46,\n bounce: 0.26,\n};\n\nconst DESCRIPTION_TRANSITION: Transition = {\n duration: 0.18,\n ease: EASE_OUT,\n};\n\nconst CHEVRON_TRANSITION: Transition = {\n type: \"spring\",\n duration: 0.42,\n bounce: 0.28,\n};\n\nfunction useControllableAccordionValue({\n value,\n defaultValue,\n onValueChange,\n}: {\n value?: string | null;\n defaultValue?: string | null;\n onValueChange?: (value: string | null) => void;\n}) {\n const [internalValue, setInternalValue] = useState(defaultValue ?? null);\n const isControlled = value !== undefined;\n const currentValue = value ?? internalValue;\n\n const setValue = useCallback(\n (next: string | null) => {\n if (!isControlled) {\n setInternalValue(next);\n }\n\n onValueChange?.(next);\n },\n [isControlled, onValueChange],\n );\n\n return [currentValue, setValue] as const;\n}\n\nfunction BouncyAccordionRow({\n item,\n open,\n startsGroup,\n endsGroup,\n separatedFromPrevious,\n contentId,\n triggerId,\n reduce,\n classNames,\n onToggle,\n}: {\n item: BouncyAccordionItem;\n open: boolean;\n startsGroup: boolean;\n endsGroup: boolean;\n separatedFromPrevious: boolean;\n contentId: string;\n triggerId: string;\n reduce: boolean | null;\n classNames?: BouncyAccordionClassNames;\n onToggle: () => void;\n}) {\n const contentRef = useRef<HTMLDivElement>(null);\n const [contentHeight, setContentHeight] = useState(0);\n\n useLayoutEffect(() => {\n const node = contentRef.current;\n if (!node) return;\n\n const updateHeight = () => {\n setContentHeight(node.offsetHeight);\n };\n\n updateHeight();\n\n const observer = new ResizeObserver(updateHeight);\n observer.observe(node);\n\n return () => {\n observer.disconnect();\n };\n }, []);\n\n return (\n <motion.div\n layout=\"position\"\n initial={false}\n style={{ marginTop: separatedFromPrevious ? 12 : 0 }}\n transition={reduce ? { duration: 0 } : ROW_TRANSITION}\n >\n <motion.div\n data-state={open ? \"open\" : \"closed\"}\n initial={false}\n animate={{\n borderTopLeftRadius: startsGroup ? 28 : 0,\n borderTopRightRadius: startsGroup ? 28 : 0,\n borderBottomLeftRadius: endsGroup ? 28 : 0,\n borderBottomRightRadius: endsGroup ? 28 : 0,\n }}\n transition={reduce ? { duration: 0 } : ROW_TRANSITION}\n className={cn(\n \"overflow-hidden bg-card text-card-foreground\",\n item.disabled && \"opacity-50\",\n classNames?.item,\n )}\n >\n <button\n id={triggerId}\n type=\"button\"\n disabled={item.disabled}\n aria-expanded={open}\n aria-controls={contentId}\n onClick={onToggle}\n className={cn(\n \"flex min-h-[54px] w-full items-center gap-4 px-5 text-left outline-none transition-colors\",\n \"focus-visible:bg-muted/25\",\n \"disabled:pointer-events-none\",\n classNames?.trigger,\n )}\n >\n {item.icon ? (\n <span\n className={cn(\n \"grid h-7 w-7 shrink-0 place-items-center text-muted-foreground\",\n classNames?.icon,\n )}\n >\n {item.icon}\n </span>\n ) : null}\n <span\n className={cn(\n \"min-w-0 flex-1 truncate font-medium text-[15px] text-foreground\",\n classNames?.title,\n )}\n >\n {item.title}\n </span>\n <motion.span\n aria-hidden\n animate={{ rotate: open ? 180 : 0 }}\n transition={reduce ? { duration: 0 } : CHEVRON_TRANSITION}\n className={cn(\n \"grid h-6 w-6 shrink-0 place-items-center text-muted-foreground\",\n classNames?.chevron,\n )}\n >\n <ChevronDown className=\"h-4 w-4\" />\n </motion.span>\n </button>\n\n <motion.div\n layout=\"size\"\n id={contentId}\n role=\"region\"\n aria-labelledby={triggerId}\n aria-hidden={!open}\n inert={!open}\n initial={false}\n style={{ height: open && item.description ? contentHeight : 0 }}\n transition={\n reduce ? { duration: 0 } : open ? CONTENT_OPEN_TRANSITION : CONTENT_CLOSE_TRANSITION\n }\n className={cn(\"overflow-hidden\", classNames?.content)}\n >\n <motion.div\n ref={contentRef}\n animate={{\n opacity: open ? 1 : 0,\n }}\n transition={reduce ? { duration: 0 } : DESCRIPTION_TRANSITION}\n className=\"px-5 pb-5\"\n >\n <div\n className={cn(\"text-[15px] text-muted-foreground leading-6\", classNames?.description)}\n >\n {item.description}\n </div>\n </motion.div>\n </motion.div>\n </motion.div>\n </motion.div>\n );\n}\n\nexport function BouncyAccordion({\n items,\n value,\n defaultValue = null,\n onValueChange,\n collapsible = true,\n className,\n classNames,\n}: BouncyAccordionProps) {\n const reduce = useReducedMotion();\n const baseId = useId();\n const [activeValue, setActiveValue] = useControllableAccordionValue({\n value,\n defaultValue,\n onValueChange,\n });\n const activeIndex = items.findIndex((item) => item.id === activeValue);\n\n const toggleItem = useCallback(\n (id: string) => {\n if (activeValue === id) {\n if (collapsible) {\n setActiveValue(null);\n }\n return;\n }\n\n setActiveValue(id);\n },\n [activeValue, collapsible, setActiveValue],\n );\n\n return (\n <div className={cn(\"w-full\", className, classNames?.root)}>\n {items.map((item, index) => {\n const open = activeValue === item.id;\n const previousIsOpen = activeIndex === index - 1;\n const nextIsOpen = activeIndex === index + 1;\n const startsGroup = open || index === 0 || previousIsOpen;\n const endsGroup = open || index === items.length - 1 || nextIsOpen;\n const separatedFromPrevious = index > 0 && (open || previousIsOpen);\n const contentId = `${baseId}-${item.id}-content`;\n const triggerId = `${baseId}-${item.id}-trigger`;\n\n return (\n <BouncyAccordionRow\n key={item.id}\n item={item}\n open={open}\n startsGroup={startsGroup}\n endsGroup={endsGroup}\n separatedFromPrevious={separatedFromPrevious}\n contentId={contentId}\n triggerId={triggerId}\n reduce={reduce}\n classNames={classNames}\n onToggle={() => toggleItem(item.id)}\n />\n );\n })}\n </div>\n );\n}\n"],"mappings":";;;;;;;;AA0CA,MAAM,iBAA6B;CACjC,MAAM;CACN,UAAU;CACV,QAAQ;AACV;AAEA,MAAM,0BAAsC;CAC1C,MAAM;CACN,UAAU;CACV,QAAQ;AACV;AAEA,MAAM,2BAAuC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AiB;CAChC,MAAM,SAAS,MAAM;CACrB,MAAM,CAAC,aAAa,kBAAkB,8BAA8B;EAClE;EACA;EACA;CACF,CAAC;CACD,MAAM,cAAc,MAAM,WAAW,SAAS,KAAK,OAAO,WAAW;CAErE,MAAM,aAAa,aAChB,OAAe;EACd,IAAI,gBAAgB,IAAI;GACtB,IAAI,aACF,eAAe,IAAI;GAErB;EACF;EAEA,eAAe,EAAE;CACnB,GACA;EAAC;EAAa;EAAa;CAAc,CAC3C;CAEA,OACE,oBAAC,OAAD;EAAK,WAAW,GAAG,UAAU,WAAW,YAAY,IAAI;EACrD,UAAA,MAAM,KAAK,MAAM,UAAU;GAC1B,MAAM,OAAO,gBAAgB,KAAK;GAClC,MAAM,iBAAiB,gBAAgB,QAAQ;GAC/C,MAAM,aAAa,gBAAgB,QAAQ;GAC3C,MAAM,cAAc,QAAQ,UAAU,KAAK;GAC3C,MAAM,YAAY,QAAQ,UAAU,MAAM,SAAS,KAAK;GACxD,MAAM,wBAAwB,QAAQ,MAAM,QAAQ;GACpD,MAAM,YAAY,GAAG,OAAO,GAAG,KAAK,GAAG;GACvC,MAAM,YAAY,GAAG,OAAO,GAAG,KAAK,GAAG;GAEvC,OACE,oBAAC,oBAAD;IAEQ;IACA;IACO;IACF;IACY;IACZ;IACA;IACH;IACI;IACZ,gBAAgB,WAAW,KAAK,EAAE;GACnC,GAXM,KAAK,EAWX;EAEL,CAAC;CACE,CAAA;AAET"}
1
+ {"version":3,"file":"bouncy-accordion.js","names":[],"sources":["../../../src/components/motion/bouncy-accordion.tsx"],"sourcesContent":["\"use client\";\n\nimport { type ReactNode, useCallback, useId, useLayoutEffect, useRef, useState } from \"react\";\nimport { ChevronDown } from \"lucide-react\";\nimport { motion, type Transition, useReducedMotion } from \"motion/react\";\n\nimport { cn } from \"@kumix/utils\";\nimport { EASE_OUT } from \"../../lib/ease\";\n\nexport type BouncyAccordionItem = {\n id: string;\n title: ReactNode;\n description?: ReactNode;\n icon?: ReactNode;\n disabled?: boolean;\n};\n\nexport type BouncyAccordionClassNames = {\n root?: string;\n item?: string;\n trigger?: string;\n icon?: string;\n title?: string;\n chevron?: string;\n content?: string;\n description?: string;\n};\n\nexport interface BouncyAccordionProps {\n items: BouncyAccordionItem[];\n value?: string | null;\n defaultValue?: string | null;\n onValueChange?: (value: string | null) => void;\n collapsible?: boolean;\n className?: string;\n classNames?: BouncyAccordionClassNames;\n}\n\n// Rows, cards and scale-corrected text share a transition so their edges\n// stay joined. A close or switch uses the faster non-overshooting spring;\n// opening from all-closed keeps the weighted bounce.\nconst EXPAND_TRANSITION: Transition = {\n type: \"spring\",\n duration: 0.58,\n bounce: 0.32,\n};\n\nconst COLLAPSE_TRANSITION: Transition = {\n type: \"spring\",\n duration: 0.46,\n bounce: 0,\n};\n\nconst DESCRIPTION_TRANSITION: Transition = {\n duration: 0.18,\n ease: EASE_OUT,\n};\n\nconst CHEVRON_TRANSITION: Transition = {\n type: \"spring\",\n duration: 0.42,\n bounce: 0.28,\n};\n\nfunction useControllableAccordionValue({\n value,\n defaultValue,\n onValueChange,\n}: {\n value?: string | null;\n defaultValue?: string | null;\n onValueChange?: (value: string | null) => void;\n}) {\n const [internalValue, setInternalValue] = useState(defaultValue ?? null);\n const isControlled = value !== undefined;\n const currentValue = isControlled ? value : internalValue;\n\n const setValue = useCallback(\n (next: string | null) => {\n if (!isControlled) {\n setInternalValue(next);\n }\n\n onValueChange?.(next);\n },\n [isControlled, onValueChange],\n );\n\n return [currentValue, setValue] as const;\n}\n\nfunction BouncyAccordionRow({\n item,\n open,\n startsGroup,\n endsGroup,\n separatedFromPrevious,\n contentId,\n triggerId,\n reduce,\n layoutTransition,\n layoutDependency,\n classNames,\n onToggle,\n}: {\n item: BouncyAccordionItem;\n open: boolean;\n startsGroup: boolean;\n endsGroup: boolean;\n separatedFromPrevious: boolean;\n contentId: string;\n triggerId: string;\n reduce: boolean | null;\n layoutTransition: Transition;\n layoutDependency: string | null;\n classNames?: BouncyAccordionClassNames;\n onToggle: () => void;\n}) {\n const contentRef = useRef<HTMLDivElement>(null);\n const [contentHeight, setContentHeight] = useState(0);\n\n useLayoutEffect(() => {\n const node = contentRef.current;\n if (!node) return;\n\n const updateHeight = () => {\n setContentHeight(node.offsetHeight);\n };\n\n updateHeight();\n\n const observer = new ResizeObserver(updateHeight);\n observer.observe(node);\n\n return () => {\n observer.disconnect();\n };\n }, []);\n\n return (\n <motion.div\n layout={reduce ? false : \"position\"}\n layoutDependency={layoutDependency}\n initial={false}\n style={{ marginTop: separatedFromPrevious ? 12 : 0 }}\n transition={{ layout: layoutTransition }}\n >\n <motion.div\n data-state={open ? \"open\" : \"closed\"}\n layout={!reduce}\n layoutDependency={layoutDependency}\n initial={false}\n animate={{\n borderTopLeftRadius: startsGroup ? 28 : 0,\n borderTopRightRadius: startsGroup ? 28 : 0,\n borderBottomLeftRadius: endsGroup ? 28 : 0,\n borderBottomRightRadius: endsGroup ? 28 : 0,\n }}\n transition={reduce ? { duration: 0 } : layoutTransition}\n style={{ originY: 0 }}\n className={cn(\n \"overflow-hidden bg-card text-card-foreground\",\n item.disabled && \"opacity-50\",\n classNames?.item,\n )}\n >\n <motion.button\n id={triggerId}\n type=\"button\"\n disabled={item.disabled}\n aria-expanded={open}\n aria-controls={contentId}\n onClick={onToggle}\n layout={reduce ? false : \"position\"}\n layoutDependency={layoutDependency}\n transition={{ layout: layoutTransition }}\n style={{ originY: 0 }}\n className={cn(\n \"flex min-h-[54px] w-full items-center gap-4 px-5 text-left outline-none transition-colors\",\n \"focus-visible:bg-muted/25\",\n \"disabled:pointer-events-none\",\n classNames?.trigger,\n )}\n >\n {item.icon ? (\n <span\n className={cn(\n \"grid h-7 w-7 shrink-0 place-items-center text-muted-foreground\",\n classNames?.icon,\n )}\n >\n {item.icon}\n </span>\n ) : null}\n <span\n className={cn(\n \"min-w-0 flex-1 truncate font-medium text-[15px] text-foreground\",\n classNames?.title,\n )}\n >\n {item.title}\n </span>\n <motion.span\n aria-hidden\n animate={{ rotate: open ? 180 : 0 }}\n transition={reduce ? { duration: 0 } : CHEVRON_TRANSITION}\n className={cn(\n \"grid h-6 w-6 shrink-0 place-items-center text-muted-foreground\",\n classNames?.chevron,\n )}\n >\n <ChevronDown className=\"h-4 w-4\" />\n </motion.span>\n </motion.button>\n\n <section\n id={contentId}\n aria-labelledby={triggerId}\n aria-hidden={!open}\n inert={!open}\n style={{ height: open && item.description ? contentHeight || \"auto\" : 0 }}\n className={cn(classNames?.content)}\n >\n <motion.div\n ref={contentRef}\n // The card clips this full-size layout node. Correcting only the\n // card scale avoids a one-pixel clip and its extreme text scale.\n // Size changes outside a toggle snap to their natural geometry.\n layout={reduce ? false : \"position\"}\n layoutDependency={layoutDependency}\n initial={false}\n animate={{ opacity: open ? 1 : 0 }}\n transition={{\n opacity: reduce ? { duration: 0 } : DESCRIPTION_TRANSITION,\n layout: layoutTransition,\n }}\n style={{ originY: 0 }}\n className=\"px-5 pb-5\"\n >\n <div\n className={cn(\"text-[15px] text-muted-foreground leading-6\", classNames?.description)}\n >\n {item.description}\n </div>\n </motion.div>\n </section>\n </motion.div>\n </motion.div>\n );\n}\n\nexport function BouncyAccordion({\n items,\n value,\n defaultValue = null,\n onValueChange,\n collapsible = true,\n className,\n classNames,\n}: BouncyAccordionProps) {\n const reduce = useReducedMotion();\n const baseId = useId();\n const [activeValue, setActiveValue] = useControllableAccordionValue({\n value,\n defaultValue,\n onValueChange,\n });\n const activeIndex = items.findIndex((item) => item.id === activeValue);\n const previousValue = useRef(activeValue);\n const layoutTransition =\n activeValue === null || previousValue.current !== null\n ? COLLAPSE_TRANSITION\n : EXPAND_TRANSITION;\n useLayoutEffect(() => {\n previousValue.current = activeValue;\n }, [activeValue]);\n\n const toggleItem = useCallback(\n (id: string) => {\n if (activeValue === id) {\n if (collapsible) {\n setActiveValue(null);\n }\n return;\n }\n\n setActiveValue(id);\n },\n [activeValue, collapsible, setActiveValue],\n );\n\n return (\n <div className={cn(\"w-full\", className, classNames?.root)}>\n {items.map((item, index) => {\n const open = activeValue === item.id;\n const previousIsOpen = activeIndex === index - 1;\n const nextIsOpen = activeIndex === index + 1;\n const startsGroup = open || index === 0 || previousIsOpen;\n const endsGroup = open || index === items.length - 1 || nextIsOpen;\n const separatedFromPrevious = index > 0 && (open || previousIsOpen);\n const contentId = `${baseId}-${item.id}-content`;\n const triggerId = `${baseId}-${item.id}-trigger`;\n\n return (\n <BouncyAccordionRow\n key={item.id}\n item={item}\n open={open}\n startsGroup={startsGroup}\n endsGroup={endsGroup}\n separatedFromPrevious={separatedFromPrevious}\n contentId={contentId}\n triggerId={triggerId}\n reduce={reduce}\n layoutTransition={layoutTransition}\n layoutDependency={activeValue}\n classNames={classNames}\n onToggle={() => toggleItem(item.id)}\n />\n );\n })}\n </div>\n );\n}\n"],"mappings":";;;;;;;;AAyCA,MAAM,oBAAgC;CACpC,MAAM;CACN,UAAU;CACV,QAAQ;AACV;AAEA,MAAM,sBAAkC;CACtC,MAAM;CACN,UAAU;CACV,QAAQ;AACV;AAEA,MAAM,yBAAqC;CACzC,UAAU;CACV,MAAM;AACR;AAEA,MAAM,qBAAiC;CACrC,MAAM;CACN,UAAU;CACV,QAAQ;AACV;AAEA,SAAS,8BAA8B,EACrC,OACA,cACA,iBAKC;CACD,MAAM,CAAC,eAAe,oBAAoB,SAAS,gBAAgB,IAAI;CACvE,MAAM,eAAe,UAAU,KAAA;CAc/B,OAAO,CAbc,eAAe,QAAQ,eAE3B,aACd,SAAwB;EACvB,IAAI,CAAC,cACH,iBAAiB,IAAI;EAGvB,gBAAgB,IAAI;CACtB,GACA,CAAC,cAAc,aAAa,CAGD,CAAC;AAChC;AAEA,SAAS,mBAAmB,EAC1B,MACA,MACA,aACA,WACA,uBACA,WACA,WACA,QACA,kBACA,kBACA,YACA,YAcC;CACD,MAAM,aAAa,OAAuB,IAAI;CAC9C,MAAM,CAAC,eAAe,oBAAoB,SAAS,CAAC;CAEpD,sBAAsB;EACpB,MAAM,OAAO,WAAW;EACxB,IAAI,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CAC3C;CAEA,OACE,oBAAC,OAAD;EAAK,WAAW,GAAG,UAAU,WAAW,YAAY,IAAI;EACrD,UAAA,MAAM,KAAK,MAAM,UAAU;GAC1B,MAAM,OAAO,gBAAgB,KAAK;GAClC,MAAM,iBAAiB,gBAAgB,QAAQ;GAC/C,MAAM,aAAa,gBAAgB,QAAQ;GAC3C,MAAM,cAAc,QAAQ,UAAU,KAAK;GAC3C,MAAM,YAAY,QAAQ,UAAU,MAAM,SAAS,KAAK;GACxD,MAAM,wBAAwB,QAAQ,MAAM,QAAQ;GACpD,MAAM,YAAY,GAAG,OAAO,GAAG,KAAK,GAAG;GACvC,MAAM,YAAY,GAAG,OAAO,GAAG,KAAK,GAAG;GAEvC,OACE,oBAAC,oBAAD;IAEQ;IACA;IACO;IACF;IACY;IACZ;IACA;IACH;IACU;IAClB,kBAAkB;IACN;IACZ,gBAAgB,WAAW,KAAK,EAAE;GACnC,GAbM,KAAK,EAaX;EAEL,CAAC;CACE,CAAA;AAET"}
@@ -1 +1 @@
1
- {"version":3,"file":"stateful.d.ts","names":[],"sources":["../../../../src/components/motion/button/stateful.tsx"],"mappings":";;;YASY;iBAEK,4BAA4B,KAAK;EAChD,QAAQ;EACR,UAAU;EACV,cAAc;EACd,cAAc;EACd,YAAY;EACZ,OAAO;;qBAuII,gCAAc,0BAAA,KAAA,8CAAA,cAAA"}
1
+ {"version":3,"file":"stateful.d.ts","names":[],"sources":["../../../../src/components/motion/button/stateful.tsx"],"mappings":";;;YASY;iBAEK,4BAA4B,KAAK;EAChD,QAAQ;EACR,UAAU;EACV,cAAc;EACd,cAAc;EACd,YAAY;EACZ,OAAO;;qBA4II,gCAAc,0BAAA,KAAA,8CAAA,cAAA"}
@@ -109,6 +109,9 @@ function TextSlot({ value, children }) {
109
109
  children: label.split("").map((char, index) => /* @__PURE__ */ jsx(motion.span, {
110
110
  custom: index * CASCADE_STAGGER,
111
111
  variants: CASCADE_LETTER_VARIANTS,
112
+ initial: "initial",
113
+ animate: "animate",
114
+ exit: "exit",
112
115
  className: "inline-block whitespace-pre will-change-[opacity,filter,transform]",
113
116
  children: char
114
117
  }, index))
@@ -1 +1 @@
1
- {"version":3,"file":"stateful.js","names":[],"sources":["../../../../src/components/motion/button/stateful.tsx"],"sourcesContent":["\"use client\";\n\nimport { forwardRef, type ReactNode, useLayoutEffect, useRef, useState } from \"react\";\nimport { Check, Loader2, X } from \"lucide-react\";\nimport { AnimatePresence, motion, useReducedMotion, type Variants } from \"motion/react\";\n\nimport { EASE_OUT, SPRING_SWAP } from \"../../../lib/ease\";\nimport { Button, type ButtonProps } from \"./base\";\n\nexport type ButtonState = \"idle\" | \"loading\" | \"success\" | \"error\";\n\nexport interface StatefulButtonProps extends Omit<ButtonProps, \"children\"> {\n state?: ButtonState;\n children: ReactNode;\n loadingText?: ReactNode;\n successText?: ReactNode;\n errorText?: ReactNode;\n icon?: ReactNode;\n}\n\nconst CASCADE_STAGGER = 0.025;\nconst ROLL_BLUR = \"blur(6px)\";\n\nconst CASCADE_LETTER_VARIANTS: Variants = {\n initial: { opacity: 0, y: \"105%\", filter: ROLL_BLUR },\n animate: (delay: number = 0) => ({\n opacity: 1,\n y: \"0%\",\n filter: \"blur(0px)\",\n transition: { ...SPRING_SWAP, delay },\n }),\n exit: (delay: number = 0) => ({\n opacity: 0,\n y: \"-105%\",\n filter: ROLL_BLUR,\n transition: { duration: 0.16, ease: EASE_OUT, delay: delay * 0.5 },\n }),\n};\n\nconst ICON_VARIANTS: Variants = {\n // Width collapses too, so the icon adds/removes its own space smoothly\n // instead of popping the row width in a single frame.\n initial: { opacity: 0, width: 0, scale: 0.7, filter: ROLL_BLUR },\n animate: {\n opacity: 1,\n width: \"1.5rem\",\n scale: 1,\n filter: \"blur(0px)\",\n transition: SPRING_SWAP,\n },\n exit: {\n opacity: 0,\n width: 0,\n scale: 0.7,\n filter: ROLL_BLUR,\n transition: { duration: 0.16, ease: EASE_OUT },\n },\n};\n\nfunction IconSlot({ keyId, children }: { keyId: string; children: ReactNode }) {\n const reduce = useReducedMotion();\n return (\n <motion.span\n key={keyId}\n variants={ICON_VARIANTS}\n initial={reduce ? { opacity: 0 } : \"initial\"}\n animate={reduce ? { opacity: 1 } : \"animate\"}\n exit={reduce ? { opacity: 0 } : \"exit\"}\n transition={reduce ? { duration: 0.15 } : undefined}\n className=\"inline-grid shrink-0 place-items-center overflow-hidden\"\n >\n {children}\n </motion.span>\n );\n}\n\nfunction TextSlot({ value, children }: { value: string; children: ReactNode }) {\n const reduce = useReducedMotion();\n const measureRef = useRef<HTMLSpanElement>(null);\n const [width, setWidth] = useState<number>();\n const label = typeof children === \"string\" ? children : null;\n const cascade = label !== null && !reduce;\n\n // Measure strings with the same per-letter layout as the cascade. Measuring\n // the whole string preserves kerning, which can make it narrower than the\n // inline-block letters and clip the final glyph during the width animation.\n useLayoutEffect(() => {\n const nextWidth = measureRef.current?.offsetWidth;\n if (!nextWidth) return;\n setWidth((current) => (current === nextWidth ? current : nextWidth));\n });\n\n return (\n <motion.span\n initial={false}\n animate={{ width }}\n transition={reduce ? { duration: 0 } : SPRING_SWAP}\n className=\"relative inline-block overflow-hidden whitespace-nowrap align-bottom\"\n >\n <span ref={measureRef} aria-hidden className=\"invisible inline-block whitespace-nowrap\">\n {cascade\n ? label.split(\"\").map((char, index) => (\n <span key={index} className=\"inline-block whitespace-pre\">\n {char}\n </span>\n ))\n : children}\n </span>\n\n {cascade ? (\n <>\n <span className=\"sr-only\">{label}</span>\n <AnimatePresence initial={false}>\n <motion.span\n key={`cascade-${value}`}\n aria-hidden\n initial=\"initial\"\n animate=\"animate\"\n exit=\"exit\"\n className=\"absolute top-0 left-0 inline-block whitespace-pre\"\n >\n {label.split(\"\").map((char, index) => (\n <motion.span\n key={index}\n custom={index * CASCADE_STAGGER}\n variants={CASCADE_LETTER_VARIANTS}\n className=\"inline-block whitespace-pre will-change-[opacity,filter,transform]\"\n >\n {char}\n </motion.span>\n ))}\n </motion.span>\n </AnimatePresence>\n </>\n ) : (\n <AnimatePresence initial={false}>\n <motion.span\n key={`text-${value}`}\n initial={reduce ? { opacity: 0 } : { opacity: 0, y: 14, filter: ROLL_BLUR }}\n animate={reduce ? { opacity: 1 } : { opacity: 1, y: 0, filter: \"blur(0px)\" }}\n exit={reduce ? { opacity: 0 } : { opacity: 0, y: -14, filter: ROLL_BLUR }}\n transition={reduce ? { duration: 0.15 } : SPRING_SWAP}\n className=\"absolute top-0 left-0 inline-block will-change-[opacity,filter,transform]\"\n >\n {children}\n </motion.span>\n </AnimatePresence>\n )}\n </motion.span>\n );\n}\n\nexport const StatefulButton = forwardRef<HTMLButtonElement, StatefulButtonProps>(\n function StatefulButton(\n {\n state = \"idle\",\n children,\n loadingText = \"Loading\",\n successText = \"Done\",\n errorText = \"Try again\",\n icon,\n disabled,\n ...rest\n },\n ref,\n ) {\n const isBusy = state === \"loading\";\n const stateText =\n state === \"loading\"\n ? loadingText\n : state === \"success\"\n ? successText\n : state === \"error\"\n ? errorText\n : children;\n const textKey = typeof stateText === \"string\" ? `${state}-${stateText}` : state;\n\n return (\n <Button\n ref={ref}\n disabled={disabled || isBusy}\n aria-busy={isBusy}\n whileHover={undefined}\n {...rest}\n >\n <span\n aria-live=\"polite\"\n className=\"relative inline-flex items-center justify-center overflow-hidden\"\n >\n <AnimatePresence initial={false}>\n {state === \"loading\" ? (\n <IconSlot keyId=\"loading-icon\">\n <Loader2 className=\"h-4 w-4 animate-spin\" />\n </IconSlot>\n ) : null}\n {state === \"success\" ? (\n <IconSlot keyId=\"success-icon\">\n <Check className=\"h-4 w-4\" />\n </IconSlot>\n ) : null}\n {state === \"error\" ? (\n <IconSlot keyId=\"error-icon\">\n <X className=\"h-4 w-4\" />\n </IconSlot>\n ) : null}\n </AnimatePresence>\n\n <TextSlot value={textKey}>{stateText}</TextSlot>\n\n <AnimatePresence initial={false}>\n {state === \"idle\" && icon ? <IconSlot keyId=\"idle-icon\">{icon}</IconSlot> : null}\n </AnimatePresence>\n </span>\n </Button>\n );\n },\n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AAA,CAER;;AAEjB;AAEA,MAAa,iBAAiB,WAC5B,SAAS,eACP,EACE,QAAQ,QACR,UACA,cAAc,WACd,cAAc,QACd,YAAY,aACZ,MACA,UACA,GAAG,QAEL,KACA;CACA,MAAM,SAAS,UAAU;CACzB,MAAM,YACJ,UAAU,YACN,cACA,UAAU,YACR,cACA,UAAU,UACR,YACA;CACV,MAAM,UAAU,OAAO,cAAc,WAAW,GAAG,MAAM,GAAG,cAAc;CAE1E,OACE,oBAAC,QAAD;EACO;EACL,UAAU,YAAY;EACtB,aAAW;EACX,YAAY,KAAA;EACZ,GAAI;EAEJ,UAAA,qBAAC,QAAD;GACE,aAAU;GACV,WAAU;GAFZ,UAAA;IAIE,qBAAC,iBAAD;KAAiB,SAAS;KAA1B,UAAA;MACG,UAAU,YACT,oBAAC,UAAD;OAAU,OAAM;OACd,UAAA,oBAAC,SAAD,EAAS,WAAU,uBAAwB,CAAA;MACnC,CAAA,IACR;MACH,UAAU,YACT,oBAAC,UAAD;OAAU,OAAM;OACd,UAAA,oBAAC,OAAD,EAAO,WAAU,UAAW,CAAA;MACpB,CAAA,IACR;MACH,UAAU,UACT,oBAAC,UAAD;OAAU,OAAM;OACd,UAAA,oBAAC,GAAD,EAAG,WAAU,UAAW,CAAA;MAChB,CAAA,IACR;KACW;;IAEjB,oBAAC,UAAD;KAAU,OAAO;KAAU,UAAA;IAAoB,CAAA;IAE/C,oBAAC,iBAAD;KAAiB,SAAS;KACvB,UAAA,UAAU,UAAU,OAAO,oBAAC,UAAD;MAAU,OAAM;MAAa,UAAA;KAAe,CAAA,IAAI;IAC7D,CAAA;GACb;;CACA,CAAA;AAEZ,CACF"}
1
+ {"version":3,"file":"stateful.js","names":[],"sources":["../../../../src/components/motion/button/stateful.tsx"],"sourcesContent":["\"use client\";\n\nimport { forwardRef, type ReactNode, useLayoutEffect, useRef, useState } from \"react\";\nimport { Check, Loader2, X } from \"lucide-react\";\nimport { AnimatePresence, motion, useReducedMotion, type Variants } from \"motion/react\";\n\nimport { EASE_OUT, SPRING_SWAP } from \"../../../lib/ease\";\nimport { Button, type ButtonProps } from \"./base\";\n\nexport type ButtonState = \"idle\" | \"loading\" | \"success\" | \"error\";\n\nexport interface StatefulButtonProps extends Omit<ButtonProps, \"children\"> {\n state?: ButtonState;\n children: ReactNode;\n loadingText?: ReactNode;\n successText?: ReactNode;\n errorText?: ReactNode;\n icon?: ReactNode;\n}\n\nconst CASCADE_STAGGER = 0.025;\nconst ROLL_BLUR = \"blur(6px)\";\n\nconst CASCADE_LETTER_VARIANTS: Variants = {\n initial: { opacity: 0, y: \"105%\", filter: ROLL_BLUR },\n animate: (delay: number = 0) => ({\n opacity: 1,\n y: \"0%\",\n filter: \"blur(0px)\",\n transition: { ...SPRING_SWAP, delay },\n }),\n exit: (delay: number = 0) => ({\n opacity: 0,\n y: \"-105%\",\n filter: ROLL_BLUR,\n transition: { duration: 0.16, ease: EASE_OUT, delay: delay * 0.5 },\n }),\n};\n\nconst ICON_VARIANTS: Variants = {\n // Width collapses too, so the icon adds/removes its own space smoothly\n // instead of popping the row width in a single frame.\n initial: { opacity: 0, width: 0, scale: 0.7, filter: ROLL_BLUR },\n animate: {\n opacity: 1,\n width: \"1.5rem\",\n scale: 1,\n filter: \"blur(0px)\",\n transition: SPRING_SWAP,\n },\n exit: {\n opacity: 0,\n width: 0,\n scale: 0.7,\n filter: ROLL_BLUR,\n transition: { duration: 0.16, ease: EASE_OUT },\n },\n};\n\nfunction IconSlot({ keyId, children }: { keyId: string; children: ReactNode }) {\n const reduce = useReducedMotion();\n return (\n <motion.span\n key={keyId}\n variants={ICON_VARIANTS}\n initial={reduce ? { opacity: 0 } : \"initial\"}\n animate={reduce ? { opacity: 1 } : \"animate\"}\n exit={reduce ? { opacity: 0 } : \"exit\"}\n transition={reduce ? { duration: 0.15 } : undefined}\n className=\"inline-grid shrink-0 place-items-center overflow-hidden\"\n >\n {children}\n </motion.span>\n );\n}\n\nfunction TextSlot({ value, children }: { value: string; children: ReactNode }) {\n const reduce = useReducedMotion();\n const measureRef = useRef<HTMLSpanElement>(null);\n const [width, setWidth] = useState<number>();\n const label = typeof children === \"string\" ? children : null;\n const cascade = label !== null && !reduce;\n\n // Measure strings with the same per-letter layout as the cascade. Measuring\n // the whole string preserves kerning, which can make it narrower than the\n // inline-block letters and clip the final glyph during the width animation.\n useLayoutEffect(() => {\n const nextWidth = measureRef.current?.offsetWidth;\n if (!nextWidth) return;\n setWidth((current) => (current === nextWidth ? current : nextWidth));\n });\n\n return (\n <motion.span\n initial={false}\n animate={{ width }}\n transition={reduce ? { duration: 0 } : SPRING_SWAP}\n className=\"relative inline-block overflow-hidden whitespace-nowrap align-bottom\"\n >\n <span ref={measureRef} aria-hidden className=\"invisible inline-block whitespace-nowrap\">\n {cascade\n ? label.split(\"\").map((char, index) => (\n <span key={index} className=\"inline-block whitespace-pre\">\n {char}\n </span>\n ))\n : children}\n </span>\n\n {cascade ? (\n <>\n <span className=\"sr-only\">{label}</span>\n <AnimatePresence initial={false}>\n <motion.span\n key={`cascade-${value}`}\n aria-hidden\n initial=\"initial\"\n animate=\"animate\"\n exit=\"exit\"\n className=\"absolute top-0 left-0 inline-block whitespace-pre\"\n >\n {label.split(\"\").map((char, index) => (\n <motion.span\n key={index}\n custom={index * CASCADE_STAGGER}\n variants={CASCADE_LETTER_VARIANTS}\n // Own states: a label that swaps away and straight back\n // re-enters mid-exit, and only owned targets are restored.\n initial=\"initial\"\n animate=\"animate\"\n exit=\"exit\"\n className=\"inline-block whitespace-pre will-change-[opacity,filter,transform]\"\n >\n {char}\n </motion.span>\n ))}\n </motion.span>\n </AnimatePresence>\n </>\n ) : (\n <AnimatePresence initial={false}>\n <motion.span\n key={`text-${value}`}\n initial={reduce ? { opacity: 0 } : { opacity: 0, y: 14, filter: ROLL_BLUR }}\n animate={reduce ? { opacity: 1 } : { opacity: 1, y: 0, filter: \"blur(0px)\" }}\n exit={reduce ? { opacity: 0 } : { opacity: 0, y: -14, filter: ROLL_BLUR }}\n transition={reduce ? { duration: 0.15 } : SPRING_SWAP}\n className=\"absolute top-0 left-0 inline-block will-change-[opacity,filter,transform]\"\n >\n {children}\n </motion.span>\n </AnimatePresence>\n )}\n </motion.span>\n );\n}\n\nexport const StatefulButton = forwardRef<HTMLButtonElement, StatefulButtonProps>(\n function StatefulButton(\n {\n state = \"idle\",\n children,\n loadingText = \"Loading\",\n successText = \"Done\",\n errorText = \"Try again\",\n icon,\n disabled,\n ...rest\n },\n ref,\n ) {\n const isBusy = state === \"loading\";\n const stateText =\n state === \"loading\"\n ? loadingText\n : state === \"success\"\n ? successText\n : state === \"error\"\n ? errorText\n : children;\n const textKey = typeof stateText === \"string\" ? `${state}-${stateText}` : state;\n\n return (\n <Button\n ref={ref}\n disabled={disabled || isBusy}\n aria-busy={isBusy}\n whileHover={undefined}\n {...rest}\n >\n <span\n aria-live=\"polite\"\n className=\"relative inline-flex items-center justify-center overflow-hidden\"\n >\n <AnimatePresence initial={false}>\n {state === \"loading\" ? (\n <IconSlot keyId=\"loading-icon\">\n <Loader2 className=\"h-4 w-4 animate-spin\" />\n </IconSlot>\n ) : null}\n {state === \"success\" ? (\n <IconSlot keyId=\"success-icon\">\n <Check className=\"h-4 w-4\" />\n </IconSlot>\n ) : null}\n {state === \"error\" ? (\n <IconSlot keyId=\"error-icon\">\n <X className=\"h-4 w-4\" />\n </IconSlot>\n ) : null}\n </AnimatePresence>\n\n <TextSlot value={textKey}>{stateText}</TextSlot>\n\n <AnimatePresence initial={false}>\n {state === \"idle\" && icon ? <IconSlot keyId=\"idle-icon\">{icon}</IconSlot> : null}\n </AnimatePresence>\n </span>\n </Button>\n );\n },\n);\n"],"mappings":";;;;;;;;AAoBA,MAAM,kBAAkB;AACxB,MAAM,YAAY;AAElB,MAAM,0BAAoC;CACxC,SAAS;EAAE,SAAS;EAAG,GAAG;EAAQ,QAAQ;CAAU;CACpD,UAAU,QAAgB,OAAO;EAC/B,SAAS;EACT,GAAG;EACH,QAAQ;EACR,YAAY;G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ACJ,UAAU,YACN,cACA,UAAU,YACR,cACA,UAAU,UACR,YACA;CACV,MAAM,UAAU,OAAO,cAAc,WAAW,GAAG,MAAM,GAAG,cAAc;CAE1E,OACE,oBAAC,QAAD;EACO;EACL,UAAU,YAAY;EACtB,aAAW;EACX,YAAY,KAAA;EACZ,GAAI;EAEJ,UAAA,qBAAC,QAAD;GACE,aAAU;GACV,WAAU;GAFZ,UAAA;IAIE,qBAAC,iBAAD;KAAiB,SAAS;KAA1B,UAAA;MACG,UAAU,YACT,oBAAC,UAAD;OAAU,OAAM;OACd,UAAA,oBAAC,SAAD,EAAS,WAAU,uBAAwB,CAAA;MACnC,CAAA,IACR;MACH,UAAU,YACT,oBAAC,UAAD;OAAU,OAAM;OACd,UAAA,oBAAC,OAAD,EAAO,WAAU,UAAW,CAAA;MACpB,CAAA,IACR;MACH,UAAU,UACT,oBAAC,UAAD;OAAU,OAAM;OACd,UAAA,oBAAC,GAAD,EAAG,WAAU,UAAW,CAAA;MAChB,CAAA,IACR;KACW;;IAEjB,oBAAC,UAAD;KAAU,OAAO;KAAU,UAAA;IAAoB,CAAA;IAE/C,oBAAC,iBAAD;KAAiB,SAAS;KACvB,UAAA,UAAU,UAAU,OAAO,oBAAC,UAAD;MAAU,OAAM;MAAa,UAAA;KAAe,CAAA,IAAI;IAC7D,CAAA;GACb;;CACA,CAAA;AAEZ,CACF"}
@@ -0,0 +1,44 @@
1
+ import { ComponentPropsWithRef } from "react";
2
+ //#region src/components/motion/card.d.ts
3
+ export type CardVariant = "outlined" | "muted";
4
+ export type CardSize = "default" | "compact";
5
+ /**
6
+ * Spread onto the one control that owns a card (a Checkbox or RadioGroupItem
7
+ * root, or a link or button) to stretch its hit area over the whole card. Any
8
+ * other interactive element inside that card needs `relative z-10` to stay on top.
9
+ */
10
+ export declare const CARD_TARGET_CLASS = "after:absolute after:inset-0";
11
+ export interface CardProps extends ComponentPropsWithRef<"div"> {
12
+ /** Default "outlined". */
13
+ variant?: CardVariant;
14
+ /** Spacing for every part. Default "default". */
15
+ size?: CardSize;
16
+ /**
17
+ * Hover and press feedback, for a card that is one target as a whole. Visual
18
+ * only: the card never takes focus, so put the control that owns it inside
19
+ * and stretch it with `CARD_TARGET_CLASS`.
20
+ */
21
+ interactive?: boolean;
22
+ /** Marks a selectable card as chosen. Visual only; the control inside carries the state. */
23
+ selected?: boolean;
24
+ }
25
+ export declare function Card({ variant, size, interactive, selected, className, children, style, onPointerDown, ...props }: CardProps): import("react").JSX.Element;
26
+ export type CardHeaderProps = ComponentPropsWithRef<"div">;
27
+ /** Title and description, with an optional CardAction pinned to the top right. */
28
+ export declare function CardHeader({ className, ...props }: CardHeaderProps): import("react").JSX.Element;
29
+ export interface CardTitleProps extends ComponentPropsWithRef<"div"> {
30
+ /** Heading level, when the card starts a section. Default "div". */
31
+ as?: "div" | "h2" | "h3" | "h4";
32
+ }
33
+ export declare function CardTitle({ as: Tag, className, ...props }: CardTitleProps): import("react").JSX.Element;
34
+ export type CardDescriptionProps = ComponentPropsWithRef<"p">;
35
+ export declare function CardDescription({ className, ...props }: CardDescriptionProps): import("react").JSX.Element;
36
+ export type CardActionProps = ComponentPropsWithRef<"div">;
37
+ /** Sits beside the title and description inside CardHeader. */
38
+ export declare function CardAction({ className, ...props }: CardActionProps): import("react").JSX.Element;
39
+ export type CardContentProps = ComponentPropsWithRef<"div">;
40
+ export declare function CardContent({ className, ...props }: CardContentProps): import("react").JSX.Element;
41
+ export type CardFooterProps = ComponentPropsWithRef<"div">;
42
+ export declare function CardFooter({ className, ...props }: CardFooterProps): import("react").JSX.Element;
43
+ //#endregion
44
+ //# sourceMappingURL=card.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"card.d.ts","names":[],"sources":["../../../src/components/motion/card.tsx"],"mappings":";;YAQY;YACA;;;;;;qBAyBC;iBAEI,kBAAkB;;EAEjC,UAAU;;EAEV,OAAO;;;;;;EAMP;;EAEA;;wBAGc,OACd,SACA,MACA,aACA,UACA,WACA,UACA,OACA,kBACG,SACF,4BAAS,IAAA;YAqEA,kBAAkB;;wBAGd,aAAa,cAAc,SAAS,kCAAe,IAAA;iBAgBlD,uBAAuB;;EAEtC;;wBAGc,YAAY,IAAI,KAAa,cAAc,SAAS,iCAAc,IAAA;YAUtE,uBAAuB;wBAEnB,kBAAkB,cAAc,SAAS,uCAAoB,IAAA;YAUjE,kBAAkB;;wBAGd,aAAa,cAAc,SAAS,kCAAe,IAAA;YAevD,mBAAmB;wBAEf,cAAc,cAAc,SAAS,mCAAgB,IAAA;YAWzD,kBAAkB;wBAEd,aAAa,cAAc,SAAS,kCAAe,IAAA"}