@elliemae/ds-controlled-form 2.0.0-alpha.1 → 2.0.0-alpha.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 (241) hide show
  1. package/cjs/controlled-checkbox/ControlledCheckbox.js +13 -6
  2. package/cjs/controlled-checkbox/config/useValidateProps.js +5 -7
  3. package/cjs/controlled-checkbox/propTypes.js +5 -4
  4. package/cjs/controlled-checkbox/styles.js +88 -52
  5. package/cjs/controlled-checkbox/utils/setMultipleRefs.js +4 -0
  6. package/cjs/controlled-checkbox/utils/styleHelpers.js +15 -27
  7. package/cjs/controlled-date-range-picker/ControlledDateRangePicker.js +2 -2
  8. package/cjs/controlled-date-range-picker/ControlledDateRangePickerCTX.js +3 -2
  9. package/cjs/controlled-date-range-picker/ControlledDateRangePickerDatatestid.js +1 -18
  10. package/cjs/controlled-date-range-picker/config/useControlledDateRangePicker.js +19 -3
  11. package/cjs/controlled-date-range-picker/config/useRangePickerLogic.js +22 -13
  12. package/cjs/controlled-date-range-picker/parts/ControlledDateRangeCalendar.js +9 -1
  13. package/cjs/controlled-date-range-picker/parts/ControlledDateRangeContent.js +30 -5
  14. package/cjs/controlled-date-range-picker/parts/ControlledDateRangeFromDate.js +13 -3
  15. package/cjs/controlled-date-range-picker/parts/ControlledDateRangeToDate.js +9 -1
  16. package/cjs/controlled-date-time-picker/ControlledDateTimePicker.js +2 -2
  17. package/cjs/controlled-date-time-picker/ControlledDateTimePickerCTX.js +23 -2
  18. package/cjs/controlled-date-time-picker/ControlledDateTimePickerDatatestid.js +31 -4
  19. package/cjs/controlled-date-time-picker/config/useControlledDateTimePicker.js +254 -36
  20. package/cjs/controlled-date-time-picker/config/useGetDestructuredValues.js +149 -0
  21. package/cjs/controlled-date-time-picker/config/useValidateProps.js +10 -41
  22. package/cjs/controlled-date-time-picker/index.js +1 -1
  23. package/cjs/controlled-date-time-picker/parts/ClearButton/ClearButton.js +11 -9
  24. package/cjs/controlled-date-time-picker/parts/ClearButton/useClearButton.js +48 -3
  25. package/cjs/controlled-date-time-picker/parts/ControlledDateTimePickerContent.js +37 -16
  26. package/cjs/controlled-date-time-picker/parts/DateInputs/DDInput.js +16 -11
  27. package/cjs/controlled-date-time-picker/parts/DateInputs/DateInputs.js +21 -11
  28. package/cjs/controlled-date-time-picker/parts/DateInputs/MMInput.js +18 -11
  29. package/cjs/controlled-date-time-picker/parts/DateInputs/YYYYInput.js +16 -11
  30. package/cjs/controlled-date-time-picker/parts/DateInputs/useDateInputs.js +117 -66
  31. package/cjs/controlled-date-time-picker/parts/Pickers/Calendar/Calendar.js +9 -8
  32. package/cjs/controlled-date-time-picker/parts/Pickers/Calendar/CalendarBody.js +10 -4
  33. package/cjs/controlled-date-time-picker/parts/Pickers/Calendar/CalendarContent.js +15 -9
  34. package/cjs/controlled-date-time-picker/parts/Pickers/Calendar/CalendarContext.js +7 -1
  35. package/cjs/controlled-date-time-picker/parts/Pickers/Calendar/CalendarDaysList.js +33 -9
  36. package/cjs/controlled-date-time-picker/parts/Pickers/Calendar/CalendarFooter.js +3 -1
  37. package/cjs/controlled-date-time-picker/parts/Pickers/Calendar/CalendarHead.js +43 -44
  38. package/cjs/controlled-date-time-picker/parts/Pickers/Calendar/CalendarIconTrigger.js +13 -12
  39. package/cjs/controlled-date-time-picker/parts/Pickers/Calendar/CalendarMonthDays.js +7 -3
  40. package/cjs/controlled-date-time-picker/parts/Pickers/Calendar/CalendarWeekDays.js +34 -2
  41. package/cjs/controlled-date-time-picker/parts/Pickers/Calendar/CalendarWrapper.js +10 -3
  42. package/cjs/controlled-date-time-picker/parts/Pickers/Calendar/Day.js +59 -28
  43. package/cjs/controlled-date-time-picker/parts/Pickers/Calendar/Styleds.js +339 -115
  44. package/cjs/controlled-date-time-picker/parts/Pickers/Calendar/useConfigCalendarCTX.js +42 -42
  45. package/cjs/controlled-date-time-picker/parts/Pickers/Calendar/useCurrentDisplayedMonthYearLogic.js +1 -1
  46. package/cjs/controlled-date-time-picker/parts/Pickers/Calendar/useFocusLogic.js +48 -23
  47. package/cjs/controlled-date-time-picker/parts/Pickers/Calendar/useKeyboardHandlers.js +135 -59
  48. package/cjs/controlled-date-time-picker/parts/Pickers/Calendar/usePopperTriggerLogic.js +26 -14
  49. package/cjs/controlled-date-time-picker/parts/Pickers/CalendarWithTimeWheel/CalendarWithTimeWheel.js +4 -4
  50. package/cjs/controlled-date-time-picker/parts/Pickers/CalendarWithTimeWheel/CalendarWithTimeWheelContent.js +5 -3
  51. package/cjs/controlled-date-time-picker/parts/Pickers/CalendarWithTimeWheel/CalendarWithTimeWheelContext.js +4 -2
  52. package/cjs/controlled-date-time-picker/parts/Pickers/CalendarWithTimeWheel/CalendarWithTimeWheelFooter.js +3 -1
  53. package/cjs/controlled-date-time-picker/parts/Pickers/CalendarWithTimeWheel/CalendarWithTimeWheelIconTrigger.js +13 -12
  54. package/cjs/controlled-date-time-picker/parts/Pickers/CalendarWithTimeWheel/CalendarWithTimeWheelWrapper.js +10 -3
  55. package/cjs/controlled-date-time-picker/parts/Pickers/CalendarWithTimeWheel/Styleds.js +61 -24
  56. package/cjs/controlled-date-time-picker/parts/Pickers/CalendarWithTimeWheel/useConfigCalendarWithTimeWheelCTX.js +23 -8
  57. package/cjs/controlled-date-time-picker/parts/Pickers/PickersIcons.js +3 -3
  58. package/cjs/controlled-date-time-picker/parts/Pickers/TimeWheel/HoursList.js +38 -26
  59. package/cjs/controlled-date-time-picker/parts/Pickers/TimeWheel/MeridiemList.js +34 -31
  60. package/cjs/controlled-date-time-picker/parts/Pickers/TimeWheel/MinutesList.js +36 -26
  61. package/cjs/controlled-date-time-picker/parts/Pickers/TimeWheel/SecondsList.js +26 -23
  62. package/cjs/controlled-date-time-picker/parts/Pickers/TimeWheel/Styleds.js +211 -150
  63. package/cjs/controlled-date-time-picker/parts/Pickers/TimeWheel/TimeWheel.js +9 -8
  64. package/cjs/controlled-date-time-picker/parts/Pickers/TimeWheel/TimeWheelContent.js +9 -6
  65. package/cjs/controlled-date-time-picker/parts/Pickers/TimeWheel/TimeWheelContext.js +5 -2
  66. package/cjs/controlled-date-time-picker/parts/Pickers/TimeWheel/TimeWheelFooter.js +3 -1
  67. package/cjs/controlled-date-time-picker/parts/Pickers/TimeWheel/TimeWheelIconTrigger.js +12 -12
  68. package/cjs/controlled-date-time-picker/parts/Pickers/TimeWheel/TimeWheelWrapper.js +10 -3
  69. package/cjs/controlled-date-time-picker/parts/Pickers/TimeWheel/useConfigTimePickerCTX.js +10 -58
  70. package/cjs/controlled-date-time-picker/parts/Pickers/TimeWheel/useCurrentDisplayedWheelsLogic.js +11 -8
  71. package/cjs/controlled-date-time-picker/parts/Pickers/TimeWheel/useKeyboardHandlers.js +184 -147
  72. package/cjs/controlled-date-time-picker/parts/Pickers/TimeWheel/usePopperTriggerLogic.js +23 -12
  73. package/cjs/controlled-date-time-picker/parts/Styleds.js +80 -42
  74. package/cjs/controlled-date-time-picker/parts/TimeInputs/HHInput.js +18 -11
  75. package/cjs/controlled-date-time-picker/parts/TimeInputs/MeridiemInput.js +17 -11
  76. package/cjs/controlled-date-time-picker/parts/TimeInputs/MinutesInput.js +16 -11
  77. package/cjs/controlled-date-time-picker/parts/TimeInputs/TimeInputs.js +20 -11
  78. package/cjs/controlled-date-time-picker/parts/TimeInputs/useTimeInputs.js +109 -205
  79. package/cjs/controlled-date-time-picker/propTypes.js +3 -1
  80. package/cjs/controlled-date-time-picker/utils/constants.js +59 -0
  81. package/cjs/controlled-date-time-picker/utils/dateHelpers.js +41 -23
  82. package/cjs/controlled-date-time-picker/utils/dateTimeHelpers.js +8 -3
  83. package/cjs/controlled-date-time-picker/utils/hooks/useGetMonthYearFromDateStringOrEmptyStartingMonth.js +1 -1
  84. package/cjs/controlled-date-time-picker/utils/stringHelpers.js +43 -17
  85. package/cjs/controlled-date-time-picker/utils/timeHelpers.js +2 -1
  86. package/cjs/controlled-toggle/ControlledToggle.js +52 -36
  87. package/cjs/controlled-toggle/propTypes.js +3 -2
  88. package/cjs/controlled-toggle/styles.js +146 -79
  89. package/cjs/controlled-toggle/utils/addTooltipOnReadOnly.js +2 -2
  90. package/cjs/controlled-toggle/utils/styleHelpers.js +15 -9
  91. package/cjs/index.js +1 -1
  92. package/esm/controlled-checkbox/ControlledCheckbox.js +12 -5
  93. package/esm/controlled-checkbox/config/useValidateProps.js +6 -8
  94. package/esm/controlled-checkbox/propTypes.js +5 -4
  95. package/esm/controlled-checkbox/styles.js +84 -48
  96. package/esm/controlled-checkbox/utils/setMultipleRefs.js +4 -0
  97. package/esm/controlled-checkbox/utils/styleHelpers.js +15 -27
  98. package/esm/controlled-date-range-picker/ControlledDateRangePickerCTX.js +2 -1
  99. package/esm/controlled-date-range-picker/ControlledDateRangePickerDatatestid.js +1 -18
  100. package/esm/controlled-date-range-picker/config/useControlledDateRangePicker.js +15 -3
  101. package/esm/controlled-date-range-picker/config/useRangePickerLogic.js +21 -12
  102. package/esm/controlled-date-range-picker/parts/ControlledDateRangeCalendar.js +8 -0
  103. package/esm/controlled-date-range-picker/parts/ControlledDateRangeContent.js +28 -4
  104. package/esm/controlled-date-range-picker/parts/ControlledDateRangeFromDate.js +12 -2
  105. package/esm/controlled-date-range-picker/parts/ControlledDateRangeToDate.js +8 -0
  106. package/esm/controlled-date-time-picker/ControlledDateTimePickerCTX.js +22 -1
  107. package/esm/controlled-date-time-picker/ControlledDateTimePickerDatatestid.js +31 -4
  108. package/esm/controlled-date-time-picker/config/useControlledDateTimePicker.js +254 -36
  109. package/esm/controlled-date-time-picker/config/useGetDestructuredValues.js +143 -0
  110. package/esm/controlled-date-time-picker/config/useValidateProps.js +10 -41
  111. package/esm/controlled-date-time-picker/index.js +1 -1
  112. package/esm/controlled-date-time-picker/parts/ClearButton/ClearButton.js +10 -7
  113. package/esm/controlled-date-time-picker/parts/ClearButton/useClearButton.js +48 -3
  114. package/esm/controlled-date-time-picker/parts/ControlledDateTimePickerContent.js +34 -14
  115. package/esm/controlled-date-time-picker/parts/DateInputs/DDInput.js +16 -11
  116. package/esm/controlled-date-time-picker/parts/DateInputs/DateInputs.js +15 -5
  117. package/esm/controlled-date-time-picker/parts/DateInputs/MMInput.js +18 -11
  118. package/esm/controlled-date-time-picker/parts/DateInputs/YYYYInput.js +16 -11
  119. package/esm/controlled-date-time-picker/parts/DateInputs/useDateInputs.js +119 -67
  120. package/esm/controlled-date-time-picker/parts/Pickers/Calendar/Calendar.js +4 -3
  121. package/esm/controlled-date-time-picker/parts/Pickers/Calendar/CalendarBody.js +10 -4
  122. package/esm/controlled-date-time-picker/parts/Pickers/Calendar/CalendarContent.js +16 -10
  123. package/esm/controlled-date-time-picker/parts/Pickers/Calendar/CalendarContext.js +6 -0
  124. package/esm/controlled-date-time-picker/parts/Pickers/Calendar/CalendarDaysList.js +35 -11
  125. package/esm/controlled-date-time-picker/parts/Pickers/Calendar/CalendarFooter.js +3 -1
  126. package/esm/controlled-date-time-picker/parts/Pickers/Calendar/CalendarHead.js +42 -39
  127. package/esm/controlled-date-time-picker/parts/Pickers/Calendar/CalendarIconTrigger.js +13 -10
  128. package/esm/controlled-date-time-picker/parts/Pickers/Calendar/CalendarMonthDays.js +6 -2
  129. package/esm/controlled-date-time-picker/parts/Pickers/Calendar/CalendarWeekDays.js +35 -3
  130. package/esm/controlled-date-time-picker/parts/Pickers/Calendar/CalendarWrapper.js +7 -0
  131. package/esm/controlled-date-time-picker/parts/Pickers/Calendar/Day.js +58 -28
  132. package/esm/controlled-date-time-picker/parts/Pickers/Calendar/Styleds.js +335 -113
  133. package/esm/controlled-date-time-picker/parts/Pickers/Calendar/useConfigCalendarCTX.js +43 -43
  134. package/esm/controlled-date-time-picker/parts/Pickers/Calendar/useCurrentDisplayedMonthYearLogic.js +1 -1
  135. package/esm/controlled-date-time-picker/parts/Pickers/Calendar/useFocusLogic.js +49 -24
  136. package/esm/controlled-date-time-picker/parts/Pickers/Calendar/useKeyboardHandlers.js +136 -60
  137. package/esm/controlled-date-time-picker/parts/Pickers/Calendar/usePopperTriggerLogic.js +27 -15
  138. package/esm/controlled-date-time-picker/parts/Pickers/CalendarWithTimeWheel/CalendarWithTimeWheelContent.js +3 -1
  139. package/esm/controlled-date-time-picker/parts/Pickers/CalendarWithTimeWheel/CalendarWithTimeWheelContext.js +3 -1
  140. package/esm/controlled-date-time-picker/parts/Pickers/CalendarWithTimeWheel/CalendarWithTimeWheelFooter.js +3 -1
  141. package/esm/controlled-date-time-picker/parts/Pickers/CalendarWithTimeWheel/CalendarWithTimeWheelIconTrigger.js +13 -10
  142. package/esm/controlled-date-time-picker/parts/Pickers/CalendarWithTimeWheel/CalendarWithTimeWheelWrapper.js +7 -0
  143. package/esm/controlled-date-time-picker/parts/Pickers/CalendarWithTimeWheel/Styleds.js +60 -24
  144. package/esm/controlled-date-time-picker/parts/Pickers/CalendarWithTimeWheel/useConfigCalendarWithTimeWheelCTX.js +23 -8
  145. package/esm/controlled-date-time-picker/parts/Pickers/TimeWheel/HoursList.js +33 -19
  146. package/esm/controlled-date-time-picker/parts/Pickers/TimeWheel/MeridiemList.js +30 -25
  147. package/esm/controlled-date-time-picker/parts/Pickers/TimeWheel/MinutesList.js +30 -18
  148. package/esm/controlled-date-time-picker/parts/Pickers/TimeWheel/SecondsList.js +20 -15
  149. package/esm/controlled-date-time-picker/parts/Pickers/TimeWheel/Styleds.js +210 -150
  150. package/esm/controlled-date-time-picker/parts/Pickers/TimeWheel/TimeWheel.js +4 -3
  151. package/esm/controlled-date-time-picker/parts/Pickers/TimeWheel/TimeWheelContent.js +8 -5
  152. package/esm/controlled-date-time-picker/parts/Pickers/TimeWheel/TimeWheelContext.js +4 -1
  153. package/esm/controlled-date-time-picker/parts/Pickers/TimeWheel/TimeWheelFooter.js +3 -1
  154. package/esm/controlled-date-time-picker/parts/Pickers/TimeWheel/TimeWheelIconTrigger.js +12 -10
  155. package/esm/controlled-date-time-picker/parts/Pickers/TimeWheel/TimeWheelWrapper.js +7 -0
  156. package/esm/controlled-date-time-picker/parts/Pickers/TimeWheel/useConfigTimePickerCTX.js +10 -58
  157. package/esm/controlled-date-time-picker/parts/Pickers/TimeWheel/useCurrentDisplayedWheelsLogic.js +11 -8
  158. package/esm/controlled-date-time-picker/parts/Pickers/TimeWheel/useKeyboardHandlers.js +185 -148
  159. package/esm/controlled-date-time-picker/parts/Pickers/TimeWheel/usePopperTriggerLogic.js +24 -13
  160. package/esm/controlled-date-time-picker/parts/Styleds.js +70 -31
  161. package/esm/controlled-date-time-picker/parts/TimeInputs/HHInput.js +18 -11
  162. package/esm/controlled-date-time-picker/parts/TimeInputs/MeridiemInput.js +17 -11
  163. package/esm/controlled-date-time-picker/parts/TimeInputs/MinutesInput.js +16 -11
  164. package/esm/controlled-date-time-picker/parts/TimeInputs/TimeInputs.js +15 -6
  165. package/esm/controlled-date-time-picker/parts/TimeInputs/useTimeInputs.js +110 -202
  166. package/esm/controlled-date-time-picker/propTypes.js +3 -1
  167. package/esm/controlled-date-time-picker/utils/constants.js +46 -0
  168. package/esm/controlled-date-time-picker/utils/dateHelpers.js +40 -23
  169. package/esm/controlled-date-time-picker/utils/dateTimeHelpers.js +7 -2
  170. package/esm/controlled-date-time-picker/utils/hooks/useGetMonthYearFromDateStringOrEmptyStartingMonth.js +1 -1
  171. package/esm/controlled-date-time-picker/utils/stringHelpers.js +43 -18
  172. package/esm/controlled-date-time-picker/utils/timeHelpers.js +2 -1
  173. package/esm/controlled-toggle/ControlledToggle.js +47 -31
  174. package/esm/controlled-toggle/propTypes.js +3 -2
  175. package/esm/controlled-toggle/styles.js +139 -72
  176. package/esm/controlled-toggle/utils/addTooltipOnReadOnly.js +1 -1
  177. package/esm/controlled-toggle/utils/styleHelpers.js +15 -9
  178. package/esm/index.js +1 -1
  179. package/package.json +29 -12
  180. package/types/controlled-checkbox/ControlledCheckbox.d.ts +60 -9
  181. package/types/controlled-checkbox/config/useValidateProps.d.ts +1 -1
  182. package/types/controlled-checkbox/index.d.d.ts +1 -0
  183. package/types/controlled-checkbox/propTypes.d.ts +55 -8
  184. package/types/controlled-checkbox/styles.d.ts +4 -4
  185. package/types/controlled-checkbox/tests/DSControlledCheckbox.keyboard.test.d.ts +1 -0
  186. package/types/controlled-checkbox/tests/DSControlledCheckbox.test.d.ts +1 -0
  187. package/types/controlled-checkbox/tests/DSControllledCheckbox.events.test.d.ts +1 -0
  188. package/types/controlled-date-range-picker/ControlledDateRangePicker.d.ts +12 -2
  189. package/types/controlled-date-range-picker/ControlledDateRangePickerDatatestid.d.ts +1 -18
  190. package/types/controlled-date-range-picker/propTypes.d.ts +7 -1
  191. package/types/controlled-date-range-picker/tests/date-range-picker.auto-advance.test.d.ts +1 -0
  192. package/types/controlled-date-range-picker/tests/date-range-picker.classes.test.d.ts +1 -0
  193. package/types/controlled-date-range-picker/tests/date-range-picker.clear-button.test.d.ts +1 -0
  194. package/types/controlled-date-range-picker/tests/date-range-picker.keyboard-focus.test.d.ts +1 -0
  195. package/types/controlled-date-range-picker/tests/date-range-picker.manual-delete-values.test.d.ts +1 -0
  196. package/types/controlled-date-range-picker/tests/date-range-picker.types-dom.test.d.ts +1 -0
  197. package/types/controlled-date-time-picker/ControlledDateTimePicker.d.ts +84 -21
  198. package/types/controlled-date-time-picker/ControlledDateTimePickerDatatestid.d.ts +28 -3
  199. package/types/controlled-date-time-picker/config/useGetDestructuredValues.d.ts +4 -0
  200. package/types/controlled-date-time-picker/index.d.ts +1 -1
  201. package/types/controlled-date-time-picker/parts/ClearButton/useClearButton.d.ts +2 -1
  202. package/types/controlled-date-time-picker/parts/DateInputs/DDInput.d.ts +3 -1
  203. package/types/controlled-date-time-picker/parts/DateInputs/MMInput.d.ts +4 -1
  204. package/types/controlled-date-time-picker/parts/DateInputs/YYYYInput.d.ts +3 -1
  205. package/types/controlled-date-time-picker/parts/DateInputs/useDateInputs.d.ts +0 -9
  206. package/types/controlled-date-time-picker/parts/Pickers/Calendar/CalendarBody.d.ts +5 -1
  207. package/types/controlled-date-time-picker/parts/Pickers/Calendar/CalendarContext.d.ts +11 -5
  208. package/types/controlled-date-time-picker/parts/Pickers/Calendar/CalendarDaysList.d.ts +5 -3
  209. package/types/controlled-date-time-picker/parts/Pickers/Calendar/Day.d.ts +5 -3
  210. package/types/controlled-date-time-picker/parts/Pickers/Calendar/Styleds.d.ts +17 -123
  211. package/types/controlled-date-time-picker/parts/Pickers/Calendar/useFocusLogic.d.ts +3 -5
  212. package/types/controlled-date-time-picker/parts/Pickers/Calendar/useKeyboardHandlers.d.ts +5 -18
  213. package/types/controlled-date-time-picker/parts/Pickers/Calendar/usePopperTriggerLogic.d.ts +4 -7
  214. package/types/controlled-date-time-picker/parts/Pickers/CalendarWithTimeWheel/CalendarWithTimeWheelContext.d.ts +2 -0
  215. package/types/controlled-date-time-picker/parts/Pickers/CalendarWithTimeWheel/Styleds.d.ts +7 -3
  216. package/types/controlled-date-time-picker/parts/Pickers/TimeWheel/Styleds.d.ts +19 -9
  217. package/types/controlled-date-time-picker/parts/Pickers/TimeWheel/TimeWheelContext.d.ts +3 -0
  218. package/types/controlled-date-time-picker/parts/Pickers/TimeWheel/useKeyboardHandlers.d.ts +3 -11
  219. package/types/controlled-date-time-picker/parts/Pickers/TimeWheel/usePopperTriggerLogic.d.ts +1 -8
  220. package/types/controlled-date-time-picker/parts/Styleds.d.ts +13 -10
  221. package/types/controlled-date-time-picker/parts/TimeInputs/HHInput.d.ts +4 -1
  222. package/types/controlled-date-time-picker/parts/TimeInputs/MeridiemInput.d.ts +3 -1
  223. package/types/controlled-date-time-picker/parts/TimeInputs/MinutesInput.d.ts +3 -1
  224. package/types/controlled-date-time-picker/propTypes.d.ts +79 -20
  225. package/types/controlled-date-time-picker/tests/date-time-picker.keyboard-focus.test.d.ts +1 -0
  226. package/types/controlled-date-time-picker/tests/date-time-picker.keyboard.data-entry-typing.test.d.ts +1 -0
  227. package/types/controlled-date-time-picker/tests/date-time-picker.keyboard.fill-with-now.test.d.ts +1 -0
  228. package/types/controlled-date-time-picker/tests/date-time-picker.keyboard.regressive-backspace.test.d.ts +1 -0
  229. package/types/controlled-date-time-picker/tests/date-time-picker.keyboard.shortcut-clear.test.d.ts +1 -0
  230. package/types/controlled-date-time-picker/utils/constants.d.ts +44 -0
  231. package/types/controlled-date-time-picker/utils/dateHelpers.d.ts +3 -2
  232. package/types/controlled-date-time-picker/utils/dateTimeHelpers.d.ts +1 -1
  233. package/types/controlled-date-time-picker/utils/stringHelpers.d.ts +1 -0
  234. package/types/controlled-toggle/ControlledToggle.d.ts +79 -13
  235. package/types/controlled-toggle/propTypes.d.ts +73 -11
  236. package/types/controlled-toggle/styles.d.ts +7 -7
  237. package/cjs/controlled-date-time-picker/parts/TimeInputs/SSInput.js +0 -53
  238. package/cjs/package.json +0 -7
  239. package/esm/controlled-date-time-picker/parts/TimeInputs/SSInput.js +0 -45
  240. package/esm/package.json +0 -7
  241. package/types/controlled-date-time-picker/parts/TimeInputs/SSInput.d.ts +0 -13
