@commercetools-uikit/date-input 12.2.2 → 12.2.6
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.
|
@@ -10,20 +10,19 @@ var _forEachInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/in
|
|
|
10
10
|
var _Object$getOwnPropertyDescriptors = require('@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors');
|
|
11
11
|
var _Object$defineProperties = require('@babel/runtime-corejs3/core-js-stable/object/define-properties');
|
|
12
12
|
var _Object$defineProperty = require('@babel/runtime-corejs3/core-js-stable/object/define-property');
|
|
13
|
-
var _extends = require('@babel/runtime-corejs3/helpers/extends');
|
|
14
13
|
var _defineProperty = require('@babel/runtime-corejs3/helpers/defineProperty');
|
|
15
14
|
var _slicedToArray = require('@babel/runtime-corejs3/helpers/slicedToArray');
|
|
16
15
|
var _fillInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/fill');
|
|
17
16
|
var _trimInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/trim');
|
|
18
17
|
var _mapInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/map');
|
|
19
|
-
var
|
|
18
|
+
var react = require('react');
|
|
20
19
|
require('prop-types');
|
|
21
20
|
var Downshift = require('downshift');
|
|
22
21
|
var reactIntl = require('react-intl');
|
|
23
22
|
var Constraints = require('@commercetools-uikit/constraints');
|
|
24
23
|
var utils = require('@commercetools-uikit/utils');
|
|
25
24
|
var calendarUtils = require('@commercetools-uikit/calendar-utils');
|
|
26
|
-
var
|
|
25
|
+
var jsxRuntime = require('@emotion/react/jsx-runtime');
|
|
27
26
|
|
|
28
27
|
function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
|
|
29
28
|
|
|
@@ -38,7 +37,6 @@ var _Object$defineProperty__default = /*#__PURE__*/_interopDefault(_Object$defin
|
|
|
38
37
|
var _fillInstanceProperty__default = /*#__PURE__*/_interopDefault(_fillInstanceProperty);
|
|
39
38
|
var _trimInstanceProperty__default = /*#__PURE__*/_interopDefault(_trimInstanceProperty);
|
|
40
39
|
var _mapInstanceProperty__default = /*#__PURE__*/_interopDefault(_mapInstanceProperty);
|
|
41
|
-
var React__default = /*#__PURE__*/_interopDefault(React);
|
|
42
40
|
var Downshift__default = /*#__PURE__*/_interopDefault(Downshift);
|
|
43
41
|
var Constraints__default = /*#__PURE__*/_interopDefault(Constraints);
|
|
44
42
|
|
|
@@ -50,9 +48,9 @@ var messages = reactIntl.defineMessages({
|
|
|
50
48
|
}
|
|
51
49
|
});
|
|
52
50
|
|
|
53
|
-
function ownKeys(object, enumerableOnly) { var keys = _Object$keys__default[
|
|
51
|
+
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; }
|
|
54
52
|
|
|
55
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { var _context2; _forEachInstanceProperty__default[
|
|
53
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { var _context2; _forEachInstanceProperty__default["default"](_context2 = ownKeys(Object(source), true)).call(_context2, 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 _context3; _forEachInstanceProperty__default["default"](_context3 = ownKeys(Object(source))).call(_context3, function (key) { _Object$defineProperty__default["default"](target, key, _Object$getOwnPropertyDescriptor__default["default"](source, key)); }); } } return target; }
|
|
56
54
|
|
|
57
55
|
var preventDownshiftDefault = function preventDownshiftDefault(event) {
|
|
58
56
|
// eslint-disable-next-line no-param-reassign
|
|
@@ -62,24 +60,24 @@ var preventDownshiftDefault = function preventDownshiftDefault(event) {
|
|
|
62
60
|
var DateInput = function DateInput(props) {
|
|
63
61
|
var intl = reactIntl.useIntl();
|
|
64
62
|
|
|
65
|
-
var
|
|
66
|
-
|
|
67
|
-
calendarDate =
|
|
68
|
-
setCalendarDate =
|
|
63
|
+
var _useState = react.useState(props.value || calendarUtils.getToday()),
|
|
64
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
65
|
+
calendarDate = _useState2[0],
|
|
66
|
+
setCalendarDate = _useState2[1];
|
|
69
67
|
|
|
70
|
-
var
|
|
71
|
-
|
|
72
|
-
suggestedItems =
|
|
73
|
-
setSuggestedItems =
|
|
68
|
+
var _useState3 = react.useState([]),
|
|
69
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
70
|
+
suggestedItems = _useState4[0],
|
|
71
|
+
setSuggestedItems = _useState4[1];
|
|
74
72
|
|
|
75
|
-
var
|
|
76
|
-
|
|
77
|
-
highlightedIndex =
|
|
78
|
-
setHighlightedIndex =
|
|
73
|
+
var _useState5 = react.useState(props.value === '' ? null : calendarUtils.getDateInMonth(props.value) - 1),
|
|
74
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
75
|
+
highlightedIndex = _useState6[0],
|
|
76
|
+
setHighlightedIndex = _useState6[1];
|
|
79
77
|
|
|
80
|
-
var inputRef =
|
|
78
|
+
var inputRef = react.useRef();
|
|
81
79
|
var onChange = props.onChange;
|
|
82
|
-
var emit =
|
|
80
|
+
var emit = react.useCallback(function (value) {
|
|
83
81
|
return onChange({
|
|
84
82
|
target: {
|
|
85
83
|
id: props.id,
|
|
@@ -90,12 +88,12 @@ var DateInput = function DateInput(props) {
|
|
|
90
88
|
}
|
|
91
89
|
});
|
|
92
90
|
}, [onChange, props.id, props.name]);
|
|
93
|
-
var handleChange =
|
|
91
|
+
var handleChange = react.useCallback(function (date) {
|
|
94
92
|
inputRef.current.setSelectionRange(0, 100);
|
|
95
93
|
emit(date);
|
|
96
94
|
}, [inputRef, emit]);
|
|
97
95
|
var onBlur = props.onBlur;
|
|
98
|
-
var handleBlur =
|
|
96
|
+
var handleBlur = react.useCallback(function () {
|
|
99
97
|
if (onBlur) onBlur({
|
|
100
98
|
target: {
|
|
101
99
|
id: props.id,
|
|
@@ -118,192 +116,196 @@ var DateInput = function DateInput(props) {
|
|
|
118
116
|
setHighlightedIndex(dayToHighlight);
|
|
119
117
|
};
|
|
120
118
|
|
|
121
|
-
return
|
|
122
|
-
max: props.horizontalConstraint
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
119
|
+
return jsxRuntime.jsx(Constraints__default["default"].Horizontal, {
|
|
120
|
+
max: props.horizontalConstraint,
|
|
121
|
+
children: jsxRuntime.jsx(Downshift__default["default"], {
|
|
122
|
+
inputId: props.id,
|
|
123
|
+
itemToString: calendarUtils.createItemToString(intl.locale),
|
|
124
|
+
selectedItem: props.value === '' ? null : props.value,
|
|
125
|
+
highlightedIndex: highlightedIndex,
|
|
126
|
+
onChange: handleChange,
|
|
127
|
+
onStateChange: function onStateChange(changes) {
|
|
128
|
+
/* eslint-disable no-prototype-builtins */
|
|
129
|
+
if (changes.hasOwnProperty('inputValue')) {
|
|
130
|
+
// input changed because user typed
|
|
131
|
+
if (changes.type === Downshift__default["default"].stateChangeTypes.changeInput) {
|
|
132
|
+
var date = calendarUtils.parseInputToDate(changes.inputValue, intl.locale);
|
|
133
|
+
|
|
134
|
+
if (date === '') {
|
|
135
|
+
setSuggestedItems([]);
|
|
136
|
+
setHighlightedIndex(null);
|
|
137
|
+
} else {
|
|
138
|
+
setSuggestedItems([date]);
|
|
139
|
+
|
|
140
|
+
if (calendarUtils.getIsDateInRange(date, props.minValue, props.maxValue)) {
|
|
141
|
+
setHighlightedIndex(calendarUtils.getDateInMonth(date) - 1);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
setCalendarDate(date);
|
|
145
|
+
}
|
|
146
|
+
} else {
|
|
147
|
+
// input changed because user selected a date
|
|
138
148
|
setSuggestedItems([]);
|
|
139
149
|
setHighlightedIndex(null);
|
|
140
|
-
} else {
|
|
141
|
-
setSuggestedItems([date]);
|
|
142
|
-
|
|
143
|
-
if (calendarUtils.getIsDateInRange(date, props.minValue, props.maxValue)) {
|
|
144
|
-
setHighlightedIndex(calendarUtils.getDateInMonth(date) - 1);
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
setCalendarDate(date);
|
|
148
150
|
}
|
|
149
|
-
} else {
|
|
150
|
-
// input changed because user selected a date
|
|
151
|
-
setSuggestedItems([]);
|
|
152
|
-
setHighlightedIndex(null);
|
|
153
151
|
}
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
if (changes.hasOwnProperty('highlightedIndex')) {
|
|
157
|
-
setHighlightedIndex(changes.highlightedIndex);
|
|
158
|
-
}
|
|
159
|
-
/* eslint-enable no-prototype-builtins */
|
|
160
|
-
|
|
161
|
-
}
|
|
162
|
-
}, function (_ref) {
|
|
163
|
-
var _context;
|
|
164
|
-
|
|
165
|
-
var getInputProps = _ref.getInputProps,
|
|
166
|
-
getMenuProps = _ref.getMenuProps,
|
|
167
|
-
getItemProps = _ref.getItemProps,
|
|
168
|
-
getToggleButtonProps = _ref.getToggleButtonProps,
|
|
169
|
-
clearSelection = _ref.clearSelection,
|
|
170
|
-
downshiftHighlightedIndex = _ref.highlightedIndex,
|
|
171
|
-
openMenu = _ref.openMenu,
|
|
172
|
-
setDownshiftHighlightedIndex = _ref.setHighlightedIndex,
|
|
173
|
-
selectedItem = _ref.selectedItem,
|
|
174
|
-
isOpen = _ref.isOpen,
|
|
175
|
-
inputValue = _ref.inputValue;
|
|
176
|
-
var calendarItems = calendarUtils.createCalendarItems(calendarDate, intl);
|
|
177
|
-
var paddingDayCount = calendarUtils.getPaddingDayCount(calendarDate, intl.locale);
|
|
178
|
-
|
|
179
|
-
var paddingDays = _fillInstanceProperty__default['default'](_context = Array(paddingDayCount)).call(_context);
|
|
180
|
-
|
|
181
|
-
var weekdays = calendarUtils.getWeekdayNames(intl.locale);
|
|
182
|
-
var today = calendarUtils.getToday();
|
|
183
|
-
return react.jsx("div", {
|
|
184
|
-
onFocus: props.onFocus,
|
|
185
|
-
onBlur: handleBlur
|
|
186
|
-
}, react.jsx(calendarUtils.CalendarBody, {
|
|
187
|
-
inputRef: inputRef,
|
|
188
|
-
inputProps: getInputProps(_objectSpread({
|
|
189
|
-
// Unset the aria-labelledby as it interfers with the link
|
|
190
|
-
// between the <label for> and the <input id>.
|
|
191
|
-
'aria-labelledby': undefined,
|
|
192
|
-
name: props.name,
|
|
193
|
-
placeholder: typeof props.placeholder === 'string' ? props.placeholder : intl.formatMessage(messages.placeholder),
|
|
194
|
-
onMouseEnter: function onMouseEnter() {
|
|
195
|
-
// we remove the highlight so that the user can use the
|
|
196
|
-
// arrow keys to move the cursor when hovering
|
|
197
|
-
if (isOpen) setDownshiftHighlightedIndex(null);
|
|
198
|
-
},
|
|
199
|
-
onKeyDown: function onKeyDown(event) {
|
|
200
|
-
if (props.isReadOnly) {
|
|
201
|
-
preventDownshiftDefault(event);
|
|
202
|
-
return;
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
if (event.key === 'Enter' && _trimInstanceProperty__default['default'](inputValue).call(inputValue) === '') {
|
|
206
|
-
clearSelection();
|
|
207
|
-
} // ArrowDown
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
if (event.keyCode === 40) {
|
|
211
|
-
var nextDayToHighlight = calendarUtils.getNextDay(calendarItems[highlightedIndex]);
|
|
212
152
|
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
return;
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
if (highlightedIndex + 1 >= calendarItems.length) {
|
|
221
|
-
// if it's the end of the month
|
|
222
|
-
// then bypass normal arrow navigation
|
|
223
|
-
preventDownshiftDefault(event); // then jump to start of next month
|
|
224
|
-
|
|
225
|
-
jumpMonth(1, 0);
|
|
226
|
-
}
|
|
227
|
-
} // ArrowUp
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
if (event.keyCode === 38) {
|
|
231
|
-
var previousDay = calendarUtils.getPreviousDay(calendarItems[highlightedIndex]);
|
|
232
|
-
|
|
233
|
-
if (!calendarUtils.getIsDateInRange(previousDay, props.minValue, props.maxValue)) {
|
|
234
|
-
// if the date to highlight is disabled
|
|
235
|
-
// then do nothing
|
|
236
|
-
preventDownshiftDefault(event);
|
|
237
|
-
return;
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
if (highlightedIndex <= 0) {
|
|
241
|
-
// if it's the start of the month
|
|
242
|
-
// then bypass normal arrow navigation
|
|
243
|
-
preventDownshiftDefault(event);
|
|
244
|
-
var numberOfDaysOfPrevMonth = calendarUtils.getDaysInMonth(previousDay); // then jump to the last day of the previous month
|
|
153
|
+
if (changes.hasOwnProperty('highlightedIndex')) {
|
|
154
|
+
setHighlightedIndex(changes.highlightedIndex);
|
|
155
|
+
}
|
|
156
|
+
/* eslint-enable no-prototype-builtins */
|
|
245
157
|
|
|
246
|
-
jumpMonth(-1, numberOfDaysOfPrevMonth - 1);
|
|
247
|
-
}
|
|
248
|
-
}
|
|
249
|
-
},
|
|
250
|
-
// we only do this for readOnly because the input
|
|
251
|
-
// doesn't ignore these events, unlike when its disabled
|
|
252
|
-
onClick: props.isReadOnly ? undefined : openMenu
|
|
253
|
-
}, utils.filterDataAttributes(props))),
|
|
254
|
-
hasSelection: Boolean(selectedItem),
|
|
255
|
-
onClear: clearSelection,
|
|
256
|
-
isOpen: isOpen,
|
|
257
|
-
isDisabled: props.isDisabled,
|
|
258
|
-
isReadOnly: props.isReadOnly,
|
|
259
|
-
toggleButtonProps: getToggleButtonProps(),
|
|
260
|
-
hasError: props.hasError,
|
|
261
|
-
hasWarning: props.hasWarning
|
|
262
|
-
}), isOpen && !props.isDisabled && !props.isReadOnly && react.jsx(calendarUtils.CalendarMenu, _extends({}, getMenuProps(), {
|
|
263
|
-
hasError: props.hasError,
|
|
264
|
-
hasWarning: props.hasWarning
|
|
265
|
-
}), react.jsx(calendarUtils.CalendarHeader, {
|
|
266
|
-
monthLabel: calendarUtils.getMonthCalendarLabel(calendarDate, intl.locale),
|
|
267
|
-
yearLabel: calendarUtils.getYearCalendarLabel(calendarDate, intl.locale),
|
|
268
|
-
onPrevMonthClick: function onPrevMonthClick() {
|
|
269
|
-
return jumpMonth(-1);
|
|
270
158
|
},
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
159
|
+
children: function children(_ref) {
|
|
160
|
+
var _context;
|
|
161
|
+
|
|
162
|
+
var getInputProps = _ref.getInputProps,
|
|
163
|
+
getMenuProps = _ref.getMenuProps,
|
|
164
|
+
getItemProps = _ref.getItemProps,
|
|
165
|
+
getToggleButtonProps = _ref.getToggleButtonProps,
|
|
166
|
+
clearSelection = _ref.clearSelection,
|
|
167
|
+
downshiftHighlightedIndex = _ref.highlightedIndex,
|
|
168
|
+
openMenu = _ref.openMenu,
|
|
169
|
+
setDownshiftHighlightedIndex = _ref.setHighlightedIndex,
|
|
170
|
+
selectedItem = _ref.selectedItem,
|
|
171
|
+
isOpen = _ref.isOpen,
|
|
172
|
+
inputValue = _ref.inputValue;
|
|
173
|
+
var calendarItems = calendarUtils.createCalendarItems(calendarDate, intl);
|
|
174
|
+
var paddingDayCount = calendarUtils.getPaddingDayCount(calendarDate, intl.locale);
|
|
175
|
+
|
|
176
|
+
var paddingDays = _fillInstanceProperty__default["default"](_context = Array(paddingDayCount)).call(_context);
|
|
177
|
+
|
|
178
|
+
var weekdays = calendarUtils.getWeekdayNames(intl.locale);
|
|
179
|
+
var today = calendarUtils.getToday();
|
|
180
|
+
return jsxRuntime.jsxs("div", {
|
|
181
|
+
onFocus: props.onFocus,
|
|
182
|
+
onBlur: handleBlur,
|
|
183
|
+
children: [jsxRuntime.jsx(calendarUtils.CalendarBody, {
|
|
184
|
+
inputRef: inputRef,
|
|
185
|
+
inputProps: getInputProps(_objectSpread({
|
|
186
|
+
// Unset the aria-labelledby as it interfers with the link
|
|
187
|
+
// between the <label for> and the <input id>.
|
|
188
|
+
'aria-labelledby': undefined,
|
|
189
|
+
name: props.name,
|
|
190
|
+
placeholder: typeof props.placeholder === 'string' ? props.placeholder : intl.formatMessage(messages.placeholder),
|
|
191
|
+
onMouseEnter: function onMouseEnter() {
|
|
192
|
+
// we remove the highlight so that the user can use the
|
|
193
|
+
// arrow keys to move the cursor when hovering
|
|
194
|
+
if (isOpen) setDownshiftHighlightedIndex(null);
|
|
195
|
+
},
|
|
196
|
+
onKeyDown: function onKeyDown(event) {
|
|
197
|
+
if (props.isReadOnly) {
|
|
198
|
+
preventDownshiftDefault(event);
|
|
199
|
+
return;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
if (event.key === 'Enter' && _trimInstanceProperty__default["default"](inputValue).call(inputValue) === '') {
|
|
203
|
+
clearSelection();
|
|
204
|
+
} // ArrowDown
|
|
205
|
+
|
|
206
|
+
|
|
207
|
+
if (event.keyCode === 40) {
|
|
208
|
+
var nextDayToHighlight = calendarUtils.getNextDay(calendarItems[highlightedIndex]);
|
|
209
|
+
|
|
210
|
+
if (!calendarUtils.getIsDateInRange(nextDayToHighlight, props.minValue, props.maxValue)) {
|
|
211
|
+
// if the date to highlight is disabled
|
|
212
|
+
// then do nothing
|
|
213
|
+
preventDownshiftDefault(event);
|
|
214
|
+
return;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
if (highlightedIndex + 1 >= calendarItems.length) {
|
|
218
|
+
// if it's the end of the month
|
|
219
|
+
// then bypass normal arrow navigation
|
|
220
|
+
preventDownshiftDefault(event); // then jump to start of next month
|
|
221
|
+
|
|
222
|
+
jumpMonth(1, 0);
|
|
223
|
+
}
|
|
224
|
+
} // ArrowUp
|
|
225
|
+
|
|
226
|
+
|
|
227
|
+
if (event.keyCode === 38) {
|
|
228
|
+
var previousDay = calendarUtils.getPreviousDay(calendarItems[highlightedIndex]);
|
|
229
|
+
|
|
230
|
+
if (!calendarUtils.getIsDateInRange(previousDay, props.minValue, props.maxValue)) {
|
|
231
|
+
// if the date to highlight is disabled
|
|
232
|
+
// then do nothing
|
|
233
|
+
preventDownshiftDefault(event);
|
|
234
|
+
return;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
if (highlightedIndex <= 0) {
|
|
238
|
+
// if it's the start of the month
|
|
239
|
+
// then bypass normal arrow navigation
|
|
240
|
+
preventDownshiftDefault(event);
|
|
241
|
+
var numberOfDaysOfPrevMonth = calendarUtils.getDaysInMonth(previousDay); // then jump to the last day of the previous month
|
|
242
|
+
|
|
243
|
+
jumpMonth(-1, numberOfDaysOfPrevMonth - 1);
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
},
|
|
247
|
+
// we only do this for readOnly because the input
|
|
248
|
+
// doesn't ignore these events, unlike when its disabled
|
|
249
|
+
onClick: props.isReadOnly ? undefined : openMenu
|
|
250
|
+
}, utils.filterDataAttributes(props))),
|
|
251
|
+
hasSelection: Boolean(selectedItem),
|
|
252
|
+
onClear: clearSelection,
|
|
253
|
+
isOpen: isOpen,
|
|
254
|
+
isDisabled: props.isDisabled,
|
|
255
|
+
isReadOnly: props.isReadOnly,
|
|
256
|
+
toggleButtonProps: getToggleButtonProps(),
|
|
257
|
+
hasError: props.hasError,
|
|
258
|
+
hasWarning: props.hasWarning
|
|
259
|
+
}), isOpen && !props.isDisabled && !props.isReadOnly && jsxRuntime.jsxs(calendarUtils.CalendarMenu, _objectSpread(_objectSpread({}, getMenuProps()), {}, {
|
|
260
|
+
hasError: props.hasError,
|
|
261
|
+
hasWarning: props.hasWarning,
|
|
262
|
+
children: [jsxRuntime.jsx(calendarUtils.CalendarHeader, {
|
|
263
|
+
monthLabel: calendarUtils.getMonthCalendarLabel(calendarDate, intl.locale),
|
|
264
|
+
yearLabel: calendarUtils.getYearCalendarLabel(calendarDate, intl.locale),
|
|
265
|
+
onPrevMonthClick: function onPrevMonthClick() {
|
|
266
|
+
return jumpMonth(-1);
|
|
267
|
+
},
|
|
268
|
+
onTodayClick: showToday,
|
|
269
|
+
onNextMonthClick: function onNextMonthClick() {
|
|
270
|
+
return jumpMonth(1);
|
|
271
|
+
},
|
|
272
|
+
onPrevYearClick: function onPrevYearClick() {
|
|
273
|
+
return jumpMonth(-12);
|
|
274
|
+
},
|
|
275
|
+
onNextYearClick: function onNextYearClick() {
|
|
276
|
+
return jumpMonth(12);
|
|
277
|
+
}
|
|
278
|
+
}), jsxRuntime.jsxs(calendarUtils.CalendarContent, {
|
|
279
|
+
children: [_mapInstanceProperty__default["default"](weekdays).call(weekdays, function (weekday) {
|
|
280
|
+
return jsxRuntime.jsx(calendarUtils.CalendarDay, {
|
|
281
|
+
type: "heading",
|
|
282
|
+
children: weekday
|
|
283
|
+
}, weekday);
|
|
284
|
+
}), _mapInstanceProperty__default["default"](paddingDays).call(paddingDays, function (day, index) {
|
|
285
|
+
return jsxRuntime.jsx(calendarUtils.CalendarDay, {
|
|
286
|
+
type: "spacing"
|
|
287
|
+
}, index);
|
|
288
|
+
}), _mapInstanceProperty__default["default"](calendarItems).call(calendarItems, function (item, index) {
|
|
289
|
+
return jsxRuntime.jsx(calendarUtils.CalendarDay, _objectSpread(_objectSpread({
|
|
290
|
+
isToday: calendarUtils.isSameDay(today, item)
|
|
291
|
+
}, getItemProps({
|
|
292
|
+
disabled: !calendarUtils.getIsDateInRange(item, props.minValue, props.maxValue),
|
|
293
|
+
item: item,
|
|
294
|
+
onMouseOut: function onMouseOut() {
|
|
295
|
+
setDownshiftHighlightedIndex(null);
|
|
296
|
+
}
|
|
297
|
+
})), {}, {
|
|
298
|
+
isHighlighted: index === downshiftHighlightedIndex,
|
|
299
|
+
isSelected: calendarUtils.isSameDay(item, props.value),
|
|
300
|
+
children: calendarUtils.getCalendarDayLabel(item)
|
|
301
|
+
}), item);
|
|
302
|
+
})]
|
|
303
|
+
})]
|
|
304
|
+
}))]
|
|
305
|
+
});
|
|
280
306
|
}
|
|
281
|
-
}
|
|
282
|
-
|
|
283
|
-
key: weekday,
|
|
284
|
-
type: "heading"
|
|
285
|
-
}, weekday);
|
|
286
|
-
}), _mapInstanceProperty__default['default'](paddingDays).call(paddingDays, function (day, index) {
|
|
287
|
-
return react.jsx(calendarUtils.CalendarDay, {
|
|
288
|
-
key: index,
|
|
289
|
-
type: "spacing"
|
|
290
|
-
});
|
|
291
|
-
}), _mapInstanceProperty__default['default'](calendarItems).call(calendarItems, function (item, index) {
|
|
292
|
-
return react.jsx(calendarUtils.CalendarDay, _extends({
|
|
293
|
-
key: item,
|
|
294
|
-
isToday: calendarUtils.isSameDay(today, item)
|
|
295
|
-
}, getItemProps({
|
|
296
|
-
disabled: !calendarUtils.getIsDateInRange(item, props.minValue, props.maxValue),
|
|
297
|
-
item: item,
|
|
298
|
-
onMouseOut: function onMouseOut() {
|
|
299
|
-
setDownshiftHighlightedIndex(null);
|
|
300
|
-
}
|
|
301
|
-
}), {
|
|
302
|
-
isHighlighted: index === downshiftHighlightedIndex,
|
|
303
|
-
isSelected: calendarUtils.isSameDay(item, props.value)
|
|
304
|
-
}), calendarUtils.getCalendarDayLabel(item));
|
|
305
|
-
}))));
|
|
306
|
-
}));
|
|
307
|
+
}, intl.locale)
|
|
308
|
+
});
|
|
307
309
|
};
|
|
308
310
|
|
|
309
311
|
DateInput.displayName = 'DateInput';
|
|
@@ -315,8 +317,8 @@ DateInput.isEmpty = function (value) {
|
|
|
315
317
|
DateInput.propTypes = {};
|
|
316
318
|
var DateInput$1 = DateInput;
|
|
317
319
|
|
|
318
|
-
// NOTE: This string will be replaced
|
|
319
|
-
var version =
|
|
320
|
+
// NOTE: This string will be replaced on build time with the package version.
|
|
321
|
+
var version = "12.2.6";
|
|
320
322
|
|
|
321
|
-
exports[
|
|
323
|
+
exports["default"] = DateInput$1;
|
|
322
324
|
exports.version = version;
|