react-leaf-carousel
Advanced tools
Comparing version 1.0.8 to 1.0.9
@@ -1,2 +0,2 @@ | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react")):"function"==typeof define&&define.amd?define(["react"],t):"object"==typeof exports?exports.InfiniteCarousel=t(require("react")):e.InfiniteCarousel=t(e.React)}(this,function(e){return function(e){function t(i){if(n[i])return n[i].exports;var o=n[i]={exports:{},id:i,loaded:!1};return e[i].call(o.exports,o,o.exports,t),o.loaded=!0,o.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function o(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var l=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),c=n(1),u=i(c),d=n(2),p=n(11),f=n(12),h=i(f),v=n(13),g=i(v),y=n(14),m=i(y),b=function(e){function t(e){r(this,t);var n=s(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n.setupBreakpointSettings=function(e){var t=e.map(function(e){return e.breakpoint}),i={};if(e.forEach(function(e){i[e.breakpoint]=e.settings}),t.length>0){t.sort(p.sortNumber),t.forEach(function(e,o){var r=void 0,s=void 0;0===o?(r=0,s=e-1):(r=t[o-1],s=e-1);var a={minWidth:r,maxWidth:s};(0,d.media)(a,function(){var t=Object.assign({},n.defaultProps,n.props,i[e],a),o=n.props.scrollOnDevice&&(0,p.isTouchDevice)(),a=o?n.state.scrollOnDeviceProps:{},l=n.getChildrenList(n.props.children,t.slidesToShow);n.setState({settings:t,children:l,lowerBreakpoint:r,higherBreakpoint:s},n.setDimensions)})}),t.reverse();var o={minWidth:t[0]};(0,d.media)(o,function(){var e=Object.assign({},n.defaultProps,n.props,i),t=n.props.scrollOnDevice&&(0,p.isTouchDevice)(),i=t?n.state.scrollOnDeviceProps:{},o=n.getChildrenList(n.props.children,e.slidesToShow);n.setState({settings:e,children:o,lowerBreakpoint:void 0,higherBreakpoint:void 0},n.setDimensions)})}},n.getSideSize=function(e,t,i){var o=n.state.settings.incrementalSides;if(void 0!==e&&void 0!==t&&o){var r=t-e,s=i-e,a=50*s/r;return a/100}return n.state.settings.sideSize},n.setDimensions=function(){var e=n.state.settings,t=n.state,i=t.lowerBreakpoint,o=t.higherBreakpoint,r=n.props.scrollOnDevice&&(0,p.isTouchDevice)(),s=(0,p.getScreenWidth)(),a=n.getSideSize(i,o,s),l=c.Children.count(n.props.children),u=r?l:c.Children.count(n.state.children),d=(0,p.getElementWidth)(n.refs.frame),f=n.props.showSides?e.slidesToShow+2*a:e.slidesToShow,h=d/f-2*e.slidesSpacing,v=n.props.children.length,g=Math.ceil(n.state.currentIndex/e.slidesToShow),y=Math.ceil(v/e.slidesToShow),m=v>e.slidesToShow?y:1,b=!(m>1),w=void 0,S=void 0;b||r?(w=n.state.children.map(function(e,t){return t}),S=n.state.children.map(function(e,t){return t})):(w=n.getLazyLoadedIndexes(n.props.children,n.state.currentIndex),S=n.getVisibleIndexes(n.props.children,n.state.currentIndex)),n.setState({activePage:g,childrenCount:l,slidesCount:u,slidesWidth:h,frameWidth:d,slidePages:m,singlePage:b,lazyLoadedList:w,visibleSlideList:S,sideSize:a})},n.getVisibleIndexes=function(e,t){var i=[],o=void 0,r=void 0,s=n.state.settings,a=s.showSides?1:0;if(o=e.length+s.slidesToShow+a,0===t){r=o+s.slidesToShow-1;for(var l=o;l<=r;l+=1)i.push(l)}o=0+a;var c=t===e.length-s.slidesToShow;if(c){r=o+s.slidesToShow-1;for(var u=o;u<=r;u+=1)i.push(u)}o=t+n.state.settings.slidesToShow+a,r=o+(n.state.settings.slidesToShow-1);for(var d=o;d<=r;d+=1)i.push(d);return i},n.getLazyLoadedIndexes=function(e,t){var i=n.state.lazyLoadedList,o=void 0,r=void 0,s=n.state.settings,a=s.showSides?1:0;if(o=e.length+s.slidesToShow+a,0===t&&n.state.lazyLoadedList.indexOf(o)<0){r=o+s.slidesToShow+a-1;for(var l=o;l<=r;l+=1)i.push(l)}o=0;var c=t===e.length-s.slidesToShow,u=i.indexOf(o)<0;if(c&&u){r=o+s.slidesToShow+a-1;for(var d=o;d<=r;d+=1)i.push(d)}o=t+s.slidesToShow+a,r=o+(s.slidesToShow-1),n.state.settings.showSides&&(o-=1,r+=1);for(var p=o;p<=r;p+=1)n.state.lazyLoadedList.indexOf(p)<0&&i.push(p);return i},n.getChildrenList=function(e,t){return Array.isArray(e)?n.props.scrollOnDevice&&(0,p.isTouchDevice)()?e:e.length>t&&n.props.showSides?[].concat(o(e.slice(e.length-t-1,e.length)),o(e),o(e.slice(0,t+1))):e.length>t?[].concat(o(e.slice(e.length-t,e.length)),o(e),o(e.slice(0,t))):e:[e]},n.getTargetIndex=function(e,t){var i=e,o=n.state.childrenCount%t;return i=e<0?0===n.state.currentIndex?n.state.childrenCount-t:0:e>=n.state.childrenCount?0!==o?0:e-n.state.childrenCount:0!==o&&e===n.state.childrenCount-o?e-(t-o):e},n.handleTrack=function(e,t){var i=n.state.settings,o=Math.ceil(t/i.slidesToShow),r=n.getLazyLoadedIndexes(n.props.children,t),s=n.getVisibleIndexes(n.props.children,t),a=function(){setTimeout(function(){n.setState({currentIndex:t,animating:!1,dragging:!1})},i.animationDuration)},l=function(){setTimeout(function(){n.setState({animating:!1,dragging:!1})},i.animationDuration)};e<0?n.setState({currentIndex:e,activePage:o,animating:!0,lazyLoadedList:r,visibleSlideList:s,touchObject:{startX:0,startY:0,endX:0,endY:0,length:0,direction:-1}},a):e>=n.props.children.length?n.setState({currentIndex:e,activePage:o,animating:!0,lazyLoadedList:r,visibleSlideList:s,touchObject:{startX:0,startY:0,endX:0,endY:0,length:0,direction:-1}},a):n.setState({currentIndex:t,activePage:o,animating:!0,lazyLoadedList:r,visibleSlideList:s,dragging:!1,touchObject:{startX:0,startY:0,endX:0,endY:0,length:0,direction:-1}},l)},n.moveToNext=function(e){if(e.preventDefault(),!n.state.animating){n.state.autoCycle&&n.state.autoCycleTimer&&clearInterval(n.state.autoCycleTimer);var t=n.state.settings,i=n.state.currentIndex+t.slidesToScroll,o=n.getTargetIndex(i,t.slidesToScroll);n.handleTrack(i,o),n.state.autoCycle&&n.playAutoCycle()}},n.moveToPrevious=function(e){if(e.preventDefault(),!n.state.animating){n.state.autoCycle&&n.state.autoCycleTimer&&clearInterval(n.state.autoCycleTimer);var t=n.state.settings,i=n.state.currentIndex-t.slidesToScroll,o=n.getTargetIndex(i,t.slidesToScroll);i<0&&0!==n.state.currentIndex&&(i=0),n.handleTrack(i,o),n.state.autoCycle&&n.playAutoCycle()}},n.onDotClick=function(e){if(e.preventDefault(),!n.state.animating){n.state.autoCycle&&n.state.autoCycleTimer&&clearInterval(n.state.autoCycleTimer);var t=n.state.settings,i=t.slidesToShow,o=e.target.parentElement.getAttribute("data-index"),r=n.getTargetIndex(o*i,i);n.handleTrack(o*i,r),n.state.autoCycle&&n.playAutoCycle()}},n.onWindowResized=function(){n.setDimensions()},n.autoCycle=function(){var e=n.state.settings,t=n.state.currentIndex+e.slidesToScroll,i=n.getTargetIndex(t,e.slidesToScroll);n.handleTrack(t,i)},n.playAutoCycle=function(){if(n.state.settings.autoCycle){var e=setInterval(n.autoCycle,n.state.settings.cycleInterval);n.setState({autoCycleTimer:e})}},n.pauseAutoCycle=function(){n.state.autoCycleTimer&&(clearInterval(n.state.autoCycleTimer),n.setState({autoCycleTimer:null}))},n.onMouseEnter=function(){n.state.settings.autoCycle&&n.state.settings.pauseOnHover&&n.pauseAutoCycle()},n.onMouseOver=function(){n.state.settings.autoCycle&&n.state.settings.pauseOnHover&&n.pauseAutoCycle()},n.onMouseLeave=function(){n.state.settings.autoCycle&&n.state.settings.pauseOnHover&&n.playAutoCycle()},n.onSwipeStart=function(e){if(!(n.state.settings.swipe===!1||"ontouchend"in document&&n.state.settings.swipe===!1||n.state.settings.draggable===!1&&e.type.indexOf("mouse")!==-1)){var t=void 0!==e.touches?e.touches[0].pageX:e.clientX,i=void 0!==e.touches?e.touches[0].pageY:e.clientY;n.setState({dragging:!0,touchObject:{startX:t,startY:i}})}},n.onSwipeMove=function(e){if(!n.state.dragging)return void e.preventDefault();if(!n.state.animating){var t=void 0!==e.touches?e.touches[0].pageX:e.clientX,i=void 0!==e.touches?e.touches[0].pageY:e.clientY,o=n.state.touchObject,r=(0,p.getSwipeDirection)(o.startX,t,o.startY,i);0!==r&&e.preventDefault();var s=Math.round(Math.sqrt(Math.pow(t-o.startX,2)));n.setState({touchObject:{startX:o.startX,startY:o.startY,endX:t,endY:i,length:s,direction:r}})}},n.onSwipeEnd=function(){var e=n.state.touchObject.length;if(0!==e&&e>n.state.slidesWidth/2)if(1===n.state.touchObject.direction){var t=n.state.settings,i=n.state.currentIndex+t.slidesToScroll,o=n.getTargetIndex(i,t.slidesToScroll);n.handleTrack(i,o)}else{var r=n.state.settings,s=n.state.currentIndex-r.slidesToScroll,a=n.getTargetIndex(s,r.slidesToScroll);s<0&&0!==n.state.currentIndex&&(s=0),n.handleTrack(s,a)}else{var l=function(){setTimeout(function(){n.setState({animating:!1,dragging:!1,touchObject:{startX:0,startY:0,endX:0,endY:0,length:0,direction:-1}})},n.state.settings.animationDuration)};n.setState({animating:!0,touchObject:{direction:n.state.touchObject.direction*-1}},l)}},n.getTrackStyles=function(){var e=n.state.settings,t=n.state.touchObject,i=n.state.slidesWidth+2*e.slidesSpacing;i*=n.state.slidesCount+2*e.slidesToShow;var o=n.state.slidesWidth+2*e.slidesSpacing,r=e.showSides?1:0,s=o*(e.slidesToShow+r),a=n.state.animating?"transform "+e.animationDuration+"ms ease":"",l=e.swipe&&t.length,c=l?t.length*t.direction:0,u=o*n.state.currentIndex,d=s+u+c,p=o*n.state.sideSize;return e.showSides&&(d-=p),{position:"relative",display:"block",width:n.state.singlePage?"100%":i,height:"auto",padding:0,transition:a,transform:n.state.singlePage?"none":"translate("+-d+"px, 0px)",boxSizing:"border-box",MozBoxSizing:"border-box",marginLeft:n.state.singlePage?p+"px":"0px"}},n.getScrollTrackStyles=function(){var e=void 0;return e=settings.showSides?totalSlideWidth*n.state.sideSize:0,{clear:"both",position:"relative",display:"block",width:"100%",height:"auto",padding:0,boxSizing:"border-box",MozBoxSizing:"border-box",marginLeft:e+"px"}},n.getSlideStyles=function(e){var t=n.state.slidesWidth,i=n.props.scrollOnDevice&&(0,p.isTouchDevice)(),o=i?"none":"left",r="inline-block",s=e?"1":n.state.settings.sidesOpacity;return{position:"relative",float:o,display:r,width:t,height:"auto",margin:"0 "+n.state.settings.slidesSpacing+"px",opacity:s}},n.getFormatedChildren=function(e,t,i){return u.default.Children.map(e,function(e,o){var r=n.state.settings,s=i.indexOf(o)>=0;return!r.lazyLoad||t.indexOf(o)>=0?u.default.createElement("li",{className:m.default.InfiniteCarouselSlide,key:o,style:n.getSlideStyles(s)},e):u.default.createElement("li",{className:m.default.InfiniteCarouselSlide,key:o,style:n.getSlideStyles(s)},u.default.createElement("img",{src:r.placeholderImageSrc}))})},n.init=function(){var e=n.getChildrenList(n.props.children,n.props.slidesToShow),t=void 0;t=n.props.scrollOnDevice&&(0,p.isTouchDevice)()?Object.assign({},n.defaultProps,n.props,n.state.scrollOnDeviceProps):Object.assign({},n.defaultProps,n.props),n.setState({children:e,settings:t}),n.props.responsive&&n.setupBreakpointSettings(n.props.breakpoints)},n.state={currentIndex:0,activePage:0,children:[],lazyLoadedList:[],visibleSlideList:[],childrenCount:0,slidesCount:0,slidesWidth:1,slidePages:1,singlePage:!0,frameWidth:1,settings:{},breakpoints:{},autoCycleTimer:null,resizeTimer:null,dragging:!1,touchObject:{startX:0,startY:0,endX:0,endY:0,length:0,direction:-1},scrollOnDeviceProps:{arrows:!1,dots:!1,lazyLoad:!1,autoCycle:!1},lowerBreakpoint:void 0,higherBreakpoint:void 0},n}return a(t,e),l(t,[{key:"componentWillMount",value:function(){this.init()}},{key:"componentDidMount",value:function(){this.setDimensions(),window&&(window.addEventListener?window.addEventListener("resize",this.onWindowResized):window.attachEvent("onresize",this.onWindowResized),this.state.settings.autoCycle&&this.playAutoCycle())}},{key:"componentWillUnmount",value:function(){window.addEventListener?window.removeEventListener("resize",this.onWindowResized):window.detachEvent("onresize",this.onWindowResized),this.state.autoCycleTimer&&clearInterval(this.state.autoCycleTimer)}},{key:"render",value:function(){var e=this.props.scrollOnDevice&&(0,p.isTouchDevice)(),t=this.state.settings,n=void 0,i=void 0,o=void 0;if(t.arrows&&!this.state.singlePage&&!e){if(null==t.prevArrow)n=u.default.createElement(h.default,{next:!1,onClick:this.moveToPrevious,styles:m.default});else{var r={onClick:this.moveToPrevious};n=u.default.cloneElement(t.prevArrow,r)}if(null==t.nextArrow)i=u.default.createElement(h.default,{onClick:this.moveToNext,styles:m.default});else{var s={onClick:this.moveToNext};i=u.default.cloneElement(t.nextArrow,s)}}!t.dots||this.state.singlePage||e||(o=u.default.createElement(g.default,{activePage:this.state.activePage,numberOfDots:this.state.slidePages,onClick:this.onDotClick,styles:m.default}));var a=this.getFormatedChildren(this.state.children,this.state.lazyLoadedList,this.state.visibleSlideList),l=void 0,c=void 0;this.props.scrollOnDevice&&(0,p.isTouchDevice)()?(l=this.getScrollTrackStyles(),c=m.default.InfiniteCarouselScrollTrack):(l=this.getTrackStyles(),c="");var d=this.props.scrollOnDevice&&(0,p.isTouchDevice)();return u.default.createElement("div",{className:m.default.InfiniteCarousel,onMouseEnter:this.onMouseEnter,onMouseLeave:this.onMouseLeave,onMouseOver:this.onMouseOver},n,u.default.createElement("div",{className:m.default.InfiniteCarouselFrame,ref:"frame"},u.default.createElement("ul",{className:c,ref:"track",onMouseDown:d?null:this.onSwipeStart,onMouseLeave:this.state.dragging||!d?this.onSwipeEnd:null,onMouseMove:this.state.dragging||!d?this.onSwipeMove:null,onMouseUp:d?null:this.onSwipeEnd,onTouchCancel:this.state.dragging||!d?this.onSwipeEnd:null,onTouchEnd:d?null:this.onSwipeEnd,onTouchMove:this.state.dragging||!d?this.onSwipeMove:null,onTouchStart:d?null:this.onSwipeStart,style:l},a)),i,o)}}]),t}(c.Component);b.propTypes={children:c.PropTypes.oneOfType([c.PropTypes.arrayOf(u.default.PropTypes.node),c.PropTypes.node]).isRequired,arrows:c.PropTypes.bool,dots:c.PropTypes.bool,lazyLoad:c.PropTypes.bool,swipe:c.PropTypes.bool,animationDuration:c.PropTypes.number,slidesToShow:c.PropTypes.number,slidesToScroll:c.PropTypes.number,slidesSpacing:c.PropTypes.number,autoCycle:c.PropTypes.bool,cycleInterval:c.PropTypes.number,pauseOnHover:c.PropTypes.bool,responsive:c.PropTypes.bool,breakpoints:c.PropTypes.arrayOf(c.PropTypes.object),placeholderImageSrc:c.PropTypes.string,nextArrow:c.PropTypes.element,prevArrow:c.PropTypes.element,scrollOnDevice:c.PropTypes.bool,showSides:c.PropTypes.bool,sidesOpacity:c.PropTypes.number,sideSize:c.PropTypes.number,incrementalSides:c.PropTypes.bool},b.defaultProps={children:[],arrows:!0,dots:!1,lazyLoad:!1,swipe:!0,draggable:!1,animationDuration:500,slidesToShow:1,slidesToScroll:1,slidesSpacing:10,autoCycle:!1,cycleInterval:5e3,pauseOnHover:!0,responsive:!0,breakpoints:[],placeholderImageSrc:"",nextArrow:null,prevArrow:null,scrollOnDevice:!1,showSides:!1,sidesOpacity:1,sideSize:.5,incrementalSides:!1},t.default=b},function(t,n){t.exports=e},function(e,t,n){var i=n(3),o=i&&n(4),r=n(9),s={media:function(e,t){e=r(e),"function"==typeof t&&(t={match:t}),i&&o.register(e,t),this._responsiveMediaHandlers||(this._responsiveMediaHandlers=[]),this._responsiveMediaHandlers.push({query:e,handler:t})},componentWillUnmount:function(){this._responsiveMediaHandlers&&this._responsiveMediaHandlers.forEach(function(e){i&&o.unregister(e.query,e.handler)})}};e.exports=s},function(e,t){var n=!("undefined"==typeof window||!window.document||!window.document.createElement);e.exports=n},function(e,t,n){var i=n(5);e.exports=new i},function(e,t,n){function i(){if(!window.matchMedia)throw new Error("matchMedia not present, legacy browsers require a polyfill");this.queries={},this.browserIsIncapable=!window.matchMedia("only all").matches}var o=n(6),r=n(8),s=r.each,a=r.isFunction,l=r.isArray;i.prototype={constructor:i,register:function(e,t,n){var i=this.queries,r=n&&this.browserIsIncapable;return i[e]||(i[e]=new o(e,r)),a(t)&&(t={match:t}),l(t)||(t=[t]),s(t,function(t){a(t)&&(t={match:t}),i[e].addHandler(t)}),this},unregister:function(e,t){var n=this.queries[e];return n&&(t?n.removeHandler(t):(n.clear(),delete this.queries[e])),this}},e.exports=i},function(e,t,n){function i(e,t){this.query=e,this.isUnconditional=t,this.handlers=[],this.mql=window.matchMedia(e);var n=this;this.listener=function(e){n.mql=e.currentTarget||e,n.assess()},this.mql.addListener(this.listener)}var o=n(7),r=n(8).each;i.prototype={constuctor:i,addHandler:function(e){var t=new o(e);this.handlers.push(t),this.matches()&&t.on()},removeHandler:function(e){var t=this.handlers;r(t,function(n,i){if(n.equals(e))return n.destroy(),!t.splice(i,1)})},matches:function(){return this.mql.matches||this.isUnconditional},clear:function(){r(this.handlers,function(e){e.destroy()}),this.mql.removeListener(this.listener),this.handlers.length=0},assess:function(){var e=this.matches()?"on":"off";r(this.handlers,function(t){t[e]()})}},e.exports=i},function(e,t){function n(e){this.options=e,!e.deferSetup&&this.setup()}n.prototype={constructor:n,setup:function(){this.options.setup&&this.options.setup(),this.initialised=!0},on:function(){!this.initialised&&this.setup(),this.options.match&&this.options.match()},off:function(){this.options.unmatch&&this.options.unmatch()},destroy:function(){this.options.destroy?this.options.destroy():this.off()},equals:function(e){return this.options===e||this.options.match===e}},e.exports=n},function(e,t){function n(e,t){var n,i=0,o=e.length;for(i;i<o&&(n=t(e[i],i),n!==!1);i++);}function i(e){return"[object Array]"===Object.prototype.toString.apply(e)}function o(e){return"function"==typeof e}e.exports={isFunction:o,isArray:i,each:n}},function(e,t,n){var i=n(10),o=function(e){var t=/[height|width]$/;return t.test(e)},r=function(e){var t="",n=Object.keys(e);return n.forEach(function(r,s){var a=e[r];r=i(r),o(r)&&"number"==typeof a&&(a+="px"),t+=a===!0?r:a===!1?"not "+r:"("+r+": "+a+")",s<n.length-1&&(t+=" and ")}),t},s=function(e){var t="";return"string"==typeof e?e:e instanceof Array?(e.forEach(function(n,i){t+=r(n),i<e.length-1&&(t+=", ")}),t):r(e)};e.exports=s},function(e,t){var n=function(e){return e.replace(/[A-Z]/g,function(e){return"-"+e.toLowerCase()}).toLowerCase()};e.exports=n},function(e,t){"use strict";function n(e){return e.getBoundingClientRect().width||e.offsetWidth||0}function i(e){return e.getBoundingClientRect().height||e.offsetHeight||0}function o(e,t,n,i){var o=e-t,r=n-i,s=Math.round(180*Math.atan2(r,o)/Math.PI);return s<0&&(s=360-Math.abs(s)),s<=45&&s>=0?1:s<=360&&s>=315?1:s>=135&&s<=225?-1:0}function r(){return"ontouchstart"in document.documentElement}function s(e,t){return e-t}function a(){return window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth}Object.defineProperty(t,"__esModule",{value:!0}),t.getElementWidth=n,t.getElementHeight=i,t.getSwipeDirection=o,t.isTouchDevice=r,t.sortNumber=s,t.getScreenWidth=a},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var a=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),l=n(1),c=i(l),u=function(e){function t(){return o(this,t),r(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return s(t,e),a(t,[{key:"render",value:function(){var e=this.props.styles.InfiniteCarouselArrow,t=void 0;t=this.props.next?this.props.styles.InfiniteCarouselArrowNext:this.props.styles.InfiniteCarouselArrowPrev;var n=this.props.styles.InfiniteCarouselArrowIcon,i=void 0;return i=this.props.next?this.props.styles.InfiniteCarouselArrowNextIcon:this.props.styles.InfiniteCarouselArrowPrevIcon,c.default.createElement("button",{className:e+" "+t,onClick:this.props.onClick},c.default.createElement("i",{className:n+" "+i}))}}]),t}(l.Component);u.propTypes={next:l.PropTypes.bool,onClick:l.PropTypes.func.isRequired,styles:l.PropTypes.object.isRequired},u.defaultProps={next:!0},t.default=u},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var a=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),l=n(1),c=i(l),u=function(e){function t(){return o(this,t),r(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return s(t,e),a(t,[{key:"render",value:function(){for(var e=[],t=this.props.styles.InfiniteCarouselDots,n=this.props.styles.InfiniteCarouselDot,i=this.props.styles.InfiniteCarouselDotIcon,o=this.props.styles.InfiniteCarouselDotActiveIcon,r=0;r<this.props.numberOfDots;r+=1)e.push(c.default.createElement("li",{className:n,"data-index":r,key:r+1,onClick:this.props.onClick},c.default.createElement("i",{className:i+" "+(r===this.props.activePage?o:"")})));return c.default.createElement("ul",{className:t},e)}}]),t}(l.Component);u.propTypes={numberOfDots:l.PropTypes.number.isRequired,activePage:l.PropTypes.number.isRequired,onClick:l.PropTypes.func.isRequired,styles:l.PropTypes.object.isRequired},t.default=u},function(e,t,n){var i=n(15);"string"==typeof i&&(i=[[e.id,i,""]]);n(17)(i,{});i.locals&&(e.exports=i.locals)},function(e,t,n){t=e.exports=n(16)(),t.push([e.id,"._2Nde-b7zBqxE2c-pX-RLQr{position:relative}.CB9vby5YRbJWpv7hRrZ0x{width:100%;overflow:hidden}._22fNtVvEKNZkRmg_lseZsh{overflow-x:scroll;overflow-y:hidden;white-space:nowrap;-webkit-overflow-scrolling:touch;overflow:-moz-scrollbars-none;-webkit-box-sizing:border-box}._22fNtVvEKNZkRmg_lseZsh::-webkit-scrollbar{display:none}._2VaQi-Tq1LrSSO0_knReFa img{width:100%}._1JwaBMUCMsc8QmGrT7DX45{position:absolute;left:50%;bottom:0;padding:0;transform:translateX(-50%)}._3h8t2ML6KJ6OrCXmy0O_sN{display:inline-block;list-style:none;margin:0 5px;cursor:pointer}._37p1PaSm2K-Q8bMPwMJq9y{display:block;background-color:#e5e5e5;width:10px;height:10px;border-radius:50%}._2WFZTqYBc3N8MmmhMS5Dii{background-color:#48799a}._37Q_YD174b3Wq9o-IFVdKS{display:block;background:none;border:none;position:absolute;top:50%;z-index:2;outline:none;transform:translateY(-50%);cursor:pointer}._3kLq2S7iaEfJAxyyJqts35{left:15px;right:auto}._1-Hp0TfFuBlCxtdPUf_zEF{left:auto;right:15px}.GasrFbdQYtD26JnmJzJpj{display:inline-block;padding:10px;border:solid #e5e5e5;border-width:0 5px 5px 0}._1xZXGqNvuv0yzPtZbeydfd{transform:rotate(-45deg)}.wMWnjwePCo1SMTH0APGNJ{transform:rotate(135deg)}",""]),t.locals={InfiniteCarousel:"_2Nde-b7zBqxE2c-pX-RLQr",InfiniteCarouselFrame:"CB9vby5YRbJWpv7hRrZ0x",InfiniteCarouselScrollTrack:"_22fNtVvEKNZkRmg_lseZsh",InfiniteCarouselSlide:"_2VaQi-Tq1LrSSO0_knReFa",InfiniteCarouselDots:"_1JwaBMUCMsc8QmGrT7DX45",InfiniteCarouselDot:"_3h8t2ML6KJ6OrCXmy0O_sN",InfiniteCarouselDotIcon:"_37p1PaSm2K-Q8bMPwMJq9y",InfiniteCarouselDotActiveIcon:"_2WFZTqYBc3N8MmmhMS5Dii",InfiniteCarouselArrow:"_37Q_YD174b3Wq9o-IFVdKS",InfiniteCarouselArrowPrev:"_3kLq2S7iaEfJAxyyJqts35",InfiniteCarouselArrowNext:"_1-Hp0TfFuBlCxtdPUf_zEF",InfiniteCarouselArrowIcon:"GasrFbdQYtD26JnmJzJpj",InfiniteCarouselArrowNextIcon:"_1xZXGqNvuv0yzPtZbeydfd",InfiniteCarouselArrowPrevIcon:"wMWnjwePCo1SMTH0APGNJ"}},function(e,t){e.exports=function(){var e=[];return e.toString=function(){for(var e=[],t=0;t<this.length;t++){var n=this[t];n[2]?e.push("@media "+n[2]+"{"+n[1]+"}"):e.push(n[1])}return e.join("")},e.i=function(t,n){"string"==typeof t&&(t=[[null,t,""]]);for(var i={},o=0;o<this.length;o++){var r=this[o][0];"number"==typeof r&&(i[r]=!0)}for(o=0;o<t.length;o++){var s=t[o];"number"==typeof s[0]&&i[s[0]]||(n&&!s[2]?s[2]=n:n&&(s[2]="("+s[2]+") and ("+n+")"),e.push(s))}},e}},function(e,t,n){function i(e,t){for(var n=0;n<e.length;n++){var i=e[n],o=f[i.id];if(o){o.refs++;for(var r=0;r<o.parts.length;r++)o.parts[r](i.parts[r]);for(;r<i.parts.length;r++)o.parts.push(c(i.parts[r],t))}else{for(var s=[],r=0;r<i.parts.length;r++)s.push(c(i.parts[r],t));f[i.id]={id:i.id,refs:1,parts:s}}}}function o(e){for(var t=[],n={},i=0;i<e.length;i++){var o=e[i],r=o[0],s=o[1],a=o[2],l=o[3],c={css:s,media:a,sourceMap:l};n[r]?n[r].parts.push(c):t.push(n[r]={id:r,parts:[c]})}return t}function r(e,t){var n=g(),i=b[b.length-1];if("top"===e.insertAt)i?i.nextSibling?n.insertBefore(t,i.nextSibling):n.appendChild(t):n.insertBefore(t,n.firstChild),b.push(t);else{if("bottom"!==e.insertAt)throw new Error("Invalid value for parameter 'insertAt'. Must be 'top' or 'bottom'.");n.appendChild(t)}}function s(e){e.parentNode.removeChild(e);var t=b.indexOf(e);t>=0&&b.splice(t,1)}function a(e){var t=document.createElement("style");return t.type="text/css",r(e,t),t}function l(e){var t=document.createElement("link");return t.rel="stylesheet",r(e,t),t}function c(e,t){var n,i,o;if(t.singleton){var r=m++;n=y||(y=a(t)),i=u.bind(null,n,r,!1),o=u.bind(null,n,r,!0)}else e.sourceMap&&"function"==typeof URL&&"function"==typeof URL.createObjectURL&&"function"==typeof URL.revokeObjectURL&&"function"==typeof Blob&&"function"==typeof btoa?(n=l(t),i=p.bind(null,n),o=function(){s(n),n.href&&URL.revokeObjectURL(n.href)}):(n=a(t),i=d.bind(null,n),o=function(){s(n)});return i(e),function(t){if(t){if(t.css===e.css&&t.media===e.media&&t.sourceMap===e.sourceMap)return;i(e=t)}else o()}}function u(e,t,n,i){var o=n?"":i.css;if(e.styleSheet)e.styleSheet.cssText=w(t,o);else{var r=document.createTextNode(o),s=e.childNodes;s[t]&&e.removeChild(s[t]),s.length?e.insertBefore(r,s[t]):e.appendChild(r)}}function d(e,t){var n=t.css,i=t.media;if(i&&e.setAttribute("media",i),e.styleSheet)e.styleSheet.cssText=n;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(n))}}function p(e,t){var n=t.css,i=t.sourceMap;i&&(n+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(i))))+" */");var o=new Blob([n],{type:"text/css"}),r=e.href;e.href=URL.createObjectURL(o),r&&URL.revokeObjectURL(r)}var f={},h=function(e){var t;return function(){return"undefined"==typeof t&&(t=e.apply(this,arguments)),t}},v=h(function(){return/msie [6-9]\b/.test(self.navigator.userAgent.toLowerCase())}),g=h(function(){return document.head||document.getElementsByTagName("head")[0]}),y=null,m=0,b=[];e.exports=function(e,t){t=t||{},"undefined"==typeof t.singleton&&(t.singleton=v()),"undefined"==typeof t.insertAt&&(t.insertAt="bottom");var n=o(e);return i(n,t),function(e){for(var r=[],s=0;s<n.length;s++){var a=n[s],l=f[a.id];l.refs--,r.push(l)}if(e){var c=o(e);i(c,t)}for(var s=0;s<r.length;s++){var l=r[s];if(0===l.refs){for(var u=0;u<l.parts.length;u++)l.parts[u]();delete f[l.id]}}}};var w=function(){var e=[];return function(t,n){return e[t]=n,e.filter(Boolean).join("\n")}}()}])}); | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react")):"function"==typeof define&&define.amd?define(["react"],t):"object"==typeof exports?exports.InfiniteCarousel=t(require("react")):e.InfiniteCarousel=t(e.React)}(this,function(e){return function(e){function t(i){if(n[i])return n[i].exports;var o=n[i]={exports:{},id:i,loaded:!1};return e[i].call(o.exports,o,o.exports,t),o.loaded=!0,o.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function o(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var l=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),c=n(1),u=i(c),d=n(2),p=n(11),f=n(12),h=i(f),v=n(13),g=i(v),y=n(14),m=i(y),b=function(e){function t(e){r(this,t);var n=s(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n.setupBreakpointSettings=function(e){var t=e.map(function(e){return e.breakpoint}),i={};if(e.forEach(function(e){i[e.breakpoint]=e.settings}),t.length>0){t.sort(p.sortNumber),t.forEach(function(e,o){var r=void 0,s=void 0;0===o?(r=0,s=e-1):(r=t[o-1],s=e-1);var a={minWidth:r,maxWidth:s};(0,d.media)(a,function(){var t=Object.assign({},n.defaultProps,n.props,i[e],a),o=n.props.scrollOnDevice&&(0,p.isTouchDevice)(),a=o?n.state.scrollOnDeviceProps:{},l=n.getChildrenList(n.props.children,t.slidesToShow);n.setState({settings:t,children:l,lowerBreakpoint:r,higherBreakpoint:s},n.setDimensions)})}),t.reverse();var o={minWidth:t[0]};(0,d.media)(o,function(){var e=Object.assign({},n.defaultProps,n.props,i),t=n.props.scrollOnDevice&&(0,p.isTouchDevice)(),i=t?n.state.scrollOnDeviceProps:{},o=n.getChildrenList(n.props.children,e.slidesToShow);n.setState({settings:e,children:o,lowerBreakpoint:void 0,higherBreakpoint:void 0},n.setDimensions)})}},n.getSideSize=function(e,t,i){var o=n.state.settings.incrementalSides;if(void 0!==e&&void 0!==t&&o){var r=t-e,s=i-e,a=50*s/r;return a/100}return n.state.settings.sideSize},n.setDimensions=function(){var e=n.state.settings,t=n.state,i=t.lowerBreakpoint,o=t.higherBreakpoint,r=n.props.scrollOnDevice&&(0,p.isTouchDevice)(),s=(0,p.getScreenWidth)(),a=n.getSideSize(i,o,s),l=c.Children.count(n.props.children),u=r?l:c.Children.count(n.state.children),d=(0,p.getElementWidth)(n.refs.frame),f=n.props.showSides?e.slidesToShow+2*a:e.slidesToShow,h=d/f-2*e.slidesSpacing,v=n.props.children.length,g=Math.ceil(n.state.currentIndex/e.slidesToShow),y=Math.ceil(v/e.slidesToShow),m=v>e.slidesToShow?y:1,b=!(m>1),w=void 0,S=void 0;b||r?(w=n.state.children.map(function(e,t){return t}),S=n.state.children.map(function(e,t){return t})):(w=n.getLazyLoadedIndexes(n.props.children,n.state.currentIndex),S=n.getVisibleIndexes(n.props.children,n.state.currentIndex)),n.setState({activePage:g,childrenCount:l,slidesCount:u,slidesWidth:h,frameWidth:d,slidePages:m,singlePage:b,lazyLoadedList:w,visibleSlideList:S,sideSize:a})},n.getVisibleIndexes=function(e,t){var i=[],o=void 0,r=void 0,s=n.state.settings,a=s.showSides?1:0;if(o=e.length+s.slidesToShow+a,0===t){r=o+s.slidesToShow-1;for(var l=o;l<=r;l+=1)i.push(l)}o=0+a;var c=t===e.length-s.slidesToShow;if(c){r=o+s.slidesToShow-1;for(var u=o;u<=r;u+=1)i.push(u)}o=t+n.state.settings.slidesToShow+a,r=o+(n.state.settings.slidesToShow-1);for(var d=o;d<=r;d+=1)i.push(d);return i},n.getLazyLoadedIndexes=function(e,t){var i=n.state.lazyLoadedList,o=void 0,r=void 0,s=n.state.settings,a=s.showSides?1:0;if(o=e.length+s.slidesToShow+a,0===t&&n.state.lazyLoadedList.indexOf(o)<0){r=o+s.slidesToShow+a-1;for(var l=o;l<=r;l+=1)i.push(l)}o=0;var c=t===e.length-s.slidesToShow,u=i.indexOf(o)<0;if(c&&u){r=o+s.slidesToShow+a-1;for(var d=o;d<=r;d+=1)i.push(d)}o=t+s.slidesToShow+a,r=o+(s.slidesToShow-1),n.state.settings.showSides&&(o-=1,r+=1);for(var p=o;p<=r;p+=1)n.state.lazyLoadedList.indexOf(p)<0&&i.push(p);return i},n.getChildrenList=function(e,t){return Array.isArray(e)?n.props.scrollOnDevice&&(0,p.isTouchDevice)()?e:e.length>t&&n.props.showSides?[].concat(o(e.slice(e.length-t-1,e.length)),o(e),o(e.slice(0,t+1))):e.length>t?[].concat(o(e.slice(e.length-t,e.length)),o(e),o(e.slice(0,t))):e:[e]},n.getTargetIndex=function(e,t){var i=e,o=n.state.childrenCount%t;return i=e<0?0===n.state.currentIndex?n.state.childrenCount-t:0:e>=n.state.childrenCount?0!==o?0:e-n.state.childrenCount:0!==o&&e===n.state.childrenCount-o?e-(t-o):e},n.handleTrack=function(e,t){var i=n.state.settings,o=Math.ceil(t/i.slidesToShow),r=n.getLazyLoadedIndexes(n.props.children,t),s=n.getVisibleIndexes(n.props.children,t),a=function(){setTimeout(function(){n.setState({currentIndex:t,animating:!1,dragging:!1})},i.animationDuration)},l=function(){setTimeout(function(){n.setState({animating:!1,dragging:!1})},i.animationDuration)};e<0?n.setState({currentIndex:e,activePage:o,animating:!0,lazyLoadedList:r,visibleSlideList:s,touchObject:{startX:0,startY:0,endX:0,endY:0,length:0,direction:-1}},a):e>=n.props.children.length?n.setState({currentIndex:e,activePage:o,animating:!0,lazyLoadedList:r,visibleSlideList:s,touchObject:{startX:0,startY:0,endX:0,endY:0,length:0,direction:-1}},a):n.setState({currentIndex:t,activePage:o,animating:!0,lazyLoadedList:r,visibleSlideList:s,dragging:!1,touchObject:{startX:0,startY:0,endX:0,endY:0,length:0,direction:-1}},l)},n.moveToNext=function(e){if(e.preventDefault(),!n.state.animating){n.state.autoCycle&&n.state.autoCycleTimer&&clearInterval(n.state.autoCycleTimer);var t=n.state.settings,i=n.state.currentIndex+t.slidesToScroll,o=n.getTargetIndex(i,t.slidesToScroll);n.handleTrack(i,o),n.state.autoCycle&&n.playAutoCycle()}},n.moveToPrevious=function(e){if(e.preventDefault(),!n.state.animating){n.state.autoCycle&&n.state.autoCycleTimer&&clearInterval(n.state.autoCycleTimer);var t=n.state.settings,i=n.state.currentIndex-t.slidesToScroll,o=n.getTargetIndex(i,t.slidesToScroll);i<0&&0!==n.state.currentIndex&&(i=0),n.handleTrack(i,o),n.state.autoCycle&&n.playAutoCycle()}},n.onDotClick=function(e){if(e.preventDefault(),!n.state.animating){n.state.autoCycle&&n.state.autoCycleTimer&&clearInterval(n.state.autoCycleTimer);var t=n.state.settings,i=t.slidesToShow,o=e.target.parentElement.getAttribute("data-index"),r=n.getTargetIndex(o*i,i);n.handleTrack(o*i,r),n.state.autoCycle&&n.playAutoCycle()}},n.onWindowResized=function(){n.setDimensions()},n.autoCycle=function(){var e=n.state.settings,t=n.state.currentIndex+e.slidesToScroll,i=n.getTargetIndex(t,e.slidesToScroll);n.handleTrack(t,i)},n.playAutoCycle=function(){if(n.state.settings.autoCycle){var e=setInterval(n.autoCycle,n.state.settings.cycleInterval);n.setState({autoCycleTimer:e})}},n.pauseAutoCycle=function(){n.state.autoCycleTimer&&(clearInterval(n.state.autoCycleTimer),n.setState({autoCycleTimer:null}))},n.onMouseEnter=function(){n.state.settings.autoCycle&&n.state.settings.pauseOnHover&&n.pauseAutoCycle()},n.onMouseOver=function(){n.state.settings.autoCycle&&n.state.settings.pauseOnHover&&n.pauseAutoCycle()},n.onMouseLeave=function(){n.state.settings.autoCycle&&n.state.settings.pauseOnHover&&n.playAutoCycle()},n.onSwipeStart=function(e){if(!(n.state.settings.swipe===!1||"ontouchend"in document&&n.state.settings.swipe===!1||n.state.settings.draggable===!1&&e.type.indexOf("mouse")!==-1)){var t=void 0!==e.touches?e.touches[0].pageX:e.clientX,i=void 0!==e.touches?e.touches[0].pageY:e.clientY;n.setState({dragging:!0,touchObject:{startX:t,startY:i}})}},n.onSwipeMove=function(e){if(!n.state.dragging)return void e.preventDefault();if(!n.state.animating){var t=void 0!==e.touches?e.touches[0].pageX:e.clientX,i=void 0!==e.touches?e.touches[0].pageY:e.clientY,o=n.state.touchObject,r=(0,p.getSwipeDirection)(o.startX,t,o.startY,i);0!==r&&e.preventDefault();var s=Math.round(Math.sqrt(Math.pow(t-o.startX,2)));n.setState({touchObject:{startX:o.startX,startY:o.startY,endX:t,endY:i,length:s,direction:r}})}},n.onSwipeEnd=function(){var e=n.state.touchObject.length;if(0!==e&&e>n.state.slidesWidth/2)if(1===n.state.touchObject.direction){var t=n.state.settings,i=n.state.currentIndex+t.slidesToScroll,o=n.getTargetIndex(i,t.slidesToScroll);n.handleTrack(i,o)}else{var r=n.state.settings,s=n.state.currentIndex-r.slidesToScroll,a=n.getTargetIndex(s,r.slidesToScroll);s<0&&0!==n.state.currentIndex&&(s=0),n.handleTrack(s,a)}else{var l=function(){setTimeout(function(){n.setState({animating:!1,dragging:!1,touchObject:{startX:0,startY:0,endX:0,endY:0,length:0,direction:-1}})},n.state.settings.animationDuration)};n.setState({animating:!0,touchObject:{direction:n.state.touchObject.direction*-1}},l)}},n.getTrackStyles=function(){var e=n.state.settings,t=n.state.touchObject,i=n.state.slidesWidth+2*e.slidesSpacing;i*=n.state.slidesCount+2*e.slidesToShow;var o=n.state.slidesWidth+2*e.slidesSpacing,r=e.showSides?1:0,s=o*(e.slidesToShow+r),a=n.state.animating?"transform "+e.animationDuration+"ms ease":"",l=e.swipe&&t.length,c=l?t.length*t.direction:0,u=o*n.state.currentIndex,d=s+u+c,p=o*n.state.sideSize;return e.showSides&&(d-=p),{position:"relative",display:"block",width:n.state.singlePage?"100%":i,height:"auto",padding:0,transition:a,transform:n.state.singlePage?"none":"translate("+-d+"px, 0px)",boxSizing:"border-box",MozBoxSizing:"border-box",marginLeft:n.state.singlePage?p+"px":"0px"}},n.getScrollTrackStyles=function(){return{clear:"both",position:"relative",display:"block",width:"100%",height:"auto",padding:0,boxSizing:"border-box",MozBoxSizing:"border-box"}},n.getSlideStyles=function(e){var t=n.state.slidesWidth,i=n.props.scrollOnDevice&&(0,p.isTouchDevice)(),o=i?"none":"left",r="inline-block",s=e?"1":n.state.settings.sidesOpacity;return{position:"relative",float:o,display:r,width:t,height:"auto",margin:"0 "+n.state.settings.slidesSpacing+"px",opacity:s}},n.getFormatedChildren=function(e,t,i){return u.default.Children.map(e,function(e,o){var r=n.state.settings,s=i.indexOf(o)>=0;return!r.lazyLoad||t.indexOf(o)>=0?u.default.createElement("li",{className:m.default.InfiniteCarouselSlide,key:o,style:n.getSlideStyles(s)},e):u.default.createElement("li",{className:m.default.InfiniteCarouselSlide,key:o,style:n.getSlideStyles(s)},u.default.createElement("img",{src:r.placeholderImageSrc}))})},n.init=function(){var e=n.getChildrenList(n.props.children,n.props.slidesToShow),t=void 0;t=n.props.scrollOnDevice&&(0,p.isTouchDevice)()?Object.assign({},n.defaultProps,n.props,n.state.scrollOnDeviceProps):Object.assign({},n.defaultProps,n.props),n.setState({children:e,settings:t}),n.props.responsive&&n.setupBreakpointSettings(n.props.breakpoints)},n.state={currentIndex:0,activePage:0,children:[],lazyLoadedList:[],visibleSlideList:[],childrenCount:0,slidesCount:0,slidesWidth:1,slidePages:1,singlePage:!0,frameWidth:1,settings:{},breakpoints:{},autoCycleTimer:null,resizeTimer:null,dragging:!1,touchObject:{startX:0,startY:0,endX:0,endY:0,length:0,direction:-1},scrollOnDeviceProps:{arrows:!1,dots:!1,lazyLoad:!1,autoCycle:!1},lowerBreakpoint:void 0,higherBreakpoint:void 0},n}return a(t,e),l(t,[{key:"componentWillMount",value:function(){this.init()}},{key:"componentDidMount",value:function(){this.setDimensions(),window&&(window.addEventListener?window.addEventListener("resize",this.onWindowResized):window.attachEvent("onresize",this.onWindowResized),this.state.settings.autoCycle&&this.playAutoCycle())}},{key:"componentWillUnmount",value:function(){window.addEventListener?window.removeEventListener("resize",this.onWindowResized):window.detachEvent("onresize",this.onWindowResized),this.state.autoCycleTimer&&clearInterval(this.state.autoCycleTimer)}},{key:"render",value:function(){var e=this.props.scrollOnDevice&&(0,p.isTouchDevice)(),t=this.state.settings,n=void 0,i=void 0,o=void 0;if(t.arrows&&!this.state.singlePage&&!e){if(null==t.prevArrow)n=u.default.createElement(h.default,{next:!1,onClick:this.moveToPrevious,styles:m.default});else{var r={onClick:this.moveToPrevious};n=u.default.cloneElement(t.prevArrow,r)}if(null==t.nextArrow)i=u.default.createElement(h.default,{onClick:this.moveToNext,styles:m.default});else{var s={onClick:this.moveToNext};i=u.default.cloneElement(t.nextArrow,s)}}!t.dots||this.state.singlePage||e||(o=u.default.createElement(g.default,{activePage:this.state.activePage,numberOfDots:this.state.slidePages,onClick:this.onDotClick,styles:m.default}));var a=this.getFormatedChildren(this.state.children,this.state.lazyLoadedList,this.state.visibleSlideList),l=void 0,c=void 0;this.props.scrollOnDevice&&(0,p.isTouchDevice)()?(l=this.getScrollTrackStyles(),c=m.default.InfiniteCarouselScrollTrack):(l=this.getTrackStyles(),c="");var d=this.props.scrollOnDevice&&(0,p.isTouchDevice)();return u.default.createElement("div",{className:m.default.InfiniteCarousel,onMouseEnter:this.onMouseEnter,onMouseLeave:this.onMouseLeave,onMouseOver:this.onMouseOver},n,u.default.createElement("div",{className:m.default.InfiniteCarouselFrame,ref:"frame"},u.default.createElement("ul",{className:c,ref:"track",onMouseDown:d?null:this.onSwipeStart,onMouseLeave:this.state.dragging||!d?this.onSwipeEnd:null,onMouseMove:this.state.dragging||!d?this.onSwipeMove:null,onMouseUp:d?null:this.onSwipeEnd,onTouchCancel:this.state.dragging||!d?this.onSwipeEnd:null,onTouchEnd:d?null:this.onSwipeEnd,onTouchMove:this.state.dragging||!d?this.onSwipeMove:null,onTouchStart:d?null:this.onSwipeStart,style:l},a)),i,o)}}]),t}(c.Component);b.propTypes={children:c.PropTypes.oneOfType([c.PropTypes.arrayOf(u.default.PropTypes.node),c.PropTypes.node]).isRequired,arrows:c.PropTypes.bool,dots:c.PropTypes.bool,lazyLoad:c.PropTypes.bool,swipe:c.PropTypes.bool,animationDuration:c.PropTypes.number,slidesToShow:c.PropTypes.number,slidesToScroll:c.PropTypes.number,slidesSpacing:c.PropTypes.number,autoCycle:c.PropTypes.bool,cycleInterval:c.PropTypes.number,pauseOnHover:c.PropTypes.bool,responsive:c.PropTypes.bool,breakpoints:c.PropTypes.arrayOf(c.PropTypes.object),placeholderImageSrc:c.PropTypes.string,nextArrow:c.PropTypes.element,prevArrow:c.PropTypes.element,scrollOnDevice:c.PropTypes.bool,showSides:c.PropTypes.bool,sidesOpacity:c.PropTypes.number,sideSize:c.PropTypes.number,incrementalSides:c.PropTypes.bool},b.defaultProps={children:[],arrows:!0,dots:!1,lazyLoad:!1,swipe:!0,draggable:!1,animationDuration:500,slidesToShow:1,slidesToScroll:1,slidesSpacing:10,autoCycle:!1,cycleInterval:5e3,pauseOnHover:!0,responsive:!0,breakpoints:[],placeholderImageSrc:"",nextArrow:null,prevArrow:null,scrollOnDevice:!1,showSides:!1,sidesOpacity:1,sideSize:.5,incrementalSides:!1},t.default=b},function(t,n){t.exports=e},function(e,t,n){var i=n(3),o=i&&n(4),r=n(9),s={media:function(e,t){e=r(e),"function"==typeof t&&(t={match:t}),i&&o.register(e,t),this._responsiveMediaHandlers||(this._responsiveMediaHandlers=[]),this._responsiveMediaHandlers.push({query:e,handler:t})},componentWillUnmount:function(){this._responsiveMediaHandlers&&this._responsiveMediaHandlers.forEach(function(e){i&&o.unregister(e.query,e.handler)})}};e.exports=s},function(e,t){var n=!("undefined"==typeof window||!window.document||!window.document.createElement);e.exports=n},function(e,t,n){var i=n(5);e.exports=new i},function(e,t,n){function i(){if(!window.matchMedia)throw new Error("matchMedia not present, legacy browsers require a polyfill");this.queries={},this.browserIsIncapable=!window.matchMedia("only all").matches}var o=n(6),r=n(8),s=r.each,a=r.isFunction,l=r.isArray;i.prototype={constructor:i,register:function(e,t,n){var i=this.queries,r=n&&this.browserIsIncapable;return i[e]||(i[e]=new o(e,r)),a(t)&&(t={match:t}),l(t)||(t=[t]),s(t,function(t){a(t)&&(t={match:t}),i[e].addHandler(t)}),this},unregister:function(e,t){var n=this.queries[e];return n&&(t?n.removeHandler(t):(n.clear(),delete this.queries[e])),this}},e.exports=i},function(e,t,n){function i(e,t){this.query=e,this.isUnconditional=t,this.handlers=[],this.mql=window.matchMedia(e);var n=this;this.listener=function(e){n.mql=e.currentTarget||e,n.assess()},this.mql.addListener(this.listener)}var o=n(7),r=n(8).each;i.prototype={constuctor:i,addHandler:function(e){var t=new o(e);this.handlers.push(t),this.matches()&&t.on()},removeHandler:function(e){var t=this.handlers;r(t,function(n,i){if(n.equals(e))return n.destroy(),!t.splice(i,1)})},matches:function(){return this.mql.matches||this.isUnconditional},clear:function(){r(this.handlers,function(e){e.destroy()}),this.mql.removeListener(this.listener),this.handlers.length=0},assess:function(){var e=this.matches()?"on":"off";r(this.handlers,function(t){t[e]()})}},e.exports=i},function(e,t){function n(e){this.options=e,!e.deferSetup&&this.setup()}n.prototype={constructor:n,setup:function(){this.options.setup&&this.options.setup(),this.initialised=!0},on:function(){!this.initialised&&this.setup(),this.options.match&&this.options.match()},off:function(){this.options.unmatch&&this.options.unmatch()},destroy:function(){this.options.destroy?this.options.destroy():this.off()},equals:function(e){return this.options===e||this.options.match===e}},e.exports=n},function(e,t){function n(e,t){var n,i=0,o=e.length;for(i;i<o&&(n=t(e[i],i),n!==!1);i++);}function i(e){return"[object Array]"===Object.prototype.toString.apply(e)}function o(e){return"function"==typeof e}e.exports={isFunction:o,isArray:i,each:n}},function(e,t,n){var i=n(10),o=function(e){var t=/[height|width]$/;return t.test(e)},r=function(e){var t="",n=Object.keys(e);return n.forEach(function(r,s){var a=e[r];r=i(r),o(r)&&"number"==typeof a&&(a+="px"),t+=a===!0?r:a===!1?"not "+r:"("+r+": "+a+")",s<n.length-1&&(t+=" and ")}),t},s=function(e){var t="";return"string"==typeof e?e:e instanceof Array?(e.forEach(function(n,i){t+=r(n),i<e.length-1&&(t+=", ")}),t):r(e)};e.exports=s},function(e,t){var n=function(e){return e.replace(/[A-Z]/g,function(e){return"-"+e.toLowerCase()}).toLowerCase()};e.exports=n},function(e,t){"use strict";function n(e){return e.getBoundingClientRect().width||e.offsetWidth||0}function i(e){return e.getBoundingClientRect().height||e.offsetHeight||0}function o(e,t,n,i){var o=e-t,r=n-i,s=Math.round(180*Math.atan2(r,o)/Math.PI);return s<0&&(s=360-Math.abs(s)),s<=45&&s>=0?1:s<=360&&s>=315?1:s>=135&&s<=225?-1:0}function r(){return"ontouchstart"in document.documentElement}function s(e,t){return e-t}function a(){return window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth}Object.defineProperty(t,"__esModule",{value:!0}),t.getElementWidth=n,t.getElementHeight=i,t.getSwipeDirection=o,t.isTouchDevice=r,t.sortNumber=s,t.getScreenWidth=a},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var a=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),l=n(1),c=i(l),u=function(e){function t(){return o(this,t),r(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return s(t,e),a(t,[{key:"render",value:function(){var e=this.props.styles.InfiniteCarouselArrow,t=void 0;t=this.props.next?this.props.styles.InfiniteCarouselArrowNext:this.props.styles.InfiniteCarouselArrowPrev;var n=this.props.styles.InfiniteCarouselArrowIcon,i=void 0;return i=this.props.next?this.props.styles.InfiniteCarouselArrowNextIcon:this.props.styles.InfiniteCarouselArrowPrevIcon,c.default.createElement("button",{className:e+" "+t,onClick:this.props.onClick},c.default.createElement("i",{className:n+" "+i}))}}]),t}(l.Component);u.propTypes={next:l.PropTypes.bool,onClick:l.PropTypes.func.isRequired,styles:l.PropTypes.object.isRequired},u.defaultProps={next:!0},t.default=u},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var a=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),l=n(1),c=i(l),u=function(e){function t(){return o(this,t),r(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return s(t,e),a(t,[{key:"render",value:function(){for(var e=[],t=this.props.styles.InfiniteCarouselDots,n=this.props.styles.InfiniteCarouselDot,i=this.props.styles.InfiniteCarouselDotIcon,o=this.props.styles.InfiniteCarouselDotActiveIcon,r=0;r<this.props.numberOfDots;r+=1)e.push(c.default.createElement("li",{className:n,"data-index":r,key:r+1,onClick:this.props.onClick},c.default.createElement("i",{className:i+" "+(r===this.props.activePage?o:"")})));return c.default.createElement("ul",{className:t},e)}}]),t}(l.Component);u.propTypes={numberOfDots:l.PropTypes.number.isRequired,activePage:l.PropTypes.number.isRequired,onClick:l.PropTypes.func.isRequired,styles:l.PropTypes.object.isRequired},t.default=u},function(e,t,n){var i=n(15);"string"==typeof i&&(i=[[e.id,i,""]]);n(17)(i,{});i.locals&&(e.exports=i.locals)},function(e,t,n){t=e.exports=n(16)(),t.push([e.id,"._2Nde-b7zBqxE2c-pX-RLQr{position:relative}.CB9vby5YRbJWpv7hRrZ0x{width:100%;overflow:hidden}._22fNtVvEKNZkRmg_lseZsh{overflow-x:scroll;overflow-y:hidden;white-space:nowrap;-webkit-overflow-scrolling:touch;overflow:-moz-scrollbars-none;-webkit-box-sizing:border-box}._22fNtVvEKNZkRmg_lseZsh::-webkit-scrollbar{display:none}._2VaQi-Tq1LrSSO0_knReFa img{width:100%}._1JwaBMUCMsc8QmGrT7DX45{position:absolute;left:50%;bottom:0;padding:0;transform:translateX(-50%)}._3h8t2ML6KJ6OrCXmy0O_sN{display:inline-block;list-style:none;margin:0 5px;cursor:pointer}._37p1PaSm2K-Q8bMPwMJq9y{display:block;background-color:#e5e5e5;width:10px;height:10px;border-radius:50%}._2WFZTqYBc3N8MmmhMS5Dii{background-color:#48799a}._37Q_YD174b3Wq9o-IFVdKS{display:block;background:none;border:none;position:absolute;top:50%;z-index:2;outline:none;transform:translateY(-50%);cursor:pointer}._3kLq2S7iaEfJAxyyJqts35{left:15px;right:auto}._1-Hp0TfFuBlCxtdPUf_zEF{left:auto;right:15px}.GasrFbdQYtD26JnmJzJpj{display:inline-block;padding:10px;border:solid #e5e5e5;border-width:0 5px 5px 0}._1xZXGqNvuv0yzPtZbeydfd{transform:rotate(-45deg)}.wMWnjwePCo1SMTH0APGNJ{transform:rotate(135deg)}",""]),t.locals={InfiniteCarousel:"_2Nde-b7zBqxE2c-pX-RLQr",InfiniteCarouselFrame:"CB9vby5YRbJWpv7hRrZ0x",InfiniteCarouselScrollTrack:"_22fNtVvEKNZkRmg_lseZsh",InfiniteCarouselSlide:"_2VaQi-Tq1LrSSO0_knReFa",InfiniteCarouselDots:"_1JwaBMUCMsc8QmGrT7DX45",InfiniteCarouselDot:"_3h8t2ML6KJ6OrCXmy0O_sN",InfiniteCarouselDotIcon:"_37p1PaSm2K-Q8bMPwMJq9y",InfiniteCarouselDotActiveIcon:"_2WFZTqYBc3N8MmmhMS5Dii",InfiniteCarouselArrow:"_37Q_YD174b3Wq9o-IFVdKS",InfiniteCarouselArrowPrev:"_3kLq2S7iaEfJAxyyJqts35",InfiniteCarouselArrowNext:"_1-Hp0TfFuBlCxtdPUf_zEF",InfiniteCarouselArrowIcon:"GasrFbdQYtD26JnmJzJpj",InfiniteCarouselArrowNextIcon:"_1xZXGqNvuv0yzPtZbeydfd",InfiniteCarouselArrowPrevIcon:"wMWnjwePCo1SMTH0APGNJ"}},function(e,t){e.exports=function(){var e=[];return e.toString=function(){for(var e=[],t=0;t<this.length;t++){var n=this[t];n[2]?e.push("@media "+n[2]+"{"+n[1]+"}"):e.push(n[1])}return e.join("")},e.i=function(t,n){"string"==typeof t&&(t=[[null,t,""]]);for(var i={},o=0;o<this.length;o++){var r=this[o][0];"number"==typeof r&&(i[r]=!0)}for(o=0;o<t.length;o++){var s=t[o];"number"==typeof s[0]&&i[s[0]]||(n&&!s[2]?s[2]=n:n&&(s[2]="("+s[2]+") and ("+n+")"),e.push(s))}},e}},function(e,t,n){function i(e,t){for(var n=0;n<e.length;n++){var i=e[n],o=f[i.id];if(o){o.refs++;for(var r=0;r<o.parts.length;r++)o.parts[r](i.parts[r]);for(;r<i.parts.length;r++)o.parts.push(c(i.parts[r],t))}else{for(var s=[],r=0;r<i.parts.length;r++)s.push(c(i.parts[r],t));f[i.id]={id:i.id,refs:1,parts:s}}}}function o(e){for(var t=[],n={},i=0;i<e.length;i++){var o=e[i],r=o[0],s=o[1],a=o[2],l=o[3],c={css:s,media:a,sourceMap:l};n[r]?n[r].parts.push(c):t.push(n[r]={id:r,parts:[c]})}return t}function r(e,t){var n=g(),i=b[b.length-1];if("top"===e.insertAt)i?i.nextSibling?n.insertBefore(t,i.nextSibling):n.appendChild(t):n.insertBefore(t,n.firstChild),b.push(t);else{if("bottom"!==e.insertAt)throw new Error("Invalid value for parameter 'insertAt'. Must be 'top' or 'bottom'.");n.appendChild(t)}}function s(e){e.parentNode.removeChild(e);var t=b.indexOf(e);t>=0&&b.splice(t,1)}function a(e){var t=document.createElement("style");return t.type="text/css",r(e,t),t}function l(e){var t=document.createElement("link");return t.rel="stylesheet",r(e,t),t}function c(e,t){var n,i,o;if(t.singleton){var r=m++;n=y||(y=a(t)),i=u.bind(null,n,r,!1),o=u.bind(null,n,r,!0)}else e.sourceMap&&"function"==typeof URL&&"function"==typeof URL.createObjectURL&&"function"==typeof URL.revokeObjectURL&&"function"==typeof Blob&&"function"==typeof btoa?(n=l(t),i=p.bind(null,n),o=function(){s(n),n.href&&URL.revokeObjectURL(n.href)}):(n=a(t),i=d.bind(null,n),o=function(){s(n)});return i(e),function(t){if(t){if(t.css===e.css&&t.media===e.media&&t.sourceMap===e.sourceMap)return;i(e=t)}else o()}}function u(e,t,n,i){var o=n?"":i.css;if(e.styleSheet)e.styleSheet.cssText=w(t,o);else{var r=document.createTextNode(o),s=e.childNodes;s[t]&&e.removeChild(s[t]),s.length?e.insertBefore(r,s[t]):e.appendChild(r)}}function d(e,t){var n=t.css,i=t.media;if(i&&e.setAttribute("media",i),e.styleSheet)e.styleSheet.cssText=n;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(n))}}function p(e,t){var n=t.css,i=t.sourceMap;i&&(n+="\n/*# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(JSON.stringify(i))))+" */");var o=new Blob([n],{type:"text/css"}),r=e.href;e.href=URL.createObjectURL(o),r&&URL.revokeObjectURL(r)}var f={},h=function(e){var t;return function(){return"undefined"==typeof t&&(t=e.apply(this,arguments)),t}},v=h(function(){return/msie [6-9]\b/.test(self.navigator.userAgent.toLowerCase())}),g=h(function(){return document.head||document.getElementsByTagName("head")[0]}),y=null,m=0,b=[];e.exports=function(e,t){t=t||{},"undefined"==typeof t.singleton&&(t.singleton=v()),"undefined"==typeof t.insertAt&&(t.insertAt="bottom");var n=o(e);return i(n,t),function(e){for(var r=[],s=0;s<n.length;s++){var a=n[s],l=f[a.id];l.refs--,r.push(l)}if(e){var c=o(e);i(c,t)}for(var s=0;s<r.length;s++){var l=r[s];if(0===l.refs){for(var u=0;u<l.parts.length;u++)l.parts[u]();delete f[l.id]}}}};var w=function(){var e=[];return function(t,n){return e[t]=n,e.filter(Boolean).join("\n")}}()}])}); | ||
//# sourceMappingURL=react-infinite-carusel.min.js.map |
{ | ||
"name": "react-leaf-carousel", | ||
"version": "1.0.8", | ||
"version": "1.0.9", | ||
"description": "React simple infinite carousel with lazy loading and responsive support", | ||
@@ -5,0 +5,0 @@ "scripts": { |
@@ -698,8 +698,2 @@ import React, { | ||
getScrollTrackStyles = () => { | ||
let sideWidth; | ||
if (settings.showSides) { | ||
sideWidth = totalSlideWidth * this.state.sideSize; | ||
} else { | ||
sideWidth = 0; | ||
} | ||
return { | ||
@@ -714,3 +708,2 @@ clear: 'both', | ||
MozBoxSizing: 'border-box', | ||
marginLeft: `${sideWidth}px`, | ||
}; | ||
@@ -717,0 +710,0 @@ }; |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
244230
1407