@elliemae/ds-form 2.0.0-rc.1 → 2.0.0-rc.10

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 (173) hide show
  1. package/cjs/ComboBox/v1/DSComboBox.js +18 -22
  2. package/cjs/ComboBox/v1/withSelectStringValueConverter.js +3 -4
  3. package/cjs/ComboBox/v3/ComboBox.js +1 -2
  4. package/cjs/ComboBox/v3/ComboBoxCTX.js +22 -15
  5. package/cjs/ComboBox/v3/ComboboxDataTestids.js +3 -1
  6. package/cjs/ComboBox/v3/config/useComboBox.js +65 -21
  7. package/cjs/ComboBox/v3/parts/container/Container.js +28 -18
  8. package/cjs/ComboBox/v3/parts/controls/Controls.js +3 -1
  9. package/cjs/ComboBox/v3/parts/controls/styled.js +30 -8
  10. package/cjs/ComboBox/v3/parts/controls-input/ControlsInput.js +5 -3
  11. package/cjs/ComboBox/v3/parts/controls-input/styled.js +1 -1
  12. package/cjs/ComboBox/v3/parts/controls-input/useControlsInput.js +19 -21
  13. package/cjs/ComboBox/v3/parts/dropdown-indicator/DropdownIndicator.js +0 -3
  14. package/cjs/ComboBox/v3/parts/dropdown-indicator/styled.js +1 -1
  15. package/cjs/ComboBox/v3/parts/header-list/HeaderList.js +61 -37
  16. package/cjs/ComboBox/v3/parts/header-list/styled.js +31 -8
  17. package/cjs/ComboBox/v3/parts/header-list/useHeaderListHandlers.js +73 -0
  18. package/cjs/ComboBox/v3/parts/menu-list/MenuList.js +32 -18
  19. package/cjs/ComboBox/v3/parts/menu-list/styled.js +17 -2
  20. package/cjs/ComboBox/v3/parts/menu-list/useItemRenderer.js +105 -0
  21. package/cjs/ComboBox/v3/parts/menu-list/useMenuList.js +42 -85
  22. package/cjs/ComboBox/v3/parts/multi-selected-values-container/MultiSelectedValuesContainer.js +26 -35
  23. package/cjs/ComboBox/v3/parts/multi-selected-values-container/useGroupPills.js +10 -6
  24. package/cjs/ComboBox/v3/propTypes.js +15 -11
  25. package/cjs/ComboBox/v3/utils/hooks/useKeyboardNavigation.js +28 -30
  26. package/cjs/ComboBox/v3/utils/hooks/useOnElementResize.js +4 -4
  27. package/cjs/FloatingLabelInput/FloatingLabelInputImpl.js +4 -7
  28. package/cjs/FormItem/ValidationFieldWrapper.js +2 -3
  29. package/cjs/Input/InputAddonWrapper.js +2 -3
  30. package/cjs/Input/InputImpl.js +16 -18
  31. package/cjs/InputGroup/AddonWrapper.js +4 -6
  32. package/cjs/InputMask/DSInputMaskDeprecated.js +10 -12
  33. package/cjs/MenuItem/components/MenuItem/index.js +1 -1
  34. package/cjs/MenuItem/components/MultiMenuItem/MultiMenuItem.js +1 -0
  35. package/cjs/MenuItem/components/Section/index.js +1 -1
  36. package/cjs/MenuItem/components/Section/styled.js +1 -1
  37. package/cjs/MenuItem/components/Separator/styled.js +2 -2
  38. package/cjs/MenuItem/components/SingleMenuItem/SingleMenuItem.js +6 -6
  39. package/cjs/MenuItem/components/SubmenuItem/index.js +1 -1
  40. package/cjs/MenuItem/components/styled.js +12 -4
  41. package/cjs/SearchBox/withSearchable.js +3 -5
  42. package/cjs/Toggle/DSToggleImpl.js +28 -28
  43. package/esm/ComboBox/v1/DSComboBox.js +17 -21
  44. package/esm/ComboBox/v1/withSelectStringValueConverter.js +3 -4
  45. package/esm/ComboBox/v3/ComboBox.js +1 -2
  46. package/esm/ComboBox/v3/ComboBoxCTX.js +17 -10
  47. package/esm/ComboBox/v3/ComboboxDataTestids.js +3 -1
  48. package/esm/ComboBox/v3/config/useComboBox.js +62 -22
  49. package/esm/ComboBox/v3/parts/container/Container.js +29 -19
  50. package/esm/ComboBox/v3/parts/controls/Controls.js +3 -1
  51. package/esm/ComboBox/v3/parts/controls/styled.js +30 -9
  52. package/esm/ComboBox/v3/parts/controls-input/ControlsInput.js +5 -3
  53. package/esm/ComboBox/v3/parts/controls-input/styled.js +1 -1
  54. package/esm/ComboBox/v3/parts/controls-input/useControlsInput.js +20 -22
  55. package/esm/ComboBox/v3/parts/dropdown-indicator/DropdownIndicator.js +0 -3
  56. package/esm/ComboBox/v3/parts/dropdown-indicator/styled.js +1 -1
  57. package/esm/ComboBox/v3/parts/header-list/HeaderList.js +63 -39
  58. package/esm/ComboBox/v3/parts/header-list/styled.js +28 -8
  59. package/esm/ComboBox/v3/parts/header-list/useHeaderListHandlers.js +69 -0
  60. package/esm/ComboBox/v3/parts/menu-list/MenuList.js +35 -21
  61. package/esm/ComboBox/v3/parts/menu-list/styled.js +17 -3
  62. package/esm/ComboBox/v3/parts/menu-list/useItemRenderer.js +97 -0
  63. package/esm/ComboBox/v3/parts/menu-list/useMenuList.js +43 -82
  64. package/esm/ComboBox/v3/parts/multi-selected-values-container/MultiSelectedValuesContainer.js +26 -35
  65. package/esm/ComboBox/v3/parts/multi-selected-values-container/useGroupPills.js +10 -6
  66. package/esm/ComboBox/v3/propTypes.js +15 -11
  67. package/esm/ComboBox/v3/utils/hooks/useKeyboardNavigation.js +28 -30
  68. package/esm/ComboBox/v3/utils/hooks/useOnElementResize.js +4 -4
  69. package/esm/FloatingLabelInput/FloatingLabelInputImpl.js +4 -7
  70. package/esm/FormItem/ValidationFieldWrapper.js +2 -3
  71. package/esm/Input/InputAddonWrapper.js +2 -3
  72. package/esm/Input/InputImpl.js +15 -17
  73. package/esm/InputGroup/AddonWrapper.js +5 -7
  74. package/esm/InputMask/DSInputMaskDeprecated.js +10 -12
  75. package/esm/MenuItem/components/MenuItem/index.js +1 -1
  76. package/esm/MenuItem/components/MultiMenuItem/MultiMenuItem.js +1 -0
  77. package/esm/MenuItem/components/Section/index.js +1 -1
  78. package/esm/MenuItem/components/Section/styled.js +1 -1
  79. package/esm/MenuItem/components/Separator/styled.js +2 -2
  80. package/esm/MenuItem/components/SingleMenuItem/SingleMenuItem.js +6 -6
  81. package/esm/MenuItem/components/SubmenuItem/index.js +1 -1
  82. package/esm/MenuItem/components/styled.js +13 -6
  83. package/esm/SearchBox/withSearchable.js +2 -4
  84. package/esm/Toggle/DSToggleImpl.js +28 -28
  85. package/package.json +40 -27
  86. package/types/Checkbox/DSCheckbox.d.ts +78 -13
  87. package/types/Checkbox/elements/CheckMark.d.ts +1 -1
  88. package/types/Checkbox/props.d.ts +58 -12
  89. package/types/CheckboxGroup/DSCheckboxGroup.d.ts +51 -7
  90. package/types/CheckboxGroup/props.d.ts +37 -6
  91. package/types/ComboBox/v2/Combobox.d.ts +56 -1
  92. package/types/ComboBox/v3/ComboBox.d.ts +54 -12
  93. package/types/ComboBox/v3/ComboboxDataTestids.d.ts +2 -0
  94. package/types/ComboBox/v3/parts/a11y-messages/styled.d.ts +1 -1
  95. package/types/ComboBox/v3/parts/container/styled.d.ts +3 -3
  96. package/types/ComboBox/v3/parts/controls/styled.d.ts +5 -5
  97. package/types/ComboBox/v3/parts/controls-input/styled.d.ts +4 -4
  98. package/types/ComboBox/v3/parts/controls-input/useControlsInput.d.ts +3 -3
  99. package/types/ComboBox/v3/parts/dropdown-indicator/styled.d.ts +1 -60
  100. package/types/ComboBox/v3/parts/empty-state/styled.d.ts +2 -2
  101. package/types/ComboBox/v3/parts/header-list/styled.d.ts +7 -93
  102. package/types/ComboBox/v3/parts/header-list/useHeaderListHandlers.d.ts +12 -0
  103. package/types/ComboBox/v3/parts/menu-list/styled.d.ts +9 -3
  104. package/types/ComboBox/v3/parts/menu-list/useItemRenderer.d.ts +2 -0
  105. package/types/ComboBox/v3/parts/menu-list/useMenuList.d.ts +1 -1
  106. package/types/ComboBox/v3/parts/multi-selected-values-container/styled.d.ts +3 -3
  107. package/types/ComboBox/v3/parts/multi-selected-values-container/useGroupPills.d.ts +1 -2
  108. package/types/ComboBox/v3/parts/single-selected-value-container/styled.d.ts +1 -1
  109. package/types/ComboBox/v3/propTypes.d.ts +49 -11
  110. package/types/ComboBox/v3/tests/combobox-special-keys.test.d.ts +1 -0
  111. package/types/ComboBox/v3/tests/utils.d.ts +5 -0
  112. package/types/ComboBox/v3/utils/hooks/useKeyboardNavigation.d.ts +4 -1
  113. package/types/ComboBox/v3/utils/listHelper.d.ts +1 -1
  114. package/types/DateInput/DSDateInput.d.ts +97 -16
  115. package/types/DateInput/props.d.ts +97 -16
  116. package/types/DateInputV2/components/DSDateInput.d.ts +72 -5
  117. package/types/DateInputV2/components/props.d.ts +61 -10
  118. package/types/DateInputV2/components/styled.d.ts +4 -4
  119. package/types/FloatingLabelInput/DSFloatingLabelInput.d.ts +118 -20
  120. package/types/FormItem/DSFormItemLayout.d.ts +390 -60
  121. package/types/FormItem/Error/DSError.d.ts +21 -3
  122. package/types/FormItem/Suffix/Suffix.d.ts +3 -3
  123. package/types/FormItem/defaultProps.d.ts +118 -20
  124. package/types/FormItem/props.d.ts +229 -39
  125. package/types/InputGroup/DSInputGroup.d.ts +56 -8
  126. package/types/InputGroup/props.d.ts +43 -7
  127. package/types/InputMask/DSInputMask.d.ts +172 -30
  128. package/types/InputMask/mask_types/DateInputMask.d.ts +34 -33
  129. package/types/InputMask/mask_types/DateTimeInputMask.d.ts +34 -33
  130. package/types/InputMask/mask_types/DictionaryInputMask.d.ts +37 -36
  131. package/types/InputMask/mask_types/NumberInputMask.d.ts +46 -45
  132. package/types/InputMask/mask_types/PhoneInputMask.d.ts +34 -33
  133. package/types/InputMask/mask_types/PhoneInternationalInputMask.d.ts +34 -33
  134. package/types/InputMask/mask_types/SsnInputMask.d.ts +34 -33
  135. package/types/InputMask/mask_types/UsZipCodeInputMask.d.ts +34 -33
  136. package/types/InputMask/mask_types/ZipCodeSearchInputMask.d.ts +34 -33
  137. package/types/InputMask/props.d.ts +172 -30
  138. package/types/InputProtected/DSInputProtected.d.ts +56 -7
  139. package/types/InputProtected/props.d.ts +43 -8
  140. package/types/LargeInputText/DSLargeInputText.d.ts +163 -27
  141. package/types/LargeInputText/props.d.ts +163 -27
  142. package/types/MenuItem/components/MenuItem/index.d.ts +12 -3
  143. package/types/MenuItem/components/MenuItem/styled.d.ts +1 -1
  144. package/types/MenuItem/components/MultiMenuItem/MultiMenuItem.d.ts +12 -3
  145. package/types/MenuItem/components/MultiMenuItem/styled.d.ts +1 -1
  146. package/types/MenuItem/components/Section/index.d.ts +4 -1
  147. package/types/MenuItem/components/Section/props.d.ts +4 -1
  148. package/types/MenuItem/components/Section/styled.d.ts +2 -2
  149. package/types/MenuItem/components/Separator/styled.d.ts +2 -2
  150. package/types/MenuItem/components/SingleMenuItem/SingleMenuItem.d.ts +7 -2
  151. package/types/MenuItem/components/SubmenuItem/index.d.ts +12 -3
  152. package/types/MenuItem/components/SubmenuItem/styled.d.ts +2 -2
  153. package/types/MenuItem/components/styled.d.ts +3 -3
  154. package/types/MenuItem/props.d.ts +7 -2
  155. package/types/Radio/Circle.d.ts +1 -1
  156. package/types/Radio/DSRadio.d.ts +79 -13
  157. package/types/RadioGroup/DSRadioGroup.d.ts +51 -7
  158. package/types/RadioGroup/props.d.ts +37 -6
  159. package/types/SearchBox/DSSearchBox.d.ts +146 -21
  160. package/types/SearchBox/NavSearchBox.d.ts +18 -3
  161. package/types/SearchBox/SButton.d.ts +13 -2
  162. package/types/SearchBox/props.d.ts +133 -22
  163. package/types/SearchBox/styled.d.ts +1 -49
  164. package/types/TextBox/DSTextBox.d.ts +146 -21
  165. package/types/TimeInput/DSTimeInput.d.ts +83 -12
  166. package/types/TimeInput/utils.d.ts +1 -1
  167. package/types/Toggle/DSToggle.d.ts +84 -12
  168. package/cjs/ComboBox/v3/utils/hooks/useOnWindowResize.js +0 -31
  169. package/cjs/MenuItem/components/SingleMenuItem/styled.js +0 -19
  170. package/esm/ComboBox/v3/utils/hooks/useOnWindowResize.js +0 -27
  171. package/esm/MenuItem/components/SingleMenuItem/styled.js +0 -10
  172. package/types/ComboBox/v3/utils/hooks/useOnWindowResize.d.ts +0 -5
  173. package/types/MenuItem/components/SingleMenuItem/styled.d.ts +0 -2
