forstok-ui-lib 5.2.43 → 5.2.44
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.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/components/date/daterange.tsx +1 -0
package/dist/index.mjs
CHANGED
|
@@ -1119,7 +1119,7 @@ r.version="2.30.1",i(Qn),r.fn=co,r.min=$n,r.max=er,r.now=tr,r.utc=p,r.unix=lo,r.
|
|
|
1119
1119
|
`,xp=g.div`
|
|
1120
1120
|
display: flex;
|
|
1121
1121
|
padding: 0 0 0 12px;
|
|
1122
|
-
`,bp=({mode:e="default",placeholder:t,startDate:i,endDate:a,rangeDate:s,minDate:c,evModDate:l,portalId:u,isForceUpdate:d,setForceUpdate:h,isCheckType:f,size:p})=>{const g=t||_f.placeholder,m=s||_f.rangeDate,y=i||_f.startDate,x=a||_f.endDate,b=c||_f.minDate,[v,C]=n(!1),[A,w]=n(0),[B,I]=n(!1),[F,D]=n(y),[k,S]=n(x),[O,M]=n(m),N=o(null),T=o(null),L=Xf.extendMoment(Wf),G=()=>{C(!1)};r((()=>{if(A&&"filter"===e&&B){const e=N.current&&N.current?N.current.getBoundingClientRect().x:0;w(e),I(!0)}d&&(y&&D(y),x&&S(x),m&&M(m),h&&h(!1))}),[A,B,e,d,h,y,x,m]);const Y=e=>{const t=e.target.dataset.type||"";let n="",r=L().clone().format("YYYY-MM-DD");switch(t){case"today":n=L().clone().format("YYYY-MM-DD");break;case"lastweek":n=L().clone().subtract(6,"days").format("YYYY-MM-DD");break;case"lastsecondweek":n=L().clone().subtract(13,"days").format("YYYY-MM-DD");break;case"lastmonth":n=L().clone().subtract(29,"days").format("YYYY-MM-DD");break;case"lastquart":n=L().clone().subtract(89,"days").format("YYYY-MM-DD");break;default:n="",r=""}D(n),S(r),M(t),l(n,r,t,G)},P=L(y,"YYYY-MM-DD"),R=L(x,"YYYY-MM-DD"),W=L(b,"YYYY-MM-DD").format("YYYY-MM-DD"),X=L(F,"YYYY-MM-DD").startOf("day"),V=L(k,"YYYY-MM-DD").endOf("day"),z=b?new Date(W):null,_=v?"is-shown":"";let H;F&&k?H=L.range(X,V):y&&x?H=L.range(L(y,"YYYY-MM-DD").startOf("day"),L(x,"YYYY-MM-DD").endOf("day")):m&&(H=L.range(L().clone().subtract(zf(m),"days").startOf("day"),L().clone().endOf("day")));const Z=E.jsxs(ap,{$mode:e,style:{left:"-"+A+"px"},children:[E.jsxs(fp,{children:[E.jsxs(pp,{children:[E.jsx(gp,{"data-type":"today",$activated:"today"===O,onClick:Y,"data-qa-id":"daterange-picker-today",children:"Today"}),E.jsx(gp,{"data-type":"lastweek",$activated:"lastweek"===O,onClick:Y,"data-qa-id":"daterange-picker-7d",children:"Last 7 days"}),E.jsx(gp,{"data-type":"lastsecondweek",$activated:"lastsecondweek"===O,onClick:Y,"data-qa-id":"daterange-picker-14d",children:"Last 14 days"}),E.jsx(gp,{"data-type":"lastmonth",$activated:"lastmonth"===O,onClick:Y,"data-qa-id":"daterange-picker-30d",children:"Last 30 days"}),E.jsx(gp,{"data-type":"lastquart",$activated:"lastquart"===O,onClick:Y,"data-qa-id":"daterange-picker-90d",children:"Last 90 days"}),E.jsx(gp,{"data-type":"custom",$activated:"custom"===O,"data-qa-id":"daterange-picker-custom",children:"Custom Range"})]}),E.jsx(Rf,Object.assign({numberOfCalendars:2,onSelect:e=>{const t=e.start.format("YYYY-MM-DD"),n=e.end.format("YYYY-MM-DD");D(t),S(n),M("custom")},selectionType:"range",maximumDate:new Date,value:H,initialMonth:L().add(-1,"month").month(),initialYear:L().add(0,"year").year(),singleDateRange:!0},z&&{minimumDate:z}))]}),E.jsxs(mp,{children:[E.jsx(j,{children:F&&k?X.format("LL")+" - "+V.format("LL"):" "}),E.jsxs("div",{children:[E.jsx(xe,{$mode:"white",$size:"small",onClick:()=>{C(!1)},"data-qa-id":"daterange-picker-cancel",children:"Cancel"}),E.jsx(xe,{$mode:"red",$size:"small",onClick:()=>{let e="",t="";F&&k?(e=F,t=k):m?(e=L().clone().subtract(zf(m),"days").format("YYYY-MM-DD"),t=L().clone().format("YYYY-MM-DD")):y&&x&&(e=y,t=x),l(e,t,"custom",G)},"data-qa-id":"daterange-picker-apply",children:"Apply"})]})]})]});return E.jsxs(cp,{className:"_refContainer "+_,$mode:e,ref:N,"data-qa-id":"daterange-picker",children:[E.jsx(sp,{ref:T,onClick:e=>{const t=T&&T.current?T.current:null,n=t&&e.target.closest(`.${t.classList[0]}`);if(!n)return;const r=n.closest("._refContainer"),i=r.classList.contains("is-shown"),o=r.getBoundingClientRect();if(!i){const e=document.getElementsByClassName("_refContainer is-shown");if(e.length)for(var a=0;a<e.length;a++)e[a].classList.remove("is-shown");setTimeout((()=>{if(u){const t=document.getElementsByClassName("._refDateRangePickerPortal is-shown");if(t.length)for(var e=0;e<t.length;e++)t[e].classList.remove("is-shown"),t[e].style.left="0",t[e].style.top="0"}}),10)}C(!i),i?(r&&r.classList.remove("is-shown"),setTimeout((()=>{if(u){const e=document.querySelector("._refDateRangePickerPortal");e&&(e.classList.remove("is-shown"),e.style.left="0",e.style.top="0")}}),10)):(D(y||""),S(x||""),M(m||""),r&&r.classList.add("is-shown"),setTimeout((()=>{if(u){const e=document.querySelector("._refDateRangePickerPortal");e&&(o&&(e.style.left=o.left+"px",e.style.top=o.top+o.height+"px"),e.classList.add("is-shown"))}}),10))},$mode:e,$size:p,children:"filterorder"===e||"filterordertofulfill"===e||"filterdashboard"===e?E.jsx(xe,{$iconLeft:"calendar",$mode:"nude",$isIndicatorArrow:!0,isIndicatorArrowColor:"#494949",children:y&&x&&"custom"===m?P.format("MMM D, YYYY")+" - "+R.format("MMM D, YYYY"):m?Vf(m):g}):E.jsxs(E.Fragment,{children:["filter"===e?E.jsx(pe,{name:"checkbox-date",id:"checkbox-date",className:"_refCheckboxContainer",defaultChecked:f,disabled:!0}):null,"popuppayment"===e?E.jsx(xp,{children:E.jsx(De,{$name:"calendar",$width:"14px"})}):null,E.jsx(lp,{children:E.jsx(up,{$size:p,children:y&&x&&"custom"===m?P.format("LL")+" - "+R.format("LL"):m?Vf(m):g})}),E.jsx(dp,{children:E.jsx(hp,{height:"20",width:"20",viewBox:"0 0 20 20","aria-hidden":"true",focusable:"false",children:E.jsx("path",{d:"M4.516 7.548c0.436-0.446 1.043-0.481 1.576 0l3.908 3.747 3.908-3.747c0.533-0.481 1.141-0.446 1.574 0 0.436 0.445 0.408 1.197 0 1.615-0.406 0.418-4.695 4.502-4.695 4.502-0.217 0.223-0.502 0.335-0.787 0.335s-0.57-0.112-0.789-0.335c0 0-4.287-4.084-4.695-4.502s-0.436-1.17 0-1.615z"})})})]})}),v&&(u?E.jsx(ke,{children:E.jsx(yp,{className:"_refDateRangePickerPortal",children:Z})}):Z)]})},vp=g.div`
|
|
1122
|
+
`,bp=({mode:e="default",placeholder:t,startDate:i,endDate:a,rangeDate:s,minDate:c,evModDate:l,portalId:u,isForceUpdate:d,setForceUpdate:h,isCheckType:f,size:p})=>{const g=t||_f.placeholder,m=s||_f.rangeDate,y=i||_f.startDate,x=a||_f.endDate,b=c||_f.minDate,[v,C]=n(!1),[A,w]=n(0),[B,I]=n(!1),[F,D]=n(y),[k,S]=n(x),[O,M]=n(m),N=o(null),T=o(null),L=Xf.extendMoment(Wf),G=()=>{C(!1)};r((()=>{if(A&&"filter"===e&&B){const e=N.current&&N.current?N.current.getBoundingClientRect().x:0;w(e),I(!0)}d&&(y&&D(y),x&&S(x),m&&M(m),h&&h(!1))}),[A,B,e,d,h,y,x,m]);const Y=e=>{const t=e.target.dataset.type||"";let n="",r=L().clone().format("YYYY-MM-DD");switch(t){case"today":n=L().clone().format("YYYY-MM-DD");break;case"lastweek":n=L().clone().subtract(6,"days").format("YYYY-MM-DD");break;case"lastsecondweek":n=L().clone().subtract(13,"days").format("YYYY-MM-DD");break;case"lastmonth":n=L().clone().subtract(29,"days").format("YYYY-MM-DD");break;case"lastquart":n=L().clone().subtract(89,"days").format("YYYY-MM-DD");break;default:n="",r=""}D(n),S(r),M(t),l(n,r,t,G)},P=L(y,"YYYY-MM-DD"),R=L(x,"YYYY-MM-DD"),W=L(b,"YYYY-MM-DD").format("YYYY-MM-DD"),X=L(F,"YYYY-MM-DD").startOf("day"),V=L(k,"YYYY-MM-DD").endOf("day"),z=b?new Date(W):null,_=v?"is-shown":"";let H;F&&k?H=L.range(X,V):y&&x?H=L.range(L(y,"YYYY-MM-DD").startOf("day"),L(x,"YYYY-MM-DD").endOf("day")):m&&(H=L.range(L().clone().subtract(zf(m),"days").startOf("day"),L().clone().endOf("day")));const Z=E.jsxs(ap,{$mode:e,style:{left:"-"+A+"px"},children:[E.jsxs(fp,{children:[E.jsxs(pp,{children:[E.jsx(gp,{"data-type":"today",$activated:"today"===O,onClick:Y,"data-qa-id":"daterange-picker-today",children:"Today"}),E.jsx(gp,{"data-type":"lastweek",$activated:"lastweek"===O,onClick:Y,"data-qa-id":"daterange-picker-7d",children:"Last 7 days"}),E.jsx(gp,{"data-type":"lastsecondweek",$activated:"lastsecondweek"===O,onClick:Y,"data-qa-id":"daterange-picker-14d",children:"Last 14 days"}),E.jsx(gp,{"data-type":"lastmonth",$activated:"lastmonth"===O,onClick:Y,"data-qa-id":"daterange-picker-30d",children:"Last 30 days"}),E.jsx(gp,{"data-type":"lastquart",$activated:"lastquart"===O,onClick:Y,"data-qa-id":"daterange-picker-90d",children:"Last 90 days"}),E.jsx(gp,{"data-type":"custom",$activated:"custom"===O,"data-qa-id":"daterange-picker-custom",children:"Custom Range"})]}),E.jsx(Rf,Object.assign({bemNamespace:"DateRangePicker",numberOfCalendars:2,onSelect:e=>{const t=e.start.format("YYYY-MM-DD"),n=e.end.format("YYYY-MM-DD");D(t),S(n),M("custom")},selectionType:"range",maximumDate:new Date,value:H,initialMonth:L().add(-1,"month").month(),initialYear:L().add(0,"year").year(),singleDateRange:!0},z&&{minimumDate:z}))]}),E.jsxs(mp,{children:[E.jsx(j,{children:F&&k?X.format("LL")+" - "+V.format("LL"):" "}),E.jsxs("div",{children:[E.jsx(xe,{$mode:"white",$size:"small",onClick:()=>{C(!1)},"data-qa-id":"daterange-picker-cancel",children:"Cancel"}),E.jsx(xe,{$mode:"red",$size:"small",onClick:()=>{let e="",t="";F&&k?(e=F,t=k):m?(e=L().clone().subtract(zf(m),"days").format("YYYY-MM-DD"),t=L().clone().format("YYYY-MM-DD")):y&&x&&(e=y,t=x),l(e,t,"custom",G)},"data-qa-id":"daterange-picker-apply",children:"Apply"})]})]})]});return E.jsxs(cp,{className:"_refContainer "+_,$mode:e,ref:N,"data-qa-id":"daterange-picker",children:[E.jsx(sp,{ref:T,onClick:e=>{const t=T&&T.current?T.current:null,n=t&&e.target.closest(`.${t.classList[0]}`);if(!n)return;const r=n.closest("._refContainer"),i=r.classList.contains("is-shown"),o=r.getBoundingClientRect();if(!i){const e=document.getElementsByClassName("_refContainer is-shown");if(e.length)for(var a=0;a<e.length;a++)e[a].classList.remove("is-shown");setTimeout((()=>{if(u){const t=document.getElementsByClassName("._refDateRangePickerPortal is-shown");if(t.length)for(var e=0;e<t.length;e++)t[e].classList.remove("is-shown"),t[e].style.left="0",t[e].style.top="0"}}),10)}C(!i),i?(r&&r.classList.remove("is-shown"),setTimeout((()=>{if(u){const e=document.querySelector("._refDateRangePickerPortal");e&&(e.classList.remove("is-shown"),e.style.left="0",e.style.top="0")}}),10)):(D(y||""),S(x||""),M(m||""),r&&r.classList.add("is-shown"),setTimeout((()=>{if(u){const e=document.querySelector("._refDateRangePickerPortal");e&&(o&&(e.style.left=o.left+"px",e.style.top=o.top+o.height+"px"),e.classList.add("is-shown"))}}),10))},$mode:e,$size:p,children:"filterorder"===e||"filterordertofulfill"===e||"filterdashboard"===e?E.jsx(xe,{$iconLeft:"calendar",$mode:"nude",$isIndicatorArrow:!0,isIndicatorArrowColor:"#494949",children:y&&x&&"custom"===m?P.format("MMM D, YYYY")+" - "+R.format("MMM D, YYYY"):m?Vf(m):g}):E.jsxs(E.Fragment,{children:["filter"===e?E.jsx(pe,{name:"checkbox-date",id:"checkbox-date",className:"_refCheckboxContainer",defaultChecked:f,disabled:!0}):null,"popuppayment"===e?E.jsx(xp,{children:E.jsx(De,{$name:"calendar",$width:"14px"})}):null,E.jsx(lp,{children:E.jsx(up,{$size:p,children:y&&x&&"custom"===m?P.format("LL")+" - "+R.format("LL"):m?Vf(m):g})}),E.jsx(dp,{children:E.jsx(hp,{height:"20",width:"20",viewBox:"0 0 20 20","aria-hidden":"true",focusable:"false",children:E.jsx("path",{d:"M4.516 7.548c0.436-0.446 1.043-0.481 1.576 0l3.908 3.747 3.908-3.747c0.533-0.481 1.141-0.446 1.574 0 0.436 0.445 0.408 1.197 0 1.615-0.406 0.418-4.695 4.502-4.695 4.502-0.217 0.223-0.502 0.335-0.787 0.335s-0.57-0.112-0.789-0.335c0 0-4.287-4.084-4.695-4.502s-0.436-1.17 0-1.615z"})})})]})}),v&&(u?E.jsx(ke,{children:E.jsx(yp,{className:"_refDateRangePickerPortal",children:Z})}):Z)]})},vp=g.div`
|
|
1123
1123
|
display: grid;
|
|
1124
1124
|
`,Cp=({dateTimeData:e})=>{const t=Wf(e,"YYYY-MM-DD HH:mm:ss ZZ").format("D MMM YYYY,"),n=Wf(e,"YYYY-MM-DD HH:mm:ss ZZ").format("hh:mm A");return E.jsx(vp,{children:e?E.jsxs(E.Fragment,{children:[E.jsx("span",{children:t}),E.jsx("span",{children:n})]}):"-"})},Ap=m`
|
|
1125
1125
|
display: grid;
|