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