@elliemae/ds-controlled-form 2.3.0-next.5 → 2.3.0-next.9

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
@@ -7,19 +7,23 @@ import { ComboBoxContext } from '../../ComboBoxCTX.js';
7
7
  import { StyledControlsWrapper, StyledSelection, StyledHeaderActionsWrapper, StyleHeaderActionsSeparator } from './styled.js';
8
8
  import { MultiSelectedValuesContainer } from '../multi-selected-values-container/MultiSelectedValuesContainer.js';
9
9
  import { ControlsInput } from '../controls-input/ControlsInput.js';
10
- import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
10
+ import { useOnPillsNavigation } from './useOnPillsNavigation.js';
11
+ import { SelectedValuesAllyMsg } from '../a11y-messages/SelectedValuesAllyMsg.js';
12
+ import { FocusMenuItem } from '../a11y-messages/FocusMenuItem.js';
13
+ import { jsxs } from 'react/jsx-runtime';
11
14
 
12
- var _MultiSelectedValuesC, _ControlsInput, _StyledHeaderActionsW;
15
+ var _SelectedValuesAllyMs, _FocusMenuItem, _MultiSelectedValuesC, _ControlsInput, _StyleHeaderActionsSe, _DropdownIndicator;
13
16
 
14
17
  const Controls = () => {
15
18
  const {
16
19
  props: {
17
20
  inline,
21
+ disabled,
18
22
  inputMinWidth,
19
23
  hasError,
20
- selectedValues
24
+ selectedValues,
25
+ innerRef
21
26
  },
22
- inputRef,
23
27
  selectedOptionsRef,
24
28
  setShowPopover,
25
29
  showPopover,
@@ -28,17 +32,17 @@ const Controls = () => {
28
32
  } = useContext(ComboBoxContext);
29
33
  const handleOnClick = useCallback(() => {
30
34
  if (hasFocus && showPopover && !inline) {
31
- var _inputRef$current;
35
+ var _innerRef$current;
32
36
 
33
- (_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 ? void 0 : _inputRef$current.blur();
37
+ (_innerRef$current = innerRef.current) === null || _innerRef$current === void 0 ? void 0 : _innerRef$current.blur();
34
38
  } else if (hasFocus) {
35
39
  setShowPopover(true);
36
40
  } else {
37
- var _inputRef$current2;
41
+ var _innerRef$current2;
38
42
 
39
- (_inputRef$current2 = inputRef.current) === null || _inputRef$current2 === void 0 ? void 0 : _inputRef$current2.focus();
43
+ (_innerRef$current2 = innerRef.current) === null || _innerRef$current2 === void 0 ? void 0 : _innerRef$current2.focus();
40
44
  }
41
- }, [hasFocus, setShowPopover, showPopover, inputRef, inline]);
45
+ }, [hasFocus, setShowPopover, showPopover, innerRef, inline]);
42
46
 
43
47
  const handleOnMouseDown = e => {
44
48
  if (hasFocus || inline) {
@@ -46,28 +50,35 @@ const Controls = () => {
46
50
  }
47
51
  };
48
52
 
53
+ const {
54
+ onKeyDownPills
55
+ } = useOnPillsNavigation();
49
56
  const cols = !inline ? ['minmax(0px,max-content)', 'minmax(20px, auto)', '29px'] : ['minmax(0px, auto)'];
50
57
  return /*#__PURE__*/jsxs(StyledControlsWrapper, {
51
58
  ref: controlsWrapperRef,
52
59
  cols: cols,
60
+ disabled: disabled,
53
61
  minWidth: inputMinWidth,
54
62
  hasError: hasError,
55
63
  hasFocus: hasFocus,
56
64
  inline: inline,
57
65
  onClick: handleOnClick,
58
66
  onMouseDown: handleOnMouseDown,
59
- children: [!inline && /*#__PURE__*/jsx(StyledSelection, {
67
+ onKeyDown: onKeyDownPills,
68
+ children: [!inline && /*#__PURE__*/jsxs(StyledSelection, {
60
69
  ref: selectedOptionsRef,
61
- "data-testid": ComboboxDataTestid.SELECTED_VALUES,
62
- children: Array.isArray(selectedValues) ? _MultiSelectedValuesC || (_MultiSelectedValuesC = /*#__PURE__*/_jsx(MultiSelectedValuesContainer, {})) : /*#__PURE__*/jsx(Fragment, {
63
- children: selectedValues && /*#__PURE__*/_jsx(DSPillV2, {
64
- size: "s",
65
- labelTruncated: true,
66
- label: selectedValues.label,
67
- type: "value"
68
- }, selectedValues.value)
69
- })
70
- }), _ControlsInput || (_ControlsInput = /*#__PURE__*/_jsx(ControlsInput, {})), !inline && (_StyledHeaderActionsW || (_StyledHeaderActionsW = /*#__PURE__*/_jsx(StyledHeaderActionsWrapper, {}, void 0, /*#__PURE__*/_jsx(StyleHeaderActionsSeparator, {}), /*#__PURE__*/_jsx(DropdownIndicator, {}))))]
70
+ children: [_SelectedValuesAllyMs || (_SelectedValuesAllyMs = /*#__PURE__*/_jsx(SelectedValuesAllyMsg, {})), _FocusMenuItem || (_FocusMenuItem = /*#__PURE__*/_jsx(FocusMenuItem, {})), Array.isArray(selectedValues) ? _MultiSelectedValuesC || (_MultiSelectedValuesC = /*#__PURE__*/_jsx(MultiSelectedValuesContainer, {})) : /*#__PURE__*/_jsx("div", {
71
+ "data-testid": ComboboxDataTestid.SELECTED_VALUES
72
+ }, void 0, selectedValues && /*#__PURE__*/_jsx(DSPillV2, {
73
+ size: "s",
74
+ labelTruncated: true,
75
+ label: selectedValues.label,
76
+ type: "value"
77
+ }, selectedValues.value))]
78
+ }), _ControlsInput || (_ControlsInput = /*#__PURE__*/_jsx(ControlsInput, {})), !inline && /*#__PURE__*/_jsx(StyledHeaderActionsWrapper, {
79
+ justifyContent: "center",
80
+ cols: ['auto', 'auto']
81
+ }, void 0, _StyleHeaderActionsSe || (_StyleHeaderActionsSe = /*#__PURE__*/_jsx(StyleHeaderActionsSeparator, {})), _DropdownIndicator || (_DropdownIndicator = /*#__PURE__*/_jsx(DropdownIndicator, {})))]
71
82
  });
72
83
  };
73
84
 
@@ -4,38 +4,50 @@ import { css } from '@elliemae/ds-system';
4
4
  import { Grid } from '@elliemae/ds-grid';
5
5
 
6
6
  var _templateObject, _templateObject2;
7
- const normalBorder = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n border: 1px solid ", ";\n"])), props => props.hasError ? props.theme.colors.danger[900] : props.theme.colors.neutral[400]);
8
- const focusBorder = css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n border: 2px solid ", ";\n"])), _ref => {
7
+ const normalBorder = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n border: 1px solid ", ";\n"])), _ref => {
9
8
  let {
9
+ hasError,
10
10
  theme
11
11
  } = _ref;
12
+ return hasError ? theme.colors.danger[900] : theme.colors.neutral[400];
13
+ });
14
+ const focusBorder = css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n border: 2px solid ", ";\n"])), _ref2 => {
15
+ let {
16
+ theme
17
+ } = _ref2;
12
18
  return theme.colors.brand[700];
