Socket
Socket
Sign inDemoInstall

react-alice-carousel

Package Overview
Dependencies
7
Maintainers
1
Versions
92
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.17.3 to 1.18.0

85

lib/prop-types.js

@@ -1,2 +0,2 @@

'use strict';
"use strict";

@@ -6,44 +6,44 @@ Object.defineProperty(exports, "__esModule", {

});
exports.defaultProps = exports.propTypes = undefined;
exports.defaultProps = exports.propTypes = void 0;
var _propTypes = require('prop-types');
var _propTypes = _interopRequireDefault(require("prop-types"));
var _propTypes2 = _interopRequireDefault(_propTypes);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var propTypes = exports.propTypes = {
autoHeight: _propTypes2.default.bool,
autoPlay: _propTypes2.default.bool,
autoPlayDirection: _propTypes2.default.string,
autoPlayInterval: _propTypes2.default.number,
buttonsDisabled: _propTypes2.default.bool,
children: _propTypes2.default.array,
controlsStrategy: _propTypes2.default.oneOf(['default', 'responsive']),
disableAutoPlayOnAction: _propTypes2.default.bool,
dotsDisabled: _propTypes2.default.bool,
duration: _propTypes2.default.number,
fadeOutAnimation: _propTypes2.default.bool,
infinite: _propTypes2.default.bool,
items: _propTypes2.default.array,
keysControlDisabled: _propTypes2.default.bool,
mouseTrackingEnabled: _propTypes2.default.bool,
onInitialized: _propTypes2.default.func,
onResized: _propTypes2.default.func,
onSlideChange: _propTypes2.default.func,
onSlideChanged: _propTypes2.default.func,
playButtonEnabled: _propTypes2.default.bool,
preventEventOnTouchMove: _propTypes2.default.bool,
responsive: _propTypes2.default.object,
shouldHandleResizeEvent: _propTypes2.default.func,
showSlideInfo: _propTypes2.default.bool,
slideToIndex: _propTypes2.default.number,
stagePadding: _propTypes2.default.object,
startIndex: _propTypes2.default.number,
stopAutoPlayOnHover: _propTypes2.default.bool,
swipeDisabled: _propTypes2.default.bool,
touchTrackingEnabled: _propTypes2.default.bool
var propTypes = {
autoHeight: _propTypes["default"].bool,
autoPlay: _propTypes["default"].bool,
autoPlayDirection: _propTypes["default"].string,
autoPlayInterval: _propTypes["default"].number,
buttonsDisabled: _propTypes["default"].bool,
children: _propTypes["default"].array,
controlsStrategy: _propTypes["default"].oneOf(['default', 'responsive']),
disableAutoPlayOnAction: _propTypes["default"].bool,
dotsDisabled: _propTypes["default"].bool,
duration: _propTypes["default"].number,
fadeOutAnimation: _propTypes["default"].bool,
infinite: _propTypes["default"].bool,
items: _propTypes["default"].array,
keysControlDisabled: _propTypes["default"].bool,
mouseTrackingEnabled: _propTypes["default"].bool,
onInitialized: _propTypes["default"].func,
onResized: _propTypes["default"].func,
onSlideChange: _propTypes["default"].func,
onSlideChanged: _propTypes["default"].func,
playButtonEnabled: _propTypes["default"].bool,
preventEventOnTouchMove: _propTypes["default"].bool,
responsive: _propTypes["default"].object,
shouldHandleResizeEvent: _propTypes["default"].func,
showSlideInfo: _propTypes["default"].bool,
slideToIndex: _propTypes["default"].number,
stagePadding: _propTypes["default"].object,
startIndex: _propTypes["default"].number,
stopAutoPlayOnHover: _propTypes["default"].bool,
swipeDelta: _propTypes["default"].number,
swipeDisabled: _propTypes["default"].bool,
touchTrackingEnabled: _propTypes["default"].bool,
transitionTimingFunction: _propTypes["default"].string
};
var defaultProps = exports.defaultProps = {
exports.propTypes = propTypes;
var defaultProps = {
autoHeight: false,

@@ -73,3 +73,6 @@ autoPlay: false,

swipeDisabled: false,
touchTrackingEnabled: true
};
swipeDelta: 10,
touchTrackingEnabled: true,
transitionTimingFunction: 'ease-out'
};
exports.defaultProps = defaultProps;

@@ -1,2 +0,2 @@

'use strict';
"use strict";

@@ -6,46 +6,62 @@ Object.defineProperty(exports, "__esModule", {

});
exports["default"] = void 0;
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
var _react = _interopRequireDefault(require("react"));
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
var _vanillaSwipe = _interopRequireDefault(require("vanilla-swipe"));
var _react = require('react');
var Utils = _interopRequireWildcard(require("./utils"));
var _react2 = _interopRequireDefault(_react);
var Views = _interopRequireWildcard(require("./views"));
var _vanillaSwipe = require('vanilla-swipe');
var _propTypes = require("./prop-types");
var _vanillaSwipe2 = _interopRequireDefault(_vanillaSwipe);
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
var _utils = require('./utils');
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
var Utils = _interopRequireWildcard(_utils);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
var _views = require('./views');
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); }
var Views = _interopRequireWildcard(_views);
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; }
var _propTypes = require('./prop-types');
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 _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
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; }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
function _createSuper(Derived) { return function () { var Super = _getPrototypeOf(Derived), result; if (_isNativeReflectConstruct()) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
var AliceCarousel = function (_React$PureComponent) {
_inherits(AliceCarousel, _React$PureComponent);
var _super = _createSuper(AliceCarousel);
function AliceCarousel(props) {
var _this;
_classCallCheck(this, AliceCarousel);
var _this = _possibleConstructorReturn(this, (AliceCarousel.__proto__ || Object.getPrototypeOf(AliceCarousel)).call(this, props));
_this = _super.call(this, props);
_this._handleOnWindowResize = function (e) {
var shouldHandleResizeEvent = _this.props.shouldHandleResizeEvent;
var currentDimensions = Utils.getElementDimensions(_this.rootComponent);

@@ -56,15 +72,27 @@ var shouldProcessEvent = shouldHandleResizeEvent || Utils.shouldHandleResizeEvent;

_this.rootComponentDimensions = currentDimensions;
_this._disableAnimation();
_this._handleOnMouseEnter();
var isAnimationCanceled = _this._isSwipeAnimationProcessing();
var currState = Utils.calculateInitialProps(_this.props, _this.stageComponent);
var translate3d = Utils.getTranslate3dPosition(currState.currentIndex, currState);
var nextState = _extends({}, currState, { translate3d: translate3d, isAnimationCanceled: isAnimationCanceled, initialStageHeight: 0 });
if (isAnimationCanceled) Utils.animate(_this.stageComponent, translate3d);
var nextState = _objectSpread({}, currState, {
translate3d: translate3d,
isAnimationCanceled: isAnimationCanceled,
initialStageHeight: 0
});
if (isAnimationCanceled) Utils.animate(_this.stageComponent, {
position: translate3d
});
_this.setState(nextState, function () {
_this._resetAllIntermediateProps();
_this._handleOnMouseLeave();
_this._onResized();

@@ -77,3 +105,6 @@ });

_this._resetAllIntermediateProps();
_this.setState({ isAnimationCanceled: false });
_this.setState({
isAnimationCanceled: false
});
};

@@ -85,4 +116,6 @@

return _this._handleOnSpaceBarClick();
case 'ArrowLeft':
return _this.slidePrev();
case 'ArrowRight':

@@ -119,4 +152,7 @@ return _this.slideNext();

_this._onSlideChange();
_this._onSlideChanged();
_this._allowAnimation();
_this._pause();

@@ -127,4 +163,7 @@ };

if (shouldRecalculate || _this._isFadeOutAnimationAllowed()) {
return { fadeoutAnimationProcessing: false };
return {
fadeoutAnimationProcessing: false
};
}
return {};

@@ -155,2 +194,3 @@ };

_this._onSlideChanged();
_this.props.disableAutoPlayOnAction && _this._pause();

@@ -173,13 +213,19 @@ _this.isHovered = false;

_this._resetFadeOutAnimationState = function () {
_this.setState({ fadeoutAnimationProcessing: false }, _this._onSlideChanged);
_this.setState({
fadeoutAnimationProcessing: false
}, _this._onSlideChanged);
};
_this._resetAllIntermediateProps = function () {
_this.prevSwipPosition = 0;
_this.swipingStarted = false;
_this.verticalSwipingDetected = false;
_this._stopSwipeAnimation();
_this._resetAnimationProps();
_this._resetSwipePositionProps();
_this._clearUpdateSlidePositionIntervalId();
_this._allowAnimation();

@@ -193,3 +239,3 @@ };

_this.setState(_extends({
_this.setState(_objectSpread({
currentIndex: currentIndex,

@@ -213,4 +259,9 @@ translate3d: translate3d,

var slide = Utils.getActiveSlideIndex(isNextSlideDisabled, state);
return { item: item, slide: slide, itemsInSlide: itemsInSlide, isNextSlideDisabled: isNextSlideDisabled, isPrevSlideDisabled: isPrevSlideDisabled };
return {
item: item,
slide: slide,
itemsInSlide: itemsInSlide,
isNextSlideDisabled: isNextSlideDisabled,
isPrevSlideDisabled: isPrevSlideDisabled
};
};

@@ -222,7 +273,10 @@

itemWidth = _this$state.itemWidth;
var fadeOutIndex = currentIndex + 1;
var fadeOutOffset = Utils.getFadeOutOffsetOnDotClick(itemIndex, currentIndex, itemWidth);
_this._setAnimationProps({ fadeOutIndex: fadeOutIndex, fadeOutOffset: fadeOutOffset, allowFadeOutAnimation: true });
_this._setAnimationProps({
fadeOutIndex: fadeOutIndex,
fadeOutOffset: fadeOutOffset,
allowFadeOutAnimation: true
});
};

@@ -233,3 +287,6 @@

_this._clearAutoPlayInterval();
_this.setState({ isPlaying: false });
_this.setState({
isPlaying: false
});
}

@@ -244,4 +301,7 @@ };

_this._getIntermediateStateProps = function (duration, shouldSkipRecalculation) {
var transitionTimingFunction = _this.props.transitionTimingFunction;
var condition = !shouldSkipRecalculation && _this._isFadeOutAnimationAllowed();
return Utils.getIntermediateTransitionProps(condition, duration);
return Utils.getIntermediateTransitionProps(condition, duration, transitionTimingFunction);
};

@@ -261,3 +321,3 @@

var prevProps = _this.animationProps || {};
_this.animationProps = _extends({}, prevProps, newProps);
_this.animationProps = _objectSpread({}, prevProps, {}, newProps);
};

@@ -271,3 +331,3 @@

var prevProps = _this.swipePosition || {};
_this.swipePosition = _extends({}, prevProps, newProps);
_this.swipePosition = _objectSpread({}, prevProps, {}, newProps);
};

@@ -282,3 +342,2 @@

var lastSwipePosition = _this.swipePosition.lastSwipePosition;
var position = lastSwipePosition || translate3d;

@@ -294,2 +353,3 @@

}
return position - Math.floor(deltaX);

@@ -299,7 +359,10 @@ };

