@kumix/ui 0.2.4 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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 +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-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 +2 -2
- 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.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/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.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/empty.d.ts +1 -1
- package/dist/components/ui/empty.js +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/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/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
|
@@ -0,0 +1,611 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { EASE_DRAWER, EASE_OUT, SPRING_LAYOUT, SPRING_PRESS } from "../../lib/ease.js";
|
|
3
|
+
import { SharedLayoutBg } from "./shared-layout-bg.js";
|
|
4
|
+
import { createContext, createElement, forwardRef, useCallback, useContext, useEffect, useId, useRef, useState, useSyncExternalStore } from "react";
|
|
5
|
+
import { cn } from "@kumix/utils";
|
|
6
|
+
import { AnimatePresence, motion, useReducedMotion } from "motion/react";
|
|
7
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
import { ChevronRight } from "lucide-react";
|
|
9
|
+
import { createPortal } from "react-dom";
|
|
10
|
+
//#region src/components/motion/animated-sidebar.tsx
|
|
11
|
+
const MOBILE_QUERY = "(max-width: 767px)";
|
|
12
|
+
const SIDEBAR_KEYBOARD_SHORTCUT = "b";
|
|
13
|
+
const PANEL_TRANSITION = {
|
|
14
|
+
duration: .36,
|
|
15
|
+
ease: EASE_DRAWER
|
|
16
|
+
};
|
|
17
|
+
const SIDEBAR_MORPH_TRANSITION = {
|
|
18
|
+
type: "spring",
|
|
19
|
+
stiffness: 380,
|
|
20
|
+
damping: 28,
|
|
21
|
+
mass: .75
|
|
22
|
+
};
|
|
23
|
+
const LABEL_ENTER_TRANSITION = {
|
|
24
|
+
duration: .2,
|
|
25
|
+
delay: .08,
|
|
26
|
+
ease: EASE_OUT
|
|
27
|
+
};
|
|
28
|
+
const LABEL_EXIT_TRANSITION = {
|
|
29
|
+
duration: .12,
|
|
30
|
+
ease: EASE_OUT
|
|
31
|
+
};
|
|
32
|
+
const SUBMENU_TRANSITION = {
|
|
33
|
+
duration: .18,
|
|
34
|
+
ease: EASE_OUT
|
|
35
|
+
};
|
|
36
|
+
const SUBMENU_VARIANTS = {
|
|
37
|
+
closed: {
|
|
38
|
+
opacity: 0,
|
|
39
|
+
clipPath: "inset(0 0 100% 0 round 8px)",
|
|
40
|
+
transition: {
|
|
41
|
+
duration: .14,
|
|
42
|
+
ease: EASE_OUT,
|
|
43
|
+
staggerChildren: .025,
|
|
44
|
+
staggerDirection: -1
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
open: {
|
|
48
|
+
opacity: 1,
|
|
49
|
+
clipPath: "inset(0 0 0% 0 round 8px)",
|
|
50
|
+
transition: {
|
|
51
|
+
duration: .2,
|
|
52
|
+
delayChildren: .035,
|
|
53
|
+
ease: EASE_OUT,
|
|
54
|
+
staggerChildren: .045
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
const SUBMENU_ITEM_VARIANTS = {
|
|
59
|
+
closed: {
|
|
60
|
+
opacity: 0,
|
|
61
|
+
y: -6,
|
|
62
|
+
filter: "blur(3px)"
|
|
63
|
+
},
|
|
64
|
+
open: {
|
|
65
|
+
opacity: 1,
|
|
66
|
+
y: 0,
|
|
67
|
+
filter: "blur(0px)",
|
|
68
|
+
transition: SUBMENU_TRANSITION
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
const REDUCED_TRANSITION = {
|
|
72
|
+
duration: .16,
|
|
73
|
+
ease: EASE_OUT
|
|
74
|
+
};
|
|
75
|
+
const FOCUSABLE_SELECTOR = [
|
|
76
|
+
"a[href]",
|
|
77
|
+
"button:not([disabled])",
|
|
78
|
+
"input:not([disabled])",
|
|
79
|
+
"select:not([disabled])",
|
|
80
|
+
"textarea:not([disabled])",
|
|
81
|
+
"[tabindex]:not([tabindex='-1'])"
|
|
82
|
+
].join(",");
|
|
83
|
+
function subscribeToMobileQuery(callback) {
|
|
84
|
+
const query = window.matchMedia(MOBILE_QUERY);
|
|
85
|
+
query.addEventListener("change", callback);
|
|
86
|
+
return () => query.removeEventListener("change", callback);
|
|
87
|
+
}
|
|
88
|
+
function getMobileSnapshot() {
|
|
89
|
+
return window.matchMedia(MOBILE_QUERY).matches;
|
|
90
|
+
}
|
|
91
|
+
function getServerMobileSnapshot() {
|
|
92
|
+
return false;
|
|
93
|
+
}
|
|
94
|
+
function useIsMobile() {
|
|
95
|
+
return useSyncExternalStore(subscribeToMobileQuery, getMobileSnapshot, getServerMobileSnapshot);
|
|
96
|
+
}
|
|
97
|
+
const AnimatedSidebarContext = createContext(null);
|
|
98
|
+
const AnimatedSidebarPanelContext = createContext(null);
|
|
99
|
+
function useAnimatedSidebar() {
|
|
100
|
+
const context = useContext(AnimatedSidebarContext);
|
|
101
|
+
if (!context) throw new Error("useAnimatedSidebar must be used inside AnimatedSidebarProvider.");
|
|
102
|
+
return context;
|
|
103
|
+
}
|
|
104
|
+
function useAnimatedSidebarPanel() {
|
|
105
|
+
const context = useContext(AnimatedSidebarPanelContext);
|
|
106
|
+
if (!context) throw new Error("Animated Sidebar parts must be used inside AnimatedSidebar.");
|
|
107
|
+
return context;
|
|
108
|
+
}
|
|
109
|
+
function AnimatedSidebarProvider({ children, open, defaultOpen = true, onOpenChange, openMobile, defaultOpenMobile = false, onOpenMobileChange, className, style, ...props }) {
|
|
110
|
+
const [internalOpen, setInternalOpen] = useState(defaultOpen);
|
|
111
|
+
const [internalOpenMobile, setInternalOpenMobile] = useState(defaultOpenMobile);
|
|
112
|
+
const isMobile = useIsMobile();
|
|
113
|
+
const reduce = useReducedMotion() ?? false;
|
|
114
|
+
const generatedId = useId();
|
|
115
|
+
const triggerRef = useRef(null);
|
|
116
|
+
const desktopOpen = open ?? internalOpen;
|
|
117
|
+
const mobileOpen = openMobile ?? internalOpenMobile;
|
|
118
|
+
const setOpen = useCallback((nextOpen) => {
|
|
119
|
+
if (open === void 0) setInternalOpen(nextOpen);
|
|
120
|
+
onOpenChange?.(nextOpen);
|
|
121
|
+
}, [onOpenChange, open]);
|
|
122
|
+
const setOpenMobile = useCallback((nextOpen) => {
|
|
123
|
+
if (openMobile === void 0) setInternalOpenMobile(nextOpen);
|
|
124
|
+
onOpenMobileChange?.(nextOpen);
|
|
125
|
+
}, [onOpenMobileChange, openMobile]);
|
|
126
|
+
const toggleSidebar = useCallback(() => {
|
|
127
|
+
if (isMobile) setOpenMobile(!mobileOpen);
|
|
128
|
+
else setOpen(!desktopOpen);
|
|
129
|
+
}, [
|
|
130
|
+
desktopOpen,
|
|
131
|
+
isMobile,
|
|
132
|
+
mobileOpen,
|
|
133
|
+
setOpen,
|
|
134
|
+
setOpenMobile
|
|
135
|
+
]);
|
|
136
|
+
useEffect(() => {
|
|
137
|
+
const handleShortcut = (event) => {
|
|
138
|
+
if (event.key.toLowerCase() === SIDEBAR_KEYBOARD_SHORTCUT && (event.metaKey || event.ctrlKey)) {
|
|
139
|
+
event.preventDefault();
|
|
140
|
+
toggleSidebar();
|
|
141
|
+
}
|
|
142
|
+
};
|
|
143
|
+
window.addEventListener("keydown", handleShortcut);
|
|
144
|
+
return () => window.removeEventListener("keydown", handleShortcut);
|
|
145
|
+
}, [toggleSidebar]);
|
|
146
|
+
return /* @__PURE__ */ jsx(AnimatedSidebarContext.Provider, {
|
|
147
|
+
value: {
|
|
148
|
+
isMobile,
|
|
149
|
+
layoutId: `${generatedId}-active`,
|
|
150
|
+
open: desktopOpen,
|
|
151
|
+
openMobile: mobileOpen,
|
|
152
|
+
reduce,
|
|
153
|
+
setOpen,
|
|
154
|
+
setOpenMobile,
|
|
155
|
+
state: desktopOpen ? "expanded" : "collapsed",
|
|
156
|
+
toggleSidebar,
|
|
157
|
+
triggerRef
|
|
158
|
+
},
|
|
159
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
160
|
+
...props,
|
|
161
|
+
"data-slot": "sidebar-wrapper",
|
|
162
|
+
"data-state": desktopOpen ? "expanded" : "collapsed",
|
|
163
|
+
style: {
|
|
164
|
+
"--sidebar-width": "16rem",
|
|
165
|
+
"--sidebar-width-icon": "4.25rem",
|
|
166
|
+
"--sidebar-width-mobile": "18rem",
|
|
167
|
+
...style
|
|
168
|
+
},
|
|
169
|
+
className: cn("group/sidebar-wrapper flex min-h-svh w-full min-w-0", className),
|
|
170
|
+
children
|
|
171
|
+
})
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
function MobileSidebar({ ariaLabel, children, className, side }) {
|
|
175
|
+
const context = useAnimatedSidebar();
|
|
176
|
+
const panelRef = useRef(null);
|
|
177
|
+
const [mounted, setMounted] = useState(false);
|
|
178
|
+
useEffect(() => setMounted(true), []);
|
|
179
|
+
useEffect(() => {
|
|
180
|
+
if (!context.openMobile) return;
|
|
181
|
+
const body = document.body;
|
|
182
|
+
const scrollY = window.scrollY;
|
|
183
|
+
const previousBodyStyles = {
|
|
184
|
+
left: body.style.left,
|
|
185
|
+
overflow: body.style.overflow,
|
|
186
|
+
position: body.style.position,
|
|
187
|
+
right: body.style.right,
|
|
188
|
+
top: body.style.top
|
|
189
|
+
};
|
|
190
|
+
body.style.position = "fixed";
|
|
191
|
+
body.style.top = `-${scrollY}px`;
|
|
192
|
+
body.style.left = "0";
|
|
193
|
+
body.style.right = "0";
|
|
194
|
+
body.style.overflow = "hidden";
|
|
195
|
+
const focusFrame = requestAnimationFrame(() => {
|
|
196
|
+
(panelRef.current?.querySelector(FOCUSABLE_SELECTOR) ?? panelRef.current)?.focus({ preventScroll: true });
|
|
197
|
+
});
|
|
198
|
+
return () => {
|
|
199
|
+
cancelAnimationFrame(focusFrame);
|
|
200
|
+
body.style.position = previousBodyStyles.position;
|
|
201
|
+
body.style.top = previousBodyStyles.top;
|
|
202
|
+
body.style.left = previousBodyStyles.left;
|
|
203
|
+
body.style.right = previousBodyStyles.right;
|
|
204
|
+
body.style.overflow = previousBodyStyles.overflow;
|
|
205
|
+
window.scrollTo(0, scrollY);
|
|
206
|
+
context.triggerRef.current?.focus({ preventScroll: true });
|
|
207
|
+
};
|
|
208
|
+
}, [context.openMobile, context.triggerRef]);
|
|
209
|
+
if (!mounted) return null;
|
|
210
|
+
return createPortal(/* @__PURE__ */ jsxs("div", {
|
|
211
|
+
className: cn("pointer-events-none fixed inset-0 z-50 md:hidden", context.openMobile ? "visible" : "invisible"),
|
|
212
|
+
children: [/* @__PURE__ */ jsx(motion.button, {
|
|
213
|
+
type: "button",
|
|
214
|
+
"aria-label": "Close sidebar",
|
|
215
|
+
tabIndex: context.openMobile ? 0 : -1,
|
|
216
|
+
initial: false,
|
|
217
|
+
animate: { opacity: context.openMobile ? 1 : 0 },
|
|
218
|
+
transition: context.reduce ? REDUCED_TRANSITION : PANEL_TRANSITION,
|
|
219
|
+
onClick: () => context.setOpenMobile(false),
|
|
220
|
+
className: cn("absolute inset-0 bg-black/40", context.openMobile ? "pointer-events-auto" : "pointer-events-none")
|
|
221
|
+
}), /* @__PURE__ */ jsx(motion.div, {
|
|
222
|
+
ref: panelRef,
|
|
223
|
+
role: "dialog",
|
|
224
|
+
"aria-modal": "true",
|
|
225
|
+
"aria-label": ariaLabel,
|
|
226
|
+
"aria-hidden": !context.openMobile,
|
|
227
|
+
inert: !context.openMobile,
|
|
228
|
+
tabIndex: -1,
|
|
229
|
+
"data-mobile": "true",
|
|
230
|
+
"data-state": context.openMobile ? "expanded" : "collapsed",
|
|
231
|
+
"data-side": side,
|
|
232
|
+
initial: false,
|
|
233
|
+
animate: {
|
|
234
|
+
opacity: context.reduce ? context.openMobile ? 1 : 0 : 1,
|
|
235
|
+
x: context.reduce ? 0 : context.openMobile ? "0%" : side === "left" ? "-100%" : "100%"
|
|
236
|
+
},
|
|
237
|
+
transition: context.reduce ? REDUCED_TRANSITION : PANEL_TRANSITION,
|
|
238
|
+
onKeyDown: (event) => {
|
|
239
|
+
if (event.key === "Escape") {
|
|
240
|
+
event.preventDefault();
|
|
241
|
+
context.setOpenMobile(false);
|
|
242
|
+
return;
|
|
243
|
+
}
|
|
244
|
+
if (event.key !== "Tab") return;
|
|
245
|
+
const focusable = panelRef.current ? Array.from(panelRef.current.querySelectorAll(FOCUSABLE_SELECTOR)) : [];
|
|
246
|
+
if (focusable.length === 0) {
|
|
247
|
+
event.preventDefault();
|
|
248
|
+
panelRef.current?.focus();
|
|
249
|
+
return;
|
|
250
|
+
}
|
|
251
|
+
const first = focusable[0];
|
|
252
|
+
const last = focusable[focusable.length - 1];
|
|
253
|
+
if (event.shiftKey && document.activeElement === first) {
|
|
254
|
+
event.preventDefault();
|
|
255
|
+
last.focus();
|
|
256
|
+
} else if (!event.shiftKey && document.activeElement === last) {
|
|
257
|
+
event.preventDefault();
|
|
258
|
+
first.focus();
|
|
259
|
+
}
|
|
260
|
+
},
|
|
261
|
+
className: cn("pointer-events-auto absolute inset-y-0 flex h-dvh w-(--sidebar-width-mobile) max-w-[88vw] flex-col overflow-hidden", "border-border bg-background shadow-2xl will-change-transform", side === "left" ? "left-0 border-r" : "right-0 border-l", !context.openMobile && "pointer-events-none", className),
|
|
262
|
+
children: /* @__PURE__ */ jsx(AnimatedSidebarPanelContext.Provider, {
|
|
263
|
+
value: {
|
|
264
|
+
collapsed: false,
|
|
265
|
+
collapsible: "none",
|
|
266
|
+
side
|
|
267
|
+
},
|
|
268
|
+
children
|
|
269
|
+
})
|
|
270
|
+
})]
|
|
271
|
+
}), document.body);
|
|
272
|
+
}
|
|
273
|
+
const AnimatedSidebar = forwardRef(function AnimatedSidebar({ side = "left", variant = "sidebar", collapsible = "icon", ariaLabel = "Sidebar", children, className, panelClassName, style, ...props }, forwardedRef) {
|
|
274
|
+
const context = useAnimatedSidebar();
|
|
275
|
+
const collapsed = collapsible !== "none" && !context.open;
|
|
276
|
+
const offcanvas = collapsed && collapsible === "offcanvas";
|
|
277
|
+
const width = offcanvas ? "0px" : collapsed ? "var(--sidebar-width-icon)" : "var(--sidebar-width)";
|
|
278
|
+
if (context.isMobile) return /* @__PURE__ */ jsx(MobileSidebar, {
|
|
279
|
+
ariaLabel,
|
|
280
|
+
className,
|
|
281
|
+
side,
|
|
282
|
+
children
|
|
283
|
+
});
|
|
284
|
+
return /* @__PURE__ */ jsx(motion.aside, {
|
|
285
|
+
...props,
|
|
286
|
+
ref: forwardedRef,
|
|
287
|
+
initial: false,
|
|
288
|
+
"aria-label": ariaLabel,
|
|
289
|
+
"data-slot": "sidebar",
|
|
290
|
+
"data-state": collapsed ? "collapsed" : "expanded",
|
|
291
|
+
"data-collapsible": collapsible,
|
|
292
|
+
"data-variant": variant,
|
|
293
|
+
"data-side": side,
|
|
294
|
+
animate: { width },
|
|
295
|
+
transition: context.reduce ? { duration: 0 } : SIDEBAR_MORPH_TRANSITION,
|
|
296
|
+
style,
|
|
297
|
+
className: cn("group/sidebar relative hidden h-auto shrink-0 will-change-[width] md:block", "peer", side === "right" && "order-last", className),
|
|
298
|
+
children: /* @__PURE__ */ jsx(motion.div, {
|
|
299
|
+
initial: false,
|
|
300
|
+
animate: {
|
|
301
|
+
opacity: offcanvas ? 0 : 1,
|
|
302
|
+
x: offcanvas ? side === "left" ? "-100%" : "100%" : "0%"
|
|
303
|
+
},
|
|
304
|
+
transition: context.reduce ? REDUCED_TRANSITION : PANEL_TRANSITION,
|
|
305
|
+
className: cn("sticky top-0 flex h-svh w-full flex-col overflow-hidden bg-background", variant === "sidebar" && (side === "left" ? "border-border border-r" : "border-border border-l"), variant === "floating" && "m-2 h-[calc(100svh-1rem)] rounded-2xl border border-border shadow-sm", variant === "inset" && "m-2 h-[calc(100svh-1rem)] rounded-2xl", panelClassName),
|
|
306
|
+
children: /* @__PURE__ */ jsx(AnimatedSidebarPanelContext.Provider, {
|
|
307
|
+
value: {
|
|
308
|
+
collapsed,
|
|
309
|
+
collapsible,
|
|
310
|
+
side
|
|
311
|
+
},
|
|
312
|
+
children
|
|
313
|
+
})
|
|
314
|
+
})
|
|
315
|
+
});
|
|
316
|
+
});
|
|
317
|
+
const AnimatedSidebarTrigger = forwardRef(function AnimatedSidebarTrigger({ className, onClick, type = "button", ...props }, forwardedRef) {
|
|
318
|
+
const context = useAnimatedSidebar();
|
|
319
|
+
const expanded = context.isMobile ? context.openMobile : context.open;
|
|
320
|
+
return /* @__PURE__ */ jsx("button", {
|
|
321
|
+
...props,
|
|
322
|
+
ref: (node) => {
|
|
323
|
+
context.triggerRef.current = node;
|
|
324
|
+
if (typeof forwardedRef === "function") forwardedRef(node);
|
|
325
|
+
else if (forwardedRef) forwardedRef.current = node;
|
|
326
|
+
},
|
|
327
|
+
type,
|
|
328
|
+
"aria-label": props["aria-label"] ?? "Toggle sidebar",
|
|
329
|
+
"aria-expanded": expanded,
|
|
330
|
+
"data-slot": "sidebar-trigger",
|
|
331
|
+
"data-state": expanded ? "expanded" : "collapsed",
|
|
332
|
+
onClick: (event) => {
|
|
333
|
+
onClick?.(event);
|
|
334
|
+
if (!event.defaultPrevented) context.toggleSidebar();
|
|
335
|
+
},
|
|
336
|
+
className: cn("inline-flex size-10 shrink-0 items-center justify-center rounded-xl outline-none", "focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background", className)
|
|
337
|
+
});
|
|
338
|
+
});
|
|
339
|
+
const AnimatedSidebarClose = forwardRef(function AnimatedSidebarClose({ className, onClick, type = "button", ...props }, forwardedRef) {
|
|
340
|
+
const context = useAnimatedSidebar();
|
|
341
|
+
return /* @__PURE__ */ jsx("button", {
|
|
342
|
+
...props,
|
|
343
|
+
ref: forwardedRef,
|
|
344
|
+
type,
|
|
345
|
+
"aria-label": props["aria-label"] ?? "Close sidebar",
|
|
346
|
+
onClick: (event) => {
|
|
347
|
+
onClick?.(event);
|
|
348
|
+
if (event.defaultPrevented) return;
|
|
349
|
+
if (context.isMobile) context.setOpenMobile(false);
|
|
350
|
+
else context.setOpen(false);
|
|
351
|
+
},
|
|
352
|
+
className: cn("inline-flex size-10 shrink-0 items-center justify-center rounded-xl outline-none", "focus-visible:ring-2 focus-visible:ring-ring", className)
|
|
353
|
+
});
|
|
354
|
+
});
|
|
355
|
+
const AnimatedSidebarRail = forwardRef(function AnimatedSidebarRail({ className, onClick, type = "button", ...props }, forwardedRef) {
|
|
356
|
+
const context = useAnimatedSidebar();
|
|
357
|
+
const panel = useAnimatedSidebarPanel();
|
|
358
|
+
return /* @__PURE__ */ jsx("button", {
|
|
359
|
+
...props,
|
|
360
|
+
ref: forwardedRef,
|
|
361
|
+
type,
|
|
362
|
+
"data-side": panel.side,
|
|
363
|
+
"aria-label": props["aria-label"] ?? "Toggle sidebar",
|
|
364
|
+
title: "Toggle sidebar",
|
|
365
|
+
tabIndex: -1,
|
|
366
|
+
onClick: (event) => {
|
|
367
|
+
onClick?.(event);
|
|
368
|
+
if (!event.defaultPrevented) context.toggleSidebar();
|
|
369
|
+
},
|
|
370
|
+
className: cn("absolute inset-y-0 z-20 hidden w-4 -translate-x-1/2 outline-none md:block", "after:absolute after:inset-y-0 after:left-1/2 after:w-px after:bg-transparent after:transition-colors hover:after:bg-border", "data-[side=right]:right-0 data-[side=left]:left-full data-[side=right]:translate-x-1/2", className)
|
|
371
|
+
});
|
|
372
|
+
});
|
|
373
|
+
const AnimatedSidebarInset = forwardRef(function AnimatedSidebarInset({ className, ...props }, forwardedRef) {
|
|
374
|
+
return /* @__PURE__ */ jsx(motion.main, {
|
|
375
|
+
...props,
|
|
376
|
+
ref: forwardedRef,
|
|
377
|
+
"data-slot": "sidebar-inset",
|
|
378
|
+
className: cn("relative flex min-h-svh min-w-0 flex-1 flex-col bg-background", "md:peer-data-[variant=inset]:m-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-2xl md:peer-data-[variant=inset]:shadow-sm", className)
|
|
379
|
+
});
|
|
380
|
+
});
|
|
381
|
+
const AnimatedSidebarHeader = forwardRef(function AnimatedSidebarHeader({ className, ...props }, forwardedRef) {
|
|
382
|
+
return /* @__PURE__ */ jsx("div", {
|
|
383
|
+
...props,
|
|
384
|
+
ref: forwardedRef,
|
|
385
|
+
"data-slot": "sidebar-header",
|
|
386
|
+
className: cn("flex shrink-0 flex-col gap-2 p-3", className)
|
|
387
|
+
});
|
|
388
|
+
});
|
|
389
|
+
const AnimatedSidebarContent = forwardRef(function AnimatedSidebarContent({ className, ...props }, forwardedRef) {
|
|
390
|
+
return /* @__PURE__ */ jsx("div", {
|
|
391
|
+
...props,
|
|
392
|
+
ref: forwardedRef,
|
|
393
|
+
"data-slot": "sidebar-content",
|
|
394
|
+
className: cn("flex min-h-0 flex-1 flex-col gap-2 overflow-y-auto overflow-x-hidden overscroll-contain px-2 py-2", className)
|
|
395
|
+
});
|
|
396
|
+
});
|
|
397
|
+
const AnimatedSidebarFooter = forwardRef(function AnimatedSidebarFooter({ className, ...props }, forwardedRef) {
|
|
398
|
+
return /* @__PURE__ */ jsx("div", {
|
|
399
|
+
...props,
|
|
400
|
+
ref: forwardedRef,
|
|
401
|
+
"data-slot": "sidebar-footer",
|
|
402
|
+
className: cn("flex shrink-0 flex-col gap-2 border-border border-t p-3 pb-[max(0.75rem,env(safe-area-inset-bottom))]", className)
|
|
403
|
+
});
|
|
404
|
+
});
|
|
405
|
+
const AnimatedSidebarGroup = forwardRef(function AnimatedSidebarGroup({ className, ...props }, forwardedRef) {
|
|
406
|
+
return /* @__PURE__ */ jsx("div", {
|
|
407
|
+
...props,
|
|
408
|
+
ref: forwardedRef,
|
|
409
|
+
"data-slot": "sidebar-group",
|
|
410
|
+
className: cn("flex w-full min-w-0 flex-col px-1 py-1.5", className)
|
|
411
|
+
});
|
|
412
|
+
});
|
|
413
|
+
const AnimatedSidebarGroupLabel = forwardRef(function AnimatedSidebarGroupLabel({ children, className, ...props }, forwardedRef) {
|
|
414
|
+
const { collapsed } = useAnimatedSidebarPanel();
|
|
415
|
+
return /* @__PURE__ */ jsx("div", {
|
|
416
|
+
...props,
|
|
417
|
+
ref: forwardedRef,
|
|
418
|
+
"aria-hidden": collapsed,
|
|
419
|
+
"data-slot": "sidebar-group-label",
|
|
420
|
+
className: cn("mb-1 h-7 overflow-hidden px-2 font-medium text-[10px] text-muted-foreground uppercase tracking-[0.14em] transition-opacity", collapsed ? "opacity-0" : "opacity-100", className),
|
|
421
|
+
children
|
|
422
|
+
});
|
|
423
|
+
});
|
|
424
|
+
const AnimatedSidebarGroupContent = forwardRef(function AnimatedSidebarGroupContent({ className, ...props }, forwardedRef) {
|
|
425
|
+
return /* @__PURE__ */ jsx("div", {
|
|
426
|
+
...props,
|
|
427
|
+
ref: forwardedRef,
|
|
428
|
+
"data-slot": "sidebar-group-content",
|
|
429
|
+
className: cn("w-full min-w-0", className)
|
|
430
|
+
});
|
|
431
|
+
});
|
|
432
|
+
const AnimatedSidebarMenu = forwardRef(function AnimatedSidebarMenu({ children, className, ...props }, forwardedRef) {
|
|
433
|
+
return /* @__PURE__ */ jsx(SharedLayoutBg, {
|
|
434
|
+
...props,
|
|
435
|
+
ref: forwardedRef,
|
|
436
|
+
as: "ul",
|
|
437
|
+
inset: 0,
|
|
438
|
+
pillClassName: "rounded-xl bg-muted/70",
|
|
439
|
+
pillContainerClassName: "inset-y-auto top-0 h-9",
|
|
440
|
+
"data-slot": "sidebar-menu",
|
|
441
|
+
className: cn("flex w-full min-w-0 list-none flex-col gap-0.5", className),
|
|
442
|
+
children
|
|
443
|
+
});
|
|
444
|
+
});
|
|
445
|
+
const AnimatedSidebarMenuItem = forwardRef(function AnimatedSidebarMenuItem({ className, ...props }, forwardedRef) {
|
|
446
|
+
return /* @__PURE__ */ jsx(motion.li, {
|
|
447
|
+
...props,
|
|
448
|
+
ref: forwardedRef,
|
|
449
|
+
layout: "position",
|
|
450
|
+
transition: SPRING_LAYOUT,
|
|
451
|
+
"data-slot": "sidebar-menu-item",
|
|
452
|
+
className: cn("relative", className)
|
|
453
|
+
});
|
|
454
|
+
});
|
|
455
|
+
const AnimatedSidebarMenuSub = forwardRef(function AnimatedSidebarMenuSub({ open, children, className, ...props }, forwardedRef) {
|
|
456
|
+
const context = useAnimatedSidebar();
|
|
457
|
+
const panel = useAnimatedSidebarPanel();
|
|
458
|
+
return /* @__PURE__ */ jsx(AnimatePresence, {
|
|
459
|
+
initial: false,
|
|
460
|
+
mode: "popLayout",
|
|
461
|
+
children: open && !panel.collapsed ? /* @__PURE__ */ createElement(motion.ul, {
|
|
462
|
+
...props,
|
|
463
|
+
ref: forwardedRef,
|
|
464
|
+
key: "sidebar-submenu",
|
|
465
|
+
variants: context.reduce ? void 0 : SUBMENU_VARIANTS,
|
|
466
|
+
initial: context.reduce ? false : "closed",
|
|
467
|
+
animate: context.reduce ? { opacity: 1 } : "open",
|
|
468
|
+
exit: context.reduce ? { opacity: 0 } : "closed",
|
|
469
|
+
transition: context.reduce ? { duration: .12 } : void 0,
|
|
470
|
+
"data-slot": "sidebar-menu-sub",
|
|
471
|
+
className: cn("relative mt-1 ml-5 flex min-w-0 flex-col gap-0.5 border-border border-l pl-3", className)
|
|
472
|
+
}, children) : null
|
|
473
|
+
});
|
|
474
|
+
});
|
|
475
|
+
const AnimatedSidebarMenuSubItem = forwardRef(function AnimatedSidebarMenuSubItem({ className, ...props }, forwardedRef) {
|
|
476
|
+
return /* @__PURE__ */ jsx(motion.li, {
|
|
477
|
+
...props,
|
|
478
|
+
ref: forwardedRef,
|
|
479
|
+
variants: SUBMENU_ITEM_VARIANTS,
|
|
480
|
+
"data-slot": "sidebar-menu-sub-item",
|
|
481
|
+
className: cn("relative min-w-0", className)
|
|
482
|
+
});
|
|
483
|
+
});
|
|
484
|
+
function AnimatedSidebarMenuSubButton({ children, icon, href, isActive = false, disabled = false, closeOnSelect = true, target, rel, onSelect, className }) {
|
|
485
|
+
const context = useAnimatedSidebar();
|
|
486
|
+
const select = (event) => {
|
|
487
|
+
if (disabled) {
|
|
488
|
+
event.preventDefault();
|
|
489
|
+
return;
|
|
490
|
+
}
|
|
491
|
+
onSelect?.();
|
|
492
|
+
if (context.isMobile && closeOnSelect) context.setOpenMobile(false);
|
|
493
|
+
};
|
|
494
|
+
const content = /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("span", {
|
|
495
|
+
"aria-hidden": "true",
|
|
496
|
+
className: "grid size-4 shrink-0 place-items-center",
|
|
497
|
+
children: icon ?? /* @__PURE__ */ jsx("span", { className: "size-1 rounded-full bg-current" })
|
|
498
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
499
|
+
className: "min-w-0 flex-1 truncate",
|
|
500
|
+
children
|
|
501
|
+
})] });
|
|
502
|
+
const interactiveClassName = cn("flex min-h-8 w-full min-w-0 items-center gap-2 rounded-lg px-2 text-left text-xs outline-none", "text-muted-foreground transition-colors hover:bg-muted/60 hover:text-foreground", "focus-visible:bg-muted/70 focus-visible:ring-2 focus-visible:ring-ring", isActive && "bg-muted/70 text-foreground", disabled && "cursor-not-allowed opacity-40", className);
|
|
503
|
+
return href ? /* @__PURE__ */ jsx(motion.a, {
|
|
504
|
+
href,
|
|
505
|
+
target,
|
|
506
|
+
rel: rel ?? (target === "_blank" ? "noreferrer noopener" : void 0),
|
|
507
|
+
"aria-current": isActive ? "page" : void 0,
|
|
508
|
+
"aria-disabled": disabled || void 0,
|
|
509
|
+
tabIndex: disabled ? -1 : void 0,
|
|
510
|
+
onClick: select,
|
|
511
|
+
whileTap: context.reduce || disabled ? void 0 : { scale: .98 },
|
|
512
|
+
transition: SPRING_PRESS,
|
|
513
|
+
className: interactiveClassName,
|
|
514
|
+
children: content
|
|
515
|
+
}) : /* @__PURE__ */ jsx(motion.button, {
|
|
516
|
+
type: "button",
|
|
517
|
+
disabled,
|
|
518
|
+
"aria-current": isActive ? "page" : void 0,
|
|
519
|
+
onClick: select,
|
|
520
|
+
whileTap: context.reduce || disabled ? void 0 : { scale: .98 },
|
|
521
|
+
transition: SPRING_PRESS,
|
|
522
|
+
className: interactiveClassName,
|
|
523
|
+
children: content
|
|
524
|
+
});
|
|
525
|
+
}
|
|
526
|
+
function AnimatedSidebarMenuButton({ children, icon, badge, href, isActive = false, ariaExpanded, disabled = false, closeOnSelect, target, rel, onSelect, className }) {
|
|
527
|
+
const context = useAnimatedSidebar();
|
|
528
|
+
const panel = useAnimatedSidebarPanel();
|
|
529
|
+
const textLabel = typeof children === "string" ? children : void 0;
|
|
530
|
+
const select = (event) => {
|
|
531
|
+
if (disabled) {
|
|
532
|
+
event.preventDefault();
|
|
533
|
+
return;
|
|
534
|
+
}
|
|
535
|
+
onSelect?.();
|
|
536
|
+
const shouldCloseOnSelect = closeOnSelect ?? ariaExpanded === void 0;
|
|
537
|
+
if (context.isMobile && shouldCloseOnSelect) context.setOpenMobile(false);
|
|
538
|
+
};
|
|
539
|
+
const content = /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
540
|
+
isActive ? /* @__PURE__ */ jsx(motion.span, {
|
|
541
|
+
layoutId: context.layoutId,
|
|
542
|
+
transition: context.reduce ? { duration: 0 } : SPRING_LAYOUT,
|
|
543
|
+
className: "absolute inset-0 rounded-xl bg-muted"
|
|
544
|
+
}) : null,
|
|
545
|
+
icon ? /* @__PURE__ */ jsx("span", {
|
|
546
|
+
"aria-hidden": "true",
|
|
547
|
+
className: "relative z-10 grid size-5 shrink-0 place-items-center",
|
|
548
|
+
children: icon
|
|
549
|
+
}) : null,
|
|
550
|
+
/* @__PURE__ */ jsx(motion.span, {
|
|
551
|
+
initial: false,
|
|
552
|
+
animate: {
|
|
553
|
+
opacity: panel.collapsed ? 0 : 1,
|
|
554
|
+
x: panel.collapsed ? -4 : 0
|
|
555
|
+
},
|
|
556
|
+
transition: context.reduce ? REDUCED_TRANSITION : panel.collapsed ? LABEL_EXIT_TRANSITION : LABEL_ENTER_TRANSITION,
|
|
557
|
+
"aria-hidden": panel.collapsed,
|
|
558
|
+
className: cn("relative z-10 min-w-0 flex-1 truncate", panel.collapsed && "pointer-events-none"),
|
|
559
|
+
children
|
|
560
|
+
}),
|
|
561
|
+
badge && !panel.collapsed ? /* @__PURE__ */ jsx("span", {
|
|
562
|
+
className: "relative z-10 shrink-0 text-muted-foreground text-xs",
|
|
563
|
+
children: badge
|
|
564
|
+
}) : null,
|
|
565
|
+
ariaExpanded !== void 0 ? /* @__PURE__ */ jsx(motion.span, {
|
|
566
|
+
"aria-hidden": "true",
|
|
567
|
+
initial: false,
|
|
568
|
+
animate: {
|
|
569
|
+
opacity: panel.collapsed ? 0 : 1,
|
|
570
|
+
rotate: ariaExpanded ? 90 : 0,
|
|
571
|
+
x: panel.collapsed ? 4 : 0
|
|
572
|
+
},
|
|
573
|
+
transition: context.reduce ? { duration: 0 } : SPRING_LAYOUT,
|
|
574
|
+
className: "relative z-10 grid size-4 shrink-0 place-items-center text-muted-foreground",
|
|
575
|
+
children: /* @__PURE__ */ jsx(ChevronRight, { className: "size-3.5" })
|
|
576
|
+
}) : null
|
|
577
|
+
] });
|
|
578
|
+
const interactiveClassName = cn("relative flex min-h-9 w-full min-w-0 items-center gap-2.5 overflow-hidden rounded-xl px-3 text-left font-medium text-sm outline-none", "text-muted-foreground transition-colors hover:text-foreground", "focus-visible:bg-muted/70 focus-visible:ring-2 focus-visible:ring-ring", isActive && "text-foreground", disabled && "cursor-not-allowed opacity-40", className);
|
|
579
|
+
return href ? /* @__PURE__ */ jsx(motion.a, {
|
|
580
|
+
href,
|
|
581
|
+
target,
|
|
582
|
+
rel: rel ?? (target === "_blank" ? "noreferrer noopener" : void 0),
|
|
583
|
+
"aria-current": isActive ? "page" : void 0,
|
|
584
|
+
"aria-expanded": ariaExpanded,
|
|
585
|
+
"aria-disabled": disabled || void 0,
|
|
586
|
+
"aria-label": panel.collapsed ? textLabel : void 0,
|
|
587
|
+
title: panel.collapsed ? textLabel : void 0,
|
|
588
|
+
tabIndex: disabled ? -1 : void 0,
|
|
589
|
+
onClick: select,
|
|
590
|
+
whileTap: context.reduce || disabled ? void 0 : { scale: .98 },
|
|
591
|
+
transition: SPRING_PRESS,
|
|
592
|
+
className: interactiveClassName,
|
|
593
|
+
children: content
|
|
594
|
+
}) : /* @__PURE__ */ jsx(motion.button, {
|
|
595
|
+
type: "button",
|
|
596
|
+
disabled,
|
|
597
|
+
"aria-current": isActive ? "page" : void 0,
|
|
598
|
+
"aria-expanded": ariaExpanded,
|
|
599
|
+
"aria-label": panel.collapsed ? textLabel : void 0,
|
|
600
|
+
title: panel.collapsed ? textLabel : void 0,
|
|
601
|
+
onClick: select,
|
|
602
|
+
whileTap: context.reduce || disabled ? void 0 : { scale: .98 },
|
|
603
|
+
transition: SPRING_PRESS,
|
|
604
|
+
className: interactiveClassName,
|
|
605
|
+
children: content
|
|
606
|
+
});
|
|
607
|
+
}
|
|
608
|
+
//#endregion
|
|
609
|
+
export { AnimatedSidebar, AnimatedSidebarClose, AnimatedSidebarContent, AnimatedSidebarFooter, AnimatedSidebarGroup, AnimatedSidebarGroupContent, AnimatedSidebarGroupLabel, AnimatedSidebarHeader, AnimatedSidebarInset, AnimatedSidebarMenu, AnimatedSidebarMenuButton, AnimatedSidebarMenuItem, AnimatedSidebarMenuSub, AnimatedSidebarMenuSubButton, AnimatedSidebarMenuSubItem, AnimatedSidebarProvider, AnimatedSidebarRail, AnimatedSidebarTrigger, useAnimatedSidebar };
|
|
610
|
+
|
|
611
|
+
//# sourceMappingURL=animated-sidebar.js.map
|