@kolserdav/swiper 2.3.1 → 3.0.0
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/README.md +106 -106
- package/dist/index.css +114 -0
- package/dist/index.js +64 -103
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +64 -103
- package/dist/index.modern.js.map +1 -1
- package/dist/navigate_next_black_24dp~NBZptwCk.svg +1 -0
- package/dist/navigate_next_black_24dp~kmANFsMv.svg +1 -0
- package/dist/navigate_next_black_48dp~bfNeNKBt.svg +1 -0
- package/dist/navigate_next_black_48dp~kmANFsMv.svg +1 -0
- package/package.json +92 -102
package/README.md
CHANGED
|
@@ -1,106 +1,106 @@
|
|
|
1
|
-
# swiper
|
|
2
|
-
|
|
3
|
-
> Simple and powerfull dynamic react swiper component
|
|
4
|
-
|
|
5
|
-
[](https://www.npmjs.com/package/swiper) [](https://standardjs.com)
|
|
6
|
-
|
|
7
|
-
## Install
|
|
8
|
-
|
|
9
|
-
```bash
|
|
10
|
-
npm install --save @kolserdav/swiper
|
|
11
|
-
```
|
|
12
|
-
|
|
13
|
-
## Usage
|
|
14
|
-
|
|
15
|
-
```tsx
|
|
16
|
-
import React, { useState, useEffect } from 'react';
|
|
17
|
-
import { Swiper, GetSwipeHandler, Swipe } from '@kolserdav/swiper';
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
id =
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
id =
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
```
|
|
67
|
-
|
|
68
|
-
## Properties
|
|
69
|
-
|
|
70
|
-
```tsx
|
|
71
|
-
interface SwiperProps {
|
|
72
|
-
/**
|
|
73
|
-
* Current card content
|
|
74
|
-
*/
|
|
75
|
-
defaultCurrent: Swipe;
|
|
76
|
-
|
|
77
|
-
/**
|
|
78
|
-
* Get next card handler
|
|
79
|
-
*/
|
|
80
|
-
getNext: GetSwipeHandler;
|
|
81
|
-
|
|
82
|
-
/**
|
|
83
|
-
* Get previous card handler
|
|
84
|
-
*/
|
|
85
|
-
getPrev: GetSwipeHandler;
|
|
86
|
-
|
|
87
|
-
/**
|
|
88
|
-
* Class name for content block
|
|
89
|
-
*/
|
|
90
|
-
className?: string;
|
|
91
|
-
|
|
92
|
-
/**
|
|
93
|
-
* invitation animation
|
|
94
|
-
*/
|
|
95
|
-
invitationAnimation?: boolean;
|
|
96
|
-
|
|
97
|
-
/**
|
|
98
|
-
* On swipe callback
|
|
99
|
-
*/
|
|
100
|
-
onSwipe?: (currentId: number) => void;
|
|
101
|
-
}
|
|
102
|
-
```
|
|
103
|
-
|
|
104
|
-
## License
|
|
105
|
-
|
|
106
|
-
MIT © [kolserdav](https://github.com/kolserdav)
|
|
1
|
+
# swiper
|
|
2
|
+
|
|
3
|
+
> Simple and powerfull dynamic react swiper component
|
|
4
|
+
|
|
5
|
+
[](https://www.npmjs.com/package/swiper) [](https://standardjs.com)
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install --save @kolserdav/swiper
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Usage
|
|
14
|
+
|
|
15
|
+
```tsx
|
|
16
|
+
import React, { useState, useEffect } from 'react';
|
|
17
|
+
import { Swiper, GetSwipeHandler, Swipe } from '@kolserdav/swiper';
|
|
18
|
+
import 'swiper/dist/index.css'; // From version 3.0.0 is required
|
|
19
|
+
|
|
20
|
+
const COUNT = 4;
|
|
21
|
+
|
|
22
|
+
const getNext: GetSwipeHandler = async (old) => {
|
|
23
|
+
let id = old + 1;
|
|
24
|
+
id = id <= COUNT ? id : 0;
|
|
25
|
+
return {
|
|
26
|
+
id,
|
|
27
|
+
children: <h1>Test {id}</h1>,
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
const getPrevios: GetSwipeHandler = async (old) => {
|
|
32
|
+
let id = old - 1;
|
|
33
|
+
id = id >= 0 ? id : COUNT;
|
|
34
|
+
return {
|
|
35
|
+
id,
|
|
36
|
+
children: <h1>Test {id}</h1>,
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
const App = (): React.ReactElement => {
|
|
41
|
+
const [current, setCurrent] = useState<Swipe>();
|
|
42
|
+
useEffect(() => {
|
|
43
|
+
if (!current) {
|
|
44
|
+
(async () => {
|
|
45
|
+
setCurrent(await getNext(0));
|
|
46
|
+
})();
|
|
47
|
+
}
|
|
48
|
+
}, []);
|
|
49
|
+
|
|
50
|
+
return (
|
|
51
|
+
<div>
|
|
52
|
+
{current && (
|
|
53
|
+
<Swiper
|
|
54
|
+
defaultCurrent={current}
|
|
55
|
+
getNext={getNext}
|
|
56
|
+
getPrev={getPrevios}
|
|
57
|
+
invitationAnimation={true}
|
|
58
|
+
durationAnimation={1000}
|
|
59
|
+
/>
|
|
60
|
+
)}
|
|
61
|
+
</div>
|
|
62
|
+
);
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
export default App;
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## Properties
|
|
69
|
+
|
|
70
|
+
```tsx
|
|
71
|
+
interface SwiperProps {
|
|
72
|
+
/**
|
|
73
|
+
* Current card content
|
|
74
|
+
*/
|
|
75
|
+
defaultCurrent: Swipe;
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Get next card handler
|
|
79
|
+
*/
|
|
80
|
+
getNext: GetSwipeHandler;
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Get previous card handler
|
|
84
|
+
*/
|
|
85
|
+
getPrev: GetSwipeHandler;
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Class name for content block
|
|
89
|
+
*/
|
|
90
|
+
className?: string;
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* invitation animation
|
|
94
|
+
*/
|
|
95
|
+
invitationAnimation?: boolean;
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* On swipe callback
|
|
99
|
+
*/
|
|
100
|
+
onSwipe?: (currentId: number) => void;
|
|
101
|
+
}
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
## License
|
|
105
|
+
|
|
106
|
+
MIT © [kolserdav](https://github.com/kolserdav)
|
package/dist/index.css
ADDED
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
._1Lxpd {
|
|
2
|
+
position: relative;
|
|
3
|
+
overflow: hidden;
|
|
4
|
+
min-width: 320px;
|
|
5
|
+
width: 100%;
|
|
6
|
+
height: 100%;
|
|
7
|
+
min-height: 80vh;
|
|
8
|
+
max-width: 100vw;
|
|
9
|
+
display: flex;
|
|
10
|
+
align-items: center;
|
|
11
|
+
justify-content: center;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
._8Yd7S {
|
|
15
|
+
background-color: #fff;
|
|
16
|
+
border-radius: 1rem;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
._3uH2i {
|
|
20
|
+
position: relative;
|
|
21
|
+
width: 100%;
|
|
22
|
+
height: 100%;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
._xsi02 {
|
|
26
|
+
position: absolute;
|
|
27
|
+
max-width: inherit;
|
|
28
|
+
top: 0;
|
|
29
|
+
left: 0;
|
|
30
|
+
display: flex;
|
|
31
|
+
align-items: center;
|
|
32
|
+
justify-content: center;
|
|
33
|
+
}
|
|
34
|
+
._KqFRp {
|
|
35
|
+
left: -100%;
|
|
36
|
+
}
|
|
37
|
+
._1uQwZ {
|
|
38
|
+
left: 100%;
|
|
39
|
+
}
|
|
40
|
+
._18Pcq {
|
|
41
|
+
transition: left 0.4s ease-in 0s;
|
|
42
|
+
}
|
|
43
|
+
._1nj1b {
|
|
44
|
+
transition: left 0.4s ease-out 0s;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
._3cLUl {
|
|
48
|
+
width: 100%;
|
|
49
|
+
height: 100%;
|
|
50
|
+
position: relative;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
._2jwZj {
|
|
54
|
+
border-radius: 2px;
|
|
55
|
+
position: relative;
|
|
56
|
+
width: calc(100% - 48px);
|
|
57
|
+
height: calc(100% - 48px);
|
|
58
|
+
box-shadow: 0px 0px 5px 1px rgba(34, 60, 80, 0.14);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
._2hTXI {
|
|
62
|
+
cursor: pointer;
|
|
63
|
+
position: absolute;
|
|
64
|
+
width: auto;
|
|
65
|
+
height: auto;
|
|
66
|
+
display: flex;
|
|
67
|
+
align-items: center;
|
|
68
|
+
z-index: 12;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
._2Z7EZ {
|
|
72
|
+
right: 0;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
._2Xedt {
|
|
76
|
+
left: 0;
|
|
77
|
+
transform: rotate(180deg);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
._2J4XS {
|
|
81
|
+
display: inline-flex;
|
|
82
|
+
align-items: center;
|
|
83
|
+
justify-content: center;
|
|
84
|
+
position: relative;
|
|
85
|
+
box-sizing: border-box;
|
|
86
|
+
background-color: transparent;
|
|
87
|
+
outline: 0;
|
|
88
|
+
border: 0;
|
|
89
|
+
margin: 0;
|
|
90
|
+
border-radius: 0;
|
|
91
|
+
padding: 0;
|
|
92
|
+
cursor: pointer;
|
|
93
|
+
-webkit-user-select: none;
|
|
94
|
+
-moz-user-select: none;
|
|
95
|
+
-ms-user-select: none;
|
|
96
|
+
user-select: none;
|
|
97
|
+
vertical-align: middle;
|
|
98
|
+
text-decoration: none;
|
|
99
|
+
color: inherit;
|
|
100
|
+
text-align: center;
|
|
101
|
+
flex: 0 0 auto;
|
|
102
|
+
font-size: 1.5rem;
|
|
103
|
+
padding: 8px;
|
|
104
|
+
border-radius: 50%;
|
|
105
|
+
overflow: visible;
|
|
106
|
+
color: rgba(0, 0, 0, 0.54);
|
|
107
|
+
transition: background-color 150ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;
|
|
108
|
+
}
|
|
109
|
+
._2J4XS:hover {
|
|
110
|
+
background-color: rgba(0, 0, 0, 0.054);
|
|
111
|
+
}
|
|
112
|
+
._2J4XS:active {
|
|
113
|
+
background-color: rgba(0, 0, 0, 0.007);
|
|
114
|
+
}
|
package/dist/index.js
CHANGED
|
@@ -2,11 +2,7 @@ function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'defau
|
|
|
2
2
|
|
|
3
3
|
var React = require('react');
|
|
4
4
|
var React__default = _interopDefault(React);
|
|
5
|
-
var material = require('@mui/material');
|
|
6
|
-
var styles = require('@mui/styles');
|
|
7
5
|
var clsx = _interopDefault(require('clsx'));
|
|
8
|
-
var StopIcon = _interopDefault(require('@mui/icons-material/StopScreenShare'));
|
|
9
|
-
var NavigateNextIcon = _interopDefault(require('@mui/icons-material/NavigateNext'));
|
|
10
6
|
|
|
11
7
|
function _extends() {
|
|
12
8
|
_extends = Object.assign || function (target) {
|
|
@@ -201,67 +197,8 @@ function _switch(discriminant, cases) {
|
|
|
201
197
|
}
|
|
202
198
|
}
|
|
203
199
|
|
|
204
|
-
var
|
|
205
|
-
|
|
206
|
-
go: {
|
|
207
|
-
transition: 'left 0.4s ease-out 0s'
|
|
208
|
-
},
|
|
209
|
-
back: {
|
|
210
|
-
transition: 'left 0.4s ease-in 0s'
|
|
211
|
-
},
|
|
212
|
-
container: {
|
|
213
|
-
position: 'relative',
|
|
214
|
-
overflow: 'hidden',
|
|
215
|
-
minWidth: '320px',
|
|
216
|
-
width: '100%',
|
|
217
|
-
height: '100%',
|
|
218
|
-
minHeight: 'calc(100vh - 2rem)',
|
|
219
|
-
maxWidth: '100vw',
|
|
220
|
-
display: 'flex',
|
|
221
|
-
alignItems: 'center',
|
|
222
|
-
justifyContent: 'center',
|
|
223
|
-
marginBlockStart: '2rem'
|
|
224
|
-
},
|
|
225
|
-
button: {
|
|
226
|
-
cursor: 'pointer',
|
|
227
|
-
position: 'absolute',
|
|
228
|
-
width: 'auto',
|
|
229
|
-
height: 'auto',
|
|
230
|
-
display: 'flex',
|
|
231
|
-
alignItems: 'center',
|
|
232
|
-
zIndex: '12'
|
|
233
|
-
},
|
|
234
|
-
button__prev: {
|
|
235
|
-
left: 0,
|
|
236
|
-
transform: 'rotate(180deg)'
|
|
237
|
-
},
|
|
238
|
-
button__next: {
|
|
239
|
-
right: 0
|
|
240
|
-
},
|
|
241
|
-
content: {
|
|
242
|
-
position: 'relative',
|
|
243
|
-
width: 'calc(100% - 48px)',
|
|
244
|
-
maxHeight: 'calc(100% - 48px)',
|
|
245
|
-
minHeight: '20%',
|
|
246
|
-
background: 'white'
|
|
247
|
-
},
|
|
248
|
-
card: {
|
|
249
|
-
position: 'absolute',
|
|
250
|
-
maxWidth: 'inherit',
|
|
251
|
-
top: 0,
|
|
252
|
-
left: 0,
|
|
253
|
-
display: 'flex',
|
|
254
|
-
alignItems: 'center',
|
|
255
|
-
justifyContent: 'center'
|
|
256
|
-
},
|
|
257
|
-
card__prev: {
|
|
258
|
-
left: '-100%'
|
|
259
|
-
},
|
|
260
|
-
card__next: {
|
|
261
|
-
left: '100%'
|
|
262
|
-
}
|
|
263
|
-
};
|
|
264
|
-
});
|
|
200
|
+
var s = {"container":"_1Lxpd","paper":"_8Yd7S","pipe":"_3uH2i","card":"_xsi02","prev":"_KqFRp","next":"_1uQwZ","back":"_18Pcq","go":"_1nj1b","card__stop":"_3cLUl","content":"_2jwZj","button":"_2hTXI","button__next":"_2Z7EZ","button__prev":"_2Xedt","icon__button":"_2J4XS"};
|
|
201
|
+
|
|
265
202
|
var SWIPE_TRANSITION_TIMEOUT = 400;
|
|
266
203
|
|
|
267
204
|
var getSwipes = function getSwipes(prev, current, next, swipes) {
|
|
@@ -303,18 +240,6 @@ var Swiper = function Swiper(props) {
|
|
|
303
240
|
invitationAnimation = props.invitationAnimation,
|
|
304
241
|
durationAnimation = props.durationAnimation;
|
|
305
242
|
|
|
306
|
-
var _useStyles = useStyles(),
|
|
307
|
-
go = _useStyles.go,
|
|
308
|
-
card = _useStyles.card,
|
|
309
|
-
card__next = _useStyles.card__next,
|
|
310
|
-
card__prev = _useStyles.card__prev,
|
|
311
|
-
button = _useStyles.button,
|
|
312
|
-
button__next = _useStyles.button__next,
|
|
313
|
-
button__prev = _useStyles.button__prev,
|
|
314
|
-
back = _useStyles.back,
|
|
315
|
-
container = _useStyles.container,
|
|
316
|
-
content = _useStyles.content;
|
|
317
|
-
|
|
318
243
|
var _useState = React.useState(),
|
|
319
244
|
current = _useState[0],
|
|
320
245
|
setCurrent = _useState[1];
|
|
@@ -374,30 +299,30 @@ var Swiper = function Swiper(props) {
|
|
|
374
299
|
var setGoClassHandler = function setGoClassHandler() {
|
|
375
300
|
var _getRef$current, _getRef$current2, _getRef$current3;
|
|
376
301
|
|
|
377
|
-
(_getRef$current = getRef((next === null || next === void 0 ? void 0 : next.id) || 0).current) === null || _getRef$current === void 0 ? void 0 : _getRef$current.classList.add(go);
|
|
378
|
-
(_getRef$current2 = getRef((prev === null || prev === void 0 ? void 0 : prev.id) || 0).current) === null || _getRef$current2 === void 0 ? void 0 : _getRef$current2.classList.add(go);
|
|
379
|
-
(_getRef$current3 = getRef((current === null || current === void 0 ? void 0 : current.id) || 0).current) === null || _getRef$current3 === void 0 ? void 0 : _getRef$current3.classList.add(go);
|
|
302
|
+
(_getRef$current = getRef((next === null || next === void 0 ? void 0 : next.id) || 0).current) === null || _getRef$current === void 0 ? void 0 : _getRef$current.classList.add(s.go);
|
|
303
|
+
(_getRef$current2 = getRef((prev === null || prev === void 0 ? void 0 : prev.id) || 0).current) === null || _getRef$current2 === void 0 ? void 0 : _getRef$current2.classList.add(s.go);
|
|
304
|
+
(_getRef$current3 = getRef((current === null || current === void 0 ? void 0 : current.id) || 0).current) === null || _getRef$current3 === void 0 ? void 0 : _getRef$current3.classList.add(s.go);
|
|
380
305
|
setTimeout(function () {
|
|
381
306
|
var _getRef$current4, _getRef$current5, _getRef$current6;
|
|
382
307
|
|
|
383
|
-
(_getRef$current4 = getRef((next === null || next === void 0 ? void 0 : next.id) || 0).current) === null || _getRef$current4 === void 0 ? void 0 : _getRef$current4.classList.remove(go);
|
|
384
|
-
(_getRef$current5 = getRef((prev === null || prev === void 0 ? void 0 : prev.id) || 0).current) === null || _getRef$current5 === void 0 ? void 0 : _getRef$current5.classList.remove(go);
|
|
385
|
-
(_getRef$current6 = getRef((current === null || current === void 0 ? void 0 : current.id) || 0).current) === null || _getRef$current6 === void 0 ? void 0 : _getRef$current6.classList.remove(go);
|
|
308
|
+
(_getRef$current4 = getRef((next === null || next === void 0 ? void 0 : next.id) || 0).current) === null || _getRef$current4 === void 0 ? void 0 : _getRef$current4.classList.remove(s.go);
|
|
309
|
+
(_getRef$current5 = getRef((prev === null || prev === void 0 ? void 0 : prev.id) || 0).current) === null || _getRef$current5 === void 0 ? void 0 : _getRef$current5.classList.remove(s.go);
|
|
310
|
+
(_getRef$current6 = getRef((current === null || current === void 0 ? void 0 : current.id) || 0).current) === null || _getRef$current6 === void 0 ? void 0 : _getRef$current6.classList.remove(s.go);
|
|
386
311
|
}, SWIPE_TRANSITION_TIMEOUT);
|
|
387
312
|
};
|
|
388
313
|
|
|
389
314
|
var setBackClassHandler = function setBackClassHandler() {
|
|
390
315
|
var _getRef$current7, _getRef$current8, _getRef$current9;
|
|
391
316
|
|
|
392
|
-
(_getRef$current7 = getRef((next === null || next === void 0 ? void 0 : next.id) || 0).current) === null || _getRef$current7 === void 0 ? void 0 : _getRef$current7.classList.add(back);
|
|
393
|
-
(_getRef$current8 = getRef((prev === null || prev === void 0 ? void 0 : prev.id) || 0).current) === null || _getRef$current8 === void 0 ? void 0 : _getRef$current8.classList.add(back);
|
|
394
|
-
(_getRef$current9 = getRef((current === null || current === void 0 ? void 0 : current.id) || 0).current) === null || _getRef$current9 === void 0 ? void 0 : _getRef$current9.classList.add(back);
|
|
317
|
+
(_getRef$current7 = getRef((next === null || next === void 0 ? void 0 : next.id) || 0).current) === null || _getRef$current7 === void 0 ? void 0 : _getRef$current7.classList.add(s.back);
|
|
318
|
+
(_getRef$current8 = getRef((prev === null || prev === void 0 ? void 0 : prev.id) || 0).current) === null || _getRef$current8 === void 0 ? void 0 : _getRef$current8.classList.add(s.back);
|
|
319
|
+
(_getRef$current9 = getRef((current === null || current === void 0 ? void 0 : current.id) || 0).current) === null || _getRef$current9 === void 0 ? void 0 : _getRef$current9.classList.add(s.back);
|
|
395
320
|
setTimeout(function () {
|
|
396
321
|
var _getRef$current10, _getRef$current11, _getRef$current12;
|
|
397
322
|
|
|
398
|
-
(_getRef$current10 = getRef((next === null || next === void 0 ? void 0 : next.id) || 0).current) === null || _getRef$current10 === void 0 ? void 0 : _getRef$current10.classList.remove(back);
|
|
399
|
-
(_getRef$current11 = getRef((prev === null || prev === void 0 ? void 0 : prev.id) || 0).current) === null || _getRef$current11 === void 0 ? void 0 : _getRef$current11.classList.remove(back);
|
|
400
|
-
(_getRef$current12 = getRef((current === null || current === void 0 ? void 0 : current.id) || 0).current) === null || _getRef$current12 === void 0 ? void 0 : _getRef$current12.classList.remove(back);
|
|
323
|
+
(_getRef$current10 = getRef((next === null || next === void 0 ? void 0 : next.id) || 0).current) === null || _getRef$current10 === void 0 ? void 0 : _getRef$current10.classList.remove(s.back);
|
|
324
|
+
(_getRef$current11 = getRef((prev === null || prev === void 0 ? void 0 : prev.id) || 0).current) === null || _getRef$current11 === void 0 ? void 0 : _getRef$current11.classList.remove(s.back);
|
|
325
|
+
(_getRef$current12 = getRef((current === null || current === void 0 ? void 0 : current.id) || 0).current) === null || _getRef$current12 === void 0 ? void 0 : _getRef$current12.classList.remove(s.back);
|
|
401
326
|
}, SWIPE_TRANSITION_TIMEOUT);
|
|
402
327
|
};
|
|
403
328
|
|
|
@@ -758,7 +683,9 @@ var Swiper = function Swiper(props) {
|
|
|
758
683
|
}
|
|
759
684
|
|
|
760
685
|
if (typeof isMobile === 'undefined') {
|
|
761
|
-
|
|
686
|
+
var _navigator;
|
|
687
|
+
|
|
688
|
+
setIsMobile('ontouchstart' in window || typeof ((_navigator = navigator) === null || _navigator === void 0 ? void 0 : _navigator.msMaxTouchPoints) !== 'undefined');
|
|
762
689
|
}
|
|
763
690
|
|
|
764
691
|
setPreValues(prev, next);
|
|
@@ -774,14 +701,14 @@ var Swiper = function Swiper(props) {
|
|
|
774
701
|
};
|
|
775
702
|
}, [next, defaultCurrent]);
|
|
776
703
|
return React__default.createElement("div", {
|
|
777
|
-
className: container,
|
|
704
|
+
className: s.container,
|
|
778
705
|
ref: containerRef
|
|
779
706
|
}, swipes.map(function (item) {
|
|
780
707
|
var _item$id;
|
|
781
708
|
|
|
782
709
|
return React__default.createElement("div", {
|
|
783
710
|
key: item.id
|
|
784
|
-
}, React__default.createElement(React.Fragment, null, item.id !== null && width && React__default.createElement("div", {
|
|
711
|
+
}, React__default.createElement(React.Fragment, null, item.id !== null && item.children !== null && width && React__default.createElement("div", {
|
|
785
712
|
onTouchMove: onTouchWrapper('onTouchMove'),
|
|
786
713
|
onTouchStart: onTouchWrapper('onTouchStart'),
|
|
787
714
|
onTouchEnd: onTouchWrapper('onTouchEnd'),
|
|
@@ -799,10 +726,10 @@ var Swiper = function Swiper(props) {
|
|
|
799
726
|
height: height,
|
|
800
727
|
left: left + window.innerWidth
|
|
801
728
|
},
|
|
802
|
-
className: clsx(card, item.type === 'prev' ?
|
|
729
|
+
className: clsx(s.card, item.type === 'prev' ? s.prev : item.type === 'next' ? s.next : ''),
|
|
803
730
|
ref: getRef(item.id)
|
|
804
731
|
}, React__default.createElement("div", {
|
|
805
|
-
className: clsx(content, className)
|
|
732
|
+
className: clsx(s.content, className)
|
|
806
733
|
}, item.children)), item.id === null && React__default.createElement("div", {
|
|
807
734
|
style: item.type === 'current' ? {
|
|
808
735
|
width: width,
|
|
@@ -817,21 +744,55 @@ var Swiper = function Swiper(props) {
|
|
|
817
744
|
height: height,
|
|
818
745
|
left: left + windowWidth
|
|
819
746
|
},
|
|
820
|
-
className: clsx(card, item.type === 'prev' ?
|
|
821
|
-
}, React__default.createElement(
|
|
747
|
+
className: clsx(s.card, item.type === 'prev' ? s.prev : item.type === 'next' ? s.next : '')
|
|
748
|
+
}, React__default.createElement("button", {
|
|
822
749
|
disabled: true
|
|
823
|
-
}, React__default.createElement(
|
|
750
|
+
}, React__default.createElement("svg", {
|
|
751
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
752
|
+
width: "16",
|
|
753
|
+
height: "16",
|
|
754
|
+
fill: "currentColor",
|
|
755
|
+
viewBox: "0 0 16 16"
|
|
756
|
+
}, React__default.createElement("path", {
|
|
757
|
+
d: "M5 3.5h6A1.5 1.5 0 0 1 12.5 5v6a1.5 1.5 0 0 1-1.5 1.5H5A1.5 1.5 0 0 1 3.5 11V5A1.5 1.5 0 0 1 5 3.5z"
|
|
758
|
+
}))))));
|
|
824
759
|
}), typeof isMobile !== 'undefined' && !isMobile && (prev === null || prev === void 0 ? void 0 : prev.id) !== null && React__default.createElement("div", {
|
|
825
|
-
className: clsx(button, button__prev)
|
|
826
|
-
}, React__default.createElement(
|
|
760
|
+
className: clsx(s.button, s.button__prev)
|
|
761
|
+
}, React__default.createElement("button", {
|
|
762
|
+
className: s.icon__button,
|
|
763
|
+
type: "button",
|
|
827
764
|
disabled: load || isMobile,
|
|
828
765
|
onClick: clickPrevHandler
|
|
829
|
-
}, React__default.createElement(
|
|
830
|
-
|
|
831
|
-
|
|
766
|
+
}, React__default.createElement("svg", {
|
|
767
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
768
|
+
height: "24px",
|
|
769
|
+
viewBox: "0 0 24 24",
|
|
770
|
+
width: "24px",
|
|
771
|
+
fill: "#000000"
|
|
772
|
+
}, React__default.createElement("path", {
|
|
773
|
+
d: "M0 0h24v24H0V0z",
|
|
774
|
+
fill: "none"
|
|
775
|
+
}), React__default.createElement("path", {
|
|
776
|
+
d: "M10.02 6L8.61 7.41 13.19 12l-4.58 4.59L10.02 18l6-6-6-6z"
|
|
777
|
+
})))), typeof isMobile !== 'undefined' && !isMobile && (next === null || next === void 0 ? void 0 : next.id) !== null && React__default.createElement("div", {
|
|
778
|
+
className: clsx(s.button, s.button__next)
|
|
779
|
+
}, React__default.createElement("button", {
|
|
780
|
+
className: s.icon__button,
|
|
781
|
+
type: "button",
|
|
832
782
|
disabled: load || isMobile,
|
|
833
783
|
onClick: clickNextHandler
|
|
834
|
-
}, React__default.createElement(
|
|
784
|
+
}, React__default.createElement("svg", {
|
|
785
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
786
|
+
height: "24px",
|
|
787
|
+
viewBox: "0 0 24 24",
|
|
788
|
+
width: "24px",
|
|
789
|
+
fill: "#000000"
|
|
790
|
+
}, React__default.createElement("path", {
|
|
791
|
+
d: "M0 0h24v24H0V0z",
|
|
792
|
+
fill: "none"
|
|
793
|
+
}), React__default.createElement("path", {
|
|
794
|
+
d: "M10.02 6L8.61 7.41 13.19 12l-4.58 4.59L10.02 18l6-6-6-6z"
|
|
795
|
+
})))));
|
|
835
796
|
};
|
|
836
797
|
Swiper.defaultProps = {
|
|
837
798
|
className: ''
|