@elliemae/ds-controlled-form 2.4.2-rc.1 → 2.4.2-rc.13

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 (272) hide show
  1. package/cjs/autocomplete/config/useAutocomplete.js +0 -1
  2. package/cjs/autocomplete/parts/A11yFocusedOption.js +46 -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/container/useKeyboardNavigation.js +2 -2
  6. package/cjs/autocomplete/parts/menu-list/MenuList.js +6 -6
  7. package/cjs/autocomplete/parts/menu-list/styled.js +2 -2
  8. package/cjs/autocomplete/parts/menu-list/useItemRenderer.js +1 -1
  9. package/cjs/autocomplete/parts/styled.js +2 -0
  10. package/cjs/autocomplete/utils/listHelper.js +1 -1
  11. package/cjs/checkbox/ControlledCheckbox.js +1 -1
  12. package/cjs/checkbox/config/useValidateProps.js +6 -3
  13. package/cjs/checkbox/react-desc-prop-types.js +2 -1
  14. package/cjs/checkbox/styles.js +73 -27
  15. package/cjs/checkbox/utils/styleHelpers.js +20 -2
  16. package/cjs/combobox/ComboBoxCTX.js +6 -3
  17. package/cjs/combobox/config/useComboBox.js +16 -6
  18. package/cjs/combobox/config/useCorrectOptions.js +1 -2
  19. package/cjs/combobox/parts/A11yFocusedOption.js +14 -6
  20. package/cjs/combobox/parts/A11ySelectedValues.js +2 -4
  21. package/cjs/combobox/parts/DropdownIndicator.js +15 -7
  22. package/cjs/combobox/parts/container/Container.js +11 -14
  23. package/cjs/combobox/parts/container/styled.js +11 -10
  24. package/cjs/combobox/parts/controls/Controls.js +19 -27
  25. package/cjs/combobox/parts/controls/styled.js +54 -22
  26. package/cjs/combobox/parts/controls/useOnPillsNavigation.js +7 -15
  27. package/cjs/combobox/parts/controls-input/ControlsInput.js +2 -2
  28. package/cjs/combobox/parts/controls-input/styled.js +41 -11
  29. package/cjs/combobox/parts/controls-input/useControlsInput.js +4 -7
  30. package/cjs/combobox/parts/controls-input/useKeyboardNavigation.js +19 -28
  31. package/cjs/combobox/parts/controls-input/useMaskedOnChange.js +7 -7
  32. package/cjs/combobox/parts/dropdown-indicator/DropdownIndicator.js +2 -2
  33. package/cjs/combobox/parts/header-list/HeaderList.js +1 -1
  34. package/cjs/combobox/parts/header-list/styled.js +39 -10
  35. package/cjs/combobox/parts/header-list/useHeaderListHandlers.js +7 -14
  36. package/cjs/combobox/parts/menu-list/MenuList.js +8 -6
  37. package/cjs/combobox/parts/menu-list/styled.js +38 -20
  38. package/cjs/combobox/parts/menu-list/useItemRenderer.js +18 -17
  39. package/cjs/combobox/parts/multi-selected-values-container/MultiSelectedValuesContainer.js +1 -1
  40. package/cjs/combobox/parts/multi-selected-values-container/RemovableSelectedValuePill.js +1 -3
  41. package/cjs/combobox/parts/multi-selected-values-container/useGroupPills.js +1 -2
  42. package/cjs/combobox/parts/styled.js +6 -7
  43. package/cjs/combobox/react-desc-prop-types.js +3 -2
  44. package/cjs/combobox/sharedTypes.js +2 -2
  45. package/cjs/combobox/utils/listHelper.js +14 -9
  46. package/cjs/date-range-picker/config/useRangePickerLogic.js +4 -8
  47. package/cjs/date-range-picker/parts/ControlledDateRangeCalendar.js +0 -2
  48. package/cjs/date-range-picker/parts/ControlledDateRangeFromDate.js +0 -2
  49. package/cjs/date-range-picker/parts/ControlledDateRangeToDate.js +0 -2
  50. package/cjs/date-time-picker/config/useChangeHandlers.js +11 -15
  51. package/cjs/date-time-picker/config/useControlledDateTimePicker.js +14 -10
  52. package/cjs/date-time-picker/config/useFocusTracker.js +136 -0
  53. package/cjs/date-time-picker/config/useGetDestructuredValues.js +6 -6
  54. package/cjs/date-time-picker/config/useGetPropsBasedOnType.js +1 -1
  55. package/cjs/date-time-picker/config/useGetReferences.js +39 -18
  56. package/cjs/date-time-picker/config/useGlobalKeyHandlers.js +8 -12
  57. package/cjs/date-time-picker/config/useRelevantValueFromProps.js +1 -1
  58. package/cjs/date-time-picker/config/useValidateProps.js +42 -11
  59. package/cjs/date-time-picker/parts/ClearButton/ClearButton.js +10 -2
  60. package/cjs/date-time-picker/parts/ClearButton/useClearButton.js +12 -25
  61. package/cjs/date-time-picker/parts/ControlledDateTimePickerContent.js +4 -7
  62. package/cjs/date-time-picker/parts/DateInputs/DDInput.js +8 -6
  63. package/cjs/date-time-picker/parts/DateInputs/DateInputs.js +9 -4
  64. package/cjs/date-time-picker/parts/DateInputs/MMInput.js +8 -6
  65. package/cjs/date-time-picker/parts/DateInputs/YYYYInput.js +8 -6
  66. package/cjs/date-time-picker/parts/DateInputs/useDateInputs.js +84 -113
  67. package/cjs/date-time-picker/parts/Pickers/Calendar/CalendarDaysList.js +4 -4
  68. package/cjs/date-time-picker/parts/Pickers/Calendar/CalendarHead.js +25 -7
  69. package/cjs/date-time-picker/parts/Pickers/Calendar/CalendarIconTrigger.js +1 -1
  70. package/cjs/date-time-picker/parts/Pickers/Calendar/Day.js +21 -17
  71. package/cjs/date-time-picker/parts/Pickers/Calendar/Styleds.js +44 -15
  72. package/cjs/date-time-picker/parts/Pickers/Calendar/useConfigCalendarCTX.js +13 -14
  73. package/cjs/date-time-picker/parts/Pickers/Calendar/useCurrentDisplayedMonthYearLogic.js +2 -1
  74. package/cjs/date-time-picker/parts/Pickers/Calendar/useFocusLogic.js +2 -39
  75. package/cjs/date-time-picker/parts/Pickers/Calendar/useKeyboardHandlers.js +40 -73
  76. package/cjs/date-time-picker/parts/Pickers/Calendar/usePopperTriggerLogic.js +18 -29
  77. package/cjs/date-time-picker/parts/Pickers/CalendarWithTimeWheel/CalendarWithTimeWheelIconTrigger.js +2 -1
  78. package/cjs/date-time-picker/parts/Pickers/CalendarWithTimeWheel/useConfigCalendarWithTimeWheelCTX.js +19 -27
  79. package/cjs/date-time-picker/parts/Pickers/TimeWheel/HoursList.js +15 -11
  80. package/cjs/date-time-picker/parts/Pickers/TimeWheel/MeridiemList.js +17 -13
  81. package/cjs/date-time-picker/parts/Pickers/TimeWheel/MinutesList.js +15 -11
  82. package/cjs/date-time-picker/parts/Pickers/TimeWheel/SecondsList.js +2 -2
  83. package/cjs/date-time-picker/parts/Pickers/TimeWheel/Styleds.js +47 -15
  84. package/cjs/date-time-picker/parts/Pickers/TimeWheel/TimeWheelContent.js +1 -1
  85. package/cjs/date-time-picker/parts/Pickers/TimeWheel/TimeWheelIconTrigger.js +1 -1
  86. package/cjs/date-time-picker/parts/Pickers/TimeWheel/useCurrentDisplayedWheelsLogic.js +3 -3
  87. package/cjs/date-time-picker/parts/Pickers/TimeWheel/useKeyboardHandlers.js +36 -230
  88. package/cjs/date-time-picker/parts/Pickers/TimeWheel/usePopperTriggerLogic.js +12 -17
  89. package/cjs/date-time-picker/parts/Styleds.js +12 -6
  90. package/cjs/date-time-picker/parts/TimeInputs/HHInput.js +7 -3
  91. package/cjs/date-time-picker/parts/TimeInputs/MeridiemInput.js +8 -7
  92. package/cjs/date-time-picker/parts/TimeInputs/MinutesInput.js +8 -6
  93. package/cjs/date-time-picker/parts/TimeInputs/TimeInputs.js +11 -6
  94. package/cjs/date-time-picker/parts/TimeInputs/useTimeInputs.js +55 -97
  95. package/cjs/date-time-picker/utils/constants.js +0 -12
  96. package/cjs/date-time-picker/utils/dateHelpers.js +17 -34
  97. package/cjs/date-time-picker/utils/hooks/useGetStartingFocusedDay.js +38 -36
  98. package/cjs/date-time-picker/utils/hooks/useOnClickOutside.js +1 -3
  99. package/cjs/date-time-picker/utils/stringHelpers.js +5 -11
  100. package/cjs/input-group/InputGroup.js +8 -7
  101. package/cjs/input-group/exported-related/data-test-ids.js +12 -0
  102. package/cjs/input-group/exported-related/index.js +12 -0
  103. package/cjs/input-group/exported-related/theming.js +13 -0
  104. package/cjs/input-group/styled.js +90 -23
  105. package/cjs/large-text-input/DSControlledLargeTextInput.js +1 -1
  106. package/cjs/large-text-input/styles.js +27 -13
  107. package/cjs/mask-hook/hooks/useNumberMask.js +1 -5
  108. package/cjs/mask-hook/hooks/usePhoneMask.js +1 -4
  109. package/cjs/mask-hook/hooks/useRegExpMask.js +4 -7
  110. package/cjs/mask-hook/hooks/useSSNMask.js +1 -4
  111. package/cjs/mask-hook/hooks/useZipCodeMask.js +1 -4
  112. package/cjs/mask-hook/utils/addSpecialCharacters.js +0 -1
  113. package/cjs/mask-hook/utils/flatStringArray.js +0 -1
  114. package/cjs/text-input/config/useInputText.js +0 -1
  115. package/cjs/text-input/styled/borders.js +18 -11
  116. package/cjs/text-input/styled/components.js +49 -10
  117. package/cjs/toggle/ControlledToggle.js +2 -3
  118. package/cjs/toggle/styles.js +7 -5
  119. package/esm/autocomplete/config/useAutocomplete.js +0 -1
  120. package/esm/autocomplete/parts/A11yFocusedOption.js +36 -0
  121. package/esm/autocomplete/parts/container/Container.js +39 -27
  122. package/esm/autocomplete/parts/container/styled.js +2 -2
  123. package/esm/autocomplete/parts/container/useKeyboardNavigation.js +2 -2
  124. package/esm/autocomplete/parts/menu-list/MenuList.js +7 -7
  125. package/esm/autocomplete/parts/menu-list/styled.js +2 -2
  126. package/esm/autocomplete/parts/menu-list/useItemRenderer.js +1 -1
  127. package/esm/autocomplete/parts/styled.js +1 -0
  128. package/esm/autocomplete/utils/listHelper.js +1 -1
  129. package/esm/checkbox/ControlledCheckbox.js +2 -2
  130. package/esm/checkbox/config/useValidateProps.js +6 -3
  131. package/esm/checkbox/react-desc-prop-types.js +2 -1
  132. package/esm/checkbox/styles.js +73 -24
  133. package/esm/checkbox/utils/styleHelpers.js +20 -2
  134. package/esm/combobox/ComboBoxCTX.js +6 -3
  135. package/esm/combobox/config/useComboBox.js +16 -6
  136. package/esm/combobox/config/useCorrectOptions.js +1 -2
  137. package/esm/combobox/parts/A11yFocusedOption.js +15 -7
  138. package/esm/combobox/parts/A11ySelectedValues.js +2 -4
  139. package/esm/combobox/parts/DropdownIndicator.js +15 -6
  140. package/esm/combobox/parts/container/Container.js +11 -14
  141. package/esm/combobox/parts/container/styled.js +11 -6
  142. package/esm/combobox/parts/controls/Controls.js +19 -27
  143. package/esm/combobox/parts/controls/styled.js +54 -18
  144. package/esm/combobox/parts/controls/useOnPillsNavigation.js +7 -15
  145. package/esm/combobox/parts/controls-input/ControlsInput.js +2 -2
  146. package/esm/combobox/parts/controls-input/styled.js +41 -7
  147. package/esm/combobox/parts/controls-input/useControlsInput.js +4 -7
  148. package/esm/combobox/parts/controls-input/useKeyboardNavigation.js +20 -29
  149. package/esm/combobox/parts/controls-input/useMaskedOnChange.js +7 -7
  150. package/esm/combobox/parts/dropdown-indicator/DropdownIndicator.js +2 -2
  151. package/esm/combobox/parts/header-list/HeaderList.js +1 -1
  152. package/esm/combobox/parts/header-list/styled.js +40 -7
  153. package/esm/combobox/parts/header-list/useHeaderListHandlers.js +7 -14
  154. package/esm/combobox/parts/menu-list/MenuList.js +8 -6
  155. package/esm/combobox/parts/menu-list/styled.js +38 -17
  156. package/esm/combobox/parts/menu-list/useItemRenderer.js +20 -19
  157. package/esm/combobox/parts/multi-selected-values-container/MultiSelectedValuesContainer.js +1 -1
  158. package/esm/combobox/parts/multi-selected-values-container/RemovableSelectedValuePill.js +1 -3
  159. package/esm/combobox/parts/multi-selected-values-container/useGroupPills.js +1 -2
  160. package/esm/combobox/parts/styled.js +6 -3
  161. package/esm/combobox/react-desc-prop-types.js +3 -2
  162. package/esm/combobox/sharedTypes.js +2 -2
  163. package/esm/combobox/utils/listHelper.js +14 -10
  164. package/esm/date-range-picker/config/useRangePickerLogic.js +3 -7
  165. package/esm/date-range-picker/parts/ControlledDateRangeCalendar.js +0 -2
  166. package/esm/date-range-picker/parts/ControlledDateRangeFromDate.js +0 -2
  167. package/esm/date-range-picker/parts/ControlledDateRangeToDate.js +0 -2
  168. package/esm/date-time-picker/config/useChangeHandlers.js +11 -15
  169. package/esm/date-time-picker/config/useControlledDateTimePicker.js +14 -10
  170. package/esm/date-time-picker/config/useFocusTracker.js +132 -0
  171. package/esm/date-time-picker/config/useGetDestructuredValues.js +6 -6
  172. package/esm/date-time-picker/config/useGetPropsBasedOnType.js +1 -1
  173. package/esm/date-time-picker/config/useGetReferences.js +40 -19
  174. package/esm/date-time-picker/config/useGlobalKeyHandlers.js +8 -12
  175. package/esm/date-time-picker/config/useRelevantValueFromProps.js +1 -1
  176. package/esm/date-time-picker/config/useValidateProps.js +42 -11
  177. package/esm/date-time-picker/parts/ClearButton/ClearButton.js +10 -2
  178. package/esm/date-time-picker/parts/ClearButton/useClearButton.js +12 -25
  179. package/esm/date-time-picker/parts/ControlledDateTimePickerContent.js +4 -7
  180. package/esm/date-time-picker/parts/DateInputs/DDInput.js +8 -6
  181. package/esm/date-time-picker/parts/DateInputs/DateInputs.js +9 -4
  182. package/esm/date-time-picker/parts/DateInputs/MMInput.js +8 -6
  183. package/esm/date-time-picker/parts/DateInputs/YYYYInput.js +8 -6
  184. package/esm/date-time-picker/parts/DateInputs/useDateInputs.js +85 -114
  185. package/esm/date-time-picker/parts/Pickers/Calendar/CalendarDaysList.js +4 -4
  186. package/esm/date-time-picker/parts/Pickers/Calendar/CalendarHead.js +26 -8
  187. package/esm/date-time-picker/parts/Pickers/Calendar/CalendarIconTrigger.js +1 -1
  188. package/esm/date-time-picker/parts/Pickers/Calendar/Day.js +21 -17
  189. package/esm/date-time-picker/parts/Pickers/Calendar/Styleds.js +44 -14
  190. package/esm/date-time-picker/parts/Pickers/Calendar/useConfigCalendarCTX.js +12 -13
  191. package/esm/date-time-picker/parts/Pickers/Calendar/useCurrentDisplayedMonthYearLogic.js +2 -1
  192. package/esm/date-time-picker/parts/Pickers/Calendar/useFocusLogic.js +3 -40
  193. package/esm/date-time-picker/parts/Pickers/Calendar/useKeyboardHandlers.js +40 -73
  194. package/esm/date-time-picker/parts/Pickers/Calendar/usePopperTriggerLogic.js +18 -29
  195. package/esm/date-time-picker/parts/Pickers/CalendarWithTimeWheel/CalendarWithTimeWheelIconTrigger.js +2 -1
  196. package/esm/date-time-picker/parts/Pickers/CalendarWithTimeWheel/useConfigCalendarWithTimeWheelCTX.js +19 -27
  197. package/esm/date-time-picker/parts/Pickers/TimeWheel/HoursList.js +16 -12
  198. package/esm/date-time-picker/parts/Pickers/TimeWheel/MeridiemList.js +18 -14
  199. package/esm/date-time-picker/parts/Pickers/TimeWheel/MinutesList.js +16 -12
  200. package/esm/date-time-picker/parts/Pickers/TimeWheel/SecondsList.js +2 -2
  201. package/esm/date-time-picker/parts/Pickers/TimeWheel/Styleds.js +47 -14
  202. package/esm/date-time-picker/parts/Pickers/TimeWheel/TimeWheelContent.js +1 -1
  203. package/esm/date-time-picker/parts/Pickers/TimeWheel/TimeWheelIconTrigger.js +1 -1
  204. package/esm/date-time-picker/parts/Pickers/TimeWheel/useCurrentDisplayedWheelsLogic.js +3 -3
  205. package/esm/date-time-picker/parts/Pickers/TimeWheel/useKeyboardHandlers.js +36 -230
  206. package/esm/date-time-picker/parts/Pickers/TimeWheel/usePopperTriggerLogic.js +12 -17
  207. package/esm/date-time-picker/parts/Styleds.js +12 -6
  208. package/esm/date-time-picker/parts/TimeInputs/HHInput.js +7 -3
  209. package/esm/date-time-picker/parts/TimeInputs/MeridiemInput.js +8 -7
  210. package/esm/date-time-picker/parts/TimeInputs/MinutesInput.js +8 -6
  211. package/esm/date-time-picker/parts/TimeInputs/TimeInputs.js +11 -6
  212. package/esm/date-time-picker/parts/TimeInputs/useTimeInputs.js +55 -97
  213. package/esm/date-time-picker/utils/constants.js +1 -7
  214. package/esm/date-time-picker/utils/dateHelpers.js +17 -34
  215. package/esm/date-time-picker/utils/hooks/useGetStartingFocusedDay.js +38 -36
  216. package/esm/date-time-picker/utils/hooks/useOnClickOutside.js +1 -3
  217. package/esm/date-time-picker/utils/stringHelpers.js +5 -11
  218. package/esm/input-group/InputGroup.js +5 -4
  219. package/esm/input-group/exported-related/data-test-ids.js +8 -0
  220. package/esm/input-group/exported-related/index.js +2 -0
  221. package/esm/input-group/exported-related/theming.js +8 -0
  222. package/esm/input-group/styled.js +89 -18
  223. package/esm/large-text-input/DSControlledLargeTextInput.js +1 -1
  224. package/esm/large-text-input/styles.js +27 -9
  225. package/esm/mask-hook/hooks/useNumberMask.js +1 -5
  226. package/esm/mask-hook/hooks/usePhoneMask.js +1 -4
  227. package/esm/mask-hook/hooks/useRegExpMask.js +4 -7
  228. package/esm/mask-hook/hooks/useSSNMask.js +1 -4
  229. package/esm/mask-hook/hooks/useZipCodeMask.js +1 -4
  230. package/esm/mask-hook/utils/addSpecialCharacters.js +0 -1
  231. package/esm/mask-hook/utils/flatStringArray.js +0 -1
  232. package/esm/text-input/config/useInputText.js +0 -1
  233. package/esm/text-input/styled/borders.js +18 -7
  234. package/esm/text-input/styled/components.js +49 -6
  235. package/esm/toggle/ControlledToggle.js +0 -1
  236. package/esm/toggle/styles.js +7 -5
  237. package/package.json +39 -15
  238. package/types/autocomplete/parts/A11yFocusedOption.d.ts +5 -0
  239. package/types/autocomplete/parts/container/styled.d.ts +1 -1
  240. package/types/autocomplete/parts/styled.d.ts +0 -0
  241. package/types/autocomplete/utils/listHelper.d.ts +5 -5
  242. package/types/checkbox/react-desc-prop-types.d.ts +1 -1
  243. package/types/checkbox/styles.d.ts +1 -0
  244. package/types/combobox/parts/menu-list/styled.d.ts +1 -0
  245. package/types/combobox/react-desc-prop-types.d.ts +8 -6
  246. package/types/combobox/sharedTypes.d.ts +3 -2
  247. package/types/combobox/utils/listHelper.d.ts +1 -0
  248. package/types/date-time-picker/config/useChangeHandlers.d.ts +3 -1
  249. package/types/date-time-picker/config/useControlledDateTimePicker.d.ts +2 -5
  250. package/types/date-time-picker/config/useFocusTracker.d.ts +38 -0
  251. package/types/date-time-picker/config/useGetPropsBasedOnType.d.ts +6 -6
  252. package/types/date-time-picker/config/useGetReferences.d.ts +30 -36
  253. package/types/date-time-picker/config/useGlobalKeyHandlers.d.ts +3 -1
  254. package/types/date-time-picker/parts/DateInputs/DDInput.d.ts +2 -1
  255. package/types/date-time-picker/parts/DateInputs/MMInput.d.ts +2 -1
  256. package/types/date-time-picker/parts/DateInputs/YYYYInput.d.ts +2 -1
  257. package/types/date-time-picker/parts/Pickers/Calendar/useConfigCalendarCTX.d.ts +14 -0
  258. package/types/date-time-picker/parts/Pickers/Calendar/useFocusLogic.d.ts +1 -2
  259. package/types/date-time-picker/parts/Pickers/Calendar/usePopperTriggerLogic.d.ts +19 -0
  260. package/types/date-time-picker/parts/Pickers/TimeWheel/useKeyboardHandlers.d.ts +0 -6
  261. package/types/date-time-picker/parts/Pickers/TimeWheel/usePopperTriggerLogic.d.ts +14 -0
  262. package/types/date-time-picker/parts/TimeInputs/HHInput.d.ts +2 -1
  263. package/types/date-time-picker/parts/TimeInputs/MeridiemInput.d.ts +2 -1
  264. package/types/date-time-picker/parts/TimeInputs/MinutesInput.d.ts +2 -1
  265. package/types/date-time-picker/propTypes.d.ts +117 -0
  266. package/types/date-time-picker/sharedTypes.d.ts +1 -1
  267. package/types/date-time-picker/utils/constants.d.ts +0 -6
  268. package/types/input-group/exported-related/data-test-ids.d.ts +6 -0
  269. package/types/input-group/exported-related/index.d.ts +2 -0
  270. package/types/input-group/exported-related/theming.d.ts +6 -0
  271. package/types/input-group/styled.d.ts +4 -7
  272. package/types/text-input/config/useInputText.d.ts +4 -4
