najwer23morsels 0.22.12 → 0.22.14
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/lib/Calendar.js +1 -1
- package/lib/{Input-ByfqJXoM.js → Input-RsQ8pvop.js} +1 -1
- package/lib/Input.js +1 -1
- package/lib/Select.js +1 -1
- package/lib/Validator.js +1 -1
- package/lib/{index-B3t-v1t9.js → index-P_Zi0cEe.js} +1 -1
- package/lib/validator/validator.d.ts +2 -0
- package/package.json +1 -1
package/lib/Calendar.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsxs as e,jsx as a,Fragment as o}from"react/jsx-runtime";import{useRef as l,useState as d,useMemo as n}from"react";import{B as r}from"./Button-DJMC5h72.js";import{I as t,a as i}from"./IconLocate-LfOaIasU.js";import{I as s}from"./Input-
|
|
1
|
+
import{jsxs as e,jsx as a,Fragment as o}from"react/jsx-runtime";import{useRef as l,useState as d,useMemo as n}from"react";import{B as r}from"./Button-DJMC5h72.js";import{I as t,a as i}from"./IconLocate-LfOaIasU.js";import{I as s}from"./Input-RsQ8pvop.js";import{T as p}from"./TextBox-CWSg4nm8.js";import{s as c}from"./style-inject.es-CrVRO2OA.js";import{g as h,a as u,i as m,b as _,c as y,d as v,e as C,f as w}from"./index-P_Zi0cEe.js";import"./Loader-D8OrIi__.js";var b={n23mCalendar:"Calendar-module_n23mCalendar__X8aV3",icon:"Calendar-module_icon__lfFoB",dropdownWrapper:"Calendar-module_dropdownWrapper__nxN2-",open:"Calendar-module_open__wT0yV",dropdown:"Calendar-module_dropdown__cb838",controls:"Calendar-module_controls__-AlZL",controlsDate:"Calendar-module_controlsDate__-SfYh",weekdays:"Calendar-module_weekdays__lNkkR",weekdaysChild:"Calendar-module_weekdaysChild__RdAK-",days:"Calendar-module_days__M9xb4",daysChild:"Calendar-module_daysChild__j3p2m",daysActive:"Calendar-module_daysActive__Y84S9",daysClickable:"Calendar-module_daysClickable__1top5",months:"Calendar-module_months__EvlXR",years:"Calendar-module_years__a49qj",monthsChild:"Calendar-module_monthsChild__abfV1",yearsChild:"Calendar-module_yearsChild__gLEoY"};c("@layer n23mCalendar{.Calendar-module_n23mCalendar__X8aV3{--iff:-apple-system,BlinkMacSystemFont,avenir next,avenir,segoe ui,helvetica neue,helvetica,Cantarell,Ubuntu,roboto,noto,arial,sans-serif;position:relative;& input{cursor:pointer;padding-right:40px}.Calendar-module_icon__lfFoB{background-image:url(\"data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 25 25'%3E%3Cpath fill='%23231f20' d='M22.5 3H21V2a1 1 0 0 0-1-1h-1a1 1 0 0 0-1 1v1h-4V2a1 1 0 0 0-1-1h-1a1 1 0 0 0-1 1v1H7V2a1 1 0 0 0-1-1H5a1 1 0 0 0-1 1v1H2.5A1.5 1.5 0 0 0 1 4.5v18A1.5 1.5 0 0 0 2.5 24h20a1.5 1.5 0 0 0 1.5-1.5v-18A1.5 1.5 0 0 0 22.5 3ZM19 2h1v3h-1Zm-7 0h1v3h-1ZM5 2h1v3H5ZM2.5 4H4v1a1 1 0 0 0 1 1h1a1 1 0 0 0 1-1V4h4v1a1 1 0 0 0 1 1h1a1 1 0 0 0 1-1V4h4v1a1 1 0 0 0 1 1h1a1 1 0 0 0 1-1V4h1.5a.5.5 0 0 1 .5.5V8H2V4.5a.5.5 0 0 1 .5-.5Zm20 19h-20a.5.5 0 0 1-.5-.5V9h21v13.5a.5.5 0 0 1-.5.5Z'/%3E%3C/svg%3E\");background-position:100%;background-position:calc(100% - 10px) 50%;background-repeat:no-repeat;background-size:18px;cursor:pointer;display:inline-block;height:40px;position:absolute;right:2px;top:21px;width:40px}.Calendar-module_dropdownWrapper__nxN2-{background-color:transparent;display:none;margin-top:65px;padding-bottom:40px;position:absolute;top:0;width:318px;z-index:3;&.Calendar-module_open__wT0yV{display:block}.Calendar-module_dropdown__cb838{background:#fff;border:1px solid var(--input-cb,#000);border-radius:5px;box-shadow:0 4px 8px 0 rgba(0,0,0,.24),0 6px 20px 0 rgba(0,0,0,.19);box-sizing:border-box;overflow-y:auto;padding:20px;& .Calendar-module_controls__-AlZL{align-items:center;display:flex;height:40px;justify-content:space-between;padding:0 7px}& .Calendar-module_controlsDate__-SfYh{display:flex;font-family:var(--n23mFontFamily,var(--iff));font-size:20px;justify-content:center}& .Calendar-module_weekdays__lNkkR{display:flex;justify-content:center;width:100%}& .Calendar-module_weekdaysChild__RdAK-{align-items:center;display:flex;font-family:var(--n23mFontFamily,var(--iff));font-size:12px;height:30px;justify-content:center;width:14.28571%}& .Calendar-module_days__M9xb4{display:flex;flex-wrap:wrap;justify-content:flex-start;width:100%}& .Calendar-module_daysChild__j3p2m{font-size:16px}& .Calendar-module_daysChild__j3p2m:nth-child(7n){color:red;font-weight:700}& .Calendar-module_daysActive__Y84S9{background-color:#f2f2f2;border-radius:100%;cursor:pointer}& .Calendar-module_daysClickable__1top5{cursor:pointer}& .Calendar-module_months__EvlXR,& .Calendar-module_years__a49qj{display:flex;flex-wrap:wrap;gap:12px;justify-content:center}& .Calendar-module_monthsChild__abfV1,& .Calendar-module_yearsChild__gLEoY{display:flex;justify-content:center}}}}}");const x=({children:c,name:x,placeholder:g,label:f="Calendar",initialValue:k,onBlur:D,validatorOptions:S,className:F,style:j,...N})=>{const V=l(null),[M,A]=d({value:""==k?"":h(k??new Date),open:!1,dropDwonState:"days"}),E=e=>{A(a=>({...a,value:h(e),open:!0}))},B=e=>{E(C(m(M.value)?M.value:h(new Date),e))},z=e=>{E(v(m(M.value)?M.value:h(new Date),e))},L=n(()=>Array.from({length:7},(e,a)=>new Date(2021,0,(a+4)%7).toLocaleString("en-US",{weekday:"short"})),[]),Z=n(()=>Array.from({length:12},(e,a)=>new Date(2021,a+1,0).toLocaleString("en-US",{month:"short"})),[]),H=u(m(M.value)?M.value:h(new Date)),R=_(m(M.value)?M.value:h(new Date)),Y=m(M.value)?new Date(M.value):new Date,T=Y.getFullYear(),I=Y.getMonth(),P=Y.getDate();return e("div",{className:[b.n23mCalendar,"n23mCalendar",F].filter(Boolean).join(" "),...N,style:{...j},children:[a("div",{className:b.icon,onMouseDown:e=>{e.preventDefault(),V.current?.focus(),A(e=>({...e,value:"",open:!e.open,dropDwonState:"days"}))}}),a(s,{inputRef:V,label:f,type:"text",kind:"input",name:x,autoComplete:"off",placeholder:g,onChange:e=>{const a=e.currentTarget.value;A(e=>({...e,value:a}))},onBlur:e=>{A(e=>({...e,open:!1})),D?.(e)},onClick:()=>A(e=>({...e,value:"",open:!0,dropDwonState:"days"})),value:M.value,validatorOptions:[...S??[],{type:"date"}],className:b.arrowUp,"aria-expanded":M.open,role:"combobox"}),a("div",{className:[b.dropdownWrapper,M.open?b.open:""].join(" "),children:e("div",{className:[b.dropdown].join(" "),onMouseDown:e=>e.preventDefault(),children:["years"===M.dropDwonState&&e(o,{children:[e("div",{className:b.controls,style:{marginBottom:"10px"},children:[a("div",{style:{width:"30px"},children:a(r,{type:"button",padding:"3px 0 0 0",height:"30px",width:"30px",title:"Prev Month",backgroundColor:"#F2F0EF",borderColor:"black",onClick:()=>z(T-9),children:a(t,{color:"black",height:22,width:22})})}),a("div",{style:{width:"60%"},className:b.controlsDate,children:a("div",{style:{cursor:"pointer"},onClick:()=>A(e=>({...e,dropDwonState:"days"})),children:T})}),a("div",{style:{width:"30px"},children:a(r,{type:"button",padding:"3px 0 0 0",height:"30px",width:"30px",title:"Prev Month",backgroundColor:"#F2F0EF",borderColor:"black",onClick:()=>z(T+9),children:a(i,{color:"black",height:22,width:22})})})]}),a("div",{className:b.years,children:R.map(e=>a("div",{className:b.yearsChild,children:a(r,{type:"button",height:"40px",width:"80px",color:"black",backgroundColor:T==e?"white":"#F2F0EF",borderColor:"black",title:"year",onClick:()=>{z(e),A(e=>({...e,dropDwonState:"days"}))},children:a(p,{mobileSize:14,desktopSize:14,children:e})},e+M.value)},e+M.value))})]}),"months"===M.dropDwonState&&a("div",{className:b.months,children:Z.map((e,o)=>a("div",{className:b.monthsChild,children:a(r,{type:"button",height:"40px",width:"80px",backgroundColor:I==o?"white":"#F2F0EF",borderColor:"black",title:"month",onClick:()=>{B(o-I),A(e=>({...e,dropDwonState:"days"}))},children:a(p,{mobileSize:14,desktopSize:14,children:e})},e+M.value)},e+M.value))}),"days"===M.dropDwonState&&e(o,{children:[e("div",{className:b.controls,children:[a("div",{style:{width:"30px"},children:a(r,{type:"button",padding:"3px 0 0 0",height:"30px",width:"30px",title:"Prev Month",backgroundColor:"#F2F0EF",borderColor:"black",onClick:()=>B(-1),children:a(t,{color:"black",height:22,width:22})})}),e("div",{style:{width:"60%"},className:b.controlsDate,children:[a("div",{style:{cursor:"pointer"},onClick:()=>A(e=>({...e,dropDwonState:"years"})),children:T}),a("div",{children:"-"}),a("div",{style:{cursor:"pointer"},onClick:()=>A(e=>({...e,dropDwonState:"months"})),children:String(I+1).padStart(2,"0")}),a("div",{children:"-"}),a("div",{children:String(P).padStart(2,"0")})]}),a("div",{style:{width:"30px"},children:a(r,{type:"button",padding:"3px 0 0 0",height:"30px",width:"30px",title:"Prev Month",backgroundColor:"#F2F0EF",borderColor:"black",onClick:()=>B(1),children:a(i,{color:"black",height:22,width:22})})})]}),a("div",{className:b.weekdays,children:L.map(e=>a("div",{className:b.weekdaysChild,children:e},e))}),a("div",{className:b.days,children:H.map(e=>a("div",{className:[b.weekdaysChild,b.daysChild,"active"==e.cssClass&&b.daysActive,"clickable"==e.cssClass&&b.daysClickable].join(" "),onMouseDown:()=>{var a;e.day>0&&(a=e.day,E(w(m(M.value)?M.value:h(new Date),a))),A(e=>({...e,open:!1})),setTimeout(()=>{V.current?.blur()})},children:e.day<=0||e.day>y(M.value)?" ":e.day},e.day+M.value))})]})]})})]})};x.displayName="Calendar";export{x as Calendar};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsxs as e,jsx as t}from"react/jsx-runtime";import{useRef as n}from"react";import{T as r}from"./TextBox-CWSg4nm8.js";import{s as a,g as o}from"./style-inject.es-CrVRO2OA.js";import{v as i}from"./index-
|
|
1
|
+
import{jsxs as e,jsx as t}from"react/jsx-runtime";import{useRef as n}from"react";import{T as r}from"./TextBox-CWSg4nm8.js";import{s as a,g as o}from"./style-inject.es-CrVRO2OA.js";import{v as i}from"./index-P_Zi0cEe.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-top:0;&:not(:has(input[type=hidden])){margin-bottom:10px}.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}&input[type=hidden]{margin:0;padding:0}& ::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:u,label:s,inputRef:d,placeholder:m,type:c="text",labelColor:f="black",kind:h="input",inputColor:g,inputColorBorder:x,defaultValue:v,disabled:b,validatorOptions:I,value:y,autoComplete:_,id:C,onBlur:k,onChange:j,...z})=>{const w=n(null),B=e=>{k?.(e);const t=e.target;if(document.activeElement!==t&&(w.current&&(w.current.textContent=""),I)){const e=i(t.value,I);e.length>0?(w.current&&(w.current.textContent=e[0]),t.classList.add("error")):t.classList.remove("error")}},S=e=>{j?.(e)};return e("div",{className:[l.n23mInput,"n23mInput",a].filter(Boolean).join(" "),...z,style:{...o({"--input-c":g,"--input-cb":x}),...p},children:["hidden"!==c&&t(r,{mobileSize:14,desktopSize:14,tag:"label",fontWeight:400,color:f,htmlFor:"select"==h?C:u,children:s}),e("div",{className:l.n23mInputInput,children:["input"===h&&t("input",{ref:d,id:u,name:u,type:c,onBlur:B,onChange:S,placeholder:m,defaultValue:v,disabled:b,value:y,autoComplete:_}),"textarea"===h&&t("textarea",{autoComplete:_,id:u,name:u,onBlur:B,onChange:S,placeholder:m,defaultValue:v,disabled:b,value:y,ref:d}),"select"===h&&t("input",{id:C,autoComplete:"off",ref:d,type:c,onBlur:B,onChange:S,placeholder:m,defaultValue:v,disabled:b,value:y})]}),"hidden"!==c&&t(r,{ref:w,mobileSize:12,desktopSize:12,tag:"p",fontWeight:400,color:"#ff3333",lineHeight:"14px",margin:"2px 0 2px"})]})};p.displayName="Input";export{p as I};
|
package/lib/Input.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{I as Input}from"./Input-
|
|
1
|
+
export{I as Input}from"./Input-RsQ8pvop.js";import"react/jsx-runtime";import"react";import"./TextBox-CWSg4nm8.js";import"./style-inject.es-CrVRO2OA.js";import"./index-P_Zi0cEe.js";
|
package/lib/Select.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsxs as e,jsx as o}from"react/jsx-runtime";import{useState as t,useRef as n,useId as r,useMemo as l}from"react";import{I as a}from"./Input-
|
|
1
|
+
import{jsxs as e,jsx as o}from"react/jsx-runtime";import{useState as t,useRef as n,useId as r,useMemo as l}from"react";import{I as a}from"./Input-RsQ8pvop.js";import{s as i}from"./style-inject.es-CrVRO2OA.js";import"./TextBox-CWSg4nm8.js";import"./index-P_Zi0cEe.js";var s={n23mSelect:"Select-module_n23mSelect__2Xjs2",icon:"Select-module_icon__EyueR",iconRotate:"Select-module_iconRotate__IuY-d",dropdownWrapper:"Select-module_dropdownWrapper__4xq1b",open:"Select-module_open__r2R21",dropdown:"Select-module_dropdown__cDzJX",dropdownItem:"Select-module_dropdownItem__RBpMK"};i('@layer n23mSelect{.Select-module_n23mSelect__2Xjs2{--iff:-apple-system,BlinkMacSystemFont,avenir next,avenir,segoe ui,helvetica neue,helvetica,Cantarell,Ubuntu,roboto,noto,arial,sans-serif;position:relative;& input{cursor:pointer;padding-right:40px}.Select-module_icon__EyueR{-webkit-touch-callout:none;-webkit-tap-highlight-color:rgba(0,0,0,0);background:url(\'data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" width="256" height="256" xml:space="preserve"><g style="stroke:none;stroke-width:1px;fill-rule:nonzero;opacity:1"><path d="M90 24.25a3.499 3.499 0 0 0-5.974-2.475L45 60.8 5.975 21.775a3.5 3.5 0 1 0-4.95 4.95l41.5 41.5a3.499 3.499 0 0 0 4.949 0l41.5-41.5A3.487 3.487 0 0 0 90 24.25z" style="stroke:none;stroke-width:1" transform="matrix(2.81 0 0 2.81 1.407 1.407)"/></g></svg>\') no-repeat 100%;background-position:calc(100% - 10px) 50%;background-size:18px;cursor:pointer;display:inline-block;height:40px;position:absolute;right:2px;top:22px;transform:rotate(0deg);transition:transform .1s ease-in-out;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;width:40px;&.Select-module_iconRotate__IuY-d{transform:rotate(180deg);transition:transform .1s ease-in-out}}.Select-module_dropdownWrapper__4xq1b{background:transparent;border-radius:5px;display:none;margin-top:65px;padding-bottom:40px;position:absolute;top:0;width:100%;z-index:3;&.Select-module_open__r2R21{display:block}.Select-module_dropdown__cDzJX{-webkit-touch-callout:none;-webkit-tap-highlight-color:rgba(0,0,0,0);background:#fff;border-radius:5px;box-shadow:0 4px 8px 0 rgba(0,0,0,.24),0 6px 20px 0 rgba(0,0,0,.19);cursor:pointer;max-height:200px;overflow-y:auto;overscroll-behavior:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;&:has(.Select-module_dropdownItem__RBpMK){border:1px solid var(--input-cb,#000)}.Select-module_dropdownItem__RBpMK{background:#fff;border-bottom:1px solid var(--input-cb,#000);box-sizing:border-box;color:var(--input-c,#000);font-family:var(--n23mFontFamily,var(--iff));font-size:16px;font-weight:500;padding:10px;width:100%;&:hover{background-color:#f5f5f5}&:not(:first-child){border-top:none}&:last-child{border-bottom:unset}}}}}}');const d=({className:i,name:d,disabled:p,style:c,options:u,initialValue:m,validatorOptions:b,placeholder:h,onBlur:_,label:x="Select",...g})=>{const[v,f]=t(m?.label??""),[w,k]=t(m?.value??""),[y,S]=t(!1),j=n(null),R=r(),I=l(()=>u.filter(e=>e.label.toLowerCase().includes(v.toLowerCase())),[u,v]),z=()=>{S(e=>!e),f(""),k("")};return e("div",{className:[s.n23mSelect,"n23mSelect",i].filter(Boolean).join(" "),...g,style:{...c},children:[o("div",{className:[s.icon,y?s.iconRotate:""].join(" "),onMouseDown:e=>{e.preventDefault(),j.current?.focus(),z()}}),o(a,{name:d,type:"hidden",kind:"input",validatorOptions:[...b??[],{type:"existsInOptions",options:{options:u,matchBy:"value"}}],value:w}),o(a,{id:R,inputRef:j,label:x,type:"text",kind:"select",disabled:p,placeholder:h,value:v,onChange:e=>{const o=e.currentTarget.value;f(o),k(""),S(!0)},onClick:z,onBlur:e=>{S(!1),_?.(e,{value:w,label:v})},validatorOptions:[...b??[],{type:"existsInOptions",options:{options:u,matchBy:"label"}}],"aria-autocomplete":"list","aria-expanded":y,"aria-controls":`${d}-listbox`,role:"combobox"}),o("div",{className:[s.dropdownWrapper,y?s.open:""].join(" "),children:o("div",{className:[s.dropdown].join(" "),children:I.map(e=>o("div",{className:s.dropdownItem,onMouseDown:()=>{(e=>{k(e.value),f(e.label),S(!1)})(e)},children:e.label},e.value))})})]})};export{d as Select};
|
package/lib/Validator.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{v as validator}from"./index-
|
|
1
|
+
export{v as validator}from"./index-P_Zi0cEe.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const t=(t,e,n)=>{const a=new Date(0);return a.setFullYear(t,e,n),a.setHours(0,0,0,0),a},e=(e,n)=>{const a="string"==typeof e?new Date(e):e,r=a.getFullYear(),l=a.getMonth(),s=t(r,l+1,0).getDate(),o=Math.max(1,Math.min(n,s));return t(r,l,o)},n=t=>{const e="string"==typeof t?new Date(t):t,n=e.getFullYear()-4,a=e.getFullYear()+4;return Array.from({length:a-n+1},(t,e)=>n+e).filter(t=>t>=0)},a=(e,n)=>{const a="string"==typeof e?new Date(e):e,r=n,l=a.getMonth(),s=a.getDate();return t(r,l,s)},r=(e,n)=>{const a="string"==typeof e?new Date(e):e,r=a.getFullYear(),l=a.getMonth()+n,s=a.getDate(),o=t(r,l,s);if(o.getDate()!==s){const e=t(r,l+1,0).getDate();return t(r,l,e)}return o},l=e=>{const n="string"==typeof e?new Date(e):e,a=n.getFullYear(),r=n.getMonth();return t(a,r+1,0).getDate()},s=t=>{const e="string"==typeof t?new Date(t):t;return`${String(e.getFullYear()).padStart(4,"0")}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`},o=e=>{const n="string"==typeof e?new Date(e):e,a=n.getDate(),r=((e=>{const n="string"==typeof e?new Date(e):e,a=n.getFullYear(),r=n.getMonth();return t(a,r,1).getDay()})(n)+6)%7,s=l(n);return Array.from({length:s+r},(t,e)=>{let n="",l="";return e<=r-1?(n="",l="blank"):e===a+r-1?(n=String(e-r+1),l="active"):(n=String(e-r+1),l="clickable"),{day:e-r+1,dayValue:n,cssClass:l}})},
|
|
1
|
+
const t=(t,e,n)=>{const a=new Date(0);return a.setFullYear(t,e,n),a.setHours(0,0,0,0),a},e=(e,n)=>{const a="string"==typeof e?new Date(e):e,r=a.getFullYear(),l=a.getMonth(),s=t(r,l+1,0).getDate(),o=Math.max(1,Math.min(n,s));return t(r,l,o)},n=t=>{const e="string"==typeof t?new Date(t):t,n=e.getFullYear()-4,a=e.getFullYear()+4;return Array.from({length:a-n+1},(t,e)=>n+e).filter(t=>t>=0)},a=(e,n)=>{const a="string"==typeof e?new Date(e):e,r=n,l=a.getMonth(),s=a.getDate();return t(r,l,s)},r=(e,n)=>{const a="string"==typeof e?new Date(e):e,r=a.getFullYear(),l=a.getMonth()+n,s=a.getDate(),o=t(r,l,s);if(o.getDate()!==s){const e=t(r,l+1,0).getDate();return t(r,l,e)}return o},l=e=>{const n="string"==typeof e?new Date(e):e,a=n.getFullYear(),r=n.getMonth();return t(a,r+1,0).getDate()},s=t=>{const e="string"==typeof t?new Date(t):t;return`${String(e.getFullYear()).padStart(4,"0")}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`},o=e=>{const n="string"==typeof e?new Date(e):e,a=n.getDate(),r=((e=>{const n="string"==typeof e?new Date(e):e,a=n.getFullYear(),r=n.getMonth();return t(a,r,1).getDay()})(n)+6)%7,s=l(n);return Array.from({length:s+r},(t,e)=>{let n="",l="";return e<=r-1?(n="",l="blank"):e===a+r-1?(n=String(e-r+1),l="active"):(n=String(e-r+1),l="clickable"),{day:e-r+1,dayValue:n,cssClass:l}})},u=t=>{if("string"==typeof t){if(!/^(\d{4})-(\d{2})-(\d{2})$/.exec(t))return!1}const e="string"==typeof t?new Date(t):t,n=e.getFullYear(),a=e.getMonth(),r=e.getDate();let l=[31,28,31,30,31,30,31,31,30,31,30,31];return(n%400==0||n%100!=0&&n%4==0)&&(l[1]=29),r>0&&r<=l[a]&&10==t.length},g={empty:t=>""===t.trim()||null===t.trim()?"The field cannot be empty.":null,email:t=>/^(?!.*\.{2})(?!.*\.$)(?!^\.)([a-zA-Z0-9._%+-]+)@([a-zA-Z0-9.-]+\.[a-zA-Z]{2,})$/.test(t)?null:"Incorrect email address.",numberInRange:(t,e)=>{const n=Number(t),a=e?.min??0,r=e?.max??1e4;return isNaN(n)||n<a||n>r?`The number must be between ${a} and ${r}.`:null},date:t=>u(t)?null:"The date is invalid.",existsInOptions:(t,e)=>{const n=e?.options??[],a=e?.matchBy??"value";return n.some(e=>"value"===a?e.value===t:e.label===t)?null:"Please select a value from the list."},json:t=>{try{const e=JSON.parse(t);return null===e||"object"!=typeof e&&!Array.isArray(e)?"The value must be a valid JSON":null}catch{return"The value must be a valid JSON."}}},i=(t,e)=>e.map(e=>"options"in e?g[e.type](t,e.options):g[e.type](t)).filter(t=>null!=t);export{o as a,n as b,l as c,a as d,r as e,e as f,s as g,u as i,i as v};
|