@elliemae/ds-controlled-form 2.4.1 → 2.4.2-rc.3

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 (192) hide show
  1. package/cjs/autocomplete/config/useAutocomplete.js +1 -3
  2. package/cjs/checkbox/ControlledCheckbox.js +49 -33
  3. package/cjs/checkbox/exported-related/data-test-ids.js +10 -0
  4. package/cjs/checkbox/exported-related/index.js +12 -0
  5. package/cjs/checkbox/exported-related/theming.js +13 -0
  6. package/cjs/checkbox/react-desc-prop-types.js +0 -1
  7. package/cjs/checkbox/styles.js +26 -15
  8. package/cjs/combobox/ComboBoxCTX.js +1 -1
  9. package/cjs/combobox/ComboboxDataTestids.js +1 -1
  10. package/cjs/combobox/config/useComboBox.js +6 -4
  11. package/cjs/combobox/index.js +5 -0
  12. package/cjs/combobox/parts/DropdownIndicator.js +2 -2
  13. package/cjs/combobox/parts/container/Container.js +5 -5
  14. package/cjs/combobox/parts/container/styled.js +13 -7
  15. package/cjs/combobox/parts/controls/Controls.js +14 -4
  16. package/cjs/combobox/parts/controls/styled.js +22 -13
  17. package/cjs/combobox/parts/controls-input/ControlsInput.js +1 -1
  18. package/cjs/combobox/parts/controls-input/styled.js +7 -3
  19. package/cjs/combobox/parts/controls-input/useControlsInput.js +3 -4
  20. package/cjs/combobox/parts/controls-input/useKeyboardNavigation.js +30 -15
  21. package/cjs/combobox/parts/header-list/HeaderList.js +4 -3
  22. package/cjs/combobox/parts/header-list/useHeaderListHandlers.js +9 -5
  23. package/cjs/combobox/parts/menu-list/MenuList.js +5 -2
  24. package/cjs/combobox/parts/menu-list/styled.js +12 -7
  25. package/cjs/combobox/parts/menu-list/useItemRenderer.js +5 -4
  26. package/cjs/combobox/parts/multi-selected-values-container/MultiSelectedValuesContainer.js +1 -1
  27. package/cjs/combobox/parts/multi-selected-values-container/RemovableSelectedValuePill.js +2 -0
  28. package/cjs/combobox/parts/multi-selected-values-container/useGroupPills.js +13 -10
  29. package/cjs/combobox/theming.js +13 -0
  30. package/cjs/combobox/utils/listHelper.js +2 -1
  31. package/cjs/date-time-picker/config/useChangeHandlers.js +8 -12
  32. package/cjs/date-time-picker/config/useControlledDateTimePicker.js +13 -9
  33. package/cjs/date-time-picker/config/useFocusTracker.js +136 -0
  34. package/cjs/date-time-picker/config/useGetReferences.js +40 -19
  35. package/cjs/date-time-picker/config/useGlobalKeyHandlers.js +8 -12
  36. package/cjs/date-time-picker/parts/ClearButton/ClearButton.js +12 -2
  37. package/cjs/date-time-picker/parts/ClearButton/useClearButton.js +12 -25
  38. package/cjs/date-time-picker/parts/ControlledDateTimePickerContent.js +4 -7
  39. package/cjs/date-time-picker/parts/DateInputs/DDInput.js +8 -2
  40. package/cjs/date-time-picker/parts/DateInputs/DateInputs.js +9 -4
  41. package/cjs/date-time-picker/parts/DateInputs/MMInput.js +8 -2
  42. package/cjs/date-time-picker/parts/DateInputs/YYYYInput.js +8 -2
  43. package/cjs/date-time-picker/parts/DateInputs/useDateInputs.js +76 -95
  44. package/cjs/date-time-picker/parts/Pickers/Calendar/CalendarHead.js +31 -5
  45. package/cjs/date-time-picker/parts/Pickers/Calendar/Day.js +16 -10
  46. package/cjs/date-time-picker/parts/Pickers/Calendar/useConfigCalendarCTX.js +12 -12
  47. package/cjs/date-time-picker/parts/Pickers/Calendar/useFocusLogic.js +2 -38
  48. package/cjs/date-time-picker/parts/Pickers/Calendar/useKeyboardHandlers.js +40 -73
  49. package/cjs/date-time-picker/parts/Pickers/Calendar/usePopperTriggerLogic.js +18 -27
  50. package/cjs/date-time-picker/parts/Pickers/CalendarWithTimeWheel/CalendarWithTimeWheelIconTrigger.js +1 -0
  51. package/cjs/date-time-picker/parts/Pickers/CalendarWithTimeWheel/useConfigCalendarWithTimeWheelCTX.js +17 -23
  52. package/cjs/date-time-picker/parts/Pickers/TimeWheel/HoursList.js +13 -7
  53. package/cjs/date-time-picker/parts/Pickers/TimeWheel/MeridiemList.js +14 -8
  54. package/cjs/date-time-picker/parts/Pickers/TimeWheel/MinutesList.js +13 -7
  55. package/cjs/date-time-picker/parts/Pickers/TimeWheel/useKeyboardHandlers.js +36 -230
  56. package/cjs/date-time-picker/parts/Pickers/TimeWheel/usePopperTriggerLogic.js +11 -13
  57. package/cjs/date-time-picker/parts/TimeInputs/HHInput.js +8 -2
  58. package/cjs/date-time-picker/parts/TimeInputs/MeridiemInput.js +8 -2
  59. package/cjs/date-time-picker/parts/TimeInputs/MinutesInput.js +8 -2
  60. package/cjs/date-time-picker/parts/TimeInputs/TimeInputs.js +11 -6
  61. package/cjs/date-time-picker/parts/TimeInputs/useTimeInputs.js +44 -74
  62. package/cjs/date-time-picker/utils/constants.js +0 -12
  63. package/cjs/date-time-picker/utils/hooks/useGetStartingFocusedDay.js +38 -36
  64. package/cjs/index.js +16 -7
  65. package/cjs/input-group/InputGroup.js +69 -0
  66. package/cjs/input-group/InputGroupDataTestIds.js +12 -0
  67. package/cjs/input-group/index.js +12 -0
  68. package/cjs/input-group/react-desc-prop-types.js +14 -0
  69. package/cjs/input-group/styled.js +46 -0
  70. package/cjs/mask-hook/hooks/index.js +0 -1
  71. package/cjs/mask-hook/hooks/usePhoneMask.js +2 -2
  72. package/cjs/mask-hook/hooks/useRegExpMask.js +0 -1
  73. package/cjs/mask-hook/index.js +0 -1
  74. package/cjs/text-input/styled/borders.js +1 -1
  75. package/esm/autocomplete/config/useAutocomplete.js +3 -5
  76. package/esm/checkbox/ControlledCheckbox.js +52 -36
  77. package/esm/checkbox/exported-related/data-test-ids.js +6 -0
  78. package/esm/checkbox/exported-related/index.js +2 -0
  79. package/esm/checkbox/exported-related/theming.js +8 -0
  80. package/esm/checkbox/react-desc-prop-types.js +0 -1
  81. package/esm/checkbox/styles.js +25 -15
  82. package/esm/combobox/ComboBoxCTX.js +1 -1
  83. package/esm/combobox/ComboboxDataTestids.js +1 -1
  84. package/esm/combobox/config/useComboBox.js +8 -6
  85. package/esm/combobox/index.js +2 -0
  86. package/esm/combobox/parts/DropdownIndicator.js +2 -2
  87. package/esm/combobox/parts/container/Container.js +7 -7
  88. package/esm/combobox/parts/container/styled.js +13 -6
  89. package/esm/combobox/parts/controls/Controls.js +14 -4
  90. package/esm/combobox/parts/controls/styled.js +22 -13
  91. package/esm/combobox/parts/controls-input/ControlsInput.js +1 -1
  92. package/esm/combobox/parts/controls-input/styled.js +7 -3
  93. package/esm/combobox/parts/controls-input/useControlsInput.js +3 -4
  94. package/esm/combobox/parts/controls-input/useKeyboardNavigation.js +30 -15
  95. package/esm/combobox/parts/header-list/HeaderList.js +4 -3
  96. package/esm/combobox/parts/header-list/useHeaderListHandlers.js +9 -5
  97. package/esm/combobox/parts/menu-list/MenuList.js +5 -2
  98. package/esm/combobox/parts/menu-list/styled.js +12 -7
  99. package/esm/combobox/parts/menu-list/useItemRenderer.js +5 -4
  100. package/esm/combobox/parts/multi-selected-values-container/MultiSelectedValuesContainer.js +1 -1
  101. package/esm/combobox/parts/multi-selected-values-container/RemovableSelectedValuePill.js +2 -0
  102. package/esm/combobox/parts/multi-selected-values-container/useGroupPills.js +13 -10
  103. package/esm/combobox/theming.js +8 -0
  104. package/esm/combobox/utils/listHelper.js +2 -1
  105. package/esm/date-range-picker/config/useRangePickerLogic.js +2 -2
  106. package/esm/date-time-picker/config/useChangeHandlers.js +8 -12
  107. package/esm/date-time-picker/config/useControlledDateTimePicker.js +13 -9
  108. package/esm/date-time-picker/config/useFocusTracker.js +132 -0
  109. package/esm/date-time-picker/config/useGetReferences.js +41 -20
  110. package/esm/date-time-picker/config/useGlobalKeyHandlers.js +8 -12
  111. package/esm/date-time-picker/parts/ClearButton/ClearButton.js +12 -2
  112. package/esm/date-time-picker/parts/ClearButton/useClearButton.js +12 -25
  113. package/esm/date-time-picker/parts/ControlledDateTimePickerContent.js +4 -7
  114. package/esm/date-time-picker/parts/DateInputs/DDInput.js +8 -2
  115. package/esm/date-time-picker/parts/DateInputs/DateInputs.js +9 -4
  116. package/esm/date-time-picker/parts/DateInputs/MMInput.js +8 -2
  117. package/esm/date-time-picker/parts/DateInputs/YYYYInput.js +8 -2
  118. package/esm/date-time-picker/parts/DateInputs/useDateInputs.js +77 -96
  119. package/esm/date-time-picker/parts/Pickers/Calendar/CalendarHead.js +32 -6
  120. package/esm/date-time-picker/parts/Pickers/Calendar/Day.js +16 -10
  121. package/esm/date-time-picker/parts/Pickers/Calendar/useConfigCalendarCTX.js +14 -14
  122. package/esm/date-time-picker/parts/Pickers/Calendar/useFocusLogic.js +3 -39
  123. package/esm/date-time-picker/parts/Pickers/Calendar/useKeyboardHandlers.js +40 -73
  124. package/esm/date-time-picker/parts/Pickers/Calendar/usePopperTriggerLogic.js +18 -27
  125. package/esm/date-time-picker/parts/Pickers/CalendarWithTimeWheel/CalendarWithTimeWheelIconTrigger.js +1 -0
  126. package/esm/date-time-picker/parts/Pickers/CalendarWithTimeWheel/useConfigCalendarWithTimeWheelCTX.js +17 -23
  127. package/esm/date-time-picker/parts/Pickers/TimeWheel/HoursList.js +14 -8
  128. package/esm/date-time-picker/parts/Pickers/TimeWheel/MeridiemList.js +15 -9
  129. package/esm/date-time-picker/parts/Pickers/TimeWheel/MinutesList.js +14 -8
  130. package/esm/date-time-picker/parts/Pickers/TimeWheel/useKeyboardHandlers.js +36 -230
  131. package/esm/date-time-picker/parts/Pickers/TimeWheel/usePopperTriggerLogic.js +11 -13
  132. package/esm/date-time-picker/parts/TimeInputs/HHInput.js +8 -2
  133. package/esm/date-time-picker/parts/TimeInputs/MeridiemInput.js +8 -2
  134. package/esm/date-time-picker/parts/TimeInputs/MinutesInput.js +8 -2
  135. package/esm/date-time-picker/parts/TimeInputs/TimeInputs.js +11 -6
  136. package/esm/date-time-picker/parts/TimeInputs/useTimeInputs.js +44 -74
  137. package/esm/date-time-picker/utils/constants.js +1 -7
  138. package/esm/date-time-picker/utils/hooks/useGetStartingFocusedDay.js +38 -36
  139. package/esm/index.js +5 -1
  140. package/esm/input-group/InputGroup.js +59 -0
  141. package/esm/input-group/InputGroupDataTestIds.js +8 -0
  142. package/esm/input-group/index.js +2 -0
  143. package/esm/input-group/react-desc-prop-types.js +10 -0
  144. package/esm/input-group/styled.js +35 -0
  145. package/esm/mask-hook/hooks/index.js +1 -1
  146. package/esm/mask-hook/hooks/usePhoneMask.js +2 -2
  147. package/esm/mask-hook/hooks/useRegExpMask.js +1 -1
  148. package/esm/mask-hook/index.js +1 -1
  149. package/esm/text-input/styled/borders.js +1 -1
  150. package/esm/toggle/ControlledToggle.js +3 -3
  151. package/package.json +55 -19
  152. package/types/checkbox/exported-related/data-test-ids.d.ts +4 -0
  153. package/types/checkbox/exported-related/index.d.ts +2 -0
  154. package/types/checkbox/exported-related/theming.d.ts +6 -0
  155. package/types/checkbox/react-desc-prop-types.d.ts +3 -3
  156. package/types/checkbox/styles.d.ts +5 -5
  157. package/types/combobox/ComboboxDataTestids.d.ts +1 -1
  158. package/types/combobox/index.d.ts +2 -0
  159. package/types/combobox/parts/container/styled.d.ts +1 -2
  160. package/types/combobox/theming.d.ts +6 -0
  161. package/types/date-time-picker/config/useChangeHandlers.d.ts +3 -1
  162. package/types/date-time-picker/config/useControlledDateTimePicker.d.ts +2 -5
  163. package/types/date-time-picker/config/useFocusTracker.d.ts +38 -0
  164. package/types/date-time-picker/config/useGetPropsBasedOnType.d.ts +6 -6
  165. package/types/date-time-picker/config/useGetReferences.d.ts +30 -36
  166. package/types/date-time-picker/config/useGlobalKeyHandlers.d.ts +3 -1
  167. package/types/date-time-picker/parts/DateInputs/DDInput.d.ts +2 -1
  168. package/types/date-time-picker/parts/DateInputs/MMInput.d.ts +2 -1
  169. package/types/date-time-picker/parts/DateInputs/YYYYInput.d.ts +2 -1
  170. package/types/date-time-picker/parts/Pickers/Calendar/useConfigCalendarCTX.d.ts +14 -0
  171. package/types/date-time-picker/parts/Pickers/Calendar/useFocusLogic.d.ts +1 -2
  172. package/types/date-time-picker/parts/Pickers/Calendar/usePopperTriggerLogic.d.ts +19 -0
  173. package/types/date-time-picker/parts/Pickers/TimeWheel/useKeyboardHandlers.d.ts +0 -6
  174. package/types/date-time-picker/parts/Pickers/TimeWheel/usePopperTriggerLogic.d.ts +14 -0
  175. package/types/date-time-picker/parts/TimeInputs/HHInput.d.ts +2 -1
  176. package/types/date-time-picker/parts/TimeInputs/MeridiemInput.d.ts +2 -1
  177. package/types/date-time-picker/parts/TimeInputs/MinutesInput.d.ts +2 -1
  178. package/types/date-time-picker/propTypes.d.ts +117 -0
  179. package/types/date-time-picker/sharedTypes.d.ts +1 -1
  180. package/types/date-time-picker/utils/constants.d.ts +0 -6
  181. package/types/index.d.ts +1 -0
  182. package/types/input-group/InputGroup.d.ts +5 -0
  183. package/types/input-group/InputGroupDataTestIds.d.ts +6 -0
  184. package/types/input-group/index.d.ts +2 -0
  185. package/types/input-group/react-desc-prop-types.d.ts +19 -0
  186. package/types/input-group/styled.d.ts +7 -0
  187. package/types/input-group/tests/DSInputGroup.test.d.ts +1 -0
  188. package/types/mask-hook/hooks/useRegExpMask.d.ts +0 -1
  189. package/types/text-input/config/useInputText.d.ts +5 -5
  190. package/cjs/combobox/parts/menu-list/useMenuListSetFocusOption.js +0 -51
  191. package/esm/combobox/parts/menu-list/useMenuListSetFocusOption.js +0 -47
  192. package/types/combobox/parts/menu-list/useMenuListSetFocusOption.d.ts +0 -1
