react-spring-carousel 1.9.29-beta1 → 1.9.29-beta101

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.
@@ -0,0 +1,124 @@
1
+ import { ReactNode, HTMLAttributes } from 'react';
2
+ import { SpringConfig } from 'react-spring';
3
+ import { PrepareThumbsData, UseListenToCustomEvent } from './index';
4
+ export declare type UseSpringCarouselBaseProps = {
5
+ disableGestures?: boolean;
6
+ draggingSlideTreshold?: number;
7
+ springConfig?: SpringConfig;
8
+ carouselSlideAxis?: 'x' | 'y';
9
+ gutter?: number;
10
+ shouldResizeOnWindowResize?: boolean;
11
+ };
12
+ /**
13
+ * Types based on withThums prop
14
+ */
15
+ export declare type ReactSpringCarouselItem = {
16
+ id: string;
17
+ renderItem: ReactNode;
18
+ renderThumb?: never;
19
+ };
20
+ export declare type ReactSpringCarouselItemWithThumbs = {
21
+ id: string;
22
+ renderItem: ReactNode;
23
+ renderThumb: ReactNode;
24
+ };
25
+ declare type UseSpringCarouselWithThumbs = {
26
+ withThumbs: true;
27
+ thumbsSlideAxis?: 'x' | 'y';
28
+ items: ReactSpringCarouselItemWithThumbs[];
29
+ enableThumbsWrapperScroll?: boolean;
30
+ CustomThumbsWrapperComponent?: React.FC<HTMLAttributes<HTMLElement>>;
31
+ prepareThumbsData?: PrepareThumbsData;
32
+ };
33
+ declare type UseSpringCarouselWithNoThumbs = {
34
+ withThumbs?: false;
35
+ thumbsSlideAxis?: never;
36
+ items: ReactSpringCarouselItem[];
37
+ enableThumbsWrapperScroll?: never;
38
+ CustomThumbsWrapperComponent?: never;
39
+ prepareThumbsData?: never;
40
+ };
41
+ export declare type ThumbsProps = UseSpringCarouselWithThumbs | UseSpringCarouselWithNoThumbs;
42
+ /**
43
+ * Types based on slideType
44
+ */
45
+ declare type UseSpringCarouselFluidType = {
46
+ slideType: 'fluid';
47
+ slideAmount?: number;
48
+ itemsPerSlide?: never;
49
+ initialActiveItem?: never;
50
+ initialStartingPosition?: never;
51
+ freeScroll?: boolean;
52
+ enableFreeScrollDrag?: boolean | (() => boolean);
53
+ };
54
+ declare type UseSpringCarouselNumericSlideType = {
55
+ slideType?: 'fixed';
56
+ itemsPerSlide?: number;
57
+ initialActiveItem?: number;
58
+ slideAmount?: never;
59
+ initialStartingPosition?: 'start' | 'center' | 'end';
60
+ freeScroll?: never;
61
+ enableFreeScrollDrag?: never;
62
+ };
63
+ declare type SlideTypes = UseSpringCarouselFluidType | UseSpringCarouselNumericSlideType;
64
+ /**
65
+ * Types based on gestures activation
66
+ */
67
+ declare type DisableGesturesProps = {
68
+ disableGestures?: true;
69
+ touchAction?: never;
70
+ };
71
+ declare type EnableGesturesProps = {
72
+ disableGestures?: false;
73
+ touchAction?: string;
74
+ };
75
+ declare type Gestures = DisableGesturesProps | EnableGesturesProps;
76
+ /**
77
+ * Types based on loop functionality
78
+ */
79
+ declare type WithLoopProps = {
80
+ withLoop: true;
81
+ initialStartingPosition?: 'start' | 'center' | 'end';
82
+ startEndGutter?: number;
83
+ };
84
+ declare type WithNoLoop = {
85
+ withLoop?: false;
86
+ initialStartingPosition?: never;
87
+ startEndGutter?: never;
88
+ };
89
+ declare type LoopProps = WithLoopProps | WithNoLoop;
90
+ export declare type UseSpringCarouselProps = UseSpringCarouselBaseProps & ThumbsProps & SlideTypes & Gestures & LoopProps;
91
+ export declare type UseSpringCarouselWithThumbsReturnProps = {
92
+ carouselFragment: ReactNode;
93
+ thumbsFragment: ReactNode;
94
+ useListenToCustomEvent: UseListenToCustomEvent<'use-spring'>;
95
+ getIsFullscreen(): boolean;
96
+ getIsPrevItem(id: string): boolean;
97
+ getIsNextItem(id: string): boolean;
98
+ enterFullscreen(elementRef?: HTMLElement): void;
99
+ exitFullscreen(): void;
100
+ slideToNextItem(): void;
101
+ slideToPrevItem(): void;
102
+ getIsAnimating(): boolean;
103
+ getIsDragging(): boolean;
104
+ };
105
+ export declare type UseSpringDafaultTypeReturnProps = {
106
+ carouselFragment: ReactNode;
107
+ useListenToCustomEvent: UseListenToCustomEvent<'use-spring'>;
108
+ getIsFullscreen(): boolean;
109
+ getIsPrevItem(id: string): boolean;
110
+ getIsNextItem(id: string): boolean;
111
+ enterFullscreen(elementRef?: HTMLElement): void;
112
+ exitFullscreen(): void;
113
+ slideToNextItem(): void;
114
+ slideToPrevItem(): void;
115
+ getIsAnimating(): boolean;
116
+ slideToItem(item: string | number): void;
117
+ getIsActiveItem(id: string): boolean;
118
+ getIsDragging(): boolean;
119
+ getCurrentActiveItem(): {
120
+ id: string;
121
+ index: number;
122
+ };
123
+ };
124
+ export {};
@@ -0,0 +1,39 @@
1
+ import { TransitionFrom, TransitionTo } from 'react-spring';
2
+ import { UseListenToCustomEvent } from './index';
3
+ import { UseSpringCarouselBaseProps, ThumbsProps } from './useSpringCarousel';
4
+ declare type ReactSpringCarouselItem = {
5
+ id: string;
6
+ };
7
+ export declare type SpringAnimationProps = {
8
+ initial: TransitionFrom<ReactSpringCarouselItem>;
9
+ from: TransitionFrom<ReactSpringCarouselItem>;
10
+ enter: TransitionTo<ReactSpringCarouselItem>;
11
+ leave: TransitionTo<ReactSpringCarouselItem>;
12
+ };
13
+ export declare type UseTransitionCarouselProps = UseSpringCarouselBaseProps & ThumbsProps & {
14
+ toPrevItemSpringProps?: SpringAnimationProps;
15
+ toNextItemSpringProps?: SpringAnimationProps;
16
+ springAnimationProps?: SpringAnimationProps;
17
+ withLoop?: boolean;
18
+ exitBeforeEnter?: boolean;
19
+ trail?: number;
20
+ };
21
+ export declare type UseTransitionCarouselContextProps = {
22
+ useListenToCustomEvent: UseListenToCustomEvent<'use-transition'>;
23
+ activeItem: number;
24
+ getIsFullscreen(): boolean;
25
+ getIsPrevItem(id: string): boolean;
26
+ getIsNextItem(id: string): boolean;
27
+ enterFullscreen(elementRef?: HTMLElement): void;
28
+ exitFullscreen(): void;
29
+ slideToNextItem(): void;
30
+ slideToPrevItem(): void;
31
+ getIsAnimating(): boolean;
32
+ slideToItem(item: string | number): void;
33
+ getIsActiveItem(id: string): boolean;
34
+ getCurrentActiveItem(): {
35
+ id: string;
36
+ index: number;
37
+ };
38
+ };
39
+ export {};
@@ -0,0 +1,26 @@
1
+ /// <reference types="react" />
2
+ import { UseSpringDafaultTypeReturnProps } from '../types';
3
+ import { UseSpringCarouselProps } from '../types/useSpringCarousel';
4
+ import { UseSpringFluidTypeReturnProps } from 'react-spring-carousel';
5
+ declare function useSpringCarousel({ items, withLoop, draggingSlideTreshold, springConfig, shouldResizeOnWindowResize, withThumbs, enableThumbsWrapperScroll, carouselSlideAxis, thumbsSlideAxis, prepareThumbsData, initialActiveItem, initialStartingPosition, disableGestures, gutter, startEndGutter, touchAction, slideAmount, freeScroll, CustomThumbsWrapperComponent, enableFreeScrollDrag, itemsPerSlide, slideType, }: UseSpringCarouselProps): {
6
+ carouselFragment: JSX.Element;
7
+ thumbsFragment: JSX.Element;
8
+ slideToItem?: ((item: string | number) => void) | undefined;
9
+ getIsActiveItem?: ((id: string) => boolean) | undefined;
10
+ getCurrentActiveItem?: (() => {
11
+ id: string;
12
+ index: number;
13
+ }) | undefined;
14
+ useListenToCustomEvent: (fn: import("../types").ObservableCallbackFn<"use-spring">) => void;
15
+ getIsFullscreen: () => boolean;
16
+ enterFullscreen: (elementRef?: HTMLElement | undefined) => void;
17
+ exitFullscreen: () => void;
18
+ getIsAnimating: () => boolean;
19
+ getIsDragging: () => boolean;
20
+ getIsNextItem: (id: string) => boolean;
21
+ getIsPrevItem: (id: string) => boolean;
22
+ slideToPrevItem: () => void;
23
+ slideToNextItem: () => void;
24
+ };
25
+ declare function useSpringCarouselContext(): UseSpringFluidTypeReturnProps | UseSpringDafaultTypeReturnProps;
26
+ export { useSpringCarousel, useSpringCarouselContext };
@@ -1,7 +1,9 @@
1
1
  /// <reference types="react" />
