@elliemae/ds-controlled-form 2.3.0-next.4 → 2.3.0-next.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (101) hide show
  1. package/cjs/controlled-combobox/ComboBox.js +3 -6
  2. package/cjs/controlled-combobox/ComboBoxCTX.js +3 -3
  3. package/cjs/controlled-combobox/ComboboxDataTestids.js +2 -1
  4. package/cjs/controlled-combobox/config/useComboBox.js +15 -70
  5. package/cjs/controlled-combobox/config/useCorrectOptions.js +77 -0
  6. package/cjs/controlled-combobox/parts/a11y-messages/FocusMenuItem.js +46 -0
  7. package/cjs/controlled-combobox/parts/a11y-messages/{MultiAllyMessages.js → SelectedValuesAllyMsg.js} +16 -7
  8. package/cjs/controlled-combobox/parts/a11y-messages/index.js +4 -4
  9. package/cjs/controlled-combobox/parts/container/Container.js +40 -15
  10. package/cjs/controlled-combobox/parts/container/styled.js +9 -6
  11. package/cjs/controlled-combobox/parts/controls/Controls.js +30 -19
  12. package/cjs/controlled-combobox/parts/controls/styled.js +22 -10
  13. package/cjs/controlled-combobox/parts/controls/useOnPillsNavigation.js +51 -0
  14. package/cjs/controlled-combobox/parts/controls-input/ControlsInput.js +9 -9
  15. package/cjs/controlled-combobox/parts/controls-input/useControlsInput.js +14 -8
  16. package/cjs/controlled-combobox/parts/dropdown-indicator/DropdownIndicator.js +6 -3
  17. package/cjs/controlled-combobox/parts/dropdown-indicator/styled.js +2 -3
  18. package/cjs/controlled-combobox/parts/header-list/HeaderList.js +6 -6
  19. package/cjs/controlled-combobox/parts/header-list/useHeaderListHandlers.js +4 -4
  20. package/cjs/controlled-combobox/parts/menu-list/MenuList.js +9 -11
  21. package/cjs/controlled-combobox/parts/menu-list/styled.js +1 -1
  22. package/cjs/controlled-combobox/parts/menu-list/useItemRenderer.js +11 -11
  23. package/cjs/controlled-combobox/parts/menu-list/useMenuList.js +11 -13
  24. package/cjs/controlled-combobox/parts/multi-selected-values-container/MultiSelectedValuesContainer.js +19 -15
  25. package/cjs/controlled-combobox/parts/multi-selected-values-container/useGroupPills.js +5 -5
  26. package/cjs/controlled-combobox/react-desc-prop-types.js +42 -0
  27. package/cjs/controlled-combobox/{index.d.js → sharedTypes.js} +0 -0
  28. package/cjs/controlled-combobox/utils/hooks/useKeyboardNavigation.js +19 -15
  29. package/cjs/controlled-combobox/utils/listHelper.js +2 -2
  30. package/esm/controlled-combobox/ComboBox.js +4 -7
  31. package/esm/controlled-combobox/ComboBoxCTX.js +4 -4
  32. package/esm/controlled-combobox/ComboboxDataTestids.js +2 -1
  33. package/esm/controlled-combobox/config/useComboBox.js +17 -72
  34. package/esm/controlled-combobox/config/useCorrectOptions.js +73 -0
  35. package/esm/controlled-combobox/parts/a11y-messages/FocusMenuItem.js +38 -0
  36. package/esm/controlled-combobox/parts/a11y-messages/SelectedValuesAllyMsg.js +34 -0
  37. package/esm/controlled-combobox/parts/a11y-messages/index.js +2 -2
  38. package/esm/controlled-combobox/parts/container/Container.js +38 -15
  39. package/esm/controlled-combobox/parts/container/styled.js +9 -6
  40. package/esm/controlled-combobox/parts/controls/Controls.js +31 -20
  41. package/esm/controlled-combobox/parts/controls/styled.js +22 -10
  42. package/esm/controlled-combobox/parts/controls/useOnPillsNavigation.js +47 -0
  43. package/esm/controlled-combobox/parts/controls-input/ControlsInput.js +9 -9
  44. package/esm/controlled-combobox/parts/controls-input/useControlsInput.js +14 -8
  45. package/esm/controlled-combobox/parts/dropdown-indicator/DropdownIndicator.js +6 -3
  46. package/esm/controlled-combobox/parts/dropdown-indicator/styled.js +3 -3
  47. package/esm/controlled-combobox/parts/header-list/HeaderList.js +6 -6
  48. package/esm/controlled-combobox/parts/header-list/useHeaderListHandlers.js +4 -4
  49. package/esm/controlled-combobox/parts/menu-list/MenuList.js +10 -12
  50. package/esm/controlled-combobox/parts/menu-list/styled.js +1 -1
  51. package/esm/controlled-combobox/parts/menu-list/useItemRenderer.js +11 -11
  52. package/esm/controlled-combobox/parts/menu-list/useMenuList.js +11 -13
  53. package/esm/controlled-combobox/parts/multi-selected-values-container/MultiSelectedValuesContainer.js +20 -16
  54. package/esm/controlled-combobox/parts/multi-selected-values-container/useGroupPills.js +5 -5
  55. package/esm/controlled-combobox/{propTypes.js → react-desc-prop-types.js} +16 -6
  56. package/esm/controlled-combobox/{index.d.js → sharedTypes.js} +0 -0
  57. package/esm/controlled-combobox/utils/hooks/useKeyboardNavigation.js +19 -15
  58. package/esm/controlled-combobox/utils/listHelper.js +2 -2
  59. package/package.json +30 -38
  60. package/types/controlled-combobox/ComboBox.d.ts +4 -70
  61. package/types/controlled-combobox/ComboBoxCTX.d.ts +4 -3
  62. package/types/controlled-combobox/ComboboxDataTestids.d.ts +1 -0
  63. package/types/controlled-combobox/config/useComboBox.d.ts +3 -2
  64. package/types/controlled-combobox/config/useCorrectOptions.d.ts +3 -0
  65. package/types/controlled-combobox/parts/a11y-messages/FocusMenuItem.d.ts +3 -0
  66. package/types/controlled-combobox/parts/a11y-messages/SelectedValuesAllyMsg.d.ts +3 -0
  67. package/types/controlled-combobox/parts/a11y-messages/index.d.ts +2 -2
  68. package/types/controlled-combobox/parts/controls/styled.d.ts +10 -2
  69. package/types/controlled-combobox/parts/controls/useOnPillsNavigation.d.ts +4 -0
  70. package/types/controlled-combobox/parts/dropdown-indicator/styled.d.ts +2 -1
  71. package/types/controlled-combobox/react-desc-prop-types.d.ts +53 -0
  72. package/types/controlled-combobox/sharedTypes.d.ts +29 -0
  73. package/types/controlled-combobox/utils/hooks/useKeyboardNavigation.d.ts +1 -1
  74. package/types/controlled-combobox/utils/listHelper.d.ts +7 -7
  75. package/types/controlled-date-time-picker/parts/Pickers/Calendar/Styleds.d.ts +3 -12
  76. package/types/controlled-date-time-picker/parts/Pickers/CalendarWithTimeWheel/Styleds.d.ts +1 -4
  77. package/types/controlled-date-time-picker/parts/Pickers/TimeWheel/Styleds.d.ts +3 -12
  78. package/types/controlled-date-time-picker/parts/Styleds.d.ts +1 -4
  79. package/cjs/controlled-combobox/config/constants.js +0 -14
  80. package/cjs/controlled-combobox/config/useGetPropsWithDefault.js +0 -11
  81. package/cjs/controlled-combobox/parts/a11y-messages/SingleAllyMessages.js +0 -28
  82. package/cjs/controlled-combobox/parts/single-selected-value-container/SingleSelectedValueContainer.js +0 -28
  83. package/cjs/controlled-combobox/parts/single-selected-value-container/index.js +0 -9
  84. package/cjs/controlled-combobox/parts/single-selected-value-container/styled.js +0 -15
  85. package/cjs/controlled-combobox/propTypes.js +0 -28
  86. package/esm/controlled-combobox/config/constants.js +0 -10
  87. package/esm/controlled-combobox/config/useGetPropsWithDefault.js +0 -7
  88. package/esm/controlled-combobox/parts/a11y-messages/MultiAllyMessages.js +0 -25
  89. package/esm/controlled-combobox/parts/a11y-messages/SingleAllyMessages.js +0 -20
  90. package/esm/controlled-combobox/parts/single-selected-value-container/SingleSelectedValueContainer.js +0 -20
  91. package/esm/controlled-combobox/parts/single-selected-value-container/index.js +0 -1
  92. package/esm/controlled-combobox/parts/single-selected-value-container/styled.js +0 -7
  93. package/types/controlled-combobox/config/constants.d.ts +0 -8
  94. package/types/controlled-combobox/config/useGetPropsWithDefault.d.ts +0 -2
  95. package/types/controlled-combobox/parts/a11y-messages/MultiAllyMessages.d.ts +0 -3
  96. package/types/controlled-combobox/parts/a11y-messages/SingleAllyMessages.d.ts +0 -3
  97. package/types/controlled-combobox/parts/single-selected-value-container/SingleSelectedValueContainer.d.ts +0 -3
  98. package/types/controlled-combobox/parts/single-selected-value-container/index.d.ts +0 -1
  99. package/types/controlled-combobox/parts/single-selected-value-container/styled.d.ts +0 -1
  100. package/types/controlled-combobox/propTypes.d.ts +0 -60
  101. package/types/controlled-combobox/tests/combobox-special-keys.test.d.ts +0 -1