@@ -3,36 +3,52 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var React = require('react');
6
+ var ControlledDateTimePickerCTX = require('../../../ControlledDateTimePickerCTX.js');
7
+ var constants = require('../../../utils/constants.js');
6
8
 
7
9
  /* eslint-disable @typescript-eslint/indent */
8
- const useKeyboardHandlers = ({
9
- handlePrevHour,
10
- handleNextHour,
11
- handlePrevMinute,
12
- handleNextMinute,
13
- // handlePrevSecond,
14
- // handleNextSecond,
15
- handleTimeWheelBtnChangeMeridiem,
16
- prevMonthBtnRef,
17
- prevHourBtnRef,
18
- currHourBtnRef,
19
- nextHourBtnRef,
20
- prevMinutesBtnRef,
21
- currMinutesBtnRef,
22
- nextMinutesBtnRef,
23
- // prevSecondsBtnRef,
24
- // currSecondsBtnRef,
25
- // nextSecondsBtnRef,
26
- prevMeridiemBtnRef,
27
- currMeridiemBtnRef,
28
- nextMeridiemBtnRef,
29
- hideDate,
30
- hideTime,
31
- monthInputRef,
32
- hourInputRef,
33
- isWithCalendarToo
34
- }) => {
35
- const onHomeKeyDown = React.useCallback(() => {
10
+ const useKeyboardHandlers = _ref => {
11
+ let {
12
+ handlePrevHour,
13
+ handleNextHour,
14
+ handlePrevMinute,
15
+ handleNextMinute,
16
+ handleTimeWheelBtnChangeMeridiem
17
+ } = _ref;
18
+ const {
19
+ withAnyInputs,
20
+ isWithTimeInputs,
21
+ isWithDateInputs,
22
+ isWithCalendarToo,
23
+ isControllerOnly,
24
+ hideDate,
25
+ hideTime,
26
+ monthInputRef,
27
+ hourInputRef,
28
+ meridiemInputRef,
29
+ yearInputRef,
30
+ prevMonthBtnRef,
31
+ prevHourBtnRef,
32
+ currHourBtnRef,
33
+ nextHourBtnRef,
34
+ prevMinutesBtnRef,
35
+ currMinutesBtnRef,
36
+ nextMinutesBtnRef,
37
+ prevMeridiemBtnRef,
38
+ currMeridiemBtnRef,
39
+ nextMeridiemBtnRef
40
+ } = React.useContext(ControlledDateTimePickerCTX.ControlledDateTimePickerContext);
41
+ const onHomeKeyDownInsideTimeWheel = React.useCallback(() => {
42
+ var _prevMonthBtnRef$curr, _prevMonthBtnRef$curr2, _currHourBtnRef$curre, _currHourBtnRef$curre2;
43
+
44
+ if (isWithCalendarToo) prevMonthBtnRef === null || prevMonthBtnRef === void 0 ? void 0 : (_prevMonthBtnRef$curr = prevMonthBtnRef.current) === null || _prevMonthBtnRef$curr === void 0 ? void 0 : (_prevMonthBtnRef$curr2 = _prevMonthBtnRef$curr.focus) === null || _prevMonthBtnRef$curr2 === void 0 ? void 0 : _prevMonthBtnRef$curr2.call(_prevMonthBtnRef$curr);else currHourBtnRef === null || currHourBtnRef === void 0 ? void 0 : (_currHourBtnRef$curre = currHourBtnRef.current) === null || _currHourBtnRef$curre === void 0 ? void 0 : (_currHourBtnRef$curre2 = _currHourBtnRef$curre.focus) === null || _currHourBtnRef$curre2 === void 0 ? void 0 : _currHourBtnRef$curre2.call(_currHourBtnRef$curre);
45
+ }, [currHourBtnRef, isWithCalendarToo, prevMonthBtnRef]);
46
+ const onEndKeyDownInsideTimeWheel = React.useCallback(() => {
47
+ var _currMeridiemBtnRef$c, _currMeridiemBtnRef$c2;
48
+
49
+ 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);
50
+ }, [currMeridiemBtnRef]);
51
+ const onHomeKeyDownTriggerIcon = React.useCallback(() => {
36
52
  var _monthInputRef$curren, _monthInputRef$curren2, _hourInputRef$current, _hourInputRef$current2;
37
53
 
38
54
  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);
@@ -41,256 +57,283 @@ const useKeyboardHandlers = ({
41
57
  const {
42
58
  key
43
59
  } = e;
44
- const preventDefaultKeys = ['Home'];
45
- if (preventDefaultKeys.includes(key)) e.preventDefault();
46
- if (key === 'Home') onHomeKeyDown();
47
- }, [onHomeKeyDown]);
60
+ if (constants.homeEndKeys.includes(key)) e.preventDefault();
61
+ if (constants.homeEndKeys.includes(key)) e.stopPropagation();
62
+ if (key === 'Home') onHomeKeyDownTriggerIcon();
63
+
64
+ if (key === 'Backspace' && withAnyInputs) {
65
+ var _meridiemInputRef$cur, _meridiemInputRef$cur2, _yearInputRef$current, _yearInputRef$current2;
66
+
67
+ 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);
68
+ }
69
+ }, [isWithDateInputs, isWithTimeInputs, meridiemInputRef, onHomeKeyDownTriggerIcon, withAnyInputs, yearInputRef]);
48
70
  const handleCurrHourOnKeyDown = React.useCallback(e => {
49
71
  const {
50
72
  key,
51
73
  shiftKey
52
74
  } = e;
75
+ if (constants.homeEndAllArrowKeys.includes(key)) e.preventDefault();
76
+ if (constants.homeEndAllArrowKeys.includes(key)) e.stopPropagation();
53
77
  let didTriggerHourChange = false;
54
78
 
55
79
  if (key === 'ArrowUp') {
56
80
  handlePrevHour(e);
57
81
  didTriggerHourChange = true;
58
- } else if (key === 'ArrowDown') {
82
+ }
83
+
84
+ if (key === 'ArrowDown') {
59
85
  handleNextHour(e);
60
86
  didTriggerHourChange = true;
61
- } else if (key === 'ArrowRight') {
87
+ }
88
+
89
+ if (key === 'ArrowRight') {
62
90
  var _currMinutesBtnRef$cu, _currMinutesBtnRef$cu2;
63
91
 
64
92
  currMinutesBtnRef === null || currMinutesBtnRef === void 0 ? void 0 : (_currMinutesBtnRef$cu = currMinutesBtnRef.current) === null || _currMinutesBtnRef$cu === void 0 ? void 0 : (_currMinutesBtnRef$cu2 = _currMinutesBtnRef$cu.focus) === null || _currMinutesBtnRef$cu2 === void 0 ? void 0 : _currMinutesBtnRef$cu2.call(_currMinutesBtnRef$cu);
65
- } else if (key === 'Tab' && shiftKey && !isWithCalendarToo) {
66
- var _currMeridiemBtnRef$c, _currMeridiemBtnRef$c2;
67
-
68
- e.preventDefault();
69
- 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);
70
- } // ensure the focus is in the correct button after up/down arrow
93
+ }
71
94
 
95
+ if (key === 'Home') onHomeKeyDownInsideTimeWheel();
96
+ if (key === 'End') onEndKeyDownInsideTimeWheel(); // ensure the focus is in the correct button after up/down arrow
72
97
 
73
98
  if (didTriggerHourChange) setTimeout(() => {
74
- var _currHourBtnRef$curre, _currHourBtnRef$curre2;
99
+ var _currHourBtnRef$curre3, _currHourBtnRef$curre4;
75
100
 
76
- return currHourBtnRef === null || currHourBtnRef === void 0 ? void 0 : (_currHourBtnRef$curre = currHourBtnRef.current) === null || _currHourBtnRef$curre === void 0 ? void 0 : (_currHourBtnRef$curre2 = _currHourBtnRef$curre.focus) === null || _currHourBtnRef$curre2 === void 0 ? void 0 : _currHourBtnRef$curre2.call(_currHourBtnRef$curre);
77
- });
78
- }, [currHourBtnRef, currMeridiemBtnRef, currMinutesBtnRef, handleNextHour, handlePrevHour, isWithCalendarToo]);
101
+ return currHourBtnRef === null || currHourBtnRef === void 0 ? void 0 : (_currHourBtnRef$curre3 = currHourBtnRef.current) === null || _currHourBtnRef$curre3 === void 0 ? void 0 : (_currHourBtnRef$curre4 = _currHourBtnRef$curre3.focus) === null || _currHourBtnRef$curre4 === void 0 ? void 0 : _currHourBtnRef$curre4.call(_currHourBtnRef$curre3);
102
+ }); // TAB CYCLE IMPLEMENTATION
103
+
104
+ if (!isControllerOnly) if (key === 'Tab' && shiftKey && !isWithCalendarToo) {
105
+ var _currMeridiemBtnRef$c3, _currMeridiemBtnRef$c4;
106
+
107
+ e.preventDefault();
108
+ 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);
109
+ }
110
+ }, [currHourBtnRef, currMeridiemBtnRef, currMinutesBtnRef, handleNextHour, handlePrevHour, isControllerOnly, isWithCalendarToo, onEndKeyDownInsideTimeWheel, onHomeKeyDownInsideTimeWheel]);
79
111
  const handleCurrMinutesOnKeyDown = React.useCallback(e => {
80
112
  const {
81
113
  key
82
114
  } = e;
115
+ if (constants.homeEndAllArrowKeys.includes(key)) e.preventDefault();
116
+ if (constants.homeEndAllArrowKeys.includes(key)) e.stopPropagation();
83
117
  let didTriggerMinuteChange = false;
84
118
 
85
119
  if (key === 'ArrowUp') {
86
120
  handlePrevMinute(e);
87
121
  didTriggerMinuteChange = true;
88
- } else if (key === 'ArrowDown') {
122
+ }
123
+
124
+ if (key === 'ArrowDown') {
89
125
  handleNextMinute(e);
90
126
  didTriggerMinuteChange = true;
91
- } else if (key === 'ArrowLeft') {
92
- var _currHourBtnRef$curre3, _currHourBtnRef$curre4;
127
+ }
93
128
 
94
- currHourBtnRef === null || currHourBtnRef === void 0 ? void 0 : (_currHourBtnRef$curre3 = currHourBtnRef.current) === null || _currHourBtnRef$curre3 === void 0 ? void 0 : (_currHourBtnRef$curre4 = _currHourBtnRef$curre3.focus) === null || _currHourBtnRef$curre4 === void 0 ? void 0 : _currHourBtnRef$curre4.call(_currHourBtnRef$curre3);
95
- } else if (key === 'ArrowRight') {
96
- var _currMeridiemBtnRef$c3, _currMeridiemBtnRef$c4;
129
+ if (key === 'ArrowLeft') {
130
+ var _currHourBtnRef$curre5, _currHourBtnRef$curre6;
97
131
 
98
- // currSecondsBtnRef?.current?.focus?.();
99
- 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);
100
- } // ensure the focus is in the correct button after up/down arrow
132
+ currHourBtnRef === null || currHourBtnRef === void 0 ? void 0 : (_currHourBtnRef$curre5 = currHourBtnRef.current) === null || _currHourBtnRef$curre5 === void 0 ? void 0 : (_currHourBtnRef$curre6 = _currHourBtnRef$curre5.focus) === null || _currHourBtnRef$curre6 === void 0 ? void 0 : _currHourBtnRef$curre6.call(_currHourBtnRef$curre5);
133
+ }
101
134
 
