@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.
Files changed (231) hide show
  1. package/cjs/autocomplete/config/useAutocomplete.js +1 -3
  2. package/cjs/autocomplete/parts/A11yFocusedOption.js +43 -0
  3. package/cjs/autocomplete/parts/container/Container.js +36 -24
  4. package/cjs/autocomplete/parts/container/styled.js +2 -2
  5. package/cjs/autocomplete/parts/menu-list/MenuList.js +4 -2
  6. package/cjs/autocomplete/parts/styled.js +2 -0
  7. package/cjs/autocomplete/utils/listHelper.js +1 -1
  8. package/cjs/checkbox/ControlledCheckbox.js +49 -33
  9. package/cjs/checkbox/exported-related/data-test-ids.js +10 -0
  10. package/cjs/checkbox/exported-related/index.js +12 -0
  11. package/cjs/checkbox/exported-related/theming.js +13 -0
  12. package/cjs/checkbox/react-desc-prop-types.js +2 -2
  13. package/cjs/checkbox/styles.js +28 -15
  14. package/cjs/combobox/ComboBoxCTX.js +7 -4
  15. package/cjs/combobox/ComboboxDataTestids.js +1 -1
  16. package/cjs/combobox/config/useComboBox.js +21 -8
  17. package/cjs/combobox/index.js +5 -0
  18. package/cjs/combobox/parts/A11yFocusedOption.js +14 -6
  19. package/cjs/combobox/parts/A11ySelectedValues.js +0 -2
  20. package/cjs/combobox/parts/DropdownIndicator.js +4 -4
  21. package/cjs/combobox/parts/container/Container.js +14 -17
  22. package/cjs/combobox/parts/container/styled.js +13 -7
  23. package/cjs/combobox/parts/controls/Controls.js +22 -14
  24. package/cjs/combobox/parts/controls/styled.js +22 -13
  25. package/cjs/combobox/parts/controls/useOnPillsNavigation.js +3 -3
  26. package/cjs/combobox/parts/controls-input/ControlsInput.js +3 -3
  27. package/cjs/combobox/parts/controls-input/styled.js +7 -3
  28. package/cjs/combobox/parts/controls-input/useControlsInput.js +5 -5
  29. package/cjs/combobox/parts/controls-input/useKeyboardNavigation.js +37 -29
  30. package/cjs/combobox/parts/controls-input/useMaskedOnChange.js +6 -6
  31. package/cjs/combobox/parts/dropdown-indicator/DropdownIndicator.js +2 -2
  32. package/cjs/combobox/parts/header-list/HeaderList.js +4 -3
  33. package/cjs/combobox/parts/header-list/useHeaderListHandlers.js +11 -7
  34. package/cjs/combobox/parts/menu-list/MenuList.js +10 -5
  35. package/cjs/combobox/parts/menu-list/styled.js +16 -9
  36. package/cjs/combobox/parts/menu-list/useItemRenderer.js +17 -15
  37. package/cjs/combobox/parts/multi-selected-values-container/MultiSelectedValuesContainer.js +1 -1
  38. package/cjs/combobox/parts/multi-selected-values-container/RemovableSelectedValuePill.js +2 -0
  39. package/cjs/combobox/parts/multi-selected-values-container/useGroupPills.js +13 -10
  40. package/cjs/combobox/react-desc-prop-types.js +3 -2
  41. package/cjs/combobox/theming.js +13 -0
  42. package/cjs/combobox/utils/listHelper.js +12 -1
  43. package/cjs/date-time-picker/config/useChangeHandlers.js +8 -12
  44. package/cjs/date-time-picker/config/useControlledDateTimePicker.js +13 -9
  45. package/cjs/date-time-picker/config/useFocusTracker.js +136 -0
  46. package/cjs/date-time-picker/config/useGetReferences.js +40 -19
  47. package/cjs/date-time-picker/config/useGlobalKeyHandlers.js +8 -12
  48. package/cjs/date-time-picker/parts/ClearButton/ClearButton.js +12 -2
  49. package/cjs/date-time-picker/parts/ClearButton/useClearButton.js +12 -25
  50. package/cjs/date-time-picker/parts/ControlledDateTimePickerContent.js +4 -7
  51. package/cjs/date-time-picker/parts/DateInputs/DDInput.js +8 -2
  52. package/cjs/date-time-picker/parts/DateInputs/DateInputs.js +9 -4
  53. package/cjs/date-time-picker/parts/DateInputs/MMInput.js +8 -2
  54. package/cjs/date-time-picker/parts/DateInputs/YYYYInput.js +8 -2
  55. package/cjs/date-time-picker/parts/DateInputs/useDateInputs.js +76 -95
  56. package/cjs/date-time-picker/parts/Pickers/Calendar/CalendarHead.js +31 -5
  57. package/cjs/date-time-picker/parts/Pickers/Calendar/Day.js +16 -10
  58. package/cjs/date-time-picker/parts/Pickers/Calendar/useConfigCalendarCTX.js +12 -12
  59. package/cjs/date-time-picker/parts/Pickers/Calendar/useFocusLogic.js +2 -38
  60. package/cjs/date-time-picker/parts/Pickers/Calendar/useKeyboardHandlers.js +40 -73
  61. package/cjs/date-time-picker/parts/Pickers/Calendar/usePopperTriggerLogic.js +18 -27
  62. package/cjs/date-time-picker/parts/Pickers/CalendarWithTimeWheel/CalendarWithTimeWheelIconTrigger.js +1 -0
  63. package/cjs/date-time-picker/parts/Pickers/CalendarWithTimeWheel/useConfigCalendarWithTimeWheelCTX.js +17 -23
  64. package/cjs/date-time-picker/parts/Pickers/TimeWheel/HoursList.js +13 -7
  65. package/cjs/date-time-picker/parts/Pickers/TimeWheel/MeridiemList.js +14 -8
  66. package/cjs/date-time-picker/parts/Pickers/TimeWheel/MinutesList.js +13 -7
  67. package/cjs/date-time-picker/parts/Pickers/TimeWheel/useKeyboardHandlers.js +36 -230
  68. package/cjs/date-time-picker/parts/Pickers/TimeWheel/usePopperTriggerLogic.js +11 -13
  69. package/cjs/date-time-picker/parts/TimeInputs/HHInput.js +8 -2
  70. package/cjs/date-time-picker/parts/TimeInputs/MeridiemInput.js +8 -2
  71. package/cjs/date-time-picker/parts/TimeInputs/MinutesInput.js +8 -2
  72. package/cjs/date-time-picker/parts/TimeInputs/TimeInputs.js +11 -6
  73. package/cjs/date-time-picker/parts/TimeInputs/useTimeInputs.js +44 -74
  74. package/cjs/date-time-picker/utils/constants.js +0 -12
  75. package/cjs/date-time-picker/utils/hooks/useGetStartingFocusedDay.js +38 -36
  76. package/cjs/index.js +16 -7
  77. package/cjs/input-group/InputGroup.js +70 -0
  78. package/cjs/input-group/InputGroupDataTestIds.js +12 -0
  79. package/cjs/input-group/exported-related/data-test-ids.js +12 -0
  80. package/cjs/input-group/exported-related/index.js +12 -0
  81. package/cjs/input-group/exported-related/theming.js +13 -0
  82. package/cjs/input-group/index.js +12 -0
  83. package/cjs/input-group/react-desc-prop-types.js +14 -0
  84. package/cjs/input-group/styled.js +47 -0
  85. package/cjs/mask-hook/hooks/index.js +0 -1
  86. package/cjs/mask-hook/hooks/usePhoneMask.js +2 -2
  87. package/cjs/mask-hook/hooks/useRegExpMask.js +0 -1
  88. package/cjs/mask-hook/index.js +0 -1
  89. package/cjs/text-input/styled/borders.js +1 -1
  90. package/esm/autocomplete/config/useAutocomplete.js +1 -3
  91. package/esm/autocomplete/parts/A11yFocusedOption.js +32 -0
  92. package/esm/autocomplete/parts/container/Container.js +39 -27
  93. package/esm/autocomplete/parts/container/styled.js +2 -2
  94. package/esm/autocomplete/parts/menu-list/MenuList.js +5 -3
  95. package/esm/autocomplete/parts/styled.js +1 -0
  96. package/esm/autocomplete/utils/listHelper.js +1 -1
  97. package/esm/checkbox/ControlledCheckbox.js +52 -36
  98. package/esm/checkbox/exported-related/data-test-ids.js +6 -0
  99. package/esm/checkbox/exported-related/index.js +2 -0
  100. package/esm/checkbox/exported-related/theming.js +8 -0
  101. package/esm/checkbox/react-desc-prop-types.js +2 -2
  102. package/esm/checkbox/styles.js +26 -15
  103. package/esm/combobox/ComboBoxCTX.js +7 -4
  104. package/esm/combobox/ComboboxDataTestids.js +1 -1
  105. package/esm/combobox/config/useComboBox.js +22 -9
  106. package/esm/combobox/index.js +2 -0
  107. package/esm/combobox/parts/A11yFocusedOption.js +15 -7
  108. package/esm/combobox/parts/A11ySelectedValues.js +0 -2
  109. package/esm/combobox/parts/DropdownIndicator.js +4 -4
  110. package/esm/combobox/parts/container/Container.js +16 -19
  111. package/esm/combobox/parts/container/styled.js +13 -6
  112. package/esm/combobox/parts/controls/Controls.js +22 -14
  113. package/esm/combobox/parts/controls/styled.js +22 -13
  114. package/esm/combobox/parts/controls/useOnPillsNavigation.js +3 -3
  115. package/esm/combobox/parts/controls-input/ControlsInput.js +3 -3
  116. package/esm/combobox/parts/controls-input/styled.js +7 -3
  117. package/esm/combobox/parts/controls-input/useControlsInput.js +5 -5
  118. package/esm/combobox/parts/controls-input/useKeyboardNavigation.js +38 -30
  119. package/esm/combobox/parts/controls-input/useMaskedOnChange.js +6 -6
  120. package/esm/combobox/parts/dropdown-indicator/DropdownIndicator.js +2 -2
  121. package/esm/combobox/parts/header-list/HeaderList.js +4 -3
  122. package/esm/combobox/parts/header-list/useHeaderListHandlers.js +11 -7
  123. package/esm/combobox/parts/menu-list/MenuList.js +10 -5
  124. package/esm/combobox/parts/menu-list/styled.js +16 -10
  125. package/esm/combobox/parts/menu-list/useItemRenderer.js +19 -17
  126. package/esm/combobox/parts/multi-selected-values-container/MultiSelectedValuesContainer.js +1 -1
  127. package/esm/combobox/parts/multi-selected-values-container/RemovableSelectedValuePill.js +2 -0
  128. package/esm/combobox/parts/multi-selected-values-container/useGroupPills.js +13 -10
  129. package/esm/combobox/react-desc-prop-types.js +3 -2
  130. package/esm/combobox/theming.js +8 -0
  131. package/esm/combobox/utils/listHelper.js +12 -2
  132. package/esm/date-time-picker/config/useChangeHandlers.js +8 -12
  133. package/esm/date-time-picker/config/useControlledDateTimePicker.js +13 -9
  134. package/esm/date-time-picker/config/useFocusTracker.js +132 -0
  135. package/esm/date-time-picker/config/useGetReferences.js +41 -20
  136. package/esm/date-time-picker/config/useGlobalKeyHandlers.js +8 -12
  137. package/esm/date-time-picker/parts/ClearButton/ClearButton.js +12 -2
  138. package/esm/date-time-picker/parts/ClearButton/useClearButton.js +12 -25
  139. package/esm/date-time-picker/parts/ControlledDateTimePickerContent.js +4 -7
  140. package/esm/date-time-picker/parts/DateInputs/DDInput.js +8 -2
  141. package/esm/date-time-picker/parts/DateInputs/DateInputs.js +9 -4
  142. package/esm/date-time-picker/parts/DateInputs/MMInput.js +8 -2
  143. package/esm/date-time-picker/parts/DateInputs/YYYYInput.js +8 -2
  144. package/esm/date-time-picker/parts/DateInputs/useDateInputs.js +77 -96
  145. package/esm/date-time-picker/parts/Pickers/Calendar/CalendarHead.js +32 -6
  146. package/esm/date-time-picker/parts/Pickers/Calendar/Day.js +16 -10
  147. package/esm/date-time-picker/parts/Pickers/Calendar/useConfigCalendarCTX.js +12 -12
  148. package/esm/date-time-picker/parts/Pickers/Calendar/useFocusLogic.js +3 -39
  149. package/esm/date-time-picker/parts/Pickers/Calendar/useKeyboardHandlers.js +40 -73
  150. package/esm/date-time-picker/parts/Pickers/Calendar/usePopperTriggerLogic.js +18 -27
  151. package/esm/date-time-picker/parts/Pickers/CalendarWithTimeWheel/CalendarWithTimeWheelIconTrigger.js +1 -0
  152. package/esm/date-time-picker/parts/Pickers/CalendarWithTimeWheel/useConfigCalendarWithTimeWheelCTX.js +17 -23
  153. package/esm/date-time-picker/parts/Pickers/TimeWheel/HoursList.js +14 -8
  154. package/esm/date-time-picker/parts/Pickers/TimeWheel/MeridiemList.js +15 -9
  155. package/esm/date-time-picker/parts/Pickers/TimeWheel/MinutesList.js +14 -8
  156. package/esm/date-time-picker/parts/Pickers/TimeWheel/useKeyboardHandlers.js +36 -230
  157. package/esm/date-time-picker/parts/Pickers/TimeWheel/usePopperTriggerLogic.js +11 -13
  158. package/esm/date-time-picker/parts/TimeInputs/HHInput.js +8 -2
  159. package/esm/date-time-picker/parts/TimeInputs/MeridiemInput.js +8 -2
  160. package/esm/date-time-picker/parts/TimeInputs/MinutesInput.js +8 -2
  161. package/esm/date-time-picker/parts/TimeInputs/TimeInputs.js +11 -6
  162. package/esm/date-time-picker/parts/TimeInputs/useTimeInputs.js +44 -74
  163. package/esm/date-time-picker/utils/constants.js +1 -7
  164. package/esm/date-time-picker/utils/hooks/useGetStartingFocusedDay.js +38 -36
  165. package/esm/index.js +5 -1
  166. package/esm/input-group/InputGroup.js +60 -0
  167. package/esm/input-group/InputGroupDataTestIds.js +8 -0
  168. package/esm/input-group/exported-related/data-test-ids.js +8 -0
  169. package/esm/input-group/exported-related/index.js +2 -0
  170. package/esm/input-group/exported-related/theming.js +8 -0
  171. package/esm/input-group/index.js +2 -0
  172. package/esm/input-group/react-desc-prop-types.js +10 -0
  173. package/esm/input-group/styled.js +36 -0
  174. package/esm/mask-hook/hooks/index.js +1 -1
  175. package/esm/mask-hook/hooks/usePhoneMask.js +2 -2
  176. package/esm/mask-hook/hooks/useRegExpMask.js +1 -1
  177. package/esm/mask-hook/index.js +1 -1
  178. package/esm/text-input/styled/borders.js +1 -1
  179. package/package.json +75 -19
  180. package/types/autocomplete/parts/A11yFocusedOption.d.ts +5 -0
  181. package/types/autocomplete/parts/container/styled.d.ts +1 -1
  182. package/types/autocomplete/parts/styled.d.ts +0 -0
  183. package/types/autocomplete/utils/listHelper.d.ts +5 -5
  184. package/types/checkbox/exported-related/data-test-ids.d.ts +4 -0
  185. package/types/checkbox/exported-related/index.d.ts +2 -0
  186. package/types/checkbox/exported-related/theming.d.ts +6 -0
  187. package/types/checkbox/react-desc-prop-types.d.ts +4 -4
  188. package/types/checkbox/styles.d.ts +6 -5
  189. package/types/combobox/ComboboxDataTestids.d.ts +1 -1
  190. package/types/combobox/index.d.ts +2 -0
  191. package/types/combobox/parts/container/styled.d.ts +1 -2
  192. package/types/combobox/parts/menu-list/styled.d.ts +1 -0
  193. package/types/combobox/react-desc-prop-types.d.ts +8 -6
  194. package/types/combobox/sharedTypes.d.ts +3 -2
  195. package/types/combobox/theming.d.ts +6 -0
  196. package/types/combobox/utils/listHelper.d.ts +1 -0
  197. package/types/date-time-picker/config/useChangeHandlers.d.ts +3 -1
  198. package/types/date-time-picker/config/useControlledDateTimePicker.d.ts +2 -5
  199. package/types/date-time-picker/config/useFocusTracker.d.ts +38 -0
  200. package/types/date-time-picker/config/useGetPropsBasedOnType.d.ts +6 -6
  201. package/types/date-time-picker/config/useGetReferences.d.ts +30 -36
  202. package/types/date-time-picker/config/useGlobalKeyHandlers.d.ts +3 -1
  203. package/types/date-time-picker/parts/DateInputs/DDInput.d.ts +2 -1
  204. package/types/date-time-picker/parts/DateInputs/MMInput.d.ts +2 -1
  205. package/types/date-time-picker/parts/DateInputs/YYYYInput.d.ts +2 -1
  206. package/types/date-time-picker/parts/Pickers/Calendar/useConfigCalendarCTX.d.ts +14 -0
  207. package/types/date-time-picker/parts/Pickers/Calendar/useFocusLogic.d.ts +1 -2
  208. package/types/date-time-picker/parts/Pickers/Calendar/usePopperTriggerLogic.d.ts +19 -0
  209. package/types/date-time-picker/parts/Pickers/TimeWheel/useKeyboardHandlers.d.ts +0 -6
  210. package/types/date-time-picker/parts/Pickers/TimeWheel/usePopperTriggerLogic.d.ts +14 -0
  211. package/types/date-time-picker/parts/TimeInputs/HHInput.d.ts +2 -1
  212. package/types/date-time-picker/parts/TimeInputs/MeridiemInput.d.ts +2 -1
  213. package/types/date-time-picker/parts/TimeInputs/MinutesInput.d.ts +2 -1
  214. package/types/date-time-picker/propTypes.d.ts +117 -0
  215. package/types/date-time-picker/sharedTypes.d.ts +1 -1
  216. package/types/date-time-picker/utils/constants.d.ts +0 -6
  217. package/types/index.d.ts +1 -0
  218. package/types/input-group/InputGroup.d.ts +5 -0
  219. package/types/input-group/InputGroupDataTestIds.d.ts +6 -0
  220. package/types/input-group/exported-related/data-test-ids.d.ts +6 -0
  221. package/types/input-group/exported-related/index.d.ts +2 -0
  222. package/types/input-group/exported-related/theming.d.ts +6 -0
  223. package/types/input-group/index.d.ts +2 -0
  224. package/types/input-group/react-desc-prop-types.d.ts +19 -0
  225. package/types/input-group/styled.d.ts +4 -0
  226. package/types/input-group/tests/DSInputGroup.test.d.ts +1 -0
  227. package/types/mask-hook/hooks/useRegExpMask.d.ts +0 -1
  228. package/types/text-input/config/useInputText.d.ts +6 -6
  229. package/cjs/combobox/parts/menu-list/useMenuListSetFocusOption.js +0 -51
  230. package/esm/combobox/parts/menu-list/useMenuListSetFocusOption.js +0 -47
  231. package/types/combobox/parts/menu-list/useMenuListSetFocusOption.d.ts +0 -1
