react-calendar
Advanced tools
Comparing version 3.2.0 to 3.2.1
@@ -15,3 +15,3 @@ function _extends() { _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; }; return _extends.apply(this, arguments); } | ||
function _createSuper(Derived) { return function () { var Super = _getPrototypeOf(Derived), result; if (_isNativeReflectConstruct()) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } | ||
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); }; } | ||
@@ -40,3 +40,3 @@ function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } | ||
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(n); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } | ||
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); } | ||
@@ -58,3 +58,3 @@ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); } | ||
import { getBegin, getBeginNext, getEnd, getValueRange } from './shared/dates'; | ||
import { isCalendarType, isClassName, isMaxDate, isMinDate, isValue, isView } from './shared/propTypes'; | ||
import { isCalendarType, isClassName, isMaxDate, isMinDate, isRef, isValue, isView } from './shared/propTypes'; | ||
import { between } from './shared/utils'; | ||
@@ -230,3 +230,3 @@ var baseClassName = 'react-calendar'; | ||
_defineProperty(_assertThisInitialized(_this), "setStateAndCallCallbacks", function (nextState, callback) { | ||
_defineProperty(_assertThisInitialized(_this), "setStateAndCallCallbacks", function (nextState, event, callback) { | ||
var _assertThisInitialize = _assertThisInitialized(_this), | ||
@@ -250,2 +250,3 @@ previousActiveStartDate = _assertThisInitialize.activeStartDate, | ||
activeStartDate: nextState.activeStartDate || _this.activeStartDate, | ||
value: nextState.value || _this.value, | ||
view: nextState.view || _this.view | ||
@@ -276,8 +277,8 @@ }; | ||
if (!isSingleValue) { | ||
onChange(nextState.value); | ||
onChange(nextState.value, event); | ||
} else if (allowPartialRange) { | ||
onChange([nextState.value]); | ||
onChange([nextState.value], event); | ||
} | ||
} else { | ||
onChange(nextState.value); | ||
onChange(nextState.value, event); | ||
} | ||
@@ -314,3 +315,3 @@ } | ||
view: nextView | ||
}, onDrillDown); | ||
}, undefined, onDrillDown); | ||
}); | ||
@@ -335,3 +336,3 @@ | ||
view: nextView | ||
}, onDrillUp); | ||
}, undefined, onDrillUp); | ||
}); | ||
@@ -365,5 +366,6 @@ | ||
var nextActiveStartDate = getActiveStartDate(_objectSpread({}, _this.props, { | ||
var nextActiveStartDate = getActiveStartDate(_objectSpread(_objectSpread({}, _this.props), {}, { | ||
value: nextValue | ||
})); | ||
event.persist(); | ||
@@ -373,3 +375,3 @@ _this.setStateAndCallCallbacks({ | ||
value: nextValue | ||
}); | ||
}, event); | ||
}); | ||
@@ -614,2 +616,3 @@ | ||
className = _this$props8.className, | ||
inputRef = _this$props8.inputRef, | ||
selectRange = _this$props8.selectRange, | ||
@@ -621,3 +624,4 @@ showDoubleView = _this$props8.showDoubleView; | ||
return /*#__PURE__*/React.createElement("div", { | ||
className: mergeClassNames(baseClassName, selectRange && valueArray.length === 1 && "".concat(baseClassName, "--selectRange"), showDoubleView && "".concat(baseClassName, "--doubleView"), className) | ||
className: mergeClassNames(baseClassName, selectRange && valueArray.length === 1 && "".concat(baseClassName, "--selectRange"), showDoubleView && "".concat(baseClassName, "--doubleView"), className), | ||
ref: inputRef | ||
}, this.renderNavigation(), /*#__PURE__*/React.createElement("div", { | ||
@@ -723,2 +727,3 @@ className: "".concat(baseClassName, "__viewContainer"), | ||
formatYear: PropTypes.func, | ||
inputRef: isRef, | ||
locale: PropTypes.string, | ||
@@ -725,0 +730,0 @@ maxDate: isMaxDate, |
@@ -144,3 +144,3 @@ import React from 'react'; | ||
type: "button" | ||
}, prev2Label), /*#__PURE__*/React.createElement("button", { | ||
}, prev2Label), prevLabel !== null && /*#__PURE__*/React.createElement("button", { | ||
"aria-label": prevAriaLabel, | ||
@@ -151,3 +151,3 @@ className: "".concat(className, "__arrow ").concat(className, "__prev-button"), | ||
type: "button" | ||
}, prevLabel), renderButton(), /*#__PURE__*/React.createElement("button", { | ||
}, prevLabel), renderButton(), nextLabel !== null && /*#__PURE__*/React.createElement("button", { | ||
"aria-label": nextAriaLabel, | ||
@@ -177,9 +177,9 @@ className: "".concat(className, "__arrow ").concat(className, "__next-button"), | ||
next2AriaLabel: PropTypes.string, | ||
next2Label: PropTypes.oneOfType([PropTypes.string, PropTypes.node]), | ||
next2Label: PropTypes.node, | ||
nextAriaLabel: PropTypes.string, | ||
nextLabel: PropTypes.oneOfType([PropTypes.string, PropTypes.node]), | ||
nextLabel: PropTypes.node, | ||
prev2AriaLabel: PropTypes.string, | ||
prev2Label: PropTypes.oneOfType([PropTypes.string, PropTypes.node]), | ||
prev2Label: PropTypes.node, | ||
prevAriaLabel: PropTypes.string, | ||
prevLabel: PropTypes.oneOfType([PropTypes.string, PropTypes.node]), | ||
prevLabel: PropTypes.node, | ||
setActiveStartDate: PropTypes.func.isRequired, | ||
@@ -186,0 +186,0 @@ showDoubleView: PropTypes.bool, |
@@ -36,4 +36,4 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } | ||
} | ||
Decade.propTypes = _objectSpread({}, tileProps, { | ||
Decade.propTypes = _objectSpread(_objectSpread({}, tileProps), {}, { | ||
formatYear: PropTypes.func | ||
}); |
@@ -35,4 +35,4 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } | ||
} | ||
Year.propTypes = _objectSpread({}, tileProps, { | ||
Year.propTypes = _objectSpread(_objectSpread({}, tileProps), {}, { | ||
formatYear: PropTypes.func | ||
}); |
@@ -38,3 +38,3 @@ function _extends() { _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; }; return _extends.apply(this, arguments); } | ||
}, otherProps), React.Children.map(children, function (child, index) { | ||
return React.cloneElement(child, _objectSpread({}, child.props, { | ||
return /*#__PURE__*/React.cloneElement(child, _objectSpread(_objectSpread({}, child.props), {}, { | ||
style: { | ||
@@ -41,0 +41,0 @@ flexBasis: toPercent(100 / count), |
@@ -38,5 +38,5 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } | ||
} | ||
Day.propTypes = _objectSpread({}, tileProps, { | ||
Day.propTypes = _objectSpread(_objectSpread({}, tileProps), {}, { | ||
currentMonthIndex: PropTypes.number.isRequired, | ||
formatLongDate: PropTypes.func | ||
}); |
@@ -7,3 +7,3 @@ var _CALENDAR_TYPE_LOCALE; | ||
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(n); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } | ||
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); } | ||
@@ -10,0 +10,0 @@ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); } |
@@ -8,2 +8,3 @@ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
export var isCalendarType = PropTypes.oneOf(calendarTypes); | ||
export var isClassName = PropTypes.oneOfType([PropTypes.string, PropTypes.arrayOf(PropTypes.string)]); | ||
export var isMinDate = function isMinDate(props, propName, componentName) { | ||
@@ -47,5 +48,8 @@ var minDate = props[propName]; | ||
}; | ||
export var isRef = PropTypes.oneOfType([PropTypes.func, PropTypes.shape({ | ||
// eslint-disable-next-line react/forbid-prop-types | ||
current: PropTypes.any | ||
})]); | ||
export var isValue = PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.arrayOf(PropTypes.instanceOf(Date))]); | ||
export var isViews = PropTypes.arrayOf(PropTypes.oneOf(allViews)); | ||
export var isClassName = PropTypes.oneOfType([PropTypes.string, PropTypes.arrayOf(PropTypes.string)]); | ||
export var isView = function isView(props, propName, componentName) { | ||
@@ -52,0 +56,0 @@ var view = props[propName]; |
@@ -5,3 +5,3 @@ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); } | ||
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(n); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } | ||
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); } | ||
@@ -8,0 +8,0 @@ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); } |
@@ -17,3 +17,3 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } | ||
function _createSuper(Derived) { return function () { var Super = _getPrototypeOf(Derived), result; if (_isNativeReflectConstruct()) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } | ||
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); }; } | ||
@@ -136,3 +136,3 @@ function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } | ||
export { Tile as default }; | ||
Tile.propTypes = _objectSpread({}, tileProps, { | ||
Tile.propTypes = _objectSpread(_objectSpread({}, tileProps), {}, { | ||
children: PropTypes.node.isRequired, | ||
@@ -139,0 +139,0 @@ formatAbbr: PropTypes.func, |
@@ -60,3 +60,3 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } | ||
} | ||
TileGroup.propTypes = _objectSpread({}, tileGroupProps, { | ||
TileGroup.propTypes = _objectSpread(_objectSpread({}, tileGroupProps), {}, { | ||
activeStartDate: PropTypes.instanceOf(Date), | ||
@@ -63,0 +63,0 @@ count: PropTypes.number, |
@@ -38,5 +38,5 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } | ||
} | ||
Month.propTypes = _objectSpread({}, tileProps, { | ||
Month.propTypes = _objectSpread(_objectSpread({}, tileProps), {}, { | ||
formatMonth: PropTypes.func, | ||
formatMonthYear: PropTypes.func | ||
}); |
@@ -31,4 +31,4 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } | ||
} | ||
Months.propTypes = _objectSpread({}, tileGroupProps, { | ||
Months.propTypes = _objectSpread(_objectSpread({}, tileGroupProps), {}, { | ||
locale: PropTypes.string | ||
}); |
@@ -50,3 +50,3 @@ "use strict"; | ||
function _createSuper(Derived) { return function () { var Super = _getPrototypeOf(Derived), result; if (_isNativeReflectConstruct()) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } | ||
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); }; } | ||
@@ -75,3 +75,3 @@ function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } | ||
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(n); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } | ||
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); } | ||
@@ -253,3 +253,3 @@ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); } | ||
_defineProperty(_assertThisInitialized(_this), "setStateAndCallCallbacks", function (nextState, callback) { | ||
_defineProperty(_assertThisInitialized(_this), "setStateAndCallCallbacks", function (nextState, event, callback) { | ||
var _assertThisInitialize = _assertThisInitialized(_this), | ||
@@ -273,2 +273,3 @@ previousActiveStartDate = _assertThisInitialize.activeStartDate, | ||
activeStartDate: nextState.activeStartDate || _this.activeStartDate, | ||
value: nextState.value || _this.value, | ||
view: nextState.view || _this.view | ||
@@ -299,8 +300,8 @@ }; | ||
if (!isSingleValue) { | ||
onChange(nextState.value); | ||
onChange(nextState.value, event); | ||
} else if (allowPartialRange) { | ||
onChange([nextState.value]); | ||
onChange([nextState.value], event); | ||
} | ||
} else { | ||
onChange(nextState.value); | ||
onChange(nextState.value, event); | ||
} | ||
@@ -337,3 +338,3 @@ } | ||
view: nextView | ||
}, onDrillDown); | ||
}, undefined, onDrillDown); | ||
}); | ||
@@ -358,3 +359,3 @@ | ||
view: nextView | ||
}, onDrillUp); | ||
}, undefined, onDrillUp); | ||
}); | ||
@@ -388,5 +389,6 @@ | ||
var nextActiveStartDate = getActiveStartDate(_objectSpread({}, _this.props, { | ||
var nextActiveStartDate = getActiveStartDate(_objectSpread(_objectSpread({}, _this.props), {}, { | ||
value: nextValue | ||
})); | ||
event.persist(); | ||
@@ -396,3 +398,3 @@ _this.setStateAndCallCallbacks({ | ||
value: nextValue | ||
}); | ||
}, event); | ||
}); | ||
@@ -637,2 +639,3 @@ | ||
className = _this$props8.className, | ||
inputRef = _this$props8.inputRef, | ||
selectRange = _this$props8.selectRange, | ||
@@ -644,3 +647,4 @@ showDoubleView = _this$props8.showDoubleView; | ||
return /*#__PURE__*/_react["default"].createElement("div", { | ||
className: (0, _mergeClassNames["default"])(baseClassName, selectRange && valueArray.length === 1 && "".concat(baseClassName, "--selectRange"), showDoubleView && "".concat(baseClassName, "--doubleView"), className) | ||
className: (0, _mergeClassNames["default"])(baseClassName, selectRange && valueArray.length === 1 && "".concat(baseClassName, "--selectRange"), showDoubleView && "".concat(baseClassName, "--doubleView"), className), | ||
ref: inputRef | ||
}, this.renderNavigation(), /*#__PURE__*/_react["default"].createElement("div", { | ||
@@ -749,2 +753,3 @@ className: "".concat(baseClassName, "__viewContainer"), | ||
formatYear: _propTypes["default"].func, | ||
inputRef: _propTypes2.isRef, | ||
locale: _propTypes["default"].string, | ||
@@ -751,0 +756,0 @@ maxDate: _propTypes2.isMaxDate, |
@@ -160,3 +160,3 @@ "use strict"; | ||
type: "button" | ||
}, prev2Label), /*#__PURE__*/_react["default"].createElement("button", { | ||
}, prev2Label), prevLabel !== null && /*#__PURE__*/_react["default"].createElement("button", { | ||
"aria-label": prevAriaLabel, | ||
@@ -167,3 +167,3 @@ className: "".concat(className, "__arrow ").concat(className, "__prev-button"), | ||
type: "button" | ||
}, prevLabel), renderButton(), /*#__PURE__*/_react["default"].createElement("button", { | ||
}, prevLabel), renderButton(), nextLabel !== null && /*#__PURE__*/_react["default"].createElement("button", { | ||
"aria-label": nextAriaLabel, | ||
@@ -194,9 +194,9 @@ className: "".concat(className, "__arrow ").concat(className, "__next-button"), | ||
next2AriaLabel: _propTypes["default"].string, | ||
next2Label: _propTypes["default"].oneOfType([_propTypes["default"].string, _propTypes["default"].node]), | ||
next2Label: _propTypes["default"].node, | ||
nextAriaLabel: _propTypes["default"].string, | ||
nextLabel: _propTypes["default"].oneOfType([_propTypes["default"].string, _propTypes["default"].node]), | ||
nextLabel: _propTypes["default"].node, | ||
prev2AriaLabel: _propTypes["default"].string, | ||
prev2Label: _propTypes["default"].oneOfType([_propTypes["default"].string, _propTypes["default"].node]), | ||
prev2Label: _propTypes["default"].node, | ||
prevAriaLabel: _propTypes["default"].string, | ||
prevLabel: _propTypes["default"].oneOfType([_propTypes["default"].string, _propTypes["default"].node]), | ||
prevLabel: _propTypes["default"].node, | ||
setActiveStartDate: _propTypes["default"].func.isRequired, | ||
@@ -203,0 +203,0 @@ showDoubleView: _propTypes["default"].bool, |
@@ -54,4 +54,4 @@ "use strict"; | ||
Decade.propTypes = _objectSpread({}, _propTypes2.tileProps, { | ||
Decade.propTypes = _objectSpread(_objectSpread({}, _propTypes2.tileProps), {}, { | ||
formatYear: _propTypes["default"].func | ||
}); |
@@ -52,4 +52,4 @@ "use strict"; | ||
Year.propTypes = _objectSpread({}, _propTypes2.tileProps, { | ||
Year.propTypes = _objectSpread(_objectSpread({}, _propTypes2.tileProps), {}, { | ||
formatYear: _propTypes["default"].func | ||
}); |
@@ -48,3 +48,3 @@ "use strict"; | ||
}, otherProps), _react["default"].Children.map(children, function (child, index) { | ||
return _react["default"].cloneElement(child, _objectSpread({}, child.props, { | ||
return /*#__PURE__*/_react["default"].cloneElement(child, _objectSpread(_objectSpread({}, child.props), {}, { | ||
style: { | ||
@@ -51,0 +51,0 @@ flexBasis: toPercent(100 / count), |
@@ -56,5 +56,5 @@ "use strict"; | ||
Day.propTypes = _objectSpread({}, _propTypes2.tileProps, { | ||
Day.propTypes = _objectSpread(_objectSpread({}, _propTypes2.tileProps), {}, { | ||
currentMonthIndex: _propTypes["default"].number.isRequired, | ||
formatLongDate: _propTypes["default"].func | ||
}); |
@@ -14,3 +14,3 @@ "use strict"; | ||
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(n); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } | ||
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); } | ||
@@ -17,0 +17,0 @@ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); } |
@@ -6,3 +6,3 @@ "use strict"; | ||
}); | ||
exports.tileProps = exports.tileGroupProps = exports.isView = exports.isClassName = exports.isViews = exports.isValue = exports.isMaxDate = exports.isMinDate = exports.isCalendarType = void 0; | ||
exports.tileProps = exports.tileGroupProps = exports.isView = exports.isViews = exports.isValue = exports.isRef = exports.isMaxDate = exports.isMinDate = exports.isClassName = exports.isCalendarType = void 0; | ||
@@ -24,2 +24,6 @@ var _propTypes = _interopRequireDefault(require("prop-types")); | ||
var isClassName = _propTypes["default"].oneOfType([_propTypes["default"].string, _propTypes["default"].arrayOf(_propTypes["default"].string)]); | ||
exports.isClassName = isClassName; | ||
var isMinDate = function isMinDate(props, propName, componentName) { | ||
@@ -69,2 +73,9 @@ var minDate = props[propName]; | ||
var isRef = _propTypes["default"].oneOfType([_propTypes["default"].func, _propTypes["default"].shape({ | ||
// eslint-disable-next-line react/forbid-prop-types | ||
current: _propTypes["default"].any | ||
})]); | ||
exports.isRef = isRef; | ||
var isValue = _propTypes["default"].oneOfType([_propTypes["default"].instanceOf(Date), _propTypes["default"].arrayOf(_propTypes["default"].instanceOf(Date))]); | ||
@@ -78,6 +89,2 @@ | ||
var isClassName = _propTypes["default"].oneOfType([_propTypes["default"].string, _propTypes["default"].arrayOf(_propTypes["default"].string)]); | ||
exports.isClassName = isClassName; | ||
var isView = function isView(props, propName, componentName) { | ||
@@ -84,0 +91,0 @@ var view = props[propName]; |
@@ -18,3 +18,3 @@ "use strict"; | ||
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(n); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } | ||
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); } | ||
@@ -21,0 +21,0 @@ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); } |
@@ -38,3 +38,3 @@ "use strict"; | ||
function _createSuper(Derived) { return function () { var Super = _getPrototypeOf(Derived), result; if (_isNativeReflectConstruct()) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } | ||
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); }; } | ||
@@ -152,3 +152,3 @@ function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } | ||
exports["default"] = Tile; | ||
Tile.propTypes = _objectSpread({}, _propTypes2.tileProps, { | ||
Tile.propTypes = _objectSpread(_objectSpread({}, _propTypes2.tileProps), {}, { | ||
children: _propTypes["default"].node.isRequired, | ||
@@ -155,0 +155,0 @@ formatAbbr: _propTypes["default"].func, |
@@ -75,3 +75,3 @@ "use strict"; | ||
TileGroup.propTypes = _objectSpread({}, _propTypes2.tileGroupProps, { | ||
TileGroup.propTypes = _objectSpread(_objectSpread({}, _propTypes2.tileGroupProps), {}, { | ||
activeStartDate: _propTypes["default"].instanceOf(Date), | ||
@@ -78,0 +78,0 @@ count: _propTypes["default"].number, |
@@ -55,5 +55,5 @@ "use strict"; | ||
Month.propTypes = _objectSpread({}, _propTypes2.tileProps, { | ||
Month.propTypes = _objectSpread(_objectSpread({}, _propTypes2.tileProps), {}, { | ||
formatMonth: _propTypes["default"].func, | ||
formatMonthYear: _propTypes["default"].func | ||
}); |
@@ -47,4 +47,4 @@ "use strict"; | ||
Months.propTypes = _objectSpread({}, _propTypes2.tileGroupProps, { | ||
Months.propTypes = _objectSpread(_objectSpread({}, _propTypes2.tileGroupProps), {}, { | ||
locale: _propTypes["default"].string | ||
}); |
{ | ||
"name": "react-calendar", | ||
"version": "3.2.0", | ||
"version": "3.2.1", | ||
"description": "Ultimate calendar for your React app.", | ||
@@ -15,4 +15,4 @@ "main": "dist/umd/index.js", | ||
"build-js-all": "yarn build-js-esm && yarn build-js-umd", | ||
"build-js-esm": "cross-env BABEL_ENV=production-esm babel src -d dist/esm --ignore \"**/*.spec.js,**/*.spec.jsx\"", | ||
"build-js-umd": "cross-env BABEL_ENV=production-umd babel src -d dist/umd --ignore \"**/*.spec.js,**/*.spec.jsx\"", | ||
"build-js-esm": "BABEL_ENV=production-esm babel src -d dist/esm --ignore \"**/*.spec.js,**/*.spec.jsx\"", | ||
"build-js-umd": "BABEL_ENV=production-umd babel src -d dist/umd --ignore \"**/*.spec.js,**/*.spec.jsx\"", | ||
"build-styles": "lessc ./dist/Calendar.less ./dist/Calendar.css", | ||
@@ -24,3 +24,3 @@ "clean": "rimraf dist", | ||
"lint": "eslint sample/ src/ test/ --ext .jsx,.js", | ||
"prepublishOnly": "yarn clean && yarn build", | ||
"prepack": "yarn clean && yarn build", | ||
"test": "yarn lint && yarn jest" | ||
@@ -93,11 +93,6 @@ }, | ||
"babel-eslint": "^10.0.0", | ||
"cross-env": "^7.0.0", | ||
"enzyme": "^3.10.0", | ||
"enzyme-adapter-react-16": "^1.14.0", | ||
"eslint": "~7.2.0", | ||
"eslint-config-airbnb": "^18.2.0", | ||
"eslint-plugin-import": "^2.21.2", | ||
"eslint-plugin-jsx-a11y": "^6.3.0", | ||
"eslint-plugin-react": "^7.20.0", | ||
"eslint-plugin-react-hooks": "^4.0.0", | ||
"eslint": "^7.12.0", | ||
"eslint-config-wojtekmaj": "^0.5.0", | ||
"jest": "^26.0.0", | ||
@@ -104,0 +99,0 @@ "less": "^3.8.1", |
@@ -1,2 +0,2 @@ | ||
[![npm](https://img.shields.io/npm/v/react-calendar.svg)](https://www.npmjs.com/package/react-calendar) ![downloads](https://img.shields.io/npm/dt/react-calendar.svg) [![build](https://travis-ci.com/wojtekmaj/react-calendar.svg?branch=master)](https://travis-ci.com/wojtekmaj/react-calendar) ![dependencies](https://img.shields.io/david/wojtekmaj/react-calendar.svg) ![dev dependencies](https://img.shields.io/david/dev/wojtekmaj/react-calendar.svg) [![tested with jest](https://img.shields.io/badge/tested_with-jest-99424f.svg)](https://github.com/facebook/jest) | ||
[![npm](https://img.shields.io/npm/v/react-calendar.svg)](https://www.npmjs.com/package/react-calendar) ![downloads](https://img.shields.io/npm/dt/react-calendar.svg) [![CI](https://github.com/wojtekmaj/react-calendar/workflows/CI/badge.svg)](https://github.com/wojtekmaj/react-calendar/actions) ![dependencies](https://img.shields.io/david/wojtekmaj/react-calendar.svg) ![dev dependencies](https://img.shields.io/david/dev/wojtekmaj/react-calendar.svg) [![tested with jest](https://img.shields.io/badge/tested_with-jest-99424f.svg)](https://github.com/facebook/jest) | ||
@@ -3,0 +3,0 @@ # React-Calendar |
@@ -93,5 +93,5 @@ import React, { Component } from 'react'; | ||
const getDetailValueFrom = args => getDetailValue(args, 0); | ||
const getDetailValueFrom = (args) => getDetailValue(args, 0); | ||
const getDetailValueTo = args => getDetailValue(args, 1); | ||
const getDetailValueTo = (args) => getDetailValue(args, 1); | ||
@@ -105,3 +105,3 @@ const getDetailValueArray = (args) => { | ||
return [getDetailValueFrom, getDetailValueTo].map(fn => fn(args)); | ||
return [getDetailValueFrom, getDetailValueTo].map((fn) => fn(args)); | ||
}; | ||
@@ -159,3 +159,3 @@ | ||
const getIsSingleValue = value => value && [].concat(value).length === 1; | ||
const getIsSingleValue = (value) => value && [].concat(value).length === 1; | ||
@@ -162,0 +162,0 @@ export default class Calendar extends Component { |
@@ -18,3 +18,3 @@ import React from 'react'; | ||
className="react-calendar__decade-view__years" | ||
dateTransform={year => new Date(year, 0, 1)} | ||
dateTransform={(year) => new Date(year, 0, 1)} | ||
dateType="year" | ||
@@ -21,0 +21,0 @@ end={end} |
@@ -82,5 +82,5 @@ import React from 'react'; | ||
children.forEach(child => expect(parseFloat(child.prop('style').flexBasis)).toBeCloseTo(33.33)); | ||
children.forEach((child) => expect(parseFloat(child.prop('style').flexBasis)).toBeCloseTo(33.33)); | ||
expect(parseFloat(children.first().prop('style').marginLeft)).toBeCloseTo(33.33); | ||
}); | ||
}); |
@@ -14,3 +14,3 @@ import React from 'react'; | ||
Object.keys(CALENDAR_TYPE_LOCALES) | ||
.find(calendarType => CALENDAR_TYPE_LOCALES[calendarType].includes(locale)) | ||
.find((calendarType) => CALENDAR_TYPE_LOCALES[calendarType].includes(locale)) | ||
|| CALENDAR_TYPES.ISO_8601 | ||
@@ -17,0 +17,0 @@ ); |
@@ -25,3 +25,3 @@ import React from 'react'; | ||
{...props} | ||
onClick={event => onClickWeekNumber(weekNumber, date, event)} | ||
onClick={(event) => onClickWeekNumber(weekNumber, date, event)} | ||
type="button" | ||
@@ -28,0 +28,0 @@ > |
@@ -55,3 +55,3 @@ import React from 'react'; | ||
const weekNumbers = dates.map(date => getWeekNumber(date, calendarType)); | ||
const weekNumbers = dates.map((date) => getWeekNumber(date, calendarType)); | ||
@@ -58,0 +58,0 @@ return ( |
@@ -256,3 +256,3 @@ import { | ||
return dates | ||
.map(date => formatYear(locale, date)) | ||
.map((date) => formatYear(locale, date)) | ||
.join(' – '); | ||
@@ -259,0 +259,0 @@ } |
@@ -58,2 +58,3 @@ import PropTypes from 'prop-types'; | ||
PropTypes.shape({ | ||
// eslint-disable-next-line react/forbid-prop-types | ||
current: PropTypes.any, | ||
@@ -77,3 +78,3 @@ }), | ||
if (view !== undefined && allowedViews.indexOf(view) === -1) { | ||
return new Error(`Invalid prop \`${propName}\` of value \`${view}\` supplied to \`${componentName}\`, expected one of [${allowedViews.map(a => `"${a}"`).join(', ')}].`); | ||
return new Error(`Invalid prop \`${propName}\` of value \`${view}\` supplied to \`${componentName}\`, expected one of [${allowedViews.map((a) => `"${a}"`).join(', ')}].`); | ||
} | ||
@@ -80,0 +81,0 @@ |
@@ -64,3 +64,3 @@ import React, { Component } from 'react'; | ||
} | ||
onClick={onClick && (event => onClick(date, event))} | ||
onClick={onClick && ((event) => onClick(date, event))} | ||
onFocus={onMouseOver && (() => onMouseOver(date))} | ||
@@ -67,0 +67,0 @@ onMouseOver={onMouseOver && (() => onMouseOver(date))} |
@@ -12,4 +12,4 @@ import React from 'react'; | ||
date: new Date(2019, 0, 1), | ||
maxDateTransform: date => date, | ||
minDateTransform: date => date, | ||
maxDateTransform: (date) => date, | ||
minDateTransform: (date) => date, | ||
}; | ||
@@ -16,0 +16,0 @@ |
@@ -20,3 +20,3 @@ import React from 'react'; | ||
className="react-calendar__year-view__months" | ||
dateTransform={monthIndex => new Date(year, monthIndex, 1)} | ||
dateTransform={(monthIndex) => new Date(year, monthIndex, 1)} | ||
dateType="month" | ||
@@ -23,0 +23,0 @@ end={end} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
464029
16
10663