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