@elliemae/ds-controlled-form 2.4.2-rc.0 → 2.4.2-rc.9

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.
Files changed (190) hide show
  1. package/cjs/autocomplete/config/useAutocomplete.js +1 -3
  2. package/cjs/checkbox/ControlledCheckbox.js +49 -33
  3. package/cjs/checkbox/exported-related/data-test-ids.js +10 -0
  4. package/cjs/checkbox/exported-related/index.js +12 -0
  5. package/cjs/checkbox/exported-related/theming.js +13 -0
  6. package/cjs/checkbox/react-desc-prop-types.js +0 -1
  7. package/cjs/checkbox/styles.js +26 -15
  8. package/cjs/combobox/ComboBoxCTX.js +1 -1
  9. package/cjs/combobox/ComboboxDataTestids.js +1 -1
  10. package/cjs/combobox/config/useComboBox.js +6 -4
  11. package/cjs/combobox/index.js +5 -0
  12. package/cjs/combobox/parts/DropdownIndicator.js +2 -2
  13. package/cjs/combobox/parts/container/Container.js +5 -5
  14. package/cjs/combobox/parts/container/styled.js +13 -7
  15. package/cjs/combobox/parts/controls/Controls.js +14 -4
  16. package/cjs/combobox/parts/controls/styled.js +22 -13
  17. package/cjs/combobox/parts/controls-input/ControlsInput.js +1 -1
  18. package/cjs/combobox/parts/controls-input/styled.js +7 -3
  19. package/cjs/combobox/parts/controls-input/useControlsInput.js +3 -4
  20. package/cjs/combobox/parts/controls-input/useKeyboardNavigation.js +30 -15
  21. package/cjs/combobox/parts/header-list/HeaderList.js +4 -3
  22. package/cjs/combobox/parts/header-list/useHeaderListHandlers.js +9 -5
  23. package/cjs/combobox/parts/menu-list/MenuList.js +5 -2
  24. package/cjs/combobox/parts/menu-list/styled.js +12 -7
  25. package/cjs/combobox/parts/menu-list/useItemRenderer.js +5 -4
  26. package/cjs/combobox/parts/multi-selected-values-container/MultiSelectedValuesContainer.js +1 -1
  27. package/cjs/combobox/parts/multi-selected-values-container/RemovableSelectedValuePill.js +2 -0
  28. package/cjs/combobox/parts/multi-selected-values-container/useGroupPills.js +13 -10
  29. package/cjs/combobox/theming.js +13 -0
  30. package/cjs/combobox/utils/listHelper.js +2 -1
  31. package/cjs/date-time-picker/config/useChangeHandlers.js +8 -12
  32. package/cjs/date-time-picker/config/useControlledDateTimePicker.js +13 -9
  33. package/cjs/date-time-picker/config/useFocusTracker.js +136 -0
  34. package/cjs/date-time-picker/config/useGetReferences.js +40 -19
  35. package/cjs/date-time-picker/config/useGlobalKeyHandlers.js +8 -12
  36. package/cjs/date-time-picker/parts/ClearButton/ClearButton.js +12 -2
  37. package/cjs/date-time-picker/parts/ClearButton/useClearButton.js +12 -25
  38. package/cjs/date-time-picker/parts/ControlledDateTimePickerContent.js +4 -7
  39. package/cjs/date-time-picker/parts/DateInputs/DDInput.js +8 -2
  40. package/cjs/date-time-picker/parts/DateInputs/DateInputs.js +9 -4
  41. package/cjs/date-time-picker/parts/DateInputs/MMInput.js +8 -2
  42. package/cjs/date-time-picker/parts/DateInputs/YYYYInput.js +8 -2
  43. package/cjs/date-time-picker/parts/DateInputs/useDateInputs.js +76 -95
  44. package/cjs/date-time-picker/parts/Pickers/Calendar/CalendarHead.js +31 -5
  45. package/cjs/date-time-picker/parts/Pickers/Calendar/Day.js +16 -10
  46. package/cjs/date-time-picker/parts/Pickers/Calendar/useConfigCalendarCTX.js +12 -12
  47. package/cjs/date-time-picker/parts/Pickers/Calendar/useFocusLogic.js +2 -38
  48. package/cjs/date-time-picker/parts/Pickers/Calendar/useKeyboardHandlers.js +40 -73
  49. package/cjs/date-time-picker/parts/Pickers/Calendar/usePopperTriggerLogic.js +18 -27
  50. package/cjs/date-time-picker/parts/Pickers/CalendarWithTimeWheel/CalendarWithTimeWheelIconTrigger.js +1 -0
  51. package/cjs/date-time-picker/parts/Pickers/CalendarWithTimeWheel/useConfigCalendarWithTimeWheelCTX.js +17 -23
  52. package/cjs/date-time-picker/parts/Pickers/TimeWheel/HoursList.js +13 -7
  53. package/cjs/date-time-picker/parts/Pickers/TimeWheel/MeridiemList.js +14 -8
  54. package/cjs/date-time-picker/parts/Pickers/TimeWheel/MinutesList.js +13 -7
  55. package/cjs/date-time-picker/parts/Pickers/TimeWheel/useKeyboardHandlers.js +36 -230
  56. package/cjs/date-time-picker/parts/Pickers/TimeWheel/usePopperTriggerLogic.js +11 -13
  57. package/cjs/date-time-picker/parts/TimeInputs/HHInput.js +8 -2
  58. package/cjs/date-time-picker/parts/TimeInputs/MeridiemInput.js +8 -2
  59. package/cjs/date-time-picker/parts/TimeInputs/MinutesInput.js +8 -2
  60. package/cjs/date-time-picker/parts/TimeInputs/TimeInputs.js +11 -6
  61. package/cjs/date-time-picker/parts/TimeInputs/useTimeInputs.js +44 -74
  62. package/cjs/date-time-picker/utils/constants.js +0 -12
  63. package/cjs/date-time-picker/utils/hooks/useGetStartingFocusedDay.js +38 -36
  64. package/cjs/index.js +16 -7
  65. package/cjs/input-group/InputGroup.js +69 -0
  66. package/cjs/input-group/InputGroupDataTestIds.js +12 -0
  67. package/cjs/input-group/index.js +12 -0
  68. package/cjs/input-group/react-desc-prop-types.js +14 -0
  69. package/cjs/input-group/styled.js +46 -0
  70. package/cjs/mask-hook/hooks/index.js +0 -1
  71. package/cjs/mask-hook/hooks/usePhoneMask.js +2 -2
  72. package/cjs/mask-hook/hooks/useRegExpMask.js +0 -1
  73. package/cjs/mask-hook/index.js +0 -1
  74. package/cjs/text-input/styled/borders.js +1 -1
  75. package/esm/autocomplete/config/useAutocomplete.js +1 -3
  76. package/esm/checkbox/ControlledCheckbox.js +52 -36
  77. package/esm/checkbox/exported-related/data-test-ids.js +6 -0
  78. package/esm/checkbox/exported-related/index.js +2 -0
  79. package/esm/checkbox/exported-related/theming.js +8 -0
  80. package/esm/checkbox/react-desc-prop-types.js +0 -1
  81. package/esm/checkbox/styles.js +25 -15
  82. package/esm/combobox/ComboBoxCTX.js +1 -1
  83. package/esm/combobox/ComboboxDataTestids.js +1 -1
  84. package/esm/combobox/config/useComboBox.js +6 -4
  85. package/esm/combobox/index.js +2 -0
  86. package/esm/combobox/parts/DropdownIndicator.js +2 -2
  87. package/esm/combobox/parts/container/Container.js +7 -7
  88. package/esm/combobox/parts/container/styled.js +13 -6
  89. package/esm/combobox/parts/controls/Controls.js +14 -4
  90. package/esm/combobox/parts/controls/styled.js +22 -13
  91. package/esm/combobox/parts/controls-input/ControlsInput.js +1 -1
  92. package/esm/combobox/parts/controls-input/styled.js +7 -3
  93. package/esm/combobox/parts/controls-input/useControlsInput.js +3 -4
  94. package/esm/combobox/parts/controls-input/useKeyboardNavigation.js +30 -15
  95. package/esm/combobox/parts/header-list/HeaderList.js +4 -3
  96. package/esm/combobox/parts/header-list/useHeaderListHandlers.js +9 -5
  97. package/esm/combobox/parts/menu-list/MenuList.js +5 -2
  98. package/esm/combobox/parts/menu-list/styled.js +12 -7
  99. package/esm/combobox/parts/menu-list/useItemRenderer.js +5 -4
  100. package/esm/combobox/parts/multi-selected-values-container/MultiSelectedValuesContainer.js +1 -1
  101. package/esm/combobox/parts/multi-selected-values-container/RemovableSelectedValuePill.js +2 -0
  102. package/esm/combobox/parts/multi-selected-values-container/useGroupPills.js +13 -10
  103. package/esm/combobox/theming.js +8 -0
  104. package/esm/combobox/utils/listHelper.js +2 -1
  105. package/esm/date-time-picker/config/useChangeHandlers.js +8 -12
  106. package/esm/date-time-picker/config/useControlledDateTimePicker.js +13 -9
  107. package/esm/date-time-picker/config/useFocusTracker.js +132 -0
  108. package/esm/date-time-picker/config/useGetReferences.js +41 -20
  109. package/esm/date-time-picker/config/useGlobalKeyHandlers.js +8 -12
  110. package/esm/date-time-picker/parts/ClearButton/ClearButton.js +12 -2
  111. package/esm/date-time-picker/parts/ClearButton/useClearButton.js +12 -25
  112. package/esm/date-time-picker/parts/ControlledDateTimePickerContent.js +4 -7
  113. package/esm/date-time-picker/parts/DateInputs/DDInput.js +8 -2
  114. package/esm/date-time-picker/parts/DateInputs/DateInputs.js +9 -4
  115. package/esm/date-time-picker/parts/DateInputs/MMInput.js +8 -2
  116. package/esm/date-time-picker/parts/DateInputs/YYYYInput.js +8 -2
  117. package/esm/date-time-picker/parts/DateInputs/useDateInputs.js +77 -96
  118. package/esm/date-time-picker/parts/Pickers/Calendar/CalendarHead.js +32 -6
  119. package/esm/date-time-picker/parts/Pickers/Calendar/Day.js +16 -10
  120. package/esm/date-time-picker/parts/Pickers/Calendar/useConfigCalendarCTX.js +12 -12
  121. package/esm/date-time-picker/parts/Pickers/Calendar/useFocusLogic.js +3 -39
  122. package/esm/date-time-picker/parts/Pickers/Calendar/useKeyboardHandlers.js +40 -73
  123. package/esm/date-time-picker/parts/Pickers/Calendar/usePopperTriggerLogic.js +18 -27
  124. package/esm/date-time-picker/parts/Pickers/CalendarWithTimeWheel/CalendarWithTimeWheelIconTrigger.js +1 -0
  125. package/esm/date-time-picker/parts/Pickers/CalendarWithTimeWheel/useConfigCalendarWithTimeWheelCTX.js +17 -23
  126. package/esm/date-time-picker/parts/Pickers/TimeWheel/HoursList.js +14 -8
  127. package/esm/date-time-picker/parts/Pickers/TimeWheel/MeridiemList.js +15 -9
  128. package/esm/date-time-picker/parts/Pickers/TimeWheel/MinutesList.js +14 -8
  129. package/esm/date-time-picker/parts/Pickers/TimeWheel/useKeyboardHandlers.js +36 -230
  130. package/esm/date-time-picker/parts/Pickers/TimeWheel/usePopperTriggerLogic.js +11 -13
  131. package/esm/date-time-picker/parts/TimeInputs/HHInput.js +8 -2
  132. package/esm/date-time-picker/parts/TimeInputs/MeridiemInput.js +8 -2
  133. package/esm/date-time-picker/parts/TimeInputs/MinutesInput.js +8 -2
  134. package/esm/date-time-picker/parts/TimeInputs/TimeInputs.js +11 -6
  135. package/esm/date-time-picker/parts/TimeInputs/useTimeInputs.js +44 -74
  136. package/esm/date-time-picker/utils/constants.js +1 -7
  137. package/esm/date-time-picker/utils/hooks/useGetStartingFocusedDay.js +38 -36
  138. package/esm/index.js +5 -1
  139. package/esm/input-group/InputGroup.js +59 -0
  140. package/esm/input-group/InputGroupDataTestIds.js +8 -0
  141. package/esm/input-group/index.js +2 -0
  142. package/esm/input-group/react-desc-prop-types.js +10 -0
  143. package/esm/input-group/styled.js +35 -0
  144. package/esm/mask-hook/hooks/index.js +1 -1
  145. package/esm/mask-hook/hooks/usePhoneMask.js +2 -2
  146. package/esm/mask-hook/hooks/useRegExpMask.js +1 -1
  147. package/esm/mask-hook/index.js +1 -1
  148. package/esm/text-input/styled/borders.js +1 -1
  149. package/package.json +55 -19
  150. package/types/checkbox/exported-related/data-test-ids.d.ts +4 -0
  151. package/types/checkbox/exported-related/index.d.ts +2 -0
  152. package/types/checkbox/exported-related/theming.d.ts +6 -0
  153. package/types/checkbox/react-desc-prop-types.d.ts +3 -3
  154. package/types/checkbox/styles.d.ts +5 -5
  155. package/types/combobox/ComboboxDataTestids.d.ts +1 -1
  156. package/types/combobox/index.d.ts +2 -0
  157. package/types/combobox/parts/container/styled.d.ts +1 -2
  158. package/types/combobox/theming.d.ts +6 -0
  159. package/types/date-time-picker/config/useChangeHandlers.d.ts +3 -1
  160. package/types/date-time-picker/config/useControlledDateTimePicker.d.ts +2 -5
  161. package/types/date-time-picker/config/useFocusTracker.d.ts +38 -0
  162. package/types/date-time-picker/config/useGetPropsBasedOnType.d.ts +6 -6
  163. package/types/date-time-picker/config/useGetReferences.d.ts +30 -36
  164. package/types/date-time-picker/config/useGlobalKeyHandlers.d.ts +3 -1
  165. package/types/date-time-picker/parts/DateInputs/DDInput.d.ts +2 -1
  166. package/types/date-time-picker/parts/DateInputs/MMInput.d.ts +2 -1
  167. package/types/date-time-picker/parts/DateInputs/YYYYInput.d.ts +2 -1
  168. package/types/date-time-picker/parts/Pickers/Calendar/useConfigCalendarCTX.d.ts +14 -0
  169. package/types/date-time-picker/parts/Pickers/Calendar/useFocusLogic.d.ts +1 -2
  170. package/types/date-time-picker/parts/Pickers/Calendar/usePopperTriggerLogic.d.ts +19 -0
  171. package/types/date-time-picker/parts/Pickers/TimeWheel/useKeyboardHandlers.d.ts +0 -6
  172. package/types/date-time-picker/parts/Pickers/TimeWheel/usePopperTriggerLogic.d.ts +14 -0
  173. package/types/date-time-picker/parts/TimeInputs/HHInput.d.ts +2 -1
  174. package/types/date-time-picker/parts/TimeInputs/MeridiemInput.d.ts +2 -1
  175. package/types/date-time-picker/parts/TimeInputs/MinutesInput.d.ts +2 -1
  176. package/types/date-time-picker/propTypes.d.ts +117 -0
  177. package/types/date-time-picker/sharedTypes.d.ts +1 -1
  178. package/types/date-time-picker/utils/constants.d.ts +0 -6
  179. package/types/index.d.ts +1 -0
  180. package/types/input-group/InputGroup.d.ts +5 -0
  181. package/types/input-group/InputGroupDataTestIds.d.ts +6 -0
  182. package/types/input-group/index.d.ts +2 -0
  183. package/types/input-group/react-desc-prop-types.d.ts +19 -0
  184. package/types/input-group/styled.d.ts +7 -0
  185. package/types/input-group/tests/DSInputGroup.test.d.ts +1 -0
  186. package/types/mask-hook/hooks/useRegExpMask.d.ts +0 -1
  187. package/types/text-input/config/useInputText.d.ts +5 -5
  188. package/cjs/combobox/parts/menu-list/useMenuListSetFocusOption.js +0 -51
  189. package/esm/combobox/parts/menu-list/useMenuListSetFocusOption.js +0 -47
  190. package/types/combobox/parts/menu-list/useMenuListSetFocusOption.d.ts +0 -1
