@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,40 +1,32 @@
1
+ import 'core-js/modules/esnext.async-iterator.filter.js';
2
+ import 'core-js/modules/esnext.iterator.constructor.js';
3
+ import 'core-js/modules/esnext.iterator.filter.js';
4
+ import 'core-js/modules/esnext.async-iterator.for-each.js';
5
+ import 'core-js/modules/esnext.iterator.for-each.js';
1
6
  import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
2
- import { useMemo, useContext, useCallback } from 'react';
7
+ import { useContext, useCallback, useMemo } from 'react';
3
8
  import { ControlledDateTimePickerContext } from '../../ControlledDateTimePickerCTX.js';
4
- import { dateTimeToDate, deconstructValuesFromDateString, getFormattedDateString, prependStringWithPlaceHolders, fillStringWithPlaceHolders } from '../../utils/stringHelpers.js';
9
+ import { getFormattedDateString, prependStringWithPlaceHolders, fillStringWithPlaceHolders } from '../../utils/stringHelpers.js';
5
10
  import { getValidationDateStringMetaInfo } from '../../utils/dateHelpers.js';
11
+ import { homeEndArrowUpDownDashSlashesKeys, homeEndArrowUpDownSpaceKeys, defaultMetaInfo } from '../../utils/constants.js';
6
12
 
7
13
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
8
14
 
9
15
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
10
- // our source of truth is either the date props or dateTime props
11
- // based on wheter it's a dateTime picker
12
- // or a date picker (it's date picker when hideTime is true)
13
-
14
- const useGetDestructuredDateValues = ({
15
- date,
16
- dateTime,
17
- hideTime
18
- }) => {
19
- const dateStringFromProps = useMemo(() => hideTime ? date : dateTimeToDate(dateTime), [date, dateTime, hideTime]);
20
- const deconstructedValues = useMemo(() => deconstructValuesFromDateString(dateStringFromProps), [dateStringFromProps]);
21
- return deconstructedValues;
22
- };
23
16
  const useDateInputs = () => {
24
17
  const {
25
18
  props: {
26
- date,
27
- dateTime,
28
19
  onMonthChange: appOnMonthChange,
29
20
  onDayChange: appOnDayChange,
30
21
  onYearChange: appOnYearChange,
31
22
  getIsDisabledDay,
32
- getIsOutOfRangeDay
23
+ getIsOutOfRangeDay,
24
+ disabled
33
25
  },
26
+ month,
27
+ day,
28
+ year,
34
29
  hideTime,
35
- hideDateTimePicker,
36
- hideDatePicker,
37
- hideTimePicker,
38
30
  monthInputRef,
39
31
  dayInputRef,
40
32
  yearInputRef,
@@ -46,33 +38,25 @@ const useDateInputs = () => {
46
38
  setLatestInteractionRegion,
47
39
  withClearBtn,
48
40
  withAnyPicker,
49
- withAnyRightController
41
+ withAnyRightController,
42
+ autoFocusMonthInput,
43
+ lastSegmentRef
50
44
  } = useContext(ControlledDateTimePickerContext);
51
- const {
52
- month,
53
- day,
54
- year
55
- } = useGetDestructuredDateValues({
56
- date,
57
- dateTime,
58
- hideTime
59
- });
60
45
  const onHomeKeyDown = useCallback(() => {
61
46
  var _monthInputRef$curren, _monthInputRef$curren2;
62
47
 
63
48
  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);
64
49
  }, [monthInputRef]);
65
50
  const onEndKeyDown = useCallback(() => {
66
- var _pickerButtonRef$curr, _pickerButtonRef$curr2, _yearInputRef$current, _yearInputRef$current2, _meridiemInputRef$cur, _meridiemInputRef$cur2;
51
+ var _pickerButtonRef$curr, _pickerButtonRef$curr2, _clearButtonRef$curre, _clearButtonRef$curre2, _meridiemInputRef$cur, _meridiemInputRef$cur2, _yearInputRef$current, _yearInputRef$current2;
67
52
 
68
- if (!hideDateTimePicker || !hideDatePicker || !hideTimePicker) pickerButtonRef === null || pickerButtonRef === void 0 ? void 0 : (_pickerButtonRef$curr = pickerButtonRef.current) === null || _pickerButtonRef$curr === void 0 ? void 0 : (_pickerButtonRef$curr2 = _pickerButtonRef$curr.focus) === null || _pickerButtonRef$curr2 === void 0 ? void 0 : _pickerButtonRef$curr2.call(_pickerButtonRef$curr);else if (hideTime) 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);else meridiemInputRef === null || meridiemInputRef === void 0 ? void 0 : (_meridiemInputRef$cur = meridiemInputRef.current) === null || _meridiemInputRef$cur === void 0 ? void 0 : (_meridiemInputRef$cur2 = _meridiemInputRef$cur.focus) === null || _meridiemInputRef$cur2 === void 0 ? void 0 : _meridiemInputRef$cur2.call(_meridiemInputRef$cur);
69
- }, [hideDateTimePicker, hideDatePicker, hideTimePicker, hideTime, pickerButtonRef, yearInputRef, meridiemInputRef]);
53
+ if (withAnyPicker) pickerButtonRef === null || pickerButtonRef === void 0 ? void 0 : (_pickerButtonRef$curr = pickerButtonRef.current) === null || _pickerButtonRef$curr === void 0 ? void 0 : (_pickerButtonRef$curr2 = _pickerButtonRef$curr.focus) === null || _pickerButtonRef$curr2 === void 0 ? void 0 : _pickerButtonRef$curr2.call(_pickerButtonRef$curr);else if (withClearBtn) clearButtonRef === null || clearButtonRef === void 0 ? void 0 : (_clearButtonRef$curre = clearButtonRef.current) === null || _clearButtonRef$curre === void 0 ? void 0 : (_clearButtonRef$curre2 = _clearButtonRef$curre.focus) === null || _clearButtonRef$curre2 === void 0 ? void 0 : _clearButtonRef$curre2.call(_clearButtonRef$curre);else if (!hideTime) meridiemInputRef === null || meridiemInputRef === void 0 ? void 0 : (_meridiemInputRef$cur = meridiemInputRef.current) === null || _meridiemInputRef$cur === void 0 ? void 0 : (_meridiemInputRef$cur2 = _meridiemInputRef$cur.focus) === null || _meridiemInputRef$cur2 === void 0 ? void 0 : _meridiemInputRef$cur2.call(_meridiemInputRef$cur);else yearInputRef === null || yearInputRef === void 0 ? void 0 : (_yearInputRef$current = yearInputRef.current) === null || _yearInputRef$current === void 0 ? void 0 : (_yearInputRef$current2 = _yearInputRef$current.focus) === null || _yearInputRef$current2 === void 0 ? void 0 : _yearInputRef$current2.call(_yearInputRef$current);
54
+ }, [withAnyPicker, pickerButtonRef, withClearBtn, clearButtonRef, hideTime, meridiemInputRef, yearInputRef]);
70
55
  const setLatestInteractionRegionDateInputs = useCallback(() => {
71
56
  setLatestInteractionRegion('date-inputs');
72
57
  }, [setLatestInteractionRegion]);
