@zohodesk/components 1.4.10 → 1.4.11-exp.1

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 (55) hide show
  1. package/.cli/propValidation_report.html +1 -1
  2. package/README.md +10 -0
  3. package/es/AppContainer/AppContainer.js +1 -0
  4. package/es/AppContainer/AppContainer.module.css +3 -2
  5. package/es/Button/css/Button.module.css +13 -4
  6. package/es/DateTime/DateTime.module.css +12 -9
  7. package/es/DateTime/YearView.module.css +1 -1
  8. package/es/Heading/Heading.module.css +1 -1
  9. package/es/Label/Label.module.css +8 -8
  10. package/es/MultiSelect/MultiSelect.js +36 -12
  11. package/es/MultiSelect/MultiSelect.module.css +1 -1
  12. package/es/MultiSelect/Suggestions.js +171 -100
  13. package/es/MultiSelect/props/defaultProps.js +2 -0
  14. package/es/MultiSelect/props/propTypes.js +4 -0
  15. package/es/Select/Select.js +38 -9
  16. package/es/Select/props/defaultProps.js +1 -0
  17. package/es/Select/props/propTypes.js +1 -0
  18. package/es/Tab/Tabs.module.css +1 -1
  19. package/es/TextBox/TextBox.module.css +4 -4
  20. package/es/Textarea/Textarea.module.css +1 -1
  21. package/es/Tooltip/Tooltip.module.css +1 -1
  22. package/es/Typography/css/Typography.module.css +4 -4
  23. package/es/common/basic.module.css +39 -6
  24. package/es/common/basicReset.module.css +2 -2
  25. package/es/common/common.module.css +5 -5
  26. package/es/utils/Common.js +2 -1
  27. package/es/v1/Tab/v1Tabs.module.css +1 -1
  28. package/es/v1/Typography/css/v1_Typography.module.css +4 -4
  29. package/lib/AppContainer/AppContainer.js +2 -0
  30. package/lib/AppContainer/AppContainer.module.css +3 -2
  31. package/lib/Button/css/Button.module.css +13 -4
  32. package/lib/DateTime/DateTime.module.css +12 -9
  33. package/lib/DateTime/YearView.module.css +1 -1
  34. package/lib/Heading/Heading.module.css +1 -1
  35. package/lib/Label/Label.module.css +8 -8
  36. package/lib/MultiSelect/MultiSelect.js +36 -10
  37. package/lib/MultiSelect/MultiSelect.module.css +1 -1
  38. package/lib/MultiSelect/Suggestions.js +174 -104
  39. package/lib/MultiSelect/props/defaultProps.js +2 -0
  40. package/lib/MultiSelect/props/propTypes.js +4 -0
  41. package/lib/Select/Select.js +38 -7
  42. package/lib/Select/props/defaultProps.js +1 -0
  43. package/lib/Select/props/propTypes.js +1 -0
  44. package/lib/Tab/Tabs.module.css +1 -1
  45. package/lib/TextBox/TextBox.module.css +4 -4
  46. package/lib/Textarea/Textarea.module.css +1 -1
  47. package/lib/Tooltip/Tooltip.module.css +1 -1
  48. package/lib/Typography/css/Typography.module.css +4 -4
  49. package/lib/common/basic.module.css +39 -6
  50. package/lib/common/basicReset.module.css +2 -2
  51. package/lib/common/common.module.css +5 -5
  52. package/lib/utils/Common.js +4 -2
  53. package/lib/v1/Tab/v1Tabs.module.css +1 -1
  54. package/lib/v1/Typography/css/v1_Typography.module.css +4 -4
  55. package/package.json +3 -3
package/README.md CHANGED
@@ -2,6 +2,16 @@
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
+ - `@zohodesk/virtualizer` version updated from **1.0.3** to **1.0.13**
8
+
9
+ - **Select, MultiSelect**
10
+ - `isVirtualizerEnabled` prop supported to manage bulk amount of options rendering
11
+
12
+ - **Suggestions**
13
+ - **Virtualizer** adopted to manage bulk amount of options rendering with `isVirtualizerEnabled` prop support
14
+
5
15
  # 1.4.10