@@ -1,6 +1,5 @@
1
1
  import { useContext, useCallback, useMemo } from 'react';
2
2
  import { ControlledDateTimePickerContext } from '../../ControlledDateTimePickerCTX.js';
3
- import { homeEndArrowUpDownSemiKeys, homeEndArrowUpDownSpaceKeys, homeEndArrowUpDownKeys } from '../../utils/constants.js';
4
3
  import { prependStringWithPlaceHolders } from '../../utils/stringHelpers.js';
5
4
 
6
5
  /* eslint-disable complexity */
@@ -9,66 +8,55 @@ const useTimeInputs = () => {
9
8
  props: {
10
9
  disabled
11
10
  },
12
- lastSegmentRef,
13
11
  hours,
14
12
  minutes,
15
13
  meridiem,
16
- hideDate,
17
14
  withAnyRightController,
18
15
  withAnyPicker,
19
16
  withClearBtn,
20
17
  isWithDateInputs,
21
- hourInputRef,
22
- minutesInputRef,
23
- meridiemInputRef,
24
- yearInputRef,
25
- clearButtonRef,
26
- pickerButtonRef,
27
- monthInputRef,
28
18
  autoFocusHourInput,
29
19
  handleChangeHours,
30
20
  handleChangeMinutes,
31
21
  handleChangeMeridiem,
32
- setLatestInteractionRegion,
33
- minutesInterval
22
+ minutesInterval,
23
+ trackFocusFirstSegment,
24
+ trackFocusLastSegment,
25
+ trackFocusHourInput,
26
+ trackFocusMinuteInput,
27
+ trackFocusMeridiemInput,
28
+ trackFocusClearBtn,
29
+ trackFocusPicker,
30
+ trackFocusYearInput
34
31
  } = useContext(ControlledDateTimePickerContext);
