@zohodesk/components 1.4.8 → 1.4.10-exp-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 (47) hide show
  1. package/.cli/propValidation_report.html +1 -1
  2. package/README.md +22 -0
  3. package/es/MultiSelect/AdvancedGroupMultiSelect.js +16 -8
  4. package/es/MultiSelect/AdvancedMultiSelect.js +13 -6
  5. package/es/MultiSelect/EmptyState.js +2 -1
  6. package/es/MultiSelect/MultiSelect.js +36 -15
  7. package/es/MultiSelect/MultiSelectWithAvatar.js +9 -2
  8. package/es/MultiSelect/SelectedOptions.js +4 -2
  9. package/es/MultiSelect/Suggestions.js +174 -97
  10. package/es/MultiSelect/__tests__/MultiSelect.spec.js +25 -0
  11. package/es/MultiSelect/__tests__/Suggestions.spec.js +58 -0
  12. package/es/MultiSelect/__tests__/__snapshots__/MultiSelect.spec.js.snap +253 -0
  13. package/es/MultiSelect/__tests__/__snapshots__/Suggestions.spec.js.snap +343 -0
  14. package/es/MultiSelect/constants.js +6 -0
  15. package/es/MultiSelect/props/defaultProps.js +2 -0
  16. package/es/MultiSelect/props/propTypes.js +18 -55
  17. package/es/Select/Select.js +13 -3
  18. package/es/Select/SelectWithIcon.js +1 -1
  19. package/es/Select/__tests__/Select.spec.js +16 -8
  20. package/es/Select/__tests__/__snapshots__/Select.spec.js.snap +281 -0
  21. package/es/Select/props/defaultProps.js +1 -0
  22. package/es/Select/props/propTypes.js +1 -0
  23. package/es/utils/Common.js +3 -2
  24. package/es/utils/dropDownUtils.js +28 -7
  25. package/lib/MultiSelect/AdvancedGroupMultiSelect.js +94 -83
  26. package/lib/MultiSelect/AdvancedMultiSelect.js +16 -7
  27. package/lib/MultiSelect/EmptyState.js +3 -1
  28. package/lib/MultiSelect/MultiSelect.js +39 -15
  29. package/lib/MultiSelect/MultiSelectWithAvatar.js +11 -3
  30. package/lib/MultiSelect/SelectedOptions.js +4 -2
  31. package/lib/MultiSelect/Suggestions.js +176 -100
  32. package/lib/MultiSelect/__tests__/MultiSelect.spec.js +25 -0
  33. package/lib/MultiSelect/__tests__/Suggestions.spec.js +58 -0
  34. package/lib/MultiSelect/__tests__/__snapshots__/MultiSelect.spec.js.snap +253 -0
  35. package/lib/MultiSelect/__tests__/__snapshots__/Suggestions.spec.js.snap +343 -0
  36. package/lib/MultiSelect/constants.js +13 -0
  37. package/lib/MultiSelect/props/defaultProps.js +2 -0
  38. package/lib/MultiSelect/props/propTypes.js +17 -55
  39. package/lib/Select/Select.js +13 -2
  40. package/lib/Select/SelectWithIcon.js +1 -1
  41. package/lib/Select/__tests__/Select.spec.js +165 -155
  42. package/lib/Select/__tests__/__snapshots__/Select.spec.js.snap +281 -0
  43. package/lib/Select/props/defaultProps.js +1 -0
  44. package/lib/Select/props/propTypes.js +1 -0
  45. package/lib/utils/Common.js +5 -3
  46. package/lib/utils/dropDownUtils.js +27 -4
  47. package/package.json +9 -8
package/README.md CHANGED
@@ -2,6 +2,28 @@
2
2
 
3
3
  Dot UI is a customizable React component library built to deliver a clean, accessible, and developer-friendly UI experience. It offers a growing set of reusable components designed to align with modern design systems and streamline application development across projects.
4
4
 
5
+ # 1.4.11
6
+
7
+ - **Select, MultiSelect**
8
+ - `isVirtualizerEnabled` prop supported to manage bulk amount of options rendering
9
+
10
+ - **Suggestions**
11
+ - **Virtualizer** adopted to manage bulk amount of options rendering with `isVirtualizerEnabled` prop support
12
+
13
+ # 1.4.10
14
+
15
+ - **Select, MultiSelect**
16
+ - Searching with leading spaces is not reflected the results correctly. Issue Fixed.
17
+
18
+ - **Select**
19
+ - Fixed performance issue in options formatting caused by unnecessary rendering triggers
20
+
21
+ # 1.4.9
22
+
23
+ - **MultiSelect , MultiSelectWithAvatar, AdvancedMultiSelect, AdvancedGroupMultiSelect**
24
+ - `limit` prop supported
25
+ - `limitReachedMessage` prop supported in i18nKeys
26
+
5
27
  # 1.4.8
