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