@elliemae/ds-controlled-form 2.4.2-rc.0 → 2.4.2-rc.12
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
|
@@ -4,7 +4,6 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var React = require('react');
|
|
6
6
|
var ControlledDateTimePickerCTX = require('../../../ControlledDateTimePickerCTX.js');
|
|
7
|
-
var constants = require('../../../utils/constants.js');
|
|
8
7
|
|
|
9
8
|
/* eslint-disable @typescript-eslint/indent */
|
|
10
9
|
const useKeyboardHandlers = _ref => {
|
|
@@ -24,59 +23,42 @@ const useKeyboardHandlers = _ref => {
|
|
|
24
23
|
isWithDateInputs,
|
|
25
24
|
isWithCalendarToo,
|
|
26
25
|
isControllerOnly,
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
prevHourBtnRef,
|
|
35
|
-
currHourBtnRef,
|
|
36
|
-
nextHourBtnRef,
|
|
37
|
-
prevMinutesBtnRef,
|
|
38
|
-
currMinutesBtnRef,
|
|
39
|
-
nextMinutesBtnRef,
|
|
40
|
-
prevMeridiemBtnRef,
|
|
41
|
-
currMeridiemBtnRef,
|
|
42
|
-
nextMeridiemBtnRef
|
|
26
|
+
trackFocusCalendarPrevMonth,
|
|
27
|
+
trackFocusTimewheelCurrHour,
|
|
28
|
+
trackFocusTimewheelCurrMinute,
|
|
29
|
+
trackFocusTimewheelCurrMeridiem,
|
|
30
|
+
trackFocusFirstSegment,
|
|
31
|
+
trackFocusMeridiemInput,
|
|
32
|
+
trackFocusYearInput
|
|
43
33
|
} = React.useContext(ControlledDateTimePickerCTX.ControlledDateTimePickerContext);
|
|
44
34
|
const onHomeKeyDownInsideTimeWheel = React.useCallback(() => {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
if (isWithCalendarToo) prevMonthBtnRef === null || prevMonthBtnRef === void 0 ? void 0 : (_prevMonthBtnRef$curr = prevMonthBtnRef.current) === null || _prevMonthBtnRef$curr === void 0 ? void 0 : (_prevMonthBtnRef$curr2 = _prevMonthBtnRef$curr.focus) === null || _prevMonthBtnRef$curr2 === void 0 ? void 0 : _prevMonthBtnRef$curr2.call(_prevMonthBtnRef$curr);else currHourBtnRef === null || currHourBtnRef === void 0 ? void 0 : (_currHourBtnRef$curre = currHourBtnRef.current) === null || _currHourBtnRef$curre === void 0 ? void 0 : (_currHourBtnRef$curre2 = _currHourBtnRef$curre.focus) === null || _currHourBtnRef$curre2 === void 0 ? void 0 : _currHourBtnRef$curre2.call(_currHourBtnRef$curre);
|
|
48
|
-
}, [currHourBtnRef, isWithCalendarToo, prevMonthBtnRef]);
|
|
35
|
+
if (isWithCalendarToo) trackFocusCalendarPrevMonth();else trackFocusTimewheelCurrHour();
|
|
36
|
+
}, [isWithCalendarToo, trackFocusCalendarPrevMonth, trackFocusTimewheelCurrHour]);
|
|
49
37
|
const onEndKeyDownInsideTimeWheel = React.useCallback(() => {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
currMeridiemBtnRef === null || currMeridiemBtnRef === void 0 ? void 0 : (_currMeridiemBtnRef$c = currMeridiemBtnRef.current) === null || _currMeridiemBtnRef$c === void 0 ? void 0 : (_currMeridiemBtnRef$c2 = _currMeridiemBtnRef$c.focus) === null || _currMeridiemBtnRef$c2 === void 0 ? void 0 : _currMeridiemBtnRef$c2.call(_currMeridiemBtnRef$c);
|
|
53
|
-
}, [currMeridiemBtnRef]);
|
|
38
|
+
trackFocusTimewheelCurrMeridiem();
|
|
39
|
+
}, [trackFocusTimewheelCurrMeridiem]);
|
|
54
40
|
const onHomeKeyDownTriggerIcon = React.useCallback(() => {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
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 if (!hideTime) 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);
|
|
58
|
-
}, [hideDate, hideTime, monthInputRef, hourInputRef]);
|
|
41
|
+
trackFocusFirstSegment();
|
|
42
|
+
}, [trackFocusFirstSegment]);
|
|
59
43
|
const handlePickerIconKeyDown = React.useCallback(e => {
|
|
60
44
|
const {
|
|
61
45
|
key
|
|
62
46
|
} = e;
|
|
63
|
-
if (
|
|
64
|
-
if (
|
|
47
|
+
if (['Home', 'End'].includes(key)) e.preventDefault();
|
|
48
|
+
if (['Home', 'End'].includes(key)) e.stopPropagation();
|
|
65
49
|
if (key === 'Home') onHomeKeyDownTriggerIcon();
|
|
66
50
|
|
|
67
51
|
if (key === 'Backspace' && withAnyInputs) {
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
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);
|
|
52
|
+
if (isWithTimeInputs) trackFocusMeridiemInput();else if (isWithDateInputs) trackFocusYearInput();
|
|
71
53
|
}
|
|
72
|
-
}, [isWithDateInputs, isWithTimeInputs,
|
|
54
|
+
}, [isWithDateInputs, isWithTimeInputs, onHomeKeyDownTriggerIcon, trackFocusMeridiemInput, trackFocusYearInput, withAnyInputs]);
|
|
73
55
|
const handleCurrHourOnKeyDown = React.useCallback(e => {
|
|
74
56
|
const {
|
|
75
57
|
key,
|
|
76
58
|
shiftKey
|
|
77
59
|
} = e;
|
|
78
|
-
if (
|
|
79
|
-
if (
|
|
60
|
+
if (['Home', 'End', 'ArrowUp', 'ArrowDown', 'ArrowLeft', 'ArrowRight'].includes(key)) e.preventDefault();
|
|
61
|
+
if (['Home', 'End', 'ArrowUp', 'ArrowDown', 'ArrowLeft', 'ArrowRight'].includes(key)) e.stopPropagation();
|
|
80
62
|
let didTriggerHourChange = false;
|
|
81
63
|
|
|
82
64
|
if (key === 'ArrowUp') {
|
|
@@ -90,33 +72,25 @@ const useKeyboardHandlers = _ref => {
|
|
|
90
72
|
}
|
|
91
73
|
|
|
92
74
|
if (key === 'ArrowRight') {
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
currMinutesBtnRef === null || currMinutesBtnRef === void 0 ? void 0 : (_currMinutesBtnRef$cu = currMinutesBtnRef.current) === null || _currMinutesBtnRef$cu === void 0 ? void 0 : (_currMinutesBtnRef$cu2 = _currMinutesBtnRef$cu.focus) === null || _currMinutesBtnRef$cu2 === void 0 ? void 0 : _currMinutesBtnRef$cu2.call(_currMinutesBtnRef$cu);
|
|
75
|
+
trackFocusTimewheelCurrMinute();
|
|
96
76
|
}
|
|
97
77
|
|
|
98
78
|
if (key === 'Home') onHomeKeyDownInsideTimeWheel();
|
|
99
79
|
if (key === 'End') onEndKeyDownInsideTimeWheel(); // ensure the focus is in the correct button after up/down arrow
|
|
100
80
|
|
|
101
|
-
if (didTriggerHourChange)
|
|
102
|
-
var _currHourBtnRef$curre3, _currHourBtnRef$curre4;
|
|
103
|
-
|
|
104
|
-
return currHourBtnRef === null || currHourBtnRef === void 0 ? void 0 : (_currHourBtnRef$curre3 = currHourBtnRef.current) === null || _currHourBtnRef$curre3 === void 0 ? void 0 : (_currHourBtnRef$curre4 = _currHourBtnRef$curre3.focus) === null || _currHourBtnRef$curre4 === void 0 ? void 0 : _currHourBtnRef$curre4.call(_currHourBtnRef$curre3);
|
|
105
|
-
}); // TAB CYCLE IMPLEMENTATION
|
|
81
|
+
if (didTriggerHourChange) trackFocusTimewheelCurrHour(); // TAB CYCLE IMPLEMENTATION
|
|
106
82
|
|
|
107
83
|
if (!isControllerOnly) if (key === 'Tab' && shiftKey && !isWithCalendarToo) {
|
|
108
|
-
var _currMeridiemBtnRef$c3, _currMeridiemBtnRef$c4;
|
|
109
|
-
|
|
110
84
|
e.preventDefault();
|
|
111
|
-
|
|
85
|
+
trackFocusTimewheelCurrMeridiem();
|
|
112
86
|
}
|
|
113
|
-
}, [
|
|
87
|
+
}, [handleNextHour, handlePrevHour, isControllerOnly, isWithCalendarToo, onEndKeyDownInsideTimeWheel, onHomeKeyDownInsideTimeWheel, trackFocusTimewheelCurrHour, trackFocusTimewheelCurrMeridiem, trackFocusTimewheelCurrMinute]);
|
|
114
88
|
const handleCurrMinutesOnKeyDown = React.useCallback(e => {
|
|
115
89
|
const {
|
|
116
90
|
key
|
|
117
91
|
} = e;
|
|
118
|
-
if (
|
|
119
|
-
if (
|
|
92
|
+
if (['Home', 'End', 'ArrowUp', 'ArrowDown', 'ArrowLeft', 'ArrowRight'].includes(key)) e.preventDefault();
|
|
93
|
+
if (['Home', 'End', 'ArrowUp', 'ArrowDown', 'ArrowLeft', 'ArrowRight'].includes(key)) e.stopPropagation();
|
|
120
94
|
let didTriggerMinuteChange = false;
|
|
121
95
|
|
|
122
96
|
if (key === 'ArrowUp') {
|
|
@@ -130,33 +104,25 @@ const useKeyboardHandlers = _ref => {
|
|
|
130
104
|
}
|
|
131
105
|
|
|
132
106
|
if (key === 'ArrowLeft') {
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
currHourBtnRef === null || currHourBtnRef === void 0 ? void 0 : (_currHourBtnRef$curre5 = currHourBtnRef.current) === null || _currHourBtnRef$curre5 === void 0 ? void 0 : (_currHourBtnRef$curre6 = _currHourBtnRef$curre5.focus) === null || _currHourBtnRef$curre6 === void 0 ? void 0 : _currHourBtnRef$curre6.call(_currHourBtnRef$curre5);
|
|
107
|
+
trackFocusTimewheelCurrHour();
|
|
136
108
|
}
|
|
137
109
|
|
|
138
110
|
if (key === 'ArrowRight') {
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
currMeridiemBtnRef === null || currMeridiemBtnRef === void 0 ? void 0 : (_currMeridiemBtnRef$c5 = currMeridiemBtnRef.current) === null || _currMeridiemBtnRef$c5 === void 0 ? void 0 : (_currMeridiemBtnRef$c6 = _currMeridiemBtnRef$c5.focus) === null || _currMeridiemBtnRef$c6 === void 0 ? void 0 : _currMeridiemBtnRef$c6.call(_currMeridiemBtnRef$c5);
|
|
111
|
+
trackFocusTimewheelCurrMeridiem();
|
|
142
112
|
}
|
|
143
113
|
|
|
144
114
|
if (key === 'Home') onHomeKeyDownInsideTimeWheel();
|
|
145
115
|
if (key === 'End') onEndKeyDownInsideTimeWheel(); // ensure the focus is in the correct button after up/down arrow
|
|
146
116
|
|
|
147
|
-
if (didTriggerMinuteChange)
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
return currMinutesBtnRef === null || currMinutesBtnRef === void 0 ? void 0 : (_currMinutesBtnRef$cu3 = currMinutesBtnRef.current) === null || _currMinutesBtnRef$cu3 === void 0 ? void 0 : (_currMinutesBtnRef$cu4 = _currMinutesBtnRef$cu3.focus) === null || _currMinutesBtnRef$cu4 === void 0 ? void 0 : _currMinutesBtnRef$cu4.call(_currMinutesBtnRef$cu3);
|
|
151
|
-
});
|
|
152
|
-
}, [onHomeKeyDownInsideTimeWheel, onEndKeyDownInsideTimeWheel, handlePrevMinute, handleNextMinute, currHourBtnRef, currMeridiemBtnRef, currMinutesBtnRef]);
|
|
117
|
+
if (didTriggerMinuteChange) trackFocusTimewheelCurrMinute();
|
|
118
|
+
}, [onHomeKeyDownInsideTimeWheel, onEndKeyDownInsideTimeWheel, handlePrevMinute, handleNextMinute, trackFocusTimewheelCurrHour, trackFocusTimewheelCurrMeridiem, trackFocusTimewheelCurrMinute]);
|
|
153
119
|
const handleCurrMeridiemOnKeyDown = React.useCallback(e => {
|
|
154
120
|
const {
|
|
155
121
|
key,
|
|
156
122
|
shiftKey
|
|
157
123
|
} = e;
|
|
158
|
-
if (
|
|
159
|
-
if (
|
|
124
|
+
if (['Home', 'End', 'ArrowUp', 'ArrowDown', 'ArrowLeft', 'ArrowRight'].includes(key)) e.preventDefault();
|
|
125
|
+
if (['Home', 'End', 'ArrowUp', 'ArrowDown', 'ArrowLeft', 'ArrowRight'].includes(key)) e.stopPropagation();
|
|
160
126
|
let didTriggerMeridiemChange = false;
|
|
161
127
|
|
|
162
128
|
if (key === 'ArrowUp') {
|
|
@@ -170,185 +136,25 @@ const useKeyboardHandlers = _ref => {
|
|
|
170
136
|
}
|
|
171
137
|
|
|
172
138
|
if (key === 'ArrowLeft') {
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
// currSecondsBtnRef?.current?.focus?.();
|
|
176
|
-
currMinutesBtnRef === null || currMinutesBtnRef === void 0 ? void 0 : (_currMinutesBtnRef$cu5 = currMinutesBtnRef.current) === null || _currMinutesBtnRef$cu5 === void 0 ? void 0 : (_currMinutesBtnRef$cu6 = _currMinutesBtnRef$cu5.focus) === null || _currMinutesBtnRef$cu6 === void 0 ? void 0 : _currMinutesBtnRef$cu6.call(_currMinutesBtnRef$cu5);
|
|
139
|
+
trackFocusTimewheelCurrMinute();
|
|
177
140
|
}
|
|
178
141
|
|
|
179
142
|
if (key === 'Home') onHomeKeyDownInsideTimeWheel();
|
|
180
143
|
if (key === 'End') onEndKeyDownInsideTimeWheel(); // ensure the focus is in the correct button after up/down arrow
|
|
181
144
|
|
|
182
|
-
if (didTriggerMeridiemChange)
|
|
183
|
-
var _currMeridiemBtnRef$c7, _currMeridiemBtnRef$c8;
|
|
184
|
-
|
|
185
|
-
return currMeridiemBtnRef === null || currMeridiemBtnRef === void 0 ? void 0 : (_currMeridiemBtnRef$c7 = currMeridiemBtnRef.current) === null || _currMeridiemBtnRef$c7 === void 0 ? void 0 : (_currMeridiemBtnRef$c8 = _currMeridiemBtnRef$c7.focus) === null || _currMeridiemBtnRef$c8 === void 0 ? void 0 : _currMeridiemBtnRef$c8.call(_currMeridiemBtnRef$c7);
|
|
186
|
-
}); // TAB CYCLE IMPLEMENTATION
|
|
145
|
+
if (didTriggerMeridiemChange) trackFocusTimewheelCurrMeridiem(); // TAB CYCLE IMPLEMENTATION
|
|
187
146
|
|
|
188
147
|
if (!isControllerOnly) if (key === 'Tab' && !shiftKey) {
|
|
189
|
-
var _prevMonthBtnRef$curr3, _prevMonthBtnRef$curr4, _currHourBtnRef$curre7, _currHourBtnRef$curre8;
|
|
190
|
-
|
|
191
148
|
e.preventDefault();
|
|
192
|
-
if (isWithCalendarToo)
|
|
193
|
-
}
|
|
194
|
-
}, [currHourBtnRef, currMeridiemBtnRef, currMinutesBtnRef, handleTimeWheelBtnChangeMeridiem, isControllerOnly, isWithCalendarToo, onEndKeyDownInsideTimeWheel, onHomeKeyDownInsideTimeWheel, prevMonthBtnRef]);
|
|
195
|
-
const handlePrevHourBtnOnKeyDown = React.useCallback(e => {
|
|
196
|
-
const {
|
|
197
|
-
key
|
|
198
|
-
} = e;
|
|
199
|
-
if (constants.homeEndAllArrowKeys.includes(key)) e.preventDefault();
|
|
200
|
-
if (constants.homeEndAllArrowKeys.includes(key)) e.stopPropagation();
|
|
201
|
-
|
|
202
|
-
if (key === 'ArrowRight') {
|
|
203
|
-
var _prevMinutesBtnRef$cu, _prevMinutesBtnRef$cu2;
|
|
204
|
-
|
|
205
|
-
prevMinutesBtnRef === null || prevMinutesBtnRef === void 0 ? void 0 : (_prevMinutesBtnRef$cu = prevMinutesBtnRef.current) === null || _prevMinutesBtnRef$cu === void 0 ? void 0 : (_prevMinutesBtnRef$cu2 = _prevMinutesBtnRef$cu.focus) === null || _prevMinutesBtnRef$cu2 === void 0 ? void 0 : _prevMinutesBtnRef$cu2.call(_prevMinutesBtnRef$cu);
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
if (key === 'ArrowDown') {
|
|
209
|
-
var _currHourBtnRef$curre9, _currHourBtnRef$curre10;
|
|
210
|
-
|
|
211
|
-
currHourBtnRef === null || currHourBtnRef === void 0 ? void 0 : (_currHourBtnRef$curre9 = currHourBtnRef.current) === null || _currHourBtnRef$curre9 === void 0 ? void 0 : (_currHourBtnRef$curre10 = _currHourBtnRef$curre9.focus) === null || _currHourBtnRef$curre10 === void 0 ? void 0 : _currHourBtnRef$curre10.call(_currHourBtnRef$curre9);
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
if (key === 'Home') onHomeKeyDownInsideTimeWheel();
|
|
215
|
-
if (key === 'End') onEndKeyDownInsideTimeWheel();
|
|
216
|
-
}, [currHourBtnRef, onEndKeyDownInsideTimeWheel, onHomeKeyDownInsideTimeWheel, prevMinutesBtnRef]);
|
|
217
|
-
const handlePrevMinuteBtnOnKeyDown = React.useCallback(e => {
|
|
218
|
-
const {
|
|
219
|
-
key
|
|
220
|
-
} = e;
|
|
221
|
-
if (constants.homeEndAllArrowKeys.includes(key)) e.preventDefault();
|
|
222
|
-
if (constants.homeEndAllArrowKeys.includes(key)) e.stopPropagation();
|
|
223
|
-
|
|
224
|
-
if (key === 'ArrowRight') {
|
|
225
|
-
var _prevMeridiemBtnRef$c, _prevMeridiemBtnRef$c2;
|
|
226
|
-
|
|
227
|
-
// prevSecondsBtnRef?.current?.focus?.();
|
|
228
|
-
prevMeridiemBtnRef === null || prevMeridiemBtnRef === void 0 ? void 0 : (_prevMeridiemBtnRef$c = prevMeridiemBtnRef.current) === null || _prevMeridiemBtnRef$c === void 0 ? void 0 : (_prevMeridiemBtnRef$c2 = _prevMeridiemBtnRef$c.focus) === null || _prevMeridiemBtnRef$c2 === void 0 ? void 0 : _prevMeridiemBtnRef$c2.call(_prevMeridiemBtnRef$c);
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
if (key === 'ArrowLeft') {
|
|
232
|
-
var _prevHourBtnRef$curre, _prevHourBtnRef$curre2;
|
|
233
|
-
|
|
234
|
-
prevHourBtnRef === null || prevHourBtnRef === void 0 ? void 0 : (_prevHourBtnRef$curre = prevHourBtnRef.current) === null || _prevHourBtnRef$curre === void 0 ? void 0 : (_prevHourBtnRef$curre2 = _prevHourBtnRef$curre.focus) === null || _prevHourBtnRef$curre2 === void 0 ? void 0 : _prevHourBtnRef$curre2.call(_prevHourBtnRef$curre);
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
if (key === 'ArrowDown') {
|
|
238
|
-
var _currMinutesBtnRef$cu7, _currMinutesBtnRef$cu8;
|
|
239
|
-
|
|
240
|
-
currMinutesBtnRef === null || currMinutesBtnRef === void 0 ? void 0 : (_currMinutesBtnRef$cu7 = currMinutesBtnRef.current) === null || _currMinutesBtnRef$cu7 === void 0 ? void 0 : (_currMinutesBtnRef$cu8 = _currMinutesBtnRef$cu7.focus) === null || _currMinutesBtnRef$cu8 === void 0 ? void 0 : _currMinutesBtnRef$cu8.call(_currMinutesBtnRef$cu7);
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
if (key === 'Home') onHomeKeyDownInsideTimeWheel();
|
|
244
|
-
if (key === 'End') onEndKeyDownInsideTimeWheel();
|
|
245
|
-
}, [currMinutesBtnRef, onEndKeyDownInsideTimeWheel, onHomeKeyDownInsideTimeWheel, prevHourBtnRef, prevMeridiemBtnRef]);
|
|
246
|
-
const handlePrevMeridiemBtnOnKeyDown = React.useCallback(e => {
|
|
247
|
-
const {
|
|
248
|
-
key
|
|
249
|
-
} = e;
|
|
250
|
-
if (constants.homeEndAllArrowKeys.includes(key)) e.preventDefault();
|
|
251
|
-
if (constants.homeEndAllArrowKeys.includes(key)) e.stopPropagation();
|
|
252
|
-
|
|
253
|
-
if (key === 'ArrowLeft') {
|
|
254
|
-
var _prevMinutesBtnRef$cu3, _prevMinutesBtnRef$cu4;
|
|
255
|
-
|
|
256
|
-
prevMinutesBtnRef === null || prevMinutesBtnRef === void 0 ? void 0 : (_prevMinutesBtnRef$cu3 = prevMinutesBtnRef.current) === null || _prevMinutesBtnRef$cu3 === void 0 ? void 0 : (_prevMinutesBtnRef$cu4 = _prevMinutesBtnRef$cu3.focus) === null || _prevMinutesBtnRef$cu4 === void 0 ? void 0 : _prevMinutesBtnRef$cu4.call(_prevMinutesBtnRef$cu3);
|
|
149
|
+
if (isWithCalendarToo) trackFocusCalendarPrevMonth();else trackFocusTimewheelCurrHour();
|
|
257
150
|
}
|
|
258
|
-
|
|
259
|
-
if (key === 'ArrowDown') {
|
|
260
|
-
var _currMeridiemBtnRef$c9, _currMeridiemBtnRef$c10;
|
|
261
|
-
|
|
262
|
-
currMeridiemBtnRef === null || currMeridiemBtnRef === void 0 ? void 0 : (_currMeridiemBtnRef$c9 = currMeridiemBtnRef.current) === null || _currMeridiemBtnRef$c9 === void 0 ? void 0 : (_currMeridiemBtnRef$c10 = _currMeridiemBtnRef$c9.focus) === null || _currMeridiemBtnRef$c10 === void 0 ? void 0 : _currMeridiemBtnRef$c10.call(_currMeridiemBtnRef$c9);
|
|
263
|
-
}
|
|
264
|
-
|
|
265
|
-
if (key === 'Home') onHomeKeyDownInsideTimeWheel();
|
|
266
|
-
if (key === 'End') onEndKeyDownInsideTimeWheel();
|
|
267
|
-
}, [currMeridiemBtnRef, onEndKeyDownInsideTimeWheel, onHomeKeyDownInsideTimeWheel, prevMinutesBtnRef]);
|
|
268
|
-
const handleNextHourBtnOnKeyDown = React.useCallback(e => {
|
|
269
|
-
const {
|
|
270
|
-
key
|
|
271
|
-
} = e;
|
|
272
|
-
if (constants.homeEndAllArrowKeys.includes(key)) e.preventDefault();
|
|
273
|
-
if (constants.homeEndAllArrowKeys.includes(key)) e.stopPropagation();
|
|
274
|
-
|
|
275
|
-
if (key === 'ArrowRight') {
|
|
276
|
-
var _nextMinutesBtnRef$cu, _nextMinutesBtnRef$cu2;
|
|
277
|
-
|
|
278
|
-
nextMinutesBtnRef === null || nextMinutesBtnRef === void 0 ? void 0 : (_nextMinutesBtnRef$cu = nextMinutesBtnRef.current) === null || _nextMinutesBtnRef$cu === void 0 ? void 0 : (_nextMinutesBtnRef$cu2 = _nextMinutesBtnRef$cu.focus) === null || _nextMinutesBtnRef$cu2 === void 0 ? void 0 : _nextMinutesBtnRef$cu2.call(_nextMinutesBtnRef$cu);
|
|
279
|
-
}
|
|
280
|
-
|
|
281
|
-
if (key === 'ArrowUp') {
|
|
282
|
-
var _currHourBtnRef$curre11, _currHourBtnRef$curre12;
|
|
283
|
-
|
|
284
|
-
currHourBtnRef === null || currHourBtnRef === void 0 ? void 0 : (_currHourBtnRef$curre11 = currHourBtnRef.current) === null || _currHourBtnRef$curre11 === void 0 ? void 0 : (_currHourBtnRef$curre12 = _currHourBtnRef$curre11.focus) === null || _currHourBtnRef$curre12 === void 0 ? void 0 : _currHourBtnRef$curre12.call(_currHourBtnRef$curre11);
|
|
285
|
-
}
|
|
286
|
-
|
|
287
|
-
if (key === 'Home') onHomeKeyDownInsideTimeWheel();
|
|
288
|
-
if (key === 'End') onEndKeyDownInsideTimeWheel();
|
|
289
|
-
}, [currHourBtnRef, nextMinutesBtnRef, onEndKeyDownInsideTimeWheel, onHomeKeyDownInsideTimeWheel]);
|
|
290
|
-
const handleNextMinuteBtnOnKeyDown = React.useCallback(e => {
|
|
291
|
-
const {
|
|
292
|
-
key
|
|
293
|
-
} = e;
|
|
294
|
-
if (constants.homeEndAllArrowKeys.includes(key)) e.preventDefault();
|
|
295
|
-
if (constants.homeEndAllArrowKeys.includes(key)) e.stopPropagation();
|
|
296
|
-
|
|
297
|
-
if (key === 'ArrowRight') {
|
|
298
|
-
var _nextMeridiemBtnRef$c, _nextMeridiemBtnRef$c2;
|
|
299
|
-
|
|
300
|
-
nextMeridiemBtnRef === null || nextMeridiemBtnRef === void 0 ? void 0 : (_nextMeridiemBtnRef$c = nextMeridiemBtnRef.current) === null || _nextMeridiemBtnRef$c === void 0 ? void 0 : (_nextMeridiemBtnRef$c2 = _nextMeridiemBtnRef$c.focus) === null || _nextMeridiemBtnRef$c2 === void 0 ? void 0 : _nextMeridiemBtnRef$c2.call(_nextMeridiemBtnRef$c);
|
|
301
|
-
}
|
|
302
|
-
|
|
303
|
-
if (key === 'ArrowLeft') {
|
|
304
|
-
var _nextHourBtnRef$curre, _nextHourBtnRef$curre2;
|
|
305
|
-
|
|
306
|
-
nextHourBtnRef === null || nextHourBtnRef === void 0 ? void 0 : (_nextHourBtnRef$curre = nextHourBtnRef.current) === null || _nextHourBtnRef$curre === void 0 ? void 0 : (_nextHourBtnRef$curre2 = _nextHourBtnRef$curre.focus) === null || _nextHourBtnRef$curre2 === void 0 ? void 0 : _nextHourBtnRef$curre2.call(_nextHourBtnRef$curre);
|
|
307
|
-
}
|
|
308
|
-
|
|
309
|
-
if (key === 'ArrowUp') {
|
|
310
|
-
var _currMinutesBtnRef$cu9, _currMinutesBtnRef$cu10;
|
|
311
|
-
|
|
312
|
-
currMinutesBtnRef === null || currMinutesBtnRef === void 0 ? void 0 : (_currMinutesBtnRef$cu9 = currMinutesBtnRef.current) === null || _currMinutesBtnRef$cu9 === void 0 ? void 0 : (_currMinutesBtnRef$cu10 = _currMinutesBtnRef$cu9.focus) === null || _currMinutesBtnRef$cu10 === void 0 ? void 0 : _currMinutesBtnRef$cu10.call(_currMinutesBtnRef$cu9);
|
|
313
|
-
}
|
|
314
|
-
|
|
315
|
-
if (key === 'Home') onHomeKeyDownInsideTimeWheel();
|
|
316
|
-
if (key === 'End') onEndKeyDownInsideTimeWheel();
|
|
317
|
-
}, [currMinutesBtnRef, nextHourBtnRef, nextMeridiemBtnRef, onEndKeyDownInsideTimeWheel, onHomeKeyDownInsideTimeWheel]);
|
|
318
|
-
const handleNextMeridiemBtnOnKeyDown = React.useCallback(e => {
|
|
319
|
-
const {
|
|
320
|
-
key
|
|
321
|
-
} = e;
|
|
322
|
-
if (constants.homeEndAllArrowKeys.includes(key)) e.preventDefault();
|
|
323
|
-
if (constants.homeEndAllArrowKeys.includes(key)) e.stopPropagation();
|
|
324
|
-
|
|
325
|
-
if (key === 'ArrowLeft') {
|
|
326
|
-
var _nextMinutesBtnRef$cu3, _nextMinutesBtnRef$cu4;
|
|
327
|
-
|
|
328
|
-
nextMinutesBtnRef === null || nextMinutesBtnRef === void 0 ? void 0 : (_nextMinutesBtnRef$cu3 = nextMinutesBtnRef.current) === null || _nextMinutesBtnRef$cu3 === void 0 ? void 0 : (_nextMinutesBtnRef$cu4 = _nextMinutesBtnRef$cu3.focus) === null || _nextMinutesBtnRef$cu4 === void 0 ? void 0 : _nextMinutesBtnRef$cu4.call(_nextMinutesBtnRef$cu3);
|
|
329
|
-
}
|
|
330
|
-
|
|
331
|
-
if (key === 'ArrowUp') {
|
|
332
|
-
var _currMeridiemBtnRef$c11, _currMeridiemBtnRef$c12;
|
|
333
|
-
|
|
334
|
-
currMeridiemBtnRef === null || currMeridiemBtnRef === void 0 ? void 0 : (_currMeridiemBtnRef$c11 = currMeridiemBtnRef.current) === null || _currMeridiemBtnRef$c11 === void 0 ? void 0 : (_currMeridiemBtnRef$c12 = _currMeridiemBtnRef$c11.focus) === null || _currMeridiemBtnRef$c12 === void 0 ? void 0 : _currMeridiemBtnRef$c12.call(_currMeridiemBtnRef$c11);
|
|
335
|
-
}
|
|
336
|
-
|
|
337
|
-
if (key === 'Home') onHomeKeyDownInsideTimeWheel();
|
|
338
|
-
if (key === 'End') onEndKeyDownInsideTimeWheel();
|
|
339
|
-
}, [currMeridiemBtnRef, nextMinutesBtnRef, onEndKeyDownInsideTimeWheel, onHomeKeyDownInsideTimeWheel]);
|
|
151
|
+
}, [handleTimeWheelBtnChangeMeridiem, isControllerOnly, isWithCalendarToo, onEndKeyDownInsideTimeWheel, onHomeKeyDownInsideTimeWheel, trackFocusCalendarPrevMonth, trackFocusTimewheelCurrHour, trackFocusTimewheelCurrMeridiem, trackFocusTimewheelCurrMinute]);
|
|
340
152
|
return React.useMemo(() => ({
|
|
341
|
-
handlePrevHourBtnOnKeyDown,
|
|
342
153
|
handleCurrHourOnKeyDown,
|
|
343
|
-
handleNextHourBtnOnKeyDown,
|
|
344
|
-
handlePrevMinuteBtnOnKeyDown,
|
|
345
154
|
handleCurrMinutesOnKeyDown,
|
|
346
|
-
handleNextMinuteBtnOnKeyDown,
|
|
347
|
-
handlePrevMeridiemBtnOnKeyDown,
|
|
348
155
|
handleCurrMeridiemOnKeyDown,
|
|
349
|
-
handleNextMeridiemBtnOnKeyDown,
|
|
350
156
|
handlePickerIconKeyDown
|
|
351
|
-
}), [handleCurrHourOnKeyDown, handleCurrMeridiemOnKeyDown, handleCurrMinutesOnKeyDown,
|
|
157
|
+
}), [handleCurrHourOnKeyDown, handleCurrMeridiemOnKeyDown, handleCurrMinutesOnKeyDown, handlePickerIconKeyDown]);
|
|
352
158
|
};
|
|
353
159
|
|
|
354
160
|
exports.useKeyboardHandlers = useKeyboardHandlers;
|
|
@@ -15,8 +15,11 @@ const usePopperTriggerLogic = () => {
|
|
|
15
15
|
onPickerClose,
|
|
16
16
|
onPickerOpen
|
|
17
17
|
},
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
isWithCalendarToo,
|
|
19
|
+
trackFocusTimewheelCurrHour,
|
|
20
|
+
trackFocusPicker,
|
|
21
|
+
latestInteractionRegion,
|
|
22
|
+
currFocusDescriber
|
|
20
23
|
} = React.useContext(ControlledDateTimePickerCTX.ControlledDateTimePickerContext);
|
|
21
24
|
const [showTimePicker, setShowTimePicker] = React.useState(false);
|
|
22
25
|
const [referenceElement, setReferenceElement] = React.useState(null);
|
|
@@ -38,16 +41,12 @@ const usePopperTriggerLogic = () => {
|
|
|
38
41
|
setShowTimePicker(oldShowCalendar => {
|
|
39
42
|
if (!oldShowCalendar) {
|
|
40
43
|
onPickerOpen();
|
|
41
|
-
if (!isWithCalendarToo)
|
|
42
|
-
var _currHourBtnRef$curre, _currHourBtnRef$curre2;
|
|
43
|
-
|
|
44
|
-
return currHourBtnRef === null || currHourBtnRef === void 0 ? void 0 : (_currHourBtnRef$curre = currHourBtnRef.current) === null || _currHourBtnRef$curre === void 0 ? void 0 : (_currHourBtnRef$curre2 = _currHourBtnRef$curre.focus) === null || _currHourBtnRef$curre2 === void 0 ? void 0 : _currHourBtnRef$curre2.call(_currHourBtnRef$curre);
|
|
45
|
-
});
|
|
44
|
+
if (!isWithCalendarToo) trackFocusTimewheelCurrHour();
|
|
46
45
|
} else onPickerClose();
|
|
47
46
|
|
|
48
47
|
return !oldShowCalendar;
|
|
49
48
|
});
|
|
50
|
-
}, [
|
|
49
|
+
}, [isWithCalendarToo, onPickerClose, onPickerOpen, trackFocusTimewheelCurrHour]);
|
|
51
50
|
useOnClickOutside.useOnClickOutside(popperElement, e => {
|
|
52
51
|
var _pickerButtonRef$curr, _pickerButtonRef$curr2;
|
|
53
52
|
|
|
@@ -56,19 +55,18 @@ const usePopperTriggerLogic = () => {
|
|
|
56
55
|
const handleSetTriggerRef = React.useCallback(newRef => {
|
|
57
56
|
pickerButtonRef.current = newRef;
|
|
58
57
|
setReferenceElement(newRef);
|
|
59
|
-
|
|
58
|
+
if (latestInteractionRegion === 'picker-icon' && currFocusDescriber === 'time-picker-icon') newRef === null || newRef === void 0 ? void 0 : newRef.focus();
|
|
59
|
+
}, [currFocusDescriber, latestInteractionRegion, pickerButtonRef]);
|
|
60
60
|
const handleMenuWrapperKeyDown = React.useCallback(e => {
|
|
61
61
|
const {
|
|
62
62
|
key
|
|
63
63
|
} = e;
|
|
64
64
|
|
|
65
65
|
if (key === 'Escape') {
|
|
66
|
-
var _pickerButtonRef$curr3, _pickerButtonRef$curr4;
|
|
67
|
-
|
|
68
66
|
closeTimePicker();
|
|
69
|
-
|
|
67
|
+
trackFocusPicker();
|
|
70
68
|
}
|
|
71
|
-
}, [closeTimePicker,
|
|
69
|
+
}, [closeTimePicker, trackFocusPicker]);
|
|
72
70
|
return React.useMemo(() => ({
|
|
73
71
|
showTimePicker,
|
|
74
72
|
setShowTimePicker,
|
|
@@ -30,7 +30,8 @@ const HHInput = /*#__PURE__*/React__default["default"].memo(_ref => {
|
|
|
30
30
|
placeholder,
|
|
31
31
|
ariaCurrentValueForInputs,
|
|
32
32
|
contextRef,
|
|
33
|
-
autoFocusHourInput
|
|
33
|
+
autoFocusHourInput,
|
|
34
|
+
isFocused
|
|
34
35
|
} = _ref;
|
|
35
36
|
const validateOnChange = React.useCallback(e => {
|
|
36
37
|
if (isInvalidHour(e.target.value)) {
|
|
@@ -47,7 +48,12 @@ const HHInput = /*#__PURE__*/React__default["default"].memo(_ref => {
|
|
|
47
48
|
onFocus: onFocus,
|
|
48
49
|
onKeyDown: onKeyDown,
|
|
49
50
|
value: value,
|
|
50
|
-
ref:
|
|
51
|
+
ref: DomElem => {
|
|
52
|
+
var _DomElem$focus;
|
|
53
|
+
|
|
54
|
+
contextRef.current = DomElem;
|
|
55
|
+
if (isFocused) DomElem === null || DomElem === void 0 ? void 0 : (_DomElem$focus = DomElem.focus) === null || _DomElem$focus === void 0 ? void 0 : _DomElem$focus.call(DomElem);
|
|
56
|
+
},
|
|
51
57
|
placeholder: placeholder,
|
|
52
58
|
"aria-label": "hours input field ".concat(ariaCurrentValueForInputs),
|
|
53
59
|
"data-testid": ControlledDateTimePickerDatatestid.ControlledDateTimePickerDatatestid.TIME_INPUTS.HOUR,
|
|
@@ -33,7 +33,8 @@ const MeridiemInput = /*#__PURE__*/React__default["default"].memo(_ref => {
|
|
|
33
33
|
disabled,
|
|
34
34
|
placeholder,
|
|
35
35
|
ariaCurrentValueForInputs,
|
|
36
|
-
contextRef
|
|
36
|
+
contextRef,
|
|
37
|
+
isFocused
|
|
37
38
|
} = _ref;
|
|
38
39
|
const validateOnChange = React.useCallback(e => {
|
|
39
40
|
var _e$target;
|
|
@@ -51,7 +52,12 @@ const MeridiemInput = /*#__PURE__*/React__default["default"].memo(_ref => {
|
|
|
51
52
|
onFocus: onFocus,
|
|
52
53
|
onKeyDown: onKeyDown,
|
|
53
54
|
value: value,
|
|
54
|
-
ref:
|
|
55
|
+
ref: DomElem => {
|
|
56
|
+
var _DomElem$focus;
|
|
57
|
+
|
|
58
|
+
contextRef.current = DomElem;
|
|
59
|
+
if (isFocused) DomElem === null || DomElem === void 0 ? void 0 : (_DomElem$focus = DomElem.focus) === null || _DomElem$focus === void 0 ? void 0 : _DomElem$focus.call(DomElem);
|
|
60
|
+
},
|
|
55
61
|
placeholder: placeholder,
|
|
56
62
|
"aria-label": "meridiem input field ".concat(ariaCurrentValueForInputs),
|
|
57
63
|
"data-testid": ControlledDateTimePickerDatatestid.ControlledDateTimePickerDatatestid.TIME_INPUTS.MERIDIEM,
|
|
@@ -29,7 +29,8 @@ const MinutesInput = /*#__PURE__*/React__default["default"].memo(_ref => {
|
|
|
29
29
|
disabled,
|
|
30
30
|
placeholder,
|
|
31
31
|
ariaCurrentValueForInputs,
|
|
32
|
-
contextRef
|
|
32
|
+
contextRef,
|
|
33
|
+
isFocused
|
|
33
34
|
} = _ref;
|
|
34
35
|
const validateOnChange = React.useCallback(e => {
|
|
35
36
|
var _e$target;
|
|
@@ -47,7 +48,12 @@ const MinutesInput = /*#__PURE__*/React__default["default"].memo(_ref => {
|
|
|
47
48
|
onFocus: onFocus,
|
|
48
49
|
onKeyDown: onKeyDown,
|
|
49
50
|
value: value,
|
|
50
|
-
ref:
|
|
51
|
+
ref: DomElem => {
|
|
52
|
+
var _DomElem$focus;
|
|
53
|
+
|
|
54
|
+
contextRef.current = DomElem;
|
|
55
|
+
if (isFocused) DomElem === null || DomElem === void 0 ? void 0 : (_DomElem$focus = DomElem.focus) === null || _DomElem$focus === void 0 ? void 0 : _DomElem$focus.call(DomElem);
|
|
56
|
+
},
|
|
51
57
|
placeholder: placeholder,
|
|
52
58
|
"aria-label": "minutes input field ".concat(ariaCurrentValueForInputs),
|
|
53
59
|
"data-testid": ControlledDateTimePickerDatatestid.ControlledDateTimePickerDatatestid.TIME_INPUTS.MINUTE,
|
|
@@ -43,7 +43,9 @@ const TimeInputs = () => {
|
|
|
43
43
|
hourInputRef,
|
|
44
44
|
minutesInputRef,
|
|
45
45
|
meridiemInputRef,
|
|
46
|
-
ariaCurrentValueForInputs
|
|
46
|
+
ariaCurrentValueForInputs,
|
|
47
|
+
latestInteractionRegion,
|
|
48
|
+
currFocusDescriber
|
|
47
49
|
} = React.useContext(ControlledDateTimePickerCTX.ControlledDateTimePickerContext);
|
|
48
50
|
return /*#__PURE__*/_jsx__default["default"](dsGrid.Grid, {
|
|
49
51
|
cols: [config.fixedValues.smallInputWidth, config.fixedValues.separatorWidth, config.fixedValues.smallInputWidth, config.fixedValues.separatorWidth, config.fixedValues.smallInputWidth]
|
|
@@ -57,29 +59,32 @@ const TimeInputs = () => {
|
|
|
57
59
|
placeholder: "HH",
|
|
58
60
|
ariaCurrentValueForInputs: ariaCurrentValueForInputs,
|
|
59
61
|
autoFocusHourInput: autoFocusHourInput,
|
|
60
|
-
disabled: disabled
|
|
62
|
+
disabled: disabled,
|
|
63
|
+
isFocused: latestInteractionRegion === 'time-inputs' && currFocusDescriber === 'hour-input'
|
|
61
64
|
})), _StyledColonSeparator || (_StyledColonSeparator = /*#__PURE__*/_jsx__default["default"](Styleds.StyledColonSeparator, {
|
|
62
65
|
alignItems: "center"
|
|
63
66
|
}, void 0, ":")), /*#__PURE__*/_jsx__default["default"](Styleds.StyledFocusWithIn, {}, void 0, /*#__PURE__*/_jsx__default["default"](MinutesInput.MinutesInput, {
|
|
64
67
|
value: minutes,
|
|
65
68
|
onChange: onMinutesChange,
|
|
66
69
|
onBlur: onMinutesBlur,
|
|
67
|
-
onFocus:
|
|
70
|
+
onFocus: onMinutesFocus,
|
|
68
71
|
onKeyDown: onMinutesKeyDown,
|
|
69
72
|
contextRef: minutesInputRef,
|
|
70
73
|
placeholder: "MM",
|
|
71
74
|
ariaCurrentValueForInputs: ariaCurrentValueForInputs,
|
|
72
|
-
disabled: disabled
|
|
75
|
+
disabled: disabled,
|
|
76
|
+
isFocused: latestInteractionRegion === 'time-inputs' && currFocusDescriber === 'minute-input'
|
|
73
77
|
})), _StyledSeparator || (_StyledSeparator = /*#__PURE__*/_jsx__default["default"](Styleds.StyledSeparator, {}, void 0, " ")), /*#__PURE__*/_jsx__default["default"](Styleds.StyledFocusWithIn, {}, void 0, /*#__PURE__*/_jsx__default["default"](MeridiemInput.MeridiemInput, {
|
|
74
78
|
value: meridiem,
|
|
75
79
|
onChange: onMeridiemChange,
|
|
76
80
|
onBlur: onMeridiemBlur,
|
|
77
|
-
onFocus:
|
|
81
|
+
onFocus: onMeridiemFocus,
|
|
78
82
|
onKeyDown: onMeridiemKeyDown,
|
|
79
83
|
contextRef: meridiemInputRef,
|
|
80
84
|
placeholder: "AM",
|
|
81
85
|
ariaCurrentValueForInputs: ariaCurrentValueForInputs,
|
|
82
|
-
disabled: disabled
|
|
86
|
+
disabled: disabled,
|
|
87
|
+
isFocused: latestInteractionRegion === 'time-inputs' && currFocusDescriber === 'meridiem-input'
|
|
83
88
|
})));
|
|
84
89
|
};
|
|
85
90
|
|