@@ -39,7 +39,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
39
39
 
40
40
  const SubmenuItem = props$1 => {
41
41
  const propsWithDefault = dsPropsHelpers.useMemoMergePropsWithDefault(props$1, props.defaultProps);
42
- dsPropsHelpers.useValidateTypescriptPropTypes(propsWithDefault, SubmenuItemWithSchema.toTypescript());
42
+ dsPropsHelpers.useValidateTypescriptPropTypes(propsWithDefault, props.itemProps);
43
43
  const {
44
44
  dsId,
45
45
  label,
@@ -2,32 +2,40 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
+ var _taggedTemplateLiteral = require('@babel/runtime/helpers/taggedTemplateLiteral');
5
6
  var styled = require('styled-components');
7
+ var dsSystem = require('@elliemae/ds-system');
6
8
  var styledSystem = require('styled-system');
7
9
 
8
10
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
9
11
 
12
+ var _taggedTemplateLiteral__default = /*#__PURE__*/_interopDefaultLegacy(_taggedTemplateLiteral);
10
13
  var styled__default = /*#__PURE__*/_interopDefaultLegacy(styled);
11
14
 
15
+ var _templateObject, _templateObject2;
16
+
12
17
  const borderOutside = function (color) {
13
18
  let width = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
14
- return styled.css([":after{display:block;content:' ';position:absolute;top:0;left:0;right:0;bottom:0;border:", "px solid ", ";pointer-events:none;z-index:7;}"], width, color);
19
+ return dsSystem.css(_templateObject || (_templateObject = _taggedTemplateLiteral__default["default"](["\n :after {\n display: block;\n content: ' ';\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n border: ", "px solid ", ";\n pointer-events: none;\n z-index: 7;\n }\n"])), width, color);
15
20
  };
16
21
 
22
+ const disabledOption = () => dsSystem.css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral__default["default"](["\n cursor: not-allowed;\n * {\n cursor: not-allowed;\n }\n"])));
23
+
17
24
  const activeBorderCss = props => borderOutside(props.theme.colors.brand[500]);
