react-slideshow-image 4.2.1 → 4.3.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -6,14 +6,12 @@ function _extends() {
6
6
  _extends = Object.assign ? Object.assign.bind() : function (target) {
7
7
  for (var i = 1; i < arguments.length; i++) {
8
8
  var source = arguments[i];
9
-
10
9
  for (var key in source) {
11
10
  if (Object.prototype.hasOwnProperty.call(source, key)) {
12
11
  target[key] = source[key];
13
12
  }
14
13
  }
15
14
  }
16
-
17
15
  return target;
18
16
  };
19
17
  return _extends.apply(this, arguments);
@@ -23,7 +21,6 @@ var getStartingIndex = function getStartingIndex(children, defaultIndex) {
23
21
  if (defaultIndex && defaultIndex < React.Children.count(children)) {
24
22
  return defaultIndex;
25
23
  }
26
-
27
24
  return 0;
28
25
  };
29
26
  var getResponsiveSettings = function getResponsiveSettings(wrapperWidth, responsive) {
@@ -32,7 +29,6 @@ var getResponsiveSettings = function getResponsiveSettings(wrapperWidth, respons
32
29
  return each.breakpoint <= wrapperWidth;
33
30
  });
34
31
  }
35
-
36
32
  return;
37
33
  };
38
34
  var EASING_METHODS = {
@@ -48,12 +44,11 @@ var getEasing = function getEasing(easeMethod) {
48
44
  if (easeMethod) {
49
45
  return EASING_METHODS[easeMethod];
50
46
  }
51
-
52
47
  return EASING_METHODS.linear;
53
48
  };
54
49
  var showPreviousArrow = function showPreviousArrow(_ref, currentIndex, moveSlides) {
55
50
  var prevArrow = _ref.prevArrow,
56
- infinite = _ref.infinite;
51
+ infinite = _ref.infinite;
57
52
  var isDisabled = currentIndex <= 0 && !infinite;
58
53
  var props = {
59
54
  'data-type': 'prev',
@@ -61,13 +56,11 @@ var showPreviousArrow = function showPreviousArrow(_ref, currentIndex, moveSlide
61
56
  disabled: isDisabled,
62
57
  onClick: moveSlides
63
58
  };
64
-
65
59
  if (prevArrow) {
66
60
  return /*#__PURE__*/React.cloneElement(prevArrow, _extends({
67
61
  className: (prevArrow.props.className || '') + " nav " + (isDisabled ? 'disabled' : '')
68
62
  }, props));
69
63
  }
70
-
71
64
  var className = "nav default-nav " + (isDisabled ? 'disabled' : '');
72
65
  return /*#__PURE__*/React.createElement("button", Object.assign({
73
66
  type: "button",
@@ -80,16 +73,16 @@ var showPreviousArrow = function showPreviousArrow(_ref, currentIndex, moveSlide
80
73
  d: "M16.67 0l2.83 2.829-9.339 9.175 9.339 9.167-2.83 2.829-12.17-11.996z"
81
74
  })));
82
75
  };
83
- var showNextArrow = function showNextArrow(properties, currentIndex, moveSlides) {
76
+ var showNextArrow = function showNextArrow(properties, currentIndex, moveSlides, responsiveSettings) {
84
77
  var nextArrow = properties.nextArrow,
85
- infinite = properties.infinite,
86
- children = properties.children;
78
+ infinite = properties.infinite,
79
+ children = properties.children;
87
80
  var slidesToScroll = 1;
88
-
89
- if ('slidesToScroll' in properties) {
81
+ if (responsiveSettings) {
82
+ slidesToScroll = responsiveSettings == null ? void 0 : responsiveSettings.settings.slidesToScroll;
83
+ } else if ('slidesToScroll' in properties) {
90
84
  slidesToScroll = properties.slidesToScroll || 1;
91
85
  }
92
-
93
86
  var isDisabled = currentIndex >= React.Children.count(children) - slidesToScroll && !infinite;
94
87
  var props = {
95
88
  'data-type': 'next',
@@ -97,13 +90,11 @@ var showNextArrow = function showNextArrow(properties, currentIndex, moveSlides)
97
90
  disabled: isDisabled,
98
91
  onClick: moveSlides
99
92
  };
100
-
101
93
  if (nextArrow) {
102
94
  return /*#__PURE__*/React.cloneElement(nextArrow, _extends({
103
95
  className: (nextArrow.props.className || '') + " nav " + (isDisabled ? 'disabled' : '')
104
96
  }, props));
105
97
  }
106
-
107
98
  var className = "nav default-nav " + (isDisabled ? 'disabled' : '');
108
99
  return /*#__PURE__*/React.createElement("button", Object.assign({
109
100
  type: "button",
@@ -116,7 +107,6 @@ var showNextArrow = function showNextArrow(properties, currentIndex, moveSlides)
116
107
  d: "M5 3l3.057-3 11.943 12-11.943 12-3.057-3 9-9z"
117
108
  })));
118
109
  };
119
-
120
110
  var showDefaultIndicator = function showDefaultIndicator(isCurrentPageActive, key, indicatorProps) {
121
111
  return /*#__PURE__*/React.createElement("li", {
122
112
  key: key
@@ -125,25 +115,21 @@ var showDefaultIndicator = function showDefaultIndicator(isCurrentPageActive, ke
125
115
  className: "each-slideshow-indicator " + (isCurrentPageActive ? 'active' : '')
126
116
  }, indicatorProps)));
127
117
  };
128
-
129
118
  var showCustomIndicator = function showCustomIndicator(isCurrentPageActive, key, indicatorProps, eachIndicator) {
130
119
  return /*#__PURE__*/React.cloneElement(eachIndicator, _extends({
131
120
  className: eachIndicator.props.className + " " + (isCurrentPageActive ? 'active' : ''),
132
121
  key: key
133
122
  }, indicatorProps));
134
123
  };
135
-
136
124
  var showIndicators = function showIndicators(props, currentIndex, navigate, responsiveSettings) {
137
125
  var children = props.children,
138
- indicators = props.indicators;
126
+ indicators = props.indicators;
139
127
  var slidesToScroll = 1;
140
-
141
128
  if (responsiveSettings) {
142
129
  slidesToScroll = responsiveSettings == null ? void 0 : responsiveSettings.settings.slidesToScroll;
143
130
  } else if ('slidesToScroll' in props) {
144
131
  slidesToScroll = props.slidesToScroll || 1;
145
132
  }
146
-
147
133
  var pages = Math.ceil(React.Children.count(children) / slidesToScroll);
148
134
  return /*#__PURE__*/React.createElement("ul", {
149
135
  className: "indicators"
@@ -156,11 +142,9 @@ var showIndicators = function showIndicators(props, currentIndex, navigate, resp
156
142
  onClick: navigate
157
143
  };
158
144
  var isCurrentPageActive = Math.floor((currentIndex + slidesToScroll - 1) / slidesToScroll) === key;
159
-
160
145
  if (typeof indicators === 'function') {
161
146
  return showCustomIndicator(isCurrentPageActive, key, indicatorProps, indicators(key));
162
147
  }
163
-
164
148
  return showDefaultIndicator(isCurrentPageActive, key, indicatorProps);
165
149
  }));
166
150
  };
@@ -182,9 +166,8 @@ var defaultProps = {
182
166
 
183
167
  var FadeZoom = /*#__PURE__*/React.forwardRef(function (props, ref) {
184
168
  var _useState = useState(getStartingIndex(props.children, props.defaultIndex)),
185
- index = _useState[0],
186
- setIndex = _useState[1];
187
-
169
+ index = _useState[0],
170
+ setIndex = _useState[1];
188
171
  var wrapperRef = useRef(null);
189
172
  var innerWrapperRef = useRef(null);
190
173
  var tweenGroup = useRef(new Group());
@@ -198,10 +181,8 @@ var FadeZoom = /*#__PURE__*/React.forwardRef(function (props, ref) {
198
181
  var wrapperWidth = wrapperRef.current.clientWidth;
199
182
  var fullwidth = wrapperWidth * childrenCount;
200
183
  innerWrapperRef.current.style.width = fullwidth + "px";
201
-
202
184
  for (var _index = 0; _index < innerWrapperRef.current.children.length; _index++) {
203
185
  var eachDiv = innerWrapperRef.current.children[_index];
204
-
205
186
  if (eachDiv) {
206
187
  eachDiv.style.width = wrapperWidth + "px";
207
188
  eachDiv.style.left = _index * -wrapperWidth + "px";
@@ -221,14 +202,13 @@ var FadeZoom = /*#__PURE__*/React.forwardRef(function (props, ref) {
221
202
  }, [wrapperRef, applyStyle]);
222
203
  var play = useCallback(function () {
223
204
  var autoplay = props.autoplay,
224
- children = props.children,
225
- duration = props.duration,
226
- infinite = props.infinite;
227
-
205
+ children = props.children,
206
+ duration = props.duration,
207
+ infinite = props.infinite;
228
208
  if (autoplay && React.Children.count(children) > 1 && (infinite || index < React.Children.count(children) - 1)) {
229
209
  timeout.current = setTimeout(moveNext, duration);
230
- } // eslint-disable-next-line react-hooks/exhaustive-deps
231
-
210
+ }
211
+ // eslint-disable-next-line react-hooks/exhaustive-deps
232
212
  }, [props, index]);
233
213
  useEffect(function () {
234
214
  initResizeObserver();
@@ -262,78 +242,61 @@ var FadeZoom = /*#__PURE__*/React.forwardRef(function (props, ref) {
262
242
  }
263
243
  };
264
244
  });
265
-
266
245
  var removeResizeObserver = function removeResizeObserver() {
267
246
  if (resizeObserver.current && wrapperRef.current) {
268
247
  resizeObserver.current.unobserve(wrapperRef.current);
269
248
  }
270
249
  };
271
-
272
250
  var pauseSlides = function pauseSlides() {
273
251
  if (props.pauseOnHover) {
274
252
  clearTimeout(timeout.current);
275
253
  }
276
254
  };
277
-
278
255
  var startSlides = function startSlides() {
279
256
  var pauseOnHover = props.pauseOnHover,
280
- autoplay = props.autoplay,
281
- duration = props.duration;
282
-
257
+ autoplay = props.autoplay,
258
+ duration = props.duration;
283
259
  if (pauseOnHover && autoplay) {
284
260
  timeout.current = setTimeout(function () {
285
261
  return moveNext();
286
262
  }, duration);
287
263
  }
288
264
  };
289
-
290
265
  var moveNext = function moveNext() {
291
266
  var children = props.children,
292
- infinite = props.infinite;
293
-
267
+ infinite = props.infinite;
294
268
  if (!infinite && index === React.Children.count(children) - 1) {
295
269
  return;
296
270
  }
297
-
298
271
  transitionSlide((index + 1) % React.Children.count(children));
299
272
  };
300
-
301
273
  var moveBack = function moveBack() {
302
274
  var children = props.children,
303
- infinite = props.infinite;
304
-
275
+ infinite = props.infinite;
305
276
  if (!infinite && index === 0) {
306
277
  return;
307
278
  }
308
-
309
279
  transitionSlide(index === 0 ? React.Children.count(children) - 1 : index - 1);
310
280
  };
311
-
312
281
  var preTransition = function preTransition(event) {
313
282
  var currentTarget = event.currentTarget;
314
-
315
283
  if (currentTarget.dataset.type === 'prev') {
316
284
  moveBack();
317
285
  } else {
318
286
  moveNext();
319
287
  }
320
288
  };
321
-
322
289
  var animate = function animate() {
323
290
  requestAnimationFrame(animate);
324
291
  tweenGroup.current.update();
325
292
  };
326
-
327
293
  var transitionSlide = function transitionSlide(newIndex) {
328
294
  var existingTweens = tweenGroup.current.getAll();
329
-
330
295
  if (!existingTweens.length) {
331
296
  var _innerWrapperRef$curr;
332
-
333
297
  if (!((_innerWrapperRef$curr = innerWrapperRef.current) != null && _innerWrapperRef$curr.children[newIndex])) {
334
298
  newIndex = 0;
335
299
  }
336
-
337
300
  clearTimeout(timeout.current);
338
301
  var value = {
339
302
  opacity: 0,
@@ -347,7 +310,6 @@ var FadeZoom = /*#__PURE__*/React.forwardRef(function (props, ref) {
347
310
  if (!innerWrapperRef.current) {
348
311
  return;
349
312
  }
350
-
351
313
  innerWrapperRef.current.children[newIndex].style.opacity = value.opacity;
352
314
  innerWrapperRef.current.children[index].style.opacity = 1 - value.opacity;
353
315
  innerWrapperRef.current.children[index].style.transform = "scale(" + value.scale + ")";
@@ -363,7 +325,6 @@ var FadeZoom = /*#__PURE__*/React.forwardRef(function (props, ref) {
363
325
  setIndex(newIndex);
364
326
  innerWrapperRef.current.children[index].style.transform = "scale(1)";
365
327
  }
366
-
367
328
  if (typeof props.onChange === 'function') {
368
329
  props.onChange(index, newIndex);
369
330
  }
@@ -371,25 +332,20 @@ var FadeZoom = /*#__PURE__*/React.forwardRef(function (props, ref) {
371
332
  tween.start();
372
333
  }
373
334
  };
374
-
375
335
  var moveTo = function moveTo(gotoIndex) {
376
336
  if (gotoIndex !== index) {
377
337
  transitionSlide(gotoIndex);
378
338
  }
379
339
  };
380
-
381
340
  var navigate = function navigate(event) {
382
341
  var currentTarget = event.currentTarget;
383
-
384
342
  if (!currentTarget.dataset.key) {
385
343
  return;
386
344
  }
387
-
388
345
  if (parseInt(currentTarget.dataset.key) !== index) {
389
346
  moveTo(parseInt(currentTarget.dataset.key));
390
347
  }
391
348
  };
392
-
393
349
  return /*#__PURE__*/React.createElement("div", {
394
350
  dir: "ltr",
395
351
  "aria-roledescription": "carousel"
@@ -438,81 +394,83 @@ Zoom.defaultProps = defaultProps;
438
394
 
439
395
  var Slide = /*#__PURE__*/React.forwardRef(function (props, ref) {
440
396
  var _useState = useState(getStartingIndex(props.children, props.defaultIndex)),
441
- index = _useState[0],
442
- setIndex = _useState[1];
443
-
397
+ index = _useState[0],
398
+ setIndex = _useState[1];
444
399
  var _useState2 = useState(0),
445
- wrapperWidth = _useState2[0],
446
- setWrapperWidth = _useState2[1];
447
-
400
+ wrapperSize = _useState2[0],
401
+ setWrapperSize = _useState2[1];
448
402
  var wrapperRef = useRef(null);
449
403
  var innerWrapperRef = useRef(null);
450
404
  var tweenGroup = useRef(new Group());
451
405
  var responsiveSettings = useMemo(function () {
452
- return getResponsiveSettings(wrapperWidth, props.responsive);
453
- }, [wrapperWidth, props.responsive]);
406
+ return getResponsiveSettings(wrapperSize, props.responsive);
407
+ }, [wrapperSize, props.responsive]);
454
408
  var slidesToScroll = useMemo(function () {
455
409
  if (responsiveSettings) {
456
410
  return responsiveSettings.settings.slidesToScroll;
457
411
  }
458
-
459
412
  return props.slidesToScroll || 1;
460
413
  }, [responsiveSettings, props.slidesToScroll]);
461
414
  var slidesToShow = useMemo(function () {
462
415
  if (responsiveSettings) {
463
416
  return responsiveSettings.settings.slidesToShow;
464
417
  }
465
-
466
418
  return props.slidesToShow || 1;
467
419
  }, [responsiveSettings, props.slidesToShow]);
468
420
  var childrenCount = useMemo(function () {
469
421
  return React.Children.count(props.children);
470
422
  }, [props.children]);
471
- var eachChildWidth = useMemo(function () {
472
- return wrapperWidth / slidesToShow;
473
- }, [wrapperWidth, slidesToShow]);
423
+ var eachChildSize = useMemo(function () {
424
+ return wrapperSize / slidesToShow;
425
+ }, [wrapperSize, slidesToShow]);
474
426
  var timeout = useRef();
475
427
  var resizeObserver = useRef();
476
- var startingClientX;
428
+ var startingSwipePosition;
477
429
  var dragging = false;
478
430
  var distanceSwiped = 0;
431
+ var translateType = props.vertical ? 'translateY' : 'translateX';
432
+ var swipeAttributeType = props.vertical ? 'clientY' : 'clientX';
433
+ var swipePageAttributeType = props.vertical ? 'pageY' : 'pageX';
479
434
  var applyStyle = useCallback(function () {
480
435
  if (innerWrapperRef.current) {
481
- var fullwidth = wrapperWidth * innerWrapperRef.current.children.length;
482
- innerWrapperRef.current.style.width = fullwidth + "px";
483
-
436
+ var fullSize = wrapperSize * innerWrapperRef.current.children.length;
437
+ var attribute = props.vertical ? 'height' : 'width';
438
+ innerWrapperRef.current.style[attribute] = fullSize + "px";
439
+ if (props.vertical && wrapperRef.current) {
440
+ wrapperRef.current.style[attribute] = wrapperSize + "px";
441
+ }
484
442
  for (var _index = 0; _index < innerWrapperRef.current.children.length; _index++) {
485
443
  var eachDiv = innerWrapperRef.current.children[_index];
486
-
487
444
  if (eachDiv) {
488
- eachDiv.style.width = eachChildWidth + "px";
445
+ if (!props.vertical) {
446
+ eachDiv.style[attribute] = eachChildSize + "px";
447
+ }
489
448
  eachDiv.style.display = "block";
490
449
  }
491
450
  }
492
451
  }
493
- }, [wrapperWidth, eachChildWidth]);
452
+ }, [wrapperSize, eachChildSize]);
494
453
  var initResizeObserver = useCallback(function () {
495
454
  if (wrapperRef.current) {
496
455
  resizeObserver.current = new ResizeObserver(function (entries) {
497
456
  if (!entries) return;
498
- setWidth();
457
+ setSize();
499
458
  });
500
459
  resizeObserver.current.observe(wrapperRef.current);
501
460
  }
502
461
  }, [wrapperRef]);
503
462
  var play = useCallback(function () {
504
463
  var autoplay = props.autoplay,
505
- infinite = props.infinite,
506
- duration = props.duration;
507
-
464
+ infinite = props.infinite,
465
+ duration = props.duration;
508
466
  if (autoplay && (infinite || index < childrenCount - 1)) {
509
467
  timeout.current = setTimeout(moveNext, duration);
510
- } // eslint-disable-next-line react-hooks/exhaustive-deps
511
-
468
+ }
469
+ // eslint-disable-next-line react-hooks/exhaustive-deps
512
470
  }, [props, childrenCount, index]);
513
471
  useEffect(function () {
514
472
  applyStyle();
515
- }, [wrapperWidth, applyStyle]);
473
+ }, [wrapperSize, applyStyle]);
516
474
  useEffect(function () {
517
475
  initResizeObserver();
518
476
  return function () {
@@ -524,7 +482,7 @@ var Slide = /*#__PURE__*/React.forwardRef(function (props, ref) {
524
482
  useEffect(function () {
525
483
  clearTimeout(timeout.current);
526
484
  play();
527
- }, [index, wrapperWidth, props.autoplay, play]);
485
+ }, [index, wrapperSize, props.autoplay, play]);
528
486
  useImperativeHandle(ref, function () {
529
487
  return {
530
488
  goNext: function goNext() {
@@ -542,102 +500,80 @@ var Slide = /*#__PURE__*/React.forwardRef(function (props, ref) {
542
500
  }
543
501
  };
544
502
  });
545
-
546
503
  var removeResizeObserver = function removeResizeObserver() {
547
504
  if (resizeObserver && wrapperRef.current) {
548
505
  resizeObserver.current.unobserve(wrapperRef.current);
549
506
  }
550
507
  };
551
-
552
508
  var pauseSlides = function pauseSlides() {
553
509
  if (props.pauseOnHover) {
554
510
  clearTimeout(timeout.current);
555
511
  }
556
512
  };
557
-
558
513
  var swipe = function swipe(event) {
559
514
  if (props.canSwipe && dragging) {
560
- var clientX;
561
-
515
+ var position;
562
516
  if (window.TouchEvent && event.nativeEvent instanceof TouchEvent) {
563
- clientX = event.nativeEvent.touches[0].pageX;
564
- } else if (event.nativeEvent instanceof MouseEvent) {
565
- clientX = event.nativeEvent.clientX;
517
+ position = event.nativeEvent.touches[0][swipePageAttributeType];
518
+ } else {
519
+ position = event.nativeEvent[swipeAttributeType];
566
520
  }
567
-
568
- if (clientX && startingClientX) {
569
- var translateValue = eachChildWidth * (index + getOffset());
570
- var distance = clientX - startingClientX;
571
-
521
+ if (position && startingSwipePosition) {
522
+ var translateValue = eachChildSize * (index + getOffset());
523
+ var distance = position - startingSwipePosition;
572
524
  if (!props.infinite && index === childrenCount - slidesToScroll && distance < 0) {
573
525
  // if it is the last and infinite is false and you're swiping left
574
526
  // then nothing happens
575
527
  return;
576
528
  }
577
-
578
529
  if (!props.infinite && index === 0 && distance > 0) {
579
530
  // if it is the first and infinite is false and you're swiping right
580
531
  // then nothing happens
581
532
  return;
582
533
  }
583
-
584
534
  distanceSwiped = distance;
585
535
  translateValue -= distanceSwiped;
586
- innerWrapperRef.current.style.transform = "translate(-" + translateValue + "px)";
536
+ innerWrapperRef.current.style.transform = translateType + "(-" + translateValue + "px)";
587
537
  }
588
538
  }
589
539
  };
590
-
591
540
  var moveNext = function moveNext() {
592
541
  if (!props.infinite && index === childrenCount - slidesToScroll) {
593
542
  return;
594
543
  }
595
-
596
544
  var nextIndex = calculateIndex(index + slidesToScroll);
597
545
  transitionSlide(nextIndex);
598
546
  };
599
-
600
547
  var moveBack = function moveBack() {
601
548
  if (!props.infinite && index === 0) {
602
549
  return;
603
550
  }
604
-
605
551
  var previousIndex = index - slidesToScroll;
606
-
607
552
  if (previousIndex % slidesToScroll) {
608
553
  previousIndex = Math.ceil(previousIndex / slidesToScroll) * slidesToScroll;
609
554
  }
610
-
611
555
  transitionSlide(previousIndex);
612
556
  };
613
-
614
557
  var goToSlide = function goToSlide(_ref) {
615
558
  var currentTarget = _ref.currentTarget;
616
-
617
559
  if (!currentTarget.dataset.key) {
618
560
  return;
619
561
  }
620
-
621
562
  var datasetKey = parseInt(currentTarget.dataset.key);
622
563
  moveTo(datasetKey * slidesToScroll);
623
564
  };
624
-
625
565
  var moveTo = function moveTo(index) {
626
566
  transitionSlide(calculateIndex(index));
627
567
  };
628
-
629
568
  var calculateIndex = function calculateIndex(nextIndex) {
630
569
  if (nextIndex < childrenCount && nextIndex + slidesToScroll > childrenCount) {
631
570
  if ((childrenCount - slidesToScroll) % slidesToScroll) {
632
571
  return childrenCount - slidesToScroll;
633
572
  }
634
-
635
573
  return nextIndex;
636
574
  }
637
-
638
575
  return nextIndex;
639
576
  };
640
-
641
577
  var startSlides = function startSlides() {
642
578
  if (dragging) {
643
579
  endSwipe();
@@ -645,17 +581,14 @@ var Slide = /*#__PURE__*/React.forwardRef(function (props, ref) {
645
581
  timeout.current = setTimeout(moveNext, props.duration);
646
582
  }
647
583
  };
648
-
649
584
  var moveSlides = function moveSlides(_ref2) {
650
585
  var dataset = _ref2.currentTarget.dataset;
651
-
652
586
  if (dataset.type === 'next') {
653
587
  moveNext();
654
588
  } else {
655
589
  moveBack();
656
590
  }
657
591
  };
658
-
659
592
  var renderPreceedingSlides = function renderPreceedingSlides() {
660
593
  return React.Children.toArray(props.children).slice(-slidesToShow).map(function (each, index) {
661
594
  return /*#__PURE__*/React.createElement("div", {
@@ -666,12 +599,10 @@ var Slide = /*#__PURE__*/React.forwardRef(function (props, ref) {
666
599
  }, each);
667
600
  });
668
601
  };
669
-
670
602
  var renderTrailingSlides = function renderTrailingSlides() {
671
603
  if (!props.infinite && slidesToShow === slidesToScroll) {
672
604
  return;
673
605
  }
674
-
675
606
  return React.Children.toArray(props.children).slice(0, slidesToShow).map(function (each, index) {
676
607
  return /*#__PURE__*/React.createElement("div", {
677
608
  "data-index": childrenCount + index,
@@ -681,31 +612,33 @@ var Slide = /*#__PURE__*/React.forwardRef(function (props, ref) {
681
612
  }, each);
682
613
  });
683
614
  };
684
-
685
- var setWidth = function setWidth() {
686
- if (wrapperRef.current) {
687
- setWrapperWidth(wrapperRef.current.clientWidth);
615
+ var setSize = function setSize() {
616
+ var attribute = props.vertical ? 'clientHeight' : 'clientWidth';
617
+ if (props.vertical) {
618
+ if (innerWrapperRef.current) {
619
+ setWrapperSize(innerWrapperRef.current.children[0][attribute]);
620
+ }
621
+ } else {
622
+ if (wrapperRef.current) {
623
+ setWrapperSize(wrapperRef.current[attribute]);
624
+ }
688
625
  }
689
626
  };
690
-
691
627
  var startSwipe = function startSwipe(event) {
692
628
  if (props.canSwipe) {
693
629
  if (window.TouchEvent && event.nativeEvent instanceof TouchEvent) {
694
- startingClientX = event.nativeEvent.touches[0].pageX;
695
- } else if (event.nativeEvent instanceof MouseEvent) {
696
- startingClientX = event.nativeEvent.clientX;
630
+ startingSwipePosition = event.nativeEvent.touches[0][swipePageAttributeType];
631
+ } else {
632
+ startingSwipePosition = event.nativeEvent[swipeAttributeType];
697
633
  }
698
-
699
634
  clearTimeout(timeout.current);
700
635
  dragging = true;
701
636
  }
702
637
  };
703
-
704
638
  var endSwipe = function endSwipe() {
705
639
  if (props.canSwipe) {
706
640
  dragging = false;
707
-
708
- if (Math.abs(distanceSwiped) / wrapperWidth > 0.2) {
641
+ if (Math.abs(distanceSwiped) / wrapperSize > 0.2) {
709
642
  if (distanceSwiped < 0) {
710
643
  moveNext();
711
644
  } else {
@@ -718,45 +651,39 @@ var Slide = /*#__PURE__*/React.forwardRef(function (props, ref) {
718
651
  }
719
652
  }
720
653
  };
721
-
722
654
  var animate = function animate() {
723
655
  requestAnimationFrame(animate);
724
656
  tweenGroup.current.update();
725
657
  };
726
-
727
658
  var transitionSlide = function transitionSlide(toIndex, animationDuration) {
728
659
  var transitionDuration = animationDuration || props.transitionDuration;
729
660
  var currentIndex = index;
730
661
  var existingTweens = tweenGroup.current.getAll();
731
-
732
662
  if (!wrapperRef.current) {
733
663
  return;
734
664
  }
735
-
736
- var childWidth = wrapperRef.current.clientWidth / slidesToShow;
737
-
665
+ var attribute = props.vertical ? 'clientHeight' : 'clientWidth';
666
+ var childSize = wrapperRef.current[attribute] / slidesToShow;
738
667
  if (!existingTweens.length) {
739
668
  clearTimeout(timeout.current);
740
669
  var value = {
741
- margin: -childWidth * (currentIndex + getOffset()) + distanceSwiped
670
+ margin: -childSize * (currentIndex + getOffset()) + distanceSwiped
742
671
  };
743
672
  var tween = new Tween(value, tweenGroup.current).to({
744
- margin: -childWidth * (toIndex + getOffset())
673
+ margin: -childSize * (toIndex + getOffset())
745
674
  }, transitionDuration).onUpdate(function (value) {
746
675
  if (innerWrapperRef.current) {
747
- innerWrapperRef.current.style.transform = "translate(" + value.margin + "px)";
676
+ innerWrapperRef.current.style.transform = translateType + "(" + value.margin + "px)";
748
677
  }
749
678
  });
750
679
  tween.easing(getEasing(props.easing));
751
680
  animate();
752
681
  var newIndex = toIndex;
753
-
754
682
  if (newIndex < 0) {
755
683
  newIndex = childrenCount - slidesToScroll;
756
684
  } else if (newIndex >= childrenCount) {
757
685
  newIndex = 0;
758
686
  }
759
-
760
687
  tween.onStart(function () {
761
688
  if (typeof props.onStartChange === 'function') {
762
689
  props.onStartChange(index, newIndex);
@@ -764,31 +691,25 @@ var Slide = /*#__PURE__*/React.forwardRef(function (props, ref) {
764
691
  });
765
692
  tween.onComplete(function () {
766
693
  distanceSwiped = 0;
767
-
768
694
  if (typeof props.onChange === 'function') {
769
695
  props.onChange(index, newIndex);
770
696
  }
771
-
772
697
  setIndex(newIndex);
773
698
  });
774
699
  tween.start();
775
700
  }
776
701
  };
777
-
778
702
  var isSlideActive = function isSlideActive(key) {
779
703
  return key < index + slidesToShow && key >= index;
780
704
  };
781
-
782
705
  var getOffset = function getOffset() {
783
706
  if (!props.infinite) {
784
707
  return 0;
785
708
  }
786
-
787
709
  return slidesToShow;
788
710
  };
789
-
790
711
  var style = {
791
- transform: "translate(-" + (index + getOffset()) * eachChildWidth + "px)"
712
+ transform: translateType + "(-" + (index + getOffset()) * eachChildSize + "px)"
792
713
  };
793
714
  return /*#__PURE__*/React.createElement("div", {
794
715
  dir: "ltr",
@@ -809,7 +730,7 @@ var Slide = /*#__PURE__*/React.forwardRef(function (props, ref) {
809
730
  className: "react-slideshow-wrapper slide " + (props.cssClass || ''),
810
731
  ref: wrapperRef
811
732
  }, /*#__PURE__*/React.createElement("div", {
812
- className: "images-wrap",
733
+ className: "images-wrap " + (props.vertical ? 'vertical' : 'horizontal'),
813
734
  style: style,
814
735
  ref: innerWrapperRef
815
736
  }, props.infinite && renderPreceedingSlides(), (React.Children.map(props.children, function (thisArg) {
@@ -823,7 +744,7 @@ var Slide = /*#__PURE__*/React.forwardRef(function (props, ref) {
823
744
  "aria-roledescription": "slide",
824
745
  "aria-hidden": isThisSlideActive ? 'false' : 'true'
825
746
  }, each);
826
- }), renderTrailingSlides())), props.arrows && showNextArrow(props, index, moveSlides)), props.indicators && showIndicators(props, index, goToSlide, responsiveSettings));
747
+ }), renderTrailingSlides())), props.arrows && showNextArrow(props, index, moveSlides, responsiveSettings)), !!props.indicators && showIndicators(props, index, goToSlide, responsiveSettings));
827
748
  });
828
749
  Slide.defaultProps = defaultProps;
829
750