35
- const setLatestInteractionRegionTimeInputs = useCallback(() => {
36
- setLatestInteractionRegion('time-inputs');
37
- }, [setLatestInteractionRegion]);
38
32
  const onHomeKeyDown = useCallback(() => {
39
- var _monthInputRef$curren, _monthInputRef$curren2, _hourInputRef$current, _hourInputRef$current2;
40
-
41
- if (!hideDate) monthInputRef === null || monthInputRef === void 0 ? void 0 : (_monthInputRef$curren = monthInputRef.current) === null || _monthInputRef$curren === void 0 ? void 0 : (_monthInputRef$curren2 = _monthInputRef$curren.focus) === null || _monthInputRef$curren2 === void 0 ? void 0 : _monthInputRef$curren2.call(_monthInputRef$curren);else hourInputRef === null || hourInputRef === void 0 ? void 0 : (_hourInputRef$current = hourInputRef.current) === null || _hourInputRef$current === void 0 ? void 0 : (_hourInputRef$current2 = _hourInputRef$current.focus) === null || _hourInputRef$current2 === void 0 ? void 0 : _hourInputRef$current2.call(_hourInputRef$current);
42
- }, [hideDate, monthInputRef, hourInputRef]);
33
+ trackFocusFirstSegment();
34
+ }, [trackFocusFirstSegment]);
43
35
  const onEndKeyDown = useCallback(() => {
44
- var _pickerButtonRef$curr, _pickerButtonRef$curr2, _clearButtonRef$curre, _clearButtonRef$curre2, _meridiemInputRef$cur, _meridiemInputRef$cur2;
45
-
46
- if (withAnyPicker) pickerButtonRef === null || pickerButtonRef === void 0 ? void 0 : (_pickerButtonRef$curr = pickerButtonRef.current) === null || _pickerButtonRef$curr === void 0 ? void 0 : (_pickerButtonRef$curr2 = _pickerButtonRef$curr.focus) === null || _pickerButtonRef$curr2 === void 0 ? void 0 : _pickerButtonRef$curr2.call(_pickerButtonRef$curr);else if (withClearBtn) clearButtonRef === null || clearButtonRef === void 0 ? void 0 : (_clearButtonRef$curre = clearButtonRef.current) === null || _clearButtonRef$curre === void 0 ? void 0 : (_clearButtonRef$curre2 = _clearButtonRef$curre.focus) === null || _clearButtonRef$curre2 === void 0 ? void 0 : _clearButtonRef$curre2.call(_clearButtonRef$curre);else meridiemInputRef === null || meridiemInputRef === void 0 ? void 0 : (_meridiemInputRef$cur = meridiemInputRef.current) === null || _meridiemInputRef$cur === void 0 ? void 0 : (_meridiemInputRef$cur2 = _meridiemInputRef$cur.focus) === null || _meridiemInputRef$cur2 === void 0 ? void 0 : _meridiemInputRef$cur2.call(_meridiemInputRef$cur);
47
- }, [withAnyPicker, pickerButtonRef, withClearBtn, clearButtonRef, meridiemInputRef]);
36
+ trackFocusLastSegment();
37
+ }, [trackFocusLastSegment]);
48
38
  const onHoursFocus = useCallback(() => {
49
- setLatestInteractionRegionTimeInputs();
50
- }, [setLatestInteractionRegionTimeInputs]);
39
+ trackFocusHourInput();
40
+ }, [trackFocusHourInput]);
51
41
  const onHoursChange = useCallback(e => {
52
- var _e$target, _minutesInputRef$curr, _minutesInputRef$curr2;
42
+ var _e$target;
53
43
 
54
44
  let newHours = e === null || e === void 0 ? void 0 : (_e$target = e.target) === null || _e$target === void 0 ? void 0 : _e$target.value; // converts hours 2~9 to 07~09
55
45
 
56
46
  if (Number.parseInt(newHours, 10) > 1) newHours = prependStringWithPlaceHolders(newHours, 2);
57
47
  handleChangeHours(newHours, e); // auto-advance functionality:
58
48
 
59
- if (newHours.length === 2) minutesInputRef === null || minutesInputRef === void 0 ? void 0 : (_minutesInputRef$curr = minutesInputRef.current) === null || _minutesInputRef$curr === void 0 ? void 0 : (_minutesInputRef$curr2 = _minutesInputRef$curr.focus) === null || _minutesInputRef$curr2 === void 0 ? void 0 : _minutesInputRef$curr2.call(_minutesInputRef$curr);
60
- }, [minutesInputRef, handleChangeHours]);
49
+ if (newHours.length === 2) trackFocusMinuteInput();
50
+ }, [handleChangeHours, trackFocusMinuteInput]);
61
51
  const onHoursKeyDown = useCallback(e => {
62
- var _lastSegmentRef$curre, _lastSegmentRef$curre2;
63
-
64
52
  const {
65
53
  key,
66
54
  ctrlKey,
67
55
  metaKey
68
56
  } = e;
69
57
  const hoursStringConvertedToInteger = Number.parseInt(hours, 10);
70
- if (homeEndArrowUpDownSemiKeys.includes(key)) e.preventDefault();
71
- if (homeEndArrowUpDownSemiKeys.includes(key)) e.stopPropagation();
58
+ if (['Home', 'End', 'ArrowUp', 'ArrowDown', ':'].includes(key)) e.preventDefault();
59
+ if (['Home', 'End', 'ArrowUp', 'ArrowDown', ':'].includes(key)) e.stopPropagation();
72
60
  if (key === 'Home') onHomeKeyDown();
73
61
  if (key === 'End') onEndKeyDown();
74
62
 
@@ -81,24 +69,20 @@ const useTimeInputs = () => {
81
69
  }
82
70
 
83
71
  if (!Number.isNaN(hoursStringConvertedToInteger) && key === ':') {
84
- var _minutesInputRef$curr3, _minutesInputRef$curr4;
85
-
86
72
  const newHours = prependStringWithPlaceHolders("".concat(hoursStringConvertedToInteger), 2);
87
73
  handleChangeHours(newHours, e); // auto-advance functionality:
88
74
 
89
- if (newHours.length === 2) minutesInputRef === null || minutesInputRef === void 0 ? void 0 : (_minutesInputRef$curr3 = minutesInputRef.current) === null || _minutesInputRef$curr3 === void 0 ? void 0 : (_minutesInputRef$curr4 = _minutesInputRef$curr3.focus) === null || _minutesInputRef$curr4 === void 0 ? void 0 : _minutesInputRef$curr4.call(_minutesInputRef$curr3);
75
+ if (newHours.length === 2) trackFocusMinuteInput();
90
76
  } // regressive backspace functionality
91
77
 
92
78
 
93
79
  if (key === 'Backspace' && hours.length === 0 && isWithDateInputs) {
94
- var _yearInputRef$current, _yearInputRef$current2;
95
-
96
- yearInputRef === null || yearInputRef === void 0 ? void 0 : (_yearInputRef$current = yearInputRef.current) === null || _yearInputRef$current === void 0 ? void 0 : (_yearInputRef$current2 = _yearInputRef$current.focus) === null || _yearInputRef$current2 === void 0 ? void 0 : _yearInputRef$current2.call(_yearInputRef$current);
80
+ trackFocusYearInput();
97
81
  } // focus last fragment on fill with now
98
82
 
99
83
 
100
- if ((ctrlKey || metaKey) && key === ';') lastSegmentRef === null || lastSegmentRef === void 0 ? void 0 : (_lastSegmentRef$curre = lastSegmentRef.current) === null || _lastSegmentRef$curre === void 0 ? void 0 : (_lastSegmentRef$curre2 = _lastSegmentRef$curre.focus) === null || _lastSegmentRef$curre2 === void 0 ? void 0 : _lastSegmentRef$curre2.call(_lastSegmentRef$curre);
101
- }, [hours, onHomeKeyDown, onEndKeyDown, isWithDateInputs, lastSegmentRef, handleChangeHours, minutesInputRef, yearInputRef]);
84
+ if ((ctrlKey || metaKey) && key === ';') trackFocusLastSegment();
85
+ }, [hours, isWithDateInputs, trackFocusYearInput, onHomeKeyDown, onEndKeyDown, trackFocusLastSegment, trackFocusMinuteInput, handleChangeHours]);
102
86
  const onHoursBlur = useCallback(e => {
103
87
  var _e$target2;
104
88
 
@@ -110,30 +94,27 @@ const useTimeInputs = () => {
110
94
  });
111
95
  }, [handleChangeHours]);
