@zohodesk/components 1.4.16 → 1.4.18

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 (78) hide show
  1. package/README.md +35 -2
  2. package/es/Card/__tests__/Card.spec.js +48 -0
  3. package/es/Card/__tests__/CardContent.spec.js +61 -0
  4. package/es/Card/__tests__/CardHeader.spec.js +33 -0
  5. package/es/Card/__tests__/__snapshots__/Card.spec.js.snap +125 -0
  6. package/es/Card/__tests__/__snapshots__/CardContent.spec.js.snap +177 -0
  7. package/es/Card/__tests__/__snapshots__/CardHeader.spec.js.snap +51 -0
  8. package/es/ListItem/ListItem.js +10 -3
  9. package/es/ListItem/ListItemWithAvatar.js +15 -6
  10. package/es/ListItem/ListItemWithCheckBox.js +13 -6
  11. package/es/ListItem/ListItemWithIcon.js +14 -5
  12. package/es/ListItem/ListItemWithRadio.js +13 -6
  13. package/es/ListItem/__tests__/ListItem.spec.js +19 -0
  14. package/es/ListItem/__tests__/ListItemWithAvatar.spec.js +19 -0
  15. package/es/ListItem/__tests__/ListItemWithCheckBox.spec.js +19 -0
  16. package/es/ListItem/__tests__/ListItemWithIcon.spec.js +17 -0
  17. package/es/ListItem/__tests__/ListItemWithRadio.spec.js +19 -0
  18. package/es/ListItem/__tests__/__snapshots__/ListItem.spec.js.snap +78 -0
  19. package/es/ListItem/__tests__/__snapshots__/ListItemWithAvatar.spec.js.snap +140 -46
  20. package/es/ListItem/__tests__/__snapshots__/ListItemWithCheckBox.spec.js.snap +251 -49
  21. package/es/ListItem/__tests__/__snapshots__/ListItemWithIcon.spec.js.snap +144 -50
  22. package/es/ListItem/__tests__/__snapshots__/ListItemWithRadio.spec.js.snap +252 -52
  23. package/es/ListItem/props/propTypes.js +15 -5
  24. package/es/MultiSelect/MultiSelect.js +55 -23
  25. package/es/MultiSelect/Suggestions.js +2 -1
  26. package/es/MultiSelect/__tests__/__snapshots__/MultiSelectHeader.spec.js.snap +6 -6
  27. package/es/MultiSelect/props/propTypes.js +2 -3
  28. package/es/Select/GroupSelect.js +4 -2
  29. package/es/Select/Select.js +50 -22
  30. package/es/Select/SelectWithAvatar.js +17 -4
  31. package/es/Select/SelectWithIcon.js +15 -5
  32. package/es/Select/props/defaultProps.js +3 -0
  33. package/es/Select/props/propTypes.js +6 -0
  34. package/es/Typography/__tests__/Typography.spec.js +225 -0
  35. package/es/Typography/__tests__/__snapshots__/Typography.spec.js.snap +1226 -0
  36. package/es/utils/dropDownUtils.js +13 -4
  37. package/es/v1/Switch/__tests__/Switch.spec.js +41 -6
  38. package/es/v1/Switch/__tests__/__snapshots__/Switch.spec.js.snap +176 -5
  39. package/es/v1/Switch/css/Switch_v1.module.css +7 -1
  40. package/lib/Card/__tests__/Card.spec.js +54 -6
  41. package/lib/Card/__tests__/CardContent.spec.js +68 -0
  42. package/lib/Card/__tests__/CardHeader.spec.js +40 -0
  43. package/lib/Card/__tests__/__snapshots__/Card.spec.js.snap +125 -0
  44. package/lib/Card/__tests__/__snapshots__/CardContent.spec.js.snap +177 -0
  45. package/lib/Card/__tests__/__snapshots__/CardHeader.spec.js.snap +51 -0
  46. package/lib/ListItem/ListItem.js +10 -3
  47. package/lib/ListItem/ListItemWithAvatar.js +15 -6
  48. package/lib/ListItem/ListItemWithCheckBox.js +15 -6
  49. package/lib/ListItem/ListItemWithIcon.js +13 -5
  50. package/lib/ListItem/ListItemWithRadio.js +15 -6
  51. package/lib/ListItem/__tests__/ListItem.spec.js +23 -0
  52. package/lib/ListItem/__tests__/ListItemWithAvatar.spec.js +23 -0
  53. package/lib/ListItem/__tests__/ListItemWithCheckBox.spec.js +23 -0
  54. package/lib/ListItem/__tests__/ListItemWithIcon.spec.js +21 -0
  55. package/lib/ListItem/__tests__/ListItemWithRadio.spec.js +23 -0
  56. package/lib/ListItem/__tests__/__snapshots__/ListItem.spec.js.snap +78 -0
  57. package/lib/ListItem/__tests__/__snapshots__/ListItemWithAvatar.spec.js.snap +140 -46
  58. package/lib/ListItem/__tests__/__snapshots__/ListItemWithCheckBox.spec.js.snap +251 -49
  59. package/lib/ListItem/__tests__/__snapshots__/ListItemWithIcon.spec.js.snap +144 -50
  60. package/lib/ListItem/__tests__/__snapshots__/ListItemWithRadio.spec.js.snap +252 -52
  61. package/lib/ListItem/props/propTypes.js +15 -6
  62. package/lib/MultiSelect/MultiSelect.js +50 -24
  63. package/lib/MultiSelect/Suggestions.js +2 -1
  64. package/lib/MultiSelect/__tests__/__snapshots__/MultiSelectHeader.spec.js.snap +6 -6
  65. package/lib/MultiSelect/props/propTypes.js +3 -4
  66. package/lib/Select/GroupSelect.js +4 -3
  67. package/lib/Select/Select.js +45 -20
  68. package/lib/Select/SelectWithAvatar.js +17 -7
  69. package/lib/Select/SelectWithIcon.js +15 -5
  70. package/lib/Select/props/defaultProps.js +3 -1
  71. package/lib/Select/props/propTypes.js +6 -0
  72. package/lib/Typography/__tests__/Typography.spec.js +232 -0
  73. package/lib/Typography/__tests__/__snapshots__/Typography.spec.js.snap +1226 -0
  74. package/lib/utils/dropDownUtils.js +17 -4
  75. package/lib/v1/Switch/__tests__/Switch.spec.js +41 -6
  76. package/lib/v1/Switch/__tests__/__snapshots__/Switch.spec.js.snap +176 -5
  77. package/lib/v1/Switch/css/Switch_v1.module.css +7 -1
  78. package/package.json +5 -5
