rsuite 5.48.1 → 5.49.0
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.
- package/CHANGELOG.md +14 -0
- package/Cascader/styles/index.less +1 -0
- package/DatePicker/styles/index.less +18 -11
- package/DateRangeInput/package.json +7 -0
- package/DateRangePicker/styles/index.less +10 -0
- package/InputGroup/styles/index.less +1 -0
- package/Picker/styles/index.less +20 -0
- package/README.md +32 -22
- package/Sidenav/styles/index.less +2 -0
- package/cjs/Calendar/CalendarContainer.d.ts +2 -0
- package/cjs/Calendar/CalendarContainer.js +11 -4
- package/cjs/Calendar/CalendarHeader.js +2 -0
- package/cjs/Calendar/MonthDropdown.js +7 -2
- package/cjs/Calendar/MonthDropdownItem.js +2 -2
- package/cjs/Calendar/Table.js +6 -1
- package/cjs/Calendar/TimeDropdown.js +17 -10
- package/cjs/Calendar/types.d.ts +1 -0
- package/cjs/CustomProvider/CustomProvider.d.ts +13 -0
- package/cjs/CustomProvider/CustomProvider.js +2 -2
- package/cjs/DateInput/DateField.d.ts +9 -31
- package/cjs/DateInput/DateField.js +61 -12
- package/cjs/DateInput/DateInput.d.ts +7 -2
- package/cjs/DateInput/DateInput.js +74 -92
- package/cjs/DateInput/index.d.ts +4 -0
- package/cjs/DateInput/index.js +19 -1
- package/cjs/DateInput/useDateInputState.d.ts +7 -31
- package/cjs/DateInput/useDateInputState.js +39 -15
- package/cjs/DateInput/useIsFocused.d.ts +7 -0
- package/cjs/DateInput/useIsFocused.js +28 -0
- package/cjs/DateInput/useKeyboardInputEvent.d.ts +10 -0
- package/cjs/DateInput/useKeyboardInputEvent.js +44 -0
- package/cjs/DateInput/utils.d.ts +23 -1
- package/cjs/DateInput/utils.js +155 -51
- package/cjs/DatePicker/DatePicker.d.ts +20 -7
- package/cjs/DatePicker/DatePicker.js +210 -241
- package/cjs/DatePicker/PickerIndicator.d.ts +10 -0
- package/cjs/DatePicker/PickerIndicator.js +48 -0
- package/cjs/DatePicker/PickerLabel.d.ts +9 -0
- package/cjs/DatePicker/PickerLabel.js +23 -0
- package/cjs/DatePicker/Toolbar.js +3 -21
- package/cjs/DatePicker/utils.d.ts +5 -1
- package/cjs/DatePicker/utils.js +17 -1
- package/cjs/DateRangeInput/DateRangeInput.d.ts +29 -0
- package/cjs/DateRangeInput/DateRangeInput.js +244 -0
- package/cjs/DateRangeInput/index.d.ts +3 -0
- package/cjs/DateRangeInput/index.js +9 -0
- package/cjs/DateRangeInput/utils.d.ts +61 -0
- package/cjs/DateRangeInput/utils.js +146 -0
- package/cjs/DateRangePicker/DateRangePicker.js +12 -2
- package/cjs/Input/Input.d.ts +11 -0
- package/cjs/Input/Input.js +11 -8
- package/cjs/Overlay/OverlayTrigger.d.ts +3 -0
- package/cjs/Overlay/OverlayTrigger.js +5 -0
- package/cjs/Picker/usePickerRef.d.ts +17 -0
- package/cjs/Picker/usePickerRef.js +82 -0
- package/cjs/index.d.ts +2 -0
- package/cjs/index.js +3 -1
- package/cjs/locales/index.d.ts +2 -2
- package/cjs/utils/index.d.ts +2 -0
- package/cjs/utils/index.js +8 -2
- package/cjs/utils/useCustom.js +1 -1
- package/cjs/utils/useIsomorphicLayoutEffect.d.ts +3 -0
- package/cjs/utils/useIsomorphicLayoutEffect.js +9 -0
- package/dist/rsuite-no-reset-rtl.css +51 -141
- package/dist/rsuite-no-reset-rtl.min.css +1 -1
- package/dist/rsuite-no-reset-rtl.min.css.map +1 -1
- package/dist/rsuite-no-reset.css +51 -141
- package/dist/rsuite-no-reset.min.css +1 -1
- package/dist/rsuite-no-reset.min.css.map +1 -1
- package/dist/rsuite-rtl.css +51 -9
- package/dist/rsuite-rtl.min.css +1 -1
- package/dist/rsuite-rtl.min.css.map +1 -1
- package/dist/rsuite.css +51 -9
- package/dist/rsuite.js +4800 -246
- package/dist/rsuite.js.map +1 -1
- package/dist/rsuite.min.css +1 -1
- package/dist/rsuite.min.css.map +1 -1
- package/dist/rsuite.min.js +1 -1
- package/dist/rsuite.min.js.map +1 -1
- package/esm/Calendar/CalendarContainer.d.ts +2 -0
- package/esm/Calendar/CalendarContainer.js +12 -5
- package/esm/Calendar/CalendarHeader.js +2 -0
- package/esm/Calendar/MonthDropdown.js +7 -2
- package/esm/Calendar/MonthDropdownItem.js +2 -2
- package/esm/Calendar/Table.js +6 -1
- package/esm/Calendar/TimeDropdown.js +17 -10
- package/esm/Calendar/types.d.ts +1 -0
- package/esm/CustomProvider/CustomProvider.d.ts +13 -0
- package/esm/CustomProvider/CustomProvider.js +3 -3
- package/esm/DateInput/DateField.d.ts +9 -31
- package/esm/DateInput/DateField.js +61 -12
- package/esm/DateInput/DateInput.d.ts +7 -2
- package/esm/DateInput/DateInput.js +77 -95
- package/esm/DateInput/index.d.ts +4 -0
- package/esm/DateInput/index.js +4 -0
- package/esm/DateInput/useDateInputState.d.ts +7 -31
- package/esm/DateInput/useDateInputState.js +41 -18
- package/esm/DateInput/useIsFocused.d.ts +7 -0
- package/esm/DateInput/useIsFocused.js +22 -0
- package/esm/DateInput/useKeyboardInputEvent.d.ts +10 -0
- package/esm/DateInput/useKeyboardInputEvent.js +38 -0
- package/esm/DateInput/utils.d.ts +23 -1
- package/esm/DateInput/utils.js +150 -51
- package/esm/DatePicker/DatePicker.d.ts +20 -7
- package/esm/DatePicker/DatePicker.js +213 -244
- package/esm/DatePicker/PickerIndicator.d.ts +10 -0
- package/esm/DatePicker/PickerIndicator.js +42 -0
- package/esm/DatePicker/PickerLabel.d.ts +9 -0
- package/esm/DatePicker/PickerLabel.js +17 -0
- package/esm/DatePicker/Toolbar.js +3 -21
- package/esm/DatePicker/utils.d.ts +5 -1
- package/esm/DatePicker/utils.js +16 -1
- package/esm/DateRangeInput/DateRangeInput.d.ts +29 -0
- package/esm/DateRangeInput/DateRangeInput.js +237 -0
- package/esm/DateRangeInput/index.d.ts +3 -0
- package/esm/DateRangeInput/index.js +3 -0
- package/esm/DateRangeInput/utils.d.ts +61 -0
- package/esm/DateRangeInput/utils.js +137 -0
- package/esm/DateRangePicker/DateRangePicker.js +12 -2
- package/esm/Input/Input.d.ts +11 -0
- package/esm/Input/Input.js +12 -9
- package/esm/Overlay/OverlayTrigger.d.ts +3 -0
- package/esm/Overlay/OverlayTrigger.js +5 -0
- package/esm/Picker/usePickerRef.d.ts +17 -0
- package/esm/Picker/usePickerRef.js +77 -0
- package/esm/index.d.ts +2 -0
- package/esm/index.js +1 -0
- package/esm/locales/index.d.ts +2 -2
- package/esm/utils/index.d.ts +2 -0
- package/esm/utils/index.js +3 -1
- package/esm/utils/useCustom.js +2 -2
- package/esm/utils/useIsomorphicLayoutEffect.d.ts +3 -0
- package/esm/utils/useIsomorphicLayoutEffect.js +4 -0
- package/package.json +1 -1
- package/styles/color-modes/dark.less +1 -0
- package/styles/color-modes/high-contrast.less +1 -0
- package/styles/color-modes/light.less +1 -0
- package/styles/normalize.less +230 -231
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
'use client';
|
|
2
|
+
import _taggedTemplateLiteralLoose from "@babel/runtime/helpers/esm/taggedTemplateLiteralLoose";
|
|
2
3
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
3
4
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
4
|
-
|
|
5
|
+
var _templateObject;
|
|
6
|
+
import React, { useMemo, useState } from 'react';
|
|
5
7
|
import PropTypes from 'prop-types';
|
|
6
8
|
import mapValues from 'lodash/mapValues';
|
|
7
9
|
import pick from 'lodash/pick';
|
|
8
|
-
import omit from 'lodash/omit';
|
|
9
10
|
import delay from 'lodash/delay';
|
|
10
|
-
import
|
|
11
|
+
import omit from 'lodash/omit';
|
|
11
12
|
import IconCalendar from '@rsuite/icons/legacy/Calendar';
|
|
12
13
|
import IconClockO from '@rsuite/icons/legacy/ClockO';
|
|
13
14
|
import CalendarContainer from '../Calendar/CalendarContainer';
|
|
@@ -16,18 +17,25 @@ import { isEveryDateInMonth } from '../Calendar/MonthDropdown';
|
|
|
16
17
|
import Toolbar from './Toolbar';
|
|
17
18
|
import Stack from '../Stack';
|
|
18
19
|
import PredefinedRanges from './PredefinedRanges';
|
|
19
|
-
import {
|
|
20
|
-
import { shouldRenderMonth, shouldRenderDate, shouldRenderTime, shouldOnlyRenderTime, setHours, getHours, addMonths, addDays,
|
|
21
|
-
import { PickerOverlay, pickerPropTypes,
|
|
20
|
+
import { createChainedFunction, mergeRefs, useClassNames, useControlled, useCustom, useUniqueId, useEventCallback, partitionHTMLProps } from '../utils';
|
|
21
|
+
import { shouldRenderMonth, shouldRenderDate, shouldRenderTime, shouldOnlyRenderTime, setHours, getHours, addMonths, addDays, isValid, disabledTime, copyTime, calendarOnlyProps } from '../utils/dateUtils';
|
|
22
|
+
import { PickerOverlay, pickerPropTypes, PickerToggleTrigger, pickTriggerPropKeys, omitTriggerPropKeys, usePickerClassName, onMenuKeyDown } from '../Picker';
|
|
23
|
+
import usePickerRef from '../Picker/usePickerRef';
|
|
24
|
+
import DateInput from '../DateInput';
|
|
25
|
+
import InputGroup from '../InputGroup';
|
|
26
|
+
import PickerLabel from './PickerLabel';
|
|
27
|
+
import PickerIndicator from './PickerIndicator';
|
|
22
28
|
import { OverlayCloseCause } from '../Overlay/OverlayTrigger';
|
|
23
29
|
import { deprecatePropTypeNew } from '../utils/deprecatePropType';
|
|
24
30
|
import { getAriaLabel } from '../Calendar/utils';
|
|
31
|
+
import { splitRanges } from './utils';
|
|
25
32
|
/**
|
|
26
33
|
* A date picker allows users to select a date from a calendar.
|
|
27
34
|
*
|
|
28
35
|
* @see https://rsuitejs.com/components/date-picker
|
|
29
36
|
*/
|
|
30
37
|
var DatePicker = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
38
|
+
var _merge;
|
|
31
39
|
var _props$as = props.as,
|
|
32
40
|
Component = _props$as === void 0 ? 'div' : _props$as,
|
|
33
41
|
className = props.className,
|
|
@@ -40,13 +48,18 @@ var DatePicker = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
40
48
|
editable = _props$editable === void 0 ? true : _props$editable,
|
|
41
49
|
defaultValue = props.defaultValue,
|
|
42
50
|
disabled = props.disabled,
|
|
51
|
+
readOnly = props.readOnly,
|
|
52
|
+
plaintext = props.plaintext,
|
|
43
53
|
_props$format = props.format,
|
|
44
54
|
formatStr = _props$format === void 0 ? 'yyyy-MM-dd' : _props$format,
|
|
55
|
+
idProp = props.id,
|
|
45
56
|
isoWeek = props.isoWeek,
|
|
46
57
|
_props$limitEndYear = props.limitEndYear,
|
|
47
58
|
limitEndYear = _props$limitEndYear === void 0 ? 1000 : _props$limitEndYear,
|
|
48
59
|
limitStartYear = props.limitStartYear,
|
|
49
60
|
overrideLocale = props.locale,
|
|
61
|
+
loading = props.loading,
|
|
62
|
+
label = props.label,
|
|
50
63
|
menuClassName = props.menuClassName,
|
|
51
64
|
menuStyle = props.menuStyle,
|
|
52
65
|
_props$appearance = props.appearance,
|
|
@@ -61,7 +74,7 @@ var DatePicker = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
61
74
|
showMeridian = props.showMeridian,
|
|
62
75
|
showWeekNumbers = props.showWeekNumbers,
|
|
63
76
|
style = props.style,
|
|
64
|
-
|
|
77
|
+
size = props.size,
|
|
65
78
|
caretAsProp = props.caretAs,
|
|
66
79
|
DEPRECATED_disabledDate = props.disabledDate,
|
|
67
80
|
DEPRECATED_disabledHours = props.disabledHours,
|
|
@@ -71,7 +84,6 @@ var DatePicker = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
71
84
|
shouldDisableHour = props.shouldDisableHour,
|
|
72
85
|
shouldDisableMinute = props.shouldDisableMinute,
|
|
73
86
|
shouldDisableSecond = props.shouldDisableSecond,
|
|
74
|
-
renderValue = props.renderValue,
|
|
75
87
|
onChange = props.onChange,
|
|
76
88
|
onChangeCalendarDate = props.onChangeCalendarDate,
|
|
77
89
|
onClean = props.onClean,
|
|
@@ -86,11 +98,16 @@ var DatePicker = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
86
98
|
onToggleMonthDropdown = props.onToggleMonthDropdown,
|
|
87
99
|
onToggleTimeDropdown = props.onToggleTimeDropdown,
|
|
88
100
|
onShortcutClick = props.onShortcutClick,
|
|
89
|
-
|
|
101
|
+
restProps = _objectWithoutPropertiesLoose(props, ["as", "className", "classPrefix", "calendarDefaultDate", "cleanable", "editable", "defaultValue", "disabled", "readOnly", "plaintext", "format", "id", "isoWeek", "limitEndYear", "limitStartYear", "locale", "loading", "label", "menuClassName", "menuStyle", "appearance", "placement", "oneTap", "placeholder", "ranges", "value", "showMeridian", "showWeekNumbers", "style", "size", "caretAs", "disabledDate", "disabledHours", "disabledMinutes", "disabledSeconds", "shouldDisableDate", "shouldDisableHour", "shouldDisableMinute", "shouldDisableSecond", "onChange", "onChangeCalendarDate", "onClean", "onClose", "onEntered", "onExited", "onNextMonth", "onOk", "onOpen", "onPrevMonth", "onSelect", "onToggleMonthDropdown", "onToggleTimeDropdown", "onShortcutClick"]);
|
|
102
|
+
var id = useUniqueId(classPrefix + "-", idProp);
|
|
103
|
+
var _usePickerRef = usePickerRef(ref),
|
|
104
|
+
trigger = _usePickerRef.trigger,
|
|
105
|
+
root = _usePickerRef.root,
|
|
106
|
+
target = _usePickerRef.target,
|
|
107
|
+
overlay = _usePickerRef.overlay;
|
|
90
108
|
var _useCustom = useCustom('DatePicker', overrideLocale),
|
|
91
109
|
locale = _useCustom.locale,
|
|
92
|
-
formatDate = _useCustom.formatDate
|
|
93
|
-
parseDate = _useCustom.parseDate;
|
|
110
|
+
formatDate = _useCustom.formatDate;
|
|
94
111
|
var _useClassNames = useClassNames(classPrefix),
|
|
95
112
|
merge = _useClassNames.merge,
|
|
96
113
|
prefix = _useClassNames.prefix;
|
|
@@ -106,71 +123,72 @@ var DatePicker = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
106
123
|
setShowMonthDropdown = _useState[1]; // Show only the calendar month panel. formatStr = 'yyyy-MM'
|
|
107
124
|
var onlyShowMonth = shouldRenderMonth(formatStr) && !shouldRenderDate(formatStr);
|
|
108
125
|
var showMonth = onlyShowMonth || showMonthDropdown;
|
|
109
|
-
var
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
var
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
126
|
+
var isDateDisabled = function isDateDisabled(date) {
|
|
127
|
+
if (typeof shouldDisableDate === 'function') {
|
|
128
|
+
return shouldDisableDate(date);
|
|
129
|
+
}
|
|
130
|
+
if (typeof DEPRECATED_disabledDate === 'function') {
|
|
131
|
+
return DEPRECATED_disabledDate(date);
|
|
132
|
+
}
|
|
133
|
+
return false;
|
|
134
|
+
};
|
|
135
|
+
var isErrorValue = function isErrorValue(value) {
|
|
136
|
+
if (!isValid(value)) {
|
|
137
|
+
return true;
|
|
138
|
+
} else if (value && isDateDisabled(value)) {
|
|
139
|
+
return true;
|
|
140
|
+
}
|
|
141
|
+
return false;
|
|
142
|
+
};
|
|
125
143
|
|
|
126
144
|
/**
|
|
127
145
|
* Switch to the callback triggered after the next month.
|
|
128
146
|
*/
|
|
129
|
-
var handleMoveForward =
|
|
147
|
+
var handleMoveForward = useEventCallback(function (nextPageDate) {
|
|
130
148
|
setCalendarDate(nextPageDate);
|
|
131
149
|
onNextMonth === null || onNextMonth === void 0 ? void 0 : onNextMonth(nextPageDate);
|
|
132
150
|
onChangeCalendarDate === null || onChangeCalendarDate === void 0 ? void 0 : onChangeCalendarDate(nextPageDate);
|
|
133
|
-
}
|
|
151
|
+
});
|
|
134
152
|
|
|
135
153
|
/**
|
|
136
154
|
* Switch to the callback triggered after the previous month.
|
|
137
155
|
*/
|
|
138
|
-
var handleMoveBackward =
|
|
156
|
+
var handleMoveBackward = useEventCallback(function (nextPageDate) {
|
|
139
157
|
setCalendarDate(nextPageDate);
|
|
140
158
|
onPrevMonth === null || onPrevMonth === void 0 ? void 0 : onPrevMonth(nextPageDate);
|
|
141
159
|
onChangeCalendarDate === null || onChangeCalendarDate === void 0 ? void 0 : onChangeCalendarDate(nextPageDate);
|
|
142
|
-
}
|
|
160
|
+
});
|
|
143
161
|
|
|
144
162
|
/**
|
|
145
163
|
* The callback triggered when the date changes.
|
|
146
164
|
*/
|
|
147
|
-
var handleDateChange =
|
|
165
|
+
var handleDateChange = useEventCallback(function (nextValue, event) {
|
|
148
166
|
onSelect === null || onSelect === void 0 ? void 0 : onSelect(nextValue, event);
|
|
149
167
|
onChangeCalendarDate === null || onChangeCalendarDate === void 0 ? void 0 : onChangeCalendarDate(nextValue, event);
|
|
150
|
-
}
|
|
168
|
+
});
|
|
151
169
|
|
|
152
170
|
/**
|
|
153
171
|
* A callback triggered when the time on the calendar changes.
|
|
154
172
|
*/
|
|
155
|
-
var handleChangeTime =
|
|
173
|
+
var handleChangeTime = useEventCallback(function (nextPageTime) {
|
|
156
174
|
setCalendarDate(nextPageTime);
|
|
157
175
|
handleDateChange(nextPageTime);
|
|
158
|
-
}
|
|
159
|
-
var handleClose =
|
|
160
|
-
var
|
|
161
|
-
(
|
|
162
|
-
}
|
|
176
|
+
});
|
|
177
|
+
var handleClose = useEventCallback(function () {
|
|
178
|
+
var _trigger$current, _trigger$current$clos;
|
|
179
|
+
(_trigger$current = trigger.current) === null || _trigger$current === void 0 ? void 0 : (_trigger$current$clos = _trigger$current.close) === null || _trigger$current$clos === void 0 ? void 0 : _trigger$current$clos.call(_trigger$current);
|
|
180
|
+
});
|
|
163
181
|
|
|
164
182
|
/**
|
|
165
183
|
* The callback triggered when PM/AM is switched.
|
|
166
184
|
*/
|
|
167
|
-
var handleToggleMeridian =
|
|
185
|
+
var handleToggleMeridian = useEventCallback(function () {
|
|
168
186
|
var hours = getHours(calendarDate);
|
|
169
187
|
var nextHours = hours >= 12 ? hours - 12 : hours + 12;
|
|
170
188
|
var nextDate = setHours(calendarDate, nextHours);
|
|
171
189
|
handleChangeTime(nextDate);
|
|
172
|
-
}
|
|
173
|
-
var updateValue =
|
|
190
|
+
});
|
|
191
|
+
var updateValue = function updateValue(event, nextPageDate, closeOverlay) {
|
|
174
192
|
if (closeOverlay === void 0) {
|
|
175
193
|
closeOverlay = true;
|
|
176
194
|
}
|
|
@@ -185,91 +203,80 @@ var DatePicker = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
185
203
|
if (closeOverlay !== false) {
|
|
186
204
|
handleClose();
|
|
187
205
|
}
|
|
188
|
-
}
|
|
206
|
+
};
|
|
189
207
|
|
|
190
208
|
/**
|
|
191
209
|
* The callback triggered after the date in the shortcut area is clicked.
|
|
192
210
|
*/
|
|
193
|
-
var handleShortcutPageDate =
|
|
211
|
+
var handleShortcutPageDate = useEventCallback(function (range, closeOverlay, event) {
|
|
194
212
|
var value = range.value;
|
|
195
213
|
updateValue(event, value, closeOverlay);
|
|
196
214
|
handleDateChange(value, event);
|
|
197
215
|
onShortcutClick === null || onShortcutClick === void 0 ? void 0 : onShortcutClick(range, event);
|
|
198
|
-
}
|
|
216
|
+
});
|
|
199
217
|
|
|
200
218
|
/**
|
|
201
219
|
* Get the corresponding container based on date selection and month selection
|
|
202
220
|
*/
|
|
203
|
-
var getOverlayContainer =
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
}, [showMonth]);
|
|
221
|
+
var getOverlayContainer = function getOverlayContainer() {
|
|
222
|
+
return showMonth ? document.getElementById(id + "-calendar-month-dropdown") : document.getElementById(id + "-calendar-table");
|
|
223
|
+
};
|
|
207
224
|
|
|
208
225
|
/**
|
|
209
226
|
* Check whether the date is focusable
|
|
210
227
|
*/
|
|
211
|
-
var checkFocusable =
|
|
228
|
+
var checkFocusable = function checkFocusable(date) {
|
|
212
229
|
var formatStr = showMonth ? locale.formattedMonthPattern : locale.formattedDayPattern;
|
|
213
230
|
var ariaLabel = getAriaLabel(date, formatStr, formatDate);
|
|
214
231
|
var container = getOverlayContainer();
|
|
215
|
-
var dateElement = container.querySelector("[aria-label=\"" + ariaLabel + "\"]");
|
|
216
|
-
if (dateElement
|
|
232
|
+
var dateElement = container === null || container === void 0 ? void 0 : container.querySelector("[aria-label=\"" + ariaLabel + "\"]");
|
|
233
|
+
if ((dateElement === null || dateElement === void 0 ? void 0 : dateElement.getAttribute('aria-disabled')) === 'true') {
|
|
217
234
|
return false;
|
|
218
235
|
}
|
|
219
236
|
return true;
|
|
220
|
-
}
|
|
237
|
+
};
|
|
221
238
|
|
|
222
239
|
/**
|
|
223
240
|
* Focus on the currently selected date element
|
|
224
241
|
*/
|
|
225
|
-
var focusSelectedDate =
|
|
242
|
+
var focusSelectedDate = function focusSelectedDate() {
|
|
226
243
|
delay(function () {
|
|
227
244
|
var container = getOverlayContainer();
|
|
228
245
|
var selectedElement = container === null || container === void 0 ? void 0 : container.querySelector('[aria-selected="true"]');
|
|
229
246
|
selectedElement === null || selectedElement === void 0 ? void 0 : selectedElement.focus();
|
|
230
247
|
}, 1);
|
|
231
|
-
}
|
|
248
|
+
};
|
|
232
249
|
|
|
233
250
|
/**
|
|
234
251
|
* Focus on the input element
|
|
235
252
|
*/
|
|
236
|
-
var
|
|
253
|
+
var focusTargetInput = useEventCallback(function () {
|
|
237
254
|
delay(function () {
|
|
238
|
-
var
|
|
239
|
-
(
|
|
240
|
-
},
|
|
241
|
-
}
|
|
255
|
+
var _target$current;
|
|
256
|
+
return (_target$current = target.current) === null || _target$current === void 0 ? void 0 : _target$current.focus();
|
|
257
|
+
}, 1);
|
|
258
|
+
});
|
|
242
259
|
|
|
243
260
|
/**
|
|
244
261
|
* The callback triggered after clicking the OK button.
|
|
245
262
|
*/
|
|
246
|
-
var handleOK =
|
|
263
|
+
var handleOK = useEventCallback(function (event) {
|
|
247
264
|
updateValue(event);
|
|
248
265
|
onOk === null || onOk === void 0 ? void 0 : onOk(calendarDate, event);
|
|
249
|
-
|
|
250
|
-
}
|
|
266
|
+
focusTargetInput();
|
|
267
|
+
});
|
|
251
268
|
|
|
252
269
|
/**
|
|
253
270
|
* Callback after clicking the clear button.
|
|
254
271
|
*/
|
|
255
|
-
|
|
272
|
+
|
|
273
|
+
var handleClean = useEventCallback(function (event) {
|
|
256
274
|
updateValue(event, null);
|
|
257
275
|
resetCalendarDate(null);
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
if (tagName === 'INPUT') {
|
|
263
|
-
if (event.key === 'ArrowDown') {
|
|
264
|
-
event.preventDefault();
|
|
265
|
-
focusSelectedDate();
|
|
266
|
-
} else if (event.key === 'Enter') {
|
|
267
|
-
var _triggerRef$current2, _triggerRef$current2$;
|
|
268
|
-
(_triggerRef$current2 = triggerRef.current) === null || _triggerRef$current2 === void 0 ? void 0 : (_triggerRef$current2$ = _triggerRef$current2.open) === null || _triggerRef$current2$ === void 0 ? void 0 : _triggerRef$current2$.call(_triggerRef$current2);
|
|
269
|
-
}
|
|
270
|
-
}
|
|
271
|
-
}, [focusSelectedDate]);
|
|
272
|
-
var handlePickerOverlayKeyDown = useCallback(function (event) {
|
|
276
|
+
onClean === null || onClean === void 0 ? void 0 : onClean(event);
|
|
277
|
+
event.stopPropagation();
|
|
278
|
+
});
|
|
279
|
+
var handlePickerOverlayKeyDown = useEventCallback(function (event) {
|
|
273
280
|
var delta = 0;
|
|
274
281
|
var step = showMonth ? 6 : 7;
|
|
275
282
|
var changeDateFunc = showMonth ? addMonths : addDays;
|
|
@@ -295,135 +302,91 @@ var DatePicker = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
295
302
|
setCalendarDate(nextDate);
|
|
296
303
|
focusSelectedDate();
|
|
297
304
|
}
|
|
298
|
-
}
|
|
305
|
+
});
|
|
299
306
|
|
|
300
307
|
/**
|
|
301
308
|
* The callback triggered after the month selection box is opened or closed.
|
|
302
309
|
*/
|
|
303
|
-
var handleToggleMonthDropdown =
|
|
310
|
+
var handleToggleMonthDropdown = useEventCallback(function (toggle) {
|
|
304
311
|
onToggleMonthDropdown === null || onToggleMonthDropdown === void 0 ? void 0 : onToggleMonthDropdown(toggle);
|
|
305
312
|
setShowMonthDropdown(toggle);
|
|
306
|
-
}
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
targetRef: targetRef,
|
|
314
|
-
overlayRef: overlayRef,
|
|
315
|
-
active: active,
|
|
316
|
-
onExit: handleClean,
|
|
317
|
-
onKeyDown: handlePickerToggleKeyDown
|
|
318
|
-
}, rest));
|
|
313
|
+
});
|
|
314
|
+
var handleClick = useEventCallback(function () {
|
|
315
|
+
if (editable) {
|
|
316
|
+
return;
|
|
317
|
+
}
|
|
318
|
+
focusSelectedDate();
|
|
319
|
+
});
|
|
319
320
|
|
|
320
321
|
/**
|
|
321
322
|
* Callback after the date is selected.
|
|
322
323
|
*/
|
|
323
|
-
var handleSelect =
|
|
324
|
+
var handleSelect = useEventCallback(function (nextValue, event, updatableValue) {
|
|
324
325
|
if (updatableValue === void 0) {
|
|
325
326
|
updatableValue = true;
|
|
326
327
|
}
|
|
327
328
|
setCalendarDate(
|
|
328
329
|
// Determine whether the current value contains time, if not, use calendarDate.
|
|
329
|
-
shouldRenderTime(formatStr) ? nextValue :
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
}, function (d) {
|
|
334
|
-
return setSeconds(d, getSeconds(calendarDate));
|
|
335
|
-
})(nextValue));
|
|
330
|
+
shouldRenderTime(formatStr) ? nextValue : copyTime({
|
|
331
|
+
from: calendarDate,
|
|
332
|
+
to: nextValue
|
|
333
|
+
}));
|
|
336
334
|
handleDateChange(nextValue);
|
|
337
335
|
if (oneTap && updatableValue) {
|
|
338
336
|
updateValue(event, nextValue);
|
|
337
|
+
focusTargetInput();
|
|
339
338
|
}
|
|
340
|
-
}
|
|
339
|
+
});
|
|
341
340
|
|
|
342
341
|
/**
|
|
343
342
|
* A callback triggered when the date on the calendar changes.
|
|
344
343
|
*/
|
|
345
|
-
var handleChangeMonth =
|
|
344
|
+
var handleChangeMonth = useEventCallback(function (nextPageDate, event) {
|
|
346
345
|
setCalendarDate(nextPageDate);
|
|
347
346
|
handleDateChange(nextPageDate);
|
|
348
347
|
focusSelectedDate();
|
|
349
348
|
if (oneTap && onlyShowMonth) {
|
|
350
349
|
updateValue(event, nextPageDate);
|
|
350
|
+
focusTargetInput();
|
|
351
351
|
}
|
|
352
|
-
}
|
|
353
|
-
var isDateDisabled = useCallback(function (date) {
|
|
354
|
-
if (typeof shouldDisableDate === 'function') {
|
|
355
|
-
return shouldDisableDate(date);
|
|
356
|
-
}
|
|
357
|
-
if (typeof DEPRECATED_disabledDate === 'function') {
|
|
358
|
-
return DEPRECATED_disabledDate(date);
|
|
359
|
-
}
|
|
360
|
-
return false;
|
|
361
|
-
}, [DEPRECATED_disabledDate, shouldDisableDate]);
|
|
352
|
+
});
|
|
362
353
|
|
|
363
354
|
/**
|
|
364
355
|
* Callback after the input box value is changed.
|
|
365
356
|
*/
|
|
366
|
-
var handleInputChange =
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
// isMatch('01/11/2020', 'MM/dd/yyyy') ==> true
|
|
370
|
-
// isMatch('2020-11-01', 'MM/dd/yyyy') ==> false
|
|
371
|
-
if (!isMatch(value, formatStr, {
|
|
372
|
-
locale: locale.dateLocale
|
|
373
|
-
})) {
|
|
374
|
-
setInputState('Error');
|
|
375
|
-
return;
|
|
376
|
-
}
|
|
377
|
-
var date = parseDate(value, formatStr);
|
|
378
|
-
|
|
379
|
-
// If only the time is included in the characters, it will default to today.
|
|
380
|
-
if (shouldOnlyRenderTime(formatStr)) {
|
|
381
|
-
date = new Date(format(new Date(), 'yyyy-MM-dd') + " " + value);
|
|
382
|
-
}
|
|
383
|
-
if (!isValid(date)) {
|
|
384
|
-
setInputState('Error');
|
|
385
|
-
return;
|
|
386
|
-
}
|
|
387
|
-
if (isDateDisabled(date)) {
|
|
388
|
-
setInputState('Error');
|
|
389
|
-
return;
|
|
390
|
-
}
|
|
391
|
-
handleSelect(date, event, false);
|
|
392
|
-
}, [formatStr, locale, parseDate, isDateDisabled, handleSelect]);
|
|
393
|
-
|
|
394
|
-
/**
|
|
395
|
-
* The callback after the enter key is triggered on the input
|
|
396
|
-
*/
|
|
397
|
-
var handleInputPressEnd = useCallback(function (event) {
|
|
398
|
-
if (inputState === 'Typing') {
|
|
399
|
-
updateValue(event, calendarDate);
|
|
400
|
-
}
|
|
401
|
-
setInputState('Initial');
|
|
402
|
-
}, [inputState, calendarDate, updateValue]);
|
|
403
|
-
var handleInputBackspace = useCallback(function (event) {
|
|
404
|
-
var value = event.target.value;
|
|
405
|
-
|
|
406
|
-
// When the input box is empty, the date is cleared.
|
|
407
|
-
if (value === '') {
|
|
408
|
-
handleClean(event);
|
|
357
|
+
var handleInputChange = useEventCallback(function (value, event) {
|
|
358
|
+
if (!isErrorValue(value)) {
|
|
359
|
+
handleSelect(value, event);
|
|
409
360
|
}
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
361
|
+
updateValue(event, value, false);
|
|
362
|
+
});
|
|
363
|
+
var handleInputKeyDown = useEventCallback(function (event) {
|
|
364
|
+
onMenuKeyDown(event, {
|
|
365
|
+
esc: handleClose,
|
|
366
|
+
enter: function enter() {
|
|
367
|
+
var _trigger$current2;
|
|
368
|
+
var _ref = ((_trigger$current2 = trigger.current) === null || _trigger$current2 === void 0 ? void 0 : _trigger$current2.getState()) || {},
|
|
369
|
+
open = _ref.open;
|
|
370
|
+
if (open) {
|
|
371
|
+
if (isValid(calendarDate) && !isDateDisabled(calendarDate)) {
|
|
372
|
+
updateValue(event);
|
|
373
|
+
focusTargetInput();
|
|
374
|
+
}
|
|
375
|
+
} else {
|
|
376
|
+
var _trigger$current3;
|
|
377
|
+
(_trigger$current3 = trigger.current) === null || _trigger$current3 === void 0 ? void 0 : _trigger$current3.open();
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
});
|
|
381
|
+
});
|
|
419
382
|
|
|
420
383
|
// Check whether the time is within the time range of the shortcut option in the toolbar.
|
|
421
|
-
var disabledToolbarHandle =
|
|
384
|
+
var disabledToolbarHandle = function disabledToolbarHandle(date) {
|
|
422
385
|
var _DEPRECATED_disabledD;
|
|
423
386
|
var allowDate = (_DEPRECATED_disabledD = DEPRECATED_disabledDate === null || DEPRECATED_disabledDate === void 0 ? void 0 : DEPRECATED_disabledDate(date)) !== null && _DEPRECATED_disabledD !== void 0 ? _DEPRECATED_disabledD : false;
|
|
424
387
|
var allowTime = disabledTime(props, date);
|
|
425
388
|
return allowDate || allowTime;
|
|
426
|
-
}
|
|
389
|
+
};
|
|
427
390
|
|
|
428
391
|
/**
|
|
429
392
|
* Whether "OK" button is disabled
|
|
@@ -431,12 +394,12 @@ var DatePicker = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
431
394
|
* - If format is date, disable ok button if selected date is disabled
|
|
432
395
|
* - If format is month, disable ok button if all dates in the month of selected date are disabled
|
|
433
396
|
*/
|
|
434
|
-
var isOKButtonDisabled =
|
|
397
|
+
var isOKButtonDisabled = function isOKButtonDisabled(selectedDate) {
|
|
435
398
|
if (shouldRenderMonth(formatStr) && !shouldRenderDate(formatStr)) {
|
|
436
399
|
return isEveryDateInMonth(selectedDate.getFullYear(), selectedDate.getMonth(), disabledToolbarHandle);
|
|
437
400
|
}
|
|
438
401
|
return disabledToolbarHandle(selectedDate);
|
|
439
|
-
}
|
|
402
|
+
};
|
|
440
403
|
var calendarProps = useMemo(function () {
|
|
441
404
|
return mapValues(pick(props, calendarOnlyProps), function (disabledOrHiddenTimeFunc) {
|
|
442
405
|
return function (next, date) {
|
|
@@ -445,53 +408,26 @@ var DatePicker = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
445
408
|
};
|
|
446
409
|
});
|
|
447
410
|
}, [props]);
|
|
448
|
-
var
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
showMeridian: showMeridian,
|
|
452
|
-
disabledDate: isDateDisabled,
|
|
453
|
-
disabledHours: shouldDisableHour !== null && shouldDisableHour !== void 0 ? shouldDisableHour : DEPRECATED_disabledHours,
|
|
454
|
-
disabledMinutes: shouldDisableMinute !== null && shouldDisableMinute !== void 0 ? shouldDisableMinute : DEPRECATED_disabledMinutes,
|
|
455
|
-
disabledSeconds: shouldDisableSecond !== null && shouldDisableSecond !== void 0 ? shouldDisableSecond : DEPRECATED_disabledSeconds,
|
|
456
|
-
limitEndYear: limitEndYear,
|
|
457
|
-
limitStartYear: limitStartYear,
|
|
458
|
-
format: formatStr,
|
|
459
|
-
isoWeek: isoWeek,
|
|
460
|
-
calendarDate: calendarDate,
|
|
461
|
-
onMoveForward: handleMoveForward,
|
|
462
|
-
onMoveBackward: handleMoveBackward,
|
|
463
|
-
onSelect: handleSelect,
|
|
464
|
-
onToggleMonthDropdown: handleToggleMonthDropdown,
|
|
465
|
-
onToggleTimeDropdown: onToggleTimeDropdown,
|
|
466
|
-
onChangeMonth: handleChangeMonth,
|
|
467
|
-
onChangeTime: handleChangeTime,
|
|
468
|
-
onToggleMeridian: handleToggleMeridian
|
|
469
|
-
}));
|
|
470
|
-
|
|
471
|
-
// The shortcut option on the left side of the calendar panel
|
|
472
|
-
var sideRanges = (ranges === null || ranges === void 0 ? void 0 : ranges.filter(function (range) {
|
|
473
|
-
return (range === null || range === void 0 ? void 0 : range.placement) === 'left';
|
|
474
|
-
})) || [];
|
|
475
|
-
|
|
476
|
-
// The shortcut option on the bottom of the calendar panel
|
|
477
|
-
var bottomRanges = (ranges === null || ranges === void 0 ? void 0 : ranges.filter(function (range) {
|
|
478
|
-
return (range === null || range === void 0 ? void 0 : range.placement) === 'bottom' || (range === null || range === void 0 ? void 0 : range.placement) === undefined;
|
|
479
|
-
})) || [];
|
|
411
|
+
var _splitRanges = splitRanges(ranges),
|
|
412
|
+
sideRanges = _splitRanges.sideRanges,
|
|
413
|
+
bottomRanges = _splitRanges.bottomRanges;
|
|
480
414
|
var renderCalendarOverlay = function renderCalendarOverlay(positionProps, speakerRef) {
|
|
481
415
|
var left = positionProps.left,
|
|
482
416
|
top = positionProps.top,
|
|
483
417
|
className = positionProps.className;
|
|
484
|
-
var classes = merge(menuClassName, className
|
|
418
|
+
var classes = merge(menuClassName, className);
|
|
485
419
|
var styles = _extends({}, menuStyle, {
|
|
486
420
|
left: left,
|
|
487
421
|
top: top
|
|
488
422
|
});
|
|
489
423
|
return /*#__PURE__*/React.createElement(PickerOverlay, {
|
|
490
424
|
role: "dialog",
|
|
425
|
+
"aria-labelledby": label ? id + "-label" : undefined,
|
|
426
|
+
tabIndex: -1,
|
|
491
427
|
className: classes,
|
|
492
|
-
ref: mergeRefs(
|
|
428
|
+
ref: mergeRefs(overlay, speakerRef),
|
|
493
429
|
style: styles,
|
|
494
|
-
target:
|
|
430
|
+
target: trigger,
|
|
495
431
|
onKeyDown: handlePickerOverlayKeyDown
|
|
496
432
|
}, /*#__PURE__*/React.createElement(Stack, {
|
|
497
433
|
alignItems: "flex-start"
|
|
@@ -504,7 +440,29 @@ var DatePicker = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
504
440
|
locale: locale,
|
|
505
441
|
disabledShortcut: disabledToolbarHandle,
|
|
506
442
|
onShortcutClick: handleShortcutPageDate
|
|
507
|
-
}), /*#__PURE__*/React.createElement(React.Fragment, null,
|
|
443
|
+
}), /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(CalendarContainer, _extends({}, calendarProps, {
|
|
444
|
+
targetId: id,
|
|
445
|
+
locale: locale,
|
|
446
|
+
showWeekNumbers: showWeekNumbers,
|
|
447
|
+
showMeridian: showMeridian,
|
|
448
|
+
disabledDate: isDateDisabled,
|
|
449
|
+
disabledHours: shouldDisableHour !== null && shouldDisableHour !== void 0 ? shouldDisableHour : DEPRECATED_disabledHours,
|
|
450
|
+
disabledMinutes: shouldDisableMinute !== null && shouldDisableMinute !== void 0 ? shouldDisableMinute : DEPRECATED_disabledMinutes,
|
|
451
|
+
disabledSeconds: shouldDisableSecond !== null && shouldDisableSecond !== void 0 ? shouldDisableSecond : DEPRECATED_disabledSeconds,
|
|
452
|
+
limitEndYear: limitEndYear,
|
|
453
|
+
limitStartYear: limitStartYear,
|
|
454
|
+
format: formatStr,
|
|
455
|
+
isoWeek: isoWeek,
|
|
456
|
+
calendarDate: calendarDate,
|
|
457
|
+
onMoveForward: handleMoveForward,
|
|
458
|
+
onMoveBackward: handleMoveBackward,
|
|
459
|
+
onSelect: handleSelect,
|
|
460
|
+
onToggleMonthDropdown: handleToggleMonthDropdown,
|
|
461
|
+
onToggleTimeDropdown: onToggleTimeDropdown,
|
|
462
|
+
onChangeMonth: handleChangeMonth,
|
|
463
|
+
onChangeTime: handleChangeTime,
|
|
464
|
+
onToggleMeridian: handleToggleMeridian
|
|
465
|
+
})), /*#__PURE__*/React.createElement(Toolbar, {
|
|
508
466
|
locale: locale,
|
|
509
467
|
ranges: bottomRanges,
|
|
510
468
|
calendarDate: calendarDate,
|
|
@@ -515,7 +473,7 @@ var DatePicker = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
515
473
|
hideOkBtn: oneTap
|
|
516
474
|
}))));
|
|
517
475
|
};
|
|
518
|
-
var hasValue =
|
|
476
|
+
var hasValue = isValid(value);
|
|
519
477
|
var _usePickerClassName = usePickerClassName(_extends({}, props, {
|
|
520
478
|
classPrefix: classPrefix,
|
|
521
479
|
name: 'date',
|
|
@@ -525,62 +483,73 @@ var DatePicker = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
525
483
|
})),
|
|
526
484
|
classes = _usePickerClassName[0],
|
|
527
485
|
usedClassNamePropKeys = _usePickerClassName[1];
|
|
528
|
-
var renderDate = useCallback(function () {
|
|
529
|
-
var _renderValue;
|
|
530
|
-
if (!value) {
|
|
531
|
-
return placeholder || formatStr;
|
|
532
|
-
}
|
|
533
|
-
return (_renderValue = renderValue === null || renderValue === void 0 ? void 0 : renderValue(value, formatStr)) !== null && _renderValue !== void 0 ? _renderValue : formatDate(value, formatStr);
|
|
534
|
-
}, [formatStr, formatDate, placeholder, renderValue, value]);
|
|
535
486
|
var caretAs = useMemo(function () {
|
|
487
|
+
if (caretAsProp === null) {
|
|
488
|
+
return null;
|
|
489
|
+
}
|
|
536
490
|
return caretAsProp || (shouldOnlyRenderTime(formatStr) ? IconClockO : IconCalendar);
|
|
537
491
|
}, [caretAsProp, formatStr]);
|
|
538
|
-
var handleTriggerClose =
|
|
492
|
+
var handleTriggerClose = useEventCallback(function (cause) {
|
|
539
493
|
// Unless overlay is closing on user clicking "OK" button,
|
|
540
494
|
// reset the selected date on calendar panel
|
|
541
495
|
if (cause !== OverlayCloseCause.ImperativeHandle) {
|
|
542
496
|
resetCalendarDate();
|
|
543
497
|
}
|
|
544
498
|
setShowMonthDropdown(false);
|
|
545
|
-
}
|
|
499
|
+
});
|
|
500
|
+
var showCleanButton = cleanable && hasValue && !readOnly;
|
|
501
|
+
var _partitionHTMLProps = partitionHTMLProps(restProps, {
|
|
502
|
+
htmlProps: [],
|
|
503
|
+
includeAria: true
|
|
504
|
+
}),
|
|
505
|
+
ariaProps = _partitionHTMLProps[0],
|
|
506
|
+
rest = _partitionHTMLProps[1];
|
|
507
|
+
var invalidValue = value && isErrorValue(value);
|
|
546
508
|
return /*#__PURE__*/React.createElement(PickerToggleTrigger, {
|
|
547
509
|
trigger: "active",
|
|
548
510
|
pickerProps: pick(props, pickTriggerPropKeys),
|
|
549
|
-
ref:
|
|
511
|
+
ref: trigger,
|
|
550
512
|
placement: placement,
|
|
551
513
|
onClose: handleTriggerClose,
|
|
552
|
-
onEntered: createChainedFunction(
|
|
553
|
-
onExited: createChainedFunction(
|
|
514
|
+
onEntered: createChainedFunction(onOpen, onEntered),
|
|
515
|
+
onExited: createChainedFunction(onClose, onExited),
|
|
554
516
|
speaker: renderCalendarOverlay
|
|
555
517
|
}, /*#__PURE__*/React.createElement(Component, {
|
|
556
|
-
className: merge(className, classes),
|
|
518
|
+
className: merge(className, classes, (_merge = {}, _merge[prefix('error')] = invalidValue, _merge)),
|
|
557
519
|
style: style,
|
|
558
|
-
ref:
|
|
559
|
-
}, /*#__PURE__*/React.createElement(
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
520
|
+
ref: root
|
|
521
|
+
}, plaintext ? /*#__PURE__*/React.createElement(DateInput, {
|
|
522
|
+
value: value,
|
|
523
|
+
format: formatStr,
|
|
524
|
+
plaintext: plaintext
|
|
525
|
+
}) : /*#__PURE__*/React.createElement(InputGroup, _extends({}, omit(rest, [].concat(omitTriggerPropKeys, usedClassNamePropKeys, calendarOnlyProps)), {
|
|
526
|
+
inside: true,
|
|
527
|
+
size: size,
|
|
528
|
+
onClick: handleClick
|
|
529
|
+
}), /*#__PURE__*/React.createElement(PickerLabel, {
|
|
530
|
+
className: prefix(_templateObject || (_templateObject = _taggedTemplateLiteralLoose(["label"]))),
|
|
531
|
+
id: id + "-label"
|
|
532
|
+
}, label), /*#__PURE__*/React.createElement(DateInput, _extends({
|
|
533
|
+
"aria-haspopup": "dialog",
|
|
534
|
+
"aria-invalid": invalidValue,
|
|
535
|
+
"aria-labelledby": label ? id + "-label" : undefined
|
|
536
|
+
}, ariaProps, {
|
|
537
|
+
ref: target,
|
|
538
|
+
id: id,
|
|
539
|
+
value: value,
|
|
540
|
+
format: formatStr,
|
|
541
|
+
placeholder: placeholder ? placeholder : formatStr,
|
|
580
542
|
disabled: disabled,
|
|
543
|
+
onChange: handleInputChange,
|
|
544
|
+
readOnly: readOnly || !editable || loading,
|
|
545
|
+
plaintext: plaintext,
|
|
546
|
+
onKeyDown: handleInputKeyDown
|
|
547
|
+
})), /*#__PURE__*/React.createElement(PickerIndicator, {
|
|
548
|
+
loading: loading,
|
|
581
549
|
caretAs: caretAs,
|
|
582
|
-
|
|
583
|
-
|
|
550
|
+
onClose: handleClean,
|
|
551
|
+
showCleanButton: showCleanButton
|
|
552
|
+
}))));
|
|
584
553
|
});
|
|
585
554
|
DatePicker.displayName = 'DatePicker';
|
|
586
555
|
DatePicker.propTypes = _extends({}, pickerPropTypes, {
|