UNPKG

3.43 kBTypeScriptView Raw
1import React from 'react';
2import Thumbs from '../Thumbs';
3import { CarouselProps, CarouselState } from './types';
4export default class Carousel extends React.Component<CarouselProps, CarouselState> {
5 private thumbsRef?;
6 private carouselWrapperRef?;
7 private listRef?;
8 private itemsRef?;
9 private timer?;
10 private animationHandler;
11 static displayName: string;
12 static defaultProps: CarouselProps;
13 constructor(props: CarouselProps);
14 componentDidMount(): void;
15 componentDidUpdate(prevProps: CarouselProps, prevState: CarouselState): void;
16 componentWillUnmount(): void;
17 setThumbsRef: (node: Thumbs) => void;
18 setCarouselWrapperRef: (node: HTMLDivElement) => void;
19 setListRef: (node: HTMLElement | HTMLUListElement) => void;
20 setItemsRef: (node: HTMLElement, index: number) => void;
21 setupCarousel(): void;
22 destroyCarousel(): void;
23 setupAutoPlay(): void;
24 destroyAutoPlay(): void;
25 bindEvents(): void;
26 unbindEvents(): void;
27 autoPlay: () => void;
28 clearAutoPlay: () => void;
29 resetAutoPlay: () => void;
30 stopOnHover: () => void;
31 startOnLeave: () => void;
32 forceFocus(): void;
33 isFocusWithinTheCarousel: () => boolean;
34 navigateWithKeyboard: (e: KeyboardEvent) => void;
35 updateSizes: () => void;
36 setMountState: () => void;
37 handleClickItem: (index: number, item: React.ReactNode) => void;
38 /**
39 * On Change handler, Passes the index and React node to the supplied onChange prop
40 * @param index of the carousel item
41 * @param item React node of the item being changed
42 */
43 handleOnChange: (index: number, item: React.ReactNode) => void;
44 handleClickThumb: (index: number, item: React.ReactNode) => void;
45 onSwipeStart: (event: React.TouchEvent) => void;
46 onSwipeEnd: (event: React.TouchEvent) => void;
47 onSwipeMove: (delta: {
48 x: number;
49 y: number;
50 }, event: React.TouchEvent) => boolean;
51 /**
52 * Decrements the selectedItem index a number of positions through the children list
53 * @param positions
54 * @param fromSwipe
55 */
56 decrement: (positions?: number) => void;
57 /**
58 * Increments the selectedItem index a number of positions through the children list
59 * @param positions
60 * @param fromSwipe
61 */
62 increment: (positions?: number) => void;
63 /**
64 * Moves the selected item to the position provided
65 * @param position
66 * @param fromSwipe
67 */
68 moveTo: (position?: number | undefined) => void;
69 onClickNext: () => void;
70 onClickPrev: () => void;
71 onSwipeForward: () => void;
72 onSwipeBackwards: () => void;
73 changeItem: (newIndex: number) => (e: React.MouseEvent | React.KeyboardEvent) => void;
74 /**
75 * This function is called when you want to 'select' a new item, or rather move to a 'selected' item
76 * It also handles the onChange callback wrapper
77 * @param state state object with updated selected item, and swiping bool if relevant
78 */
79 selectItem: (state: Pick<CarouselState, 'selectedItem' | 'swiping'>) => void;
80 getInitialImage: () => HTMLImageElement;
81 getVariableItemHeight: (position: number) => number | null;
82 renderItems(isClone?: boolean): JSX.Element[];
83 renderControls(): JSX.Element | null;
84 renderStatus(): JSX.Element | null;
85 renderThumbs(): JSX.Element | null;
86 render(): JSX.Element | null;
87}
88//# sourceMappingURL=index.d.ts.map
\No newline at end of file