react-spring-carousel 3.0.0-beta-1.0.422 → 3.0.0-beta-2.0.0
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 +20 -87
- package/dist/index.es.js +683 -1008
- package/dist/index.umd.js +20 -46
- package/package.json +1 -1
- package/README.md +0 -50
package/dist/index.d.ts
CHANGED
|
@@ -1,108 +1,41 @@
|
|
|
1
|
-
import { FullGestureState } from '@use-gesture/react';
|
|
2
1
|
import { JSX as JSX_2 } from 'react/jsx-runtime';
|
|
3
2
|
import { ReactNode } from 'react';
|
|
4
3
|
|
|
5
|
-
declare type
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
scrollAmount?: number;
|
|
15
|
-
itemsPerSlide?: never;
|
|
16
|
-
scrollAmountType?: never;
|
|
4
|
+
declare type BaseProps = {
|
|
5
|
+
init?: boolean;
|
|
6
|
+
withLoop?: boolean;
|
|
7
|
+
items: Item[];
|
|
8
|
+
id: string;
|
|
9
|
+
slideType?: SlideType;
|
|
10
|
+
enableGestures?: boolean;
|
|
11
|
+
slideWhenDragThresholdIsReached?: boolean;
|
|
12
|
+
onInit?(): void;
|
|
17
13
|
};
|
|
18
14
|
|
|
19
|
-
declare type
|
|
20
|
-
slideType?: "freeScroll";
|
|
21
|
-
scrollAmount?: number;
|
|
22
|
-
itemsPerSlide?: never;
|
|
23
|
-
scrollAmountType?: never;
|
|
24
|
-
withLoop?: never;
|
|
25
|
-
};
|
|
15
|
+
declare type CarouselAxis = "x" | "y";
|
|
26
16
|
|
|
27
17
|
declare type Item = {
|
|
28
18
|
id: string;
|
|
29
|
-
|
|
30
|
-
renderItem: ReactNode | ((props: {
|
|
31
|
-
index: number;
|
|
32
|
-
useListenToCustomEvent(eventHandler: SpringCarouselEventsEventHandler): void;
|
|
33
|
-
}) => ReactNode);
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
export declare type OnDrag = Omit<FullGestureState<"drag">, "event"> & {
|
|
37
|
-
eventName: "onDrag";
|
|
38
|
-
slideActionType: SlideActionType;
|
|
19
|
+
renderItem: ReactNode;
|
|
39
20
|
};
|
|
40
21
|
|
|
41
|
-
declare type
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
id: string;
|
|
48
|
-
startReached: boolean | undefined;
|
|
49
|
-
endReached: boolean | undefined;
|
|
50
|
-
};
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
declare type OnSlideStartChange = {
|
|
54
|
-
eventName: "onSlideStartChange";
|
|
55
|
-
slideDirection: SlideDirection;
|
|
56
|
-
sliceActionType: SlideActionType;
|
|
57
|
-
nextItem: {
|
|
58
|
-
index: number;
|
|
59
|
-
id: string;
|
|
60
|
-
startReached: boolean | undefined;
|
|
61
|
-
endReached: boolean | undefined;
|
|
62
|
-
};
|
|
22
|
+
declare type LayoutProps = {
|
|
23
|
+
itemsPerSlide?: number;
|
|
24
|
+
gutter?: number;
|
|
25
|
+
startEndGutter?: number;
|
|
26
|
+
carouselAxis?: CarouselAxis;
|
|
27
|
+
startingPosition?: "start" | "middle-start" | "center" | "middle-end" | "end";
|
|
63
28
|
};
|
|
64
29
|
|
|
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
|
-
|
|
77
|
-
export declare type SlideActionType = "drag" | "click";
|
|
78
|
-
|
|
79
|
-
export declare type SlideDirection = "prev" | "next";
|
|
30
|
+
declare type Props = BaseProps & LayoutProps;
|
|
80
31
|
|
|
81
32
|
declare type SlideType = "fixed" | "fluid" | "freeScroll";
|
|
82
33
|
|
|
83
|
-
export declare
|
|
84
|
-
|
|
85
|
-
export declare type SpringCarouselEventsEventHandler = (props: SpringCarouselEvents) => void;
|
|
86
|
-
|
|
87
|
-
export declare function useSpringCarousel({ init, items: _items, slideType, scrollAmount: _scrollAmount, withLoop, enableGestures, carouselAxis, slideWhenDragThresholdIsReached, scrollAmountType: _scrollAmountType, fadeIn, initialActiveItem, }: Props): {
|
|
34
|
+
export declare function useSpringCarousel({ init, items, withLoop, id, itemsPerSlide, gutter, startEndGutter, carouselAxis, slideType, startingPosition, enableGestures, slideWhenDragThresholdIsReached, onInit, }: Props): {
|
|
88
35
|
carouselFragment: JSX_2.Element;
|
|
89
|
-
useListenToCustomEvent: (eventHandler: SpringCarouselEventsEventHandler) => void;
|
|
90
36
|
slideToNextItem: () => void;
|
|
91
37
|
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;
|
|
38
|
+
slideToItem: (id: string | number) => void;
|
|
106
39
|
};
|
|
107
40
|
|
|
108
41
|
export { }
|