112
96
  const onMinutesFocus = useCallback(() => {
113
- setLatestInteractionRegionTimeInputs();
114
- }, [setLatestInteractionRegionTimeInputs]);
97
+ trackFocusMinuteInput();
98
+ }, [trackFocusMinuteInput]);
115
99
  const onMinutesChange = useCallback(e => {
116
- var _e$target3, _meridiemInputRef$cur3, _meridiemInputRef$cur4;
100
+ var _e$target3;
117
101
 
118
102
  let newMinutes = e === null || e === void 0 ? void 0 : (_e$target3 = e.target) === null || _e$target3 === void 0 ? void 0 : _e$target3.value; // converts minutes 7~9 to 07~09
119
103
 
120
104
  if (Number.parseInt(newMinutes, 10) > 6) newMinutes = prependStringWithPlaceHolders(newMinutes, 2);
121
105
  handleChangeMinutes(newMinutes, e); // auto-advance functionality:
122
- // if (newMinutes.length === 2) secondsInputRef?.current?.focus?.();
123
106
 
124
- if (newMinutes.length === 2) meridiemInputRef === null || meridiemInputRef === void 0 ? void 0 : (_meridiemInputRef$cur3 = meridiemInputRef.current) === null || _meridiemInputRef$cur3 === void 0 ? void 0 : (_meridiemInputRef$cur4 = _meridiemInputRef$cur3.focus) === null || _meridiemInputRef$cur4 === void 0 ? void 0 : _meridiemInputRef$cur4.call(_meridiemInputRef$cur3);
125
- }, [meridiemInputRef, handleChangeMinutes]);
107
+ if (newMinutes.length === 2) trackFocusMeridiemInput();
108
+ }, [handleChangeMinutes, trackFocusMeridiemInput]);
126
109
  const onMinutesKeyDown = useCallback(e => {
127
- var _lastSegmentRef$curre3, _lastSegmentRef$curre4;
128
-
129
110
  const {
130
111
  key,
131
112
  ctrlKey,
132
113
  metaKey
133
114
  } = e;
134
115
  const minutesStringConvertedToInteger = Number.parseInt(minutes, 10);
135
- if (homeEndArrowUpDownSpaceKeys.includes(key)) e.preventDefault();
136
- if (homeEndArrowUpDownSpaceKeys.includes(key)) e.stopPropagation();
116
+ if (['Home', 'End', 'ArrowUp', 'ArrowDown', ' '].includes(key)) e.preventDefault();
117
+ if (['Home', 'End', 'ArrowUp', 'ArrowDown', ' '].includes(key)) e.stopPropagation();
137
118
  if (key === 'Home') onHomeKeyDown();
138
119
  if (key === 'End') onEndKeyDown();
139
120
 
@@ -146,25 +127,20 @@ const useTimeInputs = () => {
146
127
  }
147
128
 
148
129
  if (!Number.isNaN(minutesStringConvertedToInteger) && key === ' ') {
149
- var _meridiemInputRef$cur5, _meridiemInputRef$cur6;
150
-
151
130
  const newMinutes = prependStringWithPlaceHolders("".concat(minutesStringConvertedToInteger), 2);
152
131
  handleChangeMinutes(newMinutes, e); // auto-advance functionality:
153
- // if (newMinutes.length === 2) secondsInputRef?.current?.focus?.();
154
132
 
155
- if (newMinutes.length === 2) meridiemInputRef === null || meridiemInputRef === void 0 ? void 0 : (_meridiemInputRef$cur5 = meridiemInputRef.current) === null || _meridiemInputRef$cur5 === void 0 ? void 0 : (_meridiemInputRef$cur6 = _meridiemInputRef$cur5.focus) === null || _meridiemInputRef$cur6 === void 0 ? void 0 : _meridiemInputRef$cur6.call(_meridiemInputRef$cur5);
133
+ if (newMinutes.length === 2) trackFocusMeridiemInput();
156
134
  } // regressive backspace functionality
157
135
 
158
136
 
159
137
  if (key === 'Backspace' && (minutes === null || minutes === void 0 ? void 0 : minutes.length) === 0) {
160
- var _hourInputRef$current3, _hourInputRef$current4;
161
-
162
- hourInputRef === null || hourInputRef === void 0 ? void 0 : (_hourInputRef$current3 = hourInputRef.current) === null || _hourInputRef$current3 === void 0 ? void 0 : (_hourInputRef$current4 = _hourInputRef$current3.focus) === null || _hourInputRef$current4 === void 0 ? void 0 : _hourInputRef$current4.call(_hourInputRef$current3);
138
+ trackFocusHourInput();
163
139
  } // focus last fragment on fill with now
164
140
 
165
141
 
166
- if ((ctrlKey || metaKey) && key === ';') lastSegmentRef === null || lastSegmentRef === void 0 ? void 0 : (_lastSegmentRef$curre3 = lastSegmentRef.current) === null || _lastSegmentRef$curre3 === void 0 ? void 0 : (_lastSegmentRef$curre4 = _lastSegmentRef$curre3.focus) === null || _lastSegmentRef$curre4 === void 0 ? void 0 : _lastSegmentRef$curre4.call(_lastSegmentRef$curre3);
167
- }, [minutes, onHomeKeyDown, onEndKeyDown, lastSegmentRef, minutesInterval, handleChangeMinutes, meridiemInputRef, hourInputRef]);
142
+ if ((ctrlKey || metaKey) && key === ';') trackFocusLastSegment();
143
+ }, [minutes, onHomeKeyDown, onEndKeyDown, trackFocusLastSegment, minutesInterval, handleChangeMinutes, trackFocusMeridiemInput, trackFocusHourInput]);
168
144
  const onMinutesBlur = useCallback(e => {
169
145
  var _e$target4;
170
146
 
@@ -174,8 +150,8 @@ const useTimeInputs = () => {
174
150
  });
175
151
  }, [handleChangeMinutes]);
