Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-date-picker

Package Overview
Dependencies
Maintainers
1
Versions
259
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-date-picker - npm Package Compare versions

Comparing version 8.3.2 to 8.3.3

176

dist/DateInput.js
"use strict";
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); }
Object.defineProperty(exports, "__esModule", {

@@ -36,8 +38,6 @@ value: true

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
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); }
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); }

@@ -49,3 +49,3 @@

function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }

@@ -66,7 +66,7 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }

function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
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 { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
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; } }

@@ -83,3 +83,3 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }

function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); }
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }

@@ -474,7 +474,26 @@ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }

_createClass(DateInput, [{
key: "getProcessedValue",
key: "formatDate",
get: function get() {
var maxDetail = this.props.maxDetail;
var options = {
year: 'numeric'
};
var level = allViews.indexOf(maxDetail);
if (level >= 2) {
options.month = 'numeric';
}
if (level >= 3) {
options.day = 'numeric';
}
return (0, _dateFormatter.getFormatter)(options);
}
/**
* Gets current value in a desired format.
*/
}, {
key: "getProcessedValue",
value: function getProcessedValue(value) {

@@ -511,71 +530,2 @@ var _this$props4 = this.props,

}, {
key: "renderCustomInputs",
value: function renderCustomInputs() {
var placeholder = this.placeholder;
var format = this.props.format;
var elementFunctions = {
d: this.renderDay,
M: this.renderMonth,
y: this.renderYear
};
var allowMultipleInstances = typeof format !== 'undefined';
return _renderCustomInputs(placeholder, elementFunctions, allowMultipleInstances);
}
}, {
key: "renderNativeInput",
value: function renderNativeInput() {
var _this$props5 = this.props,
disabled = _this$props5.disabled,
maxDate = _this$props5.maxDate,
minDate = _this$props5.minDate,
name = _this$props5.name,
nativeInputAriaLabel = _this$props5.nativeInputAriaLabel,
required = _this$props5.required;
var value = this.state.value;
return /*#__PURE__*/_react["default"].createElement(_NativeInput["default"], {
key: "date",
ariaLabel: nativeInputAriaLabel,
disabled: disabled,
maxDate: maxDate || defaultMaxDate,
minDate: minDate || defaultMinDate,
name: name,
onChange: this.onChangeNative,
required: required,
value: value,
valueType: this.valueType
});
}
}, {
key: "render",
value: function render() {
var className = this.props.className;
/* eslint-disable jsx-a11y/click-events-have-key-events */
/* eslint-disable jsx-a11y/no-static-element-interactions */
return /*#__PURE__*/_react["default"].createElement("div", {
className: className,
onClick: this.onClick
}, this.renderNativeInput(), this.renderCustomInputs());
}
}, {
key: "formatDate",
get: function get() {
var maxDetail = this.props.maxDetail;
var options = {
year: 'numeric'
};
var level = allViews.indexOf(maxDetail);
if (level >= 2) {
options.month = 'numeric';
}
if (level >= 3) {
options.day = 'numeric';
}
return (0, _dateFormatter.getFormatter)(options);
}
}, {
key: "divider",

@@ -589,5 +539,5 @@ get: function get() {

get: function get() {
var _this$props6 = this.props,
format = _this$props6.format,
locale = _this$props6.locale;
var _this$props5 = this.props,
format = _this$props5.format,
locale = _this$props5.locale;

@@ -623,9 +573,9 @@ if (format) {

get: function get() {
var _this$props7 = this.props,
className = _this$props7.className,
disabled = _this$props7.disabled,
isCalendarOpen = _this$props7.isCalendarOpen,
maxDate = _this$props7.maxDate,
minDate = _this$props7.minDate,
required = _this$props7.required;
var _this$props6 = this.props,
className = _this$props6.className,
disabled = _this$props6.disabled,
isCalendarOpen = _this$props6.isCalendarOpen,
maxDate = _this$props6.maxDate,
minDate = _this$props6.minDate,
required = _this$props6.required;
return {

@@ -649,2 +599,52 @@ className: className,

}
}, {
key: "renderCustomInputs",
value: function renderCustomInputs() {
var placeholder = this.placeholder;
var format = this.props.format;
var elementFunctions = {
d: this.renderDay,
M: this.renderMonth,
y: this.renderYear
};
var allowMultipleInstances = typeof format !== 'undefined';
return _renderCustomInputs(placeholder, elementFunctions, allowMultipleInstances);
}
}, {
key: "renderNativeInput",
value: function renderNativeInput() {
var _this$props7 = this.props,
disabled = _this$props7.disabled,
maxDate = _this$props7.maxDate,
minDate = _this$props7.minDate,
name = _this$props7.name,
nativeInputAriaLabel = _this$props7.nativeInputAriaLabel,
required = _this$props7.required;
var value = this.state.value;
return /*#__PURE__*/_react["default"].createElement(_NativeInput["default"], {
key: "date",
ariaLabel: nativeInputAriaLabel,
disabled: disabled,
maxDate: maxDate || defaultMaxDate,
minDate: minDate || defaultMinDate,
name: name,
onChange: this.onChangeNative,
required: required,
value: value,
valueType: this.valueType
});
}
}, {
key: "render",
value: function render() {
var className = this.props.className;
/* eslint-disable jsx-a11y/click-events-have-key-events */
/* eslint-disable jsx-a11y/no-static-element-interactions */
return /*#__PURE__*/_react["default"].createElement("div", {
className: className,
onClick: this.onClick
}, this.renderNativeInput(), this.renderCustomInputs());
}
}], [{

@@ -651,0 +651,0 @@ key: "getDerivedStateFromProps",

@@ -20,2 +20,4 @@ "use strict";

var _excluded = ["maxDate", "minDate", "month", "year"];
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }

@@ -34,3 +36,3 @@

year = _ref.year,
otherProps = _objectWithoutProperties(_ref, ["maxDate", "minDate", "month", "year"]);
otherProps = _objectWithoutProperties(_ref, _excluded);

@@ -37,0 +39,0 @@ var currentMonthMaxDays = function () {

@@ -22,5 +22,5 @@ "use strict";

function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

@@ -30,3 +30,3 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }

/* eslint-disable jsx-a11y/no-autofocus */
var isEdgeLegacy = typeof window !== 'undefined' && 'navigator' in window && navigator.userAgent.match(/ Edge\/1/);
var isIEOrEdgeLegacy = typeof window !== 'undefined' && /(MSIE|Trident\/|Edge\/)/.test(window.navigator.userAgent);

@@ -36,3 +36,3 @@ function onFocus(event) {

if (isEdgeLegacy) {
if (isIEOrEdgeLegacy) {
requestAnimationFrame(function () {

@@ -70,8 +70,16 @@ return target.select();

function getSelectionString() {
if (typeof window === 'undefined') {
return null;
function getSelectionString(input) {
/**
* window.getSelection().toString() returns empty string in IE11 and Firefox,
* so alternatives come first.
*/
if (input && 'selectionStart' in input && input.selectionStart !== null) {
return input.value.slice(input.selectionStart, input.selectionEnd);
}
return window.getSelection().toString();
if ('getSelection' in window) {
return window.getSelection().toString();
}
return null;
}

@@ -89,3 +97,3 @@

var isNumberKey = !isNaN(parseInt(key, 10));
var selection = getSelectionString();
var selection = getSelectionString(input);

@@ -92,0 +100,0 @@ if (isNumberKey && (selection || value.length < maxLength)) {

@@ -20,2 +20,4 @@ "use strict";

var _excluded = ["maxDate", "minDate", "year"];
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }

@@ -33,3 +35,3 @@

year = _ref.year,
otherProps = _objectWithoutProperties(_ref, ["maxDate", "minDate", "year"]);
otherProps = _objectWithoutProperties(_ref, _excluded);

@@ -36,0 +38,0 @@ function isSameYear(date) {

@@ -22,2 +22,4 @@ "use strict";

var _excluded = ["ariaLabel", "className", "inputRef", "locale", "maxDate", "minDate", "placeholder", "short", "value", "year"];
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }

@@ -33,3 +35,3 @@

function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); }
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }

@@ -56,3 +58,3 @@ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }

year = _ref.year,
otherProps = _objectWithoutProperties(_ref, ["ariaLabel", "className", "inputRef", "locale", "maxDate", "minDate", "placeholder", "short", "value", "year"]);
otherProps = _objectWithoutProperties(_ref, _excluded);

@@ -76,2 +78,3 @@ function isSameYear(date) {

"data-input": "true",
"data-select": "true",
name: name,

@@ -78,0 +81,0 @@ ref: inputRef,

@@ -20,2 +20,4 @@ "use strict";

var _excluded = ["maxDate", "minDate", "placeholder", "valueType"];
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }

@@ -35,3 +37,3 @@

valueType = _ref.valueType,
otherProps = _objectWithoutProperties(_ref, ["maxDate", "minDate", "placeholder", "valueType"]);
otherProps = _objectWithoutProperties(_ref, _excluded);

@@ -38,0 +40,0 @@ var maxYear = (0, _utils.safeMin)(275760, maxDate && (0, _dateUtils.getYear)(maxDate));

"use strict";
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); }
Object.defineProperty(exports, "__esModule", {

@@ -24,10 +26,10 @@ value: true

var _excluded = ["calendarClassName", "className", "onChange", "value"];
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
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); }
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; }

@@ -47,3 +49,3 @@

function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }

@@ -64,7 +66,7 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }

function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
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 { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
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; } }

@@ -135,2 +137,6 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }

if (openCalendarOnFocus) {
if (event.target.getAttribute('data-select') === 'true') {
return;
}
_this.openCalendar();

@@ -202,2 +208,7 @@ }

}, {
key: "eventProps",
get: function get() {
return (0, _makeEventProps["default"])(this.props);
}
}, {
key: "handleOutsideActionListeners",

@@ -309,3 +320,3 @@ value: function handleOutsideActionListeners(shouldListen) {

value = _this$props4.value,
calendarProps = _objectWithoutProperties(_this$props4, ["calendarClassName", "className", "onChange", "value"]);
calendarProps = _objectWithoutProperties(_this$props4, _excluded);

@@ -343,7 +354,2 @@ var className = "".concat(baseClassName, "__calendar");

}
}, {
key: "eventProps",
get: function get() {
return (0, _makeEventProps["default"])(this.props);
}
}], [{

@@ -350,0 +356,0 @@ key: "getDerivedStateFromProps",

@@ -20,3 +20,3 @@ "use strict";

function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); }
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }

@@ -23,0 +23,0 @@ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }

@@ -16,3 +16,3 @@ "use strict";

function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); }
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }

@@ -19,0 +19,0 @@ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }

{
"name": "react-date-picker",
"version": "8.3.2",
"version": "8.3.3",
"description": "A date picker for your React app.",

@@ -21,15 +21,2 @@ "main": "dist/entry.js",

},
"jest": {
"setupFiles": [
"<rootDir>/jest.setup.js"
],
"collectCoverageFrom": [
"**/src/**.{js,jsx}",
"!**/src/entry.js",
"!**/src/entry.nostyle.js"
],
"testPathIgnorePatterns": [
"utils.js"
]
},
"keywords": [

@@ -92,7 +79,6 @@ "calendar",

"devDependencies": {
"@babel/cli": "^7.8.0",
"@babel/core": "^7.9.0",
"@babel/plugin-proposal-class-properties": "^7.8.0",
"@babel/preset-env": "^7.9.0",
"@babel/preset-react": "^7.9.0",
"@babel/cli": "^7.15.0",
"@babel/core": "^7.15.0",
"@babel/preset-env": "^7.15.0",
"@babel/preset-react": "^7.14.0",
"@wojtekmaj/enzyme-adapter-react-17": "^0.6.0",

@@ -103,3 +89,3 @@ "babel-eslint": "^10.0.0",

"eslint-config-wojtekmaj": "^0.5.0",
"jest": "^26.6.0",
"jest": "^27.0.0",
"less": "^4.0.0",

@@ -106,0 +92,0 @@ "react": "^17.0.0",

@@ -11,6 +11,5 @@ import React from 'react';

const isEdgeLegacy = (
const isIEOrEdgeLegacy = (
typeof window !== 'undefined'
&& 'navigator' in window
&& navigator.userAgent.match(/ Edge\/1/)
&& /(MSIE|Trident\/|Edge\/)/.test(window.navigator.userAgent)
);

@@ -21,3 +20,3 @@

if (isEdgeLegacy) {
if (isIEOrEdgeLegacy) {
requestAnimationFrame(() => target.select());

@@ -53,8 +52,16 @@ } else {

function getSelectionString() {
if (typeof window === 'undefined') {
return null;
function getSelectionString(input) {
/**
* window.getSelection().toString() returns empty string in IE11 and Firefox,
* so alternatives come first.
*/
if (input && 'selectionStart' in input && input.selectionStart !== null) {
return input.value.slice(input.selectionStart, input.selectionEnd);
}
return window.getSelection().toString();
if ('getSelection' in window) {
return window.getSelection().toString();
}
return null;
}

@@ -72,3 +79,3 @@

const isNumberKey = !isNaN(parseInt(key, 10));
const selection = getSelectionString();
const selection = getSelectionString(input);

@@ -75,0 +82,0 @@ if (isNumberKey && (selection || value.length < maxLength)) {

@@ -41,2 +41,3 @@ import React from 'react';

data-input="true"
data-select="true"
name={name}

@@ -43,0 +44,0 @@ ref={inputRef}

@@ -87,2 +87,6 @@ import React, { PureComponent } from 'react';

if (openCalendarOnFocus) {
if (event.target.getAttribute('data-select') === 'true') {
return;
}
this.openCalendar();

@@ -89,0 +93,0 @@ }

@@ -303,2 +303,20 @@ import React from 'react';

});
it('does not open Calendar component when focusing on a select element', () => {
const component = mount(
<DatePicker format="dd.MMMM.yyyy" />,
);
const calendar = component.find('Calendar');
const select = component.find('select[name="month"]');
expect(calendar).toHaveLength(0);
select.simulate('focus');
component.update();
const calendar2 = component.find('Calendar');
expect(calendar2).toHaveLength(0);
});
});

@@ -305,0 +323,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc