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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (104) hide show
  1. package/cjs/autocomplete/config/useAutocomplete.js +1 -3
  2. package/cjs/checkbox/ControlledCheckbox.js +49 -33
  3. package/cjs/checkbox/exported-related/data-test-ids.js +10 -0
  4. package/cjs/checkbox/exported-related/index.js +12 -0
  5. package/cjs/checkbox/exported-related/theming.js +13 -0
  6. package/cjs/checkbox/react-desc-prop-types.js +0 -1
  7. package/cjs/checkbox/styles.js +26 -15
  8. package/cjs/combobox/ComboBoxCTX.js +1 -1
  9. package/cjs/combobox/ComboboxDataTestids.js +1 -1
  10. package/cjs/combobox/config/useComboBox.js +6 -4
  11. package/cjs/combobox/index.js +5 -0
  12. package/cjs/combobox/parts/DropdownIndicator.js +2 -2
  13. package/cjs/combobox/parts/container/Container.js +5 -5
  14. package/cjs/combobox/parts/container/styled.js +13 -7
  15. package/cjs/combobox/parts/controls/Controls.js +14 -4
  16. package/cjs/combobox/parts/controls/styled.js +22 -13
  17. package/cjs/combobox/parts/controls-input/ControlsInput.js +1 -1
  18. package/cjs/combobox/parts/controls-input/styled.js +7 -3
  19. package/cjs/combobox/parts/controls-input/useControlsInput.js +3 -4
  20. package/cjs/combobox/parts/controls-input/useKeyboardNavigation.js +30 -15
  21. package/cjs/combobox/parts/header-list/HeaderList.js +4 -3
  22. package/cjs/combobox/parts/header-list/useHeaderListHandlers.js +9 -5
  23. package/cjs/combobox/parts/menu-list/MenuList.js +5 -2
  24. package/cjs/combobox/parts/menu-list/styled.js +12 -7
  25. package/cjs/combobox/parts/menu-list/useItemRenderer.js +5 -4
  26. package/cjs/combobox/parts/multi-selected-values-container/MultiSelectedValuesContainer.js +1 -1
  27. package/cjs/combobox/parts/multi-selected-values-container/RemovableSelectedValuePill.js +2 -0
  28. package/cjs/combobox/parts/multi-selected-values-container/useGroupPills.js +13 -10
  29. package/cjs/combobox/theming.js +13 -0
  30. package/cjs/combobox/utils/listHelper.js +2 -1
  31. package/cjs/index.js +16 -7
  32. package/cjs/input-group/InputGroup.js +69 -0
  33. package/cjs/input-group/InputGroupDataTestIds.js +12 -0
  34. package/cjs/input-group/index.js +12 -0
  35. package/cjs/input-group/react-desc-prop-types.js +14 -0
  36. package/cjs/input-group/styled.js +46 -0
  37. package/cjs/mask-hook/hooks/index.js +0 -1
  38. package/cjs/mask-hook/hooks/usePhoneMask.js +2 -2
  39. package/cjs/mask-hook/hooks/useRegExpMask.js +0 -1
  40. package/cjs/mask-hook/index.js +0 -1
  41. package/cjs/text-input/styled/borders.js +1 -1
  42. package/esm/autocomplete/config/useAutocomplete.js +1 -3
  43. package/esm/checkbox/ControlledCheckbox.js +52 -36
  44. package/esm/checkbox/exported-related/data-test-ids.js +6 -0
  45. package/esm/checkbox/exported-related/index.js +2 -0
  46. package/esm/checkbox/exported-related/theming.js +8 -0
  47. package/esm/checkbox/react-desc-prop-types.js +0 -1
  48. package/esm/checkbox/styles.js +25 -15
  49. package/esm/combobox/ComboBoxCTX.js +1 -1
  50. package/esm/combobox/ComboboxDataTestids.js +1 -1
  51. package/esm/combobox/config/useComboBox.js +6 -4
  52. package/esm/combobox/index.js +2 -0
  53. package/esm/combobox/parts/DropdownIndicator.js +2 -2
  54. package/esm/combobox/parts/container/Container.js +7 -7
  55. package/esm/combobox/parts/container/styled.js +13 -6
  56. package/esm/combobox/parts/controls/Controls.js +14 -4
  57. package/esm/combobox/parts/controls/styled.js +22 -13
  58. package/esm/combobox/parts/controls-input/ControlsInput.js +1 -1
  59. package/esm/combobox/parts/controls-input/styled.js +7 -3
  60. package/esm/combobox/parts/controls-input/useControlsInput.js +3 -4
  61. package/esm/combobox/parts/controls-input/useKeyboardNavigation.js +30 -15
  62. package/esm/combobox/parts/header-list/HeaderList.js +4 -3
  63. package/esm/combobox/parts/header-list/useHeaderListHandlers.js +9 -5
  64. package/esm/combobox/parts/menu-list/MenuList.js +5 -2
  65. package/esm/combobox/parts/menu-list/styled.js +12 -7
  66. package/esm/combobox/parts/menu-list/useItemRenderer.js +5 -4
  67. package/esm/combobox/parts/multi-selected-values-container/MultiSelectedValuesContainer.js +1 -1
  68. package/esm/combobox/parts/multi-selected-values-container/RemovableSelectedValuePill.js +2 -0
  69. package/esm/combobox/parts/multi-selected-values-container/useGroupPills.js +13 -10
  70. package/esm/combobox/theming.js +8 -0
  71. package/esm/combobox/utils/listHelper.js +2 -1
  72. package/esm/index.js +5 -1
  73. package/esm/input-group/InputGroup.js +59 -0
  74. package/esm/input-group/InputGroupDataTestIds.js +8 -0
  75. package/esm/input-group/index.js +2 -0
  76. package/esm/input-group/react-desc-prop-types.js +10 -0
  77. package/esm/input-group/styled.js +35 -0
  78. package/esm/mask-hook/hooks/index.js +1 -1
  79. package/esm/mask-hook/hooks/usePhoneMask.js +2 -2
  80. package/esm/mask-hook/hooks/useRegExpMask.js +1 -1
  81. package/esm/mask-hook/index.js +1 -1
  82. package/esm/text-input/styled/borders.js +1 -1
  83. package/package.json +51 -19
  84. package/types/checkbox/exported-related/data-test-ids.d.ts +4 -0
  85. package/types/checkbox/exported-related/index.d.ts +2 -0
  86. package/types/checkbox/exported-related/theming.d.ts +6 -0
  87. package/types/checkbox/react-desc-prop-types.d.ts +3 -3
  88. package/types/checkbox/styles.d.ts +5 -5
  89. package/types/combobox/ComboboxDataTestids.d.ts +1 -1
  90. package/types/combobox/index.d.ts +2 -0
  91. package/types/combobox/parts/container/styled.d.ts +1 -2
  92. package/types/combobox/theming.d.ts +6 -0
  93. package/types/index.d.ts +1 -0
  94. package/types/input-group/InputGroup.d.ts +5 -0
  95. package/types/input-group/InputGroupDataTestIds.d.ts +6 -0
  96. package/types/input-group/index.d.ts +2 -0
  97. package/types/input-group/react-desc-prop-types.d.ts +19 -0
  98. package/types/input-group/styled.d.ts +7 -0
  99. package/types/input-group/tests/DSInputGroup.test.d.ts +1 -0
  100. package/types/mask-hook/hooks/useRegExpMask.d.ts +0 -1
  101. package/types/text-input/config/useInputText.d.ts +5 -5
  102. package/cjs/combobox/parts/menu-list/useMenuListSetFocusOption.js +0 -51
  103. package/esm/combobox/parts/menu-list/useMenuListSetFocusOption.js +0 -47
  104. package/types/combobox/parts/menu-list/useMenuListSetFocusOption.d.ts +0 -1