176
152
  const onMeridiemFocus = useCallback(() => {
177
- setLatestInteractionRegionTimeInputs();
178
- }, [setLatestInteractionRegionTimeInputs]);
153
+ trackFocusMeridiemInput();
154
+ }, [trackFocusMeridiemInput]);
179
155
  const onMeridiemChange = useCallback(e => {
180
156
  var _e$target5, _e$target5$value, _e$target5$value$toUp;
181
157
 
@@ -187,35 +163,29 @@ const useTimeInputs = () => {
187
163
  handleChangeMeridiem(newMeridiem, e); // auto-advance functionality:
188
164
 
189
165
  if (newMeridiem.length === 2 && withAnyRightController) {
190
- var _clearButtonRef$curre3, _clearButtonRef$curre4, _pickerButtonRef$curr3, _pickerButtonRef$curr4;
191
-
192
- if (withClearBtn) (_clearButtonRef$curre3 = clearButtonRef.current) === null || _clearButtonRef$curre3 === void 0 ? void 0 : (_clearButtonRef$curre4 = _clearButtonRef$curre3.focus) === null || _clearButtonRef$curre4 === void 0 ? void 0 : _clearButtonRef$curre4.call(_clearButtonRef$curre3);else if (withAnyPicker) pickerButtonRef === null || pickerButtonRef === void 0 ? void 0 : (_pickerButtonRef$curr3 = pickerButtonRef.current) === null || _pickerButtonRef$curr3 === void 0 ? void 0 : (_pickerButtonRef$curr4 = _pickerButtonRef$curr3.focus) === null || _pickerButtonRef$curr4 === void 0 ? void 0 : _pickerButtonRef$curr4.call(_pickerButtonRef$curr3);
166
+ if (withClearBtn) trackFocusClearBtn();else if (withAnyPicker) trackFocusPicker();
193
167
  }
194
- }, [meridiem, handleChangeMeridiem, withAnyRightController, withClearBtn, clearButtonRef, withAnyPicker, pickerButtonRef]);
168
+ }, [meridiem, handleChangeMeridiem, withAnyRightController, withClearBtn, trackFocusClearBtn, withAnyPicker, trackFocusPicker]);
195
169
  const onMeridiemKeyDown = useCallback(e => {
196
- var _lastSegmentRef$curre5, _lastSegmentRef$curre6;
197
-
198
170
  const {
199
171
  key,
200
172
  ctrlKey,
201
173
  metaKey
202
174
  } = e;
203
- if (homeEndArrowUpDownKeys.includes(key)) e.preventDefault();
204
- if (homeEndArrowUpDownKeys.includes(key)) e.stopPropagation();
175
+ if (['Home', 'End', 'ArrowUp', 'ArrowDown'].includes(key)) e.preventDefault();
176
+ if (['Home', 'End', 'ArrowUp', 'ArrowDown'].includes(key)) e.stopPropagation();
205
177
  if (key === 'Home') onHomeKeyDown();
206
178
  if (key === 'End') onEndKeyDown();
207
179
  if (key === 'ArrowUp' && meridiem !== 'AM') handleChangeMeridiem('AM', e);
208
180
  if (key === 'ArrowDown' && meridiem !== 'PM') handleChangeMeridiem('PM', e); // regressive backspace functionality
209
181
 
210
182
  if (key === 'Backspace') {
211
- var _minutesInputRef$curr5, _minutesInputRef$curr6;
212
-
213
- if ((meridiem === null || meridiem === void 0 ? void 0 : meridiem.length) === 2) handleChangeMeridiem('', e);else minutesInputRef === null || minutesInputRef === void 0 ? void 0 : (_minutesInputRef$curr5 = minutesInputRef.current) === null || _minutesInputRef$curr5 === void 0 ? void 0 : (_minutesInputRef$curr6 = _minutesInputRef$curr5.focus) === null || _minutesInputRef$curr6 === void 0 ? void 0 : _minutesInputRef$curr6.call(_minutesInputRef$curr5);
183
+ if ((meridiem === null || meridiem === void 0 ? void 0 : meridiem.length) === 2) handleChangeMeridiem('', e);else trackFocusMinuteInput();
214
184
  } // focus last fragment on fill with now
215
185
 
216
186
 
217
- if ((ctrlKey || metaKey) && key === ';') lastSegmentRef === null || lastSegmentRef === void 0 ? void 0 : (_lastSegmentRef$curre5 = lastSegmentRef.current) === null || _lastSegmentRef$curre5 === void 0 ? void 0 : (_lastSegmentRef$curre6 = _lastSegmentRef$curre5.focus) === null || _lastSegmentRef$curre6 === void 0 ? void 0 : _lastSegmentRef$curre6.call(_lastSegmentRef$curre5);
218
- }, [onHomeKeyDown, onEndKeyDown, meridiem, handleChangeMeridiem, lastSegmentRef, minutesInputRef]);
187
+ if ((ctrlKey || metaKey) && key === ';') trackFocusLastSegment();
188
+ }, [onHomeKeyDown, onEndKeyDown, meridiem, handleChangeMeridiem, trackFocusLastSegment, trackFocusMinuteInput]);
219
189
  const onMeridiemBlur = useCallback(e => {
220
190
  var _e$target6, _e$target6$value, _e$target6$value$toUp;
221
191
 
@@ -33,14 +33,8 @@ const announcableCardinalDays = {
33
33
  30: 'thirtieth',
34
34
  31: 'thirty first'
35
35
  };
36
- const homeEndAllArrowKeys = ['Home', 'End', 'ArrowUp', 'ArrowDown', 'ArrowLeft', 'ArrowRight'];
37
- const homeEndKeys = ['Home', 'End'];
38
- const homeEndArrowUpDownDashSlashesKeys = ['Home', 'End', 'ArrowUp', 'ArrowDown', '-', '/', '\\'];
39
- const homeEndArrowUpDownSpaceKeys = ['Home', 'End', 'ArrowUp', 'ArrowDown', ' '];
40
- const homeEndArrowUpDownSemiKeys = ['Home', 'End', 'ArrowUp', 'ArrowDown', ':'];
41
- const homeEndArrowUpDownKeys = ['Home', 'End', 'ArrowUp', 'ArrowDown'];
42
36
  const defaultMetaInfo = {
43
37
  isAutomaticFillTrigger: false
44
38
  };
45
39
 
46
- export { announcableCardinalDays, defaultMetaInfo, homeEndAllArrowKeys, homeEndArrowUpDownDashSlashesKeys, homeEndArrowUpDownKeys, homeEndArrowUpDownSemiKeys, homeEndArrowUpDownSpaceKeys, homeEndKeys, monthNames, weekDays };
40
+ export { announcableCardinalDays, defaultMetaInfo, monthNames, weekDays };
@@ -25,50 +25,52 @@ const useGetStartingFocusedDay = () => {
25
25
  onCalendarOpenFocusedDay
26
26
  } = useContext(ControlledDateTimePickerContext);
27
27
  const dayFromInputValues = useGetDayFromDateString();
28
+ const {
29
+ month: inputValuesSplitMonth,
30
+ day: inputValuesSplitDay,
31
+ year: inputValuesDaySplitYear
32
+ } = dayFromInputValues ? getDateValuesFromDate(dayFromInputValues) : {
33
+ month: null,
34
+ day: null,
35
+ year: null
36
+ };
37
+ const isInputFilledAndValid = inputValuesSplitMonth && inputValuesSplitDay && inputValuesDaySplitYear && isValidDayForTheMonth(inputValuesSplitMonth, inputValuesDaySplitYear, inputValuesSplitDay);
38
+ const isOnCalendarOpenFocusedDayEmpty = !onCalendarOpenFocusedDay;
39
+ const shouldFillWithOnCalendarOpenFocusedDay = !isInputFilledAndValid && !isOnCalendarOpenFocusedDayEmpty;
28
40
  return useMemo(() => {
29
- const startingDay = _objectSpread({}, empty);
41
+ const startingDay = _objectSpread({}, empty); // if input was filled start focus is the filled value (if it's valid day for the month)
30
42
 
31
- if (dayFromInputValues) {
32
- const {
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
43
 
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
44
+ if (isInputFilledAndValid) {
45
+ startingDay.startFocusedMonth = inputValuesSplitMonth;
46
+ startingDay.startFocusedDay = inputValuesSplitDay;
47
+ startingDay.startFocusedYear = inputValuesDaySplitYear;
48
+ startingDay.startFocusedDate = dayFromInputValues; // if input was not filled (or filled invalid) and there is no onCalendarOpenFocusedDay start focus is not a day
49
+ } else if (isOnCalendarOpenFocusedDayEmpty) {
50
+ // if input was not filled and there is onCalendarOpenFocusedDay start focus is onCalendarOpenFocusedDay day
51
+ return empty;
52
+ } else if (shouldFillWithOnCalendarOpenFocusedDay) {
53
+ const {
54
+ month: focusedDaySplitMonth,
55
+ day: focusedDaySplitDay,
56
+ year: focusedDaySplitYear
57
+ } = deconstructValuesFromDateString(onCalendarOpenFocusedDay);
58
+ const monthAsInt = convertToPositiveNumberIfPossible(focusedDaySplitMonth);
59
+ const dayAsInt = convertToPositiveNumberIfPossible(focusedDaySplitDay);
60
+ const yearAsInt = convertToPositiveNumberIfPossible(focusedDaySplitYear); // if this condition is false, return will be the same as return empty
61
+ // because startFocusedMonth/Day/Year/Date will be === null
62
+ // which is the expected result
60
63
 
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
- }
64
+ if (monthAsInt !== -1 && dayAsInt !== -1 && yearAsInt !== -1 && isValidDayForTheMonth(monthAsInt - 1, yearAsInt, dayAsInt)) {
65
+ startingDay.startFocusedMonth = monthAsInt;
66
+ startingDay.startFocusedDay = dayAsInt;
67
+ startingDay.startFocusedYear = yearAsInt;
68
+ startingDay.startFocusedDate = new Date(yearAsInt, monthAsInt - 1, dayAsInt);
67
69
  }
68
70
  }
69
71
 
70
72
  return startingDay;
71
- }, [dayFromInputValues, onCalendarOpenFocusedDay]);
73
+ }, [dayFromInputValues, inputValuesDaySplitYear, inputValuesSplitDay, inputValuesSplitMonth, isInputFilledAndValid, isOnCalendarOpenFocusedDayEmpty, onCalendarOpenFocusedDay, shouldFillWithOnCalendarOpenFocusedDay]);
72
74
  };