135
+ if (key === 'ArrowRight') {
136
+ var _currMeridiemBtnRef$c5, _currMeridiemBtnRef$c6;
137
+
138
+ currMeridiemBtnRef === null || currMeridiemBtnRef === void 0 ? void 0 : (_currMeridiemBtnRef$c5 = currMeridiemBtnRef.current) === null || _currMeridiemBtnRef$c5 === void 0 ? void 0 : (_currMeridiemBtnRef$c6 = _currMeridiemBtnRef$c5.focus) === null || _currMeridiemBtnRef$c6 === void 0 ? void 0 : _currMeridiemBtnRef$c6.call(_currMeridiemBtnRef$c5);
139
+ }
140
+
141
+ if (key === 'Home') onHomeKeyDownInsideTimeWheel();
142
+ if (key === 'End') onEndKeyDownInsideTimeWheel(); // ensure the focus is in the correct button after up/down arrow
102
143
 
103
144
  if (didTriggerMinuteChange) setTimeout(() => {
104
145
  var _currMinutesBtnRef$cu3, _currMinutesBtnRef$cu4;
105
146
 
106
147
  return currMinutesBtnRef === null || currMinutesBtnRef === void 0 ? void 0 : (_currMinutesBtnRef$cu3 = currMinutesBtnRef.current) === null || _currMinutesBtnRef$cu3 === void 0 ? void 0 : (_currMinutesBtnRef$cu4 = _currMinutesBtnRef$cu3.focus) === null || _currMinutesBtnRef$cu4 === void 0 ? void 0 : _currMinutesBtnRef$cu4.call(_currMinutesBtnRef$cu3);
107
148
  });
