@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
@@ -35,34 +35,27 @@ const useDateInputs = () => {
35
35
  day,
36
36
  year,
37
37
  hideTime,
38
- monthInputRef,
39
- dayInputRef,
40
- yearInputRef,
41
- hourInputRef,
42
- meridiemInputRef,
43
- clearButtonRef,
44
- pickerButtonRef,
45
38
  handleChangeComposedDateString,
46
- setLatestInteractionRegion,
47
39
  withClearBtn,
48
40
  withAnyPicker,
49
41
  withAnyRightController,
50
42
  autoFocusMonthInput,
51
- lastSegmentRef
43
+ trackFocusResetter,
44
+ trackFocusFirstSegment,
45
+ trackFocusLastSegment,
46
+ trackFocusDayInput,
47
+ trackFocusMonthInput,
48
+ trackFocusYearInput,
49
+ trackFocusHourInput,
50
+ trackFocusClearBtn,
51
+ trackFocusPicker
52
52
  } = React.useContext(ControlledDateTimePickerCTX.ControlledDateTimePickerContext);
53
53
  const onHomeKeyDown = React.useCallback(() => {
54
- var _monthInputRef$curren, _monthInputRef$curren2;
55
-
56
- 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);
57
- }, [monthInputRef]);
54
+ trackFocusFirstSegment();
55
+ }, [trackFocusFirstSegment]);
58
56
  const onEndKeyDown = React.useCallback(() => {
59
- var _pickerButtonRef$curr, _pickerButtonRef$curr2, _clearButtonRef$curre, _clearButtonRef$curre2, _meridiemInputRef$cur, _meridiemInputRef$cur2, _yearInputRef$current, _yearInputRef$current2;
60
-
61
- 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);
62
- }, [withAnyPicker, pickerButtonRef, withClearBtn, clearButtonRef, hideTime, meridiemInputRef, yearInputRef]);
63
- const setLatestInteractionRegionDateInputs = React.useCallback(() => {
64
- setLatestInteractionRegion('date-inputs');
65
- }, [setLatestInteractionRegion]);
57
+ trackFocusLastSegment();
58
+ }, [trackFocusLastSegment]);
66
59
  const handleChangeMonth = React.useCallback(function (newMonth, e) {
67
60
  let metaInfo = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : constants.defaultMetaInfo;
68
61
  const newDateString = stringHelpers.getFormattedDateString({
@@ -79,29 +72,25 @@ const useDateInputs = () => {
79
72
  handleChangeComposedDateString(newDateString, finalMetaInfo);
80
73
  }, [day, year, getIsOutOfRangeDay, getIsDisabledDay, appOnMonthChange, handleChangeComposedDateString]);
81
74
  const onMonthFocus = React.useCallback(() => {
82
- setLatestInteractionRegionDateInputs();
83
- }, [setLatestInteractionRegionDateInputs]);
75
+ trackFocusMonthInput();
76
+ }, [trackFocusMonthInput]);
84
77
  const onMonthChange = React.useCallback(e => {
85
- var _e$target, _dayInputRef$current, _dayInputRef$current$;
86
-
87
- 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
78
+ let newMonth = e?.target?.value; // converts months 2~9 to 02~09
88
79
 
89
80
  if (Number.parseInt(newMonth, 10) > 1) newMonth = stringHelpers.prependStringWithPlaceHolders(newMonth, 2);
90
81
  handleChangeMonth(newMonth, e); // auto-advance functionality:
91
82
 
92
- 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);
93
- }, [dayInputRef, handleChangeMonth]);
83
+ if (newMonth.length === 2) trackFocusDayInput();
84
+ }, [handleChangeMonth, trackFocusDayInput]);
94
85
  const onMonthKeyDown = React.useCallback(e => {
95
- var _lastSegmentRef$curre, _lastSegmentRef$curre2;
96
-
97
86
  const {
98
87
  key,
99
88
  ctrlKey,
100
89
  metaKey
101
90
  } = e;
102
91
  const monthStringConvertedToInteger = Number.parseInt(month, 10);
103
- if (constants.homeEndArrowUpDownDashSlashesKeys.includes(key)) e.preventDefault();
104
- if (constants.homeEndArrowUpDownDashSlashesKeys.includes(key)) e.stopPropagation();
92
+ if (['Home', 'End', 'ArrowUp', 'ArrowDown', '-', '/', '\\'].includes(key)) e.preventDefault();
93
+ if (['Home', 'End', 'ArrowUp', 'ArrowDown', '-', '/', '\\'].includes(key)) e.stopPropagation();
105
94
  if (key === 'Home') onHomeKeyDown();
106
95
  if (key === 'End') onEndKeyDown();
107
96
 
@@ -109,26 +98,22 @@ const useDateInputs = () => {
109
98
  const monthInteger = Number.isNaN(monthStringConvertedToInteger) ? 0 : monthStringConvertedToInteger;
110
99
  let newMonth;
111
100
  if (key === 'ArrowUp') newMonth = monthInteger + 1 <= 12 ? monthInteger + 1 : monthInteger;else newMonth = monthInteger - 1 > 0 ? monthInteger - 1 : 1;
112
- newMonth = stringHelpers.prependStringWithPlaceHolders("".concat(newMonth), 2);
101
+ newMonth = stringHelpers.prependStringWithPlaceHolders(`${newMonth}`, 2);
113
102
  handleChangeMonth(newMonth, e);
114
103
  }
115
104
 
116
105
  if (!Number.isNaN(monthStringConvertedToInteger) && (key === '-' || key === '/' || key === '\\')) {
117
- var _dayInputRef$current2, _dayInputRef$current3;
118
-
119
- const newMonth = stringHelpers.prependStringWithPlaceHolders("".concat(monthStringConvertedToInteger), 2);
106
+ const newMonth = stringHelpers.prependStringWithPlaceHolders(`${monthStringConvertedToInteger}`, 2);
120
107
  handleChangeMonth(newMonth, e); // auto-advance functionality:
121
108
 
122
- 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);
109
+ if (newMonth.length === 2) trackFocusDayInput();
123
110
  } // focus last fragment on fill with now
124
111
 
125
112
 
126
- 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);
127
- }, [month, onHomeKeyDown, onEndKeyDown, lastSegmentRef, handleChangeMonth, dayInputRef]);
113
+ if ((ctrlKey || metaKey) && key === ';') trackFocusLastSegment();
114
+ }, [month, onHomeKeyDown, onEndKeyDown, trackFocusLastSegment, trackFocusDayInput, handleChangeMonth]);
128
115
  const onMonthBlur = React.useCallback(e => {
129
- var _e$target2;
130
-
131
- const newMonth = e === null || e === void 0 ? void 0 : (_e$target2 = e.target) === null || _e$target2 === void 0 ? void 0 : _e$target2.value;
116
+ const newMonth = e?.target?.value;
132
117
  if (newMonth === '0') handleChangeMonth('01', e, {
133
118
  isAutomaticFillTrigger: true
134
119
  });else if (newMonth.length > 0 && newMonth.length < 2) handleChangeMonth(stringHelpers.prependStringWithPlaceHolders(newMonth, 2), e, {
@@ -151,29 +136,25 @@ const useDateInputs = () => {
151
136
  handleChangeComposedDateString(newDateString, finalMetaInfo);
152
137
  }, [month, year, getIsOutOfRangeDay, getIsDisabledDay, appOnDayChange, handleChangeComposedDateString]);
153
138
  const onDayFocus = React.useCallback(() => {
154
- setLatestInteractionRegionDateInputs();
155
- }, [setLatestInteractionRegionDateInputs]);
139
+ trackFocusDayInput();
140
+ }, [trackFocusDayInput]);
156
141
  const onDayChange = React.useCallback(e => {
157
- var _e$target3, _yearInputRef$current3, _yearInputRef$current4;
158
-
159
- 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
142
+ let newDay = e?.target?.value; // converts days 4~9 to 04~09
160
143
 
161
144
  if (Number.parseInt(newDay, 10) > 3) newDay = stringHelpers.prependStringWithPlaceHolders(newDay, 2);
162
145
  handleChangeDay(newDay, e); // auto-advance functionality:
163
146
 
164
- 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);
165
- }, [handleChangeDay, yearInputRef]);
147
+ if (newDay.length === 2) trackFocusYearInput();
148
+ }, [handleChangeDay, trackFocusYearInput]);
166
149
  const onDayKeyDown = React.useCallback(e => {
167
- var _lastSegmentRef$curre3, _lastSegmentRef$curre4;
168
-
169
150
  const {
170
151
  key,
171
152
  ctrlKey,
172
153
  metaKey
173
154
  } = e;
174
155
  const dayStringConvertedToInteger = Number.parseInt(day, 10);
175
- if (constants.homeEndArrowUpDownDashSlashesKeys.includes(key)) e.preventDefault();
176
- if (constants.homeEndArrowUpDownDashSlashesKeys.includes(key)) e.stopPropagation();
156
+ if (['Home', 'End', 'ArrowUp', 'ArrowDown', '-', '/', '\\'].includes(key)) e.preventDefault();
157
+ if (['Home', 'End', 'ArrowUp', 'ArrowDown', '-', '/', '\\'].includes(key)) e.stopPropagation();
177
158
  if (key === 'Home') onHomeKeyDown();
178
159
  if (key === 'End') onEndKeyDown();
179
160
 
@@ -181,33 +162,27 @@ const useDateInputs = () => {
181
162
  const dayInteger = Number.isNaN(dayStringConvertedToInteger) ? 0 : dayStringConvertedToInteger;
182
163
  let newDay;
183
164
  if (key === 'ArrowUp') newDay = dayInteger + 1 <= 31 ? dayInteger + 1 : dayInteger;else newDay = dayInteger - 1 > 0 ? dayInteger - 1 : 1;
184
- newDay = stringHelpers.prependStringWithPlaceHolders("".concat(newDay), 2);
165
+ newDay = stringHelpers.prependStringWithPlaceHolders(`${newDay}`, 2);
185
166
  handleChangeDay(newDay, e);
186
167
  }
187
168
 
188
169
  if (!Number.isNaN(dayStringConvertedToInteger) && (key === '-' || key === '/' || key === '\\')) {
189
- var _yearInputRef$current5, _yearInputRef$current6;
190
-
191
- const newDay = stringHelpers.prependStringWithPlaceHolders("".concat(dayStringConvertedToInteger), 2);
170
+ const newDay = stringHelpers.prependStringWithPlaceHolders(`${dayStringConvertedToInteger}`, 2);
192
171
  handleChangeDay(newDay, e); // auto-advance functionality:
193
172
 
194
- 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);
173
+ if (newDay.length === 2) trackFocusYearInput();
195
174
  } // regressive backspace functionality
196
175
 
197
176
 
198
- if (key === 'Backspace' && (day === null || day === void 0 ? void 0 : day.length) === 0) {
199
- var _monthInputRef$curren3, _monthInputRef$curren4;
200
-
201
- 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);
177
+ if (key === 'Backspace' && day?.length === 0) {
178
+ trackFocusMonthInput();
202
179
  } // focus last fragment on fill with now
203
180
 
204
181
 
205
- 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);
206
- }, [day, onHomeKeyDown, onEndKeyDown, lastSegmentRef, handleChangeDay, yearInputRef, monthInputRef]);
182
+ if ((ctrlKey || metaKey) && key === ';') trackFocusLastSegment();
183
+ }, [day, onHomeKeyDown, onEndKeyDown, trackFocusLastSegment, handleChangeDay, trackFocusYearInput, trackFocusMonthInput]);
207
184
  const onDayBlur = React.useCallback(e => {
208
- var _e$target4;
209
-
210
- const newDay = e === null || e === void 0 ? void 0 : (_e$target4 = e.target) === null || _e$target4 === void 0 ? void 0 : _e$target4.value;
185
+ const newDay = e?.target?.value;
211
186
  if (newDay === '0') handleChangeDay('01', e, {
212
187
  isAutomaticFillTrigger: true
213
188
  });else if (newDay.length > 0 && newDay.length < 2) handleChangeDay(stringHelpers.prependStringWithPlaceHolders(newDay, 2), e, {
@@ -230,79 +205,75 @@ const useDateInputs = () => {
230
205
  handleChangeComposedDateString(newDateString, finalMetaInfo);
231
206
  }, [month, day, getIsOutOfRangeDay, getIsDisabledDay, appOnYearChange, handleChangeComposedDateString]);
232
207
  const onYearFocus = React.useCallback(() => {
233
- setLatestInteractionRegionDateInputs();
234
- }, [setLatestInteractionRegionDateInputs]);
208
+ trackFocusYearInput();
209
+ }, [trackFocusYearInput]);
235
210
  const onYearChange = React.useCallback(e => {
236
- var _e$target5;
237
-
238
- const newYear = e === null || e === void 0 ? void 0 : (_e$target5 = e.target) === null || _e$target5 === void 0 ? void 0 : _e$target5.value;
211
+ const newYear = e?.target?.value;
239
212
  handleChangeYear(newYear, e); // auto-advance functionality:
240
213
 
241
214
  if (newYear.length === 4) {
242
- var _hourInputRef$current, _hourInputRef$current2;
243
-
244
- 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) {
245
- var _clearButtonRef$curre3, _clearButtonRef$curre4, _pickerButtonRef$curr3, _pickerButtonRef$curr4;
246
-
247
- 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...
215
+ if (!hideTime) trackFocusHourInput();else if (withAnyRightController) {
216
+ if (withClearBtn) trackFocusClearBtn();else if (withAnyPicker) trackFocusPicker(); // pending approval from Seda, check which one should be focused first...
248
217
  }
249
218
  }
250
- }, [handleChangeYear, hideTime, hourInputRef, withAnyRightController, withAnyPicker, pickerButtonRef, withClearBtn, clearButtonRef]);
219
+ }, [handleChangeYear, hideTime, trackFocusHourInput, withAnyRightController, withClearBtn, trackFocusClearBtn, withAnyPicker, trackFocusPicker]);
251
220
  const onYearKeyDown = React.useCallback(e => {
252
- var _lastSegmentRef$curre5, _lastSegmentRef$curre6;
253
-
254
221
  const {
255
222
  key,
256
223
  ctrlKey,
257
224
  metaKey
258
225
  } = e;
226
+ /* ****** New year value calculator logic ********* */
227
+
259
228
  const yearStringConvertedToInteger = Number.parseInt(year, 10);
260
- if (constants.homeEndArrowUpDownSpaceKeys.includes(key)) e.preventDefault();
261
- if (constants.homeEndArrowUpDownSpaceKeys.includes(key)) e.stopPropagation();
262
- if (key === 'Home') onHomeKeyDown();
263
- if (key === 'End') onEndKeyDown();
229
+ const yearInteger = Number.isNaN(yearStringConvertedToInteger) ? 0 : yearStringConvertedToInteger;
230
+ let newYear = yearInteger !== 0 ? stringHelpers.fillStringWithPlaceHolders(`${yearInteger}`, 4, '0') : '';
264
231
 
265
232
  if (key === 'ArrowUp' || key === 'ArrowDown') {
266
- const yearInteger = Number.isNaN(yearStringConvertedToInteger) ? 0 : yearStringConvertedToInteger;
267
- let newYear;
268
- if (key === 'ArrowUp') newYear = yearInteger + 1 <= 9999 ? yearInteger + 1 : yearInteger;else newYear = yearInteger - 1 > 0 ? yearInteger - 1 : 1;
269
- newYear = stringHelpers.prependStringWithPlaceHolders("".concat(newYear), 4);
270
- handleChangeYear(newYear, e);
233
+ let newYearInteger;
234
+ if (key === 'ArrowUp') newYearInteger = yearInteger + 1 <= 9999 ? yearInteger + 1 : yearInteger;else newYearInteger = yearInteger - 1 > 0 ? yearInteger - 1 : 1;
235
+ newYear = stringHelpers.prependStringWithPlaceHolders(`${newYearInteger}`, 4);
271
236
  }
272
237
 
273
- if (!Number.isNaN(yearStringConvertedToInteger) && key === ' ') {
274
- const newYear = stringHelpers.prependStringWithPlaceHolders("".concat(yearStringConvertedToInteger), 4);
275
- handleChangeYear(newYear, e); // auto-advance functionality:
238
+ const isAutomaticFillTrigger = newYear !== year && ['Tab', ' '].includes(key);
239
+ const metainfo = {
240
+ isAutomaticFillTrigger
241
+ };
242
+ /* ************* new year apply logic ************* */
243
+ // tab/spacebar applies auto-fill
244
+ // arrows up/down applies increment/decrement
276
245
 
277
- if (newYear.length === 4) {
278
- var _hourInputRef$current3, _hourInputRef$current4;
246
+ if (key === 'ArrowUp' || key === 'ArrowDown' || isAutomaticFillTrigger) {
247
+ handleChangeYear(newYear, e, metainfo);
248
+ }
249
+ /* ************* focus tracking logic ************* */
279
250
 
280
- 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) {
281
- var _clearButtonRef$curre5, _clearButtonRef$curre6, _pickerButtonRef$curr5, _pickerButtonRef$curr6;
282
251
 
283
- 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...
284
- }
285
- }
286
- } // regressive backspace functionality
252
+ let trackNextFocus = trackFocusResetter; // if nothing after, we reset internal focus tracker to avoid re-render unexpected focus shift
287
253
 
254
+ if (!hideTime) trackNextFocus = trackFocusHourInput;else if (withClearBtn) trackNextFocus = trackFocusClearBtn;else if (withAnyPicker) trackNextFocus = trackFocusPicker;
255
+ if (['Home', 'End', 'ArrowUp', 'ArrowDown', ' '].includes(key)) e.preventDefault();
256
+ if (['Home', 'End', 'ArrowUp', 'ArrowDown', ' '].includes(key)) e.stopPropagation();
257
+ if (key === 'Home') onHomeKeyDown();
258
+ if (key === 'End') onEndKeyDown();
259
+ /* ************** auto-advance logic ************** */
288
260
 
289
- if (key === 'Backspace' && (year === null || year === void 0 ? void 0 : year.length) === 0) {
290
- var _dayInputRef$current4, _dayInputRef$current5;
261
+ if (key === ' ') {
262
+ // auto-advance functionality:
263
+ trackNextFocus();
264
+ }
265
+ /* ********** regressive backspace logic ********** */
291
266
 
292
- 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);
293
- } // focus last fragment on fill with now
294
267
 