@@ -35,7 +35,6 @@ const useAutocomplete = props => {
35
35
  const [focusOptionIdx, setCurrentOption] = React.useState('');
36
36
  const inputRef = React.useRef(null);
37
37
  const listRef = React.useRef(null);
38
- const selectedOptionsRef = React.useRef(null);
39
38
  const {
40
39
  options,
41
40
  filter
@@ -74,12 +73,11 @@ const useAutocomplete = props => {
74
73
  inputRef,
75
74
  listRef,
76
75
  focusOptionIdx,
77
- selectedOptionsRef,
78
76
  setCurrentOption,
79
77
  scrollOptionIntoView,
80
78
  setReferenceElement,
81
79
  setShowPopover
82
- }), [scrollOptionIntoView, propsWithDefault, virtualListHelpers, focusOptionIdx, showPopover, referenceElement, inputRef, selectedOptionsRef, listRef]);
80
+ }), [scrollOptionIntoView, propsWithDefault, virtualListHelpers, focusOptionIdx, showPopover, referenceElement, inputRef, listRef]);
83
81
  return ctx;
84
82
  };
85
83
 
@@ -25,7 +25,7 @@ var _jsx__default = /*#__PURE__*/_interopDefaultLegacy(_jsx);
25
25
  var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_defineProperty);
26
26
  var _objectWithoutProperties__default = /*#__PURE__*/_interopDefaultLegacy(_objectWithoutProperties);
27
27
 
28
- const _excluded = ["id", "disabled", "readOnly", "label", "aria-label", "aria-controls", "onKeyDown", "className"];
28
+ const _excluded = ["id", "disabled", "readOnly", "label", "aria-label", "aria-controls", "onKeyDown", "className", "onChange"];
29
29
 
30
30
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
31
31
 
@@ -41,10 +41,8 @@ const DSControlledCheckbox = props => {
41
41
  hasError,
42
42
  innerRef,
43
43
  wrapLabel,
44
- tabIndex,
45
44
  ariaLabel: legacyAriaLabel,
46
- ariaControls: legacyAriaControls,
47
- 'data-testid': dataTestid = 'ds-checkbox-container'
45
+ ariaControls: legacyAriaControls
48
46
  } = propsWithDefault;
49
47
 
50
48
  const _useGetGlobalAttribut = dsPropsHelpers.useGetGlobalAttributes(propsWithDefault),
@@ -56,10 +54,12 @@ const DSControlledCheckbox = props => {
56
54
  'aria-label': ariaLabel,
57
55
  'aria-controls': ariaControls,
58
56
  onKeyDown: userOnKeyDown,
59
- className
57
+ className,
58
+ onChange
60
59
  } = _useGetGlobalAttribut,
61
60
  restGlobals = _objectWithoutProperties__default["default"](_useGetGlobalAttribut, _excluded);
62
61
 