108
- }, [currHourBtnRef, currMinutesBtnRef, currMeridiemBtnRef, handleNextMinute, handlePrevMinute]); // const handleCurrSecondsOnKeyDown = useCallback(
109
- // (e) => {
110
- // const { key } = e;
111
- // let didTriggerSecondChange = false;
112
- // if (key === 'ArrowUp') {
113
- // handlePrevSecond(e);
114
- // didTriggerSecondChange = true;
115
- // } else if (key === 'ArrowDown') {
116
- // handleNextSecond(e);
117
- // didTriggerSecondChange = true;
118
- // } else if (key === 'ArrowLeft') {
119
- // currMinutesBtnRef?.current?.focus?.();
120
- // } else if (key === 'ArrowRight') {
121
- // currMeridiemBtnRef?.current?.focus?.();
122
- // }
123
- // // ensure the focus is in the correct button after up/down arrow
124
- // if (didTriggerSecondChange) setTimeout(() => currSecondsBtnRef?.current?.focus?.(), 10);
125
- // },
126
- // [
127
- // currMeridiemBtnRef,
128
- // currMinutesBtnRef,
129
- // currSecondsBtnRef,
130
- // handleNextSecond,
131
- // handlePrevSecond,
132
- // ],
133
- // );
134
-
149
+ }, [onHomeKeyDownInsideTimeWheel, onEndKeyDownInsideTimeWheel, handlePrevMinute, handleNextMinute, currHourBtnRef, currMeridiemBtnRef, currMinutesBtnRef]);
135
150
  const handleCurrMeridiemOnKeyDown = React.useCallback(e => {
136
151
  const {
137
152
  key,
138
153
  shiftKey
139
154
  } = e;
155
+ if (constants.homeEndAllArrowKeys.includes(key)) e.preventDefault();
156
+ if (constants.homeEndAllArrowKeys.includes(key)) e.stopPropagation();
140
157
  let didTriggerMeridiemChange = false;
141
158
 
142
159
  if (key === 'ArrowUp') {
143
160
  handleTimeWheelBtnChangeMeridiem('AM', e);
144
161
  didTriggerMeridiemChange = true;
145
- } else if (key === 'ArrowDown') {
162
+ }
163
+
164
+ if (key === 'ArrowDown') {
146
165
  handleTimeWheelBtnChangeMeridiem('PM', e);
147
166
  didTriggerMeridiemChange = true;
148
- } else if (key === 'ArrowLeft') {
167
+ }
168
+
169
+ if (key === 'ArrowLeft') {
149
170
  var _currMinutesBtnRef$cu5, _currMinutesBtnRef$cu6;
150
171
 
151
172
  // currSecondsBtnRef?.current?.focus?.();
152
173
  currMinutesBtnRef === null || currMinutesBtnRef === void 0 ? void 0 : (_currMinutesBtnRef$cu5 = currMinutesBtnRef.current) === null || _currMinutesBtnRef$cu5 === void 0 ? void 0 : (_currMinutesBtnRef$cu6 = _currMinutesBtnRef$cu5.focus) === null || _currMinutesBtnRef$cu6 === void 0 ? void 0 : _currMinutesBtnRef$cu6.call(_currMinutesBtnRef$cu5);
153
- } else if (key === 'Tab' && !shiftKey) {
154
- var _prevMonthBtnRef$curr, _prevMonthBtnRef$curr2, _currHourBtnRef$curre5, _currHourBtnRef$curre6;
155
-
156
- e.preventDefault();
157
- if (isWithCalendarToo) prevMonthBtnRef === null || prevMonthBtnRef === void 0 ? void 0 : (_prevMonthBtnRef$curr = prevMonthBtnRef.current) === null || _prevMonthBtnRef$curr === void 0 ? void 0 : (_prevMonthBtnRef$curr2 = _prevMonthBtnRef$curr.focus) === null || _prevMonthBtnRef$curr2 === void 0 ? void 0 : _prevMonthBtnRef$curr2.call(_prevMonthBtnRef$curr);else currHourBtnRef === null || currHourBtnRef === void 0 ? void 0 : (_currHourBtnRef$curre5 = currHourBtnRef.current) === null || _currHourBtnRef$curre5 === void 0 ? void 0 : (_currHourBtnRef$curre6 = _currHourBtnRef$curre5.focus) === null || _currHourBtnRef$curre6 === void 0 ? void 0 : _currHourBtnRef$curre6.call(_currHourBtnRef$curre5);
158
- } // ensure the focus is in the correct button after up/down arrow
174
+ }
159
175
 
176
+ if (key === 'Home') onHomeKeyDownInsideTimeWheel();
177
+ if (key === 'End') onEndKeyDownInsideTimeWheel(); // ensure the focus is in the correct button after up/down arrow
160
178
 
161
179
  if (didTriggerMeridiemChange) setTimeout(() => {
162
- var _currMeridiemBtnRef$c5, _currMeridiemBtnRef$c6;
180
+ var _currMeridiemBtnRef$c7, _currMeridiemBtnRef$c8;
163
181
 
164
- return currMeridiemBtnRef === null || currMeridiemBtnRef === void 0 ? void 0 : (_currMeridiemBtnRef$c5 = currMeridiemBtnRef.current) === null || _currMeridiemBtnRef$c5 === void 0 ? void 0 : (_currMeridiemBtnRef$c6 = _currMeridiemBtnRef$c5.focus) === null || _currMeridiemBtnRef$c6 === void 0 ? void 0 : _currMeridiemBtnRef$c6.call(_currMeridiemBtnRef$c5);
165
- });
166
- }, [currHourBtnRef, currMeridiemBtnRef, currMinutesBtnRef, handleTimeWheelBtnChangeMeridiem, isWithCalendarToo, prevMonthBtnRef]);
182
+ return currMeridiemBtnRef === null || currMeridiemBtnRef === void 0 ? void 0 : (_currMeridiemBtnRef$c7 = currMeridiemBtnRef.current) === null || _currMeridiemBtnRef$c7 === void 0 ? void 0 : (_currMeridiemBtnRef$c8 = _currMeridiemBtnRef$c7.focus) === null || _currMeridiemBtnRef$c8 === void 0 ? void 0 : _currMeridiemBtnRef$c8.call(_currMeridiemBtnRef$c7);
183
+ }); // TAB CYCLE IMPLEMENTATION
184
+
185
+ if (!isControllerOnly) if (key === 'Tab' && !shiftKey) {
186
+ var _prevMonthBtnRef$curr3, _prevMonthBtnRef$curr4, _currHourBtnRef$curre7, _currHourBtnRef$curre8;
187
+
188
+ e.preventDefault();
189
+ if (isWithCalendarToo) prevMonthBtnRef === null || prevMonthBtnRef === void 0 ? void 0 : (_prevMonthBtnRef$curr3 = prevMonthBtnRef.current) === null || _prevMonthBtnRef$curr3 === void 0 ? void 0 : (_prevMonthBtnRef$curr4 = _prevMonthBtnRef$curr3.focus) === null || _prevMonthBtnRef$curr4 === void 0 ? void 0 : _prevMonthBtnRef$curr4.call(_prevMonthBtnRef$curr3);else currHourBtnRef === null || currHourBtnRef === void 0 ? void 0 : (_currHourBtnRef$curre7 = currHourBtnRef.current) === null || _currHourBtnRef$curre7 === void 0 ? void 0 : (_currHourBtnRef$curre8 = _currHourBtnRef$curre7.focus) === null || _currHourBtnRef$curre8 === void 0 ? void 0 : _currHourBtnRef$curre8.call(_currHourBtnRef$curre7);
190
+ }
191
+ }, [currHourBtnRef, currMeridiemBtnRef, currMinutesBtnRef, handleTimeWheelBtnChangeMeridiem, isControllerOnly, isWithCalendarToo, onEndKeyDownInsideTimeWheel, onHomeKeyDownInsideTimeWheel, prevMonthBtnRef]);
167
192
  const handlePrevHourBtnOnKeyDown = React.useCallback(e => {
168
193
  const {
169
194
  key
170
195
  } = e;
196
+ if (constants.homeEndAllArrowKeys.includes(key)) e.preventDefault();
197
+ if (constants.homeEndAllArrowKeys.includes(key)) e.stopPropagation();
171
198
 
172
199
  if (key === 'ArrowRight') {
173
200
  var _prevMinutesBtnRef$cu, _prevMinutesBtnRef$cu2;
174
201
 
175
202
  prevMinutesBtnRef === null || prevMinutesBtnRef === void 0 ? void 0 : (_prevMinutesBtnRef$cu = prevMinutesBtnRef.current) === null || _prevMinutesBtnRef$cu === void 0 ? void 0 : (_prevMinutesBtnRef$cu2 = _prevMinutesBtnRef$cu.focus) === null || _prevMinutesBtnRef$cu2 === void 0 ? void 0 : _prevMinutesBtnRef$cu2.call(_prevMinutesBtnRef$cu);
176
- } else if (key === 'ArrowDown') {
177
- var _currHourBtnRef$curre7, _currHourBtnRef$curre8;
203
+ }
178
204
 
179
- currHourBtnRef === null || currHourBtnRef === void 0 ? void 0 : (_currHourBtnRef$curre7 = currHourBtnRef.current) === null || _currHourBtnRef$curre7 === void 0 ? void 0 : (_currHourBtnRef$curre8 = _currHourBtnRef$curre7.focus) === null || _currHourBtnRef$curre8 === void 0 ? void 0 : _currHourBtnRef$curre8.call(_currHourBtnRef$curre7);
205
+ if (key === 'ArrowDown') {
206
+ var _currHourBtnRef$curre9, _currHourBtnRef$curre10;
207
+
208
+ currHourBtnRef === null || currHourBtnRef === void 0 ? void 0 : (_currHourBtnRef$curre9 = currHourBtnRef.current) === null || _currHourBtnRef$curre9 === void 0 ? void 0 : (_currHourBtnRef$curre10 = _currHourBtnRef$curre9.focus) === null || _currHourBtnRef$curre10 === void 0 ? void 0 : _currHourBtnRef$curre10.call(_currHourBtnRef$curre9);
180
209
  }
181
- }, [currHourBtnRef, prevMinutesBtnRef]);
210
+
211
+ if (key === 'Home') onHomeKeyDownInsideTimeWheel();
212
+ if (key === 'End') onEndKeyDownInsideTimeWheel();
213
+ }, [currHourBtnRef, onEndKeyDownInsideTimeWheel, onHomeKeyDownInsideTimeWheel, prevMinutesBtnRef]);
182
214
  const handlePrevMinuteBtnOnKeyDown = React.useCallback(e => {
183
215
  const {
184
216
  key
185
217
  } = e;
218
+ if (constants.homeEndAllArrowKeys.includes(key)) e.preventDefault();
219
+ if (constants.homeEndAllArrowKeys.includes(key)) e.stopPropagation();
186
220
 
187
221
  if (key === 'ArrowRight') {
188
222
  var _prevMeridiemBtnRef$c, _prevMeridiemBtnRef$c2;
189
223
 
190
224
  // prevSecondsBtnRef?.current?.focus?.();
191
225
  prevMeridiemBtnRef === null || prevMeridiemBtnRef === void 0 ? void 0 : (_prevMeridiemBtnRef$c = prevMeridiemBtnRef.current) === null || _prevMeridiemBtnRef$c === void 0 ? void 0 : (_prevMeridiemBtnRef$c2 = _prevMeridiemBtnRef$c.focus) === null || _prevMeridiemBtnRef$c2 === void 0 ? void 0 : _prevMeridiemBtnRef$c2.call(_prevMeridiemBtnRef$c);
192
- } else if (key === 'ArrowLeft') {
226
+ }
227
+
228
+ if (key === 'ArrowLeft') {
193
229
  var _prevHourBtnRef$curre, _prevHourBtnRef$curre2;
194
230
 
195
231
  prevHourBtnRef === null || prevHourBtnRef === void 0 ? void 0 : (_prevHourBtnRef$curre = prevHourBtnRef.current) === null || _prevHourBtnRef$curre === void 0 ? void 0 : (_prevHourBtnRef$curre2 = _prevHourBtnRef$curre.focus) === null || _prevHourBtnRef$curre2 === void 0 ? void 0 : _prevHourBtnRef$curre2.call(_prevHourBtnRef$curre);
196
- } else if (key === 'ArrowDown') {
232
+ }
233
+
234
+ if (key === 'ArrowDown') {
197
235
  var _currMinutesBtnRef$cu7, _currMinutesBtnRef$cu8;
198
236
 
199
237
  currMinutesBtnRef === null || currMinutesBtnRef === void 0 ? void 0 : (_currMinutesBtnRef$cu7 = currMinutesBtnRef.current) === null || _currMinutesBtnRef$cu7 === void 0 ? void 0 : (_currMinutesBtnRef$cu8 = _currMinutesBtnRef$cu7.focus) === null || _currMinutesBtnRef$cu8 === void 0 ? void 0 : _currMinutesBtnRef$cu8.call(_currMinutesBtnRef$cu7);
200
238
  }
201
- }, [currMinutesBtnRef, prevHourBtnRef, prevMeridiemBtnRef]); // const handlePrevSecondBtnOnKeyDown = useCallback(
202
- // (e) => {
203
- // const { key } = e;
204
- // if (key === 'ArrowRight') {
205
- // prevMeridiemBtnRef?.current?.focus?.();
206
- // } else if (key === 'ArrowLeft') {
207
- // prevMinutesBtnRef?.current?.focus?.();
208
- // } else if (key === 'ArrowDown') {
209
- // currSecondsBtnRef?.current?.focus?.();
210
- // }
211
- // },
212
- // [currSecondsBtnRef, prevMeridiemBtnRef, prevMinutesBtnRef],
213
- // );
214
239
 
