import * as React from 'react'; import { useRender } from '@base-ui/react/use-render'; import { type AccessibilityOptionsType } from 'embla-carousel-accessibility'; import { type AutoplayOptionsType } from 'embla-carousel-autoplay'; import { type AutoScrollOptionsType } from 'embla-carousel-auto-scroll'; import { type AutoHeightOptionsType } from 'embla-carousel-auto-height'; import { type ClassNamesOptionsType } from 'embla-carousel-class-names'; import { type FadeOptionsType } from 'embla-carousel-fade'; import { type WheelGesturesPluginOptions } from 'embla-carousel-wheel-gestures'; import type { EmblaCarouselType, EmblaOptionsType, EmblaPluginType } from 'embla-carousel'; type CarouselOrientation = 'horizontal' | 'vertical'; type CarouselApi = EmblaCarouselType; type CarouselOptions = EmblaOptionsType; type CarouselPlugin = EmblaPluginType; type CarouselAutoplayOptions = AutoplayOptionsType & { resumeAfter?: number; }; type CarouselAutoScrollOptions = AutoScrollOptionsType & { resumeAfter?: number; }; type CarouselAutoHeightOptions = AutoHeightOptionsType; type CarouselFadeOptions = FadeOptionsType; type CarouselClassNamesOptions = ClassNamesOptionsType; type CarouselAccessibilityOptions = AccessibilityOptionsType; type CarouselWheelGesturesOptions = WheelGesturesPluginOptions; interface CarouselAutoplayState { delay: number; cycleId: number; isPlaying: boolean; } interface CarouselContextValue { api: CarouselApi | undefined; viewportRef: (node: HTMLDivElement | null) => void; orientation: CarouselOrientation; direction: 'ltr' | 'rtl'; light: boolean; autoHeight: boolean; loop: boolean; reducedMotion: boolean; selectedIndex: number; scrollSnaps: number[]; canScrollPrev: boolean; canScrollNext: boolean; subscribeScrollProgress: (onChange: () => void) => () => void; getScrollProgress: () => number; autoplay: CarouselAutoplayState | null; scrollPrev: () => void; scrollNext: () => void; scrollTo: (index: number) => void; } declare function useCarousel(): CarouselContextValue; interface CarouselProps extends Omit, 'onSelect' | 'onScroll' | 'children'> { /** * Scroll axis. Maps to Embla's `axis`; exposed as `data-orientation`. * @default 'horizontal' */ orientation?: CarouselOrientation; /** * Wrap around from the last slide to the first. * @default false */ loop?: boolean; /** * Where slides settle within the viewport. * @default 'start' */ align?: 'start' | 'center' | 'end'; /** * How many slides advance per step. `'auto'` groups by how many fit the viewport. * @default 1 */ slidesToScroll?: number | 'auto'; /** * Clamp scrolling so there's no empty space at the edges. `false` disables containment. * @default 'trimSnaps' */ containScroll?: false | 'trimSnaps' | 'keepSnaps'; /** Release snap points; glide to a momentum stop. */ dragFree?: boolean; /** Index of the slide to start on. */ startSnap?: number; /** * When `false`, the engine is inert (no drag/snap) - e.g. to disable at a breakpoint. * @default true */ active?: boolean; /** * Whether pointer dragging is enabled (Embla's `watchDrag`). * @default true */ draggable?: boolean; /** Scroll animation duration (Embla's ease). Forced to `0` under reduced motion. */ duration?: number; /** Escape hatch: a raw Embla options object, merged last so it wins over the flat props. */ options?: CarouselOptions; /** Enable the Autoplay plugin. `resumeAfter` (ms) restarts the timer after user interaction. */ autoplay?: boolean | CarouselAutoplayOptions; /** Enable continuous Auto Scroll. Mutually exclusive with `autoplay`; paused under reduced motion. */ autoScroll?: boolean | CarouselAutoScrollOptions; /** Enable the Auto Height plugin; animates the viewport to each slide's height. */ autoHeight?: boolean | CarouselAutoHeightOptions; /** Enable the Fade plugin (cross-fade instead of slide). Best with one slide per view. */ fade?: boolean | CarouselFadeOptions; /** Enable the Class Names plugin, which toggles `snapped` / `inView` classes on slides. */ classNames?: boolean | CarouselClassNamesOptions; /** * Keyboard/ARIA plugin for the viewport. Set `false` to opt out. * @default true */ accessibility?: boolean | CarouselAccessibilityOptions; /** * Enable trackpad / mouse-wheel scrolling. * @default false */ wheelGestures?: boolean | CarouselWheelGesturesOptions; /** Additional Embla plugins to append. */ plugins?: CarouselPlugin[]; /** Receives the Embla instance once initialized - for imperative control. */ setApi?: (api: CarouselApi) => void; /** Fires on init and whenever the engine re-initializes. */ onReInit?: (api: CarouselApi) => void; /** Fires when the selected snap changes. */ onSelect?: (api: CarouselApi) => void; /** Fires continuously while scrolling. */ onScroll?: (api: CarouselApi) => void; /** * Hint stored in context for light-on-dark surfaces; read via `useCarousel()`. * @default false */ light?: boolean; /** The content. */ children: React.ReactNode; } declare function Carousel({ orientation, loop, align, slidesToScroll, containScroll, dragFree, startSnap, active, draggable, duration, options, autoplay, autoScroll, autoHeight, fade, classNames, accessibility, wheelGestures, plugins: userPlugins, setApi, onReInit, onSelect, onScroll, light, className, children, ...rest }: CarouselProps): React.JSX.Element; interface CarouselContentProps extends React.ComponentPropsWithoutRef<'div'> { /** Props for the scroll viewport, the element that clips the track. */ viewportProps?: React.ComponentPropsWithoutRef<'div'>; } declare function CarouselContent({ className, children, viewportProps, ...rest }: CarouselContentProps): React.JSX.Element; type CarouselSlideProps = React.ComponentPropsWithoutRef<'div'>; declare function CarouselSlide({ className, ...rest }: CarouselSlideProps): React.JSX.Element; interface CarouselThumbsProps extends Omit, 'draggable' | 'onSelect' | 'onScroll'> { /** * Lay the thumbnails out in a row or a column. Independent of the carousel's own axis. * @default 'horizontal' */ orientation?: CarouselOrientation; /** * Light-on-dark styling for use over imagery. * @default false */ light?: boolean; } declare function CarouselThumbs({ orientation, light: lightProp, className, children, ...rest }: CarouselThumbsProps): React.JSX.Element; interface CarouselThumbProps extends React.ComponentPropsWithoutRef<'button'> { /** Slide this thumbnail selects. Defaults to its position among the thumbnails. */ index?: number; } declare function CarouselThumb({ index: indexProp, className, children, onClick, ...rest }: CarouselThumbProps): React.JSX.Element; type CarouselButtonState = { disabled: boolean; direction: 'prev' | 'next'; }; type CarouselNavPosition = 'inside' | 'outside' | 'outside-half' | 'none'; interface CarouselPrevProps extends useRender.ComponentProps<'button', CarouselButtonState> { position?: CarouselNavPosition; disabled?: boolean; } declare function CarouselPrev({ className, position, disabled: disabledProp, render, ...props }: CarouselPrevProps): React.JSX.Element; interface CarouselNextProps extends useRender.ComponentProps<'button', CarouselButtonState> { position?: CarouselNavPosition; disabled?: boolean; } declare function CarouselNext({ className, position, disabled: disabledProp, render, ...props }: CarouselNextProps): React.JSX.Element; interface CarouselPaginationProps extends React.ComponentPropsWithoutRef<'div'> { /** * Lay the bullets out in a row or a column. * @default 'horizontal' */ orientation?: CarouselOrientation; /** * Light-on-dark styling for use over imagery. * @default false */ light?: boolean; } declare function CarouselPagination({ className, orientation, light: lightProp, ...rest }: CarouselPaginationProps): React.JSX.Element | null; interface CarouselProgressProps extends React.ComponentPropsWithoutRef<'div'> { /** * What drives the fill. `'auto'` counts down autoplay while it plays, otherwise tracks scroll position. * @default 'auto' */ source?: 'auto' | 'autoplay' | 'scroll'; /** * Straight bar or circular ring. * @default 'bar' */ variant?: 'bar' | 'circular'; /** * Fill direction for the bar variant. * @default 'horizontal' */ orientation?: CarouselOrientation; /** * Light-on-dark styling for use over imagery. * @default false */ light?: boolean; } declare function CarouselProgress({ source, variant, orientation, light: lightProp, className, ...rest }: CarouselProgressProps): React.JSX.Element; /** * Bidirectionally sync the selected snap between two carousels - the classic * "main + thumbnails" pattern. Wires `select` on each so navigating either * one drives the other. Both apis can be undefined initially (e.g. waiting on * `setApi`); the effect re-runs once both resolve. * * @example * const [mainApi, setMainApi] = useState() * const [thumbsApi, setThumbsApi] = useState() * useLinkedCarousels(mainApi, thumbsApi) * * * */ declare function useLinkedCarousels(mainApi: CarouselApi | undefined, thumbsApi: CarouselApi | undefined): void; export { Carousel, CarouselContent, CarouselSlide, CarouselThumbs, CarouselThumb, CarouselPrev, CarouselNext, CarouselPagination, CarouselProgress, useCarousel, useLinkedCarousels, }; export type { CarouselProps, CarouselContentProps, CarouselSlideProps, CarouselThumbsProps, CarouselThumbProps, CarouselPrevProps, CarouselNextProps, CarouselPaginationProps, CarouselProgressProps, CarouselApi, CarouselOptions, CarouselPlugin, CarouselAutoplayOptions, CarouselAutoScrollOptions, CarouselAutoHeightOptions, CarouselFadeOptions, CarouselClassNamesOptions, CarouselAccessibilityOptions, CarouselWheelGesturesOptions, }; //# sourceMappingURL=carousel.d.ts.map