@@ -31,13 +31,13 @@ const ControlledDateTimePickerContent = () => {
31
31
  hideTime,
32
32
  hideTimePicker,
33
33
  hideDateTimePicker,
34
- setLatestInteractionRegion,
35
34
  withAnyPicker,
36
35
  withAnyRightController,
37
36
  shouldPreserveClearableSpace,
38
37
  isControllerOnly,
39
38
  dataAttrs,
40
- onGlobalKeyDown
39
+ onGlobalKeyDown,
40
+ trackFocusResetter
41
41
  } = React.useContext(ControlledDateTimePickerContext);
42
42
  const styledsAttrs = {
43
43
  justPicker: hideDate && hideTime,
@@ -45,9 +45,6 @@ const ControlledDateTimePickerContent = () => {
45
45
  hasError,
46
46
  isControllerOnly
47
47
  };
48
- const resetLatestInteraction = React.useCallback(() => {
49
- setLatestInteractionRegion('');
50
- }, [setLatestInteractionRegion]);
51
48
  const mainCols = [];
52
49
  if (!hideDate) mainCols.push('auto');
53
50
  if (!hideTime) mainCols.push('auto');
@@ -60,9 +57,9 @@ const ControlledDateTimePickerContent = () => {
60
57
  cols: mainCols,
61
58
  gutter: "xxs",
62
59
  pr: hideDatePicker && hideTimePicker && hideDateTimePicker ? '2px' : undefined,
63
- onBlur: resetLatestInteraction,
64
60
  onKeyDown: onGlobalKeyDown,
65
- disabled: disabled
61
+ disabled: disabled,
62
+ onBlur: trackFocusResetter
66
63
  }, styledsAttrs), dataAttrs), {}, {
67
64
  children: [hideDate ? null : _DateInputs || (_DateInputs = /*#__PURE__*/_jsx(DateInputs, {})), hideTime ? null : _TimeInputs || (_TimeInputs = /*#__PURE__*/_jsx(TimeInputs, {})), withAnyRightController ? /*#__PURE__*/_jsx(Grid, {
68
65
  cols: rightControlCols
@@ -21,12 +21,11 @@ const DDInput = /*#__PURE__*/React.memo(_ref => {
21
21
  disabled,
22
22
  contextRef,
23
23
  placeholder,
24
- ariaCurrentValueForInputs
24
+ ariaCurrentValueForInputs,
25
+ isFocused
25
26
  } = _ref;
26
27
  const validateOnChange = useCallback(e => {
27
- var _e$target;
28
-
29
- if (isInvalidDay(e === null || e === void 0 ? void 0 : (_e$target = e.target) === null || _e$target === void 0 ? void 0 : _e$target.value)) {
28
+ if (isInvalidDay(e?.target?.value)) {
30
29
  e.preventDefault();
31
30
  return;
32
31
  }
@@ -39,9 +38,12 @@ const DDInput = /*#__PURE__*/React.memo(_ref => {
39
38
  onFocus: onFocus,
40
39
  onKeyDown: onKeyDown,
41
40
  value: value,
42
- ref: contextRef,
41
+ ref: DomElem => {
42
+ contextRef.current = DomElem;
43
+ if (isFocused) DomElem?.focus?.();
44
+ },
43
45
  placeholder: placeholder,
44
- "aria-label": "day input field, ".concat(ariaCurrentValueForInputs),
46
+ "aria-label": `day input field, ${ariaCurrentValueForInputs}`,
45
47
  "data-testid": ControlledDateTimePickerDatatestid.DATE_INPUTS.DAY,
46
48
  disabled: disabled,
47
49
  "aria-disabled": disabled
@@ -35,7 +35,9 @@ const DateInputs = () => {
35
35
  monthInputRef,
36
36
  dayInputRef,
37
37
  yearInputRef,
38
- ariaCurrentValueForInputs
38
+ ariaCurrentValueForInputs,
39
+ latestInteractionRegion,
40
+ currFocusDescriber
39
41
  } = useContext(ControlledDateTimePickerContext);
40
42
  return /*#__PURE__*/_jsx(Grid, {
41
43
  cols: [fixedValues.smallInputWidth, fixedValues.separatorWidth, fixedValues.smallInputWidth, fixedValues.separatorWidth, fixedValues.largeInputWidth]
@@ -49,7 +51,8 @@ const DateInputs = () => {
49
51
  autoFocusMonthInput: autoFocusMonthInput,
50
52
  placeholder: "MM",
51
53
  ariaCurrentValueForInputs: ariaCurrentValueForInputs,
52
- disabled: disabled
54
+ disabled: disabled,
55
+ isFocused: latestInteractionRegion === 'date-inputs' && currFocusDescriber === 'month-input'
53
56
  })), _StyledSeparator || (_StyledSeparator = /*#__PURE__*/_jsx(StyledSeparator, {
54
57
  alignItems: "center"
55
58
  }, void 0, "/")), /*#__PURE__*/_jsx(StyledFocusWithIn, {}, void 0, /*#__PURE__*/_jsx(DDInput, {
@@ -61,7 +64,8 @@ const DateInputs = () => {
61
64
  contextRef: dayInputRef,
62
65
  placeholder: "DD",
63
66
  ariaCurrentValueForInputs: ariaCurrentValueForInputs,
64
- disabled: disabled
67
+ disabled: disabled,
68
+ isFocused: latestInteractionRegion === 'date-inputs' && currFocusDescriber === 'day-input'
65
69
  })), _StyledSeparator2 || (_StyledSeparator2 = /*#__PURE__*/_jsx(StyledSeparator, {
66
70
  alignItems: "center"
67
71
  }, void 0, "/")), /*#__PURE__*/_jsx(StyledFocusWithIn, {}, void 0, /*#__PURE__*/_jsx(YYYYInput, {
@@ -73,7 +77,8 @@ const DateInputs = () => {
73
77
  contextRef: yearInputRef,
74
78
  placeholder: "YYYY",
75
79
  ariaCurrentValueForInputs: ariaCurrentValueForInputs,
76
- disabled: disabled
80
+ disabled: disabled,
81
+ isFocused: latestInteractionRegion === 'date-inputs' && currFocusDescriber === 'year-input'
77
82
  })));
78
83
  };
79
84
 
@@ -22,12 +22,11 @@ const MMInput = /*#__PURE__*/React.memo(_ref => {
22
22
  placeholder,
23
23
  contextRef,
24
24
  autoFocusMonthInput,
25
- ariaCurrentValueForInputs
25
+ ariaCurrentValueForInputs,
26
+ isFocused
26
27
  } = _ref;
27
28
  const validateOnChange = useCallback(e => {
28
- var _e$target;
29
-
30
- if (isInvalidMonth(e === null || e === void 0 ? void 0 : (_e$target = e.target) === null || _e$target === void 0 ? void 0 : _e$target.value)) {
29
+ if (isInvalidMonth(e?.target?.value)) {
31
30
  e.preventDefault();
32
31
  return;
33
32
  }
@@ -41,9 +40,12 @@ const MMInput = /*#__PURE__*/React.memo(_ref => {
41
40
  onFocus: onFocus,
42
41
  onKeyDown: onKeyDown,
43
42
  value: value,
44
- ref: contextRef,
43
+ ref: DomElem => {
44
+ contextRef.current = DomElem;
45
+ if (isFocused) DomElem?.focus?.();
46
+ },
45
47
  placeholder: placeholder,
46
- "aria-label": "month input field, ".concat(ariaCurrentValueForInputs),
48
+ "aria-label": `month input field, ${ariaCurrentValueForInputs}`,
47
49
  "data-testid": ControlledDateTimePickerDatatestid.DATE_INPUTS.MONTH,
48
50
  disabled: disabled,
49
51
  "aria-disabled": disabled
@@ -21,12 +21,11 @@ const YYYYInput = /*#__PURE__*/React.memo(_ref => {
21
21
  disabled,
22
22
  placeholder,
23
23
  contextRef,
24
- ariaCurrentValueForInputs
24
+ ariaCurrentValueForInputs,
25
+ isFocused
25
26
  } = _ref;
26
27
  const validateOnChange = useCallback(e => {
27
- var _e$target;
28
-
29
- if (isInvalidYear(e === null || e === void 0 ? void 0 : (_e$target = e.target) === null || _e$target === void 0 ? void 0 : _e$target.value)) {
28
+ if (isInvalidYear(e?.target?.value)) {
30
29
  e.preventDefault();
31
30
  return;
32
31
  }
@@ -39,9 +38,12 @@ const YYYYInput = /*#__PURE__*/React.memo(_ref => {
39
38
  onFocus: onFocus,
40
39
  onKeyDown: onKeyDown,
41
40
  value: value,
42
- ref: contextRef,
41
+ ref: DomElem => {
42
+ contextRef.current = DomElem;
43
+ if (isFocused) DomElem?.focus?.();
44
+ },
43
45
  placeholder: placeholder,
44
- "aria-label": "year input field, ".concat(ariaCurrentValueForInputs),
46
+ "aria-label": `year input field, ${ariaCurrentValueForInputs}`,
45
47
  "data-testid": ControlledDateTimePickerDatatestid.DATE_INPUTS.YEAR,
46
48
  disabled: disabled,
47
49
  "aria-disabled": disabled
@@ -8,7 +8,7 @@ import { useContext, useCallback, useMemo } from 'react';
8
8
  import { ControlledDateTimePickerContext } from '../../ControlledDateTimePickerCTX.js';
9
9
  import { getFormattedDateString, prependStringWithPlaceHolders, fillStringWithPlaceHolders } from '../../utils/stringHelpers.js';
10
10
  import { getValidationDateStringMetaInfo } from '../../utils/dateHelpers.js';
11
- import { homeEndArrowUpDownDashSlashesKeys, homeEndArrowUpDownSpaceKeys, defaultMetaInfo } from '../../utils/constants.js';
11
+ import { defaultMetaInfo } from '../../utils/constants.js';
12
12
 
13
13
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
14
14
 
@@ -27,34 +27,27 @@ const useDateInputs = () => {
27
27
  day,
28
28
  year,
29
29
  hideTime,
30
- monthInputRef,
31
- dayInputRef,
32
- yearInputRef,
33
- hourInputRef,
34
- meridiemInputRef,
35
- clearButtonRef,
36
- pickerButtonRef,
37
30
  handleChangeComposedDateString,
38
- setLatestInteractionRegion,
39
31
  withClearBtn,
40
32
  withAnyPicker,
41
33
  withAnyRightController,
42
34
  autoFocusMonthInput,
43
- lastSegmentRef
35
+ trackFocusResetter,
36
+ trackFocusFirstSegment,
37
+ trackFocusLastSegment,
38
+ trackFocusDayInput,
39
+ trackFocusMonthInput,
40
+ trackFocusYearInput,
41
+ trackFocusHourInput,
42
+ trackFocusClearBtn,
43
+ trackFocusPicker
44
44
  } = useContext(ControlledDateTimePickerContext);
45
45
  const onHomeKeyDown = useCallback(() => {
46
- var _monthInputRef$curren, _monthInputRef$curren2;
47
-
48
- 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);
49
- }, [monthInputRef]);
46
+ trackFocusFirstSegment();
47
+ }, [trackFocusFirstSegment]);
50
48
  const onEndKeyDown = useCallback(() => {
51
- var _pickerButtonRef$curr, _pickerButtonRef$curr2, _clearButtonRef$curre, _clearButtonRef$curre2, _meridiemInputRef$cur, _meridiemInputRef$cur2, _yearInputRef$current, _yearInputRef$current2;
52
-
53
- if (withAnyPicker) pickerButtonRef === null || pickerButtonRef === void 0 ? void 0 : (_pickerButtonRef$curr = pickerButtonRef.current) === null || _pickerButtonRef$curr === void 0 ? void 0 : (_pickerButtonRef$curr2 = _pickerButtonRef$curr.focus) === null || _pickerButtonRef$curr2 === void 0 ? void 0 : _pickerButtonRef$curr2.call(_pickerButtonRef$curr);else if (withClearBtn) clearButtonRef === null || clearButtonRef === void 0 ? void 0 : (_clearButtonRef$curre = clearButtonRef.current) === null || _clearButtonRef$curre === void 0 ? void 0 : (_clearButtonRef$curre2 = _clearButtonRef$curre.focus) === null || _clearButtonRef$curre2 === void 0 ? void 0 : _clearButtonRef$curre2.call(_clearButtonRef$curre);else if (!hideTime) 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);
54
- }, [withAnyPicker, pickerButtonRef, withClearBtn, clearButtonRef, hideTime, meridiemInputRef, yearInputRef]);
55
- const setLatestInteractionRegionDateInputs = useCallback(() => {
56
- setLatestInteractionRegion('date-inputs');
57
- }, [setLatestInteractionRegion]);
49
+ trackFocusLastSegment();
50
+ }, [trackFocusLastSegment]);
58
51
  const handleChangeMonth = useCallback(function (newMonth, e) {
59
52
  let metaInfo = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : defaultMetaInfo;
60
53
  const newDateString = getFormattedDateString({
@@ -71,29 +64,25 @@ const useDateInputs = () => {
71
64
  handleChangeComposedDateString(newDateString, finalMetaInfo);
72
65
  }, [day, year, getIsOutOfRangeDay, getIsDisabledDay, appOnMonthChange, handleChangeComposedDateString]);
73
66
  const onMonthFocus = useCallback(() => {
74
- setLatestInteractionRegionDateInputs();
75
- }, [setLatestInteractionRegionDateInputs]);
67
+ trackFocusMonthInput();
68
+ }, [trackFocusMonthInput]);
76
69
  const onMonthChange = useCallback(e => {
77
- var _e$target, _dayInputRef$current, _dayInputRef$current$;
78
-
79
- let newMonth = e === null || e === void 0 ? void 0 : (_e$target = e.target) === null || _e$target === void 0 ? void 0 : _e$target.value; // converts months 2~9 to 02~09
70
+ let newMonth = e?.target?.value; // converts months 2~9 to 02~09
80
71
 
81
72
  if (Number.parseInt(newMonth, 10) > 1) newMonth = prependStringWithPlaceHolders(newMonth, 2);
82
73
  handleChangeMonth(newMonth, e); // auto-advance functionality:
83
74
 
84
- if (newMonth.length === 2) dayInputRef === null || dayInputRef === void 0 ? void 0 : (_dayInputRef$current = dayInputRef.current) === null || _dayInputRef$current === void 0 ? void 0 : (_dayInputRef$current$ = _dayInputRef$current.focus) === null || _dayInputRef$current$ === void 0 ? void 0 : _dayInputRef$current$.call(_dayInputRef$current);
85
- }, [dayInputRef, handleChangeMonth]);
75
+ if (newMonth.length === 2) trackFocusDayInput();
76
+ }, [handleChangeMonth, trackFocusDayInput]);
86
77
  const onMonthKeyDown = useCallback(e => {
87
- var _lastSegmentRef$curre, _lastSegmentRef$curre2;
88
-
89
78
  const {
90
79
  key,
91
80
  ctrlKey,
92
81
  metaKey
93
82
  } = e;
94
83
  const monthStringConvertedToInteger = Number.parseInt(month, 10);
95
- if (homeEndArrowUpDownDashSlashesKeys.includes(key)) e.preventDefault();
96
- if (homeEndArrowUpDownDashSlashesKeys.includes(key)) e.stopPropagation();
84
+ if (['Home', 'End', 'ArrowUp', 'ArrowDown', '-', '/', '\\'].includes(key)) e.preventDefault();
85
+ if (['Home', 'End', 'ArrowUp', 'ArrowDown', '-', '/', '\\'].includes(key)) e.stopPropagation();
97
86
  if (key === 'Home') onHomeKeyDown();
98
87
  if (key === 'End') onEndKeyDown();
99
88
 
@@ -101,26 +90,22 @@ const useDateInputs = () => {
101
90
  const monthInteger = Number.isNaN(monthStringConvertedToInteger) ? 0 : monthStringConvertedToInteger;
102
91
  let newMonth;
103
92
  if (key === 'ArrowUp') newMonth = monthInteger + 1 <= 12 ? monthInteger + 1 : monthInteger;else newMonth = monthInteger - 1 > 0 ? monthInteger - 1 : 1;
104
- newMonth = prependStringWithPlaceHolders("".concat(newMonth), 2);
93
+ newMonth = prependStringWithPlaceHolders(`${newMonth}`, 2);
105
94
  handleChangeMonth(newMonth, e);
106
95
  }
107
96
 
108
97
  if (!Number.isNaN(monthStringConvertedToInteger) && (key === '-' || key === '/' || key === '\\')) {
109
- var _dayInputRef$current2, _dayInputRef$current3;
110
-
111
- const newMonth = prependStringWithPlaceHolders("".concat(monthStringConvertedToInteger), 2);
98
+ const newMonth = prependStringWithPlaceHolders(`${monthStringConvertedToInteger}`, 2);
112
99
  handleChangeMonth(newMonth, e); // auto-advance functionality:
113
100
 
114
- if (newMonth.length === 2) dayInputRef === null || dayInputRef === void 0 ? void 0 : (_dayInputRef$current2 = dayInputRef.current) === null || _dayInputRef$current2 === void 0 ? void 0 : (_dayInputRef$current3 = _dayInputRef$current2.focus) === null || _dayInputRef$current3 === void 0 ? void 0 : _dayInputRef$current3.call(_dayInputRef$current2);
101
+ if (newMonth.length === 2) trackFocusDayInput();
115
102
  } // focus last fragment on fill with now
116
103
 
117
104
 
118
- if ((ctrlKey || metaKey) && key === ';') lastSegmentRef === null || lastSegmentRef === void 0 ? void 0 : (_lastSegmentRef$curre = lastSegmentRef.current) === null || _lastSegmentRef$curre === void 0 ? void 0 : (_lastSegmentRef$curre2 = _lastSegmentRef$curre.focus) === null || _lastSegmentRef$curre2 === void 0 ? void 0 : _lastSegmentRef$curre2.call(_lastSegmentRef$curre);
119
- }, [month, onHomeKeyDown, onEndKeyDown, lastSegmentRef, handleChangeMonth, dayInputRef]);
105
+ if ((ctrlKey || metaKey) && key === ';') trackFocusLastSegment();
106
+ }, [month, onHomeKeyDown, onEndKeyDown, trackFocusLastSegment, trackFocusDayInput, handleChangeMonth]);
120
107
  const onMonthBlur = useCallback(e => {
121
- var _e$target2;
122
-
123
- const newMonth = e === null || e === void 0 ? void 0 : (_e$target2 = e.target) === null || _e$target2 === void 0 ? void 0 : _e$target2.value;
108
+ const newMonth = e?.target?.value;
124
109
  if (newMonth === '0') handleChangeMonth('01', e, {
125
110
  isAutomaticFillTrigger: true
126
111
  });else if (newMonth.length > 0 && newMonth.length < 2) handleChangeMonth(prependStringWithPlaceHolders(newMonth, 2), e, {
@@ -143,29 +128,25 @@ const useDateInputs = () => {
143
128
  handleChangeComposedDateString(newDateString, finalMetaInfo);
144
129
  }, [month, year, getIsOutOfRangeDay, getIsDisabledDay, appOnDayChange, handleChangeComposedDateString]);
145
130
  const onDayFocus = useCallback(() => {
146
- setLatestInteractionRegionDateInputs();
147
- }, [setLatestInteractionRegionDateInputs]);
131
+ trackFocusDayInput();
132
+ }, [trackFocusDayInput]);
148
133
  const onDayChange = useCallback(e => {
149
- var _e$target3, _yearInputRef$current3, _yearInputRef$current4;
150
-
151
- let newDay = e === null || e === void 0 ? void 0 : (_e$target3 = e.target) === null || _e$target3 === void 0 ? void 0 : _e$target3.value; // converts days 4~9 to 04~09
134
+ let newDay = e?.target?.value; // converts days 4~9 to 04~09
152
135
 
153
136
  if (Number.parseInt(newDay, 10) > 3) newDay = prependStringWithPlaceHolders(newDay, 2);
154
137
  handleChangeDay(newDay, e); // auto-advance functionality:
155
138
 
156
- if (newDay.length === 2) yearInputRef === null || yearInputRef === void 0 ? void 0 : (_yearInputRef$current3 = yearInputRef.current) === null || _yearInputRef$current3 === void 0 ? void 0 : (_yearInputRef$current4 = _yearInputRef$current3.focus) === null || _yearInputRef$current4 === void 0 ? void 0 : _yearInputRef$current4.call(_yearInputRef$current3);
157
- }, [handleChangeDay, yearInputRef]);
139
+ if (newDay.length === 2) trackFocusYearInput();
140
+ }, [handleChangeDay, trackFocusYearInput]);
158
141
  const onDayKeyDown = useCallback(e => {
159
- var _lastSegmentRef$curre3, _lastSegmentRef$curre4;
160
-
161
142
  const {
162
143
  key,
163
144
  ctrlKey,
164
145
  metaKey
165
146
  } = e;
166
147
  const dayStringConvertedToInteger = Number.parseInt(day, 10);
167
- if (homeEndArrowUpDownDashSlashesKeys.includes(key)) e.preventDefault();
168
- if (homeEndArrowUpDownDashSlashesKeys.includes(key)) e.stopPropagation();
148
+ if (['Home', 'End', 'ArrowUp', 'ArrowDown', '-', '/', '\\'].includes(key)) e.preventDefault();
149
+ if (['Home', 'End', 'ArrowUp', 'ArrowDown', '-', '/', '\\'].includes(key)) e.stopPropagation();
169
150
  if (key === 'Home') onHomeKeyDown();
170
151
  if (key === 'End') onEndKeyDown();
171
152
 
@@ -173,33 +154,27 @@ const useDateInputs = () => {
173
154
  const dayInteger = Number.isNaN(dayStringConvertedToInteger) ? 0 : dayStringConvertedToInteger;
174
155
  let newDay;
175
156
  if (key === 'ArrowUp') newDay = dayInteger + 1 <= 31 ? dayInteger + 1 : dayInteger;else newDay = dayInteger - 1 > 0 ? dayInteger - 1 : 1;
176
- newDay = prependStringWithPlaceHolders("".concat(newDay), 2);
157
+ newDay = prependStringWithPlaceHolders(`${newDay}`, 2);
177
158
  handleChangeDay(newDay, e);
178
159
  }
179
160
 
180
161
  if (!Number.isNaN(dayStringConvertedToInteger) && (key === '-' || key === '/' || key === '\\')) {
181
- var _yearInputRef$current5, _yearInputRef$current6;
182
-
183
- const newDay = prependStringWithPlaceHolders("".concat(dayStringConvertedToInteger), 2);
162
+ const newDay = prependStringWithPlaceHolders(`${dayStringConvertedToInteger}`, 2);
184
163
  handleChangeDay(newDay, e); // auto-advance functionality:
185
164
 
186
- if (newDay.length === 2) yearInputRef === null || yearInputRef === void 0 ? void 0 : (_yearInputRef$current5 = yearInputRef.current) === null || _yearInputRef$current5 === void 0 ? void 0 : (_yearInputRef$current6 = _yearInputRef$current5.focus) === null || _yearInputRef$current6 === void 0 ? void 0 : _yearInputRef$current6.call(_yearInputRef$current5);
165
+ if (newDay.length === 2) trackFocusYearInput();
187
166
  } // regressive backspace functionality
188
167
 
189
168
 
190
- if (key === 'Backspace' && (day === null || day === void 0 ? void 0 : day.length) === 0) {
191
- var _monthInputRef$curren3, _monthInputRef$curren4;
192
-
193
- monthInputRef === null || monthInputRef === void 0 ? void 0 : (_monthInputRef$curren3 = monthInputRef.current) === null || _monthInputRef$curren3 === void 0 ? void 0 : (_monthInputRef$curren4 = _monthInputRef$curren3.focus) === null || _monthInputRef$curren4 === void 0 ? void 0 : _monthInputRef$curren4.call(_monthInputRef$curren3);
169
+ if (key === 'Backspace' && day?.length === 0) {
170
+ trackFocusMonthInput();
194
171
  } // focus last fragment on fill with now
195
172
 
196
173
 
197
- if ((ctrlKey || metaKey) && key === ';') lastSegmentRef === null || lastSegmentRef === void 0 ? void 0 : (_lastSegmentRef$curre3 = lastSegmentRef.current) === null || _lastSegmentRef$curre3 === void 0 ? void 0 : (_lastSegmentRef$curre4 = _lastSegmentRef$curre3.focus) === null || _lastSegmentRef$curre4 === void 0 ? void 0 : _lastSegmentRef$curre4.call(_lastSegmentRef$curre3);
198
- }, [day, onHomeKeyDown, onEndKeyDown, lastSegmentRef, handleChangeDay, yearInputRef, monthInputRef]);
174
+ if ((ctrlKey || metaKey) && key === ';') trackFocusLastSegment();
175
+ }, [day, onHomeKeyDown, onEndKeyDown, trackFocusLastSegment, handleChangeDay, trackFocusYearInput, trackFocusMonthInput]);
199
176
  const onDayBlur = useCallback(e => {
200
- var _e$target4;
201
-
202
- const newDay = e === null || e === void 0 ? void 0 : (_e$target4 = e.target) === null || _e$target4 === void 0 ? void 0 : _e$target4.value;
177
+ const newDay = e?.target?.value;
203
178
  if (newDay === '0') handleChangeDay('01', e, {
204
179
  isAutomaticFillTrigger: true
205
180
  });else if (newDay.length > 0 && newDay.length < 2) handleChangeDay(prependStringWithPlaceHolders(newDay, 2), e, {
@@ -222,79 +197,75 @@ const useDateInputs = () => {
222
197
  handleChangeComposedDateString(newDateString, finalMetaInfo);
223
198
  }, [month, day, getIsOutOfRangeDay, getIsDisabledDay, appOnYearChange, handleChangeComposedDateString]);
224
199
  const onYearFocus = useCallback(() => {
225
- setLatestInteractionRegionDateInputs();
226
- }, [setLatestInteractionRegionDateInputs]);
200
+ trackFocusYearInput();
201
+ }, [trackFocusYearInput]);
227
202
  const onYearChange = useCallback(e => {
228
- var _e$target5;
229
-
230
- const newYear = e === null || e === void 0 ? void 0 : (_e$target5 = e.target) === null || _e$target5 === void 0 ? void 0 : _e$target5.value;
203
+ const newYear = e?.target?.value;
231
204
  handleChangeYear(newYear, e); // auto-advance functionality:
232
205
 
233
206
  if (newYear.length === 4) {
234
- var _hourInputRef$current, _hourInputRef$current2;
235
-
236
- 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);else if (withAnyRightController) {
237
- var _clearButtonRef$curre3, _clearButtonRef$curre4, _pickerButtonRef$curr3, _pickerButtonRef$curr4;
238
-
239
- if (withClearBtn) (_clearButtonRef$curre3 = clearButtonRef.current) === null || _clearButtonRef$curre3 === void 0 ? void 0 : (_clearButtonRef$curre4 = _clearButtonRef$curre3.focus) === null || _clearButtonRef$curre4 === void 0 ? void 0 : _clearButtonRef$curre4.call(_clearButtonRef$curre3);else if (withAnyPicker) pickerButtonRef === null || pickerButtonRef === void 0 ? void 0 : (_pickerButtonRef$curr3 = pickerButtonRef.current) === null || _pickerButtonRef$curr3 === void 0 ? void 0 : (_pickerButtonRef$curr4 = _pickerButtonRef$curr3.focus) === null || _pickerButtonRef$curr4 === void 0 ? void 0 : _pickerButtonRef$curr4.call(_pickerButtonRef$curr3); // pending approval from Seda, check which one should be focused first...
207
+ if (!hideTime) trackFocusHourInput();else if (withAnyRightController) {
208
+ if (withClearBtn) trackFocusClearBtn();else if (withAnyPicker) trackFocusPicker(); // pending approval from Seda, check which one should be focused first...
240
209
  }
241
210
  }
242
- }, [handleChangeYear, hideTime, hourInputRef, withAnyRightController, withAnyPicker, pickerButtonRef, withClearBtn, clearButtonRef]);
211
+ }, [handleChangeYear, hideTime, trackFocusHourInput, withAnyRightController, withClearBtn, trackFocusClearBtn, withAnyPicker, trackFocusPicker]);
243
212
  const onYearKeyDown = useCallback(e => {
244
- var _lastSegmentRef$curre5, _lastSegmentRef$curre6;
245
-
246
213
  const {
247
214
  key,
248
215
  ctrlKey,
249
216
  metaKey
250
217
  } = e;
218
+ /* ****** New year value calculator logic ********* */
219
+
251
220
  const yearStringConvertedToInteger = Number.parseInt(year, 10);
252
- if (homeEndArrowUpDownSpaceKeys.includes(key)) e.preventDefault();
253
- if (homeEndArrowUpDownSpaceKeys.includes(key)) e.stopPropagation();
254
- if (key === 'Home') onHomeKeyDown();
255
- if (key === 'End') onEndKeyDown();
221
+ const yearInteger = Number.isNaN(yearStringConvertedToInteger) ? 0 : yearStringConvertedToInteger;
222
+ let newYear = yearInteger !== 0 ? fillStringWithPlaceHolders(`${yearInteger}`, 4, '0') : '';
256
223
 
257
224
  if (key === 'ArrowUp' || key === 'ArrowDown') {
258
- const yearInteger = Number.isNaN(yearStringConvertedToInteger) ? 0 : yearStringConvertedToInteger;
259
- let newYear;
260
- if (key === 'ArrowUp') newYear = yearInteger + 1 <= 9999 ? yearInteger + 1 : yearInteger;else newYear = yearInteger - 1 > 0 ? yearInteger - 1 : 1;
261
- newYear = prependStringWithPlaceHolders("".concat(newYear), 4);
262
- handleChangeYear(newYear, e);
225
+ let newYearInteger;
226
+ if (key === 'ArrowUp') newYearInteger = yearInteger + 1 <= 9999 ? yearInteger + 1 : yearInteger;else newYearInteger = yearInteger - 1 > 0 ? yearInteger - 1 : 1;
227
+ newYear = prependStringWithPlaceHolders(`${newYearInteger}`, 4);
263
228
  }
264
229
 
265
- if (!Number.isNaN(yearStringConvertedToInteger) && key === ' ') {
266
- const newYear = prependStringWithPlaceHolders("".concat(yearStringConvertedToInteger), 4);
267
- handleChangeYear(newYear, e); // auto-advance functionality:
230
+ const isAutomaticFillTrigger = newYear !== year && ['Tab', ' '].includes(key);
231
+ const metainfo = {
232
+ isAutomaticFillTrigger
233
+ };
234
+ /* ************* new year apply logic ************* */
235
+ // tab/spacebar applies auto-fill
236
+ // arrows up/down applies increment/decrement
268
237
 
269
- if (newYear.length === 4) {
270
- var _hourInputRef$current3, _hourInputRef$current4;
238
+ if (key === 'ArrowUp' || key === 'ArrowDown' || isAutomaticFillTrigger) {
239
+ handleChangeYear(newYear, e, metainfo);
240
+ }
241
+ /* ************* focus tracking logic ************* */
271
242
 
272
- if (!hideTime) hourInputRef === null || hourInputRef === void 0 ? void 0 : (_hourInputRef$current3 = hourInputRef.current) === null || _hourInputRef$current3 === void 0 ? void 0 : (_hourInputRef$current4 = _hourInputRef$current3.focus) === null || _hourInputRef$current4 === void 0 ? void 0 : _hourInputRef$current4.call(_hourInputRef$current3);else if (withAnyRightController) {
273
- var _clearButtonRef$curre5, _clearButtonRef$curre6, _pickerButtonRef$curr5, _pickerButtonRef$curr6;
274
243
 
275
- if (withClearBtn) (_clearButtonRef$curre5 = clearButtonRef.current) === null || _clearButtonRef$curre5 === void 0 ? void 0 : (_clearButtonRef$curre6 = _clearButtonRef$curre5.focus) === null || _clearButtonRef$curre6 === void 0 ? void 0 : _clearButtonRef$curre6.call(_clearButtonRef$curre5);else if (withAnyPicker) pickerButtonRef === null || pickerButtonRef === void 0 ? void 0 : (_pickerButtonRef$curr5 = pickerButtonRef.current) === null || _pickerButtonRef$curr5 === void 0 ? void 0 : (_pickerButtonRef$curr6 = _pickerButtonRef$curr5.focus) === null || _pickerButtonRef$curr6 === void 0 ? void 0 : _pickerButtonRef$curr6.call(_pickerButtonRef$curr5); // pending approval from Seda, check which one should be focused first...
276
- }
277
- }
278
- } // regressive backspace functionality
244
+ let trackNextFocus = trackFocusResetter; // if nothing after, we reset internal focus tracker to avoid re-render unexpected focus shift
279
245
 
246
+ if (!hideTime) trackNextFocus = trackFocusHourInput;else if (withClearBtn) trackNextFocus = trackFocusClearBtn;else if (withAnyPicker) trackNextFocus = trackFocusPicker;
247
+ if (['Home', 'End', 'ArrowUp', 'ArrowDown', ' '].includes(key)) e.preventDefault();
248
+ if (['Home', 'End', 'ArrowUp', 'ArrowDown', ' '].includes(key)) e.stopPropagation();
249
+ if (key === 'Home') onHomeKeyDown();
250
+ if (key === 'End') onEndKeyDown();
251
+ /* ************** auto-advance logic ************** */
280
252
 
281
- if (key === 'Backspace' && (year === null || year === void 0 ? void 0 : year.length) === 0) {
282
- var _dayInputRef$current4, _dayInputRef$current5;
253
+ if (key === ' ') {
254
+ // auto-advance functionality:
255
+ trackNextFocus();
256
+ }
257
+ /* ********** regressive backspace logic ********** */
283
258
 
284
- dayInputRef === null || dayInputRef === void 0 ? void 0 : (_dayInputRef$current4 = dayInputRef.current) === null || _dayInputRef$current4 === void 0 ? void 0 : (_dayInputRef$current5 = _dayInputRef$current4.focus) === null || _dayInputRef$current5 === void 0 ? void 0 : _dayInputRef$current5.call(_dayInputRef$current4);
285
- } // focus last fragment on fill with now
286
259
 
260
+ if (key === 'Backspace' && year?.length === 0) {
261
+ trackFocusDayInput();
262
+ } // focus last fragment on fill with now
287
263
 
288
- if ((ctrlKey || metaKey) && key === ';') lastSegmentRef === null || lastSegmentRef === void 0 ? void 0 : (_lastSegmentRef$curre5 = lastSegmentRef.current) === null || _lastSegmentRef$curre5 === void 0 ? void 0 : (_lastSegmentRef$curre6 = _lastSegmentRef$curre5.focus) === null || _lastSegmentRef$curre6 === void 0 ? void 0 : _lastSegmentRef$curre6.call(_lastSegmentRef$curre5);
289
- }, [year, onHomeKeyDown, onEndKeyDown, lastSegmentRef, handleChangeYear, hideTime, hourInputRef, withAnyRightController, withClearBtn, clearButtonRef, withAnyPicker, pickerButtonRef, dayInputRef]);
290
- const onYearBlur = useCallback(e => {
291
- var _e$target6;
292
264
 
293
- const newYear = e === null || e === void 0 ? void 0 : (_e$target6 = e.target) === null || _e$target6 === void 0 ? void 0 : _e$target6.value;
294
- if (newYear.length > 0 && newYear.length < 4) handleChangeYear(fillStringWithPlaceHolders(newYear, 4, '0'), e, {
295
- isAutomaticFillTrigger: true
296
- });
297
- }, [handleChangeYear]);
265
+ if ((ctrlKey || metaKey) && key === ';') trackFocusLastSegment();
266
+ }, [year, trackFocusResetter, hideTime, trackFocusHourInput, withClearBtn, trackFocusClearBtn, withAnyPicker, trackFocusPicker, onHomeKeyDown, onEndKeyDown, trackFocusLastSegment, trackFocusDayInput, handleChangeYear]);
267
+ const onYearBlur = useCallback(() => {// this was used before, now that we have a wrapping onBlur resetting the focus tracker, this is unused;
268
+ }, []);
298
269
  return useMemo(() => ({
299
270
  month,
300
271
  day,
@@ -19,7 +19,7 @@ const CalendarDaysList = /*#__PURE__*/React.memo(_ref => {
19
19
  children: [invisibleFirstDay ? /*#__PURE__*/_jsx(Day, {
20
20
  metaDay: invisibleFirstDay,
21
21
  isInvisible: true
22
- }, "ds-calendar-".concat(invisibleFirstDay.day.toString())) : null, daysMatrixByWeekday.map((week, i) => /*#__PURE__*/_jsx(StyledWeekDaysListWrapper, {
22
+ }, `ds-calendar-${invisibleFirstDay.day.toString()}`) : null, daysMatrixByWeekday.map((week, i) => /*#__PURE__*/_jsx(StyledWeekDaysListWrapper, {
23
23
  role: "row",
24
24
  "aria-rowindex": i + 1,
25
25
  cols: ['32px', '32px', '32px', '32px', '32px', '32px', '32px'],
@@ -28,13 +28,13 @@ const CalendarDaysList = /*#__PURE__*/React.memo(_ref => {
28
28
  px: "2px",
29
29
  justifyContent: "space-between",
30
30
  alignItems: "center"
31
- }, "ds-calendar-week-".concat(week[0].day.toString(), "-").concat(week[6].day.toString()), week.map((metaDay, z) => /*#__PURE__*/_jsx(Day, {
31
+ }, `ds-calendar-week-${week[0].day.toString()}-${week[6].day.toString()}`, week.map((metaDay, z) => /*#__PURE__*/_jsx(Day, {
32
32
  metaDay: metaDay,
33
33
  colIndex: z + 1
34
- }, "ds-calendar-".concat(metaDay.day.toString()))))), invisibleLastDay ? /*#__PURE__*/_jsx(Day, {
34
+ }, `ds-calendar-${metaDay.day.toString()}`)))), invisibleLastDay ? /*#__PURE__*/_jsx(Day, {
35
35
  metaDay: invisibleLastDay,
36
36
  isInvisible: true
37
- }, "ds-calendar-".concat(invisibleLastDay.day.toString())) : null]
37
+ }, `ds-calendar-${invisibleLastDay.day.toString()}`) : null]
38
38
  });
39
39
  });
40
40
 
@@ -1,5 +1,5 @@
1
1
  import _jsx from '@babel/runtime/helpers/esm/jsx';
2
- import { useMemo, useContext } from 'react';
2
+ import { useMemo, useContext, useCallback } from 'react';
3
3
  import { BUTTON_SIZES } from '@elliemae/ds-button';
4
4
  import { ChevronDoubleLeft, ChevronLeft, ChevronRight, ChevronDoubleRight } from '@elliemae/ds-icons';
5
5
  import { ControlledDateTimePickerDatatestid } from '../../../ControlledDateTimePickerDatatestid.js';
@@ -15,8 +15,8 @@ const useGetFormattedCurrentDate = () => {
15
15
  currentMonth,
16
16
  currentYear
17
17
  } = useContext(CalendarContext);
18
- const monthString = currentMonth >= 0 && currentMonth <= 11 ? "".concat(getMonthNameByMonthNumber(currentMonth), " ") : '';
19
- return useMemo(() => "".concat(monthString).concat(currentYear), [monthString, currentYear]);
18
+ const monthString = currentMonth >= 0 && currentMonth <= 11 ? `${getMonthNameByMonthNumber(currentMonth)} ` : '';
19
+ return useMemo(() => `${monthString}${currentYear}`, [monthString, currentYear]);
20
20
  };
21
21
 
22
22
  const CalendarHead = () => {
@@ -41,14 +41,32 @@ const CalendarHead = () => {
41
41
  prevYearBtnRef,
42
42
  prevMonthBtnRef,
43
43
  nextMonthBtnRef,
44
- nextYearBtnRef
44
+ nextYearBtnRef,
45
+ latestInteractionRegion,
46
+ currFocusDescriber
45
47
  } = useContext(ControlledDateTimePickerContext);
48
+ const handlePrevYearRef = useCallback(ButtonDomNode => {
49
+ prevYearBtnRef.current = ButtonDomNode;
50
+ if (latestInteractionRegion === 'calendar-head' && currFocusDescriber === 'calendar-prev-year') ButtonDomNode?.focus?.();
51
+ }, [currFocusDescriber, latestInteractionRegion, prevYearBtnRef]);
52
+ const handlePrevMonthRef = useCallback(ButtonDomNode => {
53
+ prevMonthBtnRef.current = ButtonDomNode;
54
+ if (latestInteractionRegion === 'calendar-head' && currFocusDescriber === 'calendar-prev-month') ButtonDomNode?.focus?.();
55
+ }, [currFocusDescriber, latestInteractionRegion, prevMonthBtnRef]);
56
+ const handleNextMonthRef = useCallback(ButtonDomNode => {
57
+ nextMonthBtnRef.current = ButtonDomNode;
58
+ if (latestInteractionRegion === 'calendar-head' && currFocusDescriber === 'calendar-next-month') ButtonDomNode?.focus?.();
59
+ }, [currFocusDescriber, latestInteractionRegion, nextMonthBtnRef]);
60
+ const handleNextYearRef = useCallback(ButtonDomNode => {
61
+ nextYearBtnRef.current = ButtonDomNode;
62
+ if (latestInteractionRegion === 'calendar-head' && currFocusDescriber === 'calendar-next-year') ButtonDomNode?.focus?.();
63
+ }, [currFocusDescriber, latestInteractionRegion, nextYearBtnRef]);
46
64
  return /*#__PURE__*/_jsx(StyledHeader, {}, void 0, /*#__PURE__*/_jsx(StyledHeaderButton, {
47
65
  "aria-label": "previous year",
48
66
  buttonType: "raw",
49
67
  size: BUTTON_SIZES.M,
50
68
  onClick: handlePrevYear,
51
- innerRef: prevYearBtnRef,
69
+ innerRef: handlePrevYearRef,
52
70
  onKeyDown: handlePrevYearKeyDown,
53
71
  onFocus: onPrevYearFocus,
54
72
  tabIndex: isControllerOnly ? -1 : 1,
@@ -63,7 +81,7 @@ const CalendarHead = () => {
63
81
  buttonType: "raw",
64
82
  size: BUTTON_SIZES.M,
65
83
  onClick: handlePrevMonth,
66
- innerRef: prevMonthBtnRef,
84
+ innerRef: handlePrevMonthRef,
67
85
  onKeyDown: handlePrevMonthKeyDown,
68
86
  onFocus: onPrevMonthFocus,
69
87
  "data-testid": ControlledDateTimePickerDatatestid.CALENDAR.PREV_MONTH // this is a tabstop for when the calendar is open
@@ -75,7 +93,7 @@ const CalendarHead = () => {
75
93
  buttonType: "raw",
76
94
  size: BUTTON_SIZES.M,
77
95
  onClick: handleNextMonth,
78
- innerRef: nextMonthBtnRef,
96
+ innerRef: handleNextMonthRef,
79
97
  onKeyDown: handleNextMonthKeyDown,
80
98
  onFocus: onNextMonthFocus,
81
99
  "data-testid": ControlledDateTimePickerDatatestid.CALENDAR.NEXT_MONTH
@@ -86,7 +104,7 @@ const CalendarHead = () => {
86
104
  buttonType: "raw",
87
105
  size: BUTTON_SIZES.M,
88
106
  onClick: handleNextYear,
89
- innerRef: nextYearBtnRef,
107
+ innerRef: handleNextYearRef,
90
108
  onKeyDown: handleNextYearKeyDown,
91
109
  onFocus: onNextYearFocus,
92
110
  "data-testid": ControlledDateTimePickerDatatestid.CALENDAR.NEXT_YEAR
@@ -24,7 +24,7 @@ const CalendarIconTrigger = () => {
24
24
  ariaCurrentValueForInputs
25
25
  } = useContext(ControlledDateTimePickerContext);
26
26
  return useMemo(() => /*#__PURE__*/_jsx(StyledIconTriggerButton, {
27
- "aria-label": "date picker context menu trigger, ".concat(ariaCurrentValueForInputs),
27
+ "aria-label": `date picker context menu trigger, ${ariaCurrentValueForInputs}`,
28
28
  buttonType: "icon",
29
29
  size: BUTTON_SIZES.M,
30
30
  innerRef: handleSetTriggerRef,