najwer23morsels 0.14.0 → 0.14.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.
@@ -1 +1 @@
1
- import{jsxs as o,jsx as t}from"react/jsx-runtime";import{forwardRef as e}from"react";import{L as n}from"./Loader-Bo6bjUUl.js";import{g as r}from"./getCssVariableStyle-CBKDTT0s.js";import{s as i}from"./style-inject.es-BnTDb6vU.js";var a={n23mButtonButton:"Button-module_n23mButtonButton__IfHY-"};i('@layer n23mButton{.Button-module_n23mButtonButton__IfHY-{--boxShadow:0 4px 8px 0 rgba(0,0,0,.24),0 6px 20px 0 rgba(0,0,0,.19);-webkit-touch-callout:none;-webkit-tap-highlight-color:rgba(0,0,0,0);background-color:var(--n23mButtonBg,var(--button-bg));border:1px solid var(--n23mButtonBorderColor,var(--button-borderColor,unset));border-radius:8px;box-shadow:none;cursor:pointer;height:var(--button-height,auto);letter-spacing:normal;padding:var(--button-padding,10px 17px);position:relative;transition:background-color .3s,box-shadow .3s;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;width:var(--button-width,auto);>span{display:inline-block;position:relative;z-index:1}&:before{background-color:inherit;border-radius:8px;content:"";inset:0;pointer-events:none;position:absolute;transition:filter .3s;z-index:0}@media (hover:hover) and (pointer:fine){&:hover:before{filter:brightness(100%)}&:hover{box-shadow:var(--boxShadow)}}&:active:before{filter:brightness(.8)}&:active{box-shadow:var(--boxShadow)}&:focus-visible:before{filter:brightness(.8);outline:none}&:focus-visible{box-shadow:var(--boxShadow);outline:none}&:disabled{background-color:var(--n23mButtonBgDisabled,var(--button-bgDisabled));box-shadow:none;cursor:not-allowed}}}');const s=e(({children:e,className:i,backgroundColor:s,padding:l,loading:d,height:b,width:u,borderColor:h,backgroundColorDisabled:c,style:g,...m},p)=>o("div",{className:["n23mButton",i].filter(Boolean).join(" "),children:[d&&t("div",{style:{width:u,height:b},children:t(n,{})}),!d&&t("button",{ref:p,style:{...r({"--button-bg":s,"--button-height":b,"--button-width":u,"--button-bgDisabled":c,"--button-borderColor":h,"--button-padding":l}),...g},className:[a.n23mButtonButton,"n23mButtonButton"].filter(Boolean).join(" "),...m,children:t("span",{children:e})})]}));s.displayName="Button";export{s as B};
1
+ import{jsxs as o,jsx as t}from"react/jsx-runtime";import{forwardRef as e}from"react";import{L as n}from"./Loader-D18j8aqL.js";import{g as r}from"./getCssVariableStyle-CBKDTT0s.js";import{s as i}from"./style-inject.es-BnTDb6vU.js";var a={n23mButtonButton:"Button-module_n23mButtonButton__IfHY-"};i('@layer n23mButton{.Button-module_n23mButtonButton__IfHY-{--boxShadow:0 4px 8px 0 rgba(0,0,0,.24),0 6px 20px 0 rgba(0,0,0,.19);-webkit-touch-callout:none;-webkit-tap-highlight-color:rgba(0,0,0,0);background-color:var(--n23mButtonBg,var(--button-bg));border:1px solid var(--n23mButtonBorderColor,var(--button-borderColor,unset));border-radius:8px;box-shadow:none;cursor:pointer;height:var(--button-height,auto);letter-spacing:normal;padding:var(--button-padding,10px 17px);position:relative;transition:background-color .3s,box-shadow .3s;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;width:var(--button-width,auto);>span{display:inline-block;position:relative;z-index:1}&:before{background-color:inherit;border-radius:8px;content:"";inset:0;pointer-events:none;position:absolute;transition:filter .3s;z-index:0}@media (hover:hover) and (pointer:fine){&:hover:before{filter:brightness(100%)}&:hover{box-shadow:var(--boxShadow)}}&:active:before{filter:brightness(.8)}&:active{box-shadow:var(--boxShadow)}&:focus-visible:before{filter:brightness(.8);outline:none}&:focus-visible{box-shadow:var(--boxShadow);outline:none}&:disabled{background-color:var(--n23mButtonBgDisabled,var(--button-bgDisabled));box-shadow:none;cursor:not-allowed}}}');const s=e(({children:e,className:i,backgroundColor:s,padding:l,loading:d,height:b,width:u,borderColor:h,backgroundColorDisabled:c,style:g,...m},p)=>o("div",{className:["n23mButton",i].filter(Boolean).join(" "),children:[d&&t("div",{style:{width:u,height:b},children:t(n,{})}),!d&&t("button",{ref:p,style:{...r({"--button-bg":s,"--button-height":b,"--button-width":u,"--button-bgDisabled":c,"--button-borderColor":h,"--button-padding":l}),...g},className:[a.n23mButtonButton,"n23mButtonButton"].filter(Boolean).join(" "),...m,children:t("span",{children:e})})]}));s.displayName="Button";export{s as B};
package/lib/Button.js CHANGED
@@ -1 +1 @@
1
- export{B as Button}from"./Button-DkT8Jc4j.js";import"react/jsx-runtime";import"react";import"./Loader-Bo6bjUUl.js";import"./TextBox-02rJgu3r.js";import"./getCssVariableStyle-CBKDTT0s.js";import"./style-inject.es-BnTDb6vU.js";
1
+ export{B as Button}from"./Button-DTuQbzsZ.js";import"react/jsx-runtime";import"react";import"./Loader-D18j8aqL.js";import"./TextBox-dHL75Jj9.js";import"./getCssVariableStyle-CBKDTT0s.js";import"./style-inject.es-BnTDb6vU.js";
package/lib/Grid.js CHANGED
@@ -1 +1 @@
1
- import{jsxs as i,jsx as r}from"react/jsx-runtime";import{L as d}from"./Loader-Bo6bjUUl.js";import{g as o}from"./getCssVariableStyle-CBKDTT0s.js";import{s as e}from"./style-inject.es-BnTDb6vU.js";import"./TextBox-02rJgu3r.js";var a={n23mGridFlex:"Grid-module_n23mGridFlex__bsotF",n23mGridContainer:"Grid-module_n23mGridContainer__G1O3I",n23mGridColumns:"Grid-module_n23mGridColumns__oyScE"};e("@layer n23mGrid{.Grid-module_n23mGridContainer__G1O3I,.Grid-module_n23mGridFlex__bsotF{box-sizing:border-box;flex-wrap:var(--grid-fw,nowrap);margin:var(--grid-m);max-width:var(--grid-wMax);min-height:var(--grid-mh,auto);min-width:var(--grid-wMin);padding:var(--grid-p)}.Grid-module_n23mGridFlex__bsotF{align-items:var(--grid-align-items,center);justify-content:var(--grid-jc,space-between)}.Grid-module_n23mGridColumns__oyScE,.Grid-module_n23mGridFlex__bsotF{column-gap:var(--grid-col-gap,0);display:flex;row-gap:var(--grid-row-gap)}.Grid-module_n23mGridColumns__oyScE{flex-wrap:wrap;width:100%}.Grid-module_n23mGridColumns__oyScE>div{width:calc(100%/var(--gfc) - ((var(--gfc) - 1)/var(--gfc))*var(--grid-col-gap, 0px))}@media (max-width:767.98px){.Grid-module_n23mGridColumns__oyScE>div{--gfc:var(--grid-col-mobile)}}@media (min-width:768px) and (max-width:1199.98px){.Grid-module_n23mGridColumns__oyScE>div{--gfc:var(--grid-col-tablet)}}@media (min-width:1200px) and (max-width:1599.98px){.Grid-module_n23mGridColumns__oyScE>div{--gfc:var(--grid-col-small-desktop)}}@media (min-width:1600px){.Grid-module_n23mGridColumns__oyScE>div{--gfc:var(--grid-col-desktop)}}}");const l=({children:e,widthMin:l="0px",widthMax:m="1920px",padding:n="0px",margin:t="auto",layout:g,gap:s,col:c,loading:p=!1,justifyContent:_,alignItems:G,minHeight:u,flexWrap:x,className:w,style:v,...h})=>{if("container"===g||"flex"===g)return i("div",{className:[a["n23mGrid"+g.charAt(0).toUpperCase()+g.slice(1)],"n23mGrid"+g.charAt(0).toUpperCase()+g.slice(1),w].filter(Boolean).join(" "),style:{...o({"--grid-p":n,"--grid-m":t,"--grid-jc":_,"--grid-col-gap":s?.col,"--grid-row-gap":s?.row,"--grid-align-items":G,"--grid-fw":x,"--grid-mh":u,"--grid-wMin":l,"--grid-wMax":m}),...v},...h,children:[!p&&e,p&&r(d,{minHeight:`${u}`})]});if(!s||!c)throw new Error('When layout="columns", gap and col props are required');return r("div",{className:[a.n23mGridColumns,"n23mGridColumns",w].filter(Boolean).join(" "),style:{"--grid-col-mobile":c.mobile.toString(),"--grid-col-tablet":c.tablet.toString(),"--grid-col-small-desktop":c.smallDesktop.toString(),"--grid-col-desktop":c.desktop.toString(),"--grid-col-gap":s.col,"--grid-row-gap":s.row},...h,children:e})};l.displayName="Grid";export{l as Grid};
1
+ import{jsxs as i,jsx as r}from"react/jsx-runtime";import{L as d}from"./Loader-D18j8aqL.js";import{g as o}from"./getCssVariableStyle-CBKDTT0s.js";import{s as e}from"./style-inject.es-BnTDb6vU.js";import"./TextBox-dHL75Jj9.js";import"react";var a={n23mGridFlex:"Grid-module_n23mGridFlex__bsotF",n23mGridContainer:"Grid-module_n23mGridContainer__G1O3I",n23mGridColumns:"Grid-module_n23mGridColumns__oyScE"};e("@layer n23mGrid{.Grid-module_n23mGridContainer__G1O3I,.Grid-module_n23mGridFlex__bsotF{box-sizing:border-box;flex-wrap:var(--grid-fw,nowrap);margin:var(--grid-m);max-width:var(--grid-wMax);min-height:var(--grid-mh,auto);min-width:var(--grid-wMin);padding:var(--grid-p)}.Grid-module_n23mGridFlex__bsotF{align-items:var(--grid-align-items,center);justify-content:var(--grid-jc,space-between)}.Grid-module_n23mGridColumns__oyScE,.Grid-module_n23mGridFlex__bsotF{column-gap:var(--grid-col-gap,0);display:flex;row-gap:var(--grid-row-gap)}.Grid-module_n23mGridColumns__oyScE{flex-wrap:wrap;width:100%}.Grid-module_n23mGridColumns__oyScE>div{width:calc(100%/var(--gfc) - ((var(--gfc) - 1)/var(--gfc))*var(--grid-col-gap, 0px))}@media (max-width:767.98px){.Grid-module_n23mGridColumns__oyScE>div{--gfc:var(--grid-col-mobile)}}@media (min-width:768px) and (max-width:1199.98px){.Grid-module_n23mGridColumns__oyScE>div{--gfc:var(--grid-col-tablet)}}@media (min-width:1200px) and (max-width:1599.98px){.Grid-module_n23mGridColumns__oyScE>div{--gfc:var(--grid-col-small-desktop)}}@media (min-width:1600px){.Grid-module_n23mGridColumns__oyScE>div{--gfc:var(--grid-col-desktop)}}}");const m=({children:e,widthMin:m="0px",widthMax:l="1920px",padding:n="0px",margin:t="auto",layout:g,gap:s,col:c,loading:p=!1,justifyContent:_,alignItems:G,minHeight:u,flexWrap:x,className:w,style:v,...h})=>{if("container"===g||"flex"===g)return i("div",{className:[a["n23mGrid"+g.charAt(0).toUpperCase()+g.slice(1)],"n23mGrid"+g.charAt(0).toUpperCase()+g.slice(1),w].filter(Boolean).join(" "),style:{...o({"--grid-p":n,"--grid-m":t,"--grid-jc":_,"--grid-col-gap":s?.col,"--grid-row-gap":s?.row,"--grid-align-items":G,"--grid-fw":x,"--grid-mh":u,"--grid-wMin":m,"--grid-wMax":l}),...v},...h,children:[!p&&e,p&&r(d,{minHeight:`${u}`})]});if(!s||!c)throw new Error('When layout="columns", gap and col props are required');return r("div",{className:[a.n23mGridColumns,"n23mGridColumns",w].filter(Boolean).join(" "),style:{"--grid-col-mobile":c.mobile.toString(),"--grid-col-tablet":c.tablet.toString(),"--grid-col-small-desktop":c.smallDesktop.toString(),"--grid-col-desktop":c.desktop.toString(),"--grid-col-gap":s.col,"--grid-row-gap":s.row},...h,children:e})};m.displayName="Grid";export{m as Grid};
package/lib/Input.js CHANGED
@@ -1 +1 @@
1
- import{jsxs as e,jsx as t}from"react/jsx-runtime";import{T as n}from"./TextBox-02rJgu3r.js";import{g as i}from"./getCssVariableStyle-CBKDTT0s.js";import{s as a}from"./style-inject.es-BnTDb6vU.js";var l={n23mInput:"Input-module_n23mInput__hkvVc",n23mInputInput:"Input-module_n23mInputInput__S-hN-"};a("@layer n23mInput{.Input-module_n23mInput__hkvVc{--iff:-apple-system,BlinkMacSystemFont,avenir next,avenir,segoe ui,helvetica neue,helvetica,Cantarell,Ubuntu,roboto,noto,arial,sans-serif;margin-bottom:18px;margin-top:0;.Input-module_n23mInputInput__S-hN-{display:grid;& input,& textarea{border:1px solid var(--input-cb,#000);border-radius:5px;box-sizing:border-box;color:var(--input-c,#000);font-family:var(--n23mFontFamily,var(--iff));font-size:16px;font-weight:500}& input{height:40px;padding:20px 10px;width:100%}& textarea{field-sizing:content;block-size:100%;max-height:400px;min-height:200px;padding:10px;resize:vertical}& ::placeholder{filter:brightness(125%);font-weight:300}}}}");const o=({className:a,style:o,name:r,label:p,inputRef:u,placeholder:s,type:m="text",labelColor:d="black",kind:c="input",inputColor:f,inputColorBorder:h,defaultValue:x,disabled:b,onBlur:g,...I})=>{const v=e=>{e.target,"function"==typeof g&&g(e)};return e("div",{className:[l.n23mInput,"n23mInput",a].filter(Boolean).join(" "),...I,style:{...i({"--input-c":f,"--input-cb":h}),...o},children:[t(n,{mobileSize:14,desktopSize:14,tag:"label",fontWeight:300,color:d,htmlFor:r,children:p}),e("div",{className:l.n23mInputInput,children:["input"==c&&t("input",{ref:u,id:r,name:r,type:m,onBlur:v,placeholder:s,defaultValue:x,disabled:b}),"textarea"==c&&t("textarea",{id:r,name:r,onBlur:v,placeholder:s,defaultValue:x,disabled:b,ref:u})]})]})};o.displayName="Input";export{o as Input};
1
+ import{jsxs as t,jsx as e}from"react/jsx-runtime";import{useRef as n}from"react";import{T as r}from"./TextBox-dHL75Jj9.js";import{g as i}from"./getCssVariableStyle-CBKDTT0s.js";import{validator as o}from"./Validator.js";import{s as a}from"./style-inject.es-BnTDb6vU.js";var l={n23mInput:"Input-module_n23mInput__hkvVc",n23mInputInput:"Input-module_n23mInputInput__S-hN-"};a("@layer n23mInput{.Input-module_n23mInput__hkvVc{--iff:-apple-system,BlinkMacSystemFont,avenir next,avenir,segoe ui,helvetica neue,helvetica,Cantarell,Ubuntu,roboto,noto,arial,sans-serif;margin-bottom:10px;margin-top:0;.Input-module_n23mInputInput__S-hN-{display:grid;& input,& textarea{border:1px solid var(--input-cb,#000);border-radius:5px;box-sizing:border-box;color:var(--input-c,#000);font-family:var(--n23mFontFamily,var(--iff));font-size:16px;font-weight:500}& input{height:40px;padding:20px 10px;width:100%}& textarea{field-sizing:content;block-size:100%;max-height:400px;min-height:200px;padding:10px;resize:vertical}& ::placeholder{filter:brightness(125%);font-weight:300}}.Input-module_n23mInputError__jolhD{color:var(--najwer23snacks-input-error-font-color);font-family:var(--najwer23snacks-input-error-font-family);font-size:var(--najwer23snacks-input-error-font-size);font-weight:var(--najwer23snacks-input-error-font-weight);line-height:1;margin:2px}}}");const p=({className:a,style:p,name:s,label:u,inputRef:m,placeholder:d,type:c="text",labelColor:f="black",kind:h="input",inputColor:x,inputColorBorder:g,defaultValue:b,disabled:v,validatorOptions:I,onBlur:y,..._})=>{const j=n(null),k=t=>{const e=t.target;if(document.activeElement!==e&&(j.current&&(j.current.textContent=""),I)){const t=o(e.value,I);t.length>0?(j.current.textContent=t[0],e.classList.add("error")):e.classList.remove("error")}"function"==typeof y&&y(t)};return t("div",{className:[l.n23mInput,"n23mInput",a].filter(Boolean).join(" "),..._,style:{...i({"--input-c":x,"--input-cb":g}),...p},children:[e(r,{mobileSize:14,desktopSize:14,tag:"label",fontWeight:400,color:f,htmlFor:s,children:u}),t("div",{className:l.n23mInputInput,children:["input"==h&&e("input",{ref:m,id:s,name:s,type:c,onBlur:k,placeholder:d,defaultValue:b,disabled:v}),"textarea"==h&&e("textarea",{id:s,name:s,onBlur:k,placeholder:d,defaultValue:b,disabled:v,ref:m})]}),e(r,{ref:j,mobileSize:10,desktopSize:10,tag:"p",fontWeight:400,color:"#ff3333",lineHeight:"14px",margin:"2px 0 2px"})]})};p.displayName="Input";export{p as Input};
@@ -1 +1 @@
1
- import{jsx as e}from"react/jsx-runtime";import{T as o}from"./TextBox-02rJgu3r.js";import{g as r}from"./getCssVariableStyle-CBKDTT0s.js";import{s as a}from"./style-inject.es-BnTDb6vU.js";var l={n23mLoader:"Loader-module_n23mLoader__stRd6"};a("@layer n23mLoader{.Loader-module_n23mLoader__stRd6{align-items:center;border:1px dashed var(--loader-lc,var(--n23mTextBoxColor,#000));box-sizing:border-box;color:var(--loader-lc,var(--n23mTextBoxColor,#000));display:flex;height:var(--loader-mh,100%);justify-content:center;width:100%}}");const d=({minHeight:a,className:d,loaderColor:t,style:s})=>e("div",{className:[l.n23mLoader,"n23mLoader",d].filter(Boolean).join(" "),style:{...r({"--loader-lc":t,"--loader-mh":a}),...s},children:e(o,{mobileSize:16,desktopSize:16,color:t,children:"Loading..."})});d.displayName="Loader";export{d as L};
1
+ import{jsx as e}from"react/jsx-runtime";import{T as o}from"./TextBox-dHL75Jj9.js";import{g as r}from"./getCssVariableStyle-CBKDTT0s.js";import{s as a}from"./style-inject.es-BnTDb6vU.js";var l={n23mLoader:"Loader-module_n23mLoader__stRd6"};a("@layer n23mLoader{.Loader-module_n23mLoader__stRd6{align-items:center;border:1px dashed var(--loader-lc,var(--n23mTextBoxColor,#000));box-sizing:border-box;color:var(--loader-lc,var(--n23mTextBoxColor,#000));display:flex;height:var(--loader-mh,100%);justify-content:center;width:100%}}");const d=({minHeight:a,className:d,loaderColor:t,style:s})=>e("div",{className:[l.n23mLoader,"n23mLoader",d].filter(Boolean).join(" "),style:{...r({"--loader-lc":t,"--loader-mh":a}),...s},children:e(o,{mobileSize:16,desktopSize:16,color:t,children:"Loading..."})});d.displayName="Loader";export{d as L};
package/lib/Loader.js CHANGED
@@ -1 +1 @@
1
- export{L as Loader}from"./Loader-Bo6bjUUl.js";import"react/jsx-runtime";import"./TextBox-02rJgu3r.js";import"./getCssVariableStyle-CBKDTT0s.js";import"./style-inject.es-BnTDb6vU.js";
1
+ export{L as Loader}from"./Loader-D18j8aqL.js";import"react/jsx-runtime";import"./TextBox-dHL75Jj9.js";import"react";import"./getCssVariableStyle-CBKDTT0s.js";import"./style-inject.es-BnTDb6vU.js";
package/lib/Picture.js CHANGED
@@ -1 +1 @@
1
- import{jsxs as e,jsx as i}from"react/jsx-runtime";import{useState as r}from"react";import{u as t}from"./useWindowSize-CAQRbyxi.js";import{T as o}from"./TextBox-02rJgu3r.js";import{g as a}from"./getCssVariableStyle-CBKDTT0s.js";import{s as c}from"./style-inject.es-BnTDb6vU.js";var d={n23mPictureFigure:"Picture-module_n23mPictureFigure__uStTO",n23mPicture:"Picture-module_n23mPicture__LpndY",border:"Picture-module_border__yjTpQ",loaded:"Picture-module_loaded__fpjpQ"};c("@layer n23mPicture{.Picture-module_n23mPictureFigure__uStTO{margin:0;padding:0}.Picture-module_n23mPicture__LpndY{box-sizing:border-box;display:block;&.Picture-module_border__yjTpQ{border:2px solid var(--picture-bc);padding:5px}& img{display:grid;height:auto;max-height:var(--picture-mh,unset);opacity:0;transition:opacity .25s ease-in-out;width:100%}&.Picture-module_loaded__fpjpQ img{opacity:1}}}");const s=({children:c,className:s,style:m,draggable:l=!1,alt:u,src:n,srcDesktop:p,srcMobile:g,ar:_,arMobile:b,arDesktop:h,border:P=!1,borderColor:x="black",loading:f="lazy",srcset:y,sizes:j,maxHeight:S,maxHeightMobile:z,maxHeightDesktop:k,figcaption:w,figcaptionColor:T,...F})=>{const[Q,v]=r(!1),{width:C}=t();return e("figure",{className:d.n23mPictureFigure,children:[e("picture",{className:[d.n23mPicture,"n23mPicture",P&&d.border,Q&&d.loaded,s].filter(Boolean).join(" "),...F,style:{...a({"--picture-bc":x,"--picture-mh":k||z?z&&C<767.98?z:k||z:S}),...m},children:[p&&i("source",{media:"(min-width: 768px)",srcSet:p}),g&&i("source",{media:"(max-width: 767.98px)",srcSet:g}),i("img",{sizes:j,srcSet:y,width:h||b?b&&C<767.98?b:h||b:_,height:1,src:p||g||n||"",alt:u,loading:f,onLoad:()=>v(!0),draggable:l})]}),w&&i("figcaption",{children:i(o,{tag:"p",desktopSize:12,mobileSize:12,color:T,margin:"3px 0 3px 0",children:w})})]})};export{s as Picture};
1
+ import{jsxs as e,jsx as i}from"react/jsx-runtime";import{useState as r}from"react";import{u as t}from"./useWindowSize-CAQRbyxi.js";import{T as o}from"./TextBox-dHL75Jj9.js";import{g as a}from"./getCssVariableStyle-CBKDTT0s.js";import{s as c}from"./style-inject.es-BnTDb6vU.js";var d={n23mPictureFigure:"Picture-module_n23mPictureFigure__uStTO",n23mPicture:"Picture-module_n23mPicture__LpndY",border:"Picture-module_border__yjTpQ",loaded:"Picture-module_loaded__fpjpQ"};c("@layer n23mPicture{.Picture-module_n23mPictureFigure__uStTO{margin:0;padding:0}.Picture-module_n23mPicture__LpndY{box-sizing:border-box;display:block;&.Picture-module_border__yjTpQ{border:2px solid var(--picture-bc);padding:5px}& img{display:grid;height:auto;max-height:var(--picture-mh,unset);opacity:0;transition:opacity .25s ease-in-out;width:100%}&.Picture-module_loaded__fpjpQ img{opacity:1}}}");const s=({children:c,className:s,style:m,draggable:l=!1,alt:u,src:n,srcDesktop:p,srcMobile:g,ar:_,arMobile:b,arDesktop:h,border:P=!1,borderColor:x="black",loading:f="lazy",srcset:y,sizes:j,maxHeight:S,maxHeightMobile:z,maxHeightDesktop:k,figcaption:w,figcaptionColor:T,...F})=>{const[Q,v]=r(!1),{width:C}=t();return e("figure",{className:d.n23mPictureFigure,children:[e("picture",{className:[d.n23mPicture,"n23mPicture",P&&d.border,Q&&d.loaded,s].filter(Boolean).join(" "),...F,style:{...a({"--picture-bc":x,"--picture-mh":k||z?z&&C<767.98?z:k||z:S}),...m},children:[p&&i("source",{media:"(min-width: 768px)",srcSet:p}),g&&i("source",{media:"(max-width: 767.98px)",srcSet:g}),i("img",{sizes:j,srcSet:y,width:h||b?b&&C<767.98?b:h||b:_,height:1,src:p||g||n||"",alt:u,loading:f,onLoad:()=>v(!0),draggable:l})]}),w&&i("figcaption",{children:i(o,{tag:"p",desktopSize:12,mobileSize:12,color:T,margin:"3px 0 3px 0",children:w})})]})};export{s as Picture};
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-DkT8Jc4j.js";import{u as s}from"./useWindowSize-CAQRbyxi.js";import{a,I as c}from"./IconArrowRight-Bs6HQ5lc.js";import{L as m}from"./Loader-Bo6bjUUl.js";import{T as u}from"./TextBox-02rJgu3r.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 A=(y-C*(W-1))/W;let I=h?[...S(v,v.length,!1,1),...S(v,v.length,!1,2),...v,...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)*(A+C-i)+(y-(A-l)*W-C*(W-1))/2;e.style.transition=T?H:"none",e.style.transform=`translateX(${n}px)`})},[F,y,T,I.length,W,A,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,I.length,f]);const J=()=>{T||($(!0),L(e=>e+U))},O=()=>{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)?O():z<-50&&!(T||!h&&F+W>=v.length)&&J(),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)?O():z<-50&&!(T||!h&&F+W>=v.length)&&J(),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:I.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(${A}px - 40px)`:2===W?`calc(${A}px - 20px)`:3===W?`calc(${A}px - 12.5px)`:4===W?`calc(${A}px - 10px)`:`${A}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:O,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:J,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-DTuQbzsZ.js";import{u as s}from"./useWindowSize-CAQRbyxi.js";import{a,I as c}from"./IconArrowRight-Bs6HQ5lc.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 A=(y-C*(W-1))/W;let I=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)*(A+C-i)+(y-(A-l)*W-C*(W-1))/2;e.style.transition=T?H:"none",e.style.transform=`translateX(${n}px)`})},[F,y,T,I.length,W,A,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,I.length,f]);const J=()=>{T||($(!0),L(e=>e+U))},O=()=>{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)?O():z<-50&&!(T||!h&&F+W>=v.length)&&J(),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)?O():z<-50&&!(T||!h&&F+W>=v.length)&&J(),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:I.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(${A}px - 40px)`:2===W?`calc(${A}px - 20px)`:3===W?`calc(${A}px - 12.5px)`:4===W?`calc(${A}px - 10px)`:`${A}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:O,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:J,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-DkT8Jc4j.js";import{u}from"./useWindowSize-CAQRbyxi.js";import{a as d,I as g}from"./IconArrowRight-Bs6HQ5lc.js";import{g as m}from"./getCssVariableStyle-CBKDTT0s.js";import{s as f}from"./style-inject.es-BnTDb6vU.js";import"./Loader-Bo6bjUUl.js";import"./TextBox-02rJgu3r.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-gap);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:_})=>{const v={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([])},L=t.toArray(f),k=L.length,x=w?L.map((r,e)=>n(r,{key:`cb-${e}`})):[],y=w?L.map((r,e)=>n(r,{key:`ca-${e}`})):[],C=w?[...x,...L,...y]:L,[M,A]=o([]),{width:D}=u();i(()=>{if(!v.carousel.current)return;const r=v.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&&v.carousel.current&&I.length&&(v.carousel.current.scrollLeft=(I[k]||0)-2*Number(p.slice(0,-2))),j()},[D,I,k,w]),i(()=>{R(!1)},[]),i(()=>{if(!w)return;if(!b)return void(v.animationFrameId.current&&(cancelAnimationFrame(v.animationFrameId.current),v.animationFrameId.current=null));let r;const e=()=>{if(!v.carousel.current)return;if(v.isSliding.current||v.isHovered.current)return void(v.animationFrameId.current=requestAnimationFrame(e));const r=v.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+L.length]||r;l>t+M[0]/2&&(l-=t-e)}r.scrollLeft=l,j(),v.animationFrameId.current=requestAnimationFrame(e)};return r=setTimeout(()=>{v.animationFrameId.current=requestAnimationFrame(e)},500),()=>{r&&clearTimeout(r),v.animationFrameId.current&&(cancelAnimationFrame(v.animationFrameId.current),v.animationFrameId.current=null)}},[b,F,w,I,M,k,L.length]);const j=()=>{if(v.carousel.current){if(w)v.showArrowLeft.current=!0,v.showArrowRight.current=!0;else{const r=v.carousel.current.scrollLeft,e=v.carousel.current.scrollWidth-v.carousel.current.clientWidth;v.showArrowLeft.current=r>0,v.showArrowRight.current=r<e-1}R(v.isSliding.current)}},R=r=>{v.buttonLeft.current&&(v.buttonLeft.current.disabled=r||!v.showArrowLeft.current),v.buttonRight.current&&(v.buttonRight.current.disabled=r||!v.showArrowRight.current)},W=(r,e,l=300)=>{if(v.isSliding.current)return;v.isSliding.current=!0,R(!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):(v.isSliding.current=!1,R(!1),j())};requestAnimationFrame(i)},N=s(()=>{if(!v.carousel.current)return;if(!I.length||!M.length)return;const r=v.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)}W(v.carousel.current,s,400)},[I,M,p,k,w,L.length]),B=s(()=>{if(!v.carousel.current)return;if(!I.length||!M.length)return;const r=v.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))}W(v.carousel.current,c,400)},[I,M,p,k,w]),T=()=>{v.carousel.current&&(v.drag.current.isDragging?v.carousel.current.classList.add(h.dragging):v.carousel.current.classList.remove(h.dragging))};return r("div",{className:["n23mSliderScroll",S].filter(Boolean).join(" "),style:{...m({"--sliderscroll-gap":p,height:"calc(100% - 60px)"}),..._},onMouseEnter:()=>{v.isHovered.current=!0},onMouseLeave:()=>{v.isHovered.current=!1},children:[e("div",{className:[h.n23mSliderScrollWrapper,"n23mSliderScrollWrapper"].join(" "),children:e("div",{className:h.n23mSliderScrollTrack,ref:v.carousel,onClick:r=>{v.drag.current.isMove&&(r.preventDefault(),r.stopPropagation())},onScroll:()=>{if(v.carousel.current){if(w&&I.length&&M.length){const r=v.carousel.current.scrollLeft,e=I[I.length-1]+(M[M.length-1]||0),l=I[k]||0,t=I[k+L.length]||e;r<l-M[0]/2?v.carousel.current.scrollLeft=r+(I[L.length+k]-l):r>t+M[0]/2&&(v.carousel.current.scrollLeft=r-(t-l))}j()}},onMouseDown:r=>{v.drag.current.isDown=!0,v.drag.current.startX=r.pageX-(v.carousel.current?.offsetLeft||0),v.drag.current.scrollLeft=v.carousel.current?.scrollLeft||0,v.drag.current.isDragging=!0,T()},onMouseLeave:()=>{v.drag.current.isDown&&(v.drag.current.isDown=!1,v.drag.current.isDragging=!1,T())},onMouseUp:()=>{v.drag.current.isDown=!1,v.drag.current.isDragging=!1,T()},onMouseMove:r=>{if(!v.drag.current.isDown)return void(v.drag.current.isMove=!1);r.preventDefault();var e;const l=("pageX"in(e=r)?e.pageX:"touches"in e?e.touches[0].pageX:0)-(v.carousel.current?.offsetLeft||0)-v.drag.current.startX;Math.abs(l)>5&&(v.drag.current.isMove=!0),v.carousel.current&&(v.carousel.current.scrollLeft=v.drag.current.scrollLeft-l,j())},children:C.map((r,l)=>e("div",{ref:r=>{v.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:v.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:v.buttonRight,height:"50px",width:"50px",backgroundColor:"#F2F0EF",padding:0,title:"Next",onClick:N,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-DTuQbzsZ.js";import{u}from"./useWindowSize-CAQRbyxi.js";import{a as d,I as g}from"./IconArrowRight-Bs6HQ5lc.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-gap);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:_})=>{const v={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([])},L=t.toArray(f),k=L.length,x=w?L.map((r,e)=>n(r,{key:`cb-${e}`})):[],y=w?L.map((r,e)=>n(r,{key:`ca-${e}`})):[],C=w?[...x,...L,...y]:L,[M,A]=o([]),{width:D}=u();i(()=>{if(!v.carousel.current)return;const r=v.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&&v.carousel.current&&I.length&&(v.carousel.current.scrollLeft=(I[k]||0)-2*Number(p.slice(0,-2))),j()},[D,I,k,w]),i(()=>{R(!1)},[]),i(()=>{if(!w)return;if(!b)return void(v.animationFrameId.current&&(cancelAnimationFrame(v.animationFrameId.current),v.animationFrameId.current=null));let r;const e=()=>{if(!v.carousel.current)return;if(v.isSliding.current||v.isHovered.current)return void(v.animationFrameId.current=requestAnimationFrame(e));const r=v.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+L.length]||r;l>t+M[0]/2&&(l-=t-e)}r.scrollLeft=l,j(),v.animationFrameId.current=requestAnimationFrame(e)};return r=setTimeout(()=>{v.animationFrameId.current=requestAnimationFrame(e)},500),()=>{r&&clearTimeout(r),v.animationFrameId.current&&(cancelAnimationFrame(v.animationFrameId.current),v.animationFrameId.current=null)}},[b,F,w,I,M,k,L.length]);const j=()=>{if(v.carousel.current){if(w)v.showArrowLeft.current=!0,v.showArrowRight.current=!0;else{const r=v.carousel.current.scrollLeft,e=v.carousel.current.scrollWidth-v.carousel.current.clientWidth;v.showArrowLeft.current=r>0,v.showArrowRight.current=r<e-1}R(v.isSliding.current)}},R=r=>{v.buttonLeft.current&&(v.buttonLeft.current.disabled=r||!v.showArrowLeft.current),v.buttonRight.current&&(v.buttonRight.current.disabled=r||!v.showArrowRight.current)},W=(r,e,l=300)=>{if(v.isSliding.current)return;v.isSliding.current=!0,R(!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):(v.isSliding.current=!1,R(!1),j())};requestAnimationFrame(i)},N=s(()=>{if(!v.carousel.current)return;if(!I.length||!M.length)return;const r=v.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)}W(v.carousel.current,s,400)},[I,M,p,k,w,L.length]),B=s(()=>{if(!v.carousel.current)return;if(!I.length||!M.length)return;const r=v.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))}W(v.carousel.current,c,400)},[I,M,p,k,w]),T=()=>{v.carousel.current&&(v.drag.current.isDragging?v.carousel.current.classList.add(h.dragging):v.carousel.current.classList.remove(h.dragging))};return r("div",{className:["n23mSliderScroll",S].filter(Boolean).join(" "),style:{...m({"--sliderscroll-gap":p,height:"calc(100% - 60px)"}),..._},onMouseEnter:()=>{v.isHovered.current=!0},onMouseLeave:()=>{v.isHovered.current=!1},children:[e("div",{className:[h.n23mSliderScrollWrapper,"n23mSliderScrollWrapper"].join(" "),children:e("div",{className:h.n23mSliderScrollTrack,ref:v.carousel,onClick:r=>{v.drag.current.isMove&&(r.preventDefault(),r.stopPropagation())},onScroll:()=>{if(v.carousel.current){if(w&&I.length&&M.length){const r=v.carousel.current.scrollLeft,e=I[I.length-1]+(M[M.length-1]||0),l=I[k]||0,t=I[k+L.length]||e;r<l-M[0]/2?v.carousel.current.scrollLeft=r+(I[L.length+k]-l):r>t+M[0]/2&&(v.carousel.current.scrollLeft=r-(t-l))}j()}},onMouseDown:r=>{v.drag.current.isDown=!0,v.drag.current.startX=r.pageX-(v.carousel.current?.offsetLeft||0),v.drag.current.scrollLeft=v.carousel.current?.scrollLeft||0,v.drag.current.isDragging=!0,T()},onMouseLeave:()=>{v.drag.current.isDown&&(v.drag.current.isDown=!1,v.drag.current.isDragging=!1,T())},onMouseUp:()=>{v.drag.current.isDown=!1,v.drag.current.isDragging=!1,T()},onMouseMove:r=>{if(!v.drag.current.isDown)return void(v.drag.current.isMove=!1);r.preventDefault();var e;const l=("pageX"in(e=r)?e.pageX:"touches"in e?e.touches[0].pageX:0)-(v.carousel.current?.offsetLeft||0)-v.drag.current.startX;Math.abs(l)>5&&(v.drag.current.isMove=!0),v.carousel.current&&(v.carousel.current.scrollLeft=v.drag.current.scrollLeft-l,j())},children:C.map((r,l)=>e("div",{ref:r=>{v.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:v.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:v.buttonRight,height:"50px",width:"50px",backgroundColor:"#F2F0EF",padding:0,title:"Next",onClick:N,borderColor:"black",backgroundColorDisabled:"#F2F0EF",children:e(g,{width:24,height:24})})]})})]})};S.displayName="SliderScroll";export{S as SliderScroll};
@@ -0,0 +1 @@
1
+ import{jsx as t}from"react/jsx-runtime";import{forwardRef as e}from"react";import{g as o}from"./getCssVariableStyle-CBKDTT0s.js";import{s as x}from"./style-inject.es-BnTDb6vU.js";var a={n23mTextBox:"TextBox-module_n23mTextBox__OqCdY",n23mTextBoxLink:"TextBox-module_n23mTextBoxLink__zOG7Z"};x("@layer n23mTextBox{.TextBox-module_n23mTextBox__OqCdY{--mob:var(--textbox-ms);--des:var(--textbox-ds);--min:400;--max:1400;--tff:-apple-system,BlinkMacSystemFont,avenir next,avenir,segoe ui,helvetica neue,helvetica,Cantarell,Ubuntu,roboto,noto,arial,sans-serif;--cmn:min(var(--mob),var(--des));--cmx:max(var(--mob),var(--des));--fss:var(--mob);--fes:var(--des);--sdf:calc(var(--fes) - var(--fss));--vpr:calc(var(--max) - var(--min));--slp:calc(var(--sdf)/var(--vpr));--int:calc(var(--fss) - var(--slp)*var(--min));font-family:var(--n23mFontFamily,var(--tff));font-size:clamp(calc(var(--cmn)/16*1rem),calc(var(--slp)*100vw + var(--int)/16*1rem),calc(var(--cmx)/16*1rem));line-height:var(--textbox-lh,var(--n23mTextBoxLineHeight,1.42857));margin:var(--textbox-m,var(--n23mTextBoxMargin));text-align:var(--textbox-a)}.TextBox-module_n23mTextBoxLink__zOG7Z,.TextBox-module_n23mTextBox__OqCdY{text-wrap:var(--textbox-w);color:var(--textbox-c,var(--n23mTextBoxColor));font-weight:var(--textbox-fw,var(--n23mTextBoxFontWeight))}.TextBox-module_n23mTextBoxLink__zOG7Z{text-align:var(--text-a,left);text-decoration:unset;transition:all .15s ease-in-out;&:active,&:focus-visible,&:hover{color:var(--textbox-ch,var(--n23mTextBoxColorHover));font-weight:var(--textbox-fwh,var(--n23mTextBoxFontWeightHover,var(--textbox-fw)));text-decoration:underline}}}");const r=e(({tag:e="div",children:x,className:r,target:n,rel:m,mobileSize:i,desktopSize:l,lineHeight:s,color:v,href:c,colorHover:f,margin:b,fontWeight:B,fontWeightHover:T,textAlign:d,textWrap:h,style:g,htmlFor:_,...p},u)=>{let w=e;return c&&(w="a"),t(w,{ref:u,style:{...o({"--textbox-fw":B,"--textbox-fwh":T,"--textbox-ch":f,"--textbox-c":v,"--textbox-ms":i,"--textbox-ds":l,"--textbox-lh":s,"--textbox-a":d,"--textbox-w":h,"--textbox-m":b}),...g},className:[a.n23mTextBox,"n23mTextBox",""+(c?`${a.n23mTextBoxLink} n23mTextBoxLink`:""),r].filter(Boolean).join(" "),...c?{href:c,target:n,rel:m}:{},..._?{htmlFor:_}:{},...p,children:x})});r.displayName="TextBox";export{r as T};
package/lib/Textbox.js CHANGED
@@ -1 +1 @@
1
- export{T as TextBox}from"./TextBox-02rJgu3r.js";import"react/jsx-runtime";import"./getCssVariableStyle-CBKDTT0s.js";import"./style-inject.es-BnTDb6vU.js";
1
+ export{T as TextBox}from"./TextBox-dHL75Jj9.js";import"react/jsx-runtime";import"react";import"./getCssVariableStyle-CBKDTT0s.js";import"./style-inject.es-BnTDb6vU.js";
@@ -0,0 +1 @@
1
+ const e={empty:e=>""===e.trim()||null===e.trim()?"The field cannot be empty.":null,email:e=>/^(?!.*\.{2})(?!.*\.$)(?!^\.)([a-zA-Z0-9._%+-]+)@([a-zA-Z0-9.-]+\.[a-zA-Z]{2,})$/.test(e)?null:"Incorrect email address.",numberInRange:(e,t)=>{const n=Number(e),l=t?.min??0,a=t?.max??1e4;return isNaN(n)||n<l||n>a?`The number must be between ${l} and ${a}.`:null},date:e=>(e=>{const t="string"==typeof e?new Date(e):e,n=t.getFullYear(),l=t.getMonth(),a=t.getDate();let r=[31,28,31,30,31,30,31,31,30,31,30,31];return(n%400==0||n%100!=0&&n%4==0)&&(r[1]=29),a>0&&a<=r[l]})(e)?null:"The date is invalid."},t=(t,n)=>n.map(n=>"options"in n?e[n.type](t,n.options):e[n.type](t)).filter(e=>null!=e);export{t as validator};
@@ -1,3 +1,4 @@
1
+ import { type ValidatorOptions } from '../validator';
1
2
  interface InputProps extends React.HTMLAttributes<HTMLElement> {
2
3
  style?: React.CSSProperties;
3
4
  name: string;
@@ -10,6 +11,7 @@ interface InputProps extends React.HTMLAttributes<HTMLElement> {
10
11
  inputColor?: string;
11
12
  defaultValue?: string;
12
13
  disabled?: boolean;
14
+ validatorOptions?: ValidatorOptions;
13
15
  kind?: 'input' | 'textarea';
14
16
  onBlur?: (e: React.FocusEvent<HTMLInputElement | HTMLTextAreaElement>) => void;
15
17
  }
@@ -18,5 +18,5 @@ interface TextBoxProps extends React.HTMLAttributes<HTMLDivElement | HTMLAnchorE
18
18
  style?: React.CSSProperties;
19
19
  htmlFor?: string;
20
20
  }
21
- export declare const TextBox: React.FC<TextBoxProps>;
21
+ export declare const TextBox: import("react").ForwardRefExoticComponent<TextBoxProps & import("react").RefAttributes<any>>;
22
22
  export {};
@@ -0,0 +1,3 @@
1
+ import { type ValidatorOptions, validator } from './validator';
2
+ export { validator };
3
+ export type { ValidatorOptions };
@@ -0,0 +1,16 @@
1
+ type ValidatorOption = {
2
+ type: 'empty';
3
+ } | {
4
+ type: 'email';
5
+ } | {
6
+ type: 'numberInRange';
7
+ options?: {
8
+ min?: number;
9
+ max?: number;
10
+ };
11
+ } | {
12
+ type: 'date';
13
+ };
14
+ export type ValidatorOptions = ValidatorOption[];
15
+ export declare const validator: (value: string, validatorOptions: ValidatorOptions) => string[];
16
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "najwer23morsels",
3
- "version": "0.14.0",
3
+ "version": "0.14.2",
4
4
  "main": "./lib/index.js",
5
5
  "module": "./lib/index.mjs",
6
6
  "types": "./lib/index.d.ts",
@@ -1 +0,0 @@
1
- import{jsx as t}from"react/jsx-runtime";import{g as e}from"./getCssVariableStyle-CBKDTT0s.js";import{s as o}from"./style-inject.es-BnTDb6vU.js";var x={n23mTextBox:"TextBox-module_n23mTextBox__OqCdY",n23mTextBoxLink:"TextBox-module_n23mTextBoxLink__zOG7Z"};o("@layer n23mTextBox{.TextBox-module_n23mTextBox__OqCdY{--mob:var(--textbox-ms);--des:var(--textbox-ds);--min:400;--max:1400;--tff:-apple-system,BlinkMacSystemFont,avenir next,avenir,segoe ui,helvetica neue,helvetica,Cantarell,Ubuntu,roboto,noto,arial,sans-serif;--cmn:min(var(--mob),var(--des));--cmx:max(var(--mob),var(--des));--fss:var(--mob);--fes:var(--des);--sdf:calc(var(--fes) - var(--fss));--vpr:calc(var(--max) - var(--min));--slp:calc(var(--sdf)/var(--vpr));--int:calc(var(--fss) - var(--slp)*var(--min));font-family:var(--n23mFontFamily,var(--tff));font-size:clamp(calc(var(--cmn)/16*1rem),calc(var(--slp)*100vw + var(--int)/16*1rem),calc(var(--cmx)/16*1rem));line-height:var(--textbox-lh,var(--n23mTextBoxLineHeight,1.42857));margin:var(--textbox-m,var(--n23mTextBoxMargin));text-align:var(--textbox-a)}.TextBox-module_n23mTextBoxLink__zOG7Z,.TextBox-module_n23mTextBox__OqCdY{text-wrap:var(--textbox-w);color:var(--textbox-c,var(--n23mTextBoxColor));font-weight:var(--textbox-fw,var(--n23mTextBoxFontWeight))}.TextBox-module_n23mTextBoxLink__zOG7Z{text-align:var(--text-a,left);text-decoration:unset;transition:all .15s ease-in-out;&:active,&:focus-visible,&:hover{color:var(--textbox-ch,var(--n23mTextBoxColorHover));font-weight:var(--textbox-fwh,var(--n23mTextBoxFontWeightHover,var(--textbox-fw)));text-decoration:underline}}}");const a=({tag:o="div",children:a,className:r,target:n,rel:m,mobileSize:i,desktopSize:l,lineHeight:s,color:v,href:c,colorHover:f,margin:b,fontWeight:B,fontWeightHover:T,textAlign:d,textWrap:h,style:g,htmlFor:_,...p})=>{let u=o;return c&&(u="a"),t(u,{style:{...e({"--textbox-fw":B,"--textbox-fwh":T,"--textbox-ch":f,"--textbox-c":v,"--textbox-ms":i,"--textbox-ds":l,"--textbox-lh":s,"--textbox-a":d,"--textbox-w":h,"--textbox-m":b}),...g},className:[x.n23mTextBox,"n23mTextBox",""+(c?`${x.n23mTextBoxLink} n23mTextBoxLink`:""),r].filter(Boolean).join(" "),...c?{href:c,target:n,rel:m}:{},..._?{htmlFor:_}:{},...p,children:a})};a.displayName="TextBox";export{a as T};