@elliemae/ds-controlled-form 2.4.1-rc.4 → 2.4.1-rc.8

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 (339) hide show
  1. package/cjs/autocomplete/Autocomplete.js +4 -5
  2. package/cjs/autocomplete/AutocompleteCTX.js +3 -14
  3. package/cjs/autocomplete/AutocompleteDataTestids.js +1 -7
  4. package/cjs/autocomplete/config/useAutocomplete.js +23 -10
  5. package/cjs/autocomplete/parts/container/Container.js +36 -20
  6. package/cjs/autocomplete/parts/container/styled.js +1 -5
  7. package/cjs/autocomplete/parts/{controls → container}/useKeyboardNavigation.js +8 -24
  8. package/cjs/autocomplete/parts/menu-list/MenuList.js +17 -50
  9. package/cjs/autocomplete/parts/menu-list/styled.js +9 -10
  10. package/cjs/autocomplete/parts/menu-list/useItemRenderer.js +38 -44
  11. package/cjs/autocomplete/react-desc-prop-types.js +4 -8
  12. package/cjs/autocomplete/utils/listHelper.js +8 -16
  13. package/cjs/checkbox/react-desc-prop-types.js +1 -0
  14. package/cjs/combobox/ComboBox.js +1 -0
  15. package/cjs/combobox/config/useComboBox.js +8 -2
  16. package/cjs/combobox/config/useCorrectOptions.js +14 -42
  17. package/cjs/combobox/index.js +1 -0
  18. package/cjs/combobox/parts/A11yFocusedOption.js +3 -3
  19. package/cjs/combobox/parts/controls/Controls.js +4 -2
  20. package/cjs/combobox/parts/controls-input/ControlsInput.js +2 -0
  21. package/cjs/combobox/parts/controls-input/styled.js +1 -1
  22. package/cjs/combobox/parts/controls-input/useControlsInput.js +6 -6
  23. package/cjs/combobox/parts/controls-input/useKeyboardNavigation.js +30 -26
  24. package/cjs/combobox/parts/controls-input/useMaskedOnChange.js +7 -5
  25. package/cjs/combobox/parts/dropdown-indicator/DropdownIndicator.js +6 -4
  26. package/cjs/combobox/parts/header-list/useHeaderListHandlers.js +4 -4
  27. package/cjs/combobox/parts/menu-list/MenuList.js +13 -7
  28. package/cjs/combobox/parts/menu-list/styled.js +16 -5
  29. package/cjs/combobox/parts/menu-list/useItemRenderer.js +8 -8
  30. package/cjs/combobox/parts/menu-list/useMenuListSetFocusOption.js +6 -6
  31. package/cjs/combobox/react-desc-prop-types.js +2 -1
  32. package/cjs/combobox/utils/listHelper.js +40 -11
  33. package/cjs/date-time-picker/ControlledDateTimePickerCTX.js +1 -114
  34. package/cjs/date-time-picker/ControlledDateTimePickerDatatestid.js +0 -2
  35. package/cjs/date-time-picker/config/useChangeHandlers.js +264 -0
  36. package/cjs/date-time-picker/config/useControlledDateTimePicker.js +37 -420
  37. package/cjs/date-time-picker/config/useGetDestructuredValues.js +25 -68
  38. package/cjs/date-time-picker/config/useGetFlags.js +173 -0
  39. package/cjs/date-time-picker/config/useGetPropsBasedOnType.js +101 -0
  40. package/cjs/date-time-picker/config/useGetPropsWithDefault.js +2 -3
  41. package/cjs/date-time-picker/config/useGetReferences.js +86 -0
  42. package/cjs/date-time-picker/config/useGlobalKeyHandlers.js +106 -0
  43. package/cjs/date-time-picker/config/useRelevantValueFromProps.js +39 -0
  44. package/cjs/date-time-picker/config/useValidateProps.js +47 -42
  45. package/cjs/date-time-picker/parts/ClearButton/ClearButton.js +20 -8
  46. package/cjs/date-time-picker/parts/ControlledDateTimePickerContent.js +14 -12
  47. package/cjs/date-time-picker/parts/DateInputs/useDateInputs.js +5 -5
  48. package/cjs/date-time-picker/parts/Pickers/Calendar/Calendar.js +11 -13
  49. package/cjs/date-time-picker/parts/Pickers/Calendar/CalendarContent.js +4 -1
  50. package/cjs/date-time-picker/parts/Pickers/Calendar/CalendarContext.js +1 -49
  51. package/cjs/date-time-picker/parts/Pickers/Calendar/CalendarDaysList.js +4 -4
  52. package/cjs/date-time-picker/parts/Pickers/Calendar/CalendarHead.js +10 -7
  53. package/cjs/date-time-picker/parts/Pickers/Calendar/CalendarIconTrigger.js +8 -4
  54. package/cjs/date-time-picker/parts/Pickers/Calendar/CalendarMonthDays.js +5 -2
  55. package/cjs/date-time-picker/parts/Pickers/Calendar/CalendarWrapper.js +5 -2
  56. package/cjs/date-time-picker/parts/Pickers/Calendar/Day.js +18 -18
  57. package/cjs/date-time-picker/parts/Pickers/Calendar/useConfigCalendarCTX.js +24 -122
  58. package/cjs/date-time-picker/parts/Pickers/Calendar/useCurrentDisplayedMonthYearLogic.js +32 -4
  59. package/cjs/date-time-picker/parts/Pickers/Calendar/useFocusLogic.js +10 -6
  60. package/cjs/date-time-picker/parts/Pickers/Calendar/useKeyboardHandlers.js +30 -14
  61. package/cjs/date-time-picker/parts/Pickers/Calendar/usePopperTriggerLogic.js +7 -4
  62. package/cjs/date-time-picker/parts/Pickers/CalendarWithTimeWheel/CalendarWithTimeWheel.js +7 -3
  63. package/cjs/date-time-picker/parts/Pickers/CalendarWithTimeWheel/CalendarWithTimeWheelContext.js +1 -16
  64. package/cjs/date-time-picker/parts/Pickers/CalendarWithTimeWheel/CalendarWithTimeWheelIconTrigger.js +0 -1
  65. package/cjs/date-time-picker/parts/Pickers/CalendarWithTimeWheel/useConfigCalendarWithTimeWheelCTX.js +10 -10
  66. package/cjs/date-time-picker/parts/Pickers/TimeWheel/HoursList.js +18 -13
  67. package/cjs/date-time-picker/parts/Pickers/TimeWheel/MeridiemList.js +60 -33
  68. package/cjs/date-time-picker/parts/Pickers/TimeWheel/MinutesList.js +18 -13
  69. package/cjs/date-time-picker/parts/Pickers/TimeWheel/TimeWheel.js +11 -13
  70. package/cjs/date-time-picker/parts/Pickers/TimeWheel/TimeWheelContent.js +5 -2
  71. package/cjs/date-time-picker/parts/Pickers/TimeWheel/TimeWheelContext.js +1 -65
  72. package/cjs/date-time-picker/parts/Pickers/TimeWheel/TimeWheelIconTrigger.js +8 -3
  73. package/cjs/date-time-picker/parts/Pickers/TimeWheel/TimeWheelWrapper.js +5 -2
  74. package/cjs/date-time-picker/parts/Pickers/TimeWheel/useConfigTimePickerCTX.js +18 -116
  75. package/cjs/date-time-picker/parts/Pickers/TimeWheel/useCurrentDisplayedWheelsLogic.js +52 -94
  76. package/cjs/date-time-picker/parts/Pickers/TimeWheel/useKeyboardHandlers.js +4 -1
  77. package/cjs/date-time-picker/parts/Pickers/TimeWheel/usePopperTriggerLogic.js +1 -1
  78. package/cjs/date-time-picker/parts/TimeInputs/HHInput.js +1 -3
  79. package/cjs/date-time-picker/parts/TimeInputs/MeridiemInput.js +1 -1
  80. package/cjs/date-time-picker/parts/TimeInputs/TimeInputs.js +3 -7
  81. package/cjs/date-time-picker/parts/TimeInputs/useTimeInputs.js +3 -6
  82. package/cjs/date-time-picker/propTypes.js +56 -23
  83. package/cjs/{autocomplete/index.d.js → date-time-picker/sharedTypes.js} +0 -0
  84. package/cjs/date-time-picker/utils/dateHelpers.js +56 -56
  85. package/cjs/date-time-picker/utils/hooks/useGetMonthYearFromDateStringOrEmptyStartingMonth.js +2 -5
  86. package/cjs/date-time-picker/utils/hooks/useGetStartingFocusedDay.js +50 -47
  87. package/cjs/date-time-picker/utils/hooks/useOnClickOutside.js +1 -2
  88. package/cjs/date-time-picker/utils/stringHelpers.js +8 -14
  89. package/cjs/date-time-picker/utils/typeGuards.js +14 -0
  90. package/cjs/index.js +12 -3
  91. package/cjs/mask-hook/hooks/index.js +11 -3
  92. package/cjs/mask-hook/hooks/useNumberMask.js +7 -0
  93. package/cjs/mask-hook/hooks/usePhoneMask.js +7 -0
  94. package/cjs/mask-hook/hooks/useRegExpMask.js +122 -0
  95. package/cjs/mask-hook/hooks/useSSNMask.js +7 -0
  96. package/cjs/mask-hook/hooks/{useZipCode.js → useZipCodeMask.js} +12 -5
  97. package/cjs/mask-hook/index.js +11 -3
  98. package/cjs/mask-hook/react-desc-prop-types.js +9 -0
  99. package/cjs/mask-hook/utils/addSpecialCharacters.js +3 -4
  100. package/cjs/mask-hook/utils/flatStringArray.js +18 -0
  101. package/cjs/mask-hook/utils/index.js +2 -0
  102. package/esm/autocomplete/Autocomplete.js +2 -3
  103. package/esm/autocomplete/AutocompleteCTX.js +3 -14
  104. package/esm/autocomplete/AutocompleteDataTestids.js +1 -7
  105. package/esm/autocomplete/config/useAutocomplete.js +27 -14
  106. package/esm/autocomplete/parts/container/Container.js +38 -23
  107. package/esm/autocomplete/parts/container/styled.js +2 -5
  108. package/esm/autocomplete/parts/{controls → container}/useKeyboardNavigation.js +8 -24
  109. package/esm/autocomplete/parts/menu-list/MenuList.js +19 -52
  110. package/esm/autocomplete/parts/menu-list/styled.js +9 -10
  111. package/esm/autocomplete/parts/menu-list/useItemRenderer.js +39 -45
  112. package/esm/autocomplete/react-desc-prop-types.js +5 -8
  113. package/esm/autocomplete/utils/listHelper.js +8 -16
  114. package/esm/checkbox/react-desc-prop-types.js +1 -0
  115. package/esm/combobox/ComboBox.js +1 -1
  116. package/esm/combobox/config/useComboBox.js +8 -2
  117. package/esm/combobox/config/useCorrectOptions.js +15 -43
  118. package/esm/combobox/index.js +1 -1
  119. package/esm/combobox/parts/A11yFocusedOption.js +3 -3
  120. package/esm/combobox/parts/controls/Controls.js +4 -2
  121. package/esm/combobox/parts/controls-input/ControlsInput.js +2 -0
  122. package/esm/combobox/parts/controls-input/styled.js +1 -1
  123. package/esm/combobox/parts/controls-input/useControlsInput.js +6 -6
  124. package/esm/combobox/parts/controls-input/useKeyboardNavigation.js +30 -26
  125. package/esm/combobox/parts/controls-input/useMaskedOnChange.js +7 -5
  126. package/esm/combobox/parts/dropdown-indicator/DropdownIndicator.js +2 -2
  127. package/esm/combobox/parts/header-list/useHeaderListHandlers.js +4 -4
  128. package/esm/combobox/parts/menu-list/MenuList.js +13 -7
  129. package/esm/combobox/parts/menu-list/styled.js +16 -5
  130. package/esm/combobox/parts/menu-list/useItemRenderer.js +8 -8
  131. package/esm/combobox/parts/menu-list/useMenuListSetFocusOption.js +6 -6
  132. package/esm/combobox/react-desc-prop-types.js +2 -1
  133. package/esm/combobox/utils/listHelper.js +38 -12
  134. package/esm/date-time-picker/ControlledDateTimePickerCTX.js +3 -115
  135. package/esm/date-time-picker/ControlledDateTimePickerDatatestid.js +0 -2
  136. package/esm/date-time-picker/config/useChangeHandlers.js +256 -0
  137. package/esm/date-time-picker/config/useControlledDateTimePicker.js +38 -421
  138. package/esm/date-time-picker/config/useGetDestructuredValues.js +21 -68
  139. package/esm/date-time-picker/config/useGetFlags.js +165 -0
  140. package/esm/date-time-picker/config/useGetPropsBasedOnType.js +97 -0
  141. package/esm/date-time-picker/config/useGetPropsWithDefault.js +1 -2
  142. package/esm/date-time-picker/config/useGetReferences.js +82 -0
  143. package/esm/date-time-picker/config/useGlobalKeyHandlers.js +98 -0
  144. package/esm/date-time-picker/config/useRelevantValueFromProps.js +35 -0
  145. package/esm/date-time-picker/config/useValidateProps.js +47 -42
  146. package/esm/date-time-picker/parts/ClearButton/ClearButton.js +20 -9
  147. package/esm/date-time-picker/parts/ControlledDateTimePickerContent.js +14 -12
  148. package/esm/date-time-picker/parts/DateInputs/useDateInputs.js +5 -5
  149. package/esm/date-time-picker/parts/Pickers/Calendar/Calendar.js +11 -13
  150. package/esm/date-time-picker/parts/Pickers/Calendar/CalendarContent.js +4 -1
  151. package/esm/date-time-picker/parts/Pickers/Calendar/CalendarContext.js +2 -50
  152. package/esm/date-time-picker/parts/Pickers/Calendar/CalendarDaysList.js +4 -4
  153. package/esm/date-time-picker/parts/Pickers/Calendar/CalendarHead.js +10 -7
  154. package/esm/date-time-picker/parts/Pickers/Calendar/CalendarIconTrigger.js +9 -5
  155. package/esm/date-time-picker/parts/Pickers/Calendar/CalendarMonthDays.js +5 -2
  156. package/esm/date-time-picker/parts/Pickers/Calendar/CalendarWrapper.js +5 -2
  157. package/esm/date-time-picker/parts/Pickers/Calendar/Day.js +18 -18
  158. package/esm/date-time-picker/parts/Pickers/Calendar/useConfigCalendarCTX.js +23 -125
  159. package/esm/date-time-picker/parts/Pickers/Calendar/useCurrentDisplayedMonthYearLogic.js +33 -5
  160. package/esm/date-time-picker/parts/Pickers/Calendar/useFocusLogic.js +10 -6
  161. package/esm/date-time-picker/parts/Pickers/Calendar/useKeyboardHandlers.js +30 -14
  162. package/esm/date-time-picker/parts/Pickers/Calendar/usePopperTriggerLogic.js +7 -4
  163. package/esm/date-time-picker/parts/Pickers/CalendarWithTimeWheel/CalendarWithTimeWheel.js +9 -5
  164. package/esm/date-time-picker/parts/Pickers/CalendarWithTimeWheel/CalendarWithTimeWheelContext.js +1 -16
  165. package/esm/date-time-picker/parts/Pickers/CalendarWithTimeWheel/CalendarWithTimeWheelIconTrigger.js +1 -2
  166. package/esm/date-time-picker/parts/Pickers/CalendarWithTimeWheel/useConfigCalendarWithTimeWheelCTX.js +10 -10
  167. package/esm/date-time-picker/parts/Pickers/TimeWheel/HoursList.js +18 -13
  168. package/esm/date-time-picker/parts/Pickers/TimeWheel/MeridiemList.js +59 -33
  169. package/esm/date-time-picker/parts/Pickers/TimeWheel/MinutesList.js +18 -13
  170. package/esm/date-time-picker/parts/Pickers/TimeWheel/TimeWheel.js +11 -13
  171. package/esm/date-time-picker/parts/Pickers/TimeWheel/TimeWheelContent.js +5 -2
  172. package/esm/date-time-picker/parts/Pickers/TimeWheel/TimeWheelContext.js +2 -66
  173. package/esm/date-time-picker/parts/Pickers/TimeWheel/TimeWheelIconTrigger.js +8 -3
  174. package/esm/date-time-picker/parts/Pickers/TimeWheel/TimeWheelWrapper.js +5 -2
  175. package/esm/date-time-picker/parts/Pickers/TimeWheel/useConfigTimePickerCTX.js +15 -117
  176. package/esm/date-time-picker/parts/Pickers/TimeWheel/useCurrentDisplayedWheelsLogic.js +54 -96
  177. package/esm/date-time-picker/parts/Pickers/TimeWheel/useKeyboardHandlers.js +4 -1
  178. package/esm/date-time-picker/parts/Pickers/TimeWheel/usePopperTriggerLogic.js +1 -1
  179. package/esm/date-time-picker/parts/TimeInputs/HHInput.js +1 -3
  180. package/esm/date-time-picker/parts/TimeInputs/MeridiemInput.js +1 -1
  181. package/esm/date-time-picker/parts/TimeInputs/TimeInputs.js +3 -7
  182. package/esm/date-time-picker/parts/TimeInputs/useTimeInputs.js +3 -6
  183. package/esm/date-time-picker/propTypes.js +49 -17
  184. package/esm/{autocomplete/index.d.js → date-time-picker/sharedTypes.js} +0 -0
  185. package/esm/date-time-picker/utils/dateHelpers.js +57 -57
  186. package/esm/date-time-picker/utils/hooks/useGetMonthYearFromDateStringOrEmptyStartingMonth.js +2 -5
  187. package/esm/date-time-picker/utils/hooks/useGetStartingFocusedDay.js +46 -47
  188. package/esm/date-time-picker/utils/hooks/useOnClickOutside.js +1 -2
  189. package/esm/date-time-picker/utils/stringHelpers.js +8 -14
  190. package/esm/date-time-picker/utils/typeGuards.js +8 -0
  191. package/esm/index.js +6 -5
  192. package/esm/mask-hook/hooks/index.js +5 -4
  193. package/esm/mask-hook/hooks/useNumberMask.js +7 -1
  194. package/esm/mask-hook/hooks/usePhoneMask.js +7 -1
  195. package/esm/mask-hook/hooks/useRegExpMask.js +116 -0
  196. package/esm/mask-hook/hooks/useSSNMask.js +7 -1
  197. package/esm/mask-hook/hooks/{useZipCode.js → useZipCodeMask.js} +11 -5
  198. package/esm/mask-hook/index.js +5 -4
  199. package/esm/mask-hook/react-desc-prop-types.js +8 -1
  200. package/esm/mask-hook/utils/addSpecialCharacters.js +3 -4
  201. package/esm/mask-hook/utils/flatStringArray.js +14 -0
  202. package/esm/mask-hook/utils/index.js +1 -0
  203. package/package.json +64 -80
  204. package/types/autocomplete/Autocomplete.d.ts +4 -61
  205. package/types/autocomplete/AutocompleteCTX.d.ts +4 -3
  206. package/types/autocomplete/AutocompleteDataTestids.d.ts +1 -7
  207. package/types/autocomplete/config/useAutocomplete.d.ts +3 -2
  208. package/types/autocomplete/parts/container/Container.d.ts +1 -2
  209. package/types/autocomplete/parts/container/styled.d.ts +0 -1
  210. package/types/autocomplete/parts/{controls → container}/useKeyboardNavigation.d.ts +0 -0
  211. package/types/autocomplete/parts/menu-list/MenuList.d.ts +1 -2
  212. package/types/autocomplete/parts/menu-list/styled.d.ts +1 -4
  213. package/types/autocomplete/parts/menu-list/useItemRenderer.d.ts +2 -3
  214. package/types/autocomplete/react-desc-prop-types.d.ts +8 -18
  215. package/types/autocomplete/sharedTypes.d.ts +1 -3
  216. package/types/autocomplete/tests/general.test.d.ts +1 -0
  217. package/types/autocomplete/tests/utils.d.ts +5 -0
  218. package/types/autocomplete/utils/listHelper.d.ts +2 -2
  219. package/types/checkbox/ControlledCheckbox.d.ts +1 -1
  220. package/types/checkbox/react-desc-prop-types.d.ts +366 -1
  221. package/types/combobox/ComboBox.d.ts +2 -2
  222. package/types/combobox/parts/dropdown-indicator/DropdownIndicator.d.ts +1 -0
  223. package/types/combobox/react-desc-prop-types.d.ts +381 -3
  224. package/types/combobox/utils/listHelper.d.ts +4 -1
  225. package/types/date-time-picker/ControlledDateTimePicker.d.ts +25 -80
  226. package/types/date-time-picker/ControlledDateTimePickerCTX.d.ts +1 -2
  227. package/types/date-time-picker/ControlledDateTimePickerDatatestid.d.ts +46 -46
  228. package/types/date-time-picker/ControlledDateTimePickerTypes.d.ts +15 -15
  229. package/types/date-time-picker/config/useChangeHandlers.d.ts +25 -0
  230. package/types/date-time-picker/config/useControlledDateTimePicker.d.ts +18 -2
  231. package/types/date-time-picker/config/useGetDestructuredValues.d.ts +30 -4
  232. package/types/date-time-picker/config/useGetFlags.d.ts +27 -0
  233. package/types/date-time-picker/config/useGetPropsBasedOnType.d.ts +28 -0
  234. package/types/date-time-picker/config/useGetPropsWithDefault.d.ts +2 -2
  235. package/types/date-time-picker/config/useGetReferences.d.ts +39 -0
  236. package/types/date-time-picker/config/useGlobalKeyHandlers.d.ts +16 -0
  237. package/types/date-time-picker/config/useRelevantValueFromProps.d.ts +10 -0
  238. package/types/date-time-picker/config/useValidateProps.d.ts +2 -2
  239. package/types/date-time-picker/parts/ClearButton/useClearButton.d.ts +6 -6
  240. package/types/date-time-picker/parts/DateInputs/DDInput.d.ts +6 -6
  241. package/types/date-time-picker/parts/DateInputs/MMInput.d.ts +6 -6
  242. package/types/date-time-picker/parts/DateInputs/YYYYInput.d.ts +6 -6
  243. package/types/date-time-picker/parts/DateInputs/useDateInputs.d.ts +2 -2
  244. package/types/date-time-picker/parts/Pickers/Calendar/Calendar.d.ts +4 -2
  245. package/types/date-time-picker/parts/Pickers/Calendar/CalendarContext.d.ts +3 -63
  246. package/types/date-time-picker/parts/Pickers/Calendar/CalendarDaysList.d.ts +4 -4
  247. package/types/date-time-picker/parts/Pickers/Calendar/CalendarFooter.d.ts +2 -2
  248. package/types/date-time-picker/parts/Pickers/Calendar/Day.d.ts +2 -2
  249. package/types/date-time-picker/parts/Pickers/Calendar/useCurrentDisplayedMonthYearLogic.d.ts +15 -2
  250. package/types/date-time-picker/parts/Pickers/Calendar/useFocusLogic.d.ts +12 -5
  251. package/types/date-time-picker/parts/Pickers/Calendar/useKeyboardHandlers.d.ts +17 -11
  252. package/types/date-time-picker/parts/Pickers/CalendarWithTimeWheel/CalendarWithTimeWheelContext.d.ts +1 -16
  253. package/types/date-time-picker/parts/Pickers/CalendarWithTimeWheel/CalendarWithTimeWheelFooter.d.ts +2 -2
  254. package/types/date-time-picker/parts/Pickers/CalendarWithTimeWheel/useConfigCalendarWithTimeWheelCTX.d.ts +15 -1
  255. package/types/date-time-picker/parts/Pickers/TimeWheel/TimeWheel.d.ts +4 -2
  256. package/types/date-time-picker/parts/Pickers/TimeWheel/TimeWheelContext.d.ts +3 -62
  257. package/types/date-time-picker/parts/Pickers/TimeWheel/TimeWheelFooter.d.ts +2 -2
  258. package/types/date-time-picker/parts/Pickers/TimeWheel/useConfigTimePickerCTX.d.ts +4 -1
  259. package/types/date-time-picker/parts/Pickers/TimeWheel/useCurrentDisplayedWheelsLogic.d.ts +16 -5
  260. package/types/date-time-picker/parts/Pickers/TimeWheel/useKeyboardHandlers.d.ts +18 -3
  261. package/types/date-time-picker/parts/TimeInputs/HHInput.d.ts +6 -6
  262. package/types/date-time-picker/parts/TimeInputs/MeridiemInput.d.ts +6 -6
  263. package/types/date-time-picker/parts/TimeInputs/MinutesInput.d.ts +6 -6
  264. package/types/date-time-picker/parts/TimeInputs/useTimeInputs.d.ts +22 -2
  265. package/types/date-time-picker/parts/config.d.ts +3 -3
  266. package/types/date-time-picker/sharedTypes.d.ts +94 -0
  267. package/types/date-time-picker/utils/constants.d.ts +33 -33
  268. package/types/date-time-picker/utils/dateHelpers.d.ts +15 -14
  269. package/types/date-time-picker/utils/dateTimeHelpers.d.ts +3 -3
  270. package/types/date-time-picker/utils/hooks/useGetDayFromDateString.d.ts +1 -1
  271. package/types/date-time-picker/utils/hooks/useGetMonthYearFromDateStringOrEmptyStartingMonth.d.ts +2 -2
  272. package/types/date-time-picker/utils/hooks/useGetStartingFocusedDay.d.ts +6 -6
  273. package/types/date-time-picker/utils/hooks/useOnClickOutside.d.ts +1 -1
  274. package/types/date-time-picker/utils/timeHelpers.d.ts +2 -2
  275. package/types/date-time-picker/utils/typeGuards.d.ts +4 -0
  276. package/types/large-text-input/DSControlledLargeTextInput.d.ts +1 -1
  277. package/types/large-text-input/react-desc-prop-types.d.ts +422 -1
  278. package/types/mask-hook/hooks/index.d.ts +2 -1
  279. package/types/mask-hook/hooks/useNumberMask.d.ts +2 -1
  280. package/types/mask-hook/hooks/usePhoneMask.d.ts +2 -1
  281. package/types/mask-hook/hooks/useRegExpMask.d.ts +4 -0
  282. package/types/mask-hook/hooks/useSSNMask.d.ts +2 -1
  283. package/types/mask-hook/hooks/useZipCodeMask.d.ts +4 -0
  284. package/types/mask-hook/react-desc-prop-types.d.ts +6 -1
  285. package/types/mask-hook/tests/useRegExpMask.test.d.ts +1 -0
  286. package/types/mask-hook/utils/flatStringArray.d.ts +1 -0
  287. package/types/mask-hook/utils/index.d.ts +1 -0
  288. package/types/text-input/DSInputText.d.ts +1 -1
  289. package/types/text-input/config/useInputText.d.ts +110 -110
  290. package/cjs/autocomplete/config/constants.js +0 -14
  291. package/cjs/autocomplete/config/useGetPropsWithDefault.js +0 -11
  292. package/cjs/autocomplete/parts/a11y-messages/MultiAllyMessages.js +0 -33
  293. package/cjs/autocomplete/parts/a11y-messages/SingleAllyMessages.js +0 -28
  294. package/cjs/autocomplete/parts/a11y-messages/index.js +0 -11
  295. package/cjs/autocomplete/parts/a11y-messages/styled.js +0 -15
  296. package/cjs/autocomplete/parts/controls/Controls.js +0 -63
  297. package/cjs/autocomplete/parts/controls/index.js +0 -9
  298. package/cjs/autocomplete/parts/controls/styled.js +0 -44
  299. package/cjs/autocomplete/parts/controls/useControlsInput.js +0 -44
  300. package/cjs/autocomplete/parts/controls/useMaskedOnChange.js +0 -28
  301. package/cjs/autocomplete/parts/menu-list/useMenuList.js +0 -69
  302. package/cjs/autocomplete/propTypes.js +0 -25
  303. package/cjs/autocomplete/utils/hooks/useKeyboardNavigation.js +0 -97
  304. package/cjs/autocomplete/utils/hooks/useOnElementResize.js +0 -37
  305. package/esm/autocomplete/config/constants.js +0 -10
  306. package/esm/autocomplete/config/useGetPropsWithDefault.js +0 -7
  307. package/esm/autocomplete/parts/a11y-messages/MultiAllyMessages.js +0 -25
  308. package/esm/autocomplete/parts/a11y-messages/SingleAllyMessages.js +0 -20
  309. package/esm/autocomplete/parts/a11y-messages/index.js +0 -2
  310. package/esm/autocomplete/parts/a11y-messages/styled.js +0 -7
  311. package/esm/autocomplete/parts/controls/Controls.js +0 -55
  312. package/esm/autocomplete/parts/controls/index.js +0 -1
  313. package/esm/autocomplete/parts/controls/styled.js +0 -32
  314. package/esm/autocomplete/parts/controls/useControlsInput.js +0 -40
  315. package/esm/autocomplete/parts/controls/useMaskedOnChange.js +0 -24
  316. package/esm/autocomplete/parts/menu-list/useMenuList.js +0 -65
  317. package/esm/autocomplete/propTypes.js +0 -21
  318. package/esm/autocomplete/utils/hooks/useKeyboardNavigation.js +0 -93
  319. package/esm/autocomplete/utils/hooks/useOnElementResize.js +0 -33
  320. package/types/autocomplete/config/constants.d.ts +0 -8
  321. package/types/autocomplete/config/useGetPropsWithDefault.d.ts +0 -2
  322. package/types/autocomplete/parts/a11y-messages/MultiAllyMessages.d.ts +0 -3
  323. package/types/autocomplete/parts/a11y-messages/SingleAllyMessages.d.ts +0 -3
  324. package/types/autocomplete/parts/a11y-messages/index.d.ts +0 -2
  325. package/types/autocomplete/parts/a11y-messages/styled.d.ts +0 -1
  326. package/types/autocomplete/parts/controls/Controls.d.ts +0 -3
  327. package/types/autocomplete/parts/controls/index.d.ts +0 -1
  328. package/types/autocomplete/parts/controls/styled.d.ts +0 -8
  329. package/types/autocomplete/parts/controls/useControlsInput.d.ts +0 -9
  330. package/types/autocomplete/parts/controls/useMaskedOnChange.d.ts +0 -2
  331. package/types/autocomplete/parts/menu-list/useMenuList.d.ts +0 -2
  332. package/types/autocomplete/propTypes.d.ts +0 -51
  333. package/types/autocomplete/utils/hooks/useKeyboardNavigation.d.ts +0 -4
  334. package/types/autocomplete/utils/hooks/useOnElementResize.d.ts +0 -3
  335. package/types/date-time-picker/parts/Pickers/Calendar/useConfigCalendarCTX.d.ts +0 -2
  336. package/types/date-time-picker/parts/Pickers/Calendar/usePopperTriggerLogic.d.ts +0 -12
  337. package/types/date-time-picker/parts/Pickers/TimeWheel/usePopperTriggerLogic.d.ts +0 -2
  338. package/types/date-time-picker/propTypes.d.ts +0 -81
  339. package/types/mask-hook/hooks/useZipCode.d.ts +0 -3