18
25
 
19
26
  const focusBorderCss = props => borderOutside(props.theme.colors.brand[700], 2);
20
27
 
21
28
  const StyledGlobalMenuItemWrapper = /*#__PURE__*/styled__default["default"].li.withConfig({
22
29
  componentId: "sc-jyoobd-0"
23
- })(["cursor:pointer;height:32px;padding-left:16px;padding-right:40px;display:grid;align-items:center;list-style:none;position:relative;", " ", " ", " ", ";background-color:", ";&:hover{background-color:", ";}"], styledSystem.position, styledSystem.layout, styledSystem.space, props => {
30
+ })(["cursor:pointer;height:32px;padding-left:16px;padding-right:16px;display:grid;align-items:center;list-style:none;position:relative;", " ", " ", ";background-color:", ";&:hover{background-color:", ";}"], styledSystem.position, styledSystem.layout, props => {
31
+ if (props.disabled) return disabledOption();
24
32
  if (props.isFocus) return focusBorderCss(props);
25
33
  if (props.isActive) return activeBorderCss(props);
26
34
  return '';
27
- }, props => props.isActive ? props.theme.colors.brand[200] : 'white', props => props.theme.colors.brand[200]);
35
+ }, props => props.isActive ? props.theme.colors.brand[200] : 'white', props => !props.disabled && props.theme.colors.brand[200]);
28
36
  const StyledMenuItemWrapper = /*#__PURE__*/styled__default["default"](StyledGlobalMenuItemWrapper).withConfig({
29
37
  componentId: "sc-jyoobd-1"
30
- })(["background-color:", " !important;", ";"], props => props.isSelected ? props.theme.colors.brand[200] : 'white', props => props.isSelected && !props.isFocus ? activeBorderCss(props) : '');
38
+ })(["background-color:", " !important;cursor:", ";", ";"], props => props.isSelected ? props.theme.colors.brand[200] : 'white', props => props.disabled && 'not-allowed', props => props.isSelected && !props.isFocus ? activeBorderCss(props) : '');
31
39
  const StyledSubmenuItemWrapper = /*#__PURE__*/styled__default["default"](StyledGlobalMenuItemWrapper).withConfig({
32
40
  componentId: "sc-jyoobd-2"
33
41
  })(["", ";padding-right:0;"], props => props.isSelected || props.isActive ? activeBorderCss(props) : '');
