najwer23morsels 0.9.1 → 0.9.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1 @@
1
+ import{jsxs as e,jsx as r,Fragment as n}from"react/jsx-runtime";import t,{useState as l,useRef as i,useEffect as o,useCallback as d,useLayoutEffect as s}from"react";import{s as a}from"./style-inject.es-BnTDb6vU.js";import{T as m}from"./TextBox-B47QWA9m.js";import{L as c}from"./Loader-CL-mm0LT.js";import{a as u,I as h}from"./IconArrowRight-Bs6HQ5lc.js";import{B as S}from"./Button-DP1hmI08.js";var p={n23mSliderContainerSlider:"Slider-module_n23mSliderContainerSlider__-1M4s",n23mSliderSlideWrapper:"Slider-module_n23mSliderSlideWrapper__hbDsw",n23mSliderSlide:"Slider-module_n23mSliderSlide__Hv6uj",n23mSliderControls:"Slider-module_n23mSliderControls__DLrdZ",n23mSliderControlsButtons:"Slider-module_n23mSliderControlsButtons__C1ypH",n23mSliderCounter:"Slider-module_n23mSliderCounter__UJLZw"};a("@layer n23mSlider{.Slider-module_n23mSliderContainer__Hx9qh{width:100%}.Slider-module_n23mSliderContainerSlider__-1M4s{display:flex;flex-direction:column;gap:10px;height:100%;position:relative;user-select:none;width:100%}.Slider-module_n23mSliderSlideWrapper__hbDsw{height:100%;overflow:hidden;position:relative;width:100%;will-change:transform}.Slider-module_n23mSliderSlide__Hv6uj{height:100%;overflow:hidden;position:absolute;top:0;will-change:transform;&>*{height:100%;width:100%}}.Slider-module_n23mSliderControls__DLrdZ{align-items:center;display:flex;justify-content:space-between;margin-left:20px;margin-right:20px}.Slider-module_n23mSliderControlsButtons__C1ypH{display:flex;gap:10px;margin-top:10px}.Slider-module_n23mSliderCounter__UJLZw{align-items:center;align-items:flex-start;display:flex;height:50px;justify-content:center}}");const g=(e,r,n=!1)=>(n?e.slice(0,r):e.slice(-r)).map((e,r)=>t.cloneElement(e,{key:`${n?"clone-first":"clone-last"}-${r}`,className:e.props.className})),f=({isCircular:a=!1,children:f,className:_,showControls:C=!0,loading:v=!1,loaderColor:w="black"})=>{const x=t.Children.toArray(f).filter(t.isValidElement),[y,b]=l(a&&x.length>=2?2:0),[E,j]=l(!1),[k,L]=l(0),[N,F]=l(0),T=i(null),B=i([]),$=i(null),[W,D]=l(null),[z,H]=l(0),M=a&&x.length>=2?[...g(x,2,!1),...x.map((e,r)=>t.cloneElement(e,{key:e.key??r,className:e.props.className})),...g(x,2,!0)]:x.map((e,r)=>t.cloneElement(e,{key:e.key??r,className:e.props.className}));B.current.length!==M.length&&(B.current=Array(M.length).fill(null)),o(()=>{b(a&&x.length>=2?2:0)},[a,x.length,v]);const Z=d(()=>{const e=T.current;if(!e)return;const r=B.current[0];if(!r)return;const n=window.getComputedStyle(r);L(r.offsetWidth+parseFloat(n.marginLeft)+parseFloat(n.marginRight)),F(e.offsetWidth)},[]);s(()=>{Z();const e=()=>{null!==$.current&&clearTimeout($.current),$.current=window.setTimeout(()=>{Z(),j(!0)},150)};return window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e),null!==$.current&&clearTimeout($.current)}},[Z,v]),o(()=>{const e=k+10;B.current.forEach((r,n)=>{if(!r)return;const t=(n-y)*e+(N-k)/2;r.style.transition=E?"transform 0.4s cubic-bezier(.4,0,.2,1)":"none",r.style.transform=`translateX(${t}px)`,r.style.left=""})},[y,k,N,E,M.length,a,v]),o(()=>{if(!E||!a)return;const e=B.current.length,r=B.current[e-1];if(!r)return;let n;const t=()=>{let l=y;1===y?l=e-3:y===e-2&&(l=2),l!==y&&b(l),j(!1),r.removeEventListener("transitionend",t),clearTimeout(n)};return r.addEventListener("transitionend",t),n=window.setTimeout(()=>{j(!1),r.removeEventListener("transitionend",t)},500),()=>{r.removeEventListener("transitionend",t),clearTimeout(n)}},[y,a,E,v]),o(()=>{if(!E)return;const e=B.current[0];if(!e)return;let r;const n=()=>{j(!1),e.removeEventListener("transitionend",n),clearTimeout(r)};return e.addEventListener("transitionend",n),r=window.setTimeout(()=>{j(!1),e.removeEventListener("transitionend",n)},500),()=>{e.removeEventListener("transitionend",n),clearTimeout(r)}},[E,v]);const A=()=>{E||(j(!0),b(a?e=>e+1:e=>Math.min(e+1,M.length-1)))},X=()=>{E||(j(!0),b(a?e=>e-1:e=>Math.max(e-1,0)))};return e("div",{className:[p.n23mSlider,"n23mSlider",_].filter(Boolean).join(" "),style:{height:v?"calc(100% - 2px)":C&&x.length>1?"calc(100% - 60px)":"100%"},onTouchStart:e=>{1===e.touches.length&&(D(e.touches[0].clientX),H(0))},onTouchMove:e=>{null!==W&&H(e.touches[0].clientX-W)},onTouchEnd:()=>{z>50?X():z<-50&&A(),D(null),H(0)},children:[v&&r(c,{loaderColor:w}),!v&&e(n,{children:[r("div",{className:[p.n23mSliderContainerSlider,"n23mSliderContainerSlider"].filter(Boolean).join(" "),children:r("div",{className:[p.n23mSliderSlideWrapper,"n23mSliderSlideWrapper"].join(" "),ref:T,children:M.map((e,n)=>r("div",{ref:e=>{B.current[n]=e},className:`${p.n23mSliderSlide}`,style:{width:x.length>1?"calc(100% - 40px)":"100%"},"aria-hidden":y!==n,children:e},e.key??n))})}),C&&x.length>1&&e("div",{className:[p.n23mSliderControls,"n23mSliderControls"].join(" "),children:[r("div",{className:[p.n23mSliderCounter,"n23mSliderCounter"].join(" "),children:r(m,{mobileSize:16,desktopSize:16,color:"black",children:a?`${(()=>{if(!a)return y;const e=x.length;return e<1?0:(y-2+e)%e})()+1} / ${x.length}`:`${y+1} / ${x.length}`})}),e("div",{className:[p.n23mSliderControlsButtons,"n23mSliderControlsButtons"].join(" "),children:[r(S,{height:"50px",width:"50px",backgroundColor:"#F2F0EF",padding:0,title:"Prev",onClick:X,borderColor:"black",backgroundColorDisabled:"#F2F0EF",disabled:E||!a&&0===y,children:r(u,{width:24,height:24})}),r(S,{height:"50px",width:"50px",backgroundColor:"#F2F0EF",padding:0,title:"Next",borderColor:"black",backgroundColorDisabled:"#F2F0EF",onClick:A,disabled:E||!a&&y==x.length-1,children:r(h,{width:24,height:24})})]})]})]})]})};f.displayName="Slider";export{f as S};
package/lib/Slider.js CHANGED
@@ -1 +1 @@
1
- import{jsxs as e,jsx as r,Fragment as n}from"react/jsx-runtime";import t,{useState as l,useRef as i,useEffect as o,useCallback as d,useLayoutEffect as s}from"react";import{s as a}from"./style-inject.es-BnTDb6vU.js";import{T as m}from"./TextBox-B47QWA9m.js";import{L as c}from"./Loader-CL-mm0LT.js";import{a as u,I as h}from"./IconArrowRight-Bs6HQ5lc.js";import{B as S}from"./Button-DP1hmI08.js";var p={n23mSliderContainerSlider:"Slider-module_n23mSliderContainerSlider__-1M4s",n23mSliderSlideWrapper:"Slider-module_n23mSliderSlideWrapper__hbDsw",n23mSliderSlide:"Slider-module_n23mSliderSlide__Hv6uj",n23mSliderControls:"Slider-module_n23mSliderControls__DLrdZ",n23mSliderControlsButtons:"Slider-module_n23mSliderControlsButtons__C1ypH",n23mSliderCounter:"Slider-module_n23mSliderCounter__UJLZw"};a("@layer n23mSlider{.Slider-module_n23mSliderContainer__Hx9qh{width:100%}.Slider-module_n23mSliderContainerSlider__-1M4s{display:flex;flex-direction:column;gap:10px;height:100%;position:relative;user-select:none;width:100%}.Slider-module_n23mSliderSlideWrapper__hbDsw{height:100%;overflow:hidden;position:relative;width:100%;will-change:transform}.Slider-module_n23mSliderSlide__Hv6uj{height:100%;overflow:hidden;position:absolute;top:0;will-change:transform;&>*{height:100%;width:100%}}.Slider-module_n23mSliderControls__DLrdZ{align-items:center;display:flex;justify-content:space-between;margin-left:20px;margin-right:20px}.Slider-module_n23mSliderControlsButtons__C1ypH{display:flex;gap:10px;margin-top:10px}.Slider-module_n23mSliderCounter__UJLZw{align-items:center;align-items:flex-start;display:flex;height:50px;justify-content:center}}");const g=(e,r,n=!1)=>(n?e.slice(0,r):e.slice(-r)).map((e,r)=>t.cloneElement(e,{key:`${n?"clone-first":"clone-last"}-${r}`,className:e.props.className})),f=({isCircular:a=!1,children:f,className:_,showControls:C=!0,loading:v=!1,loaderColor:w="black"})=>{const x=t.Children.toArray(f).filter(t.isValidElement),[y,b]=l(a&&x.length>=2?2:0),[E,j]=l(!1),[k,L]=l(0),[N,F]=l(0),T=i(null),B=i([]),$=i(null),[W,D]=l(null),[z,H]=l(0),M=a&&x.length>=2?[...g(x,2,!1),...x.map((e,r)=>t.cloneElement(e,{key:e.key??r,className:e.props.className})),...g(x,2,!0)]:x.map((e,r)=>t.cloneElement(e,{key:e.key??r,className:e.props.className}));B.current.length!==M.length&&(B.current=Array(M.length).fill(null)),o(()=>{b(a&&x.length>=2?2:0)},[a,x.length,v]);const Z=d(()=>{const e=T.current;if(!e)return;const r=B.current[0];if(!r)return;const n=window.getComputedStyle(r);L(r.offsetWidth+parseFloat(n.marginLeft)+parseFloat(n.marginRight)),F(e.offsetWidth)},[]);s(()=>{Z();const e=()=>{null!==$.current&&clearTimeout($.current),$.current=window.setTimeout(()=>{Z(),j(!0)},150)};return window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e),null!==$.current&&clearTimeout($.current)}},[Z,v]),o(()=>{const e=k+10;B.current.forEach((r,n)=>{if(!r)return;const t=(n-y)*e+(N-k)/2;r.style.transition=E?"transform 0.4s cubic-bezier(.4,0,.2,1)":"none",r.style.transform=`translateX(${t}px)`,r.style.left=""})},[y,k,N,E,M.length,a,v]),o(()=>{if(!E||!a)return;const e=B.current.length,r=B.current[e-1];if(!r)return;let n;const t=()=>{let l=y;1===y?l=e-3:y===e-2&&(l=2),l!==y&&b(l),j(!1),r.removeEventListener("transitionend",t),clearTimeout(n)};return r.addEventListener("transitionend",t),n=window.setTimeout(()=>{j(!1),r.removeEventListener("transitionend",t)},500),()=>{r.removeEventListener("transitionend",t),clearTimeout(n)}},[y,a,E,v]),o(()=>{if(!E)return;const e=B.current[0];if(!e)return;let r;const n=()=>{j(!1),e.removeEventListener("transitionend",n),clearTimeout(r)};return e.addEventListener("transitionend",n),r=window.setTimeout(()=>{j(!1),e.removeEventListener("transitionend",n)},500),()=>{e.removeEventListener("transitionend",n),clearTimeout(r)}},[E,v]);const A=()=>{E||(j(!0),b(a?e=>e+1:e=>Math.min(e+1,M.length-1)))},X=()=>{E||(j(!0),b(a?e=>e-1:e=>Math.max(e-1,0)))};return e("div",{className:[p.n23mSlider,"n23mSlider",_].filter(Boolean).join(" "),style:{height:v?"calc(100% - 2px)":C&&x.length>1?"calc(100% - 60px)":"100%"},onTouchStart:e=>{1===e.touches.length&&(D(e.touches[0].clientX),H(0))},onTouchMove:e=>{null!==W&&H(e.touches[0].clientX-W)},onTouchEnd:()=>{z>50?X():z<-50&&A(),D(null),H(0)},children:[v&&r(c,{loaderColor:w}),!v&&e(n,{children:[r("div",{className:[p.n23mSliderContainerSlider,"n23mSliderContainerSlider"].filter(Boolean).join(" "),children:r("div",{className:[p.n23mSliderSlideWrapper,"n23mSliderSlideWrapper"].join(" "),ref:T,children:M.map((e,n)=>r("div",{ref:e=>{B.current[n]=e},className:`${p.n23mSliderSlide}`,style:{width:x.length>1?"calc(100% - 40px)":"100%"},"aria-hidden":y!==n,children:e},e.key??n))})}),C&&x.length>1&&e("div",{className:[p.n23mSliderControls,"n23mSliderControls"].join(" "),children:[r("div",{className:[p.n23mSliderCounter,"n23mSliderCounter"].join(" "),children:r(m,{mobileSize:16,desktopSize:16,color:"black",children:a?`${(()=>{if(!a)return y;const e=x.length;return e<1?0:(y-2+e)%e})()+1} / ${x.length}`:`${y+1} / ${x.length}`})}),e("div",{className:[p.n23mSliderControlsButtons,"n23mSliderControlsButtons"].join(" "),children:[r(S,{height:"50px",width:"50px",backgroundColor:"#F2F0EF",padding:0,title:"Prev",onClick:X,borderColor:"black",backgroundColorDisabled:"#F2F0EF",disabled:E||!a&&0===y,children:r(u,{width:24,height:24})}),r(S,{height:"50px",width:"50px",backgroundColor:"#F2F0EF",padding:0,title:"Next",borderColor:"black",backgroundColorDisabled:"#F2F0EF",onClick:A,disabled:E||!a&&y==x.length-1,children:r(h,{width:24,height:24})})]})]})]})]})};f.displayName="Slider";export{f as Slider};
1
+ export{S as Slider}from"./Slider-Dof_HMMd.js";import"react/jsx-runtime";import"react";import"./style-inject.es-BnTDb6vU.js";import"./TextBox-B47QWA9m.js";import"./Loader-CL-mm0LT.js";import"./IconArrowRight-Bs6HQ5lc.js";import"./Button-DP1hmI08.js";
@@ -1 +1 @@
1
- import{jsxs as e,jsx as l,Fragment as i}from"react/jsx-runtime";import r,{useState as t,useRef as n,useEffect as o}from"react";import{s as d}from"./style-inject.es-BnTDb6vU.js";import{L as s}from"./Loader-CL-mm0LT.js";import{a,I as u}from"./IconArrowRight-Bs6HQ5lc.js";import{B as c}from"./Button-DP1hmI08.js";import"./TextBox-B47QWA9m.js";var h={n23mSliderMulti:"SliderMulti-module_n23mSliderMulti__hsL9a",n23mSliderMultiContainerSlider:"SliderMulti-module_n23mSliderMultiContainerSlider__iu4xy",n23mSliderMultiSlideWrapper:"SliderMulti-module_n23mSliderMultiSlideWrapper__KPiK1",n23mSliderMultiSlide:"SliderMulti-module_n23mSliderMultiSlide__NDrCj",n23mSliderMultiControls:"SliderMulti-module_n23mSliderMultiControls__54jy-",n23mSliderMultiControlsButtons:"SliderMulti-module_n23mSliderMultiControlsButtons__JqcZ5"};d("@layer n23mSliderMulti{.SliderMulti-module_n23mSliderMulti__hsL9a{width:100%}.SliderMulti-module_n23mSliderMultiContainerSlider__iu4xy{display:flex;flex-direction:column;gap:10px;height:100%;position:relative;user-select:none;width:100%}.SliderMulti-module_n23mSliderMultiSlideWrapper__KPiK1{height:100%;overflow:hidden;position:relative;width:100%;will-change:transform}.SliderMulti-module_n23mSliderMultiSlide__NDrCj{height:100%;overflow:hidden;position:absolute;top:0;will-change:transform;&>*{height:100%;width:100%}}.SliderMulti-module_n23mSliderMultiControls__54jy-{align-items:center;display:flex;justify-content:flex-end;margin-left:20px;margin-right:20px}.SliderMulti-module_n23mSliderMultiControlsButtons__JqcZ5{display:flex;gap:10px;margin-top:10px}}");const m=(e,l,i=!1,t)=>(i?e.slice(0,l):e.slice(-l)).map((e,l)=>r.cloneElement(e,{key:`${i?"clone-first":"clone-last"}-${l} ${t}`,className:e.props.className})),S=({isCircular:d=!1,children:S,className:p,showControls:g=!0,loading:M=!1,loaderColor:f="black",slidesPerView:_=4,slideSpacingPx:C=10,slidesToScroll:x=4})=>{const y=r.Children.toArray(S).filter(r.isValidElement),[v,w]=t(0),E=n(null);o(()=>{const e=()=>{E.current&&w(E.current.offsetWidth)};return e(),window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[M]);const j=_>0?(v-C*(_-1))/_:0;let b=d?[...m(y,r.Children.toArray(S).length,!1,1),...m(y,r.Children.toArray(S).length,!1,2),...y,...m(y,r.Children.toArray(S).length,!0,3),...m(y,r.Children.toArray(S).length,!0,4)]:y;const[N,F]=t(d?2*r.Children.toArray(S).length:0),[k,B]=t(!1),L=n([]),[A,T]=t(null),[$,W]=t(0);o(()=>{F(d?2*r.Children.toArray(S).length:0)},[d,_,y.length,M]);o(()=>{L.current.forEach((e,l)=>{if(!e)return;const i=(l-N)*(j+C)+(v-j*_-C*(_-1))/2;e.style.transition=k?"transform 1.05s cubic-bezier(0.645, 0.045, 0.355, 1)":"none",e.style.transform=`translateX(${i}px)`,e.style.left=""})},[N,v,k,b.length,_,j,C,M]),o(()=>{if(!k)return;let e;const l=()=>{let i=N;N<_&&d?i=N+y.length:N>=y.length+_&&d&&(i=N-y.length),i!==N&&d&&F(i),B(!1),L.current.forEach(e=>{e&&e.removeEventListener("transitionend",l)}),clearTimeout(e)};return L.current.forEach(e=>{e&&e.addEventListener("transitionend",l)}),e=window.setTimeout(()=>{B(!1),L.current.forEach(e=>{e&&e.removeEventListener("transitionend",l)})},1150),()=>{L.current.forEach(e=>{e&&e.removeEventListener("transitionend",l)}),clearTimeout(e)}},[N,d,k,y.length,_,b.length,M]);const P=()=>{k||(B(!0),F(e=>e+x))},D=()=>{k||(B(!0),F(e=>e-x))};return L.current.length!==b.length&&(L.current=Array(b.length).fill(null)),e("div",{className:[h.n23mSliderMulti,"n23mSliderMulti",p].filter(Boolean).join(" "),style:{height:M?"calc(100% - 2px)":g?"calc(100% - 60px)":"100%"},onTouchStart:e=>{1===e.touches.length&&(T(e.touches[0].clientX),W(0))},onTouchMove:e=>{null!==A&&W(e.touches[0].clientX-A)},onTouchEnd:()=>{$>50?D():$<-50&&P(),T(null),W(0)},children:[M&&l(s,{loaderColor:f}),!M&&e(i,{children:[l("div",{className:[h.n23mSliderMultiContainerSlider].filter(Boolean).join(" "),children:l("div",{className:[h.n23mSliderMultiSlideWrapper,"n23mSliderMultiSlideWrapper"].join(" "),ref:E,style:{display:"flex",gap:`${C}px`,overflow:"hidden",width:"100%"},children:b.map((e,i)=>l("div",{ref:e=>{L.current[i]=e},className:h.n23mSliderMultiSlide,style:{width:`${j}px`,flex:`0 0 ${j}px`},"aria-hidden":i<N||i>=N+_,children:e},e.key??i))})}),g&&l("div",{className:[h.n23mSliderMultiControls,"n23mSliderMultiControls"].join(" "),children:e("div",{className:[h.n23mSliderMultiControlsButtons,"n23mSliderMultiControlsButtons"].join(" "),children:[l(c,{height:"50px",width:"50px",backgroundColor:"#F2F0EF",padding:0,title:"Prev",onClick:D,borderColor:"black",backgroundColorDisabled:"#F2F0EF",disabled:k||!d&&0===N,children:l(a,{width:24,height:24})}),l(c,{height:"50px",width:"50px",backgroundColor:"#F2F0EF",padding:0,title:"Next",borderColor:"black",backgroundColorDisabled:"#F2F0EF",onClick:P,disabled:k||!d&&N+_>=y.length,children:l(u,{width:24,height:24})})]})})]})]})};S.displayName="Slider";export{S as SliderMulti};
1
+ import{jsx as e,jsxs as l,Fragment as i}from"react/jsx-runtime";import r,{useState as t,useRef as n,useEffect as o}from"react";import{s as d}from"./style-inject.es-BnTDb6vU.js";import{L as s}from"./Loader-CL-mm0LT.js";import{a,I as u}from"./IconArrowRight-Bs6HQ5lc.js";import{B as c}from"./Button-DP1hmI08.js";import{u as m}from"./useWindowSize-CAQRbyxi.js";import{S as h}from"./Slider-Dof_HMMd.js";import"./TextBox-B47QWA9m.js";var S={n23mSliderMulti:"SliderMulti-module_n23mSliderMulti__hsL9a",n23mSliderMultiContainerSlider:"SliderMulti-module_n23mSliderMultiContainerSlider__iu4xy",n23mSliderMultiSlideWrapper:"SliderMulti-module_n23mSliderMultiSlideWrapper__KPiK1",n23mSliderMultiSlide:"SliderMulti-module_n23mSliderMultiSlide__NDrCj",n23mSliderMultiControls:"SliderMulti-module_n23mSliderMultiControls__54jy-",n23mSliderMultiControlsButtons:"SliderMulti-module_n23mSliderMultiControlsButtons__JqcZ5"};d("@layer n23mSliderMulti{.SliderMulti-module_n23mSliderMulti__hsL9a{width:100%}.SliderMulti-module_n23mSliderMultiContainerSlider__iu4xy{display:flex;flex-direction:column;gap:10px;height:100%;position:relative;user-select:none;width:100%}.SliderMulti-module_n23mSliderMultiSlideWrapper__KPiK1{height:100%;overflow:hidden;position:relative;width:100%;will-change:transform}.SliderMulti-module_n23mSliderMultiSlide__NDrCj{height:100%;overflow:hidden;position:absolute;top:0;will-change:transform;&>*{height:100%;width:100%}}.SliderMulti-module_n23mSliderMultiControls__54jy-{align-items:center;display:flex;justify-content:flex-end;margin-left:20px;margin-right:20px}.SliderMulti-module_n23mSliderMultiControlsButtons__JqcZ5{display:flex;gap:10px;margin-top:10px}}");const p=(e,l,i=!1,t)=>(i?e.slice(0,l):e.slice(-l)).map((e,l)=>r.cloneElement(e,{key:`${i?"clone-first":"clone-last"}-${l} ${t}`,className:e.props.className})),g=({isCircular:d=!1,children:g,className:f,showControls:M=!0,loading:_=!1,loaderColor:x="black",slidesPerView:C=4,slideSpacingPx:w=10,slidesToScroll:v=4})=>{const b=r.Children.toArray(g).filter(r.isValidElement),{width:y}=m(),[j,E]=t(0),N=n(null),[F,k]=t(d?2*b.length:0),[B,L]=t(!1),T=n([]),[z,W]=t(null),[$,P]=t(0);o(()=>{const e=()=>{N.current&&E(N.current.offsetWidth),k(0)};return e(),window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[_]),o(()=>{k(d?2*b.length:0)},[d,C,b.length,_]);let D=C,K=v,A="transform 1.00s cubic-bezier(0.645, 0.045, 0.355, 1)",X=1100;y<767.98?(D=1,K=1,A="transform 0.4s cubic-bezier(.4,0,.2,1)",X=500):y<1199.98&&(D=2,K=2,A="transform 0.85s cubic-bezier(0.645, 0.045, 0.355, 1)",X=950);const q=D>0?(j-w*(D-1))/D:0;let I=d?[...p(b,b.length,!1,1),...p(b,b.length,!1,2),...b,...p(b,b.length,!0,3),...p(b,b.length,!0,4)]:b;o(()=>{T.current.forEach((e,l)=>{if(!e)return;const i=(l-F)*(q+w)+(j-q*D-w*(D-1))/2;e.style.transition=B?A:"none",e.style.transform=`translateX(${i}px)`,e.style.left=""})},[F,j,B,I.length,D,q,w,_]),o(()=>{if(!B)return;let e;const l=()=>{let i=F;F<D&&d?i=F+b.length:F>=b.length+D&&d&&(i=F-b.length),i!==F&&d&&k(i),L(!1),T.current.forEach(e=>{e&&e.removeEventListener("transitionend",l)}),clearTimeout(e)};return T.current.forEach(e=>{e&&e.addEventListener("transitionend",l)}),e=window.setTimeout(()=>{L(!1),T.current.forEach(e=>{e&&e.removeEventListener("transitionend",l)})},X),()=>{T.current.forEach(e=>{e&&e.removeEventListener("transitionend",l)}),clearTimeout(e)}},[F,d,B,b.length,D,I.length,_]);const J=()=>{B||(L(!0),k(e=>e+K))},V=()=>{B||(L(!0),k(e=>e-K))};return T.current.length!==I.length&&(T.current=Array(I.length).fill(null)),y<767.98?e(h,{children:g,isCircular:d,loading:_}):l("div",{className:[S.n23mSliderMulti,"n23mSliderMulti",f].filter(Boolean).join(" "),style:{height:_?"calc(100% - 2px)":M?"calc(100% - 60px)":"100%"},onTouchStart:e=>{1===e.touches.length&&(W(e.touches[0].clientX),P(0))},onTouchMove:e=>{null!==z&&P(e.touches[0].clientX-z)},onTouchEnd:()=>{$>50?V():$<-50&&J(),W(null),P(0)},children:[_&&e(s,{loaderColor:x}),!_&&l(i,{children:[e("div",{className:[S.n23mSliderMultiContainerSlider].filter(Boolean).join(" "),children:e("div",{className:[S.n23mSliderMultiSlideWrapper,"n23mSliderMultiSlideWrapper"].join(" "),ref:N,style:{display:"flex",gap:`${w}px`,overflow:"hidden",width:"100%",boxSizing:"border-box"},children:I.map((l,i)=>e("div",{ref:e=>{T.current[i]=e},className:S.n23mSliderMultiSlide,style:{width:`${q}px`,flex:`0 0 ${q}px`},"aria-hidden":i<F||i>=F+D,children:l},l.key??i))})}),M&&e("div",{className:[S.n23mSliderMultiControls,"n23mSliderMultiControls"].join(" "),children:l("div",{className:[S.n23mSliderMultiControlsButtons,"n23mSliderMultiControlsButtons"].join(" "),children:[e(c,{height:"50px",width:"50px",backgroundColor:"#F2F0EF",padding:0,title:"Prev",onClick:V,borderColor:"black",backgroundColorDisabled:"#F2F0EF",disabled:B||!d&&0===F,children:e(a,{width:24,height:24})}),e(c,{height:"50px",width:"50px",backgroundColor:"#F2F0EF",padding:0,title:"Next",borderColor:"black",backgroundColorDisabled:"#F2F0EF",onClick:J,disabled:B||!d&&F+D>=b.length,children:e(u,{width:24,height:24})})]})})]})]})};g.displayName="Slider";export{g as SliderMulti};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "najwer23morsels",
3
- "version": "0.9.1",
3
+ "version": "0.9.2",
4
4
  "main": "./lib/index.js",
5
5
  "module": "./lib/index.mjs",
6
6
  "types": "./lib/index.d.ts",