@@ -9,7 +9,7 @@ const validSecondDigits = ['m', 'M'];
9
9
 
10
10
  const isInvalidMeridiem = meridiem => {
11
11
  if (meridiem === '') return false;
12
- const [firstDigit, secondDigit] = meridiem === null || meridiem === void 0 ? void 0 : meridiem.split('');
12
+ const [firstDigit, secondDigit] = meridiem.split('');
13
13
  const isValidFirstDigit = meridiem.length < 1 && !firstDigit || validFirstDigits.includes(firstDigit);
14
14
  const isValidSecondDigit = !secondDigit || validSecondDigits.includes(secondDigit);
15
15
  return meridiem.length > 2 || !isValidFirstDigit || !isValidSecondDigit;
@@ -12,30 +12,26 @@ import { StyledFocusWithIn, StyledColonSeparator, StyledSeparator } from '../Sty
12
12
  var _StyledColonSeparator, _StyledSeparator;
13
13
  const TimeInputs = () => {
14
14
  const {
15
- hours,
16
- minutes,
17
- // seconds,
18
- meridiem,
19
15
  autoFocusHourInput,
20
16
  disabled,
21
17
  onHoursChange,
22
18
  onMinutesChange,
23
- // onSecondsChange,
24
19
  onMeridiemChange,
25
20
  onHoursBlur,
26
21
  onMinutesBlur,
27
- // onSecondsBlur,
28
22
  onMeridiemBlur,
29
23
  onHoursFocus,
30
24
  onMeridiemFocus,
31
25
  onMinutesFocus,
32
26
  onHoursKeyDown,
33
27
  onMinutesKeyDown,
34
- // onSecondsKeyDown,
35
28
  onMeridiemKeyDown
36
29
  } = useTimeInputs(); // we do this here so HHInput,MinutesInput, MeridiemInput can be pure components memoized via React.memo
37
30
 
38
31
  const {
32
+ hours,
33
+ minutes,
34
+ meridiem,
39
35
  hourInputRef,
40
36
  minutesInputRef,
41
37
  meridiemInputRef,
@@ -7,7 +7,6 @@ import { prependStringWithPlaceHolders } from '../../utils/stringHelpers.js';
7
7
  const useTimeInputs = () => {
8
8
  const {
9
9
  props: {
10
- minutesInterval,
11
10
  disabled
12
11
  },
13
12
  lastSegmentRef,
@@ -30,7 +29,8 @@ const useTimeInputs = () => {
30
29
  handleChangeHours,
31
30
  handleChangeMinutes,
32
31
  handleChangeMeridiem,
33
- setLatestInteractionRegion
32
+ setLatestInteractionRegion,
33
+ minutesInterval
34
34
  } = useContext(ControlledDateTimePickerContext);
35
35
  const setLatestInteractionRegionTimeInputs = useCallback(() => {
36
36
  setLatestInteractionRegion('time-inputs');
@@ -225,9 +225,6 @@ const useTimeInputs = () => {
225
225
  });
226
226
  }, [handleChangeMeridiem]);
227
227
  return useMemo(() => ({
228
- hours,
229
- minutes,
230
- meridiem,
231
228
  autoFocusHourInput,
232
229
  disabled,
233
230
  handleChangeHours,
@@ -245,7 +242,7 @@ const useTimeInputs = () => {
245
242
  onHoursKeyDown,
246
243
  onMinutesKeyDown,
247
244
  onMeridiemKeyDown
248
- }), [hours, minutes, meridiem, autoFocusHourInput, disabled, handleChangeHours, onHoursFocus, onHoursChange, handleChangeMinutes, onMinutesFocus, onMinutesChange, handleChangeMeridiem, onMeridiemFocus, onMeridiemChange, onHoursBlur, onMinutesBlur, onMeridiemBlur, onHoursKeyDown, onMinutesKeyDown, onMeridiemKeyDown]);
245
+ }), [autoFocusHourInput, disabled, handleChangeHours, onHoursFocus, onHoursChange, handleChangeMinutes, onMinutesFocus, onMinutesChange, handleChangeMeridiem, onMeridiemFocus, onMeridiemChange, onHoursBlur, onMinutesBlur, onMeridiemBlur, onHoursKeyDown, onMinutesKeyDown, onMeridiemKeyDown]);
249
246
  };
250
247
 
251
248
  export { useTimeInputs };
@@ -1,28 +1,60 @@
1
- import { PropTypes } from 'react-desc';
1
+ import { PropTypes } from '@elliemae/ds-props-helpers';
2
2
 
3
+ /* eslint-disable max-lines */
4
+
5
+ const noop = () => {};
6
+
7
+ const defaultReturnFalse = () => false;
8
+
9
+ const defaultProps = {
10
+ type: 'full-date-time',
11
+ onDateChange: noop,
12
+ onMonthChange: noop,
13
+ onDayChange: noop,
14
+ onYearChange: noop,
15
+ onTimeChange: noop,
16
+ onHourChange: noop,
17
+ onMinuteChange: noop,
18
+ onMeridiemChange: noop,
19
+ onPickerOpen: noop,
20
+ onPickerClose: noop,
21
+ getIsDisabledDay: defaultReturnFalse,
22
+ getIsOutOfRangeDay: defaultReturnFalse,
23
+ getIsStartRangeDay: defaultReturnFalse,
24
+ getIsDayInRange: defaultReturnFalse,
25
+ getIsEndRangeDay: defaultReturnFalse,
26
+ getIsDisabledTime: defaultReturnFalse,
27
+ minutesInterval: 1,
28
+ isClearable: false,
29
+ disabled: false,
30
+ hasError: false,
31
+ autoFocus: false,
32
+ preventCloseOnSelection: false
33
+ };
3
34
  const propTypes = {
4
35
  type: PropTypes.oneOf(['full-date-time', 'date-time-inputs', 'date-time-picker', 'date-time-picker-controller-only', 'full-date', 'date-inputs', 'date-picker', 'date-picker-controller-only', 'full-time', 'time-inputs', 'time-picker', 'time-picker-controller-only']).description('Type of time form control to use').defaultValue('full-date-time'),
5
- disabled: PropTypes.bool.description('wheter or not the input is disabled').defaultValue('false'),
6
- isClearable: PropTypes.bool.description('with or without clearable button').defaultValue('false'),
36
+ disabled: PropTypes.bool.description('wheter or not the input is disabled').defaultValue(false),
37
+ isClearable: PropTypes.bool.description('with or without clearable button').defaultValue(false),
7
38
  dateTime: PropTypes.string.description('when using date-time types, this is the value of the controller'),
8
39
  date: PropTypes.string.description('when using date types, this is the value of the controller'),
9
40
  time: PropTypes.string.description('when using time types, this is the value of the controller'),
10
- onDateChange: PropTypes.func.description('(newDateString, metaInformations) => void').defaultValue(''),
11
- onTimeChange: PropTypes.func.description('(newTimeString, metaInformations) => void').defaultValue(''),
12
- onDateTimeChange: PropTypes.func.description('(newDateTimeString, metaInformations) => void').defaultValue(''),
13
- onMonthChange: PropTypes.func.description('(newMonthString, event, metaInformations) => void').defaultValue(''),
14
- onDayChange: PropTypes.func.description('(newDayString, event, metaInformations) => void').defaultValue(''),
15
- onYearChange: PropTypes.func.description('(newYearString, event, metaInformations) => void').defaultValue(''),
16
- onHourChange: PropTypes.func.description('(newHourString, event, metaInformations) => void').defaultValue(''),
17
- onMinuteChange: PropTypes.func.description('(newMinuteString, event, metaInformations) => void').defaultValue(''),
18
- onMeridiemChange: PropTypes.func.description('(newMeridiemString, event, metaInformations) => void').defaultValue(''),
19
- getIsDisabledDay: PropTypes.func.description('(dayAsString) => true for marking as disabled, false for marking as valid').defaultValue(''),
20
- getIsOutOfRangeDay: PropTypes.func.description('(dayAsString) => true for marking as disabled, false for marking as valid').defaultValue(''),
21
- getIsDisabledTime: PropTypes.func.description('(timeAsString) => true for marking as disabled, false for marking as valid').defaultValue(''),
41
+ onDateChange: PropTypes.func.description('(newDateString, metaInformations) => void'),
42
+ onTimeChange: PropTypes.func.description('(newTimeString, metaInformations) => void'),
43
+ onDateTimeChange: PropTypes.func.description('(newDateTimeString, metaInformations) => void'),
44
+ onMonthChange: PropTypes.func.description('(newMonthString, event, metaInformations) => void'),
45
+ onDayChange: PropTypes.func.description('(newDayString, event, metaInformations) => void'),
46
+ onYearChange: PropTypes.func.description('(newYearString, event, metaInformations) => void'),
47
+ onHourChange: PropTypes.func.description('(newHourString, event, metaInformations) => void'),
48
+ onMinuteChange: PropTypes.func.description('(newMinuteString, event, metaInformations) => void'),
49
+ onMeridiemChange: PropTypes.func.description('(newMeridiemString, event, metaInformations) => void'),
50
+ getIsDisabledDay: PropTypes.func.description('(dayAsString) => true for marking as disabled, false for marking as valid'),
51
+ getIsOutOfRangeDay: PropTypes.func.description('(dayAsString) => true for marking as disabled, false for marking as valid'),
52
+ getIsDisabledTime: PropTypes.func.description('(timeAsString) => true for marking as disabled, false for marking as valid'),
22
53
  emptyPickerStartingMonth: PropTypes.string.description('which month to start the calendar on open, when value is empty, string following the "MM/__/YYYY" pattern'),
23
- onCalendarOpenFocusedDay: PropTypes.string.description('which day to focus on calendar open when value is empty, string following the "MM/DD/YYYY" pattern').defaultValue('if value is empty current month, else month corresponding the month'),
54
+ onCalendarOpenFocusedDay: PropTypes.string.description('which day to focus on calendar open when value is empty, string following the "MM/DD/YYYY" pattern').defaultValue('if value is empty current month, else current month'),
55
+ onTimeWheelOpenStartingTime: PropTypes.string.description('which day to start the timewheel on picker open when value is empty, string following the HH:MM AA" pattern').defaultValue('01:00 AM'),
24
56
  minutesInterval: PropTypes.number.description('increments/decrements of minutes in time related controllers interactions').defaultValue('1'),
25
57
  'data-testid': PropTypes.string.description('Unique id for tests.').defaultValue('')
26
58
  };
27
59
 
28
- export { propTypes };
60
+ export { defaultProps, propTypes };
@@ -3,15 +3,71 @@ import 'core-js/modules/esnext.iterator.map.js';
3
3
  import 'core-js/modules/web.dom-collections.iterator.js';
4
4
  import { createRef } from 'react';
5
5
  import { monthNames } from './constants.js';
6
- import { isIncompleteString, deconstructValuesFromDateString, prependStringWithPlaceHolders } from './stringHelpers.js';
6
+ import { prependStringWithPlaceHolders, deconstructValuesFromDateString, isIncompleteString } from './stringHelpers.js';
7
7
  import { convertToPositiveNumberIfPossible } from './numberHelpers.js';
8
8
 
9
+ const getDateValuesFromDate = day => {
10
+ var _day$getMonth, _day$getDate, _day$getFullYear;
11
+
12
+ return {
13
+ month: day === null || day === void 0 ? void 0 : (_day$getMonth = day.getMonth) === null || _day$getMonth === void 0 ? void 0 : _day$getMonth.call(day),
14
+ day: day === null || day === void 0 ? void 0 : (_day$getDate = day.getDate) === null || _day$getDate === void 0 ? void 0 : _day$getDate.call(day),
15
+ year: day === null || day === void 0 ? void 0 : (_day$getFullYear = day.getFullYear) === null || _day$getFullYear === void 0 ? void 0 : _day$getFullYear.call(day)
16
+ };
17
+ };
18
+ const getDateStringFromDay = day => {
19
+ const monthFromDay = prependStringWithPlaceHolders("".concat(day.getMonth() + 1), 2); // months from 1-12
20
+
21
+ const dayFromDay = prependStringWithPlaceHolders("".concat(day.getDate()), 2);
22
+ const yearFromDay = prependStringWithPlaceHolders("".concat(day.getFullYear()), 4);
23
+ return "".concat(monthFromDay, "/").concat(dayFromDay, "/").concat(yearFromDay);
24
+ };
25
+ const getTimeStringFromDay = day => {
26
+ const hoursNum = day.getHours();
27
+ const meridiem = hoursNum > 12 ? 'PM' : 'AM';
28
+ const twelveHourFormat = hoursNum > 12 ? hoursNum - 12 : hoursNum;
29
+ const minutesNum = day.getMinutes();
30
+ const hoursFromDay = prependStringWithPlaceHolders("".concat(twelveHourFormat), 2);
31
+ const minutesFromDay = prependStringWithPlaceHolders("".concat(minutesNum), 2);
32
+ return "".concat(hoursFromDay, ":").concat(minutesFromDay, " ").concat(meridiem);
33
+ };
34
+ const getMonthNameByMonthNumber = monthNumber => monthNames[monthNumber];
35
+ const isSameDateMoment = (dateA, dateB) => {
36
+ var _dateA$getTime, _dateB$getTime;
37
+
38
+ return (dateA === null || dateA === void 0 ? void 0 : (_dateA$getTime = dateA.getTime) === null || _dateA$getTime === void 0 ? void 0 : _dateA$getTime.call(dateA)) === (dateB === null || dateB === void 0 ? void 0 : (_dateB$getTime = dateB.getTime) === null || _dateB$getTime === void 0 ? void 0 : _dateB$getTime.call(dateB));
39
+ };
40
+ const compareTwoDatesDayEquality = (dayA, dayB) => {
41
+ const {
42
+ day: currD,
43
+ month: currM,
44
+ year: currY
45
+ } = getDateValuesFromDate(dayA);
46
+ const {
47
+ day: focusD,
48
+ month: focusM,
49
+ year: focusY
50
+ } = getDateValuesFromDate(dayB);
51
+ return currD === focusD && currM === focusM && currY === focusY;
52
+ };
9
53
  const getLastDayOfMonth = (month, year) => new Date(year, month + 1, 0);
10
54
  const isValidDayForTheMonth = (month, year, day) => {
11
55
  var _Date, _Date$getMonth;
12
56
 
13
57
  return ((_Date = new Date(year, month, day)) === null || _Date === void 0 ? void 0 : (_Date$getMonth = _Date.getMonth) === null || _Date$getMonth === void 0 ? void 0 : _Date$getMonth.call(_Date)) === month;
14
58
  };
59
+ const getDayFromDateString = dateString => {
60
+ const {
61
+ month,
62
+ day,
63
+ year
64
+ } = deconstructValuesFromDateString(dateString);
65
+ const monthNum = convertToPositiveNumberIfPossible(month);
66
+ const dayNum = convertToPositiveNumberIfPossible(day);
67
+ const yearNum = convertToPositiveNumberIfPossible(year);
68
+ if (monthNum !== -1 && dayNum !== -1 && yearNum !== -1 && isValidDayForTheMonth(monthNum - 1, yearNum, dayNum)) return new Date(yearNum, monthNum - 1, dayNum);
69
+ return null;
70
+ };
15
71
  const isValidDayForTheMonthDateString = dateString => {
16
72
  var _getDayFromDateString, _getDayFromDateString2;
17
73
 
@@ -182,61 +238,5 @@ const getFiveBySevenCurrentMonthDaysMatrix = (month, year) => {
182
238
  }));