62
+ const xstyledProps = dsPropsHelpers.useGetXstyledProps(propsWithDefault);
63
63
  const handleOnKeyDown = React.useCallback(e => {
64
64
  if (checkboxRef.current && e.key === 'Enter') {
65
65
  checkboxRef.current.click();
@@ -67,35 +67,51 @@ const DSControlledCheckbox = props => {
67
67
 
68
68
  if (userOnKeyDown) userOnKeyDown(e);
69
69
  }, [userOnKeyDown]);
70
- return /*#__PURE__*/_jsx__default["default"](styles.StyledContainer, {
71
- "data-testid": dataTestid,
70
+ return /*#__PURE__*/jsxRuntime.jsxs(styles.StyledContainer, _objectSpread(_objectSpread({
71
+ "data-testid": "ds-checkbox-container",
72
72
  className: className
73
- }, void 0, /*#__PURE__*/_jsx__default["default"](styles.StyledCheckBox, {
74
- checked: checked,
75
- hasError: hasError,
76
- disabled: disabled,
77
- readOnly: readOnly
78
- }, void 0, /*#__PURE__*/jsxRuntime.jsx(styles.StyledInput, _objectSpread(_objectSpread({}, restGlobals), {}, {
79
- "data-testid": "ds-checkbox",
80
- id: id,
81
- ref: ref => setMultipleRefs.setMultipleRefs([checkboxRef, innerRef])(ref),
82
- onKeyDown: handleOnKeyDown,
83
- type: "checkbox",
84
- checked: checked !== 'mixed' ? checked : undefined,
85
- "aria-label": ariaLabel || legacyAriaLabel || label,
86
- "aria-controls": ariaControls || legacyAriaControls,
87
- tabIndex: tabIndex,
88
- disabled: disabled,
89
- readOnly: readOnly
90
- }))), label && /*#__PURE__*/_jsx__default["default"](styles.StyledLabel, {
91
- htmlFor: id,
92
- disabled: disabled,
93
- readOnly: readOnly,
94
- checked: checked,
95
- "data-testid": "ds-checkbox-label"
96
- }, void 0, wrapLabel ? label : /*#__PURE__*/_jsx__default["default"](dsTruncatedTooltipText.SimpleTruncatedTooltipText, {
97
- value: label
98
- })));
73
+ }, xstyledProps), {}, {
74
+ children: [/*#__PURE__*/_jsx__default["default"](styles.StyledCheckBox, {
75
+ checked: checked,
76
+ hasError: hasError,
77
+ disabled: disabled,
78
+ readOnly: readOnly
79
+ }, void 0, ariaControls || legacyAriaControls ? /*#__PURE__*/jsxRuntime.jsx(styles.StyledInputMixed, _objectSpread(_objectSpread({
80
+ role: "checkbox",
81
+ "data-testid": "ds-checkbox",
82
+ id: id,
83
+ ref: ref => setMultipleRefs.setMultipleRefs([checkboxRef, innerRef])(ref),
84
+ onKeyDown: handleOnKeyDown,
85
+ "aria-label": ariaLabel || legacyAriaLabel || label,
86
+ "aria-controls": ariaControls || legacyAriaControls,
87
+ disabled: disabled,
88
+ readOnly: readOnly,
89
+ onClick: onChange,
90
+ "aria-checked": checked
91
+ }, restGlobals), {}, {
92
+ tabIndex: 0
93
+ })) : /*#__PURE__*/jsxRuntime.jsx(styles.StyledInput, _objectSpread({
94
+ "data-testid": "ds-checkbox",
95
+ id: id,
96
+ ref: ref => setMultipleRefs.setMultipleRefs([checkboxRef, innerRef])(ref),
97
+ onKeyDown: handleOnKeyDown,
98
+ type: "checkbox",
99
+ checked: checked,
100
+ "aria-label": ariaLabel || legacyAriaLabel || label,
101
+ disabled: disabled,
102
+ readOnly: readOnly,
103
+ onChange: onChange
104
+ }, restGlobals))), label && /*#__PURE__*/_jsx__default["default"](styles.StyledLabel, {
105
+ htmlFor: id,
106
+ disabled: disabled,
107
+ readOnly: readOnly,
108
+ checked: checked,
109
+ "data-testid": "ds-checkbox-label",
110
+ wrapLabel: wrapLabel
111
+ }, void 0, wrapLabel ? label : /*#__PURE__*/_jsx__default["default"](dsTruncatedTooltipText.SimpleTruncatedTooltipText, {
112
+ value: label
113
+ }))]
114
+ }));
99
115
  };
100
116
 
101
117
  const DSControlledCheckboxWithSchema = dsPropsHelpers.describe(DSControlledCheckbox);
@@ -0,0 +1,10 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ const DSCheckboxDataTestIds = {
6
+ CONTAINER: 'ds-checkbox-container',
7
+ INPUT: 'ds-checkbox'
8
+ };
9
+
10
+ exports.DSCheckboxDataTestIds = DSCheckboxDataTestIds;
@@ -0,0 +1,12 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var dataTestIds = require('./data-test-ids.js');
6
+ var theming = require('./theming.js');
7
+
8
+
9
+
10
+ exports.DSCheckboxDataTestIds = dataTestIds.DSCheckboxDataTestIds;
11
+ exports.DSCheckboxName = theming.DSCheckboxName;
12
+ exports.DSCheckboxSlots = theming.DSCheckboxSlots;
@@ -0,0 +1,13 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ const DSCheckboxName = 'ds-checkbox';
6
+ const DSCheckboxSlots = {
7
+ CONTAINER: 'root',
8
+ INPUT: 'input',
9
+ LABEL: 'label'
10
+ };
11
+
12
+ exports.DSCheckboxName = DSCheckboxName;
13
+ exports.DSCheckboxSlots = DSCheckboxSlots;
@@ -25,7 +25,6 @@ const defaultProps = {
25
25
  };
26
26
  const propTypes = _objectSpread(_objectSpread({}, dsPropsHelpers.globalAttributesPropTypes), {}, {
27
27
  label: dsPropsHelpers.PropTypes.string.description('Checkbox Label property. This label is also going to be used as an aria-label for screen readers.'),
28
- wrapLabel: dsPropsHelpers.PropTypes.bool.description('Whether to wrap or truncate label'),
29
28
  hasError: dsPropsHelpers.PropTypes.bool.description('Whether the checkbox has error or not.'),
30
29
  innerRef: dsPropsHelpers.PropTypes.oneOfType([dsPropsHelpers.PropTypes.func, dsPropsHelpers.PropTypes.object]).description('Checkbox input ref.')
31
30
  });
@@ -2,24 +2,26 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var styled = require('styled-components');
5
+ var _taggedTemplateLiteral = require('@babel/runtime/helpers/taggedTemplateLiteral');
6
+ var dsSystem = require('@elliemae/ds-system');
6
7
  var styleHelpers = require('./utils/styleHelpers.js');
8
+ var theming = require('./exported-related/theming.js');
7
9
 
8
10
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
9
11
 
10
- var styled__default = /*#__PURE__*/_interopDefaultLegacy(styled);
12
+ var _taggedTemplateLiteral__default = /*#__PURE__*/_interopDefaultLegacy(_taggedTemplateLiteral);
11
13
 
12
- const StyledContainer = /*#__PURE__*/styled__default["default"].div.withConfig({
13
- componentId: "sc-flv7d2-0"
14
- })(["display:inline-grid;grid-template-rows:min-content;grid-template-columns:", " auto;align-items:center;"], _ref => {
14
+ var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6;
15
+ const StyledContainer = dsSystem.styled('div', {
16
+ name: theming.DSCheckboxName,
17
+ slot: theming.DSCheckboxSlots.CONTAINER
18
+ })(_templateObject || (_templateObject = _taggedTemplateLiteral__default["default"](["\n display: inline-grid;\n grid-template-rows: min-content;\n grid-template-columns: ", " auto;\n align-items: center;\n"])), _ref => {
15
19
  let {
16
20
  theme
17
21
  } = _ref;
18
22
  return theme.space.xs;
19
23
  });
20
- const StyledCheckBox = /*#__PURE__*/styled__default["default"].span.withConfig({
21
- componentId: "sc-flv7d2-1"
22
- })(["width:", ";height:", ";border:1px solid ", ";border-radius:2px;position:relative;background:", ";", " &:focus-within{", ";&:hover{", "}}&:hover{background:", ";", ";}"], _ref2 => {
24
+ const StyledCheckBox = dsSystem.styled('span')(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral__default["default"](["\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 => {
23
25
  let {
24
26
  theme
25
27
  } = _ref2;
@@ -82,16 +84,24 @@ const StyledCheckBox = /*#__PURE__*/styled__default["default"].span.withConfig({
82
84
  } = _ref10;
83
85
  return !hasError && !disabled && !readOnly ? " border: 1px solid ".concat(theme.colors.brand[600]) : undefined;
84
86
  });
85
- const StyledInput = /*#__PURE__*/styled__default["default"].input.withConfig({
86
- componentId: "sc-flv7d2-2"
87
- })(["&:hover{cursor:pointer;}&:disabled{cursor:not-allowed;}height:100%;position:absolute;top:0;left:0;opacity:0;"]);
88
- const StyledLabel = /*#__PURE__*/styled__default["default"].label.withConfig({
89
- componentId: "sc-flv7d2-3"
90
- })(["&:hover{cursor:pointer;}padding-left:", ";color:", ";font-size:13px;line-height:13px;display:inherit;"], _ref11 => {
87
+ const checkboxStyles = dsSystem.css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral__default["default"](["\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"])));
88
+ const StyledInput = dsSystem.styled('input', {
89
+ name: theming.DSCheckboxName,
90
+ slot: theming.DSCheckboxSlots.INPUT
91
+ })(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral__default["default"](["\n ", "\n"])), checkboxStyles);
92
+ const StyledInputMixed = dsSystem.styled('div', {
93
+ name: theming.DSCheckboxName,
94
+ slot: theming.DSCheckboxSlots.INPUT
95
+ })(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral__default["default"](["\n ", "\n"])), checkboxStyles);
96
+ const StyledLabel = dsSystem.styled('label', {
97
+ name: theming.DSCheckboxName,
98
+ slot: theming.DSCheckboxSlots.LABEL
99
+ })(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral__default["default"](["\n &:hover {\n cursor: pointer;\n }\n ", ";\n\n color: ", ";\n font-size: 13px;\n line-height: 13px;\n display: inherit;\n"])), _ref11 => {
91
100
  let {
101
+ wrapLabel,
92
102
  theme
93
103
  } = _ref11;
94
- return theme.space.xxs;
104
+ return wrapLabel ? 'padding: 8px' : "padding-left: ".concat(theme.space.xxs);
95
105
  }, _ref12 => {
96
106
  let {
97
107
  theme,
@@ -105,4 +115,5 @@ const StyledLabel = /*#__PURE__*/styled__default["default"].label.withConfig({
105
115
  exports.StyledCheckBox = StyledCheckBox;
106
116
  exports.StyledContainer = StyledContainer;
107
117
  exports.StyledInput = StyledInput;
118
+ exports.StyledInputMixed = StyledInputMixed;
108
119
  exports.StyledLabel = StyledLabel;
@@ -10,7 +10,7 @@ function noop() {}
10
10
  const defaultProps = {
11
11
  hasError: false,
12
12
  inline: false,
13
- withoutPortal: true,
13
+ withoutPortal: false,
14
14
  zIndex: 10,
15
15
  disabled: false,
16
16
  useMask: noop,
@@ -4,7 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  const ComboboxDataTestid = {
6
6
  MULTISELECT: {
7
- SELECT_ALL_CHECKBOX: 'combobox-select-all-checkbox',
7
+ HEADER_LIST: 'combobox-header-list',
8
8
  SHOW_SELECTED_OPTIONS_TOGGLE: 'combobox-selected-options-toggle'
9
9
  },
10
10
  CONTROLS_WRAPPER: 'combobox-controls-wrapper',
@@ -74,17 +74,19 @@ const useComboBox = props => {
74
74
 
75
75
  const [focusOptionIdx, setFocusOptionIdx] = React.useState('');
76
76
  React.useEffect(() => {
77
- // we are updating the focus option only when we have focus on the input and
78
- // we are in the selected option view or we are typing to force first option always
77
+ // this code calculate the option to be focused when opening the menu
78
+ // when losing focus we remove the focused one
79
+ // when focus adquired again getFirstOption calculate the correct one
80
+ if (!hasFocus) setFocusOptionIdx('');
81
+
79
82
  if (hasFocus && (focusOptionIdx === '' || inputValue !== '' || showSelectedOptions)) {
80
83
  const focusedValue = listHelper.getFirstOption(correctOptions, selectedValues, inputValue);
81
84
  setFocusOptionIdx(focusedValue);
82
85
  scrollOptionIntoView(focusedValue, {
83
86
  align: 'center'
84
87
  });
85
- }
88
+ } // eslint-disable-next-line react-hooks/exhaustive-deps
86
89
 
87
- if (!hasFocus) setFocusOptionIdx(''); // eslint-disable-next-line react-hooks/exhaustive-deps
88
90
  }, [showPopover, hasFocus, correctOptions, selectedValues, inputValue]);
89
91
  React.useEffect(() => {
90
92
  if (!showPopover) {
@@ -3,9 +3,14 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var ComboBox = require('./ComboBox.js');
6
+ var theming = require('./theming.js');
7
+ var ComboboxDataTestids = require('./ComboboxDataTestids.js');
6
8
 
7
9
 
8
10
 
9
11
  exports.DSComboBox = ComboBox.DSComboBox;
10
12
  exports.DSComboBoxV3 = ComboBox.DSComboBox;
11
13
  exports.DSComboBoxWithSchema = ComboBox.DSComboBoxWithSchema;
14
+ exports.DSComboBoxName = theming.DSComboBoxName;
15
+ exports.DSComboboxSlots = theming.DSComboboxSlots;
16
+ exports.ComboboxDataTestid = ComboboxDataTestids.ComboboxDataTestid;
@@ -17,12 +17,12 @@ var _jsx__default = /*#__PURE__*/_interopDefaultLegacy(_jsx);
17
17
  var _taggedTemplateLiteral__default = /*#__PURE__*/_interopDefaultLegacy(_taggedTemplateLiteral);
18
18
 
19
19
  var _templateObject;
20
- const StyledDropDownButton = dsSystem.styled(DSButton.DSButtonV2)(_templateObject || (_templateObject = _taggedTemplateLiteral__default["default"](["\n &:focus::after {\n border: none;\n }\n & svg {\n fill: ", ";\n }\n"])), _ref => {
20
+ const StyledDropDownButton = dsSystem.styled(DSButton.DSButtonV2)(_templateObject || (_templateObject = _taggedTemplateLiteral__default["default"](["\n &:focus::after {\n border: none;\n }\n &:hover:not(:disabled) {\n background-color: transparent;\n }\n\n & svg {\n fill: ", ";\n }\n"])), _ref => {
21
21
  let {
22
22
  theme,
23
23
  disabled
24
24
  } = _ref;
25
- return disabled ? 'red' : theme.colors.brand['700'];
25
+ return disabled ? theme.colors.neutral['400'] : theme.colors.brand['700'];
26
26
  });
27
27
  const DropdownIndicator = () => {
28
28
  const {
@@ -53,8 +53,8 @@ const Container = () => {
53
53
  withoutPortal,
54
54
  zIndex
55
55
  } = props;
56
- const StyledContainer = inline ? styled.StyledContainerInline : styled.StyledContainerWithPopper;
57
- const globalAttributes = dsPropsHelpers.useGetGlobalAttributes(props); // Removing possible collisionable props
56
+ const globalAttributes = dsPropsHelpers.useGetGlobalAttributes(props);
57
+ const xStyledProps = dsPropsHelpers.useGetXstyledProps(props); // Removing possible collisionable props
58
58
 
59
59
  const globalsAttrs = _objectWithoutProperties__default["default"](globalAttributes, _excluded);
60
60
 
@@ -76,10 +76,10 @@ const Container = () => {
76
76
  React.useEffect(() => {
77
77
  if (onMenuOpen && showPopover) onMenuOpen();else if (onMenuClose && !showPopover) onMenuClose();
78
78
  }, [showPopover, onMenuOpen, onMenuClose]);
79
- return React.useMemo(() => /*#__PURE__*/jsxRuntime.jsx(StyledContainer, _objectSpread(_objectSpread({
79
+ return React.useMemo(() => /*#__PURE__*/jsxRuntime.jsx(styled.StyledContainer, _objectSpread(_objectSpread(_objectSpread({
80
80
  "data-testid": ComboboxDataTestids.ComboboxDataTestid.CONTAINER,
81
81
  ref: setReferenceElement
82
- }, globalsAttrs), {}, {
82
+ }, globalsAttrs), xStyledProps), {}, {
83
83
  children: inline ? /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
84
84
  children: [_Controls || (_Controls = /*#__PURE__*/_jsx__default["default"](Controls.Controls, {})), _MenuList || (_MenuList = /*#__PURE__*/_jsx__default["default"](MenuList.MenuList, {}))]
85
85
  }) : /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
@@ -99,7 +99,7 @@ const Container = () => {
99
99
  onMouseDown: handleMouseDown
100
100
  }, void 0, _MenuList2 || (_MenuList2 = /*#__PURE__*/_jsx__default["default"](MenuList.MenuList, {})))))]
101
101
  })
102
- })), [inline, StyledContainer, setReferenceElement, globalsAttrs, referenceElement, showPopover, handleCloseMenu, startPlacementPreference, placementOrderPreference, withoutPortal, zIndex, handleMouseDown]);
102
+ })), [inline, setReferenceElement, globalsAttrs, referenceElement, showPopover, xStyledProps, handleCloseMenu, startPlacementPreference, placementOrderPreference, withoutPortal, zIndex, handleMouseDown]);
103
103
  };
104
104
 
105
105
  exports.Container = Container;
@@ -4,22 +4,28 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var _taggedTemplateLiteral = require('@babel/runtime/helpers/taggedTemplateLiteral');
6
6
  var dsSystem = require('@elliemae/ds-system');
7
+ var theming = require('../../theming.js');
7
8
 
8
9
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
9
10
 
10
11
  var _taggedTemplateLiteral__default = /*#__PURE__*/_interopDefaultLegacy(_taggedTemplateLiteral);
11
12
 
12
- var _templateObject, _templateObject2, _templateObject3, _templateObject4;
13
- const StyledGenericContainer = dsSystem.styled.div(_templateObject || (_templateObject = _taggedTemplateLiteral__default["default"](["\n position: relative;\n cursor: ", ";\n"])), _ref => {
13
+ var _templateObject, _templateObject2;
14
+ const StyledContainer = dsSystem.styled('div', {
15
+ name: theming.DSComboBoxName,
16
+ slot: theming.DSComboboxSlots.CONTAINER
17
+ })(_templateObject || (_templateObject = _taggedTemplateLiteral__default["default"](["\n position: relative;\n cursor: ", ";\n"])), _ref => {
14
18
  let {
15
19
  disabled
16
20
  } = _ref;
17
21
  return disabled ? 'not-allowed' : 'default';
18
22
  });
19
- const StyledContainerWithPopper = dsSystem.styled(StyledGenericContainer)(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral__default["default"](["\n width: 100%;\n height: 28px;\n"])));
20
- const StyledContainerInline = dsSystem.styled(StyledGenericContainer)(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral__default["default"](["\n width: 100%;\n"])));
21
- const StyledPopperWrapper = dsSystem.styled(StyledGenericContainer)(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral__default["default"](["\n overflow: auto;\n"])));
23
+ const StyledPopperWrapper = dsSystem.styled('div')(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral__default["default"](["\n position: relative;\n cursor: ", ";\n overflow: auto;\n"])), _ref2 => {
24
+ let {
25
+ disabled
26
+ } = _ref2;
27
+ return disabled ? 'not-allowed' : 'default';
28
+ });
22
29
 
23
- exports.StyledContainerInline = StyledContainerInline;
24
- exports.StyledContainerWithPopper = StyledContainerWithPopper;
30
+ exports.StyledContainer = StyledContainer;
25
31
  exports.StyledPopperWrapper = StyledPopperWrapper;
@@ -33,9 +33,10 @@ const Controls = () => {
33
33
  },
34
34
  selectedOptionsRef,
35
35
  setShowPopover,
36
+ setFocusOptionIdx,
36
37
  hasFocus,
38
+ listRef,
37
39
  focusOptionIdx,
38
- scrollOptionIntoView,
39
40
  showPopover,
40
41
  controlsWrapperRef
41
42
  } = React.useContext(ComboBoxCTX.ComboBoxContext);
@@ -48,13 +49,22 @@ const Controls = () => {
48
49
  var _innerRef$current;
49
50
 
50
51
  setShowPopover(false);
52
+ setFocusOptionIdx('');
51
53
  (_innerRef$current = innerRef.current) === null || _innerRef$current === void 0 ? void 0 : _innerRef$current.blur();
52
54
  return;
53
55
  }
54
56
 
55
57
  (_innerRef$current2 = innerRef.current) === null || _innerRef$current2 === void 0 ? void 0 : _innerRef$current2.focus();
56
- setShowPopover(true); // eslint-disable-next-line react-hooks/exhaustive-deps
57
- }, [disabled, hasFocus, showPopover, inline, innerRef, setShowPopover, focusOptionIdx]); // this callback prevent to toggle the menu when clicking or removing pills
58
+ setShowPopover(true);
59
+ window.requestAnimationFrame(() => {
60
+ if (listRef.current && window.scrollY < listRef.current.scrollHeight) {
61
+ window.scrollTo({
62
+ top: listRef.current.scrollHeight,
63
+ behavior: 'smooth'
64
+ });
65
+ }
66
+ }); // eslint-disable-next-line react-hooks/exhaustive-deps
67
+ }, [disabled, listRef, hasFocus, showPopover, inline, innerRef, setShowPopover, focusOptionIdx]); // this callback prevent to toggle the menu when clicking or removing pills
58
68
 
59
69
  const handleOnPillsClick = React.useCallback(e => {
60
70
  if (showPopover || disabled) {
@@ -97,7 +107,7 @@ const Controls = () => {
97
107
  }))]
98
108
  }), _ControlsInput || (_ControlsInput = /*#__PURE__*/_jsx__default["default"](ControlsInput.ControlsInput, {})), !inline && /*#__PURE__*/_jsx__default["default"](styled.StyledHeaderActionsWrapper, {
99
109
  justifyContent: "center",
100
- cols: ['auto', 'auto']
110
+ cols: ['min-content', 'min-content']
101
111
  }, void 0, /*#__PURE__*/_jsx__default["default"](styled.StyleHeaderActionsSeparator, {
102
112
  disabled: disabled
103
113
  }), _DropdownIndicator || (_DropdownIndicator = /*#__PURE__*/_jsx__default["default"](DropdownIndicator.DropdownIndicator, {})))]
