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