@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
@@ -2,13 +2,12 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var _defineProperty = require('@babel/runtime/helpers/defineProperty');
6
- require('core-js/modules/web.dom-collections.iterator.js');
7
5
  require('core-js/modules/esnext.async-iterator.filter.js');
8
6
  require('core-js/modules/esnext.iterator.constructor.js');
9
7
  require('core-js/modules/esnext.iterator.filter.js');
10
8
  require('core-js/modules/esnext.async-iterator.for-each.js');
11
9
  require('core-js/modules/esnext.iterator.for-each.js');
10
+ var _defineProperty = require('@babel/runtime/helpers/defineProperty');
12
11
  var React = require('react');
13
12
  var ControlledDateTimePickerCTX = require('../../../ControlledDateTimePickerCTX.js');
14
13
  var useCurrentDisplayedMonthYearLogic = require('./useCurrentDisplayedMonthYearLogic.js');
@@ -25,24 +24,24 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
25
24
  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__default["default"](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; }
26
25
  const useConfigCalendarCTX = () => {
27
26
  const {
28
- setLatestInteractionRegion
27
+ trackFocusCalendarPrevYear,
28
+ trackFocusCalendarNextYear,
29
+ trackFocusCalendarPrevMonth,
30
+ trackFocusCalendarNextMonth
29
31
  } = React.useContext(ControlledDateTimePickerCTX.ControlledDateTimePickerContext);
30
32
  const [showCalendar, setShowCalendar] = React.useState(false);
31
- const setLatestInteractionRegionCalendarHead = React.useCallback(() => {
32
- setLatestInteractionRegion('calendar-head');
33
- }, [setLatestInteractionRegion]);
34
33
  const onPrevYearFocus = React.useCallback(() => {
35
- setLatestInteractionRegionCalendarHead();
36
- }, [setLatestInteractionRegionCalendarHead]);
34
+ trackFocusCalendarPrevYear();
35
+ }, [trackFocusCalendarPrevYear]);
37
36
  const onPrevMonthFocus = React.useCallback(() => {
38
- setLatestInteractionRegionCalendarHead();
39
- }, [setLatestInteractionRegionCalendarHead]);
37
+ trackFocusCalendarPrevMonth();
38
+ }, [trackFocusCalendarPrevMonth]);
40
39
  const onNextMonthFocus = React.useCallback(() => {
41
- setLatestInteractionRegionCalendarHead();
42
- }, [setLatestInteractionRegionCalendarHead]);
40
+ trackFocusCalendarNextMonth();
41
+ }, [trackFocusCalendarNextMonth]);
43
42
  const onNextYearFocus = React.useCallback(() => {
44
- setLatestInteractionRegionCalendarHead();
45
- }, [setLatestInteractionRegionCalendarHead]);
43
+ trackFocusCalendarNextYear();
44
+ }, [trackFocusCalendarNextYear]);
46
45
  const currentDisplayedMonthLogic = useCurrentDisplayedMonthYearLogic.useCurrentDisplayedMonthYearLogic();
