@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.
|
@@ -6,20 +6,19 @@ import _forEachInstanceProperty from '@babel/runtime-corejs3/core-js-stable/inst
|
|
|
6
6
|
import _Object$getOwnPropertyDescriptors from '@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors';
|
|
7
7
|
import _Object$defineProperties from '@babel/runtime-corejs3/core-js-stable/object/define-properties';
|
|
8
8
|
import _Object$defineProperty from '@babel/runtime-corejs3/core-js-stable/object/define-property';
|
|
9
|
-
import _extends from '@babel/runtime-corejs3/helpers/esm/extends';
|
|
10
9
|
import _defineProperty from '@babel/runtime-corejs3/helpers/esm/defineProperty';
|
|
11
10
|
import _slicedToArray from '@babel/runtime-corejs3/helpers/esm/slicedToArray';
|
|
12
11
|
import _fillInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/fill';
|
|
13
12
|
import _trimInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/trim';
|
|
14
13
|
import _mapInstanceProperty from '@babel/runtime-corejs3/core-js-stable/instance/map';
|
|
15
|
-
import
|
|
14
|
+
import { useState, useRef, useCallback } from 'react';
|
|
16
15
|
import PropTypes from 'prop-types';
|
|
17
16
|
import Downshift from 'downshift';
|
|
18
17
|
import { defineMessages, useIntl } from 'react-intl';
|
|
19
18
|
import Constraints from '@commercetools-uikit/constraints';
|
|
20
19
|
import { filterDataAttributes } from '@commercetools-uikit/utils';
|
|
21
20
|
import { getToday, getDateInMonth, createItemToString, parseInputToDate, getIsDateInRange, createCalendarItems, getPaddingDayCount, getWeekdayNames, CalendarBody, getNextDay, getPreviousDay, getDaysInMonth, CalendarMenu, CalendarHeader, getMonthCalendarLabel, getYearCalendarLabel, CalendarContent, CalendarDay, isSameDay, getCalendarDayLabel, changeMonth } from '@commercetools-uikit/calendar-utils';
|
|
22
|
-
import { jsx } from '@emotion/react';
|
|
21
|
+
import { jsx, jsxs } from '@emotion/react/jsx-runtime';
|
|
23
22
|
|
|
24
23
|
var messages = defineMessages({
|
|
25
24
|
placeholder: {
|
|
@@ -41,24 +40,24 @@ var preventDownshiftDefault = function preventDownshiftDefault(event) {
|
|
|
41
40
|
var DateInput = function DateInput(props) {
|
|
42
41
|
var intl = useIntl();
|
|
43
42
|
|
|
44
|
-
var
|
|
45
|
-
|
|
46
|
-
calendarDate =
|
|
47
|
-
setCalendarDate =
|
|
43
|
+
var _useState = useState(props.value || getToday()),
|
|
44
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
45
|
+
calendarDate = _useState2[0],
|
|
46
|
+
setCalendarDate = _useState2[1];
|
|
48
47
|
|
|
49
|
-
var
|
|
50
|
-
|
|
51
|
-
suggestedItems =
|
|
52
|
-
setSuggestedItems =
|
|
48
|
+
var _useState3 = useState([]),
|
|
49
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
50
|
+
suggestedItems = _useState4[0],
|
|
51
|
+
setSuggestedItems = _useState4[1];
|
|
53
52
|
|
|
54
|
-
var
|
|
55
|
-
|
|
56
|
-
highlightedIndex =
|
|
57
|
-
setHighlightedIndex =
|
|
53
|
+
var _useState5 = useState(props.value === '' ? null : getDateInMonth(props.value) - 1),
|
|
54
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
55
|
+
highlightedIndex = _useState6[0],
|
|
56
|
+
setHighlightedIndex = _useState6[1];
|
|
58
57
|
|
|
59
|
-
var inputRef =
|
|
58
|
+
var inputRef = useRef();
|
|
60
59
|
var onChange = props.onChange;
|
|
61
|
-
var emit =
|
|
60
|
+
var emit = useCallback(function (value) {
|
|
62
61
|
return onChange({
|
|
63
62
|
target: {
|
|
64
63
|
id: props.id,
|
|
@@ -69,12 +68,12 @@ var DateInput = function DateInput(props) {
|
|
|
69
68
|
}
|
|
70
69
|
});
|
|
71
70
|
}, [onChange, props.id, props.name]);
|
|
72
|
-
var handleChange =
|
|
71
|
+
var handleChange = useCallback(function (date) {
|
|
73
72
|
inputRef.current.setSelectionRange(0, 100);
|
|
74
73
|
emit(date);
|
|
75
74
|
}, [inputRef, emit]);
|
|
76
75
|
var onBlur = props.onBlur;
|
|
77
|
-
var handleBlur =
|
|
76
|
+
var handleBlur = useCallback(function () {
|
|
78
77
|
if (onBlur) onBlur({
|
|
79
78
|
target: {
|
|
80
79
|
id: props.id,
|
|
@@ -98,191 +97,195 @@ var DateInput = function DateInput(props) {
|
|
|
98
97
|
};
|
|
99
98
|
|
|
100
99
|
return jsx(Constraints.Horizontal, {
|
|
101
|
-
max: props.horizontalConstraint
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
100
|
+
max: props.horizontalConstraint,
|
|
101
|
+
children: jsx(Downshift, {
|
|
102
|
+
inputId: props.id,
|
|
103
|
+
itemToString: createItemToString(intl.locale),
|
|
104
|
+
selectedItem: props.value === '' ? null : props.value,
|
|
105
|
+
highlightedIndex: highlightedIndex,
|
|
106
|
+
onChange: handleChange,
|
|
107
|
+
onStateChange: function onStateChange(changes) {
|
|
108
|
+
/* eslint-disable no-prototype-builtins */
|
|
109
|
+
if (changes.hasOwnProperty('inputValue')) {
|
|
110
|
+
// input changed because user typed
|
|
111
|
+
if (changes.type === Downshift.stateChangeTypes.changeInput) {
|
|
112
|
+
var date = parseInputToDate(changes.inputValue, intl.locale);
|
|
113
|
+
|
|
114
|
+
if (date === '') {
|
|
115
|
+
setSuggestedItems([]);
|
|
116
|
+
setHighlightedIndex(null);
|
|
117
|
+
} else {
|
|
118
|
+
setSuggestedItems([date]);
|
|
119
|
+
|
|
120
|
+
if (getIsDateInRange(date, props.minValue, props.maxValue)) {
|
|
121
|
+
setHighlightedIndex(getDateInMonth(date) - 1);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
setCalendarDate(date);
|
|
125
|
+
}
|
|
126
|
+
} else {
|
|
127
|
+
// input changed because user selected a date
|
|
117
128
|
setSuggestedItems([]);
|
|
118
129
|
setHighlightedIndex(null);
|
|
119
|
-
} else {
|
|
120
|
-
setSuggestedItems([date]);
|
|
121
|
-
|
|
122
|
-
if (getIsDateInRange(date, props.minValue, props.maxValue)) {
|
|
123
|
-
setHighlightedIndex(getDateInMonth(date) - 1);
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
setCalendarDate(date);
|
|
127
130
|
}
|
|
128
|
-
} else {
|
|
129
|
-
// input changed because user selected a date
|
|
130
|
-
setSuggestedItems([]);
|
|
131
|
-
setHighlightedIndex(null);
|
|
132
131
|
}
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
if (changes.hasOwnProperty('highlightedIndex')) {
|
|
136
|
-
setHighlightedIndex(changes.highlightedIndex);
|
|
137
|
-
}
|
|
138
|
-
/* eslint-enable no-prototype-builtins */
|
|
139
|
-
|
|
140
|
-
}
|
|
141
|
-
}, function (_ref) {
|
|
142
|
-
var _context;
|
|
143
|
-
|
|
144
|
-
var getInputProps = _ref.getInputProps,
|
|
145
|
-
getMenuProps = _ref.getMenuProps,
|
|
146
|
-
getItemProps = _ref.getItemProps,
|
|
147
|
-
getToggleButtonProps = _ref.getToggleButtonProps,
|
|
148
|
-
clearSelection = _ref.clearSelection,
|
|
149
|
-
downshiftHighlightedIndex = _ref.highlightedIndex,
|
|
150
|
-
openMenu = _ref.openMenu,
|
|
151
|
-
setDownshiftHighlightedIndex = _ref.setHighlightedIndex,
|
|
152
|
-
selectedItem = _ref.selectedItem,
|
|
153
|
-
isOpen = _ref.isOpen,
|
|
154
|
-
inputValue = _ref.inputValue;
|
|
155
|
-
var calendarItems = createCalendarItems(calendarDate, intl);
|
|
156
|
-
var paddingDayCount = getPaddingDayCount(calendarDate, intl.locale);
|
|
157
|
-
|
|
158
|
-
var paddingDays = _fillInstanceProperty(_context = Array(paddingDayCount)).call(_context);
|
|
159
|
-
|
|
160
|
-
var weekdays = getWeekdayNames(intl.locale);
|
|
161
|
-
var today = getToday();
|
|
162
|
-
return jsx("div", {
|
|
163
|
-
onFocus: props.onFocus,
|
|
164
|
-
onBlur: handleBlur
|
|
165
|
-
}, jsx(CalendarBody, {
|
|
166
|
-
inputRef: inputRef,
|
|
167
|
-
inputProps: getInputProps(_objectSpread({
|
|
168
|
-
// Unset the aria-labelledby as it interfers with the link
|
|
169
|
-
// between the <label for> and the <input id>.
|
|
170
|
-
'aria-labelledby': undefined,
|
|
171
|
-
name: props.name,
|
|
172
|
-
placeholder: typeof props.placeholder === 'string' ? props.placeholder : intl.formatMessage(messages.placeholder),
|
|
173
|
-
onMouseEnter: function onMouseEnter() {
|
|
174
|
-
// we remove the highlight so that the user can use the
|
|
175
|
-
// arrow keys to move the cursor when hovering
|
|
176
|
-
if (isOpen) setDownshiftHighlightedIndex(null);
|
|
177
|
-
},
|
|
178
|
-
onKeyDown: function onKeyDown(event) {
|
|
179
|
-
if (props.isReadOnly) {
|
|
180
|
-
preventDownshiftDefault(event);
|
|
181
|
-
return;
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
if (event.key === 'Enter' && _trimInstanceProperty(inputValue).call(inputValue) === '') {
|
|
185
|
-
clearSelection();
|
|
186
|
-
} // ArrowDown
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
if (event.keyCode === 40) {
|
|
190
|
-
var nextDayToHighlight = getNextDay(calendarItems[highlightedIndex]);
|
|
191
132
|
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
return;
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
if (highlightedIndex + 1 >= calendarItems.length) {
|
|
200
|
-
// if it's the end of the month
|
|
201
|
-
// then bypass normal arrow navigation
|
|
202
|
-
preventDownshiftDefault(event); // then jump to start of next month
|
|
203
|
-
|
|
204
|
-
jumpMonth(1, 0);
|
|
205
|
-
}
|
|
206
|
-
} // ArrowUp
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
if (event.keyCode === 38) {
|
|
210
|
-
var previousDay = getPreviousDay(calendarItems[highlightedIndex]);
|
|
211
|
-
|
|
212
|
-
if (!getIsDateInRange(previousDay, props.minValue, props.maxValue)) {
|
|
213
|
-
// if the date to highlight is disabled
|
|
214
|
-
// then do nothing
|
|
215
|
-
preventDownshiftDefault(event);
|
|
216
|
-
return;
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
if (highlightedIndex <= 0) {
|
|
220
|
-
// if it's the start of the month
|
|
221
|
-
// then bypass normal arrow navigation
|
|
222
|
-
preventDownshiftDefault(event);
|
|
223
|
-
var numberOfDaysOfPrevMonth = getDaysInMonth(previousDay); // then jump to the last day of the previous month
|
|
133
|
+
if (changes.hasOwnProperty('highlightedIndex')) {
|
|
134
|
+
setHighlightedIndex(changes.highlightedIndex);
|
|
135
|
+
}
|
|
136
|
+
/* eslint-enable no-prototype-builtins */
|
|
224
137
|
|
|
225
|
-
jumpMonth(-1, numberOfDaysOfPrevMonth - 1);
|
|
226
|
-
}
|
|
227
|
-
}
|
|
228
|
-
},
|
|
229
|
-
// we only do this for readOnly because the input
|
|
230
|
-
// doesn't ignore these events, unlike when its disabled
|
|
231
|
-
onClick: props.isReadOnly ? undefined : openMenu
|
|
232
|
-
}, filterDataAttributes(props))),
|
|
233
|
-
hasSelection: Boolean(selectedItem),
|
|
234
|
-
onClear: clearSelection,
|
|
235
|
-
isOpen: isOpen,
|
|
236
|
-
isDisabled: props.isDisabled,
|
|
237
|
-
isReadOnly: props.isReadOnly,
|
|
238
|
-
toggleButtonProps: getToggleButtonProps(),
|
|
239
|
-
hasError: props.hasError,
|
|
240
|
-
hasWarning: props.hasWarning
|
|
241
|
-
}), isOpen && !props.isDisabled && !props.isReadOnly && jsx(CalendarMenu, _extends({}, getMenuProps(), {
|
|
242
|
-
hasError: props.hasError,
|
|
243
|
-
hasWarning: props.hasWarning
|
|
244
|
-
}), jsx(CalendarHeader, {
|
|
245
|
-
monthLabel: getMonthCalendarLabel(calendarDate, intl.locale),
|
|
246
|
-
yearLabel: getYearCalendarLabel(calendarDate, intl.locale),
|
|
247
|
-
onPrevMonthClick: function onPrevMonthClick() {
|
|
248
|
-
return jumpMonth(-1);
|
|
249
138
|
},
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
139
|
+
children: function children(_ref) {
|
|
140
|
+
var _context;
|
|
141
|
+
|
|
142
|
+
var getInputProps = _ref.getInputProps,
|
|
143
|
+
getMenuProps = _ref.getMenuProps,
|
|
144
|
+
getItemProps = _ref.getItemProps,
|
|
145
|
+
getToggleButtonProps = _ref.getToggleButtonProps,
|
|
146
|
+
clearSelection = _ref.clearSelection,
|
|
147
|
+
downshiftHighlightedIndex = _ref.highlightedIndex,
|
|
148
|
+
openMenu = _ref.openMenu,
|
|
149
|
+
setDownshiftHighlightedIndex = _ref.setHighlightedIndex,
|
|
150
|
+
selectedItem = _ref.selectedItem,
|
|
151
|
+
isOpen = _ref.isOpen,
|
|
152
|
+
inputValue = _ref.inputValue;
|
|
153
|
+
var calendarItems = createCalendarItems(calendarDate, intl);
|
|
154
|
+
var paddingDayCount = getPaddingDayCount(calendarDate, intl.locale);
|
|
155
|
+
|
|
156
|
+
var paddingDays = _fillInstanceProperty(_context = Array(paddingDayCount)).call(_context);
|
|
157
|
+
|
|
158
|
+
var weekdays = getWeekdayNames(intl.locale);
|
|
159
|
+
var today = getToday();
|
|
160
|
+
return jsxs("div", {
|
|
161
|
+
onFocus: props.onFocus,
|
|
162
|
+
onBlur: handleBlur,
|
|
163
|
+
children: [jsx(CalendarBody, {
|
|
164
|
+
inputRef: inputRef,
|
|
165
|
+
inputProps: getInputProps(_objectSpread({
|
|
166
|
+
// Unset the aria-labelledby as it interfers with the link
|
|
167
|
+
// between the <label for> and the <input id>.
|
|
168
|
+
'aria-labelledby': undefined,
|
|
169
|
+
name: props.name,
|
|
170
|
+
placeholder: typeof props.placeholder === 'string' ? props.placeholder : intl.formatMessage(messages.placeholder),
|
|
171
|
+
onMouseEnter: function onMouseEnter() {
|
|
172
|
+
// we remove the highlight so that the user can use the
|
|
173
|
+
// arrow keys to move the cursor when hovering
|
|
174
|
+
if (isOpen) setDownshiftHighlightedIndex(null);
|
|
175
|
+
},
|
|
176
|
+
onKeyDown: function onKeyDown(event) {
|
|
177
|
+
if (props.isReadOnly) {
|
|
178
|
+
preventDownshiftDefault(event);
|
|
179
|
+
return;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
if (event.key === 'Enter' && _trimInstanceProperty(inputValue).call(inputValue) === '') {
|
|
183
|
+
clearSelection();
|
|
184
|
+
} // ArrowDown
|
|
185
|
+
|
|
186
|
+
|
|
187
|
+
if (event.keyCode === 40) {
|
|
188
|
+
var nextDayToHighlight = getNextDay(calendarItems[highlightedIndex]);
|
|
189
|
+
|
|
190
|
+
if (!getIsDateInRange(nextDayToHighlight, props.minValue, props.maxValue)) {
|
|
191
|
+
// if the date to highlight is disabled
|
|
192
|
+
// then do nothing
|
|
193
|
+
preventDownshiftDefault(event);
|
|
194
|
+
return;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
if (highlightedIndex + 1 >= calendarItems.length) {
|
|
198
|
+
// if it's the end of the month
|
|
199
|
+
// then bypass normal arrow navigation
|
|
200
|
+
preventDownshiftDefault(event); // then jump to start of next month
|
|
201
|
+
|
|
202
|
+
jumpMonth(1, 0);
|
|
203
|
+
}
|
|
204
|
+
} // ArrowUp
|
|
205
|
+
|
|
206
|
+
|
|
207
|
+
if (event.keyCode === 38) {
|
|
208
|
+
var previousDay = getPreviousDay(calendarItems[highlightedIndex]);
|
|
209
|
+
|
|
210
|
+
if (!getIsDateInRange(previousDay, 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 <= 0) {
|
|
218
|
+
// if it's the start of the month
|
|
219
|
+
// then bypass normal arrow navigation
|
|
220
|
+
preventDownshiftDefault(event);
|
|
221
|
+
var numberOfDaysOfPrevMonth = getDaysInMonth(previousDay); // then jump to the last day of the previous month
|
|
222
|
+
|
|
223
|
+
jumpMonth(-1, numberOfDaysOfPrevMonth - 1);
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
},
|
|
227
|
+
// we only do this for readOnly because the input
|
|
228
|
+
// doesn't ignore these events, unlike when its disabled
|
|
229
|
+
onClick: props.isReadOnly ? undefined : openMenu
|
|
230
|
+
}, filterDataAttributes(props))),
|
|
231
|
+
hasSelection: Boolean(selectedItem),
|
|
232
|
+
onClear: clearSelection,
|
|
233
|
+
isOpen: isOpen,
|
|
234
|
+
isDisabled: props.isDisabled,
|
|
235
|
+
isReadOnly: props.isReadOnly,
|
|
236
|
+
toggleButtonProps: getToggleButtonProps(),
|
|
237
|
+
hasError: props.hasError,
|
|
238
|
+
hasWarning: props.hasWarning
|
|
239
|
+
}), isOpen && !props.isDisabled && !props.isReadOnly && jsxs(CalendarMenu, _objectSpread(_objectSpread({}, getMenuProps()), {}, {
|
|
240
|
+
hasError: props.hasError,
|
|
241
|
+
hasWarning: props.hasWarning,
|
|
242
|
+
children: [jsx(CalendarHeader, {
|
|
243
|
+
monthLabel: getMonthCalendarLabel(calendarDate, intl.locale),
|
|
244
|
+
yearLabel: getYearCalendarLabel(calendarDate, intl.locale),
|
|
245
|
+
onPrevMonthClick: function onPrevMonthClick() {
|
|
246
|
+
return jumpMonth(-1);
|
|
247
|
+
},
|
|
248
|
+
onTodayClick: showToday,
|
|
249
|
+
onNextMonthClick: function onNextMonthClick() {
|
|
250
|
+
return jumpMonth(1);
|
|
251
|
+
},
|
|
252
|
+
onPrevYearClick: function onPrevYearClick() {
|
|
253
|
+
return jumpMonth(-12);
|
|
254
|
+
},
|
|
255
|
+
onNextYearClick: function onNextYearClick() {
|
|
256
|
+
return jumpMonth(12);
|
|
257
|
+
}
|
|
258
|
+
}), jsxs(CalendarContent, {
|
|
259
|
+
children: [_mapInstanceProperty(weekdays).call(weekdays, function (weekday) {
|
|
260
|
+
return jsx(CalendarDay, {
|
|
261
|
+
type: "heading",
|
|
262
|
+
children: weekday
|
|
263
|
+
}, weekday);
|
|
264
|
+
}), _mapInstanceProperty(paddingDays).call(paddingDays, function (day, index) {
|
|
265
|
+
return jsx(CalendarDay, {
|
|
266
|
+
type: "spacing"
|
|
267
|
+
}, index);
|
|
268
|
+
}), _mapInstanceProperty(calendarItems).call(calendarItems, function (item, index) {
|
|
269
|
+
return jsx(CalendarDay, _objectSpread(_objectSpread({
|
|
270
|
+
isToday: isSameDay(today, item)
|
|
271
|
+
}, getItemProps({
|
|
272
|
+
disabled: !getIsDateInRange(item, props.minValue, props.maxValue),
|
|
273
|
+
item: item,
|
|
274
|
+
onMouseOut: function onMouseOut() {
|
|
275
|
+
setDownshiftHighlightedIndex(null);
|
|
276
|
+
}
|
|
277
|
+
})), {}, {
|
|
278
|
+
isHighlighted: index === downshiftHighlightedIndex,
|
|
279
|
+
isSelected: isSameDay(item, props.value),
|
|
280
|
+
children: getCalendarDayLabel(item)
|
|
281
|
+
}), item);
|
|
282
|
+
})]
|
|
283
|
+
})]
|
|
284
|
+
}))]
|
|
285
|
+
});
|
|
259
286
|
}
|
|
260
|
-
}
|
|
261
|
-
|
|
262
|
-
key: weekday,
|
|
263
|
-
type: "heading"
|
|
264
|
-
}, weekday);
|
|
265
|
-
}), _mapInstanceProperty(paddingDays).call(paddingDays, function (day, index) {
|
|
266
|
-
return jsx(CalendarDay, {
|
|
267
|
-
key: index,
|
|
268
|
-
type: "spacing"
|
|
269
|
-
});
|
|
270
|
-
}), _mapInstanceProperty(calendarItems).call(calendarItems, function (item, index) {
|
|
271
|
-
return jsx(CalendarDay, _extends({
|
|
272
|
-
key: item,
|
|
273
|
-
isToday: isSameDay(today, item)
|
|
274
|
-
}, getItemProps({
|
|
275
|
-
disabled: !getIsDateInRange(item, props.minValue, props.maxValue),
|
|
276
|
-
item: item,
|
|
277
|
-
onMouseOut: function onMouseOut() {
|
|
278
|
-
setDownshiftHighlightedIndex(null);
|
|
279
|
-
}
|
|
280
|
-
}), {
|
|
281
|
-
isHighlighted: index === downshiftHighlightedIndex,
|
|
282
|
-
isSelected: isSameDay(item, props.value)
|
|
283
|
-
}), getCalendarDayLabel(item));
|
|
284
|
-
}))));
|
|
285
|
-
}));
|
|
287
|
+
}, intl.locale)
|
|
288
|
+
});
|
|
286
289
|
};
|
|
287
290
|
|
|
288
291
|
DateInput.displayName = 'DateInput';
|
|
@@ -366,7 +369,7 @@ DateInput.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
|
366
369
|
} : {};
|
|
367
370
|
var DateInput$1 = DateInput;
|
|
368
371
|
|
|
369
|
-
// NOTE: This string will be replaced
|
|
370
|
-
var version =
|
|
372
|
+
// NOTE: This string will be replaced on build time with the package version.
|
|
373
|
+
var version = "12.2.6";
|
|
371
374
|
|
|
372
375
|
export { DateInput$1 as default, version };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@commercetools-uikit/date-input",
|
|
3
3
|
"description": "The `DateInput` component allows the user to select a date. It formats the selected date depending on the users' locale.",
|
|
4
|
-
"version": "12.2.
|
|
4
|
+
"version": "12.2.6",
|
|
5
5
|
"bugs": "https://github.com/commercetools/ui-kit/issues",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -11,7 +11,6 @@
|
|
|
11
11
|
"homepage": "https://uikit.commercetools.com",
|
|
12
12
|
"keywords": ["javascript", "design system", "react", "uikit"],
|
|
13
13
|
"license": "MIT",
|
|
14
|
-
"private": false,
|
|
15
14
|
"publishConfig": {
|
|
16
15
|
"access": "public"
|
|
17
16
|
},
|
|
@@ -19,28 +18,25 @@
|
|
|
19
18
|
"main": "dist/commercetools-uikit-date-input.cjs.js",
|
|
20
19
|
"module": "dist/commercetools-uikit-date-input.esm.js",
|
|
21
20
|
"files": ["dist"],
|
|
22
|
-
"scripts": {
|
|
23
|
-
"prepare": "../../../../scripts/version.js replace"
|
|
24
|
-
},
|
|
25
21
|
"dependencies": {
|
|
26
|
-
"@babel/runtime": "7.
|
|
27
|
-
"@babel/runtime-corejs3": "7.
|
|
28
|
-
"@commercetools-uikit/accessible-button": "12.2.
|
|
29
|
-
"@commercetools-uikit/calendar-utils": "12.2.
|
|
30
|
-
"@commercetools-uikit/constraints": "12.2.
|
|
31
|
-
"@commercetools-uikit/design-system": "12.2.
|
|
32
|
-
"@commercetools-uikit/hooks": "12.2.
|
|
33
|
-
"@commercetools-uikit/icons": "12.2.
|
|
34
|
-
"@commercetools-uikit/secondary-icon-button": "12.2.
|
|
35
|
-
"@commercetools-uikit/select-utils": "12.2.
|
|
36
|
-
"@commercetools-uikit/spacings-inline": "12.2.
|
|
37
|
-
"@commercetools-uikit/text": "12.2.
|
|
38
|
-
"@commercetools-uikit/tooltip": "12.2.
|
|
39
|
-
"@commercetools-uikit/utils": "12.2.
|
|
22
|
+
"@babel/runtime": "7.16.3",
|
|
23
|
+
"@babel/runtime-corejs3": "7.16.3",
|
|
24
|
+
"@commercetools-uikit/accessible-button": "12.2.5",
|
|
25
|
+
"@commercetools-uikit/calendar-utils": "12.2.6",
|
|
26
|
+
"@commercetools-uikit/constraints": "12.2.5",
|
|
27
|
+
"@commercetools-uikit/design-system": "12.2.5",
|
|
28
|
+
"@commercetools-uikit/hooks": "12.2.5",
|
|
29
|
+
"@commercetools-uikit/icons": "12.2.6",
|
|
30
|
+
"@commercetools-uikit/secondary-icon-button": "12.2.5",
|
|
31
|
+
"@commercetools-uikit/select-utils": "12.2.6",
|
|
32
|
+
"@commercetools-uikit/spacings-inline": "12.2.5",
|
|
33
|
+
"@commercetools-uikit/text": "12.2.5",
|
|
34
|
+
"@commercetools-uikit/tooltip": "12.2.5",
|
|
35
|
+
"@commercetools-uikit/utils": "12.2.5",
|
|
40
36
|
"@emotion/react": "^11.4.0",
|
|
41
37
|
"@emotion/styled": "^11.3.0",
|
|
42
|
-
"common-tags": "1.8.
|
|
43
|
-
"downshift": "6.1.
|
|
38
|
+
"common-tags": "1.8.2",
|
|
39
|
+
"downshift": "6.1.7",
|
|
44
40
|
"prop-types": "15.7.2",
|
|
45
41
|
"react-is": "17.0.2",
|
|
46
42
|
"react-required-if": "1.0.3",
|
|
@@ -49,7 +45,7 @@
|
|
|
49
45
|
"devDependencies": {
|
|
50
46
|
"moment": "2.29.1",
|
|
51
47
|
"react": "17.0.2",
|
|
52
|
-
"react-intl": "5.
|
|
48
|
+
"react-intl": "5.21.2"
|
|
53
49
|
},
|
|
54
50
|
"peerDependencies": {
|
|
55
51
|
"moment": "2.x",
|