@kumix/ui 0.3.12 → 0.3.13

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 (530) hide show
  1. package/README.md +1 -1
  2. package/dist/components/agents/agent-activity/activity-row.js +2 -2
  3. package/dist/components/agents/agent-activity/activity-row.js.map +1 -1
  4. package/dist/components/agents/agent-activity/index.js +2 -2
  5. package/dist/components/agents/agent-activity/index.js.map +1 -1
  6. package/dist/components/agents/agent-code.d.ts.map +1 -1
  7. package/dist/components/agents/agent-code.js +2 -2
  8. package/dist/components/agents/agent-code.js.map +1 -1
  9. package/dist/components/agents/agent-disclosure.js +1 -1
  10. package/dist/components/agents/agent-disclosure.js.map +1 -1
  11. package/dist/components/agents/ai-sidebar.js +2 -2
  12. package/dist/components/agents/ai-sidebar.js.map +1 -1
  13. package/dist/components/agents/approval-card/index.js +2 -2
  14. package/dist/components/agents/approval-card/index.js.map +1 -1
  15. package/dist/components/agents/chat-app.js +1 -1
  16. package/dist/components/agents/chat-app.js.map +1 -1
  17. package/dist/components/agents/citations.js +2 -2
  18. package/dist/components/agents/citations.js.map +1 -1
  19. package/dist/components/agents/code-block.js +2 -2
  20. package/dist/components/agents/code-block.js.map +1 -1
  21. package/dist/components/agents/file-diff.js +2 -2
  22. package/dist/components/agents/file-diff.js.map +1 -1
  23. package/dist/components/agents/image-generation.js +2 -2
  24. package/dist/components/agents/image-generation.js.map +1 -1
  25. package/dist/components/agents/loading-states/agent-progress.js +1 -1
  26. package/dist/components/agents/loading-states/agent-progress.js.map +1 -1
  27. package/dist/components/agents/loading-states/reasoning-text.js +1 -1
  28. package/dist/components/agents/loading-states/reasoning-text.js.map +1 -1
  29. package/dist/components/agents/loading-states/thinking-shimmer.js +1 -1
  30. package/dist/components/agents/loading-states/thinking-shimmer.js.map +1 -1
  31. package/dist/components/agents/message-bubble.js +2 -2
  32. package/dist/components/agents/message-bubble.js.map +1 -1
  33. package/dist/components/agents/message-scroller.js +1 -1
  34. package/dist/components/agents/message-scroller.js.map +1 -1
  35. package/dist/components/agents/message.js +1 -1
  36. package/dist/components/agents/message.js.map +1 -1
  37. package/dist/components/agents/prompt-input.js +2 -2
  38. package/dist/components/agents/prompt-input.js.map +1 -1
  39. package/dist/components/agents/streaming-response.js +2 -2
  40. package/dist/components/agents/streaming-response.js.map +1 -1
  41. package/dist/components/agents/todo-list.js +2 -2
  42. package/dist/components/agents/todo-list.js.map +1 -1
  43. package/dist/components/agents/tool-approval.js +2 -2
  44. package/dist/components/agents/tool-approval.js.map +1 -1
  45. package/dist/components/agents/tool-result.js +2 -2
  46. package/dist/components/agents/tool-result.js.map +1 -1
  47. package/dist/components/custom/confirm-dialog.js +1 -1
  48. package/dist/components/motion/action-swap.js +1 -1
  49. package/dist/components/motion/action-swap.js.map +1 -1
  50. package/dist/components/motion/adaptive-stepper.js +2 -2
  51. package/dist/components/motion/adaptive-stepper.js.map +1 -1
  52. package/dist/components/motion/animated-badge.js +2 -2
  53. package/dist/components/motion/animated-badge.js.map +1 -1
  54. package/dist/components/motion/animated-number.js +1 -1
  55. package/dist/components/motion/animated-number.js.map +1 -1
  56. package/dist/components/motion/animated-sidebar.js +2 -2
  57. package/dist/components/motion/animated-sidebar.js.map +1 -1
  58. package/dist/components/motion/animated-toast-stack.js +2 -2
  59. package/dist/components/motion/animated-toast-stack.js.map +1 -1
  60. package/dist/components/motion/attachment-upload.js +2 -2
  61. package/dist/components/motion/attachment-upload.js.map +1 -1
  62. package/dist/components/motion/availability-scheduler/copy-menu.js +1 -1
  63. package/dist/components/motion/availability-scheduler/day-row.js +2 -2
  64. package/dist/components/motion/availability-scheduler/icon-button.js +1 -1
  65. package/dist/components/motion/availability-scheduler/icon-button.js.map +1 -1
  66. package/dist/components/motion/availability-scheduler/index.js +2 -2
  67. package/dist/components/motion/availability-scheduler/index.js.map +1 -1
  68. package/dist/components/motion/bloom-menu.js +2 -2
  69. package/dist/components/motion/bloom-menu.js.map +1 -1
  70. package/dist/components/motion/bottom-sheet.js +1 -1
  71. package/dist/components/motion/bottom-sheet.js.map +1 -1
  72. package/dist/components/motion/bounce-sidebar.d.ts.map +1 -1
  73. package/dist/components/motion/bounce-sidebar.js +1 -1
  74. package/dist/components/motion/bounce-sidebar.js.map +1 -1
  75. package/dist/components/motion/bouncy-accordion.js +2 -2
  76. package/dist/components/motion/bouncy-accordion.js.map +1 -1
  77. package/dist/components/motion/button/base.js +1 -1
  78. package/dist/components/motion/button/base.js.map +1 -1
  79. package/dist/components/motion/button/metallic.js +1 -1
  80. package/dist/components/motion/button/metallic.js.map +1 -1
  81. package/dist/components/motion/button/stateful.js +1 -1
  82. package/dist/components/motion/card-folder.d.ts +30 -0
  83. package/dist/components/motion/card-folder.d.ts.map +1 -0
  84. package/dist/components/motion/card-folder.js +254 -0
  85. package/dist/components/motion/card-folder.js.map +1 -0
  86. package/dist/components/motion/center-morph-modal.js +2 -2
  87. package/dist/components/motion/center-morph-modal.js.map +1 -1
  88. package/dist/components/motion/checkbox.js +1 -1
  89. package/dist/components/motion/checkbox.js.map +1 -1
  90. package/dist/components/motion/chromatic-text-reveal.js +1 -1
  91. package/dist/components/motion/chromatic-text-reveal.js.map +1 -1
  92. package/dist/components/motion/combobox/content.js +1 -1
  93. package/dist/components/motion/combobox/content.js.map +1 -1
  94. package/dist/components/motion/combobox/context.js +1 -1
  95. package/dist/components/motion/combobox/context.js.map +1 -1
  96. package/dist/components/motion/combobox/list.js +2 -2
  97. package/dist/components/motion/combobox/list.js.map +1 -1
  98. package/dist/components/motion/combobox/trigger.js +2 -2
  99. package/dist/components/motion/combobox/trigger.js.map +1 -1
  100. package/dist/components/motion/command-palette.js +2 -2
  101. package/dist/components/motion/command-palette.js.map +1 -1
  102. package/dist/components/motion/context-menu.js +2 -2
  103. package/dist/components/motion/context-menu.js.map +1 -1
  104. package/dist/components/motion/cylinder-carousel.js +1 -1
  105. package/dist/components/motion/cylinder-carousel.js.map +1 -1
  106. package/dist/components/motion/digit-swap.d.ts +23 -0
  107. package/dist/components/motion/digit-swap.d.ts.map +1 -0
  108. package/dist/components/motion/digit-swap.js +77 -0
  109. package/dist/components/motion/digit-swap.js.map +1 -0
  110. package/dist/components/motion/dock.js +1 -1
  111. package/dist/components/motion/dock.js.map +1 -1
  112. package/dist/components/motion/drawer.js +1 -1
  113. package/dist/components/motion/drawer.js.map +1 -1
  114. package/dist/components/motion/dynamic-island.js +1 -1
  115. package/dist/components/motion/dynamic-island.js.map +1 -1
  116. package/dist/components/motion/expandable-action-bar.js +1 -1
  117. package/dist/components/motion/expandable-action-bar.js.map +1 -1
  118. package/dist/components/motion/expandable-control.d.ts.map +1 -1
  119. package/dist/components/motion/expandable-control.js +1 -1
  120. package/dist/components/motion/expandable-control.js.map +1 -1
  121. package/dist/components/motion/expandable-tabs.js +1 -1
  122. package/dist/components/motion/expandable-tabs.js.map +1 -1
  123. package/dist/components/motion/expanding-arrow-button.js +1 -1
  124. package/dist/components/motion/expanding-arrow-button.js.map +1 -1
  125. package/dist/components/motion/feedback-widget.js +2 -2
  126. package/dist/components/motion/feedback-widget.js.map +1 -1
  127. package/dist/components/motion/file-tree.js +2 -2
  128. package/dist/components/motion/file-tree.js.map +1 -1
  129. package/dist/components/motion/file-upload.js +2 -2
  130. package/dist/components/motion/file-upload.js.map +1 -1
  131. package/dist/components/motion/hold-action-button.js +1 -1
  132. package/dist/components/motion/hold-action-button.js.map +1 -1
  133. package/dist/components/motion/infinite-masonry.js +2 -2
  134. package/dist/components/motion/infinite-masonry.js.map +1 -1
  135. package/dist/components/motion/input.d.ts.map +1 -1
  136. package/dist/components/motion/input.js +1 -1
  137. package/dist/components/motion/input.js.map +1 -1
  138. package/dist/components/motion/liquid.js +1 -1
  139. package/dist/components/motion/liquid.js.map +1 -1
  140. package/dist/components/motion/loader.js +1 -1
  141. package/dist/components/motion/loader.js.map +1 -1
  142. package/dist/components/motion/magnetic.js +1 -1
  143. package/dist/components/motion/magnetic.js.map +1 -1
  144. package/dist/components/motion/marquee.d.ts.map +1 -1
  145. package/dist/components/motion/marquee.js +1 -1
  146. package/dist/components/motion/marquee.js.map +1 -1
  147. package/dist/components/motion/morphing-modal.js +1 -1
  148. package/dist/components/motion/morphing-modal.js.map +1 -1
  149. package/dist/components/motion/morphing-search.js +2 -2
  150. package/dist/components/motion/morphing-search.js.map +1 -1
  151. package/dist/components/motion/morphing-tabs.js +2 -2
  152. package/dist/components/motion/morphing-tabs.js.map +1 -1
  153. package/dist/components/motion/multi-select/content.js +1 -1
  154. package/dist/components/motion/multi-select/content.js.map +1 -1
  155. package/dist/components/motion/multi-select/context.js +1 -1
  156. package/dist/components/motion/multi-select/context.js.map +1 -1
  157. package/dist/components/motion/multi-select/list.js +2 -2
  158. package/dist/components/motion/multi-select/list.js.map +1 -1
  159. package/dist/components/motion/multi-select/trigger.js +2 -2
  160. package/dist/components/motion/multi-select/trigger.js.map +1 -1
  161. package/dist/components/motion/not-found/magnetic.d.ts.map +1 -1
  162. package/dist/components/motion/not-found/magnetic.js +1 -1
  163. package/dist/components/motion/not-found/magnetic.js.map +1 -1
  164. package/dist/components/motion/not-found/shared.js +1 -1
  165. package/dist/components/motion/not-found/shared.js.map +1 -1
  166. package/dist/components/motion/not-found/spotlight.js +1 -1
  167. package/dist/components/motion/not-found/spotlight.js.map +1 -1
  168. package/dist/components/motion/notification-stack.js +2 -2
  169. package/dist/components/motion/notification-stack.js.map +1 -1
  170. package/dist/components/motion/number-ticker.js +1 -1
  171. package/dist/components/motion/number-ticker.js.map +1 -1
  172. package/dist/components/motion/otp-input.js +1 -1
  173. package/dist/components/motion/otp-input.js.map +1 -1
  174. package/dist/components/motion/overflow-actions.js +2 -2
  175. package/dist/components/motion/overflow-actions.js.map +1 -1
  176. package/dist/components/motion/parallax.d.ts.map +1 -1
  177. package/dist/components/motion/parallax.js +1 -1
  178. package/dist/components/motion/parallax.js.map +1 -1
  179. package/dist/components/motion/popover-morph.js +1 -1
  180. package/dist/components/motion/popover-morph.js.map +1 -1
  181. package/dist/components/motion/popover.js +1 -1
  182. package/dist/components/motion/popover.js.map +1 -1
  183. package/dist/components/motion/preview-rail.js +1 -1
  184. package/dist/components/motion/preview-rail.js.map +1 -1
  185. package/dist/components/motion/project-folder.js +2 -2
  186. package/dist/components/motion/project-folder.js.map +1 -1
  187. package/dist/components/motion/pull-to-refresh.js +1 -1
  188. package/dist/components/motion/pull-to-refresh.js.map +1 -1
  189. package/dist/components/motion/radio.js +1 -1
  190. package/dist/components/motion/radio.js.map +1 -1
  191. package/dist/components/motion/range-slider-bubble.js +1 -1
  192. package/dist/components/motion/range-slider-bubble.js.map +1 -1
  193. package/dist/components/motion/range-slider-fluid.js +1 -1
  194. package/dist/components/motion/range-slider-fluid.js.map +1 -1
  195. package/dist/components/motion/range-slider-ruler.js +1 -1
  196. package/dist/components/motion/range-slider-ruler.js.map +1 -1
  197. package/dist/components/motion/range-slider-wave.js +1 -1
  198. package/dist/components/motion/range-slider-wave.js.map +1 -1
  199. package/dist/components/motion/range-slider.js +1 -1
  200. package/dist/components/motion/range-slider.js.map +1 -1
  201. package/dist/components/motion/scroll-progress.js +1 -1
  202. package/dist/components/motion/scroll-progress.js.map +1 -1
  203. package/dist/components/motion/scroll-reveal.js +1 -1
  204. package/dist/components/motion/scroll-reveal.js.map +1 -1
  205. package/dist/components/motion/scroll-to.js +1 -1
  206. package/dist/components/motion/scroll-to.js.map +1 -1
  207. package/dist/components/motion/select-morph.d.ts.map +1 -1
  208. package/dist/components/motion/select-morph.js +2 -2
  209. package/dist/components/motion/select-morph.js.map +1 -1
  210. package/dist/components/motion/select.js +2 -2
  211. package/dist/components/motion/select.js.map +1 -1
  212. package/dist/components/motion/shader-background.d.ts.map +1 -1
  213. package/dist/components/motion/shader-background.js +1 -1
  214. package/dist/components/motion/shader-background.js.map +1 -1
  215. package/dist/components/motion/shared-layout-bg.js +1 -1
  216. package/dist/components/motion/shared-layout-bg.js.map +1 -1
  217. package/dist/components/motion/signup-form.js +2 -2
  218. package/dist/components/motion/signup-form.js.map +1 -1
  219. package/dist/components/motion/slide-action-button.js +1 -1
  220. package/dist/components/motion/slide-action-button.js.map +1 -1
  221. package/dist/components/motion/swipeable-list.js +1 -1
  222. package/dist/components/motion/swipeable-list.js.map +1 -1
  223. package/dist/components/motion/switch.d.ts.map +1 -1
  224. package/dist/components/motion/switch.js +1 -1
  225. package/dist/components/motion/switch.js.map +1 -1
  226. package/dist/components/motion/table/index.js +1 -1
  227. package/dist/components/motion/table/index.js.map +1 -1
  228. package/dist/components/motion/table/row-handle.js +1 -1
  229. package/dist/components/motion/table/skeleton-rows.d.ts.map +1 -1
  230. package/dist/components/motion/table/skeleton-rows.js +1 -1
  231. package/dist/components/motion/table/skeleton-rows.js.map +1 -1
  232. package/dist/components/motion/table/table-header.js +2 -2
  233. package/dist/components/motion/table/table-header.js.map +1 -1
  234. package/dist/components/motion/table/table-menu.js +1 -1
  235. package/dist/components/motion/table/table-menu.js.map +1 -1
  236. package/dist/components/motion/tabs.js +1 -1
  237. package/dist/components/motion/tabs.js.map +1 -1
  238. package/dist/components/motion/text-reveal.js +1 -1
  239. package/dist/components/motion/text-reveal.js.map +1 -1
  240. package/dist/components/motion/text-scramble.d.ts.map +1 -1
  241. package/dist/components/motion/text-scramble.js +1 -1
  242. package/dist/components/motion/text-scramble.js.map +1 -1
  243. package/dist/components/motion/text-shimmer.js +1 -1
  244. package/dist/components/motion/text-shimmer.js.map +1 -1
  245. package/dist/components/motion/theme-toggle.js +2 -2
  246. package/dist/components/motion/theme-toggle.js.map +1 -1
  247. package/dist/components/motion/tilt-card.js +1 -1
  248. package/dist/components/motion/tilt-card.js.map +1 -1
  249. package/dist/components/motion/tooltip.js +1 -1
  250. package/dist/components/motion/tooltip.js.map +1 -1
  251. package/dist/components/motion/wheel-picker.js +1 -1
  252. package/dist/components/motion/wheel-picker.js.map +1 -1
  253. package/dist/components/reui/alert.d.ts +1 -1
  254. package/dist/components/reui/alert.d.ts.map +1 -1
  255. package/dist/components/reui/alert.js +2 -2
  256. package/dist/components/reui/alert.js.map +1 -1
  257. package/dist/components/reui/autocomplete.d.ts +1 -1
  258. package/dist/components/reui/autocomplete.js +2 -2
  259. package/dist/components/reui/autocomplete.js.map +1 -1
  260. package/dist/components/reui/badge.d.ts +2 -2
  261. package/dist/components/reui/badge.d.ts.map +1 -1
  262. package/dist/components/reui/badge.js +1 -1
  263. package/dist/components/reui/badge.js.map +1 -1
  264. package/dist/components/reui/cascader/cascader-columns.js +2 -2
  265. package/dist/components/reui/cascader/cascader-columns.js.map +1 -1
  266. package/dist/components/reui/cascader/cascader-footer.js +2 -2
  267. package/dist/components/reui/cascader/cascader-footer.js.map +1 -1
  268. package/dist/components/reui/cascader/cascader-item.js +2 -2
  269. package/dist/components/reui/cascader/cascader-item.js.map +1 -1
  270. package/dist/components/reui/cascader/cascader-nav.js +2 -2
  271. package/dist/components/reui/cascader/cascader-nav.js.map +1 -1
  272. package/dist/components/reui/cascader/cascader.js +2 -2
  273. package/dist/components/reui/cascader/cascader.js.map +1 -1
  274. package/dist/components/reui/code-block/code-block.js +1 -1
  275. package/dist/components/reui/code-block/code-block.js.map +1 -1
  276. package/dist/components/reui/data-grid/data-grid-cell-selection.js +1 -1
  277. package/dist/components/reui/data-grid/data-grid-cell-selection.js.map +1 -1
  278. package/dist/components/reui/data-grid/data-grid-column-filter.js +2 -2
  279. package/dist/components/reui/data-grid/data-grid-column-filter.js.map +1 -1
  280. package/dist/components/reui/data-grid/data-grid-column-header.js +2 -2
  281. package/dist/components/reui/data-grid/data-grid-column-header.js.map +1 -1
  282. package/dist/components/reui/data-grid/data-grid-pagination.js +2 -2
  283. package/dist/components/reui/data-grid/data-grid-pagination.js.map +1 -1
  284. package/dist/components/reui/data-grid/data-grid-scroll-area.js +1 -1
  285. package/dist/components/reui/data-grid/data-grid-scroll-area.js.map +1 -1
  286. package/dist/components/reui/data-grid/data-grid-table-dnd-rows.js +2 -2
  287. package/dist/components/reui/data-grid/data-grid-table-dnd-rows.js.map +1 -1
  288. package/dist/components/reui/data-grid/data-grid-table-dnd.js +1 -1
  289. package/dist/components/reui/data-grid/data-grid-table-virtual.js +1 -1
  290. package/dist/components/reui/data-grid/data-grid-table-virtual.js.map +1 -1
  291. package/dist/components/reui/data-grid/data-grid-table.js +2 -2
  292. package/dist/components/reui/data-grid/data-grid-table.js.map +1 -1
  293. package/dist/components/reui/data-grid/data-grid.js +1 -1
  294. package/dist/components/reui/data-grid/data-grid.js.map +1 -1
  295. package/dist/components/reui/date-selector.js +2 -2
  296. package/dist/components/reui/date-selector.js.map +1 -1
  297. package/dist/components/reui/event-calendar/event-calendar-agenda-view.js +2 -2
  298. package/dist/components/reui/event-calendar/event-calendar-agenda-view.js.map +1 -1
  299. package/dist/components/reui/event-calendar/event-calendar-content.js +1 -1
  300. package/dist/components/reui/event-calendar/event-calendar-content.js.map +1 -1
  301. package/dist/components/reui/event-calendar/event-calendar-event.js +2 -2
  302. package/dist/components/reui/event-calendar/event-calendar-event.js.map +1 -1
  303. package/dist/components/reui/event-calendar/event-calendar-month-view.js +2 -2
  304. package/dist/components/reui/event-calendar/event-calendar-month-view.js.map +1 -1
  305. package/dist/components/reui/event-calendar/event-calendar-nav.js +2 -2
  306. package/dist/components/reui/event-calendar/event-calendar-nav.js.map +1 -1
  307. package/dist/components/reui/event-calendar/event-calendar-resource-view.js +1 -1
  308. package/dist/components/reui/event-calendar/event-calendar-resource-view.js.map +1 -1
  309. package/dist/components/reui/event-calendar/event-calendar-time-grid.js +1 -1
  310. package/dist/components/reui/event-calendar/event-calendar-time-grid.js.map +1 -1
  311. package/dist/components/reui/event-calendar/event-calendar.js +1 -1
  312. package/dist/components/reui/event-calendar/event-calendar.js.map +1 -1
  313. package/dist/components/reui/filters/filters-advanced.js +2 -2
  314. package/dist/components/reui/filters/filters-advanced.js.map +1 -1
  315. package/dist/components/reui/filters/filters-builder.js +3 -3
  316. package/dist/components/reui/filters/filters-builder.js.map +1 -1
  317. package/dist/components/reui/filters/filters-chip.js +2 -2
  318. package/dist/components/reui/filters/filters-chip.js.map +1 -1
  319. package/dist/components/reui/filters/filters-editors.js +3 -3
  320. package/dist/components/reui/filters/filters-editors.js.map +1 -1
  321. package/dist/components/reui/filters/filters.js +2 -2
  322. package/dist/components/reui/filters/filters.js.map +1 -1
  323. package/dist/components/reui/frame.d.ts +2 -2
  324. package/dist/components/reui/frame.d.ts.map +1 -1
  325. package/dist/components/reui/frame.js +2 -2
  326. package/dist/components/reui/frame.js.map +1 -1
  327. package/dist/components/reui/gantt/gantt-bar.js +2 -2
  328. package/dist/components/reui/gantt/gantt-bar.js.map +1 -1
  329. package/dist/components/reui/gantt/gantt-nav.js +2 -2
  330. package/dist/components/reui/gantt/gantt-nav.js.map +1 -1
  331. package/dist/components/reui/gantt/gantt-view.js +2 -2
  332. package/dist/components/reui/gantt/gantt-view.js.map +1 -1
  333. package/dist/components/reui/gantt/gantt.js +1 -1
  334. package/dist/components/reui/gantt/gantt.js.map +1 -1
  335. package/dist/components/reui/icon-stack.js +1 -1
  336. package/dist/components/reui/icon-stack.js.map +1 -1
  337. package/dist/components/reui/icon-tile.d.ts +2 -2
  338. package/dist/components/reui/icon-tile.d.ts.map +1 -1
  339. package/dist/components/reui/icon-tile.js +1 -1
  340. package/dist/components/reui/icon-tile.js.map +1 -1
  341. package/dist/components/reui/kanban.d.ts.map +1 -1
  342. package/dist/components/reui/kanban.js +1 -1
  343. package/dist/components/reui/kanban.js.map +1 -1
  344. package/dist/components/reui/number-field.d.ts +3 -3
  345. package/dist/components/reui/number-field.js +2 -2
  346. package/dist/components/reui/number-field.js.map +1 -1
  347. package/dist/components/reui/phone-input.js +2 -2
  348. package/dist/components/reui/phone-input.js.map +1 -1
  349. package/dist/components/reui/rating.d.ts +1 -1
  350. package/dist/components/reui/rating.d.ts.map +1 -1
  351. package/dist/components/reui/rating.js +2 -2
  352. package/dist/components/reui/rating.js.map +1 -1
  353. package/dist/components/reui/sortable.d.ts.map +1 -1
  354. package/dist/components/reui/sortable.js +1 -1
  355. package/dist/components/reui/sortable.js.map +1 -1
  356. package/dist/components/reui/stepper.d.ts.map +1 -1
  357. package/dist/components/reui/stepper.js +1 -1
  358. package/dist/components/reui/stepper.js.map +1 -1
  359. package/dist/components/reui/timeline.d.ts.map +1 -1
  360. package/dist/components/reui/timeline.js +1 -1
  361. package/dist/components/reui/timeline.js.map +1 -1
  362. package/dist/components/reui/tree.d.ts.map +1 -1
  363. package/dist/components/reui/tree.js +2 -2
  364. package/dist/components/reui/tree.js.map +1 -1
  365. package/dist/components/ui/accordion.d.ts.map +1 -1
  366. package/dist/components/ui/accordion.js +2 -2
  367. package/dist/components/ui/accordion.js.map +1 -1
  368. package/dist/components/ui/alert-dialog.js +2 -2
  369. package/dist/components/ui/alert-dialog.js.map +1 -1
  370. package/dist/components/ui/alert.d.ts.map +1 -1
  371. package/dist/components/ui/alert.js +2 -2
  372. package/dist/components/ui/alert.js.map +1 -1
  373. package/dist/components/ui/aspect-ratio.js +1 -1
  374. package/dist/components/ui/aspect-ratio.js.map +1 -1
  375. package/dist/components/ui/attachment.d.ts +1 -1
  376. package/dist/components/ui/attachment.js +2 -2
  377. package/dist/components/ui/attachment.js.map +1 -1
  378. package/dist/components/ui/avatar.d.ts.map +1 -1
  379. package/dist/components/ui/avatar.js +1 -1
  380. package/dist/components/ui/avatar.js.map +1 -1
  381. package/dist/components/ui/badge.d.ts +1 -1
  382. package/dist/components/ui/badge.d.ts.map +1 -1
  383. package/dist/components/ui/badge.js +1 -1
  384. package/dist/components/ui/badge.js.map +1 -1
  385. package/dist/components/ui/breadcrumb.d.ts.map +1 -1
  386. package/dist/components/ui/breadcrumb.js +2 -2
  387. package/dist/components/ui/breadcrumb.js.map +1 -1
  388. package/dist/components/ui/bubble.d.ts +1 -1
  389. package/dist/components/ui/bubble.d.ts.map +1 -1
  390. package/dist/components/ui/bubble.js +2 -2
  391. package/dist/components/ui/bubble.js.map +1 -1
  392. package/dist/components/ui/button-group.js +2 -2
  393. package/dist/components/ui/button-group.js.map +1 -1
  394. package/dist/components/ui/button.d.ts +2 -2
  395. package/dist/components/ui/button.d.ts.map +1 -1
  396. package/dist/components/ui/button.js +2 -2
  397. package/dist/components/ui/button.js.map +1 -1
  398. package/dist/components/ui/calendar.js +2 -2
  399. package/dist/components/ui/calendar.js.map +1 -1
  400. package/dist/components/ui/card.d.ts.map +1 -1
  401. package/dist/components/ui/card.js +1 -1
  402. package/dist/components/ui/card.js.map +1 -1
  403. package/dist/components/ui/carousel.js +2 -2
  404. package/dist/components/ui/carousel.js.map +1 -1
  405. package/dist/components/ui/chart.d.ts.map +1 -1
  406. package/dist/components/ui/chart.js +1 -1
  407. package/dist/components/ui/chart.js.map +1 -1
  408. package/dist/components/ui/checkbox.d.ts.map +1 -1
  409. package/dist/components/ui/checkbox.js +3 -3
  410. package/dist/components/ui/checkbox.js.map +1 -1
  411. package/dist/components/ui/combobox.js +2 -2
  412. package/dist/components/ui/combobox.js.map +1 -1
  413. package/dist/components/ui/command.js +2 -2
  414. package/dist/components/ui/command.js.map +1 -1
  415. package/dist/components/ui/context-menu.d.ts.map +1 -1
  416. package/dist/components/ui/context-menu.js +2 -2
  417. package/dist/components/ui/context-menu.js.map +1 -1
  418. package/dist/components/ui/dialog.js +2 -2
  419. package/dist/components/ui/dialog.js.map +1 -1
  420. package/dist/components/ui/drawer.d.ts.map +1 -1
  421. package/dist/components/ui/drawer.js +1 -1
  422. package/dist/components/ui/drawer.js.map +1 -1
  423. package/dist/components/ui/dropdown-menu.d.ts.map +1 -1
  424. package/dist/components/ui/dropdown-menu.js +2 -2
  425. package/dist/components/ui/dropdown-menu.js.map +1 -1
  426. package/dist/components/ui/empty.d.ts.map +1 -1
  427. package/dist/components/ui/empty.js +2 -2
  428. package/dist/components/ui/empty.js.map +1 -1
  429. package/dist/components/ui/field.js +3 -3
  430. package/dist/components/ui/field.js.map +1 -1
  431. package/dist/components/ui/hover-card.d.ts.map +1 -1
  432. package/dist/components/ui/hover-card.js +1 -1
  433. package/dist/components/ui/hover-card.js.map +1 -1
  434. package/dist/components/ui/input-group.d.ts +1 -1
  435. package/dist/components/ui/input-group.js +2 -2
  436. package/dist/components/ui/input-group.js.map +1 -1
  437. package/dist/components/ui/input-otp.d.ts.map +1 -1
  438. package/dist/components/ui/input-otp.js +2 -2
  439. package/dist/components/ui/input-otp.js.map +1 -1
  440. package/dist/components/ui/input.d.ts.map +1 -1
  441. package/dist/components/ui/input.js +1 -1
  442. package/dist/components/ui/input.js.map +1 -1
  443. package/dist/components/ui/item.d.ts +1 -1
  444. package/dist/components/ui/item.js +2 -2
  445. package/dist/components/ui/item.js.map +1 -1
  446. package/dist/components/ui/kbd.js +1 -1
  447. package/dist/components/ui/kbd.js.map +1 -1
  448. package/dist/components/ui/label.d.ts.map +1 -1
  449. package/dist/components/ui/label.js +1 -1
  450. package/dist/components/ui/label.js.map +1 -1
  451. package/dist/components/ui/marker.d.ts.map +1 -1
  452. package/dist/components/ui/marker.js +2 -2
  453. package/dist/components/ui/marker.js.map +1 -1
  454. package/dist/components/ui/menubar.js +2 -2
  455. package/dist/components/ui/menubar.js.map +1 -1
  456. package/dist/components/ui/message-scroller.js +2 -2
  457. package/dist/components/ui/message-scroller.js.map +1 -1
  458. package/dist/components/ui/message.d.ts.map +1 -1
  459. package/dist/components/ui/message.js +1 -1
  460. package/dist/components/ui/message.js.map +1 -1
  461. package/dist/components/ui/native-select.d.ts.map +1 -1
  462. package/dist/components/ui/native-select.js +2 -2
  463. package/dist/components/ui/native-select.js.map +1 -1
  464. package/dist/components/ui/navigation-menu.d.ts.map +1 -1
  465. package/dist/components/ui/navigation-menu.js +2 -2
  466. package/dist/components/ui/navigation-menu.js.map +1 -1
  467. package/dist/components/ui/pagination.js +2 -2
  468. package/dist/components/ui/pagination.js.map +1 -1
  469. package/dist/components/ui/popover.d.ts.map +1 -1
  470. package/dist/components/ui/popover.js +1 -1
  471. package/dist/components/ui/popover.js.map +1 -1
  472. package/dist/components/ui/progress.d.ts.map +1 -1
  473. package/dist/components/ui/progress.js +1 -1
  474. package/dist/components/ui/progress.js.map +1 -1
  475. package/dist/components/ui/questionnaire.js +4 -4
  476. package/dist/components/ui/questionnaire.js.map +1 -1
  477. package/dist/components/ui/radio-group.d.ts.map +1 -1
  478. package/dist/components/ui/radio-group.js +2 -2
  479. package/dist/components/ui/radio-group.js.map +1 -1
  480. package/dist/components/ui/resizable.d.ts.map +1 -1
  481. package/dist/components/ui/resizable.js +1 -1
  482. package/dist/components/ui/resizable.js.map +1 -1
  483. package/dist/components/ui/scroll-area.d.ts.map +1 -1
  484. package/dist/components/ui/scroll-area.js +1 -1
  485. package/dist/components/ui/scroll-area.js.map +1 -1
  486. package/dist/components/ui/select.d.ts.map +1 -1
  487. package/dist/components/ui/select.js +2 -2
  488. package/dist/components/ui/select.js.map +1 -1
  489. package/dist/components/ui/separator.d.ts.map +1 -1
  490. package/dist/components/ui/separator.js +1 -1
  491. package/dist/components/ui/separator.js.map +1 -1
  492. package/dist/components/ui/sheet.js +2 -2
  493. package/dist/components/ui/sheet.js.map +1 -1
  494. package/dist/components/ui/sidebar.d.ts +1 -1
  495. package/dist/components/ui/sidebar.js +2 -2
  496. package/dist/components/ui/sidebar.js.map +1 -1
  497. package/dist/components/ui/skeleton.js +1 -1
  498. package/dist/components/ui/skeleton.js.map +1 -1
  499. package/dist/components/ui/slider.d.ts.map +1 -1
  500. package/dist/components/ui/slider.js +1 -1
  501. package/dist/components/ui/slider.js.map +1 -1
  502. package/dist/components/ui/spinner.d.ts.map +1 -1
  503. package/dist/components/ui/spinner.js +2 -2
  504. package/dist/components/ui/spinner.js.map +1 -1
  505. package/dist/components/ui/switch.d.ts.map +1 -1
  506. package/dist/components/ui/switch.js +2 -2
  507. package/dist/components/ui/switch.js.map +1 -1
  508. package/dist/components/ui/table.d.ts.map +1 -1
  509. package/dist/components/ui/table.js +1 -1
  510. package/dist/components/ui/table.js.map +1 -1
  511. package/dist/components/ui/tabs.d.ts.map +1 -1
  512. package/dist/components/ui/tabs.js +2 -2
  513. package/dist/components/ui/tabs.js.map +1 -1
  514. package/dist/components/ui/textarea.d.ts.map +1 -1
  515. package/dist/components/ui/textarea.js +1 -1
  516. package/dist/components/ui/textarea.js.map +1 -1
  517. package/dist/components/ui/toast.js +3 -3
  518. package/dist/components/ui/toast.js.map +1 -1
  519. package/dist/components/ui/toggle-group.js +1 -1
  520. package/dist/components/ui/toggle-group.js.map +1 -1
  521. package/dist/components/ui/toggle.d.ts +1 -1
  522. package/dist/components/ui/toggle.d.ts.map +1 -1
  523. package/dist/components/ui/toggle.js +2 -2
  524. package/dist/components/ui/toggle.js.map +1 -1
  525. package/dist/components/ui/tooltip.d.ts.map +1 -1
  526. package/dist/components/ui/tooltip.js +1 -1
  527. package/dist/components/ui/tooltip.js.map +1 -1
  528. package/dist/{copy-menu-TIKvPaAZ.js → copy-menu-C5GaT4Z-.js} +2 -2
  529. package/dist/{copy-menu-TIKvPaAZ.js.map → copy-menu-C5GaT4Z-.js.map} +1 -1
  530. package/package.json +5 -3
