react-simply-carousel
Advanced tools
Comparing version 8.3.0 to 8.3.1
@@ -1,1 +0,1 @@ | ||
import e,{memo as t,useState as n,useRef as r,Children as i,useCallback as o,useEffect as c}from"react";function a(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 u(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?a(Object(n),!0).forEach((function(t){d(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):a(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function d(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function l(){return l=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},l.apply(this,arguments)}function s(e,t){if(null==e)return{};var n,r,i=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}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function f(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,i,o=[],c=!0,a=!1;try{for(n=n.call(e);!(c=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);c=!0);}catch(e){a=!0,i=e}finally{try{c||null==n.return||n.return()}finally{if(a)throw i}}return o}(e,t)||v(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function m(e){return function(e){if(Array.isArray(e))return h(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||v(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function v(e,t){if(e){if("string"==typeof e)return h(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?h(e,t):void 0}}function h(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var p=["responsiveProps"],b=["minWidth","maxWidth"],y=["style","onClickCapture"],w=["style"],g=["style","onTouchStart","onMouseDown","onTransitionEnd"],x=["children","show"],E=["children","show"],S=["className","style"],I=["className","style"],C=["className","onClick","style"],O=["props"];function L(e){var t=e.infinite,n=e.positionIndex,r=e.itemsListRef;return t?m(r.current.children).slice(r.current.children.length/3-n,r.current.children.length/3-n+r.current.children.length/3):m(r.current.children)}function T(e){var t=e.activeSlideIndex,n=e.itemsListRef,r=e.innerRef,i=e.offsetCorrectionForCenterMode,o=e.offsetCorrectionForInfiniteMode,c=e.infinite,a=e.positionIndex,u=e.innerMaxWidth,d=L({infinite:c,positionIndex:a,itemsListRef:n}),l=c?o+i:Math.min(n.current.offsetWidth-(u||r.current.offsetWidth),d.reduce((function(e,n,r){return r<t?e+n.offsetWidth:e}),0)),s=l+(u||r.current.offsetWidth),f=c?[].concat(m(d.slice(t).map((function(e,n){return{slideIndex:n+t,htmlElement:e}}))),m(d.map((function(e,t){return{slideIndex:t,htmlElement:e}}))),m(d.map((function(e,t){return{slideIndex:t,htmlElement:e}}))),m(d.slice(0,t).map((function(e,t){return{slideIndex:t,htmlElement:e}})))):d.map((function(e,t){return{slideIndex:t,htmlElement:e}})),v=f.reduce((function(e,t){var n=t.slideIndex,r=t.htmlElement.offsetWidth;return(e.summ>=l&&e.summ<s||e.summ+r>l&&e.summ+r<=s)&&e.items.push({slideIndex:n,isFullyVisible:e.summ+r<=s&&e.summ>=l}),e.summ+=r,e}),{summ:0,items:[]}),h=!!v.items.find((function(e){return 0===e.slideIndex})),p=!!v.items.find((function(e){return e.slideIndex===d.length-1}));return{visibleSlides:v.items,isFirstSlideVisible:h,isLastSlideVisible:p}}function k(t){var a=t.responsiveProps,d=void 0===a?[]:a,m=s(t,p),v=f(n(0),2),h=v[0],k=v[1],M=f(n(m.activeSlideIndex),2),W=M[0],P=M[1],j=r(null),A=r(null),N=r(null),F=r(0),R=r(!1),D=r(""),X=r(null),V=r(null),z=r(0),B=r(W),q=d.reduce((function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.minWidth,r=void 0===n?0:n,i=t.maxWidth,o=void 0===i?null:i,c=s(t,b);return h>r&&(!o||h<=o)?u(u({},e),c):e}),m),U=i.toArray(q.children),$=h?u(u({},q),{},{activeSlideIndex:Math.max(0,Math.min(q.activeSlideIndex,U.length-1)),itemsToShow:Math.min(U.length,q.itemsToShow||0),itemsToScroll:Math.min(U.length,q.itemsToScroll||1)}):m,G=$.containerProps,H=(G=void 0===G?{}:G).style,J=void 0===H?{}:H,K=G.onClickCapture,Q=void 0===K?null:K,Y=s(G,y),Z=$.innerProps,_=(Z=void 0===Z?{}:Z).style,ee=void 0===_?{}:_,te=s(Z,w),ne=$.itemsListProps,re=(ne=void 0===ne?{}:ne).style,ie=void 0===re?{}:re,oe=ne.onTouchStart,ce=void 0===oe?null:oe,ae=ne.onMouseDown,ue=void 0===ae?null:ae,de=ne.onTransitionEnd,le=void 0===de?null:de,se=s(ne,g),fe=$.backwardBtnProps,me=(fe=void 0===fe?{}:fe).children,ve=void 0===me?null:me,he=fe.show,pe=void 0===he||he,be=s(fe,x),ye=$.forwardBtnProps,we=(ye=void 0===ye?{}:ye).children,ge=void 0===we?null:we,xe=ye.show,Ee=void 0===xe||xe,Se=s(ye,E),Ie=$.activeSlideProps,Ce=(Ie=void 0===Ie?{}:Ie).className,Oe=void 0===Ce?"":Ce,Le=Ie.style,Te=void 0===Le?{}:Le,ke=s(Ie,S),Me=$.visibleSlideProps,We=(Me=void 0===Me?{}:Me).className,Pe=void 0===We?"":We,je=Me.style,Ae=void 0===je?{}:je,Ne=s(Me,I),Fe=$.updateOnItemClick,Re=void 0!==Fe&&Fe,De=$.activeSlideIndex,Xe=$.onRequestChange,Ve=$.speed,ze=void 0===Ve?0:Ve,Be=$.delay,qe=void 0===Be?0:Be,Ue=$.easing,$e=void 0===Ue?"linear":Ue,Ge=$.itemsToShow,He=void 0===Ge?0:Ge,Je=$.itemsToScroll,Ke=void 0===Je?1:Je,Qe=$.children,Ye=$.onAfterChange,Ze=$.autoplay,_e=void 0!==Ze&&Ze,et=$.autoplayDirection,tt=void 0===et?"forward":et,nt=$.disableNavIfAllVisible,rt=void 0===nt||nt,it=$.hideNavIfAllVisible,ot=void 0===it||it,ct=$.centerMode,at=void 0!==ct&&ct,ut=$.infinite,dt=void 0===ut||ut,lt=$.disableNavIfEdgeVisible,st=void 0===lt||lt,ft=$.disableNavIfEdgeActive,mt=void 0===ft||ft,vt=$.dotsNav,ht=void 0===vt?{}:vt,pt=$.persistentChangeCallbacks,bt=void 0!==pt&&pt;$.showSlidesBeforeInit;var yt=ht||{},wt=yt.show,gt=void 0!==wt&&wt,xt=yt.containerProps,Et=void 0===xt?{}:xt,St=yt.itemBtnProps,It=void 0===St?{}:St,Ct=yt.activeItemBtnProps,Ot=void 0===Ct?{}:Ct,Lt=h?L({infinite:dt,positionIndex:B.current,itemsListRef:N}):[],Tt=h&&He?Lt.reduce((function(e,t,n){return n>=De&&n<De+He||n<De&&n<De+He-Lt.length?e+t.offsetWidth:e}),0):0,kt=h?N.current.offsetWidth-(Tt||A.current.offsetWidth):0,Mt=function(e){var t=Lt.reduce((function(t,n,r){return r>=e?t:t+(n.offsetWidth||0)}),0);return dt?t:Math.min(kt,t)},Wt=i.count(Qe)-1,Pt=He===U.length,jt=ot&&Pt,At=rt&&Pt,Nt=De-W!=0,Ft=h&&Nt&&dt?Mt(W):0,Rt=!h||!Nt&&dt?0:Mt(De),Dt=h?Lt[De].offsetWidth:0,Xt=h&&(at&&dt)?-((Tt||A.current.offsetWidth)-Dt)/2:0,Vt=dt&&h?N.current.offsetWidth/3:0,zt=W-De!=0&&N.current?"forward"===D.current.toLowerCase()&&De<W?Vt:"backward"===D.current.toLowerCase()&&De>W?-Vt:0:0,Bt=Nt&&(ze||qe)?"transform ".concat(ze,"ms ").concat($e," ").concat(qe,"ms"):"none",qt=At||!h?0:Rt-Ft+Xt+zt+Vt,Ut=h?"translateX(-".concat(qt,"px)"):"none",$t=h?T({activeSlideIndex:De,itemsListRef:N,innerRef:A,offsetCorrectionForCenterMode:Xt,infinite:dt,positionIndex:B.current,offsetCorrectionForInfiniteMode:Vt,innerMaxWidth:0}):{visibleSlides:[],isFirstSlideVisible:!1,isLastSlideVisible:!1},Gt=o((function(e){if("forward"===e){var t=De+Ke;return t>Wt?dt?t-Wt-1:De:t}if("backward"===e){var n=De-Ke;return n<0?dt?Wt+1+n:De:n}return De}),[De,Ke,Wt,dt]),Ht=o((function(e,t){D.current=t,N.current.style.transition=ze||qe?"transform ".concat(ze,"ms ").concat($e," ").concat(qe,"ms"):"none",e!==De||bt?(clearTimeout(X.current),Xe(e,T({activeSlideIndex:e,positionIndex:W,infinite:dt,innerRef:A,itemsListRef:N,offsetCorrectionForCenterMode:Xt,offsetCorrectionForInfiniteMode:Vt,innerMaxWidth:Tt}))):(F.current=0,N.current.style.transform="translateX(-".concat(Xt+Vt+(dt?0:qt),"px)"))}),[bt,De,Xt,qe,$e,ze,Xe,Vt,dt,qt,W,Tt]),Jt=o((function(){_e&&(clearTimeout(X.current),X.current=setTimeout((function(){Ht(Gt(tt),tt)}),qe))}),[_e,tt,Ht,Gt,qe]),Kt=o((function(e){R.current&&(e.preventDefault(),e.stopPropagation(),Q&&Q(e))}),[Q]),Qt=o((function(){Ht(Gt("backward"),"backward")}),[Ht,Gt]),Yt=o((function(e){R.current=!0;var t=e.touches&&e.touches[0]?e.touches[0].clientX:e.clientX,n=F.current-t+Xt+Vt+(dt?0:qt),r=N.current.offsetWidth-A.current.offsetWidth,i=Math.max(Math.min(0,-n),-r);N.current.style.transition="none",N.current.style.transform="translateX(".concat(i,"px)")}),[Xt,Vt,dt,qt]),Zt=o((function(e){if(N.current.removeEventListener("mouseout",Zt),N.current.removeEventListener("dragstart",Zt),document.removeEventListener("mousemove",Yt),document.removeEventListener("mouseup",Zt),document.removeEventListener("touchmove",Yt),document.removeEventListener("touchend",Zt),R.current){var t=e.changedTouches&&e.changedTouches.length?e.changedTouches[e.changedTouches.length-1].clientX:e.clientX,n=F.current-t;n>Dt/2?Ht(Gt("forward"),"forward"):n<-Dt/2?Ht(Gt("backward"),"backward"):Ht(De,"forward")}}),[De,Dt,Ht,Gt,Yt]),_t=o((function(e){clearTimeout(X.current),R.current||(F.current=e.clientX,document.addEventListener("mousemove",Yt),document.addEventListener("mouseup",Zt),N.current.addEventListener("mouseout",Zt),N.current.addEventListener("dragstart",Zt)),ue&&ue(e)}),[Yt,Zt,ue]),en=o((function(e){clearTimeout(X.current),R.current||(F.current=e.touches[0].clientX,document.addEventListener("touchmove",Yt),document.addEventListener("touchend",Zt)),ce&&ce(e)}),[Yt,Zt,ce]),tn=o((function(e){P(De),le&&le(e)}),[De,le]),nn=o((function(){Ht(Gt("forward"),"forward")}),[Ht,Gt]),rn=function(e,t,n){return e.map((function(e,r){var i=e.props,o=(i=void 0===i?{}:i).className,c=void 0===o?"":o,a=i.onClick,d=void 0===a?null:a,l=i.style,f=void 0===l?{}:l,m=s(i,C),v=s(e,O),h=dt?z.current>=U.length?"forward":"backward":r>=De?"forward":"backward",p=r+t===De,b=$t.visibleSlides.find((function(e){return e.slideIndex===r+t})),y="".concat(c," ").concat(h," ").concat(p?Oe:""," ").concat(b?Pe:""),w=u(u(u(u({},f),b?Ae:{}),p?Te:{}),{},{boxSizing:"border-box",margin:0}),g=!n&&Re?function(e){var t=e.direction,n=e.index,r=e.onClick;return function(e){Ht(n,t||(De<n?"forward":"")||(De>n?"backward":"")),r&&r(e)}}({direction:h,index:r+t,onClick:d}):d,x=u(u(u({role:"tabpanel",className:y,style:w,onClick:g},m),b?Ne:{}),p?ke:{});return z.current+=1,u({props:x},v)}))};return c((function(){return F.current=0,W===De&&(R.current=!1),D.current="",De!==W?ze||qe||P(De):(Ye&&Ye(De,W),(dt||"forward"===tt&&De!==Wt||"backward"===tt&&0!==De)&&Jt()),function(){clearTimeout(X.current)}}),[W,De,Ye,ze,qe,Jt,dt,Wt,tt]),c((function(){return h&&Jt(),function(){clearTimeout(X.current)}}),[h]),c((function(){var e=N.current;function t(){clearTimeout(V.current),clearTimeout(X.current),V.current=setTimeout((function(){h!==window.innerWidth&&k(window.innerWidth)}),400)}return h!==window.innerWidth&&k(window.innerWidth),window.addEventListener("resize",t),function(){clearTimeout(V.current),window.removeEventListener("resize",t),document.removeEventListener("mousemove",Yt),document.removeEventListener("mouseup",Zt),document.removeEventListener("touchmove",Yt),document.removeEventListener("touchend",Zt),e.removeEventListener("mouseout",Zt),e.removeEventListener("dragstart",Zt)}}),[Yt,Zt]),z.current=0,B.current=W,e.createElement("div",l({onClickCapture:Kt,style:u({display:"flex",flexFlow:"row wrap",boxSizing:"border-box",justifyContent:"center",width:"100%"},J)},Y,{ref:j}),pe&&!jt&&e.createElement("button",l({},be,{type:"button",onClick:(0===qt&&st||0===De&&mt)&&!dt?void 0:Qt,disabled:"boolean"==typeof be.disabled?be.disabled:!(!(0===qt&&st||0===De&&mt)||dt)}),ve),e.createElement("div",l({},te,{style:u(u({},ee),{},{display:"flex",boxSizing:"border-box",flexFlow:"row wrap",padding:"0",overflow:"hidden",maxWidth:Tt?"".concat(Tt,"px"):void 0,flex:Tt?void 0:"1 0"}),ref:A}),e.createElement("div",l({},se,{style:u(u({},ie),{},{display:"flex",boxSizing:"border-box",outline:"none",transition:Bt,transform:Ut}),"data-transform":Ut,onTouchStart:At?void 0:en,onMouseDown:At?void 0:_t,onTransitionEnd:ze||qe?tn:void 0,tabIndex:-1,role:"presentation",ref:N}),dt&&rn(U.slice(W),W,At),rn(U,0,At),dt&&rn(U,0,At),dt&&rn(U.slice(0,W),0,At))),Ee&&!jt&&e.createElement("button",l({},Se,{type:"button",onClick:(qt===kt&&st||De===Wt&&mt)&&!dt?void 0:nn,disabled:"boolean"==typeof Se.disabled?Se.disabled:!(!(qt===kt&&st||De===Wt&&mt)||dt)}),ge),!!gt&&e.createElement("div",l({style:{width:"100%",display:"flex",justifyContent:"center"}},Et),Array.from({length:Math.ceil(U.length/Ke)}).map((function(t,n){return e.createElement("button",l({type:"button",key:n,title:"".concat(n)},It,Math.min(n*Ke,U.length-1)===De?Ot:{},{onClick:function(){Ht(Math.min(n*Ke,U.length-1),Math.min(n*Ke,U.length-1)>De?"forward":"backward")}}))}))))}var M=t(k);export{M as default}; | ||
import e,{memo as t,useState as n,useRef as r,Children as i,useCallback as o,useEffect as c}from"react";function u(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 l(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?u(Object(n),!0).forEach((function(t){d(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):u(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function d(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(){return a=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},a.apply(this,arguments)}function s(e,t){if(null==e)return{};var n,r,i=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}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function f(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,i,o=[],c=!0,u=!1;try{for(n=n.call(e);!(c=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);c=!0);}catch(e){u=!0,i=e}finally{try{c||null==n.return||n.return()}finally{if(u)throw i}}return o}(e,t)||v(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function m(e){return function(e){if(Array.isArray(e))return h(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||v(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function v(e,t){if(e){if("string"==typeof e)return h(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?h(e,t):void 0}}function h(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var p=["responsiveProps"],b=["minWidth","maxWidth"],y=["style","onClickCapture"],w=["style"],g=["style","onTouchStart","onMouseDown","onTransitionEnd"],x=["children","show"],S=["children","show"],O=["className","style"],E=["className","style"],I=["className","onClick","style"],C=["props"];function T(e){var t=e.infinite,n=e.indexOfFirstSlideInDOM,r=e.itemsListRef;return t?m(r.current.children).slice(r.current.children.length/3-n,r.current.children.length/3-n+r.current.children.length/3):m(r.current.children)}function L(e){var t=e.activeSlideIndex,n=e.itemsListRef,r=e.innerRef,i=e.offsetCorrectionForCenterMode,o=e.offsetCorrectionForInfiniteMode,c=e.infinite,u=e.indexOfFirstSlideInDOM,l=e.itemsToShow,d=T({infinite:c,indexOfFirstSlideInDOM:u,itemsListRef:n}),a=l?d.reduce((function(e,n,r){return r>=t&&r<t+l||r<t&&r<t+l-d.length?e+n.offsetWidth:e}),0):r.current.offsetWidth,s=c?o+i:Math.min(n.current.offsetWidth-a,d.reduce((function(e,n,r){return r<t?e+n.offsetWidth:e}),0)),f=s+a,v=c?[].concat(m(d.slice(t).map((function(e,n){return{slideIndex:n+t,htmlElement:e}}))),m(d.map((function(e,t){return{slideIndex:t,htmlElement:e}}))),m(d.map((function(e,t){return{slideIndex:t,htmlElement:e}}))),m(d.slice(0,t).map((function(e,t){return{slideIndex:t,htmlElement:e}})))):d.map((function(e,t){return{slideIndex:t,htmlElement:e}})),h=v.reduce((function(e,t){var n=t.slideIndex,r=t.htmlElement.offsetWidth;return(e.summ>=s&&e.summ<f||e.summ+r>s&&e.summ+r<=f)&&e.items.push({slideIndex:n,isFullyVisible:e.summ+r<=f&&e.summ>=s}),e.summ+=r,e}),{summ:0,items:[]}),p=!!h.items.find((function(e){return 0===e.slideIndex})),b=!!h.items.find((function(e){return e.slideIndex===d.length-1}));return{visibleSlides:h.items,isFirstSlideVisible:p,isLastSlideVisible:b}}function M(t){var u=t.responsiveProps,d=void 0===u?[]:u,m=s(t,p),v=f(n(0),2),h=v[0],M=v[1],k=f(n(m.activeSlideIndex),2),P=k[0],j=k[1],W=r(null),F=r(null),A=r(null),D=r(0),N=r(!1),R=r(""),X=r(null),V=r(null),z=r(0),B=r(P),q=d.reduce((function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.minWidth,r=void 0===n?0:n,i=t.maxWidth,o=void 0===i?null:i,c=s(t,b);return h>r&&(!o||h<=o)?l(l({},e),c):e}),m),U=i.toArray(q.children),$=h?l(l({},q),{},{activeSlideIndex:Math.max(0,Math.min(q.activeSlideIndex,U.length-1)),itemsToShow:Math.min(U.length,q.itemsToShow||0),itemsToScroll:Math.min(U.length,q.itemsToScroll||1)}):m,G=$.containerProps,H=(G=void 0===G?{}:G).style,J=void 0===H?{}:H,K=G.onClickCapture,Q=void 0===K?null:K,Y=s(G,y),Z=$.innerProps,_=(Z=void 0===Z?{}:Z).style,ee=void 0===_?{}:_,te=s(Z,w),ne=$.itemsListProps,re=(ne=void 0===ne?{}:ne).style,ie=void 0===re?{}:re,oe=ne.onTouchStart,ce=void 0===oe?null:oe,ue=ne.onMouseDown,le=void 0===ue?null:ue,de=ne.onTransitionEnd,ae=void 0===de?null:de,se=s(ne,g),fe=$.backwardBtnProps,me=(fe=void 0===fe?{}:fe).children,ve=void 0===me?null:me,he=fe.show,pe=void 0===he||he,be=s(fe,x),ye=$.forwardBtnProps,we=(ye=void 0===ye?{}:ye).children,ge=void 0===we?null:we,xe=ye.show,Se=void 0===xe||xe,Oe=s(ye,S),Ee=$.activeSlideProps,Ie=(Ee=void 0===Ee?{}:Ee).className,Ce=void 0===Ie?"":Ie,Te=Ee.style,Le=void 0===Te?{}:Te,Me=s(Ee,O),ke=$.visibleSlideProps,Pe=(ke=void 0===ke?{}:ke).className,je=void 0===Pe?"":Pe,We=ke.style,Fe=void 0===We?{}:We,Ae=s(ke,E),De=$.updateOnItemClick,Ne=void 0!==De&&De,Re=$.activeSlideIndex,Xe=$.onRequestChange,Ve=$.speed,ze=void 0===Ve?0:Ve,Be=$.delay,qe=void 0===Be?0:Be,Ue=$.easing,$e=void 0===Ue?"linear":Ue,Ge=$.itemsToShow,He=void 0===Ge?0:Ge,Je=$.itemsToScroll,Ke=void 0===Je?1:Je,Qe=$.children,Ye=$.onAfterChange,Ze=$.autoplay,_e=void 0!==Ze&&Ze,et=$.autoplayDirection,tt=void 0===et?"forward":et,nt=$.disableNavIfAllVisible,rt=void 0===nt||nt,it=$.hideNavIfAllVisible,ot=void 0===it||it,ct=$.centerMode,ut=void 0!==ct&&ct,lt=$.infinite,dt=void 0===lt||lt,at=$.disableNavIfEdgeVisible,st=void 0===at||at,ft=$.disableNavIfEdgeActive,mt=void 0===ft||ft,vt=$.dotsNav,ht=void 0===vt?{}:vt,pt=$.persistentChangeCallbacks,bt=void 0!==pt&&pt,yt=ht||{},wt=yt.show,gt=void 0!==wt&&wt,xt=yt.containerProps,St=void 0===xt?{}:xt,Ot=yt.itemBtnProps,Et=void 0===Ot?{}:Ot,It=yt.activeItemBtnProps,Ct=void 0===It?{}:It,Tt=h?T({infinite:dt,indexOfFirstSlideInDOM:B.current,itemsListRef:A}):[],Lt=h&&He?Tt.reduce((function(e,t,n){return n>=Re&&n<Re+He||n<Re&&n<Re+He-Tt.length?e+t.offsetWidth:e}),0):0,Mt=h?A.current.offsetWidth-(Lt||F.current.offsetWidth):0,kt=function(e){var t=Tt.reduce((function(t,n,r){return r>=e?t:t+(n.offsetWidth||0)}),0);return dt?t:Math.min(Mt,t)},Pt=i.count(Qe)-1,jt=He===U.length,Wt=ot&&jt,Ft=rt&&jt,At=Re-P!=0,Dt=h&&At&&dt?kt(P):0,Nt=!h||!At&&dt?0:kt(Re),Rt=h?Tt[Re].offsetWidth:0,Xt=h&&(ut&&dt)?-((Lt||F.current.offsetWidth)-Rt)/2:0,Vt=dt&&h?A.current.offsetWidth/3:0,zt=P-Re!=0&&A.current?"forward"===R.current.toLowerCase()&&Re<P?Vt:"backward"===R.current.toLowerCase()&&Re>P?-Vt:0:0,Bt=At&&(ze||qe)?"transform ".concat(ze,"ms ").concat($e," ").concat(qe,"ms"):"none",qt=Ft||!h?0:Nt-Dt+Xt+zt+Vt,Ut=h?"translateX(-".concat(qt,"px)"):"none",$t=h?L({activeSlideIndex:Re,itemsListRef:A,innerRef:F,offsetCorrectionForCenterMode:Xt,infinite:dt,indexOfFirstSlideInDOM:B.current,offsetCorrectionForInfiniteMode:Vt,itemsToShow:He}):{visibleSlides:[],isFirstSlideVisible:!1,isLastSlideVisible:!1},Gt=o((function(e){if("forward"===e){var t=Re+Ke;return t>Pt?dt?t-Pt-1:Re:t}if("backward"===e){var n=Re-Ke;return n<0?dt?Pt+1+n:Re:n}return Re}),[Re,Ke,Pt,dt]),Ht=o((function(e,t){R.current=t,A.current.style.transition=ze||qe?"transform ".concat(ze,"ms ").concat($e," ").concat(qe,"ms"):"none",e!==Re||bt?(clearTimeout(X.current),Xe(e,L({activeSlideIndex:e,indexOfFirstSlideInDOM:P,infinite:dt,innerRef:F,itemsListRef:A,offsetCorrectionForCenterMode:Xt,offsetCorrectionForInfiniteMode:Vt,itemsToShow:He}))):(D.current=0,A.current.style.transform="translateX(-".concat(Xt+Vt+(dt?0:qt),"px)"))}),[bt,Re,Xt,qe,$e,ze,Xe,Vt,dt,qt,P,He]),Jt=o((function(){_e&&(clearTimeout(X.current),X.current=setTimeout((function(){Ht(Gt(tt),tt)}),qe))}),[_e,tt,Ht,Gt,qe]),Kt=o((function(e){N.current&&(e.preventDefault(),e.stopPropagation(),Q&&Q(e))}),[Q]),Qt=o((function(){Ht(Gt("backward"),"backward")}),[Ht,Gt]),Yt=o((function(e){N.current=!0;var t=e.touches&&e.touches[0]?e.touches[0].clientX:e.clientX,n=D.current-t+Xt+Vt+(dt?0:qt),r=A.current.offsetWidth-F.current.offsetWidth,i=Math.max(Math.min(0,-n),-r);A.current.style.transition="none",A.current.style.transform="translateX(".concat(i,"px)")}),[Xt,Vt,dt,qt]),Zt=o((function(e){if(A.current.removeEventListener("mouseout",Zt),A.current.removeEventListener("dragstart",Zt),document.removeEventListener("mousemove",Yt),document.removeEventListener("mouseup",Zt),document.removeEventListener("touchmove",Yt),document.removeEventListener("touchend",Zt),N.current){var t=e.changedTouches&&e.changedTouches.length?e.changedTouches[e.changedTouches.length-1].clientX:e.clientX,n=D.current-t;n>Rt/2?Ht(Gt("forward"),"forward"):n<-Rt/2?Ht(Gt("backward"),"backward"):Ht(Re,"forward")}}),[Re,Rt,Ht,Gt,Yt]),_t=o((function(e){clearTimeout(X.current),N.current||(D.current=e.clientX,document.addEventListener("mousemove",Yt),document.addEventListener("mouseup",Zt),A.current.addEventListener("mouseout",Zt),A.current.addEventListener("dragstart",Zt)),le&&le(e)}),[Yt,Zt,le]),en=o((function(e){clearTimeout(X.current),N.current||(D.current=e.touches[0].clientX,document.addEventListener("touchmove",Yt),document.addEventListener("touchend",Zt)),ce&&ce(e)}),[Yt,Zt,ce]),tn=o((function(e){j(Re),ae&&ae(e)}),[Re,ae]),nn=o((function(){Ht(Gt("forward"),"forward")}),[Ht,Gt]),rn=function(e,t,n){return e.map((function(e,r){var i=e.props,o=(i=void 0===i?{}:i).className,c=void 0===o?"":o,u=i.onClick,d=void 0===u?null:u,a=i.style,f=void 0===a?{}:a,m=s(i,I),v=s(e,C),h=dt?z.current>=U.length?"forward":"backward":r>=Re?"forward":"backward",p=r+t===Re,b=$t.visibleSlides.find((function(e){return e.slideIndex===r+t})),y="".concat(c," ").concat(h," ").concat(p?Ce:""," ").concat(b?je:""),w=l(l(l(l({},f),b?Fe:{}),p?Le:{}),{},{boxSizing:"border-box",margin:0}),g=!n&&Ne?function(e){var t=e.direction,n=e.index,r=e.onClick;return function(e){Ht(n,t||(Re<n?"forward":"")||(Re>n?"backward":"")),r&&r(e)}}({direction:h,index:r+t,onClick:d}):d,x=l(l(l({role:"tabpanel",className:y,style:w,onClick:g},m),b?Ae:{}),p?Me:{});return z.current+=1,l({props:x},v)}))};return c((function(){return D.current=0,P===Re&&(N.current=!1),R.current="",Re!==P?ze||qe||j(Re):(Ye&&Ye(Re,P),(dt||"forward"===tt&&Re!==Pt||"backward"===tt&&0!==Re)&&Jt()),function(){clearTimeout(X.current)}}),[P,Re,Ye,ze,qe,Jt,dt,Pt,tt]),c((function(){return h&&Jt(),function(){clearTimeout(X.current)}}),[h]),c((function(){var e=A.current;function t(){clearTimeout(V.current),clearTimeout(X.current),V.current=setTimeout((function(){h!==window.innerWidth&&M(window.innerWidth)}),400)}return h!==window.innerWidth&&M(window.innerWidth),window.addEventListener("resize",t),function(){clearTimeout(V.current),window.removeEventListener("resize",t),document.removeEventListener("mousemove",Yt),document.removeEventListener("mouseup",Zt),document.removeEventListener("touchmove",Yt),document.removeEventListener("touchend",Zt),e.removeEventListener("mouseout",Zt),e.removeEventListener("dragstart",Zt)}}),[Yt,Zt]),z.current=0,B.current=P,e.createElement("div",a({onClickCapture:Kt,style:l({display:"flex",flexFlow:"row wrap",boxSizing:"border-box",justifyContent:"center",width:"100%"},J)},Y,{ref:W}),pe&&!Wt&&e.createElement("button",a({},be,{type:"button",onClick:(0===qt&&st||0===Re&&mt)&&!dt?void 0:Qt,disabled:"boolean"==typeof be.disabled?be.disabled:!(!(0===qt&&st||0===Re&&mt)||dt)}),ve),e.createElement("div",a({},te,{style:l(l({},ee),{},{display:"flex",boxSizing:"border-box",flexFlow:"row wrap",padding:"0",overflow:"hidden",maxWidth:Lt?"".concat(Lt,"px"):void 0,flex:Lt?void 0:"1 0"}),ref:F}),e.createElement("div",a({},se,{style:l(l({},ie),{},{display:"flex",boxSizing:"border-box",outline:"none",transition:Bt,transform:Ut}),onTouchStart:Ft?void 0:en,onMouseDown:Ft?void 0:_t,onTransitionEnd:ze||qe?tn:void 0,tabIndex:-1,role:"presentation",ref:A}),dt&&rn(U.slice(P),P,Ft),rn(U,0,Ft),dt&&rn(U,0,Ft),dt&&rn(U.slice(0,P),0,Ft))),Se&&!Wt&&e.createElement("button",a({},Oe,{type:"button",onClick:(qt===Mt&&st||Re===Pt&&mt)&&!dt?void 0:nn,disabled:"boolean"==typeof Oe.disabled?Oe.disabled:!(!(qt===Mt&&st||Re===Pt&&mt)||dt)}),ge),!!gt&&e.createElement("div",a({style:{width:"100%",display:"flex",justifyContent:"center"}},St),Array.from({length:Math.ceil(U.length/Ke)}).map((function(t,n){return e.createElement("button",a({type:"button",key:n,title:"".concat(n)},Et,Math.min(n*Ke,U.length-1)===Re?Ct:{},{onClick:function(){Ht(Math.min(n*Ke,U.length-1),Math.min(n*Ke,U.length-1)>Re?"forward":"backward")}}))}))))}var k=t(M);export{k as default}; |
@@ -1,1 +0,1 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("react")):"function"==typeof define&&define.amd?define(["react"],t):(e="undefined"!=typeof globalThis?globalThis:e||self).ReactSimplyCarousel=t(e.React)}(this,(function(e){"use strict";function t(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var n=t(e);function r(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 i(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?r(Object(n),!0).forEach((function(t){o(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):r(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function c(){return c=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},c.apply(this,arguments)}function u(e,t){if(null==e)return{};var n,r,i=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}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function a(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,i,o=[],c=!0,u=!1;try{for(n=n.call(e);!(c=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);c=!0);}catch(e){u=!0,i=e}finally{try{c||null==n.return||n.return()}finally{if(u)throw i}}return o}(e,t)||s(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function l(e){return function(e){if(Array.isArray(e))return d(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||s(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function s(e,t){if(e){if("string"==typeof e)return d(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?d(e,t):void 0}}function d(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var f=["responsiveProps"],m=["minWidth","maxWidth"],v=["style","onClickCapture"],h=["style"],b=["style","onTouchStart","onMouseDown","onTransitionEnd"],p=["children","show"],y=["children","show"],w=["className","style"],g=["className","style"],x=["className","onClick","style"],C=["props"];function E(e){var t=e.infinite,n=e.positionIndex,r=e.itemsListRef;return t?l(r.current.children).slice(r.current.children.length/3-n,r.current.children.length/3-n+r.current.children.length/3):l(r.current.children)}function S(e){var t=e.activeSlideIndex,n=e.itemsListRef,r=e.innerRef,i=e.offsetCorrectionForCenterMode,o=e.offsetCorrectionForInfiniteMode,c=e.infinite,u=e.positionIndex,a=e.innerMaxWidth,s=E({infinite:c,positionIndex:u,itemsListRef:n}),d=c?o+i:Math.min(n.current.offsetWidth-(a||r.current.offsetWidth),s.reduce((function(e,n,r){return r<t?e+n.offsetWidth:e}),0)),f=d+(a||r.current.offsetWidth),m=c?[].concat(l(s.slice(t).map((function(e,n){return{slideIndex:n+t,htmlElement:e}}))),l(s.map((function(e,t){return{slideIndex:t,htmlElement:e}}))),l(s.map((function(e,t){return{slideIndex:t,htmlElement:e}}))),l(s.slice(0,t).map((function(e,t){return{slideIndex:t,htmlElement:e}})))):s.map((function(e,t){return{slideIndex:t,htmlElement:e}})),v=m.reduce((function(e,t){var n=t.slideIndex,r=t.htmlElement.offsetWidth;return(e.summ>=d&&e.summ<f||e.summ+r>d&&e.summ+r<=f)&&e.items.push({slideIndex:n,isFullyVisible:e.summ+r<=f&&e.summ>=d}),e.summ+=r,e}),{summ:0,items:[]}),h=!!v.items.find((function(e){return 0===e.slideIndex})),b=!!v.items.find((function(e){return e.slideIndex===s.length-1}));return{visibleSlides:v.items,isFirstSlideVisible:h,isLastSlideVisible:b}}function I(t){var r=t.responsiveProps,o=void 0===r?[]:r,l=u(t,f),s=a(e.useState(0),2),d=s[0],I=s[1],k=a(e.useState(l.activeSlideIndex),2),O=k[0],L=k[1],T=e.useRef(null),j=e.useRef(null),M=e.useRef(null),W=e.useRef(0),P=e.useRef(!1),R=e.useRef(""),A=e.useRef(null),N=e.useRef(null),F=e.useRef(0),D=e.useRef(O),X=o.reduce((function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.minWidth,r=void 0===n?0:n,o=t.maxWidth,c=void 0===o?null:o,a=u(t,m);return d>r&&(!c||d<=c)?i(i({},e),a):e}),l),V=e.Children.toArray(X.children),z=d?i(i({},X),{},{activeSlideIndex:Math.max(0,Math.min(X.activeSlideIndex,V.length-1)),itemsToShow:Math.min(V.length,X.itemsToShow||0),itemsToScroll:Math.min(V.length,X.itemsToScroll||1)}):l,B=z.containerProps,q=(B=void 0===B?{}:B).style,U=void 0===q?{}:q,$=B.onClickCapture,G=void 0===$?null:$,H=u(B,v),J=z.innerProps,K=(J=void 0===J?{}:J).style,Q=void 0===K?{}:K,Y=u(J,h),Z=z.itemsListProps,_=(Z=void 0===Z?{}:Z).style,ee=void 0===_?{}:_,te=Z.onTouchStart,ne=void 0===te?null:te,re=Z.onMouseDown,ie=void 0===re?null:re,oe=Z.onTransitionEnd,ce=void 0===oe?null:oe,ue=u(Z,b),ae=z.backwardBtnProps,le=(ae=void 0===ae?{}:ae).children,se=void 0===le?null:le,de=ae.show,fe=void 0===de||de,me=u(ae,p),ve=z.forwardBtnProps,he=(ve=void 0===ve?{}:ve).children,be=void 0===he?null:he,pe=ve.show,ye=void 0===pe||pe,we=u(ve,y),ge=z.activeSlideProps,xe=(ge=void 0===ge?{}:ge).className,Ce=void 0===xe?"":xe,Ee=ge.style,Se=void 0===Ee?{}:Ee,Ie=u(ge,w),ke=z.visibleSlideProps,Oe=(ke=void 0===ke?{}:ke).className,Le=void 0===Oe?"":Oe,Te=ke.style,je=void 0===Te?{}:Te,Me=u(ke,g),We=z.updateOnItemClick,Pe=void 0!==We&&We,Re=z.activeSlideIndex,Ae=z.onRequestChange,Ne=z.speed,Fe=void 0===Ne?0:Ne,De=z.delay,Xe=void 0===De?0:De,Ve=z.easing,ze=void 0===Ve?"linear":Ve,Be=z.itemsToShow,qe=void 0===Be?0:Be,Ue=z.itemsToScroll,$e=void 0===Ue?1:Ue,Ge=z.children,He=z.onAfterChange,Je=z.autoplay,Ke=void 0!==Je&&Je,Qe=z.autoplayDirection,Ye=void 0===Qe?"forward":Qe,Ze=z.disableNavIfAllVisible,_e=void 0===Ze||Ze,et=z.hideNavIfAllVisible,tt=void 0===et||et,nt=z.centerMode,rt=void 0!==nt&&nt,it=z.infinite,ot=void 0===it||it,ct=z.disableNavIfEdgeVisible,ut=void 0===ct||ct,at=z.disableNavIfEdgeActive,lt=void 0===at||at,st=z.dotsNav,dt=void 0===st?{}:st,ft=z.persistentChangeCallbacks,mt=void 0!==ft&&ft;z.showSlidesBeforeInit;var vt=dt||{},ht=vt.show,bt=void 0!==ht&&ht,pt=vt.containerProps,yt=void 0===pt?{}:pt,wt=vt.itemBtnProps,gt=void 0===wt?{}:wt,xt=vt.activeItemBtnProps,Ct=void 0===xt?{}:xt,Et=d?E({infinite:ot,positionIndex:D.current,itemsListRef:M}):[],St=d&&qe?Et.reduce((function(e,t,n){return n>=Re&&n<Re+qe||n<Re&&n<Re+qe-Et.length?e+t.offsetWidth:e}),0):0,It=d?M.current.offsetWidth-(St||j.current.offsetWidth):0,kt=function(e){var t=Et.reduce((function(t,n,r){return r>=e?t:t+(n.offsetWidth||0)}),0);return ot?t:Math.min(It,t)},Ot=e.Children.count(Ge)-1,Lt=qe===V.length,Tt=tt&&Lt,jt=_e&&Lt,Mt=Re-O!=0,Wt=d&&Mt&&ot?kt(O):0,Pt=!d||!Mt&&ot?0:kt(Re),Rt=d?Et[Re].offsetWidth:0,At=d&&(rt&&ot)?-((St||j.current.offsetWidth)-Rt)/2:0,Nt=ot&&d?M.current.offsetWidth/3:0,Ft=O-Re!=0&&M.current?"forward"===R.current.toLowerCase()&&Re<O?Nt:"backward"===R.current.toLowerCase()&&Re>O?-Nt:0:0,Dt=Mt&&(Fe||Xe)?"transform ".concat(Fe,"ms ").concat(ze," ").concat(Xe,"ms"):"none",Xt=jt||!d?0:Pt-Wt+At+Ft+Nt,Vt=d?"translateX(-".concat(Xt,"px)"):"none",zt=d?S({activeSlideIndex:Re,itemsListRef:M,innerRef:j,offsetCorrectionForCenterMode:At,infinite:ot,positionIndex:D.current,offsetCorrectionForInfiniteMode:Nt,innerMaxWidth:0}):{visibleSlides:[],isFirstSlideVisible:!1,isLastSlideVisible:!1},Bt=e.useCallback((function(e){if("forward"===e){var t=Re+$e;return t>Ot?ot?t-Ot-1:Re:t}if("backward"===e){var n=Re-$e;return n<0?ot?Ot+1+n:Re:n}return Re}),[Re,$e,Ot,ot]),qt=e.useCallback((function(e,t){R.current=t,M.current.style.transition=Fe||Xe?"transform ".concat(Fe,"ms ").concat(ze," ").concat(Xe,"ms"):"none",e!==Re||mt?(clearTimeout(A.current),Ae(e,S({activeSlideIndex:e,positionIndex:O,infinite:ot,innerRef:j,itemsListRef:M,offsetCorrectionForCenterMode:At,offsetCorrectionForInfiniteMode:Nt,innerMaxWidth:St}))):(W.current=0,M.current.style.transform="translateX(-".concat(At+Nt+(ot?0:Xt),"px)"))}),[mt,Re,At,Xe,ze,Fe,Ae,Nt,ot,Xt,O,St]),Ut=e.useCallback((function(){Ke&&(clearTimeout(A.current),A.current=setTimeout((function(){qt(Bt(Ye),Ye)}),Xe))}),[Ke,Ye,qt,Bt,Xe]),$t=e.useCallback((function(e){P.current&&(e.preventDefault(),e.stopPropagation(),G&&G(e))}),[G]),Gt=e.useCallback((function(){qt(Bt("backward"),"backward")}),[qt,Bt]),Ht=e.useCallback((function(e){P.current=!0;var t=e.touches&&e.touches[0]?e.touches[0].clientX:e.clientX,n=W.current-t+At+Nt+(ot?0:Xt),r=M.current.offsetWidth-j.current.offsetWidth,i=Math.max(Math.min(0,-n),-r);M.current.style.transition="none",M.current.style.transform="translateX(".concat(i,"px)")}),[At,Nt,ot,Xt]),Jt=e.useCallback((function(e){if(M.current.removeEventListener("mouseout",Jt),M.current.removeEventListener("dragstart",Jt),document.removeEventListener("mousemove",Ht),document.removeEventListener("mouseup",Jt),document.removeEventListener("touchmove",Ht),document.removeEventListener("touchend",Jt),P.current){var t=e.changedTouches&&e.changedTouches.length?e.changedTouches[e.changedTouches.length-1].clientX:e.clientX,n=W.current-t;n>Rt/2?qt(Bt("forward"),"forward"):n<-Rt/2?qt(Bt("backward"),"backward"):qt(Re,"forward")}}),[Re,Rt,qt,Bt,Ht]),Kt=e.useCallback((function(e){clearTimeout(A.current),P.current||(W.current=e.clientX,document.addEventListener("mousemove",Ht),document.addEventListener("mouseup",Jt),M.current.addEventListener("mouseout",Jt),M.current.addEventListener("dragstart",Jt)),ie&&ie(e)}),[Ht,Jt,ie]),Qt=e.useCallback((function(e){clearTimeout(A.current),P.current||(W.current=e.touches[0].clientX,document.addEventListener("touchmove",Ht),document.addEventListener("touchend",Jt)),ne&&ne(e)}),[Ht,Jt,ne]),Yt=e.useCallback((function(e){L(Re),ce&&ce(e)}),[Re,ce]),Zt=e.useCallback((function(){qt(Bt("forward"),"forward")}),[qt,Bt]),_t=function(e,t,n){return e.map((function(e,r){var o=e.props,c=(o=void 0===o?{}:o).className,a=void 0===c?"":c,l=o.onClick,s=void 0===l?null:l,d=o.style,f=void 0===d?{}:d,m=u(o,x),v=u(e,C),h=ot?F.current>=V.length?"forward":"backward":r>=Re?"forward":"backward",b=r+t===Re,p=zt.visibleSlides.find((function(e){return e.slideIndex===r+t})),y="".concat(a," ").concat(h," ").concat(b?Ce:""," ").concat(p?Le:""),w=i(i(i(i({},f),p?je:{}),b?Se:{}),{},{boxSizing:"border-box",margin:0}),g=!n&&Pe?function(e){var t=e.direction,n=e.index,r=e.onClick;return function(e){qt(n,t||(Re<n?"forward":"")||(Re>n?"backward":"")),r&&r(e)}}({direction:h,index:r+t,onClick:s}):s,E=i(i(i({role:"tabpanel",className:y,style:w,onClick:g},m),p?Me:{}),b?Ie:{});return F.current+=1,i({props:E},v)}))};return e.useEffect((function(){return W.current=0,O===Re&&(P.current=!1),R.current="",Re!==O?Fe||Xe||L(Re):(He&&He(Re,O),(ot||"forward"===Ye&&Re!==Ot||"backward"===Ye&&0!==Re)&&Ut()),function(){clearTimeout(A.current)}}),[O,Re,He,Fe,Xe,Ut,ot,Ot,Ye]),e.useEffect((function(){return d&&Ut(),function(){clearTimeout(A.current)}}),[d]),e.useEffect((function(){var e=M.current;function t(){clearTimeout(N.current),clearTimeout(A.current),N.current=setTimeout((function(){d!==window.innerWidth&&I(window.innerWidth)}),400)}return d!==window.innerWidth&&I(window.innerWidth),window.addEventListener("resize",t),function(){clearTimeout(N.current),window.removeEventListener("resize",t),document.removeEventListener("mousemove",Ht),document.removeEventListener("mouseup",Jt),document.removeEventListener("touchmove",Ht),document.removeEventListener("touchend",Jt),e.removeEventListener("mouseout",Jt),e.removeEventListener("dragstart",Jt)}}),[Ht,Jt]),F.current=0,D.current=O,n.default.createElement("div",c({onClickCapture:$t,style:i({display:"flex",flexFlow:"row wrap",boxSizing:"border-box",justifyContent:"center",width:"100%"},U)},H,{ref:T}),fe&&!Tt&&n.default.createElement("button",c({},me,{type:"button",onClick:(0===Xt&&ut||0===Re&<)&&!ot?void 0:Gt,disabled:"boolean"==typeof me.disabled?me.disabled:!(!(0===Xt&&ut||0===Re&<)||ot)}),se),n.default.createElement("div",c({},Y,{style:i(i({},Q),{},{display:"flex",boxSizing:"border-box",flexFlow:"row wrap",padding:"0",overflow:"hidden",maxWidth:St?"".concat(St,"px"):void 0,flex:St?void 0:"1 0"}),ref:j}),n.default.createElement("div",c({},ue,{style:i(i({},ee),{},{display:"flex",boxSizing:"border-box",outline:"none",transition:Dt,transform:Vt}),"data-transform":Vt,onTouchStart:jt?void 0:Qt,onMouseDown:jt?void 0:Kt,onTransitionEnd:Fe||Xe?Yt:void 0,tabIndex:-1,role:"presentation",ref:M}),ot&&_t(V.slice(O),O,jt),_t(V,0,jt),ot&&_t(V,0,jt),ot&&_t(V.slice(0,O),0,jt))),ye&&!Tt&&n.default.createElement("button",c({},we,{type:"button",onClick:(Xt===It&&ut||Re===Ot&<)&&!ot?void 0:Zt,disabled:"boolean"==typeof we.disabled?we.disabled:!(!(Xt===It&&ut||Re===Ot&<)||ot)}),be),!!bt&&n.default.createElement("div",c({style:{width:"100%",display:"flex",justifyContent:"center"}},yt),Array.from({length:Math.ceil(V.length/$e)}).map((function(e,t){return n.default.createElement("button",c({type:"button",key:t,title:"".concat(t)},gt,Math.min(t*$e,V.length-1)===Re?Ct:{},{onClick:function(){qt(Math.min(t*$e,V.length-1),Math.min(t*$e,V.length-1)>Re?"forward":"backward")}}))}))))}return e.memo(I)})); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("react")):"function"==typeof define&&define.amd?define(["react"],t):(e="undefined"!=typeof globalThis?globalThis:e||self).ReactSimplyCarousel=t(e.React)}(this,(function(e){"use strict";function t(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var n=t(e);function r(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 i(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?r(Object(n),!0).forEach((function(t){o(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):r(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function c(){return c=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},c.apply(this,arguments)}function u(e,t){if(null==e)return{};var n,r,i=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}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}function l(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null==n)return;var r,i,o=[],c=!0,u=!1;try{for(n=n.call(e);!(c=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);c=!0);}catch(e){u=!0,i=e}finally{try{c||null==n.return||n.return()}finally{if(u)throw i}}return o}(e,t)||s(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function a(e){return function(e){if(Array.isArray(e))return d(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||s(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function s(e,t){if(e){if("string"==typeof e)return d(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?d(e,t):void 0}}function d(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var f=["responsiveProps"],m=["minWidth","maxWidth"],v=["style","onClickCapture"],h=["style"],b=["style","onTouchStart","onMouseDown","onTransitionEnd"],p=["children","show"],y=["children","show"],w=["className","style"],g=["className","style"],x=["className","onClick","style"],S=["props"];function C(e){var t=e.infinite,n=e.indexOfFirstSlideInDOM,r=e.itemsListRef;return t?a(r.current.children).slice(r.current.children.length/3-n,r.current.children.length/3-n+r.current.children.length/3):a(r.current.children)}function E(e){var t=e.activeSlideIndex,n=e.itemsListRef,r=e.innerRef,i=e.offsetCorrectionForCenterMode,o=e.offsetCorrectionForInfiniteMode,c=e.infinite,u=e.indexOfFirstSlideInDOM,l=e.itemsToShow,s=C({infinite:c,indexOfFirstSlideInDOM:u,itemsListRef:n}),d=l?s.reduce((function(e,n,r){return r>=t&&r<t+l||r<t&&r<t+l-s.length?e+n.offsetWidth:e}),0):r.current.offsetWidth,f=c?o+i:Math.min(n.current.offsetWidth-d,s.reduce((function(e,n,r){return r<t?e+n.offsetWidth:e}),0)),m=f+d,v=c?[].concat(a(s.slice(t).map((function(e,n){return{slideIndex:n+t,htmlElement:e}}))),a(s.map((function(e,t){return{slideIndex:t,htmlElement:e}}))),a(s.map((function(e,t){return{slideIndex:t,htmlElement:e}}))),a(s.slice(0,t).map((function(e,t){return{slideIndex:t,htmlElement:e}})))):s.map((function(e,t){return{slideIndex:t,htmlElement:e}})),h=v.reduce((function(e,t){var n=t.slideIndex,r=t.htmlElement.offsetWidth;return(e.summ>=f&&e.summ<m||e.summ+r>f&&e.summ+r<=m)&&e.items.push({slideIndex:n,isFullyVisible:e.summ+r<=m&&e.summ>=f}),e.summ+=r,e}),{summ:0,items:[]}),b=!!h.items.find((function(e){return 0===e.slideIndex})),p=!!h.items.find((function(e){return e.slideIndex===s.length-1}));return{visibleSlides:h.items,isFirstSlideVisible:b,isLastSlideVisible:p}}function O(t){var r=t.responsiveProps,o=void 0===r?[]:r,a=u(t,f),s=l(e.useState(0),2),d=s[0],O=s[1],k=l(e.useState(a.activeSlideIndex),2),I=k[0],T=k[1],L=e.useRef(null),M=e.useRef(null),j=e.useRef(null),P=e.useRef(0),W=e.useRef(!1),R=e.useRef(""),F=e.useRef(null),A=e.useRef(null),D=e.useRef(0),N=e.useRef(I),X=o.reduce((function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.minWidth,r=void 0===n?0:n,o=t.maxWidth,c=void 0===o?null:o,l=u(t,m);return d>r&&(!c||d<=c)?i(i({},e),l):e}),a),V=e.Children.toArray(X.children),z=d?i(i({},X),{},{activeSlideIndex:Math.max(0,Math.min(X.activeSlideIndex,V.length-1)),itemsToShow:Math.min(V.length,X.itemsToShow||0),itemsToScroll:Math.min(V.length,X.itemsToScroll||1)}):a,B=z.containerProps,q=(B=void 0===B?{}:B).style,U=void 0===q?{}:q,$=B.onClickCapture,G=void 0===$?null:$,H=u(B,v),J=z.innerProps,K=(J=void 0===J?{}:J).style,Q=void 0===K?{}:K,Y=u(J,h),Z=z.itemsListProps,_=(Z=void 0===Z?{}:Z).style,ee=void 0===_?{}:_,te=Z.onTouchStart,ne=void 0===te?null:te,re=Z.onMouseDown,ie=void 0===re?null:re,oe=Z.onTransitionEnd,ce=void 0===oe?null:oe,ue=u(Z,b),le=z.backwardBtnProps,ae=(le=void 0===le?{}:le).children,se=void 0===ae?null:ae,de=le.show,fe=void 0===de||de,me=u(le,p),ve=z.forwardBtnProps,he=(ve=void 0===ve?{}:ve).children,be=void 0===he?null:he,pe=ve.show,ye=void 0===pe||pe,we=u(ve,y),ge=z.activeSlideProps,xe=(ge=void 0===ge?{}:ge).className,Se=void 0===xe?"":xe,Ce=ge.style,Ee=void 0===Ce?{}:Ce,Oe=u(ge,w),ke=z.visibleSlideProps,Ie=(ke=void 0===ke?{}:ke).className,Te=void 0===Ie?"":Ie,Le=ke.style,Me=void 0===Le?{}:Le,je=u(ke,g),Pe=z.updateOnItemClick,We=void 0!==Pe&&Pe,Re=z.activeSlideIndex,Fe=z.onRequestChange,Ae=z.speed,De=void 0===Ae?0:Ae,Ne=z.delay,Xe=void 0===Ne?0:Ne,Ve=z.easing,ze=void 0===Ve?"linear":Ve,Be=z.itemsToShow,qe=void 0===Be?0:Be,Ue=z.itemsToScroll,$e=void 0===Ue?1:Ue,Ge=z.children,He=z.onAfterChange,Je=z.autoplay,Ke=void 0!==Je&&Je,Qe=z.autoplayDirection,Ye=void 0===Qe?"forward":Qe,Ze=z.disableNavIfAllVisible,_e=void 0===Ze||Ze,et=z.hideNavIfAllVisible,tt=void 0===et||et,nt=z.centerMode,rt=void 0!==nt&&nt,it=z.infinite,ot=void 0===it||it,ct=z.disableNavIfEdgeVisible,ut=void 0===ct||ct,lt=z.disableNavIfEdgeActive,at=void 0===lt||lt,st=z.dotsNav,dt=void 0===st?{}:st,ft=z.persistentChangeCallbacks,mt=void 0!==ft&&ft,vt=dt||{},ht=vt.show,bt=void 0!==ht&&ht,pt=vt.containerProps,yt=void 0===pt?{}:pt,wt=vt.itemBtnProps,gt=void 0===wt?{}:wt,xt=vt.activeItemBtnProps,St=void 0===xt?{}:xt,Ct=d?C({infinite:ot,indexOfFirstSlideInDOM:N.current,itemsListRef:j}):[],Et=d&&qe?Ct.reduce((function(e,t,n){return n>=Re&&n<Re+qe||n<Re&&n<Re+qe-Ct.length?e+t.offsetWidth:e}),0):0,Ot=d?j.current.offsetWidth-(Et||M.current.offsetWidth):0,kt=function(e){var t=Ct.reduce((function(t,n,r){return r>=e?t:t+(n.offsetWidth||0)}),0);return ot?t:Math.min(Ot,t)},It=e.Children.count(Ge)-1,Tt=qe===V.length,Lt=tt&&Tt,Mt=_e&&Tt,jt=Re-I!=0,Pt=d&&jt&&ot?kt(I):0,Wt=!d||!jt&&ot?0:kt(Re),Rt=d?Ct[Re].offsetWidth:0,Ft=d&&(rt&&ot)?-((Et||M.current.offsetWidth)-Rt)/2:0,At=ot&&d?j.current.offsetWidth/3:0,Dt=I-Re!=0&&j.current?"forward"===R.current.toLowerCase()&&Re<I?At:"backward"===R.current.toLowerCase()&&Re>I?-At:0:0,Nt=jt&&(De||Xe)?"transform ".concat(De,"ms ").concat(ze," ").concat(Xe,"ms"):"none",Xt=Mt||!d?0:Wt-Pt+Ft+Dt+At,Vt=d?"translateX(-".concat(Xt,"px)"):"none",zt=d?E({activeSlideIndex:Re,itemsListRef:j,innerRef:M,offsetCorrectionForCenterMode:Ft,infinite:ot,indexOfFirstSlideInDOM:N.current,offsetCorrectionForInfiniteMode:At,itemsToShow:qe}):{visibleSlides:[],isFirstSlideVisible:!1,isLastSlideVisible:!1},Bt=e.useCallback((function(e){if("forward"===e){var t=Re+$e;return t>It?ot?t-It-1:Re:t}if("backward"===e){var n=Re-$e;return n<0?ot?It+1+n:Re:n}return Re}),[Re,$e,It,ot]),qt=e.useCallback((function(e,t){R.current=t,j.current.style.transition=De||Xe?"transform ".concat(De,"ms ").concat(ze," ").concat(Xe,"ms"):"none",e!==Re||mt?(clearTimeout(F.current),Fe(e,E({activeSlideIndex:e,indexOfFirstSlideInDOM:I,infinite:ot,innerRef:M,itemsListRef:j,offsetCorrectionForCenterMode:Ft,offsetCorrectionForInfiniteMode:At,itemsToShow:qe}))):(P.current=0,j.current.style.transform="translateX(-".concat(Ft+At+(ot?0:Xt),"px)"))}),[mt,Re,Ft,Xe,ze,De,Fe,At,ot,Xt,I,qe]),Ut=e.useCallback((function(){Ke&&(clearTimeout(F.current),F.current=setTimeout((function(){qt(Bt(Ye),Ye)}),Xe))}),[Ke,Ye,qt,Bt,Xe]),$t=e.useCallback((function(e){W.current&&(e.preventDefault(),e.stopPropagation(),G&&G(e))}),[G]),Gt=e.useCallback((function(){qt(Bt("backward"),"backward")}),[qt,Bt]),Ht=e.useCallback((function(e){W.current=!0;var t=e.touches&&e.touches[0]?e.touches[0].clientX:e.clientX,n=P.current-t+Ft+At+(ot?0:Xt),r=j.current.offsetWidth-M.current.offsetWidth,i=Math.max(Math.min(0,-n),-r);j.current.style.transition="none",j.current.style.transform="translateX(".concat(i,"px)")}),[Ft,At,ot,Xt]),Jt=e.useCallback((function(e){if(j.current.removeEventListener("mouseout",Jt),j.current.removeEventListener("dragstart",Jt),document.removeEventListener("mousemove",Ht),document.removeEventListener("mouseup",Jt),document.removeEventListener("touchmove",Ht),document.removeEventListener("touchend",Jt),W.current){var t=e.changedTouches&&e.changedTouches.length?e.changedTouches[e.changedTouches.length-1].clientX:e.clientX,n=P.current-t;n>Rt/2?qt(Bt("forward"),"forward"):n<-Rt/2?qt(Bt("backward"),"backward"):qt(Re,"forward")}}),[Re,Rt,qt,Bt,Ht]),Kt=e.useCallback((function(e){clearTimeout(F.current),W.current||(P.current=e.clientX,document.addEventListener("mousemove",Ht),document.addEventListener("mouseup",Jt),j.current.addEventListener("mouseout",Jt),j.current.addEventListener("dragstart",Jt)),ie&&ie(e)}),[Ht,Jt,ie]),Qt=e.useCallback((function(e){clearTimeout(F.current),W.current||(P.current=e.touches[0].clientX,document.addEventListener("touchmove",Ht),document.addEventListener("touchend",Jt)),ne&&ne(e)}),[Ht,Jt,ne]),Yt=e.useCallback((function(e){T(Re),ce&&ce(e)}),[Re,ce]),Zt=e.useCallback((function(){qt(Bt("forward"),"forward")}),[qt,Bt]),_t=function(e,t,n){return e.map((function(e,r){var o=e.props,c=(o=void 0===o?{}:o).className,l=void 0===c?"":c,a=o.onClick,s=void 0===a?null:a,d=o.style,f=void 0===d?{}:d,m=u(o,x),v=u(e,S),h=ot?D.current>=V.length?"forward":"backward":r>=Re?"forward":"backward",b=r+t===Re,p=zt.visibleSlides.find((function(e){return e.slideIndex===r+t})),y="".concat(l," ").concat(h," ").concat(b?Se:""," ").concat(p?Te:""),w=i(i(i(i({},f),p?Me:{}),b?Ee:{}),{},{boxSizing:"border-box",margin:0}),g=!n&&We?function(e){var t=e.direction,n=e.index,r=e.onClick;return function(e){qt(n,t||(Re<n?"forward":"")||(Re>n?"backward":"")),r&&r(e)}}({direction:h,index:r+t,onClick:s}):s,C=i(i(i({role:"tabpanel",className:y,style:w,onClick:g},m),p?je:{}),b?Oe:{});return D.current+=1,i({props:C},v)}))};return e.useEffect((function(){return P.current=0,I===Re&&(W.current=!1),R.current="",Re!==I?De||Xe||T(Re):(He&&He(Re,I),(ot||"forward"===Ye&&Re!==It||"backward"===Ye&&0!==Re)&&Ut()),function(){clearTimeout(F.current)}}),[I,Re,He,De,Xe,Ut,ot,It,Ye]),e.useEffect((function(){return d&&Ut(),function(){clearTimeout(F.current)}}),[d]),e.useEffect((function(){var e=j.current;function t(){clearTimeout(A.current),clearTimeout(F.current),A.current=setTimeout((function(){d!==window.innerWidth&&O(window.innerWidth)}),400)}return d!==window.innerWidth&&O(window.innerWidth),window.addEventListener("resize",t),function(){clearTimeout(A.current),window.removeEventListener("resize",t),document.removeEventListener("mousemove",Ht),document.removeEventListener("mouseup",Jt),document.removeEventListener("touchmove",Ht),document.removeEventListener("touchend",Jt),e.removeEventListener("mouseout",Jt),e.removeEventListener("dragstart",Jt)}}),[Ht,Jt]),D.current=0,N.current=I,n.default.createElement("div",c({onClickCapture:$t,style:i({display:"flex",flexFlow:"row wrap",boxSizing:"border-box",justifyContent:"center",width:"100%"},U)},H,{ref:L}),fe&&!Lt&&n.default.createElement("button",c({},me,{type:"button",onClick:(0===Xt&&ut||0===Re&&at)&&!ot?void 0:Gt,disabled:"boolean"==typeof me.disabled?me.disabled:!(!(0===Xt&&ut||0===Re&&at)||ot)}),se),n.default.createElement("div",c({},Y,{style:i(i({},Q),{},{display:"flex",boxSizing:"border-box",flexFlow:"row wrap",padding:"0",overflow:"hidden",maxWidth:Et?"".concat(Et,"px"):void 0,flex:Et?void 0:"1 0"}),ref:M}),n.default.createElement("div",c({},ue,{style:i(i({},ee),{},{display:"flex",boxSizing:"border-box",outline:"none",transition:Nt,transform:Vt}),onTouchStart:Mt?void 0:Qt,onMouseDown:Mt?void 0:Kt,onTransitionEnd:De||Xe?Yt:void 0,tabIndex:-1,role:"presentation",ref:j}),ot&&_t(V.slice(I),I,Mt),_t(V,0,Mt),ot&&_t(V,0,Mt),ot&&_t(V.slice(0,I),0,Mt))),ye&&!Lt&&n.default.createElement("button",c({},we,{type:"button",onClick:(Xt===Ot&&ut||Re===It&&at)&&!ot?void 0:Zt,disabled:"boolean"==typeof we.disabled?we.disabled:!(!(Xt===Ot&&ut||Re===It&&at)||ot)}),be),!!bt&&n.default.createElement("div",c({style:{width:"100%",display:"flex",justifyContent:"center"}},yt),Array.from({length:Math.ceil(V.length/$e)}).map((function(e,t){return n.default.createElement("button",c({type:"button",key:t,title:"".concat(t)},gt,Math.min(t*$e,V.length-1)===Re?St:{},{onClick:function(){qt(Math.min(t*$e,V.length-1),Math.min(t*$e,V.length-1)>Re?"forward":"backward")}}))}))))}return e.memo(O)})); |
{ | ||
"name": "react-simply-carousel", | ||
"version": "8.3.0", | ||
"version": "8.3.1", | ||
"description": "A simple, lightweight, fully controlled isomorphic (with SSR support) React.js carousel component. Touch enabled and responsive. With support for autoplay and infinity options. Fully customizable", | ||
@@ -5,0 +5,0 @@ "files": [ |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
51736
166