@kolserdav/swiper 2.1.1-beta → 2.2.2
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 +3 -1
- package/dist/index.js +156 -79
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +156 -79
- package/dist/index.modern.js.map +1 -1
- package/package.json +2 -1
package/dist/index.d.ts
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* Copyright: kolserdav, All rights reserved (c)
|
|
8
8
|
* Create date: Mon Nov 29 2021 16:18:08 GMT+0700 (Krasnoyarsk Standard Time)
|
|
9
9
|
******************************************************************************************/
|
|
10
|
-
import React from 'react';
|
|
10
|
+
import React, { RefObject } from 'react';
|
|
11
11
|
/**
|
|
12
12
|
* Time to miliseconds of change animation by card left value
|
|
13
13
|
*/
|
|
@@ -17,6 +17,8 @@ export declare const SWIPE_TRANSITION_TIMEOUT = 400;
|
|
|
17
17
|
*/
|
|
18
18
|
export interface Swipe {
|
|
19
19
|
id: number | null;
|
|
20
|
+
nextRef?: RefObject<HTMLButtonElement | HTMLDivElement | undefined>;
|
|
21
|
+
closeRef?: RefObject<HTMLButtonElement | HTMLDivElement | undefined>;
|
|
20
22
|
children: React.ReactElement | React.ReactElement[];
|
|
21
23
|
}
|
|
22
24
|
/**
|
package/dist/index.js
CHANGED
|
@@ -3,6 +3,7 @@ function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'defau
|
|
|
3
3
|
var React = require('react');
|
|
4
4
|
var React__default = _interopDefault(React);
|
|
5
5
|
var material = require('@mui/material');
|
|
6
|
+
var styles = require('@mui/styles');
|
|
6
7
|
var clsx = _interopDefault(require('clsx'));
|
|
7
8
|
var StopIcon = _interopDefault(require('@mui/icons-material/StopScreenShare'));
|
|
8
9
|
var NavigateNextIcon = _interopDefault(require('@mui/icons-material/NavigateNext'));
|
|
@@ -200,8 +201,67 @@ function _switch(discriminant, cases) {
|
|
|
200
201
|
}
|
|
201
202
|
}
|
|
202
203
|
|
|
203
|
-
var
|
|
204
|
-
|
|
204
|
+
var useStyles = styles.makeStyles(function () {
|
|
205
|
+
return {
|
|
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
|
+
});
|
|
205
265
|
var SWIPE_TRANSITION_TIMEOUT = 400;
|
|
206
266
|
|
|
207
267
|
var getSwipes = function getSwipes(prev, current, next, swipes) {
|
|
@@ -242,6 +302,18 @@ var Swiper = function Swiper(props) {
|
|
|
242
302
|
className = props.className,
|
|
243
303
|
invitationAnimation = props.invitationAnimation;
|
|
244
304
|
|
|
305
|
+
var _useStyles = useStyles(),
|
|
306
|
+
go = _useStyles.go,
|
|
307
|
+
card = _useStyles.card,
|
|
308
|
+
card__next = _useStyles.card__next,
|
|
309
|
+
card__prev = _useStyles.card__prev,
|
|
310
|
+
button = _useStyles.button,
|
|
311
|
+
button__next = _useStyles.button__next,
|
|
312
|
+
button__prev = _useStyles.button__prev,
|
|
313
|
+
back = _useStyles.back,
|
|
314
|
+
container = _useStyles.container,
|
|
315
|
+
content = _useStyles.content;
|
|
316
|
+
|
|
245
317
|
var _useState = React.useState(),
|
|
246
318
|
current = _useState[0],
|
|
247
319
|
setCurrent = _useState[1];
|
|
@@ -278,16 +350,12 @@ var Swiper = function Swiper(props) {
|
|
|
278
350
|
isMobile = _useState9[0],
|
|
279
351
|
setIsMobile = _useState9[1];
|
|
280
352
|
|
|
281
|
-
var _useState10 = React.useState(
|
|
353
|
+
var _useState10 = React.useState(false),
|
|
282
354
|
load = _useState10[0],
|
|
283
355
|
setLoad = _useState10[1];
|
|
284
356
|
|
|
285
357
|
var containerRef = React.useRef(null);
|
|
286
358
|
|
|
287
|
-
var _buttonPrevRef = React.useRef(null);
|
|
288
|
-
|
|
289
|
-
var _buttonNextRef = React.useRef(null);
|
|
290
|
-
|
|
291
359
|
if (typeof _defaultCurrent === 'undefined') {
|
|
292
360
|
_defaultCurrent = defaultCurrent;
|
|
293
361
|
}
|
|
@@ -302,33 +370,33 @@ var Swiper = function Swiper(props) {
|
|
|
302
370
|
return refs[id];
|
|
303
371
|
};
|
|
304
372
|
|
|
305
|
-
var
|
|
373
|
+
var setGoClassHandler = function setGoClassHandler() {
|
|
306
374
|
var _getRef$current, _getRef$current2, _getRef$current3;
|
|
307
375
|
|
|
308
|
-
(_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(
|
|
309
|
-
(_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(
|
|
310
|
-
(_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(
|
|
376
|
+
(_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);
|
|
377
|
+
(_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);
|
|
378
|
+
(_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);
|
|
311
379
|
setTimeout(function () {
|
|
312
380
|
var _getRef$current4, _getRef$current5, _getRef$current6;
|
|
313
381
|
|
|
314
|
-
(_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(
|
|
315
|
-
(_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(
|
|
316
|
-
(_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(
|
|
382
|
+
(_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);
|
|
383
|
+
(_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);
|
|
384
|
+
(_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);
|
|
317
385
|
}, SWIPE_TRANSITION_TIMEOUT);
|
|
318
386
|
};
|
|
319
387
|
|
|
320
|
-
var
|
|
388
|
+
var setBackClassHandler = function setBackClassHandler() {
|
|
321
389
|
var _getRef$current7, _getRef$current8, _getRef$current9;
|
|
322
390
|
|
|
323
|
-
(_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(
|
|
324
|
-
(_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(
|
|
325
|
-
(_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(
|
|
391
|
+
(_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);
|
|
392
|
+
(_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);
|
|
393
|
+
(_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);
|
|
326
394
|
setTimeout(function () {
|
|
327
395
|
var _getRef$current10, _getRef$current11, _getRef$current12;
|
|
328
396
|
|
|
329
|
-
(_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(
|
|
330
|
-
(_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(
|
|
331
|
-
(_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(
|
|
397
|
+
(_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);
|
|
398
|
+
(_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);
|
|
399
|
+
(_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);
|
|
332
400
|
}, SWIPE_TRANSITION_TIMEOUT);
|
|
333
401
|
};
|
|
334
402
|
|
|
@@ -362,11 +430,6 @@ var Swiper = function Swiper(props) {
|
|
|
362
430
|
try {
|
|
363
431
|
var _temp7 = function _temp7(_result2) {
|
|
364
432
|
if (_exit2) return _result2;
|
|
365
|
-
|
|
366
|
-
if (onSwipe !== undefined) {
|
|
367
|
-
onSwipe(currentId);
|
|
368
|
-
}
|
|
369
|
-
|
|
370
433
|
setLoad(false);
|
|
371
434
|
return 0;
|
|
372
435
|
};
|
|
@@ -385,20 +448,25 @@ var Swiper = function Swiper(props) {
|
|
|
385
448
|
setLeft(0);
|
|
386
449
|
setPrev(current);
|
|
387
450
|
setCurrent(next);
|
|
388
|
-
currentId = next === null || next === void 0 ? void 0 : next.id;
|
|
389
451
|
setNext(postNext);
|
|
390
452
|
});
|
|
391
453
|
};
|
|
392
454
|
|
|
393
455
|
if (!(next !== null && next !== void 0 && next.id)) {
|
|
394
|
-
|
|
456
|
+
setBackClassHandler();
|
|
395
457
|
setLeft(0);
|
|
396
458
|
setLoad(false);
|
|
397
459
|
_exit2 = true;
|
|
398
460
|
return 1;
|
|
399
461
|
}
|
|
400
462
|
|
|
401
|
-
|
|
463
|
+
currentId = next === null || next === void 0 ? void 0 : next.id;
|
|
464
|
+
|
|
465
|
+
if (onSwipe !== undefined) {
|
|
466
|
+
onSwipe(currentId);
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
setGoClassHandler();
|
|
402
470
|
setLeft(windowWidth * -1);
|
|
403
471
|
startTime = new Date().getTime();
|
|
404
472
|
|
|
@@ -426,20 +494,25 @@ var Swiper = function Swiper(props) {
|
|
|
426
494
|
setLeft(0);
|
|
427
495
|
setPrev(prePrev);
|
|
428
496
|
setCurrent(prev);
|
|
429
|
-
currentId = prev === null || prev === void 0 ? void 0 : prev.id;
|
|
430
497
|
setNext(current);
|
|
431
498
|
});
|
|
432
499
|
};
|
|
433
500
|
|
|
434
501
|
if (!(prev !== null && prev !== void 0 && prev.id)) {
|
|
435
|
-
|
|
502
|
+
setBackClassHandler();
|
|
436
503
|
setLeft(0);
|
|
437
504
|
setLoad(false);
|
|
438
505
|
_exit2 = true;
|
|
439
506
|
return 1;
|
|
440
507
|
}
|
|
441
508
|
|
|
442
|
-
|
|
509
|
+
currentId = prev.id;
|
|
510
|
+
|
|
511
|
+
if (onSwipe !== undefined) {
|
|
512
|
+
onSwipe(currentId);
|
|
513
|
+
}
|
|
514
|
+
|
|
515
|
+
setGoClassHandler();
|
|
443
516
|
setLeft(windowWidth);
|
|
444
517
|
startTime = new Date().getTime();
|
|
445
518
|
|
|
@@ -464,7 +537,7 @@ var Swiper = function Swiper(props) {
|
|
|
464
537
|
}
|
|
465
538
|
}();
|
|
466
539
|
} else {
|
|
467
|
-
|
|
540
|
+
setBackClassHandler();
|
|
468
541
|
setLeft(0);
|
|
469
542
|
setLoad(false);
|
|
470
543
|
_exit2 = true;
|
|
@@ -491,6 +564,7 @@ var Swiper = function Swiper(props) {
|
|
|
491
564
|
return 'onTouchStart';
|
|
492
565
|
}, function () {
|
|
493
566
|
startClientX = clientX;
|
|
567
|
+
lastLeft = _left;
|
|
494
568
|
_interrupt2 = true;
|
|
495
569
|
}], [function () {
|
|
496
570
|
return 'onTouchMove';
|
|
@@ -522,20 +596,16 @@ var Swiper = function Swiper(props) {
|
|
|
522
596
|
var isNext = origin === 'next';
|
|
523
597
|
return function () {
|
|
524
598
|
try {
|
|
525
|
-
if (load) {
|
|
526
|
-
return Promise.resolve(1);
|
|
527
|
-
}
|
|
528
|
-
|
|
529
599
|
var coeff = isNext ? -1 : 1;
|
|
530
600
|
var leftVal = width * coeff;
|
|
531
601
|
|
|
532
602
|
if (isNext) {
|
|
533
|
-
|
|
603
|
+
setGoClassHandler();
|
|
534
604
|
} else {
|
|
535
|
-
|
|
605
|
+
setBackClassHandler();
|
|
536
606
|
}
|
|
537
607
|
|
|
538
|
-
return Promise.resolve(wait(SWIPE_TRANSITION_TIMEOUT
|
|
608
|
+
return Promise.resolve(wait(SWIPE_TRANSITION_TIMEOUT)).then(function () {
|
|
539
609
|
return Promise.resolve(swipe(leftVal)).then(function () {
|
|
540
610
|
return 0;
|
|
541
611
|
});
|
|
@@ -577,20 +647,21 @@ var Swiper = function Swiper(props) {
|
|
|
577
647
|
var infitationAnimationHandler = function infitationAnimationHandler(shift) {
|
|
578
648
|
try {
|
|
579
649
|
if (shift < 0) {
|
|
580
|
-
|
|
650
|
+
setGoClassHandler();
|
|
581
651
|
} else {
|
|
582
|
-
|
|
652
|
+
setBackClassHandler();
|
|
583
653
|
}
|
|
584
654
|
|
|
585
655
|
setLeft(shift);
|
|
586
656
|
return Promise.resolve(wait(SWIPE_TRANSITION_TIMEOUT)).then(function () {
|
|
587
657
|
if (shift < 0) {
|
|
588
|
-
|
|
658
|
+
setBackClassHandler();
|
|
589
659
|
} else {
|
|
590
|
-
|
|
660
|
+
setGoClassHandler();
|
|
591
661
|
}
|
|
592
662
|
|
|
593
663
|
setLeft(0);
|
|
664
|
+
return Promise.resolve(wait(SWIPE_TRANSITION_TIMEOUT)).then(function () {});
|
|
594
665
|
});
|
|
595
666
|
} catch (e) {
|
|
596
667
|
return Promise.reject(e);
|
|
@@ -598,7 +669,7 @@ var Swiper = function Swiper(props) {
|
|
|
598
669
|
};
|
|
599
670
|
|
|
600
671
|
React.useEffect(function () {
|
|
601
|
-
var _containerRef$current10, _containerRef$current11, _containerRef$current12, _containerRef$current13, _containerRef$current14, _containerRef$current15, _containerRef$current16, _containerRef$current17, _containerRef$current18;
|
|
672
|
+
var _containerRef$current10, _containerRef$current11, _containerRef$current12, _containerRef$current13, _containerRef$current14, _containerRef$current15, _containerRef$current16, _containerRef$current17, _containerRef$current18, _current$nextRef, _current$closeRef;
|
|
602
673
|
|
|
603
674
|
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;
|
|
604
675
|
|
|
@@ -607,6 +678,10 @@ var Swiper = function Swiper(props) {
|
|
|
607
678
|
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;
|
|
608
679
|
|
|
609
680
|
var _windowWidth = document.body.clientWidth;
|
|
681
|
+
var buttonNext = current === null || current === void 0 ? void 0 : (_current$nextRef = current.nextRef) === null || _current$nextRef === void 0 ? void 0 : _current$nextRef.current;
|
|
682
|
+
var buttonClose = current === null || current === void 0 ? void 0 : (_current$closeRef = current.closeRef) === null || _current$closeRef === void 0 ? void 0 : _current$closeRef.current;
|
|
683
|
+
buttonNext === null || buttonNext === void 0 ? void 0 : buttonNext.addEventListener('click', clickNextHandler);
|
|
684
|
+
buttonClose === null || buttonClose === void 0 ? void 0 : buttonClose.addEventListener('click', clickNextHandler);
|
|
610
685
|
|
|
611
686
|
if (_width && !width && _height && !height) {
|
|
612
687
|
setWidth(_width);
|
|
@@ -644,31 +719,33 @@ var Swiper = function Swiper(props) {
|
|
|
644
719
|
}
|
|
645
720
|
|
|
646
721
|
if (invitationAnimation && width && !animated) {
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
var
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
722
|
+
if (prev && next) {
|
|
723
|
+
animated = true;
|
|
724
|
+
|
|
725
|
+
(function () {
|
|
726
|
+
try {
|
|
727
|
+
var _temp18 = function _temp18() {
|
|
728
|
+
var _temp15 = function () {
|
|
729
|
+
if (next.id) {
|
|
730
|
+
return Promise.resolve(infitationAnimationHandler(windowWidth / 5.5 * -1)).then(function () {});
|
|
731
|
+
}
|
|
732
|
+
}();
|
|
657
733
|
|
|
658
|
-
|
|
659
|
-
|
|
734
|
+
if (_temp15 && _temp15.then) return _temp15.then(function () {});
|
|
735
|
+
};
|
|
660
736
|
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
737
|
+
var _temp19 = function () {
|
|
738
|
+
if (prev.id) {
|
|
739
|
+
return Promise.resolve(infitationAnimationHandler(windowWidth / 5.5)).then(function () {});
|
|
740
|
+
}
|
|
741
|
+
}();
|
|
666
742
|
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
743
|
+
return _temp19 && _temp19.then ? _temp19.then(_temp18) : _temp18(_temp19);
|
|
744
|
+
} catch (e) {
|
|
745
|
+
Promise.reject(e);
|
|
746
|
+
}
|
|
747
|
+
})();
|
|
748
|
+
}
|
|
672
749
|
}
|
|
673
750
|
|
|
674
751
|
if (typeof isMobile === 'undefined') {
|
|
@@ -679,10 +756,12 @@ var Swiper = function Swiper(props) {
|
|
|
679
756
|
window.addEventListener('resize', resizeHandler);
|
|
680
757
|
return function () {
|
|
681
758
|
window.removeEventListener('resize', resizeHandler);
|
|
759
|
+
buttonNext === null || buttonNext === void 0 ? void 0 : buttonNext.removeEventListener('click', clickNextHandler);
|
|
760
|
+
buttonClose === null || buttonClose === void 0 ? void 0 : buttonClose.removeEventListener('click', clickNextHandler);
|
|
682
761
|
};
|
|
683
762
|
}, [next, defaultCurrent]);
|
|
684
763
|
return React__default.createElement("div", {
|
|
685
|
-
className:
|
|
764
|
+
className: container,
|
|
686
765
|
ref: containerRef
|
|
687
766
|
}, swipes.map(function (item) {
|
|
688
767
|
var _item$id;
|
|
@@ -701,16 +780,16 @@ var Swiper = function Swiper(props) {
|
|
|
701
780
|
} : item.type === 'prev' ? {
|
|
702
781
|
width: width,
|
|
703
782
|
height: height,
|
|
704
|
-
left: left -
|
|
783
|
+
left: left - window.innerWidth
|
|
705
784
|
} : {
|
|
706
785
|
width: width,
|
|
707
786
|
height: height,
|
|
708
|
-
left: left +
|
|
787
|
+
left: left + window.innerWidth
|
|
709
788
|
},
|
|
710
|
-
className: clsx(
|
|
789
|
+
className: clsx(card, item.type === 'prev' ? card__prev : item.type === 'next' ? card__next : ''),
|
|
711
790
|
ref: getRef(item.id)
|
|
712
791
|
}, React__default.createElement("div", {
|
|
713
|
-
className: clsx(
|
|
792
|
+
className: clsx(content, className)
|
|
714
793
|
}, item.children)), !item.id && React__default.createElement("div", {
|
|
715
794
|
style: item.type === 'current' ? {
|
|
716
795
|
width: width,
|
|
@@ -725,21 +804,19 @@ var Swiper = function Swiper(props) {
|
|
|
725
804
|
height: height,
|
|
726
805
|
left: left + windowWidth
|
|
727
806
|
},
|
|
728
|
-
className: clsx(
|
|
807
|
+
className: clsx(card, item.type === 'prev' ? card__prev : item.type === 'next' ? card__next : '')
|
|
729
808
|
}, React__default.createElement(material.IconButton, {
|
|
730
809
|
disabled: true
|
|
731
810
|
}, React__default.createElement(StopIcon, null)))));
|
|
732
811
|
}), typeof isMobile !== 'undefined' && !isMobile && (prev === null || prev === void 0 ? void 0 : prev.id) && React__default.createElement("div", {
|
|
733
|
-
className: clsx(
|
|
734
|
-
ref: _buttonPrevRef
|
|
812
|
+
className: clsx(button, button__prev)
|
|
735
813
|
}, React__default.createElement(material.IconButton, {
|
|
736
|
-
disabled: load,
|
|
814
|
+
disabled: load || isMobile,
|
|
737
815
|
onClick: clickPrevHandler
|
|
738
816
|
}, React__default.createElement(NavigateNextIcon, null))), typeof isMobile !== 'undefined' && !isMobile && (next === null || next === void 0 ? void 0 : next.id) && React__default.createElement("div", {
|
|
739
|
-
className: clsx(
|
|
740
|
-
ref: _buttonNextRef
|
|
817
|
+
className: clsx(button, button__next)
|
|
741
818
|
}, React__default.createElement(material.IconButton, {
|
|
742
|
-
disabled: load,
|
|
819
|
+
disabled: load || isMobile,
|
|
743
820
|
onClick: clickNextHandler
|
|
744
821
|
}, React__default.createElement(NavigateNextIcon, null))));
|
|
745
822
|
};
|