@@ -13,38 +13,50 @@ var _taggedTemplateLiteral__default = /*#__PURE__*/_interopDefaultLegacy(_tagged
13
13
  var styled__default = /*#__PURE__*/_interopDefaultLegacy(styled);
14
14
 
15
15
  var _templateObject, _templateObject2;
16
- const normalBorder = dsSystem.css(_templateObject || (_templateObject = _taggedTemplateLiteral__default["default"](["\n border: 1px solid ", ";\n"])), props => props.hasError ? props.theme.colors.danger[900] : props.theme.colors.neutral[400]);
17
- const focusBorder = dsSystem.css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral__default["default"](["\n border: 2px solid ", ";\n"])), _ref => {
16
+ const normalBorder = dsSystem.css(_templateObject || (_templateObject = _taggedTemplateLiteral__default["default"](["\n border: 1px solid ", ";\n"])), _ref => {
18
17
  let {
18
+ hasError,
19
19
  theme
20
20
  } = _ref;
21
+ return hasError ? theme.colors.danger[900] : theme.colors.neutral[400];
22
+ });
23
+ const focusBorder = dsSystem.css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral__default["default"](["\n border: 2px solid ", ";\n"])), _ref2 => {
24
+ let {
25
+ theme
26
+ } = _ref2;
21
27
  return theme.colors.brand[700];
22
28
  });
