react-spring-carousel 3.0.0-beta067 → 3.0.0-beta070

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 (43) hide show
  1. package/dist/index.cjs +1 -0
  2. package/dist/index.d.ts +3 -0
  3. package/dist/index.js +18 -0
  4. package/dist/index2.cjs +1 -0
  5. package/dist/index2.js +10 -0
  6. package/dist/{types/modules → modules}/index.d.ts +3 -3
  7. package/dist/{types/modules → modules}/useEventsModule.d.ts +51 -51
  8. package/dist/{types/modules → modules}/useFullscreenModule.d.ts +12 -12
  9. package/dist/{types/modules → modules}/useThumbsModule.d.ts +14 -14
  10. package/dist/types/{types/common.d.ts → common.d.ts} +34 -34
  11. package/dist/types/index.d.ts +4 -3
  12. package/dist/types/{types/useSpringCarousel.types.d.ts → useSpringCarousel.types.d.ts} +102 -102
  13. package/dist/types/{types/useTransitionCarousel.types.d.ts → useTransitionCarousel.types.d.ts} +33 -33
  14. package/dist/useFullscreenModule-55ea7b9d.js +38 -0
  15. package/dist/useFullscreenModule-be189d5b.cjs +1 -0
  16. package/dist/useSpringCarousel.cjs +1 -0
  17. package/dist/{types/useSpringCarousel.d.ts → useSpringCarousel.d.ts} +18 -18
  18. package/dist/useSpringCarousel.js +658 -0
  19. package/dist/useThumbsModule-0c05dcf5.cjs +27 -0
  20. package/dist/useThumbsModule-db93025f.js +753 -0
  21. package/dist/useTransitionCarousel.cjs +1 -0
  22. package/dist/{types/useTransitionCarousel.d.ts → useTransitionCarousel.d.ts} +5 -5
  23. package/dist/useTransitionCarousel.js +257 -0
  24. package/package.json +37 -48
  25. package/README.md +0 -54
  26. package/dist/cjs/index.js +0 -2
  27. package/dist/cjs/index.js.map +0 -1
  28. package/dist/esm/index.js +0 -2
  29. package/dist/esm/index.js.map +0 -1
  30. package/dist/esm/index2.js +0 -2
  31. package/dist/esm/index2.js.map +0 -1
  32. package/dist/esm/useFullscreenModule-519d337d.js +0 -2
  33. package/dist/esm/useFullscreenModule-519d337d.js.map +0 -1
  34. package/dist/esm/useSpringCarousel.js +0 -2
  35. package/dist/esm/useSpringCarousel.js.map +0 -1
  36. package/dist/esm/useThumbsModule-faa196f9.js +0 -2
  37. package/dist/esm/useThumbsModule-faa196f9.js.map +0 -1
  38. package/dist/esm/useTransitionCarousel.js +0 -2
  39. package/dist/esm/useTransitionCarousel.js.map +0 -1
  40. package/dist/types/mockedItems.d.ts +0 -2
  41. package/dist/types/types/index.d.ts +0 -4
  42. package/dist/umd/index.js +0 -2
  43. package/dist/umd/index.js.map +0 -1
