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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (272) hide show
  1. package/cjs/autocomplete/config/useAutocomplete.js +0 -1
  2. package/cjs/autocomplete/parts/A11yFocusedOption.js +46 -0
  3. package/cjs/autocomplete/parts/container/Container.js +36 -24
  4. package/cjs/autocomplete/parts/container/styled.js +2 -2
  5. package/cjs/autocomplete/parts/container/useKeyboardNavigation.js +2 -2
  6. package/cjs/autocomplete/parts/menu-list/MenuList.js +6 -6
  7. package/cjs/autocomplete/parts/menu-list/styled.js +2 -2
  8. package/cjs/autocomplete/parts/menu-list/useItemRenderer.js +1 -1
  9. package/cjs/autocomplete/parts/styled.js +2 -0
  10. package/cjs/autocomplete/utils/listHelper.js +1 -1
  11. package/cjs/checkbox/ControlledCheckbox.js +1 -1
  12. package/cjs/checkbox/config/useValidateProps.js +6 -3
  13. package/cjs/checkbox/react-desc-prop-types.js +2 -1
  14. package/cjs/checkbox/styles.js +73 -27
  15. package/cjs/checkbox/utils/styleHelpers.js +20 -2
  16. package/cjs/combobox/ComboBoxCTX.js +6 -3
  17. package/cjs/combobox/config/useComboBox.js +16 -6
  18. package/cjs/combobox/config/useCorrectOptions.js +1 -2
  19. package/cjs/combobox/parts/A11yFocusedOption.js +14 -6
  20. package/cjs/combobox/parts/A11ySelectedValues.js +2 -4
  21. package/cjs/combobox/parts/DropdownIndicator.js +15 -7
  22. package/cjs/combobox/parts/container/Container.js +11 -14
  23. package/cjs/combobox/parts/container/styled.js +11 -10
  24. package/cjs/combobox/parts/controls/Controls.js +19 -27
  25. package/cjs/combobox/parts/controls/styled.js +54 -22
  26. package/cjs/combobox/parts/controls/useOnPillsNavigation.js +7 -15
  27. package/cjs/combobox/parts/controls-input/ControlsInput.js +2 -2
  28. package/cjs/combobox/parts/controls-input/styled.js +41 -11
  29. package/cjs/combobox/parts/controls-input/useControlsInput.js +4 -7
  30. package/cjs/combobox/parts/controls-input/useKeyboardNavigation.js +19 -28
  31. package/cjs/combobox/parts/controls-input/useMaskedOnChange.js +7 -7
  32. package/cjs/combobox/parts/dropdown-indicator/DropdownIndicator.js +2 -2
  33. package/cjs/combobox/parts/header-list/HeaderList.js +1 -1
  34. package/cjs/combobox/parts/header-list/styled.js +39 -10
  35. package/cjs/combobox/parts/header-list/useHeaderListHandlers.js +7 -14
  36. package/cjs/combobox/parts/menu-list/MenuList.js +8 -6
  37. package/cjs/combobox/parts/menu-list/styled.js +38 -20
  38. package/cjs/combobox/parts/menu-list/useItemRenderer.js +18 -17
  39. package/cjs/combobox/parts/multi-selected-values-container/MultiSelectedValuesContainer.js +1 -1
  40. package/cjs/combobox/parts/multi-selected-values-container/RemovableSelectedValuePill.js +1 -3
  41. package/cjs/combobox/parts/multi-selected-values-container/useGroupPills.js +1 -2
  42. package/cjs/combobox/parts/styled.js +6 -7
  43. package/cjs/combobox/react-desc-prop-types.js +3 -2
  44. package/cjs/combobox/sharedTypes.js +2 -2
  45. package/cjs/combobox/utils/listHelper.js +14 -9
  46. package/cjs/date-range-picker/config/useRangePickerLogic.js +4 -8
  47. package/cjs/date-range-picker/parts/ControlledDateRangeCalendar.js +0 -2
  48. package/cjs/date-range-picker/parts/ControlledDateRangeFromDate.js +0 -2
  49. package/cjs/date-range-picker/parts/ControlledDateRangeToDate.js +0 -2
  50. package/cjs/date-time-picker/config/useChangeHandlers.js +11 -15
  51. package/cjs/date-time-picker/config/useControlledDateTimePicker.js +14 -10
  52. package/cjs/date-time-picker/config/useFocusTracker.js +136 -0
  53. package/cjs/date-time-picker/config/useGetDestructuredValues.js +6 -6
  54. package/cjs/date-time-picker/config/useGetPropsBasedOnType.js +1 -1
  55. package/cjs/date-time-picker/config/useGetReferences.js +39 -18
  56. package/cjs/date-time-picker/config/useGlobalKeyHandlers.js +8 -12
  57. package/cjs/date-time-picker/config/useRelevantValueFromProps.js +1 -1
  58. package/cjs/date-time-picker/config/useValidateProps.js +42 -11
  59. package/cjs/date-time-picker/parts/ClearButton/ClearButton.js +10 -2
  60. package/cjs/date-time-picker/parts/ClearButton/useClearButton.js +12 -25
  61. package/cjs/date-time-picker/parts/ControlledDateTimePickerContent.js +4 -7
  62. package/cjs/date-time-picker/parts/DateInputs/DDInput.js +8 -6
  63. package/cjs/date-time-picker/parts/DateInputs/DateInputs.js +9 -4
  64. package/cjs/date-time-picker/parts/DateInputs/MMInput.js +8 -6
  65. package/cjs/date-time-picker/parts/DateInputs/YYYYInput.js +8 -6
  66. package/cjs/date-time-picker/parts/DateInputs/useDateInputs.js +84 -113
  67. package/cjs/date-time-picker/parts/Pickers/Calendar/CalendarDaysList.js +4 -4
  68. package/cjs/date-time-picker/parts/Pickers/Calendar/CalendarHead.js +25 -7
  69. package/cjs/date-time-picker/parts/Pickers/Calendar/CalendarIconTrigger.js +1 -1
  70. package/cjs/date-time-picker/parts/Pickers/Calendar/Day.js +21 -17
  71. package/cjs/date-time-picker/parts/Pickers/Calendar/Styleds.js +44 -15
  72. package/cjs/date-time-picker/parts/Pickers/Calendar/useConfigCalendarCTX.js +13 -14
  73. package/cjs/date-time-picker/parts/Pickers/Calendar/useCurrentDisplayedMonthYearLogic.js +2 -1
  74. package/cjs/date-time-picker/parts/Pickers/Calendar/useFocusLogic.js +2 -39
  75. package/cjs/date-time-picker/parts/Pickers/Calendar/useKeyboardHandlers.js +40 -73
  76. package/cjs/date-time-picker/parts/Pickers/Calendar/usePopperTriggerLogic.js +18 -29
  77. package/cjs/date-time-picker/parts/Pickers/CalendarWithTimeWheel/CalendarWithTimeWheelIconTrigger.js +2 -1
  78. package/cjs/date-time-picker/parts/Pickers/CalendarWithTimeWheel/useConfigCalendarWithTimeWheelCTX.js +19 -27
  79. package/cjs/date-time-picker/parts/Pickers/TimeWheel/HoursList.js +15 -11
  80. package/cjs/date-time-picker/parts/Pickers/TimeWheel/MeridiemList.js +17 -13
  81. package/cjs/date-time-picker/parts/Pickers/TimeWheel/MinutesList.js +15 -11
  82. package/cjs/date-time-picker/parts/Pickers/TimeWheel/SecondsList.js +2 -2
  83. package/cjs/date-time-picker/parts/Pickers/TimeWheel/Styleds.js +47 -15
  84. package/cjs/date-time-picker/parts/Pickers/TimeWheel/TimeWheelContent.js +1 -1
  85. package/cjs/date-time-picker/parts/Pickers/TimeWheel/TimeWheelIconTrigger.js +1 -1
  86. package/cjs/date-time-picker/parts/Pickers/TimeWheel/useCurrentDisplayedWheelsLogic.js +3 -3
  87. package/cjs/date-time-picker/parts/Pickers/TimeWheel/useKeyboardHandlers.js +36 -230
  88. package/cjs/date-time-picker/parts/Pickers/TimeWheel/usePopperTriggerLogic.js +12 -17
  89. package/cjs/date-time-picker/parts/Styleds.js +12 -6
  90. package/cjs/date-time-picker/parts/TimeInputs/HHInput.js +7 -3
  91. package/cjs/date-time-picker/parts/TimeInputs/MeridiemInput.js +8 -7
  92. package/cjs/date-time-picker/parts/TimeInputs/MinutesInput.js +8 -6
  93. package/cjs/date-time-picker/parts/TimeInputs/TimeInputs.js +11 -6
  94. package/cjs/date-time-picker/parts/TimeInputs/useTimeInputs.js +55 -97
  95. package/cjs/date-time-picker/utils/constants.js +0 -12
  96. package/cjs/date-time-picker/utils/dateHelpers.js +17 -34
  97. package/cjs/date-time-picker/utils/hooks/useGetStartingFocusedDay.js +38 -36
  98. package/cjs/date-time-picker/utils/hooks/useOnClickOutside.js +1 -3
  99. package/cjs/date-time-picker/utils/stringHelpers.js +5 -11
  100. package/cjs/input-group/InputGroup.js +8 -7
  101. package/cjs/input-group/exported-related/data-test-ids.js +12 -0
  102. package/cjs/input-group/exported-related/index.js +12 -0
  103. package/cjs/input-group/exported-related/theming.js +13 -0
  104. package/cjs/input-group/styled.js +90 -23
  105. package/cjs/large-text-input/DSControlledLargeTextInput.js +1 -1
  106. package/cjs/large-text-input/styles.js +27 -13
  107. package/cjs/mask-hook/hooks/useNumberMask.js +1 -5
  108. package/cjs/mask-hook/hooks/usePhoneMask.js +1 -4
  109. package/cjs/mask-hook/hooks/useRegExpMask.js +4 -7
  110. package/cjs/mask-hook/hooks/useSSNMask.js +1 -4
  111. package/cjs/mask-hook/hooks/useZipCodeMask.js +1 -4
  112. package/cjs/mask-hook/utils/addSpecialCharacters.js +0 -1
  113. package/cjs/mask-hook/utils/flatStringArray.js +0 -1
  114. package/cjs/text-input/config/useInputText.js +0 -1
  115. package/cjs/text-input/styled/borders.js +18 -11
  116. package/cjs/text-input/styled/components.js +49 -10
  117. package/cjs/toggle/ControlledToggle.js +2 -3
  118. package/cjs/toggle/styles.js +7 -5
  119. package/esm/autocomplete/config/useAutocomplete.js +0 -1
  120. package/esm/autocomplete/parts/A11yFocusedOption.js +36 -0
  121. package/esm/autocomplete/parts/container/Container.js +39 -27
  122. package/esm/autocomplete/parts/container/styled.js +2 -2
  123. package/esm/autocomplete/parts/container/useKeyboardNavigation.js +2 -2
  124. package/esm/autocomplete/parts/menu-list/MenuList.js +7 -7
  125. package/esm/autocomplete/parts/menu-list/styled.js +2 -2
  126. package/esm/autocomplete/parts/menu-list/useItemRenderer.js +1 -1
  127. package/esm/autocomplete/parts/styled.js +1 -0
  128. package/esm/autocomplete/utils/listHelper.js +1 -1
  129. package/esm/checkbox/ControlledCheckbox.js +2 -2
  130. package/esm/checkbox/config/useValidateProps.js +6 -3
  131. package/esm/checkbox/react-desc-prop-types.js +2 -1
  132. package/esm/checkbox/styles.js +73 -24
  133. package/esm/checkbox/utils/styleHelpers.js +20 -2
  134. package/esm/combobox/ComboBoxCTX.js +6 -3
  135. package/esm/combobox/config/useComboBox.js +16 -6
  136. package/esm/combobox/config/useCorrectOptions.js +1 -2
  137. package/esm/combobox/parts/A11yFocusedOption.js +15 -7
  138. package/esm/combobox/parts/A11ySelectedValues.js +2 -4
  139. package/esm/combobox/parts/DropdownIndicator.js +15 -6
  140. package/esm/combobox/parts/container/Container.js +11 -14
  141. package/esm/combobox/parts/container/styled.js +11 -6
  142. package/esm/combobox/parts/controls/Controls.js +19 -27
  143. package/esm/combobox/parts/controls/styled.js +54 -18
  144. package/esm/combobox/parts/controls/useOnPillsNavigation.js +7 -15
  145. package/esm/combobox/parts/controls-input/ControlsInput.js +2 -2
  146. package/esm/combobox/parts/controls-input/styled.js +41 -7
  147. package/esm/combobox/parts/controls-input/useControlsInput.js +4 -7
  148. package/esm/combobox/parts/controls-input/useKeyboardNavigation.js +20 -29
  149. package/esm/combobox/parts/controls-input/useMaskedOnChange.js +7 -7
  150. package/esm/combobox/parts/dropdown-indicator/DropdownIndicator.js +2 -2
  151. package/esm/combobox/parts/header-list/HeaderList.js +1 -1
  152. package/esm/combobox/parts/header-list/styled.js +40 -7
  153. package/esm/combobox/parts/header-list/useHeaderListHandlers.js +7 -14
  154. package/esm/combobox/parts/menu-list/MenuList.js +8 -6
  155. package/esm/combobox/parts/menu-list/styled.js +38 -17
  156. package/esm/combobox/parts/menu-list/useItemRenderer.js +20 -19
  157. package/esm/combobox/parts/multi-selected-values-container/MultiSelectedValuesContainer.js +1 -1
  158. package/esm/combobox/parts/multi-selected-values-container/RemovableSelectedValuePill.js +1 -3
  159. package/esm/combobox/parts/multi-selected-values-container/useGroupPills.js +1 -2
  160. package/esm/combobox/parts/styled.js +6 -3
  161. package/esm/combobox/react-desc-prop-types.js +3 -2
  162. package/esm/combobox/sharedTypes.js +2 -2
  163. package/esm/combobox/utils/listHelper.js +14 -10
  164. package/esm/date-range-picker/config/useRangePickerLogic.js +3 -7
  165. package/esm/date-range-picker/parts/ControlledDateRangeCalendar.js +0 -2
  166. package/esm/date-range-picker/parts/ControlledDateRangeFromDate.js +0 -2
  167. package/esm/date-range-picker/parts/ControlledDateRangeToDate.js +0 -2
  168. package/esm/date-time-picker/config/useChangeHandlers.js +11 -15
  169. package/esm/date-time-picker/config/useControlledDateTimePicker.js +14 -10
  170. package/esm/date-time-picker/config/useFocusTracker.js +132 -0
  171. package/esm/date-time-picker/config/useGetDestructuredValues.js +6 -6
  172. package/esm/date-time-picker/config/useGetPropsBasedOnType.js +1 -1
  173. package/esm/date-time-picker/config/useGetReferences.js +40 -19
  174. package/esm/date-time-picker/config/useGlobalKeyHandlers.js +8 -12
  175. package/esm/date-time-picker/config/useRelevantValueFromProps.js +1 -1
  176. package/esm/date-time-picker/config/useValidateProps.js +42 -11
  177. package/esm/date-time-picker/parts/ClearButton/ClearButton.js +10 -2
  178. package/esm/date-time-picker/parts/ClearButton/useClearButton.js +12 -25
  179. package/esm/date-time-picker/parts/ControlledDateTimePickerContent.js +4 -7
  180. package/esm/date-time-picker/parts/DateInputs/DDInput.js +8 -6
  181. package/esm/date-time-picker/parts/DateInputs/DateInputs.js +9 -4
  182. package/esm/date-time-picker/parts/DateInputs/MMInput.js +8 -6
  183. package/esm/date-time-picker/parts/DateInputs/YYYYInput.js +8 -6
  184. package/esm/date-time-picker/parts/DateInputs/useDateInputs.js +85 -114
  185. package/esm/date-time-picker/parts/Pickers/Calendar/CalendarDaysList.js +4 -4
  186. package/esm/date-time-picker/parts/Pickers/Calendar/CalendarHead.js +26 -8
  187. package/esm/date-time-picker/parts/Pickers/Calendar/CalendarIconTrigger.js +1 -1
  188. package/esm/date-time-picker/parts/Pickers/Calendar/Day.js +21 -17
  189. package/esm/date-time-picker/parts/Pickers/Calendar/Styleds.js +44 -14
  190. package/esm/date-time-picker/parts/Pickers/Calendar/useConfigCalendarCTX.js +12 -13
  191. package/esm/date-time-picker/parts/Pickers/Calendar/useCurrentDisplayedMonthYearLogic.js +2 -1
  192. package/esm/date-time-picker/parts/Pickers/Calendar/useFocusLogic.js +3 -40
  193. package/esm/date-time-picker/parts/Pickers/Calendar/useKeyboardHandlers.js +40 -73
  194. package/esm/date-time-picker/parts/Pickers/Calendar/usePopperTriggerLogic.js +18 -29
  195. package/esm/date-time-picker/parts/Pickers/CalendarWithTimeWheel/CalendarWithTimeWheelIconTrigger.js +2 -1
  196. package/esm/date-time-picker/parts/Pickers/CalendarWithTimeWheel/useConfigCalendarWithTimeWheelCTX.js +19 -27
  197. package/esm/date-time-picker/parts/Pickers/TimeWheel/HoursList.js +16 -12
  198. package/esm/date-time-picker/parts/Pickers/TimeWheel/MeridiemList.js +18 -14
  199. package/esm/date-time-picker/parts/Pickers/TimeWheel/MinutesList.js +16 -12
  200. package/esm/date-time-picker/parts/Pickers/TimeWheel/SecondsList.js +2 -2
  201. package/esm/date-time-picker/parts/Pickers/TimeWheel/Styleds.js +47 -14
  202. package/esm/date-time-picker/parts/Pickers/TimeWheel/TimeWheelContent.js +1 -1
  203. package/esm/date-time-picker/parts/Pickers/TimeWheel/TimeWheelIconTrigger.js +1 -1
  204. package/esm/date-time-picker/parts/Pickers/TimeWheel/useCurrentDisplayedWheelsLogic.js +3 -3
  205. package/esm/date-time-picker/parts/Pickers/TimeWheel/useKeyboardHandlers.js +36 -230
  206. package/esm/date-time-picker/parts/Pickers/TimeWheel/usePopperTriggerLogic.js +12 -17
  207. package/esm/date-time-picker/parts/Styleds.js +12 -6
  208. package/esm/date-time-picker/parts/TimeInputs/HHInput.js +7 -3
  209. package/esm/date-time-picker/parts/TimeInputs/MeridiemInput.js +8 -7
  210. package/esm/date-time-picker/parts/TimeInputs/MinutesInput.js +8 -6
  211. package/esm/date-time-picker/parts/TimeInputs/TimeInputs.js +11 -6
  212. package/esm/date-time-picker/parts/TimeInputs/useTimeInputs.js +55 -97
  213. package/esm/date-time-picker/utils/constants.js +1 -7
  214. package/esm/date-time-picker/utils/dateHelpers.js +17 -34
  215. package/esm/date-time-picker/utils/hooks/useGetStartingFocusedDay.js +38 -36
  216. package/esm/date-time-picker/utils/hooks/useOnClickOutside.js +1 -3
  217. package/esm/date-time-picker/utils/stringHelpers.js +5 -11
  218. package/esm/input-group/InputGroup.js +5 -4
  219. package/esm/input-group/exported-related/data-test-ids.js +8 -0
  220. package/esm/input-group/exported-related/index.js +2 -0
  221. package/esm/input-group/exported-related/theming.js +8 -0
  222. package/esm/input-group/styled.js +89 -18
  223. package/esm/large-text-input/DSControlledLargeTextInput.js +1 -1
  224. package/esm/large-text-input/styles.js +27 -9
  225. package/esm/mask-hook/hooks/useNumberMask.js +1 -5
  226. package/esm/mask-hook/hooks/usePhoneMask.js +1 -4
  227. package/esm/mask-hook/hooks/useRegExpMask.js +4 -7
  228. package/esm/mask-hook/hooks/useSSNMask.js +1 -4
  229. package/esm/mask-hook/hooks/useZipCodeMask.js +1 -4
  230. package/esm/mask-hook/utils/addSpecialCharacters.js +0 -1
  231. package/esm/mask-hook/utils/flatStringArray.js +0 -1
  232. package/esm/text-input/config/useInputText.js +0 -1
  233. package/esm/text-input/styled/borders.js +18 -7
  234. package/esm/text-input/styled/components.js +49 -6
  235. package/esm/toggle/ControlledToggle.js +0 -1
  236. package/esm/toggle/styles.js +7 -5
  237. package/package.json +39 -15
  238. package/types/autocomplete/parts/A11yFocusedOption.d.ts +5 -0
  239. package/types/autocomplete/parts/container/styled.d.ts +1 -1
  240. package/types/autocomplete/parts/styled.d.ts +0 -0
  241. package/types/autocomplete/utils/listHelper.d.ts +5 -5
  242. package/types/checkbox/react-desc-prop-types.d.ts +1 -1
  243. package/types/checkbox/styles.d.ts +1 -0
  244. package/types/combobox/parts/menu-list/styled.d.ts +1 -0
  245. package/types/combobox/react-desc-prop-types.d.ts +8 -6
  246. package/types/combobox/sharedTypes.d.ts +3 -2
  247. package/types/combobox/utils/listHelper.d.ts +1 -0
  248. package/types/date-time-picker/config/useChangeHandlers.d.ts +3 -1
  249. package/types/date-time-picker/config/useControlledDateTimePicker.d.ts +2 -5
  250. package/types/date-time-picker/config/useFocusTracker.d.ts +38 -0
  251. package/types/date-time-picker/config/useGetPropsBasedOnType.d.ts +6 -6
  252. package/types/date-time-picker/config/useGetReferences.d.ts +30 -36
  253. package/types/date-time-picker/config/useGlobalKeyHandlers.d.ts +3 -1
  254. package/types/date-time-picker/parts/DateInputs/DDInput.d.ts +2 -1
  255. package/types/date-time-picker/parts/DateInputs/MMInput.d.ts +2 -1
  256. package/types/date-time-picker/parts/DateInputs/YYYYInput.d.ts +2 -1
  257. package/types/date-time-picker/parts/Pickers/Calendar/useConfigCalendarCTX.d.ts +14 -0
  258. package/types/date-time-picker/parts/Pickers/Calendar/useFocusLogic.d.ts +1 -2
  259. package/types/date-time-picker/parts/Pickers/Calendar/usePopperTriggerLogic.d.ts +19 -0
  260. package/types/date-time-picker/parts/Pickers/TimeWheel/useKeyboardHandlers.d.ts +0 -6
  261. package/types/date-time-picker/parts/Pickers/TimeWheel/usePopperTriggerLogic.d.ts +14 -0
  262. package/types/date-time-picker/parts/TimeInputs/HHInput.d.ts +2 -1
  263. package/types/date-time-picker/parts/TimeInputs/MeridiemInput.d.ts +2 -1
  264. package/types/date-time-picker/parts/TimeInputs/MinutesInput.d.ts +2 -1
  265. package/types/date-time-picker/propTypes.d.ts +117 -0
  266. package/types/date-time-picker/sharedTypes.d.ts +1 -1
  267. package/types/date-time-picker/utils/constants.d.ts +0 -6
  268. package/types/input-group/exported-related/data-test-ids.d.ts +6 -0
  269. package/types/input-group/exported-related/index.d.ts +2 -0
  270. package/types/input-group/exported-related/theming.d.ts +6 -0
  271. package/types/input-group/styled.d.ts +4 -7
  272. package/types/text-input/config/useInputText.d.ts +4 -4
