New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@trendyol-js/react-carousel

Package Overview
Dependencies
Maintainers
1
Versions
30
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@trendyol-js/react-carousel - npm Package Compare versions

Comparing version

to
1.2.0-beta.2

__tests__/__fixtures__/nodes.tsx

16

dist/cjs/index.js

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

"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t=require("react"),n=(e=t)&&"object"==typeof e&&"default"in e?e.default:e,r=function(){return(r=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)};function i(e,t){void 0===t&&(t={});var n=t.insertAt;if(e&&"undefined"!=typeof document){var r=document.head||document.getElementsByTagName("head")[0],i=document.createElement("style");i.type="text/css","top"===n&&r.firstChild?r.insertBefore(i,r.firstChild):r.appendChild(i),i.styleSheet?i.styleSheet.cssText=e:i.appendChild(document.createTextNode(e))}}var s="styles-module_carousel-base__3keqD",o="styles-module_item-provider__YgMwz",a="styles-module_item-container__a8zaY",l="styles-module_item-tracker__3bypy",u="styles-module_carousel-arrow__26sRw";i(".styles-module_carousel-base__3keqD {\n\twidth: 100%;\n\tbox-sizing: border-box;\n\tdisplay: flex;\n\toutline: none;\n}\n\n.styles-module_item-provider__YgMwz {\n\toverflow: hidden;\n\twidth: 100%;\n\tcursor: pointer;\n}\n\n.styles-module_item-container__a8zaY img {\n\t-webkit-user-select: none;\n\t user-select: none;\n\t-webkit-user-drag: none;\n}\n\n.styles-module_item-tracker__3bypy {\n\theight: 100%;\n\tdisplay: flex;\n}\n\n.styles-module_carousel-arrow__26sRw {\n\tz-index: 1;\n}\n");var c,f=function(e){return n.createElement("button",{className:u,onClick:e.onClick,"data-direction":e.direction})};!function(e){e[e.Right=-1]="Right",e[e.Left=1]="Left"}(c||(c={}));var d=function(){function e(e,t){this.arr=e,this.currentIndex=t}return e.prototype.next=function(){var e=this.currentIndex,t=this.arr;return this.currentIndex=e<t.length-1?e+1:0,this.current()},e.prototype.prev=function(){var e=this.currentIndex,t=this.arr;return this.currentIndex=e>0&&e<t.length?e-1:t.length-1,this.current()},e.prototype.current=function(){return this.arr[this.currentIndex]},e}(),h=function(e,t,n){return n*e*t},m=function(e,t,n,r){var i=e>t;return n?{left:i,right:i}:{left:i&&0!==r,right:i&&r+t<e}},v=function(e,t,n){if(!n)return e;for(var r=Array.from(e),i=new d(e,0),s=0;s<t;s++)r.unshift(i.prev());return r};function g(e){return e.nativeEvent instanceof MouseEvent?e.nativeEvent.pageX:e.nativeEvent instanceof TouchEvent?e.nativeEvent.changedTouches[0].pageX:0}function p(e,t,n,r,i){if(n&&n.length<t.length)return v(t,r,i);var s=e.map((function(e){return t.find((function(t){return e.key===t.key}))}));return s.some((function(e){return void 0===e}))?v(t,r,i):s}var y=function(e){var i=t.useState(200),s=i[0],u=i[1],f=t.useCallback((function(t){if(null!==t){var n=t.getBoundingClientRect().width/e.show;u(n),e.widthCallBack(n)}}),[s]);e.responsive&&function(e){var n=t.useState(window.innerWidth),r=n[0],i=n[1];t.useLayoutEffect((function(){var t=function(){var t=r-window.innerWidth;i(window.innerWidth),e(t)};return window.addEventListener("resize",t),function(){return window.removeEventListener("resize",t)}}),[])}((function(e){u(s-e)}));var d=t.useState({initial:e.transform,start:0,isDown:!1,drag:0,finished:!0,pointers:!0}),h=d[0],m=d[1],v=function(t){t.persist(),m(r(r({},h),{isDown:!0,start:g(t),initial:e.transform,finished:!1}))},p=function(t){if(t.persist(),!h.finished){if(Math.abs(h.drag)<s*e.swipeOn)return e.dragCallback(e.transform),m({initial:e.transform,start:0,isDown:!1,drag:0,finished:!0,pointers:!0});e.slideCallback(h.drag>0?c.Right:c.Left),m(r(r({},h),{drag:0,isDown:!1,finished:!0,pointers:!0}))}},y=function(e){if(e.persist(),h.isDown){var t=g(e);m(r(r({},h),{drag:h.start-t,pointers:!1}))}},w=e.swiping?{onTouchCancel:p,onTouchEnd:p,onTouchMove:y,onTouchStart:v,onMouseDown:v,onMouseLeave:p,onMouseUp:p,onMouseMove:y}:{};return n.createElement("div",{ref:f,className:o},n.createElement("div",r({"":"trackList"},w,{className:l,style:{transform:"translateX("+(e.transform-h.drag)+"px)",transition:"transform "+e.transition+"s ease 0s",width:s*e.items.length}}),e.items.map((function(e,t){return n.createElement("div",{key:t,style:{width:s,pointerEvents:h.pointers?"all":"none"},className:a},e)}))))},w={children:[],show:1,slide:1,transition:.5,swiping:!1,swipeOn:1,responsive:!1,infinite:!0,className:"",useArrowKeys:!1,a11y:{},dynamic:!1,paginationCallback:null,pageCount:0},_="styles-module_sliderBase__swkx1",L="styles-module_slider__o0fqa",b="styles-module_sliding__3T6T6";i(".styles-module_sliderBase__swkx1 {\n\twidth: 100%;\n\tposition: relative;\n}\n\n.styles-module_slider__o0fqa {\n\tdisplay: flex;\n\toverflow-x: auto;\n\tscrollbar-width: none; /* Firefox 64 */\n\t-ms-overflow-style: none; /* Internet Explorer 11 */\n}\n\n.styles-module_slider__o0fqa::-webkit-scrollbar {\n\t/** WebKit */\n\tdisplay: none;\n}\n\n.styles-module_slider__o0fqa > * {\n\tflex: 0 0 auto;\n}\n\n.styles-module_sliding__3T6T6 > * {\n\tpointer-events: none;\n}\n");exports.Carousel=function(e){var i,o,a=r(r({},w),e),l=t.useState(v(a.children,a.slide,a.infinite)),u=l[0],g=l[1],_=t.useState(0),L=_[0],b=_[1],k=t.useState({transform:0,transition:0,isSliding:!1}),C=k[0],E=k[1],x=t.useState(0),S=x[0],R=x[1],M=t.useState(m(a.children.length,a.show,a.infinite,S)),T=M[0],I=M[1],N=(i=e.children,o=t.useRef(),t.useEffect((function(){o.current=i})),o.current),D=t.useState(0),W=D[0],z=D[1],X=t.useRef(v(a.children,a.slide,a.infinite)),q=t.useRef(!1);a.dynamic&&t.useEffect((function(){var e=p(X.current,a.children,N,a.slide,a.infinite);g(e),X.current=e,W<a.pageCount&&N&&(null==N?void 0:N.length)<a.children.length&&(B(c.Right),z(W+1))}),[a.children]);var B=function(e){if(!(C.isSliding||e===c.Right&&!T.right||e===c.Left&&!T.left)){if(a.paginationCallback&&e===c.Right&&W<a.pageCount-1&&!q.current)return q.current=!0,void a.paginationCallback(e);var t=a.children,n=function(e,t,n,r){var i=e-r*t;return i<0?n+i:n<=i?i-n:i}(S,a.slide,t.length,e),r=a.infinite?function(e,t,n,r,i,s){var o=new d(e,n),a=Array.from(t);switch(+s){case c.Left:for(var l=i;l>=0;l--)(i-l<0||!a[l-i])&&a.unshift(o.current()),o.prev();break;case c.Right:for(l=0;l<r+i;l++)a[2*i+l]||a.push(o.current()),o.next()}return a}(t,u,n,a.show,a.slide,e):u;a.infinite&&e===c.Right&&(g(r),X.current=r),E({transform:C.transform+h(L,a.slide,e),transition:a.transition,isSliding:!0}),R(n),I(m(t.length,a.show,a.infinite,n)),setTimeout((function(){if(a.infinite){var t=function(e,t,n){return n===c.Left?e.slice(0,-1*t):e.slice(t)}(e===c.Right?X.current:r,a.slide,e);g(t),X.current=t}E({transform:a.infinite?h(L,a.slide,c.Right):C.transform+h(L,a.slide,e),transition:0,isSliding:!1})}),1e3*a.transition),q.current=!1}};return n.createElement("div",r({},a.a11y,{"":"carousel",tabIndex:0},a.useArrowKeys?{onKeyDown:function(e){37===e.keyCode?B(c.Left):39===e.keyCode&&B(c.Right)}}:{},{className:s+" "+a.className}),T.left&&n.createElement(f,{direction:"left",onClick:function(){return B(c.Left)}}),n.createElement(y,r({},a,{transition:C.transition,items:X.current,transform:C.transform,slideCallback:function(e){B(e)},dragCallback:function(e){E({transform:e,transition:a.transition,isSliding:!1}),setTimeout((function(){return E(r(r({},C),{transition:0}))}),1e3*a.transition)},widthCallBack:function(e){b(e),E({transform:a.infinite?h(e,a.slide,c.Right):0,transition:0,isSliding:!1})}})),T.right&&n.createElement(f,{direction:"right",onClick:function(){return B(c.Right)}}))},exports.ScrollingCarousel=function(e){var r=e.children,i=e.className,s=e.leftIcon,o=e.rightIcon,a=t.useRef(null),l=t.useState(!1),u=l[0],f=l[1],d=t.useState({startX:0,scrollLeft:0}),h=d[0],m=d[1],v=function(){var e=a.current;return{left:!!e&&e.scrollLeft>0,right:!!e&&e.scrollWidth>e.scrollLeft+e.offsetWidth}},g=t.useState(v()),p=g[0],y=g[1],w=function(e){y(v())},k=t.useCallback((function(e){null!==e&&(Object.defineProperty(a,"current",{value:e}),y(v()),e.addEventListener("scroll",w))}),[a,r]),C=function(e){f(!1),y(v()),a.current.classList.remove(b)},E=function(e){var t=function(e){for(var t,n,r=a.current,i=e===c.Left?r.scrollLeft+r.offsetWidth:r.scrollLeft,s=0,o=0,l=Array.from(r.children);o<l.length;o++){var u=l[o],f=(t=u,n=void 0,n=getComputedStyle(t),t.offsetWidth+(parseInt(n.marginLeft,10)||0)+(parseInt(n.marginRight,10)||0));if((s+=f)>=i){var d=e===c.Left?s-i:f;return(r.offsetWidth-d)*e}}return r.offsetWidth}(e),n=a.current.scrollLeft;x(500,t,n)},x=function(e,t,n){for(var r=0,i=0;r<=e;i++)window.setTimeout(S,r,i*t/100+n),r+=e/100},S=function(e){a.current.scrollLeft=e},R=function(e,t,r){return n.createElement("div",{"data-arrow":t,onClick:function(){return E(e)}},null!=r?r:n.createElement("button",null))};return n.createElement("div",{className:_+" "+i,"":"carousel"},p.left&&R(c.Right,"left",s),p.right&&R(c.Left,"right",o),n.createElement("div",{ref:k,onMouseDown:function(e){f(!0),m({startX:e.pageX-a.current.offsetLeft,scrollLeft:a.current.scrollLeft})},onMouseLeave:C,onMouseUp:C,onMouseMove:function(e){if(u){e.preventDefault(),a.current.classList.add(b);var t=e.pageX-a.current.offsetLeft-h.startX;a.current.scrollLeft=h.scrollLeft-t}},className:L},r))};
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react");function t(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var n=t(e),r=function(){return(r=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)};
/*! *****************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */function i(e,t){void 0===t&&(t={});var n=t.insertAt;if(e&&"undefined"!=typeof document){var r=document.head||document.getElementsByTagName("head")[0],i=document.createElement("style");i.type="text/css","top"===n&&r.firstChild?r.insertBefore(i,r.firstChild):r.appendChild(i),i.styleSheet?i.styleSheet.cssText=e:i.appendChild(document.createTextNode(e))}}var o="styles-module_carousel-base__3keqD",s="styles-module_item-provider__YgMwz",a="styles-module_item-container__a8zaY",l="styles-module_item-tracker__3bypy",u="styles-module_carousel-arrow__26sRw";i(".styles-module_carousel-base__3keqD {\n\twidth: 100%;\n\tbox-sizing: border-box;\n\tdisplay: flex;\n\toutline: none;\n}\n\n.styles-module_item-provider__YgMwz {\n\toverflow: hidden;\n\twidth: 100%;\n\tcursor: pointer;\n}\n\n.styles-module_item-container__a8zaY img {\n\t-webkit-user-select: none;\n\t user-select: none;\n\t-webkit-user-drag: none;\n}\n\n.styles-module_item-tracker__3bypy {\n\theight: 100%;\n\tdisplay: flex;\n}\n\n.styles-module_carousel-arrow__26sRw {\n\tz-index: 1;\n}\n");var c,f=function(e){return n.default.createElement("button",{className:u,onClick:e.onClick,"data-direction":e.direction})};!function(e){e[e.Right=-1]="Right",e[e.Left=1]="Left"}(c||(c={}));var d=function(){function e(e,t){this.arr=e,this.currentIndex=t}return e.prototype.next=function(){var e=this.currentIndex,t=this.arr;return this.currentIndex=e<t.length-1?e+1:0,this.current()},e.prototype.prev=function(){var e=this.currentIndex,t=this.arr;return this.currentIndex=e>0&&e<t.length?e-1:t.length-1,this.current()},e.prototype.current=function(){return this.arr[this.currentIndex]},e}(),h=function(e,t,n){return n*e*t},m=function(e,t,n,r){var i=e>t;return n?{left:i,right:i}:{left:i&&0!==r,right:i&&r+t<e}},v=function(e,t,n){if(!n)return e;for(var r=Array.from(e),i=new d(e,0),o=0;o<t;o++)r.unshift(i.prev());return r};function g(e){return e.nativeEvent instanceof MouseEvent?e.nativeEvent.pageX:e.nativeEvent instanceof TouchEvent?e.nativeEvent.changedTouches[0].pageX:0}function p(e,t,n,r,i){if(n&&n.length<t.length)return v(t,r,i);var o=e.map((function(e){return t.find((function(t){return e.key===t.key}))}));return o.some((function(e){return void 0===e}))?v(t,r,i):o}var w=function(t){var i=e.useState(200),o=i[0],u=i[1],f=e.useCallback((function(e){if(null!==e){var n=e.getBoundingClientRect().width/t.show;u(n),t.widthCallBack(n)}}),[o]);t.responsive&&function(t){var n=e.useState(window.innerWidth),r=n[0],i=n[1];e.useLayoutEffect((function(){var e=function(){var e=r-window.innerWidth;i(window.innerWidth),t(e)};return window.addEventListener("resize",e),function(){return window.removeEventListener("resize",e)}}),[])}((function(e){u(o-e)}));var d=e.useState({initial:t.transform,start:0,isDown:!1,drag:0,finished:!0,pointers:!0}),h=d[0],m=d[1],v=function(e){e.persist(),m(r(r({},h),{isDown:!0,start:g(e),initial:t.transform,finished:!1}))},p=function(e){if(e.persist(),!h.finished){if(Math.abs(h.drag)<o*t.swipeOn)return t.dragCallback(t.transform),m({initial:t.transform,start:0,isDown:!1,drag:0,finished:!0,pointers:!0});t.slideCallback(h.drag>0?c.Right:c.Left),m(r(r({},h),{drag:0,isDown:!1,finished:!0,pointers:!0}))}},w=function(e){if(e.persist(),h.isDown){var t=g(e);m(r(r({},h),{drag:h.start-t,pointers:!1}))}},y=t.swiping?{onTouchCancel:p,onTouchEnd:p,onTouchMove:w,onTouchStart:v,onMouseDown:v,onMouseLeave:p,onMouseUp:p,onMouseMove:w}:{};return n.default.createElement("div",{ref:f,className:s},n.default.createElement("div",r({"":"trackList"},y,{className:l,style:{transform:"translateX("+(t.transform-h.drag)+"px)",transition:"transform "+t.transition+"s ease 0s",width:o*t.items.length}}),t.items.map((function(e,t){return n.default.createElement("div",{key:t,style:{width:o,pointerEvents:h.pointers?"all":"none"},className:a},e)}))))},y={children:[],show:1,slide:1,transition:.5,swiping:!1,swipeOn:1,responsive:!1,infinite:!0,className:"",useArrowKeys:!1,a11y:{},dynamic:!1,paginationCallback:null,pageCount:0,rightArrow:null,leftArrow:null},_="styles-module_sliderBase__swkx1",L="styles-module_slider__o0fqa",b="styles-module_sliding__3T6T6";i(".styles-module_sliderBase__swkx1 {\n\twidth: 100%;\n\tposition: relative;\n}\n\n.styles-module_slider__o0fqa {\n\tdisplay: flex;\n\toverflow-x: auto;\n\tscrollbar-width: none; /* Firefox 64 */\n\t-ms-overflow-style: none; /* Internet Explorer 11 */\n}\n\n.styles-module_slider__o0fqa::-webkit-scrollbar {\n\t/** WebKit */\n\tdisplay: none;\n}\n\n.styles-module_slider__o0fqa > * {\n\tflex: 0 0 auto;\n}\n\n.styles-module_sliding__3T6T6 > * {\n\tpointer-events: none;\n}\n");exports.Carousel=function(t){var i,s,a,l,u=r(r({},y),t),g=e.useState(v(u.children,u.slide,u.infinite)),_=g[0],L=g[1],b=e.useState(0),k=b[0],E=b[1],C=e.useState({transform:0,transition:0,isSliding:!1}),x=C[0],S=C[1],R=e.useState(0),M=R[0],T=R[1],I=e.useState(m(u.children.length,u.show,u.infinite,M)),N=I[0],D=I[1],A=(a=t.children,l=e.useRef(),e.useEffect((function(){l.current=a})),l.current),W=e.useState(0),z=W[0],X=W[1],q=e.useRef(v(u.children,u.slide,u.infinite)),B=e.useRef(!1);u.dynamic&&e.useEffect((function(){var e=p(q.current,u.children,A,u.slide,u.infinite);L(e),q.current=e,z<u.pageCount&&A&&(null==A?void 0:A.length)<u.children.length&&(O(c.Right),X(z+1))}),[u.children]);var O=function(e){if(!(x.isSliding||e===c.Right&&!N.right||e===c.Left&&!N.left)){if(u.paginationCallback&&e===c.Right&&z<u.pageCount-1&&!B.current)return B.current=!0,void u.paginationCallback(e);var t=u.children,n=function(e,t,n,r){var i=e-r*t;return i<0?n+i:n<=i?i-n:i}(M,u.slide,t.length,e),r=u.infinite?function(e,t,n,r,i,o){var s=new d(e,n),a=Array.from(t);switch(+o){case c.Left:for(var l=i;l>=0;l--)(i-l<0||!a[l-i])&&a.unshift(s.current()),s.prev();break;case c.Right:for(l=0;l<r+i;l++)a[2*i+l]||a.push(s.current()),s.next()}return a}(t,_,n,u.show,u.slide,e):_;u.infinite&&e===c.Right&&(L(r),q.current=r),S({transform:x.transform+h(k,u.slide,e),transition:u.transition,isSliding:!0}),T(n),D(m(t.length,u.show,u.infinite,n)),setTimeout((function(){if(u.infinite){var t=function(e,t,n){return n===c.Left?e.slice(0,-1*t):e.slice(t)}(e===c.Right?q.current:r,u.slide,e);L(t),q.current=t}S({transform:u.infinite?h(k,u.slide,c.Right):x.transform+h(k,u.slide,e),transition:0,isSliding:!1})}),1e3*u.transition),B.current=!1}};return n.default.createElement("div",r({},u.a11y,{"":"carousel",tabIndex:0},u.useArrowKeys?{onKeyDown:function(e){37===e.keyCode?O(c.Left):39===e.keyCode&&O(c.Right)}}:{},{className:o+" "+u.className}),N.left&&n.default.createElement("div",{onClick:function(){return O(c.Left)}},null!==(i=u.leftArrow)&&void 0!==i?i:n.default.createElement(f,{direction:"left"})),n.default.createElement(w,r({},u,{transition:x.transition,items:q.current,transform:x.transform,slideCallback:function(e){O(e)},dragCallback:function(e){S({transform:e,transition:u.transition,isSliding:!1}),setTimeout((function(){return S(r(r({},x),{transition:0}))}),1e3*u.transition)},widthCallBack:function(e){E(e),S({transform:u.infinite?h(e,u.slide,c.Right):0,transition:0,isSliding:!1})}})),N.right&&n.default.createElement("div",{onClick:function(){return O(c.Right)}},null!==(s=u.rightArrow)&&void 0!==s?s:n.default.createElement(f,{direction:"right"})))},exports.ScrollingCarousel=function(t){var r=t.children,i=t.className,o=t.leftIcon,s=t.rightIcon,a=e.useRef(null),l=e.useState(!1),u=l[0],f=l[1],d=e.useState({startX:0,scrollLeft:0}),h=d[0],m=d[1],v=function(){var e=a.current;return{left:!!e&&e.scrollLeft>0,right:!!e&&e.scrollWidth>e.scrollLeft+e.offsetWidth}},g=e.useState(v()),p=g[0],w=g[1],y=function(e){w(v())},k=e.useCallback((function(e){null!==e&&(Object.defineProperty(a,"current",{value:e}),w(v()),e.addEventListener("scroll",y))}),[a,r]),E=function(e){f(!1),w(v()),a.current.classList.remove(b)},C=function(e){var t=function(e){for(var t,n,r=a.current,i=e===c.Left?r.scrollLeft+r.offsetWidth:r.scrollLeft,o=0,s=0,l=Array.from(r.children);s<l.length;s++){var u=l[s],f=(t=u,n=void 0,n=getComputedStyle(t),t.offsetWidth+(parseInt(n.marginLeft,10)||0)+(parseInt(n.marginRight,10)||0));if((o+=f)>=i){var d=e===c.Left?o-i:f;return(r.offsetWidth-d)*e}}return r.offsetWidth}(e),n=a.current.scrollLeft;x(500,t,n)},x=function(e,t,n){for(var r=0,i=0;r<=e;i++)window.setTimeout(S,r,i*t/100+n),r+=e/100},S=function(e){a.current.scrollLeft=e},R=function(e,t,r){return n.default.createElement("div",{"data-arrow":t,onClick:function(){return C(e)}},null!=r?r:n.default.createElement("button",null))};return n.default.createElement("div",{className:_+" "+i,"":"carousel"},p.left&&R(c.Right,"left",o),p.right&&R(c.Left,"right",s),n.default.createElement("div",{ref:k,onMouseDown:function(e){f(!0),m({startX:e.pageX-a.current.offsetLeft,scrollLeft:a.current.scrollLeft})},onMouseLeave:E,onMouseUp:E,onMouseMove:function(e){if(u){e.preventDefault(),a.current.classList.add(b);var t=e.pageX-a.current.offsetLeft-h.startX;a.current.scrollLeft=h.scrollLeft-t}},className:L},r))};

