najwer23morsels 0.16.7 → 0.17.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # najwer23morsels
2
2
 
3
+ ## 0.17.1
4
+
5
+ ### Patch Changes
6
+
7
+ - Test
8
+
9
+ ## 0.17.0
10
+
11
+ ### Minor Changes
12
+
13
+ - CopyButton
14
+
3
15
  ## 0.16.0
4
16
 
5
17
  ### Minor Changes
package/biome.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "$schema": "https://biomejs.dev/schemas/2.3.4/schema.json",
2
+ "$schema": "https://biomejs.dev/schemas/2.3.15/schema.json",
3
3
  "vcs": {
4
4
  "enabled": true,
5
5
  "clientKind": "git",
@@ -0,0 +1 @@
1
+ import{jsx as t}from"react/jsx-runtime";import{useState as o,useRef as e,useCallback as r,useEffect as n}from"react";import{B as i}from"./Button-BYGSUhk2.js";import{T as a}from"./TextBox-dHL75Jj9.js";import{s as l}from"./style-inject.es-BnTDb6vU.js";import"./Loader-D18j8aqL.js";import"./getCssVariableStyle-CBKDTT0s.js";var m={n23mCopyButton:"CopyButton-module_n23mCopyButton__JWZWy"};l("");const u=({children:l,className:u,style:p,textToCopy:s,backgroundColor:c="orangered",...d})=>{const[y,C]=o(!1),B=e(null),g=r(()=>{B.current&&clearTimeout(B.current),navigator.clipboard.writeText(s),C(!0),B.current=setTimeout(()=>{C(!1),B.current=null},800)},[]);return n(()=>()=>{B.current&&clearTimeout(B.current)},[]),t("div",{className:[m.n23mCopyButton,"n23mCopyButton",u].filter(Boolean).join(" "),...d,children:t(i,{padding:"0px 3px",height:"auto",width:"auto",backgroundColor:y?"#4BB543":c,onClick:g,children:l??t(a,{mobileSize:8,desktopSize:8,fontWeight:600,title:"Copy",lineHeight:"17px",children:"Copy"})})})};u.displayName="CopyButton";export{u as CopyButton};
package/lib/Hooks.js CHANGED
@@ -1 +1 @@
1
- export{u as useCachedImageCheck}from"./useCachedImageCheck-TeUbYfzH.js";export{a as useIsMounted,u as useResizeObserver}from"./useResizeObserver-Cey-xNGY.js";export{u as useWindowSize}from"./useWindowSize-CAQRbyxi.js";import"react";
1
+ export{u as useCachedImageCheck}from"./useCachedImageCheck-TeUbYfzH.js";export{u as useIsMounted,a as useResizeObserver}from"./useResizeObserver-BbBZwKT3.js";export{u as useWindowSize}from"./useWindowSize-CAQRbyxi.js";import"react";
@@ -1 +1 @@
1
- import{jsx as c,jsxs as t}from"react/jsx-runtime";const h=({width:t,height:h,color:o="currentColor"})=>c("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 320 512",width:t,height:h,fill:o,children:c("path",{d:"M41.4 233.4c-12.5 12.5-12.5 32.8 0 45.3l160 160c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L109.3 256 246.6 118.6c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0l-160 160z"})});h.displayName="IconArrowRight";const o=({width:t,height:h,color:o="currentColor"})=>c("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 320 512",width:t,height:h,fill:o,children:c("path",{d:"M278.6 233.4c12.5 12.5 12.5 32.8 0 45.3l-160 160c-12.5 12.5-32.8 12.5-45.3 0s-12.5-32.8 0-45.3L210.7 256 73.4 118.6c-12.5-12.5-12.5-32.8 0-45.3s32.8-12.5 45.3 0l160 160z"})});o.displayName="IconArrowRight";const i=({width:h,height:o,color:i="currentColor"})=>c("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 -20 492.589 492.589",width:h,height:o,fill:i,children:t("g",{children:[c("path",{d:"M468.467,222.168h-28.329c-9.712-89.679-80.46-161.18-169.71-172.258V24.135c0-13.338-10.791-24.134-24.134-24.134 c-13.311,0-24.117,10.796-24.117,24.134V49.91C132.924,60.988,62.177,132.488,52.482,222.168H24.153 C10.806,222.168,0,232.964,0,246.286c0,13.336,10.806,24.132,24.153,24.132h29.228c12.192,86.816,81.551,155.4,168.797,166.229 v31.804c0,13.336,10.806,24.135,24.117,24.135c13.343,0,24.134-10.799,24.134-24.135v-31.804 c87.228-10.829,156.607-79.413,168.775-166.229h29.264c13.33,0,24.122-10.796,24.122-24.132 C492.589,232.964,481.797,222.168,468.467,222.168z M246.294,398.093c-85.345,0-154.804-69.453-154.804-154.813 c0-85.363,69.459-154.813,154.804-154.813c85.376,0,154.823,69.45,154.823,154.813 C401.117,328.639,331.671,398.093,246.294,398.093z"}),c("path",{d:"M246.294,176.93c-36.628,0-66.34,29.704-66.34,66.349c0,36.635,29.711,66.349,66.34,66.349 c36.66,0,66.34-29.713,66.34-66.349C312.634,206.635,282.955,176.93,246.294,176.93z"})]})});i.displayName="IconLocate";export{o as I,h as a,i as b};
1
+ import{jsx as c,jsxs as t}from"react/jsx-runtime";const h=({width:t,height:h,color:o="currentColor"})=>c("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 320 512",width:t,height:h,fill:o,children:c("path",{d:"M41.4 233.4c-12.5 12.5-12.5 32.8 0 45.3l160 160c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L109.3 256 246.6 118.6c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0l-160 160z"})});h.displayName="IconArrowRight";const o=({width:t,height:h,color:o="currentColor"})=>c("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 320 512",width:t,height:h,fill:o,children:c("path",{d:"M278.6 233.4c12.5 12.5 12.5 32.8 0 45.3l-160 160c-12.5 12.5-32.8 12.5-45.3 0s-12.5-32.8 0-45.3L210.7 256 73.4 118.6c-12.5-12.5-12.5-32.8 0-45.3s32.8-12.5 45.3 0l160 160z"})});o.displayName="IconArrowRight";const i=({width:h,height:o,color:i="currentColor"})=>c("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 -20 492.589 492.589",width:h,height:o,fill:i,children:t("g",{children:[c("path",{d:"M468.467,222.168h-28.329c-9.712-89.679-80.46-161.18-169.71-172.258V24.135c0-13.338-10.791-24.134-24.134-24.134 c-13.311,0-24.117,10.796-24.117,24.134V49.91C132.924,60.988,62.177,132.488,52.482,222.168H24.153 C10.806,222.168,0,232.964,0,246.286c0,13.336,10.806,24.132,24.153,24.132h29.228c12.192,86.816,81.551,155.4,168.797,166.229 v31.804c0,13.336,10.806,24.135,24.117,24.135c13.343,0,24.134-10.799,24.134-24.135v-31.804 c87.228-10.829,156.607-79.413,168.775-166.229h29.264c13.33,0,24.122-10.796,24.122-24.132 C492.589,232.964,481.797,222.168,468.467,222.168z M246.294,398.093c-85.345,0-154.804-69.453-154.804-154.813 c0-85.363,69.459-154.813,154.804-154.813c85.376,0,154.823,69.45,154.823,154.813 C401.117,328.639,331.671,398.093,246.294,398.093z"}),c("path",{d:"M246.294,176.93c-36.628,0-66.34,29.704-66.34,66.349c0,36.635,29.711,66.349,66.34,66.349 c36.66,0,66.34-29.713,66.34-66.349C312.634,206.635,282.955,176.93,246.294,176.93z"})]})});i.displayName="IconLocate";export{h as I,o as a,i as b};
package/lib/Icons.js CHANGED
@@ -1 +1 @@
1
- export{a as IconArrowLeft,I as IconArrowRight,b as IconLocate}from"./IconLocate-DNrSwx5A.js";import"react/jsx-runtime";
1
+ export{I as IconArrowLeft,a as IconArrowRight,b as IconLocate}from"./IconLocate-lnbPvhtP.js";import"react/jsx-runtime";
package/lib/Masonry.js CHANGED
@@ -1 +1 @@
1
- import{jsx as n}from"react/jsx-runtime";import{useRef as r,useEffect as a,Children as m,useState as o,useMemo as s}from"react";import{u as e}from"./useWindowSize-CAQRbyxi.js";import{g as t}from"./getCssVariableStyle-CBKDTT0s.js";import{s as i}from"./style-inject.es-BnTDb6vU.js";import{u as l}from"./useResizeObserver-Cey-xNGY.js";var y={n23mMasonry:"Masonry-module_n23mMasonry__i3gjM",n23mMasonryColumn:"Masonry-module_n23mMasonryColumn__KYLxP",n23mMasonryColumnChild:"Masonry-module_n23mMasonryColumnChild__D3rRF"};i("@layer n23mMasonry{.Masonry-module_n23mMasonry__i3gjM{column-gap:var(--masonry-cg);display:flex;&>*{height:fit-content}}.Masonry-module_n23mMasonryColumn__KYLxP{width:calc(100%/var(--mc) - ((var(--mc) - 1)/var(--mc))*var(--masonry-cg))}.Masonry-module_n23mMasonryColumnChild__D3rRF{margin-bottom:var(--masonry-rg)}@media (max-width:767.98px){.Masonry-module_n23mMasonryColumn__KYLxP{--mc:var(--masonry-cm)}}@media (min-width:768px) and (max-width:1199.98px){.Masonry-module_n23mMasonryColumn__KYLxP{--mc:var(--masonry-ct)}}@media (min-width:1200px) and (max-width:1599.98px){.Masonry-module_n23mMasonryColumn__KYLxP{--mc:var(--masonry-csd)}}@media (min-width:1600px){.Masonry-module_n23mMasonryColumn__KYLxP{--mc:var(--masonry-cd)}}}");const d=({arrWithChildren:o,onHeightChange:s,id:e})=>{const t=r(null),{height:i=0}=l({ref:t});return a(()=>{s(i)},[i]),n("div",{ref:t,className:y.n23mMasonryColumn,children:m.map(o,(r,a)=>n("div",{className:y.n23mMasonryColumnChild,children:r},e+a))},e)};d.displayName="MasonryColumn";const c=({children:m,gap:i,col:l,onGridMasonryLoadEnd:c,delay:h=10,className:u,style:M,..._})=>{const[p,g]=o(0),{width:C}=e(),x=r(!0),v=n=>n<767.98?l.mobile:n>=768.98&&n<1199.98?l.tablet:n>=1199.98&&n<1599.98?l.smallDesktop:n>=1599.98?l.desktop:3,[f,j]=o(()=>v(C)),w=n=>Array.from({length:n}).map((n,r)=>({name:`col${r}`,arrWithElm:[],height:0})),[b,L]=o(()=>w(f));a(()=>{const n=setTimeout(()=>{const n=v(C);n!==f&&(g(0),j(n),L(w(n)))},100);return()=>clearTimeout(n)},[C]);const W=s(()=>b.map(({height:n})=>n).join(","),[b]);return a(()=>{const n=x.current?0:h,r=setTimeout(()=>{if(p<m.length){const n=(n=>[...n].sort((n,r)=>n.height-r.height)[0].name)(b);L(b.map(r=>r.name===n?{...r,arrWithElm:[...r.arrWithElm,m[p]]}:r)),g(n=>n+1),p===m.length-1&&c&&c(!0)}},n);return()=>clearTimeout(r)},[W]),a(()=>{x.current=!1},[]),n("div",{className:[y.n23mMasonry,"n23mMasonry",u].filter(Boolean).join(" "),..._,style:{...t({"--masonry-cm":l.mobile,"--masonry-ct":l.tablet,"--masonry-csd":l.smallDesktop,"--masonry-cd":l.desktop,"--masonry-cg":i.col,"--masonry-rg":i.row}),...M},children:b.map(({arrWithElm:r,name:a})=>n(d,{arrWithChildren:r,onHeightChange:n=>((n,r)=>{L(b.map(a=>a.name===r?{...a,height:n}:a))})(n,a),id:a},"masonry-parent"+a))})};c.displayName="Masonry";export{c as Masonry};
1
+ import{jsx as n}from"react/jsx-runtime";import{useRef as r,useEffect as a,Children as m,useState as o,useMemo as s}from"react";import{u as e}from"./useWindowSize-CAQRbyxi.js";import{g as t}from"./getCssVariableStyle-CBKDTT0s.js";import{s as i}from"./style-inject.es-BnTDb6vU.js";import{a as l}from"./useResizeObserver-BbBZwKT3.js";var y={n23mMasonry:"Masonry-module_n23mMasonry__i3gjM",n23mMasonryColumn:"Masonry-module_n23mMasonryColumn__KYLxP",n23mMasonryColumnChild:"Masonry-module_n23mMasonryColumnChild__D3rRF"};i("@layer n23mMasonry{.Masonry-module_n23mMasonry__i3gjM{column-gap:var(--masonry-cg);display:flex;&>*{height:fit-content}}.Masonry-module_n23mMasonryColumn__KYLxP{width:calc(100%/var(--mc) - ((var(--mc) - 1)/var(--mc))*var(--masonry-cg))}.Masonry-module_n23mMasonryColumnChild__D3rRF{margin-bottom:var(--masonry-rg)}@media (max-width:767.98px){.Masonry-module_n23mMasonryColumn__KYLxP{--mc:var(--masonry-cm)}}@media (min-width:768px) and (max-width:1199.98px){.Masonry-module_n23mMasonryColumn__KYLxP{--mc:var(--masonry-ct)}}@media (min-width:1200px) and (max-width:1599.98px){.Masonry-module_n23mMasonryColumn__KYLxP{--mc:var(--masonry-csd)}}@media (min-width:1600px){.Masonry-module_n23mMasonryColumn__KYLxP{--mc:var(--masonry-cd)}}}");const d=({arrWithChildren:o,onHeightChange:s,id:e})=>{const t=r(null),{height:i=0}=l({ref:t});return a(()=>{s(i)},[i]),n("div",{ref:t,className:y.n23mMasonryColumn,children:m.map(o,(r,a)=>n("div",{className:y.n23mMasonryColumnChild,children:r},e+a))},e)};d.displayName="MasonryColumn";const c=({children:m,gap:i,col:l,onGridMasonryLoadEnd:c,delay:h=10,className:u,style:M,..._})=>{const[p,g]=o(0),{width:C}=e(),x=r(!0),v=n=>n<767.98?l.mobile:n>=768.98&&n<1199.98?l.tablet:n>=1199.98&&n<1599.98?l.smallDesktop:n>=1599.98?l.desktop:3,[f,j]=o(()=>v(C)),w=n=>Array.from({length:n}).map((n,r)=>({name:`col${r}`,arrWithElm:[],height:0})),[b,L]=o(()=>w(f));a(()=>{const n=setTimeout(()=>{const n=v(C);n!==f&&(g(0),j(n),L(w(n)))},100);return()=>clearTimeout(n)},[C]);const W=s(()=>b.map(({height:n})=>n).join(","),[b]);return a(()=>{const n=x.current?0:h,r=setTimeout(()=>{if(p<m.length){const n=(n=>[...n].sort((n,r)=>n.height-r.height)[0].name)(b);L(b.map(r=>r.name===n?{...r,arrWithElm:[...r.arrWithElm,m[p]]}:r)),g(n=>n+1),p===m.length-1&&c&&c(!0)}},n);return()=>clearTimeout(r)},[W]),a(()=>{x.current=!1},[]),n("div",{className:[y.n23mMasonry,"n23mMasonry",u].filter(Boolean).join(" "),..._,style:{...t({"--masonry-cm":l.mobile,"--masonry-ct":l.tablet,"--masonry-csd":l.smallDesktop,"--masonry-cd":l.desktop,"--masonry-cg":i.col,"--masonry-rg":i.row}),...M},children:b.map(({arrWithElm:r,name:a})=>n(d,{arrWithChildren:r,onHeightChange:n=>((n,r)=>{L(b.map(a=>a.name===r?{...a,height:n}:a))})(n,a),id:a},"masonry-parent"+a))})};c.displayName="Masonry";export{c as Masonry};
package/lib/Slider.js CHANGED
@@ -1 +1 @@
1
- import{jsxs as e,jsx as r,Fragment as l}from"react/jsx-runtime";import i,{useState as n,useRef as t,useLayoutEffect as o}from"react";import{B as d}from"./Button-BYGSUhk2.js";import{u as s}from"./useWindowSize-CAQRbyxi.js";import{a,I as c}from"./IconLocate-DNrSwx5A.js";import{L as m}from"./Loader-D18j8aqL.js";import{T as u}from"./TextBox-dHL75Jj9.js";import{s as h}from"./style-inject.es-BnTDb6vU.js";import"./getCssVariableStyle-CBKDTT0s.js";var g={n23mSlider:"Slider-module_n23mSlider__YOEan",dragging:"Slider-module_dragging__F3UtX",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"};h("@layer n23mSlider{.Slider-module_n23mSlider__YOEan{width:100%;&.Slider-module_dragging__F3UtX,&.Slider-module_dragging__F3UtX a{cursor:grabbing}}.Slider-module_n23mSliderContainerSlider__-1M4s{display:flex;flex-direction:column;gap:10px;height:100%;position:relative;user-select:none;width:100%}.Slider-module_n23mSliderSlideWrapper__hbDsw{box-sizing:border-box;display:flex;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;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 S=(e,r,l=!1,n)=>(l?e.slice(0,r):e.slice(-r)).map((e,r)=>i.cloneElement(e,{key:`${l?"clone-first":"clone-last"}-${r} ${n}`,className:e.props.className})),p=({isCircular:h=!1,children:p,className:_,loading:f=!1,loaderColor:x="black",slidesConfig:b={mobile:{items:1,slidesToScroll:1},tablet:{items:2,slidesToScroll:2},desktop:{items:3,slidesToScroll:3}},slideSpacingPx:C=10})=>{const v=i.Children.toArray(p).filter(i.isValidElement),{width:w}=s(),[y,j]=n(0),E=t(null),k=t(null),[F,L]=n(h?2*v.length:0),[T,$]=n(!1),N=t([]),[B,X]=n(null),[z,D]=n(0),M=t(!1);let W,U,H,Z;w<767.98?(W=b.mobile.items,U=b.mobile.slidesToScroll,H="transform 0.4s cubic-bezier(.4,0,.2,1)",Z=450):w<1199.98?(W=b.tablet.items,U=b.tablet.slidesToScroll,H="transform 0.4s cubic-bezier(.4,0,.2,1)",Z=450):(W=b.desktop.items,U=b.desktop.slidesToScroll,H="transform 0.4s cubic-bezier(.4,0,.2,1)",Z=450),o(()=>{E.current&&j(E.current.offsetWidth),L(h?2*v.length:0)},[f,h,W,v.length,w]);const I=(y-C*(W-1))/W;let J=h?[...S(v,v.length,!1,1),...v,...S(v,v.length,!1,2),...S(v,v.length,!0,3),...S(v,v.length,!0,4)]:v;o(()=>{N.current.forEach((e,r)=>{if(!e)return;let l=0,i=0;1===W&&1!==v.length?(l=40,i=40):2===W?(l=20,i=20):4===W?(l=10,i=10):3===W&&(l=12.5,i=12.5);const n=(r-F)*(I+C-i)+(y-(I-l)*W-C*(W-1))/2;e.style.transition=T?H:"none",e.style.transform=`translateX(${n}px)`})},[F,y,T,J.length,W,I,C,f]),o(()=>{if(!T)return;let e;const r=()=>{let l=F;F<2*W&&h?l=F+2*v.length:F>=2*v.length+W&&h&&(l=F-v.length),l!==F&&h&&L(l),$(!1),N.current.forEach(e=>{e&&e.removeEventListener("transitionend",r)}),clearTimeout(e)};return N.current.forEach(e=>{e&&e.addEventListener("transitionend",r)}),e=window.setTimeout(()=>{$(!1),N.current.forEach(e=>{e&&e.removeEventListener("transitionend",r)})},Z),()=>{N.current.forEach(e=>{e&&e.removeEventListener("transitionend",r)}),clearTimeout(e)}},[F,h,T,v.length,W,J.length,f]);const O=()=>{T||($(!0),L(e=>e+U))},P=()=>{T||($(!0),L(e=>e-U))};return e("div",{ref:k,className:[g.n23mSlider,"n23mSlider",_].filter(Boolean).join(" "),style:{height:f?"calc(100% - 2px)":"calc(100% - 60px)"},children:[f&&r(m,{loaderColor:x}),!f&&e(l,{children:[r("div",{className:[g.n23mSliderContainerSlider].filter(Boolean).join(" "),onTouchStart:e=>{1===e.touches.length&&(X(e.touches[0].clientX),D(0),M.current=!0,k.current&&k.current.classList.add(g.dragging))},onTouchMove:e=>{null!==B&&D(e.touches[0].clientX-B)},onTouchEnd:()=>{z>50&&!T&&(h||0!==F)?P():z<-50&&!(T||!h&&F+W>=v.length)&&O(),X(null),D(0),M.current=!1,k.current&&k.current.classList.remove(g.dragging)},onMouseDown:e=>{X(e.clientX),D(0),M.current=!0,k.current&&k.current.classList.add(g.dragging)},onMouseMove:e=>{null!==B&&D(e.clientX-B)},onMouseUp:()=>{z>50&&!T&&(h||0!==F)?P():z<-50&&!(T||!h&&F+W>=v.length)&&O(),X(null),D(0),M.current=!1,k.current&&k.current.classList.remove(g.dragging)},children:r("div",{className:[g.n23mSliderSlideWrapper,"n23mSliderSlideWrapper"].join(" "),ref:E,style:{gap:`${C}px`},children:J.map((e,l)=>r("div",{ref:e=>{N.current[l]=e},className:g.n23mSliderSlide,style:{width:1===W&&1===v.length?"100%":1===W?`calc(${I}px - 40px)`:2===W?`calc(${I}px - 20px)`:3===W?`calc(${I}px - 12.5px)`:4===W?`calc(${I}px - 10px)`:`${I}px`},"aria-hidden":l<F||l>=F+W,children:e},e.key??l))})}),e("div",{className:[g.n23mSliderControls,"n23mSliderControls"].join(" "),style:{justifyContent:1===W?"space-between":"flex-end"},children:[1===W&&r("div",{className:[g.n23mSliderCounter,"n23mSliderCounter"].join(" "),children:r(u,{mobileSize:16,desktopSize:16,color:"black",children:h?`${(()=>{if(!h)return F;const e=v.length;return e<1?0:(F+e)%e})()+1} / ${v.length}`:`${F+1} / ${v.length}`})}),e("div",{className:[g.n23mSliderControlsButtons,"n23mSliderControlsButtons"].join(" "),children:[r(d,{height:"50px",width:"50px",backgroundColor:"#F2F0EF",padding:0,title:"Prev",onClick:P,borderColor:"black",backgroundColorDisabled:"#F2F0EF",disabled:T||!h&&0===F,children:r(a,{width:24,height:24})}),r(d,{height:"50px",width:"50px",backgroundColor:"#F2F0EF",padding:0,title:"Next",borderColor:"black",backgroundColorDisabled:"#F2F0EF",onClick:O,disabled:T||!h&&F+W>=v.length,children:r(c,{width:24,height:24})})]})]})]})]})};p.displayName="Slider";export{p as Slider};
1
+ import{jsxs as e,jsx as r,Fragment as l}from"react/jsx-runtime";import i,{useState as n,useRef as t,useLayoutEffect as o}from"react";import{B as d}from"./Button-BYGSUhk2.js";import{u as s}from"./useWindowSize-CAQRbyxi.js";import{I as a,a as c}from"./IconLocate-lnbPvhtP.js";import{L as m}from"./Loader-D18j8aqL.js";import{T as u}from"./TextBox-dHL75Jj9.js";import{s as h}from"./style-inject.es-BnTDb6vU.js";import"./getCssVariableStyle-CBKDTT0s.js";var g={n23mSlider:"Slider-module_n23mSlider__YOEan",dragging:"Slider-module_dragging__F3UtX",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"};h("@layer n23mSlider{.Slider-module_n23mSlider__YOEan{width:100%;&.Slider-module_dragging__F3UtX,&.Slider-module_dragging__F3UtX a{cursor:grabbing}}.Slider-module_n23mSliderContainerSlider__-1M4s{display:flex;flex-direction:column;gap:10px;height:100%;position:relative;user-select:none;width:100%}.Slider-module_n23mSliderSlideWrapper__hbDsw{box-sizing:border-box;display:flex;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;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 S=(e,r,l=!1,n)=>(l?e.slice(0,r):e.slice(-r)).map((e,r)=>i.cloneElement(e,{key:`${l?"clone-first":"clone-last"}-${r} ${n}`,className:e.props.className})),p=({isCircular:h=!1,children:p,className:_,loading:f=!1,loaderColor:x="black",slidesConfig:b={mobile:{items:1,slidesToScroll:1},tablet:{items:2,slidesToScroll:2},desktop:{items:3,slidesToScroll:3}},slideSpacingPx:C=10})=>{const v=i.Children.toArray(p).filter(i.isValidElement),{width:w}=s(),[y,j]=n(0),E=t(null),k=t(null),[F,L]=n(h?2*v.length:0),[T,$]=n(!1),N=t([]),[B,X]=n(null),[z,D]=n(0),M=t(!1);let W,U,H,Z;w<767.98?(W=b.mobile.items,U=b.mobile.slidesToScroll,H="transform 0.4s cubic-bezier(.4,0,.2,1)",Z=450):w<1199.98?(W=b.tablet.items,U=b.tablet.slidesToScroll,H="transform 0.4s cubic-bezier(.4,0,.2,1)",Z=450):(W=b.desktop.items,U=b.desktop.slidesToScroll,H="transform 0.4s cubic-bezier(.4,0,.2,1)",Z=450),o(()=>{E.current&&j(E.current.offsetWidth),L(h?2*v.length:0)},[f,h,W,v.length,w]);const I=(y-C*(W-1))/W;let J=h?[...S(v,v.length,!1,1),...v,...S(v,v.length,!1,2),...S(v,v.length,!0,3),...S(v,v.length,!0,4)]:v;o(()=>{N.current.forEach((e,r)=>{if(!e)return;let l=0,i=0;1===W&&1!==v.length?(l=40,i=40):2===W?(l=20,i=20):4===W?(l=10,i=10):3===W&&(l=12.5,i=12.5);const n=(r-F)*(I+C-i)+(y-(I-l)*W-C*(W-1))/2;e.style.transition=T?H:"none",e.style.transform=`translateX(${n}px)`})},[F,y,T,J.length,W,I,C,f]),o(()=>{if(!T)return;let e;const r=()=>{let l=F;F<2*W&&h?l=F+2*v.length:F>=2*v.length+W&&h&&(l=F-v.length),l!==F&&h&&L(l),$(!1),N.current.forEach(e=>{e&&e.removeEventListener("transitionend",r)}),clearTimeout(e)};return N.current.forEach(e=>{e&&e.addEventListener("transitionend",r)}),e=window.setTimeout(()=>{$(!1),N.current.forEach(e=>{e&&e.removeEventListener("transitionend",r)})},Z),()=>{N.current.forEach(e=>{e&&e.removeEventListener("transitionend",r)}),clearTimeout(e)}},[F,h,T,v.length,W,J.length,f]);const O=()=>{T||($(!0),L(e=>e+U))},P=()=>{T||($(!0),L(e=>e-U))};return e("div",{ref:k,className:[g.n23mSlider,"n23mSlider",_].filter(Boolean).join(" "),style:{height:f?"calc(100% - 2px)":"calc(100% - 60px)"},children:[f&&r(m,{loaderColor:x}),!f&&e(l,{children:[r("div",{className:[g.n23mSliderContainerSlider].filter(Boolean).join(" "),onTouchStart:e=>{1===e.touches.length&&(X(e.touches[0].clientX),D(0),M.current=!0,k.current&&k.current.classList.add(g.dragging))},onTouchMove:e=>{null!==B&&D(e.touches[0].clientX-B)},onTouchEnd:()=>{z>50&&!T&&(h||0!==F)?P():z<-50&&!(T||!h&&F+W>=v.length)&&O(),X(null),D(0),M.current=!1,k.current&&k.current.classList.remove(g.dragging)},onMouseDown:e=>{X(e.clientX),D(0),M.current=!0,k.current&&k.current.classList.add(g.dragging)},onMouseMove:e=>{null!==B&&D(e.clientX-B)},onMouseUp:()=>{z>50&&!T&&(h||0!==F)?P():z<-50&&!(T||!h&&F+W>=v.length)&&O(),X(null),D(0),M.current=!1,k.current&&k.current.classList.remove(g.dragging)},children:r("div",{className:[g.n23mSliderSlideWrapper,"n23mSliderSlideWrapper"].join(" "),ref:E,style:{gap:`${C}px`},children:J.map((e,l)=>r("div",{ref:e=>{N.current[l]=e},className:g.n23mSliderSlide,style:{width:1===W&&1===v.length?"100%":1===W?`calc(${I}px - 40px)`:2===W?`calc(${I}px - 20px)`:3===W?`calc(${I}px - 12.5px)`:4===W?`calc(${I}px - 10px)`:`${I}px`},"aria-hidden":l<F||l>=F+W,children:e},e.key??l))})}),e("div",{className:[g.n23mSliderControls,"n23mSliderControls"].join(" "),style:{justifyContent:1===W?"space-between":"flex-end"},children:[1===W&&r("div",{className:[g.n23mSliderCounter,"n23mSliderCounter"].join(" "),children:r(u,{mobileSize:16,desktopSize:16,color:"black",children:h?`${(()=>{if(!h)return F;const e=v.length;return e<1?0:(F+e)%e})()+1} / ${v.length}`:`${F+1} / ${v.length}`})}),e("div",{className:[g.n23mSliderControlsButtons,"n23mSliderControlsButtons"].join(" "),children:[r(d,{height:"50px",width:"50px",backgroundColor:"#F2F0EF",padding:0,title:"Prev",onClick:P,borderColor:"black",backgroundColorDisabled:"#F2F0EF",disabled:T||!h&&0===F,children:r(a,{width:24,height:24})}),r(d,{height:"50px",width:"50px",backgroundColor:"#F2F0EF",padding:0,title:"Next",borderColor:"black",backgroundColorDisabled:"#F2F0EF",onClick:O,disabled:T||!h&&F+W>=v.length,children:r(c,{width:24,height:24})})]})]})]})]})};p.displayName="Slider";export{p as Slider};
@@ -1 +1 @@
1
- import{jsxs as r,jsx as e}from"react/jsx-runtime";import{useRef as l,Children as t,cloneElement as n,useState as o,useEffect as i,useMemo as c,useCallback as s}from"react";import{B as a}from"./Button-BYGSUhk2.js";import{u}from"./useWindowSize-CAQRbyxi.js";import{a as d,I as g}from"./IconLocate-DNrSwx5A.js";import{g as m}from"./getCssVariableStyle-CBKDTT0s.js";import{s as f}from"./style-inject.es-BnTDb6vU.js";import"./Loader-D18j8aqL.js";import"./TextBox-dHL75Jj9.js";var h={n23mSliderScrollWrapper:"SliderScroll-module_n23mSliderScrollWrapper__MqXIk",n23mSliderScrollTrack:"SliderScroll-module_n23mSliderScrollTrack__FcsTl",dragging:"SliderScroll-module_dragging__iE4mo",n23mSliderScrollControls:"SliderScroll-module_n23mSliderScrollControls__i64nM",n23mSliderScrollControlsButtons:"SliderScroll-module_n23mSliderScrollControlsButtons__W-5rb"};f("@layer n23mSliderScroll{.SliderScroll-module_n23mSliderScrollWrapper__MqXIk{display:grid;position:relative}.SliderScroll-module_n23mSliderScrollTrack__FcsTl{-ms-overflow-style:none;-webkit-overflow-scrolling:touch;display:flex;flex-wrap:nowrap;gap:var(--sliderscroll-g);overflow-x:scroll;scrollbar-width:none;user-select:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;will-change:scroll-position;&::-webkit-scrollbar{display:none}&>*{flex-shrink:0}&.SliderScroll-module_dragging__iE4mo,&.SliderScroll-module_dragging__iE4mo a{cursor:grabbing}}.SliderScroll-module_n23mSliderScrollControls__i64nM{align-items:center;display:flex;justify-content:flex-end;margin-left:20px;margin-right:20px}.SliderScroll-module_n23mSliderScrollControlsButtons__W-5rb{display:flex;gap:10px;margin-top:10px}}");const S=({children:f,className:S,gap:p="5px",isCircular:w=!1,autoPlay:b=!1,autoPlaySpeed:F=.5,style:L})=>{const _={carousel:l(null),buttonLeft:l(null),buttonRight:l(null),showArrowLeft:l(!1),showArrowRight:l(!1),isSliding:l(!1),animationFrameId:l(null),isHovered:l(!1),drag:l({isDown:!1,startX:0,scrollLeft:0,isMove:!1,isDragging:!1}),childRefs:l([])},v=t.toArray(f),k=v.length,x=w?v.map((r,e)=>n(r,{key:`cb-${e}`})):[],y=w?v.map((r,e)=>n(r,{key:`ca-${e}`})):[],C=w?[...x,...v,...y]:v,[M,A]=o([]),{width:D}=u();i(()=>{if(!_.carousel.current)return;const r=_.childRefs.current.map(r=>{if(!r)return 0;const e=getComputedStyle(r),l=parseFloat(e.marginLeft)||0,t=parseFloat(e.marginRight)||0;return r.offsetWidth+l+t+Number(p.slice(0,-2))});A(r)},[f,D,p]);const I=c(()=>{const r=[];let e=0;for(const l of M)r.push(e),e+=l;return r},[M]);i(()=>{w&&_.carousel.current&&I.length&&(_.carousel.current.scrollLeft=(I[k]||0)-2*Number(p.slice(0,-2))),j()},[D,I,k,w]),i(()=>{W(!1)},[]),i(()=>{if(!w)return;if(!b)return void(_.animationFrameId.current&&(cancelAnimationFrame(_.animationFrameId.current),_.animationFrameId.current=null));let r;const e=()=>{if(!_.carousel.current)return;if(_.isSliding.current||_.isHovered.current)return void(_.animationFrameId.current=requestAnimationFrame(e));const r=_.carousel.current;let l=r.scrollLeft+F;if(w&&I.length&&M.length){const r=I[I.length-1]+(M[M.length-1]||0),e=I[k]||0,t=I[k+v.length]||r;l>t+M[0]/2&&(l-=t-e)}r.scrollLeft=l,j(),_.animationFrameId.current=requestAnimationFrame(e)};return r=setTimeout(()=>{_.animationFrameId.current=requestAnimationFrame(e)},500),()=>{r&&clearTimeout(r),_.animationFrameId.current&&(cancelAnimationFrame(_.animationFrameId.current),_.animationFrameId.current=null)}},[b,F,w,I,M,k,v.length]);const j=()=>{if(_.carousel.current){if(w)_.showArrowLeft.current=!0,_.showArrowRight.current=!0;else{const r=_.carousel.current.scrollLeft,e=_.carousel.current.scrollWidth-_.carousel.current.clientWidth;_.showArrowLeft.current=r>0,_.showArrowRight.current=r<e-1}W(_.isSliding.current)}},W=r=>{_.buttonLeft.current&&(_.buttonLeft.current.disabled=r||!_.showArrowLeft.current),_.buttonRight.current&&(_.buttonRight.current.disabled=r||!_.showArrowRight.current)},N=(r,e,l=300)=>{if(_.isSliding.current)return;_.isSliding.current=!0,W(!0);const t=r.scrollLeft,n=e-t,o=performance.now(),i=e=>{const c=e-o,s=Math.min(c/l,1);var a;r.scrollLeft=t+n*((a=s)<.5?4*a*a*a:1-Math.pow(-2*a+2,3)/2),s<1?requestAnimationFrame(i):(_.isSliding.current=!1,W(!1),j())};requestAnimationFrame(i)},R=s(()=>{if(!_.carousel.current)return;if(!I.length||!M.length)return;const r=_.carousel.current,e=r.offsetWidth,l=r.scrollLeft;let t=I.findIndex((r,e)=>r>l);-1===t?t=I.length-1:t>0&&t--;let n,o=0,i=0;for(let r=t;r<I.length&&(o+=M[r],i++,!(o>=e));r++);const c=t+i-1;n=I[c]+M[c]>l+e+1?c:t+i;let s=I[n]-2*Number(p.slice(0,-2));if(s<0&&(s=0),w){s=(I[k]||0)+s-(I[k]||0)}N(_.carousel.current,s,400)},[I,M,p,k,w,v.length]),B=s(()=>{if(!_.carousel.current)return;if(!I.length||!M.length)return;const r=_.carousel.current,e=r.offsetWidth,l=r.scrollLeft;let t=0;for(let r=0;r<I.length;r++)if(I[r]>l){t=r-1;break}t<0&&(t=0);let n=0,o=0;for(let r=t;r>=0&&(n+=M[r],n<=e);r--)o++;let i=t;w||(i=Math.max(o-1,i));let c=I[i]+M[i]-e;if(c<0&&(c=0),w){c=(I[k]||0)+c-(I[k]||0)+Number(p.slice(0,-2))}N(_.carousel.current,c,400)},[I,M,p,k,w]),T=()=>{_.carousel.current&&(_.drag.current.isDragging?_.carousel.current.classList.add(h.dragging):_.carousel.current.classList.remove(h.dragging))};return r("div",{className:["n23mSliderScroll",S].filter(Boolean).join(" "),style:{...m({"--sliderscroll-g":p,height:"calc(100% - 60px)"}),...L},onMouseEnter:()=>{_.isHovered.current=!0},onMouseLeave:()=>{_.isHovered.current=!1},children:[e("div",{className:[h.n23mSliderScrollWrapper,"n23mSliderScrollWrapper"].join(" "),children:e("div",{className:h.n23mSliderScrollTrack,ref:_.carousel,onClick:r=>{_.drag.current.isMove&&(r.preventDefault(),r.stopPropagation())},onScroll:()=>{if(_.carousel.current){if(w&&I.length&&M.length){const r=_.carousel.current.scrollLeft,e=I[I.length-1]+(M[M.length-1]||0),l=I[k]||0,t=I[k+v.length]||e;r<l-M[0]/2?_.carousel.current.scrollLeft=r+(I[v.length+k]-l):r>t+M[0]/2&&(_.carousel.current.scrollLeft=r-(t-l))}j()}},onMouseDown:r=>{_.drag.current.isDown=!0,_.drag.current.startX=r.pageX-(_.carousel.current?.offsetLeft||0),_.drag.current.scrollLeft=_.carousel.current?.scrollLeft||0,_.drag.current.isDragging=!0,T()},onMouseLeave:()=>{_.drag.current.isDown&&(_.drag.current.isDown=!1,_.drag.current.isDragging=!1,T())},onMouseUp:()=>{_.drag.current.isDown=!1,_.drag.current.isDragging=!1,T()},onMouseMove:r=>{if(!_.drag.current.isDown)return void(_.drag.current.isMove=!1);r.preventDefault();var e;const l=("pageX"in(e=r)?e.pageX:"touches"in e?e.touches[0].pageX:0)-(_.carousel.current?.offsetLeft||0)-_.drag.current.startX;Math.abs(l)>5&&(_.drag.current.isMove=!0),_.carousel.current&&(_.carousel.current.scrollLeft=_.drag.current.scrollLeft-l,j())},children:C.map((r,l)=>e("div",{ref:r=>{_.childRefs.current[l]=r},style:{display:"inline-block"},children:r},r.key||l))})}),e("div",{className:[h.n23mSliderScrollControls,"n23mSliderScrollControls"].join(" "),children:r("div",{className:[h.n23mSliderScrollControlsButtons,"n23mSliderScrollControlsButtons"].join(" "),children:[e(a,{ref:_.buttonLeft,height:"50px",width:"50px",backgroundColor:"#F2F0EF",padding:0,title:"Prev",onClick:B,borderColor:"black",backgroundColorDisabled:"#F2F0EF",children:e(d,{width:24,height:24})}),e(a,{ref:_.buttonRight,height:"50px",width:"50px",backgroundColor:"#F2F0EF",padding:0,title:"Next",onClick:R,borderColor:"black",backgroundColorDisabled:"#F2F0EF",children:e(g,{width:24,height:24})})]})})]})};S.displayName="SliderScroll";export{S as SliderScroll};
1
+ import{jsxs as r,jsx as e}from"react/jsx-runtime";import{useRef as l,Children as t,cloneElement as n,useState as o,useEffect as i,useMemo as c,useCallback as s}from"react";import{B as a}from"./Button-BYGSUhk2.js";import{u}from"./useWindowSize-CAQRbyxi.js";import{I as d,a as g}from"./IconLocate-lnbPvhtP.js";import{g as m}from"./getCssVariableStyle-CBKDTT0s.js";import{s as f}from"./style-inject.es-BnTDb6vU.js";import"./Loader-D18j8aqL.js";import"./TextBox-dHL75Jj9.js";var h={n23mSliderScrollWrapper:"SliderScroll-module_n23mSliderScrollWrapper__MqXIk",n23mSliderScrollTrack:"SliderScroll-module_n23mSliderScrollTrack__FcsTl",dragging:"SliderScroll-module_dragging__iE4mo",n23mSliderScrollControls:"SliderScroll-module_n23mSliderScrollControls__i64nM",n23mSliderScrollControlsButtons:"SliderScroll-module_n23mSliderScrollControlsButtons__W-5rb"};f("@layer n23mSliderScroll{.SliderScroll-module_n23mSliderScrollWrapper__MqXIk{display:grid;position:relative}.SliderScroll-module_n23mSliderScrollTrack__FcsTl{-ms-overflow-style:none;-webkit-overflow-scrolling:touch;display:flex;flex-wrap:nowrap;gap:var(--sliderscroll-g);overflow-x:scroll;scrollbar-width:none;user-select:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;will-change:scroll-position;&::-webkit-scrollbar{display:none}&>*{flex-shrink:0}&.SliderScroll-module_dragging__iE4mo,&.SliderScroll-module_dragging__iE4mo a{cursor:grabbing}}.SliderScroll-module_n23mSliderScrollControls__i64nM{align-items:center;display:flex;justify-content:flex-end;margin-left:20px;margin-right:20px}.SliderScroll-module_n23mSliderScrollControlsButtons__W-5rb{display:flex;gap:10px;margin-top:10px}}");const S=({children:f,className:S,gap:p="5px",isCircular:w=!1,autoPlay:b=!1,autoPlaySpeed:F=.5,style:L})=>{const _={carousel:l(null),buttonLeft:l(null),buttonRight:l(null),showArrowLeft:l(!1),showArrowRight:l(!1),isSliding:l(!1),animationFrameId:l(null),isHovered:l(!1),drag:l({isDown:!1,startX:0,scrollLeft:0,isMove:!1,isDragging:!1}),childRefs:l([])},v=t.toArray(f),k=v.length,x=w?v.map((r,e)=>n(r,{key:`cb-${e}`})):[],y=w?v.map((r,e)=>n(r,{key:`ca-${e}`})):[],C=w?[...x,...v,...y]:v,[M,A]=o([]),{width:D}=u();i(()=>{if(!_.carousel.current)return;const r=_.childRefs.current.map(r=>{if(!r)return 0;const e=getComputedStyle(r),l=parseFloat(e.marginLeft)||0,t=parseFloat(e.marginRight)||0;return r.offsetWidth+l+t+Number(p.slice(0,-2))});A(r)},[f,D,p]);const I=c(()=>{const r=[];let e=0;for(const l of M)r.push(e),e+=l;return r},[M]);i(()=>{w&&_.carousel.current&&I.length&&(_.carousel.current.scrollLeft=(I[k]||0)-2*Number(p.slice(0,-2))),j()},[D,I,k,w]),i(()=>{W(!1)},[]),i(()=>{if(!w)return;if(!b)return void(_.animationFrameId.current&&(cancelAnimationFrame(_.animationFrameId.current),_.animationFrameId.current=null));let r;const e=()=>{if(!_.carousel.current)return;if(_.isSliding.current||_.isHovered.current)return void(_.animationFrameId.current=requestAnimationFrame(e));const r=_.carousel.current;let l=r.scrollLeft+F;if(w&&I.length&&M.length){const r=I[I.length-1]+(M[M.length-1]||0),e=I[k]||0,t=I[k+v.length]||r;l>t+M[0]/2&&(l-=t-e)}r.scrollLeft=l,j(),_.animationFrameId.current=requestAnimationFrame(e)};return r=setTimeout(()=>{_.animationFrameId.current=requestAnimationFrame(e)},500),()=>{r&&clearTimeout(r),_.animationFrameId.current&&(cancelAnimationFrame(_.animationFrameId.current),_.animationFrameId.current=null)}},[b,F,w,I,M,k,v.length]);const j=()=>{if(_.carousel.current){if(w)_.showArrowLeft.current=!0,_.showArrowRight.current=!0;else{const r=_.carousel.current.scrollLeft,e=_.carousel.current.scrollWidth-_.carousel.current.clientWidth;_.showArrowLeft.current=r>0,_.showArrowRight.current=r<e-1}W(_.isSliding.current)}},W=r=>{_.buttonLeft.current&&(_.buttonLeft.current.disabled=r||!_.showArrowLeft.current),_.buttonRight.current&&(_.buttonRight.current.disabled=r||!_.showArrowRight.current)},N=(r,e,l=300)=>{if(_.isSliding.current)return;_.isSliding.current=!0,W(!0);const t=r.scrollLeft,n=e-t,o=performance.now(),i=e=>{const c=e-o,s=Math.min(c/l,1);var a;r.scrollLeft=t+n*((a=s)<.5?4*a*a*a:1-Math.pow(-2*a+2,3)/2),s<1?requestAnimationFrame(i):(_.isSliding.current=!1,W(!1),j())};requestAnimationFrame(i)},R=s(()=>{if(!_.carousel.current)return;if(!I.length||!M.length)return;const r=_.carousel.current,e=r.offsetWidth,l=r.scrollLeft;let t=I.findIndex((r,e)=>r>l);-1===t?t=I.length-1:t>0&&t--;let n,o=0,i=0;for(let r=t;r<I.length&&(o+=M[r],i++,!(o>=e));r++);const c=t+i-1;n=I[c]+M[c]>l+e+1?c:t+i;let s=I[n]-2*Number(p.slice(0,-2));if(s<0&&(s=0),w){s=(I[k]||0)+s-(I[k]||0)}N(_.carousel.current,s,400)},[I,M,p,k,w,v.length]),B=s(()=>{if(!_.carousel.current)return;if(!I.length||!M.length)return;const r=_.carousel.current,e=r.offsetWidth,l=r.scrollLeft;let t=0;for(let r=0;r<I.length;r++)if(I[r]>l){t=r-1;break}t<0&&(t=0);let n=0,o=0;for(let r=t;r>=0&&(n+=M[r],n<=e);r--)o++;let i=t;w||(i=Math.max(o-1,i));let c=I[i]+M[i]-e;if(c<0&&(c=0),w){c=(I[k]||0)+c-(I[k]||0)+Number(p.slice(0,-2))}N(_.carousel.current,c,400)},[I,M,p,k,w]),T=()=>{_.carousel.current&&(_.drag.current.isDragging?_.carousel.current.classList.add(h.dragging):_.carousel.current.classList.remove(h.dragging))};return r("div",{className:["n23mSliderScroll",S].filter(Boolean).join(" "),style:{...m({"--sliderscroll-g":p,height:"calc(100% - 60px)"}),...L},onMouseEnter:()=>{_.isHovered.current=!0},onMouseLeave:()=>{_.isHovered.current=!1},children:[e("div",{className:[h.n23mSliderScrollWrapper,"n23mSliderScrollWrapper"].join(" "),children:e("div",{className:h.n23mSliderScrollTrack,ref:_.carousel,onClick:r=>{_.drag.current.isMove&&(r.preventDefault(),r.stopPropagation())},onScroll:()=>{if(_.carousel.current){if(w&&I.length&&M.length){const r=_.carousel.current.scrollLeft,e=I[I.length-1]+(M[M.length-1]||0),l=I[k]||0,t=I[k+v.length]||e;r<l-M[0]/2?_.carousel.current.scrollLeft=r+(I[v.length+k]-l):r>t+M[0]/2&&(_.carousel.current.scrollLeft=r-(t-l))}j()}},onMouseDown:r=>{_.drag.current.isDown=!0,_.drag.current.startX=r.pageX-(_.carousel.current?.offsetLeft||0),_.drag.current.scrollLeft=_.carousel.current?.scrollLeft||0,_.drag.current.isDragging=!0,T()},onMouseLeave:()=>{_.drag.current.isDown&&(_.drag.current.isDown=!1,_.drag.current.isDragging=!1,T())},onMouseUp:()=>{_.drag.current.isDown=!1,_.drag.current.isDragging=!1,T()},onMouseMove:r=>{if(!_.drag.current.isDown)return void(_.drag.current.isMove=!1);r.preventDefault();var e;const l=("pageX"in(e=r)?e.pageX:"touches"in e?e.touches[0].pageX:0)-(_.carousel.current?.offsetLeft||0)-_.drag.current.startX;Math.abs(l)>5&&(_.drag.current.isMove=!0),_.carousel.current&&(_.carousel.current.scrollLeft=_.drag.current.scrollLeft-l,j())},children:C.map((r,l)=>e("div",{ref:r=>{_.childRefs.current[l]=r},style:{display:"inline-block"},children:r},r.key||l))})}),e("div",{className:[h.n23mSliderScrollControls,"n23mSliderScrollControls"].join(" "),children:r("div",{className:[h.n23mSliderScrollControlsButtons,"n23mSliderScrollControlsButtons"].join(" "),children:[e(a,{ref:_.buttonLeft,height:"50px",width:"50px",backgroundColor:"#F2F0EF",padding:0,title:"Prev",onClick:B,borderColor:"black",backgroundColorDisabled:"#F2F0EF",children:e(d,{width:24,height:24})}),e(a,{ref:_.buttonRight,height:"50px",width:"50px",backgroundColor:"#F2F0EF",padding:0,title:"Next",onClick:R,borderColor:"black",backgroundColorDisabled:"#F2F0EF",children:e(g,{width:24,height:24})})]})})]})};S.displayName="SliderScroll";export{S as SliderScroll};
@@ -0,0 +1,8 @@
1
+ interface CopyButtonProps extends React.HTMLAttributes<HTMLDivElement> {
2
+ children?: React.ReactNode;
3
+ style?: React.CSSProperties;
4
+ backgroundColor: string;
5
+ textToCopy: string;
6
+ }
7
+ export declare const CopyButton: React.FC<CopyButtonProps>;
8
+ export {};
@@ -0,0 +1,2 @@
1
+ import { CopyButton } from './CopyButton';
2
+ export { CopyButton };
@@ -1 +1 @@
1
- import{useRef as e,useEffect as t,useCallback as r,useState as n}from"react";const i=()=>{const n=e(!1);return t(()=>(n.current=!0,()=>{n.current=!1}),[]),r(()=>n.current,[])},o={width:void 0,height:void 0},c=r=>{const{ref:c,box:d="content-box"}=r,[{width:u,height:s},w]=n(o),x=i(),b=e({...o}),z=e(void 0);return z.current=r.onResize,t(()=>{if(!c.current)return;if("undefined"==typeof window||!("ResizeObserver"in window))return;const e=new ResizeObserver(([e])=>{const t="border-box"===d?"borderBoxSize":"device-pixel-content-box"===d?"devicePixelContentBoxSize":"contentBoxSize",r=h(e,t,"inlineSize"),n=h(e,t,"blockSize");if(b.current.width!==r||b.current.height!==n){const e={width:r,height:n};b.current.width=r,b.current.height=n,z.current?z.current(e):x()&&w(e)}});return e.observe(c.current,{box:d}),()=>{e.disconnect()}},[d,c,x]),{width:u,height:s}},h=(e,t,r)=>e[t]?Array.isArray(e[t])?e[t][0][r]:e[t][r]:"contentBoxSize"===t?e.contentRect["inlineSize"===r?"width":"height"]:void 0;export{i as a,c as u};
1
+ import{useRef as e,useEffect as t,useCallback as r,useState as n}from"react";const i=()=>{const n=e(!1);return t(()=>(n.current=!0,()=>{n.current=!1}),[]),r(()=>n.current,[])},o={width:void 0,height:void 0},c=r=>{const{ref:c,box:d="content-box"}=r,[{width:u,height:s},w]=n(o),x=i(),b=e({...o}),z=e(void 0);return z.current=r.onResize,t(()=>{if(!c.current)return;if("undefined"==typeof window||!("ResizeObserver"in window))return;const e=new ResizeObserver(([e])=>{const t="border-box"===d?"borderBoxSize":"device-pixel-content-box"===d?"devicePixelContentBoxSize":"contentBoxSize",r=h(e,t,"inlineSize"),n=h(e,t,"blockSize");if(b.current.width!==r||b.current.height!==n){const e={width:r,height:n};b.current.width=r,b.current.height=n,z.current?z.current(e):x()&&w(e)}});return e.observe(c.current,{box:d}),()=>{e.disconnect()}},[d,c,x]),{width:u,height:s}},h=(e,t,r)=>e[t]?Array.isArray(e[t])?e[t][0][r]:e[t][r]:"contentBoxSize"===t?e.contentRect["inlineSize"===r?"width":"height"]:void 0;export{c as a,i as u};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "najwer23morsels",
3
- "version": "0.16.7",
3
+ "version": "0.17.2",
4
4
  "main": "./lib/index.js",
5
5
  "module": "./lib/index.mjs",
6
6
  "types": "./lib/index.d.ts",
@@ -21,37 +21,37 @@
21
21
  "release": "yarn build && yarn && changeset && changeset version && changeset publish && rimraf ./lib && rimraf ./.yarn/cache"
22
22
  },
23
23
  "devDependencies": {
24
- "@biomejs/biome": "2.3.4",
25
- "@changesets/cli": "^2.29.7",
24
+ "@biomejs/biome": "2.3.15",
25
+ "@changesets/cli": "^2.29.8",
26
26
  "@rollup/plugin-node-resolve": "^16.0.3",
27
27
  "@rollup/plugin-terser": "0.4.4",
28
- "@storybook/addon-a11y": "^10.0.6",
29
- "@storybook/addon-docs": "^10.0.6",
30
- "@storybook/react-vite": "^10.0.6",
31
- "@types/react": "^19.2.2",
32
- "@types/react-dom": "^19.2.2",
33
- "@vitejs/plugin-react": "^5.1.0",
28
+ "@storybook/addon-a11y": "^10.2.8",
29
+ "@storybook/addon-docs": "^10.2.8",
30
+ "@storybook/react-vite": "^10.2.8",
31
+ "@types/react": "^19.2.14",
32
+ "@types/react-dom": "^19.2.3",
33
+ "@vitejs/plugin-react": "^5.1.4",
34
34
  "gh-pages": "^6.3.0",
35
- "plop": "^4.0.4",
35
+ "plop": "^4.0.5",
36
36
  "postcss": "^8.5.6",
37
- "prettier": "^3.6.2",
38
- "react": "^19.2.0",
39
- "react-dom": "^19.2.0",
40
- "rimraf": "^6.1.0",
41
- "rollup": "^4.53.2",
42
- "rollup-plugin-dts": "6.2.3",
37
+ "prettier": "^3.8.1",
38
+ "react": "^19.2.4",
39
+ "react-dom": "^19.2.4",
40
+ "rimraf": "^6.1.2",
41
+ "rollup": "^4.57.1",
42
+ "rollup-plugin-dts": "6.3.0",
43
43
  "rollup-plugin-output-size": "^2.0.0",
44
44
  "rollup-plugin-peer-deps-external": "^2.2.4",
45
45
  "rollup-plugin-postcss": "^4.0.2",
46
46
  "rollup-plugin-typescript2": "0.36.0",
47
- "storybook": "^10.0.6",
47
+ "storybook": "^10.2.8",
48
48
  "storybook-css-modules-preset": "^1.1.1",
49
49
  "typescript": "^5.9.3",
50
- "vite": "^7.2.2"
50
+ "vite": "^7.3.1"
51
51
  },
52
52
  "peerDependencies": {
53
- "react": "^19.1.0",
54
- "react-dom": "^19.1.0"
53
+ "react": "^19.2.4",
54
+ "react-dom": "^19.2.4"
55
55
  },
56
56
  "keywords": [
57
57
  "react",
@@ -72,5 +72,5 @@
72
72
  "url": "git+https://github.com/najwer23/najwer23morsels.git"
73
73
  },
74
74
  "license": "MIT",
75
- "packageManager": "yarn@4.11.0"
75
+ "packageManager": "yarn@4.12.0"
76
76
  }