23
29
  const StyledControlsWrapper = /*#__PURE__*/styled__default["default"](Grid.Grid).withConfig({
24
30
  componentId: "sc-z30aed-0"
25
- })(["background:transparent;position:relative;border-radius:2px;min-width:", ";align-items:center;align-content:center;height:28px;padding-left:8px;margin:", ";&::after{display:block;content:' ';position:absolute;top:0;left:0;right:0;bottom:0;border-radius:2px;", " pointer-events:none;z-index:7;}"], _ref2 => {
31
+ })(["background:", ";position:relative;border-radius:2px;min-width:", ";align-items:center;align-content:center;height:28px;padding-left:8px;margin:", ";&::after{display:block;content:' ';position:absolute;top:0;left:0;right:0;bottom:0;border-radius:2px;", " pointer-events:none;z-index:7;}"], _ref3 => {
32
+ let {
33
+ disabled,
34
+ theme
35
+ } = _ref3;
36
+ return disabled ? theme.colors.neutral['200'] : '#ffffff';
37
+ }, _ref4 => {
26
38
  let {
27
39
  minWidth,
28
40
  inline
29
- } = _ref2;
41
+ } = _ref4;
30
42
  return inline ? '' : "".concat(minWidth, "px");
31
- }, _ref3 => {
43
+ }, _ref5 => {
32
44
  let {
33
45
  inline
34
- } = _ref3;
46
+ } = _ref5;
35
47
  return inline ? '10px 16px' : 'none';
36
- }, _ref4 => {
48
+ }, _ref6 => {
37
49
  let {
38
50
  hasFocus
39
- } = _ref4;
51
+ } = _ref6;
40
52
  return hasFocus ? focusBorder : normalBorder;
41
53
  });
42
54
  const StyledSelection = /*#__PURE__*/styled__default["default"].div.withConfig({
43
55
  componentId: "sc-z30aed-1"
44
56
  })(["font-size:13px;margin-right:3px;line-height:13px;display:flex;"]);
45
- const StyledHeaderActionsWrapper = /*#__PURE__*/styled__default["default"].div.withConfig({
57
+ const StyledHeaderActionsWrapper = /*#__PURE__*/styled__default["default"](Grid.Grid).withConfig({
46
58
  componentId: "sc-z30aed-2"
47
- })(["align-items:center;align-self:stretch;display:flex;box-sizing:border-box;height:28px;.em-ds-button--text:focus::after{border:none;}"]);
59
+ })(["height:100%;.em-ds-button--text:focus::after{border:none;}"]);
48
60
  const StyleDropdownIndicator = /*#__PURE__*/styled__default["default"].div.withConfig({
49
61
  componentId: "sc-z30aed-3"
50
62
  })([""]);