_this._onTouchEnd = function () {
if (!_this.swipingStarted || _this._isSwipeDisabled()) return;
_this.swipingStarted = false;
_this.prevSwipPosition = 0;
if (_this._isSwipeDisable()) return;
_this._setSwipePositionProps({
lastSwipePosition: _this.swipePosition.position
});
_this._setSwipePositionProps({ lastSwipePosition: _this.swipePosition.position });
_this._beforeTouchEnd();

@@ -316,3 +379,2 @@ };

isAnimationCanceled = _this$state2.isAnimationCanceled;
return currentIndex === itemIndex || isAnimationCanceled || !_this.allowAnimation || _this.swipeAnimation;

@@ -325,14 +387,11 @@ };

items = _this$state3.items;
var hasNoStagePadding = !(stagePadding.paddingLeft || stagePadding.paddingRight);
return _this.props.fadeOutAnimation && items === 1 && hasNoStagePadding;
};
_this._isSwipeDisable = function () {
_this._isSwipeDisabled = function () {
var _this$state4 = _this.state,
isAnimationCanceled = _this$state4.isAnimationCanceled,
fadeOutAnimation = _this$state4.fadeOutAnimation;
return _this.props.swipeDisabled || fadeOutAnimation || isAnimationCanceled || _this.verticalSwipingDetected;
fadeoutAnimationProcessing = _this$state4.fadeoutAnimationProcessing;
return _this.props.swipeDisabled || fadeoutAnimationProcessing || isAnimationCanceled;
};

@@ -352,3 +411,2 @@

currentIndex = _this$state5.currentIndex;
return currentIndex < 0 || currentIndex >= slides.length;

@@ -361,7 +419,10 @@ };

itemWidth = _this$state6.itemWidth;
var fadeOutIndex = Utils.getFadeOutIndexOnClick(currentIndex);
var fadeOutOffset = Utils.getFadeOutOffsetOnClick(direction, itemWidth);
_this._setAnimationProps({ fadeOutIndex: fadeOutIndex, fadeOutOffset: fadeOutOffset, allowFadeOutAnimation: true });
_this._setAnimationProps({
fadeOutIndex: fadeOutIndex,
fadeOutOffset: fadeOutOffset,
allowFadeOutAnimation: true
});
};

@@ -373,4 +434,6 @@

slides = _this$state7.slides;
return _react2.default.createElement(Views.SlideInfo, { slidesLength: slides.length, currentIndex: currentIndex });
return _react["default"].createElement(Views.SlideInfo, {
slidesLength: slides.length,
currentIndex: currentIndex
});
};

@@ -381,3 +444,8 @@

var className = Utils.itemClassName(i, _this.state, _this.animationProps);
return _react2.default.createElement(Views.StageItem, { styles: style, className: className, key: 'stage-item-' + i, item: item });
return _react["default"].createElement(Views.StageItem, {
styles: style,
className: className,
key: "stage-item-".concat(i),
item: item
});
};

@@ -394,7 +462,6 @@

};
_this.slideTo = _this.slideTo.bind(_this);
_this.slidePrev = _this.slidePrev.bind(_this);
_this.slideNext = _this.slideNext.bind(_this);
_this._onTouchMove = _this._onTouchMove.bind(_this);
_this.slideTo = _this.slideTo.bind(_assertThisInitialized(_this));
_this.slidePrev = _this.slidePrev.bind(_assertThisInitialized(_this));
_this.slideNext = _this.slideNext.bind(_assertThisInitialized(_this));
_this._onTouchMove = _this._onTouchMove.bind(_assertThisInitialized(_this));
_this._throttledOnTouchMove = Utils.throttle(_this._onTouchMove, 10);

@@ -406,6 +473,8 @@ _this._debouncedHandleOnWindowResize = Utils.debounce(_this._handleOnWindowResize, 100);

