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

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 (234) hide show
  1. package/cjs/autocomplete/config/useAutocomplete.js +0 -1
  2. package/cjs/autocomplete/parts/A11yFocusedOption.js +46 -0
  3. package/cjs/autocomplete/parts/container/Container.js +36 -24
  4. package/cjs/autocomplete/parts/container/styled.js +2 -2
  5. package/cjs/autocomplete/parts/container/useKeyboardNavigation.js +2 -2
  6. package/cjs/autocomplete/parts/menu-list/MenuList.js +6 -6
  7. package/cjs/autocomplete/parts/menu-list/styled.js +2 -2
  8. package/cjs/autocomplete/parts/menu-list/useItemRenderer.js +1 -1
  9. package/cjs/autocomplete/parts/styled.js +2 -0
  10. package/cjs/autocomplete/utils/listHelper.js +1 -1
  11. package/cjs/checkbox/ControlledCheckbox.js +9 -4
  12. package/cjs/checkbox/config/useValidateProps.js +6 -3
  13. package/cjs/checkbox/react-desc-prop-types.js +2 -1
  14. package/cjs/checkbox/styles.js +93 -32
  15. package/cjs/checkbox/utils/styleHelpers.js +20 -2
  16. package/cjs/combobox/ComboBoxCTX.js +6 -3
  17. package/cjs/combobox/config/useComboBox.js +16 -6
  18. package/cjs/combobox/config/useCorrectOptions.js +1 -2
  19. package/cjs/combobox/parts/A11yFocusedOption.js +14 -6
  20. package/cjs/combobox/parts/A11ySelectedValues.js +2 -4
  21. package/cjs/combobox/parts/DropdownIndicator.js +15 -7
  22. package/cjs/combobox/parts/container/Container.js +11 -14
  23. package/cjs/combobox/parts/container/styled.js +11 -10
  24. package/cjs/combobox/parts/controls/Controls.js +19 -27
  25. package/cjs/combobox/parts/controls/styled.js +54 -22
  26. package/cjs/combobox/parts/controls/useOnPillsNavigation.js +7 -15
  27. package/cjs/combobox/parts/controls-input/ControlsInput.js +2 -2
  28. package/cjs/combobox/parts/controls-input/styled.js +41 -11
  29. package/cjs/combobox/parts/controls-input/useControlsInput.js +4 -7
  30. package/cjs/combobox/parts/controls-input/useKeyboardNavigation.js +19 -28
  31. package/cjs/combobox/parts/controls-input/useMaskedOnChange.js +7 -7
  32. package/cjs/combobox/parts/dropdown-indicator/DropdownIndicator.js +2 -2
  33. package/cjs/combobox/parts/header-list/HeaderList.js +1 -1
  34. package/cjs/combobox/parts/header-list/styled.js +39 -10
  35. package/cjs/combobox/parts/header-list/useHeaderListHandlers.js +7 -14
  36. package/cjs/combobox/parts/menu-list/MenuList.js +8 -6
  37. package/cjs/combobox/parts/menu-list/styled.js +38 -20
  38. package/cjs/combobox/parts/menu-list/useItemRenderer.js +18 -17
  39. package/cjs/combobox/parts/multi-selected-values-container/MultiSelectedValuesContainer.js +1 -1
  40. package/cjs/combobox/parts/multi-selected-values-container/RemovableSelectedValuePill.js +1 -3
  41. package/cjs/combobox/parts/multi-selected-values-container/useGroupPills.js +1 -2
  42. package/cjs/combobox/parts/styled.js +6 -7
  43. package/cjs/combobox/react-desc-prop-types.js +3 -2
  44. package/cjs/combobox/sharedTypes.js +2 -2
  45. package/cjs/combobox/utils/listHelper.js +14 -9
  46. package/cjs/date-range-picker/config/useRangePickerLogic.js +4 -8
  47. package/cjs/date-range-picker/parts/ControlledDateRangeCalendar.js +0 -2
  48. package/cjs/date-range-picker/parts/ControlledDateRangeFromDate.js +0 -2
  49. package/cjs/date-range-picker/parts/ControlledDateRangeToDate.js +0 -2
  50. package/cjs/date-time-picker/config/useChangeHandlers.js +3 -3
  51. package/cjs/date-time-picker/config/useControlledDateTimePicker.js +1 -1
  52. package/cjs/date-time-picker/config/useFocusTracker.js +1 -1
  53. package/cjs/date-time-picker/config/useGetDestructuredValues.js +6 -6
  54. package/cjs/date-time-picker/config/useGetPropsBasedOnType.js +1 -1
  55. package/cjs/date-time-picker/config/useGetReferences.js +1 -1
  56. package/cjs/date-time-picker/config/useRelevantValueFromProps.js +1 -1
  57. package/cjs/date-time-picker/config/useValidateProps.js +42 -11
  58. package/cjs/date-time-picker/parts/ClearButton/ClearButton.js +1 -3
  59. package/cjs/date-time-picker/parts/DateInputs/DDInput.js +3 -7
  60. package/cjs/date-time-picker/parts/DateInputs/MMInput.js +3 -7
  61. package/cjs/date-time-picker/parts/DateInputs/YYYYInput.js +3 -7
  62. package/cjs/date-time-picker/parts/DateInputs/useDateInputs.js +13 -23
  63. package/cjs/date-time-picker/parts/Pickers/Calendar/CalendarDaysList.js +4 -4
  64. package/cjs/date-time-picker/parts/Pickers/Calendar/CalendarHead.js +6 -14
  65. package/cjs/date-time-picker/parts/Pickers/Calendar/CalendarIconTrigger.js +1 -1
  66. package/cjs/date-time-picker/parts/Pickers/Calendar/Day.js +8 -10
  67. package/cjs/date-time-picker/parts/Pickers/Calendar/Styleds.js +44 -15
  68. package/cjs/date-time-picker/parts/Pickers/Calendar/useConfigCalendarCTX.js +1 -2
  69. package/cjs/date-time-picker/parts/Pickers/Calendar/useCurrentDisplayedMonthYearLogic.js +2 -1
  70. package/cjs/date-time-picker/parts/Pickers/Calendar/useFocusLogic.js +0 -1
  71. package/cjs/date-time-picker/parts/Pickers/Calendar/usePopperTriggerLogic.js +3 -5
  72. package/cjs/date-time-picker/parts/Pickers/CalendarWithTimeWheel/CalendarWithTimeWheelIconTrigger.js +1 -1
  73. package/cjs/date-time-picker/parts/Pickers/CalendarWithTimeWheel/useConfigCalendarWithTimeWheelCTX.js +3 -5
  74. package/cjs/date-time-picker/parts/Pickers/TimeWheel/HoursList.js +5 -7
  75. package/cjs/date-time-picker/parts/Pickers/TimeWheel/MeridiemList.js +6 -8
  76. package/cjs/date-time-picker/parts/Pickers/TimeWheel/MinutesList.js +5 -7
  77. package/cjs/date-time-picker/parts/Pickers/TimeWheel/SecondsList.js +2 -2
  78. package/cjs/date-time-picker/parts/Pickers/TimeWheel/Styleds.js +47 -15
  79. package/cjs/date-time-picker/parts/Pickers/TimeWheel/TimeWheelContent.js +2 -5
  80. package/cjs/date-time-picker/parts/Pickers/TimeWheel/TimeWheelIconTrigger.js +1 -1
  81. package/cjs/date-time-picker/parts/Pickers/TimeWheel/useCurrentDisplayedWheelsLogic.js +3 -3
  82. package/cjs/date-time-picker/parts/Pickers/TimeWheel/usePopperTriggerLogic.js +2 -5
  83. package/cjs/date-time-picker/parts/Styleds.js +12 -6
  84. package/cjs/date-time-picker/parts/TimeInputs/HHInput.js +2 -4
  85. package/cjs/date-time-picker/parts/TimeInputs/MeridiemInput.js +3 -8
  86. package/cjs/date-time-picker/parts/TimeInputs/MinutesInput.js +3 -7
  87. package/cjs/date-time-picker/parts/TimeInputs/useTimeInputs.js +14 -26
  88. package/cjs/date-time-picker/utils/dateHelpers.js +17 -34
  89. package/cjs/date-time-picker/utils/hooks/useOnClickOutside.js +1 -3
  90. package/cjs/date-time-picker/utils/stringHelpers.js +5 -11
  91. package/cjs/input-group/InputGroup.js +8 -7
  92. package/cjs/input-group/exported-related/data-test-ids.js +12 -0
  93. package/cjs/input-group/exported-related/index.js +12 -0
  94. package/cjs/input-group/exported-related/theming.js +13 -0
  95. package/cjs/input-group/styled.js +90 -23
  96. package/cjs/large-text-input/DSControlledLargeTextInput.js +1 -1
  97. package/cjs/large-text-input/styles.js +27 -13
  98. package/cjs/mask-hook/hooks/useNumberMask.js +1 -5
  99. package/cjs/mask-hook/hooks/usePhoneMask.js +1 -4
  100. package/cjs/mask-hook/hooks/useRegExpMask.js +4 -7
  101. package/cjs/mask-hook/hooks/useSSNMask.js +1 -4
  102. package/cjs/mask-hook/hooks/useZipCodeMask.js +1 -4
  103. package/cjs/mask-hook/utils/addSpecialCharacters.js +0 -1
  104. package/cjs/mask-hook/utils/flatStringArray.js +0 -1
  105. package/cjs/text-input/config/useInputText.js +0 -1
  106. package/cjs/text-input/styled/borders.js +18 -11
  107. package/cjs/text-input/styled/components.js +49 -10
  108. package/cjs/toggle/ControlledToggle.js +2 -3
  109. package/cjs/toggle/styles.js +7 -5
  110. package/esm/autocomplete/config/useAutocomplete.js +0 -1
  111. package/esm/autocomplete/parts/A11yFocusedOption.js +36 -0
  112. package/esm/autocomplete/parts/container/Container.js +39 -27
  113. package/esm/autocomplete/parts/container/styled.js +2 -2
  114. package/esm/autocomplete/parts/container/useKeyboardNavigation.js +2 -2
  115. package/esm/autocomplete/parts/menu-list/MenuList.js +7 -7
  116. package/esm/autocomplete/parts/menu-list/styled.js +2 -2
  117. package/esm/autocomplete/parts/menu-list/useItemRenderer.js +1 -1
  118. package/esm/autocomplete/parts/styled.js +1 -0
  119. package/esm/autocomplete/utils/listHelper.js +1 -1
  120. package/esm/checkbox/ControlledCheckbox.js +10 -5
  121. package/esm/checkbox/config/useValidateProps.js +6 -3
  122. package/esm/checkbox/react-desc-prop-types.js +2 -1
  123. package/esm/checkbox/styles.js +93 -29
  124. package/esm/checkbox/utils/styleHelpers.js +20 -2
  125. package/esm/combobox/ComboBoxCTX.js +6 -3
  126. package/esm/combobox/config/useComboBox.js +16 -6
  127. package/esm/combobox/config/useCorrectOptions.js +1 -2
  128. package/esm/combobox/parts/A11yFocusedOption.js +15 -7
  129. package/esm/combobox/parts/A11ySelectedValues.js +2 -4
  130. package/esm/combobox/parts/DropdownIndicator.js +15 -6
  131. package/esm/combobox/parts/container/Container.js +11 -14
  132. package/esm/combobox/parts/container/styled.js +11 -6
  133. package/esm/combobox/parts/controls/Controls.js +19 -27
  134. package/esm/combobox/parts/controls/styled.js +54 -18
  135. package/esm/combobox/parts/controls/useOnPillsNavigation.js +7 -15
  136. package/esm/combobox/parts/controls-input/ControlsInput.js +2 -2
  137. package/esm/combobox/parts/controls-input/styled.js +41 -7
  138. package/esm/combobox/parts/controls-input/useControlsInput.js +4 -7
  139. package/esm/combobox/parts/controls-input/useKeyboardNavigation.js +20 -29
  140. package/esm/combobox/parts/controls-input/useMaskedOnChange.js +7 -7
  141. package/esm/combobox/parts/dropdown-indicator/DropdownIndicator.js +2 -2
  142. package/esm/combobox/parts/header-list/HeaderList.js +1 -1
  143. package/esm/combobox/parts/header-list/styled.js +40 -7
  144. package/esm/combobox/parts/header-list/useHeaderListHandlers.js +7 -14
  145. package/esm/combobox/parts/menu-list/MenuList.js +8 -6
  146. package/esm/combobox/parts/menu-list/styled.js +38 -17
  147. package/esm/combobox/parts/menu-list/useItemRenderer.js +20 -19
  148. package/esm/combobox/parts/multi-selected-values-container/MultiSelectedValuesContainer.js +1 -1
  149. package/esm/combobox/parts/multi-selected-values-container/RemovableSelectedValuePill.js +1 -3
  150. package/esm/combobox/parts/multi-selected-values-container/useGroupPills.js +1 -2
  151. package/esm/combobox/parts/styled.js +6 -3
  152. package/esm/combobox/react-desc-prop-types.js +3 -2
  153. package/esm/combobox/sharedTypes.js +2 -2
  154. package/esm/combobox/utils/listHelper.js +14 -10
  155. package/esm/date-range-picker/config/useRangePickerLogic.js +3 -7
  156. package/esm/date-range-picker/parts/ControlledDateRangeCalendar.js +0 -2
  157. package/esm/date-range-picker/parts/ControlledDateRangeFromDate.js +0 -2
  158. package/esm/date-range-picker/parts/ControlledDateRangeToDate.js +0 -2
  159. package/esm/date-time-picker/config/useChangeHandlers.js +3 -3
  160. package/esm/date-time-picker/config/useControlledDateTimePicker.js +1 -1
  161. package/esm/date-time-picker/config/useFocusTracker.js +1 -1
  162. package/esm/date-time-picker/config/useGetDestructuredValues.js +6 -6
  163. package/esm/date-time-picker/config/useGetPropsBasedOnType.js +1 -1
  164. package/esm/date-time-picker/config/useGetReferences.js +1 -1
  165. package/esm/date-time-picker/config/useRelevantValueFromProps.js +1 -1
  166. package/esm/date-time-picker/config/useValidateProps.js +42 -11
  167. package/esm/date-time-picker/parts/ClearButton/ClearButton.js +1 -3
  168. package/esm/date-time-picker/parts/DateInputs/DDInput.js +3 -7
  169. package/esm/date-time-picker/parts/DateInputs/MMInput.js +3 -7
  170. package/esm/date-time-picker/parts/DateInputs/YYYYInput.js +3 -7
  171. package/esm/date-time-picker/parts/DateInputs/useDateInputs.js +13 -23
  172. package/esm/date-time-picker/parts/Pickers/Calendar/CalendarDaysList.js +4 -4
  173. package/esm/date-time-picker/parts/Pickers/Calendar/CalendarHead.js +6 -14
  174. package/esm/date-time-picker/parts/Pickers/Calendar/CalendarIconTrigger.js +1 -1
  175. package/esm/date-time-picker/parts/Pickers/Calendar/Day.js +8 -10
  176. package/esm/date-time-picker/parts/Pickers/Calendar/Styleds.js +44 -14
  177. package/esm/date-time-picker/parts/Pickers/Calendar/useConfigCalendarCTX.js +0 -1
  178. package/esm/date-time-picker/parts/Pickers/Calendar/useCurrentDisplayedMonthYearLogic.js +2 -1
  179. package/esm/date-time-picker/parts/Pickers/Calendar/useFocusLogic.js +0 -1
  180. package/esm/date-time-picker/parts/Pickers/Calendar/usePopperTriggerLogic.js +3 -5
  181. package/esm/date-time-picker/parts/Pickers/CalendarWithTimeWheel/CalendarWithTimeWheelIconTrigger.js +1 -1
  182. package/esm/date-time-picker/parts/Pickers/CalendarWithTimeWheel/useConfigCalendarWithTimeWheelCTX.js +3 -5
  183. package/esm/date-time-picker/parts/Pickers/TimeWheel/HoursList.js +5 -7
  184. package/esm/date-time-picker/parts/Pickers/TimeWheel/MeridiemList.js +6 -8
  185. package/esm/date-time-picker/parts/Pickers/TimeWheel/MinutesList.js +5 -7
  186. package/esm/date-time-picker/parts/Pickers/TimeWheel/SecondsList.js +2 -2
  187. package/esm/date-time-picker/parts/Pickers/TimeWheel/Styleds.js +47 -14
  188. package/esm/date-time-picker/parts/Pickers/TimeWheel/TimeWheelContent.js +2 -5
  189. package/esm/date-time-picker/parts/Pickers/TimeWheel/TimeWheelIconTrigger.js +1 -1
  190. package/esm/date-time-picker/parts/Pickers/TimeWheel/useCurrentDisplayedWheelsLogic.js +3 -3
  191. package/esm/date-time-picker/parts/Pickers/TimeWheel/usePopperTriggerLogic.js +2 -5
  192. package/esm/date-time-picker/parts/Styleds.js +12 -6
  193. package/esm/date-time-picker/parts/TimeInputs/HHInput.js +2 -4
  194. package/esm/date-time-picker/parts/TimeInputs/MeridiemInput.js +3 -8
  195. package/esm/date-time-picker/parts/TimeInputs/MinutesInput.js +3 -7
  196. package/esm/date-time-picker/parts/TimeInputs/useTimeInputs.js +14 -26
  197. package/esm/date-time-picker/utils/dateHelpers.js +17 -34
  198. package/esm/date-time-picker/utils/hooks/useOnClickOutside.js +1 -3
  199. package/esm/date-time-picker/utils/stringHelpers.js +5 -11
  200. package/esm/input-group/InputGroup.js +5 -4
  201. package/esm/input-group/exported-related/data-test-ids.js +8 -0
  202. package/esm/input-group/exported-related/index.js +2 -0
  203. package/esm/input-group/exported-related/theming.js +8 -0
  204. package/esm/input-group/styled.js +89 -18
  205. package/esm/large-text-input/DSControlledLargeTextInput.js +1 -1
  206. package/esm/large-text-input/styles.js +27 -9
  207. package/esm/mask-hook/hooks/useNumberMask.js +1 -5
  208. package/esm/mask-hook/hooks/usePhoneMask.js +1 -4
  209. package/esm/mask-hook/hooks/useRegExpMask.js +4 -7
  210. package/esm/mask-hook/hooks/useSSNMask.js +1 -4
  211. package/esm/mask-hook/hooks/useZipCodeMask.js +1 -4
  212. package/esm/mask-hook/utils/addSpecialCharacters.js +0 -1
  213. package/esm/mask-hook/utils/flatStringArray.js +0 -1
  214. package/esm/text-input/config/useInputText.js +0 -1
  215. package/esm/text-input/styled/borders.js +18 -7
  216. package/esm/text-input/styled/components.js +49 -6
  217. package/esm/toggle/ControlledToggle.js +0 -1
  218. package/esm/toggle/styles.js +7 -5
  219. package/package.json +35 -15
  220. package/types/autocomplete/parts/A11yFocusedOption.d.ts +5 -0
  221. package/types/autocomplete/parts/container/styled.d.ts +1 -1
  222. package/types/autocomplete/parts/styled.d.ts +0 -0
  223. package/types/autocomplete/utils/listHelper.d.ts +5 -5
  224. package/types/checkbox/react-desc-prop-types.d.ts +2 -1
  225. package/types/checkbox/styles.d.ts +1 -0
  226. package/types/combobox/parts/menu-list/styled.d.ts +1 -0
  227. package/types/combobox/react-desc-prop-types.d.ts +8 -6
  228. package/types/combobox/sharedTypes.d.ts +3 -2
  229. package/types/combobox/utils/listHelper.d.ts +1 -0
  230. package/types/input-group/exported-related/data-test-ids.d.ts +6 -0
  231. package/types/input-group/exported-related/index.d.ts +2 -0
  232. package/types/input-group/exported-related/theming.d.ts +6 -0
  233. package/types/input-group/styled.d.ts +4 -7
  234. package/types/text-input/config/useInputText.d.ts +4 -4