@@ -0,0 +1,51 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var React = require('react');
6
+ var ComboBoxCTX = require('../../ComboBoxCTX.js');
7
+
8
+ /* eslint-disable max-lines */
9
+ const useOnPillsNavigation = () => {
10
+ const {
11
+ props: {
12
+ innerRef
13
+ },
14
+ setShowPopover,
15
+ pillGroupRef
16
+ } = React.useContext(ComboBoxCTX.ComboBoxContext);
17
+ const REMOVABLE_PILL_SELECTOR = '.ds-pill-wrapper-removable button';
18
+ const onKeyDownPills = React.useCallback(e => {
19
+ var _innerRef$current;
20
+
21
+ if ((e.key === 'ArrowLeft' || e.key === 'ArrowRight' || e.key === 'ArrowUp' || e.key === 'ArrowDown') && ((_innerRef$current = innerRef.current) === null || _innerRef$current === void 0 ? void 0 : _innerRef$current.value) === '') {
22
+ if (e.key === 'ArrowUp' || e.key === 'ArrowDown') {
23
+ innerRef.current.focus();
24
+ setShowPopover(true);
25
+ return;
26
+ }
27
+
28
+ if (e.key === 'ArrowLeft') {
29
+ var _pillGroupRef$current;
30
+
31
+ const removablePills = (_pillGroupRef$current = pillGroupRef.current) === null || _pillGroupRef$current === void 0 ? void 0 : _pillGroupRef$current.querySelectorAll(REMOVABLE_PILL_SELECTOR);
32
+
33
+ if (document.activeElement === innerRef.current && removablePills) {
34
+ var _removablePills;
35
+
36
+ (_removablePills = removablePills[removablePills.length - 1]) === null || _removablePills === void 0 ? void 0 : _removablePills.focus();
37
+ }
38
+ }
39
+
40
+ if (e.key === 'ArrowRight') {
41
+ e.preventDefault();
42
+ innerRef.current.focus();
43
+ }
44
+ }
45
+ }, [innerRef, pillGroupRef, setShowPopover]);
46
+ return {
47
+ onKeyDownPills
48
+ };
49
+ };
50
+
51
+ exports.useOnPillsNavigation = useOnPillsNavigation;
@@ -19,11 +19,11 @@ var _jsx__default = /*#__PURE__*/_interopDefaultLegacy(_jsx);
19
19
  const ControlsInput = () => {
20
20
  const {
21
21
  props: {
22
- autoFocus
22
+ autoFocus,
23
+ disabled,
24
+ innerRef
23
25
  },
24
- showPopover,
25
- focusOptionIdx,
26
- inputRef
26
+ focusOptionIdx
27
27
  } = React.useContext(ComboBoxCTX.ComboBoxContext);
28
28
  const {
29
29
  onInputKeyDown
@@ -45,17 +45,17 @@ const ControlsInput = () => {
45
45
  })), /*#__PURE__*/jsxRuntime.jsx(styled.StyledInput, {
46
46
  "data-testid": ComboboxDataTestids.ComboboxDataTestid.INPUT,
47
47
  autoFocus: autoFocus,
48
- "aria-labelledby": "combo-label",
49
- "aria-controls": "combo-listbox",
48
+ id: "combo-input",
50
49
  "aria-owns": "combo-listbox",
51
50
  "aria-activedescendant": focusOptionIdx,
52
- "aria-expanded": showPopover,
53
- "aria-haspopup": "listbox",
51
+ "aria-expanded": "false",
52
+ "aria-haspopup": "true",
54
53
  role: "combobox",
54
+ disabled: disabled,
55
55
  style: {
56
56
  width
57
57
  },
58
- ref: inputRef,
58
+ ref: innerRef,
59
59
  type: "text",
60
60
  onKeyDown: onInputKeyDown,
61
61
  onChange: handleOnChange,
@@ -5,21 +5,22 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  require('core-js/modules/web.dom-collections.iterator.js');
6
6
  require('core-js/modules/es.string.replace.js');
7
7
  var React = require('react');
8
+ var lodash = require('lodash');
8
9
  var ComboBoxCTX = require('../../ComboBoxCTX.js');
9
10
  var listHelper = require('../../utils/listHelper.js');
10
11
 
11
12
  const useControlsInput = () => {
12
- var _inputRef$current, _inputRef$current2, _inputRef$current3;
13
+ var _innerRef$current, _innerRef$current2, _innerRef$current3;
13
14
 
14
15
  const {
15
16
  props: {
16
17
  selectedValues,
18
+ innerRef,
17
19
  placeholder,
18
20
  onFilter
19
21
  },
20
22
  setShowPopover,
21
23
  setCurrentOption,
22
- inputRef,
23
24
  wrapperListRef,
24
25
  setHasFocus,
25
26
  setShowSelectedOptions
@@ -30,17 +31,22 @@ const useControlsInput = () => {
30
31
  var _spanReference$curren;
31
32
 
32
33
  setWidth(((_spanReference$curren = spanReference.current) === null || _spanReference$curren === void 0 ? void 0 : _spanReference$curren.offsetWidth) || 1);
33
- }, [(_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 ? void 0 : _inputRef$current.value]); // When writting open popover
34
+ }, [(_innerRef$current = innerRef.current) === null || _innerRef$current === void 0 ? void 0 : _innerRef$current.value]); // When writting open popover
34
35
  // and refresh selected values and update filter outside value.
35
36
 
36
37
  const handleOnChange = React.useCallback(e => {
38
+ if (onFilter === lodash.noop && innerRef.current) {
39
+ innerRef.current.value = '';
40
+ return;
41
+ }
42
+
37
43
  setShowSelectedOptions(false);
38
44
  setShowPopover(true);
39
45
  onFilter(e.currentTarget.value);
40
- }, [onFilter, setShowPopover, setShowSelectedOptions]);
46
+ }, [onFilter, innerRef, setShowPopover, setShowSelectedOptions]);
41
47
  const handleOnBlur = React.useCallback(() => {
42
48
  setHasFocus(false);
43
- if (inputRef.current) inputRef.current.value = '';
49
+ if (innerRef.current) innerRef.current.value = '';
44
50
  setTimeout(() => {
45
51
  var _wrapperListRef$curre;
46
52
 
@@ -51,12 +57,12 @@ const useControlsInput = () => {
51
57
  setCurrentOption('');
52
58
  onFilter('');
53
59
  });
54
- }, [setHasFocus, setCurrentOption, wrapperListRef, onFilter, inputRef, setShowPopover]);
60
+ }, [setHasFocus, setCurrentOption, wrapperListRef, onFilter, innerRef, setShowPopover]);
55
61
  const handleOnFocus = React.useCallback(() => {
56
62
  setHasFocus(true);
57
63
  }, [setHasFocus]);