183
239
  return [...previousMonthDaysToPrepend, ...currentMonthDays, ...nextMonthDaysToAppend];
184
240
  };
185
- const getDateValuesFromDate = day => {
186
- var _day$getMonth, _day$getDate, _day$getFullYear;
187
-
188
- return {
189
- month: day === null || day === void 0 ? void 0 : (_day$getMonth = day.getMonth) === null || _day$getMonth === void 0 ? void 0 : _day$getMonth.call(day),
190
- day: day === null || day === void 0 ? void 0 : (_day$getDate = day.getDate) === null || _day$getDate === void 0 ? void 0 : _day$getDate.call(day),
191
- year: day === null || day === void 0 ? void 0 : (_day$getFullYear = day.getFullYear) === null || _day$getFullYear === void 0 ? void 0 : _day$getFullYear.call(day)
192
- };
193
- };
194
- const getDateStringFromDay = day => {
195
- const monthFromDay = prependStringWithPlaceHolders("".concat(day.getMonth() + 1), 2); // months from 1-12
196
-
197
- const dayFromDay = prependStringWithPlaceHolders("".concat(day.getDate()), 2);
198
- const yearFromDay = prependStringWithPlaceHolders("".concat(day.getFullYear()), 4);
199
- return "".concat(monthFromDay, "/").concat(dayFromDay, "/").concat(yearFromDay);
200
- };
201
- const getTimeStringFromDay = day => {
202
- const hoursNum = day.getHours();
203
- const meridiem = hoursNum > 12 ? 'PM' : 'AM';
204
- const twelveHourFormat = hoursNum > 12 ? hoursNum - 12 : hoursNum;
205
- const minutesNum = day.getMinutes();
206
- const hoursFromDay = prependStringWithPlaceHolders("".concat(twelveHourFormat), 2);
207
- const minutesFromDay = prependStringWithPlaceHolders("".concat(minutesNum), 2);
208
- return "".concat(hoursFromDay, ":").concat(minutesFromDay, " ").concat(meridiem);
209
- };
210
- const getDayFromDateString = dateString => {
211
- const {
212
- month,
213
- day,
214
- year
215
- } = deconstructValuesFromDateString(dateString);
216
- const monthNum = convertToPositiveNumberIfPossible(month);
217
- const dayNum = convertToPositiveNumberIfPossible(day);
218
- const yearNum = convertToPositiveNumberIfPossible(year);
219
- if (monthNum !== -1 && dayNum !== -1 && yearNum !== -1 && isValidDayForTheMonth(monthNum - 1, yearNum, dayNum)) return new Date(yearNum, monthNum - 1, dayNum);
220
- return null;
221
- };
222
- const getMonthNameByMonthNumber = monthNumber => monthNames[monthNumber];
223
- const isSameDateMoment = (dateA, dateB) => {
224
- var _dateA$getTime, _dateB$getTime;
225
-
226
- return (dateA === null || dateA === void 0 ? void 0 : (_dateA$getTime = dateA.getTime) === null || _dateA$getTime === void 0 ? void 0 : _dateA$getTime.call(dateA)) === (dateB === null || dateB === void 0 ? void 0 : (_dateB$getTime = dateB.getTime) === null || _dateB$getTime === void 0 ? void 0 : _dateB$getTime.call(dateB));
227
- };
228
- const compareTwoDatesDayEquality = (dayA, dayB) => {
229
- const {
230
- day: currD,
231
- month: currM,
232
- year: currY
233
- } = getDateValuesFromDate(dayA);
234
- const {
235
- day: focusD,
236
- month: focusM,
237
- year: focusY
238
- } = getDateValuesFromDate(dayB);
239
- return currD === focusD && currM === focusM && currY === focusY;
240
- };
241
241
 