@@ -5,16 +5,16 @@ require('core-js/modules/esnext.iterator.constructor.js');
5
5
  require('core-js/modules/esnext.iterator.filter.js');
6
6
  require('core-js/modules/esnext.async-iterator.for-each.js');
7
7
  require('core-js/modules/esnext.iterator.for-each.js');
8
- var _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProperties');
9
8
  var _defineProperty = require('@babel/runtime/helpers/defineProperty');
9
+ var _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProperties');
10
10
  var React = require('react');
11
11
  var dsUtilities = require('@elliemae/ds-utilities');
12
12
  var jsxRuntime = require('react/jsx-runtime');
13
13
 
14
14
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
15
15
 
16
- var _objectWithoutProperties__default = /*#__PURE__*/_interopDefaultLegacy(_objectWithoutProperties);
17
16
  var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_defineProperty);
17
+ var _objectWithoutProperties__default = /*#__PURE__*/_interopDefaultLegacy(_objectWithoutProperties);
18
18
  var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
19
19
 
20
20
  const _excluded = ["containerProps"];
@@ -27,9 +27,7 @@ const withSearchable = WrappedComponent => {
27
27
  class Searchable extends React.Component {
28
28
  constructor(props) {
29
29
  super(props);
30
-
31
- _defineProperty__default["default"](this, "debouncedSearch", dsUtilities.debounce(this.handleSearch, 200));
32
-
30
+ this.debouncedSearch = dsUtilities.debounce(this.handleSearch, 200);
33
31
  this.state = {
34
32
  value: props.value
35
33
  };
@@ -24,7 +24,7 @@ class DSToggleImpl extends React.Component {
24
24
  constructor(props) {
25
25
  super(props);
26
26
 
27
- _defineProperty__default["default"](this, "onDragStart", clientX => {
27
+ this.onDragStart = clientX => {
28
28
  const {
29
29
  startPoint,
30
30
  checked,
@@ -44,9 +44,9 @@ class DSToggleImpl extends React.Component {
44
44
  drag
45
45
  }); // else this.setDragOnChange(checkedProp != null ? checkedProp : checked) // set initial position
46
46
  else this.setDragOnChange(checked); // set initial position
47
- });
47
+ };
48
48
 
49
- _defineProperty__default["default"](this, "onDragStop", e => {
49
+ this.onDragStop = e => {
50
50
  const {
51
51
  checked
52
52
  } = this.state; // const { checked: checkedProp, } = this.props
@@ -56,25 +56,25 @@ class DSToggleImpl extends React.Component {
56
56
  this.setState(toggleHelper.cleanDrag); // } else this.setDragOnChange(checkedProp != null ? checkedProp : checked) // set initial position
57
57
  } else this.setDragOnChange(checked); // set initial position
58
58
 
59
- });
59
+ };
60
60
 
61
- _defineProperty__default["default"](this, "onBlur", e => {
61
+ this.onBlur = e => {
62
62
  const {
63
63
  onBlur,
64
64
  id
65
65
  } = this.props;
66
66
  if (onBlur) onBlur(e, id);
67
- });
67
+ };
68
68
 
69
- _defineProperty__default["default"](this, "onFocus", e => {
69
+ this.onFocus = e => {
70
70
  const {
71
71
  onFocus,
72
72
  id
73
73
  } = this.props;
74
74
  if (onFocus) onFocus(e, id);
75
- });
75
+ };
76
76
 
77
- _defineProperty__default["default"](this, "onChange", e => {
77
+ this.onChange = e => {
78
78
  const {
79
79
  checked
80
80
  } = this.state;
@@ -97,26 +97,26 @@ class DSToggleImpl extends React.Component {
97
97
  onChange(e, id); // this.setDragOnChange(checkedProp != null ? checkedProp : newCheck) // set new position
98
98
 
99
99
  this.setDragOnChange(newCheck); // set new position
100
- });
100
+ };
101
101
 
102
- _defineProperty__default["default"](this, "onMouseEnter", () => {
102
+ this.onMouseEnter = () => {
103
103
  this.setState({
104
104
  inside: true
105
105
  });
106
- });
106
+ };
107
107
 
108
- _defineProperty__default["default"](this, "onMouseLeave", () => {
108
+ this.onMouseLeave = () => {
109
109
  this.setState({
110
110
  inside: false
111
111
  });
112
- });
112
+ };
113
113
 
114
- _defineProperty__default["default"](this, "onMouseMove", event => {
114
+ this.onMouseMove = event => {
115
115
  event.preventDefault();
116
116
  this.onDragStart(event.clientX);
117
- });
117
+ };
118
118
 
119
- _defineProperty__default["default"](this, "onMouseDown", event => {
119
+ this.onMouseDown = event => {
120
120
  this.onDragStart(event.clientX);
121
121
  this.setState({
122
122
  startPoint: event.clientX,
@@ -124,36 +124,36 @@ class DSToggleImpl extends React.Component {
124
124
  });
125
125
  window.addEventListener('mousemove', this.onMouseMove);
126
126
  window.addEventListener('mouseup', this.onMouseUp);
127
- });
127
+ };
128
128
 
129
- _defineProperty__default["default"](this, "onMouseUp", event => {
129
+ this.onMouseUp = event => {
130
130
  this.onDragStop(event);
131
131
  window.removeEventListener('mousemove', this.onMouseMove);
132
132
  window.removeEventListener('mouseup', this.onMouseUp);
133
- });
133
+ };
134
134
 
135
- _defineProperty__default["default"](this, "onTouchCancel", () => {
135
+ this.onTouchCancel = () => {
136
136
  this.setState({
137
137
  inside: false
138
138
  });
139
- });
139
+ };
140
140
 
141
- _defineProperty__default["default"](this, "onTouchEnd", event => {
141
+ this.onTouchEnd = event => {
142
142
  event.preventDefault();
143
143
  this.onDragStop(event);
144
- });
144
+ };
145
145
 
146
- _defineProperty__default["default"](this, "onTouchMove", event => {
146
+ this.onTouchMove = event => {
147
147
  this.onDragStart(event.touches[0].clientX);
148
- });
148
+ };
149
149
 
150
- _defineProperty__default["default"](this, "onTouchStart", event => {
150
+ this.onTouchStart = event => {
151
151
  this.onDragStart(event.touches[0].clientX);
152
152
  this.setState({
153
153
  startPoint: event.touches[0].clientX,
154
154
  isDragging: true
155
155
  });
156
- });
156
+ };
157
157
 
158
158
  this.state = {
159
159
  checked: props.checked || false,
@@ -2,9 +2,9 @@ import 'core-js/modules/esnext.async-iterator.filter.js';
2
2
  import 'core-js/modules/esnext.iterator.filter.js';
3
3
  import 'core-js/modules/esnext.async-iterator.for-each.js';
4
4
  import 'core-js/modules/esnext.iterator.for-each.js';
5
+ import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
5
6
  import _jsx from '@babel/runtime/helpers/esm/jsx';
6
7
  import _objectWithoutProperties from '@babel/runtime/helpers/esm/objectWithoutProperties';
7
- import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
8
8
  import 'core-js/modules/esnext.async-iterator.map.js';
9
9
  import 'core-js/modules/esnext.iterator.map.js';
10
10
  import 'core-js/modules/web.dom-collections.iterator.js';
@@ -57,36 +57,32 @@ const getValues = (option, isMulti, valueProperty) => {
57
57
  class DSComboBox extends React.Component {
58
58
  constructor(props) {
59
59
  super(props);
60
-
61
- _defineProperty(this, "forceFocus", false);
62
-
63
- _defineProperty(this, "isHover", undefined);
64
-
65
- _defineProperty(this, "handleHover", debounce(value => {
60
+ this.forceFocus = false;
61
+ this.isHover = undefined;
62
+ this.handleHover = debounce(value => {
66
63
  if (this.state.isHover === this.isHover) return;
67
64
  if (!this.unmount) this.setState({
68
65
  isHover: value
69
66
  });
70
- }, 0));
71
-
72
- _defineProperty(this, "state", {
67
+ }, 0);
68
+ this.state = {
73
69
  focus: null,
74
70
  isHover: undefined
75
- });
71
+ };
76
72
 
77
- _defineProperty(this, "handleOutsideScroll", () => {
73
+ this.handleOutsideScroll = () => {
78
74
  if (this.isHover !== true && !this.unmount) {
79
75
  this.isHover = false;
80
76
  this.handleHover(false);
81
77
  }
82
- });
78
+ };
83
79
 
84
- _defineProperty(this, "handleHoverRef", value => {
80
+ this.handleHoverRef = value => {
85
81
  this.isHover = value;
86
82
  this.handleHover(value);
87
- });
83
+ };
88
84
 
89
- _defineProperty(this, "onKeyDownClear", e => {
85
+ this.onKeyDownClear = e => {
90
86
  // if (e.key === 'ArrowRight') {
91
87
  // this.arrow.focus()
92
88
  // } else if (e.key === 'ArrowLeft') {
@@ -95,9 +91,9 @@ class DSComboBox extends React.Component {
95
91
  if (e.keyCode === 32 || e.keyCode === 13) {
96
92
  this.select.focus();
97
93
  }
98
- });
94
+ };
99
95
 
100
- _defineProperty(this, "handleKeyDown", e => {
96
+ this.handleKeyDown = e => {
101
97
  // if (e.key === 'ArrowRight') e.preventDefault()
102
98
  // if (e.target.type === 'text' && e.key === 'ArrowRight') {
103
99
  // if (this.clear && this.clear.focus) {
@@ -117,7 +113,7 @@ class DSComboBox extends React.Component {
117
113
  if (!value && e.key === ' ') e.preventDefault();
118
114
  this.props.onKeyDown(e);
119
115
  };
120
- });
116
+ };
121
117
 
122
118
  this.clear = /*#__PURE__*/React.createRef();
123
119
  this.arrow = /*#__PURE__*/React.createRef();
@@ -328,9 +324,9 @@ class DSComboBox extends React.Component {
328
324
 
329
325
  }
330
326
 
331
- _defineProperty(DSComboBox, "defaultProps", {
327
+ DSComboBox.defaultProps = {
332
328
  showAllOption: false
333
- });
329
+ };
334
330
  var DSComboBox$1 = withSelectStringValueConverter(withContentRect('bounds')(DSComboBox));
335
331
 
336
332
  export { DSComboBox$1 as default };
@@ -44,8 +44,7 @@ const withSelectStringValueConverter = WrappedComponent => {
44
44
  return _temp = _class = class extends Component {
45
45
  constructor() {
46
46
  super(...arguments);
47
-
48
- _defineProperty(this, "state", {});
47
+ this.state = {};
49
48
  }
50
49
 
51
50
  static getDerivedStateFromProps(nextProps, prevState) {
@@ -68,10 +67,10 @@ const withSelectStringValueConverter = WrappedComponent => {
68
67
  }));
69
68
  }
70
69
 
71
- }, _defineProperty(_class, "defaultProps", {
70
+ }, _class.defaultProps = {
72
71
  valueProperty: 'value',
73
72
  labelProperty: 'label'
74
- }), _temp;
73
+ }, _temp;
75
74
  };
76
75
 
77
76
  export { withSelectStringValueConverter as default };
@@ -10,9 +10,8 @@ import { defaultProps, ComboBoxContext } from './ComboBoxCTX.js';
10
10
  var _Container;
11
11
 
12
12
  const DSComboBox = props => {
13
- // if we detect wrong props configuration we throw meaningful errors
14
13
  const propsWithDefault = useMemoMergePropsWithDefault(props, defaultProps);
15
- useValidateTypescriptPropTypes(propsWithDefault, DSComboBoxWithSchema.toTypescript());
14
+ useValidateTypescriptPropTypes(propsWithDefault, propTypes);
16
15
  const ctx = useComboBox(props);
17
16
  return /*#__PURE__*/_jsx(ComboBoxContext.Provider, {
18
17
  value: ctx
@@ -1,39 +1,46 @@
1
1
  import { createContext, createRef } from 'react';
2
+ import { noop } from 'lodash';
2
3
 
3
4
  // eslint-disable-next-line @typescript-eslint/no-empty-function
4
- const noop = () => {};
5
-
6
5
  const defaultProps = {
7
6
  placeholder: '',
8
7
  options: [],
9
8
  selectedValues: null,
10
- onChange: noop,
11
- onClear: noop,
12
9
  hasError: false,
13
10
  inline: false,
14
11
  autoFocus: false,
15
- onClearAll: undefined,
16
- onSelectAll: undefined,
17
- onCreate: undefined,
18
- onFilter: noop
12
+ startPlacementPreference: 'bottom-start',
13
+ placementOrderPreference: ['bottom-start', 'bottom-end'],
14
+ onClearAll: noop,
15
+ onSelectAll: noop,
16
+ onCreate: noop,
17
+ withToggle: false,
18
+ onChange: noop,
19
+ onKeyDown: noop,
20
+ onFilter: noop,
21
+ onMenuOpen: noop
19
22
  };
20
23
  const defaultContext = {
21
24
  props: defaultProps,
22
25
  showPopover: false,
23
26
  setShowPopover: noop,
24
27
  scrollOptionIntoView: noop,
25
- referenceElement: undefined,
28
+ referenceElement: null,
26
29
  hasFocus: false,
27
30
  setHasFocus: noop,
31
+ pillGroupRef: /*#__PURE__*/createRef(),
28
32
  setReferenceElement: noop,
29
33
  inputRef: /*#__PURE__*/createRef(),
30
34
  listRef: /*#__PURE__*/createRef(),
35
+ wrapperListRef: /*#__PURE__*/createRef(),
31
36
  controlsWrapperRef: /*#__PURE__*/createRef(),
32
37
  selectedOptionsRef: /*#__PURE__*/createRef(),
33
38
  showSelectedValue: false,
34
39
  setShowSelectedValue: noop,
35
40
  focusOptionIdx: '',
36
- setCurrentOption: noop
41
+ setCurrentOption: noop,
42
+ showSelectedOptions: false,
43
+ setShowSelectedOptions: noop
37
44
  };
38
45
  /** Context for cross component communication */
39
46
 
@@ -5,7 +5,9 @@ const ComboboxDataTestid = {
5
5
  SELECT_ALL_BUTTON: 'combobox-all-btn',
6
6
  CLEAR_ALL_BUTTON: 'combobox-clear-btn',
7
7
  DROPDOWN: 'combobox-dropdown-btn',
8
- OPTION: 'combobox-option'
8
+ OPTION: 'combobox-option',
9
+ SHOW_ALL_BUTTON: 'combobox-show-all-btn',
10
+ SHOW_SELECTED_OPTIONS_BUTTON: 'combobox-selected-options-btn'
9
11
  };
10
12
 
11
13
  export { ComboboxDataTestid };
@@ -1,41 +1,75 @@
1
+ import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
1
2
  import 'core-js/modules/web.dom-collections.iterator.js';
2
- import { useState, useRef, useEffect, useCallback, useMemo } from 'react';
3
+ import 'core-js/modules/esnext.async-iterator.for-each.js';
4
+ import 'core-js/modules/esnext.iterator.constructor.js';
5
+ import 'core-js/modules/esnext.iterator.for-each.js';
6
+ import 'core-js/modules/esnext.async-iterator.find.js';
7
+ import 'core-js/modules/esnext.iterator.find.js';
8
+ import 'core-js/modules/esnext.async-iterator.filter.js';
9
+ import 'core-js/modules/esnext.iterator.filter.js';
10
+ import { useState, useRef, useCallback, useMemo } from 'react';
3
11
  import { useVirtual } from 'react-virtual';
4
12
  import { useGetComboBoxWithDefaultsProps } from './useGetPropsWithDefault.js';
5
13
 
6
- const useComboBox = props => {
7
- var _inputRef$current;
14
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
8
15
 
16
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
17
+ const useComboBox = props => {
9
18
  const [showPopover, setShowPopover] = useState(false);
10
- const [referenceElement, setReferenceElement] = useState();
19
+ const [referenceElement, setReferenceElement] = useState(null);
11
20
  const [showSelectedValue, setShowSelectedValue] = useState(false);
21
+ const [showSelectedOptions, setShowSelectedOptions] = useState(false);
12
22
  const [hasFocus, setHasFocus] = useState(false);
13
23
  const [focusOptionIdx, setCurrentOption] = useState('');
14
- const inputRef = useRef();
15
- const listRef = useRef();
16
- const selectedOptionsRef = useRef();
17
- const controlsWrapperRef = useRef();
24
+ const inputRef = useRef(null);
25
+ const listRef = useRef(null);
26
+ const wrapperListRef = useRef(null);
27
+ const selectedOptionsRef = useRef(null);
28
+ const controlsWrapperRef = useRef(null);
29
+ const pillGroupRef = useRef(null);
18
30
  const propsWithDefaults = useGetComboBoxWithDefaultsProps(props);
19
31
  const {
20
- options
32
+ options,
33
+ selectedValues
21
34
  } = propsWithDefaults; // ---------------------------------------------------------------------------
22
- // Focusing first option when dropdown opens or input changes
35
+ // Menu Options with/out selected filter
23
36
  // ---------------------------------------------------------------------------
24
37
 
25
- useEffect(() => {
26
- if (showPopover) {
27
- for (let i = 0; i < options.length; i += 1) if (!['section', 'separator'].includes(options[i].type)) {
28
- setCurrentOption(options[i].dsId);
29
- break;
38
+ const selectedValuesWithSections = useCallback(() => {
39
+ var _items2;
40
+
41
+ const multiSelectedValue = selectedValues;
42
+ const items = [];
43
+ options.forEach(option => {
44
+ const isSelectedValue = multiSelectedValue.find(item => item.dsId === option.dsId);
45
+
46
+ if (isSelectedValue) {
47
+ items.push(option);
30
48
  }
31
- } // eslint-disable-next-line react-hooks/exhaustive-deps
32
49
 
33
- }, [showPopover, (_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 ? void 0 : _inputRef$current.value]); // ===========================================================================
50
+ if (option.type === 'section') {
51
+ var _items;
52
+
53
+ if (((_items = items[items.length - 1]) === null || _items === void 0 ? void 0 : _items.type) === 'section') {
54
+ items[items.length - 1] = option;
55
+ } else {
56
+ items.push(option);
57
+ }
58
+ }
59
+ });
60
+
61
+ if (((_items2 = items[items.length - 1]) === null || _items2 === void 0 ? void 0 : _items2.type) === 'section') {
62
+ items.pop();
63
+ }
64
+
65
+ return items;
66
+ }, [options, selectedValues]);
67
+ const correctOptions = useMemo(() => showSelectedOptions && Array.isArray(selectedValues) && selectedValues.length > 0 ? selectedValuesWithSections() : options, [options, selectedValuesWithSections, selectedValues, showSelectedOptions]); // ===========================================================================
34
68
  // Virtualization setup
35
69
  // ===========================================================================
36
70
 
37
71
  const virtualListHelpers = useVirtual({
38
- size: propsWithDefaults.options.length,
72
+ size: correctOptions.length,
39
73
  parentRef: listRef,
40
74
  overscan: 15,
41
75
  paddingStart: 0
@@ -47,10 +81,12 @@ const useComboBox = props => {
47
81
  let opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {
48
82
  align: 'center'
49
83
  };
50
- virtualListHelpers.scrollToIndex(propsWithDefaults.options.findIndex(opt => opt.dsId === dsId), opts);
51
- }, [propsWithDefaults.options, virtualListHelpers]);
84
+ virtualListHelpers.scrollToIndex(correctOptions.findIndex(opt => opt.dsId === dsId), opts);
85
+ }, [correctOptions, virtualListHelpers]);
52
86
  const ctx = useMemo(() => ({
53
- props: propsWithDefaults,
87
+ props: _objectSpread(_objectSpread({}, propsWithDefaults), {}, {
88
+ options: correctOptions
89
+ }),
54
90
  virtualListHelpers,
55
91
  showPopover,
56
92
  referenceElement,
@@ -61,13 +97,17 @@ const useComboBox = props => {
61
97
  selectedOptionsRef,
62
98
  controlsWrapperRef,
63
99
  hasFocus,
100
+ pillGroupRef,
101
+ showSelectedOptions,
102
+ wrapperListRef,
103
+ setShowSelectedOptions,
64
104
  setHasFocus,
65
105
  setCurrentOption,
66
106
  scrollOptionIntoView,
67
107
  setShowSelectedValue,
68
108
  setReferenceElement,
69
109
  setShowPopover
70
- }), [scrollOptionIntoView, propsWithDefaults, virtualListHelpers, focusOptionIdx, showSelectedValue, showPopover, referenceElement, inputRef, selectedOptionsRef, controlsWrapperRef, hasFocus, listRef]);
110
+ }), [scrollOptionIntoView, correctOptions, propsWithDefaults, virtualListHelpers, focusOptionIdx, showSelectedValue, wrapperListRef, showSelectedOptions, showPopover, pillGroupRef, referenceElement, inputRef, selectedOptionsRef, controlsWrapperRef, hasFocus, listRef]);
71
111
  return ctx;
72
112
  };
73
113
 
@@ -5,14 +5,16 @@ import { ComboBoxContext } from '../../ComboBoxCTX.js';
5
5
  import { StyledPopperWrapper, StyledContainerInline, StyledContainerWithPopper } from './styled.js';
6
6
  import { Controls } from '../controls/Controls.js';
7
7
  import { MenuList } from '../menu-list/MenuList.js';
8
- import { jsxs } from 'react/jsx-runtime';
8
+ import { jsxs, Fragment } from 'react/jsx-runtime';
9
9
 
10
10
  var _Controls, _MenuList, _MenuList2;
11
11
 
12
12
  const Container = () => {
13
13
  const {
14
14
  props: {
15
- inline
15
+ inline,
16
+ startPlacementPreference,
17
+ placementOrderPreference
16
18
  },
17
19
  showPopover,
18
20
  inputRef,
@@ -22,28 +24,36 @@ const Container = () => {
22
24
  } = useContext(ComboBoxContext);
23
25
  const handleCloseMenu = useCallback(() => {
24
26
  setShowPopover(false);
25
- inputRef.current.blur();
27
+ if (inputRef.current) inputRef.current.blur();
26
28
  }, [inputRef, setShowPopover]);
27
29
  const handleMouseDown = useCallback(e => {
28
30
  e.preventDefault();
29
31
  }, []);
32
+ const handleOnClickContainer = useCallback(() => {
33
+ setShowPopover(!showPopover);
34
+ }, [setShowPopover, showPopover]);
30
35
  const StyledContainer = inline ? StyledContainerInline : StyledContainerWithPopper;
31
- return /*#__PURE__*/_jsx("div", {}, void 0, /*#__PURE__*/jsxs(StyledContainer, {
32
- ref: setReferenceElement,
33
- children: [_Controls || (_Controls = /*#__PURE__*/_jsx(Controls, {})), inline ? _MenuList || (_MenuList = /*#__PURE__*/_jsx(MenuList, {})) : null]
34
- }), !inline ? /*#__PURE__*/_jsx(DSPopperJS, {
35
- customOffset: [0, 5],
36
- closeContextMenu: handleCloseMenu,
37
- referenceElement: referenceElement,
38
- showPopover: showPopover,
39
- withoutPortal: true,
40
- withoutArrow: true,
41
- withoutAnimation: true,
42
- zIndex: 10
43
- }, void 0, /*#__PURE__*/_jsx(StyledPopperWrapper, {
44
- tabIndex: -1,
45
- onMouseDown: handleMouseDown
46
- }, void 0, _MenuList2 || (_MenuList2 = /*#__PURE__*/_jsx(MenuList, {})))) : null);
36
+ return /*#__PURE__*/jsxs(Fragment, {
37
+ children: [/*#__PURE__*/jsxs(StyledContainer, {
38
+ ref: setReferenceElement,
39
+ onClick: handleOnClickContainer,
40
+ children: [_Controls || (_Controls = /*#__PURE__*/_jsx(Controls, {})), inline ? _MenuList || (_MenuList = /*#__PURE__*/_jsx(MenuList, {})) : null]
41
+ }), !inline ? /*#__PURE__*/_jsx(DSPopperJS, {
42
+ customOffset: [0, 5],
43
+ closeContextMenu: handleCloseMenu,
44
+ referenceElement: referenceElement,
45
+ showPopover: showPopover,
46
+ startPlacementPreference: startPlacementPreference,
47
+ placementOrderPreference: placementOrderPreference,
48
+ withoutPortal: true,
49
+ withoutArrow: true,
50
+ withoutAnimation: true,
51
+ zIndex: 10
52
+ }, void 0, /*#__PURE__*/_jsx(StyledPopperWrapper, {
53
+ tabIndex: -1,
54
+ onMouseDown: handleMouseDown
55
+ }, void 0, _MenuList2 || (_MenuList2 = /*#__PURE__*/_jsx(MenuList, {})))) : null]
56
+ });
47
57
  };
48
58
 
49
59
  export { Container };
@@ -15,6 +15,7 @@ const Controls = () => {
15
15
  const {
16
16
  props: {
17
17
  inline,
18
+ inputMinWidth,
18
19
  hasError,
19
20
  selectedValues
20
21
  },
@@ -41,10 +42,11 @@ const Controls = () => {
41
42
  }
42
43
  };
43
44
 
44
- const cols = !inline ? ['minmax(0px,max-content)', 'minmax(0px, auto)', '29px'] : ['minmax(0px, auto)'];
45
+ const cols = !inline ? ['minmax(0px,max-content)', 'minmax(20px, auto)', '29px'] : ['minmax(0px, auto)'];
45
46
  return /*#__PURE__*/jsxs(StyledControlsWrapper, {
46
47
  ref: controlsWrapperRef,
47
48
  cols: cols,
49
+ minWidth: inputMinWidth,
48
50
  hasError: hasError,
49
51
  hasFocus: hasFocus,
50
52
  inline: inline,