@@ -5,6 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  var _taggedTemplateLiteral = require('@babel/runtime/helpers/taggedTemplateLiteral');
6
6
  var dsSystem = require('@elliemae/ds-system');
7
7
  var dsGrid = require('@elliemae/ds-grid');
8
+ var theming = require('../../theming.js');
8
9
 
9
10
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
10
11
 
@@ -18,39 +19,47 @@ const normalBorder = dsSystem.css(_templateObject || (_templateObject = _taggedT
18
19
  } = _ref;
19
20
  return hasError ? theme.colors.danger[900] : theme.colors.neutral[400];
20
21
  });
21
- const focusBorder = dsSystem.css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral__default["default"](["\n border: 2px solid ", ";\n"])), _ref2 => {
22
+ const focusBorder = dsSystem.css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral__default["default"](["\n outline: 2px solid ", ";\n outline-offset: -2px;\n"])), _ref2 => {
22
23
  let {
23
24
  theme
24
25
  } = _ref2;
25
26
  return theme.colors.brand[700];
26
27
  });
27
- const afterStyle = dsSystem.css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral__default["default"](["\n display: block;\n content: ' ';\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n border-radius: 2px;\n pointer-events: none;\n z-index: 7;\n"])));
28
- const StyledControlsWrapper = dsSystem.styled(dsGrid.Grid)(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral__default["default"](["\n background: ", ";\n position: relative;\n border-radius: 2px;\n min-width: ", ";\n align-items: center;\n align-content: center;\n height: 28px;\n padding-left: 8px;\n margin: ", ";\n &::after {\n ", "\n ", "\n }\n\n &:focus-within {\n &::after {\n ", "\n ", "\n }\n }\n"])), _ref3 => {
28
+ const hoverBorder = dsSystem.css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral__default["default"](["\n border: 1px solid ", ";\n"])), _ref3 => {
29
29
  let {
30
- disabled,
31
30
  theme
32
31
  } = _ref3;
32
+ return theme.colors.brand[700];
33
+ });
34
+ const StyledControlsWrapper = dsSystem.styled(dsGrid.Grid, {
35
+ name: theming.DSComboBoxName,
36
+ slot: theming.DSComboboxSlots.INPUT_WRAPPER
37
+ })(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral__default["default"](["\n background: ", ";\n position: relative;\n border-radius: 2px;\n min-width: ", ";\n align-items: center;\n align-content: center;\n height: 28px;\n padding-left: 8px;\n margin: ", ";\n ", "\n &:hover {\n ", "\n }\n &:focus-within {\n ", "\n }\n"])), _ref4 => {
38
+ let {
39
+ disabled,
40
+ theme
41
+ } = _ref4;
33
42
  return disabled ? theme.colors.neutral['080'] : '#ffffff';
34
- }, _ref4 => {
43
+ }, _ref5 => {
35
44
  let {
36
45
  minWidth,
37
46
  inline
38
- } = _ref4;
47
+ } = _ref5;
39
48
  return inline || !minWidth ? '' : "".concat(minWidth, "px");