240
+ if (key === 'Home') onHomeKeyDownInsideTimeWheel();
241
+ if (key === 'End') onEndKeyDownInsideTimeWheel();
242
+ }, [currMinutesBtnRef, onEndKeyDownInsideTimeWheel, onHomeKeyDownInsideTimeWheel, prevHourBtnRef, prevMeridiemBtnRef]);
215
243
  const handlePrevMeridiemBtnOnKeyDown = React.useCallback(e => {
216
244
  const {
217
245
  key
218
246
  } = e;
247
+ if (constants.homeEndAllArrowKeys.includes(key)) e.preventDefault();
248
+ if (constants.homeEndAllArrowKeys.includes(key)) e.stopPropagation();
219
249
 
220
250
  if (key === 'ArrowLeft') {
221
251
  var _prevMinutesBtnRef$cu3, _prevMinutesBtnRef$cu4;
222
252
 
223
- // prevSecondsBtnRef?.current?.focus?.();
224
253
  prevMinutesBtnRef === null || prevMinutesBtnRef === void 0 ? void 0 : (_prevMinutesBtnRef$cu3 = prevMinutesBtnRef.current) === null || _prevMinutesBtnRef$cu3 === void 0 ? void 0 : (_prevMinutesBtnRef$cu4 = _prevMinutesBtnRef$cu3.focus) === null || _prevMinutesBtnRef$cu4 === void 0 ? void 0 : _prevMinutesBtnRef$cu4.call(_prevMinutesBtnRef$cu3);
225
- } else if (key === 'ArrowDown') {
226
- var _currMeridiemBtnRef$c7, _currMeridiemBtnRef$c8;
254
+ }
255
+
256
+ if (key === 'ArrowDown') {
257
+ var _currMeridiemBtnRef$c9, _currMeridiemBtnRef$c10;
227
258
 
228
- currMeridiemBtnRef === null || currMeridiemBtnRef === void 0 ? void 0 : (_currMeridiemBtnRef$c7 = currMeridiemBtnRef.current) === null || _currMeridiemBtnRef$c7 === void 0 ? void 0 : (_currMeridiemBtnRef$c8 = _currMeridiemBtnRef$c7.focus) === null || _currMeridiemBtnRef$c8 === void 0 ? void 0 : _currMeridiemBtnRef$c8.call(_currMeridiemBtnRef$c7);
259
+ currMeridiemBtnRef === null || currMeridiemBtnRef === void 0 ? void 0 : (_currMeridiemBtnRef$c9 = currMeridiemBtnRef.current) === null || _currMeridiemBtnRef$c9 === void 0 ? void 0 : (_currMeridiemBtnRef$c10 = _currMeridiemBtnRef$c9.focus) === null || _currMeridiemBtnRef$c10 === void 0 ? void 0 : _currMeridiemBtnRef$c10.call(_currMeridiemBtnRef$c9);
229
260
  }
230
- }, [currMeridiemBtnRef, prevMinutesBtnRef]);
261
+
262
+ if (key === 'Home') onHomeKeyDownInsideTimeWheel();
263
+ if (key === 'End') onEndKeyDownInsideTimeWheel();
264
+ }, [currMeridiemBtnRef, onEndKeyDownInsideTimeWheel, onHomeKeyDownInsideTimeWheel, prevMinutesBtnRef]);
231
265
  const handleNextHourBtnOnKeyDown = React.useCallback(e => {
232
266
  const {
233
267
  key
234
268
  } = e;
269
+ if (constants.homeEndAllArrowKeys.includes(key)) e.preventDefault();
270
+ if (constants.homeEndAllArrowKeys.includes(key)) e.stopPropagation();
235
271
 
236
272
  if (key === 'ArrowRight') {
237
273
  var _nextMinutesBtnRef$cu, _nextMinutesBtnRef$cu2;
238
274
 
239
275
  nextMinutesBtnRef === null || nextMinutesBtnRef === void 0 ? void 0 : (_nextMinutesBtnRef$cu = nextMinutesBtnRef.current) === null || _nextMinutesBtnRef$cu === void 0 ? void 0 : (_nextMinutesBtnRef$cu2 = _nextMinutesBtnRef$cu.focus) === null || _nextMinutesBtnRef$cu2 === void 0 ? void 0 : _nextMinutesBtnRef$cu2.call(_nextMinutesBtnRef$cu);
240
- } else if (key === 'ArrowUp') {
241
- var _currHourBtnRef$curre9, _currHourBtnRef$curre10;
276
+ }
242
277
 
243
- currHourBtnRef === null || currHourBtnRef === void 0 ? void 0 : (_currHourBtnRef$curre9 = currHourBtnRef.current) === null || _currHourBtnRef$curre9 === void 0 ? void 0 : (_currHourBtnRef$curre10 = _currHourBtnRef$curre9.focus) === null || _currHourBtnRef$curre10 === void 0 ? void 0 : _currHourBtnRef$curre10.call(_currHourBtnRef$curre9);
278
+ if (key === 'ArrowUp') {
279
+ var _currHourBtnRef$curre11, _currHourBtnRef$curre12;
280
+
281
+ currHourBtnRef === null || currHourBtnRef === void 0 ? void 0 : (_currHourBtnRef$curre11 = currHourBtnRef.current) === null || _currHourBtnRef$curre11 === void 0 ? void 0 : (_currHourBtnRef$curre12 = _currHourBtnRef$curre11.focus) === null || _currHourBtnRef$curre12 === void 0 ? void 0 : _currHourBtnRef$curre12.call(_currHourBtnRef$curre11);
244
282
  }
245
- }, [currHourBtnRef, nextMinutesBtnRef]);
283
+
284
+ if (key === 'Home') onHomeKeyDownInsideTimeWheel();
285
+ if (key === 'End') onEndKeyDownInsideTimeWheel();
286
+ }, [currHourBtnRef, nextMinutesBtnRef, onEndKeyDownInsideTimeWheel, onHomeKeyDownInsideTimeWheel]);
246
287
  const handleNextMinuteBtnOnKeyDown = React.useCallback(e => {
247
288
  const {
248
289
  key
249
290
  } = e;
291
+ if (constants.homeEndAllArrowKeys.includes(key)) e.preventDefault();
292
+ if (constants.homeEndAllArrowKeys.includes(key)) e.stopPropagation();
250
293
 
251
294
  if (key === 'ArrowRight') {
252
295
  var _nextMeridiemBtnRef$c, _nextMeridiemBtnRef$c2;
253
296
 
254
- // nextSecondsBtnRef?.current?.focus?.();
255
297
  nextMeridiemBtnRef === null || nextMeridiemBtnRef === void 0 ? void 0 : (_nextMeridiemBtnRef$c = nextMeridiemBtnRef.current) === null || _nextMeridiemBtnRef$c === void 0 ? void 0 : (_nextMeridiemBtnRef$c2 = _nextMeridiemBtnRef$c.focus) === null || _nextMeridiemBtnRef$c2 === void 0 ? void 0 : _nextMeridiemBtnRef$c2.call(_nextMeridiemBtnRef$c);
256
- } else if (key === 'ArrowLeft') {
298
+ }
299
+
300
+ if (key === 'ArrowLeft') {
257
301
  var _nextHourBtnRef$curre, _nextHourBtnRef$curre2;
258
302
 
259
303
  nextHourBtnRef === null || nextHourBtnRef === void 0 ? void 0 : (_nextHourBtnRef$curre = nextHourBtnRef.current) === null || _nextHourBtnRef$curre === void 0 ? void 0 : (_nextHourBtnRef$curre2 = _nextHourBtnRef$curre.focus) === null || _nextHourBtnRef$curre2 === void 0 ? void 0 : _nextHourBtnRef$curre2.call(_nextHourBtnRef$curre);
260
- } else if (key === 'ArrowUp') {
304
+ }
305
+
306
+ if (key === 'ArrowUp') {
261
307
  var _currMinutesBtnRef$cu9, _currMinutesBtnRef$cu10;
262
308
 
263
309
  currMinutesBtnRef === null || currMinutesBtnRef === void 0 ? void 0 : (_currMinutesBtnRef$cu9 = currMinutesBtnRef.current) === null || _currMinutesBtnRef$cu9 === void 0 ? void 0 : (_currMinutesBtnRef$cu10 = _currMinutesBtnRef$cu9.focus) === null || _currMinutesBtnRef$cu10 === void 0 ? void 0 : _currMinutesBtnRef$cu10.call(_currMinutesBtnRef$cu9);
264
310
  }
265
- }, [currMinutesBtnRef, nextHourBtnRef, nextMeridiemBtnRef]); // const handleNextSecondBtnOnKeyDown = useCallback(
266
- // (e) => {
267
- // const { key } = e;
268
- // if (key === 'ArrowRight') {
269
- // nextMeridiemBtnRef?.current?.focus?.();
270
- // } else if (key === 'ArrowLeft') {
271
- // nextMinutesBtnRef?.current?.focus?.();
272
- // } else if (key === 'ArrowUp') {
273
- // currSecondsBtnRef?.current?.focus?.();
274
- // }
275
- // },
276
- // [currSecondsBtnRef, nextMeridiemBtnRef, nextMinutesBtnRef],
277
- // );
278
311
 