47
46
  const focusLogic = useFocusLogic.useFocusLogic({
48
47
  currentDisplayedMonthLogic,
@@ -2,11 +2,12 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- require('core-js/modules/web.dom-collections.iterator.js');
6
5
  var React = require('react');
7
6
  var useGetMonthYearFromDateStringOrEmptyStartingMonth = require('../../../utils/hooks/useGetMonthYearFromDateStringOrEmptyStartingMonth.js');
8
7
  var dateHelpers = require('../../../utils/dateHelpers.js');
9
8
 
9
+ /* eslint-disable complexity */
10
+
10
11
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
11
12
  function sliceIntoChunks(arr, chunkSize) {
12
13
  const res = [];
@@ -2,36 +2,17 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- require('core-js/modules/web.dom-collections.iterator.js');
6
5
  require('core-js/modules/esnext.async-iterator.find.js');
7
6
  require('core-js/modules/esnext.iterator.constructor.js');
8
7
  require('core-js/modules/esnext.iterator.find.js');
9
8
  var React = require('react');
10
- var ControlledDateTimePickerCTX = require('../../../ControlledDateTimePickerCTX.js');
11
9
  var dateHelpers = require('../../../utils/dateHelpers.js');
12
10
  var useGetStartingFocusedDay = require('../../../utils/hooks/useGetStartingFocusedDay.js');
13
11
 
14
- // eslint-disable-next-line max-params
15
- const loopWhileWaiting = function (cb) {
16
- let shortcircuit = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : () => false;
17
- let timePerTry = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 100;
18
- let maxTries = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 5;
19
- let ab = maxTries;
20
- const inter = setInterval(() => {
21
- cb();
22
- if (shortcircuit() || ab === 0) clearInterval(inter);
23
- ab -= 1;
24
- }, timePerTry);
25
- };
26
-
27
12
  const useFocusLogic = _ref => {
28
13
  let {
29
- currentDisplayedMonthLogic,
30
- showCalendar
14
+ currentDisplayedMonthLogic
31
15
  } = _ref;
32
- const {
33
- calendarDaysWrapperRef
34
- } = React.useContext(ControlledDateTimePickerCTX.ControlledDateTimePickerContext);
35
16
  const {
36
17
  daysArray
37
18
  } = currentDisplayedMonthLogic;
@@ -63,23 +44,6 @@ const useFocusLogic = _ref => {
63
44
  });
64
45
  return newFocusedDay;
65
46
  }, [daysArray, startFocusedDate, metadayToFocus]);
66
- const tryToFocusCurrentlyDataIsFocusedDay = React.useCallback(function () {
67
- let wrapperDOM = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : (calendarDaysWrapperRef === null || calendarDaysWrapperRef === void 0 ? void 0 : calendarDaysWrapperRef.current) || document;
68
- let shortcircuit = false;
69
- loopWhileWaiting(() => {
70
- const domElem = wrapperDOM === null || wrapperDOM === void 0 ? void 0 : wrapperDOM.querySelector('[data-isfocused="true"]');
71
-
72
- if (domElem) {
73
- var _domElem$focus;
74
-
75
- domElem === null || domElem === void 0 ? void 0 : (_domElem$focus = domElem.focus) === null || _domElem$focus === void 0 ? void 0 : _domElem$focus.call(domElem);
76
- shortcircuit = true;
77
- }
78
- }, () => shortcircuit);
79
- }, [calendarDaysWrapperRef]);
80
- React.useLayoutEffect(() => {
81
- if (showCalendar) tryToFocusCurrentlyDataIsFocusedDay(calendarDaysWrapperRef === null || calendarDaysWrapperRef === void 0 ? void 0 : calendarDaysWrapperRef.current);
82
- }, [calendarDaysWrapperRef, focusedDay, showCalendar, tryToFocusCurrentlyDataIsFocusedDay]);
83
47
  const handleFocusMetaDay = React.useCallback(metaDayToFocus => {
84
48
  // if focusedDay is inside current daysArray we set Focused day
85
49
  const newFocusedMetaDay = daysArray.find(_ref5 => {
@@ -105,11 +69,10 @@ const useFocusLogic = _ref => {
105
69
  }, []);
106
70
  return React.useMemo(() => ({
107
71
  focusedDay,
108
- tryToFocusCurrentlyDataIsFocusedDay,
109
72
  resetFocusedDayToStartDate,
110
73
  handleFocusMetaDay,
111
74
  handleFocusMetaDayByDay
112
- }), [focusedDay, tryToFocusCurrentlyDataIsFocusedDay, resetFocusedDayToStartDate, handleFocusMetaDay, handleFocusMetaDayByDay]);
75
+ }), [focusedDay, resetFocusedDayToStartDate, handleFocusMetaDay, handleFocusMetaDayByDay]);
113
76
  };
114
77
 
115
78
  exports.useFocusLogic = useFocusLogic;
@@ -8,7 +8,6 @@ require('core-js/modules/esnext.iterator.find.js');
8
8
  var React = require('react');
9
9
  var ControlledDateTimePickerCTX = require('../../../ControlledDateTimePickerCTX.js');
10
10
  var dateHelpers = require('../../../utils/dateHelpers.js');
11
- var constants = require('../../../utils/constants.js');
12
11
 