@@ -1,6 +1,5 @@
1
1
  import { useContext, useCallback, useMemo } from 'react';
2
2
  import { ControlledDateTimePickerContext } from '../../ControlledDateTimePickerCTX.js';
3
- import { homeEndArrowUpDownSemiKeys, homeEndArrowUpDownSpaceKeys, homeEndArrowUpDownKeys } from '../../utils/constants.js';
4
3
  import { prependStringWithPlaceHolders } from '../../utils/stringHelpers.js';
5
4
 
6
5
  /* eslint-disable complexity */
@@ -9,66 +8,53 @@ const useTimeInputs = () => {
9
8
  props: {
10
9
  disabled
11
10
  },
12
- lastSegmentRef,
13
11
  hours,
14
12
  minutes,
15
13
  meridiem,
16
- hideDate,
17
14
  withAnyRightController,
18
15
  withAnyPicker,
19
16
  withClearBtn,
20
17
  isWithDateInputs,
21
- hourInputRef,
22
- minutesInputRef,
23
- meridiemInputRef,
24
- yearInputRef,
25
- clearButtonRef,
26
- pickerButtonRef,
27
- monthInputRef,
28
18
  autoFocusHourInput,
29
19
  handleChangeHours,
30
20
  handleChangeMinutes,
31
21
  handleChangeMeridiem,
32
- setLatestInteractionRegion,
33
- minutesInterval
22
+ minutesInterval,
23
+ trackFocusFirstSegment,
24
+ trackFocusLastSegment,
25
+ trackFocusHourInput,
26
+ trackFocusMinuteInput,
27
+ trackFocusMeridiemInput,
28
+ trackFocusClearBtn,
29
+ trackFocusPicker,
30
+ trackFocusYearInput
34
31
  } = useContext(ControlledDateTimePickerContext);
