@elliemae/ds-form 2.0.0-rc.6 → 2.0.0

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 (108) 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/ComboBoxCTX.js +16 -17
  4. package/cjs/ComboBox/v3/config/useComboBox.js +6 -6
  5. package/cjs/ComboBox/v3/parts/container/Container.js +1 -1
  6. package/cjs/ComboBox/v3/parts/controls-input/ControlsInput.js +5 -3
  7. package/cjs/ComboBox/v3/parts/controls-input/useControlsInput.js +8 -8
  8. package/cjs/ComboBox/v3/parts/header-list/HeaderList.js +5 -3
  9. package/cjs/ComboBox/v3/parts/menu-list/MenuList.js +7 -8
  10. package/cjs/ComboBox/v3/parts/menu-list/styled.js +8 -4
  11. package/cjs/ComboBox/v3/parts/menu-list/useItemRenderer.js +10 -9
  12. package/cjs/ComboBox/v3/utils/hooks/useKeyboardNavigation.js +5 -5
  13. package/cjs/ComboBox/v3/utils/hooks/useOnElementResize.js +4 -4
  14. package/cjs/FloatingLabelInput/FloatingLabelInputImpl.js +4 -7
  15. package/cjs/FormItem/ValidationFieldWrapper.js +2 -3
  16. package/cjs/Input/InputAddonWrapper.js +2 -3
  17. package/cjs/Input/InputImpl.js +16 -18
  18. package/cjs/InputGroup/AddonWrapper.js +4 -6
  19. package/cjs/InputMask/DSInputMaskDeprecated.js +10 -12
  20. package/cjs/SearchBox/NavSearchBox.js +5 -1
  21. package/cjs/SearchBox/withSearchable.js +3 -5
  22. package/cjs/Toggle/DSToggleImpl.js +28 -28
  23. package/esm/ComboBox/v1/DSComboBox.js +17 -21
  24. package/esm/ComboBox/v1/withSelectStringValueConverter.js +3 -4
  25. package/esm/ComboBox/v3/ComboBoxCTX.js +5 -6
  26. package/esm/ComboBox/v3/config/useComboBox.js +6 -6
  27. package/esm/ComboBox/v3/parts/container/Container.js +1 -1
  28. package/esm/ComboBox/v3/parts/controls-input/ControlsInput.js +5 -3
  29. package/esm/ComboBox/v3/parts/controls-input/useControlsInput.js +8 -8
  30. package/esm/ComboBox/v3/parts/header-list/HeaderList.js +5 -3
  31. package/esm/ComboBox/v3/parts/menu-list/MenuList.js +8 -9
  32. package/esm/ComboBox/v3/parts/menu-list/styled.js +8 -4
  33. package/esm/ComboBox/v3/parts/menu-list/useItemRenderer.js +10 -9
  34. package/esm/ComboBox/v3/utils/hooks/useKeyboardNavigation.js +5 -5
  35. package/esm/ComboBox/v3/utils/hooks/useOnElementResize.js +4 -4
  36. package/esm/FloatingLabelInput/FloatingLabelInputImpl.js +4 -7
  37. package/esm/FormItem/ValidationFieldWrapper.js +2 -3
  38. package/esm/Input/InputAddonWrapper.js +2 -3
  39. package/esm/Input/InputImpl.js +15 -17
  40. package/esm/InputGroup/AddonWrapper.js +5 -7
  41. package/esm/InputMask/DSInputMaskDeprecated.js +10 -12
  42. package/esm/SearchBox/NavSearchBox.js +5 -1
  43. package/esm/SearchBox/withSearchable.js +2 -4
  44. package/esm/Toggle/DSToggleImpl.js +28 -28
  45. package/package.json +31 -23
  46. package/types/Checkbox/DSCheckbox.d.ts +78 -13
  47. package/types/Checkbox/props.d.ts +58 -12
  48. package/types/CheckboxGroup/DSCheckboxGroup.d.ts +51 -7
  49. package/types/CheckboxGroup/props.d.ts +37 -6
  50. package/types/ComboBox/v2/Combobox.d.ts +56 -1
  51. package/types/ComboBox/v3/ComboBox.d.ts +54 -16
  52. package/types/ComboBox/v3/parts/controls-input/useControlsInput.d.ts +3 -3
  53. package/types/ComboBox/v3/parts/dropdown-indicator/styled.d.ts +1 -60
  54. package/types/ComboBox/v3/parts/header-list/styled.d.ts +4 -208
  55. package/types/ComboBox/v3/parts/menu-list/styled.d.ts +4 -3
  56. package/types/ComboBox/v3/parts/menu-list/useItemRenderer.d.ts +1 -1
  57. package/types/ComboBox/v3/propTypes.d.ts +49 -15
  58. package/types/ComboBox/v3/utils/hooks/useKeyboardNavigation.d.ts +4 -1
  59. package/types/ComboBox/v3/utils/listHelper.d.ts +1 -1
  60. package/types/DateInput/DSDateInput.d.ts +97 -16
  61. package/types/DateInput/props.d.ts +97 -16
  62. package/types/DateInputV2/components/DSDateInput.d.ts +72 -5
  63. package/types/DateInputV2/components/props.d.ts +61 -10
  64. package/types/FloatingLabelInput/DSFloatingLabelInput.d.ts +118 -20
  65. package/types/FormItem/DSFormItemLayout.d.ts +390 -60
  66. package/types/FormItem/Error/DSError.d.ts +21 -3
  67. package/types/FormItem/defaultProps.d.ts +118 -20
  68. package/types/FormItem/props.d.ts +229 -39
  69. package/types/InputGroup/DSInputGroup.d.ts +56 -8
  70. package/types/InputGroup/props.d.ts +43 -7
  71. package/types/InputMask/DSInputMask.d.ts +172 -30
  72. package/types/InputMask/mask_types/DateInputMask.d.ts +34 -33
  73. package/types/InputMask/mask_types/DateTimeInputMask.d.ts +34 -33
  74. package/types/InputMask/mask_types/DictionaryInputMask.d.ts +37 -36
  75. package/types/InputMask/mask_types/NumberInputMask.d.ts +46 -45
  76. package/types/InputMask/mask_types/PhoneInputMask.d.ts +34 -33
  77. package/types/InputMask/mask_types/PhoneInternationalInputMask.d.ts +34 -33
  78. package/types/InputMask/mask_types/SsnInputMask.d.ts +34 -33
  79. package/types/InputMask/mask_types/UsZipCodeInputMask.d.ts +34 -33
  80. package/types/InputMask/mask_types/ZipCodeSearchInputMask.d.ts +34 -33
  81. package/types/InputMask/props.d.ts +172 -30
  82. package/types/InputProtected/DSInputProtected.d.ts +56 -7
  83. package/types/InputProtected/props.d.ts +43 -8
  84. package/types/LargeInputText/DSLargeInputText.d.ts +163 -27
  85. package/types/LargeInputText/props.d.ts +163 -27
  86. package/types/MenuItem/components/MenuItem/index.d.ts +12 -3
  87. package/types/MenuItem/components/MultiMenuItem/MultiMenuItem.d.ts +12 -3
  88. package/types/MenuItem/components/Section/index.d.ts +4 -1
  89. package/types/MenuItem/components/Section/props.d.ts +4 -1
  90. package/types/MenuItem/components/SingleMenuItem/SingleMenuItem.d.ts +7 -2
  91. package/types/MenuItem/components/SubmenuItem/index.d.ts +12 -3
  92. package/types/MenuItem/props.d.ts +7 -2
  93. package/types/Radio/DSRadio.d.ts +79 -13
  94. package/types/RadioGroup/DSRadioGroup.d.ts +51 -7
  95. package/types/RadioGroup/props.d.ts +37 -6
  96. package/types/SearchBox/DSSearchBox.d.ts +146 -21
  97. package/types/SearchBox/NavSearchBox.d.ts +18 -3
  98. package/types/SearchBox/SButton.d.ts +13 -2
  99. package/types/SearchBox/index.d.ts +1 -1
  100. package/types/SearchBox/props.d.ts +133 -22
  101. package/types/SearchBox/styled.d.ts +1 -49
  102. package/types/TextBox/DSTextBox.d.ts +146 -21
  103. package/types/TimeInput/DSTimeInput.d.ts +83 -12
  104. package/types/TimeInput/utils.d.ts +1 -1
  105. package/types/Toggle/DSToggle.d.ts +84 -12
  106. package/cjs/ComboBox/v3/utils/hooks/useOnWindowResize.js +0 -31
  107. package/esm/ComboBox/v3/utils/hooks/useOnWindowResize.js +0 -27
  108. package/types/ComboBox/v3/utils/hooks/useOnWindowResize.d.ts +0 -5
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
- var _jsx = require('@babel/runtime/helpers/jsx');
4
3
  var _defineProperty = require('@babel/runtime/helpers/defineProperty');
