@kumix/ui 0.2.3 → 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.
- package/README.md +32 -10
- package/dist/components/motion/action-swap-blur.d.ts +11 -0
- package/dist/components/motion/action-swap-blur.d.ts.map +1 -0
- package/dist/components/motion/action-swap-blur.js +26 -0
- package/dist/components/motion/action-swap-blur.js.map +1 -0
- package/dist/components/motion/action-swap-cascade.d.ts +11 -0
- package/dist/components/motion/action-swap-cascade.d.ts.map +1 -0
- package/dist/components/motion/action-swap-cascade.js +26 -0
- package/dist/components/motion/action-swap-cascade.js.map +1 -0
- package/dist/components/motion/action-swap-roll.d.ts +11 -0
- package/dist/components/motion/action-swap-roll.d.ts.map +1 -0
- package/dist/components/motion/action-swap-roll.js +26 -0
- package/dist/components/motion/action-swap-roll.js.map +1 -0
- package/dist/components/motion/action-swap.d.ts +41 -0
- package/dist/components/motion/action-swap.d.ts.map +1 -0
- package/dist/components/motion/action-swap.js +261 -0
- package/dist/components/motion/action-swap.js.map +1 -0
- package/dist/components/motion/animated-badge.d.ts +18 -0
- package/dist/components/motion/animated-badge.d.ts.map +1 -0
- package/dist/components/motion/animated-badge.js +206 -0
- package/dist/components/motion/animated-badge.js.map +1 -0
- package/dist/components/motion/animated-number.d.ts +12 -0
- package/dist/components/motion/animated-number.d.ts.map +1 -0
- package/dist/components/motion/animated-number.js +47 -0
- package/dist/components/motion/animated-number.js.map +1 -0
- package/dist/components/motion/animated-sidebar.d.ts +97 -0
- package/dist/components/motion/animated-sidebar.d.ts.map +1 -0
- package/dist/components/motion/animated-sidebar.js +611 -0
- package/dist/components/motion/animated-sidebar.js.map +1 -0
- package/dist/components/motion/animated-toast-stack.d.ts +65 -0
- package/dist/components/motion/animated-toast-stack.d.ts.map +1 -0
- package/dist/components/motion/animated-toast-stack.js +303 -0
- package/dist/components/motion/animated-toast-stack.js.map +1 -0
- package/dist/components/motion/bottom-sheet.d.ts +19 -0
- package/dist/components/motion/bottom-sheet.d.ts.map +1 -0
- package/dist/components/motion/bottom-sheet.js +146 -0
- package/dist/components/motion/bottom-sheet.js.map +1 -0
- package/dist/components/motion/bounce-sidebar.d.ts +26 -0
- package/dist/components/motion/bounce-sidebar.d.ts.map +1 -0
- package/dist/components/motion/bounce-sidebar.js +164 -0
- package/dist/components/motion/bounce-sidebar.js.map +1 -0
- package/dist/components/motion/bouncy-accordion.d.ts +32 -0
- package/dist/components/motion/bouncy-accordion.d.ts.map +1 -0
- package/dist/components/motion/bouncy-accordion.js +172 -0
- package/dist/components/motion/bouncy-accordion.js.map +1 -0
- package/dist/components/motion/button/base.d.ts +17 -0
- package/dist/components/motion/button/base.d.ts.map +1 -0
- package/dist/components/motion/button/base.js +86 -0
- package/dist/components/motion/button/base.js.map +1 -0
- package/dist/components/motion/button/magnetic.d.ts +12 -0
- package/dist/components/motion/button/magnetic.d.ts.map +1 -0
- package/dist/components/motion/button/magnetic.js +21 -0
- package/dist/components/motion/button/magnetic.js.map +1 -0
- package/dist/components/motion/button/stateful.d.ts +16 -0
- package/dist/components/motion/button/stateful.d.ts.map +1 -0
- package/dist/components/motion/button/stateful.js +190 -0
- package/dist/components/motion/button/stateful.js.map +1 -0
- package/dist/components/motion/center-morph-modal.d.ts +43 -0
- package/dist/components/motion/center-morph-modal.d.ts.map +1 -0
- package/dist/components/motion/center-morph-modal.js +238 -0
- package/dist/components/motion/center-morph-modal.js.map +1 -0
- package/dist/components/motion/checkbox.d.ts +15 -0
- package/dist/components/motion/checkbox.d.ts.map +1 -0
- package/dist/components/motion/checkbox.js +81 -0
- package/dist/components/motion/checkbox.js.map +1 -0
- package/dist/components/motion/chromatic-text-reveal.d.ts +31 -0
- package/dist/components/motion/chromatic-text-reveal.d.ts.map +1 -0
- package/dist/components/motion/chromatic-text-reveal.js +132 -0
- package/dist/components/motion/chromatic-text-reveal.js.map +1 -0
- package/dist/components/motion/context-menu.d.ts +71 -0
- package/dist/components/motion/context-menu.d.ts.map +1 -0
- package/dist/components/motion/context-menu.js +454 -0
- package/dist/components/motion/context-menu.js.map +1 -0
- package/dist/components/motion/cylinder-carousel.d.ts +40 -0
- package/dist/components/motion/cylinder-carousel.d.ts.map +1 -0
- package/dist/components/motion/cylinder-carousel.js +274 -0
- package/dist/components/motion/cylinder-carousel.js.map +1 -0
- package/dist/components/motion/dock.d.ts +24 -0
- package/dist/components/motion/dock.d.ts.map +1 -0
- package/dist/components/motion/dock.js +62 -0
- package/dist/components/motion/dock.js.map +1 -0
- package/dist/components/motion/drawer.d.ts +19 -0
- package/dist/components/motion/drawer.d.ts.map +1 -0
- package/dist/components/motion/drawer.js +58 -0
- package/dist/components/motion/drawer.js.map +1 -0
- package/dist/components/motion/hold-action-button.d.ts +17 -0
- package/dist/components/motion/hold-action-button.d.ts.map +1 -0
- package/dist/components/motion/hold-action-button.js +158 -0
- package/dist/components/motion/hold-action-button.js.map +1 -0
- package/dist/components/motion/input.d.ts +29 -0
- package/dist/components/motion/input.d.ts.map +1 -0
- package/dist/components/motion/input.js +126 -0
- package/dist/components/motion/input.js.map +1 -0
- package/dist/components/motion/loader.d.ts +17 -0
- package/dist/components/motion/loader.d.ts.map +1 -0
- package/dist/components/motion/loader.js +791 -0
- package/dist/components/motion/loader.js.map +1 -0
- package/dist/components/motion/magnetic.d.ts +11 -0
- package/dist/components/motion/magnetic.d.ts.map +1 -0
- package/dist/components/motion/magnetic.js +44 -0
- package/dist/components/motion/magnetic.js.map +1 -0
- package/dist/components/motion/marquee.d.ts +15 -0
- package/dist/components/motion/marquee.d.ts.map +1 -0
- package/dist/components/motion/marquee.js +35 -0
- package/dist/components/motion/marquee.js.map +1 -0
- package/dist/components/motion/morphing-modal.d.ts +15 -0
- package/dist/components/motion/morphing-modal.d.ts.map +1 -0
- package/dist/components/motion/morphing-modal.js +117 -0
- package/dist/components/motion/morphing-modal.js.map +1 -0
- package/dist/components/motion/number-ticker.d.ts +26 -0
- package/dist/components/motion/number-ticker.d.ts.map +1 -0
- package/dist/components/motion/number-ticker.js +129 -0
- package/dist/components/motion/number-ticker.js.map +1 -0
- package/dist/components/motion/parallax.d.ts +21 -0
- package/dist/components/motion/parallax.d.ts.map +1 -0
- package/dist/components/motion/parallax.js +35 -0
- package/dist/components/motion/parallax.js.map +1 -0
- package/dist/components/motion/popover-morph.d.ts +38 -0
- package/dist/components/motion/popover-morph.d.ts.map +1 -0
- package/dist/components/motion/popover-morph.js +167 -0
- package/dist/components/motion/popover-morph.js.map +1 -0
- package/dist/components/motion/popover.d.ts +40 -0
- package/dist/components/motion/popover.d.ts.map +1 -0
- package/dist/components/motion/popover.js +393 -0
- package/dist/components/motion/popover.js.map +1 -0
- package/dist/components/motion/preview-rail.d.ts +26 -0
- package/dist/components/motion/preview-rail.d.ts.map +1 -0
- package/dist/components/motion/preview-rail.js +134 -0
- package/dist/components/motion/preview-rail.js.map +1 -0
- package/dist/components/motion/pull-to-refresh.d.ts +28 -0
- package/dist/components/motion/pull-to-refresh.d.ts.map +1 -0
- package/dist/components/motion/pull-to-refresh.js +389 -0
- package/dist/components/motion/pull-to-refresh.js.map +1 -0
- package/dist/components/motion/radio.d.ts +22 -0
- package/dist/components/motion/radio.d.ts.map +1 -0
- package/dist/components/motion/radio.js +79 -0
- package/dist/components/motion/radio.js.map +1 -0
- package/dist/components/motion/range-slider-bubble.d.ts +16 -0
- package/dist/components/motion/range-slider-bubble.d.ts.map +1 -0
- package/dist/components/motion/range-slider-bubble.js +117 -0
- package/dist/components/motion/range-slider-bubble.js.map +1 -0
- package/dist/components/motion/range-slider-fluid.d.ts +18 -0
- package/dist/components/motion/range-slider-fluid.d.ts.map +1 -0
- package/dist/components/motion/range-slider-fluid.js +63 -0
- package/dist/components/motion/range-slider-fluid.js.map +1 -0
- package/dist/components/motion/range-slider-ruler.d.ts +19 -0
- package/dist/components/motion/range-slider-ruler.d.ts.map +1 -0
- package/dist/components/motion/range-slider-ruler.js +142 -0
- package/dist/components/motion/range-slider-ruler.js.map +1 -0
- package/dist/components/motion/range-slider-wave.d.ts +16 -0
- package/dist/components/motion/range-slider-wave.d.ts.map +1 -0
- package/dist/components/motion/range-slider-wave.js +57 -0
- package/dist/components/motion/range-slider-wave.js.map +1 -0
- package/dist/components/motion/range-slider.d.ts +11 -0
- package/dist/components/motion/range-slider.d.ts.map +1 -0
- package/dist/components/motion/range-slider.js +63 -0
- package/dist/components/motion/range-slider.js.map +1 -0
- package/dist/components/motion/scroll-progress.d.ts +29 -0
- package/dist/components/motion/scroll-progress.d.ts.map +1 -0
- package/dist/components/motion/scroll-progress.js +71 -0
- package/dist/components/motion/scroll-progress.js.map +1 -0
- package/dist/components/motion/scroll-reveal.d.ts +23 -0
- package/dist/components/motion/scroll-reveal.d.ts.map +1 -0
- package/dist/components/motion/scroll-reveal.js +42 -0
- package/dist/components/motion/scroll-reveal.js.map +1 -0
- package/dist/components/motion/scroll-to.d.ts +21 -0
- package/dist/components/motion/scroll-to.d.ts.map +1 -0
- package/dist/components/motion/scroll-to.js +27 -0
- package/dist/components/motion/scroll-to.js.map +1 -0
- package/dist/components/motion/select-morph.d.ts +41 -0
- package/dist/components/motion/select-morph.d.ts.map +1 -0
- package/dist/components/motion/select-morph.js +251 -0
- package/dist/components/motion/select-morph.js.map +1 -0
- package/dist/components/motion/select.d.ts +36 -0
- package/dist/components/motion/select.d.ts.map +1 -0
- package/dist/components/motion/select.js +319 -0
- package/dist/components/motion/select.js.map +1 -0
- package/dist/components/motion/shader-background.d.ts +38 -0
- package/dist/components/motion/shader-background.d.ts.map +1 -0
- package/dist/components/motion/shader-background.js +49 -0
- package/dist/components/motion/shader-background.js.map +1 -0
- package/dist/components/motion/shared-layout-bg.d.ts +17 -0
- package/dist/components/motion/shared-layout-bg.d.ts.map +1 -0
- package/dist/components/motion/shared-layout-bg.js +88 -0
- package/dist/components/motion/shared-layout-bg.js.map +1 -0
- package/dist/components/motion/slide-action-button.d.ts +15 -0
- package/dist/components/motion/slide-action-button.d.ts.map +1 -0
- package/dist/components/motion/slide-action-button.js +146 -0
- package/dist/components/motion/slide-action-button.js.map +1 -0
- package/dist/components/motion/smooth-scroll.d.ts +47 -0
- package/dist/components/motion/smooth-scroll.d.ts.map +1 -0
- package/dist/components/motion/smooth-scroll.js +182 -0
- package/dist/components/motion/smooth-scroll.js.map +1 -0
- package/dist/components/motion/switch.d.ts +13 -0
- package/dist/components/motion/switch.d.ts.map +1 -0
- package/dist/components/motion/switch.js +76 -0
- package/dist/components/motion/switch.js.map +1 -0
- package/dist/components/motion/table/editable-cell.d.ts +9 -0
- package/dist/components/motion/table/editable-cell.d.ts.map +1 -0
- package/dist/components/motion/table/editable-cell.js +17 -0
- package/dist/components/motion/table/editable-cell.js.map +1 -0
- package/dist/components/motion/table/index.d.ts +6 -0
- package/dist/components/motion/table/index.d.ts.map +1 -0
- package/dist/components/motion/table/index.js +420 -0
- package/dist/components/motion/table/index.js.map +1 -0
- package/dist/components/motion/table/row-handle.d.ts +15 -0
- package/dist/components/motion/table/row-handle.d.ts.map +1 -0
- package/dist/components/motion/table/row-handle.js +51 -0
- package/dist/components/motion/table/row-handle.js.map +1 -0
- package/dist/components/motion/table/skeleton-rows.d.ts +11 -0
- package/dist/components/motion/table/skeleton-rows.d.ts.map +1 -0
- package/dist/components/motion/table/skeleton-rows.js +23 -0
- package/dist/components/motion/table/skeleton-rows.js.map +1 -0
- package/dist/components/motion/table/table-header.d.ts +35 -0
- package/dist/components/motion/table/table-header.d.ts.map +1 -0
- package/dist/components/motion/table/table-header.js +167 -0
- package/dist/components/motion/table/table-header.js.map +1 -0
- package/dist/components/motion/table/table-menu.d.ts +17 -0
- package/dist/components/motion/table/table-menu.d.ts.map +1 -0
- package/dist/components/motion/table/table-menu.js +92 -0
- package/dist/components/motion/table/table-menu.js.map +1 -0
- package/dist/components/motion/tabs.d.ts +29 -0
- package/dist/components/motion/tabs.d.ts.map +1 -0
- package/dist/components/motion/tabs.js +125 -0
- package/dist/components/motion/tabs.js.map +1 -0
- package/dist/components/motion/text-cascade.d.ts +15 -0
- package/dist/components/motion/text-cascade.d.ts.map +1 -0
- package/dist/components/motion/text-cascade.js +21 -0
- package/dist/components/motion/text-cascade.js.map +1 -0
- package/dist/components/motion/text-reveal.d.ts +25 -0
- package/dist/components/motion/text-reveal.d.ts.map +1 -0
- package/dist/components/motion/text-reveal.js +94 -0
- package/dist/components/motion/text-reveal.js.map +1 -0
- package/dist/components/motion/text-shimmer.d.ts +12 -0
- package/dist/components/motion/text-shimmer.d.ts.map +1 -0
- package/dist/components/motion/text-shimmer.js +15 -0
- package/dist/components/motion/text-shimmer.js.map +1 -0
- package/dist/components/motion/theme-toggle.d.ts +23 -0
- package/dist/components/motion/theme-toggle.d.ts.map +1 -0
- package/dist/components/motion/theme-toggle.js +160 -0
- package/dist/components/motion/theme-toggle.js.map +1 -0
- package/dist/components/motion/tilt-card.d.ts +12 -0
- package/dist/components/motion/tilt-card.d.ts.map +1 -0
- package/dist/components/motion/tilt-card.js +56 -0
- package/dist/components/motion/tilt-card.js.map +1 -0
- package/dist/components/motion/tooltip.d.ts +17 -0
- package/dist/components/motion/tooltip.d.ts.map +1 -0
- package/dist/components/motion/tooltip.js +194 -0
- package/dist/components/motion/tooltip.js.map +1 -0
- package/dist/components/motion/wheel-picker.d.ts +24 -0
- package/dist/components/motion/wheel-picker.d.ts.map +1 -0
- package/dist/components/motion/wheel-picker.js +442 -0
- package/dist/components/motion/wheel-picker.js.map +1 -0
- package/dist/components/reui/alert.d.ts +1 -1
- package/dist/components/reui/alert.js +1 -1
- package/dist/components/reui/autocomplete.js +2 -2
- package/dist/components/reui/badge.d.ts +1 -1
- package/dist/components/reui/badge.js +10 -9
- package/dist/components/reui/badge.js.map +1 -1
- package/dist/components/reui/data-grid/data-grid-table-dnd.js +21 -19
- package/dist/components/reui/data-grid/data-grid-table-dnd.js.map +1 -1
- package/dist/components/reui/data-grid/data-grid-table-virtual.d.ts +1 -1
- package/dist/components/reui/data-grid/data-grid-table-virtual.js +1 -1
- package/dist/components/reui/data-grid/data-grid-table.js +4 -2
- package/dist/components/reui/data-grid/data-grid-table.js.map +1 -1
- package/dist/components/reui/event-calendar/event-calendar-agenda-view.js +2 -1
- package/dist/components/reui/event-calendar/event-calendar-agenda-view.js.map +1 -1
- package/dist/components/reui/event-calendar/event-calendar-content.js +8 -7
- package/dist/components/reui/event-calendar/event-calendar-content.js.map +1 -1
- package/dist/components/reui/event-calendar/event-calendar-dnd.js +7 -4
- package/dist/components/reui/event-calendar/event-calendar-dnd.js.map +1 -1
- package/dist/components/reui/event-calendar/event-calendar-event.js +49 -47
- package/dist/components/reui/event-calendar/event-calendar-event.js.map +1 -1
- package/dist/components/reui/event-calendar/event-calendar-lib.js +3 -2
- package/dist/components/reui/event-calendar/event-calendar-lib.js.map +1 -1
- package/dist/components/reui/event-calendar/event-calendar-nav.js +37 -31
- package/dist/components/reui/event-calendar/event-calendar-nav.js.map +1 -1
- package/dist/components/reui/event-calendar/event-calendar-time-grid.js +2 -1
- package/dist/components/reui/event-calendar/event-calendar-time-grid.js.map +1 -1
- package/dist/components/reui/event-calendar/event-calendar.js +2 -1
- package/dist/components/reui/event-calendar/event-calendar.js.map +1 -1
- package/dist/components/reui/filters.js +5 -3
- package/dist/components/reui/filters.js.map +1 -1
- package/dist/components/reui/frame.d.ts +1 -1
- package/dist/components/reui/frame.js +1 -1
- package/dist/components/reui/gantt/gantt-bar.js +52 -51
- package/dist/components/reui/gantt/gantt-bar.js.map +1 -1
- package/dist/components/reui/gantt/gantt-lib.js +3 -2
- package/dist/components/reui/gantt/gantt-lib.js.map +1 -1
- package/dist/components/reui/gantt/gantt-nav.js +34 -30
- package/dist/components/reui/gantt/gantt-nav.js.map +1 -1
- package/dist/components/reui/gantt/gantt-recurrence.js +2 -2
- package/dist/components/reui/gantt/gantt-recurrence.js.map +1 -1
- package/dist/components/reui/gantt/gantt-view.js +175 -171
- package/dist/components/reui/gantt/gantt-view.js.map +1 -1
- package/dist/components/reui/icon-tile.js +12 -11
- package/dist/components/reui/icon-tile.js.map +1 -1
- package/dist/components/reui/kanban.js +42 -37
- package/dist/components/reui/kanban.js.map +1 -1
- package/dist/components/reui/number-field.js +1 -1
- package/dist/components/reui/rating.js +1 -1
- package/dist/components/reui/sortable.js +10 -9
- package/dist/components/reui/sortable.js.map +1 -1
- package/dist/components/reui/stepper.js +16 -16
- package/dist/components/reui/stepper.js.map +1 -1
- package/dist/components/reui/timeline.js +45 -38
- package/dist/components/reui/timeline.js.map +1 -1
- package/dist/components/reui/tree.js +2 -1
- package/dist/components/reui/tree.js.map +1 -1
- package/dist/components/ui/alert-dialog.js +1 -1
- package/dist/components/ui/alert-dialog.js.map +1 -1
- package/dist/components/ui/alert.js +1 -1
- package/dist/components/ui/attachment.d.ts +1 -1
- package/dist/components/ui/attachment.js +1 -1
- package/dist/components/ui/badge.d.ts +1 -1
- package/dist/components/ui/bubble.d.ts +1 -1
- package/dist/components/ui/bubble.js +1 -1
- package/dist/components/ui/button-group.js +1 -1
- package/dist/components/ui/button.d.ts +2 -2
- package/dist/components/ui/button.js +1 -1
- package/dist/components/ui/card.js +1 -1
- package/dist/components/ui/card.js.map +1 -1
- package/dist/components/ui/dialog.js +1 -1
- package/dist/components/ui/dialog.js.map +1 -1
- package/dist/components/ui/drawer.js +1 -1
- package/dist/components/ui/drawer.js.map +1 -1
- package/dist/components/ui/empty.d.ts +1 -1
- package/dist/components/ui/empty.js +2 -2
- package/dist/components/ui/empty.js.map +1 -1
- package/dist/components/ui/field.js +1 -1
- package/dist/components/ui/input-group.js +1 -1
- package/dist/components/ui/item.d.ts +2 -2
- package/dist/components/ui/item.js +1 -1
- package/dist/components/ui/marker.js +1 -1
- package/dist/components/ui/navigation-menu.js +1 -1
- package/dist/components/ui/sheet.js +1 -1
- package/dist/components/ui/sheet.js.map +1 -1
- package/dist/components/ui/sidebar.d.ts +1 -1
- package/dist/components/ui/sidebar.js +2 -2
- package/dist/components/ui/sidebar.js.map +1 -1
- package/dist/components/ui/tabs.js +1 -1
- package/dist/components/ui/toggle.d.ts +1 -1
- package/dist/components/ui/toggle.js +1 -1
- package/dist/hooks/use-hover-capable.d.ts +10 -0
- package/dist/hooks/use-hover-capable.d.ts.map +1 -0
- package/dist/hooks/use-hover-capable.js +24 -0
- package/dist/hooks/use-hover-capable.js.map +1 -0
- package/dist/hooks/use-mobile.js +1 -1
- package/dist/hooks/use-mobile.js.map +1 -1
- package/dist/hooks/use-slider.d.ts +58 -0
- package/dist/hooks/use-slider.d.ts.map +1 -0
- package/dist/hooks/use-slider.js +133 -0
- package/dist/hooks/use-slider.js.map +1 -0
- package/dist/lib/ease.d.ts +50 -0
- package/dist/lib/ease.d.ts.map +1 -0
- package/dist/lib/ease.js +66 -0
- package/dist/lib/ease.js.map +1 -0
- package/dist/lib/tick-sound.d.ts +17 -0
- package/dist/lib/tick-sound.d.ts.map +1 -0
- package/dist/lib/tick-sound.js +120 -0
- package/dist/lib/tick-sound.js.map +1 -0
- package/dist/popover-position-BUqYCq8X.js +54 -0
- package/dist/popover-position-BUqYCq8X.js.map +1 -0
- package/dist/theme.css +18 -58
- package/dist/types-Bah5NY44.d.ts +81 -0
- package/dist/types-Bah5NY44.d.ts.map +1 -0
- package/dist/utils-DQ7OpbYQ.js +25 -0
- package/dist/utils-DQ7OpbYQ.js.map +1 -0
- package/package.json +17 -6
package/README.md
CHANGED
|
@@ -1,22 +1,25 @@
|
|
|
1
1
|
# @kumix/ui
|
|
2
2
|
|
|
3
|
-
React UI kit for Kumix products. Built on **Base UI**, **Tailwind CSS**,
|
|
3
|
+
React UI kit for Kumix products. Built on **Base UI**, **Tailwind CSS**, **class-variance-authority**, and **Motion**. Ships as ESM with per-file exports (no barrel).
|
|
4
4
|
|
|
5
5
|
## Sources
|
|
6
6
|
|
|
7
|
-
| Path | Origin
|
|
8
|
-
| --------------------------------- |
|
|
9
|
-
| `src/components/ui/*` | [shadcn/ui](https://ui.shadcn.com/) (base-nova style)
|
|
10
|
-
| `src/components/reui/*` | [ReUI](https://reui.io/) registry (`@reui/*`)
|
|
11
|
-
| `src/
|
|
12
|
-
| `src/
|
|
7
|
+
| Path | Origin | Docs / previews |
|
|
8
|
+
| --------------------------------- | ------------------------------------------------------------ | ------------------------------------------------------------------------------- |
|
|
9
|
+
| `src/components/ui/*` | [shadcn/ui](https://ui.shadcn.com/) (base-nova style) | [ui.shadcn.com/docs/components](https://ui.shadcn.com/docs/components) |
|
|
10
|
+
| `src/components/reui/*` | [ReUI](https://reui.io/) registry (`@reui/*`) | [reui.io/docs](https://reui.io/docs) · [components](https://reui.io/components) |
|
|
11
|
+
| `src/components/motion/*` | [beUI](https://beui.dev/) registry (`@beui/*`, Motion-based) | [beui.dev/components/motion](https://beui.dev/components/motion) |
|
|
12
|
+
| `src/hooks/*` | Package helpers (+ ReUI `use-file-upload`, beUI helpers) | — |
|
|
13
|
+
| `src/lib/*` | Shared utilities (beUI `ease`, `tick-sound`) | — |
|
|
14
|
+
| `src/style.css` · `src/theme.css` | Tailwind entry + design tokens | — |
|
|
13
15
|
|
|
14
16
|
For **previews, props, and usage examples** of each component, use the upstream docs:
|
|
15
17
|
|
|
16
18
|
- shadcn: https://ui.shadcn.com/docs/components/`<name>`
|
|
17
19
|
- ReUI: https://reui.io/docs/components/base/`<name>` (or browse https://reui.io/components)
|
|
20
|
+
- beUI: https://beui.dev/components/motion/`<name>`
|
|
18
21
|
|
|
19
|
-
This package is a maintained distribution: imports rewritten for monorepo (`@kumix/utils`, relative paths), Biome/TypeScript clean, published via npm.
|
|
22
|
+
This package is a maintained distribution: imports rewritten for monorepo (`@kumix/utils`, relative paths), Biome/TypeScript clean, published via npm. Motion components bundle `motion`, `lenis`, and `@paper-design/shaders-react` — no extra installs needed.
|
|
20
23
|
|
|
21
24
|
## Install
|
|
22
25
|
|
|
@@ -64,10 +67,17 @@ import { Dialog, DialogContent } from "@kumix/ui/ui/dialog";
|
|
|
64
67
|
import { Kanban } from "@kumix/ui/reui/kanban";
|
|
65
68
|
import { DataGrid } from "@kumix/ui/reui/data-grid/data-grid";
|
|
66
69
|
|
|
70
|
+
// beUI (motion)
|
|
71
|
+
import { TiltCard } from "@kumix/ui/motion/tilt-card";
|
|
72
|
+
import { MorphingModal } from "@kumix/ui/motion/morphing-modal";
|
|
73
|
+
|
|
67
74
|
// hooks
|
|
68
75
|
import { useIsMobile } from "@kumix/ui/hooks/use-mobile";
|
|
69
76
|
import { useFileUpload } from "@kumix/ui/hooks/use-file-upload";
|
|
70
77
|
|
|
78
|
+
// lib (beUI helpers)
|
|
79
|
+
import { ease } from "@kumix/ui/lib/ease";
|
|
80
|
+
|
|
71
81
|
// styles (Tailwind v4)
|
|
72
82
|
import "@kumix/ui/css";
|
|
73
83
|
import "@kumix/ui/theme";
|
|
@@ -80,7 +90,10 @@ Mapped from source:
|
|
|
80
90
|
| `src/components/ui/button.tsx` | `@kumix/ui/ui/button` |
|
|
81
91
|
| `src/components/reui/kanban.tsx` | `@kumix/ui/reui/kanban` |
|
|
82
92
|
| `src/components/reui/data-grid/data-grid.tsx` | `@kumix/ui/reui/data-grid/data-grid` |
|
|
93
|
+
| `src/components/motion/tilt-card.tsx` | `@kumix/ui/motion/tilt-card` |
|
|
94
|
+
| `src/components/motion/morphing-modal.tsx` | `@kumix/ui/motion/morphing-modal` |
|
|
83
95
|
| `src/hooks/use-mobile.ts` | `@kumix/ui/hooks/use-mobile` |
|
|
96
|
+
| `src/lib/ease.ts` | `@kumix/ui/lib/ease` |
|
|
84
97
|
| `src/style.css` | `@kumix/ui/css` |
|
|
85
98
|
| `src/theme.css` | `@kumix/ui/theme` |
|
|
86
99
|
|
|
@@ -108,12 +121,20 @@ Extended patterns. Preview: [reui.io](https://reui.io/docs).
|
|
|
108
121
|
| `gantt/*` | Day–year scales, resources, DnD |
|
|
109
122
|
| `icon-stack` · `kanban` · `number-field` · `phone-input` · `rating` · `scrollspy` · `sortable` · `stepper` · `timeline` · `tree` | — |
|
|
110
123
|
|
|
124
|
+
### beUI (`components/motion`)
|
|
125
|
+
|
|
126
|
+
Animated components built with [Motion](https://motion.dev). Preview: [beui.dev](https://beui.dev/components/motion). Bundled — `motion`, `lenis`, `@paper-design/shaders-react` are included, no extra installs needed.
|
|
127
|
+
|
|
128
|
+
`action-swap` · `animated-badge` · `animated-number` · `animated-sidebar` · `animated-toast-stack` · `bottom-sheet` · `bounce-sidebar` · `bouncy-accordion` · `button/*` (base, stateful, magnetic) · `center-morph-modal` · `checkbox` · `chromatic-text-reveal` · `context-menu` · `cylinder-carousel` · `dock` · `drawer` · `hold-action-button` · `input` · `loader` · `marquee` · `magnetic` · `morphing-modal` · `number-ticker` · `parallax` · `popover` · `popover-morph` · `preview-rail` · `pull-to-refresh` · `radio` · `range-slider` (5 variants) · `scroll-progress` · `scroll-reveal` · `scroll-to` · `select` · `select-morph` · `shader-background` · `shared-layout-bg` · `slide-action-button` · `smooth-scroll` · `switch` · `table/*` (virtualized, editable, async) · `tabs` · `text-cascade` · `text-reveal` · `text-shimmer` · `theme-toggle` · `tilt-card` · `tooltip` · `wheel-picker`
|
|
129
|
+
|
|
111
130
|
### Hooks
|
|
112
131
|
|
|
113
|
-
`use-body-classes` · `use-copy-to-clipboard` · `use-file-upload` · `use-hydrated` · `use-intersection-observer` · `use-is-mac` · `use-media-query` · `use-meta-color` · `use-mobile` · `use-mutation-observer` · `use-scroll-position` · `use-slider-input` · `use-viewport`
|
|
132
|
+
`use-body-classes` · `use-copy-to-clipboard` · `use-file-upload` · `use-hover-capable` · `use-hydrated` · `use-intersection-observer` · `use-is-mac` · `use-media-query` · `use-meta-color` · `use-mobile` · `use-mutation-observer` · `use-scroll-position` · `use-slider` · `use-slider-input` · `use-viewport`
|
|
114
133
|
|
|
115
134
|
- `useIsMobile` (`use-mobile`) — fixed `768px` breakpoint; used by `sidebar` / `date-selector`. First paint may be `false` until mount.
|
|
116
135
|
- `useMediaQuery` — arbitrary query string; SSR-safe via `useSyncExternalStore` (server snapshot `false`).
|
|
136
|
+
- `useHoverCapable` — detects pointer/hover capability; used by beUI tilt-card.
|
|
137
|
+
- `useSlider` — shared slider input logic; used by beUI range-sliders.
|
|
117
138
|
|
|
118
139
|
## Styling
|
|
119
140
|
|
|
@@ -144,10 +165,11 @@ Refresh registry sources (from `packages/ui`):
|
|
|
144
165
|
```bash
|
|
145
166
|
bun run add:shadcn # shadcn add --all --overwrite
|
|
146
167
|
bun run add:reui # @reui/* components
|
|
168
|
+
bun run add:beui # @beui/* components (Motion-based)
|
|
147
169
|
node scripts/fix-imports.mjs # REQUIRED after CLI adds
|
|
148
170
|
```
|
|
149
171
|
|
|
150
|
-
`fix-imports.mjs` rewrites `@/lib/utils` → `@kumix/utils`, converts `@/components/*` / `@/hooks/*` to relative paths, and prepends `"use client"` when missing.
|
|
172
|
+
`fix-imports.mjs` rewrites `@/lib/utils` → `@kumix/utils`, converts `@/components/*` / `@/hooks/*` / `@/lib/*` to relative paths, handles all three registries (`ui`, `reui`, `motion`), and prepends `"use client"` when missing.
|
|
151
173
|
|
|
152
174
|
## License
|
|
153
175
|
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ActionSwapButtonProps, ActionSwapButtonSize, ActionSwapButtonVariant, ActionSwapIconProps, ActionSwapItem, ActionSwapTextProps } from "./action-swap.js";
|
|
2
|
+
//#region src/components/motion/action-swap-blur.d.ts
|
|
3
|
+
type ActionSwapBlurButtonProps = Omit<ActionSwapButtonProps, "animation">;
|
|
4
|
+
type ActionSwapBlurTextProps = Omit<ActionSwapTextProps, "animation">;
|
|
5
|
+
type ActionSwapBlurIconProps = Omit<ActionSwapIconProps, "animation">;
|
|
6
|
+
declare function ActionSwapBlurButton(props: ActionSwapBlurButtonProps): import("react").JSX.Element;
|
|
7
|
+
declare function ActionSwapBlurText(props: ActionSwapBlurTextProps): import("react").JSX.Element;
|
|
8
|
+
declare function ActionSwapBlurIcon(props: ActionSwapBlurIconProps): import("react").JSX.Element;
|
|
9
|
+
//#endregion
|
|
10
|
+
export { ActionSwapBlurButton, ActionSwapBlurButtonProps, ActionSwapBlurIcon, ActionSwapBlurIconProps, ActionSwapBlurText, ActionSwapBlurTextProps, type ActionSwapButtonSize, type ActionSwapButtonVariant, type ActionSwapItem };
|
|
11
|
+
//# sourceMappingURL=action-swap-blur.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"action-swap-blur.d.ts","names":[],"sources":["../../../src/components/motion/action-swap-blur.tsx"],"mappings":";;KAiBY,4BAA4B,KAAK;KACjC,0BAA0B,KAAK;KAC/B,0BAA0B,KAAK;iBAE3B,qBAAqB,OAAO,4CAAyB,IAAA;iBAIrD,mBAAmB,OAAO,0CAAuB,IAAA;iBAIjD,mBAAmB,OAAO,0CAAuB,IAAA"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { ActionSwapButton, ActionSwapIcon, ActionSwapText } from "./action-swap.js";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
//#region src/components/motion/action-swap-blur.tsx
|
|
5
|
+
function ActionSwapBlurButton(props) {
|
|
6
|
+
return /* @__PURE__ */ jsx(ActionSwapButton, {
|
|
7
|
+
...props,
|
|
8
|
+
animation: "blur"
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
function ActionSwapBlurText(props) {
|
|
12
|
+
return /* @__PURE__ */ jsx(ActionSwapText, {
|
|
13
|
+
...props,
|
|
14
|
+
animation: "blur"
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
function ActionSwapBlurIcon(props) {
|
|
18
|
+
return /* @__PURE__ */ jsx(ActionSwapIcon, {
|
|
19
|
+
...props,
|
|
20
|
+
animation: "blur"
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
//#endregion
|
|
24
|
+
export { ActionSwapBlurButton, ActionSwapBlurIcon, ActionSwapBlurText };
|
|
25
|
+
|
|
26
|
+
//# sourceMappingURL=action-swap-blur.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"action-swap-blur.js","names":[],"sources":["../../../src/components/motion/action-swap-blur.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n ActionSwapButton,\n type ActionSwapButtonProps,\n ActionSwapIcon,\n type ActionSwapIconProps,\n ActionSwapText,\n type ActionSwapTextProps,\n} from \"./action-swap\";\n\nexport type {\n ActionSwapButtonSize,\n ActionSwapButtonVariant,\n ActionSwapItem,\n} from \"./action-swap\";\n\nexport type ActionSwapBlurButtonProps = Omit<ActionSwapButtonProps, \"animation\">;\nexport type ActionSwapBlurTextProps = Omit<ActionSwapTextProps, \"animation\">;\nexport type ActionSwapBlurIconProps = Omit<ActionSwapIconProps, \"animation\">;\n\nexport function ActionSwapBlurButton(props: ActionSwapBlurButtonProps) {\n return <ActionSwapButton {...props} animation=\"blur\" />;\n}\n\nexport function ActionSwapBlurText(props: ActionSwapBlurTextProps) {\n return <ActionSwapText {...props} animation=\"blur\" />;\n}\n\nexport function ActionSwapBlurIcon(props: ActionSwapBlurIconProps) {\n return <ActionSwapIcon {...props} animation=\"blur\" />;\n}\n"],"mappings":";;;;AAqBA,SAAgB,qBAAqB,OAAkC;CACrE,OAAO,oBAAC,kBAAD;EAAkB,GAAI;EAAO,WAAU;CAAQ,CAAA;AACxD;AAEA,SAAgB,mBAAmB,OAAgC;CACjE,OAAO,oBAAC,gBAAD;EAAgB,GAAI;EAAO,WAAU;CAAQ,CAAA;AACtD;AAEA,SAAgB,mBAAmB,OAAgC;CACjE,OAAO,oBAAC,gBAAD;EAAgB,GAAI;EAAO,WAAU;CAAQ,CAAA;AACtD"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ActionSwapButtonProps, ActionSwapButtonSize, ActionSwapButtonVariant, ActionSwapIconProps, ActionSwapItem, ActionSwapTextProps } from "./action-swap.js";
|
|
2
|
+
//#region src/components/motion/action-swap-cascade.d.ts
|
|
3
|
+
type ActionSwapCascadeButtonProps = Omit<ActionSwapButtonProps, "animation">;
|
|
4
|
+
type ActionSwapCascadeTextProps = Omit<ActionSwapTextProps, "animation">;
|
|
5
|
+
type ActionSwapCascadeIconProps = Omit<ActionSwapIconProps, "animation">;
|
|
6
|
+
declare function ActionSwapCascadeButton(props: ActionSwapCascadeButtonProps): import("react").JSX.Element;
|
|
7
|
+
declare function ActionSwapCascadeText(props: ActionSwapCascadeTextProps): import("react").JSX.Element;
|
|
8
|
+
declare function ActionSwapCascadeIcon(props: ActionSwapCascadeIconProps): import("react").JSX.Element;
|
|
9
|
+
//#endregion
|
|
10
|
+
export { type ActionSwapButtonSize, type ActionSwapButtonVariant, ActionSwapCascadeButton, ActionSwapCascadeButtonProps, ActionSwapCascadeIcon, ActionSwapCascadeIconProps, ActionSwapCascadeText, ActionSwapCascadeTextProps, type ActionSwapItem };
|
|
11
|
+
//# sourceMappingURL=action-swap-cascade.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"action-swap-cascade.d.ts","names":[],"sources":["../../../src/components/motion/action-swap-cascade.tsx"],"mappings":";;KAiBY,+BAA+B,KAAK;KACpC,6BAA6B,KAAK;KAClC,6BAA6B,KAAK;iBAE9B,wBAAwB,OAAO,+CAA4B,IAAA;iBAI3D,sBAAsB,OAAO,6CAA0B,IAAA;iBAIvD,sBAAsB,OAAO,6CAA0B,IAAA"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { ActionSwapButton, ActionSwapIcon, ActionSwapText } from "./action-swap.js";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
//#region src/components/motion/action-swap-cascade.tsx
|
|
5
|
+
function ActionSwapCascadeButton(props) {
|
|
6
|
+
return /* @__PURE__ */ jsx(ActionSwapButton, {
|
|
7
|
+
...props,
|
|
8
|
+
animation: "cascade"
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
function ActionSwapCascadeText(props) {
|
|
12
|
+
return /* @__PURE__ */ jsx(ActionSwapText, {
|
|
13
|
+
...props,
|
|
14
|
+
animation: "cascade"
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
function ActionSwapCascadeIcon(props) {
|
|
18
|
+
return /* @__PURE__ */ jsx(ActionSwapIcon, {
|
|
19
|
+
...props,
|
|
20
|
+
animation: "cascade"
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
//#endregion
|
|
24
|
+
export { ActionSwapCascadeButton, ActionSwapCascadeIcon, ActionSwapCascadeText };
|
|
25
|
+
|
|
26
|
+
//# sourceMappingURL=action-swap-cascade.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"action-swap-cascade.js","names":[],"sources":["../../../src/components/motion/action-swap-cascade.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n ActionSwapButton,\n type ActionSwapButtonProps,\n ActionSwapIcon,\n type ActionSwapIconProps,\n ActionSwapText,\n type ActionSwapTextProps,\n} from \"./action-swap\";\n\nexport type {\n ActionSwapButtonSize,\n ActionSwapButtonVariant,\n ActionSwapItem,\n} from \"./action-swap\";\n\nexport type ActionSwapCascadeButtonProps = Omit<ActionSwapButtonProps, \"animation\">;\nexport type ActionSwapCascadeTextProps = Omit<ActionSwapTextProps, \"animation\">;\nexport type ActionSwapCascadeIconProps = Omit<ActionSwapIconProps, \"animation\">;\n\nexport function ActionSwapCascadeButton(props: ActionSwapCascadeButtonProps) {\n return <ActionSwapButton {...props} animation=\"cascade\" />;\n}\n\nexport function ActionSwapCascadeText(props: ActionSwapCascadeTextProps) {\n return <ActionSwapText {...props} animation=\"cascade\" />;\n}\n\nexport function ActionSwapCascadeIcon(props: ActionSwapCascadeIconProps) {\n return <ActionSwapIcon {...props} animation=\"cascade\" />;\n}\n"],"mappings":";;;;AAqBA,SAAgB,wBAAwB,OAAqC;CAC3E,OAAO,oBAAC,kBAAD;EAAkB,GAAI;EAAO,WAAU;CAAW,CAAA;AAC3D;AAEA,SAAgB,sBAAsB,OAAmC;CACvE,OAAO,oBAAC,gBAAD;EAAgB,GAAI;EAAO,WAAU;CAAW,CAAA;AACzD;AAEA,SAAgB,sBAAsB,OAAmC;CACvE,OAAO,oBAAC,gBAAD;EAAgB,GAAI;EAAO,WAAU;CAAW,CAAA;AACzD"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ActionSwapButtonProps, ActionSwapButtonSize, ActionSwapButtonVariant, ActionSwapIconProps, ActionSwapItem, ActionSwapTextProps } from "./action-swap.js";
|
|
2
|
+
//#region src/components/motion/action-swap-roll.d.ts
|
|
3
|
+
type ActionSwapRollButtonProps = Omit<ActionSwapButtonProps, "animation">;
|
|
4
|
+
type ActionSwapRollTextProps = Omit<ActionSwapTextProps, "animation">;
|
|
5
|
+
type ActionSwapRollIconProps = Omit<ActionSwapIconProps, "animation">;
|
|
6
|
+
declare function ActionSwapRollButton(props: ActionSwapRollButtonProps): import("react").JSX.Element;
|
|
7
|
+
declare function ActionSwapRollText(props: ActionSwapRollTextProps): import("react").JSX.Element;
|
|
8
|
+
declare function ActionSwapRollIcon(props: ActionSwapRollIconProps): import("react").JSX.Element;
|
|
9
|
+
//#endregion
|
|
10
|
+
export { type ActionSwapButtonSize, type ActionSwapButtonVariant, type ActionSwapItem, ActionSwapRollButton, ActionSwapRollButtonProps, ActionSwapRollIcon, ActionSwapRollIconProps, ActionSwapRollText, ActionSwapRollTextProps };
|
|
11
|
+
//# sourceMappingURL=action-swap-roll.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"action-swap-roll.d.ts","names":[],"sources":["../../../src/components/motion/action-swap-roll.tsx"],"mappings":";;KAiBY,4BAA4B,KAAK;KACjC,0BAA0B,KAAK;KAC/B,0BAA0B,KAAK;iBAE3B,qBAAqB,OAAO,4CAAyB,IAAA;iBAIrD,mBAAmB,OAAO,0CAAuB,IAAA;iBAIjD,mBAAmB,OAAO,0CAAuB,IAAA"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { ActionSwapButton, ActionSwapIcon, ActionSwapText } from "./action-swap.js";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
//#region src/components/motion/action-swap-roll.tsx
|
|
5
|
+
function ActionSwapRollButton(props) {
|
|
6
|
+
return /* @__PURE__ */ jsx(ActionSwapButton, {
|
|
7
|
+
...props,
|
|
8
|
+
animation: "roll"
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
function ActionSwapRollText(props) {
|
|
12
|
+
return /* @__PURE__ */ jsx(ActionSwapText, {
|
|
13
|
+
...props,
|
|
14
|
+
animation: "roll"
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
function ActionSwapRollIcon(props) {
|
|
18
|
+
return /* @__PURE__ */ jsx(ActionSwapIcon, {
|
|
19
|
+
...props,
|
|
20
|
+
animation: "roll"
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
//#endregion
|
|
24
|
+
export { ActionSwapRollButton, ActionSwapRollIcon, ActionSwapRollText };
|
|
25
|
+
|
|
26
|
+
//# sourceMappingURL=action-swap-roll.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"action-swap-roll.js","names":[],"sources":["../../../src/components/motion/action-swap-roll.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n ActionSwapButton,\n type ActionSwapButtonProps,\n ActionSwapIcon,\n type ActionSwapIconProps,\n ActionSwapText,\n type ActionSwapTextProps,\n} from \"./action-swap\";\n\nexport type {\n ActionSwapButtonSize,\n ActionSwapButtonVariant,\n ActionSwapItem,\n} from \"./action-swap\";\n\nexport type ActionSwapRollButtonProps = Omit<ActionSwapButtonProps, \"animation\">;\nexport type ActionSwapRollTextProps = Omit<ActionSwapTextProps, \"animation\">;\nexport type ActionSwapRollIconProps = Omit<ActionSwapIconProps, \"animation\">;\n\nexport function ActionSwapRollButton(props: ActionSwapRollButtonProps) {\n return <ActionSwapButton {...props} animation=\"roll\" />;\n}\n\nexport function ActionSwapRollText(props: ActionSwapRollTextProps) {\n return <ActionSwapText {...props} animation=\"roll\" />;\n}\n\nexport function ActionSwapRollIcon(props: ActionSwapRollIconProps) {\n return <ActionSwapIcon {...props} animation=\"roll\" />;\n}\n"],"mappings":";;;;AAqBA,SAAgB,qBAAqB,OAAkC;CACrE,OAAO,oBAAC,kBAAD;EAAkB,GAAI;EAAO,WAAU;CAAQ,CAAA;AACxD;AAEA,SAAgB,mBAAmB,OAAgC;CACjE,OAAO,oBAAC,gBAAD;EAAgB,GAAI;EAAO,WAAU;CAAQ,CAAA;AACtD;AAEA,SAAgB,mBAAmB,OAAgC;CACjE,OAAO,oBAAC,gBAAD;EAAgB,GAAI;EAAO,WAAU;CAAQ,CAAA;AACtD"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
import { HTMLMotionProps } from "motion/react";
|
|
3
|
+
//#region src/components/motion/action-swap.d.ts
|
|
4
|
+
type ActionSwapItem = {
|
|
5
|
+
id: string;
|
|
6
|
+
label: ReactNode;
|
|
7
|
+
icon?: ReactNode;
|
|
8
|
+
ariaLabel?: string;
|
|
9
|
+
};
|
|
10
|
+
type ActionSwapButtonVariant = "primary" | "secondary" | "outline" | "ghost";
|
|
11
|
+
type ActionSwapButtonSize = "sm" | "md" | "lg" | "icon";
|
|
12
|
+
type ActionSwapAnimation = "blur" | "roll" | "cascade";
|
|
13
|
+
interface ActionSwapButtonProps extends Omit<HTMLMotionProps<"button">, "children" | "onChange"> {
|
|
14
|
+
items: ActionSwapItem[];
|
|
15
|
+
value?: string;
|
|
16
|
+
defaultValue?: string;
|
|
17
|
+
onValueChange?: (value: string, item: ActionSwapItem) => void;
|
|
18
|
+
variant?: ActionSwapButtonVariant;
|
|
19
|
+
size?: ActionSwapButtonSize;
|
|
20
|
+
animation?: ActionSwapAnimation;
|
|
21
|
+
iconOnly?: boolean;
|
|
22
|
+
cycle?: boolean;
|
|
23
|
+
}
|
|
24
|
+
interface ActionSwapTextProps {
|
|
25
|
+
value: string;
|
|
26
|
+
children: ReactNode;
|
|
27
|
+
animation?: ActionSwapAnimation;
|
|
28
|
+
className?: string;
|
|
29
|
+
}
|
|
30
|
+
interface ActionSwapIconProps {
|
|
31
|
+
value: string;
|
|
32
|
+
children: ReactNode;
|
|
33
|
+
animation?: ActionSwapAnimation;
|
|
34
|
+
className?: string;
|
|
35
|
+
}
|
|
36
|
+
declare function ActionSwapText({ value, children, animation, className }: ActionSwapTextProps): import("react").JSX.Element;
|
|
37
|
+
declare function ActionSwapIcon({ value, children, animation, className }: ActionSwapIconProps): import("react").JSX.Element;
|
|
38
|
+
declare function ActionSwapButton({ items, value, defaultValue, onValueChange, variant, size, animation, iconOnly, cycle, className, disabled, onClick, ...rest }: ActionSwapButtonProps): import("react").JSX.Element | null;
|
|
39
|
+
//#endregion
|
|
40
|
+
export { ActionSwapAnimation, ActionSwapButton, ActionSwapButtonProps, ActionSwapButtonSize, ActionSwapButtonVariant, ActionSwapIcon, ActionSwapIconProps, ActionSwapItem, ActionSwapText, ActionSwapTextProps };
|
|
41
|
+
//# sourceMappingURL=action-swap.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"action-swap.d.ts","names":[],"sources":["../../../src/components/motion/action-swap.tsx"],"mappings":";;;KAcY;EACV;EACA,OAAO;EACP,OAAO;EACP;;KAGU;KACA;KACA;UAKK,8BACP,KAAK;EACb,OAAO;EACP;EACA;EACA,iBAAiB,eAAe,MAAM;EACtC,UAAU;EACV,OAAO;EACP,YAAY;EACZ;EACA;;UAGe;EACf;EACA,UAAU;EACV,YAAY;EACZ;;UAGe;EACf;EACA,UAAU;EACV,YAAY;EACZ;;iBA+Gc,iBACd,OACA,UACA,WACA,aACC,sCAAmB,IAAA;iBA2EN,iBACd,OACA,UACA,WACA,aACC,sCAAmB,IAAA;iBA0BN,mBACd,OACA,OACA,cACA,eACA,SACA,MACA,WACA,UACA,OACA,WACA,UACA,YACG,QACF,wCAAqB,IAAA"}
|
|
@@ -0,0 +1,261 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { EASE_OUT, EASE_OUT_CSS, SPRING_PRESS, SPRING_SWAP } from "../../lib/ease.js";
|
|
3
|
+
import { useLayoutEffect, useRef, useState } from "react";
|
|
4
|
+
import { cn } from "@kumix/utils";
|
|
5
|
+
import { AnimatePresence, motion, useReducedMotion } from "motion/react";
|
|
6
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
//#region src/components/motion/action-swap.tsx
|
|
8
|
+
const BLUR_TRANSITION = {
|
|
9
|
+
duration: .2,
|
|
10
|
+
ease: "easeInOut"
|
|
11
|
+
};
|
|
12
|
+
const ROLL_TRANSITION = SPRING_SWAP;
|
|
13
|
+
const ROLL_EXIT_TRANSITION = {
|
|
14
|
+
duration: .14,
|
|
15
|
+
ease: EASE_OUT
|
|
16
|
+
};
|
|
17
|
+
const SWAP_BLUR = "blur(8px)";
|
|
18
|
+
const ROLL_BLUR = "blur(3px)";
|
|
19
|
+
const CASCADE_STAGGER = .025;
|
|
20
|
+
const CASCADE_LETTER_VARIANTS = {
|
|
21
|
+
initial: {
|
|
22
|
+
opacity: 0,
|
|
23
|
+
y: "105%",
|
|
24
|
+
filter: ROLL_BLUR
|
|
25
|
+
},
|
|
26
|
+
animate: (delay = 0) => ({
|
|
27
|
+
opacity: 1,
|
|
28
|
+
y: "0%",
|
|
29
|
+
filter: "blur(0px)",
|
|
30
|
+
transition: {
|
|
31
|
+
...SPRING_SWAP,
|
|
32
|
+
delay
|
|
33
|
+
}
|
|
34
|
+
}),
|
|
35
|
+
exit: (delay = 0) => ({
|
|
36
|
+
opacity: 0,
|
|
37
|
+
y: "-105%",
|
|
38
|
+
filter: ROLL_BLUR,
|
|
39
|
+
transition: {
|
|
40
|
+
duration: .16,
|
|
41
|
+
ease: EASE_OUT,
|
|
42
|
+
delay: delay * .5
|
|
43
|
+
}
|
|
44
|
+
})
|
|
45
|
+
};
|
|
46
|
+
const TEXT_VARIANTS = {
|
|
47
|
+
blur: {
|
|
48
|
+
initial: {
|
|
49
|
+
opacity: 0,
|
|
50
|
+
scale: .94,
|
|
51
|
+
filter: SWAP_BLUR
|
|
52
|
+
},
|
|
53
|
+
animate: {
|
|
54
|
+
opacity: 1,
|
|
55
|
+
scale: 1,
|
|
56
|
+
filter: "blur(0px)",
|
|
57
|
+
transition: BLUR_TRANSITION
|
|
58
|
+
},
|
|
59
|
+
exit: {
|
|
60
|
+
opacity: 0,
|
|
61
|
+
scale: .94,
|
|
62
|
+
filter: SWAP_BLUR,
|
|
63
|
+
transition: BLUR_TRANSITION
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
roll: {
|
|
67
|
+
initial: {
|
|
68
|
+
opacity: 0,
|
|
69
|
+
y: "90%",
|
|
70
|
+
filter: ROLL_BLUR
|
|
71
|
+
},
|
|
72
|
+
animate: {
|
|
73
|
+
opacity: 1,
|
|
74
|
+
y: "0%",
|
|
75
|
+
filter: "blur(0px)",
|
|
76
|
+
transition: ROLL_TRANSITION
|
|
77
|
+
},
|
|
78
|
+
exit: {
|
|
79
|
+
opacity: 0,
|
|
80
|
+
y: "-90%",
|
|
81
|
+
filter: ROLL_BLUR,
|
|
82
|
+
transition: ROLL_EXIT_TRANSITION
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
const ICON_VARIANTS = {
|
|
87
|
+
blur: {
|
|
88
|
+
initial: {
|
|
89
|
+
opacity: 0,
|
|
90
|
+
scale: .25,
|
|
91
|
+
filter: SWAP_BLUR
|
|
92
|
+
},
|
|
93
|
+
animate: {
|
|
94
|
+
opacity: 1,
|
|
95
|
+
scale: 1,
|
|
96
|
+
filter: "blur(0px)",
|
|
97
|
+
transition: BLUR_TRANSITION
|
|
98
|
+
},
|
|
99
|
+
exit: {
|
|
100
|
+
opacity: 0,
|
|
101
|
+
scale: .25,
|
|
102
|
+
filter: SWAP_BLUR,
|
|
103
|
+
transition: BLUR_TRANSITION
|
|
104
|
+
}
|
|
105
|
+
},
|
|
106
|
+
roll: {
|
|
107
|
+
initial: {
|
|
108
|
+
opacity: 0,
|
|
109
|
+
y: 12,
|
|
110
|
+
filter: ROLL_BLUR
|
|
111
|
+
},
|
|
112
|
+
animate: {
|
|
113
|
+
opacity: 1,
|
|
114
|
+
y: 0,
|
|
115
|
+
filter: "blur(0px)",
|
|
116
|
+
transition: ROLL_TRANSITION
|
|
117
|
+
},
|
|
118
|
+
exit: {
|
|
119
|
+
opacity: 0,
|
|
120
|
+
y: -12,
|
|
121
|
+
filter: ROLL_BLUR,
|
|
122
|
+
transition: ROLL_EXIT_TRANSITION
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
};
|
|
126
|
+
const VARIANT_CLASS = {
|
|
127
|
+
primary: "bg-primary text-primary-foreground hover:bg-primary/90",
|
|
128
|
+
secondary: "border border-border bg-card text-foreground hover:border-border",
|
|
129
|
+
outline: "border border-border bg-transparent text-foreground hover:bg-primary/5",
|
|
130
|
+
ghost: "text-muted-foreground hover:bg-primary/5 hover:text-foreground"
|
|
131
|
+
};
|
|
132
|
+
const SIZE_CLASS = {
|
|
133
|
+
sm: "h-8 gap-1.5 rounded-full px-3 text-xs",
|
|
134
|
+
md: "h-10 gap-2 rounded-full px-4 text-sm",
|
|
135
|
+
lg: "h-12 gap-2.5 rounded-full px-5 text-base",
|
|
136
|
+
icon: "h-10 w-10 rounded-full"
|
|
137
|
+
};
|
|
138
|
+
function ActionSwapText({ value, children, animation = "blur", className }) {
|
|
139
|
+
const reduce = useReducedMotion();
|
|
140
|
+
const measureRef = useRef(null);
|
|
141
|
+
const [width, setWidth] = useState();
|
|
142
|
+
useLayoutEffect(() => {
|
|
143
|
+
const nextWidth = measureRef.current?.offsetWidth;
|
|
144
|
+
if (!nextWidth) return;
|
|
145
|
+
setWidth((currentWidth) => currentWidth === nextWidth ? currentWidth : nextWidth);
|
|
146
|
+
});
|
|
147
|
+
const label = typeof children === "string" ? children : null;
|
|
148
|
+
const cascade = animation === "cascade" && label !== null && !reduce;
|
|
149
|
+
const coreAnimation = animation === "cascade" ? "roll" : animation;
|
|
150
|
+
return /* @__PURE__ */ jsxs("span", {
|
|
151
|
+
className: cn("relative inline-block overflow-hidden whitespace-nowrap align-bottom", className),
|
|
152
|
+
style: {
|
|
153
|
+
width,
|
|
154
|
+
transition: reduce ? void 0 : `width 220ms ${EASE_OUT_CSS}`
|
|
155
|
+
},
|
|
156
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
157
|
+
ref: measureRef,
|
|
158
|
+
"aria-hidden": true,
|
|
159
|
+
className: "invisible inline-block whitespace-nowrap",
|
|
160
|
+
children
|
|
161
|
+
}), cascade ? /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("span", {
|
|
162
|
+
className: "sr-only",
|
|
163
|
+
children: label
|
|
164
|
+
}), /* @__PURE__ */ jsx(AnimatePresence, {
|
|
165
|
+
initial: false,
|
|
166
|
+
children: /* @__PURE__ */ jsx(motion.span, {
|
|
167
|
+
"aria-hidden": true,
|
|
168
|
+
initial: "initial",
|
|
169
|
+
animate: "animate",
|
|
170
|
+
exit: "exit",
|
|
171
|
+
className: "absolute top-0 left-0 inline-block whitespace-pre",
|
|
172
|
+
children: label.split("").map((char, i) => /* @__PURE__ */ jsx(motion.span, {
|
|
173
|
+
custom: i * CASCADE_STAGGER,
|
|
174
|
+
variants: CASCADE_LETTER_VARIANTS,
|
|
175
|
+
className: "inline-block whitespace-pre will-change-[opacity,filter,transform]",
|
|
176
|
+
children: char
|
|
177
|
+
}, i))
|
|
178
|
+
}, `cascade-${value}`)
|
|
179
|
+
})] }) : /* @__PURE__ */ jsx(AnimatePresence, {
|
|
180
|
+
initial: false,
|
|
181
|
+
children: /* @__PURE__ */ jsx(motion.span, {
|
|
182
|
+
variants: TEXT_VARIANTS[coreAnimation],
|
|
183
|
+
initial: reduce ? false : "initial",
|
|
184
|
+
animate: reduce ? {
|
|
185
|
+
opacity: 1,
|
|
186
|
+
filter: "blur(0px)",
|
|
187
|
+
scale: 1,
|
|
188
|
+
y: 0
|
|
189
|
+
} : "animate",
|
|
190
|
+
exit: reduce ? void 0 : "exit",
|
|
191
|
+
className: "absolute top-0 left-0 inline-block will-change-[opacity,filter,transform]",
|
|
192
|
+
children
|
|
193
|
+
}, `${animation}-${value}`)
|
|
194
|
+
})]
|
|
195
|
+
});
|
|
196
|
+
}
|
|
197
|
+
function ActionSwapIcon({ value, children, animation = "blur", className }) {
|
|
198
|
+
const reduce = useReducedMotion();
|
|
199
|
+
const coreAnimation = animation === "cascade" ? "roll" : animation;
|
|
200
|
+
return /* @__PURE__ */ jsx("span", {
|
|
201
|
+
className: cn("relative inline-grid shrink-0 place-items-center overflow-hidden", className),
|
|
202
|
+
children: /* @__PURE__ */ jsx(AnimatePresence, {
|
|
203
|
+
mode: "popLayout",
|
|
204
|
+
initial: false,
|
|
205
|
+
children: /* @__PURE__ */ jsx(motion.span, {
|
|
206
|
+
"aria-hidden": true,
|
|
207
|
+
variants: ICON_VARIANTS[coreAnimation],
|
|
208
|
+
initial: reduce ? false : "initial",
|
|
209
|
+
animate: reduce ? {
|
|
210
|
+
opacity: 1,
|
|
211
|
+
filter: "blur(0px)",
|
|
212
|
+
scale: 1,
|
|
213
|
+
y: 0
|
|
214
|
+
} : "animate",
|
|
215
|
+
exit: reduce ? void 0 : "exit",
|
|
216
|
+
className: "col-start-1 row-start-1 inline-flex items-center justify-center will-change-[opacity,filter,transform]",
|
|
217
|
+
children
|
|
218
|
+
}, `${animation}-${value}`)
|
|
219
|
+
})
|
|
220
|
+
});
|
|
221
|
+
}
|
|
222
|
+
function ActionSwapButton({ items, value, defaultValue, onValueChange, variant = "secondary", size = "md", animation = "blur", iconOnly = size === "icon", cycle = true, className, disabled, onClick, ...rest }) {
|
|
223
|
+
const reduce = useReducedMotion();
|
|
224
|
+
const [internalValue, setInternalValue] = useState(defaultValue ?? items[0]?.id);
|
|
225
|
+
const currentValue = value ?? internalValue;
|
|
226
|
+
const activeIndex = Math.max(0, items.findIndex((item) => item.id === currentValue));
|
|
227
|
+
const activeItem = items[activeIndex] ?? items[0];
|
|
228
|
+
const hasIcon = items.some((item) => item.icon);
|
|
229
|
+
const nextItem = cycle && items.length > 0 ? items[(activeIndex + 1) % items.length] : void 0;
|
|
230
|
+
if (!activeItem) return null;
|
|
231
|
+
const accessibleLabel = activeItem.ariaLabel ?? (iconOnly && typeof activeItem.label === "string" ? activeItem.label : void 0);
|
|
232
|
+
return /* @__PURE__ */ jsxs(motion.button, {
|
|
233
|
+
type: "button",
|
|
234
|
+
disabled,
|
|
235
|
+
whileTap: reduce || disabled ? void 0 : { scale: .97 },
|
|
236
|
+
transition: SPRING_PRESS,
|
|
237
|
+
className: cn("inline-flex items-center justify-center overflow-hidden font-medium transition-colors", "disabled:pointer-events-none disabled:opacity-50", VARIANT_CLASS[variant], SIZE_CLASS[size], className),
|
|
238
|
+
"aria-label": accessibleLabel,
|
|
239
|
+
onClick: (event) => {
|
|
240
|
+
onClick?.(event);
|
|
241
|
+
if (event.defaultPrevented || disabled || !cycle || !nextItem) return;
|
|
242
|
+
if (value === void 0) setInternalValue(nextItem.id);
|
|
243
|
+
onValueChange?.(nextItem.id, nextItem);
|
|
244
|
+
},
|
|
245
|
+
...rest,
|
|
246
|
+
children: [hasIcon ? /* @__PURE__ */ jsx(ActionSwapIcon, {
|
|
247
|
+
value: activeItem.id,
|
|
248
|
+
animation,
|
|
249
|
+
className: "h-4 w-4",
|
|
250
|
+
children: activeItem.icon ?? null
|
|
251
|
+
}) : null, !iconOnly ? /* @__PURE__ */ jsx(ActionSwapText, {
|
|
252
|
+
value: activeItem.id,
|
|
253
|
+
animation,
|
|
254
|
+
children: activeItem.label
|
|
255
|
+
}) : null]
|
|
256
|
+
});
|
|
257
|
+
}
|
|
258
|
+
//#endregion
|
|
259
|
+
export { ActionSwapButton, ActionSwapIcon, ActionSwapText };
|
|
260
|
+
|
|
261
|
+
//# sourceMappingURL=action-swap.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"action-swap.js","names":[],"sources":["../../../src/components/motion/action-swap.tsx"],"sourcesContent":["\"use client\";\n\nimport { type ReactNode, useLayoutEffect, useRef, 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, EASE_OUT_CSS, 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 const measureRef = useRef<HTMLSpanElement>(null);\n const [width, setWidth] = useState<number>();\n\n useLayoutEffect(() => {\n const nextWidth = measureRef.current?.offsetWidth;\n if (!nextWidth) return;\n setWidth((currentWidth) => (currentWidth === nextWidth ? currentWidth : nextWidth));\n });\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 inline-block overflow-hidden whitespace-nowrap align-bottom\",\n className,\n )}\n style={{\n width,\n transition: reduce ? undefined : `width 220ms ${EASE_OUT_CSS}`,\n }}\n >\n <span ref={measureRef} aria-hidden className=\"invisible inline-block whitespace-nowrap\">\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 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 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":"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"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
import { HTMLMotionProps } from "motion/react";
|
|
3
|
+
//#region src/components/motion/animated-badge.d.ts
|
|
4
|
+
type AnimatedBadgeStatus = "neutral" | "info" | "success" | "warning" | "danger" | "loading";
|
|
5
|
+
type AnimatedBadgeSize = "sm" | "md";
|
|
6
|
+
interface AnimatedBadgeProps extends Omit<HTMLMotionProps<"span">, "children"> {
|
|
7
|
+
status?: AnimatedBadgeStatus;
|
|
8
|
+
size?: AnimatedBadgeSize;
|
|
9
|
+
children?: ReactNode;
|
|
10
|
+
icon?: ReactNode;
|
|
11
|
+
showIcon?: boolean;
|
|
12
|
+
pulse?: boolean;
|
|
13
|
+
contentKey?: string | number;
|
|
14
|
+
}
|
|
15
|
+
declare function AnimatedBadge({ status, size, children, icon, showIcon, pulse, contentKey, className, ...rest }: AnimatedBadgeProps): import("react").JSX.Element;
|
|
16
|
+
//#endregion
|
|
17
|
+
export { AnimatedBadge, AnimatedBadgeProps, AnimatedBadgeSize, AnimatedBadgeStatus };
|
|
18
|
+
//# sourceMappingURL=animated-badge.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"animated-badge.d.ts","names":[],"sources":["../../../src/components/motion/animated-badge.tsx"],"mappings":";;;KAeY;KAEA;UAEK,2BAA2B,KAAK;EAC/C,SAAS;EACT,OAAO;EACP,WAAW;EACX,OAAO;EACP;EACA;EACA;;iBAmFc,gBACd,QACA,MACA,UACA,MACA,UACA,OACA,YACA,cACG,QACF,qCAAkB,IAAA"}
|