@kumix/ui 0.3.16 → 0.3.17

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 (240) hide show
  1. package/dist/cascader-types-BnH6wYD-.d.ts.map +1 -1
  2. package/dist/components/agents/agent-activity/activity-row.js +1 -1
  3. package/dist/components/agents/agent-activity/index.js +1 -1
  4. package/dist/components/agents/agent-code.js +1 -1
  5. package/dist/components/agents/ai-sidebar.js +3 -3
  6. package/dist/components/agents/ai-sidebar.js.map +1 -1
  7. package/dist/components/agents/approval-card/index.js +23 -26
  8. package/dist/components/agents/approval-card/index.js.map +1 -1
  9. package/dist/components/agents/citations.js +1 -1
  10. package/dist/components/agents/code-block.js +1 -1
  11. package/dist/components/agents/file-diff.js +1 -1
  12. package/dist/components/agents/image-generation.js +1 -1
  13. package/dist/components/agents/message-bubble.js +2 -2
  14. package/dist/components/agents/message-bubble.js.map +1 -1
  15. package/dist/components/agents/prompt-input.js +1 -1
  16. package/dist/components/agents/streaming-response.js +1 -1
  17. package/dist/components/agents/todo-list.js +1 -1
  18. package/dist/components/agents/tool-approval.js +1 -1
  19. package/dist/components/agents/tool-result.js +1 -1
  20. package/dist/components/custom/confirm-dialog.js +1 -1
  21. package/dist/components/motion/action-swap.js +2 -2
  22. package/dist/components/motion/action-swap.js.map +1 -1
  23. package/dist/components/motion/adaptive-stepper.js +1 -1
  24. package/dist/components/motion/animated-badge.js +3 -3
  25. package/dist/components/motion/animated-badge.js.map +1 -1
  26. package/dist/components/motion/animated-sidebar.js +1 -1
  27. package/dist/components/motion/animated-toast-stack.js +6 -6
  28. package/dist/components/motion/animated-toast-stack.js.map +1 -1
  29. package/dist/components/motion/attachment-upload.js +1 -1
  30. package/dist/components/motion/availability-scheduler/copy-menu.js +1 -1
  31. package/dist/components/motion/availability-scheduler/day-row.js +2 -2
  32. package/dist/components/motion/availability-scheduler/index.js +1 -1
  33. package/dist/components/motion/bloom-menu.js +1 -1
  34. package/dist/components/motion/bouncy-accordion.js +1 -1
  35. package/dist/components/motion/button/base.js +2 -2
  36. package/dist/components/motion/button/base.js.map +1 -1
  37. package/dist/components/motion/button/stateful.js +1 -1
  38. package/dist/components/motion/card-folder.js +1 -1
  39. package/dist/components/motion/center-morph-modal.js +1 -1
  40. package/dist/components/motion/combobox/list.js +1 -1
  41. package/dist/components/motion/combobox/trigger.js +1 -1
  42. package/dist/components/motion/command-palette.js +2 -2
  43. package/dist/components/motion/command-palette.js.map +1 -1
  44. package/dist/components/motion/context-menu.js +1 -1
  45. package/dist/components/motion/dock.js +1 -1
  46. package/dist/components/motion/dock.js.map +1 -1
  47. package/dist/components/motion/expandable-action-bar.js +1 -1
  48. package/dist/components/motion/expandable-action-bar.js.map +1 -1
  49. package/dist/components/motion/feedback-widget.js +1 -1
  50. package/dist/components/motion/file-tree.js +1 -1
  51. package/dist/components/motion/file-upload.js +1 -1
  52. package/dist/components/motion/infinite-masonry.js +1 -1
  53. package/dist/components/motion/morphing-search.js +1 -1
  54. package/dist/components/motion/morphing-tabs.js +1 -1
  55. package/dist/components/motion/multi-select/list.js +1 -1
  56. package/dist/components/motion/multi-select/trigger.js +1 -1
  57. package/dist/components/motion/not-found/shared.js +1 -1
  58. package/dist/components/motion/not-found/shared.js.map +1 -1
  59. package/dist/components/motion/notification-stack.js +1 -1
  60. package/dist/components/motion/overflow-actions.js +1 -1
  61. package/dist/components/motion/project-folder.js +1 -1
  62. package/dist/components/motion/select-morph.js +1 -1
  63. package/dist/components/motion/select.js +1 -1
  64. package/dist/components/motion/shared-layout-bg.js +1 -1
  65. package/dist/components/motion/shared-layout-bg.js.map +1 -1
  66. package/dist/components/motion/signup-form.js +1 -1
  67. package/dist/components/motion/slide-action-button.js +1 -1
  68. package/dist/components/motion/slide-action-button.js.map +1 -1
  69. package/dist/components/motion/table/index.js +1 -1
  70. package/dist/components/motion/table/index.js.map +1 -1
  71. package/dist/components/motion/table/row-handle.js +1 -1
  72. package/dist/components/motion/table/table-header.d.ts.map +1 -1
  73. package/dist/components/motion/table/table-header.js +2 -2
  74. package/dist/components/motion/table/table-header.js.map +1 -1
  75. package/dist/components/motion/tabs.d.ts +2 -1
  76. package/dist/components/motion/tabs.d.ts.map +1 -1
  77. package/dist/components/motion/tabs.js +200 -18
  78. package/dist/components/motion/tabs.js.map +1 -1
  79. package/dist/components/motion/theme-toggle.js +1 -1
  80. package/dist/components/reui/alert.d.ts +1 -1
  81. package/dist/components/reui/alert.js +1 -1
  82. package/dist/components/reui/autocomplete.d.ts.map +1 -1
  83. package/dist/components/reui/autocomplete.js +1 -1
  84. package/dist/components/reui/badge.d.ts +2 -2
  85. package/dist/components/reui/cascader/cascader-columns.d.ts.map +1 -1
  86. package/dist/components/reui/cascader/cascader-columns.js +1 -1
  87. package/dist/components/reui/cascader/cascader-context.d.ts.map +1 -1
  88. package/dist/components/reui/cascader/cascader-footer.d.ts.map +1 -1
  89. package/dist/components/reui/cascader/cascader-footer.js +1 -1
  90. package/dist/components/reui/cascader/cascader-item.d.ts.map +1 -1
  91. package/dist/components/reui/cascader/cascader-item.js +1 -1
  92. package/dist/components/reui/cascader/cascader-nav.d.ts.map +1 -1
  93. package/dist/components/reui/cascader/cascader-nav.js +1 -1
  94. package/dist/components/reui/cascader/cascader-virtual.d.ts.map +1 -1
  95. package/dist/components/reui/cascader/cascader.d.ts.map +1 -1
  96. package/dist/components/reui/cascader/cascader.js +1 -1
  97. package/dist/components/reui/data-grid/data-grid-column-filter.js +1 -1
  98. package/dist/components/reui/data-grid/data-grid-column-header.d.ts.map +1 -1
  99. package/dist/components/reui/data-grid/data-grid-column-header.js +28 -22
  100. package/dist/components/reui/data-grid/data-grid-column-header.js.map +1 -1
  101. package/dist/components/reui/data-grid/data-grid-pagination.js +1 -1
  102. package/dist/components/reui/data-grid/data-grid-scroll-area.d.ts.map +1 -1
  103. package/dist/components/reui/data-grid/data-grid-table-dnd-rows.js +1 -1
  104. package/dist/components/reui/data-grid/data-grid-table-dnd.js +1 -1
  105. package/dist/components/reui/data-grid/data-grid-table.d.ts.map +1 -1
  106. package/dist/components/reui/data-grid/data-grid-table.js +5 -5
  107. package/dist/components/reui/data-grid/data-grid-table.js.map +1 -1
  108. package/dist/components/reui/date-selector.js +1 -1
  109. package/dist/components/reui/event-calendar/event-calendar-agenda-view.js +1 -1
  110. package/dist/components/reui/event-calendar/event-calendar-event.js +1 -1
  111. package/dist/components/reui/event-calendar/event-calendar-month-view.js +1 -1
  112. package/dist/components/reui/event-calendar/event-calendar-nav.js +1 -1
  113. package/dist/components/reui/filters/filters-advanced.d.ts.map +1 -1
  114. package/dist/components/reui/filters/filters-advanced.js +1 -1
  115. package/dist/components/reui/filters/filters-advanced.js.map +1 -1
  116. package/dist/components/reui/filters/filters-builder.d.ts.map +1 -1
  117. package/dist/components/reui/filters/filters-builder.js +1 -1
  118. package/dist/components/reui/filters/filters-chip.d.ts.map +1 -1
  119. package/dist/components/reui/filters/filters-chip.js +1 -1
  120. package/dist/components/reui/filters/filters-context.d.ts.map +1 -1
  121. package/dist/components/reui/filters/filters-dnd.d.ts.map +1 -1
  122. package/dist/components/reui/filters/filters-editors.d.ts.map +1 -1
  123. package/dist/components/reui/filters/filters-editors.js +1 -1
  124. package/dist/components/reui/filters/filters-types.d.ts.map +1 -1
  125. package/dist/components/reui/filters/filters.d.ts.map +1 -1
  126. package/dist/components/reui/filters/filters.js +1 -1
  127. package/dist/components/reui/frame.d.ts +1 -1
  128. package/dist/components/reui/frame.js +1 -1
  129. package/dist/components/reui/gantt/gantt-bar.js +1 -1
  130. package/dist/components/reui/gantt/gantt-nav.js +1 -1
  131. package/dist/components/reui/gantt/gantt-view.js +1 -1
  132. package/dist/components/reui/icon-tile.d.ts +2 -2
  133. package/dist/components/reui/kanban.d.ts.map +1 -1
  134. package/dist/components/reui/number-field.d.ts.map +1 -1
  135. package/dist/components/reui/number-field.js +1 -1
  136. package/dist/components/reui/phone-input.js +1 -1
  137. package/dist/components/reui/rating.js +1 -1
  138. package/dist/components/reui/sortable.d.ts.map +1 -1
  139. package/dist/components/reui/tree.js +1 -1
  140. package/dist/components/ui/accordion.d.ts.map +1 -1
  141. package/dist/components/ui/accordion.js +1 -1
  142. package/dist/components/ui/alert-dialog.d.ts.map +1 -1
  143. package/dist/components/ui/alert-dialog.js +1 -1
  144. package/dist/components/ui/alert.d.ts.map +1 -1
  145. package/dist/components/ui/alert.js +1 -1
  146. package/dist/components/ui/attachment.d.ts +1 -1
  147. package/dist/components/ui/attachment.d.ts.map +1 -1
  148. package/dist/components/ui/attachment.js +1 -1
  149. package/dist/components/ui/avatar.d.ts.map +1 -1
  150. package/dist/components/ui/badge.d.ts +1 -1
  151. package/dist/components/ui/breadcrumb.d.ts.map +1 -1
  152. package/dist/components/ui/breadcrumb.js +1 -1
  153. package/dist/components/ui/bubble.d.ts +1 -1
  154. package/dist/components/ui/bubble.d.ts.map +1 -1
  155. package/dist/components/ui/bubble.js +1 -1
  156. package/dist/components/ui/button-group.d.ts +1 -1
  157. package/dist/components/ui/button-group.js +1 -1
  158. package/dist/components/ui/button.d.ts +2 -2
  159. package/dist/components/ui/button.d.ts.map +1 -1
  160. package/dist/components/ui/button.js +1 -1
  161. package/dist/components/ui/calendar.d.ts.map +1 -1
  162. package/dist/components/ui/calendar.js +1 -1
  163. package/dist/components/ui/card.d.ts.map +1 -1
  164. package/dist/components/ui/carousel.d.ts.map +1 -1
  165. package/dist/components/ui/carousel.js +1 -1
  166. package/dist/components/ui/chart.d.ts.map +1 -1
  167. package/dist/components/ui/checkbox.d.ts.map +1 -1
  168. package/dist/components/ui/checkbox.js +1 -1
  169. package/dist/components/ui/collapsible.d.ts.map +1 -1
  170. package/dist/components/ui/combobox.d.ts.map +1 -1
  171. package/dist/components/ui/combobox.js +1 -1
  172. package/dist/components/ui/command.d.ts.map +1 -1
  173. package/dist/components/ui/command.js +1 -1
  174. package/dist/components/ui/context-menu.d.ts.map +1 -1
  175. package/dist/components/ui/context-menu.js +1 -1
  176. package/dist/components/ui/dialog.d.ts.map +1 -1
  177. package/dist/components/ui/dialog.js +1 -1
  178. package/dist/components/ui/drawer.d.ts.map +1 -1
  179. package/dist/components/ui/dropdown-menu.d.ts.map +1 -1
  180. package/dist/components/ui/dropdown-menu.js +1 -1
  181. package/dist/components/ui/empty.js +1 -1
  182. package/dist/components/ui/field.d.ts +1 -1
  183. package/dist/components/ui/field.js +1 -1
  184. package/dist/components/ui/hover-card.d.ts.map +1 -1
  185. package/dist/components/ui/input-group.d.ts.map +1 -1
  186. package/dist/components/ui/input-group.js +1 -1
  187. package/dist/components/ui/input-otp.d.ts.map +1 -1
  188. package/dist/components/ui/input-otp.js +1 -1
  189. package/dist/components/ui/input.d.ts.map +1 -1
  190. package/dist/components/ui/item.d.ts +1 -1
  191. package/dist/components/ui/item.d.ts.map +1 -1
  192. package/dist/components/ui/item.js +1 -1
  193. package/dist/components/ui/label.d.ts.map +1 -1
  194. package/dist/components/ui/marker.d.ts +1 -1
  195. package/dist/components/ui/marker.d.ts.map +1 -1
  196. package/dist/components/ui/marker.js +1 -1
  197. package/dist/components/ui/menubar.d.ts.map +1 -1
  198. package/dist/components/ui/menubar.js +1 -1
  199. package/dist/components/ui/message-scroller.d.ts.map +1 -1
  200. package/dist/components/ui/message-scroller.js +1 -1
  201. package/dist/components/ui/message.d.ts.map +1 -1
  202. package/dist/components/ui/native-select.d.ts.map +1 -1
  203. package/dist/components/ui/native-select.js +1 -1
  204. package/dist/components/ui/navigation-menu.d.ts.map +1 -1
  205. package/dist/components/ui/navigation-menu.js +1 -1
  206. package/dist/components/ui/pagination.d.ts.map +1 -1
  207. package/dist/components/ui/pagination.js +1 -1
  208. package/dist/components/ui/popover.d.ts.map +1 -1
  209. package/dist/components/ui/progress.d.ts.map +1 -1
  210. package/dist/components/ui/questionnaire.d.ts.map +1 -1
  211. package/dist/components/ui/questionnaire.js +1 -1
  212. package/dist/components/ui/radio-group.d.ts.map +1 -1
  213. package/dist/components/ui/scroll-area.d.ts.map +1 -1
  214. package/dist/components/ui/select.d.ts.map +1 -1
  215. package/dist/components/ui/select.js +1 -1
  216. package/dist/components/ui/separator.d.ts.map +1 -1
  217. package/dist/components/ui/sheet.d.ts.map +1 -1
  218. package/dist/components/ui/sheet.js +1 -1
  219. package/dist/components/ui/sidebar.d.ts.map +1 -1
  220. package/dist/components/ui/sidebar.js +1 -1
  221. package/dist/components/ui/slider.d.ts.map +1 -1
  222. package/dist/components/ui/spinner.js +1 -1
  223. package/dist/components/ui/switch.d.ts.map +1 -1
  224. package/dist/components/ui/table.d.ts.map +1 -1
  225. package/dist/components/ui/tabs.d.ts +1 -1
  226. package/dist/components/ui/tabs.d.ts.map +1 -1
  227. package/dist/components/ui/tabs.js +1 -1
  228. package/dist/components/ui/textarea.d.ts.map +1 -1
  229. package/dist/components/ui/toast.d.ts.map +1 -1
  230. package/dist/components/ui/toast.js +1 -1
  231. package/dist/components/ui/toggle-group.d.ts.map +1 -1
  232. package/dist/components/ui/toggle.d.ts.map +1 -1
  233. package/dist/components/ui/toggle.js +1 -1
  234. package/dist/components/ui/tooltip.d.ts.map +1 -1
  235. package/dist/{copy-menu-C5GaT4Z-.js → copy-menu-TIKvPaAZ.js} +2 -2
  236. package/dist/{copy-menu-C5GaT4Z-.js.map → copy-menu-TIKvPaAZ.js.map} +1 -1
  237. package/dist/hooks/use-intersection-observer.d.ts.map +1 -1
  238. package/dist/hooks/use-mutation-observer.d.ts.map +1 -1
  239. package/dist/hooks/use-slider-input.d.ts.map +1 -1
  240. package/package.json +5 -5
