@kumix/ui 0.3.6 → 0.3.8

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 (305) hide show
  1. package/README.md +25 -24
  2. package/dist/cascader-types-BnH6wYD-.d.ts +183 -0
  3. package/dist/cascader-types-BnH6wYD-.d.ts.map +1 -0
  4. package/dist/components/agents/ai-sidebar.d.ts +17 -1
  5. package/dist/components/agents/ai-sidebar.d.ts.map +1 -1
  6. package/dist/components/agents/ai-sidebar.js +90 -14
  7. package/dist/components/agents/ai-sidebar.js.map +1 -1
  8. package/dist/components/agents/chat-app.d.ts +10 -5
  9. package/dist/components/agents/chat-app.d.ts.map +1 -1
  10. package/dist/components/agents/chat-app.js +54 -5
  11. package/dist/components/agents/chat-app.js.map +1 -1
  12. package/dist/components/agents/citations.d.ts.map +1 -1
  13. package/dist/components/agents/citations.js +5 -6
  14. package/dist/components/agents/citations.js.map +1 -1
  15. package/dist/components/agents/tool-approval.d.ts.map +1 -1
  16. package/dist/components/agents/tool-approval.js +1 -1
  17. package/dist/components/agents/tool-approval.js.map +1 -1
  18. package/dist/components/motion/action-swap.d.ts.map +1 -1
  19. package/dist/components/motion/action-swap.js +2 -2
  20. package/dist/components/motion/action-swap.js.map +1 -1
  21. package/dist/components/motion/animated-sidebar.d.ts.map +1 -1
  22. package/dist/components/motion/animated-sidebar.js +13 -3
  23. package/dist/components/motion/animated-sidebar.js.map +1 -1
  24. package/dist/components/motion/attachment-upload.d.ts.map +1 -1
  25. package/dist/components/motion/attachment-upload.js +9 -5
  26. package/dist/components/motion/attachment-upload.js.map +1 -1
  27. package/dist/components/motion/availability-scheduler/copy-menu.js +1 -1
  28. package/dist/components/motion/availability-scheduler/day-row.d.ts +5 -2
  29. package/dist/components/motion/availability-scheduler/day-row.d.ts.map +1 -1
  30. package/dist/components/motion/availability-scheduler/day-row.js +18 -8
  31. package/dist/components/motion/availability-scheduler/day-row.js.map +1 -1
  32. package/dist/components/motion/availability-scheduler/index.d.ts.map +1 -1
  33. package/dist/components/motion/availability-scheduler/index.js +27 -5
  34. package/dist/components/motion/availability-scheduler/index.js.map +1 -1
  35. package/dist/components/motion/availability-scheduler/time-select.d.ts +3 -1
  36. package/dist/components/motion/availability-scheduler/time-select.d.ts.map +1 -1
  37. package/dist/components/motion/availability-scheduler/time-select.js +3 -1
  38. package/dist/components/motion/availability-scheduler/time-select.js.map +1 -1
  39. package/dist/components/motion/bottom-sheet.d.ts.map +1 -1
  40. package/dist/components/motion/bottom-sheet.js +78 -74
  41. package/dist/components/motion/bottom-sheet.js.map +1 -1
  42. package/dist/components/motion/center-morph-modal.d.ts.map +1 -1
  43. package/dist/components/motion/center-morph-modal.js +82 -88
  44. package/dist/components/motion/center-morph-modal.js.map +1 -1
  45. package/dist/components/motion/command-palette.d.ts.map +1 -1
  46. package/dist/components/motion/command-palette.js +51 -27
  47. package/dist/components/motion/command-palette.js.map +1 -1
  48. package/dist/components/motion/context-menu.d.ts.map +1 -1
  49. package/dist/components/motion/context-menu.js +16 -6
  50. package/dist/components/motion/context-menu.js.map +1 -1
  51. package/dist/components/motion/cylinder-carousel.d.ts.map +1 -1
  52. package/dist/components/motion/cylinder-carousel.js +4 -3
  53. package/dist/components/motion/cylinder-carousel.js.map +1 -1
  54. package/dist/components/motion/drawer.d.ts.map +1 -1
  55. package/dist/components/motion/drawer.js +30 -30
  56. package/dist/components/motion/drawer.js.map +1 -1
  57. package/dist/components/motion/expandable-action-bar.d.ts +6 -0
  58. package/dist/components/motion/expandable-action-bar.d.ts.map +1 -1
  59. package/dist/components/motion/expandable-action-bar.js +38 -9
  60. package/dist/components/motion/expandable-action-bar.js.map +1 -1
  61. package/dist/components/motion/hold-action-button.d.ts +1 -1
  62. package/dist/components/motion/hold-action-button.d.ts.map +1 -1
  63. package/dist/components/motion/hold-action-button.js +64 -50
  64. package/dist/components/motion/hold-action-button.js.map +1 -1
  65. package/dist/components/motion/loader.js +20 -22
  66. package/dist/components/motion/loader.js.map +1 -1
  67. package/dist/components/motion/morphing-modal.d.ts.map +1 -1
  68. package/dist/components/motion/morphing-modal.js +83 -83
  69. package/dist/components/motion/morphing-modal.js.map +1 -1
  70. package/dist/components/motion/morphing-search.d.ts +28 -0
  71. package/dist/components/motion/morphing-search.d.ts.map +1 -0
  72. package/dist/components/motion/morphing-search.js +418 -0
  73. package/dist/components/motion/morphing-search.js.map +1 -0
  74. package/dist/components/motion/morphing-tabs.d.ts.map +1 -1
  75. package/dist/components/motion/morphing-tabs.js +59 -18
  76. package/dist/components/motion/morphing-tabs.js.map +1 -1
  77. package/dist/components/motion/notification-stack.d.ts.map +1 -1
  78. package/dist/components/motion/notification-stack.js +28 -11
  79. package/dist/components/motion/notification-stack.js.map +1 -1
  80. package/dist/components/motion/popover-morph.d.ts.map +1 -1
  81. package/dist/components/motion/popover-morph.js +26 -11
  82. package/dist/components/motion/popover-morph.js.map +1 -1
  83. package/dist/components/motion/popover.d.ts.map +1 -1
  84. package/dist/components/motion/popover.js +39 -28
  85. package/dist/components/motion/popover.js.map +1 -1
  86. package/dist/components/motion/preview-rail.d.ts.map +1 -1
  87. package/dist/components/motion/preview-rail.js +42 -13
  88. package/dist/components/motion/preview-rail.js.map +1 -1
  89. package/dist/components/motion/project-folder.js +20 -20
  90. package/dist/components/motion/project-folder.js.map +1 -1
  91. package/dist/components/motion/pull-to-refresh.d.ts.map +1 -1
  92. package/dist/components/motion/pull-to-refresh.js +8 -7
  93. package/dist/components/motion/pull-to-refresh.js.map +1 -1
  94. package/dist/components/motion/range-slider-bubble.d.ts.map +1 -1
  95. package/dist/components/motion/range-slider-bubble.js +2 -1
  96. package/dist/components/motion/range-slider-bubble.js.map +1 -1
  97. package/dist/components/motion/range-slider-fluid.d.ts.map +1 -1
  98. package/dist/components/motion/range-slider-fluid.js +2 -1
  99. package/dist/components/motion/range-slider-fluid.js.map +1 -1
  100. package/dist/components/motion/range-slider-ruler.d.ts.map +1 -1
  101. package/dist/components/motion/range-slider-ruler.js +2 -1
  102. package/dist/components/motion/range-slider-ruler.js.map +1 -1
  103. package/dist/components/motion/range-slider-wave.d.ts.map +1 -1
  104. package/dist/components/motion/range-slider-wave.js +2 -1
  105. package/dist/components/motion/range-slider-wave.js.map +1 -1
  106. package/dist/components/motion/range-slider.d.ts.map +1 -1
  107. package/dist/components/motion/range-slider.js +2 -1
  108. package/dist/components/motion/range-slider.js.map +1 -1
  109. package/dist/components/motion/select.d.ts +15 -1
  110. package/dist/components/motion/select.d.ts.map +1 -1
  111. package/dist/components/motion/select.js +15 -4
  112. package/dist/components/motion/select.js.map +1 -1
  113. package/dist/components/motion/slide-action-button.d.ts.map +1 -1
  114. package/dist/components/motion/slide-action-button.js +3 -2
  115. package/dist/components/motion/slide-action-button.js.map +1 -1
  116. package/dist/components/motion/swipeable-list.d.ts.map +1 -1
  117. package/dist/components/motion/swipeable-list.js +2 -1
  118. package/dist/components/motion/swipeable-list.js.map +1 -1
  119. package/dist/components/motion/table/index.d.ts.map +1 -1
  120. package/dist/components/motion/table/index.js +64 -6
  121. package/dist/components/motion/table/index.js.map +1 -1
  122. package/dist/components/motion/table/table-header.d.ts.map +1 -1
  123. package/dist/components/motion/table/table-header.js +3 -2
  124. package/dist/components/motion/table/table-header.js.map +1 -1
  125. package/dist/components/motion/text-reveal.d.ts.map +1 -1
  126. package/dist/components/motion/text-reveal.js +72 -48
  127. package/dist/components/motion/text-reveal.js.map +1 -1
  128. package/dist/components/motion/tooltip.d.ts.map +1 -1
  129. package/dist/components/motion/tooltip.js +35 -15
  130. package/dist/components/motion/tooltip.js.map +1 -1
  131. package/dist/components/motion/wheel-picker.d.ts.map +1 -1
  132. package/dist/components/motion/wheel-picker.js +4 -3
  133. package/dist/components/motion/wheel-picker.js.map +1 -1
  134. package/dist/components/reui/badge.d.ts +1 -1
  135. package/dist/components/reui/cascader/cascader-async.d.ts +90 -0
  136. package/dist/components/reui/cascader/cascader-async.d.ts.map +1 -0
  137. package/dist/components/reui/cascader/cascader-async.js +549 -0
  138. package/dist/components/reui/cascader/cascader-async.js.map +1 -0
  139. package/dist/components/reui/cascader/cascader-columns.d.ts +29 -0
  140. package/dist/components/reui/cascader/cascader-columns.d.ts.map +1 -0
  141. package/dist/components/reui/cascader/cascader-columns.js +135 -0
  142. package/dist/components/reui/cascader/cascader-columns.js.map +1 -0
  143. package/dist/components/reui/cascader/cascader-context.d.ts +193 -0
  144. package/dist/components/reui/cascader/cascader-context.d.ts.map +1 -0
  145. package/dist/components/reui/cascader/cascader-context.js +59 -0
  146. package/dist/components/reui/cascader/cascader-context.js.map +1 -0
  147. package/dist/components/reui/cascader/cascader-footer.d.ts +85 -0
  148. package/dist/components/reui/cascader/cascader-footer.d.ts.map +1 -0
  149. package/dist/components/reui/cascader/cascader-footer.js +456 -0
  150. package/dist/components/reui/cascader/cascader-footer.js.map +1 -0
  151. package/dist/components/reui/cascader/cascader-i18n.d.ts +17 -0
  152. package/dist/components/reui/cascader/cascader-i18n.d.ts.map +1 -0
  153. package/dist/components/reui/cascader/cascader-i18n.js +68 -0
  154. package/dist/components/reui/cascader/cascader-i18n.js.map +1 -0
  155. package/dist/components/reui/cascader/cascader-item.d.ts +115 -0
  156. package/dist/components/reui/cascader/cascader-item.d.ts.map +1 -0
  157. package/dist/components/reui/cascader/cascader-item.js +530 -0
  158. package/dist/components/reui/cascader/cascader-item.js.map +1 -0
  159. package/dist/components/reui/cascader/cascader-lib.d.ts +141 -0
  160. package/dist/components/reui/cascader/cascader-lib.d.ts.map +1 -0
  161. package/dist/components/reui/cascader/cascader-lib.js +576 -0
  162. package/dist/components/reui/cascader/cascader-lib.js.map +1 -0
  163. package/dist/components/reui/cascader/cascader-nav.d.ts +59 -0
  164. package/dist/components/reui/cascader/cascader-nav.d.ts.map +1 -0
  165. package/dist/components/reui/cascader/cascader-nav.js +312 -0
  166. package/dist/components/reui/cascader/cascader-nav.js.map +1 -0
  167. package/dist/components/reui/cascader/cascader-types.d.ts +2 -0
  168. package/dist/components/reui/cascader/cascader-types.js +2 -0
  169. package/dist/components/reui/cascader/cascader-virtual.d.ts +65 -0
  170. package/dist/components/reui/cascader/cascader-virtual.d.ts.map +1 -0
  171. package/dist/components/reui/cascader/cascader-virtual.js +240 -0
  172. package/dist/components/reui/cascader/cascader-virtual.js.map +1 -0
  173. package/dist/components/reui/cascader/cascader.d.ts +322 -0
  174. package/dist/components/reui/cascader/cascader.d.ts.map +1 -0
  175. package/dist/components/reui/cascader/cascader.js +1459 -0
  176. package/dist/components/reui/cascader/cascader.js.map +1 -0
  177. package/dist/components/reui/event-calendar/event-calendar-event.d.ts +28 -47
  178. package/dist/components/reui/event-calendar/event-calendar-event.d.ts.map +1 -1
  179. package/dist/components/reui/event-calendar/event-calendar-event.js +26 -44
  180. package/dist/components/reui/event-calendar/event-calendar-event.js.map +1 -1
  181. package/dist/components/reui/event-calendar/event-calendar-nav.js +1 -1
  182. package/dist/components/reui/event-calendar/event-calendar-types.d.ts +19 -57
  183. package/dist/components/reui/event-calendar/event-calendar-types.d.ts.map +1 -1
  184. package/dist/components/reui/filters/filters-advanced.d.ts +52 -0
  185. package/dist/components/reui/filters/filters-advanced.d.ts.map +1 -0
  186. package/dist/components/reui/filters/filters-advanced.js +1191 -0
  187. package/dist/components/reui/filters/filters-advanced.js.map +1 -0
  188. package/dist/components/reui/filters/filters-builder.d.ts +43 -0
  189. package/dist/components/reui/filters/filters-builder.d.ts.map +1 -0
  190. package/dist/components/reui/filters/filters-builder.js +152 -0
  191. package/dist/components/reui/filters/filters-builder.js.map +1 -0
  192. package/dist/components/reui/filters/filters-chip.d.ts +79 -0
  193. package/dist/components/reui/filters/filters-chip.d.ts.map +1 -0
  194. package/dist/components/reui/filters/filters-chip.js +553 -0
  195. package/dist/components/reui/filters/filters-chip.js.map +1 -0
  196. package/dist/components/reui/filters/filters-context.d.ts +290 -0
  197. package/dist/components/reui/filters/filters-context.d.ts.map +1 -0
  198. package/dist/components/reui/filters/filters-context.js +277 -0
  199. package/dist/components/reui/filters/filters-context.js.map +1 -0
  200. package/dist/components/reui/filters/filters-date.d.ts +43 -0
  201. package/dist/components/reui/filters/filters-date.d.ts.map +1 -0
  202. package/dist/components/reui/filters/filters-date.js +143 -0
  203. package/dist/components/reui/filters/filters-date.js.map +1 -0
  204. package/dist/components/reui/filters/filters-dnd.d.ts +101 -0
  205. package/dist/components/reui/filters/filters-dnd.d.ts.map +1 -0
  206. package/dist/components/reui/filters/filters-dnd.js +454 -0
  207. package/dist/components/reui/filters/filters-dnd.js.map +1 -0
  208. package/dist/components/reui/filters/filters-draft.d.ts +2 -0
  209. package/dist/components/reui/filters/filters-draft.js +128 -0
  210. package/dist/components/reui/filters/filters-draft.js.map +1 -0
  211. package/dist/components/reui/filters/filters-editors.d.ts +91 -0
  212. package/dist/components/reui/filters/filters-editors.d.ts.map +1 -0
  213. package/dist/components/reui/filters/filters-editors.js +773 -0
  214. package/dist/components/reui/filters/filters-editors.js.map +1 -0
  215. package/dist/components/reui/filters/filters-i18n.d.ts +24 -0
  216. package/dist/components/reui/filters/filters-i18n.d.ts.map +1 -0
  217. package/dist/components/reui/filters/filters-i18n.js +127 -0
  218. package/dist/components/reui/filters/filters-i18n.js.map +1 -0
  219. package/dist/components/reui/filters/filters-lib.d.ts +171 -0
  220. package/dist/components/reui/filters/filters-lib.d.ts.map +1 -0
  221. package/dist/components/reui/filters/filters-lib.js +336 -0
  222. package/dist/components/reui/filters/filters-lib.js.map +1 -0
  223. package/dist/components/reui/filters/filters-operators.d.ts +49 -0
  224. package/dist/components/reui/filters/filters-operators.d.ts.map +1 -0
  225. package/dist/components/reui/filters/filters-operators.js +300 -0
  226. package/dist/components/reui/filters/filters-operators.js.map +1 -0
  227. package/dist/components/reui/filters/filters-query.d.ts +132 -0
  228. package/dist/components/reui/filters/filters-query.d.ts.map +1 -0
  229. package/dist/components/reui/filters/filters-query.js +476 -0
  230. package/dist/components/reui/filters/filters-query.js.map +1 -0
  231. package/dist/components/reui/filters/filters-types.d.ts +452 -0
  232. package/dist/components/reui/filters/filters-types.d.ts.map +1 -0
  233. package/dist/components/reui/filters/filters-types.js +2 -0
  234. package/dist/components/reui/filters/filters.d.ts +114 -0
  235. package/dist/components/reui/filters/filters.d.ts.map +1 -0
  236. package/dist/components/reui/filters/filters.js +638 -0
  237. package/dist/components/reui/filters/filters.js.map +1 -0
  238. package/dist/components/reui/frame.d.ts +1 -1
  239. package/dist/components/reui/gantt/gantt-bar.js +1 -1
  240. package/dist/components/reui/gantt/gantt-nav.js +1 -1
  241. package/dist/components/reui/gantt/gantt-types.d.ts +25 -71
  242. package/dist/components/reui/gantt/gantt-types.d.ts.map +1 -1
  243. package/dist/components/reui/gantt/gantt-view.js +1 -1
  244. package/dist/components/reui/icon-tile.d.ts +1 -1
  245. package/dist/components/ui/badge.d.ts +1 -1
  246. package/dist/components/ui/bubble.d.ts +1 -1
  247. package/dist/components/ui/button.d.ts +2 -2
  248. package/dist/components/ui/checkbox.js +1 -1
  249. package/dist/components/ui/checkbox.js.map +1 -1
  250. package/dist/components/ui/field.js +2 -2
  251. package/dist/components/ui/field.js.map +1 -1
  252. package/dist/components/ui/item.d.ts +2 -2
  253. package/dist/components/ui/marker.d.ts +1 -1
  254. package/dist/components/ui/radio-group.js +1 -1
  255. package/dist/components/ui/radio-group.js.map +1 -1
  256. package/dist/components/ui/sidebar.d.ts +1 -1
  257. package/dist/components/ui/sidebar.js +1 -1
  258. package/dist/components/ui/switch.js +1 -1
  259. package/dist/components/ui/switch.js.map +1 -1
  260. package/dist/components/ui/tabs.d.ts +1 -1
  261. package/dist/components/ui/toggle.d.ts +1 -1
  262. package/dist/{copy-menu-Bk5GP9Gp.js → copy-menu-1FKoMc9o.js} +9 -2
  263. package/dist/copy-menu-1FKoMc9o.js.map +1 -0
  264. package/dist/filters-draft-DEAl3TO-.d.ts +70 -0
  265. package/dist/filters-draft-DEAl3TO-.d.ts.map +1 -0
  266. package/dist/hooks/use-dismiss.d.ts +34 -0
  267. package/dist/hooks/use-dismiss.d.ts.map +1 -0
  268. package/dist/hooks/use-dismiss.js +78 -0
  269. package/dist/hooks/use-dismiss.js.map +1 -0
  270. package/dist/hooks/use-favicon.d.ts +17 -0
  271. package/dist/hooks/use-favicon.d.ts.map +1 -0
  272. package/dist/hooks/use-favicon.js +35 -0
  273. package/dist/hooks/use-favicon.js.map +1 -0
  274. package/dist/hooks/use-hover-gesture.d.ts +38 -0
  275. package/dist/hooks/use-hover-gesture.d.ts.map +1 -0
  276. package/dist/hooks/use-hover-gesture.js +46 -0
  277. package/dist/hooks/use-hover-gesture.js.map +1 -0
  278. package/dist/hooks/use-slider.d.ts.map +1 -1
  279. package/dist/hooks/use-slider.js +3 -2
  280. package/dist/hooks/use-slider.js.map +1 -1
  281. package/dist/hooks/use-tap-gesture.d.ts +47 -0
  282. package/dist/hooks/use-tap-gesture.d.ts.map +1 -0
  283. package/dist/hooks/use-tap-gesture.js +51 -0
  284. package/dist/hooks/use-tap-gesture.js.map +1 -0
  285. package/dist/hooks/use-touch-capable.d.ts +15 -0
  286. package/dist/hooks/use-touch-capable.d.ts.map +1 -0
  287. package/dist/hooks/use-touch-capable.js +29 -0
  288. package/dist/hooks/use-touch-capable.js.map +1 -0
  289. package/dist/lib/text-shimmer.d.ts +2 -2
  290. package/dist/lib/text-shimmer.d.ts.map +1 -1
  291. package/dist/lib/text-shimmer.js +2 -2
  292. package/dist/lib/text-shimmer.js.map +1 -1
  293. package/dist/lib/touch.d.ts +66 -0
  294. package/dist/lib/touch.d.ts.map +1 -0
  295. package/dist/lib/touch.js +79 -0
  296. package/dist/lib/touch.js.map +1 -0
  297. package/dist/presence-gate-BekdC4Bo.js +24 -0
  298. package/dist/presence-gate-BekdC4Bo.js.map +1 -0
  299. package/dist/types-smkWN_7x.d.ts.map +1 -1
  300. package/package.json +9 -9
  301. package/dist/components/reui/filters.d.ts +0 -176
  302. package/dist/components/reui/filters.d.ts.map +0 -1
  303. package/dist/components/reui/filters.js +0 -1223
  304. package/dist/components/reui/filters.js.map +0 -1
  305. package/dist/copy-menu-Bk5GP9Gp.js.map +0 -1