268
+ if (key === 'Backspace' && year?.length === 0) {
269
+ trackFocusDayInput();
270
+ } // focus last fragment on fill with now
295
271
 
296
- 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);
297
- }, [year, onHomeKeyDown, onEndKeyDown, lastSegmentRef, handleChangeYear, hideTime, hourInputRef, withAnyRightController, withClearBtn, clearButtonRef, withAnyPicker, pickerButtonRef, dayInputRef]);
298
- const onYearBlur = React.useCallback(e => {
299
- var _e$target6;
300
272
 
301
- const newYear = e === null || e === void 0 ? void 0 : (_e$target6 = e.target) === null || _e$target6 === void 0 ? void 0 : _e$target6.value;
302
- if (newYear.length > 0 && newYear.length < 4) handleChangeYear(stringHelpers.fillStringWithPlaceHolders(newYear, 4, '0'), e, {
303
- isAutomaticFillTrigger: true
304
- });
305
- }, [handleChangeYear]);
273
+ if ((ctrlKey || metaKey) && key === ';') trackFocusLastSegment();
274
+ }, [year, trackFocusResetter, hideTime, trackFocusHourInput, withClearBtn, trackFocusClearBtn, withAnyPicker, trackFocusPicker, onHomeKeyDown, onEndKeyDown, trackFocusLastSegment, trackFocusDayInput, handleChangeYear]);
275
+ const onYearBlur = React.useCallback(() => {// this was used before, now that we have a wrapping onBlur resetting the focus tracker, this is unused;
276
+ }, []);
306
277
  return React.useMemo(() => ({
307
278
  month,
308
279
  day,
@@ -28,7 +28,7 @@ const CalendarDaysList = /*#__PURE__*/React__default["default"].memo(_ref => {
28
28
  children: [invisibleFirstDay ? /*#__PURE__*/_jsx__default["default"](Day.Day, {
29
29
  metaDay: invisibleFirstDay,
30
30
  isInvisible: true
31
- }, "ds-calendar-".concat(invisibleFirstDay.day.toString())) : null, daysMatrixByWeekday.map((week, i) => /*#__PURE__*/_jsx__default["default"](Styleds.StyledWeekDaysListWrapper, {
31
+ }, `ds-calendar-${invisibleFirstDay.day.toString()}`) : null, daysMatrixByWeekday.map((week, i) => /*#__PURE__*/_jsx__default["default"](Styleds.StyledWeekDaysListWrapper, {
32
32
  role: "row",
33
33
  "aria-rowindex": i + 1,
34
34
  cols: ['32px', '32px', '32px', '32px', '32px', '32px', '32px'],
@@ -37,13 +37,13 @@ const CalendarDaysList = /*#__PURE__*/React__default["default"].memo(_ref => {
37
37
  px: "2px",
38
38
  justifyContent: "space-between",
39
39
  alignItems: "center"
40
- }, "ds-calendar-week-".concat(week[0].day.toString(), "-").concat(week[6].day.toString()), week.map((metaDay, z) => /*#__PURE__*/_jsx__default["default"](Day.Day, {
40
+ }, `ds-calendar-week-${week[0].day.toString()}-${week[6].day.toString()}`, week.map((metaDay, z) => /*#__PURE__*/_jsx__default["default"](Day.Day, {
41
41
  metaDay: metaDay,
42
42
  colIndex: z + 1
43
- }, "ds-calendar-".concat(metaDay.day.toString()))))), invisibleLastDay ? /*#__PURE__*/_jsx__default["default"](Day.Day, {
43
+ }, `ds-calendar-${metaDay.day.toString()}`)))), invisibleLastDay ? /*#__PURE__*/_jsx__default["default"](Day.Day, {
44
44
  metaDay: invisibleLastDay,
45
45
  isInvisible: true
46
- }, "ds-calendar-".concat(invisibleLastDay.day.toString())) : null]
46
+ }, `ds-calendar-${invisibleLastDay.day.toString()}`) : null]
47
47
  });
48
48
  });
