react-spring-carousel 3.0.0-beta-1.0.422 → 3.0.0-beta-2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +40 -52
- package/dist/index.es.js +750 -984
- package/dist/index.umd.js +20 -46
- package/package.json +1 -1
- package/README.md +0 -50
package/dist/index.d.ts
CHANGED
|
@@ -1,43 +1,54 @@
|
|
|
1
1
|
import { FullGestureState } from '@use-gesture/react';
|
|
2
2
|
import { JSX as JSX_2 } from 'react/jsx-runtime';
|
|
3
3
|
import { ReactNode } from 'react';
|
|
4
|
+
import { SpringCarouselEventsEventHandler as SpringCarouselEventsEventHandler_2 } from './types';
|
|
4
5
|
|
|
5
|
-
declare type
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
scrollAmount?: number;
|
|
15
|
-
itemsPerSlide?: never;
|
|
16
|
-
scrollAmountType?: never;
|
|
6
|
+
declare type BaseProps = {
|
|
7
|
+
init?: boolean;
|
|
8
|
+
withLoop?: boolean;
|
|
9
|
+
items: Item[];
|
|
10
|
+
id: string;
|
|
11
|
+
slideType?: SlideType;
|
|
12
|
+
enableGestures?: boolean;
|
|
13
|
+
slideWhenDragThresholdIsReached?: boolean;
|
|
14
|
+
onInit?(): void;
|
|
17
15
|
};
|
|
18
16
|
|
|
19
|
-
declare type
|
|
20
|
-
slideType?: "freeScroll";
|
|
21
|
-
scrollAmount?: number;
|
|
22
|
-
itemsPerSlide?: never;
|
|
23
|
-
scrollAmountType?: never;
|
|
24
|
-
withLoop?: never;
|
|
25
|
-
};
|
|
17
|
+
declare type CarouselAxis = "x" | "y";
|
|
26
18
|
|
|
27
19
|
declare type Item = {
|
|
28
20
|
id: string;
|
|
29
|
-
renderThumb?: ReactNode;
|
|
30
21
|
renderItem: ReactNode | ((props: {
|
|
31
22
|
index: number;
|
|
32
23
|
useListenToCustomEvent(eventHandler: SpringCarouselEventsEventHandler): void;
|
|
33
24
|
}) => ReactNode);
|
|
34
25
|
};
|
|
35
26
|
|
|
36
|
-
|
|
27
|
+
declare type LayoutProps = {
|
|
28
|
+
itemsPerSlide?: number;
|
|
29
|
+
gutter?: number;
|
|
30
|
+
startEndGutter?: number;
|
|
31
|
+
carouselAxis?: CarouselAxis;
|
|
32
|
+
startingPosition?: "start" | "middle-start" | "center" | "middle-end" | "end";
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
declare type OnDrag = Omit<FullGestureState<"drag">, "event"> & {
|
|
37
36
|
eventName: "onDrag";
|
|
38
37
|
slideActionType: SlideActionType;
|
|
39
38
|
};
|
|
40
39
|
|
|
40
|
+
declare type OnResize = {
|
|
41
|
+
eventName: "onResize";
|
|
42
|
+
slideDirection: SlideDirection;
|
|
43
|
+
sliceActionType: SlideActionType;
|
|
44
|
+
currentItem: {
|
|
45
|
+
index: number;
|
|
46
|
+
id: string;
|
|
47
|
+
startReached: boolean | undefined;
|
|
48
|
+
endReached: boolean | undefined;
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
|
|
41
52
|
declare type OnSlideChangeComplete = {
|
|
42
53
|
eventName: "onSlideChangeComplete";
|
|
43
54
|
slideDirection: SlideDirection;
|
|
@@ -62,47 +73,24 @@ declare type OnSlideStartChange = {
|
|
|
62
73
|
};
|
|
63
74
|
};
|
|
64
75
|
|
|
65
|
-
|
|
66
|
-
init?: boolean | (() => Promise<boolean>);
|
|
67
|
-
slideType?: SlideType;
|
|
68
|
-
items: Item[];
|
|
69
|
-
withLoop?: boolean;
|
|
70
|
-
carouselAxis?: "x" | "y";
|
|
71
|
-
enableGestures?: boolean;
|
|
72
|
-
slideWhenDragThresholdIsReached?: boolean;
|
|
73
|
-
initialActiveItem?: number;
|
|
74
|
-
fadeIn?: boolean;
|
|
75
|
-
} & (FixedSlideTypeProps | FluidSlideTypeProps | FreeScrollSlideTypeProps);
|
|
76
|
+
declare type Props = BaseProps & LayoutProps;
|
|
76
77
|
|
|
77
|
-
|
|
78
|
+
declare type SlideActionType = "drag" | "click" | "resize";
|
|
78
79
|
|
|
79
|
-
|
|
80
|
+
declare type SlideDirection = "prev" | "next";
|
|
80
81
|
|
|
81
82
|
declare type SlideType = "fixed" | "fluid" | "freeScroll";
|
|
82
83
|
|
|
83
|
-
|
|
84
|
+
declare type SpringCarouselEvents = OnSlideStartChange | OnSlideChangeComplete | OnResize | OnDrag;
|
|
84
85
|
|
|
85
|
-
|
|
86
|
+
declare type SpringCarouselEventsEventHandler = (props: SpringCarouselEvents) => void;
|
|
86
87
|
|
|
87
|
-
export declare function useSpringCarousel({ init, items
|
|
88
|
+
export declare function useSpringCarousel({ init, items, withLoop, id, itemsPerSlide, gutter, startEndGutter, carouselAxis, slideType, startingPosition, enableGestures, slideWhenDragThresholdIsReached, onInit, }: Props): {
|
|
88
89
|
carouselFragment: JSX_2.Element;
|
|
89
|
-
useListenToCustomEvent: (eventHandler:
|
|
90
|
+
useListenToCustomEvent: (eventHandler: SpringCarouselEventsEventHandler_2) => void;
|
|
90
91
|
slideToNextItem: () => void;
|
|
91
92
|
slideToPrevItem: () => void;
|
|
92
|
-
|
|
93
|
-
handleThumbsContainerScroll: ({ getContainer, activeItem, updateTotalValue, }: {
|
|
94
|
-
activeItem: number;
|
|
95
|
-
getContainer(): HTMLElement | null;
|
|
96
|
-
updateTotalValue?(props: {
|
|
97
|
-
from: number;
|
|
98
|
-
to: number;
|
|
99
|
-
itemOutOfViewport: {
|
|
100
|
-
isOut: boolean;
|
|
101
|
-
direction: "start" | "end" | null;
|
|
102
|
-
};
|
|
103
|
-
}): number;
|
|
104
|
-
}) => void;
|
|
105
|
-
carouselId: string;
|
|
93
|
+
slideToItem: (id: string | number) => void;
|
|
106
94
|
};
|
|
107
95
|
|
|
108
96
|
export { }
|