13
19
  });
14
20
  const StyledControlsWrapper = /*#__PURE__*/styled(Grid).withConfig({
15
21
  componentId: "sc-z30aed-0"
16
- })(["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 => {
22
+ })(["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 => {
23
+ let {
24
+ disabled,
25
+ theme
26
+ } = _ref3;
27
+ return disabled ? theme.colors.neutral['200'] : '#ffffff';
28
+ }, _ref4 => {
17
29
  let {
18
30
  minWidth,
19
31
  inline
20
- } = _ref2;
32
+ } = _ref4;
21
33
  return inline ? '' : "".concat(minWidth, "px");
22
- }, _ref3 => {
34
+ }, _ref5 => {
23
35
  let {
24
36
  inline
25
- } = _ref3;
37
+ } = _ref5;
26
38
  return inline ? '10px 16px' : 'none';
27
- }, _ref4 => {
39
+ }, _ref6 => {
28
40
  let {
29
41
  hasFocus
30
- } = _ref4;
42
+ } = _ref6;
31
43
  return hasFocus ? focusBorder : normalBorder;
32
44
  });
33
45
  const StyledSelection = /*#__PURE__*/styled.div.withConfig({
34
46
  componentId: "sc-z30aed-1"
35
47
  })(["font-size:13px;margin-right:3px;line-height:13px;display:flex;"]);
