@kumix/ui 0.2.4 → 0.3.1
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 +45 -10
- package/dist/components/custom/confirm-dialog.d.ts +16 -0
- package/dist/components/custom/confirm-dialog.d.ts.map +1 -0
- package/dist/components/custom/confirm-dialog.js +93 -0
- package/dist/components/custom/confirm-dialog.js.map +1 -0
- package/dist/components/custom/toast.d.ts +20 -0
- package/dist/components/custom/toast.d.ts.map +1 -0
- package/dist/components/custom/toast.js +73 -0
- package/dist/components/custom/toast.js.map +1 -0
- 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/attachment-upload.d.ts +47 -0
- package/dist/components/motion/attachment-upload.d.ts.map +1 -0
- package/dist/components/motion/attachment-upload.js +737 -0
- package/dist/components/motion/attachment-upload.js.map +1 -0
- package/dist/components/motion/availability-scheduler/copy-menu.d.ts +10 -0
- package/dist/components/motion/availability-scheduler/copy-menu.d.ts.map +1 -0
- package/dist/components/motion/availability-scheduler/copy-menu.js +3 -0
- package/dist/components/motion/availability-scheduler/day-row.d.ts +15 -0
- package/dist/components/motion/availability-scheduler/day-row.d.ts.map +1 -0
- package/dist/components/motion/availability-scheduler/day-row.js +181 -0
- package/dist/components/motion/availability-scheduler/day-row.js.map +1 -0
- package/dist/components/motion/availability-scheduler/icon-button.d.ts +15 -0
- package/dist/components/motion/availability-scheduler/icon-button.d.ts.map +1 -0
- package/dist/components/motion/availability-scheduler/icon-button.js +24 -0
- package/dist/components/motion/availability-scheduler/icon-button.js.map +1 -0
- package/dist/components/motion/availability-scheduler/index.d.ts +14 -0
- package/dist/components/motion/availability-scheduler/index.d.ts.map +1 -0
- package/dist/components/motion/availability-scheduler/index.js +59 -0
- package/dist/components/motion/availability-scheduler/index.js.map +1 -0
- package/dist/components/motion/availability-scheduler/time-select.d.ts +10 -0
- package/dist/components/motion/availability-scheduler/time-select.d.ts.map +1 -0
- package/dist/components/motion/availability-scheduler/time-select.js +26 -0
- package/dist/components/motion/availability-scheduler/time-select.js.map +1 -0
- package/dist/components/motion/bloom-menu.d.ts +17 -0
- package/dist/components/motion/bloom-menu.d.ts.map +1 -0
- package/dist/components/motion/bloom-menu.js +170 -0
- package/dist/components/motion/bloom-menu.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/index.d.ts +4 -0
- package/dist/components/motion/button/index.js +5 -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/command-palette.d.ts +26 -0
- package/dist/components/motion/command-palette.d.ts.map +1 -0
- package/dist/components/motion/command-palette.js +246 -0
- package/dist/components/motion/command-palette.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/dynamic-island.d.ts +22 -0
- package/dist/components/motion/dynamic-island.d.ts.map +1 -0
- package/dist/components/motion/dynamic-island.js +143 -0
- package/dist/components/motion/dynamic-island.js.map +1 -0
- package/dist/components/motion/expandable-action-bar.d.ts +52 -0
- package/dist/components/motion/expandable-action-bar.d.ts.map +1 -0
- package/dist/components/motion/expandable-action-bar.js +191 -0
- package/dist/components/motion/expandable-action-bar.js.map +1 -0
- package/dist/components/motion/expandable-tabs.d.ts +33 -0
- package/dist/components/motion/expandable-tabs.d.ts.map +1 -0
- package/dist/components/motion/expandable-tabs.js +291 -0
- package/dist/components/motion/expandable-tabs.js.map +1 -0
- package/dist/components/motion/feedback-widget.d.ts +18 -0
- package/dist/components/motion/feedback-widget.d.ts.map +1 -0
- package/dist/components/motion/feedback-widget.js +413 -0
- package/dist/components/motion/feedback-widget.js.map +1 -0
- package/dist/components/motion/file-upload.d.ts +48 -0
- package/dist/components/motion/file-upload.d.ts.map +1 -0
- package/dist/components/motion/file-upload.js +382 -0
- package/dist/components/motion/file-upload.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/infinite-masonry.d.ts +31 -0
- package/dist/components/motion/infinite-masonry.d.ts.map +1 -0
- package/dist/components/motion/infinite-masonry.js +223 -0
- package/dist/components/motion/infinite-masonry.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/not-found/glitch.d.ts +6 -0
- package/dist/components/motion/not-found/glitch.d.ts.map +1 -0
- package/dist/components/motion/not-found/glitch.js +90 -0
- package/dist/components/motion/not-found/glitch.js.map +1 -0
- package/dist/components/motion/not-found/magnetic.d.ts +6 -0
- package/dist/components/motion/not-found/magnetic.d.ts.map +1 -0
- package/dist/components/motion/not-found/magnetic.js +47 -0
- package/dist/components/motion/not-found/magnetic.js.map +1 -0
- package/dist/components/motion/not-found/shared.d.ts +32 -0
- package/dist/components/motion/not-found/shared.d.ts.map +1 -0
- package/dist/components/motion/not-found/shared.js +52 -0
- package/dist/components/motion/not-found/shared.js.map +1 -0
- package/dist/components/motion/not-found/spotlight.d.ts +6 -0
- package/dist/components/motion/not-found/spotlight.d.ts.map +1 -0
- package/dist/components/motion/not-found/spotlight.js +70 -0
- package/dist/components/motion/not-found/spotlight.js.map +1 -0
- package/dist/components/motion/not-found/stacked.d.ts +6 -0
- package/dist/components/motion/not-found/stacked.d.ts.map +1 -0
- package/dist/components/motion/not-found/stacked.js +95 -0
- package/dist/components/motion/not-found/stacked.js.map +1 -0
- package/dist/components/motion/not-found/terminal.d.ts +6 -0
- package/dist/components/motion/not-found/terminal.d.ts.map +1 -0
- package/dist/components/motion/not-found/terminal.js +90 -0
- package/dist/components/motion/not-found/terminal.js.map +1 -0
- package/dist/components/motion/notification-stack.d.ts +35 -0
- package/dist/components/motion/notification-stack.d.ts.map +1 -0
- package/dist/components/motion/notification-stack.js +187 -0
- package/dist/components/motion/notification-stack.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/otp-input.d.ts +32 -0
- package/dist/components/motion/otp-input.d.ts.map +1 -0
- package/dist/components/motion/otp-input.js +272 -0
- package/dist/components/motion/otp-input.js.map +1 -0
- package/dist/components/motion/overflow-actions.d.ts +39 -0
- package/dist/components/motion/overflow-actions.d.ts.map +1 -0
- package/dist/components/motion/overflow-actions.js +220 -0
- package/dist/components/motion/overflow-actions.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/swipeable-list.d.ts +60 -0
- package/dist/components/motion/swipeable-list.d.ts.map +1 -0
- package/dist/components/motion/swipeable-list.js +254 -0
- package/dist/components/motion/swipeable-list.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/autocomplete.js +1 -1
- package/dist/components/reui/badge.d.ts +2 -2
- 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-column-filter.js +2 -2
- package/dist/components/reui/data-grid/data-grid-column-header.js +1 -1
- package/dist/components/reui/data-grid/data-grid-pagination.js +1 -1
- package/dist/components/reui/data-grid/data-grid-table-dnd-rows.js +1 -1
- package/dist/components/reui/data-grid/data-grid-table-dnd.js +22 -20
- 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 +5 -3
- package/dist/components/reui/data-grid/data-grid-table.js.map +1 -1
- package/dist/components/reui/date-selector.js +2 -2
- package/dist/components/reui/event-calendar/event-calendar-agenda-view.js +3 -2
- 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 +50 -48
- 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-month-view.js +1 -1
- package/dist/components/reui/event-calendar/event-calendar-nav.js +38 -32
- 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 +6 -4
- package/dist/components/reui/filters.js.map +1 -1
- package/dist/components/reui/frame.d.ts +1 -1
- package/dist/components/reui/gantt/gantt-bar.js +53 -52
- 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 +35 -31
- 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 +177 -173
- package/dist/components/reui/gantt/gantt-view.js.map +1 -1
- package/dist/components/reui/icon-tile.d.ts +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/phone-input.js +2 -2
- 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 +3 -2
- package/dist/components/reui/tree.js.map +1 -1
- package/dist/components/ui/accordion.js +1 -1
- package/dist/components/ui/alert-dialog.js +1 -1
- package/dist/components/ui/attachment.d.ts +2 -2
- package/dist/components/ui/badge.d.ts +1 -1
- package/dist/components/ui/breadcrumb.js +1 -1
- package/dist/components/ui/bubble.d.ts +1 -1
- package/dist/components/ui/button-group.d.ts +1 -1
- package/dist/components/ui/button.d.ts +3 -3
- package/dist/components/ui/button.js +1 -1
- package/dist/components/ui/calendar.js +1 -1
- package/dist/components/ui/carousel.js +1 -1
- package/dist/components/ui/checkbox.js +1 -1
- package/dist/components/ui/combobox.js +1 -1
- package/dist/components/ui/command.js +1 -1
- package/dist/components/ui/context-menu.js +1 -1
- package/dist/components/ui/dialog.js +1 -1
- package/dist/components/ui/dropdown-menu.js +1 -1
- package/dist/components/ui/empty.d.ts +1 -1
- package/dist/components/ui/field.d.ts +1 -1
- package/dist/components/ui/input-otp.js +1 -1
- package/dist/components/ui/item.d.ts +1 -1
- package/dist/components/ui/marker.d.ts +1 -1
- package/dist/components/ui/menubar.js +1 -1
- package/dist/components/ui/message-scroller.js +1 -1
- package/dist/components/ui/native-select.js +1 -1
- package/dist/components/ui/navigation-menu.js +1 -1
- package/dist/components/ui/pagination.js +1 -1
- package/dist/components/ui/select.js +1 -1
- package/dist/components/ui/sheet.js +1 -1
- package/dist/components/ui/sidebar.js +2 -2
- package/dist/components/ui/sidebar.js.map +1 -1
- package/dist/components/ui/sonner.js +1 -1
- package/dist/components/ui/spinner.js +1 -1
- package/dist/components/ui/toast.js +1 -1
- package/dist/copy-menu-BJ-MXnkN.js +201 -0
- package/dist/copy-menu-BJ-MXnkN.js.map +1 -0
- 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/types-Bah5NY44.d.ts +81 -0
- package/dist/types-Bah5NY44.d.ts.map +1 -0
- package/dist/types-smkWN_7x.d.ts +20 -0
- package/dist/types-smkWN_7x.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
|
@@ -0,0 +1,319 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { EASE_OUT } from "../../lib/ease.js";
|
|
3
|
+
import { createContext, useCallback, useContext, useEffect, useId, useLayoutEffect, useMemo, useRef, useState } from "react";
|
|
4
|
+
import { cn } from "@kumix/utils";
|
|
5
|
+
import { Check, ChevronDown } from "lucide-react";
|
|
6
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
import { motion, useReducedMotion } from "motion/react";
|
|
8
|
+
//#region src/components/motion/select.tsx
|
|
9
|
+
const INSTANT_TRANSITION = { duration: 0 };
|
|
10
|
+
const CHEVRON_TRANSITION = {
|
|
11
|
+
type: "spring",
|
|
12
|
+
duration: .4,
|
|
13
|
+
bounce: .3
|
|
14
|
+
};
|
|
15
|
+
const LIST_VARIANTS = {
|
|
16
|
+
hidden: {},
|
|
17
|
+
show: { transition: {
|
|
18
|
+
staggerChildren: .035,
|
|
19
|
+
delayChildren: .05
|
|
20
|
+
} }
|
|
21
|
+
};
|
|
22
|
+
const ITEM_VARIANTS = {
|
|
23
|
+
hidden: {
|
|
24
|
+
opacity: 0,
|
|
25
|
+
y: -6,
|
|
26
|
+
filter: "blur(3px)"
|
|
27
|
+
},
|
|
28
|
+
show: {
|
|
29
|
+
opacity: 1,
|
|
30
|
+
y: 0,
|
|
31
|
+
filter: "blur(0px)"
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
const SelectContext = createContext(null);
|
|
35
|
+
function useSelectContext(component) {
|
|
36
|
+
const ctx = useContext(SelectContext);
|
|
37
|
+
if (!ctx) throw new Error(`${component} must be used within <Select>`);
|
|
38
|
+
return ctx;
|
|
39
|
+
}
|
|
40
|
+
function Select({ value, defaultValue, onValueChange, disabled = false, className, children }) {
|
|
41
|
+
const reduce = useReducedMotion() ?? false;
|
|
42
|
+
const baseId = useId();
|
|
43
|
+
const rootRef = useRef(null);
|
|
44
|
+
const [open, setOpen] = useState(false);
|
|
45
|
+
const [internal, setInternal] = useState(defaultValue);
|
|
46
|
+
const [labels, setLabels] = useState(/* @__PURE__ */ new Map());
|
|
47
|
+
const [placement, setPlacement] = useState("bottom");
|
|
48
|
+
const controlled = value !== void 0;
|
|
49
|
+
const current = controlled ? value : internal;
|
|
50
|
+
const select = useCallback((next) => {
|
|
51
|
+
if (!controlled) setInternal(next);
|
|
52
|
+
onValueChange?.(next);
|
|
53
|
+
setOpen(false);
|
|
54
|
+
}, [controlled, onValueChange]);
|
|
55
|
+
const register = useCallback((v, label) => {
|
|
56
|
+
setLabels((m) => m.get(v) === label ? m : new Map(m).set(v, label));
|
|
57
|
+
}, []);
|
|
58
|
+
const unregister = useCallback((v) => {
|
|
59
|
+
setLabels((m) => {
|
|
60
|
+
if (!m.has(v)) return m;
|
|
61
|
+
const next = new Map(m);
|
|
62
|
+
next.delete(v);
|
|
63
|
+
return next;
|
|
64
|
+
});
|
|
65
|
+
}, []);
|
|
66
|
+
useEffect(() => {
|
|
67
|
+
if (!open) return;
|
|
68
|
+
const onKey = (e) => e.key === "Escape" && setOpen(false);
|
|
69
|
+
const onPointer = (e) => {
|
|
70
|
+
if (rootRef.current && !rootRef.current.contains(e.target)) setOpen(false);
|
|
71
|
+
};
|
|
72
|
+
window.addEventListener("keydown", onKey);
|
|
73
|
+
window.addEventListener("pointerdown", onPointer);
|
|
74
|
+
return () => {
|
|
75
|
+
window.removeEventListener("keydown", onKey);
|
|
76
|
+
window.removeEventListener("pointerdown", onPointer);
|
|
77
|
+
};
|
|
78
|
+
}, [open]);
|
|
79
|
+
const ctx = useMemo(() => ({
|
|
80
|
+
value: current,
|
|
81
|
+
open,
|
|
82
|
+
setOpen,
|
|
83
|
+
select,
|
|
84
|
+
register,
|
|
85
|
+
unregister,
|
|
86
|
+
labelFor: (v) => v === void 0 ? void 0 : labels.get(v),
|
|
87
|
+
reduce,
|
|
88
|
+
triggerId: `${baseId}-trigger`,
|
|
89
|
+
listId: `${baseId}-list`,
|
|
90
|
+
disabled,
|
|
91
|
+
placement,
|
|
92
|
+
setPlacement
|
|
93
|
+
}), [
|
|
94
|
+
current,
|
|
95
|
+
open,
|
|
96
|
+
select,
|
|
97
|
+
register,
|
|
98
|
+
unregister,
|
|
99
|
+
labels,
|
|
100
|
+
reduce,
|
|
101
|
+
baseId,
|
|
102
|
+
disabled,
|
|
103
|
+
placement
|
|
104
|
+
]);
|
|
105
|
+
return /* @__PURE__ */ jsx(SelectContext.Provider, {
|
|
106
|
+
value: ctx,
|
|
107
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
108
|
+
ref: rootRef,
|
|
109
|
+
className: cn("relative", className),
|
|
110
|
+
children
|
|
111
|
+
})
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
function SelectTrigger({ className, children }) {
|
|
115
|
+
const ctx = useSelectContext("SelectTrigger");
|
|
116
|
+
const isTop = ctx.placement === "top";
|
|
117
|
+
const kf = ctx.open ? [
|
|
118
|
+
0,
|
|
119
|
+
0,
|
|
120
|
+
12
|
|
121
|
+
] : [
|
|
122
|
+
12,
|
|
123
|
+
0,
|
|
124
|
+
12
|
|
125
|
+
];
|
|
126
|
+
const kfT = ctx.reduce ? { duration: 0 } : ctx.open ? {
|
|
127
|
+
duration: .6,
|
|
128
|
+
times: [
|
|
129
|
+
0,
|
|
130
|
+
.4,
|
|
131
|
+
1
|
|
132
|
+
],
|
|
133
|
+
ease: EASE_OUT
|
|
134
|
+
} : {
|
|
135
|
+
duration: .42,
|
|
136
|
+
times: [
|
|
137
|
+
0,
|
|
138
|
+
.5,
|
|
139
|
+
1
|
|
140
|
+
],
|
|
141
|
+
ease: EASE_OUT
|
|
142
|
+
};
|
|
143
|
+
return /* @__PURE__ */ jsxs(motion.button, {
|
|
144
|
+
type: "button",
|
|
145
|
+
id: ctx.triggerId,
|
|
146
|
+
disabled: ctx.disabled,
|
|
147
|
+
"aria-haspopup": "listbox",
|
|
148
|
+
"aria-expanded": ctx.open,
|
|
149
|
+
"aria-controls": ctx.listId,
|
|
150
|
+
onClick: () => ctx.setOpen(!ctx.open),
|
|
151
|
+
initial: false,
|
|
152
|
+
animate: {
|
|
153
|
+
borderTopLeftRadius: isTop ? kf : 12,
|
|
154
|
+
borderTopRightRadius: isTop ? kf : 12,
|
|
155
|
+
borderBottomLeftRadius: isTop ? 12 : kf,
|
|
156
|
+
borderBottomRightRadius: isTop ? 12 : kf
|
|
157
|
+
},
|
|
158
|
+
transition: {
|
|
159
|
+
borderTopLeftRadius: isTop ? kfT : INSTANT_TRANSITION,
|
|
160
|
+
borderTopRightRadius: isTop ? kfT : INSTANT_TRANSITION,
|
|
161
|
+
borderBottomLeftRadius: isTop ? INSTANT_TRANSITION : kfT,
|
|
162
|
+
borderBottomRightRadius: isTop ? INSTANT_TRANSITION : kfT
|
|
163
|
+
},
|
|
164
|
+
className: cn("relative z-10 flex w-full items-center justify-between gap-2 rounded-xl border border-border bg-background px-3 py-2 text-foreground text-sm outline-none transition-colors", "hover:border-(--color-border-strong) focus-visible:ring-2 focus-visible:ring-foreground/20", "disabled:pointer-events-none disabled:opacity-50", className),
|
|
165
|
+
children: [children, /* @__PURE__ */ jsx(motion.span, {
|
|
166
|
+
"aria-hidden": true,
|
|
167
|
+
animate: { rotate: ctx.open ? 180 : 0 },
|
|
168
|
+
transition: ctx.reduce ? { duration: 0 } : CHEVRON_TRANSITION,
|
|
169
|
+
className: "text-muted-foreground",
|
|
170
|
+
children: /* @__PURE__ */ jsx(ChevronDown, { className: "h-4 w-4" })
|
|
171
|
+
})]
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
function SelectValue({ placeholder, className }) {
|
|
175
|
+
const ctx = useSelectContext("SelectValue");
|
|
176
|
+
const label = ctx.labelFor(ctx.value);
|
|
177
|
+
return /* @__PURE__ */ jsx("span", {
|
|
178
|
+
className: cn(label ? "text-foreground" : "text-muted-foreground", className),
|
|
179
|
+
children: label ?? placeholder ?? "Select"
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
function SelectContent({ className, children }) {
|
|
183
|
+
const ctx = useSelectContext("SelectContent");
|
|
184
|
+
const innerRef = useRef(null);
|
|
185
|
+
const [height, setHeight] = useState(0);
|
|
186
|
+
const open = ctx.open;
|
|
187
|
+
const { setPlacement } = ctx;
|
|
188
|
+
useLayoutEffect(() => {
|
|
189
|
+
const node = innerRef.current;
|
|
190
|
+
if (!node) return;
|
|
191
|
+
const measure = () => setHeight(node.offsetHeight);
|
|
192
|
+
measure();
|
|
193
|
+
const observer = new ResizeObserver(measure);
|
|
194
|
+
observer.observe(node);
|
|
195
|
+
return () => observer.disconnect();
|
|
196
|
+
});
|
|
197
|
+
useLayoutEffect(() => {
|
|
198
|
+
if (!open) return;
|
|
199
|
+
const trigger = document.getElementById(ctx.triggerId);
|
|
200
|
+
const node = innerRef.current;
|
|
201
|
+
if (!trigger || !node) return;
|
|
202
|
+
const rect = trigger.getBoundingClientRect();
|
|
203
|
+
const h = node.offsetHeight;
|
|
204
|
+
const below = window.innerHeight - rect.bottom;
|
|
205
|
+
const above = rect.top;
|
|
206
|
+
setPlacement(below < h + 16 && above > below ? "top" : "bottom");
|
|
207
|
+
}, [
|
|
208
|
+
open,
|
|
209
|
+
ctx.triggerId,
|
|
210
|
+
setPlacement
|
|
211
|
+
]);
|
|
212
|
+
const isTop = ctx.placement === "top";
|
|
213
|
+
const nearGap = open ? 8 : 0;
|
|
214
|
+
const nearRadius = open ? 12 : 0;
|
|
215
|
+
const gapT = open ? {
|
|
216
|
+
type: "spring",
|
|
217
|
+
duration: .6,
|
|
218
|
+
bounce: .5,
|
|
219
|
+
delay: .12
|
|
220
|
+
} : {
|
|
221
|
+
type: "spring",
|
|
222
|
+
duration: .3,
|
|
223
|
+
bounce: .1
|
|
224
|
+
};
|
|
225
|
+
const radiusT = open ? {
|
|
226
|
+
duration: .3,
|
|
227
|
+
ease: EASE_OUT,
|
|
228
|
+
delay: .14
|
|
229
|
+
} : {
|
|
230
|
+
duration: .16,
|
|
231
|
+
ease: EASE_OUT
|
|
232
|
+
};
|
|
233
|
+
return /* @__PURE__ */ jsx(motion.div, {
|
|
234
|
+
id: ctx.listId,
|
|
235
|
+
role: "listbox",
|
|
236
|
+
"aria-labelledby": ctx.triggerId,
|
|
237
|
+
"aria-hidden": !open,
|
|
238
|
+
inert: !open,
|
|
239
|
+
initial: false,
|
|
240
|
+
animate: ctx.reduce ? {
|
|
241
|
+
opacity: open ? 1 : 0,
|
|
242
|
+
height: open ? height : 0
|
|
243
|
+
} : {
|
|
244
|
+
opacity: open ? 1 : 0,
|
|
245
|
+
height: open ? height : 0,
|
|
246
|
+
marginTop: isTop ? 0 : nearGap,
|
|
247
|
+
marginBottom: isTop ? nearGap : 0,
|
|
248
|
+
borderTopLeftRadius: isTop ? 12 : nearRadius,
|
|
249
|
+
borderTopRightRadius: isTop ? 12 : nearRadius,
|
|
250
|
+
borderBottomLeftRadius: isTop ? nearRadius : 12,
|
|
251
|
+
borderBottomRightRadius: isTop ? nearRadius : 12
|
|
252
|
+
},
|
|
253
|
+
transition: ctx.reduce ? { duration: .12 } : {
|
|
254
|
+
opacity: open ? { duration: .18 } : {
|
|
255
|
+
duration: .16,
|
|
256
|
+
delay: .12
|
|
257
|
+
},
|
|
258
|
+
height: open ? {
|
|
259
|
+
type: "spring",
|
|
260
|
+
duration: .42,
|
|
261
|
+
bounce: .14
|
|
262
|
+
} : {
|
|
263
|
+
duration: .26,
|
|
264
|
+
ease: EASE_OUT,
|
|
265
|
+
delay: .14
|
|
266
|
+
},
|
|
267
|
+
marginTop: isTop ? INSTANT_TRANSITION : gapT,
|
|
268
|
+
marginBottom: isTop ? gapT : INSTANT_TRANSITION,
|
|
269
|
+
borderTopLeftRadius: isTop ? INSTANT_TRANSITION : radiusT,
|
|
270
|
+
borderTopRightRadius: isTop ? INSTANT_TRANSITION : radiusT,
|
|
271
|
+
borderBottomLeftRadius: isTop ? radiusT : INSTANT_TRANSITION,
|
|
272
|
+
borderBottomRightRadius: isTop ? radiusT : INSTANT_TRANSITION
|
|
273
|
+
},
|
|
274
|
+
style: {
|
|
275
|
+
transformOrigin: isTop ? "bottom" : "top",
|
|
276
|
+
overflow: "hidden",
|
|
277
|
+
pointerEvents: open ? "auto" : "none"
|
|
278
|
+
},
|
|
279
|
+
className: cn("absolute right-0 left-0 z-20 rounded-xl border border-border bg-background shadow-lg", isTop ? "bottom-full" : "top-full", className),
|
|
280
|
+
children: /* @__PURE__ */ jsx(motion.div, {
|
|
281
|
+
ref: innerRef,
|
|
282
|
+
variants: ctx.reduce ? void 0 : LIST_VARIANTS,
|
|
283
|
+
initial: false,
|
|
284
|
+
animate: open ? "show" : "hidden",
|
|
285
|
+
className: "p-1",
|
|
286
|
+
children
|
|
287
|
+
})
|
|
288
|
+
});
|
|
289
|
+
}
|
|
290
|
+
function SelectItem({ value, disabled = false, className, children }) {
|
|
291
|
+
const ctx = useSelectContext("SelectItem");
|
|
292
|
+
const selected = ctx.value === value;
|
|
293
|
+
const label = typeof children === "string" ? children : value;
|
|
294
|
+
useLayoutEffect(() => {
|
|
295
|
+
ctx.register(value, label);
|
|
296
|
+
return () => ctx.unregister(value);
|
|
297
|
+
}, [
|
|
298
|
+
ctx.register,
|
|
299
|
+
ctx.unregister,
|
|
300
|
+
value,
|
|
301
|
+
label
|
|
302
|
+
]);
|
|
303
|
+
return /* @__PURE__ */ jsx(motion.li, {
|
|
304
|
+
variants: ctx.reduce ? void 0 : ITEM_VARIANTS,
|
|
305
|
+
children: /* @__PURE__ */ jsxs("button", {
|
|
306
|
+
type: "button",
|
|
307
|
+
role: "option",
|
|
308
|
+
"aria-selected": selected,
|
|
309
|
+
disabled,
|
|
310
|
+
onClick: () => ctx.select(value),
|
|
311
|
+
className: cn("flex w-full items-center justify-between gap-2 rounded-lg px-2.5 py-1.5 text-left text-sm outline-none transition-colors", selected ? "bg-muted text-foreground" : "text-muted-foreground hover:bg-muted hover:text-foreground focus-visible:bg-muted", "disabled:pointer-events-none disabled:opacity-50", className),
|
|
312
|
+
children: [children, selected ? /* @__PURE__ */ jsx(Check, { className: "h-3.5 w-3.5 shrink-0" }) : null]
|
|
313
|
+
})
|
|
314
|
+
});
|
|
315
|
+
}
|
|
316
|
+
//#endregion
|
|
317
|
+
export { Select, SelectContent, SelectItem, SelectTrigger, SelectValue };
|
|
318
|
+
|
|
319
|
+
//# sourceMappingURL=select.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"select.js","names":[],"sources":["../../../src/components/motion/select.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n createContext,\n type ReactNode,\n useCallback,\n useContext,\n useEffect,\n useId,\n useLayoutEffect,\n useMemo,\n useRef,\n useState,\n} from \"react\";\nimport { Check, ChevronDown } from \"lucide-react\";\nimport { motion, type Transition, useReducedMotion, type Variants } from \"motion/react\";\n\nimport { cn } from \"@kumix/utils\";\nimport { EASE_OUT } from \"../../lib/ease\";\n\nconst INSTANT_TRANSITION: Transition = { duration: 0 };\n\n// Spring with bounce powers the unfold/separation; per-property timings in the\n// content choreograph it (see SelectContent). Mirrors bouncy-accordion's feel.\nconst CHEVRON_TRANSITION: Transition = { type: \"spring\", duration: 0.4, bounce: 0.3 };\n\nconst LIST_VARIANTS: Variants = {\n hidden: {},\n show: { transition: { staggerChildren: 0.035, delayChildren: 0.05 } },\n};\nconst ITEM_VARIANTS: Variants = {\n hidden: { opacity: 0, y: -6, filter: \"blur(3px)\" },\n show: { opacity: 1, y: 0, filter: \"blur(0px)\" },\n};\n\ntype Placement = \"bottom\" | \"top\";\n\ninterface SelectContextValue {\n value: string | undefined;\n open: boolean;\n setOpen: (open: boolean) => void;\n select: (value: string) => void;\n register: (value: string, label: string) => void;\n unregister: (value: string) => void;\n labelFor: (value: string | undefined) => string | undefined;\n reduce: boolean;\n triggerId: string;\n listId: string;\n disabled: boolean;\n placement: Placement;\n setPlacement: (p: Placement) => void;\n}\n\nconst SelectContext = createContext<SelectContextValue | null>(null);\n\nfunction useSelectContext(component: string) {\n const ctx = useContext(SelectContext);\n if (!ctx) throw new Error(`${component} must be used within <Select>`);\n return ctx;\n}\n\nexport interface SelectProps {\n value?: string;\n defaultValue?: string;\n onValueChange?: (value: string) => void;\n disabled?: boolean;\n className?: string;\n children: ReactNode;\n}\n\nexport function Select({\n value,\n defaultValue,\n onValueChange,\n disabled = false,\n className,\n children,\n}: SelectProps) {\n const reduce = useReducedMotion() ?? false;\n const baseId = useId();\n const rootRef = useRef<HTMLDivElement>(null);\n const [open, setOpen] = useState(false);\n const [internal, setInternal] = useState(defaultValue);\n const [labels, setLabels] = useState<Map<string, string>>(new Map());\n const [placement, setPlacement] = useState<Placement>(\"bottom\");\n\n const controlled = value !== undefined;\n const current = controlled ? value : internal;\n\n const select = useCallback(\n (next: string) => {\n if (!controlled) setInternal(next);\n onValueChange?.(next);\n setOpen(false);\n },\n [controlled, onValueChange],\n );\n\n const register = useCallback((v: string, label: string) => {\n setLabels((m) => (m.get(v) === label ? m : new Map(m).set(v, label)));\n }, []);\n const unregister = useCallback((v: string) => {\n setLabels((m) => {\n if (!m.has(v)) return m;\n const next = new Map(m);\n next.delete(v);\n return next;\n });\n }, []);\n\n // close on outside pointer / escape\n useEffect(() => {\n if (!open) return;\n const onKey = (e: KeyboardEvent) => e.key === \"Escape\" && setOpen(false);\n const onPointer = (e: PointerEvent) => {\n if (rootRef.current && !rootRef.current.contains(e.target as Node)) setOpen(false);\n };\n window.addEventListener(\"keydown\", onKey);\n window.addEventListener(\"pointerdown\", onPointer);\n return () => {\n window.removeEventListener(\"keydown\", onKey);\n window.removeEventListener(\"pointerdown\", onPointer);\n };\n }, [open]);\n\n const ctx = useMemo<SelectContextValue>(\n () => ({\n value: current,\n open,\n setOpen,\n select,\n register,\n unregister,\n labelFor: (v) => (v === undefined ? undefined : labels.get(v)),\n reduce,\n triggerId: `${baseId}-trigger`,\n listId: `${baseId}-list`,\n disabled,\n placement,\n setPlacement,\n }),\n [current, open, select, register, unregister, labels, reduce, baseId, disabled, placement],\n );\n\n return (\n <SelectContext.Provider value={ctx}>\n <div ref={rootRef} className={cn(\"relative\", className)}>\n {children}\n </div>\n </SelectContext.Provider>\n );\n}\n\nexport interface SelectTriggerProps {\n className?: string;\n children: ReactNode;\n}\n\nexport function SelectTrigger({ className, children }: SelectTriggerProps) {\n const ctx = useSelectContext(\"SelectTrigger\");\n const isTop = ctx.placement === \"top\";\n // edge facing the panel flattens then rounds; the far edge stays rounded.\n // All four corners are specified so none gets stranded when placement flips.\n const kf = ctx.open ? [0, 0, 12] : [12, 0, 12];\n const kfT: Transition = ctx.reduce\n ? { duration: 0 }\n : ctx.open\n ? { duration: 0.6, times: [0, 0.4, 1], ease: EASE_OUT }\n : { duration: 0.42, times: [0, 0.5, 1], ease: EASE_OUT };\n return (\n <motion.button\n type=\"button\"\n id={ctx.triggerId}\n disabled={ctx.disabled}\n aria-haspopup=\"listbox\"\n aria-expanded={ctx.open}\n aria-controls={ctx.listId}\n onClick={() => ctx.setOpen(!ctx.open)}\n // Gooey: the edge facing the panel snaps flat (panel attached) then rounds\n // back once the panel pulls away — the two pinch apart.\n initial={false}\n animate={{\n borderTopLeftRadius: isTop ? kf : 12,\n borderTopRightRadius: isTop ? kf : 12,\n borderBottomLeftRadius: isTop ? 12 : kf,\n borderBottomRightRadius: isTop ? 12 : kf,\n }}\n transition={{\n borderTopLeftRadius: isTop ? kfT : INSTANT_TRANSITION,\n borderTopRightRadius: isTop ? kfT : INSTANT_TRANSITION,\n borderBottomLeftRadius: isTop ? INSTANT_TRANSITION : kfT,\n borderBottomRightRadius: isTop ? INSTANT_TRANSITION : kfT,\n }}\n className={cn(\n \"relative z-10 flex w-full items-center justify-between gap-2 rounded-xl border border-border bg-background px-3 py-2 text-foreground text-sm outline-none transition-colors\",\n \"hover:border-(--color-border-strong) focus-visible:ring-2 focus-visible:ring-foreground/20\",\n \"disabled:pointer-events-none disabled:opacity-50\",\n className,\n )}\n >\n {children}\n <motion.span\n aria-hidden\n animate={{ rotate: ctx.open ? 180 : 0 }}\n transition={ctx.reduce ? { duration: 0 } : CHEVRON_TRANSITION}\n className=\"text-muted-foreground\"\n >\n <ChevronDown className=\"h-4 w-4\" />\n </motion.span>\n </motion.button>\n );\n}\n\nexport interface SelectValueProps {\n placeholder?: string;\n className?: string;\n}\n\nexport function SelectValue({ placeholder, className }: SelectValueProps) {\n const ctx = useSelectContext(\"SelectValue\");\n const label = ctx.labelFor(ctx.value);\n return (\n <span className={cn(label ? \"text-foreground\" : \"text-muted-foreground\", className)}>\n {label ?? placeholder ?? \"Select\"}\n </span>\n );\n}\n\nexport interface SelectContentProps {\n className?: string;\n children: ReactNode;\n}\n\nexport function SelectContent({ className, children }: SelectContentProps) {\n const ctx = useSelectContext(\"SelectContent\");\n const innerRef = useRef<HTMLDivElement>(null);\n const [height, setHeight] = useState(0);\n const open = ctx.open;\n const { setPlacement } = ctx;\n\n useLayoutEffect(() => {\n const node = innerRef.current;\n if (!node) return;\n const measure = () => setHeight(node.offsetHeight);\n measure();\n const observer = new ResizeObserver(measure);\n observer.observe(node);\n return () => observer.disconnect();\n });\n\n // On open, flip upward when there isn't room below and there's more above.\n useLayoutEffect(() => {\n if (!open) return;\n const trigger = document.getElementById(ctx.triggerId);\n const node = innerRef.current;\n if (!trigger || !node) return;\n const rect = trigger.getBoundingClientRect();\n const h = node.offsetHeight;\n const below = window.innerHeight - rect.bottom;\n const above = rect.top;\n setPlacement(below < h + 16 && above > below ? \"top\" : \"bottom\");\n }, [open, ctx.triggerId, setPlacement]);\n\n // Specify EVERY corner + both margins each render. The near edge (facing the\n // trigger) animates flat->round and the gap opens on that side; the far edge\n // stays rounded and its margin pinned to 0. Setting all of them avoids a\n // stranded square corner when the placement flips between opens.\n const isTop = ctx.placement === \"top\";\n const nearGap = open ? 8 : 0;\n const nearRadius = open ? 12 : 0;\n\n const gapT: Transition = open\n ? { type: \"spring\", duration: 0.6, bounce: 0.5, delay: 0.12 }\n : { type: \"spring\", duration: 0.3, bounce: 0.1 };\n const radiusT: Transition = open\n ? { duration: 0.3, ease: EASE_OUT, delay: 0.14 }\n : { duration: 0.16, ease: EASE_OUT };\n\n // Items stay mounted (open just animates the panel) so each item's label\n // registration persists — otherwise the trigger would fall back to the\n // placeholder the moment the panel closes.\n return (\n <motion.div\n id={ctx.listId}\n role=\"listbox\"\n aria-labelledby={ctx.triggerId}\n aria-hidden={!open}\n inert={!open}\n initial={false}\n animate={\n ctx.reduce\n ? { opacity: open ? 1 : 0, height: open ? height : 0 }\n : {\n opacity: open ? 1 : 0,\n height: open ? height : 0,\n // gap opens on the side facing the trigger\n marginTop: isTop ? 0 : nearGap,\n marginBottom: isTop ? nearGap : 0,\n // near corners go flat->round; far corners stay rounded\n borderTopLeftRadius: isTop ? 12 : nearRadius,\n borderTopRightRadius: isTop ? 12 : nearRadius,\n borderBottomLeftRadius: isTop ? nearRadius : 12,\n borderBottomRightRadius: isTop ? nearRadius : 12,\n }\n }\n transition={\n ctx.reduce\n ? { duration: 0.12 }\n : {\n opacity: open ? { duration: 0.18 } : { duration: 0.16, delay: 0.12 },\n height: open\n ? { type: \"spring\", duration: 0.42, bounce: 0.14 }\n : { duration: 0.26, ease: EASE_OUT, delay: 0.14 },\n marginTop: isTop ? INSTANT_TRANSITION : gapT,\n marginBottom: isTop ? gapT : INSTANT_TRANSITION,\n borderTopLeftRadius: isTop ? INSTANT_TRANSITION : radiusT,\n borderTopRightRadius: isTop ? INSTANT_TRANSITION : radiusT,\n borderBottomLeftRadius: isTop ? radiusT : INSTANT_TRANSITION,\n borderBottomRightRadius: isTop ? radiusT : INSTANT_TRANSITION,\n }\n }\n style={{\n transformOrigin: isTop ? \"bottom\" : \"top\",\n overflow: \"hidden\",\n pointerEvents: open ? \"auto\" : \"none\",\n }}\n // flush against the trigger, then separates into its own rounded pill;\n // sits above or below depending on available space\n className={cn(\n \"absolute right-0 left-0 z-20 rounded-xl border border-border bg-background shadow-lg\",\n isTop ? \"bottom-full\" : \"top-full\",\n className,\n )}\n >\n <motion.div\n ref={innerRef}\n variants={ctx.reduce ? undefined : LIST_VARIANTS}\n initial={false}\n animate={open ? \"show\" : \"hidden\"}\n className=\"p-1\"\n >\n {children}\n </motion.div>\n </motion.div>\n );\n}\n\nexport interface SelectItemProps {\n value: string;\n disabled?: boolean;\n className?: string;\n children: ReactNode;\n}\n\nexport function SelectItem({ value, disabled = false, className, children }: SelectItemProps) {\n const ctx = useSelectContext(\"SelectItem\");\n const selected = ctx.value === value;\n const label = typeof children === \"string\" ? children : value;\n\n useLayoutEffect(() => {\n ctx.register(value, label);\n return () => ctx.unregister(value);\n }, [ctx.register, ctx.unregister, value, label]);\n\n return (\n <motion.li variants={ctx.reduce ? undefined : ITEM_VARIANTS}>\n <button\n type=\"button\"\n role=\"option\"\n aria-selected={selected}\n disabled={disabled}\n onClick={() => ctx.select(value)}\n className={cn(\n \"flex w-full items-center justify-between gap-2 rounded-lg px-2.5 py-1.5 text-left text-sm outline-none transition-colors\",\n selected\n ? \"bg-muted text-foreground\"\n : \"text-muted-foreground hover:bg-muted hover:text-foreground focus-visible:bg-muted\",\n \"disabled:pointer-events-none disabled:opacity-50\",\n className,\n )}\n >\n {children}\n {selected ? <Check className=\"h-3.5 w-3.5 shrink-0\" /> : null}\n </button>\n </motion.li>\n );\n}\n"],"mappings":";;;;;;;;AAoBA,MAAM,qBAAiC,EAAE,UAAU,EAAE;AAIrD,MAAM,qBAAiC;CAAE,MAAM;CAAU,UAAU;CAAK,QAAQ;AAAI;AAEpF,MAAM,gBAA0B;CAC9B,QAAQ,CAAC;CACT,MAAM,EAAE,YAAY;EAAE,iBAAiB;EAAO,eAAe;CAAK,EAAE;AACtE;AACA,MAAM,gBAA0B;CAC9B,QAAQ;EAAE,SAAS;EAAG,GAAG;EAAI,QAAQ;CAAY;CACjD,MAAM;EAAE,SAAS;EAAG,GAAG;EAAG,QAAQ;CAAY;AAChD;AAoBA,MAAM,gBAAgB,cAAyC,IAAI;AAEnE,SAAS,iBAAiB,WAAmB;CAC3C,MAAM,MAAM,WAAW,aAAa;CACpC,IAAI,CAAC,KAAK,MAAM,IAAI,MAAM,GAAG,UAAU,8BAA8B;CACrE,OAAO;AACT;AAWA,SAAgB,OAAO,EACrB,OACA,cACA,eACA,WAAW,OACX,WACA,YACc;CACd,MAAM,SAAS,iBAAiB,KAAK;CACrC,MAAM,SAAS,MAAM;CACrB,M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UAAU;GACV,eAAe,OAAO,SAAS;EACjC;EAGA,WAAW,GACT,wFACA,QAAQ,gBAAgB,YACxB,SACF;EAEA,UAAA,oBAAC,OAAO,KAAR;GACE,KAAK;GACL,UAAU,IAAI,SAAS,KAAA,IAAY;GACnC,SAAS;GACT,SAAS,OAAO,SAAS;GACzB,WAAU;GAET;EACS,CAAA;CACF,CAAA;AAEhB;AASA,SAAgB,WAAW,EAAE,OAAO,WAAW,OAAO,WAAW,YAA6B;CAC5F,MAAM,MAAM,iBAAiB,YAAY;CACzC,MAAM,WAAW,IAAI,UAAU;CAC/B,MAAM,QAAQ,OAAO,aAAa,WAAW,WAAW;CAExD,sBAAsB;EACpB,IAAI,SAAS,OAAO,KAAK;EACzB,aAAa,IAAI,WAAW,KAAK;CACnC,GAAG;EAAC,IAAI;EAAU,IAAI;EAAY;EAAO;CAAK,CAAC;CAE/C,OACE,oBAAC,OAAO,IAAR;EAAW,UAAU,IAAI,SAAS,KAAA,IAAY;EAC5C,UAAA,qBAAC,UAAD;GACE,MAAK;GACL,MAAK;GACL,iBAAe;GACL;GACV,eAAe,IAAI,OAAO,KAAK;GAC/B,WAAW,GACT,4HACA,WACI,6BACA,qFACJ,oDACA,SACF;GAbF,UAAA,CAeG,UACA,WAAW,oBAAC,OAAD,EAAO,WAAU,uBAAwB,CAAA,IAAI,IACnD;;CACC,CAAA;AAEf"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { ColorPanelsProps, DitheringProps, DotGridProps, DotOrbitProps, GodRaysProps, GrainGradientProps, MeshGradientProps, MetaballsProps, NeuroNoiseProps, PerlinNoiseProps, PulsingBorderProps, SimplexNoiseProps, SmokeRingProps, SpiralProps, StaticMeshGradientProps, StaticRadialGradientProps, SwirlProps, VoronoiProps, WarpProps, WaterProps, WavesProps } from "@paper-design/shaders-react";
|
|
2
|
+
//#region src/components/motion/shader-background.d.ts
|
|
3
|
+
type ShaderVariantProps = {
|
|
4
|
+
"mesh-gradient": MeshGradientProps;
|
|
5
|
+
"grain-gradient": GrainGradientProps;
|
|
6
|
+
"dot-grid": DotGridProps;
|
|
7
|
+
"dot-orbit": DotOrbitProps;
|
|
8
|
+
warp: WarpProps;
|
|
9
|
+
waves: WavesProps;
|
|
10
|
+
water: WaterProps;
|
|
11
|
+
voronoi: VoronoiProps;
|
|
12
|
+
swirl: SwirlProps;
|
|
13
|
+
"smoke-ring": SmokeRingProps;
|
|
14
|
+
"static-radial-gradient": StaticRadialGradientProps;
|
|
15
|
+
"neuro-noise": NeuroNoiseProps;
|
|
16
|
+
metaballs: MetaballsProps;
|
|
17
|
+
"god-rays": GodRaysProps;
|
|
18
|
+
spiral: SpiralProps;
|
|
19
|
+
dithering: DitheringProps;
|
|
20
|
+
"pulsing-border": PulsingBorderProps;
|
|
21
|
+
"color-panels": ColorPanelsProps;
|
|
22
|
+
"static-mesh-gradient": StaticMeshGradientProps;
|
|
23
|
+
"simplex-noise": SimplexNoiseProps;
|
|
24
|
+
"perlin-noise": PerlinNoiseProps;
|
|
25
|
+
};
|
|
26
|
+
type ShaderBackgroundVariant = keyof ShaderVariantProps;
|
|
27
|
+
type ShaderBackgroundProps = { [K in ShaderBackgroundVariant]: {
|
|
28
|
+
variant: K;
|
|
29
|
+
} & ShaderVariantProps[K]; }[ShaderBackgroundVariant];
|
|
30
|
+
declare const SHADER_BACKGROUND_VARIANTS: ShaderBackgroundVariant[];
|
|
31
|
+
/**
|
|
32
|
+
* Not every variant animates (e.g. dot-grid is a static pattern), so `speed`
|
|
33
|
+
* is only frozen for reduced motion when the variant actually exposes it.
|
|
34
|
+
*/
|
|
35
|
+
declare function ShaderBackground({ variant, className, ...rest }: ShaderBackgroundProps): import("react").JSX.Element;
|
|
36
|
+
//#endregion
|
|
37
|
+
export { SHADER_BACKGROUND_VARIANTS, ShaderBackground, ShaderBackgroundProps, ShaderBackgroundVariant };
|
|
38
|
+
//# sourceMappingURL=shader-background.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shader-background.d.ts","names":[],"sources":["../../../src/components/motion/shader-background.tsx"],"mappings":";;KAmDK;EACH,iBAAiB;EACjB,kBAAkB;EAClB,YAAY;EACZ,aAAa;EACb,MAAM;EACN,OAAO;EACP,OAAO;EACP,SAAS;EACT,OAAO;EACP,cAAc;EACd,0BAA0B;EAC1B,eAAe;EACf,WAAW;EACX,YAAY;EACZ,QAAQ;EACR,WAAW;EACX,kBAAkB;EAClB,gBAAgB;EAChB,wBAAwB;EACxB,iBAAiB;EACjB,gBAAgB;;KAGN,gCAAgC;KAEhC,2BACT,KAAK;EAA4B,SAAS;IAAM,mBAAmB,MACpE;cA4BW,4BAER;;;;;iBAMW,mBAAmB,SAAS,cAAc,QAAQ,wCAAqB,IAAA"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn } from "@kumix/utils";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
import { useReducedMotion } from "motion/react";
|
|
5
|
+
import { ColorPanels, Dithering, DotGrid, DotOrbit, GodRays, GrainGradient, MeshGradient, Metaballs, NeuroNoise, PerlinNoise, PulsingBorder, SimplexNoise, SmokeRing, Spiral, StaticMeshGradient, StaticRadialGradient, Swirl, Voronoi, Warp, Water, Waves } from "@paper-design/shaders-react";
|
|
6
|
+
//#region src/components/motion/shader-background.tsx
|
|
7
|
+
const VARIANT_COMPONENTS = {
|
|
8
|
+
"mesh-gradient": MeshGradient,
|
|
9
|
+
"grain-gradient": GrainGradient,
|
|
10
|
+
"dot-grid": DotGrid,
|
|
11
|
+
"dot-orbit": DotOrbit,
|
|
12
|
+
warp: Warp,
|
|
13
|
+
waves: Waves,
|
|
14
|
+
water: Water,
|
|
15
|
+
voronoi: Voronoi,
|
|
16
|
+
swirl: Swirl,
|
|
17
|
+
"smoke-ring": SmokeRing,
|
|
18
|
+
"static-radial-gradient": StaticRadialGradient,
|
|
19
|
+
"neuro-noise": NeuroNoise,
|
|
20
|
+
metaballs: Metaballs,
|
|
21
|
+
"god-rays": GodRays,
|
|
22
|
+
spiral: Spiral,
|
|
23
|
+
dithering: Dithering,
|
|
24
|
+
"pulsing-border": PulsingBorder,
|
|
25
|
+
"color-panels": ColorPanels,
|
|
26
|
+
"static-mesh-gradient": StaticMeshGradient,
|
|
27
|
+
"simplex-noise": SimplexNoise,
|
|
28
|
+
"perlin-noise": PerlinNoise
|
|
29
|
+
};
|
|
30
|
+
const SHADER_BACKGROUND_VARIANTS = Object.keys(VARIANT_COMPONENTS);
|
|
31
|
+
/**
|
|
32
|
+
* Not every variant animates (e.g. dot-grid is a static pattern), so `speed`
|
|
33
|
+
* is only frozen for reduced motion when the variant actually exposes it.
|
|
34
|
+
*/
|
|
35
|
+
function ShaderBackground({ variant, className, ...rest }) {
|
|
36
|
+
const reducedMotion = useReducedMotion();
|
|
37
|
+
const Shader = VARIANT_COMPONENTS[variant];
|
|
38
|
+
const props = rest;
|
|
39
|
+
const speedProps = reducedMotion && "speed" in props ? { speed: 0 } : {};
|
|
40
|
+
return /* @__PURE__ */ jsx(Shader, {
|
|
41
|
+
...props,
|
|
42
|
+
...speedProps,
|
|
43
|
+
className: cn("h-full w-full", className)
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
//#endregion
|
|
47
|
+
export { SHADER_BACKGROUND_VARIANTS, ShaderBackground };
|
|
48
|
+
|
|
49
|
+
//# sourceMappingURL=shader-background.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shader-background.js","names":[],"sources":["../../../src/components/motion/shader-background.tsx"],"sourcesContent":["\"use client\";\n\nimport type { ComponentType } from \"react\";\nimport {\n ColorPanels,\n type ColorPanelsProps,\n Dithering,\n type DitheringProps,\n DotGrid,\n type DotGridProps,\n DotOrbit,\n type DotOrbitProps,\n GodRays,\n type GodRaysProps,\n GrainGradient,\n type GrainGradientProps,\n MeshGradient,\n type MeshGradientProps,\n Metaballs,\n type MetaballsProps,\n NeuroNoise,\n type NeuroNoiseProps,\n PerlinNoise,\n type PerlinNoiseProps,\n PulsingBorder,\n type PulsingBorderProps,\n SimplexNoise,\n type SimplexNoiseProps,\n SmokeRing,\n type SmokeRingProps,\n Spiral,\n type SpiralProps,\n StaticMeshGradient,\n type StaticMeshGradientProps,\n StaticRadialGradient,\n type StaticRadialGradientProps,\n Swirl,\n type SwirlProps,\n Voronoi,\n type VoronoiProps,\n Warp,\n type WarpProps,\n Water,\n type WaterProps,\n Waves,\n type WavesProps,\n} from \"@paper-design/shaders-react\";\nimport { useReducedMotion } from \"motion/react\";\n\nimport { cn } from \"@kumix/utils\";\n\ntype ShaderVariantProps = {\n \"mesh-gradient\": MeshGradientProps;\n \"grain-gradient\": GrainGradientProps;\n \"dot-grid\": DotGridProps;\n \"dot-orbit\": DotOrbitProps;\n warp: WarpProps;\n waves: WavesProps;\n water: WaterProps;\n voronoi: VoronoiProps;\n swirl: SwirlProps;\n \"smoke-ring\": SmokeRingProps;\n \"static-radial-gradient\": StaticRadialGradientProps;\n \"neuro-noise\": NeuroNoiseProps;\n metaballs: MetaballsProps;\n \"god-rays\": GodRaysProps;\n spiral: SpiralProps;\n dithering: DitheringProps;\n \"pulsing-border\": PulsingBorderProps;\n \"color-panels\": ColorPanelsProps;\n \"static-mesh-gradient\": StaticMeshGradientProps;\n \"simplex-noise\": SimplexNoiseProps;\n \"perlin-noise\": PerlinNoiseProps;\n};\n\nexport type ShaderBackgroundVariant = keyof ShaderVariantProps;\n\nexport type ShaderBackgroundProps = {\n [K in ShaderBackgroundVariant]: { variant: K } & ShaderVariantProps[K];\n}[ShaderBackgroundVariant];\n\nconst VARIANT_COMPONENTS: {\n [K in ShaderBackgroundVariant]: ComponentType<ShaderVariantProps[K]>;\n} = {\n \"mesh-gradient\": MeshGradient,\n \"grain-gradient\": GrainGradient,\n \"dot-grid\": DotGrid,\n \"dot-orbit\": DotOrbit,\n warp: Warp,\n waves: Waves,\n water: Water,\n voronoi: Voronoi,\n swirl: Swirl,\n \"smoke-ring\": SmokeRing,\n \"static-radial-gradient\": StaticRadialGradient,\n \"neuro-noise\": NeuroNoise,\n metaballs: Metaballs,\n \"god-rays\": GodRays,\n spiral: Spiral,\n dithering: Dithering,\n \"pulsing-border\": PulsingBorder,\n \"color-panels\": ColorPanels,\n \"static-mesh-gradient\": StaticMeshGradient,\n \"simplex-noise\": SimplexNoise,\n \"perlin-noise\": PerlinNoise,\n};\n\nexport const SHADER_BACKGROUND_VARIANTS = Object.keys(\n VARIANT_COMPONENTS,\n) as ShaderBackgroundVariant[];\n\n/**\n * Not every variant animates (e.g. dot-grid is a static pattern), so `speed`\n * is only frozen for reduced motion when the variant actually exposes it.\n */\nexport function ShaderBackground({ variant, className, ...rest }: ShaderBackgroundProps) {\n const reducedMotion = useReducedMotion();\n const Shader = VARIANT_COMPONENTS[variant] as ComponentType<Record<string, unknown>>;\n const props = rest as Record<string, unknown>;\n const speedProps = reducedMotion && \"speed\" in props ? { speed: 0 } : {};\n\n return <Shader {...props} {...speedProps} className={cn(\"h-full w-full\", className)} />;\n}\n"],"mappings":";;;;;;AAiFA,MAAM,qBAEF;CACF,iBAAiB;CACjB,kBAAkB;CAClB,YAAY;CACZ,aAAa;CACb,MAAM;CACN,OAAO;CACP,OAAO;CACP,SAAS;CACT,OAAO;CACP,cAAc;CACd,0BAA0B;CAC1B,eAAe;CACf,WAAW;CACX,YAAY;CACZ,QAAQ;CACR,WAAW;CACX,kBAAkB;CAClB,gBAAgB;CAChB,wBAAwB;CACxB,iBAAiB;CACjB,gBAAgB;AAClB;AAEA,MAAa,6BAA6B,OAAO,KAC/C,kBACF;;;;;AAMA,SAAgB,iBAAiB,EAAE,SAAS,WAAW,GAAG,QAA+B;CACvF,MAAM,gBAAgB,iBAAiB;CACvC,MAAM,SAAS,mBAAmB;CAClC,MAAM,QAAQ;CACd,MAAM,aAAa,iBAAiB,WAAW,QAAQ,EAAE,OAAO,EAAE,IAAI,CAAC;CAEvE,OAAO,oBAAC,QAAD;EAAQ,GAAI;EAAO,GAAI;EAAY,WAAW,GAAG,iBAAiB,SAAS;CAAI,CAAA;AACxF"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { HTMLAttributes, ReactNode } from "react";
|
|
2
|
+
//#region src/components/motion/shared-layout-bg.d.ts
|
|
3
|
+
interface SharedLayoutBgProps extends Omit<HTMLAttributes<HTMLElement>, "children"> {
|
|
4
|
+
children: ReactNode;
|
|
5
|
+
/** Semantic container used for the children. */
|
|
6
|
+
as?: "div" | "ul";
|
|
7
|
+
/** Tailwind class applied to the moving pill. Defaults to a subtle foreground tint. */
|
|
8
|
+
pillClassName?: string;
|
|
9
|
+
/** Horizontal inset of the pill relative to each row (px). Default 20. */
|
|
10
|
+
inset?: number;
|
|
11
|
+
/** Optional positioning override for the pill wrapper inside each item. */
|
|
12
|
+
pillContainerClassName?: string;
|
|
13
|
+
}
|
|
14
|
+
declare const SharedLayoutBg: import("react").ForwardRefExoticComponent<SharedLayoutBgProps & import("react").RefAttributes<HTMLElement>>;
|
|
15
|
+
//#endregion
|
|
16
|
+
export { SharedLayoutBg, SharedLayoutBgProps };
|
|
17
|
+
//# sourceMappingURL=shared-layout-bg.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shared-layout-bg.d.ts","names":[],"sources":["../../../src/components/motion/shared-layout-bg.tsx"],"mappings":";;UA0BiB,4BAA4B,KAAK,eAAe;EAC/D,UAAU;;EAEV;;EAEA;;EAEA;;EAEA;;cAeW,gCAAc,0BAAA,sCAAA,cAAA"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { SPRING_LAYOUT } from "../../lib/ease.js";
|
|
3
|
+
import { Children, cloneElement, forwardRef, isValidElement, useId, useState } from "react";
|
|
4
|
+
import { cn } from "@kumix/utils";
|
|
5
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
import { AnimatePresence, motion, useReducedMotion } from "motion/react";
|
|
7
|
+
//#region src/components/motion/shared-layout-bg.tsx
|
|
8
|
+
const variants = {
|
|
9
|
+
initial: {
|
|
10
|
+
opacity: 0,
|
|
11
|
+
filter: "blur(6px)"
|
|
12
|
+
},
|
|
13
|
+
animate: {
|
|
14
|
+
opacity: 1,
|
|
15
|
+
filter: "blur(0px)"
|
|
16
|
+
},
|
|
17
|
+
exit: (isActive) => !isActive ? {
|
|
18
|
+
opacity: 0,
|
|
19
|
+
filter: "blur(6px)"
|
|
20
|
+
} : {}
|
|
21
|
+
};
|
|
22
|
+
const reducedVariants = {
|
|
23
|
+
initial: { opacity: 0 },
|
|
24
|
+
animate: { opacity: 1 },
|
|
25
|
+
exit: (isActive) => !isActive ? { opacity: 0 } : {}
|
|
26
|
+
};
|
|
27
|
+
const SharedLayoutBg = forwardRef(function SharedLayoutBg({ children, as = "div", className, onMouseLeave, pillClassName, pillContainerClassName, inset = 20, ...props }, forwardedRef) {
|
|
28
|
+
const [activeId, setActiveId] = useState(null);
|
|
29
|
+
const uid = useId();
|
|
30
|
+
const reduce = useReducedMotion();
|
|
31
|
+
const renderedChildren = Children.toArray(children).filter(isValidElement).map((child, index) => {
|
|
32
|
+
const el = child;
|
|
33
|
+
const childKey = el.key ? String(el.key) : `item-${index}`;
|
|
34
|
+
return cloneElement(el, {
|
|
35
|
+
key: childKey,
|
|
36
|
+
className: cn("relative", el.props.className),
|
|
37
|
+
onMouseEnter: () => {
|
|
38
|
+
el.props.onMouseEnter?.();
|
|
39
|
+
setActiveId(childKey);
|
|
40
|
+
}
|
|
41
|
+
}, /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(AnimatePresence, {
|
|
42
|
+
custom: activeId !== null,
|
|
43
|
+
children: activeId !== null ? /* @__PURE__ */ jsx(motion.div, {
|
|
44
|
+
variants: reduce ? reducedVariants : variants,
|
|
45
|
+
initial: "initial",
|
|
46
|
+
animate: "animate",
|
|
47
|
+
exit: "exit",
|
|
48
|
+
custom: activeId !== null,
|
|
49
|
+
className: cn("pointer-events-none absolute inset-y-0", pillContainerClassName),
|
|
50
|
+
style: {
|
|
51
|
+
left: -inset,
|
|
52
|
+
right: -inset
|
|
53
|
+
},
|
|
54
|
+
children: activeId === childKey ? /* @__PURE__ */ jsx(motion.div, {
|
|
55
|
+
layoutId: `shared-bg-${uid}`,
|
|
56
|
+
transition: reduce ? { duration: 0 } : SPRING_LAYOUT,
|
|
57
|
+
className: cn("pointer-events-none h-full w-full rounded-2xl bg-primary/6", pillClassName)
|
|
58
|
+
}) : null
|
|
59
|
+
}) : null
|
|
60
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
61
|
+
className: "relative z-10",
|
|
62
|
+
children: el.props.children
|
|
63
|
+
})] }));
|
|
64
|
+
});
|
|
65
|
+
const handleMouseLeave = (event) => {
|
|
66
|
+
setActiveId(null);
|
|
67
|
+
onMouseLeave?.(event);
|
|
68
|
+
};
|
|
69
|
+
return as === "ul" ? /* @__PURE__ */ jsx(motion.ul, {
|
|
70
|
+
...props,
|
|
71
|
+
ref: forwardedRef,
|
|
72
|
+
layoutRoot: true,
|
|
73
|
+
onMouseLeave: handleMouseLeave,
|
|
74
|
+
className: cn("flex w-full flex-col", className),
|
|
75
|
+
children: renderedChildren
|
|
76
|
+
}) : /* @__PURE__ */ jsx(motion.div, {
|
|
77
|
+
...props,
|
|
78
|
+
ref: forwardedRef,
|
|
79
|
+
layoutRoot: true,
|
|
80
|
+
onMouseLeave: handleMouseLeave,
|
|
81
|
+
className: cn("flex w-full flex-col", className),
|
|
82
|
+
children: renderedChildren
|
|
83
|
+
});
|
|
84
|
+
});
|
|
85
|
+
//#endregion
|
|
86
|
+
export { SharedLayoutBg };
|
|
87
|
+
|
|
88
|
+
//# sourceMappingURL=shared-layout-bg.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shared-layout-bg.js","names":[],"sources":["../../../src/components/motion/shared-layout-bg.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n Children,\n cloneElement,\n forwardRef,\n type HTMLAttributes,\n isValidElement,\n type MouseEvent,\n type ReactElement,\n type ReactNode,\n type Ref,\n useId,\n useState,\n} 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 { SPRING_LAYOUT } from \"../../lib/ease\";\n\nexport interface SharedLayoutBgProps extends Omit<HTMLAttributes<HTMLElement>, \"children\"> {\n children: ReactNode;\n /** Semantic container used for the children. */\n as?: \"div\" | \"ul\";\n /** Tailwind class applied to the moving pill. Defaults to a subtle foreground tint. */\n pillClassName?: string;\n /** Horizontal inset of the pill relative to each row (px). Default 20. */\n inset?: number;\n /** Optional positioning override for the pill wrapper inside each item. */\n pillContainerClassName?: string;\n}\n\nconst variants: Variants = {\n initial: { opacity: 0, filter: \"blur(6px)\" },\n animate: { opacity: 1, filter: \"blur(0px)\" },\n exit: (isActive: boolean) => (!isActive ? { opacity: 0, filter: \"blur(6px)\" } : {}),\n};\n\nconst reducedVariants: Variants = {\n initial: { opacity: 0 },\n animate: { opacity: 1 },\n exit: (isActive: boolean) => (!isActive ? { opacity: 0 } : {}),\n};\n\nexport const SharedLayoutBg = forwardRef<HTMLElement, SharedLayoutBgProps>(function SharedLayoutBg(\n {\n children,\n as = \"div\",\n className,\n onMouseLeave,\n pillClassName,\n pillContainerClassName,\n inset = 20,\n ...props\n },\n forwardedRef,\n) {\n const [activeId, setActiveId] = useState<string | null>(null);\n const uid = useId();\n const reduce = useReducedMotion();\n\n const renderedChildren = Children.toArray(children)\n .filter(isValidElement)\n .map((child, index) => {\n const el = child as ReactElement<{\n className?: string;\n onMouseEnter?: () => void;\n children?: ReactNode;\n }>;\n const childKey = el.key ? String(el.key) : `item-${index}`;\n return cloneElement(\n el,\n {\n key: childKey,\n className: cn(\"relative\", el.props.className),\n onMouseEnter: () => {\n el.props.onMouseEnter?.();\n setActiveId(childKey);\n },\n },\n <>\n <AnimatePresence custom={activeId !== null}>\n {activeId !== null ? (\n <motion.div\n variants={reduce ? reducedVariants : variants}\n initial=\"initial\"\n animate=\"animate\"\n exit=\"exit\"\n custom={activeId !== null}\n className={cn(\"pointer-events-none absolute inset-y-0\", pillContainerClassName)}\n style={{ left: -inset, right: -inset }}\n >\n {activeId === childKey ? (\n <motion.div\n layoutId={`shared-bg-${uid}`}\n transition={reduce ? { duration: 0 } : SPRING_LAYOUT}\n className={cn(\n \"pointer-events-none h-full w-full rounded-2xl bg-primary/6\",\n pillClassName,\n )}\n />\n ) : null}\n </motion.div>\n ) : null}\n </AnimatePresence>\n <div className=\"relative z-10\">{el.props.children}</div>\n </>,\n );\n });\n\n const handleMouseLeave = (event: MouseEvent<HTMLElement>) => {\n setActiveId(null);\n onMouseLeave?.(event);\n };\n\n // layoutRoot scopes the pill's layout projection to this list, so fixed or\n // scrolled ancestors can't smear scroll offsets into its movement.\n return as === \"ul\" ? (\n <motion.ul\n {...(props as HTMLMotionProps<\"ul\">)}\n ref={forwardedRef as Ref<HTMLUListElement>}\n layoutRoot\n onMouseLeave={handleMouseLeave}\n className={cn(\"flex w-full flex-col\", className)}\n >\n {renderedChildren}\n </motion.ul>\n ) : (\n <motion.div\n {...(props as HTMLMotionProps<\"div\">)}\n ref={forwardedRef as Ref<HTMLDivElement>}\n layoutRoot\n onMouseLeave={handleMouseLeave}\n className={cn(\"flex w-full flex-col\", className)}\n >\n {renderedChildren}\n </motion.div>\n );\n});\n"],"mappings":";;;;;;;AAsCA,MAAM,WAAqB;CACzB,SAAS;EAAE,SAAS;EAAG,QAAQ;CAAY;CAC3C,SAAS;EAAE,SAAS;EAAG,QAAQ;CAAY;CAC3C,OAAO,aAAuB,CAAC,WAAW;EAAE,SAAS;EAAG,QAAQ;CAAY,IAAI,CAAC;AACnF;AAEA,MAAM,kBAA4B;CAChC,SAAS,EAAE,SAAS,EAAE;CACtB,SAAS,EAAE,SAAS,EAAE;CACtB,OAAO,aAAuB,CAAC,WAAW,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;EACE,GAAK;EACL,KAAK;EACL,YAAA;EACA,cAAc;EACd,WAAW,GAAG,wBAAwB,SAAS;EAE9C,UAAA;CACQ,CAAA,IAEX,oBAAC,OAAO,KAAR;EACE,GAAK;EACL,KAAK;EACL,YAAA;EACA,cAAc;EACd,WAAW,GAAG,wBAAwB,SAAS;EAE9C,UAAA;CACS,CAAA;AAEhB,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { HTMLAttributes, ReactNode } from "react";
|
|
2
|
+
//#region src/components/motion/slide-action-button.d.ts
|
|
3
|
+
interface SlideActionButtonProps extends Omit<HTMLAttributes<HTMLDivElement>, "children"> {
|
|
4
|
+
children: ReactNode;
|
|
5
|
+
completeLabel?: ReactNode;
|
|
6
|
+
threshold?: number;
|
|
7
|
+
resetDelay?: number;
|
|
8
|
+
onComplete?: () => void;
|
|
9
|
+
thumbClassName?: string;
|
|
10
|
+
fillClassName?: string;
|
|
11
|
+
}
|
|
12
|
+
declare function SlideActionButton({ children, completeLabel, threshold, resetDelay, onComplete, thumbClassName, fillClassName, className, ...rest }: SlideActionButtonProps): import("react").JSX.Element;
|
|
13
|
+
//#endregion
|
|
14
|
+
export { SlideActionButton, SlideActionButtonProps };
|
|
15
|
+
//# sourceMappingURL=slide-action-button.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"slide-action-button.d.ts","names":[],"sources":["../../../src/components/motion/slide-action-button.tsx"],"mappings":";;UAgBiB,+BAA+B,KAAK,eAAe;EAClE,UAAU;EACV,gBAAgB;EAChB;EACA;EACA;EACA;EACA;;iBAGc,oBACd,UACA,eACA,WACA,YACA,YACA,gBACA,eACA,cACG,QACF,yCAAsB,IAAA"}
|