@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,876 @@
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 typeString = (0, _Common.getKeyValue)(e);
503
+ var _this$props7 = this.props,
504
+ isPopupOpen = _this$props7.isPopupOpen,
505
+ autoSelectOnType = _this$props7.autoSelectOnType;
506
+
507
+ if (!isPopupOpen && autoSelectOnType) {
508
+ this.valueInputTypeString += (typeString || '').trim();
509
+ this.handleChangeOnType();
510
+ }
511
+ }
512
+ }, {
513
+ key: "handleChangeOnType",
514
+ value: function handleChangeOnType() {
515
+ var _this5 = this;
516
+
517
+ var revampedGroups = this.state.revampedGroups;
518
+ var typeString = this.valueInputTypeString;
519
+ this.valueInputTypeString = '';
520
+
521
+ var changeValue = function changeValue() {
522
+ var id = _this5.autoSelectSuggestions[_this5.autoSelectIndex];
523
+
524
+ var _this5$handleFilterSu = _this5.handleFilterSuggestions(),
525
+ suggestionOptionIds = _this5$handleFilterSu.suggestionOptionIds;
526
+
527
+ if (!(0, _Common.getIsEmptyValue)(id)) {
528
+ _this5.handleChange(id);
529
+
530
+ var hoverIndex = suggestionOptionIds.indexOf(id);
531
+
532
+ _this5.setState({
533
+ hoverIndex: hoverIndex
534
+ });
535
+ }
536
+ };
537
+
538
+ if (typeString && typeString === this.valueInputSearchString) {
539
+ if (this.autoSelectIndex < this.autoSelectSuggestions.length - 1) {
540
+ this.autoSelectIndex += 1;
541
+ } else {
542
+ this.autoSelectIndex = 0;
543
+ }
544
+
545
+ changeValue();
546
+ } else if (typeString) {
547
+ this.valueInputSearchString = typeString;
548
+
549
+ var _this$getFilterSugges2 = this.getFilterSuggestions({
550
+ revampedGroups: revampedGroups,
551
+ searchStr: typeString,
552
+ needSearch: true,
553
+ isStartsWithSearch: true
554
+ }),
555
+ suggestionOptionIds = _this$getFilterSugges2.suggestionOptionIds;
556
+
557
+ this.autoSelectIndex = 0;
558
+ this.autoSelectSuggestions = suggestionOptionIds;
559
+ changeValue();
560
+ }
561
+ }
562
+ }, {
563
+ key: "handleScroll",
564
+ value: function handleScroll(e) {
565
+ var ele = e.target;
566
+ var isScrollReachedBottom = (0, _Common.findScrollEnd)(ele);
567
+ isScrollReachedBottom && this.handleGetNextOptions();
568
+ }
569
+ }, {
570
+ key: "handleFetchOptions",
571
+ value: function handleFetchOptions(APICall) {
572
+ var _this6 = this;
573
+
574
+ var searchStr = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
575
+ // let funcArgs = args.slice(1, args.length);
576
+ var _this$state$isFetchin = this.state.isFetchingOptions,
577
+ isFetchingOptions = _this$state$isFetchin === void 0 ? false : _this$state$isFetchin;
578
+ var _isMounted = this._isMounted;
579
+
580
+ if (!isFetchingOptions && APICall) {
581
+ this.setState({
582
+ isFetchingOptions: true
583
+ });
584
+
585
+ try {
586
+ return APICall(searchStr).then(function () {
587
+ _isMounted && _this6.setState({
588
+ isFetchingOptions: false
589
+ });
590
+ }, function () {
591
+ _isMounted && _this6.setState({
592
+ isFetchingOptions: false
593
+ });
594
+ });
595
+ } catch (e) {
596
+ _isMounted && this.setState({
597
+ isFetchingOptions: false
598
+ });
599
+ }
600
+ }
601
+ }
602
+ }, {
603
+ key: "handleGetNextOptions",
604
+ value: function handleGetNextOptions() {
605
+ var _this$props8 = this.props,
606
+ isNextOptions = _this$props8.isNextOptions,
607
+ getNextOptions = _this$props8.getNextOptions;
608
+ var searchStr = this.state.searchStr;
609
+ isNextOptions && getNextOptions && this.handleFetchOptions(getNextOptions, searchStr);
610
+ }
611
+ }, {
612
+ key: "responsiveFunc",
613
+ value: function responsiveFunc(_ref2) {
614
+ var mediaQueryOR = _ref2.mediaQueryOR;
615
+ return {
616
+ tabletMode: mediaQueryOR([{
617
+ maxWidth: 700
618
+ }])
619
+ };
620
+ }
621
+ }, {
622
+ key: "render",
623
+ value: function render() {
624
+ var _this7 = this;
625
+
626
+ var _this$props9 = this.props,
627
+ isDisabled = _this$props9.isDisabled,
628
+ isReadOnly = _this$props9.isReadOnly,
629
+ needSearch = _this$props9.needSearch,
630
+ emptyMessage = _this$props9.emptyMessage,
631
+ needSelectDownIcon = _this$props9.needSelectDownIcon,
632
+ maxLength = _this$props9.maxLength,
633
+ needBorder = _this$props9.needBorder,
634
+ placeHolder = _this$props9.placeHolder,
635
+ defaultDropBoxPosition = _this$props9.defaultDropBoxPosition,
636
+ searchBoxPlaceHolder = _this$props9.searchBoxPlaceHolder,
637
+ searchEmptyMessage = _this$props9.searchEmptyMessage,
638
+ dataId = _this$props9.dataId,
639
+ dataIdSlctComp = _this$props9.dataIdSlctComp,
640
+ dataIdDownIcon = _this$props9.dataIdDownIcon,
641
+ dataIdSrchEmptyMsg = _this$props9.dataIdSrchEmptyMsg,
642
+ needResponsive = _this$props9.needResponsive,
643
+ className = _this$props9.className,
644
+ size = _this$props9.size,
645
+ title = _this$props9.title,
646
+ textBoxSize = _this$props9.textBoxSize,
647
+ textBoxVariant = _this$props9.textBoxVariant,
648
+ animationStyle = _this$props9.animationStyle,
649
+ dropBoxSize = _this$props9.dropBoxSize,
650
+ searchBoxSize = _this$props9.searchBoxSize,
651
+ getTargetRef = _this$props9.getTargetRef,
652
+ isPopupOpen = _this$props9.isPopupOpen,
653
+ position = _this$props9.position,
654
+ getContainerRef = _this$props9.getContainerRef,
655
+ isPopupReady = _this$props9.isPopupReady,
656
+ removeClose = _this$props9.removeClose,
657
+ borderColor = _this$props9.borderColor,
658
+ needTick = _this$props9.needTick,
659
+ children = _this$props9.children,
660
+ getFooter = _this$props9.getFooter,
661
+ i18nKeys = _this$props9.i18nKeys,
662
+ htmlId = _this$props9.htmlId,
663
+ iconOnHover = _this$props9.iconOnHover,
664
+ isLoading = _this$props9.isLoading,
665
+ dataSelectorId = _this$props9.dataSelectorId;
666
+ i18nKeys = Object.assign({}, i18nKeys, {
667
+ emptyText: i18nKeys.emptyText || emptyMessage,
668
+ searchEmptyText: i18nKeys.searchEmptyText || searchEmptyMessage
669
+ });
670
+ var _this$state3 = this.state,
671
+ selectedId = _this$state3.selectedId,
672
+ hoverIndex = _this$state3.hoverIndex,
673
+ searchStr = _this$state3.searchStr,
674
+ revampedGroups = _this$state3.revampedGroups,
675
+ isFetchingOptions = _this$state3.isFetchingOptions;
676
+ var normalizedFormatOptions = this.normalizedFormatOptions;
677
+
678
+ var _this$handleFilterSug4 = this.handleFilterSuggestions(),
679
+ suggestionGroups = _this$handleFilterSug4.suggestionGroups,
680
+ suggestionOptionIds = _this$handleFilterSug4.suggestionOptionIds;
681
+
682
+ var _ref3 = normalizedFormatOptions[selectedId] || {},
683
+ _ref3$value = _ref3.value,
684
+ selected = _ref3$value === void 0 ? '' : _ref3$value;
685
+
686
+ var setAriaId = this.getNextAriaId();
687
+ var ariaErrorId = this.getNextAriaId();
688
+ return /*#__PURE__*/_react["default"].createElement("div", {
689
+ 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 : ''),
690
+ "data-id": dataIdSlctComp,
691
+ "data-test-id": dataIdSlctComp,
692
+ "data-title": isDisabled ? title : null,
693
+ "data-selector-id": dataSelectorId
694
+ }, /*#__PURE__*/_react["default"].createElement("div", {
695
+ className: "".concat(className ? className : ''),
696
+ onClick: isDisabled || isReadOnly ? null : this.togglePopup,
697
+ ref: getTargetRef
698
+ }, children ? children : /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, needSelectDownIcon ? /*#__PURE__*/_react["default"].createElement(_TextBoxIcon["default"], {
699
+ isDisabled: isDisabled,
700
+ iconRotated: isPopupOpen,
701
+ inputRef: this.valueInputRef,
702
+ maxLength: maxLength,
703
+ needBorder: needBorder,
704
+ onFocus: this.handleSelectFocus,
705
+ onKeyDown: this.handleKeyDown,
706
+ placeHolder: placeHolder,
707
+ isReadOnly: true,
708
+ size: textBoxSize,
709
+ value: selected,
710
+ variant: textBoxVariant,
711
+ needReadOnlyStyle: isReadOnly ? true : false,
712
+ dataId: dataId,
713
+ onKeyPress: this.handleValueInputChange,
714
+ needEffect: isReadOnly || isDisabled ? false : true,
715
+ borderColor: borderColor,
716
+ htmlId: htmlId,
717
+ a11y: {
718
+ role: 'combobox',
719
+ ariaControls: setAriaId,
720
+ ariaExpanded: !isReadOnly && !isDisabled && isPopupOpen ? true : false,
721
+ ariaHaspopup: true,
722
+ ariaReadonly: true,
723
+ ariaActivedescendant: selectedId,
724
+ ariaOwns: setAriaId
725
+ },
726
+ isFocus: isPopupReady,
727
+ autoComplete: false
728
+ }, /*#__PURE__*/_react["default"].createElement(_Layout.Container, {
729
+ align: "both",
730
+ dataId: dataIdDownIcon
731
+ }, /*#__PURE__*/_react["default"].createElement(_icons.Icon, {
732
+ name: "ZD-down",
733
+ size: "7",
734
+ iconClass: _SelectModule["default"].arrowIcon
735
+ }))) : /*#__PURE__*/_react["default"].createElement(_TextBox["default"], {
736
+ isDisabled: isDisabled,
737
+ inputRef: this.valueInputRef,
738
+ maxLength: maxLength,
739
+ needBorder: needBorder,
740
+ onFocus: this.handleSelectFocus,
741
+ onKeyDown: this.handleKeyDown,
742
+ placeHolder: placeHolder,
743
+ isReadOnly: true,
744
+ needEffect: isReadOnly || isDisabled ? false : true,
745
+ size: textBoxSize,
746
+ value: selected,
747
+ variant: textBoxVariant,
748
+ needReadOnlyStyle: isReadOnly ? true : false,
749
+ dataId: dataId,
750
+ onKeyPress: this.handleValueInputChange,
751
+ borderColor: borderColor,
752
+ htmlId: htmlId,
753
+ a11y: {
754
+ role: 'combobox',
755
+ ariaLabel: TextBox_ally_label,
756
+ ariaControls: setAriaId,
757
+ ariaExpanded: !isReadOnly && !isDisabled && isPopupOpen ? true : false,
758
+ ariaHaspopup: true,
759
+ ariaReadonly: true,
760
+ ariaActivedescendant: selectedId,
761
+ ariaOwns: setAriaId
762
+ },
763
+ autoComplete: false,
764
+ isFocus: isPopupReady
765
+ }))), !isReadOnly && !isDisabled && isPopupOpen ? /*#__PURE__*/_react["default"].createElement(_CustomResponsive.ResponsiveReceiver, {
766
+ query: this.responsiveFunc,
767
+ responsiveId: "Helmet"
768
+ }, function (_ref4) {
769
+ var tabletMode = _ref4.tabletMode;
770
+ return /*#__PURE__*/_react["default"].createElement(_ResponsiveDropBox["default"], {
771
+ animationStyle: animationStyle,
772
+ boxPosition: position || "".concat(defaultDropBoxPosition, "Center"),
773
+ getRef: getContainerRef,
774
+ isActive: isPopupReady,
775
+ isAnimate: true,
776
+ isArrow: false,
777
+ onClick: removeClose,
778
+ needResponsive: needResponsive,
779
+ isPadding: false,
780
+ isResponsivePadding: getFooter ? false : true,
781
+ alignBox: "row"
782
+ }, isLoading ? /*#__PURE__*/_react["default"].createElement(_Layout.Container, {
783
+ align: "both",
784
+ className: _SelectModule["default"].loader
785
+ }, /*#__PURE__*/_react["default"].createElement(_Loader["default"], null)) : /*#__PURE__*/_react["default"].createElement(_Layout.Box, {
786
+ flexible: true
787
+ }, /*#__PURE__*/_react["default"].createElement(_Card["default"], {
788
+ customClass: _SelectModule["default"].box,
789
+ onScroll: _this7.handleScroll
790
+ }, needSearch ? /*#__PURE__*/_react["default"].createElement(_Card.CardHeader, null, /*#__PURE__*/_react["default"].createElement("div", {
791
+ className: "".concat(_SelectModule["default"].search, " ").concat(_SelectModule["default"][size])
792
+ }, /*#__PURE__*/_react["default"].createElement(_TextBoxIcon["default"], {
793
+ inputRef: _this7.searchInputRef,
794
+ maxLength: maxLength,
795
+ onChange: _this7.handleSearch,
796
+ onKeyDown: _this7.handleKeyDown,
797
+ placeHolder: searchBoxPlaceHolder,
798
+ size: searchBoxSize,
799
+ value: searchStr,
800
+ onClear: _this7.handleClearSearch,
801
+ a11y: {
802
+ ariaControls: setAriaId,
803
+ ariaAutocomplete: 'list',
804
+ ariaDescribedby: ariaErrorId
805
+ },
806
+ autoComplete: false
807
+ }))) : null, /*#__PURE__*/_react["default"].createElement(_Card.CardContent, {
808
+ shrink: true,
809
+ customClass: !tabletMode && dropBoxSize ? _SelectModule["default"][dropBoxSize] : '',
810
+ eleRef: _this7.suggestionContainerRef
811
+ }, suggestionGroups.length ? suggestionGroups.map(function (group) {
812
+ var groupId = group.id,
813
+ groupName = group.name,
814
+ options = group.options;
815
+ var hoverId = suggestionOptionIds[hoverIndex];
816
+ return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, {
817
+ key: groupId
818
+ }, groupName && /*#__PURE__*/_react["default"].createElement("div", {
819
+ className: _SelectModule["default"].groupTitle
820
+ }, /*#__PURE__*/_react["default"].createElement(_DropDownHeading["default"], {
821
+ text: groupName,
822
+ a11y: {
823
+ role: 'heading'
824
+ }
825
+ })), /*#__PURE__*/_react["default"].createElement(_Suggestions["default"], {
826
+ activeId: selectedId,
827
+ suggestions: options,
828
+ getRef: _this7.suggestionItemRef,
829
+ hoverId: hoverId,
830
+ onClick: _this7.handleChange,
831
+ onMouseEnter: _this7.handleMouseEnter,
832
+ selectedOptions: [selectedId],
833
+ needTick: needTick,
834
+ needBorder: false,
835
+ htmlId: setAriaId,
836
+ a11y: {
837
+ ariaParentRole: 'listbox',
838
+ role: 'option'
839
+ }
840
+ }));
841
+ }) : /*#__PURE__*/_react["default"].createElement(_EmptyState["default"], {
842
+ options: revampedGroups,
843
+ searchString: searchStr,
844
+ suggestions: suggestionGroups,
845
+ dataId: dataIdSrchEmptyMsg,
846
+ isLoading: isFetchingOptions,
847
+ i18nKeys: i18nKeys,
848
+ htmlId: ariaErrorId
849
+ }), isFetchingOptions && /*#__PURE__*/_react["default"].createElement(_Layout.Container, {
850
+ isCover: false,
851
+ align: "both"
852
+ }, /*#__PURE__*/_react["default"].createElement(_Loader["default"], null))), getFooter ? /*#__PURE__*/_react["default"].createElement(_Card.CardFooter, null, getFooter()) : null)));
853
+ }) : null);
854
+ }
855
+ }]);
856
+
857
+ return GroupSelectComponent;
858
+ }(_react.PureComponent);
859
+
860
+ exports.GroupSelectComponent = GroupSelectComponent;
861
+ GroupSelectComponent.propTypes = _propTypes.GroupSelect_propTypes;
862
+ GroupSelectComponent.defaultProps = _defaultProps.GroupSelect_defaultProps;
863
+ GroupSelectComponent.displayName = 'GroupSelect';
864
+ var GroupSelect = (0, _Popup["default"])(GroupSelectComponent);
865
+ GroupSelect.defaultProps = GroupSelectComponent.defaultProps;
866
+ GroupSelect.propTypes = GroupSelectComponent.propTypes;
867
+ var _default = GroupSelect; // if (__DOCS__) {
868
+ // GroupSelect.docs = {
869
+ // componentGroup: 'Form Elements',
870
+ // folderName: 'Style Guide'
871
+ // };
872
+ // // eslint-disable-next-line react/forbid-foreign-prop-types
873
+ // GroupSelect.propTypes = GroupSelectComponent.propTypes;
874
+ // }
875
+
876
+ exports["default"] = _default;