react-spring-carousel 3.0.0-beta090.52 → 3.0.0-beta090.53
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/.storybook/main.ts +17 -0
- package/.storybook/preview.ts +15 -0
- package/README.md +50 -0
- package/eslint.config.js +28 -0
- package/index.html +13 -0
- package/lib/events.ts +39 -0
- package/lib/index.tsx +980 -0
- package/lib/types.ts +44 -0
- package/lib/useEventsModule.ts +51 -0
- package/lib/utils.ts +42 -0
- package/lib/vite-env.d.ts +1 -0
- package/package.json +36 -84
- package/src/stories/Button.stories.ts +52 -0
- package/src/stories/Button.tsx +48 -0
- package/src/stories/Configure.mdx +364 -0
- package/src/stories/Main.stories.ts +14 -0
- package/src/stories/Main.tsx +87 -0
- package/src/stories/assets/accessibility.png +0 -0
- package/src/stories/assets/accessibility.svg +1 -0
- 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 +1 -0
- package/src/stories/assets/docs.png +0 -0
- package/src/stories/assets/figma-plugin.png +0 -0
- package/src/stories/assets/github.svg +1 -0
- 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 +1 -0
- package/src/stories/assets/youtube.svg +1 -0
- package/src/stories/button.css +30 -0
- package/src/stories/main.css +37 -0
- package/src/storybook.global.styles.css +5 -0
- package/tsconfig.app.json +24 -0
- package/tsconfig.json +7 -0
- package/tsconfig.node.json +22 -0
- package/vite.config.ts +30 -0
- package/dist/index.cjs.js +0 -28
- package/dist/index.cjs.js.map +0 -1
- package/dist/index.es.js +0 -1728
- package/dist/index.es.js.map +0 -1
- package/dist/types/index.d.ts +0 -3
- package/dist/types/modules/index.d.ts +0 -1
- package/dist/types/modules/useEventsModule.d.ts +0 -5
- package/dist/types/modules/useFullscreenModule.d.ts +0 -6
- package/dist/types/modules/useThumbsModule.d.ts +0 -6
- package/dist/types/types/common.d.ts +0 -36
- package/dist/types/types/index.d.ts +0 -4
- package/dist/types/types/useEventsModule.types.d.ts +0 -46
- package/dist/types/types/useFullscreenModule.types.d.ts +0 -6
- package/dist/types/types/useSpringCarousel.types.d.ts +0 -130
- package/dist/types/types/useThumbsModule.types.d.ts +0 -9
- package/dist/types/types/useTransitionCarousel.types.d.ts +0 -37
- package/dist/types/useSpringCarousel.d.ts +0 -12
- package/dist/types/useTransitionCarousel.d.ts +0 -5
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { StorybookConfig } from "@storybook/react-vite";
|
|
2
|
+
|
|
3
|
+
const config: StorybookConfig = {
|
|
4
|
+
stories: ["../src/**/*.mdx", "../src/**/*.stories.@(js|jsx|mjs|ts|tsx)"],
|
|
5
|
+
addons: [
|
|
6
|
+
"@storybook/addon-onboarding",
|
|
7
|
+
"@storybook/addon-links",
|
|
8
|
+
"@storybook/addon-essentials",
|
|
9
|
+
"@chromatic-com/storybook",
|
|
10
|
+
"@storybook/addon-interactions",
|
|
11
|
+
],
|
|
12
|
+
framework: {
|
|
13
|
+
name: "@storybook/react-vite",
|
|
14
|
+
options: {},
|
|
15
|
+
},
|
|
16
|
+
};
|
|
17
|
+
export default config;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Preview } from "@storybook/react";
|
|
2
|
+
import "../src/storybook.global.styles.css";
|
|
3
|
+
|
|
4
|
+
const preview: Preview = {
|
|
5
|
+
parameters: {
|
|
6
|
+
controls: {
|
|
7
|
+
matchers: {
|
|
8
|
+
color: /(background|color)$/i,
|
|
9
|
+
date: /Date$/i,
|
|
10
|
+
},
|
|
11
|
+
},
|
|
12
|
+
},
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export default preview;
|
package/README.md
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# React + TypeScript + Vite
|
|
2
|
+
|
|
3
|
+
This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
|
|
4
|
+
|
|
5
|
+
Currently, two official plugins are available:
|
|
6
|
+
|
|
7
|
+
- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react/README.md) uses [Babel](https://babeljs.io/) for Fast Refresh
|
|
8
|
+
- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh
|
|
9
|
+
|
|
10
|
+
## Expanding the ESLint configuration
|
|
11
|
+
|
|
12
|
+
If you are developing a production application, we recommend updating the configuration to enable type aware lint rules:
|
|
13
|
+
|
|
14
|
+
- Configure the top-level `parserOptions` property like this:
|
|
15
|
+
|
|
16
|
+
```js
|
|
17
|
+
export default tseslint.config({
|
|
18
|
+
languageOptions: {
|
|
19
|
+
// other options...
|
|
20
|
+
parserOptions: {
|
|
21
|
+
project: ['./tsconfig.node.json', './tsconfig.app.json'],
|
|
22
|
+
tsconfigRootDir: import.meta.dirname,
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
})
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
- Replace `tseslint.configs.recommended` to `tseslint.configs.recommendedTypeChecked` or `tseslint.configs.strictTypeChecked`
|
|
29
|
+
- Optionally add `...tseslint.configs.stylisticTypeChecked`
|
|
30
|
+
- Install [eslint-plugin-react](https://github.com/jsx-eslint/eslint-plugin-react) and update the config:
|
|
31
|
+
|
|
32
|
+
```js
|
|
33
|
+
// eslint.config.js
|
|
34
|
+
import react from 'eslint-plugin-react'
|
|
35
|
+
|
|
36
|
+
export default tseslint.config({
|
|
37
|
+
// Set the react version
|
|
38
|
+
settings: { react: { version: '18.3' } },
|
|
39
|
+
plugins: {
|
|
40
|
+
// Add the react plugin
|
|
41
|
+
react,
|
|
42
|
+
},
|
|
43
|
+
rules: {
|
|
44
|
+
// other rules...
|
|
45
|
+
// Enable its recommended rules
|
|
46
|
+
...react.configs.recommended.rules,
|
|
47
|
+
...react.configs['jsx-runtime'].rules,
|
|
48
|
+
},
|
|
49
|
+
})
|
|
50
|
+
```
|
package/eslint.config.js
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import js from "@eslint/js";
|
|
2
|
+
import globals from "globals";
|
|
3
|
+
import reactHooks from "eslint-plugin-react-hooks";
|
|
4
|
+
import reactRefresh from "eslint-plugin-react-refresh";
|
|
5
|
+
import tseslint from "typescript-eslint";
|
|
6
|
+
|
|
7
|
+
export default tseslint.config(
|
|
8
|
+
{ ignores: ["dist"] },
|
|
9
|
+
{
|
|
10
|
+
extends: [js.configs.recommended, ...tseslint.configs.recommended],
|
|
11
|
+
files: ["**/*.{ts,tsx}"],
|
|
12
|
+
languageOptions: {
|
|
13
|
+
ecmaVersion: 2020,
|
|
14
|
+
globals: globals.browser,
|
|
15
|
+
},
|
|
16
|
+
plugins: {
|
|
17
|
+
"react-hooks": reactHooks,
|
|
18
|
+
"react-refresh": reactRefresh,
|
|
19
|
+
},
|
|
20
|
+
rules: {
|
|
21
|
+
...reactHooks.configs.recommended.rules,
|
|
22
|
+
"react-refresh/only-export-components": [
|
|
23
|
+
"warn",
|
|
24
|
+
{ allowConstantExport: true },
|
|
25
|
+
],
|
|
26
|
+
},
|
|
27
|
+
}
|
|
28
|
+
);
|
package/index.html
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
|
|
6
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
7
|
+
<title>Vite + React + TS</title>
|
|
8
|
+
</head>
|
|
9
|
+
<body>
|
|
10
|
+
<div id="root"></div>
|
|
11
|
+
<script type="module" src="/src/main.tsx"></script>
|
|
12
|
+
</body>
|
|
13
|
+
</html>
|
package/lib/events.ts
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { FullGestureState } from "@use-gesture/react";
|
|
2
|
+
|
|
3
|
+
export type SlideActionType = "drag" | "click";
|
|
4
|
+
export type SlideDirection = "prev" | "next";
|
|
5
|
+
|
|
6
|
+
export type OnDrag = Omit<FullGestureState<"drag">, "event"> & {
|
|
7
|
+
eventName: "onDrag";
|
|
8
|
+
slideActionType: SlideActionType;
|
|
9
|
+
};
|
|
10
|
+
type OnSlideStartChange = {
|
|
11
|
+
eventName: "onSlideStartChange";
|
|
12
|
+
slideDirection: SlideDirection;
|
|
13
|
+
sliceActionType: SlideActionType;
|
|
14
|
+
nextItem: {
|
|
15
|
+
index: number;
|
|
16
|
+
id: string;
|
|
17
|
+
startReached: boolean | undefined;
|
|
18
|
+
endReached: boolean | undefined;
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
type OnSlideChangeComplete = {
|
|
22
|
+
eventName: "onSlideChangeComplete";
|
|
23
|
+
slideDirection: SlideDirection;
|
|
24
|
+
sliceActionType: SlideActionType;
|
|
25
|
+
currentItem: {
|
|
26
|
+
index: number;
|
|
27
|
+
id: string;
|
|
28
|
+
startReached: boolean | undefined;
|
|
29
|
+
endReached: boolean | undefined;
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export type SpringCarouselEvents =
|
|
34
|
+
| OnSlideStartChange
|
|
35
|
+
| OnSlideChangeComplete
|
|
36
|
+
| OnDrag;
|
|
37
|
+
export type SpringCarouselEventsEventHandler = (
|
|
38
|
+
props: SpringCarouselEvents
|
|
39
|
+
) => void;
|