@zohodesk/components 1.2.4 → 1.2.6

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 (202) hide show
  1. package/README.md +8 -0
  2. package/coverage/Button/Button.js.html +1 -1
  3. package/coverage/Button/css/Button.module.css.html +1 -1
  4. package/coverage/Button/css/cssJSLogic.js.html +1 -1
  5. package/coverage/Button/css/index.html +1 -1
  6. package/coverage/Button/index.html +1 -1
  7. package/coverage/Button/props/defaultProps.js.html +1 -1
  8. package/coverage/Button/props/index.html +1 -1
  9. package/coverage/Button/props/propTypes.js.html +1 -1
  10. package/coverage/Buttongroup/Buttongroup.js.html +1 -1
  11. package/coverage/Buttongroup/Buttongroup.module.css.html +1 -1
  12. package/coverage/Buttongroup/index.html +1 -1
  13. package/coverage/Buttongroup/props/defaultProps.js.html +1 -1
  14. package/coverage/Buttongroup/props/index.html +1 -1
  15. package/coverage/Buttongroup/props/propTypes.js.html +1 -1
  16. package/coverage/index.html +1 -1
  17. package/coverage/utils/dummyFunction.js.html +1 -1
  18. package/coverage/utils/index.html +1 -1
  19. package/es/AppContainer/AppContainer.js +3 -0
  20. package/es/v1/Accordion/Accordion.js +65 -0
  21. package/es/v1/Accordion/AccordionItem.js +57 -0
  22. package/es/v1/Accordion/index.js +2 -0
  23. package/es/v1/Animation/Animation.js +127 -0
  24. package/es/v1/AppContainer/AppContainer.js +137 -0
  25. package/es/v1/Avatar/Avatar.js +189 -0
  26. package/es/v1/AvatarTeam/AvatarTeam.js +70 -0
  27. package/es/v1/Button/Button.js +68 -0
  28. package/es/v1/Buttongroup/Buttongroup.js +31 -0
  29. package/es/v1/Card/Card.js +271 -0
  30. package/es/v1/CheckBox/CheckBox.js +155 -0
  31. package/es/v1/DateTime/CalendarView.js +218 -0
  32. package/es/v1/DateTime/DateTime.js +783 -0
  33. package/es/v1/DateTime/DateTimePopupFooter.js +47 -0
  34. package/es/v1/DateTime/DateTimePopupHeader.js +105 -0
  35. package/es/v1/DateTime/DateWidget.js +1098 -0
  36. package/es/v1/DateTime/DaysRow.js +31 -0
  37. package/es/v1/DateTime/Time.js +166 -0
  38. package/es/v1/DateTime/YearView.js +264 -0
  39. package/es/v1/DateTime/index.js +1 -0
  40. package/es/v1/DropBox/DropBox.js +91 -0
  41. package/es/v1/DropBox/DropBoxElement/DropBoxElement.js +132 -0
  42. package/es/v1/DropDown/DropDown.js +73 -0
  43. package/es/v1/DropDown/DropDownHeading.js +44 -0
  44. package/es/v1/DropDown/DropDownItem.js +76 -0
  45. package/es/v1/DropDown/DropDownSearch.js +63 -0
  46. package/es/v1/DropDown/DropDownSeparator.js +15 -0
  47. package/es/v1/Heading/Heading.js +32 -0
  48. package/es/v1/Label/Label.js +40 -0
  49. package/es/v1/Layout/Box.js +115 -0
  50. package/es/v1/Layout/Container.js +132 -0
  51. package/es/v1/Layout/index.js +2 -0
  52. package/es/v1/ListItem/ListContainer.js +102 -0
  53. package/es/v1/ListItem/ListItem.js +124 -0
  54. package/es/v1/ListItem/ListItemWithAvatar.js +145 -0
  55. package/es/v1/ListItem/ListItemWithCheckBox.js +104 -0
  56. package/es/v1/ListItem/ListItemWithIcon.js +127 -0
  57. package/es/v1/ListItem/ListItemWithRadio.js +105 -0
  58. package/es/v1/ListItem/index.js +6 -0
  59. package/es/v1/Modal/Modal.js +154 -0
  60. package/es/v1/MultiSelect/AdvancedGroupMultiSelect.js +1079 -0
  61. package/es/v1/MultiSelect/AdvancedMultiSelect.js +568 -0
  62. package/es/v1/MultiSelect/EmptyState.js +64 -0
  63. package/es/v1/MultiSelect/MobileHeader/MobileHeader.js +50 -0
  64. package/es/v1/MultiSelect/MultiSelect.js +1120 -0
  65. package/es/v1/MultiSelect/MultiSelectHeader.js +32 -0
  66. package/es/v1/MultiSelect/MultiSelectWithAvatar.js +216 -0
  67. package/es/v1/MultiSelect/SelectedOptions.js +82 -0
  68. package/es/v1/MultiSelect/Suggestions.js +142 -0
  69. package/es/v1/MultiSelect/index.js +4 -0
  70. package/es/v1/PopOver/PopOver.js +211 -0
  71. package/es/v1/Popup/Popup.js +645 -0
  72. package/es/v1/Radio/Radio.js +115 -0
  73. package/es/v1/Responsive/CustomResponsive.js +195 -0
  74. package/es/v1/Responsive/RefWrapper.js +39 -0
  75. package/es/v1/Responsive/ResizeComponent.js +197 -0
  76. package/es/v1/Responsive/ResizeObserver.js +140 -0
  77. package/es/v1/Responsive/Responsive.js +194 -0
  78. package/es/v1/Responsive/index.js +9 -0
  79. package/es/v1/ResponsiveDropBox/ResponsiveDropBox.js +58 -0
  80. package/es/v1/Ribbon/Ribbon.js +33 -0
  81. package/es/v1/RippleEffect/RippleEffect.js +24 -0
  82. package/es/v1/Select/GroupSelect.js +803 -0
  83. package/es/v1/Select/Select.js +969 -0
  84. package/es/v1/Select/SelectWithAvatar.js +344 -0
  85. package/es/v1/Select/SelectWithIcon.js +535 -0
  86. package/es/v1/Select/index.js +4 -0
  87. package/es/v1/Stencils/Stencils.js +26 -0
  88. package/es/v1/Switch/Switch.js +94 -0
  89. package/es/v1/Tab/Tab.js +108 -0
  90. package/es/v1/Tab/TabContent.js +30 -0
  91. package/es/v1/Tab/TabContentWrapper.js +29 -0
  92. package/es/v1/Tab/TabWrapper.js +57 -0
  93. package/es/v1/Tab/Tabs.js +612 -0
  94. package/es/v1/Tab/index.js +5 -0
  95. package/es/v1/Tag/Tag.js +134 -0
  96. package/es/v1/TextBox/TextBox.js +154 -0
  97. package/es/v1/TextBoxIcon/TextBoxIcon.js +158 -0
  98. package/es/v1/Textarea/Textarea.js +102 -0
  99. package/es/v1/Tooltip/Tooltip.js +518 -0
  100. package/es/v1/Typography/Typography.js +38 -0
  101. package/es/v1/Typography/css/Typography.module.css +376 -0
  102. package/es/v1/Typography/css/cssJSLogic.js +46 -0
  103. package/es/v1/Typography/css/letterSpacingMap.js +12 -0
  104. package/es/v1/Typography/props/defaultProps.js +8 -0
  105. package/es/v1/Typography/props/propTypes.js +24 -0
  106. package/es/v1/VelocityAnimation/VelocityAnimation/VelocityAnimation.js +69 -0
  107. package/es/v1/VelocityAnimation/VelocityAnimationGroup/VelocityAnimationGroup.js +100 -0
  108. package/es/v1/semantic/Button/Button.js +53 -0
  109. package/es/v1/semantic/index.js +1 -0
  110. package/lib/AppContainer/AppContainer.js +5 -0
  111. package/lib/v1/Accordion/Accordion.js +96 -0
  112. package/lib/v1/Accordion/AccordionItem.js +68 -0
  113. package/lib/v1/Accordion/index.js +23 -0
  114. package/lib/v1/Animation/Animation.js +143 -0
  115. package/lib/v1/AppContainer/AppContainer.js +209 -0
  116. package/lib/v1/Avatar/Avatar.js +246 -0
  117. package/lib/v1/AvatarTeam/AvatarTeam.js +81 -0
  118. package/lib/v1/Button/Button.js +82 -0
  119. package/lib/v1/Buttongroup/Buttongroup.js +44 -0
  120. package/lib/v1/Card/Card.js +365 -0
  121. package/lib/v1/CheckBox/CheckBox.js +166 -0
  122. package/lib/v1/DateTime/CalendarView.js +285 -0
  123. package/lib/v1/DateTime/DateTime.js +872 -0
  124. package/lib/v1/DateTime/DateTimePopupFooter.js +96 -0
  125. package/lib/v1/DateTime/DateTimePopupHeader.js +166 -0
  126. package/lib/v1/DateTime/DateWidget.js +1125 -0
  127. package/lib/v1/DateTime/DaysRow.js +80 -0
  128. package/lib/v1/DateTime/Time.js +254 -0
  129. package/lib/v1/DateTime/YearView.js +325 -0
  130. package/lib/v1/DateTime/index.js +15 -0
  131. package/lib/v1/DropBox/DropBox.js +119 -0
  132. package/lib/v1/DropBox/DropBoxElement/DropBoxElement.js +145 -0
  133. package/lib/v1/DropDown/DropDown.js +170 -0
  134. package/lib/v1/DropDown/DropDownHeading.js +93 -0
  135. package/lib/v1/DropDown/DropDownItem.js +127 -0
  136. package/lib/v1/DropDown/DropDownSearch.js +113 -0
  137. package/lib/v1/DropDown/DropDownSeparator.js +64 -0
  138. package/lib/v1/Heading/Heading.js +49 -0
  139. package/lib/v1/Label/Label.js +51 -0
  140. package/lib/v1/Layout/Box.js +128 -0
  141. package/lib/v1/Layout/Container.js +145 -0
  142. package/lib/v1/Layout/index.js +23 -0
  143. package/lib/v1/ListItem/ListContainer.js +120 -0
  144. package/lib/v1/ListItem/ListItem.js +138 -0
  145. package/lib/v1/ListItem/ListItemWithAvatar.js +162 -0
  146. package/lib/v1/ListItem/ListItemWithCheckBox.js +125 -0
  147. package/lib/v1/ListItem/ListItemWithIcon.js +143 -0
  148. package/lib/v1/ListItem/ListItemWithRadio.js +126 -0
  149. package/lib/v1/ListItem/index.js +55 -0
  150. package/lib/v1/Modal/Modal.js +212 -0
  151. package/lib/v1/MultiSelect/AdvancedGroupMultiSelect.js +1167 -0
  152. package/lib/v1/MultiSelect/AdvancedMultiSelect.js +634 -0
  153. package/lib/v1/MultiSelect/EmptyState.js +112 -0
  154. package/lib/v1/MultiSelect/MobileHeader/MobileHeader.js +62 -0
  155. package/lib/v1/MultiSelect/MultiSelect.js +1201 -0
  156. package/lib/v1/MultiSelect/MultiSelectHeader.js +78 -0
  157. package/lib/v1/MultiSelect/MultiSelectWithAvatar.js +270 -0
  158. package/lib/v1/MultiSelect/SelectedOptions.js +126 -0
  159. package/lib/v1/MultiSelect/Suggestions.js +195 -0
  160. package/lib/v1/MultiSelect/index.js +39 -0
  161. package/lib/v1/PopOver/PopOver.js +293 -0
  162. package/lib/v1/Popup/Popup.js +715 -0
  163. package/lib/v1/Radio/Radio.js +126 -0
  164. package/lib/v1/Responsive/CustomResponsive.js +242 -0
  165. package/lib/v1/Responsive/RefWrapper.js +57 -0
  166. package/lib/v1/Responsive/ResizeComponent.js +268 -0
  167. package/lib/v1/Responsive/ResizeObserver.js +168 -0
  168. package/lib/v1/Responsive/Responsive.js +274 -0
  169. package/lib/v1/Responsive/index.js +55 -0
  170. package/lib/v1/ResponsiveDropBox/ResponsiveDropBox.js +79 -0
  171. package/lib/v1/Ribbon/Ribbon.js +44 -0
  172. package/lib/v1/RippleEffect/RippleEffect.js +39 -0
  173. package/lib/v1/Select/GroupSelect.js +877 -0
  174. package/lib/v1/Select/Select.js +1013 -0
  175. package/lib/v1/Select/SelectWithAvatar.js +394 -0
  176. package/lib/v1/Select/SelectWithIcon.js +597 -0
  177. package/lib/v1/Select/index.js +39 -0
  178. package/lib/v1/Stencils/Stencils.js +43 -0
  179. package/lib/v1/Switch/Switch.js +108 -0
  180. package/lib/v1/Tab/Tab.js +132 -0
  181. package/lib/v1/Tab/TabContent.js +42 -0
  182. package/lib/v1/Tab/TabContentWrapper.js +42 -0
  183. package/lib/v1/Tab/TabWrapper.js +89 -0
  184. package/lib/v1/Tab/Tabs.js +680 -0
  185. package/lib/v1/Tab/index.js +47 -0
  186. package/lib/v1/Tag/Tag.js +154 -0
  187. package/lib/v1/TextBox/TextBox.js +168 -0
  188. package/lib/v1/TextBoxIcon/TextBoxIcon.js +196 -0
  189. package/lib/v1/Textarea/Textarea.js +118 -0
  190. package/lib/v1/Tooltip/Tooltip.js +586 -0
  191. package/lib/v1/Typography/Typography.js +56 -0
  192. package/lib/v1/Typography/css/Typography.module.css +376 -0
  193. package/lib/v1/Typography/css/cssJSLogic.js +41 -0
  194. package/lib/v1/Typography/css/letterSpacingMap.js +20 -0
  195. package/lib/v1/Typography/props/defaultProps.js +15 -0
  196. package/lib/v1/Typography/props/propTypes.js +35 -0
  197. package/lib/v1/VelocityAnimation/VelocityAnimation/VelocityAnimation.js +90 -0
  198. package/lib/v1/VelocityAnimation/VelocityAnimationGroup/VelocityAnimationGroup.js +126 -0
  199. package/lib/v1/semantic/Button/Button.js +63 -0
  200. package/lib/v1/semantic/index.js +15 -0
  201. package/package.json +1 -1
  202. package/result.json +1 -1