58
- const showPlaceholder = !((_inputRef$current2 = inputRef.current) !== null && _inputRef$current2 !== void 0 && _inputRef$current2.value) && listHelper.isSelectedValueEmpty(selectedValues) ? placeholder : null;
59
- const spanReferenceText = (_inputRef$current3 = inputRef.current) === null || _inputRef$current3 === void 0 ? void 0 : _inputRef$current3.value.replace(/\s/g, '\u00a0');
64
+ const showPlaceholder = !((_innerRef$current2 = innerRef.current) !== null && _innerRef$current2 !== void 0 && _innerRef$current2.value) && listHelper.isSelectedValueEmpty(selectedValues) ? placeholder : null;
65
+ const spanReferenceText = (_innerRef$current3 = innerRef.current) === null || _innerRef$current3 === void 0 ? void 0 : _innerRef$current3.value.replace(/\s/g, '\u00a0');
60
66
  return React.useMemo(() => ({
61
67
  handleOnFocus,
62
68
  handleOnBlur,
@@ -16,19 +16,22 @@ var _ChevronSmallDown;
16
16
 
17
17
  const DropdownIndicator = () => {
18
18
  const {
19
+ props: {
20
+ disabled
21
+ },
19
22
  showPopover
20
23
  } = React.useContext(ComboBoxCTX.ComboBoxContext);
21
24
  return /*#__PURE__*/_jsx__default["default"](styled.StyledDropDownButton, {
22
25
  "data-testid": ComboboxDataTestids.ComboboxDataTestid.DROPDOWN,
23
26
  "aria-controls": "combo-listbox",
24
27
  "aria-labelledby": "combo-label",
28
+ disabled: disabled,
25
29
  "aria-expanded": showPopover,
26
30
  "aria-haspopup": "listbox",
27
31
  "aria-hidden": true,
28
- buttonType: "text",
29
- icon: _ChevronSmallDown || (_ChevronSmallDown = /*#__PURE__*/_jsx__default["default"](ChevronSmallDown__default["default"], {})),
32
+ buttonType: "icon",
30
33
  tabIndex: -1
31
- });
34
+ }, void 0, _ChevronSmallDown || (_ChevronSmallDown = /*#__PURE__*/_jsx__default["default"](ChevronSmallDown__default["default"], {})));
32
35
  };
33
36
 
34
37
  module.exports = DropdownIndicator;
@@ -8,10 +8,9 @@ var DSButton = require('@elliemae/ds-button');
8
8
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
9
9
 
10
10
  var styled__default = /*#__PURE__*/_interopDefaultLegacy(styled);
11
- var DSButton__default = /*#__PURE__*/_interopDefaultLegacy(DSButton);
12
11
 
13
- const StyledDropDownButton = /*#__PURE__*/styled__default["default"](DSButton__default["default"]).withConfig({
12
+ const StyledDropDownButton = /*#__PURE__*/styled__default["default"](DSButton.DSButtonV2).withConfig({
14
13
  componentId: "sc-14dzwqd-0"
15
- })(["box-sizing:border-box;width:100;& svg{fill:", ";}"], props => props.theme.colors.brand['700']);
14
+ })(["&:focus::after{border:none;}& svg{fill:", ";}"], props => props.theme.colors.brand['700']);
16
15
 
17
16
  exports.StyledDropDownButton = StyledDropDownButton;
@@ -24,10 +24,10 @@ const HeaderList = () => {
24
24
  props: {
25
25
  onSelectAll,
26
26
  onClearAll,
27
- selectedValues
27
+ selectedValues,
28
+ innerRef
28
29
  },
29
30
  showSelectedOptions,
30
- inputRef,
31
31
  selectAllCheckboxRef,
32
32
  toggleSelectionButtonRef
33
33
  } = React.useContext(ComboBoxCTX.ComboBoxContext);
@@ -55,9 +55,9 @@ const HeaderList = () => {
55
55
  onBlur: () => {
56
56
  if (multiSelectedValues.length === 0) {
57
57
  setTimeout(() => {
58
- var _inputRef$current;
58
+ var _innerRef$current;
59
59
 
60
- return (_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 ? void 0 : _inputRef$current.focus();
60
+ return (_innerRef$current = innerRef.current) === null || _innerRef$current === void 0 ? void 0 : _innerRef$current.focus();
61
61
  });
62
62
  }
63
63
  },
@@ -65,9 +65,9 @@ const HeaderList = () => {
65
65
  })), /*#__PURE__*/_jsx__default["default"](styled.StyledSelectedItems, {}, void 0, multiSelectedValues.length > 0 ? /*#__PURE__*/_jsx__default["default"](styled.StyledButtonSelection, {
66
66
  onBlur: () => {
67
67
  setTimeout(() => {
68
- var _inputRef$current2;
68
+ var _innerRef$current2;
69
69
 
70
- return (_inputRef$current2 = inputRef.current) === null || _inputRef$current2 === void 0 ? void 0 : _inputRef$current2.focus();
70
+ return (_innerRef$current2 = innerRef.current) === null || _innerRef$current2 === void 0 ? void 0 : _innerRef$current2.focus();
71
71
  });
72
72
  },
73
73
  buttonType: "text",
@@ -13,9 +13,9 @@ const useHeaderListHandlers = () => {
13
13
  selectedValues,
14
14
  options,
15
15
  onSelectAll,
16
- onClearAll
16
+ onClearAll,
17
+ innerRef
17
18
  },
18
- inputRef,
19
19
  showSelectedOptions,
20
20
  setShowSelectedOptions,
21
21
  setShowPopover
@@ -44,10 +44,10 @@ const useHeaderListHandlers = () => {
44
44
  }
45
45
  }, [checkboxStatus, onSelectAll, onClearAll]);
46
46
  const handleToggle = React.useCallback(() => {
47
- if (inputRef.current) inputRef.current.value = '';
47
+ if (innerRef.current) innerRef.current.value = '';
48
48
  onFilter('');
49
49
  setShowSelectedOptions(!showSelectedOptions);
50
- }, [setShowSelectedOptions, inputRef, onFilter, showSelectedOptions]);
50
+ }, [setShowSelectedOptions, innerRef, onFilter, showSelectedOptions]);
51
51
  const handleKeyDown = React.useCallback(e => {
52
52
  if (e.key === 'Escape') {
53
53
  setShowPopover(false);
@@ -22,7 +22,7 @@ var _jsx__default = /*#__PURE__*/_interopDefaultLegacy(_jsx);
22
22
  var _HeaderList, _EmptyState;
23
23
 
24
24
  const MenuList = () => {
25
- var _inputRef$current;
25
+ var _innerRef$current;
26
26
 
27
27
  const {
28
28
  props: {
@@ -31,12 +31,11 @@ const MenuList = () => {
31
31
  onCreate,
32
32
  inline,
33
33
  options,
34
- selectedValues
34
+ selectedValues,
35
+ innerRef
35
36
  },
36
37
  referenceElement,
37
- inputRef,
38
38
  listRef,
39
- showPopover,
40
39
  wrapperListRef,
41
40
  controlsWrapperRef,
42
41
  virtualListHelpers
@@ -46,16 +45,18 @@ const MenuList = () => {
46
45
  } = virtualListHelpers;
47
46
  const isOnCreatedSupplied = onCreate !== lodash.noop;
48
47
  const multiple = Array.isArray(selectedValues);
49
- const withHeader = !inline && multiple && options.length > 0 && ((_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 ? void 0 : _inputRef$current.value) === '';
48
+ const withHeader = !inline && multiple && options.length > 0 && ((_innerRef$current = innerRef.current) === null || _innerRef$current === void 0 ? void 0 : _innerRef$current.value) === '';
50
49
  const ItemRenderer = useItemRenderer.useItemRenderer();
51
50
  useMenuList.useMenuList();
52
51
  const {
53
52
  width
54
53
  } = useOnElementResize.useOnElementResize(controlsWrapperRef);
55
54
  const listWidth = React.useMemo(() => menuMinWidth || "".concat(referenceElement === null || referenceElement === void 0 ? void 0 : referenceElement.offsetWidth), // eslint-disable-next-line react-hooks/exhaustive-deps
56
- [menuMinWidth, referenceElement, width]);
57
- const handleOnFocus = React.useCallback(() => {// inputRef.current?.focus();
58
- }, [inputRef]);
55
+ [menuMinWidth, referenceElement, width]); // validate funcionality with ux
56
+ // const handleOnFocus = useCallback(() => {
57
+ // // innerRef.current?.focus();
58
+ // }, [innerRef]);
59
+
59
60
  return /*#__PURE__*/jsxRuntime.jsxs(styled.StyledListWrapper, {
60
61
  ref: wrapperListRef,
61
62
  inline: inline,
@@ -69,9 +70,6 @@ const MenuList = () => {
69
70
  children: /*#__PURE__*/_jsx__default["default"](styled.StyledList, {
70
71
  id: "combo-listbox",
71
72
  role: "listbox",
72
- tabIndex: -1,
73
- "aria-expanded": showPopover,
74
- onFocus: handleOnFocus,
75
73
  "data-testid": ComboboxDataTestids.ComboboxDataTestid.LIST,
76
74
  style: {
77
75
  height: totalSize,
@@ -10,7 +10,7 @@ var styled__default = /*#__PURE__*/_interopDefaultLegacy(styled);
10
10
 
11
11
  const StyledListWrapper = /*#__PURE__*/styled__default["default"].div.withConfig({
12
12
  componentId: "sc-g2fmft-0"
13
- })(["min-width:", ";"], props => props.inline ? '100%' : "".concat(props.minWidth, "px"));
13
+ })(["min-width:", ";background-color:#ffffff;"], props => props.inline ? '100%' : "".concat(props.minWidth, "px"));
14
14
  const StyledList = /*#__PURE__*/styled__default["default"].ul.withConfig({
15
15
  componentId: "sc-g2fmft-1"
16
16
  })(["position:relative;padding:0;"]);
@@ -38,9 +38,9 @@ const useItemRenderer = () => {
38
38
  onCreate,
39
39
  onChange,
40
40
  selectedValues,
41
- onFilter
41
+ onFilter,
42
+ innerRef
42
43
  },
43
- inputRef,
44
44
  setShowPopover,
45
45
  focusOptionIdx,
46
46
  virtualListHelpers
@@ -52,9 +52,9 @@ const useItemRenderer = () => {
52
52
  const CBItem = multiple ? dsForm.MultiMenuItem : dsForm.SingleMenuItem;
53
53
  const handleClick = React.useCallback((option, e) => {
54
54
  if (option.type === 'creatable') {
55
- if (inputRef.current) {
56
- onCreate(inputRef.current.value);
57
- inputRef.current.value = '';
55
+ if (innerRef.current) {
56
+ onCreate(innerRef.current.value);
57
+ innerRef.current.value = '';
58
58
  onFilter('');
59
59
  }
60
60
 
@@ -62,16 +62,16 @@ const useItemRenderer = () => {
62
62
  }
63
63
 
64
64
  if (!multiple) {
65
- setShowPopover(false);
66
- if (inputRef.current) inputRef.current.value = '';
67
- } else if (inputRef.current) {
68
- onFilter(inputRef.current.value);
65
+ if (!option.disabled) setShowPopover(false);
66
+ if (innerRef.current) innerRef.current.value = '';
67
+ } else if (innerRef.current) {
68
+ onFilter(innerRef.current.value);
69
69
  }
70
70
 
71
71
  onChange(option);
72
72
  e.stopPropagation();
73
73
  e.preventDefault();
74
- }, [onFilter, onChange, setShowPopover, multiple, inputRef]);
74
+ }, [onFilter, onChange, setShowPopover, multiple, innerRef]);
75
75
  const handleOnMouseDown = React.useCallback(e => {
76
76
  e.preventDefault();
77
77
  }, []);
@@ -134,7 +134,7 @@ const useItemRenderer = () => {
134
134
  }
135
135
 
136
136
  return /*#__PURE__*/jsxRuntime.jsx(jsxRuntime.Fragment, {});
137
- }), [options, focusOptionIdx, selectedValues, inputRef, virtualItems]);
137
+ }), [options, focusOptionIdx, selectedValues, innerRef, virtualItems]);
138
138
  return ItemRenderer;
139
139
  };
140
140
 
@@ -6,16 +6,16 @@ var React = require('react');
6
6
  var ComboBoxCTX = require('../../ComboBoxCTX.js');
7
7
 
8
8
  const useMenuList = () => {
9
- var _inputRef$current2;
9
+ var _innerRef$current2;
10
10
 
11
11
  const {
12
12
  props: {
13
13
  inline,
14
14
  selectedValues,
15
15
  onMenuOpen,
16
- options
16
+ options,
17
+ innerRef
17
18
  },
18
- inputRef,
19
19
  setCurrentOption,
20
20
  scrollOptionIntoView,
21
21
  hasFocus,
@@ -30,18 +30,16 @@ const useMenuList = () => {
30
30
  };
31
31
 
32
32
  if (showPopover || inline) {
33
- var _inputRef$current;
33
+ var _innerRef$current;
34
34
 
35
35
  if (onMenuOpen) onMenuOpen();
36
36
 
37
- if (((_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 ? void 0 : _inputRef$current.value) !== '') {
37
+ if (((_innerRef$current = innerRef.current) === null || _innerRef$current === void 0 ? void 0 : _innerRef$current.value) !== '') {
38
38
  getFirstOption();
39
39
  } else if (Array.isArray(selectedValues)) {
40
- const multiSelectedValues = selectedValues;
41
-
42
- if (multiSelectedValues.length > 0) {
43
- setCurrentOption(multiSelectedValues[multiSelectedValues.length - 1].dsId);
44
- scrollOptionIntoView(multiSelectedValues[multiSelectedValues.length - 1].dsId);
40
+ if (selectedValues && selectedValues.length > 0) {
41
+ setCurrentOption(selectedValues[selectedValues.length - 1].dsId);
42
+ scrollOptionIntoView(selectedValues[selectedValues.length - 1].dsId);
45
43
  } else {
46
44
  getFirstOption();
47
45
  }
@@ -49,15 +47,15 @@ const useMenuList = () => {
49
47
  const singleSelectedValue = selectedValues;
50
48
 
51
49
  if (singleSelectedValue) {
52
- setCurrentOption(selectedValues.dsId);
53
- scrollOptionIntoView(selectedValues.dsId);
50
+ setCurrentOption(singleSelectedValue.dsId);
51
+ scrollOptionIntoView(singleSelectedValue.dsId);
54
52
  } else {
55
53
  getFirstOption();
56
54
  }
57
55
  }
58
56
  } // eslint-disable-next-line react-hooks/exhaustive-deps
59
57
 
60
- }, [showPopover, inline, hasFocus, (_inputRef$current2 = inputRef.current) === null || _inputRef$current2 === void 0 ? void 0 : _inputRef$current2.value]);
58
+ }, [showPopover, inline, hasFocus, (_innerRef$current2 = innerRef.current) === null || _innerRef$current2 === void 0 ? void 0 : _innerRef$current2.value]);
61
59
  };
62
60
 
63
61
  exports.useMenuList = useMenuList;
@@ -10,8 +10,7 @@ var Grid = require('@elliemae/ds-grid');
10
10
  var dsPills = require('@elliemae/ds-pills');
11
11
  var ComboBoxCTX = require('../../ComboBoxCTX.js');
12
12
  var useGroupPills = require('./useGroupPills.js');
13
- var MultiAllyMessages = require('../a11y-messages/MultiAllyMessages.js');
14
- require('styled-components');
13
+ var ComboboxDataTestids = require('../../ComboboxDataTestids.js');
15
14
  var jsxRuntime = require('react/jsx-runtime');
16
15
 
17
16
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
@@ -19,39 +18,44 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
19
18
  var _jsx__default = /*#__PURE__*/_interopDefaultLegacy(_jsx);
20
19
  var Grid__default = /*#__PURE__*/_interopDefaultLegacy(Grid);
21
20
 
22
- var _MultiAllyMessages;
23
-
24
21
  const MultiSelectedValuesContainer = () => {
25
- var _inputRef$current;
26
-
27
22
  const {
28
23
  props: {
29
- selectedValues
24
+ selectedValues,
25
+ onChange,
26
+ innerRef
30
27
  },
31
- inputRef,
32
28
  pillGroupRef
33
29
  } = React.useContext(ComboBoxCTX.ComboBoxContext);
34
30
  const multiSelectedValue = selectedValues;
35
- const pillsToShow = useGroupPills.useGroupPills();
36
- const correctPillsToShow = pillsToShow || 1;
31
+ const correctPillsToShow = useGroupPills.useGroupPills() || 1;
37
32
  const pills = React.useMemo(() => /*#__PURE__*/_jsx__default["default"](Grid__default["default"], {
38
33
  style: {
39
34
  width: 'max-content'
40
- }
35
+ },
36
+ onClick: e => e.stopPropagation(),
37
+ "data-testid": ComboboxDataTestids.ComboboxDataTestid.SELECTED_VALUES
41
38
  }, void 0, /*#__PURE__*/_jsx__default["default"](dsPills.DSPillGroupV2, {
42
39
  innerRef: pillGroupRef
43
40
  }, void 0, multiSelectedValue.length > 0 && multiSelectedValue.slice(0, correctPillsToShow).map(option => /*#__PURE__*/_jsx__default["default"](dsPills.DSPillV2, {
44
41
  size: "s",
45
42
  label: option.label,
46
- type: "value"
43
+ type: "removable",
44
+ tabIndex: -1,
45
+ onRemove: () => {
46
+ var _innerRef$current;
47
+
48
+ onChange(option);
49
+ (_innerRef$current = innerRef.current) === null || _innerRef$current === void 0 ? void 0 : _innerRef$current.focus();
50
+ }
47
51
  }, option.value)), multiSelectedValue.length > 0 && correctPillsToShow !== multiSelectedValue.length && /*#__PURE__*/_jsx__default["default"](dsPills.DSPillV2, {
48
52
  size: "s",
49
53
  labelTruncated: false,
50
54
  label: "+".concat(multiSelectedValue.length - correctPillsToShow),
51
55
  type: "value"
52
- }, "grouped"))), [pillGroupRef, multiSelectedValue, correctPillsToShow]);
53
- return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
54
- children: [multiSelectedValue.length > 0 && !((_inputRef$current = inputRef.current) !== null && _inputRef$current !== void 0 && _inputRef$current.value) && (_MultiAllyMessages || (_MultiAllyMessages = /*#__PURE__*/_jsx__default["default"](MultiAllyMessages.MultiAllyMessages, {}))), pills]
56
+ }, "grouped"))), [pillGroupRef, innerRef, onChange, multiSelectedValue, correctPillsToShow]);
57
+ return /*#__PURE__*/jsxRuntime.jsx(jsxRuntime.Fragment, {
58
+ children: pills
55
59
  });
