nuka-carousel
Advanced tools
Comparing version 5.1.1 to 5.1.2
@@ -443,3 +443,3 @@ 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; } | ||
}) | ||
}), /*#__PURE__*/React.createElement("div", { | ||
}), renderControls(props, count, currentSlide, moveSlide, nextSlide, prevSlide, slidesToScroll), /*#__PURE__*/React.createElement("div", { | ||
className: ['slider-frame', className || ''].join(' ').trim(), | ||
@@ -473,5 +473,5 @@ style: _objectSpread({ | ||
style: getSliderListStyles(children, currentSlide, animationEnabled, slidesToShow, cellAlign, wrapAround, propsSpeed, move, animation) | ||
}, wrapAround ? renderSlides('prev-cloned') : null, renderSlides(), wrapAround ? renderSlides('next-cloned') : null)), renderControls(props, count, currentSlide, moveSlide, nextSlide, prevSlide, slidesToScroll)); | ||
}, wrapAround ? renderSlides('prev-cloned') : null, renderSlides(), wrapAround ? renderSlides('next-cloned') : null))); | ||
}; | ||
Carousel.defaultProps = defaultProps; | ||
export default Carousel; |
@@ -0,2 +1,12 @@ | ||
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; } | ||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } | ||
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } | ||
import { Positions } from './types'; | ||
var commonStyles = { | ||
position: 'absolute', | ||
zIndex: 1 | ||
}; | ||
export var getDecoratorStyles = function getDecoratorStyles(pos) { | ||
@@ -6,7 +16,6 @@ switch (pos) { | ||
{ | ||
return { | ||
position: 'absolute', | ||
return _objectSpread(_objectSpread({}, commonStyles), {}, { | ||
top: 0, | ||
left: 0 | ||
}; | ||
}); | ||
} | ||
@@ -16,4 +25,3 @@ | ||
{ | ||
return { | ||
position: 'absolute', | ||
return _objectSpread(_objectSpread({}, commonStyles), {}, { | ||
top: 0, | ||
@@ -24,3 +32,3 @@ left: '50%', | ||
msTransform: 'translateX(-50%)' | ||
}; | ||
}); | ||
} | ||
@@ -30,7 +38,6 @@ | ||
{ | ||
return { | ||
position: 'absolute', | ||
return _objectSpread(_objectSpread({}, commonStyles), {}, { | ||
top: 0, | ||
right: 0 | ||
}; | ||
}); | ||
} | ||
@@ -40,4 +47,3 @@ | ||
{ | ||
return { | ||
position: 'absolute', | ||
return _objectSpread(_objectSpread({}, commonStyles), {}, { | ||
top: '50%', | ||
@@ -48,3 +54,3 @@ left: 0, | ||
msTransform: 'translateY(-50%)' | ||
}; | ||
}); | ||
} | ||
@@ -54,4 +60,3 @@ | ||
{ | ||
return { | ||
position: 'absolute', | ||
return _objectSpread(_objectSpread({}, commonStyles), {}, { | ||
top: '50%', | ||
@@ -62,3 +67,3 @@ left: '50%', | ||
msTransform: 'translate(-50%, -50%)' | ||
}; | ||
}); | ||
} | ||
@@ -68,4 +73,3 @@ | ||
{ | ||
return { | ||
position: 'absolute', | ||
return _objectSpread(_objectSpread({}, commonStyles), {}, { | ||
top: '50%', | ||
@@ -76,3 +80,3 @@ right: 0, | ||
msTransform: 'translateY(-50%)' | ||
}; | ||
}); | ||
} | ||
@@ -82,7 +86,6 @@ | ||
{ | ||
return { | ||
position: 'absolute', | ||
return _objectSpread(_objectSpread({}, commonStyles), {}, { | ||
bottom: 0, | ||
left: 0 | ||
}; | ||
}); | ||
} | ||
@@ -92,4 +95,3 @@ | ||
{ | ||
return { | ||
position: 'absolute', | ||
return _objectSpread(_objectSpread({}, commonStyles), {}, { | ||
bottom: 0, | ||
@@ -100,3 +102,3 @@ left: '50%', | ||
msTransform: 'translateX(-50%)' | ||
}; | ||
}); | ||
} | ||
@@ -106,7 +108,6 @@ | ||
{ | ||
return { | ||
position: 'absolute', | ||
return _objectSpread(_objectSpread({}, commonStyles), {}, { | ||
bottom: 0, | ||
right: 0 | ||
}; | ||
}); | ||
} | ||
@@ -116,9 +117,8 @@ | ||
{ | ||
return { | ||
position: 'absolute', | ||
return _objectSpread(_objectSpread({}, commonStyles), {}, { | ||
top: 0, | ||
left: 0 | ||
}; | ||
}); | ||
} | ||
} | ||
}; |
@@ -59,40 +59,23 @@ import React from 'react'; | ||
var getPositioning = function getPositioning(cellAlign, slidesToShow, count, currentSlide, wrapAround, move) { | ||
if (!cellAlign || cellAlign === Alignment.Left) { | ||
var initialValue = wrapAround ? -(count * (100 / (3 * count))) : 0; | ||
var horizontalMove = getTransition(count, initialValue, currentSlide, cellAlign, wrapAround); | ||
var draggableMove = move ? "calc(".concat(horizontalMove, "% - ").concat(move, "px)") : "".concat(horizontalMove, "%"); | ||
return "translate3d(".concat(draggableMove, ", 0, 0)"); | ||
} | ||
// When wrapAround is enabled, we show the slides 3 times | ||
var totalCount = wrapAround ? 3 * count : count; | ||
var slideSize = 100 / totalCount; | ||
var initialValue = wrapAround ? -count * slideSize : 0; | ||
if (cellAlign === Alignment.Right) { | ||
var right = slidesToShow > 1 ? 100 / count * (slidesToShow - 1) : 0; // if wrapAround is enabled | ||
var rightAlignedFirstSlide = -(count * (100 / (3 * count))) + (slidesToShow - 1) * (100 / (3 * count)); | ||
var _initialValue = wrapAround ? rightAlignedFirstSlide : right; | ||
var _horizontalMove = getTransition(count, _initialValue, currentSlide, cellAlign, wrapAround); | ||
var _draggableMove = move ? "calc(".concat(_horizontalMove, "% - ").concat(move, "px)") : "".concat(_horizontalMove, "%"); | ||
return "translate3d(".concat(_draggableMove, ", 0, 0)"); | ||
if (cellAlign === Alignment.Right && slidesToShow > 1) { | ||
var excessSlides = slidesToShow - 1; | ||
initialValue += slideSize * excessSlides; | ||
} | ||
if (cellAlign === Alignment.Center) { | ||
var center = slidesToShow > 1 ? 100 / count * Math.floor(slidesToShow / 2) : 0; | ||
var validatedCenter = slidesToShow % 2 === 0 ? center - 100 / count / 2 : center; // if wrapAround is enabled | ||
if (cellAlign === Alignment.Center && slidesToShow > 1) { | ||
var _excessSlides = slidesToShow - 1; // Half of excess is on left and half is on right when centered | ||
var centerAlignedFirstSlide = -(count * (100 / (3 * count))) + Math.floor(slidesToShow / 2) * (100 / (3 * count)); | ||
var wrapAroundCenter = slidesToShow % 2 === 0 ? centerAlignedFirstSlide - 100 / (3 * count) / 2 : centerAlignedFirstSlide; | ||
var _initialValue2 = wrapAround ? wrapAroundCenter : validatedCenter; | ||
var _horizontalMove2 = getTransition(count, _initialValue2, currentSlide, cellAlign, wrapAround); | ||
var _draggableMove2 = move ? "calc(".concat(_horizontalMove2, "% - ").concat(move, "px)") : "".concat(_horizontalMove2, "%"); | ||
return "translate3d(".concat(_draggableMove2, ", 0, 0)"); | ||
var excessLeftSlides = _excessSlides / 2; | ||
initialValue += slideSize * excessLeftSlides; | ||
} | ||
return 'translate3d(0, 0, 0)'; | ||
var horizontalMove = getTransition(count, initialValue, currentSlide, cellAlign, wrapAround); | ||
var draggableMove = move ? "calc(".concat(horizontalMove, "% - ").concat(move, "px)") : "".concat(horizontalMove, "%"); | ||
return "translate3d(".concat(draggableMove, ", 0, 0)"); | ||
}; | ||
@@ -99,0 +82,0 @@ |
@@ -467,3 +467,3 @@ "use strict"; | ||
}) | ||
}), /*#__PURE__*/_react["default"].createElement("div", { | ||
}), (0, _controls["default"])(props, count, currentSlide, moveSlide, nextSlide, prevSlide, slidesToScroll), /*#__PURE__*/_react["default"].createElement("div", { | ||
className: ['slider-frame', className || ''].join(' ').trim(), | ||
@@ -497,3 +497,3 @@ style: _objectSpread({ | ||
style: (0, _sliderList.getSliderListStyles)(children, currentSlide, animationEnabled, slidesToShow, cellAlign, wrapAround, propsSpeed, move, animation) | ||
}, wrapAround ? renderSlides('prev-cloned') : null, renderSlides(), wrapAround ? renderSlides('next-cloned') : null)), (0, _controls["default"])(props, count, currentSlide, moveSlide, nextSlide, prevSlide, slidesToScroll)); | ||
}, wrapAround ? renderSlides('prev-cloned') : null, renderSlides(), wrapAround ? renderSlides('next-cloned') : null))); | ||
}; | ||
@@ -500,0 +500,0 @@ |
@@ -10,2 +10,13 @@ "use strict"; | ||
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; } | ||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } | ||
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } | ||
var commonStyles = { | ||
position: 'absolute', | ||
zIndex: 1 | ||
}; | ||
var getDecoratorStyles = function getDecoratorStyles(pos) { | ||
@@ -15,7 +26,6 @@ switch (pos) { | ||
{ | ||
return { | ||
position: 'absolute', | ||
return _objectSpread(_objectSpread({}, commonStyles), {}, { | ||
top: 0, | ||
left: 0 | ||
}; | ||
}); | ||
} | ||
@@ -25,4 +35,3 @@ | ||
{ | ||
return { | ||
position: 'absolute', | ||
return _objectSpread(_objectSpread({}, commonStyles), {}, { | ||
top: 0, | ||
@@ -33,3 +42,3 @@ left: '50%', | ||
msTransform: 'translateX(-50%)' | ||
}; | ||
}); | ||
} | ||
@@ -39,7 +48,6 @@ | ||
{ | ||
return { | ||
position: 'absolute', | ||
return _objectSpread(_objectSpread({}, commonStyles), {}, { | ||
top: 0, | ||
right: 0 | ||
}; | ||
}); | ||
} | ||
@@ -49,4 +57,3 @@ | ||
{ | ||
return { | ||
position: 'absolute', | ||
return _objectSpread(_objectSpread({}, commonStyles), {}, { | ||
top: '50%', | ||
@@ -57,3 +64,3 @@ left: 0, | ||
msTransform: 'translateY(-50%)' | ||
}; | ||
}); | ||
} | ||
@@ -63,4 +70,3 @@ | ||
{ | ||
return { | ||
position: 'absolute', | ||
return _objectSpread(_objectSpread({}, commonStyles), {}, { | ||
top: '50%', | ||
@@ -71,3 +77,3 @@ left: '50%', | ||
msTransform: 'translate(-50%, -50%)' | ||
}; | ||
}); | ||
} | ||
@@ -77,4 +83,3 @@ | ||
{ | ||
return { | ||
position: 'absolute', | ||
return _objectSpread(_objectSpread({}, commonStyles), {}, { | ||
top: '50%', | ||
@@ -85,3 +90,3 @@ right: 0, | ||
msTransform: 'translateY(-50%)' | ||
}; | ||
}); | ||
} | ||
@@ -91,7 +96,6 @@ | ||
{ | ||
return { | ||
position: 'absolute', | ||
return _objectSpread(_objectSpread({}, commonStyles), {}, { | ||
bottom: 0, | ||
left: 0 | ||
}; | ||
}); | ||
} | ||
@@ -101,4 +105,3 @@ | ||
{ | ||
return { | ||
position: 'absolute', | ||
return _objectSpread(_objectSpread({}, commonStyles), {}, { | ||
bottom: 0, | ||
@@ -109,3 +112,3 @@ left: '50%', | ||
msTransform: 'translateX(-50%)' | ||
}; | ||
}); | ||
} | ||
@@ -115,7 +118,6 @@ | ||
{ | ||
return { | ||
position: 'absolute', | ||
return _objectSpread(_objectSpread({}, commonStyles), {}, { | ||
bottom: 0, | ||
right: 0 | ||
}; | ||
}); | ||
} | ||
@@ -125,7 +127,6 @@ | ||
{ | ||
return { | ||
position: 'absolute', | ||
return _objectSpread(_objectSpread({}, commonStyles), {}, { | ||
top: 0, | ||
left: 0 | ||
}; | ||
}); | ||
} | ||
@@ -132,0 +133,0 @@ } |
@@ -69,40 +69,23 @@ "use strict"; | ||
var getPositioning = function getPositioning(cellAlign, slidesToShow, count, currentSlide, wrapAround, move) { | ||
if (!cellAlign || cellAlign === _types.Alignment.Left) { | ||
var initialValue = wrapAround ? -(count * (100 / (3 * count))) : 0; | ||
var horizontalMove = getTransition(count, initialValue, currentSlide, cellAlign, wrapAround); | ||
var draggableMove = move ? "calc(".concat(horizontalMove, "% - ").concat(move, "px)") : "".concat(horizontalMove, "%"); | ||
return "translate3d(".concat(draggableMove, ", 0, 0)"); | ||
} | ||
// When wrapAround is enabled, we show the slides 3 times | ||
var totalCount = wrapAround ? 3 * count : count; | ||
var slideSize = 100 / totalCount; | ||
var initialValue = wrapAround ? -count * slideSize : 0; | ||
if (cellAlign === _types.Alignment.Right) { | ||
var right = slidesToShow > 1 ? 100 / count * (slidesToShow - 1) : 0; // if wrapAround is enabled | ||
var rightAlignedFirstSlide = -(count * (100 / (3 * count))) + (slidesToShow - 1) * (100 / (3 * count)); | ||
var _initialValue = wrapAround ? rightAlignedFirstSlide : right; | ||
var _horizontalMove = getTransition(count, _initialValue, currentSlide, cellAlign, wrapAround); | ||
var _draggableMove = move ? "calc(".concat(_horizontalMove, "% - ").concat(move, "px)") : "".concat(_horizontalMove, "%"); | ||
return "translate3d(".concat(_draggableMove, ", 0, 0)"); | ||
if (cellAlign === _types.Alignment.Right && slidesToShow > 1) { | ||
var excessSlides = slidesToShow - 1; | ||
initialValue += slideSize * excessSlides; | ||
} | ||
if (cellAlign === _types.Alignment.Center) { | ||
var center = slidesToShow > 1 ? 100 / count * Math.floor(slidesToShow / 2) : 0; | ||
var validatedCenter = slidesToShow % 2 === 0 ? center - 100 / count / 2 : center; // if wrapAround is enabled | ||
if (cellAlign === _types.Alignment.Center && slidesToShow > 1) { | ||
var _excessSlides = slidesToShow - 1; // Half of excess is on left and half is on right when centered | ||
var centerAlignedFirstSlide = -(count * (100 / (3 * count))) + Math.floor(slidesToShow / 2) * (100 / (3 * count)); | ||
var wrapAroundCenter = slidesToShow % 2 === 0 ? centerAlignedFirstSlide - 100 / (3 * count) / 2 : centerAlignedFirstSlide; | ||
var _initialValue2 = wrapAround ? wrapAroundCenter : validatedCenter; | ||
var _horizontalMove2 = getTransition(count, _initialValue2, currentSlide, cellAlign, wrapAround); | ||
var _draggableMove2 = move ? "calc(".concat(_horizontalMove2, "% - ").concat(move, "px)") : "".concat(_horizontalMove2, "%"); | ||
return "translate3d(".concat(_draggableMove2, ", 0, 0)"); | ||
var excessLeftSlides = _excessSlides / 2; | ||
initialValue += slideSize * excessLeftSlides; | ||
} | ||
return 'translate3d(0, 0, 0)'; | ||
var horizontalMove = getTransition(count, initialValue, currentSlide, cellAlign, wrapAround); | ||
var draggableMove = move ? "calc(".concat(horizontalMove, "% - ").concat(move, "px)") : "".concat(horizontalMove, "%"); | ||
return "translate3d(".concat(draggableMove, ", 0, 0)"); | ||
}; | ||
@@ -109,0 +92,0 @@ |
{ | ||
"name": "nuka-carousel", | ||
"version": "5.1.1", | ||
"version": "5.1.2", | ||
"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
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
142010
2794