@kumix/ui 0.3.13 → 0.3.14

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 (522) hide show
  1. package/README.md +2 -2
  2. package/dist/components/agents/agent-activity/activity-row.js +1 -1
  3. package/dist/components/agents/agent-activity/activity-row.js.map +1 -1
  4. package/dist/components/agents/agent-activity/index.js +1 -1
  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 +1 -1
  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 +1 -1
  12. package/dist/components/agents/ai-sidebar.js.map +1 -1
  13. package/dist/components/agents/approval-card/index.js +1 -1
  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 +1 -1
  18. package/dist/components/agents/citations.js.map +1 -1
  19. package/dist/components/agents/code-block.js +1 -1
  20. package/dist/components/agents/code-block.js.map +1 -1
  21. package/dist/components/agents/file-diff.js +1 -1
  22. package/dist/components/agents/file-diff.js.map +1 -1
  23. package/dist/components/agents/image-generation.js +1 -1
  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 +1 -1
  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 +1 -1
  38. package/dist/components/agents/prompt-input.js.map +1 -1
  39. package/dist/components/agents/streaming-response.js +1 -1
  40. package/dist/components/agents/streaming-response.js.map +1 -1
  41. package/dist/components/agents/todo-list.js +1 -1
  42. package/dist/components/agents/todo-list.js.map +1 -1
  43. package/dist/components/agents/tool-approval.js +1 -1
  44. package/dist/components/agents/tool-approval.js.map +1 -1
  45. package/dist/components/agents/tool-result.js +1 -1
  46. package/dist/components/agents/tool-result.js.map +1 -1
  47. package/dist/components/motion/action-swap.js +1 -1
  48. package/dist/components/motion/action-swap.js.map +1 -1
  49. package/dist/components/motion/adaptive-stepper.js +1 -1
  50. package/dist/components/motion/adaptive-stepper.js.map +1 -1
  51. package/dist/components/motion/animated-badge.js +1 -1
  52. package/dist/components/motion/animated-badge.js.map +1 -1
  53. package/dist/components/motion/animated-number.js +1 -1
  54. package/dist/components/motion/animated-number.js.map +1 -1
  55. package/dist/components/motion/animated-sidebar.js +1 -1
  56. package/dist/components/motion/animated-sidebar.js.map +1 -1
  57. package/dist/components/motion/animated-toast-stack.js +1 -1
  58. package/dist/components/motion/animated-toast-stack.js.map +1 -1
  59. package/dist/components/motion/attachment-upload.js +1 -1
  60. package/dist/components/motion/attachment-upload.js.map +1 -1
  61. package/dist/components/motion/availability-scheduler/icon-button.js +1 -1
  62. package/dist/components/motion/availability-scheduler/icon-button.js.map +1 -1
  63. package/dist/components/motion/availability-scheduler/index.js +1 -1
  64. package/dist/components/motion/availability-scheduler/index.js.map +1 -1
  65. package/dist/components/motion/bloom-menu.js +1 -1
  66. package/dist/components/motion/bloom-menu.js.map +1 -1
  67. package/dist/components/motion/bottom-sheet.js +1 -1
  68. package/dist/components/motion/bottom-sheet.js.map +1 -1
  69. package/dist/components/motion/bounce-sidebar.d.ts.map +1 -1
  70. package/dist/components/motion/bounce-sidebar.js +1 -1
  71. package/dist/components/motion/bounce-sidebar.js.map +1 -1
  72. package/dist/components/motion/bouncy-accordion.js +1 -1
  73. package/dist/components/motion/bouncy-accordion.js.map +1 -1
  74. package/dist/components/motion/button/base.js +1 -1
  75. package/dist/components/motion/button/base.js.map +1 -1
  76. package/dist/components/motion/button/metallic.js +1 -1
  77. package/dist/components/motion/button/metallic.js.map +1 -1
  78. package/dist/components/motion/card-folder.js +1 -1
  79. package/dist/components/motion/card-folder.js.map +1 -1
  80. package/dist/components/motion/center-morph-modal.js +1 -1
  81. package/dist/components/motion/center-morph-modal.js.map +1 -1
  82. package/dist/components/motion/checkbox.js +1 -1
  83. package/dist/components/motion/checkbox.js.map +1 -1
  84. package/dist/components/motion/chromatic-text-reveal.js +1 -1
  85. package/dist/components/motion/chromatic-text-reveal.js.map +1 -1
  86. package/dist/components/motion/combobox/content.js +1 -1
  87. package/dist/components/motion/combobox/content.js.map +1 -1
  88. package/dist/components/motion/combobox/context.js +1 -1
  89. package/dist/components/motion/combobox/context.js.map +1 -1
  90. package/dist/components/motion/combobox/list.js +1 -1
  91. package/dist/components/motion/combobox/list.js.map +1 -1
  92. package/dist/components/motion/combobox/trigger.js +1 -1
  93. package/dist/components/motion/combobox/trigger.js.map +1 -1
  94. package/dist/components/motion/command-palette.js +1 -1
  95. package/dist/components/motion/command-palette.js.map +1 -1
  96. package/dist/components/motion/context-menu.js +1 -1
  97. package/dist/components/motion/context-menu.js.map +1 -1
  98. package/dist/components/motion/cylinder-carousel.js +1 -1
  99. package/dist/components/motion/cylinder-carousel.js.map +1 -1
  100. package/dist/components/motion/digit-swap.js +1 -1
  101. package/dist/components/motion/digit-swap.js.map +1 -1
  102. package/dist/components/motion/dock.js +1 -1
  103. package/dist/components/motion/dock.js.map +1 -1
  104. package/dist/components/motion/drawer.js +1 -1
  105. package/dist/components/motion/drawer.js.map +1 -1
  106. package/dist/components/motion/dynamic-island.js +1 -1
  107. package/dist/components/motion/dynamic-island.js.map +1 -1
  108. package/dist/components/motion/expandable-action-bar.js +1 -1
  109. package/dist/components/motion/expandable-action-bar.js.map +1 -1
  110. package/dist/components/motion/expandable-control.d.ts.map +1 -1
  111. package/dist/components/motion/expandable-control.js +1 -1
  112. package/dist/components/motion/expandable-control.js.map +1 -1
  113. package/dist/components/motion/expandable-tabs.js +1 -1
  114. package/dist/components/motion/expandable-tabs.js.map +1 -1
  115. package/dist/components/motion/expanding-arrow-button.js +1 -1
  116. package/dist/components/motion/expanding-arrow-button.js.map +1 -1
  117. package/dist/components/motion/feedback-widget.js +1 -1
  118. package/dist/components/motion/feedback-widget.js.map +1 -1
  119. package/dist/components/motion/file-tree.js +1 -1
  120. package/dist/components/motion/file-tree.js.map +1 -1
  121. package/dist/components/motion/file-upload.js +1 -1
  122. package/dist/components/motion/file-upload.js.map +1 -1
  123. package/dist/components/motion/hold-action-button.js +1 -1
  124. package/dist/components/motion/hold-action-button.js.map +1 -1
  125. package/dist/components/motion/infinite-masonry.js +1 -1
  126. package/dist/components/motion/infinite-masonry.js.map +1 -1
  127. package/dist/components/motion/input.d.ts.map +1 -1
  128. package/dist/components/motion/input.js +1 -1
  129. package/dist/components/motion/input.js.map +1 -1
  130. package/dist/components/motion/liquid.js +1 -1
  131. package/dist/components/motion/liquid.js.map +1 -1
  132. package/dist/components/motion/loader.js +1 -1
  133. package/dist/components/motion/loader.js.map +1 -1
  134. package/dist/components/motion/magnetic.js +1 -1
  135. package/dist/components/motion/magnetic.js.map +1 -1
  136. package/dist/components/motion/marquee.d.ts.map +1 -1
  137. package/dist/components/motion/marquee.js +1 -1
  138. package/dist/components/motion/marquee.js.map +1 -1
  139. package/dist/components/motion/morphing-modal.js +1 -1
  140. package/dist/components/motion/morphing-modal.js.map +1 -1
  141. package/dist/components/motion/morphing-search.js +1 -1
  142. package/dist/components/motion/morphing-search.js.map +1 -1
  143. package/dist/components/motion/morphing-tabs.js +1 -1
  144. package/dist/components/motion/morphing-tabs.js.map +1 -1
  145. package/dist/components/motion/multi-select/content.js +1 -1
  146. package/dist/components/motion/multi-select/content.js.map +1 -1
  147. package/dist/components/motion/multi-select/context.js +1 -1
  148. package/dist/components/motion/multi-select/context.js.map +1 -1
  149. package/dist/components/motion/multi-select/list.js +1 -1
  150. package/dist/components/motion/multi-select/list.js.map +1 -1
  151. package/dist/components/motion/multi-select/trigger.js +1 -1
  152. package/dist/components/motion/multi-select/trigger.js.map +1 -1
  153. package/dist/components/motion/not-found/magnetic.d.ts.map +1 -1
  154. package/dist/components/motion/not-found/magnetic.js +1 -1
  155. package/dist/components/motion/not-found/magnetic.js.map +1 -1
  156. package/dist/components/motion/not-found/shared.js +1 -1
  157. package/dist/components/motion/not-found/shared.js.map +1 -1
  158. package/dist/components/motion/not-found/spotlight.js +1 -1
  159. package/dist/components/motion/not-found/spotlight.js.map +1 -1
  160. package/dist/components/motion/notification-stack.js +1 -1
  161. package/dist/components/motion/notification-stack.js.map +1 -1
  162. package/dist/components/motion/number-ticker.js +1 -1
  163. package/dist/components/motion/number-ticker.js.map +1 -1
  164. package/dist/components/motion/otp-input.js +1 -1
  165. package/dist/components/motion/otp-input.js.map +1 -1
  166. package/dist/components/motion/overflow-actions.js +1 -1
  167. package/dist/components/motion/overflow-actions.js.map +1 -1
  168. package/dist/components/motion/parallax.d.ts.map +1 -1
  169. package/dist/components/motion/parallax.js +1 -1
  170. package/dist/components/motion/parallax.js.map +1 -1
  171. package/dist/components/motion/popover-morph.js +1 -1
  172. package/dist/components/motion/popover-morph.js.map +1 -1
  173. package/dist/components/motion/popover.js +1 -1
  174. package/dist/components/motion/popover.js.map +1 -1
  175. package/dist/components/motion/preview-rail.js +1 -1
  176. package/dist/components/motion/preview-rail.js.map +1 -1
  177. package/dist/components/motion/project-folder.js +1 -1
  178. package/dist/components/motion/project-folder.js.map +1 -1
  179. package/dist/components/motion/pull-to-refresh.js +1 -1
  180. package/dist/components/motion/pull-to-refresh.js.map +1 -1
  181. package/dist/components/motion/radio.js +1 -1
  182. package/dist/components/motion/radio.js.map +1 -1
  183. package/dist/components/motion/range-slider-bubble.js +1 -1
  184. package/dist/components/motion/range-slider-bubble.js.map +1 -1
  185. package/dist/components/motion/range-slider-fluid.js +1 -1
  186. package/dist/components/motion/range-slider-fluid.js.map +1 -1
  187. package/dist/components/motion/range-slider-inline.d.ts +18 -0
  188. package/dist/components/motion/range-slider-inline.d.ts.map +1 -0
  189. package/dist/components/motion/range-slider-inline.js +267 -0
  190. package/dist/components/motion/range-slider-inline.js.map +1 -0
  191. package/dist/components/motion/range-slider-ruler.js +1 -1
  192. package/dist/components/motion/range-slider-ruler.js.map +1 -1
  193. package/dist/components/motion/range-slider-wave.js +1 -1
  194. package/dist/components/motion/range-slider-wave.js.map +1 -1
  195. package/dist/components/motion/range-slider.d.ts.map +1 -1
  196. package/dist/components/motion/range-slider.js +27 -11
  197. package/dist/components/motion/range-slider.js.map +1 -1
  198. package/dist/components/motion/scroll-progress.js +1 -1
  199. package/dist/components/motion/scroll-progress.js.map +1 -1
  200. package/dist/components/motion/scroll-reveal.js +1 -1
  201. package/dist/components/motion/scroll-reveal.js.map +1 -1
  202. package/dist/components/motion/scroll-to.js +1 -1
  203. package/dist/components/motion/scroll-to.js.map +1 -1
  204. package/dist/components/motion/select-morph.d.ts.map +1 -1
  205. package/dist/components/motion/select-morph.js +1 -1
  206. package/dist/components/motion/select-morph.js.map +1 -1
  207. package/dist/components/motion/select.js +1 -1
  208. package/dist/components/motion/select.js.map +1 -1
  209. package/dist/components/motion/shader-background.d.ts.map +1 -1
  210. package/dist/components/motion/shader-background.js +1 -1
  211. package/dist/components/motion/shader-background.js.map +1 -1
  212. package/dist/components/motion/shared-layout-bg.js +1 -1
  213. package/dist/components/motion/shared-layout-bg.js.map +1 -1
  214. package/dist/components/motion/signup-form.js +1 -1
  215. package/dist/components/motion/signup-form.js.map +1 -1
  216. package/dist/components/motion/slide-action-button.js +1 -1
  217. package/dist/components/motion/slide-action-button.js.map +1 -1
  218. package/dist/components/motion/swipeable-list.js +1 -1
  219. package/dist/components/motion/swipeable-list.js.map +1 -1
  220. package/dist/components/motion/switch.d.ts.map +1 -1
  221. package/dist/components/motion/switch.js +1 -1
  222. package/dist/components/motion/switch.js.map +1 -1
  223. package/dist/components/motion/table/index.js +1 -1
  224. package/dist/components/motion/table/index.js.map +1 -1
  225. package/dist/components/motion/table/skeleton-rows.d.ts.map +1 -1
  226. package/dist/components/motion/table/skeleton-rows.js +1 -1
  227. package/dist/components/motion/table/skeleton-rows.js.map +1 -1
  228. package/dist/components/motion/table/table-header.js +1 -1
  229. package/dist/components/motion/table/table-header.js.map +1 -1
  230. package/dist/components/motion/table/table-menu.js +1 -1
  231. package/dist/components/motion/table/table-menu.js.map +1 -1
  232. package/dist/components/motion/tabs.js +1 -1
  233. package/dist/components/motion/tabs.js.map +1 -1
  234. package/dist/components/motion/text-reveal.js +1 -1
  235. package/dist/components/motion/text-reveal.js.map +1 -1
  236. package/dist/components/motion/text-scramble.d.ts.map +1 -1
  237. package/dist/components/motion/text-scramble.js +1 -1
  238. package/dist/components/motion/text-scramble.js.map +1 -1
  239. package/dist/components/motion/text-shimmer.js +1 -1
  240. package/dist/components/motion/text-shimmer.js.map +1 -1
  241. package/dist/components/motion/theme-toggle.js +1 -1
  242. package/dist/components/motion/theme-toggle.js.map +1 -1
  243. package/dist/components/motion/tilt-card.js +1 -1
  244. package/dist/components/motion/tilt-card.js.map +1 -1
  245. package/dist/components/motion/tooltip.js +1 -1
  246. package/dist/components/motion/tooltip.js.map +1 -1
  247. package/dist/components/motion/wheel-picker.js +1 -1
  248. package/dist/components/motion/wheel-picker.js.map +1 -1
  249. package/dist/components/reui/alert.d.ts +1 -1
  250. package/dist/components/reui/alert.d.ts.map +1 -1
  251. package/dist/components/reui/alert.js +1 -1
  252. package/dist/components/reui/alert.js.map +1 -1
  253. package/dist/components/reui/autocomplete.d.ts +1 -1
  254. package/dist/components/reui/autocomplete.js +1 -1
  255. package/dist/components/reui/autocomplete.js.map +1 -1
  256. package/dist/components/reui/badge.d.ts +2 -2
  257. package/dist/components/reui/badge.d.ts.map +1 -1
  258. package/dist/components/reui/badge.js +1 -1
  259. package/dist/components/reui/badge.js.map +1 -1
  260. package/dist/components/reui/cascader/cascader-columns.js +1 -1
  261. package/dist/components/reui/cascader/cascader-columns.js.map +1 -1
  262. package/dist/components/reui/cascader/cascader-footer.js +1 -1
  263. package/dist/components/reui/cascader/cascader-footer.js.map +1 -1
  264. package/dist/components/reui/cascader/cascader-item.js +1 -1
  265. package/dist/components/reui/cascader/cascader-item.js.map +1 -1
  266. package/dist/components/reui/cascader/cascader-nav.js +1 -1
  267. package/dist/components/reui/cascader/cascader-nav.js.map +1 -1
  268. package/dist/components/reui/cascader/cascader.js +1 -1
  269. package/dist/components/reui/cascader/cascader.js.map +1 -1
  270. package/dist/components/reui/code-block/code-block.js +1 -1
  271. package/dist/components/reui/code-block/code-block.js.map +1 -1
  272. package/dist/components/reui/data-grid/data-grid-cell-selection.js +1 -1
  273. package/dist/components/reui/data-grid/data-grid-cell-selection.js.map +1 -1
  274. package/dist/components/reui/data-grid/data-grid-column-filter.js +1 -1
  275. package/dist/components/reui/data-grid/data-grid-column-filter.js.map +1 -1
  276. package/dist/components/reui/data-grid/data-grid-column-header.js +1 -1
  277. package/dist/components/reui/data-grid/data-grid-column-header.js.map +1 -1
  278. package/dist/components/reui/data-grid/data-grid-pagination.js +1 -1
  279. package/dist/components/reui/data-grid/data-grid-pagination.js.map +1 -1
  280. package/dist/components/reui/data-grid/data-grid-scroll-area.js +1 -1
  281. package/dist/components/reui/data-grid/data-grid-scroll-area.js.map +1 -1
  282. package/dist/components/reui/data-grid/data-grid-table-dnd-rows.js +1 -1
  283. package/dist/components/reui/data-grid/data-grid-table-dnd-rows.js.map +1 -1
  284. package/dist/components/reui/data-grid/data-grid-table-virtual.js +1 -1
  285. package/dist/components/reui/data-grid/data-grid-table-virtual.js.map +1 -1
  286. package/dist/components/reui/data-grid/data-grid-table.js +1 -1
  287. package/dist/components/reui/data-grid/data-grid-table.js.map +1 -1
  288. package/dist/components/reui/data-grid/data-grid.js +1 -1
  289. package/dist/components/reui/data-grid/data-grid.js.map +1 -1
  290. package/dist/components/reui/date-selector.js +1 -1
  291. package/dist/components/reui/date-selector.js.map +1 -1
  292. package/dist/components/reui/event-calendar/event-calendar-agenda-view.js +1 -1
  293. package/dist/components/reui/event-calendar/event-calendar-agenda-view.js.map +1 -1
  294. package/dist/components/reui/event-calendar/event-calendar-content.js +1 -1
  295. package/dist/components/reui/event-calendar/event-calendar-content.js.map +1 -1
  296. package/dist/components/reui/event-calendar/event-calendar-event.js +1 -1
  297. package/dist/components/reui/event-calendar/event-calendar-event.js.map +1 -1
  298. package/dist/components/reui/event-calendar/event-calendar-month-view.js +1 -1
  299. package/dist/components/reui/event-calendar/event-calendar-month-view.js.map +1 -1
  300. package/dist/components/reui/event-calendar/event-calendar-nav.js +1 -1
  301. package/dist/components/reui/event-calendar/event-calendar-nav.js.map +1 -1
  302. package/dist/components/reui/event-calendar/event-calendar-resource-view.js +1 -1
  303. package/dist/components/reui/event-calendar/event-calendar-resource-view.js.map +1 -1
  304. package/dist/components/reui/event-calendar/event-calendar-time-grid.js +1 -1
  305. package/dist/components/reui/event-calendar/event-calendar-time-grid.js.map +1 -1
  306. package/dist/components/reui/event-calendar/event-calendar.js +1 -1
  307. package/dist/components/reui/event-calendar/event-calendar.js.map +1 -1
  308. package/dist/components/reui/filters/filters-advanced.js +1 -1
  309. package/dist/components/reui/filters/filters-advanced.js.map +1 -1
  310. package/dist/components/reui/filters/filters-builder.js +2 -2
  311. package/dist/components/reui/filters/filters-builder.js.map +1 -1
  312. package/dist/components/reui/filters/filters-chip.js +1 -1
  313. package/dist/components/reui/filters/filters-chip.js.map +1 -1
  314. package/dist/components/reui/filters/filters-editors.js +2 -2
  315. package/dist/components/reui/filters/filters-editors.js.map +1 -1
  316. package/dist/components/reui/filters/filters.js +1 -1
  317. package/dist/components/reui/filters/filters.js.map +1 -1
  318. package/dist/components/reui/frame.d.ts +2 -2
  319. package/dist/components/reui/frame.d.ts.map +1 -1
  320. package/dist/components/reui/frame.js +1 -1
  321. package/dist/components/reui/frame.js.map +1 -1
  322. package/dist/components/reui/gantt/gantt-bar.js +1 -1
  323. package/dist/components/reui/gantt/gantt-bar.js.map +1 -1
  324. package/dist/components/reui/gantt/gantt-nav.js +1 -1
  325. package/dist/components/reui/gantt/gantt-nav.js.map +1 -1
  326. package/dist/components/reui/gantt/gantt-view.js +1 -1
  327. package/dist/components/reui/gantt/gantt-view.js.map +1 -1
  328. package/dist/components/reui/gantt/gantt.js +1 -1
  329. package/dist/components/reui/gantt/gantt.js.map +1 -1
  330. package/dist/components/reui/icon-stack.js +1 -1
  331. package/dist/components/reui/icon-stack.js.map +1 -1
  332. package/dist/components/reui/icon-tile.d.ts +2 -2
  333. package/dist/components/reui/icon-tile.d.ts.map +1 -1
  334. package/dist/components/reui/icon-tile.js +1 -1
  335. package/dist/components/reui/icon-tile.js.map +1 -1
  336. package/dist/components/reui/kanban.d.ts.map +1 -1
  337. package/dist/components/reui/kanban.js +1 -1
  338. package/dist/components/reui/kanban.js.map +1 -1
  339. package/dist/components/reui/number-field.d.ts +3 -3
  340. package/dist/components/reui/number-field.js +1 -1
  341. package/dist/components/reui/number-field.js.map +1 -1
  342. package/dist/components/reui/phone-input.js +1 -1
  343. package/dist/components/reui/phone-input.js.map +1 -1
  344. package/dist/components/reui/rating.d.ts +1 -1
  345. package/dist/components/reui/rating.d.ts.map +1 -1
  346. package/dist/components/reui/rating.js +1 -1
  347. package/dist/components/reui/rating.js.map +1 -1
  348. package/dist/components/reui/sortable.d.ts.map +1 -1
  349. package/dist/components/reui/sortable.js +1 -1
  350. package/dist/components/reui/sortable.js.map +1 -1
  351. package/dist/components/reui/stepper.d.ts.map +1 -1
  352. package/dist/components/reui/stepper.js +1 -1
  353. package/dist/components/reui/stepper.js.map +1 -1
  354. package/dist/components/reui/timeline.d.ts.map +1 -1
  355. package/dist/components/reui/timeline.js +1 -1
  356. package/dist/components/reui/timeline.js.map +1 -1
  357. package/dist/components/reui/tree.d.ts.map +1 -1
  358. package/dist/components/reui/tree.js +1 -1
  359. package/dist/components/reui/tree.js.map +1 -1
  360. package/dist/components/ui/accordion.d.ts.map +1 -1
  361. package/dist/components/ui/accordion.js +1 -1
  362. package/dist/components/ui/accordion.js.map +1 -1
  363. package/dist/components/ui/alert-dialog.js +1 -1
  364. package/dist/components/ui/alert-dialog.js.map +1 -1
  365. package/dist/components/ui/alert.d.ts.map +1 -1
  366. package/dist/components/ui/alert.js +1 -1
  367. package/dist/components/ui/alert.js.map +1 -1
  368. package/dist/components/ui/aspect-ratio.js +1 -1
  369. package/dist/components/ui/aspect-ratio.js.map +1 -1
  370. package/dist/components/ui/attachment.d.ts +1 -1
  371. package/dist/components/ui/attachment.js +1 -1
  372. package/dist/components/ui/attachment.js.map +1 -1
  373. package/dist/components/ui/avatar.d.ts.map +1 -1
  374. package/dist/components/ui/avatar.js +1 -1
  375. package/dist/components/ui/avatar.js.map +1 -1
  376. package/dist/components/ui/badge.d.ts +1 -1
  377. package/dist/components/ui/badge.d.ts.map +1 -1
  378. package/dist/components/ui/badge.js +1 -1
  379. package/dist/components/ui/badge.js.map +1 -1
  380. package/dist/components/ui/breadcrumb.d.ts.map +1 -1
  381. package/dist/components/ui/breadcrumb.js +1 -1
  382. package/dist/components/ui/breadcrumb.js.map +1 -1
  383. package/dist/components/ui/bubble.d.ts +1 -1
  384. package/dist/components/ui/bubble.d.ts.map +1 -1
  385. package/dist/components/ui/bubble.js +1 -1
  386. package/dist/components/ui/bubble.js.map +1 -1
  387. package/dist/components/ui/button-group.js +1 -1
  388. package/dist/components/ui/button-group.js.map +1 -1
  389. package/dist/components/ui/button.d.ts +2 -2
  390. package/dist/components/ui/button.d.ts.map +1 -1
  391. package/dist/components/ui/button.js +1 -1
  392. package/dist/components/ui/button.js.map +1 -1
  393. package/dist/components/ui/calendar.js +1 -1
  394. package/dist/components/ui/calendar.js.map +1 -1
  395. package/dist/components/ui/card.d.ts.map +1 -1
  396. package/dist/components/ui/card.js +1 -1
  397. package/dist/components/ui/card.js.map +1 -1
  398. package/dist/components/ui/carousel.js +1 -1
  399. package/dist/components/ui/carousel.js.map +1 -1
  400. package/dist/components/ui/chart.d.ts.map +1 -1
  401. package/dist/components/ui/chart.js +1 -1
  402. package/dist/components/ui/chart.js.map +1 -1
  403. package/dist/components/ui/checkbox.d.ts.map +1 -1
  404. package/dist/components/ui/checkbox.js +1 -1
  405. package/dist/components/ui/checkbox.js.map +1 -1
  406. package/dist/components/ui/combobox.js +1 -1
  407. package/dist/components/ui/combobox.js.map +1 -1
  408. package/dist/components/ui/command.js +1 -1
  409. package/dist/components/ui/command.js.map +1 -1
  410. package/dist/components/ui/context-menu.d.ts.map +1 -1
  411. package/dist/components/ui/context-menu.js +1 -1
  412. package/dist/components/ui/context-menu.js.map +1 -1
  413. package/dist/components/ui/dialog.js +1 -1
  414. package/dist/components/ui/dialog.js.map +1 -1
  415. package/dist/components/ui/drawer.d.ts.map +1 -1
  416. package/dist/components/ui/drawer.js +1 -1
  417. package/dist/components/ui/drawer.js.map +1 -1
  418. package/dist/components/ui/dropdown-menu.d.ts.map +1 -1
  419. package/dist/components/ui/dropdown-menu.js +1 -1
  420. package/dist/components/ui/dropdown-menu.js.map +1 -1
  421. package/dist/components/ui/empty.d.ts.map +1 -1
  422. package/dist/components/ui/empty.js +1 -1
  423. package/dist/components/ui/empty.js.map +1 -1
  424. package/dist/components/ui/field.js +1 -1
  425. package/dist/components/ui/field.js.map +1 -1
  426. package/dist/components/ui/hover-card.d.ts.map +1 -1
  427. package/dist/components/ui/hover-card.js +1 -1
  428. package/dist/components/ui/hover-card.js.map +1 -1
  429. package/dist/components/ui/input-group.js +1 -1
  430. package/dist/components/ui/input-group.js.map +1 -1
  431. package/dist/components/ui/input-otp.d.ts.map +1 -1
  432. package/dist/components/ui/input-otp.js +1 -1
  433. package/dist/components/ui/input-otp.js.map +1 -1
  434. package/dist/components/ui/input.d.ts.map +1 -1
  435. package/dist/components/ui/input.js +1 -1
  436. package/dist/components/ui/input.js.map +1 -1
  437. package/dist/components/ui/item.d.ts +2 -2
  438. package/dist/components/ui/item.js +1 -1
  439. package/dist/components/ui/item.js.map +1 -1
  440. package/dist/components/ui/kbd.js +1 -1
  441. package/dist/components/ui/kbd.js.map +1 -1
  442. package/dist/components/ui/label.d.ts.map +1 -1
  443. package/dist/components/ui/label.js +1 -1
  444. package/dist/components/ui/label.js.map +1 -1
  445. package/dist/components/ui/marker.d.ts.map +1 -1
  446. package/dist/components/ui/marker.js +1 -1
  447. package/dist/components/ui/marker.js.map +1 -1
  448. package/dist/components/ui/menubar.js +1 -1
  449. package/dist/components/ui/menubar.js.map +1 -1
  450. package/dist/components/ui/message-scroller.js +1 -1
  451. package/dist/components/ui/message-scroller.js.map +1 -1
  452. package/dist/components/ui/message.d.ts.map +1 -1
  453. package/dist/components/ui/message.js +1 -1
  454. package/dist/components/ui/message.js.map +1 -1
  455. package/dist/components/ui/native-select.d.ts.map +1 -1
  456. package/dist/components/ui/native-select.js +1 -1
  457. package/dist/components/ui/native-select.js.map +1 -1
  458. package/dist/components/ui/navigation-menu.d.ts.map +1 -1
  459. package/dist/components/ui/navigation-menu.js +1 -1
  460. package/dist/components/ui/navigation-menu.js.map +1 -1
  461. package/dist/components/ui/pagination.js +1 -1
  462. package/dist/components/ui/pagination.js.map +1 -1
  463. package/dist/components/ui/popover.d.ts.map +1 -1
  464. package/dist/components/ui/popover.js +1 -1
  465. package/dist/components/ui/popover.js.map +1 -1
  466. package/dist/components/ui/progress.d.ts.map +1 -1
  467. package/dist/components/ui/progress.js +1 -1
  468. package/dist/components/ui/progress.js.map +1 -1
  469. package/dist/components/ui/questionnaire.js +1 -1
  470. package/dist/components/ui/questionnaire.js.map +1 -1
  471. package/dist/components/ui/radio-group.d.ts.map +1 -1
  472. package/dist/components/ui/radio-group.js +1 -1
  473. package/dist/components/ui/radio-group.js.map +1 -1
  474. package/dist/components/ui/resizable.d.ts.map +1 -1
  475. package/dist/components/ui/resizable.js +1 -1
  476. package/dist/components/ui/resizable.js.map +1 -1
  477. package/dist/components/ui/scroll-area.d.ts.map +1 -1
  478. package/dist/components/ui/scroll-area.js +1 -1
  479. package/dist/components/ui/scroll-area.js.map +1 -1
  480. package/dist/components/ui/select.d.ts.map +1 -1
  481. package/dist/components/ui/select.js +1 -1
  482. package/dist/components/ui/select.js.map +1 -1
  483. package/dist/components/ui/separator.d.ts.map +1 -1
  484. package/dist/components/ui/separator.js +1 -1
  485. package/dist/components/ui/separator.js.map +1 -1
  486. package/dist/components/ui/sheet.js +1 -1
  487. package/dist/components/ui/sheet.js.map +1 -1
  488. package/dist/components/ui/sidebar.d.ts +2 -2
  489. package/dist/components/ui/sidebar.js +1 -1
  490. package/dist/components/ui/sidebar.js.map +1 -1
  491. package/dist/components/ui/skeleton.js +1 -1
  492. package/dist/components/ui/skeleton.js.map +1 -1
  493. package/dist/components/ui/slider.d.ts.map +1 -1
  494. package/dist/components/ui/slider.js +1 -1
  495. package/dist/components/ui/slider.js.map +1 -1
  496. package/dist/components/ui/spinner.d.ts.map +1 -1
  497. package/dist/components/ui/spinner.js +1 -1
  498. package/dist/components/ui/spinner.js.map +1 -1
  499. package/dist/components/ui/switch.d.ts.map +1 -1
  500. package/dist/components/ui/switch.js +1 -1
  501. package/dist/components/ui/switch.js.map +1 -1
  502. package/dist/components/ui/table.d.ts.map +1 -1
  503. package/dist/components/ui/table.js +1 -1
  504. package/dist/components/ui/table.js.map +1 -1
  505. package/dist/components/ui/tabs.d.ts.map +1 -1
  506. package/dist/components/ui/tabs.js +1 -1
  507. package/dist/components/ui/tabs.js.map +1 -1
  508. package/dist/components/ui/textarea.d.ts.map +1 -1
  509. package/dist/components/ui/textarea.js +1 -1
  510. package/dist/components/ui/textarea.js.map +1 -1
  511. package/dist/components/ui/toast.js +1 -1
  512. package/dist/components/ui/toast.js.map +1 -1
  513. package/dist/components/ui/toggle-group.js +1 -1
  514. package/dist/components/ui/toggle-group.js.map +1 -1
  515. package/dist/components/ui/toggle.d.ts +2 -2
  516. package/dist/components/ui/toggle.d.ts.map +1 -1
  517. package/dist/components/ui/toggle.js +1 -1
  518. package/dist/components/ui/toggle.js.map +1 -1
  519. package/dist/components/ui/tooltip.d.ts.map +1 -1
  520. package/dist/components/ui/tooltip.js +1 -1
  521. package/dist/components/ui/tooltip.js.map +1 -1
  522. package/package.json +8 -10