49
49
 
@@ -23,8 +23,8 @@ const useGetFormattedCurrentDate = () => {
23
23
  currentMonth,
24
24
  currentYear
25
25
  } = React.useContext(CalendarContext.CalendarContext);
26
- const monthString = currentMonth >= 0 && currentMonth <= 11 ? "".concat(dateHelpers.getMonthNameByMonthNumber(currentMonth), " ") : '';
27
- return React.useMemo(() => "".concat(monthString).concat(currentYear), [monthString, currentYear]);
26
+ const monthString = currentMonth >= 0 && currentMonth <= 11 ? `${dateHelpers.getMonthNameByMonthNumber(currentMonth)} ` : '';
27
+ return React.useMemo(() => `${monthString}${currentYear}`, [monthString, currentYear]);
28
28
  };
29
29
 
30
30
  const CalendarHead = () => {
@@ -49,14 +49,32 @@ const CalendarHead = () => {
49
49
  prevYearBtnRef,
50
50
  prevMonthBtnRef,
51
51
  nextMonthBtnRef,
52
- nextYearBtnRef
52
+ nextYearBtnRef,
53
+ latestInteractionRegion,
54
+ currFocusDescriber
53
55
  } = React.useContext(ControlledDateTimePickerCTX.ControlledDateTimePickerContext);
56
+ const handlePrevYearRef = React.useCallback(ButtonDomNode => {
57
+ prevYearBtnRef.current = ButtonDomNode;
58
+ if (latestInteractionRegion === 'calendar-head' && currFocusDescriber === 'calendar-prev-year') ButtonDomNode?.focus?.();
59
+ }, [currFocusDescriber, latestInteractionRegion, prevYearBtnRef]);
60
+ const handlePrevMonthRef = React.useCallback(ButtonDomNode => {
61
+ prevMonthBtnRef.current = ButtonDomNode;
62
+ if (latestInteractionRegion === 'calendar-head' && currFocusDescriber === 'calendar-prev-month') ButtonDomNode?.focus?.();
63
+ }, [currFocusDescriber, latestInteractionRegion, prevMonthBtnRef]);
64
+ const handleNextMonthRef = React.useCallback(ButtonDomNode => {
65
+ nextMonthBtnRef.current = ButtonDomNode;
66
+ if (latestInteractionRegion === 'calendar-head' && currFocusDescriber === 'calendar-next-month') ButtonDomNode?.focus?.();
67
+ }, [currFocusDescriber, latestInteractionRegion, nextMonthBtnRef]);
68
+ const handleNextYearRef = React.useCallback(ButtonDomNode => {
69
+ nextYearBtnRef.current = ButtonDomNode;
70
+ if (latestInteractionRegion === 'calendar-head' && currFocusDescriber === 'calendar-next-year') ButtonDomNode?.focus?.();
71
+ }, [currFocusDescriber, latestInteractionRegion, nextYearBtnRef]);
54
72
  return /*#__PURE__*/_jsx__default["default"](Styleds.StyledHeader, {}, void 0, /*#__PURE__*/_jsx__default["default"](Styleds.StyledHeaderButton, {
55
73
  "aria-label": "previous year",
56
74
  buttonType: "raw",
57
75
  size: DSButton.BUTTON_SIZES.M,
58
76
  onClick: handlePrevYear,
59
- innerRef: prevYearBtnRef,
77
+ innerRef: handlePrevYearRef,
60
78
  onKeyDown: handlePrevYearKeyDown,
61
79
  onFocus: onPrevYearFocus,
62
80
  tabIndex: isControllerOnly ? -1 : 1,
@@ -71,7 +89,7 @@ const CalendarHead = () => {
71
89
  buttonType: "raw",
72
90
  size: DSButton.BUTTON_SIZES.M,
73
91
  onClick: handlePrevMonth,
74
- innerRef: prevMonthBtnRef,
92
+ innerRef: handlePrevMonthRef,
75
93
  onKeyDown: handlePrevMonthKeyDown,
76
94
  onFocus: onPrevMonthFocus,
77
95
  "data-testid": ControlledDateTimePickerDatatestid.ControlledDateTimePickerDatatestid.CALENDAR.PREV_MONTH // this is a tabstop for when the calendar is open
@@ -83,7 +101,7 @@ const CalendarHead = () => {
83
101
  buttonType: "raw",
84
102
  size: DSButton.BUTTON_SIZES.M,
85
103
  onClick: handleNextMonth,
86
- innerRef: nextMonthBtnRef,
104
+ innerRef: handleNextMonthRef,
87
105
  onKeyDown: handleNextMonthKeyDown,
88
106
  onFocus: onNextMonthFocus,
89
107
  "data-testid": ControlledDateTimePickerDatatestid.ControlledDateTimePickerDatatestid.CALENDAR.NEXT_MONTH
@@ -94,7 +112,7 @@ const CalendarHead = () => {
94
112
  buttonType: "raw",
95
113
  size: DSButton.BUTTON_SIZES.M,
96
114
  onClick: handleNextYear,
97
- innerRef: nextYearBtnRef,
115
+ innerRef: handleNextYearRef,
98
116
  onKeyDown: handleNextYearKeyDown,
99
117
  onFocus: onNextYearFocus,
100
118
  "data-testid": ControlledDateTimePickerDatatestid.ControlledDateTimePickerDatatestid.CALENDAR.NEXT_YEAR
@@ -32,7 +32,7 @@ const CalendarIconTrigger = () => {
32
32
  ariaCurrentValueForInputs
33
33
  } = React.useContext(ControlledDateTimePickerCTX.ControlledDateTimePickerContext);
34
34
  return React.useMemo(() => /*#__PURE__*/_jsx__default["default"](Styleds.StyledIconTriggerButton, {
35
- "aria-label": "date picker context menu trigger, ".concat(ariaCurrentValueForInputs),
35
+ "aria-label": `date picker context menu trigger, ${ariaCurrentValueForInputs}`,
36
36
  buttonType: "icon",
37
37
  size: DSButton.BUTTON_SIZES.M,
38
38
  innerRef: handleSetTriggerRef,
@@ -58,17 +58,16 @@ const Day = _ref => {
58
58
  appOnDayChange,
59
59
  appOnYearChange,
60
60
  latestInteractionRegion,
61
- setLatestInteractionRegion,
62
- isWithTimeWheelToo
61
+ isWithTimeWheelToo,
62
+ trackFocusCalendarMetafocusedDay
63
63
  } = React.useContext(ControlledDateTimePickerCTX.ControlledDateTimePickerContext);
64
64
  const {
65
65
  focusedDay,
66
66
  handleDayOnKeyDown,
67
67
  handleFocusMetaDayByDay,
68
- closeCalendar,
69
- tryToFocusCurrentlyDataIsFocusedDay
68
+ closeCalendar
70
69
  } = React.useContext(CalendarContext.CalendarContext);
71
- const isFocusedMetaDay = focusedDay !== null && focusedDay !== void 0 && focusedDay.day ? dateHelpers.compareTwoDatesDayEquality(metaDay === null || metaDay === void 0 ? void 0 : metaDay.day, focusedDay === null || focusedDay === void 0 ? void 0 : focusedDay.day) : false;
70
+ const isFocusedMetaDay = focusedDay?.day ? dateHelpers.compareTwoDatesDayEquality(metaDay?.day, focusedDay?.day) : false;
72
71
  const isSelected = React.useMemo(() => {
73
72
  const selectedDate = dateHelpers.getDayFromDateString(dateStringFromProps);
74
73
  return selectedDate ? dateHelpers.isSameDateMoment(day, selectedDate) : false;
@@ -81,7 +80,6 @@ const Day = _ref => {
81
80
  const isDayInRange = !isStartRangeDay && !isEndRangeDay && getIsDayInRange(metaDay.dayAsString);
82
81
  const handleOnDayClick = React.useCallback(e => {
83
82
  handleFocusMetaDayByDay(day);
84
- tryToFocusCurrentlyDataIsFocusedDay();
85
83
 
86
84
  if (!isDisabled && !isOutOfRange) {
87
85
  const newDateString = dateHelpers.getDateStringFromDay(day);
@@ -95,18 +93,24 @@ const Day = _ref => {
95
93
  day: dayNumber,
96
94
  year
97
95
  } = dateHelpers.getDateValuesFromDate(day);
98
- appOnMonthChange("".concat(month + 1), e, metaInfo);
99
- if (dayNumber) appOnDayChange("".concat(dayNumber), e, metaInfo);
100
- appOnYearChange("".concat(year), e, metaInfo);
96
+ appOnMonthChange(`${month + 1}`, e, metaInfo);
97
+ if (dayNumber) appOnDayChange(`${dayNumber}`, e, metaInfo);
98
+ appOnYearChange(`${year}`, e, metaInfo);
101
99
  handleChangeComposedDateString(newDateString, metaInfo);
102
- setLatestInteractionRegion('calendar-days');
100
+ trackFocusCalendarMetafocusedDay();
103
101
  if (!isWithTimeWheelToo && !preventCloseOnSelection) closeCalendar();
104
102
  }
105
- }, [isDisabled, isOutOfRange, day, appOnMonthChange, appOnDayChange, appOnYearChange, handleChangeComposedDateString, handleFocusMetaDayByDay, tryToFocusCurrentlyDataIsFocusedDay, setLatestInteractionRegion, isWithTimeWheelToo, preventCloseOnSelection, closeCalendar]);
103
+ }, [handleFocusMetaDayByDay, day, isDisabled, isOutOfRange, appOnMonthChange, appOnDayChange, appOnYearChange, handleChangeComposedDateString, trackFocusCalendarMetafocusedDay, isWithTimeWheelToo, preventCloseOnSelection, closeCalendar]);
104
+ const handleInnerRef = React.useCallback(ButtonDomNode => {
105
+ window.requestAnimationFrame(() => {
106
+ dayBtnRef.current = ButtonDomNode;
107
+ if (isFocused) ButtonDomNode?.focus?.();
108
+ });
109
+ }, [dayBtnRef, isFocused]);
106
110
  const handleOnDayFocus = React.useCallback(() => {
107
- setLatestInteractionRegion('calendar-days');
108
- }, [setLatestInteractionRegion]);
109
- const dayClassModifiers = React.useMemo(() => "dayWrapper ".concat(isSelected ? 'selectedDay ' : '').concat(isDisabled ? 'disabledDay ' : '').concat(isOutOfRange ? 'outOfRangeDay ' : '').concat(isFocused ? 'focusedDay ' : '').concat(isStartRangeDay ? 'startRangeDay ' : '').concat(isDayInRange ? 'inRangeDay ' : '').concat(isEndRangeDay ? 'endRangeDay ' : '').concat(isCurrMonthDay ? '' : 'notCurrentMonth'), [isSelected, isDisabled, isOutOfRange, isFocused, isStartRangeDay, isDayInRange, isEndRangeDay, isCurrMonthDay]);
111
+ trackFocusCalendarMetafocusedDay('calendar-days');
112
+ }, [trackFocusCalendarMetafocusedDay]);
113
+ const dayClassModifiers = React.useMemo(() => `dayWrapper ${isSelected ? 'selectedDay ' : ''}${isDisabled ? 'disabledDay ' : ''}${isOutOfRange ? 'outOfRangeDay ' : ''}${isFocused ? 'focusedDay ' : ''}${isStartRangeDay ? 'startRangeDay ' : ''}${isDayInRange ? 'inRangeDay ' : ''}${isEndRangeDay ? 'endRangeDay ' : ''}${isCurrMonthDay ? '' : 'notCurrentMonth'}`, [isSelected, isDisabled, isOutOfRange, isFocused, isStartRangeDay, isDayInRange, isEndRangeDay, isCurrMonthDay]);
110
114
  let dataTestid = ControlledDateTimePickerDatatestid.ControlledDateTimePickerDatatestid.CALENDAR.DAY;
111
115
  if (isSelected) dataTestid = ControlledDateTimePickerDatatestid.ControlledDateTimePickerDatatestid.CALENDAR.SELECTED_DAY;
112
116
  if (isFocused) dataTestid = ControlledDateTimePickerDatatestid.ControlledDateTimePickerDatatestid.CALENDAR.FOCUSED_DAY;
@@ -122,7 +126,7 @@ const Day = _ref => {
122
126
  'aria-colindex': colIndex
123
127
  }), {}, {
124
128
  children: /*#__PURE__*/_jsx__default["default"](Styleds.StyledDayBtn, {
125
- "aria-label": "".concat(stringHelpers.getAriaDayFromDateString(dayAsString), ", ").concat(constants.weekDays[metaDay.day.getDay()]),
129
+ "aria-label": `${stringHelpers.getAriaDayFromDateString(dayAsString)}, ${constants.weekDays[metaDay.day.getDay()]}`,
126
130
  "aria-disabled": isOutOfRange || isDisabled,
127
131
  "aria-hidden": !!isInvisible,
128
132
  buttonType: "raw",
@@ -133,11 +137,11 @@ const Day = _ref => {
133
137
  onKeyDown: e => {
134
138
  handleDayOnKeyDown(e, metaDay);
135
139
  },
136
- innerRef: dayBtnRef,
140
+ innerRef: handleInnerRef,
137
141
  tabIndex: isSelected ? 0 : -1,
138
142
  "data-isfocused": isFocused,
139
143
  "data-testid": dataTestid
140
- }, void 0, "".concat(day.getDate()))
144
+ }, void 0, `${day.getDate()}`)
141
145
  }));
142
146
  };
143
147
 
@@ -2,7 +2,6 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var _taggedTemplateLiteral = require('@babel/runtime/helpers/taggedTemplateLiteral');
6
5
  var styled = require('styled-components');
7
6
  var dsSystem = require('@elliemae/ds-system');
8
7
  var dsGrid = require('@elliemae/ds-grid');
@@ -10,46 +9,76 @@ var DSButton = require('@elliemae/ds-button');
10
9
 
11
10
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
12
11
 
13
- var _taggedTemplateLiteral__default = /*#__PURE__*/_interopDefaultLegacy(_taggedTemplateLiteral);
14
12
  var styled__default = /*#__PURE__*/_interopDefaultLegacy(styled);
15
13
 
16
- var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5;
17
- const diagonalLine = dsSystem.css(_templateObject || (_templateObject = _taggedTemplateLiteral__default["default"](["\n &:before {\n position: absolute;\n content: '';\n top: 48%;\n left: -2px;\n height: 1px;\n width: calc(100% + 4px);\n transform: rotate(45deg);\n background-color: ", ";\n }\n"])), _ref => {
14
+ /* eslint-disable max-lines */
15
+ const diagonalLine = dsSystem.css`
16
+ &:before {
17
+ position: absolute;
18
+ content: '';
19
+ top: 48%;
20
+ left: -2px;
21
+ height: 1px;
22
+ width: calc(100% + 4px);
23
+ transform: rotate(45deg);
24
+ background-color: ${_ref => {
18
25
  let {
19
26
  theme
20
27
  } = _ref;
21
28
  return theme.colors.neutral[500];
22
- });
23
- const focusBorder = dsSystem.css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral__default["default"](["\n &:after {\n position: absolute;\n content: '';\n top: -4px;\n left: -4px;\n width: calc(100% + 8px);\n height: calc(100% + 8px);\n border-radius: 50%;\n }\n"])));
29
+ }};
30
+ }
31
+ `;
32
+ const focusBorder = dsSystem.css`
33
+ &:after {
34
+ position: absolute;
35
+ content: '';
36
+ top: -4px;
37
+ left: -4px;
38
+ width: calc(100% + 8px);
39
+ height: calc(100% + 8px);
40
+ border-radius: 50%;
41
+ }
42
+ `;
24
43
  const backgroundDateRange = {
25
- inRange: dsSystem.css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral__default["default"](["\n background-color: ", ";\n box-shadow: 4px 0 0 0 ", ";\n "])), _ref2 => {
44
+ inRange: dsSystem.css`
45
+ background-color: ${_ref2 => {
26
46
  let {
27
47
  theme
28
48
  } = _ref2;
29
49
  return theme.colors.brand[200];
30
- }, _ref3 => {
50
+ }};
51
+ box-shadow: 4px 0 0 0 ${_ref3 => {
31
52
  let {
32
53
  theme
33
54
  } = _ref3;
34
55
  return theme.colors.brand[200];
35
- }),
36
- startRange: dsSystem.css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral__default["default"](["\n background-color: ", ";\n border-radius: 50% 0 0 50%;\n box-shadow: 4px 0 0 0 ", ";\n "])), _ref4 => {
56
+ }};
57
+ `,
58
+ startRange: dsSystem.css`
59
+ background-color: ${_ref4 => {
37
60
  let {
38
61
  theme
39
62
  } = _ref4;
40
63
  return theme.colors.brand[200];
41
- }, _ref5 => {
64
+ }};
65
+ border-radius: 50% 0 0 50%;
66
+ box-shadow: 4px 0 0 0 ${_ref5 => {
42
67
  let {
43
68
  theme
44
69
  } = _ref5;
45
70
  return theme.colors.brand[200];
46
- }),
47
- endRange: dsSystem.css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral__default["default"](["\n background-color: ", ";\n border-radius: 0 50% 50% 0;\n "])), _ref6 => {
71
+ }};
72
+ `,
73
+ endRange: dsSystem.css`
74
+ background-color: ${_ref6 => {
48
75
  let {
49
76
  theme
50
77
  } = _ref6;
51
78
  return theme.colors.brand[200];
52
- })
79
+ }};
80
+ border-radius: 0 50% 50% 0;
81
+ `
53
82
  };
54
83
  const StyledIconTriggerButton = /*#__PURE__*/styled__default["default"](DSButton.DSButtonV2).withConfig({
55
84
  componentId: "sc-1vlmm1g-0"
@@ -139,7 +168,7 @@ const StyledWeekDaysListWrapper = /*#__PURE__*/styled__default["default"](dsGrid
139
168
  isHeader,
140
169
  theme
141
170
  } = _ref19;
142
- return isHeader ? "background: ".concat(theme.colors.neutral['050']) : '';
171
+ return isHeader ? `background: ${theme.colors.neutral['050']}` : '';
143
172
  }, _ref20 => {
144
173
  let {
145
174
  isHeader