react-spring-carousel 3.0.0-beta068 → 3.0.0-beta071

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.
Files changed (45) hide show
  1. package/dist/{types → declarations}/index.d.ts +3 -3
  2. package/dist/declarations/modules/index.d.ts +1 -0
  3. package/dist/declarations/modules/useEventsModule.d.ts +5 -0
  4. package/dist/{types → declarations}/modules/useFullscreenModule.d.ts +6 -12
  5. package/dist/{types → declarations}/modules/useThumbsModule.d.ts +14 -14
  6. package/dist/{types → declarations}/types/common.d.ts +34 -34
  7. package/dist/{types → declarations}/types/index.d.ts +3 -4
  8. package/dist/{types/modules/useEventsModule.d.ts → declarations/types/useEventsModule.types.d.ts} +46 -51
  9. package/dist/declarations/types/useFullscreenModule.types.d.ts +6 -0
  10. package/dist/{types → declarations}/types/useSpringCarousel.types.d.ts +102 -102
  11. package/dist/{types → declarations}/types/useTransitionCarousel.types.d.ts +33 -33
  12. package/dist/{types → declarations}/useSpringCarousel.d.ts +18 -18
  13. package/dist/{types → declarations}/useTransitionCarousel.d.ts +5 -5
  14. package/dist/index.cjs +1 -0
  15. package/dist/index.js +15 -0
  16. package/dist/index2.cjs +1 -0
  17. package/dist/index2.js +6 -0
  18. package/dist/useEventsModule-0feadbf7.cjs +1 -0
  19. package/dist/useEventsModule-538b90c9.js +33 -0
  20. package/dist/useSpringCarousel.cjs +1 -0
  21. package/dist/useSpringCarousel.js +665 -0
  22. package/dist/useThumbsModule-57ac2128.cjs +27 -0
  23. package/dist/useThumbsModule-f5b73ecb.js +723 -0
  24. package/dist/useTransitionCarousel.cjs +1 -0
  25. package/dist/useTransitionCarousel.js +255 -0
  26. package/package.json +37 -48
  27. package/README.md +0 -54
  28. package/dist/cjs/index.js +0 -2
  29. package/dist/cjs/index.js.map +0 -1
  30. package/dist/esm/index.js +0 -2
  31. package/dist/esm/index.js.map +0 -1
  32. package/dist/esm/index2.js +0 -2
  33. package/dist/esm/index2.js.map +0 -1
  34. package/dist/esm/useFullscreenModule-519d337d.js +0 -2
  35. package/dist/esm/useFullscreenModule-519d337d.js.map +0 -1
  36. package/dist/esm/useSpringCarousel.js +0 -2
  37. package/dist/esm/useSpringCarousel.js.map +0 -1
  38. package/dist/esm/useThumbsModule-faa196f9.js +0 -2
  39. package/dist/esm/useThumbsModule-faa196f9.js.map +0 -1
  40. package/dist/esm/useTransitionCarousel.js +0 -2
  41. package/dist/esm/useTransitionCarousel.js.map +0 -1
  42. package/dist/types/mockedItems.d.ts +0 -2
  43. package/dist/types/modules/index.d.ts +0 -3
  44. package/dist/umd/index.js +0 -2
  45. package/dist/umd/index.js.map +0 -1
