@commercetools-uikit/date-time-input 12.2.1 → 12.2.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -11,7 +11,6 @@ var _forEachInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/in
|
|
|
11
11
|
var _Object$getOwnPropertyDescriptors = require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors');
|
|
12
12
|
var _Object$defineProperties = require('@babel/runtime-corejs3/core-js-stable/object/define-properties');
|
|
13
13
|
var _Object$defineProperty = require('@babel/runtime-corejs3/core-js-stable/object/define-property');
|
|
14
|
-
var _extends = require('@babel/runtime-corejs3/helpers/extends');
|
|
15
14
|
var _defineProperty = require('@babel/runtime-corejs3/helpers/defineProperty');
|
|
16
15
|
var _classCallCheck = require('@babel/runtime-corejs3/helpers/classCallCheck');
|
|
17
16
|
var _createClass = require('@babel/runtime-corejs3/helpers/createClass');
|
|
@@ -22,7 +21,7 @@ var _concatInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/ins
|
|
|
22
21
|
var _includesInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/includes');
|
|
23
22
|
var _fillInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/fill');
|
|
24
23
|
var _mapInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/map');
|
|
25
|
-
var
|
|
24
|
+
var react$1 = require('react');
|
|
26
25
|
var PropTypes = require('prop-types');
|
|
27
26
|
var Downshift = require('downshift');
|
|
28
27
|
var reactIntl = require('react-intl');
|
|
@@ -32,6 +31,7 @@ var calendarTimeUtils = require('@commercetools-uikit/calendar-time-utils');
|
|
|
32
31
|
var calendarUtils = require('@commercetools-uikit/calendar-utils');
|
|
33
32
|
var react = require('@emotion/react');
|
|
34
33
|
var designSystem = require('@commercetools-uikit/design-system');
|
|
34
|
+
var jsxRuntime = require('@emotion/react/jsx-runtime');
|
|
35
35
|
|
|
36
36
|
function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
|
|
37
37
|
|
|
@@ -48,17 +48,16 @@ var _concatInstanceProperty__default = /*#__PURE__*/_interopDefault(_concatInsta
|
|
|
48
48
|
var _includesInstanceProperty__default = /*#__PURE__*/_interopDefault(_includesInstanceProperty);
|
|
49
49
|
var _fillInstanceProperty__default = /*#__PURE__*/_interopDefault(_fillInstanceProperty);
|
|
50
50
|
var _mapInstanceProperty__default = /*#__PURE__*/_interopDefault(_mapInstanceProperty);
|
|
51
|
-
var React__default = /*#__PURE__*/_interopDefault(React);
|
|
52
51
|
var PropTypes__default = /*#__PURE__*/_interopDefault(PropTypes);
|
|
53
52
|
var Downshift__default = /*#__PURE__*/_interopDefault(Downshift);
|
|
54
53
|
var Constraints__default = /*#__PURE__*/_interopDefault(Constraints);
|
|
55
54
|
|
|
56
55
|
var getInputStyles = function getInputStyles() {
|
|
57
|
-
return /*#__PURE__*/react.css("width:100%;text-align:center;border:0;border-top:1px solid ", designSystem.customProperties.colorNeutral90, ";padding:10px 0;outline:0;font-size:", designSystem.customProperties.fontSizeDefault, ";margin-top:", designSystem.customProperties.spacingS, ";color:", designSystem.customProperties.colorSolid, ";:disabled{background-color:", designSystem.customProperties.colorSurface, ";}" + (process.env.NODE_ENV === "production" ? "" : ";label:getInputStyles;"));
|
|
56
|
+
return /*#__PURE__*/react.css("width:100%;text-align:center;border:0;border-top:1px solid ", designSystem.customProperties.colorNeutral90, ";padding:10px 0;outline:0;font-size:", designSystem.customProperties.fontSizeDefault, ";margin-top:", designSystem.customProperties.spacingS, ";color:", designSystem.customProperties.colorSolid, ";:disabled{background-color:", designSystem.customProperties.colorSurface, ";}" + (process.env.NODE_ENV === "production" ? "" : ";label:getInputStyles;"), process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInRpbWUtaW5wdXQuanMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBSWdDIiwiZmlsZSI6InRpbWUtaW5wdXQuanMiLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgUHJvcFR5cGVzIGZyb20gJ3Byb3AtdHlwZXMnO1xuaW1wb3J0IHsgY3NzIH0gZnJvbSAnQGVtb3Rpb24vcmVhY3QnO1xuaW1wb3J0IHsgY3VzdG9tUHJvcGVydGllcyBhcyB2YXJzIH0gZnJvbSAnQGNvbW1lcmNldG9vbHMtdWlraXQvZGVzaWduLXN5c3RlbSc7XG5cbmNvbnN0IGdldElucHV0U3R5bGVzID0gKCkgPT4gY3NzYFxuICB3aWR0aDogMTAwJTtcbiAgdGV4dC1hbGlnbjogY2VudGVyO1xuICBib3JkZXI6IDA7XG4gIGJvcmRlci10b3A6IDFweCBzb2xpZCAke3ZhcnMuY29sb3JOZXV0cmFsOTB9O1xuICBwYWRkaW5nOiAxMHB4IDA7XG4gIG91dGxpbmU6IDA7XG4gIGZvbnQtc2l6ZTogJHt2YXJzLmZvbnRTaXplRGVmYXVsdH07XG4gIG1hcmdpbi10b3A6ICR7dmFycy5zcGFjaW5nU307XG4gIGNvbG9yOiAke3ZhcnMuY29sb3JTb2xpZH07XG5cbiAgOmRpc2FibGVkIHtcbiAgICAvKiBGaXhlcyBiYWNrZ3JvdW5kIGNvbG9yIGluIEZpcmVmb3ggKi9cbiAgICBiYWNrZ3JvdW5kLWNvbG9yOiAke3ZhcnMuY29sb3JTdXJmYWNlfTtcbiAgfVxuYDtcbmNvbnN0IERhdGVDYWxlbmRhclRpbWVJbnB1dCA9IChwcm9wcykgPT4gKFxuICA8aW5wdXRcbiAgICBkaXNhYmxlZD17cHJvcHMuaXNEaXNhYmxlZH1cbiAgICByZWY9e3Byb3BzLnRpbWVJbnB1dFJlZn1cbiAgICB0eXBlPVwidGV4dFwiXG4gICAgdmFsdWU9e3Byb3BzLnZhbHVlfVxuICAgIG9uQ2hhbmdlPXtwcm9wcy5vbkNoYW5nZX1cbiAgICBvbktleURvd249e3Byb3BzLm9uS2V5RG93bn1cbiAgICBwbGFjZWhvbGRlcj17cHJvcHMucGxhY2Vob2xkZXJ9XG4gICAgY3NzPXtnZXRJbnB1dFN0eWxlcygpfVxuICAvPlxuKTtcblxuRGF0ZUNhbGVuZGFyVGltZUlucHV0LmRpc3BsYXlOYW1lID0gJ0RhdGVDYWxlbmRhclRpbWVJbnB1dCc7XG5cbkRhdGVDYWxlbmRhclRpbWVJbnB1dC5wcm9wVHlwZXMgPSB7XG4gIGlzRGlzYWJsZWQ6IFByb3BUeXBlcy5ib29sLmlzUmVxdWlyZWQsXG4gIHRpbWVJbnB1dFJlZjogUHJvcFR5cGVzLm9iamVjdC5pc1JlcXVpcmVkLFxuICBvbktleURvd246IFByb3BUeXBlcy5mdW5jLmlzUmVxdWlyZWQsXG4gIG9uQ2hhbmdlOiBQcm9wVHlwZXMuZnVuYy5pc1JlcXVpcmVkLFxuICB2YWx1ZTogUHJvcFR5cGVzLnN0cmluZy5pc1JlcXVpcmVkLFxuICBwbGFjZWhvbGRlcjogUHJvcFR5cGVzLnN0cmluZyxcbn07XG5cbmV4cG9ydCBkZWZhdWx0IERhdGVDYWxlbmRhclRpbWVJbnB1dDtcbiJdfQ== */");
|
|
58
57
|
};
|
|
59
58
|
|
|
60
59
|
var DateCalendarTimeInput = function DateCalendarTimeInput(props) {
|
|
61
|
-
return
|
|
60
|
+
return jsxRuntime.jsx("input", {
|
|
62
61
|
disabled: props.isDisabled,
|
|
63
62
|
ref: props.timeInputRef,
|
|
64
63
|
type: "text",
|
|
@@ -72,13 +71,14 @@ var DateCalendarTimeInput = function DateCalendarTimeInput(props) {
|
|
|
72
71
|
|
|
73
72
|
DateCalendarTimeInput.displayName = 'DateCalendarTimeInput';
|
|
74
73
|
DateCalendarTimeInput.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
75
|
-
isDisabled: PropTypes__default[
|
|
76
|
-
timeInputRef: PropTypes__default[
|
|
77
|
-
onKeyDown: PropTypes__default[
|
|
78
|
-
onChange: PropTypes__default[
|
|
79
|
-
value: PropTypes__default[
|
|
80
|
-
placeholder: PropTypes__default[
|
|
74
|
+
isDisabled: PropTypes__default["default"].bool.isRequired,
|
|
75
|
+
timeInputRef: PropTypes__default["default"].object.isRequired,
|
|
76
|
+
onKeyDown: PropTypes__default["default"].func.isRequired,
|
|
77
|
+
onChange: PropTypes__default["default"].func.isRequired,
|
|
78
|
+
value: PropTypes__default["default"].string.isRequired,
|
|
79
|
+
placeholder: PropTypes__default["default"].string
|
|
81
80
|
} : {};
|
|
81
|
+
var TimeInput = DateCalendarTimeInput;
|
|
82
82
|
|
|
83
83
|
var messages = reactIntl.defineMessages({
|
|
84
84
|
placeholder: {
|
|
@@ -93,14 +93,14 @@ var messages = reactIntl.defineMessages({
|
|
|
93
93
|
}
|
|
94
94
|
});
|
|
95
95
|
|
|
96
|
-
function ownKeys(object, enumerableOnly) { var keys = _Object$keys__default[
|
|
96
|
+
function ownKeys(object, enumerableOnly) { var keys = _Object$keys__default["default"](object); if (_Object$getOwnPropertySymbols__default["default"]) { var symbols = _Object$getOwnPropertySymbols__default["default"](object); if (enumerableOnly) { symbols = _filterInstanceProperty__default["default"](symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor__default["default"](object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
97
97
|
|
|
98
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { var _context4; _forEachInstanceProperty__default[
|
|
98
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { var _context4; _forEachInstanceProperty__default["default"](_context4 = ownKeys(Object(source), true)).call(_context4, function (key) { _defineProperty(target, key, source[key]); }); } else if (_Object$getOwnPropertyDescriptors__default["default"]) { _Object$defineProperties__default["default"](target, _Object$getOwnPropertyDescriptors__default["default"](source)); } else { var _context5; _forEachInstanceProperty__default["default"](_context5 = ownKeys(Object(source))).call(_context5, function (key) { _Object$defineProperty__default["default"](target, key, _Object$getOwnPropertyDescriptor__default["default"](source, key)); }); } } return target; }
|
|
99
99
|
|
|
100
|
-
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = _Reflect$construct__default[
|
|
100
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = _Reflect$construct__default["default"](Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
101
101
|
|
|
102
|
-
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !_Reflect$construct__default[
|
|
103
|
-
var activationTypes = [Downshift__default[
|
|
102
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !_Reflect$construct__default["default"]) return false; if (_Reflect$construct__default["default"].sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(_Reflect$construct__default["default"](Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
103
|
+
var activationTypes = [Downshift__default["default"].stateChangeTypes.keyDownEnter, Downshift__default["default"].stateChangeTypes.clickItem];
|
|
104
104
|
|
|
105
105
|
var preventDownshiftDefault = function preventDownshiftDefault(event) {
|
|
106
106
|
// eslint-disable-next-line no-param-reassign
|
|
@@ -119,8 +119,8 @@ var createBlurHandler = function createBlurHandler(timeInputRef) {
|
|
|
119
119
|
};
|
|
120
120
|
};
|
|
121
121
|
|
|
122
|
-
var DateTimeInput = /*#__PURE__*/function (
|
|
123
|
-
_inherits(DateTimeInput,
|
|
122
|
+
var DateTimeInput = /*#__PURE__*/function (_Component) {
|
|
123
|
+
_inherits(DateTimeInput, _Component);
|
|
124
124
|
|
|
125
125
|
var _super = _createSuper(DateTimeInput);
|
|
126
126
|
|
|
@@ -135,9 +135,9 @@ var DateTimeInput = /*#__PURE__*/function (_React$Component) {
|
|
|
135
135
|
args[_key] = arguments[_key];
|
|
136
136
|
}
|
|
137
137
|
|
|
138
|
-
_this = _super.call.apply(_super, _concatInstanceProperty__default[
|
|
139
|
-
_this.inputRef = /*#__PURE__*/
|
|
140
|
-
_this.timeInputRef = /*#__PURE__*/
|
|
138
|
+
_this = _super.call.apply(_super, _concatInstanceProperty__default["default"](_context = [this]).call(_context, args));
|
|
139
|
+
_this.inputRef = /*#__PURE__*/react$1.createRef();
|
|
140
|
+
_this.timeInputRef = /*#__PURE__*/react$1.createRef();
|
|
141
141
|
_this.state = {
|
|
142
142
|
calendarDate: calendarTimeUtils.getToday(_this.props.timeZone),
|
|
143
143
|
suggestedItems: [],
|
|
@@ -218,352 +218,356 @@ var DateTimeInput = /*#__PURE__*/function (_React$Component) {
|
|
|
218
218
|
var _context2,
|
|
219
219
|
_this2 = this;
|
|
220
220
|
|
|
221
|
-
return
|
|
222
|
-
max: this.props.horizontalConstraint
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
});
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
return changes;
|
|
243
|
-
},
|
|
244
|
-
onStateChange: function onStateChange(changes) {
|
|
245
|
-
/* eslint-disable no-prototype-builtins */
|
|
246
|
-
_this2.setState(function (prevState) {
|
|
247
|
-
if (_includesInstanceProperty__default['default'](activationTypes).call(activationTypes, changes.type)) {
|
|
248
|
-
return {
|
|
249
|
-
startDate: changes.isOpen ? prevState.startDate : null,
|
|
250
|
-
inputValue: changes.inputValue || prevState.inputValue,
|
|
251
|
-
timeString: changes.selectedItem ? calendarTimeUtils.formatTime(changes.selectedItem, _this2.props.intl.locale, _this2.props.timeZone) : prevState.timeString
|
|
252
|
-
};
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
if (changes.hasOwnProperty('inputValue')) {
|
|
256
|
-
var suggestedItems = calendarTimeUtils.createSuggestedItems(changes.inputValue, _this2.props.timeZone);
|
|
257
|
-
return {
|
|
258
|
-
suggestedItems: suggestedItems,
|
|
259
|
-
highlightedIndex: suggestedItems.length > 0 ? 0 : null
|
|
260
|
-
};
|
|
261
|
-
}
|
|
262
|
-
|
|
263
|
-
if (changes.hasOwnProperty('isOpen')) {
|
|
264
|
-
return {
|
|
265
|
-
inputValue: changes.inputValue || prevState.inputValue,
|
|
266
|
-
startDate: changes.isOpen ? prevState.startDate : null,
|
|
267
|
-
// set time input value to time from value when menu is opened
|
|
268
|
-
timeString: changes.isOpen && _this2.props.value !== '' ? calendarTimeUtils.formatTime(_this2.props.value, _this2.props.intl.locale, _this2.props.timeZone) : '',
|
|
269
|
-
// ensure calendar always opens on selected item, or on
|
|
270
|
-
// current month when there is no selected item
|
|
271
|
-
calendarDate: _this2.props.value === '' ? calendarTimeUtils.getToday() : _this2.props.value
|
|
272
|
-
};
|
|
273
|
-
}
|
|
274
|
-
|
|
275
|
-
if (changes.hasOwnProperty('highlightedIndex')) {
|
|
276
|
-
return {
|
|
277
|
-
highlightedIndex: changes.highlightedIndex
|
|
278
|
-
};
|
|
279
|
-
}
|
|
280
|
-
|
|
281
|
-
return null;
|
|
282
|
-
}, function () {
|
|
283
|
-
if (_includesInstanceProperty__default['default'](activationTypes).call(activationTypes, changes.type)) {
|
|
284
|
-
_this2.timeInputRef.current.focus();
|
|
285
|
-
|
|
286
|
-
_this2.timeInputRef.current.setSelectionRange(0, _this2.state.timeString.length);
|
|
221
|
+
return jsxRuntime.jsx(Constraints__default["default"].Horizontal, {
|
|
222
|
+
max: this.props.horizontalConstraint,
|
|
223
|
+
children: jsxRuntime.jsx(Downshift__default["default"] // Setting the key to the timeZone conveniently forces a rerender
|
|
224
|
+
// when the time-zone changes. Otherwise we'd need to make
|
|
225
|
+
// inputValue a controlled property so that we can update
|
|
226
|
+
// the displayed value as downshift seems to ignore an updated
|
|
227
|
+
// itemToString function.
|
|
228
|
+
, {
|
|
229
|
+
inputId: this.props.id,
|
|
230
|
+
itemToString: calendarTimeUtils.createItemDateTimeToString(this.props.intl.locale, this.props.timeZone),
|
|
231
|
+
selectedItem: this.props.value === '' ? null : this.props.value,
|
|
232
|
+
highlightedIndex: this.state.highlightedIndex,
|
|
233
|
+
onChange: this.emit,
|
|
234
|
+
stateReducer: function stateReducer(state, changes) {
|
|
235
|
+
if (_includesInstanceProperty__default["default"](activationTypes).call(activationTypes, changes.type)) {
|
|
236
|
+
return _objectSpread(_objectSpread({}, changes), {}, {
|
|
237
|
+
isOpen: true
|
|
238
|
+
});
|
|
287
239
|
}
|
|
288
|
-
});
|
|
289
|
-
/* eslint-enable no-prototype-builtins */
|
|
290
240
|
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
openMenu = _ref.openMenu,
|
|
302
|
-
closeMenu = _ref.closeMenu,
|
|
303
|
-
setHighlightedIndex = _ref.setHighlightedIndex,
|
|
304
|
-
selectedItem = _ref.selectedItem,
|
|
305
|
-
inputValue = _ref.inputValue,
|
|
306
|
-
isOpen = _ref.isOpen;
|
|
307
|
-
var suggestedItems = _this2.state.suggestedItems;
|
|
308
|
-
var calendarItems = calendarTimeUtils.createCalendarItems(_this2.state.calendarDate, _this2.state.timeString, _this2.props.intl, _this2.props.timeZone);
|
|
309
|
-
var paddingDayCount = calendarTimeUtils.getPaddingDayCount(_this2.state.calendarDate, _this2.props.intl.locale, _this2.props.timeZone);
|
|
310
|
-
|
|
311
|
-
var paddingDays = _fillInstanceProperty__default['default'](_context3 = Array(paddingDayCount)).call(_context3);
|
|
312
|
-
|
|
313
|
-
var weekdays = calendarTimeUtils.getWeekdayNames(_this2.props.intl.locale);
|
|
314
|
-
var today = calendarTimeUtils.getToday();
|
|
315
|
-
var isTimeInputVisible = Boolean(_this2.props.value) && _this2.props.value !== '';
|
|
316
|
-
return react.jsx("div", {
|
|
317
|
-
onFocus: _this2.props.onFocus,
|
|
318
|
-
onBlur: _this2.handleBlur
|
|
319
|
-
}, react.jsx(calendarUtils.CalendarBody, {
|
|
320
|
-
inputRef: _this2.inputRef,
|
|
321
|
-
inputProps: getInputProps(_objectSpread({
|
|
322
|
-
// Unset the aria-labelledby as it interfers with the link
|
|
323
|
-
// between the <label for> and the <input id>.
|
|
324
|
-
'aria-labelledby': undefined,
|
|
325
|
-
name: _this2.props.name,
|
|
326
|
-
placeholder: typeof _this2.props.placeholder === 'string' ? _this2.props.placeholder : _this2.props.intl.formatMessage(messages.placeholder),
|
|
327
|
-
onMouseEnter: function onMouseEnter() {
|
|
328
|
-
// we remove the highlight so that the user can use the
|
|
329
|
-
// arrow keys to move the cursor when hovering
|
|
330
|
-
if (isOpen) setHighlightedIndex(null);
|
|
331
|
-
},
|
|
332
|
-
onKeyDown: function onKeyDown(event) {
|
|
333
|
-
if (_this2.props.isReadOnly) {
|
|
334
|
-
preventDownshiftDefault(event);
|
|
335
|
-
return;
|
|
336
|
-
} // parse input when user presses enter on regular input,
|
|
337
|
-
// close menu and notify parent
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
if (event.key === 'Enter' && highlightedIndex === null) {
|
|
341
|
-
preventDownshiftDefault(event);
|
|
342
|
-
var parsedDate = calendarTimeUtils.parseInputText(inputValue, _this2.props.intl.locale, _this2.props.timeZone);
|
|
343
|
-
|
|
344
|
-
_this2.emit(parsedDate);
|
|
345
|
-
|
|
346
|
-
closeMenu();
|
|
347
|
-
} // ArrowDown
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
if (event.keyCode === 40) {
|
|
351
|
-
if (highlightedIndex + 1 >= calendarItems.length) {
|
|
352
|
-
// if it's the end of the month
|
|
353
|
-
// then bypass normal arrow navigation
|
|
354
|
-
preventDownshiftDefault(event); // eslint-disable-line no-param-reassign
|
|
355
|
-
// then jump to start of next month
|
|
356
|
-
|
|
357
|
-
_this2.jumpMonths(1, 0);
|
|
358
|
-
}
|
|
359
|
-
} // ArrowUp
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
if (event.keyCode === 38) {
|
|
363
|
-
var previousDay = calendarTimeUtils.getPreviousDay(calendarItems[highlightedIndex]);
|
|
364
|
-
|
|
365
|
-
if (highlightedIndex <= 0) {
|
|
366
|
-
// if it's the start of the month
|
|
367
|
-
// then bypass normal arrow navigation
|
|
368
|
-
preventDownshiftDefault(event); // eslint-disable-line no-param-reassign
|
|
369
|
-
|
|
370
|
-
var numberOfDaysOfPrevMonth = calendarTimeUtils.getDaysInMonth(previousDay); // then jump to the last day of the previous month
|
|
371
|
-
|
|
372
|
-
_this2.jumpMonths(-1, numberOfDaysOfPrevMonth - 1);
|
|
373
|
-
}
|
|
374
|
-
}
|
|
375
|
-
},
|
|
376
|
-
onClick: _this2.props.isReadOnly ? undefined : openMenu,
|
|
377
|
-
onBlur: createBlurHandler(_this2.timeInputRef),
|
|
378
|
-
onChange: function onChange(event) {
|
|
379
|
-
// keep timeInput and regular input in sync when user
|
|
380
|
-
// types into regular input
|
|
381
|
-
if (!isOpen) return;
|
|
382
|
-
var time = event.target.value.split(' ')[1];
|
|
383
|
-
if (!time) return;
|
|
384
|
-
var parsedTime = utils.parseTime(time);
|
|
385
|
-
|
|
386
|
-
_this2.setState(function () {
|
|
387
|
-
if (!parsedTime) return {
|
|
388
|
-
timeString: ''
|
|
241
|
+
return changes;
|
|
242
|
+
},
|
|
243
|
+
onStateChange: function onStateChange(changes) {
|
|
244
|
+
/* eslint-disable no-prototype-builtins */
|
|
245
|
+
_this2.setState(function (prevState) {
|
|
246
|
+
if (_includesInstanceProperty__default["default"](activationTypes).call(activationTypes, changes.type)) {
|
|
247
|
+
return {
|
|
248
|
+
startDate: changes.isOpen ? prevState.startDate : null,
|
|
249
|
+
inputValue: changes.inputValue || prevState.inputValue,
|
|
250
|
+
timeString: changes.selectedItem ? calendarTimeUtils.formatTime(changes.selectedItem, _this2.props.intl.locale, _this2.props.timeZone) : prevState.timeString
|
|
389
251
|
};
|
|
390
|
-
|
|
252
|
+
}
|
|
391
253
|
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
254
|
+
if (changes.hasOwnProperty('inputValue')) {
|
|
255
|
+
var suggestedItems = calendarTimeUtils.createSuggestedItems(changes.inputValue, _this2.props.timeZone);
|
|
256
|
+
return {
|
|
257
|
+
suggestedItems: suggestedItems,
|
|
258
|
+
highlightedIndex: suggestedItems.length > 0 ? 0 : null
|
|
259
|
+
};
|
|
260
|
+
}
|
|
395
261
|
|
|
262
|
+
if (changes.hasOwnProperty('isOpen')) {
|
|
396
263
|
return {
|
|
397
|
-
|
|
264
|
+
inputValue: changes.inputValue || prevState.inputValue,
|
|
265
|
+
startDate: changes.isOpen ? prevState.startDate : null,
|
|
266
|
+
// set time input value to time from value when menu is opened
|
|
267
|
+
timeString: changes.isOpen && _this2.props.value !== '' ? calendarTimeUtils.formatTime(_this2.props.value, _this2.props.intl.locale, _this2.props.timeZone) : '',
|
|
268
|
+
// ensure calendar always opens on selected item, or on
|
|
269
|
+
// current month when there is no selected item
|
|
270
|
+
calendarDate: _this2.props.value === '' ? calendarTimeUtils.getToday() : _this2.props.value
|
|
398
271
|
};
|
|
399
|
-
}
|
|
400
|
-
}
|
|
401
|
-
}, utils.filterDataAttributes(_this2.props))),
|
|
402
|
-
hasSelection: Boolean(selectedItem),
|
|
403
|
-
onClear: clearSelection,
|
|
404
|
-
isOpen: isOpen,
|
|
405
|
-
isDisabled: _this2.props.isDisabled,
|
|
406
|
-
isReadOnly: _this2.props.isReadOnly,
|
|
407
|
-
toggleButtonProps: getToggleButtonProps({
|
|
408
|
-
onBlur: createBlurHandler(_this2.timeInputRef)
|
|
409
|
-
}),
|
|
410
|
-
hasError: _this2.props.hasError,
|
|
411
|
-
hasWarning: _this2.props.hasWarning
|
|
412
|
-
}), isOpen && !_this2.props.isDisabled && react.jsx(calendarUtils.CalendarMenu, _extends({}, getMenuProps(), {
|
|
413
|
-
hasFooter: true,
|
|
414
|
-
hasError: _this2.props.hasError,
|
|
415
|
-
hasWarning: _this2.props.hasWarning
|
|
416
|
-
}), react.jsx(calendarUtils.CalendarHeader, {
|
|
417
|
-
monthLabel: calendarTimeUtils.getMonthCalendarLabel(_this2.state.calendarDate, _this2.props.intl.locale),
|
|
418
|
-
yearLabel: calendarTimeUtils.getYearCalendarLabel(_this2.state.calendarDate, _this2.props.intl.locale),
|
|
419
|
-
onPrevMonthClick: function onPrevMonthClick() {
|
|
420
|
-
return _this2.jumpMonths(-1);
|
|
421
|
-
},
|
|
422
|
-
onTodayClick: _this2.showToday,
|
|
423
|
-
onNextMonthClick: function onNextMonthClick() {
|
|
424
|
-
return _this2.jumpMonths(1);
|
|
425
|
-
},
|
|
426
|
-
onPrevYearClick: function onPrevYearClick() {
|
|
427
|
-
return _this2.jumpMonths(-12);
|
|
428
|
-
},
|
|
429
|
-
onNextYearClick: function onNextYearClick() {
|
|
430
|
-
return _this2.jumpMonths(12);
|
|
431
|
-
}
|
|
432
|
-
}), react.jsx(calendarUtils.CalendarContent, null, _mapInstanceProperty__default['default'](weekdays).call(weekdays, function (weekday) {
|
|
433
|
-
return react.jsx(calendarUtils.CalendarDay, {
|
|
434
|
-
key: weekday,
|
|
435
|
-
type: "heading"
|
|
436
|
-
}, weekday);
|
|
437
|
-
}), _mapInstanceProperty__default['default'](paddingDays).call(paddingDays, function (day, index) {
|
|
438
|
-
return react.jsx(calendarUtils.CalendarDay, {
|
|
439
|
-
key: index,
|
|
440
|
-
type: "spacing"
|
|
441
|
-
});
|
|
442
|
-
}), _mapInstanceProperty__default['default'](calendarItems).call(calendarItems, function (item, index) {
|
|
443
|
-
return react.jsx(calendarUtils.CalendarDay, _extends({
|
|
444
|
-
key: item,
|
|
445
|
-
isToday: calendarTimeUtils.isSameDay(today, item)
|
|
446
|
-
}, getItemProps({
|
|
447
|
-
disabled: _this2.props.isDisabled,
|
|
448
|
-
item: item,
|
|
449
|
-
onMouseOut: function onMouseOut() {
|
|
450
|
-
setHighlightedIndex(null);
|
|
451
|
-
}
|
|
452
|
-
}), {
|
|
453
|
-
isHighlighted: suggestedItems.length + index === highlightedIndex,
|
|
454
|
-
isSelected: calendarTimeUtils.isSameDay(item, _this2.props.value)
|
|
455
|
-
}), calendarTimeUtils.getCalendarDayLabel(item, _this2.props.timeZone));
|
|
456
|
-
})), react.jsx(DateCalendarTimeInput, {
|
|
457
|
-
isDisabled: !isTimeInputVisible,
|
|
458
|
-
timeInputRef: _this2.timeInputRef,
|
|
459
|
-
placeholder: _this2.props.intl.formatMessage(messages.timePlaceholder),
|
|
460
|
-
value: _this2.state.timeString,
|
|
461
|
-
onChange: _this2.handleTimeChange,
|
|
462
|
-
onKeyDown: function onKeyDown(event) {
|
|
463
|
-
if (event.key === 'ArrowUp') {
|
|
464
|
-
setHighlightedIndex(null);
|
|
465
|
-
|
|
466
|
-
_this2.inputRef.current.focus();
|
|
467
|
-
|
|
468
|
-
return;
|
|
469
|
-
}
|
|
272
|
+
}
|
|
470
273
|
|
|
471
|
-
|
|
472
|
-
|
|
274
|
+
if (changes.hasOwnProperty('highlightedIndex')) {
|
|
275
|
+
return {
|
|
276
|
+
highlightedIndex: changes.highlightedIndex
|
|
277
|
+
};
|
|
278
|
+
}
|
|
473
279
|
|
|
474
|
-
|
|
280
|
+
return null;
|
|
281
|
+
}, function () {
|
|
282
|
+
if (_includesInstanceProperty__default["default"](activationTypes).call(activationTypes, changes.type)) {
|
|
283
|
+
_this2.timeInputRef.current.focus();
|
|
475
284
|
|
|
476
|
-
|
|
285
|
+
_this2.timeInputRef.current.setSelectionRange(0, _this2.state.timeString.length);
|
|
286
|
+
}
|
|
287
|
+
});
|
|
288
|
+
/* eslint-enable no-prototype-builtins */
|
|
477
289
|
|
|
478
|
-
|
|
479
|
-
|
|
290
|
+
},
|
|
291
|
+
children: function children(_ref) {
|
|
292
|
+
var _context3;
|
|
293
|
+
|
|
294
|
+
var getInputProps = _ref.getInputProps,
|
|
295
|
+
getMenuProps = _ref.getMenuProps,
|
|
296
|
+
getItemProps = _ref.getItemProps,
|
|
297
|
+
getToggleButtonProps = _ref.getToggleButtonProps,
|
|
298
|
+
clearSelection = _ref.clearSelection,
|
|
299
|
+
highlightedIndex = _ref.highlightedIndex,
|
|
300
|
+
openMenu = _ref.openMenu,
|
|
301
|
+
closeMenu = _ref.closeMenu,
|
|
302
|
+
setHighlightedIndex = _ref.setHighlightedIndex,
|
|
303
|
+
selectedItem = _ref.selectedItem,
|
|
304
|
+
inputValue = _ref.inputValue,
|
|
305
|
+
isOpen = _ref.isOpen;
|
|
306
|
+
var suggestedItems = _this2.state.suggestedItems;
|
|
307
|
+
var calendarItems = calendarTimeUtils.createCalendarItems(_this2.state.calendarDate, _this2.state.timeString, _this2.props.intl, _this2.props.timeZone);
|
|
308
|
+
var paddingDayCount = calendarTimeUtils.getPaddingDayCount(_this2.state.calendarDate, _this2.props.intl.locale, _this2.props.timeZone);
|
|
309
|
+
|
|
310
|
+
var paddingDays = _fillInstanceProperty__default["default"](_context3 = Array(paddingDayCount)).call(_context3);
|
|
311
|
+
|
|
312
|
+
var weekdays = calendarTimeUtils.getWeekdayNames(_this2.props.intl.locale);
|
|
313
|
+
var today = calendarTimeUtils.getToday();
|
|
314
|
+
var isTimeInputVisible = Boolean(_this2.props.value) && _this2.props.value !== '';
|
|
315
|
+
return jsxRuntime.jsxs("div", {
|
|
316
|
+
onFocus: _this2.props.onFocus,
|
|
317
|
+
onBlur: _this2.handleBlur,
|
|
318
|
+
children: [jsxRuntime.jsx(calendarUtils.CalendarBody, {
|
|
319
|
+
inputRef: _this2.inputRef,
|
|
320
|
+
inputProps: getInputProps(_objectSpread({
|
|
321
|
+
// Unset the aria-labelledby as it interfers with the link
|
|
322
|
+
// between the <label for> and the <input id>.
|
|
323
|
+
'aria-labelledby': undefined,
|
|
324
|
+
name: _this2.props.name,
|
|
325
|
+
placeholder: typeof _this2.props.placeholder === 'string' ? _this2.props.placeholder : _this2.props.intl.formatMessage(messages.placeholder),
|
|
326
|
+
onMouseEnter: function onMouseEnter() {
|
|
327
|
+
// we remove the highlight so that the user can use the
|
|
328
|
+
// arrow keys to move the cursor when hovering
|
|
329
|
+
if (isOpen) setHighlightedIndex(null);
|
|
330
|
+
},
|
|
331
|
+
onKeyDown: function onKeyDown(event) {
|
|
332
|
+
if (_this2.props.isReadOnly) {
|
|
333
|
+
preventDownshiftDefault(event);
|
|
334
|
+
return;
|
|
335
|
+
} // parse input when user presses enter on regular input,
|
|
336
|
+
// close menu and notify parent
|
|
337
|
+
|
|
338
|
+
|
|
339
|
+
if (event.key === 'Enter' && highlightedIndex === null) {
|
|
340
|
+
preventDownshiftDefault(event);
|
|
341
|
+
var parsedDate = calendarTimeUtils.parseInputText(inputValue, _this2.props.intl.locale, _this2.props.timeZone);
|
|
342
|
+
|
|
343
|
+
_this2.emit(parsedDate);
|
|
344
|
+
|
|
345
|
+
closeMenu();
|
|
346
|
+
} // ArrowDown
|
|
347
|
+
|
|
348
|
+
|
|
349
|
+
if (event.keyCode === 40) {
|
|
350
|
+
if (highlightedIndex + 1 >= calendarItems.length) {
|
|
351
|
+
// if it's the end of the month
|
|
352
|
+
// then bypass normal arrow navigation
|
|
353
|
+
preventDownshiftDefault(event); // eslint-disable-line no-param-reassign
|
|
354
|
+
// then jump to start of next month
|
|
355
|
+
|
|
356
|
+
_this2.jumpMonths(1, 0);
|
|
357
|
+
}
|
|
358
|
+
} // ArrowUp
|
|
359
|
+
|
|
360
|
+
|
|
361
|
+
if (event.keyCode === 38) {
|
|
362
|
+
var previousDay = calendarTimeUtils.getPreviousDay(calendarItems[highlightedIndex]);
|
|
363
|
+
|
|
364
|
+
if (highlightedIndex <= 0) {
|
|
365
|
+
// if it's the start of the month
|
|
366
|
+
// then bypass normal arrow navigation
|
|
367
|
+
preventDownshiftDefault(event); // eslint-disable-line no-param-reassign
|
|
368
|
+
|
|
369
|
+
var numberOfDaysOfPrevMonth = calendarTimeUtils.getDaysInMonth(previousDay); // then jump to the last day of the previous month
|
|
370
|
+
|
|
371
|
+
_this2.jumpMonths(-1, numberOfDaysOfPrevMonth - 1);
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
},
|
|
375
|
+
onClick: _this2.props.isReadOnly ? undefined : openMenu,
|
|
376
|
+
onBlur: createBlurHandler(_this2.timeInputRef),
|
|
377
|
+
onChange: function onChange(event) {
|
|
378
|
+
// keep timeInput and regular input in sync when user
|
|
379
|
+
// types into regular input
|
|
380
|
+
if (!isOpen) return;
|
|
381
|
+
var time = event.target.value.split(' ')[1];
|
|
382
|
+
if (!time) return;
|
|
383
|
+
var parsedTime = utils.parseTime(time);
|
|
384
|
+
|
|
385
|
+
_this2.setState(function () {
|
|
386
|
+
if (!parsedTime) return {
|
|
387
|
+
timeString: ''
|
|
388
|
+
};
|
|
389
|
+
var date = calendarTimeUtils.getToday(_this2.props.timeZone);
|
|
390
|
+
|
|
391
|
+
if (parsedTime) {
|
|
392
|
+
date = calendarTimeUtils.changeTime(date, _this2.props.timeZone, parsedTime);
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
return {
|
|
396
|
+
timeString: calendarTimeUtils.formatTime(date, _this2.props.intl.locale, _this2.props.timeZone)
|
|
397
|
+
};
|
|
398
|
+
});
|
|
399
|
+
}
|
|
400
|
+
}, utils.filterDataAttributes(_this2.props))),
|
|
401
|
+
hasSelection: Boolean(selectedItem),
|
|
402
|
+
onClear: clearSelection,
|
|
403
|
+
isOpen: isOpen,
|
|
404
|
+
isDisabled: _this2.props.isDisabled,
|
|
405
|
+
isReadOnly: _this2.props.isReadOnly,
|
|
406
|
+
toggleButtonProps: getToggleButtonProps({
|
|
407
|
+
onBlur: createBlurHandler(_this2.timeInputRef)
|
|
408
|
+
}),
|
|
409
|
+
hasError: _this2.props.hasError,
|
|
410
|
+
hasWarning: _this2.props.hasWarning
|
|
411
|
+
}), isOpen && !_this2.props.isDisabled && jsxRuntime.jsxs(calendarUtils.CalendarMenu, _objectSpread(_objectSpread({}, getMenuProps()), {}, {
|
|
412
|
+
hasFooter: true,
|
|
413
|
+
hasError: _this2.props.hasError,
|
|
414
|
+
hasWarning: _this2.props.hasWarning,
|
|
415
|
+
children: [jsxRuntime.jsx(calendarUtils.CalendarHeader, {
|
|
416
|
+
monthLabel: calendarTimeUtils.getMonthCalendarLabel(_this2.state.calendarDate, _this2.props.intl.locale),
|
|
417
|
+
yearLabel: calendarTimeUtils.getYearCalendarLabel(_this2.state.calendarDate, _this2.props.intl.locale),
|
|
418
|
+
onPrevMonthClick: function onPrevMonthClick() {
|
|
419
|
+
return _this2.jumpMonths(-1);
|
|
420
|
+
},
|
|
421
|
+
onTodayClick: _this2.showToday,
|
|
422
|
+
onNextMonthClick: function onNextMonthClick() {
|
|
423
|
+
return _this2.jumpMonths(1);
|
|
424
|
+
},
|
|
425
|
+
onPrevYearClick: function onPrevYearClick() {
|
|
426
|
+
return _this2.jumpMonths(-12);
|
|
427
|
+
},
|
|
428
|
+
onNextYearClick: function onNextYearClick() {
|
|
429
|
+
return _this2.jumpMonths(12);
|
|
430
|
+
}
|
|
431
|
+
}), jsxRuntime.jsxs(calendarUtils.CalendarContent, {
|
|
432
|
+
children: [_mapInstanceProperty__default["default"](weekdays).call(weekdays, function (weekday) {
|
|
433
|
+
return jsxRuntime.jsx(calendarUtils.CalendarDay, {
|
|
434
|
+
type: "heading",
|
|
435
|
+
children: weekday
|
|
436
|
+
}, weekday);
|
|
437
|
+
}), _mapInstanceProperty__default["default"](paddingDays).call(paddingDays, function (day, index) {
|
|
438
|
+
return jsxRuntime.jsx(calendarUtils.CalendarDay, {
|
|
439
|
+
type: "spacing"
|
|
440
|
+
}, index);
|
|
441
|
+
}), _mapInstanceProperty__default["default"](calendarItems).call(calendarItems, function (item, index) {
|
|
442
|
+
return jsxRuntime.jsx(calendarUtils.CalendarDay, _objectSpread(_objectSpread({
|
|
443
|
+
isToday: calendarTimeUtils.isSameDay(today, item)
|
|
444
|
+
}, getItemProps({
|
|
445
|
+
disabled: _this2.props.isDisabled,
|
|
446
|
+
item: item,
|
|
447
|
+
onMouseOut: function onMouseOut() {
|
|
448
|
+
setHighlightedIndex(null);
|
|
449
|
+
}
|
|
450
|
+
})), {}, {
|
|
451
|
+
isHighlighted: suggestedItems.length + index === highlightedIndex,
|
|
452
|
+
isSelected: calendarTimeUtils.isSameDay(item, _this2.props.value),
|
|
453
|
+
children: calendarTimeUtils.getCalendarDayLabel(item, _this2.props.timeZone)
|
|
454
|
+
}), item);
|
|
455
|
+
})]
|
|
456
|
+
}), jsxRuntime.jsx(TimeInput, {
|
|
457
|
+
isDisabled: !isTimeInputVisible,
|
|
458
|
+
timeInputRef: _this2.timeInputRef,
|
|
459
|
+
placeholder: _this2.props.intl.formatMessage(messages.timePlaceholder),
|
|
460
|
+
value: _this2.state.timeString,
|
|
461
|
+
onChange: _this2.handleTimeChange,
|
|
462
|
+
onKeyDown: function onKeyDown(event) {
|
|
463
|
+
if (event.key === 'ArrowUp') {
|
|
464
|
+
setHighlightedIndex(null);
|
|
465
|
+
|
|
466
|
+
_this2.inputRef.current.focus();
|
|
467
|
+
|
|
468
|
+
return;
|
|
469
|
+
}
|
|
470
|
+
|
|
471
|
+
if (event.key === 'Enter') {
|
|
472
|
+
setHighlightedIndex(null);
|
|
473
|
+
|
|
474
|
+
_this2.inputRef.current.focus();
|
|
475
|
+
|
|
476
|
+
_this2.inputRef.current.setSelectionRange(0, 100);
|
|
477
|
+
|
|
478
|
+
closeMenu();
|
|
479
|
+
}
|
|
480
|
+
}
|
|
481
|
+
})]
|
|
482
|
+
}))]
|
|
483
|
+
});
|
|
480
484
|
}
|
|
481
|
-
})))
|
|
482
|
-
})
|
|
485
|
+
}, _concatInstanceProperty__default["default"](_context2 = "".concat(this.props.timeZone, ":")).call(_context2, this.props.intl.locale))
|
|
486
|
+
});
|
|
483
487
|
}
|
|
484
488
|
}]);
|
|
485
489
|
|
|
486
490
|
return DateTimeInput;
|
|
487
|
-
}(
|
|
491
|
+
}(react$1.Component);
|
|
488
492
|
|
|
489
493
|
DateTimeInput.displayName = 'DateTimeInput';
|
|
490
494
|
DateTimeInput.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
491
|
-
intl: PropTypes__default[
|
|
492
|
-
locale: PropTypes__default[
|
|
493
|
-
formatMessage: PropTypes__default[
|
|
495
|
+
intl: PropTypes__default["default"].shape({
|
|
496
|
+
locale: PropTypes__default["default"].string.isRequired,
|
|
497
|
+
formatMessage: PropTypes__default["default"].func.isRequired
|
|
494
498
|
}).isRequired,
|
|
495
499
|
|
|
496
500
|
/**
|
|
497
501
|
* Horizontal size limit of the input field.
|
|
498
502
|
*/
|
|
499
|
-
horizontalConstraint: PropTypes__default[
|
|
503
|
+
horizontalConstraint: PropTypes__default["default"].oneOf([6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 'scale', 'auto']),
|
|
500
504
|
|
|
501
505
|
/**
|
|
502
506
|
* The selected date, must either be an empty string or a date formatted in ISO 8601 (e.g. "2018-10-04T09:00:00.000Z").
|
|
503
507
|
*/
|
|
504
|
-
value: PropTypes__default[
|
|
508
|
+
value: PropTypes__default["default"].string.isRequired,
|
|
505
509
|
|
|
506
510
|
/**
|
|
507
511
|
* Called when the date changes. Called with an event containing an empty string (no value) or a string in this format: "YYYY-MM-DD".
|
|
508
512
|
* <br />
|
|
509
513
|
* Signature: `(event) => void`
|
|
510
514
|
*/
|
|
511
|
-
onChange: PropTypes__default[
|
|
515
|
+
onChange: PropTypes__default["default"].func.isRequired,
|
|
512
516
|
|
|
513
517
|
/**
|
|
514
518
|
* Called when the date input gains focus.
|
|
515
519
|
*/
|
|
516
|
-
onFocus: PropTypes__default[
|
|
520
|
+
onFocus: PropTypes__default["default"].func,
|
|
517
521
|
|
|
518
522
|
/**
|
|
519
523
|
* Called when the date input loses focus.
|
|
520
524
|
*/
|
|
521
|
-
onBlur: PropTypes__default[
|
|
525
|
+
onBlur: PropTypes__default["default"].func,
|
|
522
526
|
|
|
523
527
|
/**
|
|
524
528
|
* Specifies the time zone in which the calendar and selected values are shown. It also influences how entered dates and times are parsed.
|
|
525
529
|
*/
|
|
526
|
-
timeZone: PropTypes__default[
|
|
530
|
+
timeZone: PropTypes__default["default"].string.isRequired,
|
|
527
531
|
|
|
528
532
|
/**
|
|
529
533
|
* Used as the HTML `id` attribute.
|
|
530
534
|
*/
|
|
531
|
-
id: PropTypes__default[
|
|
535
|
+
id: PropTypes__default["default"].string,
|
|
532
536
|
|
|
533
537
|
/**
|
|
534
538
|
* Used as the HTML `name` attribute.
|
|
535
539
|
*/
|
|
536
|
-
name: PropTypes__default[
|
|
540
|
+
name: PropTypes__default["default"].string,
|
|
537
541
|
|
|
538
542
|
/**
|
|
539
543
|
* Placeholder value to show in the input field
|
|
540
544
|
*/
|
|
541
|
-
placeholder: PropTypes__default[
|
|
545
|
+
placeholder: PropTypes__default["default"].string,
|
|
542
546
|
|
|
543
547
|
/**
|
|
544
548
|
* Disables the date picker
|
|
545
549
|
*/
|
|
546
|
-
isDisabled: PropTypes__default[
|
|
550
|
+
isDisabled: PropTypes__default["default"].bool,
|
|
547
551
|
|
|
548
552
|
/**
|
|
549
553
|
* Disables the date picker menu and sets the input field as read-only
|
|
550
554
|
*/
|
|
551
|
-
isReadOnly: PropTypes__default[
|
|
555
|
+
isReadOnly: PropTypes__default["default"].bool,
|
|
552
556
|
|
|
553
557
|
/**
|
|
554
558
|
* Indicates the input field has an error
|
|
555
559
|
*/
|
|
556
|
-
hasError: PropTypes__default[
|
|
560
|
+
hasError: PropTypes__default["default"].bool,
|
|
557
561
|
|
|
558
562
|
/**
|
|
559
563
|
* Indicates the input field has a warning
|
|
560
564
|
*/
|
|
561
|
-
hasWarning: PropTypes__default[
|
|
565
|
+
hasWarning: PropTypes__default["default"].bool
|
|
562
566
|
} : {};
|
|
563
567
|
var dateTimeInput = reactIntl.injectIntl(DateTimeInput);
|
|
564
568
|
|
|
565
|
-
// NOTE: This string will be replaced
|
|
566
|
-
var version =
|
|
569
|
+
// NOTE: This string will be replaced on build time with the package version.
|
|
570
|
+
var version = "12.2.5";
|
|
567
571
|
|
|
568
|
-
exports
|
|
572
|
+
exports["default"] = dateTimeInput;
|
|
569
573
|
exports.version = version;
|