36
- const StyledHeaderActionsWrapper = /*#__PURE__*/styled.div.withConfig({
48
+ const StyledHeaderActionsWrapper = /*#__PURE__*/styled(Grid).withConfig({
37
49
  componentId: "sc-z30aed-2"
38
- })(["align-items:center;align-self:stretch;display:flex;box-sizing:border-box;height:28px;.em-ds-button--text:focus::after{border:none;}"]);
50
+ })(["height:100%;.em-ds-button--text:focus::after{border:none;}"]);
39
51
  const StyleDropdownIndicator = /*#__PURE__*/styled.div.withConfig({
40
52
  componentId: "sc-z30aed-3"
41
53
  })([""]);
@@ -0,0 +1,47 @@
1
+ import { useContext, useCallback } from 'react';
2
+ import { ComboBoxContext } from '../../ComboBoxCTX.js';
3
+
4
+ /* eslint-disable max-lines */
5
+ const useOnPillsNavigation = () => {
6
+ const {
7
+ props: {
8
+ innerRef
9
+ },
10
+ setShowPopover,
11
+ pillGroupRef
12
+ } = useContext(ComboBoxContext);
13
+ const REMOVABLE_PILL_SELECTOR = '.ds-pill-wrapper-removable button';
14
+ const onKeyDownPills = useCallback(e => {
15
+ var _innerRef$current;
16
+
17
+ 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) === '') {
18
+ if (e.key === 'ArrowUp' || e.key === 'ArrowDown') {
19
+ innerRef.current.focus();
20
+ setShowPopover(true);
21
+ return;
22
+ }
23
+
24
+ if (e.key === 'ArrowLeft') {
25
+ var _pillGroupRef$current;
26
+
27
+ const removablePills = (_pillGroupRef$current = pillGroupRef.current) === null || _pillGroupRef$current === void 0 ? void 0 : _pillGroupRef$current.querySelectorAll(REMOVABLE_PILL_SELECTOR);
28
+
29
+ if (document.activeElement === innerRef.current && removablePills) {
30
+ var _removablePills;
31
+
32
+ (_removablePills = removablePills[removablePills.length - 1]) === null || _removablePills === void 0 ? void 0 : _removablePills.focus();
33
+ }
34
+ }
35
+
36
+ if (e.key === 'ArrowRight') {
37
+ e.preventDefault();
38
+ innerRef.current.focus();
39
+ }
40
+ }
41
+ }, [innerRef, pillGroupRef, setShowPopover]);
42
+ return {
43
+ onKeyDownPills
44
+ };
45
+ };
46
+
47
+ export { useOnPillsNavigation };
@@ -11,11 +11,11 @@ import { jsx } from 'react/jsx-runtime';
11
11
  const ControlsInput = () => {
12
12
  const {
13
13
  props: {
14
- autoFocus
14
+ autoFocus,
15
+ disabled,
16
+ innerRef
15
17
  },
16
- showPopover,
17
- focusOptionIdx,
18
- inputRef
18
+ focusOptionIdx
19
19
  } = useContext(ComboBoxContext);
20
20
  const {
21
21
  onInputKeyDown
@@ -37,17 +37,17 @@ const ControlsInput = () => {
37
37
  })), /*#__PURE__*/jsx(StyledInput, {
38
38
  "data-testid": ComboboxDataTestid.INPUT,
39
39
  autoFocus: autoFocus,
40
- "aria-labelledby": "combo-label",
41
- "aria-controls": "combo-listbox",
40
+ id: "combo-input",
42
41
  "aria-owns": "combo-listbox",
43
42
  "aria-activedescendant": focusOptionIdx,
44
- "aria-expanded": showPopover,
45
- "aria-haspopup": "listbox",
43
+ "aria-expanded": "false",
44
+ "aria-haspopup": "true",
46
45
  role: "combobox",
46
+ disabled: disabled,
47
47
  style: {
48
48
  width
49
49
  },
50
- ref: inputRef,
50
+ ref: innerRef,
51
51
  type: "text",
52
52
  onKeyDown: onInputKeyDown,
53
53
  onChange: handleOnChange,
@@ -1,21 +1,22 @@
1
1
  import 'core-js/modules/web.dom-collections.iterator.js';
2
2
  import 'core-js/modules/es.string.replace.js';
3
3
  import { useContext, useState, useRef, useEffect, useCallback, useMemo } from 'react';
4
+ import { noop } from 'lodash';
4
5
  import { ComboBoxContext } from '../../ComboBoxCTX.js';
5
6
  import { isSelectedValueEmpty } from '../../utils/listHelper.js';
6
7
 
7
8
  const useControlsInput = () => {
8
- var _inputRef$current, _inputRef$current2, _inputRef$current3;
9
+ var _innerRef$current, _innerRef$current2, _innerRef$current3;
9
10
 
10
11
  const {
11
12
  props: {
12
13
  selectedValues,
14
+ innerRef,
13
15
  placeholder,
14
16
  onFilter
15
17
  },
16
18
  setShowPopover,
17
19
  setCurrentOption,
18
- inputRef,
19
20
  wrapperListRef,
20
21
  setHasFocus,
21
22
  setShowSelectedOptions
@@ -26,17 +27,22 @@ const useControlsInput = () => {
26
27
  var _spanReference$curren;
27
28
 
28
29
  setWidth(((_spanReference$curren = spanReference.current) === null || _spanReference$curren === void 0 ? void 0 : _spanReference$curren.offsetWidth) || 1);
29
- }, [(_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 ? void 0 : _inputRef$current.value]); // When writting open popover
30
+ }, [(_innerRef$current = innerRef.current) === null || _innerRef$current === void 0 ? void 0 : _innerRef$current.value]); // When writting open popover
30
31
  // and refresh selected values and update filter outside value.
31
32
 
32
33
  const handleOnChange = useCallback(e => {
34
+ if (onFilter === noop && innerRef.current) {
35
+ innerRef.current.value = '';
36
+ return;
37
+ }
38
+
33
39
  setShowSelectedOptions(false);
34
40
  setShowPopover(true);
35
41
  onFilter(e.currentTarget.value);
36
- }, [onFilter, setShowPopover, setShowSelectedOptions]);
42
+ }, [onFilter, innerRef, setShowPopover, setShowSelectedOptions]);
37
43
  const handleOnBlur = useCallback(() => {
38
44
  setHasFocus(false);
39
- if (inputRef.current) inputRef.current.value = '';
45
+ if (innerRef.current) innerRef.current.value = '';
40
46
  setTimeout(() => {
41
47
  var _wrapperListRef$curre;
42
48
 
@@ -47,12 +53,12 @@ const useControlsInput = () => {
47
53
  setCurrentOption('');
48
54
  onFilter('');
49
55
  });
50
- }, [setHasFocus, setCurrentOption, wrapperListRef, onFilter, inputRef, setShowPopover]);
56
+ }, [setHasFocus, setCurrentOption, wrapperListRef, onFilter, innerRef, setShowPopover]);
51
57
  const handleOnFocus = useCallback(() => {
52
58
  setHasFocus(true);
53
59
  }, [setHasFocus]);