56
60
  };
57
61
 
@@ -21,9 +21,9 @@ const getGroupedPillWidth = remainingPills => {
21
21
  const useGroupPills = () => {
22
22
  const {
23
23
  props: {
24
- selectedValues
24
+ selectedValues,
25
+ innerRef
25
26
  },
26
- inputRef,
27
27
  selectedOptionsRef,
28
28
  controlsWrapperRef,
29
29
  pillGroupRef
@@ -35,7 +35,7 @@ const useGroupPills = () => {
35
35
  } = useOnElementResize.useOnElementResize(controlsWrapperRef);
36
36
  const {
37
37
  width: widthInput
38
- } = useOnElementResize.useOnElementResize(inputRef || null);
38
+ } = useOnElementResize.useOnElementResize(innerRef || null);
39
39
  React.useEffect(() => {
40
40
  if (multiSelectedValues.length !== pillsToShow) {
41
41
  setPillsToShow(multiSelectedValues.length);
@@ -48,7 +48,7 @@ const useGroupPills = () => {
48
48
  let lastPillFit = -1;
49
49
  let currentWidth = 0;
50
50
  const referenceWidth = selectedOptionsRef.current.offsetWidth;
51
- const pills = [...selectedOptionsRef.current.querySelectorAll('.ds-pill-wrapper-value')];
51
+ const pills = [...selectedOptionsRef.current.querySelectorAll('.ds-pill-wrapper-removable')];
52
52
  const pillsWidth = pills.map(pill => pill === null || pill === void 0 ? void 0 : pill.offsetWidth);
53
53
  pillsWidth.forEach((pillWidth, idx) => {
54
54
  currentWidth += pillWidth;
@@ -68,7 +68,7 @@ const useGroupPills = () => {
68
68
 
69
69
  if (pillGroupRef.current) pillGroupRef.current.style.width = 'fit-content';
70
70
  }
71
- }, [selectedOptionsRef, inputRef, multiSelectedValues, pillsToShow, pillGroupRef, width, widthInput]);
71
+ }, [selectedOptionsRef, innerRef, multiSelectedValues, pillsToShow, pillGroupRef, width, widthInput]);
72
72
  return pillsToShow;
73
73
  };
74
74