@zohodesk/components 1.0.0-temp-168 → 1.0.0-temp-169

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 (280) hide show
  1. package/.cli/PropLessFiles.html +1 -1
  2. package/.cli/PropValidationExcludeFilesArray.js +13 -3
  3. package/.cli/propValidation_report.html +1 -1
  4. package/README.md +48 -0
  5. package/assets/Appearance/dark/mode/Component_DarkMode.module.css +1 -0
  6. package/assets/Appearance/light/mode/Component_LightMode.module.css +1 -0
  7. package/assets/Appearance/pureDark/mode/Component_PureDarkMode.module.css +1 -0
  8. package/coverage/Button/Button.js.html +1 -1
  9. package/coverage/Button/css/Button.module.css.html +1 -1
  10. package/coverage/Button/css/cssJSLogic.js.html +1 -1
  11. package/coverage/Button/css/index.html +1 -1
  12. package/coverage/Button/index.html +1 -1
  13. package/coverage/Button/props/defaultProps.js.html +3 -6
  14. package/coverage/Button/props/index.html +1 -1
  15. package/coverage/Button/props/propTypes.js.html +9 -3
  16. package/coverage/Buttongroup/Buttongroup.js.html +1 -1
  17. package/coverage/Buttongroup/Buttongroup.module.css.html +1 -1
  18. package/coverage/Buttongroup/index.html +1 -1
  19. package/coverage/Buttongroup/props/defaultProps.js.html +1 -1
  20. package/coverage/Buttongroup/props/index.html +1 -1
  21. package/coverage/Buttongroup/props/propTypes.js.html +1 -1
  22. package/coverage/coverage-final.json +10 -10
  23. package/coverage/coverage-summary.json +10 -10
  24. package/coverage/index.html +1 -1
  25. package/coverage/utils/dummyFunction.js.html +1 -1
  26. package/coverage/utils/index.html +1 -1
  27. package/es/AppContainer/AppContainer.js +3 -0
  28. package/es/Button/__tests__/__snapshots__/Button.spec.js.snap +0 -28
  29. package/es/Button/props/defaultProps.js +1 -2
  30. package/es/Button/props/propTypes.js +3 -1
  31. package/es/DateTime/DateTime.module.css +2 -0
  32. package/es/DateTime/DateWidget.js +2 -1
  33. package/es/DateTime/dateFormatUtils/dayChange.js +2 -1
  34. package/es/DateTime/dateFormatUtils/index.js +1 -1
  35. package/es/DateTime/dateFormatUtils/monthChange.js +2 -1
  36. package/es/DateTime/dateFormatUtils/timeChange.js +4 -4
  37. package/es/DateTime/dateFormatUtils/yearChange.js +2 -1
  38. package/es/DropBox/DropBox.js +10 -10
  39. package/es/DropDown/DropDown.js +1 -7
  40. package/es/MultiSelect/AdvancedGroupMultiSelect.js +7 -5
  41. package/es/MultiSelect/AdvancedMultiSelect.js +4 -4
  42. package/es/MultiSelect/MobileHeader/MobileHeader.js +50 -0
  43. package/es/MultiSelect/MobileHeader/MobileHeader.module.css +16 -0
  44. package/es/MultiSelect/MobileHeader/props/defaultProps.js +7 -0
  45. package/es/MultiSelect/MobileHeader/props/propTypes.js +7 -0
  46. package/es/MultiSelect/MultiSelect.js +112 -91
  47. package/es/MultiSelect/MultiSelect.module.css +2 -5
  48. package/es/MultiSelect/MultiSelectHeader.js +1 -2
  49. package/es/MultiSelect/MultiSelectWithAvatar.js +15 -112
  50. package/es/MultiSelect/props/defaultProps.js +3 -1
  51. package/es/MultiSelect/props/propTypes.js +9 -57
  52. package/es/Responsive/RefWrapper.js +2 -1
  53. package/es/Select/GroupSelect.js +3 -5
  54. package/es/Select/Select.js +2 -5
  55. package/es/Select/SelectWithAvatar.js +2 -1
  56. package/es/Select/SelectWithIcon.js +5 -2
  57. package/es/TextBox/TextBox.js +3 -3
  58. package/es/TextBox/TextBox.module.css +5 -4
  59. package/es/Textarea/Textarea.module.css +3 -4
  60. package/es/deprecated/PortalLayer/props/propTypes.js +3 -1
  61. package/es/index.js +2 -1
  62. package/es/utils/Common.js +3 -0
  63. package/es/v1/Accordion/Accordion.js +66 -0
  64. package/es/v1/Accordion/AccordionItem.js +57 -0
  65. package/es/v1/Accordion/index.js +2 -0
  66. package/es/v1/Animation/Animation.js +127 -0
  67. package/es/v1/AppContainer/AppContainer.js +137 -0
  68. package/es/v1/Avatar/Avatar.js +139 -0
  69. package/es/v1/AvatarTeam/AvatarTeam.js +70 -0
  70. package/es/v1/Button/Button.js +68 -0
  71. package/es/v1/Buttongroup/Buttongroup.js +31 -0
  72. package/es/v1/Card/Card.js +271 -0
  73. package/es/v1/CheckBox/CheckBox.js +155 -0
  74. package/es/v1/DateTime/CalendarView.js +218 -0
  75. package/es/v1/DateTime/DateTime.js +783 -0
  76. package/es/v1/DateTime/DateTimePopupFooter.js +47 -0
  77. package/es/v1/DateTime/DateTimePopupHeader.js +105 -0
  78. package/es/v1/DateTime/DateWidget.js +1098 -0
  79. package/es/v1/DateTime/DaysRow.js +31 -0
  80. package/es/v1/DateTime/Time.js +166 -0
  81. package/es/v1/DateTime/YearView.js +264 -0
  82. package/es/v1/DateTime/index.js +1 -0
  83. package/es/v1/DropBox/DropBox.js +91 -0
  84. package/es/v1/DropBox/DropBoxElement/DropBoxElement.js +132 -0
  85. package/es/v1/DropDown/DropDown.js +73 -0
  86. package/es/v1/DropDown/DropDownHeading.js +44 -0
  87. package/es/v1/DropDown/DropDownItem.js +76 -0
  88. package/es/v1/DropDown/DropDownSearch.js +63 -0
  89. package/es/v1/DropDown/DropDownSeparator.js +15 -0
  90. package/es/v1/Heading/Heading.js +32 -0
  91. package/es/v1/Label/Label.js +40 -0
  92. package/es/v1/Layout/Box.js +115 -0
  93. package/es/v1/Layout/Container.js +132 -0
  94. package/es/v1/Layout/index.js +2 -0
  95. package/es/v1/ListItem/ListContainer.js +102 -0
  96. package/es/v1/ListItem/ListItem.js +124 -0
  97. package/es/v1/ListItem/ListItemWithAvatar.js +145 -0
  98. package/es/v1/ListItem/ListItemWithCheckBox.js +104 -0
  99. package/es/v1/ListItem/ListItemWithIcon.js +127 -0
  100. package/es/v1/ListItem/ListItemWithRadio.js +105 -0
  101. package/es/v1/ListItem/index.js +6 -0
  102. package/es/v1/Modal/Modal.js +154 -0
  103. package/es/v1/MultiSelect/AdvancedGroupMultiSelect.js +1079 -0
  104. package/es/v1/MultiSelect/AdvancedMultiSelect.js +568 -0
  105. package/es/v1/MultiSelect/EmptyState.js +64 -0
  106. package/es/v1/MultiSelect/MobileHeader/MobileHeader.js +50 -0
  107. package/es/v1/MultiSelect/MultiSelect.js +1120 -0
  108. package/es/v1/MultiSelect/MultiSelectHeader.js +32 -0
  109. package/es/v1/MultiSelect/MultiSelectWithAvatar.js +216 -0
  110. package/es/v1/MultiSelect/SelectedOptions.js +82 -0
  111. package/es/v1/MultiSelect/Suggestions.js +142 -0
  112. package/es/v1/MultiSelect/index.js +4 -0
  113. package/es/v1/PopOver/PopOver.js +176 -0
  114. package/es/v1/Popup/Popup.js +645 -0
  115. package/es/v1/Radio/Radio.js +115 -0
  116. package/es/v1/Responsive/CustomResponsive.js +195 -0
  117. package/es/v1/Responsive/RefWrapper.js +39 -0
  118. package/es/v1/Responsive/ResizeComponent.js +197 -0
  119. package/es/v1/Responsive/ResizeObserver.js +140 -0
  120. package/es/v1/Responsive/Responsive.js +194 -0
  121. package/es/v1/Responsive/index.js +9 -0
  122. package/es/v1/ResponsiveDropBox/ResponsiveDropBox.js +58 -0
  123. package/es/v1/Ribbon/Ribbon.js +33 -0
  124. package/es/v1/RippleEffect/RippleEffect.js +24 -0
  125. package/es/v1/Select/GroupSelect.js +800 -0
  126. package/es/v1/Select/Select.js +966 -0
  127. package/es/v1/Select/SelectWithAvatar.js +344 -0
  128. package/es/v1/Select/SelectWithIcon.js +535 -0
  129. package/es/v1/Select/index.js +4 -0
  130. package/es/v1/Stencils/Stencils.js +26 -0
  131. package/es/v1/Switch/Switch.js +94 -0
  132. package/es/v1/Tab/Tab.js +108 -0
  133. package/es/v1/Tab/TabContent.js +30 -0
  134. package/es/v1/Tab/TabContentWrapper.js +29 -0
  135. package/es/v1/Tab/TabWrapper.js +57 -0
  136. package/es/v1/Tab/Tabs.js +612 -0
  137. package/es/v1/Tab/index.js +5 -0
  138. package/es/v1/Tag/Tag.js +134 -0
  139. package/es/v1/TextBox/TextBox.js +154 -0
  140. package/es/v1/TextBoxIcon/TextBoxIcon.js +158 -0
  141. package/es/v1/Textarea/Textarea.js +102 -0
  142. package/es/v1/Tooltip/Tooltip.js +518 -0
  143. package/es/v1/Typography/Typography.js +38 -0
  144. package/es/v1/Typography/css/Typography.module.css +376 -0
  145. package/es/v1/Typography/css/cssJSLogic.js +46 -0
  146. package/es/v1/Typography/css/letterSpacingMap.js +12 -0
  147. package/es/v1/Typography/props/defaultProps.js +8 -0
  148. package/es/v1/Typography/props/propTypes.js +24 -0
  149. package/es/v1/VelocityAnimation/VelocityAnimation/VelocityAnimation.js +69 -0
  150. package/es/v1/VelocityAnimation/VelocityAnimationGroup/VelocityAnimationGroup.js +100 -0
  151. package/es/v1/semantic/Button/Button.js +53 -0
  152. package/es/v1/semantic/index.js +1 -0
  153. package/lib/AppContainer/AppContainer.js +5 -0
  154. package/lib/Button/__tests__/__snapshots__/Button.spec.js.snap +0 -28
  155. package/lib/Button/props/defaultProps.js +1 -2
  156. package/lib/Button/props/propTypes.js +3 -1
  157. package/lib/DateTime/DateTime.module.css +2 -0
  158. package/lib/DateTime/DateWidget.js +2 -1
  159. package/lib/DateTime/dateFormatUtils/dayChange.js +3 -1
  160. package/lib/DateTime/dateFormatUtils/index.js +1 -1
  161. package/lib/DateTime/dateFormatUtils/monthChange.js +3 -1
  162. package/lib/DateTime/dateFormatUtils/timeChange.js +3 -3
  163. package/lib/DateTime/dateFormatUtils/yearChange.js +3 -1
  164. package/lib/DropBox/DropBox.js +15 -15
  165. package/lib/DropDown/DropDown.js +1 -6
  166. package/lib/MultiSelect/AdvancedGroupMultiSelect.js +7 -6
  167. package/lib/MultiSelect/AdvancedMultiSelect.js +4 -4
  168. package/lib/MultiSelect/MobileHeader/MobileHeader.js +62 -0
  169. package/lib/MultiSelect/MobileHeader/MobileHeader.module.css +16 -0
  170. package/lib/MultiSelect/MobileHeader/props/defaultProps.js +14 -0
  171. package/lib/MultiSelect/MobileHeader/props/propTypes.js +18 -0
  172. package/lib/MultiSelect/MultiSelect.js +116 -96
  173. package/lib/MultiSelect/MultiSelect.module.css +2 -5
  174. package/lib/MultiSelect/MultiSelectHeader.js +1 -2
  175. package/lib/MultiSelect/MultiSelectWithAvatar.js +18 -113
  176. package/lib/MultiSelect/props/defaultProps.js +3 -1
  177. package/lib/MultiSelect/props/propTypes.js +19 -60
  178. package/lib/Responsive/RefWrapper.js +2 -1
  179. package/lib/Select/GroupSelect.js +2 -2
  180. package/lib/Select/Select.js +1 -2
  181. package/lib/Select/SelectWithAvatar.js +2 -1
  182. package/lib/Select/SelectWithIcon.js +5 -3
  183. package/lib/TextBox/TextBox.js +10 -10
  184. package/lib/TextBox/TextBox.module.css +5 -4
  185. package/lib/Textarea/Textarea.module.css +3 -4
  186. package/lib/deprecated/PortalLayer/props/propTypes.js +3 -1
  187. package/lib/index.js +10 -1
  188. package/lib/utils/Common.js +5 -0
  189. package/lib/v1/Accordion/Accordion.js +98 -0
  190. package/lib/v1/Accordion/AccordionItem.js +68 -0
  191. package/lib/v1/Accordion/index.js +23 -0
  192. package/lib/v1/Animation/Animation.js +143 -0
  193. package/lib/v1/AppContainer/AppContainer.js +209 -0
  194. package/lib/v1/Avatar/Avatar.js +190 -0
  195. package/lib/v1/AvatarTeam/AvatarTeam.js +81 -0
  196. package/lib/v1/Button/Button.js +82 -0
  197. package/lib/v1/Buttongroup/Buttongroup.js +44 -0
  198. package/lib/v1/Card/Card.js +365 -0
  199. package/lib/v1/CheckBox/CheckBox.js +166 -0
  200. package/lib/v1/DateTime/CalendarView.js +285 -0
  201. package/lib/v1/DateTime/DateTime.js +872 -0
  202. package/lib/v1/DateTime/DateTimePopupFooter.js +96 -0
  203. package/lib/v1/DateTime/DateTimePopupHeader.js +166 -0
  204. package/lib/v1/DateTime/DateWidget.js +1125 -0
  205. package/lib/v1/DateTime/DaysRow.js +80 -0
  206. package/lib/v1/DateTime/Time.js +254 -0
  207. package/lib/v1/DateTime/YearView.js +325 -0
  208. package/lib/v1/DateTime/index.js +15 -0
  209. package/lib/v1/DropBox/DropBox.js +119 -0
  210. package/lib/v1/DropBox/DropBoxElement/DropBoxElement.js +145 -0
  211. package/lib/v1/DropDown/DropDown.js +170 -0
  212. package/lib/v1/DropDown/DropDownHeading.js +93 -0
  213. package/lib/v1/DropDown/DropDownItem.js +127 -0
  214. package/lib/v1/DropDown/DropDownSearch.js +113 -0
  215. package/lib/v1/DropDown/DropDownSeparator.js +64 -0
  216. package/lib/v1/Heading/Heading.js +49 -0
  217. package/lib/v1/Label/Label.js +51 -0
  218. package/lib/v1/Layout/Box.js +128 -0
  219. package/lib/v1/Layout/Container.js +145 -0
  220. package/lib/v1/Layout/index.js +23 -0
  221. package/lib/v1/ListItem/ListContainer.js +120 -0
  222. package/lib/v1/ListItem/ListItem.js +138 -0
  223. package/lib/v1/ListItem/ListItemWithAvatar.js +162 -0
  224. package/lib/v1/ListItem/ListItemWithCheckBox.js +125 -0
  225. package/lib/v1/ListItem/ListItemWithIcon.js +143 -0
  226. package/lib/v1/ListItem/ListItemWithRadio.js +126 -0
  227. package/lib/v1/ListItem/index.js +55 -0
  228. package/lib/v1/Modal/Modal.js +212 -0
  229. package/lib/v1/MultiSelect/AdvancedGroupMultiSelect.js +1167 -0
  230. package/lib/v1/MultiSelect/AdvancedMultiSelect.js +634 -0
  231. package/lib/v1/MultiSelect/EmptyState.js +112 -0
  232. package/lib/v1/MultiSelect/MobileHeader/MobileHeader.js +62 -0
  233. package/lib/v1/MultiSelect/MultiSelect.js +1201 -0
  234. package/lib/v1/MultiSelect/MultiSelectHeader.js +78 -0
  235. package/lib/v1/MultiSelect/MultiSelectWithAvatar.js +270 -0
  236. package/lib/v1/MultiSelect/SelectedOptions.js +126 -0
  237. package/lib/v1/MultiSelect/Suggestions.js +195 -0
  238. package/lib/v1/MultiSelect/index.js +39 -0
  239. package/lib/v1/PopOver/PopOver.js +197 -0
  240. package/lib/v1/Popup/Popup.js +715 -0
  241. package/lib/v1/Radio/Radio.js +126 -0
  242. package/lib/v1/Responsive/CustomResponsive.js +242 -0
  243. package/lib/v1/Responsive/RefWrapper.js +57 -0
  244. package/lib/v1/Responsive/ResizeComponent.js +268 -0
  245. package/lib/v1/Responsive/ResizeObserver.js +168 -0
  246. package/lib/v1/Responsive/Responsive.js +274 -0
  247. package/lib/v1/Responsive/index.js +55 -0
  248. package/lib/v1/ResponsiveDropBox/ResponsiveDropBox.js +79 -0
  249. package/lib/v1/Ribbon/Ribbon.js +44 -0
  250. package/lib/v1/RippleEffect/RippleEffect.js +39 -0
  251. package/lib/v1/Select/GroupSelect.js +876 -0
  252. package/lib/v1/Select/Select.js +1012 -0
  253. package/lib/v1/Select/SelectWithAvatar.js +394 -0
  254. package/lib/v1/Select/SelectWithIcon.js +597 -0
  255. package/lib/v1/Select/index.js +39 -0
  256. package/lib/v1/Stencils/Stencils.js +43 -0
  257. package/lib/v1/Switch/Switch.js +108 -0
  258. package/lib/v1/Tab/Tab.js +132 -0
  259. package/lib/v1/Tab/TabContent.js +42 -0
  260. package/lib/v1/Tab/TabContentWrapper.js +42 -0
  261. package/lib/v1/Tab/TabWrapper.js +89 -0
  262. package/lib/v1/Tab/Tabs.js +680 -0
  263. package/lib/v1/Tab/index.js +47 -0
  264. package/lib/v1/Tag/Tag.js +154 -0
  265. package/lib/v1/TextBox/TextBox.js +168 -0
  266. package/lib/v1/TextBoxIcon/TextBoxIcon.js +196 -0
  267. package/lib/v1/Textarea/Textarea.js +118 -0
  268. package/lib/v1/Tooltip/Tooltip.js +586 -0
  269. package/lib/v1/Typography/Typography.js +56 -0
  270. package/lib/v1/Typography/css/Typography.module.css +376 -0
  271. package/lib/v1/Typography/css/cssJSLogic.js +41 -0
  272. package/lib/v1/Typography/css/letterSpacingMap.js +20 -0
  273. package/lib/v1/Typography/props/defaultProps.js +15 -0
  274. package/lib/v1/Typography/props/propTypes.js +35 -0
  275. package/lib/v1/VelocityAnimation/VelocityAnimation/VelocityAnimation.js +90 -0
  276. package/lib/v1/VelocityAnimation/VelocityAnimationGroup/VelocityAnimationGroup.js +126 -0
  277. package/lib/v1/semantic/Button/Button.js +63 -0
  278. package/lib/v1/semantic/index.js +15 -0
  279. package/package.json +10 -10
  280. package/result.json +1 -1
