@zohodesk/components 1.0.0-temp-233 → 1.0.0-temp-234

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 (77) hide show
  1. package/.cli/propValidation_report.html +1 -1
  2. package/README.md +35 -0
  3. package/assets/Appearance/dark/mode/Component_DarkMode.module.css +4 -4
  4. package/assets/Appearance/dark/themes/blue/blue_CTA_DarkModifyCategory.module.css +461 -8
  5. package/assets/Appearance/dark/themes/green/green_CTA_DarkModifyCategory.module.css +461 -8
  6. package/assets/Appearance/dark/themes/orange/orange_CTA_DarkModifyCategory.module.css +461 -8
  7. package/assets/Appearance/dark/themes/red/red_CTA_DarkModifyCategory.module.css +461 -8
  8. package/assets/Appearance/dark/themes/yellow/yellow_CTA_DarkModifyCategory.module.css +461 -8
  9. package/assets/Appearance/light/mode/Component_LightMode.module.css +6 -6
  10. package/assets/Appearance/light/themes/blue/blue_CTA_LightModifyCategory.module.css +461 -8
  11. package/assets/Appearance/light/themes/green/green_CTA_LightModifyCategory.module.css +461 -8
  12. package/assets/Appearance/light/themes/orange/orange_CTA_LightModifyCategory.module.css +461 -8
  13. package/assets/Appearance/light/themes/red/red_CTA_LightModifyCategory.module.css +461 -8
  14. package/assets/Appearance/light/themes/yellow/yellow_CTA_LightModifyCategory.module.css +461 -8
  15. package/assets/Appearance/pureDark/mode/Component_PureDarkMode.module.css +3 -3
  16. package/assets/Appearance/pureDark/themes/blue/blue_CTA_PureDarkModifyCategory.module.css +461 -8
  17. package/assets/Appearance/pureDark/themes/green/green_CTA_PureDarkModifyCategory.module.css +461 -8
  18. package/assets/Appearance/pureDark/themes/orange/orange_CTA_PureDarkModifyCategory.module.css +461 -8
  19. package/assets/Appearance/pureDark/themes/red/red_CTA_PureDarkModifyCategory.module.css +461 -8
  20. package/assets/Appearance/pureDark/themes/yellow/yellow_CTA_PureDarkModifyCategory.module.css +461 -8
  21. package/es/ListItem/ListItem.js +7 -3
  22. package/es/ListItem/ListItemWithAvatar.js +12 -6
  23. package/es/ListItem/ListItemWithCheckBox.js +12 -6
  24. package/es/ListItem/ListItemWithIcon.js +11 -5
  25. package/es/ListItem/ListItemWithRadio.js +12 -6
  26. package/es/ListItem/__tests__/ListItem.spec.js +19 -0
  27. package/es/ListItem/__tests__/ListItemWithAvatar.spec.js +19 -0
  28. package/es/ListItem/__tests__/ListItemWithCheckBox.spec.js +19 -0
  29. package/es/ListItem/__tests__/ListItemWithIcon.spec.js +17 -0
  30. package/es/ListItem/__tests__/ListItemWithRadio.spec.js +19 -0
  31. package/es/ListItem/__tests__/__snapshots__/ListItem.spec.js.snap +78 -0
  32. package/es/ListItem/__tests__/__snapshots__/ListItemWithAvatar.spec.js.snap +140 -46
  33. package/es/ListItem/__tests__/__snapshots__/ListItemWithCheckBox.spec.js.snap +251 -49
  34. package/es/ListItem/__tests__/__snapshots__/ListItemWithIcon.spec.js.snap +144 -50
  35. package/es/ListItem/__tests__/__snapshots__/ListItemWithRadio.spec.js.snap +252 -52
  36. package/es/ListItem/props/propTypes.js +15 -5
  37. package/es/MultiSelect/MultiSelect.js +44 -13
  38. package/es/MultiSelect/Suggestions.js +171 -100
  39. package/es/MultiSelect/props/defaultProps.js +2 -0
  40. package/es/MultiSelect/props/propTypes.js +4 -0
  41. package/es/Select/GroupSelect.js +4 -2
  42. package/es/Select/Select.js +47 -12
  43. package/es/Select/SelectWithAvatar.js +14 -3
  44. package/es/Select/SelectWithIcon.js +6 -2
  45. package/es/Select/props/defaultProps.js +2 -0
  46. package/es/Select/props/propTypes.js +6 -0
  47. package/es/utils/Common.js +2 -1
  48. package/es/utils/dropDownUtils.js +15 -4
  49. package/lib/ListItem/ListItem.js +8 -3
  50. package/lib/ListItem/ListItemWithAvatar.js +13 -6
  51. package/lib/ListItem/ListItemWithCheckBox.js +13 -6
  52. package/lib/ListItem/ListItemWithIcon.js +11 -5
  53. package/lib/ListItem/ListItemWithRadio.js +13 -6
  54. package/lib/ListItem/__tests__/ListItem.spec.js +23 -0
  55. package/lib/ListItem/__tests__/ListItemWithAvatar.spec.js +23 -0
  56. package/lib/ListItem/__tests__/ListItemWithCheckBox.spec.js +23 -0
  57. package/lib/ListItem/__tests__/ListItemWithIcon.spec.js +21 -0
  58. package/lib/ListItem/__tests__/ListItemWithRadio.spec.js +23 -0
  59. package/lib/ListItem/__tests__/__snapshots__/ListItem.spec.js.snap +78 -0
  60. package/lib/ListItem/__tests__/__snapshots__/ListItemWithAvatar.spec.js.snap +140 -46
  61. package/lib/ListItem/__tests__/__snapshots__/ListItemWithCheckBox.spec.js.snap +251 -49
  62. package/lib/ListItem/__tests__/__snapshots__/ListItemWithIcon.spec.js.snap +144 -50
  63. package/lib/ListItem/__tests__/__snapshots__/ListItemWithRadio.spec.js.snap +252 -52
  64. package/lib/ListItem/props/propTypes.js +15 -6
  65. package/lib/MultiSelect/MultiSelect.js +42 -12
  66. package/lib/MultiSelect/Suggestions.js +174 -104
  67. package/lib/MultiSelect/props/defaultProps.js +2 -0
  68. package/lib/MultiSelect/props/propTypes.js +4 -0
  69. package/lib/Select/GroupSelect.js +4 -3
  70. package/lib/Select/Select.js +46 -9
  71. package/lib/Select/SelectWithAvatar.js +14 -6
  72. package/lib/Select/SelectWithIcon.js +6 -3
  73. package/lib/Select/props/defaultProps.js +2 -0
  74. package/lib/Select/props/propTypes.js +6 -0
  75. package/lib/utils/Common.js +4 -2
  76. package/lib/utils/dropDownUtils.js +17 -4
  77. package/package.json +6 -6