35
- const setLatestInteractionRegionTimeInputs = useCallback(() => {
36
- setLatestInteractionRegion('time-inputs');
37
- }, [setLatestInteractionRegion]);
38
32
  const onHomeKeyDown = useCallback(() => {
39
- var _monthInputRef$curren, _monthInputRef$curren2, _hourInputRef$current, _hourInputRef$current2;
40
-
41
- 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 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);
42
- }, [hideDate, monthInputRef, hourInputRef]);
33
+ trackFocusFirstSegment();
34
+ }, [trackFocusFirstSegment]);
43
35
  const onEndKeyDown = useCallback(() => {
44
- var _pickerButtonRef$curr, _pickerButtonRef$curr2, _clearButtonRef$curre, _clearButtonRef$curre2, _meridiemInputRef$cur, _meridiemInputRef$cur2;
45
-
46
- if (withAnyPicker) pickerButtonRef === null || pickerButtonRef === void 0 ? void 0 : (_pickerButtonRef$curr = pickerButtonRef.current) === null || _pickerButtonRef$curr === void 0 ? void 0 : (_pickerButtonRef$curr2 = _pickerButtonRef$curr.focus) === null || _pickerButtonRef$curr2 === void 0 ? void 0 : _pickerButtonRef$curr2.call(_pickerButtonRef$curr);else if (withClearBtn) clearButtonRef === null || clearButtonRef === void 0 ? void 0 : (_clearButtonRef$curre = clearButtonRef.current) === null || _clearButtonRef$curre === void 0 ? void 0 : (_clearButtonRef$curre2 = _clearButtonRef$curre.focus) === null || _clearButtonRef$curre2 === void 0 ? void 0 : _clearButtonRef$curre2.call(_clearButtonRef$curre);else 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);
47
- }, [withAnyPicker, pickerButtonRef, withClearBtn, clearButtonRef, meridiemInputRef]);
36
+ trackFocusLastSegment();
37
+ }, [trackFocusLastSegment]);
48
38
  const onHoursFocus = useCallback(() => {
49
- setLatestInteractionRegionTimeInputs();
50
- }, [setLatestInteractionRegionTimeInputs]);
39
+ trackFocusHourInput();
40
+ }, [trackFocusHourInput]);
51
41
  const onHoursChange = useCallback(e => {
52
- var _e$target, _minutesInputRef$curr, _minutesInputRef$curr2;
53
-
54
- let newHours = e === null || e === void 0 ? void 0 : (_e$target = e.target) === null || _e$target === void 0 ? void 0 : _e$target.value; // converts hours 2~9 to 07~09
42
+ let newHours = e?.target?.value; // converts hours 2~9 to 07~09
55
43
 
56
44
  if (Number.parseInt(newHours, 10) > 1) newHours = prependStringWithPlaceHolders(newHours, 2);
57
45
  handleChangeHours(newHours, e); // auto-advance functionality:
58
46
 
59
- if (newHours.length === 2) minutesInputRef === null || minutesInputRef === void 0 ? void 0 : (_minutesInputRef$curr = minutesInputRef.current) === null || _minutesInputRef$curr === void 0 ? void 0 : (_minutesInputRef$curr2 = _minutesInputRef$curr.focus) === null || _minutesInputRef$curr2 === void 0 ? void 0 : _minutesInputRef$curr2.call(_minutesInputRef$curr);
60
- }, [minutesInputRef, handleChangeHours]);
47
+ if (newHours.length === 2) trackFocusMinuteInput();
48
+ }, [handleChangeHours, trackFocusMinuteInput]);
61
49
  const onHoursKeyDown = useCallback(e => {
62
- var _lastSegmentRef$curre, _lastSegmentRef$curre2;
63
-
64
50
  const {
65
51
  key,
66
52
  ctrlKey,
67
53
  metaKey
68
54
  } = e;
69
55
  const hoursStringConvertedToInteger = Number.parseInt(hours, 10);
70
- if (homeEndArrowUpDownSemiKeys.includes(key)) e.preventDefault();
71
- if (homeEndArrowUpDownSemiKeys.includes(key)) e.stopPropagation();
56
+ if (['Home', 'End', 'ArrowUp', 'ArrowDown', ':'].includes(key)) e.preventDefault();
57
+ if (['Home', 'End', 'ArrowUp', 'ArrowDown', ':'].includes(key)) e.stopPropagation();
72
58
  if (key === 'Home') onHomeKeyDown();
73
59
  if (key === 'End') onEndKeyDown();
74
60
 
@@ -76,33 +62,27 @@ const useTimeInputs = () => {
76
62
  const hoursInteger = Number.isNaN(hoursStringConvertedToInteger) ? 0 : hoursStringConvertedToInteger;
77
63
  let newHours;
78
64
  if (key === 'ArrowUp') newHours = hoursInteger + 1 <= 12 ? hoursInteger + 1 : hoursInteger;else newHours = hoursInteger - 1 > 1 ? hoursInteger - 1 : 1;
79
- newHours = prependStringWithPlaceHolders("".concat(newHours), 2);
65
+ newHours = prependStringWithPlaceHolders(`${newHours}`, 2);
80
66
  handleChangeHours(newHours, e);
81
67
  }
82
68
 
83
69
  if (!Number.isNaN(hoursStringConvertedToInteger) && key === ':') {
84
- var _minutesInputRef$curr3, _minutesInputRef$curr4;
85
-
86
- const newHours = prependStringWithPlaceHolders("".concat(hoursStringConvertedToInteger), 2);
70
+ const newHours = prependStringWithPlaceHolders(`${hoursStringConvertedToInteger}`, 2);
87
71
  handleChangeHours(newHours, e); // auto-advance functionality:
88
72
 
89
- if (newHours.length === 2) minutesInputRef === null || minutesInputRef === void 0 ? void 0 : (_minutesInputRef$curr3 = minutesInputRef.current) === null || _minutesInputRef$curr3 === void 0 ? void 0 : (_minutesInputRef$curr4 = _minutesInputRef$curr3.focus) === null || _minutesInputRef$curr4 === void 0 ? void 0 : _minutesInputRef$curr4.call(_minutesInputRef$curr3);
73
+ if (newHours.length === 2) trackFocusMinuteInput();
90
74
  } // regressive backspace functionality
91
75
 
92
76
 
93
77
  if (key === 'Backspace' && hours.length === 0 && isWithDateInputs) {
94
- var _yearInputRef$current, _yearInputRef$current2;
95
-
96
- 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);
78
+ trackFocusYearInput();
97
79
  } // focus last fragment on fill with now
98
80
 
99
81
 
100
- if ((ctrlKey || metaKey) && key === ';') lastSegmentRef === null || lastSegmentRef === void 0 ? void 0 : (_lastSegmentRef$curre = lastSegmentRef.current) === null || _lastSegmentRef$curre === void 0 ? void 0 : (_lastSegmentRef$curre2 = _lastSegmentRef$curre.focus) === null || _lastSegmentRef$curre2 === void 0 ? void 0 : _lastSegmentRef$curre2.call(_lastSegmentRef$curre);
101
- }, [hours, onHomeKeyDown, onEndKeyDown, isWithDateInputs, lastSegmentRef, handleChangeHours, minutesInputRef, yearInputRef]);
82
+ if ((ctrlKey || metaKey) && key === ';') trackFocusLastSegment();
83
+ }, [hours, isWithDateInputs, trackFocusYearInput, onHomeKeyDown, onEndKeyDown, trackFocusLastSegment, trackFocusMinuteInput, handleChangeHours]);
102
84
  const onHoursBlur = useCallback(e => {
103
- var _e$target2;
104
-
105
- const newHours = e === null || e === void 0 ? void 0 : (_e$target2 = e.target) === null || _e$target2 === void 0 ? void 0 : _e$target2.value;
85
+ const newHours = e?.target?.value;
106
86
  if (newHours === '0') handleChangeHours('01', e, {
107
87
  isAutomaticFillTrigger: true
108
88
  });else if (newHours.length > 0 && newHours.length < 2) handleChangeHours(prependStringWithPlaceHolders(newHours, 2), e, {
@@ -110,30 +90,25 @@ const useTimeInputs = () => {
110
90
  });
111
91
  }, [handleChangeHours]);
112
92
  const onMinutesFocus = useCallback(() => {
113
- setLatestInteractionRegionTimeInputs();
114
- }, [setLatestInteractionRegionTimeInputs]);
93
+ trackFocusMinuteInput();
94
+ }, [trackFocusMinuteInput]);
115
95
  const onMinutesChange = useCallback(e => {
116
- var _e$target3, _meridiemInputRef$cur3, _meridiemInputRef$cur4;
117
-
118
- let newMinutes = e === null || e === void 0 ? void 0 : (_e$target3 = e.target) === null || _e$target3 === void 0 ? void 0 : _e$target3.value; // converts minutes 7~9 to 07~09
96
+ let newMinutes = e?.target?.value; // converts minutes 7~9 to 07~09
119
97
 
120
98
  if (Number.parseInt(newMinutes, 10) > 6) newMinutes = prependStringWithPlaceHolders(newMinutes, 2);
121
99
  handleChangeMinutes(newMinutes, e); // auto-advance functionality:
122
- // if (newMinutes.length === 2) secondsInputRef?.current?.focus?.();
123
100
 
124
- if (newMinutes.length === 2) meridiemInputRef === null || meridiemInputRef === void 0 ? void 0 : (_meridiemInputRef$cur3 = meridiemInputRef.current) === null || _meridiemInputRef$cur3 === void 0 ? void 0 : (_meridiemInputRef$cur4 = _meridiemInputRef$cur3.focus) === null || _meridiemInputRef$cur4 === void 0 ? void 0 : _meridiemInputRef$cur4.call(_meridiemInputRef$cur3);
125
- }, [meridiemInputRef, handleChangeMinutes]);
101
+ if (newMinutes.length === 2) trackFocusMeridiemInput();
102
+ }, [handleChangeMinutes, trackFocusMeridiemInput]);
126
103
  const onMinutesKeyDown = useCallback(e => {
127
- var _lastSegmentRef$curre3, _lastSegmentRef$curre4;
128
-
129
104
  const {
130
105
  key,
131
106
  ctrlKey,
132
107
  metaKey
133
108
  } = e;
134
109
  const minutesStringConvertedToInteger = Number.parseInt(minutes, 10);
135
- if (homeEndArrowUpDownSpaceKeys.includes(key)) e.preventDefault();
136
- if (homeEndArrowUpDownSpaceKeys.includes(key)) e.stopPropagation();
110
+ if (['Home', 'End', 'ArrowUp', 'ArrowDown', ' '].includes(key)) e.preventDefault();
111
+ if (['Home', 'End', 'ArrowUp', 'ArrowDown', ' '].includes(key)) e.stopPropagation();
137
112
  if (key === 'Home') onHomeKeyDown();
138
113
  if (key === 'End') onEndKeyDown();
139
114
 
@@ -141,86 +116,69 @@ const useTimeInputs = () => {
141
116
  const minutesInteger = Number.isNaN(minutesStringConvertedToInteger) ? 0 : minutesStringConvertedToInteger;
142
117
  let newMinutes;
143
118
  if (key === 'ArrowUp') newMinutes = minutesInteger + minutesInterval <= 59 ? minutesInteger + minutesInterval : minutesInteger;else newMinutes = minutesInteger - minutesInterval > 0 ? minutesInteger - minutesInterval : 0;
144
- newMinutes = prependStringWithPlaceHolders("".concat(newMinutes), 2);
119
+ newMinutes = prependStringWithPlaceHolders(`${newMinutes}`, 2);
145
120
  handleChangeMinutes(newMinutes, e);
146
121
  }
147
122
 
148
123
  if (!Number.isNaN(minutesStringConvertedToInteger) && key === ' ') {
149
- var _meridiemInputRef$cur5, _meridiemInputRef$cur6;
150
-
151
- const newMinutes = prependStringWithPlaceHolders("".concat(minutesStringConvertedToInteger), 2);
124
+ const newMinutes = prependStringWithPlaceHolders(`${minutesStringConvertedToInteger}`, 2);
152
125
  handleChangeMinutes(newMinutes, e); // auto-advance functionality:
153
- // if (newMinutes.length === 2) secondsInputRef?.current?.focus?.();
154
126
 
155
- if (newMinutes.length === 2) meridiemInputRef === null || meridiemInputRef === void 0 ? void 0 : (_meridiemInputRef$cur5 = meridiemInputRef.current) === null || _meridiemInputRef$cur5 === void 0 ? void 0 : (_meridiemInputRef$cur6 = _meridiemInputRef$cur5.focus) === null || _meridiemInputRef$cur6 === void 0 ? void 0 : _meridiemInputRef$cur6.call(_meridiemInputRef$cur5);
127
+ if (newMinutes.length === 2) trackFocusMeridiemInput();
156
128
  } // regressive backspace functionality
157
129
 
158
130
 
159
- if (key === 'Backspace' && (minutes === null || minutes === void 0 ? void 0 : minutes.length) === 0) {
160
- var _hourInputRef$current3, _hourInputRef$current4;
161
-
162
- hourInputRef === null || hourInputRef === void 0 ? void 0 : (_hourInputRef$current3 = hourInputRef.current) === null || _hourInputRef$current3 === void 0 ? void 0 : (_hourInputRef$current4 = _hourInputRef$current3.focus) === null || _hourInputRef$current4 === void 0 ? void 0 : _hourInputRef$current4.call(_hourInputRef$current3);
131
+ if (key === 'Backspace' && minutes?.length === 0) {
132
+ trackFocusHourInput();
163
133
  } // focus last fragment on fill with now
164
134
 
165
135
 
166
- if ((ctrlKey || metaKey) && key === ';') lastSegmentRef === null || lastSegmentRef === void 0 ? void 0 : (_lastSegmentRef$curre3 = lastSegmentRef.current) === null || _lastSegmentRef$curre3 === void 0 ? void 0 : (_lastSegmentRef$curre4 = _lastSegmentRef$curre3.focus) === null || _lastSegmentRef$curre4 === void 0 ? void 0 : _lastSegmentRef$curre4.call(_lastSegmentRef$curre3);
167
- }, [minutes, onHomeKeyDown, onEndKeyDown, lastSegmentRef, minutesInterval, handleChangeMinutes, meridiemInputRef, hourInputRef]);
136
+ if ((ctrlKey || metaKey) && key === ';') trackFocusLastSegment();
137
+ }, [minutes, onHomeKeyDown, onEndKeyDown, trackFocusLastSegment, minutesInterval, handleChangeMinutes, trackFocusMeridiemInput, trackFocusHourInput]);
168
138
  const onMinutesBlur = useCallback(e => {
169
- var _e$target4;
170
-
171
- const newMinutes = e === null || e === void 0 ? void 0 : (_e$target4 = e.target) === null || _e$target4 === void 0 ? void 0 : _e$target4.value;
139
+ const newMinutes = e?.target?.value;
172
140
  if (newMinutes.length > 0 && newMinutes.length < 2) handleChangeMinutes(prependStringWithPlaceHolders(newMinutes, 2), e, {
173
141
  isAutomaticFillTrigger: true
174
142
  });
175
143
  }, [handleChangeMinutes]);
