@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
@@ -49,17 +49,16 @@ const Day = _ref => {
49
49
  appOnDayChange,
50
50
  appOnYearChange,
51
51
  latestInteractionRegion,
52
- setLatestInteractionRegion,
53
- isWithTimeWheelToo
52
+ isWithTimeWheelToo,
53
+ trackFocusCalendarMetafocusedDay
54
54
  } = useContext(ControlledDateTimePickerContext);
55
55
  const {
56
56
  focusedDay,
57
57
  handleDayOnKeyDown,
58
58
  handleFocusMetaDayByDay,
59
- closeCalendar,
60
- tryToFocusCurrentlyDataIsFocusedDay
59
+ closeCalendar
61
60
  } = useContext(CalendarContext);
62
- const isFocusedMetaDay = focusedDay !== null && focusedDay !== void 0 && focusedDay.day ? compareTwoDatesDayEquality(metaDay === null || metaDay === void 0 ? void 0 : metaDay.day, focusedDay === null || focusedDay === void 0 ? void 0 : focusedDay.day) : false;
61
+ const isFocusedMetaDay = focusedDay?.day ? compareTwoDatesDayEquality(metaDay?.day, focusedDay?.day) : false;
63
62
  const isSelected = useMemo(() => {
64
63
  const selectedDate = getDayFromDateString(dateStringFromProps);
65
64
  return selectedDate ? isSameDateMoment(day, selectedDate) : false;
@@ -72,7 +71,6 @@ const Day = _ref => {
72
71
  const isDayInRange = !isStartRangeDay && !isEndRangeDay && getIsDayInRange(metaDay.dayAsString);
73
72
  const handleOnDayClick = useCallback(e => {
74
73
  handleFocusMetaDayByDay(day);
75
- tryToFocusCurrentlyDataIsFocusedDay();
76
74
 
77
75
  if (!isDisabled && !isOutOfRange) {
78
76
  const newDateString = getDateStringFromDay(day);
@@ -86,18 +84,24 @@ const Day = _ref => {
86
84
  day: dayNumber,
87
85
  year
88
86
  } = getDateValuesFromDate(day);
89
- appOnMonthChange("".concat(month + 1), e, metaInfo);
90
- if (dayNumber) appOnDayChange("".concat(dayNumber), e, metaInfo);
91
- appOnYearChange("".concat(year), e, metaInfo);
87
+ appOnMonthChange(`${month + 1}`, e, metaInfo);
88
+ if (dayNumber) appOnDayChange(`${dayNumber}`, e, metaInfo);
89
+ appOnYearChange(`${year}`, e, metaInfo);
92
90
  handleChangeComposedDateString(newDateString, metaInfo);
93
- setLatestInteractionRegion('calendar-days');
91
+ trackFocusCalendarMetafocusedDay();
94
92
  if (!isWithTimeWheelToo && !preventCloseOnSelection) closeCalendar();
95
93
  }
96
- }, [isDisabled, isOutOfRange, day, appOnMonthChange, appOnDayChange, appOnYearChange, handleChangeComposedDateString, handleFocusMetaDayByDay, tryToFocusCurrentlyDataIsFocusedDay, setLatestInteractionRegion, isWithTimeWheelToo, preventCloseOnSelection, closeCalendar]);
94
+ }, [handleFocusMetaDayByDay, day, isDisabled, isOutOfRange, appOnMonthChange, appOnDayChange, appOnYearChange, handleChangeComposedDateString, trackFocusCalendarMetafocusedDay, isWithTimeWheelToo, preventCloseOnSelection, closeCalendar]);
95
+ const handleInnerRef = useCallback(ButtonDomNode => {
96
+ window.requestAnimationFrame(() => {
97
+ dayBtnRef.current = ButtonDomNode;
98
+ if (isFocused) ButtonDomNode?.focus?.();
99
+ });
100
+ }, [dayBtnRef, isFocused]);
97
101
  const handleOnDayFocus = useCallback(() => {
98
- setLatestInteractionRegion('calendar-days');
99
- }, [setLatestInteractionRegion]);
100
- const dayClassModifiers = 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]);
102
+ trackFocusCalendarMetafocusedDay('calendar-days');
103
+ }, [trackFocusCalendarMetafocusedDay]);
104
+ const dayClassModifiers = 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]);
101
105
  let dataTestid = ControlledDateTimePickerDatatestid.CALENDAR.DAY;
102
106
  if (isSelected) dataTestid = ControlledDateTimePickerDatatestid.CALENDAR.SELECTED_DAY;
103
107
  if (isFocused) dataTestid = ControlledDateTimePickerDatatestid.CALENDAR.FOCUSED_DAY;