@@ -1 +1 @@
1
- {"version":3,"file":"trigger.js","names":[],"sources":["../../../../src/components/motion/multi-select/trigger.tsx"],"sourcesContent":["\"use client\";\n\nimport type {\n InputHTMLAttributes,\n KeyboardEvent as ReactKeyboardEvent,\n ReactNode,\n Ref,\n} from \"react\";\nimport { cn } from \"cn\";\nimport { ChevronsUpDown, Search, X } from \"lucide-react\";\nimport { AnimatePresence, motion } from \"motion/react\";\n\nimport { EASE_OUT, SPRING_LAYOUT, SPRING_SWAP } from \"../../../lib/ease\";\nimport { mergeRefs, useMultiSelectContext } from \"./context\";\n\nexport interface MultiSelectTriggerProps {\n children: ReactNode;\n className?: string;\n}\n\nexport function MultiSelectTrigger({ children, className }: MultiSelectTriggerProps) {\n const context = useMultiSelectContext(\"MultiSelectTrigger\");\n\n return (\n <div\n ref={context.triggerRef}\n id={context.triggerId}\n data-state={context.open ? \"open\" : \"closed\"}\n onPointerDown={(event) => {\n const target = event.target as HTMLElement;\n if (\n context.disabled ||\n target === context.inputRef.current ||\n target.closest(\"[data-multi-select-remove]\")\n ) {\n return;\n }\n event.preventDefault();\n context.inputRef.current?.focus({ preventScroll: true });\n context.setOpen(true);\n }}\n className={cn(\n \"relative z-20 flex min-h-11 w-full min-w-52 cursor-text items-center gap-2 rounded-xl border border-border bg-transparent px-2.5 py-1.5 text-foreground text-sm transition-[border-color] hover:border-(--color-border-strong)\",\n \"focus-within:ring-2 focus-within:ring-foreground/20\",\n context.disabled && \"pointer-events-none opacity-50\",\n className,\n )}\n >\n <div className=\"flex min-w-0 flex-1 flex-wrap items-center gap-1.5\">{children}</div>\n <ChevronsUpDown aria-hidden=\"true\" className=\"size-4 shrink-0 text-muted-foreground\" />\n </div>\n );\n}\n\nexport interface MultiSelectValueProps {\n placeholder?: ReactNode;\n children?: (value: string, label: string) => ReactNode;\n className?: string;\n chipClassName?: string;\n}\n\nexport function MultiSelectValue({\n placeholder = \"Select options\",\n children,\n className,\n chipClassName,\n}: MultiSelectValueProps) {\n const context = useMultiSelectContext(\"MultiSelectValue\");\n const showPlaceholder = context.values.length === 0 && !context.open;\n\n return (\n <div className={cn(\"contents\", className)}>\n <AnimatePresence initial={false} mode=\"popLayout\">\n {showPlaceholder ? (\n <span key=\"multi-select-placeholder\" className=\"text-muted-foreground\">\n {placeholder}\n </span>\n ) : null}\n {context.values.map((value) => {\n const label = context.labelFor(value);\n return (\n <motion.span\n layout={context.reduce ? false : \"position\"}\n key={`multi-select-value-${value}`}\n initial={{\n opacity: 0,\n clipPath: \"inset(0 0 0 0% round 0.5rem)\",\n transform: context.reduce\n ? \"translateY(0px) scale(1)\"\n : \"translateY(6px) scale(0.92)\",\n }}\n animate={{\n opacity: 1,\n clipPath: \"inset(0 0 0 0% round 0.5rem)\",\n transform: \"translateY(0px) scale(1)\",\n }}\n exit={{\n opacity: 1,\n clipPath: context.reduce\n ? \"inset(0 0 0 0% round 0.5rem)\"\n : \"inset(0 0 0 100% round 0.5rem)\",\n transform: \"translateY(0px) scale(1)\",\n transition: {\n clipPath: context.reduce ? { duration: 0 } : { duration: 0.16, ease: EASE_OUT },\n transform: { duration: 0 },\n },\n }}\n transition={\n context.reduce\n ? {\n layout: { duration: 0 },\n opacity: { duration: 0.15, ease: EASE_OUT },\n transform: { duration: 0 },\n }\n : {\n layout: SPRING_LAYOUT,\n opacity: { duration: 0.18, ease: EASE_OUT },\n transform: SPRING_SWAP,\n }\n }\n className={cn(\n \"inline-flex h-7 max-w-full items-center gap-1 rounded-lg bg-muted px-2 font-medium text-foreground text-xs\",\n chipClassName,\n )}\n >\n <span className=\"truncate\">{children ? children(value, label) : label}</span>\n <button\n type=\"button\"\n data-multi-select-remove=\"\"\n aria-label={`Remove ${label}`}\n disabled={context.disabled}\n onPointerDown={(event) => event.stopPropagation()}\n onClick={(event) => {\n event.stopPropagation();\n context.remove(value);\n context.inputRef.current?.focus({ preventScroll: true });\n }}\n className=\"-mr-1 grid size-5 shrink-0 place-items-center rounded-md text-muted-foreground outline-none transition-colors hover:bg-foreground/10 hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring\"\n >\n <X aria-hidden=\"true\" className=\"size-3\" />\n </button>\n </motion.span>\n );\n })}\n </AnimatePresence>\n </div>\n );\n}\n\nexport interface MultiSelectInputProps\n extends Omit<InputHTMLAttributes<HTMLInputElement>, \"defaultValue\" | \"value\"> {\n ref?: Ref<HTMLInputElement>;\n showIcon?: boolean;\n}\n\nexport function MultiSelectInput({\n ref,\n className,\n \"aria-label\": ariaLabel = \"Search options\",\n onChange,\n onClick,\n onFocus,\n onKeyDown,\n onPointerDown,\n placeholder = \"Search…\",\n showIcon = false,\n ...props\n}: MultiSelectInputProps) {\n const context = useMultiSelectContext(\"MultiSelectInput\");\n\n const handleKeyDown = (event: ReactKeyboardEvent<HTMLInputElement>) => {\n onKeyDown?.(event);\n if (event.defaultPrevented) return;\n\n if (event.key === \"Backspace\" && !context.query && context.values.length) {\n event.preventDefault();\n context.remove(context.values.at(-1) ?? \"\");\n } else if (event.key === \"ArrowDown\" || event.key === \"ArrowUp\") {\n event.preventDefault();\n if (!context.open) {\n context.setOpen(true);\n return;\n }\n context.moveActive(event.key === \"ArrowDown\" ? 1 : -1);\n } else if (event.key === \"Home\" && context.open) {\n event.preventDefault();\n context.moveActive(\"first\");\n } else if (event.key === \"End\" && context.open) {\n event.preventDefault();\n context.moveActive(\"last\");\n } else if (event.key === \"Enter\") {\n event.preventDefault();\n if (context.open) context.toggleActive();\n else context.setOpen(true);\n } else if (event.key === \"Escape\" && context.open) {\n event.preventDefault();\n context.setOpen(false, true);\n }\n };\n\n return (\n <div className=\"flex min-w-20 flex-1 items-center gap-1.5\">\n {showIcon ? <Search aria-hidden=\"true\" className=\"size-3.5 text-muted-foreground\" /> : null}\n <input\n {...props}\n ref={mergeRefs(ref, context.inputRef)}\n id={context.inputId}\n role=\"combobox\"\n aria-label={ariaLabel}\n aria-autocomplete=\"list\"\n aria-expanded={context.open}\n aria-controls={context.listId}\n aria-activedescendant={context.open ? context.activeItemId : undefined}\n autoComplete=\"off\"\n disabled={context.disabled}\n value={context.query}\n placeholder={context.values.length ? \"\" : placeholder}\n onPointerDown={(event) => {\n onPointerDown?.(event);\n if (event.defaultPrevented || context.open) return;\n context.setOpen(true);\n }}\n onFocus={(event) => {\n context.setOpen(true);\n onFocus?.(event);\n }}\n onClick={(event) => {\n context.setOpen(true);\n onClick?.(event);\n }}\n onChange={(event) => {\n context.setOpen(true);\n context.setQuery(event.target.value);\n onChange?.(event);\n }}\n onKeyDown={handleKeyDown}\n className={cn(\n \"h-7 min-w-12 flex-1 bg-transparent text-foreground text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed\",\n className,\n )}\n />\n </div>\n );\n}\n"],"mappings":";;;;;;;;AAoBA,SAAgB,mBAAmB,EAAE,UAAU,aAAsC;CACnF,MAAM,UAAU,sBAAsB,oBAAoB;CAE1D,OACE,qBAAC,OAAD;EACE,KAAK,QAAQ;EACb,IAAI,QAAQ;EACZ,cAAY,QAAQ,OAAO,SAAS;EACpC,gBAAgB,UAAU;GACxB,MAAM,SAAS,MAAM;GACrB,IACE,QAAQ,YACR,WAAW,QAAQ,SAAS,WAC5B,OAAO,QAAQ,4BAA4B,GAE3C;GAEF,MAAM,eAAe;GACrB,QAAQ,SAAS,SAAS,MAAM,EAAE,eAAe,KAAK,CAAC;GACvD,QAAQ,QAAQ,IAAI;EACtB;EACA,WAAW,GACT,kOACA,uDACA,QAAQ,YAAY,kCACpB,SACF;EAtBF,UAAA,CAwBE,oBAAC,OAAD;GAAK,WAAU;GAAsD;EA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AAQ,QAAQ,IAAI;EAC3B,OAAO,IAAI,MAAM,QAAQ,YAAY,QAAQ,MAAM;GACjD,MAAM,eAAe;GACrB,QAAQ,QAAQ,OAAO,IAAI;EAC7B;CACF;CAEA,OACE,qBAAC,OAAD;EAAK,WAAU;EAAf,UAAA,CACG,WAAW,oBAAC,QAAD;GAAQ,eAAY;GAAO,WAAU;EAAkC,CAAA,IAAI,MACvF,oBAAC,SAAD;GACE,GAAI;GACJ,KAAK,UAAU,KAAK,QAAQ,QAAQ;GACpC,IAAI,QAAQ;GACZ,MAAK;GACL,cAAY;GACZ,qBAAkB;GAClB,iBAAe,QAAQ;GACvB,iBAAe,QAAQ;GACvB,yBAAuB,QAAQ,OAAO,QAAQ,eAAe,KAAA;GAC7D,cAAa;GACb,UAAU,QAAQ;GAClB,OAAO,QAAQ;GACf,aAAa,QAAQ,OAAO,SAAS,KAAK;GAC1C,gBAAgB,UAAU;IACxB,gBAAgB,KAAK;IACrB,IAAI,MAAM,oBAAoB,QAAQ,MAAM;IAC5C,QAAQ,QAAQ,IAAI;GACtB;GACA,UAAU,UAAU;IAClB,QAAQ,QAAQ,IAAI;IACpB,UAAU,KAAK;GACjB;GACA,UAAU,UAAU;IAClB,QAAQ,QAAQ,IAAI;IACpB,UAAU,KAAK;GACjB;GACA,WAAW,UAAU;IACnB,QAAQ,QAAQ,IAAI;IACpB,QAAQ,SAAS,MAAM,OAAO,KAAK;IACnC,WAAW,KAAK;GAClB;GACA,WAAW;GACX,WAAW,GACT,yIACA,SACF;EACD,CAAA,CACE;;AAET"}
1
+ {"version":3,"file":"trigger.js","names":[],"sources":["../../../../src/components/motion/multi-select/trigger.tsx"],"sourcesContent":["\"use client\";\n\nimport type {\n InputHTMLAttributes,\n KeyboardEvent as ReactKeyboardEvent,\n ReactNode,\n Ref,\n} from \"react\";\nimport { ChevronsUpDown, Search, X } from \"lucide-react\";\nimport { AnimatePresence, motion } from \"motion/react\";\n\nimport { cn } from \"@kumix/utils\";\nimport { EASE_OUT, SPRING_LAYOUT, SPRING_SWAP } from \"../../../lib/ease\";\nimport { mergeRefs, useMultiSelectContext } from \"./context\";\n\nexport interface MultiSelectTriggerProps {\n children: ReactNode;\n className?: string;\n}\n\nexport function MultiSelectTrigger({ children, className }: MultiSelectTriggerProps) {\n const context = useMultiSelectContext(\"MultiSelectTrigger\");\n\n return (\n <div\n ref={context.triggerRef}\n id={context.triggerId}\n data-state={context.open ? \"open\" : \"closed\"}\n onPointerDown={(event) => {\n const target = event.target as HTMLElement;\n if (\n context.disabled ||\n target === context.inputRef.current ||\n target.closest(\"[data-multi-select-remove]\")\n ) {\n return;\n }\n event.preventDefault();\n context.inputRef.current?.focus({ preventScroll: true });\n context.setOpen(true);\n }}\n className={cn(\n \"relative z-20 flex min-h-11 w-full min-w-52 cursor-text items-center gap-2 rounded-xl border border-border bg-transparent px-2.5 py-1.5 text-foreground text-sm transition-[border-color] hover:border-(--color-border-strong)\",\n \"focus-within:ring-2 focus-within:ring-foreground/20\",\n context.disabled && \"pointer-events-none opacity-50\",\n className,\n )}\n >\n <div className=\"flex min-w-0 flex-1 flex-wrap items-center gap-1.5\">{children}</div>\n <ChevronsUpDown aria-hidden=\"true\" className=\"size-4 shrink-0 text-muted-foreground\" />\n </div>\n );\n}\n\nexport interface MultiSelectValueProps {\n placeholder?: ReactNode;\n children?: (value: string, label: string) => ReactNode;\n className?: string;\n chipClassName?: string;\n}\n\nexport function MultiSelectValue({\n placeholder = \"Select options\",\n children,\n className,\n chipClassName,\n}: MultiSelectValueProps) {\n const context = useMultiSelectContext(\"MultiSelectValue\");\n const showPlaceholder = context.values.length === 0 && !context.open;\n\n return (\n <div className={cn(\"contents\", className)}>\n <AnimatePresence initial={false} mode=\"popLayout\">\n {showPlaceholder ? (\n <span key=\"multi-select-placeholder\" className=\"text-muted-foreground\">\n {placeholder}\n </span>\n ) : null}\n {context.values.map((value) => {\n const label = context.labelFor(value);\n return (\n <motion.span\n layout={context.reduce ? false : \"position\"}\n key={`multi-select-value-${value}`}\n initial={{\n opacity: 0,\n clipPath: \"inset(0 0 0 0% round 0.5rem)\",\n transform: context.reduce\n ? \"translateY(0px) scale(1)\"\n : \"translateY(6px) scale(0.92)\",\n }}\n animate={{\n opacity: 1,\n clipPath: \"inset(0 0 0 0% round 0.5rem)\",\n transform: \"translateY(0px) scale(1)\",\n }}\n exit={{\n opacity: 1,\n clipPath: context.reduce\n ? \"inset(0 0 0 0% round 0.5rem)\"\n : \"inset(0 0 0 100% round 0.5rem)\",\n transform: \"translateY(0px) scale(1)\",\n transition: {\n clipPath: context.reduce ? { duration: 0 } : { duration: 0.16, ease: EASE_OUT },\n transform: { duration: 0 },\n },\n }}\n transition={\n context.reduce\n ? {\n layout: { duration: 0 },\n opacity: { duration: 0.15, ease: EASE_OUT },\n transform: { duration: 0 },\n }\n : {\n layout: SPRING_LAYOUT,\n opacity: { duration: 0.18, ease: EASE_OUT },\n transform: SPRING_SWAP,\n }\n }\n className={cn(\n \"inline-flex h-7 max-w-full items-center gap-1 rounded-lg bg-muted px-2 font-medium text-foreground text-xs\",\n chipClassName,\n )}\n >\n <span className=\"truncate\">{children ? children(value, label) : label}</span>\n <button\n type=\"button\"\n data-multi-select-remove=\"\"\n aria-label={`Remove ${label}`}\n disabled={context.disabled}\n onPointerDown={(event) => event.stopPropagation()}\n onClick={(event) => {\n event.stopPropagation();\n context.remove(value);\n context.inputRef.current?.focus({ preventScroll: true });\n }}\n className=\"-mr-1 grid size-5 shrink-0 place-items-center rounded-md text-muted-foreground outline-none transition-colors hover:bg-foreground/10 hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring\"\n >\n <X aria-hidden=\"true\" className=\"size-3\" />\n </button>\n </motion.span>\n );\n })}\n </AnimatePresence>\n </div>\n );\n}\n\nexport interface MultiSelectInputProps\n extends Omit<InputHTMLAttributes<HTMLInputElement>, \"defaultValue\" | \"value\"> {\n ref?: Ref<HTMLInputElement>;\n showIcon?: boolean;\n}\n\nexport function MultiSelectInput({\n ref,\n className,\n \"aria-label\": ariaLabel = \"Search options\",\n onChange,\n onClick,\n onFocus,\n onKeyDown,\n onPointerDown,\n placeholder = \"Search…\",\n showIcon = false,\n ...props\n}: MultiSelectInputProps) {\n const context = useMultiSelectContext(\"MultiSelectInput\");\n\n const handleKeyDown = (event: ReactKeyboardEvent<HTMLInputElement>) => {\n onKeyDown?.(event);\n if (event.defaultPrevented) return;\n\n if (event.key === \"Backspace\" && !context.query && context.values.length) {\n event.preventDefault();\n context.remove(context.values.at(-1) ?? \"\");\n } else if (event.key === \"ArrowDown\" || event.key === \"ArrowUp\") {\n event.preventDefault();\n if (!context.open) {\n context.setOpen(true);\n return;\n }\n context.moveActive(event.key === \"ArrowDown\" ? 1 : -1);\n } else if (event.key === \"Home\" && context.open) {\n event.preventDefault();\n context.moveActive(\"first\");\n } else if (event.key === \"End\" && context.open) {\n event.preventDefault();\n context.moveActive(\"last\");\n } else if (event.key === \"Enter\") {\n event.preventDefault();\n if (context.open) context.toggleActive();\n else context.setOpen(true);\n } else if (event.key === \"Escape\" && context.open) {\n event.preventDefault();\n context.setOpen(false, true);\n }\n };\n\n return (\n <div className=\"flex min-w-20 flex-1 items-center gap-1.5\">\n {showIcon ? <Search aria-hidden=\"true\" className=\"size-3.5 text-muted-foreground\" /> : null}\n <input\n {...props}\n ref={mergeRefs(ref, context.inputRef)}\n id={context.inputId}\n role=\"combobox\"\n aria-label={ariaLabel}\n aria-autocomplete=\"list\"\n aria-expanded={context.open}\n aria-controls={context.listId}\n aria-activedescendant={context.open ? context.activeItemId : undefined}\n autoComplete=\"off\"\n disabled={context.disabled}\n value={context.query}\n placeholder={context.values.length ? \"\" : placeholder}\n onPointerDown={(event) => {\n onPointerDown?.(event);\n if (event.defaultPrevented || context.open) return;\n context.setOpen(true);\n }}\n onFocus={(event) => {\n context.setOpen(true);\n onFocus?.(event);\n }}\n onClick={(event) => {\n context.setOpen(true);\n onClick?.(event);\n }}\n onChange={(event) => {\n context.setOpen(true);\n context.setQuery(event.target.value);\n onChange?.(event);\n }}\n onKeyDown={handleKeyDown}\n className={cn(\n \"h-7 min-w-12 flex-1 bg-transparent text-foreground text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed\",\n className,\n )}\n />\n </div>\n );\n}\n"],"mappings":";;;;;;;;AAoBA,SAAgB,mBAAmB,EAAE,UAAU,aAAsC;CACnF,MAAM,UAAU,sBAAsB,oBAAoB;CAE1D,OACE,qBAAC,OAAD;EACE,KAAK,QAAQ;EACb,IAAI,QAAQ;EACZ,cAAY,QAAQ,OAAO,SAAS;EACpC,gBAAgB,UAAU;GACxB,MAAM,SAAS,MAAM;GACrB,IACE,QAAQ,YACR,WAAW,QAAQ,SAAS,WAC5B,OAAO,QAAQ,4BAA4B,GAE3C;GAEF,MAAM,eAAe;GACrB,QAAQ,SAAS,SAAS,MAAM,EAAE,eAAe,KAAK,CAAC;GACvD,QAAQ,QAAQ,IAAI;EACtB;EACA,WAAW,GACT,kOACA,uDACA,QAAQ,YAAY,kCACpB,SACF;EAtBF,UAAA,CAwBE,oBAAC,OAAD;GAAK,WAAU;GAAsD;EAAc,CAAA,GACnF,oBAAC,gBAAD;GAAgB,eAAY;GAAO,WAAU;EAAyC,CAAA,CACnF;;AAET;AASA,SAAgB,iBAAiB,EAC/B,cAAc,kBACd,UACA,WACA,iBACwB;CACxB,MAAM,UAAU,sBAAsB,kBAAkB;CACxD,MAAM,kBAAkB,QAAQ,OAAO,WAAW,KAAK,CAAC,QAAQ;CAEhE,OACE,oBAAC,OAAD;EAAK,WAAW,GAAG,YAAY,SAAS;EACtC,UAAA,qBAAC,iBAAD;GAAiB,SAAS;GAAO,MAAK;GAAtC,UAAA,CACG,kBACC,oBAAC,QAAD;IAAqC,WAAU;IAC5C,UAAA;GACG,GAFI,0BAEJ,IACJ,MACH,QAAQ,OAAO,KAAK,UAAU;IAC7B,MAAM,QAAQ,QAAQ,SAAS,KAAK;IACpC,OACE,qBAAC,OAAO,MAAR;KACE,QAAQ,QAAQ,SAA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GAC1C,gBAAgB,UAAU;IACxB,gBAAgB,KAAK;IACrB,IAAI,MAAM,oBAAoB,QAAQ,MAAM;IAC5C,QAAQ,QAAQ,IAAI;GACtB;GACA,UAAU,UAAU;IAClB,QAAQ,QAAQ,IAAI;IACpB,UAAU,KAAK;GACjB;GACA,UAAU,UAAU;IAClB,QAAQ,QAAQ,IAAI;IACpB,UAAU,KAAK;GACjB;GACA,WAAW,UAAU;IACnB,QAAQ,QAAQ,IAAI;IACpB,QAAQ,SAAS,MAAM,OAAO,KAAK;IACnC,WAAW,KAAK;GAClB;GACA,WAAW;GACX,WAAW,GACT,yIACA,SACF;EACD,CAAA,CACE;;AAET"}
@@ -1 +1 @@
1
- {"version":3,"file":"magnetic.d.ts","names":[],"sources":["../../../../src/components/motion/not-found/magnetic.tsx"],"mappings":";;wBAOgB,mBACd,WACA,MACA,OACA,aACA,UACA,WACA,YACA,eACC,gCAAa,IAAA"}
1
+ {"version":3,"file":"magnetic.d.ts","names":[],"sources":["../../../../src/components/motion/not-found/magnetic.tsx"],"mappings":";;wBAMgB,mBACd,WACA,MACA,OACA,aACA,UACA,WACA,YACA,eACC,gCAAa,IAAA"}
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import { Magnetic } from "../magnetic.js";
3
3
  import { NOT_FOUND_DEFAULTS, NotFoundActions, NotFoundStage } from "./shared.js";
