@appica/ui-react 1.0.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/LICENSE +21 -0
- package/README.md +91 -0
- package/dist/components/accordion/accordion.d.ts +29 -0
- package/dist/components/accordion/accordion.d.ts.map +1 -0
- package/dist/components/accordion/accordion.js +210 -0
- package/dist/components/accordion/accordion.js.map +1 -0
- package/dist/components/alert/alert.d.ts +32 -0
- package/dist/components/alert/alert.d.ts.map +1 -0
- package/dist/components/alert/alert.js +203 -0
- package/dist/components/alert/alert.js.map +1 -0
- package/dist/components/alert-dialog/alert-dialog.d.ts +28 -0
- package/dist/components/alert-dialog/alert-dialog.d.ts.map +1 -0
- package/dist/components/alert-dialog/alert-dialog.js +127 -0
- package/dist/components/alert-dialog/alert-dialog.js.map +1 -0
- package/dist/components/autocomplete/autocomplete.d.ts +48 -0
- package/dist/components/autocomplete/autocomplete.d.ts.map +1 -0
- package/dist/components/autocomplete/autocomplete.js +299 -0
- package/dist/components/autocomplete/autocomplete.js.map +1 -0
- package/dist/components/avatar/avatar.d.ts +29 -0
- package/dist/components/avatar/avatar.d.ts.map +1 -0
- package/dist/components/avatar/avatar.js +115 -0
- package/dist/components/avatar/avatar.js.map +1 -0
- package/dist/components/background-pattern/background-pattern-interactive.d.ts +10 -0
- package/dist/components/background-pattern/background-pattern-interactive.d.ts.map +1 -0
- package/dist/components/background-pattern/background-pattern-interactive.js +72 -0
- package/dist/components/background-pattern/background-pattern-interactive.js.map +1 -0
- package/dist/components/background-pattern/background-pattern-shared.d.ts +12 -0
- package/dist/components/background-pattern/background-pattern-shared.d.ts.map +1 -0
- package/dist/components/background-pattern/background-pattern-shared.js +73 -0
- package/dist/components/background-pattern/background-pattern-shared.js.map +1 -0
- package/dist/components/background-pattern/background-pattern.d.ts +23 -0
- package/dist/components/background-pattern/background-pattern.d.ts.map +1 -0
- package/dist/components/background-pattern/background-pattern.js +49 -0
- package/dist/components/background-pattern/background-pattern.js.map +1 -0
- package/dist/components/background-pattern/index.d.ts +4 -0
- package/dist/components/background-pattern/index.d.ts.map +1 -0
- package/dist/components/background-pattern/index.js +3 -0
- package/dist/components/background-pattern/index.js.map +1 -0
- package/dist/components/badge/badge.d.ts +17 -0
- package/dist/components/badge/badge.d.ts.map +1 -0
- package/dist/components/badge/badge.js +134 -0
- package/dist/components/badge/badge.js.map +1 -0
- package/dist/components/breadcrumb/breadcrumb.d.ts +24 -0
- package/dist/components/breadcrumb/breadcrumb.d.ts.map +1 -0
- package/dist/components/breadcrumb/breadcrumb.js +106 -0
- package/dist/components/breadcrumb/breadcrumb.js.map +1 -0
- package/dist/components/button/button-variants.d.ts +6 -0
- package/dist/components/button/button-variants.d.ts.map +1 -0
- package/dist/components/button/button-variants.js +69 -0
- package/dist/components/button/button-variants.js.map +1 -0
- package/dist/components/button/button.d.ts +10 -0
- package/dist/components/button/button.d.ts.map +1 -0
- package/dist/components/button/button.js +26 -0
- package/dist/components/button/button.js.map +1 -0
- package/dist/components/button/index.d.ts +3 -0
- package/dist/components/button/index.d.ts.map +1 -0
- package/dist/components/button/index.js +3 -0
- package/dist/components/button/index.js.map +1 -0
- package/dist/components/button-group/button-group-context.d.ts +13 -0
- package/dist/components/button-group/button-group-context.d.ts.map +1 -0
- package/dist/components/button-group/button-group-context.js +7 -0
- package/dist/components/button-group/button-group-context.js.map +1 -0
- package/dist/components/button-group/button-group.d.ts +12 -0
- package/dist/components/button-group/button-group.d.ts.map +1 -0
- package/dist/components/button-group/button-group.js +45 -0
- package/dist/components/button-group/button-group.js.map +1 -0
- package/dist/components/calendar/calendar.d.ts +14 -0
- package/dist/components/calendar/calendar.d.ts.map +1 -0
- package/dist/components/calendar/calendar.js +228 -0
- package/dist/components/calendar/calendar.js.map +1 -0
- package/dist/components/carousel/carousel.d.ts +128 -0
- package/dist/components/carousel/carousel.d.ts.map +1 -0
- package/dist/components/carousel/carousel.js +795 -0
- package/dist/components/carousel/carousel.js.map +1 -0
- package/dist/components/checkbox/checkbox.d.ts +7 -0
- package/dist/components/checkbox/checkbox.d.ts.map +1 -0
- package/dist/components/checkbox/checkbox.js +128 -0
- package/dist/components/checkbox/checkbox.js.map +1 -0
- package/dist/components/checkbox-group/checkbox-group.d.ts +9 -0
- package/dist/components/checkbox-group/checkbox-group.d.ts.map +1 -0
- package/dist/components/checkbox-group/checkbox-group.js +18 -0
- package/dist/components/checkbox-group/checkbox-group.js.map +1 -0
- package/dist/components/chip/chip.d.ts +36 -0
- package/dist/components/chip/chip.d.ts.map +1 -0
- package/dist/components/chip/chip.js +159 -0
- package/dist/components/chip/chip.js.map +1 -0
- package/dist/components/collapsible/collapsible.d.ts +11 -0
- package/dist/components/collapsible/collapsible.d.ts.map +1 -0
- package/dist/components/collapsible/collapsible.js +41 -0
- package/dist/components/collapsible/collapsible.js.map +1 -0
- package/dist/components/combobox/combobox.d.ts +57 -0
- package/dist/components/combobox/combobox.d.ts.map +1 -0
- package/dist/components/combobox/combobox.js +456 -0
- package/dist/components/combobox/combobox.js.map +1 -0
- package/dist/components/context-menu/context-menu.d.ts +43 -0
- package/dist/components/context-menu/context-menu.d.ts.map +1 -0
- package/dist/components/context-menu/context-menu.js +243 -0
- package/dist/components/context-menu/context-menu.js.map +1 -0
- package/dist/components/copy-button/copy-button.d.ts +15 -0
- package/dist/components/copy-button/copy-button.d.ts.map +1 -0
- package/dist/components/copy-button/copy-button.js +126 -0
- package/dist/components/copy-button/copy-button.js.map +1 -0
- package/dist/components/countdown/countdown.d.ts +26 -0
- package/dist/components/countdown/countdown.d.ts.map +1 -0
- package/dist/components/countdown/countdown.js +111 -0
- package/dist/components/countdown/countdown.js.map +1 -0
- package/dist/components/date-field/date-field.d.ts +25 -0
- package/dist/components/date-field/date-field.d.ts.map +1 -0
- package/dist/components/date-field/date-field.js +403 -0
- package/dist/components/date-field/date-field.js.map +1 -0
- package/dist/components/date-picker/date-picker.d.ts +58 -0
- package/dist/components/date-picker/date-picker.d.ts.map +1 -0
- package/dist/components/date-picker/date-picker.js +449 -0
- package/dist/components/date-picker/date-picker.js.map +1 -0
- package/dist/components/dialog/dialog.d.ts +30 -0
- package/dist/components/dialog/dialog.d.ts.map +1 -0
- package/dist/components/dialog/dialog.js +138 -0
- package/dist/components/dialog/dialog.js.map +1 -0
- package/dist/components/drawer/drawer.d.ts +39 -0
- package/dist/components/drawer/drawer.d.ts.map +1 -0
- package/dist/components/drawer/drawer.js +270 -0
- package/dist/components/drawer/drawer.js.map +1 -0
- package/dist/components/dropdown-menu/dropdown-menu.d.ts +43 -0
- package/dist/components/dropdown-menu/dropdown-menu.d.ts.map +1 -0
- package/dist/components/dropdown-menu/dropdown-menu.js +235 -0
- package/dist/components/dropdown-menu/dropdown-menu.js.map +1 -0
- package/dist/components/field/field.d.ts +15 -0
- package/dist/components/field/field.d.ts.map +1 -0
- package/dist/components/field/field.js +62 -0
- package/dist/components/field/field.js.map +1 -0
- package/dist/components/fieldset/fieldset.d.ts +9 -0
- package/dist/components/fieldset/fieldset.d.ts.map +1 -0
- package/dist/components/fieldset/fieldset.js +20 -0
- package/dist/components/fieldset/fieldset.js.map +1 -0
- package/dist/components/form/form.d.ts +7 -0
- package/dist/components/form/form.d.ts.map +1 -0
- package/dist/components/form/form.js +9 -0
- package/dist/components/form/form.js.map +1 -0
- package/dist/components/gradient-glow/gradient-glow.d.ts +21 -0
- package/dist/components/gradient-glow/gradient-glow.d.ts.map +1 -0
- package/dist/components/gradient-glow/gradient-glow.js +99 -0
- package/dist/components/gradient-glow/gradient-glow.js.map +1 -0
- package/dist/components/input/index.d.ts +3 -0
- package/dist/components/input/index.d.ts.map +1 -0
- package/dist/components/input/index.js +3 -0
- package/dist/components/input/index.js.map +1 -0
- package/dist/components/input/input-variants.d.ts +7 -0
- package/dist/components/input/input-variants.d.ts.map +1 -0
- package/dist/components/input/input-variants.js +52 -0
- package/dist/components/input/input-variants.js.map +1 -0
- package/dist/components/input/input.d.ts +19 -0
- package/dist/components/input/input.d.ts.map +1 -0
- package/dist/components/input/input.js +96 -0
- package/dist/components/input/input.js.map +1 -0
- package/dist/components/kbd/kbd.d.ts +13 -0
- package/dist/components/kbd/kbd.d.ts.map +1 -0
- package/dist/components/kbd/kbd.js +34 -0
- package/dist/components/kbd/kbd.js.map +1 -0
- package/dist/components/loader/loader.d.ts +10 -0
- package/dist/components/loader/loader.d.ts.map +1 -0
- package/dist/components/loader/loader.js +137 -0
- package/dist/components/loader/loader.js.map +1 -0
- package/dist/components/menubar/menubar.d.ts +44 -0
- package/dist/components/menubar/menubar.d.ts.map +1 -0
- package/dist/components/menubar/menubar.js +114 -0
- package/dist/components/menubar/menubar.js.map +1 -0
- package/dist/components/meter/meter.d.ts +24 -0
- package/dist/components/meter/meter.d.ts.map +1 -0
- package/dist/components/meter/meter.js +105 -0
- package/dist/components/meter/meter.js.map +1 -0
- package/dist/components/navigation/index.d.ts +4 -0
- package/dist/components/navigation/index.d.ts.map +1 -0
- package/dist/components/navigation/index.js +4 -0
- package/dist/components/navigation/index.js.map +1 -0
- package/dist/components/navigation/navigation-context.d.ts +16 -0
- package/dist/components/navigation/navigation-context.d.ts.map +1 -0
- package/dist/components/navigation/navigation-context.js +10 -0
- package/dist/components/navigation/navigation-context.js.map +1 -0
- package/dist/components/navigation/navigation-link-variants.d.ts +9 -0
- package/dist/components/navigation/navigation-link-variants.d.ts.map +1 -0
- package/dist/components/navigation/navigation-link-variants.js +189 -0
- package/dist/components/navigation/navigation-link-variants.js.map +1 -0
- package/dist/components/navigation/navigation-link.d.ts +20 -0
- package/dist/components/navigation/navigation-link.d.ts.map +1 -0
- package/dist/components/navigation/navigation-link.js +54 -0
- package/dist/components/navigation/navigation-link.js.map +1 -0
- package/dist/components/navigation/navigation.d.ts +21 -0
- package/dist/components/navigation/navigation.d.ts.map +1 -0
- package/dist/components/navigation/navigation.js +41 -0
- package/dist/components/navigation/navigation.js.map +1 -0
- package/dist/components/navigation-menu/navigation-menu.d.ts +41 -0
- package/dist/components/navigation-menu/navigation-menu.d.ts.map +1 -0
- package/dist/components/navigation-menu/navigation-menu.js +329 -0
- package/dist/components/navigation-menu/navigation-menu.js.map +1 -0
- package/dist/components/number-field/number-field.d.ts +17 -0
- package/dist/components/number-field/number-field.d.ts.map +1 -0
- package/dist/components/number-field/number-field.js +270 -0
- package/dist/components/number-field/number-field.js.map +1 -0
- package/dist/components/otp-field/otp-field.d.ts +19 -0
- package/dist/components/otp-field/otp-field.d.ts.map +1 -0
- package/dist/components/otp-field/otp-field.js +66 -0
- package/dist/components/otp-field/otp-field.js.map +1 -0
- package/dist/components/pagination/pagination.d.ts +29 -0
- package/dist/components/pagination/pagination.d.ts.map +1 -0
- package/dist/components/pagination/pagination.js +92 -0
- package/dist/components/pagination/pagination.js.map +1 -0
- package/dist/components/popover/popover.d.ts +22 -0
- package/dist/components/popover/popover.d.ts.map +1 -0
- package/dist/components/popover/popover.js +108 -0
- package/dist/components/popover/popover.js.map +1 -0
- package/dist/components/preview-card/preview-card.d.ts +16 -0
- package/dist/components/preview-card/preview-card.d.ts.map +1 -0
- package/dist/components/preview-card/preview-card.js +92 -0
- package/dist/components/preview-card/preview-card.js.map +1 -0
- package/dist/components/progress/progress.d.ts +18 -0
- package/dist/components/progress/progress.d.ts.map +1 -0
- package/dist/components/progress/progress.js +134 -0
- package/dist/components/progress/progress.js.map +1 -0
- package/dist/components/radio/radio.d.ts +7 -0
- package/dist/components/radio/radio.d.ts.map +1 -0
- package/dist/components/radio/radio.js +73 -0
- package/dist/components/radio/radio.js.map +1 -0
- package/dist/components/radio-group/radio-group.d.ts +9 -0
- package/dist/components/radio-group/radio-group.d.ts.map +1 -0
- package/dist/components/radio-group/radio-group.js +19 -0
- package/dist/components/radio-group/radio-group.js.map +1 -0
- package/dist/components/scroll-area/scroll-area.d.ts +14 -0
- package/dist/components/scroll-area/scroll-area.d.ts.map +1 -0
- package/dist/components/scroll-area/scroll-area.js +87 -0
- package/dist/components/scroll-area/scroll-area.js.map +1 -0
- package/dist/components/select/select.d.ts +36 -0
- package/dist/components/select/select.d.ts.map +1 -0
- package/dist/components/select/select.js +345 -0
- package/dist/components/select/select.js.map +1 -0
- package/dist/components/separator/separator.d.ts +10 -0
- package/dist/components/separator/separator.d.ts.map +1 -0
- package/dist/components/separator/separator.js +81 -0
- package/dist/components/separator/separator.js.map +1 -0
- package/dist/components/skeleton/skeleton.d.ts +9 -0
- package/dist/components/skeleton/skeleton.d.ts.map +1 -0
- package/dist/components/skeleton/skeleton.js +27 -0
- package/dist/components/skeleton/skeleton.js.map +1 -0
- package/dist/components/slider/slider.d.ts +11 -0
- package/dist/components/slider/slider.d.ts.map +1 -0
- package/dist/components/slider/slider.js +187 -0
- package/dist/components/slider/slider.js.map +1 -0
- package/dist/components/sparkline/sparkline.d.ts +39 -0
- package/dist/components/sparkline/sparkline.d.ts.map +1 -0
- package/dist/components/sparkline/sparkline.js +356 -0
- package/dist/components/sparkline/sparkline.js.map +1 -0
- package/dist/components/spinner/spinner.d.ts +10 -0
- package/dist/components/spinner/spinner.d.ts.map +1 -0
- package/dist/components/spinner/spinner.js +179 -0
- package/dist/components/spinner/spinner.js.map +1 -0
- package/dist/components/switch/switch.d.ts +33 -0
- package/dist/components/switch/switch.d.ts.map +1 -0
- package/dist/components/switch/switch.js +137 -0
- package/dist/components/switch/switch.js.map +1 -0
- package/dist/components/table/table.d.ts +34 -0
- package/dist/components/table/table.d.ts.map +1 -0
- package/dist/components/table/table.js +108 -0
- package/dist/components/table/table.js.map +1 -0
- package/dist/components/tabs/tabs.d.ts +35 -0
- package/dist/components/tabs/tabs.d.ts.map +1 -0
- package/dist/components/tabs/tabs.js +192 -0
- package/dist/components/tabs/tabs.js.map +1 -0
- package/dist/components/text-animate/text-animate.d.ts +31 -0
- package/dist/components/text-animate/text-animate.d.ts.map +1 -0
- package/dist/components/text-animate/text-animate.js +230 -0
- package/dist/components/text-animate/text-animate.js.map +1 -0
- package/dist/components/textarea/textarea.d.ts +17 -0
- package/dist/components/textarea/textarea.d.ts.map +1 -0
- package/dist/components/textarea/textarea.js +117 -0
- package/dist/components/textarea/textarea.js.map +1 -0
- package/dist/components/thumbnail/thumbnail.d.ts +26 -0
- package/dist/components/thumbnail/thumbnail.d.ts.map +1 -0
- package/dist/components/thumbnail/thumbnail.js +116 -0
- package/dist/components/thumbnail/thumbnail.js.map +1 -0
- package/dist/components/time-field/time-field.d.ts +25 -0
- package/dist/components/time-field/time-field.d.ts.map +1 -0
- package/dist/components/time-field/time-field.js +488 -0
- package/dist/components/time-field/time-field.js.map +1 -0
- package/dist/components/toast/toast.d.ts +59 -0
- package/dist/components/toast/toast.d.ts.map +1 -0
- package/dist/components/toast/toast.js +239 -0
- package/dist/components/toast/toast.js.map +1 -0
- package/dist/components/toc/toc.d.ts +21 -0
- package/dist/components/toc/toc.d.ts.map +1 -0
- package/dist/components/toc/toc.js +185 -0
- package/dist/components/toc/toc.js.map +1 -0
- package/dist/components/toggle/toggle.d.ts +7 -0
- package/dist/components/toggle/toggle.d.ts.map +1 -0
- package/dist/components/toggle/toggle.js +9 -0
- package/dist/components/toggle/toggle.js.map +1 -0
- package/dist/components/toggle-group/toggle-group.d.ts +7 -0
- package/dist/components/toggle-group/toggle-group.d.ts.map +1 -0
- package/dist/components/toggle-group/toggle-group.js +21 -0
- package/dist/components/toggle-group/toggle-group.js.map +1 -0
- package/dist/components/toolbar/toolbar.d.ts +23 -0
- package/dist/components/toolbar/toolbar.d.ts.map +1 -0
- package/dist/components/toolbar/toolbar.js +56 -0
- package/dist/components/toolbar/toolbar.js.map +1 -0
- package/dist/components/tooltip/tooltip.d.ts +16 -0
- package/dist/components/tooltip/tooltip.d.ts.map +1 -0
- package/dist/components/tooltip/tooltip.js +64 -0
- package/dist/components/tooltip/tooltip.js.map +1 -0
- package/dist/floating.d.ts +47 -0
- package/dist/floating.d.ts.map +1 -0
- package/dist/floating.js +35 -0
- package/dist/floating.js.map +1 -0
- package/dist/hooks/use-direction.d.ts +2 -0
- package/dist/hooks/use-direction.d.ts.map +1 -0
- package/dist/hooks/use-direction.js +3 -0
- package/dist/hooks/use-direction.js.map +1 -0
- package/dist/hooks/use-dismissible.d.ts +16 -0
- package/dist/hooks/use-dismissible.d.ts.map +1 -0
- package/dist/hooks/use-dismissible.js +17 -0
- package/dist/hooks/use-dismissible.js.map +1 -0
- package/dist/hooks/use-local-storage.d.ts +24 -0
- package/dist/hooks/use-local-storage.d.ts.map +1 -0
- package/dist/hooks/use-local-storage.js +127 -0
- package/dist/hooks/use-local-storage.js.map +1 -0
- package/dist/hooks/use-media-query.d.ts +20 -0
- package/dist/hooks/use-media-query.d.ts.map +1 -0
- package/dist/hooks/use-media-query.js +19 -0
- package/dist/hooks/use-media-query.js.map +1 -0
- package/dist/hooks/use-reduced-motion.d.ts +7 -0
- package/dist/hooks/use-reduced-motion.d.ts.map +1 -0
- package/dist/hooks/use-reduced-motion.js +13 -0
- package/dist/hooks/use-reduced-motion.js.map +1 -0
- package/dist/hooks/use-theme.d.ts +11 -0
- package/dist/hooks/use-theme.d.ts.map +1 -0
- package/dist/hooks/use-theme.js +9 -0
- package/dist/hooks/use-theme.js.map +1 -0
- package/dist/index.d.ts +74 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +80 -0
- package/dist/index.js.map +1 -0
- package/dist/modal.d.ts +42 -0
- package/dist/modal.d.ts.map +1 -0
- package/dist/modal.js +18 -0
- package/dist/modal.js.map +1 -0
- package/dist/providers/direction-provider.d.ts +21 -0
- package/dist/providers/direction-provider.d.ts.map +1 -0
- package/dist/providers/direction-provider.js +9 -0
- package/dist/providers/direction-provider.js.map +1 -0
- package/dist/providers/reduced-motion-provider.d.ts +30 -0
- package/dist/providers/reduced-motion-provider.d.ts.map +1 -0
- package/dist/providers/reduced-motion-provider.js +27 -0
- package/dist/providers/reduced-motion-provider.js.map +1 -0
- package/dist/providers/theme-provider/index.d.ts +5 -0
- package/dist/providers/theme-provider/index.d.ts.map +1 -0
- package/dist/providers/theme-provider/index.js +3 -0
- package/dist/providers/theme-provider/index.js.map +1 -0
- package/dist/providers/theme-provider/theme-provider.d.ts +39 -0
- package/dist/providers/theme-provider/theme-provider.d.ts.map +1 -0
- package/dist/providers/theme-provider/theme-provider.js +118 -0
- package/dist/providers/theme-provider/theme-provider.js.map +1 -0
- package/dist/providers/theme-provider/theme-script.d.ts +28 -0
- package/dist/providers/theme-provider/theme-script.d.ts.map +1 -0
- package/dist/providers/theme-provider/theme-script.js +59 -0
- package/dist/providers/theme-provider/theme-script.js.map +1 -0
- package/dist/utils.d.ts +17 -0
- package/dist/utils.d.ts.map +1 -0
- package/dist/utils.js +51 -0
- package/dist/utils.js.map +1 -0
- package/package.json +479 -0
- package/src/components/accordion/accordion.test.tsx +220 -0
- package/src/components/accordion/accordion.tsx +269 -0
- package/src/components/alert/alert.test.tsx +188 -0
- package/src/components/alert/alert.tsx +243 -0
- package/src/components/alert-dialog/alert-dialog.test.tsx +141 -0
- package/src/components/alert-dialog/alert-dialog.tsx +179 -0
- package/src/components/autocomplete/autocomplete.test.tsx +384 -0
- package/src/components/autocomplete/autocomplete.tsx +442 -0
- package/src/components/avatar/avatar.test.tsx +368 -0
- package/src/components/avatar/avatar.tsx +142 -0
- package/src/components/background-pattern/background-pattern-interactive.tsx +93 -0
- package/src/components/background-pattern/background-pattern-shared.tsx +96 -0
- package/src/components/background-pattern/background-pattern.test.tsx +97 -0
- package/src/components/background-pattern/background-pattern.tsx +67 -0
- package/src/components/background-pattern/index.ts +3 -0
- package/src/components/badge/badge.test.tsx +58 -0
- package/src/components/badge/badge.tsx +149 -0
- package/src/components/breadcrumb/breadcrumb.test.tsx +174 -0
- package/src/components/breadcrumb/breadcrumb.tsx +146 -0
- package/src/components/button/button-variants.ts +69 -0
- package/src/components/button/button.test.tsx +79 -0
- package/src/components/button/button.tsx +28 -0
- package/src/components/button/index.ts +2 -0
- package/src/components/button-group/button-group-context.ts +18 -0
- package/src/components/button-group/button-group.test.tsx +223 -0
- package/src/components/button-group/button-group.tsx +59 -0
- package/src/components/calendar/calendar.test.tsx +69 -0
- package/src/components/calendar/calendar.tsx +295 -0
- package/src/components/carousel/carousel.test.tsx +493 -0
- package/src/components/carousel/carousel.tsx +1003 -0
- package/src/components/checkbox/checkbox.test.tsx +100 -0
- package/src/components/checkbox/checkbox.tsx +154 -0
- package/src/components/checkbox-group/checkbox-group.test.tsx +86 -0
- package/src/components/checkbox-group/checkbox-group.tsx +21 -0
- package/src/components/chip/chip.test.tsx +242 -0
- package/src/components/chip/chip.tsx +234 -0
- package/src/components/collapsible/collapsible.test.tsx +126 -0
- package/src/components/collapsible/collapsible.tsx +47 -0
- package/src/components/combobox/combobox.test.tsx +410 -0
- package/src/components/combobox/combobox.tsx +598 -0
- package/src/components/context-menu/context-menu.test.tsx +226 -0
- package/src/components/context-menu/context-menu.tsx +345 -0
- package/src/components/copy-button/copy-button.test.tsx +147 -0
- package/src/components/copy-button/copy-button.tsx +141 -0
- package/src/components/countdown/countdown.test.tsx +130 -0
- package/src/components/countdown/countdown.tsx +170 -0
- package/src/components/date-field/date-field.test.tsx +373 -0
- package/src/components/date-field/date-field.tsx +512 -0
- package/src/components/date-picker/date-picker.test.tsx +291 -0
- package/src/components/date-picker/date-picker.tsx +572 -0
- package/src/components/dialog/dialog.test.tsx +173 -0
- package/src/components/dialog/dialog.tsx +190 -0
- package/src/components/drawer/drawer.test.tsx +191 -0
- package/src/components/drawer/drawer.tsx +365 -0
- package/src/components/dropdown-menu/dropdown-menu.test.tsx +227 -0
- package/src/components/dropdown-menu/dropdown-menu.tsx +341 -0
- package/src/components/field/field.test.tsx +84 -0
- package/src/components/field/field.tsx +71 -0
- package/src/components/fieldset/fieldset.test.tsx +62 -0
- package/src/components/fieldset/fieldset.tsx +24 -0
- package/src/components/form/form.test.tsx +61 -0
- package/src/components/form/form.tsx +11 -0
- package/src/components/gradient-glow/gradient-glow.test.tsx +110 -0
- package/src/components/gradient-glow/gradient-glow.tsx +132 -0
- package/src/components/input/index.ts +2 -0
- package/src/components/input/input-variants.ts +52 -0
- package/src/components/input/input.test.tsx +118 -0
- package/src/components/input/input.tsx +120 -0
- package/src/components/kbd/kbd.test.tsx +119 -0
- package/src/components/kbd/kbd.tsx +48 -0
- package/src/components/loader/loader.test.tsx +57 -0
- package/src/components/loader/loader.tsx +163 -0
- package/src/components/menubar/menubar.test.tsx +162 -0
- package/src/components/menubar/menubar.tsx +226 -0
- package/src/components/meter/meter.test.tsx +172 -0
- package/src/components/meter/meter.tsx +144 -0
- package/src/components/navigation/index.ts +3 -0
- package/src/components/navigation/navigation-context.ts +24 -0
- package/src/components/navigation/navigation-link-variants.ts +197 -0
- package/src/components/navigation/navigation-link.tsx +90 -0
- package/src/components/navigation/navigation.test.tsx +253 -0
- package/src/components/navigation/navigation.tsx +74 -0
- package/src/components/navigation-menu/navigation-menu.test.tsx +258 -0
- package/src/components/navigation-menu/navigation-menu.tsx +410 -0
- package/src/components/number-field/number-field.test.tsx +224 -0
- package/src/components/number-field/number-field.tsx +310 -0
- package/src/components/otp-field/otp-field.test.tsx +113 -0
- package/src/components/otp-field/otp-field.tsx +105 -0
- package/src/components/pagination/pagination.test.tsx +147 -0
- package/src/components/pagination/pagination.tsx +139 -0
- package/src/components/popover/popover.test.tsx +135 -0
- package/src/components/popover/popover.tsx +134 -0
- package/src/components/preview-card/preview-card.test.tsx +99 -0
- package/src/components/preview-card/preview-card.tsx +103 -0
- package/src/components/progress/progress.test.tsx +109 -0
- package/src/components/progress/progress.tsx +151 -0
- package/src/components/radio/radio.test.tsx +141 -0
- package/src/components/radio/radio.tsx +94 -0
- package/src/components/radio-group/radio-group.test.tsx +80 -0
- package/src/components/radio-group/radio-group.tsx +22 -0
- package/src/components/scroll-area/scroll-area.test.tsx +133 -0
- package/src/components/scroll-area/scroll-area.tsx +101 -0
- package/src/components/select/select.test.tsx +251 -0
- package/src/components/select/select.tsx +446 -0
- package/src/components/separator/separator.test.tsx +46 -0
- package/src/components/separator/separator.tsx +95 -0
- package/src/components/skeleton/skeleton.test.tsx +55 -0
- package/src/components/skeleton/skeleton.tsx +33 -0
- package/src/components/slider/slider.test.tsx +123 -0
- package/src/components/slider/slider.tsx +262 -0
- package/src/components/sparkline/sparkline.test.tsx +249 -0
- package/src/components/sparkline/sparkline.tsx +446 -0
- package/src/components/spinner/spinner.test.tsx +57 -0
- package/src/components/spinner/spinner.tsx +219 -0
- package/src/components/switch/switch.test.tsx +100 -0
- package/src/components/switch/switch.tsx +166 -0
- package/src/components/table/table.test.tsx +175 -0
- package/src/components/table/table.tsx +157 -0
- package/src/components/tabs/tabs.test.tsx +165 -0
- package/src/components/tabs/tabs.tsx +246 -0
- package/src/components/text-animate/text-animate.test.tsx +125 -0
- package/src/components/text-animate/text-animate.tsx +354 -0
- package/src/components/textarea/textarea.test.tsx +188 -0
- package/src/components/textarea/textarea.tsx +144 -0
- package/src/components/thumbnail/thumbnail.test.tsx +217 -0
- package/src/components/thumbnail/thumbnail.tsx +139 -0
- package/src/components/time-field/time-field.test.tsx +376 -0
- package/src/components/time-field/time-field.tsx +625 -0
- package/src/components/toast/toast.test.tsx +277 -0
- package/src/components/toast/toast.tsx +377 -0
- package/src/components/toc/toc.test.tsx +197 -0
- package/src/components/toc/toc.tsx +233 -0
- package/src/components/toggle/toggle.test.tsx +109 -0
- package/src/components/toggle/toggle.tsx +10 -0
- package/src/components/toggle-group/toggle-group.test.tsx +95 -0
- package/src/components/toggle-group/toggle-group.tsx +21 -0
- package/src/components/toolbar/toolbar.test.tsx +78 -0
- package/src/components/toolbar/toolbar.tsx +77 -0
- package/src/components/tooltip/tooltip.test.tsx +100 -0
- package/src/components/tooltip/tooltip.tsx +78 -0
- package/src/floating.test.ts +40 -0
- package/src/floating.ts +103 -0
- package/src/globals.d.ts +34 -0
- package/src/hooks/use-direction.ts +3 -0
- package/src/hooks/use-dismissible.ts +33 -0
- package/src/hooks/use-local-storage.test.tsx +63 -0
- package/src/hooks/use-local-storage.ts +190 -0
- package/src/hooks/use-media-query.test.tsx +65 -0
- package/src/hooks/use-media-query.ts +38 -0
- package/src/hooks/use-reduced-motion.ts +17 -0
- package/src/hooks/use-theme.ts +16 -0
- package/src/index.ts +76 -0
- package/src/modal.test.ts +34 -0
- package/src/modal.ts +80 -0
- package/src/providers/direction-provider.test.tsx +20 -0
- package/src/providers/direction-provider.tsx +26 -0
- package/src/providers/reduced-motion-provider.test.tsx +42 -0
- package/src/providers/reduced-motion-provider.tsx +58 -0
- package/src/providers/theme-provider/index.ts +4 -0
- package/src/providers/theme-provider/theme-provider.test.tsx +97 -0
- package/src/providers/theme-provider/theme-provider.tsx +169 -0
- package/src/providers/theme-provider/theme-script.tsx +108 -0
- package/src/test/setup.ts +27 -0
- package/src/test/vitest-axe.d.ts +7 -0
- package/src/utils.test.tsx +63 -0
- package/src/utils.ts +57 -0
- package/styles.css +523 -0
|
@@ -0,0 +1,795 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import useEmblaCarousel from 'embla-carousel-react';
|
|
5
|
+
import { mergeProps } from '@base-ui/react/merge-props';
|
|
6
|
+
import { useRender } from '@base-ui/react/use-render';
|
|
7
|
+
import Accessibility from 'embla-carousel-accessibility';
|
|
8
|
+
import Autoplay from 'embla-carousel-autoplay';
|
|
9
|
+
import AutoScroll from 'embla-carousel-auto-scroll';
|
|
10
|
+
import AutoHeight from 'embla-carousel-auto-height';
|
|
11
|
+
import ClassNames from 'embla-carousel-class-names';
|
|
12
|
+
import Fade from 'embla-carousel-fade';
|
|
13
|
+
import { WheelGesturesPlugin } from 'embla-carousel-wheel-gestures';
|
|
14
|
+
import { cn } from '../../utils.js';
|
|
15
|
+
import { useReducedMotion } from '../../hooks/use-reduced-motion.js';
|
|
16
|
+
import { useDirection } from '@base-ui/react/direction-provider';
|
|
17
|
+
|
|
18
|
+
const CarouselContext = React.createContext(null);
|
|
19
|
+
function useCarousel() {
|
|
20
|
+
const ctx = React.useContext(CarouselContext);
|
|
21
|
+
if (!ctx) {
|
|
22
|
+
throw new Error("Carousel sub-components must be rendered inside <Carousel>");
|
|
23
|
+
}
|
|
24
|
+
return ctx;
|
|
25
|
+
}
|
|
26
|
+
function Carousel({
|
|
27
|
+
orientation = "horizontal",
|
|
28
|
+
loop = false,
|
|
29
|
+
align = "start",
|
|
30
|
+
slidesToScroll = 1,
|
|
31
|
+
containScroll = "trimSnaps",
|
|
32
|
+
dragFree,
|
|
33
|
+
startSnap,
|
|
34
|
+
active = true,
|
|
35
|
+
draggable,
|
|
36
|
+
duration,
|
|
37
|
+
options,
|
|
38
|
+
autoplay,
|
|
39
|
+
autoScroll,
|
|
40
|
+
autoHeight,
|
|
41
|
+
fade,
|
|
42
|
+
classNames,
|
|
43
|
+
accessibility = true,
|
|
44
|
+
wheelGestures = false,
|
|
45
|
+
plugins: userPlugins,
|
|
46
|
+
setApi,
|
|
47
|
+
onReInit,
|
|
48
|
+
onSelect,
|
|
49
|
+
onScroll,
|
|
50
|
+
light = false,
|
|
51
|
+
className,
|
|
52
|
+
children,
|
|
53
|
+
...rest
|
|
54
|
+
}) {
|
|
55
|
+
const direction = useDirection();
|
|
56
|
+
const reducedMotion = useReducedMotion();
|
|
57
|
+
const autoplayEnabled = !!autoplay;
|
|
58
|
+
const autoScrollEnabled = !!autoScroll;
|
|
59
|
+
const warnedMutualExclusive = React.useRef(false);
|
|
60
|
+
React.useEffect(() => {
|
|
61
|
+
if (process.env.NODE_ENV !== "production" && autoplayEnabled && autoScrollEnabled && !warnedMutualExclusive.current) {
|
|
62
|
+
warnedMutualExclusive.current = true;
|
|
63
|
+
console.warn("[Carousel] `autoplay` and `autoScroll` are mutually exclusive \u2014 preferring `autoplay`.");
|
|
64
|
+
}
|
|
65
|
+
}, [autoplayEnabled, autoScrollEnabled]);
|
|
66
|
+
const resumeAfterMs = typeof autoplay === "object" && typeof autoplay.resumeAfter === "number" && autoplay.resumeAfter || typeof autoScroll === "object" && typeof autoScroll.resumeAfter === "number" && autoScroll.resumeAfter || 0;
|
|
67
|
+
const plugins = React.useMemo(() => {
|
|
68
|
+
const list = [];
|
|
69
|
+
if (accessibility !== false) {
|
|
70
|
+
list.push(Accessibility(typeof accessibility === "object" ? accessibility : void 0));
|
|
71
|
+
}
|
|
72
|
+
if (wheelGestures !== false) {
|
|
73
|
+
list.push(WheelGesturesPlugin(typeof wheelGestures === "object" ? wheelGestures : void 0));
|
|
74
|
+
}
|
|
75
|
+
if (autoplay) {
|
|
76
|
+
const opts = typeof autoplay === "object" ? autoplay : void 0;
|
|
77
|
+
const { resumeAfter, ...emblaOpts } = opts ?? {};
|
|
78
|
+
const autoResume = typeof resumeAfter === "number" && resumeAfter > 0;
|
|
79
|
+
list.push(Autoplay(autoResume ? { ...emblaOpts, defaultInteraction: false } : emblaOpts));
|
|
80
|
+
} else if (autoScroll && !reducedMotion) {
|
|
81
|
+
const opts = typeof autoScroll === "object" ? autoScroll : void 0;
|
|
82
|
+
const { resumeAfter, ...emblaOpts } = opts ?? {};
|
|
83
|
+
const autoResume = typeof resumeAfter === "number" && resumeAfter > 0;
|
|
84
|
+
list.push(AutoScroll(autoResume ? { ...emblaOpts, defaultInteraction: false } : emblaOpts));
|
|
85
|
+
}
|
|
86
|
+
if (autoHeight) {
|
|
87
|
+
list.push(AutoHeight(typeof autoHeight === "object" ? autoHeight : void 0));
|
|
88
|
+
}
|
|
89
|
+
if (fade) {
|
|
90
|
+
list.push(Fade(typeof fade === "object" ? fade : void 0));
|
|
91
|
+
}
|
|
92
|
+
if (classNames) {
|
|
93
|
+
list.push(ClassNames(typeof classNames === "object" ? classNames : void 0));
|
|
94
|
+
}
|
|
95
|
+
if (userPlugins) list.push(...userPlugins);
|
|
96
|
+
return list;
|
|
97
|
+
}, [accessibility, wheelGestures, autoplay, autoScroll, autoHeight, fade, classNames, userPlugins, reducedMotion]);
|
|
98
|
+
const emblaOptions = React.useMemo(() => {
|
|
99
|
+
const merged = {
|
|
100
|
+
axis: orientation === "vertical" ? "y" : "x",
|
|
101
|
+
loop,
|
|
102
|
+
align,
|
|
103
|
+
slidesToScroll,
|
|
104
|
+
containScroll,
|
|
105
|
+
active
|
|
106
|
+
};
|
|
107
|
+
if (dragFree !== void 0) merged.dragFree = dragFree;
|
|
108
|
+
if (startSnap !== void 0) merged.startSnap = startSnap;
|
|
109
|
+
if (duration !== void 0) merged.duration = duration;
|
|
110
|
+
if (draggable !== void 0) merged.draggable = draggable;
|
|
111
|
+
if (orientation === "horizontal") merged.direction = direction;
|
|
112
|
+
if (reducedMotion) merged.duration = 0;
|
|
113
|
+
return { ...merged, ...options };
|
|
114
|
+
}, [
|
|
115
|
+
orientation,
|
|
116
|
+
direction,
|
|
117
|
+
loop,
|
|
118
|
+
align,
|
|
119
|
+
slidesToScroll,
|
|
120
|
+
containScroll,
|
|
121
|
+
dragFree,
|
|
122
|
+
startSnap,
|
|
123
|
+
active,
|
|
124
|
+
draggable,
|
|
125
|
+
duration,
|
|
126
|
+
options,
|
|
127
|
+
reducedMotion
|
|
128
|
+
]);
|
|
129
|
+
const [viewportRef, emblaApi] = useEmblaCarousel(emblaOptions, plugins);
|
|
130
|
+
const setApiRef = React.useRef(setApi);
|
|
131
|
+
const onReInitRef = React.useRef(onReInit);
|
|
132
|
+
const onSelectRef = React.useRef(onSelect);
|
|
133
|
+
const onScrollRef = React.useRef(onScroll);
|
|
134
|
+
React.useEffect(() => {
|
|
135
|
+
setApiRef.current = setApi;
|
|
136
|
+
});
|
|
137
|
+
React.useEffect(() => {
|
|
138
|
+
onReInitRef.current = onReInit;
|
|
139
|
+
});
|
|
140
|
+
React.useEffect(() => {
|
|
141
|
+
onSelectRef.current = onSelect;
|
|
142
|
+
});
|
|
143
|
+
React.useEffect(() => {
|
|
144
|
+
onScrollRef.current = onScroll;
|
|
145
|
+
});
|
|
146
|
+
React.useEffect(() => {
|
|
147
|
+
if (!emblaApi || !reducedMotion) return;
|
|
148
|
+
const snapToTargetInstantly = () => {
|
|
149
|
+
emblaApi.internalEngine().scrollBody.useDuration(0);
|
|
150
|
+
};
|
|
151
|
+
emblaApi.on("pointerup", snapToTargetInstantly);
|
|
152
|
+
return () => {
|
|
153
|
+
emblaApi.off("pointerup", snapToTargetInstantly);
|
|
154
|
+
};
|
|
155
|
+
}, [emblaApi, reducedMotion]);
|
|
156
|
+
const [state, setState] = React.useState({
|
|
157
|
+
selectedIndex: 0,
|
|
158
|
+
scrollSnaps: [],
|
|
159
|
+
canScrollPrev: false,
|
|
160
|
+
canScrollNext: false
|
|
161
|
+
});
|
|
162
|
+
const [autoplayState, setAutoplayState] = React.useState(null);
|
|
163
|
+
const scrollProgressRef = React.useRef(0);
|
|
164
|
+
const scrollListenersRef = React.useRef(/* @__PURE__ */ new Set());
|
|
165
|
+
const subscribeScrollProgress = React.useCallback((onChange) => {
|
|
166
|
+
scrollListenersRef.current.add(onChange);
|
|
167
|
+
return () => {
|
|
168
|
+
scrollListenersRef.current.delete(onChange);
|
|
169
|
+
};
|
|
170
|
+
}, []);
|
|
171
|
+
const getScrollProgress = React.useCallback(() => scrollProgressRef.current, []);
|
|
172
|
+
React.useEffect(() => {
|
|
173
|
+
if (!emblaApi) return;
|
|
174
|
+
const notifyScroll = () => {
|
|
175
|
+
scrollProgressRef.current = emblaApi.scrollProgress();
|
|
176
|
+
scrollListenersRef.current.forEach((cb) => cb());
|
|
177
|
+
};
|
|
178
|
+
const syncFull = () => {
|
|
179
|
+
notifyScroll();
|
|
180
|
+
setState({
|
|
181
|
+
selectedIndex: emblaApi.selectedSnap(),
|
|
182
|
+
scrollSnaps: emblaApi.snapList(),
|
|
183
|
+
canScrollPrev: emblaApi.canGoToPrev(),
|
|
184
|
+
canScrollNext: emblaApi.canGoToNext()
|
|
185
|
+
});
|
|
186
|
+
};
|
|
187
|
+
const syncSelection = () => {
|
|
188
|
+
setState((s) => ({
|
|
189
|
+
...s,
|
|
190
|
+
selectedIndex: emblaApi.selectedSnap(),
|
|
191
|
+
canScrollPrev: emblaApi.canGoToPrev(),
|
|
192
|
+
canScrollNext: emblaApi.canGoToNext()
|
|
193
|
+
}));
|
|
194
|
+
};
|
|
195
|
+
const syncScroll = () => {
|
|
196
|
+
notifyScroll();
|
|
197
|
+
};
|
|
198
|
+
const syncInView = () => {
|
|
199
|
+
};
|
|
200
|
+
syncFull();
|
|
201
|
+
setApiRef.current?.(emblaApi);
|
|
202
|
+
onReInitRef.current?.(emblaApi);
|
|
203
|
+
const handleReInit = () => {
|
|
204
|
+
const autoplayWasPlaying = emblaApi.plugins().autoplay?.isPlaying();
|
|
205
|
+
const autoScrollWasPlaying = emblaApi.plugins().autoScroll?.isPlaying();
|
|
206
|
+
syncFull();
|
|
207
|
+
onReInitRef.current?.(emblaApi);
|
|
208
|
+
if (autoplayEnabled && autoplayWasPlaying) emblaApi.plugins().autoplay?.play();
|
|
209
|
+
else if (autoScrollEnabled && autoScrollWasPlaying) emblaApi.plugins().autoScroll?.play();
|
|
210
|
+
};
|
|
211
|
+
const handleSelect = () => {
|
|
212
|
+
syncSelection();
|
|
213
|
+
onSelectRef.current?.(emblaApi);
|
|
214
|
+
};
|
|
215
|
+
const handleScroll = () => {
|
|
216
|
+
syncScroll();
|
|
217
|
+
onScrollRef.current?.(emblaApi);
|
|
218
|
+
};
|
|
219
|
+
emblaApi.on("reinit", handleReInit);
|
|
220
|
+
emblaApi.on("select", handleSelect);
|
|
221
|
+
emblaApi.on("scroll", handleScroll);
|
|
222
|
+
emblaApi.on("slidesinview", syncInView);
|
|
223
|
+
emblaApi.on("slideschanged", syncFull);
|
|
224
|
+
const autoplayPlugin = emblaApi.plugins().autoplay;
|
|
225
|
+
const autoScrollPlugin = emblaApi.plugins().autoScroll;
|
|
226
|
+
const resumeAfter = resumeAfterMs;
|
|
227
|
+
let resumeTimer;
|
|
228
|
+
const clearResumeTimer = () => {
|
|
229
|
+
if (resumeTimer !== void 0) {
|
|
230
|
+
clearTimeout(resumeTimer);
|
|
231
|
+
resumeTimer = void 0;
|
|
232
|
+
}
|
|
233
|
+
};
|
|
234
|
+
const scheduleResume = (play) => {
|
|
235
|
+
if (resumeAfter <= 0) return;
|
|
236
|
+
clearResumeTimer();
|
|
237
|
+
resumeTimer = setTimeout(() => {
|
|
238
|
+
resumeTimer = void 0;
|
|
239
|
+
play();
|
|
240
|
+
}, resumeAfter);
|
|
241
|
+
};
|
|
242
|
+
let cleanupAutoplay;
|
|
243
|
+
if (autoplayPlugin) {
|
|
244
|
+
const rawDelay = autoplayPlugin.options.delay;
|
|
245
|
+
const initialDelay = typeof rawDelay === "number" ? rawDelay : 4e3;
|
|
246
|
+
setAutoplayState({
|
|
247
|
+
delay: initialDelay,
|
|
248
|
+
cycleId: 0,
|
|
249
|
+
isPlaying: autoplayPlugin.isPlaying()
|
|
250
|
+
});
|
|
251
|
+
const onPlay = () => {
|
|
252
|
+
clearResumeTimer();
|
|
253
|
+
setAutoplayState((s) => s ? { ...s, isPlaying: true } : s);
|
|
254
|
+
};
|
|
255
|
+
const onStop = () => setAutoplayState((s) => s ? { ...s, isPlaying: false } : s);
|
|
256
|
+
const onTimerSet = () => setAutoplayState((s) => s ? { ...s, cycleId: s.cycleId + 1, isPlaying: true } : s);
|
|
257
|
+
const onTimerStopped = () => setAutoplayState((s) => s ? { ...s, isPlaying: false } : s);
|
|
258
|
+
const resetOnSelect = () => autoplayPlugin.reset();
|
|
259
|
+
const onInteraction = (_api, event) => {
|
|
260
|
+
if (event.detail.interaction === "pointerdown" || event.detail.interaction === "slidefocus") {
|
|
261
|
+
autoplayPlugin.stop();
|
|
262
|
+
scheduleResume(() => emblaApi.plugins().autoplay?.play());
|
|
263
|
+
}
|
|
264
|
+
};
|
|
265
|
+
emblaApi.on("autoplay:play", onPlay);
|
|
266
|
+
emblaApi.on("autoplay:stop", onStop);
|
|
267
|
+
emblaApi.on("autoplay:timerset", onTimerSet);
|
|
268
|
+
emblaApi.on("autoplay:timerstopped", onTimerStopped);
|
|
269
|
+
emblaApi.on("select", resetOnSelect);
|
|
270
|
+
if (resumeAfter > 0) emblaApi.on("autoplay:interaction", onInteraction);
|
|
271
|
+
if (autoplayEnabled) autoplayPlugin.play();
|
|
272
|
+
cleanupAutoplay = () => {
|
|
273
|
+
emblaApi.off("autoplay:play", onPlay);
|
|
274
|
+
emblaApi.off("autoplay:stop", onStop);
|
|
275
|
+
emblaApi.off("autoplay:timerset", onTimerSet);
|
|
276
|
+
emblaApi.off("autoplay:timerstopped", onTimerStopped);
|
|
277
|
+
emblaApi.off("select", resetOnSelect);
|
|
278
|
+
if (resumeAfter > 0) emblaApi.off("autoplay:interaction", onInteraction);
|
|
279
|
+
};
|
|
280
|
+
} else {
|
|
281
|
+
setAutoplayState(null);
|
|
282
|
+
}
|
|
283
|
+
let cleanupAutoScroll;
|
|
284
|
+
if (autoScrollPlugin && autoScrollEnabled && !autoplayEnabled) {
|
|
285
|
+
autoScrollPlugin.play();
|
|
286
|
+
const onInteraction = (_api, event) => {
|
|
287
|
+
if (event.detail.interaction === "pointerdown" || event.detail.interaction === "slidefocus") {
|
|
288
|
+
autoScrollPlugin.stop();
|
|
289
|
+
scheduleResume(() => emblaApi.plugins().autoScroll?.play());
|
|
290
|
+
}
|
|
291
|
+
};
|
|
292
|
+
if (resumeAfter > 0) {
|
|
293
|
+
emblaApi.on("autoscroll:interaction", onInteraction);
|
|
294
|
+
cleanupAutoScroll = () => emblaApi.off("autoscroll:interaction", onInteraction);
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
return () => {
|
|
298
|
+
emblaApi.off("reinit", handleReInit);
|
|
299
|
+
emblaApi.off("select", handleSelect);
|
|
300
|
+
emblaApi.off("scroll", handleScroll);
|
|
301
|
+
emblaApi.off("slidesinview", syncInView);
|
|
302
|
+
emblaApi.off("slideschanged", syncFull);
|
|
303
|
+
cleanupAutoplay?.();
|
|
304
|
+
cleanupAutoScroll?.();
|
|
305
|
+
clearResumeTimer();
|
|
306
|
+
};
|
|
307
|
+
}, [emblaApi, autoplayEnabled, autoScrollEnabled, resumeAfterMs]);
|
|
308
|
+
const scrollPrev = React.useCallback(() => emblaApi?.goToPrev(), [emblaApi]);
|
|
309
|
+
const scrollNext = React.useCallback(() => emblaApi?.goToNext(), [emblaApi]);
|
|
310
|
+
const scrollTo = React.useCallback((i) => emblaApi?.goTo(i), [emblaApi]);
|
|
311
|
+
const isAutoHeight = !!autoHeight;
|
|
312
|
+
const contextValue = React.useMemo(
|
|
313
|
+
() => ({
|
|
314
|
+
api: emblaApi,
|
|
315
|
+
viewportRef,
|
|
316
|
+
orientation,
|
|
317
|
+
direction,
|
|
318
|
+
light,
|
|
319
|
+
autoHeight: isAutoHeight,
|
|
320
|
+
loop,
|
|
321
|
+
reducedMotion,
|
|
322
|
+
selectedIndex: state.selectedIndex,
|
|
323
|
+
scrollSnaps: state.scrollSnaps,
|
|
324
|
+
canScrollPrev: state.canScrollPrev,
|
|
325
|
+
canScrollNext: state.canScrollNext,
|
|
326
|
+
subscribeScrollProgress,
|
|
327
|
+
getScrollProgress,
|
|
328
|
+
autoplay: autoplayState,
|
|
329
|
+
scrollPrev,
|
|
330
|
+
scrollNext,
|
|
331
|
+
scrollTo
|
|
332
|
+
}),
|
|
333
|
+
[
|
|
334
|
+
emblaApi,
|
|
335
|
+
viewportRef,
|
|
336
|
+
orientation,
|
|
337
|
+
direction,
|
|
338
|
+
light,
|
|
339
|
+
isAutoHeight,
|
|
340
|
+
loop,
|
|
341
|
+
reducedMotion,
|
|
342
|
+
state,
|
|
343
|
+
subscribeScrollProgress,
|
|
344
|
+
getScrollProgress,
|
|
345
|
+
autoplayState,
|
|
346
|
+
scrollPrev,
|
|
347
|
+
scrollNext,
|
|
348
|
+
scrollTo
|
|
349
|
+
]
|
|
350
|
+
);
|
|
351
|
+
return /* @__PURE__ */ jsx(CarouselContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsx(
|
|
352
|
+
"div",
|
|
353
|
+
{
|
|
354
|
+
"data-slot": "carousel",
|
|
355
|
+
"data-orientation": orientation,
|
|
356
|
+
role: "region",
|
|
357
|
+
"aria-roledescription": "carousel",
|
|
358
|
+
"aria-label": "Carousel",
|
|
359
|
+
className: cn("relative", className),
|
|
360
|
+
...rest,
|
|
361
|
+
children
|
|
362
|
+
}
|
|
363
|
+
) });
|
|
364
|
+
}
|
|
365
|
+
function CarouselContent({ className, children, ...rest }) {
|
|
366
|
+
const { viewportRef, orientation, autoHeight } = useCarousel();
|
|
367
|
+
return /* @__PURE__ */ jsx(
|
|
368
|
+
"div",
|
|
369
|
+
{
|
|
370
|
+
ref: viewportRef,
|
|
371
|
+
"data-slot": "carousel-viewport",
|
|
372
|
+
"data-orientation": orientation,
|
|
373
|
+
"data-auto-height": autoHeight || void 0,
|
|
374
|
+
className: cn(
|
|
375
|
+
"overflow-hidden",
|
|
376
|
+
autoHeight && "motion-safe:transition-[height] motion-safe:duration-300 motion-safe:ease-out"
|
|
377
|
+
),
|
|
378
|
+
children: /* @__PURE__ */ jsx(
|
|
379
|
+
"div",
|
|
380
|
+
{
|
|
381
|
+
"data-slot": "carousel-content",
|
|
382
|
+
"data-orientation": orientation,
|
|
383
|
+
className: cn(
|
|
384
|
+
"flex",
|
|
385
|
+
orientation === "horizontal" ? "-ms-4 touch-pan-y touch-pinch-zoom items-start" : "-mt-4 h-full touch-pan-x touch-pinch-zoom flex-col",
|
|
386
|
+
className
|
|
387
|
+
),
|
|
388
|
+
...rest,
|
|
389
|
+
children
|
|
390
|
+
}
|
|
391
|
+
)
|
|
392
|
+
}
|
|
393
|
+
);
|
|
394
|
+
}
|
|
395
|
+
function CarouselSlide({ className, ...rest }) {
|
|
396
|
+
const { orientation } = useCarousel();
|
|
397
|
+
return /* @__PURE__ */ jsx(
|
|
398
|
+
"div",
|
|
399
|
+
{
|
|
400
|
+
"data-slot": "carousel-slide",
|
|
401
|
+
"data-orientation": orientation,
|
|
402
|
+
role: "group",
|
|
403
|
+
"aria-roledescription": "slide",
|
|
404
|
+
className: cn(
|
|
405
|
+
"min-h-0 min-w-0 shrink-0 grow-0 basis-full",
|
|
406
|
+
orientation === "horizontal" ? "ps-4" : "pt-4",
|
|
407
|
+
className
|
|
408
|
+
),
|
|
409
|
+
...rest
|
|
410
|
+
}
|
|
411
|
+
);
|
|
412
|
+
}
|
|
413
|
+
const PREV_POSITION_CLASSES = {
|
|
414
|
+
inside: cn(
|
|
415
|
+
"absolute z-10",
|
|
416
|
+
"data-[orientation=horizontal]:inset-s-4 data-[orientation=horizontal]:top-1/2 data-[orientation=horizontal]:-translate-y-1/2",
|
|
417
|
+
"data-[orientation=vertical]:inset-s-1/2 data-[orientation=vertical]:top-4 data-[orientation=vertical]:-translate-x-1/2"
|
|
418
|
+
),
|
|
419
|
+
outside: cn(
|
|
420
|
+
"absolute z-10",
|
|
421
|
+
"data-[orientation=horizontal]:-inset-s-14 data-[orientation=horizontal]:top-1/2 data-[orientation=horizontal]:-translate-y-1/2",
|
|
422
|
+
"data-[orientation=vertical]:inset-s-1/2 data-[orientation=vertical]:-top-14 data-[orientation=vertical]:-translate-x-1/2"
|
|
423
|
+
),
|
|
424
|
+
"outside-half": cn(
|
|
425
|
+
"absolute z-10",
|
|
426
|
+
"data-[orientation=horizontal]:inset-s-0 data-[orientation=horizontal]:top-1/2 data-[orientation=horizontal]:-translate-y-1/2",
|
|
427
|
+
"data-[orientation=horizontal]:ltr:-translate-x-1/2 data-[orientation=horizontal]:rtl:translate-x-1/2",
|
|
428
|
+
"data-[orientation=vertical]:inset-s-1/2 data-[orientation=vertical]:top-0 data-[orientation=vertical]:-translate-x-1/2 data-[orientation=vertical]:-translate-y-1/2"
|
|
429
|
+
),
|
|
430
|
+
none: ""
|
|
431
|
+
};
|
|
432
|
+
const NEXT_POSITION_CLASSES = {
|
|
433
|
+
inside: cn(
|
|
434
|
+
"absolute z-10",
|
|
435
|
+
"data-[orientation=horizontal]:inset-e-4 data-[orientation=horizontal]:top-1/2 data-[orientation=horizontal]:-translate-y-1/2",
|
|
436
|
+
"data-[orientation=vertical]:inset-s-1/2 data-[orientation=vertical]:bottom-4 data-[orientation=vertical]:-translate-x-1/2"
|
|
437
|
+
),
|
|
438
|
+
outside: cn(
|
|
439
|
+
"absolute z-10",
|
|
440
|
+
"data-[orientation=horizontal]:-inset-e-14 data-[orientation=horizontal]:top-1/2 data-[orientation=horizontal]:-translate-y-1/2",
|
|
441
|
+
"data-[orientation=vertical]:inset-s-1/2 data-[orientation=vertical]:-bottom-14 data-[orientation=vertical]:-translate-x-1/2"
|
|
442
|
+
),
|
|
443
|
+
"outside-half": cn(
|
|
444
|
+
"absolute z-10",
|
|
445
|
+
"data-[orientation=horizontal]:inset-e-0 data-[orientation=horizontal]:top-1/2 data-[orientation=horizontal]:-translate-y-1/2",
|
|
446
|
+
"data-[orientation=horizontal]:ltr:translate-x-1/2 data-[orientation=horizontal]:rtl:-translate-x-1/2",
|
|
447
|
+
"data-[orientation=vertical]:inset-s-1/2 data-[orientation=vertical]:bottom-0 data-[orientation=vertical]:-translate-x-1/2 data-[orientation=vertical]:translate-y-1/2"
|
|
448
|
+
),
|
|
449
|
+
none: ""
|
|
450
|
+
};
|
|
451
|
+
function CarouselPrev({ className, position = "inside", disabled: disabledProp, render, ...props }) {
|
|
452
|
+
const { scrollPrev, canScrollPrev, orientation } = useCarousel();
|
|
453
|
+
const disabled = (disabledProp ?? false) || !canScrollPrev;
|
|
454
|
+
const state = { disabled, direction: "prev" };
|
|
455
|
+
const trigger = useRender({
|
|
456
|
+
defaultTagName: "button",
|
|
457
|
+
render,
|
|
458
|
+
state,
|
|
459
|
+
props: mergeProps(
|
|
460
|
+
{
|
|
461
|
+
type: "button",
|
|
462
|
+
"data-slot": "carousel-prev",
|
|
463
|
+
"data-disabled": disabled || void 0,
|
|
464
|
+
"aria-label": "Previous slide",
|
|
465
|
+
disabled,
|
|
466
|
+
onClick: scrollPrev,
|
|
467
|
+
suppressHydrationWarning: true
|
|
468
|
+
},
|
|
469
|
+
props
|
|
470
|
+
)
|
|
471
|
+
});
|
|
472
|
+
return /* @__PURE__ */ jsx(
|
|
473
|
+
"div",
|
|
474
|
+
{
|
|
475
|
+
"data-slot": "carousel-prev-positioner",
|
|
476
|
+
"data-orientation": orientation,
|
|
477
|
+
className: cn(PREV_POSITION_CLASSES[position], className),
|
|
478
|
+
suppressHydrationWarning: true,
|
|
479
|
+
children: trigger
|
|
480
|
+
}
|
|
481
|
+
);
|
|
482
|
+
}
|
|
483
|
+
function CarouselNext({ className, position = "inside", disabled: disabledProp, render, ...props }) {
|
|
484
|
+
const { scrollNext, canScrollNext, orientation } = useCarousel();
|
|
485
|
+
const disabled = (disabledProp ?? false) || !canScrollNext;
|
|
486
|
+
const state = { disabled, direction: "next" };
|
|
487
|
+
const trigger = useRender({
|
|
488
|
+
defaultTagName: "button",
|
|
489
|
+
render,
|
|
490
|
+
state,
|
|
491
|
+
props: mergeProps(
|
|
492
|
+
{
|
|
493
|
+
type: "button",
|
|
494
|
+
"data-slot": "carousel-next",
|
|
495
|
+
"data-disabled": disabled || void 0,
|
|
496
|
+
"aria-label": "Next slide",
|
|
497
|
+
disabled,
|
|
498
|
+
onClick: scrollNext,
|
|
499
|
+
suppressHydrationWarning: true
|
|
500
|
+
},
|
|
501
|
+
props
|
|
502
|
+
)
|
|
503
|
+
});
|
|
504
|
+
return /* @__PURE__ */ jsx(
|
|
505
|
+
"div",
|
|
506
|
+
{
|
|
507
|
+
"data-slot": "carousel-next-positioner",
|
|
508
|
+
"data-orientation": orientation,
|
|
509
|
+
className: cn(NEXT_POSITION_CLASSES[position], className),
|
|
510
|
+
suppressHydrationWarning: true,
|
|
511
|
+
children: trigger
|
|
512
|
+
}
|
|
513
|
+
);
|
|
514
|
+
}
|
|
515
|
+
function CarouselPagination({
|
|
516
|
+
className,
|
|
517
|
+
orientation = "horizontal",
|
|
518
|
+
light: lightProp,
|
|
519
|
+
...rest
|
|
520
|
+
}) {
|
|
521
|
+
const { scrollSnaps, selectedIndex, scrollTo, autoplay, reducedMotion, light: ctxLight } = useCarousel();
|
|
522
|
+
const light = lightProp ?? ctxLight;
|
|
523
|
+
if (scrollSnaps.length <= 1) return null;
|
|
524
|
+
const isHorizontal = orientation === "horizontal";
|
|
525
|
+
return /* @__PURE__ */ jsx(
|
|
526
|
+
"div",
|
|
527
|
+
{
|
|
528
|
+
"data-slot": "carousel-pagination",
|
|
529
|
+
"data-orientation": orientation,
|
|
530
|
+
role: "group",
|
|
531
|
+
"aria-label": "Choose slide to display",
|
|
532
|
+
className: cn("flex gap-2 data-[orientation=vertical]:flex-col", className),
|
|
533
|
+
...rest,
|
|
534
|
+
children: scrollSnaps.map((_, index) => {
|
|
535
|
+
const isActive = index === selectedIndex;
|
|
536
|
+
const renderAutoplay = isActive && autoplay !== null && autoplay.isPlaying && !reducedMotion;
|
|
537
|
+
return /* @__PURE__ */ jsx(
|
|
538
|
+
"button",
|
|
539
|
+
{
|
|
540
|
+
type: "button",
|
|
541
|
+
"aria-current": isActive ? "true" : void 0,
|
|
542
|
+
"aria-label": `Go to slide ${index + 1}`,
|
|
543
|
+
"data-slot": "carousel-pagination-bullet",
|
|
544
|
+
"data-orientation": orientation,
|
|
545
|
+
"data-active": isActive || void 0,
|
|
546
|
+
"data-autoplay": renderAutoplay || void 0,
|
|
547
|
+
onClick: () => scrollTo(index),
|
|
548
|
+
className: cn(
|
|
549
|
+
"cursor-pointer rounded-full outline-offset-1",
|
|
550
|
+
isHorizontal ? "h-1.5" : "w-1.5",
|
|
551
|
+
light ? "outline-ring-light" : "outline-ring",
|
|
552
|
+
"motion-safe:transition-[width,height,background-color] motion-safe:duration-300",
|
|
553
|
+
!isActive && (light ? "bg-white/25" : "bg-border-strong"),
|
|
554
|
+
!isActive && (isHorizontal ? "w-1.5" : "h-1.5"),
|
|
555
|
+
isActive && !renderAutoplay && (light ? "bg-white" : "bg-primary"),
|
|
556
|
+
isActive && !renderAutoplay && (isHorizontal ? "w-5" : "h-5"),
|
|
557
|
+
renderAutoplay && "relative overflow-hidden",
|
|
558
|
+
renderAutoplay && (light ? "bg-white/25" : "bg-border-strong"),
|
|
559
|
+
renderAutoplay && (isHorizontal ? "w-10" : "h-10")
|
|
560
|
+
),
|
|
561
|
+
children: renderAutoplay && autoplay ? /* @__PURE__ */ jsx(
|
|
562
|
+
CarouselAutoplayIndicator,
|
|
563
|
+
{
|
|
564
|
+
delay: autoplay.delay,
|
|
565
|
+
isPlaying: autoplay.isPlaying,
|
|
566
|
+
light,
|
|
567
|
+
orientation
|
|
568
|
+
},
|
|
569
|
+
autoplay.cycleId
|
|
570
|
+
) : null
|
|
571
|
+
},
|
|
572
|
+
index
|
|
573
|
+
);
|
|
574
|
+
})
|
|
575
|
+
}
|
|
576
|
+
);
|
|
577
|
+
}
|
|
578
|
+
function CarouselAutoplayIndicator({ delay, isPlaying, light, orientation }) {
|
|
579
|
+
const [armed, setArmed] = React.useState(false);
|
|
580
|
+
React.useEffect(() => {
|
|
581
|
+
let raf2 = 0;
|
|
582
|
+
const raf1 = requestAnimationFrame(() => {
|
|
583
|
+
raf2 = requestAnimationFrame(() => setArmed(true));
|
|
584
|
+
});
|
|
585
|
+
return () => {
|
|
586
|
+
cancelAnimationFrame(raf1);
|
|
587
|
+
cancelAnimationFrame(raf2);
|
|
588
|
+
};
|
|
589
|
+
}, []);
|
|
590
|
+
const isHorizontal = orientation === "horizontal";
|
|
591
|
+
const fillValue = armed && isPlaying ? "100%" : "0%";
|
|
592
|
+
return /* @__PURE__ */ jsx(
|
|
593
|
+
"span",
|
|
594
|
+
{
|
|
595
|
+
"aria-hidden": "true",
|
|
596
|
+
"data-slot": "carousel-pagination-indicator",
|
|
597
|
+
"data-orientation": orientation,
|
|
598
|
+
"data-playing": isPlaying || void 0,
|
|
599
|
+
className: cn(
|
|
600
|
+
"absolute rounded-full",
|
|
601
|
+
isHorizontal ? "inset-y-0 inset-s-0" : "inset-x-0 top-0",
|
|
602
|
+
isHorizontal ? "motion-safe:transition-[width]" : "motion-safe:transition-[height]",
|
|
603
|
+
"motion-safe:ease-linear",
|
|
604
|
+
light ? "bg-white" : "bg-primary"
|
|
605
|
+
),
|
|
606
|
+
style: {
|
|
607
|
+
transitionDuration: `${delay}ms`,
|
|
608
|
+
width: isHorizontal ? fillValue : void 0,
|
|
609
|
+
height: isHorizontal ? void 0 : fillValue
|
|
610
|
+
}
|
|
611
|
+
}
|
|
612
|
+
);
|
|
613
|
+
}
|
|
614
|
+
const CAROUSEL_PROGRESS_CIRCULAR_VIEWBOX = 40;
|
|
615
|
+
const CAROUSEL_PROGRESS_CIRCULAR_THICKNESS = 4;
|
|
616
|
+
const CAROUSEL_PROGRESS_CIRCULAR_RADIUS = (CAROUSEL_PROGRESS_CIRCULAR_VIEWBOX - CAROUSEL_PROGRESS_CIRCULAR_THICKNESS) / 2;
|
|
617
|
+
const CAROUSEL_PROGRESS_CIRCULAR_CIRCUMFERENCE = 2 * Math.PI * CAROUSEL_PROGRESS_CIRCULAR_RADIUS;
|
|
618
|
+
function CarouselProgress({
|
|
619
|
+
source = "auto",
|
|
620
|
+
variant = "bar",
|
|
621
|
+
orientation = "horizontal",
|
|
622
|
+
light: lightProp,
|
|
623
|
+
className,
|
|
624
|
+
...rest
|
|
625
|
+
}) {
|
|
626
|
+
const { subscribeScrollProgress, getScrollProgress, autoplay, reducedMotion, light: ctxLight } = useCarousel();
|
|
627
|
+
const scrollProgress = React.useSyncExternalStore(subscribeScrollProgress, getScrollProgress, getScrollProgress);
|
|
628
|
+
const light = lightProp ?? ctxLight;
|
|
629
|
+
const resolvedSource = source === "auto" ? autoplay && autoplay.isPlaying ? "autoplay" : "scroll" : source;
|
|
630
|
+
const showAutoplay = resolvedSource === "autoplay" && autoplay !== null && !reducedMotion;
|
|
631
|
+
if (variant === "circular") {
|
|
632
|
+
const center = CAROUSEL_PROGRESS_CIRCULAR_VIEWBOX / 2;
|
|
633
|
+
const offset = CAROUSEL_PROGRESS_CIRCULAR_CIRCUMFERENCE * (1 - scrollProgress);
|
|
634
|
+
return /* @__PURE__ */ jsx(
|
|
635
|
+
"div",
|
|
636
|
+
{
|
|
637
|
+
"data-slot": "carousel-progress",
|
|
638
|
+
"data-variant": "circular",
|
|
639
|
+
"data-source": resolvedSource,
|
|
640
|
+
"data-light": light || void 0,
|
|
641
|
+
className: cn("relative size-10", className),
|
|
642
|
+
...rest,
|
|
643
|
+
children: /* @__PURE__ */ jsxs(
|
|
644
|
+
"svg",
|
|
645
|
+
{
|
|
646
|
+
"aria-hidden": "true",
|
|
647
|
+
viewBox: `0 0 ${CAROUSEL_PROGRESS_CIRCULAR_VIEWBOX} ${CAROUSEL_PROGRESS_CIRCULAR_VIEWBOX}`,
|
|
648
|
+
className: "size-full -rotate-90 overflow-visible",
|
|
649
|
+
children: [
|
|
650
|
+
/* @__PURE__ */ jsx(
|
|
651
|
+
"circle",
|
|
652
|
+
{
|
|
653
|
+
"data-slot": "carousel-progress-track",
|
|
654
|
+
cx: center,
|
|
655
|
+
cy: center,
|
|
656
|
+
r: CAROUSEL_PROGRESS_CIRCULAR_RADIUS,
|
|
657
|
+
fill: "none",
|
|
658
|
+
strokeWidth: CAROUSEL_PROGRESS_CIRCULAR_THICKNESS,
|
|
659
|
+
className: light ? "stroke-white/25" : "stroke-border-strong"
|
|
660
|
+
}
|
|
661
|
+
),
|
|
662
|
+
showAutoplay && autoplay ? /* @__PURE__ */ jsx(
|
|
663
|
+
CarouselAutoplayCircularIndicator,
|
|
664
|
+
{
|
|
665
|
+
delay: autoplay.delay,
|
|
666
|
+
isPlaying: autoplay.isPlaying,
|
|
667
|
+
light,
|
|
668
|
+
center,
|
|
669
|
+
radius: CAROUSEL_PROGRESS_CIRCULAR_RADIUS,
|
|
670
|
+
circumference: CAROUSEL_PROGRESS_CIRCULAR_CIRCUMFERENCE,
|
|
671
|
+
thickness: CAROUSEL_PROGRESS_CIRCULAR_THICKNESS
|
|
672
|
+
},
|
|
673
|
+
autoplay.cycleId
|
|
674
|
+
) : /* @__PURE__ */ jsx(
|
|
675
|
+
"circle",
|
|
676
|
+
{
|
|
677
|
+
"data-slot": "carousel-progress-indicator",
|
|
678
|
+
cx: center,
|
|
679
|
+
cy: center,
|
|
680
|
+
r: CAROUSEL_PROGRESS_CIRCULAR_RADIUS,
|
|
681
|
+
fill: "none",
|
|
682
|
+
strokeWidth: CAROUSEL_PROGRESS_CIRCULAR_THICKNESS,
|
|
683
|
+
strokeLinecap: "round",
|
|
684
|
+
strokeDasharray: CAROUSEL_PROGRESS_CIRCULAR_CIRCUMFERENCE,
|
|
685
|
+
strokeDashoffset: offset,
|
|
686
|
+
className: light ? "stroke-white" : "stroke-primary"
|
|
687
|
+
}
|
|
688
|
+
)
|
|
689
|
+
]
|
|
690
|
+
}
|
|
691
|
+
)
|
|
692
|
+
}
|
|
693
|
+
);
|
|
694
|
+
}
|
|
695
|
+
const isHorizontal = orientation === "horizontal";
|
|
696
|
+
return /* @__PURE__ */ jsx(
|
|
697
|
+
"div",
|
|
698
|
+
{
|
|
699
|
+
"data-slot": "carousel-progress",
|
|
700
|
+
"data-variant": "bar",
|
|
701
|
+
"data-orientation": orientation,
|
|
702
|
+
"data-source": resolvedSource,
|
|
703
|
+
"data-light": light || void 0,
|
|
704
|
+
className: cn(
|
|
705
|
+
"relative overflow-hidden rounded-full",
|
|
706
|
+
isHorizontal ? "h-1.5 w-full" : "h-full w-1.5",
|
|
707
|
+
light ? "bg-white/25" : "bg-border-strong",
|
|
708
|
+
className
|
|
709
|
+
),
|
|
710
|
+
...rest,
|
|
711
|
+
children: showAutoplay && autoplay ? /* @__PURE__ */ jsx(
|
|
712
|
+
CarouselAutoplayIndicator,
|
|
713
|
+
{
|
|
714
|
+
delay: autoplay.delay,
|
|
715
|
+
isPlaying: autoplay.isPlaying,
|
|
716
|
+
light,
|
|
717
|
+
orientation
|
|
718
|
+
},
|
|
719
|
+
autoplay.cycleId
|
|
720
|
+
) : /* @__PURE__ */ jsx(
|
|
721
|
+
"span",
|
|
722
|
+
{
|
|
723
|
+
"aria-hidden": "true",
|
|
724
|
+
"data-slot": "carousel-progress-indicator",
|
|
725
|
+
"data-orientation": orientation,
|
|
726
|
+
className: cn("block rounded-full", isHorizontal ? "h-full" : "w-full", light ? "bg-white" : "bg-primary"),
|
|
727
|
+
style: isHorizontal ? { width: `${scrollProgress * 100}%` } : { height: `${scrollProgress * 100}%` }
|
|
728
|
+
}
|
|
729
|
+
)
|
|
730
|
+
}
|
|
731
|
+
);
|
|
732
|
+
}
|
|
733
|
+
function CarouselAutoplayCircularIndicator({
|
|
734
|
+
delay,
|
|
735
|
+
isPlaying,
|
|
736
|
+
light,
|
|
737
|
+
center,
|
|
738
|
+
radius,
|
|
739
|
+
circumference,
|
|
740
|
+
thickness
|
|
741
|
+
}) {
|
|
742
|
+
const [armed, setArmed] = React.useState(false);
|
|
743
|
+
React.useEffect(() => {
|
|
744
|
+
let raf2 = 0;
|
|
745
|
+
const raf1 = requestAnimationFrame(() => {
|
|
746
|
+
raf2 = requestAnimationFrame(() => setArmed(true));
|
|
747
|
+
});
|
|
748
|
+
return () => {
|
|
749
|
+
cancelAnimationFrame(raf1);
|
|
750
|
+
cancelAnimationFrame(raf2);
|
|
751
|
+
};
|
|
752
|
+
}, []);
|
|
753
|
+
const offset = armed && isPlaying ? 0 : circumference;
|
|
754
|
+
return /* @__PURE__ */ jsx(
|
|
755
|
+
"circle",
|
|
756
|
+
{
|
|
757
|
+
"data-slot": "carousel-progress-indicator",
|
|
758
|
+
"data-playing": isPlaying || void 0,
|
|
759
|
+
cx: center,
|
|
760
|
+
cy: center,
|
|
761
|
+
r: radius,
|
|
762
|
+
fill: "none",
|
|
763
|
+
strokeWidth: thickness,
|
|
764
|
+
strokeLinecap: "round",
|
|
765
|
+
strokeDasharray: circumference,
|
|
766
|
+
strokeDashoffset: offset,
|
|
767
|
+
className: cn(
|
|
768
|
+
"motion-safe:transition-[stroke-dashoffset] motion-safe:ease-linear",
|
|
769
|
+
light ? "stroke-white" : "stroke-primary"
|
|
770
|
+
),
|
|
771
|
+
style: { transitionDuration: `${delay}ms` }
|
|
772
|
+
}
|
|
773
|
+
);
|
|
774
|
+
}
|
|
775
|
+
function useLinkedCarousels(mainApi, thumbsApi) {
|
|
776
|
+
React.useEffect(() => {
|
|
777
|
+
if (!mainApi || !thumbsApi) return;
|
|
778
|
+
const syncThumbsFromMain = () => {
|
|
779
|
+
thumbsApi.goTo(mainApi.selectedSnap());
|
|
780
|
+
};
|
|
781
|
+
const syncMainFromThumbs = () => {
|
|
782
|
+
mainApi.goTo(thumbsApi.selectedSnap());
|
|
783
|
+
};
|
|
784
|
+
syncThumbsFromMain();
|
|
785
|
+
mainApi.on("select", syncThumbsFromMain);
|
|
786
|
+
thumbsApi.on("select", syncMainFromThumbs);
|
|
787
|
+
return () => {
|
|
788
|
+
mainApi.off("select", syncThumbsFromMain);
|
|
789
|
+
thumbsApi.off("select", syncMainFromThumbs);
|
|
790
|
+
};
|
|
791
|
+
}, [mainApi, thumbsApi]);
|
|
792
|
+
}
|
|
793
|
+
|
|
794
|
+
export { Carousel, CarouselContent, CarouselNext, CarouselPagination, CarouselPrev, CarouselProgress, CarouselSlide, useCarousel, useLinkedCarousels };
|
|
795
|
+
//# sourceMappingURL=carousel.js.map
|