@kolserdav/swiper 2.1.2-beta → 2.2.3
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/dist/index.d.ts +4 -2
- package/dist/index.js +162 -85
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +162 -85
- package/dist/index.modern.js.map +1 -1
- package/package.json +2 -1
package/dist/index.modern.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React, { useState, useRef, useMemo, useEffect, Fragment, createRef } from 'react';
|
|
2
2
|
import { IconButton } from '@mui/material';
|
|
3
|
+
import { makeStyles } from '@mui/styles';
|
|
3
4
|
import clsx from 'clsx';
|
|
4
5
|
import StopIcon from '@mui/icons-material/StopScreenShare';
|
|
5
6
|
import NavigateNextIcon from '@mui/icons-material/NavigateNext';
|
|
@@ -197,8 +198,67 @@ function _switch(discriminant, cases) {
|
|
|
197
198
|
}
|
|
198
199
|
}
|
|
199
200
|
|
|
200
|
-
var
|
|
201
|
-
|
|
201
|
+
var useStyles = makeStyles(function () {
|
|
202
|
+
return {
|
|
203
|
+
go: {
|
|
204
|
+
transition: 'left 0.4s ease-out 0s'
|
|
205
|
+
},
|
|
206
|
+
back: {
|
|
207
|
+
transition: 'left 0.4s ease-in 0s'
|
|
208
|
+
},
|
|
209
|
+
container: {
|
|
210
|
+
position: 'relative',
|
|
211
|
+
overflow: 'hidden',
|
|
212
|
+
minWidth: '320px',
|
|
213
|
+
width: '100%',
|
|
214
|
+
height: '100%',
|
|
215
|
+
minHeight: 'calc(100vh - 2rem)',
|
|
216
|
+
maxWidth: '100vw',
|
|
217
|
+
display: 'flex',
|
|
218
|
+
alignItems: 'center',
|
|
219
|
+
justifyContent: 'center',
|
|
220
|
+
marginBlockStart: '2rem'
|
|
221
|
+
},
|
|
222
|
+
button: {
|
|
223
|
+
cursor: 'pointer',
|
|
224
|
+
position: 'absolute',
|
|
225
|
+
width: 'auto',
|
|
226
|
+
height: 'auto',
|
|
227
|
+
display: 'flex',
|
|
228
|
+
alignItems: 'center',
|
|
229
|
+
zIndex: '12'
|
|
230
|
+
},
|
|
231
|
+
button__prev: {
|
|
232
|
+
left: 0,
|
|
233
|
+
transform: 'rotate(180deg)'
|
|
234
|
+
},
|
|
235
|
+
button__next: {
|
|
236
|
+
right: 0
|
|
237
|
+
},
|
|
238
|
+
content: {
|
|
239
|
+
position: 'relative',
|
|
240
|
+
width: 'calc(100% - 48px)',
|
|
241
|
+
maxHeight: 'calc(100% - 48px)',
|
|
242
|
+
minHeight: '20%',
|
|
243
|
+
background: 'white'
|
|
244
|
+
},
|
|
245
|
+
card: {
|
|
246
|
+
position: 'absolute',
|
|
247
|
+
maxWidth: 'inherit',
|
|
248
|
+
top: 0,
|
|
249
|
+
left: 0,
|
|
250
|
+
display: 'flex',
|
|
251
|
+
alignItems: 'center',
|
|
252
|
+
justifyContent: 'center'
|
|
253
|
+
},
|
|
254
|
+
card__prev: {
|
|
255
|
+
left: '-100%'
|
|
256
|
+
},
|
|
257
|
+
card__next: {
|
|
258
|
+
left: '100%'
|
|
259
|
+
}
|
|
260
|
+
};
|
|
261
|
+
});
|
|
202
262
|
var SWIPE_TRANSITION_TIMEOUT = 400;
|
|
203
263
|
|
|
204
264
|
var getSwipes = function getSwipes(prev, current, next, swipes) {
|
|
@@ -239,6 +299,18 @@ var Swiper = function Swiper(props) {
|
|
|
239
299
|
className = props.className,
|
|
240
300
|
invitationAnimation = props.invitationAnimation;
|
|
241
301
|
|
|
302
|
+
var _useStyles = useStyles(),
|
|
303
|
+
go = _useStyles.go,
|
|
304
|
+
card = _useStyles.card,
|
|
305
|
+
card__next = _useStyles.card__next,
|
|
306
|
+
card__prev = _useStyles.card__prev,
|
|
307
|
+
button = _useStyles.button,
|
|
308
|
+
button__next = _useStyles.button__next,
|
|
309
|
+
button__prev = _useStyles.button__prev,
|
|
310
|
+
back = _useStyles.back,
|
|
311
|
+
container = _useStyles.container,
|
|
312
|
+
content = _useStyles.content;
|
|
313
|
+
|
|
242
314
|
var _useState = useState(),
|
|
243
315
|
current = _useState[0],
|
|
244
316
|
setCurrent = _useState[1];
|
|
@@ -275,16 +347,12 @@ var Swiper = function Swiper(props) {
|
|
|
275
347
|
isMobile = _useState9[0],
|
|
276
348
|
setIsMobile = _useState9[1];
|
|
277
349
|
|
|
278
|
-
var _useState10 = useState(
|
|
350
|
+
var _useState10 = useState(false),
|
|
279
351
|
load = _useState10[0],
|
|
280
352
|
setLoad = _useState10[1];
|
|
281
353
|
|
|
282
354
|
var containerRef = useRef(null);
|
|
283
355
|
|
|
284
|
-
var _buttonPrevRef = useRef(null);
|
|
285
|
-
|
|
286
|
-
var _buttonNextRef = useRef(null);
|
|
287
|
-
|
|
288
356
|
if (typeof _defaultCurrent === 'undefined') {
|
|
289
357
|
_defaultCurrent = defaultCurrent;
|
|
290
358
|
}
|
|
@@ -299,33 +367,33 @@ var Swiper = function Swiper(props) {
|
|
|
299
367
|
return refs[id];
|
|
300
368
|
};
|
|
301
369
|
|
|
302
|
-
var
|
|
370
|
+
var setGoClassHandler = function setGoClassHandler() {
|
|
303
371
|
var _getRef$current, _getRef$current2, _getRef$current3;
|
|
304
372
|
|
|
305
|
-
(_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(
|
|
306
|
-
(_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(
|
|
307
|
-
(_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(
|
|
373
|
+
(_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);
|
|
374
|
+
(_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);
|
|
375
|
+
(_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);
|
|
308
376
|
setTimeout(function () {
|
|
309
377
|
var _getRef$current4, _getRef$current5, _getRef$current6;
|
|
310
378
|
|
|
311
|
-
(_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(
|
|
312
|
-
(_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(
|
|
313
|
-
(_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(
|
|
379
|
+
(_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);
|
|
380
|
+
(_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);
|
|
381
|
+
(_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);
|
|
314
382
|
}, SWIPE_TRANSITION_TIMEOUT);
|
|
315
383
|
};
|
|
316
384
|
|
|
317
|
-
var
|
|
385
|
+
var setBackClassHandler = function setBackClassHandler() {
|
|
318
386
|
var _getRef$current7, _getRef$current8, _getRef$current9;
|
|
319
387
|
|
|
320
|
-
(_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(
|
|
321
|
-
(_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(
|
|
322
|
-
(_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(
|
|
388
|
+
(_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);
|
|
389
|
+
(_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);
|
|
390
|
+
(_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);
|
|
323
391
|
setTimeout(function () {
|
|
324
392
|
var _getRef$current10, _getRef$current11, _getRef$current12;
|
|
325
393
|
|
|
326
|
-
(_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(
|
|
327
|
-
(_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(
|
|
328
|
-
(_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(
|
|
394
|
+
(_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);
|
|
395
|
+
(_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);
|
|
396
|
+
(_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);
|
|
329
397
|
}, SWIPE_TRANSITION_TIMEOUT);
|
|
330
398
|
};
|
|
331
399
|
|
|
@@ -359,11 +427,6 @@ var Swiper = function Swiper(props) {
|
|
|
359
427
|
try {
|
|
360
428
|
var _temp7 = function _temp7(_result2) {
|
|
361
429
|
if (_exit2) return _result2;
|
|
362
|
-
|
|
363
|
-
if (onSwipe !== undefined) {
|
|
364
|
-
onSwipe(currentId);
|
|
365
|
-
}
|
|
366
|
-
|
|
367
430
|
setLoad(false);
|
|
368
431
|
return 0;
|
|
369
432
|
};
|
|
@@ -382,20 +445,25 @@ var Swiper = function Swiper(props) {
|
|
|
382
445
|
setLeft(0);
|
|
383
446
|
setPrev(current);
|
|
384
447
|
setCurrent(next);
|
|
385
|
-
currentId = next === null || next === void 0 ? void 0 : next.id;
|
|
386
448
|
setNext(postNext);
|
|
387
449
|
});
|
|
388
450
|
};
|
|
389
451
|
|
|
390
|
-
if (
|
|
391
|
-
|
|
452
|
+
if ((next === null || next === void 0 ? void 0 : next.id) === null) {
|
|
453
|
+
setBackClassHandler();
|
|
392
454
|
setLeft(0);
|
|
393
455
|
setLoad(false);
|
|
394
456
|
_exit2 = true;
|
|
395
457
|
return 1;
|
|
396
458
|
}
|
|
397
459
|
|
|
398
|
-
|
|
460
|
+
currentId = next === null || next === void 0 ? void 0 : next.id;
|
|
461
|
+
|
|
462
|
+
if (onSwipe !== undefined) {
|
|
463
|
+
onSwipe(currentId);
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
setGoClassHandler();
|
|
399
467
|
setLeft(windowWidth * -1);
|
|
400
468
|
startTime = new Date().getTime();
|
|
401
469
|
|
|
@@ -423,20 +491,25 @@ var Swiper = function Swiper(props) {
|
|
|
423
491
|
setLeft(0);
|
|
424
492
|
setPrev(prePrev);
|
|
425
493
|
setCurrent(prev);
|
|
426
|
-
currentId = prev === null || prev === void 0 ? void 0 : prev.id;
|
|
427
494
|
setNext(current);
|
|
428
495
|
});
|
|
429
496
|
};
|
|
430
497
|
|
|
431
|
-
if (
|
|
432
|
-
|
|
498
|
+
if ((prev === null || prev === void 0 ? void 0 : prev.id) === null) {
|
|
499
|
+
setBackClassHandler();
|
|
433
500
|
setLeft(0);
|
|
434
501
|
setLoad(false);
|
|
435
502
|
_exit2 = true;
|
|
436
503
|
return 1;
|
|
437
504
|
}
|
|
438
505
|
|
|
439
|
-
|
|
506
|
+
currentId = prev === null || prev === void 0 ? void 0 : prev.id;
|
|
507
|
+
|
|
508
|
+
if (onSwipe !== undefined) {
|
|
509
|
+
onSwipe(currentId);
|
|
510
|
+
}
|
|
511
|
+
|
|
512
|
+
setGoClassHandler();
|
|
440
513
|
setLeft(windowWidth);
|
|
441
514
|
startTime = new Date().getTime();
|
|
442
515
|
|
|
@@ -461,7 +534,7 @@ var Swiper = function Swiper(props) {
|
|
|
461
534
|
}
|
|
462
535
|
}();
|
|
463
536
|
} else {
|
|
464
|
-
|
|
537
|
+
setBackClassHandler();
|
|
465
538
|
setLeft(0);
|
|
466
539
|
setLoad(false);
|
|
467
540
|
_exit2 = true;
|
|
@@ -488,6 +561,7 @@ var Swiper = function Swiper(props) {
|
|
|
488
561
|
return 'onTouchStart';
|
|
489
562
|
}, function () {
|
|
490
563
|
startClientX = clientX;
|
|
564
|
+
lastLeft = _left;
|
|
491
565
|
_interrupt2 = true;
|
|
492
566
|
}], [function () {
|
|
493
567
|
return 'onTouchMove';
|
|
@@ -519,20 +593,16 @@ var Swiper = function Swiper(props) {
|
|
|
519
593
|
var isNext = origin === 'next';
|
|
520
594
|
return function () {
|
|
521
595
|
try {
|
|
522
|
-
if (load) {
|
|
523
|
-
return Promise.resolve(1);
|
|
524
|
-
}
|
|
525
|
-
|
|
526
596
|
var coeff = isNext ? -1 : 1;
|
|
527
597
|
var leftVal = width * coeff;
|
|
528
598
|
|
|
529
599
|
if (isNext) {
|
|
530
|
-
|
|
600
|
+
setGoClassHandler();
|
|
531
601
|
} else {
|
|
532
|
-
|
|
602
|
+
setBackClassHandler();
|
|
533
603
|
}
|
|
534
604
|
|
|
535
|
-
return Promise.resolve(wait(SWIPE_TRANSITION_TIMEOUT
|
|
605
|
+
return Promise.resolve(wait(SWIPE_TRANSITION_TIMEOUT)).then(function () {
|
|
536
606
|
return Promise.resolve(swipe(leftVal)).then(function () {
|
|
537
607
|
return 0;
|
|
538
608
|
});
|
|
@@ -574,20 +644,21 @@ var Swiper = function Swiper(props) {
|
|
|
574
644
|
var infitationAnimationHandler = function infitationAnimationHandler(shift) {
|
|
575
645
|
try {
|
|
576
646
|
if (shift < 0) {
|
|
577
|
-
|
|
647
|
+
setGoClassHandler();
|
|
578
648
|
} else {
|
|
579
|
-
|
|
649
|
+
setBackClassHandler();
|
|
580
650
|
}
|
|
581
651
|
|
|
582
652
|
setLeft(shift);
|
|
583
653
|
return Promise.resolve(wait(SWIPE_TRANSITION_TIMEOUT)).then(function () {
|
|
584
654
|
if (shift < 0) {
|
|
585
|
-
|
|
655
|
+
setBackClassHandler();
|
|
586
656
|
} else {
|
|
587
|
-
|
|
657
|
+
setGoClassHandler();
|
|
588
658
|
}
|
|
589
659
|
|
|
590
660
|
setLeft(0);
|
|
661
|
+
return Promise.resolve(wait(SWIPE_TRANSITION_TIMEOUT)).then(function () {});
|
|
591
662
|
});
|
|
592
663
|
} catch (e) {
|
|
593
664
|
return Promise.reject(e);
|
|
@@ -595,7 +666,7 @@ var Swiper = function Swiper(props) {
|
|
|
595
666
|
};
|
|
596
667
|
|
|
597
668
|
useEffect(function () {
|
|
598
|
-
var _containerRef$current10, _containerRef$current11, _containerRef$current12, _containerRef$current13, _containerRef$current14, _containerRef$current15, _containerRef$current16, _containerRef$current17, _containerRef$current18;
|
|
669
|
+
var _containerRef$current10, _containerRef$current11, _containerRef$current12, _containerRef$current13, _containerRef$current14, _containerRef$current15, _containerRef$current16, _containerRef$current17, _containerRef$current18, _current$nextRef, _current$closeRef;
|
|
599
670
|
|
|
600
671
|
var _width = containerRef === null || containerRef === void 0 ? void 0 : (_containerRef$current10 = containerRef.current) === null || _containerRef$current10 === void 0 ? void 0 : (_containerRef$current11 = _containerRef$current10.parentElement) === null || _containerRef$current11 === void 0 ? void 0 : (_containerRef$current12 = _containerRef$current11.getBoundingClientRect()) === null || _containerRef$current12 === void 0 ? void 0 : _containerRef$current12.width;
|
|
601
672
|
|
|
@@ -604,6 +675,10 @@ var Swiper = function Swiper(props) {
|
|
|
604
675
|
var __left = containerRef === null || containerRef === void 0 ? void 0 : (_containerRef$current16 = containerRef.current) === null || _containerRef$current16 === void 0 ? void 0 : (_containerRef$current17 = _containerRef$current16.parentElement) === null || _containerRef$current17 === void 0 ? void 0 : (_containerRef$current18 = _containerRef$current17.getBoundingClientRect()) === null || _containerRef$current18 === void 0 ? void 0 : _containerRef$current18.left;
|
|
605
676
|
|
|
606
677
|
var _windowWidth = document.body.clientWidth;
|
|
678
|
+
var buttonNext = current === null || current === void 0 ? void 0 : (_current$nextRef = current.nextRef) === null || _current$nextRef === void 0 ? void 0 : _current$nextRef.current;
|
|
679
|
+
var buttonClose = current === null || current === void 0 ? void 0 : (_current$closeRef = current.closeRef) === null || _current$closeRef === void 0 ? void 0 : _current$closeRef.current;
|
|
680
|
+
buttonNext === null || buttonNext === void 0 ? void 0 : buttonNext.addEventListener('click', clickNextHandler);
|
|
681
|
+
buttonClose === null || buttonClose === void 0 ? void 0 : buttonClose.addEventListener('click', clickNextHandler);
|
|
607
682
|
|
|
608
683
|
if (_width && !width && _height && !height) {
|
|
609
684
|
setWidth(_width);
|
|
@@ -641,31 +716,33 @@ var Swiper = function Swiper(props) {
|
|
|
641
716
|
}
|
|
642
717
|
|
|
643
718
|
if (invitationAnimation && width && !animated) {
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
var
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
719
|
+
if (prev && next) {
|
|
720
|
+
animated = true;
|
|
721
|
+
|
|
722
|
+
(function () {
|
|
723
|
+
try {
|
|
724
|
+
var _temp18 = function _temp18() {
|
|
725
|
+
var _temp15 = function () {
|
|
726
|
+
if (next.id) {
|
|
727
|
+
return Promise.resolve(infitationAnimationHandler(windowWidth / 5.5 * -1)).then(function () {});
|
|
728
|
+
}
|
|
729
|
+
}();
|
|
654
730
|
|
|
655
|
-
|
|
656
|
-
|
|
731
|
+
if (_temp15 && _temp15.then) return _temp15.then(function () {});
|
|
732
|
+
};
|
|
657
733
|
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
734
|
+
var _temp19 = function () {
|
|
735
|
+
if (prev.id) {
|
|
736
|
+
return Promise.resolve(infitationAnimationHandler(windowWidth / 5.5)).then(function () {});
|
|
737
|
+
}
|
|
738
|
+
}();
|
|
663
739
|
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
740
|
+
return _temp19 && _temp19.then ? _temp19.then(_temp18) : _temp18(_temp19);
|
|
741
|
+
} catch (e) {
|
|
742
|
+
Promise.reject(e);
|
|
743
|
+
}
|
|
744
|
+
})();
|
|
745
|
+
}
|
|
669
746
|
}
|
|
670
747
|
|
|
671
748
|
if (typeof isMobile === 'undefined') {
|
|
@@ -676,17 +753,19 @@ var Swiper = function Swiper(props) {
|
|
|
676
753
|
window.addEventListener('resize', resizeHandler);
|
|
677
754
|
return function () {
|
|
678
755
|
window.removeEventListener('resize', resizeHandler);
|
|
756
|
+
buttonNext === null || buttonNext === void 0 ? void 0 : buttonNext.removeEventListener('click', clickNextHandler);
|
|
757
|
+
buttonClose === null || buttonClose === void 0 ? void 0 : buttonClose.removeEventListener('click', clickNextHandler);
|
|
679
758
|
};
|
|
680
759
|
}, [next, defaultCurrent]);
|
|
681
760
|
return React.createElement("div", {
|
|
682
|
-
className:
|
|
761
|
+
className: container,
|
|
683
762
|
ref: containerRef
|
|
684
763
|
}, swipes.map(function (item) {
|
|
685
764
|
var _item$id;
|
|
686
765
|
|
|
687
766
|
return React.createElement("div", {
|
|
688
767
|
key: item.id
|
|
689
|
-
}, React.createElement(Fragment, null, item.id && width && React.createElement("div", {
|
|
768
|
+
}, React.createElement(Fragment, null, item.id !== null && width && React.createElement("div", {
|
|
690
769
|
onTouchMove: onTouchWrapper('onTouchMove'),
|
|
691
770
|
onTouchStart: onTouchWrapper('onTouchStart'),
|
|
692
771
|
onTouchEnd: onTouchWrapper('onTouchEnd'),
|
|
@@ -698,17 +777,17 @@ var Swiper = function Swiper(props) {
|
|
|
698
777
|
} : item.type === 'prev' ? {
|
|
699
778
|
width: width,
|
|
700
779
|
height: height,
|
|
701
|
-
left: left -
|
|
780
|
+
left: left - window.innerWidth
|
|
702
781
|
} : {
|
|
703
782
|
width: width,
|
|
704
783
|
height: height,
|
|
705
|
-
left: left +
|
|
784
|
+
left: left + window.innerWidth
|
|
706
785
|
},
|
|
707
|
-
className: clsx(
|
|
786
|
+
className: clsx(card, item.type === 'prev' ? card__prev : item.type === 'next' ? card__next : ''),
|
|
708
787
|
ref: getRef(item.id)
|
|
709
788
|
}, React.createElement("div", {
|
|
710
|
-
className: clsx(
|
|
711
|
-
}, item.children)),
|
|
789
|
+
className: clsx(content, className)
|
|
790
|
+
}, item.children)), item.id === null && React.createElement("div", {
|
|
712
791
|
style: item.type === 'current' ? {
|
|
713
792
|
width: width,
|
|
714
793
|
height: height,
|
|
@@ -722,21 +801,19 @@ var Swiper = function Swiper(props) {
|
|
|
722
801
|
height: height,
|
|
723
802
|
left: left + windowWidth
|
|
724
803
|
},
|
|
725
|
-
className: clsx(
|
|
804
|
+
className: clsx(card, item.type === 'prev' ? card__prev : item.type === 'next' ? card__next : '')
|
|
726
805
|
}, React.createElement(IconButton, {
|
|
727
806
|
disabled: true
|
|
728
807
|
}, React.createElement(StopIcon, null)))));
|
|
729
|
-
}), typeof isMobile !== 'undefined' && !isMobile && (prev === null || prev === void 0 ? void 0 : prev.id) && React.createElement("div", {
|
|
730
|
-
className: clsx(
|
|
731
|
-
ref: _buttonPrevRef
|
|
808
|
+
}), typeof isMobile !== 'undefined' && !isMobile && (prev === null || prev === void 0 ? void 0 : prev.id) !== null && React.createElement("div", {
|
|
809
|
+
className: clsx(button, button__prev)
|
|
732
810
|
}, React.createElement(IconButton, {
|
|
733
|
-
disabled: load,
|
|
811
|
+
disabled: load || isMobile,
|
|
734
812
|
onClick: clickPrevHandler
|
|
735
|
-
}, React.createElement(NavigateNextIcon, null))), typeof isMobile !== 'undefined' && !isMobile && (next === null || next === void 0 ? void 0 : next.id) && React.createElement("div", {
|
|
736
|
-
className: clsx(
|
|
737
|
-
ref: _buttonNextRef
|
|
813
|
+
}, React.createElement(NavigateNextIcon, null))), typeof isMobile !== 'undefined' && !isMobile && (next === null || next === void 0 ? void 0 : next.id) !== null && React.createElement("div", {
|
|
814
|
+
className: clsx(button, button__next)
|
|
738
815
|
}, React.createElement(IconButton, {
|
|
739
|
-
disabled: load,
|
|
816
|
+
disabled: load || isMobile,
|
|
740
817
|
onClick: clickNextHandler
|
|
741
818
|
}, React.createElement(NavigateNextIcon, null))));
|
|
742
819
|
};
|