176
144
  const onMeridiemFocus = useCallback(() => {
177
- setLatestInteractionRegionTimeInputs();
178
- }, [setLatestInteractionRegionTimeInputs]);
145
+ trackFocusMeridiemInput();
146
+ }, [trackFocusMeridiemInput]);
179
147
  const onMeridiemChange = useCallback(e => {
180
- var _e$target5, _e$target5$value, _e$target5$value$toUp;
181
-
182
- let newMeridiem = e === null || e === void 0 ? void 0 : (_e$target5 = e.target) === null || _e$target5 === void 0 ? void 0 : (_e$target5$value = _e$target5.value) === null || _e$target5$value === void 0 ? void 0 : (_e$target5$value$toUp = _e$target5$value.toUpperCase) === null || _e$target5$value$toUp === void 0 ? void 0 : _e$target5$value$toUp.call(_e$target5$value); // if new value is length 1,
148
+ let newMeridiem = e?.target?.value?.toUpperCase?.(); // if new value is length 1,
183
149
  // if previous value was empty, auto-complete
184
150
  // if previous value was not empty, set to empty (regressive backspace)
185
151
 
186
- if (newMeridiem.length === 1) if (meridiem === '') newMeridiem = "".concat(newMeridiem, "M");else newMeridiem = '';
152
+ if (newMeridiem.length === 1) if (meridiem === '') newMeridiem = `${newMeridiem}M`;else newMeridiem = '';
187
153
  handleChangeMeridiem(newMeridiem, e); // auto-advance functionality:
188
154
 
189
155
  if (newMeridiem.length === 2 && withAnyRightController) {
190
- var _clearButtonRef$curre3, _clearButtonRef$curre4, _pickerButtonRef$curr3, _pickerButtonRef$curr4;
191
-
192
- if (withClearBtn) (_clearButtonRef$curre3 = clearButtonRef.current) === null || _clearButtonRef$curre3 === void 0 ? void 0 : (_clearButtonRef$curre4 = _clearButtonRef$curre3.focus) === null || _clearButtonRef$curre4 === void 0 ? void 0 : _clearButtonRef$curre4.call(_clearButtonRef$curre3);else if (withAnyPicker) pickerButtonRef === null || pickerButtonRef === void 0 ? void 0 : (_pickerButtonRef$curr3 = pickerButtonRef.current) === null || _pickerButtonRef$curr3 === void 0 ? void 0 : (_pickerButtonRef$curr4 = _pickerButtonRef$curr3.focus) === null || _pickerButtonRef$curr4 === void 0 ? void 0 : _pickerButtonRef$curr4.call(_pickerButtonRef$curr3);
156
+ if (withClearBtn) trackFocusClearBtn();else if (withAnyPicker) trackFocusPicker();
193
157
  }
194
- }, [meridiem, handleChangeMeridiem, withAnyRightController, withClearBtn, clearButtonRef, withAnyPicker, pickerButtonRef]);
158
+ }, [meridiem, handleChangeMeridiem, withAnyRightController, withClearBtn, trackFocusClearBtn, withAnyPicker, trackFocusPicker]);
195
159
  const onMeridiemKeyDown = useCallback(e => {
196
- var _lastSegmentRef$curre5, _lastSegmentRef$curre6;
197
-
198
160
  const {
199
161
  key,
200
162
  ctrlKey,
201
163
  metaKey
202
164
  } = e;
203
- if (homeEndArrowUpDownKeys.includes(key)) e.preventDefault();
204
- if (homeEndArrowUpDownKeys.includes(key)) e.stopPropagation();
165
+ if (['Home', 'End', 'ArrowUp', 'ArrowDown'].includes(key)) e.preventDefault();
166
+ if (['Home', 'End', 'ArrowUp', 'ArrowDown'].includes(key)) e.stopPropagation();
205
167
  if (key === 'Home') onHomeKeyDown();
206
168
  if (key === 'End') onEndKeyDown();
207
169
  if (key === 'ArrowUp' && meridiem !== 'AM') handleChangeMeridiem('AM', e);
208
170
  if (key === 'ArrowDown' && meridiem !== 'PM') handleChangeMeridiem('PM', e); // regressive backspace functionality
209
171
 
210
172
  if (key === 'Backspace') {
211
- var _minutesInputRef$curr5, _minutesInputRef$curr6;
212
-
213
- if ((meridiem === null || meridiem === void 0 ? void 0 : meridiem.length) === 2) handleChangeMeridiem('', e);else minutesInputRef === null || minutesInputRef === void 0 ? void 0 : (_minutesInputRef$curr5 = minutesInputRef.current) === null || _minutesInputRef$curr5 === void 0 ? void 0 : (_minutesInputRef$curr6 = _minutesInputRef$curr5.focus) === null || _minutesInputRef$curr6 === void 0 ? void 0 : _minutesInputRef$curr6.call(_minutesInputRef$curr5);
173
+ if (meridiem?.length === 2) handleChangeMeridiem('', e);else trackFocusMinuteInput();
214
174
  } // focus last fragment on fill with now
215
175
 
216
176
 
217
- if ((ctrlKey || metaKey) && key === ';') lastSegmentRef === null || lastSegmentRef === void 0 ? void 0 : (_lastSegmentRef$curre5 = lastSegmentRef.current) === null || _lastSegmentRef$curre5 === void 0 ? void 0 : (_lastSegmentRef$curre6 = _lastSegmentRef$curre5.focus) === null || _lastSegmentRef$curre6 === void 0 ? void 0 : _lastSegmentRef$curre6.call(_lastSegmentRef$curre5);
218
- }, [onHomeKeyDown, onEndKeyDown, meridiem, handleChangeMeridiem, lastSegmentRef, minutesInputRef]);
177
+ if ((ctrlKey || metaKey) && key === ';') trackFocusLastSegment();
178
+ }, [onHomeKeyDown, onEndKeyDown, meridiem, handleChangeMeridiem, trackFocusLastSegment, trackFocusMinuteInput]);
219
179
  const onMeridiemBlur = useCallback(e => {
220
- var _e$target6, _e$target6$value, _e$target6$value$toUp;
221
-
222
- const newMeridiem = e === null || e === void 0 ? void 0 : (_e$target6 = e.target) === null || _e$target6 === void 0 ? void 0 : (_e$target6$value = _e$target6.value) === null || _e$target6$value === void 0 ? void 0 : (_e$target6$value$toUp = _e$target6$value.toUpperCase) === null || _e$target6$value$toUp === void 0 ? void 0 : _e$target6$value$toUp.call(_e$target6$value);
223
- if (newMeridiem.length === 1) handleChangeMeridiem("".concat(newMeridiem, "M"), e, {
180
+ const newMeridiem = e?.target?.value?.toUpperCase?.();
181
+ if (newMeridiem.length === 1) handleChangeMeridiem(`${newMeridiem}M`, e, {
224
182
  isAutomaticFillTrigger: true
225
183
  });
226
184
  }, [handleChangeMeridiem]);
@@ -33,14 +33,8 @@ const announcableCardinalDays = {
33
33
  30: 'thirtieth',
34
34
  31: 'thirty first'
35
35
  };
36
- const homeEndAllArrowKeys = ['Home', 'End', 'ArrowUp', 'ArrowDown', 'ArrowLeft', 'ArrowRight'];
37
- const homeEndKeys = ['Home', 'End'];
38
- const homeEndArrowUpDownDashSlashesKeys = ['Home', 'End', 'ArrowUp', 'ArrowDown', '-', '/', '\\'];
39
- const homeEndArrowUpDownSpaceKeys = ['Home', 'End', 'ArrowUp', 'ArrowDown', ' '];
40
- const homeEndArrowUpDownSemiKeys = ['Home', 'End', 'ArrowUp', 'ArrowDown', ':'];
41
- const homeEndArrowUpDownKeys = ['Home', 'End', 'ArrowUp', 'ArrowDown'];
42
36
  const defaultMetaInfo = {
43
37
  isAutomaticFillTrigger: false
44
38
  };
45
39
 
46
- export { announcableCardinalDays, defaultMetaInfo, homeEndAllArrowKeys, homeEndArrowUpDownDashSlashesKeys, homeEndArrowUpDownKeys, homeEndArrowUpDownSemiKeys, homeEndArrowUpDownSpaceKeys, homeEndKeys, monthNames, weekDays };
40
+ export { announcableCardinalDays, defaultMetaInfo, monthNames, weekDays };
@@ -1,42 +1,33 @@
1
1
  import 'core-js/modules/esnext.async-iterator.map.js';
2
2
  import 'core-js/modules/esnext.iterator.map.js';
3
- import 'core-js/modules/web.dom-collections.iterator.js';
4
3
  import { createRef } from 'react';
5
4
  import { monthNames } from './constants.js';
6
5
  import { prependStringWithPlaceHolders, deconstructValuesFromDateString, isIncompleteString } from './stringHelpers.js';
7
6
  import { convertToPositiveNumberIfPossible } from './numberHelpers.js';
8
7
 
9
- const getDateValuesFromDate = day => {
10
- var _day$getMonth, _day$getDate, _day$getFullYear;
11
-
12
- return {
13
- month: day === null || day === void 0 ? void 0 : (_day$getMonth = day.getMonth) === null || _day$getMonth === void 0 ? void 0 : _day$getMonth.call(day),
14
- day: day === null || day === void 0 ? void 0 : (_day$getDate = day.getDate) === null || _day$getDate === void 0 ? void 0 : _day$getDate.call(day),
15
- year: day === null || day === void 0 ? void 0 : (_day$getFullYear = day.getFullYear) === null || _day$getFullYear === void 0 ? void 0 : _day$getFullYear.call(day)
16
- };
17
- };
8
+ const getDateValuesFromDate = day => ({
9
+ month: day?.getMonth?.(),
10
+ day: day?.getDate?.(),
11
+ year: day?.getFullYear?.()
12
+ });
18
13
  const getDateStringFromDay = day => {
19
- const monthFromDay = prependStringWithPlaceHolders("".concat(day.getMonth() + 1), 2); // months from 1-12
14
+ const monthFromDay = prependStringWithPlaceHolders(`${day.getMonth() + 1}`, 2); // months from 1-12
20
15
 
21
- const dayFromDay = prependStringWithPlaceHolders("".concat(day.getDate()), 2);
22
- const yearFromDay = prependStringWithPlaceHolders("".concat(day.getFullYear()), 4);
23
- return "".concat(monthFromDay, "/").concat(dayFromDay, "/").concat(yearFromDay);
16
+ const dayFromDay = prependStringWithPlaceHolders(`${day.getDate()}`, 2);
17
+ const yearFromDay = prependStringWithPlaceHolders(`${day.getFullYear()}`, 4);
18
+ return `${monthFromDay}/${dayFromDay}/${yearFromDay}`;
24
19
  };
25
20
  const getTimeStringFromDay = day => {
26
21
  const hoursNum = day.getHours();
27
22
  const meridiem = hoursNum > 12 ? 'PM' : 'AM';
28
23
  const twelveHourFormat = hoursNum > 12 ? hoursNum - 12 : hoursNum;
29
24
  const minutesNum = day.getMinutes();
30
- const hoursFromDay = prependStringWithPlaceHolders("".concat(twelveHourFormat), 2);
31
- const minutesFromDay = prependStringWithPlaceHolders("".concat(minutesNum), 2);
32
- return "".concat(hoursFromDay, ":").concat(minutesFromDay, " ").concat(meridiem);
25
+ const hoursFromDay = prependStringWithPlaceHolders(`${twelveHourFormat}`, 2);
26
+ const minutesFromDay = prependStringWithPlaceHolders(`${minutesNum}`, 2);
27
+ return `${hoursFromDay}:${minutesFromDay} ${meridiem}`;
33
28
  };
34
29
  const getMonthNameByMonthNumber = monthNumber => monthNames[monthNumber];
35
- const isSameDateMoment = (dateA, dateB) => {
36
- var _dateA$getTime, _dateB$getTime;
37
-
38
- return (dateA === null || dateA === void 0 ? void 0 : (_dateA$getTime = dateA.getTime) === null || _dateA$getTime === void 0 ? void 0 : _dateA$getTime.call(dateA)) === (dateB === null || dateB === void 0 ? void 0 : (_dateB$getTime = dateB.getTime) === null || _dateB$getTime === void 0 ? void 0 : _dateB$getTime.call(dateB));
39
- };
30
+ const isSameDateMoment = (dateA, dateB) => dateA?.getTime?.() === dateB?.getTime?.();
40
31
  const compareTwoDatesDayEquality = (dayA, dayB) => {
41
32
  const {
42
33
  day: currD,
@@ -51,11 +42,7 @@ const compareTwoDatesDayEquality = (dayA, dayB) => {
51
42
  return currD === focusD && currM === focusM && currY === focusY;
52
43
  };
53
44
  const getLastDayOfMonth = (month, year) => new Date(year, month + 1, 0);
54
- const isValidDayForTheMonth = (month, year, day) => {
55
- var _Date, _Date$getMonth;
56
-
57
- return ((_Date = new Date(year, month, day)) === null || _Date === void 0 ? void 0 : (_Date$getMonth = _Date.getMonth) === null || _Date$getMonth === void 0 ? void 0 : _Date$getMonth.call(_Date)) === month;
58
- };
45
+ const isValidDayForTheMonth = (month, year, day) => new Date(year, month, day)?.getMonth?.() === month;
59
46
  const getDayFromDateString = dateString => {
60
47
  const {
61
48
  month,
@@ -69,8 +56,6 @@ const getDayFromDateString = dateString => {
69
56
  return null;
70
57
  };
71
58
  const isValidDayForTheMonthDateString = dateString => {
72
- var _getDayFromDateString, _getDayFromDateString2;
73
-
74
59
  if (isIncompleteString(dateString)) return true;
75
60
  const {
76
61
  month
@@ -78,7 +63,7 @@ const isValidDayForTheMonthDateString = dateString => {
78
63
  const monthInt = convertToPositiveNumberIfPossible(month);
79
64
  if (monthInt === -1) return false;
80
65
  const monthDateMonth = monthInt - 1;
81
- return ((_getDayFromDateString = getDayFromDateString(dateString)) === null || _getDayFromDateString === void 0 ? void 0 : (_getDayFromDateString2 = _getDayFromDateString.getMonth) === null || _getDayFromDateString2 === void 0 ? void 0 : _getDayFromDateString2.call(_getDayFromDateString)) === monthDateMonth;
66
+ return getDayFromDateString(dateString)?.getMonth?.() === monthDateMonth;
82
67
  };
83
68
  const getValidationDateStringMetaInfo = function (dateString) {
84
69
  let getIsOutOfRangeDay = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : day => false;
@@ -205,8 +190,6 @@ const getFirstXDaysFromNextMonth = (month, year, howMany) => {
205
190
  return days;
206
191
  };
207
192
  const getFiveBySevenCurrentMonthDaysMatrix = (month, year) => {
208
- var _currentMonthDays$, _currentMonthDays$$da, _currentMonthDays, _currentMonthDays$day;
209
-
210
193
  const currentMonthDays = getDaysInMonth(month, year).map(day => ({
211
194
  day,
212
195
  dayAsString: getDateStringFromDay(day),
@@ -216,7 +199,7 @@ const getFiveBySevenCurrentMonthDaysMatrix = (month, year) => {
216
199
  isHidden: false,
217
200
  dayBtnRef: /*#__PURE__*/createRef()
218
201
  }));
219
- const firstDayOfTheMonthWeekDay = currentMonthDays === null || currentMonthDays === void 0 ? void 0 : (_currentMonthDays$ = currentMonthDays[0]) === null || _currentMonthDays$ === void 0 ? void 0 : (_currentMonthDays$$da = _currentMonthDays$.day) === null || _currentMonthDays$$da === void 0 ? void 0 : _currentMonthDays$$da.getDay();
202
+ const firstDayOfTheMonthWeekDay = currentMonthDays?.[0]?.day?.getDay();
220
203
  const previousMonthDaysToPrepend = getLastXDaysFromPreviousMonth(month, year, firstDayOfTheMonthWeekDay).map(day => ({
221
204
  day,
222
205
  dayAsString: getDateStringFromDay(day),
@@ -226,7 +209,7 @@ const getFiveBySevenCurrentMonthDaysMatrix = (month, year) => {
226
209
  isHidden: false,
227
210
  dayBtnRef: /*#__PURE__*/createRef()
228
211
  }));
229
- const lastDayOfTheMonthWeekDay = currentMonthDays === null || currentMonthDays === void 0 ? void 0 : (_currentMonthDays = currentMonthDays[currentMonthDays.length - 1]) === null || _currentMonthDays === void 0 ? void 0 : (_currentMonthDays$day = _currentMonthDays.day) === null || _currentMonthDays$day === void 0 ? void 0 : _currentMonthDays$day.getDay();
212
+ const lastDayOfTheMonthWeekDay = currentMonthDays?.[currentMonthDays.length - 1]?.day?.getDay();
230
213
  const nextMonthDaysToAppend = getFirstXDaysFromNextMonth(month, year, 6 - lastDayOfTheMonthWeekDay).map(day => ({
231
214
  day,
232
215
  dayAsString: getDateStringFromDay(day),
@@ -25,50 +25,52 @@ const useGetStartingFocusedDay = () => {
25
25
  onCalendarOpenFocusedDay
26
26
  } = useContext(ControlledDateTimePickerContext);
27
27
  const dayFromInputValues = useGetDayFromDateString();
28
+ const {
29
+ month: inputValuesSplitMonth,
30
+ day: inputValuesSplitDay,
31
+ year: inputValuesDaySplitYear
32
+ } = dayFromInputValues ? getDateValuesFromDate(dayFromInputValues) : {
33
+ month: null,
34
+ day: null,
35
+ year: null
36
+ };
37
+ const isInputFilledAndValid = inputValuesSplitMonth && inputValuesSplitDay && inputValuesDaySplitYear && isValidDayForTheMonth(inputValuesSplitMonth, inputValuesDaySplitYear, inputValuesSplitDay);
38
+ const isOnCalendarOpenFocusedDayEmpty = !onCalendarOpenFocusedDay;
39
+ const shouldFillWithOnCalendarOpenFocusedDay = !isInputFilledAndValid && !isOnCalendarOpenFocusedDayEmpty;
28
40
  return useMemo(() => {
29
- const startingDay = _objectSpread({}, empty);
41
+ const startingDay = _objectSpread({}, empty); // if input was filled start focus is the filled value (if it's valid day for the month)
30
42
 
31
- if (dayFromInputValues) {
32
- const {
33
- month: inputValuesSplitMonth,
34
- day: inputValuesSplitDay,
35
- year: inputValuesDaySplitYear
36
- } = getDateValuesFromDate(dayFromInputValues);
37
- const isInputFilledAndValid = inputValuesSplitMonth && inputValuesSplitDay && inputValuesDaySplitYear && isValidDayForTheMonth(inputValuesSplitMonth, inputValuesDaySplitYear, inputValuesSplitDay);
38
- const isOnCalendarOpenFocusedDayEmpty = !onCalendarOpenFocusedDay;
39
- const shouldFillWithOnCalendarOpenFocusedDay = !isInputFilledAndValid && !isOnCalendarOpenFocusedDayEmpty; // if input was filled start focus is the filled value (if it's valid day for the month)
40
43
 
41
- if (isInputFilledAndValid) {
42
- startingDay.startFocusedMonth = inputValuesSplitMonth;
43
- startingDay.startFocusedDay = inputValuesSplitDay;
44
- startingDay.startFocusedYear = inputValuesDaySplitYear;
45
- startingDay.startFocusedDate = dayFromInputValues; // if input was not filled (or filled invalid) and there is no onCalendarOpenFocusedDay start focus is not a day
46
- } else if (isOnCalendarOpenFocusedDayEmpty) {
47
- // if input was not filled and there is onCalendarOpenFocusedDay start focus is onCalendarOpenFocusedDay day
48
- return empty;
49
- } else if (shouldFillWithOnCalendarOpenFocusedDay) {
50
- const {
51
- month: focusedDaySplitMonth,
52
- day: focusedDaySplitDay,
53
- year: focusedDaySplitYear
54
- } = deconstructValuesFromDateString(onCalendarOpenFocusedDay);
55
- const monthAsInt = convertToPositiveNumberIfPossible(focusedDaySplitMonth);
56
- const dayAsInt = convertToPositiveNumberIfPossible(focusedDaySplitDay);
57
- const yearAsInt = convertToPositiveNumberIfPossible(focusedDaySplitYear); // if this condition is false, return will be the same as return empty
58
- // because startFocusedMonth/Day/Year/Date will be === null
59
- // which is the expected result
44
+ if (isInputFilledAndValid) {
45
+ startingDay.startFocusedMonth = inputValuesSplitMonth;
46
+ startingDay.startFocusedDay = inputValuesSplitDay;
47
+ startingDay.startFocusedYear = inputValuesDaySplitYear;
48
+ startingDay.startFocusedDate = dayFromInputValues; // if input was not filled (or filled invalid) and there is no onCalendarOpenFocusedDay start focus is not a day
49
+ } else if (isOnCalendarOpenFocusedDayEmpty) {
50
+ // if input was not filled and there is onCalendarOpenFocusedDay start focus is onCalendarOpenFocusedDay day
51
+ return empty;
52
+ } else if (shouldFillWithOnCalendarOpenFocusedDay) {
53
+ const {
54
+ month: focusedDaySplitMonth,
55
+ day: focusedDaySplitDay,
56
+ year: focusedDaySplitYear
57
+ } = deconstructValuesFromDateString(onCalendarOpenFocusedDay);
58
+ const monthAsInt = convertToPositiveNumberIfPossible(focusedDaySplitMonth);
59
+ const dayAsInt = convertToPositiveNumberIfPossible(focusedDaySplitDay);
60
+ const yearAsInt = convertToPositiveNumberIfPossible(focusedDaySplitYear); // if this condition is false, return will be the same as return empty
61
+ // because startFocusedMonth/Day/Year/Date will be === null
62
+ // which is the expected result
60
63
 
61
- if (monthAsInt !== -1 && dayAsInt !== -1 && yearAsInt !== -1 && isValidDayForTheMonth(monthAsInt - 1, yearAsInt, dayAsInt)) {
62
- startingDay.startFocusedMonth = monthAsInt;
63
- startingDay.startFocusedDay = dayAsInt;
64
- startingDay.startFocusedYear = yearAsInt;
65
- startingDay.startFocusedDate = new Date(yearAsInt, monthAsInt - 1, dayAsInt);
66
- }
64
+ if (monthAsInt !== -1 && dayAsInt !== -1 && yearAsInt !== -1 && isValidDayForTheMonth(monthAsInt - 1, yearAsInt, dayAsInt)) {
65
+ startingDay.startFocusedMonth = monthAsInt;
66
+ startingDay.startFocusedDay = dayAsInt;
67
+ startingDay.startFocusedYear = yearAsInt;
68
+ startingDay.startFocusedDate = new Date(yearAsInt, monthAsInt - 1, dayAsInt);
67
69
  }
68
70
  }
69
71
 
70
72
  return startingDay;
71
- }, [dayFromInputValues, onCalendarOpenFocusedDay]);
73
+ }, [dayFromInputValues, inputValuesDaySplitYear, inputValuesSplitDay, inputValuesSplitMonth, isInputFilledAndValid, isOnCalendarOpenFocusedDayEmpty, onCalendarOpenFocusedDay, shouldFillWithOnCalendarOpenFocusedDay]);
72
74
  };
73
75
 
74
76
  export { useGetStartingFocusedDay };
@@ -3,10 +3,8 @@ import { useEffect } from 'react';
3
3
  const useOnClickOutside = (ref, handler) => {
4
4
  useEffect(() => {
5
5
  const listener = event => {
6
- var _ref$contains;
7
-
8
6
  // Do nothing if clicking ref's element or descendent elements
9
- if (event.target instanceof Element) if (!ref || ref !== null && ref !== void 0 && (_ref$contains = ref.contains) !== null && _ref$contains !== void 0 && _ref$contains.call(ref, event.target)) {
7
+ if (event.target instanceof Element) if (!ref || ref?.contains?.(event.target)) {
10
8
  return;
11
9
  }
12
10
  handler(event);
@@ -1,7 +1,5 @@
1
1
  import 'core-js/modules/esnext.async-iterator.map.js';
2
2
  import 'core-js/modules/esnext.iterator.map.js';
3
- import 'core-js/modules/web.dom-collections.iterator.js';
4
- import 'core-js/modules/es.string.replace.js';
5
3
  import { monthNames, announcableCardinalDays } from './constants.js';
6
4
  import { convertToPositiveNumberIfPossible } from './numberHelpers.js';
7
5
 
@@ -27,13 +25,9 @@ const getFormattedDateString = _ref => {
27
25
  const finalMonth = fillStringWithPlaceHolders(month, 2);
28
26
  const finalDay = fillStringWithPlaceHolders(day, 2);
29
27
  const finalYear = fillStringWithPlaceHolders(year, 4);
30
- return "".concat(finalMonth, "/").concat(finalDay, "/").concat(finalYear);
31
- };
32
- const dateTimeToDate = dateTime => {
33
- var _dateTime$split, _dateTime$split$call;
34
-
35
- return dateTime === null || dateTime === void 0 ? void 0 : (_dateTime$split = dateTime.split) === null || _dateTime$split === void 0 ? void 0 : (_dateTime$split$call = _dateTime$split.call(dateTime, ' ')) === null || _dateTime$split$call === void 0 ? void 0 : _dateTime$split$call[0];
28
+ return `${finalMonth}/${finalDay}/${finalYear}`;
36
29
  };
30
+ const dateTimeToDate = dateTime => dateTime?.split?.(' ')?.[0];
37
31
  const deconstructValuesFromDateString = dateString => {
38
32
  const [dirtyMonth = '', dirtyDay = '', dirtyYear = ''] = dateString.split('/');
39
33
  const replaceAllRegexp = /_/g;
@@ -79,13 +73,13 @@ const getFormattedTimeString = _ref2 => {
79
73
 
80
74
  const finalMeridiem = fillStringWithPlaceHolders(meridiem, 2); // return `${finalHour}:${finalMinutes}:${finalSeconds} ${finalMeridiem}`;// <-- seconds format
81
75
 
82
- return "".concat(finalHour, ":").concat(finalMinutes, " ").concat(finalMeridiem);
76
+ return `${finalHour}:${finalMinutes} ${finalMeridiem}`;
83
77
  };
84
78
  const dateTimeToTime = dateTime => {
85
79
  const [// eslint-disable-next-line @typescript-eslint/no-unused-vars, no-unused-vars
86
80
  date, // timeNumbers = '__:__:__', // <-- seconds format
87
81
  timeNumbers = '__:__', timeMeridiem = '__'] = dateTime.split(' ');
88
- return "".concat(timeNumbers, " ").concat(timeMeridiem);
82
+ return `${timeNumbers} ${timeMeridiem}`;
89
83
  };
90
84
  const deconstructTimeValues = timeString => {
91
85
  const [dirtyTimes = '', dirtyMeridiem] = timeString.split(' '); // <--['__:__','__']
@@ -131,7 +125,7 @@ const getAriaDayFromDateString = dateString => {
131
125
  const dayNum = convertToPositiveNumberIfPossible(dayString);
132
126
  const yearNum = convertToPositiveNumberIfPossible(yearString);
133
127
  if (monthNum === -1 || dayNum === -1 || yearNum === -1) return '';
134
- return "".concat(monthNames[monthNum - 1], " ").concat(announcableCardinalDays[dayNum], " ").concat(yearNum);
128
+ return `${monthNames[monthNum - 1]} ${announcableCardinalDays[dayNum]} ${yearNum}`;
135
129
  };
136
130
 
137
131
  export { dateTimeToDate, dateTimeToTime, deconstructTimeValues, deconstructValuesFromDateString, deconstructValuesFromTimeString, fillStringWithPlaceHolders, getAriaDayFromDateString, getFormattedDateString, getFormattedTimeString, isEmptyDateStringMask, isEmptyDateTimeStringMask, isEmptyTimeStringMask, isIncompleteString, isValidDateString, isValidTimeString, prependStringWithPlaceHolders };
@@ -6,10 +6,10 @@ import 'core-js/modules/esnext.iterator.for-each.js';
6
6
  import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
7
7
  import _jsx from '@babel/runtime/helpers/esm/jsx';
8
8
  import { useMemo } from 'react';
9
- import { describe, useValidateTypescriptPropTypes, useGetGlobalAttributes } from '@elliemae/ds-props-helpers';
9
+ import { describe, useValidateTypescriptPropTypes, useGetGlobalAttributes, useGetXstyledProps } from '@elliemae/ds-props-helpers';
10
10
  import { StyledContainer, StyledLeftAddon, StyledInput, StyledRightAddon } from './styled.js';
11
11
  import { propTypes } from './react-desc-prop-types.js';
12
- import { InputGroupDataTestIds } from './InputGroupDataTestIds.js';
12
+ import { InputGroupDataTestIds } from './exported-related/data-test-ids.js';
13
13
  import { jsxs } from 'react/jsx-runtime';
14
14
 
15
15
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
@@ -24,6 +24,7 @@ const DSInputGroup = props => {
24
24
  rightAddon
25
25
  } = props;
26
26
  const globals = useGetGlobalAttributes(props);
27
+ const xstyledProps = useGetXstyledProps(props);
27
28
  const cols = useMemo(() => {
28
29
  if (leftAddon && rightAddon) {
29
30
  return ['max-content', 'auto', 'max-content'];
@@ -39,10 +40,10 @@ const DSInputGroup = props => {
39
40
 
40
41
  return ['auto'];
41
42
  }, [leftAddon, rightAddon]);
42
- return /*#__PURE__*/jsxs(StyledContainer, _objectSpread(_objectSpread({
43
+ return /*#__PURE__*/jsxs(StyledContainer, _objectSpread(_objectSpread(_objectSpread({
43
44
  cols: cols,
44
45
  "data-testid": InputGroupDataTestIds.CONTAINER
45
- }, globals), {}, {
46
+ }, globals), xstyledProps), {}, {
46
47
  children: [leftAddon && /*#__PURE__*/_jsx(StyledLeftAddon, {
47
48
  "data-testid": InputGroupDataTestIds.LEFTADDON
48
49
  }, void 0, leftAddon), /*#__PURE__*/_jsx(StyledInput, {
@@ -0,0 +1,8 @@
1
+ const InputGroupDataTestIds = {
2
+ CONTAINER: 'ds-input-group-container',
3
+ LEFTADDON: 'ds-input-group-left-addon',
4
+ RIGHTADDON: 'ds-input-group-right-addon',
5
+ INPUTCONTAINER: 'ds-input-group-input-container'
6
+ };
7
+
8
+ export { InputGroupDataTestIds };
@@ -0,0 +1,2 @@
1
+ export { InputGroupDataTestIds } from './data-test-ids.js';
2
+ export { DSInputGroupName, DSInputGroupSlots } from './theming.js';
@@ -0,0 +1,8 @@
1
+ const DSInputGroupName = 'ds-input-group';
2
+ const DSInputGroupSlots = {
3
+ CONTAINER: 'root',
4
+ LEFT_ADDON: 'leftaddon',
5
+ RIGHT_ADDON: 'rightaddon'
6
+ };
7
+
8
+ export { DSInputGroupName, DSInputGroupSlots };