73
75
 
74
76
  export { useGetStartingFocusedDay };
package/esm/index.js CHANGED
@@ -1,6 +1,10 @@
1
1
  export { DSAutocomplete, DSAutocompleteWithSchema } from './autocomplete/Autocomplete.js';
2
+ export { DSInputGroup, DSInputGroupWithSchema } from './input-group/InputGroup.js';
3
+ export { InputGroupDataTestIds } from './input-group/InputGroupDataTestIds.js';
2
4
  export { DSControlledCheckbox, DSControlledCheckboxWithSchema } from './checkbox/ControlledCheckbox.js';
3
5
  export { DSComboBox, DSComboBox as DSComboBoxV3, DSComboBoxWithSchema } from './combobox/ComboBox.js';
6
+ export { DSComboBoxName, DSComboboxSlots } from './combobox/theming.js';
7
+ export { ComboboxDataTestid } from './combobox/ComboboxDataTestids.js';
4
8
  export { DSControlledDateRangePicker, DSControlledDateRangePickerWithSchema } from './date-range-picker/ControlledDateRangePicker.js';
5
9
  export { ControlledDateRangePickerDatatestid } from './date-range-picker/ControlledDateRangePickerDatatestid.js';
6
10
  export { CONTROLLED_DATE_RANGE_PICKER_TYPES } from './date-range-picker/ControlledDateRangePickerTypes.js';