package/dist/index.cjs ADDED
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./useSpringCarousel.cjs"),u=require("./useTransitionCarousel.cjs"),s=require("./useThumbsModule-0c05dcf5.cjs"),r=require("./useFullscreenModule-be189d5b.cjs");require("@react-spring/web");require("react");require("@use-gesture/react");require("resize-observer-polyfill");require("screenfull");exports.useSpringCarousel=e.useSpringCarousel;exports.useSpringCarouselContext=e.useSpringCarouselContext;exports.useTransitionCarousel=u.useTransitionCarousel;exports.useTransitionCarouselContext=u.useTransitionCarouselContext;exports.useEventsModule=s.useEventsModule;exports.useThumbsModule=s.useThumbsModule;exports.useFullscreenModule=r.useFullscreenModule;
@@ -0,0 +1,3 @@
1
+ export * from './useSpringCarousel';
2
+ export * from './useTransitionCarousel';
3
+ export * from './types';
package/dist/index.js ADDED
@@ -0,0 +1,18 @@
1
+ import { useSpringCarousel as p, useSpringCarouselContext as a } from "./useSpringCarousel.js";
2
+ import { useTransitionCarousel as n, useTransitionCarouselContext as l } from "./useTransitionCarousel.js";
3
+ import { u as C, a as f } from "./useThumbsModule-db93025f.js";
4
+ import { u as M } from "./useFullscreenModule-55ea7b9d.js";
5
+ import "@react-spring/web";
6
+ import "react";
7
+ import "@use-gesture/react";
8
+ import "resize-observer-polyfill";
9
+ import "screenfull";
10
+ export {
11
+ C as useEventsModule,
12
+ M as useFullscreenModule,
13
+ p as useSpringCarousel,
14
+ a as useSpringCarouselContext,
15
+ f as useThumbsModule,
16
+ n as useTransitionCarousel,
17
+ l as useTransitionCarouselContext
18
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./useThumbsModule-0c05dcf5.cjs"),u=require("./useFullscreenModule-be189d5b.cjs");require("react");require("@react-spring/web");require("screenfull");exports.useEventsModule=e.useEventsModule;exports.useThumbsModule=e.useThumbsModule;exports.useFullscreenModule=u.useFullscreenModule;
package/dist/index2.js ADDED
@@ -0,0 +1,10 @@
1
+ import { u as m, a as t } from "./useThumbsModule-db93025f.js";
2
+ import { u as p } from "./useFullscreenModule-55ea7b9d.js";
3
+ import "react";
4
+ import "@react-spring/web";
5
+ import "screenfull";
6
+ export {
7
+ m as useEventsModule,
8
+ p as useFullscreenModule,
9
+ t as useThumbsModule
10
+ };
@@ -1,3 +1,3 @@
1
- export * from './useEventsModule';
2
- export * from './useFullscreenModule';
3
- export * from './useThumbsModule';
1
+ export * from './useEventsModule';
2
+ export * from './useFullscreenModule';
3
+ export * from './useThumbsModule';
@@ -1,51 +1,51 @@
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 '../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,12 +1,12 @@
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 { 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,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 { 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,3 +1,4 @@
1
- export * from './useSpringCarousel';
2
- export * from './useTransitionCarousel';
3
- export * from './types';
1
+ export * from './common';
2
+ export * from './useSpringCarousel.types';
3
+ export * from './useTransitionCarousel.types';
4
+ export * from '../modules';
@@ -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 { 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,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 '../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 {};
@@ -0,0 +1,38 @@
1
+ import { useRef as o, useEffect as a } from "react";
2
+ import e from "screenfull";
3
+ function F({
4
+ mainCarouselWrapperRef: c,
5
+ onFullScreenChange: r,
6
+ handleResize: u
7
+ }) {
8
+ const t = o(!1);
9
+ a(() => {
10
+ function n() {
11
+ document.fullscreenElement && (l(!0), r(!0), u && u()), document.fullscreenElement || (l(!1), r(!1), u && u());
12
+ }
13
+ if (e.isEnabled)
14
+ return e.on("change", n), () => {
15
+ e.isEnabled && e.off("change", n);
16
+ };
17
+ }, []);
18
+ function l(n) {
19
+ t.current = n;
20
+ }
21
+ function f() {
22
+ return t.current;
23
+ }
24
+ function s(n) {
25
+ e.isEnabled && e.request(n || c.current);
26
+ }
27
+ function i() {
28
+ e.isEnabled && e.exit();
29
+ }
30
+ return {
31
+ enterFullscreen: s,
32
+ exitFullscreen: i,
33
+ getIsFullscreen: f
34
+ };
35
+ }
36
+ export {
37
+ F as u
38
+ };
@@ -0,0 +1 @@
1
+ "use strict";const s=require("react"),e=require("screenfull");function a({mainCarouselWrapperRef:c,onFullScreenChange:r,handleResize:u}){const t=s.useRef(!1);s.useEffect(()=>{function n(){document.fullscreenElement&&(l(!0),r(!0),u&&u()),document.fullscreenElement||(l(!1),r(!1),u&&u())}if(e.isEnabled)return e.on("change",n),()=>{e.isEnabled&&e.off("change",n)}},[]);function l(n){t.current=n}function f(){return t.current}function i(n){e.isEnabled&&e.request(n||c.current)}function o(){e.isEnabled&&e.exit()}return{enterFullscreen:i,exitFullscreen:o,getIsFullscreen:f}}exports.useFullscreenModule=a;