@@ -5,7 +5,6 @@ import 'core-js/modules/esnext.async-iterator.some.js';
5
5
  import 'core-js/modules/esnext.iterator.some.js';
6
6
  import 'core-js/modules/esnext.async-iterator.find.js';
7
7
  import 'core-js/modules/esnext.iterator.find.js';
8
- import 'core-js/modules/web.dom-collections.iterator.js';
9
8
  import 'core-js/modules/esnext.async-iterator.for-each.js';
10
9
  import 'core-js/modules/esnext.iterator.for-each.js';
11
10
  import { MENU_OPTION_TYPES } from '../constants.js';
@@ -17,11 +16,11 @@ const isSelectedValueMultiple = value => Array.isArray(value);
17
16
  const isSelected = (value, activeOption) => {
18
17
  if (isSelectedValueMultiple(value)) {
19
18
  const multiValue = value;
20
- return multiValue.some(item => (item === null || item === void 0 ? void 0 : item.value) === (activeOption === null || activeOption === void 0 ? void 0 : activeOption.value));
19
+ return multiValue.some(item => item?.value === activeOption?.value);
21
20
  }
22
21
 
23
22
  const singleValue = value;
24
- return (singleValue === null || singleValue === void 0 ? void 0 : singleValue.value) === activeOption.value;
23
+ return singleValue?.value === activeOption.value;
25
24
  };