24

dist/es/index.js

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

import n,{useRef as t,useEffect as e,useState as r,useLayoutEffect as i,useCallback as o}from"react";
import t,{useRef as n,useEffect as e,useState as r,useLayoutEffect as i,useCallback as o}from"react";
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
Copyright (c) Microsoft Corporation.
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */var s=function(){return(s=Object.assign||function(n){for(var t,e=1,r=arguments.length;e<r;e++)for(var i in t=arguments[e])Object.prototype.hasOwnProperty.call(t,i)&&(n[i]=t[i]);return n}).apply(this,arguments)};function a(n,t){void 0===t&&(t={});var e=t.insertAt;if(n&&"undefined"!=typeof document){var r=document.head||document.getElementsByTagName("head")[0],i=document.createElement("style");i.type="text/css","top"===e&&r.firstChild?r.insertBefore(i,r.firstChild):r.appendChild(i),i.styleSheet?i.styleSheet.cssText=n:i.appendChild(document.createTextNode(n))}}var l="styles-module_carousel-base__3keqD",c="styles-module_item-provider__YgMwz",u="styles-module_item-container__a8zaY",f="styles-module_item-tracker__3bypy",d="styles-module_carousel-arrow__26sRw";a(".styles-module_carousel-base__3keqD {\n\twidth: 100%;\n\tbox-sizing: border-box;\n\tdisplay: flex;\n\toutline: none;\n}\n\n.styles-module_item-provider__YgMwz {\n\toverflow: hidden;\n\twidth: 100%;\n\tcursor: pointer;\n}\n\n.styles-module_item-container__a8zaY img {\n\t-webkit-user-select: none;\n\t user-select: none;\n\t-webkit-user-drag: none;\n}\n\n.styles-module_item-tracker__3bypy {\n\theight: 100%;\n\tdisplay: flex;\n}\n\n.styles-module_carousel-arrow__26sRw {\n\tz-index: 1;\n}\n");var h,m=function(t){return n.createElement("button",{className:d,onClick:t.onClick,"data-direction":t.direction})};!function(n){n[n.Right=-1]="Right",n[n.Left=1]="Left"}(h||(h={}));var v=function(){function n(n,t){this.arr=n,this.currentIndex=t}return n.prototype.next=function(){var n=this.currentIndex,t=this.arr;return this.currentIndex=n<t.length-1?n+1:0,this.current()},n.prototype.prev=function(){var n=this.currentIndex,t=this.arr;return this.currentIndex=n>0&&n<t.length?n-1:t.length-1,this.current()},n.prototype.current=function(){return this.arr[this.currentIndex]},n}(),g=function(n,t,e){return e*n*t},p=function(n,t,e,r){var i=n>t;return e?{left:i,right:i}:{left:i&&0!==r,right:i&&r+t<n}},w=function(n,t,e){if(!e)return n;for(var r=Array.from(n),i=new v(n,0),o=0;o<t;o++)r.unshift(i.prev());return r};function y(n){return n.nativeEvent instanceof MouseEvent?n.nativeEvent.pageX:n.nativeEvent instanceof TouchEvent?n.nativeEvent.changedTouches[0].pageX:0}function _(n,t,e,r,i){if(e&&e.length<t.length)return w(t,r,i);var o=n.map((function(n){return t.find((function(t){return n.key===t.key}))}));return o.some((function(n){return void 0===n}))?w(t,r,i):o}var L=function(t){var e=r(200),a=e[0],l=e[1],d=o((function(n){if(null!==n){var e=n.getBoundingClientRect().width/t.show;l(e),t.widthCallBack(e)}}),[a]);t.responsive&&function(n){var t=r(window.innerWidth),e=t[0],o=t[1];i((function(){var t=function(){var t=e-window.innerWidth;o(window.innerWidth),n(t)};return window.addEventListener("resize",t),function(){return window.removeEventListener("resize",t)}}),[])}((function(n){l(a-n)}));var m=r({initial:t.transform,start:0,isDown:!1,drag:0,finished:!0,pointers:!0}),v=m[0],g=m[1],p=function(n){n.persist(),g(s(s({},v),{isDown:!0,start:y(n),initial:t.transform,finished:!1}))},w=function(n){if(n.persist(),!v.finished){if(Math.abs(v.drag)<a*t.swipeOn)return t.dragCallback(t.transform),g({initial:t.transform,start:0,isDown:!1,drag:0,finished:!0,pointers:!0});t.slideCallback(v.drag>0?h.Right:h.Left),g(s(s({},v),{drag:0,isDown:!1,finished:!0,pointers:!0}))}},_=function(n){if(n.persist(),v.isDown){var t=y(n);g(s(s({},v),{drag:v.start-t,pointers:!1}))}},L=t.swiping?{onTouchCancel:w,onTouchEnd:w,onTouchMove:_,onTouchStart:p,onMouseDown:p,onMouseLeave:w,onMouseUp:w,onMouseMove:_}:{};return n.createElement("div",{ref:d,className:c},n.createElement("div",s({"":"trackList"},L,{className:f,style:{transform:"translateX("+(t.transform-v.drag)+"px)",transition:"transform "+t.transition+"s ease 0s",width:a*t.items.length}}),t.items.map((function(t,e){return n.createElement("div",{key:e,style:{width:a,pointerEvents:v.pointers?"all":"none"},className:u},t)}))))},k={children:[],show:1,slide:1,transition:.5,swiping:!1,swipeOn:1,responsive:!1,infinite:!0,className:"",useArrowKeys:!1,a11y:{},dynamic:!1,paginationCallback:null,pageCount:0},b=function(i){var o,a,c=s(s({},k),i),u=r(w(c.children,c.slide,c.infinite)),f=u[0],d=u[1],y=r(0),b=y[0],x=y[1],C=r({transform:0,transition:0,isSliding:!1}),E=C[0],R=C[1],T=r(0),M=T[0],I=T[1],N=r(p(c.children.length,c.show,c.infinite,M)),D=N[0],S=N[1],W=(o=i.children,a=t(),e((function(){a.current=o})),a.current),z=r(0),X=z[0],B=z[1],q=t(w(c.children,c.slide,c.infinite)),A=t(!1);c.dynamic&&e((function(){var n=_(q.current,c.children,W,c.slide,c.infinite);d(n),q.current=n,X<c.pageCount&&W&&(null==W?void 0:W.length)<c.children.length&&(O(h.Right),B(X+1))}),[c.children]);var O=function(n){if(!(E.isSliding||n===h.Right&&!D.right||n===h.Left&&!D.left)){if(c.paginationCallback&&n===h.Right&&X<c.pageCount-1&&!A.current)return A.current=!0,void c.paginationCallback(n);var t=c.children,e=function(n,t,e,r){var i=n-r*t;return i<0?e+i:e<=i?i-e:i}(M,c.slide,t.length,n),r=c.infinite?function(n,t,e,r,i,o){var s=new v(n,e),a=Array.from(t);switch(+o){case h.Left:for(var l=i;l>=0;l--)(i-l<0||!a[l-i])&&a.unshift(s.current()),s.prev();break;case h.Right:for(l=0;l<r+i;l++)a[2*i+l]||a.push(s.current()),s.next()}return a}(t,f,e,c.show,c.slide,n):f;c.infinite&&n===h.Right&&(d(r),q.current=r),R({transform:E.transform+g(b,c.slide,n),transition:c.transition,isSliding:!0}),I(e),S(p(t.length,c.show,c.infinite,e)),setTimeout((function(){if(c.infinite){var t=function(n,t,e){return e===h.Left?n.slice(0,-1*t):n.slice(t)}(n===h.Right?q.current:r,c.slide,n);d(t),q.current=t}R({transform:c.infinite?g(b,c.slide,h.Right):E.transform+g(b,c.slide,n),transition:0,isSliding:!1})}),1e3*c.transition),A.current=!1}};return n.createElement("div",s({},c.a11y,{"":"carousel",tabIndex:0},c.useArrowKeys?{onKeyDown:function(n){37===n.keyCode?O(h.Left):39===n.keyCode&&O(h.Right)}}:{},{className:l+" "+c.className}),D.left&&n.createElement(m,{direction:"left",onClick:function(){return O(h.Left)}}),n.createElement(L,s({},c,{transition:E.transition,items:q.current,transform:E.transform,slideCallback:function(n){O(n)},dragCallback:function(n){R({transform:n,transition:c.transition,isSliding:!1}),setTimeout((function(){return R(s(s({},E),{transition:0}))}),1e3*c.transition)},widthCallBack:function(n){x(n),R({transform:c.infinite?g(n,c.slide,h.Right):0,transition:0,isSliding:!1})}})),D.right&&n.createElement(m,{direction:"right",onClick:function(){return O(h.Right)}}))},x="styles-module_sliderBase__swkx1",C="styles-module_slider__o0fqa",E="styles-module_sliding__3T6T6";a(".styles-module_sliderBase__swkx1 {\n\twidth: 100%;\n\tposition: relative;\n}\n\n.styles-module_slider__o0fqa {\n\tdisplay: flex;\n\toverflow-x: auto;\n\tscrollbar-width: none; /* Firefox 64 */\n\t-ms-overflow-style: none; /* Internet Explorer 11 */\n}\n\n.styles-module_slider__o0fqa::-webkit-scrollbar {\n\t/** WebKit */\n\tdisplay: none;\n}\n\n.styles-module_slider__o0fqa > * {\n\tflex: 0 0 auto;\n}\n\n.styles-module_sliding__3T6T6 > * {\n\tpointer-events: none;\n}\n");var R=function(e){var i=e.children,s=e.className,a=e.leftIcon,l=e.rightIcon,c=t(null),u=r(!1),f=u[0],d=u[1],m=r({startX:0,scrollLeft:0}),v=m[0],g=m[1],p=function(){var n=c.current;return{left:!!n&&n.scrollLeft>0,right:!!n&&n.scrollWidth>n.scrollLeft+n.offsetWidth}},w=r(p()),y=w[0],_=w[1],L=function(n){_(p())},k=o((function(n){null!==n&&(Object.defineProperty(c,"current",{value:n}),_(p()),n.addEventListener("scroll",L))}),[c,i]),b=function(n){d(!1),_(p()),c.current.classList.remove(E)},R=function(n){var t=function(n){for(var t,e,r=c.current,i=n===h.Left?r.scrollLeft+r.offsetWidth:r.scrollLeft,o=0,s=0,a=Array.from(r.children);s<a.length;s++){var l=a[s],u=(t=l,e=void 0,e=getComputedStyle(t),t.offsetWidth+(parseInt(e.marginLeft,10)||0)+(parseInt(e.marginRight,10)||0));if((o+=u)>=i){var f=n===h.Left?o-i:u;return(r.offsetWidth-f)*n}}return r.offsetWidth}(n),e=c.current.scrollLeft;T(500,t,e)},T=function(n,t,e){for(var r=0,i=0;r<=n;i++)window.setTimeout(M,r,i*t/100+e),r+=n/100},M=function(n){c.current.scrollLeft=n},I=function(t,e,r){return n.createElement("div",{"data-arrow":e,onClick:function(){return R(t)}},null!=r?r:n.createElement("button",null))};return n.createElement("div",{className:x+" "+s,"":"carousel"},y.left&&I(h.Right,"left",a),y.right&&I(h.Left,"right",l),n.createElement("div",{ref:k,onMouseDown:function(n){d(!0),g({startX:n.pageX-c.current.offsetLeft,scrollLeft:c.current.scrollLeft})},onMouseLeave:b,onMouseUp:b,onMouseMove:function(n){if(f){n.preventDefault(),c.current.classList.add(E);var t=n.pageX-c.current.offsetLeft-v.startX;c.current.scrollLeft=v.scrollLeft-t}},className:C},i))};export{b as Carousel,R as ScrollingCarousel};
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */var s=function(){return(s=Object.assign||function(t){for(var n,e=1,r=arguments.length;e<r;e++)for(var i in n=arguments[e])Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i]);return t}).apply(this,arguments)};function a(t,n){void 0===n&&(n={});var e=n.insertAt;if(t&&"undefined"!=typeof document){var r=document.head||document.getElementsByTagName("head")[0],i=document.createElement("style");i.type="text/css","top"===e&&r.firstChild?r.insertBefore(i,r.firstChild):r.appendChild(i),i.styleSheet?i.styleSheet.cssText=t:i.appendChild(document.createTextNode(t))}}var l="styles-module_carousel-base__3keqD",c="styles-module_item-provider__YgMwz",u="styles-module_item-container__a8zaY",f="styles-module_item-tracker__3bypy",d="styles-module_carousel-arrow__26sRw";a(".styles-module_carousel-base__3keqD {\n\twidth: 100%;\n\tbox-sizing: border-box;\n\tdisplay: flex;\n\toutline: none;\n}\n\n.styles-module_item-provider__YgMwz {\n\toverflow: hidden;\n\twidth: 100%;\n\tcursor: pointer;\n}\n\n.styles-module_item-container__a8zaY img {\n\t-webkit-user-select: none;\n\t user-select: none;\n\t-webkit-user-drag: none;\n}\n\n.styles-module_item-tracker__3bypy {\n\theight: 100%;\n\tdisplay: flex;\n}\n\n.styles-module_carousel-arrow__26sRw {\n\tz-index: 1;\n}\n");var h,m=function(n){return t.createElement("button",{className:d,onClick:n.onClick,"data-direction":n.direction})};!function(t){t[t.Right=-1]="Right",t[t.Left=1]="Left"}(h||(h={}));var v=function(){function t(t,n){this.arr=t,this.currentIndex=n}return t.prototype.next=function(){var t=this.currentIndex,n=this.arr;return this.currentIndex=t<n.length-1?t+1:0,this.current()},t.prototype.prev=function(){var t=this.currentIndex,n=this.arr;return this.currentIndex=t>0&&t<n.length?t-1:n.length-1,this.current()},t.prototype.current=function(){return this.arr[this.currentIndex]},t}(),g=function(t,n,e){return e*t*n},p=function(t,n,e,r){var i=t>n;return e?{left:i,right:i}:{left:i&&0!==r,right:i&&r+n<t}},w=function(t,n,e){if(!e)return t;for(var r=Array.from(t),i=new v(t,0),o=0;o<n;o++)r.unshift(i.prev());return r};function y(t){return t.nativeEvent instanceof MouseEvent?t.nativeEvent.pageX:t.nativeEvent instanceof TouchEvent?t.nativeEvent.changedTouches[0].pageX:0}function _(t,n,e,r,i){if(e&&e.length<n.length)return w(n,r,i);var o=t.map((function(t){return n.find((function(n){return t.key===n.key}))}));return o.some((function(t){return void 0===t}))?w(n,r,i):o}var L=function(n){var e=r(200),a=e[0],l=e[1],d=o((function(t){if(null!==t){var e=t.getBoundingClientRect().width/n.show;l(e),n.widthCallBack(e)}}),[a]);n.responsive&&function(t){var n=r(window.innerWidth),e=n[0],o=n[1];i((function(){var n=function(){var n=e-window.innerWidth;o(window.innerWidth),t(n)};return window.addEventListener("resize",n),function(){return window.removeEventListener("resize",n)}}),[])}((function(t){l(a-t)}));var m=r({initial:n.transform,start:0,isDown:!1,drag:0,finished:!0,pointers:!0}),v=m[0],g=m[1],p=function(t){t.persist(),g(s(s({},v),{isDown:!0,start:y(t),initial:n.transform,finished:!1}))},w=function(t){if(t.persist(),!v.finished){if(Math.abs(v.drag)<a*n.swipeOn)return n.dragCallback(n.transform),g({initial:n.transform,start:0,isDown:!1,drag:0,finished:!0,pointers:!0});n.slideCallback(v.drag>0?h.Right:h.Left),g(s(s({},v),{drag:0,isDown:!1,finished:!0,pointers:!0}))}},_=function(t){if(t.persist(),v.isDown){var n=y(t);g(s(s({},v),{drag:v.start-n,pointers:!1}))}},L=n.swiping?{onTouchCancel:w,onTouchEnd:w,onTouchMove:_,onTouchStart:p,onMouseDown:p,onMouseLeave:w,onMouseUp:w,onMouseMove:_}:{};return t.createElement("div",{ref:d,className:c},t.createElement("div",s({"":"trackList"},L,{className:f,style:{transform:"translateX("+(n.transform-v.drag)+"px)",transition:"transform "+n.transition+"s ease 0s",width:a*n.items.length}}),n.items.map((function(n,e){return t.createElement("div",{key:e,style:{width:a,pointerEvents:v.pointers?"all":"none"},className:u},n)}))))},k={children:[],show:1,slide:1,transition:.5,swiping:!1,swipeOn:1,responsive:!1,infinite:!0,className:"",useArrowKeys:!1,a11y:{},dynamic:!1,paginationCallback:null,pageCount:0,rightArrow:null,leftArrow:null},b=function(i){var o,a,c,u,f=s(s({},k),i),d=r(w(f.children,f.slide,f.infinite)),y=d[0],b=d[1],E=r(0),x=E[0],C=E[1],R=r({transform:0,transition:0,isSliding:!1}),T=R[0],M=R[1],I=r(0),N=I[0],D=I[1],A=r(p(f.children.length,f.show,f.infinite,N)),S=A[0],W=A[1],z=(c=i.children,u=n(),e((function(){u.current=c})),u.current),X=r(0),B=X[0],q=X[1],O=n(w(f.children,f.slide,f.infinite)),K=n(!1);f.dynamic&&e((function(){var t=_(O.current,f.children,z,f.slide,f.infinite);b(t),O.current=t,B<f.pageCount&&z&&(null==z?void 0:z.length)<f.children.length&&(Y(h.Right),q(B+1))}),[f.children]);var Y=function(t){if(!(T.isSliding||t===h.Right&&!S.right||t===h.Left&&!S.left)){if(f.paginationCallback&&t===h.Right&&B<f.pageCount-1&&!K.current)return K.current=!0,void f.paginationCallback(t);var n=f.children,e=function(t,n,e,r){var i=t-r*n;return i<0?e+i:e<=i?i-e:i}(N,f.slide,n.length,t),r=f.infinite?function(t,n,e,r,i,o){var s=new v(t,e),a=Array.from(n);switch(+o){case h.Left:for(var l=i;l>=0;l--)(i-l<0||!a[l-i])&&a.unshift(s.current()),s.prev();break;case h.Right:for(l=0;l<r+i;l++)a[2*i+l]||a.push(s.current()),s.next()}return a}(n,y,e,f.show,f.slide,t):y;f.infinite&&t===h.Right&&(b(r),O.current=r),M({transform:T.transform+g(x,f.slide,t),transition:f.transition,isSliding:!0}),D(e),W(p(n.length,f.show,f.infinite,e)),setTimeout((function(){if(f.infinite){var n=function(t,n,e){return e===h.Left?t.slice(0,-1*n):t.slice(n)}(t===h.Right?O.current:r,f.slide,t);b(n),O.current=n}M({transform:f.infinite?g(x,f.slide,h.Right):T.transform+g(x,f.slide,t),transition:0,isSliding:!1})}),1e3*f.transition),K.current=!1}};return t.createElement("div",s({},f.a11y,{"":"carousel",tabIndex:0},f.useArrowKeys?{onKeyDown:function(t){37===t.keyCode?Y(h.Left):39===t.keyCode&&Y(h.Right)}}:{},{className:l+" "+f.className}),S.left&&t.createElement("div",{onClick:function(){return Y(h.Left)}},null!==(o=f.leftArrow)&&void 0!==o?o:t.createElement(m,{direction:"left"})),t.createElement(L,s({},f,{transition:T.transition,items:O.current,transform:T.transform,slideCallback:function(t){Y(t)},dragCallback:function(t){M({transform:t,transition:f.transition,isSliding:!1}),setTimeout((function(){return M(s(s({},T),{transition:0}))}),1e3*f.transition)},widthCallBack:function(t){C(t),M({transform:f.infinite?g(t,f.slide,h.Right):0,transition:0,isSliding:!1})}})),S.right&&t.createElement("div",{onClick:function(){return Y(h.Right)}},null!==(a=f.rightArrow)&&void 0!==a?a:t.createElement(m,{direction:"right"})))},E="styles-module_sliderBase__swkx1",x="styles-module_slider__o0fqa",C="styles-module_sliding__3T6T6";a(".styles-module_sliderBase__swkx1 {\n\twidth: 100%;\n\tposition: relative;\n}\n\n.styles-module_slider__o0fqa {\n\tdisplay: flex;\n\toverflow-x: auto;\n\tscrollbar-width: none; /* Firefox 64 */\n\t-ms-overflow-style: none; /* Internet Explorer 11 */\n}\n\n.styles-module_slider__o0fqa::-webkit-scrollbar {\n\t/** WebKit */\n\tdisplay: none;\n}\n\n.styles-module_slider__o0fqa > * {\n\tflex: 0 0 auto;\n}\n\n.styles-module_sliding__3T6T6 > * {\n\tpointer-events: none;\n}\n");var R=function(e){var i=e.children,s=e.className,a=e.leftIcon,l=e.rightIcon,c=n(null),u=r(!1),f=u[0],d=u[1],m=r({startX:0,scrollLeft:0}),v=m[0],g=m[1],p=function(){var t=c.current;return{left:!!t&&t.scrollLeft>0,right:!!t&&t.scrollWidth>t.scrollLeft+t.offsetWidth}},w=r(p()),y=w[0],_=w[1],L=function(t){_(p())},k=o((function(t){null!==t&&(Object.defineProperty(c,"current",{value:t}),_(p()),t.addEventListener("scroll",L))}),[c,i]),b=function(t){d(!1),_(p()),c.current.classList.remove(C)},R=function(t){var n=function(t){for(var n,e,r=c.current,i=t===h.Left?r.scrollLeft+r.offsetWidth:r.scrollLeft,o=0,s=0,a=Array.from(r.children);s<a.length;s++){var l=a[s],u=(n=l,e=void 0,e=getComputedStyle(n),n.offsetWidth+(parseInt(e.marginLeft,10)||0)+(parseInt(e.marginRight,10)||0));if((o+=u)>=i){var f=t===h.Left?o-i:u;return(r.offsetWidth-f)*t}}return r.offsetWidth}(t),e=c.current.scrollLeft;T(500,n,e)},T=function(t,n,e){for(var r=0,i=0;r<=t;i++)window.setTimeout(M,r,i*n/100+e),r+=t/100},M=function(t){c.current.scrollLeft=t},I=function(n,e,r){return t.createElement("div",{"data-arrow":e,onClick:function(){return R(n)}},null!=r?r:t.createElement("button",null))};return t.createElement("div",{className:E+" "+s,"":"carousel"},y.left&&I(h.Right,"left",a),y.right&&I(h.Left,"right",l),t.createElement("div",{ref:k,onMouseDown:function(t){d(!0),g({startX:t.pageX-c.current.offsetLeft,scrollLeft:c.current.scrollLeft})},onMouseLeave:b,onMouseUp:b,onMouseMove:function(t){if(f){t.preventDefault(),c.current.classList.add(C);var n=t.pageX-c.current.offsetLeft-v.startX;c.current.scrollLeft=v.scrollLeft-n}},className:x},i))};export{b as Carousel,R as ScrollingCarousel};
import { FunctionComponent } from 'react';
export declare const Arrow: FunctionComponent<ArrowProps>;
export interface ArrowProps {
onClick: (...args: any) => any;
onClick?: (...args: any) => any;
direction: string;
}

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

import { FunctionComponent } from 'react';
import { FunctionComponent, ReactElement } from 'react';
import { SlideDirection, Item } from '../../types/carousel';

@@ -21,2 +21,4 @@ export declare const Carousel: FunctionComponent<CarouselProps>;

pageCount?: number;
leftArrow?: ReactElement | null;
rightArrow?: ReactElement | null;
}

@@ -23,0 +25,0 @@ export interface CarouselState {

{
"name": "@trendyol-js/react-carousel",
"version": "1.2.0-beta.1",
"version": "1.2.0-beta.2",
"description": "Lightweight carousel component for react",

@@ -5,0 +5,0 @@ "main": "dist/cjs/index.js",