zaman-backoffice 1.4.0 → 1.4.1
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 +8 -8
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
"use strict";var e=require("react"),t=require("react-dom"),n=require("@emotion/styled"),r=require("@emotion/react"),
|
1
|
+
"use strict";var e=require("react"),t=require("react-dom"),n=require("@emotion/styled"),r=require("@emotion/react"),o="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function a(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var i=/^\s+|\s+$/g,s=/^[-+]0x[0-9a-f]+$/i,l=/^0b[01]+$/i,c=/^0o[0-7]+$/i,u=parseInt,d="object"==typeof o&&o&&o.Object===Object&&o,m="object"==typeof self&&self&&self.Object===Object&&self,f=d||m||Function("return this")(),h=Object.prototype.toString,p=Math.max,y=Math.min,g=function(){return f.Date.now()};function v(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function b(e){if("number"==typeof e)return e;if(function(e){return"symbol"==typeof e||function(e){return!!e&&"object"==typeof e}(e)&&"[object Symbol]"==h.call(e)}(e))return NaN;if(v(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=v(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(i,"");var n=l.test(e);return n||c.test(e)?u(e.slice(2),n?2:8):s.test(e)?NaN:+e}var x=a((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 x(){var e=g();if(h(e))return $(e);s=setTimeout(x,function(e){var n=t-(e-l);return d?y(n,a-(e-c)):n}(e))}function $(e){return s=void 0,m&&r?f(e):(r=o=void 0,i)}function M(){var e=g(),n=h(e);if(r=arguments,o=this,l=e,n){if(void 0===s)return function(e){return c=e,s=setTimeout(x,t),u?f(e):i}(l);if(d)return s=setTimeout(x,t),f(l)}return void 0===s&&(s=setTimeout(x,t)),i}return t=b(t)||0,v(n)&&(u=!!n.leading,a=(d="maxWait"in n)?p(b(n.maxWait)||0,t):a,m="trailing"in n?!!n.trailing:m),M.cancel=function(){void 0!==s&&clearTimeout(s),c=0,r=l=o=s=void 0},M.flush=function(){return void 0===s?i:$(g())},M}));const $=320,M="cubic-bezier(0.4, 0, 0.2, 1)",w="#0D59F2",k=r.keyframes`
|
2
2
|
from {
|
3
3
|
visibility: hidden;
|
4
4
|
opacity: 0;
|
@@ -19,7 +19,7 @@
|
|
19
19
|
`,E=n.div`
|
20
20
|
position: absolute;
|
21
21
|
animation: ${k} 0.3s ${M} alternate;
|
22
|
-
`,S=n=>{const{children:r,destinationRef:
|
22
|
+
`,S=n=>{const{children:r,destinationRef:o,position:a}=n,i=e.useRef(null),s=()=>{var e;let t=0;if(null!=o&&null!==i){const n=i.current;if(null===n)return;const{top:r,bottom:s,right:l,left:c,width:u}=null===(e=null==o?void 0:o.current)||void 0===e?void 0:e.getBoundingClientRect(),{height:d,width:m}=null==n?void 0:n.getBoundingClientRect();t=window.innerHeight-s>d?s+window.scrollY:r+window.scrollY-d-8,n.style.top=`${t+4}px`;({right:()=>{n.style.right=`${Math.abs(document.body.clientWidth-l)+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-l)+e}px`}})[a]()}};return e.useEffect((()=>(s(),window.addEventListener("resize",x(s,500)),()=>{window.removeEventListener("resize",s)})),[o]),e.createElement(e.Fragment,null,t.createPortal(e.createElement(E,{ref:i},r),document.body))},Y=n.div`
|
23
23
|
position: fixed;
|
24
24
|
display: flex;
|
25
25
|
justify-content: center;
|
@@ -39,7 +39,7 @@
|
|
39
39
|
z-index: -10;
|
40
40
|
background-color: rgba(86, 86, 86, 0.4);
|
41
41
|
}
|
42
|
-
`,_=n=>{const{open:r,toggleOpen:
|
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)},T={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}},O=n.div`
|
43
43
|
overflow: hidden;
|
44
44
|
position: relative;
|
45
45
|
width: ${$}px;
|
@@ -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",a="second",o="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),a=n%60;return(t<=0?"+":"-")+g(r,2,"0")+":"+g(a,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()),a=t.clone().add(r,c),o=n-a<0,i=t.clone().add(r+(o?-1:1),c);return+(-(r+(n-a)/(o?a-i:i-a))||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:o,s:a,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 a;if(!t)return b;if("string"==typeof t){var o=t.toLowerCase();x[o]&&(a=o),n&&(x[o]=n,a=o);var i=t.split("-");if(!a&&i.length>1)return e(i[0])}else{var s=t.name;x[s]=t,a=s}return!r&&a&&(b=a),a||!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 a=r[2]-1||0,o=(r[7]||"0").substring(0,3);return n?new Date(Date.UTC(r[1],a,r[3]||1,r[4]||0,r[5]||0,r[6]||0,o)):new Date(r[1],a,r[3]||1,r[4]||0,r[5]||0,r[6]||0,o)}}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 a=D.w(n.$u?Date.UTC(n.$y,t,e):new Date(n.$y,t,e),n);return r?a:a.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 o:return h(v+"Seconds",2);case a: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[o]=u+"Minutes",n[a]=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[o]=t,m[i]=n,m[a]=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",a=D.z(this),o=this.$H,i=this.$m,s=this.$M,l=n.weekdays,c=n.months,u=n.meridiem,d=function(e,n,a,o){return e&&(e[n]||e(t,r))||a[n].slice(0,o)},m=function(e){return D.s(o%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(o);case"HH":return D.s(o,2,"0");case"h":return m(1);case"hh":return m(2);case"a":return h(o,i,!0);case"A":return h(o,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 a}return null}(e)||a.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 o:h=b/t;break;case a: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",a],["$m",o],["$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=o(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=o(Z.exports),K={exports:{}},ee=o(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,a=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 a=r&&r.toUpperCase();return n||t[r]||G[r]||t[a].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,(function(e,t,n){return t||n.slice(1)}))}))}(e,void 0===t?{}:t);return a.call(this,n)}}));const te=(e,t,n)=>{const{locale:r}=B,a=Object.assign(Object.assign({},t),null!=n&&{numberingSystem:n});return new Date(e).toLocaleString(r,a)},ne=e=>parseInt(te(e,{day:"numeric"},"latn"),10),re=(e,t)=>te(e,{day:"numeric"},t),ae=(e,t)=>te(e,{year:"numeric"},t),oe=(e,t)=>te(e,{month:"2-digit"},t);var ie={exports:{}};ie.exports=function(e,t,n){t.prototype.isBetween=function(e,t,r,a){var o=n(e),i=n(t),s="("===(a=a||"()")[0],l=")"===a[1];return(s?this.isAfter(o,r):!this.isBefore(o,r))&&(l?this.isBefore(i,r):!this.isAfter(i,r))||(s?this.isBefore(o,r):!this.isAfter(o,r))&&(l?this.isAfter(i,r):!this.isBefore(i,r))}};var se=o(ie.exports);J.extend(se);const le=(e,t)=>oe(e)===oe(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:oe,M:oe,YYYY:ae,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),a=t.match(me),o=null!==a?a[0]:"";return r.map((t=>de[t](e,n))).join(o)}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)),a=J(new Date(n)).subtract(r-1,"days"),o=a.weekday(),i=J(a).subtract(o,"days"),s=a.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(a.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(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`
|
126
126
|
color: inherit;
|
127
127
|
`,ge=n.button`
|
128
128
|
position: relative;
|
@@ -222,7 +222,7 @@
|
|
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(
|
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)},A(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),[i,s]=e.useState(void 0!==t.to?new Date(t.to):void 0),l=e.useCallback((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)),c(o,new Date(t))),r(!1)),n&&void 0!==i&&(c(o,i),r(!1))}),[o,i]),c=(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?l(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=e.forwardRef(((t,n)=>{const{locale:r}=B,{defaultValue:o,weekends:a,controlledValue:i,range:s=!1}=t,l=void 0===o?new Date:o,[c,u]=e.useState("days"),[d,m]=e.useState(void 0!==o?new Date(o):void 0),f=e.useMemo((()=>he(d)),[d]),[h,p]=e.useState([f]),y=e.useRef([]),g=(({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:y,days:h,setDays:p}),{from:v,to:b,handlers:x}=ke(t);e.useImperativeHandle(n,(()=>({todayTransitionHandler:()=>g.slideToCurrentMonth()})),[g,n]);return e.useEffect((()=>{i!==d&&void 0!==i&&m(i)}),[i]),e.createElement(O,{className:null!==t.className?t.className:""},e.createElement(X,{monthName:h[0].monthName,onNextClick:()=>{if("days"===c)return g.slideToTheNextMonth()},onPrevClick:()=>{if("days"===c)return g.slideToPrevMonth()},onClickOnTitle:()=>{u("month"!==c&&"year"!==c?"year":"days")}}),"year"===c?e.createElement(Me,{value:l,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()})(l,e);p([he(t)]),u("month")}}):null,"month"===c?e.createElement(xe,{value:l,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()})(h[0].middleOfMonth,e);p([he(t)]),u("days")}}):null,"days"===c?e.createElement(e.Fragment,null,e.createElement(H,null,ve[r].shortWeekDays.map((t=>e.createElement(V,{key:t.key},t.name)))),e.createElement(L,null,h.map(((n,r)=>e.createElement(N,{key:n.id,className:"item",ref:e=>{y.current[r]=e},role:"rowgroup"},n.weeks.map(((n,r)=>e.createElement(I,{key:r,role:"row","aria-rowindex":r+1},n.map(((n,r)=>e.createElement(ge,Object.assign({key:n.date.getTime(),className:"zm-DaysButton","data-value":n.date,"data-disabled":n.disabled,"data-range":t.range,"data-selected":!s&&ce(d,n.date),"data-start-range":null!=v&&ce(v,n.date),"data-in-range":ue(n.date,v,b),"data-end-range":null!=b&&ce(b,n.date),"data-weekend":null==a?void 0:a.some((e=>e===r)),type:"button",role:"gridcell","aria-colindex":r+1,tabIndex:0,"aria-selected":!s&&ce(l,n.date)},x),e.createElement(ye,{className:"cl-text"},fe(n.date,"DD"))))))))))))):null)}));function Ee(t,n){e.useEffect((()=>{function e({target:e}){null!=t.current&&"function"==typeof t.current.contains&&e instanceof Node&&!t.current.contains(e)&&n()}return document.addEventListener("mousedown",e),document.body.addEventListener("click",e),()=>{document.removeEventListener("mousedown",e),document.body.removeEventListener("click",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)},Te=n.div`
|
226
226
|
width: 260px;
|
227
227
|
height: 260px;
|
228
228
|
position: relative;
|
@@ -272,7 +272,7 @@
|
|
272
272
|
&.cl_selected {
|
273
273
|
background-color: ${e=>e.theme.colors.gray[20]};
|
274
274
|
}
|
275
|
-
`;const Be=130,Fe=130,Ae=(e,t=30)=>{const{offsetX:n,offsetY:r}=(e=>{const t=e,n=e;let{offsetX:r,offsetY:
|
275
|
+
`;const Be=130,Fe=130,Ae=(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}},Re=[12,1,2,3,4,5,6,7,8,9,10,11],Pe=[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
276
|
animation: ${D} 0.7s linear alternate;
|
277
277
|
`,Ve=n.span`
|
278
278
|
left: calc(50% - 16px);
|
@@ -288,7 +288,7 @@
|
|
288
288
|
pointer-events: none;
|
289
289
|
color: black;
|
290
290
|
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:
|
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,Re.map(((t,r)=>e.createElement(Ve,{key:t,idx:r,style:{opacity:n?.3:1}},A(t))))):e.createElement(e.Fragment,null,Re.map(((t,r)=>e.createElement(Ve,{key:t,idx:r,top:"15%",clockHalfWidth:85,numbersPadd:10,style:{opacity:n?1:.3}},A(t)))),Pe.map(((t,r)=>e.createElement(Ve,{key:t,idx:r,style:{opacity:n?.3:1}},A(t))))):e.createElement(ze,null,We.map(((t,n)=>e.createElement(Ve,{key:t,idx:n},A(t)))))},qe=n.div`
|
292
292
|
overflow: hidden;
|
293
293
|
position: relative;
|
294
294
|
display: flex;
|
@@ -300,4 +300,4 @@
|
|
300
300
|
border: 1px solid ${e=>e.theme.colors.gray[40]};
|
301
301
|
background-color: #fff;
|
302
302
|
border-radius: ${e=>T[e.theme.round].wrapper}px;
|
303
|
-
`;exports.Calendar=De,exports.CalendarProvider=Ce,exports.DatePicker=t=>{const{defaultValue:n,locale:r="fa",weekends:
|
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=null,clearable:l=!1}=t;e.useMemo((()=>B.setLocale(r)),[r]);const c=e.useRef(null),u=e.useRef(null),[d,m]=e.useState(void 0!==n?new Date(n):void 0),[f,h]=e.useState(!0===t.range&&void 0!==t.from?new Date(t.from):void 0),[p,y]=e.useState(!0===t.range&&void 0!==t.to?new Date(t.to):void 0),[g,v]=e.useState(!1);e.useEffect((()=>{console.log("controlled value",s),console.log("controlledValue === null || controlledValue === value",null===s||s===d),null!==s&&s!==d&&m(s)}),[s]),Ee(u,(()=>v(!1)));const b=()=>{v(!g)},x=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!==d?fe(d,n):void 0!==f&&void 0!==p?`\n ${fe(f,n)}\n -\n ${fe(p,n)}\n `:""}),[d,f,p]);return e.createElement(Ce,{accentColor:i,round:t.round,direction:a},l&&!0!==(null==t?void 0:t.range)?e.createElement("div",{style:{display:"flex",alignItems:"center"}},e.createElement("input",Object.assign({ref:c},null==t?void 0:t.inputAttributes,{onClick:b,type:"text",value:x,className:null!==t.inputClass?t.inputClass:"",readOnly:!0})),e.createElement("button",{onClick:()=>{!1===t.range&&m(void 0),h(void 0),y(void 0)},style:{border:"solid 0.5px",color:"gray",borderRadius:"100%",height:20,width:20,paddingTop:0,background:"transparent",marginRight:"-10%"}},"x")):e.createElement("input",Object.assign({ref:c},null==t?void 0:t.inputAttributes,{onClick:b,type:"text",value:x,className:null!==t.inputClass?t.inputClass:"",readOnly:!0})),e.createElement(C,{toggleOpen:b,showCalendar:g,destinationRef:c,position:t.position},e.createElement(De,{defaultValue:d,ref:u,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;h(n),y(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;m(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}=Ae(e,6);y(t)},v=e=>{const{value:t,delta:r}=Ae(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,A(h),":",A(p))),e.createElement(Te,{onMouseMove:v,onMouseUp:b,onMouseDown:x,onTouchMove:x,onTouchEnd:b},e.createElement(Oe,{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
@@ -222,7 +222,7 @@ import e,{useRef as t,useEffect as n,useMemo as r,useState as o,useCallback as a
|
|
222
222
|
overflow: auto;
|
223
223
|
padding-top: 8px;
|
224
224
|
padding-bottom: 8px;
|
225
|
-
`,Se=t=>{const n=parseInt($e(t.value,"YYYY","latn"),10),o=r((()=>((e,t=80,n=50)=>{const r=parseInt(me(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(Ce,{ref:a},o.map((r=>e.createElement(De,{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)},J(r)))))},Te=e=>!0===e.range,Oe=e=>{const[t,r]=o(!1),[i,s]=o(void 0!==e.from?new Date(e.from):void 0),[l,c]=o(void 0!==e.to?new Date(e.to):void 0),u=a((e=>{const{value:n}=e.currentTarget.dataset;t||(void 0!==n&&(s(new Date(n)),c(null)),r(!0)),t&&null===l&&(void 0!==n&&(c(new Date(n)),d(i,new Date(n))),r(!1)),t&&void 0!==l&&(d(i,l),r(!1))}),[i,l]),d=(t,n)=>{"function"==typeof e.onChange&&Te(e)&&null!=t&&null!=n&&e.onChange({from:t,to:n})};return n((()=>{null!=e.controlledRangeValue&&(s(e.controlledRangeValue[0]),c(e.controlledRangeValue[1]))}),[e.controlledRangeValue]),{handlers:Object.assign({onClick:t=>!0===e.range?u(t):(t=>{const{value:n,disabled:r}=t.currentTarget.dataset;if(void 0!==n&&"true"!==r)return Te(e)||"function"!=typeof e.onChange||e.onChange({value:new Date(n)}),n})(t)},!0===e.range&&{onMouseMove:e=>{const{value:n}=e.currentTarget.dataset;t&&void 0!==n&&re(n).isAfter(re(i))&&c(new Date(n))}}),from:i,to:l}},Le=i(((a,i)=>{const{locale:l}=X,{defaultValue:c,weekends:u,controlledValue:d,range:m=!1}=a,h=void 0===c?new Date:c,[f,p]=o("days"),[y,g]=o(void 0!==c?new Date(c):void 0),v=r((()=>we(y)),[y]),[b,x]=o([v]),$=t([]),w=(({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(${Me()}px)`,a.style.transform=`translateX(${Me()}px)`,requestAnimationFrame((()=>{a.style.transition=`transform 250ms ${S}`,a.style.transform="translateX(0px)",n.style.transition=`transform 250ms ${S}`,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 ${S}`,n.style.transform=`translateX(${Me()}px)`,a.style.transition=`transform 250ms ${S}`,a.style.transform=`translateX(${Me()}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=re(a).add(1,"month"),t=we(e.toDate());r([...n,t]),s(t)},slideToPrevMonth:()=>{if(o.current)return;const e=re(a).subtract(1,"month"),t=we(e.toDate());r([t,...n]),i(t)},slideToCurrentMonth:()=>{if(o.current)return;const e=ue(new Date);console.log(e);const t=re(new Date).subtract(e-1,"days").add(15,"days");console.log("middle of the month",t.toDate());const l=we(t.toDate());r([...n,l]),re(a).isAfter(t)&&(console.log("we re animating right "),i(l)),re(a.getMonth()).isBefore(t.get("month"))&&(console.log("we re animating left"),s(l))}}})({daysElementRefs:$,days:b,setDays:x}),{from:M,to:k,handlers:D}=Oe(a);s(i,(()=>({todayTransitionHandler:()=>w.slideToCurrentMonth()})),[w,i]);return n((()=>{d!==y&&void 0!==d&&g(d)}),[d]),e.createElement(A,{className:null!==a.className?a.className:""},e.createElement(ee,{monthName:b[0].monthName,onNextClick:()=>{if("days"===f)return w.slideToTheNextMonth()},onPrevClick:()=>{if("days"===f)return w.slideToPrevMonth()},onClickOnTitle:()=>{p("month"!==f&&"year"!==f?"year":"days")}}),"year"===f?e.createElement(Se,{value:h,onYearSelect:e=>{const t=((e,t)=>{const n=t-parseInt(me(e,"latn"),10);return n>0?re(e).add(n,"years").toDate():re(e).subtract(Math.abs(n),"years").toDate()})(h,e);x([we(t)]),p("month")}}):null,"month"===f?e.createElement(_e,{value:h,onMonthSelect:e=>{const t=((e,t)=>{const n=t-parseInt(he(e,"latn"),10);return n>0?re(e).add(n,"months").toDate():re(e).subtract(Math.abs(n),"months").toDate()})(b[0].middleOfMonth,e);x([we(t)]),p("days")}}):null,"days"===f?e.createElement(e.Fragment,null,e.createElement(R,null,Ee[l].shortWeekDays.map((t=>e.createElement(K,{key:t.key},t.name)))),e.createElement(W,null,b.map(((t,n)=>e.createElement(z,{key:t.id,className:"item",ref:e=>{$.current[n]=e},role:"rowgroup"},t.weeks.map(((t,n)=>e.createElement(P,{key:n,role:"row","aria-rowindex":n+1},t.map(((t,n)=>e.createElement(De,Object.assign({key:t.date.getTime(),className:"zm-DaysButton","data-value":t.date,"data-disabled":t.disabled,"data-range":a.range,"data-selected":!m&&ge(y,t.date),"data-start-range":null!=M&&ge(M,t.date),"data-in-range":ve(t.date,M,k),"data-end-range":null!=k&&ge(k,t.date),"data-weekend":null==u?void 0:u.some((e=>e===n)),type:"button",role:"gridcell","aria-colindex":n+1,tabIndex:0,"aria-selected":!m&&ge(h,t.date)},D),e.createElement(ke,{className:"cl-text"},$e(t.date,"DD"))))))))))))):null)}));function Ne(e,t){n((()=>{function n({target:n}){null!=e.current&&"function"==typeof e.current.contains&&n instanceof Node&&!e.current.contains(n)&&t()}return document.addEventListener("mousedown",n),document.body.addEventListener("click",n),()=>{document.removeEventListener("mousedown",n),document.body.removeEventListener("click",n)}}),[e,t])}Le.displayName="Calendar";const Ie=(e,t,n)=>`hsl(${e}deg ${t}% ${n}%)`,He=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]=Ie(t,n,r-10),o[50]=Ie(t,n,r),o[85]=Ie(t,n,85),o[90]=Ie(t,n,90),o[95]=Ie(t,n,95),o},je={0:"#FFFFFF",20:"#F5F5F5",30:"#EBEBEB",40:"#DEDEDE",50:"#BFBFBF",60:"#B0B0B0",70:"#575757",80:"#666666",600:"#2E2E2E"},Be=t=>{const{accentColor:n=T,locale:o,round:a="thin",direction:i="rtl"}=t;r((()=>X.setLocale(o)),[o]);const s={colors:{primary:r((()=>He(n)),[]),gray:je},round:a,direction:i};return e.createElement(d,{theme:s},t.children)},Fe=a=>{const{defaultValue:i,locale:s="fa",weekends:l=[],direction:c="rtl",accentColor:u,controlledValue:d=null,clearable:m=!1}=a;r((()=>X.setLocale(s)),[s]);const h=t(null),f=t(null),[p,y]=o(void 0!==i?new Date(i):void 0),[g,v]=o(!0===a.range&&void 0!==a.from?new Date(a.from):void 0),[b,x]=o(!0===a.range&&void 0!==a.to?new Date(a.to):void 0),[$,w]=o(!1);n((()=>{null!==d&&d!==p&&y(d)}),[d]),Ne(f,(()=>w(!1)));const M=()=>{w(!$)},k=r((()=>{var e;const t=null!==(e=null==a?void 0:a.customShowDateFormat)&&void 0!==e?e:Ee[s].format;return void 0===a.range&&void 0!==p?$e(p,t):void 0!==g&&void 0!==b?`\n ${$e(g,t)}\n -\n ${$e(b,t)}\n `:""}),[p,g,b]);return e.createElement(Be,{accentColor:u,round:a.round,direction:c},m&&!0!==(null==a?void 0:a.range)?e.createElement("div",{style:{display:"flex",alignItems:"center"}},e.createElement("input",Object.assign({ref:h},null==a?void 0:a.inputAttributes,{onClick:M,type:"text",value:k,className:null!==a.inputClass?a.inputClass:"",readOnly:!0})),e.createElement("button",{onClick:()=>{!1===a.range&&y(void 0),v(void 0),x(void 0)},style:{border:"solid 0.5px",color:"gray",borderRadius:"100%",height:20,width:20,paddingTop:0,background:"transparent",marginRight:"-10%"}},"x")):e.createElement("input",Object.assign({ref:h},null==a?void 0:a.inputAttributes,{onClick:M,type:"text",value:k,className:null!==a.inputClass?a.inputClass:"",readOnly:!0})),e.createElement(B,{toggleOpen:M,showCalendar:$,destinationRef:h,position:a.position},e.createElement(Le,{defaultValue:p,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;v(t),x(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;y(t),a.onChange({value:t})}},range:a.range,from:!0===a.range?a.from:void 0,to:!0===a.range?a.to:void 0})))},Ae=c.div`
|
225
|
+
`,Se=t=>{const n=parseInt($e(t.value,"YYYY","latn"),10),o=r((()=>((e,t=80,n=50)=>{const r=parseInt(me(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(Ce,{ref:a},o.map((r=>e.createElement(De,{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)},J(r)))))},Te=e=>!0===e.range,Oe=e=>{const[t,r]=o(!1),[i,s]=o(void 0!==e.from?new Date(e.from):void 0),[l,c]=o(void 0!==e.to?new Date(e.to):void 0),u=a((e=>{const{value:n}=e.currentTarget.dataset;t||(void 0!==n&&(s(new Date(n)),c(null)),r(!0)),t&&null===l&&(void 0!==n&&(c(new Date(n)),d(i,new Date(n))),r(!1)),t&&void 0!==l&&(d(i,l),r(!1))}),[i,l]),d=(t,n)=>{"function"==typeof e.onChange&&Te(e)&&null!=t&&null!=n&&e.onChange({from:t,to:n})};return n((()=>{null!=e.controlledRangeValue&&(s(e.controlledRangeValue[0]),c(e.controlledRangeValue[1]))}),[e.controlledRangeValue]),{handlers:Object.assign({onClick:t=>!0===e.range?u(t):(t=>{const{value:n,disabled:r}=t.currentTarget.dataset;if(void 0!==n&&"true"!==r)return Te(e)||"function"!=typeof e.onChange||e.onChange({value:new Date(n)}),n})(t)},!0===e.range&&{onMouseMove:e=>{const{value:n}=e.currentTarget.dataset;t&&void 0!==n&&re(n).isAfter(re(i))&&c(new Date(n))}}),from:i,to:l}},Le=i(((a,i)=>{const{locale:l}=X,{defaultValue:c,weekends:u,controlledValue:d,range:m=!1}=a,h=void 0===c?new Date:c,[f,p]=o("days"),[y,g]=o(void 0!==c?new Date(c):void 0),v=r((()=>we(y)),[y]),[b,x]=o([v]),$=t([]),w=(({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(${Me()}px)`,a.style.transform=`translateX(${Me()}px)`,requestAnimationFrame((()=>{a.style.transition=`transform 250ms ${S}`,a.style.transform="translateX(0px)",n.style.transition=`transform 250ms ${S}`,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 ${S}`,n.style.transform=`translateX(${Me()}px)`,a.style.transition=`transform 250ms ${S}`,a.style.transform=`translateX(${Me()}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=re(a).add(1,"month"),t=we(e.toDate());r([...n,t]),s(t)},slideToPrevMonth:()=>{if(o.current)return;const e=re(a).subtract(1,"month"),t=we(e.toDate());r([t,...n]),i(t)},slideToCurrentMonth:()=>{if(o.current)return;const e=ue(new Date);console.log(e);const t=re(new Date).subtract(e-1,"days").add(15,"days");console.log("middle of the month",t.toDate());const l=we(t.toDate());r([...n,l]),re(a).isAfter(t)&&(console.log("we re animating right "),i(l)),re(a.getMonth()).isBefore(t.get("month"))&&(console.log("we re animating left"),s(l))}}})({daysElementRefs:$,days:b,setDays:x}),{from:M,to:k,handlers:D}=Oe(a);s(i,(()=>({todayTransitionHandler:()=>w.slideToCurrentMonth()})),[w,i]);return n((()=>{d!==y&&void 0!==d&&g(d)}),[d]),e.createElement(A,{className:null!==a.className?a.className:""},e.createElement(ee,{monthName:b[0].monthName,onNextClick:()=>{if("days"===f)return w.slideToTheNextMonth()},onPrevClick:()=>{if("days"===f)return w.slideToPrevMonth()},onClickOnTitle:()=>{p("month"!==f&&"year"!==f?"year":"days")}}),"year"===f?e.createElement(Se,{value:h,onYearSelect:e=>{const t=((e,t)=>{const n=t-parseInt(me(e,"latn"),10);return n>0?re(e).add(n,"years").toDate():re(e).subtract(Math.abs(n),"years").toDate()})(h,e);x([we(t)]),p("month")}}):null,"month"===f?e.createElement(_e,{value:h,onMonthSelect:e=>{const t=((e,t)=>{const n=t-parseInt(he(e,"latn"),10);return n>0?re(e).add(n,"months").toDate():re(e).subtract(Math.abs(n),"months").toDate()})(b[0].middleOfMonth,e);x([we(t)]),p("days")}}):null,"days"===f?e.createElement(e.Fragment,null,e.createElement(R,null,Ee[l].shortWeekDays.map((t=>e.createElement(K,{key:t.key},t.name)))),e.createElement(W,null,b.map(((t,n)=>e.createElement(z,{key:t.id,className:"item",ref:e=>{$.current[n]=e},role:"rowgroup"},t.weeks.map(((t,n)=>e.createElement(P,{key:n,role:"row","aria-rowindex":n+1},t.map(((t,n)=>e.createElement(De,Object.assign({key:t.date.getTime(),className:"zm-DaysButton","data-value":t.date,"data-disabled":t.disabled,"data-range":a.range,"data-selected":!m&&ge(y,t.date),"data-start-range":null!=M&&ge(M,t.date),"data-in-range":ve(t.date,M,k),"data-end-range":null!=k&&ge(k,t.date),"data-weekend":null==u?void 0:u.some((e=>e===n)),type:"button",role:"gridcell","aria-colindex":n+1,tabIndex:0,"aria-selected":!m&&ge(h,t.date)},D),e.createElement(ke,{className:"cl-text"},$e(t.date,"DD"))))))))))))):null)}));function Ne(e,t){n((()=>{function n({target:n}){null!=e.current&&"function"==typeof e.current.contains&&n instanceof Node&&!e.current.contains(n)&&t()}return document.addEventListener("mousedown",n),document.body.addEventListener("click",n),()=>{document.removeEventListener("mousedown",n),document.body.removeEventListener("click",n)}}),[e,t])}Le.displayName="Calendar";const Ie=(e,t,n)=>`hsl(${e}deg ${t}% ${n}%)`,He=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]=Ie(t,n,r-10),o[50]=Ie(t,n,r),o[85]=Ie(t,n,85),o[90]=Ie(t,n,90),o[95]=Ie(t,n,95),o},je={0:"#FFFFFF",20:"#F5F5F5",30:"#EBEBEB",40:"#DEDEDE",50:"#BFBFBF",60:"#B0B0B0",70:"#575757",80:"#666666",600:"#2E2E2E"},Be=t=>{const{accentColor:n=T,locale:o,round:a="thin",direction:i="rtl"}=t;r((()=>X.setLocale(o)),[o]);const s={colors:{primary:r((()=>He(n)),[]),gray:je},round:a,direction:i};return e.createElement(d,{theme:s},t.children)},Fe=a=>{const{defaultValue:i,locale:s="fa",weekends:l=[],direction:c="rtl",accentColor:u,controlledValue:d=null,clearable:m=!1}=a;r((()=>X.setLocale(s)),[s]);const h=t(null),f=t(null),[p,y]=o(void 0!==i?new Date(i):void 0),[g,v]=o(!0===a.range&&void 0!==a.from?new Date(a.from):void 0),[b,x]=o(!0===a.range&&void 0!==a.to?new Date(a.to):void 0),[$,w]=o(!1);n((()=>{console.log("controlled value",d),console.log("controlledValue === null || controlledValue === value",null===d||d===p),null!==d&&d!==p&&y(d)}),[d]),Ne(f,(()=>w(!1)));const M=()=>{w(!$)},k=r((()=>{var e;const t=null!==(e=null==a?void 0:a.customShowDateFormat)&&void 0!==e?e:Ee[s].format;return void 0===a.range&&void 0!==p?$e(p,t):void 0!==g&&void 0!==b?`\n ${$e(g,t)}\n -\n ${$e(b,t)}\n `:""}),[p,g,b]);return e.createElement(Be,{accentColor:u,round:a.round,direction:c},m&&!0!==(null==a?void 0:a.range)?e.createElement("div",{style:{display:"flex",alignItems:"center"}},e.createElement("input",Object.assign({ref:h},null==a?void 0:a.inputAttributes,{onClick:M,type:"text",value:k,className:null!==a.inputClass?a.inputClass:"",readOnly:!0})),e.createElement("button",{onClick:()=>{!1===a.range&&y(void 0),v(void 0),x(void 0)},style:{border:"solid 0.5px",color:"gray",borderRadius:"100%",height:20,width:20,paddingTop:0,background:"transparent",marginRight:"-10%"}},"x")):e.createElement("input",Object.assign({ref:h},null==a?void 0:a.inputAttributes,{onClick:M,type:"text",value:k,className:null!==a.inputClass?a.inputClass:"",readOnly:!0})),e.createElement(B,{toggleOpen:M,showCalendar:$,destinationRef:h,position:a.position},e.createElement(Le,{defaultValue:p,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;v(t),x(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;y(t),a.onChange({value:t})}},range:a.range,from:!0===a.range?a.from:void 0,to:!0===a.range?a.to:void 0})))},Ae=c.div`
|
226
226
|
width: 260px;
|
227
227
|
height: 260px;
|
228
228
|
position: relative;
|