vue-carousel-lite
Version:
Fast, Lightweight Vue Carousel With Touch, Mouse, Keyboard, Wheel & SSR support
32 lines (30 loc) • 1.14 kB
TypeScript
import { ComputedRef } from 'vue';
import { CarouselProps, CarouselState } from '../types';
interface UseCarouselStateOptions {
props: CarouselProps;
itemsToShow: ComputedRef<number>;
totalSlides: ComputedRef<number>;
}
export declare function useCarouselState({ props, itemsToShow, totalSlides }: UseCarouselStateOptions): {
state: {
readonly currentIndex: number;
readonly isTransitioning: boolean;
readonly isDragging: boolean;
readonly isHovered: boolean;
readonly isWheeling: boolean;
};
maxIndex: ComputedRef<number>;
canGoNext: ComputedRef<boolean>;
canGoPrev: ComputedRef<boolean>;
progress: ComputedRef<number>;
visibleSlideIndices: ComputedRef<number[]>;
renderedSlideIndices: ComputedRef<number[]>;
virtualOffset: ComputedRef<number>;
goToSlide: (index: number, smooth?: boolean) => void;
goNext: (smooth?: boolean) => void;
goPrev: (smooth?: boolean) => void;
goNextPage: (smooth?: boolean) => void;
goPrevPage: (smooth?: boolean) => void;
updateState: (updates: Partial<CarouselState>) => void;
};
export {};