6
16
 
7
17
  - **Select, MultiSelect**
@@ -9,6 +9,7 @@ import '@zohodesk/variables/assets/dotVariables.module.css';
9
9
  import '@zohodesk/variables/assets/sizeVariables.module.css';
10
10
  import '@zohodesk/variables/assets/fontsizeVariables.module.css';
11
11
  import '@zohodesk/variables/es/fontFamilyVariables.module.css';
12
+ import '@zohodesk/variables/es/fontWeightVariables.module.css';
12
13
  import '@zohodesk/variables/assets/transitionVariables.module.css';
13
14
  import '@zohodesk/variables/assets/no_transitionVariables.module.css';
14
15
  import "../common/a11y.module.css";
@@ -8,8 +8,9 @@
8
8
  -moz-box-sizing: border-box;
9
9
  -ms-box-sizing: border-box;
10
10
  }
11
- .container {
12
- font-family: var(--zd_regular);
11
+ .container, .container button, .container input, .container textarea ,.container select {
12
+ /* font-family: var(--zd_regular); */
13
+ font-family: var(--zd-font-family, var(--zd_fallback_font, ZDLato));
13
14
  }
14
15
  .tooltip {
15
16
  height: 0 ;
@@ -5,7 +5,7 @@
5
5
  --button_cursor: pointer;
6
6
  --button_font_size: var(--zd_font_size13);
7
7
  --button_text_color: var(--zdt_button_default_text);
8
- --button_font_family: var(--zd_regular);
8
+ --button_font_weight: var(--zd-fw-normal);
9
9
  --button_text_transform: capitalize;
10
10
  --button_bg_color: var(--zdt_button_default_bg);
11
11
  --button_border_radius: 4px;
@@ -49,7 +49,7 @@
49
49
  position: relative;
50
50
  font-size: var(--button_font_size);
51
51
  color: var(--button_text_color);
52
- font-family: var(--button_font_family);
52
+ font-weight: var(--button_font_weight);
53
53
  text-transform: var(--button_text_transform);
54
54
  min-width: var(--button_min_width);
55
55
  height: var(--button_height);
@@ -63,7 +63,7 @@
63
63
  }
64
64
 
65
65
  .bold {
66
- --button_font_family: var(--zd_semibold);
66
+ --button_font_weight: var(--zd-fw-semibold);
67
67
  composes: ftsmooth from '../../common/common.module.css';
68
68
  }
69
69
 
@@ -569,7 +569,7 @@
569
569
  }
570
570
 
571
571
  .loader {
572
- color: var(--dot_mirror)
572
+ color: var(--dot_mirror);
573
573
  }
574
574
 
