@kumix/ui 0.2.4 → 0.3.0

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 (358) hide show
  1. package/README.md +32 -10
  2. package/dist/components/motion/action-swap-blur.d.ts +11 -0
  3. package/dist/components/motion/action-swap-blur.d.ts.map +1 -0
  4. package/dist/components/motion/action-swap-blur.js +26 -0
  5. package/dist/components/motion/action-swap-blur.js.map +1 -0
  6. package/dist/components/motion/action-swap-cascade.d.ts +11 -0
  7. package/dist/components/motion/action-swap-cascade.d.ts.map +1 -0
  8. package/dist/components/motion/action-swap-cascade.js +26 -0
  9. package/dist/components/motion/action-swap-cascade.js.map +1 -0
  10. package/dist/components/motion/action-swap-roll.d.ts +11 -0
  11. package/dist/components/motion/action-swap-roll.d.ts.map +1 -0
  12. package/dist/components/motion/action-swap-roll.js +26 -0
  13. package/dist/components/motion/action-swap-roll.js.map +1 -0
  14. package/dist/components/motion/action-swap.d.ts +41 -0
  15. package/dist/components/motion/action-swap.d.ts.map +1 -0
  16. package/dist/components/motion/action-swap.js +261 -0
  17. package/dist/components/motion/action-swap.js.map +1 -0
  18. package/dist/components/motion/animated-badge.d.ts +18 -0
  19. package/dist/components/motion/animated-badge.d.ts.map +1 -0
  20. package/dist/components/motion/animated-badge.js +206 -0
  21. package/dist/components/motion/animated-badge.js.map +1 -0
  22. package/dist/components/motion/animated-number.d.ts +12 -0
  23. package/dist/components/motion/animated-number.d.ts.map +1 -0
  24. package/dist/components/motion/animated-number.js +47 -0
  25. package/dist/components/motion/animated-number.js.map +1 -0
  26. package/dist/components/motion/animated-sidebar.d.ts +97 -0
  27. package/dist/components/motion/animated-sidebar.d.ts.map +1 -0
  28. package/dist/components/motion/animated-sidebar.js +611 -0
  29. package/dist/components/motion/animated-sidebar.js.map +1 -0
  30. package/dist/components/motion/animated-toast-stack.d.ts +65 -0
  31. package/dist/components/motion/animated-toast-stack.d.ts.map +1 -0
  32. package/dist/components/motion/animated-toast-stack.js +303 -0
  33. package/dist/components/motion/animated-toast-stack.js.map +1 -0
  34. package/dist/components/motion/bottom-sheet.d.ts +19 -0
  35. package/dist/components/motion/bottom-sheet.d.ts.map +1 -0
  36. package/dist/components/motion/bottom-sheet.js +146 -0
  37. package/dist/components/motion/bottom-sheet.js.map +1 -0
  38. package/dist/components/motion/bounce-sidebar.d.ts +26 -0
  39. package/dist/components/motion/bounce-sidebar.d.ts.map +1 -0
  40. package/dist/components/motion/bounce-sidebar.js +164 -0
  41. package/dist/components/motion/bounce-sidebar.js.map +1 -0
  42. package/dist/components/motion/bouncy-accordion.d.ts +32 -0
  43. package/dist/components/motion/bouncy-accordion.d.ts.map +1 -0
  44. package/dist/components/motion/bouncy-accordion.js +172 -0
  45. package/dist/components/motion/bouncy-accordion.js.map +1 -0
  46. package/dist/components/motion/button/base.d.ts +17 -0
  47. package/dist/components/motion/button/base.d.ts.map +1 -0
  48. package/dist/components/motion/button/base.js +86 -0
  49. package/dist/components/motion/button/base.js.map +1 -0
  50. package/dist/components/motion/button/magnetic.d.ts +12 -0
  51. package/dist/components/motion/button/magnetic.d.ts.map +1 -0
  52. package/dist/components/motion/button/magnetic.js +21 -0
  53. package/dist/components/motion/button/magnetic.js.map +1 -0
  54. package/dist/components/motion/button/stateful.d.ts +16 -0
  55. package/dist/components/motion/button/stateful.d.ts.map +1 -0
  56. package/dist/components/motion/button/stateful.js +190 -0
  57. package/dist/components/motion/button/stateful.js.map +1 -0
  58. package/dist/components/motion/center-morph-modal.d.ts +43 -0
  59. package/dist/components/motion/center-morph-modal.d.ts.map +1 -0
  60. package/dist/components/motion/center-morph-modal.js +238 -0
  61. package/dist/components/motion/center-morph-modal.js.map +1 -0
  62. package/dist/components/motion/checkbox.d.ts +15 -0
  63. package/dist/components/motion/checkbox.d.ts.map +1 -0
  64. package/dist/components/motion/checkbox.js +81 -0
  65. package/dist/components/motion/checkbox.js.map +1 -0
  66. package/dist/components/motion/chromatic-text-reveal.d.ts +31 -0
  67. package/dist/components/motion/chromatic-text-reveal.d.ts.map +1 -0
  68. package/dist/components/motion/chromatic-text-reveal.js +132 -0
  69. package/dist/components/motion/chromatic-text-reveal.js.map +1 -0
  70. package/dist/components/motion/context-menu.d.ts +71 -0
  71. package/dist/components/motion/context-menu.d.ts.map +1 -0
  72. package/dist/components/motion/context-menu.js +454 -0
  73. package/dist/components/motion/context-menu.js.map +1 -0
  74. package/dist/components/motion/cylinder-carousel.d.ts +40 -0
  75. package/dist/components/motion/cylinder-carousel.d.ts.map +1 -0
  76. package/dist/components/motion/cylinder-carousel.js +274 -0
  77. package/dist/components/motion/cylinder-carousel.js.map +1 -0
  78. package/dist/components/motion/dock.d.ts +24 -0
  79. package/dist/components/motion/dock.d.ts.map +1 -0
  80. package/dist/components/motion/dock.js +62 -0
  81. package/dist/components/motion/dock.js.map +1 -0
  82. package/dist/components/motion/drawer.d.ts +19 -0
  83. package/dist/components/motion/drawer.d.ts.map +1 -0
  84. package/dist/components/motion/drawer.js +58 -0
  85. package/dist/components/motion/drawer.js.map +1 -0
  86. package/dist/components/motion/hold-action-button.d.ts +17 -0
  87. package/dist/components/motion/hold-action-button.d.ts.map +1 -0
  88. package/dist/components/motion/hold-action-button.js +158 -0
  89. package/dist/components/motion/hold-action-button.js.map +1 -0
  90. package/dist/components/motion/input.d.ts +29 -0
  91. package/dist/components/motion/input.d.ts.map +1 -0
  92. package/dist/components/motion/input.js +126 -0
  93. package/dist/components/motion/input.js.map +1 -0
  94. package/dist/components/motion/loader.d.ts +17 -0
  95. package/dist/components/motion/loader.d.ts.map +1 -0
  96. package/dist/components/motion/loader.js +791 -0
  97. package/dist/components/motion/loader.js.map +1 -0
  98. package/dist/components/motion/magnetic.d.ts +11 -0
  99. package/dist/components/motion/magnetic.d.ts.map +1 -0
  100. package/dist/components/motion/magnetic.js +44 -0
  101. package/dist/components/motion/magnetic.js.map +1 -0
  102. package/dist/components/motion/marquee.d.ts +15 -0
  103. package/dist/components/motion/marquee.d.ts.map +1 -0
  104. package/dist/components/motion/marquee.js +35 -0
  105. package/dist/components/motion/marquee.js.map +1 -0
  106. package/dist/components/motion/morphing-modal.d.ts +15 -0
  107. package/dist/components/motion/morphing-modal.d.ts.map +1 -0
  108. package/dist/components/motion/morphing-modal.js +117 -0
  109. package/dist/components/motion/morphing-modal.js.map +1 -0
  110. package/dist/components/motion/number-ticker.d.ts +26 -0
  111. package/dist/components/motion/number-ticker.d.ts.map +1 -0
  112. package/dist/components/motion/number-ticker.js +129 -0
  113. package/dist/components/motion/number-ticker.js.map +1 -0
  114. package/dist/components/motion/parallax.d.ts +21 -0
  115. package/dist/components/motion/parallax.d.ts.map +1 -0
  116. package/dist/components/motion/parallax.js +35 -0
  117. package/dist/components/motion/parallax.js.map +1 -0
  118. package/dist/components/motion/popover-morph.d.ts +38 -0
  119. package/dist/components/motion/popover-morph.d.ts.map +1 -0
  120. package/dist/components/motion/popover-morph.js +167 -0
  121. package/dist/components/motion/popover-morph.js.map +1 -0
  122. package/dist/components/motion/popover.d.ts +40 -0
  123. package/dist/components/motion/popover.d.ts.map +1 -0
  124. package/dist/components/motion/popover.js +393 -0
  125. package/dist/components/motion/popover.js.map +1 -0
  126. package/dist/components/motion/preview-rail.d.ts +26 -0
  127. package/dist/components/motion/preview-rail.d.ts.map +1 -0
  128. package/dist/components/motion/preview-rail.js +134 -0
  129. package/dist/components/motion/preview-rail.js.map +1 -0
  130. package/dist/components/motion/pull-to-refresh.d.ts +28 -0
  131. package/dist/components/motion/pull-to-refresh.d.ts.map +1 -0
  132. package/dist/components/motion/pull-to-refresh.js +389 -0
  133. package/dist/components/motion/pull-to-refresh.js.map +1 -0
  134. package/dist/components/motion/radio.d.ts +22 -0
  135. package/dist/components/motion/radio.d.ts.map +1 -0
  136. package/dist/components/motion/radio.js +79 -0
  137. package/dist/components/motion/radio.js.map +1 -0
  138. package/dist/components/motion/range-slider-bubble.d.ts +16 -0
  139. package/dist/components/motion/range-slider-bubble.d.ts.map +1 -0
  140. package/dist/components/motion/range-slider-bubble.js +117 -0
  141. package/dist/components/motion/range-slider-bubble.js.map +1 -0
  142. package/dist/components/motion/range-slider-fluid.d.ts +18 -0
  143. package/dist/components/motion/range-slider-fluid.d.ts.map +1 -0
  144. package/dist/components/motion/range-slider-fluid.js +63 -0
  145. package/dist/components/motion/range-slider-fluid.js.map +1 -0
  146. package/dist/components/motion/range-slider-ruler.d.ts +19 -0
  147. package/dist/components/motion/range-slider-ruler.d.ts.map +1 -0
  148. package/dist/components/motion/range-slider-ruler.js +142 -0
  149. package/dist/components/motion/range-slider-ruler.js.map +1 -0
  150. package/dist/components/motion/range-slider-wave.d.ts +16 -0
  151. package/dist/components/motion/range-slider-wave.d.ts.map +1 -0
  152. package/dist/components/motion/range-slider-wave.js +57 -0
  153. package/dist/components/motion/range-slider-wave.js.map +1 -0
  154. package/dist/components/motion/range-slider.d.ts +11 -0
  155. package/dist/components/motion/range-slider.d.ts.map +1 -0
  156. package/dist/components/motion/range-slider.js +63 -0
  157. package/dist/components/motion/range-slider.js.map +1 -0
  158. package/dist/components/motion/scroll-progress.d.ts +29 -0
  159. package/dist/components/motion/scroll-progress.d.ts.map +1 -0
  160. package/dist/components/motion/scroll-progress.js +71 -0
  161. package/dist/components/motion/scroll-progress.js.map +1 -0
  162. package/dist/components/motion/scroll-reveal.d.ts +23 -0
  163. package/dist/components/motion/scroll-reveal.d.ts.map +1 -0
  164. package/dist/components/motion/scroll-reveal.js +42 -0
  165. package/dist/components/motion/scroll-reveal.js.map +1 -0
  166. package/dist/components/motion/scroll-to.d.ts +21 -0
  167. package/dist/components/motion/scroll-to.d.ts.map +1 -0
  168. package/dist/components/motion/scroll-to.js +27 -0
  169. package/dist/components/motion/scroll-to.js.map +1 -0
  170. package/dist/components/motion/select-morph.d.ts +41 -0
  171. package/dist/components/motion/select-morph.d.ts.map +1 -0
  172. package/dist/components/motion/select-morph.js +251 -0
  173. package/dist/components/motion/select-morph.js.map +1 -0
  174. package/dist/components/motion/select.d.ts +36 -0
  175. package/dist/components/motion/select.d.ts.map +1 -0
  176. package/dist/components/motion/select.js +319 -0
  177. package/dist/components/motion/select.js.map +1 -0
  178. package/dist/components/motion/shader-background.d.ts +38 -0
  179. package/dist/components/motion/shader-background.d.ts.map +1 -0
  180. package/dist/components/motion/shader-background.js +49 -0
  181. package/dist/components/motion/shader-background.js.map +1 -0
  182. package/dist/components/motion/shared-layout-bg.d.ts +17 -0
  183. package/dist/components/motion/shared-layout-bg.d.ts.map +1 -0
  184. package/dist/components/motion/shared-layout-bg.js +88 -0
  185. package/dist/components/motion/shared-layout-bg.js.map +1 -0
  186. package/dist/components/motion/slide-action-button.d.ts +15 -0
  187. package/dist/components/motion/slide-action-button.d.ts.map +1 -0
  188. package/dist/components/motion/slide-action-button.js +146 -0
  189. package/dist/components/motion/slide-action-button.js.map +1 -0
  190. package/dist/components/motion/smooth-scroll.d.ts +47 -0
  191. package/dist/components/motion/smooth-scroll.d.ts.map +1 -0
  192. package/dist/components/motion/smooth-scroll.js +182 -0
  193. package/dist/components/motion/smooth-scroll.js.map +1 -0
  194. package/dist/components/motion/switch.d.ts +13 -0
  195. package/dist/components/motion/switch.d.ts.map +1 -0
  196. package/dist/components/motion/switch.js +76 -0
  197. package/dist/components/motion/switch.js.map +1 -0
  198. package/dist/components/motion/table/editable-cell.d.ts +9 -0
  199. package/dist/components/motion/table/editable-cell.d.ts.map +1 -0
  200. package/dist/components/motion/table/editable-cell.js +17 -0
  201. package/dist/components/motion/table/editable-cell.js.map +1 -0
  202. package/dist/components/motion/table/index.d.ts +6 -0
  203. package/dist/components/motion/table/index.d.ts.map +1 -0
  204. package/dist/components/motion/table/index.js +420 -0
  205. package/dist/components/motion/table/index.js.map +1 -0
  206. package/dist/components/motion/table/row-handle.d.ts +15 -0
  207. package/dist/components/motion/table/row-handle.d.ts.map +1 -0
  208. package/dist/components/motion/table/row-handle.js +51 -0
  209. package/dist/components/motion/table/row-handle.js.map +1 -0
  210. package/dist/components/motion/table/skeleton-rows.d.ts +11 -0
  211. package/dist/components/motion/table/skeleton-rows.d.ts.map +1 -0
  212. package/dist/components/motion/table/skeleton-rows.js +23 -0
  213. package/dist/components/motion/table/skeleton-rows.js.map +1 -0
  214. package/dist/components/motion/table/table-header.d.ts +35 -0
  215. package/dist/components/motion/table/table-header.d.ts.map +1 -0
  216. package/dist/components/motion/table/table-header.js +167 -0
  217. package/dist/components/motion/table/table-header.js.map +1 -0
  218. package/dist/components/motion/table/table-menu.d.ts +17 -0
  219. package/dist/components/motion/table/table-menu.d.ts.map +1 -0
  220. package/dist/components/motion/table/table-menu.js +92 -0
  221. package/dist/components/motion/table/table-menu.js.map +1 -0
  222. package/dist/components/motion/tabs.d.ts +29 -0
  223. package/dist/components/motion/tabs.d.ts.map +1 -0
  224. package/dist/components/motion/tabs.js +125 -0
  225. package/dist/components/motion/tabs.js.map +1 -0
  226. package/dist/components/motion/text-cascade.d.ts +15 -0
  227. package/dist/components/motion/text-cascade.d.ts.map +1 -0
  228. package/dist/components/motion/text-cascade.js +21 -0
  229. package/dist/components/motion/text-cascade.js.map +1 -0
  230. package/dist/components/motion/text-reveal.d.ts +25 -0
  231. package/dist/components/motion/text-reveal.d.ts.map +1 -0
  232. package/dist/components/motion/text-reveal.js +94 -0
  233. package/dist/components/motion/text-reveal.js.map +1 -0
  234. package/dist/components/motion/text-shimmer.d.ts +12 -0
  235. package/dist/components/motion/text-shimmer.d.ts.map +1 -0
  236. package/dist/components/motion/text-shimmer.js +15 -0
  237. package/dist/components/motion/text-shimmer.js.map +1 -0
  238. package/dist/components/motion/theme-toggle.d.ts +23 -0
  239. package/dist/components/motion/theme-toggle.d.ts.map +1 -0
  240. package/dist/components/motion/theme-toggle.js +160 -0
  241. package/dist/components/motion/theme-toggle.js.map +1 -0
  242. package/dist/components/motion/tilt-card.d.ts +12 -0
  243. package/dist/components/motion/tilt-card.d.ts.map +1 -0
  244. package/dist/components/motion/tilt-card.js +56 -0
  245. package/dist/components/motion/tilt-card.js.map +1 -0
  246. package/dist/components/motion/tooltip.d.ts +17 -0
  247. package/dist/components/motion/tooltip.d.ts.map +1 -0
  248. package/dist/components/motion/tooltip.js +194 -0
  249. package/dist/components/motion/tooltip.js.map +1 -0
  250. package/dist/components/motion/wheel-picker.d.ts +24 -0
  251. package/dist/components/motion/wheel-picker.d.ts.map +1 -0
  252. package/dist/components/motion/wheel-picker.js +442 -0
  253. package/dist/components/motion/wheel-picker.js.map +1 -0
  254. package/dist/components/reui/alert.d.ts +1 -1
  255. package/dist/components/reui/alert.js +1 -1
  256. package/dist/components/reui/autocomplete.js +2 -2
  257. package/dist/components/reui/badge.d.ts +2 -2
  258. package/dist/components/reui/badge.js +10 -9
  259. package/dist/components/reui/badge.js.map +1 -1
  260. package/dist/components/reui/data-grid/data-grid-table-dnd.js +21 -19
  261. package/dist/components/reui/data-grid/data-grid-table-dnd.js.map +1 -1
  262. package/dist/components/reui/data-grid/data-grid-table-virtual.d.ts +1 -1
  263. package/dist/components/reui/data-grid/data-grid-table-virtual.js +1 -1
  264. package/dist/components/reui/data-grid/data-grid-table.js +4 -2
  265. package/dist/components/reui/data-grid/data-grid-table.js.map +1 -1
  266. package/dist/components/reui/event-calendar/event-calendar-agenda-view.js +2 -1
  267. package/dist/components/reui/event-calendar/event-calendar-agenda-view.js.map +1 -1
  268. package/dist/components/reui/event-calendar/event-calendar-content.js +8 -7
  269. package/dist/components/reui/event-calendar/event-calendar-content.js.map +1 -1
  270. package/dist/components/reui/event-calendar/event-calendar-dnd.js +7 -4
  271. package/dist/components/reui/event-calendar/event-calendar-dnd.js.map +1 -1
  272. package/dist/components/reui/event-calendar/event-calendar-event.js +49 -47
  273. package/dist/components/reui/event-calendar/event-calendar-event.js.map +1 -1
  274. package/dist/components/reui/event-calendar/event-calendar-lib.js +3 -2
  275. package/dist/components/reui/event-calendar/event-calendar-lib.js.map +1 -1
  276. package/dist/components/reui/event-calendar/event-calendar-nav.js +37 -31
  277. package/dist/components/reui/event-calendar/event-calendar-nav.js.map +1 -1
  278. package/dist/components/reui/event-calendar/event-calendar-time-grid.js +2 -1
  279. package/dist/components/reui/event-calendar/event-calendar-time-grid.js.map +1 -1
  280. package/dist/components/reui/event-calendar/event-calendar.js +2 -1
  281. package/dist/components/reui/event-calendar/event-calendar.js.map +1 -1
  282. package/dist/components/reui/filters.js +5 -3
  283. package/dist/components/reui/filters.js.map +1 -1
  284. package/dist/components/reui/frame.d.ts +2 -2
  285. package/dist/components/reui/frame.js +1 -1
  286. package/dist/components/reui/gantt/gantt-bar.js +52 -51
  287. package/dist/components/reui/gantt/gantt-bar.js.map +1 -1
  288. package/dist/components/reui/gantt/gantt-lib.js +3 -2
  289. package/dist/components/reui/gantt/gantt-lib.js.map +1 -1
  290. package/dist/components/reui/gantt/gantt-nav.js +34 -30
  291. package/dist/components/reui/gantt/gantt-nav.js.map +1 -1
  292. package/dist/components/reui/gantt/gantt-recurrence.js +2 -2
  293. package/dist/components/reui/gantt/gantt-recurrence.js.map +1 -1
  294. package/dist/components/reui/gantt/gantt-view.js +175 -171
  295. package/dist/components/reui/gantt/gantt-view.js.map +1 -1
  296. package/dist/components/reui/icon-tile.d.ts +1 -1
  297. package/dist/components/reui/icon-tile.js +12 -11
  298. package/dist/components/reui/icon-tile.js.map +1 -1
  299. package/dist/components/reui/kanban.js +42 -37
  300. package/dist/components/reui/kanban.js.map +1 -1
  301. package/dist/components/reui/number-field.js +1 -1
  302. package/dist/components/reui/rating.js +1 -1
  303. package/dist/components/reui/sortable.js +10 -9
  304. package/dist/components/reui/sortable.js.map +1 -1
  305. package/dist/components/reui/stepper.js +16 -16
  306. package/dist/components/reui/stepper.js.map +1 -1
  307. package/dist/components/reui/timeline.js +45 -38
  308. package/dist/components/reui/timeline.js.map +1 -1
  309. package/dist/components/reui/tree.js +2 -1
  310. package/dist/components/reui/tree.js.map +1 -1
  311. package/dist/components/ui/alert.js +1 -1
  312. package/dist/components/ui/attachment.d.ts +1 -1
  313. package/dist/components/ui/attachment.js +1 -1
  314. package/dist/components/ui/badge.d.ts +1 -1
  315. package/dist/components/ui/bubble.d.ts +1 -1
  316. package/dist/components/ui/bubble.js +1 -1
  317. package/dist/components/ui/button-group.js +1 -1
  318. package/dist/components/ui/button.d.ts +2 -2
  319. package/dist/components/ui/button.js +1 -1
  320. package/dist/components/ui/empty.d.ts +1 -1
  321. package/dist/components/ui/empty.js +1 -1
  322. package/dist/components/ui/field.js +1 -1
  323. package/dist/components/ui/input-group.js +1 -1
  324. package/dist/components/ui/item.d.ts +2 -2
  325. package/dist/components/ui/item.js +1 -1
  326. package/dist/components/ui/marker.js +1 -1
  327. package/dist/components/ui/navigation-menu.js +1 -1
  328. package/dist/components/ui/sidebar.d.ts +1 -1
  329. package/dist/components/ui/sidebar.js +2 -2
  330. package/dist/components/ui/sidebar.js.map +1 -1
  331. package/dist/components/ui/tabs.js +1 -1
  332. package/dist/components/ui/toggle.d.ts +1 -1
  333. package/dist/components/ui/toggle.js +1 -1
  334. package/dist/hooks/use-hover-capable.d.ts +10 -0
  335. package/dist/hooks/use-hover-capable.d.ts.map +1 -0
  336. package/dist/hooks/use-hover-capable.js +24 -0
  337. package/dist/hooks/use-hover-capable.js.map +1 -0
  338. package/dist/hooks/use-mobile.js +1 -1
  339. package/dist/hooks/use-mobile.js.map +1 -1
  340. package/dist/hooks/use-slider.d.ts +58 -0
  341. package/dist/hooks/use-slider.d.ts.map +1 -0
  342. package/dist/hooks/use-slider.js +133 -0
  343. package/dist/hooks/use-slider.js.map +1 -0
  344. package/dist/lib/ease.d.ts +50 -0
  345. package/dist/lib/ease.d.ts.map +1 -0
  346. package/dist/lib/ease.js +66 -0
  347. package/dist/lib/ease.js.map +1 -0
  348. package/dist/lib/tick-sound.d.ts +17 -0
  349. package/dist/lib/tick-sound.d.ts.map +1 -0
  350. package/dist/lib/tick-sound.js +120 -0
  351. package/dist/lib/tick-sound.js.map +1 -0
  352. package/dist/popover-position-BUqYCq8X.js +54 -0
  353. package/dist/popover-position-BUqYCq8X.js.map +1 -0
  354. package/dist/types-Bah5NY44.d.ts +81 -0
  355. package/dist/types-Bah5NY44.d.ts.map +1 -0
  356. package/dist/utils-DQ7OpbYQ.js +25 -0
  357. package/dist/utils-DQ7OpbYQ.js.map +1 -0
  358. package/package.json +17 -6