312
+ if (key === 'Home') onHomeKeyDownInsideTimeWheel();
313
+ if (key === 'End') onEndKeyDownInsideTimeWheel();
314
+ }, [currMinutesBtnRef, nextHourBtnRef, nextMeridiemBtnRef, onEndKeyDownInsideTimeWheel, onHomeKeyDownInsideTimeWheel]);
279
315
  const handleNextMeridiemBtnOnKeyDown = React.useCallback(e => {
280
316
  const {
281
317
  key
282
318
  } = e;
319
+ if (constants.homeEndAllArrowKeys.includes(key)) e.preventDefault();
320
+ if (constants.homeEndAllArrowKeys.includes(key)) e.stopPropagation();
283
321
 
284
322
  if (key === 'ArrowLeft') {
285
323
  var _nextMinutesBtnRef$cu3, _nextMinutesBtnRef$cu4;
286
324
 
287
325
  nextMinutesBtnRef === null || nextMinutesBtnRef === void 0 ? void 0 : (_nextMinutesBtnRef$cu3 = nextMinutesBtnRef.current) === null || _nextMinutesBtnRef$cu3 === void 0 ? void 0 : (_nextMinutesBtnRef$cu4 = _nextMinutesBtnRef$cu3.focus) === null || _nextMinutesBtnRef$cu4 === void 0 ? void 0 : _nextMinutesBtnRef$cu4.call(_nextMinutesBtnRef$cu3);
288
- } else if (key === 'ArrowUp') {
289
- var _currMeridiemBtnRef$c9, _currMeridiemBtnRef$c10;
326
+ }
290
327
 
291
- currMeridiemBtnRef === null || currMeridiemBtnRef === void 0 ? void 0 : (_currMeridiemBtnRef$c9 = currMeridiemBtnRef.current) === null || _currMeridiemBtnRef$c9 === void 0 ? void 0 : (_currMeridiemBtnRef$c10 = _currMeridiemBtnRef$c9.focus) === null || _currMeridiemBtnRef$c10 === void 0 ? void 0 : _currMeridiemBtnRef$c10.call(_currMeridiemBtnRef$c9);
328
+ if (key === 'ArrowUp') {
329
+ var _currMeridiemBtnRef$c11, _currMeridiemBtnRef$c12;
330
+
331
+ currMeridiemBtnRef === null || currMeridiemBtnRef === void 0 ? void 0 : (_currMeridiemBtnRef$c11 = currMeridiemBtnRef.current) === null || _currMeridiemBtnRef$c11 === void 0 ? void 0 : (_currMeridiemBtnRef$c12 = _currMeridiemBtnRef$c11.focus) === null || _currMeridiemBtnRef$c12 === void 0 ? void 0 : _currMeridiemBtnRef$c12.call(_currMeridiemBtnRef$c11);
292
332
  }
293
- }, [currMeridiemBtnRef, nextMinutesBtnRef]);
333
+
334
+ if (key === 'Home') onHomeKeyDownInsideTimeWheel();
335
+ if (key === 'End') onEndKeyDownInsideTimeWheel();
336
+ }, [currMeridiemBtnRef, nextMinutesBtnRef, onEndKeyDownInsideTimeWheel, onHomeKeyDownInsideTimeWheel]);
294
337
  return React.useMemo(() => ({
295
338
  handlePrevHourBtnOnKeyDown,
296
339
  handleCurrHourOnKeyDown,
@@ -298,17 +341,11 @@ const useKeyboardHandlers = ({
298
341
  handlePrevMinuteBtnOnKeyDown,
299
342
  handleCurrMinutesOnKeyDown,
300
343
  handleNextMinuteBtnOnKeyDown,
301
- // handlePrevSecondBtnOnKeyDown,
302
- // handleCurrSecondsOnKeyDown,
303
- // handleNextSecondBtnOnKeyDown,
304
344
  handlePrevMeridiemBtnOnKeyDown,
305
345
  handleCurrMeridiemOnKeyDown,
306
346
  handleNextMeridiemBtnOnKeyDown,
307
347
  handlePickerIconKeyDown
308
- }), [handleCurrHourOnKeyDown, handleCurrMeridiemOnKeyDown, handleCurrMinutesOnKeyDown, // handleCurrSecondsOnKeyDown,
309
- handleNextHourBtnOnKeyDown, handleNextMeridiemBtnOnKeyDown, handleNextMinuteBtnOnKeyDown, // handleNextSecondBtnOnKeyDown,
310
- handlePrevHourBtnOnKeyDown, handlePrevMeridiemBtnOnKeyDown, handlePrevMinuteBtnOnKeyDown, // handlePrevSecondBtnOnKeyDown,
311
- handlePickerIconKeyDown]);
348
+ }), [handleCurrHourOnKeyDown, handleCurrMeridiemOnKeyDown, handleCurrMinutesOnKeyDown, handleNextHourBtnOnKeyDown, handleNextMeridiemBtnOnKeyDown, handleNextMinuteBtnOnKeyDown, handlePrevHourBtnOnKeyDown, handlePrevMeridiemBtnOnKeyDown, handlePrevMinuteBtnOnKeyDown, handlePickerIconKeyDown]);
312
349
  };