@@ -14,7 +18,7 @@ export { getValidationTimeStringMetaInfo } from './date-time-picker/utils/timeHe
14
18
  export { UsePhoneMaskWithSchema, getPhoneMaskedValue, usePhoneMask } from './mask-hook/hooks/usePhoneMask.js';
15
19
  export { UseNumberMaskWithSchema, getNumberMaskedValue, useNumberMask } from './mask-hook/hooks/useNumberMask.js';
16
20
  export { UseSSNMaskWithSchema, getSSNMaskedValue, useSSNMask } from './mask-hook/hooks/useSSNMask.js';
17
- export { UseRegExpMaskWithSchema, isRegExp, useRegExpMask } from './mask-hook/hooks/useRegExpMask.js';
21
+ export { UseRegExpMaskWithSchema, useRegExpMask } from './mask-hook/hooks/useRegExpMask.js';
18
22
  export { UseZipCodeMaskWithSchema, getUseZipMaskedValue, useZipCodeMask } from './mask-hook/hooks/useZipCodeMask.js';
19
23
  export { DSInputText, DSInputTextWithSchema } from './text-input/DSInputText.js';
20
24
  export { DSInputTextDataTestIds } from './text-input/exported-related/data-test-ids.js';
@@ -0,0 +1,59 @@
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';
7
+ import _jsx from '@babel/runtime/helpers/esm/jsx';
8
+ import { useMemo } from 'react';
9
+ import { describe, useValidateTypescriptPropTypes, useGetGlobalAttributes } from '@elliemae/ds-props-helpers';
10
+ import { StyledContainer, StyledLeftAddon, StyledInput, StyledRightAddon } from './styled.js';
11
+ import { propTypes } from './react-desc-prop-types.js';
12
+ import { InputGroupDataTestIds } from './InputGroupDataTestIds.js';
13
+ import { jsxs } from 'react/jsx-runtime';
14
+
15
+ 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; }
16
+
17
+ 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; }
18
+
19
+ const DSInputGroup = props => {
20
+ useValidateTypescriptPropTypes(props, propTypes);
21
+ const {
22
+ children,
23
+ leftAddon,
24
+ rightAddon
25
+ } = props;
26
+ const globals = useGetGlobalAttributes(props);
27
+ const cols = useMemo(() => {
28
+ if (leftAddon && rightAddon) {
29
+ return ['max-content', 'auto', 'max-content'];
30
+ }
31
+
32
+ if (leftAddon && !rightAddon) {
33
+ return ['max-content', 'auto'];
34
+ }
35
+
36
+ if (!leftAddon && rightAddon) {
37
+ return ['auto', 'max-content'];
38
+ }
39
+
40
+ return ['auto'];
41
+ }, [leftAddon, rightAddon]);
42
+ return /*#__PURE__*/jsxs(StyledContainer, _objectSpread(_objectSpread({
43
+ cols: cols,
44
+ "data-testid": InputGroupDataTestIds.CONTAINER
45
+ }, globals), {}, {
46
+ children: [leftAddon && /*#__PURE__*/_jsx(StyledLeftAddon, {
47
+ "data-testid": InputGroupDataTestIds.LEFTADDON
48
+ }, void 0, leftAddon), /*#__PURE__*/_jsx(StyledInput, {
49
+ "data-testid": InputGroupDataTestIds.INPUTCONTAINER
50
+ }, void 0, children), rightAddon && /*#__PURE__*/_jsx(StyledRightAddon, {
51
+ "data-testid": InputGroupDataTestIds.RIGHTADDON
52
+ }, void 0, rightAddon)]
53
+ }));
54
+ };
55
+
56
+ const DSInputGroupWithSchema = describe(DSInputGroup);
57
+ DSInputGroupWithSchema.propTypes = propTypes;
58
+
59
+ export { DSInputGroup, DSInputGroupWithSchema };
@@ -0,0 +1,8 @@
1
+ const InputGroupDataTestIds = {
2
+ CONTAINER: 'ds-input-group-container',
3
+ LEFTADDON: 'ds-input-group-left-addon',
4
+ RIGHTADDON: 'ds-input-group-right-addon',
5
+ INPUTCONTAINER: 'ds-input-group-input-container'
6
+ };
7
+
8
+ export { InputGroupDataTestIds };
@@ -0,0 +1,2 @@
1
+ export { DSInputGroup, DSInputGroupWithSchema } from './InputGroup.js';
2
+ export { InputGroupDataTestIds } from './InputGroupDataTestIds.js';
@@ -0,0 +1,10 @@
1
+ import { PropTypes } from '@elliemae/ds-props-helpers';
2
+
3
+ /* eslint-disable @typescript-eslint/no-unused-vars */
4
+ const propTypes = {
5
+ leftAddon: PropTypes.element.description('Component to be added at the left side of the input'),
6
+ rightAddon: PropTypes.element.description('Component to be added at the right side of the input'),
7
+ children: PropTypes.node.isRequired.description('React component to apply autocomplete functionality').defaultValue('')
8
+ };
9
+
10
+ export { propTypes };
@@ -0,0 +1,35 @@
1
+ import styled from 'styled-components';
2
+ import { Grid } from '@elliemae/ds-grid';
3
+ import '../text-input/DSInputText.js';
4
+ import { DSInputTextName, DSInputTextSlots } from '../text-input/exported-related/theming.js';
5
+ import '../combobox/ComboBox.js';
6
+ import { DSComboBoxName, DSComboboxSlots } from '../combobox/theming.js';
7
+
8
+ /* eslint-disable @typescript-eslint/no-unsafe-assignment */
9
+ const StyledContainer = /*#__PURE__*/styled(Grid).withConfig({
10
+ componentId: "sc-12elcva-0"
11
+ })(["width:100%;height:28px;& > div:nth-child(1){.", "-", ",.", "-", ",.", "-", "{border-top-right-radius:0;border-bottom-right-radius:0;}}& > div:nth-child(2):nth-last-child(2){.", "-", ",.", "-", ",.", "-", "{border-radius:0;}}& > div:nth-child(2):nth-last-child(1){.", "-", ",.", "-", ",.", "-", "{border-top-left-radius:0;border-bottom-left-radius:0;}}"], DSInputTextName, DSInputTextSlots.INPUT_WRAPPER, DSInputTextName, DSInputTextSlots.INPUT, DSComboBoxName, DSComboboxSlots.INPUT_WRAPPER, DSInputTextName, DSInputTextSlots.INPUT_WRAPPER, DSInputTextName, DSInputTextSlots.INPUT, DSComboBoxName, DSComboboxSlots.INPUT_WRAPPER, DSInputTextName, DSInputTextSlots.INPUT_WRAPPER, DSInputTextName, DSInputTextSlots.INPUT, DSComboBoxName, DSComboboxSlots.INPUT_WRAPPER);
12
+ const StyledAddon = /*#__PURE__*/styled.div.withConfig({
13
+ componentId: "sc-12elcva-1"
14
+ })(["outline:1px solid ", ";outline-offset:-1px;height:inherit;display:flex;button{border-width:1px;}&:hover{z-index:1;button:not(:disabled){border:1px solid ", ";}}&:focus-within{z-index:1;}"], _ref => {
15
+ let {
16
+ theme
17
+ } = _ref;
18
+ return theme.colors.neutral['400'];
19
+ }, _ref2 => {
20
+ let {
21
+ theme
22
+ } = _ref2;
23
+ return theme.colors.brand['700'];
24
+ });
25
+ const StyledLeftAddon = /*#__PURE__*/styled(StyledAddon).withConfig({
26
+ componentId: "sc-12elcva-2"
27
+ })(["border-top-left-radius:2px;border-bottom-left-radius:2px;margin-right:-1px;&:hover{button:not(:disabled){border-top-right-radius:0px;border-bottom-right-radius:0px;}}"]);
28
+ const StyledRightAddon = /*#__PURE__*/styled(StyledAddon).withConfig({
29
+ componentId: "sc-12elcva-3"
30
+ })(["border-top-right-radius:2px;border-bottom-right-radius:2px;margin-left:-1px;&:hover{button:not(:disabled){border-top-left-radius:0px;border-bottom-left-radius:0px;}}"]);
31
+ const StyledInput = /*#__PURE__*/styled.div.withConfig({
32
+ componentId: "sc-12elcva-4"
33
+ })(["&:focus-within,&:hover{z-index:1;}"]);
34
+
35
+ export { StyledContainer, StyledInput, StyledLeftAddon, StyledRightAddon };
@@ -1,5 +1,5 @@
1
1
  export { UsePhoneMaskWithSchema, getPhoneMaskedValue, usePhoneMask } from './usePhoneMask.js';