@@ -1 +1 @@
1
- {"version":3,"file":"expandable-action-bar.js","names":[],"sources":["../../../src/components/motion/expandable-action-bar.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n type FocusEvent,\n type MouseEvent,\n type PointerEvent,\n type ReactNode,\n useCallback,\n useEffect,\n useId,\n useMemo,\n useRef,\n useState,\n} from \"react\";\nimport { LayoutGroup, motion, type Transition, useReducedMotion } from \"motion/react\";\n\nimport { cn } from \"@kumix/utils\";\nimport { useDismiss } from \"../../hooks/use-dismiss\";\nimport { useHoverGesture } from \"../../hooks/use-hover-gesture\";\nimport { useTapGesture } from \"../../hooks/use-tap-gesture\";\n\nexport type ExpandableActionBarSize = \"sm\" | \"md\";\n\nexport type ExpandableActionBarItem = {\n id: string;\n label: ReactNode;\n icon: ReactNode;\n onClick?: () => void;\n disabled?: boolean;\n active?: boolean;\n badge?: ReactNode;\n shortcut?: ReactNode;\n};\n\nexport type ExpandableActionBarClassNames = {\n root?: string;\n track?: string;\n item?: string;\n activeItem?: string;\n icon?: string;\n label?: string;\n badge?: string;\n shortcut?: string;\n};\n\nexport interface ExpandableActionBarProps {\n items: ExpandableActionBarItem[];\n expanded?: boolean;\n defaultExpanded?: boolean;\n onExpandedChange?: (expanded: boolean) => void;\n activeId?: string;\n onAction?: (item: ExpandableActionBarItem) => void;\n size?: ExpandableActionBarSize;\n /**\n * Expand when a pointer that hovers rests on the bar. Default true. It also\n * governs the touch equivalent: with no hover to reveal the labels, the\n * first tap expands the bar and runs no action, and the second one acts.\n * Set false to make every tap and click act immediately.\n */\n expandOnHover?: boolean;\n expandOnFocus?: boolean;\n collapseDelay?: number;\n className?: string;\n classNames?: ExpandableActionBarClassNames;\n renderItem?: (\n item: ExpandableActionBarItem,\n state: { expanded: boolean; active: boolean },\n ) => ReactNode;\n}\n\nconst ITEM_TRANSITION: Transition = {\n type: \"spring\",\n stiffness: 460,\n damping: 34,\n mass: 0.62,\n};\n\nconst LABEL_TRANSITION: Transition = {\n type: \"spring\",\n stiffness: 380,\n damping: 32,\n mass: 0.7,\n};\n\nconst SIZE_CLASS: Record<ExpandableActionBarSize, string> = {\n sm: \"min-h-9 gap-1 p-1 text-xs\",\n md: \"min-h-11 gap-1.5 p-1.5 text-sm\",\n};\n\nconst ITEM_SIZE_CLASS: Record<ExpandableActionBarSize, string> = {\n sm: \"h-7 min-w-7 px-1.5\",\n md: \"h-8 min-w-8 px-2\",\n};\n\nconst ICON_SIZE_CLASS: Record<ExpandableActionBarSize, string> = {\n sm: \"h-3.5 w-3.5\",\n md: \"h-4 w-4\",\n};\n\nfunction useControllableExpanded({\n expanded,\n defaultExpanded,\n onExpandedChange,\n}: {\n expanded?: boolean;\n defaultExpanded?: boolean;\n onExpandedChange?: (expanded: boolean) => void;\n}) {\n const [internalExpanded, setInternalExpanded] = useState(defaultExpanded ?? false);\n const isControlled = expanded !== undefined;\n const value = expanded ?? internalExpanded;\n\n const setValue = useCallback(\n (next: boolean) => {\n if (!isControlled) setInternalExpanded(next);\n onExpandedChange?.(next);\n },\n [isControlled, onExpandedChange],\n );\n\n return [value, setValue] as const;\n}\n\nexport function ExpandableActionBar({\n items,\n expanded,\n defaultExpanded = false,\n onExpandedChange,\n activeId,\n onAction,\n size = \"md\",\n expandOnHover = true,\n expandOnFocus = true,\n collapseDelay = 90,\n className,\n classNames,\n renderItem,\n}: ExpandableActionBarProps) {\n const reduce = useReducedMotion();\n const layoutId = useId();\n const [isExpanded, setIsExpanded] = useControllableExpanded({\n expanded,\n defaultExpanded,\n onExpandedChange,\n });\n const [hoveredId, setHoveredId] = useState<string | null>(null);\n // Set by the tap that expands the bar, and the reason the outside-tap\n // dismisser exists at all — a hovering pointer has its own way out.\n const [tapExpanded, setTapExpanded] = useState(false);\n const collapseTimer = useRef<number | null>(null);\n const trackRef = useRef<HTMLDivElement | null>(null);\n // What the last gesture on an action was, and whether the bar was already\n // expanded when it started. A click reports neither.\n const tap = useTapGesture<boolean>();\n const hover = useHoverGesture();\n\n const clearCollapseTimer = useCallback(() => {\n if (collapseTimer.current) window.clearTimeout(collapseTimer.current);\n collapseTimer.current = null;\n }, []);\n\n const open = useCallback(() => {\n clearCollapseTimer();\n setIsExpanded(true);\n }, [clearCollapseTimer, setIsExpanded]);\n\n const close = useCallback(() => {\n clearCollapseTimer();\n const timer = window.setTimeout(() => {\n setIsExpanded(false);\n setHoveredId(null);\n setTapExpanded(false);\n }, collapseDelay);\n collapseTimer.current = timer;\n }, [clearCollapseTimer, collapseDelay, setIsExpanded]);\n\n useEffect(() => clearCollapseTimer, [clearCollapseTimer]);\n\n // A collapse from outside takes the labels with it, so the arm the tap that\n // expanded the bar left behind has to go too — otherwise the next tap runs\n // an action whose label nobody can read. Only on the way down from expanded:\n // a controlled bar that declined to expand at all keeps its arm, which is\n // what lets its second tap act.\n const wasExpanded = useRef(isExpanded);\n useEffect(() => {\n if (wasExpanded.current && !isExpanded) setTapExpanded(false);\n wasExpanded.current = isExpanded;\n }, [isExpanded]);\n\n // A finger never hovers and Safari does not focus a button on tap, so a bar a\n // tap expanded would have nothing to close it. The tap that lands elsewhere\n // stands in for the pointer leaving — and it is consumed rather than passed\n // through, because the labelled bar is exactly the kind of surface people\n // dismiss by tapping just past it, over whatever control is there.\n useDismiss(tapExpanded && isExpanded, close, trackRef, {\n behavior: \"consume\",\n });\n\n const onRootPointerEnter = (event: PointerEvent<HTMLDivElement>) => {\n // The gesture is told about every enter, `expandOnHover` or not: it is\n // what the matching leave is read against.\n if (hover.enter(event) && expandOnHover) open();\n };\n\n const onRootPointerLeave = (event: PointerEvent<HTMLDivElement>) => {\n if (!hover.leave(event)) return;\n setHoveredId(null);\n if (expandOnHover) close();\n };\n\n const onRootFocus = () => {\n if (expandOnFocus) open();\n };\n\n const onRootBlur = (event: FocusEvent<HTMLDivElement>) => {\n if (!event.currentTarget.contains(event.relatedTarget as Node) && expandOnFocus) {\n close();\n }\n };\n\n const activeItemId = activeId ?? items.find((item) => item.active)?.id;\n const highlightId = hoveredId ?? activeItemId;\n\n return (\n <LayoutGroup id={layoutId}>\n <motion.div\n layout=\"size\"\n // Pointer events, not the mouse pair: a tap fires compatibility\n // mouseenter/mouseleave that carry no pointerType, and the bar growing\n // under a stationary finger fired the leave before the click ever\n // landed — so one tap expanded, collapsed and ran nothing.\n onPointerEnter={onRootPointerEnter}\n onPointerLeave={onRootPointerLeave}\n onFocus={onRootFocus}\n onBlur={onRootBlur}\n transition={ITEM_TRANSITION}\n className={cn(\"inline-flex max-w-full\", classNames?.root, className)}\n >\n <motion.div\n ref={trackRef}\n layout=\"size\"\n className={cn(\n // Labelled actions can outgrow the space the bar sits in — the pill\n // stays inside it and scrolls its rail rather than running off the\n // edge, where the last action is unreachable.\n \"scrollbar-hide relative inline-flex max-w-full items-center overflow-x-auto overflow-y-hidden rounded-full border border-border bg-card/90 shadow-2xl backdrop-blur-xl\",\n SIZE_CLASS[size],\n classNames?.track,\n )}\n transition={ITEM_TRANSITION}\n >\n {items.map((item) => {\n const isActive = item.active || activeId === item.id;\n const isHighlighted = highlightId === item.id;\n\n return (\n <motion.button\n key={item.id}\n layout=\"position\"\n type=\"button\"\n disabled={item.disabled}\n title={typeof item.label === \"string\" ? item.label : undefined}\n onPointerEnter={(event: PointerEvent<HTMLButtonElement>) => {\n if (!hover.enter(event)) return;\n clearCollapseTimer();\n setHoveredId(item.id);\n }}\n onPointerDown={(event: PointerEvent<HTMLButtonElement>) => {\n tap.start(event, isExpanded);\n }}\n // A gesture the platform takes away sends no click, and a key\n // press starts an activation that never had a pointer behind\n // it: either one would otherwise leave the finger in place for\n // the next click to spend.\n onPointerCancel={tap.drop}\n onKeyDown={tap.drop}\n onClick={(event: MouseEvent<HTMLButtonElement>) => {\n event.currentTarget.blur();\n const gesture = tap.take();\n // Nothing reveals the labels to a finger, so the first tap\n // expands the bar and the next one runs the action. The bar\n // state is read from the gesture's start: a browser that\n // focuses the button on contact expands it mid-tap, and that\n // first tap would otherwise fire the action it was meant to\n // reveal. `tapExpanded` arms the second tap, so a controlled\n // bar that declines to expand still runs the action rather\n // than swallowing every tap.\n const firstTap =\n gesture !== null &&\n gesture.pointerType !== \"mouse\" &&\n !gesture.state &&\n !tapExpanded;\n if (firstTap && expandOnHover) {\n setTapExpanded(true);\n open();\n setHoveredId(item.id);\n return;\n }\n item.onClick?.();\n onAction?.(item);\n }}\n whileTap={reduce || item.disabled ? undefined : { scale: 0.96 }}\n transition={ITEM_TRANSITION}\n className={cn(\n \"relative isolate inline-flex shrink-0 items-center justify-center overflow-hidden rounded-full font-medium text-muted-foreground outline-none transition-[color,background-color] duration-150 ease-out\",\n \"focus-visible:text-foreground disabled:pointer-events-none disabled:opacity-40\",\n isHighlighted && \"text-foreground\",\n ITEM_SIZE_CLASS[size],\n classNames?.item,\n isActive && classNames?.activeItem,\n )}\n >\n {isHighlighted ? (\n <motion.span\n layoutId=\"action-bar-highlight\"\n className=\"absolute inset-0 -z-10 rounded-full bg-primary/[0.07]\"\n transition={ITEM_TRANSITION}\n />\n ) : null}\n\n {renderItem ? (\n renderItem(item, { expanded: isExpanded, active: isActive })\n ) : (\n <>\n <span\n className={cn(\n \"inline-flex shrink-0 items-center justify-center\",\n ICON_SIZE_CLASS[size],\n classNames?.icon,\n )}\n >\n {item.icon}\n </span>\n\n <motion.span\n aria-hidden={!isExpanded}\n animate={\n reduce\n ? {\n width: isExpanded ? \"auto\" : 0,\n opacity: isExpanded ? 1 : 0,\n marginLeft: isExpanded ? 8 : 0,\n x: 0,\n filter: \"blur(0px)\",\n }\n : {\n width: isExpanded ? \"auto\" : 0,\n opacity: isExpanded ? 1 : 0,\n x: isExpanded ? 0 : -4,\n marginLeft: isExpanded ? 8 : 0,\n filter: isExpanded ? \"blur(0px)\" : \"blur(3px)\",\n }\n }\n transition={reduce ? { duration: 0 } : LABEL_TRANSITION}\n className={cn(\n \"inline-block overflow-hidden whitespace-nowrap\",\n classNames?.label,\n )}\n >\n {item.label}\n </motion.span>\n\n {item.shortcut ? (\n <motion.span\n aria-hidden={!isExpanded}\n animate={{\n width: isExpanded ? \"auto\" : 0,\n opacity: isExpanded ? 1 : 0,\n marginLeft: isExpanded ? 4 : 0,\n }}\n transition={LABEL_TRANSITION}\n className={cn(\n \"hidden overflow-hidden whitespace-nowrap text-[10px] text-muted-foreground sm:inline-block\",\n classNames?.shortcut,\n )}\n >\n {item.shortcut}\n </motion.span>\n ) : null}\n\n {item.badge ? (\n <span\n className={cn(\n \"ml-0.5 inline-flex h-4 min-w-4 items-center justify-center rounded-full bg-destructive px-1 text-[10px] text-primary-foreground leading-none\",\n !isExpanded && \"absolute top-0.5 right-0.5\",\n classNames?.badge,\n )}\n >\n {item.badge}\n </span>\n ) : null}\n </>\n )}\n </motion.button>\n );\n })}\n </motion.div>\n </motion.div>\n </LayoutGroup>\n );\n}\n\nexport function useExpandableActionBar(items: ExpandableActionBarItem[]) {\n const [expanded, setExpanded] = useState(false);\n const [activeId, setActiveId] = useState(items[0]?.id);\n\n const activeItem = useMemo(() => items.find((item) => item.id === activeId), [activeId, items]);\n\n return useMemo(\n () => ({ expanded, setExpanded, activeId, setActiveId, activeItem }),\n [activeId, activeItem, expanded],\n );\n}\n"],"mappings":";;;;;;;;;AAsEA,MAAM,kBAA8B;CAClC,MAAM;CACN,WAAW;CACX,SAAS;CACT,MAAM;AACR;AAEA,MAAM,mBAA+B;CACnC,MAAM;CACN,WAAW;CACX,SAAS;CACT,MAAM;AACR;AAEA,MAAM,aAAsD;CAC1D,IAAI;CACJ,IAAI;AACN;AAEA,MAAM,kBAA2D;CAC/D,IAAI;CACJ,IAAI;AACN;AAEA,MAAM,kBAA2D;CAC/D,IAAI;CACJ,IAAI;AACN;AAEA,SAAS,wBAAwB,EAC/B,UACA,iBACA,oBAKC;CACD,MAAM,CAAC,kBAAkB,uBAAuB,SAAS,mBAAmB,KAAK;CACjF,MAAM,eAAe,aAAa,KAAA;CAWlC,OAAO,CAVO,YAAY,kBAET,aACd,SAAkB;EACjB,IAAI,CAAC,cAAc,oBAAoB,IAAI;EAC3C,mBAAmB,IAAI;CACzB,GACA,CAAC,cAAc,gBAAgB,CAGX,CAAC;AACzB;AAEA,SAAgB,oBAAoB,EAClC,OACA,UACA,kBAAkB,OAClB,kBACA,UACA,UACA,OAAO,MACP,gBAAgB,MAChB,gBAAgB,MAChB,gBAAgB,IAChB,WACA,YACA,cAC2B;CAC3B,MAAM,SAAS,iBAAiB;CAChC,MAAM,WAAW,MAAM;CACvB,MAAM,CAAC,YAAY,iBAAiB,wBAAwB;EAC1D;EACA;EACA;CACF,CAAC;CACD,MAAM,CAAC,WAAW,gBAAgB,SAAwB,IAAI;CAG9D,MAAM,CAAC,aAAa,kBAAkB,SAAS,KAAK;CACpD,MAAM,gBAAgB,OAAsB,IAAI;CAChD,MAAM,WAAW,OAA8B,IAAI;CAGnD,MAAM,MAAM,cAAuB;CACnC,MAAM,QAAQ,gBAAgB;CAE9B,MAAM,qBAAqB,kBAAkB;EAC3C,IAAI,cAAc,SAAS,OAAO,aAAa,cAAc,OAAO;EACpE,cAAc,UAAU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,oBAAC,OAAO,MAAR;QACE,eAAa,CAAC;QACd,SACE,SACI;SACE,OAAO,aAAa,SAAS;SAC7B,SAAS,aAAa,IAAI;SAC1B,YAAY,aAAa,IAAI;SAC7B,GAAG;SACH,QAAQ;QACV,IACA;SACE,OAAO,aAAa,SAAS;SAC7B,SAAS,aAAa,IAAI;SAC1B,GAAG,aAAa,IAAI;SACpB,YAAY,aAAa,IAAI;SAC7B,QAAQ,aAAa,cAAc;QACrC;QAEN,YAAY,SAAS,EAAE,UAAU,EAAE,IAAI;QACvC,WAAW,GACT,kDACA,YAAY,KACd;QAEC,UAAA,KAAK;OACK,CAAA;OAEZ,KAAK,WACJ,oBAAC,OAAO,MAAR;QACE,eAAa,CAAC;QACd,SAAS;SACP,OAAO,aAAa,SAAS;SAC7B,SAAS,aAAa,IAAI;SAC1B,YAAY,aAAa,IAAI;QAC/B;QACA,YAAY;QACZ,WAAW,GACT,8FACA,YAAY,QACd;QAEC,UAAA,KAAK;OACK,CAAA,IACX;OAEH,KAAK,QACJ,oBAAC,QAAD;QACE,WAAW,GACT,gJACA,CAAC,cAAc,8BACf,YAAY,KACd;QAEC,UAAA,KAAK;OACF,CAAA,IACJ;MACJ,EAAA,CAAA,CAES;KAxIR,GAAA,KAAK,EAwIG;IAEnB,CAAC;GACS,CAAA;EACF,CAAA;CACD,CAAA;AAEjB;AAEA,SAAgB,uBAAuB,OAAkC;CACvE,MAAM,CAAC,UAAU,eAAe,SAAS,KAAK;CAC9C,MAAM,CAAC,UAAU,eAAe,SAAS,MAAM,EAAE,EAAE,EAAE;CAErD,MAAM,aAAa,cAAc,MAAM,MAAM,SAAS,KAAK,OAAO,QAAQ,GAAG,CAAC,UAAU,KAAK,CAAC;CAE9F,OAAO,eACE;EAAE;EAAU;EAAa;EAAU;EAAa;CAAW,IAClE;EAAC;EAAU;EAAY;CAAQ,CACjC;AACF"}
1
+ {"version":3,"file":"expandable-action-bar.js","names":[],"sources":["../../../src/components/motion/expandable-action-bar.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n type FocusEvent,\n type MouseEvent,\n type PointerEvent,\n type ReactNode,\n useCallback,\n useEffect,\n useId,\n useMemo,\n useRef,\n useState,\n} from \"react\";\nimport { cn } from \"cn\";\nimport { LayoutGroup, motion, type Transition, useReducedMotion } from \"motion/react\";\n\nimport { useDismiss } from \"../../hooks/use-dismiss\";\nimport { useHoverGesture } from \"../../hooks/use-hover-gesture\";\nimport { useTapGesture } from \"../../hooks/use-tap-gesture\";\n\nexport type ExpandableActionBarSize = \"sm\" | \"md\";\n\nexport type ExpandableActionBarItem = {\n id: string;\n label: ReactNode;\n icon: ReactNode;\n onClick?: () => void;\n disabled?: boolean;\n active?: boolean;\n badge?: ReactNode;\n shortcut?: ReactNode;\n};\n\nexport type ExpandableActionBarClassNames = {\n root?: string;\n track?: string;\n item?: string;\n activeItem?: string;\n icon?: string;\n label?: string;\n badge?: string;\n shortcut?: string;\n};\n\nexport interface ExpandableActionBarProps {\n items: ExpandableActionBarItem[];\n expanded?: boolean;\n defaultExpanded?: boolean;\n onExpandedChange?: (expanded: boolean) => void;\n activeId?: string;\n onAction?: (item: ExpandableActionBarItem) => void;\n size?: ExpandableActionBarSize;\n /**\n * Expand when a pointer that hovers rests on the bar. Default true. It also\n * governs the touch equivalent: with no hover to reveal the labels, the\n * first tap expands the bar and runs no action, and the second one acts.\n * Set false to make every tap and click act immediately.\n */\n expandOnHover?: boolean;\n expandOnFocus?: boolean;\n collapseDelay?: number;\n className?: string;\n classNames?: ExpandableActionBarClassNames;\n renderItem?: (\n item: ExpandableActionBarItem,\n state: { expanded: boolean; active: boolean },\n ) => ReactNode;\n}\n\nconst ITEM_TRANSITION: Transition = {\n type: \"spring\",\n stiffness: 460,\n damping: 34,\n mass: 0.62,\n};\n\nconst LABEL_TRANSITION: Transition = {\n type: \"spring\",\n stiffness: 380,\n damping: 32,\n mass: 0.7,\n};\n\nconst SIZE_CLASS: Record<ExpandableActionBarSize, string> = {\n sm: \"min-h-9 gap-1 p-1 text-xs\",\n md: \"min-h-11 gap-1.5 p-1.5 text-sm\",\n};\n\nconst ITEM_SIZE_CLASS: Record<ExpandableActionBarSize, string> = {\n sm: \"h-7 min-w-7 px-1.5\",\n md: \"h-8 min-w-8 px-2\",\n};\n\nconst ICON_SIZE_CLASS: Record<ExpandableActionBarSize, string> = {\n sm: \"h-3.5 w-3.5\",\n md: \"h-4 w-4\",\n};\n\nfunction useControllableExpanded({\n expanded,\n defaultExpanded,\n onExpandedChange,\n}: {\n expanded?: boolean;\n defaultExpanded?: boolean;\n onExpandedChange?: (expanded: boolean) => void;\n}) {\n const [internalExpanded, setInternalExpanded] = useState(defaultExpanded ?? false);\n const isControlled = expanded !== undefined;\n const value = expanded ?? internalExpanded;\n\n const setValue = useCallback(\n (next: boolean) => {\n if (!isControlled) setInternalExpanded(next);\n onExpandedChange?.(next);\n },\n [isControlled, onExpandedChange],\n );\n\n return [value, setValue] as const;\n}\n\nexport function ExpandableActionBar({\n items,\n expanded,\n defaultExpanded = false,\n onExpandedChange,\n activeId,\n onAction,\n size = \"md\",\n expandOnHover = true,\n expandOnFocus = true,\n collapseDelay = 90,\n className,\n classNames,\n renderItem,\n}: ExpandableActionBarProps) {\n const reduce = useReducedMotion();\n const layoutId = useId();\n const [isExpanded, setIsExpanded] = useControllableExpanded({\n expanded,\n defaultExpanded,\n onExpandedChange,\n });\n const [hoveredId, setHoveredId] = useState<string | null>(null);\n // Set by the tap that expands the bar, and the reason the outside-tap\n // dismisser exists at all — a hovering pointer has its own way out.\n const [tapExpanded, setTapExpanded] = useState(false);\n const collapseTimer = useRef<number | null>(null);\n const trackRef = useRef<HTMLDivElement | null>(null);\n // What the last gesture on an action was, and whether the bar was already\n // expanded when it started. A click reports neither.\n const tap = useTapGesture<boolean>();\n const hover = useHoverGesture();\n\n const clearCollapseTimer = useCallback(() => {\n if (collapseTimer.current) window.clearTimeout(collapseTimer.current);\n collapseTimer.current = null;\n }, []);\n\n const open = useCallback(() => {\n clearCollapseTimer();\n setIsExpanded(true);\n }, [clearCollapseTimer, setIsExpanded]);\n\n const close = useCallback(() => {\n clearCollapseTimer();\n const timer = window.setTimeout(() => {\n setIsExpanded(false);\n setHoveredId(null);\n setTapExpanded(false);\n }, collapseDelay);\n collapseTimer.current = timer;\n }, [clearCollapseTimer, collapseDelay, setIsExpanded]);\n\n useEffect(() => clearCollapseTimer, [clearCollapseTimer]);\n\n // A collapse from outside takes the labels with it, so the arm the tap that\n // expanded the bar left behind has to go too — otherwise the next tap runs\n // an action whose label nobody can read. Only on the way down from expanded:\n // a controlled bar that declined to expand at all keeps its arm, which is\n // what lets its second tap act.\n const wasExpanded = useRef(isExpanded);\n useEffect(() => {\n if (wasExpanded.current && !isExpanded) setTapExpanded(false);\n wasExpanded.current = isExpanded;\n }, [isExpanded]);\n\n // A finger never hovers and Safari does not focus a button on tap, so a bar a\n // tap expanded would have nothing to close it. The tap that lands elsewhere\n // stands in for the pointer leaving — and it is consumed rather than passed\n // through, because the labelled bar is exactly the kind of surface people\n // dismiss by tapping just past it, over whatever control is there.\n useDismiss(tapExpanded && isExpanded, close, trackRef, {\n behavior: \"consume\",\n });\n\n const onRootPointerEnter = (event: PointerEvent<HTMLDivElement>) => {\n // The gesture is told about every enter, `expandOnHover` or not: it is\n // what the matching leave is read against.\n if (hover.enter(event) && expandOnHover) open();\n };\n\n const onRootPointerLeave = (event: PointerEvent<HTMLDivElement>) => {\n if (!hover.leave(event)) return;\n setHoveredId(null);\n if (expandOnHover) close();\n };\n\n const onRootFocus = () => {\n if (expandOnFocus) open();\n };\n\n const onRootBlur = (event: FocusEvent<HTMLDivElement>) => {\n if (!event.currentTarget.contains(event.relatedTarget as Node) && expandOnFocus) {\n close();\n }\n };\n\n const activeItemId = activeId ?? items.find((item) => item.active)?.id;\n const highlightId = hoveredId ?? activeItemId;\n\n return (\n <LayoutGroup id={layoutId}>\n <motion.div\n layout=\"size\"\n // Pointer events, not the mouse pair: a tap fires compatibility\n // mouseenter/mouseleave that carry no pointerType, and the bar growing\n // under a stationary finger fired the leave before the click ever\n // landed — so one tap expanded, collapsed and ran nothing.\n onPointerEnter={onRootPointerEnter}\n onPointerLeave={onRootPointerLeave}\n onFocus={onRootFocus}\n onBlur={onRootBlur}\n transition={ITEM_TRANSITION}\n className={cn(\"inline-flex max-w-full\", classNames?.root, className)}\n >\n <motion.div\n ref={trackRef}\n layout=\"size\"\n className={cn(\n // Labelled actions can outgrow the space the bar sits in — the pill\n // stays inside it and scrolls its rail rather than running off the\n // edge, where the last action is unreachable.\n \"scrollbar-hide relative inline-flex max-w-full items-center overflow-x-auto overflow-y-hidden rounded-full border border-border bg-card/90 shadow-2xl backdrop-blur-xl\",\n SIZE_CLASS[size],\n classNames?.track,\n )}\n transition={ITEM_TRANSITION}\n >\n {items.map((item) => {\n const isActive = item.active || activeId === item.id;\n const isHighlighted = highlightId === item.id;\n\n return (\n <motion.button\n key={item.id}\n layout=\"position\"\n type=\"button\"\n disabled={item.disabled}\n title={typeof item.label === \"string\" ? item.label : undefined}\n onPointerEnter={(event: PointerEvent<HTMLButtonElement>) => {\n if (!hover.enter(event)) return;\n clearCollapseTimer();\n setHoveredId(item.id);\n }}\n onPointerDown={(event: PointerEvent<HTMLButtonElement>) => {\n tap.start(event, isExpanded);\n }}\n // A gesture the platform takes away sends no click, and a key\n // press starts an activation that never had a pointer behind\n // it: either one would otherwise leave the finger in place for\n // the next click to spend.\n onPointerCancel={tap.drop}\n onKeyDown={tap.drop}\n onClick={(event: MouseEvent<HTMLButtonElement>) => {\n event.currentTarget.blur();\n const gesture = tap.take();\n // Nothing reveals the labels to a finger, so the first tap\n // expands the bar and the next one runs the action. The bar\n // state is read from the gesture's start: a browser that\n // focuses the button on contact expands it mid-tap, and that\n // first tap would otherwise fire the action it was meant to\n // reveal. `tapExpanded` arms the second tap, so a controlled\n // bar that declines to expand still runs the action rather\n // than swallowing every tap.\n const firstTap =\n gesture !== null &&\n gesture.pointerType !== \"mouse\" &&\n !gesture.state &&\n !tapExpanded;\n if (firstTap && expandOnHover) {\n setTapExpanded(true);\n open();\n setHoveredId(item.id);\n return;\n }\n item.onClick?.();\n onAction?.(item);\n }}\n whileTap={reduce || item.disabled ? undefined : { scale: 0.96 }}\n transition={ITEM_TRANSITION}\n className={cn(\n \"relative isolate inline-flex shrink-0 items-center justify-center overflow-hidden rounded-full font-medium text-muted-foreground outline-none transition-[color,background-color] duration-150 ease-out\",\n \"focus-visible:text-foreground disabled:pointer-events-none disabled:opacity-40\",\n isHighlighted && \"text-foreground\",\n ITEM_SIZE_CLASS[size],\n classNames?.item,\n isActive && classNames?.activeItem,\n )}\n >\n {isHighlighted ? (\n <motion.span\n layoutId=\"action-bar-highlight\"\n className=\"absolute inset-0 -z-10 rounded-full bg-primary/[0.07]\"\n transition={ITEM_TRANSITION}\n />\n ) : null}\n\n {renderItem ? (\n renderItem(item, { expanded: isExpanded, active: isActive })\n ) : (\n <>\n <span\n className={cn(\n \"inline-flex shrink-0 items-center justify-center\",\n ICON_SIZE_CLASS[size],\n classNames?.icon,\n )}\n >\n {item.icon}\n </span>\n\n <motion.span\n aria-hidden={!isExpanded}\n animate={\n reduce\n ? {\n width: isExpanded ? \"auto\" : 0,\n opacity: isExpanded ? 1 : 0,\n marginLeft: isExpanded ? 8 : 0,\n x: 0,\n filter: \"blur(0px)\",\n }\n : {\n width: isExpanded ? \"auto\" : 0,\n opacity: isExpanded ? 1 : 0,\n x: isExpanded ? 0 : -4,\n marginLeft: isExpanded ? 8 : 0,\n filter: isExpanded ? \"blur(0px)\" : \"blur(3px)\",\n }\n }\n transition={reduce ? { duration: 0 } : LABEL_TRANSITION}\n className={cn(\n \"inline-block overflow-hidden whitespace-nowrap\",\n classNames?.label,\n )}\n >\n {item.label}\n </motion.span>\n\n {item.shortcut ? (\n <motion.span\n aria-hidden={!isExpanded}\n animate={{\n width: isExpanded ? \"auto\" : 0,\n opacity: isExpanded ? 1 : 0,\n marginLeft: isExpanded ? 4 : 0,\n }}\n transition={LABEL_TRANSITION}\n className={cn(\n \"hidden overflow-hidden whitespace-nowrap text-[10px] text-muted-foreground sm:inline-block\",\n classNames?.shortcut,\n )}\n >\n {item.shortcut}\n </motion.span>\n ) : null}\n\n {item.badge ? (\n <span\n className={cn(\n \"ml-0.5 inline-flex h-4 min-w-4 items-center justify-center rounded-full bg-destructive px-1 text-[10px] text-primary-foreground leading-none\",\n !isExpanded && \"absolute top-0.5 right-0.5\",\n classNames?.badge,\n )}\n >\n {item.badge}\n </span>\n ) : null}\n </>\n )}\n </motion.button>\n );\n })}\n </motion.div>\n </motion.div>\n </LayoutGroup>\n );\n}\n\nexport function useExpandableActionBar(items: ExpandableActionBarItem[]) {\n const [expanded, setExpanded] = useState(false);\n const [activeId, setActiveId] = useState(items[0]?.id);\n\n const activeItem = useMemo(() => items.find((item) => item.id === activeId), [activeId, items]);\n\n return useMemo(\n () => ({ expanded, setExpanded, activeId, setActiveId, activeItem }),\n [activeId, activeItem, expanded],\n );\n}\n"],"mappings":";;;;;;;;;AAsEA,MAAM,kBAA8B;CAClC,MAAM;CACN,WAAW;CACX,SAAS;CACT,MAAM;AACR;AAEA,MAAM,mBAA+B;CACnC,MAAM;CACN,WAAW;CACX,SAAS;CACT,MAAM;AACR;AAEA,MAAM,aAAsD;CAC1D,IAAI;CACJ,IAAI;AACN;AAEA,MAAM,kBAA2D;CAC/D,IAAI;CACJ,IAAI;AACN;AAEA,MAAM,kBAA2D;CAC/D,IAAI;CACJ,IAAI;AACN;AAEA,SAAS,wBAAwB,EAC/B,UACA,iBACA,oBAKC;CACD,MAAM,CAAC,kBAAkB,uBAAuB,SAAS,mBAAmB,KAAK;CACjF,MAAM,eAAe,aAAa,KAAA;CAWlC,OAAO,CAVO,YAAY,kBAET,aACd,SAAkB;EACjB,IAAI,CAAC,cAAc,oBAAoB,IAAI;EAC3C,mBAAmB,IAAI;CACzB,GACA,CAAC,cAAc,gBAAgB,CAGX,CAAC;AACzB;AAEA,SAAgB,oBAAoB,EAClC,OACA,UACA,k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,UAAA,KAAK;OACF,CAAA,IACJ;MACJ,EAAA,CAAA,CAES;KAxIR,GAAA,KAAK,EAwIG;IAEnB,CAAC;GACS,CAAA;EACF,CAAA;CACD,CAAA;AAEjB;AAEA,SAAgB,uBAAuB,OAAkC;CACvE,MAAM,CAAC,UAAU,eAAe,SAAS,KAAK;CAC9C,MAAM,CAAC,UAAU,eAAe,SAAS,MAAM,EAAE,EAAE,EAAE;CAErD,MAAM,aAAa,cAAc,MAAM,MAAM,SAAS,KAAK,OAAO,QAAQ,GAAG,CAAC,UAAU,KAAK,CAAC;CAE9F,OAAO,eACE;EAAE;EAAU;EAAa;EAAU;EAAa;CAAW,IAClE;EAAC;EAAU;EAAY;CAAQ,CACjC;AACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"expandable-control.d.ts","names":[],"sources":["../../../src/components/motion/expandable-control.tsx"],"mappings":";;;KA6BK;EACH;EACA;EACA,oBAAoB;;iBAGL,8BACP,KAAK,wCACX;EACF,MAAM;EACN,OAAO;;iBAGQ,4BAA4B;EAC3C,OAAO;EACP,YAAY;EACZ;EACA;EACA;EACA;EACA;EACA;EACA;;wBAyBc,mBACd,MACA,OACA,UACA,iBACA,kBACA,WACA,SACA,UACA,oBACc,cACX,SACF,wCAAqB,IAAA;wBAiER,iBACd,OACA,YACA,aACA,UACA,kBACA,UACA,iBACA,kBACA,UACA,WACA,gBACA,mBACC,sCAAmB,IAAA"}
1
+ {"version":3,"file":"expandable-control.d.ts","names":[],"sources":["../../../src/components/motion/expandable-control.tsx"],"mappings":";;;KA4BK;EACH;EACA;EACA,oBAAoB;;iBAGL,8BACP,KAAK,wCACX;EACF,MAAM;EACN,OAAO;;iBAGQ,4BAA4B;EAC3C,OAAO;EACP,YAAY;EACZ;EACA;EACA;EACA;EACA;EACA;EACA;;wBAyBc,mBACd,MACA,OACA,UACA,iBACA,kBACA,WACA,SACA,UACA,oBACc,cACX,SACF,wCAAqB,IAAA;wBAiER,iBACd,OACA,YACA,aACA,UACA,kBACA,UACA,iBACA,kBACA,UACA,WACA,gBACA,mBACC,sCAAmB,IAAA"}
@@ -1,6 +1,6 @@
1
1
  "use client";
2
2
  import { useCallback, useRef, useState } from "react";
3
- import { cn } from "@kumix/utils";
3
+ import { cn } from "cn";
4
4
  import { jsx, jsxs } from "react/jsx-runtime";
5
5
  import { AnimatePresence, motion, useReducedMotion } from "motion/react";
6
6
  //#region src/components/motion/expandable-control.tsx
@@ -1 +1 @@
1
- {"version":3,"file":"expandable-control.js","names":[],"sources":["../../../src/components/motion/expandable-control.tsx"],"sourcesContent":["\"use client\";\n\nimport { type MouseEvent, type ReactNode, useCallback, useRef, useState } from \"react\";\nimport {\n AnimatePresence,\n type HTMLMotionProps,\n motion,\n type Transition,\n useReducedMotion,\n type Variants,\n} from \"motion/react\";\n\nimport { cn } from \"@kumix/utils\";\n\n// Matches the Motion Patterns \"Layout continuity\" recipe so the surface\n// keeps its identity while its footprint changes.\nconst CONTINUITY_SPRING: Transition = {\n type: \"spring\",\n stiffness: 220,\n damping: 17,\n mass: 0.85,\n};\n\nconst CONTINUITY_LABEL: Variants = {\n hidden: { opacity: 0, filter: \"blur(4px)\" },\n visible: { opacity: 1, filter: \"blur(0px)\" },\n exit: { opacity: 0, filter: \"blur(4px)\" },\n};\n\ntype ExpandableStateProps = {\n expanded?: boolean;\n defaultExpanded?: boolean;\n onExpandedChange?: (expanded: boolean) => void;\n};\n\nexport interface ExpandableButtonProps\n extends Omit<HTMLMotionProps<\"button\">, \"children\">,\n ExpandableStateProps {\n icon: ReactNode;\n label: ReactNode;\n}\n\nexport interface ExpandableChipProps extends ExpandableStateProps {\n label: ReactNode;\n actionIcon: ReactNode;\n actionLabel: string;\n onAction?: () => void;\n collapseOnAction?: boolean;\n disabled?: boolean;\n className?: string;\n labelClassName?: string;\n actionClassName?: string;\n}\n\nfunction useExpandableState({\n expanded,\n defaultExpanded = false,\n onExpandedChange,\n}: ExpandableStateProps) {\n const [internalExpanded, setInternalExpanded] = useState(defaultExpanded);\n const isControlled = expanded !== undefined;\n const currentExpanded = expanded ?? internalExpanded;\n\n const setExpanded = useCallback(\n (nextExpanded: boolean) => {\n if (!isControlled) {\n setInternalExpanded(nextExpanded);\n }\n onExpandedChange?.(nextExpanded);\n },\n [isControlled, onExpandedChange],\n );\n\n return [currentExpanded, setExpanded] as const;\n}\n\nexport function ExpandableButton({\n icon,\n label,\n expanded,\n defaultExpanded,\n onExpandedChange,\n className,\n onClick,\n disabled,\n type = \"button\",\n \"aria-label\": ariaLabel,\n ...props\n}: ExpandableButtonProps) {\n const reduce = useReducedMotion();\n const [isExpanded, setExpanded] = useExpandableState({\n expanded,\n defaultExpanded,\n onExpandedChange,\n });\n\n const handleClick = (event: MouseEvent<HTMLButtonElement>) => {\n onClick?.(event);\n if (!event.defaultPrevented) {\n setExpanded(!isExpanded);\n }\n };\n\n const transition = reduce ? { duration: 0 } : CONTINUITY_SPRING;\n\n return (\n <motion.span layout transition={transition} className=\"inline-flex\">\n <motion.button\n {...props}\n layout\n type={type}\n aria-label={ariaLabel ?? (typeof label === \"string\" ? label : undefined)}\n aria-expanded={isExpanded}\n disabled={disabled}\n className={cn(\n \"relative inline-flex h-11 min-w-11 items-center overflow-hidden rounded-full border border-border bg-transparent p-1 pr-1 font-medium text-foreground text-sm outline-none transition-colors focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset disabled:pointer-events-none disabled:opacity-50\",\n className,\n )}\n style={{ borderRadius: 9999 }}\n onClick={handleClick}\n whileTap={reduce || disabled ? undefined : { scale: 0.97 }}\n transition={transition}\n >\n <motion.span\n layout=\"position\"\n className=\"grid size-9 shrink-0 place-items-center\"\n aria-hidden=\"true\"\n transition={transition}\n >\n {icon}\n </motion.span>\n <AnimatePresence mode=\"popLayout\" initial={false}>\n {isExpanded ? (\n <motion.span\n key=\"label\"\n layout\n variants={CONTINUITY_LABEL}\n initial={reduce ? { opacity: 0 } : \"hidden\"}\n animate={reduce ? { opacity: 1 } : \"visible\"}\n exit={reduce ? { opacity: 0 } : \"exit\"}\n transition={transition}\n className=\"relative inline-flex w-max items-center whitespace-nowrap pr-3\"\n aria-hidden=\"true\"\n >\n {label}\n </motion.span>\n ) : null}\n </AnimatePresence>\n </motion.button>\n </motion.span>\n );\n}\n\nexport function ExpandableChip({\n label,\n actionIcon,\n actionLabel,\n onAction,\n collapseOnAction = true,\n expanded,\n defaultExpanded,\n onExpandedChange,\n disabled,\n className,\n labelClassName,\n actionClassName,\n}: ExpandableChipProps) {\n const reduce = useReducedMotion();\n const triggerRef = useRef<HTMLButtonElement>(null);\n const [isExpanded, setExpanded] = useExpandableState({\n expanded,\n defaultExpanded,\n onExpandedChange,\n });\n\n const handleAction = () => {\n onAction?.();\n if (collapseOnAction) {\n setExpanded(false);\n triggerRef.current?.focus();\n }\n };\n\n const transition = reduce ? { duration: 0 } : CONTINUITY_SPRING;\n\n return (\n <motion.span layout transition={transition} className=\"inline-flex\">\n <motion.div\n layout\n className={cn(\n \"inline-flex h-10 items-center overflow-hidden rounded-full border border-border bg-transparent text-foreground text-sm has-focus-visible:ring-2 has-focus-visible:ring-ring has-focus-visible:ring-inset\",\n className,\n )}\n style={{ borderRadius: 9999 }}\n transition={transition}\n >\n <motion.button\n layout=\"position\"\n ref={triggerRef}\n type=\"button\"\n aria-expanded={isExpanded}\n disabled={disabled}\n className={cn(\n \"h-full whitespace-nowrap py-0 pl-3 font-medium outline-none disabled:pointer-events-none disabled:opacity-50\",\n isExpanded ? \"pr-1\" : \"pr-3\",\n labelClassName,\n )}\n onClick={() => setExpanded(!isExpanded)}\n transition={transition}\n >\n {label}\n </motion.button>\n <motion.span\n variants={CONTINUITY_LABEL}\n className={cn(\n \"relative inline-flex h-10 shrink-0 items-center overflow-hidden\",\n isExpanded ? \"w-8\" : \"w-0\",\n )}\n aria-hidden={!isExpanded}\n initial={false}\n animate={reduce ? { opacity: isExpanded ? 1 : 0 } : isExpanded ? \"visible\" : \"hidden\"}\n transition={transition}\n >\n <motion.button\n type=\"button\"\n aria-label={actionLabel}\n disabled={disabled || !isExpanded}\n className={cn(\n \"flex h-10 w-8 shrink-0 items-center justify-center rounded-full text-muted-foreground outline-none transition-colors hover:text-foreground disabled:pointer-events-none\",\n disabled && \"opacity-50\",\n actionClassName,\n )}\n onClick={handleAction}\n whileTap={reduce || disabled ? undefined : { scale: 0.97 }}\n transition={transition}\n >\n <span aria-hidden=\"true\">{actionIcon}</span>\n </motion.button>\n </motion.span>\n </motion.div>\n </motion.span>\n );\n}\n"],"mappings":";;;;;;AAgBA,MAAM,oBAAgC;CACpC,MAAM;CACN,WAAW;CACX,SAAS;CACT,MAAM;AACR;AAEA,MAAM,mBAA6B;CACjC,QAAQ;EAAE,SAAS;EAAG,QAAQ;CAAY;CAC1C,SAAS;EAAE,SAAS;EAAG,QAAQ;CAAY;CAC3C,MAAM;EAAE,SAAS;EAAG,QAAQ;CAAY;AAC1C;AA2BA,SAAS,mBAAmB,EAC1B,UACA,kBAAkB,OAClB,oBACuB;CACvB,MAAM,CAAC,kBAAkB,uBAAuB,SAAS,eAAe;CACxE,MAAM,eAAe,aAAa,KAAA;CAalC,OAAO,CAZiB,YAAY,kBAEhB,aACjB,iBAA0B;EACzB,IAAI,CAAC,cACH,oBAAoB,YAAY;EAElC,mBAAmB,YAAY;CACjC,GACA,CAAC,cAAc,gBAAgB,CAGE,CAAC;AACtC;AAEA,SAAgB,iBAAiB,EAC/B,MACA,OACA,UACA,iBACA,kBACA,WACA,SACA,UACA,OAAO,UACP,cAAc,WACd,GAAG,SACqB;CACxB,MAAM,SAAS,iBAAiB;CAChC,MAAM,CAAC,YAAY,eAAe,mBAAmB;EACnD;EACA;EACA;CACF,CAAC;CAED,MAAM,eAAe,UAAyC;EAC5D,UAAU,KAAK;EACf,IAAI,CAAC,MAAM,kBACT,YAAY,CAAC,UAAU;CAE3B;CAEA,MAAM,aAAa,SAAS,EAAE,UAAU,EAAE,IAAI;CAE9C,OACE,oBAAC,OAAO,MAAR;EAAa,QAAA;EAAmB;EAAY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APd,UAAA,CASE,oBAAC,OAAO,QAAR;IACE,QAAO;IACP,KAAK;IACL,MAAK;IACL,iBAAe;IACL;IACV,WAAW,GACT,gHACA,aAAa,SAAS,QACtB,cACF;IACA,eAAe,YAAY,CAAC,UAAU;IAC1B;IAEX,UAAA;GACY,CAAA,GACf,oBAAC,OAAO,MAAR;IACE,UAAU;IACV,WAAW,GACT,mEACA,aAAa,QAAQ,KACvB;IACA,eAAa,CAAC;IACd,SAAS;IACT,SAAS,SAAS,EAAE,SAAS,aAAa,IAAI,EAAE,IAAI,aAAa,YAAY;IACjE;IAEZ,UAAA,oBAAC,OAAO,QAAR;KACE,MAAK;KACL,cAAY;KACZ,UAAU,YAAY,CAAC;KACvB,WAAW,GACT,2KACA,YAAY,cACZ,eACF;KACA,SAAS;KACT,UAAU,UAAU,WAAW,KAAA,IAAY,EAAE,OAAO,IAAK;KAC7C;KAEZ,UAAA,oBAAC,QAAD;MAAM,eAAY;MAAQ,UAAA;KAAiB,CAAA;IAC9B,CAAA;GACJ,CAAA,CACH;;CACD,CAAA;AAEjB"}
1
+ {"version":3,"file":"expandable-control.js","names":[],"sources":["../../../src/components/motion/expandable-control.tsx"],"sourcesContent":["\"use client\";\n\nimport { type MouseEvent, type ReactNode, useCallback, useRef, useState } from \"react\";\nimport { cn } from \"cn\";\nimport {\n AnimatePresence,\n type HTMLMotionProps,\n motion,\n type Transition,\n useReducedMotion,\n type Variants,\n} from \"motion/react\";\n\n// Matches the Motion Patterns \"Layout continuity\" recipe so the surface\n// keeps its identity while its footprint changes.\nconst CONTINUITY_SPRING: Transition = {\n type: \"spring\",\n stiffness: 220,\n damping: 17,\n mass: 0.85,\n};\n\nconst CONTINUITY_LABEL: Variants = {\n hidden: { opacity: 0, filter: \"blur(4px)\" },\n visible: { opacity: 1, filter: \"blur(0px)\" },\n exit: { opacity: 0, filter: \"blur(4px)\" },\n};\n\ntype ExpandableStateProps = {\n expanded?: boolean;\n defaultExpanded?: boolean;\n onExpandedChange?: (expanded: boolean) => void;\n};\n\nexport interface ExpandableButtonProps\n extends Omit<HTMLMotionProps<\"button\">, \"children\">,\n ExpandableStateProps {\n icon: ReactNode;\n label: ReactNode;\n}\n\nexport interface ExpandableChipProps extends ExpandableStateProps {\n label: ReactNode;\n actionIcon: ReactNode;\n actionLabel: string;\n onAction?: () => void;\n collapseOnAction?: boolean;\n disabled?: boolean;\n className?: string;\n labelClassName?: string;\n actionClassName?: string;\n}\n\nfunction useExpandableState({\n expanded,\n defaultExpanded = false,\n onExpandedChange,\n}: ExpandableStateProps) {\n const [internalExpanded, setInternalExpanded] = useState(defaultExpanded);\n const isControlled = expanded !== undefined;\n const currentExpanded = expanded ?? internalExpanded;\n\n const setExpanded = useCallback(\n (nextExpanded: boolean) => {\n if (!isControlled) {\n setInternalExpanded(nextExpanded);\n }\n onExpandedChange?.(nextExpanded);\n },\n [isControlled, onExpandedChange],\n );\n\n return [currentExpanded, setExpanded] as const;\n}\n\nexport function ExpandableButton({\n icon,\n label,\n expanded,\n defaultExpanded,\n onExpandedChange,\n className,\n onClick,\n disabled,\n type = \"button\",\n \"aria-label\": ariaLabel,\n ...props\n}: ExpandableButtonProps) {\n const reduce = useReducedMotion();\n const [isExpanded, setExpanded] = useExpandableState({\n expanded,\n defaultExpanded,\n onExpandedChange,\n });\n\n const handleClick = (event: MouseEvent<HTMLButtonElement>) => {\n onClick?.(event);\n if (!event.defaultPrevented) {\n setExpanded(!isExpanded);\n }\n };\n\n const transition = reduce ? { duration: 0 } : CONTINUITY_SPRING;\n\n return (\n <motion.span layout transition={transition} className=\"inline-flex\">\n <motion.button\n {...props}\n layout\n type={type}\n aria-label={ariaLabel ?? (typeof label === \"string\" ? label : undefined)}\n aria-expanded={isExpanded}\n disabled={disabled}\n className={cn(\n \"relative inline-flex h-11 min-w-11 items-center overflow-hidden rounded-full border border-border bg-transparent p-1 pr-1 font-medium text-foreground text-sm outline-none transition-colors focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset disabled:pointer-events-none disabled:opacity-50\",\n className,\n )}\n style={{ borderRadius: 9999 }}\n onClick={handleClick}\n whileTap={reduce || disabled ? undefined : { scale: 0.97 }}\n transition={transition}\n >\n <motion.span\n layout=\"position\"\n className=\"grid size-9 shrink-0 place-items-center\"\n aria-hidden=\"true\"\n transition={transition}\n >\n {icon}\n </motion.span>\n <AnimatePresence mode=\"popLayout\" initial={false}>\n {isExpanded ? (\n <motion.span\n key=\"label\"\n layout\n variants={CONTINUITY_LABEL}\n initial={reduce ? { opacity: 0 } : \"hidden\"}\n animate={reduce ? { opacity: 1 } : \"visible\"}\n exit={reduce ? { opacity: 0 } : \"exit\"}\n transition={transition}\n className=\"relative inline-flex w-max items-center whitespace-nowrap pr-3\"\n aria-hidden=\"true\"\n >\n {label}\n </motion.span>\n ) : null}\n </AnimatePresence>\n </motion.button>\n </motion.span>\n );\n}\n\nexport function ExpandableChip({\n label,\n actionIcon,\n actionLabel,\n onAction,\n collapseOnAction = true,\n expanded,\n defaultExpanded,\n onExpandedChange,\n disabled,\n className,\n labelClassName,\n actionClassName,\n}: ExpandableChipProps) {\n const reduce = useReducedMotion();\n const triggerRef = useRef<HTMLButtonElement>(null);\n const [isExpanded, setExpanded] = useExpandableState({\n expanded,\n defaultExpanded,\n onExpandedChange,\n });\n\n const handleAction = () => {\n onAction?.();\n if (collapseOnAction) {\n setExpanded(false);\n triggerRef.current?.focus();\n }\n };\n\n const transition = reduce ? { duration: 0 } : CONTINUITY_SPRING;\n\n return (\n <motion.span layout transition={transition} className=\"inline-flex\">\n <motion.div\n layout\n className={cn(\n \"inline-flex h-10 items-center overflow-hidden rounded-full border border-border bg-transparent text-foreground text-sm has-focus-visible:ring-2 has-focus-visible:ring-ring has-focus-visible:ring-inset\",\n className,\n )}\n style={{ borderRadius: 9999 }}\n transition={transition}\n >\n <motion.button\n layout=\"position\"\n ref={triggerRef}\n type=\"button\"\n aria-expanded={isExpanded}\n disabled={disabled}\n className={cn(\n \"h-full whitespace-nowrap py-0 pl-3 font-medium outline-none disabled:pointer-events-none disabled:opacity-50\",\n isExpanded ? \"pr-1\" : \"pr-3\",\n labelClassName,\n )}\n onClick={() => setExpanded(!isExpanded)}\n transition={transition}\n >\n {label}\n </motion.button>\n <motion.span\n variants={CONTINUITY_LABEL}\n className={cn(\n \"relative inline-flex h-10 shrink-0 items-center overflow-hidden\",\n isExpanded ? \"w-8\" : \"w-0\",\n )}\n aria-hidden={!isExpanded}\n initial={false}\n animate={reduce ? { opacity: isExpanded ? 1 : 0 } : isExpanded ? \"visible\" : \"hidden\"}\n transition={transition}\n >\n <motion.button\n type=\"button\"\n aria-label={actionLabel}\n disabled={disabled || !isExpanded}\n className={cn(\n \"flex h-10 w-8 shrink-0 items-center justify-center rounded-full text-muted-foreground outline-none transition-colors hover:text-foreground disabled:pointer-events-none\",\n disabled && \"opacity-50\",\n actionClassName,\n )}\n onClick={handleAction}\n whileTap={reduce || disabled ? undefined : { scale: 0.97 }}\n transition={transition}\n >\n <span aria-hidden=\"true\">{actionIcon}</span>\n </motion.button>\n </motion.span>\n </motion.div>\n </motion.span>\n );\n}\n"],"mappings":";;;;;;AAeA,MAAM,oBAAgC;CACpC,MAAM;CACN,WAAW;CACX,SAAS;CACT,MAAM;AACR;AAEA,MAAM,mBAA6B;CACjC,QAAQ;EAAE,SAAS;EAAG,QAAQ;CAAY;CAC1C,SAAS;EAAE,SAAS;EAAG,QAAQ;CAAY;CAC3C,MAAM;EAAE,SAAS;EAAG,QAAQ;CAAY;AAC1C;AA2BA,SAAS,mBAAmB,EAC1B,UACA,kBAAkB,OAClB,oBACuB;CACvB,MAAM,CAAC,kBAAkB,uBAAuB,SAAS,eAAe;CACxE,MAAM,eAAe,aAAa,KAAA;CAalC,OAAO,CAZiB,YAAY,kBAEhB,aACjB,iBAA0B;EACzB,IAAI,CAAC,cACH,oBAAoB,YAAY;EAElC,mBAAmB,YAAY;CACjC,GACA,CAAC,cAAc,gBAAgB,CAGE,CAAC;AACtC;AAEA,SAAgB,iBA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MAAM,CAAC,YAAY,eAAe,mBAAmB;EACnD;EACA;EACA;CACF,CAAC;CAED,MAAM,qBAAqB;EACzB,WAAW;EACX,IAAI,kBAAkB;GACpB,YAAY,KAAK;GACjB,WAAW,SAAS,MAAM;EAC5B;CACF;CAEA,MAAM,aAAa,SAAS,EAAE,UAAU,EAAE,IAAI;CAE9C,OACE,oBAAC,OAAO,MAAR;EAAa,QAAA;EAAmB;EAAY,WAAU;EACpD,UAAA,qBAAC,OAAO,KAAR;GACE,QAAA;GACA,WAAW,GACT,4MACA,SACF;GACA,OAAO,EAAE,cAAc,KAAK;GAChB;GAPd,UAAA,CASE,oBAAC,OAAO,QAAR;IACE,QAAO;IACP,KAAK;IACL,MAAK;IACL,iBAAe;IACL;IACV,WAAW,GACT,gHACA,aAAa,SAAS,QACtB,cACF;IACA,eAAe,YAAY,CAAC,UAAU;IAC1B;IAEX,UAAA;GACY,CAAA,GACf,oBAAC,OAAO,MAAR;IACE,UAAU;IACV,WAAW,GACT,mEACA,aAAa,QAAQ,KACvB;IACA,eAAa,CAAC;IACd,SAAS;IACT,SAAS,SAAS,EAAE,SAAS,aAAa,IAAI,EAAE,IAAI,aAAa,YAAY;IACjE;IAEZ,UAAA,oBAAC,OAAO,QAAR;KACE,MAAK;KACL,cAAY;KACZ,UAAU,YAAY,CAAC;KACvB,WAAW,GACT,2KACA,YAAY,cACZ,eACF;KACA,SAAS;KACT,UAAU,UAAU,WAAW,KAAA,IAAY,EAAE,OAAO,IAAK;KAC7C;KAEZ,UAAA,oBAAC,QAAD;MAAM,eAAY;MAAQ,UAAA;KAAiB,CAAA;IAC9B,CAAA;GACJ,CAAA,CACH;;CACD,CAAA;AAEjB"}
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import { EASE_OUT } from "../../lib/ease.js";
3
3
  import { useCallback, useEffect, useLayoutEffect, useRef, useState } from "react";
4
- import { cn } from "@kumix/utils";
4
+ import { cn } from "cn";
5
5
  import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
6
6
  import { AnimatePresence, motion, useReducedMotion } from "motion/react";
7
7
  //#region src/components/motion/expandable-tabs.tsx
@@ -1 +1 @@
1
- {"version":3,"file":"expandable-tabs.js","names":[],"sources":["../../../src/components/motion/expandable-tabs.tsx"],"sourcesContent":["\"use client\";\n\nimport { type ReactNode, useCallback, useEffect, useLayoutEffect, useRef, useState } from \"react\";\nimport { AnimatePresence, motion, useReducedMotion, type Variants } from \"motion/react\";\n\nimport { cn } from \"@kumix/utils\";\nimport { EASE_OUT } from \"../../lib/ease\";\n\nexport type ExpandableTabsItem = {\n id: string;\n /** String label — shown inside the active tab and used as the button's accessible name. */\n label: string;\n icon: ReactNode;\n /** Panel shown above the bar when this tab is active. */\n content: ReactNode;\n};\n\nexport type ExpandableTabsClassNames = {\n root?: string;\n panel?: string;\n bar?: string;\n tab?: string;\n activeTab?: string;\n icon?: string;\n label?: string;\n pill?: string;\n};\n\nexport interface ExpandableTabsProps {\n items: ExpandableTabsItem[];\n /** Active tab id, or null/undefined for the closed (bar-only) state. */\n value?: string | null;\n defaultValue?: string | null;\n onValueChange?: (id: string | null) => void;\n className?: string;\n classNames?: ExpandableTabsClassNames;\n}\n\ntype Size = { width: number; height: number };\n\n// DynamicIsland-style real width/height motion, tuned tighter here so the tab\n// bar feels controlled instead of elastic.\nconst SHELL_SPRING = { type: \"spring\", duration: 0.58, bounce: 0.06 } as const;\n\n// Position-only tab layout motion keeps switching loose without stretching\n// icons or letting the label linger.\nconst TAB_CHANGE_SPRING = {\n type: \"spring\",\n duration: 0.46,\n bounce: 0.04,\n} as const;\nconst LABEL_OPEN = { type: \"spring\", duration: 0.38, bounce: 0.03 } as const;\nconst LABEL_CLOSE = { duration: 0.16, ease: EASE_OUT } as const;\n\n// Fixed bar height keeps the content panel's bottom reserve static so the open\n// height is right on the first frame. p-2 (16) + h-9 button (36).\nconst BAR_H = 52;\nconst TAB_W = 32;\nconst BAR_X = 16;\nconst BAR_GAP = 4;\nconst ROOT_BORDER = 2;\nconst ICON_W = 16;\nconst ACTIVE_LEFT_PAD = 10;\nconst ACTIVE_RIGHT_PAD = 16;\nconst LABEL_GAP = 7;\nconst PANEL_DOCK_GAP = 4;\n\n// Content is clipped above the dock so rows never pass through the icon bar.\n// It enters from slightly above instead of from the dock line.\nconst CONTENT_VARIANTS: Variants = {\n enter: { y: -8, scale: 0.98, opacity: 0, filter: \"blur(4px)\" },\n center: { y: 0, scale: 1, opacity: 1, filter: \"blur(0px)\" },\n exit: {\n y: -6,\n scale: 0.98,\n opacity: 0,\n filter: \"blur(4px)\",\n transition: { duration: 0.08, ease: EASE_OUT },\n },\n};\n\nconst REDUCED_CONTENT_VARIANTS: Variants = {\n enter: { opacity: 0, filter: \"blur(0px)\" },\n center: { opacity: 1, filter: \"blur(0px)\" },\n exit: {\n opacity: 0,\n filter: \"blur(0px)\",\n transition: { duration: 0.08, ease: EASE_OUT },\n },\n};\n\nconst CONTENT_SPRING = { type: \"spring\", duration: 0.46, bounce: 0.08 } as const;\n\nfunction sameSize(a: Size | null | undefined, b: Size | null | undefined) {\n return a?.width === b?.width && a?.height === b?.height;\n}\n\nfunction sameWidths(a: Record<string, number>, b: Record<string, number>) {\n const aKeys = Object.keys(a);\n const bKeys = Object.keys(b);\n\n if (aKeys.length !== bKeys.length) {\n return false;\n }\n\n return aKeys.every((key) => a[key] === b[key]);\n}\n\nfunction useContentSize() {\n const ref = useRef<HTMLDivElement | null>(null);\n const [size, setSize] = useState<Size | null>(null);\n\n const measure = useCallback(() => {\n const el = ref.current;\n if (!el) return;\n const next = { width: el.offsetWidth, height: el.offsetHeight };\n setSize((current) => (sameSize(current, next) ? current : next));\n }, []);\n\n useLayoutEffect(() => {\n measure();\n }, [measure]);\n\n useEffect(() => {\n const el = ref.current;\n if (!el || typeof ResizeObserver === \"undefined\") return;\n const observer = new ResizeObserver(measure);\n observer.observe(el);\n return () => observer.disconnect();\n }, [measure]);\n\n return [ref, size] as const;\n}\n\nfunction useLabelWidths(items: ExpandableTabsItem[]) {\n const refs = useRef<Record<string, HTMLSpanElement | null>>({});\n const [widths, setWidths] = useState<Record<string, number>>({});\n\n const setLabelMeasureRef = useCallback(\n (id: string) => (node: HTMLSpanElement | null) => {\n refs.current[id] = node;\n },\n [],\n );\n\n const measure = useCallback(() => {\n const next: Record<string, number> = {};\n\n for (const item of items) {\n const node = refs.current[item.id];\n\n if (node) {\n next[item.id] = Math.ceil(node.offsetWidth);\n }\n }\n\n setWidths((current) => (sameWidths(current, next) ? current : next));\n }, [items]);\n\n useLayoutEffect(() => {\n measure();\n }, [measure]);\n\n useEffect(() => {\n if (typeof ResizeObserver === \"undefined\") {\n return;\n }\n\n const observer = new ResizeObserver(measure);\n\n for (const item of items) {\n const node = refs.current[item.id];\n\n if (node) {\n observer.observe(node);\n }\n }\n\n return () => observer.disconnect();\n }, [items, measure]);\n\n return { setLabelMeasureRef, widths };\n}\n\nexport function ExpandableTabs({\n items,\n value,\n defaultValue = null,\n onValueChange,\n className,\n classNames,\n}: ExpandableTabsProps) {\n const reduce = useReducedMotion();\n const rootRef = useRef<HTMLDivElement>(null);\n const [sizerRef, size] = useContentSize();\n const { setLabelMeasureRef, widths: labelWidths } = useLabelWidths(items);\n\n const controlled = value !== undefined;\n const [internal, setInternal] = useState<string | null>(defaultValue);\n const activeId = controlled ? value : internal;\n const active = items.find((item) => item.id === activeId) ?? null;\n const visualActiveId = active?.id ?? null;\n\n const setActive = useCallback(\n (next: string | null) => {\n if (!controlled) setInternal(next);\n onValueChange?.(next);\n },\n [controlled, onValueChange],\n );\n\n // Outside click / Escape closes — it behaves like an open menu.\n useEffect(() => {\n if (!visualActiveId) return;\n const onPointer = (e: PointerEvent) => {\n if (!rootRef.current?.contains(e.target as Node)) setActive(null);\n };\n const onKey = (e: KeyboardEvent) => {\n if (e.key === \"Escape\") setActive(null);\n };\n document.addEventListener(\"pointerdown\", onPointer);\n document.addEventListener(\"keydown\", onKey);\n return () => {\n document.removeEventListener(\"pointerdown\", onPointer);\n document.removeEventListener(\"keydown\", onKey);\n };\n }, [setActive, visualActiveId]);\n\n const closedSize = {\n width: items.length * TAB_W + Math.max(0, items.length - 1) * BAR_GAP + BAR_X + ROOT_BORDER,\n height: BAR_H + ROOT_BORDER,\n };\n const openSize = size\n ? {\n width: Math.max(size.width + ROOT_BORDER, closedSize.width),\n height: Math.max(size.height + ROOT_BORDER, closedSize.height),\n }\n : closedSize;\n const targetSize = active ? openSize : closedSize;\n\n const getActiveTabWidth = useCallback(\n (item: ExpandableTabsItem) =>\n Math.max(\n TAB_W,\n ACTIVE_LEFT_PAD + ICON_W + LABEL_GAP + (labelWidths[item.id] ?? 0) + ACTIVE_RIGHT_PAD,\n ),\n [labelWidths],\n );\n\n return (\n <>\n <motion.div\n ref={rootRef}\n initial={false}\n animate={targetSize ? { width: targetSize.width, height: targetSize.height } : undefined}\n transition={reduce ? { duration: 0 } : SHELL_SPRING}\n style={{ transformOrigin: \"bottom center\" }}\n className={cn(\n \"relative overflow-hidden rounded-[26px] border border-border bg-card\",\n className,\n classNames?.root,\n )}\n >\n <div\n ref={sizerRef}\n aria-hidden\n className={cn(\n \"pointer-events-none invisible absolute top-0 left-0 grid w-max px-2 pt-2\",\n classNames?.panel,\n )}\n style={{ paddingBottom: BAR_H + PANEL_DOCK_GAP }}\n >\n {items.map((item) => (\n <div key={item.id} className=\"col-start-1 row-start-1 w-max\">\n {item.content}\n </div>\n ))}\n </div>\n\n <div\n className={cn(\n \"absolute top-0 right-0 left-0 z-10 overflow-hidden px-2 pt-2\",\n classNames?.panel,\n )}\n style={{ bottom: BAR_H + PANEL_DOCK_GAP }}\n >\n <AnimatePresence mode=\"popLayout\" initial={false}>\n {active ? (\n <motion.div\n key={active.id}\n variants={reduce ? REDUCED_CONTENT_VARIANTS : CONTENT_VARIANTS}\n initial=\"enter\"\n animate=\"center\"\n exit=\"exit\"\n transition={reduce ? { duration: 0.15, ease: EASE_OUT } : CONTENT_SPRING}\n className=\"w-max\"\n style={{\n transformOrigin: \"top center\",\n willChange: \"transform, opacity, filter\",\n }}\n >\n {active.content}\n </motion.div>\n ) : null}\n </AnimatePresence>\n </div>\n\n <div\n role=\"tablist\"\n aria-label=\"Navigation tabs\"\n aria-orientation=\"horizontal\"\n className={cn(\n \"absolute bottom-0 left-0 z-20 flex w-full items-center justify-between gap-1 p-2\",\n classNames?.bar,\n )}\n style={{ height: BAR_H }}\n >\n {items.map((item) => {\n const isActive = item.id === visualActiveId;\n const activeTabWidth = getActiveTabWidth(item);\n const labelWidth = labelWidths[item.id] ?? 0;\n\n return (\n <motion.button\n key={item.id}\n type=\"button\"\n role=\"tab\"\n aria-selected={isActive}\n aria-label={item.label}\n onClick={() => setActive(isActive ? null : item.id)}\n layout={reduce ? false : \"position\"}\n animate={{\n width: active && isActive ? activeTabWidth : TAB_W,\n }}\n transition={reduce ? { duration: 0 } : TAB_CHANGE_SPRING}\n className={cn(\n \"relative isolate flex h-9 min-w-8 shrink-0 items-center justify-center overflow-hidden rounded-[18px] px-2 font-medium text-sm outline-none\",\n \"focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background\",\n active && isActive && \"min-w-0 justify-start pr-4 pl-2.5\",\n isActive ? \"text-foreground\" : \"text-muted-foreground hover:text-foreground\",\n classNames?.tab,\n isActive && classNames?.activeTab,\n )}\n >\n {isActive ? (\n <span\n className={cn(\n \"absolute inset-0 -z-10 rounded-[18px] bg-foreground/10\",\n classNames?.pill,\n )}\n />\n ) : null}\n <span className={cn(\"grid shrink-0 place-items-center\", classNames?.icon)}>\n {item.icon}\n </span>\n <motion.span\n aria-hidden\n initial={false}\n animate={\n reduce\n ? {\n width: isActive ? labelWidth : 0,\n opacity: isActive ? 1 : 0,\n marginLeft: isActive ? LABEL_GAP : 0,\n filter: \"blur(0px)\",\n }\n : {\n width: isActive ? labelWidth : 0,\n opacity: isActive ? 1 : 0,\n marginLeft: isActive ? LABEL_GAP : 0,\n filter: isActive ? \"blur(0px)\" : \"blur(3px)\",\n }\n }\n transition={reduce ? { duration: 0 } : isActive ? LABEL_OPEN : LABEL_CLOSE}\n className={cn(\n \"inline-block overflow-hidden whitespace-nowrap\",\n classNames?.label,\n )}\n >\n {item.label}\n </motion.span>\n </motion.button>\n );\n })}\n </div>\n </motion.div>\n <div\n aria-hidden=\"true\"\n className=\"pointer-events-none fixed top-0 left-0 -z-10 flex opacity-0\"\n >\n {items.map((item) => (\n <span\n className={cn(\"whitespace-nowrap font-medium text-sm leading-none\", classNames?.label)}\n key={item.id}\n ref={setLabelMeasureRef(item.id)}\n >\n {item.label}\n </span>\n ))}\n </div>\n </>\n );\n}\n"],"mappings":";;;;;;;AA0CA,MAAM,eAAe;CAAE,MAAM;CAAU,UAAU;CAAM,QAAQ;AAAK;AAIpE,MAAM,oBAAoB;CACxB,MAAM;CACN,UAAU;CACV,QAAQ;AACV;AACA,MAAM,aAAa;CAAE,MAAM;CAAU,UAAU;CAAM,QAAQ;AAAK;AAClE,MAAM,cAAc;CAAE,UAAU;CAAM,MAAM;AAAS;AAIrD,MAAM,QAAQ;AACd,MAAM,QAAQ;AACd,MAAM,QAAQ;AACd,MAAM,UAAU;AAChB,MAAM,cAAc;AAGpB,MAAM,mBAAmB;AACzB,MAAM,YAAY;AAKlB,MAAM,mBAA6B;CACjC,OAAO;EAAE,GAAG;EAAI,OAAO;EAAM,SAAS;EAAG,QAAQ;CAAY;CAC7D,QAAQ;EAAE,GAAG;EAAG,OAAO;EAAG,SAAS;EAAG,QAAQ;CAAY;CAC1D,MAAM;EACJ,GAAG;EACH,OAAO;EACP,SAAS;EACT,QAAQ;EACR,YAAY;GAAE,UAAU;GAAM,MAAM;EAAS;CAC/C;AACF;AAEA,MAAM,2BAAqC;CACzC,OAAO;EAAE,SAAS;EAAG,QAAQ;CAAY;CACzC,QAAQ;EAAE,SAAS;EAAG,QAAQ;CAAY;CAC1C,MAAM;EACJ,SAAS;EACT,QAAQ;EACR,YAAY;GAAE,UAAU;GAAM,MAAM;EAAS;CA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S,WAAW,IAAI;SACxB,YAAY,WAAW,YAAY;SACnC,QAAQ;QACV,IACA;SACE,OAAO,WAAW,aAAa;SAC/B,SAAS,WAAW,IAAI;SACxB,YAAY,WAAW,YAAY;SACnC,QAAQ,WAAW,cAAc;QACnC;QAEN,YAAY,SAAS,EAAE,UAAU,EAAE,IAAI,WAAW,aAAa;QAC/D,WAAW,GACT,kDACA,YAAY,KACd;QAEC,UAAA,KAAK;OACK,CAAA;MACA;KAzDR,GAAA,KAAK,EAyDG;IAEnB,CAAC;GACE,CAAA;EACK;CACZ,CAAA,GAAA,oBAAC,OAAD;EACE,eAAY;EACZ,WAAU;EAET,UAAA,MAAM,KAAK,SACV,oBAAC,QAAD;GACE,WAAW,GAAG,sDAAsD,YAAY,KAAK;GAErF,KAAK,mBAAmB,KAAK,EAAE;GAE9B,UAAA,KAAK;EACF,GAJC,KAAK,EAIN,CACP;CACE,CAAA,CACL,EAAA,CAAA;AAEN"}
1
+ {"version":3,"file":"expandable-tabs.js","names":[],"sources":["../../../src/components/motion/expandable-tabs.tsx"],"sourcesContent":["\"use client\";\n\nimport { type ReactNode, useCallback, useEffect, useLayoutEffect, useRef, useState } from \"react\";\nimport { cn } from \"cn\";\nimport { AnimatePresence, motion, useReducedMotion, type Variants } from \"motion/react\";\n\nimport { EASE_OUT } from \"../../lib/ease\";\n\nexport type ExpandableTabsItem = {\n id: string;\n /** String label — shown inside the active tab and used as the button's accessible name. */\n label: string;\n icon: ReactNode;\n /** Panel shown above the bar when this tab is active. */\n content: ReactNode;\n};\n\nexport type ExpandableTabsClassNames = {\n root?: string;\n panel?: string;\n bar?: string;\n tab?: string;\n activeTab?: string;\n icon?: string;\n label?: string;\n pill?: string;\n};\n\nexport interface ExpandableTabsProps {\n items: ExpandableTabsItem[];\n /** Active tab id, or null/undefined for the closed (bar-only) state. */\n value?: string | null;\n defaultValue?: string | null;\n onValueChange?: (id: string | null) => void;\n className?: string;\n classNames?: ExpandableTabsClassNames;\n}\n\ntype Size = { width: number; height: number };\n\n// DynamicIsland-style real width/height motion, tuned tighter here so the tab\n// bar feels controlled instead of elastic.\nconst SHELL_SPRING = { type: \"spring\", duration: 0.58, bounce: 0.06 } as const;\n\n// Position-only tab layout motion keeps switching loose without stretching\n// icons or letting the label linger.\nconst TAB_CHANGE_SPRING = {\n type: \"spring\",\n duration: 0.46,\n bounce: 0.04,\n} as const;\nconst LABEL_OPEN = { type: \"spring\", duration: 0.38, bounce: 0.03 } as const;\nconst LABEL_CLOSE = { duration: 0.16, ease: EASE_OUT } as const;\n\n// Fixed bar height keeps the content panel's bottom reserve static so the open\n// height is right on the first frame. p-2 (16) + h-9 button (36).\nconst BAR_H = 52;\nconst TAB_W = 32;\nconst BAR_X = 16;\nconst BAR_GAP = 4;\nconst ROOT_BORDER = 2;\nconst ICON_W = 16;\nconst ACTIVE_LEFT_PAD = 10;\nconst ACTIVE_RIGHT_PAD = 16;\nconst LABEL_GAP = 7;\nconst PANEL_DOCK_GAP = 4;\n\n// Content is clipped above the dock so rows never pass through the icon bar.\n// It enters from slightly above instead of from the dock line.\nconst CONTENT_VARIANTS: Variants = {\n enter: { y: -8, scale: 0.98, opacity: 0, filter: \"blur(4px)\" },\n center: { y: 0, scale: 1, opacity: 1, filter: \"blur(0px)\" },\n exit: {\n y: -6,\n scale: 0.98,\n opacity: 0,\n filter: \"blur(4px)\",\n transition: { duration: 0.08, ease: EASE_OUT },\n },\n};\n\nconst REDUCED_CONTENT_VARIANTS: Variants = {\n enter: { opacity: 0, filter: \"blur(0px)\" },\n center: { opacity: 1, filter: \"blur(0px)\" },\n exit: {\n opacity: 0,\n filter: \"blur(0px)\",\n transition: { duration: 0.08, ease: EASE_OUT },\n },\n};\n\nconst CONTENT_SPRING = { type: \"spring\", duration: 0.46, bounce: 0.08 } as const;\n\nfunction sameSize(a: Size | null | undefined, b: Size | null | undefined) {\n return a?.width === b?.width && a?.height === b?.height;\n}\n\nfunction sameWidths(a: Record<string, number>, b: Record<string, number>) {\n const aKeys = Object.keys(a);\n const bKeys = Object.keys(b);\n\n if (aKeys.length !== bKeys.length) {\n return false;\n }\n\n return aKeys.every((key) => a[key] === b[key]);\n}\n\nfunction useContentSize() {\n const ref = useRef<HTMLDivElement | null>(null);\n const [size, setSize] = useState<Size | null>(null);\n\n const measure = useCallback(() => {\n const el = ref.current;\n if (!el) return;\n const next = { width: el.offsetWidth, height: el.offsetHeight };\n setSize((current) => (sameSize(current, next) ? current : next));\n }, []);\n\n useLayoutEffect(() => {\n measure();\n }, [measure]);\n\n useEffect(() => {\n const el = ref.current;\n if (!el || typeof ResizeObserver === \"undefined\") return;\n const observer = new ResizeObserver(measure);\n observer.observe(el);\n return () => observer.disconnect();\n }, [measure]);\n\n return [ref, size] as const;\n}\n\nfunction useLabelWidths(items: ExpandableTabsItem[]) {\n const refs = useRef<Record<string, HTMLSpanElement | null>>({});\n const [widths, setWidths] = useState<Record<string, number>>({});\n\n const setLabelMeasureRef = useCallback(\n (id: string) => (node: HTMLSpanElement | null) => {\n refs.current[id] = node;\n },\n [],\n );\n\n const measure = useCallback(() => {\n const next: Record<string, number> = {};\n\n for (const item of items) {\n const node = refs.current[item.id];\n\n if (node) {\n next[item.id] = Math.ceil(node.offsetWidth);\n }\n }\n\n setWidths((current) => (sameWidths(current, next) ? current : next));\n }, [items]);\n\n useLayoutEffect(() => {\n measure();\n }, [measure]);\n\n useEffect(() => {\n if (typeof ResizeObserver === \"undefined\") {\n return;\n }\n\n const observer = new ResizeObserver(measure);\n\n for (const item of items) {\n const node = refs.current[item.id];\n\n if (node) {\n observer.observe(node);\n }\n }\n\n return () => observer.disconnect();\n }, [items, measure]);\n\n return { setLabelMeasureRef, widths };\n}\n\nexport function ExpandableTabs({\n items,\n value,\n defaultValue = null,\n onValueChange,\n className,\n classNames,\n}: ExpandableTabsProps) {\n const reduce = useReducedMotion();\n const rootRef = useRef<HTMLDivElement>(null);\n const [sizerRef, size] = useContentSize();\n const { setLabelMeasureRef, widths: labelWidths } = useLabelWidths(items);\n\n const controlled = value !== undefined;\n const [internal, setInternal] = useState<string | null>(defaultValue);\n const activeId = controlled ? value : internal;\n const active = items.find((item) => item.id === activeId) ?? null;\n const visualActiveId = active?.id ?? null;\n\n const setActive = useCallback(\n (next: string | null) => {\n if (!controlled) setInternal(next);\n onValueChange?.(next);\n },\n [controlled, onValueChange],\n );\n\n // Outside click / Escape closes — it behaves like an open menu.\n useEffect(() => {\n if (!visualActiveId) return;\n const onPointer = (e: PointerEvent) => {\n if (!rootRef.current?.contains(e.target as Node)) setActive(null);\n };\n const onKey = (e: KeyboardEvent) => {\n if (e.key === \"Escape\") setActive(null);\n };\n document.addEventListener(\"pointerdown\", onPointer);\n document.addEventListener(\"keydown\", onKey);\n return () => {\n document.removeEventListener(\"pointerdown\", onPointer);\n document.removeEventListener(\"keydown\", onKey);\n };\n }, [setActive, visualActiveId]);\n\n const closedSize = {\n width: items.length * TAB_W + Math.max(0, items.length - 1) * BAR_GAP + BAR_X + ROOT_BORDER,\n height: BAR_H + ROOT_BORDER,\n };\n const openSize = size\n ? {\n width: Math.max(size.width + ROOT_BORDER, closedSize.width),\n height: Math.max(size.height + ROOT_BORDER, closedSize.height),\n }\n : closedSize;\n const targetSize = active ? openSize : closedSize;\n\n const getActiveTabWidth = useCallback(\n (item: ExpandableTabsItem) =>\n Math.max(\n TAB_W,\n ACTIVE_LEFT_PAD + ICON_W + LABEL_GAP + (labelWidths[item.id] ?? 0) + ACTIVE_RIGHT_PAD,\n ),\n [labelWidths],\n );\n\n return (\n <>\n <motion.div\n ref={rootRef}\n initial={false}\n animate={targetSize ? { width: targetSize.width, height: targetSize.height } : undefined}\n transition={reduce ? { duration: 0 } : SHELL_SPRING}\n style={{ transformOrigin: \"bottom center\" }}\n className={cn(\n \"relative overflow-hidden rounded-[26px] border border-border bg-card\",\n className,\n classNames?.root,\n )}\n >\n <div\n ref={sizerRef}\n aria-hidden\n className={cn(\n \"pointer-events-none invisible absolute top-0 left-0 grid w-max px-2 pt-2\",\n classNames?.panel,\n )}\n style={{ paddingBottom: BAR_H + PANEL_DOCK_GAP }}\n >\n {items.map((item) => (\n <div key={item.id} className=\"col-start-1 row-start-1 w-max\">\n {item.content}\n </div>\n ))}\n </div>\n\n <div\n className={cn(\n \"absolute top-0 right-0 left-0 z-10 overflow-hidden px-2 pt-2\",\n classNames?.panel,\n )}\n style={{ bottom: BAR_H + PANEL_DOCK_GAP }}\n >\n <AnimatePresence mode=\"popLayout\" initial={false}>\n {active ? (\n <motion.div\n key={active.id}\n variants={reduce ? REDUCED_CONTENT_VARIANTS : CONTENT_VARIANTS}\n initial=\"enter\"\n animate=\"center\"\n exit=\"exit\"\n transition={reduce ? { duration: 0.15, ease: EASE_OUT } : CONTENT_SPRING}\n className=\"w-max\"\n style={{\n transformOrigin: \"top center\",\n willChange: \"transform, opacity, filter\",\n }}\n >\n {active.content}\n </motion.div>\n ) : null}\n </AnimatePresence>\n </div>\n\n <div\n role=\"tablist\"\n aria-label=\"Navigation tabs\"\n aria-orientation=\"horizontal\"\n className={cn(\n \"absolute bottom-0 left-0 z-20 flex w-full items-center justify-between gap-1 p-2\",\n classNames?.bar,\n )}\n style={{ height: BAR_H }}\n >\n {items.map((item) => {\n const isActive = item.id === visualActiveId;\n const activeTabWidth = getActiveTabWidth(item);\n const labelWidth = labelWidths[item.id] ?? 0;\n\n return (\n <motion.button\n key={item.id}\n type=\"button\"\n role=\"tab\"\n aria-selected={isActive}\n aria-label={item.label}\n onClick={() => setActive(isActive ? null : item.id)}\n layout={reduce ? false : \"position\"}\n animate={{\n width: active && isActive ? activeTabWidth : TAB_W,\n }}\n transition={reduce ? { duration: 0 } : TAB_CHANGE_SPRING}\n className={cn(\n \"relative isolate flex h-9 min-w-8 shrink-0 items-center justify-center overflow-hidden rounded-[18px] px-2 font-medium text-sm outline-none\",\n \"focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background\",\n active && isActive && \"min-w-0 justify-start pr-4 pl-2.5\",\n isActive ? \"text-foreground\" : \"text-muted-foreground hover:text-foreground\",\n classNames?.tab,\n isActive && classNames?.activeTab,\n )}\n >\n {isActive ? (\n <span\n className={cn(\n \"absolute inset-0 -z-10 rounded-[18px] bg-foreground/10\",\n classNames?.pill,\n )}\n />\n ) : null}\n <span className={cn(\"grid shrink-0 place-items-center\", classNames?.icon)}>\n {item.icon}\n </span>\n <motion.span\n aria-hidden\n initial={false}\n animate={\n reduce\n ? {\n width: isActive ? labelWidth : 0,\n opacity: isActive ? 1 : 0,\n marginLeft: isActive ? LABEL_GAP : 0,\n filter: \"blur(0px)\",\n }\n : {\n width: isActive ? labelWidth : 0,\n opacity: isActive ? 1 : 0,\n marginLeft: isActive ? LABEL_GAP : 0,\n filter: isActive ? \"blur(0px)\" : \"blur(3px)\",\n }\n }\n transition={reduce ? { duration: 0 } : isActive ? LABEL_OPEN : LABEL_CLOSE}\n className={cn(\n \"inline-block overflow-hidden whitespace-nowrap\",\n classNames?.label,\n )}\n >\n {item.label}\n </motion.span>\n </motion.button>\n );\n })}\n </div>\n </motion.div>\n <div\n aria-hidden=\"true\"\n className=\"pointer-events-none fixed top-0 left-0 -z-10 flex opacity-0\"\n >\n {items.map((item) => (\n <span\n className={cn(\"whitespace-nowrap font-medium text-sm leading-none\", classNames?.label)}\n key={item.id}\n ref={setLabelMeasureRef(item.id)}\n >\n {item.label}\n </span>\n ))}\n </div>\n </>\n );\n}\n"],"mappings":";;;;;;;AA0CA,MAAM,eAAe;CAAE,MAAM;CAAU,UAAU;CAAM,QAAQ;AAAK;AAIpE,MAAM,oBAAoB;CACxB,MAAM;CACN,UAAU;CACV,QAAQ;AACV;AACA,MAAM,aAAa;CAAE,MAAM;CAAU,UAAU;CAAM,QAAQ;AAAK;AAClE,MAAM,cAAc;CAAE,UAAU;CAAM,MAAM;AAAS;AAIrD,MAAM,QAAQ;AACd,MAAM,QAAQ;AACd,MAAM,QAAQ;AACd,MAAM,UAAU;AAChB,MAAM,cAAc;AAGpB,MAAM,mBA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,QAAQ,SAAS,QAAQ;MACzB,SAAS,EACP,OAAO,UAAU,WAAW,iBAAiB,MAC/C;MACA,YAAY,SAAS,EAAE,UAAU,EAAE,IAAI;MACvC,WAAW,GACT,+IACA,iHACA,UAAU,YAAY,qCACtB,WAAW,oBAAoB,+CAC/B,YAAY,KACZ,YAAY,YAAY,SAC1B;MAnBF,UAAA;OAqBG,WACC,oBAAC,QAAD,EACE,WAAW,GACT,0DACA,YAAY,IACd,EACD,CAAA,IACC;OACJ,oBAAC,QAAD;QAAM,WAAW,GAAG,oCAAoC,YAAY,IAAI;QACrE,UAAA,KAAK;OACF,CAAA;OACN,oBAAC,OAAO,MAAR;QACE,eAAA;QACA,SAAS;QACT,SACE,SACI;SACE,OAAO,WAAW,aAAa;SAC/B,SAAS,WAAW,IAAI;SACxB,YAAY,WAAW,YAAY;SACnC,QAAQ;QACV,IACA;SACE,OAAO,WAAW,aAAa;SAC/B,SAAS,WAAW,IAAI;SACxB,YAAY,WAAW,YAAY;SACnC,QAAQ,WAAW,cAAc;QACnC;QAEN,YAAY,SAAS,EAAE,UAAU,EAAE,IAAI,WAAW,aAAa;QAC/D,WAAW,GACT,kDACA,YAAY,KACd;QAEC,UAAA,KAAK;OACK,CAAA;MACA;KAzDR,GAAA,KAAK,EAyDG;IAEnB,CAAC;GACE,CAAA;EACK;CACZ,CAAA,GAAA,oBAAC,OAAD;EACE,eAAY;EACZ,WAAU;EAET,UAAA,MAAM,KAAK,SACV,oBAAC,QAAD;GACE,WAAW,GAAG,sDAAsD,YAAY,KAAK;GAErF,KAAK,mBAAmB,KAAK,EAAE;GAE9B,UAAA,KAAK;EACF,GAJC,KAAK,EAIN,CACP;CACE,CAAA,CACL,EAAA,CAAA;AAEN"}
@@ -2,7 +2,7 @@
2
2
  import { useHoverCapable } from "../../hooks/use-hover-capable.js";
3
3
  import { EASE_OUT, SPRING_LAYOUT, SPRING_PRESS } from "../../lib/ease.js";
4
4
  import { forwardRef, useState } from "react";
5
- import { cn } from "@kumix/utils";
5
+ import { cn } from "cn";
6
6
  import { jsx, jsxs } from "react/jsx-runtime";
7
7
  import { motion, useReducedMotion } from "motion/react";
8
8
  //#region src/components/motion/expanding-arrow-button.tsx
@@ -1 +1 @@
1
- {"version":3,"file":"expanding-arrow-button.js","names":[],"sources":["../../../src/components/motion/expanding-arrow-button.tsx"],"sourcesContent":["\"use client\";\n\nimport { type FocusEvent, forwardRef, type MouseEvent, type ReactNode, useState } from \"react\";\nimport { type HTMLMotionProps, motion, useReducedMotion } from \"motion/react\";\n\nimport { cn } from \"@kumix/utils\";\nimport { useHoverCapable } from \"../../hooks/use-hover-capable\";\nimport { EASE_OUT, SPRING_LAYOUT, SPRING_PRESS } from \"../../lib/ease\";\n\nexport interface ExpandingArrowButtonProps extends Omit<HTMLMotionProps<\"button\">, \"children\"> {\n children: ReactNode;\n accentClassName?: string;\n labelClassName?: string;\n}\n\nconst ARROW_OPACITY = [1, 0.78, 0.54, 0.32, 0.16] as const;\n\nfunction DottedChevron({ className }: { className?: string }) {\n return (\n <svg viewBox=\"0 0 20 28\" fill=\"none\" aria-hidden=\"true\" className={className}>\n <circle cx=\"4\" cy=\"4\" r=\"2\" fill=\"currentColor\" />\n <circle cx=\"10\" cy=\"9\" r=\"2\" fill=\"currentColor\" />\n <circle cx=\"16\" cy=\"14\" r=\"2\" fill=\"currentColor\" />\n <circle cx=\"10\" cy=\"19\" r=\"2\" fill=\"currentColor\" />\n <circle cx=\"4\" cy=\"24\" r=\"2\" fill=\"currentColor\" />\n </svg>\n );\n}\n\nexport const ExpandingArrowButton = forwardRef<HTMLButtonElement, ExpandingArrowButtonProps>(\n function ExpandingArrowButton(\n {\n children,\n className,\n accentClassName,\n labelClassName,\n disabled,\n onMouseEnter,\n onMouseLeave,\n onFocus,\n onBlur,\n ...rest\n },\n ref,\n ) {\n const reduce = useReducedMotion();\n const canHover = useHoverCapable();\n const [hovered, setHovered] = useState(false);\n const [focused, setFocused] = useState(false);\n const active = !disabled && ((canHover && hovered) || focused);\n const layoutTransition = reduce ? { duration: 0 } : SPRING_LAYOUT;\n\n const handleMouseEnter = (event: MouseEvent<HTMLButtonElement>) => {\n setHovered(true);\n onMouseEnter?.(event);\n };\n\n const handleMouseLeave = (event: MouseEvent<HTMLButtonElement>) => {\n setHovered(false);\n onMouseLeave?.(event);\n };\n\n const handleFocus = (event: FocusEvent<HTMLButtonElement>) => {\n setFocused(true);\n onFocus?.(event);\n };\n\n const handleBlur = (event: FocusEvent<HTMLButtonElement>) => {\n setFocused(false);\n onBlur?.(event);\n };\n\n return (\n <motion.button\n ref={ref}\n type=\"button\"\n disabled={disabled}\n onMouseEnter={handleMouseEnter}\n onMouseLeave={handleMouseLeave}\n onFocus={handleFocus}\n onBlur={handleBlur}\n whileTap={reduce || disabled ? undefined : { scale: 0.97 }}\n transition={SPRING_PRESS}\n className={cn(\n \"relative inline-flex h-16 min-w-72 select-none items-center overflow-hidden rounded-[22px] bg-neutral-950 p-1.5 text-white\",\n \"outline-none focus-visible:ring-2 focus-visible:ring-lime-300 focus-visible:ring-offset-2 focus-visible:ring-offset-background\",\n \"disabled:pointer-events-none disabled:opacity-50\",\n className,\n )}\n {...rest}\n >\n <motion.span\n layout=\"size\"\n aria-hidden=\"true\"\n transition={layoutTransition}\n style={{\n width: active ? \"calc(100% - 12px)\" : 52,\n borderRadius: 16,\n }}\n className={cn(\n \"absolute inset-y-1.5 left-1.5 z-10 overflow-hidden bg-lime-300 text-neutral-950\",\n accentClassName,\n )}\n >\n <motion.span\n animate={{ opacity: active ? 0 : 1 }}\n transition={{ duration: reduce ? 0 : 0.1, ease: EASE_OUT }}\n className=\"absolute inset-0 grid place-items-center\"\n >\n <DottedChevron className=\"h-7 w-5\" />\n </motion.span>\n\n <span className=\"absolute inset-0 flex items-center justify-around px-3\">\n {ARROW_OPACITY.map((opacity, index) => (\n <motion.span\n key={opacity}\n animate={{\n opacity: active ? 1 : 0,\n transform: active && !reduce ? \"translateX(0px)\" : \"translateX(-6px)\",\n }}\n transition={{\n duration: reduce ? 0 : 0.18,\n delay: active && !reduce ? 0.04 + index * 0.025 : 0,\n ease: EASE_OUT,\n }}\n style={{ color: `rgb(10 10 10 / ${opacity})` }}\n className=\"inline-grid place-items-center\"\n >\n <DottedChevron className=\"h-7 w-5\" />\n </motion.span>\n ))}\n </span>\n </motion.span>\n\n <motion.span\n animate={{\n opacity: active ? 0 : 1,\n transform: active && !reduce ? \"translateX(6px)\" : \"translateX(0px)\",\n }}\n transition={{ duration: reduce ? 0 : 0.12, ease: EASE_OUT }}\n className={cn(\n \"relative z-0 mr-5 ml-[76px] whitespace-nowrap font-medium text-lg tracking-[-0.02em]\",\n labelClassName,\n )}\n >\n {children}\n </motion.span>\n </motion.button>\n );\n },\n);\n"],"mappings":";;;;;;;;AAeA,MAAM,gBAAgB;CAAC;CAAG;CAAM;CAAM;CAAM;AAAI;AAEhD,SAAS,cAAc,EAAE,aAAqC;CAC5D,OACE,qBAAC,OAAD;EAAK,SAAQ;EAAY,MAAK;EAAO,eAAY;EAAkB;EAAnE,UAAA;GACE,oBAAC,UAAD;IAAQ,IAAG;IAAI,IAAG;IAAI,GAAE;IAAI,MAAK;GAAgB,CAAA;GACjD,oBAAC,UAAD;IAAQ,IAAG;IAAK,IAAG;IAAI,GAAE;IAAI,MAAK;GAAgB,CAAA;GAClD,oBAAC,UAAD;IAAQ,IAAG;IAAK,IAAG;IAAK,GAAE;IAAI,MAAK;GAAgB,CAAA;GACnD,oBAAC,UAAD;IAAQ,IAAG;IAAK,IAAG;IAAK,GAAE;IAAI,MAAK;GAAgB,CAAA;GACnD,oBAAC,UAAD;IAAQ,IAAG;IAAI,IAAG;IAAK,GAAE;IAAI,MAAK;GAAgB,CAAA;EAC/C;;AAET;AAEA,MAAa,uBAAuB,WAClC,SAAS,qBACP,EACE,UACA,WACA,iBACA,gBACA,UACA,cACA,cACA,SACA,QACA,GAAG,QAEL,KACA;CACA,MAAM,SAAS,iBAAiB;CAChC,MAAM,WAAW,gBAAgB;C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AAO,UAAU,CAAC,SAAS,MAAO,QAAQ,OAAQ;MAClD,MAAM;KACR;KACA,OAAO,EAAE,OAAO,kBAAkB,QAAQ,GAAG;KAC7C,WAAU;KAEV,UAAA,oBAAC,eAAD,EAAe,WAAU,UAAW,CAAA;IACzB,GAdN,OAcM,CACd;GACG,CAAA,CACK;EAEb,CAAA,GAAA,oBAAC,OAAO,MAAR;GACE,SAAS;IACP,SAAS,SAAS,IAAI;IACtB,WAAW,UAAU,CAAC,SAAS,oBAAoB;GACrD;GACA,YAAY;IAAE,UAAU,SAAS,IAAI;IAAM,MAAM;GAAS;GAC1D,WAAW,GACT,wFACA,cACF;GAEC;EACU,CAAA,CACA;;AAEnB,CACF"}
1
+ {"version":3,"file":"expanding-arrow-button.js","names":[],"sources":["../../../src/components/motion/expanding-arrow-button.tsx"],"sourcesContent":["\"use client\";\n\nimport { type FocusEvent, forwardRef, type MouseEvent, type ReactNode, useState } from \"react\";\nimport { cn } from \"cn\";\nimport { type HTMLMotionProps, motion, useReducedMotion } from \"motion/react\";\n\nimport { useHoverCapable } from \"../../hooks/use-hover-capable\";\nimport { EASE_OUT, SPRING_LAYOUT, SPRING_PRESS } from \"../../lib/ease\";\n\nexport interface ExpandingArrowButtonProps extends Omit<HTMLMotionProps<\"button\">, \"children\"> {\n children: ReactNode;\n accentClassName?: string;\n labelClassName?: string;\n}\n\nconst ARROW_OPACITY = [1, 0.78, 0.54, 0.32, 0.16] as const;\n\nfunction DottedChevron({ className }: { className?: string }) {\n return (\n <svg viewBox=\"0 0 20 28\" fill=\"none\" aria-hidden=\"true\" className={className}>\n <circle cx=\"4\" cy=\"4\" r=\"2\" fill=\"currentColor\" />\n <circle cx=\"10\" cy=\"9\" r=\"2\" fill=\"currentColor\" />\n <circle cx=\"16\" cy=\"14\" r=\"2\" fill=\"currentColor\" />\n <circle cx=\"10\" cy=\"19\" r=\"2\" fill=\"currentColor\" />\n <circle cx=\"4\" cy=\"24\" r=\"2\" fill=\"currentColor\" />\n </svg>\n );\n}\n\nexport const ExpandingArrowButton = forwardRef<HTMLButtonElement, ExpandingArrowButtonProps>(\n function ExpandingArrowButton(\n {\n children,\n className,\n accentClassName,\n labelClassName,\n disabled,\n onMouseEnter,\n onMouseLeave,\n onFocus,\n onBlur,\n ...rest\n },\n ref,\n ) {\n const reduce = useReducedMotion();\n const canHover = useHoverCapable();\n const [hovered, setHovered] = useState(false);\n const [focused, setFocused] = useState(false);\n const active = !disabled && ((canHover && hovered) || focused);\n const layoutTransition = reduce ? { duration: 0 } : SPRING_LAYOUT;\n\n const handleMouseEnter = (event: MouseEvent<HTMLButtonElement>) => {\n setHovered(true);\n onMouseEnter?.(event);\n };\n\n const handleMouseLeave = (event: MouseEvent<HTMLButtonElement>) => {\n setHovered(false);\n onMouseLeave?.(event);\n };\n\n const handleFocus = (event: FocusEvent<HTMLButtonElement>) => {\n setFocused(true);\n onFocus?.(event);\n };\n\n const handleBlur = (event: FocusEvent<HTMLButtonElement>) => {\n setFocused(false);\n onBlur?.(event);\n };\n\n return (\n <motion.button\n ref={ref}\n type=\"button\"\n disabled={disabled}\n onMouseEnter={handleMouseEnter}\n onMouseLeave={handleMouseLeave}\n onFocus={handleFocus}\n onBlur={handleBlur}\n whileTap={reduce || disabled ? undefined : { scale: 0.97 }}\n transition={SPRING_PRESS}\n className={cn(\n \"relative inline-flex h-16 min-w-72 select-none items-center overflow-hidden rounded-[22px] bg-neutral-950 p-1.5 text-white\",\n \"outline-none focus-visible:ring-2 focus-visible:ring-lime-300 focus-visible:ring-offset-2 focus-visible:ring-offset-background\",\n \"disabled:pointer-events-none disabled:opacity-50\",\n className,\n )}\n {...rest}\n >\n <motion.span\n layout=\"size\"\n aria-hidden=\"true\"\n transition={layoutTransition}\n style={{\n width: active ? \"calc(100% - 12px)\" : 52,\n borderRadius: 16,\n }}\n className={cn(\n \"absolute inset-y-1.5 left-1.5 z-10 overflow-hidden bg-lime-300 text-neutral-950\",\n accentClassName,\n )}\n >\n <motion.span\n animate={{ opacity: active ? 0 : 1 }}\n transition={{ duration: reduce ? 0 : 0.1, ease: EASE_OUT }}\n className=\"absolute inset-0 grid place-items-center\"\n >\n <DottedChevron className=\"h-7 w-5\" />\n </motion.span>\n\n <span className=\"absolute inset-0 flex items-center justify-around px-3\">\n {ARROW_OPACITY.map((opacity, index) => (\n <motion.span\n key={opacity}\n animate={{\n opacity: active ? 1 : 0,\n transform: active && !reduce ? \"translateX(0px)\" : \"translateX(-6px)\",\n }}\n transition={{\n duration: reduce ? 0 : 0.18,\n delay: active && !reduce ? 0.04 + index * 0.025 : 0,\n ease: EASE_OUT,\n }}\n style={{ color: `rgb(10 10 10 / ${opacity})` }}\n className=\"inline-grid place-items-center\"\n >\n <DottedChevron className=\"h-7 w-5\" />\n </motion.span>\n ))}\n </span>\n </motion.span>\n\n <motion.span\n animate={{\n opacity: active ? 0 : 1,\n transform: active && !reduce ? \"translateX(6px)\" : \"translateX(0px)\",\n }}\n transition={{ duration: reduce ? 0 : 0.12, ease: EASE_OUT }}\n className={cn(\n \"relative z-0 mr-5 ml-[76px] whitespace-nowrap font-medium text-lg tracking-[-0.02em]\",\n labelClassName,\n )}\n >\n {children}\n </motion.span>\n </motion.button>\n );\n },\n);\n"],"mappings":";;;;;;;;AAeA,MAAM,gBAAgB;CAAC;CAAG;CAAM;CAAM;CAAM;AAAI;AAEhD,SAAS,cAAc,EAAE,aAAqC;CAC5D,OACE,qBAAC,OAAD;EAAK,SAAQ;EAAY,MAAK;EAAO,eAAY;EAAkB;EAAnE,UAAA;GACE,oBAAC,UAAD;IAAQ,IAAG;IAAI,IAAG;IAAI,GAAE;IAAI,MAAK;GAAgB,CAAA;GACjD,oBAAC,UAAD;IAAQ,IAAG;IAAK,IAAG;IAAI,GAAE;IAAI,MAAK;GAAgB,CAAA;GAClD,oBAAC,UAAD;IAAQ,IAAG;IAAK,IAAG;IAAK,GAAE;IAAI,MAAK;GAAgB,CAAA;GACnD,oBAAC,UAAD;IAAQ,IAAG;IAAK,IAAG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MAAM;IAAS;IACzD,WAAU;IAEV,UAAA,oBAAC,eAAD,EAAe,WAAU,UAAW,CAAA;GACzB,CAAA,GAEb,oBAAC,QAAD;IAAM,WAAU;IACb,UAAA,cAAc,KAAK,SAAS,UAC3B,oBAAC,OAAO,MAAR;KAEE,SAAS;MACP,SAAS,SAAS,IAAI;MACtB,WAAW,UAAU,CAAC,SAAS,oBAAoB;KACrD;KACA,YAAY;MACV,UAAU,SAAS,IAAI;MACvB,OAAO,UAAU,CAAC,SAAS,MAAO,QAAQ,OAAQ;MAClD,MAAM;KACR;KACA,OAAO,EAAE,OAAO,kBAAkB,QAAQ,GAAG;KAC7C,WAAU;KAEV,UAAA,oBAAC,eAAD,EAAe,WAAU,UAAW,CAAA;IACzB,GAdN,OAcM,CACd;GACG,CAAA,CACK;EAEb,CAAA,GAAA,oBAAC,OAAO,MAAR;GACE,SAAS;IACP,SAAS,SAAS,IAAI;IACtB,WAAW,UAAU,CAAC,SAAS,oBAAoB;GACrD;GACA,YAAY;IAAE,UAAU,SAAS,IAAI;IAAM,MAAM;GAAS;GAC1D,WAAW,GACT,wFACA,cACF;GAEC;EACU,CAAA,CACA;;AAEnB,CACF"}
@@ -4,10 +4,10 @@ import { Button } from "./button/base.js";
4
4
  import { StatefulButton } from "./button/stateful.js";
5
5
  import "./button/index.js";
6
6
  import { useCallback, useEffect, useRef, useState } from "react";
7
- import { cn } from "@kumix/utils";
8
- import { AlertCircle, MessageSquare, X } from "lucide-react";
7
+ import { cn } from "cn";
9
8
  import { jsx, jsxs } from "react/jsx-runtime";
10
9
  import { AnimatePresence, motion, useReducedMotion } from "motion/react";
10
+ import { AlertCircle, MessageSquare, X } from "lucide-react";
11
11
  //#region src/components/motion/feedback-widget.tsx
12
12
  const SUCCESS_DURATION_MS = 1600;
13
13
  const MORPH_OPEN_EASE = [
@@ -1 +1 @@
1
- {"version":3,"file":"feedback-widget.js","names":[],"sources":["../../../src/components/motion/feedback-widget.tsx"],"sourcesContent":["\"use client\";\n\nimport { type ReactNode, useCallback, useEffect, useRef, useState } from \"react\";\nimport { AlertCircle, MessageSquare, X } from \"lucide-react\";\nimport { AnimatePresence, motion, useReducedMotion } from \"motion/react\";\n\nimport { cn } from \"@kumix/utils\";\nimport { EASE_OUT } from \"../../lib/ease\";\nimport { Button, StatefulButton } from \"./button\";\n\ntype Status = \"idle\" | \"open\" | \"sending\" | \"sent\" | \"error\";\n\nconst SUCCESS_DURATION_MS = 1600;\n\n// The trigger grows into the panel with a slight overshoot on open, then uses\n// a calmer curve on close so dismissing feels faster and less prominent.\nconst MORPH_OPEN_EASE = [0.34, 1.25, 0.64, 1] as const;\nconst MORPH_CLOSE_EASE = [0.22, 1, 0.36, 1] as const;\nconst MORPH_OPEN_DURATION = 0.4;\nconst MORPH_CLOSE_DURATION = 0.28;\nconst MORPH_FADE_DURATION = 0.22;\nconst MORPH_SLIDE = 40;\nconst MORPH_SCALE = 0.97;\nconst MORPH_BLUR = \"blur(2px)\";\n\n// Celebration sprinkles that burst from the success icon.\nconst SPRINKLES = Array.from({ length: 8 }, (_, i) => {\n const angle = (i / 8) * Math.PI * 2;\n return {\n x: Math.cos(angle) * 26,\n y: Math.sin(angle) * 26,\n color: i % 2 === 0 ? \"var(--color-success)\" : \"var(--accent)\",\n };\n});\n\nexport interface FeedbackData {\n message: string;\n}\n\nexport interface FeedbackWidgetProps {\n /** Called on submit. May be async; the button shows a sending state until it resolves. */\n onSubmit?: (data: FeedbackData) => void | Promise<void>;\n position?: \"bottom-right\" | \"bottom-left\";\n title?: string;\n placeholder?: string;\n icon?: ReactNode;\n className?: string;\n}\n\nexport function FeedbackWidget({\n onSubmit,\n position = \"bottom-right\",\n title = \"Help us improve\",\n placeholder = \"Share an idea or report a bug\",\n icon,\n className,\n}: FeedbackWidgetProps) {\n const reduce = useReducedMotion();\n const rootRef = useRef<HTMLDivElement>(null);\n const textareaRef = useRef<HTMLTextAreaElement>(null);\n const closeTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null);\n\n const [status, setStatus] = useState<Status>(\"idle\");\n const [message, setMessage] = useState(\"\");\n\n const open = status !== \"idle\";\n const busy = status === \"sending\";\n\n const clearCloseTimer = useCallback(() => {\n if (closeTimerRef.current === null) return;\n clearTimeout(closeTimerRef.current);\n closeTimerRef.current = null;\n }, []);\n\n const close = useCallback(() => {\n clearCloseTimer();\n setStatus(\"idle\");\n setMessage(\"\");\n }, [clearCloseTimer]);\n\n useEffect(\n () => () => {\n if (closeTimerRef.current !== null) {\n clearTimeout(closeTimerRef.current);\n }\n },\n [],\n );\n\n useEffect(() => {\n if (status !== \"open\") return;\n\n // Match the wallet account switcher's staged interaction: focusing while\n // the surface is still expanding makes the caret and focus state appear\n // inside a scaled panel. Arm the field once the open morph has settled.\n const timer = window.setTimeout(\n () => textareaRef.current?.focus(),\n reduce ? 0 : MORPH_OPEN_DURATION * 1000,\n );\n return () => window.clearTimeout(timer);\n }, [status, reduce]);\n\n // Dismiss on escape or outside click while open (but not mid-send).\n useEffect(() => {\n if (!open) return;\n const onKey = (e: KeyboardEvent) => {\n if (e.key === \"Escape\" && !busy) close();\n };\n const onPointer = (e: PointerEvent) => {\n if (!busy && rootRef.current && !rootRef.current.contains(e.target as Node)) {\n close();\n }\n };\n window.addEventListener(\"keydown\", onKey);\n window.addEventListener(\"pointerdown\", onPointer);\n return () => {\n window.removeEventListener(\"keydown\", onKey);\n window.removeEventListener(\"pointerdown\", onPointer);\n };\n }, [open, busy, close]);\n\n const scheduleSuccessClose = () => {\n clearCloseTimer();\n closeTimerRef.current = setTimeout(close, SUCCESS_DURATION_MS);\n };\n\n const submit = async () => {\n if (busy || message.trim().length === 0) return;\n setStatus(\"sending\");\n try {\n await onSubmit?.({ message });\n setStatus(\"sent\");\n scheduleSuccessClose();\n } catch {\n // Preserve the message so a rejected submission can be retried.\n setStatus(\"error\");\n }\n };\n\n const left = position === \"bottom-left\";\n const contentOffset = left ? -MORPH_SLIDE : MORPH_SLIDE;\n const surfaceTransition = reduce\n ? { duration: 0 }\n : {\n layout: {\n duration: open ? MORPH_OPEN_DURATION : MORPH_CLOSE_DURATION,\n ease: open ? MORPH_OPEN_EASE : MORPH_CLOSE_EASE,\n },\n borderRadius: {\n duration: open ? MORPH_OPEN_DURATION : MORPH_CLOSE_DURATION,\n ease: open ? MORPH_OPEN_EASE : MORPH_CLOSE_EASE,\n },\n };\n const contentTransition = reduce\n ? { duration: 0 }\n : {\n opacity: {\n duration: MORPH_FADE_DURATION,\n ease: MORPH_CLOSE_EASE,\n },\n x: {\n duration: MORPH_OPEN_DURATION,\n ease: MORPH_CLOSE_EASE,\n },\n scale: {\n duration: MORPH_OPEN_DURATION,\n ease: MORPH_CLOSE_EASE,\n },\n filter: {\n duration: MORPH_FADE_DURATION,\n ease: MORPH_CLOSE_EASE,\n },\n rotate: {\n duration: MORPH_OPEN_DURATION,\n ease: MORPH_CLOSE_EASE,\n },\n };\n const viewInitial = reduce ? { opacity: 0 } : { opacity: 0, y: 8, filter: \"blur(4px)\" };\n const viewAnimate = reduce\n ? {\n opacity: 1,\n transition: { duration: 0.18, ease: EASE_OUT },\n }\n : {\n opacity: 1,\n y: 0,\n filter: \"blur(0px)\",\n transition: { duration: 0.24, ease: EASE_OUT },\n };\n const viewExit = reduce\n ? {\n opacity: 0,\n transition: { duration: 0.14, ease: EASE_OUT },\n }\n : {\n opacity: 0,\n y: -8,\n filter: \"blur(4px)\",\n transition: { duration: 0.16, ease: EASE_OUT },\n };\n\n return (\n <div\n ref={rootRef}\n className={cn(\n \"pointer-events-none absolute bottom-4 z-30\",\n left ? \"left-4\" : \"right-4\",\n className,\n )}\n >\n {/* One persistent shell grows out of the corner trigger. The shell and\n its contents use separate timing so the surface leads the reveal. */}\n <motion.div\n layout\n animate={{ borderRadius: open ? 20 : 40 }}\n transition={surfaceTransition}\n style={{ transformOrigin: left ? \"bottom left\" : \"bottom right\" }}\n className={cn(\n \"pointer-events-auto absolute bottom-0 overflow-hidden border border-border bg-background text-foreground shadow-lg\",\n open ? \"w-[min(86vw,320px)] p-2\" : \"h-12 w-12 p-0\",\n left ? \"left-0\" : \"right-0\",\n )}\n >\n <AnimatePresence initial={false} mode=\"popLayout\">\n {open ? (\n <motion.div\n key=\"panel\"\n initial={\n reduce\n ? { opacity: 0 }\n : {\n opacity: 0,\n x: contentOffset,\n scale: MORPH_SCALE,\n filter: MORPH_BLUR,\n }\n }\n animate={{ opacity: 1, x: 0, scale: 1, filter: \"blur(0px)\" }}\n exit={\n reduce\n ? { opacity: 0 }\n : {\n opacity: 0,\n x: contentOffset,\n scale: MORPH_SCALE,\n filter: MORPH_BLUR,\n }\n }\n transition={contentTransition}\n >\n <motion.div layout=\"position\">\n <AnimatePresence mode=\"popLayout\" initial={false} propagate>\n {status === \"sent\" ? (\n <motion.div\n key=\"sent\"\n initial={viewInitial}\n animate={viewAnimate}\n exit={viewExit}\n >\n <div className=\"flex flex-col items-center justify-center gap-1.5 rounded-[20px] bg-border/60 px-4 py-6 text-center\">\n <div className=\"relative mb-1 flex h-12 w-12 items-center justify-center\">\n {reduce\n ? null\n : SPRINKLES.map((s, i) => (\n <motion.span\n key={`${s.x}-${s.y}`}\n initial={{ opacity: 0, scale: 0.4, x: 0, y: 0 }}\n animate={{\n opacity: [0, 1, 0],\n scale: [0, 1, 0.4],\n x: s.x,\n y: s.y,\n }}\n transition={{\n duration: 0.6,\n delay: 0.18 + i * 0.02,\n ease: \"easeOut\",\n }}\n style={{ backgroundColor: s.color }}\n className=\"absolute h-1.5 w-1.5 rounded-full\"\n />\n ))}\n <motion.div\n initial={reduce ? { scale: 1 } : { scale: 0 }}\n animate={{ scale: 1 }}\n transition={{\n type: \"spring\",\n stiffness: 500,\n damping: 22,\n delay: 0.04,\n }}\n className=\"flex h-12 w-12 items-center justify-center rounded-full bg-(--color-success)\"\n >\n <motion.svg\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n className=\"h-5 w-5 text-white\"\n >\n <motion.path\n d=\"M5 12.5l4.5 4.5L19 7.5\"\n stroke=\"currentColor\"\n strokeWidth={2.5}\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n initial={reduce ? { pathLength: 1 } : { pathLength: 0 }}\n animate={{ pathLength: 1 }}\n transition={{\n duration: 0.35,\n ease: \"easeOut\",\n delay: 0.15,\n }}\n />\n </motion.svg>\n </motion.div>\n </div>\n <h3 className=\"font-semibold text-foreground text-sm\">Thanks!</h3>\n <p className=\"text-muted-foreground text-xs leading-relaxed\">\n Your feedback helps us build something better.\n </p>\n </div>\n </motion.div>\n ) : status === \"error\" ? (\n <motion.div\n key=\"error\"\n initial={viewInitial}\n animate={viewAnimate}\n exit={viewExit}\n >\n <div\n role=\"alert\"\n className=\"rounded-[20px] bg-border/60 px-4 py-5 text-center\"\n >\n <div className=\"mx-auto flex h-12 w-12 items-center justify-center rounded-full bg-destructive/10 text-destructive\">\n <AlertCircle className=\"h-5 w-5\" />\n </div>\n <h3 className=\"mt-3 font-semibold text-foreground text-sm\">\n Something went wrong\n </h3>\n <p className=\"mt-1 text-muted-foreground text-xs leading-relaxed\">\n We couldn&apos;t send your feedback. Please try again.\n </p>\n <Button size=\"sm\" onClick={submit} className=\"mt-4\">\n Try again\n </Button>\n </div>\n </motion.div>\n ) : (\n <motion.div\n key=\"form\"\n initial={viewInitial}\n animate={viewAnimate}\n exit={viewExit}\n >\n <div className=\"min-h-[150px] rounded-[20px] bg-border/60 px-4 py-3.5\">\n <div className=\"flex items-start justify-between gap-3\">\n <h3 className=\"font-semibold text-foreground text-sm\">{title}</h3>\n <button\n type=\"button\"\n onClick={close}\n aria-label=\"Close\"\n className=\"flex h-5 w-5 shrink-0 items-center justify-center rounded-full bg-foreground/[0.07] text-muted-foreground transition-colors hover:text-foreground\"\n >\n <X className=\"h-3 w-3\" />\n </button>\n </div>\n <textarea\n ref={textareaRef}\n value={message}\n onChange={(e) => setMessage(e.target.value)}\n placeholder={placeholder}\n disabled={busy}\n rows={3}\n className=\"mt-2 w-full resize-none bg-transparent text-base text-foreground outline-none placeholder:text-muted-foreground/60 md:text-sm\"\n />\n </div>\n\n <div className=\"flex items-center gap-2 px-1 pt-2 pb-1\">\n <Button\n variant=\"secondary\"\n size=\"md\"\n onClick={close}\n disabled={busy}\n className=\"flex-1 bg-border text-muted-foreground hover:text-foreground\"\n >\n Cancel\n </Button>\n <StatefulButton\n state={busy ? \"loading\" : \"idle\"}\n loadingText=\"Sending\"\n size=\"md\"\n onClick={submit}\n disabled={busy || message.trim().length === 0}\n className=\"flex-1 bg-foreground text-background hover:bg-foreground/90\"\n >\n Submit\n </StatefulButton>\n </div>\n </motion.div>\n )}\n </AnimatePresence>\n </motion.div>\n </motion.div>\n ) : (\n <motion.button\n key=\"trigger\"\n type=\"button\"\n initial={\n reduce\n ? { opacity: 0 }\n : {\n opacity: 0,\n x: -contentOffset,\n filter: MORPH_BLUR,\n }\n }\n animate={{ opacity: 1, x: 0, filter: \"blur(0px)\" }}\n exit={\n reduce\n ? { opacity: 0 }\n : {\n opacity: 0,\n x: -contentOffset,\n filter: MORPH_BLUR,\n }\n }\n transition={contentTransition}\n onClick={() => {\n clearCloseTimer();\n setStatus(\"open\");\n }}\n aria-label={title}\n aria-haspopup=\"dialog\"\n whileTap={reduce ? undefined : { scale: 0.92 }}\n className={cn(\n \"absolute bottom-0 flex h-12 w-12 items-center justify-center bg-transparent text-foreground\",\n left ? \"left-0\" : \"right-0\",\n )}\n >\n <motion.span\n initial={reduce ? false : { rotate: 45, scale: MORPH_SCALE }}\n animate={{ rotate: 0, scale: 1 }}\n exit={{ rotate: 45, scale: MORPH_SCALE }}\n transition={contentTransition}\n className=\"grid h-5 w-5 shrink-0 place-items-center [&>svg]:h-full [&>svg]:w-full\"\n >\n {icon ?? <MessageSquare className=\"h-5 w-5\" />}\n </motion.span>\n </motion.button>\n )}\n </AnimatePresence>\n </motion.div>\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;AAYA,MAAM,sBAAsB;AAI5B,MAAM,kBAAkB;CAAC;CAAM;CAAM;CAAM;AAAC;AA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jDN,GAAA,MAiDM;MAEC,CAAA;KACP,CAAA;IACF,GA/KN,OA+KM,IAEZ,oBAAC,OAAO,QAAR;KAEE,MAAK;KACL,SACE,SACI,EAAE,SAAS,EAAE,IACb;MACE,SAAS;MACT,GAAG,CAAC;MACJ,QAAQ;KACV;KAEN,SAAS;MAAE,SAAS;MAAG,GAAG;MAAG,QAAQ;KAAY;KACjD,MACE,SACI,EAAE,SAAS,EAAE,IACb;MACE,SAAS;MACT,GAAG,CAAC;MACJ,QAAQ;KACV;KAEN,YAAY;KACZ,eAAe;MACb,gBAAgB;MAChB,UAAU,MAAM;KAClB;KACA,cAAY;KACZ,iBAAc;KACd,UAAU,SAAS,KAAA,IAAY,EAAE,OAAO,IAAK;KAC7C,WAAW,GACT,+FACA,OAAO,WAAW,SACpB;KAEA,UAAA,oBAAC,OAAO,MAAR;MACE,SAAS,SAAS,QAAQ;OAAE,QAAQ;OAAI,OAAO;MAAY;MAC3D,SAAS;OAAE,QAAQ;OAAG,OAAO;MAAE;MAC/B,MAAM;OAAE,QAAQ;OAAI,OAAO;MAAY;MACvC,YAAY;MACZ,WAAU;MAET,UAAA,QAAQ,oBAAC,eAAD,EAAe,WAAU,UAAW,CAAA;KAClC,CAAA;IACA,GA3CT,SA2CS;GAEF,CAAA;EACP,CAAA;CACT,CAAA;AAET"}
1
+ {"version":3,"file":"feedback-widget.js","names":[],"sources":["../../../src/components/motion/feedback-widget.tsx"],"sourcesContent":["\"use client\";\n\nimport { type ReactNode, useCallback, useEffect, useRef, useState } from \"react\";\nimport { cn } from \"cn\";\nimport { AlertCircle, MessageSquare, X } from \"lucide-react\";\nimport { AnimatePresence, motion, useReducedMotion } from \"motion/react\";\n\nimport { EASE_OUT } from \"../../lib/ease\";\nimport { Button, StatefulButton } from \"./button\";\n\ntype Status = \"idle\" | \"open\" | \"sending\" | \"sent\" | \"error\";\n\nconst SUCCESS_DURATION_MS = 1600;\n\n// The trigger grows into the panel with a slight overshoot on open, then uses\n// a calmer curve on close so dismissing feels faster and less prominent.\nconst MORPH_OPEN_EASE = [0.34, 1.25, 0.64, 1] as const;\nconst MORPH_CLOSE_EASE = [0.22, 1, 0.36, 1] as const;\nconst MORPH_OPEN_DURATION = 0.4;\nconst MORPH_CLOSE_DURATION = 0.28;\nconst MORPH_FADE_DURATION = 0.22;\nconst MORPH_SLIDE = 40;\nconst MORPH_SCALE = 0.97;\nconst MORPH_BLUR = \"blur(2px)\";\n\n// Celebration sprinkles that burst from the success icon.\nconst SPRINKLES = Array.from({ length: 8 }, (_, i) => {\n const angle = (i / 8) * Math.PI * 2;\n return {\n x: Math.cos(angle) * 26,\n y: Math.sin(angle) * 26,\n color: i % 2 === 0 ? \"var(--color-success)\" : \"var(--accent)\",\n };\n});\n\nexport interface FeedbackData {\n message: string;\n}\n\nexport interface FeedbackWidgetProps {\n /** Called on submit. May be async; the button shows a sending state until it resolves. */\n onSubmit?: (data: FeedbackData) => void | Promise<void>;\n position?: \"bottom-right\" | \"bottom-left\";\n title?: string;\n placeholder?: string;\n icon?: ReactNode;\n className?: string;\n}\n\nexport function FeedbackWidget({\n onSubmit,\n position = \"bottom-right\",\n title = \"Help us improve\",\n placeholder = \"Share an idea or report a bug\",\n icon,\n className,\n}: FeedbackWidgetProps) {\n const reduce = useReducedMotion();\n const rootRef = useRef<HTMLDivElement>(null);\n const textareaRef = useRef<HTMLTextAreaElement>(null);\n const closeTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null);\n\n const [status, setStatus] = useState<Status>(\"idle\");\n const [message, setMessage] = useState(\"\");\n\n const open = status !== \"idle\";\n const busy = status === \"sending\";\n\n const clearCloseTimer = useCallback(() => {\n if (closeTimerRef.current === null) return;\n clearTimeout(closeTimerRef.current);\n closeTimerRef.current = null;\n }, []);\n\n const close = useCallback(() => {\n clearCloseTimer();\n setStatus(\"idle\");\n setMessage(\"\");\n }, [clearCloseTimer]);\n\n useEffect(\n () => () => {\n if (closeTimerRef.current !== null) {\n clearTimeout(closeTimerRef.current);\n }\n },\n [],\n );\n\n useEffect(() => {\n if (status !== \"open\") return;\n\n // Match the wallet account switcher's staged interaction: focusing while\n // the surface is still expanding makes the caret and focus state appear\n // inside a scaled panel. Arm the field once the open morph has settled.\n const timer = window.setTimeout(\n () => textareaRef.current?.focus(),\n reduce ? 0 : MORPH_OPEN_DURATION * 1000,\n );\n return () => window.clearTimeout(timer);\n }, [status, reduce]);\n\n // Dismiss on escape or outside click while open (but not mid-send).\n useEffect(() => {\n if (!open) return;\n const onKey = (e: KeyboardEvent) => {\n if (e.key === \"Escape\" && !busy) close();\n };\n const onPointer = (e: PointerEvent) => {\n if (!busy && rootRef.current && !rootRef.current.contains(e.target as Node)) {\n close();\n }\n };\n window.addEventListener(\"keydown\", onKey);\n window.addEventListener(\"pointerdown\", onPointer);\n return () => {\n window.removeEventListener(\"keydown\", onKey);\n window.removeEventListener(\"pointerdown\", onPointer);\n };\n }, [open, busy, close]);\n\n const scheduleSuccessClose = () => {\n clearCloseTimer();\n closeTimerRef.current = setTimeout(close, SUCCESS_DURATION_MS);\n };\n\n const submit = async () => {\n if (busy || message.trim().length === 0) return;\n setStatus(\"sending\");\n try {\n await onSubmit?.({ message });\n setStatus(\"sent\");\n scheduleSuccessClose();\n } catch {\n // Preserve the message so a rejected submission can be retried.\n setStatus(\"error\");\n }\n };\n\n const left = position === \"bottom-left\";\n const contentOffset = left ? -MORPH_SLIDE : MORPH_SLIDE;\n const surfaceTransition = reduce\n ? { duration: 0 }\n : {\n layout: {\n duration: open ? MORPH_OPEN_DURATION : MORPH_CLOSE_DURATION,\n ease: open ? MORPH_OPEN_EASE : MORPH_CLOSE_EASE,\n },\n borderRadius: {\n duration: open ? MORPH_OPEN_DURATION : MORPH_CLOSE_DURATION,\n ease: open ? MORPH_OPEN_EASE : MORPH_CLOSE_EASE,\n },\n };\n const contentTransition = reduce\n ? { duration: 0 }\n : {\n opacity: {\n duration: MORPH_FADE_DURATION,\n ease: MORPH_CLOSE_EASE,\n },\n x: {\n duration: MORPH_OPEN_DURATION,\n ease: MORPH_CLOSE_EASE,\n },\n scale: {\n duration: MORPH_OPEN_DURATION,\n ease: MORPH_CLOSE_EASE,\n },\n filter: {\n duration: MORPH_FADE_DURATION,\n ease: MORPH_CLOSE_EASE,\n },\n rotate: {\n duration: MORPH_OPEN_DURATION,\n ease: MORPH_CLOSE_EASE,\n },\n };\n const viewInitial = reduce ? { opacity: 0 } : { opacity: 0, y: 8, filter: \"blur(4px)\" };\n const viewAnimate = reduce\n ? {\n opacity: 1,\n transition: { duration: 0.18, ease: EASE_OUT },\n }\n : {\n opacity: 1,\n y: 0,\n filter: \"blur(0px)\",\n transition: { duration: 0.24, ease: EASE_OUT },\n };\n const viewExit = reduce\n ? {\n opacity: 0,\n transition: { duration: 0.14, ease: EASE_OUT },\n }\n : {\n opacity: 0,\n y: -8,\n filter: \"blur(4px)\",\n transition: { duration: 0.16, ease: EASE_OUT },\n };\n\n return (\n <div\n ref={rootRef}\n className={cn(\n \"pointer-events-none absolute bottom-4 z-30\",\n left ? \"left-4\" : \"right-4\",\n className,\n )}\n >\n {/* One persistent shell grows out of the corner trigger. The shell and\n its contents use separate timing so the surface leads the reveal. */}\n <motion.div\n layout\n animate={{ borderRadius: open ? 20 : 40 }}\n transition={surfaceTransition}\n style={{ transformOrigin: left ? \"bottom left\" : \"bottom right\" }}\n className={cn(\n \"pointer-events-auto absolute bottom-0 overflow-hidden border border-border bg-background text-foreground shadow-lg\",\n open ? \"w-[min(86vw,320px)] p-2\" : \"h-12 w-12 p-0\",\n left ? \"left-0\" : \"right-0\",\n )}\n >\n <AnimatePresence initial={false} mode=\"popLayout\">\n {open ? (\n <motion.div\n key=\"panel\"\n initial={\n reduce\n ? { opacity: 0 }\n : {\n opacity: 0,\n x: contentOffset,\n scale: MORPH_SCALE,\n filter: MORPH_BLUR,\n }\n }\n animate={{ opacity: 1, x: 0, scale: 1, filter: \"blur(0px)\" }}\n exit={\n reduce\n ? { opacity: 0 }\n : {\n opacity: 0,\n x: contentOffset,\n scale: MORPH_SCALE,\n filter: MORPH_BLUR,\n }\n }\n transition={contentTransition}\n >\n <motion.div layout=\"position\">\n <AnimatePresence mode=\"popLayout\" initial={false} propagate>\n {status === \"sent\" ? (\n <motion.div\n key=\"sent\"\n initial={viewInitial}\n animate={viewAnimate}\n exit={viewExit}\n >\n <div className=\"flex flex-col items-center justify-center gap-1.5 rounded-[20px] bg-border/60 px-4 py-6 text-center\">\n <div className=\"relative mb-1 flex h-12 w-12 items-center justify-center\">\n {reduce\n ? null\n : SPRINKLES.map((s, i) => (\n <motion.span\n key={`${s.x}-${s.y}`}\n initial={{ opacity: 0, scale: 0.4, x: 0, y: 0 }}\n animate={{\n opacity: [0, 1, 0],\n scale: [0, 1, 0.4],\n x: s.x,\n y: s.y,\n }}\n transition={{\n duration: 0.6,\n delay: 0.18 + i * 0.02,\n ease: \"easeOut\",\n }}\n style={{ backgroundColor: s.color }}\n className=\"absolute h-1.5 w-1.5 rounded-full\"\n />\n ))}\n <motion.div\n initial={reduce ? { scale: 1 } : { scale: 0 }}\n animate={{ scale: 1 }}\n transition={{\n type: \"spring\",\n stiffness: 500,\n damping: 22,\n delay: 0.04,\n }}\n className=\"flex h-12 w-12 items-center justify-center rounded-full bg-(--color-success)\"\n >\n <motion.svg\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n className=\"h-5 w-5 text-white\"\n >\n <motion.path\n d=\"M5 12.5l4.5 4.5L19 7.5\"\n stroke=\"currentColor\"\n strokeWidth={2.5}\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n initial={reduce ? { pathLength: 1 } : { pathLength: 0 }}\n animate={{ pathLength: 1 }}\n transition={{\n duration: 0.35,\n ease: \"easeOut\",\n delay: 0.15,\n }}\n />\n </motion.svg>\n </motion.div>\n </div>\n <h3 className=\"font-semibold text-foreground text-sm\">Thanks!</h3>\n <p className=\"text-muted-foreground text-xs leading-relaxed\">\n Your feedback helps us build something better.\n </p>\n </div>\n </motion.div>\n ) : status === \"error\" ? (\n <motion.div\n key=\"error\"\n initial={viewInitial}\n animate={viewAnimate}\n exit={viewExit}\n >\n <div\n role=\"alert\"\n className=\"rounded-[20px] bg-border/60 px-4 py-5 text-center\"\n >\n <div className=\"mx-auto flex h-12 w-12 items-center justify-center rounded-full bg-destructive/10 text-destructive\">\n <AlertCircle className=\"h-5 w-5\" />\n </div>\n <h3 className=\"mt-3 font-semibold text-foreground text-sm\">\n Something went wrong\n </h3>\n <p className=\"mt-1 text-muted-foreground text-xs leading-relaxed\">\n We couldn&apos;t send your feedback. Please try again.\n </p>\n <Button size=\"sm\" onClick={submit} className=\"mt-4\">\n Try again\n </Button>\n </div>\n </motion.div>\n ) : (\n <motion.div\n key=\"form\"\n initial={viewInitial}\n animate={viewAnimate}\n exit={viewExit}\n >\n <div className=\"min-h-[150px] rounded-[20px] bg-border/60 px-4 py-3.5\">\n <div className=\"flex items-start justify-between gap-3\">\n <h3 className=\"font-semibold text-foreground text-sm\">{title}</h3>\n <button\n type=\"button\"\n onClick={close}\n aria-label=\"Close\"\n className=\"flex h-5 w-5 shrink-0 items-center justify-center rounded-full bg-foreground/[0.07] text-muted-foreground transition-colors hover:text-foreground\"\n >\n <X className=\"h-3 w-3\" />\n </button>\n </div>\n <textarea\n ref={textareaRef}\n value={message}\n onChange={(e) => setMessage(e.target.value)}\n placeholder={placeholder}\n disabled={busy}\n rows={3}\n className=\"mt-2 w-full resize-none bg-transparent text-base text-foreground outline-none placeholder:text-muted-foreground/60 md:text-sm\"\n />\n </div>\n\n <div className=\"flex items-center gap-2 px-1 pt-2 pb-1\">\n <Button\n variant=\"secondary\"\n size=\"md\"\n onClick={close}\n disabled={busy}\n className=\"flex-1 bg-border text-muted-foreground hover:text-foreground\"\n >\n Cancel\n </Button>\n <StatefulButton\n state={busy ? \"loading\" : \"idle\"}\n loadingText=\"Sending\"\n size=\"md\"\n onClick={submit}\n disabled={busy || message.trim().length === 0}\n className=\"flex-1 bg-foreground text-background hover:bg-foreground/90\"\n >\n Submit\n </StatefulButton>\n </div>\n </motion.div>\n )}\n </AnimatePresence>\n </motion.div>\n </motion.div>\n ) : (\n <motion.button\n key=\"trigger\"\n type=\"button\"\n initial={\n reduce\n ? { opacity: 0 }\n : {\n opacity: 0,\n x: -contentOffset,\n filter: MORPH_BLUR,\n }\n }\n animate={{ opacity: 1, x: 0, filter: \"blur(0px)\" }}\n exit={\n reduce\n ? { opacity: 0 }\n : {\n opacity: 0,\n x: -contentOffset,\n filter: MORPH_BLUR,\n }\n }\n transition={contentTransition}\n onClick={() => {\n clearCloseTimer();\n setStatus(\"open\");\n }}\n aria-label={title}\n aria-haspopup=\"dialog\"\n whileTap={reduce ? undefined : { scale: 0.92 }}\n className={cn(\n \"absolute bottom-0 flex h-12 w-12 items-center justify-center bg-transparent text-foreground\",\n left ? \"left-0\" : \"right-0\",\n )}\n >\n <motion.span\n initial={reduce ? false : { rotate: 45, scale: MORPH_SCALE }}\n animate={{ rotate: 0, scale: 1 }}\n exit={{ rotate: 45, scale: MORPH_SCALE }}\n transition={contentTransition}\n className=\"grid h-5 w-5 shrink-0 place-items-center [&>svg]:h-full [&>svg]:w-full\"\n >\n {icon ?? <MessageSquare className=\"h-5 w-5\" />}\n </motion.span>\n </motion.button>\n )}\n </AnimatePresence>\n </motion.div>\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;AAYA,MAAM,sBAAsB;AAI5B,MAAM,kBAAkB;CAAC;CAAM;CAAM;CAAM;AAAC;AAC5C,MAAM,mBAAmB;CAAC;CAAM;CAAG;CAAM;AAAC;AAC1C,MAAM,sBAAsB;AAC5B,MAAM,uBAAuB;AAC7B,MAAM,sBAAsB;AAC5B,MAAM,cAAc;AACpB,MAAM,cAAc;AACpB,MAAM,aAAa;AAGnB,MAAM,YAAY,MAAM,KAAK,EAAE,QAAQ,EAAE,IAAI,GAAG,MAAM;CACpD,MAAM,QAAS,IAAI,IAAK,KAAK,KAAK;CAClC,OAAO;EACL,GAAG,KAAK,IAAI,KAAK,IAAI;EAC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AY;KACZ,eAAe;MACb,gBAAgB;MAChB,UAAU,MAAM;KAClB;KACA,cAAY;KACZ,iBAAc;KACd,UAAU,SAAS,KAAA,IAAY,EAAE,OAAO,IAAK;KAC7C,WAAW,GACT,+FACA,OAAO,WAAW,SACpB;KAEA,UAAA,oBAAC,OAAO,MAAR;MACE,SAAS,SAAS,QAAQ;OAAE,QAAQ;OAAI,OAAO;MAAY;MAC3D,SAAS;OAAE,QAAQ;OAAG,OAAO;MAAE;MAC/B,MAAM;OAAE,QAAQ;OAAI,OAAO;MAAY;MACvC,YAAY;MACZ,WAAU;MAET,UAAA,QAAQ,oBAAC,eAAD,EAAe,WAAU,UAAW,CAAA;KAClC,CAAA;IACA,GA3CT,SA2CS;GAEF,CAAA;EACP,CAAA;CACT,CAAA;AAET"}
@@ -2,10 +2,10 @@
2
2
  import { EASE_OUT, SPRING_LAYOUT, SPRING_SWAP } from "../../lib/ease.js";
3
3
  import { SharedLayoutBg } from "./shared-layout-bg.js";
4
4
  import { Children, Fragment, isValidElement, useCallback, useMemo, useRef, useState } from "react";
5
- import { cn } from "@kumix/utils";
6
- import { ChevronRight, File, Folder, FolderOpen } from "lucide-react";
5
+ import { cn } from "cn";
7
6
  import { jsx, jsxs } from "react/jsx-runtime";
8
7
  import { AnimatePresence, motion, useReducedMotion } from "motion/react";
8
+ import { ChevronRight, File, Folder, FolderOpen } from "lucide-react";
9
9
  //#region src/components/motion/file-tree.tsx
10
10
  function FileTreeFolder(_props) {
11
11
  return null;
@@ -1 +1 @@
1
- {"version":3,"file":"file-tree.js","names":[],"sources":["../../../src/components/motion/file-tree.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n Children,\n Fragment,\n isValidElement,\n type KeyboardEvent,\n type ReactNode,\n useCallback,\n useMemo,\n useRef,\n useState,\n} from \"react\";\nimport { ChevronRight, File, Folder, FolderOpen } from \"lucide-react\";\nimport { AnimatePresence, motion, useReducedMotion } from \"motion/react\";\n\nimport { cn } from \"@kumix/utils\";\nimport { EASE_OUT, SPRING_LAYOUT, SPRING_SWAP } from \"../../lib/ease\";\nimport { SharedLayoutBg } from \"./shared-layout-bg\";\n\ntype FileTreeItem = {\n value: string;\n name: string;\n type: \"file\" | \"folder\";\n children?: FileTreeItem[];\n icon?: ReactNode;\n disabled?: boolean;\n className?: string;\n};\n\nexport interface FileTreeFolderProps {\n value: string;\n name: string;\n icon?: ReactNode;\n disabled?: boolean;\n children?: ReactNode;\n className?: string;\n}\n\nexport interface FileTreeFileProps {\n value: string;\n name: string;\n icon?: ReactNode;\n disabled?: boolean;\n className?: string;\n}\n\nexport type FileTreeClassNames = {\n tree?: string;\n item?: string;\n icon?: string;\n label?: string;\n};\n\nexport interface FileTreeProps {\n children: ReactNode;\n value?: string | null;\n defaultValue?: string | null;\n onValueChange?: (value: string) => void;\n expandedIds?: string[];\n defaultExpandedIds?: string[];\n onExpandedChange?: (expandedIds: string[]) => void;\n ariaLabel?: string;\n indent?: number;\n className?: string;\n classNames?: FileTreeClassNames;\n}\n\ntype FlatFileTreeItem = {\n item: FileTreeItem;\n depth: number;\n parentId: string | null;\n position: number;\n setSize: number;\n};\n\n// These declarative parts are read by FileTree and turned into one flattened,\n// keyboard-navigable collection. They intentionally render nothing alone.\nexport function FileTreeFolder(_props: FileTreeFolderProps) {\n return null;\n}\n\nexport function FileTreeFile(_props: FileTreeFileProps) {\n return null;\n}\n\nconst ROW_ENTER = { duration: 0.22, ease: EASE_OUT } as const;\nconst BRANCH_DRAW = { duration: 0.3, ease: EASE_OUT } as const;\n\nfunction flattenItems(\n items: FileTreeItem[],\n expanded: ReadonlySet<string>,\n depth = 0,\n parentId: string | null = null,\n): FlatFileTreeItem[] {\n return items.flatMap((item, index) => {\n const row = {\n item,\n depth,\n parentId,\n position: index + 1,\n setSize: items.length,\n };\n\n if (item.type !== \"folder\" || !expanded.has(item.value) || !item.children?.length) {\n return [row];\n }\n\n return [row, ...flattenItems(item.children, expanded, depth + 1, item.value)];\n });\n}\n\nfunction itemsFromChildren(children: ReactNode): FileTreeItem[] {\n const items: FileTreeItem[] = [];\n\n Children.forEach(children, (child) => {\n if (!isValidElement(child)) return;\n\n if (child.type === Fragment) {\n const props = child.props as { children?: ReactNode };\n items.push(...itemsFromChildren(props.children));\n return;\n }\n\n if (child.type === FileTreeFolder) {\n const props = child.props as FileTreeFolderProps;\n items.push({\n value: props.value,\n name: props.name,\n type: \"folder\",\n icon: props.icon,\n disabled: props.disabled,\n className: props.className,\n children: itemsFromChildren(props.children),\n });\n return;\n }\n\n if (child.type === FileTreeFile) {\n const props = child.props as FileTreeFileProps;\n items.push({\n value: props.value,\n name: props.name,\n type: \"file\",\n icon: props.icon,\n disabled: props.disabled,\n className: props.className,\n });\n }\n });\n\n return items;\n}\n\nfunction DefaultIcon({\n item,\n open,\n reduce,\n}: {\n item: FileTreeItem;\n open: boolean;\n reduce: boolean;\n}) {\n if (item.type === \"file\") return <File className=\"size-4\" />;\n if (reduce) {\n return open ? <FolderOpen className=\"size-4\" /> : <Folder className=\"size-4\" />;\n }\n\n return (\n <AnimatePresence initial={false} mode=\"popLayout\">\n <motion.span\n key={open ? \"open\" : \"closed\"}\n initial={{ opacity: 0, scale: 0.75, rotate: open ? -8 : 8 }}\n animate={{ opacity: 1, scale: 1, rotate: 0 }}\n exit={{ opacity: 0, scale: 0.75, rotate: open ? 8 : -8 }}\n transition={SPRING_SWAP}\n className=\"absolute inset-0 grid place-items-center\"\n >\n {open ? <FolderOpen className=\"size-4\" /> : <Folder className=\"size-4\" />}\n </motion.span>\n </AnimatePresence>\n );\n}\n\nexport function FileTree({\n children,\n value,\n defaultValue = null,\n onValueChange,\n expandedIds,\n defaultExpandedIds = [],\n onExpandedChange,\n ariaLabel = \"Files\",\n indent = 18,\n className,\n classNames,\n}: FileTreeProps) {\n const reduce = useReducedMotion() ?? false;\n const [internalValue, setInternalValue] = useState(defaultValue);\n const [internalExpandedIds, setInternalExpandedIds] = useState(defaultExpandedIds);\n const [focusedId, setFocusedId] = useState<string | null>(value ?? defaultValue);\n const rowRefs = useRef(new Map<string, HTMLButtonElement>());\n const selectedId = value === undefined ? internalValue : value;\n const currentExpandedIds = expandedIds ?? internalExpandedIds;\n const expanded = useMemo(() => new Set(currentExpandedIds), [currentExpandedIds]);\n const items = useMemo(() => itemsFromChildren(children), [children]);\n const rows = useMemo(() => flattenItems(items, expanded), [expanded, items]);\n\n // Keep a real row tabbable in the first commit and immediately after a\n // collapse removes the previously focused descendant.\n const focusedRow =\n focusedId !== null && rows.some(({ item }) => item.value === focusedId)\n ? focusedId\n : (rows[0]?.item.value ?? null);\n if (focusedId !== focusedRow) setFocusedId(focusedRow);\n\n const focusRow = useCallback((id: string) => {\n setFocusedId(id);\n const row = rowRefs.current.get(id);\n if (row) row.focus();\n else requestAnimationFrame(() => rowRefs.current.get(id)?.focus());\n }, []);\n\n const selectItem = useCallback(\n (item: FileTreeItem) => {\n if (item.disabled) return;\n if (value === undefined) setInternalValue(item.value);\n onValueChange?.(item.value);\n },\n [onValueChange, value],\n );\n\n const setExpanded = useCallback(\n (next: string[]) => {\n if (expandedIds === undefined) setInternalExpandedIds(next);\n onExpandedChange?.(next);\n },\n [expandedIds, onExpandedChange],\n );\n\n const toggleFolder = useCallback(\n (id: string) => {\n const next = new Set(currentExpandedIds);\n if (next.has(id)) next.delete(id);\n else next.add(id);\n setExpanded(Array.from(next));\n },\n [currentExpandedIds, setExpanded],\n );\n\n const handleKeyDown = useCallback(\n (event: KeyboardEvent<HTMLButtonElement>, row: FlatFileTreeItem) => {\n const index = rows.findIndex(({ item }) => item.value === row.item.value);\n const previous = rows[index - 1];\n const next = rows[index + 1];\n const isFolder = row.item.type === \"folder\";\n const isOpen = expanded.has(row.item.value);\n\n if (event.key === \"ArrowDown\" && next) {\n event.preventDefault();\n focusRow(next.item.value);\n } else if (event.key === \"ArrowUp\" && previous) {\n event.preventDefault();\n focusRow(previous.item.value);\n } else if (event.key === \"Home\" && rows[0]) {\n event.preventDefault();\n focusRow(rows[0].item.value);\n } else if (event.key === \"End\" && rows.at(-1)) {\n event.preventDefault();\n focusRow(rows.at(-1)?.item.value ?? row.item.value);\n } else if (event.key === \"ArrowRight\" && isFolder) {\n event.preventDefault();\n if (!isOpen && !row.item.disabled) toggleFolder(row.item.value);\n else if (next?.parentId === row.item.value) focusRow(next.item.value);\n } else if (event.key === \"ArrowLeft\") {\n event.preventDefault();\n if (isFolder && isOpen && !row.item.disabled) toggleFolder(row.item.value);\n else if (row.parentId) focusRow(row.parentId);\n } else if (event.key === \"Enter\" || event.key === \" \") {\n event.preventDefault();\n if (row.item.disabled) return;\n selectItem(row.item);\n if (isFolder) toggleFolder(row.item.value);\n }\n },\n [expanded, focusRow, rows, selectItem, toggleFolder],\n );\n\n return (\n <SharedLayoutBg\n role=\"tree\"\n aria-label={ariaLabel}\n aria-multiselectable=\"false\"\n inset={0}\n pillClassName=\"rounded-xl bg-muted\"\n pillContainerClassName=\"inset-y-auto top-0 h-9\"\n className={cn(\"min-w-0\", className, classNames?.tree)}\n >\n {rows.map((row) => {\n const isFolder = row.item.type === \"folder\";\n const isOpen = isFolder && expanded.has(row.item.value);\n const isSelected = selectedId === row.item.value;\n\n return (\n <motion.div\n layout={reduce ? false : \"position\"}\n key={row.item.value}\n initial={reduce ? false : { opacity: 0, y: -6 }}\n animate={{\n opacity: row.item.disabled ? 0.42 : 1,\n y: 0,\n transition: reduce\n ? { duration: 0 }\n : {\n ...ROW_ENTER,\n delay: Math.min(row.position * 0.025, 0.1),\n },\n }}\n transition={reduce ? { duration: 0 } : SPRING_LAYOUT}\n >\n <button\n ref={(node) => {\n if (node) rowRefs.current.set(row.item.value, node);\n else rowRefs.current.delete(row.item.value);\n }}\n type=\"button\"\n role=\"treeitem\"\n aria-level={row.depth + 1}\n aria-posinset={row.position}\n aria-setsize={row.setSize}\n aria-selected={isSelected}\n aria-expanded={isFolder ? isOpen : undefined}\n aria-disabled={row.item.disabled || undefined}\n tabIndex={focusedRow === row.item.value ? 0 : -1}\n onFocus={() => setFocusedId(row.item.value)}\n onKeyDown={(event) => handleKeyDown(event, row)}\n onClick={() => {\n if (row.item.disabled) return;\n selectItem(row.item);\n if (isFolder) toggleFolder(row.item.value);\n }}\n className={cn(\n \"group/file-tree relative flex h-9 w-full items-center gap-2 overflow-hidden rounded-lg pr-2 text-left text-muted-foreground text-sm outline-none\",\n \"transition-colors hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset\",\n \"aria-disabled:cursor-not-allowed\",\n isSelected && \"bg-muted font-medium text-foreground\",\n classNames?.item,\n row.item.className,\n )}\n style={{ paddingLeft: 8 + row.depth * indent }}\n >\n {row.depth > 0 ? (\n <motion.span\n aria-hidden=\"true\"\n initial={reduce ? false : { opacity: 0, scaleY: 0 }}\n animate={{ opacity: 1, scaleY: 1 }}\n exit={{ opacity: 0, scaleY: 0 }}\n transition={reduce ? { duration: 0 } : BRANCH_DRAW}\n className=\"absolute top-0 bottom-0 w-px origin-top bg-border/70\"\n style={{ left: 16 + (row.depth - 1) * indent }}\n />\n ) : null}\n\n <motion.span\n aria-hidden=\"true\"\n animate={{ rotate: isOpen ? 90 : 0 }}\n transition={reduce ? { duration: 0 } : SPRING_SWAP}\n className={cn(\n \"relative z-10 grid size-4 shrink-0 place-items-center\",\n !isFolder && \"opacity-0\",\n )}\n >\n <ChevronRight className=\"size-3.5\" />\n </motion.span>\n\n <span\n aria-hidden=\"true\"\n className={cn(\n \"relative z-10 grid size-4 shrink-0 place-items-center text-muted-foreground transition-colors group-hover/file-tree:text-foreground\",\n isFolder && isOpen && \"text-foreground\",\n classNames?.icon,\n )}\n >\n {row.item.icon ?? <DefaultIcon item={row.item} open={isOpen} reduce={reduce} />}\n </span>\n\n <span className={cn(\"relative z-10 min-w-0 flex-1 truncate\", classNames?.label)}>\n {row.item.name}\n </span>\n </button>\n </motion.div>\n );\n })}\n </SharedLayoutBg>\n );\n}\n"],"mappings":";;;;;;;;;AA8EA,SAAgB,eAAe,QAA6B;CAC1D,OAAO;AACT;AAEA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;OAAE;OACjC,MAAM;QAAE,SAAS;QAAG,QAAQ;OAAE;OAC9B,YAAY,SAAS,EAAE,UAAU,EAAE,IAAI;OACvC,WAAU;OACV,OAAO,EAAE,MAAM,MAAM,IAAI,QAAQ,KAAK,OAAO;MAC9C,CAAA,IACC;MAEJ,oBAAC,OAAO,MAAR;OACE,eAAY;OACZ,SAAS,EAAE,QAAQ,SAAS,KAAK,EAAE;OACnC,YAAY,SAAS,EAAE,UAAU,EAAE,IAAI;OACvC,WAAW,GACT,yDACA,CAAC,YAAY,WACf;OAEA,UAAA,oBAAC,cAAD,EAAc,WAAU,WAAY,CAAA;MACzB,CAAA;MAEb,oBAAC,QAAD;OACE,eAAY;OACZ,WAAW,GACT,uIACA,YAAY,UAAU,mBACtB,YAAY,IACd;OAEC,UAAA,IAAI,KAAK,QAAQ,oBAAC,aAAD;QAAa,MAAM,IAAI;QAAM,MAAM;QAAgB;OAAS,CAAA;MAC1E,CAAA;MAEN,oBAAC,QAAD;OAAM,WAAW,GAAG,yCAAyC,YAAY,KAAK;OAC3E,UAAA,IAAI,KAAK;MACN,CAAA;KACA;;GACE,GApFL,IAAI,KAAK,KAoFJ;EAEhB,CAAC;CACa,CAAA;AAEpB"}
1
+ {"version":3,"file":"file-tree.js","names":[],"sources":["../../../src/components/motion/file-tree.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n Children,\n Fragment,\n isValidElement,\n type KeyboardEvent,\n type ReactNode,\n useCallback,\n useMemo,\n useRef,\n useState,\n} from \"react\";\nimport { cn } from \"cn\";\nimport { ChevronRight, File, Folder, FolderOpen } from \"lucide-react\";\nimport { AnimatePresence, motion, useReducedMotion } from \"motion/react\";\n\nimport { EASE_OUT, SPRING_LAYOUT, SPRING_SWAP } from \"../../lib/ease\";\nimport { SharedLayoutBg } from \"./shared-layout-bg\";\n\ntype FileTreeItem = {\n value: string;\n name: string;\n type: \"file\" | \"folder\";\n children?: FileTreeItem[];\n icon?: ReactNode;\n disabled?: boolean;\n className?: string;\n};\n\nexport interface FileTreeFolderProps {\n value: string;\n name: string;\n icon?: ReactNode;\n disabled?: boolean;\n children?: ReactNode;\n className?: string;\n}\n\nexport interface FileTreeFileProps {\n value: string;\n name: string;\n icon?: ReactNode;\n disabled?: boolean;\n className?: string;\n}\n\nexport type FileTreeClassNames = {\n tree?: string;\n item?: string;\n icon?: string;\n label?: string;\n};\n\nexport interface FileTreeProps {\n children: ReactNode;\n value?: string | null;\n defaultValue?: string | null;\n onValueChange?: (value: string) => void;\n expandedIds?: string[];\n defaultExpandedIds?: string[];\n onExpandedChange?: (expandedIds: string[]) => void;\n ariaLabel?: string;\n indent?: number;\n className?: string;\n classNames?: FileTreeClassNames;\n}\n\ntype FlatFileTreeItem = {\n item: FileTreeItem;\n depth: number;\n parentId: string | null;\n position: number;\n setSize: number;\n};\n\n// These declarative parts are read by FileTree and turned into one flattened,\n// keyboard-navigable collection. They intentionally render nothing alone.\nexport function FileTreeFolder(_props: FileTreeFolderProps) {\n return null;\n}\n\nexport function FileTreeFile(_props: FileTreeFileProps) {\n return null;\n}\n\nconst ROW_ENTER = { duration: 0.22, ease: EASE_OUT } as const;\nconst BRANCH_DRAW = { duration: 0.3, ease: EASE_OUT } as const;\n\nfunction flattenItems(\n items: FileTreeItem[],\n expanded: ReadonlySet<string>,\n depth = 0,\n parentId: string | null = null,\n): FlatFileTreeItem[] {\n return items.flatMap((item, index) => {\n const row = {\n item,\n depth,\n parentId,\n position: index + 1,\n setSize: items.length,\n };\n\n if (item.type !== \"folder\" || !expanded.has(item.value) || !item.children?.length) {\n return [row];\n }\n\n return [row, ...flattenItems(item.children, expanded, depth + 1, item.value)];\n });\n}\n\nfunction itemsFromChildren(children: ReactNode): FileTreeItem[] {\n const items: FileTreeItem[] = [];\n\n Children.forEach(children, (child) => {\n if (!isValidElement(child)) return;\n\n if (child.type === Fragment) {\n const props = child.props as { children?: ReactNode };\n items.push(...itemsFromChildren(props.children));\n return;\n }\n\n if (child.type === FileTreeFolder) {\n const props = child.props as FileTreeFolderProps;\n items.push({\n value: props.value,\n name: props.name,\n type: \"folder\",\n icon: props.icon,\n disabled: props.disabled,\n className: props.className,\n children: itemsFromChildren(props.children),\n });\n return;\n }\n\n if (child.type === FileTreeFile) {\n const props = child.props as FileTreeFileProps;\n items.push({\n value: props.value,\n name: props.name,\n type: \"file\",\n icon: props.icon,\n disabled: props.disabled,\n className: props.className,\n });\n }\n });\n\n return items;\n}\n\nfunction DefaultIcon({\n item,\n open,\n reduce,\n}: {\n item: FileTreeItem;\n open: boolean;\n reduce: boolean;\n}) {\n if (item.type === \"file\") return <File className=\"size-4\" />;\n if (reduce) {\n return open ? <FolderOpen className=\"size-4\" /> : <Folder className=\"size-4\" />;\n }\n\n return (\n <AnimatePresence initial={false} mode=\"popLayout\">\n <motion.span\n key={open ? \"open\" : \"closed\"}\n initial={{ opacity: 0, scale: 0.75, rotate: open ? -8 : 8 }}\n animate={{ opacity: 1, scale: 1, rotate: 0 }}\n exit={{ opacity: 0, scale: 0.75, rotate: open ? 8 : -8 }}\n transition={SPRING_SWAP}\n className=\"absolute inset-0 grid place-items-center\"\n >\n {open ? <FolderOpen className=\"size-4\" /> : <Folder className=\"size-4\" />}\n </motion.span>\n </AnimatePresence>\n );\n}\n\nexport function FileTree({\n children,\n value,\n defaultValue = null,\n onValueChange,\n expandedIds,\n defaultExpandedIds = [],\n onExpandedChange,\n ariaLabel = \"Files\",\n indent = 18,\n className,\n classNames,\n}: FileTreeProps) {\n const reduce = useReducedMotion() ?? false;\n const [internalValue, setInternalValue] = useState(defaultValue);\n const [internalExpandedIds, setInternalExpandedIds] = useState(defaultExpandedIds);\n const [focusedId, setFocusedId] = useState<string | null>(value ?? defaultValue);\n const rowRefs = useRef(new Map<string, HTMLButtonElement>());\n const selectedId = value === undefined ? internalValue : value;\n const currentExpandedIds = expandedIds ?? internalExpandedIds;\n const expanded = useMemo(() => new Set(currentExpandedIds), [currentExpandedIds]);\n const items = useMemo(() => itemsFromChildren(children), [children]);\n const rows = useMemo(() => flattenItems(items, expanded), [expanded, items]);\n\n // Keep a real row tabbable in the first commit and immediately after a\n // collapse removes the previously focused descendant.\n const focusedRow =\n focusedId !== null && rows.some(({ item }) => item.value === focusedId)\n ? focusedId\n : (rows[0]?.item.value ?? null);\n if (focusedId !== focusedRow) setFocusedId(focusedRow);\n\n const focusRow = useCallback((id: string) => {\n setFocusedId(id);\n const row = rowRefs.current.get(id);\n if (row) row.focus();\n else requestAnimationFrame(() => rowRefs.current.get(id)?.focus());\n }, []);\n\n const selectItem = useCallback(\n (item: FileTreeItem) => {\n if (item.disabled) return;\n if (value === undefined) setInternalValue(item.value);\n onValueChange?.(item.value);\n },\n [onValueChange, value],\n );\n\n const setExpanded = useCallback(\n (next: string[]) => {\n if (expandedIds === undefined) setInternalExpandedIds(next);\n onExpandedChange?.(next);\n },\n [expandedIds, onExpandedChange],\n );\n\n const toggleFolder = useCallback(\n (id: string) => {\n const next = new Set(currentExpandedIds);\n if (next.has(id)) next.delete(id);\n else next.add(id);\n setExpanded(Array.from(next));\n },\n [currentExpandedIds, setExpanded],\n );\n\n const handleKeyDown = useCallback(\n (event: KeyboardEvent<HTMLButtonElement>, row: FlatFileTreeItem) => {\n const index = rows.findIndex(({ item }) => item.value === row.item.value);\n const previous = rows[index - 1];\n const next = rows[index + 1];\n const isFolder = row.item.type === \"folder\";\n const isOpen = expanded.has(row.item.value);\n\n if (event.key === \"ArrowDown\" && next) {\n event.preventDefault();\n focusRow(next.item.value);\n } else if (event.key === \"ArrowUp\" && previous) {\n event.preventDefault();\n focusRow(previous.item.value);\n } else if (event.key === \"Home\" && rows[0]) {\n event.preventDefault();\n focusRow(rows[0].item.value);\n } else if (event.key === \"End\" && rows.at(-1)) {\n event.preventDefault();\n focusRow(rows.at(-1)?.item.value ?? row.item.value);\n } else if (event.key === \"ArrowRight\" && isFolder) {\n event.preventDefault();\n if (!isOpen && !row.item.disabled) toggleFolder(row.item.value);\n else if (next?.parentId === row.item.value) focusRow(next.item.value);\n } else if (event.key === \"ArrowLeft\") {\n event.preventDefault();\n if (isFolder && isOpen && !row.item.disabled) toggleFolder(row.item.value);\n else if (row.parentId) focusRow(row.parentId);\n } else if (event.key === \"Enter\" || event.key === \" \") {\n event.preventDefault();\n if (row.item.disabled) return;\n selectItem(row.item);\n if (isFolder) toggleFolder(row.item.value);\n }\n },\n [expanded, focusRow, rows, selectItem, toggleFolder],\n );\n\n return (\n <SharedLayoutBg\n role=\"tree\"\n aria-label={ariaLabel}\n aria-multiselectable=\"false\"\n inset={0}\n pillClassName=\"rounded-xl bg-muted\"\n pillContainerClassName=\"inset-y-auto top-0 h-9\"\n className={cn(\"min-w-0\", className, classNames?.tree)}\n >\n {rows.map((row) => {\n const isFolder = row.item.type === \"folder\";\n const isOpen = isFolder && expanded.has(row.item.value);\n const isSelected = selectedId === row.item.value;\n\n return (\n <motion.div\n layout={reduce ? false : \"position\"}\n key={row.item.value}\n initial={reduce ? false : { opacity: 0, y: -6 }}\n animate={{\n opacity: row.item.disabled ? 0.42 : 1,\n y: 0,\n transition: reduce\n ? { duration: 0 }\n : {\n ...ROW_ENTER,\n delay: Math.min(row.position * 0.025, 0.1),\n },\n }}\n transition={reduce ? { duration: 0 } : SPRING_LAYOUT}\n >\n <button\n ref={(node) => {\n if (node) rowRefs.current.set(row.item.value, node);\n else rowRefs.current.delete(row.item.value);\n }}\n type=\"button\"\n role=\"treeitem\"\n aria-level={row.depth + 1}\n aria-posinset={row.position}\n aria-setsize={row.setSize}\n aria-selected={isSelected}\n aria-expanded={isFolder ? isOpen : undefined}\n aria-disabled={row.item.disabled || undefined}\n tabIndex={focusedRow === row.item.value ? 0 : -1}\n onFocus={() => setFocusedId(row.item.value)}\n onKeyDown={(event) => handleKeyDown(event, row)}\n onClick={() => {\n if (row.item.disabled) return;\n selectItem(row.item);\n if (isFolder) toggleFolder(row.item.value);\n }}\n className={cn(\n \"group/file-tree relative flex h-9 w-full items-center gap-2 overflow-hidden rounded-lg pr-2 text-left text-muted-foreground text-sm outline-none\",\n \"transition-colors hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset\",\n \"aria-disabled:cursor-not-allowed\",\n isSelected && \"bg-muted font-medium text-foreground\",\n classNames?.item,\n row.item.className,\n )}\n style={{ paddingLeft: 8 + row.depth * indent }}\n >\n {row.depth > 0 ? (\n <motion.span\n aria-hidden=\"true\"\n initial={reduce ? false : { opacity: 0, scaleY: 0 }}\n animate={{ opacity: 1, scaleY: 1 }}\n exit={{ opacity: 0, scaleY: 0 }}\n transition={reduce ? { duration: 0 } : BRANCH_DRAW}\n className=\"absolute top-0 bottom-0 w-px origin-top bg-border/70\"\n style={{ left: 16 + (row.depth - 1) * indent }}\n />\n ) : null}\n\n <motion.span\n aria-hidden=\"true\"\n animate={{ rotate: isOpen ? 90 : 0 }}\n transition={reduce ? { duration: 0 } : SPRING_SWAP}\n className={cn(\n \"relative z-10 grid size-4 shrink-0 place-items-center\",\n !isFolder && \"opacity-0\",\n )}\n >\n <ChevronRight className=\"size-3.5\" />\n </motion.span>\n\n <span\n aria-hidden=\"true\"\n className={cn(\n \"relative z-10 grid size-4 shrink-0 place-items-center text-muted-foreground transition-colors group-hover/file-tree:text-foreground\",\n isFolder && isOpen && \"text-foreground\",\n classNames?.icon,\n )}\n >\n {row.item.icon ?? <DefaultIcon item={row.item} open={isOpen} reduce={reduce} />}\n </span>\n\n <span className={cn(\"relative z-10 min-w-0 flex-1 truncate\", classNames?.label)}>\n {row.item.name}\n </span>\n </button>\n </motion.div>\n );\n })}\n </SharedLayoutBg>\n );\n}\n"],"mappings":";;;;;;;;;AA8EA,SAAgB,eAAe,QAA6B;CAC1D,OAAO;AACT;AAEA,SAAgB,aAAa,QAA2B;CACtD,OAAO;AACT;AAEA,MAAM,YAAY;CAAE,UAAU;CAAM,MAAM;AAAS;AACnD,MAAM,cAAc;CAAE,UAAU;CAAK,MAAM;AAAS;AAEpD,SAAS,aACP,OACA,UACA,QAAQ,GACR,WAA0B,MACN;C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BAAC,OAAO,MAAR;OACE,eAAY;OACZ,SAAS,EAAE,QAAQ,SAAS,KAAK,EAAE;OACnC,YAAY,SAAS,EAAE,UAAU,EAAE,IAAI;OACvC,WAAW,GACT,yDACA,CAAC,YAAY,WACf;OAEA,UAAA,oBAAC,cAAD,EAAc,WAAU,WAAY,CAAA;MACzB,CAAA;MAEb,oBAAC,QAAD;OACE,eAAY;OACZ,WAAW,GACT,uIACA,YAAY,UAAU,mBACtB,YAAY,IACd;OAEC,UAAA,IAAI,KAAK,QAAQ,oBAAC,aAAD;QAAa,MAAM,IAAI;QAAM,MAAM;QAAgB;OAAS,CAAA;MAC1E,CAAA;MAEN,oBAAC,QAAD;OAAM,WAAW,GAAG,yCAAyC,YAAY,KAAK;OAC3E,UAAA,IAAI,KAAK;MACN,CAAA;KACA;;GACE,GApFL,IAAI,KAAK,KAoFJ;EAEhB,CAAC;CACa,CAAA;AAEpB"}
@@ -1,10 +1,10 @@
1
1
  "use client";
2
2
  import { EASE_OUT } from "../../lib/ease.js";
3
3
  import { useCallback, useId, useRef, useState } from "react";
4
- import { cn } from "@kumix/utils";
5
- import { AlertCircle, CheckCircle2, FileArchive, FileAudio, FileCode2, FileIcon, FileImage, FileSpreadsheet, FileText, FileVideo, Loader2, RotateCcw, UploadCloud, X } from "lucide-react";
4
+ import { cn } from "cn";
6
5
  import { jsx, jsxs } from "react/jsx-runtime";
7
6
  import { AnimatePresence, motion, useReducedMotion } from "motion/react";
7
+ import { AlertCircle, CheckCircle2, FileArchive, FileAudio, FileCode2, FileIcon, FileImage, FileSpreadsheet, FileText, FileVideo, Loader2, RotateCcw, UploadCloud, X } from "lucide-react";
8
8
  //#region src/components/motion/file-upload.tsx
9
9
  const ROW_TRANSITION = {
10
10
  duration: .22,