@@ -113,7 +117,7 @@ const Day = _ref => {
113
117
  'aria-colindex': colIndex
114
118
  }), {}, {
115
119
  children: /*#__PURE__*/_jsx(StyledDayBtn, {
116
- "aria-label": "".concat(getAriaDayFromDateString(dayAsString), ", ").concat(weekDays[metaDay.day.getDay()]),
120
+ "aria-label": `${getAriaDayFromDateString(dayAsString)}, ${weekDays[metaDay.day.getDay()]}`,
117
121
  "aria-disabled": isOutOfRange || isDisabled,
118
122
  "aria-hidden": !!isInvisible,
119
123
  buttonType: "raw",
@@ -124,11 +128,11 @@ const Day = _ref => {
124
128
  onKeyDown: e => {
125
129
  handleDayOnKeyDown(e, metaDay);
126
130
  },
127
- innerRef: dayBtnRef,
131
+ innerRef: handleInnerRef,
128
132
  tabIndex: isSelected ? 0 : -1,
129
133
  "data-isfocused": isFocused,
130
134
  "data-testid": dataTestid
131
- }, void 0, "".concat(day.getDate()))
135
+ }, void 0, `${day.getDate()}`)
132
136
  }));
133
137
  };
134
138
 
@@ -1,46 +1,76 @@
1
- import _taggedTemplateLiteral from '@babel/runtime/helpers/esm/taggedTemplateLiteral';
2
1
  import styled from 'styled-components';
3
2
  import { css } from '@elliemae/ds-system';
4
3
  import { Grid } from '@elliemae/ds-grid';
5
4
  import { DSButtonV2 } from '@elliemae/ds-button';
6
5
 
7
- var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5;
8
- const diagonalLine = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\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 => {
6
+ /* eslint-disable max-lines */
7
+ const diagonalLine = css`
8
+ &:before {
9
+ position: absolute;
10
+ content: '';
11
+ top: 48%;
12
+ left: -2px;
13
+ height: 1px;
14
+ width: calc(100% + 4px);
15
+ transform: rotate(45deg);
16
+ background-color: ${_ref => {
9
17
  let {
10
18
  theme
11
19
  } = _ref;
12
20
  return theme.colors.neutral[500];
13
- });
14
- const focusBorder = css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\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"])));
21
+ }};
22
+ }
23
+ `;
24
+ const focusBorder = css`
25
+ &:after {
26
+ position: absolute;
27
+ content: '';
28
+ top: -4px;
29
+ left: -4px;
30
+ width: calc(100% + 8px);
31
+ height: calc(100% + 8px);
32
+ border-radius: 50%;
33
+ }
34
+ `;
15
35
  const backgroundDateRange = {
16
- inRange: css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n background-color: ", ";\n box-shadow: 4px 0 0 0 ", ";\n "])), _ref2 => {
36
+ inRange: css`
37
+ background-color: ${_ref2 => {
17
38
  let {
18
39
  theme
19
40
  } = _ref2;
20
41
  return theme.colors.brand[200];
21
- }, _ref3 => {
42
+ }};
43
+ box-shadow: 4px 0 0 0 ${_ref3 => {
22
44
  let {
23
45
  theme
24
46
  } = _ref3;
25
47
  return theme.colors.brand[200];
26
- }),
27
- startRange: css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n background-color: ", ";\n border-radius: 50% 0 0 50%;\n box-shadow: 4px 0 0 0 ", ";\n "])), _ref4 => {
48
+ }};
49
+ `,
50
+ startRange: css`
51
+ background-color: ${_ref4 => {
28
52
  let {
29
53
  theme
30
54
  } = _ref4;
31
55
  return theme.colors.brand[200];
32
- }, _ref5 => {
56
+ }};
57
+ border-radius: 50% 0 0 50%;
58
+ box-shadow: 4px 0 0 0 ${_ref5 => {
33
59
  let {
34
60
  theme
35
61
  } = _ref5;
36
62
  return theme.colors.brand[200];
37
- }),
38
- endRange: css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n background-color: ", ";\n border-radius: 0 50% 50% 0;\n "])), _ref6 => {
63
+ }};
64
+ `,
65
+ endRange: css`
66
+ background-color: ${_ref6 => {
39
67
  let {
40
68
  theme
41
69
  } = _ref6;
42
70
  return theme.colors.brand[200];
43
- })
71
+ }};
72
+ border-radius: 0 50% 50% 0;
73
+ `
44
74
  };
45
75
  const StyledIconTriggerButton = /*#__PURE__*/styled(DSButtonV2).withConfig({
46
76
  componentId: "sc-1vlmm1g-0"
@@ -130,7 +160,7 @@ const StyledWeekDaysListWrapper = /*#__PURE__*/styled(Grid).withConfig({
130
160
  isHeader,
131
161
  theme
132
162
  } = _ref19;
133
- return isHeader ? "background: ".concat(theme.colors.neutral['050']) : '';
163
+ return isHeader ? `background: ${theme.colors.neutral['050']}` : '';
134
164
  }, _ref20 => {
135
165
  let {
136
166
  isHeader
@@ -4,7 +4,6 @@ import 'core-js/modules/esnext.iterator.filter.js';
4
4
  import 'core-js/modules/esnext.async-iterator.for-each.js';
5
5
  import 'core-js/modules/esnext.iterator.for-each.js';
6
6
  import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
7
- import 'core-js/modules/web.dom-collections.iterator.js';
8
7
  import { useContext, useState, useCallback, useMemo } from 'react';
9
8
  import { ControlledDateTimePickerContext } from '../../../ControlledDateTimePickerCTX.js';
10
9
  import { useCurrentDisplayedMonthYearLogic } from './useCurrentDisplayedMonthYearLogic.js';
@@ -17,24 +16,24 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
17
16
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
18
17
  const useConfigCalendarCTX = () => {
19
18
  const {
20
- setLatestInteractionRegion
19
+ trackFocusCalendarPrevYear,
20
+ trackFocusCalendarNextYear,
21
+ trackFocusCalendarPrevMonth,
22
+ trackFocusCalendarNextMonth
21
23
  } = useContext(ControlledDateTimePickerContext);
22
24
  const [showCalendar, setShowCalendar] = useState(false);
23
- const setLatestInteractionRegionCalendarHead = useCallback(() => {
24
- setLatestInteractionRegion('calendar-head');
25
- }, [setLatestInteractionRegion]);
26
25
  const onPrevYearFocus = useCallback(() => {
27
- setLatestInteractionRegionCalendarHead();
28
- }, [setLatestInteractionRegionCalendarHead]);
26
+ trackFocusCalendarPrevYear();
27
+ }, [trackFocusCalendarPrevYear]);
29
28
  const onPrevMonthFocus = useCallback(() => {
30
- setLatestInteractionRegionCalendarHead();
31
- }, [setLatestInteractionRegionCalendarHead]);
29
+ trackFocusCalendarPrevMonth();
30
+ }, [trackFocusCalendarPrevMonth]);
32
31
  const onNextMonthFocus = useCallback(() => {
33
- setLatestInteractionRegionCalendarHead();
34
- }, [setLatestInteractionRegionCalendarHead]);
32
+ trackFocusCalendarNextMonth();
33
+ }, [trackFocusCalendarNextMonth]);
35
34
  const onNextYearFocus = useCallback(() => {
36
- setLatestInteractionRegionCalendarHead();
37
- }, [setLatestInteractionRegionCalendarHead]);
35
+ trackFocusCalendarNextYear();
36
+ }, [trackFocusCalendarNextYear]);
38
37
  const currentDisplayedMonthLogic = useCurrentDisplayedMonthYearLogic();