54
- const showPlaceholder = !((_inputRef$current2 = inputRef.current) !== null && _inputRef$current2 !== void 0 && _inputRef$current2.value) && isSelectedValueEmpty(selectedValues) ? placeholder : null;
55
- const spanReferenceText = (_inputRef$current3 = inputRef.current) === null || _inputRef$current3 === void 0 ? void 0 : _inputRef$current3.value.replace(/\s/g, '\u00a0');
60
+ const showPlaceholder = !((_innerRef$current2 = innerRef.current) !== null && _innerRef$current2 !== void 0 && _innerRef$current2.value) && isSelectedValueEmpty(selectedValues) ? placeholder : null;
61
+ const spanReferenceText = (_innerRef$current3 = innerRef.current) === null || _innerRef$current3 === void 0 ? void 0 : _innerRef$current3.value.replace(/\s/g, '\u00a0');
56
62
  return useMemo(() => ({
57
63
  handleOnFocus,
58
64
  handleOnBlur,
@@ -9,19 +9,22 @@ var _ChevronSmallDown;
9
9
 
10
10
  const DropdownIndicator = () => {
11
11
  const {
12
+ props: {
13
+ disabled
14
+ },
12
15
  showPopover
13
16
  } = useContext(ComboBoxContext);
14
17
  return /*#__PURE__*/_jsx(StyledDropDownButton, {
15
18
  "data-testid": ComboboxDataTestid.DROPDOWN,
16
19
  "aria-controls": "combo-listbox",
17
20
  "aria-labelledby": "combo-label",
21
+ disabled: disabled,
18
22
  "aria-expanded": showPopover,
19
23
  "aria-haspopup": "listbox",
20
24
  "aria-hidden": true,
21
- buttonType: "text",
22
- icon: _ChevronSmallDown || (_ChevronSmallDown = /*#__PURE__*/_jsx(ChevronSmallDown, {})),
25
+ buttonType: "icon",
23
26
  tabIndex: -1
24
- });
27
+ }, void 0, _ChevronSmallDown || (_ChevronSmallDown = /*#__PURE__*/_jsx(ChevronSmallDown, {})));
25
28
  };
26
29
 
27
30
  export { DropdownIndicator as default };
@@ -1,8 +1,8 @@
1
1
  import styled from 'styled-components';
2
- import DSButton from '@elliemae/ds-button';
2
+ import { DSButtonV2 } from '@elliemae/ds-button';
3
3
 
4
- const StyledDropDownButton = /*#__PURE__*/styled(DSButton).withConfig({
4
+ const StyledDropDownButton = /*#__PURE__*/styled(DSButtonV2).withConfig({
5
5
  componentId: "sc-14dzwqd-0"
6
- })(["box-sizing:border-box;width:100;& svg{fill:", ";}"], props => props.theme.colors.brand['700']);
6
+ })(["&:focus::after{border:none;}& svg{fill:", ";}"], props => props.theme.colors.brand['700']);
7
7
 
8
8
  export { StyledDropDownButton };
@@ -16,10 +16,10 @@ const HeaderList = () => {
16
16
  props: {
17
17
  onSelectAll,
18
18
  onClearAll,
19
- selectedValues
19
+ selectedValues,
20
+ innerRef
20
21
  },
21
22
  showSelectedOptions,
22
- inputRef,
23
23
  selectAllCheckboxRef,
24
24
  toggleSelectionButtonRef
25
25
  } = useContext(ComboBoxContext);
@@ -47,9 +47,9 @@ const HeaderList = () => {
47
47
  onBlur: () => {
48
48
  if (multiSelectedValues.length === 0) {
49
49
  setTimeout(() => {
50
- var _inputRef$current;
50
+ var _innerRef$current;
51
51
 
52
- return (_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 ? void 0 : _inputRef$current.focus();
52
+ return (_innerRef$current = innerRef.current) === null || _innerRef$current === void 0 ? void 0 : _innerRef$current.focus();
53
53
  });
54
54
  }
55
55
  },
@@ -57,9 +57,9 @@ const HeaderList = () => {
57
57
  })), /*#__PURE__*/_jsx(StyledSelectedItems, {}, void 0, multiSelectedValues.length > 0 ? /*#__PURE__*/_jsx(StyledButtonSelection, {
58
58
  onBlur: () => {
59
59
  setTimeout(() => {
60
- var _inputRef$current2;
60
+ var _innerRef$current2;
61
61
 
62
- return (_inputRef$current2 = inputRef.current) === null || _inputRef$current2 === void 0 ? void 0 : _inputRef$current2.focus();
62
+ return (_innerRef$current2 = innerRef.current) === null || _innerRef$current2 === void 0 ? void 0 : _innerRef$current2.focus();
63
63
  });
64
64
  },
65
65
  buttonType: "text",
@@ -9,9 +9,9 @@ const useHeaderListHandlers = () => {
9
9
  selectedValues,
10
10
  options,
11
11
  onSelectAll,
12
- onClearAll
12
+ onClearAll,
13
+ innerRef
13
14
  },
14
- inputRef,
15
15
  showSelectedOptions,
16
16
  setShowSelectedOptions,
17
17
  setShowPopover
@@ -40,10 +40,10 @@ const useHeaderListHandlers = () => {
40
40
  }
41
41
  }, [checkboxStatus, onSelectAll, onClearAll]);
42
42
  const handleToggle = useCallback(() => {
43
- if (inputRef.current) inputRef.current.value = '';
43
+ if (innerRef.current) innerRef.current.value = '';
44
44
  onFilter('');
45
45
  setShowSelectedOptions(!showSelectedOptions);
46
- }, [setShowSelectedOptions, inputRef, onFilter, showSelectedOptions]);
46
+ }, [setShowSelectedOptions, innerRef, onFilter, showSelectedOptions]);
47
47
  const handleKeyDown = useCallback(e => {
48
48
  if (e.key === 'Escape') {
49
49
  setShowPopover(false);
@@ -1,5 +1,5 @@
1
1
  import _jsx from '@babel/runtime/helpers/esm/jsx';
2
- import { useContext, useMemo, useCallback } from 'react';
2
+ import { useContext, useMemo } from 'react';
3
3
  import { noop } from 'lodash';
4
4
  import { StyledListWrapper, StyledVirtualListWrapper, StyledList } from './styled.js';
5
5
  import { ComboboxDataTestid } from '../../ComboboxDataTestids.js';
@@ -14,7 +14,7 @@ import { jsxs, jsx } from 'react/jsx-runtime';
14
14
  var _HeaderList, _EmptyState;
15
15
 
16
16
  const MenuList = () => {
17
- var _inputRef$current;
17
+ var _innerRef$current;
18
18
 
19
19
  const {
20
20
  props: {
@@ -23,12 +23,11 @@ const MenuList = () => {
23
23
  onCreate,
24
24
  inline,
25
25
  options,
26
- selectedValues
26
+ selectedValues,
27
+ innerRef
27
28
  },
28
29
  referenceElement,
29
- inputRef,
30
30
  listRef,
31
- showPopover,
32
31
  wrapperListRef,
33
32
  controlsWrapperRef,
34
33
  virtualListHelpers
@@ -38,16 +37,18 @@ const MenuList = () => {
38
37
  } = virtualListHelpers;
39
38
  const isOnCreatedSupplied = onCreate !== noop;
40
39
  const multiple = Array.isArray(selectedValues);
41
- const withHeader = !inline && multiple && options.length > 0 && ((_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 ? void 0 : _inputRef$current.value) === '';
40
+ const withHeader = !inline && multiple && options.length > 0 && ((_innerRef$current = innerRef.current) === null || _innerRef$current === void 0 ? void 0 : _innerRef$current.value) === '';
42
41
  const ItemRenderer = useItemRenderer();
43
42
  useMenuList();
44
43
  const {
45
44
  width
46
45
  } = useOnElementResize(controlsWrapperRef);
47
46
  const listWidth = useMemo(() => menuMinWidth || "".concat(referenceElement === null || referenceElement === void 0 ? void 0 : referenceElement.offsetWidth), // eslint-disable-next-line react-hooks/exhaustive-deps
48
- [menuMinWidth, referenceElement, width]);
49
- const handleOnFocus = useCallback(() => {// inputRef.current?.focus();
50
- }, [inputRef]);
47
+ [menuMinWidth, referenceElement, width]); // validate funcionality with ux
48
+ // const handleOnFocus = useCallback(() => {
49
+ // // innerRef.current?.focus();
50
+ // }, [innerRef]);
51
+
51
52
  return /*#__PURE__*/jsxs(StyledListWrapper, {
52
53
  ref: wrapperListRef,
53
54
  inline: inline,
@@ -61,9 +62,6 @@ const MenuList = () => {
61
62
  children: /*#__PURE__*/_jsx(StyledList, {
62
63
  id: "combo-listbox",
63
64
  role: "listbox",
64
- tabIndex: -1,
65
- "aria-expanded": showPopover,
66
- onFocus: handleOnFocus,
67
65
  "data-testid": ComboboxDataTestid.LIST,
68
66
  style: {
69
67
  height: totalSize,
@@ -2,7 +2,7 @@ import styled from 'styled-components';
2
2
 
3
3
  const StyledListWrapper = /*#__PURE__*/styled.div.withConfig({
4
4
  componentId: "sc-g2fmft-0"
5
- })(["min-width:", ";"], props => props.inline ? '100%' : "".concat(props.minWidth, "px"));
5
+ })(["min-width:", ";background-color:#ffffff;"], props => props.inline ? '100%' : "".concat(props.minWidth, "px"));
6
6
  const StyledList = /*#__PURE__*/styled.ul.withConfig({
7
7
  componentId: "sc-g2fmft-1"
8
8
  })(["position:relative;padding:0;"]);
@@ -29,9 +29,9 @@ const useItemRenderer = () => {
29
29
  onCreate,
30
30
  onChange,
31
31
  selectedValues,
32
- onFilter
32
+ onFilter,
33
+ innerRef
33
34
  },
34
- inputRef,
35
35
  setShowPopover,
36
36
  focusOptionIdx,
37
37
  virtualListHelpers
@@ -43,9 +43,9 @@ const useItemRenderer = () => {
43
43
  const CBItem = multiple ? MultiMenuItem : SingleMenuItem;
44
44
  const handleClick = useCallback((option, e) => {
45
45
  if (option.type === 'creatable') {
46
- if (inputRef.current) {
47
- onCreate(inputRef.current.value);
48
- inputRef.current.value = '';
46
+ if (innerRef.current) {
47
+ onCreate(innerRef.current.value);
48
+ innerRef.current.value = '';
49
49
  onFilter('');
50
50
  }
51
51
 
@@ -53,16 +53,16 @@ const useItemRenderer = () => {
53
53
  }
54
54
 
55
55
  if (!multiple) {
56
- setShowPopover(false);
57
- if (inputRef.current) inputRef.current.value = '';
58
- } else if (inputRef.current) {
59
- onFilter(inputRef.current.value);
56
+ if (!option.disabled) setShowPopover(false);
57
+ if (innerRef.current) innerRef.current.value = '';
58
+ } else if (innerRef.current) {
59
+ onFilter(innerRef.current.value);
60
60
  }
61
61
 
62
62
  onChange(option);
63
63
  e.stopPropagation();
64
64
  e.preventDefault();
65
- }, [onFilter, onChange, setShowPopover, multiple, inputRef]);
65
+ }, [onFilter, onChange, setShowPopover, multiple, innerRef]);
66
66
  const handleOnMouseDown = useCallback(e => {
67
67
  e.preventDefault();
68
68
  }, []);
@@ -125,7 +125,7 @@ const useItemRenderer = () => {
125
125
  }
126
126
 
127
127
  return /*#__PURE__*/jsx(Fragment, {});
128
- }), [options, focusOptionIdx, selectedValues, inputRef, virtualItems]);
128
+ }), [options, focusOptionIdx, selectedValues, innerRef, virtualItems]);
129
129
  return ItemRenderer;
130
130
  };
131
131
 
@@ -2,16 +2,16 @@ import { useContext, useEffect } from 'react';
2
2
  import { ComboBoxContext } from '../../ComboBoxCTX.js';
3
3
 
4
4
  const useMenuList = () => {
5
- var _inputRef$current2;
5
+ var _innerRef$current2;
6
6
 
7
7
  const {
8
8
  props: {
9
9
  inline,
10
10
  selectedValues,
11
11
  onMenuOpen,
12
- options
12
+ options,
13
+ innerRef
13
14
  },
14
- inputRef,
15
15
  setCurrentOption,
16
16
  scrollOptionIntoView,
17
17
  hasFocus,
@@ -26,18 +26,16 @@ const useMenuList = () => {
26
26
  };
27
27
 
28
28
  if (showPopover || inline) {
29
- var _inputRef$current;
29
+ var _innerRef$current;
30
30
 
31
31
  if (onMenuOpen) onMenuOpen();
32
32
 
33
- if (((_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 ? void 0 : _inputRef$current.value) !== '') {
33
+ if (((_innerRef$current = innerRef.current) === null || _innerRef$current === void 0 ? void 0 : _innerRef$current.value) !== '') {
34
34
  getFirstOption();
35
35
  } else if (Array.isArray(selectedValues)) {
36
- const multiSelectedValues = selectedValues;
37
-
38
- if (multiSelectedValues.length > 0) {
39
- setCurrentOption(multiSelectedValues[multiSelectedValues.length - 1].dsId);
40
- scrollOptionIntoView(multiSelectedValues[multiSelectedValues.length - 1].dsId);
36
+ if (selectedValues && selectedValues.length > 0) {
37
+ setCurrentOption(selectedValues[selectedValues.length - 1].dsId);
38
+ scrollOptionIntoView(selectedValues[selectedValues.length - 1].dsId);
41
39
  } else {
42
40
  getFirstOption();
43
41
  }
@@ -45,15 +43,15 @@ const useMenuList = () => {
45
43
  const singleSelectedValue = selectedValues;
46
44
 
47
45
  if (singleSelectedValue) {
48
- setCurrentOption(selectedValues.dsId);
49
- scrollOptionIntoView(selectedValues.dsId);
46
+ setCurrentOption(singleSelectedValue.dsId);
47
+ scrollOptionIntoView(singleSelectedValue.dsId);
50
48
  } else {
51
49
  getFirstOption();
52
50
  }
53
51
  }
54
52
  } // eslint-disable-next-line react-hooks/exhaustive-deps
55
53
 
56
- }, [showPopover, inline, hasFocus, (_inputRef$current2 = inputRef.current) === null || _inputRef$current2 === void 0 ? void 0 : _inputRef$current2.value]);
54
+ }, [showPopover, inline, hasFocus, (_innerRef$current2 = innerRef.current) === null || _innerRef$current2 === void 0 ? void 0 : _innerRef$current2.value]);
57
55
  };
58
56
 
59
57
  export { useMenuList };