
File name
Commit message
Commit date
File name
Commit message
Commit date
File name
Commit message
Commit date
File name
Commit message
Commit date
File name
Commit message
Commit date
var _excluded = ["activeStartDate", "defaultActiveStartDate", "defaultValue", "defaultView", "maxDetail", "minDetail", "value", "view"];
function _extends() { _extends = Object.assign ? Object.assign.bind() : 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; }; return _extends.apply(this, arguments); }
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a 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); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
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 _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import clsx from 'clsx';
import Navigation from './Calendar/Navigation';
import CenturyView from './CenturyView';
import DecadeView from './DecadeView';
import YearView from './YearView';
import MonthView from './MonthView';
import { getBegin, getBeginNext, getEnd, getValueRange } from './shared/dates';
import { isCalendarType, isClassName, isMaxDate, isMinDate, isRef, isValue, isView } from './shared/propTypes';
import { between } from './shared/utils';
var defaultMinDate = new Date();
defaultMinDate.setFullYear(1, 0, 1);
defaultMinDate.setHours(0, 0, 0, 0);
var defaultMaxDate = new Date(8.64e15);
var baseClassName = 'react-calendar';
var allViews = ['century', 'decade', 'year', 'month'];
var allValueTypes = [].concat(_toConsumableArray(allViews.slice(1)), ['day']);
function toDate(value) {
if (value instanceof Date) {
return value;
}
return new Date(value);
}
/**
* Returns views array with disallowed values cut off.
*/
function getLimitedViews(minDetail, maxDetail) {
return allViews.slice(allViews.indexOf(minDetail), allViews.indexOf(maxDetail) + 1);
}
/**
* Determines whether a given view is allowed with currently applied settings.
*/
function isViewAllowed(view, minDetail, maxDetail) {
var views = getLimitedViews(minDetail, maxDetail);
return views.indexOf(view) !== -1;
}
/**
* Gets either provided view if allowed by minDetail and maxDetail, or gets
* the default view if not allowed.
*/
function getView(view, minDetail, maxDetail) {
if (isViewAllowed(view, minDetail, maxDetail)) {
return view;
}
return maxDetail;
}
/**
* Returns value type that can be returned with currently applied settings.
*/
function getValueType(maxDetail) {
return allValueTypes[allViews.indexOf(maxDetail)];
}
function getValue(value, index) {
if (!value) {
return null;
}
var rawValue = Array.isArray(value) && value.length === 2 ? value[index] : value;
if (!rawValue) {
return null;
}
var valueDate = toDate(rawValue);
if (isNaN(valueDate.getTime())) {
throw new Error("Invalid date: ".concat(value));
}
return valueDate;
}
function getDetailValue(_ref, index) {
var value = _ref.value,
minDate = _ref.minDate,
maxDate = _ref.maxDate,
maxDetail = _ref.maxDetail;
var valuePiece = getValue(value, index);
if (!valuePiece) {
return null;
}
var valueType = getValueType(maxDetail);
var detailValueFrom = [getBegin, getEnd][index](valueType, valuePiece);
return between(detailValueFrom, minDate, maxDate);
}
var getDetailValueFrom = function getDetailValueFrom(args) {
return getDetailValue(args, 0);
};
var getDetailValueTo = function getDetailValueTo(args) {
return getDetailValue(args, 1);
};
var getDetailValueArray = function getDetailValueArray(args) {
var value = args.value;
if (Array.isArray(value)) {
return value;
}
return [getDetailValueFrom, getDetailValueTo].map(function (fn) {
return fn(args);
});
};
function getActiveStartDate(props) {
var maxDate = props.maxDate,
maxDetail = props.maxDetail,
minDate = props.minDate,
minDetail = props.minDetail,
value = props.value,
view = props.view;
var rangeType = getView(view, minDetail, maxDetail);
var valueFrom = getDetailValueFrom({
value: value,
minDate: minDate,
maxDate: maxDate,
maxDetail: maxDetail
}) || new Date();
return getBegin(rangeType, valueFrom);
}
function getInitialActiveStartDate(props) {
var activeStartDate = props.activeStartDate,
defaultActiveStartDate = props.defaultActiveStartDate,
defaultValue = props.defaultValue,
defaultView = props.defaultView,
maxDetail = props.maxDetail,
minDetail = props.minDetail,
value = props.value,
view = props.view,
otherProps = _objectWithoutProperties(props, _excluded);
var rangeType = getView(view, minDetail, maxDetail);
var valueFrom = activeStartDate || defaultActiveStartDate;
if (valueFrom) {
return getBegin(rangeType, valueFrom);
}
return getActiveStartDate(_objectSpread({
maxDetail: maxDetail,
minDetail: minDetail,
value: value || defaultValue,
view: view || defaultView
}, otherProps));
}
var getIsSingleValue = function getIsSingleValue(value) {
return value && [].concat(value).length === 1;
};
var Calendar = /*#__PURE__*/function (_Component) {
_inherits(Calendar, _Component);
var _super = _createSuper(Calendar);
function Calendar() {
var _this;
_classCallCheck(this, Calendar);
for (var _len = arguments.length, _args = new Array(_len), _key = 0; _key < _len; _key++) {
_args[_key] = arguments[_key];
}
_this = _super.call.apply(_super, [this].concat(_args));
_defineProperty(_assertThisInitialized(_this), "state", {
activeStartDate: _this.props.defaultActiveStartDate,
value: _this.props.defaultValue,
view: _this.props.defaultView
});
_defineProperty(_assertThisInitialized(_this), "setStateAndCallCallbacks", function (nextState, event, callback) {
var _assertThisInitialize = _assertThisInitialized(_this),
previousActiveStartDate = _assertThisInitialize.activeStartDate,
previousView = _assertThisInitialize.view;
var _this$props = _this.props,
allowPartialRange = _this$props.allowPartialRange,
onActiveStartDateChange = _this$props.onActiveStartDateChange,
onChange = _this$props.onChange,
onViewChange = _this$props.onViewChange,
selectRange = _this$props.selectRange;
var prevArgs = {
activeStartDate: previousActiveStartDate,
view: previousView
};
_this.setState(nextState, function () {
var args = {
action: nextState.action,
activeStartDate: nextState.activeStartDate || _this.activeStartDate,
value: nextState.value || _this.value,
view: nextState.view || _this.view
};
function shouldUpdate(key) {
return (
// Key must exist, and…
key in nextState && (
// …key changed from undefined to defined or the other way around, or…
_typeof(nextState[key]) !== _typeof(prevArgs[key]) || (
// …value changed.
nextState[key] instanceof Date ? nextState[key].getTime() !== prevArgs[key].getTime() : nextState[key] !== prevArgs[key]))
);
}
if (shouldUpdate('activeStartDate')) {
if (onActiveStartDateChange) onActiveStartDateChange(args);
}
if (shouldUpdate('view')) {
if (onViewChange) onViewChange(args);
}
if (shouldUpdate('value')) {
if (onChange) {
if (selectRange) {
var isSingleValue = getIsSingleValue(nextState.value);
if (!isSingleValue) {
onChange(nextState.value, event);
} else if (allowPartialRange) {
onChange([nextState.value], event);
}
} else {
onChange(nextState.value, event);
}
}
}
if (callback) callback(args);
});
});
_defineProperty(_assertThisInitialized(_this), "setActiveStartDate", function (nextActiveStartDate, action) {
_this.setStateAndCallCallbacks({
action: action,
activeStartDate: nextActiveStartDate
});
});
_defineProperty(_assertThisInitialized(_this), "drillDown", function (nextActiveStartDate, event) {
if (!_this.drillDownAvailable) {
return;
}
_this.onClickTile(nextActiveStartDate, event);
var _assertThisInitialize2 = _assertThisInitialized(_this),
view = _assertThisInitialize2.view,
views = _assertThisInitialize2.views;
var onDrillDown = _this.props.onDrillDown;
var nextView = views[views.indexOf(view) + 1];
_this.setStateAndCallCallbacks({
action: 'drillDown',
activeStartDate: nextActiveStartDate,
view: nextView
}, undefined, onDrillDown);
});
_defineProperty(_assertThisInitialized(_this), "drillUp", function () {
if (!_this.drillUpAvailable) {
return;
}
var _assertThisInitialize3 = _assertThisInitialized(_this),
activeStartDate = _assertThisInitialize3.activeStartDate,
view = _assertThisInitialize3.view,
views = _assertThisInitialize3.views;
var onDrillUp = _this.props.onDrillUp;
var nextView = views[views.indexOf(view) - 1];
var nextActiveStartDate = getBegin(nextView, activeStartDate);
_this.setStateAndCallCallbacks({
action: 'drillUp',
activeStartDate: nextActiveStartDate,
view: nextView
}, undefined, onDrillUp);
});
_defineProperty(_assertThisInitialized(_this), "onChange", function (value, event) {
var _assertThisInitialize4 = _assertThisInitialized(_this),
previousValue = _assertThisInitialize4.value;
var _this$props2 = _this.props,
goToRangeStartOnSelect = _this$props2.goToRangeStartOnSelect,
selectRange = _this$props2.selectRange;
_this.onClickTile(value, event);
var isFirstValueInRange = selectRange && !getIsSingleValue(previousValue);
var nextValue;
if (selectRange) {
// Range selection turned on
var _assertThisInitialize5 = _assertThisInitialized(_this),
valueType = _assertThisInitialize5.valueType;
if (isFirstValueInRange) {
// Value has 0 or 2 elements - either way we're starting a new array
// First value
nextValue = getBegin(valueType, value);
} else {
// Second value
nextValue = getValueRange(valueType, previousValue, value);
}
} else {
// Range selection turned off
nextValue = _this.getProcessedValue(value);
}
var nextActiveStartDate =
// Range selection turned off
!selectRange ||
// Range selection turned on, first value
isFirstValueInRange ||
// Range selection turned on, second value, goToRangeStartOnSelect toggled on
goToRangeStartOnSelect ? getActiveStartDate(_objectSpread(_objectSpread({}, _this.props), {}, {
value: nextValue
})) : null;
event.persist();
_this.setStateAndCallCallbacks({
action: 'onChange',
activeStartDate: nextActiveStartDate,
value: nextValue
}, event);
});
_defineProperty(_assertThisInitialized(_this), "onClickTile", function (value, event) {
var _assertThisInitialize6 = _assertThisInitialized(_this),
view = _assertThisInitialize6.view;
var _this$props3 = _this.props,
onClickDay = _this$props3.onClickDay,
onClickDecade = _this$props3.onClickDecade,
onClickMonth = _this$props3.onClickMonth,
onClickYear = _this$props3.onClickYear;
var callback = function () {
switch (view) {
case 'century':
return onClickDecade;
case 'decade':
return onClickYear;
case 'year':
return onClickMonth;
case 'month':
return onClickDay;
default:
throw new Error("Invalid view: ".concat(view, "."));
}
}();
if (callback) callback(value, event);
});
_defineProperty(_assertThisInitialized(_this), "onMouseOver", function (value) {
_this.setState(function (prevState) {
if (prevState.hover && prevState.hover.getTime() === value.getTime()) {
return null;
}
return {
hover: value
};
});
});
_defineProperty(_assertThisInitialized(_this), "onMouseLeave", function () {
_this.setState({
hover: null
});
});
return _this;
}
_createClass(Calendar, [{
key: "activeStartDate",
get: function get() {
var activeStartDateProps = this.props.activeStartDate;
var activeStartDateState = this.state.activeStartDate;
return activeStartDateProps || activeStartDateState || getInitialActiveStartDate(this.props);
}
}, {
key: "value",
get: function get() {
var _this$props4 = this.props,
selectRange = _this$props4.selectRange,
valueProps = _this$props4.value;
var valueState = this.state.value;
// In the middle of range selection, use value from state
if (selectRange && getIsSingleValue(valueState)) {
return valueState;
}
return valueProps !== undefined ? valueProps : valueState;
}
}, {
key: "valueType",
get: function get() {
var maxDetail = this.props.maxDetail;
return getValueType(maxDetail);
}
}, {
key: "view",
get: function get() {
var _this$props5 = this.props,
minDetail = _this$props5.minDetail,
maxDetail = _this$props5.maxDetail,
viewProps = _this$props5.view;
var viewState = this.state.view;
return getView(viewProps || viewState, minDetail, maxDetail);
}
}, {
key: "views",
get: function get() {
var _this$props6 = this.props,
minDetail = _this$props6.minDetail,
maxDetail = _this$props6.maxDetail;
return getLimitedViews(minDetail, maxDetail);
}
}, {
key: "hover",
get: function get() {
var selectRange = this.props.selectRange;
var hover = this.state.hover;
return selectRange ? hover : null;
}
}, {
key: "drillDownAvailable",
get: function get() {
var view = this.view,
views = this.views;
return views.indexOf(view) < views.length - 1;
}
}, {
key: "drillUpAvailable",
get: function get() {
var view = this.view,
views = this.views;
return views.indexOf(view) > 0;
}
/**
* Gets current value in a desired format.
*/
}, {
key: "getProcessedValue",
value: function getProcessedValue(value) {
var _this$props7 = this.props,
minDate = _this$props7.minDate,
maxDate = _this$props7.maxDate,
maxDetail = _this$props7.maxDetail,
returnValue = _this$props7.returnValue;
var processFunction = function () {
switch (returnValue) {
case 'start':
return getDetailValueFrom;
case 'end':
return getDetailValueTo;
case 'range':
return getDetailValueArray;
default:
throw new Error('Invalid returnValue.');
}
}();
return processFunction({
value: value,
minDate: minDate,
maxDate: maxDate,
maxDetail: maxDetail
});
}
}, {
key: "renderContent",
value: function renderContent(next) {
var currentActiveStartDate = this.activeStartDate,
onMouseOver = this.onMouseOver,
valueType = this.valueType,
value = this.value,
view = this.view;
var _this$props8 = this.props,
calendarType = _this$props8.calendarType,
locale = _this$props8.locale,
maxDate = _this$props8.maxDate,
minDate = _this$props8.minDate,
selectRange = _this$props8.selectRange,
tileClassName = _this$props8.tileClassName,
tileContent = _this$props8.tileContent,
tileDisabled = _this$props8.tileDisabled;
var hover = this.hover;
var activeStartDate = next ? getBeginNext(view, currentActiveStartDate) : getBegin(view, currentActiveStartDate);
var onClick = this.drillDownAvailable ? this.drillDown : this.onChange;
var commonProps = {
activeStartDate: activeStartDate,
hover: hover,
locale: locale,
maxDate: maxDate,
minDate: minDate,
onClick: onClick,
onMouseOver: selectRange ? onMouseOver : null,
tileClassName: tileClassName,
tileContent: tileContent,
tileDisabled: tileDisabled,
value: value,
valueType: valueType
};
switch (view) {
case 'century':
{
var formatYear = this.props.formatYear;
return /*#__PURE__*/React.createElement(CenturyView, _extends({
formatYear: formatYear
}, commonProps));
}
case 'decade':
{
var _formatYear = this.props.formatYear;
return /*#__PURE__*/React.createElement(DecadeView, _extends({
formatYear: _formatYear
}, commonProps));
}
case 'year':
{
var _this$props9 = this.props,
formatMonth = _this$props9.formatMonth,
formatMonthYear = _this$props9.formatMonthYear;
return /*#__PURE__*/React.createElement(YearView, _extends({
formatMonth: formatMonth,
formatMonthYear: formatMonthYear
}, commonProps));
}
case 'month':
{
var _this$props10 = this.props,
formatDay = _this$props10.formatDay,
formatLongDate = _this$props10.formatLongDate,
formatShortWeekday = _this$props10.formatShortWeekday,
formatWeekday = _this$props10.formatWeekday,
onClickWeekNumber = _this$props10.onClickWeekNumber,
showDoubleView = _this$props10.showDoubleView,
showFixedNumberOfWeeks = _this$props10.showFixedNumberOfWeeks,
showNeighboringMonth = _this$props10.showNeighboringMonth,
showWeekNumbers = _this$props10.showWeekNumbers;
var onMouseLeave = this.onMouseLeave;
return /*#__PURE__*/React.createElement(MonthView, _extends({
calendarType: calendarType,
formatDay: formatDay,
formatLongDate: formatLongDate,
formatShortWeekday: formatShortWeekday,
formatWeekday: formatWeekday,
onClickWeekNumber: onClickWeekNumber,
onMouseLeave: selectRange ? onMouseLeave : null,
showFixedNumberOfWeeks: typeof showFixedNumberOfWeeks !== 'undefined' ? showFixedNumberOfWeeks : showDoubleView,
showNeighboringMonth: showNeighboringMonth,
showWeekNumbers: showWeekNumbers
}, commonProps));
}
default:
throw new Error("Invalid view: ".concat(view, "."));
}
}
}, {
key: "renderNavigation",
value: function renderNavigation() {
var showNavigation = this.props.showNavigation;
if (!showNavigation) {
return null;
}
var activeStartDate = this.activeStartDate,
view = this.view,
views = this.views;
var _this$props11 = this.props,
formatMonthYear = _this$props11.formatMonthYear,
formatYear = _this$props11.formatYear,
locale = _this$props11.locale,
maxDate = _this$props11.maxDate,
minDate = _this$props11.minDate,
navigationAriaLabel = _this$props11.navigationAriaLabel,
navigationAriaLive = _this$props11.navigationAriaLive,
navigationLabel = _this$props11.navigationLabel,
next2AriaLabel = _this$props11.next2AriaLabel,
next2Label = _this$props11.next2Label,
nextAriaLabel = _this$props11.nextAriaLabel,
nextLabel = _this$props11.nextLabel,
prev2AriaLabel = _this$props11.prev2AriaLabel,
prev2Label = _this$props11.prev2Label,
prevAriaLabel = _this$props11.prevAriaLabel,
prevLabel = _this$props11.prevLabel,
showDoubleView = _this$props11.showDoubleView;
return /*#__PURE__*/React.createElement(Navigation, {
activeStartDate: activeStartDate,
drillUp: this.drillUp,
formatMonthYear: formatMonthYear,
formatYear: formatYear,
locale: locale,
maxDate: maxDate,
minDate: minDate,
navigationAriaLabel: navigationAriaLabel,
navigationAriaLive: navigationAriaLive,
navigationLabel: navigationLabel,
next2AriaLabel: next2AriaLabel,
next2Label: next2Label,
nextAriaLabel: nextAriaLabel,
nextLabel: nextLabel,
prev2AriaLabel: prev2AriaLabel,
prev2Label: prev2Label,
prevAriaLabel: prevAriaLabel,
prevLabel: prevLabel,
setActiveStartDate: this.setActiveStartDate,
showDoubleView: showDoubleView,
view: view,
views: views
});
}
}, {
key: "render",
value: function render() {
var _this$props12 = this.props,
className = _this$props12.className,
inputRef = _this$props12.inputRef,
selectRange = _this$props12.selectRange,
showDoubleView = _this$props12.showDoubleView;
var onMouseLeave = this.onMouseLeave,
value = this.value;
var valueArray = [].concat(value);
return /*#__PURE__*/React.createElement("div", {
className: clsx(baseClassName, selectRange && valueArray.length === 1 && "".concat(baseClassName, "--selectRange"), showDoubleView && "".concat(baseClassName, "--doubleView"), className),
ref: inputRef
}, this.renderNavigation(), /*#__PURE__*/React.createElement("div", {
className: "".concat(baseClassName, "__viewContainer"),
onBlur: selectRange ? onMouseLeave : null,
onMouseLeave: selectRange ? onMouseLeave : null
}, this.renderContent(), showDoubleView && this.renderContent(true)));
}
}]);
return Calendar;
}(Component);
export { Calendar as default };
Calendar.defaultProps = {
goToRangeStartOnSelect: true,
maxDate: defaultMaxDate,
maxDetail: 'month',
minDate: defaultMinDate,
minDetail: 'century',
returnValue: 'start',
showNavigation: true,
showNeighboringMonth: true
};
var isActiveStartDate = PropTypes.instanceOf(Date);
var isLooseValue = PropTypes.oneOfType([PropTypes.string, isValue]);
Calendar.propTypes = {
activeStartDate: isActiveStartDate,
allowPartialRange: PropTypes.bool,
calendarType: isCalendarType,
className: isClassName,
defaultActiveStartDate: isActiveStartDate,
defaultValue: isLooseValue,
defaultView: isView,
formatDay: PropTypes.func,
formatLongDate: PropTypes.func,
formatMonth: PropTypes.func,
formatMonthYear: PropTypes.func,
formatShortWeekday: PropTypes.func,
formatWeekday: PropTypes.func,
formatYear: PropTypes.func,
goToRangeStartOnSelect: PropTypes.bool,
inputRef: isRef,
locale: PropTypes.string,
maxDate: isMaxDate,
maxDetail: PropTypes.oneOf(allViews),
minDate: isMinDate,
minDetail: PropTypes.oneOf(allViews),
navigationAriaLabel: PropTypes.string,
navigationAriaLive: PropTypes.oneOf(['off', 'polite', 'assertive']),
navigationLabel: PropTypes.func,
next2AriaLabel: PropTypes.string,
next2Label: PropTypes.node,
nextAriaLabel: PropTypes.string,
nextLabel: PropTypes.node,
onActiveStartDateChange: PropTypes.func,
onChange: PropTypes.func,
onClickDay: PropTypes.func,
onClickDecade: PropTypes.func,
onClickMonth: PropTypes.func,
onClickWeekNumber: PropTypes.func,
onClickYear: PropTypes.func,
onDrillDown: PropTypes.func,
onDrillUp: PropTypes.func,
onViewChange: PropTypes.func,
prev2AriaLabel: PropTypes.string,
prev2Label: PropTypes.node,
prevAriaLabel: PropTypes.string,
prevLabel: PropTypes.node,
returnValue: PropTypes.oneOf(['start', 'end', 'range']),
selectRange: PropTypes.bool,
showDoubleView: PropTypes.bool,
showFixedNumberOfWeeks: PropTypes.bool,
showNavigation: PropTypes.bool,
showNeighboringMonth: PropTypes.bool,
showWeekNumbers: PropTypes.bool,
tileClassName: PropTypes.oneOfType([PropTypes.func, isClassName]),
tileContent: PropTypes.oneOfType([PropTypes.func, PropTypes.node]),
tileDisabled: PropTypes.func,
value: isLooseValue,
view: isView
};