@@ -0,0 +1,966 @@
1
+ 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); }
2
+
3
+ /**** Libraries ****/
4
+ import React, { Component } from 'react';
5
+ import { Select_defaultProps } from '../../Select/props/defaultProps';
6
+ import { Select_propTypes } from '../../Select/props/propTypes';
7
+ /**** Components ****/
8
+
9
+ import Popup from '../Popup/Popup';
10
+ import TextBoxIcon from '../TextBoxIcon/TextBoxIcon';
11
+ import { Container, Box } from '../Layout';
12
+ import Textbox from '../TextBox/TextBox';
13
+ import Card, { CardHeader, CardContent, CardFooter } from '../Card/Card';
14
+ import Suggestions from '../MultiSelect/Suggestions';
15
+ import EmptyState from '../MultiSelect/EmptyState';
16
+ import { getUniqueId } from '../../Provider/IdProvider';
17
+ import { Icon } from '@zohodesk/icons';
18
+ import ResponsiveDropBox from '../ResponsiveDropBox/ResponsiveDropBox';
19
+ import { ResponsiveReceiver } from '../Responsive/CustomResponsive';
20
+ import Loader from '@zohodesk/svg/lib/Loader/Loader';
21
+ /**** Methods ****/
22
+
23
+ import { makeFormatOptions, makeGetMultiSelectFilterSuggestions as makeGetFilterSuggestions, makeGetSelectedValueText as makeGetSelectedValue } from '../../utils/dropDownUtils';
24
+ import { debounce, scrollTo, getIsEmptyValue, getSearchString, findScrollEnd, getKeyValue } from '../../utils/Common.js';
25
+ /**** CSS ****/
26
+
27
+ import style from '../../Select/Select.module.css';
28
+ import { getLibraryConfig } from '../../Provider/Config';
29
+ /* eslint-disable react/no-deprecated */
30
+
31
+ /* eslint-disable react/no-unused-prop-types */
32
+
33
+ let dummyArray = [];
34
+ export class SelectComponent extends Component {
35
+ constructor(props) {
36
+ super(props);
37
+ this.getNextAriaId = getUniqueId(this);
38
+ this.getFilterSuggestions = makeGetFilterSuggestions();
39
+ this.formatOptions = makeFormatOptions();
40
+ this.getSelectedValue = makeGetSelectedValue();
41
+ this.selectedFormatOptions = {};
42
+ let {
43
+ selectedValue,
44
+ searchDebounceTime = 500,
45
+ isDefaultSelectValue,
46
+ autoSelectDebouneTime = 350,
47
+ valueField,
48
+ textField
49
+ } = props;
50
+ let {
51
+ allOptions,
52
+ normalizedAllOptions,
53
+ optionsOrder,
54
+ normalizedFormatOptions
55
+ } = this.handleFormatOptions(this.props);
56
+ let {
57
+ selected,
58
+ hoverIndex,
59
+ selectedValueDetails,
60
+ selectedId,
61
+ isSelfValueChanged
62
+ } = this.getSelectedValue({
63
+ optionsOrder,
64
+ selectedValue,
65
+ normalizedFormatOptions,
66
+ selectedFormatOptions: this.selectedFormatOptions,
67
+ isDefaultSelectValue,
68
+ valueField,
69
+ textField
70
+ }); // eslint-disable-next-line
71
+
72
+ if (isSelfValueChanged) {// onChange && onChange(selectedId, normalizedAllOptions[selectedId]);
73
+ }
74
+
75
+ this.state = {
76
+ selected,
77
+ options: allOptions,
78
+ optionsNormalize: normalizedAllOptions,
79
+ hoverIndex,
80
+ searchStr: '',
81
+ isFetchingOptions: false,
82
+ selectedId,
83
+ selectedValueIndex: hoverIndex
84
+ };
85
+ this.optionsOrder = optionsOrder;
86
+ this._isMounted = false;
87
+ this.normalizedFormatOptions = normalizedFormatOptions;
88
+ this.allSelectedOptions = selectedValueDetails;
89
+ this.handleChange = this.handleChange.bind(this);
90
+ this.handleKeyDown = this.handleKeyDown.bind(this);
91
+ this.handleSearch = this.handleSearch.bind(this);
92
+ this.handleFilterSuggestions = this.handleFilterSuggestions.bind(this);
93
+ this.handleMouseEnter = this.handleMouseEnter.bind(this);
94
+ this.handleFetchOptions = this.handleFetchOptions.bind(this);
95
+ this.handleGetNextOptions = this.handleGetNextOptions.bind(this);
96
+ this.handleScroll = this.handleScroll.bind(this);
97
+ this.handleSearchOptions = debounce(this.handleSearchOptions.bind(this), searchDebounceTime);
98
+ this.suggestionContainerRef = this.suggestionContainerRef.bind(this);
99
+ this.suggestionItemRef = this.suggestionItemRef.bind(this);
100
+ this.searchInputRef = this.searchInputRef.bind(this);
101
+ this.valueInputRef = this.valueInputRef.bind(this);
102
+ this.togglePopup = this.togglePopup.bind(this);
103
+ this.handleSelectFocus = this.handleSelectFocus.bind(this);
104
+ this.handleFormatOptions = this.handleFormatOptions.bind(this);
105
+ this.handlePopupClose = this.handlePopupClose.bind(this);
106
+ this.handleClearSearch = this.handleClearSearch.bind(this);
107
+ this.handleValueInputChange = this.handleValueInputChange.bind(this);
108
+ this.handleChangeOnType = debounce(this.handleChangeOnType.bind(this), autoSelectDebouneTime);
109
+ this.handleAddNewOption = this.handleAddNewOption.bind(this);
110
+ this.handleExposePopupHandlers = this.handleExposePopupHandlers.bind(this);
111
+ this.handleGetAddNewOptionText = this.handleGetAddNewOptionText.bind(this);
112
+ this.valueInputTypeString = '';
113
+ this.valueInputSearchString = '';
114
+ this.autoSelectSuggestions = [];
115
+ this.autoSelectIndex = 0;
116
+ }
117
+
118
+ componentDidMount() {
119
+ this._isMounted = true;
120
+ this.handleExposePopupHandlers(); // let { suggestionContainer } = this;
121
+ // suggestionContainer &&
122
+ // suggestionContainer.addEventListener('scroll', this.handleScroll);
123
+ }
124
+
125
+ componentWillReceiveProps(nextProps) {
126
+ let {
127
+ selectedValue,
128
+ isDefaultSelectValue,
129
+ valueField,
130
+ textField
131
+ } = nextProps;
132
+ let {
133
+ hoverIndex: oldHoverIndex
134
+ } = this.state;
135
+ let {
136
+ allOptions,
137
+ normalizedAllOptions,
138
+ optionsOrder,
139
+ normalizedFormatOptions
140
+ } = this.handleFormatOptions(nextProps);
141
+ let {
142
+ selectedFormatOptions: oldSelectedFormatOptions
143
+ } = this;
144
+ let {
145
+ selected,
146
+ hoverIndex,
147
+ selectedValueDetails,
148
+ selectedId,
149
+ isSelfValueChanged
150
+ } = this.getSelectedValue({
151
+ optionsOrder,
152
+ selectedValue,
153
+ normalizedFormatOptions,
154
+ selectedFormatOptions: oldSelectedFormatOptions,
155
+ isDefaultSelectValue,
156
+ valueField,
157
+ textField
158
+ });
159
+ let {
160
+ selectedValue: oldSelectedValue
161
+ } = this.props; // eslint-disable-next-line
162
+
163
+ if (isSelfValueChanged && oldSelectedValue !== selectedValue) {// onChange && onChange(selectedId, normalizedAllOptions[selectedId]);
164
+ }
165
+
166
+ this.selectedFormatOptions = Object.assign(oldSelectedFormatOptions, selectedValueDetails);
167
+ this.normalizedFormatOptions = normalizedFormatOptions;
168
+ this.optionsOrder = optionsOrder;
169
+ this.setState({
170
+ options: allOptions,
171
+ optionsNormalize: normalizedAllOptions,
172
+ selected,
173
+ hoverIndex: oldHoverIndex ? oldHoverIndex : hoverIndex,
174
+ selectedId,
175
+ selectedValueIndex: hoverIndex
176
+ });
177
+ }
178
+
179
+ componentDidUpdate(prevProps) {
180
+ let {
181
+ suggestionContainer,
182
+ optionsOrder
183
+ } = this;
184
+ let {
185
+ hoverIndex,
186
+ searchStr,
187
+ selectedValueIndex
188
+ } = this.state;
189
+ let {
190
+ needLocalSearch,
191
+ onDropBoxClose,
192
+ onDropBoxOpen,
193
+ needSearch,
194
+ onSearch,
195
+ isPopupOpen,
196
+ isSearchClearOnClose
197
+ } = this.props;
198
+ let hoverId = getIsEmptyValue(optionsOrder[hoverIndex]) ? '' : optionsOrder[hoverIndex];
199
+ let selSuggestion = this[`suggestion_${hoverId}`];
200
+ isPopupOpen && scrollTo(suggestionContainer, selSuggestion);
201
+
202
+ if (prevProps.isPopupOpen !== isPopupOpen) {
203
+ if (isPopupOpen) {
204
+ onDropBoxOpen && this.handleFetchOptions(onDropBoxOpen, searchStr);
205
+ setTimeout(() => {
206
+ this.searchInput && this.searchInput.focus({
207
+ preventScroll: true
208
+ });
209
+ }, 10);
210
+ } else {
211
+ // needSearch && this.valueInput && this.valueInput.focus({preventScroll:true});
212
+ onDropBoxClose && onDropBoxClose();
213
+ isSearchClearOnClose && searchStr && onSearch && onSearch('');
214
+ this.setState({
215
+ searchStr: isSearchClearOnClose ? '' : searchStr,
216
+ hoverIndex: selectedValueIndex
217
+ });
218
+ }
219
+ } //When suggestions length less than 5, getNextOptions function call
220
+
221
+
222
+ let {
223
+ isNextOptions,
224
+ getNextOptions
225
+ } = this.props; // let { searchStr } = this.state;
226
+
227
+ let suggestions = isPopupOpen ? this.handleFilterSuggestions() : [];
228
+ let suggestionsLen = suggestions.length;
229
+
230
+ if (isPopupOpen && suggestionsLen <= 5 && isNextOptions && getNextOptions && !needLocalSearch) {
231
+ this.handleFetchOptions(getNextOptions, searchStr);
232
+ }
233
+ }
234
+
235
+ componentWillUnmount() {
236
+ this._isMounted = false;
237
+ let {
238
+ getPopupHandlers
239
+ } = this.props;
240
+ let methods = {
241
+ removeClose: null,
242
+ openPopup: null,
243
+ closePopup: null,
244
+ togglePopup: null
245
+ };
246
+ getPopupHandlers && getPopupHandlers(methods); // let { suggestionContainer } = this;
247
+ // suggestionContainer &&
248
+ // suggestionContainer.removeEventListener('scroll', this.handleScroll);
249
+ }
250
+
251
+ handleFormatOptions(props) {
252
+ let {
253
+ options,
254
+ valueField,
255
+ textField,
256
+ customProps = {}
257
+ } = props;
258
+ let {
259
+ listItemProps = {}
260
+ } = customProps;
261
+ return this.formatOptions({
262
+ options,
263
+ valueField,
264
+ textField,
265
+ listItemProps
266
+ });
267
+ }
268
+
269
+ handleChange(id, value, index, e) {
270
+ e && e.preventDefault && e.preventDefault();
271
+ let {
272
+ onChange,
273
+ isReadOnly,
274
+ needCloseOnSelect
275
+ } = this.props;
276
+ let {
277
+ optionsNormalize
278
+ } = this.state;
279
+ !isReadOnly && onChange && onChange(id, optionsNormalize[id]); // this.valueInput && this.valueInput.focus({preventScroll:true});
280
+
281
+ needCloseOnSelect && this.handlePopupClose(e);
282
+ }
283
+
284
+ responsiveFunc(_ref) {
285
+ let {
286
+ mediaQueryOR
287
+ } = _ref;
288
+ return {
289
+ tabletMode: mediaQueryOR([{
290
+ maxWidth: 700
291
+ }])
292
+ };
293
+ }
294
+
295
+ handleKeyDown(e) {
296
+ let {
297
+ onChange,
298
+ isPopupOpen,
299
+ onKeyDown,
300
+ isPopupOpenOnEnter,
301
+ needCloseOnSelect
302
+ } = this.props;
303
+ let {
304
+ hoverIndex,
305
+ optionsNormalize
306
+ } = this.state;
307
+ let options = this.handleFilterSuggestions();
308
+ let {
309
+ keyCode
310
+ } = e;
311
+
312
+ if (!isPopupOpen && !isPopupOpenOnEnter) {
313
+ onKeyDown && onKeyDown(e);
314
+ }
315
+
316
+ if (isPopupOpen && (keyCode === 38 || keyCode === 40 || keyCode === 13) && e.preventDefault) {
317
+ e.preventDefault(); //prevent body scroll and enter key prevent
318
+ } else if (!isPopupOpen && keyCode === 40) {
319
+ e.preventDefault(); //prevent body scroll
320
+
321
+ this.togglePopup(e);
322
+ }
323
+
324
+ if (keyCode === 38 && isPopupOpen && options.length) {
325
+ // eslint-disable-next-line
326
+ if (hoverIndex === 0) {// hoverIndex = options.length - 1;
327
+ } else {
328
+ hoverIndex -= 1;
329
+ }
330
+
331
+ this.setState({
332
+ hoverIndex
333
+ });
334
+ } else if (keyCode === 40 && isPopupOpen && options.length) {
335
+ // eslint-disable-next-line
336
+ if (hoverIndex === options.length - 1) {// hoverIndex = 0;
337
+ } else {
338
+ if (hoverIndex === options.length - 3) {
339
+ this.handleGetNextOptions();
340
+ }
341
+
342
+ hoverIndex += 1;
343
+ }
344
+
345
+ this.setState({
346
+ hoverIndex
347
+ });
348
+ } else if (keyCode === 13) {
349
+ let option = options[hoverIndex];
350
+ let {
351
+ id
352
+ } = option || {};
353
+
354
+ if (isPopupOpen && !getIsEmptyValue(id) && onChange) {
355
+ onChange(id, optionsNormalize[id]);
356
+ needCloseOnSelect && this.handlePopupClose(e);
357
+ }
358
+
359
+ if (!isPopupOpen && isPopupOpenOnEnter) {
360
+ this.togglePopup(e);
361
+ }
362
+ } else if (keyCode === 27) {
363
+ this.valueInput && this.valueInput.focus({
364
+ preventScroll: true
365
+ }); //this.handlePopupClose(e);
366
+ } else if (keyCode === 9) {
367
+ let option = options[hoverIndex];
368
+ let {
369
+ id
370
+ } = option || {};
371
+
372
+ if (isPopupOpen && !getIsEmptyValue(id)) {
373
+ onChange && onChange(id, optionsNormalize[id]);
374
+ needCloseOnSelect && this.handlePopupClose(e);
375
+ }
376
+
377
+ if (!isPopupOpen && isPopupOpenOnEnter) {
378
+ this.togglePopup(e);
379
+ }
380
+ }
381
+ }
382
+
383
+ handleSearchOptions() {
384
+ let {
385
+ onSearch
386
+ } = this.props;
387
+ let {
388
+ searchStr
389
+ } = this.state;
390
+ searchStr && this.handleFetchOptions(onSearch, searchStr);
391
+ }
392
+
393
+ handleSearch(value) {
394
+ // let { value = '' } = e.target;
395
+ let {
396
+ searchStr = ''
397
+ } = this.state;
398
+ let {
399
+ onSearch
400
+ } = this.props;
401
+ let searchStrRegex = getSearchString(searchStr);
402
+ let valueStrRegex = getSearchString(value);
403
+ let isSearch = searchStrRegex !== valueStrRegex ? true : false;
404
+ this.setState({
405
+ searchStr: value,
406
+ hoverIndex: 0
407
+ }, () => {
408
+ if (!value) {
409
+ onSearch && this.handleFetchOptions(onSearch, '');
410
+ } else if (isSearch && onSearch) {
411
+ this.handleSearchOptions();
412
+ }
413
+ });
414
+ }
415
+
416
+ handleMouseEnter(id
417
+ /*val, index*/
418
+ ) {
419
+ let {
420
+ hoverIndex
421
+ } = this.state;
422
+ let {
423
+ optionsOrder
424
+ } = this;
425
+ let newHoverIndex = optionsOrder.indexOf(id);
426
+ hoverIndex !== newHoverIndex && this.setState({
427
+ hoverIndex: newHoverIndex
428
+ });
429
+ }
430
+
431
+ handleFilterSuggestions() {
432
+ let {
433
+ needLocalSearch,
434
+ excludeOptions = dummyArray // needSearch
435
+
436
+ } = this.props;
437
+ let {
438
+ options = dummyArray,
439
+ searchStr = ''
440
+ } = this.state; // if (
441
+ // (needSearch && searchStr && searchStr.trim().length) ||
442
+ // (excludeOptions && excludeOptions.length)
443
+ // ) {
444
+
445
+ searchStr = getSearchString(searchStr);
446
+ let {
447
+ suggestions,
448
+ suggestionIds
449
+ } = this.getFilterSuggestions({
450
+ options,
451
+ selectedOptions: excludeOptions,
452
+ searchStr,
453
+ needSearch: needLocalSearch
454
+ });
455
+ this.optionsOrder = suggestionIds;
456
+ return suggestions; // }
457
+ // return options;
458
+ }
459
+
460
+ handleScroll(e) {
461
+ let ele = e.target;
462
+ let isScrollReachedBottom = findScrollEnd(ele);
463
+ isScrollReachedBottom && this.handleGetNextOptions();
464
+ }
465
+
466
+ handleFetchOptions(APICall) {
467
+ let searchStr = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
468
+ // let funcArgs = args.slice(1, args.length);
469
+ let {
470
+ isFetchingOptions = false
471
+ } = this.state;
472
+ let {
473
+ _isMounted
474
+ } = this;
475
+
476
+ if (!isFetchingOptions && APICall) {
477
+ this.setState({
478
+ isFetchingOptions: true
479
+ });
480
+
481
+ try {
482
+ return APICall(searchStr).then(() => {
483
+ _isMounted && this.setState({
484
+ isFetchingOptions: false
485
+ });
486
+ }, () => {
487
+ _isMounted && this.setState({
488
+ isFetchingOptions: false
489
+ });
490
+ });
491
+ } catch (e) {
492
+ _isMounted && this.setState({
493
+ isFetchingOptions: false
494
+ });
495
+ }
496
+ }
497
+ }
498
+
499
+ handleGetNextOptions() {
500
+ let {
501
+ isNextOptions,
502
+ getNextOptions
503
+ } = this.props;
504
+ let {
505
+ searchStr
506
+ } = this.state;
507
+ isNextOptions && getNextOptions && this.handleFetchOptions(getNextOptions, searchStr);
508
+ }
509
+
510
+ togglePopup(e) {
511
+ let {
512
+ togglePopup,
513
+ isReadOnly,
514
+ defaultDropBoxPosition,
515
+ onFocus,
516
+ isPopupOpen
517
+ } = this.props;
518
+ !isReadOnly && togglePopup(e, defaultDropBoxPosition ? `${defaultDropBoxPosition}` : null);
519
+ !isPopupOpen && typeof onFocus === 'function' && onFocus(e);
520
+ }
521
+
522
+ handlePopupClose(e) {
523
+ let {
524
+ closePopupOnly
525
+ } = this.props;
526
+ this.valueInput && this.valueInput.focus({
527
+ preventScroll: true
528
+ });
529
+ closePopupOnly(e);
530
+ }
531
+
532
+ suggestionContainerRef(el) {
533
+ this.suggestionContainer = el;
534
+ }
535
+
536
+ suggestionItemRef(el, index, id) {
537
+ this[`suggestion_${id}`] = el;
538
+ }
539
+
540
+ searchInputRef(el) {
541
+ this.searchInput = el;
542
+ }
543
+
544
+ valueInputRef(el) {
545
+ let {
546
+ getRef
547
+ } = this.props;
548
+ this.valueInput = el;
549
+ getRef && getRef(el);
550
+ }
551
+
552
+ handleSelectFocus() {
553
+ let {
554
+ valueInput
555
+ } = this;
556
+ valueInput && valueInput.setSelectionRange(valueInput, 0);
557
+ }
558
+
559
+ handleClearSearch() {
560
+ this.handleSearch('');
561
+ setTimeout(() => {
562
+ this.searchInput && this.searchInput.focus({
563
+ preventScroll: true
564
+ });
565
+ }, 1);
566
+ }
567
+
568
+ handleValueInputChange(e) {
569
+ let typeString = getKeyValue(e);
570
+ let {
571
+ isPopupOpen,
572
+ autoSelectOnType
573
+ } = this.props;
574
+
575
+ if (!isPopupOpen && autoSelectOnType) {
576
+ this.valueInputTypeString += (typeString || '').trim();
577
+ this.handleChangeOnType();
578
+ }
579
+ }
580
+
581
+ handleChangeOnType() {
582
+ let {
583
+ excludeOptions = dummyArray
584
+ } = this.props;
585
+ let {
586
+ options = dummyArray
587
+ } = this.state;
588
+ let {
589
+ optionsOrder
590
+ } = this;
591
+ let typeString = this.valueInputTypeString;
592
+ this.valueInputTypeString = '';
593
+
594
+ let changeValue = () => {
595
+ let optionDetails = this.autoSelectSuggestions[this.autoSelectIndex];
596
+ let {
597
+ id
598
+ } = optionDetails || {};
599
+
600
+ if (!getIsEmptyValue(id)) {
601
+ this.handleChange(id);
602
+ let hoverIndex = optionsOrder.indexOf(id);
603
+ this.setState({
604
+ hoverIndex
605
+ });
606
+ }
607
+ };
608
+
609
+ if (typeString && typeString === this.valueInputSearchString) {
610
+ if (this.autoSelectIndex < this.autoSelectSuggestions.length - 1) {
611
+ this.autoSelectIndex += 1;
612
+ } else {
613
+ this.autoSelectIndex = 0;
614
+ }
615
+
616
+ changeValue();
617
+ } else if (typeString) {
618
+ this.valueInputSearchString = typeString;
619
+ let {
620
+ suggestions = []
621
+ } = this.getFilterSuggestions({
622
+ options,
623
+ selectedOptions: excludeOptions,
624
+ searchStr: typeString,
625
+ needSearch: true,
626
+ isStartsWithSearch: true
627
+ });
628
+ this.autoSelectIndex = 0;
629
+ this.autoSelectSuggestions = suggestions;
630
+ changeValue();
631
+ }
632
+ }
633
+
634
+ handleAddNewOption() {
635
+ let {
636
+ searchStr
637
+ } = this.state;
638
+ let {
639
+ onAddNewOption,
640
+ getCustomEmptyState
641
+ } = this.props;
642
+
643
+ if (getCustomEmptyState) {
644
+ this.setState({
645
+ searchStr: ''
646
+ });
647
+ this.handleFetchOptions(onAddNewOption, searchStr);
648
+ }
649
+ }
650
+
651
+ handleExposePopupHandlers() {
652
+ let {
653
+ removeClose,
654
+ openPopupOnly,
655
+ closePopupOnly,
656
+ togglePopup,
657
+ getPopupHandlers
658
+ } = this.props;
659
+ let methods = {
660
+ removeClose,
661
+ openPopup: openPopupOnly,
662
+ closePopup: closePopupOnly,
663
+ togglePopup
664
+ };
665
+ getPopupHandlers && getPopupHandlers(methods);
666
+ }
667
+
668
+ handleGetAddNewOptionText() {
669
+ let {
670
+ searchStr
671
+ } = this.state;
672
+ let {
673
+ getCustomEmptyState
674
+ } = this.props;
675
+ return getCustomEmptyState({
676
+ searchString: searchStr,
677
+ onAddNewOption: this.handleAddNewOption
678
+ });
679
+ }
680
+
681
+ render() {
682
+ let {
683
+ needSearch,
684
+ dropBoxSize,
685
+ emptyMessage,
686
+ searchEmptyMessage,
687
+ needBorder,
688
+ needSelectDownIcon,
689
+ position,
690
+ defaultDropBoxPosition,
691
+ getTargetRef,
692
+ getContainerRef,
693
+ removeClose,
694
+ isPopupOpen,
695
+ isPopupReady,
696
+ animationStyle,
697
+ textBoxSize,
698
+ textBoxVariant,
699
+ searchBoxSize,
700
+ searchBoxPlaceHolder,
701
+ maxLength,
702
+ isDisabled,
703
+ title,
704
+ size,
705
+ placeHolder,
706
+ className,
707
+ isReadOnly,
708
+ dataId,
709
+ needResponsive,
710
+ borderColor,
711
+ needTick,
712
+ listItemSize,
713
+ boxSize,
714
+ needListBorder,
715
+ getFooter,
716
+ getChildren,
717
+ getCustomEmptyState,
718
+ isParentBased,
719
+ i18nKeys,
720
+ htmlId,
721
+ children,
722
+ iconOnHover,
723
+ customProps,
724
+ autoComplete,
725
+ ariaLabelledby,
726
+ isLoading,
727
+ dataSelectorId,
728
+ isAbsolutePositioningNeeded,
729
+ positionsOffset,
730
+ targetOffset,
731
+ isRestrictScroll,
732
+ dropBoxPortalId
733
+ } = this.props;
734
+ let {
735
+ TextBoxIcon_i18n,
736
+ TextBox_ally_label = 'click to select options'
737
+ } = i18nKeys;
738
+ i18nKeys = Object.assign({}, i18nKeys, {
739
+ emptyText: i18nKeys.emptyText || emptyMessage,
740
+ searchEmptyText: i18nKeys.searchEmptyText || searchEmptyMessage
741
+ });
742
+ let {
743
+ hoverIndex,
744
+ selected,
745
+ searchStr,
746
+ isFetchingOptions,
747
+ selectedId,
748
+ options
749
+ } = this.state;
750
+ let suggestions = this.handleFilterSuggestions();
751
+ let setAriaId = this.getNextAriaId();
752
+ let ariaErrorId = this.getNextAriaId();
753
+ let {
754
+ TextBoxProps = {},
755
+ DropdownSearchTextBoxProps = {},
756
+ SuggestionsProps = {}
757
+ } = customProps;
758
+ return /*#__PURE__*/React.createElement("div", {
759
+ className: `${isParentBased || isReadOnly || isDisabled ? style.container : ''} ${style[`box_${size}`]} ${isReadOnly ? style.readonly : ''} ${borderColor === 'transparent' ? style.transparentContainer : ''} ${iconOnHover && (isReadOnly || isDisabled) ? style.iconOnHoverReadonly : iconOnHover && !(isReadOnly || isDisabled) ? style.iconOnHoverStyle : ''}`,
760
+ "data-title": isDisabled ? title : null,
761
+ "data-selector-id": dataSelectorId
762
+ }, /*#__PURE__*/React.createElement("div", {
763
+ className: `${className ? className : ''}`,
764
+ onClick: isDisabled || isReadOnly ? null : this.togglePopup,
765
+ ref: getTargetRef,
766
+ "data-id": `${isDisabled ? `${dataId}_disabled` : isReadOnly ? `${dataId}_readOnly` : dataId}`,
767
+ "data-test-id": `${isDisabled ? `${dataId}_disabled` : isReadOnly ? `${dataId}_readOnly` : dataId}`
768
+ }, needSelectDownIcon ? /*#__PURE__*/React.createElement(TextBoxIcon, {
769
+ a11y: {
770
+ role: 'Menuitem',
771
+ ariaLabel: TextBox_ally_label,
772
+ ariaControls: setAriaId,
773
+ ariaExpanded: !isReadOnly && !isDisabled && isPopupOpen ? true : false,
774
+ ariaHaspopup: true,
775
+ ariaReadonly: true,
776
+ ariaActivedescendant: selectedId,
777
+ ariaOwns: setAriaId,
778
+ ariaLabelledby: ariaLabelledby
779
+ },
780
+ isDisabled: isDisabled,
781
+ iconRotated: isPopupOpen,
782
+ inputRef: this.valueInputRef,
783
+ maxLength: maxLength,
784
+ needBorder: needBorder,
785
+ onFocus: this.handleSelectFocus,
786
+ onKeyDown: this.handleKeyDown,
787
+ placeHolder: placeHolder,
788
+ isReadOnly: true,
789
+ size: textBoxSize,
790
+ value: selected,
791
+ variant: textBoxVariant,
792
+ needReadOnlyStyle: isReadOnly ? true : false,
793
+ dataId: `${dataId}_textBox`,
794
+ isClickable: isReadOnly || isDisabled ? false : true,
795
+ customClass: {
796
+ customTBoxWrap: isReadOnly || isDisabled ? '' : style.input
797
+ },
798
+ needEffect: isReadOnly || isDisabled ? false : true,
799
+ onKeyPress: this.handleValueInputChange,
800
+ borderColor: borderColor,
801
+ htmlId: htmlId,
802
+ isFocus: isPopupReady,
803
+ autoComplete: autoComplete,
804
+ customProps: {
805
+ TextBoxProps: TextBoxProps
806
+ }
807
+ }, /*#__PURE__*/React.createElement(Container, {
808
+ alignBox: "row",
809
+ align: "both"
810
+ }, children ? /*#__PURE__*/React.createElement(Box, {
811
+ className: isPopupOpen ? style.rotate : '',
812
+ dataId: `${dataId}_children`
813
+ }, children) : null, /*#__PURE__*/React.createElement(Container, {
814
+ align: "both",
815
+ dataId: `${dataId}_downIcon`,
816
+ "aria-hidden": true,
817
+ className: style.arrowIcon
818
+ }, /*#__PURE__*/React.createElement(Icon, {
819
+ name: "ZD-down",
820
+ size: "7"
821
+ })))) : /*#__PURE__*/React.createElement(Textbox, {
822
+ a11y: {
823
+ role: 'Menuitem',
824
+ ariaLabel: TextBox_ally_label,
825
+ ariaControls: setAriaId,
826
+ ariaExpanded: !isReadOnly && !isDisabled && isPopupOpen ? true : false,
827
+ ariaHaspopup: true,
828
+ ariaReadonly: true,
829
+ ariaActivedescendant: selectedId,
830
+ ariaOwns: setAriaId,
831
+ ariaLabelledby: ariaLabelledby
832
+ },
833
+ isDisabled: isDisabled,
834
+ inputRef: this.valueInputRef,
835
+ maxLength: maxLength,
836
+ needBorder: needBorder,
837
+ onFocus: this.handleSelectFocus,
838
+ onKeyDown: getChildren && this.handleKeyDown,
839
+ placeHolder: placeHolder,
840
+ isReadOnly: true,
841
+ needEffect: isReadOnly || isDisabled ? false : true,
842
+ size: textBoxSize,
843
+ value: selected,
844
+ variant: textBoxVariant,
845
+ needReadOnlyStyle: isReadOnly ? true : false,
846
+ dataId: `${dataId}_textBox`,
847
+ isClickable: isReadOnly || isDisabled ? false : true,
848
+ onKeyPress: this.handleValueInputChange,
849
+ borderColor: borderColor,
850
+ htmlId: htmlId,
851
+ autoComplete: autoComplete,
852
+ isFocus: isPopupReady,
853
+ customProps: TextBoxProps
854
+ })), !isReadOnly && !isDisabled && isPopupOpen ? /*#__PURE__*/React.createElement(ResponsiveReceiver, {
855
+ query: this.responsiveFunc,
856
+ responsiveId: "Helmet"
857
+ }, _ref2 => {
858
+ let {
859
+ tabletMode
860
+ } = _ref2;
861
+ return /*#__PURE__*/React.createElement(ResponsiveDropBox, {
862
+ animationStyle: animationStyle,
863
+ boxPosition: position || `${defaultDropBoxPosition}`,
864
+ getRef: getContainerRef,
865
+ isActive: isPopupReady,
866
+ isAnimate: true,
867
+ isArrow: false,
868
+ onClick: removeClose,
869
+ needResponsive: needResponsive,
870
+ dataId: `${dataId}_suggestions`,
871
+ size: boxSize,
872
+ isPadding: false,
873
+ isResponsivePadding: getFooter ? false : true,
874
+ alignBox: "row",
875
+ isAbsolutePositioningNeeded: isAbsolutePositioningNeeded,
876
+ positionsOffset: positionsOffset,
877
+ targetOffset: targetOffset,
878
+ isRestrictScroll: isRestrictScroll,
879
+ portalId: dropBoxPortalId
880
+ }, isLoading ? /*#__PURE__*/React.createElement(Container, {
881
+ align: "both",
882
+ className: style.loader
883
+ }, /*#__PURE__*/React.createElement(Loader, null)) : /*#__PURE__*/React.createElement(React.Fragment, null, !getChildren ? /*#__PURE__*/React.createElement(Box, {
884
+ flexible: true
885
+ }, /*#__PURE__*/React.createElement(Card, {
886
+ onScroll: this.handleScroll
887
+ }, needSearch ? /*#__PURE__*/React.createElement(CardHeader, null, /*#__PURE__*/React.createElement("div", {
888
+ className: `${style.search} ${style[size]}`
889
+ }, /*#__PURE__*/React.createElement(TextBoxIcon, {
890
+ a11y: {
891
+ ariaControls: setAriaId,
892
+ ariaAutocomplete: 'list',
893
+ ariaDescribedby: ariaErrorId
894
+ },
895
+ inputRef: this.searchInputRef,
896
+ maxLength: maxLength,
897
+ onChange: this.handleSearch,
898
+ onKeyDown: this.handleKeyDown,
899
+ placeHolder: searchBoxPlaceHolder,
900
+ size: searchBoxSize,
901
+ value: searchStr,
902
+ onClear: this.handleClearSearch,
903
+ dataId: `${dataId}_search`,
904
+ i18nKeys: TextBoxIcon_i18n,
905
+ autoComplete: autoComplete,
906
+ customProps: {
907
+ TextBoxProps: DropdownSearchTextBoxProps
908
+ }
909
+ }))) : null, /*#__PURE__*/React.createElement(CardContent, {
910
+ shrink: true,
911
+ customClass: !tabletMode && dropBoxSize ? style[dropBoxSize] : '',
912
+ eleRef: this.suggestionContainerRef
913
+ }, suggestions.length ? /*#__PURE__*/React.createElement(Suggestions, _extends({
914
+ activeId: selectedId,
915
+ suggestions: suggestions,
916
+ getRef: this.suggestionItemRef,
917
+ hoverOption: hoverIndex,
918
+ onClick: this.handleChange,
919
+ onMouseEnter: this.handleMouseEnter,
920
+ dataId: `${dataId}_Options`,
921
+ needTick: needTick,
922
+ needBorder: needListBorder,
923
+ selectedOptions: [selectedId],
924
+ className: `${tabletMode ? style.responsivelistItemContainer : style.listItemContainer}`,
925
+ listItemSize: listItemSize,
926
+ htmlId: setAriaId,
927
+ a11y: {
928
+ ariaParentRole: 'listbox',
929
+ role: 'option'
930
+ }
931
+ }, SuggestionsProps)) : /*#__PURE__*/React.createElement(EmptyState, {
932
+ isLoading: isFetchingOptions,
933
+ options: options,
934
+ searchString: searchStr,
935
+ suggestions: suggestions,
936
+ dataId: dataId,
937
+ getCustomEmptyState: getCustomEmptyState ? this.handleGetAddNewOptionText : null,
938
+ i18nKeys: i18nKeys,
939
+ htmlId: ariaErrorId
940
+ }), isFetchingOptions && /*#__PURE__*/React.createElement(Container, {
941
+ isCover: false,
942
+ align: "both"
943
+ }, /*#__PURE__*/React.createElement(Loader, null))), getFooter ? /*#__PURE__*/React.createElement(CardFooter, null, getFooter()) : null)) : /*#__PURE__*/React.createElement(Box, {
944
+ flexible: true
945
+ }, getChildren())));
946
+ }) : null);
947
+ }
948
+
949
+ }
950
+ SelectComponent.propTypes = Select_propTypes;
951
+ SelectComponent.defaultProps = Select_defaultProps;
952
+ SelectComponent.displayName = 'Select';
953
+ let Select = Popup(SelectComponent);
954
+ Select.defaultProps = SelectComponent.defaultProps;
955
+ Select.propTypes = Select_propTypes;
956
+ Select.displayName = 'Select';
957
+ export default Select; // if (__DOCS__) {
958
+ // Select.docs = {
959
+ // componentGroup: 'Form Elements',
960
+ // folderName: 'Style Guide',
961
+ // external: true,
962
+ // description: ' '
963
+ // };
964
+ // // eslint-disable-next-line react/forbid-foreign-prop-types
965
+ // Select.propTypes = SelectComponent.propTypes;
966
+ // }