26
25
  const findInCircularList = function (list, from, criteria) {
27
26
  let step = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 1;
@@ -71,8 +70,6 @@ const getSuggestedValueOnChange = (selectedOption, selectedValues) => {
71
70
  };
72
71
  const filterOptions = (inputValue, options) => options.filter(option => option.type === MENU_OPTION_TYPES.OPTION && option.label.toLowerCase().includes(inputValue.toLowerCase()));
73
72
  const selectedValuesWithSections = (optionsToParse, multiSelectedValue) => {
74
- var _items2;
75
-
76
73
  const items = [];
77
74
  if (optionsToParse) optionsToParse.forEach(option => {
78
75
  // const isSelectedValue = multiSelectedValue.find((item) => item?.dsId === option.dsId);
@@ -81,9 +78,7 @@ const selectedValuesWithSections = (optionsToParse, multiSelectedValue) => {
81
78
  }
82
79
 
83
80
  if (option.type === MENU_OPTION_TYPES.SECTION) {
84
- var _items;
85
-
86
- if (((_items = items[items.length - 1]) === null || _items === void 0 ? void 0 : _items.type) === MENU_OPTION_TYPES.SECTION) {
81
+ if (items[items.length - 1]?.type === MENU_OPTION_TYPES.SECTION) {
87
82
  items[items.length - 1] = option;
88
83
  } else {
89
84
  items.push(option);
@@ -91,12 +86,21 @@ const selectedValuesWithSections = (optionsToParse, multiSelectedValue) => {
91
86
  }
92
87
  });
93
88
 
94
- if (((_items2 = items[items.length - 1]) === null || _items2 === void 0 ? void 0 : _items2.type) === MENU_OPTION_TYPES.SECTION) {
89
+ if (items[items.length - 1]?.type === MENU_OPTION_TYPES.SECTION) {
95
90
  items.pop();
96
91
  }
97
92
 
98
93
  return items;
99
94
  };
100
95
  const getFilteredOptionsSelected = (filteredOption, selectedValues) => filteredOption.filter(option => option.type === MENU_OPTION_TYPES.OPTION && isSelected(selectedValues, option));
96
+ const scrollIfNeeded = function (elem) {
97
+ let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {
98
+ behavior: 'smooth',
99
+ block: 'end',
100
+ inline: 'nearest'
101
+ };
102
+ const bounding = elem.getBoundingClientRect();
103
+ if (!(bounding.top >= 0 && bounding.left >= 0 && bounding.bottom <= (window.innerHeight || document.documentElement.clientHeight) && bounding.right <= (window.innerWidth || document.documentElement.clientWidth))) elem.scrollIntoView(options);
104
+ };
101
105
 
102
- export { filterOptions, findInCircularList, getFilteredOptionsSelected, getFirstOption, getLastValueSelected, getOptions, getSelectableOptions, getSuggestedValueOnChange, isSelected, isSelectedValueEmpty, isSelectedValueMultiple, selectedValuesWithSections };
106
+ export { filterOptions, findInCircularList, getFilteredOptionsSelected, getFirstOption, getLastValueSelected, getOptions, getSelectableOptions, getSuggestedValueOnChange, isSelected, isSelectedValueEmpty, isSelectedValueMultiple, scrollIfNeeded, selectedValuesWithSections };
@@ -4,12 +4,10 @@ import 'core-js/modules/esnext.iterator.filter.js';
4
4
  import 'core-js/modules/esnext.async-iterator.for-each.js';
5
5
  import 'core-js/modules/esnext.iterator.for-each.js';
6
6
  import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
7
- import 'core-js/modules/web.dom-collections.iterator.js';
8
7
  import { useState, useEffect, useCallback, useMemo } from 'react';
9
8
  import '../../date-time-picker/ControlledDateTimePicker.js';
10
9
  import 'core-js/modules/esnext.async-iterator.map.js';
11
10
  import 'core-js/modules/esnext.iterator.map.js';
12
- import 'core-js/modules/es.string.replace.js';
13
11
  import { getDayFromDateString } from '../../date-time-picker/utils/dateHelpers.js';
14
12
 
15
13
  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; }
@@ -46,7 +44,7 @@ const useRangePickerLogic = _ref => {
46
44
  const dateToString = calendarChangeIsFrom ? toDate : changedDay;
47
45
  const dateTo = getDayFromDateString(dateToString); // we force the "from" to ALWAYS be before the "to" date
48
46
 
49
- const isToBeforeFrom = (dateTo === null || dateTo === void 0 ? void 0 : dateTo.getTime()) < (dateFrom === null || dateFrom === void 0 ? void 0 : dateFrom.getTime());
47
+ const isToBeforeFrom = dateTo?.getTime() < dateFrom?.getTime();
50
48
  const newDateFromString = isToBeforeFrom ? dateToString : dateFromString;
51
49
  const forcingFromDatePick = isToBeforeFrom ? !calendarChangeIsFrom : false;
52
50
  const newDateToString = isToBeforeFrom ? dateFromString : dateToString;
@@ -121,19 +119,17 @@ const useRangePickerLogic = _ref => {
121
119
  }, [getChangedDayStringValues, onFromDateChange, onToDateChange]);
122
120
  const getIsStartRangeDay = useCallback(dayString => dayString === fromDate, [fromDate]);
123
121
  const getIsDayInRange = useCallback(dayString => {
124
- var _getDayFromDateString;
125
-
126
122
  const dayFrom = getDayFromDateString(fromDate);
127
123
  const dayTo = getDayFromDateString(toDate);
128
124
  if (!dayFrom || !dayTo || !dayString) return false;
129
- const newDayTime = (_getDayFromDateString = getDayFromDateString(dayString)) === null || _getDayFromDateString === void 0 ? void 0 : _getDayFromDateString.getTime();
125
+ const newDayTime = getDayFromDateString(dayString)?.getTime();
130
126
  return newDayTime <= dayTo.getTime() && newDayTime >= dayFrom.getTime();
131
127
  }, [fromDate, toDate]);
132
128
  const getIsEndRangeDay = useCallback(dayString => dayString === toDate, [toDate]);
133
129
  const getIsToBeforeFrom = useCallback((fromString, toString) => {
134
130
  const dateFrom = getDayFromDateString(fromString);
135
131
  const dateTo = getDayFromDateString(toString);
136
- return (dateTo === null || dateTo === void 0 ? void 0 : dateTo.getTime()) < (dateFrom === null || dateFrom === void 0 ? void 0 : dateFrom.getTime());
132
+ return dateTo?.getTime() < dateFrom?.getTime();
137
133
  }, []);
138
134
  const handleFromDateChange = useCallback((newVal, metaInfo) => {
139
135
  const isIncorrectOrder = getIsToBeforeFrom(newVal, toDate);
@@ -4,8 +4,6 @@ import { DSControlledDateTimePicker } from '../../date-time-picker/ControlledDat
4
4
  import { CONTROLLED_DATE_TIME_PICKER_TYPES } from '../../date-time-picker/ControlledDateTimePickerTypes.js';
5
5
  import 'core-js/modules/esnext.async-iterator.map.js';
6
6
  import 'core-js/modules/esnext.iterator.map.js';
7
- import 'core-js/modules/web.dom-collections.iterator.js';
8
- import 'core-js/modules/es.string.replace.js';
9
7
  import 'core-js/modules/esnext.async-iterator.filter.js';
10
8
  import 'core-js/modules/esnext.iterator.constructor.js';
11
9
  import 'core-js/modules/esnext.iterator.filter.js';
@@ -5,8 +5,6 @@ import { DSControlledDateTimePicker } from '../../date-time-picker/ControlledDat
5
5
  import { CONTROLLED_DATE_TIME_PICKER_TYPES } from '../../date-time-picker/ControlledDateTimePickerTypes.js';
6
6
  import 'core-js/modules/esnext.async-iterator.map.js';
7
7
  import 'core-js/modules/esnext.iterator.map.js';
8
- import 'core-js/modules/web.dom-collections.iterator.js';
9
- import 'core-js/modules/es.string.replace.js';
10
8
  import 'core-js/modules/esnext.async-iterator.filter.js';
11
9
  import 'core-js/modules/esnext.iterator.constructor.js';
12
10
  import 'core-js/modules/esnext.iterator.filter.js';
@@ -5,8 +5,6 @@ import { DSControlledDateTimePicker } from '../../date-time-picker/ControlledDat
5
5
  import { CONTROLLED_DATE_TIME_PICKER_TYPES } from '../../date-time-picker/ControlledDateTimePickerTypes.js';
6
6
  import 'core-js/modules/esnext.async-iterator.map.js';
7
7
  import 'core-js/modules/esnext.iterator.map.js';
8
- import 'core-js/modules/web.dom-collections.iterator.js';
9
- import 'core-js/modules/es.string.replace.js';
10
8
  import 'core-js/modules/esnext.async-iterator.filter.js';
11
9
  import 'core-js/modules/esnext.iterator.constructor.js';
12
10
  import 'core-js/modules/esnext.iterator.filter.js';
@@ -81,7 +81,7 @@ const useChangeHandlers = _ref => {
81
81
  appOnTimeChange(appTimeString, metaInfo); // don't do this on useEffect to avoid complete chaos
82
82
 
83
83
  setTimeString(newTimeString);
84
- const newDateTimeString = "".concat(newDateString, " ").concat(newTimeString);
84
+ const newDateTimeString = `${newDateString} ${newTimeString}`;
85
85
 
86
86
  const newMetaInfo = _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, metaInfo), getTimeMetaInfo(newTimeString, metaInfo)), getDateMetaInfo(newDateString, metaInfo)), {}, {
87
87
  newDateString,
@@ -98,7 +98,7 @@ const useChangeHandlers = _ref => {
98
98
  appOnDateChange(appDateString, metaInfo); // don't do this on useEffect to avoid complete chaos
99
99
 
100
100
  setTempDateString(newDateString);
101
- const newDateTimeString = "".concat(newDateString, " ").concat(tempTimeString);
101
+ const newDateTimeString = `${newDateString} ${tempTimeString}`;
102
102
 
103
103
  const newMetaInfo = _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, metaInfo), getTimeMetaInfo(tempTimeString, metaInfo)), getDateMetaInfo(newDateString, metaInfo)), {}, {
104
104
  newDateString,
@@ -114,7 +114,7 @@ const useChangeHandlers = _ref => {
114
114
  appOnTimeChange(appTimeString, metaInfo); // don't do this on useEffect to avoid complete chaos
115
115
 
116
116
  setTimeString(newTimeString);
117
- const newDateTimeString = "".concat(tempDateString, " ").concat(newTimeString);
117
+ const newDateTimeString = `${tempDateString} ${newTimeString}`;
118
118
 
119
119
  const newMetaInfo = _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, metaInfo), getTimeMetaInfo(newTimeString, metaInfo)), getDateMetaInfo(tempDateString, metaInfo)), {}, {
120
120
  newDateTimeString,
@@ -59,7 +59,7 @@ const useControlledDateTimePicker = props => {
59
59
  isDateTimeSelector,
60
60
  isWithTimeInputs
61
61
  } = flags;
62
- const ariaCurrentValueForInputs = "current values: ".concat(isWithDateInputs ? "".concat(announcedDateValues) : '').concat(isDateTimeSelector ? ', ' : '').concat(isWithTimeInputs ? "".concat(announcedTimeValues) : '');
62
+ const ariaCurrentValueForInputs = `current values: ${isWithDateInputs ? `${announcedDateValues}` : ''}${isDateTimeSelector ? ', ' : ''}${isWithTimeInputs ? `${announcedTimeValues}` : ''}`;
63
63
  const ctx = React.useMemo(() => _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({
64
64
  props: propsWithDefaults,
65
65
  ariaCurrentValueForInputs,
@@ -1,6 +1,6 @@
1
- import 'core-js/modules/web.dom-collections.iterator.js';
2
1
  import { useState, useCallback, useMemo } from 'react';
3
2
 
3
+ /* eslint-disable max-lines */
4
4
  const useFocusTracker = _ref => {
5
5
  let {
6
6
  DOMRefs,
@@ -34,8 +34,8 @@ const useGetDestructuredDateValues = _ref => {
34
34
  const yearNum = convertToPositiveNumberIfPossible(year);
35
35
  const announcedMonth = monthNum !== -1 ? monthNames[monthNum - 1] : 'empty month';
36
36
  const announcedDay = dayNum !== -1 ? announcableCardinalDays[dayNum] : 'empty day';
37
- const announcedYear = yearNum !== -1 ? fillStringWithPlaceHolders("".concat(yearNum), 4, '0') : 'empty year';
38
- const announcedDateValues = "".concat(announcedMonth, ", ").concat(announcedDay, ", ").concat(announcedYear);
37
+ const announcedYear = yearNum !== -1 ? fillStringWithPlaceHolders(`${yearNum}`, 4, '0') : 'empty year';
38
+ const announcedDateValues = `${announcedMonth}, ${announcedDay}, ${announcedYear}`;
39
39
  return useMemo(() => ({
40
40
  month,
41
41
  day,
@@ -69,12 +69,12 @@ const useGetDestructuredTimeValues = _ref2 => {
69
69
  const hoursNum = convertToPositiveNumberIfPossible(hours);
70
70
  const minutesNum = convertToPositiveNumberIfPossible(minutes); // 01 -> 1 ~ 09 -> 9 || 1_ -> 1 ~ 9_ -> 9 || empty...
71
71
 
72
- const announcedHours = hoursNum !== -1 ? "".concat(hoursNum) : 'empty hours'; // 01 -> 1 ~ 09 -> 9 || 1_ -> 1 ~ 9_ -> 9 || empty...
72
+ const announcedHours = hoursNum !== -1 ? `${hoursNum}` : 'empty hours'; // 01 -> 1 ~ 09 -> 9 || 1_ -> 1 ~ 9_ -> 9 || empty...
73
73
 
74
- const announcedMinutes = minutesNum !== -1 ? "".concat(minutesNum) : 'empty minutes';
74
+ const announcedMinutes = minutesNum !== -1 ? `${minutesNum}` : 'empty minutes';
75
75
  const announcedMeridiem = // eslint-disable-next-line no-nested-ternary
76
- meridiem === 'PM' ? "post meridiem" : meridiem === 'AM' ? 'ante meridiem' : 'empty meriediem';
77
- const announcedTimeValues = "".concat(announcedHours, ", ").concat(announcedMinutes, ", ").concat(announcedMeridiem);
76
+ meridiem === 'PM' ? `post meridiem` : meridiem === 'AM' ? 'ante meridiem' : 'empty meriediem';
77
+ const announcedTimeValues = `${announcedHours}, ${announcedMinutes}, ${announcedMeridiem}`;
78
78
  return useMemo(() => ({
79
79
  hours,
80
80
  minutes,
@@ -23,7 +23,7 @@ const useGetPropsBasedOnType = propsWithDefaults => {
23
23
  const appOnMonthChange = (isDateTime || isDate) && propsWithDefaults.onMonthChange ? propsWithDefaults.onMonthChange : noop;
24
24
  const appOnDayChange = (isDateTime || isDate) && propsWithDefaults.onDayChange ? propsWithDefaults.onDayChange : noop;
25
25
  const appOnYearChange = (isDateTime || isDate) && propsWithDefaults.onYearChange ? propsWithDefaults.onYearChange : noop;
26
- const emptyPickerStartingMonthDefault = "".concat(new Date().getMonth() + 1, "/__/").concat(new Date().getFullYear());
26
+ const emptyPickerStartingMonthDefault = `${new Date().getMonth() + 1}/__/${new Date().getFullYear()}`;
27
27
  const emptyPickerStartingMonth = (isDateTime || isDate) && propsWithDefaults.emptyPickerStartingMonth ? propsWithDefaults.emptyPickerStartingMonth : emptyPickerStartingMonthDefault;
28
28
  const onCalendarOpenFocusedDay = (isDateTime || isDate) && propsWithDefaults.onCalendarOpenFocusedDay ? propsWithDefaults.onCalendarOpenFocusedDay : undefined;
29
29
  /* -------------------------- -------------- --------------------------*/
@@ -1,6 +1,6 @@
1
- import 'core-js/modules/web.dom-collections.iterator.js';
2
1
  import { useState, useRef, useMemo } from 'react';
3
2
 
3
+ /* eslint-disable complexity */
4
4
  const useGetReferences = _ref => {
5
5
  let {
6
6
  isWithDateInputs,
@@ -1,8 +1,8 @@
1
- import 'core-js/modules/web.dom-collections.iterator.js';
2
1
  import { useMemo, useState } from 'react';
3
2
  import { getIsDateTime, getIsDate, getIsTime } from '../utils/typeGuards.js';
4
3
  import { dateTimeToDate, dateTimeToTime } from '../utils/stringHelpers.js';
5
4
 
5
+ /* eslint-disable complexity */
6
6
  const useRelevantValueFromProps = props => {
7
7
  const dateStringFromProps = useMemo(() => {
8
8
  if (getIsDateTime(props)) return props.dateTime !== '' ? dateTimeToDate(props.dateTime) : '__/__/____';
@@ -1,43 +1,74 @@
1
+ import 'core-js/modules/es.error.cause.js';
1
2
  import { deconstructValuesFromDateString, isValidDateString, dateTimeToDate, isValidTimeString, dateTimeToTime } from '../utils/stringHelpers.js';
2
3
  import { convertToPositiveNumberIfPossible } from '../utils/numberHelpers.js';
3
4
  import { getIsDateTime, getIsDate, getIsTime } from '../utils/typeGuards.js';
4
5
 
5
- /* eslint-disable max-statements */
6
- const PREPEND = "ControlledDateTimePicker:\n Invalid configuration detected::\n \n ";
6
+ const PREPEND = `ControlledDateTimePicker:
7
+ Invalid configuration detected::
8
+
9
+ `;
7
10
  const NOT_A_DEFECT = ''; // '\n\n\t\tThis is not a defect, please check\n\n\t\thttps://qa.dimsum.rd.elliemae.io/?path=/story/components-desktop-components-d-controlledform-date-time-picker--basic\n\n\t\tfor instructions on how to use the component correctly\n\n';
8
11
 
9
- const INLINE_RECEIVED_PREPEND = "\n\n Received:";
12
+ const INLINE_RECEIVED_PREPEND = `
13
+
14
+ Received:`;
10
15
 
11
16
  const throwInvalidDateTimeError = invalidValue => {
12
- throw new Error("".concat(PREPEND, "the \"dateTime\" you are providing is not respecting the format it must respect.").concat(INLINE_RECEIVED_PREPEND).concat(invalidValue, "(").concat(typeof invalidValue, ")").concat(NOT_A_DEFECT));
17
+ throw new Error(`${PREPEND}the "dateTime" you are providing is not respecting the format it must respect.${INLINE_RECEIVED_PREPEND}${invalidValue}(${typeof invalidValue})${NOT_A_DEFECT}`);
13
18
  };
14
19
 
15
20
  const throwInvalidDaterror = invalidValue => {
16
- throw new Error("".concat(PREPEND, "the \"date\" you are providing is not respecting the format it must respect.").concat(INLINE_RECEIVED_PREPEND).concat(invalidValue, "(").concat(typeof invalidValue, ")").concat(NOT_A_DEFECT));
21
+ throw new Error(`${PREPEND}the "date" you are providing is not respecting the format it must respect.${INLINE_RECEIVED_PREPEND}${invalidValue}(${typeof invalidValue})${NOT_A_DEFECT}`);
17
22
  };
18
23
 
19
24
  const throwInvalidTimerror = invalidValue => {
20
- throw new Error("".concat(PREPEND, "the \"time\" you are providing is not respecting the format it must respect.").concat(INLINE_RECEIVED_PREPEND).concat(invalidValue, "(").concat(typeof invalidValue, ")").concat(NOT_A_DEFECT));
25
+ throw new Error(`${PREPEND}the "time" you are providing is not respecting the format it must respect.${INLINE_RECEIVED_PREPEND}${invalidValue}(${typeof invalidValue})${NOT_A_DEFECT}`);
21
26
  };
22
27
 
23
28
  const throwUncontrolledDateError = (date, onDateChange) => {
24
- throw new Error("".concat(PREPEND, "you are trying to use a date selector while providing a non-string \"date\" or providing a non-function to \"onDateChange\"\n the full-controlled pattern must be used\n\tcheck https://reactjs.org/docs/forms.html#controlled-components for more informations\n\n Received:\n date: ").concat(date, "(").concat(typeof date, ")\n onDateChange: (").concat(typeof onDateChange, ")\n ").concat(NOT_A_DEFECT));
29
+ throw new Error(`${PREPEND}you are trying to use a date selector while providing a non-string "date" or providing a non-function to "onDateChange"
30
+ the full-controlled pattern must be used\n\tcheck https://reactjs.org/docs/forms.html#controlled-components for more informations
31
+
32
+ Received:
33
+ date: ${date}(${typeof date})
34
+ onDateChange: (${typeof onDateChange})
35
+ ${NOT_A_DEFECT}`);
25
36
  };
26
37
 
27
38
  const throwUncontrolledTimeError = (time, onTimeChange) => {
28
- throw new Error("".concat(PREPEND, "you are trying to use a time selector while providing a non-string \"time\" or providing a non-function to \"onTimeChange\"\n the full-controlled pattern must be used\n\tcheck https://reactjs.org/docs/forms.html#controlled-components for more informations\n\n Received:\n time: ").concat(time, "(").concat(typeof time, ")\n onTimeChange: (").concat(typeof onTimeChange, ")\n ").concat(NOT_A_DEFECT));
39
+ throw new Error(`${PREPEND}you are trying to use a time selector while providing a non-string "time" or providing a non-function to "onTimeChange"
40
+ the full-controlled pattern must be used\n\tcheck https://reactjs.org/docs/forms.html#controlled-components for more informations
41
+
42
+ Received:
43
+ time: ${time}(${typeof time})
44
+ onTimeChange: (${typeof onTimeChange})
45
+ ${NOT_A_DEFECT}`);
29
46
  };
30
47
 
31
48
  const throwUncontrolledDateTimeError = (dateTime, onDateTimeChange) => {
32
- throw new Error("".concat(PREPEND, "you are trying to use a date-time selector while providing a non-string \"dateTime\" or providing a non-function to \"onDateTimeChange\"\n the full-controlled pattern must be used\n\tcheck https://reactjs.org/docs/forms.html#controlled-components for more informations\n\n Received:\n dateTime: ").concat(dateTime, "(").concat(typeof dateTime, ")\n onDateTimeChange: (").concat(typeof onDateTimeChange, ")\n ").concat(NOT_A_DEFECT));
49
+ throw new Error(`${PREPEND}you are trying to use a date-time selector while providing a non-string "dateTime" or providing a non-function to "onDateTimeChange"
50
+ the full-controlled pattern must be used\n\tcheck https://reactjs.org/docs/forms.html#controlled-components for more informations
51
+
52
+ Received:
53
+ dateTime: ${dateTime}(${typeof dateTime})
54
+ onDateTimeChange: (${typeof onDateTimeChange})
55
+ ${NOT_A_DEFECT}`);
33
56
  };
34
57
 
35
58
  const throwInvalidEmptyPickerStartingMonthError = emptyPickerStartingMonth => {
36
- throw new Error("".concat(PREPEND, "the provided emptyPickerStartingMonth props is invalid. please provide a string with the format mm/__/yyyy, (mm 01~12, yyyy 0001~9999) \n\n Received:\n ").concat(emptyPickerStartingMonth, "(").concat(typeof emptyPickerStartingMonth, ")\n ").concat(NOT_A_DEFECT));
59
+ throw new Error(`${PREPEND}the provided emptyPickerStartingMonth props is invalid. please provide a string with the format mm/__/yyyy, (mm 01~12, yyyy 0001~9999)
60
+
61
+ Received:
62
+ ${emptyPickerStartingMonth}(${typeof emptyPickerStartingMonth})
63
+ ${NOT_A_DEFECT}`);
37
64
  };
38
65
 
39
66
  const throwInvalidOnCalendarOpenFocusedDayError = onCalendarOpenFocusedDay => {
40
- throw new Error("".concat(PREPEND, "the provided onCalendarOpenFocusedDay props is invalid. please provide a string with the format mm/dd/yyyy, (mm 01~12, dd 01~31, yyyy 0001~9999) \n\n Received:\n ").concat(onCalendarOpenFocusedDay, "(").concat(typeof onCalendarOpenFocusedDay, ")\n ").concat(NOT_A_DEFECT));
67
+ throw new Error(`${PREPEND}the provided onCalendarOpenFocusedDay props is invalid. please provide a string with the format mm/dd/yyyy, (mm 01~12, dd 01~31, yyyy 0001~9999)
68
+
69
+ Received:
70
+ ${onCalendarOpenFocusedDay}(${typeof onCalendarOpenFocusedDay})
71
+ ${NOT_A_DEFECT}`);
41
72
  };
42
73
 
43
74
  const useValidateProps = props => {
@@ -38,10 +38,8 @@ const ClearButton = () => {
38
38
  size: BUTTON_SIZES.M,
39
39
  "data-testid": ControlledDateTimePickerDatatestid.CLEAR_BUTTON,
40
40
  innerRef: DomElem => {
41
- var _DomElem$focus;
42
-
43
41
  clearButtonRef.current = DomElem;
44
- if (latestInteractionRegion === 'clear-btn' && currFocusDescriber === 'clear-btn') DomElem === null || DomElem === void 0 ? void 0 : (_DomElem$focus = DomElem.focus) === null || _DomElem$focus === void 0 ? void 0 : _DomElem$focus.call(DomElem);
42
+ if (latestInteractionRegion === 'clear-btn' && currFocusDescriber === 'clear-btn') DomElem?.focus?.();
45
43
  },
46
44
  onClick: onClearClick,
47
45
  onKeyDown: onClearButtonKeyDown
@@ -25,9 +25,7 @@ const DDInput = /*#__PURE__*/React.memo(_ref => {
25
25
  isFocused
26
26
  } = _ref;
27
27
  const validateOnChange = useCallback(e => {
28
- var _e$target;
29
-
30
- if (isInvalidDay(e === null || e === void 0 ? void 0 : (_e$target = e.target) === null || _e$target === void 0 ? void 0 : _e$target.value)) {
28
+ if (isInvalidDay(e?.target?.value)) {
31
29
  e.preventDefault();
32
30
  return;
33
31
  }
@@ -41,13 +39,11 @@ const DDInput = /*#__PURE__*/React.memo(_ref => {
41
39
  onKeyDown: onKeyDown,
42
40
  value: value,
43
41
  ref: DomElem => {
44
- var _DomElem$focus;
45
-
46
42
  contextRef.current = DomElem;
47
- if (isFocused) DomElem === null || DomElem === void 0 ? void 0 : (_DomElem$focus = DomElem.focus) === null || _DomElem$focus === void 0 ? void 0 : _DomElem$focus.call(DomElem);
43
+ if (isFocused) DomElem?.focus?.();
48
44
  },
49
45
  placeholder: placeholder,
50
- "aria-label": "day input field, ".concat(ariaCurrentValueForInputs),
46
+ "aria-label": `day input field, ${ariaCurrentValueForInputs}`,
51
47
  "data-testid": ControlledDateTimePickerDatatestid.DATE_INPUTS.DAY,
52
48
  disabled: disabled,
53
49
  "aria-disabled": disabled
@@ -26,9 +26,7 @@ const MMInput = /*#__PURE__*/React.memo(_ref => {
26
26
  isFocused
27
27
  } = _ref;
28
28
  const validateOnChange = useCallback(e => {
29
- var _e$target;
30
-
31
- if (isInvalidMonth(e === null || e === void 0 ? void 0 : (_e$target = e.target) === null || _e$target === void 0 ? void 0 : _e$target.value)) {
29
+ if (isInvalidMonth(e?.target?.value)) {
32
30
  e.preventDefault();
33
31
  return;
34
32
  }
@@ -43,13 +41,11 @@ const MMInput = /*#__PURE__*/React.memo(_ref => {
43
41
  onKeyDown: onKeyDown,
44
42
  value: value,
45
43
  ref: DomElem => {
46
- var _DomElem$focus;
47
-
48
44
  contextRef.current = DomElem;
49
- if (isFocused) DomElem === null || DomElem === void 0 ? void 0 : (_DomElem$focus = DomElem.focus) === null || _DomElem$focus === void 0 ? void 0 : _DomElem$focus.call(DomElem);
45
+ if (isFocused) DomElem?.focus?.();
50
46
  },
51
47
  placeholder: placeholder,
52
- "aria-label": "month input field, ".concat(ariaCurrentValueForInputs),
48
+ "aria-label": `month input field, ${ariaCurrentValueForInputs}`,
53
49
  "data-testid": ControlledDateTimePickerDatatestid.DATE_INPUTS.MONTH,
54
50
  disabled: disabled,
55
51
  "aria-disabled": disabled
@@ -25,9 +25,7 @@ const YYYYInput = /*#__PURE__*/React.memo(_ref => {
25
25
  isFocused
26
26
  } = _ref;
27
27
  const validateOnChange = useCallback(e => {
28
- var _e$target;
29
-
30
- if (isInvalidYear(e === null || e === void 0 ? void 0 : (_e$target = e.target) === null || _e$target === void 0 ? void 0 : _e$target.value)) {
28
+ if (isInvalidYear(e?.target?.value)) {
31
29
  e.preventDefault();
32
30
  return;
33
31
  }
@@ -41,13 +39,11 @@ const YYYYInput = /*#__PURE__*/React.memo(_ref => {
41
39
  onKeyDown: onKeyDown,
42
40
  value: value,
43
41
  ref: DomElem => {
44
- var _DomElem$focus;
45
-
46
42
  contextRef.current = DomElem;
47
- if (isFocused) DomElem === null || DomElem === void 0 ? void 0 : (_DomElem$focus = DomElem.focus) === null || _DomElem$focus === void 0 ? void 0 : _DomElem$focus.call(DomElem);
43
+ if (isFocused) DomElem?.focus?.();
48
44
  },
49
45
  placeholder: placeholder,
50
- "aria-label": "year input field, ".concat(ariaCurrentValueForInputs),
46
+ "aria-label": `year input field, ${ariaCurrentValueForInputs}`,
51
47
  "data-testid": ControlledDateTimePickerDatatestid.DATE_INPUTS.YEAR,
52
48
  disabled: disabled,
53
49
  "aria-disabled": disabled
@@ -67,9 +67,7 @@ const useDateInputs = () => {
67
67
  trackFocusMonthInput();
68
68
  }, [trackFocusMonthInput]);
69
69
  const onMonthChange = useCallback(e => {
70
- var _e$target;
71
-
72
- let newMonth = e === null || e === void 0 ? void 0 : (_e$target = e.target) === null || _e$target === void 0 ? void 0 : _e$target.value; // converts months 2~9 to 02~09
70
+ let newMonth = e?.target?.value; // converts months 2~9 to 02~09
73
71
 
74
72
  if (Number.parseInt(newMonth, 10) > 1) newMonth = prependStringWithPlaceHolders(newMonth, 2);
75
73
  handleChangeMonth(newMonth, e); // auto-advance functionality:
@@ -92,12 +90,12 @@ const useDateInputs = () => {
92
90
  const monthInteger = Number.isNaN(monthStringConvertedToInteger) ? 0 : monthStringConvertedToInteger;
93
91
  let newMonth;
94
92
  if (key === 'ArrowUp') newMonth = monthInteger + 1 <= 12 ? monthInteger + 1 : monthInteger;else newMonth = monthInteger - 1 > 0 ? monthInteger - 1 : 1;
95
- newMonth = prependStringWithPlaceHolders("".concat(newMonth), 2);
93
+ newMonth = prependStringWithPlaceHolders(`${newMonth}`, 2);
96
94
  handleChangeMonth(newMonth, e);
97
95
  }
98
96
 
99
97
  if (!Number.isNaN(monthStringConvertedToInteger) && (key === '-' || key === '/' || key === '\\')) {
100
- const newMonth = prependStringWithPlaceHolders("".concat(monthStringConvertedToInteger), 2);
98
+ const newMonth = prependStringWithPlaceHolders(`${monthStringConvertedToInteger}`, 2);
101
99
  handleChangeMonth(newMonth, e); // auto-advance functionality:
102
100
 
103
101
  if (newMonth.length === 2) trackFocusDayInput();
@@ -107,9 +105,7 @@ const useDateInputs = () => {
107
105
  if ((ctrlKey || metaKey) && key === ';') trackFocusLastSegment();
108
106
  }, [month, onHomeKeyDown, onEndKeyDown, trackFocusLastSegment, trackFocusDayInput, handleChangeMonth]);
109
107
  const onMonthBlur = useCallback(e => {
110
- var _e$target2;
111
-
112
- const newMonth = e === null || e === void 0 ? void 0 : (_e$target2 = e.target) === null || _e$target2 === void 0 ? void 0 : _e$target2.value;
108
+ const newMonth = e?.target?.value;
113
109
  if (newMonth === '0') handleChangeMonth('01', e, {
114
110
  isAutomaticFillTrigger: true
115
111
  });else if (newMonth.length > 0 && newMonth.length < 2) handleChangeMonth(prependStringWithPlaceHolders(newMonth, 2), e, {
@@ -135,9 +131,7 @@ const useDateInputs = () => {
135
131
  trackFocusDayInput();
136
132
  }, [trackFocusDayInput]);
137
133
  const onDayChange = useCallback(e => {
138
- var _e$target3;
139
-
140
- let newDay = e === null || e === void 0 ? void 0 : (_e$target3 = e.target) === null || _e$target3 === void 0 ? void 0 : _e$target3.value; // converts days 4~9 to 04~09
134
+ let newDay = e?.target?.value; // converts days 4~9 to 04~09
141
135
 
142
136
  if (Number.parseInt(newDay, 10) > 3) newDay = prependStringWithPlaceHolders(newDay, 2);
143
137
  handleChangeDay(newDay, e); // auto-advance functionality:
@@ -160,19 +154,19 @@ const useDateInputs = () => {
160
154
  const dayInteger = Number.isNaN(dayStringConvertedToInteger) ? 0 : dayStringConvertedToInteger;
161
155
  let newDay;
162
156
  if (key === 'ArrowUp') newDay = dayInteger + 1 <= 31 ? dayInteger + 1 : dayInteger;else newDay = dayInteger - 1 > 0 ? dayInteger - 1 : 1;
163
- newDay = prependStringWithPlaceHolders("".concat(newDay), 2);
157
+ newDay = prependStringWithPlaceHolders(`${newDay}`, 2);
164
158
  handleChangeDay(newDay, e);
165
159
  }
166
160
 
167
161
  if (!Number.isNaN(dayStringConvertedToInteger) && (key === '-' || key === '/' || key === '\\')) {
168
- const newDay = prependStringWithPlaceHolders("".concat(dayStringConvertedToInteger), 2);
162
+ const newDay = prependStringWithPlaceHolders(`${dayStringConvertedToInteger}`, 2);
169
163
  handleChangeDay(newDay, e); // auto-advance functionality:
170
164
 
171
165
  if (newDay.length === 2) trackFocusYearInput();
172
166
  } // regressive backspace functionality
173
167
 
174
168
 
175
- if (key === 'Backspace' && (day === null || day === void 0 ? void 0 : day.length) === 0) {
169
+ if (key === 'Backspace' && day?.length === 0) {
176
170
  trackFocusMonthInput();
177
171
  } // focus last fragment on fill with now
178
172
 
@@ -180,9 +174,7 @@ const useDateInputs = () => {
180
174
  if ((ctrlKey || metaKey) && key === ';') trackFocusLastSegment();
181
175
  }, [day, onHomeKeyDown, onEndKeyDown, trackFocusLastSegment, handleChangeDay, trackFocusYearInput, trackFocusMonthInput]);
182
176
  const onDayBlur = useCallback(e => {
183
- var _e$target4;
184
-
185
- const newDay = e === null || e === void 0 ? void 0 : (_e$target4 = e.target) === null || _e$target4 === void 0 ? void 0 : _e$target4.value;
177
+ const newDay = e?.target?.value;
186
178
  if (newDay === '0') handleChangeDay('01', e, {
187
179
  isAutomaticFillTrigger: true
188
180
  });else if (newDay.length > 0 && newDay.length < 2) handleChangeDay(prependStringWithPlaceHolders(newDay, 2), e, {
@@ -208,9 +200,7 @@ const useDateInputs = () => {
208
200
  trackFocusYearInput();
209
201
  }, [trackFocusYearInput]);
210
202
  const onYearChange = useCallback(e => {
211
- var _e$target5;
212
-
213
- const newYear = e === null || e === void 0 ? void 0 : (_e$target5 = e.target) === null || _e$target5 === void 0 ? void 0 : _e$target5.value;
203
+ const newYear = e?.target?.value;
214
204
  handleChangeYear(newYear, e); // auto-advance functionality:
215
205
 
216
206
  if (newYear.length === 4) {
@@ -229,12 +219,12 @@ const useDateInputs = () => {
229
219
 
230
220
  const yearStringConvertedToInteger = Number.parseInt(year, 10);
231
221
  const yearInteger = Number.isNaN(yearStringConvertedToInteger) ? 0 : yearStringConvertedToInteger;
232
- let newYear = yearInteger !== 0 ? fillStringWithPlaceHolders("".concat(yearInteger), 4, '0') : '';
222
+ let newYear = yearInteger !== 0 ? fillStringWithPlaceHolders(`${yearInteger}`, 4, '0') : '';
233
223
 
234
224
  if (key === 'ArrowUp' || key === 'ArrowDown') {
235
225
  let newYearInteger;
236
226
  if (key === 'ArrowUp') newYearInteger = yearInteger + 1 <= 9999 ? yearInteger + 1 : yearInteger;else newYearInteger = yearInteger - 1 > 0 ? yearInteger - 1 : 1;
237
- newYear = prependStringWithPlaceHolders("".concat(newYearInteger), 4);
227
+ newYear = prependStringWithPlaceHolders(`${newYearInteger}`, 4);
238
228
  }
239
229
 
240
230
  const isAutomaticFillTrigger = newYear !== year && ['Tab', ' '].includes(key);
@@ -267,7 +257,7 @@ const useDateInputs = () => {
267
257
  /* ********** regressive backspace logic ********** */
268
258
 
269
259
 
270
- if (key === 'Backspace' && (year === null || year === void 0 ? void 0 : year.length) === 0) {
260
+ if (key === 'Backspace' && year?.length === 0) {
271
261
  trackFocusDayInput();
272
262
  } // focus last fragment on fill with now
273
263
 
@@ -19,7 +19,7 @@ const CalendarDaysList = /*#__PURE__*/React.memo(_ref => {
19
19
  children: [invisibleFirstDay ? /*#__PURE__*/_jsx(Day, {
20
20
  metaDay: invisibleFirstDay,
21
21
  isInvisible: true
22
- }, "ds-calendar-".concat(invisibleFirstDay.day.toString())) : null, daysMatrixByWeekday.map((week, i) => /*#__PURE__*/_jsx(StyledWeekDaysListWrapper, {
22
+ }, `ds-calendar-${invisibleFirstDay.day.toString()}`) : null, daysMatrixByWeekday.map((week, i) => /*#__PURE__*/_jsx(StyledWeekDaysListWrapper, {
23
23
  role: "row",
24
24
  "aria-rowindex": i + 1,
25
25
  cols: ['32px', '32px', '32px', '32px', '32px', '32px', '32px'],
@@ -28,13 +28,13 @@ const CalendarDaysList = /*#__PURE__*/React.memo(_ref => {
28
28
  px: "2px",
29
29
  justifyContent: "space-between",
30
30
  alignItems: "center"
31
- }, "ds-calendar-week-".concat(week[0].day.toString(), "-").concat(week[6].day.toString()), week.map((metaDay, z) => /*#__PURE__*/_jsx(Day, {
31
+ }, `ds-calendar-week-${week[0].day.toString()}-${week[6].day.toString()}`, week.map((metaDay, z) => /*#__PURE__*/_jsx(Day, {
32
32
  metaDay: metaDay,
33
33
  colIndex: z + 1
34
- }, "ds-calendar-".concat(metaDay.day.toString()))))), invisibleLastDay ? /*#__PURE__*/_jsx(Day, {
34
+ }, `ds-calendar-${metaDay.day.toString()}`)))), invisibleLastDay ? /*#__PURE__*/_jsx(Day, {
35
35
  metaDay: invisibleLastDay,
36
36
  isInvisible: true
37
- }, "ds-calendar-".concat(invisibleLastDay.day.toString())) : null]
37
+ }, `ds-calendar-${invisibleLastDay.day.toString()}`) : null]
38
38
  });
39
39
  });
40
40
 
@@ -15,8 +15,8 @@ const useGetFormattedCurrentDate = () => {
15
15
  currentMonth,
16
16
  currentYear
17
17
  } = useContext(CalendarContext);
18
- const monthString = currentMonth >= 0 && currentMonth <= 11 ? "".concat(getMonthNameByMonthNumber(currentMonth), " ") : '';
19
- return useMemo(() => "".concat(monthString).concat(currentYear), [monthString, currentYear]);
18
+ const monthString = currentMonth >= 0 && currentMonth <= 11 ? `${getMonthNameByMonthNumber(currentMonth)} ` : '';
19
+ return useMemo(() => `${monthString}${currentYear}`, [monthString, currentYear]);
20
20
  };
21
21
 
22
22
  const CalendarHead = () => {
@@ -46,28 +46,20 @@ const CalendarHead = () => {
46
46
  currFocusDescriber
47
47
  } = useContext(ControlledDateTimePickerContext);
48
48
  const handlePrevYearRef = useCallback(ButtonDomNode => {
49
- var _ButtonDomNode$focus;
50
-
51
49
  prevYearBtnRef.current = ButtonDomNode;
52
- if (latestInteractionRegion === 'calendar-head' && currFocusDescriber === 'calendar-prev-year') ButtonDomNode === null || ButtonDomNode === void 0 ? void 0 : (_ButtonDomNode$focus = ButtonDomNode.focus) === null || _ButtonDomNode$focus === void 0 ? void 0 : _ButtonDomNode$focus.call(ButtonDomNode);
50
+ if (latestInteractionRegion === 'calendar-head' && currFocusDescriber === 'calendar-prev-year') ButtonDomNode?.focus?.();
53
51
  }, [currFocusDescriber, latestInteractionRegion, prevYearBtnRef]);
54
52
  const handlePrevMonthRef = useCallback(ButtonDomNode => {
55
- var _ButtonDomNode$focus2;
56
-
57
53
  prevMonthBtnRef.current = ButtonDomNode;
58
- if (latestInteractionRegion === 'calendar-head' && currFocusDescriber === 'calendar-prev-month') ButtonDomNode === null || ButtonDomNode === void 0 ? void 0 : (_ButtonDomNode$focus2 = ButtonDomNode.focus) === null || _ButtonDomNode$focus2 === void 0 ? void 0 : _ButtonDomNode$focus2.call(ButtonDomNode);
54
+ if (latestInteractionRegion === 'calendar-head' && currFocusDescriber === 'calendar-prev-month') ButtonDomNode?.focus?.();
59
55
  }, [currFocusDescriber, latestInteractionRegion, prevMonthBtnRef]);
60
56
  const handleNextMonthRef = useCallback(ButtonDomNode => {
61
- var _ButtonDomNode$focus3;
62
-
63
57
  nextMonthBtnRef.current = ButtonDomNode;
64
- if (latestInteractionRegion === 'calendar-head' && currFocusDescriber === 'calendar-next-month') ButtonDomNode === null || ButtonDomNode === void 0 ? void 0 : (_ButtonDomNode$focus3 = ButtonDomNode.focus) === null || _ButtonDomNode$focus3 === void 0 ? void 0 : _ButtonDomNode$focus3.call(ButtonDomNode);
58
+ if (latestInteractionRegion === 'calendar-head' && currFocusDescriber === 'calendar-next-month') ButtonDomNode?.focus?.();
65
59
  }, [currFocusDescriber, latestInteractionRegion, nextMonthBtnRef]);
66
60
  const handleNextYearRef = useCallback(ButtonDomNode => {
67
- var _ButtonDomNode$focus4;
68
-
69
61
  nextYearBtnRef.current = ButtonDomNode;
70
- if (latestInteractionRegion === 'calendar-head' && currFocusDescriber === 'calendar-next-year') ButtonDomNode === null || ButtonDomNode === void 0 ? void 0 : (_ButtonDomNode$focus4 = ButtonDomNode.focus) === null || _ButtonDomNode$focus4 === void 0 ? void 0 : _ButtonDomNode$focus4.call(ButtonDomNode);
62
+ if (latestInteractionRegion === 'calendar-head' && currFocusDescriber === 'calendar-next-year') ButtonDomNode?.focus?.();
71
63
  }, [currFocusDescriber, latestInteractionRegion, nextYearBtnRef]);
72
64
  return /*#__PURE__*/_jsx(StyledHeader, {}, void 0, /*#__PURE__*/_jsx(StyledHeaderButton, {
73
65
  "aria-label": "previous year",