6
28
 
7
29
  - Added UNSAFE_ prefix to deprecated lifecycle methods: componentWillMount, componentWillReceiveProps, and componentWillUpdate.
@@ -1,6 +1,7 @@
1
1
  import React from 'react';
2
2
  import { AdvancedGroupMultiSelect_propTypes } from "./props/propTypes";
3
3
  import { AdvancedGroupMultiSelect_defaultProps } from "./props/defaultProps";
4
+ import { MULTISELECT_I18N_KEYS } from "./constants";
4
5
  /**** Components ****/
5
6
 
6
7
  import Loader from '@zohodesk/svg/lib/Loader/Loader';
@@ -185,7 +186,8 @@ class AdvancedGroupMultiSelect extends React.Component {
185
186
 
186
187
  handleSelectedOptionIdChange(selectedGroupOptions, normalizedFormatOptions, normalizedSelectedOptions) {
187
188
  const {
188
- allowValueFallback
189
+ allowValueFallback,
190
+ limit
189
191
  } = this.props;
190
192
  let newSelectedOptions = selectedGroupOptions.map(option => optionIdGrouping(option.id, option.groupId));
191
193
  let selectedOptionsLength = newSelectedOptions.length;
@@ -197,7 +199,8 @@ class AdvancedGroupMultiSelect extends React.Component {
197
199
  selectedOptions: newSelectedOptions,
198
200
  normalizedFormatOptions: formatOptions,
199
201
  selectedOptionsLength,
200
- allowValueFallback
202
+ allowValueFallback,
203
+ limit
201
204
  });
202
205
  }
203
206
 
@@ -390,7 +393,8 @@ class AdvancedGroupMultiSelect extends React.Component {
390
393
  getNextOptions,
391
394
  isPopupOpen,
392
395
  isPopupOpenOnEnter,
393
- onKeyDown
396
+ onKeyDown,
397
+ limit
394
398
  } = this.props;
395
399
  let highLightedSelectOptionsLen = highLightedSelectOptions.length;
396
400
 
@@ -442,7 +446,7 @@ class AdvancedGroupMultiSelect extends React.Component {
442
446
  hoverIndex: hoverIndex + 1
443
447
  });
444
448
  }
