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

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 +1 -1
  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 +73 -27
  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 +2 -3
  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 +2 -2
  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 +73 -24
  124. package/esm/checkbox/utils/styleHelpers.js +20 -2
  125. package/esm/combobox/ComboBoxCTX.js +6 -3
  126. package/esm/combobox/config/useComboBox.js +17 -7
  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 +4 -8
  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 +1 -2
  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 +2 -3
  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 +1 -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
@@ -2,19 +2,21 @@ import _jsx from '@babel/runtime/helpers/esm/jsx';
2
2
  import 'core-js/modules/esnext.async-iterator.filter.js';
3
3
  import 'core-js/modules/esnext.iterator.constructor.js';
4
4
  import 'core-js/modules/esnext.iterator.filter.js';
5
- import React, { useContext, useEffect, useCallback } from 'react';
5
+ import React, { useContext, useEffect, useCallback, useMemo } from 'react';
6
6
  import { DSPopperJS } from '@elliemae/ds-popperjs';
7
7
  import { AutocompleteContext } from '../../AutocompleteCTX.js';
8
- import { StyledContainerWithPopper, StyledPopperWrapper } from './styled.js';
8
+ import { StyledContainer, StyledPopperWrapper } from './styled.js';
9
9
  import { MenuList } from '../menu-list/MenuList.js';
10
10
  import { useKeyboardNavigation } from './useKeyboardNavigation.js';
11
11
  import { AutocompleteDataTestid } from '../../AutocompleteDataTestids.js';
12
- import { jsxs } from 'react/jsx-runtime';
12
+ import { A11yFocusedOption } from '../A11yFocusedOption.js';
13
+ import { jsxs, Fragment } from 'react/jsx-runtime';
13
14
 
