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