@@ -163,6 +163,7 @@ var MultiSelectComponent = /*#__PURE__*/function (_React$Component) {
163
163
  _this.handleScroll = _this.handleScroll.bind(_assertThisInitialized(_this));
164
164
  _this.handleScrollFuncCall = (0, _Common.debounce)(_this.handleScrollFuncCall.bind(_assertThisInitialized(_this)), 500);
165
165
  _this.getVirtualizerPublicMethods = _this.getVirtualizerPublicMethods.bind(_assertThisInitialized(_this));
166
+ _this.scrollToHighlightedIndex = _this.scrollToHighlightedIndex.bind(_assertThisInitialized(_this));
166
167
  _this.setSuggestionsVirtualizerContainerRefFunction = _this.setSuggestionsVirtualizerContainerRefFunction.bind(_assertThisInitialized(_this));
167
168
  return _this;
168
169
  }
@@ -227,20 +228,52 @@ var MultiSelectComponent = /*#__PURE__*/function (_React$Component) {
227
228
  }
228
229
  }
229
230
  }, {
230
- key: "componentDidUpdate",
231
- value: function componentDidUpdate(prevProps, prevState) {
231
+ key: "scrollToHighlightedIndex",
232
+ value: function scrollToHighlightedIndex() {
233
+ var suggestionContainer = this.suggestionContainer,
234
+ selectedOptionContainer = this.selectedOptionContainer,
235
+ suggestionsOrder = this.suggestionsOrder;
236
+
237
+ if (!suggestionContainer) {
238
+ return;
239
+ }
240
+
232
241
  var _this$state = this.state,
233
242
  hoverOption = _this$state.hoverOption,
234
243
  highLightedSelectOptions = _this$state.highLightedSelectOptions,
235
- selectedOptions = _this$state.selectedOptions,
236
- searchStr = _this$state.searchStr;
244
+ selectedOptions = _this$state.selectedOptions;
245
+ var isVirtualizerEnabled = this.props.isVirtualizerEnabled;
246
+ var hoverId = suggestionsOrder[hoverOption] || '';
247
+ var lastHighLightedSelectOption = highLightedSelectOptions.slice(-1).length ? highLightedSelectOptions.slice(-1)[0] : null;
248
+ var selectedOption = this["selectedOption_".concat(lastHighLightedSelectOption)];
249
+ selectedOptions.length && selectedOption && (0, _Common.scrollTo)(selectedOptionContainer, selectedOption);
250
+ var selectedSuggestion = this["suggestion_".concat(hoverId)];
251
+
252
+ if (selectedSuggestion) {
253
+ (0, _Common.scrollTo)(suggestionContainer, selectedSuggestion);
254
+ } else {
255
+ // Hack: Virtualizer not having options order properly all the time, so scrollToIndex method used here.
256
+ if (isVirtualizerEnabled && !!this.virtualizerMethods) {
257
+ this.virtualizerMethods.scrollToIndex(hoverOption, 'auto', {
258
+ speed: 0,
259
+ duration: 0,
260
+ onComplete: function onComplete() {
261
+ (0, _Common.scrollTo)(suggestionContainer, selectedSuggestion);
262
+ }
263
+ });
264
+ }
265
+ }
266
+ }
267
+ }, {
268
+ key: "componentDidUpdate",
269
+ value: function componentDidUpdate(prevProps, prevState) {
270
+ var searchStr = this.state.searchStr;
237
271
  var _this$props2 = this.props,
238
272
  needLocalSearch = _this$props2.needLocalSearch,
239
273
  isPopupOpen = _this$props2.isPopupOpen,
240
274
  onDropBoxClose = _this$props2.onDropBoxClose,
241
275
  onDropBoxOpen = _this$props2.onDropBoxOpen,
242
- isSearchClearOnClose = _this$props2.isSearchClearOnClose,
243
- isVirtualizerEnabled = _this$props2.isVirtualizerEnabled; //handle dropbox open & close
276
+ isSearchClearOnClose = _this$props2.isSearchClearOnClose; //handle dropbox open & close
244
277
 
245
278
  if (prevProps.isPopupOpen !== isPopupOpen) {
246
279
  isPopupOpen && onDropBoxOpen && this.handleFetchOptions(onDropBoxOpen, searchStr);
@@ -252,22 +285,10 @@ var MultiSelectComponent = /*#__PURE__*/function (_React$Component) {
252
285
  isSearchClearOnClose && searchStr && this.handleSearch('');
253
286
  onDropBoxClose && onDropBoxClose();
254
287
  }
255
- } //scrollTo handling
256
-
288
+ }
257
289
 
258
- if (isVirtualizerEnabled && !!this.virtualizerMethods) {
259
- var position = prevState.hoverOption > hoverOption ? 'top' : 'bottom';
260
- this.virtualizerMethods.getElementVisiblePercentage(hoverOption) < 50 && this.virtualizerMethods.scrollToIndex(hoverOption, position);
261
- } else {
262
- var suggestionContainer = this.suggestionContainer,
263
- selectedOptionContainer = this.selectedOptionContainer,
264
- suggestionsOrder = this.suggestionsOrder;
265
- var hoverId = suggestionsOrder[hoverOption] || '';
266
- var selectedSuggestion = this["suggestion_".concat(hoverId)];
267
- var lastHighLightedSelectOption = highLightedSelectOptions.slice(-1).length ? highLightedSelectOptions.slice(-1)[0] : null;
268
- var selectedOption = this["selectedOption_".concat(lastHighLightedSelectOption)];
269
- isPopupOpen && (0, _Common.scrollTo)(suggestionContainer, selectedSuggestion);
270
- selectedOptions.length && selectedOption && (0, _Common.scrollTo)(selectedOptionContainer, selectedOption);
290
+ if (isPopupOpen) {
291
+ this.scrollToHighlightedIndex();
271
292
  } //When suggestions length less than 5, getNextOptions function call
272
293
 
273
294
 
@@ -309,6 +330,7 @@ var MultiSelectComponent = /*#__PURE__*/function (_React$Component) {
309
330
  var options = props.options,
310
331
  valueField = props.valueField,
311
332
  textField = props.textField,
333
+ secondaryField = props.secondaryField,
312
334
  prefixText = props.prefixText,
313
335
  disabledOptions = props.disabledOptions,
314
336
  allowValueFallback = props.allowValueFallback,
@@ -321,6 +343,7 @@ var MultiSelectComponent = /*#__PURE__*/function (_React$Component) {
321
343
  optionType: 'default',
322
344
  disabledOptions: disabledOptions,
323
345
  allowValueFallback: allowValueFallback,
346
+ secondaryField: secondaryField,
324
347
  searchFields: searchFields
325
348
  });
326
349
  }
@@ -1140,6 +1163,7 @@ var MultiSelectComponent = /*#__PURE__*/function (_React$Component) {
1140
1163
  isLoading = _this$props15.isLoading,
1141
1164
  selectAllText = _this$props15.selectAllText,
1142
1165
  needSelectAll = _this$props15.needSelectAll,
1166
+ customProps = _this$props15.customProps,
1143
1167
  isVirtualizerEnabled = _this$props15.isVirtualizerEnabled,
1144
1168
  limit = _this$props15.limit;
1145
1169
  var _this$state9 = this.state,
@@ -1163,6 +1187,7 @@ var MultiSelectComponent = /*#__PURE__*/function (_React$Component) {
1163
1187
  noMoreText: i18nKeys.noMoreText || noMoreOptionsMessage
1164
1188
  });
1165
1189
  var isModel = (0, _isMobilePopover["default"])(needResponsive);
1190
+ var SuggestionsProps = customProps.SuggestionsProps;
1166
1191
  return /*#__PURE__*/_react["default"].createElement("div", {
1167
1192
  className: "".concat(_MultiSelectModule["default"].wrapper, " ").concat(isDisabled ? _MultiSelectModule["default"].disabled : '', " ").concat(isReadOnly ? _MultiSelectModule["default"].readOnly : '', " ").concat(disableAction ? (0, _CssProvider["default"])('isBlock') : '', " ").concat(borderColor === 'transparent' ? _MultiSelectModule["default"].transparentContainer : '', " ").concat(needEffect && !(isDisabled || isReadOnly) ? _MultiSelectModule["default"].effect : ''),
1168
1193
  "data-id": "".concat(isDisabled ? "".concat(dataId, "_disabled") : isReadOnly ? "".concat(dataId, "_readOnly") : dataId),
@@ -1175,7 +1200,8 @@ var MultiSelectComponent = /*#__PURE__*/function (_React$Component) {
1175
1200
  boxPosition: position || "".concat(defaultDropBoxPosition),
1176
1201
  getRef: getContainerRef,
1177
1202
  isActive: isPopupReady,
1178
- isAnimate: isAnimate,
1203
+ isAnimate: isAnimate && !isVirtualizerEnabled // Note: Virtualizer gets element height at mount itself which causes issue with options height
1204
+ ,
1179
1205
  isArrow: false,
1180
1206
  onClick: removeClose,
1181
1207
  needResponsive: needResponsive,
@@ -1220,7 +1246,7 @@ var MultiSelectComponent = /*#__PURE__*/function (_React$Component) {
1220
1246
  eleRef: this.suggestionContainerRef
1221
1247
  }, isSearching ? /*#__PURE__*/_react["default"].createElement("div", {
1222
1248
  className: _MultiSelectModule["default"][palette]
1223
- }, searchText) : suggestions.length ? /*#__PURE__*/_react["default"].createElement(_Suggestions["default"], {
1249
+ }, searchText) : suggestions.length ? /*#__PURE__*/_react["default"].createElement(_Suggestions["default"], _extends({
1224
1250
  key: searchStr.trim(),
1225
1251
  suggestions: suggestions,
1226
1252
  isVirtualizerEnabled: isVirtualizerEnabled,
@@ -1239,7 +1265,7 @@ var MultiSelectComponent = /*#__PURE__*/function (_React$Component) {
1239
1265
  },
1240
1266
  limit: limit,
1241
1267
  limitReachedMessage: limitReachedMessage
1242
- }) : /*#__PURE__*/_react["default"].createElement(_EmptyState["default"], {
1268
+ }, SuggestionsProps)) : /*#__PURE__*/_react["default"].createElement(_EmptyState["default"], {
1243
1269
  isLoading: isFetchingOptions,
1244
1270
  options: options,
1245
1271
  searchString: searchStr,
@@ -213,7 +213,8 @@ var Suggestions = /*#__PURE__*/function (_React$PureComponent) {
213
213
  active: isActive,
214
214
  size: listItemSize,
215
215
  palette: palette,
216
- a11y: list_a11y
216
+ a11y: list_a11y,
217
+ secondaryValue: secondaryValue
217
218
  }));
218
219
  }
219
220
  }, {
@@ -35,19 +35,19 @@ exports[`MultiSelectHeader rendering the basic value 1`] = `
35
35
  </div>
36
36
  </div>
37
37
  <div
38
- class="grow basis shrinkOn"
38
+ class="leftBox grow basis shrinkOff"
39
39
  data-id="boxComponent"
40
40
  data-selector-id="box"
41
41
  data-test-id="boxComponent"
42
42
  >
43
43
  <div
44
- class="flex cover coldir"
45
- data-id="containerComponent"
46
- data-selector-id="container"
47
- data-test-id="containerComponent"
44
+ class="titleBox shrinkOff"
45
+ data-id="boxComponent"
46
+ data-selector-id="box"
47
+ data-test-id="boxComponent"
48
48
  >
49
49
  <div
50
- class="value shrinkOff"
50
+ class="value basisAuto shrinkOn"
51
51
  data-id="MultiSelectHeader_selectAll_Text"
52
52
  data-selector-id="box"
53
53
  data-test-id="MultiSelectHeader_selectAll_Text"
@@ -139,7 +139,8 @@ var MultiSelect_propTypes = {
139
139
  allowValueFallback: _propTypes["default"].bool,
140
140
  renderCustomClearComponent: _propTypes["default"].func,
141
141
  renderCustomToggleIndicator: _propTypes["default"].oneOfType([_propTypes["default"].func, _propTypes["default"].node]),
142
- limit: _propTypes["default"].number
142
+ limit: _propTypes["default"].number,
143
+ secondaryField: _propTypes["default"].string
143
144
  };
144
145
  exports.MultiSelect_propTypes = MultiSelect_propTypes;
145
146
  var MultiSelectHeader_propTypes = {
@@ -160,8 +161,7 @@ var MultiSelectWithAvatar_propTypes = _objectSpread({
160
161
  customProps: _propTypes["default"].shape({
161
162
  SuggestionsProps: _propTypes["default"].object,
162
163
  DropBoxProps: _propTypes["default"].object
163
- }),
164
- secondaryField: _propTypes["default"].string
164
+ })
165
165
  }, MultiSelect_propTypes);
166
166
 
167
167
  exports.MultiSelectWithAvatar_propTypes = MultiSelectWithAvatar_propTypes;
@@ -309,7 +309,6 @@ var AdvancedMultiSelect_propTypes = _objectSpread(_objectSpread({}, MultiSelect_
309
309
  prefixText: _propTypes["default"].oneOfType([_propTypes["default"].string, _propTypes["default"].number]),
310
310
  //For grouping multiSelect
311
311
  optionType: _propTypes["default"].oneOf(['default', 'avatar', 'icon']),
312
- secondaryField: _propTypes["default"].string,
313
312
  dataIdClearIcon: _propTypes["default"].string,
314
313
  dataIdLoading: _propTypes["default"].string,
315
314
  dataIdMultiSelectComp: _propTypes["default"].string,
@@ -699,7 +699,8 @@ var GroupSelectComponent = /*#__PURE__*/function (_PureComponent) {
699
699
  var _customProps$TextBoxI = customProps.TextBoxIconProps,
700
700
  TextBoxIconProps = _customProps$TextBoxI === void 0 ? {} : _customProps$TextBoxI,
701
701
  _customProps$TextBoxP = customProps.TextBoxProps,
702
- TextBoxProps = _customProps$TextBoxP === void 0 ? {} : _customProps$TextBoxP;
702
+ TextBoxProps = _customProps$TextBoxP === void 0 ? {} : _customProps$TextBoxP,
703
+ SuggestionsProps = customProps.SuggestionsProps;
703
704
  return /*#__PURE__*/_react["default"].createElement("div", {
704
705
  className: "".concat(_SelectModule["default"].container, " ").concat(_SelectModule["default"]["box_".concat(size)], " ").concat(isReadOnly ? _SelectModule["default"].readonly : '', " ").concat(borderColor === 'transparent' ? _SelectModule["default"].transparentContainer : '', " ").concat(iconOnHover && (isReadOnly || isDisabled) ? _SelectModule["default"].iconOnHoverReadonly : iconOnHover && !(isReadOnly || isDisabled) ? _SelectModule["default"].iconOnHoverStyle : ''),
705
706
  "data-id": dataIdSlctComp,
@@ -846,7 +847,7 @@ var GroupSelectComponent = /*#__PURE__*/function (_PureComponent) {
846
847
  a11y: {
847
848
  role: 'heading'
848
849
  }
849
- })), /*#__PURE__*/_react["default"].createElement(_Suggestions["default"], {
850
+ })), /*#__PURE__*/_react["default"].createElement(_Suggestions["default"], _extends({
850
851
  activeId: selectedId,
851
852
  suggestions: options,
852
853
  getRef: _this7.suggestionItemRef,
@@ -862,7 +863,7 @@ var GroupSelectComponent = /*#__PURE__*/function (_PureComponent) {
862
863
  role: 'option'
863
864
  },
864
865
  dataId: "".concat(dataId, "_Options")
865
- }));
866
+ }, SuggestionsProps)));
866
867
  }) : /*#__PURE__*/_react["default"].createElement(_EmptyState["default"], {
867
868
  options: revampedGroups,
868
869
  searchString: searchStr,
@@ -169,6 +169,7 @@ var SelectComponent = /*#__PURE__*/function (_Component) {
169
169
  _this.handleExposePopupHandlers = _this.handleExposePopupHandlers.bind(_assertThisInitialized(_this));
170
170
  _this.handleGetAddNewOptionText = _this.handleGetAddNewOptionText.bind(_assertThisInitialized(_this));
171
171
  _this.getVirtualizerPublicMethods = _this.getVirtualizerPublicMethods.bind(_assertThisInitialized(_this));
172
+ _this.scrollToHighlightedIndex = _this.scrollToHighlightedIndex.bind(_assertThisInitialized(_this));
172
173
  _this.setSuggestionsVirtualizerContainerRefFunction = _this.setSuggestionsVirtualizerContainerRefFunction.bind(_assertThisInitialized(_this));
173
174
  _this.valueInputTypeString = '';
174
175
  _this.valueInputSearchString = '';
@@ -234,13 +235,42 @@ var SelectComponent = /*#__PURE__*/function (_Component) {
234
235
  selectedValueIndex: hoverIndex
235
236
  });
236
237
  }
238
+ }, {
239
+ key: "scrollToHighlightedIndex",
240
+ value: function scrollToHighlightedIndex() {
241
+ var suggestionContainer = this.suggestionContainer,
242
+ optionsOrder = this.optionsOrder;
243
+
244
+ if (!suggestionContainer) {
245
+ return;
246
+ }
247
+
248
+ var hoverIndex = this.state.hoverIndex;
249
+ var isVirtualizerEnabled = this.props.isVirtualizerEnabled;
250
+ var hoverId = (0, _Common.getIsEmptyValue)(optionsOrder[hoverIndex]) ? '' : optionsOrder[hoverIndex];
251
+ var selSuggestion = this["suggestion_".concat(hoverId)];
252
+
253
+ if (selSuggestion) {
254
+ (0, _Common.scrollTo)(suggestionContainer, selSuggestion);
255
+ } else {
256
+ // Hack: Virtualizer not having options order properly all the time, so scrollToIndex method used here.
257
+ if (isVirtualizerEnabled && !!this.virtualizerMethods) {
258
+ this.virtualizerMethods.scrollToIndex(hoverIndex, 'auto', {
259
+ speed: 0,
260
+ duration: 0,
261
+ onComplete: function onComplete() {
262
+ (0, _Common.scrollTo)(suggestionContainer, selSuggestion);
263
+ }
264
+ });
265
+ }
266
+ }
267
+ }
237
268
  }, {
238
269
  key: "componentDidUpdate",
239
- value: function componentDidUpdate(prevProps, prevState) {
270
+ value: function componentDidUpdate(prevProps) {
240
271
  var _this2 = this;
241
272
 
242
273
  var _this$state = this.state,
243
- hoverIndex = _this$state.hoverIndex,
244
274
  searchStr = _this$state.searchStr,
245
275
  selectedValueIndex = _this$state.selectedValueIndex;
246
276
  var _this$props = this.props,
@@ -250,28 +280,15 @@ var SelectComponent = /*#__PURE__*/function (_Component) {
250
280
  needSearch = _this$props.needSearch,
251
281
  onSearch = _this$props.onSearch,
252
282
  isPopupOpen = _this$props.isPopupOpen,
253
- isSearchClearOnClose = _this$props.isSearchClearOnClose,
254
- isVirtualizerEnabled = _this$props.isVirtualizerEnabled;
283
+ isSearchClearOnClose = _this$props.isSearchClearOnClose;
255
284
 
256
- if (isVirtualizerEnabled && !!this.virtualizerMethods) {
257
- var position = prevState.hoverIndex > hoverIndex ? 'top' : 'bottom';
258
- this.virtualizerMethods.getElementVisiblePercentage(hoverIndex) < 50 && this.virtualizerMethods.scrollToIndex(hoverIndex, position);
259
- } else {
260
- var suggestionContainer = this.suggestionContainer,
261
- optionsOrder = this.optionsOrder;
262
- var hoverId = (0, _Common.getIsEmptyValue)(optionsOrder[hoverIndex]) ? '' : optionsOrder[hoverIndex];
263
- var selSuggestion = this["suggestion_".concat(hoverId)];
264
- isPopupOpen && (0, _Common.scrollTo)(suggestionContainer, selSuggestion);
285
+ if (isPopupOpen) {
286
+ this.scrollToHighlightedIndex();
265
287
  }
266
288
 
267
289
  if (prevProps.isPopupOpen !== isPopupOpen) {
268
290
  if (isPopupOpen) {
269
291
  onDropBoxOpen && this.handleFetchOptions(onDropBoxOpen, searchStr);
270
-
271
- if (isVirtualizerEnabled && !!this.virtualizerMethods) {
272
- this.virtualizerMethods.getElementVisiblePercentage(hoverIndex) < 50 && this.virtualizerMethods.scrollToIndex(hoverIndex);
273
- }
274
-
275
292
  setTimeout(function () {
276
293
  _this2.searchInput && _this2.searchInput.focus({
277
294
  preventScroll: true
@@ -323,13 +340,17 @@ var SelectComponent = /*#__PURE__*/function (_Component) {
323
340
  textField = props.textField,
324
341
  allowValueFallback = props.allowValueFallback,
325
342
  _props$customProps = props.customProps,
326
- customProps = _props$customProps === void 0 ? _dropDownUtils.dummyObj : _props$customProps;
343
+ customProps = _props$customProps === void 0 ? _dropDownUtils.dummyObj : _props$customProps,
344
+ searchFields = props.searchFields,
345
+ secondaryField = props.secondaryField;
327
346
  var _customProps$listItem = customProps.listItemProps,
328
347
  listItemProps = _customProps$listItem === void 0 ? _dropDownUtils.dummyObj : _customProps$listItem;
329
348
  return this.formatOptions({
330
349
  options: options,
331
350
  valueField: valueField,
332
351
  textField: textField,
352
+ secondaryField: secondaryField,
353
+ searchFields: searchFields,
333
354
  listItemProps: listItemProps,
334
355
  allowValueFallback: allowValueFallback
335
356
  });
@@ -488,6 +509,7 @@ var SelectComponent = /*#__PURE__*/function (_Component) {
488
509
  value: function handleFilterSuggestions() {
489
510
  var _this$props5 = this.props,
490
511
  needLocalSearch = _this$props5.needLocalSearch,
512
+ searchFields = _this$props5.searchFields,
491
513
  _this$props5$excludeO = _this$props5.excludeOptions,
492
514
  excludeOptions = _this$props5$excludeO === void 0 ? dummyArray : _this$props5$excludeO;
493
515
  var _this$state3 = this.state,
@@ -505,6 +527,7 @@ var SelectComponent = /*#__PURE__*/function (_Component) {
505
527
  options: options,
506
528
  selectedOptions: excludeOptions,
507
529
  searchStr: searchStr,
530
+ searchFields: searchFields,
508
531
  needSearch: needLocalSearch
509
532
  }),
510
533
  suggestions = _this$getFilterSugges.suggestions,
@@ -764,6 +787,7 @@ var SelectComponent = /*#__PURE__*/function (_Component) {
764
787
  getTargetRef = _this$props11.getTargetRef,
765
788
  getContainerRef = _this$props11.getContainerRef,
766
789
  removeClose = _this$props11.removeClose,
790
+ isAnimate = _this$props11.isAnimate,
767
791
  isPopupOpen = _this$props11.isPopupOpen,
768
792
  isPopupReady = _this$props11.isPopupReady,
769
793
  animationStyle = _this$props11.animationStyle,
@@ -953,7 +977,8 @@ var SelectComponent = /*#__PURE__*/function (_Component) {
953
977
  boxPosition: position || "".concat(defaultDropBoxPosition),
954
978
  getRef: getContainerRef,
955
979
  isActive: isPopupReady,
956
- isAnimate: true,
980
+ isAnimate: isAnimate && !isVirtualizerEnabled // Note: Virtualizer gets element height at mount itself which causes issue with options height
981
+ ,
957
982
  isArrow: false,
958
983
  onClick: removeClose,
959
984
  needResponsive: needResponsive,
@@ -51,6 +51,8 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
51
51
 
52
52
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
53
53
 
54
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
55
+
54
56
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
55
57
 
56
58
  function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
@@ -99,13 +101,17 @@ var SelectWithAvatarComponent = /*#__PURE__*/function (_SelectComponent) {
99
101
  valueField = props.valueField,
100
102
  textField = props.textField,
101
103
  imageField = props.imageField,
102
- allowValueFallback = props.allowValueFallback;
104
+ secondaryField = props.secondaryField,
105
+ allowValueFallback = props.allowValueFallback,
106
+ searchFields = props.searchFields;
103
107
  return this.formatOptions({
104
108
  options: options,
105
109
  valueField: valueField,
106
110
  textField: textField,
107
111
  imageField: imageField,
112
+ secondaryField: secondaryField,
108
113
  optionType: 'avatar',
114
+ searchFields: searchFields,
109
115
  allowValueFallback: allowValueFallback
110
116
  });
111
117
  }
@@ -215,6 +221,7 @@ var SelectWithAvatarComponent = /*#__PURE__*/function (_SelectComponent) {
215
221
  needEffect = _this$props.needEffect,
216
222
  isLoading = _this$props.isLoading,
217
223
  dataSelectorId = _this$props.dataSelectorId,
224
+ customProps = _this$props.customProps,
218
225
  getTargetRef = _this$props.getTargetRef;
219
226
  i18nKeys = Object.assign({}, i18nKeys, {
220
227
  emptyText: i18nKeys.emptyText || emptyMessage,
@@ -236,6 +243,9 @@ var SelectWithAvatarComponent = /*#__PURE__*/function (_SelectComponent) {
236
243
 
237
244
  var setAriaId = this.getNextAriaId();
238
245
  var ariaErrorId = this.getNextAriaId();
246
+ var TextBoxProps = customProps.TextBoxProps,
247
+ DropdownSearchTextBoxProps = customProps.DropdownSearchTextBoxProps,
248
+ SuggestionsProps = customProps.SuggestionsProps;
239
249
  return /*#__PURE__*/_react["default"].createElement("div", {
240
250
  className: "".concat(_MultiSelectModule["default"].wrapper, " ").concat(isDisabled ? _MultiSelectModule["default"].disabled : '', " ").concat(isReadOnly ? _MultiSelectModule["default"].readOnly : '', " ").concat(needEffect && !(isDisabled || isReadOnly) ? _MultiSelectModule["default"].effect : '', " ").concat(className ? className : ''),
241
251
  "data-id": "".concat(isDisabled ? "".concat(dataId, "_disabled") : isReadOnly ? "".concat(dataId, "_readOnly") : dataId),
@@ -267,7 +277,7 @@ var SelectWithAvatarComponent = /*#__PURE__*/function (_SelectComponent) {
267
277
  flexible: true,
268
278
  className: _MultiSelectModule["default"].textBox,
269
279
  dataId: "".concat(dataId, "_textBox")
270
- }, /*#__PURE__*/_react["default"].createElement(_TextBox["default"], {
280
+ }, /*#__PURE__*/_react["default"].createElement(_TextBox["default"], _extends({
271
281
  a11y: {
272
282
  ariaActivedescendant: selectedId,
273
283
  role: 'combobox',
@@ -296,7 +306,7 @@ var SelectWithAvatarComponent = /*#__PURE__*/function (_SelectComponent) {
296
306
  borderColor: borderColor,
297
307
  htmlId: htmlId,
298
308
  autoComplete: false
299
- }))), !isReadOnly && !isDisabled && isPopupOpen ? /*#__PURE__*/_react["default"].createElement(_CustomResponsive.ResponsiveReceiver, {
309
+ }, TextBoxProps)))), !isReadOnly && !isDisabled && isPopupOpen ? /*#__PURE__*/_react["default"].createElement(_CustomResponsive.ResponsiveReceiver, {
300
310
  query: this.responsiveFunc,
301
311
  responsiveId: "Helmet"
302
312
  }, function (_ref4) {
@@ -327,7 +337,7 @@ var SelectWithAvatarComponent = /*#__PURE__*/function (_SelectComponent) {
327
337
  onScroll: _this2.handleScroll
328
338
  }, needSearch ? /*#__PURE__*/_react["default"].createElement(_Card.CardHeader, null, /*#__PURE__*/_react["default"].createElement("div", {
329
339
  className: "".concat(_SelectModule["default"].search, " ").concat(_SelectModule["default"][size])
330
- }, /*#__PURE__*/_react["default"].createElement(_TextBoxIcon["default"], {
340
+ }, /*#__PURE__*/_react["default"].createElement(_TextBoxIcon["default"], _extends({
331
341
  inputRef: _this2.searchInputRef,
332
342
  maxLength: maxLength,
333
343
  onChange: _this2.handleSearch,
@@ -343,7 +353,7 @@ var SelectWithAvatarComponent = /*#__PURE__*/function (_SelectComponent) {
343
353
  ariaDescribedby: ariaErrorId
344
354
  },
345
355
  autoComplete: false
346
- }))) : null, /*#__PURE__*/_react["default"].createElement(_Card.CardContent, {
356
+ }, DropdownSearchTextBoxProps)))) : null, /*#__PURE__*/_react["default"].createElement(_Card.CardContent, {
347
357
  shrink: true,
348
358
  customClass: !tabletMode && dropBoxSize ? _MultiSelectModule["default"][dropBoxSize] : '',
349
359
  eleRef: _this2.suggestionContainerRef
@@ -354,7 +364,7 @@ var SelectWithAvatarComponent = /*#__PURE__*/function (_SelectComponent) {
354
364
  a11y: {
355
365
  role: 'heading'
356
366
  }
357
- })) : null, suggestions.length ? /*#__PURE__*/_react["default"].createElement(_Suggestions["default"], {
367
+ })) : null, suggestions.length ? /*#__PURE__*/_react["default"].createElement(_Suggestions["default"], _extends({
358
368
  dataId: "".concat(dataId, "_Options"),
359
369
  activeId: selectedId,
360
370
  suggestions: suggestions,
@@ -371,7 +381,7 @@ var SelectWithAvatarComponent = /*#__PURE__*/function (_SelectComponent) {
371
381
  ariaParentRole: 'listbox',
372
382
  role: 'option'
373
383
  }
374
- }) : /*#__PURE__*/_react["default"].createElement(_EmptyState["default"], {
384
+ }, SuggestionsProps)) : /*#__PURE__*/_react["default"].createElement(_EmptyState["default"], {
375
385
  isLoading: isFetchingOptions,
376
386
  options: options,
377
387
  searchString: searchStr,
@@ -37,6 +37,8 @@ var _Loader = _interopRequireDefault(require("@zohodesk/svg/lib/Loader/Loader"))
37
37
 
38
38
  var _Common = require("../utils/Common.js");
39
39
 
40
+ var _dropDownUtils = require("../utils/dropDownUtils.js");
41
+
40
42
  var _SelectModule = _interopRequireDefault(require("./Select.module.css"));
41
43
 
42
44
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
@@ -257,11 +259,16 @@ var SelectWithIcon = /*#__PURE__*/function (_Component) {
257
259
  var datas = [];
258
260
  var _this$props3 = this.props,
259
261
  options = _this$props3.options,
260
- valueKey = _this$props3.valueKey;
262
+ valueKey = _this$props3.valueKey,
263
+ searchFields = _this$props3.searchFields;
261
264
 
262
265
  if (options.length) {
266
+ if (!searchFields.includes(valueKey)) {
267
+ searchFields.push(valueKey);
268
+ }
269
+
263
270
  datas = options.filter(function (obj) {
264
- return obj[valueKey].toLowerCase().includes(searchValue.toLowerCase().trim());
271
+ return (0, _dropDownUtils.isObjectContainsSearchString)(searchFields, (0, _Common.getSearchString)(searchValue), obj);
265
272
  });
266
273
  }
267
274
 
@@ -401,6 +408,7 @@ var SelectWithIcon = /*#__PURE__*/function (_Component) {
401
408
  targetOffset = _this$props7.targetOffset,
402
409
  isRestrictScroll = _this$props7.isRestrictScroll,
403
410
  valueKey = _this$props7.valueKey,
411
+ secondaryValueKey = _this$props7.secondaryValueKey,
404
412
  idKey = _this$props7.idKey,
405
413
  needListBorder = _this$props7.needListBorder,
406
414
  needTick = _this$props7.needTick,
@@ -440,7 +448,8 @@ var SelectWithIcon = /*#__PURE__*/function (_Component) {
440
448
  _customProps$Dropdown = customProps.DropdownSearchTextBoxProps,
441
449
  DropdownSearchTextBoxProps = _customProps$Dropdown === void 0 ? {} : _customProps$Dropdown,
442
450
  _customProps$TextBoxI = customProps.TextBoxIconProps,
443
- TextBoxIconProps = _customProps$TextBoxI === void 0 ? {} : _customProps$TextBoxI;
451
+ TextBoxIconProps = _customProps$TextBoxI === void 0 ? {} : _customProps$TextBoxI,
452
+ ListItemProps = customProps.ListItemProps;
444
453
  return /*#__PURE__*/_react["default"].createElement("div", {
445
454
  className: "".concat(_SelectModule["default"].container, " ").concat(_SelectModule["default"]["box_".concat(size)], " ").concat(isReadOnly ? _SelectModule["default"].readonly : '', " ").concat(borderColor === 'transparent' ? _SelectModule["default"].transparentContainer : ''),
446
455
  "data-title": isDisabled ? title : null,
@@ -573,9 +582,10 @@ var SelectWithIcon = /*#__PURE__*/function (_Component) {
573
582
  var iconName = options.iconName,
574
583
  iconSize = options.iconSize,
575
584
  iconColor = options.iconColor;
576
- return /*#__PURE__*/_react["default"].createElement(_ListItemWithIcon["default"], {
585
+ return /*#__PURE__*/_react["default"].createElement(_ListItemWithIcon["default"], _extends({
577
586
  key: options[idKey],
578
587
  value: options[valueKey],
588
+ secondaryValue: options[secondaryValueKey],
579
589
  size: "medium",
580
590
  onClick: _this5.handleChange,
581
591
  id: options[idKey],
@@ -597,7 +607,7 @@ var SelectWithIcon = /*#__PURE__*/function (_Component) {
597
607
  ariaSelected: selectedId === options[idKey],
598
608
  ariaLabel: options[valueKey]
599
609
  }
600
- });
610
+ }, ListItemProps));
601
611
  })) : /*#__PURE__*/_react["default"].createElement(_EmptyState["default"], {
602
612
  isLoading: isFetchingOptions,
603
613
  options: options,
@@ -40,6 +40,7 @@ var Select_defaultProps = {
40
40
  boxSize: 'default',
41
41
  needListBorder: false,
42
42
  needCloseOnSelect: true,
43
+ isAnimate: true,
43
44
  isParentBased: true,
44
45
  isSearchClearOnClose: true,
45
46
  i18nKeys: {},
@@ -112,6 +113,7 @@ var SelectWithAvatar_defaultProps = {
112
113
  isAbsolutePositioningNeeded: true,
113
114
  isRestrictScroll: false,
114
115
  i18nKeys: {},
116
+ customProps: {},
115
117
  needEffect: true,
116
118
  isLoading: false
117
119
  };
@@ -125,5 +127,5 @@ var SelectWithIcon_defaultProps = (_SelectWithIcon_defau = {
125
127
  needListBorder: false,
126
128
  needSearch: false,
127
129
  boxSize: 'default'
128
- }, _defineProperty(_SelectWithIcon_defau, "needListBorder", false), _defineProperty(_SelectWithIcon_defau, "needCloseOnSelect", true), _defineProperty(_SelectWithIcon_defau, "borderColor", 'default'), _defineProperty(_SelectWithIcon_defau, "needTick", true), _defineProperty(_SelectWithIcon_defau, "searchBoxSize", 'small'), _defineProperty(_SelectWithIcon_defau, "size", 'medium'), _defineProperty(_SelectWithIcon_defau, "textBoxSize", 'medium'), _defineProperty(_SelectWithIcon_defau, "textBoxVariant", 'default'), _defineProperty(_SelectWithIcon_defau, "dataId", 'selectWithIcon'), _defineProperty(_SelectWithIcon_defau, "dataSelectorId", 'selectWithIcon'), _defineProperty(_SelectWithIcon_defau, "dropBoxSize", 'small'), _defineProperty(_SelectWithIcon_defau, "needIcon", true), _defineProperty(_SelectWithIcon_defau, "iconSize", '14'), _defineProperty(_SelectWithIcon_defau, "i18nKeys", {}), _defineProperty(_SelectWithIcon_defau, "isLoading", false), _defineProperty(_SelectWithIcon_defau, "isAbsolutePositioningNeeded", true), _defineProperty(_SelectWithIcon_defau, "isRestrictScroll", false), _defineProperty(_SelectWithIcon_defau, "customProps", {}), _SelectWithIcon_defau);
130
+ }, _defineProperty(_SelectWithIcon_defau, "needListBorder", false), _defineProperty(_SelectWithIcon_defau, "needCloseOnSelect", true), _defineProperty(_SelectWithIcon_defau, "borderColor", 'default'), _defineProperty(_SelectWithIcon_defau, "needTick", true), _defineProperty(_SelectWithIcon_defau, "searchBoxSize", 'small'), _defineProperty(_SelectWithIcon_defau, "size", 'medium'), _defineProperty(_SelectWithIcon_defau, "searchFields", []), _defineProperty(_SelectWithIcon_defau, "textBoxSize", 'medium'), _defineProperty(_SelectWithIcon_defau, "textBoxVariant", 'default'), _defineProperty(_SelectWithIcon_defau, "dataId", 'selectWithIcon'), _defineProperty(_SelectWithIcon_defau, "dataSelectorId", 'selectWithIcon'), _defineProperty(_SelectWithIcon_defau, "dropBoxSize", 'small'), _defineProperty(_SelectWithIcon_defau, "needIcon", true), _defineProperty(_SelectWithIcon_defau, "iconSize", '14'), _defineProperty(_SelectWithIcon_defau, "i18nKeys", {}), _defineProperty(_SelectWithIcon_defau, "isLoading", false), _defineProperty(_SelectWithIcon_defau, "isAbsolutePositioningNeeded", true), _defineProperty(_SelectWithIcon_defau, "isRestrictScroll", false), _defineProperty(_SelectWithIcon_defau, "customProps", {}), _SelectWithIcon_defau);
129
131
  exports.SelectWithIcon_defaultProps = SelectWithIcon_defaultProps;
@@ -44,6 +44,7 @@ var Select_propTypes = {
44
44
  noMoreText: _propTypes["default"].string,
45
45
  searchEmptyText: _propTypes["default"].string
46
46
  }),
47
+ isAnimate: _propTypes["default"].bool,
47
48
  isDefaultSelectValue: _propTypes["default"].bool,
48
49
  isDisabled: _propTypes["default"].bool,
49
50
  isNextOptions: _propTypes["default"].bool,
@@ -80,6 +81,8 @@ var Select_propTypes = {
80
81
  searchBoxSize: _propTypes["default"].string,
81
82
  searchDebounceTime: _propTypes["default"].number,
82
83
  searchEmptyMessage: _propTypes["default"].string,
84
+ searchFields: _propTypes["default"].arrayOf(_propTypes["default"].string),
85
+ secondaryField: _propTypes["default"].string,
83
86
  selectedValue: _propTypes["default"].oneOfType([_propTypes["default"].oneOfType([_propTypes["default"].string, _propTypes["default"].number]), _propTypes["default"].shape({
84
87
  id: _propTypes["default"].oneOfType([_propTypes["default"].string, _propTypes["default"].number]),
85
88
  text: _propTypes["default"].oneOfType([_propTypes["default"].string, _propTypes["default"].number])
@@ -303,6 +306,7 @@ var SelectWithIcon_propTypes = {
303
306
  removeClose: _propTypes["default"].func,
304
307
  searchBoxPlaceHolder: _propTypes["default"].string,
305
308
  searchEmptyMessage: _propTypes["default"].string,
309
+ secondaryValueKey: _propTypes["default"].string,
306
310
  selectedId: _propTypes["default"].oneOfType([_propTypes["default"].string, _propTypes["default"].number]),
307
311
  selectedValue: _propTypes["default"].string,
308
312
  size: _propTypes["default"].oneOf(['small', 'medium']),
@@ -317,6 +321,7 @@ var SelectWithIcon_propTypes = {
317
321
  className: _propTypes["default"].string,
318
322
  needBorder: _propTypes["default"].bool,
319
323
  searchBoxSize: _propTypes["default"].string,
324
+ searchFields: _propTypes["default"].arrayOf(_propTypes["default"].string),
320
325
  needResponsive: _propTypes["default"].bool,
321
326
  boxSize: _propTypes["default"].string,
322
327
  emptyMessage: _propTypes["default"].string,
@@ -327,6 +332,7 @@ var SelectWithIcon_propTypes = {
327
332
  customProps: _propTypes["default"].shape({
328
333
  TextBoxProps: _propTypes["default"].object,
329
334
  DropdownSearchTextBoxProps: _propTypes["default"].object,
335
+ SuggestionsProps: _propTypes["default"].object,
330
336
  TextBoxIconProps: _propTypes["default"].object
331
337
  })
332
338
  };