@kolserdav/swiper 1.0.10 → 2.0.0-beta
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 +68 -39
- package/dist/index.css +13 -0
- package/dist/index.d.ts +5 -1
- package/dist/index.js +220 -137
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +226 -143
- package/dist/index.modern.js.map +1 -1
- package/package.json +5 -2
package/dist/index.modern.js
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React, { useState, useRef, useMemo, useEffect, createRef } from 'react';
|
|
2
|
+
import { IconButton } from '@mui/material';
|
|
2
3
|
import clsx from 'clsx';
|
|
4
|
+
import StopIcon from '@mui/icons-material/StopScreenShare';
|
|
5
|
+
import NavigateNextIcon from '@mui/icons-material/NavigateNext';
|
|
3
6
|
|
|
4
7
|
function _extends() {
|
|
5
8
|
_extends = Object.assign || function (target) {
|
|
@@ -194,80 +197,17 @@ function _switch(discriminant, cases) {
|
|
|
194
197
|
}
|
|
195
198
|
}
|
|
196
199
|
|
|
197
|
-
var styles = {"container":"_p6aGD","paper":"_3_Zua","card":"_7l_j0","prev":"_2S9j_","next":"_2T1oW","back":"_uQNyq","go":"_8240d","content":"_1EOHv","button":"_7_rsx","button_next":"_2kk22","button_prev":"_B1K5l"};
|
|
198
|
-
|
|
199
|
-
var _path, _path2;
|
|
200
|
-
|
|
201
|
-
function _extends$1() {
|
|
202
|
-
_extends$1 = Object.assign || function (target) {
|
|
203
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
204
|
-
var source = arguments[i];
|
|
205
|
-
|
|
206
|
-
for (var key in source) {
|
|
207
|
-
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
208
|
-
target[key] = source[key];
|
|
209
|
-
}
|
|
210
|
-
}
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
return target;
|
|
214
|
-
};
|
|
215
|
-
|
|
216
|
-
return _extends$1.apply(this, arguments);
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
function SvgNavigateNextBlack24Dp(props) {
|
|
220
|
-
return /*#__PURE__*/createElement("svg", _extends$1({
|
|
221
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
222
|
-
height: 24,
|
|
223
|
-
width: 24
|
|
224
|
-
}, props), _path || (_path = /*#__PURE__*/createElement("path", {
|
|
225
|
-
d: "M0 0h24v24H0V0z",
|
|
226
|
-
fill: "none"
|
|
227
|
-
})), _path2 || (_path2 = /*#__PURE__*/createElement("path", {
|
|
228
|
-
d: "M10.02 6L8.61 7.41 13.19 12l-4.58 4.59L10.02 18l6-6-6-6z"
|
|
229
|
-
})));
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
var _path$1, _path2$1;
|
|
233
|
-
|
|
234
|
-
function _extends$2() {
|
|
235
|
-
_extends$2 = Object.assign || function (target) {
|
|
236
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
237
|
-
var source = arguments[i];
|
|
238
|
-
|
|
239
|
-
for (var key in source) {
|
|
240
|
-
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
241
|
-
target[key] = source[key];
|
|
242
|
-
}
|
|
243
|
-
}
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
return target;
|
|
247
|
-
};
|
|
248
|
-
|
|
249
|
-
return _extends$2.apply(this, arguments);
|
|
250
|
-
}
|
|
251
|
-
|
|
252
|
-
function SvgNavigateNextBlack48Dp(props) {
|
|
253
|
-
return /*#__PURE__*/createElement("svg", _extends$2({
|
|
254
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
255
|
-
height: 48,
|
|
256
|
-
viewBox: "0 0 24 24",
|
|
257
|
-
width: 48
|
|
258
|
-
}, props), _path$1 || (_path$1 = /*#__PURE__*/createElement("path", {
|
|
259
|
-
d: "M0 0h24v24H0V0z",
|
|
260
|
-
fill: "none"
|
|
261
|
-
})), _path2$1 || (_path2$1 = /*#__PURE__*/createElement("path", {
|
|
262
|
-
d: "M10.02 6L8.61 7.41 13.19 12l-4.58 4.59L10.02 18l6-6-6-6z"
|
|
263
|
-
})));
|
|
264
|
-
}
|
|
200
|
+
var styles = {"container":"_p6aGD","paper":"_3_Zua","pipe":"_2tyje","card":"_7l_j0","prev":"_2S9j_","next":"_2T1oW","back":"_uQNyq","go":"_8240d","card__stop":"_1mqCn","content":"_1EOHv","button":"_7_rsx","button_next":"_2kk22","button_prev":"_B1K5l"};
|
|
265
201
|
|
|
266
202
|
var SWIPE_TRANSITION_TIMEOUT = 400;
|
|
267
203
|
|
|
268
|
-
var getSwipes = function getSwipes(
|
|
204
|
+
var getSwipes = function getSwipes(prev, current, next, swipes) {
|
|
205
|
+
if (((prev === null || prev === void 0 ? void 0 : prev.id) === (current === null || current === void 0 ? void 0 : current.id) || (current === null || current === void 0 ? void 0 : current.id) === (next === null || next === void 0 ? void 0 : next.id) || (next === null || next === void 0 ? void 0 : next.id) === (prev === null || prev === void 0 ? void 0 : prev.id)) && swipes.length) {
|
|
206
|
+
return swipes;
|
|
207
|
+
}
|
|
208
|
+
|
|
269
209
|
var result = [1, 2, 3].map(function (id) {
|
|
270
|
-
var item = id === 1 ? _extends({},
|
|
210
|
+
var item = id === 1 ? _extends({}, prev) : id === 2 ? current : _extends({}, next);
|
|
271
211
|
item.type = id === 1 ? 'prev' : id === 2 ? 'current' : 'next';
|
|
272
212
|
return item;
|
|
273
213
|
});
|
|
@@ -277,7 +217,7 @@ var getSwipes = function getSwipes(__prev, __current, __next) {
|
|
|
277
217
|
var getDefaultSwipe = function getDefaultSwipe() {
|
|
278
218
|
return {
|
|
279
219
|
id: Math.ceil(Math.random() * 1000),
|
|
280
|
-
children:
|
|
220
|
+
children: React.createElement("div", null)
|
|
281
221
|
};
|
|
282
222
|
};
|
|
283
223
|
|
|
@@ -285,10 +225,17 @@ var refs = {};
|
|
|
285
225
|
var startClientX;
|
|
286
226
|
var lastLeft;
|
|
287
227
|
var animated = false;
|
|
228
|
+
var prePrev = null;
|
|
229
|
+
var postNext = null;
|
|
230
|
+
|
|
231
|
+
var _defaultCurrent;
|
|
232
|
+
|
|
233
|
+
var oldSwipes = [];
|
|
288
234
|
var Swiper = function Swiper(props) {
|
|
289
235
|
var defaultCurrent = props.defaultCurrent,
|
|
290
236
|
getNext = props.getNext,
|
|
291
237
|
getPrev = props.getPrev,
|
|
238
|
+
onSwipe = props.onSwipe,
|
|
292
239
|
className = props.className,
|
|
293
240
|
prevButtonRef = props.prevButtonRef,
|
|
294
241
|
nextButtonRef = props.nextButtonRef,
|
|
@@ -336,9 +283,14 @@ var Swiper = function Swiper(props) {
|
|
|
336
283
|
|
|
337
284
|
var _buttonNextRef = useRef(null);
|
|
338
285
|
|
|
286
|
+
if (typeof _defaultCurrent === 'undefined') {
|
|
287
|
+
_defaultCurrent = defaultCurrent;
|
|
288
|
+
}
|
|
289
|
+
|
|
339
290
|
var swipes = useMemo(function () {
|
|
340
|
-
return getSwipes(prev || getDefaultSwipe(), current || defaultCurrent, next || getDefaultSwipe());
|
|
341
|
-
}, [next]);
|
|
291
|
+
return getSwipes(prev || getDefaultSwipe(), current || defaultCurrent, next || getDefaultSwipe(), oldSwipes);
|
|
292
|
+
}, [next, prev, current]);
|
|
293
|
+
oldSwipes = swipes;
|
|
342
294
|
|
|
343
295
|
var getRef = function getRef(id) {
|
|
344
296
|
refs[id] = refs[id] ? refs[id] : createRef();
|
|
@@ -366,7 +318,6 @@ var Swiper = function Swiper(props) {
|
|
|
366
318
|
(_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(styles.back);
|
|
367
319
|
(_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(styles.back);
|
|
368
320
|
(_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(styles.back);
|
|
369
|
-
setLeft(0);
|
|
370
321
|
setTimeout(function () {
|
|
371
322
|
var _getRef$current10, _getRef$current11, _getRef$current12;
|
|
372
323
|
|
|
@@ -376,56 +327,142 @@ var Swiper = function Swiper(props) {
|
|
|
376
327
|
}, SWIPE_TRANSITION_TIMEOUT);
|
|
377
328
|
};
|
|
378
329
|
|
|
330
|
+
var wait = function wait(miliseconds) {
|
|
331
|
+
try {
|
|
332
|
+
return Promise.resolve(new Promise(function (resolve) {
|
|
333
|
+
setTimeout(function () {
|
|
334
|
+
resolve(0);
|
|
335
|
+
}, miliseconds);
|
|
336
|
+
})).then(function () {});
|
|
337
|
+
} catch (e) {
|
|
338
|
+
return Promise.reject(e);
|
|
339
|
+
}
|
|
340
|
+
};
|
|
341
|
+
|
|
342
|
+
var setPreValues = function setPreValues(_p, _n) {
|
|
343
|
+
if (_p) {
|
|
344
|
+
getPrev((_p === null || _p === void 0 ? void 0 : _p.id) || 0).then(function (d) {
|
|
345
|
+
prePrev = d;
|
|
346
|
+
});
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
if (_n) {
|
|
350
|
+
getNext((_n === null || _n === void 0 ? void 0 : _n.id) || 0).then(function (d) {
|
|
351
|
+
postNext = d;
|
|
352
|
+
});
|
|
353
|
+
}
|
|
354
|
+
};
|
|
355
|
+
|
|
379
356
|
var swipe = function swipe(_lastLeft) {
|
|
380
357
|
try {
|
|
381
|
-
var
|
|
358
|
+
var _temp7 = function _temp7(_result2) {
|
|
359
|
+
if (_exit2) return _result2;
|
|
382
360
|
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
if (_exit2) return _result;
|
|
387
|
-
setGoClass();
|
|
388
|
-
};
|
|
361
|
+
if (onSwipe !== undefined) {
|
|
362
|
+
onSwipe(currentId);
|
|
363
|
+
}
|
|
389
364
|
|
|
390
|
-
|
|
365
|
+
return 0;
|
|
366
|
+
};
|
|
367
|
+
|
|
368
|
+
var _exit2 = false;
|
|
369
|
+
var startTime;
|
|
370
|
+
var currentId = 0;
|
|
391
371
|
|
|
392
|
-
|
|
372
|
+
var _temp8 = function () {
|
|
373
|
+
if (Math.abs(_lastLeft) > width / 3) {
|
|
374
|
+
return function () {
|
|
393
375
|
if (_lastLeft < 0) {
|
|
376
|
+
var _temp9 = function _temp9() {
|
|
377
|
+
return Promise.resolve(wait(SWIPE_TRANSITION_TIMEOUT - (new Date().getTime() - startTime))).then(function () {
|
|
378
|
+
setLeft(0);
|
|
379
|
+
setPrev(current);
|
|
380
|
+
setCurrent(next);
|
|
381
|
+
currentId = next === null || next === void 0 ? void 0 : next.id;
|
|
382
|
+
setNext(postNext);
|
|
383
|
+
});
|
|
384
|
+
};
|
|
385
|
+
|
|
394
386
|
if (!(next !== null && next !== void 0 && next.id)) {
|
|
395
387
|
setBackClass();
|
|
388
|
+
setLeft(0);
|
|
396
389
|
_exit2 = true;
|
|
397
390
|
return 1;
|
|
398
391
|
}
|
|
399
392
|
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
393
|
+
setGoClass();
|
|
394
|
+
setLeft(windowWidth * -1);
|
|
395
|
+
startTime = new Date().getTime();
|
|
396
|
+
|
|
397
|
+
var _temp10 = function () {
|
|
398
|
+
var _postNext;
|
|
399
|
+
|
|
400
|
+
if ((next === null || next === void 0 ? void 0 : next.id) === ((_postNext = postNext) === null || _postNext === void 0 ? void 0 : _postNext.id)) {
|
|
401
|
+
return Promise.resolve(new Promise(function (resolve) {
|
|
402
|
+
var clear = setInterval(function () {
|
|
403
|
+
var _postNext2;
|
|
404
|
+
|
|
405
|
+
if ((next === null || next === void 0 ? void 0 : next.id) !== ((_postNext2 = postNext) === null || _postNext2 === void 0 ? void 0 : _postNext2.id)) {
|
|
406
|
+
clearInterval(clear);
|
|
407
|
+
resolve(0);
|
|
408
|
+
}
|
|
409
|
+
}, 0);
|
|
410
|
+
})).then(function () {});
|
|
411
|
+
}
|
|
412
|
+
}();
|
|
413
|
+
|
|
414
|
+
return _temp10 && _temp10.then ? _temp10.then(_temp9) : _temp9(_temp10);
|
|
405
415
|
} else {
|
|
416
|
+
var _temp11 = function _temp11() {
|
|
417
|
+
return Promise.resolve(wait(SWIPE_TRANSITION_TIMEOUT - (new Date().getTime() - startTime))).then(function () {
|
|
418
|
+
setLeft(0);
|
|
419
|
+
setPrev(prePrev);
|
|
420
|
+
setCurrent(prev);
|
|
421
|
+
currentId = prev === null || prev === void 0 ? void 0 : prev.id;
|
|
422
|
+
setNext(current);
|
|
423
|
+
});
|
|
424
|
+
};
|
|
425
|
+
|
|
406
426
|
if (!(prev !== null && prev !== void 0 && prev.id)) {
|
|
407
427
|
setBackClass();
|
|
428
|
+
setLeft(0);
|
|
408
429
|
_exit2 = true;
|
|
409
430
|
return 1;
|
|
410
431
|
}
|
|
411
432
|
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
433
|
+
setGoClass();
|
|
434
|
+
setLeft(windowWidth);
|
|
435
|
+
startTime = new Date().getTime();
|
|
436
|
+
|
|
437
|
+
var _temp12 = function () {
|
|
438
|
+
var _prePrev;
|
|
439
|
+
|
|
440
|
+
if ((prev === null || prev === void 0 ? void 0 : prev.id) === ((_prePrev = prePrev) === null || _prePrev === void 0 ? void 0 : _prePrev.id)) {
|
|
441
|
+
return Promise.resolve(new Promise(function (resolve) {
|
|
442
|
+
var clear = setInterval(function () {
|
|
443
|
+
var _prePrev2;
|
|
444
|
+
|
|
445
|
+
if ((prev === null || prev === void 0 ? void 0 : prev.id) !== ((_prePrev2 = prePrev) === null || _prePrev2 === void 0 ? void 0 : _prePrev2.id)) {
|
|
446
|
+
clearInterval(clear);
|
|
447
|
+
resolve(0);
|
|
448
|
+
}
|
|
449
|
+
}, 0);
|
|
450
|
+
})).then(function () {});
|
|
451
|
+
}
|
|
452
|
+
}();
|
|
453
|
+
|
|
454
|
+
return _temp12 && _temp12.then ? _temp12.then(_temp11) : _temp11(_temp12);
|
|
417
455
|
}
|
|
418
456
|
}();
|
|
419
|
-
|
|
420
|
-
return _temp6 && _temp6.then ? _temp6.then(_temp5) : _temp5(_temp6);
|
|
421
457
|
} else {
|
|
422
458
|
setBackClass();
|
|
459
|
+
setLeft(0);
|
|
460
|
+
_exit2 = true;
|
|
461
|
+
return 1;
|
|
423
462
|
}
|
|
424
463
|
}();
|
|
425
464
|
|
|
426
|
-
return Promise.resolve(
|
|
427
|
-
return _exit2 ? _result2 : 0;
|
|
428
|
-
}) : _exit2 ? _temp4 : 0);
|
|
465
|
+
return Promise.resolve(_temp8 && _temp8.then ? _temp8.then(_temp7) : _temp7(_temp8));
|
|
429
466
|
} catch (e) {
|
|
430
467
|
return Promise.reject(e);
|
|
431
468
|
}
|
|
@@ -440,7 +477,7 @@ var Swiper = function Swiper(props) {
|
|
|
440
477
|
var clientX = (_touches$ = touches[0]) === null || _touches$ === void 0 ? void 0 : _touches$.clientX;
|
|
441
478
|
startClientX = startClientX || 0;
|
|
442
479
|
|
|
443
|
-
var
|
|
480
|
+
var _temp14 = _switch(name, [[function () {
|
|
444
481
|
return 'onTouchStart';
|
|
445
482
|
}, function () {
|
|
446
483
|
startClientX = clientX;
|
|
@@ -459,19 +496,7 @@ var Swiper = function Swiper(props) {
|
|
|
459
496
|
});
|
|
460
497
|
}], []]);
|
|
461
498
|
|
|
462
|
-
return Promise.resolve(
|
|
463
|
-
} catch (e) {
|
|
464
|
-
return Promise.reject(e);
|
|
465
|
-
}
|
|
466
|
-
};
|
|
467
|
-
|
|
468
|
-
var wait = function wait(miliseconds) {
|
|
469
|
-
try {
|
|
470
|
-
return Promise.resolve(new Promise(function (resolve) {
|
|
471
|
-
setTimeout(function () {
|
|
472
|
-
resolve(0);
|
|
473
|
-
}, miliseconds);
|
|
474
|
-
})).then(function () {});
|
|
499
|
+
return Promise.resolve(_temp14 && _temp14.then ? _temp14.then(function () {}) : void 0);
|
|
475
500
|
} catch (e) {
|
|
476
501
|
return Promise.reject(e);
|
|
477
502
|
}
|
|
@@ -534,6 +559,29 @@ var Swiper = function Swiper(props) {
|
|
|
534
559
|
}
|
|
535
560
|
};
|
|
536
561
|
|
|
562
|
+
var infitationAnimationHandler = function infitationAnimationHandler(shift) {
|
|
563
|
+
try {
|
|
564
|
+
if (shift < 0) {
|
|
565
|
+
setGoClass();
|
|
566
|
+
} else {
|
|
567
|
+
setBackClass();
|
|
568
|
+
}
|
|
569
|
+
|
|
570
|
+
setLeft(shift);
|
|
571
|
+
return Promise.resolve(wait(SWIPE_TRANSITION_TIMEOUT)).then(function () {
|
|
572
|
+
if (shift < 0) {
|
|
573
|
+
setBackClass();
|
|
574
|
+
} else {
|
|
575
|
+
setGoClass();
|
|
576
|
+
}
|
|
577
|
+
|
|
578
|
+
setLeft(0);
|
|
579
|
+
});
|
|
580
|
+
} catch (e) {
|
|
581
|
+
return Promise.reject(e);
|
|
582
|
+
}
|
|
583
|
+
};
|
|
584
|
+
|
|
537
585
|
useEffect(function () {
|
|
538
586
|
var _containerRef$current10, _containerRef$current11, _containerRef$current12, _containerRef$current13, _containerRef$current14, _containerRef$current15, _containerRef$current16, _containerRef$current17, _containerRef$current18;
|
|
539
587
|
|
|
@@ -560,14 +608,21 @@ var Swiper = function Swiper(props) {
|
|
|
560
608
|
setWindowWidth(_windowWidth);
|
|
561
609
|
}
|
|
562
610
|
|
|
563
|
-
if (!current || !prev || !next) {
|
|
564
|
-
setCurrent(defaultCurrent);
|
|
565
|
-
|
|
611
|
+
if (!current || !prev || !next || _defaultCurrent !== defaultCurrent) {
|
|
566
612
|
try {
|
|
567
|
-
return Promise.resolve(getNext(defaultCurrent.id || 0)).then(function (
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
setPrev(
|
|
613
|
+
return Promise.resolve(getNext(defaultCurrent.id || 0)).then(function (_n) {
|
|
614
|
+
return Promise.resolve(getPrev(defaultCurrent.id || 0)).then(function (_p) {
|
|
615
|
+
setCurrent(defaultCurrent);
|
|
616
|
+
setPrev(_p);
|
|
617
|
+
setNext(_n);
|
|
618
|
+
setLeft(_left);
|
|
619
|
+
return Promise.resolve(getPrev(_p.id || 0)).then(function (_getPrev) {
|
|
620
|
+
prePrev = _getPrev;
|
|
621
|
+
return Promise.resolve(getNext(_n.id || 0)).then(function (_getNext) {
|
|
622
|
+
postNext = _getNext;
|
|
623
|
+
_defaultCurrent = defaultCurrent;
|
|
624
|
+
});
|
|
625
|
+
});
|
|
571
626
|
});
|
|
572
627
|
});
|
|
573
628
|
} catch (e) {
|
|
@@ -578,22 +633,36 @@ var Swiper = function Swiper(props) {
|
|
|
578
633
|
if (invitationAnimation && width && !animated) {
|
|
579
634
|
animated = true;
|
|
580
635
|
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
636
|
+
(function () {
|
|
637
|
+
try {
|
|
638
|
+
var _temp18 = function _temp18() {
|
|
639
|
+
var _temp15 = function () {
|
|
640
|
+
if (next !== null && next !== void 0 && next.id) {
|
|
641
|
+
return Promise.resolve(infitationAnimationHandler(-100)).then(function () {});
|
|
642
|
+
}
|
|
643
|
+
}();
|
|
644
|
+
|
|
645
|
+
if (_temp15 && _temp15.then) return _temp15.then(function () {});
|
|
646
|
+
};
|
|
647
|
+
|
|
648
|
+
var _temp19 = function () {
|
|
649
|
+
if (prev !== null && prev !== void 0 && prev.id) {
|
|
650
|
+
return Promise.resolve(infitationAnimationHandler(100)).then(function () {});
|
|
651
|
+
}
|
|
652
|
+
}();
|
|
653
|
+
|
|
654
|
+
return _temp19 && _temp19.then ? _temp19.then(_temp18) : _temp18(_temp19);
|
|
655
|
+
} catch (e) {
|
|
656
|
+
Promise.reject(e);
|
|
657
|
+
}
|
|
658
|
+
})();
|
|
591
659
|
}
|
|
592
660
|
|
|
593
661
|
if (typeof isMobile === 'undefined') {
|
|
594
662
|
setIsMobile('ontouchstart' in window || typeof navigator.msMaxTouchPoints !== 'undefined');
|
|
595
663
|
}
|
|
596
664
|
|
|
665
|
+
setPreValues(prev, next);
|
|
597
666
|
prevButton === null || prevButton === void 0 ? void 0 : prevButton.addEventListener('click', clickPrevHandler);
|
|
598
667
|
nextButton === null || nextButton === void 0 ? void 0 : nextButton.addEventListener('click', clickNextHandler);
|
|
599
668
|
window.addEventListener('resize', resizeHandler);
|
|
@@ -602,19 +671,16 @@ var Swiper = function Swiper(props) {
|
|
|
602
671
|
nextButton === null || nextButton === void 0 ? void 0 : nextButton.removeEventListener('click', clickNextHandler);
|
|
603
672
|
window.removeEventListener('resize', resizeHandler);
|
|
604
673
|
};
|
|
605
|
-
}, [next,
|
|
606
|
-
return
|
|
674
|
+
}, [next, defaultCurrent]);
|
|
675
|
+
return React.createElement("div", {
|
|
607
676
|
className: styles.container,
|
|
608
677
|
ref: containerRef
|
|
609
678
|
}, swipes.map(function (item) {
|
|
610
679
|
var _item$id;
|
|
611
680
|
|
|
612
|
-
return
|
|
613
|
-
key: item.id
|
|
614
|
-
|
|
615
|
-
display: 'none'
|
|
616
|
-
} : {}
|
|
617
|
-
}, item.id && width && React__default.createElement("div", {
|
|
681
|
+
return React.createElement("div", {
|
|
682
|
+
key: item.id
|
|
683
|
+
}, React.createElement(React.Fragment, null, item.id && width && React.createElement("div", {
|
|
618
684
|
onTouchMove: onTouchWrapper('onTouchMove'),
|
|
619
685
|
onTouchStart: onTouchWrapper('onTouchStart'),
|
|
620
686
|
onTouchEnd: onTouchWrapper('onTouchEnd'),
|
|
@@ -634,16 +700,33 @@ var Swiper = function Swiper(props) {
|
|
|
634
700
|
},
|
|
635
701
|
className: clsx(styles.card, item.type === 'prev' ? styles.prev : item.type === 'next' ? styles.next : ''),
|
|
636
702
|
ref: getRef(item.id)
|
|
637
|
-
},
|
|
703
|
+
}, React.createElement("div", {
|
|
638
704
|
className: clsx(styles.content, className)
|
|
639
|
-
}, item.children))
|
|
640
|
-
|
|
705
|
+
}, item.children)), !item.id && React.createElement("div", {
|
|
706
|
+
style: item.type === 'current' ? {
|
|
707
|
+
width: width,
|
|
708
|
+
height: height,
|
|
709
|
+
left: left
|
|
710
|
+
} : item.type === 'prev' ? {
|
|
711
|
+
width: width,
|
|
712
|
+
height: height,
|
|
713
|
+
left: left - windowWidth
|
|
714
|
+
} : {
|
|
715
|
+
width: width,
|
|
716
|
+
height: height,
|
|
717
|
+
left: left + windowWidth
|
|
718
|
+
},
|
|
719
|
+
className: clsx(styles.card, item.type === 'prev' ? styles.prev : item.type === 'next' ? styles.next : '')
|
|
720
|
+
}, React.createElement(IconButton, {
|
|
721
|
+
disabled: true
|
|
722
|
+
}, React.createElement(StopIcon, null)))));
|
|
723
|
+
}), typeof isMobile !== 'undefined' && !isMobile && !prevButtonRef && (prev === null || prev === void 0 ? void 0 : prev.id) && React.createElement("div", {
|
|
641
724
|
className: clsx(styles.button, styles.button_prev),
|
|
642
725
|
ref: _buttonPrevRef
|
|
643
|
-
},
|
|
726
|
+
}, React.createElement(IconButton, null, React.createElement(NavigateNextIcon, null))), typeof isMobile !== 'undefined' && !isMobile && !nextButtonRef && (next === null || next === void 0 ? void 0 : next.id) && React.createElement("div", {
|
|
644
727
|
className: clsx(styles.button, styles.button_next),
|
|
645
728
|
ref: _buttonNextRef
|
|
646
|
-
},
|
|
729
|
+
}, React.createElement(IconButton, null, React.createElement(NavigateNextIcon, null))));
|
|
647
730
|
};
|
|
648
731
|
Swiper.defaultProps = {
|
|
649
732
|
className: ''
|