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; }; }();
var _object = __webpack_require__("Koq/");
var _object2 = _interopRequireDefault(_object);
var _react = __webpack_require__("cDcd");
var _react2 = _interopRequireDefault(_react);
var _propTypes = __webpack_require__("17x9");
var _propTypes2 = _interopRequireDefault(_propTypes);
var _reactMomentProptypes = __webpack_require__("XGBb");
var _reactMomentProptypes2 = _interopRequireDefault(_reactMomentProptypes);
var _airbnbPropTypes = __webpack_require__("Hsqg");
var _moment = __webpack_require__("wy2R");
var _moment2 = _interopRequireDefault(_moment);
var _object3 = __webpack_require__("4cSd");
var _object4 = _interopRequireDefault(_object3);
var _isTouchDevice = __webpack_require__("LTAC");
var _isTouchDevice2 = _interopRequireDefault(_isTouchDevice);
var _defaultPhrases = __webpack_require__("vV+G");
var _getPhrasePropTypes = __webpack_require__("yc2e");
var _getPhrasePropTypes2 = _interopRequireDefault(_getPhrasePropTypes);
var _isSameDay = __webpack_require__("pRvc");
var _isSameDay2 = _interopRequireDefault(_isSameDay);
var _isAfterDay = __webpack_require__("Nho6");
var _isAfterDay2 = _interopRequireDefault(_isAfterDay);
var _getVisibleDays = __webpack_require__("u5Fq");
var _getVisibleDays2 = _interopRequireDefault(_getVisibleDays);
var _isDayVisible = __webpack_require__("IgE5");
var _isDayVisible2 = _interopRequireDefault(_isDayVisible);
var _toISODateString = __webpack_require__("pYxT");
var _toISODateString2 = _interopRequireDefault(_toISODateString);
var _toISOMonthString = __webpack_require__("jenk");
var _toISOMonthString2 = _interopRequireDefault(_toISOMonthString);
var _ScrollableOrientationShape = __webpack_require__("aE6U");
var _ScrollableOrientationShape2 = _interopRequireDefault(_ScrollableOrientationShape);
var _DayOfWeekShape = __webpack_require__("2S2E");
var _DayOfWeekShape2 = _interopRequireDefault(_DayOfWeekShape);
var _CalendarInfoPositionShape = __webpack_require__("oR9Z");
var _CalendarInfoPositionShape2 = _interopRequireDefault(_CalendarInfoPositionShape);
var _constants = __webpack_require__("Fv1B");
var _DayPicker = __webpack_require__("Nloh");
var _DayPicker2 = _interopRequireDefault(_DayPicker);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
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; }
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; }
var propTypes = (0, _airbnbPropTypes.forbidExtraProps)({
date: _reactMomentProptypes2['default'].momentObj,
onDateChange: _propTypes2['default'].func,
focused: _propTypes2['default'].bool,
onFocusChange: _propTypes2['default'].func,
onClose: _propTypes2['default'].func,
keepOpenOnDateSelect: _propTypes2['default'].bool,
isOutsideRange: _propTypes2['default'].func,
isDayBlocked: _propTypes2['default'].func,
isDayHighlighted: _propTypes2['default'].func,
renderMonthText: (0, _airbnbPropTypes.mutuallyExclusiveProps)(_propTypes2['default'].func, 'renderMonthText', 'renderMonthElement'),
renderMonthElement: (0, _airbnbPropTypes.mutuallyExclusiveProps)(_propTypes2['default'].func, 'renderMonthText', 'renderMonthElement'),
enableOutsideDays: _propTypes2['default'].bool,
numberOfMonths: _propTypes2['default'].number,
orientation: _ScrollableOrientationShape2['default'],
withPortal: _propTypes2['default'].bool,
initialVisibleMonth: _propTypes2['default'].func,
firstDayOfWeek: _DayOfWeekShape2['default'],
hideKeyboardShortcutsPanel: _propTypes2['default'].bool,
daySize: _airbnbPropTypes.nonNegativeInteger,
verticalHeight: _airbnbPropTypes.nonNegativeInteger,
noBorder: _propTypes2['default'].bool,
verticalBorderSpacing: _airbnbPropTypes.nonNegativeInteger,
transitionDuration: _airbnbPropTypes.nonNegativeInteger,
horizontalMonthPadding: _airbnbPropTypes.nonNegativeInteger,
navPrev: _propTypes2['default'].node,
navNext: _propTypes2['default'].node,
onPrevMonthClick: _propTypes2['default'].func,
onNextMonthClick: _propTypes2['default'].func,
onOutsideClick: _propTypes2['default'].func,
renderCalendarDay: _propTypes2['default'].func,
renderDayContents: _propTypes2['default'].func,
renderCalendarInfo: _propTypes2['default'].func,
calendarInfoPosition: _CalendarInfoPositionShape2['default'],
onBlur: _propTypes2['default'].func,
isFocused: _propTypes2['default'].bool,
showKeyboardShortcuts: _propTypes2['default'].bool,
monthFormat: _propTypes2['default'].string,
weekDayFormat: _propTypes2['default'].string,
phrases: _propTypes2['default'].shape((0, _getPhrasePropTypes2['default'])(_defaultPhrases.DayPickerPhrases)),
dayAriaLabelFormat: _propTypes2['default'].string,
isRTL: _propTypes2['default'].bool
date: undefined, // TODO: use null
onDateChange: function () {
function onDateChange() {}
onFocusChange: function () {
function onFocusChange() {}
keepOpenOnDateSelect: false,
isOutsideRange: function () {
function isOutsideRange() {}
isDayBlocked: function () {
function isDayBlocked() {}
isDayHighlighted: function () {
function isDayHighlighted() {}
enableOutsideDays: false,
orientation: _constants.HORIZONTAL_ORIENTATION,
hideKeyboardShortcutsPanel: false,
initialVisibleMonth: null,
daySize: _constants.DAY_SIZE,
verticalBorderSpacing: undefined,
transitionDuration: undefined,
horizontalMonthPadding: 13,
onPrevMonthClick: function () {
function onPrevMonthClick() {}
onNextMonthClick: function () {
function onNextMonthClick() {}
onOutsideClick: function () {
function onOutsideClick() {}
renderCalendarDay: undefined,
renderCalendarInfo: null,
renderMonthElement: null,
calendarInfoPosition: _constants.INFO_POSITION_BOTTOM,
showKeyboardShortcuts: false,
monthFormat: 'MMMM YYYY',
phrases: _defaultPhrases.DayPickerPhrases,
dayAriaLabelFormat: undefined,
var DayPickerSingleDateController = function (_React$Component) {
_inherits(DayPickerSingleDateController, _React$Component);
function DayPickerSingleDateController(props) {
_classCallCheck(this, DayPickerSingleDateController);
var _this = _possibleConstructorReturn(this, (DayPickerSingleDateController.__proto__ || Object.getPrototypeOf(DayPickerSingleDateController)).call(this, props));
_this.isTouchDevice = false;
_this.today = (0, _moment2['default'])();
return _this.isToday(day);
return _this.isBlocked(day);
'blocked-calendar': function () {
function blockedCalendar(day) {
return props.isDayBlocked(day);
'blocked-out-of-range': function () {
function blockedOutOfRange(day) {
return props.isOutsideRange(day);
return blockedOutOfRange;
'highlighted-calendar': function () {
function highlightedCalendar(day) {
return props.isDayHighlighted(day);
return highlightedCalendar;
return !_this.isBlocked(day);
return _this.isHovered(day);
return _this.isSelected(day);
'first-day-of-week': function () {
function firstDayOfWeek(day) {
return _this.isFirstDayOfWeek(day);
'last-day-of-week': function () {
function lastDayOfWeek(day) {
return _this.isLastDayOfWeek(day);
var _this$getStateForNewM = _this.getStateForNewMonth(props),
currentMonth = _this$getStateForNewM.currentMonth,
visibleDays = _this$getStateForNewM.visibleDays;
currentMonth: currentMonth,
_this.onDayMouseEnter = _this.onDayMouseEnter.bind(_this);
_this.onDayMouseLeave = _this.onDayMouseLeave.bind(_this);
_this.onDayClick = _this.onDayClick.bind(_this);
_this.onPrevMonthClick = _this.onPrevMonthClick.bind(_this);
_this.onNextMonthClick = _this.onNextMonthClick.bind(_this);
_this.onMonthChange = _this.onMonthChange.bind(_this);
_this.onYearChange = _this.onYearChange.bind(_this);
_this.getFirstFocusableDay = _this.getFirstFocusableDay.bind(_this);
_createClass(DayPickerSingleDateController, [{
key: 'componentDidMount',
function componentDidMount() {
this.isTouchDevice = (0, _isTouchDevice2['default'])();
return componentDidMount;
key: 'componentWillReceiveProps',
function componentWillReceiveProps(nextProps) {
var date = nextProps.date,
focused = nextProps.focused,
isOutsideRange = nextProps.isOutsideRange,
isDayBlocked = nextProps.isDayBlocked,
isDayHighlighted = nextProps.isDayHighlighted,
initialVisibleMonth = nextProps.initialVisibleMonth,
numberOfMonths = nextProps.numberOfMonths,
enableOutsideDays = nextProps.enableOutsideDays;
prevIsOutsideRange = _props.isOutsideRange,
prevIsDayBlocked = _props.isDayBlocked,
prevIsDayHighlighted = _props.isDayHighlighted,
prevNumberOfMonths = _props.numberOfMonths,
prevEnableOutsideDays = _props.enableOutsideDays,
prevInitialVisibleMonth = _props.initialVisibleMonth,
prevFocused = _props.focused,
var visibleDays = this.state.visibleDays;
var recomputeOutsideRange = false;
var recomputeDayBlocked = false;
var recomputeDayHighlighted = false;
if (isOutsideRange !== prevIsOutsideRange) {
this.modifiers['blocked-out-of-range'] = function (day) {
return isOutsideRange(day);
recomputeOutsideRange = true;
if (isDayBlocked !== prevIsDayBlocked) {
this.modifiers['blocked-calendar'] = function (day) {
return isDayBlocked(day);
recomputeDayBlocked = true;
if (isDayHighlighted !== prevIsDayHighlighted) {
this.modifiers['highlighted-calendar'] = function (day) {
return isDayHighlighted(day);
recomputeDayHighlighted = true;
var recomputePropModifiers = recomputeOutsideRange || recomputeDayBlocked || recomputeDayHighlighted;
if (numberOfMonths !== prevNumberOfMonths || enableOutsideDays !== prevEnableOutsideDays || initialVisibleMonth !== prevInitialVisibleMonth && !prevFocused && focused) {
var newMonthState = this.getStateForNewMonth(nextProps);
var currentMonth = newMonthState.currentMonth;
visibleDays = newMonthState.visibleDays;
currentMonth: currentMonth,
var didDateChange = date !== prevDate;
var didFocusChange = focused !== prevFocused;
modifiers = this.deleteModifier(modifiers, prevDate, 'selected');
modifiers = this.addModifier(modifiers, date, 'selected');
if (didFocusChange || recomputePropModifiers) {
(0, _object4['default'])(visibleDays).forEach(function (days) {
Object.keys(days).forEach(function (day) {
var momentObj = (0, _moment2['default'])(day);
if (_this2.isBlocked(momentObj)) {
modifiers = _this2.addModifier(modifiers, momentObj, 'blocked');
modifiers = _this2.deleteModifier(modifiers, momentObj, 'blocked');
if (didFocusChange || recomputeOutsideRange) {
if (isOutsideRange(momentObj)) {
modifiers = _this2.addModifier(modifiers, momentObj, 'blocked-out-of-range');
modifiers = _this2.deleteModifier(modifiers, momentObj, 'blocked-out-of-range');
if (didFocusChange || recomputeDayBlocked) {
if (isDayBlocked(momentObj)) {
modifiers = _this2.addModifier(modifiers, momentObj, 'blocked-calendar');
modifiers = _this2.deleteModifier(modifiers, momentObj, 'blocked-calendar');
if (didFocusChange || recomputeDayHighlighted) {
if (isDayHighlighted(momentObj)) {
modifiers = _this2.addModifier(modifiers, momentObj, 'highlighted-calendar');
modifiers = _this2.deleteModifier(modifiers, momentObj, 'highlighted-calendar');
var today = (0, _moment2['default'])();
if (!(0, _isSameDay2['default'])(this.today, today)) {
modifiers = this.deleteModifier(modifiers, this.today, 'today');
modifiers = this.addModifier(modifiers, today, 'today');
if (Object.keys(modifiers).length > 0) {
visibleDays: (0, _object2['default'])({}, visibleDays, modifiers)
return componentWillReceiveProps;
key: 'componentWillUpdate',
function componentWillUpdate() {
this.today = (0, _moment2['default'])();
return componentWillUpdate;