@arolariu/components 0.0.39 → 0.1.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/CONTRIBUTING.md +371 -371
- package/DEBUGGING.md +3 -8
- package/EXAMPLES.md +1035 -1035
- package/README.md +1 -1
- package/{CHANGELOG.md → changelog.md} +15 -0
- package/dist/components/ui/accordion.d.ts.map +1 -0
- package/dist/components/ui/alert-dialog.d.ts.map +1 -0
- package/dist/components/ui/alert.d.ts.map +1 -0
- package/dist/components/ui/aspect-ratio.d.ts.map +1 -0
- package/dist/components/ui/avatar.d.ts.map +1 -0
- package/dist/components/ui/background-beams.d.ts.map +1 -0
- package/dist/components/ui/badge.d.ts.map +1 -0
- package/dist/components/ui/breadcrumb.d.ts.map +1 -0
- package/dist/components/ui/bubble-background.d.ts.map +1 -0
- package/dist/{esm/components → components}/ui/bubble-background.js +1 -2
- package/dist/components/ui/bubble-background.js.map +1 -0
- package/dist/components/ui/button.d.ts.map +1 -0
- package/dist/components/ui/calendar.d.ts.map +1 -0
- package/dist/{esm/components → components}/ui/calendar.js +1 -1
- package/dist/components/ui/calendar.js.map +1 -0
- package/dist/components/ui/card.d.ts.map +1 -0
- package/dist/components/ui/carousel.d.ts.map +1 -0
- package/dist/components/ui/chart.d.ts +41 -0
- package/dist/components/ui/chart.d.ts.map +1 -0
- package/dist/{esm/components → components}/ui/chart.js +10 -10
- package/dist/components/ui/chart.js.map +1 -0
- package/dist/components/ui/checkbox.d.ts.map +1 -0
- package/dist/components/ui/collapsible.d.ts.map +1 -0
- package/dist/components/ui/command.d.ts.map +1 -0
- package/dist/components/ui/context-menu.d.ts.map +1 -0
- package/dist/components/ui/counting-number.d.ts.map +1 -0
- package/dist/components/ui/dialog.d.ts.map +1 -0
- package/dist/components/ui/dot-background.d.ts.map +1 -0
- package/dist/components/ui/drawer.d.ts.map +1 -0
- package/dist/components/ui/dropdown-menu.d.ts.map +1 -0
- package/dist/components/ui/dropdrawer.d.ts.map +1 -0
- package/dist/components/ui/dropdrawer.js.map +1 -0
- package/dist/components/ui/fireworks-background.d.ts.map +1 -0
- package/dist/components/ui/flip-button.d.ts.map +1 -0
- package/dist/components/ui/form.d.ts.map +1 -0
- package/dist/components/ui/gradient-background.d.ts.map +1 -0
- package/dist/components/ui/gradient-text.d.ts.map +1 -0
- package/dist/components/ui/highlight-text.d.ts.map +1 -0
- package/dist/components/ui/hole-background.d.ts.map +1 -0
- package/dist/components/ui/hover-card.d.ts.map +1 -0
- package/dist/components/ui/input-otp.d.ts.map +1 -0
- package/dist/components/ui/input.d.ts.map +1 -0
- package/dist/components/ui/label.d.ts.map +1 -0
- package/dist/components/ui/menubar.d.ts.map +1 -0
- package/dist/components/ui/navigation-menu.d.ts.map +1 -0
- package/dist/components/ui/pagination.d.ts.map +1 -0
- package/dist/components/ui/popover.d.ts.map +1 -0
- package/dist/components/ui/progress.d.ts.map +1 -0
- package/dist/components/ui/radio-group.d.ts.map +1 -0
- package/dist/components/ui/resizable.d.ts.map +1 -0
- package/dist/components/ui/ripple-button.d.ts.map +1 -0
- package/dist/components/ui/scratcher.d.ts.map +1 -0
- package/dist/components/ui/scroll-area.d.ts.map +1 -0
- package/dist/components/ui/select.d.ts.map +1 -0
- package/dist/components/ui/separator.d.ts.map +1 -0
- package/dist/components/ui/sheet.d.ts.map +1 -0
- package/dist/components/ui/sidebar.d.ts.map +1 -0
- package/dist/components/ui/skeleton.d.ts.map +1 -0
- package/dist/components/ui/slider.d.ts.map +1 -0
- package/dist/components/ui/sonner.d.ts.map +1 -0
- package/dist/components/ui/switch.d.ts.map +1 -0
- package/dist/components/ui/table.d.ts.map +1 -0
- package/dist/components/ui/tabs.d.ts.map +1 -0
- package/dist/components/ui/textarea.d.ts.map +1 -0
- package/dist/components/ui/toggle-group.d.ts.map +1 -0
- package/dist/components/ui/toggle.d.ts.map +1 -0
- package/dist/components/ui/tooltip.d.ts.map +1 -0
- package/dist/hooks/use-mobile.d.ts.map +1 -0
- package/dist/index.css +26 -2
- package/dist/index.css.map +1 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +61 -61
- package/dist/lib/utils.d.ts.map +1 -0
- package/package.json +261 -332
- package/src/components/ui/bubble-background.tsx +189 -187
- package/src/components/ui/calendar.tsx +4 -1
- package/src/components/ui/chart.tsx +31 -58
- package/src/components/ui/dropdrawer.tsx +973 -973
- package/src/index.css +67 -69
- package/dist/cjs/components/ui/accordion.cjs +0 -92
- package/dist/cjs/components/ui/accordion.cjs.map +0 -1
- package/dist/cjs/components/ui/alert-dialog.cjs +0 -152
- package/dist/cjs/components/ui/alert-dialog.cjs.map +0 -1
- package/dist/cjs/components/ui/alert.cjs +0 -83
- package/dist/cjs/components/ui/alert.cjs.map +0 -1
- package/dist/cjs/components/ui/aspect-ratio.cjs +0 -47
- package/dist/cjs/components/ui/aspect-ratio.cjs.map +0 -1
- package/dist/cjs/components/ui/avatar.cjs +0 -69
- package/dist/cjs/components/ui/avatar.cjs.map +0 -1
- package/dist/cjs/components/ui/background-beams.cjs +0 -200
- package/dist/cjs/components/ui/background-beams.cjs.map +0 -1
- package/dist/cjs/components/ui/badge.cjs +0 -69
- package/dist/cjs/components/ui/badge.cjs.map +0 -1
- package/dist/cjs/components/ui/breadcrumb.cjs +0 -128
- package/dist/cjs/components/ui/breadcrumb.cjs.map +0 -1
- package/dist/cjs/components/ui/bubble-background.cjs +0 -214
- package/dist/cjs/components/ui/bubble-background.cjs.map +0 -1
- package/dist/cjs/components/ui/button.cjs +0 -80
- package/dist/cjs/components/ui/button.cjs.map +0 -1
- package/dist/cjs/components/ui/calendar.cjs +0 -146
- package/dist/cjs/components/ui/calendar.cjs.map +0 -1
- package/dist/cjs/components/ui/card.cjs +0 -108
- package/dist/cjs/components/ui/card.cjs.map +0 -1
- package/dist/cjs/components/ui/carousel.cjs +0 -207
- package/dist/cjs/components/ui/carousel.cjs.map +0 -1
- package/dist/cjs/components/ui/chart.cjs +0 -221
- package/dist/cjs/components/ui/chart.cjs.map +0 -1
- package/dist/cjs/components/ui/checkbox.cjs +0 -57
- package/dist/cjs/components/ui/checkbox.cjs.map +0 -1
- package/dist/cjs/components/ui/collapsible.cjs +0 -65
- package/dist/cjs/components/ui/collapsible.cjs.map +0 -1
- package/dist/cjs/components/ui/command.cjs +0 -159
- package/dist/cjs/components/ui/command.cjs.map +0 -1
- package/dist/cjs/components/ui/context-menu.cjs +0 -219
- package/dist/cjs/components/ui/context-menu.cjs.map +0 -1
- package/dist/cjs/components/ui/counting-number.cjs +0 -95
- package/dist/cjs/components/ui/counting-number.cjs.map +0 -1
- package/dist/cjs/components/ui/dialog.cjs +0 -156
- package/dist/cjs/components/ui/dialog.cjs.map +0 -1
- package/dist/cjs/components/ui/dot-background.cjs +0 -131
- package/dist/cjs/components/ui/dot-background.cjs.map +0 -1
- package/dist/cjs/components/ui/drawer.cjs +0 -147
- package/dist/cjs/components/ui/drawer.cjs.map +0 -1
- package/dist/cjs/components/ui/dropdown-menu.cjs +0 -220
- package/dist/cjs/components/ui/dropdown-menu.cjs.map +0 -1
- package/dist/cjs/components/ui/dropdrawer.cjs +0 -627
- package/dist/cjs/components/ui/dropdrawer.cjs.map +0 -1
- package/dist/cjs/components/ui/fireworks-background.cjs +0 -259
- package/dist/cjs/components/ui/fireworks-background.cjs.map +0 -1
- package/dist/cjs/components/ui/flip-button.cjs +0 -100
- package/dist/cjs/components/ui/flip-button.cjs.map +0 -1
- package/dist/cjs/components/ui/form.cjs +0 -149
- package/dist/cjs/components/ui/form.cjs.map +0 -1
- package/dist/cjs/components/ui/gradient-background.cjs +0 -60
- package/dist/cjs/components/ui/gradient-background.cjs.map +0 -1
- package/dist/cjs/components/ui/gradient-text.cjs +0 -83
- package/dist/cjs/components/ui/gradient-text.cjs.map +0 -1
- package/dist/cjs/components/ui/highlight-text.cjs +0 -74
- package/dist/cjs/components/ui/highlight-text.cjs.map +0 -1
- package/dist/cjs/components/ui/hole-background.cjs +0 -361
- package/dist/cjs/components/ui/hole-background.cjs.map +0 -1
- package/dist/cjs/components/ui/hover-card.cjs +0 -72
- package/dist/cjs/components/ui/hover-card.cjs.map +0 -1
- package/dist/cjs/components/ui/input-otp.cjs +0 -94
- package/dist/cjs/components/ui/input-otp.cjs.map +0 -1
- package/dist/cjs/components/ui/input.cjs +0 -49
- package/dist/cjs/components/ui/input.cjs.map +0 -1
- package/dist/cjs/components/ui/label.cjs +0 -49
- package/dist/cjs/components/ui/label.cjs.map +0 -1
- package/dist/cjs/components/ui/menubar.cjs +0 -233
- package/dist/cjs/components/ui/menubar.cjs.map +0 -1
- package/dist/cjs/components/ui/navigation-menu.cjs +0 -144
- package/dist/cjs/components/ui/navigation-menu.cjs.map +0 -1
- package/dist/cjs/components/ui/pagination.cjs +0 -142
- package/dist/cjs/components/ui/pagination.cjs.map +0 -1
- package/dist/cjs/components/ui/popover.cjs +0 -80
- package/dist/cjs/components/ui/popover.cjs.map +0 -1
- package/dist/cjs/components/ui/progress.cjs +0 -56
- package/dist/cjs/components/ui/progress.cjs.map +0 -1
- package/dist/cjs/components/ui/radio-group.cjs +0 -67
- package/dist/cjs/components/ui/radio-group.cjs.map +0 -1
- package/dist/cjs/components/ui/resizable.cjs +0 -75
- package/dist/cjs/components/ui/resizable.cjs.map +0 -1
- package/dist/cjs/components/ui/ripple-button.cjs +0 -108
- package/dist/cjs/components/ui/ripple-button.cjs.map +0 -1
- package/dist/cjs/components/ui/scratcher.cjs +0 -179
- package/dist/cjs/components/ui/scratcher.cjs.map +0 -1
- package/dist/cjs/components/ui/scroll-area.cjs +0 -73
- package/dist/cjs/components/ui/scroll-area.cjs.map +0 -1
- package/dist/cjs/components/ui/select.cjs +0 -177
- package/dist/cjs/components/ui/select.cjs.map +0 -1
- package/dist/cjs/components/ui/separator.cjs +0 -51
- package/dist/cjs/components/ui/separator.cjs.map +0 -1
- package/dist/cjs/components/ui/sheet.cjs +0 -150
- package/dist/cjs/components/ui/sheet.cjs.map +0 -1
- package/dist/cjs/components/ui/sidebar.cjs +0 -513
- package/dist/cjs/components/ui/sidebar.cjs.map +0 -1
- package/dist/cjs/components/ui/skeleton.cjs +0 -48
- package/dist/cjs/components/ui/skeleton.cjs.map +0 -1
- package/dist/cjs/components/ui/slider.cjs +0 -78
- package/dist/cjs/components/ui/slider.cjs.map +0 -1
- package/dist/cjs/components/ui/sonner.cjs +0 -58
- package/dist/cjs/components/ui/sonner.cjs.map +0 -1
- package/dist/cjs/components/ui/switch.cjs +0 -53
- package/dist/cjs/components/ui/switch.cjs.map +0 -1
- package/dist/cjs/components/ui/table.cjs +0 -122
- package/dist/cjs/components/ui/table.cjs.map +0 -1
- package/dist/cjs/components/ui/tabs.cjs +0 -79
- package/dist/cjs/components/ui/tabs.cjs.map +0 -1
- package/dist/cjs/components/ui/textarea.cjs +0 -48
- package/dist/cjs/components/ui/textarea.cjs.map +0 -1
- package/dist/cjs/components/ui/toggle-group.cjs +0 -80
- package/dist/cjs/components/ui/toggle-group.cjs.map +0 -1
- package/dist/cjs/components/ui/toggle.cjs +0 -74
- package/dist/cjs/components/ui/toggle.cjs.map +0 -1
- package/dist/cjs/components/ui/tooltip.cjs +0 -88
- package/dist/cjs/components/ui/tooltip.cjs.map +0 -1
- package/dist/cjs/hooks/use-mobile.cjs +0 -52
- package/dist/cjs/hooks/use-mobile.cjs.map +0 -1
- package/dist/cjs/index.cjs +0 -905
- package/dist/cjs/index.cjs.map +0 -1
- package/dist/cjs/index.css +0 -7309
- package/dist/cjs/index.css.map +0 -1
- package/dist/cjs/lib/utils.cjs +0 -42
- package/dist/cjs/lib/utils.cjs.map +0 -1
- package/dist/esm/components/ui/bubble-background.js.map +0 -1
- package/dist/esm/components/ui/calendar.js.map +0 -1
- package/dist/esm/components/ui/chart.js.map +0 -1
- package/dist/esm/components/ui/dropdrawer.js.map +0 -1
- package/dist/esm/index.css +0 -7309
- package/dist/esm/index.css.map +0 -1
- package/dist/esm/index.js +0 -62
- package/dist/types/components/ui/accordion.d.ts.map +0 -1
- package/dist/types/components/ui/alert-dialog.d.ts.map +0 -1
- package/dist/types/components/ui/alert.d.ts.map +0 -1
- package/dist/types/components/ui/aspect-ratio.d.ts.map +0 -1
- package/dist/types/components/ui/avatar.d.ts.map +0 -1
- package/dist/types/components/ui/background-beams.d.ts.map +0 -1
- package/dist/types/components/ui/badge.d.ts.map +0 -1
- package/dist/types/components/ui/breadcrumb.d.ts.map +0 -1
- package/dist/types/components/ui/bubble-background.d.ts.map +0 -1
- package/dist/types/components/ui/button.d.ts.map +0 -1
- package/dist/types/components/ui/calendar.d.ts.map +0 -1
- package/dist/types/components/ui/card.d.ts.map +0 -1
- package/dist/types/components/ui/carousel.d.ts.map +0 -1
- package/dist/types/components/ui/chart.d.ts +0 -55
- package/dist/types/components/ui/chart.d.ts.map +0 -1
- package/dist/types/components/ui/checkbox.d.ts.map +0 -1
- package/dist/types/components/ui/collapsible.d.ts.map +0 -1
- package/dist/types/components/ui/command.d.ts.map +0 -1
- package/dist/types/components/ui/context-menu.d.ts.map +0 -1
- package/dist/types/components/ui/counting-number.d.ts.map +0 -1
- package/dist/types/components/ui/dialog.d.ts.map +0 -1
- package/dist/types/components/ui/dot-background.d.ts.map +0 -1
- package/dist/types/components/ui/drawer.d.ts.map +0 -1
- package/dist/types/components/ui/dropdown-menu.d.ts.map +0 -1
- package/dist/types/components/ui/dropdrawer.d.ts.map +0 -1
- package/dist/types/components/ui/fireworks-background.d.ts.map +0 -1
- package/dist/types/components/ui/flip-button.d.ts.map +0 -1
- package/dist/types/components/ui/form.d.ts.map +0 -1
- package/dist/types/components/ui/gradient-background.d.ts.map +0 -1
- package/dist/types/components/ui/gradient-text.d.ts.map +0 -1
- package/dist/types/components/ui/highlight-text.d.ts.map +0 -1
- package/dist/types/components/ui/hole-background.d.ts.map +0 -1
- package/dist/types/components/ui/hover-card.d.ts.map +0 -1
- package/dist/types/components/ui/input-otp.d.ts.map +0 -1
- package/dist/types/components/ui/input.d.ts.map +0 -1
- package/dist/types/components/ui/label.d.ts.map +0 -1
- package/dist/types/components/ui/menubar.d.ts.map +0 -1
- package/dist/types/components/ui/navigation-menu.d.ts.map +0 -1
- package/dist/types/components/ui/pagination.d.ts.map +0 -1
- package/dist/types/components/ui/popover.d.ts.map +0 -1
- package/dist/types/components/ui/progress.d.ts.map +0 -1
- package/dist/types/components/ui/radio-group.d.ts.map +0 -1
- package/dist/types/components/ui/resizable.d.ts.map +0 -1
- package/dist/types/components/ui/ripple-button.d.ts.map +0 -1
- package/dist/types/components/ui/scratcher.d.ts.map +0 -1
- package/dist/types/components/ui/scroll-area.d.ts.map +0 -1
- package/dist/types/components/ui/select.d.ts.map +0 -1
- package/dist/types/components/ui/separator.d.ts.map +0 -1
- package/dist/types/components/ui/sheet.d.ts.map +0 -1
- package/dist/types/components/ui/sidebar.d.ts.map +0 -1
- package/dist/types/components/ui/skeleton.d.ts.map +0 -1
- package/dist/types/components/ui/slider.d.ts.map +0 -1
- package/dist/types/components/ui/sonner.d.ts.map +0 -1
- package/dist/types/components/ui/switch.d.ts.map +0 -1
- package/dist/types/components/ui/table.d.ts.map +0 -1
- package/dist/types/components/ui/tabs.d.ts.map +0 -1
- package/dist/types/components/ui/textarea.d.ts.map +0 -1
- package/dist/types/components/ui/toggle-group.d.ts.map +0 -1
- package/dist/types/components/ui/toggle.d.ts.map +0 -1
- package/dist/types/components/ui/tooltip.d.ts.map +0 -1
- package/dist/types/hooks/use-mobile.d.ts.map +0 -1
- package/dist/types/index.d.ts.map +0 -1
- package/dist/types/lib/utils.d.ts.map +0 -1
- package/tailwind.config.mjs +0 -65
- package/tsconfig.json +0 -58
- /package/{LICENSE → LICENSE.md} +0 -0
- /package/dist/{types/components → components}/ui/accordion.d.ts +0 -0
- /package/dist/{esm/components → components}/ui/accordion.js +0 -0
- /package/dist/{esm/components → components}/ui/accordion.js.map +0 -0
- /package/dist/{types/components → components}/ui/alert-dialog.d.ts +0 -0
- /package/dist/{esm/components → components}/ui/alert-dialog.js +0 -0
- /package/dist/{esm/components → components}/ui/alert-dialog.js.map +0 -0
- /package/dist/{types/components → components}/ui/alert.d.ts +0 -0
- /package/dist/{esm/components → components}/ui/alert.js +0 -0
- /package/dist/{esm/components → components}/ui/alert.js.map +0 -0
- /package/dist/{types/components → components}/ui/aspect-ratio.d.ts +0 -0
- /package/dist/{esm/components → components}/ui/aspect-ratio.js +0 -0
- /package/dist/{esm/components → components}/ui/aspect-ratio.js.map +0 -0
- /package/dist/{types/components → components}/ui/avatar.d.ts +0 -0
- /package/dist/{esm/components → components}/ui/avatar.js +0 -0
- /package/dist/{esm/components → components}/ui/avatar.js.map +0 -0
- /package/dist/{types/components → components}/ui/background-beams.d.ts +0 -0
- /package/dist/{esm/components → components}/ui/background-beams.js +0 -0
- /package/dist/{esm/components → components}/ui/background-beams.js.map +0 -0
- /package/dist/{types/components → components}/ui/badge.d.ts +0 -0
- /package/dist/{esm/components → components}/ui/badge.js +0 -0
- /package/dist/{esm/components → components}/ui/badge.js.map +0 -0
- /package/dist/{types/components → components}/ui/breadcrumb.d.ts +0 -0
- /package/dist/{esm/components → components}/ui/breadcrumb.js +0 -0
- /package/dist/{esm/components → components}/ui/breadcrumb.js.map +0 -0
- /package/dist/{types/components → components}/ui/bubble-background.d.ts +0 -0
- /package/dist/{types/components → components}/ui/button.d.ts +0 -0
- /package/dist/{esm/components → components}/ui/button.js +0 -0
- /package/dist/{esm/components → components}/ui/button.js.map +0 -0
- /package/dist/{types/components → components}/ui/calendar.d.ts +0 -0
- /package/dist/{types/components → components}/ui/card.d.ts +0 -0
- /package/dist/{esm/components → components}/ui/card.js +0 -0
- /package/dist/{esm/components → components}/ui/card.js.map +0 -0
- /package/dist/{types/components → components}/ui/carousel.d.ts +0 -0
- /package/dist/{esm/components → components}/ui/carousel.js +0 -0
- /package/dist/{esm/components → components}/ui/carousel.js.map +0 -0
- /package/dist/{types/components → components}/ui/checkbox.d.ts +0 -0
- /package/dist/{esm/components → components}/ui/checkbox.js +0 -0
- /package/dist/{esm/components → components}/ui/checkbox.js.map +0 -0
- /package/dist/{types/components → components}/ui/collapsible.d.ts +0 -0
- /package/dist/{esm/components → components}/ui/collapsible.js +0 -0
- /package/dist/{esm/components → components}/ui/collapsible.js.map +0 -0
- /package/dist/{types/components → components}/ui/command.d.ts +0 -0
- /package/dist/{esm/components → components}/ui/command.js +0 -0
- /package/dist/{esm/components → components}/ui/command.js.map +0 -0
- /package/dist/{types/components → components}/ui/context-menu.d.ts +0 -0
- /package/dist/{esm/components → components}/ui/context-menu.js +0 -0
- /package/dist/{esm/components → components}/ui/context-menu.js.map +0 -0
- /package/dist/{types/components → components}/ui/counting-number.d.ts +0 -0
- /package/dist/{esm/components → components}/ui/counting-number.js +0 -0
- /package/dist/{esm/components → components}/ui/counting-number.js.map +0 -0
- /package/dist/{types/components → components}/ui/dialog.d.ts +0 -0
- /package/dist/{esm/components → components}/ui/dialog.js +0 -0
- /package/dist/{esm/components → components}/ui/dialog.js.map +0 -0
- /package/dist/{types/components → components}/ui/dot-background.d.ts +0 -0
- /package/dist/{esm/components → components}/ui/dot-background.js +0 -0
- /package/dist/{esm/components → components}/ui/dot-background.js.map +0 -0
- /package/dist/{types/components → components}/ui/drawer.d.ts +0 -0
- /package/dist/{esm/components → components}/ui/drawer.js +0 -0
- /package/dist/{esm/components → components}/ui/drawer.js.map +0 -0
- /package/dist/{types/components → components}/ui/dropdown-menu.d.ts +0 -0
- /package/dist/{esm/components → components}/ui/dropdown-menu.js +0 -0
- /package/dist/{esm/components → components}/ui/dropdown-menu.js.map +0 -0
- /package/dist/{types/components → components}/ui/dropdrawer.d.ts +0 -0
- /package/dist/{esm/components → components}/ui/dropdrawer.js +0 -0
- /package/dist/{types/components → components}/ui/fireworks-background.d.ts +0 -0
- /package/dist/{esm/components → components}/ui/fireworks-background.js +0 -0
- /package/dist/{esm/components → components}/ui/fireworks-background.js.map +0 -0
- /package/dist/{types/components → components}/ui/flip-button.d.ts +0 -0
- /package/dist/{esm/components → components}/ui/flip-button.js +0 -0
- /package/dist/{esm/components → components}/ui/flip-button.js.map +0 -0
- /package/dist/{types/components → components}/ui/form.d.ts +0 -0
- /package/dist/{esm/components → components}/ui/form.js +0 -0
- /package/dist/{esm/components → components}/ui/form.js.map +0 -0
- /package/dist/{types/components → components}/ui/gradient-background.d.ts +0 -0
- /package/dist/{esm/components → components}/ui/gradient-background.js +0 -0
- /package/dist/{esm/components → components}/ui/gradient-background.js.map +0 -0
- /package/dist/{types/components → components}/ui/gradient-text.d.ts +0 -0
- /package/dist/{esm/components → components}/ui/gradient-text.js +0 -0
- /package/dist/{esm/components → components}/ui/gradient-text.js.map +0 -0
- /package/dist/{types/components → components}/ui/highlight-text.d.ts +0 -0
- /package/dist/{esm/components → components}/ui/highlight-text.js +0 -0
- /package/dist/{esm/components → components}/ui/highlight-text.js.map +0 -0
- /package/dist/{types/components → components}/ui/hole-background.d.ts +0 -0
- /package/dist/{esm/components → components}/ui/hole-background.js +0 -0
- /package/dist/{esm/components → components}/ui/hole-background.js.map +0 -0
- /package/dist/{types/components → components}/ui/hover-card.d.ts +0 -0
- /package/dist/{esm/components → components}/ui/hover-card.js +0 -0
- /package/dist/{esm/components → components}/ui/hover-card.js.map +0 -0
- /package/dist/{types/components → components}/ui/input-otp.d.ts +0 -0
- /package/dist/{esm/components → components}/ui/input-otp.js +0 -0
- /package/dist/{esm/components → components}/ui/input-otp.js.map +0 -0
- /package/dist/{types/components → components}/ui/input.d.ts +0 -0
- /package/dist/{esm/components → components}/ui/input.js +0 -0
- /package/dist/{esm/components → components}/ui/input.js.map +0 -0
- /package/dist/{types/components → components}/ui/label.d.ts +0 -0
- /package/dist/{esm/components → components}/ui/label.js +0 -0
- /package/dist/{esm/components → components}/ui/label.js.map +0 -0
- /package/dist/{types/components → components}/ui/menubar.d.ts +0 -0
- /package/dist/{esm/components → components}/ui/menubar.js +0 -0
- /package/dist/{esm/components → components}/ui/menubar.js.map +0 -0
- /package/dist/{types/components → components}/ui/navigation-menu.d.ts +0 -0
- /package/dist/{esm/components → components}/ui/navigation-menu.js +0 -0
- /package/dist/{esm/components → components}/ui/navigation-menu.js.map +0 -0
- /package/dist/{types/components → components}/ui/pagination.d.ts +0 -0
- /package/dist/{esm/components → components}/ui/pagination.js +0 -0
- /package/dist/{esm/components → components}/ui/pagination.js.map +0 -0
- /package/dist/{types/components → components}/ui/popover.d.ts +0 -0
- /package/dist/{esm/components → components}/ui/popover.js +0 -0
- /package/dist/{esm/components → components}/ui/popover.js.map +0 -0
- /package/dist/{types/components → components}/ui/progress.d.ts +0 -0
- /package/dist/{esm/components → components}/ui/progress.js +0 -0
- /package/dist/{esm/components → components}/ui/progress.js.map +0 -0
- /package/dist/{types/components → components}/ui/radio-group.d.ts +0 -0
- /package/dist/{esm/components → components}/ui/radio-group.js +0 -0
- /package/dist/{esm/components → components}/ui/radio-group.js.map +0 -0
- /package/dist/{types/components → components}/ui/resizable.d.ts +0 -0
- /package/dist/{esm/components → components}/ui/resizable.js +0 -0
- /package/dist/{esm/components → components}/ui/resizable.js.map +0 -0
- /package/dist/{types/components → components}/ui/ripple-button.d.ts +0 -0
- /package/dist/{esm/components → components}/ui/ripple-button.js +0 -0
- /package/dist/{esm/components → components}/ui/ripple-button.js.map +0 -0
- /package/dist/{types/components → components}/ui/scratcher.d.ts +0 -0
- /package/dist/{esm/components → components}/ui/scratcher.js +0 -0
- /package/dist/{esm/components → components}/ui/scratcher.js.map +0 -0
- /package/dist/{types/components → components}/ui/scroll-area.d.ts +0 -0
- /package/dist/{esm/components → components}/ui/scroll-area.js +0 -0
- /package/dist/{esm/components → components}/ui/scroll-area.js.map +0 -0
- /package/dist/{types/components → components}/ui/select.d.ts +0 -0
- /package/dist/{esm/components → components}/ui/select.js +0 -0
- /package/dist/{esm/components → components}/ui/select.js.map +0 -0
- /package/dist/{types/components → components}/ui/separator.d.ts +0 -0
- /package/dist/{esm/components → components}/ui/separator.js +0 -0
- /package/dist/{esm/components → components}/ui/separator.js.map +0 -0
- /package/dist/{types/components → components}/ui/sheet.d.ts +0 -0
- /package/dist/{esm/components → components}/ui/sheet.js +0 -0
- /package/dist/{esm/components → components}/ui/sheet.js.map +0 -0
- /package/dist/{types/components → components}/ui/sidebar.d.ts +0 -0
- /package/dist/{esm/components → components}/ui/sidebar.js +0 -0
- /package/dist/{esm/components → components}/ui/sidebar.js.map +0 -0
- /package/dist/{types/components → components}/ui/skeleton.d.ts +0 -0
- /package/dist/{esm/components → components}/ui/skeleton.js +0 -0
- /package/dist/{esm/components → components}/ui/skeleton.js.map +0 -0
- /package/dist/{types/components → components}/ui/slider.d.ts +0 -0
- /package/dist/{esm/components → components}/ui/slider.js +0 -0
- /package/dist/{esm/components → components}/ui/slider.js.map +0 -0
- /package/dist/{types/components → components}/ui/sonner.d.ts +0 -0
- /package/dist/{esm/components → components}/ui/sonner.js +0 -0
- /package/dist/{esm/components → components}/ui/sonner.js.map +0 -0
- /package/dist/{types/components → components}/ui/switch.d.ts +0 -0
- /package/dist/{esm/components → components}/ui/switch.js +0 -0
- /package/dist/{esm/components → components}/ui/switch.js.map +0 -0
- /package/dist/{types/components → components}/ui/table.d.ts +0 -0
- /package/dist/{esm/components → components}/ui/table.js +0 -0
- /package/dist/{esm/components → components}/ui/table.js.map +0 -0
- /package/dist/{types/components → components}/ui/tabs.d.ts +0 -0
- /package/dist/{esm/components → components}/ui/tabs.js +0 -0
- /package/dist/{esm/components → components}/ui/tabs.js.map +0 -0
- /package/dist/{types/components → components}/ui/textarea.d.ts +0 -0
- /package/dist/{esm/components → components}/ui/textarea.js +0 -0
- /package/dist/{esm/components → components}/ui/textarea.js.map +0 -0
- /package/dist/{types/components → components}/ui/toggle-group.d.ts +0 -0
- /package/dist/{esm/components → components}/ui/toggle-group.js +0 -0
- /package/dist/{esm/components → components}/ui/toggle-group.js.map +0 -0
- /package/dist/{types/components → components}/ui/toggle.d.ts +0 -0
- /package/dist/{esm/components → components}/ui/toggle.js +0 -0
- /package/dist/{esm/components → components}/ui/toggle.js.map +0 -0
- /package/dist/{types/components → components}/ui/tooltip.d.ts +0 -0
- /package/dist/{esm/components → components}/ui/tooltip.js +0 -0
- /package/dist/{esm/components → components}/ui/tooltip.js.map +0 -0
- /package/dist/{types/hooks → hooks}/use-mobile.d.ts +0 -0
- /package/dist/{esm/hooks → hooks}/use-mobile.js +0 -0
- /package/dist/{esm/hooks → hooks}/use-mobile.js.map +0 -0
- /package/dist/{types/index.d.ts → index.d.ts} +0 -0
- /package/dist/{types/lib → lib}/utils.d.ts +0 -0
- /package/dist/{esm/lib → lib}/utils.js +0 -0
- /package/dist/{esm/lib → lib}/utils.js.map +0 -0
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"components\\ui\\dropdrawer.cjs","sources":["webpack://@arolariu/components/webpack/runtime/define_property_getters","webpack://@arolariu/components/webpack/runtime/has_own_property","webpack://@arolariu/components/webpack/runtime/make_namespace_object","webpack://@arolariu/components/./src/components/ui/dropdrawer.tsx"],"sourcesContent":["__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n }\n }\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","\n\nimport { AnimatePresence, motion } from \"motion/react\";\nimport { ChevronLeftIcon, ChevronRightIcon } from \"lucide-react\";\nimport * as React from \"react\";\n\nimport {\n Drawer,\n DrawerClose,\n DrawerContent,\n DrawerFooter,\n DrawerHeader,\n DrawerTitle,\n DrawerTrigger,\n} from \"@/components/ui/drawer\";\nimport {\n DropdownMenu,\n DropdownMenuContent,\n DropdownMenuItem,\n DropdownMenuLabel,\n DropdownMenuSeparator,\n DropdownMenuSub,\n DropdownMenuSubContent,\n DropdownMenuSubTrigger,\n DropdownMenuTrigger,\n} from \"@/components/ui/dropdown-menu\";\nimport { useIsMobile } from \"@/hooks/use-mobile\";\nimport { cn } from \"@/lib/utils\";\n\nconst DropDrawerContext = React.createContext<{ isMobile: boolean }>({\n isMobile: false,\n});\n\nconst useDropDrawerContext = () => {\n const context = React.useContext(DropDrawerContext);\n if (!context) {\n throw new Error(\n \"DropDrawer components cannot be rendered outside the Context\",\n );\n }\n return context;\n};\n\nfunction DropDrawer({\n children,\n ...props\n}:\n | React.ComponentProps<typeof Drawer>\n | React.ComponentProps<typeof DropdownMenu>) {\n const isMobile = useIsMobile();\n const DropdownComponent = isMobile ? Drawer : DropdownMenu;\n\n return (\n <DropDrawerContext.Provider value={{ isMobile }}>\n <DropdownComponent\n data-slot=\"drop-drawer\"\n {...(isMobile && { autoFocus: true })}\n {...props}\n >\n {children}\n </DropdownComponent>\n </DropDrawerContext.Provider>\n );\n}\n\nfunction DropDrawerTrigger({\n className,\n children,\n ...props\n}:\n | React.ComponentProps<typeof DrawerTrigger>\n | React.ComponentProps<typeof DropdownMenuTrigger>) {\n const { isMobile } = useDropDrawerContext();\n const TriggerComponent = isMobile ? DrawerTrigger : DropdownMenuTrigger;\n\n return (\n <TriggerComponent\n data-slot=\"drop-drawer-trigger\"\n className={className}\n {...props}\n >\n {children}\n </TriggerComponent>\n );\n}\n\nfunction DropDrawerContent({\n className,\n children,\n ...props\n}:\n | React.ComponentProps<typeof DrawerContent>\n | React.ComponentProps<typeof DropdownMenuContent>) {\n const { isMobile } = useDropDrawerContext();\n const [activeSubmenu, setActiveSubmenu] = React.useState<string | null>(null);\n const [submenuTitle, setSubmenuTitle] = React.useState<string | null>(null);\n const [submenuStack, setSubmenuStack] = React.useState<\n { id: string; title: string }[]\n >([]);\n // Add animation direction state\n const [animationDirection, setAnimationDirection] = React.useState<\n \"forward\" | \"backward\"\n >(\"forward\");\n\n // Create a ref to store submenu content by ID\n const submenuContentRef = React.useRef<Map<string, React.ReactNode[]>>(\n new Map(),\n );\n\n // Function to navigate to a submenu\n const navigateToSubmenu = React.useCallback((id: string, title: string) => {\n // Set animation direction to forward when navigating to a submenu\n setAnimationDirection(\"forward\");\n setActiveSubmenu(id);\n setSubmenuTitle(title);\n setSubmenuStack((prev) => [...prev, { id, title }]);\n }, []);\n\n // Function to go back to previous menu\n const goBack = React.useCallback(() => {\n // Set animation direction to backward when going back\n setAnimationDirection(\"backward\");\n\n if (submenuStack.length <= 1) {\n // If we're at the first level, go back to main menu\n setActiveSubmenu(null);\n setSubmenuTitle(null);\n setSubmenuStack([]);\n } else {\n // Go back to previous submenu\n const newStack = [...submenuStack];\n newStack.pop(); // Remove current\n const previous = newStack[newStack.length - 1];\n setActiveSubmenu(previous.id);\n setSubmenuTitle(previous.title);\n setSubmenuStack(newStack);\n }\n }, [submenuStack]);\n\n // Function to register submenu content\n const registerSubmenuContent = React.useCallback(\n (id: string, content: React.ReactNode[]) => {\n submenuContentRef.current.set(id, content);\n },\n [],\n );\n\n // Function to extract submenu content\n const extractSubmenuContent = React.useCallback(\n (elements: React.ReactNode, targetId: string): React.ReactNode[] => {\n const result: React.ReactNode[] = [];\n\n // Recursive function to search through all children\n const findSubmenuContent = (node: React.ReactNode) => {\n // Skip if not a valid element\n if (!React.isValidElement(node)) return;\n\n const element = node as React.ReactElement;\n // Use a more specific type to avoid 'any'\n const props = element.props as {\n id?: string;\n \"data-submenu-id\"?: string;\n children?: React.ReactNode;\n };\n\n // Check if this is a DropDrawerSub\n if (element.type === DropDrawerSub) {\n // Get all possible ID values\n const elementId = props.id;\n const dataSubmenuId = props[\"data-submenu-id\"];\n\n // If this is the submenu we're looking for\n if (elementId === targetId || dataSubmenuId === targetId) {\n // Find the SubContent within this Sub\n if (props.children) {\n React.Children.forEach(props.children, (child) => {\n if (\n React.isValidElement(child) &&\n child.type === DropDrawerSubContent\n ) {\n // Add all children of the SubContent to the result\n const subContentProps = child.props as {\n children?: React.ReactNode;\n };\n if (subContentProps.children) {\n React.Children.forEach(\n subContentProps.children,\n (contentChild) => {\n result.push(contentChild);\n },\n );\n }\n }\n });\n }\n return; // Found what we needed, no need to search deeper\n }\n }\n\n // If this element has children, search through them\n if (props.children) {\n if (Array.isArray(props.children)) {\n props.children.forEach((child: React.ReactNode) =>\n findSubmenuContent(child),\n );\n } else {\n findSubmenuContent(props.children);\n }\n }\n };\n\n // Start the search from the root elements\n if (Array.isArray(elements)) {\n elements.forEach((child) => findSubmenuContent(child));\n } else {\n findSubmenuContent(elements);\n }\n\n return result;\n },\n [],\n );\n\n // Get submenu content (either from cache or extract it)\n const getSubmenuContent = React.useCallback(\n (id: string) => {\n // Check if we have the content in our ref\n const cachedContent = submenuContentRef.current.get(id || \"\");\n if (cachedContent && cachedContent.length > 0) {\n return cachedContent;\n }\n\n // If not in cache, extract it\n const submenuContent = extractSubmenuContent(children, id);\n\n if (submenuContent.length === 0) {\n return [];\n }\n\n // Store in cache for future use\n if (id) {\n submenuContentRef.current.set(id, submenuContent);\n }\n\n return submenuContent;\n },\n [children, extractSubmenuContent],\n );\n\n // Animation variants for Framer Motion\n const variants = {\n enter: (direction: \"forward\" | \"backward\") => ({\n x: direction === \"forward\" ? \"100%\" : \"-100%\",\n opacity: 0,\n }),\n center: {\n x: 0,\n opacity: 1,\n },\n exit: (direction: \"forward\" | \"backward\") => ({\n x: direction === \"forward\" ? \"-100%\" : \"100%\",\n opacity: 0,\n }),\n };\n\n // Animation transition\n const transition = {\n duration: 0.3,\n ease: [0.25, 0.1, 0.25, 1.0], // cubic-bezier easing\n };\n\n if (isMobile) {\n return (\n <SubmenuContext.Provider\n value={{\n activeSubmenu,\n setActiveSubmenu: (id) => {\n if (id === null) {\n setActiveSubmenu(null);\n setSubmenuTitle(null);\n setSubmenuStack([]);\n }\n },\n submenuTitle,\n setSubmenuTitle,\n navigateToSubmenu,\n registerSubmenuContent,\n }}\n >\n <DrawerContent\n data-slot=\"drop-drawer-content\"\n className={cn(\"max-h-[90vh]\", className)}\n {...props}\n >\n {activeSubmenu ? (\n <>\n <DrawerHeader>\n <div className=\"flex items-center gap-2\">\n <button\n onClick={goBack}\n className=\"hover:bg-neutral-100/50 rounded-full p-1 dark:hover:bg-neutral-800/50\"\n >\n <ChevronLeftIcon className=\"h-5 w-5\" />\n </button>\n <DrawerTitle>{submenuTitle || \"Submenu\"}</DrawerTitle>\n </div>\n </DrawerHeader>\n <div className=\"flex-1 relative overflow-y-auto max-h-[70vh]\">\n {/* Use AnimatePresence to handle exit animations */}\n <AnimatePresence\n initial={false}\n mode=\"wait\"\n custom={animationDirection}\n >\n <motion.div\n key={activeSubmenu || \"main\"}\n custom={animationDirection}\n variants={variants}\n initial=\"enter\"\n animate=\"center\"\n exit=\"exit\"\n transition={transition}\n className=\"pb-6 space-y-1.5 w-full h-full\"\n >\n {activeSubmenu\n ? getSubmenuContent(activeSubmenu)\n : children}\n </motion.div>\n </AnimatePresence>\n </div>\n </>\n ) : (\n <>\n <DrawerHeader className=\"sr-only\">\n <DrawerTitle>Menu</DrawerTitle>\n </DrawerHeader>\n <div className=\"overflow-y-auto max-h-[70vh]\">\n <AnimatePresence\n initial={false}\n mode=\"wait\"\n custom={animationDirection}\n >\n <motion.div\n key=\"main-menu\"\n custom={animationDirection}\n variants={variants}\n initial=\"enter\"\n animate=\"center\"\n exit=\"exit\"\n transition={transition}\n className=\"pb-6 space-y-1.5 w-full\"\n >\n {children}\n </motion.div>\n </AnimatePresence>\n </div>\n </>\n )}\n </DrawerContent>\n </SubmenuContext.Provider>\n );\n }\n\n return (\n <SubmenuContext.Provider\n value={{\n activeSubmenu,\n setActiveSubmenu,\n submenuTitle,\n setSubmenuTitle,\n registerSubmenuContent,\n }}\n >\n <DropdownMenuContent\n data-slot=\"drop-drawer-content\"\n align=\"end\"\n sideOffset={4}\n className={cn(\n \"max-h-[var(--radix-dropdown-menu-content-available-height)] min-w-[220px] overflow-y-auto\",\n className,\n )}\n {...props}\n >\n {children}\n </DropdownMenuContent>\n </SubmenuContext.Provider>\n );\n}\n\nfunction DropDrawerItem({\n className,\n children,\n onSelect,\n onClick,\n icon,\n variant = \"default\",\n inset,\n disabled,\n ...props\n}: React.ComponentProps<typeof DropdownMenuItem> & {\n icon?: React.ReactNode;\n}) {\n const { isMobile } = useDropDrawerContext();\n\n // Define hooks outside of conditionals to follow React rules\n // Check if this item is inside a group by looking at parent elements\n const isInGroup = React.useCallback(\n (element: HTMLElement | null): boolean => {\n if (!element) return false;\n\n // Check if any parent has a data-drop-drawer-group attribute\n let parent = element.parentElement;\n while (parent) {\n if (parent.hasAttribute(\"data-drop-drawer-group\")) {\n return true;\n }\n parent = parent.parentElement;\n }\n return false;\n },\n [],\n );\n\n // Create a ref to check if the item is in a group\n const itemRef = React.useRef<HTMLDivElement>(null);\n const [isInsideGroup, setIsInsideGroup] = React.useState(false);\n\n React.useEffect(() => {\n // Only run this effect in mobile mode\n if (!isMobile) return;\n\n // Use a short timeout to ensure the DOM is fully rendered\n const timer = setTimeout(() => {\n if (itemRef.current) {\n setIsInsideGroup(isInGroup(itemRef.current));\n }\n }, 0);\n\n return () => clearTimeout(timer);\n }, [isInGroup, isMobile]);\n\n if (isMobile) {\n const handleClick = (e: React.MouseEvent<HTMLDivElement>) => {\n if (disabled) return;\n if (onClick) onClick(e);\n if (onSelect) onSelect(e as unknown as Event);\n };\n\n // Only wrap in DrawerClose if it's not a submenu item\n const content = (\n <div\n ref={itemRef}\n data-slot=\"drop-drawer-item\"\n data-variant={variant}\n data-inset={inset}\n data-disabled={disabled}\n className={cn(\n \"flex cursor-pointer items-center justify-between px-4 py-4\",\n // Only apply margin, background and rounded corners if not in a group\n !isInsideGroup &&\n \"bg-neutral-100 dark:bg-neutral-100 mx-2 my-1.5 rounded-md dark:bg-neutral-800 dark:dark:bg-neutral-800\",\n // For items in a group, don't add background but add more padding\n isInsideGroup && \"bg-transparent py-4\",\n inset && \"pl-8\",\n variant === \"destructive\" &&\n \"text-red-500 dark:text-red-500 dark:text-red-900 dark:dark:text-red-900\",\n disabled && \"pointer-events-none opacity-50\",\n className,\n )}\n onClick={handleClick}\n aria-disabled={disabled}\n {...props}\n >\n <div className=\"flex items-center gap-2\">{children}</div>\n {icon && <div className=\"flex-shrink-0\">{icon}</div>}\n </div>\n );\n\n // Check if this is inside a submenu\n const isInSubmenu =\n (props as Record<string, unknown>)[\"data-parent-submenu-id\"] ||\n (props as Record<string, unknown>)[\"data-parent-submenu\"];\n\n if (isInSubmenu) {\n return content;\n }\n\n return <DrawerClose asChild>{content}</DrawerClose>;\n }\n\n return (\n <DropdownMenuItem\n data-slot=\"drop-drawer-item\"\n data-variant={variant}\n data-inset={inset}\n className={className}\n onSelect={onSelect}\n onClick={onClick as React.MouseEventHandler<HTMLDivElement>}\n variant={variant}\n inset={inset}\n disabled={disabled}\n {...props}\n >\n <div className=\"flex w-full items-center justify-between\">\n <div>{children}</div>\n {icon && <div>{icon}</div>}\n </div>\n </DropdownMenuItem>\n );\n}\n\nfunction DropDrawerSeparator({\n className,\n ...props\n}: React.ComponentProps<typeof DropdownMenuSeparator>) {\n const { isMobile } = useDropDrawerContext();\n\n // For mobile, render a simple divider\n if (isMobile) {\n return null;\n }\n\n // For desktop, use the standard dropdown separator\n return (\n <DropdownMenuSeparator\n data-slot=\"drop-drawer-separator\"\n className={className}\n {...props}\n />\n );\n}\n\nfunction DropDrawerLabel({\n className,\n children,\n ...props\n}:\n | React.ComponentProps<typeof DropdownMenuLabel>\n | React.ComponentProps<typeof DrawerTitle>) {\n const { isMobile } = useDropDrawerContext();\n\n if (isMobile) {\n return (\n <DrawerHeader className=\"p-0\">\n <DrawerTitle\n data-slot=\"drop-drawer-label\"\n className={cn(\n \"text-neutral-500 px-4 py-2 text-sm font-medium dark:text-neutral-400\",\n className,\n )}\n {...props}\n >\n {children}\n </DrawerTitle>\n </DrawerHeader>\n );\n }\n\n return (\n <DropdownMenuLabel\n data-slot=\"drop-drawer-label\"\n className={className}\n {...props}\n >\n {children}\n </DropdownMenuLabel>\n );\n}\n\nfunction DropDrawerFooter({\n className,\n children,\n ...props\n}: React.ComponentProps<typeof DrawerFooter> | React.ComponentProps<\"div\">) {\n const { isMobile } = useDropDrawerContext();\n\n if (isMobile) {\n return (\n <DrawerFooter\n data-slot=\"drop-drawer-footer\"\n className={cn(\"p-4\", className)}\n {...props}\n >\n {children}\n </DrawerFooter>\n );\n }\n\n // No direct equivalent in DropdownMenu, so we'll just render a div\n return (\n <div\n data-slot=\"drop-drawer-footer\"\n className={cn(\"p-2\", className)}\n {...props}\n >\n {children}\n </div>\n );\n}\n\nfunction DropDrawerGroup({\n className,\n children,\n ...props\n}: React.ComponentProps<\"div\"> & {\n children: React.ReactNode;\n}) {\n const { isMobile } = useDropDrawerContext();\n\n // Add separators between children on mobile\n const childrenWithSeparators = React.useMemo(() => {\n if (!isMobile) return children;\n\n const childArray = React.Children.toArray(children);\n\n // Filter out any existing separators\n const filteredChildren = childArray.filter(\n (child) =>\n React.isValidElement(child) && child.type !== DropDrawerSeparator,\n );\n\n // Add separators between items\n return filteredChildren.flatMap((child, index) => {\n if (index === filteredChildren.length - 1) return [child];\n return [\n child,\n <div\n key={`separator-${index}`}\n className=\"bg-neutral-200 h-px dark:bg-neutral-800\"\n aria-hidden=\"true\"\n />,\n ];\n });\n }, [children, isMobile]);\n\n if (isMobile) {\n return (\n <div\n data-drop-drawer-group\n data-slot=\"drop-drawer-group\"\n role=\"group\"\n className={cn(\n \"bg-neutral-100 dark:bg-neutral-100 mx-2 my-3 overflow-hidden rounded-xl dark:bg-neutral-800 dark:dark:bg-neutral-800\",\n className,\n )}\n {...props}\n >\n {childrenWithSeparators}\n </div>\n );\n }\n\n // On desktop, use a div with proper role and attributes\n return (\n <div\n data-drop-drawer-group\n data-slot=\"drop-drawer-group\"\n role=\"group\"\n className={className}\n {...props}\n >\n {children}\n </div>\n );\n}\n\n// Context for managing submenu state on mobile\ninterface SubmenuContextType {\n activeSubmenu: string | null;\n setActiveSubmenu: (id: string | null) => void;\n submenuTitle: string | null;\n setSubmenuTitle: (title: string | null) => void;\n navigateToSubmenu?: (id: string, title: string) => void;\n registerSubmenuContent?: (id: string, content: React.ReactNode[]) => void;\n}\n\nconst SubmenuContext = React.createContext<SubmenuContextType>({\n activeSubmenu: null,\n setActiveSubmenu: () => {},\n submenuTitle: null,\n setSubmenuTitle: () => {},\n navigateToSubmenu: undefined,\n registerSubmenuContent: undefined,\n});\n\n// Submenu components\n// Counter for generating simple numeric IDs\nlet submenuIdCounter = 0;\n\nfunction DropDrawerSub({\n children,\n id,\n ...props\n}: React.ComponentProps<typeof DropdownMenuSub> & {\n id?: string;\n}) {\n const { isMobile } = useDropDrawerContext();\n const { registerSubmenuContent } = React.useContext(SubmenuContext);\n\n // Generate a simple numeric ID instead of using React.useId()\n const [generatedId] = React.useState(() => `submenu-${submenuIdCounter++}`);\n const submenuId = id || generatedId;\n\n // Extract submenu content to register with parent\n React.useEffect(() => {\n if (!registerSubmenuContent) return;\n\n // Find the SubContent within this Sub\n const contentItems: React.ReactNode[] = [];\n React.Children.forEach(children, (child) => {\n if (React.isValidElement(child) && child.type === DropDrawerSubContent) {\n // Add all children of the SubContent to the result\n React.Children.forEach(\n (child.props as { children?: React.ReactNode }).children,\n (contentChild) => {\n contentItems.push(contentChild);\n },\n );\n }\n });\n\n // Register the content with the parent\n if (contentItems.length > 0) {\n registerSubmenuContent(submenuId, contentItems);\n }\n }, [children, registerSubmenuContent, submenuId]);\n\n if (isMobile) {\n // For mobile, we'll use the context to manage submenu state\n // Process children to pass the submenu ID to the trigger and content\n const processedChildren = React.Children.map(children, (child) => {\n if (!React.isValidElement(child)) return child;\n\n if (child.type === DropDrawerSubTrigger) {\n return React.cloneElement(\n child as React.ReactElement,\n {\n ...(child.props as object),\n \"data-parent-submenu-id\": submenuId,\n \"data-submenu-id\": submenuId,\n // Use only data attributes, not custom props\n \"data-parent-submenu\": submenuId,\n } as React.HTMLAttributes<HTMLElement>,\n );\n }\n\n if (child.type === DropDrawerSubContent) {\n return React.cloneElement(\n child as React.ReactElement,\n {\n ...(child.props as object),\n \"data-parent-submenu-id\": submenuId,\n \"data-submenu-id\": submenuId,\n // Use only data attributes, not custom props\n \"data-parent-submenu\": submenuId,\n } as React.HTMLAttributes<HTMLElement>,\n );\n }\n\n return child;\n });\n\n return (\n <div\n data-slot=\"drop-drawer-sub\"\n data-submenu-id={submenuId}\n id={submenuId}\n >\n {processedChildren}\n </div>\n );\n }\n\n // For desktop, pass the generated ID to the DropdownMenuSub\n return (\n <DropdownMenuSub\n data-slot=\"drop-drawer-sub\"\n data-submenu-id={submenuId}\n // Don't pass id to DropdownMenuSub as it doesn't accept this prop\n {...props}\n >\n {children}\n </DropdownMenuSub>\n );\n}\n\nfunction DropDrawerSubTrigger({\n className,\n inset,\n children,\n ...props\n}: React.ComponentProps<typeof DropdownMenuSubTrigger> & {\n icon?: React.ReactNode;\n}) {\n const { isMobile } = useDropDrawerContext();\n const { navigateToSubmenu } = React.useContext(SubmenuContext);\n\n // Define hooks outside of conditionals to follow React rules\n // Check if this item is inside a group by looking at parent elements\n const isInGroup = React.useCallback(\n (element: HTMLElement | null): boolean => {\n if (!element) return false;\n\n // Check if any parent has a data-drop-drawer-group attribute\n let parent = element.parentElement;\n while (parent) {\n if (parent.hasAttribute(\"data-drop-drawer-group\")) {\n return true;\n }\n parent = parent.parentElement;\n }\n return false;\n },\n [],\n );\n\n // Create a ref to check if the item is in a group\n const itemRef = React.useRef<HTMLDivElement>(null);\n const [isInsideGroup, setIsInsideGroup] = React.useState(false);\n\n React.useEffect(() => {\n // Only run this effect in mobile mode\n if (!isMobile) return;\n\n // Use a short timeout to ensure the DOM is fully rendered\n const timer = setTimeout(() => {\n if (itemRef.current) {\n setIsInsideGroup(isInGroup(itemRef.current));\n }\n }, 0);\n\n return () => clearTimeout(timer);\n }, [isInGroup, isMobile]);\n\n if (isMobile) {\n // Find the parent submenu ID\n const handleClick = (e: React.MouseEvent) => {\n e.preventDefault();\n e.stopPropagation();\n\n // Get the closest parent with data-submenu-id attribute\n const element = e.currentTarget as HTMLElement;\n let submenuId: string | null = null;\n\n // First check if the element itself has the data attribute\n if (element.closest(\"[data-submenu-id]\")) {\n const closestElement = element.closest(\"[data-submenu-id]\");\n const id = closestElement?.getAttribute(\"data-submenu-id\");\n if (id) {\n submenuId = id;\n }\n }\n\n // If not found, try props\n if (!submenuId) {\n submenuId =\n ((props as Record<string, unknown>)[\n \"data-parent-submenu-id\"\n ] as string) ||\n ((props as Record<string, unknown>)[\"data-parent-submenu\"] as string);\n }\n\n if (!submenuId) {\n return;\n }\n\n // Get the title\n const title = typeof children === \"string\" ? children : \"Submenu\";\n\n // Navigate to the submenu\n if (navigateToSubmenu) {\n navigateToSubmenu(submenuId, title);\n }\n };\n\n // Combine onClick handlers\n const combinedOnClick = (e: React.MouseEvent) => {\n // Call the original onClick if provided\n const typedProps = props as Record<string, unknown>;\n if (typedProps[\"onClick\"]) {\n const originalOnClick = typedProps[\n \"onClick\"\n ] as React.MouseEventHandler<HTMLDivElement>;\n originalOnClick(e as React.MouseEvent<HTMLDivElement>);\n }\n\n // Call our navigation handler\n handleClick(e);\n };\n\n // Remove onClick from props to avoid duplicate handlers\n const { ...restProps } = props as Record<string, unknown>;\n\n // Don't wrap in DrawerClose for submenu triggers\n return (\n <div\n ref={itemRef}\n data-slot=\"drop-drawer-sub-trigger\"\n data-inset={inset}\n className={cn(\n \"flex cursor-pointer items-center justify-between px-4 py-4\",\n // Only apply margin, background and rounded corners if not in a group\n !isInsideGroup &&\n \"bg-neutral-100 dark:bg-neutral-100 mx-2 my-1.5 rounded-md dark:bg-neutral-800 dark:dark:bg-neutral-800\",\n // For items in a group, don't add background but add more padding\n isInsideGroup && \"bg-transparent py-4\",\n inset && \"pl-8\",\n className,\n )}\n onClick={combinedOnClick}\n {...restProps}\n >\n <div className=\"flex items-center gap-2\">{children}</div>\n <ChevronRightIcon className=\"h-5 w-5\" />\n </div>\n );\n }\n\n return (\n <DropdownMenuSubTrigger\n data-slot=\"drop-drawer-sub-trigger\"\n data-inset={inset}\n className={className}\n inset={inset}\n {...props}\n >\n {children}\n </DropdownMenuSubTrigger>\n );\n}\n\nfunction DropDrawerSubContent({\n className,\n sideOffset = 4,\n children,\n ...props\n}: React.ComponentProps<typeof DropdownMenuSubContent>) {\n const { isMobile } = useDropDrawerContext();\n\n if (isMobile) {\n // For mobile, we don't render the content directly\n // It will be rendered by the DropDrawerContent component when active\n return null;\n }\n\n return (\n <DropdownMenuSubContent\n data-slot=\"drop-drawer-sub-content\"\n sideOffset={sideOffset}\n className={cn(\n \"z-50 min-w-[8rem] overflow-hidden rounded-md border border-neutral-200 p-1 shadow-lg dark:border-neutral-800\",\n className,\n )}\n {...props}\n >\n {children}\n </DropdownMenuSubContent>\n );\n}\n\nexport {\n DropDrawer,\n DropDrawerContent,\n DropDrawerFooter,\n DropDrawerGroup,\n DropDrawerItem,\n DropDrawerLabel,\n DropDrawerSeparator,\n DropDrawerSub,\n DropDrawerSubContent,\n DropDrawerSubTrigger,\n DropDrawerTrigger,\n};\n"],"names":["__webpack_require__","definition","key","Object","obj","prop","Symbol","DropDrawerContext","React","useDropDrawerContext","context","Error","DropDrawer","children","props","isMobile","useIsMobile","DropdownComponent","Drawer","DropdownMenu","DropDrawerTrigger","className","TriggerComponent","DrawerTrigger","DropdownMenuTrigger","DropDrawerContent","activeSubmenu","setActiveSubmenu","submenuTitle","setSubmenuTitle","submenuStack","setSubmenuStack","animationDirection","setAnimationDirection","submenuContentRef","Map","navigateToSubmenu","id","title","prev","goBack","newStack","previous","registerSubmenuContent","content","extractSubmenuContent","elements","targetId","result","findSubmenuContent","node","element","DropDrawerSub","elementId","dataSubmenuId","child","DropDrawerSubContent","subContentProps","contentChild","Array","getSubmenuContent","cachedContent","submenuContent","variants","direction","transition","SubmenuContext","DrawerContent","cn","DrawerHeader","ChevronLeftIcon","DrawerTitle","AnimatePresence","motion","DropdownMenuContent","DropDrawerItem","onSelect","onClick","icon","variant","inset","disabled","isInGroup","parent","itemRef","isInsideGroup","setIsInsideGroup","timer","setTimeout","clearTimeout","handleClick","e","isInSubmenu","DrawerClose","DropdownMenuItem","DropDrawerSeparator","DropdownMenuSeparator","DropDrawerLabel","DropdownMenuLabel","DropDrawerFooter","DrawerFooter","DropDrawerGroup","childrenWithSeparators","childArray","filteredChildren","index","undefined","submenuIdCounter","generatedId","submenuId","contentItems","processedChildren","DropDrawerSubTrigger","DropdownMenuSub","closestElement","combinedOnClick","typedProps","originalOnClick","restProps","ChevronRightIcon","DropdownMenuSubTrigger","sideOffset","DropdownMenuSubContent"],"mappings":";;;;IAAAA,oBAAoB,CAAC,GAAG,CAAC,UAASC;QACjC,IAAI,IAAIC,OAAOD,WACR,IAAGD,oBAAoB,CAAC,CAACC,YAAYC,QAAQ,CAACF,oBAAoB,CAAC,CAAC,UAASE,MACzEC,OAAO,cAAc,CAAC,UAASD,KAAK;YAAE,YAAY;YAAM,KAAKD,UAAU,CAACC,IAAI;QAAC;IAGzF;;;ICNAF,oBAAoB,CAAC,GAAG,CAACI,KAAKC,OAAUF,OAAO,SAAS,CAAC,cAAc,CAAC,IAAI,CAACC,KAAKC;;;ICClFL,oBAAoB,CAAC,GAAG,CAAC;QACxB,IAAG,sBAAOM,UAA0BA,OAAO,WAAW,EACrDH,OAAO,cAAc,CAAC,UAASG,OAAO,WAAW,EAAE;YAAE,OAAO;QAAS;QAEtEH,OAAO,cAAc,CAAC,UAAS,cAAc;YAAE,OAAO;QAAK;IAC5D;;;;;;;;;;;;;;;;;;;;;;;;;ACuBA,MAAMI,oBAAoB,WAApBA,GAAoBC,+BAAAA,aAAmB,CAAwB;IACnE,UAAU;AACZ;AAEA,MAAMC,uBAAuB;IAC3B,MAAMC,UAAUF,+BAAAA,UAAgB,CAACD;IACjC,IAAI,CAACG,SACH,MAAM,IAAIC,MACR;IAGJ,OAAOD;AACT;AAEA,SAASE,WAAW,EAClBC,QAAQ,EACR,GAAGC,OAGwC;IAC3C,MAAMC,WAAWC,IAAAA,+BAAAA,WAAAA;IACjB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ACR,GAAGC,OACiD;IACpD,MAAM,EAAEC,QAAQ,EAAE,GAAGN;IAErB,IAAIM,UAGF,OAAO;IAGT,OACE,WADF,GACE,qCAAC2G,2CAAAA,sBAAsBA,EAAAA;QACrB,aAAU;QACV,YAAYD;QACZ,WAAWrD,IAAAA,0BAAAA,EAAAA,EACT,gHACA/C;QAED,GAAGP,KAAK;kBAERD;;AAGP"}
|
|
@@ -1,259 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
"use strict";
|
|
3
|
-
var __webpack_require__ = {};
|
|
4
|
-
(()=>{
|
|
5
|
-
__webpack_require__.d = (exports1, definition)=>{
|
|
6
|
-
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: definition[key]
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
})();
|
|
12
|
-
(()=>{
|
|
13
|
-
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
14
|
-
})();
|
|
15
|
-
(()=>{
|
|
16
|
-
__webpack_require__.r = (exports1)=>{
|
|
17
|
-
if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
18
|
-
value: 'Module'
|
|
19
|
-
});
|
|
20
|
-
Object.defineProperty(exports1, '__esModule', {
|
|
21
|
-
value: true
|
|
22
|
-
});
|
|
23
|
-
};
|
|
24
|
-
})();
|
|
25
|
-
var __webpack_exports__ = {};
|
|
26
|
-
__webpack_require__.r(__webpack_exports__);
|
|
27
|
-
__webpack_require__.d(__webpack_exports__, {
|
|
28
|
-
FireworksBackground: ()=>FireworksBackground
|
|
29
|
-
});
|
|
30
|
-
const jsx_runtime_namespaceObject = require("react/jsx-runtime");
|
|
31
|
-
const external_react_namespaceObject = require("react");
|
|
32
|
-
const utils_cjs_namespaceObject = require("../../lib/utils.cjs");
|
|
33
|
-
const rand = (min, max)=>Math.random() * (max - min) + min;
|
|
34
|
-
const randInt = (min, max)=>Math.floor(Math.random() * (max - min) + min);
|
|
35
|
-
const randColor = ()=>`hsl(${randInt(0, 360)}, 100%, 50%)`;
|
|
36
|
-
const createParticle = (x, y, color, speed, direction, gravity, friction, size)=>{
|
|
37
|
-
const vx = Math.cos(direction) * speed;
|
|
38
|
-
const vy = Math.sin(direction) * speed;
|
|
39
|
-
const alpha = 1;
|
|
40
|
-
const decay = rand(0.005, 0.02);
|
|
41
|
-
return {
|
|
42
|
-
x,
|
|
43
|
-
y,
|
|
44
|
-
color,
|
|
45
|
-
speed,
|
|
46
|
-
direction,
|
|
47
|
-
vx,
|
|
48
|
-
vy,
|
|
49
|
-
gravity,
|
|
50
|
-
friction,
|
|
51
|
-
alpha,
|
|
52
|
-
decay,
|
|
53
|
-
size,
|
|
54
|
-
update () {
|
|
55
|
-
this.vx *= this.friction;
|
|
56
|
-
this.vy *= this.friction;
|
|
57
|
-
this.vy += this.gravity;
|
|
58
|
-
this.x += this.vx;
|
|
59
|
-
this.y += this.vy;
|
|
60
|
-
this.alpha -= this.decay;
|
|
61
|
-
},
|
|
62
|
-
draw (ctx) {
|
|
63
|
-
ctx.save();
|
|
64
|
-
ctx.globalAlpha = this.alpha;
|
|
65
|
-
ctx.beginPath();
|
|
66
|
-
ctx.arc(this.x, this.y, this.size, 0, 2 * Math.PI);
|
|
67
|
-
ctx.fillStyle = this.color;
|
|
68
|
-
ctx.fill();
|
|
69
|
-
ctx.restore();
|
|
70
|
-
},
|
|
71
|
-
isAlive () {
|
|
72
|
-
return this.alpha > 0;
|
|
73
|
-
}
|
|
74
|
-
};
|
|
75
|
-
};
|
|
76
|
-
const createFirework = (x, y, targetY, color, speed, size, particleSpeed, particleSize, onExplode)=>{
|
|
77
|
-
const angle = -Math.PI / 2 + rand(-0.3, 0.3);
|
|
78
|
-
const vx = Math.cos(angle) * speed;
|
|
79
|
-
const vy = Math.sin(angle) * speed;
|
|
80
|
-
const trail = [];
|
|
81
|
-
const trailLength = randInt(10, 25);
|
|
82
|
-
return {
|
|
83
|
-
x,
|
|
84
|
-
y,
|
|
85
|
-
targetY,
|
|
86
|
-
color,
|
|
87
|
-
speed,
|
|
88
|
-
size,
|
|
89
|
-
angle,
|
|
90
|
-
vx,
|
|
91
|
-
vy,
|
|
92
|
-
trail,
|
|
93
|
-
trailLength,
|
|
94
|
-
exploded: false,
|
|
95
|
-
update () {
|
|
96
|
-
this.trail.push({
|
|
97
|
-
x: this.x,
|
|
98
|
-
y: this.y
|
|
99
|
-
});
|
|
100
|
-
if (this.trail.length > this.trailLength) this.trail.shift();
|
|
101
|
-
this.x += this.vx;
|
|
102
|
-
this.y += this.vy;
|
|
103
|
-
this.vy += 0.02;
|
|
104
|
-
if (this.vy >= 0 || this.y <= this.targetY) {
|
|
105
|
-
this.explode();
|
|
106
|
-
return false;
|
|
107
|
-
}
|
|
108
|
-
return true;
|
|
109
|
-
},
|
|
110
|
-
explode () {
|
|
111
|
-
const numParticles = randInt(50, 150);
|
|
112
|
-
const particles = [];
|
|
113
|
-
for(let i = 0; i < numParticles; i++){
|
|
114
|
-
const particleAngle = rand(0, 2 * Math.PI);
|
|
115
|
-
const localParticleSpeed = getValueByRange(particleSpeed);
|
|
116
|
-
const localParticleSize = getValueByRange(particleSize);
|
|
117
|
-
particles.push(createParticle(this.x, this.y, this.color, localParticleSpeed, particleAngle, 0.05, 0.98, localParticleSize));
|
|
118
|
-
}
|
|
119
|
-
onExplode(particles);
|
|
120
|
-
},
|
|
121
|
-
draw (ctx) {
|
|
122
|
-
ctx.save();
|
|
123
|
-
ctx.beginPath();
|
|
124
|
-
if (this.trail.length > 1) {
|
|
125
|
-
ctx.moveTo(this.trail[0].x, this.trail[0].y);
|
|
126
|
-
for (const point of this.trail)ctx.lineTo(point.x, point.y);
|
|
127
|
-
} else {
|
|
128
|
-
ctx.moveTo(this.x, this.y);
|
|
129
|
-
ctx.lineTo(this.x, this.y);
|
|
130
|
-
}
|
|
131
|
-
ctx.strokeStyle = this.color;
|
|
132
|
-
ctx.lineWidth = this.size;
|
|
133
|
-
ctx.lineCap = "round";
|
|
134
|
-
ctx.stroke();
|
|
135
|
-
ctx.restore();
|
|
136
|
-
}
|
|
137
|
-
};
|
|
138
|
-
};
|
|
139
|
-
const getValueByRange = (range)=>{
|
|
140
|
-
if ("number" == typeof range) return range;
|
|
141
|
-
return rand(range.min, range.max);
|
|
142
|
-
};
|
|
143
|
-
const getColor = (color)=>{
|
|
144
|
-
if (Array.isArray(color)) return color[randInt(0, color.length)];
|
|
145
|
-
return color ?? randColor();
|
|
146
|
-
};
|
|
147
|
-
const FireworksBackground = /*#__PURE__*/ external_react_namespaceObject.forwardRef(({ className, canvasProps, population = 1, color, fireworkSpeed = {
|
|
148
|
-
min: 4,
|
|
149
|
-
max: 8
|
|
150
|
-
}, fireworkSize = {
|
|
151
|
-
min: 2,
|
|
152
|
-
max: 5
|
|
153
|
-
}, particleSpeed = {
|
|
154
|
-
min: 2,
|
|
155
|
-
max: 7
|
|
156
|
-
}, particleSize = {
|
|
157
|
-
min: 1,
|
|
158
|
-
max: 5
|
|
159
|
-
}, ...props }, ref)=>{
|
|
160
|
-
const canvasRef = external_react_namespaceObject.useRef(null);
|
|
161
|
-
const containerRef = external_react_namespaceObject.useRef(null);
|
|
162
|
-
external_react_namespaceObject.useImperativeHandle(ref, ()=>containerRef.current);
|
|
163
|
-
external_react_namespaceObject.useEffect(()=>{
|
|
164
|
-
const canvas = canvasRef.current;
|
|
165
|
-
const container = containerRef.current;
|
|
166
|
-
if (!canvas || !container) return;
|
|
167
|
-
const ctx = canvas.getContext("2d");
|
|
168
|
-
if (!ctx) return;
|
|
169
|
-
let maxX = window.innerWidth;
|
|
170
|
-
let ratio = container.offsetHeight / container.offsetWidth;
|
|
171
|
-
let maxY = maxX * ratio;
|
|
172
|
-
canvas.width = maxX;
|
|
173
|
-
canvas.height = maxY;
|
|
174
|
-
const setCanvasSize = ()=>{
|
|
175
|
-
maxX = window.innerWidth;
|
|
176
|
-
ratio = container.offsetHeight / container.offsetWidth;
|
|
177
|
-
maxY = maxX * ratio;
|
|
178
|
-
canvas.width = maxX;
|
|
179
|
-
canvas.height = maxY;
|
|
180
|
-
};
|
|
181
|
-
window.addEventListener("resize", setCanvasSize);
|
|
182
|
-
const explosions = [];
|
|
183
|
-
const fireworks = [];
|
|
184
|
-
const handleExplosion = (particles)=>{
|
|
185
|
-
explosions.push(...particles);
|
|
186
|
-
};
|
|
187
|
-
const launchFirework = ()=>{
|
|
188
|
-
const x = rand(0.1 * maxX, 0.9 * maxX);
|
|
189
|
-
const y = maxY;
|
|
190
|
-
const targetY = rand(0.1 * maxY, 0.4 * maxY);
|
|
191
|
-
const fireworkColor = getColor(color);
|
|
192
|
-
const speed = getValueByRange(fireworkSpeed);
|
|
193
|
-
const size = getValueByRange(fireworkSize);
|
|
194
|
-
fireworks.push(createFirework(x, y, targetY, fireworkColor, speed, size, particleSpeed, particleSize, handleExplosion));
|
|
195
|
-
const timeout = rand(300, 800) / population;
|
|
196
|
-
setTimeout(launchFirework, timeout);
|
|
197
|
-
};
|
|
198
|
-
launchFirework();
|
|
199
|
-
let animationFrameId;
|
|
200
|
-
const animate = ()=>{
|
|
201
|
-
ctx.clearRect(0, 0, maxX, maxY);
|
|
202
|
-
for(let i = fireworks.length - 1; i >= 0; i--){
|
|
203
|
-
const firework = fireworks[i];
|
|
204
|
-
if (firework.update()) firework.draw(ctx);
|
|
205
|
-
else fireworks.splice(i, 1);
|
|
206
|
-
}
|
|
207
|
-
for(let i = explosions.length - 1; i >= 0; i--){
|
|
208
|
-
const particle = explosions[i];
|
|
209
|
-
particle.update();
|
|
210
|
-
if (particle.isAlive()) particle.draw(ctx);
|
|
211
|
-
else explosions.splice(i, 1);
|
|
212
|
-
}
|
|
213
|
-
animationFrameId = requestAnimationFrame(animate);
|
|
214
|
-
};
|
|
215
|
-
animate();
|
|
216
|
-
const handleClick = (event)=>{
|
|
217
|
-
const x = event.clientX;
|
|
218
|
-
const y = maxY;
|
|
219
|
-
const targetY = event.clientY;
|
|
220
|
-
const fireworkColor = getColor(color);
|
|
221
|
-
const speed = getValueByRange(fireworkSpeed);
|
|
222
|
-
const size = getValueByRange(fireworkSize);
|
|
223
|
-
fireworks.push(createFirework(x, y, targetY, fireworkColor, speed, size, particleSpeed, particleSize, handleExplosion));
|
|
224
|
-
};
|
|
225
|
-
container.addEventListener("click", handleClick);
|
|
226
|
-
return ()=>{
|
|
227
|
-
window.removeEventListener("resize", setCanvasSize);
|
|
228
|
-
container.removeEventListener("click", handleClick);
|
|
229
|
-
cancelAnimationFrame(animationFrameId);
|
|
230
|
-
};
|
|
231
|
-
}, [
|
|
232
|
-
population,
|
|
233
|
-
color,
|
|
234
|
-
fireworkSpeed,
|
|
235
|
-
fireworkSize,
|
|
236
|
-
particleSpeed,
|
|
237
|
-
particleSize
|
|
238
|
-
]);
|
|
239
|
-
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
240
|
-
ref: containerRef,
|
|
241
|
-
className: (0, utils_cjs_namespaceObject.cn)("relative size-full overflow-hidden", className),
|
|
242
|
-
...props,
|
|
243
|
-
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("canvas", {
|
|
244
|
-
...canvasProps,
|
|
245
|
-
ref: canvasRef,
|
|
246
|
-
className: (0, utils_cjs_namespaceObject.cn)("absolute inset-0 size-full", canvasProps?.className)
|
|
247
|
-
})
|
|
248
|
-
});
|
|
249
|
-
});
|
|
250
|
-
FireworksBackground.displayName = "FireworksBackground";
|
|
251
|
-
exports.FireworksBackground = __webpack_exports__.FireworksBackground;
|
|
252
|
-
for(var __webpack_i__ in __webpack_exports__)if (-1 === [
|
|
253
|
-
"FireworksBackground"
|
|
254
|
-
].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
|
|
255
|
-
Object.defineProperty(exports, '__esModule', {
|
|
256
|
-
value: true
|
|
257
|
-
});
|
|
258
|
-
|
|
259
|
-
//# sourceMappingURL=fireworks-background.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"components\\ui\\fireworks-background.cjs","sources":["webpack://@arolariu/components/webpack/runtime/define_property_getters","webpack://@arolariu/components/webpack/runtime/has_own_property","webpack://@arolariu/components/webpack/runtime/make_namespace_object","webpack://@arolariu/components/./src/components/ui/fireworks-background.tsx"],"sourcesContent":["__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n }\n }\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","\n\nimport * as React from \"react\";\n\nimport { cn } from \"@/lib/utils\";\n\nconst rand = (min: number, max: number): number =>\n Math.random() * (max - min) + min;\nconst randInt = (min: number, max: number): number =>\n Math.floor(Math.random() * (max - min) + min);\nconst randColor = (): string => `hsl(${randInt(0, 360)}, 100%, 50%)`;\n\ninterface ParticleType {\n x: number;\n y: number;\n color: string;\n speed: number;\n direction: number;\n vx: number;\n vy: number;\n gravity: number;\n friction: number;\n alpha: number;\n decay: number;\n size: number;\n update: () => void;\n draw: (ctx: CanvasRenderingContext2D) => void;\n isAlive: () => boolean;\n}\n\nconst createParticle = (\n x: number,\n y: number,\n color: string,\n speed: number,\n direction: number,\n gravity: number,\n friction: number,\n size: number,\n): ParticleType => {\n const vx = Math.cos(direction) * speed;\n const vy = Math.sin(direction) * speed;\n const alpha = 1;\n const decay = rand(0.005, 0.02);\n\n return {\n x,\n y,\n color,\n speed,\n direction,\n vx,\n vy,\n gravity,\n friction,\n alpha,\n decay,\n size,\n update() {\n this.vx *= this.friction;\n this.vy *= this.friction;\n this.vy += this.gravity;\n this.x += this.vx;\n this.y += this.vy;\n this.alpha -= this.decay;\n },\n draw(ctx: CanvasRenderingContext2D) {\n ctx.save();\n ctx.globalAlpha = this.alpha;\n ctx.beginPath();\n ctx.arc(this.x, this.y, this.size, 0, Math.PI * 2);\n ctx.fillStyle = this.color;\n ctx.fill();\n ctx.restore();\n },\n isAlive() {\n return this.alpha > 0;\n },\n };\n};\n\ninterface FireworkType {\n x: number;\n y: number;\n targetY: number;\n color: string;\n speed: number;\n size: number;\n angle: number;\n vx: number;\n vy: number;\n trail: { x: number; y: number }[];\n trailLength: number;\n exploded: boolean;\n update: () => boolean;\n explode: () => void;\n draw: (ctx: CanvasRenderingContext2D) => void;\n}\n\nconst createFirework = (\n x: number,\n y: number,\n targetY: number,\n color: string,\n speed: number,\n size: number,\n particleSpeed: { min: number; max: number } | number,\n particleSize: { min: number; max: number } | number,\n onExplode: (particles: ParticleType[]) => void,\n): FireworkType => {\n const angle = -Math.PI / 2 + rand(-0.3, 0.3);\n const vx = Math.cos(angle) * speed;\n const vy = Math.sin(angle) * speed;\n const trail: { x: number; y: number }[] = [];\n const trailLength = randInt(10, 25);\n\n return {\n x,\n y,\n targetY,\n color,\n speed,\n size,\n angle,\n vx,\n vy,\n trail,\n trailLength,\n exploded: false,\n update() {\n this.trail.push({ x: this.x, y: this.y });\n if (this.trail.length > this.trailLength) {\n this.trail.shift();\n }\n this.x += this.vx;\n this.y += this.vy;\n this.vy += 0.02;\n if (this.vy >= 0 || this.y <= this.targetY) {\n this.explode();\n return false;\n }\n return true;\n },\n explode() {\n const numParticles = randInt(50, 150);\n const particles: ParticleType[] = [];\n for (let i = 0; i < numParticles; i++) {\n const particleAngle = rand(0, Math.PI * 2);\n const localParticleSpeed = getValueByRange(particleSpeed);\n const localParticleSize = getValueByRange(particleSize);\n particles.push(\n createParticle(\n this.x,\n this.y,\n this.color,\n localParticleSpeed,\n particleAngle,\n 0.05,\n 0.98,\n localParticleSize,\n ),\n );\n }\n onExplode(particles);\n },\n draw(ctx: CanvasRenderingContext2D) {\n ctx.save();\n ctx.beginPath();\n if (this.trail.length > 1) {\n ctx.moveTo(this.trail[0].x, this.trail[0].y);\n for (const point of this.trail) {\n ctx.lineTo(point.x, point.y);\n }\n } else {\n ctx.moveTo(this.x, this.y);\n ctx.lineTo(this.x, this.y);\n }\n ctx.strokeStyle = this.color;\n ctx.lineWidth = this.size;\n ctx.lineCap = \"round\";\n ctx.stroke();\n ctx.restore();\n },\n };\n};\n\nconst getValueByRange = (\n range: { min: number; max: number } | number,\n): number => {\n if (typeof range === \"number\") {\n return range;\n }\n return rand(range.min, range.max);\n};\n\nconst getColor = (color: string | string[] | undefined): string => {\n if (Array.isArray(color)) {\n return color[randInt(0, color.length)];\n }\n return color ?? randColor();\n};\n\ninterface FireworksBackgroundProps\n extends Omit<React.HTMLAttributes<HTMLDivElement>, \"color\"> {\n canvasProps?: React.HTMLAttributes<HTMLCanvasElement>;\n population?: number;\n color?: string | string[];\n fireworkSpeed?: { min: number; max: number } | number;\n fireworkSize?: { min: number; max: number } | number;\n particleSpeed?: { min: number; max: number } | number;\n particleSize?: { min: number; max: number } | number;\n}\n\nconst FireworksBackground = React.forwardRef<\n HTMLDivElement,\n FireworksBackgroundProps\n>(\n (\n {\n className,\n canvasProps,\n population = 1,\n color,\n fireworkSpeed = { min: 4, max: 8 },\n fireworkSize = { min: 2, max: 5 },\n particleSpeed = { min: 2, max: 7 },\n particleSize = { min: 1, max: 5 },\n ...props\n },\n ref,\n ) => {\n const canvasRef = React.useRef<HTMLCanvasElement>(null);\n const containerRef = React.useRef<HTMLDivElement>(null);\n React.useImperativeHandle(\n ref,\n () => containerRef.current as HTMLDivElement,\n );\n\n React.useEffect(() => {\n const canvas = canvasRef.current;\n const container = containerRef.current;\n if (!canvas || !container) return;\n const ctx = canvas.getContext(\"2d\");\n if (!ctx) return;\n\n let maxX = window.innerWidth;\n let ratio = container.offsetHeight / container.offsetWidth;\n let maxY = maxX * ratio;\n canvas.width = maxX;\n canvas.height = maxY;\n\n const setCanvasSize = () => {\n maxX = window.innerWidth;\n ratio = container.offsetHeight / container.offsetWidth;\n maxY = maxX * ratio;\n canvas.width = maxX;\n canvas.height = maxY;\n };\n window.addEventListener(\"resize\", setCanvasSize);\n\n const explosions: ParticleType[] = [];\n const fireworks: FireworkType[] = [];\n\n const handleExplosion = (particles: ParticleType[]) => {\n explosions.push(...particles);\n };\n\n const launchFirework = () => {\n const x = rand(maxX * 0.1, maxX * 0.9);\n const y = maxY;\n const targetY = rand(maxY * 0.1, maxY * 0.4);\n const fireworkColor = getColor(color);\n const speed = getValueByRange(fireworkSpeed);\n const size = getValueByRange(fireworkSize);\n fireworks.push(\n createFirework(\n x,\n y,\n targetY,\n fireworkColor,\n speed,\n size,\n particleSpeed,\n particleSize,\n handleExplosion,\n ),\n );\n const timeout = rand(300, 800) / population;\n setTimeout(launchFirework, timeout);\n };\n\n launchFirework();\n\n let animationFrameId: number;\n const animate = () => {\n ctx.clearRect(0, 0, maxX, maxY);\n\n for (let i = fireworks.length - 1; i >= 0; i--) {\n const firework = fireworks[i];\n if (!firework.update()) {\n fireworks.splice(i, 1);\n } else {\n firework.draw(ctx);\n }\n }\n\n for (let i = explosions.length - 1; i >= 0; i--) {\n const particle = explosions[i];\n particle.update();\n if (particle.isAlive()) {\n particle.draw(ctx);\n } else {\n explosions.splice(i, 1);\n }\n }\n\n animationFrameId = requestAnimationFrame(animate);\n };\n\n animate();\n\n const handleClick = (event: MouseEvent) => {\n const x = event.clientX;\n const y = maxY;\n const targetY = event.clientY;\n const fireworkColor = getColor(color);\n const speed = getValueByRange(fireworkSpeed);\n const size = getValueByRange(fireworkSize);\n fireworks.push(\n createFirework(\n x,\n y,\n targetY,\n fireworkColor,\n speed,\n size,\n particleSpeed,\n particleSize,\n handleExplosion,\n ),\n );\n };\n\n container.addEventListener(\"click\", handleClick);\n\n return () => {\n window.removeEventListener(\"resize\", setCanvasSize);\n container.removeEventListener(\"click\", handleClick);\n cancelAnimationFrame(animationFrameId);\n };\n }, [\n population,\n color,\n fireworkSpeed,\n fireworkSize,\n particleSpeed,\n particleSize,\n ]);\n\n return (\n <div\n ref={containerRef}\n className={cn(\"relative size-full overflow-hidden\", className)}\n {...props}\n >\n <canvas\n {...canvasProps}\n ref={canvasRef}\n className={cn(\"absolute inset-0 size-full\", canvasProps?.className)}\n />\n </div>\n );\n },\n);\n\nFireworksBackground.displayName = \"FireworksBackground\";\n\nexport { FireworksBackground, type FireworksBackgroundProps };\n"],"names":["__webpack_require__","definition","key","Object","obj","prop","Symbol","rand","min","max","Math","randInt","randColor","createParticle","x","y","color","speed","direction","gravity","friction","size","vx","vy","alpha","decay","ctx","createFirework","targetY","particleSpeed","particleSize","onExplode","angle","trail","trailLength","numParticles","particles","i","particleAngle","localParticleSpeed","getValueByRange","localParticleSize","point","range","getColor","Array","FireworksBackground","React","className","canvasProps","population","fireworkSpeed","fireworkSize","props","ref","canvasRef","containerRef","canvas","container","maxX","window","ratio","maxY","setCanvasSize","explosions","fireworks","handleExplosion","launchFirework","fireworkColor","timeout","setTimeout","animationFrameId","animate","firework","particle","requestAnimationFrame","handleClick","event","cancelAnimationFrame","cn"],"mappings":";;;;IAAAA,oBAAoB,CAAC,GAAG,CAAC,UAASC;QACjC,IAAI,IAAIC,OAAOD,WACR,IAAGD,oBAAoB,CAAC,CAACC,YAAYC,QAAQ,CAACF,oBAAoB,CAAC,CAAC,UAASE,MACzEC,OAAO,cAAc,CAAC,UAASD,KAAK;YAAE,YAAY;YAAM,KAAKD,UAAU,CAACC,IAAI;QAAC;IAGzF;;;ICNAF,oBAAoB,CAAC,GAAG,CAACI,KAAKC,OAAUF,OAAO,SAAS,CAAC,cAAc,CAAC,IAAI,CAACC,KAAKC;;;ICClFL,oBAAoB,CAAC,GAAG,CAAC;QACxB,IAAG,sBAAOM,UAA0BA,OAAO,WAAW,EACrDH,OAAO,cAAc,CAAC,UAASG,OAAO,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SAASkB;YACvCE,qBAAqBP;QACvB;IACF,GAAG;QACDrB;QACAlC;QACAmC;QACAC;QACAvB;QACAC;KACD;IAED,OACE,WADF,GACE,qCAAC;QACC,KAAK0B;QACL,WAAWuB,IAAAA,0BAAAA,EAAAA,EAAG,sCAAsC/B;QACnD,GAAGK,KAAK;kBAET,mDAAC;YACE,GAAGJ,WAAW;YACf,KAAKM;YACL,WAAWwB,IAAAA,0BAAAA,EAAAA,EAAG,8BAA8B9B,aAAa;;;AAIjE;AAGFH,oBAAoB,WAAW,GAAG"}
|
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
"use strict";
|
|
3
|
-
var __webpack_require__ = {};
|
|
4
|
-
(()=>{
|
|
5
|
-
__webpack_require__.d = (exports1, definition)=>{
|
|
6
|
-
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: definition[key]
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
})();
|
|
12
|
-
(()=>{
|
|
13
|
-
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
14
|
-
})();
|
|
15
|
-
(()=>{
|
|
16
|
-
__webpack_require__.r = (exports1)=>{
|
|
17
|
-
if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
18
|
-
value: 'Module'
|
|
19
|
-
});
|
|
20
|
-
Object.defineProperty(exports1, '__esModule', {
|
|
21
|
-
value: true
|
|
22
|
-
});
|
|
23
|
-
};
|
|
24
|
-
})();
|
|
25
|
-
var __webpack_exports__ = {};
|
|
26
|
-
__webpack_require__.r(__webpack_exports__);
|
|
27
|
-
__webpack_require__.d(__webpack_exports__, {
|
|
28
|
-
FlipButton: ()=>FlipButton
|
|
29
|
-
});
|
|
30
|
-
const jsx_runtime_namespaceObject = require("react/jsx-runtime");
|
|
31
|
-
const external_react_namespaceObject = require("react");
|
|
32
|
-
const react_namespaceObject = require("motion/react");
|
|
33
|
-
const utils_cjs_namespaceObject = require("../../lib/utils.cjs");
|
|
34
|
-
const defaultSpanClassName = "absolute inset-0 flex items-center justify-center rounded-lg";
|
|
35
|
-
const FlipButton = /*#__PURE__*/ external_react_namespaceObject.forwardRef(({ frontText, backText, transition = {
|
|
36
|
-
type: "spring",
|
|
37
|
-
stiffness: 280,
|
|
38
|
-
damping: 20
|
|
39
|
-
}, className, frontClassName, backClassName, from = "top", ...props }, ref)=>{
|
|
40
|
-
const isVertical = "top" === from || "bottom" === from;
|
|
41
|
-
const rotateAxis = isVertical ? "rotateX" : "rotateY";
|
|
42
|
-
const frontOffset = "top" === from || "left" === from ? "50%" : "-50%";
|
|
43
|
-
const backOffset = "top" === from || "left" === from ? "-50%" : "50%";
|
|
44
|
-
const buildVariant = (opacity, rotation, offset = null)=>({
|
|
45
|
-
opacity,
|
|
46
|
-
[rotateAxis]: rotation,
|
|
47
|
-
...isVertical && null !== offset ? {
|
|
48
|
-
y: offset
|
|
49
|
-
} : {},
|
|
50
|
-
...!isVertical && null !== offset ? {
|
|
51
|
-
x: offset
|
|
52
|
-
} : {}
|
|
53
|
-
});
|
|
54
|
-
const frontVariants = {
|
|
55
|
-
initial: buildVariant(1, 0, "0%"),
|
|
56
|
-
hover: buildVariant(0, 90, frontOffset)
|
|
57
|
-
};
|
|
58
|
-
const backVariants = {
|
|
59
|
-
initial: buildVariant(0, 90, backOffset),
|
|
60
|
-
hover: buildVariant(1, 0, "0%")
|
|
61
|
-
};
|
|
62
|
-
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(react_namespaceObject.motion.button, {
|
|
63
|
-
ref: ref,
|
|
64
|
-
initial: "initial",
|
|
65
|
-
whileHover: "hover",
|
|
66
|
-
whileTap: {
|
|
67
|
-
scale: 0.95
|
|
68
|
-
},
|
|
69
|
-
className: (0, utils_cjs_namespaceObject.cn)("relative inline-block h-10 px-4 py-2 text-sm font-medium cursor-pointer perspective-[1000px] focus:outline-none", className),
|
|
70
|
-
...props,
|
|
71
|
-
children: [
|
|
72
|
-
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(react_namespaceObject.motion.span, {
|
|
73
|
-
variants: frontVariants,
|
|
74
|
-
transition: transition,
|
|
75
|
-
className: (0, utils_cjs_namespaceObject.cn)(defaultSpanClassName, "bg-muted text-black dark:text-white", frontClassName),
|
|
76
|
-
children: frontText
|
|
77
|
-
}),
|
|
78
|
-
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(react_namespaceObject.motion.span, {
|
|
79
|
-
variants: backVariants,
|
|
80
|
-
transition: transition,
|
|
81
|
-
className: (0, utils_cjs_namespaceObject.cn)(defaultSpanClassName, "bg-primary text-primary-foreground", backClassName),
|
|
82
|
-
children: backText
|
|
83
|
-
}),
|
|
84
|
-
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("span", {
|
|
85
|
-
className: "invisible",
|
|
86
|
-
children: frontText
|
|
87
|
-
})
|
|
88
|
-
]
|
|
89
|
-
});
|
|
90
|
-
});
|
|
91
|
-
FlipButton.displayName = "FlipButton";
|
|
92
|
-
exports.FlipButton = __webpack_exports__.FlipButton;
|
|
93
|
-
for(var __webpack_i__ in __webpack_exports__)if (-1 === [
|
|
94
|
-
"FlipButton"
|
|
95
|
-
].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
|
|
96
|
-
Object.defineProperty(exports, '__esModule', {
|
|
97
|
-
value: true
|
|
98
|
-
});
|
|
99
|
-
|
|
100
|
-
//# sourceMappingURL=flip-button.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"components\\ui\\flip-button.cjs","sources":["webpack://@arolariu/components/webpack/runtime/define_property_getters","webpack://@arolariu/components/webpack/runtime/has_own_property","webpack://@arolariu/components/webpack/runtime/make_namespace_object","webpack://@arolariu/components/./src/components/ui/flip-button.tsx"],"sourcesContent":["__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n }\n }\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","\n\nimport * as React from \"react\";\nimport {\n type HTMLMotionProps,\n type Transition,\n type Variant,\n motion,\n} from \"motion/react\";\n\nimport { cn } from \"@/lib/utils\";\n\ntype FlipDirection = \"top\" | \"bottom\" | \"left\" | \"righ\";\n\ninterface FlipButtonProps extends HTMLMotionProps<\"button\"> {\n frontText: string;\n backText: string;\n transition?: Transition;\n frontClassName?: string;\n backClassName?: string;\n from?: FlipDirection;\n}\n\nconst defaultSpanClassName =\n \"absolute inset-0 flex items-center justify-center rounded-lg\";\n\nconst FlipButton = React.forwardRef<HTMLButtonElement, FlipButtonProps>(\n (\n {\n frontText,\n backText,\n transition = { type: \"spring\", stiffness: 280, damping: 20 },\n className,\n frontClassName,\n backClassName,\n from = \"top\",\n ...props\n },\n ref,\n ) => {\n const isVertical = from === \"top\" || from === \"bottom\";\n const rotateAxis = isVertical ? \"rotateX\" : \"rotateY\";\n\n const frontOffset = from === \"top\" || from === \"left\" ? \"50%\" : \"-50%\";\n const backOffset = from === \"top\" || from === \"left\" ? \"-50%\" : \"50%\";\n\n const buildVariant = (\n opacity: number,\n rotation: number,\n offset: string | null = null,\n ): Variant => ({\n opacity,\n [rotateAxis]: rotation,\n ...(isVertical && offset !== null ? { y: offset } : {}),\n ...(!isVertical && offset !== null ? { x: offset } : {}),\n });\n\n const frontVariants = {\n initial: buildVariant(1, 0, \"0%\"),\n hover: buildVariant(0, 90, frontOffset),\n };\n\n const backVariants = {\n initial: buildVariant(0, 90, backOffset),\n hover: buildVariant(1, 0, \"0%\"),\n };\n\n return (\n <motion.button\n ref={ref}\n initial=\"initial\"\n whileHover=\"hover\"\n whileTap={{ scale: 0.95 }}\n className={cn(\n \"relative inline-block h-10 px-4 py-2 text-sm font-medium cursor-pointer perspective-[1000px] focus:outline-none\",\n className,\n )}\n {...props}\n >\n <motion.span\n variants={frontVariants}\n transition={transition}\n className={cn(\n defaultSpanClassName,\n \"bg-muted text-black dark:text-white\",\n frontClassName,\n )}\n >\n {frontText}\n </motion.span>\n <motion.span\n variants={backVariants}\n transition={transition}\n className={cn(\n defaultSpanClassName,\n \"bg-primary text-primary-foreground\",\n backClassName,\n )}\n >\n {backText}\n </motion.span>\n <span className=\"invisible\">{frontText}</span>\n </motion.button>\n );\n },\n);\n\nFlipButton.displayName = \"FlipButton\";\n\nexport { FlipButton, type FlipButtonProps, type FlipDirection };\n"],"names":["__webpack_require__","definition","key","Object","obj","prop","Symbol","defaultSpanClassName","FlipButton","React","frontText","backText","transition","className","frontClassName","backClassName","from","props","ref","isVertical","rotateAxis","frontOffset","backOffset","buildVariant","opacity","rotation","offset","frontVariants","backVariants","motion","cn"],"mappings":";;;;IAAAA,oBAAoB,CAAC,GAAG,CAAC,UAASC;QACjC,IAAI,IAAIC,OAAOD,WACR,IAAGD,oBAAoB,CAAC,CAACC,YAAYC,QAAQ,CAACF,oBAAoB,CAAC,CAAC,UAASE,MACzEC,OAAO,cAAc,CAAC,UAASD,KAAK;YAAE,YAAY;YAAM,KAAKD,UAAU,CAACC,IAAI;QAAC;IAGzF;;;ICNAF,oBAAoB,CAAC,GAAG,CAACI,KAAKC,OAAUF,OAAO,SAAS,CAAC,cAAc,CAAC,IAAI,CAACC,KAAKC;;;ICClFL,oBAAoB,CAAC,GAAG,CAAC;QACxB,IAAG,sBAAOM,UAA0BA,OAAO,WAAW,EACrDH,OAAO,cAAc,CAAC,UAASG,OAAO,WAAW,EAAE;YAAE,O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