react-spring-carousel 3.0.0-beta-2.0.1 → 3.0.0-beta-2.0.12
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 +2 -96
- package/dist/types.d.ts +71 -0
- package/dist/useEventsModule.d.ts +5 -0
- package/dist/useSpringCarousel.d.ts +8 -0
- package/package.json +2 -3
package/dist/index.d.ts
CHANGED
|
@@ -1,96 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import { ReactNode } from 'react';
|
|
4
|
-
import { SpringCarouselEventsEventHandler as SpringCarouselEventsEventHandler_2 } from './types';
|
|
5
|
-
|
|
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;
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
declare type CarouselAxis = "x" | "y";
|
|
18
|
-
|
|
19
|
-
declare type Item = {
|
|
20
|
-
id: string;
|
|
21
|
-
renderItem: ReactNode | ((props: {
|
|
22
|
-
index: number;
|
|
23
|
-
useListenToCustomEvent(eventHandler: SpringCarouselEventsEventHandler): void;
|
|
24
|
-
}) => ReactNode);
|
|
25
|
-
};
|
|
26
|
-
|
|
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"> & {
|
|
36
|
-
eventName: "onDrag";
|
|
37
|
-
slideActionType: SlideActionType;
|
|
38
|
-
};
|
|
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
|
-
|
|
52
|
-
declare type OnSlideChangeComplete = {
|
|
53
|
-
eventName: "onSlideChangeComplete";
|
|
54
|
-
slideDirection: SlideDirection;
|
|
55
|
-
sliceActionType: SlideActionType;
|
|
56
|
-
currentItem: {
|
|
57
|
-
index: number;
|
|
58
|
-
id: string;
|
|
59
|
-
startReached: boolean | undefined;
|
|
60
|
-
endReached: boolean | undefined;
|
|
61
|
-
};
|
|
62
|
-
};
|
|
63
|
-
|
|
64
|
-
declare type OnSlideStartChange = {
|
|
65
|
-
eventName: "onSlideStartChange";
|
|
66
|
-
slideDirection: SlideDirection;
|
|
67
|
-
sliceActionType: SlideActionType;
|
|
68
|
-
nextItem: {
|
|
69
|
-
index: number;
|
|
70
|
-
id: string;
|
|
71
|
-
startReached: boolean | undefined;
|
|
72
|
-
endReached: boolean | undefined;
|
|
73
|
-
};
|
|
74
|
-
};
|
|
75
|
-
|
|
76
|
-
declare type Props = BaseProps & LayoutProps;
|
|
77
|
-
|
|
78
|
-
declare type SlideActionType = "drag" | "click" | "resize";
|
|
79
|
-
|
|
80
|
-
declare type SlideDirection = "prev" | "next";
|
|
81
|
-
|
|
82
|
-
declare type SlideType = "fixed" | "fluid" | "freeScroll";
|
|
83
|
-
|
|
84
|
-
declare type SpringCarouselEvents = OnSlideStartChange | OnSlideChangeComplete | OnResize | OnDrag;
|
|
85
|
-
|
|
86
|
-
declare type SpringCarouselEventsEventHandler = (props: SpringCarouselEvents) => void;
|
|
87
|
-
|
|
88
|
-
export declare function useSpringCarousel({ init, items, withLoop, id, itemsPerSlide, gutter, startEndGutter, carouselAxis, slideType, startingPosition, enableGestures, slideWhenDragThresholdIsReached, onInit, }: Props): {
|
|
89
|
-
carouselFragment: JSX_2.Element;
|
|
90
|
-
useListenToCustomEvent: (eventHandler: SpringCarouselEventsEventHandler_2) => void;
|
|
91
|
-
slideToNextItem: () => void;
|
|
92
|
-
slideToPrevItem: () => void;
|
|
93
|
-
slideToItem: (id: string | number) => void;
|
|
94
|
-
};
|
|
95
|
-
|
|
96
|
-
export { }
|
|
1
|
+
export * from './useSpringCarousel';
|
|
2
|
+
export * from './types';
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { FullGestureState } from '@use-gesture/react';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
export type SlideType = "fixed" | "fluid" | "freeScroll";
|
|
4
|
+
export type CarouselAxis = "x" | "y";
|
|
5
|
+
type Item = {
|
|
6
|
+
id: string;
|
|
7
|
+
renderItem: ReactNode | ((props: {
|
|
8
|
+
index: number;
|
|
9
|
+
useListenToCustomEvent(eventHandler: SpringCarouselEventsEventHandler): void;
|
|
10
|
+
}) => ReactNode);
|
|
11
|
+
};
|
|
12
|
+
type LayoutProps = {
|
|
13
|
+
itemsPerSlide?: number;
|
|
14
|
+
gutter?: number;
|
|
15
|
+
startEndGutter?: number;
|
|
16
|
+
carouselAxis?: CarouselAxis;
|
|
17
|
+
startingPosition?: "start" | "middle-start" | "center" | "middle-end" | "end";
|
|
18
|
+
};
|
|
19
|
+
type BaseProps = {
|
|
20
|
+
init?: boolean;
|
|
21
|
+
withLoop?: boolean;
|
|
22
|
+
items: Item[];
|
|
23
|
+
id: string;
|
|
24
|
+
slideType?: SlideType;
|
|
25
|
+
enableGestures?: boolean;
|
|
26
|
+
slideWhenDragThresholdIsReached?: boolean;
|
|
27
|
+
onInit?(): void;
|
|
28
|
+
};
|
|
29
|
+
export type Props = BaseProps & LayoutProps;
|
|
30
|
+
export type SlideActionType = "drag" | "click" | "resize";
|
|
31
|
+
export type SlideDirection = "prev" | "next";
|
|
32
|
+
export type OnDrag = Omit<FullGestureState<"drag">, "event"> & {
|
|
33
|
+
eventName: "onDrag";
|
|
34
|
+
slideActionType: SlideActionType;
|
|
35
|
+
};
|
|
36
|
+
type OnSlideStartChange = {
|
|
37
|
+
eventName: "onSlideStartChange";
|
|
38
|
+
slideDirection: SlideDirection;
|
|
39
|
+
sliceActionType: SlideActionType;
|
|
40
|
+
nextItem: {
|
|
41
|
+
index: number;
|
|
42
|
+
id: string;
|
|
43
|
+
startReached: boolean | undefined;
|
|
44
|
+
endReached: boolean | undefined;
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
type OnSlideChangeComplete = {
|
|
48
|
+
eventName: "onSlideChangeComplete";
|
|
49
|
+
slideDirection: SlideDirection;
|
|
50
|
+
sliceActionType: SlideActionType;
|
|
51
|
+
currentItem: {
|
|
52
|
+
index: number;
|
|
53
|
+
id: string;
|
|
54
|
+
startReached: boolean | undefined;
|
|
55
|
+
endReached: boolean | undefined;
|
|
56
|
+
};
|
|
57
|
+
};
|
|
58
|
+
type OnResize = {
|
|
59
|
+
eventName: "onResize";
|
|
60
|
+
slideDirection: SlideDirection;
|
|
61
|
+
sliceActionType: SlideActionType;
|
|
62
|
+
currentItem: {
|
|
63
|
+
index: number;
|
|
64
|
+
id: string;
|
|
65
|
+
startReached: boolean | undefined;
|
|
66
|
+
endReached: boolean | undefined;
|
|
67
|
+
};
|
|
68
|
+
};
|
|
69
|
+
export type SpringCarouselEvents = OnSlideStartChange | OnSlideChangeComplete | OnResize | OnDrag;
|
|
70
|
+
export type SpringCarouselEventsEventHandler = (props: SpringCarouselEvents) => void;
|
|
71
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Props } from './types';
|
|
2
|
+
export declare function useSpringCarousel({ init, items, withLoop, id, itemsPerSlide, gutter, startEndGutter, carouselAxis, slideType, startingPosition, enableGestures, slideWhenDragThresholdIsReached, onInit, }: Props): {
|
|
3
|
+
carouselFragment: import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
useListenToCustomEvent: (eventHandler: import('./types').SpringCarouselEventsEventHandler) => void;
|
|
5
|
+
slideToNextItem: () => void;
|
|
6
|
+
slideToPrevItem: () => void;
|
|
7
|
+
slideToItem: (id: string | number) => void;
|
|
8
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-spring-carousel",
|
|
3
|
-
"version": "3.0.0-beta-2.0.
|
|
3
|
+
"version": "3.0.0-beta-2.0.12",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "./dist/index.umd.js",
|
|
@@ -14,8 +14,7 @@
|
|
|
14
14
|
"import": "./dist/index.es.js",
|
|
15
15
|
"require": "./dist/index.umd.js",
|
|
16
16
|
"types": "./dist/index.d.ts"
|
|
17
|
-
}
|
|
18
|
-
"./dist/style.css": "./dist/style.css"
|
|
17
|
+
}
|
|
19
18
|
},
|
|
20
19
|
"scripts": {
|
|
21
20
|
"dev": "vite",
|