4
- import { cn } from "cn";
4
+ import { cn } from "@kumix/utils";
5
5
  import { jsx, jsxs } from "react/jsx-runtime";
6
6
  //#region src/components/motion/not-found/magnetic.tsx
7
7
  function NotFoundMagnetic({ className, code = NOT_FOUND_DEFAULTS.code, title = NOT_FOUND_DEFAULTS.title, description = NOT_FOUND_DEFAULTS.description, homeHref, homeLabel, browseHref, browseLabel }) {
@@ -1 +1 @@
1
- {"version":3,"file":"magnetic.js","names":[],"sources":["../../../../src/components/motion/not-found/magnetic.tsx"],"sourcesContent":["\"use client\";\n\nimport { cn } from \"cn\";\n\nimport { Magnetic } from \"../magnetic\";\nimport { NOT_FOUND_DEFAULTS, NotFoundActions, type NotFoundProps, NotFoundStage } from \"./shared\";\n\nexport function NotFoundMagnetic({\n className,\n code = NOT_FOUND_DEFAULTS.code,\n title = NOT_FOUND_DEFAULTS.title,\n description = NOT_FOUND_DEFAULTS.description,\n homeHref,\n homeLabel,\n browseHref,\n browseLabel,\n}: NotFoundProps) {\n const chars = code.split(\"\");\n\n return (\n <NotFoundStage className={className}>\n <h1\n aria-label={code}\n className=\"flex select-none items-center justify-center font-bold text-[clamp(5rem,18vw,12rem)] text-foreground leading-none tracking-tighter\"\n >\n {chars.map((ch, i) => (\n <Magnetic key={i} strength={0.6} className={cn(i > 0 && \"-ml-2\")}>\n <span aria-hidden className=\"inline-block px-1 tabular-nums\">\n {ch}\n </span>\n </Magnetic>\n ))}\n </h1>\n\n <div className=\"flex flex-col items-center gap-2\">\n <p className=\"font-semibold text-foreground text-lg\">{title}</p>\n <p className=\"max-w-sm text-muted-foreground text-sm\">{description}</p>\n </div>\n\n <NotFoundActions\n homeHref={homeHref}\n homeLabel={homeLabel}\n browseHref={browseHref}\n browseLabel={browseLabel}\n />\n </NotFoundStage>\n );\n}\n"],"mappings":";;;;;;AAOA,SAAgB,iBAAiB,EAC/B,WACA,OAAO,mBAAmB,MAC1B,QAAQ,mBAAmB,OAC3B,cAAc,mBAAmB,aACjC,UACA,WACA,YACA,eACgB;CAChB,MAAM,QAAQ,KAAK,MAAM,EAAE;CAE3B,OACE,qBAAC,eAAD;EAA0B;EAA1B,UAAA;GACE,oBAAC,MAAD;IACE,cAAY;IACZ,WAAU;IAET,UAAA,MAAM,KAAK,IAAI,MACd,oBAAC,UAAD;KAAkB,UAAU;KAAK,WAAW,GAAG,IAAI,KAAK,OAAO;KAC7D,UAAA,oBAAC,QAAD;MAAM,eAAA;MAAY,WAAU;MACzB,UAAA;KACG,CAAA;IACE,GAJK,CAIL,CACX;GACC,CAAA;GAEJ,qBAAC,OAAD;IAAK,WAAU;IAAf,UAAA,CACE,oBAAC,KAAD;KAAG,WAAU;KAAyC,UAAA;IAAS,CAAA,GAC/D,oBAAC,KAAD;KAAG,WAAU;KAA0C,UAAA;IAAe,CAAA,CACnE;;GAEL,oBAAC,iBAAD;IACY;IACC;IACC;IACC;GACd,CAAA;EACY;;AAEnB"}
1
+ {"version":3,"file":"magnetic.js","names":[],"sources":["../../../../src/components/motion/not-found/magnetic.tsx"],"sourcesContent":["\"use client\";\n\nimport { cn } from \"@kumix/utils\";\nimport { Magnetic } from \"../magnetic\";\nimport { NOT_FOUND_DEFAULTS, NotFoundActions, type NotFoundProps, NotFoundStage } from \"./shared\";\n\nexport function NotFoundMagnetic({\n className,\n code = NOT_FOUND_DEFAULTS.code,\n title = NOT_FOUND_DEFAULTS.title,\n description = NOT_FOUND_DEFAULTS.description,\n homeHref,\n homeLabel,\n browseHref,\n browseLabel,\n}: NotFoundProps) {\n const chars = code.split(\"\");\n\n return (\n <NotFoundStage className={className}>\n <h1\n aria-label={code}\n className=\"flex select-none items-center justify-center font-bold text-[clamp(5rem,18vw,12rem)] text-foreground leading-none tracking-tighter\"\n >\n {chars.map((ch, i) => (\n <Magnetic key={i} strength={0.6} className={cn(i > 0 && \"-ml-2\")}>\n <span aria-hidden className=\"inline-block px-1 tabular-nums\">\n {ch}\n </span>\n </Magnetic>\n ))}\n </h1>\n\n <div className=\"flex flex-col items-center gap-2\">\n <p className=\"font-semibold text-foreground text-lg\">{title}</p>\n <p className=\"max-w-sm text-muted-foreground text-sm\">{description}</p>\n </div>\n\n <NotFoundActions\n homeHref={homeHref}\n homeLabel={homeLabel}\n browseHref={browseHref}\n browseLabel={browseLabel}\n />\n </NotFoundStage>\n );\n}\n"],"mappings":";;;;;;AAMA,SAAgB,iBAAiB,EAC/B,WACA,OAAO,mBAAmB,MAC1B,QAAQ,mBAAmB,OAC3B,cAAc,mBAAmB,aACjC,UACA,WACA,YACA,eACgB;CAChB,MAAM,QAAQ,KAAK,MAAM,EAAE;CAE3B,OACE,qBAAC,eAAD;EAA0B;EAA1B,UAAA;GACE,oBAAC,MAAD;IACE,cAAY;IACZ,WAAU;IAET,UAAA,MAAM,KAAK,IAAI,MACd,oBAAC,UAAD;KAAkB,UAAU;KAAK,WAAW,GAAG,IAAI,KAAK,OAAO;KAC7D,UAAA,oBAAC,QAAD;MAAM,eAAA;MAAY,WAAU;MACzB,UAAA;KACG,CAAA;IACE,GAJK,CAIL,CACX;GACC,CAAA;GAEJ,qBAAC,OAAD;IAAK,WAAU;IAAf,UAAA,CACE,oBAAC,KAAD;KAAG,WAAU;KAAyC,UAAA;IAAS,CAAA,GAC/D,oBAAC,KAAD;KAAG,WAAU;KAA0C,UAAA;IAAe,CAAA,CACnE;;GAEL,oBAAC,iBAAD;IACY;IACC;IACC;IACC;GACd,CAAA;EACY;;AAEnB"}
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import { useHoverCapable } from "../../../hooks/use-hover-capable.js";
3
3
  import { SPRING_PRESS } from "../../../lib/ease.js";
4
- import { cn } from "cn";
4
+ import { cn } from "@kumix/utils";
5
5
  import { jsx, jsxs } from "react/jsx-runtime";
6
6
  import { motion, useReducedMotion } from "motion/react";
7
7
  //#region src/components/motion/not-found/shared.tsx
@@ -1 +1 @@
1
- {"version":3,"file":"shared.js","names":[],"sources":["../../../../src/components/motion/not-found/shared.tsx"],"sourcesContent":["\"use client\";\n\nimport { cn } from \"cn\";\nimport { motion, useReducedMotion } from \"motion/react\";\n\nimport { useHoverCapable } from \"../../../hooks/use-hover-capable\";\nimport { SPRING_PRESS } from \"../../../lib/ease\";\n\nexport interface NotFoundProps {\n className?: string;\n /** The big status code. */\n code?: string;\n title?: string;\n description?: string;\n homeHref?: string;\n homeLabel?: string;\n browseHref?: string;\n browseLabel?: string;\n}\n\nexport const NOT_FOUND_DEFAULTS = {\n code: \"404\",\n title: \"Page not found\",\n description: \"The page you are looking for moved, vanished, or never existed.\",\n homeHref: \"/\",\n homeLabel: \"Back home\",\n browseHref: \"/components/motion\",\n browseLabel: \"Browse components\",\n} as const;\n\ntype ActionsProps = Pick<\n NotFoundProps,\n \"homeHref\" | \"homeLabel\" | \"browseHref\" | \"browseLabel\" | \"className\"\n>;\n\n/** The shared dual CTA: a primary \"Back home\" and a secondary \"Browse\". */\nexport function NotFoundActions({\n homeHref = NOT_FOUND_DEFAULTS.homeHref,\n homeLabel = NOT_FOUND_DEFAULTS.homeLabel,\n browseHref = NOT_FOUND_DEFAULTS.browseHref,\n browseLabel = NOT_FOUND_DEFAULTS.browseLabel,\n className,\n}: ActionsProps) {\n const reduce = useReducedMotion();\n const canHover = useHoverCapable();\n const whileTap = reduce ? undefined : { scale: 0.96 };\n const whileHover = reduce || !canHover ? undefined : { scale: 1.02 };\n\n return (\n <div className={cn(\"flex flex-wrap items-center justify-center gap-3\", className)}>\n <motion.a\n href={homeHref}\n whileTap={whileTap}\n whileHover={whileHover}\n transition={SPRING_PRESS}\n className=\"inline-flex h-11 select-none items-center justify-center rounded-full bg-primary px-6 font-medium text-primary-foreground text-sm transition-colors hover:bg-primary/90\"\n >\n {homeLabel}\n </motion.a>\n <motion.a\n href={browseHref}\n whileTap={whileTap}\n whileHover={whileHover}\n transition={SPRING_PRESS}\n className=\"inline-flex h-11 select-none items-center justify-center rounded-full border border-border bg-card px-6 font-medium text-foreground text-sm transition-colors hover:bg-primary/5\"\n >\n {browseLabel}\n </motion.a>\n </div>\n );\n}\n\n/** Centers a variant and gives it a consistent minimum stage height. */\nexport function NotFoundStage({\n className,\n children,\n}: {\n className?: string;\n children: React.ReactNode;\n}) {\n return (\n <div\n className={cn(\n \"flex min-h-[420px] w-full flex-col items-center justify-center gap-8 px-4 text-center\",\n className,\n )}\n >\n {children}\n </div>\n );\n}\n"],"mappings":";;;;;;;AAoBA,MAAa,qBAAqB;CAChC,MAAM;CACN,OAAO;CACP,aAAa;CACb,UAAU;CACV,WAAW;CACX,YAAY;CACZ,aAAa;AACf;;AAQA,SAAgB,gBAAgB,EAC9B,WAAW,mBAAmB,UAC9B,YAAY,mBAAmB,WAC/B,aAAa,mBAAmB,YAChC,cAAc,mBAAmB,aACjC,aACe;CACf,MAAM,SAAS,iBAAiB;CAChC,MAAM,WAAW,gBAAgB;CACjC,MAAM,WAAW,SAAS,KAAA,IAAY,EAAE,OAAO,IAAK;CACpD,MAAM,aAAa,UAAU,CAAC,WAAW,KAAA,IAAY,EAAE,OAAO,KAAK;CAEnE,OACE,qBAAC,OAAD;EAAK,WAAW,GAAG,oDAAoD,SAAS;EAAhF,UAAA,CACE,oBAAC,OAAO,GAAR;GACE,MAAM;GACI;GACE;GACZ,YAAY;GACZ,WAAU;GAET,UAAA;EACO,CAAA,GACV,oBAAC,OAAO,GAAR;GACE,MAAM;GACI;GACE;GACZ,YAAY;GACZ,WAAU;GAET,UAAA;EACO,CAAA,CACP;;AAET;;AAGA,SAAgB,cAAc,EAC5B,WACA,YAIC;CACD,OACE,oBAAC,OAAD;EACE,WAAW,GACT,yFACA,SACF;EAEC;CACE,CAAA;AAET"}
1
+ {"version":3,"file":"shared.js","names":[],"sources":["../../../../src/components/motion/not-found/shared.tsx"],"sourcesContent":["\"use client\";\n\nimport { motion, useReducedMotion } from \"motion/react\";\n\nimport { cn } from \"@kumix/utils\";\nimport { useHoverCapable } from \"../../../hooks/use-hover-capable\";\nimport { SPRING_PRESS } from \"../../../lib/ease\";\n\nexport interface NotFoundProps {\n className?: string;\n /** The big status code. */\n code?: string;\n title?: string;\n description?: string;\n homeHref?: string;\n homeLabel?: string;\n browseHref?: string;\n browseLabel?: string;\n}\n\nexport const NOT_FOUND_DEFAULTS = {\n code: \"404\",\n title: \"Page not found\",\n description: \"The page you are looking for moved, vanished, or never existed.\",\n homeHref: \"/\",\n homeLabel: \"Back home\",\n browseHref: \"/components/motion\",\n browseLabel: \"Browse components\",\n} as const;\n\ntype ActionsProps = Pick<\n NotFoundProps,\n \"homeHref\" | \"homeLabel\" | \"browseHref\" | \"browseLabel\" | \"className\"\n>;\n\n/** The shared dual CTA: a primary \"Back home\" and a secondary \"Browse\". */\nexport function NotFoundActions({\n homeHref = NOT_FOUND_DEFAULTS.homeHref,\n homeLabel = NOT_FOUND_DEFAULTS.homeLabel,\n browseHref = NOT_FOUND_DEFAULTS.browseHref,\n browseLabel = NOT_FOUND_DEFAULTS.browseLabel,\n className,\n}: ActionsProps) {\n const reduce = useReducedMotion();\n const canHover = useHoverCapable();\n const whileTap = reduce ? undefined : { scale: 0.96 };\n const whileHover = reduce || !canHover ? undefined : { scale: 1.02 };\n\n return (\n <div className={cn(\"flex flex-wrap items-center justify-center gap-3\", className)}>\n <motion.a\n href={homeHref}\n whileTap={whileTap}\n whileHover={whileHover}\n transition={SPRING_PRESS}\n className=\"inline-flex h-11 select-none items-center justify-center rounded-full bg-primary px-6 font-medium text-primary-foreground text-sm transition-colors hover:bg-primary/90\"\n >\n {homeLabel}\n </motion.a>\n <motion.a\n href={browseHref}\n whileTap={whileTap}\n whileHover={whileHover}\n transition={SPRING_PRESS}\n className=\"inline-flex h-11 select-none items-center justify-center rounded-full border border-border bg-card px-6 font-medium text-foreground text-sm transition-colors hover:bg-primary/5\"\n >\n {browseLabel}\n </motion.a>\n </div>\n );\n}\n\n/** Centers a variant and gives it a consistent minimum stage height. */\nexport function NotFoundStage({\n className,\n children,\n}: {\n className?: string;\n children: React.ReactNode;\n}) {\n return (\n <div\n className={cn(\n \"flex min-h-[420px] w-full flex-col items-center justify-center gap-8 px-4 text-center\",\n className,\n )}\n >\n {children}\n </div>\n );\n}\n"],"mappings":";;;;;;;AAoBA,MAAa,qBAAqB;CAChC,MAAM;CACN,OAAO;CACP,aAAa;CACb,UAAU;CACV,WAAW;CACX,YAAY;CACZ,aAAa;AACf;;AAQA,SAAgB,gBAAgB,EAC9B,WAAW,mBAAmB,UAC9B,YAAY,mBAAmB,WAC/B,aAAa,mBAAmB,YAChC,cAAc,mBAAmB,aACjC,aACe;CACf,MAAM,SAAS,iBAAiB;CAChC,MAAM,WAAW,gBAAgB;CACjC,MAAM,WAAW,SAAS,KAAA,IAAY,EAAE,OAAO,IAAK;CACpD,MAAM,aAAa,UAAU,CAAC,WAAW,KAAA,IAAY,EAAE,OAAO,KAAK;CAEnE,OACE,qBAAC,OAAD;EAAK,WAAW,GAAG,oDAAoD,SAAS;EAAhF,UAAA,CACE,oBAAC,OAAO,GAAR;GACE,MAAM;GACI;GACE;GACZ,YAAY;GACZ,WAAU;GAET,UAAA;EACO,CAAA,GACV,oBAAC,OAAO,GAAR;GACE,MAAM;GACI;GACE;GACZ,YAAY;GACZ,WAAU;GAET,UAAA;EACO,CAAA,CACP;;AAET;;AAGA,SAAgB,cAAc,EAC5B,WACA,YAIC;CACD,OACE,oBAAC,OAAD;EACE,WAAW,GACT,yFACA,SACF;EAEC;CACE,CAAA;AAET"}
@@ -2,7 +2,7 @@
2
2
  import { useHoverCapable } from "../../../hooks/use-hover-capable.js";
3
3
  import { NOT_FOUND_DEFAULTS, NotFoundActions, NotFoundStage } from "./shared.js";
4
4
  import { useRef } from "react";
5
- import { cn } from "cn";
5
+ import { cn } from "@kumix/utils";
6
6
  import { jsx, jsxs } from "react/jsx-runtime";
7
7
  import { motion, useMotionTemplate, useMotionValue, useReducedMotion } from "motion/react";
8
8
  //#region src/components/motion/not-found/spotlight.tsx
@@ -1 +1 @@
1
- {"version":3,"file":"spotlight.js","names":[],"sources":["../../../../src/components/motion/not-found/spotlight.tsx"],"sourcesContent":["\"use client\";\n\nimport { useRef } from \"react\";\nimport { cn } from \"cn\";\nimport { motion, useMotionTemplate, useMotionValue, useReducedMotion } from \"motion/react\";\n\nimport { useHoverCapable } from \"../../../hooks/use-hover-capable\";\nimport { NOT_FOUND_DEFAULTS, NotFoundActions, type NotFoundProps, NotFoundStage } from \"./shared\";\n\nexport function NotFoundSpotlight({\n className,\n code = NOT_FOUND_DEFAULTS.code,\n title = NOT_FOUND_DEFAULTS.title,\n description = NOT_FOUND_DEFAULTS.description,\n homeHref,\n homeLabel,\n browseHref,\n browseLabel,\n}: NotFoundProps) {\n const ref = useRef<HTMLDivElement>(null);\n const reduce = useReducedMotion();\n const canHover = useHoverCapable();\n const enabled = !reduce && canHover;\n\n const mx = useMotionValue(50);\n const my = useMotionValue(50);\n const mask = useMotionTemplate`radial-gradient(220px circle at ${mx}% ${my}%, #000 25%, transparent 72%)`;\n\n const onMove = (e: React.MouseEvent<HTMLDivElement>) => {\n const el = ref.current;\n if (!el || !enabled) return;\n const rect = el.getBoundingClientRect();\n mx.set(((e.clientX - rect.left) / rect.width) * 100);\n my.set(((e.clientY - rect.top) / rect.height) * 100);\n };\n\n return (\n <NotFoundStage className={className}>\n <motion.div\n ref={ref}\n onMouseMove={onMove}\n className=\"relative isolate flex aspect-16/9 w-full max-w-xl items-center justify-center overflow-hidden rounded-3xl border border-border bg-neutral-950\"\n >\n {/* Dim base layer. */}\n <span\n aria-hidden\n className=\"select-none font-bold text-[clamp(5rem,16vw,10rem)] text-white/10 leading-none tracking-tighter\"\n >\n {code}\n </span>\n {/* Bright layer, revealed only under the spotlight. */}\n <motion.h1\n aria-label={code}\n style={enabled ? { WebkitMaskImage: mask, maskImage: mask } : undefined}\n className={cn(\n \"absolute select-none font-bold text-[clamp(5rem,16vw,10rem)] text-white leading-none tracking-tighter\",\n !enabled && \"text-white/90\",\n )}\n >\n <span aria-hidden>{code}</span>\n </motion.h1>\n </motion.div>\n\n <div className=\"flex flex-col items-center gap-2\">\n <p className=\"font-semibold text-foreground text-lg\">{title}</p>\n <p className=\"max-w-sm text-muted-foreground text-sm\">{description}</p>\n </div>\n\n <NotFoundActions\n homeHref={homeHref}\n homeLabel={homeLabel}\n browseHref={browseHref}\n browseLabel={browseLabel}\n />\n </NotFoundStage>\n );\n}\n"],"mappings":";;;;;;;;AASA,SAAgB,kBAAkB,EAChC,WACA,OAAO,mBAAmB,MAC1B,QAAQ,mBAAmB,OAC3B,cAAc,mBAAmB,aACjC,UACA,WACA,YACA,eACgB;CAChB,MAAM,MAAM,OAAuB,IAAI;CACvC,MAAM,SAAS,iBAAiB;CAChC,MAAM,WAAW,gBAAgB;CACjC,MAAM,UAAU,CAAC,UAAU;CAE3B,MAAM,KAAK,eAAe,EAAE;CAC5B,MAAM,KAAK,eAAe,EAAE;CAC5B,MAAM,OAAO,iBAAiB,mCAAmC,GAAG,IAAI,GAAG;CAE3E,MAAM,UAAU,MAAwC;EACtD,MAAM,KAAK,IAAI;EACf,IAAI,CAAC,MAAM,CAAC,SAAS;EACrB,MAAM,OAAO,GAAG,sBAAsB;EACtC,GAAG,KAAM,EAAE,UAAU,KAAK,QAAQ,KAAK,QAAS,GAAG;EACnD,GAAG,KAAM,EAAE,UAAU,KAAK,OAAO,KAAK,SAAU,GAAG;CACrD;CAEA,OACE,qBAAC,eAAD;EAA0B;EAA1B,UAAA;GACE,qBAAC,OAAO,KAAR;IACO;IACL,aAAa;IACb,WAAU;IAHZ,UAAA,CAME,oBAAC,QAAD;KACE,eAAA;KACA,WAAU;KAET,UAAA;IACG,CAAA,GAEN,oBAAC,OAAO,IAAR;KACE,cAAY;KACZ,OAAO,UAAU;MAAE,iBAAiB;MAAM,WAAW;KAAK,IAAI,KAAA;KAC9D,WAAW,GACT,yGACA,CAAC,WAAW,eACd;KAEA,UAAA,oBAAC,QAAD;MAAM,eAAA;MAAa,UAAA;KAAW,CAAA;IACrB,CAAA,CACD;;GAEZ,qBAAC,OAAD;IAAK,WAAU;IAAf,UAAA,CACE,oBAAC,KAAD;KAAG,WAAU;KAAyC,UAAA;IAAS,CAAA,GAC/D,oBAAC,KAAD;KAAG,WAAU;KAA0C,UAAA;IAAe,CAAA,CACnE;;GAEL,oBAAC,iBAAD;IACY;IACC;IACC;IACC;GACd,CAAA;EACY;;AAEnB"}
1
+ {"version":3,"file":"spotlight.js","names":[],"sources":["../../../../src/components/motion/not-found/spotlight.tsx"],"sourcesContent":["\"use client\";\n\nimport { useRef } from \"react\";\nimport { motion, useMotionTemplate, useMotionValue, useReducedMotion } from \"motion/react\";\n\nimport { cn } from \"@kumix/utils\";\nimport { useHoverCapable } from \"../../../hooks/use-hover-capable\";\nimport { NOT_FOUND_DEFAULTS, NotFoundActions, type NotFoundProps, NotFoundStage } from \"./shared\";\n\nexport function NotFoundSpotlight({\n className,\n code = NOT_FOUND_DEFAULTS.code,\n title = NOT_FOUND_DEFAULTS.title,\n description = NOT_FOUND_DEFAULTS.description,\n homeHref,\n homeLabel,\n browseHref,\n browseLabel,\n}: NotFoundProps) {\n const ref = useRef<HTMLDivElement>(null);\n const reduce = useReducedMotion();\n const canHover = useHoverCapable();\n const enabled = !reduce && canHover;\n\n const mx = useMotionValue(50);\n const my = useMotionValue(50);\n const mask = useMotionTemplate`radial-gradient(220px circle at ${mx}% ${my}%, #000 25%, transparent 72%)`;\n\n const onMove = (e: React.MouseEvent<HTMLDivElement>) => {\n const el = ref.current;\n if (!el || !enabled) return;\n const rect = el.getBoundingClientRect();\n mx.set(((e.clientX - rect.left) / rect.width) * 100);\n my.set(((e.clientY - rect.top) / rect.height) * 100);\n };\n\n return (\n <NotFoundStage className={className}>\n <motion.div\n ref={ref}\n onMouseMove={onMove}\n className=\"relative isolate flex aspect-16/9 w-full max-w-xl items-center justify-center overflow-hidden rounded-3xl border border-border bg-neutral-950\"\n >\n {/* Dim base layer. */}\n <span\n aria-hidden\n className=\"select-none font-bold text-[clamp(5rem,16vw,10rem)] text-white/10 leading-none tracking-tighter\"\n >\n {code}\n </span>\n {/* Bright layer, revealed only under the spotlight. */}\n <motion.h1\n aria-label={code}\n style={enabled ? { WebkitMaskImage: mask, maskImage: mask } : undefined}\n className={cn(\n \"absolute select-none font-bold text-[clamp(5rem,16vw,10rem)] text-white leading-none tracking-tighter\",\n !enabled && \"text-white/90\",\n )}\n >\n <span aria-hidden>{code}</span>\n </motion.h1>\n </motion.div>\n\n <div className=\"flex flex-col items-center gap-2\">\n <p className=\"font-semibold text-foreground text-lg\">{title}</p>\n <p className=\"max-w-sm text-muted-foreground text-sm\">{description}</p>\n </div>\n\n <NotFoundActions\n homeHref={homeHref}\n homeLabel={homeLabel}\n browseHref={brow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;IACY;IACC;IACC;IACC;GACd,CAAA;EACY;;AAEnB"}
@@ -5,7 +5,7 @@ import { useTapGesture } from "../../hooks/use-tap-gesture.js";
5
5
  import { EASE_OUT, SPRING_LAYOUT } from "../../lib/ease.js";
6
6
  import { ActionSwapText } from "./action-swap.js";
7
7
  import { useCallback, useRef, useState } from "react";
8
- import { cn } from "cn";
8
+ import { cn } from "@kumix/utils";
9
9
  import { jsx, jsxs } from "react/jsx-runtime";
10
10
  import { motion, useReducedMotion } from "motion/react";
11
11
  import { ArrowUpRight, BellOff } from "lucide-react";
@@ -1 +1 @@
1
- {"version":3,"file":"notification-stack.js","names":[],"sources":["../../../src/components/motion/notification-stack.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n type FocusEvent,\n type KeyboardEvent,\n type PointerEvent,\n type ReactNode,\n useCallback,\n useRef,\n useState,\n} from \"react\";\nimport { cn } from \"cn\";\nimport { ArrowUpRight, BellOff } from \"lucide-react\";\nimport { 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\";\nimport { EASE_OUT, SPRING_LAYOUT } from \"../../lib/ease\";\nimport { ActionSwapText } from \"./action-swap\";\n\nexport type NotificationStackItem = {\n id: string;\n title: ReactNode;\n description?: ReactNode;\n trailing?: ReactNode;\n};\n\nexport type NotificationStackClassNames = {\n stack?: string;\n card?: string;\n content?: string;\n title?: string;\n description?: string;\n trailing?: string;\n footer?: string;\n count?: string;\n};\n\nexport interface NotificationStackProps {\n items: NotificationStackItem[];\n expanded?: boolean;\n defaultExpanded?: boolean;\n onExpandedChange?: (expanded: boolean) => void;\n onViewAll?: () => void;\n maxVisible?: number;\n collapsedLabel?: string;\n expandedLabel?: string;\n emptyLabel?: string;\n className?: string;\n classNames?: NotificationStackClassNames;\n}\n\nconst STACK_PEEK = 8;\nconst STACK_INSET = 12;\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);\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\nfunction NotificationCardContent({\n item,\n classNames,\n}: {\n item: NotificationStackItem;\n classNames?: NotificationStackClassNames;\n}) {\n return (\n <span className={cn(\"flex min-w-0 flex-col gap-1.5 py-4\", classNames?.content)}>\n <span className=\"flex min-w-0 items-start justify-between gap-3\">\n <span className={cn(\"min-w-0 font-medium text-sm leading-snug\", classNames?.title)}>\n {item.title}\n </span>\n {item.trailing ? (\n <span className={cn(\"shrink-0 text-xs\", classNames?.trailing)}>{item.trailing}</span>\n ) : null}\n </span>\n {item.description ? (\n <span\n className={cn(\"text-muted-foreground text-xs leading-relaxed\", classNames?.description)}\n >\n {item.description}\n </span>\n ) : null}\n </span>\n );\n}\n\nexport function NotificationStack({\n items,\n expanded,\n defaultExpanded = false,\n onExpandedChange,\n onViewAll,\n maxVisible = 3,\n collapsedLabel = \"Notifications\",\n expandedLabel = \"View all\",\n emptyLabel = \"All caught up\",\n className,\n classNames,\n}: NotificationStackProps) {\n const reduce = useReducedMotion();\n const hasFocus = useRef(false);\n const rootRef = useRef<HTMLButtonElement>(null);\n const hover = useHoverGesture();\n // What the last gesture on the stack was, and whether it was already\n // expanded when that gesture started. A click reports neither.\n const tap = useTapGesture<boolean>();\n const [isExpanded, setIsExpanded] = useControllableExpanded({\n expanded,\n defaultExpanded,\n onExpandedChange,\n });\n // Set by the tap that expands the stack, 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\n const collapse = useCallback(() => {\n setTapExpanded(false);\n setIsExpanded(false);\n }, [setIsExpanded]);\n\n // A pointer leaving the stack is what collapses it, and a finger never\n // leaves: without this the stack stays open for good once tapped, and when\n // `onViewAll` is set the next tap follows the link instead of closing. The\n // tap that lands somewhere else stands in for the pointer leaving, and it is\n // consumed rather than passed through — the expanded stack covers the page,\n // so the tap that dismisses it is aimed at nothing else.\n useDismiss(tapExpanded && isExpanded, collapse, rootRef, {\n behavior: \"consume\",\n });\n\n const visibleItems = items.slice(0, Math.max(1, maxVisible));\n const primaryItem = visibleItems[0];\n const transition: Transition = reduce ? { duration: 0 } : SPRING_LAYOUT;\n const cardTransition: Transition = reduce ? { duration: 0 } : { duration: 0.32, ease: EASE_OUT };\n const backgroundTransition: Transition = reduce\n ? { duration: 0 }\n : { duration: 0.26, ease: EASE_OUT };\n\n if (!primaryItem) {\n return (\n <div\n className={cn(\n \"flex w-full max-w-[22rem] items-center justify-center gap-2 rounded-3xl bg-muted/70 px-5 py-8 font-medium text-muted-foreground text-sm\",\n className,\n )}\n >\n <BellOff className=\"h-4 w-4\" aria-hidden=\"true\" />\n {emptyLabel}\n </div>\n );\n }\n\n const handleBlur = (event: FocusEvent<HTMLButtonElement>) => {\n if (event.currentTarget.contains(event.relatedTarget)) return;\n hasFocus.current = false;\n collapse();\n };\n\n const handleKeyDown = (event: KeyboardEvent<HTMLButtonElement>) => {\n // A key press is the start of a keyboard activation, never part of a tap:\n // whatever a taken-away gesture left behind must not be read as one.\n tap.drop();\n if (event.key !== \"Escape\") return;\n event.preventDefault();\n collapse();\n // Focus stays where the keyboard put it. Blurring here collapsed the stack\n // *and* threw the user back to the top of the document.\n };\n\n const handleClick = () => {\n const gesture = tap.take();\n // Read from where the gesture started, not from now: a browser that\n // focuses the stack on contact expands it mid-tap, and the first tap would\n // then follow `onViewAll` instead of opening the list it was meant to.\n const wasExpanded = gesture ? gesture.state : isExpanded;\n\n if (!wasExpanded) {\n setIsExpanded(true);\n if (gesture && gesture.pointerType !== \"mouse\") setTapExpanded(true);\n return;\n }\n\n if (onViewAll) {\n onViewAll();\n return;\n }\n\n collapse();\n };\n\n return (\n <motion.button\n ref={rootRef}\n type=\"button\"\n initial={false}\n aria-expanded={isExpanded}\n aria-label={\n isExpanded\n ? `${items.length} notifications. ${expandedLabel}.`\n : `${items.length} notifications. Expand notifications.`\n }\n // A tap reports as a hover on its way past — enter, leave, then click —\n // so an unfiltered hover path expands, collapses and expands again in\n // the space of one tap, springs and all. The tap has its own route\n // through `handleClick`.\n onPointerEnter={(event: PointerEvent<HTMLButtonElement>) => {\n if (hover.enter(event)) setIsExpanded(true);\n }}\n onPointerLeave={(event: PointerEvent<HTMLButtonElement>) => {\n if (hover.leave(event) && !hasFocus.current) collapse();\n }}\n onPointerDown={(event: PointerEvent<HTMLButtonElement>) => {\n tap.start(event, isExpanded);\n }}\n // The platform can take the gesture away mid-press — a scroll, a system\n // swipe — and no click follows it.\n onPointerCancel={tap.drop}\n onFocus={() => {\n hasFocus.current = true;\n setIsExpanded(true);\n }}\n onBlur={handleBlur}\n onKeyDown={handleKeyDown}\n onClick={handleClick}\n className={cn(\n \"relative z-10 block w-full max-w-[22rem] cursor-pointer rounded-3xl text-left text-foreground outline-none\",\n \"focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background\",\n className,\n )}\n >\n {/* This invisible first card gives the button its compact intrinsic footprint. */}\n <span aria-hidden=\"true\" className=\"invisible block p-3\">\n <span className=\"block\">\n <span\n className={cn(\"block rounded-2xl border border-transparent px-4\", classNames?.card)}\n >\n <NotificationCardContent item={primaryItem} classNames={classNames} />\n </span>\n </span>\n <span className=\"mt-2 block h-9\" />\n </span>\n\n <span className=\"absolute inset-x-0 bottom-0 block p-3\">\n <motion.span\n aria-hidden=\"true\"\n layout\n initial={false}\n transition={backgroundTransition}\n className=\"absolute inset-0 rounded-3xl bg-muted\"\n />\n <span className={cn(\"relative z-10 grid gap-1\", !isExpanded && \"pb-2\", classNames?.stack)}>\n {visibleItems.map((item, index) => {\n const isPrimary = index === 0;\n\n return (\n <motion.span\n key={item.id}\n layout=\"position\"\n initial={false}\n animate={{\n y: isExpanded ? 0 : index * STACK_PEEK,\n clipPath: isExpanded\n ? \"inset(0px 0px round 16px)\"\n : `inset(0px ${index * STACK_INSET}px round 16px)`,\n }}\n transition={cardTransition}\n className={cn(\n \"block rounded-2xl border border-border/60 bg-background px-4\",\n classNames?.card,\n )}\n style={{\n zIndex: visibleItems.length - index,\n gridColumn: 1,\n gridRow: isExpanded ? index + 1 : 1,\n }}\n >\n <span className={cn(\"block\", !isPrimary && !isExpanded && \"invisible\")}>\n <NotificationCardContent item={item} classNames={classNames} />\n </span>\n </motion.span>\n );\n })}\n </span>\n\n <motion.span\n layout=\"position\"\n transition={transition}\n className={cn(\n \"relative z-10 mt-2 flex min-h-9 items-center gap-2 px-1\",\n classNames?.footer,\n )}\n >\n <span\n className={cn(\n \"grid size-7 shrink-0 place-items-center rounded-full bg-orange-600 font-medium text-white text-xs shadow-[inset_0_1px_2px_rgb(0_0_0/0.2),inset_0_-1px_0_rgb(255_255_255/0.16)] dark:bg-orange-500\",\n classNames?.count,\n )}\n >\n {items.length}\n </span>\n <span className=\"flex items-center font-medium text-sm\">\n <ActionSwapText value={isExpanded ? \"expanded\" : \"collapsed\"} animation=\"roll\">\n {isExpanded ? (\n <span className=\"inline-flex items-center gap-1\">\n {expandedLabel}\n <ArrowUpRight className=\"size-4\" aria-hidden=\"true\" />\n </span>\n ) : (\n collapsedLabel\n )}\n </ActionSwapText>\n </span>\n </motion.span>\n </span>\n </motion.button>\n );\n}\n"],"mappings":";;;;;;;;;;;;AAqDA,MAAM,aAAa;AACnB,MAAM,cAAc;AAEpB,SAAS,wBAAwB,EAC/B,UACA,iBACA,oBAKC;CACD,MAAM,CAAC,kBAAkB,uBAAuB,SAAS,eAAe;CACxE,MAAM,eAAe,aAAa,KAAA;CAWlC,OAAO,CAVO,YAAY,kBAET,aACd,SAAkB;EACjB,IAAI,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,GACT,qMACA,YAAY,KACd;MAEC,UAAA,MAAM;KACH,CAAA,GACN,oBAAC,QAAD;MAAM,WAAU;MACd,UAAA,oBAAC,gBAAD;OAAgB,OAAO,aAAa,aAAa;OAAa,WAAU;OACrE,UAAA,aACC,qBAAC,QAAD;QAAM,WAAU;QAAhB,UAAA,CACG,eACD,oBAAC,cAAD;SAAc,WAAU;SAAS,eAAY;QAAQ,CAAA,CACjD;OAEN,CAAA,IAAA;MAEY,CAAA;KACZ,CAAA,CACK;;GACT;EACO,CAAA,CAAA;;AAEnB"}
1
+ {"version":3,"file":"notification-stack.js","names":[],"sources":["../../../src/components/motion/notification-stack.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n type FocusEvent,\n type KeyboardEvent,\n type PointerEvent,\n type ReactNode,\n useCallback,\n useRef,\n useState,\n} from \"react\";\nimport { ArrowUpRight, BellOff } from \"lucide-react\";\nimport { 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\";\nimport { EASE_OUT, SPRING_LAYOUT } from \"../../lib/ease\";\nimport { ActionSwapText } from \"./action-swap\";\n\nexport type NotificationStackItem = {\n id: string;\n title: ReactNode;\n description?: ReactNode;\n trailing?: ReactNode;\n};\n\nexport type NotificationStackClassNames = {\n stack?: string;\n card?: string;\n content?: string;\n title?: string;\n description?: string;\n trailing?: string;\n footer?: string;\n count?: string;\n};\n\nexport interface NotificationStackProps {\n items: NotificationStackItem[];\n expanded?: boolean;\n defaultExpanded?: boolean;\n onExpandedChange?: (expanded: boolean) => void;\n onViewAll?: () => void;\n maxVisible?: number;\n collapsedLabel?: string;\n expandedLabel?: string;\n emptyLabel?: string;\n className?: string;\n classNames?: NotificationStackClassNames;\n}\n\nconst STACK_PEEK = 8;\nconst STACK_INSET = 12;\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);\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\nfunction NotificationCardContent({\n item,\n classNames,\n}: {\n item: NotificationStackItem;\n classNames?: NotificationStackClassNames;\n}) {\n return (\n <span className={cn(\"flex min-w-0 flex-col gap-1.5 py-4\", classNames?.content)}>\n <span className=\"flex min-w-0 items-start justify-between gap-3\">\n <span className={cn(\"min-w-0 font-medium text-sm leading-snug\", classNames?.title)}>\n {item.title}\n </span>\n {item.trailing ? (\n <span className={cn(\"shrink-0 text-xs\", classNames?.trailing)}>{item.trailing}</span>\n ) : null}\n </span>\n {item.description ? (\n <span\n className={cn(\"text-muted-foreground text-xs leading-relaxed\", classNames?.description)}\n >\n {item.description}\n </span>\n ) : null}\n </span>\n );\n}\n\nexport function NotificationStack({\n items,\n expanded,\n defaultExpanded = false,\n onExpandedChange,\n onViewAll,\n maxVisible = 3,\n collapsedLabel = \"Notifications\",\n expandedLabel = \"View all\",\n emptyLabel = \"All caught up\",\n className,\n classNames,\n}: NotificationStackProps) {\n const reduce = useReducedMotion();\n const hasFocus = useRef(false);\n const rootRef = useRef<HTMLButtonElement>(null);\n const hover = useHoverGesture();\n // What the last gesture on the stack was, and whether it was already\n // expanded when that gesture started. A click reports neither.\n const tap = useTapGesture<boolean>();\n const [isExpanded, setIsExpanded] = useControllableExpanded({\n expanded,\n defaultExpanded,\n onExpandedChange,\n });\n // Set by the tap that expands the stack, 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\n const collapse = useCallback(() => {\n setTapExpanded(false);\n setIsExpanded(false);\n }, [setIsExpanded]);\n\n // A pointer leaving the stack is what collapses it, and a finger never\n // leaves: without this the stack stays open for good once tapped, and when\n // `onViewAll` is set the next tap follows the link instead of closing. The\n // tap that lands somewhere else stands in for the pointer leaving, and it is\n // consumed rather than passed through — the expanded stack covers the page,\n // so the tap that dismisses it is aimed at nothing else.\n useDismiss(tapExpanded && isExpanded, collapse, rootRef, {\n behavior: \"consume\",\n });\n\n const visibleItems = items.slice(0, Math.max(1, maxVisible));\n const primaryItem = visibleItems[0];\n const transition: Transition = reduce ? { duration: 0 } : SPRING_LAYOUT;\n const cardTransition: Transition = reduce ? { duration: 0 } : { duration: 0.32, ease: EASE_OUT };\n const backgroundTransition: Transition = reduce\n ? { duration: 0 }\n : { duration: 0.26, ease: EASE_OUT };\n\n if (!primaryItem) {\n return (\n <div\n className={cn(\n \"flex w-full max-w-[22rem] items-center justify-center gap-2 rounded-3xl bg-muted/70 px-5 py-8 font-medium text-muted-foreground text-sm\",\n className,\n )}\n >\n <BellOff className=\"h-4 w-4\" aria-hidden=\"true\" />\n {emptyLabel}\n </div>\n );\n }\n\n const handleBlur = (event: FocusEvent<HTMLButtonElement>) => {\n if (event.currentTarget.contains(event.relatedTarget)) return;\n hasFocus.current = false;\n collapse();\n };\n\n const handleKeyDown = (event: KeyboardEvent<HTMLButtonElement>) => {\n // A key press is the start of a keyboard activation, never part of a tap:\n // whatever a taken-away gesture left behind must not be read as one.\n tap.drop();\n if (event.key !== \"Escape\") return;\n event.preventDefault();\n collapse();\n // Focus stays where the keyboard put it. Blurring here collapsed the stack\n // *and* threw the user back to the top of the document.\n };\n\n const handleClick = () => {\n const gesture = tap.take();\n // Read from where the gesture started, not from now: a browser that\n // focuses the stack on contact expands it mid-tap, and the first tap would\n // then follow `onViewAll` instead of opening the list it was meant to.\n const wasExpanded = gesture ? gesture.state : isExpanded;\n\n if (!wasExpanded) {\n setIsExpanded(true);\n if (gesture && gesture.pointerType !== \"mouse\") setTapExpanded(true);\n return;\n }\n\n if (onViewAll) {\n onViewAll();\n return;\n }\n\n collapse();\n };\n\n return (\n <motion.button\n ref={rootRef}\n type=\"button\"\n initial={false}\n aria-expanded={isExpanded}\n aria-label={\n isExpanded\n ? `${items.length} notifications. ${expandedLabel}.`\n : `${items.length} notifications. Expand notifications.`\n }\n // A tap reports as a hover on its way past — enter, leave, then click —\n // so an unfiltered hover path expands, collapses and expands again in\n // the space of one tap, springs and all. The tap has its own route\n // through `handleClick`.\n onPointerEnter={(event: PointerEvent<HTMLButtonElement>) => {\n if (hover.enter(event)) setIsExpanded(true);\n }}\n onPointerLeave={(event: PointerEvent<HTMLButtonElement>) => {\n if (hover.leave(event) && !hasFocus.current) collapse();\n }}\n onPointerDown={(event: PointerEvent<HTMLButtonElement>) => {\n tap.start(event, isExpanded);\n }}\n // The platform can take the gesture away mid-press — a scroll, a system\n // swipe — and no click follows it.\n onPointerCancel={tap.drop}\n onFocus={() => {\n hasFocus.current = true;\n setIsExpanded(true);\n }}\n onBlur={handleBlur}\n onKeyDown={handleKeyDown}\n onClick={handleClick}\n className={cn(\n \"relative z-10 block w-full max-w-[22rem] cursor-pointer rounded-3xl text-left text-foreground outline-none\",\n \"focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background\",\n className,\n )}\n >\n {/* This invisible first card gives the button its compact intrinsic footprint. */}\n <span aria-hidden=\"true\" className=\"invisible block p-3\">\n <span className=\"block\">\n <span\n className={cn(\"block rounded-2xl border border-transparent px-4\", classNames?.card)}\n >\n <NotificationCardContent item={primaryItem} classNames={classNames} />\n </span>\n </span>\n <span className=\"mt-2 block h-9\" />\n </span>\n\n <span className=\"absolute inset-x-0 bottom-0 block p-3\">\n <motion.span\n aria-hidden=\"true\"\n layout\n initial={false}\n transition={backgroundTransition}\n className=\"absolute inset-0 rounded-3xl bg-muted\"\n />\n <span className={cn(\"relative z-10 grid gap-1\", !isExpanded && \"pb-2\", classNames?.stack)}>\n {visibleItems.map((item, index) => {\n const isPrimary = index === 0;\n\n return (\n <motion.span\n key={item.id}\n layout=\"position\"\n initial={false}\n animate={{\n y: isExpanded ? 0 : index * STACK_PEEK,\n clipPath: isExpanded\n ? \"inset(0px 0px round 16px)\"\n : `inset(0px ${index * STACK_INSET}px round 16px)`,\n }}\n transition={cardTransition}\n className={cn(\n \"block rounded-2xl border border-border/60 bg-background px-4\",\n classNames?.card,\n )}\n style={{\n zIndex: visibleItems.length - index,\n gridColumn: 1,\n gridRow: isExpanded ? index + 1 : 1,\n }}\n >\n <span className={cn(\"block\", !isPrimary && !isExpanded && \"invisible\")}>\n <NotificationCardContent item={item} classNames={classNames} />\n </span>\n </motion.span>\n );\n })}\n </span>\n\n <motion.span\n layout=\"position\"\n transition={transition}\n className={cn(\n \"relative z-10 mt-2 flex min-h-9 items-center gap-2 px-1\",\n classNames?.footer,\n )}\n >\n <span\n className={cn(\n \"grid size-7 shrink-0 place-items-center rounded-full bg-orange-600 font-medium text-white text-xs shadow-[inset_0_1px_2px_rgb(0_0_0/0.2),inset_0_-1px_0_rgb(255_255_255/0.16)] dark:bg-orange-500\",\n classNames?.count,\n )}\n >\n {items.length}\n </span>\n <span className=\"flex items-center font-medium text-sm\">\n <ActionSwapText value={isExpanded ? \"expanded\" : \"collapsed\"} animation=\"roll\">\n {isExpanded ? (\n <span className=\"inline-flex items-center gap-1\">\n {expandedLabel}\n <ArrowUpRight className=\"size-4\" aria-hidden=\"true\" />\n </span>\n ) : (\n collapsedLabel\n )}\n </ActionSwapText>\n </span>\n </motion.span>\n </span>\n </motion.button>\n );\n}\n"],"mappings":";;;;;;;;;;;;AAqDA,MAAM,aAAa;AACnB,MAAM,cAAc;AAEpB,SAAS,wBAAwB,EAC/B,UACA,iBACA,oBAKC;CACD,MAAM,CAAC,kBAAkB,uBAAuB,SAAS,eAAe;CACxE,MAAM,eAAe,aAAa,KAAA;CAWlC,OAAO,CAVO,YAAY,kBAET,aACd,SAAkB;EACjB,IAAI,CAAC,cAAc,o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AAY,KACd;MAEC,UAAA,MAAM;KACH,CAAA,GACN,oBAAC,QAAD;MAAM,WAAU;MACd,UAAA,oBAAC,gBAAD;OAAgB,OAAO,aAAa,aAAa;OAAa,WAAU;OACrE,UAAA,aACC,qBAAC,QAAD;QAAM,WAAU;QAAhB,UAAA,CACG,eACD,oBAAC,cAAD;SAAc,WAAU;SAAS,eAAY;QAAQ,CAAA,CACjD;OAEN,CAAA,IAAA;MAEY,CAAA;KACZ,CAAA,CACK;;GACT;EACO,CAAA,CAAA;;AAEnB"}
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import { EASE_OUT } from "../../lib/ease.js";
3
3
  import { useEffect, useMemo, useRef, useState } from "react";
4
- import { cn } from "cn";
4
+ import { cn } from "@kumix/utils";
5
5
  import { jsx, jsxs } from "react/jsx-runtime";
6
6
  import { animate, motion, useInView, useReducedMotion } from "motion/react";
7
7
  //#region src/components/motion/number-ticker.tsx
@@ -1 +1 @@
1
- {"version":3,"file":"number-ticker.js","names":[],"sources":["../../../src/components/motion/number-ticker.tsx"],"sourcesContent":["\"use client\";\n\nimport { useEffect, useMemo, useRef, useState } from \"react\";\nimport { cn } from \"cn\";\nimport { animate, motion, useInView, useReducedMotion } from \"motion/react\";\n\nimport { EASE_OUT } from \"../../lib/ease\";\n\nexport interface NumberTickerProps {\n value: number;\n /** Digits to pad to (left). */\n pad?: number;\n /** Per-digit roll duration in seconds. */\n duration?: number;\n /** Stagger between digits. */\n stagger?: number;\n /** Render only after the element enters the viewport. */\n startOnView?: boolean;\n prefix?: string;\n suffix?: string;\n /** Add a small blur during digit rolls. */\n blur?: boolean;\n className?: string;\n digitClassName?: string;\n /** Insert locale group separators (commas). Server-component safe. */\n locale?: boolean;\n /** Custom formatter. Client-only — server components must use `locale` instead. */\n format?: (value: number) => string;\n}\n\nconst DIGIT_HEIGHT_EM = 1.1;\nconst DIGITS = Array.from({ length: 10 }, (_, n) => n);\n\nexport function NumberTicker({\n value,\n pad,\n duration = 0.9,\n stagger = 0.04,\n startOnView = true,\n prefix,\n suffix,\n blur = false,\n className,\n digitClassName,\n locale,\n format,\n}: NumberTickerProps) {\n const containerRef = useRef<HTMLSpanElement>(null);\n const inView = useInView(containerRef, { once: true, amount: 0.6 });\n const [armed, setArmed] = useState(!startOnView);\n\n useEffect(() => {\n if (startOnView && inView) setArmed(true);\n }, [startOnView, inView]);\n\n const text = useMemo(() => {\n const rounded = Math.round(value);\n const formatted = format\n ? format(rounded)\n : locale\n ? rounded.toLocaleString()\n : rounded.toString();\n return pad ? formatted.padStart(pad, \"0\") : formatted;\n }, [value, pad, format, locale]);\n const glyphs = useMemo(() => {\n const chars = text.split(\"\");\n // Key by place value (position from the right): a changing digit keeps its\n // identity and rolls to the new value instead of remounting and replaying\n // from 0. Growing numbers add glyphs on the left without re-keying the\n // ones, tens, hundreds already on screen.\n return chars.map((char, i) => ({ char, id: `g-${chars.length - 1 - i}` }));\n }, [text]);\n const readableText = `${prefix ?? \"\"}${text}${suffix ?? \"\"}`;\n\n // Stagger is an entrance flourish. Once the reveal has played, value\n // changes roll every digit immediately — a per-digit delay on live updates\n // reads as lag.\n const [entered, setEntered] = useState(false);\n useEffect(() => {\n if (!armed || entered) return;\n const total = (duration + glyphs.length * stagger) * 1000;\n const t = window.setTimeout(() => setEntered(true), total);\n return () => window.clearTimeout(t);\n }, [armed, entered, duration, stagger, glyphs.length]);\n\n return (\n <span ref={containerRef} className={cn(\"inline-flex items-center tabular-nums\", className)}>\n <span className=\"sr-only\">{readableText}</span>\n <span aria-hidden=\"true\" className=\"inline-flex items-center\">\n {prefix ? <span>{prefix}</span> : null}\n {glyphs.map(({ char, id }, i) => {\n const isDigit = /\\d/.test(char);\n if (!isDigit) {\n return (\n <span key={id} className=\"inline-block\">\n {char}\n </span>\n );\n }\n const digit = Number(char);\n return (\n <Digit\n key={id}\n digit={armed ? digit : 0}\n delay={entered ? 0 : i * stagger}\n duration={duration}\n blur={blur}\n className={digitClassName}\n />\n );\n })}\n {suffix ? <span>{suffix}</span> : null}\n </span>\n </span>\n );\n}\n\nfunction Digit({\n digit,\n delay,\n duration,\n blur,\n className,\n}: {\n digit: number;\n delay: number;\n duration: number;\n blur: boolean;\n className?: string;\n}) {\n const reduce = useReducedMotion();\n const columnRef = useRef<HTMLSpanElement>(null);\n\n useEffect(() => {\n if (reduce || !blur || !columnRef.current || !Number.isFinite(digit)) {\n return;\n }\n\n const node = columnRef.current;\n const controls = animate(\n node,\n { filter: [\"blur(10px)\", \"blur(0px)\"] },\n {\n duration: Math.min(duration * 0.75, 0.32),\n delay,\n ease: EASE_OUT,\n },\n );\n\n return () => {\n controls.stop();\n node.style.filter = \"blur(0px)\";\n };\n }, [blur, delay, digit, duration, reduce]);\n\n return (\n <span\n className={cn(\"relative inline-block overflow-hidden\", className)}\n style={{ height: `${DIGIT_HEIGHT_EM}em`, width: \"1ch\" }}\n >\n <motion.span\n ref={columnRef}\n initial={{ y: 0 }}\n animate={{ y: `-${digit * DIGIT_HEIGHT_EM}em` }}\n transition={reduce ? { duration: 0 } : { duration, delay, ease: EASE_OUT }}\n className=\"absolute inset-x-0 top-0 flex flex-col items-center will-change-[transform,filter]\"\n >\n {DIGITS.map((n) => (\n <span key={n} className=\"flex h-[1.1em] items-center justify-center leading-none\">\n {n}\n </span>\n ))}\n </motion.span>\n </span>\n );\n}\n"],"mappings":";;;;;;;AA8BA,MAAM,kBAAkB;AACxB,MAAM,SAAS,MAAM,KAAK,EAAE,QAAQ,GAAG,IAAI,GAAG,MAAM,CAAC;AAErD,SAAgB,aAAa,EAC3B,OACA,KACA,WAAW,IACX,UAAU,KACV,cAAc,MACd,QACA,QACA,OAAO,OACP,WACA,gBACA,QACA,UACoB;CACpB,MAAM,eAAe,OAAwB,IAAI;CACjD,MAAM,SAAS,UAAU,cAAc;EAAE,MAAM;EAAM,QAAQ;CAAI,CAAC;CAClE,MAAM,CAAC,OAAO,YAAY,SAAS,CAAC,WAAW;CAE/C,gBAAgB;EACd,IAAI,eAAe,QAAQ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AC,OAAD;MAEE,OAAO,QAAQ,QAAQ;MACvB,OAAO,UAAU,IAAI,IAAI;MACf;MACJ;MACN,WAAW;KACZ,GANM,EAMN;IAEL,CAAC;IACA,SAAS,oBAAC,QAAD,EAAA,UAAO,OAAa,CAAA,IAAI;GAC9B;EACF,CAAA,CAAA;;AAEV;AAEA,SAAS,MAAM,EACb,OACA,OACA,UACA,MACA,aAOC;CACD,MAAM,SAAS,iBAAiB;CAChC,MAAM,YAAY,OAAwB,IAAI;CAE9C,gBAAgB;EACd,IAAI,UAAU,CAAC,QAAQ,CAAC,UAAU,WAAW,CAAC,OAAO,SAAS,KAAK,GACjE;EAGF,MAAM,OAAO,UAAU;EACvB,MAAM,WAAW,QACf,MACA,EAAE,QAAQ,CAAC,cAAc,WAAW,EAAE,GACtC;GACE,UAAU,KAAK,IAAI,WAAW,KAAM,GAAI;GACxC;GACA,MAAM;EACR,CACF;EAEA,aAAa;GACX,SAAS,KAAK;GACd,KAAK,MAAM,SAAS;EACtB;CACF,GAAG;EAAC;EAAM;EAAO;EAAO;EAAU;CAAM,CAAC;CAEzC,OACE,oBAAC,QAAD;EACE,WAAW,GAAG,yCAAyC,SAAS;EAChE,OAAO;GAAE,QAAQ,GAAG,gBAAgB;GAAK,OAAO;EAAM;EAEtD,UAAA,oBAAC,OAAO,MAAR;GACE,KAAK;GACL,SAAS,EAAE,GAAG,EAAE;GAChB,SAAS,EAAE,GAAG,IAAI,QAAQ,gBAAgB,IAAI;GAC9C,YAAY,SAAS,EAAE,UAAU,EAAE,IAAI;IAAE;IAAU;IAAO,MAAM;GAAS;GACzE,WAAU;GAET,UAAA,OAAO,KAAK,MACX,oBAAC,QAAD;IAAc,WAAU;IACrB,UAAA;GACG,GAFK,CAEL,CACP;EACU,CAAA;CACT,CAAA;AAEV"}
1
+ {"version":3,"file":"number-ticker.js","names":[],"sources":["../../../src/components/motion/number-ticker.tsx"],"sourcesContent":["\"use client\";\n\nimport { useEffect, useMemo, useRef, useState } from \"react\";\nimport { animate, motion, useInView, useReducedMotion } from \"motion/react\";\n\nimport { cn } from \"@kumix/utils\";\nimport { EASE_OUT } from \"../../lib/ease\";\n\nexport interface NumberTickerProps {\n value: number;\n /** Digits to pad to (left). */\n pad?: number;\n /** Per-digit roll duration in seconds. */\n duration?: number;\n /** Stagger between digits. */\n stagger?: number;\n /** Render only after the element enters the viewport. */\n startOnView?: boolean;\n prefix?: string;\n suffix?: string;\n /** Add a small blur during digit rolls. */\n blur?: boolean;\n className?: string;\n digitClassName?: string;\n /** Insert locale group separators (commas). Server-component safe. */\n locale?: boolean;\n /** Custom formatter. Client-only — server components must use `locale` instead. */\n format?: (value: number) => string;\n}\n\nconst DIGIT_HEIGHT_EM = 1.1;\nconst DIGITS = Array.from({ length: 10 }, (_, n) => n);\n\nexport function NumberTicker({\n value,\n pad,\n duration = 0.9,\n stagger = 0.04,\n startOnView = true,\n prefix,\n suffix,\n blur = false,\n className,\n digitClassName,\n locale,\n format,\n}: NumberTickerProps) {\n const containerRef = useRef<HTMLSpanElement>(null);\n const inView = useInView(containerRef, { once: true, amount: 0.6 });\n const [armed, setArmed] = useState(!startOnView);\n\n useEffect(() => {\n if (startOnView && inView) setArmed(true);\n }, [startOnView, inView]);\n\n const text = useMemo(() => {\n const rounded = Math.round(value);\n const formatted = format\n ? format(rounded)\n : locale\n ? rounded.toLocaleString()\n : rounded.toString();\n return pad ? formatted.padStart(pad, \"0\") : formatted;\n }, [value, pad, format, locale]);\n const glyphs = useMemo(() => {\n const chars = text.split(\"\");\n // Key by place value (position from the right): a changing digit keeps its\n // identity and rolls to the new value instead of remounting and replaying\n // from 0. Growing numbers add glyphs on the left without re-keying the\n // ones, tens, hundreds already on screen.\n return chars.map((char, i) => ({ char, id: `g-${chars.length - 1 - i}` }));\n }, [text]);\n const readableText = `${prefix ?? \"\"}${text}${suffix ?? \"\"}`;\n\n // Stagger is an entrance flourish. Once the reveal has played, value\n // changes roll every digit immediately — a per-digit delay on live updates\n // reads as lag.\n const [entered, setEntered] = useState(false);\n useEffect(() => {\n if (!armed || entered) return;\n const total = (duration + glyphs.length * stagger) * 1000;\n const t = window.setTimeout(() => setEntered(true), total);\n return () => window.clearTimeout(t);\n }, [armed, entered, duration, stagger, glyphs.length]);\n\n return (\n <span ref={containerRef} className={cn(\"inline-flex items-center tabular-nums\", className)}>\n <span className=\"sr-only\">{readableText}</span>\n <span aria-hidden=\"true\" className=\"inline-flex items-center\">\n {prefix ? <span>{prefix}</span> : null}\n {glyphs.map(({ char, id }, i) => {\n const isDigit = /\\d/.test(char);\n if (!isDigit) {\n return (\n <span key={id} className=\"inline-block\">\n {char}\n </span>\n );\n }\n const digit = Number(char);\n return (\n <Digit\n key={id}\n digit={armed ? digit : 0}\n delay={entered ? 0 : i * stagger}\n duration={duration}\n blur={blur}\n className={digitClassName}\n />\n );\n })}\n {suffix ? <span>{suffix}</span> : null}\n </span>\n </span>\n );\n}\n\nfunction Digit({\n digit,\n delay,\n duration,\n blur,\n className,\n}: {\n digit: number;\n delay: number;\n duration: number;\n blur: boolean;\n className?: string;\n}) {\n const reduce = useReducedMotion();\n const columnRef = useRef<HTMLSpanElement>(null);\n\n useEffect(() => {\n if (reduce || !blur || !columnRef.current || !Number.isFinite(digit)) {\n return;\n }\n\n const node = columnRef.current;\n const controls = animate(\n node,\n { filter: [\"blur(10px)\", \"blur(0px)\"] },\n {\n duration: Math.min(duration * 0.75, 0.32),\n delay,\n ease: EASE_OUT,\n },\n );\n\n return () => {\n controls.stop();\n node.style.filter = \"blur(0px)\";\n };\n }, [blur, delay, digit, duration, reduce]);\n\n return (\n <span\n className={cn(\"relative inline-block overflow-hidden\", className)}\n style={{ height: `${DIGIT_HEIGHT_EM}em`, width: \"1ch\" }}\n >\n <motion.span\n ref={columnRef}\n initial={{ y: 0 }}\n animate={{ y: `-${digit * DIGIT_HEIGHT_EM}em` }}\n transition={reduce ? { duration: 0 } : { duration, delay, ease: EASE_OUT }}\n className=\"absolute inset-x-0 top-0 flex flex-col items-center will-change-[transform,filter]\"\n >\n {DIGITS.map((n) => (\n <span key={n} className=\"flex h-[1.1em] items-center justify-center leading-none\">\n {n}\n </span>\n ))}\n </motion.span>\n </span>\n );\n}\n"],"mappings":";;;;;;;AA8BA,MAAM,kBAAkB;AACxB,MAAM,SAAS,MAAM,KAAK,EAAE,QAAQ,GAAG,IAAI,GAAG,MAAM,CAAC;AAErD,SAAgB,aAAa,EAC3B,OACA,KACA,WAAW,IACX,UAAU,KACV,cAAc,MACd,QACA,QACA,OAAO,OACP,WACA,gBACA,QACA,UACoB;CACpB,MAAM,eAAe,OAAwB,IAAI;CACjD,MAAM,SAAS,UAAU,cAAc;EAAE,MAAM;EAAM,QAAQ;CAAI,CAAC;CAClE,MAAM,CAAC,OAAO,YAAY,SAAS,CAAC,WAAW;CAE/C,gBAAgB;EACd,IAAI,eAAe,QAAQ,SAAS,IAAI;CAC1C,GAAG,CAAC,aAAa,MAAM,CAAC;CAExB,MAAM,OAAO,cAAc;EACzB,MAAM,UAAU,KAAK,MAAM,KAAK;EAChC,MAAM,YAAY,SACd,OAAO,OAAO,IACd,SACE,QAAQ,eAAe,IACvB,QAAQ,SAAS;EACvB,OAAO,MAAM,UAAU,SAAS,KAAK,GAAG,IAAI;CAC9C,GAAG;EAAC;EAAO;EAAK;EAAQ;CAAM,CAAC;CAC/B,MAAM,SAAS,cAAc;EAC3B,MAAM,QAAQ,KAAK,MAAM,EAAE;EAK3B,OAAO,MAAM,KAAK,MAAM,OAAO;GAAE;GAAM,IAAI,KAAK,MAAM,SAAS,IAAI;EAAI,EAAE;CAC3E,GAAG,CAAC,IAAI,CAAC;CACT,MAAM,eAAe,GAAG,UAAU,KAAK,OAAO,UAAU;CAKxD,MAAM,CAAC,SAAS,cAAc,SAAS,KAAK;CAC5C,gBAAgB;EACd,IAAI,CAAC,SAAS,SAAS;EACvB,MAAM,SAAS,WAAW,OAAO,SAAS,WAAW;EACrD,MAAM,IAAI,OAAO,iBAAiB,WAAW,IAAI,GAAG,KAA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WAAW,GAAG,yCAAyC,SAAS;EAChE,OAAO;GAAE,QAAQ,GAAG,gBAAgB;GAAK,OAAO;EAAM;EAEtD,UAAA,oBAAC,OAAO,MAAR;GACE,KAAK;GACL,SAAS,EAAE,GAAG,EAAE;GAChB,SAAS,EAAE,GAAG,IAAI,QAAQ,gBAAgB,IAAI;GAC9C,YAAY,SAAS,EAAE,UAAU,EAAE,IAAI;IAAE;IAAU;IAAO,MAAM;GAAS;GACzE,WAAU;GAET,UAAA,OAAO,KAAK,MACX,oBAAC,QAAD;IAAc,WAAU;IACrB,UAAA;GACG,GAFK,CAEL,CACP;EACU,CAAA;CACT,CAAA;AAEV"}
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import { EASE_OUT } from "../../lib/ease.js";
3
3
  import { useEffect, useId, useRef, useState } from "react";
4
- import { cn } from "cn";
4
+ import { cn } from "@kumix/utils";
5
5
  import { jsx, jsxs } from "react/jsx-runtime";
6
6
  import { AnimatePresence, animate, motion, useReducedMotion } from "motion/react";
7
7
  //#region src/components/motion/otp-input.tsx
@@ -1 +1 @@
1
- {"version":3,"file":"otp-input.js","names":[],"sources":["../../../src/components/motion/otp-input.tsx"],"sourcesContent":["\"use client\";\n\nimport { useEffect, useId, useRef, useState } from \"react\";\nimport { cn } from \"cn\";\nimport { AnimatePresence, animate, motion, useReducedMotion } from \"motion/react\";\n\nimport { EASE_OUT } from \"../../lib/ease\";\n\nexport type OTPStatus = \"idle\" | \"error\" | \"success\";\n\nexport interface OTPInputProps {\n /** Number of slots. Default 6. */\n length?: number;\n value?: string;\n defaultValue?: string;\n onChange?: (value: string) => void;\n /** Fires once every slot is filled. */\n onComplete?: (value: string) => void;\n /** Optional label rendered above the slots. */\n label?: string;\n /** Helper text shown below the slots while idle. */\n hint?: string;\n /** Message shown below the slots when status is \"success\". */\n successMessage?: string;\n /** Message shown below the slots when status is \"error\". */\n errorMessage?: string;\n /** External validation feedback. \"error\" shakes, \"success\" draws a check. */\n status?: OTPStatus;\n /** Render dots instead of the typed digits. */\n mask?: boolean;\n disabled?: boolean;\n autoFocus?: boolean;\n /** Accessible label for the underlying input. */\n \"aria-label\"?: string;\n className?: string;\n}\n\nexport function OTPInput({\n length = 6,\n value: controlledValue,\n defaultValue = \"\",\n onChange,\n onComplete,\n label,\n hint,\n successMessage,\n errorMessage,\n status = \"idle\",\n mask = false,\n disabled = false,\n autoFocus = false,\n \"aria-label\": ariaLabel = \"One-time passcode\",\n className,\n}: OTPInputProps) {\n const uid = useId();\n const reduce = useReducedMotion();\n const inputRef = useRef<HTMLInputElement>(null);\n const slotsRef = useRef<HTMLDivElement>(null);\n\n const controlled = controlledValue !== undefined;\n\n // Source of truth is a fixed-length array, so a cleared middle slot stays an\n // in-place hole instead of collapsing the digits after it to the left.\n const [slots, setSlots] = useState<string[]>(() =>\n toSlots(controlled ? controlledValue : defaultValue, length),\n );\n const [focused, setFocused] = useState(false);\n const [active, setActive] = useState(0);\n\n const joined = slots.join(\"\");\n const joinedRef = useRef(joined);\n\n useEffect(() => {\n joinedRef.current = joined;\n }, [joined]);\n\n // Pull in external value changes; skip when the parent is just echoing our own\n // onChange, so internal holes survive the controlled round-trip.\n useEffect(() => {\n if (!controlled) return;\n const incoming = sanitize(controlledValue, length);\n if (incoming !== joinedRef.current) setSlots(toSlots(incoming, length));\n }, [controlled, controlledValue, length]);\n\n const commit = (next: string[]) => {\n const wasComplete = slots.every((c) => c !== \"\");\n setSlots(next);\n const str = next.join(\"\");\n onChange?.(str);\n // Fire only on the empty→full transition, not on every edit of a full code.\n if (!wasComplete && next.every((c) => c !== \"\")) onComplete?.(str);\n };\n\n const clearSlot = (idx: number) => {\n const next = [...slots];\n next[idx] = \"\";\n commit(next);\n };\n\n const slotFromClientX = (clientX: number) => {\n const els = slotsRef.current?.children;\n if (!els) return 0;\n for (let i = 0; i < els.length; i++) {\n if (clientX < els[i].getBoundingClientRect().right) return i;\n }\n return length - 1;\n };\n\n // Single insertion path: one digit overwrites the active slot and advances; a\n // multi-digit chunk (paste / SMS autofill) fills forward from the active slot.\n const insert = (raw: string, from = active) => {\n const digits = raw.replace(/\\D/g, \"\");\n if (!digits) return;\n const next = [...slots];\n let i = from;\n for (const ch of digits) {\n if (i >= length) break;\n next[i] = ch;\n i++;\n }\n commit(next);\n setActive(Math.min(i, length - 1));\n };\n\n // The keyboard is the single source of truth: preventDefault on keydown\n // reliably blocks native insertion (unlike beforeinput in React), so the hidden\n // input never accumulates a competing string and slot holes survive.\n const onKeyDown = (e: React.KeyboardEvent<HTMLInputElement>) => {\n if (disabled || e.metaKey || e.ctrlKey || e.altKey) return;\n const k = e.key;\n if (/^[0-9]$/.test(k)) {\n e.preventDefault();\n insert(k);\n } else if (k === \"Backspace\") {\n e.preventDefault();\n // A filled slot clears in place; an empty slot steps back and clears there.\n if (slots[active]) {\n clearSlot(active);\n } else if (active > 0) {\n clearSlot(active - 1);\n setActive((current) => Math.max(current - 1, 0));\n }\n } else if (k === \"Delete\") {\n e.preventDefault();\n clearSlot(active);\n } else if (k === \"ArrowLeft\") {\n e.preventDefault();\n setActive((a) => Math.max(a - 1, 0));\n } else if (k === \"ArrowRight\") {\n e.preventDefault();\n setActive((a) => Math.min(a + 1, length - 1));\n } else if (k === \"Home\") {\n e.preventDefault();\n setActive(0);\n } else if (k === \"End\") {\n e.preventDefault();\n setActive(length - 1);\n }\n };\n\n const onPaste = (e: React.ClipboardEvent<HTMLInputElement>) => {\n if (disabled) return;\n // preventDefault suppresses the duplicate onChange, keeping that path autofill-only.\n e.preventDefault();\n insert(e.clipboardData.getData(\"text\"), active);\n };\n\n // Autofill path: SMS one-time-code arrives as a whole value in one shot.\n // Keystrokes go through onKeyDown and paste through onPaste, so only autofill\n // reaches here — spread it across the slots from the start.\n const onChangeNative = (e: React.ChangeEvent<HTMLInputElement>) => {\n const digits = sanitize(e.target.value, length);\n if (!digits) return;\n commit(toSlots(digits, length));\n setActive(Math.min(digits.length, length - 1));\n };\n\n // Error shake — imperative so it replays on every transition into \"error\".\n useEffect(() => {\n if (status !== \"error\" || reduce || !slotsRef.current) return;\n animate(slotsRef.current, { x: [0, -5, 5, -3, 3, -1, 0] }, { duration: 0.45, ease: EASE_OUT });\n }, [status, reduce]);\n\n const showSuccess = status === \"success\";\n const activeIndex = focused ? active : -1;\n const message = showSuccess ? successMessage : status === \"error\" ? errorMessage : hint;\n\n return (\n <div className={cn(\"inline-flex flex-col gap-2\", className)}>\n {label ? (\n <label htmlFor={`${uid}-input`} className=\"font-medium text-foreground text-sm\">\n {label}\n </label>\n ) : null}\n <fieldset\n className=\"relative m-0 inline-flex w-max border-0 p-0\"\n onMouseDown={(e) => {\n if (disabled) return;\n // Suppress the native click-caret; we drive the active slot ourselves.\n e.preventDefault();\n // Clamp to the first empty slot so a click can't jump ahead of progress.\n const firstEmpty = slots.indexOf(\"\");\n const cap = firstEmpty === -1 ? length - 1 : firstEmpty;\n setActive(Math.min(slotFromClientX(e.clientX), cap));\n inputRef.current?.focus();\n }}\n >\n <input\n ref={inputRef}\n id={`${uid}-input`}\n inputMode=\"numeric\"\n autoComplete=\"one-time-code\"\n autoFocus={autoFocus}\n disabled={disabled}\n aria-label={ariaLabel}\n aria-invalid={status === \"error\"}\n // Kept empty on purpose — our state owns the digits, native holds none.\n value=\"\"\n maxLength={length}\n onKeyDown={onKeyDown}\n onChange={onChangeNative}\n onPaste={onPaste}\n onFocus={() => setFocused(true)}\n onBlur={() => setFocused(false)}\n // Transparent overlay owns focus, the soft keyboard, paste and autofill;\n // the slots below are purely presentational.\n className=\"absolute inset-0 z-20 h-full w-full cursor-text bg-transparent text-transparent caret-transparent opacity-0 outline-none disabled:cursor-not-allowed\"\n />\n\n <div ref={slotsRef} className=\"flex items-center gap-2\">\n {Array.from({ length }, (_, i) => {\n const char = slots[i] ?? \"\";\n const isActive = i === activeIndex;\n return (\n <div\n key={`${uid}-${i}`}\n data-active={isActive}\n data-filled={char !== \"\"}\n className={cn(\n \"relative grid h-14 w-12 place-items-center overflow-hidden rounded-xl border font-semibold text-xl tabular-nums transition-colors duration-200\",\n showSuccess\n ? \"border-emerald-500/60 text-foreground\"\n : status === \"error\"\n ? \"border-destructive/60 text-foreground\"\n : char\n ? \"border-border-strong text-foreground\"\n : \"border-border text-muted-foreground\",\n // Active slot reads stronger; twMerge lets this win the border.\n isActive && !showSuccess && status !== \"error\" && \"border-foreground\",\n disabled && \"opacity-50\",\n )}\n >\n {/* Blinking caret marks the active slot — centered when empty,\n trailing the digit when the slot is already filled. */}\n {isActive && !showSuccess ? (\n <motion.span\n aria-hidden\n animate={reduce ? undefined : { opacity: [1, 1, 0, 0] }}\n transition={\n reduce\n ? undefined\n : { duration: 1, repeat: Number.POSITIVE_INFINITY, ease: \"linear\" }\n }\n className={cn(\n \"pointer-events-none absolute top-1/2 h-6 w-px -translate-y-1/2 bg-foreground\",\n char ? \"right-3\" : \"left-1/2 -translate-x-1/2\",\n )}\n />\n ) : null}\n\n {/* Digits roll vertically. Each is absolutely centered so enter and\n exit overlap in place — no in-flow reflow, no sideways drift. */}\n <AnimatePresence initial={false}>\n {char ? (\n <motion.span\n key={char}\n initial={reduce ? { opacity: 0 } : { y: 14, opacity: 0, filter: \"blur(4px)\" }}\n animate={reduce ? { opacity: 1 } : { y: 0, opacity: 1, filter: \"blur(0px)\" }}\n exit={reduce ? { opacity: 0 } : { y: -14, opacity: 0, filter: \"blur(4px)\" }}\n transition={reduce ? { duration: 0 } : { duration: 0.22, ease: EASE_OUT }}\n className=\"absolute inset-0 grid place-items-center leading-none\"\n >\n {mask ? \"•\" : char}\n </motion.span>\n ) : null}\n </AnimatePresence>\n </div>\n );\n })}\n </div>\n\n <AnimatePresence>\n {showSuccess ? (\n <motion.span\n initial={reduce ? { opacity: 0 } : { scale: 0.6, opacity: 0 }}\n animate={reduce ? { opacity: 1 } : { scale: 1, opacity: 1 }}\n exit={reduce ? { opacity: 0 } : { scale: 0.6, opacity: 0 }}\n transition={\n reduce ? { duration: 0 } : { type: \"spring\", stiffness: 500, damping: 28 }\n }\n className=\"pointer-events-none absolute top-1/2 -right-7 -translate-y-1/2 text-emerald-500\"\n aria-hidden\n >\n <svg\n width=\"20\"\n height=\"20\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth={3}\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n >\n <title>Verified</title>\n <motion.path\n d=\"M5 13l4 4L19 7\"\n initial={reduce ? { pathLength: 1 } : { pathLength: 0 }}\n animate={{ pathLength: 1 }}\n transition={\n reduce ? { duration: 0 } : { duration: 0.35, ease: EASE_OUT, delay: 0.1 }\n }\n />\n </svg>\n </motion.span>\n ) : null}\n </AnimatePresence>\n </fieldset>\n\n {message ? (\n <p\n aria-live=\"polite\"\n className={cn(\n \"text-sm\",\n showSuccess\n ? \"text-emerald-500\"\n : status === \"error\"\n ? \"text-destructive\"\n : \"text-muted-foreground\",\n )}\n >\n {message}\n </p>\n ) : null}\n </div>\n );\n}\n\nfunction sanitize(raw: string, length: number) {\n return raw.replace(/\\D/g, \"\").slice(0, length);\n}\n\nfunction toSlots(raw: string, length: number) {\n const digits = sanitize(raw, length);\n return Array.from({ length }, (_, i) => digits[i] ?? \"\");\n}\n"],"mappings":";;;;;;;AAqCA,SAAgB,SAAS,EACvB,SAAS,GACT,OAAO,iBACP,eAAe,IACf,UACA,YACA,OACA,MACA,gBACA,cACA,SAAS,QACT,OAAO,OACP,WAAW,OACX,YAAY,OACZ,cAAc,YAAY,qBAC1B,aACgB;CAChB,MAAM,MAAM,MAAM;CAClB,MAAM,SAAS,iBAAiB;CAChC,MAAM,WAAW,OAAyB,IAAI;CAC9C,MAAM,WAAW,OAAuB,IAAI;CAE5C,MAAM,aAAa,oBAAoB,KAAA;CAIvC,MAAM,CAAC,OAAO,YAAY,eACxB,QAAQ,aAAa,kBAAkB,cAAc,MAAM,CAC7D;CACA,MAAM,CAAC,SAAS,cAAc,SAAS,KAAK;CAC5C,MAAM,CAAC,QAAQ,aAAa,SAAS,CAAC;CAEtC,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ARjB,UAAA,CAUE,oBAAC,SAAD,EAAA,UAAO,WAAe,CAAA,GACtB,oBAAC,OAAO,MAAR;QACE,GAAE;QACF,SAAS,SAAS,EAAE,YAAY,EAAE,IAAI,EAAE,YAAY,EAAE;QACtD,SAAS,EAAE,YAAY,EAAE;QACzB,YACE,SAAS,EAAE,UAAU,EAAE,IAAI;SAAE,UAAU;SAAM,MAAM;SAAU,OAAO;QAAI;OAE3E,CAAA,CACE;;KACM,CAAA,IACX,KACW,CAAA;IACT;;GAET,UACC,oBAAC,KAAD;IACE,aAAU;IACV,WAAW,GACT,WACA,cACI,qBACA,WAAW,UACT,qBACA,uBACR;IAEC,UAAA;GACA,CAAA,IACD;EACD;;AAET;AAEA,SAAS,SAAS,KAAa,QAAgB;CAC7C,OAAO,IAAI,QAAQ,OAAO,EAAE,CAAC,CAAC,MAAM,GAAG,MAAM;AAC/C;AAEA,SAAS,QAAQ,KAAa,QAAgB;CAC5C,MAAM,SAAS,SAAS,KAAK,MAAM;CACnC,OAAO,MAAM,KAAK,EAAE,OAAO,IAAI,GAAG,MAAM,OAAO,MAAM,EAAE;AACzD"}
1
+ {"version":3,"file":"otp-input.js","names":[],"sources":["../../../src/components/motion/otp-input.tsx"],"sourcesContent":["\"use client\";\n\nimport { useEffect, useId, useRef, useState } from \"react\";\nimport { AnimatePresence, animate, motion, useReducedMotion } from \"motion/react\";\n\nimport { cn } from \"@kumix/utils\";\nimport { EASE_OUT } from \"../../lib/ease\";\n\nexport type OTPStatus = \"idle\" | \"error\" | \"success\";\n\nexport interface OTPInputProps {\n /** Number of slots. Default 6. */\n length?: number;\n value?: string;\n defaultValue?: string;\n onChange?: (value: string) => void;\n /** Fires once every slot is filled. */\n onComplete?: (value: string) => void;\n /** Optional label rendered above the slots. */\n label?: string;\n /** Helper text shown below the slots while idle. */\n hint?: string;\n /** Message shown below the slots when status is \"success\". */\n successMessage?: string;\n /** Message shown below the slots when status is \"error\". */\n errorMessage?: string;\n /** External validation feedback. \"error\" shakes, \"success\" draws a check. */\n status?: OTPStatus;\n /** Render dots instead of the typed digits. */\n mask?: boolean;\n disabled?: boolean;\n autoFocus?: boolean;\n /** Accessible label for the underlying input. */\n \"aria-label\"?: string;\n className?: string;\n}\n\nexport function OTPInput({\n length = 6,\n value: controlledValue,\n defaultValue = \"\",\n onChange,\n onComplete,\n label,\n hint,\n successMessage,\n errorMessage,\n status = \"idle\",\n mask = false,\n disabled = false,\n autoFocus = false,\n \"aria-label\": ariaLabel = \"One-time passcode\",\n className,\n}: OTPInputProps) {\n const uid = useId();\n const reduce = useReducedMotion();\n const inputRef = useRef<HTMLInputElement>(null);\n const slotsRef = useRef<HTMLDivElement>(null);\n\n const controlled = controlledValue !== undefined;\n\n // Source of truth is a fixed-length array, so a cleared middle slot stays an\n // in-place hole instead of collapsing the digits after it to the left.\n const [slots, setSlots] = useState<string[]>(() =>\n toSlots(controlled ? controlledValue : defaultValue, length),\n );\n const [focused, setFocused] = useState(false);\n const [active, setActive] = useState(0);\n\n const joined = slots.join(\"\");\n const joinedRef = useRef(joined);\n\n useEffect(() => {\n joinedRef.current = joined;\n }, [joined]);\n\n // Pull in external value changes; skip when the parent is just echoing our own\n // onChange, so internal holes survive the controlled round-trip.\n useEffect(() => {\n if (!controlled) return;\n const incoming = sanitize(controlledValue, length);\n if (incoming !== joinedRef.current) setSlots(toSlots(incoming, length));\n }, [controlled, controlledValue, length]);\n\n const commit = (next: string[]) => {\n const wasComplete = slots.every((c) => c !== \"\");\n setSlots(next);\n const str = next.join(\"\");\n onChange?.(str);\n // Fire only on the empty→full transition, not on every edit of a full code.\n if (!wasComplete && next.every((c) => c !== \"\")) onComplete?.(str);\n };\n\n const clearSlot = (idx: number) => {\n const next = [...slots];\n next[idx] = \"\";\n commit(next);\n };\n\n const slotFromClientX = (clientX: number) => {\n const els = slotsRef.current?.children;\n if (!els) return 0;\n for (let i = 0; i < els.length; i++) {\n if (clientX < els[i].getBoundingClientRect().right) return i;\n }\n return length - 1;\n };\n\n // Single insertion path: one digit overwrites the active slot and advances; a\n // multi-digit chunk (paste / SMS autofill) fills forward from the active slot.\n const insert = (raw: string, from = active) => {\n const digits = raw.replace(/\\D/g, \"\");\n if (!digits) return;\n const next = [...slots];\n let i = from;\n for (const ch of digits) {\n if (i >= length) break;\n next[i] = ch;\n i++;\n }\n commit(next);\n setActive(Math.min(i, length - 1));\n };\n\n // The keyboard is the single source of truth: preventDefault on keydown\n // reliably blocks native insertion (unlike beforeinput in React), so the hidden\n // input never accumulates a competing string and slot holes survive.\n const onKeyDown = (e: React.KeyboardEvent<HTMLInputElement>) => {\n if (disabled || e.metaKey || e.ctrlKey || e.altKey) return;\n const k = e.key;\n if (/^[0-9]$/.test(k)) {\n e.preventDefault();\n insert(k);\n } else if (k === \"Backspace\") {\n e.preventDefault();\n // A filled slot clears in place; an empty slot steps back and clears there.\n if (slots[active]) {\n clearSlot(active);\n } else if (active > 0) {\n clearSlot(active - 1);\n setActive((current) => Math.max(current - 1, 0));\n }\n } else if (k === \"Delete\") {\n e.preventDefault();\n clearSlot(active);\n } else if (k === \"ArrowLeft\") {\n e.preventDefault();\n setActive((a) => Math.max(a - 1, 0));\n } else if (k === \"ArrowRight\") {\n e.preventDefault();\n setActive((a) => Math.min(a + 1, length - 1));\n } else if (k === \"Home\") {\n e.preventDefault();\n setActive(0);\n } else if (k === \"End\") {\n e.preventDefault();\n setActive(length - 1);\n }\n };\n\n const onPaste = (e: React.ClipboardEvent<HTMLInputElement>) => {\n if (disabled) return;\n // preventDefault suppresses the duplicate onChange, keeping that path autofill-only.\n e.preventDefault();\n insert(e.clipboardData.getData(\"text\"), active);\n };\n\n // Autofill path: SMS one-time-code arrives as a whole value in one shot.\n // Keystrokes go through onKeyDown and paste through onPaste, so only autofill\n // reaches here — spread it across the slots from the start.\n const onChangeNative = (e: React.ChangeEvent<HTMLInputElement>) => {\n const digits = sanitize(e.target.value, length);\n if (!digits) return;\n commit(toSlots(digits, length));\n setActive(Math.min(digits.length, length - 1));\n };\n\n // Error shake — imperative so it replays on every transition into \"error\".\n useEffect(() => {\n if (status !== \"error\" || reduce || !slotsRef.current) return;\n animate(slotsRef.current, { x: [0, -5, 5, -3, 3, -1, 0] }, { duration: 0.45, ease: EASE_OUT });\n }, [status, reduce]);\n\n const showSuccess = status === \"success\";\n const activeIndex = focused ? active : -1;\n const message = showSuccess ? successMessage : status === \"error\" ? errorMessage : hint;\n\n return (\n <div className={cn(\"inline-flex flex-col gap-2\", className)}>\n {label ? (\n <label htmlFor={`${uid}-input`} className=\"font-medium text-foreground text-sm\">\n {label}\n </label>\n ) : null}\n <fieldset\n className=\"relative m-0 inline-flex w-max border-0 p-0\"\n onMouseDown={(e) => {\n if (disabled) return;\n // Suppress the native click-caret; we drive the active slot ourselves.\n e.preventDefault();\n // Clamp to the first empty slot so a click can't jump ahead of progress.\n const firstEmpty = slots.indexOf(\"\");\n const cap = firstEmpty === -1 ? length - 1 : firstEmpty;\n setActive(Math.min(slotFromClientX(e.clientX), cap));\n inputRef.current?.focus();\n }}\n >\n <input\n ref={inputRef}\n id={`${uid}-input`}\n inputMode=\"numeric\"\n autoComplete=\"one-time-code\"\n autoFocus={autoFocus}\n disabled={disabled}\n aria-label={ariaLabel}\n aria-invalid={status === \"error\"}\n // Kept empty on purpose — our state owns the digits, native holds none.\n value=\"\"\n maxLength={length}\n onKeyDown={onKeyDown}\n onChange={onChangeNative}\n onPaste={onPaste}\n onFocus={() => setFocused(true)}\n onBlur={() => setFocused(false)}\n // Transparent overlay owns focus, the soft keyboard, paste and autofill;\n // the slots below are purely presentational.\n className=\"absolute inset-0 z-20 h-full w-full cursor-text bg-transparent text-transparent caret-transparent opacity-0 outline-none disabled:cursor-not-allowed\"\n />\n\n <div ref={slotsRef} className=\"flex items-center gap-2\">\n {Array.from({ length }, (_, i) => {\n const char = slots[i] ?? \"\";\n const isActive = i === activeIndex;\n return (\n <div\n key={`${uid}-${i}`}\n data-active={isActive}\n data-filled={char !== \"\"}\n className={cn(\n \"relative grid h-14 w-12 place-items-center overflow-hidden rounded-xl border font-semibold text-xl tabular-nums transition-colors duration-200\",\n showSuccess\n ? \"border-emerald-500/60 text-foreground\"\n : status === \"error\"\n ? \"border-destructive/60 text-foreground\"\n : char\n ? \"border-border-strong text-foreground\"\n : \"border-border text-muted-foreground\",\n // Active slot reads stronger; twMerge lets this win the border.\n isActive && !showSuccess && status !== \"error\" && \"border-foreground\",\n disabled && \"opacity-50\",\n )}\n >\n {/* Blinking caret marks the active slot — centered when empty,\n trailing the digit when the slot is already filled. */}\n {isActive && !showSuccess ? (\n <motion.span\n aria-hidden\n animate={reduce ? undefined : { opacity: [1, 1, 0, 0] }}\n transition={\n reduce\n ? undefined\n : { duration: 1, repeat: Number.POSITIVE_INFINITY, ease: \"linear\" }\n }\n className={cn(\n \"pointer-events-none absolute top-1/2 h-6 w-px -translate-y-1/2 bg-foreground\",\n char ? \"right-3\" : \"left-1/2 -translate-x-1/2\",\n )}\n />\n ) : null}\n\n {/* Digits roll vertically. Each is absolutely centered so enter and\n exit overlap in place — no in-flow reflow, no sideways drift. */}\n <AnimatePresence initial={false}>\n {char ? (\n <motion.span\n key={char}\n initial={reduce ? { opacity: 0 } : { y: 14, opacity: 0, filter: \"blur(4px)\" }}\n animate={reduce ? { opacity: 1 } : { y: 0, opacity: 1, filter: \"blur(0px)\" }}\n exit={reduce ? { opacity: 0 } : { y: -14, opacity: 0, filter: \"blur(4px)\" }}\n transition={reduce ? { duration: 0 } : { duration: 0.22, ease: EASE_OUT }}\n className=\"absolute inset-0 grid place-items-center leading-none\"\n >\n {mask ? \"•\" : char}\n </motion.span>\n ) : null}\n </AnimatePresence>\n </div>\n );\n })}\n </div>\n\n <AnimatePresence>\n {showSuccess ? (\n <motion.span\n initial={reduce ? { opacity: 0 } : { scale: 0.6, opacity: 0 }}\n animate={reduce ? { opacity: 1 } : { scale: 1, opacity: 1 }}\n exit={reduce ? { opacity: 0 } : { scale: 0.6, opacity: 0 }}\n transition={\n reduce ? { duration: 0 } : { type: \"spring\", stiffness: 500, damping: 28 }\n }\n className=\"pointer-events-none absolute top-1/2 -right-7 -translate-y-1/2 text-emerald-500\"\n aria-hidden\n >\n <svg\n width=\"20\"\n height=\"20\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth={3}\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n >\n <title>Verified</title>\n <motion.path\n d=\"M5 13l4 4L19 7\"\n initial={reduce ? { pathLength: 1 } : { pathLength: 0 }}\n animate={{ pathLength: 1 }}\n transition={\n reduce ? { duration: 0 } : { duration: 0.35, ease: EASE_OUT, delay: 0.1 }\n }\n />\n </svg>\n </motion.span>\n ) : null}\n </AnimatePresence>\n </fieldset>\n\n {message ? (\n <p\n aria-live=\"polite\"\n className={cn(\n \"text-sm\",\n showSuccess\n ? \"text-emerald-500\"\n : status === \"error\"\n ? \"text-destructive\"\n : \"text-muted-foreground\",\n )}\n >\n {message}\n </p>\n ) : null}\n </div>\n );\n}\n\nfunction sanitize(raw: string, length: number) {\n return raw.replace(/\\D/g, \"\").slice(0, length);\n}\n\nfunction toSlots(raw: string, length: number) {\n const digits = sanitize(raw, length);\n return Array.from({ length }, (_, i) => digits[i] ?? \"\");\n}\n"],"mappings":";;;;;;;AAqCA,SAAgB,SAAS,EACvB,SAAS,GACT,OAAO,iBACP,eAAe,IACf,UACA,YACA,OACA,MACA,gBACA,cACA,SAAS,QACT,OAAO,OACP,WAAW,OACX,YAAY,OACZ,cAAc,YAAY,qBAC1B,aACgB;CAChB,MAAM,MAAM,MAAM;CAClB,MAAM,SAAS,iBAAiB;CAChC,MAAM,WAAW,OAAyB,IAAI;CAC9C,MAAM,WAAW,OAAuB,IAAI;CAE5C,MAAM,aAAa,oBAAoB,KAAA;CAIvC,MAAM,CAAC,OAAO,YAAY,eACxB,QAAQ,aAAa,kBAAkB,cAAc,MAAM,CAC7D;CACA,MAAM,CAAC,SAAS,cAAc,SAAS,KAAK;CAC5C,MAAM,CAAC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ACP,aAAa;OACb,eAAc;OACd,gBAAe;OARjB,UAAA,CAUE,oBAAC,SAAD,EAAA,UAAO,WAAe,CAAA,GACtB,oBAAC,OAAO,MAAR;QACE,GAAE;QACF,SAAS,SAAS,EAAE,YAAY,EAAE,IAAI,EAAE,YAAY,EAAE;QACtD,SAAS,EAAE,YAAY,EAAE;QACzB,YACE,SAAS,EAAE,UAAU,EAAE,IAAI;SAAE,UAAU;SAAM,MAAM;SAAU,OAAO;QAAI;OAE3E,CAAA,CACE;;KACM,CAAA,IACX,KACW,CAAA;IACT;;GAET,UACC,oBAAC,KAAD;IACE,aAAU;IACV,WAAW,GACT,WACA,cACI,qBACA,WAAW,UACT,qBACA,uBACR;IAEC,UAAA;GACA,CAAA,IACD;EACD;;AAET;AAEA,SAAS,SAAS,KAAa,QAAgB;CAC7C,OAAO,IAAI,QAAQ,OAAO,EAAE,CAAC,CAAC,MAAM,GAAG,MAAM;AAC/C;AAEA,SAAS,QAAQ,KAAa,QAAgB;CAC5C,MAAM,SAAS,SAAS,KAAK,MAAM;CACnC,OAAO,MAAM,KAAK,EAAE,OAAO,IAAI,GAAG,MAAM,OAAO,MAAM,EAAE;AACzD"}
@@ -2,7 +2,7 @@
2
2
  import { useHoverCapable } from "../../hooks/use-hover-capable.js";
3
3
  import { EASE_OUT } from "../../lib/ease.js";
4
4
  import { useCallback, useId, useLayoutEffect, useRef, useState } from "react";
5
- import { cn } from "cn";
5
+ import { cn } from "@kumix/utils";
6
6
  import { jsx, jsxs } from "react/jsx-runtime";
7
7
  import { AnimatePresence, motion, useReducedMotion } from "motion/react";
8
8
  import { MoreHorizontal, X } from "lucide-react";
@@ -1 +1 @@
1
- {"version":3,"file":"overflow-actions.js","names":[],"sources":["../../../src/components/motion/overflow-actions.tsx"],"sourcesContent":["\"use client\";\n\nimport { type ReactNode, useCallback, useId, useLayoutEffect, useRef, useState } from \"react\";\nimport { cn } from \"cn\";\nimport { MoreHorizontal, X } from \"lucide-react\";\nimport {\n AnimatePresence,\n motion,\n type Transition,\n useReducedMotion,\n type Variants,\n} from \"motion/react\";\n\nimport { useHoverCapable } from \"../../hooks/use-hover-capable\";\nimport { EASE_OUT } from \"../../lib/ease\";\n\nexport type OverflowActionsSize = \"sm\" | \"md\";\n\nexport type OverflowActionItem = {\n id: string;\n label: ReactNode;\n icon?: ReactNode;\n onClick?: () => void;\n disabled?: boolean;\n ariaLabel?: string;\n};\n\nexport type OverflowActionsClassNames = {\n root?: string;\n track?: string;\n action?: string;\n primaryAction?: string;\n overflowAction?: string;\n toggle?: string;\n icon?: string;\n label?: string;\n};\n\nexport interface OverflowActionsProps {\n primaryActions: OverflowActionItem[];\n overflowActions: OverflowActionItem[];\n expanded?: boolean;\n defaultExpanded?: boolean;\n onExpandedChange?: (expanded: boolean) => void;\n onAction?: (item: OverflowActionItem) => void;\n collapseOnAction?: boolean;\n size?: OverflowActionsSize;\n openLabel?: string;\n closeLabel?: string;\n className?: string;\n classNames?: OverflowActionsClassNames;\n}\n\n// This needs a softer layout spring than the app defaults so the overflow group\n// stays visually attached to the toggle while entering and leaving.\nconst SHELL_TRANSITION: Transition = {\n type: \"spring\",\n stiffness: 220,\n damping: 17,\n mass: 0.85,\n};\n\nconst ICON_VARIANTS: Variants = {\n hidden: { opacity: 0, filter: \"blur(3px)\" },\n visible: {\n opacity: 1,\n filter: \"blur(0px)\",\n transition: { duration: 0.18, ease: EASE_OUT },\n },\n exit: {\n opacity: 0,\n filter: \"blur(3px)\",\n transition: { duration: 0.18, ease: EASE_OUT },\n },\n};\n\nconst OVERFLOW_ACTION_VARIANTS: Variants = {\n hidden: { opacity: 0, filter: \"blur(4px)\" },\n visible: { opacity: 1, filter: \"blur(0px)\" },\n exit: { opacity: 0, filter: \"blur(4px)\" },\n};\n\nconst TRACK_SIZE_CLASS: Record<OverflowActionsSize, string> = {\n sm: \"gap-1 p-1 text-xs\",\n md: \"gap-1.5 p-1.5 text-sm\",\n};\n\nconst GROUP_GAP_CLASS: Record<OverflowActionsSize, string> = {\n sm: \"gap-1\",\n md: \"gap-1.5\",\n};\n\nconst ACTION_SIZE_CLASS: Record<OverflowActionsSize, string> = {\n sm: \"h-8 min-w-8 gap-1.5 px-3\",\n md: \"h-9 min-w-9 gap-2 px-3.5\",\n};\n\nconst TOGGLE_SIZE_CLASS: Record<OverflowActionsSize, string> = {\n sm: \"h-8 w-8\",\n md: \"h-9 w-9\",\n};\n\nconst ICON_SIZE_CLASS: Record<OverflowActionsSize, 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 OverflowActions({\n primaryActions,\n overflowActions,\n expanded,\n defaultExpanded = false,\n onExpandedChange,\n onAction,\n collapseOnAction = false,\n size = \"md\",\n openLabel = \"Show extra actions\",\n closeLabel = \"Hide extra actions\",\n className,\n classNames,\n}: OverflowActionsProps) {\n const reduce = useReducedMotion();\n const canHover = useHoverCapable();\n const overflowId = useId();\n const overflowWrapperRef = useRef<HTMLDivElement>(null);\n const overflowWrapperLeftRef = useRef(0);\n const [isExpanded, setIsExpanded] = useControllableExpanded({\n expanded,\n defaultExpanded,\n onExpandedChange,\n });\n\n const transition = reduce ? { duration: 0 } : SHELL_TRANSITION;\n\n useLayoutEffect(() => {\n const overflowNode = overflowWrapperRef.current;\n if (!overflowNode) return;\n\n if (!isExpanded) {\n overflowNode.style.left = `${\n overflowWrapperLeftRef.current - overflowNode.getBoundingClientRect().left\n }px`;\n return;\n }\n\n overflowNode.style.left = \"\";\n overflowWrapperLeftRef.current = overflowNode.getBoundingClientRect().left;\n }, [isExpanded]);\n\n const handleAction = (item: OverflowActionItem) => {\n item.onClick?.();\n onAction?.(item);\n if (collapseOnAction) setIsExpanded(false);\n };\n\n return (\n <motion.div\n layout\n transition={transition}\n className={cn(\"inline-flex\", classNames?.root, className)}\n >\n <motion.div\n layout\n transition={transition}\n className={cn(\n \"relative inline-flex items-center overflow-hidden rounded-full border border-border bg-card\",\n TRACK_SIZE_CLASS[size],\n classNames?.track,\n )}\n >\n <motion.div\n layout\n transition={transition}\n className={cn(\"inline-flex items-center\", GROUP_GAP_CLASS[size])}\n >\n {primaryActions.map((item) => (\n <ActionButton\n key={item.id}\n item={item}\n size={size}\n reduce={reduce}\n canHover={canHover}\n onAction={handleAction}\n layoutTransition={transition}\n className={cn(classNames?.action, classNames?.primaryAction)}\n iconClassName={classNames?.icon}\n labelClassName={classNames?.label}\n />\n ))}\n </motion.div>\n\n <AnimatePresence mode=\"popLayout\" initial={false}>\n {isExpanded ? (\n <motion.div\n key=\"overflow-actions\"\n ref={overflowWrapperRef}\n id={overflowId}\n layout\n aria-hidden={!isExpanded}\n transition={transition}\n className={cn(\"relative inline-flex w-max items-center\", GROUP_GAP_CLASS[size])}\n >\n {overflowActions.map((item) => (\n <ActionButton\n key={item.id}\n item={item}\n size={size}\n reduce={reduce}\n canHover={canHover}\n overflow\n visible={isExpanded}\n variants={OVERFLOW_ACTION_VARIANTS}\n onAction={handleAction}\n layoutTransition={transition}\n className={cn(classNames?.action, classNames?.overflowAction)}\n iconClassName={classNames?.icon}\n labelClassName={classNames?.label}\n />\n ))}\n </motion.div>\n ) : null}\n </AnimatePresence>\n\n <motion.button\n type=\"button\"\n layout\n aria-expanded={isExpanded}\n aria-controls={isExpanded ? overflowId : undefined}\n aria-label={isExpanded ? closeLabel : openLabel}\n title={isExpanded ? closeLabel : openLabel}\n onClick={() => setIsExpanded(!isExpanded)}\n whileTap={reduce ? undefined : { scale: 0.96 }}\n whileHover={reduce || !canHover ? undefined : { scale: 1.03 }}\n transition={transition}\n className={cn(\n \"relative inline-grid shrink-0 place-items-center rounded-full bg-primary text-primary-foreground outline-none disabled:pointer-events-none disabled:opacity-50\",\n \"focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background\",\n TOGGLE_SIZE_CLASS[size],\n classNames?.toggle,\n )}\n >\n <AnimatePresence mode=\"popLayout\" initial={false}>\n <motion.span\n key={isExpanded ? \"close\" : \"open\"}\n variants={ICON_VARIANTS}\n initial={reduce ? { opacity: 0 } : \"hidden\"}\n animate={reduce ? { opacity: 1 } : \"visible\"}\n exit={reduce ? { opacity: 0 } : \"exit\"}\n className=\"inline-grid place-items-center\"\n >\n {isExpanded ? (\n <X className={ICON_SIZE_CLASS[size]} />\n ) : (\n <MoreHorizontal className={ICON_SIZE_CLASS[size]} />\n )}\n </motion.span>\n </AnimatePresence>\n </motion.button>\n </motion.div>\n </motion.div>\n );\n}\n\nfunction ActionButton({\n item,\n size,\n reduce,\n canHover,\n overflow,\n visible = true,\n variants,\n onAction,\n layoutTransition,\n className,\n iconClassName,\n labelClassName,\n}: {\n item: OverflowActionItem;\n size: OverflowActionsSize;\n reduce: boolean | null;\n canHover: boolean;\n overflow?: boolean;\n visible?: boolean;\n variants?: Variants;\n onAction: (item: OverflowActionItem) => void;\n layoutTransition: Transition;\n className?: string;\n iconClassName?: string;\n labelClassName?: string;\n}) {\n const label = typeof item.label === \"string\" ? item.label : undefined;\n\n return (\n <motion.span\n layout=\"position\"\n variants={variants}\n initial={variants ? (reduce ? { opacity: 0 } : \"hidden\") : undefined}\n animate={variants ? (reduce ? { opacity: 1 } : \"visible\") : undefined}\n exit={variants ? (reduce ? { opacity: 0 } : \"exit\") : undefined}\n whileTap={reduce || item.disabled ? undefined : { scale: 0.97 }}\n whileHover={reduce || !canHover || item.disabled ? undefined : { scale: 1.008 }}\n transition={layoutTransition}\n className=\"inline-flex shrink-0\"\n >\n <button\n type=\"button\"\n disabled={item.disabled}\n aria-label={item.ariaLabel}\n tabIndex={overflow && !visible ? -1 : undefined}\n title={label}\n onClick={() => onAction(item)}\n className={cn(\n \"inline-flex shrink-0 items-center justify-center rounded-full bg-background font-medium text-foreground outline-none\",\n \"disabled:pointer-events-none disabled:opacity-45\",\n \"focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background\",\n ACTION_SIZE_CLASS[size],\n className,\n )}\n >\n {item.icon ? (\n <span\n className={cn(\n \"inline-flex shrink-0 items-center justify-center\",\n ICON_SIZE_CLASS[size],\n iconClassName,\n )}\n >\n {item.icon}\n </span>\n ) : null}\n <span className={cn(\"whitespace-nowrap\", labelClassName)}>{item.label}</span>\n </button>\n </motion.span>\n );\n}\n"],"mappings":";;;;;;;;;AAuDA,MAAM,mBAA+B;CACnC,MAAM;CACN,WAAW;CACX,SAAS;CACT,MAAM;AACR;AAEA,MAAM,gBAA0B;CAC9B,QAAQ;EAAE,SAAS;EAAG,QAAQ;CAAY;CAC1C,SAAS;EACP,SAAS;EACT,QAAQ;EACR,YAAY;GAAE,UAAU;GAAM,MAAM;EAAS;CAC/C;CACA,MAAM;EACJ,SAAS;EACT,QAAQ;EACR,YAAY;GAAE,UAAU;GAAM,MAAM;EAAS;CAC/C;AACF;AAEA,MAAM,2BAAqC;CACzC,QAAQ;EAAE,SAAS;EAAG,QAAQ;CAAY;CAC1C,SAAS;EAAE,SAAS;EAAG,QAAQ;CAAY;CAC3C,MAAM;EAAE,SAAS;EAAG,QAAQ;CAAY;AAC1C;AAEA,MAAM,mBAAwD;CAC5D,IAAI;CACJ,IAAI;AACN;AAEA,MAAM,kBAAuD;CAC3D,IAAI;CACJ,IAAI;AACN;AAEA,MAAM,oBAAyD;CAC7D,IAAI;CACJ,IAAI;AACN;AAEA,MAAM,oBAAyD;CAC7D,IAAI;CACJ,IAAI;AACN;AAEA,MAAM,kBAAuD;CAC3D,IAAI;CACJ,IAAI;AACN;AAEA,SAAS,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AAA,CACtE;;CACG,CAAA;AAEjB"}
1
+ {"version":3,"file":"overflow-actions.js","names":[],"sources":["../../../src/components/motion/overflow-actions.tsx"],"sourcesContent":["\"use client\";\n\nimport { type ReactNode, useCallback, useId, useLayoutEffect, useRef, useState } from \"react\";\nimport { MoreHorizontal, X } from \"lucide-react\";\nimport {\n AnimatePresence,\n motion,\n type Transition,\n useReducedMotion,\n type Variants,\n} from \"motion/react\";\n\nimport { cn } from \"@kumix/utils\";\nimport { useHoverCapable } from \"../../hooks/use-hover-capable\";\nimport { EASE_OUT } from \"../../lib/ease\";\n\nexport type OverflowActionsSize = \"sm\" | \"md\";\n\nexport type OverflowActionItem = {\n id: string;\n label: ReactNode;\n icon?: ReactNode;\n onClick?: () => void;\n disabled?: boolean;\n ariaLabel?: string;\n};\n\nexport type OverflowActionsClassNames = {\n root?: string;\n track?: string;\n action?: string;\n primaryAction?: string;\n overflowAction?: string;\n toggle?: string;\n icon?: string;\n label?: string;\n};\n\nexport interface OverflowActionsProps {\n primaryActions: OverflowActionItem[];\n overflowActions: OverflowActionItem[];\n expanded?: boolean;\n defaultExpanded?: boolean;\n onExpandedChange?: (expanded: boolean) => void;\n onAction?: (item: OverflowActionItem) => void;\n collapseOnAction?: boolean;\n size?: OverflowActionsSize;\n openLabel?: string;\n closeLabel?: string;\n className?: string;\n classNames?: OverflowActionsClassNames;\n}\n\n// This needs a softer layout spring than the app defaults so the overflow group\n// stays visually attached to the toggle while entering and leaving.\nconst SHELL_TRANSITION: Transition = {\n type: \"spring\",\n stiffness: 220,\n damping: 17,\n mass: 0.85,\n};\n\nconst ICON_VARIANTS: Variants = {\n hidden: { opacity: 0, filter: \"blur(3px)\" },\n visible: {\n opacity: 1,\n filter: \"blur(0px)\",\n transition: { duration: 0.18, ease: EASE_OUT },\n },\n exit: {\n opacity: 0,\n filter: \"blur(3px)\",\n transition: { duration: 0.18, ease: EASE_OUT },\n },\n};\n\nconst OVERFLOW_ACTION_VARIANTS: Variants = {\n hidden: { opacity: 0, filter: \"blur(4px)\" },\n visible: { opacity: 1, filter: \"blur(0px)\" },\n exit: { opacity: 0, filter: \"blur(4px)\" },\n};\n\nconst TRACK_SIZE_CLASS: Record<OverflowActionsSize, string> = {\n sm: \"gap-1 p-1 text-xs\",\n md: \"gap-1.5 p-1.5 text-sm\",\n};\n\nconst GROUP_GAP_CLASS: Record<OverflowActionsSize, string> = {\n sm: \"gap-1\",\n md: \"gap-1.5\",\n};\n\nconst ACTION_SIZE_CLASS: Record<OverflowActionsSize, string> = {\n sm: \"h-8 min-w-8 gap-1.5 px-3\",\n md: \"h-9 min-w-9 gap-2 px-3.5\",\n};\n\nconst TOGGLE_SIZE_CLASS: Record<OverflowActionsSize, string> = {\n sm: \"h-8 w-8\",\n md: \"h-9 w-9\",\n};\n\nconst ICON_SIZE_CLASS: Record<OverflowActionsSize, 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 OverflowActions({\n primaryActions,\n overflowActions,\n expanded,\n defaultExpanded = false,\n onExpandedChange,\n onAction,\n collapseOnAction = false,\n size = \"md\",\n openLabel = \"Show extra actions\",\n closeLabel = \"Hide extra actions\",\n className,\n classNames,\n}: OverflowActionsProps) {\n const reduce = useReducedMotion();\n const canHover = useHoverCapable();\n const overflowId = useId();\n const overflowWrapperRef = useRef<HTMLDivElement>(null);\n const overflowWrapperLeftRef = useRef(0);\n const [isExpanded, setIsExpanded] = useControllableExpanded({\n expanded,\n defaultExpanded,\n onExpandedChange,\n });\n\n const transition = reduce ? { duration: 0 } : SHELL_TRANSITION;\n\n useLayoutEffect(() => {\n const overflowNode = overflowWrapperRef.current;\n if (!overflowNode) return;\n\n if (!isExpanded) {\n overflowNode.style.left = `${\n overflowWrapperLeftRef.current - overflowNode.getBoundingClientRect().left\n }px`;\n return;\n }\n\n overflowNode.style.left = \"\";\n overflowWrapperLeftRef.current = overflowNode.getBoundingClientRect().left;\n }, [isExpanded]);\n\n const handleAction = (item: OverflowActionItem) => {\n item.onClick?.();\n onAction?.(item);\n if (collapseOnAction) setIsExpanded(false);\n };\n\n return (\n <motion.div\n layout\n transition={transition}\n className={cn(\"inline-flex\", classNames?.root, className)}\n >\n <motion.div\n layout\n transition={transition}\n className={cn(\n \"relative inline-flex items-center overflow-hidden rounded-full border border-border bg-card\",\n TRACK_SIZE_CLASS[size],\n classNames?.track,\n )}\n >\n <motion.div\n layout\n transition={transition}\n className={cn(\"inline-flex items-center\", GROUP_GAP_CLASS[size])}\n >\n {primaryActions.map((item) => (\n <ActionButton\n key={item.id}\n item={item}\n size={size}\n reduce={reduce}\n canHover={canHover}\n onAction={handleAction}\n layoutTransition={transition}\n className={cn(classNames?.action, classNames?.primaryAction)}\n iconClassName={classNames?.icon}\n labelClassName={classNames?.label}\n />\n ))}\n </motion.div>\n\n <AnimatePresence mode=\"popLayout\" initial={false}>\n {isExpanded ? (\n <motion.div\n key=\"overflow-actions\"\n ref={overflowWrapperRef}\n id={overflowId}\n layout\n aria-hidden={!isExpanded}\n transition={transition}\n className={cn(\"relative inline-flex w-max items-center\", GROUP_GAP_CLASS[size])}\n >\n {overflowActions.map((item) => (\n <ActionButton\n key={item.id}\n item={item}\n size={size}\n reduce={reduce}\n canHover={canHover}\n overflow\n visible={isExpanded}\n variants={OVERFLOW_ACTION_VARIANTS}\n onAction={handleAction}\n layoutTransition={transition}\n className={cn(classNames?.action, classNames?.overflowAction)}\n iconClassName={classNames?.icon}\n labelClassName={classNames?.label}\n />\n ))}\n </motion.div>\n ) : null}\n </AnimatePresence>\n\n <motion.button\n type=\"button\"\n layout\n aria-expanded={isExpanded}\n aria-controls={isExpanded ? overflowId : undefined}\n aria-label={isExpanded ? closeLabel : openLabel}\n title={isExpanded ? closeLabel : openLabel}\n onClick={() => setIsExpanded(!isExpanded)}\n whileTap={reduce ? undefined : { scale: 0.96 }}\n whileHover={reduce || !canHover ? undefined : { scale: 1.03 }}\n transition={transition}\n className={cn(\n \"relative inline-grid shrink-0 place-items-center rounded-full bg-primary text-primary-foreground outline-none disabled:pointer-events-none disabled:opacity-50\",\n \"focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background\",\n TOGGLE_SIZE_CLASS[size],\n classNames?.toggle,\n )}\n >\n <AnimatePresence mode=\"popLayout\" initial={false}>\n <motion.span\n key={isExpanded ? \"close\" : \"open\"}\n variants={ICON_VARIANTS}\n initial={reduce ? { opacity: 0 } : \"hidden\"}\n animate={reduce ? { opacity: 1 } : \"visible\"}\n exit={reduce ? { opacity: 0 } : \"exit\"}\n className=\"inline-grid place-items-center\"\n >\n {isExpanded ? (\n <X className={ICON_SIZE_CLASS[size]} />\n ) : (\n <MoreHorizontal className={ICON_SIZE_CLASS[size]} />\n )}\n </motion.span>\n </AnimatePresence>\n </motion.button>\n </motion.div>\n </motion.div>\n );\n}\n\nfunction ActionButton({\n item,\n size,\n reduce,\n canHover,\n overflow,\n visible = true,\n variants,\n onAction,\n layoutTransition,\n className,\n iconClassName,\n labelClassName,\n}: {\n item: OverflowActionItem;\n size: OverflowActionsSize;\n reduce: boolean | null;\n canHover: boolean;\n overflow?: boolean;\n visible?: boolean;\n variants?: Variants;\n onAction: (item: OverflowActionItem) => void;\n layoutTransition: Transition;\n className?: string;\n iconClassName?: string;\n labelClassName?: string;\n}) {\n const label = typeof item.label === \"string\" ? item.label : undefined;\n\n return (\n <motion.span\n layout=\"position\"\n variants={variants}\n initial={variants ? (reduce ? { opacity: 0 } : \"hidden\") : undefined}\n animate={variants ? (reduce ? { opacity: 1 } : \"visible\") : undefined}\n exit={variants ? (reduce ? { opacity: 0 } : \"exit\") : undefined}\n whileTap={reduce || item.disabled ? undefined : { scale: 0.97 }}\n whileHover={reduce || !canHover || item.disabled ? undefined : { scale: 1.008 }}\n transition={layoutTransition}\n className=\"inline-flex shrink-0\"\n >\n <button\n type=\"button\"\n disabled={item.disabled}\n aria-label={item.ariaLabel}\n tabIndex={overflow && !visible ? -1 : undefined}\n title={label}\n onClick={() => onAction(item)}\n className={cn(\n \"inline-flex shrink-0 items-center justify-center rounded-full bg-background font-medium text-foreground outline-none\",\n \"disabled:pointer-events-none disabled:opacity-45\",\n \"focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background\",\n ACTION_SIZE_CLASS[size],\n className,\n )}\n >\n {item.icon ? (\n <span\n className={cn(\n \"inline-flex shrink-0 items-center justify-center\",\n ICON_SIZE_CLASS[size],\n iconClassName,\n )}\n >\n {item.icon}\n </span>\n ) : null}\n <span className={cn(\"whitespace-nowrap\", labelClassName)}>{item.label}</span>\n </button>\n </motion.span>\n );\n}\n"],"mappings":";;;;;;;;;AAuDA,MAAM,mBAA+B;CACnC,MAAM;CACN,WAAW;CACX,SAAS;CACT,MAAM;AACR;AAEA,MAAM,gBAA0B;CAC9B,QAAQ;EAAE,SAAS;EAAG,QAAQ;CAAY;CAC1C,SAAS;EACP,SAAS;EACT,QAAQ;EACR,YAAY;GAAE,UAAU;GAAM,MAAM;EAAS;CAC/C;CACA,MAAM;EACJ,SAAS;EACT,QAAQ;EACR,YAAY;GAAE,UAAU;GAAM,MAAM;EAAS;CAC/C;AACF;AAEA,MAAM,2BAAqC;CACzC,QAAQ;EAAE,SAAS;EAAG,QAAQ;CAAY;CAC1C,SAAS;EAAE,SAAS;EAAG,QAAQ;CAAY;CAC3C,MAAM;EAAE,SAAS;EAAG,QAAQ;CAAY;AAC1C;AAEA,MAAM,mBAAwD;CAC5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,GACT,wHACA,oDACA,iHACA,kBAAkB,OAClB,SACF;GAbF,UAAA,CAeG,KAAK,OACJ,oBAAC,QAAD;IACE,WAAW,GACT,oDACA,gBAAgB,OAChB,aACF;IAEC,UAAA,KAAK;GACF,CAAA,IACJ,MACJ,oBAAC,QAAD;IAAM,WAAW,GAAG,qBAAqB,cAAc;IAAI,UAAA,KAAK;GAAY,CAAA,CACtE;;CACG,CAAA;AAEjB"}
@@ -1 +1 @@
1
- {"version":3,"file":"parallax.d.ts","names":[],"sources":["../../../src/components/motion/parallax.tsx"],"mappings":";;iBAiBiB;EACf,UAAU;;;;;;EAMV;EACA;;EAEA,YAAY,UAAU;;EAEtB;EACA;;wBAGc,WACd,UACA,OACA,MACA,WACA,QACA,aACC,gCAAa,IAAA"}
1
+ {"version":3,"file":"parallax.d.ts","names":[],"sources":["../../../src/components/motion/parallax.tsx"],"mappings":";;iBAkBiB;EACf,UAAU;;;;;;EAMV;EACA;;EAEA,YAAY,UAAU;;EAEtB;EACA;;wBAGc,WACd,UACA,OACA,MACA,WACA,QACA,aACC,gCAAa,IAAA"}
@@ -1,6 +1,6 @@
1
1
  "use client";
2
2
  import { useRef } from "react";
3
- import { cn } from "cn";
3
+ import { cn } from "@kumix/utils";
4
4
  import { jsx } from "react/jsx-runtime";
5
5
  import { motion, useReducedMotion, useScroll, useSpring, useTransform } from "motion/react";
6
6
  //#region src/components/motion/parallax.tsx
@@ -1 +1 @@
1
- {"version":3,"file":"parallax.js","names":[],"sources":["../../../src/components/motion/parallax.tsx"],"sourcesContent":["\"use client\";\n\nimport { type ReactNode, type RefObject, useRef } from \"react\";\nimport { cn } from \"cn\";\nimport {\n type MotionStyle,\n motion,\n useReducedMotion,\n useScroll,\n useSpring,\n useTransform,\n} from \"motion/react\";\n\n// Soft follow so the drift trails the scroll smoothly; looser than the UI\n// springs in lib/ease.ts on purpose.\nconst PARALLAX_SPRING = { stiffness: 120, damping: 30, mass: 0.6 };\n\nexport interface ParallaxProps {\n children: ReactNode;\n /**\n * Drift as a fraction of the element's travel through the viewport.\n * Positive moves with the scroll (foreground), negative against it\n * (background). ~0.1–0.5 reads best.\n */\n speed?: number;\n axis?: \"x\" | \"y\";\n /** Scroll container for contained scroll areas. Defaults to the viewport. */\n container?: RefObject<HTMLElement | null>;\n /** Spring-smooth the drift. Disabled automatically under reduced motion. */\n spring?: boolean;\n className?: string;\n}\n\nexport function Parallax({\n children,\n speed = 0.3,\n axis = \"y\",\n container,\n spring = true,\n className,\n}: ParallaxProps) {\n const reduce = useReducedMotion();\n const ref = useRef<HTMLDivElement>(null);\n const { scrollYProgress } = useScroll({\n target: ref,\n container,\n offset: [\"start end\", \"end start\"],\n // Run after paint so a container ref defined higher in the tree is hydrated;\n // otherwise framer falls back to the document and only the page scroll works.\n // layoutEffect: false,\n });\n\n // progress 0→1 as the element crosses the viewport; map to a symmetric drift.\n const travel = speed * 100;\n const drift = useTransform(scrollYProgress, [0, 1], [travel, -travel]);\n const smoothed = useSpring(drift, PARALLAX_SPRING);\n const value = spring && !reduce ? smoothed : drift;\n\n const style: MotionStyle = reduce ? {} : axis === \"x\" ? { x: value } : { y: value };\n\n return (\n <motion.div ref={ref} style={style} className={cn(className)}>\n {children}\n </motion.div>\n );\n}\n"],"mappings":";;;;;;AAeA,MAAM,kBAAkB;CAAE,WAAW;CAAK,SAAS;CAAI,MAAM;AAAI;AAkBjE,SAAgB,SAAS,EACvB,UACA,QAAQ,IACR,OAAO,KACP,WACA,SAAS,MACT,aACgB;CAChB,MAAM,SAAS,iBAAiB;CAChC,MAAM,MAAM,OAAuB,IAAI;CACvC,MAAM,EAAE,oBAAoB,UAAU;EACpC,QAAQ;EACR;EACA,QAAQ,CAAC,aAAa,WAAW;CAInC,CAAC;CAGD,MAAM,SAAS,QAAQ;CACvB,MAAM,QAAQ,aAAa,iBAAiB,CAAC,GAAG,CAAC,GAAG,CAAC,QAAQ,CAAC,MAAM,CAAC;CACrE,MAAM,WAAW,UAAU,OAAO,eAAe;CACjD,MAAM,QAAQ,UAAU,CAAC,SAAS,WAAW;CAE7C,MAAM,QAAqB,SAAS,CAAC,IAAI,SAAS,MAAM,EAAE,GAAG,MAAM,IAAI,EAAE,GAAG,MAAM;CAElF,OACE,oBAAC,OAAO,KAAR;EAAiB;EAAY;EAAO,WAAW,GAAG,SAAS;EACxD;CACS,CAAA;AAEhB"}
1
+ {"version":3,"file":"parallax.js","names":[],"sources":["../../../src/components/motion/parallax.tsx"],"sourcesContent":["\"use client\";\n\nimport { type ReactNode, type RefObject, useRef } from \"react\";\nimport {\n type MotionStyle,\n motion,\n useReducedMotion,\n useScroll,\n useSpring,\n useTransform,\n} from \"motion/react\";\n\nimport { cn } from \"@kumix/utils\";\n\n// Soft follow so the drift trails the scroll smoothly; looser than the UI\n// springs in lib/ease.ts on purpose.\nconst PARALLAX_SPRING = { stiffness: 120, damping: 30, mass: 0.6 };\n\nexport interface ParallaxProps {\n children: ReactNode;\n /**\n * Drift as a fraction of the element's travel through the viewport.\n * Positive moves with the scroll (foreground), negative against it\n * (background). ~0.1–0.5 reads best.\n */\n speed?: number;\n axis?: \"x\" | \"y\";\n /** Scroll container for contained scroll areas. Defaults to the viewport. */\n container?: RefObject<HTMLElement | null>;\n /** Spring-smooth the drift. Disabled automatically under reduced motion. */\n spring?: boolean;\n className?: string;\n}\n\nexport function Parallax({\n children,\n speed = 0.3,\n axis = \"y\",\n container,\n spring = true,\n className,\n}: ParallaxProps) {\n const reduce = useReducedMotion();\n const ref = useRef<HTMLDivElement>(null);\n const { scrollYProgress } = useScroll({\n target: ref,\n container,\n offset: [\"start end\", \"end start\"],\n // Run after paint so a container ref defined higher in the tree is hydrated;\n // otherwise framer falls back to the document and only the page scroll works.\n // layoutEffect: false,\n });\n\n // progress 0→1 as the element crosses the viewport; map to a symmetric drift.\n const travel = speed * 100;\n const drift = useTransform(scrollYProgress, [0, 1], [travel, -travel]);\n const smoothed = useSpring(drift, PARALLAX_SPRING);\n const value = spring && !reduce ? smoothed : drift;\n\n const style: MotionStyle = reduce ? {} : axis === \"x\" ? { x: value } : { y: value };\n\n return (\n <motion.div ref={ref} style={style} className={cn(className)}>\n {children}\n </motion.div>\n );\n}\n"],"mappings":";;;;;;AAgBA,MAAM,kBAAkB;CAAE,WAAW;CAAK,SAAS;CAAI,MAAM;AAAI;AAkBjE,SAAgB,SAAS,EACvB,UACA,QAAQ,IACR,OAAO,KACP,WACA,SAAS,MACT,aACgB;CAChB,MAAM,SAAS,iBAAiB;CAChC,MAAM,MAAM,OAAuB,IAAI;CACvC,MAAM,EAAE,oBAAoB,UAAU;EACpC,QAAQ;EACR;EACA,QAAQ,CAAC,aAAa,WAAW;CAInC,CAAC;CAGD,MAAM,SAAS,QAAQ;CACvB,MAAM,QAAQ,aAAa,iBAAiB,CAAC,GAAG,CAAC,GAAG,CAAC,QAAQ,CAAC,MAAM,CAAC;CACrE,MAAM,WAAW,UAAU,OAAO,eAAe;CACjD,MAAM,QAAQ,UAAU,CAAC,SAAS,WAAW;CAE7C,MAAM,QAAqB,SAAS,CAAC,IAAI,SAAS,MAAM,EAAE,GAAG,MAAM,IAAI,EAAE,GAAG,MAAM;CAElF,OACE,oBAAC,OAAO,KAAR;EAAiB;EAAY;EAAO,WAAW,GAAG,SAAS;EACxD;CACS,CAAA;AAEhB"}
@@ -2,7 +2,7 @@
2
2
  import { EASE_OUT, SPRING_PANEL } from "../../lib/ease.js";
3
3
  import { t as usePopoverPortalPosition } from "../../popover-position-BUqYCq8X.js";
4
4
  import { cloneElement, createContext, isValidElement, useCallback, useContext, useEffect, useId, useMemo, useRef, useState } from "react";
5
- import { cn } from "cn";
5
+ import { cn } from "@kumix/utils";
6
6
  import { jsx } from "react/jsx-runtime";
7
7
  import { AnimatePresence, motion, useReducedMotion } from "motion/react";
8
8
  import { createPortal } from "react-dom";