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