@kolserdav/swiper 3.0.2 → 4.0.1
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 +116 -106
- package/dist/index.css +114 -114
- package/dist/index.d.ts +4 -0
- package/dist/index.js +71 -54
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +71 -54
- package/dist/index.modern.js.map +1 -1
- package/package.json +93 -92
- package/dist/navigate_next_black_24dp~NBZptwCk.svg +0 -1
- package/dist/navigate_next_black_24dp~kmANFsMv.svg +0 -1
- package/dist/navigate_next_black_48dp~bfNeNKBt.svg +0 -1
- package/dist/navigate_next_black_48dp~kmANFsMv.svg +0 -1
package/README.md
CHANGED
|
@@ -1,106 +1,116 @@
|
|
|
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 '@kolserdav/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
|
-
|
|
105
|
-
|
|
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
|
+
import '@kolserdav/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
|
+
* Auto slide if provieded
|
|
104
|
+
*/
|
|
105
|
+
durationAnimation?: number;
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Blocked swipe event
|
|
109
|
+
*/
|
|
110
|
+
blockSwipe?: boolean;
|
|
111
|
+
}
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
## License
|
|
115
|
+
|
|
116
|
+
MIT © [kolserdav](https://github.com/kolserdav)
|
package/dist/index.css
CHANGED
|
@@ -1,114 +1,114 @@
|
|
|
1
|
-
._1Lxpd {
|
|
2
|
-
position: relative;
|
|
3
|
-
overflow: hidden;
|
|
4
|
-
min-width: 320px;
|
|
5
|
-
width: 100%;
|
|
6
|
-
height: 100%;
|
|
7
|
-
min-height: 20vh;
|
|
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
|
-
}
|
|
1
|
+
._1Lxpd {
|
|
2
|
+
position: relative;
|
|
3
|
+
overflow: hidden;
|
|
4
|
+
min-width: 320px;
|
|
5
|
+
width: 100%;
|
|
6
|
+
height: 100%;
|
|
7
|
+
min-height: 20vh;
|
|
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.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -238,7 +238,8 @@ var Swiper = function Swiper(props) {
|
|
|
238
238
|
onSwipe = props.onSwipe,
|
|
239
239
|
className = props.className,
|
|
240
240
|
invitationAnimation = props.invitationAnimation,
|
|
241
|
-
durationAnimation = props.durationAnimation
|
|
241
|
+
durationAnimation = props.durationAnimation,
|
|
242
|
+
blockSwipe = props.blockSwipe;
|
|
242
243
|
|
|
243
244
|
var _useState = React.useState(),
|
|
244
245
|
current = _useState[0],
|
|
@@ -481,12 +482,16 @@ var Swiper = function Swiper(props) {
|
|
|
481
482
|
try {
|
|
482
483
|
var _touches$;
|
|
483
484
|
|
|
485
|
+
var _temp16 = function _temp16() {
|
|
486
|
+
_interrupt2 = true;
|
|
487
|
+
};
|
|
488
|
+
|
|
484
489
|
var _interrupt2 = false;
|
|
485
490
|
var touches = e.touches;
|
|
486
491
|
var clientX = (_touches$ = touches[0]) === null || _touches$ === void 0 ? void 0 : _touches$.clientX;
|
|
487
492
|
startClientX = startClientX || 0;
|
|
488
493
|
|
|
489
|
-
var
|
|
494
|
+
var _temp17 = _switch(name, [[function () {
|
|
490
495
|
return 'onTouchStart';
|
|
491
496
|
}, function () {
|
|
492
497
|
startClientX = clientX;
|
|
@@ -495,18 +500,25 @@ var Swiper = function Swiper(props) {
|
|
|
495
500
|
}], [function () {
|
|
496
501
|
return 'onTouchMove';
|
|
497
502
|
}, function () {
|
|
498
|
-
|
|
499
|
-
|
|
503
|
+
if (!blockSwipe) {
|
|
504
|
+
lastLeft = _left - (startClientX - clientX);
|
|
505
|
+
setLeft(lastLeft);
|
|
506
|
+
}
|
|
507
|
+
|
|
500
508
|
_interrupt2 = true;
|
|
501
509
|
}], [function () {
|
|
502
510
|
return 'onTouchEnd';
|
|
503
511
|
}, function () {
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
512
|
+
var _temp13 = function () {
|
|
513
|
+
if (!blockSwipe) {
|
|
514
|
+
return Promise.resolve(swipe(lastLeft)).then(function () {});
|
|
515
|
+
}
|
|
516
|
+
}();
|
|
517
|
+
|
|
518
|
+
return _temp13 && _temp13.then ? _temp13.then(_temp16) : _temp16(_temp13);
|
|
507
519
|
}], []]);
|
|
508
520
|
|
|
509
|
-
return Promise.resolve(
|
|
521
|
+
return Promise.resolve(_temp17 && _temp17.then ? _temp17.then(function () {}) : void 0);
|
|
510
522
|
} catch (e) {
|
|
511
523
|
return Promise.reject(e);
|
|
512
524
|
}
|
|
@@ -594,6 +606,52 @@ var Swiper = function Swiper(props) {
|
|
|
594
606
|
}
|
|
595
607
|
};
|
|
596
608
|
|
|
609
|
+
var setStartCards = function setStartCards() {
|
|
610
|
+
try {
|
|
611
|
+
return Promise.resolve(getNext(defaultCurrent.id || 0)).then(function (_n) {
|
|
612
|
+
return Promise.resolve(getPrev(defaultCurrent.id || 0)).then(function (_p) {
|
|
613
|
+
setCurrent(defaultCurrent);
|
|
614
|
+
setPrev(_p);
|
|
615
|
+
setNext(_n);
|
|
616
|
+
return Promise.resolve(getPrev(_p.id || 0)).then(function (_getPrev) {
|
|
617
|
+
prePrev = _getPrev;
|
|
618
|
+
return Promise.resolve(getNext(_n.id || 0)).then(function (_getNext) {
|
|
619
|
+
postNext = _getNext;
|
|
620
|
+
_defaultCurrent = defaultCurrent;
|
|
621
|
+
setLoad(false);
|
|
622
|
+
});
|
|
623
|
+
});
|
|
624
|
+
});
|
|
625
|
+
});
|
|
626
|
+
} catch (e) {
|
|
627
|
+
return Promise.reject(e);
|
|
628
|
+
}
|
|
629
|
+
};
|
|
630
|
+
|
|
631
|
+
var startInvitationAnimation = function startInvitationAnimation(prev, next) {
|
|
632
|
+
try {
|
|
633
|
+
var _temp21 = function _temp21() {
|
|
634
|
+
var _temp18 = function () {
|
|
635
|
+
if (next.id) {
|
|
636
|
+
return Promise.resolve(infitationAnimationHandler(windowWidth / 5.5 * -1)).then(function () {});
|
|
637
|
+
}
|
|
638
|
+
}();
|
|
639
|
+
|
|
640
|
+
if (_temp18 && _temp18.then) return _temp18.then(function () {});
|
|
641
|
+
};
|
|
642
|
+
|
|
643
|
+
var _temp22 = function () {
|
|
644
|
+
if (prev.id) {
|
|
645
|
+
return Promise.resolve(infitationAnimationHandler(windowWidth / 5.5)).then(function () {});
|
|
646
|
+
}
|
|
647
|
+
}();
|
|
648
|
+
|
|
649
|
+
return Promise.resolve(_temp22 && _temp22.then ? _temp22.then(_temp21) : _temp21(_temp22));
|
|
650
|
+
} catch (e) {
|
|
651
|
+
return Promise.reject(e);
|
|
652
|
+
}
|
|
653
|
+
};
|
|
654
|
+
|
|
597
655
|
React.useEffect(function () {
|
|
598
656
|
var _containerRef$current10, _containerRef$current11, _containerRef$current12, _containerRef$current13, _containerRef$current14, _containerRef$current15, _containerRef$current16, _containerRef$current17, _containerRef$current18, _current$nextRef, _current$closeRef;
|
|
599
657
|
|
|
@@ -631,54 +689,13 @@ var Swiper = function Swiper(props) {
|
|
|
631
689
|
}
|
|
632
690
|
|
|
633
691
|
if (!current || !prev || !next || _defaultCurrent !== defaultCurrent) {
|
|
634
|
-
|
|
635
|
-
return Promise.resolve(getNext(defaultCurrent.id || 0)).then(function (_n) {
|
|
636
|
-
return Promise.resolve(getPrev(defaultCurrent.id || 0)).then(function (_p) {
|
|
637
|
-
setCurrent(defaultCurrent);
|
|
638
|
-
setPrev(_p);
|
|
639
|
-
setNext(_n);
|
|
640
|
-
return Promise.resolve(getPrev(_p.id || 0)).then(function (_getPrev) {
|
|
641
|
-
prePrev = _getPrev;
|
|
642
|
-
return Promise.resolve(getNext(_n.id || 0)).then(function (_getNext) {
|
|
643
|
-
postNext = _getNext;
|
|
644
|
-
_defaultCurrent = defaultCurrent;
|
|
645
|
-
setLoad(false);
|
|
646
|
-
});
|
|
647
|
-
});
|
|
648
|
-
});
|
|
649
|
-
});
|
|
650
|
-
} catch (e) {
|
|
651
|
-
Promise.reject(e);
|
|
652
|
-
}
|
|
692
|
+
setStartCards();
|
|
653
693
|
}
|
|
654
694
|
|
|
655
695
|
if (invitationAnimation && width && !animated) {
|
|
656
696
|
if (prev && next) {
|
|
657
697
|
animated = true;
|
|
658
|
-
|
|
659
|
-
(function () {
|
|
660
|
-
try {
|
|
661
|
-
var _temp18 = function _temp18() {
|
|
662
|
-
var _temp15 = function () {
|
|
663
|
-
if (next.id) {
|
|
664
|
-
return Promise.resolve(infitationAnimationHandler(windowWidth / 5.5 * -1)).then(function () {});
|
|
665
|
-
}
|
|
666
|
-
}();
|
|
667
|
-
|
|
668
|
-
if (_temp15 && _temp15.then) return _temp15.then(function () {});
|
|
669
|
-
};
|
|
670
|
-
|
|
671
|
-
var _temp19 = function () {
|
|
672
|
-
if (prev.id) {
|
|
673
|
-
return Promise.resolve(infitationAnimationHandler(windowWidth / 5.5)).then(function () {});
|
|
674
|
-
}
|
|
675
|
-
}();
|
|
676
|
-
|
|
677
|
-
return _temp19 && _temp19.then ? _temp19.then(_temp18) : _temp18(_temp19);
|
|
678
|
-
} catch (e) {
|
|
679
|
-
Promise.reject(e);
|
|
680
|
-
}
|
|
681
|
-
})();
|
|
698
|
+
startInvitationAnimation(prev, next);
|
|
682
699
|
}
|
|
683
700
|
}
|
|
684
701
|
|
|
@@ -706,9 +723,9 @@ var Swiper = function Swiper(props) {
|
|
|
706
723
|
}, swipes.map(function (item) {
|
|
707
724
|
var _item$id;
|
|
708
725
|
|
|
709
|
-
return React__default.createElement(
|
|
726
|
+
return React__default.createElement(React.Fragment, {
|
|
710
727
|
key: item.id
|
|
711
|
-
},
|
|
728
|
+
}, item.id !== null && item.children !== null && width && React__default.createElement("div", {
|
|
712
729
|
onTouchMove: onTouchWrapper('onTouchMove'),
|
|
713
730
|
onTouchStart: onTouchWrapper('onTouchStart'),
|
|
714
731
|
onTouchEnd: onTouchWrapper('onTouchEnd'),
|
|
@@ -755,7 +772,7 @@ var Swiper = function Swiper(props) {
|
|
|
755
772
|
viewBox: "0 0 16 16"
|
|
756
773
|
}, React__default.createElement("path", {
|
|
757
774
|
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
|
-
})))))
|
|
775
|
+
})))));
|
|
759
776
|
}), typeof isMobile !== 'undefined' && !isMobile && (prev === null || prev === void 0 ? void 0 : prev.id) !== null && React__default.createElement("div", {
|
|
760
777
|
className: clsx(s.button, s.button__prev)
|
|
761
778
|
}, React__default.createElement("button", {
|