14
- var _StyledPopperWrapper;
15
+ var _A11yFocusedOption, _StyledPopperWrapper;
15
16
  const Container = () => {
16
17
  const {
17
18
  props: {
19
+ id,
18
20
  startPlacementPreference,
19
21
  children,
20
22
  filter,
@@ -23,6 +25,7 @@ const Container = () => {
23
25
  showPopover,
24
26
  setReferenceElement,
25
27
  setShowPopover,
28
+ focusOptionIdx,
26
29
  referenceElement
27
30
  } = useContext(AutocompleteContext);
28
31
  useEffect(() => {
@@ -38,32 +41,41 @@ const Container = () => {
38
41
  const handleCloseMenu = useCallback(() => {
39
42
  setShowPopover(false);
40
43
  }, [setShowPopover]);
41
- const input = React.Children.only(children);
42
44
  const {
43
45
  onInputKeyDown
44
46
  } = useKeyboardNavigation();
45
- return /*#__PURE__*/jsxs(StyledContainerWithPopper, {
46
- ref: setReferenceElement,
47
- role: "combobox",
48
- "aria-autocomplete": "list",
49
- "aria-controls": "autocomplete-listbox",
50
- "aria-expanded": showPopover,
51
- onKeyDown: onInputKeyDown,
52
- "data-testid": AutocompleteDataTestid.CONTAINER,
53
- children: [input, filter && /*#__PURE__*/_jsx(DSPopperJS, {
54
- customOffset: [0, 5],
55
- closeContextMenu: handleCloseMenu,
56
- referenceElement: referenceElement,
57
- showPopover: showPopover,
58
- startPlacementPreference: startPlacementPreference,
59
- placementOrderPreference: placementOrderPreference,
60
- withoutPortal: true,
61
- withoutArrow: true,
62
- withoutAnimation: true,
63
- zIndex: 10
64
- }, void 0, _StyledPopperWrapper || (_StyledPopperWrapper = /*#__PURE__*/_jsx(StyledPopperWrapper, {
65
- tabIndex: -1
66
- }, void 0, /*#__PURE__*/_jsx(MenuList, {}))))]
47
+ const input = React.Children.only(children);
48
+ const childrenWithProps = /*#__PURE__*/React.isValidElement(input) ? /*#__PURE__*/React.cloneElement(input, {
49
+ 'aria-activedescendant': focusOptionIdx
50
+ }) : input;
51
+ const idList = useMemo(() => `${id ? `${id}-` : ''}listbox`, [id]);
52
+ return /*#__PURE__*/jsxs(Fragment, {
53
+ children: [_A11yFocusedOption || (_A11yFocusedOption = /*#__PURE__*/_jsx(A11yFocusedOption, {})), /*#__PURE__*/jsxs(StyledContainer, {
54
+ id: id,
55
+ ref: setReferenceElement,
56
+ role: "combobox",
57
+ "aria-autocomplete": "list",
58
+ "aria-controls": "autocomplete-listbox",
59
+ "aria-expanded": showPopover,
60
+ "aria-haspopup": "listbox",
61
+ "aria-owns": idList,
62
+ onKeyDown: onInputKeyDown,
63
+ "data-testid": AutocompleteDataTestid.CONTAINER,
64
+ children: [childrenWithProps, filter && /*#__PURE__*/_jsx(DSPopperJS, {
65
+ customOffset: [0, 5],
66
+ closeContextMenu: handleCloseMenu,
67
+ referenceElement: referenceElement,
68
+ showPopover: showPopover,
69
+ startPlacementPreference: startPlacementPreference,
70
+ placementOrderPreference: placementOrderPreference,
71
+ withoutPortal: true,
72
+ withoutArrow: true,
73
+ withoutAnimation: true,
74
+ zIndex: 10
75
+ }, void 0, _StyledPopperWrapper || (_StyledPopperWrapper = /*#__PURE__*/_jsx(StyledPopperWrapper, {
76
+ tabIndex: -1
77
+ }, void 0, /*#__PURE__*/_jsx(MenuList, {}))))]
78
+ })]
67
79
  });
68
80
  };
69
81
 
@@ -1,10 +1,10 @@
1
1
  import styled from 'styled-components';
2
2
 
3
- const StyledContainerWithPopper = /*#__PURE__*/styled.div.withConfig({
3
+ const StyledContainer = /*#__PURE__*/styled.div.withConfig({
4
4
  componentId: "sc-xupfk9-0"
5
5
  })(["width:100%;height:28px;position:relative;"]);
6
6
  const StyledPopperWrapper = /*#__PURE__*/styled.div.withConfig({
7
7
  componentId: "sc-xupfk9-1"
8
8
  })(["background:#fff;overflow:auto;position:relative;"]);
9
9
 
10
- export { StyledContainerWithPopper, StyledPopperWrapper };
10
+ export { StyledContainer, StyledPopperWrapper };
@@ -31,7 +31,7 @@ const useKeyboardNavigation = () => {
31
31
 
32
32
  if (e.key === 'Enter' && showPopover) {
33
33
  e.preventDefault();
34
- onSelect(currentItem === null || currentItem === void 0 ? void 0 : currentItem.label, e);
34
+ onSelect(currentItem?.label, e);
35
35
  setShowPopover(false);
36
36
  } // =============================================================================
37
37
  // ARROWS UP AND DOWN
@@ -64,7 +64,7 @@ const useKeyboardNavigation = () => {
64
64
  if (e.key === 'Escape') {
65
65
  setShowPopover(false);
66
66
  }
67
- }, [currentItem === null || currentItem === void 0 ? void 0 : currentItem.label, currentItemIndex, onSelect, options, scrollOptionIntoView, setCurrentOption, setShowPopover, showPopover]);
67
+ }, [currentItem?.label, currentItemIndex, onSelect, options, scrollOptionIntoView, setCurrentOption, setShowPopover, showPopover]);
68
68
  return {
69
69
  onInputKeyDown
70
70
  };
@@ -1,5 +1,5 @@
1
1
  import _jsx from '@babel/runtime/helpers/esm/jsx';
2
- import { useContext, useCallback } from 'react';
2
+ import { useContext, useCallback, useMemo } from 'react';
3
3
  import { StyledListWrapper, StyledVirtualListWrapper, StyledList } from './styled.js';
4
4
  import { AutocompleteDataTestid } from '../../AutocompleteDataTestids.js';
5
5
  import { AutocompleteContext } from '../../AutocompleteCTX.js';
@@ -9,7 +9,8 @@ import { jsx } from 'react/jsx-runtime';
9
9
  const MenuList = () => {
10
10
  const {
11
11
  props: {
12
- options
12
+ options,
13
+ id
13
14
  },
14
15
  referenceElement,
15
16
  inputRef,
@@ -21,15 +22,14 @@ const MenuList = () => {
21
22
  } = useContext(AutocompleteContext);
22
23
  const ItemRenderer = useItemRenderer();
23
24
  const handleOnFocus = useCallback(() => {
24
- var _inputRef$current;
25
-
26
- (_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 ? void 0 : _inputRef$current.focus();
25
+ inputRef.current?.focus();
27
26
  }, [inputRef]);
27
+ const idList = useMemo(() => `${id ? `${id}-` : ''}listbox`, [id]);
28
28
  return /*#__PURE__*/_jsx(StyledListWrapper, {
29
29
  tabIndex: -1,
30
30
  onMouseDown: e => e.preventDefault(),
31
- minWidth: referenceElement === null || referenceElement === void 0 ? void 0 : referenceElement.offsetWidth,
32
- id: "autocomplete-listbox",
31
+ minWidth: referenceElement?.offsetWidth,
32
+ id: idList,
33
33
  role: "listbox"
34
34
  }, void 0, options.length > 0 && /*#__PURE__*/jsx(StyledVirtualListWrapper, {
35
35
  tabIndex: -1,
@@ -6,7 +6,7 @@ const StyledListWrapper = /*#__PURE__*/styled.div.withConfig({
6
6
  let {
7
7
  minWidth
8
8
  } = _ref;
9
- return minWidth ? "".concat(minWidth, "px") : '100%';
9
+ return minWidth ? `${minWidth}px` : '100%';
10
10
  });
11
11
  const StyledList = /*#__PURE__*/styled.ul.withConfig({
12
12
  componentId: "sc-qt1kwv-1"
@@ -17,7 +17,7 @@ const StyledVirtualListWrapper = /*#__PURE__*/styled.div.withConfig({
17
17
  let {
18
18
  maxHeight
19
19
  } = _ref2;
20
- return "".concat(!maxHeight ? '400' : maxHeight, "px");
20
+ return `${!maxHeight ? '400' : maxHeight}px`;
21
21
  });
22
22
 
23
23
  export { StyledList, StyledListWrapper, StyledVirtualListWrapper };
@@ -43,7 +43,7 @@ const useItemRenderer = () => {
43
43
  left: 0,
44
44
  width: '100%'
45
45
  },
46
- key: "".concat(option.dsId),
46
+ key: `${option.dsId}`,
47
47
  innerRef: vItem.measureRef
48
48
  };
49
49
 
@@ -0,0 +1 @@
1
+
@@ -9,7 +9,7 @@ const isSelectedValueMultiple = value => Array.isArray(value);
9
9
  const findInCircularList = function (list, from, criteria) {
10
10
  let step = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 1;
11
11
 
12
- for (let i = (from + step + list.length) % list.length; i !== from; i = (i + step + list.length) % list.length) {
12
+ for (let i = (from + step + list.length) % list.length; i !== from && from > -1; i = (i + step + list.length) % list.length) {
13
13
  if (criteria(list[i])) return i;
14
14
  }
15
15
 
@@ -9,7 +9,7 @@ import _objectWithoutProperties from '@babel/runtime/helpers/esm/objectWithoutPr
9
9
  import { useRef, useCallback } from 'react';
10
10
  import { describe, useMemoMergePropsWithDefault, useGetGlobalAttributes, useGetXstyledProps } from '@elliemae/ds-props-helpers';
11
11
  import { SimpleTruncatedTooltipText } from '@elliemae/ds-truncated-tooltip-text';
12
- import { StyledContainer, StyledCheckBox, StyledInputMixed, StyledInput, StyledLabel } from './styles.js';
12
+ import { StyledContainer, StyledCheckBox, StyledInputMixed, StyledInput, StyledLabel, StyledWrapLabel } from './styles.js';
13
13
  import { propTypes, defaultProps } from './react-desc-prop-types.js';
14
14
  import { setMultipleRefs } from './utils/setMultipleRefs.js';
15
15
  import { useValidateProps } from './config/useValidateProps.js';
@@ -98,7 +98,7 @@ const DSControlledCheckbox = props => {
98
98
  checked: checked,
99
99
  "data-testid": "ds-checkbox-label",
100
100
  wrapLabel: wrapLabel
101
- }, void 0, wrapLabel ? label : /*#__PURE__*/_jsx(SimpleTruncatedTooltipText, {
101
+ }, void 0, wrapLabel ? /*#__PURE__*/_jsx(StyledWrapLabel, {}, void 0, label) : /*#__PURE__*/_jsx(SimpleTruncatedTooltipText, {
102
102
  value: label
103
103
  }))]
104
104
  }));
@@ -1,18 +1,21 @@
1
+ import 'core-js/modules/es.error.cause.js';
1
2
  import { useValidateTypescriptPropTypes } from '@elliemae/ds-props-helpers';
2
3
 
3
4
  const throwError = message => {
4
- throw new Error("DSControlledCheckbox:: ".concat(message, "\n "));
5
+ throw new Error(`DSControlledCheckbox:: ${message}
6
+ `);
5
7
  };
6
8
 
7
9
  const useValidateProps = (props, propTypes) => {
8
10
  useValidateTypescriptPropTypes(props, propTypes);
9
11
 
10
12
  if (typeof props.label === 'undefined' && typeof props['aria-label'] === 'undefined') {
11
- throwError("Please provide a label or ariaLabel property to use this component.");
13
+ throwError(`Please provide a label or ariaLabel property to use this component.`);
12
14
  }
13
15
 
14
16
  if (props.checked === 'mixed' && typeof props['aria-controls'] === 'undefined') {
15
- throwError("Please provide an ariaControls property to use a checkbox mixed state. \n This property must be a string containing all the ids that this mixed checkbox is controlling.");
17
+ throwError(`Please provide an ariaControls property to use a checkbox mixed state.
18
+ This property must be a string containing all the ids that this mixed checkbox is controlling.`);
16
19
  }
17
20
  };
18
21
 
@@ -18,7 +18,8 @@ const defaultProps = {
18
18
  const propTypes = _objectSpread(_objectSpread({}, globalAttributesPropTypes), {}, {
19
19
  label: PropTypes.string.description('Checkbox Label property. This label is also going to be used as an aria-label for screen readers.'),
20
20
  hasError: PropTypes.bool.description('Whether the checkbox has error or not.'),
21
- innerRef: PropTypes.oneOfType([PropTypes.func, PropTypes.object]).description('Checkbox input ref.')
21
+ innerRef: PropTypes.oneOfType([PropTypes.func, PropTypes.object]).description('Checkbox input ref.'),
22
+ wrapLabel: PropTypes.bool.description('Whether to wrap or truncate the label')
22
23
  });
23
24
 
24
25
  export { defaultProps, propTypes };
@@ -1,41 +1,51 @@
1
- import _taggedTemplateLiteral from '@babel/runtime/helpers/esm/taggedTemplateLiteral';
2
1
  import { styled, css } from '@elliemae/ds-system';
3
2
  import { handleBackgroundColor, handleCheckmark } from './utils/styleHelpers.js';
4
3
  import { DSCheckboxName, DSCheckboxSlots } from './exported-related/theming.js';
5
4
 
6
- var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6;
7
5
  const StyledContainer = styled('div', {
8
6
  name: DSCheckboxName,
9
7
  slot: DSCheckboxSlots.CONTAINER
10
- })(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: inline-grid;\n grid-template-rows: min-content;\n grid-template-columns: ", " auto;\n align-items: center;\n"])), _ref => {
8
+ })`
9
+ display: inline-grid;
10
+ grid-template-rows: min-content;
11
+ grid-template-columns: ${_ref => {
11
12
  let {
12
13
  theme
13
14
  } = _ref;
14
15
  return theme.space.xs;
15
- });
16
- const StyledCheckBox = styled('span')(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n width: ", ";\n height: ", ";\n border: 1px solid ", ";\n border-radius: 2px;\n position: relative;\n background: ", ";\n ", "\n &:focus-within {\n ", ";\n &:hover {\n ", "\n }\n }\n &:hover {\n background: ", ";\n ", ";\n }\n"])), _ref2 => {
16
+ }} auto;
17
+ align-items: center;
18
+ `;
19
+ const StyledCheckBox = styled('span')`
20
+ width: ${_ref2 => {
17
21
  let {
18
22
  theme
19
23
  } = _ref2;
20
24
  return theme.space.xs;
21
- }, _ref3 => {
25
+ }};
26
+ height: ${_ref3 => {
22
27
  let {
23
28
  theme
24
29
  } = _ref3;
25
30
  return theme.space.xs;
26
- }, _ref4 => {
31
+ }};
32
+ border: 1px solid ${_ref4 => {
27
33
  let {
28
34
  theme,
29
35
  hasError
30
36
  } = _ref4;
31
37
  return hasError ? theme.colors.danger[900] : theme.colors.neutral[400];
32
- }, _ref5 => {
38
+ }};
39
+ border-radius: 2px;
40
+ position: relative;
41
+ background: ${_ref5 => {
33
42
  let {
34
43
  theme,
35
44
  disabled
36
45
  } = _ref5;
37
46
  return handleBackgroundColor(theme, disabled);
38
- }, _ref6 => {
47
+ }};
48
+ ${_ref6 => {
39
49
  let {
40
50
  theme,
41
51
  checked,
@@ -44,14 +54,18 @@ const StyledCheckBox = styled('span')(_templateObject2 || (_templateObject2 = _t
44
54
  hasError
45
55
  } = _ref6;
46
56
  return handleCheckmark(theme, checked, disabled, readOnly, hasError);
47
- }, _ref7 => {
57
+ }}
58
+ &:focus-within {
59
+ ${_ref7 => {
48
60
  let {
49
61
  theme,
50
62
  hasError,
51
63
  disabled
52
64
  } = _ref7;
53
- return !disabled && !hasError ? "border: 1px solid ".concat(theme.colors.brand[700], "; outline : 1px solid ").concat(theme.colors.brand[700], " ") : undefined;
54
- }, _ref8 => {
65
+ return !disabled && !hasError ? `border: 1px solid ${theme.colors.brand[700]}; outline : 1px solid ${theme.colors.brand[700]} ` : undefined;
66
+ }};
67
+ &:hover {
68
+ ${_ref8 => {
55
69
  let {
56
70
  theme,
57
71
  checked,
@@ -60,41 +74,71 @@ const StyledCheckBox = styled('span')(_templateObject2 || (_templateObject2 = _t
60
74
  hasError
61
75
  } = _ref8;
62
76
  return handleCheckmark(theme, checked, disabled, readOnly, hasError, true);
63
- }, _ref9 => {
77
+ }}
78
+ }
79
+ }
80
+ &:hover {
81
+ background: ${_ref9 => {
64
82
  let {
65
83
  theme,
66
84
  checked,
67
85
  disabled
68
86
  } = _ref9;
69
87
  return !disabled && (checked === 'mixed' || checked) ? theme.colors.brand[200] : undefined;
70
- }, _ref10 => {
88
+ }};
89
+ ${_ref10 => {
71
90
  let {
72
91
  theme,
73
92
  hasError,
74
93
  disabled,
75
94
  readOnly
76
95
  } = _ref10;
77
- return !hasError && !disabled && !readOnly ? " border: 1px solid ".concat(theme.colors.brand[600]) : undefined;
78
- });
79
- const checkboxStyles = css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n &:hover {\n cursor: pointer;\n }\n &:disabled {\n cursor: not-allowed;\n }\n width: 100%;\n height: 100%;\n position: absolute;\n top: 0;\n left: 0;\n opacity: 0;\n"])));
96
+ return !hasError && !disabled && !readOnly ? ` border: 1px solid ${theme.colors.brand[600]}` : undefined;
97
+ }};
98
+ }
99
+ `;
100
+ const checkboxStyles = css`
101
+ &:hover {
102
+ cursor: pointer;
103
+ }
104
+ &:disabled {
105
+ cursor: not-allowed;
106
+ }
107
+ width: 100%;
108
+ height: 100%;
109
+ position: absolute;
110
+ top: 0;
111
+ left: 0;
112
+ opacity: 0;
113
+ `;
80
114
  const StyledInput = styled('input', {
81
115
  name: DSCheckboxName,
82
116
  slot: DSCheckboxSlots.INPUT
83
- })(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n ", "\n"])), checkboxStyles);
117
+ })`
118
+ ${checkboxStyles}
119
+ `;
84
120
  const StyledInputMixed = styled('div', {
85
121
  name: DSCheckboxName,
86
122
  slot: DSCheckboxSlots.INPUT
87
- })(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n ", "\n"])), checkboxStyles);
123
+ })`
124
+ ${checkboxStyles}
125
+ `;
88
126
  const StyledLabel = styled('label', {
89
127
  name: DSCheckboxName,
90
128
  slot: DSCheckboxSlots.LABEL
91
- })(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n &:hover {\n cursor: pointer;\n }\n ", ";\n\n color: ", ";\n font-size: 13px;\n line-height: 13px;\n display: inherit;\n"])), _ref11 => {
129
+ })`
130
+ &:hover {
131
+ cursor: pointer;
132
+ }
133
+ ${_ref11 => {
92
134
  let {
93
135
  wrapLabel,
94
136
  theme
95
137
  } = _ref11;
96
- return wrapLabel ? 'padding: 8px' : "padding-left: ".concat(theme.space.xxs);
97
- }, _ref12 => {
138
+ return wrapLabel ? 'padding: 8px 0px 8px 8px;' : `padding-left: ${theme.space.xxs}`;
139
+ }};
140
+
141
+ color: ${_ref12 => {
98
142
  let {
99
143
  theme,
100
144
  disabled,
@@ -102,6 +146,11 @@ const StyledLabel = styled('label', {
102
146
  checked
103
147
  } = _ref12;
104
148
  return disabled && checked !== true || readOnly ? theme.colors.neutral[500] : theme.colors.neutral[800];
105
- });
149
+ }};
150
+ font-size: 13px;
151
+ line-height: 13px;
152
+ display: inherit;
153
+ `;
154
+ const StyledWrapLabel = styled('span')``;
106
155
 
107
- export { StyledCheckBox, StyledContainer, StyledInput, StyledInputMixed, StyledLabel };
156
+ export { StyledCheckBox, StyledContainer, StyledInput, StyledInputMixed, StyledLabel, StyledWrapLabel };
@@ -22,11 +22,29 @@ const handleCheckmark = function (theme, checked, disabled, readOnly, hasError)
22
22
  let isHovering = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : false;
23
23
 
24
24
  if (checked === 'mixed') {
25
- return "&:before {\n position: absolute;\n content: '';\n top: 6px;\n left: 3px;\n background: ".concat(handleCheckMarkColor(theme, checked, isHovering, disabled, readOnly, hasError), ";\n width: ").concat(theme.space.xxs, ";\n height: 2px;\n }");
25
+ return `&:before {
26
+ position: absolute;
27
+ content: '';
28
+ top: 6px;
29
+ left: 3px;
30
+ background: ${handleCheckMarkColor(theme, checked, isHovering, disabled, readOnly, hasError)};
31
+ width: ${theme.space.xxs};
32
+ height: 2px;
33
+ }`;
26
34
  }
27
35
 
28
36
  if (checked) {
29
- return "&:before {\n position: absolute;\n content: '';\n top: 3px;\n left: 2px;\n border-left: 2px solid ".concat(handleCheckMarkColor(theme, checked, isHovering, disabled, readOnly, hasError), ";\n border-bottom: 2px solid ").concat(handleCheckMarkColor(theme, checked, isHovering, disabled, readOnly, hasError), ";\n height: 5px;\n width: 10px;\n transform: rotate(-45deg);\n }");
37
+ return `&:before {
38
+ position: absolute;
39
+ content: '';
40
+ top: 3px;
41
+ left: 2px;
42
+ border-left: 2px solid ${handleCheckMarkColor(theme, checked, isHovering, disabled, readOnly, hasError)};
43
+ border-bottom: 2px solid ${handleCheckMarkColor(theme, checked, isHovering, disabled, readOnly, hasError)};
44
+ height: 5px;
45
+ width: 10px;
46
+ transform: rotate(-45deg);
47
+ }`;
30
48
  }
31
49
 
32
50
  return '';
@@ -12,12 +12,14 @@ const defaultProps = {
12
12
  useMask: noop,
13
13
  innerRef: /*#__PURE__*/createRef(),
14
14
  startPlacementPreference: 'bottom-start',
15
- placementOrderPreference: ['bottom-start', 'bottom-end'] // override in useCombobox to avoid ref duplications when more than one cb is used
15
+ placementOrderPreference: ['bottom-start', 'bottom-end'],
16
+ noOptionsMessage: 'No Matches Found',
17
+ filteredOptions: [] // override in useCombobox to avoid ref duplications when more than one cb is used
16
18
 
17
19
  };
18
20
  const defaultContext = {
19
21
  props: defaultProps,
20
- showPopover: false,
22
+ menuState: false,
21
23
  hasFocus: false,
22
24
  referenceElement: null,
23
25
  inputValue: '',
@@ -36,7 +38,8 @@ const defaultContext = {
36
38
  setInputValue: noop,
37
39
  setReferenceElement: noop,
38
40
  setFocusOptionIdx: noop,
39
- setShowSelectedOptions: noop
41
+ setShowSelectedOptions: noop,
42
+ setMenuState: noop
40
43
  };
41
44
  /** Context for cross component communication */
42
45
 
@@ -1,11 +1,10 @@
1
- import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
2
- import 'core-js/modules/web.dom-collections.iterator.js';
3
1
  import 'core-js/modules/esnext.async-iterator.filter.js';
4
2
  import 'core-js/modules/esnext.iterator.constructor.js';
5
3
  import 'core-js/modules/esnext.iterator.filter.js';
6
4
  import 'core-js/modules/esnext.async-iterator.for-each.js';
7
5
  import 'core-js/modules/esnext.iterator.for-each.js';
8
- import { useRef, useState, useCallback, useEffect, useMemo } from 'react';
6
+ import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
7
+ import { useRef, useState, useMemo, useCallback, useEffect } from 'react';
9
8
  import { useVirtual } from 'react-virtual';
10
9
  import { useMemoMergePropsWithDefault, useValidateTypescriptPropTypes } from '@elliemae/ds-props-helpers';
11
10
  import { defaultProps } from '../ComboBoxCTX.js';
@@ -36,8 +35,18 @@ const useComboBox = props => {
36
35
  const toggleSelectionButtonRef = useRef(null);
37
36
  const pillGroupRef = useRef(null);
38
37
  const {
39
- selectedValues
40
- } = propsWithDefaults; // ---------------------------------------------------------------------------
38
+ selectedValues,
39
+ isMenuOpen,
40
+ onMenuChange
41
+ } = propsWithDefaults;
42
+ const menuState = useMemo(() => {
43
+ if (isMenuOpen !== undefined) return isMenuOpen;
44
+ return showPopover;
45
+ }, [showPopover, isMenuOpen]);
46
+ const setMenuState = useCallback((newState, reason, e) => {
47
+ if (onMenuChange !== undefined) onMenuChange(newState, reason, e);
48
+ setShowPopover(newState);
49
+ }, [onMenuChange]); // ---------------------------------------------------------------------------
41
50
  // Options with creatable option + filtered by selected
42
51
  // ---------------------------------------------------------------------------
43
52
 
@@ -91,7 +100,7 @@ const useComboBox = props => {
91
100
  filteredOptions: correctOptions
92
101
  }),
93
102
  virtualListHelpers,
94
- showPopover,
103
+ menuState,
95
104
  referenceElement,
96
105
  listRef,
97
106
  focusOptionIdx,
@@ -100,6 +109,7 @@ const useComboBox = props => {
100
109
  selectAllCheckboxRef,
101
110
  inputValue,
102
111
  setInputValue,
112
+ setMenuState,
103
113
  hasFocus,
104
114
  toggleSelectionButtonRef,
105
115
  pillGroupRef,
@@ -111,7 +121,7 @@ const useComboBox = props => {
111
121
  scrollOptionIntoView,
112
122
  setReferenceElement,
113
123
  setShowPopover
114
- }), [scrollOptionIntoView, correctOptions, hasFocus, propsWithDefaults, virtualListHelpers, inputValue, focusOptionIdx, wrapperListRef, showSelectedOptions, showPopover, pillGroupRef, referenceElement, selectedOptionsRef, controlsWrapperRef, selectAllCheckboxRef, toggleSelectionButtonRef, listRef]);
124
+ }), [scrollOptionIntoView, setMenuState, correctOptions, hasFocus, propsWithDefaults, virtualListHelpers, inputValue, focusOptionIdx, wrapperListRef, showSelectedOptions, menuState, pillGroupRef, referenceElement, selectedOptionsRef, controlsWrapperRef, selectAllCheckboxRef, toggleSelectionButtonRef, listRef]);
115
125
  return ctx;
116
126
  };
117
127
 
@@ -1,4 +1,3 @@
1
- import 'core-js/modules/web.dom-collections.iterator.js';
2
1
  import { useMemo } from 'react';
3
2
  import { uid } from 'uid';
4
3
  import { MENU_OPTION_TYPES } from '../constants.js';
@@ -24,7 +23,7 @@ const useCorrectOptions = (propsWithDefaults, inputValue, showSelectedOptions) =
24
23
  if (onCreate && inputValue && filteredOptions.findIndex(option => option.type === MENU_OPTION_TYPES.OPTION && option.label === inputValue) === -1) {
25
24
  const creatableUuid = uid();
26
25
  const creatableItem = {
27
- dsId: "creatable-".concat(creatableUuid),
26
+ dsId: `creatable-${creatableUuid}`,
28
27
  label: inputValue,
29
28
  type: 'creatable'
30
29
  };
@@ -5,28 +5,36 @@ import 'core-js/modules/esnext.iterator.find.js';
5
5
  import { useContext, useMemo } from 'react';
6
6
  import { ComboBoxContext } from '../ComboBoxCTX.js';
7
7
  import { StyledA11ySelectedValues } from './styled.js';
8
- import { getSelectableOptions } from '../utils/listHelper.js';
8
+ import { getSelectableOptions, isSelected } from '../utils/listHelper.js';
9
9
  import { isSeparator } from '../sharedTypes.js';
10
10
 
11
11
  const A11yFocusedOption = () => {
12
12
  const {
13
13
  props: {
14
- filteredOptions
14
+ filteredOptions,
15
+ selectedValues
15
16
  },
16
17
  focusOptionIdx,
17
- showPopover
18
+ menuState
18
19
  } = useContext(ComboBoxContext);
19
20
  const selectabledOptions = getSelectableOptions(filteredOptions);
20
- const focusOption = filteredOptions.find(option => !isSeparator(option) && option.dsId === focusOptionIdx);
21
+ const focusOption = filteredOptions.find(option => option.dsId === focusOptionIdx);
22
+ const isFocusOptionSelected = focusOption?.type === 'option' && isSelected(selectedValues, focusOption);
21
23
  const focusSelectableOptionIdx = selectabledOptions.findIndex(option => option.dsId === focusOptionIdx);
24
+ const navigationContext = 'Use up and down to choose options,press enter to choose focused option, press Escape to excuse dropdown menu';
22
25
  return useMemo(() => {
23
- if (!isSeparator(focusOption) && showPopover && focusOption) return /*#__PURE__*/_jsx(StyledA11ySelectedValues, {
26
+ if (!isSeparator(focusOption) && menuState && focusOption && focusOption.type === 'option') return /*#__PURE__*/_jsx(StyledA11ySelectedValues, {
24
27
  "aria-live": "polite",
25
28
  "aria-atomic": "false",
26
29
  "aria-relevant": "additions text"
27
- }, void 0, "option ".concat(focusOption === null || focusOption === void 0 ? void 0 : focusOption.label, " focused.").concat(focusSelectableOptionIdx + 1, " of ").concat(selectabledOptions.length, " "));
30
+ }, menuState, `option ${focusOption?.label} ${isFocusOptionSelected ? 'selected and ' : ''}focused .${focusSelectableOptionIdx + 1} of ${selectabledOptions.length}. ${navigationContext} `);
31
+ if (focusOption?.type === 'creatable') return /*#__PURE__*/_jsx(StyledA11ySelectedValues, {
32
+ "aria-live": "assertive",
33
+ "aria-atomic": "false",
34
+ "aria-relevant": "additions text"
35
+ }, menuState, `Press enter to Add: ${focusOption?.label}. ${navigationContext}`);
28
36
  return null;
29
- }, [showPopover, focusOption, focusSelectableOptionIdx, selectabledOptions]);
37
+ }, [focusOption, menuState, isFocusOptionSelected, focusSelectableOptionIdx, selectabledOptions.length]);
30
38
  };
31
39
 
32
40
  export { A11yFocusedOption };
@@ -17,12 +17,10 @@ const A11ySelectedValues = () => {
17
17
 
18
18
  if (Array.isArray(selectedValues)) {
19
19
  if (selectedValues.length > 0) {
20
- msg = "Options selected: ".concat(selectedValues.map(item => item.label).join(', '));
20
+ msg = `Options selected: ${selectedValues.map(item => item.label).join(', ')}`;
21
21
  }
22
-
23
- msg = 'No Options Selected';
24
22
  } else if (selectedValues) {
25
- msg = "Option selected: ".concat(selectedValues === null || selectedValues === void 0 ? void 0 : selectedValues.label);
23
+ msg = `Option selected: ${selectedValues?.label}`;
26
24
  }
27
25
 
28
26
  return /*#__PURE__*/_jsx(StyledA11ySelectedValues, {