@elliemae/ds-controlled-form 2.4.1 → 2.4.2-rc.11
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/autocomplete/config/useAutocomplete.js +1 -3
- package/cjs/autocomplete/parts/A11yFocusedOption.js +43 -0
- package/cjs/autocomplete/parts/container/Container.js +36 -24
- package/cjs/autocomplete/parts/container/styled.js +2 -2
- package/cjs/autocomplete/parts/menu-list/MenuList.js +4 -2
- package/cjs/autocomplete/parts/styled.js +2 -0
- package/cjs/autocomplete/utils/listHelper.js +1 -1
- package/cjs/checkbox/ControlledCheckbox.js +49 -33
- package/cjs/checkbox/exported-related/data-test-ids.js +10 -0
- package/cjs/checkbox/exported-related/index.js +12 -0
- package/cjs/checkbox/exported-related/theming.js +13 -0
- package/cjs/checkbox/react-desc-prop-types.js +2 -2
- package/cjs/checkbox/styles.js +28 -15
- package/cjs/combobox/ComboBoxCTX.js +7 -4
- package/cjs/combobox/ComboboxDataTestids.js +1 -1
- package/cjs/combobox/config/useComboBox.js +21 -8
- package/cjs/combobox/index.js +5 -0
- package/cjs/combobox/parts/A11yFocusedOption.js +14 -6
- package/cjs/combobox/parts/A11ySelectedValues.js +0 -2
- package/cjs/combobox/parts/DropdownIndicator.js +4 -4
- package/cjs/combobox/parts/container/Container.js +14 -17
- package/cjs/combobox/parts/container/styled.js +13 -7
- package/cjs/combobox/parts/controls/Controls.js +22 -14
- package/cjs/combobox/parts/controls/styled.js +22 -13
- package/cjs/combobox/parts/controls/useOnPillsNavigation.js +3 -3
- package/cjs/combobox/parts/controls-input/ControlsInput.js +3 -3
- package/cjs/combobox/parts/controls-input/styled.js +7 -3
- package/cjs/combobox/parts/controls-input/useControlsInput.js +5 -5
- package/cjs/combobox/parts/controls-input/useKeyboardNavigation.js +37 -29
- package/cjs/combobox/parts/controls-input/useMaskedOnChange.js +6 -6
- package/cjs/combobox/parts/dropdown-indicator/DropdownIndicator.js +2 -2
- package/cjs/combobox/parts/header-list/HeaderList.js +4 -3
- package/cjs/combobox/parts/header-list/useHeaderListHandlers.js +11 -7
- package/cjs/combobox/parts/menu-list/MenuList.js +10 -5
- package/cjs/combobox/parts/menu-list/styled.js +16 -9
- package/cjs/combobox/parts/menu-list/useItemRenderer.js +17 -15
- package/cjs/combobox/parts/multi-selected-values-container/MultiSelectedValuesContainer.js +1 -1
- package/cjs/combobox/parts/multi-selected-values-container/RemovableSelectedValuePill.js +2 -0
- package/cjs/combobox/parts/multi-selected-values-container/useGroupPills.js +13 -10
- package/cjs/combobox/react-desc-prop-types.js +3 -2
- package/cjs/combobox/theming.js +13 -0
- package/cjs/combobox/utils/listHelper.js +12 -1
- 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/cjs/index.js +16 -7
- package/cjs/input-group/InputGroup.js +70 -0
- package/cjs/input-group/InputGroupDataTestIds.js +12 -0
- package/cjs/input-group/exported-related/data-test-ids.js +12 -0
- package/cjs/input-group/exported-related/index.js +12 -0
- package/cjs/input-group/exported-related/theming.js +13 -0
- package/cjs/input-group/index.js +12 -0
- package/cjs/input-group/react-desc-prop-types.js +14 -0
- package/cjs/input-group/styled.js +47 -0
- package/cjs/mask-hook/hooks/index.js +0 -1
- package/cjs/mask-hook/hooks/usePhoneMask.js +2 -2
- package/cjs/mask-hook/hooks/useRegExpMask.js +0 -1
- package/cjs/mask-hook/index.js +0 -1
- package/cjs/text-input/styled/borders.js +1 -1
- package/esm/autocomplete/config/useAutocomplete.js +1 -3
- package/esm/autocomplete/parts/A11yFocusedOption.js +32 -0
- package/esm/autocomplete/parts/container/Container.js +39 -27
- package/esm/autocomplete/parts/container/styled.js +2 -2
- package/esm/autocomplete/parts/menu-list/MenuList.js +5 -3
- package/esm/autocomplete/parts/styled.js +1 -0
- package/esm/autocomplete/utils/listHelper.js +1 -1
- package/esm/checkbox/ControlledCheckbox.js +52 -36
- package/esm/checkbox/exported-related/data-test-ids.js +6 -0
- package/esm/checkbox/exported-related/index.js +2 -0
- package/esm/checkbox/exported-related/theming.js +8 -0
- package/esm/checkbox/react-desc-prop-types.js +2 -2
- package/esm/checkbox/styles.js +26 -15
- package/esm/combobox/ComboBoxCTX.js +7 -4
- package/esm/combobox/ComboboxDataTestids.js +1 -1
- package/esm/combobox/config/useComboBox.js +22 -9
- package/esm/combobox/index.js +2 -0
- package/esm/combobox/parts/A11yFocusedOption.js +15 -7
- package/esm/combobox/parts/A11ySelectedValues.js +0 -2
- package/esm/combobox/parts/DropdownIndicator.js +4 -4
- package/esm/combobox/parts/container/Container.js +16 -19
- package/esm/combobox/parts/container/styled.js +13 -6
- package/esm/combobox/parts/controls/Controls.js +22 -14
- package/esm/combobox/parts/controls/styled.js +22 -13
- package/esm/combobox/parts/controls/useOnPillsNavigation.js +3 -3
- package/esm/combobox/parts/controls-input/ControlsInput.js +3 -3
- package/esm/combobox/parts/controls-input/styled.js +7 -3
- package/esm/combobox/parts/controls-input/useControlsInput.js +5 -5
- package/esm/combobox/parts/controls-input/useKeyboardNavigation.js +38 -30
- package/esm/combobox/parts/controls-input/useMaskedOnChange.js +6 -6
- package/esm/combobox/parts/dropdown-indicator/DropdownIndicator.js +2 -2
- package/esm/combobox/parts/header-list/HeaderList.js +4 -3
- package/esm/combobox/parts/header-list/useHeaderListHandlers.js +11 -7
- package/esm/combobox/parts/menu-list/MenuList.js +10 -5
- package/esm/combobox/parts/menu-list/styled.js +16 -10
- package/esm/combobox/parts/menu-list/useItemRenderer.js +19 -17
- package/esm/combobox/parts/multi-selected-values-container/MultiSelectedValuesContainer.js +1 -1
- package/esm/combobox/parts/multi-selected-values-container/RemovableSelectedValuePill.js +2 -0
- package/esm/combobox/parts/multi-selected-values-container/useGroupPills.js +13 -10
- package/esm/combobox/react-desc-prop-types.js +3 -2
- package/esm/combobox/theming.js +8 -0
- package/esm/combobox/utils/listHelper.js +12 -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 +12 -12
- 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/index.js +5 -1
- package/esm/input-group/InputGroup.js +60 -0
- package/esm/input-group/InputGroupDataTestIds.js +8 -0
- package/esm/input-group/exported-related/data-test-ids.js +8 -0
- package/esm/input-group/exported-related/index.js +2 -0
- package/esm/input-group/exported-related/theming.js +8 -0
- package/esm/input-group/index.js +2 -0
- package/esm/input-group/react-desc-prop-types.js +10 -0
- package/esm/input-group/styled.js +36 -0
- package/esm/mask-hook/hooks/index.js +1 -1
- package/esm/mask-hook/hooks/usePhoneMask.js +2 -2
- package/esm/mask-hook/hooks/useRegExpMask.js +1 -1
- package/esm/mask-hook/index.js +1 -1
- package/esm/text-input/styled/borders.js +1 -1
- package/package.json +75 -19
- package/types/autocomplete/parts/A11yFocusedOption.d.ts +5 -0
- package/types/autocomplete/parts/container/styled.d.ts +1 -1
- package/types/autocomplete/parts/styled.d.ts +0 -0
- package/types/autocomplete/utils/listHelper.d.ts +5 -5
- package/types/checkbox/exported-related/data-test-ids.d.ts +4 -0
- package/types/checkbox/exported-related/index.d.ts +2 -0
- package/types/checkbox/exported-related/theming.d.ts +6 -0
- package/types/checkbox/react-desc-prop-types.d.ts +4 -4
- package/types/checkbox/styles.d.ts +6 -5
- package/types/combobox/ComboboxDataTestids.d.ts +1 -1
- package/types/combobox/index.d.ts +2 -0
- package/types/combobox/parts/container/styled.d.ts +1 -2
- package/types/combobox/parts/menu-list/styled.d.ts +1 -0
- package/types/combobox/react-desc-prop-types.d.ts +8 -6
- package/types/combobox/sharedTypes.d.ts +3 -2
- package/types/combobox/theming.d.ts +6 -0
- package/types/combobox/utils/listHelper.d.ts +1 -0
- 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
- package/types/index.d.ts +1 -0
- package/types/input-group/InputGroup.d.ts +5 -0
- package/types/input-group/InputGroupDataTestIds.d.ts +6 -0
- package/types/input-group/exported-related/data-test-ids.d.ts +6 -0
- package/types/input-group/exported-related/index.d.ts +2 -0
- package/types/input-group/exported-related/theming.d.ts +6 -0
- package/types/input-group/index.d.ts +2 -0
- package/types/input-group/react-desc-prop-types.d.ts +19 -0
- package/types/input-group/styled.d.ts +4 -0
- package/types/input-group/tests/DSInputGroup.test.d.ts +1 -0
- package/types/mask-hook/hooks/useRegExpMask.d.ts +0 -1
- package/types/text-input/config/useInputText.d.ts +6 -6
- package/cjs/combobox/parts/menu-list/useMenuListSetFocusOption.js +0 -51
- package/esm/combobox/parts/menu-list/useMenuListSetFocusOption.js +0 -47
- package/types/combobox/parts/menu-list/useMenuListSetFocusOption.d.ts +0 -1
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import 'core-js/modules/web.dom-collections.iterator.js';
|
|
2
|
+
import { useState, useCallback, useMemo } from 'react';
|
|
3
|
+
|
|
4
|
+
const useFocusTracker = _ref => {
|
|
5
|
+
let {
|
|
6
|
+
DOMRefs,
|
|
7
|
+
flags
|
|
8
|
+
} = _ref;
|
|
9
|
+
const [latestInteractionRegion, setLatestInteractionRegion] = useState('');
|
|
10
|
+
const [currFocusDescriber, setCurrFocusDescriber] = useState('');
|
|
11
|
+
const {
|
|
12
|
+
firstSegment,
|
|
13
|
+
lastSegment
|
|
14
|
+
} = DOMRefs;
|
|
15
|
+
const {
|
|
16
|
+
isDateSelector,
|
|
17
|
+
isTimeSelector
|
|
18
|
+
} = flags;
|
|
19
|
+
const trackFocusPicker = useCallback(() => {
|
|
20
|
+
let picker = 'datetime-picker-icon';
|
|
21
|
+
if (isDateSelector) picker = 'date-picker-icon';
|
|
22
|
+
if (isTimeSelector) picker = 'time-picker-icon';
|
|
23
|
+
if (latestInteractionRegion !== 'picker-icon') setLatestInteractionRegion('picker-icon');
|
|
24
|
+
if (picker !== currFocusDescriber) setCurrFocusDescriber(picker);
|
|
25
|
+
}, [currFocusDescriber, isDateSelector, isTimeSelector, latestInteractionRegion]);
|
|
26
|
+
const trackFocusFirstSegment = useCallback(() => {
|
|
27
|
+
let region = 'date-inputs';
|
|
28
|
+
if (firstSegment === 'hour-input') region = 'time-inputs';
|
|
29
|
+
if (firstSegment === 'date-picker-icon') region = 'picker-icon';
|
|
30
|
+
if (firstSegment === 'time-picker-icon') region = 'picker-icon';
|
|
31
|
+
if (firstSegment === 'datetime-picker-icon') region = 'picker-icon';
|
|
32
|
+
if (region !== latestInteractionRegion) setLatestInteractionRegion(region);
|
|
33
|
+
if (firstSegment !== currFocusDescriber) setCurrFocusDescriber(firstSegment);
|
|
34
|
+
}, [currFocusDescriber, firstSegment, latestInteractionRegion]);
|
|
35
|
+
const trackFocusLastSegment = useCallback(() => {
|
|
36
|
+
let region = 'date-inputs';
|
|
37
|
+
if (lastSegment === 'meridiem-input') region = 'time-inputs';
|
|
38
|
+
if (lastSegment === 'clear-btn') region = 'clear-btn';
|
|
39
|
+
if (lastSegment === 'date-picker-icon') region = 'picker-icon';
|
|
40
|
+
if (lastSegment === 'time-picker-icon') region = 'picker-icon';
|
|
41
|
+
if (lastSegment === 'datetime-picker-icon') region = 'picker-icon';
|
|
42
|
+
if (region !== latestInteractionRegion) setLatestInteractionRegion(region);
|
|
43
|
+
if (lastSegment !== currFocusDescriber) setCurrFocusDescriber(lastSegment);
|
|
44
|
+
}, [currFocusDescriber, lastSegment, latestInteractionRegion]);
|
|
45
|
+
return useMemo(() => ({
|
|
46
|
+
latestInteractionRegion,
|
|
47
|
+
setLatestInteractionRegion,
|
|
48
|
+
currFocusDescriber,
|
|
49
|
+
setCurrFocusDescriber,
|
|
50
|
+
trackFocusResetter: () => {
|
|
51
|
+
if (latestInteractionRegion !== '') setLatestInteractionRegion('');
|
|
52
|
+
if (currFocusDescriber !== '') setCurrFocusDescriber('');
|
|
53
|
+
},
|
|
54
|
+
trackFocusMonthInput: () => {
|
|
55
|
+
if (latestInteractionRegion !== 'date-inputs') setLatestInteractionRegion('date-inputs');
|
|
56
|
+
if (currFocusDescriber !== 'month-input') setCurrFocusDescriber('month-input');
|
|
57
|
+
},
|
|
58
|
+
trackFocusDayInput: () => {
|
|
59
|
+
if (latestInteractionRegion !== 'date-inputs') setLatestInteractionRegion('date-inputs');
|
|
60
|
+
if (currFocusDescriber !== 'day-input') setCurrFocusDescriber('day-input');
|
|
61
|
+
},
|
|
62
|
+
trackFocusYearInput: () => {
|
|
63
|
+
if (latestInteractionRegion !== 'date-inputs') setLatestInteractionRegion('date-inputs');
|
|
64
|
+
if (currFocusDescriber !== 'year-input') setCurrFocusDescriber('year-input');
|
|
65
|
+
},
|
|
66
|
+
trackFocusHourInput: () => {
|
|
67
|
+
if (latestInteractionRegion !== 'time-inputs') setLatestInteractionRegion('time-inputs');
|
|
68
|
+
if (currFocusDescriber !== 'hour-input') setCurrFocusDescriber('hour-input');
|
|
69
|
+
},
|
|
70
|
+
trackFocusMinuteInput: () => {
|
|
71
|
+
if (latestInteractionRegion !== 'time-inputs') setLatestInteractionRegion('time-inputs');
|
|
72
|
+
if (currFocusDescriber !== 'minute-input') setCurrFocusDescriber('minute-input');
|
|
73
|
+
},
|
|
74
|
+
trackFocusMeridiemInput: () => {
|
|
75
|
+
if (latestInteractionRegion !== 'time-inputs') setLatestInteractionRegion('time-inputs');
|
|
76
|
+
if (currFocusDescriber !== 'meridiem-input') setCurrFocusDescriber('meridiem-input');
|
|
77
|
+
},
|
|
78
|
+
trackFocusClearBtn: () => {
|
|
79
|
+
if (latestInteractionRegion !== 'clear-btn') setLatestInteractionRegion('clear-btn');
|
|
80
|
+
if (currFocusDescriber !== 'clear-btn') setCurrFocusDescriber('clear-btn');
|
|
81
|
+
},
|
|
82
|
+
trackFocusDatePickerIcon: () => {
|
|
83
|
+
if (latestInteractionRegion !== 'picker-icon') setLatestInteractionRegion('picker-icon');
|
|
84
|
+
if (currFocusDescriber !== 'date-picker-icon') setCurrFocusDescriber('date-picker-icon');
|
|
85
|
+
},
|
|
86
|
+
trackFocusTimePickerIcon: () => {
|
|
87
|
+
if (latestInteractionRegion !== 'picker-icon') setLatestInteractionRegion('picker-icon');
|
|
88
|
+
if (currFocusDescriber !== 'time-picker-icon') setCurrFocusDescriber('time-picker-icon');
|
|
89
|
+
},
|
|
90
|
+
trackFocusDatetimePickerIcon: () => {
|
|
91
|
+
if (latestInteractionRegion !== 'picker-icon') setLatestInteractionRegion('picker-icon');
|
|
92
|
+
if (currFocusDescriber !== 'datetime-picker-icon') setCurrFocusDescriber('datetime-picker-icon');
|
|
93
|
+
},
|
|
94
|
+
trackFocusCalendarPrevMonth: () => {
|
|
95
|
+
if (latestInteractionRegion !== 'calendar-head') setLatestInteractionRegion('calendar-head');
|
|
96
|
+
if (currFocusDescriber !== 'calendar-prev-month') setCurrFocusDescriber('calendar-prev-month');
|
|
97
|
+
},
|
|
98
|
+
trackFocusCalendarNextMonth: () => {
|
|
99
|
+
if (latestInteractionRegion !== 'calendar-head') setLatestInteractionRegion('calendar-head');
|
|
100
|
+
if (currFocusDescriber !== 'calendar-next-month') setCurrFocusDescriber('calendar-next-month');
|
|
101
|
+
},
|
|
102
|
+
trackFocusCalendarPrevYear: () => {
|
|
103
|
+
if (latestInteractionRegion !== 'calendar-head') setLatestInteractionRegion('calendar-head');
|
|
104
|
+
if (currFocusDescriber !== 'calendar-prev-year') setCurrFocusDescriber('calendar-prev-year');
|
|
105
|
+
},
|
|
106
|
+
trackFocusCalendarNextYear: () => {
|
|
107
|
+
if (latestInteractionRegion !== 'calendar-head') setLatestInteractionRegion('calendar-head');
|
|
108
|
+
if (currFocusDescriber !== 'calendar-next-year') setCurrFocusDescriber('calendar-next-year');
|
|
109
|
+
},
|
|
110
|
+
trackFocusCalendarMetafocusedDay: () => {
|
|
111
|
+
if (latestInteractionRegion !== 'calendar-days') setLatestInteractionRegion('calendar-days');
|
|
112
|
+
if (currFocusDescriber !== 'calendar-metafocused-day') setCurrFocusDescriber('calendar-metafocused-day');
|
|
113
|
+
},
|
|
114
|
+
trackFocusTimewheelCurrHour: () => {
|
|
115
|
+
if (latestInteractionRegion !== 'timewheel') setLatestInteractionRegion('timewheel');
|
|
116
|
+
if (currFocusDescriber !== 'timewheel-curr-hour') setCurrFocusDescriber('timewheel-curr-hour');
|
|
117
|
+
},
|
|
118
|
+
trackFocusTimewheelCurrMinute: () => {
|
|
119
|
+
if (latestInteractionRegion !== 'timewheel') setLatestInteractionRegion('timewheel');
|
|
120
|
+
if (currFocusDescriber !== 'timewheel-curr-minute') setCurrFocusDescriber('timewheel-curr-minute');
|
|
121
|
+
},
|
|
122
|
+
trackFocusTimewheelCurrMeridiem: () => {
|
|
123
|
+
if (latestInteractionRegion !== 'timewheel') setLatestInteractionRegion('timewheel');
|
|
124
|
+
if (currFocusDescriber !== 'timewheel-curr-meridiem') setCurrFocusDescriber('timewheel-curr-meridiem');
|
|
125
|
+
},
|
|
126
|
+
trackFocusPicker,
|
|
127
|
+
trackFocusFirstSegment,
|
|
128
|
+
trackFocusLastSegment
|
|
129
|
+
}), [currFocusDescriber, latestInteractionRegion, trackFocusPicker, trackFocusFirstSegment, trackFocusLastSegment]);
|
|
130
|
+
};
|
|
131
|
+
|
|
132
|
+
export { useFocusTracker };
|
|
@@ -1,14 +1,20 @@
|
|
|
1
|
-
import
|
|
1
|
+
import 'core-js/modules/web.dom-collections.iterator.js';
|
|
2
|
+
import { useState, useRef, useMemo } from 'react';
|
|
2
3
|
|
|
3
|
-
/* eslint-disable complexity */
|
|
4
4
|
const useGetReferences = _ref => {
|
|
5
5
|
let {
|
|
6
6
|
isWithDateInputs,
|
|
7
7
|
isWithTimeInputs,
|
|
8
|
+
isDateSelector,
|
|
9
|
+
isTimeSelector,
|
|
10
|
+
isDateTimeSelector,
|
|
8
11
|
withAnyPicker,
|
|
9
12
|
withClearBtn
|
|
10
13
|
} = _ref;
|
|
11
|
-
//
|
|
14
|
+
// those 2 states are needed for focus tracking
|
|
15
|
+
const [firstSegment, setFirstSegment] = useState('');
|
|
16
|
+
const [lastSegment, setLastSegment] = useState(''); // refs are used for "auto-advance" feature
|
|
17
|
+
|
|
12
18
|
const monthInputRef = useRef(null);
|
|
13
19
|
const dayInputRef = useRef(null);
|
|
14
20
|
const yearInputRef = useRef(null);
|
|
@@ -32,22 +38,38 @@ const useGetReferences = _ref => {
|
|
|
32
38
|
const currMeridiemBtnRef = useRef(null);
|
|
33
39
|
const nextMeridiemBtnRef = useRef(null);
|
|
34
40
|
let firstSegmentRef = useRef(null);
|
|
35
|
-
if (isWithDateInputs) firstSegmentRef = monthInputRef;else if (isWithTimeInputs) firstSegmentRef = hourInputRef;else if (withAnyPicker) firstSegmentRef = pickerButtonRef; // we need some non-ref to force refresh of the hooks dependencies when using firstSegmentRef
|
|
36
41
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
+
if (isWithDateInputs) {
|
|
43
|
+
firstSegmentRef = monthInputRef;
|
|
44
|
+
if (firstSegment !== 'month-input') setFirstSegment('month-input');
|
|
45
|
+
} else if (isWithTimeInputs) {
|
|
46
|
+
firstSegmentRef = hourInputRef;
|
|
47
|
+
if (firstSegment !== 'hour-input') setFirstSegment('hour-input');
|
|
48
|
+
} else if (withAnyPicker) {
|
|
49
|
+
firstSegmentRef = pickerButtonRef;
|
|
50
|
+
if (isDateSelector && firstSegment !== 'date-picker-icon') setFirstSegment('date-picker-icon');
|
|
51
|
+
if (isTimeSelector && firstSegment !== 'time-picker-icon') setFirstSegment('time-picker-icon');
|
|
52
|
+
if (isDateTimeSelector && firstSegment !== 'datetime-picker-icon') setFirstSegment('datetime-picker-icon');
|
|
53
|
+
}
|
|
54
|
+
|
|
42
55
|
let lastSegmentRef = useRef(null);
|
|
43
|
-
if (withAnyPicker) lastSegmentRef = pickerButtonRef;else if (withClearBtn) lastSegmentRef = clearButtonRef;else if (isWithTimeInputs) lastSegmentRef = meridiemInputRef;else if (isWithDateInputs) lastSegmentRef = yearInputRef; // we need some non-ref to force refresh of the hooks dependencies when using lastSegmentRef
|
|
44
56
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
}
|
|
57
|
+
if (withAnyPicker) {
|
|
58
|
+
lastSegmentRef = pickerButtonRef;
|
|
59
|
+
if (isDateSelector && lastSegment !== 'date-picker-icon') setLastSegment('date-picker-icon');
|
|
60
|
+
if (isTimeSelector && lastSegment !== 'time-picker-icon') setLastSegment('time-picker-icon');
|
|
61
|
+
if (isDateTimeSelector && lastSegment !== 'datetime-picker-icon') setLastSegment('datetime-picker-icon');
|
|
62
|
+
} else if (withClearBtn) {
|
|
63
|
+
lastSegmentRef = clearButtonRef;
|
|
64
|
+
if (lastSegment !== 'clear-btn') setLastSegment('clear-btn');
|
|
65
|
+
} else if (isWithTimeInputs) {
|
|
66
|
+
lastSegmentRef = meridiemInputRef;
|
|
67
|
+
if (lastSegment !== 'meridiem-input') setLastSegment('meridiem-input');
|
|
68
|
+
} else if (isWithDateInputs) {
|
|
69
|
+
lastSegmentRef = yearInputRef;
|
|
70
|
+
if (lastSegment !== 'year-input') setLastSegment('year-input');
|
|
71
|
+
}
|
|
72
|
+
|
|
51
73
|
return useMemo(() => ({
|
|
52
74
|
monthInputRef,
|
|
53
75
|
dayInputRef,
|
|
@@ -73,10 +95,9 @@ const useGetReferences = _ref => {
|
|
|
73
95
|
nextMeridiemBtnRef,
|
|
74
96
|
firstSegmentRef,
|
|
75
97
|
lastSegmentRef,
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
}), [
|
|
79
|
-
);
|
|
98
|
+
firstSegment,
|
|
99
|
+
lastSegment
|
|
100
|
+
}), [firstSegment, lastSegment]);
|
|
80
101
|
};
|
|
81
102
|
|
|
82
103
|
export { useGetReferences };
|
|
@@ -16,8 +16,8 @@ const useGlobalKeyHandlers = _ref => {
|
|
|
16
16
|
let {
|
|
17
17
|
propsBasedOnType,
|
|
18
18
|
changeHandlers,
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
flags,
|
|
20
|
+
focusTrackers
|
|
21
21
|
} = _ref;
|
|
22
22
|
const {
|
|
23
23
|
getIsOutOfRangeDay,
|
|
@@ -34,13 +34,13 @@ const useGlobalKeyHandlers = _ref => {
|
|
|
34
34
|
handleChangeComposedDateTimeString,
|
|
35
35
|
handleClearAll
|
|
36
36
|
} = changeHandlers;
|
|
37
|
-
const {
|
|
38
|
-
lastSegmentRef,
|
|
39
|
-
clearButtonRef
|
|
40
|
-
} = DOMRefs;
|
|
41
37
|
const {
|
|
42
38
|
shouldPreserveClearableSpace
|
|
43
39
|
} = flags;
|
|
40
|
+
const {
|
|
41
|
+
trackFocusClearBtn,
|
|
42
|
+
trackFocusLastSegment
|
|
43
|
+
} = focusTrackers;
|
|
44
44
|
const onFillWithCurrentDateKeys = useCallback(function (e) {
|
|
45
45
|
let metaInfo = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {
|
|
46
46
|
isAutomaticFillTrigger: true
|
|
@@ -70,12 +70,8 @@ const useGlobalKeyHandlers = _ref => {
|
|
|
70
70
|
appOnMinuteChange(minutes, e, metaInfo);
|
|
71
71
|
appOnMeridiemChange(meridiem, e, metaInfo);
|
|
72
72
|
handleChangeComposedDateTimeString(nowDateString, nowTimeString, finalMetaInfo);
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
if (shouldPreserveClearableSpace) (_clearButtonRef$curre = clearButtonRef.current) === null || _clearButtonRef$curre === void 0 ? void 0 : _clearButtonRef$curre.focus();else (_lastSegmentRef$curre = lastSegmentRef.current) === null || _lastSegmentRef$curre === void 0 ? void 0 : _lastSegmentRef$curre.focus();
|
|
77
|
-
});
|
|
78
|
-
}, [appOnDayChange, appOnHourChange, appOnMeridiemChange, appOnMinuteChange, appOnMonthChange, appOnYearChange, clearButtonRef, getIsDisabledDay, getIsDisabledTime, getIsOutOfRangeDay, handleChangeComposedDateTimeString, lastSegmentRef, shouldPreserveClearableSpace]);
|
|
73
|
+
if (shouldPreserveClearableSpace) trackFocusClearBtn();else trackFocusLastSegment();
|
|
74
|
+
}, [appOnDayChange, appOnHourChange, appOnMeridiemChange, appOnMinuteChange, appOnMonthChange, appOnYearChange, getIsDisabledDay, getIsDisabledTime, getIsOutOfRangeDay, handleChangeComposedDateTimeString, shouldPreserveClearableSpace, trackFocusClearBtn, trackFocusLastSegment]);
|
|
79
75
|
const onGlobalKeyDown = useCallback(e => {
|
|
80
76
|
const {
|
|
81
77
|
key,
|
|
@@ -5,12 +5,13 @@ import 'core-js/modules/esnext.async-iterator.for-each.js';
|
|
|
5
5
|
import 'core-js/modules/esnext.iterator.for-each.js';
|
|
6
6
|
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
|
|
7
7
|
import _jsx from '@babel/runtime/helpers/esm/jsx';
|
|
8
|
-
import 'react';
|
|
8
|
+
import { useContext } from 'react';
|
|
9
9
|
import { CloseMedium } from '@elliemae/ds-icons';
|
|
10
10
|
import { DSIconColors } from '@elliemae/ds-icon';
|
|
11
11
|
import { BUTTON_SIZES } from '@elliemae/ds-button';
|
|
12
12
|
import { StyledClearButton } from '../Styleds.js';
|
|
13
13
|
import { ControlledDateTimePickerDatatestid } from '../../ControlledDateTimePickerDatatestid.js';
|
|
14
|
+
import { ControlledDateTimePickerContext } from '../../ControlledDateTimePickerCTX.js';
|
|
14
15
|
import { useClearButton } from './useClearButton.js';
|
|
15
16
|
import { jsx } from 'react/jsx-runtime';
|
|
16
17
|
|
|
@@ -27,12 +28,21 @@ const ClearButton = () => {
|
|
|
27
28
|
const styledsAttrs = {
|
|
28
29
|
shouldDisplay: withClearBtn
|
|
29
30
|
};
|
|
31
|
+
const {
|
|
32
|
+
latestInteractionRegion,
|
|
33
|
+
currFocusDescriber
|
|
34
|
+
} = useContext(ControlledDateTimePickerContext);
|
|
30
35
|
return /*#__PURE__*/jsx(StyledClearButton, _objectSpread(_objectSpread({
|
|
31
36
|
"aria-label": "clear selected date",
|
|
32
37
|
buttonType: "icon",
|
|
33
38
|
size: BUTTON_SIZES.M,
|
|
34
39
|
"data-testid": ControlledDateTimePickerDatatestid.CLEAR_BUTTON,
|
|
35
|
-
innerRef:
|
|
40
|
+
innerRef: DomElem => {
|
|
41
|
+
var _DomElem$focus;
|
|
42
|
+
|
|
43
|
+
clearButtonRef.current = DomElem;
|
|
44
|
+
if (latestInteractionRegion === 'clear-btn' && currFocusDescriber === 'clear-btn') DomElem === null || DomElem === void 0 ? void 0 : (_DomElem$focus = DomElem.focus) === null || _DomElem$focus === void 0 ? void 0 : _DomElem$focus.call(DomElem);
|
|
45
|
+
},
|
|
36
46
|
onClick: onClearClick,
|
|
37
47
|
onKeyDown: onClearButtonKeyDown
|
|
38
48
|
}, styledsAttrs), {}, {
|
|
@@ -11,32 +11,21 @@ const useClearButton = () => {
|
|
|
11
11
|
withAnyInputs,
|
|
12
12
|
isWithTimeInputs,
|
|
13
13
|
isWithDateInputs,
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
meridiemInputRef,
|
|
19
|
-
yearInputRef,
|
|
20
|
-
setLatestInteractionRegion
|
|
14
|
+
trackFocusFirstSegment,
|
|
15
|
+
trackFocusMeridiemInput,
|
|
16
|
+
trackFocusYearInput,
|
|
17
|
+
trackFocusPicker
|
|
21
18
|
} = useContext(ControlledDateTimePickerContext);
|
|
22
|
-
const focusFirstRegion = useCallback(() => {
|
|
23
|
-
var _hourInputRef$current, _hourInputRef$current2, _monthInputRef$curren, _monthInputRef$curren2;
|
|
24
|
-
|
|
25
|
-
if (withAnyInputs) if (isTimeSelector) 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);else 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);
|
|
26
|
-
}, [withAnyInputs, isTimeSelector, hourInputRef, monthInputRef]);
|
|
27
19
|
const onClearClick = useCallback(e => {
|
|
28
20
|
handleClearAll(e);
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
}, [focusFirstRegion, handleClearAll, setLatestInteractionRegion]);
|
|
21
|
+
trackFocusFirstSegment();
|
|
22
|
+
}, [handleClearAll, trackFocusFirstSegment]);
|
|
32
23
|
const onHomeKeyDown = useCallback(() => {
|
|
33
|
-
|
|
34
|
-
}, [
|
|
24
|
+
trackFocusFirstSegment();
|
|
25
|
+
}, [trackFocusFirstSegment]);
|
|
35
26
|
const onEndKeyDown = useCallback(() => {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
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);
|
|
39
|
-
}, [withAnyPicker, pickerButtonRef]);
|
|
27
|
+
if (withAnyPicker) trackFocusPicker();
|
|
28
|
+
}, [withAnyPicker, trackFocusPicker]);
|
|
40
29
|
const onClearButtonKeyDown = useCallback(e => {
|
|
41
30
|
const {
|
|
42
31
|
key
|
|
@@ -49,11 +38,9 @@ const useClearButton = () => {
|
|
|
49
38
|
if (key === 'End') onEndKeyDown();
|
|
50
39
|
|
|
51
40
|
if (key === 'Backspace' && withAnyInputs) {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
if (isWithTimeInputs) 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);else if (isWithDateInputs) 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);
|
|
41
|
+
if (isWithTimeInputs) trackFocusMeridiemInput();else if (isWithDateInputs) trackFocusYearInput();
|
|
55
42
|
}
|
|
56
|
-
}, [isWithDateInputs, isWithTimeInputs,
|
|
43
|
+
}, [isWithDateInputs, isWithTimeInputs, onEndKeyDown, onHomeKeyDown, trackFocusMeridiemInput, trackFocusYearInput, withAnyInputs]);
|
|
57
44
|
return useMemo(() => ({
|
|
58
45
|
onClearClick,
|
|
59
46
|
onClearButtonKeyDown,
|
|
@@ -31,13 +31,13 @@ const ControlledDateTimePickerContent = () => {
|
|
|
31
31
|
hideTime,
|
|
32
32
|
hideTimePicker,
|
|
33
33
|
hideDateTimePicker,
|
|
34
|
-
setLatestInteractionRegion,
|
|
35
34
|
withAnyPicker,
|
|
36
35
|
withAnyRightController,
|
|
37
36
|
shouldPreserveClearableSpace,
|
|
38
37
|
isControllerOnly,
|
|
39
38
|
dataAttrs,
|
|
40
|
-
onGlobalKeyDown
|
|
39
|
+
onGlobalKeyDown,
|
|
40
|
+
trackFocusResetter
|
|
41
41
|
} = React.useContext(ControlledDateTimePickerContext);
|
|
42
42
|
const styledsAttrs = {
|
|
43
43
|
justPicker: hideDate && hideTime,
|
|
@@ -45,9 +45,6 @@ const ControlledDateTimePickerContent = () => {
|
|
|
45
45
|
hasError,
|
|
46
46
|
isControllerOnly
|
|
47
47
|
};
|
|
48
|
-
const resetLatestInteraction = React.useCallback(() => {
|
|
49
|
-
setLatestInteractionRegion('');
|
|
50
|
-
}, [setLatestInteractionRegion]);
|
|
51
48
|
const mainCols = [];
|
|
52
49
|
if (!hideDate) mainCols.push('auto');
|
|
53
50
|
if (!hideTime) mainCols.push('auto');
|
|
@@ -60,9 +57,9 @@ const ControlledDateTimePickerContent = () => {
|
|
|
60
57
|
cols: mainCols,
|
|
61
58
|
gutter: "xxs",
|
|
62
59
|
pr: hideDatePicker && hideTimePicker && hideDateTimePicker ? '2px' : undefined,
|
|
63
|
-
onBlur: resetLatestInteraction,
|
|
64
60
|
onKeyDown: onGlobalKeyDown,
|
|
65
|
-
disabled: disabled
|
|
61
|
+
disabled: disabled,
|
|
62
|
+
onBlur: trackFocusResetter
|
|
66
63
|
}, styledsAttrs), dataAttrs), {}, {
|
|
67
64
|
children: [hideDate ? null : _DateInputs || (_DateInputs = /*#__PURE__*/_jsx(DateInputs, {})), hideTime ? null : _TimeInputs || (_TimeInputs = /*#__PURE__*/_jsx(TimeInputs, {})), withAnyRightController ? /*#__PURE__*/_jsx(Grid, {
|
|
68
65
|
cols: rightControlCols
|
|
@@ -21,7 +21,8 @@ const DDInput = /*#__PURE__*/React.memo(_ref => {
|
|
|
21
21
|
disabled,
|
|
22
22
|
contextRef,
|
|
23
23
|
placeholder,
|
|
24
|
-
ariaCurrentValueForInputs
|
|
24
|
+
ariaCurrentValueForInputs,
|
|
25
|
+
isFocused
|
|
25
26
|
} = _ref;
|
|
26
27
|
const validateOnChange = useCallback(e => {
|
|
27
28
|
var _e$target;
|
|
@@ -39,7 +40,12 @@ const DDInput = /*#__PURE__*/React.memo(_ref => {
|
|
|
39
40
|
onFocus: onFocus,
|
|
40
41
|
onKeyDown: onKeyDown,
|
|
41
42
|
value: value,
|
|
42
|
-
ref:
|
|
43
|
+
ref: DomElem => {
|
|
44
|
+
var _DomElem$focus;
|
|
45
|
+
|
|
46
|
+
contextRef.current = DomElem;
|
|
47
|
+
if (isFocused) DomElem === null || DomElem === void 0 ? void 0 : (_DomElem$focus = DomElem.focus) === null || _DomElem$focus === void 0 ? void 0 : _DomElem$focus.call(DomElem);
|
|
48
|
+
},
|
|
43
49
|
placeholder: placeholder,
|
|
44
50
|
"aria-label": "day input field, ".concat(ariaCurrentValueForInputs),
|
|
45
51
|
"data-testid": ControlledDateTimePickerDatatestid.DATE_INPUTS.DAY,
|
|
@@ -35,7 +35,9 @@ const DateInputs = () => {
|
|
|
35
35
|
monthInputRef,
|
|
36
36
|
dayInputRef,
|
|
37
37
|
yearInputRef,
|
|
38
|
-
ariaCurrentValueForInputs
|
|
38
|
+
ariaCurrentValueForInputs,
|
|
39
|
+
latestInteractionRegion,
|
|
40
|
+
currFocusDescriber
|
|
39
41
|
} = useContext(ControlledDateTimePickerContext);
|
|
40
42
|
return /*#__PURE__*/_jsx(Grid, {
|
|
41
43
|
cols: [fixedValues.smallInputWidth, fixedValues.separatorWidth, fixedValues.smallInputWidth, fixedValues.separatorWidth, fixedValues.largeInputWidth]
|
|
@@ -49,7 +51,8 @@ const DateInputs = () => {
|
|
|
49
51
|
autoFocusMonthInput: autoFocusMonthInput,
|
|
50
52
|
placeholder: "MM",
|
|
51
53
|
ariaCurrentValueForInputs: ariaCurrentValueForInputs,
|
|
52
|
-
disabled: disabled
|
|
54
|
+
disabled: disabled,
|
|
55
|
+
isFocused: latestInteractionRegion === 'date-inputs' && currFocusDescriber === 'month-input'
|
|
53
56
|
})), _StyledSeparator || (_StyledSeparator = /*#__PURE__*/_jsx(StyledSeparator, {
|
|
54
57
|
alignItems: "center"
|
|
55
58
|
}, void 0, "/")), /*#__PURE__*/_jsx(StyledFocusWithIn, {}, void 0, /*#__PURE__*/_jsx(DDInput, {
|
|
@@ -61,7 +64,8 @@ const DateInputs = () => {
|
|
|
61
64
|
contextRef: dayInputRef,
|
|
62
65
|
placeholder: "DD",
|
|
63
66
|
ariaCurrentValueForInputs: ariaCurrentValueForInputs,
|
|
64
|
-
disabled: disabled
|
|
67
|
+
disabled: disabled,
|
|
68
|
+
isFocused: latestInteractionRegion === 'date-inputs' && currFocusDescriber === 'day-input'
|
|
65
69
|
})), _StyledSeparator2 || (_StyledSeparator2 = /*#__PURE__*/_jsx(StyledSeparator, {
|
|
66
70
|
alignItems: "center"
|
|
67
71
|
}, void 0, "/")), /*#__PURE__*/_jsx(StyledFocusWithIn, {}, void 0, /*#__PURE__*/_jsx(YYYYInput, {
|
|
@@ -73,7 +77,8 @@ const DateInputs = () => {
|
|
|
73
77
|
contextRef: yearInputRef,
|
|
74
78
|
placeholder: "YYYY",
|
|
75
79
|
ariaCurrentValueForInputs: ariaCurrentValueForInputs,
|
|
76
|
-
disabled: disabled
|
|
80
|
+
disabled: disabled,
|
|
81
|
+
isFocused: latestInteractionRegion === 'date-inputs' && currFocusDescriber === 'year-input'
|
|
77
82
|
})));
|
|
78
83
|
};
|
|
79
84
|
|
|
@@ -22,7 +22,8 @@ const MMInput = /*#__PURE__*/React.memo(_ref => {
|
|
|
22
22
|
placeholder,
|
|
23
23
|
contextRef,
|
|
24
24
|
autoFocusMonthInput,
|
|
25
|
-
ariaCurrentValueForInputs
|
|
25
|
+
ariaCurrentValueForInputs,
|
|
26
|
+
isFocused
|
|
26
27
|
} = _ref;
|
|
27
28
|
const validateOnChange = useCallback(e => {
|
|
28
29
|
var _e$target;
|
|
@@ -41,7 +42,12 @@ const MMInput = /*#__PURE__*/React.memo(_ref => {
|
|
|
41
42
|
onFocus: onFocus,
|
|
42
43
|
onKeyDown: onKeyDown,
|
|
43
44
|
value: value,
|
|
44
|
-
ref:
|
|
45
|
+
ref: DomElem => {
|
|
46
|
+
var _DomElem$focus;
|
|
47
|
+
|
|
48
|
+
contextRef.current = DomElem;
|
|
49
|
+
if (isFocused) DomElem === null || DomElem === void 0 ? void 0 : (_DomElem$focus = DomElem.focus) === null || _DomElem$focus === void 0 ? void 0 : _DomElem$focus.call(DomElem);
|
|
50
|
+
},
|
|
45
51
|
placeholder: placeholder,
|
|
46
52
|
"aria-label": "month input field, ".concat(ariaCurrentValueForInputs),
|
|
47
53
|
"data-testid": ControlledDateTimePickerDatatestid.DATE_INPUTS.MONTH,
|
|
@@ -21,7 +21,8 @@ const YYYYInput = /*#__PURE__*/React.memo(_ref => {
|
|
|
21
21
|
disabled,
|
|
22
22
|
placeholder,
|
|
23
23
|
contextRef,
|
|
24
|
-
ariaCurrentValueForInputs
|
|
24
|
+
ariaCurrentValueForInputs,
|
|
25
|
+
isFocused
|
|
25
26
|
} = _ref;
|
|
26
27
|
const validateOnChange = useCallback(e => {
|
|
27
28
|
var _e$target;
|
|
@@ -39,7 +40,12 @@ const YYYYInput = /*#__PURE__*/React.memo(_ref => {
|
|
|
39
40
|
onFocus: onFocus,
|
|
40
41
|
onKeyDown: onKeyDown,
|
|
41
42
|
value: value,
|
|
42
|
-
ref:
|
|
43
|
+
ref: DomElem => {
|
|
44
|
+
var _DomElem$focus;
|
|
45
|
+
|
|
46
|
+
contextRef.current = DomElem;
|
|
47
|
+
if (isFocused) DomElem === null || DomElem === void 0 ? void 0 : (_DomElem$focus = DomElem.focus) === null || _DomElem$focus === void 0 ? void 0 : _DomElem$focus.call(DomElem);
|
|
48
|
+
},
|
|
43
49
|
placeholder: placeholder,
|
|
44
50
|
"aria-label": "year input field, ".concat(ariaCurrentValueForInputs),
|
|
45
51
|
"data-testid": ControlledDateTimePickerDatatestid.DATE_INPUTS.YEAR,
|