4
+ var _jsx = require('@babel/runtime/helpers/jsx');
5
5
  require('core-js/modules/web.dom-collections.iterator.js');
6
6
  require('core-js/modules/esnext.async-iterator.filter.js');
7
7
  require('core-js/modules/esnext.iterator.constructor.js');
@@ -14,8 +14,8 @@ var jsxRuntime = require('react/jsx-runtime');
14
14
 
15
15
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
16
16
 
17
- var _jsx__default = /*#__PURE__*/_interopDefaultLegacy(_jsx);
18
17
  var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_defineProperty);
18
+ var _jsx__default = /*#__PURE__*/_interopDefaultLegacy(_jsx);
19
19
 
20
20
  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; }
21
21
 
@@ -26,8 +26,7 @@ const InputAddon = dsClassnames.aggregatedClasses('span')(blockName, 'addon');
26
26
  class AddonWrapper extends React.Component {
27
27
  constructor() {
28
28
  super(...arguments);
29
-
30
- _defineProperty__default["default"](this, "state", {});
29
+ this.state = {};
31
30
  }
32
31
 
33
32
  render() {
@@ -47,7 +46,6 @@ class AddonWrapper extends React.Component {
47
46
  }
48
47
 
49
48
  }
50
-
51
- _defineProperty__default["default"](AddonWrapper, "defaultProps", {});
49
+ AddonWrapper.defaultProps = {};
52
50
 
53
51
  module.exports = AddonWrapper;
@@ -96,12 +96,10 @@ class DSInputMaskDeprecated extends React.Component {
96
96
 
97
97
  super(props);
98
98
  _this = this;
99
+ this.lastkey = null;
100
+ this.lastkeycode = null;
99
101
 
100
- _defineProperty__default["default"](this, "lastkey", null);
101
-
102
- _defineProperty__default["default"](this, "lastkeycode", null);
103
-
104
- _defineProperty__default["default"](this, "conformValue", function (rawValueOrEvent, currentCaretPosition) {
102
+ this.conformValue = function (rawValueOrEvent, currentCaretPosition) {
105
103
  let {
106
104
  skipCaretPositioning = false,
107
105
  skipOnChangeCallback = false
@@ -213,9 +211,9 @@ class DSInputMaskDeprecated extends React.Component {
213
211
  if (!skipOnChangeCallback) onChange(event);
214
212
  if (!skipCaretPositioning) setTimeout(() => setCaretPosition(_this.inputref, caretPos));
215
213
  });
216
- });
214
+ };
217
215
 
218
- _defineProperty__default["default"](this, "handleOnChange", e => {
216
+ this.handleOnChange = e => {
219
217
  var _e$target;
220
218
 
221
219
  const rawValue = (e === null || e === void 0 ? void 0 : (_e$target = e.target) === null || _e$target === void 0 ? void 0 : _e$target.value) || '';
@@ -224,9 +222,9 @@ class DSInputMaskDeprecated extends React.Component {
224
222
  } = e.target;
225
223
  const currentCaretPosition = selectionEnd;
226
224
  this.conformValue(rawValue, currentCaretPosition);
227
- });
225
+ };
228
226
 
229
- _defineProperty__default["default"](this, "handleKeyDown", e => {
227
+ this.handleKeyDown = e => {
230
228
  e.stopPropagation();
231
229
  const {
232
230
  onKeyDown
@@ -234,9 +232,9 @@ class DSInputMaskDeprecated extends React.Component {
234
232
  this.lastkey = e.key;
235
233
  this.lastkeycode = e.keyCode;
236
234
  onKeyDown(e);
237
- });
235
+ };
238
236
 
239
- _defineProperty__default["default"](this, "handleBlur", e => {
237
+ this.handleBlur = e => {
240
238
  const {
241
239
  onBlur
242
240
  } = this.props;
@@ -244,7 +242,7 @@ class DSInputMaskDeprecated extends React.Component {
244
242
  focus: false
245
243
  });
246
244
  onBlur(e);
247
- });
245
+ };
248
246
 
249
247
  this.inputref = /*#__PURE__*/React__default["default"].createRef();
250
248
  this.state = {
@@ -133,7 +133,9 @@ const NavSearchBox = props => {
133
133
  totalResults,
134
134
  value,
135
135
  onBlur,
136
- placeholder
136
+ placeholder,
137
+ autoFocus,
138
+ innerRef
137
139
  } = props;
138
140
 
139
141
  const handleChange = e => {
@@ -164,6 +166,8 @@ const NavSearchBox = props => {
164
166
  onKeyDown: handleKeyDown,
165
167
  placeholder: placeholder,
166
168
  value: value,
169
+ autoFocus: autoFocus,
170
+ innerRef: innerRef,
167
171
  rightComponent: /*#__PURE__*/_jsx__default["default"](ToolbarRightAddons, {
168
172
  showClear: !!value,
169
173
  onNext: onNext,
@@ -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 };
@@ -1,8 +1,7 @@
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: [],
@@ -12,9 +11,9 @@ const defaultProps = {
12
11
  autoFocus: false,
13
12
  startPlacementPreference: 'bottom-start',
14
13
  placementOrderPreference: ['bottom-start', 'bottom-end'],
15
- onClearAll: undefined,
16
- onSelectAll: undefined,
17
- onCreate: undefined,
14
+ onClearAll: noop,
15
+ onSelectAll: noop,
16
+ onCreate: noop,
18
17
  withToggle: false,
19
18
  onChange: noop,
20
19
  onKeyDown: noop,
@@ -26,7 +25,7 @@ const defaultContext = {
26
25
  showPopover: false,
27
26
  setShowPopover: noop,
28
27
  scrollOptionIntoView: noop,
29
- referenceElement: undefined,
28
+ referenceElement: null,
30
29
  hasFocus: false,
31
30
  setHasFocus: noop,
32
31
  pillGroupRef: /*#__PURE__*/createRef(),
@@ -16,16 +16,16 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
16
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
17
  const useComboBox = props => {
18
18
  const [showPopover, setShowPopover] = useState(false);
19
- const [referenceElement, setReferenceElement] = useState();
19
+ const [referenceElement, setReferenceElement] = useState(null);
20
20
  const [showSelectedValue, setShowSelectedValue] = useState(false);
21
21
  const [showSelectedOptions, setShowSelectedOptions] = useState(false);
22
22
  const [hasFocus, setHasFocus] = useState(false);
23
23
  const [focusOptionIdx, setCurrentOption] = useState('');
24
- const inputRef = useRef();
25
- const listRef = useRef();
26
- const wrapperListRef = useRef();
27
- const selectedOptionsRef = useRef();
28
- 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
29
  const pillGroupRef = useRef(null);
30
30
  const propsWithDefaults = useGetComboBoxWithDefaultsProps(props);
31
31
  const {
@@ -24,7 +24,7 @@ const Container = () => {
24
24
  } = useContext(ComboBoxContext);
25
25
  const handleCloseMenu = useCallback(() => {
26
26
  setShowPopover(false);
27
- inputRef.current.blur();
27
+ if (inputRef.current) inputRef.current.blur();
28
28
  }, [inputRef, setShowPopover]);
29
29
  const handleMouseDown = useCallback(e => {
30
30
  e.preventDefault();
@@ -17,9 +17,11 @@ const ControlsInput = () => {
17
17
  focusOptionIdx,
18
18
  inputRef
19
19
  } = useContext(ComboBoxContext);
20
- const onInputKeyDown = useKeyboardNavigation();
21
20
  const {
22
- span,
21
+ onInputKeyDown
22
+ } = useKeyboardNavigation();
23
+ const {
24
+ spanReference,
23
25
  width,
24
26
  spanReferenceText,
25
27
  showPlaceholder,
@@ -28,7 +30,7 @@ const ControlsInput = () => {
28
30
  handleOnFocus
29
31
  } = useControlsInput();
30
32
  return /*#__PURE__*/_jsx(StyledInputWrapper, {}, void 0, /*#__PURE__*/jsx(StyledInputWidthReference, {
31
- ref: span,
33
+ ref: spanReference,
32
34
  children: spanReferenceText
33
35
  }), /*#__PURE__*/_jsx(StyledInputPlaceHolder, {}, void 0, /*#__PURE__*/_jsx(SimpleTruncatedTooltipText, {
34
36
  value: showPlaceholder
@@ -21,12 +21,12 @@ const useControlsInput = () => {
21
21
  setShowSelectedValue,
22
22
  setShowSelectedOptions
23
23
  } = useContext(ComboBoxContext);
24
- const [width, setWidth] = useState();
25
- const span = useRef(null);
24
+ const [width, setWidth] = useState(1);
25
+ const spanReference = useRef(null);
26
26
  useEffect(() => {
27
- var _span$current;
27
+ var _spanReference$curren;
28
28
 
29
- setWidth(((_span$current = span.current) === null || _span$current === void 0 ? void 0 : _span$current.offsetWidth) || 1);
29
+ setWidth(((_spanReference$curren = spanReference.current) === null || _spanReference$curren === void 0 ? void 0 : _spanReference$curren.offsetWidth) || 1);
30
30
  }, [(_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 ? void 0 : _inputRef$current.value]);
31
31
  useEffect(() => {
32
32
  setShowSelectedValue(true);
@@ -35,9 +35,9 @@ const useControlsInput = () => {
35
35
 
36
36
  const handleOnChange = useCallback(e => {
37
37
  setShowSelectedOptions(false);
38
- if (e.target.value) setShowSelectedValue(false);
38
+ if (e.currentTarget.value) setShowSelectedValue(false);
39
39
  setShowPopover(true);
40
- onFilter(e.target.value);
40
+ onFilter(e.currentTarget.value);
41
41
  }, [onFilter, setShowPopover, setShowSelectedOptions, setShowSelectedValue]);
42
42
  const handleOnBlur = useCallback(() => {
43
43
  setHasFocus(false);
@@ -66,8 +66,8 @@ const useControlsInput = () => {
66
66
  showPlaceholder,
67
67
  spanReferenceText,
68
68
  width,
69
- span
70
- }), [handleOnFocus, handleOnBlur, handleOnChange, spanReferenceText, showPlaceholder, width, span]);
69
+ spanReference
70
+ }), [handleOnFocus, handleOnBlur, handleOnChange, spanReferenceText, showPlaceholder, width, spanReference]);
71
71
  };
72
72
 
73
73
  export { useControlsInput };
@@ -24,6 +24,8 @@ const HeaderList = () => {
24
24
  showSelectedOptions,
25
25
  inputRef
26
26
  } = useContext(ComboBoxContext);
27
+ const isSelectAllSupplied = onSelectAll !== noop;
28
+ const isClearAllSupplied = onClearAll !== noop;
27
29
  const multiSelectedValues = selectedValues;
28
30
  const selectableOptions = getSelectableOptions(options);
29
31
  const {
@@ -38,7 +40,7 @@ const HeaderList = () => {
38
40
  return /*#__PURE__*/_jsx(StyledHeaderListWrapper, {
39
41
  onKeyDown: handleKeyDown,
40
42
  onMouseDown: handleOnMouseDown
41
- }, void 0, /*#__PURE__*/_jsx(StyledSelectedItems, {}, void 0, onSelectAll && /*#__PURE__*/_jsx(StyledButton, {
43
+ }, void 0, /*#__PURE__*/_jsx(StyledSelectedItems, {}, void 0, isSelectAllSupplied && /*#__PURE__*/_jsx(StyledButton, {
42
44
  disabled: (inputRef === null || inputRef === void 0 ? void 0 : (_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 ? void 0 : _inputRef$current.value) !== '' || selectableOptions.length === multiSelectedValues.length,
43
45
  "data-testid": ComboboxDataTestid.SELECT_ALL_BUTTON,
44
46
  buttonType: "text",
@@ -47,12 +49,12 @@ const HeaderList = () => {
47
49
  onMouseDown: handleOnMouseDown,
48
50
  onBlur: handleOnBlurSelectAll,
49
51
  onClick: handleClickOnSelectAll
50
- }), onSelectAll && onClearAll && (_StyledSeparator || (_StyledSeparator = /*#__PURE__*/_jsx(StyledSeparator, {
52
+ }), isSelectAllSupplied && isClearAllSupplied && (_StyledSeparator || (_StyledSeparator = /*#__PURE__*/_jsx(StyledSeparator, {
51
53
  orientation: "vertical",
52
54
  position: "center",
53
55
  type: "group-level",
54
56
  margin: "none"
55
- }))), onClearAll && /*#__PURE__*/_jsx(StyledButton, {
57
+ }))), isClearAllSupplied && /*#__PURE__*/_jsx(StyledButton, {
56
58
  disabled: multiSelectedValues.length === 0,
57
59
  tabIndex: 0,
58
60
  "data-testid": ComboboxDataTestid.CLEAR_ALL_BUTTON,
@@ -1,5 +1,5 @@
1
1
  import _jsx from '@babel/runtime/helpers/esm/jsx';
2
- import { useContext, useCallback } from 'react';
2
+ import { useContext, useMemo, useCallback } from 'react';
3
3
  import { StyledListWrapper, StyledVirtualListWrapper, StyledList } from './styled.js';
4
4
  import { ComboboxDataTestid } from '../../ComboboxDataTestids.js';
5
5
  import { ComboBoxContext } from '../../ComboBoxCTX.js';
@@ -33,14 +33,14 @@ const MenuList = () => {
33
33
  } = useContext(ComboBoxContext);
34
34
  const multiple = Array.isArray(selectedValues);
35
35
  const withHeader = !inline && multiple && options.length > 0;
36
- const {
37
- ItemRenderer
38
- } = useItemRenderer();
36
+ const ItemRenderer = useItemRenderer();
39
37
  useMenuList();
40
38
  useOnElementResize(controlsWrapperRef);
41
- const listWidth = menuMinWidth || "".concat(referenceElement === null || referenceElement === void 0 ? void 0 : referenceElement.offsetWidth);
39
+ const listWidth = useMemo(() => menuMinWidth || "".concat(referenceElement === null || referenceElement === void 0 ? void 0 : referenceElement.offsetWidth), [menuMinWidth, referenceElement]);
42
40
  const handleOnFocus = useCallback(() => {
43
- inputRef === null || inputRef === void 0 ? void 0 : inputRef.current.focus();
41
+ var _inputRef$current;
42
+
43
+ (_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 ? void 0 : _inputRef$current.focus();
44
44
  }, [inputRef]);
45
45
  return /*#__PURE__*/jsxs(StyledListWrapper, {
46
46
  tabIndex: -1,
@@ -52,11 +52,10 @@ const MenuList = () => {
52
52
  role: "listbox",
53
53
  children: [withHeader && (_HeaderList || (_HeaderList = /*#__PURE__*/_jsx(HeaderList, {}))), options.length > 0 ? /*#__PURE__*/jsx(StyledVirtualListWrapper, {
54
54
  tabIndex: -1,
55
+ inline: inline,
55
56
  maxHeight: menuMaxHeight,
56
57
  ref: listRef,
57
- style: {
58
- marginTop: withHeader && '28px'
59
- },
58
+ withHeader: withHeader,
60
59
  children: /*#__PURE__*/_jsx(StyledList, {
61
60
  tabIndex: -1,
62
61
  "aria-expanded": showPopover,
@@ -8,12 +8,16 @@ const StyledList = /*#__PURE__*/styled.ul.withConfig({
8
8
  })(["position:relative;padding:0;"]);
9
9
  const StyledVirtualListWrapper = /*#__PURE__*/styled.div.withConfig({
10
10
  componentId: "sc-1uedyf-2"
11
- })(["overflow-y:auto;max-height:", ";"], _ref => {
11
+ })(["overflow-y:auto;margin-top:", ";max-height:", ";"], _ref => {
12
12
  let {
13
- maxHeight,
14
- inline
13
+ withHeader
15
14
  } = _ref;
16
- return inline ? '' : "".concat(!maxHeight ? '400' : maxHeight, "px");
15
+ return withHeader ? '28px' : '';
16
+ }, _ref2 => {
17
+ let {
18
+ maxHeight
19
+ } = _ref2;
20
+ return !maxHeight ? '400px' : "".concat(maxHeight, "px");
17
21
  });
18
22
 
19
23
  export { StyledList, StyledListWrapper, StyledVirtualListWrapper };