@@ -0,0 +1,877 @@
1
+ "use strict";
2
+
3
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports["default"] = exports.GroupSelectComponent = void 0;
9
+
10
+ var _react = _interopRequireWildcard(require("react"));
11
+
12
+ var _defaultProps = require("../../Select/props/defaultProps");
13
+
14
+ var _propTypes = require("../../Select/props/propTypes");
15
+
16
+ var _Popup = _interopRequireDefault(require("../Popup/Popup"));
17
+
18
+ var _TextBoxIcon = _interopRequireDefault(require("../TextBoxIcon/TextBoxIcon"));
19
+
20
+ var _TextBox = _interopRequireDefault(require("../TextBox/TextBox"));
21
+
22
+ var _Card = _interopRequireWildcard(require("../Card/Card"));
23
+
24
+ var _Suggestions = _interopRequireDefault(require("../MultiSelect/Suggestions"));
25
+
26
+ var _EmptyState = _interopRequireDefault(require("../MultiSelect/EmptyState"));
27
+
28
+ var _icons = require("@zohodesk/icons");
29
+
30
+ var _Loader = _interopRequireDefault(require("@zohodesk/svg/lib/Loader/Loader"));
31
+
32
+ var _DropDownHeading = _interopRequireDefault(require("../DropDown/DropDownHeading"));
33
+
34
+ var _Layout = require("../Layout");
35
+
36
+ var _IdProvider = require("../../Provider/IdProvider");
37
+
38
+ var _ResponsiveDropBox = _interopRequireDefault(require("../ResponsiveDropBox/ResponsiveDropBox"));
39
+
40
+ var _CustomResponsive = require("../Responsive/CustomResponsive");
41
+
42
+ var _SelectModule = _interopRequireDefault(require("../../Select/Select.module.css"));
43
+
44
+ var _dropDownUtils = require("../../utils/dropDownUtils");
45
+
46
+ var _Common = require("../../utils/Common");
47
+
48
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
49
+
50
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
51
+
52
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
53
+
54
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
55
+
56
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
57
+
58
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
59
+
60
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
61
+
62
+ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
63
+
64
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
65
+
66
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
67
+
68
+ function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
69
+
70
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
71
+
72
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
73
+
74
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
75
+
76
+ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
77
+
78
+ function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
79
+
80
+ function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
81
+
82
+ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
83
+
84
+ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
85
+
86
+ /* eslint-disable react/no-unused-prop-types */
87
+
88
+ /* eslint-disable react/sort-prop-types */
89
+
90
+ /* eslint-disable react/forbid-component-props */
91
+ var GroupSelectComponent = /*#__PURE__*/function (_PureComponent) {
92
+ _inherits(GroupSelectComponent, _PureComponent);
93
+
94
+ var _super = _createSuper(GroupSelectComponent);
95
+
96
+ function GroupSelectComponent(props) {
97
+ var _this;
98
+
99
+ _classCallCheck(this, GroupSelectComponent);
100
+
101
+ _this = _super.call(this, props);
102
+ _this.getNextAriaId = (0, _IdProvider.getUniqueId)(_assertThisInitialized(_this));
103
+ var _props$autoSelectDebo = props.autoSelectDebouneTime,
104
+ autoSelectDebouneTime = _props$autoSelectDebo === void 0 ? 350 : _props$autoSelectDebo,
105
+ _props$searchDebounce = props.searchDebounceTime,
106
+ searchDebounceTime = _props$searchDebounce === void 0 ? 500 : _props$searchDebounce;
107
+ _this.getGroupSelectOptions = (0, _dropDownUtils.makeGetGroupSelectOptions)();
108
+ _this.getFilterSuggestions = (0, _dropDownUtils.makeGetGroupSelectFilterSuggestions)();
109
+ _this.handleGetGroupSelectOptions = _this.handleGetGroupSelectOptions.bind(_assertThisInitialized(_this));
110
+ _this.handleGetSelectedId = _this.handleGetSelectedId.bind(_assertThisInitialized(_this));
111
+ _this.handleFilterSuggestions = _this.handleFilterSuggestions.bind(_assertThisInitialized(_this));
112
+ _this.handleSearch = _this.handleSearch.bind(_assertThisInitialized(_this));
113
+ _this.handleKeyDown = _this.handleKeyDown.bind(_assertThisInitialized(_this));
114
+ _this.handleMouseEnter = _this.handleMouseEnter.bind(_assertThisInitialized(_this));
115
+ _this.handleChange = _this.handleChange.bind(_assertThisInitialized(_this));
116
+ _this.togglePopup = _this.togglePopup.bind(_assertThisInitialized(_this));
117
+ _this.handlePopupClose = _this.handlePopupClose.bind(_assertThisInitialized(_this));
118
+ _this.suggestionContainerRef = _this.suggestionContainerRef.bind(_assertThisInitialized(_this));
119
+ _this.suggestionItemRef = _this.suggestionItemRef.bind(_assertThisInitialized(_this));
120
+ _this.searchInputRef = _this.searchInputRef.bind(_assertThisInitialized(_this));
121
+ _this.valueInputRef = _this.valueInputRef.bind(_assertThisInitialized(_this));
122
+ _this.handleSelectFocus = _this.handleSelectFocus.bind(_assertThisInitialized(_this));
123
+ _this.handleClearSearch = _this.handleClearSearch.bind(_assertThisInitialized(_this));
124
+ _this.handleValueInputChange = _this.handleValueInputChange.bind(_assertThisInitialized(_this));
125
+ _this.handleChangeOnType = (0, _Common.debounce)(_this.handleChangeOnType.bind(_assertThisInitialized(_this)), autoSelectDebouneTime);
126
+ _this.handleFetchOptions = _this.handleFetchOptions.bind(_assertThisInitialized(_this));
127
+ _this.handleGetNextOptions = _this.handleGetNextOptions.bind(_assertThisInitialized(_this));
128
+ _this.handleScroll = _this.handleScroll.bind(_assertThisInitialized(_this));
129
+ _this.handleSearchOptions = (0, _Common.debounce)(_this.handleSearchOptions.bind(_assertThisInitialized(_this)), searchDebounceTime);
130
+ _this.valueInputTypeString = '';
131
+ _this.valueInputSearchString = '';
132
+ _this.autoSelectSuggestions = [];
133
+ _this.autoSelectIndex = 0;
134
+
135
+ var _this$handleGetGroupS = _this.handleGetGroupSelectOptions(props),
136
+ revampedGroups = _this$handleGetGroupS.revampedGroups,
137
+ normalizedAllOptions = _this$handleGetGroupS.normalizedAllOptions,
138
+ normalizedFormatOptions = _this$handleGetGroupS.normalizedFormatOptions,
139
+ allOptionIds = _this$handleGetGroupS.allOptionIds;
140
+
141
+ var _this$handleGetSelect = _this.handleGetSelectedId(props, allOptionIds),
142
+ selectedId = _this$handleGetSelect.selectedId,
143
+ hoverIndex = _this$handleGetSelect.hoverIndex;
144
+
145
+ _this.normalizedAllOptions = normalizedAllOptions;
146
+ _this.normalizedFormatOptions = normalizedFormatOptions;
147
+ _this.state = {
148
+ revampedGroups: revampedGroups,
149
+ allOptionIds: allOptionIds,
150
+ selectedId: selectedId,
151
+ hoverIndex: hoverIndex,
152
+ searchStr: '',
153
+ isFetchingOptions: false
154
+ };
155
+ _this._isMounted = false;
156
+ return _this;
157
+ }
158
+
159
+ _createClass(GroupSelectComponent, [{
160
+ key: "componentDidMount",
161
+ value: function componentDidMount() {
162
+ this._isMounted = true;
163
+ }
164
+ }, {
165
+ key: "componentDidUpdate",
166
+ value: function componentDidUpdate(prevProps) {
167
+ var _this2 = this;
168
+
169
+ var _this$props = this.props,
170
+ groupedOptions = _this$props.groupedOptions,
171
+ selectedOption = _this$props.selectedOption,
172
+ isPopupOpen = _this$props.isPopupOpen,
173
+ needSearch = _this$props.needSearch,
174
+ isSearchClearOnClose = _this$props.isSearchClearOnClose;
175
+ var _this$state = this.state,
176
+ allOptionIds = _this$state.allOptionIds,
177
+ hoverIndex = _this$state.hoverIndex,
178
+ selectedId = _this$state.selectedId,
179
+ searchStr = _this$state.searchStr;
180
+ var suggestionContainer = this.suggestionContainer;
181
+ var newOptionIds = allOptionIds;
182
+ var newSelectedId = selectedId;
183
+
184
+ if (groupedOptions !== prevProps.groupedOptions) {
185
+ var _this$handleGetGroupS2 = this.handleGetGroupSelectOptions(this.props),
186
+ revampedGroups = _this$handleGetGroupS2.revampedGroups,
187
+ normalizedAllOptions = _this$handleGetGroupS2.normalizedAllOptions,
188
+ _allOptionIds = _this$handleGetGroupS2.allOptionIds,
189
+ normalizedFormatOptions = _this$handleGetGroupS2.normalizedFormatOptions;
190
+
191
+ this.normalizedAllOptions = normalizedAllOptions;
192
+ this.normalizedFormatOptions = normalizedFormatOptions;
193
+ newOptionIds = _allOptionIds;
194
+ this.setState({
195
+ revampedGroups: revampedGroups,
196
+ allOptionIds: _allOptionIds
197
+ });
198
+ }
199
+
200
+ if (selectedOption !== prevProps.selectedOption) {
201
+ var _this$handleGetSelect2 = this.handleGetSelectedId(this.props, newOptionIds),
202
+ _selectedId = _this$handleGetSelect2.selectedId,
203
+ _hoverIndex = _this$handleGetSelect2.hoverIndex;
204
+
205
+ newSelectedId = _selectedId;
206
+ this.setState({
207
+ selectedId: _selectedId,
208
+ hoverIndex: _hoverIndex
209
+ });
210
+ }
211
+
212
+ var _this$handleFilterSug = this.handleFilterSuggestions(),
213
+ suggestionOptionIds = _this$handleFilterSug.suggestionOptionIds;
214
+
215
+ var hoverId = (0, _Common.getIsEmptyValue)(suggestionOptionIds[hoverIndex]) ? '' : suggestionOptionIds[hoverIndex];
216
+ var selSuggestion = this["suggestion_".concat(hoverId)];
217
+ isPopupOpen && (0, _Common.scrollTo)(suggestionContainer, selSuggestion);
218
+
219
+ if (isPopupOpen !== prevProps.isPopupOpen) {
220
+ if (isPopupOpen) {
221
+ setTimeout(function () {
222
+ _this2.searchInput && _this2.searchInput.focus({
223
+ preventScroll: true
224
+ });
225
+ }, 10);
226
+ } else {
227
+ // needSearch && this.valueInput && this.valueInput.focus({preventScroll:true});
228
+ isSearchClearOnClose && searchStr && this.handleSearch('');
229
+
230
+ var _hoverIndex2 = newOptionIds.indexOf(newSelectedId);
231
+
232
+ _hoverIndex2 = _hoverIndex2 >= 0 ? _hoverIndex2 : 0;
233
+ this.setState({
234
+ hoverIndex: _hoverIndex2
235
+ });
236
+ }
237
+ }
238
+ }
239
+ }, {
240
+ key: "componentWillUnmount",
241
+ value: function componentWillUnmount() {
242
+ this._isMounted = false;
243
+ }
244
+ }, {
245
+ key: "handleGetGroupSelectOptions",
246
+ value: function handleGetGroupSelectOptions(props) {
247
+ var groupedOptions = props.groupedOptions;
248
+ return this.getGroupSelectOptions({
249
+ groupedOptions: groupedOptions
250
+ });
251
+ }
252
+ }, {
253
+ key: "handleGetSelectedId",
254
+ value: function handleGetSelectedId(props, allOptionIds) {
255
+ var selectedOption = props.selectedOption,
256
+ isDefaultSelectValue = props.isDefaultSelectValue;
257
+ var selected = selectedOption.selected,
258
+ groupId = selectedOption.groupId;
259
+ var selectedId = (0, _dropDownUtils.optionIdGrouping)(selected, groupId);
260
+ var selectedIdIndex = allOptionIds.indexOf(selectedId);
261
+
262
+ if (selectedIdIndex === -1) {
263
+ selectedIdIndex = 0;
264
+
265
+ if (isDefaultSelectValue) {
266
+ var _allOptionIds2 = _slicedToArray(allOptionIds, 1);
267
+
268
+ selectedId = _allOptionIds2[0];
269
+ } else {
270
+ selectedId = '';
271
+ }
272
+ }
273
+
274
+ return {
275
+ selectedId: selectedId,
276
+ hoverIndex: selectedIdIndex
277
+ };
278
+ }
279
+ }, {
280
+ key: "handleFilterSuggestions",
281
+ value: function handleFilterSuggestions() {
282
+ var _this$props2 = this.props,
283
+ needSearch = _this$props2.needSearch,
284
+ needLocalSearch = _this$props2.needLocalSearch;
285
+ var _this$state2 = this.state,
286
+ revampedGroups = _this$state2.revampedGroups,
287
+ _this$state2$searchSt = _this$state2.searchStr,
288
+ searchStr = _this$state2$searchSt === void 0 ? '' : _this$state2$searchSt,
289
+ allOptionIds = _this$state2.allOptionIds;
290
+
291
+ if (needSearch && searchStr && searchStr.trim().length) {
292
+ searchStr = (0, _Common.getSearchString)(searchStr);
293
+
294
+ var _this$getFilterSugges = this.getFilterSuggestions({
295
+ revampedGroups: revampedGroups,
296
+ searchStr: searchStr,
297
+ needSearch: needLocalSearch
298
+ }),
299
+ suggestionGroups = _this$getFilterSugges.suggestionGroups,
300
+ suggestionOptionIds = _this$getFilterSugges.suggestionOptionIds;
301
+
302
+ return {
303
+ suggestionGroups: suggestionGroups,
304
+ suggestionOptionIds: suggestionOptionIds
305
+ };
306
+ }
307
+
308
+ return {
309
+ suggestionGroups: revampedGroups,
310
+ suggestionOptionIds: allOptionIds
311
+ };
312
+ }
313
+ }, {
314
+ key: "handleSearchOptions",
315
+ value: function handleSearchOptions() {
316
+ var onSearch = this.props.onSearch;
317
+ var searchStr = this.state.searchStr;
318
+ searchStr && this.handleFetchOptions(onSearch, searchStr);
319
+ }
320
+ }, {
321
+ key: "handleSearch",
322
+ value: function handleSearch(value) {
323
+ var _this3 = this;
324
+
325
+ // let { value = '' } = e.target;
326
+ var _this$state$searchStr = this.state.searchStr,
327
+ searchStr = _this$state$searchStr === void 0 ? '' : _this$state$searchStr;
328
+ var onSearch = this.props.onSearch;
329
+ var searchStrRegex = (0, _Common.getSearchString)(searchStr);
330
+ var valueStrRegex = (0, _Common.getSearchString)(value);
331
+ var isSearch = searchStrRegex !== valueStrRegex ? true : false;
332
+ this.setState({
333
+ searchStr: value,
334
+ hoverIndex: 0
335
+ }, function () {
336
+ if (!value) {
337
+ onSearch && _this3.handleFetchOptions(onSearch, '');
338
+ } else if (isSearch && onSearch) {
339
+ _this3.handleSearchOptions();
340
+ }
341
+ });
342
+ }
343
+ }, {
344
+ key: "handleKeyDown",
345
+ value: function handleKeyDown(e) {
346
+ var _this$props3 = this.props,
347
+ isPopupOpen = _this$props3.isPopupOpen,
348
+ isPopupOpenOnEnter = _this$props3.isPopupOpenOnEnter,
349
+ onKeyDown = _this$props3.onKeyDown;
350
+ var hoverIndex = this.state.hoverIndex;
351
+
352
+ var _this$handleFilterSug2 = this.handleFilterSuggestions(),
353
+ suggestionOptionIds = _this$handleFilterSug2.suggestionOptionIds;
354
+
355
+ var keyCode = e.keyCode;
356
+
357
+ if (!isPopupOpen && !isPopupOpenOnEnter) {
358
+ onKeyDown && onKeyDown(e);
359
+ }
360
+
361
+ if (isPopupOpen && (keyCode === 38 || keyCode === 40) && e.preventDefault) {
362
+ e.preventDefault(); //prevent body scroll
363
+ } else if (!isPopupOpen && keyCode === 40) {
364
+ e.preventDefault(); //prevent body scroll
365
+
366
+ this.togglePopup(e);
367
+ }
368
+
369
+ if (keyCode === 38 && isPopupOpen && suggestionOptionIds.length) {
370
+ // eslint-disable-next-line
371
+ if (hoverIndex === 0) {// hoverIndex = options.length - 1;
372
+ } else {
373
+ hoverIndex -= 1;
374
+ }
375
+
376
+ this.setState({
377
+ hoverIndex: hoverIndex
378
+ });
379
+ } else if (keyCode === 40 && isPopupOpen && suggestionOptionIds.length) {
380
+ // eslint-disable-next-line
381
+ if (hoverIndex === suggestionOptionIds.length - 1) {// hoverIndex = 0;
382
+ } else {
383
+ if (hoverIndex === suggestionOptionIds.length - 3) {
384
+ this.handleGetNextOptions();
385
+ }
386
+
387
+ hoverIndex += 1;
388
+ }
389
+
390
+ this.setState({
391
+ hoverIndex: hoverIndex
392
+ });
393
+ } else if (keyCode === 13) {
394
+ var id = suggestionOptionIds[hoverIndex];
395
+ isPopupOpen && this.handleChange(id, null, null, e);
396
+ !isPopupOpen && isPopupOpenOnEnter && this.togglePopup(e);
397
+ } else if (keyCode === 27) {
398
+ this.valueInput && this.valueInput.focus({
399
+ preventScroll: true
400
+ }); // this.handlePopupClose(e);
401
+ }
402
+ }
403
+ }, {
404
+ key: "handleMouseEnter",
405
+ value: function handleMouseEnter(id) {
406
+ var hoverIndex = this.state.hoverIndex;
407
+
408
+ var _this$handleFilterSug3 = this.handleFilterSuggestions(),
409
+ suggestionOptionIds = _this$handleFilterSug3.suggestionOptionIds;
410
+
411
+ var newHoverIndex = suggestionOptionIds.indexOf(id);
412
+ hoverIndex !== newHoverIndex && this.setState({
413
+ hoverIndex: newHoverIndex
414
+ });
415
+ }
416
+ }, {
417
+ key: "handleChange",
418
+ value: function handleChange(id, value, index, e) {
419
+ e && e.preventDefault && e.preventDefault();
420
+ var _this$props4 = this.props,
421
+ onChange = _this$props4.onChange,
422
+ isReadOnly = _this$props4.isReadOnly;
423
+ var normalizedAllOptions = this.normalizedAllOptions;
424
+
425
+ var _extractOptionId = (0, _dropDownUtils.extractOptionId)(id),
426
+ selected = _extractOptionId.id,
427
+ groupId = _extractOptionId.groupId;
428
+
429
+ if (!(0, _Common.getIsEmptyValue)(id) && !isReadOnly) {
430
+ onChange && onChange({
431
+ groupId: groupId,
432
+ selected: selected
433
+ }, normalizedAllOptions[id]);
434
+ this.handlePopupClose(); // this.valueInput && this.valueInput.focus({preventScroll:true});
435
+ }
436
+ }
437
+ }, {
438
+ key: "togglePopup",
439
+ value: function togglePopup(e) {
440
+ var _this$props5 = this.props,
441
+ togglePopup = _this$props5.togglePopup,
442
+ isReadOnly = _this$props5.isReadOnly,
443
+ defaultDropBoxPosition = _this$props5.defaultDropBoxPosition;
444
+ !isReadOnly && togglePopup(e, defaultDropBoxPosition ? "".concat(defaultDropBoxPosition, "Center") : null);
445
+ }
446
+ }, {
447
+ key: "handlePopupClose",
448
+ value: function handlePopupClose(e) {
449
+ var _this$props6 = this.props,
450
+ closePopupOnly = _this$props6.closePopupOnly,
451
+ isPopupOpen = _this$props6.isPopupOpen;
452
+ this.valueInput && this.valueInput.focus({
453
+ preventScroll: true
454
+ });
455
+ isPopupOpen && closePopupOnly(e);
456
+ }
457
+ }, {
458
+ key: "suggestionContainerRef",
459
+ value: function suggestionContainerRef(el) {
460
+ this.suggestionContainer = el;
461
+ }
462
+ }, {
463
+ key: "suggestionItemRef",
464
+ value: function suggestionItemRef(el, index, id) {
465
+ this["suggestion_".concat(id)] = el;
466
+ }
467
+ }, {
468
+ key: "searchInputRef",
469
+ value: function searchInputRef(el) {
470
+ this.searchInput = el;
471
+ }
472
+ }, {
473
+ key: "valueInputRef",
474
+ value: function valueInputRef(el) {
475
+ var getRef = this.props.getRef;
476
+ this.valueInput = el;
477
+ getRef && getRef(el);
478
+ }
479
+ }, {
480
+ key: "handleSelectFocus",
481
+ value: function handleSelectFocus(e) {
482
+ var _ref = e || {},
483
+ target = _ref.target;
484
+
485
+ target && target.setSelectionRange(target, 0);
486
+ }
487
+ }, {
488
+ key: "handleClearSearch",
489
+ value: function handleClearSearch() {
490
+ var _this4 = this;
491
+
492
+ this.handleSearch('');
493
+ setTimeout(function () {
494
+ _this4.searchInput && _this4.searchInput.focus({
495
+ preventScroll: true
496
+ });
497
+ }, 1);
498
+ }
499
+ }, {
500
+ key: "handleValueInputChange",
501
+ value: function handleValueInputChange(e) {
502
+ var which = e.which;
503
+ var typeString = String.fromCharCode(which);
504
+ var _this$props7 = this.props,
505
+ isPopupOpen = _this$props7.isPopupOpen,
506
+ autoSelectOnType = _this$props7.autoSelectOnType;
507
+
508
+ if (!isPopupOpen && autoSelectOnType) {
509
+ this.valueInputTypeString += (typeString || '').trim();
510
+ this.handleChangeOnType();
511
+ }
512
+ }
513
+ }, {
514
+ key: "handleChangeOnType",
515
+ value: function handleChangeOnType() {
516
+ var _this5 = this;
517
+
518
+ var revampedGroups = this.state.revampedGroups;
519
+ var typeString = this.valueInputTypeString;
520
+ this.valueInputTypeString = '';
521
+
522
+ var changeValue = function changeValue() {
523
+ var id = _this5.autoSelectSuggestions[_this5.autoSelectIndex];
524
+
525
+ var _this5$handleFilterSu = _this5.handleFilterSuggestions(),
526
+ suggestionOptionIds = _this5$handleFilterSu.suggestionOptionIds;
527
+
528
+ if (!(0, _Common.getIsEmptyValue)(id)) {
529
+ _this5.handleChange(id);
530
+
531
+ var hoverIndex = suggestionOptionIds.indexOf(id);
532
+
533
+ _this5.setState({
534
+ hoverIndex: hoverIndex
535
+ });
536
+ }
537
+ };
538
+
539
+ if (typeString && typeString === this.valueInputSearchString) {
540
+ if (this.autoSelectIndex < this.autoSelectSuggestions.length - 1) {
541
+ this.autoSelectIndex += 1;
542
+ } else {
543
+ this.autoSelectIndex = 0;
544
+ }
545
+
546
+ changeValue();
547
+ } else if (typeString) {
548
+ this.valueInputSearchString = typeString;
549
+
550
+ var _this$getFilterSugges2 = this.getFilterSuggestions({
551
+ revampedGroups: revampedGroups,
552
+ searchStr: typeString,
553
+ needSearch: true,
554
+ isStartsWithSearch: true
555
+ }),
556
+ suggestionOptionIds = _this$getFilterSugges2.suggestionOptionIds;
557
+
558
+ this.autoSelectIndex = 0;
559
+ this.autoSelectSuggestions = suggestionOptionIds;
560
+ changeValue();
561
+ }
562
+ }
563
+ }, {
564
+ key: "handleScroll",
565
+ value: function handleScroll(e) {
566
+ var ele = e.target;
567
+ var isScrollReachedBottom = (0, _Common.findScrollEnd)(ele);
568
+ isScrollReachedBottom && this.handleGetNextOptions();
569
+ }
570
+ }, {
571
+ key: "handleFetchOptions",
572
+ value: function handleFetchOptions(APICall) {
573
+ var _this6 = this;
574
+
575
+ var searchStr = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
576
+ // let funcArgs = args.slice(1, args.length);
577
+ var _this$state$isFetchin = this.state.isFetchingOptions,
578
+ isFetchingOptions = _this$state$isFetchin === void 0 ? false : _this$state$isFetchin;
579
+ var _isMounted = this._isMounted;
580
+
581
+ if (!isFetchingOptions && APICall) {
582
+ this.setState({
583
+ isFetchingOptions: true
584
+ });
585
+
586
+ try {
587
+ return APICall(searchStr).then(function () {
588
+ _isMounted && _this6.setState({
589
+ isFetchingOptions: false
590
+ });
591
+ }, function () {
592
+ _isMounted && _this6.setState({
593
+ isFetchingOptions: false
594
+ });
595
+ });
596
+ } catch (e) {
597
+ _isMounted && this.setState({
598
+ isFetchingOptions: false
599
+ });
600
+ }
601
+ }
602
+ }
603
+ }, {
604
+ key: "handleGetNextOptions",
605
+ value: function handleGetNextOptions() {
606
+ var _this$props8 = this.props,
607
+ isNextOptions = _this$props8.isNextOptions,
608
+ getNextOptions = _this$props8.getNextOptions;
609
+ var searchStr = this.state.searchStr;
610
+ isNextOptions && getNextOptions && this.handleFetchOptions(getNextOptions, searchStr);
611
+ }
612
+ }, {
613
+ key: "responsiveFunc",
614
+ value: function responsiveFunc(_ref2) {
615
+ var mediaQueryOR = _ref2.mediaQueryOR;
616
+ return {
617
+ tabletMode: mediaQueryOR([{
618
+ maxWidth: 700
619
+ }])
620
+ };
621
+ }
622
+ }, {
623
+ key: "render",
624
+ value: function render() {
625
+ var _this7 = this;
626
+
627
+ var _this$props9 = this.props,
628
+ isDisabled = _this$props9.isDisabled,
629
+ isReadOnly = _this$props9.isReadOnly,
630
+ needSearch = _this$props9.needSearch,
631
+ emptyMessage = _this$props9.emptyMessage,
632
+ needSelectDownIcon = _this$props9.needSelectDownIcon,
633
+ maxLength = _this$props9.maxLength,
634
+ needBorder = _this$props9.needBorder,
635
+ placeHolder = _this$props9.placeHolder,
636
+ defaultDropBoxPosition = _this$props9.defaultDropBoxPosition,
637
+ searchBoxPlaceHolder = _this$props9.searchBoxPlaceHolder,
638
+ searchEmptyMessage = _this$props9.searchEmptyMessage,
639
+ dataId = _this$props9.dataId,
640
+ dataIdSlctComp = _this$props9.dataIdSlctComp,
641
+ dataIdDownIcon = _this$props9.dataIdDownIcon,
642
+ dataIdSrchEmptyMsg = _this$props9.dataIdSrchEmptyMsg,
643
+ needResponsive = _this$props9.needResponsive,
644
+ className = _this$props9.className,
645
+ size = _this$props9.size,
646
+ title = _this$props9.title,
647
+ textBoxSize = _this$props9.textBoxSize,
648
+ textBoxVariant = _this$props9.textBoxVariant,
649
+ animationStyle = _this$props9.animationStyle,
650
+ dropBoxSize = _this$props9.dropBoxSize,
651
+ searchBoxSize = _this$props9.searchBoxSize,
652
+ getTargetRef = _this$props9.getTargetRef,
653
+ isPopupOpen = _this$props9.isPopupOpen,
654
+ position = _this$props9.position,
655
+ getContainerRef = _this$props9.getContainerRef,
656
+ isPopupReady = _this$props9.isPopupReady,
657
+ removeClose = _this$props9.removeClose,
658
+ borderColor = _this$props9.borderColor,
659
+ needTick = _this$props9.needTick,
660
+ children = _this$props9.children,
661
+ getFooter = _this$props9.getFooter,
662
+ i18nKeys = _this$props9.i18nKeys,
663
+ htmlId = _this$props9.htmlId,
664
+ iconOnHover = _this$props9.iconOnHover,
665
+ isLoading = _this$props9.isLoading,
666
+ dataSelectorId = _this$props9.dataSelectorId;
667
+ i18nKeys = Object.assign({}, i18nKeys, {
668
+ emptyText: i18nKeys.emptyText || emptyMessage,
669
+ searchEmptyText: i18nKeys.searchEmptyText || searchEmptyMessage
670
+ });
671
+ var _this$state3 = this.state,
672
+ selectedId = _this$state3.selectedId,
673
+ hoverIndex = _this$state3.hoverIndex,
674
+ searchStr = _this$state3.searchStr,
675
+ revampedGroups = _this$state3.revampedGroups,
676
+ isFetchingOptions = _this$state3.isFetchingOptions;
677
+ var normalizedFormatOptions = this.normalizedFormatOptions;
678
+
679
+ var _this$handleFilterSug4 = this.handleFilterSuggestions(),
680
+ suggestionGroups = _this$handleFilterSug4.suggestionGroups,
681
+ suggestionOptionIds = _this$handleFilterSug4.suggestionOptionIds;
682
+
683
+ var _ref3 = normalizedFormatOptions[selectedId] || {},
684
+ _ref3$value = _ref3.value,
685
+ selected = _ref3$value === void 0 ? '' : _ref3$value;
686
+
687
+ var setAriaId = this.getNextAriaId();
688
+ var ariaErrorId = this.getNextAriaId();
689
+ return /*#__PURE__*/_react["default"].createElement("div", {
690
+ className: "".concat(_SelectModule["default"].container, " ").concat(_SelectModule["default"]["box_".concat(size)], " ").concat(isReadOnly ? _SelectModule["default"].readonly : '', " ").concat(borderColor === 'transparent' ? _SelectModule["default"].transparentContainer : '', " ").concat(iconOnHover && (isReadOnly || isDisabled) ? _SelectModule["default"].iconOnHoverReadonly : iconOnHover && !(isReadOnly || isDisabled) ? _SelectModule["default"].iconOnHoverStyle : ''),
691
+ "data-id": dataIdSlctComp,
692
+ "data-test-id": dataIdSlctComp,
693
+ "data-title": isDisabled ? title : null,
694
+ "data-selector-id": dataSelectorId
695
+ }, /*#__PURE__*/_react["default"].createElement("div", {
696
+ className: "".concat(className ? className : ''),
697
+ onClick: isDisabled || isReadOnly ? null : this.togglePopup,
698
+ ref: getTargetRef
699
+ }, children ? children : /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, needSelectDownIcon ? /*#__PURE__*/_react["default"].createElement(_TextBoxIcon["default"], {
700
+ isDisabled: isDisabled,
701
+ iconRotated: isPopupOpen,
702
+ inputRef: this.valueInputRef,
703
+ maxLength: maxLength,
704
+ needBorder: needBorder,
705
+ onFocus: this.handleSelectFocus,
706
+ onKeyDown: this.handleKeyDown,
707
+ placeHolder: placeHolder,
708
+ isReadOnly: true,
709
+ size: textBoxSize,
710
+ value: selected,
711
+ variant: textBoxVariant,
712
+ needReadOnlyStyle: isReadOnly ? true : false,
713
+ dataId: dataId,
714
+ onKeyPress: this.handleValueInputChange,
715
+ needEffect: isReadOnly || isDisabled ? false : true,
716
+ borderColor: borderColor,
717
+ htmlId: htmlId,
718
+ a11y: {
719
+ role: 'combobox',
720
+ ariaControls: setAriaId,
721
+ ariaExpanded: !isReadOnly && !isDisabled && isPopupOpen ? true : false,
722
+ ariaHaspopup: true,
723
+ ariaReadonly: true,
724
+ ariaActivedescendant: selectedId,
725
+ ariaOwns: setAriaId
726
+ },
727
+ isFocus: isPopupReady,
728
+ autoComplete: false
729
+ }, /*#__PURE__*/_react["default"].createElement(_Layout.Container, {
730
+ align: "both",
731
+ dataId: dataIdDownIcon
732
+ }, /*#__PURE__*/_react["default"].createElement(_icons.Icon, {
733
+ name: "ZD-down",
734
+ size: "7",
735
+ iconClass: _SelectModule["default"].arrowIcon
736
+ }))) : /*#__PURE__*/_react["default"].createElement(_TextBox["default"], {
737
+ isDisabled: isDisabled,
738
+ inputRef: this.valueInputRef,
739
+ maxLength: maxLength,
740
+ needBorder: needBorder,
741
+ onFocus: this.handleSelectFocus,
742
+ onKeyDown: this.handleKeyDown,
743
+ placeHolder: placeHolder,
744
+ isReadOnly: true,
745
+ needEffect: isReadOnly || isDisabled ? false : true,
746
+ size: textBoxSize,
747
+ value: selected,
748
+ variant: textBoxVariant,
749
+ needReadOnlyStyle: isReadOnly ? true : false,
750
+ dataId: dataId,
751
+ onKeyPress: this.handleValueInputChange,
752
+ borderColor: borderColor,
753
+ htmlId: htmlId,
754
+ a11y: {
755
+ role: 'combobox',
756
+ ariaLabel: TextBox_ally_label,
757
+ ariaControls: setAriaId,
758
+ ariaExpanded: !isReadOnly && !isDisabled && isPopupOpen ? true : false,
759
+ ariaHaspopup: true,
760
+ ariaReadonly: true,
761
+ ariaActivedescendant: selectedId,
762
+ ariaOwns: setAriaId
763
+ },
764
+ autoComplete: false,
765
+ isFocus: isPopupReady
766
+ }))), !isReadOnly && !isDisabled && isPopupOpen ? /*#__PURE__*/_react["default"].createElement(_CustomResponsive.ResponsiveReceiver, {
767
+ query: this.responsiveFunc,
768
+ responsiveId: "Helmet"
769
+ }, function (_ref4) {
770
+ var tabletMode = _ref4.tabletMode;
771
+ return /*#__PURE__*/_react["default"].createElement(_ResponsiveDropBox["default"], {
772
+ animationStyle: animationStyle,
773
+ boxPosition: position || "".concat(defaultDropBoxPosition, "Center"),
774
+ getRef: getContainerRef,
775
+ isActive: isPopupReady,
776
+ isAnimate: true,
777
+ isArrow: false,
778
+ onClick: removeClose,
779
+ needResponsive: needResponsive,
780
+ isPadding: false,
781
+ isResponsivePadding: getFooter ? false : true,
782
+ alignBox: "row"
783
+ }, isLoading ? /*#__PURE__*/_react["default"].createElement(_Layout.Container, {
784
+ align: "both",
785
+ className: _SelectModule["default"].loader
786
+ }, /*#__PURE__*/_react["default"].createElement(_Loader["default"], null)) : /*#__PURE__*/_react["default"].createElement(_Layout.Box, {
787
+ flexible: true
788
+ }, /*#__PURE__*/_react["default"].createElement(_Card["default"], {
789
+ customClass: _SelectModule["default"].box,
790
+ onScroll: _this7.handleScroll
791
+ }, needSearch ? /*#__PURE__*/_react["default"].createElement(_Card.CardHeader, null, /*#__PURE__*/_react["default"].createElement("div", {
792
+ className: "".concat(_SelectModule["default"].search, " ").concat(_SelectModule["default"][size])
793
+ }, /*#__PURE__*/_react["default"].createElement(_TextBoxIcon["default"], {
794
+ inputRef: _this7.searchInputRef,
795
+ maxLength: maxLength,
796
+ onChange: _this7.handleSearch,
797
+ onKeyDown: _this7.handleKeyDown,
798
+ placeHolder: searchBoxPlaceHolder,
799
+ size: searchBoxSize,
800
+ value: searchStr,
801
+ onClear: _this7.handleClearSearch,
802
+ a11y: {
803
+ ariaControls: setAriaId,
804
+ ariaAutocomplete: 'list',
805
+ ariaDescribedby: ariaErrorId
806
+ },
807
+ autoComplete: false
808
+ }))) : null, /*#__PURE__*/_react["default"].createElement(_Card.CardContent, {
809
+ shrink: true,
810
+ customClass: !tabletMode && dropBoxSize ? _SelectModule["default"][dropBoxSize] : '',
811
+ eleRef: _this7.suggestionContainerRef
812
+ }, suggestionGroups.length ? suggestionGroups.map(function (group) {
813
+ var groupId = group.id,
814
+ groupName = group.name,
815
+ options = group.options;
816
+ var hoverId = suggestionOptionIds[hoverIndex];
817
+ return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, {
818
+ key: groupId
819
+ }, groupName && /*#__PURE__*/_react["default"].createElement("div", {
820
+ className: _SelectModule["default"].groupTitle
821
+ }, /*#__PURE__*/_react["default"].createElement(_DropDownHeading["default"], {
822
+ text: groupName,
823
+ a11y: {
824
+ role: 'heading'
825
+ }
826
+ })), /*#__PURE__*/_react["default"].createElement(_Suggestions["default"], {
827
+ activeId: selectedId,
828
+ suggestions: options,
829
+ getRef: _this7.suggestionItemRef,
830
+ hoverId: hoverId,
831
+ onClick: _this7.handleChange,
832
+ onMouseEnter: _this7.handleMouseEnter,
833
+ selectedOptions: [selectedId],
834
+ needTick: needTick,
835
+ needBorder: false,
836
+ htmlId: setAriaId,
837
+ a11y: {
838
+ ariaParentRole: 'listbox',
839
+ role: 'option'
840
+ }
841
+ }));
842
+ }) : /*#__PURE__*/_react["default"].createElement(_EmptyState["default"], {
843
+ options: revampedGroups,
844
+ searchString: searchStr,
845
+ suggestions: suggestionGroups,
846
+ dataId: dataIdSrchEmptyMsg,
847
+ isLoading: isFetchingOptions,
848
+ i18nKeys: i18nKeys,
849
+ htmlId: ariaErrorId
850
+ }), isFetchingOptions && /*#__PURE__*/_react["default"].createElement(_Layout.Container, {
851
+ isCover: false,
852
+ align: "both"
853
+ }, /*#__PURE__*/_react["default"].createElement(_Loader["default"], null))), getFooter ? /*#__PURE__*/_react["default"].createElement(_Card.CardFooter, null, getFooter()) : null)));
854
+ }) : null);
855
+ }
856
+ }]);
857
+
858
+ return GroupSelectComponent;
859
+ }(_react.PureComponent);
860
+
861
+ exports.GroupSelectComponent = GroupSelectComponent;
862
+ GroupSelectComponent.propTypes = _propTypes.GroupSelect_propTypes;
863
+ GroupSelectComponent.defaultProps = _defaultProps.GroupSelect_defaultProps;
864
+ GroupSelectComponent.displayName = 'GroupSelect';
865
+ var GroupSelect = (0, _Popup["default"])(GroupSelectComponent);
866
+ GroupSelect.defaultProps = GroupSelectComponent.defaultProps;
867
+ GroupSelect.propTypes = GroupSelectComponent.propTypes;
868
+ var _default = GroupSelect; // if (__DOCS__) {
869
+ // GroupSelect.docs = {
870
+ // componentGroup: 'Form Elements',
871
+ // folderName: 'Style Guide'
872
+ // };
873
+ // // eslint-disable-next-line react/forbid-foreign-prop-types
874
+ // GroupSelect.propTypes = GroupSelectComponent.propTypes;
875
+ // }
876
+
877
+ exports["default"] = _default;