40
- }, _ref5 => {
49
+ }, _ref6 => {
41
50
  let {
42
51
  inline
43
- } = _ref5;
44
- return inline ? '10px 16px' : 'none';
45
- }, afterStyle, normalBorder, afterStyle, focusBorder);
46
- const StyledSelection = dsSystem.styled.div(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral__default["default"](["\n font-size: 13px;\n margin-right: 3px;\n line-height: 13px;\n display: flex;\n"])));
52
+ } = _ref6;
53
+ return inline ? '10px 16px' : '';
54
+ }, normalBorder, hoverBorder, focusBorder);
55
+ const StyledSelection = dsSystem.styled.div(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral__default["default"](["\n font-size: 13px;\n margin-right: 3px;\n display: flex;\n"])));
47
56
  const StyledHeaderActionsWrapper = dsSystem.styled(dsGrid.Grid)(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral__default["default"](["\n height: 100%;\n .em-ds-button--text:focus::after {\n border: none;\n }\n"])));
48
57
  const StyleDropdownIndicator = dsSystem.styled.div(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral__default["default"]([""])));
49
- const StyleHeaderActionsSeparator = dsSystem.styled.span(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral__default["default"](["\n align-self: stretch;\n margin: 4px 0px;\n width: 1px;\n background-color: ", ";\n"])), _ref6 => {
58
+ const StyleHeaderActionsSeparator = dsSystem.styled.span(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral__default["default"](["\n align-self: stretch;\n margin: 4px 0px;\n width: 1px;\n background-color: ", ";\n"])), _ref7 => {
50
59
  let {
51
60
  theme,
52
61
  disabled
53
- } = _ref6;
62
+ } = _ref7;
54
63
  return disabled ? theme.colors.neutral['400'] : theme.colors.neutral['500'];
55
64
  });