39
38
  const focusLogic = useFocusLogic({
40
39
  currentDisplayedMonthLogic,
@@ -1,8 +1,9 @@
1
- import 'core-js/modules/web.dom-collections.iterator.js';
2
1
  import { useState, useEffect, useMemo, createRef, useCallback } from 'react';
3
2
  import { useGetMonthYearFromDateStringOrEmptyStartingMonth } from '../../../utils/hooks/useGetMonthYearFromDateStringOrEmptyStartingMonth.js';
4
3
  import { getFiveBySevenCurrentMonthDaysMatrix, sumValuesToDate, getDateStringFromDay, sumFromDateValues } from '../../../utils/dateHelpers.js';
5
4
 
5
+ /* eslint-disable complexity */
6
+
6
7
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
7
8
  function sliceIntoChunks(arr, chunkSize) {
8
9
  const res = [];
@@ -1,33 +1,14 @@
1
- import 'core-js/modules/web.dom-collections.iterator.js';
2
1
  import 'core-js/modules/esnext.async-iterator.find.js';
3
2
  import 'core-js/modules/esnext.iterator.constructor.js';
4
3
  import 'core-js/modules/esnext.iterator.find.js';
5
- import { useContext, useState, useMemo, useCallback, useLayoutEffect } from 'react';
6
- import { ControlledDateTimePickerContext } from '../../../ControlledDateTimePickerCTX.js';
4
+ import { useState, useMemo, useCallback } from 'react';
7
5
  import { compareTwoDatesDayEquality } from '../../../utils/dateHelpers.js';
8
6
  import { useGetStartingFocusedDay } from '../../../utils/hooks/useGetStartingFocusedDay.js';
9
7
 
10
- // eslint-disable-next-line max-params
11
- const loopWhileWaiting = function (cb) {
12
- let shortcircuit = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : () => false;
13
- let timePerTry = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 100;
14
- let maxTries = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 5;
15
- let ab = maxTries;
16
- const inter = setInterval(() => {
17
- cb();
18
- if (shortcircuit() || ab === 0) clearInterval(inter);
19
- ab -= 1;
20
- }, timePerTry);
21
- };
22
-
23
8
  const useFocusLogic = _ref => {
24
9
  let {
25
- currentDisplayedMonthLogic,
26
- showCalendar
10
+ currentDisplayedMonthLogic
27
11
  } = _ref;
28
- const {
29
- calendarDaysWrapperRef
30
- } = useContext(ControlledDateTimePickerContext);
31
12
  const {
32
13
  daysArray
33
14
  } = currentDisplayedMonthLogic;
@@ -59,23 +40,6 @@ const useFocusLogic = _ref => {
59
40
  });
60
41
  return newFocusedDay;
61
42
  }, [daysArray, startFocusedDate, metadayToFocus]);
62
- const tryToFocusCurrentlyDataIsFocusedDay = useCallback(function () {
63
- let wrapperDOM = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : (calendarDaysWrapperRef === null || calendarDaysWrapperRef === void 0 ? void 0 : calendarDaysWrapperRef.current) || document;
64
- let shortcircuit = false;
65
- loopWhileWaiting(() => {
66
- const domElem = wrapperDOM === null || wrapperDOM === void 0 ? void 0 : wrapperDOM.querySelector('[data-isfocused="true"]');
67
-
68
- if (domElem) {
69
- var _domElem$focus;
70
-
71
- domElem === null || domElem === void 0 ? void 0 : (_domElem$focus = domElem.focus) === null || _domElem$focus === void 0 ? void 0 : _domElem$focus.call(domElem);
72
- shortcircuit = true;
73
- }
74
- }, () => shortcircuit);
75
- }, [calendarDaysWrapperRef]);
76
- useLayoutEffect(() => {
77
- if (showCalendar) tryToFocusCurrentlyDataIsFocusedDay(calendarDaysWrapperRef === null || calendarDaysWrapperRef === void 0 ? void 0 : calendarDaysWrapperRef.current);
78
- }, [calendarDaysWrapperRef, focusedDay, showCalendar, tryToFocusCurrentlyDataIsFocusedDay]);
79
43
  const handleFocusMetaDay = useCallback(metaDayToFocus => {
80
44
  // if focusedDay is inside current daysArray we set Focused day
81
45
  const newFocusedMetaDay = daysArray.find(_ref5 => {
@@ -101,11 +65,10 @@ const useFocusLogic = _ref => {
101
65
  }, []);
102
66
  return useMemo(() => ({
103
67
  focusedDay,
104
- tryToFocusCurrentlyDataIsFocusedDay,
105
68
  resetFocusedDayToStartDate,
106
69
  handleFocusMetaDay,
107
70
  handleFocusMetaDayByDay
108
- }), [focusedDay, tryToFocusCurrentlyDataIsFocusedDay, resetFocusedDayToStartDate, handleFocusMetaDay, handleFocusMetaDayByDay]);
71
+ }), [focusedDay, resetFocusedDayToStartDate, handleFocusMetaDay, handleFocusMetaDayByDay]);
109
72
  };