@@ -0,0 +1,136 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ require('core-js/modules/web.dom-collections.iterator.js');
6
+ var React = require('react');
7
+
8
+ const useFocusTracker = _ref => {
9
+ let {
10
+ DOMRefs,
11
+ flags
12
+ } = _ref;
13
+ const [latestInteractionRegion, setLatestInteractionRegion] = React.useState('');
14
+ const [currFocusDescriber, setCurrFocusDescriber] = React.useState('');
15
+ const {
16
+ firstSegment,
17
+ lastSegment
18
+ } = DOMRefs;
19
+ const {
20
+ isDateSelector,
21
+ isTimeSelector
22
+ } = flags;
23
+ const trackFocusPicker = React.useCallback(() => {
24
+ let picker = 'datetime-picker-icon';
25
+ if (isDateSelector) picker = 'date-picker-icon';
26
+ if (isTimeSelector) picker = 'time-picker-icon';
27
+ if (latestInteractionRegion !== 'picker-icon') setLatestInteractionRegion('picker-icon');
28
+ if (picker !== currFocusDescriber) setCurrFocusDescriber(picker);
29
+ }, [currFocusDescriber, isDateSelector, isTimeSelector, latestInteractionRegion]);
30
+ const trackFocusFirstSegment = React.useCallback(() => {
31
+ let region = 'date-inputs';
32
+ if (firstSegment === 'hour-input') region = 'time-inputs';
33
+ if (firstSegment === 'date-picker-icon') region = 'picker-icon';
34
+ if (firstSegment === 'time-picker-icon') region = 'picker-icon';
35
+ if (firstSegment === 'datetime-picker-icon') region = 'picker-icon';
36
+ if (region !== latestInteractionRegion) setLatestInteractionRegion(region);
37
+ if (firstSegment !== currFocusDescriber) setCurrFocusDescriber(firstSegment);
38
+ }, [currFocusDescriber, firstSegment, latestInteractionRegion]);
39
+ const trackFocusLastSegment = React.useCallback(() => {
40
+ let region = 'date-inputs';
41
+ if (lastSegment === 'meridiem-input') region = 'time-inputs';
42
+ if (lastSegment === 'clear-btn') region = 'clear-btn';
43
+ if (lastSegment === 'date-picker-icon') region = 'picker-icon';
44
+ if (lastSegment === 'time-picker-icon') region = 'picker-icon';
45
+ if (lastSegment === 'datetime-picker-icon') region = 'picker-icon';
46
+ if (region !== latestInteractionRegion) setLatestInteractionRegion(region);
47
+ if (lastSegment !== currFocusDescriber) setCurrFocusDescriber(lastSegment);
48
+ }, [currFocusDescriber, lastSegment, latestInteractionRegion]);
49
+ return React.useMemo(() => ({
50
+ latestInteractionRegion,
51
+ setLatestInteractionRegion,
52
+ currFocusDescriber,
53
+ setCurrFocusDescriber,
54
+ trackFocusResetter: () => {
55
+ if (latestInteractionRegion !== '') setLatestInteractionRegion('');
56
+ if (currFocusDescriber !== '') setCurrFocusDescriber('');
57
+ },
58
+ trackFocusMonthInput: () => {
59
+ if (latestInteractionRegion !== 'date-inputs') setLatestInteractionRegion('date-inputs');
60
+ if (currFocusDescriber !== 'month-input') setCurrFocusDescriber('month-input');
61
+ },
62
+ trackFocusDayInput: () => {
63
+ if (latestInteractionRegion !== 'date-inputs') setLatestInteractionRegion('date-inputs');
64
+ if (currFocusDescriber !== 'day-input') setCurrFocusDescriber('day-input');
65
+ },
66
+ trackFocusYearInput: () => {
67
+ if (latestInteractionRegion !== 'date-inputs') setLatestInteractionRegion('date-inputs');
68
+ if (currFocusDescriber !== 'year-input') setCurrFocusDescriber('year-input');
69
+ },
70
+ trackFocusHourInput: () => {
71
+ if (latestInteractionRegion !== 'time-inputs') setLatestInteractionRegion('time-inputs');
72
+ if (currFocusDescriber !== 'hour-input') setCurrFocusDescriber('hour-input');
73
+ },
74
+ trackFocusMinuteInput: () => {
75
+ if (latestInteractionRegion !== 'time-inputs') setLatestInteractionRegion('time-inputs');
76
+ if (currFocusDescriber !== 'minute-input') setCurrFocusDescriber('minute-input');
77
+ },
78
+ trackFocusMeridiemInput: () => {
79
+ if (latestInteractionRegion !== 'time-inputs') setLatestInteractionRegion('time-inputs');
80
+ if (currFocusDescriber !== 'meridiem-input') setCurrFocusDescriber('meridiem-input');
81
+ },
82
+ trackFocusClearBtn: () => {
83
+ if (latestInteractionRegion !== 'clear-btn') setLatestInteractionRegion('clear-btn');
84
+ if (currFocusDescriber !== 'clear-btn') setCurrFocusDescriber('clear-btn');
85
+ },
86
+ trackFocusDatePickerIcon: () => {
87
+ if (latestInteractionRegion !== 'picker-icon') setLatestInteractionRegion('picker-icon');
88
+ if (currFocusDescriber !== 'date-picker-icon') setCurrFocusDescriber('date-picker-icon');
89
+ },
90
+ trackFocusTimePickerIcon: () => {
91
+ if (latestInteractionRegion !== 'picker-icon') setLatestInteractionRegion('picker-icon');
92
+ if (currFocusDescriber !== 'time-picker-icon') setCurrFocusDescriber('time-picker-icon');
93
+ },
94
+ trackFocusDatetimePickerIcon: () => {
95
+ if (latestInteractionRegion !== 'picker-icon') setLatestInteractionRegion('picker-icon');
96
+ if (currFocusDescriber !== 'datetime-picker-icon') setCurrFocusDescriber('datetime-picker-icon');
97
+ },
98
+ trackFocusCalendarPrevMonth: () => {
99
+ if (latestInteractionRegion !== 'calendar-head') setLatestInteractionRegion('calendar-head');
100
+ if (currFocusDescriber !== 'calendar-prev-month') setCurrFocusDescriber('calendar-prev-month');
101
+ },
102
+ trackFocusCalendarNextMonth: () => {
103
+ if (latestInteractionRegion !== 'calendar-head') setLatestInteractionRegion('calendar-head');
104
+ if (currFocusDescriber !== 'calendar-next-month') setCurrFocusDescriber('calendar-next-month');
105
+ },
106
+ trackFocusCalendarPrevYear: () => {
107
+ if (latestInteractionRegion !== 'calendar-head') setLatestInteractionRegion('calendar-head');
108
+ if (currFocusDescriber !== 'calendar-prev-year') setCurrFocusDescriber('calendar-prev-year');
109
+ },
110
+ trackFocusCalendarNextYear: () => {
111
+ if (latestInteractionRegion !== 'calendar-head') setLatestInteractionRegion('calendar-head');
112
+ if (currFocusDescriber !== 'calendar-next-year') setCurrFocusDescriber('calendar-next-year');
113
+ },
114
+ trackFocusCalendarMetafocusedDay: () => {
115
+ if (latestInteractionRegion !== 'calendar-days') setLatestInteractionRegion('calendar-days');
116
+ if (currFocusDescriber !== 'calendar-metafocused-day') setCurrFocusDescriber('calendar-metafocused-day');
117
+ },
118
+ trackFocusTimewheelCurrHour: () => {
119
+ if (latestInteractionRegion !== 'timewheel') setLatestInteractionRegion('timewheel');
120
+ if (currFocusDescriber !== 'timewheel-curr-hour') setCurrFocusDescriber('timewheel-curr-hour');
121
+ },
122
+ trackFocusTimewheelCurrMinute: () => {
123
+ if (latestInteractionRegion !== 'timewheel') setLatestInteractionRegion('timewheel');
124
+ if (currFocusDescriber !== 'timewheel-curr-minute') setCurrFocusDescriber('timewheel-curr-minute');
125
+ },
126
+ trackFocusTimewheelCurrMeridiem: () => {
127
+ if (latestInteractionRegion !== 'timewheel') setLatestInteractionRegion('timewheel');
128
+ if (currFocusDescriber !== 'timewheel-curr-meridiem') setCurrFocusDescriber('timewheel-curr-meridiem');
129
+ },
130
+ trackFocusPicker,
131
+ trackFocusFirstSegment,
132
+ trackFocusLastSegment
133
+ }), [currFocusDescriber, latestInteractionRegion, trackFocusPicker, trackFocusFirstSegment, trackFocusLastSegment]);
134
+ };
135
+
136
+ exports.useFocusTracker = useFocusTracker;
@@ -2,17 +2,23 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
+ require('core-js/modules/web.dom-collections.iterator.js');
5
6
  var React = require('react');
6
7
 
7
- /* eslint-disable complexity */
8
8
  const useGetReferences = _ref => {
9
9
  let {
10
10
  isWithDateInputs,
11
11
  isWithTimeInputs,
12
+ isDateSelector,
13
+ isTimeSelector,
14
+ isDateTimeSelector,
12
15
  withAnyPicker,
13
16
  withClearBtn
14
17
  } = _ref;
15
- // refs are used for "auto-advance" feature
18
+ // those 2 states are needed for focus tracking
19
+ const [firstSegment, setFirstSegment] = React.useState('');
20
+ const [lastSegment, setLastSegment] = React.useState(''); // refs are used for "auto-advance" feature
21
+
16
22
  const monthInputRef = React.useRef(null);
17
23
  const dayInputRef = React.useRef(null);
18
24
  const yearInputRef = React.useRef(null);
@@ -36,22 +42,38 @@ const useGetReferences = _ref => {
36
42
  const currMeridiemBtnRef = React.useRef(null);
37
43
  const nextMeridiemBtnRef = React.useRef(null);
38
44
  let firstSegmentRef = React.useRef(null);
39
- if (isWithDateInputs) firstSegmentRef = monthInputRef;else if (isWithTimeInputs) firstSegmentRef = hourInputRef;else if (withAnyPicker) firstSegmentRef = pickerButtonRef; // we need some non-ref to force refresh of the hooks dependencies when using firstSegmentRef
40
45
 
41
- const firstFragmentRefUpdateDeps = React.useMemo(() => ({
42
- isWithDateInputs,
43
- isWithTimeInputs,
44
- withAnyPicker
45
- }), [isWithDateInputs, isWithTimeInputs, withAnyPicker]);
46
+ if (isWithDateInputs) {
47
+ firstSegmentRef = monthInputRef;
48
+ if (firstSegment !== 'month-input') setFirstSegment('month-input');
49
+ } else if (isWithTimeInputs) {
50
+ firstSegmentRef = hourInputRef;
51
+ if (firstSegment !== 'hour-input') setFirstSegment('hour-input');
52
+ } else if (withAnyPicker) {
53
+ firstSegmentRef = pickerButtonRef;
54
+ if (isDateSelector && firstSegment !== 'date-picker-icon') setFirstSegment('date-picker-icon');
55
+ if (isTimeSelector && firstSegment !== 'time-picker-icon') setFirstSegment('time-picker-icon');
56
+ if (isDateTimeSelector && firstSegment !== 'datetime-picker-icon') setFirstSegment('datetime-picker-icon');
57
+ }
58
+
46
59
  let lastSegmentRef = React.useRef(null);
47
- if (withAnyPicker) lastSegmentRef = pickerButtonRef;else if (withClearBtn) lastSegmentRef = clearButtonRef;else if (isWithTimeInputs) lastSegmentRef = meridiemInputRef;else if (isWithDateInputs) lastSegmentRef = yearInputRef; // we need some non-ref to force refresh of the hooks dependencies when using lastSegmentRef
48
60
 
49
- const lastFragmentRefUpdateDeps = React.useMemo(() => ({
50
- withAnyPicker,
51
- withClearBtn,
52
- isWithTimeInputs,
53
- isWithDateInputs
54
- }), [isWithDateInputs, isWithTimeInputs, withAnyPicker, withClearBtn]);
61
+ if (withAnyPicker) {
62
+ lastSegmentRef = pickerButtonRef;
63
+ if (isDateSelector && lastSegment !== 'date-picker-icon') setLastSegment('date-picker-icon');
64
+ if (isTimeSelector && lastSegment !== 'time-picker-icon') setLastSegment('time-picker-icon');
65
+ if (isDateTimeSelector && lastSegment !== 'datetime-picker-icon') setLastSegment('datetime-picker-icon');
66
+ } else if (withClearBtn) {
67
+ lastSegmentRef = clearButtonRef;
68
+ if (lastSegment !== 'clear-btn') setLastSegment('clear-btn');
69
+ } else if (isWithTimeInputs) {
70
+ lastSegmentRef = meridiemInputRef;
71
+ if (lastSegment !== 'meridiem-input') setLastSegment('meridiem-input');
72
+ } else if (isWithDateInputs) {
73
+ lastSegmentRef = yearInputRef;
74
+ if (lastSegment !== 'year-input') setLastSegment('year-input');
75
+ }
76
+
55
77
  return React.useMemo(() => ({
56
78
  monthInputRef,
57
79
  dayInputRef,
@@ -77,10 +99,9 @@ const useGetReferences = _ref => {
77
99
  nextMeridiemBtnRef,
78
100
  firstSegmentRef,
79
101
  lastSegmentRef,
80
- firstFragmentRefUpdateDeps,
81
- lastFragmentRefUpdateDeps
82
- }), [firstFragmentRefUpdateDeps, lastFragmentRefUpdateDeps] // if we remove this last/first segment won't work
83
- );
102
+ firstSegment,
103
+ lastSegment
104
+ }), [firstSegment, lastSegment]);
84
105
  };