445
- } else if (keyCode === 13) {
449
+ } else if (keyCode === 13 && selectedOptions.length < limit) {
446
450
  //enter key
447
451
  let id = suggestions[hoverIndex] || {};
448
452
  isPopupOpen && !getIsEmptyValue(id) && this.handleSelectOption(id, null, null, e);
@@ -884,13 +888,15 @@ class AdvancedGroupMultiSelect extends React.Component {
884
888
  needEffect,
885
889
  autoComplete,
886
890
  getTargetRef,
887
- isFocus
891
+ isFocus,
892
+ limit
888
893
  } = this.props;
889
894
  let {
890
- clearText = 'Clear all'
895
+ clearText = MULTISELECT_I18N_KEYS.clearText,
896
+ limitReachedMessage = MULTISELECT_I18N_KEYS.limitReachedMessage
891
897
  } = i18nKeys;
892
898
  let {
893
- clearLabel = 'Clear all'
899
+ clearLabel = MULTISELECT_I18N_KEYS.clearText
894
900
  } = a11y;
895
901
  i18nKeys = Object.assign({}, i18nKeys, {
896
902
  emptyText: i18nKeys.emptyText || emptyMessage,
@@ -1026,7 +1032,7 @@ class AdvancedGroupMultiSelect extends React.Component {
1026
1032
  }, /*#__PURE__*/React.createElement(Card, {
1027
1033
  customClass: `${style.box} ${style[`${palette}Box`]}`,
1028
1034
  onScroll: this.handleScroll
1029
- }, needSelectAll ? /*#__PURE__*/React.createElement(CardHeader, null, /*#__PURE__*/React.createElement(MultiSelectHeader, {
1035
+ }, needSelectAll && !(limit >= 0) ? /*#__PURE__*/React.createElement(CardHeader, null, /*#__PURE__*/React.createElement(MultiSelectHeader, {
1030
1036
  onSelect: this.handleSelectAll,
1031
1037
  selectAllText: selectAllText,
1032
1038
  suggestions: suggestionOptionIds,
@@ -1065,6 +1071,8 @@ class AdvancedGroupMultiSelect extends React.Component {
1065
1071
  a11y: {
1066
1072
  role: 'option'
1067
1073
  },
1074
+ limit: limit,
1075
+ limitReachedMessage: limitReachedMessage,
1068
1076
  dataId: `${dataId}_Options`
1069
1077
  }));
1070
1078
  }) : /*#__PURE__*/React.createElement(EmptyState, {
@@ -2,6 +2,7 @@
2
2
  import React from 'react';
3
3
  import { AdvancedMultiSelect_propTypes } from "./props/propTypes";
4
4
  import { AdvancedMultiSelect_defaultProps } from "./props/defaultProps";
5
+ import { MULTISELECT_I18N_KEYS } from "./constants";
5
6
  /**** Components ****/
6
7
 
7
8
  import { MultiSelectComponent } from "./MultiSelect";
@@ -177,7 +178,8 @@ export class AdvancedMultiSelectComponent extends MultiSelectComponent {
177
178
  const {
178
179
  selectedOptionsLimit,
179
180
  selectedOptionDetails,
180
- allowValueFallback
181
+ allowValueFallback,
182
+ limit
181
183
  } = props;
182
184
  showedSelectedOptionsCount = getIsEmptyValue(showedSelectedOptionsCount) ? selectedOptionsLimit : showedSelectedOptionsCount;
183
185
  const {
@@ -191,7 +193,8 @@ export class AdvancedMultiSelectComponent extends MultiSelectComponent {
191
193
  selectedOptions,
192
194
  normalizedFormatOptions: formatOptions,
193
195
  selectedOptionsLength: showedSelectedOptionsCount,
194
- allowValueFallback: allowValueFallback
196
+ allowValueFallback,
197
+ limit
195
198
  });
196
199
  }
197
200
 
@@ -385,7 +388,8 @@ export class AdvancedMultiSelectComponent extends MultiSelectComponent {
385
388
  positionsOffset,
386
389
  targetOffset,
387
390
  isRestrictScroll,
388
- isFocus
391
+ isFocus,
392
+ limit
389
393
  } = this.props;
390
394
  let {
391
395
  SuggestionsProps = {},
@@ -395,10 +399,11 @@ export class AdvancedMultiSelectComponent extends MultiSelectComponent {
395
399
  containerClass = ''
396
400
  } = customClass;
397
401
  const {
398
- clearText = 'Clear all'
402
+ clearText = MULTISELECT_I18N_KEYS.clearText,
403
+ limitReachedMessage = MULTISELECT_I18N_KEYS.limitReachedMessage
399
404
  } = i18nKeys;
400
405
  const {
401
- clearLabel = 'Clear all'
406
+ clearLabel = MULTISELECT_I18N_KEYS.clearText
402
407
  } = a11y;
403
408
  i18nKeys = Object.assign({}, i18nKeys, {
404
409
  emptyText: i18nKeys.emptyText || emptyMessage,
@@ -541,7 +546,7 @@ export class AdvancedMultiSelectComponent extends MultiSelectComponent {
541
546
  }, /*#__PURE__*/React.createElement(Card, {
542
547
  customClass: style.box,
543
548
  onScroll: this.handleScroll
544
- }, needSelectAll ? /*#__PURE__*/React.createElement(CardHeader, null, /*#__PURE__*/React.createElement(MultiSelectHeader, {
549
+ }, needSelectAll && !(limit >= 0) ? /*#__PURE__*/React.createElement(CardHeader, null, /*#__PURE__*/React.createElement(MultiSelectHeader, {
545
550
  onSelect: this.handleSelectAll,
546
551
  selectAllText: selectAllText,
547
552
  suggestions: suggestions,
@@ -563,6 +568,8 @@ export class AdvancedMultiSelectComponent extends MultiSelectComponent {
563
568
  role: 'option'
564
569
  },
565
570
  dataId: `${dataIdMultiSelectComp}_Options`,
571
+ limit: limit,
572
+ limitReachedMessage: limitReachedMessage,
566
573
  ...SuggestionsProps
567
574
  }) : /*#__PURE__*/React.createElement(EmptyState, {
568
575
  isLoading: isFetchingOptions,
@@ -2,6 +2,7 @@
2
2
  import React from 'react';
3
3
  import { EmptyState_propTypes } from "./props/propTypes";
4
4
  import { EmptyState_defaultProps } from "./props/defaultProps";
5
+ import { MULTISELECT_I18N_KEYS } from "./constants";
5
6
  /**** CSS ****/
6
7
 
7
8
  import style from "./MultiSelect.module.css";
@@ -23,7 +24,7 @@ export default class EmptyState extends React.PureComponent {
23
24
  a11y
24
25
  } = this.props;
25
26
  let {
26
- loadingText = 'Loading',
27
+ loadingText = MULTISELECT_I18N_KEYS.loadingText,
27
28
  emptyText = emptyMessage,
28
29
  noMoreText = noMoreOptionsMessage,
29
30
  searchEmptyText = searchEmptyMessage
@@ -3,6 +3,7 @@ import React from 'react';
3
3
  import { MultiSelect_propTypes } from "./props/propTypes";
4
4
  import { MultiSelect_defaultProps } from "./props/defaultProps";
5
5
  import { defaultProps as MobileHeader_defaultProps } from "./MobileHeader/props/defaultProps";
6
+ import { MULTISELECT_I18N_KEYS } from "./constants";
6
7
  /**** Components ****/
7
8
 
8
9
  import Popup from "../Popup/Popup";
@@ -80,6 +81,7 @@ export class MultiSelectComponent extends React.Component {
80
81
  this.handleSearchOptions = debounce(this.handleSearchOptions.bind(this), searchDebounceTime);
81
82
  this.handleScroll = this.handleScroll.bind(this);
82
83
  this.handleScrollFuncCall = debounce(this.handleScrollFuncCall.bind(this), 500);
84
+ this.setSuggestionsVirtualizerContainerRefFunction = this.setSuggestionsVirtualizerContainerRefFunction.bind(this);
83
85
  }
84
86
 
85
87
  componentDidMount() {
@@ -234,12 +236,14 @@ export class MultiSelectComponent extends React.Component {
234
236
 
235
237
  handleGetSelectedOptions(selectedOptions, normalizedFormatOptions, props) {
236
238
  const {
237
- allowValueFallback
239
+ allowValueFallback,
240
+ limit
238
241
  } = props;
239
242
  return this.getSelectedOptions({
240
243
  selectedOptions,
241
244
  normalizedFormatOptions,
242
- allowValueFallback
245
+ allowValueFallback,
246
+ limit
243
247
  });
244
248
  }
245
249
 
@@ -313,8 +317,10 @@ export class MultiSelectComponent extends React.Component {
313
317
  getNextOptions,
314
318
  isPopupOpen,
315
319
  isPopupOpenOnEnter,
316
- onKeyDown
320
+ onKeyDown,
321
+ limit
317
322
  } = this.props;
323
+ const allowKeyboardActions = !limit || limit && selectedOptions.length < limit;
318
324
  const highLightedSelectOptionsLen = highLightedSelectOptions.length;
319
325
 
320
326
  if (isPopupOpen && (keyCode === 38 || keyCode === 40 || keyCode === 13 || keyCode === 27 || keyCode === 9)) {
@@ -334,7 +340,7 @@ export class MultiSelectComponent extends React.Component {
334
340
 
335
341
  const suggestionsLen = suggestions.length;
336
342
 
337
- if (suggestionsLen && isPopupOpen && keyCode === 38) {
343
+ if (suggestionsLen && isPopupOpen && keyCode === 38 && allowKeyboardActions) {
338
344
  //up arrow
339
345
 
340
346
  /*if (hoverOption === 0) { //disable first to last option higlight
@@ -345,7 +351,7 @@ export class MultiSelectComponent extends React.Component {
345
351
  hoverOption: hoverOption - 1
346
352
  });
347
353
  }
348
- } else if (suggestionsLen && isPopupOpen && keyCode === 40) {
354
+ } else if (suggestionsLen && isPopupOpen && keyCode === 40 && allowKeyboardActions) {
349
355
  //down arrow
350
356
 
351
357
  /*else if (hoverOption === suggestionsLen - 1 || hoverOption === null) {
@@ -362,8 +368,8 @@ export class MultiSelectComponent extends React.Component {
362
368
  hoverOption: hoverOption + 1
363
369
  });
364
370
  }
365
- } else if (keyCode === 13) {
366
- //enter key
371
+ } else if (keyCode === 13 && allowKeyboardActions) {
372
+ //enter ke
367
373
  const selectedOption = suggestions[hoverOption] || {};
368
374
  const {
369
375
  id
@@ -727,14 +733,16 @@ export class MultiSelectComponent extends React.Component {
727
733
  needToCloseOnSelect,
728
734
  togglePopup,
729
735
  selectedOptions: propSelectedOptions,
730
- disabledOptions = dummyArray
736
+ disabledOptions = dummyArray,
737
+ limit
731
738
  } = this.props;
732
739
  const {
733
740
  newSelectedOptions
734
741
  } = filterSelectedOptions({
735
742
  selectedOptions,
736
743
  propSelectedOptions,
737
- disabledOptions
744
+ disabledOptions,
745
+ limit
738
746
  });
739
747
  const selectedOptionsLen = newSelectedOptions.length;
740
748
  const allSelectedOptionsDetails = [];
@@ -791,6 +799,7 @@ export class MultiSelectComponent extends React.Component {
791
799
 
792
800
  suggestionContainerRef(el) {
793
801
  this.suggestionContainer = el;
802
+ typeof this.setSuggestionsVirtualizerRef === 'function' && this.setSuggestionsVirtualizerRef(el);
794
803
  }
795
804
 
796
805
  suggestionItemRef(el, index, id) {
@@ -855,6 +864,11 @@ export class MultiSelectComponent extends React.Component {
855
864
  });
856
865
  }
857
866
 
867
+ setSuggestionsVirtualizerContainerRefFunction(refFunc) {
868
+ this.setSuggestionsVirtualizerRef = refFunc;
869
+ this.suggestionContainer && refFunc(this.suggestionContainer);
870
+ }
871
+
858
872
  getSelectionUI() {
859
873
  let isResponsive = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
860
874
  let {
@@ -894,10 +908,10 @@ export class MultiSelectComponent extends React.Component {
894
908
  searchStr
895
909
  } = this.state;
896
910
  const {
897
- clearText = 'Clear all'
911
+ clearText = MULTISELECT_I18N_KEYS.clearText
898
912
  } = i18nKeys;
899
913
  const {
900
- clearLabel = 'Clear all',
914
+ clearLabel = MULTISELECT_I18N_KEYS.clearLabel,
901
915
  ariaLabelledby
902
916
  } = a11y;
903
917
  let {
@@ -1034,7 +1048,9 @@ export class MultiSelectComponent extends React.Component {
1034
1048
  boxSize,
1035
1049
  isLoading,
1036
1050
  selectAllText,
1037
- needSelectAll
1051
+ needSelectAll,
1052
+ isVirtualizerEnabled,
1053
+ limit
1038
1054
  } = this.props;
1039
1055
  const {
1040
1056
  selectedOptions,
@@ -1045,7 +1061,8 @@ export class MultiSelectComponent extends React.Component {
1045
1061
  selectedOptionIds
1046
1062
  } = this.state;
1047
1063
  const {
1048
- searchText = 'Searching...'
1064
+ searchText = MULTISELECT_I18N_KEYS.searchText,
1065
+ limitReachedMessage = MULTISELECT_I18N_KEYS.limitReachedMessage
1049
1066
  } = i18nKeys;
1050
1067
  const suggestions = this.handleFilterSuggestions();
1051
1068
  const setAriaId = this.getNextAriaId();
@@ -1099,7 +1116,7 @@ export class MultiSelectComponent extends React.Component {
1099
1116
  onClick: this.handlePopupClose
1100
1117
  }, /*#__PURE__*/React.createElement("div", {
1101
1118
  className: style.effect
1102
- }, this.getSelectionUI(true))) : null, needSelectAll ? /*#__PURE__*/React.createElement(CardHeader, null, /*#__PURE__*/React.createElement(MultiSelectHeader, {
1119
+ }, this.getSelectionUI(true))) : null, needSelectAll && !(limit >= 0) ? /*#__PURE__*/React.createElement(CardHeader, null, /*#__PURE__*/React.createElement(MultiSelectHeader, {
1103
1120
  onSelect: this.handleSelectAll,
1104
1121
  selectAllText: selectAllText,
1105
1122
  suggestions: suggestions,
@@ -1115,6 +1132,8 @@ export class MultiSelectComponent extends React.Component {
1115
1132
  className: style[palette]
1116
1133
  }, searchText) : suggestions.length ? /*#__PURE__*/React.createElement(Suggestions, {
1117
1134
  suggestions: suggestions,
1135
+ isVirtualizerEnabled: isVirtualizerEnabled,
1136
+ setVirtualizerContainerRefFunction: this.setSuggestionsVirtualizerContainerRefFunction,
1118
1137
  getRef: this.suggestionItemRef,
1119
1138
  hoverOption: hoverOption,
1120
1139
  onClick: this.handleSelectOption,
@@ -1125,7 +1144,9 @@ export class MultiSelectComponent extends React.Component {
1125
1144
  selectedOptions: selectedOptionIds,
1126
1145
  a11y: {
1127
1146
  role: 'option'
1128
- }
1147
+ },
1148
+ limit: limit,
1149
+ limitReachedMessage: limitReachedMessage
1129
1150
  }) : /*#__PURE__*/React.createElement(EmptyState, {
1130
1151
  isLoading: isFetchingOptions,
1131
1152
  options: options,
@@ -3,6 +3,7 @@ import React from 'react';
3
3
  import { MultiSelectWithAvatar_propTypes } from "./props/propTypes";
4
4
  import { MultiSelectWithAvatar_defaultProps } from "./props/defaultProps";
5
5
  import { defaultProps as MobileHeader_defaultProps } from "./MobileHeader/props/defaultProps";
6
+ import { MULTISELECT_I18N_KEYS } from "./constants";
6
7
  /**** Components ****/
7
8
 
8
9
  import { MultiSelectComponent } from "./MultiSelect";
@@ -93,11 +94,15 @@ class MultiSelectWithAvatarComponent extends MultiSelectComponent {
93
94
  needEffect,
94
95
  isLoading,
95
96
  keepSelectedOptions,
96
- customProps
97
+ customProps,
98
+ limit
97
99
  } = this.props;
98
100
  let {
99
101
  SuggestionsProps = {}
100
102
  } = customProps;
103
+ let {
104
+ limitReachedMessage = MULTISELECT_I18N_KEYS.limitReachedMessage
105
+ } = i18nKeys;
101
106
  i18nKeys = Object.assign({}, MobileHeader_defaultProps.i18nKeys, i18nKeys, {
102
107
  emptyText: i18nKeys.emptyText || emptyMessage,
103
108
  searchEmptyText: i18nKeys.searchEmptyText || searchEmptyMessage,
@@ -158,7 +163,7 @@ class MultiSelectWithAvatarComponent extends MultiSelectComponent {
158
163
  onClick: this.handlePopupClose
159
164
  }, /*#__PURE__*/React.createElement("div", {
160
165
  className: style.effect
161
- }, this.getSelectionUI(true)))) : null, needSelectAll ? /*#__PURE__*/React.createElement(CardHeader, null, /*#__PURE__*/React.createElement(MultiSelectHeader, {
166
+ }, this.getSelectionUI(true)))) : null, needSelectAll && !(limit >= 0) ? /*#__PURE__*/React.createElement(CardHeader, null, /*#__PURE__*/React.createElement(MultiSelectHeader, {
162
167
  onSelect: this.handleSelectAll,
163
168
  selectAllText: selectAllText,
164
169
  suggestions: suggestions,
@@ -184,6 +189,8 @@ class MultiSelectWithAvatarComponent extends MultiSelectComponent {
184
189
  a11y: {
185
190
  role: 'option'
186
191
  },
192
+ limit: limit,
193
+ limitReachedMessage: limitReachedMessage,
187
194
  ...SuggestionsProps
188
195
  }) : /*#__PURE__*/React.createElement(EmptyState, {
189
196
  isLoading: isFetchingOptions,
@@ -22,10 +22,12 @@ export default class SelectedOptions extends React.PureComponent {
22
22
  onSelect,
23
23
  size,
24
24
  palette,
25
- dataId
25
+ dataId,
26
+ limit
26
27
  } = this.props;
27
28
  const isDarkPalette = palette === 'dark' ? 'dark' : 'danger';
28
- return /*#__PURE__*/React.createElement(React.Fragment, null, selectedOptions.map(option => {
29
+ const selectedData = limit && limit > 0 ? selectedOptions.slice(0, limit) : selectedOptions;
30
+ return /*#__PURE__*/React.createElement(React.Fragment, null, selectedData.map(option => {
29
31
  const {
30
32
  id,
31
33
  value,