@@ -0,0 +1,94 @@
1
+ "use client";
2
+ import { EASE_OUT } from "../../lib/ease.js";
3
+ import { useRef } from "react";
4
+ import { cn } from "@kumix/utils";
5
+ import { motion, useInView, useReducedMotion } from "motion/react";
6
+ import { jsx, jsxs } from "react/jsx-runtime";
7
+ //#region src/components/motion/text-reveal.tsx
8
+ const DEFAULT_SPRING = {
9
+ stiffness: 140,
10
+ damping: 26,
11
+ mass: 1.2
12
+ };
13
+ function TextReveal({ text, as: Comp = "span", className, split = "word", stagger = .09, delay = 0, blur = 12, yOffset = "40%", spring, once = true, whileInView = false, children }) {
14
+ const ref = useRef(null);
15
+ const inView = useInView(ref, {
16
+ once,
17
+ amount: .4
18
+ });
19
+ const reduce = useReducedMotion();
20
+ const shouldAnimate = whileInView ? inView : true;
21
+ const lines = Array.isArray(text) ? text : [text];
22
+ const s = {
23
+ ...DEFAULT_SPRING,
24
+ ...spring
25
+ };
26
+ let unitIndex = 0;
27
+ const lineCounts = /* @__PURE__ */ new Map();
28
+ return /* @__PURE__ */ jsxs(Comp, {
29
+ ref,
30
+ className: cn("block", className),
31
+ children: [lines.map((line) => {
32
+ const units = split === "word" ? line.split(" ") : Array.from(line);
33
+ const lineCount = lineCounts.get(line) ?? 0;
34
+ lineCounts.set(line, lineCount + 1);
35
+ const lineKey = `${line}-${lineCount}`;
36
+ const unitCounts = /* @__PURE__ */ new Map();
37
+ return /* @__PURE__ */ jsx("span", {
38
+ className: "block",
39
+ children: units.map((unit, i) => {
40
+ const d = delay + unitIndex * stagger;
41
+ unitIndex += 1;
42
+ const unitCount = unitCounts.get(unit) ?? 0;
43
+ unitCounts.set(unit, unitCount + 1);
44
+ const unitKey = `${unit}-${unitCount}`;
45
+ const initial = reduce ? { opacity: 0 } : {
46
+ y: yOffset,
47
+ opacity: 0,
48
+ filter: `blur(${blur}px)`
49
+ };
50
+ const animate = shouldAnimate ? reduce ? { opacity: 1 } : {
51
+ y: 0,
52
+ opacity: 1,
53
+ filter: "blur(0px)"
54
+ } : initial;
55
+ const transition = reduce ? { opacity: {
56
+ duration: .25,
57
+ ease: EASE_OUT,
58
+ delay: d * .3
59
+ } } : {
60
+ y: {
61
+ type: "spring",
62
+ ...s,
63
+ delay: d
64
+ },
65
+ opacity: {
66
+ duration: .7,
67
+ ease: EASE_OUT,
68
+ delay: d
69
+ },
70
+ filter: {
71
+ duration: .9,
72
+ ease: EASE_OUT,
73
+ delay: d
74
+ }
75
+ };
76
+ return /* @__PURE__ */ jsxs(motion.span, {
77
+ initial,
78
+ animate,
79
+ transition,
80
+ className: "inline-block will-change-transform",
81
+ children: [unit, split === "word" && i < units.length - 1 ? /* @__PURE__ */ jsx("span", {
82
+ className: "inline-block",
83
+ children: "\xA0"
84
+ }) : null]
85
+ }, unitKey);
86
+ })
87
+ }, lineKey);
88
+ }), children]
89
+ });
90
+ }
91
+ //#endregion
92
+ export { TextReveal };
93
+
94
+ //# sourceMappingURL=text-reveal.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"text-reveal.js","names":[],"sources":["../../../src/components/motion/text-reveal.tsx"],"sourcesContent":["\"use client\";\n\nimport { type ElementType, type ReactNode, useRef } from \"react\";\nimport { motion, type Transition, useInView, useReducedMotion } from \"motion/react\";\n\nimport { cn } from \"@kumix/utils\";\nimport { EASE_OUT } from \"../../lib/ease\";\n\ntype SplitMode = \"word\" | \"char\";\n\nexport interface TextRevealProps {\n text: string | string[];\n as?: ElementType;\n className?: string;\n split?: SplitMode;\n stagger?: number;\n delay?: number;\n blur?: number;\n yOffset?: string | number;\n spring?: { stiffness?: number; damping?: number; mass?: number };\n once?: boolean;\n whileInView?: boolean;\n children?: ReactNode;\n}\n\nconst DEFAULT_SPRING = { stiffness: 140, damping: 26, mass: 1.2 };\n\nexport function TextReveal({\n text,\n as: Comp = \"span\",\n className,\n split = \"word\",\n stagger = 0.09,\n delay = 0,\n blur = 12,\n yOffset = \"40%\",\n spring,\n once = true,\n whileInView = false,\n children,\n}: TextRevealProps) {\n const ref = useRef<HTMLElement>(null);\n const inView = useInView(ref, { once, amount: 0.4 });\n const reduce = useReducedMotion();\n const shouldAnimate = whileInView ? inView : true;\n\n const lines = Array.isArray(text) ? text : [text];\n const s = { ...DEFAULT_SPRING, ...spring };\n\n let unitIndex = 0;\n const lineCounts = new Map<string, number>();\n\n return (\n <Comp ref={ref} className={cn(\"block\", className)}>\n {lines.map((line) => {\n const units = split === \"word\" ? line.split(\" \") : Array.from(line);\n const lineCount = lineCounts.get(line) ?? 0;\n lineCounts.set(line, lineCount + 1);\n const lineKey = `${line}-${lineCount}`;\n const unitCounts = new Map<string, number>();\n\n return (\n <span key={lineKey} className=\"block\">\n {units.map((unit, i) => {\n const d = delay + unitIndex * stagger;\n unitIndex += 1;\n const unitCount = unitCounts.get(unit) ?? 0;\n unitCounts.set(unit, unitCount + 1);\n const unitKey = `${unit}-${unitCount}`;\n const initial = reduce\n ? { opacity: 0 }\n : { y: yOffset, opacity: 0, filter: `blur(${blur}px)` };\n const animate = shouldAnimate\n ? reduce\n ? { opacity: 1 }\n : { y: 0, opacity: 1, filter: \"blur(0px)\" }\n : initial;\n const transition: Transition = reduce\n ? { opacity: { duration: 0.25, ease: EASE_OUT, delay: d * 0.3 } }\n : {\n y: { type: \"spring\" as const, ...s, delay: d },\n opacity: { duration: 0.7, ease: EASE_OUT, delay: d },\n filter: { duration: 0.9, ease: EASE_OUT, delay: d },\n };\n return (\n <motion.span\n key={unitKey}\n initial={initial}\n animate={animate}\n transition={transition}\n className=\"inline-block will-change-transform\"\n >\n {unit}\n {split === \"word\" && i < units.length - 1 ? (\n <span className=\"inline-block\">&nbsp;</span>\n ) : null}\n </motion.span>\n );\n })}\n </span>\n );\n })}\n {children}\n </Comp>\n );\n}\n"],"mappings":";;;;;;;AAyBA,MAAM,iBAAiB;CAAE,WAAW;CAAK,SAAS;CAAI,MAAM;AAAI;AAEhE,SAAgB,WAAW,EACzB,MACA,IAAI,OAAO,QACX,WACA,QAAQ,QACR,UAAU,KACV,QAAQ,GACR,OAAO,IACP,UAAU,OACV,QACA,OAAO,MACP,cAAc,OACd,YACkB;CAClB,MAAM,MAAM,OAAoB,IAAI;CACpC,MAAM,SAAS,UAAU,KAAK;EAAE;EAAM,QAAQ;CAAI,CAAC;CACnD,MAAM,SAAS,iBAAiB;CAChC,MAAM,gBAAgB,cAAc,SAAS;CAE7C,MAAM,QAAQ,MAAM,QAAQ,IAAI,IAAI,OAAO,CAAC,IAAI;CAChD,MAAM,IAAI;EAAE,GAAG;EAAgB,GAAG;CAAO;CAEzC,IAAI,YAAY;CAChB,MAAM,6BAAa,IAAI,IAAoB;CAE3C,OACE,qBAAC,MAAD;EAAW;EAAK,WAAW,GAAG,SAAS,SAAS;EAAhD,UAAA,CACG,MAAM,KAAK,SAAS;GACnB,MAAM,QAAQ,UAAU,SAAS,KAAK,MAAM,GAAG,IAAI,MAAM,KAAK,IAAI;GAClE,MAAM,YAAY,WAAW,IAAI,IAAI,KAAK;GAC1C,WAAW,IAAI,MAAM,YAAY,CAAC;GAClC,MAAM,UAAU,GAAG,KAAK,GAAG;GAC3B,MAAM,6BAAa,IAAI,IAAoB;GAE3C,OACE,oBAAC,QAAD;IAAoB,WAAU;IAC3B,UAAA,MAAM,KAAK,MAAM,MAAM;KACtB,MAAM,IAAI,QAAQ,YAAY;KAC9B,aAAa;KACb,MAAM,YAAY,WAAW,IAAI,IAAI,KAAK;KAC1C,WAAW,IAAI,MAAM,YAAY,CAAC;KAClC,MAAM,UAAU,GAAG,KAAK,GAAG;KAC3B,MAAM,UAAU,SACZ,EAAE,SAAS,EAAE,IACb;MAAE,GAAG;MAAS,SAAS;MAAG,QAAQ,QAAQ,KAAK;KAAK;KACxD,MAAM,UAAU,gBACZ,SACE,EAAE,SAAS,EAAE,IACb;MAAE,GAAG;MAAG,SAAS;MAAG,QAAQ;KAAY,IAC1C;KACJ,MAAM,aAAyB,SAC3B,EAAE,SAAS;MAAE,UAAU;MAAM,MAAM;MAAU,OAAO,IAAI;KAAI,EAAE,IAC9D;MACE,GAAG;OAAE,MAAM;OAAmB,GAAG;OAAG,OAAO;MAAE;MAC7C,SAAS;OAAE,UAAU;OAAK,MAAM;OAAU,OAAO;MAAE;MACnD,QAAQ;OAAE,UAAU;OAAK,MAAM;OAAU,OAAO;MAAE;KACpD;KACJ,OACE,qBAAC,OAAO,MAAR;MAEW;MACA;MACG;MACZ,WAAU;MALZ,UAAA,CAOG,MACA,UAAU,UAAU,IAAI,MAAM,SAAS,IACtC,oBAAC,QAAD;OAAM,WAAU;OAAe,UAAA;MAAY,CAAA,IACzC,IACO;KAVN,GAAA,OAUM;IAEjB,CAAC;GACG,GArCK,OAqCL;EAEV,CAAC,GACA,QACG;;AAEV"}
@@ -0,0 +1,12 @@
1
+ import { ElementType, ReactNode } from "react";
2
+ //#region src/components/motion/text-shimmer.d.ts
3
+ interface TextShimmerProps {
4
+ children: ReactNode;
5
+ as?: ElementType;
6
+ duration?: number;
7
+ className?: string;
8
+ }
9
+ declare function TextShimmer({ children, as: Comp, duration, className }: TextShimmerProps): import("react").JSX.Element;
10
+ //#endregion
11
+ export { TextShimmer, TextShimmerProps };
12
+ //# sourceMappingURL=text-shimmer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"text-shimmer.d.ts","names":[],"sources":["../../../src/components/motion/text-shimmer.tsx"],"mappings":";;UAMiB;EACf,UAAU;EACV,KAAK;EACL;EACA;;iBAGc,cACd,UACA,IAAI,MACJ,UACA,aACC,mCAAgB,IAAA"}
@@ -0,0 +1,15 @@
1
+ "use client";
2
+ import { cn } from "@kumix/utils";
3
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
4
+ //#region src/components/motion/text-shimmer.tsx
5
+ function TextShimmer({ children, as: Comp = "span", duration = 2.5, className }) {
6
+ return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("style", { children: `@keyframes beui-text-shimmer{from{background-position:200% 0}to{background-position:-200% 0}}` }), /* @__PURE__ */ jsx(Comp, {
7
+ style: { animation: `beui-text-shimmer ${duration}s linear infinite` },
8
+ className: cn("inline-block bg-[length:200%_100%] bg-clip-text text-transparent", "bg-[linear-gradient(110deg,var(--muted-foreground)_30%,var(--foreground)_50%,var(--muted-foreground)_70%)]", className),
9
+ children
10
+ })] });
11
+ }
12
+ //#endregion
13
+ export { TextShimmer };
14
+
15
+ //# sourceMappingURL=text-shimmer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"text-shimmer.js","names":[],"sources":["../../../src/components/motion/text-shimmer.tsx"],"sourcesContent":["\"use client\";\n\nimport type { ElementType, ReactNode } from \"react\";\n\nimport { cn } from \"@kumix/utils\";\n\nexport interface TextShimmerProps {\n children: ReactNode;\n as?: ElementType;\n duration?: number;\n className?: string;\n}\n\nexport function TextShimmer({\n children,\n as: Comp = \"span\",\n duration = 2.5,\n className,\n}: TextShimmerProps) {\n return (\n <>\n <style>\n {`@keyframes beui-text-shimmer{from{background-position:200% 0}to{background-position:-200% 0}}`}\n </style>\n <Comp\n style={{ animation: `beui-text-shimmer ${duration}s linear infinite` }}\n className={cn(\n \"inline-block bg-[length:200%_100%] bg-clip-text text-transparent\",\n \"bg-[linear-gradient(110deg,var(--muted-foreground)_30%,var(--foreground)_50%,var(--muted-foreground)_70%)]\",\n className,\n )}\n >\n {children}\n </Comp>\n </>\n );\n}\n"],"mappings":";;;;AAaA,SAAgB,YAAY,EAC1B,UACA,IAAI,OAAO,QACX,WAAW,KACX,aACmB;CACnB,OACE,qBAAA,UAAA,EAAA,UAAA,CACE,oBAAC,SAAD,EAAA,UACG,gGACI,CAAA,GACP,oBAAC,MAAD;EACE,OAAO,EAAE,WAAW,qBAAqB,SAAS,mBAAmB;EACrE,WAAW,GACT,oEACA,8GACA,SACF;EAEC;CACG,CAAA,CACN,EAAA,CAAA;AAEN"}
@@ -0,0 +1,23 @@
1
+ import { ComponentPropsWithoutRef } from "react";
2
+ //#region src/components/motion/theme-toggle.d.ts
3
+ type ThemeVariant = "rectangle" | "circle" | "circle-blur" | "blinds";
4
+ type RectStart = "top-left" | "top-right" | "bottom-left" | "bottom-right" | "center" | "bottom-up";
5
+ interface ThemeToggleProps extends Omit<ComponentPropsWithoutRef<"button">, "children" | "onClick"> {
6
+ /** Animation variant. Default: "rectangle". */
7
+ variant?: ThemeVariant;
8
+ /** Origin direction for the reveal. Default: "bottom-up". */
9
+ start?: RectStart;
10
+ iconClassName?: string;
11
+ }
12
+ declare function useThemeToggle({ variant, start }?: {
13
+ variant?: ThemeVariant;
14
+ start?: RectStart;
15
+ }): {
16
+ isDark: boolean;
17
+ mounted: boolean;
18
+ toggle: () => void;
19
+ };
20
+ declare function ThemeToggle({ variant, start, className, iconClassName, ...rest }: ThemeToggleProps): import("react").JSX.Element;
21
+ //#endregion
22
+ export { RectStart, ThemeToggle, ThemeToggleProps, ThemeVariant, useThemeToggle };
23
+ //# sourceMappingURL=theme-toggle.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"theme-toggle.d.ts","names":[],"sources":["../../../src/components/motion/theme-toggle.tsx"],"mappings":";;KAWY;KAEA;UAQK,yBACP,KAAK;;EAEb,UAAU;;EAEV,QAAQ;EACR;;iBAiGc,iBACd,SACA;EAEA,UAAU;EACV,QAAQ;;;;;;iBAkDM,cACd,SACA,OACA,WACA,kBACG,QACF,mCAAgB,IAAA"}
@@ -0,0 +1,160 @@
1
+ "use client";
2
+ import { EASE_OUT_CSS } from "../../lib/ease.js";
3
+ import { ActionSwapIcon } from "./action-swap.js";
4
+ import { useEffect, useState } from "react";
5
+ import { cn } from "@kumix/utils";
6
+ import { useTheme } from "next-themes";
7
+ import { useReducedMotion } from "motion/react";
8
+ import { jsx } from "react/jsx-runtime";
9
+ import { Moon, Sun } from "lucide-react";
10
+ //#region src/components/motion/theme-toggle.tsx
11
+ const VT_STYLE_ID = "beui-theme-toggle-vt";
12
+ const VT_CSS = `
13
+ html[data-beui-vt="rect"]::view-transition-old(root) {
14
+ animation: none;
15
+ mix-blend-mode: normal;
16
+ }
17
+ html[data-beui-vt="rect"]::view-transition-new(root) {
18
+ mix-blend-mode: normal;
19
+ animation: beui-rect-reveal 400ms ease-out;
20
+ }
21
+ html[data-beui-vt="circle"]::view-transition-old(root),
22
+ html[data-beui-vt="circle-blur"]::view-transition-old(root) {
23
+ animation: none;
24
+ mix-blend-mode: normal;
25
+ }
26
+ html[data-beui-vt="circle"]::view-transition-new(root) {
27
+ mix-blend-mode: normal;
28
+ animation: beui-circle-reveal 700ms cubic-bezier(0.4, 0, 0.2, 1);
29
+ }
30
+ html[data-beui-vt="circle-blur"]::view-transition-new(root) {
31
+ mix-blend-mode: normal;
32
+ animation: beui-circle-blur-reveal 700ms cubic-bezier(0.4, 0, 0.2, 1);
33
+ }
34
+ html[data-beui-vt="blinds"]::view-transition-old(root) {
35
+ animation: none;
36
+ mix-blend-mode: normal;
37
+ }
38
+ /* Slats: a masked band widens inside every 72px tile, so the new theme opens
39
+ across the page like a shutter. The band edge has to be a registered custom
40
+ property — mask-image itself is not animatable, but it re-resolves every
41
+ frame the property ticks. mask-size fixes the tile at 72px rather than
42
+ letting a repeating gradient's last stop define it, which is what keeps the
43
+ 20px soft edge from dragging the tile wider than the slat and leaving a
44
+ feathered gap that never closes; it also means both ends land clean, fully
45
+ transparent at -20px and fully opaque at 72px. Falling back to no mask
46
+ (unregistered property, so the var is invalid) reveals the page in one
47
+ step. */
48
+ @property --beui-vt-slat {
49
+ syntax: "<length>";
50
+ inherits: false;
51
+ initial-value: 72px;
52
+ }
53
+ html[data-beui-vt="blinds"]::view-transition-new(root) {
54
+ mix-blend-mode: normal;
55
+ mask-image: linear-gradient(
56
+ 90deg,
57
+ #000 0 var(--beui-vt-slat),
58
+ transparent calc(var(--beui-vt-slat) + 20px)
59
+ );
60
+ mask-size: 72px 100%;
61
+ mask-repeat: repeat;
62
+ animation: beui-blinds-reveal 700ms ${EASE_OUT_CSS};
63
+ }
64
+ @keyframes beui-rect-reveal {
65
+ from { clip-path: var(--beui-vt-from, inset(100% 0 0 0)); }
66
+ to { clip-path: inset(0 0 0 0); }
67
+ }
68
+ @keyframes beui-circle-reveal {
69
+ from { clip-path: circle(0% at var(--beui-vt-origin, 50% 100%)); }
70
+ to { clip-path: circle(150% at var(--beui-vt-origin, 50% 100%)); }
71
+ }
72
+ @keyframes beui-circle-blur-reveal {
73
+ from { clip-path: circle(0% at var(--beui-vt-origin, 50% 100%)); filter: blur(8px); }
74
+ to { clip-path: circle(150% at var(--beui-vt-origin, 50% 100%)); filter: blur(0px); }
75
+ }
76
+ @keyframes beui-blinds-reveal {
77
+ from { --beui-vt-slat: -20px; }
78
+ to { --beui-vt-slat: 72px; }
79
+ }
80
+ `;
81
+ const RECT_FROM = {
82
+ "top-left": "inset(0 100% 100% 0)",
83
+ "top-right": "inset(0 0 100% 100%)",
84
+ "bottom-left": "inset(100% 100% 0 0)",
85
+ "bottom-right": "inset(100% 0 0 100%)",
86
+ center: "inset(50% 50% 50% 50%)",
87
+ "bottom-up": "inset(100% 0 0 0)"
88
+ };
89
+ const CIRCLE_ORIGIN = {
90
+ "top-left": "0% 0%",
91
+ "top-right": "100% 0%",
92
+ "bottom-left": "0% 100%",
93
+ "bottom-right": "100% 100%",
94
+ center: "50% 50%",
95
+ "bottom-up": "50% 100%"
96
+ };
97
+ function useThemeToggle({ variant = "rectangle", start = "bottom-up" } = {}) {
98
+ const { setTheme, resolvedTheme } = useTheme();
99
+ const reduce = useReducedMotion() ?? false;
100
+ const [mounted, setMounted] = useState(false);
101
+ useEffect(() => setMounted(true), []);
102
+ useEffect(() => {
103
+ if (document.getElementById(VT_STYLE_ID)) return;
104
+ const el = document.createElement("style");
105
+ el.id = VT_STYLE_ID;
106
+ el.textContent = VT_CSS;
107
+ document.head.appendChild(el);
108
+ }, []);
109
+ const isDark = mounted && resolvedTheme === "dark";
110
+ const toggle = () => {
111
+ const next = isDark ? "light" : "dark";
112
+ if (reduce || !("startViewTransition" in document)) {
113
+ setTheme(next);
114
+ return;
115
+ }
116
+ const root = document.documentElement;
117
+ if (variant === "rectangle") {
118
+ root.style.setProperty("--beui-vt-from", RECT_FROM[start]);
119
+ root.dataset.beuiVt = "rect";
120
+ } else if (variant === "blinds") root.dataset.beuiVt = "blinds";
121
+ else {
122
+ root.style.setProperty("--beui-vt-origin", CIRCLE_ORIGIN[start]);
123
+ root.dataset.beuiVt = variant;
124
+ }
125
+ document.startViewTransition(() => setTheme(next)).finished.finally(() => {
126
+ delete root.dataset.beuiVt;
127
+ });
128
+ };
129
+ return {
130
+ isDark,
131
+ mounted,
132
+ toggle
133
+ };
134
+ }
135
+ function ThemeToggle({ variant = "rectangle", start = "bottom-up", className, iconClassName, ...rest }) {
136
+ const { isDark, mounted, toggle } = useThemeToggle({
137
+ variant,
138
+ start
139
+ });
140
+ return /* @__PURE__ */ jsx("button", {
141
+ type: "button",
142
+ "aria-label": mounted && isDark ? "Switch to light mode" : "Switch to dark mode",
143
+ onClick: toggle,
144
+ className: cn("flex items-center justify-center", className),
145
+ ...rest,
146
+ children: mounted ? /* @__PURE__ */ jsx(ActionSwapIcon, {
147
+ value: isDark ? "dark" : "light",
148
+ animation: "blur",
149
+ className: iconClassName,
150
+ children: isDark ? /* @__PURE__ */ jsx(Sun, { className: iconClassName }) : /* @__PURE__ */ jsx(Moon, { className: iconClassName })
151
+ }) : /* @__PURE__ */ jsx("span", {
152
+ className: iconClassName,
153
+ "aria-hidden": "true"
154
+ })
155
+ });
156
+ }
157
+ //#endregion
158
+ export { ThemeToggle, useThemeToggle };
159
+
160
+ //# sourceMappingURL=theme-toggle.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"theme-toggle.js","names":[],"sources":["../../../src/components/motion/theme-toggle.tsx"],"sourcesContent":["\"use client\";\n\nimport { type ComponentPropsWithoutRef, useEffect, useState } from \"react\";\nimport { Moon, Sun } from \"lucide-react\";\nimport { useReducedMotion } from \"motion/react\";\nimport { useTheme } from \"next-themes\";\n\nimport { cn } from \"@kumix/utils\";\nimport { EASE_OUT_CSS } from \"../../lib/ease\";\nimport { ActionSwapIcon } from \"./action-swap\";\n\nexport type ThemeVariant = \"rectangle\" | \"circle\" | \"circle-blur\" | \"blinds\";\n\nexport type RectStart =\n | \"top-left\"\n | \"top-right\"\n | \"bottom-left\"\n | \"bottom-right\"\n | \"center\"\n | \"bottom-up\";\n\nexport interface ThemeToggleProps\n extends Omit<ComponentPropsWithoutRef<\"button\">, \"children\" | \"onClick\"> {\n /** Animation variant. Default: \"rectangle\". */\n variant?: ThemeVariant;\n /** Origin direction for the reveal. Default: \"bottom-up\". */\n start?: RectStart;\n iconClassName?: string;\n}\n\nconst VT_STYLE_ID = \"beui-theme-toggle-vt\";\n\n// View transitions animate in CSS, not motion springs, so easing here is\n// either EASE_OUT_CSS or a keyword. The circle variants keep the Material\n// standard curve because their reveal expands symmetrically rather than\n// decelerating. Durations differ per variant to match native OS mode switches.\nconst VT_CSS = `\nhtml[data-beui-vt=\"rect\"]::view-transition-old(root) {\n animation: none;\n mix-blend-mode: normal;\n}\nhtml[data-beui-vt=\"rect\"]::view-transition-new(root) {\n mix-blend-mode: normal;\n animation: beui-rect-reveal 400ms ease-out;\n}\nhtml[data-beui-vt=\"circle\"]::view-transition-old(root),\nhtml[data-beui-vt=\"circle-blur\"]::view-transition-old(root) {\n animation: none;\n mix-blend-mode: normal;\n}\nhtml[data-beui-vt=\"circle\"]::view-transition-new(root) {\n mix-blend-mode: normal;\n animation: beui-circle-reveal 700ms cubic-bezier(0.4, 0, 0.2, 1);\n}\nhtml[data-beui-vt=\"circle-blur\"]::view-transition-new(root) {\n mix-blend-mode: normal;\n animation: beui-circle-blur-reveal 700ms cubic-bezier(0.4, 0, 0.2, 1);\n}\nhtml[data-beui-vt=\"blinds\"]::view-transition-old(root) {\n animation: none;\n mix-blend-mode: normal;\n}\n/* Slats: a masked band widens inside every 72px tile, so the new theme opens\n across the page like a shutter. The band edge has to be a registered custom\n property — mask-image itself is not animatable, but it re-resolves every\n frame the property ticks. mask-size fixes the tile at 72px rather than\n letting a repeating gradient's last stop define it, which is what keeps the\n 20px soft edge from dragging the tile wider than the slat and leaving a\n feathered gap that never closes; it also means both ends land clean, fully\n transparent at -20px and fully opaque at 72px. Falling back to no mask\n (unregistered property, so the var is invalid) reveals the page in one\n step. */\n@property --beui-vt-slat {\n syntax: \"<length>\";\n inherits: false;\n initial-value: 72px;\n}\nhtml[data-beui-vt=\"blinds\"]::view-transition-new(root) {\n mix-blend-mode: normal;\n mask-image: linear-gradient(\n 90deg,\n #000 0 var(--beui-vt-slat),\n transparent calc(var(--beui-vt-slat) + 20px)\n );\n mask-size: 72px 100%;\n mask-repeat: repeat;\n animation: beui-blinds-reveal 700ms ${EASE_OUT_CSS};\n}\n@keyframes beui-rect-reveal {\n from { clip-path: var(--beui-vt-from, inset(100% 0 0 0)); }\n to { clip-path: inset(0 0 0 0); }\n}\n@keyframes beui-circle-reveal {\n from { clip-path: circle(0% at var(--beui-vt-origin, 50% 100%)); }\n to { clip-path: circle(150% at var(--beui-vt-origin, 50% 100%)); }\n}\n@keyframes beui-circle-blur-reveal {\n from { clip-path: circle(0% at var(--beui-vt-origin, 50% 100%)); filter: blur(8px); }\n to { clip-path: circle(150% at var(--beui-vt-origin, 50% 100%)); filter: blur(0px); }\n}\n@keyframes beui-blinds-reveal {\n from { --beui-vt-slat: -20px; }\n to { --beui-vt-slat: 72px; }\n}\n`;\n\nconst RECT_FROM: Record<RectStart, string> = {\n \"top-left\": \"inset(0 100% 100% 0)\",\n \"top-right\": \"inset(0 0 100% 100%)\",\n \"bottom-left\": \"inset(100% 100% 0 0)\",\n \"bottom-right\": \"inset(100% 0 0 100%)\",\n center: \"inset(50% 50% 50% 50%)\",\n \"bottom-up\": \"inset(100% 0 0 0)\",\n};\n\nconst CIRCLE_ORIGIN: Record<RectStart, string> = {\n \"top-left\": \"0% 0%\",\n \"top-right\": \"100% 0%\",\n \"bottom-left\": \"0% 100%\",\n \"bottom-right\": \"100% 100%\",\n center: \"50% 50%\",\n \"bottom-up\": \"50% 100%\",\n};\n\nexport function useThemeToggle({\n variant = \"rectangle\",\n start = \"bottom-up\",\n}: {\n variant?: ThemeVariant;\n start?: RectStart;\n} = {}) {\n const { setTheme, resolvedTheme } = useTheme();\n const reduce = useReducedMotion() ?? false;\n const [mounted, setMounted] = useState(false);\n useEffect(() => setMounted(true), []);\n useEffect(() => {\n if (document.getElementById(VT_STYLE_ID)) return;\n const el = document.createElement(\"style\");\n el.id = VT_STYLE_ID;\n el.textContent = VT_CSS;\n document.head.appendChild(el);\n }, []);\n const isDark = mounted && resolvedTheme === \"dark\";\n\n const toggle = () => {\n const next = isDark ? \"light\" : \"dark\";\n\n if (reduce || !(\"startViewTransition\" in document)) {\n setTheme(next);\n return;\n }\n\n const root = document.documentElement;\n\n if (variant === \"rectangle\") {\n root.style.setProperty(\"--beui-vt-from\", RECT_FROM[start]);\n root.dataset.beuiVt = \"rect\";\n } else if (variant === \"blinds\") {\n // Slats sweep the whole viewport; there is no origin point to set.\n root.dataset.beuiVt = \"blinds\";\n } else {\n root.style.setProperty(\"--beui-vt-origin\", CIRCLE_ORIGIN[start]);\n root.dataset.beuiVt = variant;\n }\n\n const vt = (\n document as Document & {\n startViewTransition(cb: () => void): { finished: Promise<void> };\n }\n ).startViewTransition(() => setTheme(next));\n\n vt.finished.finally(() => {\n delete root.dataset.beuiVt;\n });\n };\n\n return { isDark, mounted, toggle };\n}\n\nexport function ThemeToggle({\n variant = \"rectangle\",\n start = \"bottom-up\",\n className,\n iconClassName,\n ...rest\n}: ThemeToggleProps) {\n const { isDark, mounted, toggle } = useThemeToggle({ variant, start });\n\n return (\n <button\n type=\"button\"\n aria-label={mounted && isDark ? \"Switch to light mode\" : \"Switch to dark mode\"}\n onClick={toggle}\n className={cn(\"flex items-center justify-center\", className)}\n {...rest}\n >\n {mounted ? (\n <ActionSwapIcon\n value={isDark ? \"dark\" : \"light\"}\n animation=\"blur\"\n className={iconClassName}\n >\n {isDark ? <Sun className={iconClassName} /> : <Moon className={iconClassName} />}\n </ActionSwapIcon>\n ) : (\n <span className={iconClassName} aria-hidden=\"true\" />\n )}\n </button>\n );\n}\n"],"mappings":";;;;;;;;;;AA8BA,MAAM,cAAc;AAMpB,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wCAkDyB,aAAa;;;;;;;;;;;;;;;;;;;AAoBrD,MAAM,YAAuC;CAC3C,YAAY;CACZ,aAAa;CACb,eAAe;CACf,gBAAgB;CAChB,QAAQ;CACR,aAAa;AACf;AAEA,MAAM,gBAA2C;CAC/C,YAAY;CACZ,aAAa;CACb,eAAe;CACf,gBAAgB;CAChB,QAAQ;CACR,aAAa;AACf;AAEA,SAAgB,eAAe,EAC7B,UAAU,aACV,QAAQ,gBAIN,CAAC,GAAG;CACN,MAAM,EAAE,UAAU,kBAAkB,SAAS;CAC7C,MAAM,SAAS,iBAAiB,KAAK;CACrC,MAAM,CAAC,SAAS,cAAc,SAAS,KAAK;CAC5C,gBAAgB,WAAW,IAAI,GAAG,CAAC,CAAC;CACpC,gBAAgB;EACd,IAAI,SAAS,eAAe,WAAW,GAAG;EAC1C,MAAM,KAAK,SAAS,cAAc,OAAO;EACzC,GAAG,KAAK;EACR,GAAG,cAAc;EACjB,SAAS,KAAK,YAAY,EAAE;CAC9B,GAAG,CAAC,CAAC;CACL,MAAM,SAAS,WAAW,kBAAkB;CAE5C,MAAM,eAAe;EACnB,MAAM,OAAO,SAAS,UAAU;EAEhC,IAAI,UAAU,EAAE,yBAAyB,WAAW;GAClD,SAAS,IAAI;GACb;EACF;EAEA,MAAM,OAAO,SAAS;EAEtB,IAAI,YAAY,aAAa;GAC3B,KAAK,MAAM,YAAY,kBAAkB,UAAU,MAAM;GACzD,KAAK,QAAQ,SAAS;EACxB,OAAO,IAAI,YAAY,UAErB,KAAK,QAAQ,SAAS;OACjB;GACL,KAAK,MAAM,YAAY,oBAAoB,cAAc,MAAM;GAC/D,KAAK,QAAQ,SAAS;EACxB;EAQA,SAFE,0BAA0B,SAAS,IAAI,CAExC,CAAC,CAAC,SAAS,cAAc;GACxB,OAAO,KAAK,QAAQ;EACtB,CAAC;CACH;CAEA,OAAO;EAAE;EAAQ;EAAS;CAAO;AACnC;AAEA,SAAgB,YAAY,EAC1B,UAAU,aACV,QAAQ,aACR,WACA,eACA,GAAG,QACgB;CACnB,MAAM,EAAE,QAAQ,SAAS,WAAW,eAAe;EAAE;EAAS;CAAM,CAAC;CAErE,OACE,oBAAC,UAAD;EACE,MAAK;EACL,cAAY,WAAW,SAAS,yBAAyB;EACzD,SAAS;EACT,WAAW,GAAG,oCAAoC,SAAS;EAC3D,GAAI;EAEH,UAAA,UACC,oBAAC,gBAAD;GACE,OAAO,SAAS,SAAS;GACzB,WAAU;GACV,WAAW;GAEV,UAAA,SAAS,oBAAC,KAAD,EAAK,WAAW,cAAgB,CAAA,IAAI,oBAAC,MAAD,EAAM,WAAW,cAAgB,CAAA;EACjE,CAAA,IAEhB,oBAAC,QAAD;GAAM,WAAW;GAAe,eAAY;EAAQ,CAAA;CAEhD,CAAA;AAEZ"}
@@ -0,0 +1,12 @@
1
+ import { ReactNode } from "react";
2
+ //#region src/components/motion/tilt-card.d.ts
3
+ interface TiltCardProps {
4
+ children: ReactNode;
5
+ max?: number;
6
+ glare?: boolean;
7
+ className?: string;
8
+ }
9
+ declare function TiltCard({ children, max, glare, className }: TiltCardProps): import("react").JSX.Element;
10
+ //#endregion
11
+ export { TiltCard, TiltCardProps };
12
+ //# sourceMappingURL=tilt-card.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tilt-card.d.ts","names":[],"sources":["../../../src/components/motion/tilt-card.tsx"],"mappings":";;UAeiB;EACf,UAAU;EACV;EACA;EACA;;iBAGc,WAAW,UAAU,KAAU,OAAc,aAAa,gCAAa,IAAA"}
@@ -0,0 +1,56 @@
1
+ "use client";
2
+ import { useHoverCapable } from "../../hooks/use-hover-capable.js";
3
+ import { SPRING_MOUSE } from "../../lib/ease.js";
4
+ import { useRef } from "react";
5
+ import { cn } from "@kumix/utils";
6
+ import { motion, useMotionTemplate, useMotionValue, useReducedMotion, useSpring } from "motion/react";
7
+ import { jsx, jsxs } from "react/jsx-runtime";
8
+ //#region src/components/motion/tilt-card.tsx
9
+ function TiltCard({ children, max = 12, glare = true, className }) {
10
+ const ref = useRef(null);
11
+ const reduce = useReducedMotion();
12
+ const canHover = useHoverCapable();
13
+ const enabled = !reduce && canHover;
14
+ const rx = useMotionValue(0);
15
+ const ry = useMotionValue(0);
16
+ const gx = useMotionValue(50);
17
+ const gy = useMotionValue(50);
18
+ const srx = useSpring(rx, SPRING_MOUSE);
19
+ const sry = useSpring(ry, SPRING_MOUSE);
20
+ const onMove = (e) => {
21
+ const el = ref.current;
22
+ if (!el || !enabled) return;
23
+ const rect = el.getBoundingClientRect();
24
+ const px = (e.clientX - rect.left) / rect.width;
25
+ const py = (e.clientY - rect.top) / rect.height;
26
+ ry.set((px - .5) * max);
27
+ rx.set((.5 - py) * max);
28
+ gx.set(px * 100);
29
+ gy.set(py * 100);
30
+ };
31
+ const onLeave = () => {
32
+ rx.set(0);
33
+ ry.set(0);
34
+ };
35
+ const transform = useMotionTemplate`perspective(1000px) rotateX(${srx}deg) rotateY(${sry}deg)`;
36
+ const glareBg = useMotionTemplate`radial-gradient(circle at ${gx}% ${gy}%, var(--foreground), transparent 50%)`;
37
+ return /* @__PURE__ */ jsxs(motion.div, {
38
+ ref,
39
+ onMouseMove: onMove,
40
+ onMouseLeave: onLeave,
41
+ style: {
42
+ transform,
43
+ transformStyle: "preserve-3d"
44
+ },
45
+ className: cn("relative overflow-hidden rounded-2xl will-change-transform", className),
46
+ children: [children, glare && enabled ? /* @__PURE__ */ jsx(motion.div, {
47
+ "aria-hidden": true,
48
+ style: { background: glareBg },
49
+ className: "pointer-events-none absolute inset-0 opacity-15"
50
+ }) : null]
51
+ });
52
+ }
53
+ //#endregion
54
+ export { TiltCard };
55
+
56
+ //# sourceMappingURL=tilt-card.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tilt-card.js","names":[],"sources":["../../../src/components/motion/tilt-card.tsx"],"sourcesContent":["\"use client\";\n\nimport { type ReactNode, useRef } from \"react\";\nimport {\n motion,\n useMotionTemplate,\n useMotionValue,\n useReducedMotion,\n useSpring,\n} from \"motion/react\";\n\nimport { cn } from \"@kumix/utils\";\nimport { useHoverCapable } from \"../../hooks/use-hover-capable\";\nimport { SPRING_MOUSE } from \"../../lib/ease\";\n\nexport interface TiltCardProps {\n children: ReactNode;\n max?: number;\n glare?: boolean;\n className?: string;\n}\n\nexport function TiltCard({ children, max = 12, glare = true, className }: TiltCardProps) {\n const ref = useRef<HTMLDivElement>(null);\n const reduce = useReducedMotion();\n const canHover = useHoverCapable();\n // Decorative cursor-follow: skip on touch (phantom hover) and reduced motion.\n const enabled = !reduce && canHover;\n const rx = useMotionValue(0);\n const ry = useMotionValue(0);\n const gx = useMotionValue(50);\n const gy = useMotionValue(50);\n\n const srx = useSpring(rx, SPRING_MOUSE);\n const sry = useSpring(ry, SPRING_MOUSE);\n\n const onMove = (e: React.MouseEvent<HTMLDivElement>) => {\n const el = ref.current;\n if (!el || !enabled) return;\n const rect = el.getBoundingClientRect();\n const px = (e.clientX - rect.left) / rect.width;\n const py = (e.clientY - rect.top) / rect.height;\n ry.set((px - 0.5) * max);\n rx.set((0.5 - py) * max);\n gx.set(px * 100);\n gy.set(py * 100);\n };\n\n const onLeave = () => {\n rx.set(0);\n ry.set(0);\n };\n\n const transform = useMotionTemplate`perspective(1000px) rotateX(${srx}deg) rotateY(${sry}deg)`;\n const glareBg = useMotionTemplate`radial-gradient(circle at ${gx}% ${gy}%, var(--foreground), transparent 50%)`;\n\n return (\n <motion.div\n ref={ref}\n onMouseMove={onMove}\n onMouseLeave={onLeave}\n style={{ transform, transformStyle: \"preserve-3d\" }}\n className={cn(\"relative overflow-hidden rounded-2xl will-change-transform\", className)}\n >\n {children}\n {glare && enabled ? (\n <motion.div\n aria-hidden\n style={{ background: glareBg }}\n className=\"pointer-events-none absolute inset-0 opacity-15\"\n />\n ) : null}\n </motion.div>\n );\n}\n"],"mappings":";;;;;;;;AAsBA,SAAgB,SAAS,EAAE,UAAU,MAAM,IAAI,QAAQ,MAAM,aAA4B;CACvF,MAAM,MAAM,OAAuB,IAAI;CACvC,MAAM,SAAS,iBAAiB;CAChC,MAAM,WAAW,gBAAgB;CAEjC,MAAM,UAAU,CAAC,UAAU;CAC3B,MAAM,KAAK,eAAe,CAAC;CAC3B,MAAM,KAAK,eAAe,CAAC;CAC3B,MAAM,KAAK,eAAe,EAAE;CAC5B,MAAM,KAAK,eAAe,EAAE;CAE5B,MAAM,MAAM,UAAU,IAAI,YAAY;CACtC,MAAM,MAAM,UAAU,IAAI,YAAY;CAEtC,MAAM,UAAU,MAAwC;EACtD,MAAM,KAAK,IAAI;EACf,IAAI,CAAC,MAAM,CAAC,SAAS;EACrB,MAAM,OAAO,GAAG,sBAAsB;EACtC,MAAM,MAAM,EAAE,UAAU,KAAK,QAAQ,KAAK;EAC1C,MAAM,MAAM,EAAE,UAAU,KAAK,OAAO,KAAK;EACzC,GAAG,KAAK,KAAK,MAAO,GAAG;EACvB,GAAG,KAAK,KAAM,MAAM,GAAG;EACvB,GAAG,IAAI,KAAK,GAAG;EACf,GAAG,IAAI,KAAK,GAAG;CACjB;CAEA,MAAM,gBAAgB;EACpB,GAAG,IAAI,CAAC;EACR,GAAG,IAAI,CAAC;CACV;CAEA,MAAM,YAAY,iBAAiB,+BAA+B,IAAI,eAAe,IAAI;CACzF,MAAM,UAAU,iBAAiB,6BAA6B,GAAG,IAAI,GAAG;CAExE,OACE,qBAAC,OAAO,KAAR;EACO;EACL,aAAa;EACb,cAAc;EACd,OAAO;GAAE;GAAW,gBAAgB;EAAc;EAClD,WAAW,GAAG,8DAA8D,SAAS;EALvF,UAAA,CAOG,UACA,SAAS,UACR,oBAAC,OAAO,KAAR;GACE,eAAA;GACA,OAAO,EAAE,YAAY,QAAQ;GAC7B,WAAU;EACX,CAAA,IACC,IACM;;AAEhB"}
@@ -0,0 +1,17 @@
1
+ import { ReactElement, ReactNode } from "react";
2
+ //#region src/components/motion/tooltip.d.ts
3
+ type Side = "top" | "right" | "bottom" | "left";
4
+ interface TooltipProps {
5
+ content: ReactNode;
6
+ children: ReactElement;
7
+ side?: Side;
8
+ /** Delay before showing (ms). Default 120. */
9
+ delay?: number;
10
+ className?: string;
11
+ /** Classes for the outer wrapper span. Use to fix baseline / fill parent. */
12
+ wrapperClassName?: string;
13
+ }
14
+ declare function Tooltip({ content, children, side, delay, className, wrapperClassName }: TooltipProps): import("react").JSX.Element;
15
+ //#endregion
16
+ export { Tooltip, TooltipProps };
17
+ //# sourceMappingURL=tooltip.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tooltip.d.ts","names":[],"sources":["../../../src/components/motion/tooltip.tsx"],"mappings":";;KAqBK;UAEY;EACf,SAAS;EACT,UAAU;EACV,OAAO;;EAEP;EACA;;EAEA;;iBA6Ec,UACd,SACA,UACA,MACA,OACA,WACA,oBACC,+BAAY,IAAA"}
@@ -0,0 +1,194 @@
1
+ "use client";
2
+ import { useHoverCapable } from "../../hooks/use-hover-capable.js";
3
+ import { EASE_OUT } from "../../lib/ease.js";
4
+ import { cloneElement, isValidElement, useCallback, useEffect, useId, useMemo, useRef, useState } from "react";
5
+ import { cn } from "@kumix/utils";
6
+ import { AnimatePresence, motion, useReducedMotion } from "motion/react";
7
+ import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
8
+ import { createPortal } from "react-dom";
9
+ //#region src/components/motion/tooltip.tsx
10
+ const GAP = 8;
11
+ const anchorTransform = {
12
+ top: "translate(-50%, -100%)",
13
+ bottom: "translate(-50%, 0)",
14
+ left: "translate(-100%, -50%)",
15
+ right: "translate(0, -50%)"
16
+ };
17
+ const transformOrigin = {
18
+ top: "center bottom",
19
+ bottom: "center top",
20
+ left: "right center",
21
+ right: "left center"
22
+ };
23
+ const offsetFrom = {
24
+ top: { y: 8 },
25
+ bottom: { y: -8 },
26
+ left: { x: 8 },
27
+ right: { x: -8 }
28
+ };
29
+ function buildVariants(side) {
30
+ const o = offsetFrom[side];
31
+ return {
32
+ initial: {
33
+ opacity: 0,
34
+ scale: .9,
35
+ filter: "blur(5px)",
36
+ x: o.x ?? 0,
37
+ y: o.y ?? 0
38
+ },
39
+ animate: {
40
+ opacity: 1,
41
+ scale: 1,
42
+ filter: "blur(0px)",
43
+ x: 0,
44
+ y: 0,
45
+ transition: {
46
+ type: "spring",
47
+ stiffness: 380,
48
+ damping: 30,
49
+ mass: .7,
50
+ opacity: {
51
+ duration: .14,
52
+ ease: EASE_OUT
53
+ },
54
+ filter: {
55
+ duration: .18,
56
+ ease: EASE_OUT
57
+ }
58
+ }
59
+ },
60
+ exit: {
61
+ opacity: 0,
62
+ scale: .94,
63
+ filter: "blur(3px)",
64
+ x: (o.x ?? 0) * .6,
65
+ y: (o.y ?? 0) * .6,
66
+ transition: {
67
+ duration: .12,
68
+ ease: EASE_OUT
69
+ }
70
+ }
71
+ };
72
+ }
73
+ const REDUCED_VARIANTS = {
74
+ initial: { opacity: 0 },
75
+ animate: {
76
+ opacity: 1,
77
+ transition: {
78
+ duration: .14,
79
+ ease: EASE_OUT
80
+ }
81
+ },
82
+ exit: {
83
+ opacity: 0,
84
+ transition: {
85
+ duration: .1,
86
+ ease: EASE_OUT
87
+ }
88
+ }
89
+ };
90
+ const WARM_WINDOW_MS = 300;
91
+ let lastHiddenAt = 0;
92
+ function Tooltip({ content, children, side = "top", delay = 120, className, wrapperClassName }) {
93
+ const [open, setOpen] = useState(false);
94
+ const [coords, setCoords] = useState(null);
95
+ const id = useId();
96
+ const timer = useRef(null);
97
+ const anchorRef = useRef(null);
98
+ const reduce = useReducedMotion();
99
+ const canHover = useHoverCapable();
100
+ const place = useCallback(() => {
101
+ const el = anchorRef.current;
102
+ if (!el) return;
103
+ const r = el.getBoundingClientRect();
104
+ const cx = r.left + r.width / 2;
105
+ const cy = r.top + r.height / 2;
106
+ const point = {
107
+ top: {
108
+ top: r.top - GAP,
109
+ left: cx
110
+ },
111
+ bottom: {
112
+ top: r.bottom + GAP,
113
+ left: cx
114
+ },
115
+ left: {
116
+ top: cy,
117
+ left: r.left - GAP
118
+ },
119
+ right: {
120
+ top: cy,
121
+ left: r.right + GAP
122
+ }
123
+ };
124
+ setCoords(point[side]);
125
+ }, [side]);
126
+ const show = useCallback(() => {
127
+ if (!canHover) return;
128
+ if (timer.current) clearTimeout(timer.current);
129
+ const warm = Date.now() - lastHiddenAt < WARM_WINDOW_MS;
130
+ timer.current = setTimeout(() => {
131
+ place();
132
+ setOpen(true);
133
+ }, warm ? 0 : delay);
134
+ }, [
135
+ canHover,
136
+ delay,
137
+ place
138
+ ]);
139
+ const hide = useCallback(() => {
140
+ if (timer.current) {
141
+ clearTimeout(timer.current);
142
+ timer.current = null;
143
+ }
144
+ if (open) lastHiddenAt = Date.now();
145
+ setOpen(false);
146
+ }, [open]);
147
+ useEffect(() => {
148
+ if (!open) return;
149
+ const onMove = () => place();
150
+ window.addEventListener("scroll", onMove, true);
151
+ window.addEventListener("resize", onMove);
152
+ return () => {
153
+ window.removeEventListener("scroll", onMove, true);
154
+ window.removeEventListener("resize", onMove);
155
+ };
156
+ }, [open, place]);
157
+ const variants = useMemo(() => reduce ? REDUCED_VARIANTS : buildVariants(side), [reduce, side]);
158
+ if (!isValidElement(children)) return children;
159
+ const trigger = cloneElement(children, {
160
+ onMouseEnter: show,
161
+ onMouseLeave: hide,
162
+ onFocus: show,
163
+ onBlur: hide,
164
+ "aria-describedby": id
165
+ });
166
+ return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("span", {
167
+ ref: anchorRef,
168
+ className: cn("relative inline-flex align-middle", wrapperClassName),
169
+ children: trigger
170
+ }), typeof document !== "undefined" ? createPortal(/* @__PURE__ */ jsx(AnimatePresence, { children: open && coords ? /* @__PURE__ */ jsx("span", {
171
+ "aria-hidden": true,
172
+ className: "pointer-events-none fixed z-9999",
173
+ style: {
174
+ top: coords.top,
175
+ left: coords.left,
176
+ transform: anchorTransform[side]
177
+ },
178
+ children: /* @__PURE__ */ jsx(motion.span, {
179
+ id,
180
+ role: "tooltip",
181
+ variants,
182
+ initial: "initial",
183
+ animate: "animate",
184
+ exit: "exit",
185
+ style: { transformOrigin: transformOrigin[side] },
186
+ className: cn("block whitespace-nowrap rounded-lg border border-border bg-background px-2.5 py-1 font-medium text-foreground text-xs shadow-lg", className),
187
+ children: content
188
+ })
189
+ }) : null }), document.body) : null] });
190
+ }
191
+ //#endregion
192
+ export { Tooltip };
193
+
194
+ //# sourceMappingURL=tooltip.js.map