13
12
  const useKeyboardHandlers = _ref => {
14
13
  let {
@@ -16,29 +15,26 @@ const useKeyboardHandlers = _ref => {
16
15
  focusLogic
17
16
  } = _ref;
18
17
  const {
19
- hideDate,
20
- hideTime,
21
- monthInputRef,
22
- hourInputRef,
23
- prevYearBtnRef,
24
- prevMonthBtnRef,
25
- nextMonthBtnRef,
26
- nextYearBtnRef,
27
- currMeridiemBtnRef,
28
18
  isControllerOnly,
29
19
  isWithTimeWheelToo,
30
- setLatestInteractionRegion,
31
20
  withAnyInputs,
32
21
  isWithTimeInputs,
33
- meridiemInputRef,
34
22
  isWithDateInputs,
35
- yearInputRef
23
+ trackFocusFirstSegment,
24
+ trackFocusMeridiemInput,
25
+ trackFocusYearInput,
26
+ trackFocusCalendarPrevMonth,
27
+ trackFocusCalendarNextMonth,
28
+ trackFocusCalendarNextYear,
29
+ trackFocusCalendarPrevYear,
30
+ trackFocusTimewheelCurrMeridiem,
31
+ trackFocusCalendarMetafocusedDay
36
32
  } = React.useContext(ControlledDateTimePickerCTX.ControlledDateTimePickerContext);
37
33
  const {
38
34
  focusedDay,
39
35
  handleFocusMetaDay,
40
- handleFocusMetaDayByDay,
41
- tryToFocusCurrentlyDataIsFocusedDay
36
+ handleFocusMetaDayByDay // tryToFocusCurrentlyDataIsFocusedDay
37
+
42
38
  } = focusLogic;
43
39
  const {
44
40
  daysArray,
@@ -46,8 +42,6 @@ const useKeyboardHandlers = _ref => {
46
42
  handleNextMonth
47
43
  } = currentDisplayedMonthLogic;
48
44
  const tryToFocusDayRegion = React.useCallback(() => {
49
- setLatestInteractionRegion('calendar-days');
50
-
51
45
  if (!focusedDay) {
52
46
  const newFocusDay = daysArray.find(_ref2 => {
53
47
  let {
@@ -55,42 +49,32 @@ const useKeyboardHandlers = _ref => {
55
49
  } = _ref2;
56
50
  return isCurrMonthDay;
57
51
  });
58
- if (newFocusDay) setTimeout(() => {
59
- handleFocusMetaDay(newFocusDay);
60
- });
61
- } else {
62
- tryToFocusCurrentlyDataIsFocusedDay();
52
+ if (newFocusDay) handleFocusMetaDay(newFocusDay);
63
53
  }
64
- }, [daysArray, focusedDay, handleFocusMetaDay, setLatestInteractionRegion, tryToFocusCurrentlyDataIsFocusedDay]);
65
- const onHomeKeyDownInsideCalendar = React.useCallback(() => {
66
- var _prevMonthBtnRef$curr, _prevMonthBtnRef$curr2;
67
54
 
68
- 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);
69
- }, [prevMonthBtnRef]);
55
+ trackFocusCalendarMetafocusedDay();
56
+ }, [daysArray, focusedDay, handleFocusMetaDay, trackFocusCalendarMetafocusedDay]);
57
+ const onHomeKeyDownInsideCalendar = React.useCallback(() => {
58
+ trackFocusCalendarPrevMonth();
59
+ }, [trackFocusCalendarPrevMonth]);
70
60
  const onEndKeyDownInsideCalendar = React.useCallback(() => {
71
- var _currMeridiemBtnRef$c, _currMeridiemBtnRef$c2;
72
-
73
- 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();
74
- }, [currMeridiemBtnRef, isWithTimeWheelToo, tryToFocusDayRegion]);
61
+ if (isWithTimeWheelToo) trackFocusTimewheelCurrMeridiem();else tryToFocusDayRegion();
62
+ }, [isWithTimeWheelToo, trackFocusTimewheelCurrMeridiem, tryToFocusDayRegion]);
75
63
  const onHomeKeyDownTriggerIcon = React.useCallback(() => {
76
- var _monthInputRef$curren, _monthInputRef$curren2, _hourInputRef$current, _hourInputRef$current2;
77
-
78
- 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);
79
- }, [hideDate, hideTime, monthInputRef, hourInputRef]);
64
+ trackFocusFirstSegment();
65
+ }, [trackFocusFirstSegment]);
80
66
  const handlePickerIconKeyDown = React.useCallback(e => {
81
67
  const {
82
68
  key
83
69
  } = e;
84
- if (constants.homeEndKeys.includes(key)) e.preventDefault();
85
- if (constants.homeEndKeys.includes(key)) e.stopPropagation();
70
+ if (['Home', 'End'].includes(key)) e.preventDefault();
71
+ if (['Home', 'End'].includes(key)) e.stopPropagation();
86
72
  if (key === 'Home') onHomeKeyDownTriggerIcon();
87
73
 
88
74
  if (key === 'Backspace' && withAnyInputs) {
89
- var _meridiemInputRef$cur, _meridiemInputRef$cur2, _yearInputRef$current, _yearInputRef$current2;
90
-
91
- 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);
75
+ if (isWithTimeInputs) trackFocusMeridiemInput();else if (isWithDateInputs) trackFocusYearInput();
92
76
  }
93
- }, [isWithDateInputs, isWithTimeInputs, meridiemInputRef, onHomeKeyDownTriggerIcon, withAnyInputs, yearInputRef]);
77
+ }, [isWithDateInputs, isWithTimeInputs, onHomeKeyDownTriggerIcon, trackFocusMeridiemInput, trackFocusYearInput, withAnyInputs]);
94
78
  const handleDayOnKeyDown = React.useCallback((e, metaDay) => {
95
79
  let newFocusedDayDate;
96
80
  const {
@@ -100,8 +84,8 @@ const useKeyboardHandlers = _ref => {
100
84
  key,
101
85
  shiftKey
102
86
  } = e;
103
- if (constants.homeEndAllArrowKeys.includes(key)) e.preventDefault();
104
- if (constants.homeEndAllArrowKeys.includes(key)) e.stopPropagation();
87
+ if (['Home', 'End', 'ArrowUp', 'ArrowDown', 'ArrowLeft', 'ArrowRight'].includes(key)) e.preventDefault();
88
+ if (['Home', 'End', 'ArrowUp', 'ArrowDown', 'ArrowLeft', 'ArrowRight'].includes(key)) e.stopPropagation();
105
89
  if (key === 'ArrowUp') newFocusedDayDate = dateHelpers.sumValuesToDate(day, {
106
90
  daysToSum: -7
107
91
  });
@@ -131,21 +115,18 @@ const useKeyboardHandlers = _ref => {
131
115
 
132
116
  if (newFocusedDayDate) {
133
117
  handleFocusMetaDayByDay(newFocusedDayDate);
134
- setTimeout(tryToFocusCurrentlyDataIsFocusedDay);
135
118
  }
136
119
 
137
120
  if (key === 'Home') onHomeKeyDownInsideCalendar();
138
121
  if (key === 'End') onEndKeyDownInsideCalendar(); // TAB CYCLE IMPLEMENTATION
139
122
 
140
123
  if (key === 'Tab' && !shiftKey && isControllerOnly === false && !isWithTimeWheelToo) {
141
- var _prevMonthBtnRef$curr3, _prevMonthBtnRef$curr4;
142
-
143
124
  // MUST prevent default since this is a custom focus switch
144
125
  // NOT preventing the default event will cause unexpected result
145
126
  e.preventDefault();
146
- 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);
127
+ trackFocusCalendarPrevMonth();
147
128
  }
148
- }, [daysArray, handleFocusMetaDayByDay, handleNextMonth, handlePrevMonth, isControllerOnly, isWithTimeWheelToo, onEndKeyDownInsideCalendar, onHomeKeyDownInsideCalendar, prevMonthBtnRef, tryToFocusCurrentlyDataIsFocusedDay]);
129
+ }, [daysArray, handleFocusMetaDayByDay, handleNextMonth, handlePrevMonth, isControllerOnly, isWithTimeWheelToo, onEndKeyDownInsideCalendar, onHomeKeyDownInsideCalendar, trackFocusCalendarPrevMonth]);
149
130
  const handlePrevYearKeyDown = React.useCallback(e => {
150
131
  const {
151
132
  key,
@@ -156,13 +137,9 @@ const useKeyboardHandlers = _ref => {
156
137
  e.preventDefault();
157
138
 
158
139
  if (shiftKey) {
159
- var _nextMonthBtnRef$curr;
160
-
161
- (_nextMonthBtnRef$curr = nextMonthBtnRef.current) === null || _nextMonthBtnRef$curr === void 0 ? void 0 : _nextMonthBtnRef$curr.focus();
140
+ trackFocusCalendarNextMonth();
162
141
  } else {
163
- var _nextYearBtnRef$curre;
164
-
165
- (_nextYearBtnRef$curre = nextYearBtnRef.current) === null || _nextYearBtnRef$curre === void 0 ? void 0 : _nextYearBtnRef$curre.focus();
142
+ trackFocusCalendarNextYear();
166
143
  }
167
144
  }
168
145
 
@@ -175,7 +152,7 @@ const useKeyboardHandlers = _ref => {
175
152
  onEndKeyDownInsideCalendar();
176
153
  e.preventDefault();
177
154
  }
178
- }, [nextMonthBtnRef, nextYearBtnRef, onEndKeyDownInsideCalendar, onHomeKeyDownInsideCalendar]);
155
+ }, [onEndKeyDownInsideCalendar, onHomeKeyDownInsideCalendar, trackFocusCalendarNextMonth, trackFocusCalendarNextYear]);
179
156
  const handlePrevMonthKeyDown = React.useCallback(e => {
180
157
  const {
181
158
  key,
@@ -186,16 +163,12 @@ const useKeyboardHandlers = _ref => {
186
163
  if (shiftKey) {
187
164
  // TAB CYCLE IMPLEMENTATION
188
165
  if (!isControllerOnly) {
189
- var _currMeridiemBtnRef$c3, _currMeridiemBtnRef$c4;
190
-
191
166
  e.preventDefault();
192
- 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();
167
+ if (isWithTimeWheelToo) trackFocusTimewheelCurrMeridiem();else tryToFocusDayRegion();
193
168
  }
194
169
  } else {
195
- var _nextMonthBtnRef$curr2;
196
-
197
170
  e.preventDefault();
198
- (_nextMonthBtnRef$curr2 = nextMonthBtnRef.current) === null || _nextMonthBtnRef$curr2 === void 0 ? void 0 : _nextMonthBtnRef$curr2.focus();
171
+ trackFocusCalendarNextMonth();
199
172
  }
200
173
  }
201
174
 
@@ -208,7 +181,7 @@ const useKeyboardHandlers = _ref => {
208
181
  onEndKeyDownInsideCalendar();
209
182
  e.preventDefault();
210
183
  }
211
- }, [currMeridiemBtnRef, isControllerOnly, isWithTimeWheelToo, nextMonthBtnRef, onEndKeyDownInsideCalendar, onHomeKeyDownInsideCalendar, tryToFocusDayRegion]);
184
+ }, [isControllerOnly, isWithTimeWheelToo, onEndKeyDownInsideCalendar, onHomeKeyDownInsideCalendar, trackFocusCalendarNextMonth, trackFocusTimewheelCurrMeridiem, tryToFocusDayRegion]);
212
185
  const handleNextMonthKeyDown = React.useCallback(e => {
213
186
  const {
214
187
  key,
@@ -219,13 +192,9 @@ const useKeyboardHandlers = _ref => {
219
192
  e.preventDefault();
220
193
 
221
194
  if (shiftKey) {
222
- var _prevMonthBtnRef$curr5;
223
-
224
- (_prevMonthBtnRef$curr5 = prevMonthBtnRef.current) === null || _prevMonthBtnRef$curr5 === void 0 ? void 0 : _prevMonthBtnRef$curr5.focus();
195
+ trackFocusCalendarPrevMonth();
225
196
  } else {
226
- var _prevYearBtnRef$curre;
227
-
228
- (_prevYearBtnRef$curre = prevYearBtnRef.current) === null || _prevYearBtnRef$curre === void 0 ? void 0 : _prevYearBtnRef$curre.focus();
197
+ trackFocusCalendarPrevYear();
229
198
  }
230
199
  }
231
200
 
@@ -238,7 +207,7 @@ const useKeyboardHandlers = _ref => {
238
207
  onEndKeyDownInsideCalendar();
239
208
  e.preventDefault();
240
209
  }
241
- }, [onEndKeyDownInsideCalendar, onHomeKeyDownInsideCalendar, prevMonthBtnRef, prevYearBtnRef]);
210
+ }, [onEndKeyDownInsideCalendar, onHomeKeyDownInsideCalendar, trackFocusCalendarPrevMonth, trackFocusCalendarPrevYear]);
242
211
  const handleNextYearKeyDown = React.useCallback(e => {
243
212
  const {
244
213
  key,
@@ -249,9 +218,7 @@ const useKeyboardHandlers = _ref => {
249
218
  e.preventDefault();
250
219
 
251
220
  if (shiftKey) {
252
- var _prevYearBtnRef$curre2, _prevYearBtnRef$curre3;
253
-
254
- 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);
221
+ trackFocusCalendarPrevYear();
255
222
  }
256
223
 
257
224
  if (!shiftKey) tryToFocusDayRegion();
@@ -266,7 +233,7 @@ const useKeyboardHandlers = _ref => {
266
233
  onEndKeyDownInsideCalendar();
267
234
  e.preventDefault();
268
235
  }
269
- }, [tryToFocusDayRegion, prevYearBtnRef, onHomeKeyDownInsideCalendar, onEndKeyDownInsideCalendar]);
236
+ }, [tryToFocusDayRegion, trackFocusCalendarPrevYear, onHomeKeyDownInsideCalendar, onEndKeyDownInsideCalendar]);
270
237
  return React.useMemo(() => ({
271
238
  handleDayOnKeyDown,
272
239
  handlePrevYearKeyDown,
@@ -2,12 +2,12 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- require('core-js/modules/web.dom-collections.iterator.js');
6
5
  var React = require('react');
7
6
  var reactPopper = require('react-popper');
8
7
  var ControlledDateTimePickerCTX = require('../../../ControlledDateTimePickerCTX.js');
9
8
  var useOnClickOutside = require('../../../utils/hooks/useOnClickOutside.js');
10
9
 
10
+ /* eslint-disable complexity */
11
11
  const usePopperTriggerLogic = _ref => {
12
12
  let {
13
13
  focusLogic,
@@ -16,16 +16,19 @@ const usePopperTriggerLogic = _ref => {
16
16
  } = _ref;
17
17
  const {
18
18
  focusedDay,
19
- resetFocusedDayToStartDate,
20
- tryToFocusCurrentlyDataIsFocusedDay
19
+ resetFocusedDayToStartDate
21
20
  } = focusLogic;
22
21
  const {
23
22
  props: {
24
23
  onPickerOpen,
25
24
  onPickerClose
26
25
  },
27
- prevMonthBtnRef,
28
- pickerButtonRef
26
+ pickerButtonRef,
27
+ trackFocusCalendarMetafocusedDay,
28
+ trackFocusCalendarPrevMonth,
29
+ trackFocusPicker,
30
+ latestInteractionRegion,
31
+ currFocusDescriber
29
32
  } = React.useContext(ControlledDateTimePickerCTX.ControlledDateTimePickerContext);
30
33
  const [referenceElement, setReferenceElement] = React.useState(null);
31
34
  const [popperElement, setPopperElement] = React.useState(null);
@@ -41,29 +44,18 @@ const usePopperTriggerLogic = _ref => {
41
44
 
42
45
  const handleOnPickerOpen = React.useCallback(() => {
43
46
  onPickerOpen();
44
- tryToFocusCurrentlyDataIsFocusedDay();
45
- }, [onPickerOpen, tryToFocusCurrentlyDataIsFocusedDay]);
47
+ }, [onPickerOpen]);
46
48
  const openCalendar = React.useCallback(() => {
47
- if (focusedDay) setTimeout(() => {
48
- var _focusedDay$dayBtnRef, _focusedDay$dayBtnRef2, _focusedDay$dayBtnRef3;
49
-
50
- 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);
51
- }, 100);else setTimeout(() => {
52
- var _prevMonthBtnRef$curr, _prevMonthBtnRef$curr2;
53
-
54
- 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);
55
- }, 100);
49
+ if (focusedDay) trackFocusCalendarMetafocusedDay();else trackFocusCalendarPrevMonth();
56
50
  setShowCalendar(true);
57
51
  handleOnPickerOpen();
58
- }, [focusedDay, handleOnPickerOpen, prevMonthBtnRef, setShowCalendar]);
52
+ }, [focusedDay, handleOnPickerOpen, setShowCalendar, trackFocusCalendarMetafocusedDay, trackFocusCalendarPrevMonth]);
59
53
  const closeCalendar = React.useCallback(() => {
60
- var _pickerButtonRef$curr, _pickerButtonRef$curr2;
61
-
62
54
  setShowCalendar(false);
63
55
  onPickerClose();
64
56
  resetFocusedDayToStartDate();
65
- 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);
66
- }, [setShowCalendar, onPickerClose, resetFocusedDayToStartDate, pickerButtonRef]);
57
+ trackFocusPicker();
58
+ }, [setShowCalendar, onPickerClose, resetFocusedDayToStartDate, trackFocusPicker]);
67
59
  const handleToggleCalendar = React.useCallback(() => {
68
60
  const isOpening = !showCalendar;
69
61
  if (isOpening) openCalendar();else closeCalendar();
@@ -71,23 +63,20 @@ const usePopperTriggerLogic = _ref => {
71
63
  const handleSetTriggerRef = React.useCallback(newRef => {
72
64
  pickerButtonRef.current = newRef;
73
65
  setReferenceElement(newRef);
74
- }, [pickerButtonRef]);
66
+ if (latestInteractionRegion === 'picker-icon' && currFocusDescriber === 'date-picker-icon') newRef?.focus();
67
+ }, [currFocusDescriber, latestInteractionRegion, pickerButtonRef]);
75
68
  const handleMenuWrapperKeyDown = React.useCallback(e => {
76
69
  const {
77
70
  key
78
71
  } = e;
79
72
 
80
73
  if (key === 'Escape') {
81
- var _pickerButtonRef$curr3, _pickerButtonRef$curr4;
82
-
83
74
  closeCalendar();
84
- 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);
75
+ trackFocusPicker();
85
76
  }
86
- }, [closeCalendar, pickerButtonRef]);
77
+ }, [closeCalendar, trackFocusPicker]);
87
78
  useOnClickOutside.useOnClickOutside(popperElement, e => {
88
- var _pickerButtonRef$curr5, _pickerButtonRef$curr6;
89
-
90
- 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();
79
+ if (e.target instanceof Element && !pickerButtonRef?.current?.contains?.(e?.target)) closeCalendar();
91
80
  });