575
575
  [dir=ltr] .strike {
@@ -579,34 +579,43 @@
579
579
  [dir=rtl] .strike {
580
580
  background-image: repeating-linear-gradient(-120deg, var(--button_strike_color) 0 1px, transparent 1px 8px);
581
581
  }
582
+
582
583
  .primaryStrike {
583
584
  --button_strike_color: var(--zdt_button_primary_strike);
584
585
  }
586
+
585
587
  .primaryfilledStrike {
586
588
  --button_strike_color: var(--zdt_button_primaryFilled_strike);
587
589
  --button_border_color: var(--zdt_button_primaryfill_bg);
588
590
  }
591
+
589
592
  .dangerStrike {
590
593
  --button_strike_color: var(--zdt_button_danger_strike);
591
594
  }
595
+
592
596
  .dangerfilledStrike {
593
597
  --button_strike_color: var(--zdt_button_dangerFilled_strike);
594
598
  --button_border_color: var(--zdt_button_dangerfill_bg);
595
599
  }
600
+
596
601
  .secondaryStrike {
597
602
  --button_strike_color: var(--zdt_button_secondary_border);
598
603
  }
604
+
599
605
  .secondaryfilledStrike {
600
606
  --button_strike_color: var(--zdt_button_secondaryFilled_strike);
601
607
  --button_border_color: var(--zdt_button_secondaryfill_bg);
602
608
  }
609
+
603
610
  .tertiaryfilledStrike {
604
611
  --button_strike_color: var(--zdt_button_tertiaryFilled_strike);
605
612
  --button_border_color: var(--zdt_button_tertiaryfill_bg);
606
613
  }
614
+
607
615
  .successStrike {
608
616
  --button_strike_color: var(--zdt_button_success_strike);
609
617
  }
618
+
610
619
  .successfilledStrike {
611
620
  --button_strike_color: var(--zdt_button_successFilled_strike);
612
621
  --button_border_color: var(--zdt_button_successfill_bg);
@@ -1,5 +1,5 @@
1
1
  .semibold {
2
- font-family: var(--zd_semibold);
2
+ font-weight: var(--zd-fw-semibold);
3
3
  }
4
4
 
5
5
  [dir=ltr] .boxPadding {
@@ -29,7 +29,7 @@
29
29
  }
30
30
 
31
31
  .datesStr {
32
- font-family: var(--zd_regular);
32
+ font-weight: var(--zd-fw-normal);
33
33
  }
34
34
 
35
35
  .grid {
@@ -122,7 +122,8 @@
122
122
  color: var(--zdt_datetime_invalid_text);
123
123
  }
124
124
 
125
- .invalidDate.holiday,.inActiveDate.holiday:hover {
125
+ .invalidDate.holiday,
126
+ .inActiveDate.holiday:hover {
126
127
  color: var(--zdt_datetime_invaliddate_text);
127
128
  }
128
129
 
@@ -147,15 +148,17 @@
147
148
  background-color: var(--zdt_datetime_selected_bg);
148
149
  border-radius: 50%;
149
150
  }
150
- .inActiveDate{
151
- color: var(--zdt_datetime_invalid_text);
152
- cursor: no-drop;
151
+
152
+ .inActiveDate {
153
+ color: var(--zdt_datetime_invalid_text);
154
+ cursor: no-drop;
153
155
  }
154
- .inActiveDate:hover
155
- {
156
+
157
+ .inActiveDate:hover {
156
158
  color: var(--zdt_datetime_invalid_text);
157
159
  }
158
- .inActiveDate:hover, .inActiveDate.holiday:hover{
160
+
161
+ .inActiveDate:hover, .inActiveDate.holiday:hover {
159
162
  background-color: var(--zdt_datetime_inactivedate_hover_bg);
160
163
 
161
164
  }
@@ -61,7 +61,7 @@
61
61
  }
62
62
 
63
63
  .isActive .yearText {
64
- font-family: var(--zd_semibold);
64
+ font-weight: var(--zd-fw-semibold);
65
65
  color: var(--zdt_yearview_year_hover_text);
66
66
  font-size: var(--zd_font_size11) ;
67
67
  }
@@ -1,5 +1,5 @@
1
1
  .reset {
2
2
  font-size: inherit ;
3
- font-weight: initial;
3
+ font-weight: var(--zd-fw-normal);
4
4
  margin: initial ;
5
5
  }
@@ -2,7 +2,7 @@
2
2
  /* label default variables */
3
3
  --label_font_size: var(--zd_font_size14);
4
4
  --label_text_color: var(--zdt_label_default_text);
5
- --label_font_family: var(--zd_regular);
5
+ --label_font_weight: var(--zd-fw-normal);
6
6
  --label_cursor: default;
7
7
  --label_line_height: 1.286;
8
8
  }
@@ -13,24 +13,24 @@
13
13
  line-height: var(--label_line_height);
14
14
  font-size: var(--label_font_size);
15
15
  color: var(--label_text_color);
16
- font-family: var(--label_font_family);
16
+ font-weight: var(--label_font_weight);
17
17
  cursor: var(--label_cursor);
18
18
  }
19
19
  .xsmall {
20
20
  --label_font_size: var(--zd_font_size12);
21
- --label_line_height:1.5;
21
+ --label_line_height: 1.5;
22
22
  }
23
23
  .small {
24
24
  --label_font_size: var(--zd_font_size13);
25
- --label_line_height:1.385;
25
+ --label_line_height: 1.385;
26
26
  }
27
27
  .medium {
28
28
  --label_font_size: var(--zd_font_size14);
29
- --label_line_height:1.286;
29
+ --label_line_height: 1.286;
30
30
  }
31
31
  .large {
32
32
  --label_font_size: var(--zd_font_size26);
33
- --label_line_height:0.6923;
33
+ --label_line_height: 0.6923;
34
34
  composes: semibold from '../common/common.module.css';
35
35
  }
36
36
  .pointer {
@@ -46,10 +46,10 @@
46
46
  display: inline-block;
47
47
  }
48
48
  .font_default {
49
- --label_font_family: var(--zd_regular);
49
+ --label_font_weight: var(--zd-fw-normal);
50
50
  }
51
51
  .font_primary {
52
- --label_font_family: var(--zd_semibold);
52
+ --label_font_weight: var(--zd-fw-semibold);
53
53
  composes: ftsmooth from '../common/common.module.css';
54
54
  }
55
55
  .dotted {
@@ -81,6 +81,8 @@ export class MultiSelectComponent extends React.Component {
81
81
  this.handleSearchOptions = debounce(this.handleSearchOptions.bind(this), searchDebounceTime);
82
82
  this.handleScroll = this.handleScroll.bind(this);
83
83
  this.handleScrollFuncCall = debounce(this.handleScrollFuncCall.bind(this), 500);
84
+ this.getVirtualizerPublicMethods = this.getVirtualizerPublicMethods.bind(this);
85
+ this.setSuggestionsVirtualizerContainerRefFunction = this.setSuggestionsVirtualizerContainerRefFunction.bind(this);
84
86
  }
85
87
 
86
88
  componentDidMount() {
@@ -140,11 +142,6 @@ export class MultiSelectComponent extends React.Component {
140
142
  }
141
143
 
142
144
  componentDidUpdate(prevProps, prevState) {
143
- const {
144
- suggestionContainer,
145
- selectedOptionContainer,
146
- suggestionsOrder
147
- } = this;
148
145
  const {
149
146
  hoverOption,
150
147
  highLightedSelectOptions,
@@ -156,7 +153,8 @@ export class MultiSelectComponent extends React.Component {
156
153
  isPopupOpen,
157
154
  onDropBoxClose,
158
155
  onDropBoxOpen,
159
- isSearchClearOnClose
156
+ isSearchClearOnClose,
157
+ isVirtualizerEnabled
160
158
  } = this.props; //handle dropbox open & close
161
159
 
162
160
  if (prevProps.isPopupOpen !== isPopupOpen) {
@@ -172,12 +170,23 @@ export class MultiSelectComponent extends React.Component {
172
170
  } //scrollTo handling
173
171
 
174
172
 
175
- const hoverId = suggestionsOrder[hoverOption] || '';
176
- const selectedSuggestion = this[`suggestion_${hoverId}`];
177
- const lastHighLightedSelectOption = highLightedSelectOptions.slice(-1).length ? highLightedSelectOptions.slice(-1)[0] : null;
178
- const selectedOption = this[`selectedOption_${lastHighLightedSelectOption}`];
179
- isPopupOpen && scrollTo(suggestionContainer, selectedSuggestion);
180
- selectedOptions.length && selectedOption && scrollTo(selectedOptionContainer, selectedOption); //When suggestions length less than 5, getNextOptions function call
173
+ if (isVirtualizerEnabled && !!this.virtualizerMethods) {
174
+ let position = prevState.hoverOption > hoverOption ? 'top' : 'bottom';
175
+ this.virtualizerMethods.getElementVisiblePercentage(hoverOption) < 50 && this.virtualizerMethods.scrollToIndex(hoverOption, position);
176
+ } else {
177
+ const {
178
+ suggestionContainer,
179
+ selectedOptionContainer,
180
+ suggestionsOrder
181
+ } = this;
182
+ const hoverId = suggestionsOrder[hoverOption] || '';
183
+ const selectedSuggestion = this[`suggestion_${hoverId}`];
184
+ const lastHighLightedSelectOption = highLightedSelectOptions.slice(-1).length ? highLightedSelectOptions.slice(-1)[0] : null;
185
+ const selectedOption = this[`selectedOption_${lastHighLightedSelectOption}`];
186
+ isPopupOpen && scrollTo(suggestionContainer, selectedSuggestion);
187
+ selectedOptions.length && selectedOption && scrollTo(selectedOptionContainer, selectedOption);
188
+ } //When suggestions length less than 5, getNextOptions function call
189
+
181
190
 
182
191
  const {
183
192
  isNextOptions,
@@ -798,6 +807,7 @@ export class MultiSelectComponent extends React.Component {
798
807
 
799
808
  suggestionContainerRef(el) {
800
809
  this.suggestionContainer = el;
810
+ typeof this.setSuggestionsVirtualizerRef === 'function' && this.setSuggestionsVirtualizerRef(el);
801
811
  }
802
812
 
803
813
  suggestionItemRef(el, index, id) {
@@ -862,6 +872,15 @@ export class MultiSelectComponent extends React.Component {
862
872
  });
863
873
  }
864
874
 
875
+ getVirtualizerPublicMethods(methods) {
876
+ this.virtualizerMethods = methods;
877
+ }
878
+
879
+ setSuggestionsVirtualizerContainerRefFunction(refFunc) {
880
+ this.setSuggestionsVirtualizerRef = refFunc;
881
+ this.suggestionContainer && refFunc(this.suggestionContainer);
882
+ }
883
+
865
884
  getSelectionUI() {
866
885
  let isResponsive = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
867
886
  let {
@@ -1042,6 +1061,7 @@ export class MultiSelectComponent extends React.Component {
1042
1061
  isLoading,
1043
1062
  selectAllText,
1044
1063
  needSelectAll,
1064
+ isVirtualizerEnabled,
1045
1065
  limit
1046
1066
  } = this.props;
1047
1067
  const {
@@ -1123,7 +1143,11 @@ export class MultiSelectComponent extends React.Component {
1123
1143
  }, isSearching ? /*#__PURE__*/React.createElement("div", {
1124
1144
  className: style[palette]
1125
1145
  }, searchText) : suggestions.length ? /*#__PURE__*/React.createElement(Suggestions, {
1146
+ key: searchStr.trim(),
1126
1147
  suggestions: suggestions,
1148
+ isVirtualizerEnabled: isVirtualizerEnabled,
1149
+ getVirtualizerPublicMethods: this.getVirtualizerPublicMethods,
1150
+ setVirtualizerContainerRefFunction: this.setSuggestionsVirtualizerContainerRefFunction,
1127
1151
  getRef: this.suggestionItemRef,
1128
1152
  hoverOption: hoverOption,
1129
1153
  onClick: this.handleSelectOption,
@@ -196,7 +196,7 @@
196
196
  .more {
197
197
  font-size: var(--zd_font_size14) ;
198
198
  color: var(--zdt_multiselect_more_text);
199
- font-family: inherit;
199
+ font-weight: var(--zd-fw-normal);
200
200
  cursor: pointer;
201
201
  margin-top: var(--zd_size5) ;
202
202
  background-color: var(--zdt_multiselect_delete_bg);
@@ -1,140 +1,114 @@
1
1
  /**** Libraries ****/
2
- import React from 'react';
2
+ import React, { useMemo } from 'react';
3
3
  import { Suggestions_propTypes } from "./props/propTypes";
4
4
  import { Suggestions_defaultProps } from "./props/defaultProps";
5
+ import { Virtualizer } from '@zohodesk/virtualizer';
5
6
  /**** Components ****/
6
7
 
7
8
  import ListItem from "../ListItem/ListItem";
8
9
  import ListItemWithAvatar from "../ListItem/ListItemWithAvatar";
9
10
  import ListItemWithIcon from "../ListItem/ListItemWithIcon";
10
11
  import { Container, Box } from "../Layout";
12
+ import { DUMMY_OBJECT, DUMMY_ARRAY } from "../utils/Common";
13
+
14
+ function SuggestionsVirtualizerContainer(_ref) {
15
+ let {
16
+ eleRef,
17
+ children,
18
+ setVirtualizerContainerRefFunction
19
+ } = _ref;
20
+ useMemo(() => {
21
+ typeof setVirtualizerContainerRefFunction === 'function' && setVirtualizerContainerRefFunction(eleRef);
22
+ }, [eleRef, setVirtualizerContainerRefFunction]);
23
+ return /*#__PURE__*/React.createElement(React.Fragment, null, children);
24
+ }
25
+
11
26
  export default class Suggestions extends React.PureComponent {
12
- render() {
27
+ constructor(props) {
28
+ super(props);
29
+ this.renderSuggestionList = this.renderSuggestionList.bind(this);
30
+ this.renderVirtualizerSuggestionListItem = this.renderVirtualizerSuggestionListItem.bind(this);
31
+ }
32
+
33
+ renderSuggestionList(_ref2) {
34
+ let {
35
+ suggestion,
36
+ index,
37
+ ref
38
+ } = _ref2;
13
39
  const {
14
- suggestions,
15
40
  getRef,
16
41
  hoverOption,
17
42
  onClick,
18
43
  onMouseEnter,
19
44
  needTick,
20
45
  needBorder,
21
- selectedOptions = [],
46
+ selectedOptions = DUMMY_ARRAY,
22
47
  activeId,
23
48
  hoverId,
24
- dataId,
25
49
  listItemSize,
26
- className,
27
50
  avatarPalette,
28
51
  palette,
29
- htmlId,
30
52
  a11y,
31
53
  needMultiLineText,
32
54
  limit,
33
55
  limitReachedMessage
34
56
  } = this.props;
35
57
  const {
36
- ariaParentRole,
37
- ariaMultiselectable
38
- } = a11y;
58
+ id,
59
+ value,
60
+ secondaryValue,
61
+ photoURL,
62
+ icon,
63
+ optionType,
64
+ iconSize,
65
+ isDisabled,
66
+ listItemProps,
67
+ listItemCustomProps = DUMMY_OBJECT
68
+ } = suggestion;
69
+ const isActive = activeId === id || selectedOptions.indexOf(id) >= 0;
70
+ const isHighlight = hoverOption === index || id === hoverId ? true : false;
39
71
  const selectedOptionsLength = selectedOptions.length;
40
- return /*#__PURE__*/React.createElement(Container, {
41
- isCover: false,
42
- role: ariaParentRole,
43
- id: htmlId,
44
- tabindex: "0",
45
- "aria-multiselectable": ariaMultiselectable
46
- }, /*#__PURE__*/React.createElement(Box, {
47
- dataId: `${dataId}`,
48
- className: className ? className : ''
49
- }, suggestions.map((suggestion, index) => {
50
- const {
51
- id,
52
- value,
53
- secondaryValue,
54
- photoURL,
55
- icon,
56
- optionType,
57
- iconSize,
58
- isDisabled,
59
- listItemProps,
60
- listItemCustomProps = {}
61
- } = suggestion;
62
- const isActive = activeId === id || selectedOptions.indexOf(id) >= 0;
63
- const isHighlight = hoverOption === index || id === hoverId ? true : false;
64
- const isLimitReached = selectedOptionsLength >= limit && !isActive;
65
- const list_a11y = Object.assign({}, a11y, {
66
- ariaSelected: isActive,
67
- ariaLabel: value,
68
- 'data-a11y-list-active': isHighlight
69
- });
70
- const commonProps = {
71
- isDisabled: isDisabled ? isDisabled : isLimitReached,
72
- needMultiLineText,
73
- ...listItemCustomProps
72
+ const isLimitReached = selectedOptionsLength >= limit && !isActive;
73
+ const list_a11y = Object.assign({}, a11y, {
74
+ ariaSelected: isActive,
75
+ ariaLabel: value,
76
+ 'data-a11y-list-active': isHighlight
77
+ });
78
+ const commonProps = {
79
+ isDisabled: isDisabled ? isDisabled : isLimitReached,
80
+ needMultiLineText,
81
+ ...listItemCustomProps
82
+ };
83
+
84
+ if (listItemProps) {
85
+ commonProps.customProps = {
86
+ ListItemProps: { ...listItemProps
87
+ }
74
88
  };
89
+ }
75
90
 
76
- if (listItemProps) {
77
- commonProps.customProps = {
78
- ListItemProps: { ...listItemProps
79
- }
80
- };
81
- }
91
+ if (isLimitReached) {
92
+ commonProps.disableTitle = limitReachedMessage;
93
+ }
82
94
 
83
- if (isLimitReached) {
84
- commonProps.disableTitle = limitReachedMessage;
85
- }
95
+ function getListItemRef(ele, index, id) {
96
+ ref && ref(ele);
86
97
 
87
- if (optionType === 'avatar') {
88
- return /*#__PURE__*/React.createElement(ListItemWithAvatar, { ...commonProps,
89
- autoHover: false,
90
- getRef: getRef,
91
- highlight: isHighlight,
92
- id: id,
93
- imgSrc: photoURL,
94
- key: `${id}avatarListItem`,
95
- name: value,
96
- onClick: onClick,
97
- onMouseEnter: onMouseEnter,
98
- value: value,
99
- title: value,
100
- needTick: needTick,
101
- needBorder: needBorder,
102
- active: isActive,
103
- size: listItemSize,
104
- avatarPalette: avatarPalette,
105
- palette: palette,
106
- a11y: list_a11y,
107
- secondaryValue: secondaryValue
108
- });
109
- } else if (optionType === 'icon') {
110
- return /*#__PURE__*/React.createElement(ListItemWithIcon, { ...commonProps,
111
- autoHover: false,
112
- getRef: getRef,
113
- highlight: isHighlight,
114
- id: id,
115
- key: `${id}iconListItem`,
116
- onClick: onClick,
117
- onMouseEnter: onMouseEnter,
118
- value: value,
119
- title: value,
120
- iconName: icon,
121
- needTick: needTick,
122
- needBorder: needBorder,
123
- active: isActive,
124
- iconSize: iconSize,
125
- size: listItemSize,
126
- palette: palette,
127
- a11y: list_a11y,
128
- secondaryValue: secondaryValue
129
- });
98
+ if (typeof getRef === 'function') {
99
+ getRef(ele, index, id);
130
100
  }
101
+ }
131
102
 
132
- return /*#__PURE__*/React.createElement(ListItem, { ...commonProps,
103
+ if (optionType === 'avatar') {
104
+ return /*#__PURE__*/React.createElement(ListItemWithAvatar, { ...commonProps,
133
105
  autoHover: false,
134
- getRef: getRef,
106
+ getRef: getListItemRef,
135
107
  highlight: isHighlight,
136
108
  id: id,
137
- key: `${id}listItem`,
109
+ imgSrc: photoURL,
110
+ key: `${id}avatarListItem`,
111
+ name: value,
138
112
  onClick: onClick,
139
113
  onMouseEnter: onMouseEnter,
140
114
  value: value,
@@ -143,8 +117,105 @@ export default class Suggestions extends React.PureComponent {
143
117
  needBorder: needBorder,
144
118
  active: isActive,
145
119
  size: listItemSize,
120
+ avatarPalette: avatarPalette,
146
121
  palette: palette,
147
- a11y: list_a11y
122
+ a11y: list_a11y,
123
+ secondaryValue: secondaryValue
124
+ });
125
+ } else if (optionType === 'icon') {
126
+ return /*#__PURE__*/React.createElement(ListItemWithIcon, { ...commonProps,
127
+ autoHover: false,
128
+ getRef: getListItemRef,
129
+ highlight: isHighlight,
130
+ id: id,
131
+ key: `${id}iconListItem`,
132
+ onClick: onClick,
133
+ onMouseEnter: onMouseEnter,
134
+ value: value,
135
+ title: value,
136
+ iconName: icon,
137
+ needTick: needTick,
138
+ needBorder: needBorder,
139
+ active: isActive,
140
+ iconSize: iconSize,
141
+ size: listItemSize,
142
+ palette: palette,
143
+ a11y: list_a11y,
144
+ secondaryValue: secondaryValue
145
+ });
146
+ }
147
+
148
+ return /*#__PURE__*/React.createElement(ListItem, { ...commonProps,
149
+ autoHover: false,
150
+ getRef: getListItemRef,
151
+ highlight: isHighlight,
152
+ id: id,
153
+ key: `${id}listItem`,
154
+ onClick: onClick,
155
+ onMouseEnter: onMouseEnter,
156
+ value: value,
157
+ title: value,
158
+ needTick: needTick,
159
+ needBorder: needBorder,
160
+ active: isActive,
161
+ size: listItemSize,
162
+ palette: palette,
163
+ a11y: list_a11y
164
+ });
165
+ }
166
+
167
+ renderVirtualizerSuggestionListItem(_ref3) {
168
+ let {
169
+ index,
170
+ ref
171
+ } = _ref3;
172
+ const {
173
+ suggestions
174
+ } = this.props;
175
+ const suggestion = suggestions[index];
176
+ return this.renderSuggestionList({
177
+ suggestion,
178
+ index,
179
+ ref
180
+ });
181
+ }
182
+
183
+ render() {
184
+ const {
185
+ suggestions,
186
+ dataId,
187
+ className,
188
+ isVirtualizerEnabled,
189
+ htmlId,
190
+ a11y,
191
+ getVirtualizerPublicMethods,
192
+ setVirtualizerContainerRefFunction
193
+ } = this.props;
194
+ const {
195
+ ariaParentRole,
196
+ ariaMultiselectable
197
+ } = a11y;
198
+ return /*#__PURE__*/React.createElement(Container, {
199
+ isCover: false,
200
+ role: ariaParentRole,
201
+ id: htmlId,
202
+ tabindex: "0",
203
+ "aria-multiselectable": ariaMultiselectable
204
+ }, /*#__PURE__*/React.createElement(Box, {
205
+ dataId: `${dataId}`,
206
+ className: className ? className : ''
207
+ }, isVirtualizerEnabled ? /*#__PURE__*/React.createElement(Virtualizer, {
208
+ containerType: SuggestionsVirtualizerContainer,
209
+ elementRenderer: this.renderVirtualizerSuggestionListItem,
210
+ getExposedPublicMethods: getVirtualizerPublicMethods,
211
+ elementsCount: suggestions.length,
212
+ isElementsFixedHeight: false,
213
+ dataId: `${dataId}_virtualizer`,
214
+ setVirtualizerContainerRefFunction: setVirtualizerContainerRefFunction
215
+ }) : suggestions.map((suggestion, index) => {
216
+ return this.renderSuggestionList({
217
+ suggestion,
218
+ index
148
219
  });
149
220
  })));
150
221
  }
@@ -86,6 +86,7 @@ export const MultiSelect_defaultProps = {
86
86
  autoComplete: getLibraryConfig('autoComplete'),
87
87
  dataId: 'multiSelect',
88
88
  dropBoxSize: 'small',
89
+ isVirtualizerEnabled: false,
89
90
  isAnimate: true,
90
91
  isDisabled: false,
91
92
  isPopupOpenOnEnter: false,
@@ -167,5 +168,6 @@ export const SelectedOptions_defaultProps = {
167
168
  };
168
169
  export const Suggestions_defaultProps = {
169
170
  a11y: {},
171
+ isVirtualizerEnabled: false,
170
172
  needMultiLineText: false
171
173
  };