react-simply-carousel
Advanced tools
Comparing version 8.3.5 to 8.4.0
@@ -49,2 +49,3 @@ import React, { HTMLAttributes, ButtonHTMLAttributes, ReactNode } from 'react'; | ||
showSlidesBeforeInit?: boolean; | ||
autoplayDelay?: number; | ||
}; | ||
@@ -51,0 +52,0 @@ declare type ReactSimplyCarouselResponsiveProps = (Omit<Omit<ReactSimplyCarouselStaticProps, 'activeSlideIndex'>, 'onRequestChange'> & { |
@@ -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 d(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?d(Object(n),!0).forEach((function(t){a(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):d(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function u(){return u=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},u.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,d=!1;try{for(n=n.call(e);!(c=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);c=!0);}catch(e){d=!0,i=e}finally{try{c||null==n.return||n.return()}finally{if(d)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"],x=["style","onTouchStart","onMouseDown","onTransitionEnd"],g=["children","show"],S=["children","show"],E=["className","style"],I=["className","style"],T=["className","onClick","style"],O=["props"];function C(t){var d=t.responsiveProps,a=void 0===d?[]:d,v=s(t,p),h=f(n(0),2),C=h[0],L=h[1],k=f(n(v.activeSlideIndex),2),M=k[0],P=k[1],j=r(null),W=r(null),A=r(null),X=r(0),N=r(!1),F=r(""),V=r(null),D=r(null),z=r(0),B=r(M),q=a.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 C>r&&(!o||C<=o)?l(l({},e),c):e}),v),H=i.toArray(q.children),R=C?l(l({},q),{},{activeSlideIndex:Math.max(0,Math.min(q.activeSlideIndex,H.length-1)),itemsToShow:Math.min(H.length,q.itemsToShow||0),itemsToScroll:Math.min(H.length,q.itemsToScroll||1)}):v,U=R.containerProps,$=(U=void 0===U?{}:U).style,G=void 0===$?{}:$,J=U.onClickCapture,K=void 0===J?null:J,Q=s(U,y),Y=R.innerProps,Z=(Y=void 0===Y?{}:Y).style,_=void 0===Z?{}:Z,ee=s(Y,w),te=R.itemsListProps,ne=(te=void 0===te?{}:te).style,re=void 0===ne?{}:ne,ie=te.onTouchStart,oe=void 0===ie?null:ie,ce=te.onMouseDown,de=void 0===ce?null:ce,le=te.onTransitionEnd,ae=void 0===le?null:le,ue=s(te,x),se=R.backwardBtnProps,fe=(se=void 0===se?{}:se).children,me=void 0===fe?null:fe,ve=se.show,he=void 0===ve||ve,pe=s(se,g),be=R.forwardBtnProps,ye=(be=void 0===be?{}:be).children,we=void 0===ye?null:ye,xe=be.show,ge=void 0===xe||xe,Se=s(be,S),Ee=R.activeSlideProps,Ie=(Ee=void 0===Ee?{}:Ee).className,Te=void 0===Ie?"":Ie,Oe=Ee.style,Ce=void 0===Oe?{}:Oe,Le=s(Ee,E),ke=R.visibleSlideProps,Me=(ke=void 0===ke?{}:ke).className,Pe=void 0===Me?"":Me,je=ke.style,We=void 0===je?{}:je,Ae=s(ke,I),Xe=R.updateOnItemClick,Ne=void 0!==Xe&&Xe,Fe=R.activeSlideIndex,Ve=R.onRequestChange,De=R.speed,ze=void 0===De?0:De,Be=R.delay,qe=void 0===Be?0:Be,He=R.easing,Re=void 0===He?"linear":He,Ue=R.itemsToShow,$e=void 0===Ue?0:Ue,Ge=R.itemsToScroll,Je=void 0===Ge?1:Ge,Ke=R.children,Qe=R.onAfterChange,Ye=R.autoplay,Ze=void 0!==Ye&&Ye,_e=R.autoplayDirection,et=void 0===_e?"forward":_e,tt=R.disableNavIfAllVisible,nt=void 0===tt||tt,rt=R.hideNavIfAllVisible,it=void 0===rt||rt,ot=R.centerMode,ct=void 0!==ot&&ot,dt=R.infinite,lt=void 0===dt||dt,at=R.disableNavIfEdgeVisible,ut=void 0===at||at,st=R.disableNavIfEdgeActive,ft=void 0===st||st,mt=R.dotsNav,vt=void 0===mt?{}:mt,ht=R.persistentChangeCallbacks,pt=void 0!==ht&&ht,bt=vt||{},yt=bt.show,wt=void 0!==yt&&yt,xt=bt.containerProps,gt=void 0===xt?{}:xt,St=bt.itemBtnProps,Et=void 0===St?{}:St,It=bt.activeItemBtnProps,Tt=void 0===It?{}:It,Ot=i.count(Ke)-1,Ct=$e===H.length,Lt=it&&Ct,kt=nt&&Ct,Mt=Fe-M==0||!ze&&!qe?"none":"transform ".concat(ze,"ms ").concat(Re," ").concat(qe,"ms"),Pt=o((function(e){var t=e.correctionSlideIndex,n=e.prevCorrectionSlideIndex,r=e.curActiveSlideIndex,i=lt?m(A.current.children).slice(A.current.children.length/3-n,A.current.children.length/3-n+A.current.children.length/3):m(A.current.children),o=i[r].offsetWidth,c=$e?i.reduce((function(e,t,n){return n>=r&&n<r+$e||n<r&&n<r+$e-i.length?e+t.offsetWidth:e}),0):W.current.offsetWidth,d=A.current.offsetWidth-c,l=ct&<?-(c-o)/2:0,a=lt?A.current.offsetWidth/3:0,u=t-r==0?0:"forward"===F.current&&r<t?a:"backward"===F.current&&r>t?-a:0,s=r-t!=0,f=function(e){var t=i.reduce((function(t,n,r){return r>=e?t:t+(n.offsetWidth||0)}),0);return lt?t:Math.min(d,t)},v=s&<?f(t):0,h=s||!lt?f(r):0,p=kt?0:h-v+l+u+a,b="translateX(-".concat(p,"px)"),y=lt?a+l:Math.min(A.current.offsetWidth-c,i.reduce((function(e,t,n){return n<r?e+t.offsetWidth:e}),0)),w=y+c,x=lt?[].concat(m(i.slice(r).map((function(e,t){return{slideIndex:t+r,htmlElement:e}}))),m(i.map((function(e,t){return{slideIndex:t,htmlElement:e}}))),m(i.map((function(e,t){return{slideIndex:t,htmlElement:e}}))),m(i.slice(0,r).map((function(e,t){return{slideIndex:t,htmlElement:e}})))):i.map((function(e,t){return{slideIndex:t,htmlElement:e}})),g=x.reduce((function(e,t){var n=t.slideIndex,r=t.htmlElement.offsetWidth;return(e.summ>=y&&e.summ<w||e.summ+r>y&&e.summ+r<=w)&&e.items.push({slideIndex:n,isFullyVisible:e.summ+r<=w&&e.summ>=y}),e.summ+=r,e}),{summ:0,items:[]}),S=!!g.items.find((function(e){return 0===e.slideIndex})),E=!!g.items.find((function(e){return e.slideIndex===i.length-1}));return{slidesHTMLElements:i,innerMaxWidth:c,itemsListMaxTranslateX:d,activeSlideWidth:o,offsetCorrectionForCenterMode:l,offsetCorrectionForInfiniteMode:a,itemsListTranslateX:p,itemsListTransform:b,visibleSlides:g.items,isFirstSlideVisible:S,isLastSlideVisible:E}}),[ct,kt,lt,$e]),jt=C?Pt({prevCorrectionSlideIndex:B.current,curActiveSlideIndex:Fe,correctionSlideIndex:M}):{},Wt=jt.innerMaxWidth,At=void 0===Wt?0:Wt,Xt=jt.itemsListMaxTranslateX,Nt=void 0===Xt?0:Xt,Ft=jt.activeSlideWidth,Vt=void 0===Ft?0:Ft,Dt=jt.offsetCorrectionForCenterMode,zt=void 0===Dt?0:Dt,Bt=jt.offsetCorrectionForInfiniteMode,qt=void 0===Bt?0:Bt,Ht=jt.itemsListTranslateX,Rt=void 0===Ht?0:Ht,Ut=jt.itemsListTransform,$t=void 0===Ut?"none":Ut,Gt=jt.visibleSlides,Jt=void 0===Gt?[]:Gt,Kt=o((function(e){if("forward"===e){var t=Fe+Je;return t>Ot?lt?t-Ot-1:Fe:t}if("backward"===e){var n=Fe-Je;return n<0?lt?Ot+1+n:Fe:n}return Fe}),[Fe,Je,Ot,lt]),Qt=o((function(e,t){if(F.current=t,A.current.style.transition=ze||qe?"transform ".concat(ze,"ms ").concat(Re," ").concat(qe,"ms"):"none",e!==Fe||pt){clearTimeout(V.current);var n=Pt({correctionSlideIndex:M,prevCorrectionSlideIndex:M,curActiveSlideIndex:e}),r=n.visibleSlides,i=n.isFirstSlideVisible,o=n.isLastSlideVisible;Ve(e,{visibleSlides:r,isFirstSlideVisible:i,isLastSlideVisible:o})}else X.current=0,A.current.style.transform="translateX(-".concat(zt+qt+(lt?0:Rt),"px)")}),[pt,Fe,zt,qe,Re,ze,Ve,qt,lt,Rt,M,Pt]),Yt=o((function(){Ze&&(clearTimeout(V.current),V.current=setTimeout((function(){Qt(Kt(et),et)}),qe))}),[Ze,et,Qt,Kt,qe]),Zt=o((function(e){N.current&&(e.preventDefault(),e.stopPropagation(),K&&K(e))}),[K]),_t=o((function(){Qt(Kt("backward"),"backward")}),[Qt,Kt]),en=o((function(e){N.current=!0;var t=e.touches&&e.touches[0]?e.touches[0].clientX:e.clientX,n=X.current-t+zt+qt+(lt?0:Rt),r=A.current.offsetWidth-W.current.offsetWidth,i=Math.max(Math.min(0,-n),-r);A.current.style.transition="none",A.current.style.transform="translateX(".concat(i,"px)")}),[zt,qt,lt,Rt]),tn=o((function(e){if(A.current.removeEventListener("mouseout",tn),A.current.removeEventListener("dragstart",tn),document.removeEventListener("mousemove",en),document.removeEventListener("mouseup",tn),document.removeEventListener("touchmove",en),document.removeEventListener("touchend",tn),N.current){var t=e.changedTouches&&e.changedTouches.length?e.changedTouches[e.changedTouches.length-1].clientX:e.clientX,n=X.current-t,r=n>Vt/2?{index:Kt("forward"),direction:"forward"}:n<-Vt/2?{index:Kt("backward"),direction:"backward"}:{index:Fe,direction:"forward"};r.index===Fe&&(N.current=!1),Qt(r.index,r.direction)}}),[Fe,Vt,Qt,Kt,en]),nn=o((function(e){clearTimeout(V.current),N.current||(X.current=e.clientX,document.addEventListener("mousemove",en),document.addEventListener("mouseup",tn),A.current.addEventListener("mouseout",tn),A.current.addEventListener("dragstart",tn)),de&&de(e)}),[en,tn,de]),rn=o((function(e){clearTimeout(V.current),N.current||(X.current=e.touches[0].clientX,document.addEventListener("touchmove",en),document.addEventListener("touchend",tn)),oe&&oe(e)}),[en,tn,oe]),on=o((function(e){P(Fe),ae&&ae(e)}),[Fe,ae]),cn=o((function(){Qt(Kt("forward"),"forward")}),[Qt,Kt]),dn=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,d=i.onClick,a=void 0===d?null:d,u=i.style,f=void 0===u?{}:u,m=s(i,T),v=s(e,O),h=lt?z.current>=H.length?"forward":"backward":r>=Fe?"forward":"backward",p=r+t===Fe,b=Jt.find((function(e){return e.slideIndex===r+t})),y="".concat(c," ").concat(h," ").concat(p?Te:""," ").concat(b?Pe:""),w=l(l(l(l({},f),b?We:{}),p?Ce:{}),{},{boxSizing:"border-box",margin:0}),x=!n&&Ne?function(e){var t=e.direction,n=e.index,r=e.onClick;return function(e){Qt(n,t||(Fe<n?"forward":"")||(Fe>n?"backward":"")),r&&r(e)}}({direction:h,index:r+t,onClick:a}):a,g=l(l(l({role:"tabpanel",className:y,style:w,onClick:x},m),b?Ae:{}),p?Le:{});return z.current+=1,l({props:g},v)}))};return c((function(){return X.current=0,M===Fe&&(N.current=!1),F.current="",Fe!==M?ze||qe||P(Fe):(Qe&&Qe(Fe,M),(lt||"forward"===et&&Fe!==Ot||"backward"===et&&0!==Fe)&&Yt()),function(){clearTimeout(V.current)}}),[M,Fe,Qe,ze,qe,Yt,lt,Ot,et]),c((function(){return C&&Yt(),function(){clearTimeout(V.current)}}),[C]),c((function(){var e=A.current;function t(){clearTimeout(D.current),clearTimeout(V.current),D.current=setTimeout((function(){C!==window.innerWidth&&L(window.innerWidth)}),400)}return C!==window.innerWidth&&L(window.innerWidth),window.addEventListener("resize",t),function(){clearTimeout(D.current),window.removeEventListener("resize",t),document.removeEventListener("mousemove",en),document.removeEventListener("mouseup",tn),document.removeEventListener("touchmove",en),document.removeEventListener("touchend",tn),e.removeEventListener("mouseout",tn),e.removeEventListener("dragstart",tn)}}),[en,tn]),z.current=0,B.current=M,e.createElement("div",u({onClickCapture:Zt,style:l({display:"flex",flexFlow:"row wrap",boxSizing:"border-box",justifyContent:"center",width:"100%"},G)},Q,{ref:j}),he&&!Lt&&e.createElement("button",u({},pe,{type:"button",onClick:(0===Rt&&ut||0===Fe&&ft)&&!lt?void 0:_t,disabled:"boolean"==typeof pe.disabled?pe.disabled:!(!(0===Rt&&ut||0===Fe&&ft)||lt)}),me),e.createElement("div",u({},ee,{style:l(l({},_),{},{display:"flex",boxSizing:"border-box",flexFlow:"row wrap",padding:"0",overflow:"hidden",maxWidth:At?"".concat(At,"px"):void 0,flex:At?void 0:"1 0"}),ref:W}),e.createElement("div",u({},ue,{style:l(l({},re),{},{display:"flex",boxSizing:"border-box",outline:"none",transition:Mt,transform:$t}),onTouchStart:kt?void 0:rn,onMouseDown:kt?void 0:nn,onTransitionEnd:ze||qe?on:void 0,tabIndex:-1,role:"presentation",ref:A}),lt&&dn(H.slice(M),M,kt),dn(H,0,kt),lt&&dn(H,0,kt),lt&&dn(H.slice(0,M),0,kt))),ge&&!Lt&&e.createElement("button",u({},Se,{type:"button",onClick:(Rt===Nt&&ut||Fe===Ot&&ft)&&!lt?void 0:cn,disabled:"boolean"==typeof Se.disabled?Se.disabled:!(!(Rt===Nt&&ut||Fe===Ot&&ft)||lt)}),we),!!wt&&e.createElement("div",u({style:{width:"100%",display:"flex",justifyContent:"center"}},gt),Array.from({length:Math.ceil(H.length/Je)}).map((function(t,n){return e.createElement("button",u({type:"button",key:n,title:"".concat(n)},Et,Math.min(n*Je,H.length-1)===Fe?Tt:{},{onClick:function(){Qt(Math.min(n*Je,H.length-1),Math.min(n*Je,H.length-1)>Fe?"forward":"backward")}}))}))))}var L=t(C);export{L 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 d(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 a(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?d(Object(n),!0).forEach((function(t){l(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):d(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function l(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function u(){return u=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},u.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,d=!1;try{for(n=n.call(e);!(c=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);c=!0);}catch(e){d=!0,i=e}finally{try{c||null==n.return||n.return()}finally{if(d)throw i}}return o}(e,t)||m(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 v(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)||m(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 m(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"],x=["style","onTouchStart","onMouseDown","onTransitionEnd"],g=["children","show"],S=["children","show"],E=["className","style"],I=["className","style"],T=["className","onClick","style"],O=["props"];function C(t){var d=t.responsiveProps,l=void 0===d?[]:d,m=s(t,p),h=f(n(0),2),C=h[0],L=h[1],k=f(n(m.activeSlideIndex),2),M=k[0],P=k[1],j=r(null),W=r(null),A=r(null),X=r(0),N=r(!1),D=r(""),F=r(null),V=r(null),z=r(0),B=r(M),q=l.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 C>r&&(!o||C<=o)?a(a({},e),c):e}),m),H=i.toArray(q.children),R=C?a(a({},q),{},{activeSlideIndex:Math.max(0,Math.min(q.activeSlideIndex,H.length-1)),itemsToShow:Math.min(H.length,q.itemsToShow||0),itemsToScroll:Math.min(H.length,q.itemsToScroll||1)}):m,U=R.containerProps,$=(U=void 0===U?{}:U).style,G=void 0===$?{}:$,J=U.onClickCapture,K=void 0===J?null:J,Q=s(U,y),Y=R.innerProps,Z=(Y=void 0===Y?{}:Y).style,_=void 0===Z?{}:Z,ee=s(Y,w),te=R.itemsListProps,ne=(te=void 0===te?{}:te).style,re=void 0===ne?{}:ne,ie=te.onTouchStart,oe=void 0===ie?null:ie,ce=te.onMouseDown,de=void 0===ce?null:ce,ae=te.onTransitionEnd,le=void 0===ae?null:ae,ue=s(te,x),se=R.backwardBtnProps,fe=(se=void 0===se?{}:se).children,ve=void 0===fe?null:fe,me=se.show,he=void 0===me||me,pe=s(se,g),be=R.forwardBtnProps,ye=(be=void 0===be?{}:be).children,we=void 0===ye?null:ye,xe=be.show,ge=void 0===xe||xe,Se=s(be,S),Ee=R.activeSlideProps,Ie=(Ee=void 0===Ee?{}:Ee).className,Te=void 0===Ie?"":Ie,Oe=Ee.style,Ce=void 0===Oe?{}:Oe,Le=s(Ee,E),ke=R.visibleSlideProps,Me=(ke=void 0===ke?{}:ke).className,Pe=void 0===Me?"":Me,je=ke.style,We=void 0===je?{}:je,Ae=s(ke,I),Xe=R.updateOnItemClick,Ne=void 0!==Xe&&Xe,De=R.activeSlideIndex,Fe=R.onRequestChange,Ve=R.speed,ze=void 0===Ve?0:Ve,Be=R.delay,qe=void 0===Be?0:Be,He=R.easing,Re=void 0===He?"linear":He,Ue=R.itemsToShow,$e=void 0===Ue?0:Ue,Ge=R.itemsToScroll,Je=void 0===Ge?1:Ge,Ke=R.children,Qe=R.onAfterChange,Ye=R.autoplay,Ze=void 0!==Ye&&Ye,_e=R.autoplayDirection,et=void 0===_e?"forward":_e,tt=R.disableNavIfAllVisible,nt=void 0===tt||tt,rt=R.hideNavIfAllVisible,it=void 0===rt||rt,ot=R.centerMode,ct=void 0!==ot&&ot,dt=R.infinite,at=void 0===dt||dt,lt=R.disableNavIfEdgeVisible,ut=void 0===lt||lt,st=R.disableNavIfEdgeActive,ft=void 0===st||st,vt=R.dotsNav,mt=void 0===vt?{}:vt,ht=R.persistentChangeCallbacks,pt=void 0!==ht&&ht,bt=R.autoplayDelay,yt=void 0===bt?0:bt,wt=mt||{},xt=wt.show,gt=void 0!==xt&&xt,St=wt.containerProps,Et=void 0===St?{}:St,It=wt.itemBtnProps,Tt=void 0===It?{}:It,Ot=wt.activeItemBtnProps,Ct=void 0===Ot?{}:Ot,Lt=i.count(Ke)-1,kt=$e===H.length,Mt=it&&kt,Pt=nt&&kt,jt=De-M==0||!ze&&!qe?"none":"transform ".concat(ze,"ms ").concat(Re," ").concat(qe,"ms"),Wt=o((function(e){var t=e.correctionSlideIndex,n=e.prevCorrectionSlideIndex,r=e.curActiveSlideIndex,i=A.current.offsetWidth,o=A.current.children,c=o.length,d=at?v(o).slice(c/3-n,c/3-n+c/3):v(o),a=d[r].offsetWidth,l=$e?d.reduce((function(e,t,n){return n>=r&&n<r+$e||n<r&&n<r+$e-d.length?e+t.offsetWidth:e}),0):W.current.offsetWidth,u=i-l,s=ct&&at?-(l-a)/2:0,f=at?i/3:0,m=t-r==0?0:"forward"===D.current&&r<t?f:"backward"===D.current&&r>t?-f:0,h=r-t!=0,p=function(e){var t=d.reduce((function(t,n,r){return r>=e?t:t+(n.offsetWidth||0)}),0);return at?t:Math.min(u,t)},b=h&&at?p(t):0,y=h||!at?p(r):0,w=Pt?0:y-b+s+m+f,x="translateX(-".concat(w,"px)"),g=at?f+s:Math.min(u,d.reduce((function(e,t,n){return n<r?e+t.offsetWidth:e}),0)),S=g+l,E=d.map((function(e,t){return{slideIndex:t,htmlElement:e}})),I=at?[].concat(v(d.slice(r).map((function(e,t){return{slideIndex:t+r,htmlElement:e}}))),v(E),v(E),v(d.slice(0,r).map((function(e,t){return{slideIndex:t,htmlElement:e}})))):E,T=I.reduce((function(e,t){var n=t.slideIndex,r=t.htmlElement.offsetWidth;return(e.summ>=g&&e.summ<S||e.summ+r>g&&e.summ+r<=S)&&e.items.push({slideIndex:n,isFullyVisible:e.summ+r<=S&&e.summ>=g}),e.summ+=r,e}),{summ:0,items:[]}),O=!!T.items.find((function(e){return 0===e.slideIndex})),C=!!T.items.find((function(e){return e.slideIndex===d.length-1}));return{slidesHTMLElements:d,innerMaxWidth:l,itemsListMaxTranslateX:u,activeSlideWidth:a,offsetCorrectionForCenterMode:s,offsetCorrectionForInfiniteMode:f,itemsListTranslateX:w,itemsListTransform:x,visibleSlides:T.items,isFirstSlideVisible:O,isLastSlideVisible:C}}),[ct,Pt,at,$e]),At=C?Wt({prevCorrectionSlideIndex:B.current,curActiveSlideIndex:De,correctionSlideIndex:M}):{},Xt=At.innerMaxWidth,Nt=void 0===Xt?0:Xt,Dt=At.itemsListMaxTranslateX,Ft=void 0===Dt?0:Dt,Vt=At.activeSlideWidth,zt=void 0===Vt?0:Vt,Bt=At.offsetCorrectionForCenterMode,qt=void 0===Bt?0:Bt,Ht=At.offsetCorrectionForInfiniteMode,Rt=void 0===Ht?0:Ht,Ut=At.itemsListTranslateX,$t=void 0===Ut?0:Ut,Gt=At.itemsListTransform,Jt=void 0===Gt?"none":Gt,Kt=At.visibleSlides,Qt=void 0===Kt?[]:Kt,Yt=o((function(e){if("forward"===e){var t=De+Je;return t>Lt?at?t-Lt-1:De:t}if("backward"===e){var n=De-Je;return n<0?at?Lt+1+n:De:n}return De}),[De,Je,Lt,at]),Zt=o((function(e,t){if(D.current=t,A.current.style.transition=ze||qe?"transform ".concat(ze,"ms ").concat(Re," ").concat(qe,"ms"):"none",e!==De||pt){clearTimeout(F.current);var n=Wt({correctionSlideIndex:M,prevCorrectionSlideIndex:M,curActiveSlideIndex:e}),r=n.visibleSlides,i=n.isFirstSlideVisible,o=n.isLastSlideVisible;Fe(e,{visibleSlides:r,isFirstSlideVisible:i,isLastSlideVisible:o})}else X.current=0,A.current.style.transform="translateX(-".concat(qt+Rt+(at?0:$t),"px)")}),[pt,De,qt,qe,Re,ze,Fe,Rt,at,$t,M,Wt]),_t=o((function(){Ze&&(clearTimeout(F.current),F.current=setTimeout((function(){Zt(Yt(et),et)}),yt||qe))}),[Ze,et,yt,Zt,Yt,qe]),en=o((function(e){N.current&&(e.preventDefault(),e.stopPropagation(),K&&K(e))}),[K]),tn=o((function(){Zt(Yt("backward"),"backward")}),[Zt,Yt]),nn=o((function(e){N.current=!0;var t=e.touches&&e.touches[0]?e.touches[0].clientX:e.clientX,n=X.current-t+qt+Rt+(at?0:$t),r=A.current.offsetWidth-W.current.offsetWidth,i=Math.max(Math.min(0,-n),-r);A.current.style.transition="none",A.current.style.transform="translateX(".concat(i,"px)")}),[qt,Rt,at,$t]),rn=o((function(e){if(A.current.removeEventListener("mouseout",rn),A.current.removeEventListener("dragstart",rn),document.removeEventListener("mousemove",nn),document.removeEventListener("mouseup",rn),document.removeEventListener("touchmove",nn),document.removeEventListener("touchend",rn),N.current){var t=e.changedTouches&&e.changedTouches.length?e.changedTouches[e.changedTouches.length-1].clientX:e.clientX,n=X.current-t,r=n>zt/2?{index:Yt("forward"),direction:"forward"}:n<-zt/2?{index:Yt("backward"),direction:"backward"}:{index:De,direction:"forward"};r.index===De&&(N.current=!1),Zt(r.index,r.direction)}}),[De,zt,Zt,Yt,nn]),on=o((function(e){clearTimeout(F.current),N.current||(X.current=e.clientX,document.addEventListener("mousemove",nn),document.addEventListener("mouseup",rn),A.current.addEventListener("mouseout",rn),A.current.addEventListener("dragstart",rn)),de&&de(e)}),[nn,rn,de]),cn=o((function(e){clearTimeout(F.current),N.current||(X.current=e.touches[0].clientX,document.addEventListener("touchmove",nn),document.addEventListener("touchend",rn)),oe&&oe(e)}),[nn,rn,oe]),dn=o((function(e){P(De),le&&le(e)}),[De,le]),an=o((function(){Zt(Yt("forward"),"forward")}),[Zt,Yt]),ln=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,d=i.onClick,l=void 0===d?null:d,u=i.style,f=void 0===u?{}:u,v=s(i,T),m=s(e,O),h=at?z.current>=H.length?"forward":"backward":r>=De?"forward":"backward",p=r+t===De,b=Qt.find((function(e){return e.slideIndex===r+t})),y="".concat(c," ").concat(h," ").concat(p?Te:""," ").concat(b?Pe:""),w=a(a(a(a({},f),b?We:{}),p?Ce:{}),{},{boxSizing:"border-box",margin:0}),x=!n&&Ne?function(e){var t=e.direction,n=e.index,r=e.onClick;return function(e){Zt(n,t||(De<n?"forward":"")||(De>n?"backward":"")),r&&r(e)}}({direction:h,index:r+t,onClick:l}):l,g=a(a(a({role:"tabpanel",className:y,style:w,onClick:x},v),b?Ae:{}),p?Le:{});return z.current+=1,a({props:g},m)}))};return c((function(){return X.current=0,M===De&&(N.current=!1),D.current="",De!==M?ze||qe||P(De):(Qe&&Qe(De,M),(at||"forward"===et&&De!==Lt||"backward"===et&&0!==De)&&_t()),function(){clearTimeout(F.current)}}),[M,De,Qe,ze,qe,_t,at,Lt,et]),c((function(){return C&&_t(),function(){clearTimeout(F.current)}}),[C]),c((function(){var e=A.current;function t(){clearTimeout(V.current),clearTimeout(F.current),V.current=setTimeout((function(){C!==window.innerWidth&&L(window.innerWidth)}),400)}return C!==window.innerWidth&&L(window.innerWidth),window.addEventListener("resize",t),function(){clearTimeout(V.current),window.removeEventListener("resize",t),document.removeEventListener("mousemove",nn),document.removeEventListener("mouseup",rn),document.removeEventListener("touchmove",nn),document.removeEventListener("touchend",rn),e.removeEventListener("mouseout",rn),e.removeEventListener("dragstart",rn)}}),[nn,rn]),z.current=0,B.current=M,e.createElement("div",u({onClickCapture:en,style:a({display:"flex",flexFlow:"row wrap",boxSizing:"border-box",justifyContent:"center",width:"100%"},G)},Q,{ref:j}),he&&!Mt&&e.createElement("button",u({},pe,{type:"button",onClick:(0===$t&&ut||0===De&&ft)&&!at?void 0:tn,disabled:"boolean"==typeof pe.disabled?pe.disabled:!(!(0===$t&&ut||0===De&&ft)||at)}),ve),e.createElement("div",u({},ee,{style:a(a({},_),{},{display:"flex",boxSizing:"border-box",flexFlow:"row wrap",padding:"0",overflow:"hidden",maxWidth:Nt?"".concat(Nt,"px"):void 0,flex:Nt?void 0:"1 0"}),ref:W}),e.createElement("div",u({},ue,{style:a(a({},re),{},{display:"flex",boxSizing:"border-box",outline:"none",transition:jt,transform:Jt}),onTouchStart:Pt?void 0:cn,onMouseDown:Pt?void 0:on,onTransitionEnd:ze||qe?dn:void 0,tabIndex:-1,role:"presentation",ref:A}),at&&ln(H.slice(M),M,Pt),ln(H,0,Pt),at&&ln(H,0,Pt),at&&ln(H.slice(0,M),0,Pt))),ge&&!Mt&&e.createElement("button",u({},Se,{type:"button",onClick:($t===Ft&&ut||De===Lt&&ft)&&!at?void 0:an,disabled:"boolean"==typeof Se.disabled?Se.disabled:!(!($t===Ft&&ut||De===Lt&&ft)||at)}),we),!!gt&&e.createElement("div",u({style:{width:"100%",display:"flex",justifyContent:"center"}},Et),Array.from({length:Math.ceil(H.length/Je)}).map((function(t,n){return e.createElement("button",u({type:"button",key:n,title:"".concat(n)},Tt,Math.min(n*Je,H.length-1)===De?Ct:{},{onClick:function(){Zt(Math.min(n*Je,H.length-1),Math.min(n*Je,H.length-1)>De?"forward":"backward")}}))}))))}var L=t(C);export{L 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 l(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,l=!1;try{for(n=n.call(e);!(c=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{c||null==n.return||n.return()}finally{if(l)throw i}}return o}(e,t)||d(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 u(e){return function(e){if(Array.isArray(e))return s(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||d(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 d(e,t){if(e){if("string"==typeof e)return s(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)?s(e,t):void 0}}function s(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"],x=["className","style"],g=["className","onClick","style"],S=["props"];function E(t){var r=t.responsiveProps,o=void 0===r?[]:r,d=l(t,f),s=a(e.useState(0),2),E=s[0],C=s[1],k=a(e.useState(d.activeSlideIndex),2),I=k[0],T=k[1],O=e.useRef(null),L=e.useRef(null),j=e.useRef(null),M=e.useRef(0),P=e.useRef(!1),W=e.useRef(""),A=e.useRef(null),R=e.useRef(null),X=e.useRef(0),N=e.useRef(I),F=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=l(t,m);return E>r&&(!c||E<=c)?i(i({},e),a):e}),d),V=e.Children.toArray(F.children),D=E?i(i({},F),{},{activeSlideIndex:Math.max(0,Math.min(F.activeSlideIndex,V.length-1)),itemsToShow:Math.min(V.length,F.itemsToShow||0),itemsToScroll:Math.min(V.length,F.itemsToScroll||1)}):d,z=D.containerProps,B=(z=void 0===z?{}:z).style,q=void 0===B?{}:B,H=z.onClickCapture,U=void 0===H?null:H,$=l(z,v),G=D.innerProps,J=(G=void 0===G?{}:G).style,K=void 0===J?{}:J,Q=l(G,h),Y=D.itemsListProps,Z=(Y=void 0===Y?{}:Y).style,_=void 0===Z?{}:Z,ee=Y.onTouchStart,te=void 0===ee?null:ee,ne=Y.onMouseDown,re=void 0===ne?null:ne,ie=Y.onTransitionEnd,oe=void 0===ie?null:ie,ce=l(Y,b),le=D.backwardBtnProps,ae=(le=void 0===le?{}:le).children,ue=void 0===ae?null:ae,de=le.show,se=void 0===de||de,fe=l(le,p),me=D.forwardBtnProps,ve=(me=void 0===me?{}:me).children,he=void 0===ve?null:ve,be=me.show,pe=void 0===be||be,ye=l(me,y),we=D.activeSlideProps,xe=(we=void 0===we?{}:we).className,ge=void 0===xe?"":xe,Se=we.style,Ee=void 0===Se?{}:Se,Ce=l(we,w),ke=D.visibleSlideProps,Ie=(ke=void 0===ke?{}:ke).className,Te=void 0===Ie?"":Ie,Oe=ke.style,Le=void 0===Oe?{}:Oe,je=l(ke,x),Me=D.updateOnItemClick,Pe=void 0!==Me&&Me,We=D.activeSlideIndex,Ae=D.onRequestChange,Re=D.speed,Xe=void 0===Re?0:Re,Ne=D.delay,Fe=void 0===Ne?0:Ne,Ve=D.easing,De=void 0===Ve?"linear":Ve,ze=D.itemsToShow,Be=void 0===ze?0:ze,qe=D.itemsToScroll,He=void 0===qe?1:qe,Ue=D.children,$e=D.onAfterChange,Ge=D.autoplay,Je=void 0!==Ge&&Ge,Ke=D.autoplayDirection,Qe=void 0===Ke?"forward":Ke,Ye=D.disableNavIfAllVisible,Ze=void 0===Ye||Ye,_e=D.hideNavIfAllVisible,et=void 0===_e||_e,tt=D.centerMode,nt=void 0!==tt&&tt,rt=D.infinite,it=void 0===rt||rt,ot=D.disableNavIfEdgeVisible,ct=void 0===ot||ot,lt=D.disableNavIfEdgeActive,at=void 0===lt||lt,ut=D.dotsNav,dt=void 0===ut?{}:ut,st=D.persistentChangeCallbacks,ft=void 0!==st&&st,mt=dt||{},vt=mt.show,ht=void 0!==vt&&vt,bt=mt.containerProps,pt=void 0===bt?{}:bt,yt=mt.itemBtnProps,wt=void 0===yt?{}:yt,xt=mt.activeItemBtnProps,gt=void 0===xt?{}:xt,St=e.Children.count(Ue)-1,Et=Be===V.length,Ct=et&&Et,kt=Ze&&Et,It=We-I==0||!Xe&&!Fe?"none":"transform ".concat(Xe,"ms ").concat(De," ").concat(Fe,"ms"),Tt=e.useCallback((function(e){var t=e.correctionSlideIndex,n=e.prevCorrectionSlideIndex,r=e.curActiveSlideIndex,i=it?u(j.current.children).slice(j.current.children.length/3-n,j.current.children.length/3-n+j.current.children.length/3):u(j.current.children),o=i[r].offsetWidth,c=Be?i.reduce((function(e,t,n){return n>=r&&n<r+Be||n<r&&n<r+Be-i.length?e+t.offsetWidth:e}),0):L.current.offsetWidth,l=j.current.offsetWidth-c,a=nt&&it?-(c-o)/2:0,d=it?j.current.offsetWidth/3:0,s=t-r==0?0:"forward"===W.current&&r<t?d:"backward"===W.current&&r>t?-d:0,f=r-t!=0,m=function(e){var t=i.reduce((function(t,n,r){return r>=e?t:t+(n.offsetWidth||0)}),0);return it?t:Math.min(l,t)},v=f&&it?m(t):0,h=f||!it?m(r):0,b=kt?0:h-v+a+s+d,p="translateX(-".concat(b,"px)"),y=it?d+a:Math.min(j.current.offsetWidth-c,i.reduce((function(e,t,n){return n<r?e+t.offsetWidth:e}),0)),w=y+c,x=it?[].concat(u(i.slice(r).map((function(e,t){return{slideIndex:t+r,htmlElement:e}}))),u(i.map((function(e,t){return{slideIndex:t,htmlElement:e}}))),u(i.map((function(e,t){return{slideIndex:t,htmlElement:e}}))),u(i.slice(0,r).map((function(e,t){return{slideIndex:t,htmlElement:e}})))):i.map((function(e,t){return{slideIndex:t,htmlElement:e}})),g=x.reduce((function(e,t){var n=t.slideIndex,r=t.htmlElement.offsetWidth;return(e.summ>=y&&e.summ<w||e.summ+r>y&&e.summ+r<=w)&&e.items.push({slideIndex:n,isFullyVisible:e.summ+r<=w&&e.summ>=y}),e.summ+=r,e}),{summ:0,items:[]}),S=!!g.items.find((function(e){return 0===e.slideIndex})),E=!!g.items.find((function(e){return e.slideIndex===i.length-1}));return{slidesHTMLElements:i,innerMaxWidth:c,itemsListMaxTranslateX:l,activeSlideWidth:o,offsetCorrectionForCenterMode:a,offsetCorrectionForInfiniteMode:d,itemsListTranslateX:b,itemsListTransform:p,visibleSlides:g.items,isFirstSlideVisible:S,isLastSlideVisible:E}}),[nt,kt,it,Be]),Ot=E?Tt({prevCorrectionSlideIndex:N.current,curActiveSlideIndex:We,correctionSlideIndex:I}):{},Lt=Ot.innerMaxWidth,jt=void 0===Lt?0:Lt,Mt=Ot.itemsListMaxTranslateX,Pt=void 0===Mt?0:Mt,Wt=Ot.activeSlideWidth,At=void 0===Wt?0:Wt,Rt=Ot.offsetCorrectionForCenterMode,Xt=void 0===Rt?0:Rt,Nt=Ot.offsetCorrectionForInfiniteMode,Ft=void 0===Nt?0:Nt,Vt=Ot.itemsListTranslateX,Dt=void 0===Vt?0:Vt,zt=Ot.itemsListTransform,Bt=void 0===zt?"none":zt,qt=Ot.visibleSlides,Ht=void 0===qt?[]:qt,Ut=e.useCallback((function(e){if("forward"===e){var t=We+He;return t>St?it?t-St-1:We:t}if("backward"===e){var n=We-He;return n<0?it?St+1+n:We:n}return We}),[We,He,St,it]),$t=e.useCallback((function(e,t){if(W.current=t,j.current.style.transition=Xe||Fe?"transform ".concat(Xe,"ms ").concat(De," ").concat(Fe,"ms"):"none",e!==We||ft){clearTimeout(A.current);var n=Tt({correctionSlideIndex:I,prevCorrectionSlideIndex:I,curActiveSlideIndex:e}),r=n.visibleSlides,i=n.isFirstSlideVisible,o=n.isLastSlideVisible;Ae(e,{visibleSlides:r,isFirstSlideVisible:i,isLastSlideVisible:o})}else M.current=0,j.current.style.transform="translateX(-".concat(Xt+Ft+(it?0:Dt),"px)")}),[ft,We,Xt,Fe,De,Xe,Ae,Ft,it,Dt,I,Tt]),Gt=e.useCallback((function(){Je&&(clearTimeout(A.current),A.current=setTimeout((function(){$t(Ut(Qe),Qe)}),Fe))}),[Je,Qe,$t,Ut,Fe]),Jt=e.useCallback((function(e){P.current&&(e.preventDefault(),e.stopPropagation(),U&&U(e))}),[U]),Kt=e.useCallback((function(){$t(Ut("backward"),"backward")}),[$t,Ut]),Qt=e.useCallback((function(e){P.current=!0;var t=e.touches&&e.touches[0]?e.touches[0].clientX:e.clientX,n=M.current-t+Xt+Ft+(it?0:Dt),r=j.current.offsetWidth-L.current.offsetWidth,i=Math.max(Math.min(0,-n),-r);j.current.style.transition="none",j.current.style.transform="translateX(".concat(i,"px)")}),[Xt,Ft,it,Dt]),Yt=e.useCallback((function(e){if(j.current.removeEventListener("mouseout",Yt),j.current.removeEventListener("dragstart",Yt),document.removeEventListener("mousemove",Qt),document.removeEventListener("mouseup",Yt),document.removeEventListener("touchmove",Qt),document.removeEventListener("touchend",Yt),P.current){var t=e.changedTouches&&e.changedTouches.length?e.changedTouches[e.changedTouches.length-1].clientX:e.clientX,n=M.current-t,r=n>At/2?{index:Ut("forward"),direction:"forward"}:n<-At/2?{index:Ut("backward"),direction:"backward"}:{index:We,direction:"forward"};r.index===We&&(P.current=!1),$t(r.index,r.direction)}}),[We,At,$t,Ut,Qt]),Zt=e.useCallback((function(e){clearTimeout(A.current),P.current||(M.current=e.clientX,document.addEventListener("mousemove",Qt),document.addEventListener("mouseup",Yt),j.current.addEventListener("mouseout",Yt),j.current.addEventListener("dragstart",Yt)),re&&re(e)}),[Qt,Yt,re]),_t=e.useCallback((function(e){clearTimeout(A.current),P.current||(M.current=e.touches[0].clientX,document.addEventListener("touchmove",Qt),document.addEventListener("touchend",Yt)),te&&te(e)}),[Qt,Yt,te]),en=e.useCallback((function(e){T(We),oe&&oe(e)}),[We,oe]),tn=e.useCallback((function(){$t(Ut("forward"),"forward")}),[$t,Ut]),nn=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,u=o.onClick,d=void 0===u?null:u,s=o.style,f=void 0===s?{}:s,m=l(o,g),v=l(e,S),h=it?X.current>=V.length?"forward":"backward":r>=We?"forward":"backward",b=r+t===We,p=Ht.find((function(e){return e.slideIndex===r+t})),y="".concat(a," ").concat(h," ").concat(b?ge:""," ").concat(p?Te:""),w=i(i(i(i({},f),p?Le:{}),b?Ee:{}),{},{boxSizing:"border-box",margin:0}),x=!n&&Pe?function(e){var t=e.direction,n=e.index,r=e.onClick;return function(e){$t(n,t||(We<n?"forward":"")||(We>n?"backward":"")),r&&r(e)}}({direction:h,index:r+t,onClick:d}):d,E=i(i(i({role:"tabpanel",className:y,style:w,onClick:x},m),p?je:{}),b?Ce:{});return X.current+=1,i({props:E},v)}))};return e.useEffect((function(){return M.current=0,I===We&&(P.current=!1),W.current="",We!==I?Xe||Fe||T(We):($e&&$e(We,I),(it||"forward"===Qe&&We!==St||"backward"===Qe&&0!==We)&&Gt()),function(){clearTimeout(A.current)}}),[I,We,$e,Xe,Fe,Gt,it,St,Qe]),e.useEffect((function(){return E&&Gt(),function(){clearTimeout(A.current)}}),[E]),e.useEffect((function(){var e=j.current;function t(){clearTimeout(R.current),clearTimeout(A.current),R.current=setTimeout((function(){E!==window.innerWidth&&C(window.innerWidth)}),400)}return E!==window.innerWidth&&C(window.innerWidth),window.addEventListener("resize",t),function(){clearTimeout(R.current),window.removeEventListener("resize",t),document.removeEventListener("mousemove",Qt),document.removeEventListener("mouseup",Yt),document.removeEventListener("touchmove",Qt),document.removeEventListener("touchend",Yt),e.removeEventListener("mouseout",Yt),e.removeEventListener("dragstart",Yt)}}),[Qt,Yt]),X.current=0,N.current=I,n.default.createElement("div",c({onClickCapture:Jt,style:i({display:"flex",flexFlow:"row wrap",boxSizing:"border-box",justifyContent:"center",width:"100%"},q)},$,{ref:O}),se&&!Ct&&n.default.createElement("button",c({},fe,{type:"button",onClick:(0===Dt&&ct||0===We&&at)&&!it?void 0:Kt,disabled:"boolean"==typeof fe.disabled?fe.disabled:!(!(0===Dt&&ct||0===We&&at)||it)}),ue),n.default.createElement("div",c({},Q,{style:i(i({},K),{},{display:"flex",boxSizing:"border-box",flexFlow:"row wrap",padding:"0",overflow:"hidden",maxWidth:jt?"".concat(jt,"px"):void 0,flex:jt?void 0:"1 0"}),ref:L}),n.default.createElement("div",c({},ce,{style:i(i({},_),{},{display:"flex",boxSizing:"border-box",outline:"none",transition:It,transform:Bt}),onTouchStart:kt?void 0:_t,onMouseDown:kt?void 0:Zt,onTransitionEnd:Xe||Fe?en:void 0,tabIndex:-1,role:"presentation",ref:j}),it&&nn(V.slice(I),I,kt),nn(V,0,kt),it&&nn(V,0,kt),it&&nn(V.slice(0,I),0,kt))),pe&&!Ct&&n.default.createElement("button",c({},ye,{type:"button",onClick:(Dt===Pt&&ct||We===St&&at)&&!it?void 0:tn,disabled:"boolean"==typeof ye.disabled?ye.disabled:!(!(Dt===Pt&&ct||We===St&&at)||it)}),he),!!ht&&n.default.createElement("div",c({style:{width:"100%",display:"flex",justifyContent:"center"}},pt),Array.from({length:Math.ceil(V.length/He)}).map((function(e,t){return n.default.createElement("button",c({type:"button",key:t,title:"".concat(t)},wt,Math.min(t*He,V.length-1)===We?gt:{},{onClick:function(){$t(Math.min(t*He,V.length-1),Math.min(t*He,V.length-1)>We?"forward":"backward")}}))}))))}return e.memo(E)})); | ||
!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 a(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,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)||d(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 u(e){return function(e){if(Array.isArray(e))return s(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||d(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 d(e,t){if(e){if("string"==typeof e)return s(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)?s(e,t):void 0}}function s(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"],x=["className","style"],g=["className","onClick","style"],S=["props"];function C(t){var r=t.responsiveProps,o=void 0===r?[]:r,d=a(t,f),s=l(e.useState(0),2),C=s[0],E=s[1],k=l(e.useState(d.activeSlideIndex),2),T=k[0],I=k[1],O=e.useRef(null),L=e.useRef(null),j=e.useRef(null),M=e.useRef(0),P=e.useRef(!1),W=e.useRef(""),A=e.useRef(null),R=e.useRef(null),X=e.useRef(0),N=e.useRef(T),D=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=a(t,m);return C>r&&(!c||C<=c)?i(i({},e),l):e}),d),F=e.Children.toArray(D.children),V=C?i(i({},D),{},{activeSlideIndex:Math.max(0,Math.min(D.activeSlideIndex,F.length-1)),itemsToShow:Math.min(F.length,D.itemsToShow||0),itemsToScroll:Math.min(F.length,D.itemsToScroll||1)}):d,z=V.containerProps,B=(z=void 0===z?{}:z).style,q=void 0===B?{}:B,H=z.onClickCapture,U=void 0===H?null:H,$=a(z,v),G=V.innerProps,J=(G=void 0===G?{}:G).style,K=void 0===J?{}:J,Q=a(G,h),Y=V.itemsListProps,Z=(Y=void 0===Y?{}:Y).style,_=void 0===Z?{}:Z,ee=Y.onTouchStart,te=void 0===ee?null:ee,ne=Y.onMouseDown,re=void 0===ne?null:ne,ie=Y.onTransitionEnd,oe=void 0===ie?null:ie,ce=a(Y,b),ae=V.backwardBtnProps,le=(ae=void 0===ae?{}:ae).children,ue=void 0===le?null:le,de=ae.show,se=void 0===de||de,fe=a(ae,p),me=V.forwardBtnProps,ve=(me=void 0===me?{}:me).children,he=void 0===ve?null:ve,be=me.show,pe=void 0===be||be,ye=a(me,y),we=V.activeSlideProps,xe=(we=void 0===we?{}:we).className,ge=void 0===xe?"":xe,Se=we.style,Ce=void 0===Se?{}:Se,Ee=a(we,w),ke=V.visibleSlideProps,Te=(ke=void 0===ke?{}:ke).className,Ie=void 0===Te?"":Te,Oe=ke.style,Le=void 0===Oe?{}:Oe,je=a(ke,x),Me=V.updateOnItemClick,Pe=void 0!==Me&&Me,We=V.activeSlideIndex,Ae=V.onRequestChange,Re=V.speed,Xe=void 0===Re?0:Re,Ne=V.delay,De=void 0===Ne?0:Ne,Fe=V.easing,Ve=void 0===Fe?"linear":Fe,ze=V.itemsToShow,Be=void 0===ze?0:ze,qe=V.itemsToScroll,He=void 0===qe?1:qe,Ue=V.children,$e=V.onAfterChange,Ge=V.autoplay,Je=void 0!==Ge&&Ge,Ke=V.autoplayDirection,Qe=void 0===Ke?"forward":Ke,Ye=V.disableNavIfAllVisible,Ze=void 0===Ye||Ye,_e=V.hideNavIfAllVisible,et=void 0===_e||_e,tt=V.centerMode,nt=void 0!==tt&&tt,rt=V.infinite,it=void 0===rt||rt,ot=V.disableNavIfEdgeVisible,ct=void 0===ot||ot,at=V.disableNavIfEdgeActive,lt=void 0===at||at,ut=V.dotsNav,dt=void 0===ut?{}:ut,st=V.persistentChangeCallbacks,ft=void 0!==st&&st,mt=V.autoplayDelay,vt=void 0===mt?0:mt,ht=dt||{},bt=ht.show,pt=void 0!==bt&&bt,yt=ht.containerProps,wt=void 0===yt?{}:yt,xt=ht.itemBtnProps,gt=void 0===xt?{}:xt,St=ht.activeItemBtnProps,Ct=void 0===St?{}:St,Et=e.Children.count(Ue)-1,kt=Be===F.length,Tt=et&&kt,It=Ze&&kt,Ot=We-T==0||!Xe&&!De?"none":"transform ".concat(Xe,"ms ").concat(Ve," ").concat(De,"ms"),Lt=e.useCallback((function(e){var t=e.correctionSlideIndex,n=e.prevCorrectionSlideIndex,r=e.curActiveSlideIndex,i=j.current.offsetWidth,o=j.current.children,c=o.length,a=it?u(o).slice(c/3-n,c/3-n+c/3):u(o),l=a[r].offsetWidth,d=Be?a.reduce((function(e,t,n){return n>=r&&n<r+Be||n<r&&n<r+Be-a.length?e+t.offsetWidth:e}),0):L.current.offsetWidth,s=i-d,f=nt&&it?-(d-l)/2:0,m=it?i/3:0,v=t-r==0?0:"forward"===W.current&&r<t?m:"backward"===W.current&&r>t?-m:0,h=r-t!=0,b=function(e){var t=a.reduce((function(t,n,r){return r>=e?t:t+(n.offsetWidth||0)}),0);return it?t:Math.min(s,t)},p=h&&it?b(t):0,y=h||!it?b(r):0,w=It?0:y-p+f+v+m,x="translateX(-".concat(w,"px)"),g=it?m+f:Math.min(s,a.reduce((function(e,t,n){return n<r?e+t.offsetWidth:e}),0)),S=g+d,C=a.map((function(e,t){return{slideIndex:t,htmlElement:e}})),E=it?[].concat(u(a.slice(r).map((function(e,t){return{slideIndex:t+r,htmlElement:e}}))),u(C),u(C),u(a.slice(0,r).map((function(e,t){return{slideIndex:t,htmlElement:e}})))):C,k=E.reduce((function(e,t){var n=t.slideIndex,r=t.htmlElement.offsetWidth;return(e.summ>=g&&e.summ<S||e.summ+r>g&&e.summ+r<=S)&&e.items.push({slideIndex:n,isFullyVisible:e.summ+r<=S&&e.summ>=g}),e.summ+=r,e}),{summ:0,items:[]}),T=!!k.items.find((function(e){return 0===e.slideIndex})),I=!!k.items.find((function(e){return e.slideIndex===a.length-1}));return{slidesHTMLElements:a,innerMaxWidth:d,itemsListMaxTranslateX:s,activeSlideWidth:l,offsetCorrectionForCenterMode:f,offsetCorrectionForInfiniteMode:m,itemsListTranslateX:w,itemsListTransform:x,visibleSlides:k.items,isFirstSlideVisible:T,isLastSlideVisible:I}}),[nt,It,it,Be]),jt=C?Lt({prevCorrectionSlideIndex:N.current,curActiveSlideIndex:We,correctionSlideIndex:T}):{},Mt=jt.innerMaxWidth,Pt=void 0===Mt?0:Mt,Wt=jt.itemsListMaxTranslateX,At=void 0===Wt?0:Wt,Rt=jt.activeSlideWidth,Xt=void 0===Rt?0:Rt,Nt=jt.offsetCorrectionForCenterMode,Dt=void 0===Nt?0:Nt,Ft=jt.offsetCorrectionForInfiniteMode,Vt=void 0===Ft?0:Ft,zt=jt.itemsListTranslateX,Bt=void 0===zt?0:zt,qt=jt.itemsListTransform,Ht=void 0===qt?"none":qt,Ut=jt.visibleSlides,$t=void 0===Ut?[]:Ut,Gt=e.useCallback((function(e){if("forward"===e){var t=We+He;return t>Et?it?t-Et-1:We:t}if("backward"===e){var n=We-He;return n<0?it?Et+1+n:We:n}return We}),[We,He,Et,it]),Jt=e.useCallback((function(e,t){if(W.current=t,j.current.style.transition=Xe||De?"transform ".concat(Xe,"ms ").concat(Ve," ").concat(De,"ms"):"none",e!==We||ft){clearTimeout(A.current);var n=Lt({correctionSlideIndex:T,prevCorrectionSlideIndex:T,curActiveSlideIndex:e}),r=n.visibleSlides,i=n.isFirstSlideVisible,o=n.isLastSlideVisible;Ae(e,{visibleSlides:r,isFirstSlideVisible:i,isLastSlideVisible:o})}else M.current=0,j.current.style.transform="translateX(-".concat(Dt+Vt+(it?0:Bt),"px)")}),[ft,We,Dt,De,Ve,Xe,Ae,Vt,it,Bt,T,Lt]),Kt=e.useCallback((function(){Je&&(clearTimeout(A.current),A.current=setTimeout((function(){Jt(Gt(Qe),Qe)}),vt||De))}),[Je,Qe,vt,Jt,Gt,De]),Qt=e.useCallback((function(e){P.current&&(e.preventDefault(),e.stopPropagation(),U&&U(e))}),[U]),Yt=e.useCallback((function(){Jt(Gt("backward"),"backward")}),[Jt,Gt]),Zt=e.useCallback((function(e){P.current=!0;var t=e.touches&&e.touches[0]?e.touches[0].clientX:e.clientX,n=M.current-t+Dt+Vt+(it?0:Bt),r=j.current.offsetWidth-L.current.offsetWidth,i=Math.max(Math.min(0,-n),-r);j.current.style.transition="none",j.current.style.transform="translateX(".concat(i,"px)")}),[Dt,Vt,it,Bt]),_t=e.useCallback((function(e){if(j.current.removeEventListener("mouseout",_t),j.current.removeEventListener("dragstart",_t),document.removeEventListener("mousemove",Zt),document.removeEventListener("mouseup",_t),document.removeEventListener("touchmove",Zt),document.removeEventListener("touchend",_t),P.current){var t=e.changedTouches&&e.changedTouches.length?e.changedTouches[e.changedTouches.length-1].clientX:e.clientX,n=M.current-t,r=n>Xt/2?{index:Gt("forward"),direction:"forward"}:n<-Xt/2?{index:Gt("backward"),direction:"backward"}:{index:We,direction:"forward"};r.index===We&&(P.current=!1),Jt(r.index,r.direction)}}),[We,Xt,Jt,Gt,Zt]),en=e.useCallback((function(e){clearTimeout(A.current),P.current||(M.current=e.clientX,document.addEventListener("mousemove",Zt),document.addEventListener("mouseup",_t),j.current.addEventListener("mouseout",_t),j.current.addEventListener("dragstart",_t)),re&&re(e)}),[Zt,_t,re]),tn=e.useCallback((function(e){clearTimeout(A.current),P.current||(M.current=e.touches[0].clientX,document.addEventListener("touchmove",Zt),document.addEventListener("touchend",_t)),te&&te(e)}),[Zt,_t,te]),nn=e.useCallback((function(e){I(We),oe&&oe(e)}),[We,oe]),rn=e.useCallback((function(){Jt(Gt("forward"),"forward")}),[Jt,Gt]),on=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,u=o.onClick,d=void 0===u?null:u,s=o.style,f=void 0===s?{}:s,m=a(o,g),v=a(e,S),h=it?X.current>=F.length?"forward":"backward":r>=We?"forward":"backward",b=r+t===We,p=$t.find((function(e){return e.slideIndex===r+t})),y="".concat(l," ").concat(h," ").concat(b?ge:""," ").concat(p?Ie:""),w=i(i(i(i({},f),p?Le:{}),b?Ce:{}),{},{boxSizing:"border-box",margin:0}),x=!n&&Pe?function(e){var t=e.direction,n=e.index,r=e.onClick;return function(e){Jt(n,t||(We<n?"forward":"")||(We>n?"backward":"")),r&&r(e)}}({direction:h,index:r+t,onClick:d}):d,C=i(i(i({role:"tabpanel",className:y,style:w,onClick:x},m),p?je:{}),b?Ee:{});return X.current+=1,i({props:C},v)}))};return e.useEffect((function(){return M.current=0,T===We&&(P.current=!1),W.current="",We!==T?Xe||De||I(We):($e&&$e(We,T),(it||"forward"===Qe&&We!==Et||"backward"===Qe&&0!==We)&&Kt()),function(){clearTimeout(A.current)}}),[T,We,$e,Xe,De,Kt,it,Et,Qe]),e.useEffect((function(){return C&&Kt(),function(){clearTimeout(A.current)}}),[C]),e.useEffect((function(){var e=j.current;function t(){clearTimeout(R.current),clearTimeout(A.current),R.current=setTimeout((function(){C!==window.innerWidth&&E(window.innerWidth)}),400)}return C!==window.innerWidth&&E(window.innerWidth),window.addEventListener("resize",t),function(){clearTimeout(R.current),window.removeEventListener("resize",t),document.removeEventListener("mousemove",Zt),document.removeEventListener("mouseup",_t),document.removeEventListener("touchmove",Zt),document.removeEventListener("touchend",_t),e.removeEventListener("mouseout",_t),e.removeEventListener("dragstart",_t)}}),[Zt,_t]),X.current=0,N.current=T,n.default.createElement("div",c({onClickCapture:Qt,style:i({display:"flex",flexFlow:"row wrap",boxSizing:"border-box",justifyContent:"center",width:"100%"},q)},$,{ref:O}),se&&!Tt&&n.default.createElement("button",c({},fe,{type:"button",onClick:(0===Bt&&ct||0===We&<)&&!it?void 0:Yt,disabled:"boolean"==typeof fe.disabled?fe.disabled:!(!(0===Bt&&ct||0===We&<)||it)}),ue),n.default.createElement("div",c({},Q,{style:i(i({},K),{},{display:"flex",boxSizing:"border-box",flexFlow:"row wrap",padding:"0",overflow:"hidden",maxWidth:Pt?"".concat(Pt,"px"):void 0,flex:Pt?void 0:"1 0"}),ref:L}),n.default.createElement("div",c({},ce,{style:i(i({},_),{},{display:"flex",boxSizing:"border-box",outline:"none",transition:Ot,transform:Ht}),onTouchStart:It?void 0:tn,onMouseDown:It?void 0:en,onTransitionEnd:Xe||De?nn:void 0,tabIndex:-1,role:"presentation",ref:j}),it&&on(F.slice(T),T,It),on(F,0,It),it&&on(F,0,It),it&&on(F.slice(0,T),0,It))),pe&&!Tt&&n.default.createElement("button",c({},ye,{type:"button",onClick:(Bt===At&&ct||We===Et&<)&&!it?void 0:rn,disabled:"boolean"==typeof ye.disabled?ye.disabled:!(!(Bt===At&&ct||We===Et&<)||it)}),he),!!pt&&n.default.createElement("div",c({style:{width:"100%",display:"flex",justifyContent:"center"}},wt),Array.from({length:Math.ceil(F.length/He)}).map((function(e,t){return n.default.createElement("button",c({type:"button",key:t,title:"".concat(t)},gt,Math.min(t*He,F.length-1)===We?Ct:{},{onClick:function(){Jt(Math.min(t*He,F.length-1),Math.min(t*He,F.length-1)>We?"forward":"backward")}}))}))))}return e.memo(C)})); |
{ | ||
"name": "react-simply-carousel", | ||
"version": "8.3.5", | ||
"version": "8.4.0", | ||
"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": [ |
@@ -165,2 +165,3 @@ # react-simply-carousel | ||
| **visibleSlideProps** | object | `{}` | DOM props for visible slide element | | ||
| **autoplayDelay** | number | `0` | after what period of time the auto-update function of the active slide will be launched | | ||
@@ -167,0 +168,0 @@ ## Demo |
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
51882
170
1