92
81
  return React.useMemo(() => ({
93
82
  closeCalendar,
@@ -27,8 +27,9 @@ const CalendarWithTimeWheelIconTrigger = () => {
27
27
  disabled
28
28
  } = React.useContext(CalendarWithTimeWheelContext.CalendarWithTimeWheelContext);
29
29
  return React.useMemo(() => /*#__PURE__*/_jsx__default["default"](Styleds.StyledIconTriggerButton, {
30
- "aria-label": "date time picker context menu trigger, ".concat(ariaCurrentValueForInputs),
30
+ "aria-label": `date time picker context menu trigger, ${ariaCurrentValueForInputs}`,
31
31
  buttonType: "icon",
32
+ type: "button",
32
33
  size: DSButton.BUTTON_SIZES.M,
33
34
  innerRef: handleSetTriggerRef,
34
35
  onClick: handleToggleCalendarWithTimeWheel,
@@ -2,7 +2,6 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- require('core-js/modules/web.dom-collections.iterator.js');
6
5
  var React = require('react');
7
6
  var reactPopper = require('react-popper');
8
7
  var ControlledDateTimePickerTypes = require('../../../ControlledDateTimePickerTypes.js');
@@ -10,8 +9,8 @@ var ControlledDateTimePickerCTX = require('../../../ControlledDateTimePickerCTX.
10
9
  var useOnClickOutside = require('../../../utils/hooks/useOnClickOutside.js');
11
10
  var CalendarContext = require('../Calendar/CalendarContext.js');
12
11
  var TimeWheelContext = require('../TimeWheel/TimeWheelContext.js');
13
- var constants = require('../../../utils/constants.js');
14
12
 
13
+ /* eslint-disable max-statements */
15
14
  const useConfigCalendarWithTimeWheelCTX = () => {
16
15
  const {
17
16
  pickerButtonRef,
@@ -21,15 +20,15 @@ const useConfigCalendarWithTimeWheelCTX = () => {
21
20
  onPickerClose,
22
21
  disabled
23
22
  },
24
- hideDate,
25
- hideTime,
26
- monthInputRef,
27
- hourInputRef,
28
23
  withAnyInputs,
29
24
  isWithTimeInputs,
30
- meridiemInputRef,
31
- yearInputRef,
32
- ariaCurrentValueForInputs
25
+ ariaCurrentValueForInputs,
26
+ trackFocusFirstSegment,
27
+ trackFocusMeridiemInput,
28
+ trackFocusYearInput,
29
+ trackFocusPicker,
30
+ latestInteractionRegion,
31
+ currFocusDescriber
33
32
  } = React.useContext(ControlledDateTimePickerCTX.ControlledDateTimePickerContext);
34
33
  const {
35
34
  handleToggleCalendar
@@ -39,24 +38,20 @@ const useConfigCalendarWithTimeWheelCTX = () => {
39
38
  } = React.useContext(TimeWheelContext.TimeWheelContext);
40
39
  const [showCalendarWithTimeWheel, setShowCalendarWithTimeWheel] = React.useState(false);
41
40
  const onHomeKeyDown = React.useCallback(() => {
42
- var _monthInputRef$curren, _monthInputRef$curren2, _hourInputRef$current, _hourInputRef$current2;
43
-
44
- 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);
45
- }, [hideDate, hideTime, monthInputRef, hourInputRef]);
41
+ trackFocusFirstSegment();
42
+ }, [trackFocusFirstSegment]);
46
43
  const handlePickerIconKeyDown = React.useCallback(e => {
47
44
  const {
48
45
  key
49
46
  } = e;
50
- if (constants.homeEndKeys.includes(key)) e.preventDefault();
51
- if (constants.homeEndKeys.includes(key)) e.stopPropagation();
47
+ if (['Home', 'End'].includes(key)) e.preventDefault();
48
+ if (['Home', 'End'].includes(key)) e.stopPropagation();
52
49
  if (key === 'Home') onHomeKeyDown();
53
50
 
54
51
  if (key === 'Backspace' && withAnyInputs) {
55
- var _meridiemInputRef$cur, _meridiemInputRef$cur2, _yearInputRef$current, _yearInputRef$current2;
56
-
57
- 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 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);
52
+ if (isWithTimeInputs) trackFocusMeridiemInput();else trackFocusYearInput();
58
53
  }
59
- }, [isWithTimeInputs, meridiemInputRef, onHomeKeyDown, withAnyInputs, yearInputRef]);
54
+ }, [isWithTimeInputs, onHomeKeyDown, trackFocusMeridiemInput, trackFocusYearInput, withAnyInputs]);
60
55
  const [referenceElement, setReferenceElement] = React.useState(null);
61
56
  const [popperElement, setPopperElement] = React.useState(null);
62
57
  const [arrowElement, setArrowElement] = React.useState(null);
@@ -84,26 +79,23 @@ const useConfigCalendarWithTimeWheelCTX = () => {
84
79
  if (!showCalendarWithTimeWheel) openCalendar();else closeCalendar();
85
80
  }, [closeCalendar, openCalendar, showCalendarWithTimeWheel]);
86
81
  useOnClickOutside.useOnClickOutside(popperElement, e => {
87
- var _pickerButtonRef$curr, _pickerButtonRef$curr2;
88
-
89
- 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))) closeCalendar();
82
+ if (e.target instanceof Element && !pickerButtonRef?.current?.contains?.(e?.target)) closeCalendar();
90
83
  });
