enerdot-front-system 0.0.29-beta.6 → 0.0.29-beta.7
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/dist/index.cjs.js +1 -1
- package/dist/index.es.js +3 -1
- package/package.json +5 -4
package/dist/index.cjs.js
CHANGED
|
@@ -65,7 +65,7 @@ m.version="2.30.1";ic(Q);m.fn=g;m.min=zu;m.max=Zu;m.now=Ju;m.utc=Te;m.unix=Mf;m.
|
|
|
65
65
|
${z?ue.small:ue.large}
|
|
66
66
|
${d&&ue.errorInput}
|
|
67
67
|
${_&&ue.successInput}
|
|
68
|
-
`,style:{paddingRight:(E||20+(M&&p&&24))+"px",fontSize:(z?16:18)+"px"},type:R?"text":t,onChange:ce,value:H?u:"",disabled:f,onFocus:()=>j(!0),onBlur:()=>j(!1),...S}),(e||M)&&o.jsxs("div",{className:`${ue.rightContainer} ${z?ue.small:ue.large}`,style:{fontSize:(z?14:16)+"px"},ref:Y,children:[M&&p&&o.jsx("div",{className:ue.iconButton,onClick:()=>p(S==null?void 0:S.name),onMouseDown:re=>re.preventDefault(),children:o.jsx("div",{className:ue.iconWrapper,children:o.jsx("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:o.jsxs("g",{id:"Frame 48096259",children:[o.jsx("circle",{id:"Ellipse 52",cx:"9",cy:"9",r:"9",fill:"#DADEE5"}),o.jsx("path",{id:"Vector",d:"M5 5L13 13",stroke:"white",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),o.jsx("path",{id:"Vector_2",d:"M13 5L5 13",stroke:"white",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})})})}),e]})]}),d&&o.jsx("label",{className:ue.errorMessage,children:d}),_&&o.jsx("label",{className:ue.successMessage,children:_}),h&&o.jsx("label",{className:ue.guideMessage,children:h})]})},w_=({level:e,dateType:t,onClick:r,format:n,disabled:s,date:a})=>{const i=n==="hyphenFormat"?te:Gn,l=t==="week",u=t==="quarter",f=t==="quarter"?i.year+". Q분기":t==="week"?i.day+" ~ "+i.day:i[t],d=a&&(u?a==null?void 0:a.format(i.year+". "+(a==null?void 0:a.quarter())+"분기"):l?(a==null?void 0:a.format(i.day))+" ~ "+(a==null?void 0:a.clone().add(6,"days").format(i.day)):a==null?void 0:a.format(i[t]));return o.jsx("button",{disabled:s,"aria-label":"input-button",onClick:r,className:qt.inputButton,children:o.jsxs("div",{className:qt.inputWrapper,style:{pointerEvents:s?"none":"auto"},children:[o.jsx(qn,{level:e,placeholder:f,value:d,width:"100%"}),o.jsx("div",{className:qt.iconWrapper,children:o.jsx(Un,{})})]})})},Br=(e,t)=>{const r=[...e],n=[];for(;r.length>0;)n.push(r.splice(0,t));return n},Ta={day:te.month,week:te.month,month:te.year,quarter:te.year,year:te.year},pn=e=>{const t=e.clone().startOf("month"),r=e.clone().endOf("month"),n=t.clone().startOf("week"),a=r.clone().endOf("week").diff(n,"day"),i=[];for(let l=0;l<a+1;l++)i.push(n.clone().add(l,"day"));return Br(i,7)},Ca=e=>{const t=Array.from({length:12},(r,n)=>m(m(e).format(te.year)+`-${n+1}`));return Br(t,3)},k_=e=>{const t=m(e).format(te.year),r=Array.from({length:4},(n,s)=>m(t).add(s*3,"month"));return Br(r,3)},Be=e=>{const t=Number(e.format(te.year)),r=Math.floor(t/10)*10;return m(`${r}`)},Ea=e=>{const t=[];for(let r=0;r<10;r++)t.push(Be(e).clone().add(r,"year"));return Br(t,3)},Pa=({dateType:e,screenDate:t})=>{switch(e){case"day":return t.format("YYYY년 MM월");case"week":return t.format("YYYY년 MM월");case"quarter":return t.format("YYYY년");case"year":return Be(t).format(`YYYY년~${Be(t).add(9,"year").format("YYYY")}년`);default:return t.format("YYYY년")}},S_=(e,t,r)=>{const n=t[0],s=t[1];let a=!1,i;switch(e){case"day":{const l=Math.abs(s.diff(n,"day"))+1;r&&l>r&&(a=!0,i=`최대 ${r}일까지 선택 가능합니다.`);break}case"month":{const l=Math.abs(s.diff(n,"month"))+1;r&&l>r&&(a=!0,i=`최대 ${r}개월까지 선택 가능합니다.`);break}case"year":{const l=Math.abs(s.diff(n,"year"))+1;r&&l>r&&(a=!0,i=`최대 ${r}년까지 선택 가능합니다.`);break}}return{isRangeExceeded:a,errorMessage:i}},M_="_row_1m5wd_1",j_="_navText_1m5wd_8",Y_="_clickableNav_1m5wd_16",O_="_header_1m5wd_27",$_="_headerText_1m5wd_38",R_="_button_1m5wd_46",N_="_circle_1m5wd_64",T_="_box_1m5wd_80",C_="_buttonText_1m5wd_91",E_="_sundayText_1m5wd_97",J={row:M_,navText:j_,clickableNav:Y_,header:O_,headerText:$_,button:R_,circle:N_,box:T_,buttonText:C_,sundayText:E_},wt=te.day,P_=({day:e,minDate:t,maxDate:r,screenMonth:n,selectDate:s,index:a,onChange:i,initialDate:l})=>{const u=a===0,f=e.month()===n.month(),d=l?e.format(wt)===l.format(wt):!1,_=s?s.format(wt)===e.format(wt):!1,h=t.format(wt),x=r.format(wt),p=e.diff(h)<0,S=e.diff(x)>0,M=!f||p||S;return o.jsxs("button",{className:J.button,disabled:M,onClick:()=>i(e),children:[o.jsx("div",{className:u?J.sundayText:J.buttonText,children:e.format("D")}),(d||_)&&o.jsx("div",{className:J.circle,style:{backgroundColor:d?b.blue100:b.blue600,color:d?b.blue600:b.white},children:e.format("D")})]})},kt=te.month,D_=({day:e,minDate:t,maxDate:r,selectDate:n,onChange:s,initialDate:a})=>{const i=n?n.format(kt)===e.format(kt):!1,l=a?e.format(kt)===a.format(kt):!1,u=t.format(kt),f=r.format(kt),d=e.diff(u)<0,_=e.diff(f)>0,h=d||_;return o.jsxs("button",{className:J.button,style:{opacity:h?.3:1,width:`${100/3}%`},disabled:h,onClick:()=>s(e),children:[o.jsx("div",{className:J.buttonText,children:e.format("MM")}),(l||i)&&o.jsx("div",{className:J.circle,style:{backgroundColor:l?b.blue100:b.blue600,color:l?b.blue600:b.white},children:e.format("MM")})]})},ln=te.day,yr=te.month,$s=te.year,cn=e=>{const t=parseInt(e.split("-")[1]);return Math.ceil(t/3)},F_=({day:e,minDate:t,maxDate:r,selectDate:n,onChange:s,initialDate:a})=>{const i=n?n.format($s)===e.format($s)&&cn(n.format(ln))===cn(e.format(ln)):!1,l=a?e.format(yr)===a.format(yr):!1,u=t.format(yr),f=r.format(yr),d=e.diff(u)<0,_=e.diff(f)>0,h=d||_,x=cn(e.format(ln))+"분기";return o.jsxs("button",{className:J.button,style:{opacity:h?.3:1,width:`${100/3}%`},disabled:h,onClick:()=>s(e),children:[o.jsx("div",{className:J.buttonText,children:x}),(l||i)&&o.jsx("div",{className:J.box,style:{backgroundColor:l?b.blue100:b.blue600,color:l?b.blue600:b.white},children:x})]})},W_=({day:e,minDate:t,maxDate:r,screenMonth:n,selectDate:s,index:a,onChange:i})=>{const l=a===0,u=e.month()===n.month(),f=s==null?void 0:s.clone().startOf("week"),d=s==null?void 0:s.clone().endOf("week"),_=e.clone().startOf("week"),h=e.clone().endOf("week"),x=_.diff(f,"day")>=0&&h.diff(d,"day")<=0,p=x&&l,S=x&&a===6,M=p||S,j=t.format(te.day),Y=r.format(te.day),E=e.diff(j,"day")<0,H=e.diff(Y,"day")>0,R=!u||E||H,z=()=>{i(_)};return o.jsxs("button",{className:J.button,style:{opacity:R?.3:1},disabled:R,onClick:z,children:[x&&o.jsx("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",position:"absolute",backgroundColor:b.blue100,width:x&&M?"50%":"100%",height:"100%",right:p?0:void 0,left:S?0:void 0},children:!S&&!p?e.format("D"):""}),o.jsx("div",{className:l?J.sundayText:J.buttonText,children:e.format("D")}),M&&o.jsx("div",{className:J.circle,style:{backgroundColor:M?b.blue600:b.blue100,color:M?b.white:b.blue600},children:e.format("D")})]})},St=te.year,L_=({day:e,minDate:t,maxDate:r,selectDate:n,onChange:s,initialDate:a})=>{const i=n?n.format(St)===e.format(St):!1,l=a?e.format(St)===a.format(St):!1,u=t.format(St),f=r.format(St),d=e.diff(u)<0,_=e.diff(f)>0,h=d||_;return o.jsxs("button",{className:J.button,style:{opacity:h?.3:1,width:`${100/3}%`},disabled:h,onClick:()=>s(e),children:[o.jsx("div",{className:J.buttonText,children:e.format("YYYY")}),(l||i)&&o.jsx("div",{className:J.circle,style:{backgroundColor:l?b.blue100:b.blue600,color:l?b.blue600:b.white},children:e.format("YYYY")})]})},Da=e=>{const{dateType:t="day"}=e,r=Ta[t],{date:n=null,maxDate:s=m(),minDate:a=m("1900-01-01"),onChange:i,initialDate:l,name:u,width:f=328}=e,[d,_]=O.useState(n||m()),[h,x]=O.useState(t);O.useEffect(()=>{x(t)},[t]);const p=a.format(r),S=s.format(r),M=d.format(r),j=h==="day"||h==="week",Y=V=>{const w=h==="year",N=V==="min";if(w){const F=N?a:s,W=Be(d).format(r),G=Be(F).format(r);return N?m(W).diff(G)<=0:m(W).diff(G)>=0}else return N?m(M).diff(p)<=0:m(M).diff(S)>=0},E=Y("min"),H=Y("max"),R=()=>{switch(h){case"day":{_(d.clone().add(-1,"month"));break}case"week":{_(d.clone().add(-1,"month"));break}case"month":{_(d.clone().add(-1,"year"));break}case"quarter":{_(d.clone().add(-1,"year"));break}case"year":{_(d.clone().add(-10,"year"));break}}},z=()=>{switch(h){case"day":{_(d.clone().add(1,"month"));break}case"week":{_(d.clone().add(1,"month"));break}case"month":{_(d.clone().add(1,"year"));break}case"quarter":{_(d.clone().add(1,"year"));break}case"year":{_(d.clone().add(10,"year"));break}}},ce=()=>{switch(h){case"day":case"week":x("month");break;case"month":case"quarter":x("year");break}},re=V=>{_(V),h==="year"?t==="year"?i==null||i({date:V,name:u}):x(t==="day"||t==="week"?"month":t):h==="month"?t==="month"?i==null||i({date:V,name:u}):t==="day"||t==="week"?x(t):i==null||i({date:V,name:u}):h==="quarter"?i==null||i({date:V,name:u}):i==null||i({date:V,name:u})},fe=O.useMemo(()=>{switch(h){case"day":return pn(m(d)).map((w,N)=>{const F=w.map((W,G)=>o.jsx(P_,{day:W,initialDate:l,minDate:a,maxDate:s,screenMonth:d,selectDate:n,index:G,onChange:ee=>re(ee)},`${N}-${G}`));return o.jsx("div",{className:J.row,children:F},N)});case"week":return pn(m(d)).map((w,N)=>{const F=w.map((W,G)=>o.jsx(W_,{day:W,minDate:a,maxDate:s,screenMonth:d,selectDate:n,index:G,onChange:ee=>re(ee)},`${N}-${G}`));return o.jsx("div",{className:J.row,children:F},N)});case"month":return Ca(m(d)).map((w,N)=>{const F=w.map((W,G)=>o.jsx(D_,{day:W,initialDate:l,minDate:a,maxDate:s,selectDate:n,onChange:ee=>re(ee)},`${N}-${G}`));return o.jsx("div",{className:J.row,children:F},N)});case"quarter":return k_(m(d)).map((w,N)=>{const F=w.map((W,G)=>o.jsx(F_,{day:W,initialDate:l,minDate:a,maxDate:s,selectDate:n,onChange:ee=>re(ee)},`${N}-${G}`));return o.jsx("div",{className:J.row,children:F},N)});case"year":return Ea(d).map((w,N)=>{const F=w.map((W,G)=>o.jsx(L_,{day:W,initialDate:l,minDate:a,maxDate:s,selectDate:n,onChange:ee=>re(ee)},`${N}-${G}`));return o.jsx("div",{className:J.row,children:F},N)});default:return null}},[h,d,l,a,s,n]),ge=Pa({dateType:h,screenDate:d}),xe=h==="day"||h==="week"||h==="month"||h==="quarter";return o.jsxs("div",{style:{width:f+"px"},children:[o.jsxs("div",{className:J.row,style:{gap:20,marginBottom:20,justifyContent:"center"},children:[o.jsx(mt,{theme:"onlyIcon",level:"medium",disabled:E,onClick:()=>R(),children:o.jsx(Hn,{disabled:E})}),o.jsx("div",{className:`${J.navText} ${xe?J.clickableNav:""}`,onClick:xe?ce:void 0,children:ge}),o.jsx(mt,{theme:"onlyIcon",level:"medium",disabled:H,onClick:()=>z(),children:o.jsx(Vn,{disabled:H})})]}),j&&o.jsx("div",{className:J.header,children:Oa.map(V=>o.jsx("div",{className:J.headerText,children:V},V))}),o.jsx("div",{style:{minHeight:j&&276},children:fe})]})},I_=O.memo(Da),A_="_container_acsyr_1",B_="_tooltip_acsyr_7",H_="_fold_acsyr_1",Rs={container:A_,tooltip:B_,fold:H_},V_=({date:e,dateType:t="day",maxDate:r=m(),minDate:n=m("2020-01-01"),onChange:s,disabled:a,name:i,format:l="hyphenFormat",level:u="large",buttonType:f="input",width:d="100%"})=>{const _=O.useRef(null),h=O.useRef(null),[x,p]=Yr(_),S=Ct({isOpen:x,containerRef:_,tooltipRef:h}),[M,j]=O.useState(e),{height:Y}=Ya[u],E=f==="input",H=()=>{p(!0),j(e)},R=z=>{s(z),p(!1)};return o.jsxs("div",{ref:_,className:Rs.container,style:{width:d},children:[E?o.jsx(w_,{disabled:a,date:e,level:u,dateType:t,onClick:H,format:l}):o.jsx(qh,{disabled:a,date:e,level:u,dateType:t,onClick:H,format:l,maxDate:r,minDate:n,onChange:R,name:i}),x&&o.jsx("div",{ref:h,className:Rs.tooltip,style:{minWidth:"300px",...S.includes("top")?{bottom:Y+8+"px"}:{top:Y+8+"px"},...S.includes("right")?{right:0}:{left:0}},children:o.jsx(I_,{dateType:t,date:e,initialDate:M,maxDate:r,minDate:n,onChange:R,name:i})})]})},U_="_container_8c683_1",G_="_tooltip_8c683_7",q_="_fold_8c683_1",z_="_inputButton_8c683_42",Z_="_inputWrapper_8c683_53",J_="_iconWrapper_8c683_58",zt={container:U_,tooltip:G_,fold:q_,inputButton:z_,inputWrapper:Z_,iconWrapper:J_},Q_=({level:e,dateType:t,onClick:r,format:n,disabled:s,dates:a})=>{var f,d;const i=n==="hyphenFormat"?te:Gn,l=i[t]+" ~ "+i[t],u=(a==null?void 0:a[0])&&(((f=a==null?void 0:a[0])==null?void 0:f.format(i[t]))||i[t])+" ~ "+(((d=a==null?void 0:a[1])==null?void 0:d.format(i[t]))||i[t]);return o.jsx("button",{disabled:s,"aria-label":"input-button",onClick:r,className:zt.inputButton,children:o.jsxs("div",{className:zt.inputWrapper,style:{pointerEvents:s?"none":"auto"},children:[o.jsx(qn,{level:e,placeholder:l,value:u,width:"100%"}),o.jsx("div",{className:zt.iconWrapper,children:o.jsx(Un,{})})]})})},K_="_toast_zkt0s_11",X_="_fadeIn_zkt0s_1",em={toast:K_,fadeIn:X_},tm=({message:e,onClose:t})=>o.jsx("div",{className:`${em.toast}`,onClick:t,children:e}),rm=(e=2e3)=>{const[t,r]=O.useState(!1),[n,s]=O.useState(""),a=O.useRef(null),i=O.useCallback(u=>{a.current&&(clearTimeout(a.current),a.current=null),s(u),r(!0),a.current=setTimeout(()=>{r(!1),s(""),a.current=null},e)},[e]),l=O.useCallback(()=>{a.current&&(clearTimeout(a.current),a.current=null),r(!1),s("")},[]);return{isVisible:t,message:n,showToast:i,closeToast:l}},nm="_row_1lecd_1",sm="_navText_1lecd_8",am="_clickableNav_1lecd_16",im="_header_1lecd_27",om="_headerText_1lecd_38",lm="_button_1lecd_46",cm="_circle_1lecd_64",um="_box_1lecd_80",dm="_buttonText_1lecd_92",fm="_sundayText_1lecd_99",hm="_rangeBackground_1lecd_106",ae={row:nm,navText:sm,clickableNav:am,header:im,headerText:om,button:lm,circle:cm,box:um,buttonText:dm,sundayText:fm,rangeBackground:hm},Ke=te.day,_m=({day:e,minDate:t,maxDate:r,screenMonth:n,selectDates:s,index:a,onChange:i})=>{var H,R;const l=a===0,u=e.month()===n.month(),f=((H=s==null?void 0:s[0])==null?void 0:H.format(Ke))===e.format(Ke),d=((R=s==null?void 0:s[1])==null?void 0:R.format(Ke))===e.format(Ke),_=f&&!(s!=null&&s[1]),h=f||d,x=!!(s!=null&&s[0])&&!!(s!=null&&s[1])&&e.diff(s==null?void 0:s[0],"day")>=0&&e.diff(s==null?void 0:s[1],"day")<=0&&(s==null?void 0:s[0].format(Ke))!==(s==null?void 0:s[1].format(Ke)),p=t.format(Ke),S=r.format(Ke),M=e.diff(p,"day")<0,j=e.diff(S,"day")>0,Y=!u||M||j,E=()=>{const z=!(s!=null&&s[0])||!!(s!=null&&s[0])&&!!(s!=null&&s[1]),ce=!!(s!=null&&s[0])&&!(s!=null&&s[1]);if(z)i([e,null]);else if(ce){const fe=e.diff(s[0])>0?[s[0],e]:[e,s[0]];i(fe)}};return o.jsxs("button",{className:ae.button,disabled:Y,onClick:E,style:{opacity:Y?.3:1},children:[(x||_)&&!(f&&d)?o.jsx("div",{className:ae.rangeBackground,style:{width:(x||_)&&(f||d)?"50%":"100%",right:f?0:void 0,left:d?0:void 0},children:f||d?"":e.format("D")}):o.jsx("div",{className:l?ae.sundayText:ae.buttonText,children:e.format("D")}),h&&o.jsx("div",{className:ae.circle,style:{backgroundColor:h?b.blue600:b.blue100,color:h?b.white:b.blue600},children:e.format("D")})]})},Xe=te.month,mm=({day:e,minDate:t,maxDate:r,selectDates:n,onChange:s})=>{var M,j;const a=((M=n==null?void 0:n[0])==null?void 0:M.format(Xe))===e.format(Xe),i=((j=n==null?void 0:n[1])==null?void 0:j.format(Xe))===e.format(Xe),l=a&&!(n!=null&&n[1]),u=a||i,f=!!(n!=null&&n[0])&&!!(n!=null&&n[1])&&e.diff(n==null?void 0:n[0],"month")>=0&&e.diff(n==null?void 0:n[1],"month")<=0&&(n==null?void 0:n[0].format(Xe))!==(n==null?void 0:n[1].format(Xe)),d=t.format(Xe),_=r.format(Xe),h=e.diff(d,"month")<0,x=e.diff(_,"month")>0,p=h||x,S=()=>{const Y=!(n!=null&&n[0])||!!(n!=null&&n[0])&&!!(n!=null&&n[1]),E=!!(n!=null&&n[0])&&!(n!=null&&n[1]);if(Y)s([e,null]);else if(E){const R=e.diff(n[0])>0?[n[0],e]:[e,n[0]];s(R)}};return o.jsxs("button",{className:ae.button,style:{opacity:p?.3:1,width:`${100/3}%`},disabled:p,onClick:S,children:[(f||l)&&!(a&&i)?o.jsx("div",{className:ae.rangeBackground,style:{width:(f||l)&&(a||i)?"50%":"100%",right:a?0:void 0,left:i?0:void 0},children:a||i?"":e.format("MM")}):o.jsx("div",{className:ae.buttonText,children:e.format("MM")}),u&&o.jsx("div",{className:ae.circle,style:{backgroundColor:u?b.blue600:b.blue100,color:u?b.white:b.blue600},children:e.format("MM")})]})},et=te.year,ym=({day:e,minDate:t,maxDate:r,selectDates:n,onChange:s})=>{var M,j;const a=((M=n==null?void 0:n[0])==null?void 0:M.format(et))===e.format(et),i=((j=n==null?void 0:n[1])==null?void 0:j.format(et))===e.format(et),l=a&&!(n!=null&&n[1]),u=a||i,f=!!(n!=null&&n[0])&&!!(n!=null&&n[1])&&e.diff(n==null?void 0:n[0],"year")>=0&&e.diff(n==null?void 0:n[1],"year")<=0&&(n==null?void 0:n[0].format(et))!==(n==null?void 0:n[1].format(et)),d=t.format(et),_=r.format(et),h=e.diff(d,"year")<0,x=e.diff(_,"year")>0,p=h||x,S=()=>{const Y=!(n!=null&&n[0])||!!(n!=null&&n[0])&&!!(n!=null&&n[1]),E=!!(n!=null&&n[0])&&!(n!=null&&n[1]);if(Y)s([e,null]);else if(E){const R=e.diff(n[0])>0?[n[0],e]:[e,n[0]];s(R)}};return o.jsxs("button",{className:ae.button,style:{opacity:p?.3:1,width:`${100/3}%`},disabled:p,onClick:S,children:[(f||l)&&!(a&&i)?o.jsx("div",{className:ae.rangeBackground,style:{width:(f||l)&&(a||i)?"50%":"100%",right:a?0:void 0,left:i?0:void 0},children:a||i?"":e.format("YYYY")}):o.jsx("div",{className:ae.buttonText,children:e.format("YYYY")}),u&&o.jsx("div",{className:ae.circle,style:{backgroundColor:u?b.blue600:b.blue100,color:u?b.white:b.blue600},children:e.format("YYYY")})]})},Fa=e=>{const{dateType:t="day",width:r=328}=e,n=Ta[t],{dates:s=[null,null],maxDate:a=m(),minDate:i=m("2020-01-01"),onChange:l,maxRange:u=999,name:f}=e,{isVisible:d,message:_,showToast:h,closeToast:x}=rm(),[p,S]=O.useState((s==null?void 0:s[0])||m());O.useEffect(()=>{j(t)},[t]);const[M,j]=O.useState(t),Y=O.useCallback((w,N)=>{if(w!=null&&w[0]&&!(w!=null&&w[1])){l==null||l(w,N||f);return}if(w!=null&&w[0]&&(w!=null&&w[1])){const{isRangeExceeded:F,errorMessage:W}=S_(t,w,u);if(F){h(W);return}else l==null||l(w,N||f)}},[t,u,f,l,h]),E=O.useCallback(()=>{switch(M){case"day":j("month");break;case"month":j("year");break}},[M]),H=O.useCallback((w,N)=>{M!==t?M==="year"?t==="year"?Y(w,N):(j("month"),S(w[0]||p)):M==="month"?t==="month"?Y(w,N):(j("day"),S(w[0]||p)):Y(w,N):Y(w,N)},[t,Y,p,M]),R=M==="year"?m(Be(p).format(n)).diff(Be(i).format(n))<=0:m(p.format(n)).diff(i.format(n))<=0,z=M==="year"?m(Be(p).format(n)).diff(Be(a).format(n))>=0:m(p.format(n)).diff(a.format(n))>=0,ce=()=>{switch(M){case"day":{S(p.clone().add(-1,"month"));break}case"month":{S(p.clone().add(-1,"year"));break}case"year":{S(p.clone().add(-10,"year"));break}}},re=()=>{switch(M){case"day":{S(p.clone().add(1,"month"));break}case"month":{S(p.clone().add(1,"year"));break}case"year":{S(p.clone().add(10,"year"));break}}},fe=O.useMemo(()=>{switch(M){case"day":return pn(m(p)).map((N,F)=>{const W=N.map((G,ee)=>o.jsx(_m,{day:G,minDate:i,maxDate:a,screenMonth:p,selectDates:s,index:ee,onChange:H,maxRange:u},`${F}-${ee}`));return o.jsx("div",{className:ae.row,children:W},F)});case"month":return Ca(m(p)).map((N,F)=>{const W=N.map((G,ee)=>o.jsx(mm,{day:G,minDate:i,maxDate:a,selectDates:s,onChange:H,maxRange:u},`${F}-${ee}`));return o.jsx("div",{className:ae.row,children:W},F)});case"year":return Ea(p).map((N,F)=>{const W=N.map((G,ee)=>o.jsx(ym,{day:G,minDate:i,maxDate:a,selectDates:s,onChange:H,maxRange:u},`${F}-${ee}`));return o.jsx("div",{className:ae.row,children:W},F)});default:return null}},[s,M,a,i,p,u,H]),ge=Pa({dateType:M,screenDate:p}),xe=M==="day",V=M==="day"||M==="month";return o.jsxs("div",{style:{width:r+"px",position:"relative"},children:[o.jsxs("div",{className:ae.row,style:{justifyContent:"center",marginBottom:"20px",gap:"20px"},children:[o.jsx(mt,{onClick:ce,disabled:R,theme:"onlyIcon",level:"medium",children:o.jsx(Hn,{})}),o.jsx("div",{className:`${ae.navText} ${V?ae.clickableNav:""}`,onClick:V?E:void 0,children:ge}),o.jsx(mt,{onClick:re,disabled:z,theme:"onlyIcon",level:"medium",children:o.jsx(Vn,{})})]}),xe&&o.jsx("div",{className:ae.header,children:Oa.map(w=>o.jsx("div",{className:ae.headerText,children:w},w))}),o.jsx("div",{style:{minHeight:xe?276:"auto"},children:fe}),d&&o.jsx(tm,{message:_,onClose:x})]})},gm=O.memo(Fa),pm=({dates:e=[m(),m()],dateType:t="day",maxDate:r=m(),minDate:n=m("1900-01-01"),onChange:s,disabled:a,name:i,format:l="hyphenFormat",level:u="large",width:f="100%",maxRange:d})=>{const[_,h]=O.useState(e),x=O.useRef(null),p=O.useRef(null),[S,M]=Yr(x),j=Ct({isOpen:S,containerRef:x,tooltipRef:p}),{height:Y}=Ya[u],E=()=>{M(!0),h(e)},H=R=>{var z,ce;h(R.dates),(z=R==null?void 0:R.dates)!=null&&z[0]&&((ce=R==null?void 0:R.dates)!=null&&ce[1])&&(s(R),M(!1))};return o.jsxs("div",{ref:x,className:zt.container,style:{width:f},children:[o.jsx(Q_,{disabled:a,dates:e,level:u,dateType:t,onClick:E,format:l}),S&&o.jsx("div",{ref:p,className:zt.tooltip,style:{minWidth:"300px",...j.includes("top")?{bottom:Y+8+"px"}:{top:Y+8+"px"},...j.includes("right")?{right:0}:{left:0}},children:o.jsx(gm,{dateType:t,dates:_,maxDate:r,minDate:n,onChange:(R,z)=>H({dates:R,name:z}),name:i,maxRange:d})})]})},xm="_divider_6kbwo_1",bm="_row_6kbwo_5",vm="_column_6kbwo_9",un={divider:xm,row:bm,column:vm},wm=({size:e=1,direction:t="row"})=>{const r=t==="row";return o.jsx("div",{className:`${un.divider} ${r?un.row:un.column}`,style:{borderBottom:r&&`${e}px solid ${b.gray300}`,borderRight:!r&&`${e}px solid ${b.gray300}`}})},km="_button_186r4_1",Sm="_buttonDisabled_186r4_21",Mm="_open_186r4_28",gr={button:km,buttonDisabled:Sm,open:Mm},jm=e=>{const{children:t,level:r="small",width:n="fit-content",isOpen:s,disabled:a,...i}=e,{height:l,fontSize:u}=Ym[r];return o.jsx("div",{className:`
|
|
68
|
+
`,style:{paddingRight:(E||20+(M&&p&&24))+"px",fontSize:(z?16:18)+"px"},type:R?"text":t,onChange:ce,value:H?u:"",disabled:f,onFocus:()=>j(!0),onBlur:()=>j(!1),...S}),(e||M)&&o.jsxs("div",{className:`${ue.rightContainer} ${z?ue.small:ue.large}`,style:{fontSize:(z?14:16)+"px"},ref:Y,children:[M&&p&&o.jsx("div",{className:ue.iconButton,onClick:()=>p(S==null?void 0:S.name),onMouseDown:re=>re.preventDefault(),children:o.jsx("div",{className:ue.iconWrapper,children:o.jsx("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:o.jsxs("g",{id:"Frame 48096259",children:[o.jsx("circle",{id:"Ellipse 52",cx:"9",cy:"9",r:"9",fill:"#DADEE5"}),o.jsx("path",{id:"Vector",d:"M5 5L13 13",stroke:"white",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),o.jsx("path",{id:"Vector_2",d:"M13 5L5 13",stroke:"white",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})})})}),e]})]}),d&&o.jsx("label",{className:ue.errorMessage,children:d}),_&&o.jsx("label",{className:ue.successMessage,children:_}),h&&o.jsx("label",{className:ue.guideMessage,children:h})]})},w_=({level:e,dateType:t,onClick:r,format:n,disabled:s,date:a})=>{const i=n==="hyphenFormat"?te:Gn,l=t==="week",u=t==="quarter",f=t==="quarter"?i.year+". Q분기":t==="week"?i.day+" ~ "+i.day:i[t],d=a&&(u?a==null?void 0:a.format(i.year+". "+(a==null?void 0:a.quarter())+"분기"):l?(a==null?void 0:a.format(i.day))+" ~ "+(a==null?void 0:a.clone().add(6,"days").format(i.day)):a==null?void 0:a.format(i[t]));return o.jsx("button",{disabled:s,"aria-label":"input-button",onClick:r,className:qt.inputButton,children:o.jsxs("div",{className:qt.inputWrapper,style:{pointerEvents:s?"none":"auto"},children:[o.jsx(qn,{level:e,placeholder:f,value:d,width:"100%"}),o.jsx("div",{className:qt.iconWrapper,children:o.jsx(Un,{})})]})})},Br=(e,t)=>{const r=[...e],n=[];for(;r.length>0;)n.push(r.splice(0,t));return n},Ta={day:te.month,week:te.month,month:te.year,quarter:te.year,year:te.year},pn=e=>{const t=e.clone().startOf("month"),r=e.clone().endOf("month"),n=t.clone().startOf("week"),a=r.clone().endOf("week").diff(n,"day"),i=[];for(let l=0;l<a+1;l++)i.push(n.clone().add(l,"day"));return Br(i,7)},Ca=e=>{const t=Array.from({length:12},(r,n)=>m(m(e).format(te.year)+`-${n+1}`));return Br(t,3)},k_=e=>{const t=m(e).format(te.year),r=Array.from({length:4},(n,s)=>m(t).add(s*3,"month"));return Br(r,3)},Be=e=>{const t=Number(e.format(te.year)),r=Math.floor(t/10)*10;return m(`${r}`)},Ea=e=>{const t=[];for(let r=0;r<10;r++)t.push(Be(e).clone().add(r,"year"));return Br(t,3)},Pa=({dateType:e,screenDate:t})=>{switch(e){case"day":return t.format("YYYY년 MM월");case"week":return t.format("YYYY년 MM월");case"quarter":return t.format("YYYY년");case"year":return Be(t).format(`YYYY년~${Be(t).add(9,"year").format("YYYY")}년`);default:return t.format("YYYY년")}},S_=(e,t,r)=>{const n=t[0],s=t[1];let a=!1,i;switch(e){case"day":{const l=Math.abs(s.diff(n,"day"))+1;r&&l>r&&(a=!0,i=`최대 ${r}일까지 선택 가능합니다.`);break}case"month":{const l=Math.abs(s.diff(n,"month"))+1;r&&l>r&&(a=!0,i=`최대 ${r}개월까지 선택 가능합니다.`);break}case"year":{const l=Math.abs(s.diff(n,"year"))+1;r&&l>r&&(a=!0,i=`최대 ${r}년까지 선택 가능합니다.`);break}}return{isRangeExceeded:a,errorMessage:i}},M_="_row_1m5wd_1",j_="_navText_1m5wd_8",Y_="_clickableNav_1m5wd_16",O_="_header_1m5wd_27",$_="_headerText_1m5wd_38",R_="_button_1m5wd_46",N_="_circle_1m5wd_64",T_="_box_1m5wd_80",C_="_buttonText_1m5wd_91",E_="_sundayText_1m5wd_97",J={row:M_,navText:j_,clickableNav:Y_,header:O_,headerText:$_,button:R_,circle:N_,box:T_,buttonText:C_,sundayText:E_},wt=te.day,P_=({day:e,minDate:t,maxDate:r,screenMonth:n,selectDate:s,index:a,onChange:i,initialDate:l})=>{const u=a===0,f=e.month()===n.month(),d=l?e.format(wt)===l.format(wt):!1,_=s?s.format(wt)===e.format(wt):!1,h=t.format(wt),x=r.format(wt),p=e.diff(h)<0,S=e.diff(x)>0,M=!f||p||S;return o.jsxs("button",{className:J.button,disabled:M,onClick:()=>i(e),children:[o.jsx("div",{className:u?J.sundayText:J.buttonText,children:e.format("D")}),(d||_)&&o.jsx("div",{className:J.circle,style:{backgroundColor:d?b.blue100:b.blue600,color:d?b.blue600:b.white},children:e.format("D")})]})},kt=te.month,D_=({day:e,minDate:t,maxDate:r,selectDate:n,onChange:s,initialDate:a})=>{const i=n?n.format(kt)===e.format(kt):!1,l=a?e.format(kt)===a.format(kt):!1,u=t.format(kt),f=r.format(kt),d=e.diff(u)<0,_=e.diff(f)>0,h=d||_;return o.jsxs("button",{className:J.button,style:{opacity:h?.3:1,width:`${100/3}%`},disabled:h,onClick:()=>s(e),children:[o.jsx("div",{className:J.buttonText,children:e.format("MM")}),(l||i)&&o.jsx("div",{className:J.circle,style:{backgroundColor:l?b.blue100:b.blue600,color:l?b.blue600:b.white},children:e.format("MM")})]})},ln=te.day,yr=te.month,$s=te.year,cn=e=>{const t=parseInt(e.split("-")[1]);return Math.ceil(t/3)},F_=({day:e,minDate:t,maxDate:r,selectDate:n,onChange:s,initialDate:a})=>{const i=n?n.format($s)===e.format($s)&&cn(n.format(ln))===cn(e.format(ln)):!1,l=a?e.format(yr)===a.format(yr):!1,u=t.format(yr),f=r.format(yr),d=e.diff(u)<0,_=e.diff(f)>0,h=d||_,x=cn(e.format(ln))+"분기";return o.jsxs("button",{className:J.button,style:{opacity:h?.3:1,width:`${100/3}%`},disabled:h,onClick:()=>s(e),children:[o.jsx("div",{className:J.buttonText,children:x}),(l||i)&&o.jsx("div",{className:J.box,style:{backgroundColor:l?b.blue100:b.blue600,color:l?b.blue600:b.white},children:x})]})},W_=({day:e,minDate:t,maxDate:r,screenMonth:n,selectDate:s,index:a,onChange:i})=>{const l=a===0,u=e.month()===n.month(),f=s==null?void 0:s.clone().startOf("week"),d=s==null?void 0:s.clone().endOf("week"),_=e.clone().startOf("week"),h=e.clone().endOf("week"),x=_.diff(f,"day")>=0&&h.diff(d,"day")<=0,p=x&&l,S=x&&a===6,M=p||S,j=t.format(te.day),Y=r.format(te.day),E=e.diff(j,"day")<0,H=e.diff(Y,"day")>0,R=!u||E||H,z=()=>{i(_)};return o.jsxs("button",{className:J.button,style:{opacity:R?.3:1},disabled:R,onClick:z,children:[x&&o.jsx("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",position:"absolute",backgroundColor:b.blue100,width:x&&M?"50%":"100%",height:"100%",right:p?0:void 0,left:S?0:void 0},children:!S&&!p?e.format("D"):""}),o.jsx("div",{className:l?J.sundayText:J.buttonText,children:e.format("D")}),M&&o.jsx("div",{className:J.circle,style:{backgroundColor:M?b.blue600:b.blue100,color:M?b.white:b.blue600},children:e.format("D")})]})},St=te.year,L_=({day:e,minDate:t,maxDate:r,selectDate:n,onChange:s,initialDate:a})=>{const i=n?n.format(St)===e.format(St):!1,l=a?e.format(St)===a.format(St):!1,u=t.format(St),f=r.format(St),d=e.diff(u)<0,_=e.diff(f)>0,h=d||_;return o.jsxs("button",{className:J.button,style:{opacity:h?.3:1,width:`${100/3}%`},disabled:h,onClick:()=>s(e),children:[o.jsx("div",{className:J.buttonText,children:e.format("YYYY")}),(l||i)&&o.jsx("div",{className:J.circle,style:{backgroundColor:l?b.blue100:b.blue600,color:l?b.blue600:b.white},children:e.format("YYYY")})]})},Da=e=>{const{dateType:t="day"}=e,r=Ta[t],{date:n=null,maxDate:s=m(),minDate:a=m("1900-01-01"),onChange:i,initialDate:l,name:u,width:f=328}=e,[d,_]=O.useState(n||m()),[h,x]=O.useState(t);O.useEffect(()=>{x(t)},[t]);const p=a.format(r),S=s.format(r),M=d.format(r),j=h==="day"||h==="week",Y=V=>{const w=h==="year",N=V==="min";if(w){const F=N?a:s,W=Be(d).format(r),G=Be(F).format(r);return N?m(W).diff(G)<=0:m(W).diff(G)>=0}else return N?m(M).diff(p)<=0:m(M).diff(S)>=0},E=Y("min"),H=Y("max"),R=()=>{switch(h){case"day":{_(d.clone().add(-1,"month"));break}case"week":{_(d.clone().add(-1,"month"));break}case"month":{_(d.clone().add(-1,"year"));break}case"quarter":{_(d.clone().add(-1,"year"));break}case"year":{_(d.clone().add(-10,"year"));break}}},z=()=>{switch(h){case"day":{_(d.clone().add(1,"month"));break}case"week":{_(d.clone().add(1,"month"));break}case"month":{_(d.clone().add(1,"year"));break}case"quarter":{_(d.clone().add(1,"year"));break}case"year":{_(d.clone().add(10,"year"));break}}},ce=()=>{switch(h){case"day":case"week":x("month");break;case"month":case"quarter":x("year");break}},re=V=>{_(V),h==="year"?t==="year"?i==null||i({date:V,name:u}):x(t==="day"||t==="week"?"month":t):h==="month"?t==="month"?i==null||i({date:V,name:u}):t==="day"||t==="week"?x(t):i==null||i({date:V,name:u}):h==="quarter"?i==null||i({date:V,name:u}):i==null||i({date:V,name:u})},fe=O.useMemo(()=>{switch(h){case"day":return pn(m(d)).map((w,N)=>{const F=w.map((W,G)=>o.jsx(P_,{day:W,initialDate:l,minDate:a,maxDate:s,screenMonth:d,selectDate:n,index:G,onChange:ee=>re(ee)},`${N}-${G}`));return o.jsx("div",{className:J.row,children:F},N)});case"week":return pn(m(d)).map((w,N)=>{const F=w.map((W,G)=>o.jsx(W_,{day:W,minDate:a,maxDate:s,screenMonth:d,selectDate:n,index:G,onChange:ee=>re(ee)},`${N}-${G}`));return o.jsx("div",{className:J.row,children:F},N)});case"month":return Ca(m(d)).map((w,N)=>{const F=w.map((W,G)=>o.jsx(D_,{day:W,initialDate:l,minDate:a,maxDate:s,selectDate:n,onChange:ee=>re(ee)},`${N}-${G}`));return o.jsx("div",{className:J.row,children:F},N)});case"quarter":return k_(m(d)).map((w,N)=>{const F=w.map((W,G)=>o.jsx(F_,{day:W,initialDate:l,minDate:a,maxDate:s,selectDate:n,onChange:ee=>re(ee)},`${N}-${G}`));return o.jsx("div",{className:J.row,children:F},N)});case"year":return Ea(d).map((w,N)=>{const F=w.map((W,G)=>o.jsx(L_,{day:W,initialDate:l,minDate:a,maxDate:s,selectDate:n,onChange:ee=>re(ee)},`${N}-${G}`));return o.jsx("div",{className:J.row,children:F},N)});default:return null}},[h,d,l,a,s,n]),ge=Pa({dateType:h,screenDate:d}),xe=h==="day"||h==="week"||h==="month"||h==="quarter";return o.jsxs("div",{style:{width:f+"px"},children:[o.jsxs("div",{className:J.row,style:{gap:20,marginBottom:20,justifyContent:"center"},children:[o.jsx(mt,{theme:"onlyIcon",level:"medium",disabled:E,onClick:()=>R(),children:o.jsx(Hn,{disabled:E})}),o.jsx("div",{className:`${J.navText} ${xe?J.clickableNav:""}`,onClick:xe?ce:void 0,children:ge}),o.jsx(mt,{theme:"onlyIcon",level:"medium",disabled:H,onClick:()=>z(),children:o.jsx(Vn,{disabled:H})})]}),j&&o.jsx("div",{className:J.header,children:Oa.map(V=>o.jsx("div",{className:J.headerText,children:V},V))}),o.jsx("div",{style:{minHeight:j&&276},children:fe})]})},I_=O.memo(Da),A_="_container_acsyr_1",B_="_tooltip_acsyr_7",H_="_fold_acsyr_1",Rs={container:A_,tooltip:B_,fold:H_},V_=({date:e,dateType:t="day",maxDate:r=m(),minDate:n=m("2020-01-01"),onChange:s,disabled:a,name:i,format:l="hyphenFormat",level:u="large",buttonType:f="input",width:d="100%"})=>{const _=O.useRef(null),h=O.useRef(null),[x,p]=Yr(_),S=Ct({isOpen:x,containerRef:_,tooltipRef:h}),[M,j]=O.useState(e),{height:Y}=Ya[u],E=f==="input",H=()=>{p(!0),j(e)},R=z=>{s(z),p(!1)};return o.jsxs("div",{ref:_,className:Rs.container,style:{width:d},children:[E?o.jsx(w_,{disabled:a,date:e,level:u,dateType:t,onClick:H,format:l}):o.jsx(qh,{disabled:a,date:e,level:u,dateType:t,onClick:H,format:l,maxDate:r,minDate:n,onChange:R,name:i}),x&&o.jsx("div",{ref:h,className:Rs.tooltip,style:{minWidth:"300px",...S.includes("top")?{bottom:Y+8+"px"}:{top:Y+8+"px"},...S.includes("right")?{right:0}:{left:0}},children:o.jsx(I_,{dateType:t,date:e,initialDate:M,maxDate:r,minDate:n,onChange:R,name:i})})]})},U_="_container_8c683_1",G_="_tooltip_8c683_7",q_="_fold_8c683_1",z_="_inputButton_8c683_42",Z_="_inputWrapper_8c683_53",J_="_iconWrapper_8c683_58",zt={container:U_,tooltip:G_,fold:q_,inputButton:z_,inputWrapper:Z_,iconWrapper:J_},Q_=({level:e,dateType:t,onClick:r,format:n,disabled:s,dates:a})=>{var f,d;const i=n==="hyphenFormat"?te:Gn,l=i[t]+" ~ "+i[t],u=(a==null?void 0:a[0])&&(((f=a==null?void 0:a[0])==null?void 0:f.format(i[t]))||i[t])+" ~ "+(((d=a==null?void 0:a[1])==null?void 0:d.format(i[t]))||i[t]);return o.jsx("button",{disabled:s,"aria-label":"input-button",onClick:r,className:zt.inputButton,children:o.jsxs("div",{className:zt.inputWrapper,style:{pointerEvents:s?"none":"auto"},children:[o.jsx(qn,{level:e,placeholder:l,value:u,width:"100%"}),o.jsx("div",{className:zt.iconWrapper,children:o.jsx(Un,{})})]})})},K_="_toast_zkt0s_11",X_="_fadeIn_zkt0s_1",em={toast:K_,fadeIn:X_},tm=({message:e,onClose:t})=>o.jsx("div",{className:`${em.toast}`,onClick:t,children:e}),rm=(e=2e3)=>{const[t,r]=O.useState(!1),[n,s]=O.useState(""),a=O.useRef(null),i=O.useCallback(u=>{a.current&&(clearTimeout(a.current),a.current=null),s(u),r(!0),a.current=setTimeout(()=>{r(!1),s(""),a.current=null},e)},[e]),l=O.useCallback(()=>{a.current&&(clearTimeout(a.current),a.current=null),r(!1),s("")},[]);return{isVisible:t,message:n,showToast:i,closeToast:l}},nm="_row_1lecd_1",sm="_navText_1lecd_8",am="_clickableNav_1lecd_16",im="_header_1lecd_27",om="_headerText_1lecd_38",lm="_button_1lecd_46",cm="_circle_1lecd_64",um="_box_1lecd_80",dm="_buttonText_1lecd_92",fm="_sundayText_1lecd_99",hm="_rangeBackground_1lecd_106",ae={row:nm,navText:sm,clickableNav:am,header:im,headerText:om,button:lm,circle:cm,box:um,buttonText:dm,sundayText:fm,rangeBackground:hm},Ke=te.day,_m=({day:e,minDate:t,maxDate:r,screenMonth:n,selectDates:s,index:a,onChange:i})=>{var H,R;const l=a===0,u=e.month()===n.month(),f=((H=s==null?void 0:s[0])==null?void 0:H.format(Ke))===e.format(Ke),d=((R=s==null?void 0:s[1])==null?void 0:R.format(Ke))===e.format(Ke),_=f&&!(s!=null&&s[1]),h=f||d,x=!!(s!=null&&s[0])&&!!(s!=null&&s[1])&&e.diff(s==null?void 0:s[0],"day")>=0&&e.diff(s==null?void 0:s[1],"day")<=0&&(s==null?void 0:s[0].format(Ke))!==(s==null?void 0:s[1].format(Ke)),p=t.format(Ke),S=r.format(Ke),M=e.diff(p,"day")<0,j=e.diff(S,"day")>0,Y=!u||M||j,E=()=>{const z=!(s!=null&&s[0])||!!(s!=null&&s[0])&&!!(s!=null&&s[1]),ce=!!(s!=null&&s[0])&&!(s!=null&&s[1]);if(z)i([e,null]);else if(ce){const fe=e.diff(s[0])>0?[s[0],e]:[e,s[0]];i(fe)}};return o.jsxs("button",{className:ae.button,disabled:Y,onClick:E,style:{opacity:Y?.3:1},children:[(x||_)&&!(f&&d)?o.jsx("div",{className:ae.rangeBackground,style:{width:(x||_)&&(f||d)?"50%":"100%",right:f?0:void 0,left:d?0:void 0},children:f||d?"":e.format("D")}):o.jsx("div",{className:l?ae.sundayText:ae.buttonText,children:e.format("D")}),h&&o.jsx("div",{className:ae.circle,style:{backgroundColor:h?b.blue600:b.blue100,color:h?b.white:b.blue600},children:e.format("D")})]})},Xe=te.month,mm=({day:e,minDate:t,maxDate:r,selectDates:n,onChange:s})=>{var M,j;const a=((M=n==null?void 0:n[0])==null?void 0:M.format(Xe))===e.format(Xe),i=((j=n==null?void 0:n[1])==null?void 0:j.format(Xe))===e.format(Xe),l=a&&!(n!=null&&n[1]),u=a||i,f=!!(n!=null&&n[0])&&!!(n!=null&&n[1])&&e.diff(n==null?void 0:n[0],"month")>=0&&e.diff(n==null?void 0:n[1],"month")<=0&&(n==null?void 0:n[0].format(Xe))!==(n==null?void 0:n[1].format(Xe)),d=t.format(Xe),_=r.format(Xe),h=e.diff(d,"month")<0,x=e.diff(_,"month")>0,p=h||x,S=()=>{const Y=!(n!=null&&n[0])||!!(n!=null&&n[0])&&!!(n!=null&&n[1]),E=!!(n!=null&&n[0])&&!(n!=null&&n[1]);if(Y)s([e,null]);else if(E){const R=e.diff(n[0])>0?[n[0],e]:[e,n[0]];s(R)}};return o.jsxs("button",{className:ae.button,style:{opacity:p?.3:1,width:`${100/3}%`},disabled:p,onClick:S,children:[(f||l)&&!(a&&i)?o.jsx("div",{className:ae.rangeBackground,style:{width:(f||l)&&(a||i)?"50%":"100%",right:a?0:void 0,left:i?0:void 0},children:a||i?"":e.format("MM")}):o.jsx("div",{className:ae.buttonText,children:e.format("MM")}),u&&o.jsx("div",{className:ae.circle,style:{backgroundColor:u?b.blue600:b.blue100,color:u?b.white:b.blue600},children:e.format("MM")})]})},et=te.year,ym=({day:e,minDate:t,maxDate:r,selectDates:n,onChange:s})=>{var M,j;const a=((M=n==null?void 0:n[0])==null?void 0:M.format(et))===e.format(et),i=((j=n==null?void 0:n[1])==null?void 0:j.format(et))===e.format(et),l=a&&!(n!=null&&n[1]),u=a||i,f=!!(n!=null&&n[0])&&!!(n!=null&&n[1])&&e.diff(n==null?void 0:n[0],"year")>=0&&e.diff(n==null?void 0:n[1],"year")<=0&&(n==null?void 0:n[0].format(et))!==(n==null?void 0:n[1].format(et)),d=t.format(et),_=r.format(et),h=e.diff(d,"year")<0,x=e.diff(_,"year")>0,p=h||x,S=()=>{const Y=!(n!=null&&n[0])||!!(n!=null&&n[0])&&!!(n!=null&&n[1]),E=!!(n!=null&&n[0])&&!(n!=null&&n[1]);if(Y)s([e,null]);else if(E){const R=e.diff(n[0])>0?[n[0],e]:[e,n[0]];s(R)}};return o.jsxs("button",{className:ae.button,style:{opacity:p?.3:1,width:`${100/3}%`},disabled:p,onClick:S,children:[(f||l)&&!(a&&i)?o.jsx("div",{className:ae.rangeBackground,style:{width:(f||l)&&(a||i)?"50%":"100%",right:a?0:void 0,left:i?0:void 0},children:a||i?"":e.format("YYYY")}):o.jsx("div",{className:ae.buttonText,children:e.format("YYYY")}),u&&o.jsx("div",{className:ae.circle,style:{backgroundColor:u?b.blue600:b.blue100,color:u?b.white:b.blue600},children:e.format("YYYY")})]})},Fa=e=>{const{dateType:t="day",width:r=328}=e,n=Ta[t],{dates:s=[null,null],maxDate:a=m(),minDate:i=m("2020-01-01"),onChange:l,maxRange:u=999,name:f}=e,{isVisible:d,message:_,showToast:h,closeToast:x}=rm(),[p,S]=O.useState((s==null?void 0:s[0])||m());O.useEffect(()=>{j(t)},[t]);const[M,j]=O.useState(t),Y=O.useCallback((w,N)=>{if(w!=null&&w[0]&&!(w!=null&&w[1])){l==null||l(w,N||f);return}if(w!=null&&w[0]&&(w!=null&&w[1])){const{isRangeExceeded:F,errorMessage:W}=S_(t,w,u);if(F){h(W);return}else l==null||l(w,N||f)}},[t,u,f,l,h]),E=O.useCallback(()=>{switch(M){case"day":j("month");break;case"month":j("year");break}},[M]),H=O.useCallback((w,N)=>{M!==t?M==="year"?t==="year"?Y(w,N):(j("month"),S(w[0]||p)):M==="month"?t==="month"?Y(w,N):(j("day"),S(w[0]||p)):Y(w,N):Y(w,N)},[t,Y,p,M]),R=M==="year"?m(Be(p).format(n)).diff(Be(i).format(n))<=0:m(p.format(n)).diff(i.format(n))<=0,z=M==="year"?m(Be(p).format(n)).diff(Be(a).format(n))>=0:m(p.format(n)).diff(a.format(n))>=0,ce=()=>{switch(M){case"day":{S(p.clone().add(-1,"month"));break}case"month":{S(p.clone().add(-1,"year"));break}case"year":{S(p.clone().add(-10,"year"));break}}},re=()=>{switch(M){case"day":{S(p.clone().add(1,"month"));break}case"month":{S(p.clone().add(1,"year"));break}case"year":{S(p.clone().add(10,"year"));break}}},fe=O.useMemo(()=>{switch(M){case"day":return pn(m(p)).map((N,F)=>{const W=N.map((G,ee)=>o.jsx(_m,{day:G,minDate:i,maxDate:a,screenMonth:p,selectDates:s,index:ee,onChange:H,maxRange:u},`${F}-${ee}`));return o.jsx("div",{className:ae.row,children:W},F)});case"month":return Ca(m(p)).map((N,F)=>{const W=N.map((G,ee)=>o.jsx(mm,{day:G,minDate:i,maxDate:a,selectDates:s,onChange:H,maxRange:u},`${F}-${ee}`));return o.jsx("div",{className:ae.row,children:W},F)});case"year":return Ea(p).map((N,F)=>{const W=N.map((G,ee)=>o.jsx(ym,{day:G,minDate:i,maxDate:a,selectDates:s,onChange:H,maxRange:u},`${F}-${ee}`));return o.jsx("div",{className:ae.row,children:W},F)});default:return null}},[s,M,a,i,p,u,H]),ge=Pa({dateType:M,screenDate:p}),xe=M==="day",V=M==="day"||M==="month";return o.jsxs("div",{style:{width:r+"px",position:"relative"},children:[o.jsxs("div",{className:ae.row,style:{justifyContent:"center",marginBottom:"20px",gap:"20px"},children:[o.jsx(mt,{onClick:ce,disabled:R,theme:"onlyIcon",level:"medium",children:o.jsx(Hn,{})}),o.jsx("div",{className:`${ae.navText} ${V?ae.clickableNav:""}`,onClick:V?E:void 0,children:ge}),o.jsx(mt,{onClick:re,disabled:z,theme:"onlyIcon",level:"medium",children:o.jsx(Vn,{})})]}),xe&&o.jsx("div",{className:ae.header,children:Oa.map(w=>o.jsx("div",{className:ae.headerText,children:w},w))}),o.jsx("div",{style:{minHeight:xe?276:"auto"},children:fe}),d&&o.jsx(tm,{message:_,onClose:x})]})},gm=O.memo(Fa),pm=({dates:e=[m(),m()],dateType:t="day",maxDate:r=m(),minDate:n=m("1900-01-01"),onChange:s,disabled:a,name:i,format:l="hyphenFormat",level:u="large",width:f="100%",maxRange:d})=>{const[_,h]=O.useState(e),x=O.useRef(null),p=O.useRef(null),[S,M]=Yr(x),j=Ct({isOpen:S,containerRef:x,tooltipRef:p}),{height:Y}=Ya[u],E=()=>{M(!0),h(e)},H=R=>{var z,ce;h(R.dates),(z=R==null?void 0:R.dates)!=null&&z[0]&&((ce=R==null?void 0:R.dates)!=null&&ce[1])&&(s(R),M(!1))};return o.jsxs("div",{ref:x,className:zt.container,style:{width:f},children:[o.jsx(Q_,{disabled:a,dates:e,level:u,dateType:t,onClick:E,format:l}),S&&o.jsx("div",{ref:p,className:zt.tooltip,style:{minWidth:"300px",...j.includes("top")?{bottom:Y+8+"px"}:{top:Y+8+"px"},...j.includes("right")?{right:0}:{left:0}},children:o.jsx(gm,{dateType:t,dates:_,maxDate:r,minDate:n,onChange:(R,z)=>H({dates:R,name:z}),name:i,maxRange:d})})]})},xm="_divider_6kbwo_1",bm="_row_6kbwo_5",vm="_column_6kbwo_9",un={divider:xm,row:bm,column:vm},wm=({size:e=1,direction:t="row"})=>{const r=t==="row";return o.jsx("div",{className:`${un.divider} ${r?un.row:un.column}`,style:{borderBottom:r&&`${e}px solid ${b.gray300}`,borderRight:!r&&`${e}px solid ${b.gray300}`,width:r&&"100%",height:!r&&"100%"}})},km="_button_186r4_1",Sm="_buttonDisabled_186r4_21",Mm="_open_186r4_28",gr={button:km,buttonDisabled:Sm,open:Mm},jm=e=>{const{children:t,level:r="small",width:n="fit-content",isOpen:s,disabled:a,...i}=e,{height:l,fontSize:u}=Ym[r];return o.jsx("div",{className:`
|
|
69
69
|
${gr.button}
|
|
70
70
|
${gr[r]}
|
|
71
71
|
${s&&gr.open}
|
package/dist/index.es.js
CHANGED
|
@@ -6045,7 +6045,9 @@ const Xh = /^\d+$/, e_ = /^-?\d+(\.\d+)?$/, Rs = (e) => Xh.test(e), t_ = (e) =>
|
|
|
6045
6045
|
className: `${fn.divider} ${r ? fn.row : fn.column}`,
|
|
6046
6046
|
style: {
|
|
6047
6047
|
borderBottom: r && `${e}px solid ${v.gray300}`,
|
|
6048
|
-
borderRight: !r && `${e}px solid ${v.gray300}
|
|
6048
|
+
borderRight: !r && `${e}px solid ${v.gray300}`,
|
|
6049
|
+
width: r && "100%",
|
|
6050
|
+
height: !r && "100%"
|
|
6049
6051
|
}
|
|
6050
6052
|
}
|
|
6051
6053
|
);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "enerdot-front-system",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "0.0.29-beta.
|
|
4
|
+
"version": "0.0.29-beta.7",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"enerdot-front-system",
|
|
@@ -27,8 +27,8 @@
|
|
|
27
27
|
"lint": "eslint .",
|
|
28
28
|
"preview": "vite preview",
|
|
29
29
|
"prepare": "rm -rf dist && tsc && vite build",
|
|
30
|
-
"add:package": "yarn add ./enerdot-front-system-v0.0.29-beta.
|
|
31
|
-
"reset:package": "yarn remove enerdot-front-system && yarn cache clean && rm -rf ./enerdot-front-system-v0.0.29-beta.
|
|
30
|
+
"add:package": "yarn add ./enerdot-front-system-v0.0.29-beta.7.tgz",
|
|
31
|
+
"reset:package": "yarn remove enerdot-front-system && yarn cache clean && rm -rf ./enerdot-front-system-v0.0.29-beta.7.tgz"
|
|
32
32
|
},
|
|
33
33
|
"exports": {
|
|
34
34
|
".": {
|
|
@@ -68,5 +68,6 @@
|
|
|
68
68
|
"vite": "^6.0.5",
|
|
69
69
|
"vite-plugin-css-injected-by-js": "^3.5.2",
|
|
70
70
|
"vite-plugin-dts": "^4.4.0"
|
|
71
|
-
}
|
|
71
|
+
},
|
|
72
|
+
"dependencies": {}
|
|
72
73
|
}
|