242
242
  export { compareTwoDatesDayEquality, dateAddMonths, dateAddYear, dateGetDaysInMonth, dateIsLeapYear, getDateStringFromDay, getDateValuesFromDate, getDayFromDateString, getDaysInMonth, getFirstXDaysFromNextMonth, getFiveBySevenCurrentMonthDaysMatrix, getHowManyDaysInMonth, getLastDayOfMonth, getLastXDaysFromPreviousMonth, getMonthNameByMonthNumber, getTimeStringFromDay, getValidationDateStringMetaInfo, isLeapYear, isSameDateMoment, isValidDayForTheMonth, isValidDayForTheMonthDateString, subtractMonths, subtractYears, sumFromDateValues, sumMonths, sumValuesToDate, sumYears };
@@ -5,12 +5,9 @@ import { deconstructValuesFromDateString } from '../stringHelpers.js';
5
5
  const useGetMonthYearFromDateStringOrEmptyStartingMonth = () => {
6
6
  const {
7
7
  dateStringFromProps,
8
- props: {
9
- emptyPickerStartingMonth
10
- }
8
+ emptyPickerStartingMonth
11
9
  } = useContext(ControlledDateTimePickerContext);
12
10
  return useMemo(() => {
13
- const emptyPickerStartingMonthDefault = "".concat(new Date().getMonth() + 1, "/__/").concat(new Date().getFullYear());
14
11
  const {
15
12
  month: stringMonthVal,
16
13
  year: stringYearVal
@@ -18,7 +15,7 @@ const useGetMonthYearFromDateStringOrEmptyStartingMonth = () => {
18
15
  const {
19
16
  month: emptyStringSplitMonth,
20
17
  year: emptyStringSplitYear
21
- } = deconstructValuesFromDateString(emptyPickerStartingMonth || emptyPickerStartingMonthDefault);
18
+ } = deconstructValuesFromDateString(emptyPickerStartingMonth);
22
19
  const userEmptyStringMonth = Number.parseInt(emptyStringSplitMonth, 10);
23
20
  const userEmptyStringYear = Number.parseInt(emptyStringSplitYear, 10);
24
21
  const month = stringMonthVal === '' || stringMonthVal.length !== 2 ? userEmptyStringMonth - 1 : Number.parseInt(stringMonthVal, 10) - 1; // month is 0~11 in javascript Date...
@@ -1,3 +1,9 @@
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';
6
+ import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
1
7
  import { useContext, useMemo } from 'react';
2
8
  import { ControlledDateTimePickerContext } from '../../ControlledDateTimePickerCTX.js';
3
9
  import { deconstructValuesFromDateString } from '../stringHelpers.js';
@@ -5,7 +11,9 @@ import { convertToPositiveNumberIfPossible } from '../numberHelpers.js';
5
11
  import { getDateValuesFromDate, isValidDayForTheMonth } from '../dateHelpers.js';
6
12
  import { useGetDayFromDateString } from './useGetDayFromDateString.js';
7
13
 
8
- /* eslint-disable max-statements */
14
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
15
+
16
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
9
17
  const empty = {
10
18
  startFocusedYear: null,
11
19
  startFocusedDay: null,
@@ -14,61 +22,52 @@ const empty = {
14
22
  };
15
23
  const useGetStartingFocusedDay = () => {
16
24
  const {
17
- props: {
18
- onCalendarOpenFocusedDay
19
- }
25
+ onCalendarOpenFocusedDay
20
26
  } = useContext(ControlledDateTimePickerContext);
21
27
  const dayFromInputValues = useGetDayFromDateString();
22
28
  return useMemo(() => {
23
- const {
24
- month: inputValuesSplitMonth,
25
- day: inputValuesSplitDay,
26
- year: inputValuesDaySplitYear
27
- } = getDateValuesFromDate(dayFromInputValues);
28
- let startFocusedMonth = null;
29
- let startFocusedDay = null;
30
- let startFocusedYear = null;
31
- let startFocusedDate = null;
32
- const isInputFilledAndValid = inputValuesSplitMonth && inputValuesSplitDay && inputValuesDaySplitYear && isValidDayForTheMonth(inputValuesSplitMonth, inputValuesDaySplitYear, inputValuesSplitDay);
33
- const isOnCalendarOpenFocusedDayEmpty = !onCalendarOpenFocusedDay;
34
- const shouldFillWithOnCalendarOpenFocusedDay = !isInputFilledAndValid && !isOnCalendarOpenFocusedDayEmpty; // if input was filled start focus is the filled value (if it's valid day for the month)
35
-
36
- if (isInputFilledAndValid) {
37
- startFocusedMonth = inputValuesSplitMonth;
38
- startFocusedDay = inputValuesSplitDay;
39
- startFocusedYear = inputValuesDaySplitYear;
40
- startFocusedDate = dayFromInputValues; // if input was not filled (or filled invalid) and there is no onCalendarOpenFocusedDay start focus is not a day
41
- } // if input was not filled and there is onCalendarOpenFocusedDay start focus is onCalendarOpenFocusedDay day
29
+ const startingDay = _objectSpread({}, empty);
42
30
 
43
-
44
- if (!isInputFilledAndValid && isOnCalendarOpenFocusedDayEmpty) return empty;
45
-
46
- if (shouldFillWithOnCalendarOpenFocusedDay) {
31
+ if (dayFromInputValues) {
47
32
  const {
48
- month: focusedDaySplitMonth,
49
- day: focusedDaySplitDay,
50
- year: focusedDaySplitYear
51
- } = deconstructValuesFromDateString(onCalendarOpenFocusedDay);
52
- const monthAsInt = convertToPositiveNumberIfPossible(focusedDaySplitMonth);
53
- const dayAsInt = convertToPositiveNumberIfPossible(focusedDaySplitDay);
54
- const yearAsInt = convertToPositiveNumberIfPossible(focusedDaySplitYear); // if this condition is false, return will be the same as return empty
55
- // because startFocusedMonth/Day/Year/Date will be === null
56
- // which is the expected result
33
+ month: inputValuesSplitMonth,
34
+ day: inputValuesSplitDay,
35
+ year: inputValuesDaySplitYear
36
+ } = getDateValuesFromDate(dayFromInputValues);
37
+ const isInputFilledAndValid = inputValuesSplitMonth && inputValuesSplitDay && inputValuesDaySplitYear && isValidDayForTheMonth(inputValuesSplitMonth, inputValuesDaySplitYear, inputValuesSplitDay);
38
+ const isOnCalendarOpenFocusedDayEmpty = !onCalendarOpenFocusedDay;
39
+ const shouldFillWithOnCalendarOpenFocusedDay = !isInputFilledAndValid && !isOnCalendarOpenFocusedDayEmpty; // if input was filled start focus is the filled value (if it's valid day for the month)
40
+
41
+ if (isInputFilledAndValid) {
42
+ startingDay.startFocusedMonth = inputValuesSplitMonth;
43
+ startingDay.startFocusedDay = inputValuesSplitDay;
44
+ startingDay.startFocusedYear = inputValuesDaySplitYear;
45
+ startingDay.startFocusedDate = dayFromInputValues; // if input was not filled (or filled invalid) and there is no onCalendarOpenFocusedDay start focus is not a day
46
+ } else if (isOnCalendarOpenFocusedDayEmpty) {
47
+ // if input was not filled and there is onCalendarOpenFocusedDay start focus is onCalendarOpenFocusedDay day
48
+ return empty;
49
+ } else if (shouldFillWithOnCalendarOpenFocusedDay) {
50
+ const {
51
+ month: focusedDaySplitMonth,
52
+ day: focusedDaySplitDay,
53
+ year: focusedDaySplitYear
54
+ } = deconstructValuesFromDateString(onCalendarOpenFocusedDay);
55
+ const monthAsInt = convertToPositiveNumberIfPossible(focusedDaySplitMonth);
56
+ const dayAsInt = convertToPositiveNumberIfPossible(focusedDaySplitDay);
57
+ const yearAsInt = convertToPositiveNumberIfPossible(focusedDaySplitYear); // if this condition is false, return will be the same as return empty
58
+ // because startFocusedMonth/Day/Year/Date will be === null
59
+ // which is the expected result
57
60
 
58
- if (monthAsInt !== -1 && dayAsInt !== -1 && yearAsInt !== -1 && isValidDayForTheMonth(monthAsInt - 1, yearAsInt, dayAsInt)) {
59
- startFocusedMonth = monthAsInt;
60
- startFocusedDay = dayAsInt;
61
- startFocusedYear = yearAsInt;
62
- startFocusedDate = new Date(yearAsInt, monthAsInt - 1, dayAsInt);
61
+ if (monthAsInt !== -1 && dayAsInt !== -1 && yearAsInt !== -1 && isValidDayForTheMonth(monthAsInt - 1, yearAsInt, dayAsInt)) {
62
+ startingDay.startFocusedMonth = monthAsInt;
63
+ startingDay.startFocusedDay = dayAsInt;
64
+ startingDay.startFocusedYear = yearAsInt;
65
+ startingDay.startFocusedDate = new Date(yearAsInt, monthAsInt - 1, dayAsInt);
66
+ }
63
67
  }
64
68
  }
65
69
 
66
- return {
67
- startFocusedYear,
68
- startFocusedDay,
69
- startFocusedMonth,
70
- startFocusedDate
71
- };
70
+ return startingDay;
72
71
  }, [dayFromInputValues, onCalendarOpenFocusedDay]);
73
72
  };
74
73
 
@@ -6,10 +6,9 @@ const useOnClickOutside = (ref, handler) => {
6
6
  var _ref$contains;
7
7
 
8
8
  // Do nothing if clicking ref's element or descendent elements
9
- if (!ref || ref !== null && ref !== void 0 && (_ref$contains = ref.contains) !== null && _ref$contains !== void 0 && _ref$contains.call(ref, event.target)) {
9
+ if (event.target instanceof Element) if (!ref || ref !== null && ref !== void 0 && (_ref$contains = ref.contains) !== null && _ref$contains !== void 0 && _ref$contains.call(ref, event.target)) {
10
10
  return;
11
11
  }
12
-
13
12
  handler(event);
14
13
  };
15
14
 
@@ -6,7 +6,6 @@ import { monthNames, announcableCardinalDays } from './constants.js';
6
6
  import { convertToPositiveNumberIfPossible } from './numberHelpers.js';
7
7
 
8
8
  /* eslint-disable max-lines */
9
-
10
9
  const prependStringWithPlaceHolders = function (val, finalLength) {
11
10
  let placeholder = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '0';
12
11
  if (val.length === finalLength) return val;
@@ -36,7 +35,7 @@ const dateTimeToDate = dateTime => {
36
35
  return dateTime === null || dateTime === void 0 ? void 0 : (_dateTime$split = dateTime.split) === null || _dateTime$split === void 0 ? void 0 : (_dateTime$split$call = _dateTime$split.call(dateTime, ' ')) === null || _dateTime$split$call === void 0 ? void 0 : _dateTime$split$call[0];
37
36
  };
38
37
  const deconstructValuesFromDateString = dateString => {
39
- const [dirtyMonth = '', dirtyDay = '', dirtyYear = ''] = dateString === null || dateString === void 0 ? void 0 : dateString.split('/');
38
+ const [dirtyMonth = '', dirtyDay = '', dirtyYear = ''] = dateString.split('/');
40
39
  const replaceAllRegexp = /_/g;
41
40
  return {
42
41
  month: (dirtyMonth || '').replace(replaceAllRegexp, ''),
@@ -45,8 +44,8 @@ const deconstructValuesFromDateString = dateString => {
45
44
  };
46
45
  };
47
46
  const deconstructValuesFromTimeString = timeString => {
48
- const [dirtyHour = '', dirtyMintuesAndMeridiem = ''] = timeString === null || timeString === void 0 ? void 0 : timeString.split(':');
49
- const [dirtyMinutes = '', dirtyMeridiem = ''] = dirtyMintuesAndMeridiem === null || dirtyMintuesAndMeridiem === void 0 ? void 0 : dirtyMintuesAndMeridiem.split(' ');
47
+ const [dirtyHour = '', dirtyMintuesAndMeridiem = ''] = timeString.split(':');
48
+ const [dirtyMinutes = '', dirtyMeridiem = ''] = dirtyMintuesAndMeridiem.split(' ');
50
49
  const replaceAllRegexp = /_/g;
51
50
  return {
52
51
  hours: (dirtyHour || '').replace(replaceAllRegexp, ''),
@@ -83,26 +82,21 @@ const getFormattedTimeString = _ref2 => {
83
82
  return "".concat(finalHour, ":").concat(finalMinutes, " ").concat(finalMeridiem);
84
83
  };
85
84
  const dateTimeToTime = dateTime => {
86
- var _dateTime$split2;
87
-
88
- const [// eslint-disable-next-line @typescript-eslint/no-unused-vars
89
- _date, // timeNumbers = '__:__:__', // <-- seconds format
90
- timeNumbers = '__:__', timeMeridiem = '__'] = dateTime === null || dateTime === void 0 ? void 0 : (_dateTime$split2 = dateTime.split) === null || _dateTime$split2 === void 0 ? void 0 : _dateTime$split2.call(dateTime, ' ');
85
+ const [// eslint-disable-next-line @typescript-eslint/no-unused-vars, no-unused-vars
86
+ date, // timeNumbers = '__:__:__', // <-- seconds format
87
+ timeNumbers = '__:__', timeMeridiem = '__'] = dateTime.split(' ');
91
88
  return "".concat(timeNumbers, " ").concat(timeMeridiem);
92
89
  };
93
90
  const deconstructTimeValues = timeString => {
94
- var _timeString$split, _dirtyTimes$split;
95
-
96
- const [dirtyTimes, dirtyMeridiem] = timeString === null || timeString === void 0 ? void 0 : (_timeString$split = timeString.split) === null || _timeString$split === void 0 ? void 0 : _timeString$split.call(timeString, ' '); // <--['__:__','__']
91
+ const [dirtyTimes = '', dirtyMeridiem] = timeString.split(' '); // <--['__:__','__']
97
92
 
98
- const [dirtyHours, dirtyMinutes] = (_dirtyTimes$split = dirtyTimes.split) === null || _dirtyTimes$split === void 0 ? void 0 : _dirtyTimes$split.call(dirtyTimes, ':'); // <--['__','__']
93
+ const [dirtyHours, dirtyMinutes] = dirtyTimes.split(':'); // <--['__','__']
99
94
 
100
95
  const regex = /_/g; // Note the 'g' flag, which matches all occurrences of the expression
101
96
 
102
97
  const newValues = {
103
98
  hours: (dirtyHours || '').replace(regex, ''),
104
99
  minutes: (dirtyMinutes || '').replace(regex, ''),
105
- // seconds: (dirtySeconds||"").replace(regex, ''),
106
100
  meridiem: (dirtyMeridiem || '').replace(regex, '')
107
101
  };
108
102
  return newValues;
@@ -0,0 +1,8 @@
1
+ const dateTimeTypes = ['full-date-time', 'date-time-inputs', 'date-time-picker', 'date-time-picker-controller-only'];
2
+ const dateTypes = ['full-date', 'date-inputs', 'date-picker', 'date-picker-controller-only'];
3
+ const timeTypes = ['full-time', 'time-inputs', 'time-picker', 'time-picker-controller-only'];
4
+ const getIsDateTime = props => dateTimeTypes.includes(props.type);
5
+ const getIsDate = props => dateTypes.includes(props.type);
6
+ const getIsTime = props => timeTypes.includes(props.type);
7
+
8
+ export { getIsDate, getIsDateTime, getIsTime };
package/esm/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  export { DSAutocomplete, DSAutocompleteWithSchema } from './autocomplete/Autocomplete.js';
2
2
  export { DSControlledCheckbox, DSControlledCheckboxWithSchema } from './checkbox/ControlledCheckbox.js';
3
- export { DSComboBox, DSComboBoxWithSchema } from './combobox/ComboBox.js';
3
+ export { DSComboBox, DSComboBox as DSComboBoxV3, DSComboBoxWithSchema } from './combobox/ComboBox.js';
4
4
  export { DSControlledDateRangePicker, DSControlledDateRangePickerWithSchema } from './date-range-picker/ControlledDateRangePicker.js';
5
5
  export { ControlledDateRangePickerDatatestid } from './date-range-picker/ControlledDateRangePickerDatatestid.js';
6
6
  export { CONTROLLED_DATE_RANGE_PICKER_TYPES } from './date-range-picker/ControlledDateRangePickerTypes.js';
@@ -11,10 +11,11 @@ export { deconstructValuesFromDateString, prependStringWithPlaceHolders } from '
11
11
  export { getValidationDateTimeStringMetaInfo } from './date-time-picker/utils/dateTimeHelpers.js';
12
12
  export { getDateStringFromDay, getDateValuesFromDate, getDayFromDateString, getValidationDateStringMetaInfo } from './date-time-picker/utils/dateHelpers.js';
13
13
  export { getValidationTimeStringMetaInfo } from './date-time-picker/utils/timeHelpers.js';
14
- export { UsePhoneMaskWithSchema, usePhoneMask } from './mask-hook/hooks/usePhoneMask.js';
15
- export { UseNumberMaskWithSchema, useNumberMask } from './mask-hook/hooks/useNumberMask.js';
16
- export { UseSSNMaskWithSchema, useSSNMask } from './mask-hook/hooks/useSSNMask.js';
17
- export { UseZipCodeMaskWithSchema, useZipCode } from './mask-hook/hooks/useZipCode.js';
14
+ export { UsePhoneMaskWithSchema, getPhoneMaskedValue, usePhoneMask } from './mask-hook/hooks/usePhoneMask.js';
15
+ export { UseNumberMaskWithSchema, getNumberMaskedValue, useNumberMask } from './mask-hook/hooks/useNumberMask.js';
16
+ export { UseSSNMaskWithSchema, getSSNMaskedValue, useSSNMask } from './mask-hook/hooks/useSSNMask.js';
17
+ export { UseRegExpMaskWithSchema, isRegExp, useRegExpMask } from './mask-hook/hooks/useRegExpMask.js';
18
+ export { UseZipCodeMaskWithSchema, getUseZipMaskedValue, useZipCodeMask } from './mask-hook/hooks/useZipCodeMask.js';
18
19
  export { DSInputText, DSInputTextWithSchema } from './text-input/DSInputText.js';
19
20
  export { DSInputTextDataTestIds } from './text-input/exported-related/data-test-ids.js';
20
21
  export { DSInputTextName, DSInputTextSlots } from './text-input/exported-related/theming.js';
@@ -1,4 +1,5 @@
1
- export { UsePhoneMaskWithSchema, usePhoneMask } from './usePhoneMask.js';
2
- export { UseNumberMaskWithSchema, useNumberMask } from './useNumberMask.js';
3
- export { UseSSNMaskWithSchema, useSSNMask } from './useSSNMask.js';
4
- export { UseZipCodeMaskWithSchema, useZipCode } from './useZipCode.js';
1
+ export { UsePhoneMaskWithSchema, getPhoneMaskedValue, usePhoneMask } from './usePhoneMask.js';
2
+ export { UseNumberMaskWithSchema, getNumberMaskedValue, useNumberMask } from './useNumberMask.js';
3
+ export { UseSSNMaskWithSchema, getSSNMaskedValue, useSSNMask } from './useSSNMask.js';
4
+ export { UseRegExpMaskWithSchema, isRegExp, useRegExpMask } from './useRegExpMask.js';
5
+ export { UseZipCodeMaskWithSchema, getUseZipMaskedValue, useZipCodeMask } from './useZipCodeMask.js';
@@ -10,6 +10,8 @@ import { useCallbackAfterRender } from '@elliemae/ds-utilities';
10
10
  import 'core-js/modules/esnext.async-iterator.for-each.js';
11
11
  import 'core-js/modules/esnext.iterator.for-each.js';
12
12
  import { setCursorPosition } from '../utils/setCursorPosition.js';
13
+ import 'core-js/modules/esnext.async-iterator.reduce.js';
14
+ import 'core-js/modules/esnext.iterator.reduce.js';
13
15
  import { DSMaskNumberHookPropsTypes, DSMaskNumberHookDefaultProps } from '../react-desc-prop-types.js';
14
16
 
15
17
  const _excluded = ["valueSetter", "onChange", "onKeyDown", "onBlur"];
@@ -156,7 +158,11 @@ const useNumberMask = props => {
156
158
  onBlur
157
159
  };
158
160
  };
161
+ const getNumberMaskedValue = (value, opts) => {
162
+ const [maskedValue] = conformValue(value, value.length - 1, '', opts);
163
+ return maskedValue;
164
+ };
159
165
  const UseNumberMaskWithSchema = describe(useNumberMask);
160
166
  UseNumberMaskWithSchema.propTypes = DSMaskNumberHookPropsTypes;
161
167
 
162
- export { UseNumberMaskWithSchema, useNumberMask };
168
+ export { UseNumberMaskWithSchema, getNumberMaskedValue, useNumberMask };
@@ -9,6 +9,8 @@ import { useCallbackAfterRender } from '@elliemae/ds-utilities';
9
9
  import { addSpecialCharacters } from '../utils/addSpecialCharacters.js';
10
10
  import { getPartialMaskedPos } from '../utils/getPartialMaskedPos.js';
11
11
  import { setCursorPosition } from '../utils/setCursorPosition.js';
12
+ import 'core-js/modules/esnext.async-iterator.reduce.js';
13
+ import 'core-js/modules/esnext.iterator.reduce.js';
12
14
  import { DSMaskPhoneHookPropsTypes, DSMaskPhoneHookDefaultProps } from '../react-desc-prop-types.js';
13
15
 
14
16
  const _excluded = ["valueSetter", "onChange", "onKeyDown", "onBlur"];
@@ -78,7 +80,11 @@ const usePhoneMask = props => {
78
80
  onChange
79
81
  };
80
82
  };
83
+ const getPhoneMaskedValue = (value, opts) => {
84
+ const [maskedValue] = conformValue(value, value.length - 1, '', opts);
85
+ return maskedValue;
86
+ };
81
87
  const UsePhoneMaskWithSchema = describe(usePhoneMask);
82
88
  UsePhoneMaskWithSchema.propTypes = DSMaskPhoneHookPropsTypes;
83
89
 
84
- export { UsePhoneMaskWithSchema, usePhoneMask };
90
+ export { UsePhoneMaskWithSchema, getPhoneMaskedValue, usePhoneMask };