_createClass(AliceCarousel, [{
key: 'componentDidMount',
key: "componentDidMount",
value: function componentDidMount() {
this._setInitialState();
this._setupSwipeHahdlers();
this._setupSwipeHandlers();
this._resetAllIntermediateProps();

@@ -422,15 +491,21 @@

}, {
key: 'componentDidUpdate',
key: "componentDidUpdate",
value: function componentDidUpdate(prevProps) {
if (this.props.autoHeight && this.stageComponent && !this.state.initialStageHeight) {
var initialStageHeight = Utils.getGalleryItemHeight(this.stageComponent, this.props, this.state);
this.setState({ initialStageHeight: initialStageHeight });
this.setState({
initialStageHeight: initialStageHeight
});
}
if (this.props.duration !== prevProps.duration) {
this.setState({ duration: this.props.duration });
this.setState({
duration: this.props.duration
});
}
if (this.props.fadeOutAnimation !== prevProps.fadeOutAnimation) {
this.setState({ fadeoutAnimationProcessing: false }, this._resetAnimationProps);
this.setState({
fadeoutAnimationProcessing: false
}, this._resetAnimationProps);
}

@@ -448,2 +523,3 @@

this._resetAllIntermediateProps();
this.setState(Utils.calculateInitialProps(this.props, this.stageComponent));

@@ -456,4 +532,5 @@ }

if (!this.swipingStarted) {
if (!this.swipingStarted && (this.props.mouseTrackingEnabled !== prevProps.mouseTrackingEnabled || this.props.touchTrackingEnabled !== prevProps.touchTrackingEnabled || this.props.preventEventOnTouchMove !== prevProps.preventEventOnTouchMove || this.props.swipeDelta !== prevProps.swipeDelta)) {
this.swiper.update({
delta: this.props.swipeDelta,
mouseTrackingEnabled: this.props.mouseTrackingEnabled,

@@ -466,3 +543,3 @@ touchTrackingEnabled: this.props.touchTrackingEnabled,

}, {
key: 'componentWillUnmount',
key: "componentWillUnmount",
value: function componentWillUnmount() {

@@ -475,23 +552,23 @@ clearInterval(this._autoPlayIntervalId);

}, {
key: 'slideTo',
key: "slideTo",
value: function slideTo() {
var index = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
if (this._isClickDisabled(index)) return;
this._disableAnimation();
this._isFadeOutAnimationAllowed() && this.setAnimationPropsOnDotClick(index);
this.props.disableAutoPlayOnAction && this._pause();
this._slideToItem(index);
}
}, {
key: 'slidePrev',
key: "slidePrev",
value: function slidePrev() {
var action = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
if (this._isClickDisabled()) return;
this._disableAnimation();
this._isFadeOutAnimationAllowed() && this._setAnimationPropsOnClick('prev');
if (Utils.itemInfo(this.state).isPrevSlideDisabled) return this._onInactiveItem();

@@ -503,11 +580,10 @@ if (action && this.props.disableAutoPlayOnAction) this._pause();

}, {
key: 'slideNext',
key: "slideNext",
value: function slideNext() {
var action = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
if (this._isClickDisabled()) return;
this._disableAnimation();
this._isFadeOutAnimationAllowed() && this._setAnimationPropsOnClick('next');
if (Utils.itemInfo(this.state).isNextSlideDisabled) return this._onInactiveItem();

@@ -519,18 +595,19 @@ if (action && this.props.disableAutoPlayOnAction) this._pause();

}, {
key: '_setupSwipeHahdlers',
value: function _setupSwipeHahdlers() {
this.swiper = new _vanillaSwipe2.default({
key: "_setupSwipeHandlers",
value: function _setupSwipeHandlers() {
this.swiper = new _vanillaSwipe["default"]({
element: this.rootComponent,
delta: this.props.swipeDelta,
onSwiping: this._throttledOnTouchMove,
onSwiped: this._onTouchEnd,
rotationAngle: 10,
rotationAngle: 5,
mouseTrackingEnabled: this.props.mouseTrackingEnabled,
touchTrackingEnabled: this.props.touchTrackingEnabled,
preventDefaultTouchmoveEvent: this.props.preventEventOnTouchMove
preventDefaultTouchmoveEvent: this.props.preventEventOnTouchMove,
preventTrackingOnMouseleave: true
});
this.swiper.init();
}
}, {
key: '_onSlideChange',
key: "_onSlideChange",
value: function _onSlideChange() {

@@ -542,3 +619,3 @@ if (this.props.onSlideChange) {

}, {
key: '_onSlideChanged',
key: "_onSlideChanged",
value: function _onSlideChanged() {

@@ -548,6 +625,7 @@ if (this.props.onSlideChanged) {

}
this._allowAnimation();
}
}, {
key: '_onInitialized',
key: "_onInitialized",
value: function _onInitialized(initialState) {

@@ -561,3 +639,3 @@ this.rootComponentDimensions = Utils.getElementDimensions(this.rootComponent);

}, {
key: '_onResized',
key: "_onResized",
value: function _onResized() {

@@ -569,3 +647,3 @@ if (this.props.onResized) {

}, {
key: '_setInitialState',
key: "_setInitialState",
value: function _setInitialState() {

@@ -576,6 +654,8 @@ var initialState = Utils.calculateInitialProps(this.props, this.stageComponent);

}, {
key: '_checkSlidePosition',
key: "_checkSlidePosition",
value: function _checkSlidePosition(shouldSkipRecalculation) {
this._stopSwipeAnimation();
this._resetAnimationProps();
this._resetSwipePositionProps();

@@ -586,3 +666,3 @@

}, {
key: '_setAutoPlayInterval',
key: "_setAutoPlayInterval",
value: function _setAutoPlayInterval() {

@@ -592,8 +672,6 @@ var _this2 = this;

var duration = this.state.duration;
var _props = this.props,
autoPlayDirection = _props.autoPlayDirection,
autoPlayInterval = _props.autoPlayInterval;
var _this$props = this.props,
autoPlayDirection = _this$props.autoPlayDirection,
autoPlayInterval = _this$props.autoPlayInterval;
var playInterval = Math.max(autoPlayInterval, duration);
this._autoPlayIntervalId = setInterval(function () {

@@ -606,3 +684,3 @@ if (!_this2._isHovered() && _this2._autoPlayIntervalId && _this2.state.isPlaying) {

}, {
key: '_clearAutoPlayInterval',
key: "_clearAutoPlayInterval",
value: function _clearAutoPlayInterval() {

@@ -612,3 +690,3 @@ clearInterval(this._autoPlayIntervalId);

}, {
key: '_clearUpdateSlidePositionIntervalId',
key: "_clearUpdateSlidePositionIntervalId",
value: function _clearUpdateSlidePositionIntervalId() {

@@ -618,5 +696,7 @@ clearTimeout(this._updateSlidePositionIntervalId);

}, {
key: '_play',
key: "_play",
value: function _play() {
this.setState({ isPlaying: true });
this.setState({
isPlaying: true
});

@@ -628,3 +708,3 @@ if (!this._autoPlayIntervalId) {

}, {
key: '_slideToItem',
key: "_slideToItem",
value: function _slideToItem(index) {

@@ -636,10 +716,9 @@ var _this3 = this;

this._onSlideChange();
var _options$duration = options.duration,
duration = _options$duration === undefined ? this.state.duration : _options$duration,
duration = _options$duration === void 0 ? this.state.duration : _options$duration,
_options$shouldSkipRe = options.shouldSkipRecalculation,
shouldSkipRecalculation = _options$shouldSkipRe === undefined ? false : _options$shouldSkipRe;
shouldSkipRecalculation = _options$shouldSkipRe === void 0 ? false : _options$shouldSkipRe;
var translate3d = Utils.getTranslate3dPosition(index, this.state);
this.setState(_extends({
this.setState(_objectSpread({
currentIndex: index,

@@ -652,33 +731,32 @@ translate3d: translate3d

}, {
key: '_onTouchMove',
value: function _onTouchMove(e, deltaX, deltaY) {
this.swipingStarted = true;
key: "_onTouchMove",
value: function _onTouchMove(e, deltaX, deltaY, absX, absY) {
this._handleOnMouseEnter();
if (Utils.isVerticalTouchMoveDetected(e, deltaX, deltaY)) {
if (this.swipePosition.direction) return;
this.verticalSwipingDetected = true;
} else {
this.verticalSwipingDetected = false;
if (this._isSwipeDisabled()) {
return;
}
if (this._isSwipeDisable()) {
if (!this.swipingStarted && Utils.isVerticalTouchMoveDetected(e, absX, absY)) {
return;
}
this.swipingStarted = true;
this._disableAnimation();
this._startSwipeAnimation();
this._clearUpdateSlidePositionIntervalId();
this.touchEndTimeoutId && clearTimeout(this.touchEndTimeoutId);
var _state = this.state,
slides = _state.slides,
items = _state.items,
itemWidth = _state.itemWidth,
infinite = _state.infinite,
stagePadding = _state.stagePadding;
var _this$state8 = this.state,
slides = _this$state8.slides,
items = _this$state8.items,
itemWidth = _this$state8.itemWidth,
infinite = _this$state8.infinite,
stagePadding = _this$state8.stagePadding;
var slidesLength = slides.length;
var direction = Utils.getSwipeDirection(deltaX);
var direction = Utils.getSwipeDirection(this.prevSwipPosition, deltaX);
this.prevSwipPosition = deltaX;

@@ -689,2 +767,3 @@ var position = this._getTranslateXPosition(deltaX);

var _minSwipeLimit = Utils.getMinSwipeLimitIfNotInfinite(items, itemWidth);
var _maxSwipeLimit = Utils.getMaxSwipeLimitIfNotInfinite(slidesLength, itemWidth);

@@ -696,4 +775,11 @@

Utils.animate(this.stageComponent, position);
this._setSwipePositionProps({ position: position, direction: direction });
Utils.animate(this.stageComponent, {
position: position
});
this._setSwipePositionProps({
position: position,
direction: direction
});
return;

@@ -715,6 +801,13 @@ }

Utils.animate(this.stageComponent, position);
this._setSwipePositionProps({ position: position, direction: direction });
Utils.animate(this.stageComponent, {
position: position
});
this._setSwipePositionProps({
position: position,
direction: direction
});
function recalculatePosition() {
var direction = Utils.getSwipeDirection(0, deltaX);
direction === 'RIGHT' ? position = position + slidesLength * -itemWidth : position = position + maxPosition - items * itemWidth;

@@ -728,15 +821,15 @@

}, {
key: '_beforeTouchEnd',
key: "_beforeTouchEnd",
value: function _beforeTouchEnd() {
var _this4 = this;
var _swipePosition = this.swipePosition,
direction = _swipePosition.direction,
position = _swipePosition.position;
var _state2 = this.state,
itemWidth = _state2.itemWidth,
items = _state2.items,
duration = _state2.duration,
infinite = _state2.infinite;
var _this$swipePosition = this.swipePosition,
direction = _this$swipePosition.direction,
position = _this$swipePosition.position;
var transitionTimingFunction = this.props.transitionTimingFunction;
var _this$state9 = this.state,
itemWidth = _this$state9.itemWidth,
items = _this$state9.items,
duration = _this$state9.duration,
infinite = _this$state9.infinite;
var swipeIndex = Utils.calculateSwipeIndex(itemWidth, position, direction);

@@ -748,7 +841,11 @@ var currentIndex = Utils.getSwipeIndexOnBeforeTouchEnd(swipeIndex, items);

this._isInfiniteModeDisabledBeforeTouchEnd(swipeIndex, currentIndex);
return;
}
Utils.animate(this.stageComponent, translateXPosition, duration);
Utils.animate(this.stageComponent, {
position: translateXPosition,
duration: duration,
transitionTimingFunction: transitionTimingFunction
});
this.touchEndAnimation = true;

@@ -763,5 +860,10 @@ this.touchEndTimeoutId = setTimeout(function () {

var nextTranslateXPosition = Utils.getTranslate3dPosition(nextItemIndex, _this4.state);
Utils.animate(_this4.stageComponent, {
position: nextTranslateXPosition
});
Utils.animate(_this4.stageComponent, nextTranslateXPosition, 0);
_this4._slideToItem(nextItemIndex, { duration: 0, shouldSkipRecalculation: true });
_this4._slideToItem(nextItemIndex, {
duration: 0,
shouldSkipRecalculation: true
});
}

@@ -771,14 +873,17 @@ }, duration);

}, {
key: '_isInfiniteModeDisabledBeforeTouchEnd',
key: "_isInfiniteModeDisabledBeforeTouchEnd",
value: function _isInfiniteModeDisabledBeforeTouchEnd(swipeIndex, currentIndex) {
var _this5 = this;
var _state3 = this.state,
items = _state3.items,
itemWidth = _state3.itemWidth,
duration = _state3.duration,
slides = _state3.slides;
var transitionTimingFunction = this.props.transitionTimingFunction;
var _this$state10 = this.state,
items = _this$state10.items,
itemWidth = _this$state10.itemWidth,
duration = _this$state10.duration,
slides = _this$state10.slides;
var position = Utils.getTranslate3dPosition(currentIndex, {
itemWidth: itemWidth,
items: items
});
var position = Utils.getTranslate3dPosition(currentIndex, { itemWidth: itemWidth, items: items });
if (swipeIndex < items) {

@@ -794,4 +899,7 @@ currentIndex = Utils.recalculateCurrentIndexOnBeforeTouchEnd();

Utils.animate(this.stageComponent, position, duration);
Utils.animate(this.stageComponent, {
position: position,
duration: duration,
transitionTimingFunction: transitionTimingFunction
});
this.touchEndAnimation = true;

@@ -804,4 +912,10 @@ this.touchEndTimeoutId = setTimeout(function () {

Utils.animate(_this5.stageComponent, position);
_this5._slideToItem(currentIndex, { duration: 0, shouldSkipRecalculation: true });
Utils.animate(_this5.stageComponent, {
position: position
});
_this5._slideToItem(currentIndex, {
duration: 0,
shouldSkipRecalculation: true
});
}

@@ -811,3 +925,3 @@ }, duration);

}, {
key: '_renderPrevButton',
key: "_renderPrevButton",
value: function _renderPrevButton() {

@@ -817,4 +931,4 @@ var _Utils$itemInfo2 = Utils.itemInfo(this.state),

return _react2.default.createElement(Views.PrevNextButton, {
name: 'prev',
return _react["default"].createElement(Views.PrevNextButton, {
name: "prev",
disabled: isPrevSlideDisabled,

@@ -827,3 +941,3 @@ onClick: this.slidePrev,

}, {
key: '_renderNextButton',
key: "_renderNextButton",
value: function _renderNextButton() {

@@ -833,4 +947,4 @@ var _Utils$itemInfo3 = Utils.itemInfo(this.state),

return _react2.default.createElement(Views.PrevNextButton, {
name: 'next',
return _react["default"].createElement(Views.PrevNextButton, {
name: "next",
disabled: isNextSlideDisabled,

@@ -843,10 +957,13 @@ onClick: this.slideNext,

}, {
key: '_renderPlayPauseButton',
key: "_renderPlayPauseButton",
value: function _renderPlayPauseButton() {
return _react2.default.createElement(Views.PlayPauseButton, { isPlaying: this.state.isPlaying, onClick: this._playPauseToggle });
return _react["default"].createElement(Views.PlayPauseButton, {
isPlaying: this.state.isPlaying,
onClick: this._playPauseToggle
});
}
}, {
key: '_renderDotsNavigation',
key: "_renderDotsNavigation",
value: function _renderDotsNavigation() {
return _react2.default.createElement(Views.DotsNavigation, {
return _react["default"].createElement(Views.DotsNavigation, {
state: this.state,

@@ -859,40 +976,27 @@ onClick: this.slideTo,

}, {
key: 'render',
key: "render",
value: function render() {
var _state4 = this.state,
style = _state4.style,
translate3d = _state4.translate3d,
clones = _state4.clones;
var _this$state11 = this.state,
style = _this$state11.style,
translate3d = _this$state11.translate3d,
clones = _this$state11.clones;
var wrapperStyles = Utils.getWrapperStyles(this.stageComponent, this.props, this.state);
var stageStyles = Utils.getStageStyles({ translate3d: translate3d }, style);
var stageStyles = Utils.getStageStyles({
translate3d: translate3d
}, style);
var dotsDisabled = Utils.shouldDisableDots(this.props, this.state);
return _react2.default.createElement(
'div',
{ className: 'alice-carousel' },
_react2.default.createElement(
'div',
{ ref: this._setRootComponentRef },
_react2.default.createElement(
'div',
{
style: wrapperStyles,
className: 'alice-carousel__wrapper',
onMouseEnter: this._handleOnMouseEnter,
onMouseLeave: this._handleOnMouseLeave
},
_react2.default.createElement(
'ul',
{ style: stageStyles, className: 'alice-carousel__stage', ref: this._setStageComponentRef },
clones.map(this._renderStageItem)
)
)
),
this.props.showSlideInfo ? this._renderSlideInfo() : null,
dotsDisabled ? null : this._renderDotsNavigation(),
!this.props.buttonsDisabled ? this._renderPrevButton() : null,
!this.props.buttonsDisabled ? this._renderNextButton() : null,
this.props.playButtonEnabled ? this._renderPlayPauseButton() : null
);
return _react["default"].createElement("div", {
className: "alice-carousel"
}, _react["default"].createElement("div", {
ref: this._setRootComponentRef
}, _react["default"].createElement("div", {
style: wrapperStyles,
className: "alice-carousel__wrapper",
onMouseEnter: this._handleOnMouseEnter,
onMouseLeave: this._handleOnMouseLeave
}, _react["default"].createElement("ul", {
style: stageStyles,
className: "alice-carousel__stage",
ref: this._setStageComponentRef
}, clones.map(this._renderStageItem)))), this.props.showSlideInfo ? this._renderSlideInfo() : null, dotsDisabled ? null : this._renderDotsNavigation(), !this.props.buttonsDisabled ? this._renderPrevButton() : null, !this.props.buttonsDisabled ? this._renderNextButton() : null, this.props.playButtonEnabled ? this._renderPlayPauseButton() : null);
}

@@ -902,8 +1006,6 @@ }]);

return AliceCarousel;
}(_react2.default.PureComponent);
}(_react["default"].PureComponent);
exports.default = AliceCarousel;
exports["default"] = AliceCarousel;
AliceCarousel.propTypes = _propTypes.propTypes;
AliceCarousel.defaultProps = _propTypes.defaultProps;

@@ -1,25 +0,33 @@

'use strict';
"use strict";
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); }
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.isAnimatedItem = exports.getTranslate3dPosition = undefined;
exports.animate = animate;
exports.getTranslateX = getTranslateX;
exports.getTransformMatrix = getTransformMatrix;
exports.isAnimatedItem = exports.getTranslate3dPosition = void 0;
var _index = require('./index');
var Utils = _interopRequireWildcard(require("./index"));
var Utils = _interopRequireWildcard(_index);
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
function animate(element) {
var position = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
var durationMs = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
function animate(element, options) {
var _ref = options || {},
_ref$position = _ref.position,
position = _ref$position === void 0 ? 0 : _ref$position,
_ref$duration = _ref.duration,
duration = _ref$duration === void 0 ? 0 : _ref$duration,
_ref$transitionTiming = _ref.transitionTimingFunction,
transitionTimingFunction = _ref$transitionTiming === void 0 ? 'step-start' : _ref$transitionTiming;
if (Utils.isElement(element)) {
element.style['transition'] = 'transform ' + durationMs + 'ms ease-out';
element.style['transform'] = 'translate3d(' + position + 'px, 0, 0)';
element.style['transition'] = "transform ".concat(duration, "ms ").concat(transitionTimingFunction);
element.style['transform'] = "translate3d(".concat(position, "px, 0, 0)");
}
return element;

@@ -40,9 +48,9 @@ }

var matched = transform.match(/(-?[0-9.]+)/g);
return matched || [];
}
return [];
}
var getTranslate3dPosition = exports.getTranslate3dPosition = function getTranslate3dPosition() {
var getTranslate3dPosition = function getTranslate3dPosition() {
var currentIndex = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;

@@ -54,5 +62,4 @@ var state = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};

_state$stagePadding = state.stagePadding,
stagePadding = _state$stagePadding === undefined ? {} : _state$stagePadding;
stagePadding = _state$stagePadding === void 0 ? {} : _state$stagePadding;
if (infinite) {

@@ -66,6 +73,9 @@ var paddingLeft = stagePadding.paddingLeft,

}
return (items + currentIndex) * -itemWidth || 0;
};
var isAnimatedItem = exports.isAnimatedItem = function isAnimatedItem() {
exports.getTranslate3dPosition = getTranslate3dPosition;
var isAnimatedItem = function isAnimatedItem() {
var i = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;

@@ -75,4 +85,5 @@ var animationProps = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};

fadeOutIndex = animationProps.fadeOutIndex;
return !!allowFadeOutAnimation && fadeOutIndex === i;
};
return !!allowFadeOutAnimation && fadeOutIndex === i;
};
exports.isAnimatedItem = isAnimatedItem;

@@ -1,15 +0,17 @@

'use strict';
"use strict";
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); }
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.itemClassName = exports.isClonedItem = exports.isActiveItem = undefined;
exports.itemClassName = exports.isClonedItem = exports.isActiveItem = void 0;
var _index = require('./index');
var Utils = _interopRequireWildcard(require("./index"));
var Utils = _interopRequireWildcard(_index);
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
var isActiveItem = exports.isActiveItem = function isActiveItem() {
var isActiveItem = function isActiveItem() {
var i = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;

@@ -21,5 +23,4 @@ var state = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};

_state$stagePadding = state.stagePadding,
stagePadding = _state$stagePadding === undefined ? {} : _state$stagePadding;
stagePadding = _state$stagePadding === void 0 ? {} : _state$stagePadding;
if (infinite && (stagePadding.paddingLeft || stagePadding.paddingRight)) {

@@ -33,3 +34,5 @@ currentIndex += 1;

var isClonedItem = exports.isClonedItem = function isClonedItem() {
exports.isActiveItem = isActiveItem;
var isClonedItem = function isClonedItem() {
var i = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;

@@ -40,17 +43,18 @@ var state = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};

_state$slides = state.slides,
slides = _state$slides === undefined ? [] : _state$slides;
slides = _state$slides === void 0 ? [] : _state$slides;
return infinite === false && (i < items || i > slides.length + items - 1);
};
var itemClassName = exports.itemClassName = function itemClassName() {
exports.isClonedItem = isClonedItem;
var itemClassName = function itemClassName() {
var i = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
var state = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
var animationProps = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
var isActive = isActiveItem(i, state) ? ' __active' : '';
var isCloned = isClonedItem(i, state) ? ' __cloned' : '';
var isAnimated = Utils.isAnimatedItem(i, animationProps) ? ' animated animated-out fadeOut' : '';
return 'alice-carousel__stage-item' + isActive + isCloned + isAnimated;
};
return 'alice-carousel__stage-item' + isActive + isCloned + isAnimated;
};
exports.itemClassName = itemClassName;

@@ -1,16 +0,19 @@

'use strict';
"use strict";
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); }
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.calculateInitialProps = exports.setTotalItemsInSlide = undefined;
exports.calculateInitialProps = exports.setTotalItemsInSlide = void 0;
var _index = require('./index');
var Utils = _interopRequireWildcard(require("./index"));
var Utils = _interopRequireWildcard(_index);
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
var setTotalItemsInSlide = exports.setTotalItemsInSlide = function setTotalItemsInSlide(responsiveConfig, childrenLength) {
var setTotalItemsInSlide = function setTotalItemsInSlide(responsiveConfig, childrenLength) {
var items = 1;
if (responsiveConfig) {

@@ -27,10 +30,12 @@ var configKeys = Object.keys(responsiveConfig);

}
return items;
};
var calculateInitialProps = exports.calculateInitialProps = function calculateInitialProps(props, el) {
exports.setTotalItemsInSlide = setTotalItemsInSlide;
var calculateInitialProps = function calculateInitialProps(props, el) {
var startIndex = props.startIndex,
responsive = props.responsive,
infinite = props.infinite;
var style = Utils.getDefaultStyles();

@@ -46,5 +51,12 @@ var slides = Utils.getSlides(props);

var itemWidth = Utils.getItemWidth(galleryWidth, items);
var clones = Utils.cloneCarouselItems(slides, items, { stagePadding: stagePadding, infinite: infinite });
var translate3d = Utils.getTranslate3dPosition(currentIndex, { itemWidth: itemWidth, items: items, stagePadding: stagePadding, infinite: infinite });
var clones = Utils.cloneCarouselItems(slides, items, {
stagePadding: stagePadding,
infinite: infinite
});
var translate3d = Utils.getTranslate3dPosition(currentIndex, {
itemWidth: itemWidth,
items: items,
stagePadding: stagePadding,
infinite: infinite
});
return {

@@ -61,2 +73,4 @@ items: items,

};
};
};
exports.calculateInitialProps = calculateInitialProps;

@@ -7,2 +7,3 @@ "use strict";

exports.debug = debug;
function debug() {

@@ -13,4 +14,6 @@ if (window.__DEBUG__) {

(_console = console).debug.apply(_console, arguments);
return arguments;
}
}

@@ -1,22 +0,23 @@

'use strict';
"use strict";
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); }
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.getCurrentIndex = exports.getNextItemIndexBeforeTouchEnd = exports.isElement = exports.getSlideInfo = exports.getGalleryItemHeight = exports.getNextItem = exports.getItemWidth = exports.isStagePadding = exports.getStagePadding = exports.itemInfo = exports.getSlides = exports.cloneCarouselItems = undefined;
exports.getElementDimensions = getElementDimensions;
exports.shouldHandleResizeEvent = shouldHandleResizeEvent;
exports.shouldDisableDots = shouldDisableDots;
exports.getCurrentIndex = exports.getNextItemIndexBeforeTouchEnd = exports.isElement = exports.getSlideInfo = exports.getGalleryItemHeight = exports.getNextItem = exports.getItemWidth = exports.isStagePadding = exports.getStagePadding = exports.itemInfo = exports.getSlides = exports.cloneCarouselItems = void 0;
var _index = require('./index');
var Utils = _interopRequireWildcard(require("./index"));
var Utils = _interopRequireWildcard(_index);
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
var cloneCarouselItems = exports.cloneCarouselItems = function cloneCarouselItems() {
var cloneCarouselItems = function cloneCarouselItems() {
var children = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
var itemsInSlide = arguments[1];
var props = arguments[2];
var itemsInSlide = arguments.length > 1 ? arguments[1] : undefined;
var props = arguments.length > 2 ? arguments[2] : undefined;
var items = itemsInSlide || 1;

@@ -43,3 +44,5 @@

var firstElement = children.slice(0, 1);
var _clonesBefore = lastElement.concat(children);
var _clonesAfter = children.concat(firstElement);

@@ -54,11 +57,12 @@

var clonesBefore = children.slice(children.length - items);
return [].concat(clonesBefore, children, clonesAfter);
};
var getSlides = exports.getSlides = function getSlides(props) {
exports.cloneCarouselItems = cloneCarouselItems;
var getSlides = function getSlides(props) {
var _ref3 = props || {},
children = _ref3.children,
_ref3$items = _ref3.items,
items = _ref3$items === undefined ? [] : _ref3$items;
items = _ref3$items === void 0 ? [] : _ref3$items;

@@ -68,3 +72,5 @@ return children && children.length ? children : items;

var itemInfo = exports.itemInfo = function itemInfo(props) {
exports.getSlides = getSlides;
var itemInfo = function itemInfo(props) {
var _ref4 = props || {},

@@ -75,22 +81,30 @@ items = _ref4.items,

_ref4$slides = _ref4.slides,
slides = _ref4$slides === undefined ? [] : _ref4$slides;
slides = _ref4$slides === void 0 ? [] : _ref4$slides;
var isPrevSlideDisabled = infinite === false && currentIndex === 0;
var isNextSlideDisabled = infinite === false && slides.length - items === currentIndex;
return { isPrevSlideDisabled: isPrevSlideDisabled, isNextSlideDisabled: isNextSlideDisabled };
return {
isPrevSlideDisabled: isPrevSlideDisabled,
isNextSlideDisabled: isNextSlideDisabled
};
};
var getStagePadding = exports.getStagePadding = function getStagePadding(props) {
exports.itemInfo = itemInfo;
var getStagePadding = function getStagePadding(props) {
var _ref5 = props || {},
_ref5$stagePadding = _ref5.stagePadding,
stagePadding = _ref5$stagePadding === undefined ? {} : _ref5$stagePadding;
stagePadding = _ref5$stagePadding === void 0 ? {} : _ref5$stagePadding;
var paddingLeft = Math.abs(stagePadding.paddingLeft) || 0;
var paddingRight = Math.abs(stagePadding.paddingRight) || 0;
return { paddingLeft: paddingLeft, paddingRight: paddingRight };
return {
paddingLeft: paddingLeft,
paddingRight: paddingRight
};
};
var isStagePadding = exports.isStagePadding = function isStagePadding() {
exports.getStagePadding = getStagePadding;
var isStagePadding = function isStagePadding() {
var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};

@@ -105,6 +119,7 @@

var getItemWidth = exports.getItemWidth = function getItemWidth() {
exports.isStagePadding = isStagePadding;
var getItemWidth = function getItemWidth() {
var galleryWidth = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
var totalItems = arguments[1];
var totalItems = arguments.length > 1 ? arguments[1] : undefined;
var width = Number(galleryWidth);

@@ -115,3 +130,5 @@ var items = Number(totalItems);

var getNextItem = exports.getNextItem = function getNextItem(stageComponent, itemIndex) {
exports.getItemWidth = getItemWidth;
var getNextItem = function getNextItem(stageComponent, itemIndex) {
var children = stageComponent && stageComponent.children || [];

@@ -121,5 +138,6 @@ return children[itemIndex] && children[itemIndex].firstChild || null;

var getGalleryItemHeight = exports.getGalleryItemHeight = function getGalleryItemHeight(stageComponent, props, state) {
exports.getNextItem = getNextItem;
var getGalleryItemHeight = function getGalleryItemHeight(stageComponent, props, state) {
var currentIndex = state.currentIndex;
var slidesOffset = Utils.calculateSlidesOffset(props, state);

@@ -133,3 +151,2 @@ var itemIndex = Utils.getIndexForItemHeightCalculation(currentIndex, slidesOffset);

var marginBottom = parseFloat(styles['marginBottom']);
return Math.ceil(element.offsetHeight + marginTop + marginBottom);

@@ -139,6 +156,7 @@ }

var getSlideInfo = exports.getSlideInfo = function getSlideInfo() {
exports.getGalleryItemHeight = getGalleryItemHeight;
var getSlideInfo = function getSlideInfo() {
var currentIndex = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
var slidesLength = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
var slideIndex = currentIndex + 1;

@@ -152,6 +170,11 @@

return { slideIndex: slideIndex, slidesLength: slidesLength };
return {
slideIndex: slideIndex,
slidesLength: slidesLength
};
};
var isElement = exports.isElement = function isElement(element) {
exports.getSlideInfo = getSlideInfo;
var isElement = function isElement(element) {
try {

@@ -164,17 +187,18 @@ return element instanceof Element || element instanceof HTMLDocument;

var getNextItemIndexBeforeTouchEnd = exports.getNextItemIndexBeforeTouchEnd = function getNextItemIndexBeforeTouchEnd(currentTranslateXPosition) {
exports.isElement = isElement;
var getNextItemIndexBeforeTouchEnd = function getNextItemIndexBeforeTouchEnd(currentTranslateXPosition) {
var props = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
var infinite = props.infinite,
_props$items = props.items,
items = _props$items === undefined ? 1 : _props$items,
items = _props$items === void 0 ? 1 : _props$items,
_props$itemWidth = props.itemWidth,
itemWidth = _props$itemWidth === undefined ? 0 : _props$itemWidth,
itemWidth = _props$itemWidth === void 0 ? 0 : _props$itemWidth,
_props$slides = props.slides,
slides = _props$slides === undefined ? [] : _props$slides,
slides = _props$slides === void 0 ? [] : _props$slides,
_props$stagePadding = props.stagePadding,
stagePadding = _props$stagePadding === undefined ? {} : _props$stagePadding;
stagePadding = _props$stagePadding === void 0 ? {} : _props$stagePadding;
var paddingLeft = stagePadding.paddingLeft,
paddingRight = stagePadding.paddingRight;
if (itemWidth <= 0 || items > slides.length) {

@@ -201,8 +225,11 @@ return 0;

var getCurrentIndex = exports.getCurrentIndex = function getCurrentIndex(currentTranslateXPosition, itemWidth, items) {
exports.getNextItemIndexBeforeTouchEnd = getNextItemIndexBeforeTouchEnd;
var getCurrentIndex = function getCurrentIndex(currentTranslateXPosition, itemWidth, items) {
var value = Math.abs(currentTranslateXPosition / itemWidth);
return Math.floor(value) - items;
};
exports.getCurrentIndex = getCurrentIndex;
function getElementDimensions(element) {

@@ -214,4 +241,8 @@ if (element && element.getBoundingClientRect) {

return { width: width, height: height };
return {
width: width,
height: height
};
}
return {};

@@ -223,3 +254,2 @@ }

var currentDimensions = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
return prevDimensions.width !== currentDimensions.width;

@@ -226,0 +256,0 @@ }

@@ -1,2 +0,2 @@

'use strict';
"use strict";

@@ -7,3 +7,3 @@ Object.defineProperty(exports, "__esModule", {

var _animation = require('./animation');
var _animation = require("./animation");

@@ -20,3 +20,3 @@ Object.keys(_animation).forEach(function (key) {

var _common = require('./common');
var _common = require("./common");

@@ -33,3 +33,3 @@ Object.keys(_common).forEach(function (key) {

var _debug = require('./debug');
var _debug = require("./debug");

@@ -46,3 +46,3 @@ Object.keys(_debug).forEach(function (key) {

var _elements = require('./elements');
var _elements = require("./elements");

@@ -59,3 +59,3 @@ Object.keys(_elements).forEach(function (key) {

var _swipe = require('./swipe');
var _swipe = require("./swipe");

@@ -72,3 +72,3 @@ Object.keys(_swipe).forEach(function (key) {

var _timers = require('./timers');
var _timers = require("./timers");

@@ -85,3 +85,3 @@ Object.keys(_timers).forEach(function (key) {

var _math = require('./math');
var _math = require("./math");

@@ -98,3 +98,3 @@ Object.keys(_math).forEach(function (key) {

var _style = require('./style');
var _style = require("./style");

@@ -111,3 +111,3 @@ Object.keys(_style).forEach(function (key) {

var _classnames = require('./classnames');
var _classnames = require("./classnames");

@@ -114,0 +114,0 @@ Object.keys(_classnames).forEach(function (key) {

@@ -1,15 +0,17 @@

'use strict';
"use strict";
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); }
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.getIndexForItemHeightCalculation = exports.calculateSlidesOffset = exports.recalculateTranslatePosition = exports.recalculateCurrentSlideIndex = exports.isTheLastDotIndex = exports.getItemIndexForDotNavigation = exports.getDotsNavigationLength = exports.getMaxSwipeLimitIfNotInfinite = exports.shouldRecalculateSwipePosition = exports.getMinSwipeLimitIfNotInfinite = exports.getSlideOffset = exports.getMaxSwipeLimit = exports.getMinSwipeLimit = exports.getMinSwipePosition = exports.getMaxSwipePosition = exports.recalculateCurrentIndexOnBeforeTouchEnd = exports.recalculatePositionOnBeforeTouchEnd = exports.getFadeOutOffsetOnClick = exports.getFadeOutIndexOnClick = exports.getFadeOutOffsetOnDotClick = exports.setStartIndex = exports.getSlideIndexForMultipleItems = exports.getSlideIndexForNotMultipleItems = exports.getActiveSlideIndex = exports.getDotsLength = undefined;
exports.getIndexForItemHeightCalculation = exports.calculateSlidesOffset = exports.recalculateTranslatePosition = exports.recalculateCurrentSlideIndex = exports.isTheLastDotIndex = exports.getItemIndexForDotNavigation = exports.getDotsNavigationLength = exports.getMaxSwipeLimitIfNotInfinite = exports.shouldRecalculateSwipePosition = exports.getMinSwipeLimitIfNotInfinite = exports.getSlideOffset = exports.getMaxSwipeLimit = exports.getMinSwipeLimit = exports.getMinSwipePosition = exports.getMaxSwipePosition = exports.recalculateCurrentIndexOnBeforeTouchEnd = exports.recalculatePositionOnBeforeTouchEnd = exports.getFadeOutOffsetOnClick = exports.getFadeOutIndexOnClick = exports.getFadeOutOffsetOnDotClick = exports.setStartIndex = exports.getSlideIndexForMultipleItems = exports.getSlideIndexForNotMultipleItems = exports.getActiveSlideIndex = exports.getDotsLength = void 0;
var _index = require('./index');
var Utils = _interopRequireWildcard(require("./index"));
var Utils = _interopRequireWildcard(_index);
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
var getDotsLength = exports.getDotsLength = function getDotsLength(slidesLength, items) {
var getDotsLength = function getDotsLength(slidesLength, items) {
if (slidesLength && items) {

@@ -19,6 +21,9 @@ var dots = Math.floor(slidesLength / items);

}
return 0;
};
var getActiveSlideIndex = exports.getActiveSlideIndex = function getActiveSlideIndex(isNextSlideDisabled) {
exports.getDotsLength = getDotsLength;
var getActiveSlideIndex = function getActiveSlideIndex(isNextSlideDisabled) {
var props = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};

@@ -28,11 +33,11 @@ var index = props.currentIndex,

_props$slides = props.slides,
slides = _props$slides === undefined ? [] : _props$slides;
slides = _props$slides === void 0 ? [] : _props$slides;
var currentIndex = index + items;
var slidesLength = slides.length;
return items === 1 ? getSlideIndexForNotMultipleItems(currentIndex, items, slidesLength) : getSlideIndexForMultipleItems(currentIndex, items, slidesLength, isNextSlideDisabled);
};
var getSlideIndexForNotMultipleItems = exports.getSlideIndexForNotMultipleItems = function getSlideIndexForNotMultipleItems(currentIndex, items, slidesLength) {
exports.getActiveSlideIndex = getActiveSlideIndex;
var getSlideIndexForNotMultipleItems = function getSlideIndexForNotMultipleItems(currentIndex, items, slidesLength) {
if (currentIndex < items) return slidesLength - items;

@@ -43,7 +48,9 @@ if (currentIndex > slidesLength) return 0;

var getSlideIndexForMultipleItems = exports.getSlideIndexForMultipleItems = function getSlideIndexForMultipleItems(currentIndex, items, slidesLength, isNextSlideDisabled) {
exports.getSlideIndexForNotMultipleItems = getSlideIndexForNotMultipleItems;
var getSlideIndexForMultipleItems = function getSlideIndexForMultipleItems(currentIndex, items, slidesLength, isNextSlideDisabled) {
var dotsLength = getDotsLength(slidesLength, items);
if (currentIndex === slidesLength + items) return 0;
if (isNextSlideDisabled || currentIndex < items && currentIndex !== 0) return dotsLength;
if (currentIndex === 0) {

@@ -56,3 +63,5 @@ return slidesLength % items === 0 ? dotsLength : dotsLength - 1;

var setStartIndex = exports.setStartIndex = function setStartIndex(childrenLength, index) {
exports.getSlideIndexForMultipleItems = getSlideIndexForMultipleItems;
var setStartIndex = function setStartIndex(childrenLength, index) {
var startIndex = index ? Math.abs(Math.ceil(index)) : 0;

@@ -62,3 +71,5 @@ return Math.min(startIndex, childrenLength - 1) || 0;

var getFadeOutOffsetOnDotClick = exports.getFadeOutOffsetOnDotClick = function getFadeOutOffsetOnDotClick(itemIndex, currentIndex, itemWidth) {
exports.setStartIndex = setStartIndex;
var getFadeOutOffsetOnDotClick = function getFadeOutOffsetOnDotClick(itemIndex, currentIndex, itemWidth) {
if (itemIndex < currentIndex) {

@@ -71,36 +82,51 @@ return (currentIndex - itemIndex) * -itemWidth || 0;

var getFadeOutIndexOnClick = exports.getFadeOutIndexOnClick = function getFadeOutIndexOnClick(currentIndex) {
exports.getFadeOutOffsetOnDotClick = getFadeOutOffsetOnDotClick;
var getFadeOutIndexOnClick = function getFadeOutIndexOnClick(currentIndex) {
return currentIndex === 0 ? 1 : currentIndex + 1;
};
var getFadeOutOffsetOnClick = exports.getFadeOutOffsetOnClick = function getFadeOutOffsetOnClick(direction, itemWidth) {
exports.getFadeOutIndexOnClick = getFadeOutIndexOnClick;
var getFadeOutOffsetOnClick = function getFadeOutOffsetOnClick(direction, itemWidth) {
return direction === 'next' ? itemWidth : -itemWidth;
};
var recalculatePositionOnBeforeTouchEnd = exports.recalculatePositionOnBeforeTouchEnd = function recalculatePositionOnBeforeTouchEnd(items, itemWidth) {
exports.getFadeOutOffsetOnClick = getFadeOutOffsetOnClick;
var recalculatePositionOnBeforeTouchEnd = function recalculatePositionOnBeforeTouchEnd(items, itemWidth) {
return -getMinSwipePosition(items, itemWidth);
};
var recalculateCurrentIndexOnBeforeTouchEnd = exports.recalculateCurrentIndexOnBeforeTouchEnd = function recalculateCurrentIndexOnBeforeTouchEnd(slidesLength, items) {
exports.recalculatePositionOnBeforeTouchEnd = recalculatePositionOnBeforeTouchEnd;
var recalculateCurrentIndexOnBeforeTouchEnd = function recalculateCurrentIndexOnBeforeTouchEnd(slidesLength, items) {
return slidesLength - items || 0;
};
var getMaxSwipePosition = exports.getMaxSwipePosition = function getMaxSwipePosition(items, itemWidth, slidesLength) {
exports.recalculateCurrentIndexOnBeforeTouchEnd = recalculateCurrentIndexOnBeforeTouchEnd;
var getMaxSwipePosition = function getMaxSwipePosition(items, itemWidth, slidesLength) {
return (slidesLength + items) * itemWidth || 0;
};
var getMinSwipePosition = exports.getMinSwipePosition = function getMinSwipePosition(items, itemWidth) {
exports.getMaxSwipePosition = getMaxSwipePosition;
var getMinSwipePosition = function getMinSwipePosition(items, itemWidth) {
return items * itemWidth || 0;
};
var getMinSwipeLimit = exports.getMinSwipeLimit = function getMinSwipeLimit() {
exports.getMinSwipePosition = getMinSwipePosition;
var getMinSwipeLimit = function getMinSwipeLimit() {
var minSwipePosition = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
var stagePadding = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
var _stagePadding$padding = stagePadding.paddingLeft,
paddingLeft = _stagePadding$padding === undefined ? 0 : _stagePadding$padding;
paddingLeft = _stagePadding$padding === void 0 ? 0 : _stagePadding$padding;
return paddingLeft ? minSwipePosition : 0;
};
var getMaxSwipeLimit = exports.getMaxSwipeLimit = function getMaxSwipeLimit() {
exports.getMinSwipeLimit = getMinSwipeLimit;
var getMaxSwipeLimit = function getMaxSwipeLimit() {
var maxSwipePosition = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;

@@ -110,33 +136,44 @@ var stagePadding = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};

var _stagePadding$padding2 = stagePadding.paddingRight,
paddingRight = _stagePadding$padding2 === undefined ? 0 : _stagePadding$padding2;
paddingRight = _stagePadding$padding2 === void 0 ? 0 : _stagePadding$padding2;
return paddingRight ? maxSwipePosition + itemWidth : maxSwipePosition;
};
var getSlideOffset = exports.getSlideOffset = function getSlideOffset(itemWidth) {
exports.getMaxSwipeLimit = getMaxSwipeLimit;
var getSlideOffset = function getSlideOffset(itemWidth) {
var offset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 250;
return Math.min(itemWidth / 2, offset) || 0;
};
var getMinSwipeLimitIfNotInfinite = exports.getMinSwipeLimitIfNotInfinite = function getMinSwipeLimitIfNotInfinite(items, itemWidth) {
exports.getSlideOffset = getSlideOffset;
var getMinSwipeLimitIfNotInfinite = function getMinSwipeLimitIfNotInfinite(items, itemWidth) {
return items * itemWidth - getSlideOffset(itemWidth) || 0;
};
var shouldRecalculateSwipePosition = exports.shouldRecalculateSwipePosition = function shouldRecalculateSwipePosition(currentPosition, minPosition, maxPosition) {
exports.getMinSwipeLimitIfNotInfinite = getMinSwipeLimitIfNotInfinite;
var shouldRecalculateSwipePosition = function shouldRecalculateSwipePosition(currentPosition, minPosition, maxPosition) {
return currentPosition >= 0 - minPosition || Math.abs(currentPosition) >= maxPosition;
};
var getMaxSwipeLimitIfNotInfinite = exports.getMaxSwipeLimitIfNotInfinite = function getMaxSwipeLimitIfNotInfinite(slidesLength, itemWidth) {
exports.shouldRecalculateSwipePosition = shouldRecalculateSwipePosition;
var getMaxSwipeLimitIfNotInfinite = function getMaxSwipeLimitIfNotInfinite(slidesLength, itemWidth) {
return slidesLength * itemWidth + getSlideOffset(itemWidth) || 0;
};
var getDotsNavigationLength = exports.getDotsNavigationLength = function getDotsNavigationLength(slidesLength, items) {
exports.getMaxSwipeLimitIfNotInfinite = getMaxSwipeLimitIfNotInfinite;
var getDotsNavigationLength = function getDotsNavigationLength(slidesLength, items) {
if (Number(items) !== 0) {
return Math.ceil(slidesLength / items) || 0;
}
return 0;
};
var getItemIndexForDotNavigation = exports.getItemIndexForDotNavigation = function getItemIndexForDotNavigation(index, isTheLastIndex, slidesLength, itemsLength) {
exports.getDotsNavigationLength = getDotsNavigationLength;
var getItemIndexForDotNavigation = function getItemIndexForDotNavigation(index, isTheLastIndex, slidesLength, itemsLength) {
var result = isTheLastIndex ? slidesLength - itemsLength : index * itemsLength;

@@ -146,16 +183,21 @@ return result || 0;

var isTheLastDotIndex = exports.isTheLastDotIndex = function isTheLastDotIndex(index, infinite, dotsLength) {
exports.getItemIndexForDotNavigation = getItemIndexForDotNavigation;
var isTheLastDotIndex = function isTheLastDotIndex(index, infinite, dotsLength) {
return infinite === false && index === dotsLength - 1;
};
var recalculateCurrentSlideIndex = exports.recalculateCurrentSlideIndex = function recalculateCurrentSlideIndex() {
exports.isTheLastDotIndex = isTheLastDotIndex;
var recalculateCurrentSlideIndex = function recalculateCurrentSlideIndex() {
var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
var currentIndex = state.currentIndex,
_state$slides = state.slides,
slides = _state$slides === undefined ? [] : _state$slides;
slides = _state$slides === void 0 ? [] : _state$slides;
return currentIndex < 0 ? slides.length - 1 : 0;
};
var recalculateTranslatePosition = exports.recalculateTranslatePosition = function recalculateTranslatePosition() {
exports.recalculateCurrentSlideIndex = recalculateCurrentSlideIndex;
var recalculateTranslatePosition = function recalculateTranslatePosition() {
var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};

@@ -165,8 +207,6 @@ var items = state.items,

_state$stagePadding = state.stagePadding,
stagePadding = _state$stagePadding === undefined ? {} : _state$stagePadding,
stagePadding = _state$stagePadding === void 0 ? {} : _state$stagePadding,
_state$slides2 = state.slides,
slides = _state$slides2 === undefined ? [] : _state$slides2;
slides = _state$slides2 === void 0 ? [] : _state$slides2;
var maxSlidePosition = slides.length - 1;
var currentIndex = state.currentIndex < 0 ? maxSlidePosition : 0;

@@ -178,9 +218,11 @@ var nextIndex = currentIndex === 0 ? items : maxSlidePosition + items;

}
return nextIndex * -itemWidth || 0;
};
var calculateSlidesOffset = exports.calculateSlidesOffset = function calculateSlidesOffset(props, state) {
exports.recalculateTranslatePosition = recalculateTranslatePosition;
var calculateSlidesOffset = function calculateSlidesOffset(props, state) {
var items = state.items,
infinite = state.infinite;
var offset = infinite && Utils.isStagePadding(props) ? 1 : 0;

@@ -190,4 +232,8 @@ return items + offset;

var getIndexForItemHeightCalculation = exports.getIndexForItemHeightCalculation = function getIndexForItemHeightCalculation(currentIndex, slidesOffset) {
exports.calculateSlidesOffset = calculateSlidesOffset;
var getIndexForItemHeightCalculation = function getIndexForItemHeightCalculation(currentIndex, slidesOffset) {
return currentIndex + slidesOffset;
};
};
exports.getIndexForItemHeightCalculation = getIndexForItemHeightCalculation;

@@ -1,48 +0,83 @@

'use strict';
"use strict";
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); }
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.getWrapperStyles = exports.getStageStyles = exports.getDefaultStyles = exports.itemStyles = exports.getIntermediateTransitionProps = undefined;
exports.getWrapperStyles = exports.getStageStyles = exports.getDefaultStyles = exports.itemStyles = exports.getIntermediateTransitionProps = void 0;
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
var Utils = _interopRequireWildcard(require("./index"));
var _index = require('./index');
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
var Utils = _interopRequireWildcard(_index);
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
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; }
var getIntermediateTransitionProps = exports.getIntermediateTransitionProps = function getIntermediateTransitionProps(condition, duration) {
return condition ? { fadeoutAnimationProcessing: true, style: { transition: 'transform 0ms ease-out' } } : { style: { transition: 'transform ' + duration + 'ms ease-out' } };
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 getIntermediateTransitionProps = function getIntermediateTransitionProps(condition, duration) {
var transitionTimingFunction = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
return condition ? {
fadeoutAnimationProcessing: true,
style: {
transition: 'transform 0ms'
}
} : {
style: {
transition: "transform ".concat(duration, "ms ").concat(transitionTimingFunction)
}
};
};
var itemStyles = exports.itemStyles = function itemStyles(i, state, animationProps) {
exports.getIntermediateTransitionProps = getIntermediateTransitionProps;
var itemStyles = function itemStyles(i, state, animationProps) {
var fadeOutOffset = animationProps.fadeOutOffset;
var itemWidth = state.itemWidth,
duration = state.duration;
return Utils.isAnimatedItem(i, animationProps) ? {
transform: "translateX(".concat(fadeOutOffset, "px)"),
animationDuration: "".concat(duration, "ms"),
width: "".concat(itemWidth, "px")
} : {
width: "".concat(itemWidth, "px")
};
};
exports.itemStyles = itemStyles;
return Utils.isAnimatedItem(i, animationProps) ? { transform: 'translateX(' + fadeOutOffset + 'px)', animationDuration: duration + 'ms', width: itemWidth + 'px' } : { width: itemWidth + 'px' };
var getDefaultStyles = function getDefaultStyles(options) {
var _ref = options || {},
_ref$duration = _ref.duration,
duration = _ref$duration === void 0 ? 0 : _ref$duration,
_ref$transitionTiming = _ref.transitionTimingFunction,
transitionTimingFunction = _ref$transitionTiming === void 0 ? '' : _ref$transitionTiming;
return {
transition: "transform ".concat(duration, "ms ").concat(transitionTimingFunction)
};
};
var getDefaultStyles = exports.getDefaultStyles = function getDefaultStyles() {
var duration = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
exports.getDefaultStyles = getDefaultStyles;
return { transition: 'transform ' + duration + 'ms ease-out' };
};
var getStageStyles = exports.getStageStyles = function getStageStyles() {
var getStageStyles = function getStageStyles() {
var nextStyles = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
var currentStyles = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
var _nextStyles$translate = nextStyles.translate3d,
translate3d = _nextStyles$translate === undefined ? 0 : _nextStyles$translate,
translate3d = _nextStyles$translate === void 0 ? 0 : _nextStyles$translate,
height = nextStyles.height;
var transform = "translate3d(".concat(translate3d, "px, 0, 0)");
return _objectSpread({}, currentStyles, {
transform: transform,
height: height
});
};
var transform = 'translate3d(' + translate3d + 'px, 0, 0)';
exports.getStageStyles = getStageStyles;
return _extends({}, currentStyles, { transform: transform, height: height });
};
var getWrapperStyles = exports.getWrapperStyles = function getWrapperStyles(element) {
var getWrapperStyles = function getWrapperStyles(element) {
var props = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};

@@ -56,10 +91,11 @@ var state = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};

var height = props.autoHeight && Utils.getGalleryItemHeight(element, props, state);
var transition = height && 'height ' + state.duration + 'ms ease-out';
var transition = height && "height ".concat(state.duration, "ms");
return {
height: height,
transition: transition,
paddingLeft: paddingLeft + 'px',
paddingRight: paddingRight + 'px'
paddingLeft: "".concat(paddingLeft, "px"),
paddingRight: "".concat(paddingRight, "px")
};
};
};
exports.getWrapperStyles = getWrapperStyles;

@@ -1,2 +0,2 @@

'use strict';
"use strict";

@@ -6,11 +6,12 @@ Object.defineProperty(exports, "__esModule", {

});
var isVerticalTouchMoveDetected = exports.isVerticalTouchMoveDetected = function isVerticalTouchMoveDetected(e, deltaX, deltaY) {
var gap = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 32;
exports.getSwipePositionOnBeforeTouchEnd = exports.getSwipeIndexOnBeforeTouchEnd = exports.getSwipeIndex = exports.getSwipeOffset = exports.getSwipeDirection = exports.calculateSwipeIndex = exports.isVerticalTouchMoveDetected = void 0;
var vertical = Math.abs(deltaY);
var horizontal = Math.abs(deltaX);
return vertical > horizontal && horizontal < gap;
var isVerticalTouchMoveDetected = function isVerticalTouchMoveDetected(e, deltaX, deltaY) {
var gap = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 20;
return deltaY > deltaX && deltaX < gap;
};
var calculateSwipeIndex = exports.calculateSwipeIndex = function calculateSwipeIndex(itemWidth, position, direction) {
exports.isVerticalTouchMoveDetected = isVerticalTouchMoveDetected;
var calculateSwipeIndex = function calculateSwipeIndex(itemWidth, position, direction) {
var index = getSwipeIndex(position, itemWidth);

@@ -21,11 +22,20 @@ var offset = getSwipeOffset(direction);

var getSwipeDirection = exports.getSwipeDirection = function getSwipeDirection(deltaX) {
return deltaX > 0 ? 'LEFT' : 'RIGHT';
exports.calculateSwipeIndex = calculateSwipeIndex;
var getSwipeDirection = function getSwipeDirection() {
var prevDeltaX = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
var deltaX = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
var vector = Math.round((prevDeltaX - deltaX) * 100);
return vector < 0 ? 'LEFT' : 'RIGHT';
};
var getSwipeOffset = exports.getSwipeOffset = function getSwipeOffset(direction) {
exports.getSwipeDirection = getSwipeDirection;
var getSwipeOffset = function getSwipeOffset(direction) {
return direction === 'LEFT' ? 1 : 0;
};
var getSwipeIndex = exports.getSwipeIndex = function getSwipeIndex(position, itemWidth) {
exports.getSwipeOffset = getSwipeOffset;
var getSwipeIndex = function getSwipeIndex(position, itemWidth) {
var swipePosition = Math.abs(position);

@@ -35,8 +45,14 @@ return Math.floor(swipePosition / itemWidth);

var getSwipeIndexOnBeforeTouchEnd = exports.getSwipeIndexOnBeforeTouchEnd = function getSwipeIndexOnBeforeTouchEnd(swipeIndex, items) {
exports.getSwipeIndex = getSwipeIndex;
var getSwipeIndexOnBeforeTouchEnd = function getSwipeIndexOnBeforeTouchEnd(swipeIndex, items) {
return swipeIndex - items || 0;
};
var getSwipePositionOnBeforeTouchEnd = exports.getSwipePositionOnBeforeTouchEnd = function getSwipePositionOnBeforeTouchEnd(swipeIndex, itemWidth) {
exports.getSwipeIndexOnBeforeTouchEnd = getSwipeIndexOnBeforeTouchEnd;
var getSwipePositionOnBeforeTouchEnd = function getSwipePositionOnBeforeTouchEnd(swipeIndex, itemWidth) {
return swipeIndex * -itemWidth || 0;
};
};
exports.getSwipePositionOnBeforeTouchEnd = getSwipePositionOnBeforeTouchEnd;

@@ -8,11 +8,10 @@ "use strict";

exports.throttle = throttle;
function debounce(func) {
var ms = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
var timer = null;
return function () {
var _this = this;
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];

@@ -33,6 +32,3 @@ }

function throttle(func, ms) {
var isThrottled = void 0,
savedArgs = void 0,
savedThis = void 0;
var isThrottled, savedArgs, savedThis;
return function () {

@@ -47,5 +43,5 @@ if (isThrottled) {

isThrottled = true;
setTimeout(function () {
isThrottled = false;
if (savedArgs) {

@@ -52,0 +48,0 @@ func.apply(savedThis, savedArgs);

@@ -1,25 +0,23 @@

'use strict';
"use strict";
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); }
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.DotsNavigation = undefined;
exports.DotsNavigation = void 0;
var _react = require('react');
var _react = _interopRequireDefault(require("react"));
var _react2 = _interopRequireDefault(_react);
var _propTypes = _interopRequireDefault(require("prop-types"));
var _propTypes = require('prop-types');
var Utils = _interopRequireWildcard(require("../utils"));
var _propTypes2 = _interopRequireDefault(_propTypes);
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
var _utils = require('../utils');
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
var Utils = _interopRequireWildcard(_utils);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var DotsNavigation = exports.DotsNavigation = function DotsNavigation(_ref) {
var DotsNavigation = function DotsNavigation(_ref) {
var state = _ref.state,

@@ -37,32 +35,29 @@ _onClick = _ref.onClick,

var dotsLength = Utils.getDotsNavigationLength(slides.length, items);
return _react2.default.createElement(
'ul',
{ className: 'alice-carousel__dots' },
slides.map(function (item, i) {
if (i < dotsLength) {
var isTheLastDotIndex = Utils.isTheLastDotIndex(i, infinite, dotsLength);
var itemIndex = Utils.getItemIndexForDotNavigation(i, isTheLastDotIndex, slides.length, items);
var activeIndex = Utils.getActiveSlideIndex(isNextSlideDisabled, state);
var className = activeIndex === i ? ' __active' : '';
return _react2.default.createElement('li', {
key: 'dot-item-' + i,
onClick: function onClick() {
return _onClick(itemIndex);
},
onMouseEnter: onMouseEnter,
onMouseLeave: onMouseLeave,
className: 'alice-carousel__dots-item' + className
});
}
})
);
return _react["default"].createElement("ul", {
className: "alice-carousel__dots"
}, slides.map(function (item, i) {
if (i < dotsLength) {
var isTheLastDotIndex = Utils.isTheLastDotIndex(i, infinite, dotsLength);
var itemIndex = Utils.getItemIndexForDotNavigation(i, isTheLastDotIndex, slides.length, items);
var activeIndex = Utils.getActiveSlideIndex(isNextSlideDisabled, state);
var className = activeIndex === i ? ' __active' : '';
return _react["default"].createElement("li", {
key: "dot-item-".concat(i),
onClick: function onClick() {
return _onClick(itemIndex);
},
onMouseEnter: onMouseEnter,
onMouseLeave: onMouseLeave,
className: "alice-carousel__dots-item".concat(className)
});
}
}));
};
exports.DotsNavigation = DotsNavigation;
DotsNavigation.propTypes = {
state: _propTypes2.default.object.isRequired,
onClick: _propTypes2.default.func.isRequired,
onMouseEnter: _propTypes2.default.func.isRequired,
onMouseLeave: _propTypes2.default.func.isRequired
state: _propTypes["default"].object.isRequired,
onClick: _propTypes["default"].func.isRequired,
onMouseEnter: _propTypes["default"].func.isRequired,
onMouseLeave: _propTypes["default"].func.isRequired
};

@@ -1,2 +0,2 @@

'use strict';
"use strict";

@@ -7,3 +7,3 @@ Object.defineProperty(exports, "__esModule", {

var _SlideInfo = require('./SlideInfo');
var _SlideInfo = require("./SlideInfo");

@@ -20,3 +20,3 @@ Object.keys(_SlideInfo).forEach(function (key) {

var _StageItem = require('./StageItem');
var _StageItem = require("./StageItem");

@@ -33,3 +33,3 @@ Object.keys(_StageItem).forEach(function (key) {

var _DotsNavigation = require('./DotsNavigation');
var _DotsNavigation = require("./DotsNavigation");

@@ -46,3 +46,3 @@ Object.keys(_DotsNavigation).forEach(function (key) {

var _PlayPauseButton = require('./PlayPauseButton');
var _PlayPauseButton = require("./PlayPauseButton");

@@ -59,3 +59,3 @@ Object.keys(_PlayPauseButton).forEach(function (key) {

var _PrevNextButton = require('./PrevNextButton');
var _PrevNextButton = require("./PrevNextButton");

@@ -62,0 +62,0 @@ Object.keys(_PrevNextButton).forEach(function (key) {

@@ -1,2 +0,2 @@

'use strict';
"use strict";

@@ -6,32 +6,27 @@ Object.defineProperty(exports, "__esModule", {

});
exports.PlayPauseButton = undefined;
exports.PlayPauseButton = void 0;
var _react = require('react');
var _react = _interopRequireDefault(require("react"));
var _react2 = _interopRequireDefault(_react);
var _propTypes = _interopRequireDefault(require("prop-types"));
var _propTypes = require('prop-types');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
var _propTypes2 = _interopRequireDefault(_propTypes);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var PlayPauseButton = exports.PlayPauseButton = function PlayPauseButton(_ref) {
var PlayPauseButton = function PlayPauseButton(_ref) {
var isPlaying = _ref.isPlaying,
onClick = _ref.onClick;
return _react2.default.createElement(
'div',
{ className: 'alice-carousel__play-btn' },
_react2.default.createElement(
'div',
{ className: 'alice-carousel__play-btn-wrapper' },
_react2.default.createElement('div', { onClick: onClick, className: 'alice-carousel__play-btn-item' + (isPlaying ? ' __pause' : '') })
)
);
return _react["default"].createElement("div", {
className: "alice-carousel__play-btn"
}, _react["default"].createElement("div", {
className: "alice-carousel__play-btn-wrapper"
}, _react["default"].createElement("div", {
onClick: onClick,
className: "alice-carousel__play-btn-item".concat(isPlaying ? ' __pause' : '')
})));
};
exports.PlayPauseButton = PlayPauseButton;
PlayPauseButton.propTypes = {
isPlaying: _propTypes2.default.bool,
onClick: _propTypes2.default.func
isPlaying: _propTypes["default"].bool,
onClick: _propTypes["default"].func
};

@@ -1,2 +0,2 @@

'use strict';
"use strict";

@@ -6,15 +6,11 @@ Object.defineProperty(exports, "__esModule", {

});
exports.PrevNextButton = undefined;
exports.PrevNextButton = void 0;
var _react = require('react');
var _react = _interopRequireDefault(require("react"));
var _react2 = _interopRequireDefault(_react);
var _propTypes = _interopRequireDefault(require("prop-types"));
var _propTypes = require('prop-types');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
var _propTypes2 = _interopRequireDefault(_propTypes);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var PrevNextButton = exports.PrevNextButton = function PrevNextButton(_ref) {
var PrevNextButton = function PrevNextButton(_ref) {
var name = _ref.name,

@@ -25,26 +21,24 @@ disabled = _ref.disabled,

onMouseLeave = _ref.onMouseLeave;
var className = 'alice-carousel__' + name + '-btn-item' + (disabled ? ' __inactive' : '');
return _react2.default.createElement(
'div',
{ className: 'alice-carousel__' + name + '-btn' },
_react2.default.createElement(
'div',
{ className: 'alice-carousel__' + name + '-btn-wrapper', onMouseEnter: onMouseEnter, onMouseLeave: onMouseLeave },
_react2.default.createElement(
'p',
{ className: className, onClick: onClick },
_react2.default.createElement('span', { 'data-area': name })
)
)
);
var className = "alice-carousel__".concat(name, "-btn-item").concat(disabled ? ' __inactive' : '');
return _react["default"].createElement("div", {
className: "alice-carousel__".concat(name, "-btn")
}, _react["default"].createElement("div", {
className: "alice-carousel__".concat(name, "-btn-wrapper"),
onMouseEnter: onMouseEnter,
onMouseLeave: onMouseLeave
}, _react["default"].createElement("p", {
className: className,
onClick: onClick
}, _react["default"].createElement("span", {
"data-area": name
}))));
};
exports.PrevNextButton = PrevNextButton;
PrevNextButton.propTypes = {
name: _propTypes2.default.oneOf(['next', 'prev']),
disabled: _propTypes2.default.bool.isRequired,
onClick: _propTypes2.default.func.isRequired,
onMouseEnter: _propTypes2.default.func.isRequired,
onMouseLeave: _propTypes2.default.func.isRequired
name: _propTypes["default"].oneOf(['next', 'prev']),
disabled: _propTypes["default"].bool.isRequired,
onClick: _propTypes["default"].func.isRequired,
onMouseEnter: _propTypes["default"].func.isRequired,
onMouseLeave: _propTypes["default"].func.isRequired
};

@@ -1,54 +0,41 @@

'use strict';
"use strict";
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); }
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.SlideInfo = undefined;
exports.SlideInfo = void 0;
var _react = require('react');
var _react = _interopRequireDefault(require("react"));
var _react2 = _interopRequireDefault(_react);
var _propTypes = _interopRequireDefault(require("prop-types"));
var _propTypes = require('prop-types');
var Utils = _interopRequireWildcard(require("../utils"));
var _propTypes2 = _interopRequireDefault(_propTypes);
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
var _utils = require('../utils');
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
var Utils = _interopRequireWildcard(_utils);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var SlideInfo = exports.SlideInfo = function SlideInfo(_ref) {
var SlideInfo = function SlideInfo(_ref) {
var currentIndex = _ref.currentIndex,
slidesLength = _ref.slidesLength;
var info = Utils.getSlideInfo(currentIndex, slidesLength);
return _react2.default.createElement(
'div',
{ className: 'alice-carousel__slide-info' },
_react2.default.createElement(
'span',
{ className: 'alice-carousel__slide-info-item' },
info.slideIndex
),
_react2.default.createElement(
'span',
{ className: 'alice-carousel__slide-info-item alice-carousel__slide-info-item--separator' },
'/'
),
_react2.default.createElement(
'span',
{ className: 'alice-carousel__slide-info-item' },
info.slidesLength
)
);
return _react["default"].createElement("div", {
className: "alice-carousel__slide-info"
}, _react["default"].createElement("span", {
className: "alice-carousel__slide-info-item"
}, info.slideIndex), _react["default"].createElement("span", {
className: "alice-carousel__slide-info-item alice-carousel__slide-info-item--separator"
}, "/"), _react["default"].createElement("span", {
className: "alice-carousel__slide-info-item"
}, info.slidesLength));
};
exports.SlideInfo = SlideInfo;
SlideInfo.propTypes = {
currentIndex: _propTypes2.default.number.isRequired,
slidesLength: _propTypes2.default.number.isRequired
currentIndex: _propTypes["default"].number.isRequired,
slidesLength: _propTypes["default"].number.isRequired
};

@@ -1,2 +0,2 @@

'use strict';
"use strict";

@@ -6,30 +6,25 @@ Object.defineProperty(exports, "__esModule", {

});
exports.StageItem = undefined;
exports.StageItem = void 0;
var _react = require('react');
var _react = _interopRequireDefault(require("react"));
var _react2 = _interopRequireDefault(_react);
var _propTypes = _interopRequireDefault(require("prop-types"));
var _propTypes = require('prop-types');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
var _propTypes2 = _interopRequireDefault(_propTypes);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var StageItem = exports.StageItem = function StageItem(_ref) {
var StageItem = function StageItem(_ref) {
var item = _ref.item,
className = _ref.className,
styles = _ref.styles;
return _react2.default.createElement(
'li',
{ style: styles, className: className },
item
);
return _react["default"].createElement("li", {
style: styles,
className: className
}, item);
};
exports.StageItem = StageItem;
StageItem.propTypes = {
item: _propTypes2.default.node,
className: _propTypes2.default.string.isRequired,
styles: _propTypes2.default.object.isRequired
item: _propTypes["default"].node,
className: _propTypes["default"].string.isRequired,
styles: _propTypes["default"].object.isRequired
};
{
"name": "react-alice-carousel",
"version": "1.17.3",
"version": "1.18.0",
"description": "React image gallery, react slideshow carousel, react content rotator",

@@ -14,3 +14,8 @@ "main": "./lib/react-alice-carousel",

"build:prod": "cross-env npm run clean && webpack --config config/webpack/webpack.lib.config.js --progress --profile --colors",
"clean": "rimraf lib dist",
"clean": "rm -rf lib dist",
"remove:nm": "find . -name 'node_modules' -type d -prune -exec rm -rf '{}' +",
"remove:dist": "npm run clean",
"remove:lock": "find . -type f \\( -name 'yarn.lock' -or -name 'package-lock.json' \\) -delete",
"remove:cache": "yarn cache clean --force; npm cache clean --force",
"clear:all-hard": "npm-run-all 'remove:*'",
"lib": "cross-env npm run clean && gulp --gulpfile config/gulp/gulpfile.js",

@@ -83,19 +88,15 @@ "lint": "eslint ./src/**/**.js",

"prop-types": "^15.5.10",
"vanilla-swipe": "^1.0.0"
"vanilla-swipe": "^1.2.0"
},
"devDependencies": {
"babel-cli": "6.26.0",
"babel-core": "6.26.0",
"@babel/core": "^7.9.0",
"@babel/preset-env": "^7.9.0",
"@babel/preset-react": "^7.9.4",
"babel-eslint": "8.2.6",
"babel-jest": "23.0.1",
"babel-loader": "7.1.4",
"babel-jest": "^25.2.3",
"babel-loader": "^8.1.0",
"babel-plugin-transform-class-properties": "^6.24.1",
"babel-plugin-transform-object-assign": "^6.22.0",
"babel-plugin-transform-object-rest-spread": "^6.26.0",
"babel-preset-env": "^1.6.1",
"babel-preset-react": "6.24.1",
"babel-preset-react-boilerplate": "1.1.1",
"babel-preset-react-hmre": "1.1.1",
"babel-preset-stage-2": "6.24.1",
"copy-webpack-plugin": "4.5.2",
"copy-webpack-plugin": "^5.1.1",
"cross-env": "5.2.0",

@@ -116,5 +117,5 @@ "css-hot-loader": "1.4.2",

"file-loader": "1.1.11",
"gulp": "^3.9.1",
"gulp": "^4.0.2",
"gulp-autoprefixer": "^3.1.1",
"gulp-babel": "^6.1.2",
"gulp-babel": "^8.0.0",
"gulp-concat": "^2.6.1",

@@ -126,21 +127,18 @@ "gulp-rename": "^1.2.2",

"husky": "0.15.0-rc.2",
"jest": "22.1.0",
"jest": "^25.1.0",
"node-sass": "^4.13.0",
"open-browser-webpack-plugin": "0.0.5",
"prettier": "^1.14.3",
"react": ">=15.4",
"react": "^16.13.1",
"react-addons-test-utils": "15.6.2",
"react-dom": ">=15.4",
"react-hot-loader": "4.3.5",
"react-dom": "^16.13.1",
"react-hot-loader": "^4.12.20",
"react-router-dom": "^4.3.1",
"react-test-renderer": "16.4.2",
"rimraf": "2.6.2",
"sass-loader": "7.1.0",
"style-loader": "0.22.1",
"uglifyjs-webpack-plugin": "^2.0.1",
"url-loader": "1.0.1",
"webpack": "4.17.0",
"webpack-cli": "3.1.0",
"webpack": "^4.42.0",
"webpack-cli": "^3.3.11",
"webpack-dev-server": "^3.1.11"
}
}

@@ -149,4 +149,8 @@ # React Alice Carousel

- `swipeDelta` : Number, default `10` - Minimum distance to the start of the swiping (px)
- `preventEventOnTouchMove` : Boolean, default `false` - Prevent the browser's touchmove event when carousel is swiping
- `transitionTimingFunction` : String, default `ease-out` - Sets how intermediate values are calculated for CSS properties being affected by a transition effect.
- `onSlideChange` : Function - Fired when the event object is changing / returns event object

@@ -153,0 +157,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc