najwer23morsels 0.22.5 → 0.22.6
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/package.json +1 -1
package/lib/Calendar.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsxs as e,jsx as a,Fragment as l}from"react/jsx-runtime";import{useRef as o,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-ByfqJXoM.js";import{T as c}from"./TextBox-CWSg4nm8.js";import{s as p}from"./style-inject.es-CrVRO2OA.js";import{g as h,a as
|
|
1
|
+
import{jsxs as e,jsx as a,Fragment as l}from"react/jsx-runtime";import{useRef as o,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-ByfqJXoM.js";import{T as c}from"./TextBox-CWSg4nm8.js";import{s as p}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-B3t-v1t9.js";import"./Loader-D8OrIi__.js";var x={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"};p("@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 b=({children:p,name:b,placeholder:g,label:f="Calendar",initialValue:k,onBlur:D,validatorOptions:S,className:F,style:j,...N})=>{const V=o(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:[x.n23mCalendar,"n23mCalendar",F].filter(Boolean).join(" "),...N,style:{...j},children:[a("div",{className:x.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:b,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:x.arrowUp}),a("div",{className:[x.dropdownWrapper,M.open?x.open:""].join(" "),children:e("div",{className:[x.dropdown].join(" "),onMouseDown:e=>e.preventDefault(),children:["years"===M.dropDwonState&&e(l,{children:[e("div",{className:x.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:x.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:x.years,children:R.map(e=>a("div",{className:x.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(c,{mobileSize:14,desktopSize:14,children:e})},e+M.value)},e+M.value))})]}),"months"===M.dropDwonState&&a("div",{className:x.months,children:Z.map((e,l)=>a("div",{className:x.monthsChild,children:a(r,{type:"button",height:"40px",width:"80px",backgroundColor:I==l?"white":"#F2F0EF",borderColor:"black",title:"month",onClick:()=>{B(l-I),A(e=>({...e,dropDwonState:"days"}))},children:a(c,{mobileSize:14,desktopSize:14,children:e})},e+M.value)},e+M.value))}),"days"===M.dropDwonState&&e(l,{children:[e("div",{className:x.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:x.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:x.weekdays,children:L.map(e=>a("div",{className:x.weekdaysChild,children:e},e))}),a("div",{className:x.days,children:H.map(e=>a("div",{className:[x.weekdaysChild,x.daysChild,"active"==e.cssClass&&x.daysActive,"clickable"==e.cssClass&&x.daysClickable].join(" "),onClick:()=>{return e.day>0&&(a=e.day,void E(w(m(M.value)?M.value:h(new Date),a)));var a},children:e.day<=0||e.day>y(M.value)?" ":e.day},e.day+M.value))})]})]})})]})};b.displayName="Calendar";export{b as Calendar};
|