56
65
 
@@ -53,7 +53,7 @@ const ControlsInput = () => {
53
53
  "aria-controls": "combo-listbox",
54
54
  "aria-activedescendant": focusOptionIdx,
55
55
  "aria-expanded": showPopover,
56
- "aria-haspopup": "true",
56
+ "aria-haspopup": "listbox",
57
57
  "aria-describedby": "combobox-selected-items",
58
58
  role: "combobox",
59
59
  disabled: disabled,
@@ -4,21 +4,25 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var _taggedTemplateLiteral = require('@babel/runtime/helpers/taggedTemplateLiteral');
6
6
  var dsSystem = require('@elliemae/ds-system');
7
+ var theming = require('../../theming.js');
7
8
 
8
9
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
9
10
 
10
11
  var _taggedTemplateLiteral__default = /*#__PURE__*/_interopDefaultLegacy(_taggedTemplateLiteral);
11
12
 
12
13
  var _templateObject, _templateObject2, _templateObject3, _templateObject4;
13
- const StyledInput = dsSystem.styled.input(_templateObject || (_templateObject = _taggedTemplateLiteral__default["default"](["\n font-size: 13px;\n line-height: 13px;\n border: none;\n padding: 0;\n outline: none;\n color: ", ";\n &:focus {\n outline: none;\n }\n ", "\n &::placeholder {\n color: transparent;\n }\n"])), props => props.theme.colors.neutral[700], _ref => {
14
+ const StyledInput = dsSystem.styled('input', {
15
+ name: theming.DSComboBoxName,
16
+ slot: theming.DSComboboxSlots.INPUT
17
+ })(_templateObject || (_templateObject = _taggedTemplateLiteral__default["default"](["\n font-size: 13px;\n line-height: 13px;\n border: none;\n padding: 0;\n outline: none;\n color: ", ";\n &:focus {\n outline: none;\n }\n ", "\n &::placeholder {\n color: transparent;\n }\n"])), props => props.theme.colors.neutral[700], _ref => {
14
18
  let {
15
19
  withoutCaret
16
20
  } = _ref;
17
21
  return withoutCaret && 'caret-color: transparent;';
18
22
  });
19
- const StyledInputPlaceHolder = dsSystem.styled.div(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral__default["default"](["\n font-style: italic;\n color: ", ";\n position: absolute;\n display: flex;\n align-items: center;\n width: 100%;\n user-select: none;\n height: 28px;\n & span {\n line-height: 13px;\n }\n"])), props => props.theme.colors.neutral[500]);
23
+ const StyledInputPlaceHolder = dsSystem.styled.div(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral__default["default"](["\n font-style: italic;\n color: ", ";\n position: absolute;\n display: flex;\n align-items: center;\n width: 100%;\n user-select: none;\n height: 28px;\n font-size: 13px;\n & span::after {\n content: '';\n padding: 1px;\n }\n"])), props => props.theme.colors.neutral[500]);
20
24
  const StyledInputWidthReference = dsSystem.styled.span(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral__default["default"](["\n visibility: hidden;\n position: absolute;\n top: -9999px;\n"])));
