react-simply-carousel
Advanced tools
Comparing version 2.1.0 to 2.1.1
@@ -1,1 +0,1 @@ | ||
!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.ReactSimplyCarousel=t(require("react")):e.ReactSimplyCarousel=t(e.React)}(window,(function(e){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=11)}([function(t,n){t.exports=e},function(e,t,n){var r=n(15);e.exports=function(e,t){if(null==e)return{};var n,o,i=r(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(o=0;o<s.length;o++)n=s[o],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}},function(e,t){function n(){return e.exports=n=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},n.apply(this,arguments)}e.exports=n},function(e,t,n){var r=n(19);"string"==typeof r&&(r=[[e.i,r,""]]);var o={insert:"head",singleton:!1};n(21)(r,o);r.locals&&(e.exports=r.locals)},function(e,t,n){var r=n(12),o=n(13),i=n(14);e.exports=function(e){return r(e)||o(e)||i()}},function(e,t){e.exports=function(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}},function(e,t){e.exports=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}},function(e,t){function n(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}e.exports=function(e,t,r){return t&&n(e.prototype,t),r&&n(e,r),e}},function(e,t,n){var r=n(16),o=n(17);e.exports=function(e,t){return!t||"object"!==r(t)&&"function"!=typeof t?o(e):t}},function(e,t){function n(t){return e.exports=n=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},n(t)}e.exports=n},function(e,t,n){var r=n(18);e.exports=function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&r(e,t)}},function(e,t,n){"use strict";n.r(t);var r=n(2),o=n.n(r),i=n(4),s=n.n(i),a=n(5),c=n.n(a),l=n(1),u=n.n(l),d=n(6),f=n.n(d),p=n(7),h=n.n(p),m=n(8),v=n.n(m),y=n(9),b=n.n(y),g=n(10),x=n.n(g),S=n(0),w=n.n(S),I=n(3),L=n.n(I);function P(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function C(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};if(t%2)for(var r=P(n,!0),o=0;o<r.length;o++)l=r[o],c()(e,l,n[l]);else if(Object.getOwnPropertyDescriptors)Object.defineProperties(e,Object.getOwnPropertyDescriptors(n));else for(var i=P(n),s=function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))},a=0;a<i.length;a++)s(i[a])}var l;return e}var O=function(e){function t(e){var n;return f()(this,t),(n=v()(this,b()(t).call(this,e))).getRenderProps=function(e,t){var n=e.windowWidth,r=t.responsiveProps,o=u()(t,["responsiveProps"]);if(!n)return o;var i=r.reduce((function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.minWidth,o=void 0===r?0:r,i=t.maxWidth,s=void 0===i?null:i,a=u()(t,["minWidth","maxWidth"]);return n>o&&(!s||n<=s)?C({},e,{},a):e}),o),s=S.Children.toArray(i.children).length;return C({},i,{activeSlideIndex:Math.max(0,Math.min(i.activeSlideIndex,s-1)),itemsToShow:Math.min(s,i.itemsToShow),itemsToScroll:Math.min(s,i.itemsToScroll)})},n.getInnerWidth=function(){var e=n.state.windowWidth,t=n.renderProps,r=t.activeSlideIndex,o=t.itemsToShow;return e&&o?n.slides.reduce((function(e,t,i){return i>=r&&i<r+o||i<r&&i<r+o-n.slides.length?e+t.offsetWidth:e}),0):null},n.getItemsListOffsetBySlideIndex=function(e){return n.slides.reduce((function(t,n,r){return r>=e?t:t+(n.offsetWidth||0)}),0)},n.getOffsetCorrectionForEdgeSlides=function(e,t){return t-e==0?0:"forward"===n.direction.toLowerCase()&&e<t?n.itemsListRef.current.offsetWidth/3:"backward"===n.direction.toLowerCase()&&e>t?-n.itemsListRef.current.offsetWidth/3:0},n.getSlideItemOnClick=function(e){var t=e.activeSlideIndex,r=e.direction,o=e.index,i=e.onClick;return function(e){var s=t<o?"forward":"",a=t>o?"backward":"";n.updateActiveSlideIndex(o,r||s||a),i&&i(e)}},n.getNextSlideIndex=function(e){var t=n.renderProps,r=t.activeSlideIndex,o=t.itemsToScroll,i=t.children,s=S.Children.count(i)-1;if("forward"===e){var a=r+o;return a>s?a-s-1:a}if("backward"===e){var c=r-o;return c<0?s+1+c:c}return r},n.updateActiveSlideIndex=function(e,t){var r=n.renderProps,o=r.activeSlideIndex,i=r.onRequestChange,s=r.speed,a=r.delay,c=r.easing;n.itemsListRef.current.style.transition=s||a?"transform ".concat(s,"ms ").concat(c," ").concat(a,"ms"):null,e!==o?(n.stopAutoplay(),n.direction=t,i(e)):(n.itemsListRef.current.style.transform="translateX(-".concat(n.itemsListRef.current.offsetWidth/3,"px)"),s||a||n.updatePositionIndex())},n.updatePositionIndex=function(){var e=n.renderProps,t=e.activeSlideIndex,r=e.onAfterChange,o=n.state.positionIndex;n.setState((function(){return{positionIndex:t}}),(function(){n.itemsListDragStartPos=null,n.isListDragging=!1,n.startAutoplay(),r&&r(t,o)}))},n.startAutoplay=function(){var e=n.renderProps,t=e.autoplay,r=e.autoplayDirection,o=e.delay;t&&(n.autoplayTimer=setTimeout((function(){n.updateActiveSlideIndex(n.getNextSlideIndex(r),r)}),o))},n.stopAutoplay=function(){clearTimeout(n.autoplayTimer)},n.handleInitializationEnd=function(){n.setState((function(){return{windowWidth:window.innerWidth}}),n.startAutoplay)},n.handleWindowResize=function(){clearTimeout(n.resizeTimer),n.resizeTimer=setTimeout(n.handleInitializationEnd,400)},n.handleContainerClickCapture=function(e){var t=n.renderProps.containerProps.onClickCapture;n.isListDragging&&(e.preventDefault(),e.stopPropagation(),t&&t(e))},n.handleBackwardBtnClick=function(){n.updateActiveSlideIndex(n.getNextSlideIndex("backward"),"backward")},n.handleForwardBtnClick=function(){n.updateActiveSlideIndex(n.getNextSlideIndex("forward"),"forward")},n.updateItemsListPosByDragPos=function(e){var t=n.itemsListDragStartPos-e+n.itemsListRef.current.offsetWidth/3,r=n.itemsListRef.current.offsetWidth-n.innerRef.current.offsetWidth,o=Math.max(Math.min(0,-t),-r);n.itemsListRef.current.style.transition="none",n.itemsListRef.current.style.transform="translateX(".concat(o,"px)")},n.handleItemsListDragEnd=function(e){var t=n.renderProps.activeSlideIndex,r=n.itemsListDragStartPos-e,o=n.slides[t].offsetWidth/2;r>o?n.updateActiveSlideIndex(n.getNextSlideIndex("forward"),"forward"):r<-o?n.updateActiveSlideIndex(n.getNextSlideIndex("backward"),"backward"):n.updateActiveSlideIndex(t,"forward")},n.handleItemsListMouseMove=function(e){n.isListDragging=!0,n.updateItemsListPosByDragPos(e.clientX)},n.handleItemsListMouseUp=function(e){document.removeEventListener("mousemove",n.handleItemsListMouseMove),document.removeEventListener("mouseup",n.handleItemsListMouseUp),n.isListDragging&&n.handleItemsListDragEnd(e.clientX)},n.handleItemsListMouseDown=function(e){n.stopAutoplay(),n.isListDragging||(n.itemsListDragStartPos=e.clientX,document.addEventListener("mousemove",n.handleItemsListMouseMove),document.addEventListener("mouseup",n.handleItemsListMouseUp))},n.handleItemsListTouchMove=function(e){n.isListDragging=!0,n.updateItemsListPosByDragPos(e.touches[0].clientX)},n.handleItemsListTouchEnd=function(e){document.removeEventListener("touchmove",n.handleItemsListTouchMove),document.removeEventListener("touchend",n.handleItemsListTouchEnd),n.isListDragging&&n.handleItemsListDragEnd(e.changedTouches[e.changedTouches.length-1].clientX)},n.handleItemsListTouchStart=function(e){n.stopAutoplay(),n.isListDragging||(n.itemsListDragStartPos=e.touches[0].clientX,document.addEventListener("touchmove",n.handleItemsListTouchMove),document.addEventListener("touchend",n.handleItemsListTouchEnd))},n.renderSlidesItems=function(e,t,r){for(var o,i,s,a,c,l,d,f,p,h,m,v,y,b,g,x=n.renderProps,S=x.activeSlideIndex,w=x.activeSlideProps,I=w.className,L=void 0===I?"":I,P=w.style,O=void 0===P?{}:P,T=u()(w,["className","style"]),k=x.updateOnItemClick,E=e,j=[],R=0;R<E.length;R++)j.push((o=E[R],i=R,s=void 0,a=void 0,c=void 0,l=void 0,d=void 0,f=void 0,p=void 0,h=void 0,m=void 0,v=void 0,y=void 0,b=void 0,g=void 0,s=o.props,a=(s=void 0===s?{}:s).className,c=void 0===a?"":a,l=s.onClick,d=s.style,f=void 0===d?{}:d,p=u()(s,["className","onClick","style"]),h=u()(o,["props"]),m=n.renderedSlidesCount>=n.slidesCount?"forward":"backward",v=i+t===S,y="".concat(c," ").concat(v?L:""),b=C({},f,{},v?O:{},{boxSizing:"border-box",margin:0}),g=C({role:"tabpanel",className:y,style:b,onClick:!r&&k?n.getSlideItemOnClick({activeSlideIndex:S,direction:m,index:i+t,onClick:l}):l},p,{},v?T:{}),n.renderedSlidesCount=n.renderedSlidesCount+1,C({props:g},h)));return j},n.containerRef=Object(S.createRef)(),n.innerRef=Object(S.createRef)(),n.itemsListRef=Object(S.createRef)(),n.autoplayTimer=null,n.itemsListDragStartPos=null,n.resizeTimer=null,n.direction="",n.slides=[],n.state={windowWidth:0,positionIndex:e.activeSlideIndex},n}return x()(t,e),h()(t,[{key:"componentDidMount",value:function(){this.handleInitializationEnd(),window.addEventListener("resize",this.handleWindowResize)}},{key:"componentDidUpdate",value:function(e,t){var n=this.getRenderProps(t,e).activeSlideIndex,r=this.renderProps,o=r.activeSlideIndex,i=r.speed,s=r.delay;o===n?this.direction="":i||s||this.updatePositionIndex()}},{key:"componentWillUnmount",value:function(){this.stopAutoplay(),clearTimeout(this.resizeTimer),window.removeEventListener("resize",this.handleWindowResize),document.removeEventListener("mousemove",this.handleItemsListMouseMove),document.removeEventListener("mouseup",this.handleItemsListMouseUp),document.removeEventListener("touchmove",this.handleItemsListTouchMove),document.removeEventListener("touchend",this.handleItemsListTouchEnd)}},{key:"render",value:function(){var e=this.state,t=e.windowWidth,n=e.positionIndex;this.renderProps=this.getRenderProps(this.state,this.props);var r=this.renderProps,i=r.activeSlideIndex,a=r.backwardBtnProps,c=a.children,l=void 0===c?null:c,d=a.show,f=void 0===d||d,p=u()(a,["children","show"]),h=r.children,m=r.containerProps,v=m.className,y=void 0===v?"":v,b=(m.onClickCapture,u()(m,["className","onClickCapture"])),g=r.delay,x=r.disableNavIfAllVisible,I=r.easing,P=r.forwardBtnProps,O=P.children,T=void 0===O?null:O,k=P.show,E=void 0===k||k,j=u()(P,["children","show"]),R=r.hideNavIfAllVisible,M=r.innerProps,D=M.className,N=void 0===D?"":D,A=M.style,W=(A=void 0===A?{}:A).width,_=void 0===W?null:W,B=u()(A,["width"]),z=u()(M,["className","style"]),U=r.itemsListProps,F=U.className,K=void 0===F?"":F,J=U.style,X=void 0===J?{}:J,V=(U.onTouchStart,U.onMouseDown,U.onTransitionEnd,u()(U,["className","style","onTouchStart","onMouseDown","onTransitionEnd"])),q=r.itemsToShow,G=r.speed,Q=S.Children.toArray(h);this.slides=t?s()(this.itemsListRef.current.children).slice(Q.length-n,Q.length-n+Q.length):[];var H=this.getInnerWidth(),Z=q===Q.length,Y=R&&Z,$=x&&Z,ee=i-n!=0,te=t&&ee?this.getItemsListOffsetBySlideIndex(n):0,ne=t&&ee?this.getItemsListOffsetBySlideIndex(i):0,re=ee&&(G||g)?"transform ".concat(G,"ms ").concat(I," ").concat(g,"ms"):null,oe=$||!t?0:ne-te+this.getOffsetCorrectionForEdgeSlides(i,n)+this.itemsListRef.current.offsetWidth/3,ie=t?"translateX(-".concat(oe,"px)"):null;return this.slidesCount=Q.length,this.renderedSlidesCount=0,w.a.createElement("div",o()({className:"".concat(L.a.ReactJSSimpleCarousel," ").concat(y),onClickCapture:this.handleContainerClickCapture},b,{ref:this.containerRef}),f&&!Y&&w.a.createElement("button",o()({},p,{type:"button",onClick:this.handleBackwardBtnClick}),l),w.a.createElement("div",o()({className:"".concat(L.a.ReactJSSimpleCarousel__inner," ").concat(N),style:C({width:H?"".concat(H,"px"):_},B)},z,{ref:this.innerRef}),w.a.createElement("div",o()({className:"".concat(L.a.ReactJSSimpleCarousel__itemsList," ").concat(K),style:C({},X,{transition:re,transform:ie}),onTouchStart:$?null:this.handleItemsListTouchStart,onMouseDown:$?null:this.handleItemsListMouseDown,onTransitionEnd:G||g?this.updatePositionIndex:null,onDragStartCapture:this.handleItemsListMouseUp,tabIndex:"-1",role:"presentation"},V,{ref:this.itemsListRef}),!$&&this.renderSlidesItems(Q.slice(n),n),this.renderSlidesItems(Q,0,$),!$&&this.renderSlidesItems(Q,0),!$&&this.renderSlidesItems(Q.slice(0,n),0))),E&&!Y&&w.a.createElement("button",o()({},j,{type:"button",onClick:this.handleForwardBtnClick}),T))}}]),t}(S.Component);O.defaultProps={activeSlideProps:{},autoplay:!1,autoplayDirection:"forward",backwardBtnProps:{},children:null,containerProps:{},delay:0,disableNavIfAllVisible:!0,easing:"linear",forwardBtnProps:{},hideNavIfAllVisible:!0,innerProps:{},itemsListProps:{},itemsToScroll:1,itemsToShow:0,onAfterChange:null,responsiveProps:[],speed:0,updateOnItemClick:!1},t.default=O},function(e,t){e.exports=function(e){if(Array.isArray(e)){for(var t=0,n=new Array(e.length);t<e.length;t++)n[t]=e[t];return n}}},function(e,t){e.exports=function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}},function(e,t){e.exports=function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}},function(e,t){e.exports=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}},function(e,t){function n(e){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function r(t){return"function"==typeof Symbol&&"symbol"===n(Symbol.iterator)?e.exports=r=function(e){return n(e)}:e.exports=r=function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":n(e)},r(t)}e.exports=r},function(e,t){e.exports=function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}},function(e,t){function n(t,r){return e.exports=n=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},n(t,r)}e.exports=n},function(e,t,n){(t=e.exports=n(20)(!1)).push([e.i,"._1la421bxBQAeua6KKGZ1oQ {\n display: -webkit-box;\n display: flex;\n box-sizing: border-box;\n -webkit-box-pack: center;\n justify-content: center;\n}\n._1Wl9uwIG1ye40T5BD9Vc_F {\n box-sizing: border-box;\n display: -webkit-box;\n display: flex;\n -webkit-box-orient: horizontal;\n -webkit-box-direction: normal;\n flex-flow: row wrap;\n max-width: 100%;\n padding: 0;\n overflow: hidden;\n}\n.KViA7SkpESwNTmcWoOrK3 {\n box-sizing: border-box;\n display: -webkit-box;\n display: flex;\n outline: none;\n}\n._2uFs-3N4OgnK-dWyqEEMLs {\n box-sizing: border-box;\n text-align: center;\n width: 100%;\n}\n",""]),t.locals={ReactJSSimpleCarousel:"_1la421bxBQAeua6KKGZ1oQ",ReactJSSimpleCarousel__inner:"_1Wl9uwIG1ye40T5BD9Vc_F",ReactJSSimpleCarousel__itemsList:"KViA7SkpESwNTmcWoOrK3",ReactJSSimpleCarousel__dotsNav:"_2uFs-3N4OgnK-dWyqEEMLs"}},function(e,t,n){"use strict";e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n=function(e,t){var n=e[1]||"",r=e[3];if(!r)return n;if(t&&"function"==typeof btoa){var o=(s=r,a=btoa(unescape(encodeURIComponent(JSON.stringify(s)))),c="sourceMappingURL=data:application/json;charset=utf-8;base64,".concat(a),"/*# ".concat(c," */")),i=r.sources.map((function(e){return"/*# sourceURL=".concat(r.sourceRoot).concat(e," */")}));return[n].concat(i).concat([o]).join("\n")}var s,a,c;return[n].join("\n")}(t,e);return t[2]?"@media ".concat(t[2],"{").concat(n,"}"):n})).join("")},t.i=function(e,n){"string"==typeof e&&(e=[[null,e,""]]);for(var r={},o=0;o<this.length;o++){var i=this[o][0];null!=i&&(r[i]=!0)}for(var s=0;s<e.length;s++){var a=e[s];null!=a[0]&&r[a[0]]||(n&&!a[2]?a[2]=n:n&&(a[2]="(".concat(a[2],") and (").concat(n,")")),t.push(a))}},t}},function(e,t,n){"use strict";var r,o={},i=function(){return void 0===r&&(r=Boolean(window&&document&&document.all&&!window.atob)),r},s=function(){var e={};return function(t){if(void 0===e[t]){var n=document.querySelector(t);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}e[t]=n}return e[t]}}();function a(e,t){for(var n=[],r={},o=0;o<e.length;o++){var i=e[o],s=t.base?i[0]+t.base:i[0],a={css:i[1],media:i[2],sourceMap:i[3]};r[s]?r[s].parts.push(a):n.push(r[s]={id:s,parts:[a]})}return n}function c(e,t){for(var n=0;n<e.length;n++){var r=e[n],i=o[r.id],s=0;if(i){for(i.refs++;s<i.parts.length;s++)i.parts[s](r.parts[s]);for(;s<r.parts.length;s++)i.parts.push(v(r.parts[s],t))}else{for(var a=[];s<r.parts.length;s++)a.push(v(r.parts[s],t));o[r.id]={id:r.id,refs:1,parts:a}}}}function l(e){var t=document.createElement("style");if(void 0===e.attributes.nonce){var r=n.nc;r&&(e.attributes.nonce=r)}if(Object.keys(e.attributes).forEach((function(n){t.setAttribute(n,e.attributes[n])})),"function"==typeof e.insert)e.insert(t);else{var o=s(e.insert||"head");if(!o)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");o.appendChild(t)}return t}var u,d=(u=[],function(e,t){return u[e]=t,u.filter(Boolean).join("\n")});function f(e,t,n,r){var o=n?"":r.css;if(e.styleSheet)e.styleSheet.cssText=d(t,o);else{var i=document.createTextNode(o),s=e.childNodes;s[t]&&e.removeChild(s[t]),s.length?e.insertBefore(i,s[t]):e.appendChild(i)}}function p(e,t,n){var r=n.css,o=n.media,i=n.sourceMap;if(o&&e.setAttribute("media",o),i&&btoa&&(r+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),e.styleSheet)e.styleSheet.cssText=r;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(r))}}var h=null,m=0;function v(e,t){var n,r,o;if(t.singleton){var i=m++;n=h||(h=l(t)),r=f.bind(null,n,i,!1),o=f.bind(null,n,i,!0)}else n=l(t),r=p.bind(null,n,t),o=function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(n)};return r(e),function(t){if(t){if(t.css===e.css&&t.media===e.media&&t.sourceMap===e.sourceMap)return;r(e=t)}else o()}}e.exports=function(e,t){(t=t||{}).attributes="object"==typeof t.attributes?t.attributes:{},t.singleton||"boolean"==typeof t.singleton||(t.singleton=i());var n=a(e,t);return c(n,t),function(e){for(var r=[],i=0;i<n.length;i++){var s=n[i],l=o[s.id];l&&(l.refs--,r.push(l))}e&&c(a(e,t),t);for(var u=0;u<r.length;u++){var d=r[u];if(0===d.refs){for(var f=0;f<d.parts.length;f++)d.parts[f]();delete o[d.id]}}}}}])})); | ||
!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.ReactSimplyCarousel=t(require("react")):e.ReactSimplyCarousel=t(e.React)}(window,(function(e){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=11)}([function(t,n){t.exports=e},function(e,t,n){var r=n(15);e.exports=function(e,t){if(null==e)return{};var n,i,o=r(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(i=0;i<s.length;i++)n=s[i],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}},function(e,t){function n(){return e.exports=n=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},n.apply(this,arguments)}e.exports=n},function(e,t,n){var r=n(19);"string"==typeof r&&(r=[[e.i,r,""]]);var i={insert:"head",singleton:!1};n(21)(r,i);r.locals&&(e.exports=r.locals)},function(e,t,n){var r=n(12),i=n(13),o=n(14);e.exports=function(e){return r(e)||i(e)||o()}},function(e,t){e.exports=function(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}},function(e,t){e.exports=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}},function(e,t){function n(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}e.exports=function(e,t,r){return t&&n(e.prototype,t),r&&n(e,r),e}},function(e,t,n){var r=n(16),i=n(17);e.exports=function(e,t){return!t||"object"!==r(t)&&"function"!=typeof t?i(e):t}},function(e,t){function n(t){return e.exports=n=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},n(t)}e.exports=n},function(e,t,n){var r=n(18);e.exports=function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&r(e,t)}},function(e,t,n){"use strict";n.r(t);var r=n(2),i=n.n(r),o=n(4),s=n.n(o),a=n(5),c=n.n(a),l=n(1),u=n.n(l),d=n(6),f=n.n(d),p=n(7),m=n.n(p),h=n(8),v=n.n(h),y=n(9),b=n.n(y),g=n(10),x=n.n(g),S=n(0),w=n.n(S),I=n(3),L=n.n(I);function P(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function C(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};if(t%2)for(var r=P(n,!0),i=0;i<r.length;i++)l=r[i],c()(e,l,n[l]);else if(Object.getOwnPropertyDescriptors)Object.defineProperties(e,Object.getOwnPropertyDescriptors(n));else for(var o=P(n),s=function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))},a=0;a<o.length;a++)s(o[a])}var l;return e}var O=function(e){function t(e){var n;return f()(this,t),(n=v()(this,b()(t).call(this,e))).getRenderProps=function(e,t){var n=e.windowWidth,r=t.responsiveProps,i=u()(t,["responsiveProps"]);if(!n)return i;var o=r.reduce((function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.minWidth,i=void 0===r?0:r,o=t.maxWidth,s=void 0===o?null:o,a=u()(t,["minWidth","maxWidth"]);return n>i&&(!s||n<=s)?C({},e,{},a):e}),i),s=S.Children.toArray(o.children).length;return C({},o,{activeSlideIndex:Math.max(0,Math.min(o.activeSlideIndex,s-1)),itemsToShow:Math.min(s,o.itemsToShow),itemsToScroll:Math.min(s,o.itemsToScroll)})},n.getInnerWidth=function(){var e=n.state.windowWidth,t=n.renderProps,r=t.activeSlideIndex,i=t.itemsToShow;return e&&i?n.slides.reduce((function(e,t,o){return o>=r&&o<r+i||o<r&&o<r+i-n.slides.length?e+t.offsetWidth:e}),0):null},n.getItemsListOffsetBySlideIndex=function(e){return n.slides.reduce((function(t,n,r){return r>=e?t:t+(n.offsetWidth||0)}),0)},n.getOffsetCorrectionForEdgeSlides=function(e,t){return t-e==0?0:"forward"===n.direction.toLowerCase()&&e<t?n.itemsListRef.current.offsetWidth/3:"backward"===n.direction.toLowerCase()&&e>t?-n.itemsListRef.current.offsetWidth/3:0},n.getSlideItemOnClick=function(e){var t=e.activeSlideIndex,r=e.direction,i=e.index,o=e.onClick;return function(e){var s=t<i?"forward":"",a=t>i?"backward":"";n.updateActiveSlideIndex(i,r||s||a),o&&o(e)}},n.getNextSlideIndex=function(e){var t=n.renderProps,r=t.activeSlideIndex,i=t.itemsToScroll,o=t.children,s=S.Children.count(o)-1;if("forward"===e){var a=r+i;return a>s?a-s-1:a}if("backward"===e){var c=r-i;return c<0?s+1+c:c}return r},n.updateActiveSlideIndex=function(e,t){var r=n.renderProps,i=r.activeSlideIndex,o=r.onRequestChange,s=r.speed,a=r.delay,c=r.easing;n.itemsListRef.current.style.transition=s||a?"transform ".concat(s,"ms ").concat(c," ").concat(a,"ms"):null,e!==i?(n.stopAutoplay(),n.direction=t,o(e)):(n.itemsListRef.current.style.transform="translateX(-".concat(n.itemsListRef.current.offsetWidth/3,"px)"),s||a||n.updatePositionIndex())},n.updatePositionIndex=function(){var e=n.renderProps,t=e.activeSlideIndex,r=e.onAfterChange,i=n.state.positionIndex;n.setState((function(){return{positionIndex:t}}),(function(){n.itemsListDragStartPos=null,n.isListDragging=!1,n.startAutoplay(),r&&r(t,i)}))},n.startAutoplay=function(){var e=n.renderProps,t=e.autoplay,r=e.autoplayDirection,i=e.delay;t&&(n.autoplayTimer=setTimeout((function(){n.updateActiveSlideIndex(n.getNextSlideIndex(r),r)}),i))},n.stopAutoplay=function(){clearTimeout(n.autoplayTimer)},n.handleInitializationEnd=function(){n.setState((function(){return{windowWidth:window.innerWidth}}),n.startAutoplay)},n.handleWindowResize=function(){clearTimeout(n.resizeTimer),n.resizeTimer=setTimeout(n.handleInitializationEnd,400)},n.handleContainerClickCapture=function(e){var t=n.renderProps.containerProps.onClickCapture;n.isListDragging&&(e.preventDefault(),e.stopPropagation(),t&&t(e))},n.handleBackwardBtnClick=function(){n.updateActiveSlideIndex(n.getNextSlideIndex("backward"),"backward")},n.handleForwardBtnClick=function(){n.updateActiveSlideIndex(n.getNextSlideIndex("forward"),"forward")},n.updateItemsListPosByDragPos=function(e){var t=n.itemsListDragStartPos-e+n.itemsListRef.current.offsetWidth/3,r=n.itemsListRef.current.offsetWidth-n.innerRef.current.offsetWidth,i=Math.max(Math.min(0,-t),-r);n.itemsListRef.current.style.transition="none",n.itemsListRef.current.style.transform="translateX(".concat(i,"px)")},n.handleItemsListDragEnd=function(e){var t=n.renderProps.activeSlideIndex,r=n.itemsListDragStartPos-e,i=n.slides[t].offsetWidth/2;r>i?n.updateActiveSlideIndex(n.getNextSlideIndex("forward"),"forward"):r<-i?n.updateActiveSlideIndex(n.getNextSlideIndex("backward"),"backward"):n.updateActiveSlideIndex(t,"forward")},n.handleItemsListMouseMove=function(e){n.isListDragging=!0,n.updateItemsListPosByDragPos(e.clientX)},n.handleItemsListMouseUp=function(e){n.itemsListRef.current.removeEventListener("mouseout",n.handleItemsListMouseUp),n.itemsListRef.current.removeEventListener("dragstart",n.handleItemsListMouseUp),document.removeEventListener("mousemove",n.handleItemsListMouseMove),document.removeEventListener("mouseup",n.handleItemsListMouseUp),n.isListDragging&&n.handleItemsListDragEnd(e.clientX)},n.handleItemsListMouseDown=function(e){n.stopAutoplay(),n.isListDragging||(n.itemsListDragStartPos=e.clientX,document.addEventListener("mousemove",n.handleItemsListMouseMove),document.addEventListener("mouseup",n.handleItemsListMouseUp),n.itemsListRef.current.addEventListener("mouseout",n.handleItemsListMouseUp),n.itemsListRef.current.addEventListener("dragstart",n.handleItemsListMouseUp))},n.handleItemsListTouchMove=function(e){n.isListDragging=!0,n.updateItemsListPosByDragPos(e.touches[0].clientX)},n.handleItemsListTouchEnd=function(e){document.removeEventListener("touchmove",n.handleItemsListTouchMove),document.removeEventListener("touchend",n.handleItemsListTouchEnd),n.isListDragging&&n.handleItemsListDragEnd(e.changedTouches[e.changedTouches.length-1].clientX)},n.handleItemsListTouchStart=function(e){n.stopAutoplay(),n.isListDragging||(n.itemsListDragStartPos=e.touches[0].clientX,document.addEventListener("touchmove",n.handleItemsListTouchMove),document.addEventListener("touchend",n.handleItemsListTouchEnd))},n.renderSlidesItems=function(e,t,r){for(var i,o,s,a,c,l,d,f,p,m,h,v,y,b,g,x=n.renderProps,S=x.activeSlideIndex,w=x.activeSlideProps,I=w.className,L=void 0===I?"":I,P=w.style,O=void 0===P?{}:P,E=u()(w,["className","style"]),T=x.updateOnItemClick,R=e,k=[],M=0;M<R.length;M++)k.push((i=R[M],o=M,s=void 0,a=void 0,c=void 0,l=void 0,d=void 0,f=void 0,p=void 0,m=void 0,h=void 0,v=void 0,y=void 0,b=void 0,g=void 0,s=i.props,a=(s=void 0===s?{}:s).className,c=void 0===a?"":a,l=s.onClick,d=s.style,f=void 0===d?{}:d,p=u()(s,["className","onClick","style"]),m=u()(i,["props"]),h=n.renderedSlidesCount>=n.slidesCount?"forward":"backward",v=o+t===S,y="".concat(c," ").concat(v?L:""),b=C({},f,{},v?O:{},{boxSizing:"border-box",margin:0}),g=C({role:"tabpanel",className:y,style:b,onClick:!r&&T?n.getSlideItemOnClick({activeSlideIndex:S,direction:h,index:o+t,onClick:l}):l},p,{},v?E:{}),n.renderedSlidesCount=n.renderedSlidesCount+1,C({props:g},m)));return k},n.containerRef=Object(S.createRef)(),n.innerRef=Object(S.createRef)(),n.itemsListRef=Object(S.createRef)(),n.autoplayTimer=null,n.itemsListDragStartPos=null,n.resizeTimer=null,n.direction="",n.slides=[],n.state={windowWidth:0,positionIndex:e.activeSlideIndex},n}return x()(t,e),m()(t,[{key:"componentDidMount",value:function(){this.handleInitializationEnd(),window.addEventListener("resize",this.handleWindowResize)}},{key:"componentDidUpdate",value:function(e,t){var n=this.getRenderProps(t,e).activeSlideIndex,r=this.renderProps,i=r.activeSlideIndex,o=r.speed,s=r.delay;i===n?this.direction="":o||s||this.updatePositionIndex()}},{key:"componentWillUnmount",value:function(){this.stopAutoplay(),clearTimeout(this.resizeTimer),window.removeEventListener("resize",this.handleWindowResize),document.removeEventListener("mousemove",this.handleItemsListMouseMove),document.removeEventListener("mouseup",this.handleItemsListMouseUp),document.removeEventListener("touchmove",this.handleItemsListTouchMove),document.removeEventListener("touchend",this.handleItemsListTouchEnd),this.itemsListRef.current.removeEventListener("mouseout",this.handleItemsListMouseUp),this.itemsListRef.current.removeEventListener("dragstart",this.handleItemsListMouseUp)}},{key:"render",value:function(){var e=this.state,t=e.windowWidth,n=e.positionIndex;this.renderProps=this.getRenderProps(this.state,this.props);var r=this.renderProps,o=r.activeSlideIndex,a=r.backwardBtnProps,c=a.children,l=void 0===c?null:c,d=a.show,f=void 0===d||d,p=u()(a,["children","show"]),m=r.children,h=r.containerProps,v=h.className,y=void 0===v?"":v,b=(h.onClickCapture,u()(h,["className","onClickCapture"])),g=r.delay,x=r.disableNavIfAllVisible,I=r.easing,P=r.forwardBtnProps,O=P.children,E=void 0===O?null:O,T=P.show,R=void 0===T||T,k=u()(P,["children","show"]),M=r.hideNavIfAllVisible,j=r.innerProps,D=j.className,N=void 0===D?"":D,A=j.style,W=(A=void 0===A?{}:A).width,_=void 0===W?null:W,B=u()(A,["width"]),z=u()(j,["className","style"]),U=r.itemsListProps,F=U.className,K=void 0===F?"":F,J=U.style,X=void 0===J?{}:J,V=(U.onTouchStart,U.onMouseDown,U.onTransitionEnd,u()(U,["className","style","onTouchStart","onMouseDown","onTransitionEnd"])),q=r.itemsToShow,G=r.speed,Q=S.Children.toArray(m);this.slides=t?s()(this.itemsListRef.current.children).slice(Q.length-n,Q.length-n+Q.length):[];var H=this.getInnerWidth(),Z=q===Q.length,Y=M&&Z,$=x&&Z,ee=o-n!=0,te=t&&ee?this.getItemsListOffsetBySlideIndex(n):0,ne=t&&ee?this.getItemsListOffsetBySlideIndex(o):0,re=ee&&(G||g)?"transform ".concat(G,"ms ").concat(I," ").concat(g,"ms"):null,ie=$||!t?0:ne-te+this.getOffsetCorrectionForEdgeSlides(o,n)+this.itemsListRef.current.offsetWidth/3,oe=t?"translateX(-".concat(ie,"px)"):null;return this.slidesCount=Q.length,this.renderedSlidesCount=0,w.a.createElement("div",i()({className:"".concat(L.a.ReactJSSimpleCarousel," ").concat(y),onClickCapture:this.handleContainerClickCapture},b,{ref:this.containerRef}),f&&!Y&&w.a.createElement("button",i()({},p,{type:"button",onClick:this.handleBackwardBtnClick}),l),w.a.createElement("div",i()({className:"".concat(L.a.ReactJSSimpleCarousel__inner," ").concat(N),style:C({width:H?"".concat(H,"px"):_},B)},z,{ref:this.innerRef}),w.a.createElement("div",i()({className:"".concat(L.a.ReactJSSimpleCarousel__itemsList," ").concat(K),style:C({},X,{transition:re,transform:oe}),onTouchStart:$?null:this.handleItemsListTouchStart,onMouseDown:$?null:this.handleItemsListMouseDown,onTransitionEnd:G||g?this.updatePositionIndex:null,tabIndex:"-1",role:"presentation"},V,{ref:this.itemsListRef}),!$&&this.renderSlidesItems(Q.slice(n),n),this.renderSlidesItems(Q,0,$),!$&&this.renderSlidesItems(Q,0),!$&&this.renderSlidesItems(Q.slice(0,n),0))),R&&!Y&&w.a.createElement("button",i()({},k,{type:"button",onClick:this.handleForwardBtnClick}),E))}}]),t}(S.Component);O.defaultProps={activeSlideProps:{},autoplay:!1,autoplayDirection:"forward",backwardBtnProps:{},centerMode:!1,children:null,containerProps:{},delay:0,disableNavIfAllVisible:!0,easing:"linear",forwardBtnProps:{},hideNavIfAllVisible:!0,innerProps:{},itemsListProps:{},itemsToScroll:1,itemsToShow:0,onAfterChange:null,responsiveProps:[],speed:0,updateOnItemClick:!1},t.default=O},function(e,t){e.exports=function(e){if(Array.isArray(e)){for(var t=0,n=new Array(e.length);t<e.length;t++)n[t]=e[t];return n}}},function(e,t){e.exports=function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}},function(e,t){e.exports=function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}},function(e,t){e.exports=function(e,t){if(null==e)return{};var n,r,i={},o=Object.keys(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||(i[n]=e[n]);return i}},function(e,t){function n(e){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function r(t){return"function"==typeof Symbol&&"symbol"===n(Symbol.iterator)?e.exports=r=function(e){return n(e)}:e.exports=r=function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":n(e)},r(t)}e.exports=r},function(e,t){e.exports=function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}},function(e,t){function n(t,r){return e.exports=n=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},n(t,r)}e.exports=n},function(e,t,n){(t=e.exports=n(20)(!1)).push([e.i,"._1la421bxBQAeua6KKGZ1oQ {\n display: -webkit-box;\n display: flex;\n box-sizing: border-box;\n -webkit-box-pack: center;\n justify-content: center;\n}\n._1Wl9uwIG1ye40T5BD9Vc_F {\n box-sizing: border-box;\n display: -webkit-box;\n display: flex;\n -webkit-box-orient: horizontal;\n -webkit-box-direction: normal;\n flex-flow: row wrap;\n max-width: 100%;\n padding: 0;\n overflow: hidden;\n}\n.KViA7SkpESwNTmcWoOrK3 {\n box-sizing: border-box;\n display: -webkit-box;\n display: flex;\n outline: none;\n}\n._2uFs-3N4OgnK-dWyqEEMLs {\n box-sizing: border-box;\n text-align: center;\n width: 100%;\n}\n",""]),t.locals={ReactJSSimpleCarousel:"_1la421bxBQAeua6KKGZ1oQ",ReactJSSimpleCarousel__inner:"_1Wl9uwIG1ye40T5BD9Vc_F",ReactJSSimpleCarousel__itemsList:"KViA7SkpESwNTmcWoOrK3",ReactJSSimpleCarousel__dotsNav:"_2uFs-3N4OgnK-dWyqEEMLs"}},function(e,t,n){"use strict";e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n=function(e,t){var n=e[1]||"",r=e[3];if(!r)return n;if(t&&"function"==typeof btoa){var i=(s=r,a=btoa(unescape(encodeURIComponent(JSON.stringify(s)))),c="sourceMappingURL=data:application/json;charset=utf-8;base64,".concat(a),"/*# ".concat(c," */")),o=r.sources.map((function(e){return"/*# sourceURL=".concat(r.sourceRoot).concat(e," */")}));return[n].concat(o).concat([i]).join("\n")}var s,a,c;return[n].join("\n")}(t,e);return t[2]?"@media ".concat(t[2],"{").concat(n,"}"):n})).join("")},t.i=function(e,n){"string"==typeof e&&(e=[[null,e,""]]);for(var r={},i=0;i<this.length;i++){var o=this[i][0];null!=o&&(r[o]=!0)}for(var s=0;s<e.length;s++){var a=e[s];null!=a[0]&&r[a[0]]||(n&&!a[2]?a[2]=n:n&&(a[2]="(".concat(a[2],") and (").concat(n,")")),t.push(a))}},t}},function(e,t,n){"use strict";var r,i={},o=function(){return void 0===r&&(r=Boolean(window&&document&&document.all&&!window.atob)),r},s=function(){var e={};return function(t){if(void 0===e[t]){var n=document.querySelector(t);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}e[t]=n}return e[t]}}();function a(e,t){for(var n=[],r={},i=0;i<e.length;i++){var o=e[i],s=t.base?o[0]+t.base:o[0],a={css:o[1],media:o[2],sourceMap:o[3]};r[s]?r[s].parts.push(a):n.push(r[s]={id:s,parts:[a]})}return n}function c(e,t){for(var n=0;n<e.length;n++){var r=e[n],o=i[r.id],s=0;if(o){for(o.refs++;s<o.parts.length;s++)o.parts[s](r.parts[s]);for(;s<r.parts.length;s++)o.parts.push(v(r.parts[s],t))}else{for(var a=[];s<r.parts.length;s++)a.push(v(r.parts[s],t));i[r.id]={id:r.id,refs:1,parts:a}}}}function l(e){var t=document.createElement("style");if(void 0===e.attributes.nonce){var r=n.nc;r&&(e.attributes.nonce=r)}if(Object.keys(e.attributes).forEach((function(n){t.setAttribute(n,e.attributes[n])})),"function"==typeof e.insert)e.insert(t);else{var i=s(e.insert||"head");if(!i)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");i.appendChild(t)}return t}var u,d=(u=[],function(e,t){return u[e]=t,u.filter(Boolean).join("\n")});function f(e,t,n,r){var i=n?"":r.css;if(e.styleSheet)e.styleSheet.cssText=d(t,i);else{var o=document.createTextNode(i),s=e.childNodes;s[t]&&e.removeChild(s[t]),s.length?e.insertBefore(o,s[t]):e.appendChild(o)}}function p(e,t,n){var r=n.css,i=n.media,o=n.sourceMap;if(i&&e.setAttribute("media",i),o&&btoa&&(r+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(o))))," */")),e.styleSheet)e.styleSheet.cssText=r;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(r))}}var m=null,h=0;function v(e,t){var n,r,i;if(t.singleton){var o=h++;n=m||(m=l(t)),r=f.bind(null,n,o,!1),i=f.bind(null,n,o,!0)}else n=l(t),r=p.bind(null,n,t),i=function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(n)};return r(e),function(t){if(t){if(t.css===e.css&&t.media===e.media&&t.sourceMap===e.sourceMap)return;r(e=t)}else i()}}e.exports=function(e,t){(t=t||{}).attributes="object"==typeof t.attributes?t.attributes:{},t.singleton||"boolean"==typeof t.singleton||(t.singleton=o());var n=a(e,t);return c(n,t),function(e){for(var r=[],o=0;o<n.length;o++){var s=n[o],l=i[s.id];l&&(l.refs--,r.push(l))}e&&c(a(e,t),t);for(var u=0;u<r.length;u++){var d=r[u];if(0===d.refs){for(var f=0;f<d.parts.length;f++)d.parts[f]();delete i[d.id]}}}}}])})); |
{ | ||
"name": "react-simply-carousel", | ||
"version": "2.1.0", | ||
"version": "2.1.1", | ||
"description": "Simple react.js carousel component", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
# react-simply-carousel | ||
![gzip size](https://img.badgesize.io/https://unpkg.com/react-simply-carousel/dist/index.js?compression=gzip) | ||
[![npm version](https://img.shields.io/npm/v/react-simply-carousel.svg?style=flat)](https://www.npmjs.com/package/react) | ||
![npm bundle size](https://img.shields.io/bundlephobia/minzip/react-simply-carousel?label=size) | ||
[![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/vadymshymko/react-simply-carousel/blob/master/LICENSE) | ||
@@ -12,3 +14,3 @@ Simple && small controlled React.js carousel component (touch enabled, infnite and responsive) | ||
* [Props](#props) | ||
* [Example](#example) | ||
* [Demo](#demo) | ||
@@ -98,4 +100,4 @@ ## Installation | ||
## Example | ||
## Demo | ||
See in `example` folder. (Clone this repo, go to `example` folder and run ```yarn start ``` | ||
[![Edit react-simply-carousel-demo](https://codesandbox.io/static/img/play-codesandbox.svg)](https://codesandbox.io/s/k0fxi?fontsize=14) |
@@ -6,3 +6,3 @@ import React, { Component, Children, createRef } from 'react'; | ||
class ReactJSSimpleCarousel extends Component { | ||
class ReactSimplyCarousel extends Component { | ||
static propTypes = { | ||
@@ -14,2 +14,3 @@ activeSlideIndex: PropTypes.number.isRequired, | ||
backwardBtnProps: PropTypes.objectOf(PropTypes.any), | ||
centerMode: PropTypes.bool, | ||
children: PropTypes.node, | ||
@@ -38,2 +39,3 @@ containerProps: PropTypes.objectOf(PropTypes.any), | ||
backwardBtnProps: {}, | ||
centerMode: false, | ||
children: null, | ||
@@ -103,2 +105,5 @@ containerProps: {}, | ||
document.removeEventListener('touchend', this.handleItemsListTouchEnd); | ||
this.itemsListRef.current.removeEventListener('mouseout', this.handleItemsListMouseUp); | ||
this.itemsListRef.current.removeEventListener('dragstart', this.handleItemsListMouseUp); | ||
} | ||
@@ -376,2 +381,5 @@ | ||
handleItemsListMouseUp = (event) => { | ||
this.itemsListRef.current.removeEventListener('mouseout', this.handleItemsListMouseUp); | ||
this.itemsListRef.current.removeEventListener('dragstart', this.handleItemsListMouseUp); | ||
document.removeEventListener('mousemove', this.handleItemsListMouseMove); | ||
@@ -393,2 +401,5 @@ document.removeEventListener('mouseup', this.handleItemsListMouseUp); | ||
document.addEventListener('mouseup', this.handleItemsListMouseUp); | ||
this.itemsListRef.current.addEventListener('mouseout', this.handleItemsListMouseUp); | ||
this.itemsListRef.current.addEventListener('dragstart', this.handleItemsListMouseUp); | ||
} | ||
@@ -601,2 +612,3 @@ }; | ||
> | ||
{/* eslint-disable-next-line jsx-a11y/mouse-events-have-key-events */} | ||
<div | ||
@@ -612,3 +624,2 @@ className={`${styles.ReactJSSimpleCarousel__itemsList} ${itemsListClassName}`} | ||
onTransitionEnd={speed || delay ? this.updatePositionIndex : null} | ||
onDragStartCapture={this.handleItemsListMouseUp} | ||
tabIndex="-1" | ||
@@ -640,2 +651,2 @@ role="presentation" | ||
export default ReactJSSimpleCarousel; | ||
export default ReactSimplyCarousel; |
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
48270
535
102