react-slideshow-image 4.3.1 → 4.4.0

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.
@@ -3,18 +3,22 @@ import ResizeObserver from 'resize-observer-polyfill';
3
3
  import { Easing, Group, Tween } from '@tweenjs/tween.js';
4
4
 
5
5
  function _extends() {
6
- _extends = Object.assign ? Object.assign.bind() : function (target) {
7
- for (var i = 1; i < arguments.length; i++) {
8
- var source = arguments[i];
9
- for (var key in source) {
10
- if (Object.prototype.hasOwnProperty.call(source, key)) {
11
- target[key] = source[key];
12
- }
13
- }
6
+ return _extends = Object.assign ? Object.assign.bind() : function (n) {
7
+ for (var e = 1; e < arguments.length; e++) {
8
+ var t = arguments[e];
9
+ for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
14
10
  }
15
- return target;
16
- };
17
- return _extends.apply(this, arguments);
11
+ return n;
12
+ }, _extends.apply(null, arguments);
13
+ }
14
+ function _objectWithoutPropertiesLoose(r, e) {
15
+ if (null == r) return {};
16
+ var t = {};
17
+ for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
18
+ if (-1 !== e.indexOf(n)) continue;
19
+ t[n] = r[n];
20
+ }
21
+ return t;
18
22
  }
19
23
 
20
24
  var getStartingIndex = function getStartingIndex(children, defaultIndex) {
@@ -149,33 +153,40 @@ var showIndicators = function showIndicators(props, currentIndex, navigate, resp
149
153
  }));
150
154
  };
151
155
 
