@elliemae/ds-controlled-form 2.4.2-rc.1 → 2.4.2-rc.3
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/cjs/date-time-picker/config/useChangeHandlers.js +8 -12
- package/cjs/date-time-picker/config/useControlledDateTimePicker.js +13 -9
- package/cjs/date-time-picker/config/useFocusTracker.js +136 -0
- package/cjs/date-time-picker/config/useGetReferences.js +40 -19
- package/cjs/date-time-picker/config/useGlobalKeyHandlers.js +8 -12
- package/cjs/date-time-picker/parts/ClearButton/ClearButton.js +12 -2
- package/cjs/date-time-picker/parts/ClearButton/useClearButton.js +12 -25
- package/cjs/date-time-picker/parts/ControlledDateTimePickerContent.js +4 -7
- package/cjs/date-time-picker/parts/DateInputs/DDInput.js +8 -2
- package/cjs/date-time-picker/parts/DateInputs/DateInputs.js +9 -4
- package/cjs/date-time-picker/parts/DateInputs/MMInput.js +8 -2
- package/cjs/date-time-picker/parts/DateInputs/YYYYInput.js +8 -2
- package/cjs/date-time-picker/parts/DateInputs/useDateInputs.js +76 -95
- package/cjs/date-time-picker/parts/Pickers/Calendar/CalendarHead.js +31 -5
- package/cjs/date-time-picker/parts/Pickers/Calendar/Day.js +16 -10
- package/cjs/date-time-picker/parts/Pickers/Calendar/useConfigCalendarCTX.js +12 -12
- package/cjs/date-time-picker/parts/Pickers/Calendar/useFocusLogic.js +2 -38
- package/cjs/date-time-picker/parts/Pickers/Calendar/useKeyboardHandlers.js +40 -73
- package/cjs/date-time-picker/parts/Pickers/Calendar/usePopperTriggerLogic.js +18 -27
- package/cjs/date-time-picker/parts/Pickers/CalendarWithTimeWheel/CalendarWithTimeWheelIconTrigger.js +1 -0
- package/cjs/date-time-picker/parts/Pickers/CalendarWithTimeWheel/useConfigCalendarWithTimeWheelCTX.js +17 -23
- package/cjs/date-time-picker/parts/Pickers/TimeWheel/HoursList.js +13 -7
- package/cjs/date-time-picker/parts/Pickers/TimeWheel/MeridiemList.js +14 -8
- package/cjs/date-time-picker/parts/Pickers/TimeWheel/MinutesList.js +13 -7
- package/cjs/date-time-picker/parts/Pickers/TimeWheel/useKeyboardHandlers.js +36 -230
- package/cjs/date-time-picker/parts/Pickers/TimeWheel/usePopperTriggerLogic.js +11 -13
- package/cjs/date-time-picker/parts/TimeInputs/HHInput.js +8 -2
- package/cjs/date-time-picker/parts/TimeInputs/MeridiemInput.js +8 -2
- package/cjs/date-time-picker/parts/TimeInputs/MinutesInput.js +8 -2
- package/cjs/date-time-picker/parts/TimeInputs/TimeInputs.js +11 -6
- package/cjs/date-time-picker/parts/TimeInputs/useTimeInputs.js +44 -74
- package/cjs/date-time-picker/utils/constants.js +0 -12
- package/cjs/date-time-picker/utils/hooks/useGetStartingFocusedDay.js +38 -36
- package/esm/autocomplete/config/useAutocomplete.js +2 -2
- package/esm/combobox/config/useComboBox.js +2 -2
- package/esm/date-range-picker/config/useRangePickerLogic.js +2 -2
- package/esm/date-time-picker/config/useChangeHandlers.js +8 -12
- package/esm/date-time-picker/config/useControlledDateTimePicker.js +13 -9
- package/esm/date-time-picker/config/useFocusTracker.js +132 -0
- package/esm/date-time-picker/config/useGetReferences.js +41 -20
- package/esm/date-time-picker/config/useGlobalKeyHandlers.js +8 -12
- package/esm/date-time-picker/parts/ClearButton/ClearButton.js +12 -2
- package/esm/date-time-picker/parts/ClearButton/useClearButton.js +12 -25
- package/esm/date-time-picker/parts/ControlledDateTimePickerContent.js +4 -7
- package/esm/date-time-picker/parts/DateInputs/DDInput.js +8 -2
- package/esm/date-time-picker/parts/DateInputs/DateInputs.js +9 -4
- package/esm/date-time-picker/parts/DateInputs/MMInput.js +8 -2
- package/esm/date-time-picker/parts/DateInputs/YYYYInput.js +8 -2
- package/esm/date-time-picker/parts/DateInputs/useDateInputs.js +77 -96
- package/esm/date-time-picker/parts/Pickers/Calendar/CalendarHead.js +32 -6
- package/esm/date-time-picker/parts/Pickers/Calendar/Day.js +16 -10
- package/esm/date-time-picker/parts/Pickers/Calendar/useConfigCalendarCTX.js +14 -14
- package/esm/date-time-picker/parts/Pickers/Calendar/useFocusLogic.js +3 -39
- package/esm/date-time-picker/parts/Pickers/Calendar/useKeyboardHandlers.js +40 -73
- package/esm/date-time-picker/parts/Pickers/Calendar/usePopperTriggerLogic.js +18 -27
- package/esm/date-time-picker/parts/Pickers/CalendarWithTimeWheel/CalendarWithTimeWheelIconTrigger.js +1 -0
- package/esm/date-time-picker/parts/Pickers/CalendarWithTimeWheel/useConfigCalendarWithTimeWheelCTX.js +17 -23
- package/esm/date-time-picker/parts/Pickers/TimeWheel/HoursList.js +14 -8
- package/esm/date-time-picker/parts/Pickers/TimeWheel/MeridiemList.js +15 -9
- package/esm/date-time-picker/parts/Pickers/TimeWheel/MinutesList.js +14 -8
- package/esm/date-time-picker/parts/Pickers/TimeWheel/useKeyboardHandlers.js +36 -230
- package/esm/date-time-picker/parts/Pickers/TimeWheel/usePopperTriggerLogic.js +11 -13
- package/esm/date-time-picker/parts/TimeInputs/HHInput.js +8 -2
- package/esm/date-time-picker/parts/TimeInputs/MeridiemInput.js +8 -2
- package/esm/date-time-picker/parts/TimeInputs/MinutesInput.js +8 -2
- package/esm/date-time-picker/parts/TimeInputs/TimeInputs.js +11 -6
- package/esm/date-time-picker/parts/TimeInputs/useTimeInputs.js +44 -74
- package/esm/date-time-picker/utils/constants.js +1 -7
- package/esm/date-time-picker/utils/hooks/useGetStartingFocusedDay.js +38 -36
- package/esm/toggle/ControlledToggle.js +3 -3
- package/package.json +19 -15
- package/types/date-time-picker/config/useChangeHandlers.d.ts +3 -1
- package/types/date-time-picker/config/useControlledDateTimePicker.d.ts +2 -5
- package/types/date-time-picker/config/useFocusTracker.d.ts +38 -0
- package/types/date-time-picker/config/useGetPropsBasedOnType.d.ts +6 -6
- package/types/date-time-picker/config/useGetReferences.d.ts +30 -36
- package/types/date-time-picker/config/useGlobalKeyHandlers.d.ts +3 -1
- package/types/date-time-picker/parts/DateInputs/DDInput.d.ts +2 -1
- package/types/date-time-picker/parts/DateInputs/MMInput.d.ts +2 -1
- package/types/date-time-picker/parts/DateInputs/YYYYInput.d.ts +2 -1
- package/types/date-time-picker/parts/Pickers/Calendar/useConfigCalendarCTX.d.ts +14 -0
- package/types/date-time-picker/parts/Pickers/Calendar/useFocusLogic.d.ts +1 -2
- package/types/date-time-picker/parts/Pickers/Calendar/usePopperTriggerLogic.d.ts +19 -0
- package/types/date-time-picker/parts/Pickers/TimeWheel/useKeyboardHandlers.d.ts +0 -6
- package/types/date-time-picker/parts/Pickers/TimeWheel/usePopperTriggerLogic.d.ts +14 -0
- package/types/date-time-picker/parts/TimeInputs/HHInput.d.ts +2 -1
- package/types/date-time-picker/parts/TimeInputs/MeridiemInput.d.ts +2 -1
- package/types/date-time-picker/parts/TimeInputs/MinutesInput.d.ts +2 -1
- package/types/date-time-picker/propTypes.d.ts +117 -0
- package/types/date-time-picker/sharedTypes.d.ts +1 -1
- package/types/date-time-picker/utils/constants.d.ts +0 -6
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { useContext, useCallback, useMemo } from 'react';
|
|
2
2
|
import { ControlledDateTimePickerContext } from '../../ControlledDateTimePickerCTX.js';
|
|
3
|
-
import { homeEndArrowUpDownSemiKeys, homeEndArrowUpDownSpaceKeys, homeEndArrowUpDownKeys } from '../../utils/constants.js';
|
|
4
3
|
import { prependStringWithPlaceHolders } from '../../utils/stringHelpers.js';
|
|
5
4
|
|
|
6
5
|
/* eslint-disable complexity */
|
|
@@ -9,66 +8,55 @@ const useTimeInputs = () => {
|
|
|
9
8
|
props: {
|
|
10
9
|
disabled
|
|
11
10
|
},
|
|
12
|
-
lastSegmentRef,
|
|
13
11
|
hours,
|
|
14
12
|
minutes,
|
|
15
13
|
meridiem,
|
|
16
|
-
hideDate,
|
|
17
14
|
withAnyRightController,
|
|
18
15
|
withAnyPicker,
|
|
19
16
|
withClearBtn,
|
|
20
17
|
isWithDateInputs,
|
|
21
|
-
hourInputRef,
|
|
22
|
-
minutesInputRef,
|
|
23
|
-
meridiemInputRef,
|
|
24
|
-
yearInputRef,
|
|
25
|
-
clearButtonRef,
|
|
26
|
-
pickerButtonRef,
|
|
27
|
-
monthInputRef,
|
|
28
18
|
autoFocusHourInput,
|
|
29
19
|
handleChangeHours,
|
|
30
20
|
handleChangeMinutes,
|
|
31
21
|
handleChangeMeridiem,
|
|
32
|
-
|
|
33
|
-
|
|
22
|
+
minutesInterval,
|
|
23
|
+
trackFocusFirstSegment,
|
|
24
|
+
trackFocusLastSegment,
|
|
25
|
+
trackFocusHourInput,
|
|
26
|
+
trackFocusMinuteInput,
|
|
27
|
+
trackFocusMeridiemInput,
|
|
28
|
+
trackFocusClearBtn,
|
|
29
|
+
trackFocusPicker,
|
|
30
|
+
trackFocusYearInput
|
|
34
31
|
} = useContext(ControlledDateTimePickerContext);
|
|
35
|
-
const setLatestInteractionRegionTimeInputs = useCallback(() => {
|
|
36
|
-
setLatestInteractionRegion('time-inputs');
|
|
37
|
-
}, [setLatestInteractionRegion]);
|
|
38
32
|
const onHomeKeyDown = useCallback(() => {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
if (!hideDate) monthInputRef === null || monthInputRef === void 0 ? void 0 : (_monthInputRef$curren = monthInputRef.current) === null || _monthInputRef$curren === void 0 ? void 0 : (_monthInputRef$curren2 = _monthInputRef$curren.focus) === null || _monthInputRef$curren2 === void 0 ? void 0 : _monthInputRef$curren2.call(_monthInputRef$curren);else hourInputRef === null || hourInputRef === void 0 ? void 0 : (_hourInputRef$current = hourInputRef.current) === null || _hourInputRef$current === void 0 ? void 0 : (_hourInputRef$current2 = _hourInputRef$current.focus) === null || _hourInputRef$current2 === void 0 ? void 0 : _hourInputRef$current2.call(_hourInputRef$current);
|
|
42
|
-
}, [hideDate, monthInputRef, hourInputRef]);
|
|
33
|
+
trackFocusFirstSegment();
|
|
34
|
+
}, [trackFocusFirstSegment]);
|
|
43
35
|
const onEndKeyDown = useCallback(() => {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
if (withAnyPicker) pickerButtonRef === null || pickerButtonRef === void 0 ? void 0 : (_pickerButtonRef$curr = pickerButtonRef.current) === null || _pickerButtonRef$curr === void 0 ? void 0 : (_pickerButtonRef$curr2 = _pickerButtonRef$curr.focus) === null || _pickerButtonRef$curr2 === void 0 ? void 0 : _pickerButtonRef$curr2.call(_pickerButtonRef$curr);else if (withClearBtn) clearButtonRef === null || clearButtonRef === void 0 ? void 0 : (_clearButtonRef$curre = clearButtonRef.current) === null || _clearButtonRef$curre === void 0 ? void 0 : (_clearButtonRef$curre2 = _clearButtonRef$curre.focus) === null || _clearButtonRef$curre2 === void 0 ? void 0 : _clearButtonRef$curre2.call(_clearButtonRef$curre);else meridiemInputRef === null || meridiemInputRef === void 0 ? void 0 : (_meridiemInputRef$cur = meridiemInputRef.current) === null || _meridiemInputRef$cur === void 0 ? void 0 : (_meridiemInputRef$cur2 = _meridiemInputRef$cur.focus) === null || _meridiemInputRef$cur2 === void 0 ? void 0 : _meridiemInputRef$cur2.call(_meridiemInputRef$cur);
|
|
47
|
-
}, [withAnyPicker, pickerButtonRef, withClearBtn, clearButtonRef, meridiemInputRef]);
|
|
36
|
+
trackFocusLastSegment();
|
|
37
|
+
}, [trackFocusLastSegment]);
|
|
48
38
|
const onHoursFocus = useCallback(() => {
|
|
49
|
-
|
|
50
|
-
}, [
|
|
39
|
+
trackFocusHourInput();
|
|
40
|
+
}, [trackFocusHourInput]);
|
|
51
41
|
const onHoursChange = useCallback(e => {
|
|
52
|
-
var _e$target
|
|
42
|
+
var _e$target;
|
|
53
43
|
|
|
54
44
|
let newHours = e === null || e === void 0 ? void 0 : (_e$target = e.target) === null || _e$target === void 0 ? void 0 : _e$target.value; // converts hours 2~9 to 07~09
|
|
55
45
|
|
|
56
46
|
if (Number.parseInt(newHours, 10) > 1) newHours = prependStringWithPlaceHolders(newHours, 2);
|
|
57
47
|
handleChangeHours(newHours, e); // auto-advance functionality:
|
|
58
48
|
|
|
59
|
-
if (newHours.length === 2)
|
|
60
|
-
}, [
|
|
49
|
+
if (newHours.length === 2) trackFocusMinuteInput();
|
|
50
|
+
}, [handleChangeHours, trackFocusMinuteInput]);
|
|
61
51
|
const onHoursKeyDown = useCallback(e => {
|
|
62
|
-
var _lastSegmentRef$curre, _lastSegmentRef$curre2;
|
|
63
|
-
|
|
64
52
|
const {
|
|
65
53
|
key,
|
|
66
54
|
ctrlKey,
|
|
67
55
|
metaKey
|
|
68
56
|
} = e;
|
|
69
57
|
const hoursStringConvertedToInteger = Number.parseInt(hours, 10);
|
|
70
|
-
if (
|
|
71
|
-
if (
|
|
58
|
+
if (['Home', 'End', 'ArrowUp', 'ArrowDown', ':'].includes(key)) e.preventDefault();
|
|
59
|
+
if (['Home', 'End', 'ArrowUp', 'ArrowDown', ':'].includes(key)) e.stopPropagation();
|
|
72
60
|
if (key === 'Home') onHomeKeyDown();
|
|
73
61
|
if (key === 'End') onEndKeyDown();
|
|
74
62
|
|
|
@@ -81,24 +69,20 @@ const useTimeInputs = () => {
|
|
|
81
69
|
}
|
|
82
70
|
|
|
83
71
|
if (!Number.isNaN(hoursStringConvertedToInteger) && key === ':') {
|
|
84
|
-
var _minutesInputRef$curr3, _minutesInputRef$curr4;
|
|
85
|
-
|
|
86
72
|
const newHours = prependStringWithPlaceHolders("".concat(hoursStringConvertedToInteger), 2);
|
|
87
73
|
handleChangeHours(newHours, e); // auto-advance functionality:
|
|
88
74
|
|
|
89
|
-
if (newHours.length === 2)
|
|
75
|
+
if (newHours.length === 2) trackFocusMinuteInput();
|
|
90
76
|
} // regressive backspace functionality
|
|
91
77
|
|
|
92
78
|
|
|
93
79
|
if (key === 'Backspace' && hours.length === 0 && isWithDateInputs) {
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
yearInputRef === null || yearInputRef === void 0 ? void 0 : (_yearInputRef$current = yearInputRef.current) === null || _yearInputRef$current === void 0 ? void 0 : (_yearInputRef$current2 = _yearInputRef$current.focus) === null || _yearInputRef$current2 === void 0 ? void 0 : _yearInputRef$current2.call(_yearInputRef$current);
|
|
80
|
+
trackFocusYearInput();
|
|
97
81
|
} // focus last fragment on fill with now
|
|
98
82
|
|
|
99
83
|
|
|
100
|
-
if ((ctrlKey || metaKey) && key === ';')
|
|
101
|
-
}, [hours,
|
|
84
|
+
if ((ctrlKey || metaKey) && key === ';') trackFocusLastSegment();
|
|
85
|
+
}, [hours, isWithDateInputs, trackFocusYearInput, onHomeKeyDown, onEndKeyDown, trackFocusLastSegment, trackFocusMinuteInput, handleChangeHours]);
|
|
102
86
|
const onHoursBlur = useCallback(e => {
|
|
103
87
|
var _e$target2;
|
|
104
88
|
|
|
@@ -110,30 +94,27 @@ const useTimeInputs = () => {
|
|
|
110
94
|
});
|
|
111
95
|
}, [handleChangeHours]);
|
|
112
96
|
const onMinutesFocus = useCallback(() => {
|
|
113
|
-
|
|
114
|
-
}, [
|
|
97
|
+
trackFocusMinuteInput();
|
|
98
|
+
}, [trackFocusMinuteInput]);
|
|
115
99
|
const onMinutesChange = useCallback(e => {
|
|
116
|
-
var _e$target3
|
|
100
|
+
var _e$target3;
|
|
117
101
|
|
|
118
102
|
let newMinutes = e === null || e === void 0 ? void 0 : (_e$target3 = e.target) === null || _e$target3 === void 0 ? void 0 : _e$target3.value; // converts minutes 7~9 to 07~09
|
|
119
103
|
|
|
120
104
|
if (Number.parseInt(newMinutes, 10) > 6) newMinutes = prependStringWithPlaceHolders(newMinutes, 2);
|
|
121
105
|
handleChangeMinutes(newMinutes, e); // auto-advance functionality:
|
|
122
|
-
// if (newMinutes.length === 2) secondsInputRef?.current?.focus?.();
|
|
123
106
|
|
|
124
|
-
if (newMinutes.length === 2)
|
|
125
|
-
}, [
|
|
107
|
+
if (newMinutes.length === 2) trackFocusMeridiemInput();
|
|
108
|
+
}, [handleChangeMinutes, trackFocusMeridiemInput]);
|
|
126
109
|
const onMinutesKeyDown = useCallback(e => {
|
|
127
|
-
var _lastSegmentRef$curre3, _lastSegmentRef$curre4;
|
|
128
|
-
|
|
129
110
|
const {
|
|
130
111
|
key,
|
|
131
112
|
ctrlKey,
|
|
132
113
|
metaKey
|
|
133
114
|
} = e;
|
|
134
115
|
const minutesStringConvertedToInteger = Number.parseInt(minutes, 10);
|
|
135
|
-
if (
|
|
136
|
-
if (
|
|
116
|
+
if (['Home', 'End', 'ArrowUp', 'ArrowDown', ' '].includes(key)) e.preventDefault();
|
|
117
|
+
if (['Home', 'End', 'ArrowUp', 'ArrowDown', ' '].includes(key)) e.stopPropagation();
|
|
137
118
|
if (key === 'Home') onHomeKeyDown();
|
|
138
119
|
if (key === 'End') onEndKeyDown();
|
|
139
120
|
|
|
@@ -146,25 +127,20 @@ const useTimeInputs = () => {
|
|
|
146
127
|
}
|
|
147
128
|
|
|
148
129
|
if (!Number.isNaN(minutesStringConvertedToInteger) && key === ' ') {
|
|
149
|
-
var _meridiemInputRef$cur5, _meridiemInputRef$cur6;
|
|
150
|
-
|
|
151
130
|
const newMinutes = prependStringWithPlaceHolders("".concat(minutesStringConvertedToInteger), 2);
|
|
152
131
|
handleChangeMinutes(newMinutes, e); // auto-advance functionality:
|
|
153
|
-
// if (newMinutes.length === 2) secondsInputRef?.current?.focus?.();
|
|
154
132
|
|
|
155
|
-
if (newMinutes.length === 2)
|
|
133
|
+
if (newMinutes.length === 2) trackFocusMeridiemInput();
|
|
156
134
|
} // regressive backspace functionality
|
|
157
135
|
|
|
158
136
|
|
|
159
137
|
if (key === 'Backspace' && (minutes === null || minutes === void 0 ? void 0 : minutes.length) === 0) {
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
hourInputRef === null || hourInputRef === void 0 ? void 0 : (_hourInputRef$current3 = hourInputRef.current) === null || _hourInputRef$current3 === void 0 ? void 0 : (_hourInputRef$current4 = _hourInputRef$current3.focus) === null || _hourInputRef$current4 === void 0 ? void 0 : _hourInputRef$current4.call(_hourInputRef$current3);
|
|
138
|
+
trackFocusHourInput();
|
|
163
139
|
} // focus last fragment on fill with now
|
|
164
140
|
|
|
165
141
|
|
|
166
|
-
if ((ctrlKey || metaKey) && key === ';')
|
|
167
|
-
}, [minutes, onHomeKeyDown, onEndKeyDown,
|
|
142
|
+
if ((ctrlKey || metaKey) && key === ';') trackFocusLastSegment();
|
|
143
|
+
}, [minutes, onHomeKeyDown, onEndKeyDown, trackFocusLastSegment, minutesInterval, handleChangeMinutes, trackFocusMeridiemInput, trackFocusHourInput]);
|
|
168
144
|
const onMinutesBlur = useCallback(e => {
|
|
169
145
|
var _e$target4;
|
|
170
146
|
|
|
@@ -174,8 +150,8 @@ const useTimeInputs = () => {
|
|
|
174
150
|
});
|
|
175
151
|
}, [handleChangeMinutes]);
|
|
176
152
|
const onMeridiemFocus = useCallback(() => {
|
|
177
|
-
|
|
178
|
-
}, [
|
|
153
|
+
trackFocusMeridiemInput();
|
|
154
|
+
}, [trackFocusMeridiemInput]);
|
|
179
155
|
const onMeridiemChange = useCallback(e => {
|
|
180
156
|
var _e$target5, _e$target5$value, _e$target5$value$toUp;
|
|
181
157
|
|
|
@@ -187,35 +163,29 @@ const useTimeInputs = () => {
|
|
|
187
163
|
handleChangeMeridiem(newMeridiem, e); // auto-advance functionality:
|
|
188
164
|
|
|
189
165
|
if (newMeridiem.length === 2 && withAnyRightController) {
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
if (withClearBtn) (_clearButtonRef$curre3 = clearButtonRef.current) === null || _clearButtonRef$curre3 === void 0 ? void 0 : (_clearButtonRef$curre4 = _clearButtonRef$curre3.focus) === null || _clearButtonRef$curre4 === void 0 ? void 0 : _clearButtonRef$curre4.call(_clearButtonRef$curre3);else if (withAnyPicker) pickerButtonRef === null || pickerButtonRef === void 0 ? void 0 : (_pickerButtonRef$curr3 = pickerButtonRef.current) === null || _pickerButtonRef$curr3 === void 0 ? void 0 : (_pickerButtonRef$curr4 = _pickerButtonRef$curr3.focus) === null || _pickerButtonRef$curr4 === void 0 ? void 0 : _pickerButtonRef$curr4.call(_pickerButtonRef$curr3);
|
|
166
|
+
if (withClearBtn) trackFocusClearBtn();else if (withAnyPicker) trackFocusPicker();
|
|
193
167
|
}
|
|
194
|
-
}, [meridiem, handleChangeMeridiem, withAnyRightController, withClearBtn,
|
|
168
|
+
}, [meridiem, handleChangeMeridiem, withAnyRightController, withClearBtn, trackFocusClearBtn, withAnyPicker, trackFocusPicker]);
|
|
195
169
|
const onMeridiemKeyDown = useCallback(e => {
|
|
196
|
-
var _lastSegmentRef$curre5, _lastSegmentRef$curre6;
|
|
197
|
-
|
|
198
170
|
const {
|
|
199
171
|
key,
|
|
200
172
|
ctrlKey,
|
|
201
173
|
metaKey
|
|
202
174
|
} = e;
|
|
203
|
-
if (
|
|
204
|
-
if (
|
|
175
|
+
if (['Home', 'End', 'ArrowUp', 'ArrowDown'].includes(key)) e.preventDefault();
|
|
176
|
+
if (['Home', 'End', 'ArrowUp', 'ArrowDown'].includes(key)) e.stopPropagation();
|
|
205
177
|
if (key === 'Home') onHomeKeyDown();
|
|
206
178
|
if (key === 'End') onEndKeyDown();
|
|
207
179
|
if (key === 'ArrowUp' && meridiem !== 'AM') handleChangeMeridiem('AM', e);
|
|
208
180
|
if (key === 'ArrowDown' && meridiem !== 'PM') handleChangeMeridiem('PM', e); // regressive backspace functionality
|
|
209
181
|
|
|
210
182
|
if (key === 'Backspace') {
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
if ((meridiem === null || meridiem === void 0 ? void 0 : meridiem.length) === 2) handleChangeMeridiem('', e);else minutesInputRef === null || minutesInputRef === void 0 ? void 0 : (_minutesInputRef$curr5 = minutesInputRef.current) === null || _minutesInputRef$curr5 === void 0 ? void 0 : (_minutesInputRef$curr6 = _minutesInputRef$curr5.focus) === null || _minutesInputRef$curr6 === void 0 ? void 0 : _minutesInputRef$curr6.call(_minutesInputRef$curr5);
|
|
183
|
+
if ((meridiem === null || meridiem === void 0 ? void 0 : meridiem.length) === 2) handleChangeMeridiem('', e);else trackFocusMinuteInput();
|
|
214
184
|
} // focus last fragment on fill with now
|
|
215
185
|
|
|
216
186
|
|
|
217
|
-
if ((ctrlKey || metaKey) && key === ';')
|
|
218
|
-
}, [onHomeKeyDown, onEndKeyDown, meridiem, handleChangeMeridiem,
|
|
187
|
+
if ((ctrlKey || metaKey) && key === ';') trackFocusLastSegment();
|
|
188
|
+
}, [onHomeKeyDown, onEndKeyDown, meridiem, handleChangeMeridiem, trackFocusLastSegment, trackFocusMinuteInput]);
|
|
219
189
|
const onMeridiemBlur = useCallback(e => {
|
|
220
190
|
var _e$target6, _e$target6$value, _e$target6$value$toUp;
|
|
221
191
|
|
|
@@ -33,14 +33,8 @@ const announcableCardinalDays = {
|
|
|
33
33
|
30: 'thirtieth',
|
|
34
34
|
31: 'thirty first'
|
|
35
35
|
};
|
|
36
|
-
const homeEndAllArrowKeys = ['Home', 'End', 'ArrowUp', 'ArrowDown', 'ArrowLeft', 'ArrowRight'];
|
|
37
|
-
const homeEndKeys = ['Home', 'End'];
|
|
38
|
-
const homeEndArrowUpDownDashSlashesKeys = ['Home', 'End', 'ArrowUp', 'ArrowDown', '-', '/', '\\'];
|
|
39
|
-
const homeEndArrowUpDownSpaceKeys = ['Home', 'End', 'ArrowUp', 'ArrowDown', ' '];
|
|
40
|
-
const homeEndArrowUpDownSemiKeys = ['Home', 'End', 'ArrowUp', 'ArrowDown', ':'];
|
|
41
|
-
const homeEndArrowUpDownKeys = ['Home', 'End', 'ArrowUp', 'ArrowDown'];
|
|
42
36
|
const defaultMetaInfo = {
|
|
43
37
|
isAutomaticFillTrigger: false
|
|
44
38
|
};
|
|
45
39
|
|
|
46
|
-
export { announcableCardinalDays, defaultMetaInfo,
|
|
40
|
+
export { announcableCardinalDays, defaultMetaInfo, monthNames, weekDays };
|
|
@@ -25,50 +25,52 @@ const useGetStartingFocusedDay = () => {
|
|
|
25
25
|
onCalendarOpenFocusedDay
|
|
26
26
|
} = useContext(ControlledDateTimePickerContext);
|
|
27
27
|
const dayFromInputValues = useGetDayFromDateString();
|
|
28
|
+
const {
|
|
29
|
+
month: inputValuesSplitMonth,
|
|
30
|
+
day: inputValuesSplitDay,
|
|
31
|
+
year: inputValuesDaySplitYear
|
|
32
|
+
} = dayFromInputValues ? getDateValuesFromDate(dayFromInputValues) : {
|
|
33
|
+
month: null,
|
|
34
|
+
day: null,
|
|
35
|
+
year: null
|
|
36
|
+
};
|
|
37
|
+
const isInputFilledAndValid = inputValuesSplitMonth && inputValuesSplitDay && inputValuesDaySplitYear && isValidDayForTheMonth(inputValuesSplitMonth, inputValuesDaySplitYear, inputValuesSplitDay);
|
|
38
|
+
const isOnCalendarOpenFocusedDayEmpty = !onCalendarOpenFocusedDay;
|
|
39
|
+
const shouldFillWithOnCalendarOpenFocusedDay = !isInputFilledAndValid && !isOnCalendarOpenFocusedDayEmpty;
|
|
28
40
|
return useMemo(() => {
|
|
29
|
-
const startingDay = _objectSpread({}, empty);
|
|
41
|
+
const startingDay = _objectSpread({}, empty); // if input was filled start focus is the filled value (if it's valid day for the month)
|
|
30
42
|
|
|
31
|
-
if (dayFromInputValues) {
|
|
32
|
-
const {
|
|
33
|
-
month: inputValuesSplitMonth,
|
|
34
|
-
day: inputValuesSplitDay,
|
|
35
|
-
year: inputValuesDaySplitYear
|
|
36
|
-
} = getDateValuesFromDate(dayFromInputValues);
|
|
37
|
-
const isInputFilledAndValid = inputValuesSplitMonth && inputValuesSplitDay && inputValuesDaySplitYear && isValidDayForTheMonth(inputValuesSplitMonth, inputValuesDaySplitYear, inputValuesSplitDay);
|
|
38
|
-
const isOnCalendarOpenFocusedDayEmpty = !onCalendarOpenFocusedDay;
|
|
39
|
-
const shouldFillWithOnCalendarOpenFocusedDay = !isInputFilledAndValid && !isOnCalendarOpenFocusedDayEmpty; // if input was filled start focus is the filled value (if it's valid day for the month)
|
|
40
43
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
44
|
+
if (isInputFilledAndValid) {
|
|
45
|
+
startingDay.startFocusedMonth = inputValuesSplitMonth;
|
|
46
|
+
startingDay.startFocusedDay = inputValuesSplitDay;
|
|
47
|
+
startingDay.startFocusedYear = inputValuesDaySplitYear;
|
|
48
|
+
startingDay.startFocusedDate = dayFromInputValues; // if input was not filled (or filled invalid) and there is no onCalendarOpenFocusedDay start focus is not a day
|
|
49
|
+
} else if (isOnCalendarOpenFocusedDayEmpty) {
|
|
50
|
+
// if input was not filled and there is onCalendarOpenFocusedDay start focus is onCalendarOpenFocusedDay day
|
|
51
|
+
return empty;
|
|
52
|
+
} else if (shouldFillWithOnCalendarOpenFocusedDay) {
|
|
53
|
+
const {
|
|
54
|
+
month: focusedDaySplitMonth,
|
|
55
|
+
day: focusedDaySplitDay,
|
|
56
|
+
year: focusedDaySplitYear
|
|
57
|
+
} = deconstructValuesFromDateString(onCalendarOpenFocusedDay);
|
|
58
|
+
const monthAsInt = convertToPositiveNumberIfPossible(focusedDaySplitMonth);
|
|
59
|
+
const dayAsInt = convertToPositiveNumberIfPossible(focusedDaySplitDay);
|
|
60
|
+
const yearAsInt = convertToPositiveNumberIfPossible(focusedDaySplitYear); // if this condition is false, return will be the same as return empty
|
|
61
|
+
// because startFocusedMonth/Day/Year/Date will be === null
|
|
62
|
+
// which is the expected result
|
|
60
63
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
}
|
|
64
|
+
if (monthAsInt !== -1 && dayAsInt !== -1 && yearAsInt !== -1 && isValidDayForTheMonth(monthAsInt - 1, yearAsInt, dayAsInt)) {
|
|
65
|
+
startingDay.startFocusedMonth = monthAsInt;
|
|
66
|
+
startingDay.startFocusedDay = dayAsInt;
|
|
67
|
+
startingDay.startFocusedYear = yearAsInt;
|
|
68
|
+
startingDay.startFocusedDate = new Date(yearAsInt, monthAsInt - 1, dayAsInt);
|
|
67
69
|
}
|
|
68
70
|
}
|
|
69
71
|
|
|
70
72
|
return startingDay;
|
|
71
|
-
}, [dayFromInputValues, onCalendarOpenFocusedDay]);
|
|
73
|
+
}, [dayFromInputValues, inputValuesDaySplitYear, inputValuesSplitDay, inputValuesSplitMonth, isInputFilledAndValid, isOnCalendarOpenFocusedDayEmpty, onCalendarOpenFocusedDay, shouldFillWithOnCalendarOpenFocusedDay]);
|
|
72
74
|
};
|
|
73
75
|
|
|
74
76
|
export { useGetStartingFocusedDay };
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
+
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
2
|
+
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
3
|
+
import 'core-js/modules/web.dom-collections.iterator.js';
|
|
1
4
|
import 'core-js/modules/esnext.async-iterator.filter.js';
|
|
2
5
|
import 'core-js/modules/esnext.iterator.constructor.js';
|
|
3
6
|
import 'core-js/modules/esnext.iterator.filter.js';
|
|
4
7
|
import 'core-js/modules/esnext.async-iterator.for-each.js';
|
|
5
8
|
import 'core-js/modules/esnext.iterator.for-each.js';
|
|
6
|
-
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
7
|
-
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
8
|
-
import 'core-js/modules/web.dom-collections.iterator.js';
|
|
9
9
|
import { useState, useRef, useMemo, useEffect, useCallback } from 'react';
|
|
10
10
|
import { uid } from 'uid';
|
|
11
11
|
import { describe } from 'react-desc';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elliemae/ds-controlled-form",
|
|
3
|
-
"version": "2.4.2-rc.
|
|
3
|
+
"version": "2.4.2-rc.3",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "ICE MT - Dimsum - Controlled Form Controllers",
|
|
6
6
|
"module": "./esm/index.js",
|
|
@@ -511,6 +511,10 @@
|
|
|
511
511
|
"import": "./esm/date-time-picker/config/useGetDestructuredValues.js",
|
|
512
512
|
"require": "./cjs/date-time-picker/config/useGetDestructuredValues.js"
|
|
513
513
|
},
|
|
514
|
+
"./date-time-picker/config/useFocusTracker": {
|
|
515
|
+
"import": "./esm/date-time-picker/config/useFocusTracker.js",
|
|
516
|
+
"require": "./cjs/date-time-picker/config/useFocusTracker.js"
|
|
517
|
+
},
|
|
514
518
|
"./date-time-picker/config/useControlledDateTimePicker": {
|
|
515
519
|
"import": "./esm/date-time-picker/config/useControlledDateTimePicker.js",
|
|
516
520
|
"require": "./cjs/date-time-picker/config/useControlledDateTimePicker.js"
|
|
@@ -872,20 +876,20 @@
|
|
|
872
876
|
"build": "node ../../scripts/build/build.js"
|
|
873
877
|
},
|
|
874
878
|
"dependencies": {
|
|
875
|
-
"@elliemae/ds-button": "2.4.2-rc.
|
|
876
|
-
"@elliemae/ds-circular-progress-indicator": "2.4.2-rc.
|
|
877
|
-
"@elliemae/ds-controlled-form": "2.4.2-rc.
|
|
878
|
-
"@elliemae/ds-form": "2.4.2-rc.
|
|
879
|
-
"@elliemae/ds-form-layout-blocks": "2.4.2-rc.
|
|
880
|
-
"@elliemae/ds-grid": "2.4.2-rc.
|
|
881
|
-
"@elliemae/ds-icon": "2.4.2-rc.
|
|
882
|
-
"@elliemae/ds-icons": "2.4.2-rc.
|
|
883
|
-
"@elliemae/ds-pills": "2.4.2-rc.
|
|
884
|
-
"@elliemae/ds-popperjs": "2.4.2-rc.
|
|
885
|
-
"@elliemae/ds-props-helpers": "2.4.2-rc.
|
|
886
|
-
"@elliemae/ds-system": "2.4.2-rc.
|
|
887
|
-
"@elliemae/ds-tooltip": "2.4.2-rc.
|
|
888
|
-
"@elliemae/ds-truncated-tooltip-text": "2.4.2-rc.
|
|
879
|
+
"@elliemae/ds-button": "2.4.2-rc.3",
|
|
880
|
+
"@elliemae/ds-circular-progress-indicator": "2.4.2-rc.3",
|
|
881
|
+
"@elliemae/ds-controlled-form": "2.4.2-rc.3",
|
|
882
|
+
"@elliemae/ds-form": "2.4.2-rc.3",
|
|
883
|
+
"@elliemae/ds-form-layout-blocks": "2.4.2-rc.3",
|
|
884
|
+
"@elliemae/ds-grid": "2.4.2-rc.3",
|
|
885
|
+
"@elliemae/ds-icon": "2.4.2-rc.3",
|
|
886
|
+
"@elliemae/ds-icons": "2.4.2-rc.3",
|
|
887
|
+
"@elliemae/ds-pills": "2.4.2-rc.3",
|
|
888
|
+
"@elliemae/ds-popperjs": "2.4.2-rc.3",
|
|
889
|
+
"@elliemae/ds-props-helpers": "2.4.2-rc.3",
|
|
890
|
+
"@elliemae/ds-system": "2.4.2-rc.3",
|
|
891
|
+
"@elliemae/ds-tooltip": "2.4.2-rc.3",
|
|
892
|
+
"@elliemae/ds-truncated-tooltip-text": "2.4.2-rc.3",
|
|
889
893
|
"prop-types": "~15.7.2",
|
|
890
894
|
"react-desc": "~4.1.3",
|
|
891
895
|
"react-popper": "~2.2.5",
|
|
@@ -2,6 +2,7 @@ import { useRelevantValueFromProps } from './useRelevantValueFromProps';
|
|
|
2
2
|
import { useGetDestructuredValues } from './useGetDestructuredValues';
|
|
3
3
|
import { useGetPropsBasedOnType } from './useGetPropsBasedOnType';
|
|
4
4
|
import { useGetReferences } from './useGetReferences';
|
|
5
|
+
import { useFocusTracker } from './useFocusTracker';
|
|
5
6
|
import type { DSControlledDateTimePickerT } from '../propTypes';
|
|
6
7
|
import type { DSControlledDateTimePickerInternalsT } from '../sharedTypes';
|
|
7
8
|
interface Config {
|
|
@@ -9,8 +10,9 @@ interface Config {
|
|
|
9
10
|
destructuredValues: ReturnType<typeof useGetDestructuredValues>;
|
|
10
11
|
propsBasedOnType: ReturnType<typeof useGetPropsBasedOnType>;
|
|
11
12
|
DOMRefs: ReturnType<typeof useGetReferences>;
|
|
13
|
+
focusTrackers: ReturnType<typeof useFocusTracker>;
|
|
12
14
|
}
|
|
13
|
-
export declare const useChangeHandlers: ({ relevantValues, destructuredValues, propsBasedOnType,
|
|
15
|
+
export declare const useChangeHandlers: ({ relevantValues, destructuredValues, propsBasedOnType, focusTrackers }: Config) => {
|
|
14
16
|
handleChangeComposedDateTimeString: (newDateString: string, newTimeString: string, metaInfo: DSControlledDateTimePickerT.InternalInputsChangeMetaInfo) => void;
|
|
15
17
|
handleChangeComposedDateString: (newDateString: string, metaInfo: Partial<DSControlledDateTimePickerT.InternalInputsChangeMetaInfo>) => void;
|
|
16
18
|
handleChangeComposedTimeString: (newTimeString: string, metaInfo: Partial<DSControlledDateTimePickerT.InternalInputsChangeMetaInfo>) => void;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { useFocusTracker } from './useFocusTracker';
|
|
2
2
|
import { useGetFlags } from './useGetFlags';
|
|
3
3
|
import { useGetReferences } from './useGetReferences';
|
|
4
4
|
import { useRelevantValueFromProps } from './useRelevantValueFromProps';
|
|
@@ -7,12 +7,9 @@ import { useGetDestructuredValues } from './useGetDestructuredValues';
|
|
|
7
7
|
import { useChangeHandlers } from './useChangeHandlers';
|
|
8
8
|
import { useGlobalKeyHandlers } from './useGlobalKeyHandlers';
|
|
9
9
|
import type { DSControlledDateTimePickerT } from '../propTypes';
|
|
10
|
-
export declare type
|
|
11
|
-
export declare type ControlledDateTimePickerContextT = ReturnType<typeof useGetFlags> & ReturnType<typeof useGetReferences> & ReturnType<typeof useGetPropsBasedOnType> & ReturnType<typeof useRelevantValueFromProps> & ReturnType<typeof useGetDestructuredValues> & ReturnType<typeof useChangeHandlers> & ReturnType<typeof useGlobalKeyHandlers> & {
|
|
10
|
+
export declare type ControlledDateTimePickerContextT = ReturnType<typeof useGetFlags> & ReturnType<typeof useFocusTracker> & ReturnType<typeof useGetReferences> & ReturnType<typeof useGetPropsBasedOnType> & ReturnType<typeof useRelevantValueFromProps> & ReturnType<typeof useGetDestructuredValues> & ReturnType<typeof useChangeHandlers> & ReturnType<typeof useGlobalKeyHandlers> & {
|
|
12
11
|
props: DSControlledDateTimePickerT.InternalProps;
|
|
13
12
|
ariaCurrentValueForInputs: string;
|
|
14
13
|
dataAttrs: Record<string, string>;
|
|
15
|
-
latestInteractionRegion: LatestInteractionRegion;
|
|
16
|
-
setLatestInteractionRegion: React.Dispatch<React.SetStateAction<LatestInteractionRegion>>;
|
|
17
14
|
};
|
|
18
15
|
export declare const useControlledDateTimePicker: (props: DSControlledDateTimePickerT.Props) => ControlledDateTimePickerContextT;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { useGetReferences } from './useGetReferences';
|
|
3
|
+
import { useGetFlags } from './useGetFlags';
|
|
4
|
+
declare type LatestInteractionRegion = 'calendar-days' | 'calendar-head' | 'timewheel' | 'date-inputs' | 'time-inputs' | 'clear-btn' | 'picker-icon' | '';
|
|
5
|
+
declare type CurrFocusDescriber = 'first-segment' | 'month-input' | 'day-input' | 'year-input' | 'hour-input' | 'minute-input' | 'meridiem-input' | 'last-segment' | 'clear-btn' | 'date-picker-icon' | 'time-picker-icon' | 'datetime-picker-icon' | 'calendar-prev-month' | 'calendar-next-month' | 'calendar-prev-year' | 'calendar-next-year' | 'calendar-metafocused-day' | 'timewheel-curr-hour' | 'timewheel-curr-minute' | 'timewheel-curr-meridiem' | '';
|
|
6
|
+
interface Config {
|
|
7
|
+
DOMRefs: ReturnType<typeof useGetReferences>;
|
|
8
|
+
flags: ReturnType<typeof useGetFlags>;
|
|
9
|
+
}
|
|
10
|
+
export declare const useFocusTracker: ({ DOMRefs, flags }: Config) => {
|
|
11
|
+
latestInteractionRegion: LatestInteractionRegion;
|
|
12
|
+
setLatestInteractionRegion: import("react").Dispatch<import("react").SetStateAction<LatestInteractionRegion>>;
|
|
13
|
+
currFocusDescriber: CurrFocusDescriber;
|
|
14
|
+
setCurrFocusDescriber: import("react").Dispatch<import("react").SetStateAction<CurrFocusDescriber>>;
|
|
15
|
+
trackFocusResetter: () => void;
|
|
16
|
+
trackFocusMonthInput: () => void;
|
|
17
|
+
trackFocusDayInput: () => void;
|
|
18
|
+
trackFocusYearInput: () => void;
|
|
19
|
+
trackFocusHourInput: () => void;
|
|
20
|
+
trackFocusMinuteInput: () => void;
|
|
21
|
+
trackFocusMeridiemInput: () => void;
|
|
22
|
+
trackFocusClearBtn: () => void;
|
|
23
|
+
trackFocusDatePickerIcon: () => void;
|
|
24
|
+
trackFocusTimePickerIcon: () => void;
|
|
25
|
+
trackFocusDatetimePickerIcon: () => void;
|
|
26
|
+
trackFocusCalendarPrevMonth: () => void;
|
|
27
|
+
trackFocusCalendarNextMonth: () => void;
|
|
28
|
+
trackFocusCalendarPrevYear: () => void;
|
|
29
|
+
trackFocusCalendarNextYear: () => void;
|
|
30
|
+
trackFocusCalendarMetafocusedDay: () => void;
|
|
31
|
+
trackFocusTimewheelCurrHour: () => void;
|
|
32
|
+
trackFocusTimewheelCurrMinute: () => void;
|
|
33
|
+
trackFocusTimewheelCurrMeridiem: () => void;
|
|
34
|
+
trackFocusPicker: () => void;
|
|
35
|
+
trackFocusFirstSegment: () => void;
|
|
36
|
+
trackFocusLastSegment: () => void;
|
|
37
|
+
};
|
|
38
|
+
export {};
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import type { DSControlledDateTimePickerT } from '../propTypes';
|
|
2
2
|
export declare const useGetPropsBasedOnType: (propsWithDefaults: DSControlledDateTimePickerT.InternalProps) => {
|
|
3
|
-
getIsDisabledDay:
|
|
4
|
-
getIsOutOfRangeDay:
|
|
5
|
-
getIsStartRangeDay:
|
|
6
|
-
getIsDayInRange:
|
|
7
|
-
getIsEndRangeDay:
|
|
3
|
+
getIsDisabledDay: BooleanGetter<string>;
|
|
4
|
+
getIsOutOfRangeDay: BooleanGetter<string>;
|
|
5
|
+
getIsStartRangeDay: BooleanGetter<string> | (() => void);
|
|
6
|
+
getIsDayInRange: BooleanGetter<string> | (() => void);
|
|
7
|
+
getIsEndRangeDay: BooleanGetter<string> | (() => void);
|
|
8
8
|
appOnDateChange: DSControlledDateTimePickerT.OnDateChange;
|
|
9
9
|
appOnMonthChange: DSControlledDateTimePickerT.OnInternalInputsChange;
|
|
10
10
|
appOnDayChange: DSControlledDateTimePickerT.OnInternalInputsChange;
|
|
11
11
|
appOnYearChange: DSControlledDateTimePickerT.OnInternalInputsChange;
|
|
12
12
|
appDate: string;
|
|
13
|
-
getIsDisabledTime:
|
|
13
|
+
getIsDisabledTime: BooleanGetter<string>;
|
|
14
14
|
appOnTimeChange: DSControlledDateTimePickerT.OnTimeChange;
|
|
15
15
|
appOnHourChange: DSControlledDateTimePickerT.OnInternalInputsChange;
|
|
16
16
|
appOnMinuteChange: DSControlledDateTimePickerT.OnInternalInputsChange;
|
|
@@ -1,39 +1,33 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { useGetFlags } from './useGetFlags';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
};
|
|
33
|
-
lastFragmentRefUpdateDeps: {
|
|
34
|
-
withAnyPicker: boolean;
|
|
35
|
-
withClearBtn: boolean;
|
|
36
|
-
isWithTimeInputs: boolean;
|
|
37
|
-
isWithDateInputs: boolean;
|
|
38
|
-
};
|
|
3
|
+
declare type FirstSegment = 'month-input' | 'hour-input' | 'date-picker-icon' | 'time-picker-icon' | 'datetime-picker-icon' | '';
|
|
4
|
+
declare type LastSegment = 'year-input' | 'meridiem-input' | 'clear-btn' | 'date-picker-icon' | 'time-picker-icon' | 'datetime-picker-icon' | '';
|
|
5
|
+
export declare const useGetReferences: ({ isWithDateInputs, isWithTimeInputs, isDateSelector, isTimeSelector, isDateTimeSelector, withAnyPicker, withClearBtn, }: ReturnType<typeof useGetFlags>) => {
|
|
6
|
+
monthInputRef: import("react").MutableRefObject<HTMLInputElement>;
|
|
7
|
+
dayInputRef: import("react").MutableRefObject<HTMLInputElement>;
|
|
8
|
+
yearInputRef: import("react").MutableRefObject<HTMLInputElement>;
|
|
9
|
+
hourInputRef: import("react").MutableRefObject<HTMLInputElement>;
|
|
10
|
+
minutesInputRef: import("react").MutableRefObject<HTMLInputElement>;
|
|
11
|
+
meridiemInputRef: import("react").MutableRefObject<HTMLInputElement>;
|
|
12
|
+
clearButtonRef: import("react").MutableRefObject<HTMLButtonElement>;
|
|
13
|
+
pickerButtonRef: import("react").MutableRefObject<HTMLButtonElement>;
|
|
14
|
+
prevYearBtnRef: import("react").MutableRefObject<HTMLButtonElement>;
|
|
15
|
+
prevMonthBtnRef: import("react").MutableRefObject<HTMLButtonElement>;
|
|
16
|
+
nextMonthBtnRef: import("react").MutableRefObject<HTMLButtonElement>;
|
|
17
|
+
nextYearBtnRef: import("react").MutableRefObject<HTMLButtonElement>;
|
|
18
|
+
calendarDaysWrapperRef: import("react").MutableRefObject<HTMLDivElement>;
|
|
19
|
+
prevHourBtnRef: import("react").MutableRefObject<HTMLButtonElement>;
|
|
20
|
+
currHourBtnRef: import("react").MutableRefObject<HTMLButtonElement>;
|
|
21
|
+
nextHourBtnRef: import("react").MutableRefObject<HTMLButtonElement>;
|
|
22
|
+
prevMinutesBtnRef: import("react").MutableRefObject<HTMLButtonElement>;
|
|
23
|
+
currMinutesBtnRef: import("react").MutableRefObject<HTMLButtonElement>;
|
|
24
|
+
nextMinutesBtnRef: import("react").MutableRefObject<HTMLButtonElement>;
|
|
25
|
+
prevMeridiemBtnRef: import("react").MutableRefObject<HTMLButtonElement>;
|
|
26
|
+
currMeridiemBtnRef: import("react").MutableRefObject<HTMLButtonElement>;
|
|
27
|
+
nextMeridiemBtnRef: import("react").MutableRefObject<HTMLButtonElement>;
|
|
28
|
+
firstSegmentRef: import("react").MutableRefObject<HTMLInputElement | HTMLButtonElement>;
|
|
29
|
+
lastSegmentRef: import("react").MutableRefObject<HTMLInputElement | HTMLButtonElement>;
|
|
30
|
+
firstSegment: FirstSegment;
|
|
31
|
+
lastSegment: LastSegment;
|
|
39
32
|
};
|
|
33
|
+
export {};
|
|
@@ -2,14 +2,16 @@ import { useChangeHandlers } from './useChangeHandlers';
|
|
|
2
2
|
import { useGetPropsBasedOnType } from './useGetPropsBasedOnType';
|
|
3
3
|
import { useGetReferences } from './useGetReferences';
|
|
4
4
|
import { useGetFlags } from './useGetFlags';
|
|
5
|
+
import { useFocusTracker } from './useFocusTracker';
|
|
5
6
|
import type { DSControlledDateTimePickerT } from '../propTypes';
|
|
6
7
|
interface Config {
|
|
7
8
|
propsBasedOnType: ReturnType<typeof useGetPropsBasedOnType>;
|
|
8
9
|
changeHandlers: ReturnType<typeof useChangeHandlers>;
|
|
9
10
|
DOMRefs: ReturnType<typeof useGetReferences>;
|
|
10
11
|
flags: ReturnType<typeof useGetFlags>;
|
|
12
|
+
focusTrackers: ReturnType<typeof useFocusTracker>;
|
|
11
13
|
}
|
|
12
|
-
export declare const useGlobalKeyHandlers: ({ propsBasedOnType, changeHandlers,
|
|
14
|
+
export declare const useGlobalKeyHandlers: ({ propsBasedOnType, changeHandlers, flags, focusTrackers }: Config) => {
|
|
13
15
|
onFillWithCurrentDateKeys: (e: React.KeyboardEvent<HTMLInputElement | HTMLButtonElement>, metaInfo?: Partial<DSControlledDateTimePickerT.InternalInputsChangeMetaInfo>) => void;
|
|
14
16
|
onGlobalKeyDown: (e: React.KeyboardEvent<HTMLInputElement | HTMLButtonElement>) => void;
|
|
15
17
|
};
|