85
106
 
86
107
  exports.useGetReferences = useGetReferences;
@@ -24,8 +24,8 @@ const useGlobalKeyHandlers = _ref => {
24
24
  let {
25
25
  propsBasedOnType,
26
26
  changeHandlers,
27
- DOMRefs,
28
- flags
27
+ flags,
28
+ focusTrackers
29
29
  } = _ref;
30
30
  const {
31
31
  getIsOutOfRangeDay,
@@ -42,13 +42,13 @@ const useGlobalKeyHandlers = _ref => {
42
42
  handleChangeComposedDateTimeString,
43
43
  handleClearAll
44
44
  } = changeHandlers;
45
- const {
46
- lastSegmentRef,
47
- clearButtonRef
48
- } = DOMRefs;
49
45
  const {
50
46
  shouldPreserveClearableSpace
51
47
  } = flags;
48
+ const {
49
+ trackFocusClearBtn,
50
+ trackFocusLastSegment
51
+ } = focusTrackers;
52
52
  const onFillWithCurrentDateKeys = React.useCallback(function (e) {
53
53
  let metaInfo = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {
54
54
  isAutomaticFillTrigger: true
@@ -78,12 +78,8 @@ const useGlobalKeyHandlers = _ref => {
78
78
  appOnMinuteChange(minutes, e, metaInfo);
79
79
  appOnMeridiemChange(meridiem, e, metaInfo);
80
80
  handleChangeComposedDateTimeString(nowDateString, nowTimeString, finalMetaInfo);
81
- setTimeout(() => {
82
- var _clearButtonRef$curre, _lastSegmentRef$curre;
83
-
84
- if (shouldPreserveClearableSpace) (_clearButtonRef$curre = clearButtonRef.current) === null || _clearButtonRef$curre === void 0 ? void 0 : _clearButtonRef$curre.focus();else (_lastSegmentRef$curre = lastSegmentRef.current) === null || _lastSegmentRef$curre === void 0 ? void 0 : _lastSegmentRef$curre.focus();
85
- });
86
- }, [appOnDayChange, appOnHourChange, appOnMeridiemChange, appOnMinuteChange, appOnMonthChange, appOnYearChange, clearButtonRef, getIsDisabledDay, getIsDisabledTime, getIsOutOfRangeDay, handleChangeComposedDateTimeString, lastSegmentRef, shouldPreserveClearableSpace]);
81
+ if (shouldPreserveClearableSpace) trackFocusClearBtn();else trackFocusLastSegment();
82
+ }, [appOnDayChange, appOnHourChange, appOnMeridiemChange, appOnMinuteChange, appOnMonthChange, appOnYearChange, getIsDisabledDay, getIsDisabledTime, getIsOutOfRangeDay, handleChangeComposedDateTimeString, shouldPreserveClearableSpace, trackFocusClearBtn, trackFocusLastSegment]);
87
83
  const onGlobalKeyDown = React.useCallback(e => {
88
84
  const {
89
85
  key,
@@ -9,12 +9,13 @@ require('core-js/modules/esnext.async-iterator.for-each.js');
9
9
  require('core-js/modules/esnext.iterator.for-each.js');
10
10
  var _defineProperty = require('@babel/runtime/helpers/defineProperty');
11
11
  var _jsx = require('@babel/runtime/helpers/jsx');
12
- require('react');
12
+ var React = require('react');
13
13
  var dsIcons = require('@elliemae/ds-icons');
14
14
  var dsIcon = require('@elliemae/ds-icon');
15
15
  var DSButton = require('@elliemae/ds-button');
16
16
  var Styleds = require('../Styleds.js');
17
17
  var ControlledDateTimePickerDatatestid = require('../../ControlledDateTimePickerDatatestid.js');
18
+ var ControlledDateTimePickerCTX = require('../../ControlledDateTimePickerCTX.js');
18
19
  var useClearButton = require('./useClearButton.js');
19
20
  var jsxRuntime = require('react/jsx-runtime');
20
21
 
@@ -36,12 +37,21 @@ const ClearButton = () => {
36
37
  const styledsAttrs = {
37
38
  shouldDisplay: withClearBtn
38
39
  };
40
+ const {
41
+ latestInteractionRegion,
42
+ currFocusDescriber
43
+ } = React.useContext(ControlledDateTimePickerCTX.ControlledDateTimePickerContext);
39
44
  return /*#__PURE__*/jsxRuntime.jsx(Styleds.StyledClearButton, _objectSpread(_objectSpread({
40
45
  "aria-label": "clear selected date",
41
46
  buttonType: "icon",
42
47
  size: DSButton.BUTTON_SIZES.M,
43
48
  "data-testid": ControlledDateTimePickerDatatestid.ControlledDateTimePickerDatatestid.CLEAR_BUTTON,
44
- innerRef: clearButtonRef,
49
+ innerRef: DomElem => {
50
+ var _DomElem$focus;
51
+
52
+ clearButtonRef.current = DomElem;
53
+ if (latestInteractionRegion === 'clear-btn' && currFocusDescriber === 'clear-btn') DomElem === null || DomElem === void 0 ? void 0 : (_DomElem$focus = DomElem.focus) === null || _DomElem$focus === void 0 ? void 0 : _DomElem$focus.call(DomElem);
54
+ },
45
55
  onClick: onClearClick,
46
56
  onKeyDown: onClearButtonKeyDown
47
57
  }, styledsAttrs), {}, {
@@ -15,32 +15,21 @@ const useClearButton = () => {
15
15
  withAnyInputs,
16
16
  isWithTimeInputs,
17
17
  isWithDateInputs,
18
- isTimeSelector,
19
- hourInputRef,
20
- monthInputRef,
21
- pickerButtonRef,
22
- meridiemInputRef,
23
- yearInputRef,
24
- setLatestInteractionRegion
18
+ trackFocusFirstSegment,
19
+ trackFocusMeridiemInput,
20
+ trackFocusYearInput,
21
+ trackFocusPicker
25
22
  } = React.useContext(ControlledDateTimePickerCTX.ControlledDateTimePickerContext);
26
- const focusFirstRegion = React.useCallback(() => {
27
- var _hourInputRef$current, _hourInputRef$current2, _monthInputRef$curren, _monthInputRef$curren2;
28
-
29
- if (withAnyInputs) if (isTimeSelector) hourInputRef === null || hourInputRef === void 0 ? void 0 : (_hourInputRef$current = hourInputRef.current) === null || _hourInputRef$current === void 0 ? void 0 : (_hourInputRef$current2 = _hourInputRef$current.focus) === null || _hourInputRef$current2 === void 0 ? void 0 : _hourInputRef$current2.call(_hourInputRef$current);else monthInputRef === null || monthInputRef === void 0 ? void 0 : (_monthInputRef$curren = monthInputRef.current) === null || _monthInputRef$curren === void 0 ? void 0 : (_monthInputRef$curren2 = _monthInputRef$curren.focus) === null || _monthInputRef$curren2 === void 0 ? void 0 : _monthInputRef$curren2.call(_monthInputRef$curren);
30
- }, [withAnyInputs, isTimeSelector, hourInputRef, monthInputRef]);
31
23
  const onClearClick = React.useCallback(e => {
32
24
  handleClearAll(e);
33
- setLatestInteractionRegion('clear-btn');
34
- focusFirstRegion();
35
- }, [focusFirstRegion, handleClearAll, setLatestInteractionRegion]);
25
+ trackFocusFirstSegment();
26
+ }, [handleClearAll, trackFocusFirstSegment]);
36
27
  const onHomeKeyDown = React.useCallback(() => {
37
- focusFirstRegion();
38
- }, [focusFirstRegion]);
28
+ trackFocusFirstSegment();
29
+ }, [trackFocusFirstSegment]);
39
30
  const onEndKeyDown = React.useCallback(() => {
40
- var _pickerButtonRef$curr, _pickerButtonRef$curr2;
41
-
42
- if (withAnyPicker) pickerButtonRef === null || pickerButtonRef === void 0 ? void 0 : (_pickerButtonRef$curr = pickerButtonRef.current) === null || _pickerButtonRef$curr === void 0 ? void 0 : (_pickerButtonRef$curr2 = _pickerButtonRef$curr.focus) === null || _pickerButtonRef$curr2 === void 0 ? void 0 : _pickerButtonRef$curr2.call(_pickerButtonRef$curr);
43
- }, [withAnyPicker, pickerButtonRef]);
31
+ if (withAnyPicker) trackFocusPicker();
32
+ }, [withAnyPicker, trackFocusPicker]);
44
33
  const onClearButtonKeyDown = React.useCallback(e => {
45
34
  const {
46
35
  key
@@ -53,11 +42,9 @@ const useClearButton = () => {
53
42
  if (key === 'End') onEndKeyDown();
54
43
 
55
44
  if (key === 'Backspace' && withAnyInputs) {
56
- var _meridiemInputRef$cur, _meridiemInputRef$cur2, _yearInputRef$current, _yearInputRef$current2;
57
-
58
- 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);
45
+ if (isWithTimeInputs) trackFocusMeridiemInput();else if (isWithDateInputs) trackFocusYearInput();
59
46
  }
60
- }, [isWithDateInputs, isWithTimeInputs, meridiemInputRef, onEndKeyDown, onHomeKeyDown, withAnyInputs, yearInputRef]);
47
+ }, [isWithDateInputs, isWithTimeInputs, onEndKeyDown, onHomeKeyDown, trackFocusMeridiemInput, trackFocusYearInput, withAnyInputs]);
61
48
  return React.useMemo(() => ({
62
49
  onClearClick,
63
50
  onClearButtonKeyDown,
@@ -41,13 +41,13 @@ const ControlledDateTimePickerContent = () => {
41
41
  hideTime,
42
42
  hideTimePicker,
43
43
  hideDateTimePicker,
44
- setLatestInteractionRegion,
45
44
  withAnyPicker,
46
45
  withAnyRightController,
47
46
  shouldPreserveClearableSpace,
48
47
  isControllerOnly,
49
48
  dataAttrs,
50
- onGlobalKeyDown
49
+ onGlobalKeyDown,
50
+ trackFocusResetter
51
51
  } = React__default["default"].useContext(ControlledDateTimePickerCTX.ControlledDateTimePickerContext);
52
52
  const styledsAttrs = {
53
53
  justPicker: hideDate && hideTime,
@@ -55,9 +55,6 @@ const ControlledDateTimePickerContent = () => {
55
55
  hasError,
56
56
  isControllerOnly
57
57
  };
58
- const resetLatestInteraction = React__default["default"].useCallback(() => {
59
- setLatestInteractionRegion('');
60
- }, [setLatestInteractionRegion]);
61
58
  const mainCols = [];
62
59
  if (!hideDate) mainCols.push('auto');
63
60
  if (!hideTime) mainCols.push('auto');
@@ -70,9 +67,9 @@ const ControlledDateTimePickerContent = () => {
70
67
  cols: mainCols,
71
68
  gutter: "xxs",
72
69
  pr: hideDatePicker && hideTimePicker && hideDateTimePicker ? '2px' : undefined,
73
- onBlur: resetLatestInteraction,
74
70
  onKeyDown: onGlobalKeyDown,
75
- disabled: disabled
71
+ disabled: disabled,
72
+ onBlur: trackFocusResetter
76
73
  }, styledsAttrs), dataAttrs), {}, {
77
74
  children: [hideDate ? null : _DateInputs || (_DateInputs = /*#__PURE__*/_jsx__default["default"](DateInputs.DateInputs, {})), hideTime ? null : _TimeInputs || (_TimeInputs = /*#__PURE__*/_jsx__default["default"](TimeInputs.TimeInputs, {})), withAnyRightController ? /*#__PURE__*/_jsx__default["default"](dsGrid.Grid, {
78
75
  cols: rightControlCols
@@ -29,7 +29,8 @@ const DDInput = /*#__PURE__*/React__default["default"].memo(_ref => {
29
29
  disabled,
30
30
  contextRef,
31
31
  placeholder,
32
- ariaCurrentValueForInputs
32
+ ariaCurrentValueForInputs,
33
+ isFocused
33
34
  } = _ref;
34
35
  const validateOnChange = React.useCallback(e => {
35
36
  var _e$target;
@@ -47,7 +48,12 @@ const DDInput = /*#__PURE__*/React__default["default"].memo(_ref => {
47
48
  onFocus: onFocus,
48
49
  onKeyDown: onKeyDown,
49
50
  value: value,
50
- ref: contextRef,
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": "day input field, ".concat(ariaCurrentValueForInputs),
53
59
  "data-testid": ControlledDateTimePickerDatatestid.ControlledDateTimePickerDatatestid.DATE_INPUTS.DAY,
@@ -43,7 +43,9 @@ const DateInputs = () => {
43
43
  monthInputRef,
44
44
  dayInputRef,
45
45
  yearInputRef,
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.largeInputWidth]
@@ -57,7 +59,8 @@ const DateInputs = () => {
57
59
  autoFocusMonthInput: autoFocusMonthInput,
58
60
  placeholder: "MM",
59
61
  ariaCurrentValueForInputs: ariaCurrentValueForInputs,
60
- disabled: disabled
62
+ disabled: disabled,
63
+ isFocused: latestInteractionRegion === 'date-inputs' && currFocusDescriber === 'month-input'
61
64
  })), _StyledSeparator || (_StyledSeparator = /*#__PURE__*/_jsx__default["default"](Styleds.StyledSeparator, {
62
65
  alignItems: "center"
63
66
  }, void 0, "/")), /*#__PURE__*/_jsx__default["default"](Styleds.StyledFocusWithIn, {}, void 0, /*#__PURE__*/_jsx__default["default"](DDInput.DDInput, {
@@ -69,7 +72,8 @@ const DateInputs = () => {
69
72
  contextRef: dayInputRef,
70
73
  placeholder: "DD",
71
74
  ariaCurrentValueForInputs: ariaCurrentValueForInputs,
72
- disabled: disabled
75
+ disabled: disabled,
76
+ isFocused: latestInteractionRegion === 'date-inputs' && currFocusDescriber === 'day-input'
73
77
  })), _StyledSeparator2 || (_StyledSeparator2 = /*#__PURE__*/_jsx__default["default"](Styleds.StyledSeparator, {
74
78
  alignItems: "center"
75
79
  }, void 0, "/")), /*#__PURE__*/_jsx__default["default"](Styleds.StyledFocusWithIn, {}, void 0, /*#__PURE__*/_jsx__default["default"](YYYYInput.YYYYInput, {
@@ -81,7 +85,8 @@ const DateInputs = () => {
81
85
  contextRef: yearInputRef,
82
86
  placeholder: "YYYY",
83
87
  ariaCurrentValueForInputs: ariaCurrentValueForInputs,
84
- disabled: disabled
88
+ disabled: disabled,
89
+ isFocused: latestInteractionRegion === 'date-inputs' && currFocusDescriber === 'year-input'
85
90
  })));
86
91
  };
87
92
 
@@ -30,7 +30,8 @@ const MMInput = /*#__PURE__*/React__default["default"].memo(_ref => {
30
30
  placeholder,
31
31
  contextRef,
32
32
  autoFocusMonthInput,
33
- ariaCurrentValueForInputs
33
+ ariaCurrentValueForInputs,
34
+ isFocused
34
35
  } = _ref;
35
36
  const validateOnChange = React.useCallback(e => {
36
37
  var _e$target;
@@ -49,7 +50,12 @@ const MMInput = /*#__PURE__*/React__default["default"].memo(_ref => {
49
50
  onFocus: onFocus,
50
51
  onKeyDown: onKeyDown,
51
52
  value: value,
52
- ref: contextRef,
53
+ ref: DomElem => {
54
+ var _DomElem$focus;
55
+
56
+ contextRef.current = DomElem;
57
+ if (isFocused) DomElem === null || DomElem === void 0 ? void 0 : (_DomElem$focus = DomElem.focus) === null || _DomElem$focus === void 0 ? void 0 : _DomElem$focus.call(DomElem);
58
+ },
53
59
  placeholder: placeholder,
54
60
  "aria-label": "month input field, ".concat(ariaCurrentValueForInputs),
55
61
  "data-testid": ControlledDateTimePickerDatatestid.ControlledDateTimePickerDatatestid.DATE_INPUTS.MONTH,
@@ -29,7 +29,8 @@ const YYYYInput = /*#__PURE__*/React__default["default"].memo(_ref => {
29
29
  disabled,
30
30
  placeholder,
31
31
  contextRef,
32
- ariaCurrentValueForInputs
32
+ ariaCurrentValueForInputs,
33
+ isFocused
33
34
  } = _ref;
34
35
  const validateOnChange = React.useCallback(e => {
35
36
  var _e$target;
@@ -47,7 +48,12 @@ const YYYYInput = /*#__PURE__*/React__default["default"].memo(_ref => {
47
48
  onFocus: onFocus,
48
49
  onKeyDown: onKeyDown,
49
50
  value: value,
50
- ref: contextRef,
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": "year input field, ".concat(ariaCurrentValueForInputs),
53
59
  "data-testid": ControlledDateTimePickerDatatestid.ControlledDateTimePickerDatatestid.DATE_INPUTS.YEAR,