@@ -1 +1 @@
1
- {"version":3,"file":"message-bubble.js","names":[],"sources":["../../../src/components/agents/message-bubble.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n type ComponentPropsWithRef,\n cloneElement,\n createContext,\n type ReactElement,\n type ReactNode,\n type Ref,\n useCallback,\n useContext,\n useId,\n useState,\n} from \"react\";\nimport { ChevronDown } from \"lucide-react\";\nimport { type HTMLMotionProps, motion, useReducedMotion } from \"motion/react\";\n\nimport { cn } from \"@kumix/utils\";\nimport { EASE_OUT, SPRING_LAYOUT, SPRING_SWAP } from \"../../lib/ease\";\nimport { MessageSideContext } from \"./message-context\";\n\nexport type MessageBubbleVariant = \"solid\" | \"soft\" | \"tint\" | \"outline\" | \"ghost\" | \"danger\";\nexport type MessageBubbleAlign = \"start\" | \"end\";\n\ninterface MessageBubbleContextValue {\n align?: MessageBubbleAlign;\n animateIn: boolean;\n variant: MessageBubbleVariant;\n}\n\nconst MessageBubbleContext = createContext<MessageBubbleContextValue>({\n animateIn: true,\n variant: \"soft\",\n});\nconst MessageBubbleLayoutContext = createContext<() => void>(() => {});\n\nexport interface MessageBubbleProps extends Omit<HTMLMotionProps<\"div\">, \"children\"> {\n variant?: MessageBubbleVariant;\n /** Defaults to the surrounding Message alignment when omitted. */\n align?: MessageBubbleAlign;\n /** Plays the bubble entrance once when this component mounts. */\n animateIn?: boolean;\n children?: ReactNode;\n}\n\nexport interface MessageBubbleContentProps extends ComponentPropsWithRef<\"div\"> {\n /** Replaces the content element while preserving bubble styling. */\n render?: ReactElement;\n}\n\nexport interface MessageBubbleGroupProps extends ComponentPropsWithRef<\"div\"> {\n spacing?: \"compact\" | \"default\";\n}\n\nexport interface MessageBubbleCollapsibleProps extends ComponentPropsWithRef<\"div\"> {\n open?: boolean;\n defaultOpen?: boolean;\n onOpenChange?: (open: boolean) => void;\n collapsedLines?: 2 | 3 | 4 | 5 | 6;\n moreLabel?: ReactNode;\n lessLabel?: ReactNode;\n contentClassName?: string;\n triggerClassName?: string;\n children?: ReactNode;\n}\n\nfunction mergeRefs<T>(...refs: Array<Ref<T> | undefined>) {\n return (node: T | null) => {\n for (const ref of refs) {\n if (typeof ref === \"function\") ref(node);\n else if (ref) ref.current = node;\n }\n };\n}\n\nconst BUBBLE_CONTENT_REVEAL = {\n duration: 0.12,\n ease: EASE_OUT,\n delay: 0.04,\n} as const;\n\n// Sent bubbles should pop into place quickly with one restrained overshoot.\nconst BUBBLE_POP = {\n type: \"spring\",\n stiffness: 520,\n damping: 27,\n mass: 0.52,\n} as const;\n\nexport function MessageBubble({\n variant = \"soft\",\n align,\n animateIn = false,\n className,\n children,\n initial,\n animate,\n exit,\n transition,\n layout,\n ...props\n}: MessageBubbleProps) {\n const reduce = useReducedMotion() ?? false;\n const messageSide = useContext(MessageSideContext);\n const resolvedAlign = align ?? messageSide ?? \"start\";\n\n return (\n <MessageBubbleContext.Provider value={{ align: resolvedAlign, animateIn, variant }}>\n <motion.div\n data-slot=\"message-bubble\"\n data-align={resolvedAlign}\n data-variant={variant}\n layout={layout}\n initial={initial ?? false}\n animate={animate}\n exit={exit ?? (reduce ? { opacity: 0 } : { opacity: 0, y: -3, scale: 0.99 })}\n transition={transition ?? (reduce ? { duration: 0.12 } : SPRING_LAYOUT)}\n className={cn(\n \"group/bubble flex w-full flex-col\",\n resolvedAlign === \"end\" ? \"items-end\" : \"items-start\",\n className,\n )}\n {...props}\n >\n {children}\n </motion.div>\n </MessageBubbleContext.Provider>\n );\n}\n\nfunction bubbleContentClass(variant: MessageBubbleVariant, interactive: boolean) {\n return cn(\n \"relative z-0 min-w-9 max-w-[82%] rounded-2xl px-3.5 py-2.5 text-foreground text-sm leading-6\",\n \"[&_a]:font-medium [&_a]:underline [&_a]:underline-offset-4 [&_code]:rounded [&_code]:bg-background/60 [&_code]:px-1 [&_code]:py-0.5 [&_code]:font-mono [&_code]:text-[0.9em] [&_ol]:my-2 [&_ol]:list-decimal [&_ol]:pl-5 [&_p+p]:mt-2 [&_pre]:my-2 [&_pre]:overflow-x-auto [&_pre]:rounded-xl [&_pre]:bg-background/60 [&_pre]:p-3 [&_ul]:my-2 [&_ul]:list-disc [&_ul]:pl-5\",\n variant === \"solid\" && \"text-background\",\n variant === \"ghost\" && \"w-full max-w-none rounded-none px-0 py-0\",\n variant === \"danger\" && \"text-destructive\",\n interactive &&\n \"cursor-pointer text-left outline-none transition-[background-color,color,transform] duration-150 hover:brightness-[0.98] focus-visible:ring-2 focus-visible:ring-ring active:scale-[0.99]\",\n );\n}\n\nfunction bubbleSurfaceClass(variant: MessageBubbleVariant, align: MessageBubbleAlign) {\n return cn(\n \"pointer-events-none absolute inset-0 -z-10 rounded-[inherit]\",\n align === \"end\" ? \"origin-bottom-right\" : \"origin-bottom-left\",\n variant === \"solid\" && \"bg-foreground\",\n variant === \"soft\" && \"bg-muted\",\n variant === \"tint\" && \"bg-primary/10\",\n variant === \"outline\" && \"border border-border/70 bg-background\",\n variant === \"danger\" && \"bg-destructive/10\",\n );\n}\n\nexport function MessageBubbleContent({\n render,\n className,\n children,\n ref,\n ...props\n}: MessageBubbleContentProps) {\n const reduce = useReducedMotion() ?? false;\n const { align = \"start\", animateIn, variant } = useContext(MessageBubbleContext);\n const [layoutVersion, setLayoutVersion] = useState(0);\n const notifyLayout = useCallback(() => setLayoutVersion((version) => version + 1), []);\n const interactive = render?.type === \"button\" || render?.type === \"a\";\n const classes = cn(bubbleContentClass(variant, interactive), className);\n const composedChildren = (\n <>\n {variant !== \"ghost\" ? (\n <motion.span\n aria-hidden=\"true\"\n layout={reduce ? false : \"size\"}\n layoutDependency={layoutVersion}\n initial={\n animateIn && !reduce\n ? {\n opacity: 0,\n scale: 0.92,\n }\n : false\n }\n animate={{ opacity: 1, scale: 1 }}\n transition={\n reduce\n ? { duration: 0 }\n : {\n opacity: { duration: 0.12, ease: EASE_OUT },\n scale: BUBBLE_POP,\n layout: SPRING_LAYOUT,\n }\n }\n className={bubbleSurfaceClass(variant, align)}\n />\n ) : null}\n <MessageBubbleLayoutContext.Provider value={notifyLayout}>\n <motion.div\n initial={animateIn ? (reduce ? { opacity: 0 } : { opacity: 0 }) : false}\n animate={{ opacity: 1 }}\n transition={reduce ? { duration: 0.12, ease: EASE_OUT } : BUBBLE_CONTENT_REVEAL}\n className=\"relative\"\n >\n {children}\n </motion.div>\n </MessageBubbleLayoutContext.Provider>\n </>\n );\n\n if (render) {\n const child = render as ReactElement<\n Record<string, unknown> & { className?: string; ref?: Ref<HTMLElement> }\n >;\n\n return cloneElement(child, {\n ...props,\n ref: mergeRefs(child.props.ref, ref as Ref<HTMLElement> | undefined),\n className: cn(classes, child.props.className),\n children: composedChildren,\n \"data-slot\": \"message-bubble-content\",\n });\n }\n\n return (\n <div ref={ref} data-slot=\"message-bubble-content\" className={classes} {...props}>\n {composedChildren}\n </div>\n );\n}\n\nexport function MessageBubbleGroup({\n spacing = \"compact\",\n className,\n ...props\n}: MessageBubbleGroupProps) {\n return (\n <div\n data-slot=\"message-bubble-group\"\n className={cn(\"flex w-full flex-col\", spacing === \"compact\" ? \"gap-1.5\" : \"gap-3\", className)}\n {...props}\n />\n );\n}\n\nconst LINE_CLAMP_CLASS = {\n 2: \"line-clamp-2\",\n 3: \"line-clamp-3\",\n 4: \"line-clamp-4\",\n 5: \"line-clamp-5\",\n 6: \"line-clamp-6\",\n} as const;\n\nexport function MessageBubbleCollapsible({\n open,\n defaultOpen = false,\n onOpenChange,\n collapsedLines = 4,\n moreLabel = \"Show more\",\n lessLabel = \"Show less\",\n contentClassName,\n triggerClassName,\n className,\n children,\n ...props\n}: MessageBubbleCollapsibleProps) {\n const reduce = useReducedMotion() ?? false;\n const contentId = useId();\n const notifyLayout = useContext(MessageBubbleLayoutContext);\n const [internalOpen, setInternalOpen] = useState(defaultOpen);\n const currentOpen = open ?? internalOpen;\n\n const setOpen = useCallback(\n (next: boolean) => {\n notifyLayout();\n if (open === undefined) setInternalOpen(next);\n onOpenChange?.(next);\n },\n [notifyLayout, onOpenChange, open],\n );\n\n return (\n <div\n data-slot=\"message-bubble-collapsible\"\n data-state={currentOpen ? \"open\" : \"closed\"}\n className={cn(\"w-full\", className)}\n {...props}\n >\n <div\n id={contentId}\n className={cn(\n \"transition-[mask-image] duration-200\",\n !currentOpen && LINE_CLAMP_CLASS[collapsedLines],\n !currentOpen && \"mask-[linear-gradient(to_bottom,#000_68%,transparent_100%)]\",\n contentClassName,\n )}\n >\n {children}\n </div>\n <button\n type=\"button\"\n aria-expanded={currentOpen}\n aria-controls={contentId}\n onClick={() => setOpen(!currentOpen)}\n className={cn(\n \"mt-2 inline-flex h-7 items-center gap-1 rounded-full px-2 font-medium text-muted-foreground text-xs outline-none transition-colors hover:bg-muted hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring\",\n triggerClassName,\n )}\n >\n <span>{currentOpen ? lessLabel : moreLabel}</span>\n <motion.span\n aria-hidden=\"true\"\n animate={{ rotate: currentOpen ? 180 : 0 }}\n transition={reduce ? { duration: 0 } : SPRING_SWAP}\n >\n <ChevronDown className=\"size-3.5\" />\n </motion.span>\n </button>\n </div>\n );\n}\n"],"mappings":";;;;;;;;;AA8BA,MAAM,uBAAuB,cAAyC;CACpE,WAAW;CACX,SAAS;AACX,CAAC;AACD,MAAM,6BAA6B,oBAAgC,CAAC,CAAC;AAgCrE,SAAS,UAAa,GAAG,MAAiC;CACxD,QAAQ,SAAmB;EACzB,KAAK,MAAM,OAAO,MAChB,IAAI,OAAO,QAAQ,YAAY,IAAI,IAAI;OAClC,IAAI,KAAK,IAAI,UAAU;CAEhC;AACF;AAEA,MAAM,wBAAwB;CAC5B,UAAU;CACV,MAAM;CACN,OAAO;AACT;AAGA,MAAM,aAAa;CACjB,MAAM;CACN,WAAW;CACX,SAAS;CACT,MAAM;AACR;AAEA,SAAgB,cAAc,EAC5B,UAAU,QACV,OACA,YAAY,OACZ,WACA,UACA,SACA,SACA,MACA,YACA,QACA,GAAG,SACkB;CACrB,MAAM,SAAS,iBAAiB,KAAK;CACrC,MAAM,cAAc,WAAW,kBAAkB;CACjD,MAAM,gBAAgB,SAAS,eAAe;CAE9C,OACE,oBAAC,qBAAqB,UAAtB;EAA+B,OAAO;GAAE,OAAO;GAAe;GAAW;EAAQ;EAC/E,UAAA,oBAAC,OAAO,KAAR;GACE,aAAU;GACV,cAAY;GACZ,gBAAc;GACN;GACR,SAAS,WAAW;GACX;GACT,MAAM,SAAS,SAAS,EAAE,SAAS,EAAE,IAAI;IAAE,SAAS;IAAG,GAAG;IAAI,OAAO;GAAK;GAC1E,YA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CACrB,GACA;EAAC;EAAc;EAAc;CAAI,CACnC;CAEA,OACE,qBAAC,OAAD;EACE,aAAU;EACV,cAAY,cAAc,SAAS;EACnC,WAAW,GAAG,UAAU,SAAS;EACjC,GAAI;EAJN,UAAA,CAME,oBAAC,OAAD;GACE,IAAI;GACJ,WAAW,GACT,wCACA,CAAC,eAAe,iBAAiB,iBACjC,CAAC,eAAe,+DAChB,gBACF;GAEC;EACE,CAAA,GACL,qBAAC,UAAD;GACE,MAAK;GACL,iBAAe;GACf,iBAAe;GACf,eAAe,QAAQ,CAAC,WAAW;GACnC,WAAW,GACT,wNACA,gBACF;GARF,UAAA,CAUE,oBAAC,QAAD,EAAA,UAAO,cAAc,YAAY,UAAgB,CAAA,GACjD,oBAAC,OAAO,MAAR;IACE,eAAY;IACZ,SAAS,EAAE,QAAQ,cAAc,MAAM,EAAE;IACzC,YAAY,SAAS,EAAE,UAAU,EAAE,IAAI;IAEvC,UAAA,oBAAC,aAAD,EAAa,WAAU,WAAY,CAAA;GACxB,CAAA,CACP;EACL,CAAA,CAAA;;AAET"}
1
+ {"version":3,"file":"message-bubble.js","names":[],"sources":["../../../src/components/agents/message-bubble.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n type ComponentPropsWithRef,\n cloneElement,\n createContext,\n type ReactElement,\n type ReactNode,\n type Ref,\n useCallback,\n useContext,\n useId,\n useState,\n} from \"react\";\nimport { ChevronDown } from \"lucide-react\";\nimport { type HTMLMotionProps, motion, useReducedMotion } from \"motion/react\";\n\nimport { cn } from \"@kumix/utils\";\nimport { EASE_OUT, SPRING_LAYOUT, SPRING_SWAP } from \"../../lib/ease\";\nimport { MessageSideContext } from \"./message-context\";\n\nexport type MessageBubbleVariant = \"solid\" | \"soft\" | \"tint\" | \"outline\" | \"ghost\" | \"danger\";\nexport type MessageBubbleAlign = \"start\" | \"end\";\n\ninterface MessageBubbleContextValue {\n align?: MessageBubbleAlign;\n animateIn: boolean;\n variant: MessageBubbleVariant;\n}\n\nconst MessageBubbleContext = createContext<MessageBubbleContextValue>({\n animateIn: true,\n variant: \"soft\",\n});\nconst MessageBubbleLayoutContext = createContext<() => void>(() => {});\n\nexport interface MessageBubbleProps extends Omit<HTMLMotionProps<\"div\">, \"children\"> {\n variant?: MessageBubbleVariant;\n /** Defaults to the surrounding Message alignment when omitted. */\n align?: MessageBubbleAlign;\n /** Plays the bubble entrance once when this component mounts. */\n animateIn?: boolean;\n children?: ReactNode;\n}\n\nexport interface MessageBubbleContentProps extends ComponentPropsWithRef<\"div\"> {\n /** Replaces the content element while preserving bubble styling. */\n render?: ReactElement;\n}\n\nexport interface MessageBubbleGroupProps extends ComponentPropsWithRef<\"div\"> {\n spacing?: \"compact\" | \"default\";\n}\n\nexport interface MessageBubbleCollapsibleProps extends ComponentPropsWithRef<\"div\"> {\n open?: boolean;\n defaultOpen?: boolean;\n onOpenChange?: (open: boolean) => void;\n collapsedLines?: 2 | 3 | 4 | 5 | 6;\n moreLabel?: ReactNode;\n lessLabel?: ReactNode;\n contentClassName?: string;\n triggerClassName?: string;\n children?: ReactNode;\n}\n\nfunction mergeRefs<T>(...refs: Array<Ref<T> | undefined>) {\n return (node: T | null) => {\n for (const ref of refs) {\n if (typeof ref === \"function\") ref(node);\n else if (ref) ref.current = node;\n }\n };\n}\n\nconst BUBBLE_CONTENT_REVEAL = {\n duration: 0.12,\n ease: EASE_OUT,\n delay: 0.04,\n} as const;\n\n// Sent bubbles should pop into place quickly with one restrained overshoot.\nconst BUBBLE_POP = {\n type: \"spring\",\n stiffness: 520,\n damping: 27,\n mass: 0.52,\n} as const;\n\nexport function MessageBubble({\n variant = \"soft\",\n align,\n animateIn = false,\n className,\n children,\n initial,\n animate,\n exit,\n transition,\n layout,\n ...props\n}: MessageBubbleProps) {\n const reduce = useReducedMotion() ?? false;\n const messageSide = useContext(MessageSideContext);\n const resolvedAlign = align ?? messageSide ?? \"start\";\n\n return (\n <MessageBubbleContext.Provider value={{ align: resolvedAlign, animateIn, variant }}>\n <motion.div\n data-slot=\"message-bubble\"\n data-align={resolvedAlign}\n data-variant={variant}\n layout={layout}\n initial={initial ?? false}\n animate={animate}\n exit={exit ?? (reduce ? { opacity: 0 } : { opacity: 0, y: -3, scale: 0.99 })}\n transition={transition ?? (reduce ? { duration: 0.12 } : SPRING_LAYOUT)}\n className={cn(\n \"group/bubble flex w-full flex-col\",\n resolvedAlign === \"end\" ? \"items-end\" : \"items-start\",\n className,\n )}\n {...props}\n >\n {children}\n </motion.div>\n </MessageBubbleContext.Provider>\n );\n}\n\nfunction bubbleContentClass(variant: MessageBubbleVariant, interactive: boolean) {\n return cn(\n \"relative z-0 min-w-9 max-w-[82%] rounded-2xl px-3.5 py-2.5 text-foreground text-sm leading-6\",\n \"[&_a]:font-medium [&_a]:underline [&_a]:underline-offset-4 [&_code]:rounded [&_code]:bg-background/60 [&_code]:px-1 [&_code]:py-0.5 [&_code]:font-mono [&_code]:text-[0.9em] [&_ol]:my-2 [&_ol]:list-decimal [&_ol]:pl-5 [&_p+p]:mt-2 [&_pre]:my-2 [&_pre]:overflow-x-auto [&_pre]:rounded-xl [&_pre]:bg-background/60 [&_pre]:p-3 [&_ul]:my-2 [&_ul]:list-disc [&_ul]:pl-5\",\n variant === \"solid\" && \"text-background\",\n variant === \"ghost\" && \"w-full max-w-none rounded-none px-0 py-0\",\n variant === \"danger\" && \"text-destructive\",\n interactive &&\n \"cursor-pointer text-left outline-none transition-[background-color,color,transform] duration-150 hover:brightness-[0.98] focus-visible:ring-2 focus-visible:ring-ring active:scale-[0.99]\",\n );\n}\n\nfunction bubbleSurfaceClass(variant: MessageBubbleVariant, align: MessageBubbleAlign) {\n return cn(\n \"pointer-events-none absolute inset-0 -z-10 rounded-[inherit]\",\n align === \"end\" ? \"origin-bottom-right\" : \"origin-bottom-left\",\n variant === \"solid\" && \"bg-foreground\",\n variant === \"soft\" && \"bg-muted\",\n variant === \"tint\" && \"bg-muted\",\n variant === \"outline\" && \"border border-border/70 bg-background\",\n variant === \"danger\" && \"bg-destructive/10\",\n );\n}\n\nexport function MessageBubbleContent({\n render,\n className,\n children,\n ref,\n ...props\n}: MessageBubbleContentProps) {\n const reduce = useReducedMotion() ?? false;\n const { align = \"start\", animateIn, variant } = useContext(MessageBubbleContext);\n const [layoutVersion, setLayoutVersion] = useState(0);\n const notifyLayout = useCallback(() => setLayoutVersion((version) => version + 1), []);\n const interactive = render?.type === \"button\" || render?.type === \"a\";\n const classes = cn(bubbleContentClass(variant, interactive), className);\n const composedChildren = (\n <>\n {variant !== \"ghost\" ? (\n <motion.span\n aria-hidden=\"true\"\n layout={reduce ? false : \"size\"}\n layoutDependency={layoutVersion}\n initial={\n animateIn && !reduce\n ? {\n opacity: 0,\n scale: 0.92,\n }\n : false\n }\n animate={{ opacity: 1, scale: 1 }}\n transition={\n reduce\n ? { duration: 0 }\n : {\n opacity: { duration: 0.12, ease: EASE_OUT },\n scale: BUBBLE_POP,\n layout: SPRING_LAYOUT,\n }\n }\n className={bubbleSurfaceClass(variant, align)}\n />\n ) : null}\n <MessageBubbleLayoutContext.Provider value={notifyLayout}>\n <motion.div\n initial={animateIn ? (reduce ? { opacity: 0 } : { opacity: 0 }) : false}\n animate={{ opacity: 1 }}\n transition={reduce ? { duration: 0.12, ease: EASE_OUT } : BUBBLE_CONTENT_REVEAL}\n className=\"relative\"\n >\n {children}\n </motion.div>\n </MessageBubbleLayoutContext.Provider>\n </>\n );\n\n if (render) {\n const child = render as ReactElement<\n Record<string, unknown> & { className?: string; ref?: Ref<HTMLElement> }\n >;\n\n return cloneElement(child, {\n ...props,\n ref: mergeRefs(child.props.ref, ref as Ref<HTMLElement> | undefined),\n className: cn(classes, child.props.className),\n children: composedChildren,\n \"data-slot\": \"message-bubble-content\",\n });\n }\n\n return (\n <div ref={ref} data-slot=\"message-bubble-content\" className={classes} {...props}>\n {composedChildren}\n </div>\n );\n}\n\nexport function MessageBubbleGroup({\n spacing = \"compact\",\n className,\n ...props\n}: MessageBubbleGroupProps) {\n return (\n <div\n data-slot=\"message-bubble-group\"\n className={cn(\"flex w-full flex-col\", spacing === \"compact\" ? \"gap-1.5\" : \"gap-3\", className)}\n {...props}\n />\n );\n}\n\nconst LINE_CLAMP_CLASS = {\n 2: \"line-clamp-2\",\n 3: \"line-clamp-3\",\n 4: \"line-clamp-4\",\n 5: \"line-clamp-5\",\n 6: \"line-clamp-6\",\n} as const;\n\nexport function MessageBubbleCollapsible({\n open,\n defaultOpen = false,\n onOpenChange,\n collapsedLines = 4,\n moreLabel = \"Show more\",\n lessLabel = \"Show less\",\n contentClassName,\n triggerClassName,\n className,\n children,\n ...props\n}: MessageBubbleCollapsibleProps) {\n const reduce = useReducedMotion() ?? false;\n const contentId = useId();\n const notifyLayout = useContext(MessageBubbleLayoutContext);\n const [internalOpen, setInternalOpen] = useState(defaultOpen);\n const currentOpen = open ?? internalOpen;\n\n const setOpen = useCallback(\n (next: boolean) => {\n notifyLayout();\n if (open === undefined) setInternalOpen(next);\n onOpenChange?.(next);\n },\n [notifyLayout, onOpenChange, open],\n );\n\n return (\n <div\n data-slot=\"message-bubble-collapsible\"\n data-state={currentOpen ? \"open\" : \"closed\"}\n className={cn(\"w-full\", className)}\n {...props}\n >\n <div\n id={contentId}\n className={cn(\n \"transition-[mask-image] duration-200\",\n !currentOpen && LINE_CLAMP_CLASS[collapsedLines],\n !currentOpen && \"mask-[linear-gradient(to_bottom,#000_68%,transparent_100%)]\",\n contentClassName,\n )}\n >\n {children}\n </div>\n <button\n type=\"button\"\n aria-expanded={currentOpen}\n aria-controls={contentId}\n onClick={() => setOpen(!currentOpen)}\n className={cn(\n \"mt-2 inline-flex h-7 items-center gap-1 rounded-full px-2 font-medium text-muted-foreground text-xs outline-none transition-colors hover:bg-muted hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring\",\n triggerClassName,\n )}\n >\n <span>{currentOpen ? lessLabel : moreLabel}</span>\n <motion.span\n aria-hidden=\"true\"\n animate={{ rotate: currentOpen ? 180 : 0 }}\n transition={reduce ? { duration: 0 }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,qBAAC,UAAD;GACE,MAAK;GACL,iBAAe;GACf,iBAAe;GACf,eAAe,QAAQ,CAAC,WAAW;GACnC,WAAW,GACT,wNACA,gBACF;GARF,UAAA,CAUE,oBAAC,QAAD,EAAA,UAAO,cAAc,YAAY,UAAgB,CAAA,GACjD,oBAAC,OAAO,MAAR;IACE,eAAY;IACZ,SAAS,EAAE,QAAQ,cAAc,MAAM,EAAE;IACzC,YAAY,SAAS,EAAE,UAAU,EAAE,IAAI;IAEvC,UAAA,oBAAC,aAAD,EAAa,WAAU,WAAY,CAAA;GACxB,CAAA,CACP;EACL,CAAA,CAAA;;AAET"}
@@ -6,9 +6,9 @@ import "../motion/button/index.js";
6
6
  import { Select, SelectContent, SelectItem, SelectTrigger } from "../motion/select.js";
7
7
  import { useCallback, useEffect, useLayoutEffect, useRef, useState } from "react";
8
8
  import { cn } from "@kumix/utils";
9
+ import { ArrowUp, Plus, Square } from "lucide-react";
9
10
  import { jsx, jsxs } from "react/jsx-runtime";
10
11
  import { AnimatePresence, motion, useReducedMotion } from "motion/react";
11
- import { ArrowUp, Plus, Square } from "lucide-react";
12
12
  //#region src/components/agents/prompt-input.tsx
13
13
  function PromptInput({ value, defaultValue = "", onValueChange, models = [], model, defaultModel, onModelChange, actions = [], onAction, onSubmit, loading = false, onStop, minRows = 2, maxRows = 8, leadingAction, className, disabled, placeholder = "Ask the agent to do something…", "aria-label": ariaLabel = "Prompt", onKeyDown, ...textareaProps }) {
14
14
  const reduce = useReducedMotion() ?? false;
@@ -4,9 +4,9 @@ import { AgentDisclosure } from "./agent-disclosure.js";
4
4
  import { CitationList, CitationStack } from "./citations.js";
5
5
  import { useCallback, useEffect, useId, useRef, useState } from "react";
6
6
  import { cn } from "@kumix/utils";
7
+ import { Check, ChevronDown, Copy, RotateCcw, ThumbsDown, ThumbsUp } from "lucide-react";
7
8
  import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
8
9
  import { AnimatePresence, motion, useReducedMotion } from "motion/react";
9
- import { Check, ChevronDown, Copy, RotateCcw, ThumbsDown, ThumbsUp } from "lucide-react";
10
10
  //#region src/components/agents/streaming-response.tsx
11
11
  function ResponseAction({ label, active = false, onClick, children }) {
12
12
  const reduce = useReducedMotion() ?? false;
@@ -4,9 +4,9 @@ import { AgentDisclosure } from "./agent-disclosure.js";
4
4
  import { ActionSwapRollText } from "../motion/action-swap-roll.js";
5
5
  import { useCallback, useEffect, useId, useLayoutEffect, useRef, useState } from "react";
6
6
  import { cn } from "@kumix/utils";
7
+ import { ChevronDown, ListTodo } from "lucide-react";
7
8
  import { jsx, jsxs } from "react/jsx-runtime";
8
9
  import { AnimatePresence, motion, useReducedMotion } from "motion/react";
9
- import { ChevronDown, ListTodo } from "lucide-react";
10
10
  //#region src/components/agents/todo-list.tsx
11
11
  function statusLabel(status) {
12
12
  if (status === "in-progress") return "In progress";
@@ -4,9 +4,9 @@ import { AgentCode } from "./agent-code.js";
4
4
  import { AgentDisclosure } from "./agent-disclosure.js";
5
5
  import { useCallback, useEffect, useId, useRef, useState } from "react";
6
6
  import { cn } from "@kumix/utils";
7
+ import { Check, ChevronDown, CircleAlert, LoaderCircle, ShieldCheck, X } from "lucide-react";
7
8
  import { jsx, jsxs } from "react/jsx-runtime";
8
9
  import { AnimatePresence, motion, useReducedMotion } from "motion/react";
9
- import { Check, ChevronDown, CircleAlert, LoaderCircle, ShieldCheck, X } from "lucide-react";
10
10
  //#region src/components/agents/tool-approval.tsx
11
11
  function getStatusCopy(status) {
12
12
  if (status === "approving") return "Approving";
@@ -5,9 +5,9 @@ import { AgentDisclosure } from "./agent-disclosure.js";
5
5
  import { ActionSwapRollText } from "../motion/action-swap-roll.js";
6
6
  import { useCallback, useEffect, useId, useLayoutEffect, useRef, useState } from "react";
7
7
  import { cn } from "@kumix/utils";
8
+ import { Ban, Braces, Check, ChevronDown, CircleCheck, CircleX, Copy, LoaderCircle, RotateCcw, SquareTerminal, Wrench } from "lucide-react";
8
9
  import { jsx, jsxs } from "react/jsx-runtime";
9
10
  import { motion, useReducedMotion } from "motion/react";
10
- import { Ban, Braces, Check, ChevronDown, CircleCheck, CircleX, Copy, LoaderCircle, RotateCcw, SquareTerminal, Wrench } from "lucide-react";
11
11
  //#region src/components/agents/tool-result.tsx
12
12
  function getStatusLabel(status) {
13
13
  if (status === "running") return "Running";
@@ -1,8 +1,8 @@
1
1
  "use client";
2
2
  import { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogMedia, AlertDialogTitle } from "../ui/alert-dialog.js";
3
3
  import { Spinner } from "../ui/spinner.js";
4
- import { jsx, jsxs } from "react/jsx-runtime";
5
4
  import { CircleAlertIcon, ShieldQuestionMarkIcon } from "lucide-react";
5
+ import { jsx, jsxs } from "react/jsx-runtime";
6
6
  //#region src/components/custom/confirm-dialog.tsx
7
7
  function ConfirmDialog({ open, onOpenChange, onConfirm, title, description, confirmText, cancelText, loading = false }) {
8
8
  return /* @__PURE__ */ jsx(AlertDialog, {
@@ -126,8 +126,8 @@ const ICON_VARIANTS = {
126
126
  const VARIANT_CLASS = {
127
127
  primary: "bg-primary text-primary-foreground hover:bg-primary/90",
128
128
  secondary: "border border-border bg-card text-foreground hover:border-border",
129
- outline: "border border-border bg-transparent text-foreground hover:bg-primary/5",
130
- ghost: "text-muted-foreground hover:bg-primary/5 hover:text-foreground"
129
+ outline: "border border-border bg-transparent text-foreground hover:bg-muted/60",
130
+ ghost: "text-muted-foreground hover:bg-muted/60 hover:text-foreground"
131
131
  };
132
132
  const SIZE_CLASS = {
133
133
  sm: "h-8 gap-1.5 rounded-full px-3 text-xs",
@@ -1 +1 @@
1
- {"version":3,"file":"action-swap.js","names":[],"sources":["../../../src/components/motion/action-swap.tsx"],"sourcesContent":["\"use client\";\n\nimport type { ReactNode } from \"react\";\nimport { useState } from \"react\";\nimport {\n AnimatePresence,\n type HTMLMotionProps,\n motion,\n useReducedMotion,\n type Variants,\n} from \"motion/react\";\n\nimport { cn } from \"@kumix/utils\";\nimport { EASE_OUT, SPRING_PRESS, SPRING_SWAP } from \"../../lib/ease\";\n\nexport type ActionSwapItem = {\n id: string;\n label: ReactNode;\n icon?: ReactNode;\n ariaLabel?: string;\n};\n\nexport type ActionSwapButtonVariant = \"primary\" | \"secondary\" | \"outline\" | \"ghost\";\nexport type ActionSwapButtonSize = \"sm\" | \"md\" | \"lg\" | \"icon\";\nexport type ActionSwapAnimation = \"blur\" | \"roll\" | \"cascade\";\n\n/** Animations with a single-element variant set (cascade animates per letter). */\ntype CoreAnimation = \"blur\" | \"roll\";\n\nexport interface ActionSwapButtonProps\n extends Omit<HTMLMotionProps<\"button\">, \"children\" | \"onChange\"> {\n items: ActionSwapItem[];\n value?: string;\n defaultValue?: string;\n onValueChange?: (value: string, item: ActionSwapItem) => void;\n variant?: ActionSwapButtonVariant;\n size?: ActionSwapButtonSize;\n animation?: ActionSwapAnimation;\n iconOnly?: boolean;\n cycle?: boolean;\n}\n\nexport interface ActionSwapTextProps {\n value: string;\n children: ReactNode;\n animation?: ActionSwapAnimation;\n className?: string;\n}\n\nexport interface ActionSwapIconProps {\n value: string;\n children: ReactNode;\n animation?: ActionSwapAnimation;\n className?: string;\n}\n\nconst BLUR_TRANSITION = { duration: 0.2, ease: \"easeInOut\" } as const;\nconst ROLL_TRANSITION = SPRING_SWAP;\nconst ROLL_EXIT_TRANSITION = { duration: 0.14, ease: EASE_OUT } as const;\nconst SWAP_BLUR = \"blur(8px)\";\nconst ROLL_BLUR = \"blur(3px)\";\n\n// Cascade rolls the label one letter at a time, left to right. The leaving\n// and landing strings overlap as independent layers (no shared cells), so\n// proportional glyph widths never jitter. Exits cascade at half the enter\n// stagger so the tail of the old label lingers briefly.\nconst CASCADE_STAGGER = 0.025;\n\nconst CASCADE_LETTER_VARIANTS: Variants = {\n initial: { opacity: 0, y: \"105%\", filter: ROLL_BLUR },\n animate: (delay: number = 0) => ({\n opacity: 1,\n y: \"0%\",\n filter: \"blur(0px)\",\n transition: { ...SPRING_SWAP, delay },\n }),\n exit: (delay: number = 0) => ({\n opacity: 0,\n y: \"-105%\",\n filter: ROLL_BLUR,\n transition: { duration: 0.16, ease: EASE_OUT, delay: delay * 0.5 },\n }),\n};\n\nconst TEXT_VARIANTS: Record<CoreAnimation, Variants> = {\n blur: {\n initial: { opacity: 0, scale: 0.94, filter: SWAP_BLUR },\n animate: {\n opacity: 1,\n scale: 1,\n filter: \"blur(0px)\",\n transition: BLUR_TRANSITION,\n },\n exit: {\n opacity: 0,\n scale: 0.94,\n filter: SWAP_BLUR,\n transition: BLUR_TRANSITION,\n },\n },\n roll: {\n initial: { opacity: 0, y: \"90%\", filter: ROLL_BLUR },\n animate: {\n opacity: 1,\n y: \"0%\",\n filter: \"blur(0px)\",\n transition: ROLL_TRANSITION,\n },\n exit: {\n opacity: 0,\n y: \"-90%\",\n filter: ROLL_BLUR,\n transition: ROLL_EXIT_TRANSITION,\n },\n },\n};\n\nconst ICON_VARIANTS: Record<CoreAnimation, Variants> = {\n blur: {\n initial: { opacity: 0, scale: 0.25, filter: SWAP_BLUR },\n animate: {\n opacity: 1,\n scale: 1,\n filter: \"blur(0px)\",\n transition: BLUR_TRANSITION,\n },\n exit: {\n opacity: 0,\n scale: 0.25,\n filter: SWAP_BLUR,\n transition: BLUR_TRANSITION,\n },\n },\n roll: {\n initial: { opacity: 0, y: 12, filter: ROLL_BLUR },\n animate: {\n opacity: 1,\n y: 0,\n filter: \"blur(0px)\",\n transition: ROLL_TRANSITION,\n },\n exit: {\n opacity: 0,\n y: -12,\n filter: ROLL_BLUR,\n transition: ROLL_EXIT_TRANSITION,\n },\n },\n};\n\nconst VARIANT_CLASS: Record<ActionSwapButtonVariant, string> = {\n primary: \"bg-primary text-primary-foreground hover:bg-primary/90\",\n secondary: \"border border-border bg-card text-foreground hover:border-border\",\n outline: \"border border-border bg-transparent text-foreground hover:bg-primary/5\",\n ghost: \"text-muted-foreground hover:bg-primary/5 hover:text-foreground\",\n};\n\nconst SIZE_CLASS: Record<ActionSwapButtonSize, string> = {\n sm: \"h-8 gap-1.5 rounded-full px-3 text-xs\",\n md: \"h-10 gap-2 rounded-full px-4 text-sm\",\n lg: \"h-12 gap-2.5 rounded-full px-5 text-base\",\n icon: \"h-10 w-10 rounded-full\",\n};\n\nexport function ActionSwapText({\n value,\n children,\n animation = \"blur\",\n className,\n}: ActionSwapTextProps) {\n const reduce = useReducedMotion();\n\n // Cascade needs a plain string to split into letters; non-string content\n // and reduced motion fall back to the closest single-element animation.\n const label = typeof children === \"string\" ? children : null;\n const cascade = animation === \"cascade\" && label !== null && !reduce;\n const coreAnimation: CoreAnimation = animation === \"cascade\" ? \"roll\" : animation;\n\n return (\n <span\n className={cn(\n \"relative -my-[0.08em] inline-block max-w-full whitespace-nowrap py-[0.08em] align-bottom\",\n className,\n )}\n style={{\n clipPath: \"inset(0 -999px)\",\n WebkitClipPath: \"inset(0 -999px)\",\n }}\n >\n <span aria-hidden className=\"invisible inline-block whitespace-nowrap\">\n {cascade\n ? label.split(\"\").map((char, index) => (\n <span key={index} className=\"inline-block whitespace-pre\">\n {char}\n </span>\n ))\n : children}\n </span>\n {cascade ? (\n <>\n {/* Letters are decorative fragments; readers get the whole label. */}\n <span className=\"sr-only\">{label}</span>\n <AnimatePresence initial={false}>\n <motion.span\n key={`cascade-${value}`}\n aria-hidden\n initial=\"initial\"\n animate=\"animate\"\n exit=\"exit\"\n className=\"absolute top-[0.08em] left-0 inline-block whitespace-pre\"\n >\n {label.split(\"\").map((char, i) => (\n <motion.span\n key={i}\n custom={i * CASCADE_STAGGER}\n variants={CASCADE_LETTER_VARIANTS}\n className=\"inline-block whitespace-pre will-change-[opacity,filter,transform]\"\n >\n {char}\n </motion.span>\n ))}\n </motion.span>\n </AnimatePresence>\n </>\n ) : (\n <AnimatePresence initial={false}>\n <motion.span\n key={`${animation}-${value}`}\n variants={TEXT_VARIANTS[coreAnimation]}\n initial={reduce ? false : \"initial\"}\n animate={reduce ? { opacity: 1, filter: \"blur(0px)\", scale: 1, y: 0 } : \"animate\"}\n exit={reduce ? undefined : \"exit\"}\n // Truncation lives on the layer that holds the text — the layer\n // moves as a whole, so clipping it never eats the roll.\n className=\"absolute top-[0.08em] left-0 inline-block max-w-full truncate will-change-[opacity,filter,transform]\"\n >\n {children}\n </motion.span>\n </AnimatePresence>\n )}\n </span>\n );\n}\n\nexport function ActionSwapIcon({\n value,\n children,\n animation = \"blur\",\n className,\n}: ActionSwapIconProps) {\n const reduce = useReducedMotion();\n // Icons are single elements — cascade maps to its closest motion, roll.\n const coreAnimation: CoreAnimation = animation === \"cascade\" ? \"roll\" : animation;\n\n return (\n <span\n className={cn(\"relative inline-grid shrink-0 place-items-center overflow-hidden\", className)}\n >\n <AnimatePresence mode=\"popLayout\" initial={false}>\n <motion.span\n key={`${animation}-${value}`}\n aria-hidden\n variants={ICON_VARIANTS[coreAnimation]}\n initial={reduce ? false : \"initial\"}\n animate={reduce ? { opacity: 1, filter: \"blur(0px)\", scale: 1, y: 0 } : \"animate\"}\n exit={reduce ? undefined : \"exit\"}\n className=\"col-start-1 row-start-1 inline-flex items-center justify-center will-change-[opacity,filter,transform]\"\n >\n {children}\n </motion.span>\n </AnimatePresence>\n </span>\n );\n}\n\nexport function ActionSwapButton({\n items,\n value,\n defaultValue,\n onValueChange,\n variant = \"secondary\",\n size = \"md\",\n animation = \"blur\",\n iconOnly = size === \"icon\",\n cycle = true,\n className,\n disabled,\n onClick,\n ...rest\n}: ActionSwapButtonProps) {\n const reduce = useReducedMotion();\n const [internalValue, setInternalValue] = useState(defaultValue ?? items[0]?.id);\n const currentValue = value ?? internalValue;\n const activeIndex = Math.max(\n 0,\n items.findIndex((item) => item.id === currentValue),\n );\n const activeItem = items[activeIndex] ?? items[0];\n const hasIcon = items.some((item) => item.icon);\n const nextItem = cycle && items.length > 0 ? items[(activeIndex + 1) % items.length] : undefined;\n\n if (!activeItem) return null;\n\n const accessibleLabel =\n activeItem.ariaLabel ??\n (iconOnly && typeof activeItem.label === \"string\" ? activeItem.label : undefined);\n\n return (\n <motion.button\n type=\"button\"\n disabled={disabled}\n whileTap={reduce || disabled ? undefined : { scale: 0.97 }}\n transition={SPRING_PRESS}\n className={cn(\n \"inline-flex items-center justify-center overflow-hidden font-medium transition-colors\",\n \"disabled:pointer-events-none disabled:opacity-50\",\n VARIANT_CLASS[variant],\n SIZE_CLASS[size],\n className,\n )}\n aria-label={accessibleLabel}\n onClick={(event) => {\n onClick?.(event);\n if (event.defaultPrevented || disabled || !cycle || !nextItem) return;\n if (value === undefined) setInternalValue(nextItem.id);\n onValueChange?.(nextItem.id, nextItem);\n }}\n {...rest}\n >\n {hasIcon ? (\n <ActionSwapIcon value={activeItem.id} animation={animation} className=\"h-4 w-4\">\n {activeItem.icon ?? null}\n </ActionSwapIcon>\n ) : null}\n {!iconOnly ? (\n <ActionSwapText value={activeItem.id} animation={animation}>\n {activeItem.label}\n </ActionSwapText>\n ) : null}\n </motion.button>\n );\n}\n"],"mappings":";;;;;;;AAwDA,MAAM,kBAAkB;CAAE,UAAU;CAAK,MAAM;AAAY;AAC3D,MAAM,kBAAkB;AACxB,MAAM,uBAAuB;CAAE,UAAU;CAAM,MAAM;AAAS;AAC9D,MAAM,YAAY;AAClB,MAAM,YAAY;AAMlB,MAAM,kBAAkB;AAExB,MAAM,0BAAoC;CACxC,SAAS;EAAE,SAAS;EAAG,GAAG;EAAQ,QAAQ;CAAU;CACpD,UAAU,QAAgB,OAAO;EAC/B,SAAS;EACT,GAAG;EACH,QAAQ;EACR,YAAY;GAAE,GAAG;GAAa;EAAM;CACtC;CACA,OAAO,QAAgB,OAAO;EAC5B,SAAS;EACT,GAAG;EACH,QAAQ;EACR,YAAY;GAAE,UAAU;GAAM,MAAM;GAAU,OAAO,QAAQ;EAAI;CACnE;AACF;AAEA,MAAM,gBAAiD;CACrD,MAAM;EACJ,SAAS;GAAE,SAAS;GAAG,OAAO;GAAM,QAAQ;EAAU;EACtD,SAAS;GACP,SAAS;GACT,OAAO;GACP,Q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D;GAAgB,OAAO,WAAW;GAAe;GAC9C,UAAA,WAAW;EACE,CAAA,IACd,IACS;;AAEnB"}
1
+ {"version":3,"file":"action-swap.js","names":[],"sources":["../../../src/components/motion/action-swap.tsx"],"sourcesContent":["\"use client\";\n\nimport type { ReactNode } from \"react\";\nimport { useState } from \"react\";\nimport {\n AnimatePresence,\n type HTMLMotionProps,\n motion,\n useReducedMotion,\n type Variants,\n} from \"motion/react\";\n\nimport { cn } from \"@kumix/utils\";\nimport { EASE_OUT, SPRING_PRESS, SPRING_SWAP } from \"../../lib/ease\";\n\nexport type ActionSwapItem = {\n id: string;\n label: ReactNode;\n icon?: ReactNode;\n ariaLabel?: string;\n};\n\nexport type ActionSwapButtonVariant = \"primary\" | \"secondary\" | \"outline\" | \"ghost\";\nexport type ActionSwapButtonSize = \"sm\" | \"md\" | \"lg\" | \"icon\";\nexport type ActionSwapAnimation = \"blur\" | \"roll\" | \"cascade\";\n\n/** Animations with a single-element variant set (cascade animates per letter). */\ntype CoreAnimation = \"blur\" | \"roll\";\n\nexport interface ActionSwapButtonProps\n extends Omit<HTMLMotionProps<\"button\">, \"children\" | \"onChange\"> {\n items: ActionSwapItem[];\n value?: string;\n defaultValue?: string;\n onValueChange?: (value: string, item: ActionSwapItem) => void;\n variant?: ActionSwapButtonVariant;\n size?: ActionSwapButtonSize;\n animation?: ActionSwapAnimation;\n iconOnly?: boolean;\n cycle?: boolean;\n}\n\nexport interface ActionSwapTextProps {\n value: string;\n children: ReactNode;\n animation?: ActionSwapAnimation;\n className?: string;\n}\n\nexport interface ActionSwapIconProps {\n value: string;\n children: ReactNode;\n animation?: ActionSwapAnimation;\n className?: string;\n}\n\nconst BLUR_TRANSITION = { duration: 0.2, ease: \"easeInOut\" } as const;\nconst ROLL_TRANSITION = SPRING_SWAP;\nconst ROLL_EXIT_TRANSITION = { duration: 0.14, ease: EASE_OUT } as const;\nconst SWAP_BLUR = \"blur(8px)\";\nconst ROLL_BLUR = \"blur(3px)\";\n\n// Cascade rolls the label one letter at a time, left to right. The leaving\n// and landing strings overlap as independent layers (no shared cells), so\n// proportional glyph widths never jitter. Exits cascade at half the enter\n// stagger so the tail of the old label lingers briefly.\nconst CASCADE_STAGGER = 0.025;\n\nconst CASCADE_LETTER_VARIANTS: Variants = {\n initial: { opacity: 0, y: \"105%\", filter: ROLL_BLUR },\n animate: (delay: number = 0) => ({\n opacity: 1,\n y: \"0%\",\n filter: \"blur(0px)\",\n transition: { ...SPRING_SWAP, delay },\n }),\n exit: (delay: number = 0) => ({\n opacity: 0,\n y: \"-105%\",\n filter: ROLL_BLUR,\n transition: { duration: 0.16, ease: EASE_OUT, delay: delay * 0.5 },\n }),\n};\n\nconst TEXT_VARIANTS: Record<CoreAnimation, Variants> = {\n blur: {\n initial: { opacity: 0, scale: 0.94, filter: SWAP_BLUR },\n animate: {\n opacity: 1,\n scale: 1,\n filter: \"blur(0px)\",\n transition: BLUR_TRANSITION,\n },\n exit: {\n opacity: 0,\n scale: 0.94,\n filter: SWAP_BLUR,\n transition: BLUR_TRANSITION,\n },\n },\n roll: {\n initial: { opacity: 0, y: \"90%\", filter: ROLL_BLUR },\n animate: {\n opacity: 1,\n y: \"0%\",\n filter: \"blur(0px)\",\n transition: ROLL_TRANSITION,\n },\n exit: {\n opacity: 0,\n y: \"-90%\",\n filter: ROLL_BLUR,\n transition: ROLL_EXIT_TRANSITION,\n },\n },\n};\n\nconst ICON_VARIANTS: Record<CoreAnimation, Variants> = {\n blur: {\n initial: { opacity: 0, scale: 0.25, filter: SWAP_BLUR },\n animate: {\n opacity: 1,\n scale: 1,\n filter: \"blur(0px)\",\n transition: BLUR_TRANSITION,\n },\n exit: {\n opacity: 0,\n scale: 0.25,\n filter: SWAP_BLUR,\n transition: BLUR_TRANSITION,\n },\n },\n roll: {\n initial: { opacity: 0, y: 12, filter: ROLL_BLUR },\n animate: {\n opacity: 1,\n y: 0,\n filter: \"blur(0px)\",\n transition: ROLL_TRANSITION,\n },\n exit: {\n opacity: 0,\n y: -12,\n filter: ROLL_BLUR,\n transition: ROLL_EXIT_TRANSITION,\n },\n },\n};\n\nconst VARIANT_CLASS: Record<ActionSwapButtonVariant, string> = {\n primary: \"bg-primary text-primary-foreground hover:bg-primary/90\",\n secondary: \"border border-border bg-card text-foreground hover:border-border\",\n outline: \"border border-border bg-transparent text-foreground hover:bg-muted/60\",\n ghost: \"text-muted-foreground hover:bg-muted/60 hover:text-foreground\",\n};\n\nconst SIZE_CLASS: Record<ActionSwapButtonSize, string> = {\n sm: \"h-8 gap-1.5 rounded-full px-3 text-xs\",\n md: \"h-10 gap-2 rounded-full px-4 text-sm\",\n lg: \"h-12 gap-2.5 rounded-full px-5 text-base\",\n icon: \"h-10 w-10 rounded-full\",\n};\n\nexport function ActionSwapText({\n value,\n children,\n animation = \"blur\",\n className,\n}: ActionSwapTextProps) {\n const reduce = useReducedMotion();\n\n // Cascade needs a plain string to split into letters; non-string content\n // and reduced motion fall back to the closest single-element animation.\n const label = typeof children === \"string\" ? children : null;\n const cascade = animation === \"cascade\" && label !== null && !reduce;\n const coreAnimation: CoreAnimation = animation === \"cascade\" ? \"roll\" : animation;\n\n return (\n <span\n className={cn(\n \"relative -my-[0.08em] inline-block max-w-full whitespace-nowrap py-[0.08em] align-bottom\",\n className,\n )}\n style={{\n clipPath: \"inset(0 -999px)\",\n WebkitClipPath: \"inset(0 -999px)\",\n }}\n >\n <span aria-hidden className=\"invisible inline-block whitespace-nowrap\">\n {cascade\n ? label.split(\"\").map((char, index) => (\n <span key={index} className=\"inline-block whitespace-pre\">\n {char}\n </span>\n ))\n : children}\n </span>\n {cascade ? (\n <>\n {/* Letters are decorative fragments; readers get the whole label. */}\n <span className=\"sr-only\">{label}</span>\n <AnimatePresence initial={false}>\n <motion.span\n key={`cascade-${value}`}\n aria-hidden\n initial=\"initial\"\n animate=\"animate\"\n exit=\"exit\"\n className=\"absolute top-[0.08em] left-0 inline-block whitespace-pre\"\n >\n {label.split(\"\").map((char, i) => (\n <motion.span\n key={i}\n custom={i * CASCADE_STAGGER}\n variants={CASCADE_LETTER_VARIANTS}\n className=\"inline-block whitespace-pre will-change-[opacity,filter,transform]\"\n >\n {char}\n </motion.span>\n ))}\n </motion.span>\n </AnimatePresence>\n </>\n ) : (\n <AnimatePresence initial={false}>\n <motion.span\n key={`${animation}-${value}`}\n variants={TEXT_VARIANTS[coreAnimation]}\n initial={reduce ? false : \"initial\"}\n animate={reduce ? { opacity: 1, filter: \"blur(0px)\", scale: 1, y: 0 } : \"animate\"}\n exit={reduce ? undefined : \"exit\"}\n // Truncation lives on the layer that holds the text — the layer\n // moves as a whole, so clipping it never eats the roll.\n className=\"absolute top-[0.08em] left-0 inline-block max-w-full truncate will-change-[opacity,filter,transform]\"\n >\n {children}\n </motion.span>\n </AnimatePresence>\n )}\n </span>\n );\n}\n\nexport function ActionSwapIcon({\n value,\n children,\n animation = \"blur\",\n className,\n}: ActionSwapIconProps) {\n const reduce = useReducedMotion();\n // Icons are single elements — cascade maps to its closest motion, roll.\n const coreAnimation: CoreAnimation = animation === \"cascade\" ? \"roll\" : animation;\n\n return (\n <span\n className={cn(\"relative inline-grid shrink-0 place-items-center overflow-hidden\", className)}\n >\n <AnimatePresence mode=\"popLayout\" initial={false}>\n <motion.span\n key={`${animation}-${value}`}\n aria-hidden\n variants={ICON_VARIANTS[coreAnimation]}\n initial={reduce ? false : \"initial\"}\n animate={reduce ? { opacity: 1, filter: \"blur(0px)\", scale: 1, y: 0 } : \"animate\"}\n exit={reduce ? undefined : \"exit\"}\n className=\"col-start-1 row-start-1 inline-flex items-center justify-center will-change-[opacity,filter,transform]\"\n >\n {children}\n </motion.span>\n </AnimatePresence>\n </span>\n );\n}\n\nexport function ActionSwapButton({\n items,\n value,\n defaultValue,\n onValueChange,\n variant = \"secondary\",\n size = \"md\",\n animation = \"blur\",\n iconOnly = size === \"icon\",\n cycle = true,\n className,\n disabled,\n onClick,\n ...rest\n}: ActionSwapButtonProps) {\n const reduce = useReducedMotion();\n const [internalValue, setInternalValue] = useState(defaultValue ?? items[0]?.id);\n const currentValue = value ?? internalValue;\n const activeIndex = Math.max(\n 0,\n items.findIndex((item) => item.id === currentValue),\n );\n const activeItem = items[activeIndex] ?? items[0];\n const hasIcon = items.some((item) => item.icon);\n const nextItem = cycle && items.length > 0 ? items[(activeIndex + 1) % items.length] : undefined;\n\n if (!activeItem) return null;\n\n const accessibleLabel =\n activeItem.ariaLabel ??\n (iconOnly && typeof activeItem.label === \"string\" ? activeItem.label : undefined);\n\n return (\n <motion.button\n type=\"button\"\n disabled={disabled}\n whileTap={reduce || disabled ? undefined : { scale: 0.97 }}\n transition={SPRING_PRESS}\n className={cn(\n \"inline-flex items-center justify-center overflow-hidden font-medium transition-colors\",\n \"disabled:pointer-events-none disabled:opacity-50\",\n VARIANT_CLASS[variant],\n SIZE_CLASS[size],\n className,\n )}\n aria-label={accessibleLabel}\n onClick={(event) => {\n onClick?.(event);\n if (event.defaultPrevented || disabled || !cycle || !nextItem) return;\n if (value === undefined) setInternalValue(nextItem.id);\n onValueChange?.(nextItem.id, nextItem);\n }}\n {...rest}\n >\n {hasIcon ? (\n <ActionSwapIcon value={activeItem.id} animation={animation} className=\"h-4 w-4\">\n {activeItem.icon ?? null}\n </ActionSwapIcon>\n ) : null}\n {!iconOnly ? (\n <ActionSwapText value={activeItem.id} animation={animation}>\n {activeItem.label}\n </ActionSwapText>\n ) : null}\n </motion.button>\n );\n}\n"],"mappings":";;;;;;;AAwDA,MAAM,kBAAkB;CAAE,UAAU;CAAK,MAAM;AAAY;AAC3D,MAAM,kBAAkB;AACxB,MAAM,uBAAuB;CAAE,UAAU;CAAM,MAAM;AAAS;AAC9D,MAAM,YAAY;AAClB,MAAM,YAAY;AAMlB,MAAM,kBAAkB;AAExB,MAAM,0BAAoC;CACxC,SAAS;EAAE,SAAS;EAAG,GAAG;EAAQ,QAAQ;CAAU;CACpD,UAAU,QAAgB,OAAO;EAC/B,SAAS;EACT,GAAG;EACH,QAAQ;EACR,YAAY;GAA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BAAoB,YAAY,CAAC,SAAS,CAAC,UAAU;GAC/D,IAAI,UAAU,KAAA,GAAW,iBAAiB,SAAS,EAAE;GACrD,gBAAgB,SAAS,IAAI,QAAQ;EACvC;EACA,GAAI;EAnBN,UAAA,CAqBG,UACC,oBAAC,gBAAD;GAAgB,OAAO,WAAW;GAAe;GAAW,WAAU;GACnE,UAAA,WAAW,QAAQ;EACN,CAAA,IACd,MACH,CAAC,WACA,oBAAC,gBAAD;GAAgB,OAAO,WAAW;GAAe;GAC9C,UAAA,WAAW;EACE,CAAA,IACd,IACS;;AAEnB"}
@@ -3,9 +3,9 @@ import { EASE_OUT, SPRING_PRESS } from "../../lib/ease.js";
3
3
  import { Liquid, LiquidItem } from "./liquid.js";
4
4
  import { createContext, useCallback, useContext, useId, useLayoutEffect, useMemo, useRef, useState } from "react";
5
5
  import { cn } from "@kumix/utils";
6
+ import { Minus, Plus } from "lucide-react";
6
7
  import { jsx, jsxs } from "react/jsx-runtime";
7
8
  import { AnimatePresence, motion, useReducedMotion } from "motion/react";
8
- import { Minus, Plus } from "lucide-react";
9
9
  //#region src/components/motion/adaptive-stepper.tsx
10
10
  const STEPPER_LIQUID_TRANSITION = {
11
11
  duration: 600,
@@ -1,17 +1,17 @@
1
1
  "use client";
2
2
  import { EASE_OUT } from "../../lib/ease.js";
3
3
  import { cn } from "@kumix/utils";
4
+ import { AlertTriangle, Check, Circle, Info, LoaderCircle, X } from "lucide-react";
4
5
  import { jsx, jsxs } from "react/jsx-runtime";
5
6
  import { AnimatePresence, motion, useReducedMotion } from "motion/react";
6
- import { AlertTriangle, Check, Circle, Info, LoaderCircle, X } from "lucide-react";
7
7
  //#region src/components/motion/animated-badge.tsx
8
8
  const STATUS_CLASS = {
9
9
  neutral: "border-border bg-card text-muted-foreground",
10
- info: "border-primary/30 bg-primary/10 text-primary",
10
+ info: "border-primary/30 bg-muted text-primary",
11
11
  success: "border-emerald-500/30 bg-emerald-500/10 text-emerald-600 dark:text-emerald-400",
12
12
  warning: "border-amber-500/30 bg-amber-500/10 text-amber-600 dark:text-amber-400",
13
13
  danger: "border-destructive/30 bg-destructive/10 text-destructive",
14
- loading: "border-primary/30 bg-primary/10 text-primary"
14
+ loading: "border-primary/30 bg-muted text-primary"
15
15
  };
16
16
  const SIZE_CLASS = {
17
17
  sm: "h-6 gap-1.5 px-2 text-[11px]",
@@ -1 +1 @@
1
- {"version":3,"file":"animated-badge.js","names":[],"sources":["../../../src/components/motion/animated-badge.tsx"],"sourcesContent":["\"use client\";\n\nimport type { ReactNode } from \"react\";\nimport { AlertTriangle, Check, Circle, Info, LoaderCircle, type LucideIcon, X } from \"lucide-react\";\nimport {\n AnimatePresence,\n type HTMLMotionProps,\n motion,\n useReducedMotion,\n type Variants,\n} from \"motion/react\";\n\nimport { cn } from \"@kumix/utils\";\nimport { EASE_OUT } from \"../../lib/ease\";\n\nexport type AnimatedBadgeStatus = \"neutral\" | \"info\" | \"success\" | \"warning\" | \"danger\" | \"loading\";\n\nexport type AnimatedBadgeSize = \"sm\" | \"md\";\n\nexport interface AnimatedBadgeProps extends Omit<HTMLMotionProps<\"span\">, \"children\"> {\n status?: AnimatedBadgeStatus;\n size?: AnimatedBadgeSize;\n children?: ReactNode;\n icon?: ReactNode;\n showIcon?: boolean;\n pulse?: boolean;\n contentKey?: string | number;\n}\n\nconst STATUS_CLASS: Record<AnimatedBadgeStatus, string> = {\n neutral: \"border-border bg-card text-muted-foreground\",\n info: \"border-primary/30 bg-primary/10 text-primary\",\n success: \"border-emerald-500/30 bg-emerald-500/10 text-emerald-600 dark:text-emerald-400\",\n warning: \"border-amber-500/30 bg-amber-500/10 text-amber-600 dark:text-amber-400\",\n danger: \"border-destructive/30 bg-destructive/10 text-destructive\",\n loading: \"border-primary/30 bg-primary/10 text-primary\",\n};\n\nconst SIZE_CLASS: Record<AnimatedBadgeSize, string> = {\n sm: \"h-6 gap-1.5 px-2 text-[11px]\",\n md: \"h-8 gap-2 px-3 text-xs\",\n};\n\nconst ICON_CLASS: Record<AnimatedBadgeSize, string> = {\n sm: \"h-3 w-3\",\n md: \"h-3.5 w-3.5\",\n};\n\nconst ICONS: Record<AnimatedBadgeStatus, LucideIcon> = {\n neutral: Circle,\n info: Info,\n success: Check,\n warning: AlertTriangle,\n danger: X,\n loading: LoaderCircle,\n};\n\nconst ICON_ROLL_VARIANTS: Variants = {\n initial: {\n opacity: 0.72,\n y: \"80%\",\n scale: 0.92,\n rotate: -8,\n filter: \"blur(6px)\",\n },\n animate: {\n opacity: 1,\n y: \"0%\",\n scale: 1,\n rotate: 0,\n filter: \"blur(0px)\",\n transition: {\n y: { type: \"spring\", stiffness: 210, damping: 24, mass: 0.85 },\n scale: { type: \"spring\", stiffness: 250, damping: 24, mass: 0.75 },\n rotate: { duration: 0.28, ease: EASE_OUT },\n opacity: { duration: 0.28, ease: EASE_OUT },\n filter: { duration: 0.42, ease: EASE_OUT },\n },\n },\n exit: {\n opacity: 0.5,\n y: \"-80%\",\n scale: 0.96,\n rotate: 8,\n filter: \"blur(6px)\",\n transition: { duration: 0.22, ease: EASE_OUT },\n },\n};\n\nconst TEXT_ROLL_VARIANTS: Variants = {\n initial: { opacity: 0.76, y: \"85%\", filter: \"blur(6px)\" },\n animate: {\n opacity: 1,\n y: \"0%\",\n filter: \"blur(0px)\",\n transition: {\n y: { type: \"spring\", stiffness: 210, damping: 24, mass: 0.85 },\n opacity: { duration: 0.3, ease: EASE_OUT },\n filter: { duration: 0.42, ease: EASE_OUT },\n },\n },\n exit: {\n opacity: 0.5,\n y: \"-85%\",\n filter: \"blur(6px)\",\n transition: { duration: 0.2, ease: EASE_OUT },\n },\n};\n\nexport function AnimatedBadge({\n status = \"neutral\",\n size = \"md\",\n children,\n icon,\n showIcon = true,\n pulse = status === \"loading\",\n contentKey,\n className,\n ...rest\n}: AnimatedBadgeProps) {\n const reduce = useReducedMotion();\n const Icon = ICONS[status];\n const resolvedContentKey =\n contentKey ??\n (typeof children === \"string\" || typeof children === \"number\" ? children : status);\n\n return (\n <motion.span\n layout\n transition={{ type: \"spring\", stiffness: 420, damping: 30, mass: 0.7 }}\n className={cn(\n \"relative inline-flex shrink-0 items-center overflow-hidden whitespace-nowrap rounded-full border font-medium tabular-nums\",\n \"transition-colors duration-300\",\n STATUS_CLASS[status],\n SIZE_CLASS[size],\n className,\n )}\n {...rest}\n >\n {pulse && !reduce ? (\n <motion.span\n aria-hidden\n className=\"absolute inset-0 rounded-full bg-current opacity-10\"\n animate={{ scale: [0.94, 1.08, 0.94], opacity: [0.08, 0.16, 0.08] }}\n transition={{ duration: 1.6, repeat: Infinity, ease: \"easeInOut\" }}\n />\n ) : null}\n {showIcon ? (\n <span className=\"relative z-10 inline-flex items-center justify-center overflow-hidden\">\n <AnimatePresence mode=\"popLayout\" initial={false}>\n <motion.span\n key={status}\n aria-hidden\n data-badge-icon\n variants={ICON_ROLL_VARIANTS}\n initial={reduce ? false : \"initial\"}\n animate={reduce ? { opacity: 1 } : \"animate\"}\n exit={reduce ? undefined : \"exit\"}\n className=\"inline-flex will-change-transform\"\n >\n {status === \"loading\" && !reduce && !icon ? (\n <motion.span\n animate={{ rotate: 360 }}\n transition={{ duration: 1, repeat: Infinity, ease: \"linear\" }}\n className=\"inline-flex\"\n >\n <Icon className={ICON_CLASS[size]} />\n </motion.span>\n ) : (\n (icon ?? <Icon className={ICON_CLASS[size]} />)\n )}\n </motion.span>\n </AnimatePresence>\n </span>\n ) : null}\n {children != null ? (\n <span className=\"relative z-10 inline-flex overflow-hidden\">\n <AnimatePresence mode=\"popLayout\" initial={false}>\n <motion.span\n key={resolvedContentKey}\n data-badge-label\n variants={TEXT_ROLL_VARIANTS}\n initial={reduce ? false : \"initial\"}\n animate={reduce ? { opacity: 1 } : \"animate\"}\n exit={reduce ? undefined : \"exit\"}\n className=\"inline-block will-change-transform\"\n >\n {children}\n </motion.span>\n </AnimatePresence>\n </span>\n ) : null}\n </motion.span>\n );\n}\n"],"mappings":";;;;;;;AA6BA,MAAM,eAAoD;CACxD,SAAS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X,oBAAC,QAAD;IAAM,WAAU;IACd,UAAA,oBAAC,iBAAD;KAAiB,MAAK;KAAY,SAAS;KACzC,UAAA,oBAAC,OAAO,MAAR;MAEE,oBAAA;MACA,UAAU;MACV,SAAS,SAAS,QAAQ;MAC1B,SAAS,SAAS,EAAE,SAAS,EAAE,IAAI;MACnC,MAAM,SAAS,KAAA,IAAY;MAC3B,WAAU;MAET;KACU,GATN,kBASM;IACE,CAAA;GACb,CAAA,IACJ;EACO;;AAEjB"}
1
+ {"version":3,"file":"animated-badge.js","names":[],"sources":["../../../src/components/motion/animated-badge.tsx"],"sourcesContent":["\"use client\";\n\nimport type { ReactNode } from \"react\";\nimport { AlertTriangle, Check, Circle, Info, LoaderCircle, type LucideIcon, X } from \"lucide-react\";\nimport {\n AnimatePresence,\n type HTMLMotionProps,\n motion,\n useReducedMotion,\n type Variants,\n} from \"motion/react\";\n\nimport { cn } from \"@kumix/utils\";\nimport { EASE_OUT } from \"../../lib/ease\";\n\nexport type AnimatedBadgeStatus = \"neutral\" | \"info\" | \"success\" | \"warning\" | \"danger\" | \"loading\";\n\nexport type AnimatedBadgeSize = \"sm\" | \"md\";\n\nexport interface AnimatedBadgeProps extends Omit<HTMLMotionProps<\"span\">, \"children\"> {\n status?: AnimatedBadgeStatus;\n size?: AnimatedBadgeSize;\n children?: ReactNode;\n icon?: ReactNode;\n showIcon?: boolean;\n pulse?: boolean;\n contentKey?: string | number;\n}\n\nconst STATUS_CLASS: Record<AnimatedBadgeStatus, string> = {\n neutral: \"border-border bg-card text-muted-foreground\",\n info: \"border-primary/30 bg-muted text-primary\",\n success: \"border-emerald-500/30 bg-emerald-500/10 text-emerald-600 dark:text-emerald-400\",\n warning: \"border-amber-500/30 bg-amber-500/10 text-amber-600 dark:text-amber-400\",\n danger: \"border-destructive/30 bg-destructive/10 text-destructive\",\n loading: \"border-primary/30 bg-muted text-primary\",\n};\n\nconst SIZE_CLASS: Record<AnimatedBadgeSize, string> = {\n sm: \"h-6 gap-1.5 px-2 text-[11px]\",\n md: \"h-8 gap-2 px-3 text-xs\",\n};\n\nconst ICON_CLASS: Record<AnimatedBadgeSize, string> = {\n sm: \"h-3 w-3\",\n md: \"h-3.5 w-3.5\",\n};\n\nconst ICONS: Record<AnimatedBadgeStatus, LucideIcon> = {\n neutral: Circle,\n info: Info,\n success: Check,\n warning: AlertTriangle,\n danger: X,\n loading: LoaderCircle,\n};\n\nconst ICON_ROLL_VARIANTS: Variants = {\n initial: {\n opacity: 0.72,\n y: \"80%\",\n scale: 0.92,\n rotate: -8,\n filter: \"blur(6px)\",\n },\n animate: {\n opacity: 1,\n y: \"0%\",\n scale: 1,\n rotate: 0,\n filter: \"blur(0px)\",\n transition: {\n y: { type: \"spring\", stiffness: 210, damping: 24, mass: 0.85 },\n scale: { type: \"spring\", stiffness: 250, damping: 24, mass: 0.75 },\n rotate: { duration: 0.28, ease: EASE_OUT },\n opacity: { duration: 0.28, ease: EASE_OUT },\n filter: { duration: 0.42, ease: EASE_OUT },\n },\n },\n exit: {\n opacity: 0.5,\n y: \"-80%\",\n scale: 0.96,\n rotate: 8,\n filter: \"blur(6px)\",\n transition: { duration: 0.22, ease: EASE_OUT },\n },\n};\n\nconst TEXT_ROLL_VARIANTS: Variants = {\n initial: { opacity: 0.76, y: \"85%\", filter: \"blur(6px)\" },\n animate: {\n opacity: 1,\n y: \"0%\",\n filter: \"blur(0px)\",\n transition: {\n y: { type: \"spring\", stiffness: 210, damping: 24, mass: 0.85 },\n opacity: { duration: 0.3, ease: EASE_OUT },\n filter: { duration: 0.42, ease: EASE_OUT },\n },\n },\n exit: {\n opacity: 0.5,\n y: \"-85%\",\n filter: \"blur(6px)\",\n transition: { duration: 0.2, ease: EASE_OUT },\n },\n};\n\nexport function AnimatedBadge({\n status = \"neutral\",\n size = \"md\",\n children,\n icon,\n showIcon = true,\n pulse = status === \"loading\",\n contentKey,\n className,\n ...rest\n}: AnimatedBadgeProps) {\n const reduce = useReducedMotion();\n const Icon = ICONS[status];\n const resolvedContentKey =\n contentKey ??\n (typeof children === \"string\" || typeof children === \"number\" ? children : status);\n\n return (\n <motion.span\n layout\n transition={{ type: \"spring\", stiffness: 420, damping: 30, mass: 0.7 }}\n className={cn(\n \"relative inline-flex shrink-0 items-center overflow-hidden whitespace-nowrap rounded-full border font-medium tabular-nums\",\n \"transition-colors duration-300\",\n STATUS_CLASS[status],\n SIZE_CLASS[size],\n className,\n )}\n {...rest}\n >\n {pulse && !reduce ? (\n <motion.span\n aria-hidden\n className=\"absolute inset-0 rounded-full bg-current opacity-10\"\n animate={{ scale: [0.94, 1.08, 0.94], opacity: [0.08, 0.16, 0.08] }}\n transition={{ duration: 1.6, repeat: Infinity, ease: \"easeInOut\" }}\n />\n ) : null}\n {showIcon ? (\n <span className=\"relative z-10 inline-flex items-center justify-center overflow-hidden\">\n <AnimatePresence mode=\"popLayout\" initial={false}>\n <motion.span\n key={status}\n aria-hidden\n data-badge-icon\n variants={ICON_ROLL_VARIANTS}\n initial={reduce ? false : \"initial\"}\n animate={reduce ? { opacity: 1 } : \"animate\"}\n exit={reduce ? undefined : \"exit\"}\n className=\"inline-flex will-change-transform\"\n >\n {status === \"loading\" && !reduce && !icon ? (\n <motion.span\n animate={{ rotate: 360 }}\n transition={{ duration: 1, repeat: Infinity, ease: \"linear\" }}\n className=\"inline-flex\"\n >\n <Icon className={ICON_CLASS[size]} />\n </motion.span>\n ) : (\n (icon ?? <Icon className={ICON_CLASS[size]} />)\n )}\n </motion.span>\n </AnimatePresence>\n </span>\n ) : null}\n {children != null ? (\n <span className=\"relative z-10 inline-flex overflow-hidden\">\n <AnimatePresence mode=\"popLayout\" initial={false}>\n <motion.span\n key={resolvedContentKey}\n data-badge-label\n variants={TEXT_ROLL_VARIANTS}\n initial={reduce ? false : \"initial\"}\n animate={reduce ? { opacity: 1 } : \"animate\"}\n exit={reduce ? undefined : \"exit\"}\n className=\"inline-block will-change-transform\"\n >\n {children}\n </motion.span>\n </AnimatePresence>\n </span>\n ) : null}\n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AA;KAEpC,GApBN,MAoBM;IACE,CAAA;GACb,CAAA,IACJ;GACH,YAAY,OACX,oBAAC,QAAD;IAAM,WAAU;IACd,UAAA,oBAAC,iBAAD;KAAiB,MAAK;KAAY,SAAS;KACzC,UAAA,oBAAC,OAAO,MAAR;MAEE,oBAAA;MACA,UAAU;MACV,SAAS,SAAS,QAAQ;MAC1B,SAAS,SAAS,EAAE,SAAS,EAAE,IAAI;MACnC,MAAM,SAAS,KAAA,IAAY;MAC3B,WAAU;MAET;KACU,GATN,kBASM;IACE,CAAA;GACb,CAAA,IACJ;EACO;;AAEjB"}
@@ -3,9 +3,9 @@ import { EASE_DRAWER, EASE_OUT, SPRING_LAYOUT, SPRING_PRESS } from "../../lib/ea
3
3
  import { SharedLayoutBg } from "./shared-layout-bg.js";
4
4
  import { createContext, createElement, forwardRef, useCallback, useContext, useEffect, useId, useRef, useState, useSyncExternalStore } from "react";
5
5
  import { cn } from "@kumix/utils";
6
+ import { ChevronRight } from "lucide-react";
6
7
  import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
7
8
  import { AnimatePresence, motion, useReducedMotion } from "motion/react";
8
- import { ChevronRight } from "lucide-react";
9
9
  import { createPortal } from "react-dom";
10
10
  //#region src/components/motion/animated-sidebar.tsx
11
11
  const MOBILE_QUERY = "(max-width: 767px)";
@@ -2,9 +2,9 @@
2
2
  import { EASE_OUT } from "../../lib/ease.js";
3
3
  import { memo, useCallback, useEffect, useMemo, useRef, useState } from "react";
4
4
  import { cn } from "@kumix/utils";
5
+ import { AlertCircle, Bell, Check, Info, LoaderCircle, X } from "lucide-react";
5
6
  import { jsx, jsxs } from "react/jsx-runtime";
6
7
  import { AnimatePresence, motion, useReducedMotion } from "motion/react";
7
- import { AlertCircle, Bell, Check, Info, LoaderCircle, X } from "lucide-react";
8
8
  import { createPortal } from "react-dom";
9
9
  //#region src/components/motion/animated-toast-stack.tsx
10
10
  const STACK_SPRING = {
@@ -25,9 +25,9 @@ const STATUS_ICON = {
25
25
  error: AlertCircle
26
26
  };
27
27
  const STATUS_CLASS = {
28
- neutral: "text-muted-foreground bg-primary/[0.05]",
29
- info: "text-primary bg-primary/10",
30
- loading: "text-primary bg-primary/10",
28
+ neutral: "text-muted-foreground bg-muted/60",
29
+ info: "text-primary bg-muted",
30
+ loading: "text-primary bg-muted",
31
31
  success: "text-emerald-600 bg-emerald-500/10 dark:text-emerald-400",
32
32
  error: "text-destructive bg-destructive/10"
33
33
  };
@@ -282,7 +282,7 @@ const ToastItem = memo(function ToastItem({ toast, index, onDismiss, classNames,
282
282
  }), toast.action ? /* @__PURE__ */ jsx("button", {
283
283
  type: "button",
284
284
  onClick: () => toast.action?.onClick(toast),
285
- className: cn("mt-2 inline-flex h-7 items-center rounded-full bg-primary/6 px-3 font-medium text-foreground text-xs transition-colors hover:bg-primary/10", classNames?.action),
285
+ className: cn("mt-2 inline-flex h-7 items-center rounded-full bg-muted/80 px-3 font-medium text-foreground text-xs transition-colors hover:bg-muted", classNames?.action),
286
286
  children: toast.action.label
287
287
  }) : null]
288
288
  }),
@@ -290,7 +290,7 @@ const ToastItem = memo(function ToastItem({ toast, index, onDismiss, classNames,
290
290
  type: "button",
291
291
  onClick: () => onDismiss?.(toast.id),
292
292
  "aria-label": "Dismiss toast",
293
- className: cn("inline-flex h-7 w-7 shrink-0 items-center justify-center rounded-full text-muted-foreground transition-colors hover:bg-primary/6 hover:text-foreground", classNames?.close),
293
+ className: cn("inline-flex h-7 w-7 shrink-0 items-center justify-center rounded-full text-muted-foreground transition-colors hover:bg-muted/80 hover:text-foreground", classNames?.close),
294
294
  children: /* @__PURE__ */ jsx(X, { className: "h-3.5 w-3.5" })
295
295
  }) : null
296
296
  ]
@@ -1 +1 @@
1
- {"version":3,"file":"animated-toast-stack.js","names":[],"sources":["../../../src/components/motion/animated-toast-stack.tsx"],"sourcesContent":["\"use client\";\n\nimport { memo, type ReactNode, useCallback, useEffect, useMemo, useRef, useState } from \"react\";\nimport { AlertCircle, Bell, Check, Info, LoaderCircle, type LucideIcon, X } from \"lucide-react\";\nimport { AnimatePresence, motion, type Transition, useReducedMotion } from \"motion/react\";\nimport { createPortal } from \"react-dom\";\n\nimport { cn } from \"@kumix/utils\";\nimport { EASE_OUT } from \"../../lib/ease\";\n\nexport type ToastStatus = \"neutral\" | \"info\" | \"loading\" | \"success\" | \"error\";\nexport type ToastPosition =\n | \"top-left\"\n | \"top-center\"\n | \"top-right\"\n | \"bottom-left\"\n | \"bottom-center\"\n | \"bottom-right\";\n\nexport type AnimatedToastAction = {\n label: ReactNode;\n onClick: (toast: AnimatedToast) => void;\n};\n\nexport type AnimatedToast = {\n id: string;\n title: ReactNode;\n description?: ReactNode;\n status?: ToastStatus;\n icon?: ReactNode;\n action?: AnimatedToastAction;\n duration?: number;\n dismissible?: boolean;\n createdAt?: number;\n};\n\nexport type ToastInput = Omit<AnimatedToast, \"id\" | \"createdAt\"> & {\n id?: string;\n};\n\nexport type ToastClassNames = {\n root?: string;\n item?: string;\n surface?: string;\n iconWrap?: string;\n content?: string;\n title?: string;\n description?: string;\n action?: string;\n close?: string;\n progress?: string;\n};\n\nexport interface AnimatedToastStackProps {\n toasts: AnimatedToast[];\n onDismiss?: (id: string) => void;\n position?: ToastPosition;\n placement?: \"static\" | \"fixed\" | \"absolute\";\n fixed?: boolean;\n portal?: boolean;\n portalRoot?: Element | null;\n maxVisible?: number;\n className?: string;\n classNames?: ToastClassNames;\n icons?: Partial<Record<ToastStatus, ReactNode>>;\n renderToast?: (toast: AnimatedToast) => ReactNode;\n}\n\nexport interface UseAnimatedToastStackOptions {\n initialToasts?: ToastInput[];\n defaultDuration?: number;\n limit?: number;\n}\n\nconst STACK_SPRING: Transition = {\n type: \"spring\",\n stiffness: 420,\n damping: 34,\n mass: 0.75,\n};\n\nconst CONTENT_TRANSITION = {\n duration: 0.28,\n ease: EASE_OUT,\n} as const;\n\nconst STATUS_ICON: Record<ToastStatus, LucideIcon> = {\n neutral: Bell,\n info: Info,\n loading: LoaderCircle,\n success: Check,\n error: AlertCircle,\n};\n\nconst STATUS_CLASS: Record<ToastStatus, string> = {\n neutral: \"text-muted-foreground bg-primary/[0.05]\",\n info: \"text-primary bg-primary/10\",\n loading: \"text-primary bg-primary/10\",\n success: \"text-emerald-600 bg-emerald-500/10 dark:text-emerald-400\",\n error: \"text-destructive bg-destructive/10\",\n};\n\nconst POSITION_CLASS: Record<ToastPosition, string> = {\n \"top-left\": \"left-4 top-4\",\n \"top-center\": \"left-1/2 top-4 -translate-x-1/2\",\n \"top-right\": \"right-4 top-4\",\n \"bottom-left\": \"bottom-6 left-4\",\n \"bottom-center\": \"bottom-6 left-1/2 -translate-x-1/2\",\n \"bottom-right\": \"bottom-6 right-4\",\n};\n\nlet idSeed = 0;\n\nfunction createToast(input: ToastInput, defaultDuration: number): AnimatedToast {\n return {\n duration: defaultDuration,\n dismissible: true,\n ...input,\n id: input.id ?? `toast-${Date.now()}-${idSeed++}`,\n createdAt: Date.now(),\n };\n}\n\nexport function useAnimatedToastStack({\n initialToasts = [],\n defaultDuration = 4200,\n limit,\n}: UseAnimatedToastStackOptions = {}) {\n const toastTimers = useRef<Map<string, { timer: number; signature: string }>>(new Map());\n const [toasts, setToasts] = useState<AnimatedToast[]>(() =>\n initialToasts.map((toast) => createToast(toast, defaultDuration)),\n );\n\n const dismissToast = useCallback((id: string) => {\n setToasts((current) => current.filter((toast) => toast.id !== id));\n }, []);\n\n const clearToasts = useCallback(() => {\n setToasts([]);\n }, []);\n\n const showToast = useCallback(\n (input: ToastInput) => {\n const toast = createToast(input, defaultDuration);\n setToasts((current) => {\n const next = [...current, toast];\n return typeof limit === \"number\" ? next.slice(-limit) : next;\n });\n return toast.id;\n },\n [defaultDuration, limit],\n );\n\n const updateToast = useCallback((id: string, patch: Partial<ToastInput>) => {\n setToasts((current) =>\n current.map((toast) =>\n toast.id === id\n ? {\n ...toast,\n ...patch,\n id,\n createdAt: patch.duration === undefined ? toast.createdAt : Date.now(),\n }\n : toast,\n ),\n );\n }, []);\n\n useEffect(() => {\n const activeIds = new Set(toasts.map((toast) => toast.id));\n\n toastTimers.current.forEach((entry, id) => {\n if (!activeIds.has(id)) {\n window.clearTimeout(entry.timer);\n toastTimers.current.delete(id);\n }\n });\n\n toasts.forEach((toast) => {\n const duration = toast.duration ?? defaultDuration;\n const existing = toastTimers.current.get(toast.id);\n\n if (duration <= 0) {\n if (existing) {\n window.clearTimeout(existing.timer);\n toastTimers.current.delete(toast.id);\n }\n return;\n }\n\n const createdAt = toast.createdAt ?? Date.now();\n const signature = `${createdAt}:${duration}`;\n\n if (existing?.signature === signature) {\n return;\n }\n\n if (existing) {\n window.clearTimeout(existing.timer);\n }\n\n const elapsed = Date.now() - createdAt;\n const remaining = Math.max(duration - elapsed, 0);\n const timer = window.setTimeout(() => {\n toastTimers.current.delete(toast.id);\n dismissToast(toast.id);\n }, remaining);\n\n toastTimers.current.set(toast.id, { timer, signature });\n });\n }, [defaultDuration, dismissToast, toasts]);\n\n useEffect(() => {\n const timers = toastTimers.current;\n\n return () => {\n timers.forEach((entry) => {\n window.clearTimeout(entry.timer);\n });\n timers.clear();\n };\n }, []);\n\n return useMemo(\n () => ({\n toasts,\n showToast,\n updateToast,\n dismissToast,\n clearToasts,\n setToasts,\n }),\n [clearToasts, dismissToast, showToast, toasts, updateToast],\n );\n}\n\nexport function AnimatedToastStack({\n toasts,\n onDismiss,\n position = \"bottom-right\",\n placement,\n fixed = false,\n portal,\n portalRoot,\n maxVisible = 4,\n className,\n classNames,\n icons,\n renderToast,\n}: AnimatedToastStackProps) {\n const [portalTarget, setPortalTarget] = useState<Element | null>(null);\n const visibleToasts = toasts.slice(-maxVisible);\n const isBottom = position.startsWith(\"bottom\");\n const resolvedPlacement = placement ?? (fixed ? \"fixed\" : \"static\");\n const shouldPortal = portal ?? resolvedPlacement === \"fixed\";\n\n useEffect(() => {\n setPortalTarget(shouldPortal ? (portalRoot ?? document.body) : null);\n }, [portalRoot, shouldPortal]);\n\n const stack = (\n <ol\n aria-live=\"polite\"\n aria-atomic=\"false\"\n className={cn(\n \"pointer-events-none flex w-[calc(100vw-2rem)] max-w-sm gap-2\",\n isBottom ? \"flex-col-reverse\" : \"flex-col\",\n resolvedPlacement === \"fixed\" && \"fixed z-90\",\n resolvedPlacement === \"absolute\" && \"absolute z-20\",\n resolvedPlacement !== \"static\" && POSITION_CLASS[position],\n classNames?.root,\n className,\n )}\n >\n <AnimatePresence initial={false} mode=\"popLayout\">\n {visibleToasts.map((toast, index) => (\n <ToastItem\n key={toast.id}\n toast={toast}\n index={index}\n onDismiss={onDismiss}\n classNames={classNames}\n icons={icons}\n renderToast={renderToast}\n />\n ))}\n </AnimatePresence>\n </ol>\n );\n\n if (shouldPortal && !portalTarget) {\n return null;\n }\n\n if (shouldPortal && portalTarget) {\n return createPortal(stack, portalTarget);\n }\n\n return stack;\n}\n\nconst ToastItem = memo(function ToastItem({\n toast,\n index,\n onDismiss,\n classNames,\n icons,\n renderToast,\n}: {\n toast: AnimatedToast;\n index: number;\n onDismiss?: (id: string) => void;\n classNames?: ToastClassNames;\n icons?: Partial<Record<ToastStatus, ReactNode>>;\n renderToast?: (toast: AnimatedToast) => ReactNode;\n}) {\n const reduce = useReducedMotion();\n const status = toast.status ?? \"neutral\";\n const Icon = STATUS_ICON[status];\n const iconNode = icons?.[status] ?? toast.icon ?? <Icon className=\"h-3.5 w-3.5\" />;\n const canDismiss = toast.dismissible !== false && Boolean(onDismiss);\n const hasDetails = Boolean(toast.description || toast.action);\n\n return (\n <motion.li\n layout\n initial={reduce ? { opacity: 0 } : { opacity: 0, y: 22, scale: 0.96, filter: \"blur(10px)\" }}\n animate={reduce ? { opacity: 1 } : { opacity: 1, y: 0, scale: 1, filter: \"blur(0px)\" }}\n exit={\n reduce\n ? { opacity: 0 }\n : {\n opacity: 0,\n x: 32,\n scale: 0.96,\n filter: \"blur(8px)\",\n transition: { duration: 0.18, ease: EASE_OUT },\n }\n }\n transition={STACK_SPRING}\n drag={canDismiss && !reduce ? \"x\" : false}\n dragConstraints={{ left: 0, right: 0 }}\n dragElastic={0.18}\n onDragEnd={(_, info) => {\n if (!canDismiss || !onDismiss) return;\n if (Math.abs(info.offset.x) > 72 || Math.abs(info.velocity.x) > 520) {\n onDismiss(toast.id);\n }\n }}\n className={cn(\"pointer-events-auto relative will-change-transform\", classNames?.item)}\n style={{ zIndex: 20 - index }}\n >\n <div\n className={cn(\n \"relative overflow-hidden rounded-2xl border border-border bg-card/95 p-3 shadow-2xl backdrop-blur-xl\",\n classNames?.surface,\n )}\n >\n {renderToast ? (\n renderToast(toast)\n ) : (\n <div className={cn(\"flex gap-3\", hasDetails ? \"items-start\" : \"items-center\")}>\n <motion.span\n layout\n className={cn(\n \"inline-flex h-7 w-7 shrink-0 items-center justify-center rounded-full\",\n hasDetails && \"mt-0.5\",\n STATUS_CLASS[status],\n classNames?.iconWrap,\n )}\n >\n <AnimatePresence mode=\"popLayout\" initial={false}>\n <motion.span\n key={status}\n initial={\n reduce ? { opacity: 0 } : { opacity: 0, y: 8, scale: 0.8, filter: \"blur(6px)\" }\n }\n animate={\n reduce ? { opacity: 1 } : { opacity: 1, y: 0, scale: 1, filter: \"blur(0px)\" }\n }\n exit={\n reduce ? { opacity: 0 } : { opacity: 0, y: -8, scale: 0.9, filter: \"blur(6px)\" }\n }\n transition={CONTENT_TRANSITION}\n className=\"inline-flex\"\n >\n {status === \"loading\" ? (\n <span className=\"inline-flex animate-spin\">{iconNode}</span>\n ) : (\n iconNode\n )}\n </motion.span>\n </AnimatePresence>\n </motion.span>\n\n <div className={cn(\"min-w-0 flex-1\", classNames?.content)}>\n <AnimatePresence mode=\"popLayout\" initial={false}>\n <motion.div\n key={`${toast.id}-${status}-${String(toast.title)}`}\n initial={reduce ? { opacity: 0 } : { opacity: 0, y: 8, filter: \"blur(6px)\" }}\n animate={reduce ? { opacity: 1 } : { opacity: 1, y: 0, filter: \"blur(0px)\" }}\n exit={reduce ? { opacity: 0 } : { opacity: 0, y: -8, filter: \"blur(6px)\" }}\n transition={CONTENT_TRANSITION}\n >\n <p\n className={cn(\n \"truncate font-medium text-foreground text-sm leading-5\",\n classNames?.title,\n )}\n >\n {toast.title}\n </p>\n {toast.description ? (\n <p\n className={cn(\n \"mt-0.5 line-clamp-2 text-muted-foreground text-xs leading-4\",\n classNames?.description,\n )}\n >\n {toast.description}\n </p>\n ) : null}\n </motion.div>\n </AnimatePresence>\n\n {toast.action ? (\n <button\n type=\"button\"\n onClick={() => toast.action?.onClick(toast)}\n className={cn(\n \"mt-2 inline-flex h-7 items-center rounded-full bg-primary/6 px-3 font-medium text-foreground text-xs transition-colors hover:bg-primary/10\",\n classNames?.action,\n )}\n >\n {toast.action.label}\n </button>\n ) : null}\n </div>\n\n {canDismiss ? (\n <button\n type=\"button\"\n onClick={() => onDismiss?.(toast.id)}\n aria-label=\"Dismiss toast\"\n className={cn(\n \"inline-flex h-7 w-7 shrink-0 items-center justify-center rounded-full text-muted-foreground transition-colors hover:bg-primary/6 hover:text-foreground\",\n classNames?.close,\n )}\n >\n <X className=\"h-3.5 w-3.5\" />\n </button>\n ) : null}\n </div>\n )}\n </div>\n </motion.li>\n );\n});\n"],"mappings":";;;;;;;;;AA0EA,MAAM,eAA2B;CAC/B,MAAM;CACN,WAAW;CACX,SAAS;CACT,MAAM;AACR;AAEA,MAAM,qBAAqB;CACzB,UAAU;CACV,MAAM;AACR;AAEA,MAAM,cAA+C;CACnD,SAAS;CACT,MAAM;CACN,SAAS;CACT,SAAS;CACT,OAAO;AACT;AAEA,MAAM,eAA4C;CAChD,SAAS;CACT,MAAM;CACN,SAAS;CACT,SAAS;CACT,OAAO;AACT;AAEA,MAAM,iBAAgD;CACpD,YAAY;CACZ,cAAc;CACd,aAAa;CACb,eAAe;CACf,iBAAiB;CACjB,gBAAgB;AAClB;AAEA,IAAI,SAAS;AAEb,SAAS,YAAY,OAAmB,iBAAwC;CAC9E,OAAO;EACL,UAAU;EACV,aAAa;EACb,GAAG;EACH,IAAI,MAAM,MAAM,SA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UAAA,CACE,oBAAC,iBAAD;OAAiB,MAAK;OAAY,SAAS;OACzC,UAAA,qBAAC,OAAO,KAAR;QAEE,SAAS,SAAS,EAAE,SAAS,EAAE,IAAI;SAAE,SAAS;SAAG,GAAG;SAAG,QAAQ;QAAY;QAC3E,SAAS,SAAS,EAAE,SAAS,EAAE,IAAI;SAAE,SAAS;SAAG,GAAG;SAAG,QAAQ;QAAY;QAC3E,MAAM,SAAS,EAAE,SAAS,EAAE,IAAI;SAAE,SAAS;SAAG,GAAG;SAAI,QAAQ;QAAY;QACzE,YAAY;QALd,UAAA,CAOE,oBAAC,KAAD;SACE,WAAW,GACT,0DACA,YAAY,KACd;SAEC,UAAA,MAAM;QACN,CAAA,GACF,MAAM,cACL,oBAAC,KAAD;SACE,WAAW,GACT,+DACA,YAAY,WACd;SAEC,UAAA,MAAM;QACN,CAAA,IACD,IACM;OAxBL,GAAA,GAAG,MAAM,GAAG,GAAG,OAAO,GAAG,OAAO,MAAM,KAAK,GAwBtC;MACG,CAAA,GAEhB,MAAM,SACL,oBAAC,UAAD;OACE,MAAK;OACL,eAAe,MAAM,QAAQ,QAAQ,KAAK;OAC1C,WAAW,GACT,8IACA,YAAY,MACd;OAEC,UAAA,MAAM,OAAO;MACR,CAAA,IACN,IACD;;KAEJ,aACC,oBAAC,UAAD;MACE,MAAK;MACL,eAAe,YAAY,MAAM,EAAE;MACnC,cAAW;MACX,WAAW,GACT,0JACA,YAAY,KACd;MAEA,UAAA,oBAAC,GAAD,EAAG,WAAU,cAAe,CAAA;KACtB,CAAA,IACN;IACD;;EAEJ,CAAA;CACI,CAAA;AAEf,CAAC"}
1
+ {"version":3,"file":"animated-toast-stack.js","names":[],"sources":["../../../src/components/motion/animated-toast-stack.tsx"],"sourcesContent":["\"use client\";\n\nimport { memo, type ReactNode, useCallback, useEffect, useMemo, useRef, useState } from \"react\";\nimport { AlertCircle, Bell, Check, Info, LoaderCircle, type LucideIcon, X } from \"lucide-react\";\nimport { AnimatePresence, motion, type Transition, useReducedMotion } from \"motion/react\";\nimport { createPortal } from \"react-dom\";\n\nimport { cn } from \"@kumix/utils\";\nimport { EASE_OUT } from \"../../lib/ease\";\n\nexport type ToastStatus = \"neutral\" | \"info\" | \"loading\" | \"success\" | \"error\";\nexport type ToastPosition =\n | \"top-left\"\n | \"top-center\"\n | \"top-right\"\n | \"bottom-left\"\n | \"bottom-center\"\n | \"bottom-right\";\n\nexport type AnimatedToastAction = {\n label: ReactNode;\n onClick: (toast: AnimatedToast) => void;\n};\n\nexport type AnimatedToast = {\n id: string;\n title: ReactNode;\n description?: ReactNode;\n status?: ToastStatus;\n icon?: ReactNode;\n action?: AnimatedToastAction;\n duration?: number;\n dismissible?: boolean;\n createdAt?: number;\n};\n\nexport type ToastInput = Omit<AnimatedToast, \"id\" | \"createdAt\"> & {\n id?: string;\n};\n\nexport type ToastClassNames = {\n root?: string;\n item?: string;\n surface?: string;\n iconWrap?: string;\n content?: string;\n title?: string;\n description?: string;\n action?: string;\n close?: string;\n progress?: string;\n};\n\nexport interface AnimatedToastStackProps {\n toasts: AnimatedToast[];\n onDismiss?: (id: string) => void;\n position?: ToastPosition;\n placement?: \"static\" | \"fixed\" | \"absolute\";\n fixed?: boolean;\n portal?: boolean;\n portalRoot?: Element | null;\n maxVisible?: number;\n className?: string;\n classNames?: ToastClassNames;\n icons?: Partial<Record<ToastStatus, ReactNode>>;\n renderToast?: (toast: AnimatedToast) => ReactNode;\n}\n\nexport interface UseAnimatedToastStackOptions {\n initialToasts?: ToastInput[];\n defaultDuration?: number;\n limit?: number;\n}\n\nconst STACK_SPRING: Transition = {\n type: \"spring\",\n stiffness: 420,\n damping: 34,\n mass: 0.75,\n};\n\nconst CONTENT_TRANSITION = {\n duration: 0.28,\n ease: EASE_OUT,\n} as const;\n\nconst STATUS_ICON: Record<ToastStatus, LucideIcon> = {\n neutral: Bell,\n info: Info,\n loading: LoaderCircle,\n success: Check,\n error: AlertCircle,\n};\n\nconst STATUS_CLASS: Record<ToastStatus, string> = {\n neutral: \"text-muted-foreground bg-muted/60\",\n info: \"text-primary bg-muted\",\n loading: \"text-primary bg-muted\",\n success: \"text-emerald-600 bg-emerald-500/10 dark:text-emerald-400\",\n error: \"text-destructive bg-destructive/10\",\n};\n\nconst POSITION_CLASS: Record<ToastPosition, string> = {\n \"top-left\": \"left-4 top-4\",\n \"top-center\": \"left-1/2 top-4 -translate-x-1/2\",\n \"top-right\": \"right-4 top-4\",\n \"bottom-left\": \"bottom-6 left-4\",\n \"bottom-center\": \"bottom-6 left-1/2 -translate-x-1/2\",\n \"bottom-right\": \"bottom-6 right-4\",\n};\n\nlet idSeed = 0;\n\nfunction createToast(input: ToastInput, defaultDuration: number): AnimatedToast {\n return {\n duration: defaultDuration,\n dismissible: true,\n ...input,\n id: input.id ?? `toast-${Date.now()}-${idSeed++}`,\n createdAt: Date.now(),\n };\n}\n\nexport function useAnimatedToastStack({\n initialToasts = [],\n defaultDuration = 4200,\n limit,\n}: UseAnimatedToastStackOptions = {}) {\n const toastTimers = useRef<Map<string, { timer: number; signature: string }>>(new Map());\n const [toasts, setToasts] = useState<AnimatedToast[]>(() =>\n initialToasts.map((toast) => createToast(toast, defaultDuration)),\n );\n\n const dismissToast = useCallback((id: string) => {\n setToasts((current) => current.filter((toast) => toast.id !== id));\n }, []);\n\n const clearToasts = useCallback(() => {\n setToasts([]);\n }, []);\n\n const showToast = useCallback(\n (input: ToastInput) => {\n const toast = createToast(input, defaultDuration);\n setToasts((current) => {\n const next = [...current, toast];\n return typeof limit === \"number\" ? next.slice(-limit) : next;\n });\n return toast.id;\n },\n [defaultDuration, limit],\n );\n\n const updateToast = useCallback((id: string, patch: Partial<ToastInput>) => {\n setToasts((current) =>\n current.map((toast) =>\n toast.id === id\n ? {\n ...toast,\n ...patch,\n id,\n createdAt: patch.duration === undefined ? toast.createdAt : Date.now(),\n }\n : toast,\n ),\n );\n }, []);\n\n useEffect(() => {\n const activeIds = new Set(toasts.map((toast) => toast.id));\n\n toastTimers.current.forEach((entry, id) => {\n if (!activeIds.has(id)) {\n window.clearTimeout(entry.timer);\n toastTimers.current.delete(id);\n }\n });\n\n toasts.forEach((toast) => {\n const duration = toast.duration ?? defaultDuration;\n const existing = toastTimers.current.get(toast.id);\n\n if (duration <= 0) {\n if (existing) {\n window.clearTimeout(existing.timer);\n toastTimers.current.delete(toast.id);\n }\n return;\n }\n\n const createdAt = toast.createdAt ?? Date.now();\n const signature = `${createdAt}:${duration}`;\n\n if (existing?.signature === signature) {\n return;\n }\n\n if (existing) {\n window.clearTimeout(existing.timer);\n }\n\n const elapsed = Date.now() - createdAt;\n const remaining = Math.max(duration - elapsed, 0);\n const timer = window.setTimeout(() => {\n toastTimers.current.delete(toast.id);\n dismissToast(toast.id);\n }, remaining);\n\n toastTimers.current.set(toast.id, { timer, signature });\n });\n }, [defaultDuration, dismissToast, toasts]);\n\n useEffect(() => {\n const timers = toastTimers.current;\n\n return () => {\n timers.forEach((entry) => {\n window.clearTimeout(entry.timer);\n });\n timers.clear();\n };\n }, []);\n\n return useMemo(\n () => ({\n toasts,\n showToast,\n updateToast,\n dismissToast,\n clearToasts,\n setToasts,\n }),\n [clearToasts, dismissToast, showToast, toasts, updateToast],\n );\n}\n\nexport function AnimatedToastStack({\n toasts,\n onDismiss,\n position = \"bottom-right\",\n placement,\n fixed = false,\n portal,\n portalRoot,\n maxVisible = 4,\n className,\n classNames,\n icons,\n renderToast,\n}: AnimatedToastStackProps) {\n const [portalTarget, setPortalTarget] = useState<Element | null>(null);\n const visibleToasts = toasts.slice(-maxVisible);\n const isBottom = position.startsWith(\"bottom\");\n const resolvedPlacement = placement ?? (fixed ? \"fixed\" : \"static\");\n const shouldPortal = portal ?? resolvedPlacement === \"fixed\";\n\n useEffect(() => {\n setPortalTarget(shouldPortal ? (portalRoot ?? document.body) : null);\n }, [portalRoot, shouldPortal]);\n\n const stack = (\n <ol\n aria-live=\"polite\"\n aria-atomic=\"false\"\n className={cn(\n \"pointer-events-none flex w-[calc(100vw-2rem)] max-w-sm gap-2\",\n isBottom ? \"flex-col-reverse\" : \"flex-col\",\n resolvedPlacement === \"fixed\" && \"fixed z-90\",\n resolvedPlacement === \"absolute\" && \"absolute z-20\",\n resolvedPlacement !== \"static\" && POSITION_CLASS[position],\n classNames?.root,\n className,\n )}\n >\n <AnimatePresence initial={false} mode=\"popLayout\">\n {visibleToasts.map((toast, index) => (\n <ToastItem\n key={toast.id}\n toast={toast}\n index={index}\n onDismiss={onDismiss}\n classNames={classNames}\n icons={icons}\n renderToast={renderToast}\n />\n ))}\n </AnimatePresence>\n </ol>\n );\n\n if (shouldPortal && !portalTarget) {\n return null;\n }\n\n if (shouldPortal && portalTarget) {\n return createPortal(stack, portalTarget);\n }\n\n return stack;\n}\n\nconst ToastItem = memo(function ToastItem({\n toast,\n index,\n onDismiss,\n classNames,\n icons,\n renderToast,\n}: {\n toast: AnimatedToast;\n index: number;\n onDismiss?: (id: string) => void;\n classNames?: ToastClassNames;\n icons?: Partial<Record<ToastStatus, ReactNode>>;\n renderToast?: (toast: AnimatedToast) => ReactNode;\n}) {\n const reduce = useReducedMotion();\n const status = toast.status ?? \"neutral\";\n const Icon = STATUS_ICON[status];\n const iconNode = icons?.[status] ?? toast.icon ?? <Icon className=\"h-3.5 w-3.5\" />;\n const canDismiss = toast.dismissible !== false && Boolean(onDismiss);\n const hasDetails = Boolean(toast.description || toast.action);\n\n return (\n <motion.li\n layout\n initial={reduce ? { opacity: 0 } : { opacity: 0, y: 22, scale: 0.96, filter: \"blur(10px)\" }}\n animate={reduce ? { opacity: 1 } : { opacity: 1, y: 0, scale: 1, filter: \"blur(0px)\" }}\n exit={\n reduce\n ? { opacity: 0 }\n : {\n opacity: 0,\n x: 32,\n scale: 0.96,\n filter: \"blur(8px)\",\n transition: { duration: 0.18, ease: EASE_OUT },\n }\n }\n transition={STACK_SPRING}\n drag={canDismiss && !reduce ? \"x\" : false}\n dragConstraints={{ left: 0, right: 0 }}\n dragElastic={0.18}\n onDragEnd={(_, info) => {\n if (!canDismiss || !onDismiss) return;\n if (Math.abs(info.offset.x) > 72 || Math.abs(info.velocity.x) > 520) {\n onDismiss(toast.id);\n }\n }}\n className={cn(\"pointer-events-auto relative will-change-transform\", classNames?.item)}\n style={{ zIndex: 20 - index }}\n >\n <div\n className={cn(\n \"relative overflow-hidden rounded-2xl border border-border bg-card/95 p-3 shadow-2xl backdrop-blur-xl\",\n classNames?.surface,\n )}\n >\n {renderToast ? (\n renderToast(toast)\n ) : (\n <div className={cn(\"flex gap-3\", hasDetails ? \"items-start\" : \"items-center\")}>\n <motion.span\n layout\n className={cn(\n \"inline-flex h-7 w-7 shrink-0 items-center justify-center rounded-full\",\n hasDetails && \"mt-0.5\",\n STATUS_CLASS[status],\n classNames?.iconWrap,\n )}\n >\n <AnimatePresence mode=\"popLayout\" initial={false}>\n <motion.span\n key={status}\n initial={\n reduce ? { opacity: 0 } : { opacity: 0, y: 8, scale: 0.8, filter: \"blur(6px)\" }\n }\n animate={\n reduce ? { opacity: 1 } : { opacity: 1, y: 0, scale: 1, filter: \"blur(0px)\" }\n }\n exit={\n reduce ? { opacity: 0 } : { opacity: 0, y: -8, scale: 0.9, filter: \"blur(6px)\" }\n }\n transition={CONTENT_TRANSITION}\n className=\"inline-flex\"\n >\n {status === \"loading\" ? (\n <span className=\"inline-flex animate-spin\">{iconNode}</span>\n ) : (\n iconNode\n )}\n </motion.span>\n </AnimatePresence>\n </motion.span>\n\n <div className={cn(\"min-w-0 flex-1\", classNames?.content)}>\n <AnimatePresence mode=\"popLayout\" initial={false}>\n <motion.div\n key={`${toast.id}-${status}-${String(toast.title)}`}\n initial={reduce ? { opacity: 0 } : { opacity: 0, y: 8, filter: \"blur(6px)\" }}\n animate={reduce ? { opacity: 1 } : { opacity: 1, y: 0, filter: \"blur(0px)\" }}\n exit={reduce ? { opacity: 0 } : { opacity: 0, y: -8, filter: \"blur(6px)\" }}\n transition={CONTENT_TRANSITION}\n >\n <p\n className={cn(\n \"truncate font-medium text-foreground text-sm leading-5\",\n classNames?.title,\n )}\n >\n {toast.title}\n </p>\n {toast.description ? (\n <p\n className={cn(\n \"mt-0.5 line-clamp-2 text-muted-foreground text-xs leading-4\",\n classNames?.description,\n )}\n >\n {toast.description}\n </p>\n ) : null}\n </motion.div>\n </AnimatePresence>\n\n {toast.action ? (\n <button\n type=\"button\"\n onClick={() => toast.action?.onClick(toast)}\n className={cn(\n \"mt-2 inline-flex h-7 items-center rounded-full bg-muted/80 px-3 font-medium text-foreground text-xs transition-colors hover:bg-muted\",\n classNames?.action,\n )}\n >\n {toast.action.label}\n </button>\n ) : null}\n </div>\n\n {canDismiss ? (\n <button\n type=\"button\"\n onClick={() => onDismiss?.(toast.id)}\n aria-label=\"Dismiss toast\"\n className={cn(\n \"inline-flex h-7 w-7 shrink-0 items-center justify-center rounded-full text-muted-foreground transition-colors hover:bg-muted/80 hover:text-foreground\",\n classNames?.close,\n )}\n >\n <X className=\"h-3.5 w-3.5\" />\n </button>\n ) : null}\n </div>\n )}\n </div>\n </motion.li>\n );\n});\n"],"mappings":";;;;;;;;;AA0EA,MAAM,eAA2B;CAC/B,MAAM;CACN,WAAW;CACX,SAAS;CACT,MAAM;AACR;AAEA,MAAM,qBAAqB;CACzB,UAAU;CACV,MAAM;AACR;AAEA,MAAM,cAA+C;CACnD,SAAS;CACT,MAAM;CACN,SAAS;CACT,SAAS;CACT,OAAO;AACT;AAEA,MAAM,eAA4C;CAChD,SAAS;CACT,MAAM;CACN,SAAS;CACT,SAAS;CACT,OAAO;AACT;AAEA,MAAM,iBAAgD;CACpD,YAAY;CACZ,cAAc;CACd,aAAa;CACb,eAAe;CACf,iBAAiB;CACjB,gBAAgB;AAClB;AAEA,IAAI,SAAS;AAEb,SAAS,YAAY,OAAmB,iBAAwC;CAC9E,OAAO;EACL,UAAU;EACV,aAAa;EACb,GAAG;EACH,IAAI,MAAM,MAAM,SAAS,KAAK,IAAI,EAAE,GAAG;EACvC,WAAW,KAAK,IAAI;CACtB;AACF;AAEA,S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OAAO,KAAR;QAEE,SAAS,SAAS,EAAE,SAAS,EAAE,IAAI;SAAE,SAAS;SAAG,GAAG;SAAG,QAAQ;QAAY;QAC3E,SAAS,SAAS,EAAE,SAAS,EAAE,IAAI;SAAE,SAAS;SAAG,GAAG;SAAG,QAAQ;QAAY;QAC3E,MAAM,SAAS,EAAE,SAAS,EAAE,IAAI;SAAE,SAAS;SAAG,GAAG;SAAI,QAAQ;QAAY;QACzE,YAAY;QALd,UAAA,CAOE,oBAAC,KAAD;SACE,WAAW,GACT,0DACA,YAAY,KACd;SAEC,UAAA,MAAM;QACN,CAAA,GACF,MAAM,cACL,oBAAC,KAAD;SACE,WAAW,GACT,+DACA,YAAY,WACd;SAEC,UAAA,MAAM;QACN,CAAA,IACD,IACM;OAxBL,GAAA,GAAG,MAAM,GAAG,GAAG,OAAO,GAAG,OAAO,MAAM,KAAK,GAwBtC;MACG,CAAA,GAEhB,MAAM,SACL,oBAAC,UAAD;OACE,MAAK;OACL,eAAe,MAAM,QAAQ,QAAQ,KAAK;OAC1C,WAAW,GACT,wIACA,YAAY,MACd;OAEC,UAAA,MAAM,OAAO;MACR,CAAA,IACN,IACD;;KAEJ,aACC,oBAAC,UAAD;MACE,MAAK;MACL,eAAe,YAAY,MAAM,EAAE;MACnC,cAAW;MACX,WAAW,GACT,yJACA,YAAY,KACd;MAEA,UAAA,oBAAC,GAAD,EAAG,WAAU,cAAe,CAAA;KACtB,CAAA,IACN;IACD;;EAEJ,CAAA;CACI,CAAA;AAEf,CAAC"}
@@ -4,9 +4,9 @@ import { t as PresenceGate } from "../../presence-gate-BekdC4Bo.js";
4
4
  import { Tooltip } from "./tooltip.js";
5
5
  import { useCallback, useEffect, useId, useRef, useState } from "react";
6
6
  import { cn } from "@kumix/utils";
7
+ import { AlertCircle, Check, ExternalLink, FileImage, Link, LoaderCircle, Mic, Paperclip, Pause, Play, RotateCcw, Upload, X } from "lucide-react";
7
8
  import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
8
9
  import { AnimatePresence, LayoutGroup, motion, useReducedMotion } from "motion/react";
9
- import { AlertCircle, Check, ExternalLink, FileImage, Link, LoaderCircle, Mic, Paperclip, Pause, Play, RotateCcw, Upload, X } from "lucide-react";
10
10
  import { createPortal } from "react-dom";
11
11
  //#region src/components/motion/attachment-upload.tsx
12
12
  const ITEM_TRANSITION = {
@@ -1,3 +1,3 @@
1
1
  "use client";
2
- import { t as CopyMenu } from "../../../copy-menu-C5GaT4Z-.js";
2
+ import { t as CopyMenu } from "../../../copy-menu-TIKvPaAZ.js";
3
3
  export { CopyMenu };
@@ -3,12 +3,12 @@ import { SPRING_LAYOUT } from "../../../lib/ease.js";
3
3
  import { Tooltip } from "../tooltip.js";
4
4
  import { Switch } from "../switch.js";
5
5
  import { IconButton } from "./icon-button.js";
6
- import { c as startOptions, i as clampRange, l as toMinutes, o as endOptions, s as panelKey, t as CopyMenu, u as toValue } from "../../../copy-menu-C5GaT4Z-.js";
6
+ import { c as startOptions, i as clampRange, l as toMinutes, o as endOptions, s as panelKey, t as CopyMenu, u as toValue } from "../../../copy-menu-TIKvPaAZ.js";
7
7
  import { TimeSelect } from "./time-select.js";
8
8
  import { useRef, useState } from "react";
9
+ import { Plus, X } from "lucide-react";
9
10
  import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
10
11
  import { AnimatePresence, motion } from "motion/react";
11
- import { Plus, X } from "lucide-react";
12
12
  //#region src/components/motion/availability-scheduler/day-row.tsx
13
13
  function DayRow({ day, label, state, options, reduce, elevated, openPanel, onChange, onCopy, onPanelOpenChange }) {
14
14
  const idRef = useRef(0);
@@ -1,5 +1,5 @@
1
1
  "use client";
2
- import { a as defaultWeek, n as WEEKDAYS, r as buildOptions, s as panelKey } from "../../../copy-menu-C5GaT4Z-.js";
2
+ import { a as defaultWeek, n as WEEKDAYS, r as buildOptions, s as panelKey } from "../../../copy-menu-TIKvPaAZ.js";
3
3
  import { DayRow } from "./day-row.js";
4
4
  import { useCallback, useEffect, useId, useMemo, useRef, useState } from "react";
5
5
  import { cn } from "@kumix/utils";
@@ -2,9 +2,9 @@
2
2
  import { EASE_OUT } from "../../lib/ease.js";
3
3
  import { useEffect, useId, useRef, useState } from "react";
4
4
  import { cn } from "@kumix/utils";
5
+ import { Bell, FileText, FolderClosed, LayoutGrid, Link, Plus, Table, X } from "lucide-react";
5
6
  import { jsx, jsxs } from "react/jsx-runtime";
6
7
  import { AnimatePresence, motion, useReducedMotion } from "motion/react";
7
- import { Bell, FileText, FolderClosed, LayoutGrid, Link, Plus, Table, X } from "lucide-react";
8
8
  //#region src/components/motion/bloom-menu.tsx
9
9
  const ITEMS = [
10
10
  {
@@ -2,9 +2,9 @@
2
2
  import { EASE_OUT } from "../../lib/ease.js";
3
3
  import { useCallback, useId, useLayoutEffect, useRef, useState } from "react";
4
4
  import { cn } from "@kumix/utils";
5
+ import { ChevronDown } from "lucide-react";
5
6
  import { jsx, jsxs } from "react/jsx-runtime";
6
7
  import { motion, useReducedMotion } from "motion/react";
7
- import { ChevronDown } from "lucide-react";
8
8
  //#region src/components/motion/bouncy-accordion.tsx
9
9
  const ROW_TRANSITION = {
10
10
  type: "spring",
@@ -9,8 +9,8 @@ import { AnimatePresence, motion, useReducedMotion } from "motion/react";
9
9
  const VARIANT_CLASS = {
10
10
  primary: "bg-primary text-primary-foreground hover:bg-primary/90",
11
11
  secondary: "border border-border bg-card text-foreground hover:border-border",
12
- ghost: "text-muted-foreground hover:text-foreground hover:bg-primary/5",
13
- outline: "border border-border bg-transparent text-foreground hover:bg-primary/5"
12
+ ghost: "text-muted-foreground hover:text-foreground hover:bg-muted/60",
13
+ outline: "border border-border bg-transparent text-foreground hover:bg-muted/60"
14
14
  };
15
15
  const SIZE_CLASS = {
16
16
  sm: "h-8 px-3 text-xs gap-1.5 rounded-full",
@@ -1 +1 @@
1
- {"version":3,"file":"base.js","names":[],"sources":["../../../../src/components/motion/button/base.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n forwardRef,\n type PointerEvent,\n type ReactNode,\n useCallback,\n useRef,\n useState,\n} from \"react\";\nimport { AnimatePresence, type HTMLMotionProps, motion, useReducedMotion } from \"motion/react\";\n\nimport { cn } from \"@kumix/utils\";\nimport { useHoverCapable } from \"../../../hooks/use-hover-capable\";\nimport { EASE_OUT, SPRING_PRESS } from \"../../../lib/ease\";\n\nexport type ButtonVariant = \"primary\" | \"secondary\" | \"ghost\" | \"outline\";\nexport type ButtonSize = \"sm\" | \"md\" | \"lg\" | \"icon\";\n\nexport interface ButtonProps extends Omit<HTMLMotionProps<\"button\">, \"children\"> {\n variant?: ButtonVariant;\n size?: ButtonSize;\n pressScale?: number;\n /** Spawn a Material-style ripple from the press point. Off by default. */\n ripple?: boolean;\n children?: ReactNode;\n}\n\nexport interface ButtonLinkProps extends Omit<HTMLMotionProps<\"a\">, \"children\"> {\n variant?: ButtonVariant;\n size?: ButtonSize;\n pressScale?: number;\n children?: ReactNode;\n}\n\ntype Ripple = { id: number; x: number; y: number; size: number };\n\nconst VARIANT_CLASS: Record<ButtonVariant, string> = {\n primary: \"bg-primary text-primary-foreground hover:bg-primary/90\",\n secondary: \"border border-border bg-card text-foreground hover:border-border\",\n ghost: \"text-muted-foreground hover:text-foreground hover:bg-primary/5\",\n outline: \"border border-border bg-transparent text-foreground hover:bg-primary/5\",\n};\n\nconst SIZE_CLASS: Record<ButtonSize, string> = {\n sm: \"h-8 px-3 text-xs gap-1.5 rounded-full\",\n md: \"h-10 px-5 text-sm gap-2 rounded-full\",\n lg: \"h-12 px-6 text-base gap-2 rounded-full\",\n icon: \"h-8 w-8 rounded-lg\",\n};\n\nexport const Button = forwardRef<HTMLButtonElement, ButtonProps>(function Button(\n {\n variant = \"primary\",\n size = \"md\",\n pressScale = 0.93,\n ripple = false,\n className,\n children,\n onPointerDown,\n ...rest\n },\n ref,\n) {\n const reduce = useReducedMotion();\n const canHover = useHoverCapable();\n const [ripples, setRipples] = useState<Ripple[]>([]);\n const nextId = useRef(0);\n\n const handlePointerDown = useCallback(\n (event: PointerEvent<HTMLButtonElement>) => {\n if (ripple && !reduce) {\n const rect = event.currentTarget.getBoundingClientRect();\n const size = Math.max(rect.width, rect.height) * 2;\n const id = nextId.current++;\n setRipples((prev) => [\n ...prev,\n {\n id,\n x: event.clientX - rect.left,\n y: event.clientY - rect.top,\n size,\n },\n ]);\n }\n onPointerDown?.(event);\n },\n [ripple, reduce, onPointerDown],\n );\n\n return (\n <motion.button\n ref={ref}\n type=\"button\"\n whileTap={reduce ? undefined : { scale: pressScale }}\n whileHover={reduce || !canHover ? undefined : { scale: 1.02 }}\n transition={SPRING_PRESS}\n onPointerDown={handlePointerDown}\n className={cn(\n \"inline-flex select-none items-center justify-center font-medium\",\n \"transition-colors\",\n \"disabled:pointer-events-none disabled:opacity-50\",\n ripple && \"relative overflow-hidden\",\n VARIANT_CLASS[variant],\n SIZE_CLASS[size],\n className,\n )}\n {...rest}\n >\n {ripple && !reduce ? (\n <span className=\"pointer-events-none absolute inset-0 overflow-hidden rounded-[inherit]\">\n <AnimatePresence>\n {ripples.map((r) => (\n <motion.span\n key={r.id}\n className=\"absolute rounded-full bg-current\"\n style={{\n left: r.x,\n top: r.y,\n width: r.size,\n height: r.size,\n x: \"-50%\",\n y: \"-50%\",\n }}\n initial={{ scale: 0.05, opacity: 0.3 }}\n animate={{ scale: 1, opacity: 0 }}\n exit={{ opacity: 0 }}\n transition={{ duration: 1.6, ease: EASE_OUT }}\n onAnimationComplete={() => setRipples((prev) => prev.filter((x) => x.id !== r.id))}\n />\n ))}\n </AnimatePresence>\n </span>\n ) : null}\n {children}\n </motion.button>\n );\n});\n\nexport const ButtonLink = forwardRef<HTMLAnchorElement, ButtonLinkProps>(function ButtonLink(\n { variant = \"primary\", size = \"md\", pressScale = 0.93, className, children, ...rest },\n ref,\n) {\n const reduce = useReducedMotion();\n const canHover = useHoverCapable();\n\n return (\n <motion.a\n ref={ref}\n whileTap={reduce ? undefined : { scale: pressScale }}\n whileHover={reduce || !canHover ? undefined : { scale: 1.02 }}\n transition={SPRING_PRESS}\n className={cn(\n \"inline-flex select-none items-center justify-center font-medium\",\n \"transition-colors\",\n VARIANT_CLASS[variant],\n SIZE_CLASS[size],\n className,\n )}\n {...rest}\n >\n {children}\n </motion.a>\n );\n});\n"],"mappings":";;;;;;;;AAqCA,MAAM,gBAA+C;CACnD,SAAS;CACT,WAAW;CACX,OAAO;CACP,SAAS;AACX;AAEA,MAAM,aAAyC;CAC7C,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,MAAM;AACR;AAEA,MAAa,SAAS,WAA2C,SAAS,OACxE,EACE,UAAU,WACV,OAAO,MACP,aAAa,KACb,SAAS,OACT,WACA,UACA,eACA,GAAG,QAEL,KACA;CACA,MAAM,SAAS,iBAAiB;CAChC,MAAM,WAAW,gBAAgB;CACjC,MAAM,CAAC,SAAS,cAAc,SAAmB,CAAC,CAAC;CACnD,MAAM,SAAS,OAAO,CAAC;CAEvB,MAAM,oBAAoB,aACvB,UAA2C;EAC1C,IAAI,UAAU,CAAC,QAAQ;GACrB,MAAM,OAAO,MAAM,cAAc,sBAAsB;GACvD,MAAM,OAAO,KAAK,IAAI,KAAK,OAAO,KAAK,MAAM,IAAI;GACjD,MAAM,KAAK,OAAO;GAClB,YAAY,SAAS,CACnB,GAAG,MACH;IACE;IACA,GAAG,MAAM,UAAU,KAAK;IACxB,GAAG,MAAM,UAAU,KAAK;IACxB;GACF,CACF,CAAC;EACH;EACA,gBAAgB,KAAK;CACvB,GACA;EAAC;EAAQ;EAAQ;CAAa,CAChC;CAEA,OACE,qBAAC,OAAO,QAAR;EACO;EACL,MAAK;EACL,UAAU,SAAS,KAAA,IAAY,EAAE,OAAO,WAAW;EACnD,YAAY,UAAU,CAAC,WAAW,KAAA,IAAY,EAAE,OAAO,KAAK;EAC5D,YAAY;EACZ,eAAe;EACf,WAAW,GACT,mEACA,qBACA,oDACA,UAAU,4BACV,cAAc,UACd,WAAW,OACX,SACF;EACA,GAAI;EAhBN,UAAA,CAkBG,UAAU,CAAC,SACV,oBAAC,QAAD;GAAM,WAAU;GACd,UAAA,oBAAC,iBAAD,EAAA,UACG,QAAQ,KAAK,MACZ,oBAAC,OAAO,MAAR;IAEE,WAAU;IACV,OAAO;KACL,MAAM,EAAE;KACR,KAAK,EAAE;KACP,OAAO,EAAE;KACT,QAAQ,EAAE;KACV,GAAG;KACH,GAAG;IACL;IACA,SAAS;KAAE,OAAO;KAAM,SAAS;IAAI;IACrC,SAAS;KAAE,OAAO;KAAG,SAAS;IAAE;IAChC,MAAM,EAAE,SAAS,EAAE;IACnB,YAAY;KAAE,UAAU;KAAK,MAAM;IAAS;IAC5C,2BAA2B,YAAY,SAAS,KAAK,QAAQ,MAAM,EAAE,OAAO,EAAE,EAAE,CAAC;GAClF,GAfM,EAAE,EAeR,CACF,EACc,CAAA;EACb,CAAA,IACJ,MACH,QACY;;AAEnB,CAAC;AAED,MAAa,aAAa,WAA+C,SAAS,WAChF,EAAE,UAAU,WAAW,OAAO,MAAM,aAAa,KAAM,WAAW,UAAU,GAAG,QAC/E,KACA;CACA,MAAM,SAAS,iBAAiB;CAChC,MAAM,WAAW,gBAAgB;CAEjC,OACE,oBAAC,OAAO,GAAR;EACO;EACL,UAAU,SAAS,KAAA,IAAY,EAAE,OAAO,WAAW;EACnD,YAAY,UAAU,CAAC,WAAW,KAAA,IAAY,EAAE,OAAO,KAAK;EAC5D,YAAY;EACZ,WAAW,GACT,mEACA,qBACA,cAAc,UACd,WAAW,OACX,SACF;EACA,GAAI;EAEH;CACO,CAAA;AAEd,CAAC"}
1
+ {"version":3,"file":"base.js","names":[],"sources":["../../../../src/components/motion/button/base.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n forwardRef,\n type PointerEvent,\n type ReactNode,\n useCallback,\n useRef,\n useState,\n} from \"react\";\nimport { AnimatePresence, type HTMLMotionProps, motion, useReducedMotion } from \"motion/react\";\n\nimport { cn } from \"@kumix/utils\";\nimport { useHoverCapable } from \"../../../hooks/use-hover-capable\";\nimport { EASE_OUT, SPRING_PRESS } from \"../../../lib/ease\";\n\nexport type ButtonVariant = \"primary\" | \"secondary\" | \"ghost\" | \"outline\";\nexport type ButtonSize = \"sm\" | \"md\" | \"lg\" | \"icon\";\n\nexport interface ButtonProps extends Omit<HTMLMotionProps<\"button\">, \"children\"> {\n variant?: ButtonVariant;\n size?: ButtonSize;\n pressScale?: number;\n /** Spawn a Material-style ripple from the press point. Off by default. */\n ripple?: boolean;\n children?: ReactNode;\n}\n\nexport interface ButtonLinkProps extends Omit<HTMLMotionProps<\"a\">, \"children\"> {\n variant?: ButtonVariant;\n size?: ButtonSize;\n pressScale?: number;\n children?: ReactNode;\n}\n\ntype Ripple = { id: number; x: number; y: number; size: number };\n\nconst VARIANT_CLASS: Record<ButtonVariant, string> = {\n primary: \"bg-primary text-primary-foreground hover:bg-primary/90\",\n secondary: \"border border-border bg-card text-foreground hover:border-border\",\n ghost: \"text-muted-foreground hover:text-foreground hover:bg-muted/60\",\n outline: \"border border-border bg-transparent text-foreground hover:bg-muted/60\",\n};\n\nconst SIZE_CLASS: Record<ButtonSize, string> = {\n sm: \"h-8 px-3 text-xs gap-1.5 rounded-full\",\n md: \"h-10 px-5 text-sm gap-2 rounded-full\",\n lg: \"h-12 px-6 text-base gap-2 rounded-full\",\n icon: \"h-8 w-8 rounded-lg\",\n};\n\nexport const Button = forwardRef<HTMLButtonElement, ButtonProps>(function Button(\n {\n variant = \"primary\",\n size = \"md\",\n pressScale = 0.93,\n ripple = false,\n className,\n children,\n onPointerDown,\n ...rest\n },\n ref,\n) {\n const reduce = useReducedMotion();\n const canHover = useHoverCapable();\n const [ripples, setRipples] = useState<Ripple[]>([]);\n const nextId = useRef(0);\n\n const handlePointerDown = useCallback(\n (event: PointerEvent<HTMLButtonElement>) => {\n if (ripple && !reduce) {\n const rect = event.currentTarget.getBoundingClientRect();\n const size = Math.max(rect.width, rect.height) * 2;\n const id = nextId.current++;\n setRipples((prev) => [\n ...prev,\n {\n id,\n x: event.clientX - rect.left,\n y: event.clientY - rect.top,\n size,\n },\n ]);\n }\n onPointerDown?.(event);\n },\n [ripple, reduce, onPointerDown],\n );\n\n return (\n <motion.button\n ref={ref}\n type=\"button\"\n whileTap={reduce ? undefined : { scale: pressScale }}\n whileHover={reduce || !canHover ? undefined : { scale: 1.02 }}\n transition={SPRING_PRESS}\n onPointerDown={handlePointerDown}\n className={cn(\n \"inline-flex select-none items-center justify-center font-medium\",\n \"transition-colors\",\n \"disabled:pointer-events-none disabled:opacity-50\",\n ripple && \"relative overflow-hidden\",\n VARIANT_CLASS[variant],\n SIZE_CLASS[size],\n className,\n )}\n {...rest}\n >\n {ripple && !reduce ? (\n <span className=\"pointer-events-none absolute inset-0 overflow-hidden rounded-[inherit]\">\n <AnimatePresence>\n {ripples.map((r) => (\n <motion.span\n key={r.id}\n className=\"absolute rounded-full bg-current\"\n style={{\n left: r.x,\n top: r.y,\n width: r.size,\n height: r.size,\n x: \"-50%\",\n y: \"-50%\",\n }}\n initial={{ scale: 0.05, opacity: 0.3 }}\n animate={{ scale: 1, opacity: 0 }}\n exit={{ opacity: 0 }}\n transition={{ duration: 1.6, ease: EASE_OUT }}\n onAnimationComplete={() => setRipples((prev) => prev.filter((x) => x.id !== r.id))}\n />\n ))}\n </AnimatePresence>\n </span>\n ) : null}\n {children}\n </motion.button>\n );\n});\n\nexport const ButtonLink = forwardRef<HTMLAnchorElement, ButtonLinkProps>(function ButtonLink(\n { variant = \"primary\", size = \"md\", pressScale = 0.93, className, children, ...rest },\n ref,\n) {\n const reduce = useReducedMotion();\n const canHover = useHoverCapable();\n\n return (\n <motion.a\n ref={ref}\n whileTap={reduce ? undefined : { scale: pressScale }}\n whileHover={reduce || !canHover ? undefined : { scale: 1.02 }}\n transition={SPRING_PRESS}\n className={cn(\n \"inline-flex select-none items-center justify-center font-medium\",\n \"transition-colors\",\n VARIANT_CLASS[variant],\n SIZE_CLASS[size],\n className,\n )}\n {...rest}\n >\n {children}\n </motion.a>\n );\n});\n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