@@ -8,7 +8,6 @@ require('core-js/modules/esnext.iterator.find.js');
8
8
  var React = require('react');
9
9
  var ControlledDateTimePickerCTX = require('../../../ControlledDateTimePickerCTX.js');
10
10
  var dateHelpers = require('../../../utils/dateHelpers.js');
11
- var constants = require('../../../utils/constants.js');
12
11
 
13
12
  const useKeyboardHandlers = _ref => {
14
13
  let {
@@ -16,29 +15,26 @@ const useKeyboardHandlers = _ref => {
16
15
  focusLogic
17
16
  } = _ref;
18
17
  const {
19
- hideDate,
20
- hideTime,
21
- monthInputRef,
22
- hourInputRef,
23
- prevYearBtnRef,
24
- prevMonthBtnRef,
25
- nextMonthBtnRef,
26
- nextYearBtnRef,
27
- currMeridiemBtnRef,
28
18
  isControllerOnly,
29
19
  isWithTimeWheelToo,
30
- setLatestInteractionRegion,
31
20
  withAnyInputs,
32
21
  isWithTimeInputs,
33
- meridiemInputRef,
34
22
  isWithDateInputs,
35
- yearInputRef
23
+ trackFocusFirstSegment,
24
+ trackFocusMeridiemInput,
25
+ trackFocusYearInput,
26
+ trackFocusCalendarPrevMonth,
27
+ trackFocusCalendarNextMonth,
28
+ trackFocusCalendarNextYear,
29
+ trackFocusCalendarPrevYear,
30
+ trackFocusTimewheelCurrMeridiem,
31
+ trackFocusCalendarMetafocusedDay
36
32
  } = React.useContext(ControlledDateTimePickerCTX.ControlledDateTimePickerContext);
37
33
  const {
38
34
  focusedDay,
39
35
  handleFocusMetaDay,
40
- handleFocusMetaDayByDay,
41
- tryToFocusCurrentlyDataIsFocusedDay
36
+ handleFocusMetaDayByDay // tryToFocusCurrentlyDataIsFocusedDay
37
+
42
38
  } = focusLogic;
43
39
  const {
44
40
  daysArray,
@@ -46,8 +42,6 @@ const useKeyboardHandlers = _ref => {
46
42
  handleNextMonth
47
43
  } = currentDisplayedMonthLogic;
48
44
  const tryToFocusDayRegion = React.useCallback(() => {
49
- setLatestInteractionRegion('calendar-days');
50
-
51
45
  if (!focusedDay) {
52
46
  const newFocusDay = daysArray.find(_ref2 => {
53
47
  let {
@@ -55,42 +49,32 @@ const useKeyboardHandlers = _ref => {
55
49
  } = _ref2;
56
50
  return isCurrMonthDay;
57
51
  });
58
- if (newFocusDay) setTimeout(() => {
59
- handleFocusMetaDay(newFocusDay);
60
- });
61
- } else {
62
- tryToFocusCurrentlyDataIsFocusedDay();
52
+ if (newFocusDay) handleFocusMetaDay(newFocusDay);
63
53
  }
64
- }, [daysArray, focusedDay, handleFocusMetaDay, setLatestInteractionRegion, tryToFocusCurrentlyDataIsFocusedDay]);
65
- const onHomeKeyDownInsideCalendar = React.useCallback(() => {
66
- var _prevMonthBtnRef$curr, _prevMonthBtnRef$curr2;
67
54
 
68
- 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);
69
- }, [prevMonthBtnRef]);
55
+ trackFocusCalendarMetafocusedDay();
56
+ }, [daysArray, focusedDay, handleFocusMetaDay, trackFocusCalendarMetafocusedDay]);
57
+ const onHomeKeyDownInsideCalendar = React.useCallback(() => {
58
+ trackFocusCalendarPrevMonth();
59
+ }, [trackFocusCalendarPrevMonth]);
70
60
  const onEndKeyDownInsideCalendar = React.useCallback(() => {
71
- var _currMeridiemBtnRef$c, _currMeridiemBtnRef$c2;
72
-
73
- if (isWithTimeWheelToo) 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);else tryToFocusDayRegion();
74
- }, [currMeridiemBtnRef, isWithTimeWheelToo, tryToFocusDayRegion]);
61
+ if (isWithTimeWheelToo) trackFocusTimewheelCurrMeridiem();else tryToFocusDayRegion();
62
+ }, [isWithTimeWheelToo, trackFocusTimewheelCurrMeridiem, tryToFocusDayRegion]);
75
63
  const onHomeKeyDownTriggerIcon = React.useCallback(() => {
76
- var _monthInputRef$curren, _monthInputRef$curren2, _hourInputRef$current, _hourInputRef$current2;
77
-
78
- 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);
79
- }, [hideDate, hideTime, monthInputRef, hourInputRef]);
64
+ trackFocusFirstSegment();
65
+ }, [trackFocusFirstSegment]);
80
66
  const handlePickerIconKeyDown = React.useCallback(e => {
81
67
  const {
82
68
  key
83
69
  } = e;
84
- if (constants.homeEndKeys.includes(key)) e.preventDefault();
85
- if (constants.homeEndKeys.includes(key)) e.stopPropagation();
70
+ if (['Home', 'End'].includes(key)) e.preventDefault();
71
+ if (['Home', 'End'].includes(key)) e.stopPropagation();
86
72
  if (key === 'Home') onHomeKeyDownTriggerIcon();
87
73
 
88
74
  if (key === 'Backspace' && withAnyInputs) {
89
- var _meridiemInputRef$cur, _meridiemInputRef$cur2, _yearInputRef$current, _yearInputRef$current2;
90
-
91
- 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);
75
+ if (isWithTimeInputs) trackFocusMeridiemInput();else if (isWithDateInputs) trackFocusYearInput();
92
76
  }
93
- }, [isWithDateInputs, isWithTimeInputs, meridiemInputRef, onHomeKeyDownTriggerIcon, withAnyInputs, yearInputRef]);
77
+ }, [isWithDateInputs, isWithTimeInputs, onHomeKeyDownTriggerIcon, trackFocusMeridiemInput, trackFocusYearInput, withAnyInputs]);
94
78
  const handleDayOnKeyDown = React.useCallback((e, metaDay) => {
95
79
  let newFocusedDayDate;
96
80
  const {
@@ -100,8 +84,8 @@ const useKeyboardHandlers = _ref => {
100
84
  key,
101
85
  shiftKey
102
86
  } = e;
103
- if (constants.homeEndAllArrowKeys.includes(key)) e.preventDefault();
104
- if (constants.homeEndAllArrowKeys.includes(key)) e.stopPropagation();
87
+ if (['Home', 'End', 'ArrowUp', 'ArrowDown', 'ArrowLeft', 'ArrowRight'].includes(key)) e.preventDefault();
88
+ if (['Home', 'End', 'ArrowUp', 'ArrowDown', 'ArrowLeft', 'ArrowRight'].includes(key)) e.stopPropagation();
105
89
  if (key === 'ArrowUp') newFocusedDayDate = dateHelpers.sumValuesToDate(day, {
106
90
  daysToSum: -7
107
91
  });
@@ -131,21 +115,18 @@ const useKeyboardHandlers = _ref => {
131
115
 
132
116
  if (newFocusedDayDate) {
133
117
  handleFocusMetaDayByDay(newFocusedDayDate);
134
- setTimeout(tryToFocusCurrentlyDataIsFocusedDay);
135
118
  }
136
119
 
137
120
  if (key === 'Home') onHomeKeyDownInsideCalendar();
138
121
  if (key === 'End') onEndKeyDownInsideCalendar(); // TAB CYCLE IMPLEMENTATION
139
122
 
140
123
  if (key === 'Tab' && !shiftKey && isControllerOnly === false && !isWithTimeWheelToo) {
141
- var _prevMonthBtnRef$curr3, _prevMonthBtnRef$curr4;
142
-
143
124
  // MUST prevent default since this is a custom focus switch
144
125
  // NOT preventing the default event will cause unexpected result
145
126
  e.preventDefault();
146
- prevMonthBtnRef === null || prevMonthBtnRef === void 0 ? void 0 : (_prevMonthBtnRef$curr3 = prevMonthBtnRef.current) === null || _prevMonthBtnRef$curr3 === void 0 ? void 0 : (_prevMonthBtnRef$curr4 = _prevMonthBtnRef$curr3.focus) === null || _prevMonthBtnRef$curr4 === void 0 ? void 0 : _prevMonthBtnRef$curr4.call(_prevMonthBtnRef$curr3);
127
+ trackFocusCalendarPrevMonth();
147
128
  }
148
- }, [daysArray, handleFocusMetaDayByDay, handleNextMonth, handlePrevMonth, isControllerOnly, isWithTimeWheelToo, onEndKeyDownInsideCalendar, onHomeKeyDownInsideCalendar, prevMonthBtnRef, tryToFocusCurrentlyDataIsFocusedDay]);
129
+ }, [daysArray, handleFocusMetaDayByDay, handleNextMonth, handlePrevMonth, isControllerOnly, isWithTimeWheelToo, onEndKeyDownInsideCalendar, onHomeKeyDownInsideCalendar, trackFocusCalendarPrevMonth]);
149
130
  const handlePrevYearKeyDown = React.useCallback(e => {
150
131
  const {
151
132
  key,
@@ -156,13 +137,9 @@ const useKeyboardHandlers = _ref => {
156
137
  e.preventDefault();
157
138
 
158
139
  if (shiftKey) {
159
- var _nextMonthBtnRef$curr;
160
-
161
- (_nextMonthBtnRef$curr = nextMonthBtnRef.current) === null || _nextMonthBtnRef$curr === void 0 ? void 0 : _nextMonthBtnRef$curr.focus();
140
+ trackFocusCalendarNextMonth();
162
141
  } else {
163
- var _nextYearBtnRef$curre;
164
-
165
- (_nextYearBtnRef$curre = nextYearBtnRef.current) === null || _nextYearBtnRef$curre === void 0 ? void 0 : _nextYearBtnRef$curre.focus();
142
+ trackFocusCalendarNextYear();
166
143
  }
167
144
  }
168
145
 
@@ -175,7 +152,7 @@ const useKeyboardHandlers = _ref => {
175
152
  onEndKeyDownInsideCalendar();
176
153
  e.preventDefault();
177
154
  }
178
- }, [nextMonthBtnRef, nextYearBtnRef, onEndKeyDownInsideCalendar, onHomeKeyDownInsideCalendar]);
155
+ }, [onEndKeyDownInsideCalendar, onHomeKeyDownInsideCalendar, trackFocusCalendarNextMonth, trackFocusCalendarNextYear]);
179
156
  const handlePrevMonthKeyDown = React.useCallback(e => {
180
157
  const {
181
158
  key,
@@ -186,16 +163,12 @@ const useKeyboardHandlers = _ref => {
186
163
  if (shiftKey) {
187
164
  // TAB CYCLE IMPLEMENTATION
188
165
  if (!isControllerOnly) {
189
- var _currMeridiemBtnRef$c3, _currMeridiemBtnRef$c4;
190
-
191
166
  e.preventDefault();
192
- if (isWithTimeWheelToo) currMeridiemBtnRef === null || currMeridiemBtnRef === void 0 ? void 0 : (_currMeridiemBtnRef$c3 = currMeridiemBtnRef.current) === null || _currMeridiemBtnRef$c3 === void 0 ? void 0 : (_currMeridiemBtnRef$c4 = _currMeridiemBtnRef$c3.focus) === null || _currMeridiemBtnRef$c4 === void 0 ? void 0 : _currMeridiemBtnRef$c4.call(_currMeridiemBtnRef$c3);else tryToFocusDayRegion();
167
+ if (isWithTimeWheelToo) trackFocusTimewheelCurrMeridiem();else tryToFocusDayRegion();
193
168
  }
194
169
  } else {
195
- var _nextMonthBtnRef$curr2;
196
-
197
170
  e.preventDefault();
198
- (_nextMonthBtnRef$curr2 = nextMonthBtnRef.current) === null || _nextMonthBtnRef$curr2 === void 0 ? void 0 : _nextMonthBtnRef$curr2.focus();
171
+ trackFocusCalendarNextMonth();
199
172
  }
200
173
  }
201
174
 
@@ -208,7 +181,7 @@ const useKeyboardHandlers = _ref => {
208
181
  onEndKeyDownInsideCalendar();
209
182
  e.preventDefault();
210
183
  }
211
- }, [currMeridiemBtnRef, isControllerOnly, isWithTimeWheelToo, nextMonthBtnRef, onEndKeyDownInsideCalendar, onHomeKeyDownInsideCalendar, tryToFocusDayRegion]);
184
+ }, [isControllerOnly, isWithTimeWheelToo, onEndKeyDownInsideCalendar, onHomeKeyDownInsideCalendar, trackFocusCalendarNextMonth, trackFocusTimewheelCurrMeridiem, tryToFocusDayRegion]);
212
185
  const handleNextMonthKeyDown = React.useCallback(e => {
213
186
  const {
214
187
  key,
@@ -219,13 +192,9 @@ const useKeyboardHandlers = _ref => {
219
192
  e.preventDefault();
220
193
 
221
194
  if (shiftKey) {
222
- var _prevMonthBtnRef$curr5;
223
-
224
- (_prevMonthBtnRef$curr5 = prevMonthBtnRef.current) === null || _prevMonthBtnRef$curr5 === void 0 ? void 0 : _prevMonthBtnRef$curr5.focus();
195
+ trackFocusCalendarPrevMonth();
225
196
  } else {
226
- var _prevYearBtnRef$curre;
227
-
228
- (_prevYearBtnRef$curre = prevYearBtnRef.current) === null || _prevYearBtnRef$curre === void 0 ? void 0 : _prevYearBtnRef$curre.focus();
197
+ trackFocusCalendarPrevYear();
229
198
  }
230
199
  }
231
200
 
@@ -238,7 +207,7 @@ const useKeyboardHandlers = _ref => {
238
207
  onEndKeyDownInsideCalendar();
239
208
  e.preventDefault();
240
209
  }
241
- }, [onEndKeyDownInsideCalendar, onHomeKeyDownInsideCalendar, prevMonthBtnRef, prevYearBtnRef]);
210
+ }, [onEndKeyDownInsideCalendar, onHomeKeyDownInsideCalendar, trackFocusCalendarPrevMonth, trackFocusCalendarPrevYear]);
242
211
  const handleNextYearKeyDown = React.useCallback(e => {
243
212
  const {
244
213
  key,
@@ -249,9 +218,7 @@ const useKeyboardHandlers = _ref => {
249
218
  e.preventDefault();
250
219
 
251
220
  if (shiftKey) {
252
- var _prevYearBtnRef$curre2, _prevYearBtnRef$curre3;
253
-
254
- prevYearBtnRef === null || prevYearBtnRef === void 0 ? void 0 : (_prevYearBtnRef$curre2 = prevYearBtnRef.current) === null || _prevYearBtnRef$curre2 === void 0 ? void 0 : (_prevYearBtnRef$curre3 = _prevYearBtnRef$curre2.focus) === null || _prevYearBtnRef$curre3 === void 0 ? void 0 : _prevYearBtnRef$curre3.call(_prevYearBtnRef$curre2);
221
+ trackFocusCalendarPrevYear();
255
222
  }
256
223
 
257
224
  if (!shiftKey) tryToFocusDayRegion();
@@ -266,7 +233,7 @@ const useKeyboardHandlers = _ref => {
266
233
  onEndKeyDownInsideCalendar();
267
234
  e.preventDefault();
268
235
  }
269
- }, [tryToFocusDayRegion, prevYearBtnRef, onHomeKeyDownInsideCalendar, onEndKeyDownInsideCalendar]);
236
+ }, [tryToFocusDayRegion, trackFocusCalendarPrevYear, onHomeKeyDownInsideCalendar, onEndKeyDownInsideCalendar]);
270
237
  return React.useMemo(() => ({
271
238
  handleDayOnKeyDown,
272
239
  handlePrevYearKeyDown,
@@ -16,16 +16,19 @@ const usePopperTriggerLogic = _ref => {
16
16
  } = _ref;
17
17
  const {
18
18
  focusedDay,
19
- resetFocusedDayToStartDate,
20
- tryToFocusCurrentlyDataIsFocusedDay
19
+ resetFocusedDayToStartDate
21
20
  } = focusLogic;
22
21
  const {
23
22
  props: {
24
23
  onPickerOpen,
25
24
  onPickerClose
26
25
  },
27
- prevMonthBtnRef,
28
- pickerButtonRef
26
+ pickerButtonRef,
27
+ trackFocusCalendarMetafocusedDay,
28
+ trackFocusCalendarPrevMonth,
29
+ trackFocusPicker,
30
+ latestInteractionRegion,
31
+ currFocusDescriber
29
32
  } = React.useContext(ControlledDateTimePickerCTX.ControlledDateTimePickerContext);
30
33
  const [referenceElement, setReferenceElement] = React.useState(null);
31
34
  const [popperElement, setPopperElement] = React.useState(null);
@@ -41,29 +44,18 @@ const usePopperTriggerLogic = _ref => {
41
44
 
42
45
  const handleOnPickerOpen = React.useCallback(() => {
43
46
  onPickerOpen();
44
- tryToFocusCurrentlyDataIsFocusedDay();
45
- }, [onPickerOpen, tryToFocusCurrentlyDataIsFocusedDay]);
47
+ }, [onPickerOpen]);
46
48
  const openCalendar = React.useCallback(() => {
47
- if (focusedDay) setTimeout(() => {
48
- var _focusedDay$dayBtnRef, _focusedDay$dayBtnRef2, _focusedDay$dayBtnRef3;
49
-
50
- return focusedDay === null || focusedDay === void 0 ? void 0 : (_focusedDay$dayBtnRef = focusedDay.dayBtnRef) === null || _focusedDay$dayBtnRef === void 0 ? void 0 : (_focusedDay$dayBtnRef2 = _focusedDay$dayBtnRef.current) === null || _focusedDay$dayBtnRef2 === void 0 ? void 0 : (_focusedDay$dayBtnRef3 = _focusedDay$dayBtnRef2.focus) === null || _focusedDay$dayBtnRef3 === void 0 ? void 0 : _focusedDay$dayBtnRef3.call(_focusedDay$dayBtnRef2);
51
- }, 100);else setTimeout(() => {
52
- var _prevMonthBtnRef$curr, _prevMonthBtnRef$curr2;
53
-
54
- return 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);
55
- }, 100);
49
+ if (focusedDay) trackFocusCalendarMetafocusedDay();else trackFocusCalendarPrevMonth();
56
50
  setShowCalendar(true);
57
51
  handleOnPickerOpen();
58
- }, [focusedDay, handleOnPickerOpen, prevMonthBtnRef, setShowCalendar]);
52
+ }, [focusedDay, handleOnPickerOpen, setShowCalendar, trackFocusCalendarMetafocusedDay, trackFocusCalendarPrevMonth]);
59
53
  const closeCalendar = React.useCallback(() => {
60
- var _pickerButtonRef$curr, _pickerButtonRef$curr2;
61
-
62
54
  setShowCalendar(false);
63
55
  onPickerClose();
64
56
  resetFocusedDayToStartDate();
65
- 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);
66
- }, [setShowCalendar, onPickerClose, resetFocusedDayToStartDate, pickerButtonRef]);
57
+ trackFocusPicker();
58
+ }, [setShowCalendar, onPickerClose, resetFocusedDayToStartDate, trackFocusPicker]);
67
59
  const handleToggleCalendar = React.useCallback(() => {
68
60
  const isOpening = !showCalendar;
69
61
  if (isOpening) openCalendar();else closeCalendar();
@@ -71,23 +63,22 @@ const usePopperTriggerLogic = _ref => {
71
63
  const handleSetTriggerRef = React.useCallback(newRef => {
72
64
  pickerButtonRef.current = newRef;
73
65
  setReferenceElement(newRef);
74
- }, [pickerButtonRef]);
66
+ if (latestInteractionRegion === 'picker-icon' && currFocusDescriber === 'date-picker-icon') newRef === null || newRef === void 0 ? void 0 : newRef.focus();
67
+ }, [currFocusDescriber, latestInteractionRegion, pickerButtonRef]);
75
68
  const handleMenuWrapperKeyDown = React.useCallback(e => {
76
69
  const {
77
70
  key
78
71
  } = e;
79
72
 
80
73
  if (key === 'Escape') {
81
- var _pickerButtonRef$curr3, _pickerButtonRef$curr4;
82
-
83
74
  closeCalendar();
84
- 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);
75
+ trackFocusPicker();
85
76
  }
86
- }, [closeCalendar, pickerButtonRef]);
77
+ }, [closeCalendar, trackFocusPicker]);
87
78
  useOnClickOutside.useOnClickOutside(popperElement, e => {
88
- var _pickerButtonRef$curr5, _pickerButtonRef$curr6;
79
+ var _pickerButtonRef$curr, _pickerButtonRef$curr2;
89
80
 
90
- if (e.target instanceof Element && !(pickerButtonRef !== null && pickerButtonRef !== void 0 && (_pickerButtonRef$curr5 = pickerButtonRef.current) !== null && _pickerButtonRef$curr5 !== void 0 && (_pickerButtonRef$curr6 = _pickerButtonRef$curr5.contains) !== null && _pickerButtonRef$curr6 !== void 0 && _pickerButtonRef$curr6.call(_pickerButtonRef$curr5, e === null || e === void 0 ? void 0 : e.target))) closeCalendar();
81
+ if (e.target instanceof Element && !(pickerButtonRef !== null && pickerButtonRef !== void 0 && (_pickerButtonRef$curr = pickerButtonRef.current) !== null && _pickerButtonRef$curr !== void 0 && (_pickerButtonRef$curr2 = _pickerButtonRef$curr.contains) !== null && _pickerButtonRef$curr2 !== void 0 && _pickerButtonRef$curr2.call(_pickerButtonRef$curr, e === null || e === void 0 ? void 0 : e.target))) closeCalendar();
91
82
  });
