@popsure/dirty-swan 0.33.4 → 0.34.0
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/cjs/index.js +25 -18
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/lib/components/cards/cardButton/index.d.ts +8 -8
- package/dist/cjs/lib/components/cards/cardButton/index.stories.d.ts +39 -0
- package/dist/cjs/lib/components/cards/cardWithLeftIcon/index.d.ts +6 -12
- package/dist/cjs/lib/components/cards/cardWithLeftIcon/index.stories.d.ts +55 -0
- package/dist/cjs/lib/components/cards/cardWithTopIcon/index.d.ts +5 -11
- package/dist/cjs/lib/components/cards/cardWithTopIcon/index.stories.d.ts +59 -0
- package/dist/cjs/lib/components/cards/cardWithTopLeftIcon/index.d.ts +6 -12
- package/dist/cjs/lib/components/cards/cardWithTopLeftIcon/index.stories.d.ts +49 -0
- package/dist/cjs/lib/components/cards/index.d.ts +5 -5
- package/dist/cjs/lib/components/cards/infoCard/index.d.ts +4 -10
- package/dist/cjs/lib/components/cards/infoCard/index.stories.d.ts +47 -0
- package/dist/cjs/lib/components/dateSelector/index.d.ts +11 -11
- package/dist/cjs/lib/components/dateSelector/index.stories.d.ts +65 -0
- package/dist/cjs/lib/components/input/index.d.ts +4 -5
- package/dist/cjs/lib/components/input/input.stories.d.ts +90 -0
- package/dist/cjs/lib/components/input/stories/config.d.ts +71 -0
- package/dist/cjs/lib/components/multiDropzone/index.d.ts +4 -4
- package/dist/cjs/lib/components/multiDropzone/index.stories.d.ts +72 -0
- package/dist/cjs/lib/index.d.ts +3 -3
- package/dist/cjs/lib/util/images/index.d.ts +7 -0
- package/dist/esm/components/autocompleteAddress/index.js +1 -1
- package/dist/esm/components/autocompleteAddress/index.js.map +1 -1
- package/dist/esm/components/cards/cardButton/index.js +1 -1
- package/dist/esm/components/cards/cardButton/index.stories.js +49 -0
- package/dist/esm/components/cards/cardButton/index.stories.js.map +1 -0
- package/dist/esm/components/cards/cardWithLeftIcon/index.js +1 -1
- package/dist/esm/components/cards/cardWithLeftIcon/index.stories.js +64 -0
- package/dist/esm/components/cards/cardWithLeftIcon/index.stories.js.map +1 -0
- package/dist/esm/components/cards/cardWithTopIcon/index.js +1 -1
- package/dist/esm/components/cards/cardWithTopIcon/index.stories.js +68 -0
- package/dist/esm/components/cards/cardWithTopIcon/index.stories.js.map +1 -0
- package/dist/esm/components/cards/cardWithTopLeftIcon/index.js +1 -1
- package/dist/esm/components/cards/cardWithTopLeftIcon/index.stories.js +57 -0
- package/dist/esm/components/cards/cardWithTopLeftIcon/index.stories.js.map +1 -0
- package/dist/esm/components/cards/index.js +9 -9
- package/dist/esm/components/cards/index.js.map +1 -1
- package/dist/esm/components/cards/infoCard/index.js +1 -1
- package/dist/esm/components/cards/infoCard/index.stories.js +58 -0
- package/dist/esm/components/cards/infoCard/index.stories.js.map +1 -0
- package/dist/esm/components/comparisonTable/components/AccordionItem/AccordionItem.js +1 -1
- package/dist/esm/components/comparisonTable/components/TableArrows/index.js +1 -1
- package/dist/esm/components/comparisonTable/components/TableInfoButton/index.js +1 -1
- package/dist/esm/components/dateSelector/index.js +6 -2179
- package/dist/esm/components/dateSelector/index.js.map +1 -1
- package/dist/esm/components/dateSelector/index.stories.js +92 -0
- package/dist/esm/components/dateSelector/index.stories.js.map +1 -0
- package/dist/esm/components/dateSelector/index.test.js +1 -1
- package/dist/esm/components/dateSelector/index.test.js.map +1 -1
- package/dist/esm/components/input/autoSuggestInput/index.js +1 -1
- package/dist/esm/components/input/autoSuggestInput/index.js.map +1 -1
- package/dist/esm/components/input/checkbox/index.stories.js +1 -1
- package/dist/esm/components/input/currency/index.js +1 -1
- package/dist/esm/components/input/currency/index.js.map +1 -1
- package/dist/esm/components/input/iban/index.js +1 -1
- package/dist/esm/components/input/iban/index.js.map +1 -1
- package/dist/esm/components/input/index.js +1 -1
- package/dist/esm/components/input/index.js.map +1 -1
- package/dist/esm/components/input/input.stories.js +85 -0
- package/dist/esm/components/input/input.stories.js.map +1 -0
- package/dist/esm/components/multiDropzone/index.js +3 -3
- package/dist/esm/components/multiDropzone/index.js.map +1 -1
- package/dist/esm/components/multiDropzone/index.stories.js +147 -0
- package/dist/esm/components/multiDropzone/index.stories.js.map +1 -0
- package/dist/esm/components/multiDropzone/index.test.js +2 -2
- package/dist/esm/components/multiDropzone/index.test.js.map +1 -1
- package/dist/esm/{index-e81a1766.js → index-31224f74.js} +8 -1
- package/dist/esm/index-31224f74.js.map +1 -0
- package/dist/esm/index-47663d39.js.map +1 -1
- package/dist/esm/index-639cf8b3.js +2179 -0
- package/dist/esm/index-639cf8b3.js.map +1 -0
- package/dist/esm/index.js +4 -4
- package/dist/esm/lib/components/cards/cardButton/index.d.ts +8 -8
- package/dist/esm/lib/components/cards/cardButton/index.stories.d.ts +39 -0
- package/dist/esm/lib/components/cards/cardWithLeftIcon/index.d.ts +6 -12
- package/dist/esm/lib/components/cards/cardWithLeftIcon/index.stories.d.ts +55 -0
- package/dist/esm/lib/components/cards/cardWithTopIcon/index.d.ts +5 -11
- package/dist/esm/lib/components/cards/cardWithTopIcon/index.stories.d.ts +59 -0
- package/dist/esm/lib/components/cards/cardWithTopLeftIcon/index.d.ts +6 -12
- package/dist/esm/lib/components/cards/cardWithTopLeftIcon/index.stories.d.ts +49 -0
- package/dist/esm/lib/components/cards/index.d.ts +5 -5
- package/dist/esm/lib/components/cards/infoCard/index.d.ts +4 -10
- package/dist/esm/lib/components/cards/infoCard/index.stories.d.ts +47 -0
- package/dist/esm/lib/components/dateSelector/index.d.ts +11 -11
- package/dist/esm/lib/components/dateSelector/index.stories.d.ts +65 -0
- package/dist/esm/lib/components/input/index.d.ts +4 -5
- package/dist/esm/lib/components/input/input.stories.d.ts +90 -0
- package/dist/esm/lib/components/input/stories/config.d.ts +71 -0
- package/dist/esm/lib/components/multiDropzone/index.d.ts +4 -4
- package/dist/esm/lib/components/multiDropzone/index.stories.d.ts +72 -0
- package/dist/esm/lib/index.d.ts +3 -3
- package/dist/esm/lib/util/images/index.d.ts +7 -0
- package/dist/esm/scss/public/demo.js +1 -1
- package/dist/esm/scss/public/demo.js.map +1 -1
- package/dist/esm/util/images/index.stories.js +1 -1
- package/dist/index.css +10 -10
- package/dist/lib/scss/public/colors/default.scss +2 -2
- package/dist/lib/scss/public/demo.tsx +1 -1
- package/package.json +1 -1
- package/src/App.tsx +1 -1
- package/src/lib/components/autocompleteAddress/index.tsx +1 -1
- package/src/lib/components/cards/cardButton/index.stories.tsx +61 -0
- package/src/lib/components/cards/cardButton/index.tsx +9 -10
- package/src/lib/components/cards/cardWithLeftIcon/index.stories.tsx +79 -0
- package/src/lib/components/cards/cardWithLeftIcon/index.tsx +8 -6
- package/src/lib/components/cards/cardWithTopIcon/index.stories.tsx +85 -0
- package/src/lib/components/cards/cardWithTopIcon/index.tsx +9 -7
- package/src/lib/components/cards/cardWithTopLeftIcon/index.stories.tsx +73 -0
- package/src/lib/components/cards/cardWithTopLeftIcon/index.tsx +8 -6
- package/src/lib/components/cards/index.tsx +5 -5
- package/src/lib/components/cards/infoCard/index.stories.tsx +71 -0
- package/src/lib/components/cards/infoCard/index.tsx +7 -5
- package/src/lib/components/dateSelector/index.stories.tsx +104 -0
- package/src/lib/components/dateSelector/index.test.tsx +2 -2
- package/src/lib/components/dateSelector/index.tsx +14 -14
- package/src/lib/components/input/a.stories.mdx +2 -2
- package/src/lib/components/input/autoSuggestInput/index.tsx +1 -1
- package/src/lib/components/input/currency/index.tsx +1 -1
- package/src/lib/components/input/iban/index.tsx +1 -1
- package/src/lib/components/input/index.tsx +4 -4
- package/src/lib/components/input/input.stories.tsx +48 -0
- package/src/lib/components/input/stories/config.ts +56 -0
- package/src/lib/components/multiDropzone/index.stories.tsx +228 -0
- package/src/lib/components/multiDropzone/index.test.tsx +1 -1
- package/src/lib/components/multiDropzone/index.tsx +6 -6
- package/src/lib/index.tsx +4 -3
- package/src/lib/scss/public/colors/default.scss +2 -2
- package/src/lib/scss/public/demo.tsx +1 -1
- package/src/lib/util/images/index.ts +7 -0
- package/dist/esm/index-e81a1766.js.map +0 -1
- package/src/lib/components/cards/cardButton/index.stories.mdx +0 -47
- package/src/lib/components/cards/cardWithLeftIcon/index.stories.mdx +0 -103
- package/src/lib/components/cards/cardWithTopIcon/index.stories.mdx +0 -105
- package/src/lib/components/cards/cardWithTopLeftIcon/index.stories.mdx +0 -101
- package/src/lib/components/cards/infoCard/index.stories.mdx +0 -61
- package/src/lib/components/dateSelector/index.stories.mdx +0 -106
- package/src/lib/components/input/index.stories.mdx +0 -108
- package/src/lib/components/multiDropzone/index.stories.mdx +0 -187
|
@@ -0,0 +1,2179 @@
|
|
|
1
|
+
import { _ as __assign } from './tslib.es6-5bc94358.js';
|
|
2
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
3
|
+
import React__default, { useEffect, useState, useRef } from 'react';
|
|
4
|
+
import { c as commonjsGlobal, a as getDefaultExportFromCjs } from './_commonjsHelpers-e7f67fd8.js';
|
|
5
|
+
import { s as styleInject } from './style-inject.es-1f59c1d0.js';
|
|
6
|
+
|
|
7
|
+
var dayjs_min = {exports: {}};
|
|
8
|
+
|
|
9
|
+
(function (module, exports) {
|
|
10
|
+
!function(t,e){module.exports=e();}(commonjsGlobal,(function(){var t=1e3,e=6e4,n=36e5,r="millisecond",i="second",s="minute",u="hour",a="day",o="week",f="month",h="quarter",c="year",d="date",$="Invalid Date",l=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,y=/\[([^\]]+)]|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,M={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("_")},m=function(t,e,n){var r=String(t);return !r||r.length>=e?t:""+Array(e+1-r.length).join(n)+t},g={s:m,z:function(t){var e=-t.utcOffset(),n=Math.abs(e),r=Math.floor(n/60),i=n%60;return (e<=0?"+":"-")+m(r,2,"0")+":"+m(i,2,"0")},m:function t(e,n){if(e.date()<n.date())return -t(n,e);var r=12*(n.year()-e.year())+(n.month()-e.month()),i=e.clone().add(r,f),s=n-i<0,u=e.clone().add(r+(s?-1:1),f);return +(-(r+(n-i)/(s?i-u:u-i))||0)},a:function(t){return t<0?Math.ceil(t)||0:Math.floor(t)},p:function(t){return {M:f,y:c,w:o,d:a,D:d,h:u,m:s,s:i,ms:r,Q:h}[t]||String(t||"").toLowerCase().replace(/s$/,"")},u:function(t){return void 0===t}},D="en",v={};v[D]=M;var p=function(t){return t instanceof _},S=function(t,e,n){var r;if(!t)return D;if("string"==typeof t)v[t]&&(r=t),e&&(v[t]=e,r=t);else {var i=t.name;v[i]=t,r=i;}return !n&&r&&(D=r),r||!n&&D},w=function(t,e){if(p(t))return t.clone();var n="object"==typeof e?e:{};return n.date=t,n.args=arguments,new _(n)},O=g;O.l=S,O.i=p,O.w=function(t,e){return w(t,{locale:e.$L,utc:e.$u,x:e.$x,$offset:e.$offset})};var _=function(){function M(t){this.$L=S(t.locale,null,!0),this.parse(t);}var m=M.prototype;return m.parse=function(t){this.$d=function(t){var e=t.date,n=t.utc;if(null===e)return new Date(NaN);if(O.u(e))return new Date;if(e instanceof Date)return new Date(e);if("string"==typeof e&&!/Z$/i.test(e)){var r=e.match(l);if(r){var i=r[2]-1||0,s=(r[7]||"0").substring(0,3);return n?new Date(Date.UTC(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,s)):new Date(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,s)}}return new Date(e)}(t),this.$x=t.x||{},this.init();},m.init=function(){var t=this.$d;this.$y=t.getFullYear(),this.$M=t.getMonth(),this.$D=t.getDate(),this.$W=t.getDay(),this.$H=t.getHours(),this.$m=t.getMinutes(),this.$s=t.getSeconds(),this.$ms=t.getMilliseconds();},m.$utils=function(){return O},m.isValid=function(){return !(this.$d.toString()===$)},m.isSame=function(t,e){var n=w(t);return this.startOf(e)<=n&&n<=this.endOf(e)},m.isAfter=function(t,e){return w(t)<this.startOf(e)},m.isBefore=function(t,e){return this.endOf(e)<w(t)},m.$g=function(t,e,n){return O.u(t)?this[e]:this.set(n,t)},m.unix=function(){return Math.floor(this.valueOf()/1e3)},m.valueOf=function(){return this.$d.getTime()},m.startOf=function(t,e){var n=this,r=!!O.u(e)||e,h=O.p(t),$=function(t,e){var i=O.w(n.$u?Date.UTC(n.$y,e,t):new Date(n.$y,e,t),n);return r?i:i.endOf(a)},l=function(t,e){return O.w(n.toDate()[t].apply(n.toDate("s"),(r?[0,0,0,0]:[23,59,59,999]).slice(e)),n)},y=this.$W,M=this.$M,m=this.$D,g="set"+(this.$u?"UTC":"");switch(h){case c:return r?$(1,0):$(31,11);case f:return r?$(1,M):$(0,M+1);case o:var D=this.$locale().weekStart||0,v=(y<D?y+7:y)-D;return $(r?m-v:m+(6-v),M);case a:case d:return l(g+"Hours",0);case u:return l(g+"Minutes",1);case s:return l(g+"Seconds",2);case i:return l(g+"Milliseconds",3);default:return this.clone()}},m.endOf=function(t){return this.startOf(t,!1)},m.$set=function(t,e){var n,o=O.p(t),h="set"+(this.$u?"UTC":""),$=(n={},n[a]=h+"Date",n[d]=h+"Date",n[f]=h+"Month",n[c]=h+"FullYear",n[u]=h+"Hours",n[s]=h+"Minutes",n[i]=h+"Seconds",n[r]=h+"Milliseconds",n)[o],l=o===a?this.$D+(e-this.$W):e;if(o===f||o===c){var y=this.clone().set(d,1);y.$d[$](l),y.init(),this.$d=y.set(d,Math.min(this.$D,y.daysInMonth())).$d;}else $&&this.$d[$](l);return this.init(),this},m.set=function(t,e){return this.clone().$set(t,e)},m.get=function(t){return this[O.p(t)]()},m.add=function(r,h){var d,$=this;r=Number(r);var l=O.p(h),y=function(t){var e=w($);return O.w(e.date(e.date()+Math.round(t*r)),$)};if(l===f)return this.set(f,this.$M+r);if(l===c)return this.set(c,this.$y+r);if(l===a)return y(1);if(l===o)return y(7);var M=(d={},d[s]=e,d[u]=n,d[i]=t,d)[l]||1,m=this.$d.getTime()+r*M;return O.w(m,this)},m.subtract=function(t,e){return this.add(-1*t,e)},m.format=function(t){var e=this,n=this.$locale();if(!this.isValid())return n.invalidDate||$;var r=t||"YYYY-MM-DDTHH:mm:ssZ",i=O.z(this),s=this.$H,u=this.$m,a=this.$M,o=n.weekdays,f=n.months,h=function(t,n,i,s){return t&&(t[n]||t(e,r))||i[n].substr(0,s)},c=function(t){return O.s(s%12||12,t,"0")},d=n.meridiem||function(t,e,n){var r=t<12?"AM":"PM";return n?r.toLowerCase():r},l={YY:String(this.$y).slice(-2),YYYY:this.$y,M:a+1,MM:O.s(a+1,2,"0"),MMM:h(n.monthsShort,a,f,3),MMMM:h(f,a),D:this.$D,DD:O.s(this.$D,2,"0"),d:String(this.$W),dd:h(n.weekdaysMin,this.$W,o,2),ddd:h(n.weekdaysShort,this.$W,o,3),dddd:o[this.$W],H:String(s),HH:O.s(s,2,"0"),h:c(1),hh:c(2),a:d(s,u,!0),A:d(s,u,!1),m:String(u),mm:O.s(u,2,"0"),s:String(this.$s),ss:O.s(this.$s,2,"0"),SSS:O.s(this.$ms,3,"0"),Z:i};return r.replace(y,(function(t,e){return e||l[t]||i.replace(":","")}))},m.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},m.diff=function(r,d,$){var l,y=O.p(d),M=w(r),m=(M.utcOffset()-this.utcOffset())*e,g=this-M,D=O.m(this,M);return D=(l={},l[c]=D/12,l[f]=D,l[h]=D/3,l[o]=(g-m)/6048e5,l[a]=(g-m)/864e5,l[u]=g/n,l[s]=g/e,l[i]=g/t,l)[y]||g,$?D:O.a(D)},m.daysInMonth=function(){return this.endOf(f).$D},m.$locale=function(){return v[this.$L]},m.locale=function(t,e){if(!t)return this.$L;var n=this.clone(),r=S(t,e,!0);return r&&(n.$L=r),n},m.clone=function(){return O.w(this.$d,this)},m.toDate=function(){return new Date(this.valueOf())},m.toJSON=function(){return this.isValid()?this.toISOString():null},m.toISOString=function(){return this.$d.toISOString()},m.toString=function(){return this.$d.toUTCString()},M}(),b=_.prototype;return w.prototype=b,[["$ms",r],["$s",i],["$m",s],["$H",u],["$W",a],["$M",f],["$y",c],["$D",d]].forEach((function(t){b[t[1]]=function(e){return this.$g(e,t[0],t[1])};})),w.extend=function(t,e){return t.$i||(t(e,_,w),t.$i=!0),w},w.locale=S,w.isDayjs=p,w.unix=function(t){return w(1e3*t)},w.en=v[D],w.Ls=v,w.p={},w}));
|
|
11
|
+
}(dayjs_min));
|
|
12
|
+
|
|
13
|
+
var dayjs = dayjs_min.exports;
|
|
14
|
+
|
|
15
|
+
var localeData$1 = {exports: {}};
|
|
16
|
+
|
|
17
|
+
(function (module, exports) {
|
|
18
|
+
!function(n,e){module.exports=e();}(commonjsGlobal,(function(){return function(n,e,t){var r=e.prototype,o=function(n){return n&&(n.indexOf?n:n.s)},u=function(n,e,t,r,u){var i=n.name?n:n.$locale(),a=o(i[e]),s=o(i[t]),f=a||s.map((function(n){return n.substr(0,r)}));if(!u)return f;var d=i.weekStart;return f.map((function(n,e){return f[(e+(d||0))%7]}))},i=function(){return t.Ls[t.locale()]},a=function(n,e){return n.formats[e]||function(n){return n.replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,(function(n,e,t){return e||t.slice(1)}))}(n.formats[e.toUpperCase()])},s=function(){var n=this;return {months:function(e){return e?e.format("MMMM"):u(n,"months")},monthsShort:function(e){return e?e.format("MMM"):u(n,"monthsShort","months",3)},firstDayOfWeek:function(){return n.$locale().weekStart||0},weekdays:function(e){return e?e.format("dddd"):u(n,"weekdays")},weekdaysMin:function(e){return e?e.format("dd"):u(n,"weekdaysMin","weekdays",2)},weekdaysShort:function(e){return e?e.format("ddd"):u(n,"weekdaysShort","weekdays",3)},longDateFormat:function(e){return a(n.$locale(),e)},meridiem:this.$locale().meridiem,ordinal:this.$locale().ordinal}};r.localeData=function(){return s.bind(this)()},t.localeData=function(){var n=i();return {firstDayOfWeek:function(){return n.weekStart||0},weekdays:function(){return t.weekdays()},weekdaysShort:function(){return t.weekdaysShort()},weekdaysMin:function(){return t.weekdaysMin()},months:function(){return t.months()},monthsShort:function(){return t.monthsShort()},longDateFormat:function(e){return a(n,e)},meridiem:n.meridiem,ordinal:n.ordinal}},t.months=function(){return u(i(),"months")},t.monthsShort=function(){return u(i(),"monthsShort","months",3)},t.weekdays=function(n){return u(i(),"weekdays",null,null,n)},t.weekdaysShort=function(n){return u(i(),"weekdaysShort","weekdays",3,n)},t.weekdaysMin=function(n){return u(i(),"weekdaysMin","weekdays",2,n)};}}));
|
|
19
|
+
}(localeData$1));
|
|
20
|
+
|
|
21
|
+
var localeData = localeData$1.exports;
|
|
22
|
+
|
|
23
|
+
var build = {};
|
|
24
|
+
|
|
25
|
+
var DayPicker$2 = {};
|
|
26
|
+
|
|
27
|
+
var Caption$1 = {};
|
|
28
|
+
|
|
29
|
+
var LocaleUtils$1 = {};
|
|
30
|
+
|
|
31
|
+
Object.defineProperty(LocaleUtils$1, "__esModule", {
|
|
32
|
+
value: true
|
|
33
|
+
});
|
|
34
|
+
LocaleUtils$1.formatDay = formatDay;
|
|
35
|
+
LocaleUtils$1.formatMonthTitle = formatMonthTitle;
|
|
36
|
+
LocaleUtils$1.formatWeekdayShort = formatWeekdayShort;
|
|
37
|
+
LocaleUtils$1.formatWeekdayLong = formatWeekdayLong;
|
|
38
|
+
LocaleUtils$1.getFirstDayOfWeek = getFirstDayOfWeek;
|
|
39
|
+
LocaleUtils$1.getMonths = getMonths;
|
|
40
|
+
var WEEKDAYS_LONG = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'];
|
|
41
|
+
|
|
42
|
+
var WEEKDAYS_SHORT = ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'];
|
|
43
|
+
|
|
44
|
+
var MONTHS = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'];
|
|
45
|
+
|
|
46
|
+
function formatDay(day) {
|
|
47
|
+
return day.toDateString();
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function formatMonthTitle(d) {
|
|
51
|
+
return MONTHS[d.getMonth()] + ' ' + d.getFullYear();
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
function formatWeekdayShort(i) {
|
|
55
|
+
return WEEKDAYS_SHORT[i];
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
function formatWeekdayLong(i) {
|
|
59
|
+
return WEEKDAYS_LONG[i];
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
function getFirstDayOfWeek() {
|
|
63
|
+
return 0;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
function getMonths() {
|
|
67
|
+
return MONTHS;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
LocaleUtils$1.default = {
|
|
71
|
+
formatDay: formatDay,
|
|
72
|
+
formatMonthTitle: formatMonthTitle,
|
|
73
|
+
formatWeekdayShort: formatWeekdayShort,
|
|
74
|
+
formatWeekdayLong: formatWeekdayLong,
|
|
75
|
+
getFirstDayOfWeek: getFirstDayOfWeek,
|
|
76
|
+
getMonths: getMonths
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
var keys = {};
|
|
80
|
+
|
|
81
|
+
Object.defineProperty(keys, "__esModule", {
|
|
82
|
+
value: true
|
|
83
|
+
});
|
|
84
|
+
keys.LEFT = 37;
|
|
85
|
+
keys.UP = 38;
|
|
86
|
+
keys.RIGHT = 39;
|
|
87
|
+
keys.DOWN = 40;
|
|
88
|
+
keys.ENTER = 13;
|
|
89
|
+
keys.SPACE = 32;
|
|
90
|
+
keys.ESC = 27;
|
|
91
|
+
keys.TAB = 9;
|
|
92
|
+
|
|
93
|
+
Object.defineProperty(Caption$1, "__esModule", {
|
|
94
|
+
value: true
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
var _createClass$6 = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
|
98
|
+
|
|
99
|
+
var _react$6 = React__default;
|
|
100
|
+
|
|
101
|
+
var _react2$6 = _interopRequireDefault$7(_react$6);
|
|
102
|
+
|
|
103
|
+
var _LocaleUtils$2 = LocaleUtils$1;
|
|
104
|
+
|
|
105
|
+
var _LocaleUtils2 = _interopRequireDefault$7(_LocaleUtils$2);
|
|
106
|
+
|
|
107
|
+
var _keys$3 = keys;
|
|
108
|
+
|
|
109
|
+
function _interopRequireDefault$7(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
110
|
+
|
|
111
|
+
function _classCallCheck$6(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
112
|
+
|
|
113
|
+
function _possibleConstructorReturn$6(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
|
114
|
+
|
|
115
|
+
function _inherits$6(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
|
116
|
+
|
|
117
|
+
var Caption = function (_Component) {
|
|
118
|
+
_inherits$6(Caption, _Component);
|
|
119
|
+
|
|
120
|
+
function Caption(props) {
|
|
121
|
+
_classCallCheck$6(this, Caption);
|
|
122
|
+
|
|
123
|
+
var _this = _possibleConstructorReturn$6(this, (Caption.__proto__ || Object.getPrototypeOf(Caption)).call(this, props));
|
|
124
|
+
|
|
125
|
+
_this.handleKeyUp = _this.handleKeyUp.bind(_this);
|
|
126
|
+
return _this;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
_createClass$6(Caption, [{
|
|
130
|
+
key: 'shouldComponentUpdate',
|
|
131
|
+
value: function shouldComponentUpdate(nextProps) {
|
|
132
|
+
return nextProps.locale !== this.props.locale || nextProps.classNames !== this.props.classNames || nextProps.date.getMonth() !== this.props.date.getMonth() || nextProps.date.getFullYear() !== this.props.date.getFullYear();
|
|
133
|
+
}
|
|
134
|
+
}, {
|
|
135
|
+
key: 'handleKeyUp',
|
|
136
|
+
value: function handleKeyUp(e) {
|
|
137
|
+
if (e.keyCode === _keys$3.ENTER) {
|
|
138
|
+
this.props.onClick(e);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
}, {
|
|
142
|
+
key: 'render',
|
|
143
|
+
value: function render() {
|
|
144
|
+
var _props = this.props,
|
|
145
|
+
classNames = _props.classNames,
|
|
146
|
+
date = _props.date,
|
|
147
|
+
months = _props.months,
|
|
148
|
+
locale = _props.locale,
|
|
149
|
+
localeUtils = _props.localeUtils,
|
|
150
|
+
onClick = _props.onClick;
|
|
151
|
+
|
|
152
|
+
return _react2$6.default.createElement(
|
|
153
|
+
'div',
|
|
154
|
+
{ className: classNames.caption, role: 'heading', 'aria-live': 'polite' },
|
|
155
|
+
_react2$6.default.createElement(
|
|
156
|
+
'div',
|
|
157
|
+
{ onClick: onClick, onKeyUp: this.handleKeyUp },
|
|
158
|
+
months ? months[date.getMonth()] + ' ' + date.getFullYear() : localeUtils.formatMonthTitle(date, locale)
|
|
159
|
+
)
|
|
160
|
+
);
|
|
161
|
+
}
|
|
162
|
+
}]);
|
|
163
|
+
|
|
164
|
+
return Caption;
|
|
165
|
+
}(_react$6.Component);
|
|
166
|
+
|
|
167
|
+
Caption.defaultProps = {
|
|
168
|
+
localeUtils: _LocaleUtils2.default
|
|
169
|
+
};
|
|
170
|
+
Caption$1.default = Caption;
|
|
171
|
+
|
|
172
|
+
var Navbar$1 = {};
|
|
173
|
+
|
|
174
|
+
var classNames = {};
|
|
175
|
+
|
|
176
|
+
Object.defineProperty(classNames, "__esModule", {
|
|
177
|
+
value: true
|
|
178
|
+
});
|
|
179
|
+
// Proxy object to map classnames when css modules are not used
|
|
180
|
+
|
|
181
|
+
classNames.default = {
|
|
182
|
+
container: 'DayPicker',
|
|
183
|
+
wrapper: 'DayPicker-wrapper',
|
|
184
|
+
interactionDisabled: 'DayPicker--interactionDisabled',
|
|
185
|
+
months: 'DayPicker-Months',
|
|
186
|
+
month: 'DayPicker-Month',
|
|
187
|
+
|
|
188
|
+
navBar: 'DayPicker-NavBar',
|
|
189
|
+
navButtonPrev: 'DayPicker-NavButton DayPicker-NavButton--prev',
|
|
190
|
+
navButtonNext: 'DayPicker-NavButton DayPicker-NavButton--next',
|
|
191
|
+
navButtonInteractionDisabled: 'DayPicker-NavButton--interactionDisabled',
|
|
192
|
+
|
|
193
|
+
caption: 'DayPicker-Caption',
|
|
194
|
+
weekdays: 'DayPicker-Weekdays',
|
|
195
|
+
weekdaysRow: 'DayPicker-WeekdaysRow',
|
|
196
|
+
weekday: 'DayPicker-Weekday',
|
|
197
|
+
body: 'DayPicker-Body',
|
|
198
|
+
week: 'DayPicker-Week',
|
|
199
|
+
weekNumber: 'DayPicker-WeekNumber',
|
|
200
|
+
day: 'DayPicker-Day',
|
|
201
|
+
footer: 'DayPicker-Footer',
|
|
202
|
+
todayButton: 'DayPicker-TodayButton',
|
|
203
|
+
|
|
204
|
+
// default modifiers
|
|
205
|
+
today: 'today',
|
|
206
|
+
selected: 'selected',
|
|
207
|
+
disabled: 'disabled',
|
|
208
|
+
outside: 'outside'
|
|
209
|
+
};
|
|
210
|
+
|
|
211
|
+
Object.defineProperty(Navbar$1, "__esModule", {
|
|
212
|
+
value: true
|
|
213
|
+
});
|
|
214
|
+
|
|
215
|
+
var _createClass$5 = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
|
216
|
+
|
|
217
|
+
var _react$5 = React__default;
|
|
218
|
+
|
|
219
|
+
var _react2$5 = _interopRequireDefault$6(_react$5);
|
|
220
|
+
|
|
221
|
+
var _classNames$3 = classNames;
|
|
222
|
+
|
|
223
|
+
var _classNames2$3 = _interopRequireDefault$6(_classNames$3);
|
|
224
|
+
|
|
225
|
+
var _keys$2 = keys;
|
|
226
|
+
|
|
227
|
+
function _interopRequireDefault$6(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
228
|
+
|
|
229
|
+
function _classCallCheck$5(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
230
|
+
|
|
231
|
+
function _possibleConstructorReturn$5(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
|
232
|
+
|
|
233
|
+
function _inherits$5(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
|
234
|
+
|
|
235
|
+
var Navbar = function (_Component) {
|
|
236
|
+
_inherits$5(Navbar, _Component);
|
|
237
|
+
|
|
238
|
+
function Navbar() {
|
|
239
|
+
var _ref;
|
|
240
|
+
|
|
241
|
+
var _temp, _this, _ret;
|
|
242
|
+
|
|
243
|
+
_classCallCheck$5(this, Navbar);
|
|
244
|
+
|
|
245
|
+
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
|
|
246
|
+
args[_key] = arguments[_key];
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
return _ret = (_temp = (_this = _possibleConstructorReturn$5(this, (_ref = Navbar.__proto__ || Object.getPrototypeOf(Navbar)).call.apply(_ref, [this].concat(args))), _this), _this.handleNextClick = function () {
|
|
250
|
+
if (_this.props.onNextClick) {
|
|
251
|
+
_this.props.onNextClick();
|
|
252
|
+
}
|
|
253
|
+
}, _this.handlePreviousClick = function () {
|
|
254
|
+
if (_this.props.onPreviousClick) {
|
|
255
|
+
_this.props.onPreviousClick();
|
|
256
|
+
}
|
|
257
|
+
}, _this.handleNextKeyDown = function (e) {
|
|
258
|
+
if (e.keyCode !== _keys$2.ENTER && e.keyCode !== _keys$2.SPACE) {
|
|
259
|
+
return;
|
|
260
|
+
}
|
|
261
|
+
e.preventDefault();
|
|
262
|
+
_this.handleNextClick();
|
|
263
|
+
}, _this.handlePreviousKeyDown = function (e) {
|
|
264
|
+
if (e.keyCode !== _keys$2.ENTER && e.keyCode !== _keys$2.SPACE) {
|
|
265
|
+
return;
|
|
266
|
+
}
|
|
267
|
+
e.preventDefault();
|
|
268
|
+
_this.handlePreviousClick();
|
|
269
|
+
}, _temp), _possibleConstructorReturn$5(_this, _ret);
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
_createClass$5(Navbar, [{
|
|
273
|
+
key: 'shouldComponentUpdate',
|
|
274
|
+
value: function shouldComponentUpdate(nextProps) {
|
|
275
|
+
return nextProps.labels !== this.props.labels || nextProps.dir !== this.props.dir || this.props.showPreviousButton !== nextProps.showPreviousButton || this.props.showNextButton !== nextProps.showNextButton;
|
|
276
|
+
}
|
|
277
|
+
}, {
|
|
278
|
+
key: 'render',
|
|
279
|
+
value: function render() {
|
|
280
|
+
var _props = this.props,
|
|
281
|
+
classNames = _props.classNames,
|
|
282
|
+
className = _props.className,
|
|
283
|
+
showPreviousButton = _props.showPreviousButton,
|
|
284
|
+
showNextButton = _props.showNextButton,
|
|
285
|
+
labels = _props.labels,
|
|
286
|
+
dir = _props.dir;
|
|
287
|
+
|
|
288
|
+
|
|
289
|
+
var previousClickHandler = void 0;
|
|
290
|
+
var nextClickHandler = void 0;
|
|
291
|
+
var previousKeyDownHandler = void 0;
|
|
292
|
+
var nextKeyDownHandler = void 0;
|
|
293
|
+
var shouldShowPrevious = void 0;
|
|
294
|
+
var shouldShowNext = void 0;
|
|
295
|
+
|
|
296
|
+
if (dir === 'rtl') {
|
|
297
|
+
previousClickHandler = this.handleNextClick;
|
|
298
|
+
nextClickHandler = this.handlePreviousClick;
|
|
299
|
+
previousKeyDownHandler = this.handleNextKeyDown;
|
|
300
|
+
nextKeyDownHandler = this.handlePreviousKeyDown;
|
|
301
|
+
shouldShowNext = showPreviousButton;
|
|
302
|
+
shouldShowPrevious = showNextButton;
|
|
303
|
+
} else {
|
|
304
|
+
previousClickHandler = this.handlePreviousClick;
|
|
305
|
+
nextClickHandler = this.handleNextClick;
|
|
306
|
+
previousKeyDownHandler = this.handlePreviousKeyDown;
|
|
307
|
+
nextKeyDownHandler = this.handleNextKeyDown;
|
|
308
|
+
shouldShowNext = showNextButton;
|
|
309
|
+
shouldShowPrevious = showPreviousButton;
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
var previousClassName = shouldShowPrevious ? classNames.navButtonPrev : classNames.navButtonPrev + ' ' + classNames.navButtonInteractionDisabled;
|
|
313
|
+
|
|
314
|
+
var nextClassName = shouldShowNext ? classNames.navButtonNext : classNames.navButtonNext + ' ' + classNames.navButtonInteractionDisabled;
|
|
315
|
+
|
|
316
|
+
var previousButton = _react2$5.default.createElement('span', {
|
|
317
|
+
tabIndex: '0',
|
|
318
|
+
role: 'button',
|
|
319
|
+
'aria-label': labels.previousMonth,
|
|
320
|
+
key: 'previous',
|
|
321
|
+
className: previousClassName,
|
|
322
|
+
onKeyDown: shouldShowPrevious ? previousKeyDownHandler : undefined,
|
|
323
|
+
onClick: shouldShowPrevious ? previousClickHandler : undefined
|
|
324
|
+
});
|
|
325
|
+
|
|
326
|
+
var nextButton = _react2$5.default.createElement('span', {
|
|
327
|
+
tabIndex: '0',
|
|
328
|
+
role: 'button',
|
|
329
|
+
'aria-label': labels.nextMonth,
|
|
330
|
+
key: 'right',
|
|
331
|
+
className: nextClassName,
|
|
332
|
+
onKeyDown: shouldShowNext ? nextKeyDownHandler : undefined,
|
|
333
|
+
onClick: shouldShowNext ? nextClickHandler : undefined
|
|
334
|
+
});
|
|
335
|
+
|
|
336
|
+
return _react2$5.default.createElement(
|
|
337
|
+
'div',
|
|
338
|
+
{ className: className || classNames.navBar },
|
|
339
|
+
dir === 'rtl' ? [nextButton, previousButton] : [previousButton, nextButton]
|
|
340
|
+
);
|
|
341
|
+
}
|
|
342
|
+
}]);
|
|
343
|
+
|
|
344
|
+
return Navbar;
|
|
345
|
+
}(_react$5.Component);
|
|
346
|
+
|
|
347
|
+
Navbar.defaultProps = {
|
|
348
|
+
classNames: _classNames2$3.default,
|
|
349
|
+
dir: 'ltr',
|
|
350
|
+
labels: {
|
|
351
|
+
previousMonth: 'Previous Month',
|
|
352
|
+
nextMonth: 'Next Month'
|
|
353
|
+
},
|
|
354
|
+
showPreviousButton: true,
|
|
355
|
+
showNextButton: true
|
|
356
|
+
};
|
|
357
|
+
Navbar$1.default = Navbar;
|
|
358
|
+
|
|
359
|
+
var Month$1 = {};
|
|
360
|
+
|
|
361
|
+
var Weekdays$1 = {};
|
|
362
|
+
|
|
363
|
+
Object.defineProperty(Weekdays$1, "__esModule", {
|
|
364
|
+
value: true
|
|
365
|
+
});
|
|
366
|
+
|
|
367
|
+
var _createClass$4 = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
|
368
|
+
|
|
369
|
+
var _react$4 = React__default;
|
|
370
|
+
|
|
371
|
+
var _react2$4 = _interopRequireDefault$5(_react$4);
|
|
372
|
+
|
|
373
|
+
function _interopRequireDefault$5(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
374
|
+
|
|
375
|
+
function _classCallCheck$4(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
376
|
+
|
|
377
|
+
function _possibleConstructorReturn$4(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
|
378
|
+
|
|
379
|
+
function _inherits$4(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
|
380
|
+
|
|
381
|
+
var Weekdays = function (_Component) {
|
|
382
|
+
_inherits$4(Weekdays, _Component);
|
|
383
|
+
|
|
384
|
+
function Weekdays() {
|
|
385
|
+
_classCallCheck$4(this, Weekdays);
|
|
386
|
+
|
|
387
|
+
return _possibleConstructorReturn$4(this, (Weekdays.__proto__ || Object.getPrototypeOf(Weekdays)).apply(this, arguments));
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
_createClass$4(Weekdays, [{
|
|
391
|
+
key: 'shouldComponentUpdate',
|
|
392
|
+
value: function shouldComponentUpdate(nextProps) {
|
|
393
|
+
return this.props !== nextProps;
|
|
394
|
+
}
|
|
395
|
+
}, {
|
|
396
|
+
key: 'render',
|
|
397
|
+
value: function render() {
|
|
398
|
+
var _props = this.props,
|
|
399
|
+
classNames = _props.classNames,
|
|
400
|
+
firstDayOfWeek = _props.firstDayOfWeek,
|
|
401
|
+
showWeekNumbers = _props.showWeekNumbers,
|
|
402
|
+
weekdaysLong = _props.weekdaysLong,
|
|
403
|
+
weekdaysShort = _props.weekdaysShort,
|
|
404
|
+
locale = _props.locale,
|
|
405
|
+
localeUtils = _props.localeUtils,
|
|
406
|
+
weekdayElement = _props.weekdayElement;
|
|
407
|
+
|
|
408
|
+
var days = [];
|
|
409
|
+
for (var i = 0; i < 7; i += 1) {
|
|
410
|
+
var weekday = (i + firstDayOfWeek) % 7;
|
|
411
|
+
var elementProps = {
|
|
412
|
+
key: i,
|
|
413
|
+
className: classNames.weekday,
|
|
414
|
+
weekday: weekday,
|
|
415
|
+
weekdaysLong: weekdaysLong,
|
|
416
|
+
weekdaysShort: weekdaysShort,
|
|
417
|
+
localeUtils: localeUtils,
|
|
418
|
+
locale: locale
|
|
419
|
+
};
|
|
420
|
+
var element = _react2$4.default.isValidElement(weekdayElement) ? _react2$4.default.cloneElement(weekdayElement, elementProps) : _react2$4.default.createElement(weekdayElement, elementProps);
|
|
421
|
+
days.push(element);
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
return _react2$4.default.createElement(
|
|
425
|
+
'div',
|
|
426
|
+
{ className: classNames.weekdays, role: 'rowgroup' },
|
|
427
|
+
_react2$4.default.createElement(
|
|
428
|
+
'div',
|
|
429
|
+
{ className: classNames.weekdaysRow, role: 'row' },
|
|
430
|
+
showWeekNumbers && _react2$4.default.createElement('div', { className: classNames.weekday }),
|
|
431
|
+
days
|
|
432
|
+
)
|
|
433
|
+
);
|
|
434
|
+
}
|
|
435
|
+
}]);
|
|
436
|
+
|
|
437
|
+
return Weekdays;
|
|
438
|
+
}(_react$4.Component);
|
|
439
|
+
|
|
440
|
+
Weekdays$1.default = Weekdays;
|
|
441
|
+
|
|
442
|
+
var Day$1 = {};
|
|
443
|
+
|
|
444
|
+
var DateUtils$2 = {};
|
|
445
|
+
|
|
446
|
+
Object.defineProperty(DateUtils$2, "__esModule", {
|
|
447
|
+
value: true
|
|
448
|
+
});
|
|
449
|
+
DateUtils$2.clone = clone;
|
|
450
|
+
DateUtils$2.isDate = isDate;
|
|
451
|
+
DateUtils$2.addMonths = addMonths;
|
|
452
|
+
DateUtils$2.isSameDay = isSameDay;
|
|
453
|
+
DateUtils$2.isSameMonth = isSameMonth;
|
|
454
|
+
DateUtils$2.isDayBefore = isDayBefore;
|
|
455
|
+
DateUtils$2.isDayAfter = isDayAfter;
|
|
456
|
+
DateUtils$2.isPastDay = isPastDay;
|
|
457
|
+
DateUtils$2.isFutureDay = isFutureDay;
|
|
458
|
+
DateUtils$2.isDayBetween = isDayBetween;
|
|
459
|
+
DateUtils$2.addDayToRange = addDayToRange;
|
|
460
|
+
DateUtils$2.isDayInRange = isDayInRange;
|
|
461
|
+
DateUtils$2.getWeekNumber = getWeekNumber;
|
|
462
|
+
/**
|
|
463
|
+
* Clone a date object.
|
|
464
|
+
*
|
|
465
|
+
* @export
|
|
466
|
+
* @param {Date} d The date to clone
|
|
467
|
+
* @return {Date} The cloned date
|
|
468
|
+
*/
|
|
469
|
+
function clone(d) {
|
|
470
|
+
return new Date(d.getTime());
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
/**
|
|
474
|
+
* Return `true` if the passed value is a valid JavaScript Date object.
|
|
475
|
+
*
|
|
476
|
+
* @export
|
|
477
|
+
* @param {any} value
|
|
478
|
+
* @returns {Boolean}
|
|
479
|
+
*/
|
|
480
|
+
function isDate(value) {
|
|
481
|
+
return value instanceof Date && !isNaN(value.valueOf());
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
/**
|
|
485
|
+
* Return `d` as a new date with `n` months added.
|
|
486
|
+
*
|
|
487
|
+
* @export
|
|
488
|
+
* @param {Date} d
|
|
489
|
+
* @param {number} n
|
|
490
|
+
*/
|
|
491
|
+
function addMonths(d, n) {
|
|
492
|
+
var newDate = clone(d);
|
|
493
|
+
newDate.setMonth(d.getMonth() + n);
|
|
494
|
+
return newDate;
|
|
495
|
+
}
|
|
496
|
+
|
|
497
|
+
/**
|
|
498
|
+
* Return `true` if two dates are the same day, ignoring the time.
|
|
499
|
+
*
|
|
500
|
+
* @export
|
|
501
|
+
* @param {Date} d1
|
|
502
|
+
* @param {Date} d2
|
|
503
|
+
* @return {Boolean}
|
|
504
|
+
*/
|
|
505
|
+
function isSameDay(d1, d2) {
|
|
506
|
+
if (!d1 || !d2) {
|
|
507
|
+
return false;
|
|
508
|
+
}
|
|
509
|
+
return d1.getDate() === d2.getDate() && d1.getMonth() === d2.getMonth() && d1.getFullYear() === d2.getFullYear();
|
|
510
|
+
}
|
|
511
|
+
|
|
512
|
+
/**
|
|
513
|
+
* Return `true` if two dates fall in the same month.
|
|
514
|
+
*
|
|
515
|
+
* @export
|
|
516
|
+
* @param {Date} d1
|
|
517
|
+
* @param {Date} d2
|
|
518
|
+
* @return {Boolean}
|
|
519
|
+
*/
|
|
520
|
+
function isSameMonth(d1, d2) {
|
|
521
|
+
if (!d1 || !d2) {
|
|
522
|
+
return false;
|
|
523
|
+
}
|
|
524
|
+
return d1.getMonth() === d2.getMonth() && d1.getFullYear() === d2.getFullYear();
|
|
525
|
+
}
|
|
526
|
+
|
|
527
|
+
/**
|
|
528
|
+
* Returns `true` if the first day is before the second day.
|
|
529
|
+
*
|
|
530
|
+
* @export
|
|
531
|
+
* @param {Date} d1
|
|
532
|
+
* @param {Date} d2
|
|
533
|
+
* @returns {Boolean}
|
|
534
|
+
*/
|
|
535
|
+
function isDayBefore(d1, d2) {
|
|
536
|
+
var day1 = clone(d1).setHours(0, 0, 0, 0);
|
|
537
|
+
var day2 = clone(d2).setHours(0, 0, 0, 0);
|
|
538
|
+
return day1 < day2;
|
|
539
|
+
}
|
|
540
|
+
|
|
541
|
+
/**
|
|
542
|
+
* Returns `true` if the first day is after the second day.
|
|
543
|
+
*
|
|
544
|
+
* @export
|
|
545
|
+
* @param {Date} d1
|
|
546
|
+
* @param {Date} d2
|
|
547
|
+
* @returns {Boolean}
|
|
548
|
+
*/
|
|
549
|
+
function isDayAfter(d1, d2) {
|
|
550
|
+
var day1 = clone(d1).setHours(0, 0, 0, 0);
|
|
551
|
+
var day2 = clone(d2).setHours(0, 0, 0, 0);
|
|
552
|
+
return day1 > day2;
|
|
553
|
+
}
|
|
554
|
+
|
|
555
|
+
/**
|
|
556
|
+
* Return `true` if a day is in the past, e.g. yesterday or any day
|
|
557
|
+
* before yesterday.
|
|
558
|
+
*
|
|
559
|
+
* @export
|
|
560
|
+
* @param {Date} d
|
|
561
|
+
* @return {Boolean}
|
|
562
|
+
*/
|
|
563
|
+
function isPastDay(d) {
|
|
564
|
+
var today = new Date();
|
|
565
|
+
today.setHours(0, 0, 0, 0);
|
|
566
|
+
return isDayBefore(d, today);
|
|
567
|
+
}
|
|
568
|
+
|
|
569
|
+
/**
|
|
570
|
+
* Return `true` if a day is in the future, e.g. tomorrow or any day
|
|
571
|
+
* after tomorrow.
|
|
572
|
+
*
|
|
573
|
+
* @export
|
|
574
|
+
* @param {Date} d
|
|
575
|
+
* @return {Boolean}
|
|
576
|
+
*/
|
|
577
|
+
function isFutureDay(d) {
|
|
578
|
+
var tomorrow = new Date(new Date().getTime() + 24 * 60 * 60 * 1000);
|
|
579
|
+
tomorrow.setHours(0, 0, 0, 0);
|
|
580
|
+
return d >= tomorrow;
|
|
581
|
+
}
|
|
582
|
+
|
|
583
|
+
/**
|
|
584
|
+
* Return `true` if day `d` is between days `d1` and `d2`,
|
|
585
|
+
* without including them.
|
|
586
|
+
*
|
|
587
|
+
* @export
|
|
588
|
+
* @param {Date} d
|
|
589
|
+
* @param {Date} d1
|
|
590
|
+
* @param {Date} d2
|
|
591
|
+
* @return {Boolean}
|
|
592
|
+
*/
|
|
593
|
+
function isDayBetween(d, d1, d2) {
|
|
594
|
+
var date = clone(d);
|
|
595
|
+
date.setHours(0, 0, 0, 0);
|
|
596
|
+
return isDayAfter(date, d1) && isDayBefore(date, d2) || isDayAfter(date, d2) && isDayBefore(date, d1);
|
|
597
|
+
}
|
|
598
|
+
|
|
599
|
+
/**
|
|
600
|
+
* Add a day to a range and return a new range. A range is an object with
|
|
601
|
+
* `from` and `to` days.
|
|
602
|
+
*
|
|
603
|
+
* @export
|
|
604
|
+
* @param {Date} day
|
|
605
|
+
* @param {Object} range
|
|
606
|
+
* @return {Object} Returns a new range object
|
|
607
|
+
*/
|
|
608
|
+
function addDayToRange(day) {
|
|
609
|
+
var range = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : { from: null, to: null };
|
|
610
|
+
var from = range.from,
|
|
611
|
+
to = range.to;
|
|
612
|
+
|
|
613
|
+
if (!from) {
|
|
614
|
+
from = day;
|
|
615
|
+
} else if (from && to && isSameDay(from, to) && isSameDay(day, from)) {
|
|
616
|
+
from = null;
|
|
617
|
+
to = null;
|
|
618
|
+
} else if (to && isDayBefore(day, from)) {
|
|
619
|
+
from = day;
|
|
620
|
+
} else if (to && isSameDay(day, to)) {
|
|
621
|
+
from = day;
|
|
622
|
+
to = day;
|
|
623
|
+
} else {
|
|
624
|
+
to = day;
|
|
625
|
+
if (isDayBefore(to, from)) {
|
|
626
|
+
to = from;
|
|
627
|
+
from = day;
|
|
628
|
+
}
|
|
629
|
+
}
|
|
630
|
+
|
|
631
|
+
return { from: from, to: to };
|
|
632
|
+
}
|
|
633
|
+
|
|
634
|
+
/**
|
|
635
|
+
* Return `true` if a day is included in a range of days.
|
|
636
|
+
*
|
|
637
|
+
* @export
|
|
638
|
+
* @param {Date} day
|
|
639
|
+
* @param {Object} range
|
|
640
|
+
* @return {Boolean}
|
|
641
|
+
*/
|
|
642
|
+
function isDayInRange(day, range) {
|
|
643
|
+
var from = range.from,
|
|
644
|
+
to = range.to;
|
|
645
|
+
|
|
646
|
+
return from && isSameDay(day, from) || to && isSameDay(day, to) || from && to && isDayBetween(day, from, to);
|
|
647
|
+
}
|
|
648
|
+
|
|
649
|
+
/**
|
|
650
|
+
* Return the year's week number (as per ISO, i.e. with the week starting from monday)
|
|
651
|
+
* for the given day.
|
|
652
|
+
*
|
|
653
|
+
* @export
|
|
654
|
+
* @param {Date} day
|
|
655
|
+
* @returns {Number}
|
|
656
|
+
*/
|
|
657
|
+
function getWeekNumber(day) {
|
|
658
|
+
var date = clone(day);
|
|
659
|
+
date.setHours(0, 0, 0);
|
|
660
|
+
date.setDate(date.getDate() + 4 - (date.getDay() || 7));
|
|
661
|
+
return Math.ceil(((date - new Date(date.getFullYear(), 0, 1)) / 8.64e7 + 1) / 7);
|
|
662
|
+
}
|
|
663
|
+
|
|
664
|
+
DateUtils$2.default = {
|
|
665
|
+
addDayToRange: addDayToRange,
|
|
666
|
+
addMonths: addMonths,
|
|
667
|
+
clone: clone,
|
|
668
|
+
getWeekNumber: getWeekNumber,
|
|
669
|
+
isDate: isDate,
|
|
670
|
+
isDayAfter: isDayAfter,
|
|
671
|
+
isDayBefore: isDayBefore,
|
|
672
|
+
isDayBetween: isDayBetween,
|
|
673
|
+
isDayInRange: isDayInRange,
|
|
674
|
+
isFutureDay: isFutureDay,
|
|
675
|
+
isPastDay: isPastDay,
|
|
676
|
+
isSameDay: isSameDay,
|
|
677
|
+
isSameMonth: isSameMonth
|
|
678
|
+
};
|
|
679
|
+
|
|
680
|
+
var Helpers$2 = {};
|
|
681
|
+
|
|
682
|
+
Object.defineProperty(Helpers$2, "__esModule", {
|
|
683
|
+
value: true
|
|
684
|
+
});
|
|
685
|
+
|
|
686
|
+
var _extends$2 = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
|
|
687
|
+
|
|
688
|
+
Helpers$2.cancelEvent = cancelEvent;
|
|
689
|
+
Helpers$2.getFirstDayOfMonth = getFirstDayOfMonth;
|
|
690
|
+
Helpers$2.getDaysInMonth = getDaysInMonth;
|
|
691
|
+
Helpers$2.getModifiersFromProps = getModifiersFromProps;
|
|
692
|
+
Helpers$2.getFirstDayOfWeekFromProps = getFirstDayOfWeekFromProps;
|
|
693
|
+
Helpers$2.isRangeOfDates = isRangeOfDates;
|
|
694
|
+
Helpers$2.getMonthsDiff = getMonthsDiff;
|
|
695
|
+
Helpers$2.getWeekArray = getWeekArray;
|
|
696
|
+
Helpers$2.startOfMonth = startOfMonth;
|
|
697
|
+
Helpers$2.getDayNodes = getDayNodes;
|
|
698
|
+
Helpers$2.nodeListToArray = nodeListToArray;
|
|
699
|
+
Helpers$2.hasOwnProp = hasOwnProp;
|
|
700
|
+
|
|
701
|
+
var _DateUtils$4 = DateUtils$2;
|
|
702
|
+
|
|
703
|
+
var _LocaleUtils$1 = LocaleUtils$1;
|
|
704
|
+
|
|
705
|
+
var _classNames$2 = classNames;
|
|
706
|
+
|
|
707
|
+
var _classNames2$2 = _interopRequireDefault$4(_classNames$2);
|
|
708
|
+
|
|
709
|
+
function _interopRequireDefault$4(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
710
|
+
|
|
711
|
+
function cancelEvent(e) {
|
|
712
|
+
e.preventDefault();
|
|
713
|
+
e.stopPropagation();
|
|
714
|
+
}
|
|
715
|
+
|
|
716
|
+
function getFirstDayOfMonth(d) {
|
|
717
|
+
return new Date(d.getFullYear(), d.getMonth(), 1, 12);
|
|
718
|
+
}
|
|
719
|
+
|
|
720
|
+
function getDaysInMonth(d) {
|
|
721
|
+
var resultDate = getFirstDayOfMonth(d);
|
|
722
|
+
|
|
723
|
+
resultDate.setMonth(resultDate.getMonth() + 1);
|
|
724
|
+
resultDate.setDate(resultDate.getDate() - 1);
|
|
725
|
+
|
|
726
|
+
return resultDate.getDate();
|
|
727
|
+
}
|
|
728
|
+
|
|
729
|
+
function getModifiersFromProps(props) {
|
|
730
|
+
var modifiers = _extends$2({}, props.modifiers);
|
|
731
|
+
if (props.selectedDays) {
|
|
732
|
+
modifiers[props.classNames.selected] = props.selectedDays;
|
|
733
|
+
}
|
|
734
|
+
if (props.disabledDays) {
|
|
735
|
+
modifiers[props.classNames.disabled] = props.disabledDays;
|
|
736
|
+
}
|
|
737
|
+
return modifiers;
|
|
738
|
+
}
|
|
739
|
+
|
|
740
|
+
function getFirstDayOfWeekFromProps(props) {
|
|
741
|
+
var firstDayOfWeek = props.firstDayOfWeek,
|
|
742
|
+
_props$locale = props.locale,
|
|
743
|
+
locale = _props$locale === undefined ? 'en' : _props$locale,
|
|
744
|
+
_props$localeUtils = props.localeUtils,
|
|
745
|
+
localeUtils = _props$localeUtils === undefined ? {} : _props$localeUtils;
|
|
746
|
+
|
|
747
|
+
if (!isNaN(firstDayOfWeek)) {
|
|
748
|
+
return firstDayOfWeek;
|
|
749
|
+
}
|
|
750
|
+
if (localeUtils.getFirstDayOfWeek) {
|
|
751
|
+
return localeUtils.getFirstDayOfWeek(locale);
|
|
752
|
+
}
|
|
753
|
+
return 0;
|
|
754
|
+
}
|
|
755
|
+
|
|
756
|
+
function isRangeOfDates(value) {
|
|
757
|
+
return !!(value && value.from && value.to);
|
|
758
|
+
}
|
|
759
|
+
|
|
760
|
+
function getMonthsDiff(d1, d2) {
|
|
761
|
+
return d2.getMonth() - d1.getMonth() + 12 * (d2.getFullYear() - d1.getFullYear());
|
|
762
|
+
}
|
|
763
|
+
|
|
764
|
+
function getWeekArray(d) {
|
|
765
|
+
var firstDayOfWeek = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : (0, _LocaleUtils$1.getFirstDayOfWeek)();
|
|
766
|
+
var fixedWeeks = arguments[2];
|
|
767
|
+
|
|
768
|
+
var daysInMonth = getDaysInMonth(d);
|
|
769
|
+
var dayArray = [];
|
|
770
|
+
|
|
771
|
+
var week = [];
|
|
772
|
+
var weekArray = [];
|
|
773
|
+
|
|
774
|
+
for (var i = 1; i <= daysInMonth; i += 1) {
|
|
775
|
+
dayArray.push(new Date(d.getFullYear(), d.getMonth(), i, 12));
|
|
776
|
+
}
|
|
777
|
+
|
|
778
|
+
dayArray.forEach(function (day) {
|
|
779
|
+
if (week.length > 0 && day.getDay() === firstDayOfWeek) {
|
|
780
|
+
weekArray.push(week);
|
|
781
|
+
week = [];
|
|
782
|
+
}
|
|
783
|
+
week.push(day);
|
|
784
|
+
if (dayArray.indexOf(day) === dayArray.length - 1) {
|
|
785
|
+
weekArray.push(week);
|
|
786
|
+
}
|
|
787
|
+
});
|
|
788
|
+
|
|
789
|
+
// unshift days to start the first week
|
|
790
|
+
var firstWeek = weekArray[0];
|
|
791
|
+
for (var _i = 7 - firstWeek.length; _i > 0; _i -= 1) {
|
|
792
|
+
var outsideDate = (0, _DateUtils$4.clone)(firstWeek[0]);
|
|
793
|
+
outsideDate.setDate(firstWeek[0].getDate() - 1);
|
|
794
|
+
firstWeek.unshift(outsideDate);
|
|
795
|
+
}
|
|
796
|
+
|
|
797
|
+
// push days until the end of the last week
|
|
798
|
+
var lastWeek = weekArray[weekArray.length - 1];
|
|
799
|
+
for (var _i2 = lastWeek.length; _i2 < 7; _i2 += 1) {
|
|
800
|
+
var _outsideDate = (0, _DateUtils$4.clone)(lastWeek[lastWeek.length - 1]);
|
|
801
|
+
_outsideDate.setDate(lastWeek[lastWeek.length - 1].getDate() + 1);
|
|
802
|
+
lastWeek.push(_outsideDate);
|
|
803
|
+
}
|
|
804
|
+
|
|
805
|
+
// add extra weeks to reach 6 weeks
|
|
806
|
+
if (fixedWeeks && weekArray.length < 6) {
|
|
807
|
+
var lastExtraWeek = void 0;
|
|
808
|
+
|
|
809
|
+
for (var _i3 = weekArray.length; _i3 < 6; _i3 += 1) {
|
|
810
|
+
lastExtraWeek = weekArray[weekArray.length - 1];
|
|
811
|
+
var lastDay = lastExtraWeek[lastExtraWeek.length - 1];
|
|
812
|
+
var extraWeek = [];
|
|
813
|
+
|
|
814
|
+
for (var j = 0; j < 7; j += 1) {
|
|
815
|
+
var _outsideDate2 = (0, _DateUtils$4.clone)(lastDay);
|
|
816
|
+
_outsideDate2.setDate(lastDay.getDate() + j + 1);
|
|
817
|
+
extraWeek.push(_outsideDate2);
|
|
818
|
+
}
|
|
819
|
+
|
|
820
|
+
weekArray.push(extraWeek);
|
|
821
|
+
}
|
|
822
|
+
}
|
|
823
|
+
|
|
824
|
+
return weekArray;
|
|
825
|
+
}
|
|
826
|
+
|
|
827
|
+
function startOfMonth(d) {
|
|
828
|
+
var newDate = (0, _DateUtils$4.clone)(d);
|
|
829
|
+
newDate.setDate(1);
|
|
830
|
+
newDate.setHours(12, 0, 0, 0); // always set noon to avoid time zone issues
|
|
831
|
+
return newDate;
|
|
832
|
+
}
|
|
833
|
+
|
|
834
|
+
function getDayNodes(node, classNames) {
|
|
835
|
+
var outsideClassName = void 0;
|
|
836
|
+
if (classNames === _classNames2$2.default) {
|
|
837
|
+
// When using CSS modules prefix the modifier as required by the BEM syntax
|
|
838
|
+
outsideClassName = classNames.day + '--' + classNames.outside;
|
|
839
|
+
} else {
|
|
840
|
+
outsideClassName = '' + classNames.outside;
|
|
841
|
+
}
|
|
842
|
+
var dayQuery = classNames.day.replace(/ /g, '.');
|
|
843
|
+
var outsideDayQuery = outsideClassName.replace(/ /g, '.');
|
|
844
|
+
var selector = '.' + dayQuery + ':not(.' + outsideDayQuery + ')';
|
|
845
|
+
return node.querySelectorAll(selector);
|
|
846
|
+
}
|
|
847
|
+
|
|
848
|
+
function nodeListToArray(nodeList) {
|
|
849
|
+
return Array.prototype.slice.call(nodeList, 0);
|
|
850
|
+
}
|
|
851
|
+
|
|
852
|
+
function hasOwnProp(obj, prop) {
|
|
853
|
+
return Object.prototype.hasOwnProperty.call(obj, prop);
|
|
854
|
+
}
|
|
855
|
+
|
|
856
|
+
Object.defineProperty(Day$1, "__esModule", {
|
|
857
|
+
value: true
|
|
858
|
+
});
|
|
859
|
+
|
|
860
|
+
var _extends$1 = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
|
|
861
|
+
|
|
862
|
+
var _createClass$3 = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
|
863
|
+
|
|
864
|
+
var _react$3 = React__default;
|
|
865
|
+
|
|
866
|
+
var _react2$3 = _interopRequireDefault$3(_react$3);
|
|
867
|
+
|
|
868
|
+
var _DateUtils$3 = DateUtils$2;
|
|
869
|
+
|
|
870
|
+
var _Helpers$3 = Helpers$2;
|
|
871
|
+
|
|
872
|
+
var _classNames$1 = classNames;
|
|
873
|
+
|
|
874
|
+
var _classNames2$1 = _interopRequireDefault$3(_classNames$1);
|
|
875
|
+
|
|
876
|
+
function _interopRequireDefault$3(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
877
|
+
|
|
878
|
+
function _classCallCheck$3(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
879
|
+
|
|
880
|
+
function _possibleConstructorReturn$3(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
|
881
|
+
|
|
882
|
+
function _inherits$3(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } /* eslint-disable jsx-a11y/no-static-element-interactions, react/forbid-prop-types */
|
|
883
|
+
|
|
884
|
+
function handleEvent(handler, day, modifiers) {
|
|
885
|
+
if (!handler) {
|
|
886
|
+
return undefined;
|
|
887
|
+
}
|
|
888
|
+
return function (e) {
|
|
889
|
+
e.persist();
|
|
890
|
+
handler(day, modifiers, e);
|
|
891
|
+
};
|
|
892
|
+
}
|
|
893
|
+
|
|
894
|
+
var Day = function (_Component) {
|
|
895
|
+
_inherits$3(Day, _Component);
|
|
896
|
+
|
|
897
|
+
function Day() {
|
|
898
|
+
_classCallCheck$3(this, Day);
|
|
899
|
+
|
|
900
|
+
return _possibleConstructorReturn$3(this, (Day.__proto__ || Object.getPrototypeOf(Day)).apply(this, arguments));
|
|
901
|
+
}
|
|
902
|
+
|
|
903
|
+
_createClass$3(Day, [{
|
|
904
|
+
key: 'shouldComponentUpdate',
|
|
905
|
+
value: function shouldComponentUpdate(nextProps) {
|
|
906
|
+
var _this2 = this;
|
|
907
|
+
|
|
908
|
+
var propNames = Object.keys(this.props);
|
|
909
|
+
var nextPropNames = Object.keys(nextProps);
|
|
910
|
+
if (propNames.length !== nextPropNames.length) {
|
|
911
|
+
return true;
|
|
912
|
+
}
|
|
913
|
+
return propNames.some(function (name) {
|
|
914
|
+
if (name === 'modifiers' || name === 'modifiersStyles' || name === 'classNames') {
|
|
915
|
+
var prop = _this2.props[name];
|
|
916
|
+
var nextProp = nextProps[name];
|
|
917
|
+
var modifiers = Object.keys(prop);
|
|
918
|
+
var nextModifiers = Object.keys(nextProp);
|
|
919
|
+
if (modifiers.length !== nextModifiers.length) {
|
|
920
|
+
return true;
|
|
921
|
+
}
|
|
922
|
+
return modifiers.some(function (mod) {
|
|
923
|
+
return !(0, _Helpers$3.hasOwnProp)(nextProp, mod) || prop[mod] !== nextProp[mod];
|
|
924
|
+
});
|
|
925
|
+
}
|
|
926
|
+
if (name === 'day') {
|
|
927
|
+
return !(0, _DateUtils$3.isSameDay)(_this2.props[name], nextProps[name]);
|
|
928
|
+
}
|
|
929
|
+
return !(0, _Helpers$3.hasOwnProp)(nextProps, name) || _this2.props[name] !== nextProps[name];
|
|
930
|
+
});
|
|
931
|
+
}
|
|
932
|
+
}, {
|
|
933
|
+
key: 'render',
|
|
934
|
+
value: function render() {
|
|
935
|
+
var _props = this.props,
|
|
936
|
+
classNames = _props.classNames,
|
|
937
|
+
modifiersStyles = _props.modifiersStyles,
|
|
938
|
+
day = _props.day,
|
|
939
|
+
tabIndex = _props.tabIndex,
|
|
940
|
+
empty = _props.empty,
|
|
941
|
+
modifiers = _props.modifiers,
|
|
942
|
+
onMouseEnter = _props.onMouseEnter,
|
|
943
|
+
onMouseLeave = _props.onMouseLeave,
|
|
944
|
+
onMouseUp = _props.onMouseUp,
|
|
945
|
+
onMouseDown = _props.onMouseDown,
|
|
946
|
+
onClick = _props.onClick,
|
|
947
|
+
onKeyDown = _props.onKeyDown,
|
|
948
|
+
onTouchStart = _props.onTouchStart,
|
|
949
|
+
onTouchEnd = _props.onTouchEnd,
|
|
950
|
+
onFocus = _props.onFocus,
|
|
951
|
+
ariaLabel = _props.ariaLabel,
|
|
952
|
+
ariaDisabled = _props.ariaDisabled,
|
|
953
|
+
ariaSelected = _props.ariaSelected,
|
|
954
|
+
children = _props.children;
|
|
955
|
+
|
|
956
|
+
|
|
957
|
+
var className = classNames.day;
|
|
958
|
+
if (classNames !== _classNames2$1.default) {
|
|
959
|
+
// When using CSS modules prefix the modifier as required by the BEM syntax
|
|
960
|
+
className += ' ' + Object.keys(modifiers).join(' ');
|
|
961
|
+
} else {
|
|
962
|
+
className += Object.keys(modifiers).map(function (modifier) {
|
|
963
|
+
return ' ' + className + '--' + modifier;
|
|
964
|
+
}).join('');
|
|
965
|
+
}
|
|
966
|
+
|
|
967
|
+
var style = void 0;
|
|
968
|
+
if (modifiersStyles) {
|
|
969
|
+
Object.keys(modifiers).filter(function (modifier) {
|
|
970
|
+
return !!modifiersStyles[modifier];
|
|
971
|
+
}).forEach(function (modifier) {
|
|
972
|
+
style = _extends$1({}, style, modifiersStyles[modifier]);
|
|
973
|
+
});
|
|
974
|
+
}
|
|
975
|
+
|
|
976
|
+
if (empty) {
|
|
977
|
+
return _react2$3.default.createElement('div', { 'aria-disabled': true, className: className, style: style });
|
|
978
|
+
}
|
|
979
|
+
return _react2$3.default.createElement(
|
|
980
|
+
'div',
|
|
981
|
+
{
|
|
982
|
+
className: className,
|
|
983
|
+
tabIndex: tabIndex,
|
|
984
|
+
style: style,
|
|
985
|
+
role: 'gridcell',
|
|
986
|
+
'aria-label': ariaLabel,
|
|
987
|
+
'aria-disabled': ariaDisabled,
|
|
988
|
+
'aria-selected': ariaSelected,
|
|
989
|
+
onClick: handleEvent(onClick, day, modifiers),
|
|
990
|
+
onKeyDown: handleEvent(onKeyDown, day, modifiers),
|
|
991
|
+
onMouseEnter: handleEvent(onMouseEnter, day, modifiers),
|
|
992
|
+
onMouseLeave: handleEvent(onMouseLeave, day, modifiers),
|
|
993
|
+
onMouseUp: handleEvent(onMouseUp, day, modifiers),
|
|
994
|
+
onMouseDown: handleEvent(onMouseDown, day, modifiers),
|
|
995
|
+
onTouchEnd: handleEvent(onTouchEnd, day, modifiers),
|
|
996
|
+
onTouchStart: handleEvent(onTouchStart, day, modifiers),
|
|
997
|
+
onFocus: handleEvent(onFocus, day, modifiers)
|
|
998
|
+
},
|
|
999
|
+
children
|
|
1000
|
+
);
|
|
1001
|
+
}
|
|
1002
|
+
}]);
|
|
1003
|
+
|
|
1004
|
+
return Day;
|
|
1005
|
+
}(_react$3.Component);
|
|
1006
|
+
|
|
1007
|
+
Day.defaultProps = {
|
|
1008
|
+
tabIndex: -1
|
|
1009
|
+
};
|
|
1010
|
+
Day.defaultProps = {
|
|
1011
|
+
modifiers: {},
|
|
1012
|
+
modifiersStyles: {},
|
|
1013
|
+
empty: false
|
|
1014
|
+
};
|
|
1015
|
+
Day$1.default = Day;
|
|
1016
|
+
|
|
1017
|
+
var ModifiersUtils$2 = {};
|
|
1018
|
+
|
|
1019
|
+
Object.defineProperty(ModifiersUtils$2, "__esModule", {
|
|
1020
|
+
value: true
|
|
1021
|
+
});
|
|
1022
|
+
ModifiersUtils$2.dayMatchesModifier = dayMatchesModifier;
|
|
1023
|
+
ModifiersUtils$2.getModifiersForDay = getModifiersForDay;
|
|
1024
|
+
|
|
1025
|
+
var _DateUtils$2 = DateUtils$2;
|
|
1026
|
+
|
|
1027
|
+
var _Helpers$2 = Helpers$2;
|
|
1028
|
+
|
|
1029
|
+
/**
|
|
1030
|
+
* Return `true` if a date matches the specified modifier.
|
|
1031
|
+
*
|
|
1032
|
+
* @export
|
|
1033
|
+
* @param {Date} day
|
|
1034
|
+
* @param {Any} modifier
|
|
1035
|
+
* @return {Boolean}
|
|
1036
|
+
*/
|
|
1037
|
+
function dayMatchesModifier(day, modifier) {
|
|
1038
|
+
if (!modifier) {
|
|
1039
|
+
return false;
|
|
1040
|
+
}
|
|
1041
|
+
var arr = Array.isArray(modifier) ? modifier : [modifier];
|
|
1042
|
+
return arr.some(function (mod) {
|
|
1043
|
+
if (!mod) {
|
|
1044
|
+
return false;
|
|
1045
|
+
}
|
|
1046
|
+
if (mod instanceof Date) {
|
|
1047
|
+
return (0, _DateUtils$2.isSameDay)(day, mod);
|
|
1048
|
+
}
|
|
1049
|
+
if ((0, _Helpers$2.isRangeOfDates)(mod)) {
|
|
1050
|
+
return (0, _DateUtils$2.isDayInRange)(day, mod);
|
|
1051
|
+
}
|
|
1052
|
+
if (mod.after && mod.before && (0, _DateUtils$2.isDayAfter)(mod.before, mod.after)) {
|
|
1053
|
+
return (0, _DateUtils$2.isDayAfter)(day, mod.after) && (0, _DateUtils$2.isDayBefore)(day, mod.before);
|
|
1054
|
+
}
|
|
1055
|
+
if (mod.after && mod.before && ((0, _DateUtils$2.isDayAfter)(mod.after, mod.before) || (0, _DateUtils$2.isSameDay)(mod.after, mod.before))) {
|
|
1056
|
+
return (0, _DateUtils$2.isDayAfter)(day, mod.after) || (0, _DateUtils$2.isDayBefore)(day, mod.before);
|
|
1057
|
+
}
|
|
1058
|
+
if (mod.after) {
|
|
1059
|
+
return (0, _DateUtils$2.isDayAfter)(day, mod.after);
|
|
1060
|
+
}
|
|
1061
|
+
if (mod.before) {
|
|
1062
|
+
return (0, _DateUtils$2.isDayBefore)(day, mod.before);
|
|
1063
|
+
}
|
|
1064
|
+
if (mod.daysOfWeek) {
|
|
1065
|
+
return mod.daysOfWeek.some(function (dayOfWeek) {
|
|
1066
|
+
return day.getDay() === dayOfWeek;
|
|
1067
|
+
});
|
|
1068
|
+
}
|
|
1069
|
+
if (typeof mod === 'function') {
|
|
1070
|
+
return mod(day);
|
|
1071
|
+
}
|
|
1072
|
+
return false;
|
|
1073
|
+
});
|
|
1074
|
+
}
|
|
1075
|
+
|
|
1076
|
+
/**
|
|
1077
|
+
* Return the modifiers matching the given day for the given
|
|
1078
|
+
* object of modifiers.
|
|
1079
|
+
*
|
|
1080
|
+
* @export
|
|
1081
|
+
* @param {Date} day
|
|
1082
|
+
* @param {Object} [modifiersObj={}]
|
|
1083
|
+
* @return {Array}
|
|
1084
|
+
*/
|
|
1085
|
+
function getModifiersForDay(day) {
|
|
1086
|
+
var modifiersObj = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
1087
|
+
|
|
1088
|
+
return Object.keys(modifiersObj).reduce(function (modifiers, modifierName) {
|
|
1089
|
+
var value = modifiersObj[modifierName];
|
|
1090
|
+
if (dayMatchesModifier(day, value)) {
|
|
1091
|
+
modifiers.push(modifierName);
|
|
1092
|
+
}
|
|
1093
|
+
return modifiers;
|
|
1094
|
+
}, []);
|
|
1095
|
+
}
|
|
1096
|
+
|
|
1097
|
+
ModifiersUtils$2.default = { dayMatchesModifier: dayMatchesModifier, getModifiersForDay: getModifiersForDay };
|
|
1098
|
+
|
|
1099
|
+
Object.defineProperty(Month$1, "__esModule", {
|
|
1100
|
+
value: true
|
|
1101
|
+
});
|
|
1102
|
+
|
|
1103
|
+
var _createClass$2 = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
|
1104
|
+
|
|
1105
|
+
var _react$2 = React__default;
|
|
1106
|
+
|
|
1107
|
+
var _react2$2 = _interopRequireDefault$2(_react$2);
|
|
1108
|
+
|
|
1109
|
+
var _Weekdays = Weekdays$1;
|
|
1110
|
+
|
|
1111
|
+
var _Weekdays2 = _interopRequireDefault$2(_Weekdays);
|
|
1112
|
+
|
|
1113
|
+
var _Day = Day$1;
|
|
1114
|
+
|
|
1115
|
+
var _Day2 = _interopRequireDefault$2(_Day);
|
|
1116
|
+
|
|
1117
|
+
var _keys$1 = keys;
|
|
1118
|
+
|
|
1119
|
+
var _ModifiersUtils$1 = ModifiersUtils$2;
|
|
1120
|
+
|
|
1121
|
+
var ModifiersUtils$1 = _interopRequireWildcard$1(_ModifiersUtils$1);
|
|
1122
|
+
|
|
1123
|
+
var _Helpers$1 = Helpers$2;
|
|
1124
|
+
|
|
1125
|
+
var Helpers$1 = _interopRequireWildcard$1(_Helpers$1);
|
|
1126
|
+
|
|
1127
|
+
var _DateUtils$1 = DateUtils$2;
|
|
1128
|
+
|
|
1129
|
+
var DateUtils$1 = _interopRequireWildcard$1(_DateUtils$1);
|
|
1130
|
+
|
|
1131
|
+
function _interopRequireWildcard$1(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
|
|
1132
|
+
|
|
1133
|
+
function _interopRequireDefault$2(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
1134
|
+
|
|
1135
|
+
function _classCallCheck$2(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
1136
|
+
|
|
1137
|
+
function _possibleConstructorReturn$2(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
|
1138
|
+
|
|
1139
|
+
function _inherits$2(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
|
1140
|
+
|
|
1141
|
+
var Month = function (_Component) {
|
|
1142
|
+
_inherits$2(Month, _Component);
|
|
1143
|
+
|
|
1144
|
+
function Month() {
|
|
1145
|
+
var _ref;
|
|
1146
|
+
|
|
1147
|
+
var _temp, _this, _ret;
|
|
1148
|
+
|
|
1149
|
+
_classCallCheck$2(this, Month);
|
|
1150
|
+
|
|
1151
|
+
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
|
|
1152
|
+
args[_key] = arguments[_key];
|
|
1153
|
+
}
|
|
1154
|
+
|
|
1155
|
+
return _ret = (_temp = (_this = _possibleConstructorReturn$2(this, (_ref = Month.__proto__ || Object.getPrototypeOf(Month)).call.apply(_ref, [this].concat(args))), _this), _this.renderDay = function (day) {
|
|
1156
|
+
var monthNumber = _this.props.month.getMonth();
|
|
1157
|
+
var propModifiers = Helpers$1.getModifiersFromProps(_this.props);
|
|
1158
|
+
var dayModifiers = ModifiersUtils$1.getModifiersForDay(day, propModifiers);
|
|
1159
|
+
if (DateUtils$1.isSameDay(day, new Date()) && !Object.prototype.hasOwnProperty.call(propModifiers, _this.props.classNames.today)) {
|
|
1160
|
+
dayModifiers.push(_this.props.classNames.today);
|
|
1161
|
+
}
|
|
1162
|
+
if (day.getMonth() !== monthNumber) {
|
|
1163
|
+
dayModifiers.push(_this.props.classNames.outside);
|
|
1164
|
+
}
|
|
1165
|
+
|
|
1166
|
+
var isOutside = day.getMonth() !== monthNumber;
|
|
1167
|
+
var tabIndex = -1;
|
|
1168
|
+
// Focus on the first day of the month
|
|
1169
|
+
if (_this.props.onDayClick && !isOutside && day.getDate() === 1) {
|
|
1170
|
+
tabIndex = _this.props.tabIndex; // eslint-disable-line prefer-destructuring
|
|
1171
|
+
}
|
|
1172
|
+
var key = '' + day.getFullYear() + day.getMonth() + day.getDate();
|
|
1173
|
+
var modifiers = {};
|
|
1174
|
+
dayModifiers.forEach(function (modifier) {
|
|
1175
|
+
modifiers[modifier] = true;
|
|
1176
|
+
});
|
|
1177
|
+
|
|
1178
|
+
return _react2$2.default.createElement(
|
|
1179
|
+
_Day2.default,
|
|
1180
|
+
{
|
|
1181
|
+
key: '' + (isOutside ? 'outside-' : '') + key,
|
|
1182
|
+
classNames: _this.props.classNames,
|
|
1183
|
+
day: day,
|
|
1184
|
+
modifiers: modifiers,
|
|
1185
|
+
modifiersStyles: _this.props.modifiersStyles,
|
|
1186
|
+
empty: isOutside && !_this.props.showOutsideDays && !_this.props.fixedWeeks,
|
|
1187
|
+
tabIndex: tabIndex,
|
|
1188
|
+
ariaLabel: _this.props.localeUtils.formatDay(day, _this.props.locale),
|
|
1189
|
+
ariaDisabled: isOutside || dayModifiers.indexOf(_this.props.classNames.disabled) > -1,
|
|
1190
|
+
ariaSelected: dayModifiers.indexOf(_this.props.classNames.selected) > -1,
|
|
1191
|
+
onClick: _this.props.onDayClick,
|
|
1192
|
+
onFocus: _this.props.onDayFocus,
|
|
1193
|
+
onKeyDown: _this.props.onDayKeyDown,
|
|
1194
|
+
onMouseEnter: _this.props.onDayMouseEnter,
|
|
1195
|
+
onMouseLeave: _this.props.onDayMouseLeave,
|
|
1196
|
+
onMouseDown: _this.props.onDayMouseDown,
|
|
1197
|
+
onMouseUp: _this.props.onDayMouseUp,
|
|
1198
|
+
onTouchEnd: _this.props.onDayTouchEnd,
|
|
1199
|
+
onTouchStart: _this.props.onDayTouchStart
|
|
1200
|
+
},
|
|
1201
|
+
_this.props.renderDay(day, modifiers)
|
|
1202
|
+
);
|
|
1203
|
+
}, _temp), _possibleConstructorReturn$2(_this, _ret);
|
|
1204
|
+
}
|
|
1205
|
+
|
|
1206
|
+
_createClass$2(Month, [{
|
|
1207
|
+
key: 'render',
|
|
1208
|
+
value: function render() {
|
|
1209
|
+
var _this2 = this;
|
|
1210
|
+
|
|
1211
|
+
var _props = this.props,
|
|
1212
|
+
classNames = _props.classNames,
|
|
1213
|
+
month = _props.month,
|
|
1214
|
+
months = _props.months,
|
|
1215
|
+
fixedWeeks = _props.fixedWeeks,
|
|
1216
|
+
captionElement = _props.captionElement,
|
|
1217
|
+
weekdayElement = _props.weekdayElement,
|
|
1218
|
+
locale = _props.locale,
|
|
1219
|
+
localeUtils = _props.localeUtils,
|
|
1220
|
+
weekdaysLong = _props.weekdaysLong,
|
|
1221
|
+
weekdaysShort = _props.weekdaysShort,
|
|
1222
|
+
firstDayOfWeek = _props.firstDayOfWeek,
|
|
1223
|
+
onCaptionClick = _props.onCaptionClick,
|
|
1224
|
+
showWeekNumbers = _props.showWeekNumbers,
|
|
1225
|
+
showWeekDays = _props.showWeekDays,
|
|
1226
|
+
onWeekClick = _props.onWeekClick;
|
|
1227
|
+
|
|
1228
|
+
|
|
1229
|
+
var captionProps = {
|
|
1230
|
+
date: month,
|
|
1231
|
+
classNames: classNames,
|
|
1232
|
+
months: months,
|
|
1233
|
+
localeUtils: localeUtils,
|
|
1234
|
+
locale: locale,
|
|
1235
|
+
onClick: onCaptionClick ? function (e) {
|
|
1236
|
+
return onCaptionClick(month, e);
|
|
1237
|
+
} : undefined
|
|
1238
|
+
};
|
|
1239
|
+
var caption = _react2$2.default.isValidElement(captionElement) ? _react2$2.default.cloneElement(captionElement, captionProps) : _react2$2.default.createElement(captionElement, captionProps);
|
|
1240
|
+
|
|
1241
|
+
var weeks = Helpers$1.getWeekArray(month, firstDayOfWeek, fixedWeeks);
|
|
1242
|
+
return _react2$2.default.createElement(
|
|
1243
|
+
'div',
|
|
1244
|
+
{ className: classNames.month, role: 'grid' },
|
|
1245
|
+
caption,
|
|
1246
|
+
showWeekDays && _react2$2.default.createElement(_Weekdays2.default, {
|
|
1247
|
+
classNames: classNames,
|
|
1248
|
+
weekdaysShort: weekdaysShort,
|
|
1249
|
+
weekdaysLong: weekdaysLong,
|
|
1250
|
+
firstDayOfWeek: firstDayOfWeek,
|
|
1251
|
+
showWeekNumbers: showWeekNumbers,
|
|
1252
|
+
locale: locale,
|
|
1253
|
+
localeUtils: localeUtils,
|
|
1254
|
+
weekdayElement: weekdayElement
|
|
1255
|
+
}),
|
|
1256
|
+
_react2$2.default.createElement(
|
|
1257
|
+
'div',
|
|
1258
|
+
{ className: classNames.body, role: 'rowgroup' },
|
|
1259
|
+
weeks.map(function (week) {
|
|
1260
|
+
var weekNumber = void 0;
|
|
1261
|
+
if (showWeekNumbers) {
|
|
1262
|
+
weekNumber = DateUtils$1.getWeekNumber(week[6]);
|
|
1263
|
+
}
|
|
1264
|
+
return _react2$2.default.createElement(
|
|
1265
|
+
'div',
|
|
1266
|
+
{
|
|
1267
|
+
key: week[0].getTime(),
|
|
1268
|
+
className: classNames.week,
|
|
1269
|
+
role: 'row'
|
|
1270
|
+
},
|
|
1271
|
+
showWeekNumbers && _react2$2.default.createElement(
|
|
1272
|
+
'div',
|
|
1273
|
+
{
|
|
1274
|
+
className: classNames.weekNumber,
|
|
1275
|
+
tabIndex: onWeekClick ? 0 : -1,
|
|
1276
|
+
role: 'gridcell',
|
|
1277
|
+
onClick: onWeekClick ? function (e) {
|
|
1278
|
+
return onWeekClick(weekNumber, week, e);
|
|
1279
|
+
} : undefined,
|
|
1280
|
+
onKeyUp: onWeekClick ? function (e) {
|
|
1281
|
+
return e.keyCode === _keys$1.ENTER && onWeekClick(weekNumber, week, e);
|
|
1282
|
+
} : undefined
|
|
1283
|
+
},
|
|
1284
|
+
_this2.props.renderWeek(weekNumber, week, month)
|
|
1285
|
+
),
|
|
1286
|
+
week.map(_this2.renderDay)
|
|
1287
|
+
);
|
|
1288
|
+
})
|
|
1289
|
+
)
|
|
1290
|
+
);
|
|
1291
|
+
}
|
|
1292
|
+
}]);
|
|
1293
|
+
|
|
1294
|
+
return Month;
|
|
1295
|
+
}(_react$2.Component);
|
|
1296
|
+
|
|
1297
|
+
Month$1.default = Month;
|
|
1298
|
+
|
|
1299
|
+
var Weekday$1 = {};
|
|
1300
|
+
|
|
1301
|
+
Object.defineProperty(Weekday$1, "__esModule", {
|
|
1302
|
+
value: true
|
|
1303
|
+
});
|
|
1304
|
+
|
|
1305
|
+
var _createClass$1 = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
|
1306
|
+
|
|
1307
|
+
var _react$1 = React__default;
|
|
1308
|
+
|
|
1309
|
+
var _react2$1 = _interopRequireDefault$1(_react$1);
|
|
1310
|
+
|
|
1311
|
+
function _interopRequireDefault$1(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
1312
|
+
|
|
1313
|
+
function _classCallCheck$1(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
1314
|
+
|
|
1315
|
+
function _possibleConstructorReturn$1(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
|
1316
|
+
|
|
1317
|
+
function _inherits$1(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
|
1318
|
+
|
|
1319
|
+
var Weekday = function (_Component) {
|
|
1320
|
+
_inherits$1(Weekday, _Component);
|
|
1321
|
+
|
|
1322
|
+
function Weekday() {
|
|
1323
|
+
_classCallCheck$1(this, Weekday);
|
|
1324
|
+
|
|
1325
|
+
return _possibleConstructorReturn$1(this, (Weekday.__proto__ || Object.getPrototypeOf(Weekday)).apply(this, arguments));
|
|
1326
|
+
}
|
|
1327
|
+
|
|
1328
|
+
_createClass$1(Weekday, [{
|
|
1329
|
+
key: 'shouldComponentUpdate',
|
|
1330
|
+
value: function shouldComponentUpdate(nextProps) {
|
|
1331
|
+
return this.props !== nextProps;
|
|
1332
|
+
}
|
|
1333
|
+
}, {
|
|
1334
|
+
key: 'render',
|
|
1335
|
+
value: function render() {
|
|
1336
|
+
var _props = this.props,
|
|
1337
|
+
weekday = _props.weekday,
|
|
1338
|
+
className = _props.className,
|
|
1339
|
+
weekdaysLong = _props.weekdaysLong,
|
|
1340
|
+
weekdaysShort = _props.weekdaysShort,
|
|
1341
|
+
localeUtils = _props.localeUtils,
|
|
1342
|
+
locale = _props.locale;
|
|
1343
|
+
|
|
1344
|
+
var title = void 0;
|
|
1345
|
+
if (weekdaysLong) {
|
|
1346
|
+
title = weekdaysLong[weekday];
|
|
1347
|
+
} else {
|
|
1348
|
+
title = localeUtils.formatWeekdayLong(weekday, locale);
|
|
1349
|
+
}
|
|
1350
|
+
var content = void 0;
|
|
1351
|
+
if (weekdaysShort) {
|
|
1352
|
+
content = weekdaysShort[weekday];
|
|
1353
|
+
} else {
|
|
1354
|
+
content = localeUtils.formatWeekdayShort(weekday, locale);
|
|
1355
|
+
}
|
|
1356
|
+
|
|
1357
|
+
return _react2$1.default.createElement(
|
|
1358
|
+
'div',
|
|
1359
|
+
{ className: className, role: 'columnheader' },
|
|
1360
|
+
_react2$1.default.createElement(
|
|
1361
|
+
'abbr',
|
|
1362
|
+
{ title: title },
|
|
1363
|
+
content
|
|
1364
|
+
)
|
|
1365
|
+
);
|
|
1366
|
+
}
|
|
1367
|
+
}]);
|
|
1368
|
+
|
|
1369
|
+
return Weekday;
|
|
1370
|
+
}(_react$1.Component);
|
|
1371
|
+
|
|
1372
|
+
Weekday$1.default = Weekday;
|
|
1373
|
+
|
|
1374
|
+
Object.defineProperty(DayPicker$2, "__esModule", {
|
|
1375
|
+
value: true
|
|
1376
|
+
});
|
|
1377
|
+
DayPicker$2.ModifiersUtils = DayPicker$2.LocaleUtils = DayPicker$2.DateUtils = DayPicker$2.DayPicker = undefined;
|
|
1378
|
+
|
|
1379
|
+
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
|
|
1380
|
+
|
|
1381
|
+
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
|
1382
|
+
|
|
1383
|
+
var _react = React__default;
|
|
1384
|
+
|
|
1385
|
+
var _react2 = _interopRequireDefault(_react);
|
|
1386
|
+
|
|
1387
|
+
var _Caption = Caption$1;
|
|
1388
|
+
|
|
1389
|
+
var _Caption2 = _interopRequireDefault(_Caption);
|
|
1390
|
+
|
|
1391
|
+
var _Navbar = Navbar$1;
|
|
1392
|
+
|
|
1393
|
+
var _Navbar2 = _interopRequireDefault(_Navbar);
|
|
1394
|
+
|
|
1395
|
+
var _Month = Month$1;
|
|
1396
|
+
|
|
1397
|
+
var _Month2 = _interopRequireDefault(_Month);
|
|
1398
|
+
|
|
1399
|
+
var _Weekday = Weekday$1;
|
|
1400
|
+
|
|
1401
|
+
var _Weekday2 = _interopRequireDefault(_Weekday);
|
|
1402
|
+
|
|
1403
|
+
var _Helpers = Helpers$2;
|
|
1404
|
+
|
|
1405
|
+
var Helpers = _interopRequireWildcard(_Helpers);
|
|
1406
|
+
|
|
1407
|
+
var _DateUtils = DateUtils$2;
|
|
1408
|
+
|
|
1409
|
+
var DateUtils = _interopRequireWildcard(_DateUtils);
|
|
1410
|
+
|
|
1411
|
+
var _LocaleUtils = LocaleUtils$1;
|
|
1412
|
+
|
|
1413
|
+
var LocaleUtils = _interopRequireWildcard(_LocaleUtils);
|
|
1414
|
+
|
|
1415
|
+
var _ModifiersUtils = ModifiersUtils$2;
|
|
1416
|
+
|
|
1417
|
+
var ModifiersUtils = _interopRequireWildcard(_ModifiersUtils);
|
|
1418
|
+
|
|
1419
|
+
var _classNames = classNames;
|
|
1420
|
+
|
|
1421
|
+
var _classNames2 = _interopRequireDefault(_classNames);
|
|
1422
|
+
|
|
1423
|
+
var _keys = keys;
|
|
1424
|
+
|
|
1425
|
+
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
|
|
1426
|
+
|
|
1427
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
1428
|
+
|
|
1429
|
+
function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
|
|
1430
|
+
|
|
1431
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
1432
|
+
|
|
1433
|
+
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
|
1434
|
+
|
|
1435
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
|
1436
|
+
|
|
1437
|
+
var DayPicker$1 = DayPicker$2.DayPicker = function (_Component) {
|
|
1438
|
+
_inherits(DayPicker, _Component);
|
|
1439
|
+
|
|
1440
|
+
function DayPicker(props) {
|
|
1441
|
+
_classCallCheck(this, DayPicker);
|
|
1442
|
+
|
|
1443
|
+
var _this = _possibleConstructorReturn(this, (DayPicker.__proto__ || Object.getPrototypeOf(DayPicker)).call(this, props));
|
|
1444
|
+
|
|
1445
|
+
_this.dayPicker = null;
|
|
1446
|
+
|
|
1447
|
+
_this.showNextMonth = function (callback) {
|
|
1448
|
+
if (!_this.allowNextMonth()) {
|
|
1449
|
+
return;
|
|
1450
|
+
}
|
|
1451
|
+
var deltaMonths = _this.props.pagedNavigation ? _this.props.numberOfMonths : 1;
|
|
1452
|
+
var nextMonth = DateUtils.addMonths(_this.state.currentMonth, deltaMonths);
|
|
1453
|
+
_this.showMonth(nextMonth, callback);
|
|
1454
|
+
};
|
|
1455
|
+
|
|
1456
|
+
_this.showPreviousMonth = function (callback) {
|
|
1457
|
+
if (!_this.allowPreviousMonth()) {
|
|
1458
|
+
return;
|
|
1459
|
+
}
|
|
1460
|
+
var deltaMonths = _this.props.pagedNavigation ? _this.props.numberOfMonths : 1;
|
|
1461
|
+
var previousMonth = DateUtils.addMonths(_this.state.currentMonth, -deltaMonths);
|
|
1462
|
+
_this.showMonth(previousMonth, callback);
|
|
1463
|
+
};
|
|
1464
|
+
|
|
1465
|
+
_this.handleKeyDown = function (e) {
|
|
1466
|
+
e.persist();
|
|
1467
|
+
|
|
1468
|
+
switch (e.keyCode) {
|
|
1469
|
+
case _keys.LEFT:
|
|
1470
|
+
if (_this.props.dir === 'rtl') {
|
|
1471
|
+
_this.showNextMonth();
|
|
1472
|
+
} else {
|
|
1473
|
+
_this.showPreviousMonth();
|
|
1474
|
+
}
|
|
1475
|
+
Helpers.cancelEvent(e);
|
|
1476
|
+
break;
|
|
1477
|
+
case _keys.RIGHT:
|
|
1478
|
+
if (_this.props.dir === 'rtl') {
|
|
1479
|
+
_this.showPreviousMonth();
|
|
1480
|
+
} else {
|
|
1481
|
+
_this.showNextMonth();
|
|
1482
|
+
}
|
|
1483
|
+
Helpers.cancelEvent(e);
|
|
1484
|
+
break;
|
|
1485
|
+
case _keys.UP:
|
|
1486
|
+
_this.showPreviousYear();
|
|
1487
|
+
Helpers.cancelEvent(e);
|
|
1488
|
+
break;
|
|
1489
|
+
case _keys.DOWN:
|
|
1490
|
+
_this.showNextYear();
|
|
1491
|
+
Helpers.cancelEvent(e);
|
|
1492
|
+
break;
|
|
1493
|
+
}
|
|
1494
|
+
|
|
1495
|
+
if (_this.props.onKeyDown) {
|
|
1496
|
+
_this.props.onKeyDown(e);
|
|
1497
|
+
}
|
|
1498
|
+
};
|
|
1499
|
+
|
|
1500
|
+
_this.handleDayKeyDown = function (day, modifiers, e) {
|
|
1501
|
+
e.persist();
|
|
1502
|
+
|
|
1503
|
+
switch (e.keyCode) {
|
|
1504
|
+
case _keys.LEFT:
|
|
1505
|
+
Helpers.cancelEvent(e);
|
|
1506
|
+
if (_this.props.dir === 'rtl') {
|
|
1507
|
+
_this.focusNextDay(e.target);
|
|
1508
|
+
} else {
|
|
1509
|
+
_this.focusPreviousDay(e.target);
|
|
1510
|
+
}
|
|
1511
|
+
break;
|
|
1512
|
+
case _keys.RIGHT:
|
|
1513
|
+
Helpers.cancelEvent(e);
|
|
1514
|
+
if (_this.props.dir === 'rtl') {
|
|
1515
|
+
_this.focusPreviousDay(e.target);
|
|
1516
|
+
} else {
|
|
1517
|
+
_this.focusNextDay(e.target);
|
|
1518
|
+
}
|
|
1519
|
+
break;
|
|
1520
|
+
case _keys.UP:
|
|
1521
|
+
Helpers.cancelEvent(e);
|
|
1522
|
+
_this.focusPreviousWeek(e.target);
|
|
1523
|
+
break;
|
|
1524
|
+
case _keys.DOWN:
|
|
1525
|
+
Helpers.cancelEvent(e);
|
|
1526
|
+
_this.focusNextWeek(e.target);
|
|
1527
|
+
break;
|
|
1528
|
+
case _keys.ENTER:
|
|
1529
|
+
case _keys.SPACE:
|
|
1530
|
+
Helpers.cancelEvent(e);
|
|
1531
|
+
if (_this.props.onDayClick) {
|
|
1532
|
+
_this.handleDayClick(day, modifiers, e);
|
|
1533
|
+
}
|
|
1534
|
+
break;
|
|
1535
|
+
}
|
|
1536
|
+
if (_this.props.onDayKeyDown) {
|
|
1537
|
+
_this.props.onDayKeyDown(day, modifiers, e);
|
|
1538
|
+
}
|
|
1539
|
+
};
|
|
1540
|
+
|
|
1541
|
+
_this.handleDayClick = function (day, modifiers, e) {
|
|
1542
|
+
e.persist();
|
|
1543
|
+
|
|
1544
|
+
if (modifiers[_this.props.classNames.outside] && _this.props.enableOutsideDaysClick) {
|
|
1545
|
+
_this.handleOutsideDayClick(day);
|
|
1546
|
+
}
|
|
1547
|
+
if (_this.props.onDayClick) {
|
|
1548
|
+
_this.props.onDayClick(day, modifiers, e);
|
|
1549
|
+
}
|
|
1550
|
+
};
|
|
1551
|
+
|
|
1552
|
+
_this.handleTodayButtonClick = function (e) {
|
|
1553
|
+
var today = new Date();
|
|
1554
|
+
var month = new Date(today.getFullYear(), today.getMonth());
|
|
1555
|
+
_this.showMonth(month);
|
|
1556
|
+
e.target.blur();
|
|
1557
|
+
if (_this.props.onTodayButtonClick) {
|
|
1558
|
+
e.persist();
|
|
1559
|
+
_this.props.onTodayButtonClick(new Date(today.getFullYear(), today.getMonth(), today.getDate()), ModifiersUtils.getModifiersForDay(today, _this.props.modifiers), e);
|
|
1560
|
+
}
|
|
1561
|
+
};
|
|
1562
|
+
|
|
1563
|
+
var currentMonth = _this.getCurrentMonthFromProps(props);
|
|
1564
|
+
_this.state = { currentMonth: currentMonth };
|
|
1565
|
+
return _this;
|
|
1566
|
+
}
|
|
1567
|
+
|
|
1568
|
+
_createClass(DayPicker, [{
|
|
1569
|
+
key: 'componentDidUpdate',
|
|
1570
|
+
value: function componentDidUpdate(prevProps) {
|
|
1571
|
+
// Changing the `month` props means changing the current displayed month
|
|
1572
|
+
if (prevProps.month !== this.props.month && !DateUtils.isSameMonth(prevProps.month, this.props.month)) {
|
|
1573
|
+
var currentMonth = this.getCurrentMonthFromProps(this.props);
|
|
1574
|
+
// eslint-disable-next-line react/no-did-update-set-state
|
|
1575
|
+
this.setState({ currentMonth: currentMonth });
|
|
1576
|
+
}
|
|
1577
|
+
}
|
|
1578
|
+
}, {
|
|
1579
|
+
key: 'getCurrentMonthFromProps',
|
|
1580
|
+
|
|
1581
|
+
|
|
1582
|
+
/**
|
|
1583
|
+
* Return the month to be shown in the calendar based on the component props.
|
|
1584
|
+
*
|
|
1585
|
+
* @param {Object} props
|
|
1586
|
+
* @returns Date
|
|
1587
|
+
* @memberof DayPicker
|
|
1588
|
+
* @private
|
|
1589
|
+
*/
|
|
1590
|
+
value: function getCurrentMonthFromProps(props) {
|
|
1591
|
+
var initialMonth = Helpers.startOfMonth(props.month || props.initialMonth || new Date());
|
|
1592
|
+
var currentMonth = initialMonth;
|
|
1593
|
+
|
|
1594
|
+
if (props.pagedNavigation && props.numberOfMonths > 1 && props.fromMonth) {
|
|
1595
|
+
var fromMonth = Helpers.startOfMonth(props.fromMonth);
|
|
1596
|
+
var diffInMonths = Helpers.getMonthsDiff(fromMonth, currentMonth);
|
|
1597
|
+
currentMonth = DateUtils.addMonths(fromMonth, Math.floor(diffInMonths / props.numberOfMonths) * props.numberOfMonths);
|
|
1598
|
+
} else if (props.toMonth && props.numberOfMonths > 1 && Helpers.getMonthsDiff(currentMonth, props.toMonth) <= 0) {
|
|
1599
|
+
currentMonth = DateUtils.addMonths(Helpers.startOfMonth(props.toMonth), 1 - this.props.numberOfMonths);
|
|
1600
|
+
}
|
|
1601
|
+
return currentMonth;
|
|
1602
|
+
}
|
|
1603
|
+
}, {
|
|
1604
|
+
key: 'getNextNavigableMonth',
|
|
1605
|
+
value: function getNextNavigableMonth() {
|
|
1606
|
+
return DateUtils.addMonths(this.state.currentMonth, this.props.numberOfMonths);
|
|
1607
|
+
}
|
|
1608
|
+
}, {
|
|
1609
|
+
key: 'getPreviousNavigableMonth',
|
|
1610
|
+
value: function getPreviousNavigableMonth() {
|
|
1611
|
+
return DateUtils.addMonths(this.state.currentMonth, -1);
|
|
1612
|
+
}
|
|
1613
|
+
}, {
|
|
1614
|
+
key: 'allowPreviousMonth',
|
|
1615
|
+
value: function allowPreviousMonth() {
|
|
1616
|
+
var previousMonth = DateUtils.addMonths(this.state.currentMonth, -1);
|
|
1617
|
+
return this.allowMonth(previousMonth);
|
|
1618
|
+
}
|
|
1619
|
+
}, {
|
|
1620
|
+
key: 'allowNextMonth',
|
|
1621
|
+
value: function allowNextMonth() {
|
|
1622
|
+
var nextMonth = DateUtils.addMonths(this.state.currentMonth, this.props.numberOfMonths);
|
|
1623
|
+
return this.allowMonth(nextMonth);
|
|
1624
|
+
}
|
|
1625
|
+
}, {
|
|
1626
|
+
key: 'allowMonth',
|
|
1627
|
+
value: function allowMonth(d) {
|
|
1628
|
+
var _props = this.props,
|
|
1629
|
+
fromMonth = _props.fromMonth,
|
|
1630
|
+
toMonth = _props.toMonth,
|
|
1631
|
+
canChangeMonth = _props.canChangeMonth;
|
|
1632
|
+
|
|
1633
|
+
if (!canChangeMonth || fromMonth && Helpers.getMonthsDiff(fromMonth, d) < 0 || toMonth && Helpers.getMonthsDiff(toMonth, d) > 0) {
|
|
1634
|
+
return false;
|
|
1635
|
+
}
|
|
1636
|
+
return true;
|
|
1637
|
+
}
|
|
1638
|
+
}, {
|
|
1639
|
+
key: 'allowYearChange',
|
|
1640
|
+
value: function allowYearChange() {
|
|
1641
|
+
return this.props.canChangeMonth;
|
|
1642
|
+
}
|
|
1643
|
+
}, {
|
|
1644
|
+
key: 'showMonth',
|
|
1645
|
+
value: function showMonth(d, callback) {
|
|
1646
|
+
var _this2 = this;
|
|
1647
|
+
|
|
1648
|
+
if (!this.allowMonth(d)) {
|
|
1649
|
+
return;
|
|
1650
|
+
}
|
|
1651
|
+
this.setState({ currentMonth: Helpers.startOfMonth(d) }, function () {
|
|
1652
|
+
if (callback) {
|
|
1653
|
+
callback();
|
|
1654
|
+
}
|
|
1655
|
+
if (_this2.props.onMonthChange) {
|
|
1656
|
+
_this2.props.onMonthChange(_this2.state.currentMonth);
|
|
1657
|
+
}
|
|
1658
|
+
});
|
|
1659
|
+
}
|
|
1660
|
+
}, {
|
|
1661
|
+
key: 'showNextYear',
|
|
1662
|
+
value: function showNextYear() {
|
|
1663
|
+
if (!this.allowYearChange()) {
|
|
1664
|
+
return;
|
|
1665
|
+
}
|
|
1666
|
+
var nextMonth = DateUtils.addMonths(this.state.currentMonth, 12);
|
|
1667
|
+
this.showMonth(nextMonth);
|
|
1668
|
+
}
|
|
1669
|
+
}, {
|
|
1670
|
+
key: 'showPreviousYear',
|
|
1671
|
+
value: function showPreviousYear() {
|
|
1672
|
+
if (!this.allowYearChange()) {
|
|
1673
|
+
return;
|
|
1674
|
+
}
|
|
1675
|
+
var nextMonth = DateUtils.addMonths(this.state.currentMonth, -12);
|
|
1676
|
+
this.showMonth(nextMonth);
|
|
1677
|
+
}
|
|
1678
|
+
}, {
|
|
1679
|
+
key: 'focus',
|
|
1680
|
+
value: function focus() {
|
|
1681
|
+
this.wrapper.focus();
|
|
1682
|
+
}
|
|
1683
|
+
}, {
|
|
1684
|
+
key: 'focusFirstDayOfMonth',
|
|
1685
|
+
value: function focusFirstDayOfMonth() {
|
|
1686
|
+
Helpers.getDayNodes(this.dayPicker, this.props.classNames)[0].focus();
|
|
1687
|
+
}
|
|
1688
|
+
}, {
|
|
1689
|
+
key: 'focusLastDayOfMonth',
|
|
1690
|
+
value: function focusLastDayOfMonth() {
|
|
1691
|
+
var dayNodes = Helpers.getDayNodes(this.dayPicker, this.props.classNames);
|
|
1692
|
+
dayNodes[dayNodes.length - 1].focus();
|
|
1693
|
+
}
|
|
1694
|
+
}, {
|
|
1695
|
+
key: 'focusPreviousDay',
|
|
1696
|
+
value: function focusPreviousDay(dayNode) {
|
|
1697
|
+
var _this3 = this;
|
|
1698
|
+
|
|
1699
|
+
var dayNodes = Helpers.getDayNodes(this.dayPicker, this.props.classNames);
|
|
1700
|
+
var dayNodeIndex = Helpers.nodeListToArray(dayNodes).indexOf(dayNode);
|
|
1701
|
+
if (dayNodeIndex === -1) return;
|
|
1702
|
+
if (dayNodeIndex === 0) {
|
|
1703
|
+
this.showPreviousMonth(function () {
|
|
1704
|
+
return _this3.focusLastDayOfMonth();
|
|
1705
|
+
});
|
|
1706
|
+
} else {
|
|
1707
|
+
dayNodes[dayNodeIndex - 1].focus();
|
|
1708
|
+
}
|
|
1709
|
+
}
|
|
1710
|
+
}, {
|
|
1711
|
+
key: 'focusNextDay',
|
|
1712
|
+
value: function focusNextDay(dayNode) {
|
|
1713
|
+
var _this4 = this;
|
|
1714
|
+
|
|
1715
|
+
var dayNodes = Helpers.getDayNodes(this.dayPicker, this.props.classNames);
|
|
1716
|
+
var dayNodeIndex = Helpers.nodeListToArray(dayNodes).indexOf(dayNode);
|
|
1717
|
+
if (dayNodeIndex === -1) return;
|
|
1718
|
+
if (dayNodeIndex === dayNodes.length - 1) {
|
|
1719
|
+
this.showNextMonth(function () {
|
|
1720
|
+
return _this4.focusFirstDayOfMonth();
|
|
1721
|
+
});
|
|
1722
|
+
} else {
|
|
1723
|
+
dayNodes[dayNodeIndex + 1].focus();
|
|
1724
|
+
}
|
|
1725
|
+
}
|
|
1726
|
+
}, {
|
|
1727
|
+
key: 'focusNextWeek',
|
|
1728
|
+
value: function focusNextWeek(dayNode) {
|
|
1729
|
+
var _this5 = this;
|
|
1730
|
+
|
|
1731
|
+
var dayNodes = Helpers.getDayNodes(this.dayPicker, this.props.classNames);
|
|
1732
|
+
var dayNodeIndex = Helpers.nodeListToArray(dayNodes).indexOf(dayNode);
|
|
1733
|
+
var isInLastWeekOfMonth = dayNodeIndex > dayNodes.length - 8;
|
|
1734
|
+
|
|
1735
|
+
if (isInLastWeekOfMonth) {
|
|
1736
|
+
this.showNextMonth(function () {
|
|
1737
|
+
var daysAfterIndex = dayNodes.length - dayNodeIndex;
|
|
1738
|
+
var nextMonthDayNodeIndex = 7 - daysAfterIndex;
|
|
1739
|
+
Helpers.getDayNodes(_this5.dayPicker, _this5.props.classNames)[nextMonthDayNodeIndex].focus();
|
|
1740
|
+
});
|
|
1741
|
+
} else {
|
|
1742
|
+
dayNodes[dayNodeIndex + 7].focus();
|
|
1743
|
+
}
|
|
1744
|
+
}
|
|
1745
|
+
}, {
|
|
1746
|
+
key: 'focusPreviousWeek',
|
|
1747
|
+
value: function focusPreviousWeek(dayNode) {
|
|
1748
|
+
var _this6 = this;
|
|
1749
|
+
|
|
1750
|
+
var dayNodes = Helpers.getDayNodes(this.dayPicker, this.props.classNames);
|
|
1751
|
+
var dayNodeIndex = Helpers.nodeListToArray(dayNodes).indexOf(dayNode);
|
|
1752
|
+
var isInFirstWeekOfMonth = dayNodeIndex <= 6;
|
|
1753
|
+
|
|
1754
|
+
if (isInFirstWeekOfMonth) {
|
|
1755
|
+
this.showPreviousMonth(function () {
|
|
1756
|
+
var previousMonthDayNodes = Helpers.getDayNodes(_this6.dayPicker, _this6.props.classNames);
|
|
1757
|
+
var startOfLastWeekOfMonth = previousMonthDayNodes.length - 7;
|
|
1758
|
+
var previousMonthDayNodeIndex = startOfLastWeekOfMonth + dayNodeIndex;
|
|
1759
|
+
previousMonthDayNodes[previousMonthDayNodeIndex].focus();
|
|
1760
|
+
});
|
|
1761
|
+
} else {
|
|
1762
|
+
dayNodes[dayNodeIndex - 7].focus();
|
|
1763
|
+
}
|
|
1764
|
+
}
|
|
1765
|
+
|
|
1766
|
+
// Event handlers
|
|
1767
|
+
|
|
1768
|
+
}, {
|
|
1769
|
+
key: 'handleOutsideDayClick',
|
|
1770
|
+
value: function handleOutsideDayClick(day) {
|
|
1771
|
+
var currentMonth = this.state.currentMonth;
|
|
1772
|
+
var numberOfMonths = this.props.numberOfMonths;
|
|
1773
|
+
|
|
1774
|
+
var diffInMonths = Helpers.getMonthsDiff(currentMonth, day);
|
|
1775
|
+
if (diffInMonths > 0 && diffInMonths >= numberOfMonths) {
|
|
1776
|
+
this.showNextMonth();
|
|
1777
|
+
} else if (diffInMonths < 0) {
|
|
1778
|
+
this.showPreviousMonth();
|
|
1779
|
+
}
|
|
1780
|
+
}
|
|
1781
|
+
}, {
|
|
1782
|
+
key: 'renderNavbar',
|
|
1783
|
+
value: function renderNavbar() {
|
|
1784
|
+
var _props2 = this.props,
|
|
1785
|
+
labels = _props2.labels,
|
|
1786
|
+
locale = _props2.locale,
|
|
1787
|
+
localeUtils = _props2.localeUtils,
|
|
1788
|
+
canChangeMonth = _props2.canChangeMonth,
|
|
1789
|
+
navbarElement = _props2.navbarElement,
|
|
1790
|
+
attributes = _objectWithoutProperties(_props2, ['labels', 'locale', 'localeUtils', 'canChangeMonth', 'navbarElement']);
|
|
1791
|
+
|
|
1792
|
+
if (!canChangeMonth) return null;
|
|
1793
|
+
|
|
1794
|
+
var props = {
|
|
1795
|
+
month: this.state.currentMonth,
|
|
1796
|
+
classNames: this.props.classNames,
|
|
1797
|
+
className: this.props.classNames.navBar,
|
|
1798
|
+
nextMonth: this.getNextNavigableMonth(),
|
|
1799
|
+
previousMonth: this.getPreviousNavigableMonth(),
|
|
1800
|
+
showPreviousButton: this.allowPreviousMonth(),
|
|
1801
|
+
showNextButton: this.allowNextMonth(),
|
|
1802
|
+
onNextClick: this.showNextMonth,
|
|
1803
|
+
onPreviousClick: this.showPreviousMonth,
|
|
1804
|
+
dir: attributes.dir,
|
|
1805
|
+
labels: labels,
|
|
1806
|
+
locale: locale,
|
|
1807
|
+
localeUtils: localeUtils
|
|
1808
|
+
};
|
|
1809
|
+
return _react2.default.isValidElement(navbarElement) ? _react2.default.cloneElement(navbarElement, props) : _react2.default.createElement(navbarElement, props);
|
|
1810
|
+
}
|
|
1811
|
+
}, {
|
|
1812
|
+
key: 'renderMonths',
|
|
1813
|
+
value: function renderMonths() {
|
|
1814
|
+
var months = [];
|
|
1815
|
+
var firstDayOfWeek = Helpers.getFirstDayOfWeekFromProps(this.props);
|
|
1816
|
+
for (var i = 0; i < this.props.numberOfMonths; i += 1) {
|
|
1817
|
+
var month = DateUtils.addMonths(this.state.currentMonth, i);
|
|
1818
|
+
months.push(_react2.default.createElement(_Month2.default, _extends({
|
|
1819
|
+
key: i
|
|
1820
|
+
}, this.props, {
|
|
1821
|
+
month: month,
|
|
1822
|
+
firstDayOfWeek: firstDayOfWeek,
|
|
1823
|
+
onDayKeyDown: this.handleDayKeyDown,
|
|
1824
|
+
onDayClick: this.handleDayClick
|
|
1825
|
+
})));
|
|
1826
|
+
}
|
|
1827
|
+
|
|
1828
|
+
if (this.props.reverseMonths) {
|
|
1829
|
+
months.reverse();
|
|
1830
|
+
}
|
|
1831
|
+
return months;
|
|
1832
|
+
}
|
|
1833
|
+
}, {
|
|
1834
|
+
key: 'renderFooter',
|
|
1835
|
+
value: function renderFooter() {
|
|
1836
|
+
if (this.props.todayButton) {
|
|
1837
|
+
return _react2.default.createElement(
|
|
1838
|
+
'div',
|
|
1839
|
+
{ className: this.props.classNames.footer },
|
|
1840
|
+
this.renderTodayButton()
|
|
1841
|
+
);
|
|
1842
|
+
}
|
|
1843
|
+
return null;
|
|
1844
|
+
}
|
|
1845
|
+
}, {
|
|
1846
|
+
key: 'renderTodayButton',
|
|
1847
|
+
value: function renderTodayButton() {
|
|
1848
|
+
return _react2.default.createElement(
|
|
1849
|
+
'button',
|
|
1850
|
+
{
|
|
1851
|
+
type: 'button',
|
|
1852
|
+
tabIndex: 0,
|
|
1853
|
+
className: this.props.classNames.todayButton,
|
|
1854
|
+
'aria-label': this.props.todayButton,
|
|
1855
|
+
onClick: this.handleTodayButtonClick
|
|
1856
|
+
},
|
|
1857
|
+
this.props.todayButton
|
|
1858
|
+
);
|
|
1859
|
+
}
|
|
1860
|
+
}, {
|
|
1861
|
+
key: 'render',
|
|
1862
|
+
value: function render() {
|
|
1863
|
+
var _this7 = this;
|
|
1864
|
+
|
|
1865
|
+
var className = this.props.classNames.container;
|
|
1866
|
+
|
|
1867
|
+
if (!this.props.onDayClick) {
|
|
1868
|
+
className = className + ' ' + this.props.classNames.interactionDisabled;
|
|
1869
|
+
}
|
|
1870
|
+
if (this.props.className) {
|
|
1871
|
+
className = className + ' ' + this.props.className;
|
|
1872
|
+
}
|
|
1873
|
+
return _react2.default.createElement(
|
|
1874
|
+
'div',
|
|
1875
|
+
_extends({}, this.props.containerProps, {
|
|
1876
|
+
className: className,
|
|
1877
|
+
ref: function ref(el) {
|
|
1878
|
+
return _this7.dayPicker = el;
|
|
1879
|
+
},
|
|
1880
|
+
lang: this.props.locale
|
|
1881
|
+
}),
|
|
1882
|
+
_react2.default.createElement(
|
|
1883
|
+
'div',
|
|
1884
|
+
{
|
|
1885
|
+
className: this.props.classNames.wrapper,
|
|
1886
|
+
ref: function ref(el) {
|
|
1887
|
+
return _this7.wrapper = el;
|
|
1888
|
+
},
|
|
1889
|
+
tabIndex: this.props.canChangeMonth && typeof this.props.tabIndex !== 'undefined' ? this.props.tabIndex : -1,
|
|
1890
|
+
onKeyDown: this.handleKeyDown,
|
|
1891
|
+
onFocus: this.props.onFocus,
|
|
1892
|
+
onBlur: this.props.onBlur
|
|
1893
|
+
},
|
|
1894
|
+
this.renderNavbar(),
|
|
1895
|
+
_react2.default.createElement(
|
|
1896
|
+
'div',
|
|
1897
|
+
{ className: this.props.classNames.months },
|
|
1898
|
+
this.renderMonths()
|
|
1899
|
+
),
|
|
1900
|
+
this.renderFooter()
|
|
1901
|
+
)
|
|
1902
|
+
);
|
|
1903
|
+
}
|
|
1904
|
+
}]);
|
|
1905
|
+
|
|
1906
|
+
return DayPicker;
|
|
1907
|
+
}(_react.Component);
|
|
1908
|
+
|
|
1909
|
+
DayPicker$1.defaultProps = {
|
|
1910
|
+
classNames: _classNames2.default,
|
|
1911
|
+
tabIndex: 0,
|
|
1912
|
+
numberOfMonths: 1,
|
|
1913
|
+
labels: {
|
|
1914
|
+
previousMonth: 'Previous Month',
|
|
1915
|
+
nextMonth: 'Next Month'
|
|
1916
|
+
},
|
|
1917
|
+
locale: 'en',
|
|
1918
|
+
localeUtils: LocaleUtils,
|
|
1919
|
+
showOutsideDays: false,
|
|
1920
|
+
enableOutsideDaysClick: true,
|
|
1921
|
+
fixedWeeks: false,
|
|
1922
|
+
canChangeMonth: true,
|
|
1923
|
+
reverseMonths: false,
|
|
1924
|
+
pagedNavigation: false,
|
|
1925
|
+
showWeekNumbers: false,
|
|
1926
|
+
showWeekDays: true,
|
|
1927
|
+
renderDay: function renderDay(day) {
|
|
1928
|
+
return day.getDate();
|
|
1929
|
+
},
|
|
1930
|
+
renderWeek: function renderWeek(weekNumber) {
|
|
1931
|
+
return weekNumber;
|
|
1932
|
+
},
|
|
1933
|
+
weekdayElement: _react2.default.createElement(_Weekday2.default, null),
|
|
1934
|
+
navbarElement: _react2.default.createElement(_Navbar2.default, { classNames: _classNames2.default }),
|
|
1935
|
+
captionElement: _react2.default.createElement(_Caption2.default, { classNames: _classNames2.default })
|
|
1936
|
+
};
|
|
1937
|
+
DayPicker$1.VERSION = '7.4.10';
|
|
1938
|
+
|
|
1939
|
+
|
|
1940
|
+
DayPicker$1.DateUtils = DateUtils;
|
|
1941
|
+
DayPicker$1.LocaleUtils = LocaleUtils;
|
|
1942
|
+
DayPicker$1.ModifiersUtils = ModifiersUtils;
|
|
1943
|
+
|
|
1944
|
+
DayPicker$2.DateUtils = DateUtils;
|
|
1945
|
+
DayPicker$2.LocaleUtils = LocaleUtils;
|
|
1946
|
+
DayPicker$2.ModifiersUtils = ModifiersUtils;
|
|
1947
|
+
DayPicker$2.default = DayPicker$1;
|
|
1948
|
+
|
|
1949
|
+
(function (exports) {
|
|
1950
|
+
|
|
1951
|
+
Object.defineProperty(exports, "__esModule", {
|
|
1952
|
+
value: true
|
|
1953
|
+
});
|
|
1954
|
+
|
|
1955
|
+
var _DayPicker = DayPicker$2;
|
|
1956
|
+
|
|
1957
|
+
Object.defineProperty(exports, 'default', {
|
|
1958
|
+
enumerable: true,
|
|
1959
|
+
get: function get() {
|
|
1960
|
+
return _interopRequireDefault(_DayPicker).default;
|
|
1961
|
+
}
|
|
1962
|
+
});
|
|
1963
|
+
|
|
1964
|
+
var _DateUtils = DateUtils$2;
|
|
1965
|
+
|
|
1966
|
+
Object.defineProperty(exports, 'DateUtils', {
|
|
1967
|
+
enumerable: true,
|
|
1968
|
+
get: function get() {
|
|
1969
|
+
return _interopRequireDefault(_DateUtils).default;
|
|
1970
|
+
}
|
|
1971
|
+
});
|
|
1972
|
+
|
|
1973
|
+
var _LocaleUtils = LocaleUtils$1;
|
|
1974
|
+
|
|
1975
|
+
Object.defineProperty(exports, 'LocaleUtils', {
|
|
1976
|
+
enumerable: true,
|
|
1977
|
+
get: function get() {
|
|
1978
|
+
return _interopRequireDefault(_LocaleUtils).default;
|
|
1979
|
+
}
|
|
1980
|
+
});
|
|
1981
|
+
|
|
1982
|
+
var _ModifiersUtils = ModifiersUtils$2;
|
|
1983
|
+
|
|
1984
|
+
Object.defineProperty(exports, 'ModifiersUtils', {
|
|
1985
|
+
enumerable: true,
|
|
1986
|
+
get: function get() {
|
|
1987
|
+
return _interopRequireDefault(_ModifiersUtils).default;
|
|
1988
|
+
}
|
|
1989
|
+
});
|
|
1990
|
+
|
|
1991
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
1992
|
+
|
|
1993
|
+
}(build));
|
|
1994
|
+
|
|
1995
|
+
var DayPicker = /*@__PURE__*/getDefaultExportFromCjs(build);
|
|
1996
|
+
|
|
1997
|
+
var customParseFormat$1 = {exports: {}};
|
|
1998
|
+
|
|
1999
|
+
(function (module, exports) {
|
|
2000
|
+
!function(t,e){module.exports=e();}(commonjsGlobal,(function(){var t={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"},e=/(\[[^[]*\])|([-:/.()\s]+)|(A|a|YYYY|YY?|MM?M?M?|Do|DD?|hh?|HH?|mm?|ss?|S{1,3}|z|ZZ?)/g,n=/\d\d/,r=/\d\d?/,i=/\d*[^\s\d-_:/()]+/,o={},s=function(t){return (t=+t)+(t>68?1900:2e3)};var a=function(t){return function(e){this[t]=+e;}},f=[/[+-]\d\d:?(\d\d)?|Z/,function(t){(this.zone||(this.zone={})).offset=function(t){if(!t)return 0;if("Z"===t)return 0;var e=t.match(/([+-]|\d\d)/g),n=60*e[1]+(+e[2]||0);return 0===n?0:"+"===e[0]?-n:n}(t);}],u=function(t){var e=o[t];return e&&(e.indexOf?e:e.s.concat(e.f))},h=function(t,e){var n,r=o.meridiem;if(r){for(var i=1;i<=24;i+=1)if(t.indexOf(r(i,0,e))>-1){n=i>12;break}}else n=t===(e?"pm":"PM");return n},d={A:[i,function(t){this.afternoon=h(t,!1);}],a:[i,function(t){this.afternoon=h(t,!0);}],S:[/\d/,function(t){this.milliseconds=100*+t;}],SS:[n,function(t){this.milliseconds=10*+t;}],SSS:[/\d{3}/,function(t){this.milliseconds=+t;}],s:[r,a("seconds")],ss:[r,a("seconds")],m:[r,a("minutes")],mm:[r,a("minutes")],H:[r,a("hours")],h:[r,a("hours")],HH:[r,a("hours")],hh:[r,a("hours")],D:[r,a("day")],DD:[n,a("day")],Do:[i,function(t){var e=o.ordinal,n=t.match(/\d+/);if(this.day=n[0],e)for(var r=1;r<=31;r+=1)e(r).replace(/\[|\]/g,"")===t&&(this.day=r);}],M:[r,a("month")],MM:[n,a("month")],MMM:[i,function(t){var e=u("months"),n=(u("monthsShort")||e.map((function(t){return t.substr(0,3)}))).indexOf(t)+1;if(n<1)throw new Error;this.month=n%12||n;}],MMMM:[i,function(t){var e=u("months").indexOf(t)+1;if(e<1)throw new Error;this.month=e%12||e;}],Y:[/[+-]?\d+/,a("year")],YY:[n,function(t){this.year=s(t);}],YYYY:[/\d{4}/,a("year")],Z:f,ZZ:f};function c(n){var r,i;r=n,i=o&&o.formats;for(var s=(n=r.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,(function(e,n,r){var o=r&&r.toUpperCase();return n||i[r]||t[r]||i[o].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,(function(t,e,n){return e||n.slice(1)}))}))).match(e),a=s.length,f=0;f<a;f+=1){var u=s[f],h=d[u],c=h&&h[0],l=h&&h[1];s[f]=l?{regex:c,parser:l}:u.replace(/^\[|\]$/g,"");}return function(t){for(var e={},n=0,r=0;n<a;n+=1){var i=s[n];if("string"==typeof i)r+=i.length;else {var o=i.regex,f=i.parser,u=t.substr(r),h=o.exec(u)[0];f.call(e,h),t=t.replace(h,"");}}return function(t){var e=t.afternoon;if(void 0!==e){var n=t.hours;e?n<12&&(t.hours+=12):12===n&&(t.hours=0),delete t.afternoon;}}(e),e}}return function(t,e,n){n.p.customParseFormat=!0,t&&t.parseTwoDigitYear&&(s=t.parseTwoDigitYear);var r=e.prototype,i=r.parse;r.parse=function(t){var e=t.date,r=t.utc,s=t.args;this.$u=r;var a=s[1];if("string"==typeof a){var f=!0===s[2],u=!0===s[3],h=f||u,d=s[2];u&&(d=s[2]),o=this.$locale(),!f&&d&&(o=n.Ls[d]),this.$d=function(t,e,n){try{if(["x","X"].indexOf(e)>-1)return new Date(("X"===e?1e3:1)*t);var r=c(e)(t),i=r.year,o=r.month,s=r.day,a=r.hours,f=r.minutes,u=r.seconds,h=r.milliseconds,d=r.zone,l=new Date,m=s||(i||o?1:l.getDate()),M=i||l.getFullYear(),Y=0;i&&!o||(Y=o>0?o-1:l.getMonth());var p=a||0,v=f||0,D=u||0,g=h||0;return d?new Date(Date.UTC(M,Y,m,p,v,D,g+60*d.offset*1e3)):n?new Date(Date.UTC(M,Y,m,p,v,D,g)):new Date(M,Y,m,p,v,D,g)}catch(t){return new Date("")}}(e,a,r),this.init(),d&&!0!==d&&(this.$L=this.locale(d).$L),h&&e!=this.format(a)&&(this.$d=new Date("")),o={};}else if(a instanceof Array)for(var l=a.length,m=1;m<=l;m+=1){s[1]=a[m-1];var M=n.apply(this,s);if(M.isValid()){this.$d=M.$d,this.$L=M.$L,this.init();break}m===l&&(this.$d=new Date(""));}else i.call(this,t);};}}));
|
|
2001
|
+
}(customParseFormat$1));
|
|
2002
|
+
|
|
2003
|
+
var customParseFormat = customParseFormat$1.exports;
|
|
2004
|
+
|
|
2005
|
+
function zerofill(input, size) {
|
|
2006
|
+
if (size === void 0) { size = 2; }
|
|
2007
|
+
var toReturn = String(input);
|
|
2008
|
+
while (toReturn.length < size) {
|
|
2009
|
+
toReturn = '0' + toReturn;
|
|
2010
|
+
}
|
|
2011
|
+
return toReturn;
|
|
2012
|
+
}
|
|
2013
|
+
|
|
2014
|
+
dayjs.extend(customParseFormat);
|
|
2015
|
+
function calendarDateToISODate(calendarDate) {
|
|
2016
|
+
return calendarDate.year + "-" + zerofill(calendarDate.month) + "-" + zerofill(calendarDate.day);
|
|
2017
|
+
}
|
|
2018
|
+
function isoStringtoCalendarDate(input) {
|
|
2019
|
+
var date = dayjs(input, 'YYYY-MM-DD');
|
|
2020
|
+
var dateValidity = dayjs(input, 'YYYY-MM-DD', true).isValid();
|
|
2021
|
+
if (dateValidity === false) {
|
|
2022
|
+
return;
|
|
2023
|
+
}
|
|
2024
|
+
var year = date.year();
|
|
2025
|
+
var month = date.get('month');
|
|
2026
|
+
var day = date.date();
|
|
2027
|
+
return { year: year, month: month + 1, day: day };
|
|
2028
|
+
}
|
|
2029
|
+
|
|
2030
|
+
var css_248z = ".style-module_container__3bJf5 {\n display: flex;\n align-items: center;\n}\n\n.style-module_date-selector-container__165Ii {\n margin-left: -8px;\n display: flex;\n}\n.style-module_date-selector-container__165Ii > select {\n margin-left: 8px;\n}\n@media (max-width: 34rem) {\n .style-module_date-selector-container__165Ii > select {\n margin-left: 0;\n }\n}\n@media (max-width: 34rem) {\n .style-module_date-selector-container__165Ii {\n margin-left: 0;\n display: unset;\n }\n}\n\n.style-module_row-container__2J4YP > select {\n margin-left: 8px;\n}\n@media (max-width: 34rem) {\n .style-module_row-container__2J4YP > select {\n margin-left: 0;\n }\n}\n@media (max-width: 34rem) {\n .style-module_row-container__2J4YP {\n display: flex;\n justify-content: space-between;\n }\n}\n\n.style-module_day-select__pHm0x {\n width: 88px;\n}\n@media (max-width: 34rem) {\n .style-module_day-select__pHm0x {\n flex: 1;\n margin-right: 8px;\n }\n}\n\n.style-module_month-select__2RXk9 {\n width: 104px;\n}\n@media (max-width: 34rem) {\n .style-module_month-select__2RXk9 {\n flex: 1;\n }\n}\n\n.style-module_year-select__8HXni {\n width: 104px;\n}\n@media (max-width: 34rem) {\n .style-module_year-select__8HXni {\n display: block;\n margin-top: 8px;\n width: 100%;\n }\n}\n\n.style-module_date-calendar-container__2ERYZ {\n position: relative;\n margin-left: 24px;\n}\n@media (max-width: 34rem) {\n .style-module_date-calendar-container__2ERYZ {\n margin-left: 16px;\n }\n}";
|
|
2031
|
+
var styles = {"container":"style-module_container__3bJf5","date-selector-container":"style-module_date-selector-container__165Ii","row-container":"style-module_row-container__2J4YP","day-select":"style-module_day-select__pHm0x","month-select":"style-module_month-select__2RXk9","year-select":"style-module_year-select__8HXni","date-calendar-container":"style-module_date-calendar-container__2ERYZ"};
|
|
2032
|
+
styleInject(css_248z);
|
|
2033
|
+
|
|
2034
|
+
var calendarIcon = "data:image/svg+xml,%3Csvg%20width%3D%2224%22%20height%3D%2225%22%20viewBox%3D%220%200%2024%2025%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22M19%204.46118H5C3.89543%204.46118%203%205.35661%203%206.46118V20.4612C3%2021.5658%203.89543%2022.4612%205%2022.4612H19C20.1046%2022.4612%2021%2021.5658%2021%2020.4612V6.46118C21%205.35661%2020.1046%204.46118%2019%204.46118Z%22%20stroke%3D%22%238E8CEE%22%20strokeWidth%3D%222%22%20strokeLinecap%3D%22round%22%20strokeLinejoin%3D%22round%22%2F%3E%3Cpath%20d%3D%22M16%202.46118V6.46118%22%20stroke%3D%22%238E8CEE%22%20strokeWidth%3D%222%22%20strokeLinecap%3D%22round%22%20strokeLinejoin%3D%22round%22%2F%3E%3Cpath%20d%3D%22M8%202.46118V6.46118%22%20stroke%3D%22%238E8CEE%22%20strokeWidth%3D%222%22%20strokeLinecap%3D%22round%22%20strokeLinejoin%3D%22round%22%2F%3E%3Cpath%20d%3D%22M3%2010.4612H21%22%20stroke%3D%22%238E8CEE%22%20strokeWidth%3D%222%22%20strokeLinecap%3D%22round%22%20strokeLinejoin%3D%22round%22%2F%3E%3C%2Fsvg%3E";
|
|
2035
|
+
|
|
2036
|
+
var useOnClickOutside = function (ref, callback) {
|
|
2037
|
+
useEffect(function () {
|
|
2038
|
+
var listener = function (event) {
|
|
2039
|
+
if (!ref.current || ref.current.contains(event.target)) {
|
|
2040
|
+
return;
|
|
2041
|
+
}
|
|
2042
|
+
callback(event);
|
|
2043
|
+
};
|
|
2044
|
+
document.addEventListener('mousedown', listener);
|
|
2045
|
+
document.addEventListener('touchstart', listener);
|
|
2046
|
+
return function () {
|
|
2047
|
+
document.removeEventListener('mousedown', listener);
|
|
2048
|
+
document.removeEventListener('touchstart', listener);
|
|
2049
|
+
};
|
|
2050
|
+
}, [ref, callback]);
|
|
2051
|
+
};
|
|
2052
|
+
|
|
2053
|
+
dayjs.extend(localeData);
|
|
2054
|
+
var COLLECTABLE_DATE_FORMAT = 'YYYY-MM-DD';
|
|
2055
|
+
/*
|
|
2056
|
+
Fill an array with an increment from a number to another number.
|
|
2057
|
+
i.e. fillArray from 1 to 4 will return the following: [1, 2, 3, 4]
|
|
2058
|
+
|
|
2059
|
+
You can fill descending by flipping the to value
|
|
2060
|
+
i.e. fillArray from 4 to 1 will return the following: [4, 3, 2, 1]
|
|
2061
|
+
*/
|
|
2062
|
+
var fillArray = function (from, to) {
|
|
2063
|
+
var ascending = from > to;
|
|
2064
|
+
var arraySize = Math.abs(from - to) + 1;
|
|
2065
|
+
var toReturn = new Array(arraySize).fill(0).map(function (_, index) {
|
|
2066
|
+
return ascending ? to + index : from + index;
|
|
2067
|
+
});
|
|
2068
|
+
if (ascending) {
|
|
2069
|
+
return toReturn.reverse();
|
|
2070
|
+
}
|
|
2071
|
+
return toReturn;
|
|
2072
|
+
};
|
|
2073
|
+
/*
|
|
2074
|
+
Return the maximum number of days given a month and a year.
|
|
2075
|
+
*/
|
|
2076
|
+
var daysInMonthOfYear = function (_a) {
|
|
2077
|
+
var month = _a.month, year = _a.year;
|
|
2078
|
+
return dayjs(year + "-" + month).daysInMonth();
|
|
2079
|
+
};
|
|
2080
|
+
var DateSelector = function (_a) {
|
|
2081
|
+
var _b, _c, _d;
|
|
2082
|
+
var value = _a.value, onChange = _a.onChange, yearBoundaries = _a.yearBoundaries, displayCalendar = _a.displayCalendar, placeholders = _a.placeholders, dayjsLocale = _a.dayjsLocale, _e = _a.firstDayOfWeek, firstDayOfWeek = _e === void 0 ? 0 : _e;
|
|
2083
|
+
var calendarDateValue = value ? isoStringtoCalendarDate(value) : undefined;
|
|
2084
|
+
var daysInSelectedDate = calendarDateValue
|
|
2085
|
+
? daysInMonthOfYear({
|
|
2086
|
+
month: calendarDateValue.month,
|
|
2087
|
+
year: calendarDateValue.year,
|
|
2088
|
+
})
|
|
2089
|
+
: 31;
|
|
2090
|
+
var localeDate = dayjsLocale
|
|
2091
|
+
? dayjs().locale(dayjsLocale).localeData()
|
|
2092
|
+
: dayjs().locale('en').localeData();
|
|
2093
|
+
var localizedWeekdays = localeDate.weekdays();
|
|
2094
|
+
var localizedWeekdaysShort = localeDate.weekdaysShort();
|
|
2095
|
+
var localizedMonths = localeDate.months();
|
|
2096
|
+
var localizedMonthsShort = localeDate.monthsShort();
|
|
2097
|
+
var availableDays = fillArray(1, daysInSelectedDate);
|
|
2098
|
+
var availableYears = fillArray(yearBoundaries.max, yearBoundaries.min);
|
|
2099
|
+
var availableMonths = localizedMonthsShort;
|
|
2100
|
+
var _f = useState(calendarDateValue !== null && calendarDateValue !== void 0 ? calendarDateValue : {}), date = _f[0], setDate = _f[1];
|
|
2101
|
+
var _g = useState(false), openCalendar = _g[0], setOpenCalendar = _g[1];
|
|
2102
|
+
var calendarContainerRef = useRef(null);
|
|
2103
|
+
var calendarDefaultDate = dayjs().year() >= yearBoundaries.min && dayjs().year() <= yearBoundaries.max
|
|
2104
|
+
? dayjs().toDate()
|
|
2105
|
+
: dayjs().set('year', yearBoundaries.max).toDate();
|
|
2106
|
+
var selectedDateInDateType = value
|
|
2107
|
+
? dayjs(value).toDate()
|
|
2108
|
+
: calendarDefaultDate;
|
|
2109
|
+
var dateCalendarFromMonth = dayjs(String(yearBoundaries.min))
|
|
2110
|
+
.startOf('year')
|
|
2111
|
+
.toDate();
|
|
2112
|
+
var dateCalendarToMonth = dayjs(String(yearBoundaries.max))
|
|
2113
|
+
.endOf('year')
|
|
2114
|
+
.toDate();
|
|
2115
|
+
useOnClickOutside(calendarContainerRef, function () { return setOpenCalendar(false); });
|
|
2116
|
+
useEffect(function () {
|
|
2117
|
+
if (calendarDateValue) {
|
|
2118
|
+
setDate(calendarDateValue);
|
|
2119
|
+
}
|
|
2120
|
+
}, [value]); //eslint-disable-line react-hooks/exhaustive-deps
|
|
2121
|
+
useEffect(function () {
|
|
2122
|
+
if (date.year !== undefined &&
|
|
2123
|
+
date.month !== undefined &&
|
|
2124
|
+
date.day !== undefined) {
|
|
2125
|
+
if (calendarDateValue === undefined ||
|
|
2126
|
+
date.day !== calendarDateValue.day ||
|
|
2127
|
+
date.month !== calendarDateValue.month ||
|
|
2128
|
+
date.year !== calendarDateValue.year) {
|
|
2129
|
+
onChange(calendarDateToISODate({
|
|
2130
|
+
day: date.day,
|
|
2131
|
+
month: date.month,
|
|
2132
|
+
year: date.year,
|
|
2133
|
+
}));
|
|
2134
|
+
}
|
|
2135
|
+
}
|
|
2136
|
+
}, [date]); //eslint-disable-line react-hooks/exhaustive-deps
|
|
2137
|
+
var handleOnChange = function (key, v) {
|
|
2138
|
+
var _a;
|
|
2139
|
+
var newValue = __assign(__assign({}, date), (_a = {}, _a[key] = v, _a));
|
|
2140
|
+
if (key !== 'day' &&
|
|
2141
|
+
newValue.month !== undefined &&
|
|
2142
|
+
newValue.year !== undefined &&
|
|
2143
|
+
newValue.day !== undefined) {
|
|
2144
|
+
var cappedDays = Math.min(daysInMonthOfYear({ month: newValue.month, year: newValue.year }), newValue.day);
|
|
2145
|
+
setDate(__assign(__assign({}, newValue), { day: cappedDays }));
|
|
2146
|
+
}
|
|
2147
|
+
else {
|
|
2148
|
+
setDate(newValue);
|
|
2149
|
+
}
|
|
2150
|
+
setOpenCalendar(false);
|
|
2151
|
+
};
|
|
2152
|
+
return (jsxs("div", __assign({ className: styles.container }, { children: [jsxs("div", __assign({ className: styles['date-selector-container'] }, { children: [jsxs("div", __assign({ className: styles['row-container'] }, { children: [jsxs("select", __assign({ "data-cy": "date-selector-day", className: "p-select " + styles['day-select'], id: "day", name: "day", required: true, value: (_b = date.day) !== null && _b !== void 0 ? _b : '', onChange: function (e) {
|
|
2153
|
+
handleOnChange('day', parseInt(e.target.value, 10));
|
|
2154
|
+
} }, { children: [jsx("option", __assign({ value: "", disabled: true }, { children: (placeholders === null || placeholders === void 0 ? void 0 : placeholders.day) || 'Day' }), void 0),
|
|
2155
|
+
availableDays.map(function (day) { return (jsx("option", __assign({ value: day }, { children: day }), day)); })] }), void 0),
|
|
2156
|
+
jsxs("select", __assign({ "data-cy": "date-selector-month", className: "p-select " + styles['month-select'], id: "month", name: "month", required: true, value: (_c = date.month) !== null && _c !== void 0 ? _c : '', onChange: function (e) {
|
|
2157
|
+
handleOnChange('month', parseInt(e.target.value, 10));
|
|
2158
|
+
} }, { children: [jsx("option", __assign({ value: "", disabled: true }, { children: (placeholders === null || placeholders === void 0 ? void 0 : placeholders.month) || 'Month' }), void 0),
|
|
2159
|
+
availableMonths.map(function (month, i) { return (jsx("option", __assign({ value: i + 1 }, { children: month }), month)); })] }), void 0)] }), void 0),
|
|
2160
|
+
jsxs("select", __assign({ "data-cy": "date-selector-year", className: "p-select " + styles['year-select'], id: "year", name: "year", required: true, value: (_d = date.year) !== null && _d !== void 0 ? _d : '', onChange: function (e) {
|
|
2161
|
+
handleOnChange('year', parseInt(e.target.value, 10));
|
|
2162
|
+
} }, { children: [jsx("option", __assign({ value: "", disabled: true }, { children: (placeholders === null || placeholders === void 0 ? void 0 : placeholders.year) || 'Year' }), void 0),
|
|
2163
|
+
availableYears.map(function (year) { return (jsx("option", __assign({ value: year }, { children: year }), year)); })] }), void 0)] }), void 0),
|
|
2164
|
+
displayCalendar && (jsxs("div", __assign({ className: styles['date-calendar-container'], ref: calendarContainerRef }, { children: [jsx("img", { className: "c-pointer", src: calendarIcon, alt: "calendar", onClick: function () { return setOpenCalendar(!openCalendar); } }, void 0),
|
|
2165
|
+
openCalendar && (jsx(DayPicker, { month: selectedDateInDateType, showOutsideDays: true, fromMonth: dateCalendarFromMonth, toMonth: dateCalendarToMonth, selectedDays: selectedDateInDateType, onDayClick: function (date) {
|
|
2166
|
+
if (dayjs(date).isAfter(dateCalendarFromMonth) ||
|
|
2167
|
+
dayjs(date).isBefore(dateCalendarToMonth)) {
|
|
2168
|
+
var selectedDate = dayjs(date).format(COLLECTABLE_DATE_FORMAT);
|
|
2169
|
+
onChange(selectedDate);
|
|
2170
|
+
setOpenCalendar(false);
|
|
2171
|
+
}
|
|
2172
|
+
}, pagedNavigation: true, disabledDays: {
|
|
2173
|
+
before: dateCalendarFromMonth,
|
|
2174
|
+
after: dateCalendarToMonth,
|
|
2175
|
+
}, firstDayOfWeek: firstDayOfWeek, locale: (dayjsLocale === null || dayjsLocale === void 0 ? void 0 : dayjsLocale.name) || 'en', months: localizedMonths, weekdaysLong: localizedWeekdays, weekdaysShort: localizedWeekdaysShort }, void 0))] }), void 0))] }), void 0));
|
|
2176
|
+
};
|
|
2177
|
+
|
|
2178
|
+
export { DateSelector as D, daysInMonthOfYear as a, dayjs_min as d, fillArray as f };
|
|
2179
|
+
//# sourceMappingURL=index-639cf8b3.js.map
|