@@ -162,6 +162,8 @@ var MultiSelectComponent = /*#__PURE__*/function (_React$Component) {
162
162
  _this.handleSearchOptions = (0, _Common.debounce)(_this.handleSearchOptions.bind(_assertThisInitialized(_this)), searchDebounceTime);
163
163
  _this.handleScroll = _this.handleScroll.bind(_assertThisInitialized(_this));
164
164
  _this.handleScrollFuncCall = (0, _Common.debounce)(_this.handleScrollFuncCall.bind(_assertThisInitialized(_this)), 500);
165
+ _this.getVirtualizerPublicMethods = _this.getVirtualizerPublicMethods.bind(_assertThisInitialized(_this));
166
+ _this.setSuggestionsVirtualizerContainerRefFunction = _this.setSuggestionsVirtualizerContainerRefFunction.bind(_assertThisInitialized(_this));
165
167
  return _this;
166
168
  }
167
169
 
@@ -227,9 +229,6 @@ var MultiSelectComponent = /*#__PURE__*/function (_React$Component) {
227
229
  }, {
228
230
  key: "componentDidUpdate",
229
231
  value: function componentDidUpdate(prevProps, prevState) {
230
- var suggestionContainer = this.suggestionContainer,
231
- selectedOptionContainer = this.selectedOptionContainer,
232
- suggestionsOrder = this.suggestionsOrder;
233
232
  var _this$state = this.state,
234
233
  hoverOption = _this$state.hoverOption,
235
234
  highLightedSelectOptions = _this$state.highLightedSelectOptions,
@@ -240,7 +239,8 @@ var MultiSelectComponent = /*#__PURE__*/function (_React$Component) {
240
239
  isPopupOpen = _this$props2.isPopupOpen,
241
240
  onDropBoxClose = _this$props2.onDropBoxClose,
242
241
  onDropBoxOpen = _this$props2.onDropBoxOpen,
243
- isSearchClearOnClose = _this$props2.isSearchClearOnClose; //handle dropbox open & close
242
+ isSearchClearOnClose = _this$props2.isSearchClearOnClose,
243
+ isVirtualizerEnabled = _this$props2.isVirtualizerEnabled; //handle dropbox open & close
244
244
 
245
245
  if (prevProps.isPopupOpen !== isPopupOpen) {
246
246
  isPopupOpen && onDropBoxOpen && this.handleFetchOptions(onDropBoxOpen, searchStr);
@@ -255,12 +255,21 @@ var MultiSelectComponent = /*#__PURE__*/function (_React$Component) {
255
255
  } //scrollTo handling
256
256
 
257
257
 
258
- var hoverId = suggestionsOrder[hoverOption] || '';
259
- var selectedSuggestion = this["suggestion_".concat(hoverId)];
260
- var lastHighLightedSelectOption = highLightedSelectOptions.slice(-1).length ? highLightedSelectOptions.slice(-1)[0] : null;
261
- var selectedOption = this["selectedOption_".concat(lastHighLightedSelectOption)];
262
- isPopupOpen && (0, _Common.scrollTo)(suggestionContainer, selectedSuggestion);
263
- selectedOptions.length && selectedOption && (0, _Common.scrollTo)(selectedOptionContainer, selectedOption); //When suggestions length less than 5, getNextOptions function call
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);
271
+ } //When suggestions length less than 5, getNextOptions function call
272
+
264
273
 
265
274
  var _this$props3 = this.props,
266
275
  isNextOptions = _this$props3.isNextOptions,
@@ -300,6 +309,7 @@ var MultiSelectComponent = /*#__PURE__*/function (_React$Component) {
300
309
  var options = props.options,
301
310
  valueField = props.valueField,
302
311
  textField = props.textField,
312
+ secondaryField = props.secondaryField,
303
313
  prefixText = props.prefixText,
304
314
  disabledOptions = props.disabledOptions,
305
315
  allowValueFallback = props.allowValueFallback,
@@ -312,6 +322,7 @@ var MultiSelectComponent = /*#__PURE__*/function (_React$Component) {
312
322
  optionType: 'default',
313
323
  disabledOptions: disabledOptions,
314
324
  allowValueFallback: allowValueFallback,
325
+ secondaryField: secondaryField,
315
326
  searchFields: searchFields
316
327
  });
317
328
  }
@@ -880,6 +891,7 @@ var MultiSelectComponent = /*#__PURE__*/function (_React$Component) {
880
891
  key: "suggestionContainerRef",
881
892
  value: function suggestionContainerRef(el) {
882
893
  this.suggestionContainer = el;
894
+ typeof this.setSuggestionsVirtualizerRef === 'function' && this.setSuggestionsVirtualizerRef(el);
883
895
  }
884
896
  }, {
885
897
  key: "suggestionItemRef",
@@ -942,6 +954,17 @@ var MultiSelectComponent = /*#__PURE__*/function (_React$Component) {
942
954
  openPopupOnly: openPopupOnly
943
955
  });
944
956
  }
