nuka-carousel
Advanced tools
Comparing version 4.8.3 to 4.8.4
@@ -148,3 +148,5 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } | ||
for (var i = 0; i < lastDotIndex; i += slidesToScroll) { | ||
var scrollSlides = slidesToScroll === 0 ? 1 : slidesToScroll; | ||
for (var i = 0; i < lastDotIndex; i += scrollSlides) { | ||
dotIndexes.push(i); | ||
@@ -151,0 +153,0 @@ } // the below condition includes the last index if slidesToShow is not decimal and cellAlign = left |
@@ -51,3 +51,3 @@ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
key: "getSlideTargetPosition", | ||
value: function getSlideTargetPosition(currentSlideIndex, positionValue) { | ||
value: function getSlideTargetPosition(currentSlideIndex, positionValue, childrenLength, slidesToShow) { | ||
var offset = 0; // Below lines help to display peeking slides when number of slides is less than 3. | ||
@@ -96,2 +96,3 @@ | ||
var distanceFromStart = Math.abs(startSlideIndex - currentSlideIndex); | ||
var isDistanceBiggerThanSlides = childrenLength === slidesToShow ? distanceFromStart > slidesAfter : distanceFromStart >= slidesAfter; | ||
@@ -102,3 +103,3 @@ if (currentSlideIndex < startSlideIndex) { | ||
} | ||
} else if (distanceFromStart >= slidesAfter) { | ||
} else if (isDistanceBiggerThanSlides) { | ||
targetPosition = (this.props.slideWidth + this.props.cellSpacing) * (this.props.slideCount - currentSlideIndex) * -1; | ||
@@ -124,2 +125,3 @@ } | ||
var positionValue = vertical ? top : left; | ||
var childrenLength = React.Children.count(children); | ||
return React.Children.map(children, function (child, index) { | ||
@@ -134,3 +136,3 @@ var isVisible = isFullyVisible(index, _this2.props); | ||
role: "group", | ||
style: _this2.getSlideStyles(index, positionValue), | ||
style: _this2.getSlideStyles(index, positionValue, childrenLength, slidesToShow), | ||
key: index, | ||
@@ -144,4 +146,4 @@ onClick: handleSelfFocus, | ||
key: "getSlideStyles", | ||
value: function getSlideStyles(index, positionValue) { | ||
var targetPosition = this.getSlideTargetPosition(index, positionValue); | ||
value: function getSlideStyles(index, positionValue, childrenLength, slidesToShow) { | ||
var targetPosition = this.getSlideTargetPosition(index, positionValue, childrenLength, slidesToShow); | ||
var transformScale = this.props.animation === 'zoom' && this.props.currentSlide !== index ? Math.max(Math.min(this.props.zoomScale, MAX_ZOOM_SCALE), MIN_ZOOM_SCALE) : 1.0; | ||
@@ -148,0 +150,0 @@ return { |
@@ -166,3 +166,5 @@ "use strict"; | ||
for (var i = 0; i < lastDotIndex; i += slidesToScroll) { | ||
var scrollSlides = slidesToScroll === 0 ? 1 : slidesToScroll; | ||
for (var i = 0; i < lastDotIndex; i += scrollSlides) { | ||
dotIndexes.push(i); | ||
@@ -169,0 +171,0 @@ } // the below condition includes the last index if slidesToShow is not decimal and cellAlign = left |
@@ -64,3 +64,3 @@ "use strict"; | ||
key: "getSlideTargetPosition", | ||
value: function getSlideTargetPosition(currentSlideIndex, positionValue) { | ||
value: function getSlideTargetPosition(currentSlideIndex, positionValue, childrenLength, slidesToShow) { | ||
var offset = 0; // Below lines help to display peeking slides when number of slides is less than 3. | ||
@@ -109,2 +109,3 @@ | ||
var distanceFromStart = Math.abs(startSlideIndex - currentSlideIndex); | ||
var isDistanceBiggerThanSlides = childrenLength === slidesToShow ? distanceFromStart > slidesAfter : distanceFromStart >= slidesAfter; | ||
@@ -115,3 +116,3 @@ if (currentSlideIndex < startSlideIndex) { | ||
} | ||
} else if (distanceFromStart >= slidesAfter) { | ||
} else if (isDistanceBiggerThanSlides) { | ||
targetPosition = (this.props.slideWidth + this.props.cellSpacing) * (this.props.slideCount - currentSlideIndex) * -1; | ||
@@ -137,2 +138,5 @@ } | ||
var positionValue = vertical ? top : left; | ||
var childrenLength = _react["default"].Children.count(children); | ||
return _react["default"].Children.map(children, function (child, index) { | ||
@@ -147,3 +151,3 @@ var isVisible = (0, _utilities.isFullyVisible)(index, _this2.props); | ||
role: "group", | ||
style: _this2.getSlideStyles(index, positionValue), | ||
style: _this2.getSlideStyles(index, positionValue, childrenLength, slidesToShow), | ||
key: index, | ||
@@ -157,4 +161,4 @@ onClick: _utilities.handleSelfFocus, | ||
key: "getSlideStyles", | ||
value: function getSlideStyles(index, positionValue) { | ||
var targetPosition = this.getSlideTargetPosition(index, positionValue); | ||
value: function getSlideStyles(index, positionValue, childrenLength, slidesToShow) { | ||
var targetPosition = this.getSlideTargetPosition(index, positionValue, childrenLength, slidesToShow); | ||
var transformScale = this.props.animation === 'zoom' && this.props.currentSlide !== index ? Math.max(Math.min(this.props.zoomScale, MAX_ZOOM_SCALE), MIN_ZOOM_SCALE) : 1.0; | ||
@@ -161,0 +165,0 @@ return { |
{ | ||
"name": "nuka-carousel", | ||
"version": "4.8.3", | ||
"version": "4.8.4", | ||
"description": "Pure React Carousel", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
5688
286175
25
1