73
- const handleChangeMonth = useCallback((newMonth, e, metaInfo = {
74
- isAutomaticFillTrigger: false
75
- }) => {
58
+ const handleChangeMonth = useCallback(function (newMonth, e) {
59
+ let metaInfo = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : defaultMetaInfo;
76
60
  const newDateString = getFormattedDateString({
77
61
  month: newMonth,
78
62
  day,
@@ -100,36 +84,51 @@ const useDateInputs = () => {
100
84
  if (newMonth.length === 2) dayInputRef === null || dayInputRef === void 0 ? void 0 : (_dayInputRef$current = dayInputRef.current) === null || _dayInputRef$current === void 0 ? void 0 : (_dayInputRef$current$ = _dayInputRef$current.focus) === null || _dayInputRef$current$ === void 0 ? void 0 : _dayInputRef$current$.call(_dayInputRef$current);
101
85
  }, [dayInputRef, handleChangeMonth]);
102
86
  const onMonthKeyDown = useCallback(e => {
87
+ var _lastSegmentRef$curre, _lastSegmentRef$curre2;
88
+
103
89
  const {
104
- key
90
+ key,
91
+ ctrlKey,
92
+ metaKey
105
93
  } = e;
106
- const preventDefaultKeys = ['Home', 'End', 'ArrowUp', 'ArrowDown'];
107
- if (preventDefaultKeys.includes(key)) e.preventDefault();
94
+ const monthStringConvertedToInteger = Number.parseInt(month, 10);
95
+ if (homeEndArrowUpDownDashSlashesKeys.includes(key)) e.preventDefault();
96
+ if (homeEndArrowUpDownDashSlashesKeys.includes(key)) e.stopPropagation();
108
97
  if (key === 'Home') onHomeKeyDown();
109
98
  if (key === 'End') onEndKeyDown();
110
99
 
111
100
  if (key === 'ArrowUp' || key === 'ArrowDown') {
112
- const monthStringConvertedToInteger = Number.parseInt(month, 10);
113
101
  const monthInteger = Number.isNaN(monthStringConvertedToInteger) ? 0 : monthStringConvertedToInteger;
114
102
  let newMonth;
115
103
  if (key === 'ArrowUp') newMonth = monthInteger + 1 <= 12 ? monthInteger + 1 : monthInteger;else newMonth = monthInteger - 1 > 0 ? monthInteger - 1 : 1;
116
- newMonth = prependStringWithPlaceHolders(`${newMonth}`, 2);
104
+ newMonth = prependStringWithPlaceHolders("".concat(newMonth), 2);
117
105
  handleChangeMonth(newMonth, e);
118
106
  }
119
- }, [onHomeKeyDown, onEndKeyDown, month, handleChangeMonth]);
107
+
108
+ if (!Number.isNaN(monthStringConvertedToInteger) && (key === '-' || key === '/' || key === '\\')) {
109
+ var _dayInputRef$current2, _dayInputRef$current3;
110
+
111
+ const newMonth = prependStringWithPlaceHolders("".concat(monthStringConvertedToInteger), 2);
112
+ handleChangeMonth(newMonth, e); // auto-advance functionality:
113
+
114
+ if (newMonth.length === 2) dayInputRef === null || dayInputRef === void 0 ? void 0 : (_dayInputRef$current2 = dayInputRef.current) === null || _dayInputRef$current2 === void 0 ? void 0 : (_dayInputRef$current3 = _dayInputRef$current2.focus) === null || _dayInputRef$current3 === void 0 ? void 0 : _dayInputRef$current3.call(_dayInputRef$current2);
115
+ } // focus last fragment on fill with now
116
+
117
+
118
+ if ((ctrlKey || metaKey) && key === ';') lastSegmentRef === null || lastSegmentRef === void 0 ? void 0 : (_lastSegmentRef$curre = lastSegmentRef.current) === null || _lastSegmentRef$curre === void 0 ? void 0 : (_lastSegmentRef$curre2 = _lastSegmentRef$curre.focus) === null || _lastSegmentRef$curre2 === void 0 ? void 0 : _lastSegmentRef$curre2.call(_lastSegmentRef$curre);
119
+ }, [month, onHomeKeyDown, onEndKeyDown, lastSegmentRef, handleChangeMonth, dayInputRef]);
120
120
  const onMonthBlur = useCallback(e => {
121
121
  var _e$target2;
122
122
 
123
123
  const newMonth = e === null || e === void 0 ? void 0 : (_e$target2 = e.target) === null || _e$target2 === void 0 ? void 0 : _e$target2.value;
124
- if (newMonth === '0') handleChangeMonth('', e, {
124
+ if (newMonth === '0') handleChangeMonth('01', e, {
125
125
  isAutomaticFillTrigger: true
126
126
  });else if (newMonth.length > 0 && newMonth.length < 2) handleChangeMonth(prependStringWithPlaceHolders(newMonth, 2), e, {
127
127
  isAutomaticFillTrigger: true
128
128
  });
129
129
  }, [handleChangeMonth]);
130
- const handleChangeDay = useCallback((newDay, e, metaInfo = {
131
- isAutomaticFillTrigger: false
132
- }) => {
130
+ const handleChangeDay = useCallback(function (newDay, e) {
131
+ let metaInfo = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : defaultMetaInfo;
133
132
  const newDateString = getFormattedDateString({
134
133
  month,
135
134
  day: newDay,
@@ -157,36 +156,58 @@ const useDateInputs = () => {
157
156
  if (newDay.length === 2) yearInputRef === null || yearInputRef === void 0 ? void 0 : (_yearInputRef$current3 = yearInputRef.current) === null || _yearInputRef$current3 === void 0 ? void 0 : (_yearInputRef$current4 = _yearInputRef$current3.focus) === null || _yearInputRef$current4 === void 0 ? void 0 : _yearInputRef$current4.call(_yearInputRef$current3);
158
157
  }, [handleChangeDay, yearInputRef]);
159
158
  const onDayKeyDown = useCallback(e => {
159
+ var _lastSegmentRef$curre3, _lastSegmentRef$curre4;
160
+
160
161
  const {
161
- key
162
+ key,
163
+ ctrlKey,
164
+ metaKey
162
165
  } = e;
163
- const preventDefaultKeys = ['Home', 'End', 'ArrowUp', 'ArrowDown'];
164
- if (preventDefaultKeys.includes(key)) e.preventDefault();
166
+ const dayStringConvertedToInteger = Number.parseInt(day, 10);
167
+ if (homeEndArrowUpDownDashSlashesKeys.includes(key)) e.preventDefault();
168
+ if (homeEndArrowUpDownDashSlashesKeys.includes(key)) e.stopPropagation();
165
169
  if (key === 'Home') onHomeKeyDown();
166
170
  if (key === 'End') onEndKeyDown();
167
171
 
168
172
  if (key === 'ArrowUp' || key === 'ArrowDown') {
169
- const dayStringConvertedToInteger = Number.parseInt(day, 10);
170
173
  const dayInteger = Number.isNaN(dayStringConvertedToInteger) ? 0 : dayStringConvertedToInteger;
171
174
  let newDay;
172
175
  if (key === 'ArrowUp') newDay = dayInteger + 1 <= 31 ? dayInteger + 1 : dayInteger;else newDay = dayInteger - 1 > 0 ? dayInteger - 1 : 1;
173
- newDay = prependStringWithPlaceHolders(`${newDay}`, 2);
176
+ newDay = prependStringWithPlaceHolders("".concat(newDay), 2);
174
177
  handleChangeDay(newDay, e);
175
178
  }
176
- }, [onHomeKeyDown, onEndKeyDown, handleChangeDay, day]);
179
+
180
+ if (!Number.isNaN(dayStringConvertedToInteger) && (key === '-' || key === '/' || key === '\\')) {
181
+ var _yearInputRef$current5, _yearInputRef$current6;
182
+
183
+ const newDay = prependStringWithPlaceHolders("".concat(dayStringConvertedToInteger), 2);
184
+ handleChangeDay(newDay, e); // auto-advance functionality:
185
+
186
+ if (newDay.length === 2) yearInputRef === null || yearInputRef === void 0 ? void 0 : (_yearInputRef$current5 = yearInputRef.current) === null || _yearInputRef$current5 === void 0 ? void 0 : (_yearInputRef$current6 = _yearInputRef$current5.focus) === null || _yearInputRef$current6 === void 0 ? void 0 : _yearInputRef$current6.call(_yearInputRef$current5);
187
+ } // regressive backspace functionality
188
+
189
+
190
+ if (key === 'Backspace' && (day === null || day === void 0 ? void 0 : day.length) === 0) {
191
+ var _monthInputRef$curren3, _monthInputRef$curren4;
192
+
193
+ monthInputRef === null || monthInputRef === void 0 ? void 0 : (_monthInputRef$curren3 = monthInputRef.current) === null || _monthInputRef$curren3 === void 0 ? void 0 : (_monthInputRef$curren4 = _monthInputRef$curren3.focus) === null || _monthInputRef$curren4 === void 0 ? void 0 : _monthInputRef$curren4.call(_monthInputRef$curren3);
194
+ } // focus last fragment on fill with now
195
+
196
+
197
+ if ((ctrlKey || metaKey) && key === ';') lastSegmentRef === null || lastSegmentRef === void 0 ? void 0 : (_lastSegmentRef$curre3 = lastSegmentRef.current) === null || _lastSegmentRef$curre3 === void 0 ? void 0 : (_lastSegmentRef$curre4 = _lastSegmentRef$curre3.focus) === null || _lastSegmentRef$curre4 === void 0 ? void 0 : _lastSegmentRef$curre4.call(_lastSegmentRef$curre3);
198
+ }, [day, onHomeKeyDown, onEndKeyDown, lastSegmentRef, handleChangeDay, yearInputRef, monthInputRef]);
177
199
  const onDayBlur = useCallback(e => {
178
200
  var _e$target4;
179
201
 
180
202
  const newDay = e === null || e === void 0 ? void 0 : (_e$target4 = e.target) === null || _e$target4 === void 0 ? void 0 : _e$target4.value;
181
- if (newDay === '0') handleChangeDay('', e, {
203
+ if (newDay === '0') handleChangeDay('01', e, {
182
204
  isAutomaticFillTrigger: true
183
205
  });else if (newDay.length > 0 && newDay.length < 2) handleChangeDay(prependStringWithPlaceHolders(newDay, 2), e, {
184
206
  isAutomaticFillTrigger: true
185
207
  });
186
208
  }, [handleChangeDay]);
187
- const handleChangeYear = useCallback((newYear, e, metaInfo = {
188
- isAutomaticFillTrigger: false
189
- }) => {
209
+ const handleChangeYear = useCallback(function (newYear, e) {
210
+ let metaInfo = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : defaultMetaInfo;
190
211
  const newDateString = getFormattedDateString({
191
212
  month,
192
213
  day,
@@ -213,30 +234,59 @@ const useDateInputs = () => {
213
234
  var _hourInputRef$current, _hourInputRef$current2;
214
235
 
215
236
  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);else if (withAnyRightController) {
216
- var _clearButtonRef$curre, _clearButtonRef$curre2, _pickerButtonRef$curr3, _pickerButtonRef$curr4;
237
+ var _clearButtonRef$curre3, _clearButtonRef$curre4, _pickerButtonRef$curr3, _pickerButtonRef$curr4;
217
238
 
218
- if (withClearBtn) (_clearButtonRef$curre = clearButtonRef.current) === null || _clearButtonRef$curre === void 0 ? void 0 : (_clearButtonRef$curre2 = _clearButtonRef$curre.focus) === null || _clearButtonRef$curre2 === void 0 ? void 0 : _clearButtonRef$curre2.call(_clearButtonRef$curre);else if (withAnyPicker) pickerButtonRef === null || pickerButtonRef === void 0 ? void 0 : (_pickerButtonRef$curr3 = pickerButtonRef.current) === null || _pickerButtonRef$curr3 === void 0 ? void 0 : (_pickerButtonRef$curr4 = _pickerButtonRef$curr3.focus) === null || _pickerButtonRef$curr4 === void 0 ? void 0 : _pickerButtonRef$curr4.call(_pickerButtonRef$curr3); // pending approval from Seda, check which one should be focused first...
239
+ if (withClearBtn) (_clearButtonRef$curre3 = clearButtonRef.current) === null || _clearButtonRef$curre3 === void 0 ? void 0 : (_clearButtonRef$curre4 = _clearButtonRef$curre3.focus) === null || _clearButtonRef$curre4 === void 0 ? void 0 : _clearButtonRef$curre4.call(_clearButtonRef$curre3);else if (withAnyPicker) pickerButtonRef === null || pickerButtonRef === void 0 ? void 0 : (_pickerButtonRef$curr3 = pickerButtonRef.current) === null || _pickerButtonRef$curr3 === void 0 ? void 0 : (_pickerButtonRef$curr4 = _pickerButtonRef$curr3.focus) === null || _pickerButtonRef$curr4 === void 0 ? void 0 : _pickerButtonRef$curr4.call(_pickerButtonRef$curr3); // pending approval from Seda, check which one should be focused first...
219
240
  }
220
241
  }
221
242
  }, [handleChangeYear, hideTime, hourInputRef, withAnyRightController, withAnyPicker, pickerButtonRef, withClearBtn, clearButtonRef]);
222
243
  const onYearKeyDown = useCallback(e => {
244
+ var _lastSegmentRef$curre5, _lastSegmentRef$curre6;
245
+
223
246
  const {
224
- key
247
+ key,
248
+ ctrlKey,
249
+ metaKey
225
250
  } = e;
226
- const preventDefaultKeys = ['Home', 'End', 'ArrowUp', 'ArrowDown'];
227
- if (preventDefaultKeys.includes(key)) e.preventDefault();
251
+ const yearStringConvertedToInteger = Number.parseInt(year, 10);
252
+ if (homeEndArrowUpDownSpaceKeys.includes(key)) e.preventDefault();
253
+ if (homeEndArrowUpDownSpaceKeys.includes(key)) e.stopPropagation();
228
254
  if (key === 'Home') onHomeKeyDown();
229
255
  if (key === 'End') onEndKeyDown();
230
256
 
231
257
  if (key === 'ArrowUp' || key === 'ArrowDown') {
232
- const yearStringConvertedToInteger = Number.parseInt(year, 10);
233
258
  const yearInteger = Number.isNaN(yearStringConvertedToInteger) ? 0 : yearStringConvertedToInteger;
234
259
  let newYear;
235
260
  if (key === 'ArrowUp') newYear = yearInteger + 1 <= 9999 ? yearInteger + 1 : yearInteger;else newYear = yearInteger - 1 > 0 ? yearInteger - 1 : 1;
236
- newYear = prependStringWithPlaceHolders(`${newYear}`, 4);
261
+ newYear = prependStringWithPlaceHolders("".concat(newYear), 4);
237
262
  handleChangeYear(newYear, e);
238
263
  }
239
- }, [onHomeKeyDown, onEndKeyDown, handleChangeYear, year]);
264
+
265
+ if (!Number.isNaN(yearStringConvertedToInteger) && key === ' ') {
266
+ const newYear = prependStringWithPlaceHolders("".concat(yearStringConvertedToInteger), 4);
267
+ handleChangeYear(newYear, e); // auto-advance functionality:
268
+
269
+ if (newYear.length === 4) {
270
+ var _hourInputRef$current3, _hourInputRef$current4;
271
+
272
+ if (!hideTime) hourInputRef === null || hourInputRef === void 0 ? void 0 : (_hourInputRef$current3 = hourInputRef.current) === null || _hourInputRef$current3 === void 0 ? void 0 : (_hourInputRef$current4 = _hourInputRef$current3.focus) === null || _hourInputRef$current4 === void 0 ? void 0 : _hourInputRef$current4.call(_hourInputRef$current3);else if (withAnyRightController) {
273
+ var _clearButtonRef$curre5, _clearButtonRef$curre6, _pickerButtonRef$curr5, _pickerButtonRef$curr6;
274
+
275
+ if (withClearBtn) (_clearButtonRef$curre5 = clearButtonRef.current) === null || _clearButtonRef$curre5 === void 0 ? void 0 : (_clearButtonRef$curre6 = _clearButtonRef$curre5.focus) === null || _clearButtonRef$curre6 === void 0 ? void 0 : _clearButtonRef$curre6.call(_clearButtonRef$curre5);else if (withAnyPicker) pickerButtonRef === null || pickerButtonRef === void 0 ? void 0 : (_pickerButtonRef$curr5 = pickerButtonRef.current) === null || _pickerButtonRef$curr5 === void 0 ? void 0 : (_pickerButtonRef$curr6 = _pickerButtonRef$curr5.focus) === null || _pickerButtonRef$curr6 === void 0 ? void 0 : _pickerButtonRef$curr6.call(_pickerButtonRef$curr5); // pending approval from Seda, check which one should be focused first...
276
+ }
277
+ }
278
+ } // regressive backspace functionality
279
+
280
+
281
+ if (key === 'Backspace' && (year === null || year === void 0 ? void 0 : year.length) === 0) {
282
+ var _dayInputRef$current4, _dayInputRef$current5;
283
+
284
+ dayInputRef === null || dayInputRef === void 0 ? void 0 : (_dayInputRef$current4 = dayInputRef.current) === null || _dayInputRef$current4 === void 0 ? void 0 : (_dayInputRef$current5 = _dayInputRef$current4.focus) === null || _dayInputRef$current5 === void 0 ? void 0 : _dayInputRef$current5.call(_dayInputRef$current4);
285
+ } // focus last fragment on fill with now
286
+
287
+
288
+ if ((ctrlKey || metaKey) && key === ';') lastSegmentRef === null || lastSegmentRef === void 0 ? void 0 : (_lastSegmentRef$curre5 = lastSegmentRef.current) === null || _lastSegmentRef$curre5 === void 0 ? void 0 : (_lastSegmentRef$curre6 = _lastSegmentRef$curre5.focus) === null || _lastSegmentRef$curre6 === void 0 ? void 0 : _lastSegmentRef$curre6.call(_lastSegmentRef$curre5);
289
+ }, [year, onHomeKeyDown, onEndKeyDown, lastSegmentRef, handleChangeYear, hideTime, hourInputRef, withAnyRightController, withClearBtn, clearButtonRef, withAnyPicker, pickerButtonRef, dayInputRef]);
240
290
  const onYearBlur = useCallback(e => {
241
291
  var _e$target6;
242
292
 
@@ -249,6 +299,8 @@ const useDateInputs = () => {
249
299
  month,
250
300
  day,
251
301
  year,
302
+ autoFocusMonthInput,
303
+ disabled,
252
304
  onMonthFocus,
253
305
  onMonthChange,
254
306
  onDayFocus,
@@ -261,7 +313,7 @@ const useDateInputs = () => {
261
313
  onMonthKeyDown,
262
314
  onDayKeyDown,
263
315
  onYearKeyDown
264
- }), [month, day, year, onMonthFocus, onMonthChange, onDayFocus, onDayChange, onYearFocus, onYearChange, onMonthBlur, onDayBlur, onYearBlur, onMonthKeyDown, onDayKeyDown, onYearKeyDown]);
316
+ }), [month, day, year, autoFocusMonthInput, disabled, onMonthFocus, onMonthChange, onDayFocus, onDayChange, onYearFocus, onYearChange, onMonthBlur, onDayBlur, onYearBlur, onMonthKeyDown, onDayKeyDown, onYearKeyDown]);
265
317
  };
266
318
 
267
- export { useDateInputs, useGetDestructuredDateValues };
319
+ export { useDateInputs };
@@ -8,9 +8,10 @@ import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
8
8
 
9
9
  var _CalendarIconTrigger, _CalendarWrapper;
10
10
 
11
- const WrappedCalendarContext = ({
12
- children
13
- }) => {
11
+ const WrappedCalendarContext = _ref => {
12
+ let {
13
+ children
14
+ } = _ref;
14
15
  const ctx = useConfigCalendarCTX();
15
16
  return /*#__PURE__*/_jsx(CalendarContext.Provider, {
16
17
  value: ctx
@@ -3,11 +3,17 @@ import React from 'react';
3
3
  import { CalendarMonthDays } from './CalendarMonthDays.js';
4
4
  import { CalendarWeekDays } from './CalendarWeekDays.js';
5
5
  import { StyledBody } from './Styleds.js';
6
- import { jsxs, Fragment } from 'react/jsx-runtime';
7
6
 
8
7
  var _CalendarWeekDays, _StyledBody;
9
- const CalendarBody = /*#__PURE__*/React.memo(() => /*#__PURE__*/jsxs(Fragment, {
10
- children: [_CalendarWeekDays || (_CalendarWeekDays = /*#__PURE__*/_jsx(CalendarWeekDays, {})), _StyledBody || (_StyledBody = /*#__PURE__*/_jsx(StyledBody, {}, void 0, /*#__PURE__*/_jsx(CalendarMonthDays, {})))]
11
- }));
8
+ const CalendarBody = /*#__PURE__*/React.memo(_ref => {
9
+ let {
10
+ weekRowsNum
11
+ } = _ref;
12
+ return /*#__PURE__*/_jsx("span", {
13
+ role: "grid",
14
+ "aria-colcount": 7,
15
+ "aria-rowcount": weekRowsNum
16
+ }, void 0, _CalendarWeekDays || (_CalendarWeekDays = /*#__PURE__*/_jsx(CalendarWeekDays, {})), _StyledBody || (_StyledBody = /*#__PURE__*/_jsx(StyledBody, {}, void 0, /*#__PURE__*/_jsx(CalendarMonthDays, {}))));
17
+ });
12
18
 
13
19
  export { CalendarBody };
@@ -1,26 +1,32 @@
1
1
  import _jsx from '@babel/runtime/helpers/esm/jsx';
2
2
  import { useContext } from 'react';
3
+ import { ControlledDateTimePickerDatatestid } from '../../../ControlledDateTimePickerDatatestid.js';
3
4
  import { CalendarBody } from './CalendarBody.js';
4
5
  import { CalendarHead } from './CalendarHead.js';
5
6
  import { CalendarFooter } from './CalendarFooter.js';
6
7
  import { CalendarContext } from './CalendarContext.js';
7
- import { StyledSpacingResetter, StyledCalendarWrapper } from './Styleds.js';
8
+ import { StyledShadowWrapper, StyledCalendarWrapper } from './Styleds.js';
8
9
 
9
- var _StyledCalendarWrappe;
10
- // <StyledSpacingResetter className={className}>
10
+ var _CalendarHead, _CalendarFooter;
11
+ // <StyledShadowWrapper className={className}>
11
12
  // is required for styled-components, without this we can't styled(CalendarContent)...
12
13
  // https://stackoverflow.com/questions/52542817/styled-components-not-applying-style-to-custom-functional-react-component
13
14
 
14
- const CalendarContent = ({
15
- className = ''
16
- }) => {
15
+ const CalendarContent = _ref => {
16
+ let {
17
+ className = ''
18
+ } = _ref;
17
19
  const {
18
- isControllerOnly
20
+ isControllerOnly,
21
+ daysMatrixByWeekday
19
22
  } = useContext(CalendarContext);
20
- return /*#__PURE__*/_jsx(StyledSpacingResetter, {
23
+ return /*#__PURE__*/_jsx(StyledShadowWrapper, {
21
24
  className: className,
22
- isControllerOnly: isControllerOnly
23
- }, void 0, _StyledCalendarWrappe || (_StyledCalendarWrappe = /*#__PURE__*/_jsx(StyledCalendarWrapper, {}, void 0, /*#__PURE__*/_jsx(CalendarHead, {}), /*#__PURE__*/_jsx(CalendarBody, {}), /*#__PURE__*/_jsx(CalendarFooter, {}))));
25
+ isControllerOnly: isControllerOnly,
26
+ "data-testid": ControlledDateTimePickerDatatestid.CONTROLLER_COMPONENT.CALENDAR
27
+ }, void 0, /*#__PURE__*/_jsx(StyledCalendarWrapper, {}, void 0, _CalendarHead || (_CalendarHead = /*#__PURE__*/_jsx(CalendarHead, {})), /*#__PURE__*/_jsx(CalendarBody, {
28
+ weekRowsNum: daysMatrixByWeekday.length
29
+ }), _CalendarFooter || (_CalendarFooter = /*#__PURE__*/_jsx(CalendarFooter, {}))));
24
30
  };
25
31
 
26
32
  export { CalendarContent };
@@ -4,7 +4,9 @@ import { createRef, createContext } from 'react';
4
4
  const noop = () => {};
5
5
 
6
6
  const defaultCalendarContext = {
7
+ ariaCurrentValueForInputs: '',
7
8
  showCalendar: false,
9
+ disabled: false,
8
10
  setShowCalendar: noop,
9
11
  closeCalendar: noop,
10
12
  setPopperElement: noop,
@@ -21,6 +23,9 @@ const defaultCalendarContext = {
21
23
  currentMonth: undefined,
22
24
  currentYear: undefined,
23
25
  daysArray: [],
26
+ invisibleFirstDay: undefined,
27
+ daysMatrixByWeekday: [],
28
+ invisibleLastDay: undefined,
24
29
  focusedDay: undefined,
25
30
  tryToFocusCurrentlyDataIsFocusedDay: noop,
26
31
  resetFocusedDayToStartDate: noop,
@@ -38,6 +43,7 @@ const defaultCalendarContext = {
38
43
  handlePickerIconKeyDown: noop,
39
44
  isControllerOnly: false,
40
45
  isWithTimeWheelToo: true,
46
+ autoFocusPrevMonthArrow: false,
41
47
  onPrevYearFocus: noop,
42
48
  onPrevMonthFocus: noop,
43
49
  onNextMonthFocus: noop,
@@ -1,17 +1,41 @@
1
1
  import _jsx from '@babel/runtime/helpers/esm/jsx';
2
+ import 'core-js/modules/esnext.async-iterator.map.js';
3
+ import 'core-js/modules/esnext.iterator.map.js';
2
4
  import React from 'react';
3
5
  import { Day } from './Day.js';
4
- import { StyledMonthDaysUList } from './Styleds.js';
5
- import { jsx } from 'react/jsx-runtime';
6
+ import { StyledWeekDaysListWrapper } from './Styleds.js';
7
+ import { jsxs } from 'react/jsx-runtime';
6
8
 
7
- const CalendarDaysList = /*#__PURE__*/React.memo(({
8
- daysArray,
9
- innerRef
10
- }) => /*#__PURE__*/jsx("div", {
11
- ref: innerRef,
12
- children: /*#__PURE__*/_jsx(StyledMonthDaysUList, {}, void 0, daysArray.map(metaDay => /*#__PURE__*/_jsx(Day, {
13
- metaDay: metaDay
14
- }, `ds-calendar-${metaDay.day.toString()}`)))
15
- }));
9
+ const CalendarDaysList = /*#__PURE__*/React.memo(_ref => {
10
+ let {
11
+ invisibleFirstDay,
12
+ daysMatrixByWeekday,
13
+ invisibleLastDay,
14
+ innerRef
15
+ } = _ref;
16
+ return /*#__PURE__*/jsxs("div", {
17
+ ref: innerRef,
18
+ role: "rowgroup",
19
+ children: [/*#__PURE__*/_jsx(Day, {
20
+ metaDay: invisibleFirstDay,
21
+ isInvisible: true
22
+ }, "ds-calendar-".concat(invisibleFirstDay.day.toString())), daysMatrixByWeekday.map((week, i) => /*#__PURE__*/_jsx(StyledWeekDaysListWrapper, {
23
+ role: "row",
24
+ "aria-rowindex": i + 1,
25
+ cols: ['32px', '32px', '32px', '32px', '32px', '32px', '32px'],
26
+ rows: ['28px'],
27
+ py: "xxxs",
28
+ px: "2px",
29
+ justifyContent: "space-between",
30
+ alignItems: "center"
31
+ }, "ds-calendar-week-".concat(week[0].day.toString(), "-").concat(week[6].day.toString()), week.map((metaDay, z) => /*#__PURE__*/_jsx(Day, {
32
+ metaDay: metaDay,
33
+ colIndex: z + 1
34
+ }, "ds-calendar-".concat(metaDay.day.toString()))))), /*#__PURE__*/_jsx(Day, {
35
+ metaDay: invisibleLastDay,
36
+ isInvisible: true
37
+ }, "ds-calendar-".concat(invisibleLastDay.day.toString()))]
38
+ });
39
+ });
16
40
 
17
41
  export { CalendarDaysList };
@@ -11,7 +11,9 @@ const CalendarFooter = () => {
11
11
  },
12
12
  isWithTimeWheelToo
13
13
  } = useContext(ControlledDateTimePickerContext);
14
- if (pickerFooterMsg !== undefined && !isWithTimeWheelToo && hasError) return /*#__PURE__*/_jsx(CalendarFooterMessage, {}, void 0, pickerFooterMsg);
14
+ if (pickerFooterMsg !== undefined && !isWithTimeWheelToo && hasError) return /*#__PURE__*/_jsx(CalendarFooterMessage, {
15
+ role: "alert"
16
+ }, void 0, pickerFooterMsg);
15
17
  return null;
16
18
  };
17
19
 
@@ -1,9 +1,8 @@
1
1
  import _jsx from '@babel/runtime/helpers/esm/jsx';
2
2
  import { useMemo, useContext } from 'react';
3
- import ChevronDoubleLeft from '@elliemae/ds-icons/ChevronDoubleLeft';
4
- import ChevronLeft from '@elliemae/ds-icons/ChevronLeft';
5
- import ChevronRight from '@elliemae/ds-icons/ChevronRight';
6
- import ChevronDoubleRight from '@elliemae/ds-icons/ChevronDoubleRight';
3
+ import { BUTTON_SIZES } from '@elliemae/ds-button';
4
+ import { ChevronDoubleLeft, ChevronLeft, ChevronRight, ChevronDoubleRight } from '@elliemae/ds-icons';
5
+ import { ControlledDateTimePickerDatatestid } from '../../../ControlledDateTimePickerDatatestid.js';
7
6
  import { getMonthNameByMonthNumber } from '../../../utils/dateHelpers.js';
8
7
  import { StyledHeader, StyledHeaderButton } from './Styleds.js';
9
8
  import { CalendarContext } from './CalendarContext.js';
@@ -15,8 +14,8 @@ const useGetFormattedCurrentDate = () => {
15
14
  currentMonth,
16
15
  currentYear
17
16
  } = useContext(CalendarContext);
18
- const monthString = currentMonth >= 0 && currentMonth <= 11 ? `${getMonthNameByMonthNumber(currentMonth)} ` : '';
19
- return useMemo(() => `${monthString}${currentYear}`, [monthString, currentYear]);
17
+ const monthString = currentMonth >= 0 && currentMonth <= 11 ? "".concat(getMonthNameByMonthNumber(currentMonth), " ") : '';
18
+ return useMemo(() => "".concat(monthString).concat(currentYear), [monthString, currentYear]);
20
19
  };
21
20
 
22
21
  const CalendarHead = () => {
@@ -37,58 +36,62 @@ const CalendarHead = () => {
37
36
  onPrevYearFocus,
38
37
  onPrevMonthFocus,
39
38
  onNextMonthFocus,
40
- onNextYearFocus
39
+ onNextYearFocus,
40
+ isControllerOnly,
41
+ autoFocusPrevMonthArrow
41
42
  } = useContext(CalendarContext);
42
43
  return /*#__PURE__*/_jsx(StyledHeader, {}, void 0, /*#__PURE__*/_jsx(StyledHeaderButton, {
43
44
  "aria-label": "previous year",
44
- buttonType: "text",
45
- leftIcon: _ChevronDoubleLeft || (_ChevronDoubleLeft = /*#__PURE__*/_jsx(ChevronDoubleLeft, {
46
- height: 14,
47
- width: 14,
48
- fill: "#25292f"
49
- })),
50
- size: "m",
45
+ buttonType: "raw",
46
+ size: BUTTON_SIZES.M,
51
47
  onClick: handlePrevYear,
52
48
  innerRef: prevYearBtnRef,
53
49
  onKeyDown: handlePrevYearKeyDown,
54
- onFocus: onPrevYearFocus
55
- }), /*#__PURE__*/_jsx(StyledHeaderButton, {
50
+ onFocus: onPrevYearFocus,
51
+ tabIndex: isControllerOnly ? -1 : 1,
52
+ "data-testid": ControlledDateTimePickerDatatestid.CALENDAR.PREV_YEAR
53
+ }, void 0, _ChevronDoubleLeft || (_ChevronDoubleLeft = /*#__PURE__*/_jsx(ChevronDoubleLeft, {
54
+ height: 14,
55
+ width: 14,
56
+ fill: "#25292f"
57
+ }))), /*#__PURE__*/_jsx(StyledHeaderButton, {
58
+ autoFocus: autoFocusPrevMonthArrow,
56
59
  "aria-label": "previous month",
57
- buttonType: "text",
58
- leftIcon: _ChevronLeft || (_ChevronLeft = /*#__PURE__*/_jsx(ChevronLeft, {
59
- fill: "#25292f"
60
- })),
61
- size: "m",
60
+ buttonType: "raw",
61
+ size: BUTTON_SIZES.M,
62
62
  onClick: handlePrevMonth,
63
63
  innerRef: prevMonthBtnRef,
64
64
  onKeyDown: handlePrevMonthKeyDown,
65
- onFocus: onPrevMonthFocus // this is a tabstop for when the calendar is open
65
+ onFocus: onPrevMonthFocus,
66
+ "data-testid": ControlledDateTimePickerDatatestid.CALENDAR.PREV_MONTH // this is a tabstop for when the calendar is open
66
67
 
67
- }), /*#__PURE__*/_jsx("h3", {}, void 0, currentFormatedDate), /*#__PURE__*/_jsx(StyledHeaderButton, {
68
+ }, void 0, _ChevronLeft || (_ChevronLeft = /*#__PURE__*/_jsx(ChevronLeft, {
69
+ fill: "#25292f"
70
+ }))), /*#__PURE__*/_jsx("h3", {}, void 0, currentFormatedDate), /*#__PURE__*/_jsx(StyledHeaderButton, {
68
71
  "aria-label": "next month",
69
- buttonType: "text",
70
- leftIcon: _ChevronRight || (_ChevronRight = /*#__PURE__*/_jsx(ChevronRight, {
71
- fill: "#25292f"
72
- })),
73
- size: "m",
72
+ buttonType: "raw",
73
+ size: BUTTON_SIZES.M,
74
74
  onClick: handleNextMonth,
75
75
  innerRef: nextMonthBtnRef,
76
76
  onKeyDown: handleNextMonthKeyDown,
77
- onFocus: onNextMonthFocus
78
- }), /*#__PURE__*/_jsx(StyledHeaderButton, {
77
+ onFocus: onNextMonthFocus,
78
+ "data-testid": ControlledDateTimePickerDatatestid.CALENDAR.NEXT_MONTH
79
+ }, void 0, _ChevronRight || (_ChevronRight = /*#__PURE__*/_jsx(ChevronRight, {
80
+ fill: "#25292f"
81
+ }))), /*#__PURE__*/_jsx(StyledHeaderButton, {
79
82
  "aria-label": "next year",
80
- buttonType: "text",
81
- leftIcon: _ChevronDoubleRight || (_ChevronDoubleRight = /*#__PURE__*/_jsx(ChevronDoubleRight, {
82
- height: 14,
83
- width: 14,
84
- fill: "#25292f"
85
- })),
86
- size: "m",
83
+ buttonType: "raw",
84
+ size: BUTTON_SIZES.M,
87
85
  onClick: handleNextYear,
88
86
  innerRef: nextYearBtnRef,
89
87
  onKeyDown: handleNextYearKeyDown,
90
- onFocus: onNextYearFocus
91
- }));
88
+ onFocus: onNextYearFocus,
89
+ "data-testid": ControlledDateTimePickerDatatestid.CALENDAR.NEXT_YEAR
90
+ }, void 0, _ChevronDoubleRight || (_ChevronDoubleRight = /*#__PURE__*/_jsx(ChevronDoubleRight, {
91
+ height: 14,
92
+ width: 14,
93
+ fill: "#25292f"
94
+ }))));
92
95
  };
93
96
 
94
97
  export { CalendarHead };