UNPKG

2.9 kBTypeScriptView Raw
1import React from 'react';
2import type { ReactNode, ReactElement } from 'react';
3import { NativeProps } from '../../utils/native-props';
4import { PageIndicatorProps } from '../page-indicator';
5declare const eventToPropRecord: {
6 readonly mousedown: "onMouseDown";
7 readonly mousemove: "onMouseMove";
8 readonly mouseup: "onMouseUp";
9};
10declare type PropagationEvent = keyof typeof eventToPropRecord;
11export declare type SwiperRef = {
12 swipeTo: (index: number) => void;
13 swipeNext: () => void;
14 swipePrev: () => void;
15};
16export declare type SwiperProps = {
17 defaultIndex?: number;
18 allowTouchMove?: boolean;
19 autoplay?: boolean | 'reverse';
20 autoplayInterval?: number;
21 loop?: boolean;
22 direction?: 'horizontal' | 'vertical';
23 onIndexChange?: (index: number) => void;
24 indicatorProps?: Pick<PageIndicatorProps, 'color' | 'style' | 'className'>;
25 indicator?: false | ((total: number, current: number) => ReactNode);
26 slideSize?: number;
27 trackOffset?: number;
28 stuckAtBoundary?: boolean;
29 rubberband?: boolean;
30 stopPropagation?: PropagationEvent[];
31 /**
32 * Virtual scroll usage. Should work with renderProps `children`
33 */
34 total?: number;
35 /**
36 * renderProps is only work when `total` used
37 */
38 children?: ReactElement | ReactElement[] | ((index: number) => ReactElement);
39} & NativeProps<'--height' | '--width' | '--border-radius' | '--track-padding'>;
40export declare const Swiper: React.ForwardRefExoticComponent<{
41 defaultIndex?: number | undefined;
42 allowTouchMove?: boolean | undefined;
43 autoplay?: boolean | "reverse" | undefined;
44 autoplayInterval?: number | undefined;
45 loop?: boolean | undefined;
46 direction?: "vertical" | "horizontal" | undefined;
47 onIndexChange?: ((index: number) => void) | undefined;
48 indicatorProps?: Pick<PageIndicatorProps, "style" | "className" | "color"> | undefined;
49 indicator?: false | ((total: number, current: number) => ReactNode) | undefined;
50 slideSize?: number | undefined;
51 trackOffset?: number | undefined;
52 stuckAtBoundary?: boolean | undefined;
53 rubberband?: boolean | undefined;
54 stopPropagation?: ("mousedown" | "mousemove" | "mouseup")[] | undefined;
55 /**
56 * Virtual scroll usage. Should work with renderProps `children`
57 */
58 total?: number | undefined;
59 /**
60 * renderProps is only work when `total` used
61 */
62 children?: React.ReactElement<any, string | React.JSXElementConstructor<any>> | React.ReactElement<any, string | React.JSXElementConstructor<any>>[] | ((index: number) => ReactElement) | undefined;
63} & {
64 className?: string | undefined;
65 style?: (React.CSSProperties & Partial<Record<"--width" | "--height" | "--border-radius" | "--track-padding", string>>) | undefined;
66 tabIndex?: number | undefined;
67} & React.AriaAttributes & React.RefAttributes<SwiperRef>>;
68export {};
69
\No newline at end of file