92
83
  return React.useMemo(() => ({
93
84
  closeCalendar,
@@ -29,6 +29,7 @@ const CalendarWithTimeWheelIconTrigger = () => {
29
29
  return React.useMemo(() => /*#__PURE__*/_jsx__default["default"](Styleds.StyledIconTriggerButton, {
30
30
  "aria-label": "date time picker context menu trigger, ".concat(ariaCurrentValueForInputs),
31
31
  buttonType: "icon",
32
+ type: "button",
32
33
  size: DSButton.BUTTON_SIZES.M,
33
34
  innerRef: handleSetTriggerRef,
34
35
  onClick: handleToggleCalendarWithTimeWheel,
@@ -10,7 +10,6 @@ var ControlledDateTimePickerCTX = require('../../../ControlledDateTimePickerCTX.
10
10
  var useOnClickOutside = require('../../../utils/hooks/useOnClickOutside.js');
11
11
  var CalendarContext = require('../Calendar/CalendarContext.js');
12
12
  var TimeWheelContext = require('../TimeWheel/TimeWheelContext.js');
13
- var constants = require('../../../utils/constants.js');
14
13
 
15
14
  const useConfigCalendarWithTimeWheelCTX = () => {
16
15
  const {
@@ -21,15 +20,15 @@ const useConfigCalendarWithTimeWheelCTX = () => {
21
20
  onPickerClose,
22
21
  disabled
23
22
  },
24
- hideDate,
25
- hideTime,
26
- monthInputRef,
27
- hourInputRef,
28
23
  withAnyInputs,
29
24
  isWithTimeInputs,
30
- meridiemInputRef,
31
- yearInputRef,
32
- ariaCurrentValueForInputs
25
+ ariaCurrentValueForInputs,
26
+ trackFocusFirstSegment,
27
+ trackFocusMeridiemInput,
28
+ trackFocusYearInput,
29
+ trackFocusPicker,
30
+ latestInteractionRegion,
31
+ currFocusDescriber
33
32
  } = React.useContext(ControlledDateTimePickerCTX.ControlledDateTimePickerContext);
34
33
  const {
35
34
  handleToggleCalendar
@@ -39,24 +38,20 @@ const useConfigCalendarWithTimeWheelCTX = () => {
39
38
  } = React.useContext(TimeWheelContext.TimeWheelContext);
40
39
  const [showCalendarWithTimeWheel, setShowCalendarWithTimeWheel] = React.useState(false);
41
40
  const onHomeKeyDown = React.useCallback(() => {
42
- var _monthInputRef$curren, _monthInputRef$curren2, _hourInputRef$current, _hourInputRef$current2;
43
-
44
- 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);
45
- }, [hideDate, hideTime, monthInputRef, hourInputRef]);
41
+ trackFocusFirstSegment();
42
+ }, [trackFocusFirstSegment]);
46
43
  const handlePickerIconKeyDown = React.useCallback(e => {
47
44
  const {
48
45
  key
49
46
  } = e;
50
- if (constants.homeEndKeys.includes(key)) e.preventDefault();
51
- if (constants.homeEndKeys.includes(key)) e.stopPropagation();
47
+ if (['Home', 'End'].includes(key)) e.preventDefault();
48
+ if (['Home', 'End'].includes(key)) e.stopPropagation();
52
49
  if (key === 'Home') onHomeKeyDown();
53
50
 
54
51
  if (key === 'Backspace' && withAnyInputs) {
55
- var _meridiemInputRef$cur, _meridiemInputRef$cur2, _yearInputRef$current, _yearInputRef$current2;
56
-
57
- 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 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 trackFocusYearInput();
58
53
  }
59
- }, [isWithTimeInputs, meridiemInputRef, onHomeKeyDown, withAnyInputs, yearInputRef]);
54
+ }, [isWithTimeInputs, onHomeKeyDown, trackFocusMeridiemInput, trackFocusYearInput, withAnyInputs]);
60
55
  const [referenceElement, setReferenceElement] = React.useState(null);
61
56
  const [popperElement, setPopperElement] = React.useState(null);
62
57
  const [arrowElement, setArrowElement] = React.useState(null);
@@ -91,19 +86,18 @@ const useConfigCalendarWithTimeWheelCTX = () => {
91
86
  const handleSetTriggerRef = React.useCallback(newRef => {
92
87
  pickerButtonRef.current = newRef;
93
88
  setReferenceElement(newRef);
94
- }, [pickerButtonRef]);
89
+ if (latestInteractionRegion === 'picker-icon' && currFocusDescriber === 'datetime-picker-icon') newRef === null || newRef === void 0 ? void 0 : newRef.focus();
90
+ }, [currFocusDescriber, latestInteractionRegion, pickerButtonRef]);
95
91
  const handleMenuWrapperKeyDown = React.useCallback(e => {
96
92
  const {
97
93
  key
98
94
  } = e;
99
95
 
100
96
  if (key === 'Escape') {
101
- var _pickerButtonRef$curr3, _pickerButtonRef$curr4;
102
-
103
97
  closeCalendar();
104
- 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);
98
+ trackFocusPicker();
105
99
  }
106
- }, [closeCalendar, pickerButtonRef]);
100
+ }, [closeCalendar, trackFocusPicker]);
107
101
  const isControllerOnly = React.useMemo(() => type === ControlledDateTimePickerTypes.CONTROLLED_DATE_TIME_PICKER_TYPES.DATE_TIME.CONTROLLER_ONLY, [type]);
108
102
  return React.useMemo(() => ({
109
103
  showCalendarWithTimeWheel,
@@ -39,9 +39,7 @@ const HoursList = () => {
39
39
  handlePrevHour,
40
40
  handleNextHour,
41
41
  handleTimeWheelBtnChangeHours,
42
- handlePrevHourBtnOnKeyDown,
43
- handleCurrHourOnKeyDown,
44
- handleNextHourBtnOnKeyDown
42
+ handleCurrHourOnKeyDown
45
43
  } = React.useContext(TimeWheelContext.TimeWheelContext);
46
44
  const {
47
45
  prevHourBtnRef,
@@ -49,14 +47,23 @@ const HoursList = () => {
49
47
  nextHourBtnRef,
50
48
  getIsDisabledTime,
51
49
  autoFocusHourTimeWheel,
52
- hours
50
+ hours,
51
+ latestInteractionRegion,
52
+ currFocusDescriber
53
53
  } = React.useContext(ControlledDateTimePickerCTX.ControlledDateTimePickerContext);
54
+ const handleCurrYearRef = React.useCallback(ButtonDomNode => {
55
+ setTimeout(() => {
56
+ var _ButtonDomNode$focus;
57
+
58
+ currHourBtnRef.current = ButtonDomNode;
59
+ if (latestInteractionRegion === 'timewheel' && currFocusDescriber === 'timewheel-curr-hour') ButtonDomNode === null || ButtonDomNode === void 0 ? void 0 : (_ButtonDomNode$focus = ButtonDomNode.focus) === null || _ButtonDomNode$focus === void 0 ? void 0 : _ButtonDomNode$focus.call(ButtonDomNode);
60
+ });
61
+ }, [currFocusDescriber, latestInteractionRegion, currHourBtnRef]);
54
62
  return /*#__PURE__*/_jsx__default["default"](Styleds.StyledWheelList, {}, void 0, /*#__PURE__*/_jsx__default["default"](Styleds.StyledWheelListItem, {}, void 0, /*#__PURE__*/_jsx__default["default"](Styleds.StyledWheelChangeTimeBtn, {
55
63
  "aria-label": "subtract one hour",
56
64
  buttonType: "raw",
57
65
  size: "m",
58
66
  onClick: handlePrevHour,
59
- onKeyDown: handlePrevHourBtnOnKeyDown,
60
67
  innerRef: prevHourBtnRef,
61
68
  "data-testid": ControlledDateTimePickerDatatestid.ControlledDateTimePickerDatatestid.TIMEWHEEL.PREV_HOUR,
62
69
  tabIndex: -1
@@ -70,7 +77,7 @@ const HoursList = () => {
70
77
  const tabIndex = isCurrentListItem ? 0 : -1;
71
78
  const btnProps = {
72
79
  onKeyDown: isCurrentListItem ? handleCurrHourOnKeyDown : undefined,
73
- innerRef: isCurrentListItem ? currHourBtnRef : undefined
80
+ innerRef: isCurrentListItem ? handleCurrYearRef : undefined
74
81
  };
75
82
  const styleProps = {
76
83
  isCurrentListItem,
@@ -101,7 +108,6 @@ const HoursList = () => {
101
108
  buttonType: "raw",
102
109
  size: "m",
103
110
  onClick: handleNextHour,
104
- onKeyDown: handleNextHourBtnOnKeyDown,
105
111
  innerRef: nextHourBtnRef,
106
112
  tabIndex: -1,
107
113
  "data-testid": ControlledDateTimePickerDatatestid.ControlledDateTimePickerDatatestid.TIMEWHEEL.NEXT_HOUR
@@ -31,9 +31,7 @@ const MeridiemList = () => {
31
31
  const {
32
32
  currMeridiem,
33
33
  handleTimeWheelBtnChangeMeridiem,
34
- handlePrevMeridiemBtnOnKeyDown,
35
- handleCurrMeridiemOnKeyDown,
36
- handleNextMeridiemBtnOnKeyDown
34
+ handleCurrMeridiemOnKeyDown
37
35
  } = React.useContext(TimeWheelContext.TimeWheelContext);
38
36
  const {
39
37
  prevMeridiemBtnRef,
@@ -41,7 +39,9 @@ const MeridiemList = () => {
41
39
  nextMeridiemBtnRef,
42
40
  getIsDisabledTime,
43
41
  hours,
44
- minutes
42
+ minutes,
43
+ latestInteractionRegion,
44
+ currFocusDescriber
45
45
  } = React.useContext(ControlledDateTimePickerCTX.ControlledDateTimePickerContext);
46
46
  const isAmCurrent = !currMeridiem || currMeridiem === 'AM';
47
47
  const isPmCurrent = currMeridiem === 'PM';
@@ -64,6 +64,14 @@ const MeridiemList = () => {
64
64
  const styledPropsNextMeridiem = {
65
65
  isDisabled: isDisabledPm
66
66
  };
67
+ const handleCurrMeridiemRef = React.useCallback(ButtonDomNode => {
68
+ setTimeout(() => {
69
+ var _ButtonDomNode$focus;
70
+
71
+ currMeridiemBtnRef.current = ButtonDomNode;
72
+ if (latestInteractionRegion === 'timewheel' && currFocusDescriber === 'timewheel-curr-meridiem') ButtonDomNode === null || ButtonDomNode === void 0 ? void 0 : (_ButtonDomNode$focus = ButtonDomNode.focus) === null || _ButtonDomNode$focus === void 0 ? void 0 : _ButtonDomNode$focus.call(ButtonDomNode);
73
+ });
74
+ }, [currFocusDescriber, latestInteractionRegion, currMeridiemBtnRef]);
67
75
  return /*#__PURE__*/_jsx__default["default"](Styleds.StyledWheelList, {}, void 0, /*#__PURE__*/_jsx__default["default"](Styleds.StyledWheelListItem, {}, void 0, /*#__PURE__*/jsxRuntime.jsx(Styleds.StyledWheelChangeTimeBtn, _objectSpread(_objectSpread({}, styledPropsPrevMeridiem), {}, {
68
76
  "aria-label": "set am meridiem",
69
77
  "aria-disabled": isDisabledAm,
@@ -71,7 +79,6 @@ const MeridiemList = () => {
71
79
  buttonType: "raw",
72
80
  size: "m",
73
81
  onClick: e => handleTimeWheelBtnChangeMeridiem('AM', e),
74
- onKeyDown: handlePrevMeridiemBtnOnKeyDown,
75
82
  innerRef: prevMeridiemBtnRef,
76
83
  tabIndex: -1,
77
84
  children: _ChevronSmallUp || (_ChevronSmallUp = /*#__PURE__*/_jsx__default["default"](dsIcons.ChevronSmallUp, {}))
@@ -86,7 +93,7 @@ const MeridiemList = () => {
86
93
  size: "m",
87
94
  onClick: e => handleTimeWheelBtnChangeMeridiem('AM', e),
88
95
  onKeyDown: isAmCurrent ? handleCurrMeridiemOnKeyDown : undefined,
89
- innerRef: isAmCurrent ? currMeridiemBtnRef : undefined,
96
+ innerRef: isAmCurrent ? handleCurrMeridiemRef : undefined,
90
97
  tabIndex: isAmCurrent ? 0 : -1,
91
98
  role: "spinbutton",
92
99
  "aria-valuemax": 1,
@@ -105,7 +112,7 @@ const MeridiemList = () => {
105
112
  size: "m",
106
113
  onClick: e => handleTimeWheelBtnChangeMeridiem('PM', e),
107
114
  onKeyDown: isPmCurrent ? handleCurrMeridiemOnKeyDown : undefined,
108
- innerRef: isPmCurrent ? currMeridiemBtnRef : undefined,
115
+ innerRef: isPmCurrent ? handleCurrMeridiemRef : undefined,
109
116
  tabIndex: isPmCurrent ? 0 : -1,
110
117
  role: "spinbutton",
111
118
  "aria-valuemax": 1,
@@ -120,7 +127,6 @@ const MeridiemList = () => {
120
127
  buttonType: "raw",
121
128
  size: "m",
122
129
  onClick: e => handleTimeWheelBtnChangeMeridiem('PM', e),
123
- onKeyDown: handleNextMeridiemBtnOnKeyDown,
124
130
  innerRef: nextMeridiemBtnRef,
125
131
  tabIndex: -1,
126
132
  children: _ChevronSmallDown || (_ChevronSmallDown = /*#__PURE__*/_jsx__default["default"](dsIcons.ChevronSmallDown, {}))
@@ -39,23 +39,30 @@ const MinutesList = () => {
39
39
  handlePrevMinute,
40
40
  handleNextMinute,
41
41
  handleTimeWheelBtnChangeMinutes,
42
- handlePrevMinuteBtnOnKeyDown,
43
- handleCurrMinutesOnKeyDown,
44
- handleNextMinuteBtnOnKeyDown
42
+ handleCurrMinutesOnKeyDown
45
43
  } = React.useContext(TimeWheelContext.TimeWheelContext);
46
44
  const {
47
45
  prevMinutesBtnRef,
48
46
  currMinutesBtnRef,
49
47
  nextMinutesBtnRef,
50
48
  getIsDisabledTime,
51
- minutes
49
+ minutes,
50
+ currFocusDescriber,
51
+ latestInteractionRegion
52
52
  } = React.useContext(ControlledDateTimePickerCTX.ControlledDateTimePickerContext);
53
+ const handleCurrMeridiemRef = React.useCallback(ButtonDomNode => {
54
+ setTimeout(() => {
55
+ var _ButtonDomNode$focus;
56
+
57
+ currMinutesBtnRef.current = ButtonDomNode;
58
+ if (latestInteractionRegion === 'timewheel' && currFocusDescriber === 'timewheel-curr-minute') ButtonDomNode === null || ButtonDomNode === void 0 ? void 0 : (_ButtonDomNode$focus = ButtonDomNode.focus) === null || _ButtonDomNode$focus === void 0 ? void 0 : _ButtonDomNode$focus.call(ButtonDomNode);
59
+ });
60
+ }, [currFocusDescriber, latestInteractionRegion, currMinutesBtnRef]);
53
61
  return /*#__PURE__*/_jsx__default["default"](Styleds.StyledWheelList, {}, void 0, /*#__PURE__*/_jsx__default["default"](Styleds.StyledWheelListItem, {}, void 0, /*#__PURE__*/_jsx__default["default"](Styleds.StyledWheelChangeTimeBtn, {
54
62
  "aria-label": "subtract one minute",
55
63
  buttonType: "raw",
56
64
  size: "m",
57
65
  onClick: handlePrevMinute,
58
- onKeyDown: handlePrevMinuteBtnOnKeyDown,
59
66
  innerRef: prevMinutesBtnRef,
60
67
  tabIndex: -1,
61
68
  "data-testid": ControlledDateTimePickerDatatestid.ControlledDateTimePickerDatatestid.TIMEWHEEL.PREV_MINUTE
@@ -69,7 +76,7 @@ const MinutesList = () => {
69
76
  const tabIndex = isCurrentListItem ? 0 : -1;
70
77
  const btnProps = {
71
78
  onKeyDown: isCurrentListItem ? handleCurrMinutesOnKeyDown : undefined,
72
- innerRef: isCurrentListItem ? currMinutesBtnRef : undefined
79
+ innerRef: isCurrentListItem ? handleCurrMeridiemRef : undefined
73
80
  };
74
81
  const styledProps = {
75
82
  isCurrentListItem,
@@ -100,7 +107,6 @@ const MinutesList = () => {
100
107
  buttonType: "raw",
101
108
  size: "m",
102
109
  onClick: handleNextMinute,
103
- onKeyDown: handleNextMinuteBtnOnKeyDown,
104
110
  innerRef: nextMinutesBtnRef,
105
111
  "data-testid": ControlledDateTimePickerDatatestid.ControlledDateTimePickerDatatestid.TIMEWHEEL.NEXT_MINUTE,
106
112
  tabIndex: -1