zaman-backoffice 1.2.3 → 1.2.5
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 +36 -21
- package/dist/index.js +58 -43
- package/dist/packages/Calendar/Calendar.d.ts +9 -4
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
@@ -39,14 +39,14 @@
|
|
39
39
|
z-index: -10;
|
40
40
|
background-color: rgba(86, 86, 86, 0.4);
|
41
41
|
}
|
42
|
-
`,_=n=>{const{open:r,toggleOpen:o,children:a}=n;return!1===r?null:e.createElement(e.Fragment,null,t.createPortal(e.createElement(Y,{className:"rdp__modal"},a,e.createElement("div",{"data-testid":"overlay",className:"rdp__overlay",onClick:o})),document.body))},C=t=>{const{position:n="right"}=t;if(!t.showCalendar)return null;const{matches:r}=window.matchMedia("(min-width: 640px)");return r?e.createElement(S,{destinationRef:t.destinationRef,position:n},t.children):e.createElement(_,{toggleOpen:t.toggleOpen,open:t.showCalendar},t.children)}
|
42
|
+
`,_=n=>{const{open:r,toggleOpen:o,children:a}=n;return!1===r?null:e.createElement(e.Fragment,null,t.createPortal(e.createElement(Y,{className:"rdp__modal"},a,e.createElement("div",{"data-testid":"overlay",className:"rdp__overlay",onClick:o})),document.body))},C=t=>{const{position:n="right"}=t;if(!t.showCalendar)return null;const{matches:r}=window.matchMedia("(min-width: 640px)");return r?e.createElement(S,{destinationRef:t.destinationRef,position:n},t.children):e.createElement(_,{toggleOpen:t.toggleOpen,open:t.showCalendar},t.children)};const O={thin:{wrapper:0,calendarItem:0},x1:{wrapper:8,calendarItem:4},x2:{wrapper:16,calendarItem:8},x3:{wrapper:24,calendarItem:16},x4:{wrapper:24,calendarItem:20}},T=n.div`
|
43
43
|
overflow: hidden;
|
44
44
|
position: relative;
|
45
45
|
width: ${$}px;
|
46
46
|
height: ${372}px;
|
47
47
|
border: 1px solid ${e=>e.theme.colors.gray[40]};
|
48
48
|
background-color: #fff;
|
49
|
-
border-radius: ${e=>
|
49
|
+
border-radius: ${e=>O[e.theme.round].wrapper}px;
|
50
50
|
`,L=n.div`
|
51
51
|
display: flex;
|
52
52
|
position: absolute;
|
@@ -59,10 +59,10 @@
|
|
59
59
|
flex-direction: column;
|
60
60
|
width: ${$}px;
|
61
61
|
gap: 4px;
|
62
|
-
`,
|
62
|
+
`,I=n.div`
|
63
63
|
display: flex;
|
64
64
|
gap: 4px;
|
65
|
-
`,
|
65
|
+
`,H=n.div`
|
66
66
|
display: flex;
|
67
67
|
justify-content: center;
|
68
68
|
align-items: center;
|
@@ -82,13 +82,13 @@
|
|
82
82
|
transition: background-color 0.2s ease-in;
|
83
83
|
color: ${e=>e.theme.colors.primary[50]};
|
84
84
|
background-color: transparent;
|
85
|
-
border-radius: ${e=>
|
85
|
+
border-radius: ${e=>O[e.theme.round].calendarItem}px;
|
86
86
|
|
87
87
|
&:hover,
|
88
88
|
&:focus {
|
89
89
|
background-color: ${e=>e.theme.colors.primary[90]};
|
90
90
|
}
|
91
|
-
`,B={localeDefault:"en",setLocale(e){null!=e&&(this.localeDefault=e)},get locale(){return this.localeDefault}},F=()=>{if(""!==document.dir)return"rtl"===document.dir;const{body:e}=document;return"rtl"===getComputedStyle(e).direction},
|
91
|
+
`,B={localeDefault:"en",setLocale(e){null!=e&&(this.localeDefault=e)},get locale(){return this.localeDefault}},F=()=>{if(""!==document.dir)return"rtl"===document.dir;const{body:e}=document;return"rtl"===getComputedStyle(e).direction},P=e=>{if("test"===process.env.NODE_ENV)return e;const{locale:t}=B;return Number(e).toLocaleString(t,{useGrouping:!1})},A=()=>e.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"feather feather-chevron-right",style:{transform:F()?"unset":"rotate(180deg)"}},e.createElement("polyline",{points:"9 18 15 12 9 6"})),R=()=>e.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"feather feather-chevron-left",style:{transform:F()?"unset":"rotate(180deg)"}},e.createElement("polyline",{points:"15 18 9 12 15 6"})),W=n.div`
|
92
92
|
display: flex;
|
93
93
|
justify-content: space-between;
|
94
94
|
align-items: center;
|
@@ -109,7 +109,7 @@
|
|
109
109
|
padding: 8px 16px;
|
110
110
|
font-weight: 500;
|
111
111
|
transition: background-color 0.2s ease-in;
|
112
|
-
border-radius: ${e=>
|
112
|
+
border-radius: ${e=>O[e.theme.round].calendarItem}px;
|
113
113
|
|
114
114
|
&:hover,
|
115
115
|
&:focus {
|
@@ -122,7 +122,7 @@
|
|
122
122
|
font-size: 14px;
|
123
123
|
width: 40px;
|
124
124
|
color: #8c8c8c;
|
125
|
-
`,X=t=>e.createElement(W,{className:"zm-Header"},e.createElement(j,{"aria-label":"Previous month",onClick:t.onPrevClick,className:"zm-IconPrevButton",tabIndex:0},e.createElement(R,null)),e.createElement(z,{className:"zm-MonthYearButton",role:"presentation",onClick:t.onClickOnTitle,"aria-label":"calendar view is open, switch to year and month view",tabIndex:0},t.monthName),e.createElement(j,{"aria-label":"Next month",onClick:t.onNextClick,className:"zm-IconNextButton",tabIndex:0},e.createElement(P,null)));var q={exports:{}};q.exports=function(){var e=1e3,t=6e4,n=36e5,r="millisecond",o="second",a="minute",i="hour",s="day",l="week",c="month",u="quarter",d="year",m="date",f="Invalid Date",h=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,p=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,y={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(e){var t=["th","st","nd","rd"],n=e%100;return"["+e+(t[(n-20)%10]||t[n]||t[0])+"]"}},g=function(e,t,n){var r=String(e);return!r||r.length>=t?e:""+Array(t+1-r.length).join(n)+e},v={s:g,z:function(e){var t=-e.utcOffset(),n=Math.abs(t),r=Math.floor(n/60),o=n%60;return(t<=0?"+":"-")+g(r,2,"0")+":"+g(o,2,"0")},m:function e(t,n){if(t.date()<n.date())return-e(n,t);var r=12*(n.year()-t.year())+(n.month()-t.month()),o=t.clone().add(r,c),a=n-o<0,i=t.clone().add(r+(a?-1:1),c);return+(-(r+(n-o)/(a?o-i:i-o))||0)},a:function(e){return e<0?Math.ceil(e)||0:Math.floor(e)},p:function(e){return{M:c,y:d,w:l,d:s,D:m,h:i,m:a,s:o,ms:r,Q:u}[e]||String(e||"").toLowerCase().replace(/s$/,"")},u:function(e){return void 0===e}},b="en",x={};x[b]=y;var $="$isDayjsObject",M=function(e){return e instanceof E||!(!e||!e[$])},w=function e(t,n,r){var o;if(!t)return b;if("string"==typeof t){var a=t.toLowerCase();x[a]&&(o=a),n&&(x[a]=n,o=a);var i=t.split("-");if(!o&&i.length>1)return e(i[0])}else{var s=t.name;x[s]=t,o=s}return!r&&o&&(b=o),o||!r&&b},k=function(e,t){if(M(e))return e.clone();var n="object"==typeof t?t:{};return n.date=e,n.args=arguments,new E(n)},D=v;D.l=w,D.i=M,D.w=function(e,t){return k(e,{locale:t.$L,utc:t.$u,x:t.$x,$offset:t.$offset})};var E=function(){function y(e){this.$L=w(e.locale,null,!0),this.parse(e),this.$x=this.$x||e.x||{},this[$]=!0}var g=y.prototype;return g.parse=function(e){this.$d=function(e){var t=e.date,n=e.utc;if(null===t)return new Date(NaN);if(D.u(t))return new Date;if(t instanceof Date)return new Date(t);if("string"==typeof t&&!/Z$/i.test(t)){var r=t.match(h);if(r){var o=r[2]-1||0,a=(r[7]||"0").substring(0,3);return n?new Date(Date.UTC(r[1],o,r[3]||1,r[4]||0,r[5]||0,r[6]||0,a)):new Date(r[1],o,r[3]||1,r[4]||0,r[5]||0,r[6]||0,a)}}return new Date(t)}(e),this.init()},g.init=function(){var e=this.$d;this.$y=e.getFullYear(),this.$M=e.getMonth(),this.$D=e.getDate(),this.$W=e.getDay(),this.$H=e.getHours(),this.$m=e.getMinutes(),this.$s=e.getSeconds(),this.$ms=e.getMilliseconds()},g.$utils=function(){return D},g.isValid=function(){return!(this.$d.toString()===f)},g.isSame=function(e,t){var n=k(e);return this.startOf(t)<=n&&n<=this.endOf(t)},g.isAfter=function(e,t){return k(e)<this.startOf(t)},g.isBefore=function(e,t){return this.endOf(t)<k(e)},g.$g=function(e,t,n){return D.u(e)?this[t]:this.set(n,e)},g.unix=function(){return Math.floor(this.valueOf()/1e3)},g.valueOf=function(){return this.$d.getTime()},g.startOf=function(e,t){var n=this,r=!!D.u(t)||t,u=D.p(e),f=function(e,t){var o=D.w(n.$u?Date.UTC(n.$y,t,e):new Date(n.$y,t,e),n);return r?o:o.endOf(s)},h=function(e,t){return D.w(n.toDate()[e].apply(n.toDate("s"),(r?[0,0,0,0]:[23,59,59,999]).slice(t)),n)},p=this.$W,y=this.$M,g=this.$D,v="set"+(this.$u?"UTC":"");switch(u){case d:return r?f(1,0):f(31,11);case c:return r?f(1,y):f(0,y+1);case l:var b=this.$locale().weekStart||0,x=(p<b?p+7:p)-b;return f(r?g-x:g+(6-x),y);case s:case m:return h(v+"Hours",0);case i:return h(v+"Minutes",1);case a:return h(v+"Seconds",2);case o:return h(v+"Milliseconds",3);default:return this.clone()}},g.endOf=function(e){return this.startOf(e,!1)},g.$set=function(e,t){var n,l=D.p(e),u="set"+(this.$u?"UTC":""),f=(n={},n[s]=u+"Date",n[m]=u+"Date",n[c]=u+"Month",n[d]=u+"FullYear",n[i]=u+"Hours",n[a]=u+"Minutes",n[o]=u+"Seconds",n[r]=u+"Milliseconds",n)[l],h=l===s?this.$D+(t-this.$W):t;if(l===c||l===d){var p=this.clone().set(m,1);p.$d[f](h),p.init(),this.$d=p.set(m,Math.min(this.$D,p.daysInMonth())).$d}else f&&this.$d[f](h);return this.init(),this},g.set=function(e,t){return this.clone().$set(e,t)},g.get=function(e){return this[D.p(e)]()},g.add=function(r,u){var m,f=this;r=Number(r);var h=D.p(u),p=function(e){var t=k(f);return D.w(t.date(t.date()+Math.round(e*r)),f)};if(h===c)return this.set(c,this.$M+r);if(h===d)return this.set(d,this.$y+r);if(h===s)return p(1);if(h===l)return p(7);var y=(m={},m[a]=t,m[i]=n,m[o]=e,m)[h]||1,g=this.$d.getTime()+r*y;return D.w(g,this)},g.subtract=function(e,t){return this.add(-1*e,t)},g.format=function(e){var t=this,n=this.$locale();if(!this.isValid())return n.invalidDate||f;var r=e||"YYYY-MM-DDTHH:mm:ssZ",o=D.z(this),a=this.$H,i=this.$m,s=this.$M,l=n.weekdays,c=n.months,u=n.meridiem,d=function(e,n,o,a){return e&&(e[n]||e(t,r))||o[n].slice(0,a)},m=function(e){return D.s(a%12||12,e,"0")},h=u||function(e,t,n){var r=e<12?"AM":"PM";return n?r.toLowerCase():r};return r.replace(p,(function(e,r){return r||function(e){switch(e){case"YY":return String(t.$y).slice(-2);case"YYYY":return D.s(t.$y,4,"0");case"M":return s+1;case"MM":return D.s(s+1,2,"0");case"MMM":return d(n.monthsShort,s,c,3);case"MMMM":return d(c,s);case"D":return t.$D;case"DD":return D.s(t.$D,2,"0");case"d":return String(t.$W);case"dd":return d(n.weekdaysMin,t.$W,l,2);case"ddd":return d(n.weekdaysShort,t.$W,l,3);case"dddd":return l[t.$W];case"H":return String(a);case"HH":return D.s(a,2,"0");case"h":return m(1);case"hh":return m(2);case"a":return h(a,i,!0);case"A":return h(a,i,!1);case"m":return String(i);case"mm":return D.s(i,2,"0");case"s":return String(t.$s);case"ss":return D.s(t.$s,2,"0");case"SSS":return D.s(t.$ms,3,"0");case"Z":return o}return null}(e)||o.replace(":","")}))},g.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},g.diff=function(r,m,f){var h,p=this,y=D.p(m),g=k(r),v=(g.utcOffset()-this.utcOffset())*t,b=this-g,x=function(){return D.m(p,g)};switch(y){case d:h=x()/12;break;case c:h=x();break;case u:h=x()/3;break;case l:h=(b-v)/6048e5;break;case s:h=(b-v)/864e5;break;case i:h=b/n;break;case a:h=b/t;break;case o:h=b/e;break;default:h=b}return f?h:D.a(h)},g.daysInMonth=function(){return this.endOf(c).$D},g.$locale=function(){return x[this.$L]},g.locale=function(e,t){if(!e)return this.$L;var n=this.clone(),r=w(e,t,!0);return r&&(n.$L=r),n},g.clone=function(){return D.w(this.$d,this)},g.toDate=function(){return new Date(this.valueOf())},g.toJSON=function(){return this.isValid()?this.toISOString():null},g.toISOString=function(){return this.$d.toISOString()},g.toString=function(){return this.$d.toUTCString()},y}(),S=E.prototype;return k.prototype=S,[["$ms",r],["$s",o],["$m",a],["$H",i],["$W",s],["$M",c],["$y",d],["$D",m]].forEach((function(e){S[e[1]]=function(t){return this.$g(t,e[0],e[1])}})),k.extend=function(e,t){return e.$i||(e(t,E,k),e.$i=!0),k},k.locale=w,k.isDayjs=M,k.unix=function(e){return k(1e3*e)},k.en=x[b],k.Ls=x,k.p={},k}();var U=q.exports,J=a(U);!function(e){function t(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var n=t(e),r={name:"fa",weekdays:"یکشنبه_دوشنبه_سهشنبه_چهارشنبه_پنجشنبه_جمعه_شنبه".split("_"),weekdaysShort:"یکشنبه_دوشنبه_سهشنبه_چهارشنبه_پنجشنبه_جمعه_شنبه".split("_"),weekdaysMin:"ی_د_س_چ_پ_ج_ش".split("_"),weekStart:6,months:"ژانویه_فوریه_مارس_آوریل_مه_ژوئن_ژوئیه_اوت_سپتامبر_اکتبر_نوامبر_دسامبر".split("_"),monthsShort:"ژانویه_فوریه_مارس_آوریل_مه_ژوئن_ژوئیه_اوت_سپتامبر_اکتبر_نوامبر_دسامبر".split("_"),ordinal:function(e){return e},formats:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},relativeTime:{future:"در %s",past:"%s پیش",s:"چند ثانیه",m:"یک دقیقه",mm:"%d دقیقه",h:"یک ساعت",hh:"%d ساعت",d:"یک روز",dd:"%d روز",M:"یک ماه",MM:"%d ماه",y:"یک سال",yy:"%d سال"}};n.default.locale(r,null,!0)}(U);var Z={exports:{}};Z.exports=function(e,t){t.prototype.weekday=function(e){var t=this.$locale().weekStart||0,n=this.$W,r=(n<t?n+7:n)-t;return this.$utils().u(e)?r:this.subtract(r,"day").add(e,"day")}};var G,Q=a(Z.exports),K={exports:{}},ee=a(K.exports=(G={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},function(e,t,n){var r=t.prototype,o=r.format;n.en.formats=G,r.format=function(e){void 0===e&&(e="YYYY-MM-DDTHH:mm:ssZ");var t=this.$locale().formats,n=function(e,t){return e.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,(function(e,n,r){var o=r&&r.toUpperCase();return n||t[r]||G[r]||t[o].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,(function(e,t,n){return t||n.slice(1)}))}))}(e,void 0===t?{}:t);return o.call(this,n)}}));const te=(e,t,n)=>{const{locale:r}=B,o=Object.assign(Object.assign({},t),null!=n&&{numberingSystem:n});return new Date(e).toLocaleString(r,o)},ne=e=>parseInt(te(e,{day:"numeric"},"latn"),10),re=(e,t)=>te(e,{day:"numeric"},t),oe=(e,t)=>te(e,{year:"numeric"},t),ae=(e,t)=>te(e,{month:"2-digit"},t);var ie={exports:{}};ie.exports=function(e,t,n){t.prototype.isBetween=function(e,t,r,o){var a=n(e),i=n(t),s="("===(o=o||"()")[0],l=")"===o[1];return(s?this.isAfter(a,r):!this.isBefore(a,r))&&(l?this.isBefore(i,r):!this.isAfter(i,r))||(s?this.isBefore(a,r):!this.isAfter(a,r))&&(l?this.isAfter(i,r):!this.isBefore(i,r))}};var se=a(ie.exports);J.extend(se);const le=(e,t)=>ae(e)===ae(t),ce=(e,t)=>void 0!==e&&J(e).isSame(t,"day"),ue=(e,t,n)=>null!==t&&null!==n&&J(e).isBetween(J(t),J(n)),de={MMMM:(e,t)=>te(e,{month:"short"},t),MM:ae,M:ae,YYYY:oe,YY:(e,t)=>te(e,{year:"2-digit"},t),DD:re,D:re},me=/\/|\s|-/,fe=(e,t,n)=>{try{(e=>{const t=e.trimStart().trimEnd().split(me);if(""===e||""===e.trim())throw new Error("format is empty");t.forEach((e=>{if(!(e in de))throw new Error(`format is not valid, format passed is: ${e}`)}))})(t);const r=t.trimStart().trimEnd().split(me),o=t.match(me),a=null!==o?o[0]:"";return r.map((t=>de[t](e,n))).join(a)}catch(e){console.error(e)}return""};J.extend(Q),J.extend(ee);const he=e=>{const{locale:t}=B;J.locale(t);const n=void 0===e?new Date:J(e).toDate(),r=ne(new Date(n)),o=J(new Date(n)).subtract(r-1,"days"),a=o.weekday(),i=J(o).subtract(a,"days"),s=o.add(15,"days"),l=[];let c=J(i.format());for(let e=0;e<=5;e++){const e=[];for(let t=0;t<7;t++){const t=new Date(c.format());e.push({date:t,disabled:!le(o.toDate(),t)}),c=c.add(1,"day")}l.push(e)}return{id:Date.now(),monthName:fe(new Date(n),"MMMM YYYY"),middleOfMonth:s.toDate(),weeks:l}},pe=()=>F()?$:-320,ye=n.div`
|
125
|
+
`,X=t=>e.createElement(W,{className:"zm-Header"},e.createElement(j,{"aria-label":"Previous month",onClick:t.onPrevClick,className:"zm-IconPrevButton",tabIndex:0},e.createElement(A,null)),e.createElement(z,{className:"zm-MonthYearButton",role:"presentation",onClick:t.onClickOnTitle,"aria-label":"calendar view is open, switch to year and month view",tabIndex:0},t.monthName),e.createElement(j,{"aria-label":"Next month",onClick:t.onNextClick,className:"zm-IconNextButton",tabIndex:0},e.createElement(R,null)));var q={exports:{}};q.exports=function(){var e=1e3,t=6e4,n=36e5,r="millisecond",o="second",a="minute",i="hour",s="day",l="week",c="month",u="quarter",d="year",m="date",f="Invalid Date",h=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,p=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,y={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(e){var t=["th","st","nd","rd"],n=e%100;return"["+e+(t[(n-20)%10]||t[n]||t[0])+"]"}},g=function(e,t,n){var r=String(e);return!r||r.length>=t?e:""+Array(t+1-r.length).join(n)+e},v={s:g,z:function(e){var t=-e.utcOffset(),n=Math.abs(t),r=Math.floor(n/60),o=n%60;return(t<=0?"+":"-")+g(r,2,"0")+":"+g(o,2,"0")},m:function e(t,n){if(t.date()<n.date())return-e(n,t);var r=12*(n.year()-t.year())+(n.month()-t.month()),o=t.clone().add(r,c),a=n-o<0,i=t.clone().add(r+(a?-1:1),c);return+(-(r+(n-o)/(a?o-i:i-o))||0)},a:function(e){return e<0?Math.ceil(e)||0:Math.floor(e)},p:function(e){return{M:c,y:d,w:l,d:s,D:m,h:i,m:a,s:o,ms:r,Q:u}[e]||String(e||"").toLowerCase().replace(/s$/,"")},u:function(e){return void 0===e}},b="en",x={};x[b]=y;var $="$isDayjsObject",M=function(e){return e instanceof E||!(!e||!e[$])},w=function e(t,n,r){var o;if(!t)return b;if("string"==typeof t){var a=t.toLowerCase();x[a]&&(o=a),n&&(x[a]=n,o=a);var i=t.split("-");if(!o&&i.length>1)return e(i[0])}else{var s=t.name;x[s]=t,o=s}return!r&&o&&(b=o),o||!r&&b},k=function(e,t){if(M(e))return e.clone();var n="object"==typeof t?t:{};return n.date=e,n.args=arguments,new E(n)},D=v;D.l=w,D.i=M,D.w=function(e,t){return k(e,{locale:t.$L,utc:t.$u,x:t.$x,$offset:t.$offset})};var E=function(){function y(e){this.$L=w(e.locale,null,!0),this.parse(e),this.$x=this.$x||e.x||{},this[$]=!0}var g=y.prototype;return g.parse=function(e){this.$d=function(e){var t=e.date,n=e.utc;if(null===t)return new Date(NaN);if(D.u(t))return new Date;if(t instanceof Date)return new Date(t);if("string"==typeof t&&!/Z$/i.test(t)){var r=t.match(h);if(r){var o=r[2]-1||0,a=(r[7]||"0").substring(0,3);return n?new Date(Date.UTC(r[1],o,r[3]||1,r[4]||0,r[5]||0,r[6]||0,a)):new Date(r[1],o,r[3]||1,r[4]||0,r[5]||0,r[6]||0,a)}}return new Date(t)}(e),this.init()},g.init=function(){var e=this.$d;this.$y=e.getFullYear(),this.$M=e.getMonth(),this.$D=e.getDate(),this.$W=e.getDay(),this.$H=e.getHours(),this.$m=e.getMinutes(),this.$s=e.getSeconds(),this.$ms=e.getMilliseconds()},g.$utils=function(){return D},g.isValid=function(){return!(this.$d.toString()===f)},g.isSame=function(e,t){var n=k(e);return this.startOf(t)<=n&&n<=this.endOf(t)},g.isAfter=function(e,t){return k(e)<this.startOf(t)},g.isBefore=function(e,t){return this.endOf(t)<k(e)},g.$g=function(e,t,n){return D.u(e)?this[t]:this.set(n,e)},g.unix=function(){return Math.floor(this.valueOf()/1e3)},g.valueOf=function(){return this.$d.getTime()},g.startOf=function(e,t){var n=this,r=!!D.u(t)||t,u=D.p(e),f=function(e,t){var o=D.w(n.$u?Date.UTC(n.$y,t,e):new Date(n.$y,t,e),n);return r?o:o.endOf(s)},h=function(e,t){return D.w(n.toDate()[e].apply(n.toDate("s"),(r?[0,0,0,0]:[23,59,59,999]).slice(t)),n)},p=this.$W,y=this.$M,g=this.$D,v="set"+(this.$u?"UTC":"");switch(u){case d:return r?f(1,0):f(31,11);case c:return r?f(1,y):f(0,y+1);case l:var b=this.$locale().weekStart||0,x=(p<b?p+7:p)-b;return f(r?g-x:g+(6-x),y);case s:case m:return h(v+"Hours",0);case i:return h(v+"Minutes",1);case a:return h(v+"Seconds",2);case o:return h(v+"Milliseconds",3);default:return this.clone()}},g.endOf=function(e){return this.startOf(e,!1)},g.$set=function(e,t){var n,l=D.p(e),u="set"+(this.$u?"UTC":""),f=(n={},n[s]=u+"Date",n[m]=u+"Date",n[c]=u+"Month",n[d]=u+"FullYear",n[i]=u+"Hours",n[a]=u+"Minutes",n[o]=u+"Seconds",n[r]=u+"Milliseconds",n)[l],h=l===s?this.$D+(t-this.$W):t;if(l===c||l===d){var p=this.clone().set(m,1);p.$d[f](h),p.init(),this.$d=p.set(m,Math.min(this.$D,p.daysInMonth())).$d}else f&&this.$d[f](h);return this.init(),this},g.set=function(e,t){return this.clone().$set(e,t)},g.get=function(e){return this[D.p(e)]()},g.add=function(r,u){var m,f=this;r=Number(r);var h=D.p(u),p=function(e){var t=k(f);return D.w(t.date(t.date()+Math.round(e*r)),f)};if(h===c)return this.set(c,this.$M+r);if(h===d)return this.set(d,this.$y+r);if(h===s)return p(1);if(h===l)return p(7);var y=(m={},m[a]=t,m[i]=n,m[o]=e,m)[h]||1,g=this.$d.getTime()+r*y;return D.w(g,this)},g.subtract=function(e,t){return this.add(-1*e,t)},g.format=function(e){var t=this,n=this.$locale();if(!this.isValid())return n.invalidDate||f;var r=e||"YYYY-MM-DDTHH:mm:ssZ",o=D.z(this),a=this.$H,i=this.$m,s=this.$M,l=n.weekdays,c=n.months,u=n.meridiem,d=function(e,n,o,a){return e&&(e[n]||e(t,r))||o[n].slice(0,a)},m=function(e){return D.s(a%12||12,e,"0")},h=u||function(e,t,n){var r=e<12?"AM":"PM";return n?r.toLowerCase():r};return r.replace(p,(function(e,r){return r||function(e){switch(e){case"YY":return String(t.$y).slice(-2);case"YYYY":return D.s(t.$y,4,"0");case"M":return s+1;case"MM":return D.s(s+1,2,"0");case"MMM":return d(n.monthsShort,s,c,3);case"MMMM":return d(c,s);case"D":return t.$D;case"DD":return D.s(t.$D,2,"0");case"d":return String(t.$W);case"dd":return d(n.weekdaysMin,t.$W,l,2);case"ddd":return d(n.weekdaysShort,t.$W,l,3);case"dddd":return l[t.$W];case"H":return String(a);case"HH":return D.s(a,2,"0");case"h":return m(1);case"hh":return m(2);case"a":return h(a,i,!0);case"A":return h(a,i,!1);case"m":return String(i);case"mm":return D.s(i,2,"0");case"s":return String(t.$s);case"ss":return D.s(t.$s,2,"0");case"SSS":return D.s(t.$ms,3,"0");case"Z":return o}return null}(e)||o.replace(":","")}))},g.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},g.diff=function(r,m,f){var h,p=this,y=D.p(m),g=k(r),v=(g.utcOffset()-this.utcOffset())*t,b=this-g,x=function(){return D.m(p,g)};switch(y){case d:h=x()/12;break;case c:h=x();break;case u:h=x()/3;break;case l:h=(b-v)/6048e5;break;case s:h=(b-v)/864e5;break;case i:h=b/n;break;case a:h=b/t;break;case o:h=b/e;break;default:h=b}return f?h:D.a(h)},g.daysInMonth=function(){return this.endOf(c).$D},g.$locale=function(){return x[this.$L]},g.locale=function(e,t){if(!e)return this.$L;var n=this.clone(),r=w(e,t,!0);return r&&(n.$L=r),n},g.clone=function(){return D.w(this.$d,this)},g.toDate=function(){return new Date(this.valueOf())},g.toJSON=function(){return this.isValid()?this.toISOString():null},g.toISOString=function(){return this.$d.toISOString()},g.toString=function(){return this.$d.toUTCString()},y}(),S=E.prototype;return k.prototype=S,[["$ms",r],["$s",o],["$m",a],["$H",i],["$W",s],["$M",c],["$y",d],["$D",m]].forEach((function(e){S[e[1]]=function(t){return this.$g(t,e[0],e[1])}})),k.extend=function(e,t){return e.$i||(e(t,E,k),e.$i=!0),k},k.locale=w,k.isDayjs=M,k.unix=function(e){return k(1e3*e)},k.en=x[b],k.Ls=x,k.p={},k}();var U=q.exports,J=a(U);!function(e){function t(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var n=t(e),r={name:"fa",weekdays:"یکشنبه_دوشنبه_سهشنبه_چهارشنبه_پنجشنبه_جمعه_شنبه".split("_"),weekdaysShort:"یکشنبه_دوشنبه_سهشنبه_چهارشنبه_پنجشنبه_جمعه_شنبه".split("_"),weekdaysMin:"ی_د_س_چ_پ_ج_ش".split("_"),weekStart:6,months:"ژانویه_فوریه_مارس_آوریل_مه_ژوئن_ژوئیه_اوت_سپتامبر_اکتبر_نوامبر_دسامبر".split("_"),monthsShort:"ژانویه_فوریه_مارس_آوریل_مه_ژوئن_ژوئیه_اوت_سپتامبر_اکتبر_نوامبر_دسامبر".split("_"),ordinal:function(e){return e},formats:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},relativeTime:{future:"در %s",past:"%s پیش",s:"چند ثانیه",m:"یک دقیقه",mm:"%d دقیقه",h:"یک ساعت",hh:"%d ساعت",d:"یک روز",dd:"%d روز",M:"یک ماه",MM:"%d ماه",y:"یک سال",yy:"%d سال"}};n.default.locale(r,null,!0)}(U);var Z={exports:{}};Z.exports=function(e,t){t.prototype.weekday=function(e){var t=this.$locale().weekStart||0,n=this.$W,r=(n<t?n+7:n)-t;return this.$utils().u(e)?r:this.subtract(r,"day").add(e,"day")}};var G,Q=a(Z.exports),K={exports:{}},ee=a(K.exports=(G={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},function(e,t,n){var r=t.prototype,o=r.format;n.en.formats=G,r.format=function(e){void 0===e&&(e="YYYY-MM-DDTHH:mm:ssZ");var t=this.$locale().formats,n=function(e,t){return e.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,(function(e,n,r){var o=r&&r.toUpperCase();return n||t[r]||G[r]||t[o].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,(function(e,t,n){return t||n.slice(1)}))}))}(e,void 0===t?{}:t);return o.call(this,n)}}));const te=(e,t,n)=>{const{locale:r}=B,o=Object.assign(Object.assign({},t),null!=n&&{numberingSystem:n});return new Date(e).toLocaleString(r,o)},ne=e=>parseInt(te(e,{day:"numeric"},"latn"),10),re=(e,t)=>te(e,{day:"numeric"},t),oe=(e,t)=>te(e,{year:"numeric"},t),ae=(e,t)=>te(e,{month:"2-digit"},t);var ie={exports:{}};ie.exports=function(e,t,n){t.prototype.isBetween=function(e,t,r,o){var a=n(e),i=n(t),s="("===(o=o||"()")[0],l=")"===o[1];return(s?this.isAfter(a,r):!this.isBefore(a,r))&&(l?this.isBefore(i,r):!this.isAfter(i,r))||(s?this.isBefore(a,r):!this.isAfter(a,r))&&(l?this.isAfter(i,r):!this.isBefore(i,r))}};var se=a(ie.exports);J.extend(se);const le=(e,t)=>ae(e)===ae(t),ce=(e,t)=>void 0!==e&&J(e).isSame(t,"day"),ue=(e,t,n)=>null!==t&&null!==n&&J(e).isBetween(J(t),J(n)),de={MMMM:(e,t)=>te(e,{month:"short"},t),MM:ae,M:ae,YYYY:oe,YY:(e,t)=>te(e,{year:"2-digit"},t),DD:re,D:re},me=/\/|\s|-/,fe=(e,t,n)=>{try{(e=>{const t=e.trimStart().trimEnd().split(me);if(""===e||""===e.trim())throw new Error("format is empty");t.forEach((e=>{if(!(e in de))throw new Error(`format is not valid, format passed is: ${e}`)}))})(t);const r=t.trimStart().trimEnd().split(me),o=t.match(me),a=null!==o?o[0]:"";return r.map((t=>de[t](e,n))).join(a)}catch(e){console.error(e)}return""};J.extend(Q),J.extend(ee);const he=e=>{const{locale:t}=B;J.locale(t);const n=void 0===e?new Date:J(e).toDate(),r=ne(new Date(n)),o=J(new Date(n)).subtract(r-1,"days"),a=o.weekday(),i=J(o).subtract(a,"days"),s=o.add(15,"days"),l=[];let c=J(i.format());for(let e=0;e<=5;e++){const e=[];for(let t=0;t<7;t++){const t=new Date(c.format());e.push({date:t,disabled:!le(o.toDate(),t)}),c=c.add(1,"day")}l.push(e)}return{id:Date.now(),monthName:fe(new Date(n),"MMMM YYYY"),middleOfMonth:s.toDate(),weeks:l}},pe=()=>F()?$:-320,ye=n.div`
|
126
126
|
color: inherit;
|
127
127
|
`,ge=n.button`
|
128
128
|
position: relative;
|
@@ -137,7 +137,7 @@
|
|
137
137
|
border: 1px solid transparent;
|
138
138
|
user-select: none;
|
139
139
|
color: ${e=>e.theme.colors.gray[600]};
|
140
|
-
border-radius: ${e=>
|
140
|
+
border-radius: ${e=>O[e.theme.round].calendarItem}px;
|
141
141
|
|
142
142
|
// pseudos
|
143
143
|
&:hover,
|
@@ -163,7 +163,7 @@
|
|
163
163
|
}
|
164
164
|
&:not([data-range='true']) {
|
165
165
|
transition: all 0.1s linear;
|
166
|
-
border-radius: ${e=>
|
166
|
+
border-radius: ${e=>O[e.theme.round].calendarItem}px;
|
167
167
|
}
|
168
168
|
&:not([data-selected='true'])&[data-weekend='true'] {
|
169
169
|
color: #ff4d4d;
|
@@ -179,13 +179,13 @@
|
|
179
179
|
&[data-start-range='true'] {
|
180
180
|
background-color: ${e=>e.theme.colors.primary[40]};
|
181
181
|
color: ${e=>e.theme.colors.gray[0]};
|
182
|
-
border-radius: ${e=>
|
182
|
+
border-radius: ${e=>O[e.theme.round].calendarItem}px;
|
183
183
|
border-color: transparent;
|
184
184
|
}
|
185
185
|
&[data-end-range='true'] {
|
186
186
|
background-color: ${e=>e.theme.colors.primary[40]};
|
187
187
|
color: ${e=>e.theme.colors.gray[0]};
|
188
|
-
border-radius: ${e=>
|
188
|
+
border-radius: ${e=>O[e.theme.round].calendarItem}px;
|
189
189
|
border-color: transparent;
|
190
190
|
}
|
191
191
|
&[data-in-range='true']:before,
|
@@ -222,14 +222,29 @@
|
|
222
222
|
overflow: auto;
|
223
223
|
padding-top: 8px;
|
224
224
|
padding-bottom: 8px;
|
225
|
-
`,Me=t=>{const n=parseInt(fe(t.value,"YYYY","latn"),10),r=e.useMemo((()=>((e,t=80,n=50)=>{const r=parseInt(oe(e,"latn"),10),o=r+n,a=[];for(let e=r-t;e<=o;e++)a.push(e);return a})(t.value)),[]),o=e.useCallback((e=>{if(null===e)return;const t=e.querySelector("button[data-selected=true]");if(null!=t){const{height:n,top:r}=e.getBoundingClientRect(),{top:o}=t.getBoundingClientRect();e.scrollTop=Math.abs(r-o)-n/2}}),[]);return e.createElement($e,{ref:o},r.map((r=>e.createElement(ge,{className:"zm-YearPickerButton",key:r,width:90,height:48,"data-selected":n===r,"aria-selected":n===r,"aria-current":"date",type:"button",tabIndex:0,onClick:()=>t.onYearSelect(r)},
|
225
|
+
`,Me=t=>{const n=parseInt(fe(t.value,"YYYY","latn"),10),r=e.useMemo((()=>((e,t=80,n=50)=>{const r=parseInt(oe(e,"latn"),10),o=r+n,a=[];for(let e=r-t;e<=o;e++)a.push(e);return a})(t.value)),[]),o=e.useCallback((e=>{if(null===e)return;const t=e.querySelector("button[data-selected=true]");if(null!=t){const{height:n,top:r}=e.getBoundingClientRect(),{top:o}=t.getBoundingClientRect();e.scrollTop=Math.abs(r-o)-n/2}}),[]);return e.createElement($e,{ref:o},r.map((r=>e.createElement(ge,{className:"zm-YearPickerButton",key:r,width:90,height:48,"data-selected":n===r,"aria-selected":n===r,"aria-current":"date",type:"button",tabIndex:0,onClick:()=>t.onYearSelect(r)},P(r)))))},we=e=>!0===e.range,ke=t=>{const[n,r]=e.useState(!1),[o,a]=e.useState(void 0!==t.from?new Date(t.from):void 0);console.log(t.controlledRangeValue);const[i,s]=e.useState(void 0!==t.to?new Date(t.to):void 0),l=(e,n)=>{"function"==typeof t.onChange&&we(t)&&null!=e&&null!=n&&t.onChange({from:e,to:n})};return e.useEffect((()=>{null!=t.controlledRangeValue&&(a(t.controlledRangeValue[0]),s(t.controlledRangeValue[1]))}),[t.controlledRangeValue]),{handlers:Object.assign({onClick:e=>!0===t.range?(e=>{const{value:t}=e.currentTarget.dataset;n||(void 0!==t&&(a(new Date(t)),s(null)),r(!0)),n&&null===i&&(void 0!==t&&(s(new Date(t)),l(o,new Date(t))),r(!1)),n&&void 0!==i&&(l(o,i),r(!1))})(e):(e=>{const{value:n,disabled:r}=e.currentTarget.dataset;if(void 0!==n&&"true"!==r)return we(t)||"function"!=typeof t.onChange||t.onChange({value:new Date(n)}),n})(e)},!0===t.range&&{onMouseMove:e=>{const{value:t}=e.currentTarget.dataset;n&&void 0!==t&&J(t).isAfter(J(o))&&s(new Date(t))}}),from:o,to:i}},De=t=>{var{ref:n}=t,r=
|
226
|
+
/*! *****************************************************************************
|
227
|
+
Copyright (c) Microsoft Corporation.
|
228
|
+
|
229
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
230
|
+
purpose with or without fee is hereby granted.
|
231
|
+
|
232
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
233
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
234
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
235
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
236
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
237
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
238
|
+
PERFORMANCE OF THIS SOFTWARE.
|
239
|
+
***************************************************************************** */
|
240
|
+
function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}(t,["ref"]);const{locale:o}=B,{defaultValue:a,weekends:i,controlledValue:s,range:l=!1}=r,c=void 0===a?new Date:a,[u,d]=e.useState("days"),[m,f]=e.useState(void 0!==a?new Date(a):void 0),h=e.useMemo((()=>he(m)),[m]),[p,y]=e.useState([h]),g=e.useRef([]),v=(({daysElementRefs:t,days:n,setDays:r})=>{const o=e.useRef(!1),a=n[0].middleOfMonth,i=e=>requestAnimationFrame((()=>{o.current=!0;const[n,a]=t.current;n.style.transform=`translateX(${pe()}px)`,a.style.transform=`translateX(${pe()}px)`,requestAnimationFrame((()=>{a.style.transition=`transform 250ms ${M}`,a.style.transform="translateX(0px)",n.style.transition=`transform 250ms ${M}`,n.style.transform="translateX(0px)",setTimeout((()=>{r((t=>t.filter((t=>t.id===e.id)))),n.style.transition=null,n.style.transform=null,o.current=!1}),300)}))})),s=e=>{requestAnimationFrame((()=>{o.current=!0;const[n,a]=t.current;n.style.transition=`transform 250ms ${M}`,n.style.transform=`translateX(${pe()}px)`,a.style.transition=`transform 250ms ${M}`,a.style.transform=`translateX(${pe()}px)`,setTimeout((()=>{r((t=>t.filter((t=>t.id===e.id)))),a.style.transition=null,a.style.transform=null,o.current=!1}),300)}))};return{slideToTheNextMonth:()=>{if(o.current)return;const e=J(a).add(1,"month"),t=he(e.toDate());r([...n,t]),s(t)},slideToPrevMonth:()=>{if(o.current)return;const e=J(a).subtract(1,"month"),t=he(e.toDate());r([t,...n]),i(t)},slideToCurrentMonth:()=>{if(o.current)return;const e=ne(new Date);console.log(e);const t=J(new Date).subtract(e-1,"days").add(15,"days");console.log("middle of the month",t.toDate());const l=he(t.toDate());r([...n,l]),J(a).isAfter(t)&&(console.log("we re animating right "),i(l)),J(a.getMonth()).isBefore(t.get("month"))&&(console.log("we re animating left"),s(l))}}})({daysElementRefs:g,days:p,setDays:y}),{from:b,to:x,handlers:$}=ke(r);e.useImperativeHandle(n,(()=>({todayTransitionHandler:()=>v.slideToCurrentMonth()})),[v]),console.log("ref assigned",n);return e.useEffect((()=>{s!==m&&void 0!==s&&f(s)}),[s]),e.createElement(T,{className:null!==r.className?r.className:""},e.createElement(X,{monthName:p[0].monthName,onNextClick:()=>{if("days"===u)return v.slideToTheNextMonth()},onPrevClick:()=>{if("days"===u)return v.slideToPrevMonth()},onClickOnTitle:()=>{d("month"!==u&&"year"!==u?"year":"days")}}),"year"===u?e.createElement(Me,{value:c,onYearSelect:e=>{const t=((e,t)=>{const n=t-parseInt(oe(e,"latn"),10);return n>0?J(e).add(n,"years").toDate():J(e).subtract(Math.abs(n),"years").toDate()})(c,e);y([he(t)]),d("month")}}):null,"month"===u?e.createElement(xe,{value:c,onMonthSelect:e=>{const t=((e,t)=>{const n=t-parseInt(ae(e,"latn"),10);return n>0?J(e).add(n,"months").toDate():J(e).subtract(Math.abs(n),"months").toDate()})(p[0].middleOfMonth,e);y([he(t)]),d("days")}}):null,"days"===u?e.createElement(e.Fragment,null,e.createElement(H,null,ve[o].shortWeekDays.map((t=>e.createElement(V,{key:t.key},t.name)))),e.createElement(L,null,p.map(((t,n)=>e.createElement(N,{key:t.id,className:"item",ref:e=>{g.current[n]=e},role:"rowgroup"},t.weeks.map(((t,n)=>e.createElement(I,{key:n,role:"row","aria-rowindex":n+1},t.map(((t,n)=>e.createElement(ge,Object.assign({key:t.date.getTime(),className:"zm-DaysButton","data-value":t.date,"data-disabled":t.disabled,"data-range":r.range,"data-selected":!l&&ce(m,t.date),"data-start-range":null!=b&&ce(b,t.date),"data-in-range":ue(t.date,b,x),"data-end-range":null!=x&&ce(x,t.date),"data-weekend":null==i?void 0:i.some((e=>e===n)),type:"button",role:"gridcell","aria-colindex":n+1,tabIndex:0,"aria-selected":!l&&ce(c,t.date)},$),e.createElement(ye,{className:"cl-text"},fe(t.date,"DD"))))))))))))):null)};function Ee(t,n){e.useEffect((()=>{function e({target:e}){null==t.current||t.current.contains(e)||n()}return document.addEventListener("mousedown",e),()=>{document.removeEventListener("mousedown",e)}}),[t,n])}De.displayName="Calendar";const Se=(e,t,n)=>`hsl(${e}deg ${t}% ${n}%)`,Ye=e=>{const{h:t,s:n,l:r}=function(e){const t=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);if(null==t)throw new Error("Could not parse Hex Color");const n=parseInt(t[1],16)/255,r=parseInt(t[2],16)/255,o=parseInt(t[3],16)/255,a=Math.max(n,r,o),i=Math.min(n,r,o);let s=(a+i)/2,l=s,c=s;if(a===i)return{h:0,s:0,l:c};const u=a-i;switch(l=c>.5?u/(2-a-i):u/(a+i),a){case n:s=(r-o)/u+(r<o?6:0);break;case r:s=(o-n)/u+2;break;case o:s=(n-r)/u+4}return s/=6,l*=100,l=Math.round(l),c*=100,c=Math.round(c),s=Math.round(360*s),{h:s,s:l,l:c}}(e),o={};return o[40]=Se(t,n,r-10),o[50]=Se(t,n,r),o[85]=Se(t,n,85),o[90]=Se(t,n,90),o[95]=Se(t,n,95),o},_e={0:"#FFFFFF",20:"#F5F5F5",30:"#EBEBEB",40:"#DEDEDE",50:"#BFBFBF",60:"#B0B0B0",70:"#575757",80:"#666666",600:"#2E2E2E"},Ce=t=>{const{accentColor:n=w,locale:o,round:a="thin",direction:i="rtl"}=t;e.useMemo((()=>B.setLocale(o)),[o]);const s={colors:{primary:e.useMemo((()=>Ye(n)),[]),gray:_e},round:a,direction:i};return e.createElement(r.ThemeProvider,{theme:s},t.children)},Oe=n.div`
|
226
241
|
width: 260px;
|
227
242
|
height: 260px;
|
228
243
|
position: relative;
|
229
244
|
z-index: 1;
|
230
245
|
border-radius: 50%;
|
231
246
|
background-color: ${e=>e.theme.colors.primary[95]};
|
232
|
-
`,
|
247
|
+
`,Te=n("div")`
|
233
248
|
left: 50%;
|
234
249
|
width: 1.5px;
|
235
250
|
bottom: 50%;
|
@@ -256,11 +271,11 @@
|
|
256
271
|
display: flex;
|
257
272
|
align-items: center;
|
258
273
|
gap: 8px;
|
259
|
-
`,
|
274
|
+
`,Ie=n.div`
|
260
275
|
padding: 4px 8px;
|
261
|
-
border-radius: ${e=>
|
276
|
+
border-radius: ${e=>O[e.theme.round].calendarItem}px;
|
262
277
|
background-color: ${e=>e.theme.colors.gray[20]};
|
263
|
-
`,
|
278
|
+
`,He=n.div`
|
264
279
|
display: flex;
|
265
280
|
gap: 4px;
|
266
281
|
`,je=n.div`
|
@@ -272,7 +287,7 @@
|
|
272
287
|
&.cl_selected {
|
273
288
|
background-color: ${e=>e.theme.colors.gray[20]};
|
274
289
|
}
|
275
|
-
`;const Be=130,Fe=130,
|
290
|
+
`;const Be=130,Fe=130,Pe=(e,t=30)=>{const{offsetX:n,offsetY:r}=(e=>{const t=e,n=e;let{offsetX:r,offsetY:o}=t.nativeEvent;if(void 0===r){const e=n.currentTarget.getBoundingClientRect();0!==n.changedTouches.length?(r=n.changedTouches[0].clientX-e.left,o=n.changedTouches[0].clientY-e.top):(r=t.clientX-e.left,o=t.clientY-e.top)}return{offsetX:r,offsetY:o}})(e),o=n-Be,a=r-Fe,i=Math.PI-Math.atan2(o,a),s=Math.sqrt(Math.pow(o,2)+Math.pow(a,2));const l=((e,t,n)=>{const r=Math.floor(e*(1/n));return 6===n?r:Math.round(t)>85?0===r?-12:r:0===r?12:r})(57.29577951308232*i,s,t);return{value:l,delta:s}},Ae=[12,1,2,3,4,5,6,7,8,9,10,11],Re=[0,13,14,15,16,17,18,19,20,21,22,23],We=[0,5,10,15,20,25,30,35,40,45,50,55],ze=n("div")`
|
276
291
|
animation: ${D} 0.7s linear alternate;
|
277
292
|
`,Ve=n.span`
|
278
293
|
left: calc(50% - 16px);
|
@@ -288,7 +303,7 @@
|
|
288
303
|
pointer-events: none;
|
289
304
|
color: black;
|
290
305
|
transform: ${e=>`translate(${function(e,t=130,n=20){const r=t-n;return Math.round(r*Math.sin(.5235987755982988*e))}(e.idx,e.clockHalfWidth,e.numbersPadd)}px,\n ${function(e,t=130,n=17){const r=t-n;return-Math.round(r*Math.cos(.5235987755982988*e))+t-n}(e.idx,e.clockHalfWidth,e.numbersPadd)}px)`};
|
291
|
-
`;Ve.defaultProps={clockHalfWidth:130,numbersPadd:24,top:"2%"};const Xe=t=>{const{insideHour:n,hourSelecting:r,clockTime:o}=t;return r?12===o?e.createElement(e.Fragment,null,
|
306
|
+
`;Ve.defaultProps={clockHalfWidth:130,numbersPadd:24,top:"2%"};const Xe=t=>{const{insideHour:n,hourSelecting:r,clockTime:o}=t;return r?12===o?e.createElement(e.Fragment,null,Ae.map(((t,r)=>e.createElement(Ve,{key:t,idx:r,style:{opacity:n?.3:1}},P(t))))):e.createElement(e.Fragment,null,Ae.map(((t,r)=>e.createElement(Ve,{key:t,idx:r,top:"15%",clockHalfWidth:85,numbersPadd:10,style:{opacity:n?1:.3}},P(t)))),Re.map(((t,r)=>e.createElement(Ve,{key:t,idx:r,style:{opacity:n?.3:1}},P(t))))):e.createElement(ze,null,We.map(((t,n)=>e.createElement(Ve,{key:t,idx:n},P(t)))))},qe=n.div`
|
292
307
|
overflow: hidden;
|
293
308
|
position: relative;
|
294
309
|
display: flex;
|
@@ -299,5 +314,5 @@
|
|
299
314
|
min-height: ${372}px;
|
300
315
|
border: 1px solid ${e=>e.theme.colors.gray[40]};
|
301
316
|
background-color: #fff;
|
302
|
-
border-radius: ${e=>
|
303
|
-
`;exports.Calendar=De,exports.CalendarProvider=Ce,exports.DatePicker=t=>{const{defaultValue:n,locale:r="fa",weekends:o=[],direction:a="rtl",accentColor:i,controlledValue:s}=t;e.useMemo((()=>B.setLocale(r)),[r]);const l=e.useRef(null),c=e.useRef(null),[u,d]=e.useState(void 0!==n?new Date(n):void 0),[m,f]=e.useState(!0===t.range&&void 0!==t.from?new Date(t.from):void 0),[h,p]=e.useState(!0===t.range&&void 0!==t.to?new Date(t.to):void 0),[y,g]=e.useState(!1);e.useEffect((()=>{s&&s!==u&&d(s)}),[s]),Ee(c,(()=>g(!1)));const v=()=>{g(!y)},b=e.useMemo((()=>{var e;const n=null!==(e=null==t?void 0:t.customShowDateFormat)&&void 0!==e?e:ve[r].format;return void 0===t.range&&void 0!==u?fe(u,n):(console.log("from >>",m),void 0!==m&&void 0!==h?`\n ${fe(m,n)}\n -\n ${fe(h,n)}\n `:"")}),[u,m,h]);return e.createElement(Ce,{accentColor:i,round:t.round,direction:a},e.createElement("input",Object.assign({ref:l},null==t?void 0:t.inputAttributes,{onClick:v,type:"text",value:b,className:null!==t.inputClass?t.inputClass:"",readOnly:!0})),e.createElement(C,{toggleOpen:v,showCalendar:y,destinationRef:l,position:t.position},e.createElement(De,{defaultValue:u,ref:c,className:t.className,weekends:o,onChange:e=>{if(!0===t.range&&"function"==typeof t.onChange){const n="from"in e?e.from:new Date,r="to"in e?e.to:new Date;f(n),p(r),t.onChange({from:n,to:r})}else if((!1===t.range||void 0===t.range)&&"function"==typeof t.onChange){const n="value"in e?e.value:new Date;d(n),t.onChange({value:n})}},range:t.range,from:!0===t.range?t.from:void 0,to:!0===t.range?t.to:void 0})))},exports.TimePicker=t=>{const{defaultValue:n,onChange:r,round:o="x2",locale:a="fa",clockTime:i=24}=t;e.useMemo((()=>B.setLocale(a)),[a]);const s=e.useRef(null),l=e.useRef(null),[c,u]=e.useState(!1),[d,m]=e.useState("am");Ee(l,(()=>u(!1)));const f=()=>{u(!c)},{hour:h,minute:p,isInsideHour:y,selectingHour:g,handleMouseMove:v,handleMouseUp:b,handleSelecting:x}=(({defaultValue:t,clockTime:n,timeConvention:r,onChange:o})=>{const a=void 0!==t?J(t):J().startOf("date"),[i,s]=e.useState(!1),[l,c]=e.useState(!1),[u,d]=e.useState(!1),m=24===n?"HH":"h",[f,h]=e.useState(parseInt(a.format(m),10)),[p,y]=e.useState(parseInt(a.format("mm"),10)),g=e=>{const{value:t}=
|
317
|
+
border-radius: ${e=>O[e.theme.round].wrapper}px;
|
318
|
+
`;exports.Calendar=De,exports.CalendarProvider=Ce,exports.DatePicker=t=>{const{defaultValue:n,locale:r="fa",weekends:o=[],direction:a="rtl",accentColor:i,controlledValue:s}=t;e.useMemo((()=>B.setLocale(r)),[r]);const l=e.useRef(null),c=e.useRef(null),[u,d]=e.useState(void 0!==n?new Date(n):void 0),[m,f]=e.useState(!0===t.range&&void 0!==t.from?new Date(t.from):void 0),[h,p]=e.useState(!0===t.range&&void 0!==t.to?new Date(t.to):void 0),[y,g]=e.useState(!1);e.useEffect((()=>{s&&s!==u&&d(s)}),[s]),Ee(c,(()=>g(!1)));const v=()=>{g(!y)},b=e.useMemo((()=>{var e;const n=null!==(e=null==t?void 0:t.customShowDateFormat)&&void 0!==e?e:ve[r].format;return void 0===t.range&&void 0!==u?fe(u,n):(console.log("from >>",m),void 0!==m&&void 0!==h?`\n ${fe(m,n)}\n -\n ${fe(h,n)}\n `:"")}),[u,m,h]);return e.createElement(Ce,{accentColor:i,round:t.round,direction:a},e.createElement("input",Object.assign({ref:l},null==t?void 0:t.inputAttributes,{onClick:v,type:"text",value:b,className:null!==t.inputClass?t.inputClass:"",readOnly:!0})),e.createElement(C,{toggleOpen:v,showCalendar:y,destinationRef:l,position:t.position},e.createElement(De,{defaultValue:u,ref:c,className:t.className,weekends:o,onChange:e=>{if(!0===t.range&&"function"==typeof t.onChange){const n="from"in e?e.from:new Date,r="to"in e?e.to:new Date;f(n),p(r),t.onChange({from:n,to:r})}else if((!1===t.range||void 0===t.range)&&"function"==typeof t.onChange){const n="value"in e?e.value:new Date;d(n),t.onChange({value:n})}},range:t.range,from:!0===t.range?t.from:void 0,to:!0===t.range?t.to:void 0})))},exports.TimePicker=t=>{const{defaultValue:n,onChange:r,round:o="x2",locale:a="fa",clockTime:i=24}=t;e.useMemo((()=>B.setLocale(a)),[a]);const s=e.useRef(null),l=e.useRef(null),[c,u]=e.useState(!1),[d,m]=e.useState("am");Ee(l,(()=>u(!1)));const f=()=>{u(!c)},{hour:h,minute:p,isInsideHour:y,selectingHour:g,handleMouseMove:v,handleMouseUp:b,handleSelecting:x}=(({defaultValue:t,clockTime:n,timeConvention:r,onChange:o})=>{const a=void 0!==t?J(t):J().startOf("date"),[i,s]=e.useState(!1),[l,c]=e.useState(!1),[u,d]=e.useState(!1),m=24===n?"HH":"h",[f,h]=e.useState(parseInt(a.format(m),10)),[p,y]=e.useState(parseInt(a.format("mm"),10)),g=e=>{const{value:t}=Pe(e,6);y(t)},v=e=>{const{value:t,delta:r}=Pe(e);24!==n?h(t):Math.round(r)<85?(h(t),d(!0)):(h(t+12),d(!1))};return{hour:f,minute:p,isInsideHour:u,selectingHour:l,handleMouseMove:e=>{if(e.preventDefault(),i)return l?v(e):g(e)},handleMouseUp:()=>{if(l)return"function"==typeof o&&o(Object.assign({hour:f,minute:p},12===n&&{timeConvention:r})),s(!1),c(!1),void d(!1);s(!1),c(!0)},handleSelecting:e=>(s(!0),l?v(e):g(e))}})({defaultValue:n,clockTime:i,timeConvention:d,onChange:r}),$=e.useMemo((()=>`${h}:${p}`),[h,p]);return e.createElement(Ce,{accentColor:t.accentColor,round:o},e.createElement("input",Object.assign({ref:s},null==t?void 0:t.inputAttributes,{onClick:f,type:"text",value:$,className:null!==t.inputClass?t.inputClass:"",readOnly:!0})),e.createElement(C,{toggleOpen:f,showCalendar:c,destinationRef:s},e.createElement(qe,{ref:l},e.createElement(Ne,null,12===i?e.createElement(He,null,e.createElement(je,{className:"am"===d?"cl_selected":"",onClick:()=>m("am")},ve[a].am),e.createElement(je,{className:"pm"===d?"cl_selected":"",onClick:()=>m("pm")},ve[a].pm)):null,e.createElement(Ie,null,P(h),":",P(p))),e.createElement(Oe,{onMouseMove:v,onMouseUp:b,onMouseDown:x,onTouchMove:x,onTouchEnd:b},e.createElement(Te,{value:g?h:p,hour:h,minute:p,isSelectingHour:g,isInsideHour:y},e.createElement(Le,{isSelectingHour:g})),e.createElement(Xe,{insideHour:y,hourSelecting:g,clockTime:i})))))};
|
package/dist/index.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import e,{useRef as t,useEffect as n,useMemo as r,useState as o,
|
1
|
+
import e,{useRef as t,useEffect as n,useMemo as r,useState as o,useImperativeHandle as a}from"react";import{createPortal as i}from"react-dom";import s from"@emotion/styled";import{keyframes as l,ThemeProvider as c}from"@emotion/react";var u="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function d(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var m=/^\s+|\s+$/g,f=/^[-+]0x[0-9a-f]+$/i,h=/^0b[01]+$/i,p=/^0o[0-7]+$/i,y=parseInt,g="object"==typeof u&&u&&u.Object===Object&&u,v="object"==typeof self&&self&&self.Object===Object&&self,b=g||v||Function("return this")(),x=Object.prototype.toString,$=Math.max,w=Math.min,M=function(){return b.Date.now()};function k(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function D(e){if("number"==typeof e)return e;if(function(e){return"symbol"==typeof e||function(e){return!!e&&"object"==typeof e}(e)&&"[object Symbol]"==x.call(e)}(e))return NaN;if(k(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=k(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(m,"");var n=h.test(e);return n||p.test(e)?y(e.slice(2),n?2:8):f.test(e)?NaN:+e}var E=d((function(e,t,n){var r,o,a,i,s,l,c=0,u=!1,d=!1,m=!0;if("function"!=typeof e)throw new TypeError("Expected a function");function f(t){var n=r,a=o;return r=o=void 0,c=t,i=e.apply(a,n)}function h(e){var n=e-l;return void 0===l||n>=t||n<0||d&&e-c>=a}function p(){var e=M();if(h(e))return y(e);s=setTimeout(p,function(e){var n=t-(e-l);return d?w(n,a-(e-c)):n}(e))}function y(e){return s=void 0,m&&r?f(e):(r=o=void 0,i)}function g(){var e=M(),n=h(e);if(r=arguments,o=this,l=e,n){if(void 0===s)return function(e){return c=e,s=setTimeout(p,t),u?f(e):i}(l);if(d)return s=setTimeout(p,t),f(l)}return void 0===s&&(s=setTimeout(p,t)),i}return t=D(t)||0,k(n)&&(u=!!n.leading,a=(d="maxWait"in n)?$(D(n.maxWait)||0,t):a,m="trailing"in n?!!n.trailing:m),g.cancel=function(){void 0!==s&&clearTimeout(s),c=0,r=l=o=s=void 0},g.flush=function(){return void 0===s?i:y(M())},g}));const Y=320,_="cubic-bezier(0.4, 0, 0.2, 1)",C="#0D59F2",S=l`
|
2
2
|
from {
|
3
3
|
visibility: hidden;
|
4
4
|
opacity: 0;
|
@@ -9,17 +9,17 @@ import e,{useRef as t,useEffect as n,useMemo as r,useState as o,forwardRef as a,
|
|
9
9
|
opacity: 1;
|
10
10
|
transform: translateY(0px);
|
11
11
|
}
|
12
|
-
`,O=
|
12
|
+
`,O=l`
|
13
13
|
from {
|
14
14
|
opacity: 0;
|
15
15
|
}
|
16
16
|
to {
|
17
17
|
opacity: 1;
|
18
18
|
}
|
19
|
-
`,
|
19
|
+
`,T=s.div`
|
20
20
|
position: absolute;
|
21
|
-
animation: ${
|
22
|
-
`,
|
21
|
+
animation: ${S} 0.3s ${_} alternate;
|
22
|
+
`,L=r=>{const{children:o,destinationRef:a,position:s}=r,l=t(null),c=()=>{var e;let t=0;if(null!=a&&null!==l){const n=l.current;if(null===n)return;const{top:r,bottom:o,right:i,left:c,width:u}=null===(e=null==a?void 0:a.current)||void 0===e?void 0:e.getBoundingClientRect(),{height:d,width:m}=null==n?void 0:n.getBoundingClientRect();t=window.innerHeight-o>d?o+window.scrollY:r+window.scrollY-d-8,n.style.top=`${t+4}px`;({right:()=>{n.style.right=`${Math.abs(document.body.clientWidth-i)+16}px`},left:()=>{n.style.left=`${c}px`},center:()=>{const e=m>u?0:Math.abs(m-u)/2+16;n.style.right=`${Math.abs(document.body.clientWidth-i)+e}px`}})[s]()}};return n((()=>(c(),window.addEventListener("resize",E(c,500)),()=>{window.removeEventListener("resize",c)})),[a]),e.createElement(e.Fragment,null,i(e.createElement(T,{ref:l},o),document.body))},N=s.div`
|
23
23
|
position: fixed;
|
24
24
|
display: flex;
|
25
25
|
justify-content: center;
|
@@ -39,30 +39,30 @@ import e,{useRef as t,useEffect as n,useMemo as r,useState as o,forwardRef as a,
|
|
39
39
|
z-index: -10;
|
40
40
|
background-color: rgba(86, 86, 86, 0.4);
|
41
41
|
}
|
42
|
-
`,I=t=>{const{open:n,toggleOpen:r,children:o}=t;return!1===n?null:e.createElement(e.Fragment,null,
|
42
|
+
`,I=t=>{const{open:n,toggleOpen:r,children:o}=t;return!1===n?null:e.createElement(e.Fragment,null,i(e.createElement(N,{className:"rdp__modal"},o,e.createElement("div",{"data-testid":"overlay",className:"rdp__overlay",onClick:r})),document.body))},H=t=>{const{position:n="right"}=t;if(!t.showCalendar)return null;const{matches:r}=window.matchMedia("(min-width: 640px)");return r?e.createElement(L,{destinationRef:t.destinationRef,position:n},t.children):e.createElement(I,{toggleOpen:t.toggleOpen,open:t.showCalendar},t.children)};const j={thin:{wrapper:0,calendarItem:0},x1:{wrapper:8,calendarItem:4},x2:{wrapper:16,calendarItem:8},x3:{wrapper:24,calendarItem:16},x4:{wrapper:24,calendarItem:20}},B=s.div`
|
43
43
|
overflow: hidden;
|
44
44
|
position: relative;
|
45
|
-
width: ${
|
45
|
+
width: ${Y}px;
|
46
46
|
height: ${372}px;
|
47
47
|
border: 1px solid ${e=>e.theme.colors.gray[40]};
|
48
48
|
background-color: #fff;
|
49
|
-
border-radius: ${e=>
|
50
|
-
`,
|
49
|
+
border-radius: ${e=>j[e.theme.round].wrapper}px;
|
50
|
+
`,F=s.div`
|
51
51
|
display: flex;
|
52
52
|
position: absolute;
|
53
53
|
overflow: hidden;
|
54
54
|
right: ${e=>"rtl"===e.theme.direction?"8px":"unset"};
|
55
55
|
left: ${e=>"rtl"!==e.theme.direction?"8px":"unset"};
|
56
|
-
`,
|
56
|
+
`,A=s.div`
|
57
57
|
will-change: transform;
|
58
58
|
display: flex;
|
59
59
|
flex-direction: column;
|
60
|
-
width: ${
|
60
|
+
width: ${Y}px;
|
61
61
|
gap: 4px;
|
62
|
-
`,
|
62
|
+
`,W=s.div`
|
63
63
|
display: flex;
|
64
64
|
gap: 4px;
|
65
|
-
`,
|
65
|
+
`,z=s.div`
|
66
66
|
display: flex;
|
67
67
|
justify-content: center;
|
68
68
|
align-items: center;
|
@@ -70,7 +70,7 @@ import e,{useRef as t,useEffect as n,useMemo as r,useState as o,forwardRef as a,
|
|
70
70
|
margin-bottom: 8px;
|
71
71
|
height: 24px;
|
72
72
|
gap: 4px;
|
73
|
-
`,
|
73
|
+
`,P=s.button`
|
74
74
|
cursor: pointer;
|
75
75
|
outline: none;
|
76
76
|
border: none;
|
@@ -82,13 +82,13 @@ import e,{useRef as t,useEffect as n,useMemo as r,useState as o,forwardRef as a,
|
|
82
82
|
transition: background-color 0.2s ease-in;
|
83
83
|
color: ${e=>e.theme.colors.primary[50]};
|
84
84
|
background-color: transparent;
|
85
|
-
border-radius: ${e=>
|
85
|
+
border-radius: ${e=>j[e.theme.round].calendarItem}px;
|
86
86
|
|
87
87
|
&:hover,
|
88
88
|
&:focus {
|
89
89
|
background-color: ${e=>e.theme.colors.primary[90]};
|
90
90
|
}
|
91
|
-
`,
|
91
|
+
`,R={localeDefault:"en",setLocale(e){null!=e&&(this.localeDefault=e)},get locale(){return this.localeDefault}},V=()=>{if(""!==document.dir)return"rtl"===document.dir;const{body:e}=document;return"rtl"===getComputedStyle(e).direction},X=e=>{if("test"===process.env.NODE_ENV)return e;const{locale:t}=R;return Number(e).toLocaleString(t,{useGrouping:!1})},U=()=>e.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"feather feather-chevron-right",style:{transform:V()?"unset":"rotate(180deg)"}},e.createElement("polyline",{points:"9 18 15 12 9 6"})),J=()=>e.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"feather feather-chevron-left",style:{transform:V()?"unset":"rotate(180deg)"}},e.createElement("polyline",{points:"15 18 9 12 15 6"})),Z=s.div`
|
92
92
|
display: flex;
|
93
93
|
justify-content: space-between;
|
94
94
|
align-items: center;
|
@@ -97,7 +97,7 @@ import e,{useRef as t,useEffect as n,useMemo as r,useState as o,forwardRef as a,
|
|
97
97
|
padding-left: 8px;
|
98
98
|
background-color: ${e=>e.theme.colors.primary[95]};
|
99
99
|
border-bottom: 2px solid ${e=>e.theme.colors.primary[85]};
|
100
|
-
`,
|
100
|
+
`,q=s.button`
|
101
101
|
will-change: auto;
|
102
102
|
min-width: 100px;
|
103
103
|
outline: none;
|
@@ -109,22 +109,22 @@ import e,{useRef as t,useEffect as n,useMemo as r,useState as o,forwardRef as a,
|
|
109
109
|
padding: 8px 16px;
|
110
110
|
font-weight: 500;
|
111
111
|
transition: background-color 0.2s ease-in;
|
112
|
-
border-radius: ${e=>
|
112
|
+
border-radius: ${e=>j[e.theme.round].calendarItem}px;
|
113
113
|
|
114
114
|
&:hover,
|
115
115
|
&:focus {
|
116
116
|
background-color: ${e=>e.theme.colors.primary[90]};
|
117
117
|
}
|
118
|
-
`,
|
118
|
+
`,G=s.div`
|
119
119
|
display: flex;
|
120
120
|
justify-content: center;
|
121
121
|
align-items: center;
|
122
122
|
font-size: 14px;
|
123
123
|
width: 40px;
|
124
124
|
color: #8c8c8c;
|
125
|
-
`,K=t=>e.createElement(q,{className:"zm-Header"},e.createElement(R,{"aria-label":"Previous month",onClick:t.onPrevClick,className:"zm-IconPrevButton",tabIndex:0},e.createElement(J,null)),e.createElement(G,{className:"zm-MonthYearButton",role:"presentation",onClick:t.onClickOnTitle,"aria-label":"calendar view is open, switch to year and month view",tabIndex:0},t.monthName),e.createElement(R,{"aria-label":"Next month",onClick:t.onNextClick,className:"zm-IconNextButton",tabIndex:0},e.createElement(Z,null)));var ee={exports:{}};ee.exports=function(){var e=1e3,t=6e4,n=36e5,r="millisecond",o="second",a="minute",i="hour",s="day",l="week",c="month",u="quarter",d="year",m="date",h="Invalid Date",f=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,p=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,y={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(e){var t=["th","st","nd","rd"],n=e%100;return"["+e+(t[(n-20)%10]||t[n]||t[0])+"]"}},g=function(e,t,n){var r=String(e);return!r||r.length>=t?e:""+Array(t+1-r.length).join(n)+e},v={s:g,z:function(e){var t=-e.utcOffset(),n=Math.abs(t),r=Math.floor(n/60),o=n%60;return(t<=0?"+":"-")+g(r,2,"0")+":"+g(o,2,"0")},m:function e(t,n){if(t.date()<n.date())return-e(n,t);var r=12*(n.year()-t.year())+(n.month()-t.month()),o=t.clone().add(r,c),a=n-o<0,i=t.clone().add(r+(a?-1:1),c);return+(-(r+(n-o)/(a?o-i:i-o))||0)},a:function(e){return e<0?Math.ceil(e)||0:Math.floor(e)},p:function(e){return{M:c,y:d,w:l,d:s,D:m,h:i,m:a,s:o,ms:r,Q:u}[e]||String(e||"").toLowerCase().replace(/s$/,"")},u:function(e){return void 0===e}},b="en",x={};x[b]=y;var $="$isDayjsObject",w=function(e){return e instanceof E||!(!e||!e[$])},M=function e(t,n,r){var o;if(!t)return b;if("string"==typeof t){var a=t.toLowerCase();x[a]&&(o=a),n&&(x[a]=n,o=a);var i=t.split("-");if(!o&&i.length>1)return e(i[0])}else{var s=t.name;x[s]=t,o=s}return!r&&o&&(b=o),o||!r&&b},k=function(e,t){if(w(e))return e.clone();var n="object"==typeof t?t:{};return n.date=e,n.args=arguments,new E(n)},D=v;D.l=M,D.i=w,D.w=function(e,t){return k(e,{locale:t.$L,utc:t.$u,x:t.$x,$offset:t.$offset})};var E=function(){function y(e){this.$L=M(e.locale,null,!0),this.parse(e),this.$x=this.$x||e.x||{},this[$]=!0}var g=y.prototype;return g.parse=function(e){this.$d=function(e){var t=e.date,n=e.utc;if(null===t)return new Date(NaN);if(D.u(t))return new Date;if(t instanceof Date)return new Date(t);if("string"==typeof t&&!/Z$/i.test(t)){var r=t.match(f);if(r){var o=r[2]-1||0,a=(r[7]||"0").substring(0,3);return n?new Date(Date.UTC(r[1],o,r[3]||1,r[4]||0,r[5]||0,r[6]||0,a)):new Date(r[1],o,r[3]||1,r[4]||0,r[5]||0,r[6]||0,a)}}return new Date(t)}(e),this.init()},g.init=function(){var e=this.$d;this.$y=e.getFullYear(),this.$M=e.getMonth(),this.$D=e.getDate(),this.$W=e.getDay(),this.$H=e.getHours(),this.$m=e.getMinutes(),this.$s=e.getSeconds(),this.$ms=e.getMilliseconds()},g.$utils=function(){return D},g.isValid=function(){return!(this.$d.toString()===h)},g.isSame=function(e,t){var n=k(e);return this.startOf(t)<=n&&n<=this.endOf(t)},g.isAfter=function(e,t){return k(e)<this.startOf(t)},g.isBefore=function(e,t){return this.endOf(t)<k(e)},g.$g=function(e,t,n){return D.u(e)?this[t]:this.set(n,e)},g.unix=function(){return Math.floor(this.valueOf()/1e3)},g.valueOf=function(){return this.$d.getTime()},g.startOf=function(e,t){var n=this,r=!!D.u(t)||t,u=D.p(e),h=function(e,t){var o=D.w(n.$u?Date.UTC(n.$y,t,e):new Date(n.$y,t,e),n);return r?o:o.endOf(s)},f=function(e,t){return D.w(n.toDate()[e].apply(n.toDate("s"),(r?[0,0,0,0]:[23,59,59,999]).slice(t)),n)},p=this.$W,y=this.$M,g=this.$D,v="set"+(this.$u?"UTC":"");switch(u){case d:return r?h(1,0):h(31,11);case c:return r?h(1,y):h(0,y+1);case l:var b=this.$locale().weekStart||0,x=(p<b?p+7:p)-b;return h(r?g-x:g+(6-x),y);case s:case m:return f(v+"Hours",0);case i:return f(v+"Minutes",1);case a:return f(v+"Seconds",2);case o:return f(v+"Milliseconds",3);default:return this.clone()}},g.endOf=function(e){return this.startOf(e,!1)},g.$set=function(e,t){var n,l=D.p(e),u="set"+(this.$u?"UTC":""),h=(n={},n[s]=u+"Date",n[m]=u+"Date",n[c]=u+"Month",n[d]=u+"FullYear",n[i]=u+"Hours",n[a]=u+"Minutes",n[o]=u+"Seconds",n[r]=u+"Milliseconds",n)[l],f=l===s?this.$D+(t-this.$W):t;if(l===c||l===d){var p=this.clone().set(m,1);p.$d[h](f),p.init(),this.$d=p.set(m,Math.min(this.$D,p.daysInMonth())).$d}else h&&this.$d[h](f);return this.init(),this},g.set=function(e,t){return this.clone().$set(e,t)},g.get=function(e){return this[D.p(e)]()},g.add=function(r,u){var m,h=this;r=Number(r);var f=D.p(u),p=function(e){var t=k(h);return D.w(t.date(t.date()+Math.round(e*r)),h)};if(f===c)return this.set(c,this.$M+r);if(f===d)return this.set(d,this.$y+r);if(f===s)return p(1);if(f===l)return p(7);var y=(m={},m[a]=t,m[i]=n,m[o]=e,m)[f]||1,g=this.$d.getTime()+r*y;return D.w(g,this)},g.subtract=function(e,t){return this.add(-1*e,t)},g.format=function(e){var t=this,n=this.$locale();if(!this.isValid())return n.invalidDate||h;var r=e||"YYYY-MM-DDTHH:mm:ssZ",o=D.z(this),a=this.$H,i=this.$m,s=this.$M,l=n.weekdays,c=n.months,u=n.meridiem,d=function(e,n,o,a){return e&&(e[n]||e(t,r))||o[n].slice(0,a)},m=function(e){return D.s(a%12||12,e,"0")},f=u||function(e,t,n){var r=e<12?"AM":"PM";return n?r.toLowerCase():r};return r.replace(p,(function(e,r){return r||function(e){switch(e){case"YY":return String(t.$y).slice(-2);case"YYYY":return D.s(t.$y,4,"0");case"M":return s+1;case"MM":return D.s(s+1,2,"0");case"MMM":return d(n.monthsShort,s,c,3);case"MMMM":return d(c,s);case"D":return t.$D;case"DD":return D.s(t.$D,2,"0");case"d":return String(t.$W);case"dd":return d(n.weekdaysMin,t.$W,l,2);case"ddd":return d(n.weekdaysShort,t.$W,l,3);case"dddd":return l[t.$W];case"H":return String(a);case"HH":return D.s(a,2,"0");case"h":return m(1);case"hh":return m(2);case"a":return f(a,i,!0);case"A":return f(a,i,!1);case"m":return String(i);case"mm":return D.s(i,2,"0");case"s":return String(t.$s);case"ss":return D.s(t.$s,2,"0");case"SSS":return D.s(t.$ms,3,"0");case"Z":return o}return null}(e)||o.replace(":","")}))},g.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},g.diff=function(r,m,h){var f,p=this,y=D.p(m),g=k(r),v=(g.utcOffset()-this.utcOffset())*t,b=this-g,x=function(){return D.m(p,g)};switch(y){case d:f=x()/12;break;case c:f=x();break;case u:f=x()/3;break;case l:f=(b-v)/6048e5;break;case s:f=(b-v)/864e5;break;case i:f=b/n;break;case a:f=b/t;break;case o:f=b/e;break;default:f=b}return h?f:D.a(f)},g.daysInMonth=function(){return this.endOf(c).$D},g.$locale=function(){return x[this.$L]},g.locale=function(e,t){if(!e)return this.$L;var n=this.clone(),r=M(e,t,!0);return r&&(n.$L=r),n},g.clone=function(){return D.w(this.$d,this)},g.toDate=function(){return new Date(this.valueOf())},g.toJSON=function(){return this.isValid()?this.toISOString():null},g.toISOString=function(){return this.$d.toISOString()},g.toString=function(){return this.$d.toUTCString()},y}(),Y=E.prototype;return k.prototype=Y,[["$ms",r],["$s",o],["$m",a],["$H",i],["$W",s],["$M",c],["$y",d],["$D",m]].forEach((function(e){Y[e[1]]=function(t){return this.$g(t,e[0],e[1])}})),k.extend=function(e,t){return e.$i||(e(t,E,k),e.$i=!0),k},k.locale=M,k.isDayjs=w,k.unix=function(e){return k(1e3*e)},k.en=x[b],k.Ls=x,k.p={},k}();var te=ee.exports,ne=m(te);!function(e){function t(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var n=t(e),r={name:"fa",weekdays:"یکشنبه_دوشنبه_سهشنبه_چهارشنبه_پنجشنبه_جمعه_شنبه".split("_"),weekdaysShort:"یکشنبه_دوشنبه_سهشنبه_چهارشنبه_پنجشنبه_جمعه_شنبه".split("_"),weekdaysMin:"ی_د_س_چ_پ_ج_ش".split("_"),weekStart:6,months:"ژانویه_فوریه_مارس_آوریل_مه_ژوئن_ژوئیه_اوت_سپتامبر_اکتبر_نوامبر_دسامبر".split("_"),monthsShort:"ژانویه_فوریه_مارس_آوریل_مه_ژوئن_ژوئیه_اوت_سپتامبر_اکتبر_نوامبر_دسامبر".split("_"),ordinal:function(e){return e},formats:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},relativeTime:{future:"در %s",past:"%s پیش",s:"چند ثانیه",m:"یک دقیقه",mm:"%d دقیقه",h:"یک ساعت",hh:"%d ساعت",d:"یک روز",dd:"%d روز",M:"یک ماه",MM:"%d ماه",y:"یک سال",yy:"%d سال"}};n.default.locale(r,null,!0)}(te);var re={exports:{}};re.exports=function(e,t){t.prototype.weekday=function(e){var t=this.$locale().weekStart||0,n=this.$W,r=(n<t?n+7:n)-t;return this.$utils().u(e)?r:this.subtract(r,"day").add(e,"day")}};var oe,ae=m(re.exports),ie={exports:{}},se=m(ie.exports=(oe={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},function(e,t,n){var r=t.prototype,o=r.format;n.en.formats=oe,r.format=function(e){void 0===e&&(e="YYYY-MM-DDTHH:mm:ssZ");var t=this.$locale().formats,n=function(e,t){return e.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,(function(e,n,r){var o=r&&r.toUpperCase();return n||t[r]||oe[r]||t[o].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,(function(e,t,n){return t||n.slice(1)}))}))}(e,void 0===t?{}:t);return o.call(this,n)}}));const le=(e,t,n)=>{const{locale:r}=V,o=Object.assign(Object.assign({},t),null!=n&&{numberingSystem:n});return new Date(e).toLocaleString(r,o)},ce=e=>parseInt(le(e,{day:"numeric"},"latn"),10),ue=(e,t)=>le(e,{day:"numeric"},t),de=(e,t)=>le(e,{year:"numeric"},t),me=(e,t)=>le(e,{month:"2-digit"},t);var he={exports:{}};he.exports=function(e,t,n){t.prototype.isBetween=function(e,t,r,o){var a=n(e),i=n(t),s="("===(o=o||"()")[0],l=")"===o[1];return(s?this.isAfter(a,r):!this.isBefore(a,r))&&(l?this.isBefore(i,r):!this.isAfter(i,r))||(s?this.isBefore(a,r):!this.isAfter(a,r))&&(l?this.isAfter(i,r):!this.isBefore(i,r))}};var fe=m(he.exports);ne.extend(fe);const pe=(e,t)=>me(e)===me(t),ye=(e,t)=>void 0!==e&&ne(e).isSame(t,"day"),ge=(e,t,n)=>null!==t&&null!==n&&ne(e).isBetween(ne(t),ne(n)),ve={MMMM:(e,t)=>le(e,{month:"short"},t),MM:me,M:me,YYYY:de,YY:(e,t)=>le(e,{year:"2-digit"},t),DD:ue,D:ue},be=/\/|\s|-/,xe=(e,t,n)=>{try{(e=>{const t=e.trimStart().trimEnd().split(be);if(""===e||""===e.trim())throw new Error("format is empty");t.forEach((e=>{if(!(e in ve))throw new Error(`format is not valid, format passed is: ${e}`)}))})(t);const r=t.trimStart().trimEnd().split(be),o=t.match(be),a=null!==o?o[0]:"";return r.map((t=>ve[t](e,n))).join(a)}catch(e){console.error(e)}return""};ne.extend(ae),ne.extend(se);const $e=e=>{const{locale:t}=V;ne.locale(t);const n=void 0===e?new Date:ne(e).toDate(),r=ce(new Date(n)),o=ne(new Date(n)).subtract(r-1,"days"),a=o.weekday(),i=ne(o).subtract(a,"days"),s=o.add(15,"days"),l=[];let c=ne(i.format());for(let e=0;e<=5;e++){const e=[];for(let t=0;t<7;t++){const t=new Date(c.format());e.push({date:t,disabled:!pe(o.toDate(),t)}),c=c.add(1,"day")}l.push(e)}return{id:Date.now(),monthName:xe(new Date(n),"MMMM YYYY"),middleOfMonth:s.toDate(),weeks:l}},we=()=>X()?_:-320,Me=l.div`
|
125
|
+
`,Q=t=>e.createElement(Z,{className:"zm-Header"},e.createElement(P,{"aria-label":"Previous month",onClick:t.onPrevClick,className:"zm-IconPrevButton",tabIndex:0},e.createElement(U,null)),e.createElement(q,{className:"zm-MonthYearButton",role:"presentation",onClick:t.onClickOnTitle,"aria-label":"calendar view is open, switch to year and month view",tabIndex:0},t.monthName),e.createElement(P,{"aria-label":"Next month",onClick:t.onNextClick,className:"zm-IconNextButton",tabIndex:0},e.createElement(J,null)));var K={exports:{}};K.exports=function(){var e=1e3,t=6e4,n=36e5,r="millisecond",o="second",a="minute",i="hour",s="day",l="week",c="month",u="quarter",d="year",m="date",f="Invalid Date",h=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,p=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,y={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(e){var t=["th","st","nd","rd"],n=e%100;return"["+e+(t[(n-20)%10]||t[n]||t[0])+"]"}},g=function(e,t,n){var r=String(e);return!r||r.length>=t?e:""+Array(t+1-r.length).join(n)+e},v={s:g,z:function(e){var t=-e.utcOffset(),n=Math.abs(t),r=Math.floor(n/60),o=n%60;return(t<=0?"+":"-")+g(r,2,"0")+":"+g(o,2,"0")},m:function e(t,n){if(t.date()<n.date())return-e(n,t);var r=12*(n.year()-t.year())+(n.month()-t.month()),o=t.clone().add(r,c),a=n-o<0,i=t.clone().add(r+(a?-1:1),c);return+(-(r+(n-o)/(a?o-i:i-o))||0)},a:function(e){return e<0?Math.ceil(e)||0:Math.floor(e)},p:function(e){return{M:c,y:d,w:l,d:s,D:m,h:i,m:a,s:o,ms:r,Q:u}[e]||String(e||"").toLowerCase().replace(/s$/,"")},u:function(e){return void 0===e}},b="en",x={};x[b]=y;var $="$isDayjsObject",w=function(e){return e instanceof E||!(!e||!e[$])},M=function e(t,n,r){var o;if(!t)return b;if("string"==typeof t){var a=t.toLowerCase();x[a]&&(o=a),n&&(x[a]=n,o=a);var i=t.split("-");if(!o&&i.length>1)return e(i[0])}else{var s=t.name;x[s]=t,o=s}return!r&&o&&(b=o),o||!r&&b},k=function(e,t){if(w(e))return e.clone();var n="object"==typeof t?t:{};return n.date=e,n.args=arguments,new E(n)},D=v;D.l=M,D.i=w,D.w=function(e,t){return k(e,{locale:t.$L,utc:t.$u,x:t.$x,$offset:t.$offset})};var E=function(){function y(e){this.$L=M(e.locale,null,!0),this.parse(e),this.$x=this.$x||e.x||{},this[$]=!0}var g=y.prototype;return g.parse=function(e){this.$d=function(e){var t=e.date,n=e.utc;if(null===t)return new Date(NaN);if(D.u(t))return new Date;if(t instanceof Date)return new Date(t);if("string"==typeof t&&!/Z$/i.test(t)){var r=t.match(h);if(r){var o=r[2]-1||0,a=(r[7]||"0").substring(0,3);return n?new Date(Date.UTC(r[1],o,r[3]||1,r[4]||0,r[5]||0,r[6]||0,a)):new Date(r[1],o,r[3]||1,r[4]||0,r[5]||0,r[6]||0,a)}}return new Date(t)}(e),this.init()},g.init=function(){var e=this.$d;this.$y=e.getFullYear(),this.$M=e.getMonth(),this.$D=e.getDate(),this.$W=e.getDay(),this.$H=e.getHours(),this.$m=e.getMinutes(),this.$s=e.getSeconds(),this.$ms=e.getMilliseconds()},g.$utils=function(){return D},g.isValid=function(){return!(this.$d.toString()===f)},g.isSame=function(e,t){var n=k(e);return this.startOf(t)<=n&&n<=this.endOf(t)},g.isAfter=function(e,t){return k(e)<this.startOf(t)},g.isBefore=function(e,t){return this.endOf(t)<k(e)},g.$g=function(e,t,n){return D.u(e)?this[t]:this.set(n,e)},g.unix=function(){return Math.floor(this.valueOf()/1e3)},g.valueOf=function(){return this.$d.getTime()},g.startOf=function(e,t){var n=this,r=!!D.u(t)||t,u=D.p(e),f=function(e,t){var o=D.w(n.$u?Date.UTC(n.$y,t,e):new Date(n.$y,t,e),n);return r?o:o.endOf(s)},h=function(e,t){return D.w(n.toDate()[e].apply(n.toDate("s"),(r?[0,0,0,0]:[23,59,59,999]).slice(t)),n)},p=this.$W,y=this.$M,g=this.$D,v="set"+(this.$u?"UTC":"");switch(u){case d:return r?f(1,0):f(31,11);case c:return r?f(1,y):f(0,y+1);case l:var b=this.$locale().weekStart||0,x=(p<b?p+7:p)-b;return f(r?g-x:g+(6-x),y);case s:case m:return h(v+"Hours",0);case i:return h(v+"Minutes",1);case a:return h(v+"Seconds",2);case o:return h(v+"Milliseconds",3);default:return this.clone()}},g.endOf=function(e){return this.startOf(e,!1)},g.$set=function(e,t){var n,l=D.p(e),u="set"+(this.$u?"UTC":""),f=(n={},n[s]=u+"Date",n[m]=u+"Date",n[c]=u+"Month",n[d]=u+"FullYear",n[i]=u+"Hours",n[a]=u+"Minutes",n[o]=u+"Seconds",n[r]=u+"Milliseconds",n)[l],h=l===s?this.$D+(t-this.$W):t;if(l===c||l===d){var p=this.clone().set(m,1);p.$d[f](h),p.init(),this.$d=p.set(m,Math.min(this.$D,p.daysInMonth())).$d}else f&&this.$d[f](h);return this.init(),this},g.set=function(e,t){return this.clone().$set(e,t)},g.get=function(e){return this[D.p(e)]()},g.add=function(r,u){var m,f=this;r=Number(r);var h=D.p(u),p=function(e){var t=k(f);return D.w(t.date(t.date()+Math.round(e*r)),f)};if(h===c)return this.set(c,this.$M+r);if(h===d)return this.set(d,this.$y+r);if(h===s)return p(1);if(h===l)return p(7);var y=(m={},m[a]=t,m[i]=n,m[o]=e,m)[h]||1,g=this.$d.getTime()+r*y;return D.w(g,this)},g.subtract=function(e,t){return this.add(-1*e,t)},g.format=function(e){var t=this,n=this.$locale();if(!this.isValid())return n.invalidDate||f;var r=e||"YYYY-MM-DDTHH:mm:ssZ",o=D.z(this),a=this.$H,i=this.$m,s=this.$M,l=n.weekdays,c=n.months,u=n.meridiem,d=function(e,n,o,a){return e&&(e[n]||e(t,r))||o[n].slice(0,a)},m=function(e){return D.s(a%12||12,e,"0")},h=u||function(e,t,n){var r=e<12?"AM":"PM";return n?r.toLowerCase():r};return r.replace(p,(function(e,r){return r||function(e){switch(e){case"YY":return String(t.$y).slice(-2);case"YYYY":return D.s(t.$y,4,"0");case"M":return s+1;case"MM":return D.s(s+1,2,"0");case"MMM":return d(n.monthsShort,s,c,3);case"MMMM":return d(c,s);case"D":return t.$D;case"DD":return D.s(t.$D,2,"0");case"d":return String(t.$W);case"dd":return d(n.weekdaysMin,t.$W,l,2);case"ddd":return d(n.weekdaysShort,t.$W,l,3);case"dddd":return l[t.$W];case"H":return String(a);case"HH":return D.s(a,2,"0");case"h":return m(1);case"hh":return m(2);case"a":return h(a,i,!0);case"A":return h(a,i,!1);case"m":return String(i);case"mm":return D.s(i,2,"0");case"s":return String(t.$s);case"ss":return D.s(t.$s,2,"0");case"SSS":return D.s(t.$ms,3,"0");case"Z":return o}return null}(e)||o.replace(":","")}))},g.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},g.diff=function(r,m,f){var h,p=this,y=D.p(m),g=k(r),v=(g.utcOffset()-this.utcOffset())*t,b=this-g,x=function(){return D.m(p,g)};switch(y){case d:h=x()/12;break;case c:h=x();break;case u:h=x()/3;break;case l:h=(b-v)/6048e5;break;case s:h=(b-v)/864e5;break;case i:h=b/n;break;case a:h=b/t;break;case o:h=b/e;break;default:h=b}return f?h:D.a(h)},g.daysInMonth=function(){return this.endOf(c).$D},g.$locale=function(){return x[this.$L]},g.locale=function(e,t){if(!e)return this.$L;var n=this.clone(),r=M(e,t,!0);return r&&(n.$L=r),n},g.clone=function(){return D.w(this.$d,this)},g.toDate=function(){return new Date(this.valueOf())},g.toJSON=function(){return this.isValid()?this.toISOString():null},g.toISOString=function(){return this.$d.toISOString()},g.toString=function(){return this.$d.toUTCString()},y}(),Y=E.prototype;return k.prototype=Y,[["$ms",r],["$s",o],["$m",a],["$H",i],["$W",s],["$M",c],["$y",d],["$D",m]].forEach((function(e){Y[e[1]]=function(t){return this.$g(t,e[0],e[1])}})),k.extend=function(e,t){return e.$i||(e(t,E,k),e.$i=!0),k},k.locale=M,k.isDayjs=w,k.unix=function(e){return k(1e3*e)},k.en=x[b],k.Ls=x,k.p={},k}();var ee=K.exports,te=d(ee);!function(e){function t(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var n=t(e),r={name:"fa",weekdays:"یکشنبه_دوشنبه_سهشنبه_چهارشنبه_پنجشنبه_جمعه_شنبه".split("_"),weekdaysShort:"یکشنبه_دوشنبه_سهشنبه_چهارشنبه_پنجشنبه_جمعه_شنبه".split("_"),weekdaysMin:"ی_د_س_چ_پ_ج_ش".split("_"),weekStart:6,months:"ژانویه_فوریه_مارس_آوریل_مه_ژوئن_ژوئیه_اوت_سپتامبر_اکتبر_نوامبر_دسامبر".split("_"),monthsShort:"ژانویه_فوریه_مارس_آوریل_مه_ژوئن_ژوئیه_اوت_سپتامبر_اکتبر_نوامبر_دسامبر".split("_"),ordinal:function(e){return e},formats:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},relativeTime:{future:"در %s",past:"%s پیش",s:"چند ثانیه",m:"یک دقیقه",mm:"%d دقیقه",h:"یک ساعت",hh:"%d ساعت",d:"یک روز",dd:"%d روز",M:"یک ماه",MM:"%d ماه",y:"یک سال",yy:"%d سال"}};n.default.locale(r,null,!0)}(ee);var ne={exports:{}};ne.exports=function(e,t){t.prototype.weekday=function(e){var t=this.$locale().weekStart||0,n=this.$W,r=(n<t?n+7:n)-t;return this.$utils().u(e)?r:this.subtract(r,"day").add(e,"day")}};var re,oe=d(ne.exports),ae={exports:{}},ie=d(ae.exports=(re={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"},function(e,t,n){var r=t.prototype,o=r.format;n.en.formats=re,r.format=function(e){void 0===e&&(e="YYYY-MM-DDTHH:mm:ssZ");var t=this.$locale().formats,n=function(e,t){return e.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,(function(e,n,r){var o=r&&r.toUpperCase();return n||t[r]||re[r]||t[o].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,(function(e,t,n){return t||n.slice(1)}))}))}(e,void 0===t?{}:t);return o.call(this,n)}}));const se=(e,t,n)=>{const{locale:r}=R,o=Object.assign(Object.assign({},t),null!=n&&{numberingSystem:n});return new Date(e).toLocaleString(r,o)},le=e=>parseInt(se(e,{day:"numeric"},"latn"),10),ce=(e,t)=>se(e,{day:"numeric"},t),ue=(e,t)=>se(e,{year:"numeric"},t),de=(e,t)=>se(e,{month:"2-digit"},t);var me={exports:{}};me.exports=function(e,t,n){t.prototype.isBetween=function(e,t,r,o){var a=n(e),i=n(t),s="("===(o=o||"()")[0],l=")"===o[1];return(s?this.isAfter(a,r):!this.isBefore(a,r))&&(l?this.isBefore(i,r):!this.isAfter(i,r))||(s?this.isBefore(a,r):!this.isAfter(a,r))&&(l?this.isAfter(i,r):!this.isBefore(i,r))}};var fe=d(me.exports);te.extend(fe);const he=(e,t)=>de(e)===de(t),pe=(e,t)=>void 0!==e&&te(e).isSame(t,"day"),ye=(e,t,n)=>null!==t&&null!==n&&te(e).isBetween(te(t),te(n)),ge={MMMM:(e,t)=>se(e,{month:"short"},t),MM:de,M:de,YYYY:ue,YY:(e,t)=>se(e,{year:"2-digit"},t),DD:ce,D:ce},ve=/\/|\s|-/,be=(e,t,n)=>{try{(e=>{const t=e.trimStart().trimEnd().split(ve);if(""===e||""===e.trim())throw new Error("format is empty");t.forEach((e=>{if(!(e in ge))throw new Error(`format is not valid, format passed is: ${e}`)}))})(t);const r=t.trimStart().trimEnd().split(ve),o=t.match(ve),a=null!==o?o[0]:"";return r.map((t=>ge[t](e,n))).join(a)}catch(e){console.error(e)}return""};te.extend(oe),te.extend(ie);const xe=e=>{const{locale:t}=R;te.locale(t);const n=void 0===e?new Date:te(e).toDate(),r=le(new Date(n)),o=te(new Date(n)).subtract(r-1,"days"),a=o.weekday(),i=te(o).subtract(a,"days"),s=o.add(15,"days"),l=[];let c=te(i.format());for(let e=0;e<=5;e++){const e=[];for(let t=0;t<7;t++){const t=new Date(c.format());e.push({date:t,disabled:!he(o.toDate(),t)}),c=c.add(1,"day")}l.push(e)}return{id:Date.now(),monthName:be(new Date(n),"MMMM YYYY"),middleOfMonth:s.toDate(),weeks:l}},$e=()=>V()?Y:-320,we=s.div`
|
126
126
|
color: inherit;
|
127
|
-
`,
|
127
|
+
`,Me=s.button`
|
128
128
|
position: relative;
|
129
129
|
outline: none;
|
130
130
|
background-color: transparent;
|
@@ -137,7 +137,7 @@ import e,{useRef as t,useEffect as n,useMemo as r,useState as o,forwardRef as a,
|
|
137
137
|
border: 1px solid transparent;
|
138
138
|
user-select: none;
|
139
139
|
color: ${e=>e.theme.colors.gray[600]};
|
140
|
-
border-radius: ${e=>
|
140
|
+
border-radius: ${e=>j[e.theme.round].calendarItem}px;
|
141
141
|
|
142
142
|
// pseudos
|
143
143
|
&:hover,
|
@@ -163,7 +163,7 @@ import e,{useRef as t,useEffect as n,useMemo as r,useState as o,forwardRef as a,
|
|
163
163
|
}
|
164
164
|
&:not([data-range='true']) {
|
165
165
|
transition: all 0.1s linear;
|
166
|
-
border-radius: ${e=>
|
166
|
+
border-radius: ${e=>j[e.theme.round].calendarItem}px;
|
167
167
|
}
|
168
168
|
&:not([data-selected='true'])&[data-weekend='true'] {
|
169
169
|
color: #ff4d4d;
|
@@ -179,13 +179,13 @@ import e,{useRef as t,useEffect as n,useMemo as r,useState as o,forwardRef as a,
|
|
179
179
|
&[data-start-range='true'] {
|
180
180
|
background-color: ${e=>e.theme.colors.primary[40]};
|
181
181
|
color: ${e=>e.theme.colors.gray[0]};
|
182
|
-
border-radius: ${e=>
|
182
|
+
border-radius: ${e=>j[e.theme.round].calendarItem}px;
|
183
183
|
border-color: transparent;
|
184
184
|
}
|
185
185
|
&[data-end-range='true'] {
|
186
186
|
background-color: ${e=>e.theme.colors.primary[40]};
|
187
187
|
color: ${e=>e.theme.colors.gray[0]};
|
188
|
-
border-radius: ${e=>
|
188
|
+
border-radius: ${e=>j[e.theme.round].calendarItem}px;
|
189
189
|
border-color: transparent;
|
190
190
|
}
|
191
191
|
&[data-in-range='true']:before,
|
@@ -205,31 +205,46 @@ import e,{useRef as t,useEffect as n,useMemo as r,useState as o,forwardRef as a,
|
|
205
205
|
&[data-start-range='true']:before {
|
206
206
|
display: none;
|
207
207
|
}
|
208
|
-
`;
|
208
|
+
`;Me.defaultProps={width:40,height:40};const ke={fa:{shortWeekDays:[{key:0,name:"ش"},{key:1,name:"ی"},{key:2,name:"د"},{key:3,name:"س"},{key:4,name:"چ"},{key:5,name:"پ"},{key:6,name:"ج"}],months:[{key:1,name:"فروردین"},{key:2,name:"اردیبهشت"},{key:3,name:"خرداد"},{key:4,name:"تیر"},{key:5,name:"مرداد"},{key:6,name:"شهریور"},{key:7,name:"مهر"},{key:8,name:"آبان"},{key:9,name:"آذر"},{key:10,name:"دی"},{key:11,name:"بهمن"},{key:12,name:"اسفند"}],format:"YYYY/MM/DD",am:"ق.ظ",pm:"ب.ظ"},en:{shortWeekDays:[{key:0,name:"S"},{key:1,name:"M"},{key:2,name:"T"},{key:3,name:"W"},{key:4,name:"T"},{key:5,name:"F"},{key:6,name:"S"}],months:[{key:1,name:"January"},{key:2,name:"February"},{key:3,name:"March"},{key:4,name:"April"},{key:5,name:"May"},{key:6,name:"June"},{key:7,name:"July"},{key:8,name:"August"},{key:9,name:"September"},{key:10,name:"October"},{key:11,name:"November"},{key:12,name:"December"}],format:"MM-DD-YY",am:"AM",pm:"PM"}},De=s.div`
|
209
209
|
display: flex;
|
210
210
|
justify-content: center;
|
211
211
|
align-items: center;
|
212
212
|
flex-wrap: wrap;
|
213
213
|
gap: 4px;
|
214
|
-
height: ${
|
215
|
-
`,
|
214
|
+
height: ${Y}px;
|
215
|
+
`,Ee=t=>{const{locale:n}=R,r=be(t.value,"MM","latn");return e.createElement(De,null,ke[n].months.map((n=>e.createElement(Me,{key:n.key,className:"zm-MonthPickerButton",width:90,height:48,"data-selected":n.key===parseInt(r,10),onClick:()=>t.onMonthSelect(n.key),"aria-current":"date",type:"button",tabIndex:0},n.name))))},Ye=s.div`
|
216
216
|
display: grid;
|
217
217
|
grid-template-columns: repeat(3, 92px);
|
218
218
|
grid-template-rows: auto;
|
219
219
|
justify-content: center;
|
220
220
|
gap: 4px;
|
221
|
-
max-height: ${
|
221
|
+
max-height: ${Y}px;
|
222
222
|
overflow: auto;
|
223
223
|
padding-top: 8px;
|
224
224
|
padding-bottom: 8px;
|
225
|
-
`,
|
225
|
+
`,_e=t=>{const n=parseInt(be(t.value,"YYYY","latn"),10),o=r((()=>((e,t=80,n=50)=>{const r=parseInt(ue(e,"latn"),10),o=r+n,a=[];for(let e=r-t;e<=o;e++)a.push(e);return a})(t.value)),[]),a=e.useCallback((e=>{if(null===e)return;const t=e.querySelector("button[data-selected=true]");if(null!=t){const{height:n,top:r}=e.getBoundingClientRect(),{top:o}=t.getBoundingClientRect();e.scrollTop=Math.abs(r-o)-n/2}}),[]);return e.createElement(Ye,{ref:a},o.map((r=>e.createElement(Me,{className:"zm-YearPickerButton",key:r,width:90,height:48,"data-selected":n===r,"aria-selected":n===r,"aria-current":"date",type:"button",tabIndex:0,onClick:()=>t.onYearSelect(r)},X(r)))))},Ce=e=>!0===e.range,Se=e=>{const[t,r]=o(!1),[a,i]=o(void 0!==e.from?new Date(e.from):void 0);console.log(e.controlledRangeValue);const[s,l]=o(void 0!==e.to?new Date(e.to):void 0),c=(t,n)=>{"function"==typeof e.onChange&&Ce(e)&&null!=t&&null!=n&&e.onChange({from:t,to:n})};return n((()=>{null!=e.controlledRangeValue&&(i(e.controlledRangeValue[0]),l(e.controlledRangeValue[1]))}),[e.controlledRangeValue]),{handlers:Object.assign({onClick:n=>!0===e.range?(e=>{const{value:n}=e.currentTarget.dataset;t||(void 0!==n&&(i(new Date(n)),l(null)),r(!0)),t&&null===s&&(void 0!==n&&(l(new Date(n)),c(a,new Date(n))),r(!1)),t&&void 0!==s&&(c(a,s),r(!1))})(n):(t=>{const{value:n,disabled:r}=t.currentTarget.dataset;if(void 0!==n&&"true"!==r)return Ce(e)||"function"!=typeof e.onChange||e.onChange({value:new Date(n)}),n})(n)},!0===e.range&&{onMouseMove:e=>{const{value:n}=e.currentTarget.dataset;t&&void 0!==n&&te(n).isAfter(te(a))&&l(new Date(n))}}),from:a,to:s}},Oe=i=>{var{ref:s}=i,l=
|
226
|
+
/*! *****************************************************************************
|
227
|
+
Copyright (c) Microsoft Corporation.
|
228
|
+
|
229
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
230
|
+
purpose with or without fee is hereby granted.
|
231
|
+
|
232
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
233
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
234
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
235
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
236
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
237
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
238
|
+
PERFORMANCE OF THIS SOFTWARE.
|
239
|
+
***************************************************************************** */
|
240
|
+
function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]])}return n}(i,["ref"]);const{locale:c}=R,{defaultValue:u,weekends:d,controlledValue:m,range:f=!1}=l,h=void 0===u?new Date:u,[p,y]=o("days"),[g,v]=o(void 0!==u?new Date(u):void 0),b=r((()=>xe(g)),[g]),[x,$]=o([b]),w=t([]),M=(({daysElementRefs:e,days:n,setDays:r})=>{const o=t(!1),a=n[0].middleOfMonth,i=t=>requestAnimationFrame((()=>{o.current=!0;const[n,a]=e.current;n.style.transform=`translateX(${$e()}px)`,a.style.transform=`translateX(${$e()}px)`,requestAnimationFrame((()=>{a.style.transition=`transform 250ms ${_}`,a.style.transform="translateX(0px)",n.style.transition=`transform 250ms ${_}`,n.style.transform="translateX(0px)",setTimeout((()=>{r((e=>e.filter((e=>e.id===t.id)))),n.style.transition=null,n.style.transform=null,o.current=!1}),300)}))})),s=t=>{requestAnimationFrame((()=>{o.current=!0;const[n,a]=e.current;n.style.transition=`transform 250ms ${_}`,n.style.transform=`translateX(${$e()}px)`,a.style.transition=`transform 250ms ${_}`,a.style.transform=`translateX(${$e()}px)`,setTimeout((()=>{r((e=>e.filter((e=>e.id===t.id)))),a.style.transition=null,a.style.transform=null,o.current=!1}),300)}))};return{slideToTheNextMonth:()=>{if(o.current)return;const e=te(a).add(1,"month"),t=xe(e.toDate());r([...n,t]),s(t)},slideToPrevMonth:()=>{if(o.current)return;const e=te(a).subtract(1,"month"),t=xe(e.toDate());r([t,...n]),i(t)},slideToCurrentMonth:()=>{if(o.current)return;const e=le(new Date);console.log(e);const t=te(new Date).subtract(e-1,"days").add(15,"days");console.log("middle of the month",t.toDate());const l=xe(t.toDate());r([...n,l]),te(a).isAfter(t)&&(console.log("we re animating right "),i(l)),te(a.getMonth()).isBefore(t.get("month"))&&(console.log("we re animating left"),s(l))}}})({daysElementRefs:w,days:x,setDays:$}),{from:k,to:D,handlers:E}=Se(l);a(s,(()=>({todayTransitionHandler:()=>M.slideToCurrentMonth()})),[M]),console.log("ref assigned",s);return n((()=>{m!==g&&void 0!==m&&v(m)}),[m]),e.createElement(B,{className:null!==l.className?l.className:""},e.createElement(Q,{monthName:x[0].monthName,onNextClick:()=>{if("days"===p)return M.slideToTheNextMonth()},onPrevClick:()=>{if("days"===p)return M.slideToPrevMonth()},onClickOnTitle:()=>{y("month"!==p&&"year"!==p?"year":"days")}}),"year"===p?e.createElement(_e,{value:h,onYearSelect:e=>{const t=((e,t)=>{const n=t-parseInt(ue(e,"latn"),10);return n>0?te(e).add(n,"years").toDate():te(e).subtract(Math.abs(n),"years").toDate()})(h,e);$([xe(t)]),y("month")}}):null,"month"===p?e.createElement(Ee,{value:h,onMonthSelect:e=>{const t=((e,t)=>{const n=t-parseInt(de(e,"latn"),10);return n>0?te(e).add(n,"months").toDate():te(e).subtract(Math.abs(n),"months").toDate()})(x[0].middleOfMonth,e);$([xe(t)]),y("days")}}):null,"days"===p?e.createElement(e.Fragment,null,e.createElement(z,null,ke[c].shortWeekDays.map((t=>e.createElement(G,{key:t.key},t.name)))),e.createElement(F,null,x.map(((t,n)=>e.createElement(A,{key:t.id,className:"item",ref:e=>{w.current[n]=e},role:"rowgroup"},t.weeks.map(((t,n)=>e.createElement(W,{key:n,role:"row","aria-rowindex":n+1},t.map(((t,n)=>e.createElement(Me,Object.assign({key:t.date.getTime(),className:"zm-DaysButton","data-value":t.date,"data-disabled":t.disabled,"data-range":l.range,"data-selected":!f&&pe(g,t.date),"data-start-range":null!=k&&pe(k,t.date),"data-in-range":ye(t.date,k,D),"data-end-range":null!=D&&pe(D,t.date),"data-weekend":null==d?void 0:d.some((e=>e===n)),type:"button",role:"gridcell","aria-colindex":n+1,tabIndex:0,"aria-selected":!f&&pe(h,t.date)},E),e.createElement(we,{className:"cl-text"},be(t.date,"DD"))))))))))))):null)};function Te(e,t){n((()=>{function n({target:n}){null==e.current||e.current.contains(n)||t()}return document.addEventListener("mousedown",n),()=>{document.removeEventListener("mousedown",n)}}),[e,t])}Oe.displayName="Calendar";const Le=(e,t,n)=>`hsl(${e}deg ${t}% ${n}%)`,Ne=e=>{const{h:t,s:n,l:r}=function(e){const t=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);if(null==t)throw new Error("Could not parse Hex Color");const n=parseInt(t[1],16)/255,r=parseInt(t[2],16)/255,o=parseInt(t[3],16)/255,a=Math.max(n,r,o),i=Math.min(n,r,o);let s=(a+i)/2,l=s,c=s;if(a===i)return{h:0,s:0,l:c};const u=a-i;switch(l=c>.5?u/(2-a-i):u/(a+i),a){case n:s=(r-o)/u+(r<o?6:0);break;case r:s=(o-n)/u+2;break;case o:s=(n-r)/u+4}return s/=6,l*=100,l=Math.round(l),c*=100,c=Math.round(c),s=Math.round(360*s),{h:s,s:l,l:c}}(e),o={};return o[40]=Le(t,n,r-10),o[50]=Le(t,n,r),o[85]=Le(t,n,85),o[90]=Le(t,n,90),o[95]=Le(t,n,95),o},Ie={0:"#FFFFFF",20:"#F5F5F5",30:"#EBEBEB",40:"#DEDEDE",50:"#BFBFBF",60:"#B0B0B0",70:"#575757",80:"#666666",600:"#2E2E2E"},He=t=>{const{accentColor:n=C,locale:o,round:a="thin",direction:i="rtl"}=t;r((()=>R.setLocale(o)),[o]);const s={colors:{primary:r((()=>Ne(n)),[]),gray:Ie},round:a,direction:i};return e.createElement(c,{theme:s},t.children)},je=a=>{const{defaultValue:i,locale:s="fa",weekends:l=[],direction:c="rtl",accentColor:u,controlledValue:d}=a;r((()=>R.setLocale(s)),[s]);const m=t(null),f=t(null),[h,p]=o(void 0!==i?new Date(i):void 0),[y,g]=o(!0===a.range&&void 0!==a.from?new Date(a.from):void 0),[v,b]=o(!0===a.range&&void 0!==a.to?new Date(a.to):void 0),[x,$]=o(!1);n((()=>{d&&d!==h&&p(d)}),[d]),Te(f,(()=>$(!1)));const w=()=>{$(!x)},M=r((()=>{var e;const t=null!==(e=null==a?void 0:a.customShowDateFormat)&&void 0!==e?e:ke[s].format;return void 0===a.range&&void 0!==h?be(h,t):(console.log("from >>",y),void 0!==y&&void 0!==v?`\n ${be(y,t)}\n -\n ${be(v,t)}\n `:"")}),[h,y,v]);return e.createElement(He,{accentColor:u,round:a.round,direction:c},e.createElement("input",Object.assign({ref:m},null==a?void 0:a.inputAttributes,{onClick:w,type:"text",value:M,className:null!==a.inputClass?a.inputClass:"",readOnly:!0})),e.createElement(H,{toggleOpen:w,showCalendar:x,destinationRef:m,position:a.position},e.createElement(Oe,{defaultValue:h,ref:f,className:a.className,weekends:l,onChange:e=>{if(!0===a.range&&"function"==typeof a.onChange){const t="from"in e?e.from:new Date,n="to"in e?e.to:new Date;g(t),b(n),a.onChange({from:t,to:n})}else if((!1===a.range||void 0===a.range)&&"function"==typeof a.onChange){const t="value"in e?e.value:new Date;p(t),a.onChange({value:t})}},range:a.range,from:!0===a.range?a.from:void 0,to:!0===a.range?a.to:void 0})))},Be=s.div`
|
226
241
|
width: 260px;
|
227
242
|
height: 260px;
|
228
243
|
position: relative;
|
229
244
|
z-index: 1;
|
230
245
|
border-radius: 50%;
|
231
246
|
background-color: ${e=>e.theme.colors.primary[95]};
|
232
|
-
`,
|
247
|
+
`,Fe=s("div")`
|
233
248
|
left: 50%;
|
234
249
|
width: 1.5px;
|
235
250
|
bottom: 50%;
|
@@ -240,7 +255,7 @@ import e,{useRef as t,useEffect as n,useMemo as r,useState as o,forwardRef as a,
|
|
240
255
|
transition: height 300ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;
|
241
256
|
pointer-events: none;
|
242
257
|
${e=>e.isSelectingHour?`transform: rotateZ(${e.value/12*360}deg); `:`transform: rotateZ(${e.value/60*360}deg); `}
|
243
|
-
`,
|
258
|
+
`,Ae=s("div")`
|
244
259
|
top: -22px;
|
245
260
|
right: -16px;
|
246
261
|
border: 16px solid ${e=>e.theme.colors.primary[85]};
|
@@ -249,21 +264,21 @@ import e,{useRef as t,useEffect as n,useMemo as r,useState as o,forwardRef as a,
|
|
249
264
|
border-radius: 100%;
|
250
265
|
background-color: ${e=>e.theme.colors.primary[85]};
|
251
266
|
pointer-events: none;
|
252
|
-
`,
|
267
|
+
`,We=s.div`
|
253
268
|
position: absolute;
|
254
269
|
top: 16px;
|
255
270
|
left: 16px;
|
256
271
|
display: flex;
|
257
272
|
align-items: center;
|
258
273
|
gap: 8px;
|
259
|
-
`,
|
274
|
+
`,ze=s.div`
|
260
275
|
padding: 4px 8px;
|
261
|
-
border-radius: ${e=>
|
276
|
+
border-radius: ${e=>j[e.theme.round].calendarItem}px;
|
262
277
|
background-color: ${e=>e.theme.colors.gray[20]};
|
263
|
-
`,
|
278
|
+
`,Pe=s.div`
|
264
279
|
display: flex;
|
265
280
|
gap: 4px;
|
266
|
-
`,
|
281
|
+
`,Re=s.div`
|
267
282
|
cursor: pointer;
|
268
283
|
font-size: 12px;
|
269
284
|
padding: 4px;
|
@@ -272,9 +287,9 @@ import e,{useRef as t,useEffect as n,useMemo as r,useState as o,forwardRef as a,
|
|
272
287
|
&.cl_selected {
|
273
288
|
background-color: ${e=>e.theme.colors.gray[20]};
|
274
289
|
}
|
275
|
-
`;const
|
290
|
+
`;const Ve=130,Xe=130,Ue=(e,t=30)=>{const{offsetX:n,offsetY:r}=(e=>{const t=e,n=e;let{offsetX:r,offsetY:o}=t.nativeEvent;if(void 0===r){const e=n.currentTarget.getBoundingClientRect();0!==n.changedTouches.length?(r=n.changedTouches[0].clientX-e.left,o=n.changedTouches[0].clientY-e.top):(r=t.clientX-e.left,o=t.clientY-e.top)}return{offsetX:r,offsetY:o}})(e),o=n-Ve,a=r-Xe,i=Math.PI-Math.atan2(o,a),s=Math.sqrt(Math.pow(o,2)+Math.pow(a,2));const l=((e,t,n)=>{const r=Math.floor(e*(1/n));return 6===n?r:Math.round(t)>85?0===r?-12:r:0===r?12:r})(57.29577951308232*i,s,t);return{value:l,delta:s}},Je=[12,1,2,3,4,5,6,7,8,9,10,11],Ze=[0,13,14,15,16,17,18,19,20,21,22,23],qe=[0,5,10,15,20,25,30,35,40,45,50,55],Ge=s("div")`
|
276
291
|
animation: ${O} 0.7s linear alternate;
|
277
|
-
`,
|
292
|
+
`,Qe=s.span`
|
278
293
|
left: calc(50% - 16px);
|
279
294
|
top: ${e=>e.top};
|
280
295
|
width: 32px;
|
@@ -288,16 +303,16 @@ import e,{useRef as t,useEffect as n,useMemo as r,useState as o,forwardRef as a,
|
|
288
303
|
pointer-events: none;
|
289
304
|
color: black;
|
290
305
|
transform: ${e=>`translate(${function(e,t=130,n=20){const r=t-n;return Math.round(r*Math.sin(.5235987755982988*e))}(e.idx,e.clockHalfWidth,e.numbersPadd)}px,\n ${function(e,t=130,n=17){const r=t-n;return-Math.round(r*Math.cos(.5235987755982988*e))+t-n}(e.idx,e.clockHalfWidth,e.numbersPadd)}px)`};
|
291
|
-
`;
|
306
|
+
`;Qe.defaultProps={clockHalfWidth:130,numbersPadd:24,top:"2%"};const Ke=t=>{const{insideHour:n,hourSelecting:r,clockTime:o}=t;return r?12===o?e.createElement(e.Fragment,null,Je.map(((t,r)=>e.createElement(Qe,{key:t,idx:r,style:{opacity:n?.3:1}},X(t))))):e.createElement(e.Fragment,null,Je.map(((t,r)=>e.createElement(Qe,{key:t,idx:r,top:"15%",clockHalfWidth:85,numbersPadd:10,style:{opacity:n?1:.3}},X(t)))),Ze.map(((t,r)=>e.createElement(Qe,{key:t,idx:r,style:{opacity:n?.3:1}},X(t))))):e.createElement(Ge,null,qe.map(((t,n)=>e.createElement(Qe,{key:t,idx:n},X(t)))))},et=s.div`
|
292
307
|
overflow: hidden;
|
293
308
|
position: relative;
|
294
309
|
display: flex;
|
295
310
|
flex-direction: column;
|
296
311
|
justify-content: center;
|
297
312
|
align-items: center;
|
298
|
-
width: ${
|
313
|
+
width: ${Y}px;
|
299
314
|
min-height: ${372}px;
|
300
315
|
border: 1px solid ${e=>e.theme.colors.gray[40]};
|
301
316
|
background-color: #fff;
|
302
|
-
border-radius: ${e=>
|
303
|
-
`,
|
317
|
+
border-radius: ${e=>j[e.theme.round].wrapper}px;
|
318
|
+
`,tt=n=>{const{defaultValue:a,onChange:i,round:s="x2",locale:l="fa",clockTime:c=24}=n;r((()=>R.setLocale(l)),[l]);const u=t(null),d=t(null),[m,f]=o(!1),[h,p]=o("am");Te(d,(()=>f(!1)));const y=()=>{f(!m)},{hour:g,minute:v,isInsideHour:b,selectingHour:x,handleMouseMove:$,handleMouseUp:w,handleSelecting:M}=(({defaultValue:e,clockTime:t,timeConvention:n,onChange:r})=>{const a=void 0!==e?te(e):te().startOf("date"),[i,s]=o(!1),[l,c]=o(!1),[u,d]=o(!1),m=24===t?"HH":"h",[f,h]=o(parseInt(a.format(m),10)),[p,y]=o(parseInt(a.format("mm"),10)),g=e=>{const{value:t}=Ue(e,6);y(t)},v=e=>{const{value:n,delta:r}=Ue(e);24!==t?h(n):Math.round(r)<85?(h(n),d(!0)):(h(n+12),d(!1))};return{hour:f,minute:p,isInsideHour:u,selectingHour:l,handleMouseMove:e=>{if(e.preventDefault(),i)return l?v(e):g(e)},handleMouseUp:()=>{if(l)return"function"==typeof r&&r(Object.assign({hour:f,minute:p},12===t&&{timeConvention:n})),s(!1),c(!1),void d(!1);s(!1),c(!0)},handleSelecting:e=>(s(!0),l?v(e):g(e))}})({defaultValue:a,clockTime:c,timeConvention:h,onChange:i}),k=r((()=>`${g}:${v}`),[g,v]);return e.createElement(He,{accentColor:n.accentColor,round:s},e.createElement("input",Object.assign({ref:u},null==n?void 0:n.inputAttributes,{onClick:y,type:"text",value:k,className:null!==n.inputClass?n.inputClass:"",readOnly:!0})),e.createElement(H,{toggleOpen:y,showCalendar:m,destinationRef:u},e.createElement(et,{ref:d},e.createElement(We,null,12===c?e.createElement(Pe,null,e.createElement(Re,{className:"am"===h?"cl_selected":"",onClick:()=>p("am")},ke[l].am),e.createElement(Re,{className:"pm"===h?"cl_selected":"",onClick:()=>p("pm")},ke[l].pm)):null,e.createElement(ze,null,X(g),":",X(v))),e.createElement(Be,{onMouseMove:$,onMouseUp:w,onMouseDown:M,onTouchMove:M,onTouchEnd:w},e.createElement(Fe,{value:x?g:v,hour:g,minute:v,isSelectingHour:x,isInsideHour:b},e.createElement(Ae,{isSelectingHour:x})),e.createElement(Ke,{insideHour:b,hourSelecting:x,clockTime:c})))))};export{Oe as Calendar,He as CalendarProvider,je as DatePicker,tt as TimePicker};
|
@@ -1,6 +1,11 @@
|
|
1
|
-
import React from 'react';
|
1
|
+
import React, { type ForwardedRef } from 'react';
|
2
2
|
import type { CalendarProps } from './Calendar.types';
|
3
|
-
declare const Calendar:
|
4
|
-
|
5
|
-
|
3
|
+
declare const Calendar: {
|
4
|
+
({ ref, ...props }: CalendarProps & {
|
5
|
+
ref: ForwardedRef<{
|
6
|
+
todayTransitionHandler: () => void;
|
7
|
+
}>;
|
8
|
+
}): React.JSX.Element;
|
9
|
+
displayName: string;
|
10
|
+
};
|
6
11
|
export default Calendar;
|