2
2
  export { UseNumberMaskWithSchema, getNumberMaskedValue, useNumberMask } from './useNumberMask.js';
3
3
  export { UseSSNMaskWithSchema, getSSNMaskedValue, useSSNMask } from './useSSNMask.js';
4
- export { UseRegExpMaskWithSchema, isRegExp, useRegExpMask } from './useRegExpMask.js';
4
+ export { UseRegExpMaskWithSchema, useRegExpMask } from './useRegExpMask.js';
5
5
  export { UseZipCodeMaskWithSchema, getUseZipMaskedValue, useZipCodeMask } from './useZipCodeMask.js';
@@ -14,8 +14,8 @@ import 'core-js/modules/esnext.iterator.reduce.js';
14
14
  import { DSMaskPhoneHookPropsTypes, DSMaskPhoneHookDefaultProps } from '../react-desc-prop-types.js';
15
15
 
16
16
  const _excluded = ["valueSetter", "onChange", "onKeyDown", "onBlur"];
17
- const phoneSpecialChars = [['(', 0], [') ', 4], ['-', 9]];
18
- const internationalPhoneSpecialChars = [['+1 (', 0], [') ', 7], ['-', 12]];
17
+ const phoneSpecialChars = [['(', 0], [') ', 4], [' - ', 9]];
18
+ const internationalPhoneSpecialChars = [['+1 (', 0], [') ', 7], [' - ', 12]];
19
19
 
20
20
  const conformValue = (rawValue, cursorPos, lastKeyCode, opts) => {
21
21
  const characters = rawValue.split(''); // Work with digits only
@@ -113,4 +113,4 @@ const useRegExpMask = props => {
113
113
  const UseRegExpMaskWithSchema = describe(useRegExpMask);
114
114
  UseRegExpMaskWithSchema.propTypes = DSMaskRegExpHookPropsTypes;
115
115
 
116
- export { UseRegExpMaskWithSchema, isRegExp, useRegExpMask };
116
+ export { UseRegExpMaskWithSchema, useRegExpMask };
@@ -1,5 +1,5 @@
1
1
  export { UsePhoneMaskWithSchema, getPhoneMaskedValue, usePhoneMask } from './hooks/usePhoneMask.js';
2
2
  export { UseNumberMaskWithSchema, getNumberMaskedValue, useNumberMask } from './hooks/useNumberMask.js';
3
3
  export { UseSSNMaskWithSchema, getSSNMaskedValue, useSSNMask } from './hooks/useSSNMask.js';
4
- export { UseRegExpMaskWithSchema, isRegExp, useRegExpMask } from './hooks/useRegExpMask.js';
4
+ export { UseRegExpMaskWithSchema, useRegExpMask } from './hooks/useRegExpMask.js';
5
5
  export { UseZipCodeMaskWithSchema, getUseZipMaskedValue, useZipCodeMask } from './hooks/useZipCodeMask.js';
@@ -7,7 +7,7 @@ const readOnlyBorderCss = css(_templateObject2 || (_templateObject2 = _taggedTem
7
7
  const disabledBorderCss = commonBorderCss;
8
8
  const hasErrorBorderCss = css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n border: 1px solid ", ";\n"])), th.color('danger-900'));
9
9
  const hoverBorderCss = css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n border: 1px solid ", ";\n"])), th.color('brand-700'));
10
- const focusBorderCss = css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n border: 1px solid transparent;\n outline: 2px solid ", ";\n outline-offset: -1px;\n"])), th.color('brand-700'));
10
+ const focusBorderCss = css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n border: 1px solid transparent;\n outline: 2px solid ", ";\n outline-offset: -2px;\n"])), th.color('brand-700'));
11
11
  const getBorderCss = props => {
12
12
  if (props.isDisabled) return disabledBorderCss;
13
13
  if (props.hasFocus) return focusBorderCss;
@@ -1,11 +1,11 @@
1
+ import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
2
+ import _jsx from '@babel/runtime/helpers/esm/jsx';
3
+ import 'core-js/modules/web.dom-collections.iterator.js';
1
4
  import 'core-js/modules/esnext.async-iterator.filter.js';
2
5
  import 'core-js/modules/esnext.iterator.constructor.js';
3
6
  import 'core-js/modules/esnext.iterator.filter.js';
4
7
  import 'core-js/modules/esnext.async-iterator.for-each.js';
5
8
  import 'core-js/modules/esnext.iterator.for-each.js';
6
- import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
7
- import _jsx from '@babel/runtime/helpers/esm/jsx';
8
- import 'core-js/modules/web.dom-collections.iterator.js';
9
9
  import { useState, useRef, useMemo, useEffect, useCallback } from 'react';
10
10
  import { uid } from 'uid';
11
11
  import { describe } from 'react-desc';