152
- var defaultProps = {
153
- duration: 5000,
154
- transitionDuration: 1000,
155
- defaultIndex: 0,
156
- infinite: true,
157
- autoplay: true,
158
- indicators: false,
159
- arrows: true,
160
- pauseOnHover: true,
161
- easing: 'linear',
162
- canSwipe: true,
163
- cssClass: '',
164
- responsive: []
165
- };
166
-
156
+ var _excluded = ["duration", "transitionDuration", "defaultIndex", "infinite", "autoplay", "indicators", "arrows", "pauseOnHover", "easing", "cssClass"];
167
157
  var FadeZoom = /*#__PURE__*/React.forwardRef(function (props, ref) {
168
- var _useState = useState(getStartingIndex(props.children, props.defaultIndex)),
158
+ var _props$duration = props.duration,
159
+ duration = _props$duration === void 0 ? 5000 : _props$duration,
160
+ _props$transitionDura = props.transitionDuration,
161
+ transitionDuration = _props$transitionDura === void 0 ? 1000 : _props$transitionDura,
162
+ _props$defaultIndex = props.defaultIndex,
163
+ defaultIndex = _props$defaultIndex === void 0 ? 0 : _props$defaultIndex,
164
+ _props$infinite = props.infinite,
165
+ infinite = _props$infinite === void 0 ? true : _props$infinite,
166
+ _props$autoplay = props.autoplay,
167
+ autoplay = _props$autoplay === void 0 ? true : _props$autoplay,
168
+ _props$indicators = props.indicators,
169
+ indicators = _props$indicators === void 0 ? false : _props$indicators,
170
+ _props$arrows = props.arrows,
171
+ arrows = _props$arrows === void 0 ? true : _props$arrows,
172
+ _props$pauseOnHover = props.pauseOnHover,
173
+ pauseOnHover = _props$pauseOnHover === void 0 ? true : _props$pauseOnHover,
174
+ _props$easing = props.easing,
175
+ easing = _props$easing === void 0 ? 'linear' : _props$easing,
176
+ _props$cssClass = props.cssClass,
177
+ cssClass = _props$cssClass === void 0 ? '' : _props$cssClass,
178
+ others = _objectWithoutPropertiesLoose(props, _excluded);
179
+ var _useState = useState(getStartingIndex(others.children, defaultIndex)),
169
180
  index = _useState[0],
170
181
  setIndex = _useState[1];
171
182
  var wrapperRef = useRef(null);
172
183
  var innerWrapperRef = useRef(null);
173
184
  var tweenGroup = useRef(new Group());
174
- var timeout = useRef();
175
- var resizeObserver = useRef();
185
+ var timeout = useRef(undefined);
186
+ var resizeObserver = useRef(undefined);
176
187
  var childrenCount = useMemo(function () {
177
- return React.Children.count(props.children);
178
- }, [props.children]);
188
+ return React.Children.count(others.children);
189
+ }, [others.children]);
179
190
  var applyStyle = useCallback(function () {
180
191
  if (innerWrapperRef.current && wrapperRef.current) {
181
192
  var wrapperWidth = wrapperRef.current.clientWidth;
@@ -201,19 +212,16 @@ var FadeZoom = /*#__PURE__*/React.forwardRef(function (props, ref) {
201
212
  }
202
213
  }, [wrapperRef, applyStyle]);
203
214
  var play = useCallback(function () {
204
- var autoplay = props.autoplay,
205
- children = props.children,
206
- duration = props.duration,
207
- infinite = props.infinite;
208
- if (autoplay && React.Children.count(children) > 1 && (infinite || index < React.Children.count(children) - 1)) {
215
+ if (autoplay && React.Children.count(others.children) > 1 && (infinite || index < React.Children.count(others.children) - 1)) {
209
216
  timeout.current = setTimeout(moveNext, duration);
210
217
  }
211
218
  // eslint-disable-next-line react-hooks/exhaustive-deps
212
- }, [props, index]);
219
+ }, [autoplay, duration, infinite, others.children, index]);
213
220
  useEffect(function () {
214
221
  initResizeObserver();
222
+ var tweenGroupRef = tweenGroup.current;
215
223
  return function () {
216
- tweenGroup.current.removeAll();
224
+ tweenGroupRef.removeAll();
217
225
  clearTimeout(timeout.current);
218
226
  removeResizeObserver();
219
227
  };
@@ -221,7 +229,7 @@ var FadeZoom = /*#__PURE__*/React.forwardRef(function (props, ref) {
221
229
  useEffect(function () {
222
230
  clearTimeout(timeout.current);
223
231
  play();
224
- }, [index, props.autoplay, play]);
232
+ }, [index, autoplay, play]);
225
233
  useEffect(function () {
226
234
  applyStyle();
227
235
  }, [childrenCount, applyStyle]);
@@ -248,14 +256,11 @@ var FadeZoom = /*#__PURE__*/React.forwardRef(function (props, ref) {
248
256
  }
249
257
  };
250
258
  var pauseSlides = function pauseSlides() {
251
- if (props.pauseOnHover) {
259
+ if (pauseOnHover) {
252
260
  clearTimeout(timeout.current);
253
261
  }
254
262
  };
255
263
  var startSlides = function startSlides() {
256
- var pauseOnHover = props.pauseOnHover,
257
- autoplay = props.autoplay,
258
- duration = props.duration;
259
264
  if (pauseOnHover && autoplay) {
260
265
  timeout.current = setTimeout(function () {
261
266
  return moveNext();
@@ -263,20 +268,16 @@ var FadeZoom = /*#__PURE__*/React.forwardRef(function (props, ref) {
263
268
  }
264
269
  };
265
270
  var moveNext = function moveNext() {
266
- var children = props.children,
267
- infinite = props.infinite;
268
- if (!infinite && index === React.Children.count(children) - 1) {
271
+ if (!infinite && index === React.Children.count(others.children) - 1) {
269
272
  return;
270
273
  }
271
- transitionSlide((index + 1) % React.Children.count(children));
274
+ transitionSlide((index + 1) % React.Children.count(others.children));
272
275
  };
273
276
  var moveBack = function moveBack() {
274
- var children = props.children,
275
- infinite = props.infinite;
276
277
  if (!infinite && index === 0) {
277
278
  return;
278
279
  }
279
- transitionSlide(index === 0 ? React.Children.count(children) - 1 : index - 1);
280
+ transitionSlide(index === 0 ? React.Children.count(others.children) - 1 : index - 1);
280
281
  };
281
282
  var preTransition = function preTransition(event) {
282
283
  var currentTarget = event.currentTarget;
@@ -286,8 +287,8 @@ var FadeZoom = /*#__PURE__*/React.forwardRef(function (props, ref) {
286
287
  moveNext();
287
288
  }
288
289
  };
289
- var animate = function animate() {
290
- requestAnimationFrame(animate);
290
+ var _animate = function animate() {
291
+ requestAnimationFrame(_animate);
291
292
  tweenGroup.current.update();
292
293
  };
293
294
  var transitionSlide = function transitionSlide(newIndex) {
@@ -302,11 +303,11 @@ var FadeZoom = /*#__PURE__*/React.forwardRef(function (props, ref) {
302
303
  opacity: 0,
303
304
  scale: 1
304
305
  };
305
- animate();
306
+ _animate();
306
307
  var tween = new Tween(value, tweenGroup.current).to({
307
308
  opacity: 1,
308
- scale: props.scale
309
- }, props.transitionDuration).onUpdate(function (value) {
309
+ scale: others.scale
310
+ }, transitionDuration).onUpdate(function (value) {
310
311
  if (!innerWrapperRef.current) {
311
312
  return;
312
313
  }
@@ -314,10 +315,10 @@ var FadeZoom = /*#__PURE__*/React.forwardRef(function (props, ref) {
314
315
  innerWrapperRef.current.children[index].style.opacity = 1 - value.opacity;
315
316
  innerWrapperRef.current.children[index].style.transform = "scale(" + value.scale + ")";
316
317
  });
317
- tween.easing(getEasing(props.easing));
318
+ tween.easing(getEasing(easing));
318
319
  tween.onStart(function () {
319
- if (typeof props.onStartChange === 'function') {
320
- props.onStartChange(index, newIndex);
320
+ if (typeof others.onStartChange === 'function') {
321
+ others.onStartChange(index, newIndex);
321
322
  }
322
323
  });
323
324
  tween.onComplete(function () {
@@ -325,8 +326,8 @@ var FadeZoom = /*#__PURE__*/React.forwardRef(function (props, ref) {
325
326
  setIndex(newIndex);
326
327
  innerWrapperRef.current.children[index].style.transform = "scale(1)";
327
328
  }
328
- if (typeof props.onChange === 'function') {
329
- props.onChange(index, newIndex);
329
+ if (typeof others.onChange === 'function') {
330
+ others.onChange(index, newIndex);
330
331
  }
331
332
  });
332
333
  tween.start();
@@ -350,17 +351,19 @@ var FadeZoom = /*#__PURE__*/React.forwardRef(function (props, ref) {
350
351
  dir: "ltr",
351
352
  "aria-roledescription": "carousel"
352
353
  }, /*#__PURE__*/React.createElement("div", {
353
- className: "react-slideshow-container " + (props.cssClass || ''),
354
+ className: "react-slideshow-container " + (cssClass || ''),
354
355
  onMouseEnter: pauseSlides,
355
356
  onMouseOver: pauseSlides,
356
357
  onMouseLeave: startSlides
357
- }, props.arrows && showPreviousArrow(props, index, preTransition), /*#__PURE__*/React.createElement("div", {
358
- className: "react-slideshow-fadezoom-wrapper " + props.cssClass,
358
+ }, arrows && showPreviousArrow(_extends({}, props, {
359
+ infinite: infinite
360
+ }), index, preTransition), /*#__PURE__*/React.createElement("div", {
361
+ className: "react-slideshow-fadezoom-wrapper " + cssClass,
359
362
  ref: wrapperRef
360
363
  }, /*#__PURE__*/React.createElement("div", {
361
364
  className: "react-slideshow-fadezoom-images-wrap",
362
365
  ref: innerWrapperRef
363
- }, (React.Children.map(props.children, function (thisArg) {
366
+ }, (React.Children.map(others.children, function (thisArg) {
364
367
  return thisArg;
365
368
  }) || []).map(function (each, key) {
366
369
  return /*#__PURE__*/React.createElement("div", {
@@ -373,27 +376,73 @@ var FadeZoom = /*#__PURE__*/React.forwardRef(function (props, ref) {
373
376
  "aria-roledescription": "slide",
374
377
  "aria-hidden": key === index ? 'false' : 'true'
375
378
  }, each);
376
- }))), props.arrows && showNextArrow(props, index, preTransition)), props.indicators && showIndicators(props, index, navigate));
379
+ }))), arrows && showNextArrow(_extends({}, props, {
380
+ infinite: infinite
381
+ }), index, preTransition)), indicators && showIndicators(_extends({}, props, {
382
+ indicators: indicators
383
+ }), index, navigate));
377
384
  });
378
- FadeZoom.defaultProps = defaultProps;
385
+
386
+ var defaultProps = {
387
+ duration: 5000,
388
+ transitionDuration: 1000,
389
+ defaultIndex: 0,
390
+ infinite: true,
391
+ autoplay: true,
392
+ indicators: false,
393
+ arrows: true,
394
+ pauseOnHover: true,
395
+ easing: 'linear',
396
+ canSwipe: true,
397
+ cssClass: ''
398
+ };
379
399
 
380
400
  var Fade = /*#__PURE__*/React.forwardRef(function (props, ref) {
381
- return /*#__PURE__*/React.createElement(FadeZoom, Object.assign({}, props, {
401
+ return /*#__PURE__*/React.createElement(FadeZoom, Object.assign({}, defaultProps, props, {
382
402
  scale: 1,
383
403
  ref: ref
384
404
  }));
385
405
  });
386
- Fade.defaultProps = defaultProps;
387
406
 
388
407
  var Zoom = /*#__PURE__*/React.forwardRef(function (props, ref) {
389
- return /*#__PURE__*/React.createElement(FadeZoom, Object.assign({}, props, {
408
+ return /*#__PURE__*/React.createElement(FadeZoom, Object.assign({}, defaultProps, props, {
390
409
  ref: ref
391
410
  }));
392
411
  });
393
- Zoom.defaultProps = defaultProps;
394
412
 
413
+ var _excluded$1 = ["duration", "transitionDuration", "defaultIndex", "infinite", "autoplay", "indicators", "arrows", "pauseOnHover", "easing", "canSwipe", "cssClass", "responsive", "slidesToShow", "slidesToScroll"];
395
414
  var Slide = /*#__PURE__*/React.forwardRef(function (props, ref) {
396
- var _useState = useState(getStartingIndex(props.children, props.defaultIndex)),
415
+ var _props$duration = props.duration,
416
+ duration = _props$duration === void 0 ? 5000 : _props$duration,
417
+ _props$transitionDura = props.transitionDuration,
418
+ transitionDuration = _props$transitionDura === void 0 ? 1000 : _props$transitionDura,
419
+ _props$defaultIndex = props.defaultIndex,
420
+ defaultIndex = _props$defaultIndex === void 0 ? 0 : _props$defaultIndex,
421
+ _props$infinite = props.infinite,
422
+ infinite = _props$infinite === void 0 ? true : _props$infinite,
423
+ _props$autoplay = props.autoplay,
424
+ autoplay = _props$autoplay === void 0 ? true : _props$autoplay,
425
+ _props$indicators = props.indicators,
426
+ indicators = _props$indicators === void 0 ? false : _props$indicators,
427
+ _props$arrows = props.arrows,
428
+ arrows = _props$arrows === void 0 ? true : _props$arrows,
429
+ _props$pauseOnHover = props.pauseOnHover,
430
+ pauseOnHover = _props$pauseOnHover === void 0 ? true : _props$pauseOnHover,
431
+ _props$easing = props.easing,
432
+ easing = _props$easing === void 0 ? 'linear' : _props$easing,
433
+ _props$canSwipe = props.canSwipe,
434
+ canSwipe = _props$canSwipe === void 0 ? true : _props$canSwipe,
435
+ _props$cssClass = props.cssClass,
436
+ cssClass = _props$cssClass === void 0 ? '' : _props$cssClass,
437
+ _props$responsive = props.responsive,
438
+ responsive = _props$responsive === void 0 ? [] : _props$responsive,
439
+ _props$slidesToShow = props.slidesToShow,
440
+ slidesToShowDefault = _props$slidesToShow === void 0 ? 1 : _props$slidesToShow,
441
+ _props$slidesToScroll = props.slidesToScroll,
442
+ slidesToScrollDefault = _props$slidesToScroll === void 0 ? 1 : _props$slidesToScroll,
443
+ others = _objectWithoutPropertiesLoose(props, _excluded$1);
444
+ var newTransitionDuration = transitionDuration;
445
+ var _useState = useState(getStartingIndex(others.children, defaultIndex)),
397
446
  index = _useState[0],
398
447
  setIndex = _useState[1];
399
448
  var _useState2 = useState(0),
@@ -403,53 +452,65 @@ var Slide = /*#__PURE__*/React.forwardRef(function (props, ref) {
403
452
  var innerWrapperRef = useRef(null);
404
453
  var tweenGroup = useRef(new Group());
405
454
  var responsiveSettings = useMemo(function () {
406
- return getResponsiveSettings(wrapperSize, props.responsive);
407
- }, [wrapperSize, props.responsive]);
455
+ return getResponsiveSettings(wrapperSize, responsive);
456
+ }, [wrapperSize, responsive]);
408
457
  var slidesToScroll = useMemo(function () {
409
458
  if (responsiveSettings) {
410
459
  return responsiveSettings.settings.slidesToScroll;
411
460
  }
412
- return props.slidesToScroll || 1;
413
- }, [responsiveSettings, props.slidesToScroll]);
461
+ return slidesToScrollDefault;
462
+ }, [responsiveSettings, slidesToScrollDefault]);
414
463
  var slidesToShow = useMemo(function () {
415
464
  if (responsiveSettings) {
416
465
  return responsiveSettings.settings.slidesToShow;
417
466
  }
418
- return props.slidesToShow || 1;
419
- }, [responsiveSettings, props.slidesToShow]);
467
+ return slidesToShowDefault;
468
+ }, [responsiveSettings, slidesToShowDefault]);
420
469
  var childrenCount = useMemo(function () {
421
- return React.Children.count(props.children);
422
- }, [props.children]);
470
+ return React.Children.count(others.children);
471
+ }, [others.children]);
423
472
  var eachChildSize = useMemo(function () {
424
473
  return wrapperSize / slidesToShow;
425
474
  }, [wrapperSize, slidesToShow]);
426
- var timeout = useRef();
427
- var resizeObserver = useRef();
475
+ var timeout = useRef(undefined);
476
+ var resizeObserver = useRef(undefined);
428
477
  var startingSwipePosition;
429
478
  var dragging = false;
430
479
  var distanceSwiped = 0;
431
- var translateType = props.vertical ? 'translateY' : 'translateX';
432
- var swipeAttributeType = props.vertical ? 'clientY' : 'clientX';
433
- var swipePageAttributeType = props.vertical ? 'pageY' : 'pageX';
480
+ var translateType = others.vertical ? 'translateY' : 'translateX';
481
+ var swipeAttributeType = others.vertical ? 'clientY' : 'clientX';
482
+ var swipePageAttributeType = others.vertical ? 'pageY' : 'pageX';
434
483
  var applyStyle = useCallback(function () {
435
484
  if (innerWrapperRef.current) {
436
485
  var fullSize = wrapperSize * innerWrapperRef.current.children.length;
437
- var attribute = props.vertical ? 'height' : 'width';
486
+ var attribute = others.vertical ? 'height' : 'width';
438
487
  innerWrapperRef.current.style[attribute] = fullSize + "px";
439
- if (props.vertical && wrapperRef.current) {
488
+ if (others.vertical && wrapperRef.current) {
440
489
  wrapperRef.current.style[attribute] = wrapperSize + "px";
441
490
  }
442
491
  for (var _index = 0; _index < innerWrapperRef.current.children.length; _index++) {
443
492
  var eachDiv = innerWrapperRef.current.children[_index];
444
493
  if (eachDiv) {
445
- if (!props.vertical) {
494
+ if (!others.vertical) {
446
495
  eachDiv.style[attribute] = eachChildSize + "px";
447
496
  }
448
497
  eachDiv.style.display = "block";
449
498
  }
450
499
  }
451
500
  }
452
- }, [wrapperSize, eachChildSize]);
501
+ }, [wrapperSize, eachChildSize, others.vertical]);
502
+ var setSize = useCallback(function () {
503
+ var attribute = others.vertical ? 'clientHeight' : 'clientWidth';
504
+ if (others.vertical) {
505
+ if (innerWrapperRef.current) {
506
+ setWrapperSize(innerWrapperRef.current.children[0][attribute]);
507
+ }
508
+ } else {
509
+ if (wrapperRef.current) {
510
+ setWrapperSize(wrapperRef.current[attribute]);
511
+ }
512
+ }
513
+ }, [others.vertical]);
453
514
  var initResizeObserver = useCallback(function () {
454
515
  if (wrapperRef.current) {
455
516
  resizeObserver.current = new ResizeObserver(function (entries) {
@@ -458,23 +519,21 @@ var Slide = /*#__PURE__*/React.forwardRef(function (props, ref) {
458
519
  });
459
520
  resizeObserver.current.observe(wrapperRef.current);
460
521
  }
461
- }, [wrapperRef]);
522
+ }, [wrapperRef, setSize]);
462
523
  var play = useCallback(function () {
463
- var autoplay = props.autoplay,
464
- infinite = props.infinite,
465
- duration = props.duration;
466
524
  if (autoplay && (infinite || index < childrenCount - 1)) {
467
525
  timeout.current = setTimeout(moveNext, duration);
468
526
  }
469
527
  // eslint-disable-next-line react-hooks/exhaustive-deps
470
- }, [props, childrenCount, index]);
528
+ }, [autoplay, infinite, duration, childrenCount, index]);
471
529
  useEffect(function () {
472
530
  applyStyle();
473
531
  }, [wrapperSize, applyStyle]);
474
532
  useEffect(function () {
475
533
  initResizeObserver();
534
+ var tweenGroupRef = tweenGroup.current;
476
535
  return function () {
477
- tweenGroup.current.removeAll();
536
+ tweenGroupRef.removeAll();
478
537
  clearTimeout(timeout.current);
479
538
  removeResizeObserver();
480
539
  };
@@ -482,7 +541,7 @@ var Slide = /*#__PURE__*/React.forwardRef(function (props, ref) {
482
541
  useEffect(function () {
483
542
  clearTimeout(timeout.current);
484
543
  play();
485
- }, [index, wrapperSize, props.autoplay, play]);
544
+ }, [index, wrapperSize, autoplay, play]);
486
545
  useImperativeHandle(ref, function () {
487
546
  return {
488
547
  goNext: function goNext() {
@@ -506,12 +565,12 @@ var Slide = /*#__PURE__*/React.forwardRef(function (props, ref) {
506
565
  }
507
566
  };
508
567
  var pauseSlides = function pauseSlides() {
509
- if (props.pauseOnHover) {
568
+ if (pauseOnHover) {
510
569
  clearTimeout(timeout.current);
511
570
  }
512
571
  };
513
572
  var swipe = function swipe(event) {
514
- if (props.canSwipe && dragging) {
573
+ if (canSwipe && dragging) {
515
574
  var position;
516
575
  if (window.TouchEvent && event.nativeEvent instanceof TouchEvent) {
517
576
  position = event.nativeEvent.touches[0][swipePageAttributeType];
@@ -521,12 +580,12 @@ var Slide = /*#__PURE__*/React.forwardRef(function (props, ref) {
521
580
  if (position && startingSwipePosition) {
522
581
  var translateValue = eachChildSize * (index + getOffset());
523
582
  var distance = position - startingSwipePosition;
524
- if (!props.infinite && index === childrenCount - slidesToScroll && distance < 0) {
583
+ if (!infinite && index === childrenCount - slidesToScroll && distance < 0) {
525
584
  // if it is the last and infinite is false and you're swiping left
526
585
  // then nothing happens
527
586
  return;
528
587
  }
529
- if (!props.infinite && index === 0 && distance > 0) {
588
+ if (!infinite && index === 0 && distance > 0) {
530
589
  // if it is the first and infinite is false and you're swiping right
531
590
  // then nothing happens
532
591
  return;
@@ -538,14 +597,14 @@ var Slide = /*#__PURE__*/React.forwardRef(function (props, ref) {
538
597
  }
539
598
  };
540
599
  var moveNext = function moveNext() {
541
- if (!props.infinite && index === childrenCount - slidesToScroll) {
600
+ if (!infinite && index === childrenCount - slidesToScroll) {
542
601
  return;
543
602
  }
544
603
  var nextIndex = calculateIndex(index + slidesToScroll);
545
604
  transitionSlide(nextIndex);
546
605
  };
547
606
  var moveBack = function moveBack() {
548
- if (!props.infinite && index === 0) {
607
+ if (!infinite && index === 0) {
549
608
  return;
550
609
  }
551
610
  var previousIndex = index - slidesToScroll;
@@ -577,8 +636,8 @@ var Slide = /*#__PURE__*/React.forwardRef(function (props, ref) {
577
636
  var startSlides = function startSlides() {
578
637
  if (dragging) {
579
638
  endSwipe();
580
- } else if (props.pauseOnHover && props.autoplay) {
581
- timeout.current = setTimeout(moveNext, props.duration);
639
+ } else if (pauseOnHover && autoplay) {
640
+ timeout.current = setTimeout(moveNext, duration);
582
641
  }
583
642
  };
584
643
  var moveSlides = function moveSlides(_ref2) {
@@ -590,7 +649,7 @@ var Slide = /*#__PURE__*/React.forwardRef(function (props, ref) {
590
649
  }
591
650
  };
592
651
  var renderPreceedingSlides = function renderPreceedingSlides() {
593
- return React.Children.toArray(props.children).slice(-slidesToShow).map(function (each, index) {
652
+ return React.Children.toArray(others.children).slice(-slidesToShow).map(function (each, index) {
594
653
  return /*#__PURE__*/React.createElement("div", {
595
654
  "data-index": index - slidesToShow,
596
655
  "aria-roledescription": "slide",
@@ -600,10 +659,10 @@ var Slide = /*#__PURE__*/React.forwardRef(function (props, ref) {
600
659
  });
601
660
  };
602
661
  var renderTrailingSlides = function renderTrailingSlides() {
603
- if (!props.infinite && slidesToShow === slidesToScroll) {
662
+ if (!infinite && slidesToShow === slidesToScroll) {
604
663
  return;
605
664
  }
606
- return React.Children.toArray(props.children).slice(0, slidesToShow).map(function (each, index) {
665
+ return React.Children.toArray(others.children).slice(0, slidesToShow).map(function (each, index) {
607
666
  return /*#__PURE__*/React.createElement("div", {
608
667
  "data-index": childrenCount + index,
609
668
  "aria-roledescription": "slide",
@@ -612,20 +671,8 @@ var Slide = /*#__PURE__*/React.forwardRef(function (props, ref) {
612
671
  }, each);
613
672
  });
614
673
  };
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
- }
625
- }
626
- };
627
674
  var startSwipe = function startSwipe(event) {
628
- if (props.canSwipe) {
675
+ if (canSwipe) {
629
676
  if (window.TouchEvent && event.nativeEvent instanceof TouchEvent) {
630
677
  startingSwipePosition = event.nativeEvent.touches[0][swipePageAttributeType];
631
678
  } else {
@@ -636,7 +683,7 @@ var Slide = /*#__PURE__*/React.forwardRef(function (props, ref) {
636
683
  }
637
684
  };
638
685
  var endSwipe = function endSwipe() {
639
- if (props.canSwipe) {
686
+ if (canSwipe) {
640
687
  dragging = false;
641
688
  if (Math.abs(distanceSwiped) / wrapperSize > 0.2) {
642
689
  if (distanceSwiped < 0) {
@@ -651,18 +698,18 @@ var Slide = /*#__PURE__*/React.forwardRef(function (props, ref) {
651
698
  }
652
699
  }
653
700
  };
654
- var animate = function animate() {
655
- requestAnimationFrame(animate);
701
+ var _animate = function animate() {
702
+ requestAnimationFrame(_animate);
656
703
  tweenGroup.current.update();
657
704
  };
658
705
  var transitionSlide = function transitionSlide(toIndex, animationDuration) {
659
- var transitionDuration = animationDuration || props.transitionDuration;
706
+ var transitionDuration = animationDuration || newTransitionDuration;
660
707
  var currentIndex = index;
661
708
  var existingTweens = tweenGroup.current.getAll();
662
709
  if (!wrapperRef.current) {
663
710
  return;
664
711
  }
665
- var attribute = props.vertical ? 'clientHeight' : 'clientWidth';
712
+ var attribute = others.vertical ? 'clientHeight' : 'clientWidth';
666
713
  var childSize = wrapperRef.current[attribute] / slidesToShow;
667
714
  if (!existingTweens.length) {
668
715
  clearTimeout(timeout.current);
@@ -676,8 +723,8 @@ var Slide = /*#__PURE__*/React.forwardRef(function (props, ref) {
676
723
  innerWrapperRef.current.style.transform = translateType + "(" + value.margin + "px)";
677
724
  }
678
725
  });
679
- tween.easing(getEasing(props.easing));
680
- animate();
726
+ tween.easing(getEasing(easing));
727
+ _animate();
681
728
  var newIndex = toIndex;
682
729
  if (newIndex < 0) {
683
730
  newIndex = childrenCount - slidesToScroll;
@@ -685,14 +732,14 @@ var Slide = /*#__PURE__*/React.forwardRef(function (props, ref) {
685
732
  newIndex = 0;
686
733
  }
687
734
  tween.onStart(function () {
688
- if (typeof props.onStartChange === 'function') {
689
- props.onStartChange(index, newIndex);
735
+ if (typeof others.onStartChange === 'function') {
736
+ others.onStartChange(index, newIndex);
690
737
  }
691
738
  });
692
739
  tween.onComplete(function () {
693
740
  distanceSwiped = 0;
694
- if (typeof props.onChange === 'function') {
695
- props.onChange(index, newIndex);
741
+ if (typeof others.onChange === 'function') {
742
+ others.onChange(index, newIndex);
696
743
  }
697
744
  setIndex(newIndex);
698
745
  });
@@ -703,7 +750,7 @@ var Slide = /*#__PURE__*/React.forwardRef(function (props, ref) {
703
750
  return key < index + slidesToShow && key >= index;
704
751
  };
705
752
  var getOffset = function getOffset() {
706
- if (!props.infinite) {
753
+ if (!infinite) {
707
754
  return 0;
708
755
  }
709
756
  return slidesToShow;
@@ -726,14 +773,16 @@ var Slide = /*#__PURE__*/React.forwardRef(function (props, ref) {
726
773
  onTouchEnd: endSwipe,
727
774
  onTouchCancel: endSwipe,
728
775
  onTouchMove: swipe
729
- }, props.arrows && showPreviousArrow(props, index, moveSlides), /*#__PURE__*/React.createElement("div", {
730
- className: "react-slideshow-wrapper slide " + (props.cssClass || ''),
776
+ }, arrows && showPreviousArrow(_extends({}, props, {
777
+ infinite: infinite
778
+ }), index, moveSlides), /*#__PURE__*/React.createElement("div", {
779
+ className: "react-slideshow-wrapper slide " + (cssClass || ''),
731
780
  ref: wrapperRef
732
781
  }, /*#__PURE__*/React.createElement("div", {
733
- className: "images-wrap " + (props.vertical ? 'vertical' : 'horizontal'),
782
+ className: "images-wrap " + (others.vertical ? 'vertical' : 'horizontal'),
734
783
  style: style,
735
784
  ref: innerWrapperRef
736
- }, props.infinite && renderPreceedingSlides(), (React.Children.map(props.children, function (thisArg) {
785
+ }, infinite && renderPreceedingSlides(), (React.Children.map(others.children, function (thisArg) {
737
786
  return thisArg;
738
787
  }) || []).map(function (each, key) {
739
788
  var isThisSlideActive = isSlideActive(key);
@@ -744,9 +793,12 @@ var Slide = /*#__PURE__*/React.forwardRef(function (props, ref) {
744
793
  "aria-roledescription": "slide",
745
794
  "aria-hidden": isThisSlideActive ? 'false' : 'true'
746
795
  }, each);
747
- }), renderTrailingSlides())), props.arrows && showNextArrow(props, index, moveSlides, responsiveSettings)), !!props.indicators && showIndicators(props, index, goToSlide, responsiveSettings));
796
+ }), renderTrailingSlides())), arrows && showNextArrow(_extends({}, props, {
797
+ infinite: infinite
798
+ }), index, moveSlides, responsiveSettings)), !!indicators && showIndicators(_extends({}, props, {
799
+ indicators: indicators
800
+ }), index, goToSlide, responsiveSettings));
748
801
  });
749
- Slide.defaultProps = defaultProps;
750
802
 
751
803
  export { Fade, Slide, Zoom };
752
804
  //# sourceMappingURL=react-slideshow-image.esm.js.map