957
+ }, {
958
+ key: "getVirtualizerPublicMethods",
959
+ value: function getVirtualizerPublicMethods(methods) {
960
+ this.virtualizerMethods = methods;
961
+ }
962
+ }, {
963
+ key: "setSuggestionsVirtualizerContainerRefFunction",
964
+ value: function setSuggestionsVirtualizerContainerRefFunction(refFunc) {
965
+ this.setSuggestionsVirtualizerRef = refFunc;
966
+ this.suggestionContainer && refFunc(this.suggestionContainer);
967
+ }
945
968
  }, {
946
969
  key: "getSelectionUI",
947
970
  value: function getSelectionUI() {
@@ -1119,6 +1142,8 @@ var MultiSelectComponent = /*#__PURE__*/function (_React$Component) {
1119
1142
  isLoading = _this$props15.isLoading,
1120
1143
  selectAllText = _this$props15.selectAllText,
1121
1144
  needSelectAll = _this$props15.needSelectAll,
1145
+ customProps = _this$props15.customProps,
1146
+ isVirtualizerEnabled = _this$props15.isVirtualizerEnabled,
1122
1147
  limit = _this$props15.limit;
1123
1148
  var _this$state9 = this.state,
1124
1149
  selectedOptions = _this$state9.selectedOptions,
@@ -1141,6 +1166,7 @@ var MultiSelectComponent = /*#__PURE__*/function (_React$Component) {
1141
1166
  noMoreText: i18nKeys.noMoreText || noMoreOptionsMessage
1142
1167
  });
1143
1168
  var isModel = (0, _isMobilePopover["default"])(needResponsive);
1169
+ var SuggestionsProps = customProps.SuggestionsProps;
1144
1170
  return /*#__PURE__*/_react["default"].createElement("div", {
1145
1171
  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 : ''),
1146
1172
  "data-id": "".concat(isDisabled ? "".concat(dataId, "_disabled") : isReadOnly ? "".concat(dataId, "_readOnly") : dataId),
@@ -1198,8 +1224,12 @@ var MultiSelectComponent = /*#__PURE__*/function (_React$Component) {
1198
1224
  eleRef: this.suggestionContainerRef
1199
1225
  }, isSearching ? /*#__PURE__*/_react["default"].createElement("div", {
1200
1226
  className: _MultiSelectModule["default"][palette]
1201
- }, searchText) : suggestions.length ? /*#__PURE__*/_react["default"].createElement(_Suggestions["default"], {
1227
+ }, searchText) : suggestions.length ? /*#__PURE__*/_react["default"].createElement(_Suggestions["default"], _extends({
1228
+ key: searchStr.trim(),
1202
1229
  suggestions: suggestions,
1230
+ isVirtualizerEnabled: isVirtualizerEnabled,
1231
+ getVirtualizerPublicMethods: this.getVirtualizerPublicMethods,
1232
+ setVirtualizerContainerRefFunction: this.setSuggestionsVirtualizerContainerRefFunction,
1203
1233
  getRef: this.suggestionItemRef,
1204
1234
  hoverOption: hoverOption,
1205
1235
  onClick: this.handleSelectOption,
@@ -1213,7 +1243,7 @@ var MultiSelectComponent = /*#__PURE__*/function (_React$Component) {
1213
1243
  },
1214
1244
  limit: limit,
1215
1245
  limitReachedMessage: limitReachedMessage
1216
- }) : /*#__PURE__*/_react["default"].createElement(_EmptyState["default"], {
1246
+ }, SuggestionsProps)) : /*#__PURE__*/_react["default"].createElement(_EmptyState["default"], {
1217
1247
  isLoading: isFetchingOptions,
1218
1248
  options: options,
1219
1249
  searchString: searchStr,
@@ -7,12 +7,14 @@ Object.defineProperty(exports, "__esModule", {
7
7
  });
8
8
  exports["default"] = void 0;
9
9
 
10
- var _react = _interopRequireDefault(require("react"));
10
+ var _react = _interopRequireWildcard(require("react"));
11
11
 
12
12
  var _propTypes = require("./props/propTypes");
13
13
 
14
14
  var _defaultProps = require("./props/defaultProps");
15
15
 
16
+ var _virtualizer = require("@zohodesk/virtualizer");
17
+
16
18
  var _ListItem = _interopRequireDefault(require("../ListItem/ListItem"));
17
19
 
18
20
  var _ListItemWithAvatar = _interopRequireDefault(require("../ListItem/ListItemWithAvatar"));
@@ -21,8 +23,14 @@ var _ListItemWithIcon = _interopRequireDefault(require("../ListItem/ListItemWith
21
23
 
22
24
  var _Layout = require("../Layout");
23
25
 
26
+ var _Common = require("../utils/Common");
27
+
24
28
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
25
29
 
30
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
31
+
32
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
33
+
26
34
  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); }
27
35
 
28
36
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
@@ -51,22 +59,39 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
51
59
 
52
60
  function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
53
61
 
62
+ function SuggestionsVirtualizerContainer(_ref) {
63
+ var eleRef = _ref.eleRef,
64
+ children = _ref.children,
65
+ setVirtualizerContainerRefFunction = _ref.setVirtualizerContainerRefFunction;
66
+ (0, _react.useMemo)(function () {
67
+ typeof setVirtualizerContainerRefFunction === 'function' && setVirtualizerContainerRefFunction(eleRef);
68
+ }, [eleRef, setVirtualizerContainerRefFunction]);
69
+ return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, children);
70
+ }
71
+
54
72
  var Suggestions = /*#__PURE__*/function (_React$PureComponent) {
55
73
  _inherits(Suggestions, _React$PureComponent);
56
74
 
57
75
  var _super = _createSuper(Suggestions);
58
76
 
59
- function Suggestions() {
77
+ function Suggestions(props) {
78
+ var _this;
79
+
60
80
  _classCallCheck(this, Suggestions);
61
81
 
62
- return _super.apply(this, arguments);
82
+ _this = _super.call(this, props);
83
+ _this.renderSuggestionList = _this.renderSuggestionList.bind(_assertThisInitialized(_this));
84
+ _this.renderVirtualizerSuggestionListItem = _this.renderVirtualizerSuggestionListItem.bind(_assertThisInitialized(_this));
85
+ return _this;
63
86
  }
64
87
 
65
88
  _createClass(Suggestions, [{
66
- key: "render",
67
- value: function render() {
89
+ key: "renderSuggestionList",
90
+ value: function renderSuggestionList(_ref2) {
91
+ var suggestion = _ref2.suggestion,
92
+ index = _ref2.index,
93
+ ref = _ref2.ref;
68
94
  var _this$props = this.props,
69
- suggestions = _this$props.suggestions,
70
95
  getRef = _this$props.getRef,
71
96
  hoverOption = _this$props.hoverOption,
72
97
  onClick = _this$props.onClick,
@@ -74,118 +99,69 @@ var Suggestions = /*#__PURE__*/function (_React$PureComponent) {
74
99
  needTick = _this$props.needTick,
75
100
  needBorder = _this$props.needBorder,
76
101
  _this$props$selectedO = _this$props.selectedOptions,
77
- selectedOptions = _this$props$selectedO === void 0 ? [] : _this$props$selectedO,
102
+ selectedOptions = _this$props$selectedO === void 0 ? _Common.DUMMY_ARRAY : _this$props$selectedO,
78
103
  activeId = _this$props.activeId,
79
104
  hoverId = _this$props.hoverId,
80
- dataId = _this$props.dataId,
81
105
  listItemSize = _this$props.listItemSize,
82
- className = _this$props.className,
83
106
  avatarPalette = _this$props.avatarPalette,
84
107
  palette = _this$props.palette,
85
- htmlId = _this$props.htmlId,
86
108
  a11y = _this$props.a11y,
87
109
  needMultiLineText = _this$props.needMultiLineText,
88
110
  limit = _this$props.limit,
89
111
  limitReachedMessage = _this$props.limitReachedMessage;
90
- var ariaParentRole = a11y.ariaParentRole,
91
- ariaMultiselectable = a11y.ariaMultiselectable;
112
+ var id = suggestion.id,
113
+ value = suggestion.value,
114
+ secondaryValue = suggestion.secondaryValue,
115
+ photoURL = suggestion.photoURL,
116
+ icon = suggestion.icon,
117
+ optionType = suggestion.optionType,
118
+ iconSize = suggestion.iconSize,
119
+ isDisabled = suggestion.isDisabled,
120
+ listItemProps = suggestion.listItemProps,
121
+ _suggestion$listItemC = suggestion.listItemCustomProps,
122
+ listItemCustomProps = _suggestion$listItemC === void 0 ? _Common.DUMMY_OBJECT : _suggestion$listItemC;
123
+ var isActive = activeId === id || selectedOptions.indexOf(id) >= 0;
124
+ var isHighlight = hoverOption === index || id === hoverId ? true : false;
92
125
  var selectedOptionsLength = selectedOptions.length;
93
- return /*#__PURE__*/_react["default"].createElement(_Layout.Container, {
94
- isCover: false,
95
- role: ariaParentRole,
96
- id: htmlId,
97
- tabindex: "0",
98
- "aria-multiselectable": ariaMultiselectable
99
- }, /*#__PURE__*/_react["default"].createElement(_Layout.Box, {
100
- dataId: "".concat(dataId),
101
- className: className ? className : ''
102
- }, suggestions.map(function (suggestion, index) {
103
- var id = suggestion.id,
104
- value = suggestion.value,
105
- secondaryValue = suggestion.secondaryValue,
106
- photoURL = suggestion.photoURL,
107
- icon = suggestion.icon,
108
- optionType = suggestion.optionType,
109
- iconSize = suggestion.iconSize,
110
- isDisabled = suggestion.isDisabled,
111
- listItemProps = suggestion.listItemProps,
112
- _suggestion$listItemC = suggestion.listItemCustomProps,
113
- listItemCustomProps = _suggestion$listItemC === void 0 ? {} : _suggestion$listItemC;
114
- var isActive = activeId === id || selectedOptions.indexOf(id) >= 0;
115
- var isHighlight = hoverOption === index || id === hoverId ? true : false;
116
- var isLimitReached = selectedOptionsLength >= limit && !isActive;
117
- var list_a11y = Object.assign({}, a11y, {
118
- ariaSelected: isActive,
119
- ariaLabel: value,
120
- 'data-a11y-list-active': isHighlight
121
- });
122
-
123
- var commonProps = _objectSpread({
124
- isDisabled: isDisabled ? isDisabled : isLimitReached,
125
- needMultiLineText: needMultiLineText
126
- }, listItemCustomProps);
127
-
128
- if (listItemProps) {
129
- commonProps.customProps = {
130
- ListItemProps: _objectSpread({}, listItemProps)
131
- };
132
- }
133
-
134
- if (isLimitReached) {
135
- commonProps.disableTitle = limitReachedMessage;
126
+ var isLimitReached = selectedOptionsLength >= limit && !isActive;
127
+ var list_a11y = Object.assign({}, a11y, {
128
+ ariaSelected: isActive,
129
+ ariaLabel: value,
130
+ 'data-a11y-list-active': isHighlight
131
+ });
132
+
133
+ var commonProps = _objectSpread({
134
+ isDisabled: isDisabled ? isDisabled : isLimitReached,
135
+ needMultiLineText: needMultiLineText
136
+ }, listItemCustomProps);
137
+
138
+ if (listItemProps) {
139
+ commonProps.customProps = {
140
+ ListItemProps: _objectSpread({}, listItemProps)
141
+ };
142
+ }
143
+
144
+ if (isLimitReached) {
145
+ commonProps.disableTitle = limitReachedMessage;
146
+ }
147
+
148
+ function getListItemRef(ele, index, id) {
149
+ ref && ref(ele);
150
+
151
+ if (typeof getRef === 'function') {
152
+ getRef(ele, index, id);
136
153
  }
154
+ }
137
155
 
138
- if (optionType === 'avatar') {
139
- return /*#__PURE__*/_react["default"].createElement(_ListItemWithAvatar["default"], _extends({}, commonProps, {
140
- autoHover: false,
141
- getRef: getRef,
142
- highlight: isHighlight,
143
- id: id,
144
- imgSrc: photoURL,
145
- key: "".concat(id, "avatarListItem"),
146
- name: value,
147
- onClick: onClick,
148
- onMouseEnter: onMouseEnter,
149
- value: value,
150
- title: value,
151
- needTick: needTick,
152
- needBorder: needBorder,
153
- active: isActive,
154
- size: listItemSize,
155
- avatarPalette: avatarPalette,
156
- palette: palette,
157
- a11y: list_a11y,
158
- secondaryValue: secondaryValue
159
- }));
160
- } else if (optionType === 'icon') {
161
- return /*#__PURE__*/_react["default"].createElement(_ListItemWithIcon["default"], _extends({}, commonProps, {
162
- autoHover: false,
163
- getRef: getRef,
164
- highlight: isHighlight,
165
- id: id,
166
- key: "".concat(id, "iconListItem"),
167
- onClick: onClick,
168
- onMouseEnter: onMouseEnter,
169
- value: value,
170
- title: value,
171
- iconName: icon,
172
- needTick: needTick,
173
- needBorder: needBorder,
174
- active: isActive,
175
- iconSize: iconSize,
176
- size: listItemSize,
177
- palette: palette,
178
- a11y: list_a11y,
179
- secondaryValue: secondaryValue
180
- }));
181
- }
182
-
183
- return /*#__PURE__*/_react["default"].createElement(_ListItem["default"], _extends({}, commonProps, {
156
+ if (optionType === 'avatar') {
157
+ return /*#__PURE__*/_react["default"].createElement(_ListItemWithAvatar["default"], _extends({}, commonProps, {
184
158
  autoHover: false,
185
- getRef: getRef,
159
+ getRef: getListItemRef,
186
160
  highlight: isHighlight,
187
161
  id: id,
188
- key: "".concat(id, "listItem"),
162
+ imgSrc: photoURL,
163
+ key: "".concat(id, "avatarListItem"),
164
+ name: value,
189
165
  onClick: onClick,
190
166
  onMouseEnter: onMouseEnter,
191
167
  value: value,
@@ -194,9 +170,103 @@ var Suggestions = /*#__PURE__*/function (_React$PureComponent) {
194
170
  needBorder: needBorder,
195
171
  active: isActive,
196
172
  size: listItemSize,
173
+ avatarPalette: avatarPalette,
197
174
  palette: palette,
198
- a11y: list_a11y
175
+ a11y: list_a11y,
176
+ secondaryValue: secondaryValue
199
177
  }));
178
+ } else if (optionType === 'icon') {
179
+ return /*#__PURE__*/_react["default"].createElement(_ListItemWithIcon["default"], _extends({}, commonProps, {
180
+ autoHover: false,
181
+ getRef: getListItemRef,
182
+ highlight: isHighlight,
183
+ id: id,
184
+ key: "".concat(id, "iconListItem"),
185
+ onClick: onClick,
186
+ onMouseEnter: onMouseEnter,
187
+ value: value,
188
+ title: value,
189
+ iconName: icon,
190
+ needTick: needTick,
191
+ needBorder: needBorder,
192
+ active: isActive,
193
+ iconSize: iconSize,
194
+ size: listItemSize,
195
+ palette: palette,
196
+ a11y: list_a11y,
197
+ secondaryValue: secondaryValue
198
+ }));
199
+ }
200
+
201
+ return /*#__PURE__*/_react["default"].createElement(_ListItem["default"], _extends({}, commonProps, {
202
+ autoHover: false,
203
+ getRef: getListItemRef,
204
+ highlight: isHighlight,
205
+ id: id,
206
+ key: "".concat(id, "listItem"),
207
+ onClick: onClick,
208
+ onMouseEnter: onMouseEnter,
209
+ value: value,
210
+ title: value,
211
+ needTick: needTick,
212
+ needBorder: needBorder,
213
+ active: isActive,
214
+ size: listItemSize,
215
+ palette: palette,
216
+ a11y: list_a11y
217
+ }));
218
+ }
219
+ }, {
220
+ key: "renderVirtualizerSuggestionListItem",
221
+ value: function renderVirtualizerSuggestionListItem(_ref3) {
222
+ var index = _ref3.index,
223
+ ref = _ref3.ref;
224
+ var suggestions = this.props.suggestions;
225
+ var suggestion = suggestions[index];
226
+ return this.renderSuggestionList({
227
+ suggestion: suggestion,
228
+ index: index,
229
+ ref: ref
230
+ });
231
+ }
232
+ }, {
233
+ key: "render",
234
+ value: function render() {
235
+ var _this2 = this;
236
+
237
+ var _this$props2 = this.props,
238
+ suggestions = _this$props2.suggestions,
239
+ dataId = _this$props2.dataId,
240
+ className = _this$props2.className,
241
+ isVirtualizerEnabled = _this$props2.isVirtualizerEnabled,
242
+ htmlId = _this$props2.htmlId,
243
+ a11y = _this$props2.a11y,
244
+ getVirtualizerPublicMethods = _this$props2.getVirtualizerPublicMethods,
245
+ setVirtualizerContainerRefFunction = _this$props2.setVirtualizerContainerRefFunction;
246
+ var ariaParentRole = a11y.ariaParentRole,
247
+ ariaMultiselectable = a11y.ariaMultiselectable;
248
+ return /*#__PURE__*/_react["default"].createElement(_Layout.Container, {
249
+ isCover: false,
250
+ role: ariaParentRole,
251
+ id: htmlId,
252
+ tabindex: "0",
253
+ "aria-multiselectable": ariaMultiselectable
254
+ }, /*#__PURE__*/_react["default"].createElement(_Layout.Box, {
255
+ dataId: "".concat(dataId),
256
+ className: className ? className : ''
257
+ }, isVirtualizerEnabled ? /*#__PURE__*/_react["default"].createElement(_virtualizer.Virtualizer, {
258
+ containerType: SuggestionsVirtualizerContainer,
259
+ elementRenderer: this.renderVirtualizerSuggestionListItem,
260
+ getExposedPublicMethods: getVirtualizerPublicMethods,
261
+ elementsCount: suggestions.length,
262
+ isElementsFixedHeight: false,
263
+ dataId: "".concat(dataId, "_virtualizer"),
264
+ setVirtualizerContainerRefFunction: setVirtualizerContainerRefFunction
265
+ }) : suggestions.map(function (suggestion, index) {
266
+ return _this2.renderSuggestionList({
267
+ suggestion: suggestion,
268
+ index: index
269
+ });
200
270
  })));
201
271
  }
202
272
  }]);
@@ -97,6 +97,7 @@ var MultiSelect_defaultProps = {
97
97
  autoComplete: (0, _Config.getLibraryConfig)('autoComplete'),
98
98
  dataId: 'multiSelect',
99
99
  dropBoxSize: 'small',
100
+ isVirtualizerEnabled: false,
100
101
  isAnimate: true,
101
102
  isDisabled: false,
102
103
  isPopupOpenOnEnter: false,
@@ -182,6 +183,7 @@ var SelectedOptions_defaultProps = {
182
183
  exports.SelectedOptions_defaultProps = SelectedOptions_defaultProps;
183
184
  var Suggestions_defaultProps = {
184
185
  a11y: {},
186
+ isVirtualizerEnabled: false,
185
187
  needMultiLineText: false
186
188
  };
187
189
  exports.Suggestions_defaultProps = Suggestions_defaultProps;
@@ -50,6 +50,7 @@ var MultiSelect_propTypes = {
50
50
  disableAction: _propTypes["default"].bool,
51
51
  dropBoxSize: _propTypes["default"].oneOf(['small', 'medium', 'large']),
52
52
  emptyMessage: _propTypes["default"].string.isRequired,
53
+ isVirtualizerEnabled: _propTypes["default"].bool,
53
54
  getContainerRef: _propTypes["default"].func,
54
55
  getNextOptions: _propTypes["default"].func,
55
56
  getPublicMethods: _propTypes["default"].func,
@@ -192,6 +193,9 @@ var Suggestions_propTypes = {
192
193
  avatarPalette: _propTypes["default"].string,
193
194
  className: _propTypes["default"].string,
194
195
  dataId: _propTypes["default"].string,
196
+ isVirtualizerEnabled: _propTypes["default"].bool,
197
+ setVirtualizerContainerRefFunction: _propTypes["default"].func,
198
+ getVirtualizerPublicMethods: _propTypes["default"].func,
195
199
  getRef: _propTypes["default"].func,
196
200
  hoverId: _propTypes["default"].oneOfType([_propTypes["default"].string, _propTypes["default"].number]),
197
201
  hoverOption: _propTypes["default"].number,
@@ -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,