@@ -1,3 +1,3 @@
1
- export * from './useSpringCarousel';
2
- export * from './useTransitionCarousel';
3
- export * from './types';
1
+ export * from './useSpringCarousel';
2
+ export * from './useTransitionCarousel';
3
+ export * from './types';
@@ -0,0 +1 @@
1
+ export * from './useThumbsModule';
@@ -0,0 +1,5 @@
1
+ import { EventHandler, Events } from '../types/useEventsModule.types';
2
+ export declare function useEventsModule<T extends 'use-spring' | 'use-transition'>(): {
3
+ useListenToCustomEvent: (eventHandler: EventHandler<T>) => void;
4
+ emitEvent: (event: Events<T>) => void;
5
+ };
@@ -1,12 +1,6 @@
1
- import { MutableRefObject } from 'react';
2
- type FullscreenModule = {
3
- mainCarouselWrapperRef: MutableRefObject<HTMLDivElement | null>;
4
- handleResize?(): void;
5
- onFullScreenChange(isFullscreen: boolean): void;
6
- };
7
- export declare function useFullscreenModule({ mainCarouselWrapperRef, onFullScreenChange, handleResize, }: FullscreenModule): {
8
- enterFullscreen: (elementRef?: HTMLElement) => void;
9
- exitFullscreen: () => void;
10
- getIsFullscreen: () => boolean;
11
- };
12
- export {};
1
+ import { FullscreenModule } from '../types/useFullscreenModule.types';
2
+ export declare function useFullscreenModule({ mainCarouselWrapperRef, onFullScreenChange, handleResize, }: FullscreenModule): {
3
+ enterFullscreen: (elementRef?: HTMLElement) => void;
4
+ exitFullscreen: () => void;
5
+ getIsFullscreen: () => boolean;
6
+ };
@@ -1,14 +1,14 @@
1
- /// <reference types="react" />
2
- import { ItemWithThumb, PrepareThumbsData, RenderItemProps, SpringCarouselWithThumbs } from '../types';
3
- type Props<T extends 'use-spring' | 'use-transition'> = {
4
- withThumbs?: boolean;
5
- thumbsSlideAxis: SpringCarouselWithThumbs['thumbsSlideAxis'];
6
- prepareThumbsData?: PrepareThumbsData<T>;
7
- items: ItemWithThumb<T>[];
8
- renderThumbFnProps: RenderItemProps<T>;
9
- };
10
- export declare function useThumbsModule<T extends 'use-spring' | 'use-transition'>({ thumbsSlideAxis, withThumbs, prepareThumbsData, items, renderThumbFnProps, }: Props<T>): {
11
- thumbsFragment: JSX.Element | null;
12
- handleScroll: (activeItem: number) => void;
13
- };
14
- export {};
1
+ /// <reference types="react" />
2
+ import { ItemWithThumb, PrepareThumbsData, RenderItemProps, SpringCarouselWithThumbs } from '../types';
3
+ type Props<T extends 'use-spring' | 'use-transition'> = {
4
+ withThumbs?: boolean;
5
+ thumbsSlideAxis: SpringCarouselWithThumbs['thumbsSlideAxis'];
6
+ prepareThumbsData?: PrepareThumbsData<T>;
7
+ items: ItemWithThumb<T>[];
8
+ renderThumbFnProps: RenderItemProps<T>;
9
+ };
10
+ export declare function useThumbsModule<T extends 'use-spring' | 'use-transition'>({ thumbsSlideAxis, withThumbs, prepareThumbsData, items, renderThumbFnProps, }: Props<T>): {
11
+ thumbsFragment: JSX.Element | null;
12
+ handleScroll: (activeItem: number) => void;
13
+ };
14
+ export {};
@@ -1,34 +1,34 @@
1
- import { ReactNode } from 'react';
2
- import { UseListenToCustomEvent } from '../modules/useEventsModule';
3
- import { UseSpringReturnType } from './useSpringCarousel.types';
4
- export type SlideActionType = 'prev' | 'next' | 'initial';
5
- export type SlideMode = 'drag' | 'click' | 'initial';
6
- export type TransitionSlideMode = 'swipe' | 'click' | 'initial';
7
- type SpringRenderItem = {
8
- useListenToCustomEvent: UseListenToCustomEvent<'use-spring'>['useListenToCustomEvent'];
9
- getIsActiveItem: UseSpringReturnType['getIsActiveItem'];
10
- getIsPrevItem: UseSpringReturnType['getIsPrevItem'];
11
- getIsNextItem: UseSpringReturnType['getIsNextItem'];
12
- };
13
- type TransitionRenderItem = {
14
- getIsPrevItem: UseSpringReturnType['getIsPrevItem'];
15
- getIsNextItem: UseSpringReturnType['getIsNextItem'];
16
- useListenToCustomEvent: UseListenToCustomEvent<'use-transition'>['useListenToCustomEvent'];
17
- activeItem: {
18
- index: number;
19
- id: string;
20
- };
21
- };
22
- export type RenderItemProps<T> = T extends 'use-spring' ? SpringRenderItem : TransitionRenderItem;
23
- type RenderItemFn<T> = (props: RenderItemProps<T>) => JSX.Element;
24
- export type ItemWithThumb<T extends 'use-spring' | 'use-transition'> = {
25
- id: string;
26
- renderItem: ReactNode | RenderItemFn<T>;
27
- renderThumb: ReactNode | RenderItemFn<T>;
28
- };
29
- export type ItemWithNoThumb<T extends 'use-spring' | 'use-transition'> = {
30
- id: string;
31
- renderItem: ReactNode | RenderItemFn<T>;
32
- };
33
- export type PrepareThumbsData<T extends 'use-spring' | 'use-transition'> = (items: Omit<ItemWithThumb<T>, 'renderItem'>[]) => Omit<ItemWithThumb<T>, 'renderItem'>[];
34
- export {};
1
+ import { ReactNode } from 'react';
2
+ import { UseSpringReturnType } from './useSpringCarousel.types';
3
+ import { UseListenToCustomEvent } from './useEventsModule.types';
4
+ export type SlideActionType = 'prev' | 'next' | 'initial';
5
+ export type SlideMode = 'drag' | 'click' | 'initial';
6
+ export type TransitionSlideMode = 'swipe' | 'click' | 'initial';
7
+ type SpringRenderItem = {
8
+ useListenToCustomEvent: UseListenToCustomEvent<'use-spring'>['useListenToCustomEvent'];
9
+ getIsActiveItem: UseSpringReturnType['getIsActiveItem'];
10
+ getIsPrevItem: UseSpringReturnType['getIsPrevItem'];
11
+ getIsNextItem: UseSpringReturnType['getIsNextItem'];
12
+ };
13
+ type TransitionRenderItem = {
14
+ getIsPrevItem: UseSpringReturnType['getIsPrevItem'];
15
+ getIsNextItem: UseSpringReturnType['getIsNextItem'];
16
+ useListenToCustomEvent: UseListenToCustomEvent<'use-transition'>['useListenToCustomEvent'];
17
+ activeItem: {
18
+ index: number;
19
+ id: string;
20
+ };
21
+ };
22
+ export type RenderItemProps<T> = T extends 'use-spring' ? SpringRenderItem : TransitionRenderItem;
23
+ type RenderItemFn<T> = (props: RenderItemProps<T>) => JSX.Element;
24
+ export type ItemWithThumb<T extends 'use-spring' | 'use-transition'> = {
25
+ id: string;
26
+ renderItem: ReactNode | RenderItemFn<T>;
27
+ renderThumb: ReactNode | RenderItemFn<T>;
28
+ };
29
+ export type ItemWithNoThumb<T extends 'use-spring' | 'use-transition'> = {
30
+ id: string;
31
+ renderItem: ReactNode | RenderItemFn<T>;
32
+ };
33
+ export type PrepareThumbsData<T extends 'use-spring' | 'use-transition'> = (items: Omit<ItemWithThumb<T>, 'renderItem'>[]) => Omit<ItemWithThumb<T>, 'renderItem'>[];
34
+ export {};
@@ -1,4 +1,3 @@
1
- export * from './common';
2
- export * from './useSpringCarousel.types';
3
- export * from './useTransitionCarousel.types';
4
- export * from '../modules';
1
+ export * from './common';
2
+ export * from './useSpringCarousel.types';
3
+ export * from './useTransitionCarousel.types';
@@ -1,51 +1,46 @@
1
- import { FullGestureState } from '@use-gesture/react';
2
- import { SlideActionType, SlideMode, TransitionSlideMode } from '../types/common';
3
- type OnSlideStartChange<T> = {
4
- eventName: 'onSlideStartChange';
5
- slideActionType: SlideActionType;
6
- slideMode: T extends 'use-spring' ? SlideMode : TransitionSlideMode;
7
- nextItem: {
8
- index: number;
9
- id: string;
10
- startReached: boolean;
11
- endReached: boolean;
12
- };
13
- };
14
- type OnSlideChange<T> = {
15
- eventName: 'onSlideChange';
16
- slideActionType: SlideActionType;
17
- slideMode: T extends 'use-spring' ? SlideMode : TransitionSlideMode;
18
- currentItem: {
19
- index: number;
20
- id: string;
21
- startReached: boolean;
22
- endReached: boolean;
23
- };
24
- };
25
- type OnFullscreenChange = {
26
- eventName: 'onFullscreenChange';
27
- isFullscreen: boolean;
28
- };
29
- type OnDrag = Omit<FullGestureState<'drag'>, 'event'> & {
30
- eventName: 'onDrag';
31
- slideActionType: SlideActionType;
32
- };
33
- type OnLeftSwipe = {
34
- eventName: 'onLeftSwipe';
35
- };
36
- type OnRightSwipe = {
37
- eventName: 'onRightSwipe';
38
- };
39
- type SpringCarouselEvents<T> = OnSlideStartChange<T> | OnSlideChange<T> | OnDrag | OnFullscreenChange;
40
- type TransitionCarouselEvents<T> = OnSlideStartChange<T> | OnSlideChange<T> | OnFullscreenChange | OnLeftSwipe | OnRightSwipe;
41
- type Events<T> = T extends 'use-spring' ? SpringCarouselEvents<'use-spring'> : TransitionCarouselEvents<'use-transition'>;
42
- type EventHandler<T> = (props: Events<T>) => void;
43
- export type UseListenToCustomEvent<T> = {
44
- useListenToCustomEvent: (eventHandler: EventHandler<T>) => void;
45
- emitEvent: (event: Events<T>) => void;
46
- };
47
- export declare function useEventsModule<T extends 'use-spring' | 'use-transition'>(): {
48
- useListenToCustomEvent: (eventHandler: EventHandler<T>) => void;
49
- emitEvent: (event: Events<T>) => void;
50
- };
51
- export {};
1
+ import { FullGestureState } from '@use-gesture/react';
2
+ import { SlideActionType, SlideMode, TransitionSlideMode } from './common';
3
+ export type OnSlideStartChange<T> = {
4
+ eventName: 'onSlideStartChange';
5
+ slideActionType: SlideActionType;
6
+ slideMode: T extends 'use-spring' ? SlideMode : TransitionSlideMode;
7
+ nextItem: {
8
+ index: number;
9
+ id: string;
10
+ startReached: boolean;
11
+ endReached: boolean;
12
+ };
13
+ };
14
+ export type OnSlideChange<T> = {
15
+ eventName: 'onSlideChange';
16
+ slideActionType: SlideActionType;
17
+ slideMode: T extends 'use-spring' ? SlideMode : TransitionSlideMode;
18
+ currentItem: {
19
+ index: number;
20
+ id: string;
21
+ startReached: boolean;
22
+ endReached: boolean;
23
+ };
24
+ };
25
+ export type OnFullscreenChange = {
26
+ eventName: 'onFullscreenChange';
27
+ isFullscreen: boolean;
28
+ };
29
+ export type OnDrag = Omit<FullGestureState<'drag'>, 'event'> & {
30
+ eventName: 'onDrag';
31
+ slideActionType: SlideActionType;
32
+ };
33
+ export type OnLeftSwipe = {
34
+ eventName: 'onLeftSwipe';
35
+ };
36
+ export type OnRightSwipe = {
37
+ eventName: 'onRightSwipe';
38
+ };
39
+ export type SpringCarouselEvents<T> = OnSlideStartChange<T> | OnSlideChange<T> | OnDrag | OnFullscreenChange;
40
+ export type TransitionCarouselEvents<T> = OnSlideStartChange<T> | OnSlideChange<T> | OnFullscreenChange | OnLeftSwipe | OnRightSwipe;
41
+ export type Events<T> = T extends 'use-spring' ? SpringCarouselEvents<'use-spring'> : TransitionCarouselEvents<'use-transition'>;
42
+ export type EventHandler<T> = (props: Events<T>) => void;
43
+ export type UseListenToCustomEvent<T> = {
44
+ useListenToCustomEvent: (eventHandler: EventHandler<T>) => void;
45
+ emitEvent: (event: Events<T>) => void;
46
+ };
@@ -0,0 +1,6 @@
1
+ import { MutableRefObject } from 'react';
2
+ export type FullscreenModule = {
3
+ mainCarouselWrapperRef: MutableRefObject<HTMLDivElement | null>;
4
+ handleResize?(): void;
5
+ onFullScreenChange(isFullscreen: boolean): void;
6
+ };
@@ -1,102 +1,102 @@
1
- import { ReactNode } from 'react';
2
- import { UseListenToCustomEvent } from '../modules/useEventsModule';
3
- import { ItemWithThumb, ItemWithNoThumb, PrepareThumbsData } from '../types';
4
- export type UseSpringReturnType = {
5
- carouselFragment: ReactNode;
6
- thumbsFragment: ReactNode;
7
- useListenToCustomEvent: UseListenToCustomEvent<'use-spring'>['useListenToCustomEvent'];
8
- getIsFullscreen(): boolean;
9
- enterFullscreen(ref?: HTMLElement): void;
10
- exitFullscreen(): void;
11
- slideToNextItem(animate?: boolean): void;
12
- slideToPrevItem(animate?: boolean): void;
13
- slideToItem(item: string | number, animate?: boolean): void;
14
- getIsActiveItem(id: string): boolean;
15
- getIsNextItem(id: string | number): boolean;
16
- getIsPrevItem(id: string | number): boolean;
17
- };
18
- export type UseSpringFreeScrollReturnType = {
19
- carouselFragment: ReactNode;
20
- thumbsFragment: ReactNode;
21
- useListenToCustomEvent: UseListenToCustomEvent<'use-spring'>['useListenToCustomEvent'];
22
- getIsFullscreen(): boolean;
23
- enterFullscreen(ref?: HTMLElement): void;
24
- exitFullscreen(): void;
25
- slideToNextItem(animate?: boolean): void;
26
- slideToPrevItem(animate?: boolean): void;
27
- };
28
- export type SlideType = 'fixed' | 'fluid';
29
- export type SpringCarouselWithThumbs<T extends 'use-spring' | 'use-transition' = 'use-spring'> = {
30
- withThumbs: true;
31
- thumbsSlideAxis?: 'x' | 'y';
32
- items: ItemWithThumb<T>[];
33
- prepareThumbsData?: PrepareThumbsData<T>;
34
- };
35
- export type SpringCarouselWithNoThumbs<T extends 'use-spring' | 'use-transition' = 'use-spring'> = {
36
- withThumbs?: false | undefined;
37
- thumbsSlideAxis?: never;
38
- items: ItemWithNoThumb<T>[];
39
- prepareThumbsData?: never;
40
- };
41
- export type SpringCarouselWithFixedItems = {
42
- slideType?: SlideType[0];
43
- itemsPerSlide?: number;
44
- startEndGutter?: number;
45
- initialActiveItem?: number;
46
- };
47
- export type SpringCarouselWithNoFixedItems = {
48
- slideType?: SlideType[1];
49
- itemsPerSlide?: never;
50
- startEndGutter?: never;
51
- initialActiveItem?: never;
52
- };
53
- export type SpringCarouselWithLoop = {
54
- withLoop: true;
55
- initialStartingPosition?: 'start' | 'center' | 'end';
56
- };
57
- export type SpringCarouselWithNoLoop = {
58
- withLoop?: false | undefined;
59
- initialStartingPosition?: never;
60
- };
61
- export type SpringCarouselFreeScroll = {
62
- freeScroll: true;
63
- withLoop?: never;
64
- slideType?: never;
65
- enableFreeScrollDrag?: true | false;
66
- initialActiveItem?: never;
67
- itemsPerSlide?: never;
68
- animateWhenActiveItemChange?: never;
69
- slideWhenThresholdIsReached?: never;
70
- };
71
- export type SpringCarouselNoFreeScroll = {
72
- freeScroll?: never | false | undefined;
73
- withLoop?: boolean;
74
- slideType?: SlideType;
75
- enableFreeScrollDrag?: never;
76
- initialActiveItem?: number;
77
- itemsPerSlide?: number;
78
- animateWhenActiveItemChange?: boolean;
79
- slideWhenThresholdIsReached?: boolean;
80
- };
81
- export type ControllerRef = {
82
- slideToNextItem: UseSpringReturnType['slideToNextItem'];
83
- slideToPrevItem: UseSpringReturnType['slideToPrevItem'];
84
- slideToItem?: UseSpringReturnType['slideToItem'];
85
- };
86
- export type BaseProps = {
87
- init?: boolean;
88
- gutter?: number;
89
- carouselSlideAxis?: 'x' | 'y';
90
- draggingSlideTreshold?: number;
91
- disableGestures?: boolean;
92
- startEndGutter?: number;
93
- getControllerRef?(ref: ControllerRef): void;
94
- };
95
- type ScrollType<T> = T extends true ? SpringCarouselFreeScroll : SpringCarouselNoFreeScroll;
96
- export type UseSpringCarouselWithThumbs<T> = BaseProps & SpringCarouselWithThumbs & ScrollType<T> & (SpringCarouselWithFixedItems | SpringCarouselWithNoFixedItems) & (SpringCarouselWithLoop | SpringCarouselWithNoLoop);
97
- export type UseSpringCarouselWithNoThumbs<T> = BaseProps & SpringCarouselWithNoThumbs & ScrollType<T> & (SpringCarouselWithFixedItems | SpringCarouselWithNoFixedItems) & (SpringCarouselWithLoop | SpringCarouselWithNoLoop);
98
- export type UseSpringCarouselWithFixedItems<T> = BaseProps & SpringCarouselWithFixedItems & ScrollType<T> & (SpringCarouselWithThumbs | SpringCarouselWithNoThumbs) & (SpringCarouselWithLoop | SpringCarouselWithNoLoop);
99
- export type UseSpringCarouselWithNoFixedItems<T> = BaseProps & SpringCarouselWithNoFixedItems & ScrollType<T> & (SpringCarouselWithThumbs | SpringCarouselWithNoThumbs) & (SpringCarouselWithLoop | SpringCarouselWithNoLoop);
100
- export type UseSpringCarouselWithFreeScroll = BaseProps & SpringCarouselFreeScroll & (SpringCarouselWithThumbs | SpringCarouselWithNoThumbs);
101
- export type UseSpringCarouselComplete = BaseProps & (SpringCarouselWithThumbs | SpringCarouselWithNoThumbs) & (SpringCarouselWithFixedItems | SpringCarouselWithNoFixedItems) & (SpringCarouselWithLoop | SpringCarouselWithNoLoop) & (SpringCarouselFreeScroll | SpringCarouselNoFreeScroll);
102
- export {};
1
+ import { ReactNode } from 'react';
2
+ import { ItemWithThumb, ItemWithNoThumb, PrepareThumbsData } from '../types';
3
+ import { UseListenToCustomEvent } from './useEventsModule.types';
4
+ export type UseSpringReturnType = {
5
+ carouselFragment: ReactNode;
6
+ thumbsFragment: ReactNode;
7
+ useListenToCustomEvent: UseListenToCustomEvent<'use-spring'>['useListenToCustomEvent'];
8
+ getIsFullscreen(): boolean;
9
+ enterFullscreen(ref?: HTMLElement): void;
10
+ exitFullscreen(): void;
11
+ slideToNextItem(animate?: boolean): void;
12
+ slideToPrevItem(animate?: boolean): void;
13
+ slideToItem(item: string | number, animate?: boolean): void;
14
+ getIsActiveItem(id: string): boolean;
15
+ getIsNextItem(id: string | number): boolean;
16
+ getIsPrevItem(id: string | number): boolean;
17
+ };
18
+ export type UseSpringFreeScrollReturnType = {
19
+ carouselFragment: ReactNode;
20
+ thumbsFragment: ReactNode;
21
+ useListenToCustomEvent: UseListenToCustomEvent<'use-spring'>['useListenToCustomEvent'];
22
+ getIsFullscreen(): boolean;
23
+ enterFullscreen(ref?: HTMLElement): void;
24
+ exitFullscreen(): void;
25
+ slideToNextItem(animate?: boolean): void;
26
+ slideToPrevItem(animate?: boolean): void;
27
+ };
28
+ export type SlideType = 'fixed' | 'fluid';
29
+ export type SpringCarouselWithThumbs<T extends 'use-spring' | 'use-transition' = 'use-spring'> = {
30
+ withThumbs: true;
31
+ thumbsSlideAxis?: 'x' | 'y';
32
+ items: ItemWithThumb<T>[];
33
+ prepareThumbsData?: PrepareThumbsData<T>;
34
+ };
35
+ export type SpringCarouselWithNoThumbs<T extends 'use-spring' | 'use-transition' = 'use-spring'> = {
36
+ withThumbs?: false | undefined;
37
+ thumbsSlideAxis?: never;
38
+ items: ItemWithNoThumb<T>[];
39
+ prepareThumbsData?: never;
40
+ };
41
+ export type SpringCarouselWithFixedItems = {
42
+ slideType?: SlideType[0];
43
+ itemsPerSlide?: number;
44
+ startEndGutter?: number;
45
+ initialActiveItem?: number;
46
+ };
47
+ export type SpringCarouselWithNoFixedItems = {
48
+ slideType?: SlideType[1];
49
+ itemsPerSlide?: never;
50
+ startEndGutter?: never;
51
+ initialActiveItem?: never;
52
+ };
53
+ export type SpringCarouselWithLoop = {
54
+ withLoop: true;
55
+ initialStartingPosition?: 'start' | 'center' | 'end';
56
+ };
57
+ export type SpringCarouselWithNoLoop = {
58
+ withLoop?: false | undefined;
59
+ initialStartingPosition?: never;
60
+ };
61
+ export type SpringCarouselFreeScroll = {
62
+ freeScroll: true;
63
+ withLoop?: never;
64
+ slideType?: never;
65
+ enableFreeScrollDrag?: true | false;
66
+ initialActiveItem?: never;
67
+ itemsPerSlide?: never;
68
+ animateWhenActiveItemChange?: never;
69
+ slideWhenThresholdIsReached?: never;
70
+ };
71
+ export type SpringCarouselNoFreeScroll = {
72
+ freeScroll?: never | false | undefined;
73
+ withLoop?: boolean;
74
+ slideType?: SlideType;
75
+ enableFreeScrollDrag?: never;
76
+ initialActiveItem?: number;
77
+ itemsPerSlide?: number;
78
+ animateWhenActiveItemChange?: boolean;
79
+ slideWhenThresholdIsReached?: boolean;
80
+ };
81
+ export type ControllerRef = {
82
+ slideToNextItem: UseSpringReturnType['slideToNextItem'];
83
+ slideToPrevItem: UseSpringReturnType['slideToPrevItem'];
84
+ slideToItem?: UseSpringReturnType['slideToItem'];
85
+ };
86
+ export type BaseProps = {
87
+ init?: boolean;
88
+ gutter?: number;
89
+ carouselSlideAxis?: 'x' | 'y';
90
+ draggingSlideTreshold?: number;
91
+ disableGestures?: boolean;
92
+ startEndGutter?: number;
93
+ getControllerRef?(ref: ControllerRef): void;
94
+ };
95
+ type ScrollType<T> = T extends true ? SpringCarouselFreeScroll : SpringCarouselNoFreeScroll;
96
+ export type UseSpringCarouselWithThumbs<T> = BaseProps & SpringCarouselWithThumbs & ScrollType<T> & (SpringCarouselWithFixedItems | SpringCarouselWithNoFixedItems) & (SpringCarouselWithLoop | SpringCarouselWithNoLoop);
97
+ export type UseSpringCarouselWithNoThumbs<T> = BaseProps & SpringCarouselWithNoThumbs & ScrollType<T> & (SpringCarouselWithFixedItems | SpringCarouselWithNoFixedItems) & (SpringCarouselWithLoop | SpringCarouselWithNoLoop);
98
+ export type UseSpringCarouselWithFixedItems<T> = BaseProps & SpringCarouselWithFixedItems & ScrollType<T> & (SpringCarouselWithThumbs | SpringCarouselWithNoThumbs) & (SpringCarouselWithLoop | SpringCarouselWithNoLoop);
99
+ export type UseSpringCarouselWithNoFixedItems<T> = BaseProps & SpringCarouselWithNoFixedItems & ScrollType<T> & (SpringCarouselWithThumbs | SpringCarouselWithNoThumbs) & (SpringCarouselWithLoop | SpringCarouselWithNoLoop);
100
+ export type UseSpringCarouselWithFreeScroll = BaseProps & SpringCarouselFreeScroll & (SpringCarouselWithThumbs | SpringCarouselWithNoThumbs);
101
+ export type UseSpringCarouselComplete = BaseProps & (SpringCarouselWithThumbs | SpringCarouselWithNoThumbs) & (SpringCarouselWithFixedItems | SpringCarouselWithNoFixedItems) & (SpringCarouselWithLoop | SpringCarouselWithNoLoop) & (SpringCarouselFreeScroll | SpringCarouselNoFreeScroll);
102
+ export {};
@@ -1,33 +1,33 @@
1
- import { SpringConfig, TransitionFrom, TransitionTo } from '@react-spring/web';
2
- import { ItemWithNoThumb, ItemWithThumb, SpringCarouselWithNoThumbs, SpringCarouselWithThumbs } from '../types';
3
- import { ReactNode } from 'react';
4
- import { UseListenToCustomEvent } from 'src/modules';
5
- type Item = ItemWithThumb<'use-transition'> | ItemWithNoThumb<'use-transition'>;
6
- export type SpringAnimationProps = {
7
- initial: TransitionFrom<Item>;
8
- from: TransitionFrom<Item>;
9
- enter: TransitionTo<Item>;
10
- leave: TransitionTo<Item>;
11
- };
12
- type BaseProps = {
13
- init?: boolean;
14
- disableGestures?: boolean;
15
- springConfig?: Omit<SpringConfig, 'velocity'>;
16
- toPrevItemSpringProps?: SpringAnimationProps;
17
- toNextItemSpringProps?: SpringAnimationProps;
18
- exitBeforeEnter?: boolean;
19
- trail?: number;
20
- withLoop?: boolean;
21
- draggingSlideTreshold?: number;
22
- thumbsSlideAxis?: 'x' | 'y';
23
- activeItem?: number;
24
- };
25
- export type UseTransitionCarouselProps = BaseProps & (SpringCarouselWithThumbs<'use-transition'> | SpringCarouselWithNoThumbs<'use-transition'>);
26
- export type UseTransitionCarouselReturnProps = {
27
- useListenToCustomEvent: UseListenToCustomEvent<'use-transition'>['useListenToCustomEvent'];
28
- carouselFragment: ReactNode;
29
- thumbsFragment: ReactNode;
30
- slideToPrevItem(): void;
31
- slideToNextItem(): void;
32
- };
33
- export {};
1
+ import { SpringConfig, TransitionFrom, TransitionTo } from '@react-spring/web';
2
+ import { ItemWithNoThumb, ItemWithThumb, SpringCarouselWithNoThumbs, SpringCarouselWithThumbs } from '../types';
3
+ import { ReactNode } from 'react';
4
+ import { UseListenToCustomEvent } from './useEventsModule.types';
5
+ type Item = ItemWithThumb<'use-transition'> | ItemWithNoThumb<'use-transition'>;
6
+ export type SpringAnimationProps = {
7
+ initial: TransitionFrom<Item>;
8
+ from: TransitionFrom<Item>;
9
+ enter: TransitionTo<Item>;
10
+ leave: TransitionTo<Item>;
11
+ };
12
+ type BaseProps = {
13
+ init?: boolean;
14
+ disableGestures?: boolean;
15
+ springConfig?: Omit<SpringConfig, 'velocity'>;
16
+ toPrevItemSpringProps?: SpringAnimationProps;
17
+ toNextItemSpringProps?: SpringAnimationProps;
18
+ exitBeforeEnter?: boolean;
19
+ trail?: number;
20
+ withLoop?: boolean;
21
+ draggingSlideTreshold?: number;
22
+ thumbsSlideAxis?: 'x' | 'y';
23
+ activeItem?: number;
24
+ };
25
+ export type UseTransitionCarouselProps = BaseProps & (SpringCarouselWithThumbs<'use-transition'> | SpringCarouselWithNoThumbs<'use-transition'>);
26
+ export type UseTransitionCarouselReturnProps = {
27
+ useListenToCustomEvent: UseListenToCustomEvent<'use-transition'>['useListenToCustomEvent'];
28
+ carouselFragment: ReactNode;
29
+ thumbsFragment: ReactNode;
30
+ slideToPrevItem(): void;
31
+ slideToNextItem(): void;
32
+ };
33
+ export {};
@@ -1,18 +1,18 @@
1
- import { UseSpringCarouselWithFreeScroll, UseSpringCarouselWithThumbs, UseSpringCarouselWithNoThumbs, UseSpringCarouselWithNoFixedItems, UseSpringCarouselWithFixedItems, UseSpringFreeScrollReturnType, UseSpringReturnType } from './types';
2
- type ReturnType<T> = T extends true ? UseSpringFreeScrollReturnType : UseSpringReturnType;
3
- /**
4
- * With free scroll
5
- */
6
- declare function useSpringCarousel(props: UseSpringCarouselWithFreeScroll): ReturnType<true>;
7
- declare function useSpringCarousel(props: UseSpringCarouselWithThumbs<true>): ReturnType<true>;
8
- declare function useSpringCarousel(props: UseSpringCarouselWithNoThumbs<true>): ReturnType<true>;
9
- /**
10
- * No free scroll
11
- */
12
- declare function useSpringCarousel(props: UseSpringCarouselWithThumbs<false>): ReturnType<false>;
13
- declare function useSpringCarousel(props: UseSpringCarouselWithNoThumbs<false>): ReturnType<false>;
14
- declare function useSpringCarousel(props: UseSpringCarouselWithFixedItems<false>): ReturnType<false>;
15
- declare function useSpringCarousel(props: UseSpringCarouselWithNoFixedItems<false>): ReturnType<false>;
16
- type ContextProps<T = undefined> = Omit<ReturnType<T extends 'free-scroll' ? true : false>, 'carouselFragment' | 'thumbsFragment'>;
17
- declare function useSpringCarouselContext<T>(): ContextProps<T>;
18
- export { useSpringCarousel, useSpringCarouselContext };
1
+ import { UseSpringCarouselWithFreeScroll, UseSpringCarouselWithThumbs, UseSpringCarouselWithNoThumbs, UseSpringCarouselWithNoFixedItems, UseSpringCarouselWithFixedItems, UseSpringFreeScrollReturnType, UseSpringReturnType } from './types';
2
+ type ReturnType<T> = T extends true ? UseSpringFreeScrollReturnType : UseSpringReturnType;
3
+ /**
4
+ * With free scroll
5
+ */
6
+ declare function useSpringCarousel(props: UseSpringCarouselWithFreeScroll): ReturnType<true>;
7
+ declare function useSpringCarousel(props: UseSpringCarouselWithThumbs<true>): ReturnType<true>;
8
+ declare function useSpringCarousel(props: UseSpringCarouselWithNoThumbs<true>): ReturnType<true>;
9
+ /**
10
+ * No free scroll
11
+ */
12
+ declare function useSpringCarousel(props: UseSpringCarouselWithThumbs<false>): ReturnType<false>;
13
+ declare function useSpringCarousel(props: UseSpringCarouselWithNoThumbs<false>): ReturnType<false>;
14
+ declare function useSpringCarousel(props: UseSpringCarouselWithFixedItems<false>): ReturnType<false>;
15
+ declare function useSpringCarousel(props: UseSpringCarouselWithNoFixedItems<false>): ReturnType<false>;
16
+ type ContextProps<T = undefined> = Omit<ReturnType<T extends 'free-scroll' ? true : false>, 'carouselFragment' | 'thumbsFragment'>;
17
+ declare function useSpringCarouselContext<T>(): ContextProps<T>;
18
+ export { useSpringCarousel, useSpringCarouselContext };
@@ -1,5 +1,5 @@
1
- import { UseTransitionCarouselProps, UseTransitionCarouselReturnProps } from './types';
2
- declare function useTransitionCarousel({ init, disableGestures, items, springConfig, exitBeforeEnter, trail, withLoop, activeItem: externalActiveItem, toPrevItemSpringProps, toNextItemSpringProps, draggingSlideTreshold, thumbsSlideAxis, }: UseTransitionCarouselProps): UseTransitionCarouselReturnProps;
3
- type ContextProps = Omit<UseTransitionCarouselReturnProps, 'carouselFragment' | 'thumbsFragment'>;
4
- declare function useTransitionCarouselContext(): ContextProps;
5
- export { useTransitionCarousel, useTransitionCarouselContext };
1
+ import { UseTransitionCarouselProps, UseTransitionCarouselReturnProps } from './types';
2
+ declare function useTransitionCarousel({ init, disableGestures, items, springConfig, exitBeforeEnter, trail, withLoop, activeItem: externalActiveItem, toPrevItemSpringProps, toNextItemSpringProps, draggingSlideTreshold, thumbsSlideAxis, }: UseTransitionCarouselProps): UseTransitionCarouselReturnProps;
3
+ type ContextProps = Omit<UseTransitionCarouselReturnProps, 'carouselFragment' | 'thumbsFragment'>;
4
+ declare function useTransitionCarouselContext(): ContextProps;
5
+ export { useTransitionCarousel, useTransitionCarouselContext };
package/dist/index.cjs ADDED
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./useSpringCarousel.cjs"),r=require("./useTransitionCarousel.cjs");require("./useThumbsModule-57ac2128.cjs");require("react");require("@react-spring/web");require("./useEventsModule-0feadbf7.cjs");require("@use-gesture/react");require("resize-observer-polyfill");require("screenfull");exports.useSpringCarousel=e.useSpringCarousel;exports.useSpringCarouselContext=e.useSpringCarouselContext;exports.useTransitionCarousel=r.useTransitionCarousel;exports.useTransitionCarouselContext=r.useTransitionCarouselContext;
package/dist/index.js ADDED
@@ -0,0 +1,15 @@
1
+ import { useSpringCarousel as u, useSpringCarouselContext as a } from "./useSpringCarousel.js";
2
+ import { useTransitionCarousel as l, useTransitionCarouselContext as x } from "./useTransitionCarousel.js";
3
+ import "./useThumbsModule-f5b73ecb.js";
4
+ import "react";
5
+ import "@react-spring/web";
6
+ import "./useEventsModule-538b90c9.js";
7
+ import "@use-gesture/react";
8
+ import "resize-observer-polyfill";
9
+ import "screenfull";
10
+ export {
11
+ u as useSpringCarousel,
12
+ a as useSpringCarouselContext,
13
+ l as useTransitionCarousel,
14
+ x as useTransitionCarouselContext
15
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./useThumbsModule-57ac2128.cjs");require("react");require("@react-spring/web");exports.useThumbsModule=e.useThumbsModule;
package/dist/index2.js ADDED
@@ -0,0 +1,6 @@
1
+ import { u as e } from "./useThumbsModule-f5b73ecb.js";
2
+ import "react";
3
+ import "@react-spring/web";
4
+ export {
5
+ e as useThumbsModule
6
+ };
@@ -0,0 +1 @@
1
+ "use strict";const s=require("react"),u="RSC::Event";function o(){const e=s.useRef(null);function c(t){s.useEffect(()=>{e.current||(e.current=document.createElement("div"));function n(r){t(r.detail)}if(e.current)return e.current.addEventListener(u,n,!1),()=>{var r;(r=e.current)==null||r.removeEventListener(u,n,!1)}},[t])}function i(t){if(e.current){const n=new CustomEvent(u,{detail:t});e.current.dispatchEvent(n)}}return{useListenToCustomEvent:c,emitEvent:i}}exports.useEventsModule=o;