@@ -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 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 className=\"absolute top-[0.08em] left-0 inline-block 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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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"}
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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,UAAU,UAAU,WAAW,KAAA,IAAY,EAAE,OAAO,IAAK;EACzD,YAAY;EACZ,WAAW,GACT,yFACA,oDACA,cAAc,UACd,WAAW,OACX,SACF;EACA,cAAY;EACZ,UAAU,UAAU;GAClB,UAAU,KAAK;GACf,IAAI,MAAM,oBAAoB,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"}
@@ -1 +1 @@
1
- {"version":3,"file":"animated-sidebar.d.ts","names":[],"sources":["../../../src/components/motion/animated-sidebar.tsx"],"mappings":";;;KA+BK;KACA;KACA;KACA;UAyGK;EACR;EACA;EACA;EACA;EACA;EACA,UAAU;EACV,gBAAgB;EAChB,OAAO;EACP;EACA,YAAY,MAAM,UAAU;;iBAad,sBAAkB;KAgB7B,uBAAuB;EAC1B;EACA;EACA;;UAGe,qCAAqC,eAAe;EACnE;EACA;EACA,gBAAgB;EAChB;EACA;EACA,sBAAsB;EACtB,QAAQ;;iBAGM,0BACd,UACA,MACA,aACA,cACA,YACA,mBACA,oBACA,WACA,UACG,SACF,+CAA4B,IAAA;UA2Nd,6BAA6B,KAAK;EACjD,WAAW;EACX,OAAO;EACP,UAAU;EACV,cAAc;EACd;EACA;;cAGW,iCAAe,0BAAA,KAAA,+CAAA,cAAA;UAgFX,oCAAoC,qBAAqB;cAE7D,wCAAsB,0BAAA,8CAAA,cAAA;UAgClB,kCAAkC,qBAAqB;cAE3D,sCAAoB,0BAAA,4CAAA,cAAA;UA0BhB,iCAAiC,qBAAqB;cAE1D,qCAAmB,0BAAA,2CAAA,cAAA;UA6Bf,kCAAkC;cAEtC,sCAAoB,0BAAA,KAAA,oDAAA,cAAA;cAiBpB,uCAAqB,0BAAA,eAAA,kCAAA,cAAA;cAarB,wCAAsB,0BAAA,eAAA,kCAAA,cAAA;cAgBtB,uCAAqB,0BAAA,eAAA,kCAAA,cAAA;cAgBrB,sCAAoB,0BAAA,eAAA,kCAAA,cAAA;cAapB,2CAAyB,0BAAA,eAAA,kCAAA,cAAA;cAsBzB,6CAA2B,0BAAA,eAAA,kCAAA,cAAA;cAc3B,qCAAmB,0BAAA,eAAA,oCAAA,cAAA;cAmBnB,yCAAuB,0BAAA,KAAA,gDAAA,cAAA;UAenB,oCAAoC,KAAK;EACxD;EACA,WAAW;;cAGA,wCAAsB,0BAAA,KAAA,sDAAA,cAAA;cA+BtB,4CAA0B,0BAAA,KAAA,gDAAA,cAAA;UActB;EACf,UAAU;EACV,OAAO;EACP;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;iBAGc,+BACd,UACA,MACA,MACA,UACA,UACA,eACA,QACA,KACA,UACA,aACC,oDAAiC,IAAA;UA4DnB;EACf,UAAU;EACV,OAAO;EACP,QAAQ;EACR;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;iBAGc,4BACd,UACA,MACA,OACA,MACA,UACA,cACA,UACA,eACA,QACA,KACA,UACA,aACC,iDAA8B,IAAA"}
1
+ {"version":3,"file":"animated-sidebar.d.ts","names":[],"sources":["../../../src/components/motion/animated-sidebar.tsx"],"mappings":";;;KA+BK;KACA;KACA;KACA;UAyGK;EACR;EACA;EACA;EACA;EACA;EACA,UAAU;EACV,gBAAgB;EAChB,OAAO;EACP;EACA,YAAY,MAAM,UAAU;;iBAad,sBAAkB;KAgB7B,uBAAuB;EAC1B;EACA;EACA;;UAGe,qCAAqC,eAAe;EACnE;EACA;EACA,gBAAgB;EAChB;EACA;EACA,sBAAsB;EACtB,QAAQ;;iBAGM,0BACd,UACA,MACA,aACA,cACA,YACA,mBACA,oBACA,WACA,UACG,SACF,+CAA4B,IAAA;UAiPd,6BAA6B,KAAK;EACjD,WAAW;EACX,OAAO;EACP,UAAU;EACV,cAAc;EACd;EACA;;cAGW,iCAAe,0BAAA,KAAA,+CAAA,cAAA;UAgFX,oCAAoC,qBAAqB;cAE7D,wCAAsB,0BAAA,8CAAA,cAAA;UAgClB,kCAAkC,qBAAqB;cAE3D,sCAAoB,0BAAA,4CAAA,cAAA;UA0BhB,iCAAiC,qBAAqB;cAE1D,qCAAmB,0BAAA,2CAAA,cAAA;UA6Bf,kCAAkC;cAEtC,sCAAoB,0BAAA,KAAA,oDAAA,cAAA;cAiBpB,uCAAqB,0BAAA,eAAA,kCAAA,cAAA;cAarB,wCAAsB,0BAAA,eAAA,kCAAA,cAAA;cAgBtB,uCAAqB,0BAAA,eAAA,kCAAA,cAAA;cAgBrB,sCAAoB,0BAAA,eAAA,kCAAA,cAAA;cAapB,2CAAyB,0BAAA,eAAA,kCAAA,cAAA;cAsBzB,6CAA2B,0BAAA,eAAA,kCAAA,cAAA;cAc3B,qCAAmB,0BAAA,eAAA,oCAAA,cAAA;cAmBnB,yCAAuB,0BAAA,KAAA,gDAAA,cAAA;UAenB,oCAAoC,KAAK;EACxD;EACA,WAAW;;cAGA,wCAAsB,0BAAA,KAAA,sDAAA,cAAA;cA+BtB,4CAA0B,0BAAA,KAAA,gDAAA,cAAA;UActB;EACf,UAAU;EACV,OAAO;EACP;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;iBAGc,+BACd,UACA,MACA,MACA,UACA,UACA,eACA,QACA,KACA,UACA,aACC,oDAAiC,IAAA;UA4DnB;EACf,UAAU;EACV,OAAO;EACP,QAAQ;EACR;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;iBAGc,4BACd,UACA,MACA,OACA,MACA,UACA,cACA,UACA,eACA,QACA,KACA,UACA,aACC,iDAA8B,IAAA"}
@@ -175,7 +175,13 @@ function MobileSidebar({ ariaLabel, children, className, side }) {
175
175
  const context = useAnimatedSidebar();
176
176
  const panelRef = useRef(null);
177
177
  const [mounted, setMounted] = useState(false);
178
+ const [hidden, setHidden] = useState(!context.openMobile);
179
+ const openMobileRef = useRef(context.openMobile);
178
180
  useEffect(() => setMounted(true), []);
181
+ useEffect(() => {
182
+ openMobileRef.current = context.openMobile;
183
+ if (context.openMobile) setHidden(false);
184
+ }, [context.openMobile]);
179
185
  useEffect(() => {
180
186
  if (!context.openMobile) return;
181
187
  const body = document.body;
@@ -208,7 +214,7 @@ function MobileSidebar({ ariaLabel, children, className, side }) {
208
214
  }, [context.openMobile, context.triggerRef]);
209
215
  if (!mounted) return null;
210
216
  return createPortal(/* @__PURE__ */ jsxs("div", {
211
- className: cn("pointer-events-none fixed inset-0 z-50 md:hidden", context.openMobile ? "visible" : "invisible"),
217
+ className: cn("pointer-events-none fixed top-0 left-0 z-50 size-0 md:hidden", hidden && !context.openMobile ? "invisible" : "visible"),
212
218
  children: [/* @__PURE__ */ jsx(motion.button, {
213
219
  type: "button",
214
220
  "aria-label": "Close sidebar",
@@ -217,7 +223,7 @@ function MobileSidebar({ ariaLabel, children, className, side }) {
217
223
  animate: { opacity: context.openMobile ? 1 : 0 },
218
224
  transition: context.reduce ? REDUCED_TRANSITION : PANEL_TRANSITION,
219
225
  onClick: () => context.setOpenMobile(false),
220
- className: cn("absolute inset-0 bg-black/40", context.openMobile ? "pointer-events-auto" : "pointer-events-none")
226
+ className: cn("fixed inset-0 bg-black/40", context.openMobile ? "pointer-events-auto" : "pointer-events-none")
221
227
  }), /* @__PURE__ */ jsx(motion.div, {
222
228
  ref: panelRef,
223
229
  role: "dialog",
@@ -235,6 +241,9 @@ function MobileSidebar({ ariaLabel, children, className, side }) {
235
241
  x: context.reduce ? 0 : context.openMobile ? "0%" : side === "left" ? "-100%" : "100%"
236
242
  },
237
243
  transition: context.reduce ? REDUCED_TRANSITION : PANEL_TRANSITION,
244
+ onAnimationComplete: () => {
245
+ if (!openMobileRef.current) setHidden(true);
246
+ },
238
247
  onKeyDown: (event) => {
239
248
  if (event.key === "Escape") {
240
249
  event.preventDefault();
@@ -258,7 +267,7 @@ function MobileSidebar({ ariaLabel, children, className, side }) {
258
267
  first.focus();
259
268
  }
260
269
  },
261
- className: cn("pointer-events-auto absolute inset-y-0 flex h-dvh w-(--sidebar-width-mobile) max-w-[88vw] flex-col overflow-hidden", "border-border bg-background shadow-2xl will-change-transform", side === "left" ? "left-0 border-r" : "right-0 border-l", !context.openMobile && "pointer-events-none", className),
270
+ className: cn("pointer-events-auto fixed inset-y-0 flex h-dvh w-(--sidebar-width-mobile) max-w-[88vw] flex-col overflow-hidden", "border-border bg-background shadow-2xl will-change-transform", side === "left" ? "left-0 border-r" : "right-0 border-l", !context.openMobile && "pointer-events-none", className),
262
271
  children: /* @__PURE__ */ jsx(AnimatedSidebarPanelContext.Provider, {
263
272
  value: {
264
273
  collapsed: false,
@@ -535,6 +544,7 @@ function AnimatedSidebarMenuButton({ children, icon, badge, href, isActive = fal
535
544
  onSelect?.();
536
545
  const shouldCloseOnSelect = closeOnSelect ?? ariaExpanded === void 0;
537
546
  if (context.isMobile && shouldCloseOnSelect) context.setOpenMobile(false);
547
+ if (ariaExpanded !== void 0 && panel.collapsed && !context.isMobile) context.setOpen(true);
538
548
  };
539
549
  const content = /* @__PURE__ */ jsxs(Fragment$1, { children: [
540
550
  isActive ? /* @__PURE__ */ jsx(motion.span, {
@@ -1 +1 @@
1
- {"version":3,"file":"animated-sidebar.js","names":[],"sources":["../../../src/components/motion/animated-sidebar.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n type ButtonHTMLAttributes,\n type CSSProperties,\n createContext,\n forwardRef,\n type HTMLAttributes,\n type ReactNode,\n useCallback,\n useContext,\n useEffect,\n useId,\n useRef,\n useState,\n useSyncExternalStore,\n} from \"react\";\nimport { ChevronRight } from \"lucide-react\";\nimport {\n AnimatePresence,\n type HTMLMotionProps,\n motion,\n useReducedMotion,\n type Variants,\n} from \"motion/react\";\nimport { createPortal } from \"react-dom\";\n\nimport { cn } from \"@kumix/utils\";\nimport { EASE_DRAWER, EASE_OUT, SPRING_LAYOUT, SPRING_PRESS } from \"../../lib/ease\";\nimport { SharedLayoutBg } from \"./shared-layout-bg\";\n\ntype SidebarState = \"expanded\" | \"collapsed\";\ntype SidebarSide = \"left\" | \"right\";\ntype SidebarVariant = \"sidebar\" | \"floating\" | \"inset\";\ntype SidebarCollapsible = \"offcanvas\" | \"icon\" | \"none\";\n\nconst MOBILE_QUERY = \"(max-width: 767px)\";\nconst SIDEBAR_KEYBOARD_SHORTCUT = \"b\";\n\nconst PANEL_TRANSITION = {\n duration: 0.36,\n ease: EASE_DRAWER,\n} as const;\n\n// The desktop rail settles at a hard zero-width boundary. Keep the spring\n// critically damped so it cannot overshoot, pause against that boundary, and\n// then snap back during the final frame.\nconst SIDEBAR_MORPH_TRANSITION = {\n type: \"spring\",\n stiffness: 380,\n damping: 35,\n mass: 0.75,\n} as const;\n\nconst LABEL_ENTER_TRANSITION = {\n duration: 0.2,\n delay: 0.08,\n ease: EASE_OUT,\n} as const;\n\nconst LABEL_EXIT_TRANSITION = {\n duration: 0.12,\n ease: EASE_OUT,\n} as const;\n\nconst SUBMENU_TRANSITION = {\n duration: 0.18,\n ease: EASE_OUT,\n} as const;\n\nconst SUBMENU_VARIANTS: Variants = {\n closed: {\n opacity: 0,\n clipPath: \"inset(0 0 100% 0 round 8px)\",\n transition: {\n duration: 0.14,\n ease: EASE_OUT,\n staggerChildren: 0.025,\n staggerDirection: -1,\n },\n },\n open: {\n opacity: 1,\n clipPath: \"inset(0 0 0% 0 round 8px)\",\n transition: {\n duration: 0.2,\n delayChildren: 0.035,\n ease: EASE_OUT,\n staggerChildren: 0.045,\n },\n },\n};\n\nconst SUBMENU_ITEM_VARIANTS: Variants = {\n closed: {\n opacity: 0,\n y: -6,\n filter: \"blur(3px)\",\n },\n open: {\n opacity: 1,\n y: 0,\n filter: \"blur(0px)\",\n transition: SUBMENU_TRANSITION,\n },\n};\n\nconst REDUCED_TRANSITION = {\n duration: 0.16,\n ease: EASE_OUT,\n} as const;\n\nconst FOCUSABLE_SELECTOR = [\n \"a[href]\",\n \"button:not([disabled])\",\n \"input:not([disabled])\",\n \"select:not([disabled])\",\n \"textarea:not([disabled])\",\n \"[tabindex]:not([tabindex='-1'])\",\n].join(\",\");\n\nfunction subscribeToMobileQuery(callback: () => void) {\n const query = window.matchMedia(MOBILE_QUERY);\n query.addEventListener(\"change\", callback);\n return () => query.removeEventListener(\"change\", callback);\n}\n\nfunction getMobileSnapshot() {\n return window.matchMedia(MOBILE_QUERY).matches;\n}\n\nfunction getServerMobileSnapshot() {\n return false;\n}\n\nfunction useIsMobile() {\n return useSyncExternalStore(subscribeToMobileQuery, getMobileSnapshot, getServerMobileSnapshot);\n}\n\ninterface AnimatedSidebarContextValue {\n isMobile: boolean;\n layoutId: string;\n open: boolean;\n openMobile: boolean;\n reduce: boolean;\n setOpen: (open: boolean) => void;\n setOpenMobile: (open: boolean) => void;\n state: SidebarState;\n toggleSidebar: () => void;\n triggerRef: React.RefObject<HTMLButtonElement | null>;\n}\n\nconst AnimatedSidebarContext = createContext<AnimatedSidebarContextValue | null>(null);\n\ninterface AnimatedSidebarPanelContextValue {\n collapsed: boolean;\n collapsible: SidebarCollapsible;\n side: SidebarSide;\n}\n\nconst AnimatedSidebarPanelContext = createContext<AnimatedSidebarPanelContextValue | null>(null);\n\nexport function useAnimatedSidebar() {\n const context = useContext(AnimatedSidebarContext);\n if (!context) {\n throw new Error(\"useAnimatedSidebar must be used inside AnimatedSidebarProvider.\");\n }\n return context;\n}\n\nfunction useAnimatedSidebarPanel() {\n const context = useContext(AnimatedSidebarPanelContext);\n if (!context) {\n throw new Error(\"Animated Sidebar parts must be used inside AnimatedSidebar.\");\n }\n return context;\n}\n\ntype SidebarProviderStyle = CSSProperties & {\n \"--sidebar-width\"?: string;\n \"--sidebar-width-icon\"?: string;\n \"--sidebar-width-mobile\"?: string;\n};\n\nexport interface AnimatedSidebarProviderProps extends HTMLAttributes<HTMLDivElement> {\n open?: boolean;\n defaultOpen?: boolean;\n onOpenChange?: (open: boolean) => void;\n openMobile?: boolean;\n defaultOpenMobile?: boolean;\n onOpenMobileChange?: (open: boolean) => void;\n style?: SidebarProviderStyle;\n}\n\nexport function AnimatedSidebarProvider({\n children,\n open,\n defaultOpen = true,\n onOpenChange,\n openMobile,\n defaultOpenMobile = false,\n onOpenMobileChange,\n className,\n style,\n ...props\n}: AnimatedSidebarProviderProps) {\n const [internalOpen, setInternalOpen] = useState(defaultOpen);\n const [internalOpenMobile, setInternalOpenMobile] = useState(defaultOpenMobile);\n const isMobile = useIsMobile();\n const reduce = useReducedMotion() ?? false;\n const generatedId = useId();\n const triggerRef = useRef<HTMLButtonElement>(null);\n const desktopOpen = open ?? internalOpen;\n const mobileOpen = openMobile ?? internalOpenMobile;\n\n const setOpen = useCallback(\n (nextOpen: boolean) => {\n if (open === undefined) setInternalOpen(nextOpen);\n onOpenChange?.(nextOpen);\n },\n [onOpenChange, open],\n );\n\n const setOpenMobile = useCallback(\n (nextOpen: boolean) => {\n if (openMobile === undefined) setInternalOpenMobile(nextOpen);\n onOpenMobileChange?.(nextOpen);\n },\n [onOpenMobileChange, openMobile],\n );\n\n const toggleSidebar = useCallback(() => {\n if (isMobile) setOpenMobile(!mobileOpen);\n else setOpen(!desktopOpen);\n }, [desktopOpen, isMobile, mobileOpen, setOpen, setOpenMobile]);\n\n useEffect(() => {\n const handleShortcut = (event: KeyboardEvent) => {\n if (\n event.key.toLowerCase() === SIDEBAR_KEYBOARD_SHORTCUT &&\n (event.metaKey || event.ctrlKey)\n ) {\n event.preventDefault();\n toggleSidebar();\n }\n };\n\n window.addEventListener(\"keydown\", handleShortcut);\n return () => window.removeEventListener(\"keydown\", handleShortcut);\n }, [toggleSidebar]);\n\n return (\n <AnimatedSidebarContext.Provider\n value={{\n isMobile,\n layoutId: `${generatedId}-active`,\n open: desktopOpen,\n openMobile: mobileOpen,\n reduce,\n setOpen,\n setOpenMobile,\n state: desktopOpen ? \"expanded\" : \"collapsed\",\n toggleSidebar,\n triggerRef,\n }}\n >\n <div\n {...props}\n data-slot=\"sidebar-wrapper\"\n data-state={desktopOpen ? \"expanded\" : \"collapsed\"}\n style={{\n \"--sidebar-width\": \"16rem\",\n \"--sidebar-width-icon\": \"4.25rem\",\n \"--sidebar-width-mobile\": \"18rem\",\n ...style,\n }}\n className={cn(\"group/sidebar-wrapper flex min-h-svh w-full min-w-0\", className)}\n >\n {children}\n </div>\n </AnimatedSidebarContext.Provider>\n );\n}\n\nfunction MobileSidebar({\n ariaLabel,\n children,\n className,\n side,\n}: {\n ariaLabel: string;\n children: ReactNode;\n className?: string;\n side: SidebarSide;\n}) {\n const context = useAnimatedSidebar();\n const panelRef = useRef<HTMLDivElement>(null);\n const [mounted, setMounted] = useState(false);\n\n useEffect(() => setMounted(true), []);\n\n useEffect(() => {\n if (!context.openMobile) return;\n\n const body = document.body;\n const scrollY = window.scrollY;\n const previousBodyStyles = {\n left: body.style.left,\n overflow: body.style.overflow,\n position: body.style.position,\n right: body.style.right,\n top: body.style.top,\n };\n\n body.style.position = \"fixed\";\n body.style.top = `-${scrollY}px`;\n body.style.left = \"0\";\n body.style.right = \"0\";\n body.style.overflow = \"hidden\";\n\n const focusFrame = requestAnimationFrame(() => {\n const firstFocusable = panelRef.current?.querySelector<HTMLElement>(FOCUSABLE_SELECTOR);\n (firstFocusable ?? panelRef.current)?.focus({ preventScroll: true });\n });\n\n return () => {\n cancelAnimationFrame(focusFrame);\n body.style.position = previousBodyStyles.position;\n body.style.top = previousBodyStyles.top;\n body.style.left = previousBodyStyles.left;\n body.style.right = previousBodyStyles.right;\n body.style.overflow = previousBodyStyles.overflow;\n window.scrollTo(0, scrollY);\n context.triggerRef.current?.focus({ preventScroll: true });\n };\n }, [context.openMobile, context.triggerRef]);\n\n if (!mounted) return null;\n\n return createPortal(\n <div\n className={cn(\n \"pointer-events-none fixed inset-0 z-50 md:hidden\",\n context.openMobile ? \"visible\" : \"invisible\",\n )}\n >\n <motion.button\n type=\"button\"\n aria-label=\"Close sidebar\"\n tabIndex={context.openMobile ? 0 : -1}\n initial={false}\n animate={{ opacity: context.openMobile ? 1 : 0 }}\n transition={context.reduce ? REDUCED_TRANSITION : PANEL_TRANSITION}\n onClick={() => context.setOpenMobile(false)}\n className={cn(\n \"absolute inset-0 bg-black/40\",\n context.openMobile ? \"pointer-events-auto\" : \"pointer-events-none\",\n )}\n />\n\n <motion.div\n ref={panelRef}\n role=\"dialog\"\n aria-modal=\"true\"\n aria-label={ariaLabel}\n aria-hidden={!context.openMobile}\n inert={!context.openMobile}\n tabIndex={-1}\n data-mobile=\"true\"\n data-state={context.openMobile ? \"expanded\" : \"collapsed\"}\n data-side={side}\n initial={false}\n animate={{\n opacity: context.reduce ? (context.openMobile ? 1 : 0) : 1,\n x: context.reduce ? 0 : context.openMobile ? \"0%\" : side === \"left\" ? \"-100%\" : \"100%\",\n }}\n transition={context.reduce ? REDUCED_TRANSITION : PANEL_TRANSITION}\n onKeyDown={(event) => {\n if (event.key === \"Escape\") {\n event.preventDefault();\n context.setOpenMobile(false);\n return;\n }\n\n if (event.key !== \"Tab\") return;\n const focusable = panelRef.current\n ? Array.from(panelRef.current.querySelectorAll<HTMLElement>(FOCUSABLE_SELECTOR))\n : [];\n\n if (focusable.length === 0) {\n event.preventDefault();\n panelRef.current?.focus();\n return;\n }\n\n const first = focusable[0];\n const last = focusable[focusable.length - 1];\n if (event.shiftKey && document.activeElement === first) {\n event.preventDefault();\n last.focus();\n } else if (!event.shiftKey && document.activeElement === last) {\n event.preventDefault();\n first.focus();\n }\n }}\n className={cn(\n \"pointer-events-auto absolute inset-y-0 flex h-dvh w-(--sidebar-width-mobile) max-w-[88vw] flex-col overflow-hidden\",\n \"border-border bg-background shadow-2xl will-change-transform\",\n side === \"left\" ? \"left-0 border-r\" : \"right-0 border-l\",\n !context.openMobile && \"pointer-events-none\",\n className,\n )}\n >\n <AnimatedSidebarPanelContext.Provider\n value={{ collapsed: false, collapsible: \"none\", side }}\n >\n {children}\n </AnimatedSidebarPanelContext.Provider>\n </motion.div>\n </div>,\n document.body,\n );\n}\n\nexport interface AnimatedSidebarProps extends Omit<HTMLMotionProps<\"aside\">, \"children\"> {\n children?: ReactNode;\n side?: SidebarSide;\n variant?: SidebarVariant;\n collapsible?: SidebarCollapsible;\n ariaLabel?: string;\n panelClassName?: string;\n}\n\nexport const AnimatedSidebar = forwardRef<HTMLElement, AnimatedSidebarProps>(\n function AnimatedSidebar(\n {\n side = \"left\",\n variant = \"sidebar\",\n collapsible = \"icon\",\n ariaLabel = \"Sidebar\",\n children,\n className,\n panelClassName,\n style,\n ...props\n },\n forwardedRef,\n ) {\n const context = useAnimatedSidebar();\n const collapsed = collapsible !== \"none\" && !context.open;\n const offcanvas = collapsed && collapsible === \"offcanvas\";\n const width = offcanvas\n ? \"0px\"\n : collapsed\n ? \"var(--sidebar-width-icon)\"\n : \"var(--sidebar-width)\";\n\n if (context.isMobile) {\n return (\n <MobileSidebar ariaLabel={ariaLabel} className={className} side={side}>\n {children}\n </MobileSidebar>\n );\n }\n\n return (\n <motion.aside\n {...props}\n ref={forwardedRef}\n initial={false}\n aria-label={ariaLabel}\n data-slot=\"sidebar\"\n data-state={collapsed ? \"collapsed\" : \"expanded\"}\n data-collapsible={collapsible}\n data-variant={variant}\n data-side={side}\n animate={{ width }}\n transition={context.reduce ? { duration: 0 } : SIDEBAR_MORPH_TRANSITION}\n style={style}\n className={cn(\n \"group/sidebar relative hidden h-auto shrink-0 will-change-[width] md:block\",\n \"peer\",\n side === \"right\" && \"order-last\",\n className,\n )}\n >\n <motion.div\n initial={false}\n animate={{\n opacity: offcanvas ? 0 : 1,\n x: offcanvas ? (side === \"left\" ? \"-100%\" : \"100%\") : \"0%\",\n }}\n transition={context.reduce ? REDUCED_TRANSITION : PANEL_TRANSITION}\n className={cn(\n \"sticky top-0 flex h-svh w-full flex-col overflow-hidden bg-background\",\n collapsible === \"offcanvas\" && \"w-(--sidebar-width)\",\n variant === \"sidebar\" &&\n (side === \"left\" ? \"border-border border-r\" : \"border-border border-l\"),\n variant === \"floating\" &&\n \"m-2 h-[calc(100svh-1rem)] rounded-2xl border border-border shadow-sm\",\n variant === \"inset\" && \"m-2 h-[calc(100svh-1rem)] rounded-2xl\",\n panelClassName,\n )}\n >\n <AnimatedSidebarPanelContext.Provider value={{ collapsed, collapsible, side }}>\n {children}\n </AnimatedSidebarPanelContext.Provider>\n </motion.div>\n </motion.aside>\n );\n },\n);\n\nexport interface AnimatedSidebarTriggerProps extends ButtonHTMLAttributes<HTMLButtonElement> {}\n\nexport const AnimatedSidebarTrigger = forwardRef<HTMLButtonElement, AnimatedSidebarTriggerProps>(\n function AnimatedSidebarTrigger({ className, onClick, type = \"button\", ...props }, forwardedRef) {\n const context = useAnimatedSidebar();\n const expanded = context.isMobile ? context.openMobile : context.open;\n\n return (\n <button\n {...props}\n ref={(node) => {\n context.triggerRef.current = node;\n if (typeof forwardedRef === \"function\") forwardedRef(node);\n else if (forwardedRef) forwardedRef.current = node;\n }}\n type={type}\n aria-label={props[\"aria-label\"] ?? \"Toggle sidebar\"}\n aria-expanded={expanded}\n data-slot=\"sidebar-trigger\"\n data-state={expanded ? \"expanded\" : \"collapsed\"}\n onClick={(event) => {\n onClick?.(event);\n if (!event.defaultPrevented) context.toggleSidebar();\n }}\n className={cn(\n \"inline-flex size-10 shrink-0 items-center justify-center rounded-xl outline-none\",\n \"focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background\",\n className,\n )}\n />\n );\n },\n);\n\nexport interface AnimatedSidebarCloseProps extends ButtonHTMLAttributes<HTMLButtonElement> {}\n\nexport const AnimatedSidebarClose = forwardRef<HTMLButtonElement, AnimatedSidebarCloseProps>(\n function AnimatedSidebarClose({ className, onClick, type = \"button\", ...props }, forwardedRef) {\n const context = useAnimatedSidebar();\n\n return (\n <button\n {...props}\n ref={forwardedRef}\n type={type}\n aria-label={props[\"aria-label\"] ?? \"Close sidebar\"}\n onClick={(event) => {\n onClick?.(event);\n if (event.defaultPrevented) return;\n if (context.isMobile) context.setOpenMobile(false);\n else context.setOpen(false);\n }}\n className={cn(\n \"inline-flex size-10 shrink-0 items-center justify-center rounded-xl outline-none\",\n \"focus-visible:ring-2 focus-visible:ring-ring\",\n className,\n )}\n />\n );\n },\n);\n\nexport interface AnimatedSidebarRailProps extends ButtonHTMLAttributes<HTMLButtonElement> {}\n\nexport const AnimatedSidebarRail = forwardRef<HTMLButtonElement, AnimatedSidebarRailProps>(\n function AnimatedSidebarRail({ className, onClick, type = \"button\", ...props }, forwardedRef) {\n const context = useAnimatedSidebar();\n const panel = useAnimatedSidebarPanel();\n\n return (\n <button\n {...props}\n ref={forwardedRef}\n type={type}\n data-side={panel.side}\n aria-label={props[\"aria-label\"] ?? \"Toggle sidebar\"}\n title=\"Toggle sidebar\"\n tabIndex={-1}\n onClick={(event) => {\n onClick?.(event);\n if (!event.defaultPrevented) context.toggleSidebar();\n }}\n className={cn(\n \"absolute inset-y-0 z-20 hidden w-4 -translate-x-1/2 outline-none md:block\",\n \"after:absolute after:inset-y-0 after:left-1/2 after:w-px after:bg-transparent after:transition-colors hover:after:bg-border\",\n \"data-[side=right]:right-0 data-[side=left]:left-full data-[side=right]:translate-x-1/2\",\n className,\n )}\n />\n );\n },\n);\n\nexport interface AnimatedSidebarInsetProps extends HTMLMotionProps<\"main\"> {}\n\nexport const AnimatedSidebarInset = forwardRef<HTMLElement, AnimatedSidebarInsetProps>(\n function AnimatedSidebarInset({ className, ...props }, forwardedRef) {\n return (\n <motion.main\n {...props}\n ref={forwardedRef}\n data-slot=\"sidebar-inset\"\n className={cn(\n \"relative flex min-h-svh min-w-0 flex-1 flex-col bg-background\",\n \"md:peer-data-[variant=inset]:m-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-2xl md:peer-data-[variant=inset]:shadow-sm\",\n className,\n )}\n />\n );\n },\n);\n\nexport const AnimatedSidebarHeader = forwardRef<HTMLDivElement, HTMLAttributes<HTMLDivElement>>(\n function AnimatedSidebarHeader({ className, ...props }, forwardedRef) {\n return (\n <div\n {...props}\n ref={forwardedRef}\n data-slot=\"sidebar-header\"\n className={cn(\"flex shrink-0 flex-col gap-2 p-3\", className)}\n />\n );\n },\n);\n\nexport const AnimatedSidebarContent = forwardRef<HTMLDivElement, HTMLAttributes<HTMLDivElement>>(\n function AnimatedSidebarContent({ className, ...props }, forwardedRef) {\n return (\n <div\n {...props}\n ref={forwardedRef}\n data-slot=\"sidebar-content\"\n className={cn(\n \"flex min-h-0 flex-1 flex-col gap-2 overflow-y-auto overflow-x-hidden overscroll-contain px-2 py-2\",\n className,\n )}\n />\n );\n },\n);\n\nexport const AnimatedSidebarFooter = forwardRef<HTMLDivElement, HTMLAttributes<HTMLDivElement>>(\n function AnimatedSidebarFooter({ className, ...props }, forwardedRef) {\n return (\n <div\n {...props}\n ref={forwardedRef}\n data-slot=\"sidebar-footer\"\n className={cn(\n \"flex shrink-0 flex-col gap-2 border-border border-t p-3 pb-[max(0.75rem,env(safe-area-inset-bottom))]\",\n className,\n )}\n />\n );\n },\n);\n\nexport const AnimatedSidebarGroup = forwardRef<HTMLDivElement, HTMLAttributes<HTMLDivElement>>(\n function AnimatedSidebarGroup({ className, ...props }, forwardedRef) {\n return (\n <div\n {...props}\n ref={forwardedRef}\n data-slot=\"sidebar-group\"\n className={cn(\"flex w-full min-w-0 flex-col px-1 py-1.5\", className)}\n />\n );\n },\n);\n\nexport const AnimatedSidebarGroupLabel = forwardRef<HTMLDivElement, HTMLAttributes<HTMLDivElement>>(\n function AnimatedSidebarGroupLabel({ children, className, ...props }, forwardedRef) {\n const { collapsed } = useAnimatedSidebarPanel();\n\n return (\n <div\n {...props}\n ref={forwardedRef}\n aria-hidden={collapsed}\n data-slot=\"sidebar-group-label\"\n className={cn(\n \"mb-1 h-7 overflow-hidden px-2 font-medium text-[10px] text-muted-foreground uppercase tracking-[0.14em] transition-opacity\",\n collapsed ? \"opacity-0\" : \"opacity-100\",\n className,\n )}\n >\n {children}\n </div>\n );\n },\n);\n\nexport const AnimatedSidebarGroupContent = forwardRef<\n HTMLDivElement,\n HTMLAttributes<HTMLDivElement>\n>(function AnimatedSidebarGroupContent({ className, ...props }, forwardedRef) {\n return (\n <div\n {...props}\n ref={forwardedRef}\n data-slot=\"sidebar-group-content\"\n className={cn(\"w-full min-w-0\", className)}\n />\n );\n});\n\nexport const AnimatedSidebarMenu = forwardRef<HTMLUListElement, HTMLAttributes<HTMLUListElement>>(\n function AnimatedSidebarMenu({ children, className, ...props }, forwardedRef) {\n return (\n <SharedLayoutBg\n {...props}\n ref={forwardedRef as React.Ref<HTMLElement>}\n as=\"ul\"\n inset={0}\n pillClassName=\"rounded-xl bg-muted/70\"\n pillContainerClassName=\"inset-y-auto top-0 h-9\"\n data-slot=\"sidebar-menu\"\n className={cn(\"flex w-full min-w-0 list-none flex-col gap-0.5\", className)}\n >\n {children}\n </SharedLayoutBg>\n );\n },\n);\n\nexport const AnimatedSidebarMenuItem = forwardRef<HTMLLIElement, HTMLMotionProps<\"li\">>(\n function AnimatedSidebarMenuItem({ className, ...props }, forwardedRef) {\n return (\n <motion.li\n {...props}\n ref={forwardedRef}\n layout=\"position\"\n transition={SPRING_LAYOUT}\n data-slot=\"sidebar-menu-item\"\n className={cn(\"relative\", className)}\n />\n );\n },\n);\n\nexport interface AnimatedSidebarMenuSubProps extends Omit<HTMLMotionProps<\"ul\">, \"children\"> {\n open: boolean;\n children?: ReactNode;\n}\n\nexport const AnimatedSidebarMenuSub = forwardRef<HTMLUListElement, AnimatedSidebarMenuSubProps>(\n function AnimatedSidebarMenuSub({ open, children, className, ...props }, forwardedRef) {\n const context = useAnimatedSidebar();\n const panel = useAnimatedSidebarPanel();\n\n return (\n <AnimatePresence initial={false} mode=\"popLayout\">\n {open && !panel.collapsed ? (\n <motion.ul\n {...props}\n ref={forwardedRef}\n key=\"sidebar-submenu\"\n variants={context.reduce ? undefined : SUBMENU_VARIANTS}\n initial={context.reduce ? false : \"closed\"}\n animate={context.reduce ? { opacity: 1 } : \"open\"}\n exit={context.reduce ? { opacity: 0 } : \"closed\"}\n transition={context.reduce ? { duration: 0.12 } : undefined}\n data-slot=\"sidebar-menu-sub\"\n className={cn(\n \"relative mt-1 ml-5 flex min-w-0 flex-col gap-0.5 border-border border-l pl-3\",\n className,\n )}\n >\n {children}\n </motion.ul>\n ) : null}\n </AnimatePresence>\n );\n },\n);\n\nexport const AnimatedSidebarMenuSubItem = forwardRef<HTMLLIElement, HTMLMotionProps<\"li\">>(\n function AnimatedSidebarMenuSubItem({ className, ...props }, forwardedRef) {\n return (\n <motion.li\n {...props}\n ref={forwardedRef}\n variants={SUBMENU_ITEM_VARIANTS}\n data-slot=\"sidebar-menu-sub-item\"\n className={cn(\"relative min-w-0\", className)}\n />\n );\n },\n);\n\nexport interface AnimatedSidebarMenuSubButtonProps {\n children: ReactNode;\n icon?: ReactNode;\n href?: string;\n isActive?: boolean;\n disabled?: boolean;\n closeOnSelect?: boolean;\n target?: \"_blank\" | \"_self\" | \"_parent\" | \"_top\";\n rel?: string;\n onSelect?: () => void;\n className?: string;\n}\n\nexport function AnimatedSidebarMenuSubButton({\n children,\n icon,\n href,\n isActive = false,\n disabled = false,\n closeOnSelect = true,\n target,\n rel,\n onSelect,\n className,\n}: AnimatedSidebarMenuSubButtonProps) {\n const context = useAnimatedSidebar();\n\n const select = (event: React.MouseEvent<HTMLAnchorElement | HTMLButtonElement>) => {\n if (disabled) {\n event.preventDefault();\n return;\n }\n onSelect?.();\n if (context.isMobile && closeOnSelect) context.setOpenMobile(false);\n };\n\n const content = (\n <>\n <span aria-hidden=\"true\" className=\"grid size-4 shrink-0 place-items-center\">\n {icon ?? <span className=\"size-1 rounded-full bg-current\" />}\n </span>\n <span className=\"min-w-0 flex-1 truncate\">{children}</span>\n </>\n );\n\n const interactiveClassName = cn(\n \"flex min-h-8 w-full min-w-0 items-center gap-2 rounded-lg px-2 text-left text-xs outline-none\",\n \"text-muted-foreground transition-colors hover:bg-muted/60 hover:text-foreground\",\n \"focus-visible:bg-muted/70 focus-visible:ring-2 focus-visible:ring-ring\",\n isActive && \"bg-muted/70 text-foreground\",\n disabled && \"cursor-not-allowed opacity-40\",\n className,\n );\n\n return href ? (\n <motion.a\n href={href}\n target={target}\n rel={rel ?? (target === \"_blank\" ? \"noreferrer noopener\" : undefined)}\n aria-current={isActive ? \"page\" : undefined}\n aria-disabled={disabled || undefined}\n tabIndex={disabled ? -1 : undefined}\n onClick={select}\n whileTap={context.reduce || disabled ? undefined : { scale: 0.98 }}\n transition={SPRING_PRESS}\n className={interactiveClassName}\n >\n {content}\n </motion.a>\n ) : (\n <motion.button\n type=\"button\"\n disabled={disabled}\n aria-current={isActive ? \"page\" : undefined}\n onClick={select}\n whileTap={context.reduce || disabled ? undefined : { scale: 0.98 }}\n transition={SPRING_PRESS}\n className={interactiveClassName}\n >\n {content}\n </motion.button>\n );\n}\n\nexport interface AnimatedSidebarMenuButtonProps {\n children: ReactNode;\n icon?: ReactNode;\n badge?: ReactNode;\n href?: string;\n isActive?: boolean;\n ariaExpanded?: boolean;\n disabled?: boolean;\n closeOnSelect?: boolean;\n target?: \"_blank\" | \"_self\" | \"_parent\" | \"_top\";\n rel?: string;\n onSelect?: () => void;\n className?: string;\n}\n\nexport function AnimatedSidebarMenuButton({\n children,\n icon,\n badge,\n href,\n isActive = false,\n ariaExpanded,\n disabled = false,\n closeOnSelect,\n target,\n rel,\n onSelect,\n className,\n}: AnimatedSidebarMenuButtonProps) {\n const context = useAnimatedSidebar();\n const panel = useAnimatedSidebarPanel();\n const textLabel = typeof children === \"string\" ? children : undefined;\n\n const select = (event: React.MouseEvent<HTMLAnchorElement | HTMLButtonElement>) => {\n if (disabled) {\n event.preventDefault();\n return;\n }\n onSelect?.();\n const shouldCloseOnSelect = closeOnSelect ?? ariaExpanded === undefined;\n if (context.isMobile && shouldCloseOnSelect) {\n context.setOpenMobile(false);\n }\n };\n\n const content = (\n <>\n {isActive ? (\n <motion.span\n layoutId={context.layoutId}\n transition={context.reduce ? { duration: 0 } : SPRING_LAYOUT}\n className=\"absolute inset-0 rounded-xl bg-muted\"\n />\n ) : null}\n {icon ? (\n <span aria-hidden=\"true\" className=\"relative z-10 grid size-5 shrink-0 place-items-center\">\n {icon}\n </span>\n ) : null}\n <motion.span\n initial={false}\n animate={{\n opacity: panel.collapsed ? 0 : 1,\n x: panel.collapsed ? -4 : 0,\n }}\n transition={\n context.reduce\n ? REDUCED_TRANSITION\n : panel.collapsed\n ? LABEL_EXIT_TRANSITION\n : LABEL_ENTER_TRANSITION\n }\n aria-hidden={panel.collapsed}\n className={cn(\n \"relative z-10 min-w-0 flex-1 truncate\",\n panel.collapsed && \"pointer-events-none\",\n )}\n >\n {children}\n </motion.span>\n {badge && !panel.collapsed ? (\n <span className=\"relative z-10 shrink-0 text-muted-foreground text-xs\">{badge}</span>\n ) : null}\n {ariaExpanded !== undefined ? (\n <motion.span\n aria-hidden=\"true\"\n initial={false}\n animate={{\n opacity: panel.collapsed ? 0 : 1,\n rotate: ariaExpanded ? 90 : 0,\n x: panel.collapsed ? 4 : 0,\n }}\n transition={context.reduce ? { duration: 0 } : SPRING_LAYOUT}\n className=\"relative z-10 grid size-4 shrink-0 place-items-center text-muted-foreground\"\n >\n <ChevronRight className=\"size-3.5\" />\n </motion.span>\n ) : null}\n </>\n );\n\n const interactiveClassName = cn(\n \"relative flex min-h-9 w-full min-w-0 items-center gap-2.5 overflow-hidden rounded-xl px-3 text-left font-medium text-sm outline-none\",\n \"text-muted-foreground transition-colors hover:text-foreground\",\n \"focus-visible:bg-muted/70 focus-visible:ring-2 focus-visible:ring-ring\",\n isActive && \"text-foreground\",\n disabled && \"cursor-not-allowed opacity-40\",\n className,\n );\n\n return href ? (\n <motion.a\n href={href}\n target={target}\n rel={rel ?? (target === \"_blank\" ? \"noreferrer noopener\" : undefined)}\n aria-current={isActive ? \"page\" : undefined}\n aria-expanded={ariaExpanded}\n aria-disabled={disabled || undefined}\n aria-label={panel.collapsed ? textLabel : undefined}\n title={panel.collapsed ? textLabel : undefined}\n tabIndex={disabled ? -1 : undefined}\n onClick={select}\n whileTap={context.reduce || disabled ? undefined : { scale: 0.98 }}\n transition={SPRING_PRESS}\n className={interactiveClassName}\n >\n {content}\n </motion.a>\n ) : (\n <motion.button\n type=\"button\"\n disabled={disabled}\n aria-current={isActive ? \"page\" : undefined}\n aria-expanded={ariaExpanded}\n aria-label={panel.collapsed ? textLabel : undefined}\n title={panel.collapsed ? textLabel : undefined}\n onClick={select}\n whileTap={context.reduce || disabled ? undefined : { scale: 0.98 }}\n transition={SPRING_PRESS}\n className={interactiveClassName}\n >\n {content}\n </motion.button>\n );\n}\n"],"mappings":";;;;;;;;;;AAoCA,MAAM,eAAe;AACrB,MAAM,4BAA4B;AAElC,MAAM,mBAAmB;CACvB,UAAU;CACV,MAAM;AACR;AAKA,MAAM,2BAA2B;CAC/B,MAAM;CACN,WAAW;CACX,SAAS;CACT,MAAM;AACR;AAEA,MAAM,yBAAyB;CAC7B,UAAU;CACV,OAAO;CACP,MAAM;AACR;AAEA,MAAM,wBAAwB;CAC5B,UAAU;CACV,MAAM;AACR;AAEA,MAAM,qBAAqB;CACzB,UAAU;CACV,MAAM;AACR;AAEA,MAAM,mBAA6B;CACjC,QAAQ;EACN,SAAS;EACT,UAAU;EACV,YAAY;GACV,UAAU;GACV,MAAM;GACN,iBAAiB;GACjB,kBAAkB;EACpB;CACF;CACA,MAAM;EACJ,SAAS;EACT,UAAU;EACV,YAAY;GACV,UAAU;GACV,eAAe;GACf,MAAM;GACN,iBAAiB;EACnB;CACF;AACF;AAEA,MAAM,wBAAkC;CACtC,QAAQ;EACN,SAAS;EACT,GAAG;EACH,QAAQ;CACV;CACA,MAAM;EACJ,SAAS;EACT,GAAG;EACH,QAAQ;EACR,YAAY;CACd;AACF;AAEA,MAAM,qBAAqB;CACzB,UAAU;CACV,MAAM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KAAA;EACrC,UAAU,WAAW,KAAK,KAAA;EAC1B,SAAS;EACT,UAAU,QAAQ,UAAU,WAAW,KAAA,IAAY,EAAE,OAAO,IAAK;EACjE,YAAY;EACZ,WAAW;EAEV,UAAA;CACO,CAAA,IAEV,oBAAC,OAAO,QAAR;EACE,MAAK;EACK;EACV,gBAAc,WAAW,SAAS,KAAA;EAClC,iBAAe;EACf,cAAY,MAAM,YAAY,YAAY,KAAA;EAC1C,OAAO,MAAM,YAAY,YAAY,KAAA;EACrC,SAAS;EACT,UAAU,QAAQ,UAAU,WAAW,KAAA,IAAY,EAAE,OAAO,IAAK;EACjE,YAAY;EACZ,WAAW;EAEV,UAAA;CACY,CAAA;AAEnB"}
1
+ {"version":3,"file":"animated-sidebar.js","names":[],"sources":["../../../src/components/motion/animated-sidebar.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n type ButtonHTMLAttributes,\n type CSSProperties,\n createContext,\n forwardRef,\n type HTMLAttributes,\n type ReactNode,\n useCallback,\n useContext,\n useEffect,\n useId,\n useRef,\n useState,\n useSyncExternalStore,\n} from \"react\";\nimport { ChevronRight } from \"lucide-react\";\nimport {\n AnimatePresence,\n type HTMLMotionProps,\n motion,\n useReducedMotion,\n type Variants,\n} from \"motion/react\";\nimport { createPortal } from \"react-dom\";\n\nimport { cn } from \"@kumix/utils\";\nimport { EASE_DRAWER, EASE_OUT, SPRING_LAYOUT, SPRING_PRESS } from \"../../lib/ease\";\nimport { SharedLayoutBg } from \"./shared-layout-bg\";\n\ntype SidebarState = \"expanded\" | \"collapsed\";\ntype SidebarSide = \"left\" | \"right\";\ntype SidebarVariant = \"sidebar\" | \"floating\" | \"inset\";\ntype SidebarCollapsible = \"offcanvas\" | \"icon\" | \"none\";\n\nconst MOBILE_QUERY = \"(max-width: 767px)\";\nconst SIDEBAR_KEYBOARD_SHORTCUT = \"b\";\n\nconst PANEL_TRANSITION = {\n duration: 0.36,\n ease: EASE_DRAWER,\n} as const;\n\n// The desktop rail settles at a hard zero-width boundary. Keep the spring\n// critically damped so it cannot overshoot, pause against that boundary, and\n// then snap back during the final frame.\nconst SIDEBAR_MORPH_TRANSITION = {\n type: \"spring\",\n stiffness: 380,\n damping: 35,\n mass: 0.75,\n} as const;\n\nconst LABEL_ENTER_TRANSITION = {\n duration: 0.2,\n delay: 0.08,\n ease: EASE_OUT,\n} as const;\n\nconst LABEL_EXIT_TRANSITION = {\n duration: 0.12,\n ease: EASE_OUT,\n} as const;\n\nconst SUBMENU_TRANSITION = {\n duration: 0.18,\n ease: EASE_OUT,\n} as const;\n\nconst SUBMENU_VARIANTS: Variants = {\n closed: {\n opacity: 0,\n clipPath: \"inset(0 0 100% 0 round 8px)\",\n transition: {\n duration: 0.14,\n ease: EASE_OUT,\n staggerChildren: 0.025,\n staggerDirection: -1,\n },\n },\n open: {\n opacity: 1,\n clipPath: \"inset(0 0 0% 0 round 8px)\",\n transition: {\n duration: 0.2,\n delayChildren: 0.035,\n ease: EASE_OUT,\n staggerChildren: 0.045,\n },\n },\n};\n\nconst SUBMENU_ITEM_VARIANTS: Variants = {\n closed: {\n opacity: 0,\n y: -6,\n filter: \"blur(3px)\",\n },\n open: {\n opacity: 1,\n y: 0,\n filter: \"blur(0px)\",\n transition: SUBMENU_TRANSITION,\n },\n};\n\nconst REDUCED_TRANSITION = {\n duration: 0.16,\n ease: EASE_OUT,\n} as const;\n\nconst FOCUSABLE_SELECTOR = [\n \"a[href]\",\n \"button:not([disabled])\",\n \"input:not([disabled])\",\n \"select:not([disabled])\",\n \"textarea:not([disabled])\",\n \"[tabindex]:not([tabindex='-1'])\",\n].join(\",\");\n\nfunction subscribeToMobileQuery(callback: () => void) {\n const query = window.matchMedia(MOBILE_QUERY);\n query.addEventListener(\"change\", callback);\n return () => query.removeEventListener(\"change\", callback);\n}\n\nfunction getMobileSnapshot() {\n return window.matchMedia(MOBILE_QUERY).matches;\n}\n\nfunction getServerMobileSnapshot() {\n return false;\n}\n\nfunction useIsMobile() {\n return useSyncExternalStore(subscribeToMobileQuery, getMobileSnapshot, getServerMobileSnapshot);\n}\n\ninterface AnimatedSidebarContextValue {\n isMobile: boolean;\n layoutId: string;\n open: boolean;\n openMobile: boolean;\n reduce: boolean;\n setOpen: (open: boolean) => void;\n setOpenMobile: (open: boolean) => void;\n state: SidebarState;\n toggleSidebar: () => void;\n triggerRef: React.RefObject<HTMLButtonElement | null>;\n}\n\nconst AnimatedSidebarContext = createContext<AnimatedSidebarContextValue | null>(null);\n\ninterface AnimatedSidebarPanelContextValue {\n collapsed: boolean;\n collapsible: SidebarCollapsible;\n side: SidebarSide;\n}\n\nconst AnimatedSidebarPanelContext = createContext<AnimatedSidebarPanelContextValue | null>(null);\n\nexport function useAnimatedSidebar() {\n const context = useContext(AnimatedSidebarContext);\n if (!context) {\n throw new Error(\"useAnimatedSidebar must be used inside AnimatedSidebarProvider.\");\n }\n return context;\n}\n\nfunction useAnimatedSidebarPanel() {\n const context = useContext(AnimatedSidebarPanelContext);\n if (!context) {\n throw new Error(\"Animated Sidebar parts must be used inside AnimatedSidebar.\");\n }\n return context;\n}\n\ntype SidebarProviderStyle = CSSProperties & {\n \"--sidebar-width\"?: string;\n \"--sidebar-width-icon\"?: string;\n \"--sidebar-width-mobile\"?: string;\n};\n\nexport interface AnimatedSidebarProviderProps extends HTMLAttributes<HTMLDivElement> {\n open?: boolean;\n defaultOpen?: boolean;\n onOpenChange?: (open: boolean) => void;\n openMobile?: boolean;\n defaultOpenMobile?: boolean;\n onOpenMobileChange?: (open: boolean) => void;\n style?: SidebarProviderStyle;\n}\n\nexport function AnimatedSidebarProvider({\n children,\n open,\n defaultOpen = true,\n onOpenChange,\n openMobile,\n defaultOpenMobile = false,\n onOpenMobileChange,\n className,\n style,\n ...props\n}: AnimatedSidebarProviderProps) {\n const [internalOpen, setInternalOpen] = useState(defaultOpen);\n const [internalOpenMobile, setInternalOpenMobile] = useState(defaultOpenMobile);\n const isMobile = useIsMobile();\n const reduce = useReducedMotion() ?? false;\n const generatedId = useId();\n const triggerRef = useRef<HTMLButtonElement>(null);\n const desktopOpen = open ?? internalOpen;\n const mobileOpen = openMobile ?? internalOpenMobile;\n\n const setOpen = useCallback(\n (nextOpen: boolean) => {\n if (open === undefined) setInternalOpen(nextOpen);\n onOpenChange?.(nextOpen);\n },\n [onOpenChange, open],\n );\n\n const setOpenMobile = useCallback(\n (nextOpen: boolean) => {\n if (openMobile === undefined) setInternalOpenMobile(nextOpen);\n onOpenMobileChange?.(nextOpen);\n },\n [onOpenMobileChange, openMobile],\n );\n\n const toggleSidebar = useCallback(() => {\n if (isMobile) setOpenMobile(!mobileOpen);\n else setOpen(!desktopOpen);\n }, [desktopOpen, isMobile, mobileOpen, setOpen, setOpenMobile]);\n\n useEffect(() => {\n const handleShortcut = (event: KeyboardEvent) => {\n if (\n event.key.toLowerCase() === SIDEBAR_KEYBOARD_SHORTCUT &&\n (event.metaKey || event.ctrlKey)\n ) {\n event.preventDefault();\n toggleSidebar();\n }\n };\n\n window.addEventListener(\"keydown\", handleShortcut);\n return () => window.removeEventListener(\"keydown\", handleShortcut);\n }, [toggleSidebar]);\n\n return (\n <AnimatedSidebarContext.Provider\n value={{\n isMobile,\n layoutId: `${generatedId}-active`,\n open: desktopOpen,\n openMobile: mobileOpen,\n reduce,\n setOpen,\n setOpenMobile,\n state: desktopOpen ? \"expanded\" : \"collapsed\",\n toggleSidebar,\n triggerRef,\n }}\n >\n <div\n {...props}\n data-slot=\"sidebar-wrapper\"\n data-state={desktopOpen ? \"expanded\" : \"collapsed\"}\n style={{\n \"--sidebar-width\": \"16rem\",\n \"--sidebar-width-icon\": \"4.25rem\",\n \"--sidebar-width-mobile\": \"18rem\",\n ...style,\n }}\n className={cn(\"group/sidebar-wrapper flex min-h-svh w-full min-w-0\", className)}\n >\n {children}\n </div>\n </AnimatedSidebarContext.Provider>\n );\n}\n\nfunction MobileSidebar({\n ariaLabel,\n children,\n className,\n side,\n}: {\n ariaLabel: string;\n children: ReactNode;\n className?: string;\n side: SidebarSide;\n}) {\n const context = useAnimatedSidebar();\n const panelRef = useRef<HTMLDivElement>(null);\n const [mounted, setMounted] = useState(false);\n // The sheet is mounted for as long as the viewport is mobile, so it hides\n // itself while closed rather than sitting there transparent and interactive.\n // Opening shows it in the same commit that starts the slide — a delayed show\n // would run the focus effect below against a still-hidden panel, and focus()\n // on a hidden element is ignored. Closing waits for the slide to finish, and\n // the panel's own exit tells us when that is: no duration to keep in sync.\n const [hidden, setHidden] = useState(!context.openMobile);\n // The completion callback fires for the open slide too, and it reads state\n // from whenever motion settles: a ref keeps it on the current one.\n const openMobileRef = useRef(context.openMobile);\n\n useEffect(() => setMounted(true), []);\n\n useEffect(() => {\n openMobileRef.current = context.openMobile;\n if (context.openMobile) setHidden(false);\n }, [context.openMobile]);\n\n useEffect(() => {\n if (!context.openMobile) return;\n\n const body = document.body;\n const scrollY = window.scrollY;\n const previousBodyStyles = {\n left: body.style.left,\n overflow: body.style.overflow,\n position: body.style.position,\n right: body.style.right,\n top: body.style.top,\n };\n\n body.style.position = \"fixed\";\n body.style.top = `-${scrollY}px`;\n body.style.left = \"0\";\n body.style.right = \"0\";\n body.style.overflow = \"hidden\";\n\n const focusFrame = requestAnimationFrame(() => {\n const firstFocusable = panelRef.current?.querySelector<HTMLElement>(FOCUSABLE_SELECTOR);\n (firstFocusable ?? panelRef.current)?.focus({ preventScroll: true });\n });\n\n return () => {\n cancelAnimationFrame(focusFrame);\n body.style.position = previousBodyStyles.position;\n body.style.top = previousBodyStyles.top;\n body.style.left = previousBodyStyles.left;\n body.style.right = previousBodyStyles.right;\n body.style.overflow = previousBodyStyles.overflow;\n window.scrollTo(0, scrollY);\n context.triggerRef.current?.focus({ preventScroll: true });\n };\n }, [context.openMobile, context.triggerRef]);\n\n if (!mounted) return null;\n\n // This container groups the sheet for hiding and the z-index and carries no\n // box: both children are `fixed` and resolve against the viewport themselves.\n // The scrim spans the viewport edges but paints a colour, and the panel is\n // inset off one side and paints its own surface, so no layer here is a\n return createPortal(\n <div\n className={cn(\n \"pointer-events-none fixed top-0 left-0 z-50 size-0 md:hidden\",\n hidden && !context.openMobile ? \"invisible\" : \"visible\",\n )}\n >\n <motion.button\n type=\"button\"\n aria-label=\"Close sidebar\"\n tabIndex={context.openMobile ? 0 : -1}\n initial={false}\n animate={{ opacity: context.openMobile ? 1 : 0 }}\n transition={context.reduce ? REDUCED_TRANSITION : PANEL_TRANSITION}\n onClick={() => context.setOpenMobile(false)}\n className={cn(\n \"fixed inset-0 bg-black/40\",\n context.openMobile ? \"pointer-events-auto\" : \"pointer-events-none\",\n )}\n />\n\n <motion.div\n ref={panelRef}\n role=\"dialog\"\n aria-modal=\"true\"\n aria-label={ariaLabel}\n aria-hidden={!context.openMobile}\n inert={!context.openMobile}\n tabIndex={-1}\n data-mobile=\"true\"\n data-state={context.openMobile ? \"expanded\" : \"collapsed\"}\n data-side={side}\n initial={false}\n animate={{\n opacity: context.reduce ? (context.openMobile ? 1 : 0) : 1,\n x: context.reduce ? 0 : context.openMobile ? \"0%\" : side === \"left\" ? \"-100%\" : \"100%\",\n }}\n transition={context.reduce ? REDUCED_TRANSITION : PANEL_TRANSITION}\n onAnimationComplete={() => {\n if (!openMobileRef.current) setHidden(true);\n }}\n onKeyDown={(event) => {\n if (event.key === \"Escape\") {\n event.preventDefault();\n context.setOpenMobile(false);\n return;\n }\n\n if (event.key !== \"Tab\") return;\n const focusable = panelRef.current\n ? Array.from(panelRef.current.querySelectorAll<HTMLElement>(FOCUSABLE_SELECTOR))\n : [];\n\n if (focusable.length === 0) {\n event.preventDefault();\n panelRef.current?.focus();\n return;\n }\n\n const first = focusable[0];\n const last = focusable[focusable.length - 1];\n if (event.shiftKey && document.activeElement === first) {\n event.preventDefault();\n last.focus();\n } else if (!event.shiftKey && document.activeElement === last) {\n event.preventDefault();\n first.focus();\n }\n }}\n className={cn(\n \"pointer-events-auto fixed inset-y-0 flex h-dvh w-(--sidebar-width-mobile) max-w-[88vw] flex-col overflow-hidden\",\n \"border-border bg-background shadow-2xl will-change-transform\",\n side === \"left\" ? \"left-0 border-r\" : \"right-0 border-l\",\n !context.openMobile && \"pointer-events-none\",\n className,\n )}\n >\n <AnimatedSidebarPanelContext.Provider\n value={{ collapsed: false, collapsible: \"none\", side }}\n >\n {children}\n </AnimatedSidebarPanelContext.Provider>\n </motion.div>\n </div>,\n document.body,\n );\n}\n\nexport interface AnimatedSidebarProps extends Omit<HTMLMotionProps<\"aside\">, \"children\"> {\n children?: ReactNode;\n side?: SidebarSide;\n variant?: SidebarVariant;\n collapsible?: SidebarCollapsible;\n ariaLabel?: string;\n panelClassName?: string;\n}\n\nexport const AnimatedSidebar = forwardRef<HTMLElement, AnimatedSidebarProps>(\n function AnimatedSidebar(\n {\n side = \"left\",\n variant = \"sidebar\",\n collapsible = \"icon\",\n ariaLabel = \"Sidebar\",\n children,\n className,\n panelClassName,\n style,\n ...props\n },\n forwardedRef,\n ) {\n const context = useAnimatedSidebar();\n const collapsed = collapsible !== \"none\" && !context.open;\n const offcanvas = collapsed && collapsible === \"offcanvas\";\n const width = offcanvas\n ? \"0px\"\n : collapsed\n ? \"var(--sidebar-width-icon)\"\n : \"var(--sidebar-width)\";\n\n if (context.isMobile) {\n return (\n <MobileSidebar ariaLabel={ariaLabel} className={className} side={side}>\n {children}\n </MobileSidebar>\n );\n }\n\n return (\n <motion.aside\n {...props}\n ref={forwardedRef}\n initial={false}\n aria-label={ariaLabel}\n data-slot=\"sidebar\"\n data-state={collapsed ? \"collapsed\" : \"expanded\"}\n data-collapsible={collapsible}\n data-variant={variant}\n data-side={side}\n animate={{ width }}\n transition={context.reduce ? { duration: 0 } : SIDEBAR_MORPH_TRANSITION}\n style={style}\n className={cn(\n \"group/sidebar relative hidden h-auto shrink-0 will-change-[width] md:block\",\n \"peer\",\n side === \"right\" && \"order-last\",\n className,\n )}\n >\n <motion.div\n initial={false}\n animate={{\n opacity: offcanvas ? 0 : 1,\n x: offcanvas ? (side === \"left\" ? \"-100%\" : \"100%\") : \"0%\",\n }}\n transition={context.reduce ? REDUCED_TRANSITION : PANEL_TRANSITION}\n className={cn(\n \"sticky top-0 flex h-svh w-full flex-col overflow-hidden bg-background\",\n collapsible === \"offcanvas\" && \"w-(--sidebar-width)\",\n variant === \"sidebar\" &&\n (side === \"left\" ? \"border-border border-r\" : \"border-border border-l\"),\n variant === \"floating\" &&\n \"m-2 h-[calc(100svh-1rem)] rounded-2xl border border-border shadow-sm\",\n variant === \"inset\" && \"m-2 h-[calc(100svh-1rem)] rounded-2xl\",\n panelClassName,\n )}\n >\n <AnimatedSidebarPanelContext.Provider value={{ collapsed, collapsible, side }}>\n {children}\n </AnimatedSidebarPanelContext.Provider>\n </motion.div>\n </motion.aside>\n );\n },\n);\n\nexport interface AnimatedSidebarTriggerProps extends ButtonHTMLAttributes<HTMLButtonElement> {}\n\nexport const AnimatedSidebarTrigger = forwardRef<HTMLButtonElement, AnimatedSidebarTriggerProps>(\n function AnimatedSidebarTrigger({ className, onClick, type = \"button\", ...props }, forwardedRef) {\n const context = useAnimatedSidebar();\n const expanded = context.isMobile ? context.openMobile : context.open;\n\n return (\n <button\n {...props}\n ref={(node) => {\n context.triggerRef.current = node;\n if (typeof forwardedRef === \"function\") forwardedRef(node);\n else if (forwardedRef) forwardedRef.current = node;\n }}\n type={type}\n aria-label={props[\"aria-label\"] ?? \"Toggle sidebar\"}\n aria-expanded={expanded}\n data-slot=\"sidebar-trigger\"\n data-state={expanded ? \"expanded\" : \"collapsed\"}\n onClick={(event) => {\n onClick?.(event);\n if (!event.defaultPrevented) context.toggleSidebar();\n }}\n className={cn(\n \"inline-flex size-10 shrink-0 items-center justify-center rounded-xl outline-none\",\n \"focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background\",\n className,\n )}\n />\n );\n },\n);\n\nexport interface AnimatedSidebarCloseProps extends ButtonHTMLAttributes<HTMLButtonElement> {}\n\nexport const AnimatedSidebarClose = forwardRef<HTMLButtonElement, AnimatedSidebarCloseProps>(\n function AnimatedSidebarClose({ className, onClick, type = \"button\", ...props }, forwardedRef) {\n const context = useAnimatedSidebar();\n\n return (\n <button\n {...props}\n ref={forwardedRef}\n type={type}\n aria-label={props[\"aria-label\"] ?? \"Close sidebar\"}\n onClick={(event) => {\n onClick?.(event);\n if (event.defaultPrevented) return;\n if (context.isMobile) context.setOpenMobile(false);\n else context.setOpen(false);\n }}\n className={cn(\n \"inline-flex size-10 shrink-0 items-center justify-center rounded-xl outline-none\",\n \"focus-visible:ring-2 focus-visible:ring-ring\",\n className,\n )}\n />\n );\n },\n);\n\nexport interface AnimatedSidebarRailProps extends ButtonHTMLAttributes<HTMLButtonElement> {}\n\nexport const AnimatedSidebarRail = forwardRef<HTMLButtonElement, AnimatedSidebarRailProps>(\n function AnimatedSidebarRail({ className, onClick, type = \"button\", ...props }, forwardedRef) {\n const context = useAnimatedSidebar();\n const panel = useAnimatedSidebarPanel();\n\n return (\n <button\n {...props}\n ref={forwardedRef}\n type={type}\n data-side={panel.side}\n aria-label={props[\"aria-label\"] ?? \"Toggle sidebar\"}\n title=\"Toggle sidebar\"\n tabIndex={-1}\n onClick={(event) => {\n onClick?.(event);\n if (!event.defaultPrevented) context.toggleSidebar();\n }}\n className={cn(\n \"absolute inset-y-0 z-20 hidden w-4 -translate-x-1/2 outline-none md:block\",\n \"after:absolute after:inset-y-0 after:left-1/2 after:w-px after:bg-transparent after:transition-colors hover:after:bg-border\",\n \"data-[side=right]:right-0 data-[side=left]:left-full data-[side=right]:translate-x-1/2\",\n className,\n )}\n />\n );\n },\n);\n\nexport interface AnimatedSidebarInsetProps extends HTMLMotionProps<\"main\"> {}\n\nexport const AnimatedSidebarInset = forwardRef<HTMLElement, AnimatedSidebarInsetProps>(\n function AnimatedSidebarInset({ className, ...props }, forwardedRef) {\n return (\n <motion.main\n {...props}\n ref={forwardedRef}\n data-slot=\"sidebar-inset\"\n className={cn(\n \"relative flex min-h-svh min-w-0 flex-1 flex-col bg-background\",\n \"md:peer-data-[variant=inset]:m-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-2xl md:peer-data-[variant=inset]:shadow-sm\",\n className,\n )}\n />\n );\n },\n);\n\nexport const AnimatedSidebarHeader = forwardRef<HTMLDivElement, HTMLAttributes<HTMLDivElement>>(\n function AnimatedSidebarHeader({ className, ...props }, forwardedRef) {\n return (\n <div\n {...props}\n ref={forwardedRef}\n data-slot=\"sidebar-header\"\n className={cn(\"flex shrink-0 flex-col gap-2 p-3\", className)}\n />\n );\n },\n);\n\nexport const AnimatedSidebarContent = forwardRef<HTMLDivElement, HTMLAttributes<HTMLDivElement>>(\n function AnimatedSidebarContent({ className, ...props }, forwardedRef) {\n return (\n <div\n {...props}\n ref={forwardedRef}\n data-slot=\"sidebar-content\"\n className={cn(\n \"flex min-h-0 flex-1 flex-col gap-2 overflow-y-auto overflow-x-hidden overscroll-contain px-2 py-2\",\n className,\n )}\n />\n );\n },\n);\n\nexport const AnimatedSidebarFooter = forwardRef<HTMLDivElement, HTMLAttributes<HTMLDivElement>>(\n function AnimatedSidebarFooter({ className, ...props }, forwardedRef) {\n return (\n <div\n {...props}\n ref={forwardedRef}\n data-slot=\"sidebar-footer\"\n className={cn(\n \"flex shrink-0 flex-col gap-2 border-border border-t p-3 pb-[max(0.75rem,env(safe-area-inset-bottom))]\",\n className,\n )}\n />\n );\n },\n);\n\nexport const AnimatedSidebarGroup = forwardRef<HTMLDivElement, HTMLAttributes<HTMLDivElement>>(\n function AnimatedSidebarGroup({ className, ...props }, forwardedRef) {\n return (\n <div\n {...props}\n ref={forwardedRef}\n data-slot=\"sidebar-group\"\n className={cn(\"flex w-full min-w-0 flex-col px-1 py-1.5\", className)}\n />\n );\n },\n);\n\nexport const AnimatedSidebarGroupLabel = forwardRef<HTMLDivElement, HTMLAttributes<HTMLDivElement>>(\n function AnimatedSidebarGroupLabel({ children, className, ...props }, forwardedRef) {\n const { collapsed } = useAnimatedSidebarPanel();\n\n return (\n <div\n {...props}\n ref={forwardedRef}\n aria-hidden={collapsed}\n data-slot=\"sidebar-group-label\"\n className={cn(\n \"mb-1 h-7 overflow-hidden px-2 font-medium text-[10px] text-muted-foreground uppercase tracking-[0.14em] transition-opacity\",\n collapsed ? \"opacity-0\" : \"opacity-100\",\n className,\n )}\n >\n {children}\n </div>\n );\n },\n);\n\nexport const AnimatedSidebarGroupContent = forwardRef<\n HTMLDivElement,\n HTMLAttributes<HTMLDivElement>\n>(function AnimatedSidebarGroupContent({ className, ...props }, forwardedRef) {\n return (\n <div\n {...props}\n ref={forwardedRef}\n data-slot=\"sidebar-group-content\"\n className={cn(\"w-full min-w-0\", className)}\n />\n );\n});\n\nexport const AnimatedSidebarMenu = forwardRef<HTMLUListElement, HTMLAttributes<HTMLUListElement>>(\n function AnimatedSidebarMenu({ children, className, ...props }, forwardedRef) {\n return (\n <SharedLayoutBg\n {...props}\n ref={forwardedRef as React.Ref<HTMLElement>}\n as=\"ul\"\n inset={0}\n pillClassName=\"rounded-xl bg-muted/70\"\n pillContainerClassName=\"inset-y-auto top-0 h-9\"\n data-slot=\"sidebar-menu\"\n className={cn(\"flex w-full min-w-0 list-none flex-col gap-0.5\", className)}\n >\n {children}\n </SharedLayoutBg>\n );\n },\n);\n\nexport const AnimatedSidebarMenuItem = forwardRef<HTMLLIElement, HTMLMotionProps<\"li\">>(\n function AnimatedSidebarMenuItem({ className, ...props }, forwardedRef) {\n return (\n <motion.li\n {...props}\n ref={forwardedRef}\n layout=\"position\"\n transition={SPRING_LAYOUT}\n data-slot=\"sidebar-menu-item\"\n className={cn(\"relative\", className)}\n />\n );\n },\n);\n\nexport interface AnimatedSidebarMenuSubProps extends Omit<HTMLMotionProps<\"ul\">, \"children\"> {\n open: boolean;\n children?: ReactNode;\n}\n\nexport const AnimatedSidebarMenuSub = forwardRef<HTMLUListElement, AnimatedSidebarMenuSubProps>(\n function AnimatedSidebarMenuSub({ open, children, className, ...props }, forwardedRef) {\n const context = useAnimatedSidebar();\n const panel = useAnimatedSidebarPanel();\n\n return (\n <AnimatePresence initial={false} mode=\"popLayout\">\n {open && !panel.collapsed ? (\n <motion.ul\n {...props}\n ref={forwardedRef}\n key=\"sidebar-submenu\"\n variants={context.reduce ? undefined : SUBMENU_VARIANTS}\n initial={context.reduce ? false : \"closed\"}\n animate={context.reduce ? { opacity: 1 } : \"open\"}\n exit={context.reduce ? { opacity: 0 } : \"closed\"}\n transition={context.reduce ? { duration: 0.12 } : undefined}\n data-slot=\"sidebar-menu-sub\"\n className={cn(\n \"relative mt-1 ml-5 flex min-w-0 flex-col gap-0.5 border-border border-l pl-3\",\n className,\n )}\n >\n {children}\n </motion.ul>\n ) : null}\n </AnimatePresence>\n );\n },\n);\n\nexport const AnimatedSidebarMenuSubItem = forwardRef<HTMLLIElement, HTMLMotionProps<\"li\">>(\n function AnimatedSidebarMenuSubItem({ className, ...props }, forwardedRef) {\n return (\n <motion.li\n {...props}\n ref={forwardedRef}\n variants={SUBMENU_ITEM_VARIANTS}\n data-slot=\"sidebar-menu-sub-item\"\n className={cn(\"relative min-w-0\", className)}\n />\n );\n },\n);\n\nexport interface AnimatedSidebarMenuSubButtonProps {\n children: ReactNode;\n icon?: ReactNode;\n href?: string;\n isActive?: boolean;\n disabled?: boolean;\n closeOnSelect?: boolean;\n target?: \"_blank\" | \"_self\" | \"_parent\" | \"_top\";\n rel?: string;\n onSelect?: () => void;\n className?: string;\n}\n\nexport function AnimatedSidebarMenuSubButton({\n children,\n icon,\n href,\n isActive = false,\n disabled = false,\n closeOnSelect = true,\n target,\n rel,\n onSelect,\n className,\n}: AnimatedSidebarMenuSubButtonProps) {\n const context = useAnimatedSidebar();\n\n const select = (event: React.MouseEvent<HTMLAnchorElement | HTMLButtonElement>) => {\n if (disabled) {\n event.preventDefault();\n return;\n }\n onSelect?.();\n if (context.isMobile && closeOnSelect) context.setOpenMobile(false);\n };\n\n const content = (\n <>\n <span aria-hidden=\"true\" className=\"grid size-4 shrink-0 place-items-center\">\n {icon ?? <span className=\"size-1 rounded-full bg-current\" />}\n </span>\n <span className=\"min-w-0 flex-1 truncate\">{children}</span>\n </>\n );\n\n const interactiveClassName = cn(\n \"flex min-h-8 w-full min-w-0 items-center gap-2 rounded-lg px-2 text-left text-xs outline-none\",\n \"text-muted-foreground transition-colors hover:bg-muted/60 hover:text-foreground\",\n \"focus-visible:bg-muted/70 focus-visible:ring-2 focus-visible:ring-ring\",\n isActive && \"bg-muted/70 text-foreground\",\n disabled && \"cursor-not-allowed opacity-40\",\n className,\n );\n\n return href ? (\n <motion.a\n href={href}\n target={target}\n rel={rel ?? (target === \"_blank\" ? \"noreferrer noopener\" : undefined)}\n aria-current={isActive ? \"page\" : undefined}\n aria-disabled={disabled || undefined}\n tabIndex={disabled ? -1 : undefined}\n onClick={select}\n whileTap={context.reduce || disabled ? undefined : { scale: 0.98 }}\n transition={SPRING_PRESS}\n className={interactiveClassName}\n >\n {content}\n </motion.a>\n ) : (\n <motion.button\n type=\"button\"\n disabled={disabled}\n aria-current={isActive ? \"page\" : undefined}\n onClick={select}\n whileTap={context.reduce || disabled ? undefined : { scale: 0.98 }}\n transition={SPRING_PRESS}\n className={interactiveClassName}\n >\n {content}\n </motion.button>\n );\n}\n\nexport interface AnimatedSidebarMenuButtonProps {\n children: ReactNode;\n icon?: ReactNode;\n badge?: ReactNode;\n href?: string;\n isActive?: boolean;\n ariaExpanded?: boolean;\n disabled?: boolean;\n closeOnSelect?: boolean;\n target?: \"_blank\" | \"_self\" | \"_parent\" | \"_top\";\n rel?: string;\n onSelect?: () => void;\n className?: string;\n}\n\nexport function AnimatedSidebarMenuButton({\n children,\n icon,\n badge,\n href,\n isActive = false,\n ariaExpanded,\n disabled = false,\n closeOnSelect,\n target,\n rel,\n onSelect,\n className,\n}: AnimatedSidebarMenuButtonProps) {\n const context = useAnimatedSidebar();\n const panel = useAnimatedSidebarPanel();\n const textLabel = typeof children === \"string\" ? children : undefined;\n\n const select = (event: React.MouseEvent<HTMLAnchorElement | HTMLButtonElement>) => {\n if (disabled) {\n event.preventDefault();\n return;\n }\n onSelect?.();\n const shouldCloseOnSelect = closeOnSelect ?? ariaExpanded === undefined;\n if (context.isMobile && shouldCloseOnSelect) {\n context.setOpenMobile(false);\n }\n // A submenu cannot render in the icon rail, so opening one from there\n // leaves its children unreachable — a pointer can still fall back to the\n // rail or the shortcut, a finger has nothing. Selecting a group unfolds\n // the panel that is about to hold it.\n if (ariaExpanded !== undefined && panel.collapsed && !context.isMobile) {\n context.setOpen(true);\n }\n };\n\n const content = (\n <>\n {isActive ? (\n <motion.span\n layoutId={context.layoutId}\n transition={context.reduce ? { duration: 0 } : SPRING_LAYOUT}\n className=\"absolute inset-0 rounded-xl bg-muted\"\n />\n ) : null}\n {icon ? (\n <span aria-hidden=\"true\" className=\"relative z-10 grid size-5 shrink-0 place-items-center\">\n {icon}\n </span>\n ) : null}\n <motion.span\n initial={false}\n animate={{\n opacity: panel.collapsed ? 0 : 1,\n x: panel.collapsed ? -4 : 0,\n }}\n transition={\n context.reduce\n ? REDUCED_TRANSITION\n : panel.collapsed\n ? LABEL_EXIT_TRANSITION\n : LABEL_ENTER_TRANSITION\n }\n aria-hidden={panel.collapsed}\n className={cn(\n \"relative z-10 min-w-0 flex-1 truncate\",\n panel.collapsed && \"pointer-events-none\",\n )}\n >\n {children}\n </motion.span>\n {badge && !panel.collapsed ? (\n <span className=\"relative z-10 shrink-0 text-muted-foreground text-xs\">{badge}</span>\n ) : null}\n {ariaExpanded !== undefined ? (\n <motion.span\n aria-hidden=\"true\"\n initial={false}\n animate={{\n opacity: panel.collapsed ? 0 : 1,\n rotate: ariaExpanded ? 90 : 0,\n x: panel.collapsed ? 4 : 0,\n }}\n transition={context.reduce ? { duration: 0 } : SPRING_LAYOUT}\n className=\"relative z-10 grid size-4 shrink-0 place-items-center text-muted-foreground\"\n >\n <ChevronRight className=\"size-3.5\" />\n </motion.span>\n ) : null}\n </>\n );\n\n const interactiveClassName = cn(\n \"relative flex min-h-9 w-full min-w-0 items-center gap-2.5 overflow-hidden rounded-xl px-3 text-left font-medium text-sm outline-none\",\n \"text-muted-foreground transition-colors hover:text-foreground\",\n \"focus-visible:bg-muted/70 focus-visible:ring-2 focus-visible:ring-ring\",\n isActive && \"text-foreground\",\n disabled && \"cursor-not-allowed opacity-40\",\n className,\n );\n\n return href ? (\n <motion.a\n href={href}\n target={target}\n rel={rel ?? (target === \"_blank\" ? \"noreferrer noopener\" : undefined)}\n aria-current={isActive ? \"page\" : undefined}\n aria-expanded={ariaExpanded}\n aria-disabled={disabled || undefined}\n aria-label={panel.collapsed ? textLabel : undefined}\n title={panel.collapsed ? textLabel : undefined}\n tabIndex={disabled ? -1 : undefined}\n onClick={select}\n whileTap={context.reduce || disabled ? undefined : { scale: 0.98 }}\n transition={SPRING_PRESS}\n className={interactiveClassName}\n >\n {content}\n </motion.a>\n ) : (\n <motion.button\n type=\"button\"\n disabled={disabled}\n aria-current={isActive ? \"page\" : undefined}\n aria-expanded={ariaExpanded}\n aria-label={panel.collapsed ? textLabel : undefined}\n title={panel.collapsed ? textLabel : undefined}\n onClick={select}\n whileTap={context.reduce || disabled ? undefined : { scale: 0.98 }}\n transition={SPRING_PRESS}\n className={interactiveClassName}\n >\n {content}\n </motion.button>\n );\n}\n"],"mappings":";;;;;;;;;;AAoCA,MAAM,eAAe;AACrB,MAAM,4BAA4B;AAElC,MAAM,mBAAmB;CACvB,UAAU;CACV,MAAM;AACR;AAKA,MAAM,2BAA2B;CAC/B,MAAM;CACN,WAAW;CACX,SAAS;CACT,MAAM;AACR;AAEA,MAAM,yBAAyB;CAC7B,UAAU;CACV,OAAO;CACP,MAAM;AACR;AAEA,MAAM,wBAAwB;CAC5B,UAAU;CACV,MAAM;AACR;AAEA,MAAM,qBAAqB;CACzB,UAAU;CACV,MAAM;AACR;AAEA,MAAM,mBAA6B;CACjC,QAAQ;EACN,SAAS;EACT,UAAU;EACV,YAAY;GACV,UAAU;GACV,MAAM;GACN,iBAAiB;GACjB,kBAAkB;EACpB;CACF;CACA,MAAM;EACJ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A;EAAY,CAAA,IAClF;EACH,iBAAiB,KAAA,IAChB,oBAAC,OAAO,MAAR;GACE,eAAY;GACZ,SAAS;GACT,SAAS;IACP,SAAS,MAAM,YAAY,IAAI;IAC/B,QAAQ,eAAe,KAAK;IAC5B,GAAG,MAAM,YAAY,IAAI;GAC3B;GACA,YAAY,QAAQ,SAAS,EAAE,UAAU,EAAE,IAAI;GAC/C,WAAU;GAEV,UAAA,oBAAC,cAAD,EAAc,WAAU,WAAY,CAAA;EACzB,CAAA,IACX;CACJ,EAAA,CAAA;CAGJ,MAAM,uBAAuB,GAC3B,wIACA,iEACA,0EACA,YAAY,mBACZ,YAAY,iCACZ,SACF;CAEA,OAAO,OACL,oBAAC,OAAO,GAAR;EACQ;EACE;EACR,KAAK,QAAQ,WAAW,WAAW,wBAAwB,KAAA;EAC3D,gBAAc,WAAW,SAAS,KAAA;EAClC,iBAAe;EACf,iBAAe,YAAY,KAAA;EAC3B,cAAY,MAAM,YAAY,YAAY,KAAA;EAC1C,OAAO,MAAM,YAAY,YAAY,KAAA;EACrC,UAAU,WAAW,KAAK,KAAA;EAC1B,SAAS;EACT,UAAU,QAAQ,UAAU,WAAW,KAAA,IAAY,EAAE,OAAO,IAAK;EACjE,YAAY;EACZ,WAAW;EAEV,UAAA;CACO,CAAA,IAEV,oBAAC,OAAO,QAAR;EACE,MAAK;EACK;EACV,gBAAc,WAAW,SAAS,KAAA;EAClC,iBAAe;EACf,cAAY,MAAM,YAAY,YAAY,KAAA;EAC1C,OAAO,MAAM,YAAY,YAAY,KAAA;EACrC,SAAS;EACT,UAAU,QAAQ,UAAU,WAAW,KAAA,IAAY,EAAE,OAAO,IAAK;EACjE,YAAY;EACZ,WAAW;EAEV,UAAA;CACY,CAAA;AAEnB"}
@@ -1 +1 @@
1
- {"version":3,"file":"attachment-upload.d.ts","names":[],"sources":["../../../src/components/motion/attachment-upload.tsx"],"mappings":";KAyBY;KACA;KACA;KAEA;EACV;EACA;EACA,MAAM;EACN;EACA;EACA;EACA;EACA;EACA,SAAS;EACT;EACA,OAAO;;KAGG;EACV;EACA;EACA;;UAGe;EACf,QAAQ;EACR,eAAe;EACf,iBAAiB,OAAO;EACxB,gBAAgB,OAAO,wBAAwB,OAAO;EACtD,mBAAmB,OAAO,QAAQ,QAAQ;EAC1C,YAAY,MAAM;EAClB,WAAW,MAAM;EACjB;EACA,iBAAiB,MAAM;EACvB;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,aAAa;;iBA4jBC,mBACd,OACA,cACA,eACA,cACA,iBACA,UACA,SACA,WACA,eACA,QACA,UACA,UACA,aACA,UACA,OACA,aACA,kBACA,WACA,cACC,wCAAqB,IAAA"}
1
+ {"version":3,"file":"attachment-upload.d.ts","names":[],"sources":["../../../src/components/motion/attachment-upload.tsx"],"mappings":";KA0BY;KACA;KACA;KAEA;EACV;EACA;EACA,MAAM;EACN;EACA;EACA;EACA;EACA;EACA,SAAS;EACT;EACA,OAAO;;KAGG;EACV;EACA;EACA;;UAGe;EACf,QAAQ;EACR,eAAe;EACf,iBAAiB,OAAO;EACxB,gBAAgB,OAAO,wBAAwB,OAAO;EACtD,mBAAmB,OAAO,QAAQ,QAAQ;EAC1C,YAAY,MAAM;EAClB,WAAW,MAAM;EACjB;EACA,iBAAiB,MAAM;EACvB;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,aAAa;;iBAskBC,mBACd,OACA,cACA,eACA,cACA,iBACA,UACA,SACA,WACA,eACA,QACA,UACA,UACA,aACA,UACA,OACA,aACA,kBACA,WACA,cACC,wCAAqB,IAAA"}
@@ -1,5 +1,6 @@
1
1
  "use client";
2
2
  import { EASE_OUT, SPRING_LAYOUT, SPRING_PRESS } from "../../lib/ease.js";
3
+ import { t as PresenceGate } from "../../presence-gate-BekdC4Bo.js";
3
4
  import { Tooltip } from "./tooltip.js";
4
5
  import { useCallback, useEffect, useId, useRef, useState } from "react";
5
6
  import { cn } from "@kumix/utils";
@@ -246,13 +247,14 @@ function ImagePreviewDialog({ item, layoutId, onClose, reduce }) {
246
247
  }, [item, onClose]);
247
248
  if (typeof document === "undefined") return null;
248
249
  const src = item ? imageSource(item) : void 0;
249
- const content = item && src ? /* @__PURE__ */ jsxs("div", {
250
- className: "pointer-events-none fixed inset-0 z-10000",
250
+ const content = item && src ? /* @__PURE__ */ jsx(PresenceGate, { children: ({ isPresent, gate }) => /* @__PURE__ */ jsxs("div", {
251
+ inert: !isPresent,
252
+ className: "pointer-events-none fixed top-0 left-0 z-10000 size-0",
251
253
  children: [/* @__PURE__ */ jsx(motion.button, {
252
254
  type: "button",
253
255
  "aria-label": "Close image preview",
254
256
  tabIndex: -1,
255
- className: "pointer-events-auto absolute inset-0 size-full cursor-default bg-black/45 backdrop-blur-xl",
257
+ className: "pointer-events-auto fixed inset-0 size-full cursor-default bg-black/45 backdrop-blur-xl",
256
258
  initial: { opacity: 0 },
257
259
  animate: { opacity: 1 },
258
260
  exit: reduce ? void 0 : { opacity: 0 },
@@ -260,9 +262,10 @@ function ImagePreviewDialog({ item, layoutId, onClose, reduce }) {
260
262
  duration: reduce ? .1 : .2,
261
263
  ease: EASE_OUT
262
264
  },
265
+ ...gate,
263
266
  onClick: onClose
264
267
  }), /* @__PURE__ */ jsx("div", {
265
- className: "absolute inset-0 flex items-center justify-center p-4 sm:p-8",
268
+ className: "fixed inset-4 flex items-center justify-center sm:inset-8",
266
269
  children: /* @__PURE__ */ jsxs(motion.div, {
267
270
  role: "dialog",
268
271
  "aria-modal": "true",
@@ -271,6 +274,7 @@ function ImagePreviewDialog({ item, layoutId, onClose, reduce }) {
271
274
  animate: { opacity: 1 },
272
275
  exit: reduce ? void 0 : { opacity: 0 },
273
276
  transition: ITEM_TRANSITION,
277
+ ...gate,
274
278
  className: "pointer-events-auto relative",
275
279
  children: [/* @__PURE__ */ jsx(motion.img, {
276
280
  layoutId: reduce ? void 0 : layoutId,
@@ -302,7 +306,7 @@ function ImagePreviewDialog({ item, layoutId, onClose, reduce }) {
302
306
  })]
303
307
  })
304
308
  })]
305
- }) : null;
309
+ }) }) : null;
306
310
  return createPortal(reduce ? content : /* @__PURE__ */ jsx(AnimatePresence, { children: content }), document.body);
307
311
  }
308
312
  function AttachmentRow({ item, playing, uploading, uploadComplete, failed, removing, arrivalIndex, imageLayoutId, onAudioToggle, onImagePreview, onRemove, onRetry, reduce, className }) {