2
- import { UseTransitionCarouselContextProps, UseTransitionCarouselProps } from './types';
3
- export declare function useTransitionCarouselContext(): UseTransitionCarouselContextProps;
4
- export default function useTransitionCarousel({ items, withLoop, withThumbs, springConfig, thumbsSlideAxis, enableThumbsWrapperScroll, draggingSlideTreshold, prepareThumbsData, toPrevItemSpringProps, toNextItemSpringProps, disableGestures, springAnimationProps, }: UseTransitionCarouselProps): {
2
+ import { UseTransitionCarouselContextProps, UseTransitionCarouselProps } from '../types/useTransitionCarousel';
3
+ declare function useTransitionCarouselContext(): UseTransitionCarouselContextProps;
4
+ declare function useTransitionCarousel({ items, withLoop, withThumbs, springConfig, thumbsSlideAxis, enableThumbsWrapperScroll, draggingSlideTreshold, prepareThumbsData, toPrevItemSpringProps, toNextItemSpringProps, disableGestures, CustomThumbsWrapperComponent, trail, exitBeforeEnter, springAnimationProps, }: UseTransitionCarouselProps): {
5
+ useListenToCustomEvent: import("../types").UseListenToCustomEvent<"use-transition">;
6
+ activeItem: number;
5
7
  getIsFullscreen(): boolean;
6
8
  getIsPrevItem(id: string): boolean;
7
9
  getIsNextItem(id: string): boolean;
@@ -16,8 +18,7 @@ export default function useTransitionCarousel({ items, withLoop, withThumbs, spr
16
18
  id: string;
17
19
  index: number;
18
20
  };
19
- useListenToCustomEvent: import("./types").UseListenToCustomEvent;
20
- activeItem: number;
21
21
  carouselFragment: JSX.Element;
22
22
  thumbsFragment: JSX.Element;
23
23
  };
24
+ export { useTransitionCarouselContext, useTransitionCarousel };
@@ -0,0 +1,5 @@
1
+ import { useLayoutEffect } from 'react';
2
+ declare type Callback = () => void | (() => void);
3
+ declare const useIsomorphicLayoutEffect: typeof useLayoutEffect;
4
+ declare function useIsomorphicMount(callback: Callback): void;
5
+ export { useIsomorphicLayoutEffect, useIsomorphicMount };
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "react-spring-carousel",
3
- "version": "1.9.29-beta1",
3
+ "version": "1.9.29-beta101",
4
4
  "description": "A new Carousel experience for the web",
5
5
  "homepage": "https://react-spring-carousel-js.emilianobucci.com",
6
- "repository": "https://github.com/Emiliano-Bucci/react-spring-carousel-js",
6
+ "repository": "https://github.com/Emiliano-Bucci/react-spring-carousel",
7
7
  "author": "Emiliano Bucci",
8
8
  "license": "MIT",
9
9
  "keywords": [
@@ -17,10 +17,23 @@
17
17
  "react-spring-slider",
18
18
  "animated"
19
19
  ],
20
+ "main": "./dist/cjs/index.js",
21
+ "module": "./dist/esm/index.js",
22
+ "types": "./dist/types/index.d.ts",
23
+ "files": [
24
+ "dist"
25
+ ],
26
+ "exports": {
27
+ ".": {
28
+ "require": "./dist/cjs/index.js",
29
+ "default": "./dist/esm/index.js"
30
+ }
31
+ },
20
32
  "scripts": {
21
33
  "start": "start-storybook -p 6006",
34
+ "clean": "rimraf dist",
22
35
  "build-storybook": "build-storybook",
23
- "build:lib": "rollup -c",
36
+ "build:lib": "npm run clean && rollup -c",
24
37
  "lint": "eslint --fix --config .eslintrc.js 'src/**/*.{ts,tsx,js}'",
25
38
  "prepare": "husky install",
26
39
  "lint-staged": "lint-staged",
@@ -29,67 +42,66 @@
29
42
  "release:test": "jest",
30
43
  "push:tags": "git push --follow-tags",
31
44
  "release:lib": "npm run lint && npm run release:test && npm run check:tag:branch && npm run build:lib && npm run push:tags && npm publish",
32
- "storybook": "start-storybook -p 6006"
45
+ "storybook": "start-storybook -p 6006",
46
+ "release:beta": "npm run build:lib && npm publish --tag beta"
33
47
  },
34
- "main": "dist/index.umd.js",
35
- "module": "dist/index.es.js",
36
- "types": "dist/index.d.ts",
37
- "files": [
38
- "dist"
39
- ],
40
48
  "dependencies": {
41
- "@use-gesture/react": "^10.1.1",
42
- "rxjs": "^7.4.0",
43
- "screenfull": "^5.1.0"
49
+ "@use-gesture/react": "^10.2.7",
50
+ "movement": "^0.0.13",
51
+ "react-spring-carousel": "^1.9.29-beta26",
52
+ "rxjs": "^7.5.4",
53
+ "screenfull": "^5.2.0"
44
54
  },
45
55
  "devDependencies": {
46
- "@babel/core": "^7.16.0",
47
- "@babel/preset-env": "^7.16.0",
48
- "@babel/preset-react": "^7.16.0",
49
- "@emotion/babel-plugin": "^11.3.0",
56
+ "@babel/core": "^7.17.5",
57
+ "@babel/preset-env": "^7.16.11",
58
+ "@babel/preset-react": "^7.16.7",
59
+ "@emotion/babel-plugin": "^11.7.2",
50
60
  "@emotion/babel-preset-css-prop": "^11.2.0",
51
- "@emotion/jest": "^11.5.0",
52
- "@emotion/react": "^11.5.0",
53
- "@rollup/plugin-commonjs": "^21.0.1",
54
- "@rollup/plugin-node-resolve": "^13.0.6",
55
- "@storybook/addon-actions": "^6.3.12",
56
- "@storybook/addon-essentials": "^6.1.21",
57
- "@storybook/addon-links": "^6.3.12",
58
- "@storybook/react": "^6.0.28",
59
- "@testing-library/jest-dom": "^5.14.1",
60
- "@testing-library/react": "^12.1.2",
61
- "@types/jest": "^27.0.2",
62
- "@types/react": "^17.0.33",
63
- "@types/react-dom": "^17.0.10",
64
- "@typescript-eslint/eslint-plugin": "^5.2.0",
65
- "@typescript-eslint/parser": "^5.2.0",
61
+ "@emotion/jest": "^11.8.0",
62
+ "@emotion/react": "^11.8.1",
63
+ "@rollup/plugin-commonjs": "^21.0.2",
64
+ "@rollup/plugin-node-resolve": "^13.1.3",
65
+ "@storybook/addon-actions": "^6.4.19",
66
+ "@storybook/addon-essentials": "^6.4.19",
67
+ "@storybook/addon-links": "^6.4.19",
68
+ "@storybook/react": "^6.4.19",
69
+ "@testing-library/jest-dom": "^5.16.2",
70
+ "@testing-library/react": "^12.1.3",
71
+ "@types/jest": "^27.4.1",
72
+ "@types/react": "^17.0.39",
73
+ "@types/react-dom": "^17.0.13",
74
+ "@typescript-eslint/eslint-plugin": "^5.13.0",
75
+ "@typescript-eslint/parser": "^5.13.0",
66
76
  "babel-loader": "^8.2.3",
67
- "chalk": "^4.1.2",
68
- "eslint": "^8.1.0",
69
- "eslint-config-prettier": "^8.3.0",
77
+ "chalk": "^5.0.0",
78
+ "eslint": "^8.10.0",
79
+ "eslint-config-prettier": "^8.5.0",
70
80
  "eslint-plugin-prettier": "^4.0.0",
71
- "eslint-plugin-react": "^7.26.1",
72
- "eslint-plugin-react-hooks": "^4.2.1-alpha-9c8161ba8-20211028",
73
- "eslint-plugin-testing-library": "^5.0.0",
81
+ "eslint-plugin-react": "^7.29.3",
82
+ "eslint-plugin-react-hooks": "^4.3.0",
83
+ "eslint-plugin-testing-library": "^5.0.6",
74
84
  "git-repo-info": "^2.1.1",
75
85
  "husky": "^7.0.4",
76
- "jest": "^27.3.1",
77
- "lint-staged": "^11.2.6",
78
- "prettier": "^2.4.1",
79
- "rollup": "^2.58.3",
86
+ "jest": "^27.5.1",
87
+ "lint-staged": "^12.3.4",
88
+ "prettier": "^2.5.1",
89
+ "rimraf": "^3.0.2",
90
+ "rollup": "^2.69.0",
80
91
  "rollup-plugin-babel": "^4.4.0",
81
- "rollup-plugin-filesize": "^9.1.1",
92
+ "rollup-plugin-exclude-dependencies-from-bundle": "^1.1.22",
93
+ "rollup-plugin-filesize": "^9.1.2",
82
94
  "rollup-plugin-peer-deps-external": "^2.2.4",
83
95
  "rollup-plugin-terser": "^7.0.2",
84
- "rollup-plugin-typescript2": "^0.30.0",
85
- "rollup-plugin-visualizer": "^5.5.2",
86
- "ts-jest": "^27.0.7",
87
- "typescript": "^4.4.4"
96
+ "rollup-plugin-typescript2": "^0.31.2",
97
+ "rollup-plugin-visualizer": "^5.6.0",
98
+ "ts-jest": "^27.1.3",
99
+ "typescript": "^4.6.2"
88
100
  },
89
101
  "peerDependencies": {
90
102
  "react": "^17.0.2",
91
103
  "react-dom": "^17.0.2",
92
- "react-spring": "^9.3.0"
104
+ "react-spring": "^9.4.2"
93
105
  },
94
106
  "lint-staged": {
95
107
  "*.{ts,tsx}": [
package/dist/index.d.ts DELETED
@@ -1,5 +0,0 @@
1
- export { default as useSpringCarousel } from './useSpringCarousel';
2
- export { default as useTransitionCarousel } from './useTransitionCarousel';
3
- export * from './useSpringCarousel';
4
- export * from './useTransitionCarousel';
5
- export * from './types';