313
350
 
314
351
  exports.useKeyboardHandlers = useKeyboardHandlers;
@@ -2,15 +2,22 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
+ require('core-js/modules/web.dom-collections.iterator.js');
5
6
  var React = require('react');
6
7
  var reactPopper = require('react-popper');
8
+ var ControlledDateTimePickerCTX = require('../../../ControlledDateTimePickerCTX.js');
7
9
  var useOnClickOutside = require('../../../utils/hooks/useOnClickOutside.js');
8
10
 
9
- const usePopperTriggerLogic = ({
10
- pickerButtonRef,
11
- onPickerClose,
12
- onPickerOpen
13
- }) => {
11
+ const usePopperTriggerLogic = () => {
12
+ const {
13
+ pickerButtonRef,
14
+ props: {
15
+ onPickerClose,
16
+ onPickerOpen
17
+ },
18
+ currHourBtnRef,
19
+ isWithCalendarToo
20
+ } = React.useContext(ControlledDateTimePickerCTX.ControlledDateTimePickerContext);
14
21
  const [showTimePicker, setShowTimePicker] = React.useState(false);
15
22
  const [referenceElement, setReferenceElement] = React.useState(null);
16
23
  const [popperElement, setPopperElement] = React.useState(null);
@@ -26,17 +33,21 @@ const usePopperTriggerLogic = ({
26
33
  const closeTimePicker = React.useCallback(() => {
27
34
  setShowTimePicker(false);
28
35
  onPickerClose();
29
- }, [onPickerClose]); // const openTimePicker = useCallback(() => {
30
- // setShowTimePicker(true);
31
- // onPickerOpen();
32
- // }, [onPickerOpen]);
33
-
36
+ }, [onPickerClose]);
34
37
  const handleToggleTimePicker = React.useCallback(() => {
35
38
  setShowTimePicker(oldShowCalendar => {
36
- if (!oldShowCalendar) onPickerOpen();else onPickerClose();
39
+ if (!oldShowCalendar) {
40
+ onPickerOpen();
41
+ if (!isWithCalendarToo) setTimeout(() => {
42
+ var _currHourBtnRef$curre, _currHourBtnRef$curre2;
43
+
44
+ return currHourBtnRef === null || currHourBtnRef === void 0 ? void 0 : (_currHourBtnRef$curre = currHourBtnRef.current) === null || _currHourBtnRef$curre === void 0 ? void 0 : (_currHourBtnRef$curre2 = _currHourBtnRef$curre.focus) === null || _currHourBtnRef$curre2 === void 0 ? void 0 : _currHourBtnRef$curre2.call(_currHourBtnRef$curre);
45
+ });
46
+ } else onPickerClose();
47
+
37
48
  return !oldShowCalendar;
38
49
  });
39
- }, [onPickerClose, onPickerOpen]);
50
+ }, [currHourBtnRef, isWithCalendarToo, onPickerClose, onPickerOpen]);
40
51
  useOnClickOutside.useOnClickOutside(popperElement, e => {
41
52
  var _pickerButtonRef$curr, _pickerButtonRef$curr2;
42
53