UNPKG

3.18 kBTypeScriptView Raw
1/// <reference types="react" />
2export interface AnimationHandlerResponse {
3 itemListStyle?: React.CSSProperties;
4 slideStyle?: React.CSSProperties;
5 selectedStyle?: React.CSSProperties;
6 prevStyle?: React.CSSProperties;
7}
8export declare type AnimationHandler = (props: CarouselProps, state: CarouselState) => AnimationHandlerResponse;
9export declare type SwipeAnimationHandler = (delta: {
10 x: number;
11 y: number;
12}, props: CarouselProps, state: CarouselState, setState: Function) => AnimationHandlerResponse;
13export declare type StopSwipingHandler = (props: CarouselProps, state: CarouselState) => AnimationHandlerResponse;
14export interface CarouselProps {
15 ariaLabel?: string | undefined;
16 axis: 'horizontal' | 'vertical';
17 autoFocus?: boolean;
18 autoPlay?: boolean;
19 centerMode?: boolean;
20 centerSlidePercentage: number;
21 children?: React.ReactChild[];
22 className?: string;
23 dynamicHeight?: boolean;
24 emulateTouch?: boolean;
25 infiniteLoop?: boolean;
26 interval: number;
27 labels: {
28 leftArrow: string;
29 rightArrow: string;
30 item: string;
31 };
32 onClickItem: (index: number, item: React.ReactNode) => void;
33 onClickThumb: (index: number, item: React.ReactNode) => void;
34 onChange: (index: number, item: React.ReactNode) => void;
35 onSwipeStart: (event: React.TouchEvent) => void;
36 onSwipeEnd: (event: React.TouchEvent) => void;
37 onSwipeMove: (event: React.TouchEvent) => boolean;
38 preventMovementUntilSwipeScrollTolerance: boolean;
39 renderArrowPrev: (clickHandler: () => void, hasPrev: boolean, label: string) => React.ReactNode;
40 renderArrowNext: (clickHandler: () => void, hasNext: boolean, label: string) => React.ReactNode;
41 renderIndicator: (clickHandler: (e: React.MouseEvent | React.KeyboardEvent) => void, isSelected: boolean, index: number, label: string) => React.ReactNode;
42 renderItem: (item: React.ReactNode, options?: {
43 isSelected: boolean;
44 isPrevious: boolean;
45 }) => React.ReactNode;
46 renderThumbs: (children: React.ReactChild[]) => React.ReactChild[];
47 selectedItem: number;
48 showArrows: boolean;
49 showStatus: boolean;
50 showIndicators: boolean;
51 showThumbs: boolean;
52 statusFormatter: (currentItem: number, total: number) => string;
53 stopOnHover: boolean;
54 swipeable: boolean;
55 swipeScrollTolerance: number;
56 thumbWidth?: number;
57 transitionTime: number;
58 useKeyboardArrows?: boolean;
59 verticalSwipe: 'natural' | 'standard';
60 width: number | string;
61 animationHandler: 'slide' | 'fade' | AnimationHandler;
62 swipeAnimationHandler: SwipeAnimationHandler;
63 stopSwipingHandler: StopSwipingHandler;
64}
65export interface CarouselState {
66 autoPlay?: boolean;
67 cancelClick: boolean;
68 hasMount: boolean;
69 initialized: boolean;
70 isMouseEntered: boolean;
71 itemSize: number;
72 previousItem: number;
73 selectedItem: number;
74 swiping?: boolean;
75 swipeMovementStarted: boolean;
76 itemListStyle?: React.CSSProperties;
77 slideStyle?: React.CSSProperties;
78 selectedStyle?: React.CSSProperties;
79 prevStyle?: React.CSSProperties;
80}
81//# sourceMappingURL=types.d.ts.map
\No newline at end of file