21
- const StyledInputWrapper = dsSystem.styled.div(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral__default["default"](["\n position: relative;\n flex: 1;\n margin-right: 5px;\n display: flex;\n align-items: center;\n"])));
25
+ const StyledInputWrapper = dsSystem.styled('div')(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral__default["default"](["\n position: relative;\n align-items: center;\n display: flex;\n"])));
22
26
 
23
27
  exports.StyledInput = StyledInput;
24
28
  exports.StyledInputPlaceHolder = StyledInputPlaceHolder;
@@ -19,8 +19,7 @@ const useControlsInput = () => {
19
19
  },
20
20
  setHasFocus,
21
21
  inputValue,
22
- setInputValue,
23
- setShowSelectedOptions
22
+ setInputValue
24
23
  } = React.useContext(ComboBoxCTX.ComboBoxContext);
25
24
  const [width, setWidth] = React.useState(1); // use span reference to calculate the real width for the input
26
25
 
@@ -38,8 +37,8 @@ const useControlsInput = () => {
38
37
  const handleOnBlur = React.useCallback(() => {
39
38
  setInputValue('');
40
39
  if (onFilter) onFilter(allOptions, inputValue);
41
- setHasFocus(false); // setShowSelectedOptions(false);
42
- }, [setInputValue, onFilter, allOptions, inputValue, setHasFocus, setShowSelectedOptions]);
40
+ setHasFocus(false);
41
+ }, [setInputValue, onFilter, allOptions, inputValue, setHasFocus]);
43
42
  const handleOnFocus = React.useCallback(() => {
44
43
  setHasFocus(true);
45
44
  }, [setHasFocus]);