react-spring-carousel 3.0.0-beta-1.0.0 → 3.0.0-beta-1.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 +106 -0
- package/dist/react-spring-carousel.js +1454 -0
- package/package.json +13 -1
- package/.storybook/main.ts +0 -17
- package/.storybook/preview.ts +0 -15
- package/eslint.config.js +0 -28
- package/index.html +0 -13
- package/lib/events.ts +0 -39
- package/lib/index.tsx +0 -980
- package/lib/types.ts +0 -44
- package/lib/useEventsModule.ts +0 -51
- package/lib/utils.ts +0 -42
- package/lib/vite-env.d.ts +0 -1
- package/src/stories/Button.stories.ts +0 -52
- package/src/stories/Button.tsx +0 -48
- package/src/stories/Configure.mdx +0 -364
- package/src/stories/Main.stories.ts +0 -14
- package/src/stories/Main.tsx +0 -87
- package/src/stories/assets/accessibility.png +0 -0
- package/src/stories/assets/accessibility.svg +0 -1
- package/src/stories/assets/addon-library.png +0 -0
- package/src/stories/assets/assets.png +0 -0
- package/src/stories/assets/avif-test-image.avif +0 -0
- package/src/stories/assets/context.png +0 -0
- package/src/stories/assets/discord.svg +0 -1
- package/src/stories/assets/docs.png +0 -0
- package/src/stories/assets/figma-plugin.png +0 -0
- package/src/stories/assets/github.svg +0 -1
- package/src/stories/assets/share.png +0 -0
- package/src/stories/assets/styling.png +0 -0
- package/src/stories/assets/testing.png +0 -0
- package/src/stories/assets/theming.png +0 -0
- package/src/stories/assets/tutorials.svg +0 -1
- package/src/stories/assets/youtube.svg +0 -1
- package/src/stories/button.css +0 -30
- package/src/stories/main.css +0 -37
- package/src/storybook.global.styles.css +0 -5
- package/tsconfig.app.json +0 -24
- package/tsconfig.json +0 -7
- package/tsconfig.node.json +0 -22
- package/vite.config.ts +0 -30
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { FullGestureState } from '@use-gesture/react';
|
|
2
|
+
import { JSX as JSX_2 } from 'react/jsx-runtime';
|
|
3
|
+
import { ReactNode } from 'react';
|
|
4
|
+
|
|
5
|
+
declare type FixedSlideTypeProps = {
|
|
6
|
+
slideType?: "fixed";
|
|
7
|
+
scrollAmount?: never;
|
|
8
|
+
itemsPerSlide?: number;
|
|
9
|
+
scrollAmountType?: "group" | "slide";
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
declare type FluidSlideTypeProps = {
|
|
13
|
+
slideType?: "fluid";
|
|
14
|
+
scrollAmount?: number;
|
|
15
|
+
itemsPerSlide?: never;
|
|
16
|
+
scrollAmountType?: never;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
declare type FreeScrollSlideTypeProps = {
|
|
20
|
+
slideType?: "freeScroll";
|
|
21
|
+
scrollAmount?: number;
|
|
22
|
+
itemsPerSlide?: never;
|
|
23
|
+
scrollAmountType?: never;
|
|
24
|
+
withLoop?: never;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
declare type Item = {
|
|
28
|
+
id: string;
|
|
29
|
+
renderItem: ReactNode;
|
|
30
|
+
renderThumb?: ReactNode;
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
declare type OnDrag = Omit<FullGestureState<"drag">, "event"> & {
|
|
34
|
+
eventName: "onDrag";
|
|
35
|
+
slideActionType: SlideActionType;
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
declare type OnSlideChangeComplete = {
|
|
39
|
+
eventName: "onSlideChangeComplete";
|
|
40
|
+
slideDirection: SlideDirection;
|
|
41
|
+
sliceActionType: SlideActionType;
|
|
42
|
+
currentItem: {
|
|
43
|
+
index: number;
|
|
44
|
+
id: string;
|
|
45
|
+
startReached: boolean | undefined;
|
|
46
|
+
endReached: boolean | undefined;
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
declare type OnSlideStartChange = {
|
|
51
|
+
eventName: "onSlideStartChange";
|
|
52
|
+
slideDirection: SlideDirection;
|
|
53
|
+
sliceActionType: SlideActionType;
|
|
54
|
+
nextItem: {
|
|
55
|
+
index: number;
|
|
56
|
+
id: string;
|
|
57
|
+
startReached: boolean | undefined;
|
|
58
|
+
endReached: boolean | undefined;
|
|
59
|
+
};
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
declare type Props = {
|
|
63
|
+
init?: boolean;
|
|
64
|
+
slideType?: SlideType;
|
|
65
|
+
items: Item[];
|
|
66
|
+
withLoop?: boolean;
|
|
67
|
+
enableGestures?: boolean;
|
|
68
|
+
carouselAxis?: "x" | "y";
|
|
69
|
+
slideWhenDragThresholdIsReached?: boolean;
|
|
70
|
+
gutter?: number;
|
|
71
|
+
startEndGutter?: number;
|
|
72
|
+
fadeIn?: boolean;
|
|
73
|
+
} & (FixedSlideTypeProps | FluidSlideTypeProps | FreeScrollSlideTypeProps);
|
|
74
|
+
|
|
75
|
+
declare type SlideActionType = "drag" | "click";
|
|
76
|
+
|
|
77
|
+
declare type SlideDirection = "prev" | "next";
|
|
78
|
+
|
|
79
|
+
declare type SlideType = "fixed" | "fluid" | "freeScroll";
|
|
80
|
+
|
|
81
|
+
declare type SpringCarouselEvents = OnSlideStartChange | OnSlideChangeComplete | OnDrag;
|
|
82
|
+
|
|
83
|
+
declare type SpringCarouselEventsEventHandler = (props: SpringCarouselEvents) => void;
|
|
84
|
+
|
|
85
|
+
export declare function useSpringCarousel({ init, items: _items, slideType, scrollAmount: _scrollAmount, withLoop, enableGestures, carouselAxis, slideWhenDragThresholdIsReached, itemsPerSlide: _itemsPerSlide, scrollAmountType: _scrollAmountType, gutter, startEndGutter, fadeIn, }: Props): {
|
|
86
|
+
carouselFragment: JSX_2.Element;
|
|
87
|
+
useListenToCustomEvent: (eventHandler: SpringCarouselEventsEventHandler) => void;
|
|
88
|
+
slideToNextItem: () => void;
|
|
89
|
+
slideToPrevItem: () => void;
|
|
90
|
+
slideToIem: (id: string | number) => void;
|
|
91
|
+
handleThumbsContainerScroll: ({ getContainer, activeItem, updateTotalValue, }: {
|
|
92
|
+
activeItem: number;
|
|
93
|
+
getContainer(): HTMLElement | null;
|
|
94
|
+
updateTotalValue?(props: {
|
|
95
|
+
from: number;
|
|
96
|
+
to: number;
|
|
97
|
+
itemOutOfViewport: {
|
|
98
|
+
isOut: boolean;
|
|
99
|
+
direction: "start" | "end" | null;
|
|
100
|
+
};
|
|
101
|
+
}): number;
|
|
102
|
+
}) => void;
|
|
103
|
+
carouselId: string;
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
export { }
|