110
73
 
111
74
  export { useFocusLogic };
@@ -4,7 +4,6 @@ import 'core-js/modules/esnext.iterator.find.js';
4
4
  import { useContext, useCallback, useMemo } from 'react';
5
5
  import { ControlledDateTimePickerContext } from '../../../ControlledDateTimePickerCTX.js';
6
6
  import { sumValuesToDate } from '../../../utils/dateHelpers.js';
7
- import { homeEndKeys, homeEndAllArrowKeys } from '../../../utils/constants.js';
8
7
 
9
8
  const useKeyboardHandlers = _ref => {
10
9
  let {
@@ -12,29 +11,26 @@ const useKeyboardHandlers = _ref => {
12
11
  focusLogic
13
12
  } = _ref;
14
13
  const {
15
- hideDate,
16
- hideTime,
17
- monthInputRef,
18
- hourInputRef,
19
- prevYearBtnRef,
20
- prevMonthBtnRef,
21
- nextMonthBtnRef,
22
- nextYearBtnRef,
23
- currMeridiemBtnRef,
24
14
  isControllerOnly,
25
15
  isWithTimeWheelToo,
26
- setLatestInteractionRegion,
27
16
  withAnyInputs,
28
17
  isWithTimeInputs,
29
- meridiemInputRef,
30
18
  isWithDateInputs,
31
- yearInputRef
19
+ trackFocusFirstSegment,
20
+ trackFocusMeridiemInput,
21
+ trackFocusYearInput,
22
+ trackFocusCalendarPrevMonth,
23
+ trackFocusCalendarNextMonth,
24
+ trackFocusCalendarNextYear,
25
+ trackFocusCalendarPrevYear,
26
+ trackFocusTimewheelCurrMeridiem,
27
+ trackFocusCalendarMetafocusedDay
32
28
  } = useContext(ControlledDateTimePickerContext);
33
29
  const {
34
30
  focusedDay,
35
31
  handleFocusMetaDay,
36
- handleFocusMetaDayByDay,
37
- tryToFocusCurrentlyDataIsFocusedDay
32
+ handleFocusMetaDayByDay // tryToFocusCurrentlyDataIsFocusedDay
33
+
38
34
  } = focusLogic;
39
35
  const {
40
36
  daysArray,
@@ -42,8 +38,6 @@ const useKeyboardHandlers = _ref => {
42
38
  handleNextMonth
43
39
  } = currentDisplayedMonthLogic;
44
40
  const tryToFocusDayRegion = useCallback(() => {
45
- setLatestInteractionRegion('calendar-days');
46
-
47
41
  if (!focusedDay) {
48
42
  const newFocusDay = daysArray.find(_ref2 => {
49
43
  let {
@@ -51,42 +45,32 @@ const useKeyboardHandlers = _ref => {
51
45
  } = _ref2;
52
46
  return isCurrMonthDay;
53
47
  });
54
- if (newFocusDay) setTimeout(() => {
55
- handleFocusMetaDay(newFocusDay);
56
- });
57
- } else {
58
- tryToFocusCurrentlyDataIsFocusedDay();
48
+ if (newFocusDay) handleFocusMetaDay(newFocusDay);
59
49
  }
60
- }, [daysArray, focusedDay, handleFocusMetaDay, setLatestInteractionRegion, tryToFocusCurrentlyDataIsFocusedDay]);
61
- const onHomeKeyDownInsideCalendar = useCallback(() => {
62
- var _prevMonthBtnRef$curr, _prevMonthBtnRef$curr2;
63
50
 
64
- 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);
65
- }, [prevMonthBtnRef]);
51
+ trackFocusCalendarMetafocusedDay();
52
+ }, [daysArray, focusedDay, handleFocusMetaDay, trackFocusCalendarMetafocusedDay]);
53
+ const onHomeKeyDownInsideCalendar = useCallback(() => {
54
+ trackFocusCalendarPrevMonth();
55
+ }, [trackFocusCalendarPrevMonth]);
66
56
  const onEndKeyDownInsideCalendar = useCallback(() => {
67
- var _currMeridiemBtnRef$c, _currMeridiemBtnRef$c2;
68
-
69
- if (isWithTimeWheelToo) currMeridiemBtnRef === null || currMeridiemBtnRef === void 0 ? void 0 : (_currMeridiemBtnRef$c = currMeridiemBtnRef.current) === null || _currMeridiemBtnRef$c === void 0 ? void 0 : (_currMeridiemBtnRef$c2 = _currMeridiemBtnRef$c.focus) === null || _currMeridiemBtnRef$c2 === void 0 ? void 0 : _currMeridiemBtnRef$c2.call(_currMeridiemBtnRef$c);else tryToFocusDayRegion();
70
- }, [currMeridiemBtnRef, isWithTimeWheelToo, tryToFocusDayRegion]);
57
+ if (isWithTimeWheelToo) trackFocusTimewheelCurrMeridiem();else tryToFocusDayRegion();
58
+ }, [isWithTimeWheelToo, trackFocusTimewheelCurrMeridiem, tryToFocusDayRegion]);
71
59
  const onHomeKeyDownTriggerIcon = useCallback(() => {
72
- var _monthInputRef$curren, _monthInputRef$curren2, _hourInputRef$current, _hourInputRef$current2;
73
-
74
- 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);
75
- }, [hideDate, hideTime, monthInputRef, hourInputRef]);
60
+ trackFocusFirstSegment();
61
+ }, [trackFocusFirstSegment]);
76
62
  const handlePickerIconKeyDown = useCallback(e => {
77
63
  const {
78
64
  key
79
65
  } = e;
80
- if (homeEndKeys.includes(key)) e.preventDefault();
81
- if (homeEndKeys.includes(key)) e.stopPropagation();
66
+ if (['Home', 'End'].includes(key)) e.preventDefault();
67
+ if (['Home', 'End'].includes(key)) e.stopPropagation();
82
68
  if (key === 'Home') onHomeKeyDownTriggerIcon();
83
69
 
84
70
  if (key === 'Backspace' && withAnyInputs) {
85
- var _meridiemInputRef$cur, _meridiemInputRef$cur2, _yearInputRef$current, _yearInputRef$current2;
86
-
87
- 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);
71
+ if (isWithTimeInputs) trackFocusMeridiemInput();else if (isWithDateInputs) trackFocusYearInput();
88
72
  }
89
- }, [isWithDateInputs, isWithTimeInputs, meridiemInputRef, onHomeKeyDownTriggerIcon, withAnyInputs, yearInputRef]);
73
+ }, [isWithDateInputs, isWithTimeInputs, onHomeKeyDownTriggerIcon, trackFocusMeridiemInput, trackFocusYearInput, withAnyInputs]);
90
74
  const handleDayOnKeyDown = useCallback((e, metaDay) => {
91
75
  let newFocusedDayDate;
92
76
  const {
@@ -96,8 +80,8 @@ const useKeyboardHandlers = _ref => {
96
80
  key,
97
81
  shiftKey
98
82
  } = e;
99
- if (homeEndAllArrowKeys.includes(key)) e.preventDefault();
100
- if (homeEndAllArrowKeys.includes(key)) e.stopPropagation();
83
+ if (['Home', 'End', 'ArrowUp', 'ArrowDown', 'ArrowLeft', 'ArrowRight'].includes(key)) e.preventDefault();
84
+ if (['Home', 'End', 'ArrowUp', 'ArrowDown', 'ArrowLeft', 'ArrowRight'].includes(key)) e.stopPropagation();
101
85
  if (key === 'ArrowUp') newFocusedDayDate = sumValuesToDate(day, {
102
86
  daysToSum: -7
103
87
  });
@@ -127,21 +111,18 @@ const useKeyboardHandlers = _ref => {
127
111
 
128
112
  if (newFocusedDayDate) {
129
113
  handleFocusMetaDayByDay(newFocusedDayDate);
130
- setTimeout(tryToFocusCurrentlyDataIsFocusedDay);
131
114
  }
132
115
 
133
116
  if (key === 'Home') onHomeKeyDownInsideCalendar();
134
117
  if (key === 'End') onEndKeyDownInsideCalendar(); // TAB CYCLE IMPLEMENTATION
135
118
 
136
119
  if (key === 'Tab' && !shiftKey && isControllerOnly === false && !isWithTimeWheelToo) {
137
- var _prevMonthBtnRef$curr3, _prevMonthBtnRef$curr4;
138
-
139
120
  // MUST prevent default since this is a custom focus switch
140
121
  // NOT preventing the default event will cause unexpected result
141
122
  e.preventDefault();
142
- 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);
123
+ trackFocusCalendarPrevMonth();
143
124
  }
144
- }, [daysArray, handleFocusMetaDayByDay, handleNextMonth, handlePrevMonth, isControllerOnly, isWithTimeWheelToo, onEndKeyDownInsideCalendar, onHomeKeyDownInsideCalendar, prevMonthBtnRef, tryToFocusCurrentlyDataIsFocusedDay]);
125
+ }, [daysArray, handleFocusMetaDayByDay, handleNextMonth, handlePrevMonth, isControllerOnly, isWithTimeWheelToo, onEndKeyDownInsideCalendar, onHomeKeyDownInsideCalendar, trackFocusCalendarPrevMonth]);
145
126
  const handlePrevYearKeyDown = useCallback(e => {
146
127
  const {
147
128
  key,
@@ -152,13 +133,9 @@ const useKeyboardHandlers = _ref => {
152
133
  e.preventDefault();
153
134
 
154
135
  if (shiftKey) {
155
- var _nextMonthBtnRef$curr;
156
-
157
- (_nextMonthBtnRef$curr = nextMonthBtnRef.current) === null || _nextMonthBtnRef$curr === void 0 ? void 0 : _nextMonthBtnRef$curr.focus();
136
+ trackFocusCalendarNextMonth();
158
137
  } else {
159
- var _nextYearBtnRef$curre;
160
-
161
- (_nextYearBtnRef$curre = nextYearBtnRef.current) === null || _nextYearBtnRef$curre === void 0 ? void 0 : _nextYearBtnRef$curre.focus();
138
+ trackFocusCalendarNextYear();
162
139
  }
163
140
  }
164
141
 
@@ -171,7 +148,7 @@ const useKeyboardHandlers = _ref => {
171
148
  onEndKeyDownInsideCalendar();
172
149
  e.preventDefault();
173
150
  }
174
- }, [nextMonthBtnRef, nextYearBtnRef, onEndKeyDownInsideCalendar, onHomeKeyDownInsideCalendar]);
151
+ }, [onEndKeyDownInsideCalendar, onHomeKeyDownInsideCalendar, trackFocusCalendarNextMonth, trackFocusCalendarNextYear]);
175
152
  const handlePrevMonthKeyDown = useCallback(e => {
176
153
  const {
177
154
  key,
@@ -182,16 +159,12 @@ const useKeyboardHandlers = _ref => {
182
159
  if (shiftKey) {
183
160
  // TAB CYCLE IMPLEMENTATION
184
161
  if (!isControllerOnly) {
185
- var _currMeridiemBtnRef$c3, _currMeridiemBtnRef$c4;
186
-
187
162
  e.preventDefault();
188
- if (isWithTimeWheelToo) currMeridiemBtnRef === null || currMeridiemBtnRef === void 0 ? void 0 : (_currMeridiemBtnRef$c3 = currMeridiemBtnRef.current) === null || _currMeridiemBtnRef$c3 === void 0 ? void 0 : (_currMeridiemBtnRef$c4 = _currMeridiemBtnRef$c3.focus) === null || _currMeridiemBtnRef$c4 === void 0 ? void 0 : _currMeridiemBtnRef$c4.call(_currMeridiemBtnRef$c3);else tryToFocusDayRegion();
163
+ if (isWithTimeWheelToo) trackFocusTimewheelCurrMeridiem();else tryToFocusDayRegion();
189
164
  }
190
165
  } else {
191
- var _nextMonthBtnRef$curr2;
192
-
193
166
  e.preventDefault();
194
- (_nextMonthBtnRef$curr2 = nextMonthBtnRef.current) === null || _nextMonthBtnRef$curr2 === void 0 ? void 0 : _nextMonthBtnRef$curr2.focus();
167
+ trackFocusCalendarNextMonth();
195
168
  }
196
169
  }
197
170
 
@@ -204,7 +177,7 @@ const useKeyboardHandlers = _ref => {
204
177
  onEndKeyDownInsideCalendar();
205
178
  e.preventDefault();
206
179
  }
207
- }, [currMeridiemBtnRef, isControllerOnly, isWithTimeWheelToo, nextMonthBtnRef, onEndKeyDownInsideCalendar, onHomeKeyDownInsideCalendar, tryToFocusDayRegion]);
180
+ }, [isControllerOnly, isWithTimeWheelToo, onEndKeyDownInsideCalendar, onHomeKeyDownInsideCalendar, trackFocusCalendarNextMonth, trackFocusTimewheelCurrMeridiem, tryToFocusDayRegion]);
208
181
  const handleNextMonthKeyDown = useCallback(e => {
209
182
  const {
210
183
  key,
@@ -215,13 +188,9 @@ const useKeyboardHandlers = _ref => {
215
188
  e.preventDefault();
216
189
 
217
190
  if (shiftKey) {
218
- var _prevMonthBtnRef$curr5;
219
-
220
- (_prevMonthBtnRef$curr5 = prevMonthBtnRef.current) === null || _prevMonthBtnRef$curr5 === void 0 ? void 0 : _prevMonthBtnRef$curr5.focus();
191
+ trackFocusCalendarPrevMonth();
221
192
  } else {
222
- var _prevYearBtnRef$curre;
223
-
224
- (_prevYearBtnRef$curre = prevYearBtnRef.current) === null || _prevYearBtnRef$curre === void 0 ? void 0 : _prevYearBtnRef$curre.focus();
193
+ trackFocusCalendarPrevYear();
225
194
  }
226
195
  }
227
196
 
@@ -234,7 +203,7 @@ const useKeyboardHandlers = _ref => {
234
203
  onEndKeyDownInsideCalendar();
235
204
  e.preventDefault();
236
205
  }
237
- }, [onEndKeyDownInsideCalendar, onHomeKeyDownInsideCalendar, prevMonthBtnRef, prevYearBtnRef]);
206
+ }, [onEndKeyDownInsideCalendar, onHomeKeyDownInsideCalendar, trackFocusCalendarPrevMonth, trackFocusCalendarPrevYear]);
238
207
  const handleNextYearKeyDown = useCallback(e => {
239
208
  const {
240
209
  key,
@@ -245,9 +214,7 @@ const useKeyboardHandlers = _ref => {
245
214
  e.preventDefault();
246
215
 
247
216
  if (shiftKey) {
248
- var _prevYearBtnRef$curre2, _prevYearBtnRef$curre3;
249
-
250
- prevYearBtnRef === null || prevYearBtnRef === void 0 ? void 0 : (_prevYearBtnRef$curre2 = prevYearBtnRef.current) === null || _prevYearBtnRef$curre2 === void 0 ? void 0 : (_prevYearBtnRef$curre3 = _prevYearBtnRef$curre2.focus) === null || _prevYearBtnRef$curre3 === void 0 ? void 0 : _prevYearBtnRef$curre3.call(_prevYearBtnRef$curre2);
217
+ trackFocusCalendarPrevYear();
251
218
  }
252
219
 
253
220
  if (!shiftKey) tryToFocusDayRegion();
@@ -262,7 +229,7 @@ const useKeyboardHandlers = _ref => {
262
229
  onEndKeyDownInsideCalendar();
263
230
  e.preventDefault();
264
231
  }
265
- }, [tryToFocusDayRegion, prevYearBtnRef, onHomeKeyDownInsideCalendar, onEndKeyDownInsideCalendar]);
232
+ }, [tryToFocusDayRegion, trackFocusCalendarPrevYear, onHomeKeyDownInsideCalendar, onEndKeyDownInsideCalendar]);
266
233
  return useMemo(() => ({
267
234
  handleDayOnKeyDown,
268
235
  handlePrevYearKeyDown,
@@ -1,9 +1,9 @@
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';
5
4
  import { useOnClickOutside } from '../../../utils/hooks/useOnClickOutside.js';
6
5
 
6
+ /* eslint-disable complexity */
7
7
  const usePopperTriggerLogic = _ref => {
8
8
  let {
9
9
  focusLogic,
@@ -12,16 +12,19 @@ const usePopperTriggerLogic = _ref => {
12
12
  } = _ref;
13
13
  const {
14
14
  focusedDay,
15
- resetFocusedDayToStartDate,
16
- tryToFocusCurrentlyDataIsFocusedDay
15
+ resetFocusedDayToStartDate
17
16
  } = focusLogic;
18
17
  const {
19
18
  props: {
20
19
  onPickerOpen,
21
20
  onPickerClose
22
21
  },
23
- prevMonthBtnRef,
24
- pickerButtonRef
22
+ pickerButtonRef,
23
+ trackFocusCalendarMetafocusedDay,
24
+ trackFocusCalendarPrevMonth,
25
+ trackFocusPicker,
26
+ latestInteractionRegion,
27
+ currFocusDescriber
25
28
  } = useContext(ControlledDateTimePickerContext);
26
29
  const [referenceElement, setReferenceElement] = useState(null);
27
30
  const [popperElement, setPopperElement] = useState(null);
@@ -37,29 +40,18 @@ const usePopperTriggerLogic = _ref => {
37
40
 
38
41
  const handleOnPickerOpen = useCallback(() => {
39
42
  onPickerOpen();
40
- tryToFocusCurrentlyDataIsFocusedDay();
41
- }, [onPickerOpen, tryToFocusCurrentlyDataIsFocusedDay]);
43
+ }, [onPickerOpen]);
42
44
  const openCalendar = useCallback(() => {
43
- if (focusedDay) setTimeout(() => {
44
- var _focusedDay$dayBtnRef, _focusedDay$dayBtnRef2, _focusedDay$dayBtnRef3;
45
-
46
- return focusedDay === null || focusedDay === void 0 ? void 0 : (_focusedDay$dayBtnRef = focusedDay.dayBtnRef) === null || _focusedDay$dayBtnRef === void 0 ? void 0 : (_focusedDay$dayBtnRef2 = _focusedDay$dayBtnRef.current) === null || _focusedDay$dayBtnRef2 === void 0 ? void 0 : (_focusedDay$dayBtnRef3 = _focusedDay$dayBtnRef2.focus) === null || _focusedDay$dayBtnRef3 === void 0 ? void 0 : _focusedDay$dayBtnRef3.call(_focusedDay$dayBtnRef2);
47
- }, 100);else setTimeout(() => {
48
- var _prevMonthBtnRef$curr, _prevMonthBtnRef$curr2;
49
-
50
- return prevMonthBtnRef === null || prevMonthBtnRef === void 0 ? void 0 : (_prevMonthBtnRef$curr = prevMonthBtnRef.current) === null || _prevMonthBtnRef$curr === void 0 ? void 0 : (_prevMonthBtnRef$curr2 = _prevMonthBtnRef$curr.focus) === null || _prevMonthBtnRef$curr2 === void 0 ? void 0 : _prevMonthBtnRef$curr2.call(_prevMonthBtnRef$curr);
51
- }, 100);
45
+ if (focusedDay) trackFocusCalendarMetafocusedDay();else trackFocusCalendarPrevMonth();
52
46
  setShowCalendar(true);
53
47
  handleOnPickerOpen();
54
- }, [focusedDay, handleOnPickerOpen, prevMonthBtnRef, setShowCalendar]);
48
+ }, [focusedDay, handleOnPickerOpen, setShowCalendar, trackFocusCalendarMetafocusedDay, trackFocusCalendarPrevMonth]);
55
49
  const closeCalendar = useCallback(() => {
56
- var _pickerButtonRef$curr, _pickerButtonRef$curr2;
57
-
58
50
  setShowCalendar(false);
59
51
  onPickerClose();
60
52
  resetFocusedDayToStartDate();
61
- 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);
62
- }, [setShowCalendar, onPickerClose, resetFocusedDayToStartDate, pickerButtonRef]);
53
+ trackFocusPicker();
54
+ }, [setShowCalendar, onPickerClose, resetFocusedDayToStartDate, trackFocusPicker]);
63
55
  const handleToggleCalendar = useCallback(() => {
64
56
  const isOpening = !showCalendar;
65
57
  if (isOpening) openCalendar();else closeCalendar();
@@ -67,23 +59,20 @@ const usePopperTriggerLogic = _ref => {
67
59
  const handleSetTriggerRef = useCallback(newRef => {
68
60
  pickerButtonRef.current = newRef;
69
61
  setReferenceElement(newRef);
70
- }, [pickerButtonRef]);
62
+ if (latestInteractionRegion === 'picker-icon' && currFocusDescriber === 'date-picker-icon') newRef?.focus();
63
+ }, [currFocusDescriber, latestInteractionRegion, pickerButtonRef]);
71
64
  const handleMenuWrapperKeyDown = useCallback(e => {
72
65
  const {
73
66
  key
74
67
  } = e;
75
68
 
76
69
  if (key === 'Escape') {
77
- var _pickerButtonRef$curr3, _pickerButtonRef$curr4;
78
-
79
70
  closeCalendar();
80
- 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);
71
+ trackFocusPicker();
81
72
  }
82
- }, [closeCalendar, pickerButtonRef]);
73
+ }, [closeCalendar, trackFocusPicker]);
83
74
  useOnClickOutside(popperElement, e => {
84
- var _pickerButtonRef$curr5, _pickerButtonRef$curr6;
85
-
86
- if (e.target instanceof Element && !(pickerButtonRef !== null && pickerButtonRef !== void 0 && (_pickerButtonRef$curr5 = pickerButtonRef.current) !== null && _pickerButtonRef$curr5 !== void 0 && (_pickerButtonRef$curr6 = _pickerButtonRef$curr5.contains) !== null && _pickerButtonRef$curr6 !== void 0 && _pickerButtonRef$curr6.call(_pickerButtonRef$curr5, e === null || e === void 0 ? void 0 : e.target))) closeCalendar();
75
+ if (e.target instanceof Element && !pickerButtonRef?.current?.contains?.(e?.target)) closeCalendar();
87
76
  });
88
77
  return useMemo(() => ({
89
78
  closeCalendar,