91
84
  const handleSetTriggerRef = React.useCallback(newRef => {
92
85
  pickerButtonRef.current = newRef;
93
86
  setReferenceElement(newRef);
94
- }, [pickerButtonRef]);
87
+ if (latestInteractionRegion === 'picker-icon' && currFocusDescriber === 'datetime-picker-icon') newRef?.focus();
88
+ }, [currFocusDescriber, latestInteractionRegion, pickerButtonRef]);
95
89
  const handleMenuWrapperKeyDown = React.useCallback(e => {
96
90
  const {
97
91
  key
98
92
  } = e;
99
93
 
100
94
  if (key === 'Escape') {
101
- var _pickerButtonRef$curr3, _pickerButtonRef$curr4;
102
-
103
95
  closeCalendar();
104
- 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);
96
+ trackFocusPicker();
105
97
  }
106
- }, [closeCalendar, pickerButtonRef]);
98
+ }, [closeCalendar, trackFocusPicker]);
107
99
  const isControllerOnly = React.useMemo(() => type === ControlledDateTimePickerTypes.CONTROLLED_DATE_TIME_PICKER_TYPES.DATE_TIME.CONTROLLER_ONLY, [type]);
108
100
  return React.useMemo(() => ({
109
101
  showCalendarWithTimeWheel,