@zohodesk/components 1.0.0-temp-157 → 1.0.0-temp-158

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 (423) hide show
  1. package/README.md +4 -0
  2. package/es/Accordion/Accordion.js +7 -3
  3. package/es/Accordion/AccordionItem.js +4 -2
  4. package/es/Animation/Animation.js +3 -3
  5. package/es/AppContainer/AppContainer.js +13 -5
  6. package/es/Avatar/Avatar.js +23 -11
  7. package/es/Avatar/Avatar.module.css +8 -8
  8. package/es/AvatarTeam/AvatarTeam.js +3 -3
  9. package/es/AvatarTeam/AvatarTeam.module.css +33 -32
  10. package/es/Button/Button.js +4 -3
  11. package/es/Button/css/Button.module.css +49 -48
  12. package/es/Buttongroup/Buttongroup.js +3 -3
  13. package/es/Buttongroup/Buttongroup.module.css +10 -10
  14. package/es/Card/Card.js +21 -10
  15. package/es/CheckBox/CheckBox.js +5 -3
  16. package/es/CheckBox/CheckBox.module.css +14 -14
  17. package/es/DateTime/CalendarView.js +32 -20
  18. package/es/DateTime/DateTime.js +76 -11
  19. package/es/DateTime/DateTime.module.css +32 -32
  20. package/es/DateTime/DateTimePopupFooter.js +4 -2
  21. package/es/DateTime/DateTimePopupHeader.js +8 -2
  22. package/es/DateTime/DateWidget.js +98 -35
  23. package/es/DateTime/DaysRow.js +4 -2
  24. package/es/DateTime/Time.js +10 -2
  25. package/es/DateTime/YearView.js +28 -4
  26. package/es/DateTime/YearView.module.css +12 -12
  27. package/es/DateTime/__tests__/CalendarView.spec.js +1 -0
  28. package/es/DateTime/__tests__/DateTime.spec.js +1 -0
  29. package/es/DateTime/__tests__/DateWidget.spec.js +2 -3
  30. package/es/DateTime/common.js +3 -0
  31. package/es/DateTime/constants.js +1 -0
  32. package/es/DateTime/dateFormatUtils/dateFormat.js +63 -30
  33. package/es/DateTime/dateFormatUtils/dateFormats.js +0 -1
  34. package/es/DateTime/dateFormatUtils/dayChange.js +13 -4
  35. package/es/DateTime/dateFormatUtils/index.js +32 -2
  36. package/es/DateTime/dateFormatUtils/monthChange.js +8 -0
  37. package/es/DateTime/dateFormatUtils/timeChange.js +22 -6
  38. package/es/DateTime/dateFormatUtils/yearChange.js +11 -2
  39. package/es/DateTime/objectUtils.js +14 -20
  40. package/es/DateTime/props/defaultProps.js +2 -1
  41. package/es/DateTime/typeChecker.js +3 -0
  42. package/es/DateTime/validator.js +58 -6
  43. package/es/DropBox/DropBox.js +6 -2
  44. package/es/DropBox/DropBoxElement/DropBoxElement.js +7 -0
  45. package/es/DropBox/DropBoxElement/css/DropBoxElement.module.css +42 -41
  46. package/es/DropBox/DropBoxElement/css/cssJSLogic.js +5 -3
  47. package/es/DropBox/DropBoxElement/useDropboxPosCalc.js +3 -0
  48. package/es/DropBox/props/defaultProps.js +1 -2
  49. package/es/DropBox/props/propTypes.js +1 -2
  50. package/es/DropDown/DropDown.js +8 -4
  51. package/es/DropDown/DropDown.module.css +2 -2
  52. package/es/DropDown/DropDownHeading.js +4 -5
  53. package/es/DropDown/DropDownHeading.module.css +5 -5
  54. package/es/DropDown/DropDownItem.js +6 -0
  55. package/es/DropDown/DropDownItem.module.css +7 -7
  56. package/es/DropDown/DropDownSearch.js +4 -0
  57. package/es/DropDown/DropDownSearch.module.css +3 -3
  58. package/es/DropDown/DropDownSeparator.js +1 -0
  59. package/es/DropDown/DropDownSeparator.module.css +2 -2
  60. package/es/DropDown/__tests__/DropDown.spec.js +1 -2
  61. package/es/Heading/Heading.js +2 -3
  62. package/es/Heading/Heading.module.css +1 -1
  63. package/es/Label/Label.js +4 -10
  64. package/es/Label/Label.module.css +6 -6
  65. package/es/Label/props/propTypes.js +1 -4
  66. package/es/Layout/Box.js +13 -0
  67. package/es/Layout/Container.js +12 -1
  68. package/es/Layout/index.js +1 -2
  69. package/es/ListItem/ListContainer.js +8 -3
  70. package/es/ListItem/ListItem.js +9 -3
  71. package/es/ListItem/ListItem.module.css +37 -37
  72. package/es/ListItem/ListItemWithAvatar.js +9 -3
  73. package/es/ListItem/ListItemWithCheckBox.js +7 -2
  74. package/es/ListItem/ListItemWithIcon.js +8 -3
  75. package/es/ListItem/ListItemWithRadio.js +7 -3
  76. package/es/Modal/Modal.js +28 -11
  77. package/es/MultiSelect/AdvancedGroupMultiSelect.js +89 -13
  78. package/es/MultiSelect/AdvancedMultiSelect.js +32 -9
  79. package/es/MultiSelect/EmptyState.js +2 -0
  80. package/es/MultiSelect/MultiSelect.js +99 -32
  81. package/es/MultiSelect/MultiSelect.module.css +25 -24
  82. package/es/MultiSelect/MultiSelectHeader.js +3 -0
  83. package/es/MultiSelect/MultiSelectWithAvatar.js +12 -6
  84. package/es/MultiSelect/SelectedOptions.js +6 -3
  85. package/es/MultiSelect/SelectedOptions.module.css +4 -4
  86. package/es/MultiSelect/Suggestions.js +7 -3
  87. package/es/MultiSelect/__tests__/MultiSelect.spec.js +4 -6
  88. package/es/MultiSelect/props/propTypes.js +2 -0
  89. package/es/PopOver/PopOver.js +18 -2
  90. package/es/PopOver/__tests__/PopOver.spec.js +2 -1
  91. package/es/Popup/Popup.js +77 -24
  92. package/es/Popup/__tests__/Popup.spec.js +17 -5
  93. package/es/Popup/viewPort.js +16 -4
  94. package/es/Provider/IdProvider.js +10 -5
  95. package/es/Provider/LibraryContext.js +6 -4
  96. package/es/Provider/NumberGenerator/NumberGenerator.js +21 -7
  97. package/es/Provider/ZindexProvider.js +9 -2
  98. package/es/Radio/Radio.js +4 -2
  99. package/es/Radio/Radio.module.css +9 -9
  100. package/es/Responsive/CustomResponsive.js +30 -18
  101. package/es/Responsive/RefWrapper.js +6 -7
  102. package/es/Responsive/ResizeComponent.js +35 -25
  103. package/es/Responsive/ResizeObserver.js +26 -6
  104. package/es/Responsive/Responsive.js +34 -20
  105. package/es/Responsive/index.js +1 -3
  106. package/es/Responsive/sizeObservers.js +28 -7
  107. package/es/Responsive/utils/index.js +7 -5
  108. package/es/Responsive/utils/shallowCompare.js +7 -2
  109. package/es/Responsive/windowResizeObserver.js +7 -0
  110. package/es/ResponsiveDropBox/ResponsiveDropBox.js +4 -0
  111. package/es/ResponsiveDropBox/ResponsiveDropBox.module.css +1 -1
  112. package/es/Ribbon/Ribbon.js +3 -2
  113. package/es/Ribbon/Ribbon.module.css +44 -42
  114. package/es/RippleEffect/RippleEffect.js +1 -3
  115. package/es/Select/GroupSelect.js +58 -14
  116. package/es/Select/Select.js +79 -33
  117. package/es/Select/Select.module.css +19 -19
  118. package/es/Select/SelectWithAvatar.js +17 -4
  119. package/es/Select/SelectWithIcon.js +46 -5
  120. package/es/Select/__tests__/Select.spec.js +6 -8
  121. package/es/Select/props/propTypes.js +1 -0
  122. package/es/Stencils/Stencils.js +3 -3
  123. package/es/Stencils/Stencils.module.css +13 -13
  124. package/es/Switch/Switch.js +5 -3
  125. package/es/Switch/Switch.module.css +22 -22
  126. package/es/Tab/Tab.js +4 -4
  127. package/es/Tab/Tab.module.css +10 -10
  128. package/es/Tab/TabContent.js +1 -0
  129. package/es/Tab/TabContentWrapper.js +2 -0
  130. package/es/Tab/TabWrapper.js +5 -2
  131. package/es/Tab/Tabs.js +54 -7
  132. package/es/Tab/Tabs.module.css +12 -12
  133. package/es/Tab/__tests__/Tab.spec.js +1 -3
  134. package/es/Tab/__tests__/TabWrapper.spec.js +1 -0
  135. package/es/Tag/Tag.js +6 -3
  136. package/es/Tag/Tag.module.css +20 -20
  137. package/es/TextBox/TextBox.js +15 -3
  138. package/es/TextBox/TextBox.module.css +15 -14
  139. package/es/TextBox/__tests__/TextBox.spec.js +1 -4
  140. package/es/TextBoxIcon/TextBoxIcon.js +9 -2
  141. package/es/TextBoxIcon/TextBoxIcon.module.css +2 -1
  142. package/es/TextBoxIcon/__tests__/TextBoxIcon.spec.js +2 -7
  143. package/es/Textarea/Textarea.js +12 -3
  144. package/es/Textarea/Textarea.module.css +21 -21
  145. package/es/Textarea/__tests__/Textarea.spec.js +2 -2
  146. package/es/Tooltip/Tooltip.js +58 -14
  147. package/es/Tooltip/Tooltip.module.css +10 -3
  148. package/es/Tooltip/__tests__/Tooltip.spec.js +5 -0
  149. package/es/VelocityAnimation/VelocityAnimation/VelocityAnimation.js +3 -2
  150. package/es/VelocityAnimation/VelocityAnimationGroup/VelocityAnimationGroup.js +7 -5
  151. package/es/common/avatarsizes.module.css +16 -16
  152. package/es/common/customscroll.module.css +2 -0
  153. package/es/common/reset.module.css +1 -0
  154. package/es/deprecated/AdvancedMultiSelect.module.css +16 -16
  155. package/es/deprecated/PortalLayer/PortalLayer.js +25 -20
  156. package/es/semantic/Button/Button.js +3 -2
  157. package/es/utils/Common.js +54 -9
  158. package/es/utils/ContextOptimizer.js +4 -5
  159. package/es/utils/__tests__/debounce.spec.js +2 -2
  160. package/es/utils/constructFullName.js +2 -0
  161. package/es/utils/css/compileClassNames.js +5 -0
  162. package/es/utils/css/mergeStyle.js +7 -6
  163. package/es/utils/css/utils.js +1 -0
  164. package/es/utils/datetime/GMTZones.js +48 -0
  165. package/es/utils/datetime/common.js +31 -7
  166. package/es/utils/debounce.js +5 -1
  167. package/es/utils/dropDownUtils.js +68 -11
  168. package/es/utils/getInitial.js +4 -0
  169. package/es/utils/shallowEqual.js +6 -0
  170. package/lib/Accordion/Accordion.js +42 -18
  171. package/lib/Accordion/AccordionItem.js +40 -18
  172. package/lib/Accordion/__tests__/Accordion.spec.js +3 -0
  173. package/lib/Accordion/index.js +3 -0
  174. package/lib/Accordion/props/propTypes.js +3 -0
  175. package/lib/Animation/Animation.js +38 -18
  176. package/lib/Animation/__tests__/Animation.spec.js +11 -7
  177. package/lib/Animation/props/propTypes.js +3 -0
  178. package/lib/AppContainer/AppContainer.js +56 -21
  179. package/lib/AppContainer/props/propTypes.js +3 -0
  180. package/lib/Avatar/Avatar.js +78 -38
  181. package/lib/Avatar/Avatar.module.css +8 -8
  182. package/lib/Avatar/__tests__/Avatar.spec.js +44 -0
  183. package/lib/Avatar/props/propTypes.js +3 -0
  184. package/lib/AvatarTeam/AvatarTeam.js +52 -30
  185. package/lib/AvatarTeam/AvatarTeam.module.css +33 -32
  186. package/lib/AvatarTeam/__tests__/AvatarTeam.spec.js +13 -0
  187. package/lib/AvatarTeam/props/propTypes.js +3 -0
  188. package/lib/Button/Button.js +31 -20
  189. package/lib/Button/css/Button.module.css +49 -48
  190. package/lib/Button/css/cssJSLogic.js +18 -17
  191. package/lib/Button/index.js +3 -0
  192. package/lib/Button/props/defaultProps.js +2 -0
  193. package/lib/Button/props/propTypes.js +3 -0
  194. package/lib/Buttongroup/Buttongroup.js +32 -12
  195. package/lib/Buttongroup/Buttongroup.module.css +10 -10
  196. package/lib/Buttongroup/__test__/Buttongroup.spec.js +10 -0
  197. package/lib/Buttongroup/props/propTypes.js +3 -0
  198. package/lib/Card/Card.js +102 -46
  199. package/lib/Card/__tests__/Card.spec.js +10 -1
  200. package/lib/Card/index.js +4 -0
  201. package/lib/Card/props/propTypes.js +3 -0
  202. package/lib/CheckBox/CheckBox.js +71 -47
  203. package/lib/CheckBox/CheckBox.module.css +14 -14
  204. package/lib/CheckBox/__tests__/CheckBox.spec.js +3 -0
  205. package/lib/CheckBox/props/propTypes.js +3 -0
  206. package/lib/DateTime/CalendarView.js +82 -42
  207. package/lib/DateTime/DateTime.js +248 -160
  208. package/lib/DateTime/DateTime.module.css +32 -32
  209. package/lib/DateTime/DateTimePopupFooter.js +32 -9
  210. package/lib/DateTime/DateTimePopupHeader.js +49 -18
  211. package/lib/DateTime/DateWidget.js +353 -251
  212. package/lib/DateTime/DaysRow.js +28 -6
  213. package/lib/DateTime/Time.js +74 -33
  214. package/lib/DateTime/YearView.js +78 -29
  215. package/lib/DateTime/YearView.module.css +12 -12
  216. package/lib/DateTime/__tests__/CalendarView.spec.js +13 -5
  217. package/lib/DateTime/__tests__/DateTime.spec.js +51 -37
  218. package/lib/DateTime/__tests__/DateWidget.spec.js +10 -8
  219. package/lib/DateTime/common.js +6 -0
  220. package/lib/DateTime/constants.js +1 -0
  221. package/lib/DateTime/dateFormatUtils/dateFormat.js +184 -122
  222. package/lib/DateTime/dateFormatUtils/dateFormats.js +0 -1
  223. package/lib/DateTime/dateFormatUtils/dayChange.js +14 -7
  224. package/lib/DateTime/dateFormatUtils/index.js +74 -16
  225. package/lib/DateTime/dateFormatUtils/monthChange.js +19 -9
  226. package/lib/DateTime/dateFormatUtils/timeChange.js +55 -23
  227. package/lib/DateTime/dateFormatUtils/yearChange.js +22 -11
  228. package/lib/DateTime/index.js +2 -0
  229. package/lib/DateTime/objectUtils.js +24 -20
  230. package/lib/DateTime/props/defaultProps.js +2 -1
  231. package/lib/DateTime/props/propTypes.js +11 -1
  232. package/lib/DateTime/typeChecker.js +4 -0
  233. package/lib/DateTime/validator.js +73 -10
  234. package/lib/DropBox/DropBox.js +34 -10
  235. package/lib/DropBox/DropBoxElement/DropBoxElement.js +58 -37
  236. package/lib/DropBox/DropBoxElement/css/DropBoxElement.module.css +42 -41
  237. package/lib/DropBox/DropBoxElement/css/cssJSLogic.js +41 -33
  238. package/lib/DropBox/DropBoxElement/props/propTypes.js +3 -0
  239. package/lib/DropBox/DropBoxElement/useDropboxPosCalc.js +14 -9
  240. package/lib/DropBox/__tests__/DropBox.spec.js +6 -2
  241. package/lib/DropBox/css/cssJSLogic.js +3 -1
  242. package/lib/DropBox/props/defaultProps.js +8 -4
  243. package/lib/DropBox/props/propTypes.js +10 -4
  244. package/lib/DropDown/DropDown.js +52 -8
  245. package/lib/DropDown/DropDown.module.css +2 -2
  246. package/lib/DropDown/DropDownHeading.js +39 -20
  247. package/lib/DropDown/DropDownHeading.module.css +5 -5
  248. package/lib/DropDown/DropDownItem.js +42 -20
  249. package/lib/DropDown/DropDownItem.module.css +7 -7
  250. package/lib/DropDown/DropDownSearch.js +40 -17
  251. package/lib/DropDown/DropDownSearch.module.css +3 -3
  252. package/lib/DropDown/DropDownSeparator.js +24 -4
  253. package/lib/DropDown/DropDownSeparator.module.css +2 -2
  254. package/lib/DropDown/__tests__/DropDown.spec.js +15 -9
  255. package/lib/DropDown/__tests__/DropDownItem.spec.js +9 -4
  256. package/lib/DropDown/__tests__/DropDownSearch.spec.js +3 -0
  257. package/lib/DropDown/index.js +9 -0
  258. package/lib/DropDown/props/propTypes.js +6 -4
  259. package/lib/Heading/Heading.js +37 -15
  260. package/lib/Heading/Heading.module.css +1 -1
  261. package/lib/Heading/props/propTypes.js +3 -0
  262. package/lib/Label/Label.js +41 -27
  263. package/lib/Label/Label.module.css +6 -6
  264. package/lib/Label/__tests__/Label.spec.js +14 -1
  265. package/lib/Label/props/propTypes.js +4 -4
  266. package/lib/Layout/Box.js +31 -11
  267. package/lib/Layout/Container.js +29 -10
  268. package/lib/Layout/__tests__/Box.spec.js +65 -49
  269. package/lib/Layout/__tests__/Container.spec.js +67 -50
  270. package/lib/Layout/index.js +3 -0
  271. package/lib/Layout/props/propTypes.js +3 -0
  272. package/lib/Layout/utils.js +10 -0
  273. package/lib/ListItem/ListContainer.js +49 -28
  274. package/lib/ListItem/ListItem.js +70 -46
  275. package/lib/ListItem/ListItem.module.css +37 -37
  276. package/lib/ListItem/ListItemWithAvatar.js +76 -49
  277. package/lib/ListItem/ListItemWithCheckBox.js +64 -39
  278. package/lib/ListItem/ListItemWithIcon.js +69 -45
  279. package/lib/ListItem/ListItemWithRadio.js +65 -41
  280. package/lib/ListItem/index.js +7 -0
  281. package/lib/ListItem/props/propTypes.js +6 -4
  282. package/lib/Modal/Modal.js +46 -11
  283. package/lib/Modal/props/propTypes.js +3 -0
  284. package/lib/MultiSelect/AdvancedGroupMultiSelect.js +295 -167
  285. package/lib/MultiSelect/AdvancedMultiSelect.js +203 -125
  286. package/lib/MultiSelect/EmptyState.js +46 -25
  287. package/lib/MultiSelect/MultiSelect.js +324 -206
  288. package/lib/MultiSelect/MultiSelect.module.css +25 -24
  289. package/lib/MultiSelect/MultiSelectHeader.js +31 -9
  290. package/lib/MultiSelect/MultiSelectWithAvatar.js +106 -64
  291. package/lib/MultiSelect/SelectedOptions.js +44 -18
  292. package/lib/MultiSelect/SelectedOptions.module.css +4 -4
  293. package/lib/MultiSelect/Suggestions.js +65 -33
  294. package/lib/MultiSelect/__tests__/MultiSelect.spec.js +86 -75
  295. package/lib/MultiSelect/index.js +5 -0
  296. package/lib/MultiSelect/props/defaultProps.js +2 -0
  297. package/lib/MultiSelect/props/propTypes.js +5 -0
  298. package/lib/PopOver/PopOver.js +95 -49
  299. package/lib/PopOver/__tests__/PopOver.spec.js +4 -1
  300. package/lib/PopOver/index.js +4 -0
  301. package/lib/PopOver/props/propTypes.js +3 -0
  302. package/lib/Popup/Popup.js +159 -82
  303. package/lib/Popup/__tests__/Popup.spec.js +44 -9
  304. package/lib/Popup/viewPort.js +28 -14
  305. package/lib/Provider/AvatarSize.js +4 -0
  306. package/lib/Provider/Config.js +2 -0
  307. package/lib/Provider/CssProvider.js +4 -0
  308. package/lib/Provider/IdProvider.js +17 -6
  309. package/lib/Provider/LibraryContext.js +35 -15
  310. package/lib/Provider/LibraryContextInit.js +4 -0
  311. package/lib/Provider/NumberGenerator/NumberGenerator.js +44 -15
  312. package/lib/Provider/ZindexProvider.js +15 -3
  313. package/lib/Provider/index.js +5 -0
  314. package/lib/Radio/Radio.js +62 -39
  315. package/lib/Radio/Radio.module.css +9 -9
  316. package/lib/Radio/__tests__/Radiospec.js +9 -5
  317. package/lib/Radio/props/propTypes.js +3 -0
  318. package/lib/Responsive/CustomResponsive.js +73 -28
  319. package/lib/Responsive/RefWrapper.js +17 -11
  320. package/lib/Responsive/ResizeComponent.js +63 -39
  321. package/lib/Responsive/ResizeObserver.js +24 -10
  322. package/lib/Responsive/Responsive.js +81 -31
  323. package/lib/Responsive/index.js +4 -0
  324. package/lib/Responsive/props/propTypes.js +3 -0
  325. package/lib/Responsive/sizeObservers.js +53 -17
  326. package/lib/Responsive/utils/index.js +11 -3
  327. package/lib/Responsive/utils/shallowCompare.js +11 -2
  328. package/lib/Responsive/windowResizeObserver.js +8 -0
  329. package/lib/ResponsiveDropBox/ResponsiveDropBox.js +45 -17
  330. package/lib/ResponsiveDropBox/ResponsiveDropBox.module.css +1 -1
  331. package/lib/ResponsiveDropBox/props/propTypes.js +3 -0
  332. package/lib/Ribbon/Ribbon.js +34 -14
  333. package/lib/Ribbon/Ribbon.module.css +44 -42
  334. package/lib/Ribbon/__tests__/Ribbon.spec.js +22 -0
  335. package/lib/Ribbon/props/propTypes.js +3 -0
  336. package/lib/RippleEffect/RippleEffect.js +18 -10
  337. package/lib/RippleEffect/props/propTypes.js +3 -0
  338. package/lib/Select/GroupSelect.js +230 -131
  339. package/lib/Select/Select.js +291 -209
  340. package/lib/Select/Select.module.css +19 -19
  341. package/lib/Select/SelectWithAvatar.js +103 -57
  342. package/lib/Select/SelectWithIcon.js +133 -77
  343. package/lib/Select/__tests__/Select.spec.js +134 -92
  344. package/lib/Select/index.js +5 -0
  345. package/lib/Select/props/defaultProps.js +5 -4
  346. package/lib/Select/props/propTypes.js +4 -0
  347. package/lib/Stencils/Stencils.js +30 -11
  348. package/lib/Stencils/Stencils.module.css +13 -13
  349. package/lib/Stencils/__tests__/Stencils.spec.js +12 -0
  350. package/lib/Stencils/props/propTypes.js +3 -0
  351. package/lib/Switch/Switch.js +57 -34
  352. package/lib/Switch/Switch.module.css +22 -22
  353. package/lib/Switch/props/propTypes.js +3 -0
  354. package/lib/Tab/Tab.js +41 -28
  355. package/lib/Tab/Tab.module.css +10 -10
  356. package/lib/Tab/TabContent.js +12 -5
  357. package/lib/Tab/TabContentWrapper.js +13 -6
  358. package/lib/Tab/TabWrapper.js +37 -19
  359. package/lib/Tab/Tabs.js +172 -98
  360. package/lib/Tab/Tabs.module.css +12 -12
  361. package/lib/Tab/__tests__/Tab.spec.js +67 -58
  362. package/lib/Tab/__tests__/TabContent.spec.js +10 -6
  363. package/lib/Tab/__tests__/TabContentWrapper.spec.js +28 -20
  364. package/lib/Tab/__tests__/TabWrapper.spec.js +12 -0
  365. package/lib/Tab/__tests__/Tabs.spec.js +53 -39
  366. package/lib/Tab/index.js +6 -0
  367. package/lib/Tab/props/propTypes.js +3 -0
  368. package/lib/Tag/Tag.js +72 -43
  369. package/lib/Tag/Tag.module.css +20 -20
  370. package/lib/Tag/__tests__/Tag.spec.js +14 -8
  371. package/lib/Tag/props/propTypes.js +3 -0
  372. package/lib/TextBox/TextBox.js +86 -60
  373. package/lib/TextBox/TextBox.module.css +15 -14
  374. package/lib/TextBox/__tests__/TextBox.spec.js +14 -4
  375. package/lib/TextBox/props/propTypes.js +6 -4
  376. package/lib/TextBoxIcon/TextBoxIcon.js +79 -52
  377. package/lib/TextBoxIcon/TextBoxIcon.module.css +2 -1
  378. package/lib/TextBoxIcon/__tests__/TextBoxIcon.spec.js +14 -4
  379. package/lib/TextBoxIcon/props/propTypes.js +3 -0
  380. package/lib/Textarea/Textarea.js +55 -30
  381. package/lib/Textarea/Textarea.module.css +21 -21
  382. package/lib/Textarea/__tests__/Textarea.spec.js +14 -2
  383. package/lib/Textarea/props/propTypes.js +3 -0
  384. package/lib/Tooltip/Tooltip.js +94 -31
  385. package/lib/Tooltip/Tooltip.module.css +10 -3
  386. package/lib/Tooltip/__tests__/Tooltip.spec.js +24 -3
  387. package/lib/Tooltip/props/propTypes.js +3 -0
  388. package/lib/VelocityAnimation/VelocityAnimation/VelocityAnimation.js +40 -16
  389. package/lib/VelocityAnimation/VelocityAnimation/props/propTypes.js +3 -0
  390. package/lib/VelocityAnimation/VelocityAnimationGroup/VelocityAnimationGroup.js +53 -25
  391. package/lib/VelocityAnimation/VelocityAnimationGroup/props/propTypes.js +3 -0
  392. package/lib/VelocityAnimation/index.js +3 -0
  393. package/lib/common/avatarsizes.module.css +16 -16
  394. package/lib/common/customscroll.module.css +2 -0
  395. package/lib/common/reset.module.css +1 -0
  396. package/lib/css.js +40 -0
  397. package/lib/deprecated/AdvancedMultiSelect.module.css +16 -16
  398. package/lib/deprecated/PortalLayer/PortalLayer.js +47 -24
  399. package/lib/deprecated/PortalLayer/props/propTypes.js +3 -0
  400. package/lib/index.js +57 -0
  401. package/lib/semantic/Button/Button.js +42 -22
  402. package/lib/semantic/Button/props/propTypes.js +3 -0
  403. package/lib/semantic/index.js +2 -0
  404. package/lib/utils/Common.js +108 -18
  405. package/lib/utils/ContextOptimizer.js +16 -10
  406. package/lib/utils/__tests__/constructFullName.spec.js +1 -0
  407. package/lib/utils/__tests__/debounce.spec.js +3 -2
  408. package/lib/utils/__tests__/getInitial.spec.js +1 -0
  409. package/lib/utils/constructFullName.js +13 -4
  410. package/lib/utils/css/compileClassNames.js +6 -0
  411. package/lib/utils/css/mergeStyle.js +10 -7
  412. package/lib/utils/css/utils.js +8 -0
  413. package/lib/utils/datetime/GMTZones.js +55 -0
  414. package/lib/utils/datetime/common.js +52 -7
  415. package/lib/utils/debounce.js +6 -1
  416. package/lib/utils/dropDownUtils.js +176 -60
  417. package/lib/utils/dummyFunction.js +2 -0
  418. package/lib/utils/getHTMLFontSize.js +1 -0
  419. package/lib/utils/getInitial.js +6 -0
  420. package/lib/utils/index.js +4 -0
  421. package/lib/utils/scrollTo.js +2 -0
  422. package/lib/utils/shallowEqual.js +8 -0
  423. package/package.json +20 -13
@@ -1,87 +1,139 @@
1
1
  "use strict";
2
2
 
3
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
+
4
5
  Object.defineProperty(exports, "__esModule", {
5
6
  value: true
6
7
  });
7
8
  exports["default"] = exports.MultiSelectComponent = void 0;
9
+
8
10
  var _react = _interopRequireDefault(require("react"));
11
+
9
12
  var _propTypes = require("./props/propTypes");
13
+
10
14
  var _defaultProps = require("./props/defaultProps");
15
+
11
16
  var _Popup = _interopRequireDefault(require("../Popup/Popup"));
17
+
12
18
  var _TextBoxIcon = _interopRequireDefault(require("../TextBoxIcon/TextBoxIcon"));
19
+
13
20
  var _Layout = require("../Layout");
21
+
14
22
  var _Card = _interopRequireWildcard(require("../Card/Card"));
23
+
15
24
  var _SelectedOptions = _interopRequireDefault(require("./SelectedOptions"));
25
+
16
26
  var _Suggestions = _interopRequireDefault(require("./Suggestions"));
27
+
17
28
  var _EmptyState = _interopRequireDefault(require("./EmptyState"));
29
+
18
30
  var _MultiSelectHeader = _interopRequireDefault(require("./MultiSelectHeader"));
31
+
19
32
  var _CssProvider = _interopRequireDefault(require("../Provider/CssProvider"));
33
+
20
34
  var _IdProvider = require("../Provider/IdProvider");
35
+
21
36
  var _ResponsiveDropBox = _interopRequireDefault(require("../ResponsiveDropBox/ResponsiveDropBox"));
37
+
22
38
  var _CustomResponsive = require("../Responsive/CustomResponsive");
39
+
23
40
  var _Loader = _interopRequireDefault(require("@zohodesk/svg/lib/Loader/Loader"));
41
+
24
42
  var _icons = require("@zohodesk/icons");
43
+
25
44
  var _MultiSelectModule = _interopRequireDefault(require("./MultiSelect.module.css"));
45
+
26
46
  var _Common = require("../utils/Common.js");
47
+
27
48
  var _dropDownUtils = require("../utils/dropDownUtils");
49
+
28
50
  var _Config = require("../Provider/Config");
51
+
29
52
  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); }
53
+
30
54
  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; }
55
+
31
56
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
57
+
32
58
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
59
+
33
60
  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."); }
34
- function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
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
+
35
64
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
65
+
36
66
  function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
67
+
37
68
  function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
69
+
38
70
  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); }
71
+
39
72
  function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
73
+
40
74
  function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
41
- 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; }
75
+
76
+ 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; }
77
+
42
78
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
43
- 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, _toPropertyKey(descriptor.key), descriptor); } }
79
+
80
+ 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); } }
81
+
44
82
  function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
45
- function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
46
- function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
83
+
47
84
  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); }
85
+
48
86
  function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
87
+
49
88
  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); }; }
89
+
50
90
  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); }
91
+
51
92
  function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
93
+
52
94
  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; } }
53
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } /**** Libraries ****/ /**** Components ****/ /**** Icons ****/ /**** CSS ****/ /**** Methods ****/
95
+
96
+ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
97
+
54
98
  /* eslint-disable react/forbid-component-props */
99
+
55
100
  /* eslint-disable react/no-unused-prop-types */
56
101
  var dummyArray = [];
102
+
57
103
  var MultiSelectComponent = /*#__PURE__*/function (_React$Component) {
58
104
  _inherits(MultiSelectComponent, _React$Component);
105
+
59
106
  var _super = _createSuper(MultiSelectComponent);
107
+
60
108
  function MultiSelectComponent(props) {
61
109
  var _this;
110
+
62
111
  _classCallCheck(this, MultiSelectComponent);
112
+
63
113
  _this = _super.call(this, props);
64
114
  _this.getNextAriaId = (0, _IdProvider.getUniqueId)(_assertThisInitialized(_this));
65
115
  _this.getFilterSuggestions = (0, _dropDownUtils.makeGetMultiSelectFilterSuggestions)();
66
116
  _this.formatOptions = (0, _dropDownUtils.makeFormatOptions)();
67
117
  _this.getSelectedOptions = (0, _dropDownUtils.makeGetMultiSelectSelectedOptions)();
68
- _this.getIsShowClearIcon = (0, _dropDownUtils.makeGetIsShowClearIcon)();
118
+ _this.getIsShowClearIcon = (0, _dropDownUtils.makeGetIsShowClearIcon)(); //Use in AdvancedMultiSelect component
69
119
 
70
- //Use in AdvancedMultiSelect component
71
120
  _this.objectConcat = (0, _dropDownUtils.makeObjectConcat)();
72
121
  _this.formatSelectedOptions = (0, _dropDownUtils.makeFormatOptions)();
73
122
  var _this$props = _this.props,
74
- selectedOptions = _this$props.selectedOptions,
75
- _this$props$searchDeb = _this$props.searchDebounceTime,
76
- searchDebounceTime = _this$props$searchDeb === void 0 ? 500 : _this$props$searchDeb;
123
+ selectedOptions = _this$props.selectedOptions,
124
+ _this$props$searchDeb = _this$props.searchDebounceTime,
125
+ searchDebounceTime = _this$props$searchDeb === void 0 ? 500 : _this$props$searchDeb;
126
+
77
127
  var _this$handleFormatOpt = _this.handleFormatOptions(_this.props),
78
- allOptions = _this$handleFormatOpt.allOptions,
79
- normalizedAllOptions = _this$handleFormatOpt.normalizedAllOptions,
80
- normalizedFormatOptions = _this$handleFormatOpt.normalizedFormatOptions;
128
+ allOptions = _this$handleFormatOpt.allOptions,
129
+ normalizedAllOptions = _this$handleFormatOpt.normalizedAllOptions,
130
+ normalizedFormatOptions = _this$handleFormatOpt.normalizedFormatOptions;
131
+
81
132
  var _this$handleGetSelect = _this.handleGetSelectedOptions(selectedOptions, normalizedFormatOptions, _this.props),
82
- formatSelectedOptions = _this$handleGetSelect.formatSelectedOptions,
83
- normalizedSelectedOptions = _this$handleGetSelect.normalizedSelectedOptions,
84
- selectedOptionIds = _this$handleGetSelect.selectedOptionIds;
133
+ formatSelectedOptions = _this$handleGetSelect.formatSelectedOptions,
134
+ normalizedSelectedOptions = _this$handleGetSelect.normalizedSelectedOptions,
135
+ selectedOptionIds = _this$handleGetSelect.selectedOptionIds;
136
+
85
137
  _this.state = {
86
138
  options: allOptions,
87
139
  optionsNormalize: normalizedAllOptions,
@@ -98,43 +150,50 @@ var MultiSelectComponent = /*#__PURE__*/function (_React$Component) {
98
150
  _this.allSelectedOptionsDetails = normalizedSelectedOptions;
99
151
  _this.suggestionsOrder = [];
100
152
  _this._isMounted = false;
153
+
101
154
  _Common.bind.apply(_assertThisInitialized(_this), ['handleInputCick', 'handleFilterSuggestions', 'handleKeyDown', 'handleSelectAll', 'handleDeselectAll', 'handleSelectOption', 'handleRemoveOption', 'handleSearch', 'handleClickSelectedOption', 'handleChange', 'handlePopupClose', 'togglePopup', 'selectedOptionRef', 'searchInputRef', 'suggestionContainerRef', 'suggestionItemRef', 'selectedOptionContainerRef', 'handleActive', 'handleInactive', 'handleMouseEnter', 'handleFetchOptions', 'handleFormatOptions', 'handleGetSelectedOptions', 'handleComponentDidUpdate', 'handleInputFocus', 'handleExposedPublicMethods']);
155
+
102
156
  _this.handleSearchOptions = (0, _Common.debounce)(_this.handleSearchOptions.bind(_assertThisInitialized(_this)), searchDebounceTime);
103
157
  _this.handleScroll = _this.handleScroll.bind(_assertThisInitialized(_this));
104
158
  _this.handleScrollFuncCall = (0, _Common.debounce)(_this.handleScrollFuncCall.bind(_assertThisInitialized(_this)), 500);
105
159
  return _this;
106
160
  }
161
+
107
162
  _createClass(MultiSelectComponent, [{
108
163
  key: "componentDidMount",
109
164
  value: function componentDidMount() {
110
165
  // let { suggestionContainer } = this;
111
166
  this._isMounted = true;
112
- this.handleExposedPublicMethods();
113
- // suggestionContainer &&
167
+ this.handleExposedPublicMethods(); // suggestionContainer &&
114
168
  // suggestionContainer.addEventListener('scroll', this.handleScroll);
115
169
  }
116
170
  }, {
117
171
  key: "componentWillReceiveProps",
118
172
  value: function componentWillReceiveProps(nextProps) {
119
173
  var _this2 = this;
174
+
120
175
  var selectedOptions = nextProps.selectedOptions,
121
- options = nextProps.options,
122
- valueField = nextProps.valueField,
123
- textField = nextProps.textField,
124
- prefixText = nextProps.prefixText;
176
+ options = nextProps.options,
177
+ valueField = nextProps.valueField,
178
+ textField = nextProps.textField,
179
+ prefixText = nextProps.prefixText;
125
180
  var oldProps = this.props;
181
+
126
182
  if (selectedOptions !== oldProps.selectedOptions || options !== oldProps.options || valueField !== oldProps.valueField || textField !== oldProps.textField || prefixText !== oldProps.prefixText //For GroupMultiSelect component
127
183
  ) {
128
184
  var _this$handleFormatOpt2 = this.handleFormatOptions(nextProps),
129
- allOptions = _this$handleFormatOpt2.allOptions,
130
- normalizedAllOptions = _this$handleFormatOpt2.normalizedAllOptions,
131
- normalizedFormatOptions = _this$handleFormatOpt2.normalizedFormatOptions;
185
+ allOptions = _this$handleFormatOpt2.allOptions,
186
+ normalizedAllOptions = _this$handleFormatOpt2.normalizedAllOptions,
187
+ normalizedFormatOptions = _this$handleFormatOpt2.normalizedFormatOptions;
188
+
132
189
  var oldAllSelectedOptionsDetails = this.allSelectedOptionsDetails;
133
190
  var optionsDetails = Object.assign({}, oldAllSelectedOptionsDetails, normalizedFormatOptions);
191
+
134
192
  var _this$handleGetSelect2 = this.handleGetSelectedOptions(selectedOptions, optionsDetails, nextProps),
135
- formatSelectedOptions = _this$handleGetSelect2.formatSelectedOptions,
136
- normalizedSelectedOptions = _this$handleGetSelect2.normalizedSelectedOptions,
137
- selectedOptionIds = _this$handleGetSelect2.selectedOptionIds;
193
+ formatSelectedOptions = _this$handleGetSelect2.formatSelectedOptions,
194
+ normalizedSelectedOptions = _this$handleGetSelect2.normalizedSelectedOptions,
195
+ selectedOptionIds = _this$handleGetSelect2.selectedOptionIds;
196
+
138
197
  this.allSelectedOptionsDetails = Object.assign(oldAllSelectedOptionsDetails, normalizedSelectedOptions);
139
198
  this.setState({
140
199
  options: allOptions,
@@ -143,11 +202,16 @@ var MultiSelectComponent = /*#__PURE__*/function (_React$Component) {
143
202
  selectedOptionIds: selectedOptionIds
144
203
  }, function () {
145
204
  var hoverOption = _this2.state.hoverOption;
205
+
146
206
  var suggestions = _this2.handleFilterSuggestions();
207
+
147
208
  var suggestionsLen = suggestions.length;
209
+
148
210
  var _ref = suggestions[hoverOption] || {},
149
- id = _ref.id;
211
+ id = _ref.id;
212
+
150
213
  var newHoverOption = !(0, _Common.getIsEmptyValue)(id) ? hoverOption : suggestionsLen ? suggestionsLen - 1 : 0;
214
+
151
215
  _this2.setState({
152
216
  hoverOption: newHoverOption
153
217
  });
@@ -158,23 +222,23 @@ var MultiSelectComponent = /*#__PURE__*/function (_React$Component) {
158
222
  key: "componentDidUpdate",
159
223
  value: function componentDidUpdate(prevProps, prevState) {
160
224
  var suggestionContainer = this.suggestionContainer,
161
- selectedOptionContainer = this.selectedOptionContainer,
162
- suggestionsOrder = this.suggestionsOrder;
225
+ selectedOptionContainer = this.selectedOptionContainer,
226
+ suggestionsOrder = this.suggestionsOrder;
163
227
  var _this$state = this.state,
164
- hoverOption = _this$state.hoverOption,
165
- highLightedSelectOptions = _this$state.highLightedSelectOptions,
166
- selectedOptions = _this$state.selectedOptions,
167
- searchStr = _this$state.searchStr;
228
+ hoverOption = _this$state.hoverOption,
229
+ highLightedSelectOptions = _this$state.highLightedSelectOptions,
230
+ selectedOptions = _this$state.selectedOptions,
231
+ searchStr = _this$state.searchStr;
168
232
  var _this$props2 = this.props,
169
- needLocalSearch = _this$props2.needLocalSearch,
170
- isPopupOpen = _this$props2.isPopupOpen,
171
- onDropBoxClose = _this$props2.onDropBoxClose,
172
- onDropBoxOpen = _this$props2.onDropBoxOpen,
173
- isSearchClearOnClose = _this$props2.isSearchClearOnClose;
233
+ needLocalSearch = _this$props2.needLocalSearch,
234
+ isPopupOpen = _this$props2.isPopupOpen,
235
+ onDropBoxClose = _this$props2.onDropBoxClose,
236
+ onDropBoxOpen = _this$props2.onDropBoxOpen,
237
+ isSearchClearOnClose = _this$props2.isSearchClearOnClose; //handle dropbox open & close
174
238
 
175
- //handle dropbox open & close
176
239
  if (prevProps.isPopupOpen !== isPopupOpen) {
177
240
  isPopupOpen && onDropBoxOpen && this.handleFetchOptions(onDropBoxOpen, searchStr);
241
+
178
242
  if (!isPopupOpen) {
179
243
  this.setState({
180
244
  hoverOption: 0
@@ -182,36 +246,35 @@ var MultiSelectComponent = /*#__PURE__*/function (_React$Component) {
182
246
  isSearchClearOnClose && searchStr && this.handleSearch('');
183
247
  onDropBoxClose && onDropBoxClose();
184
248
  }
185
- }
249
+ } //scrollTo handling
250
+
186
251
 
187
- //scrollTo handling
188
252
  var hoverId = suggestionsOrder[hoverOption] || '';
189
253
  var selectedSuggestion = this["suggestion_".concat(hoverId)];
190
254
  var lastHighLightedSelectOption = highLightedSelectOptions.slice(-1).length ? highLightedSelectOptions.slice(-1)[0] : null;
191
255
  var selectedOption = this["selectedOption_".concat(lastHighLightedSelectOption)];
192
256
  isPopupOpen && (0, _Common.scrollTo)(suggestionContainer, selectedSuggestion);
193
- selectedOptions.length && selectedOption && (0, _Common.scrollTo)(selectedOptionContainer, selectedOption);
257
+ selectedOptions.length && selectedOption && (0, _Common.scrollTo)(selectedOptionContainer, selectedOption); //When suggestions length less than 5, getNextOptions function call
194
258
 
195
- //When suggestions length less than 5, getNextOptions function call
196
259
  var _this$props3 = this.props,
197
- isNextOptions = _this$props3.isNextOptions,
198
- getNextOptions = _this$props3.getNextOptions;
199
- // let { searchStr } = this.state;
260
+ isNextOptions = _this$props3.isNextOptions,
261
+ getNextOptions = _this$props3.getNextOptions; // let { searchStr } = this.state;
262
+
200
263
  var suggestions = this.handleFilterSuggestions();
201
264
  var suggestionsLen = suggestions.length;
265
+
202
266
  if (isPopupOpen && suggestionsLen <= 5 && isNextOptions && getNextOptions && !needLocalSearch) {
203
267
  this.handleFetchOptions(getNextOptions, searchStr);
204
- }
268
+ } //Need To MultiselectNew Component
269
+
205
270
 
206
- //Need To MultiselectNew Component
207
271
  this.handleComponentDidUpdate(prevProps, prevState);
208
272
  }
209
273
  }, {
210
274
  key: "componentWillUnmount",
211
275
  value: function componentWillUnmount() {
212
276
  // let { suggestionContainer } = this;
213
- this._isMounted = false;
214
- // suggestionContainer &&
277
+ this._isMounted = false; // suggestionContainer &&
215
278
  // suggestionContainer.removeEventListener('scroll', this.handleScroll);
216
279
  }
217
280
  }, {
@@ -223,10 +286,10 @@ var MultiSelectComponent = /*#__PURE__*/function (_React$Component) {
223
286
  key: "handleFormatOptions",
224
287
  value: function handleFormatOptions(props) {
225
288
  var options = props.options,
226
- valueField = props.valueField,
227
- textField = props.textField,
228
- prefixText = props.prefixText,
229
- disabledOptions = props.disabledOptions;
289
+ valueField = props.valueField,
290
+ textField = props.textField,
291
+ prefixText = props.prefixText,
292
+ disabledOptions = props.disabledOptions;
230
293
  return this.formatOptions({
231
294
  options: options,
232
295
  valueField: valueField,
@@ -249,9 +312,10 @@ var MultiSelectComponent = /*#__PURE__*/function (_React$Component) {
249
312
  value: function handleInputCick(e) {
250
313
  var removeClose = this.props.removeClose;
251
314
  var _this$state2 = this.state,
252
- highLightedSelectOptions = _this$state2.highLightedSelectOptions,
253
- _this$state2$searchSt = _this$state2.searchStr,
254
- searchStr = _this$state2$searchSt === void 0 ? '' : _this$state2$searchSt;
315
+ highLightedSelectOptions = _this$state2.highLightedSelectOptions,
316
+ _this$state2$searchSt = _this$state2.searchStr,
317
+ searchStr = _this$state2$searchSt === void 0 ? '' : _this$state2$searchSt;
318
+
255
319
  if (highLightedSelectOptions.length) {
256
320
  this.setState({
257
321
  highLightedSelectOptions: [],
@@ -269,23 +333,25 @@ var MultiSelectComponent = /*#__PURE__*/function (_React$Component) {
269
333
  key: "handleFilterSuggestions",
270
334
  value: function handleFilterSuggestions() {
271
335
  var _this$state3 = this.state,
272
- _this$state3$options = _this$state3.options,
273
- options = _this$state3$options === void 0 ? dummyArray : _this$state3$options,
274
- _this$state3$searchSt = _this$state3.searchStr,
275
- searchStr = _this$state3$searchSt === void 0 ? '' : _this$state3$searchSt;
336
+ _this$state3$options = _this$state3.options,
337
+ options = _this$state3$options === void 0 ? dummyArray : _this$state3$options,
338
+ _this$state3$searchSt = _this$state3.searchStr,
339
+ searchStr = _this$state3$searchSt === void 0 ? '' : _this$state3$searchSt;
276
340
  var _this$props4 = this.props,
277
- selectedOptions = _this$props4.selectedOptions,
278
- needLocalSearch = _this$props4.needLocalSearch,
279
- keepSelectedOptions = _this$props4.keepSelectedOptions;
341
+ selectedOptions = _this$props4.selectedOptions,
342
+ needLocalSearch = _this$props4.needLocalSearch,
343
+ keepSelectedOptions = _this$props4.keepSelectedOptions;
344
+
280
345
  var _this$getFilterSugges = this.getFilterSuggestions({
281
- options: options,
282
- selectedOptions: selectedOptions,
283
- searchStr: (0, _Common.getSearchString)(searchStr),
284
- needSearch: needLocalSearch,
285
- keepSelectedOptions: keepSelectedOptions
286
- }),
287
- suggestions = _this$getFilterSugges.suggestions,
288
- suggestionIds = _this$getFilterSugges.suggestionIds;
346
+ options: options,
347
+ selectedOptions: selectedOptions,
348
+ searchStr: (0, _Common.getSearchString)(searchStr),
349
+ needSearch: needLocalSearch,
350
+ keepSelectedOptions: keepSelectedOptions
351
+ }),
352
+ suggestions = _this$getFilterSugges.suggestions,
353
+ suggestionIds = _this$getFilterSugges.suggestionIds;
354
+
289
355
  this.suggestionsOrder = suggestionIds;
290
356
  return suggestions;
291
357
  }
@@ -293,38 +359,45 @@ var MultiSelectComponent = /*#__PURE__*/function (_React$Component) {
293
359
  key: "handleKeyDown",
294
360
  value: function handleKeyDown(e) {
295
361
  var keyCode = e.keyCode,
296
- ctrlKey = e.ctrlKey,
297
- metaKey = e.metaKey,
298
- shiftKey = e.shiftKey;
362
+ ctrlKey = e.ctrlKey,
363
+ metaKey = e.metaKey,
364
+ shiftKey = e.shiftKey;
299
365
  var suggestions = [];
300
366
  var _this$state4 = this.state,
301
- hoverOption = _this$state4.hoverOption,
302
- searchStr = _this$state4.searchStr,
303
- highLightedSelectOptions = _this$state4.highLightedSelectOptions,
304
- lastHighLightedSelectOption = _this$state4.lastHighLightedSelectOption,
305
- shiftKeyPressHighLighted = _this$state4.shiftKeyPressHighLighted,
306
- selectedOptions = _this$state4.selectedOptionIds;
367
+ hoverOption = _this$state4.hoverOption,
368
+ searchStr = _this$state4.searchStr,
369
+ highLightedSelectOptions = _this$state4.highLightedSelectOptions,
370
+ lastHighLightedSelectOption = _this$state4.lastHighLightedSelectOption,
371
+ shiftKeyPressHighLighted = _this$state4.shiftKeyPressHighLighted,
372
+ selectedOptions = _this$state4.selectedOptionIds;
307
373
  var _this$props5 = this.props,
308
- isNextOptions = _this$props5.isNextOptions,
309
- getNextOptions = _this$props5.getNextOptions,
310
- isPopupOpen = _this$props5.isPopupOpen,
311
- isPopupOpenOnEnter = _this$props5.isPopupOpenOnEnter,
312
- onKeyDown = _this$props5.onKeyDown;
374
+ isNextOptions = _this$props5.isNextOptions,
375
+ getNextOptions = _this$props5.getNextOptions,
376
+ isPopupOpen = _this$props5.isPopupOpen,
377
+ isPopupOpenOnEnter = _this$props5.isPopupOpenOnEnter,
378
+ onKeyDown = _this$props5.onKeyDown;
313
379
  var highLightedSelectOptionsLen = highLightedSelectOptions.length;
380
+
314
381
  if (isPopupOpen && (keyCode === 38 || keyCode === 40 || keyCode === 13 || keyCode === 27 || keyCode === 9)) {
315
382
  suggestions = this.handleFilterSuggestions();
316
383
  }
384
+
317
385
  if (!isPopupOpen && !isPopupOpenOnEnter) {
318
386
  onKeyDown && onKeyDown(e);
319
387
  }
388
+
320
389
  if (!isPopupOpen && keyCode === 40) {
321
390
  //down arrow press popup open
322
391
  e.preventDefault(); //prevent body scroll
392
+
323
393
  this.togglePopup(e);
324
394
  }
395
+
325
396
  var suggestionsLen = suggestions.length;
397
+
326
398
  if (suggestionsLen && isPopupOpen && keyCode === 38) {
327
399
  //up arrow
400
+
328
401
  /*if (hoverOption === 0) { //disable first to last option higlight
329
402
  !isNextOptions && this.setState({ hoverOption: suggestionsLen - 1 });
330
403
  }*/
@@ -335,6 +408,7 @@ var MultiSelectComponent = /*#__PURE__*/function (_React$Component) {
335
408
  }
336
409
  } else if (suggestionsLen && isPopupOpen && keyCode === 40) {
337
410
  //down arrow
411
+
338
412
  /*else if (hoverOption === suggestionsLen - 1 || hoverOption === null) {
339
413
  //disable last to first option higlight
340
414
  !isNextOptions && this.setState({ hoverOption: 0 });
@@ -360,8 +434,7 @@ var MultiSelectComponent = /*#__PURE__*/function (_React$Component) {
360
434
  if (highLightedSelectOptionsLen) {
361
435
  this.handleRemoveOption(highLightedSelectOptions);
362
436
  } else {
363
- this.handleRemoveOption(selectedOptions.slice(-1));
364
- // this.setState({
437
+ this.handleRemoveOption(selectedOptions.slice(-1)); // this.setState({
365
438
  // highLightedSelectOptions: selectedOptions.slice(-1)
366
439
  // });
367
440
  }
@@ -376,6 +449,7 @@ var MultiSelectComponent = /*#__PURE__*/function (_React$Component) {
376
449
  var lastHighLightedSelectOptionIndex = lastHighLightedSelectOption && selectedOptions.indexOf(lastHighLightedSelectOption) >= 0 ? selectedOptions.indexOf(lastHighLightedSelectOption) : 0;
377
450
  var newShiftKeyPressHighLighted = shiftKeyPressHighLighted ? shiftKeyPressHighLighted : shiftKeyPressHighLighted + 1;
378
451
  var newHighLightedSelectOption = lastHighLightedSelectOptionIndex !== null ? selectedOptions[lastHighLightedSelectOptionIndex + newShiftKeyPressHighLighted] : selectedOptions[0];
452
+
379
453
  if (!(0, _Common.getIsEmptyValue)(newHighLightedSelectOption)) {
380
454
  var newLastHighLightedSelectOption = lastHighLightedSelectOption ? lastHighLightedSelectOption : selectedOptions[0];
381
455
  highLightedSelectOptions = !shiftKeyPressHighLighted ? [newLastHighLightedSelectOption] : highLightedSelectOptions;
@@ -392,15 +466,22 @@ var MultiSelectComponent = /*#__PURE__*/function (_React$Component) {
392
466
  } else if (keyCode === 37 && shiftKey && selectedOptions.length && !searchStr.length) {
393
467
  // shift+left arrow=37
394
468
  var _lastHighLightedSelectOptionIndex = lastHighLightedSelectOption ? selectedOptions.indexOf(lastHighLightedSelectOption) : selectedOptions.length - 1;
469
+
395
470
  var _newShiftKeyPressHighLighted = shiftKeyPressHighLighted !== 1 ? shiftKeyPressHighLighted : shiftKeyPressHighLighted - 1;
471
+
396
472
  var _newHighLightedSelectOption = selectedOptions[_lastHighLightedSelectOptionIndex + _newShiftKeyPressHighLighted - 1];
473
+
397
474
  if (!(0, _Common.getIsEmptyValue)(_newHighLightedSelectOption)) {
398
475
  var _newLastHighLightedSelectOption = lastHighLightedSelectOption ? lastHighLightedSelectOption : selectedOptions.slice(-1)[0];
476
+
399
477
  highLightedSelectOptions = !shiftKeyPressHighLighted ? [_newLastHighLightedSelectOption] : highLightedSelectOptions;
478
+
400
479
  var _isRemove = highLightedSelectOptions.indexOf(_newHighLightedSelectOption) >= 0 && _newHighLightedSelectOption !== lastHighLightedSelectOption ? true : false;
480
+
401
481
  var _newHighLightedSelectOptions = _isRemove ? highLightedSelectOptions.filter(function (option) {
402
482
  return option !== _newHighLightedSelectOption;
403
483
  }) : [].concat(_toConsumableArray(highLightedSelectOptions), [_newHighLightedSelectOption]);
484
+
404
485
  this.setState({
405
486
  highLightedSelectOptions: _newHighLightedSelectOptions,
406
487
  shiftKeyPressHighLighted: _newShiftKeyPressHighLighted - 1,
@@ -408,16 +489,19 @@ var MultiSelectComponent = /*#__PURE__*/function (_React$Component) {
408
489
  });
409
490
  }
410
491
  } else if ((keyCode === 39 || keyCode === 37) && selectedOptions.length && !searchStr.length) {
411
- var isRightArrow = keyCode === 39 ? true : false;
412
- // let isLefttArrow = keyCode === 37 ? true : false;
492
+ var isRightArrow = keyCode === 39 ? true : false; // let isLefttArrow = keyCode === 37 ? true : false;
493
+
413
494
  if (highLightedSelectOptions.length) {
414
495
  var _highLightedSelectOpt = highLightedSelectOptions.slice(-1),
415
- _highLightedSelectOpt2 = _slicedToArray(_highLightedSelectOpt, 1),
416
- _lastHighLightedSelectOption = _highLightedSelectOpt2[0];
496
+ _highLightedSelectOpt2 = _slicedToArray(_highLightedSelectOpt, 1),
497
+ _lastHighLightedSelectOption = _highLightedSelectOpt2[0];
498
+
417
499
  var _lastHighLightedSelectOptionIndex2 = selectedOptions.indexOf(_lastHighLightedSelectOption);
500
+
418
501
  var newLastHighLightedSelectOptionIndex = isRightArrow ? _lastHighLightedSelectOptionIndex2 === selectedOptions.length - 1 ? _lastHighLightedSelectOptionIndex2 : _lastHighLightedSelectOptionIndex2 + 1 : _lastHighLightedSelectOptionIndex2 - 1;
419
502
  var _newLastHighLightedSelectOption2 = selectedOptions[newLastHighLightedSelectOptionIndex];
420
503
  var isEmptyHighlighted = isRightArrow && highLightedSelectOptions.length === 1 && selectedOptions.slice(-1)[0] === _lastHighLightedSelectOption ? true : false;
504
+
421
505
  if (!(0, _Common.getIsEmptyValue)(_newLastHighLightedSelectOption2)) {
422
506
  this.setState({
423
507
  lastHighLightedSelectOption: isEmptyHighlighted ? '' : _newLastHighLightedSelectOption2,
@@ -427,16 +511,16 @@ var MultiSelectComponent = /*#__PURE__*/function (_React$Component) {
427
511
  }
428
512
  } else {
429
513
  var _ref2 = isRightArrow ? selectedOptions : selectedOptions.slice(-1),
430
- _ref3 = _slicedToArray(_ref2, 1),
431
- _newLastHighLightedSelectOption3 = _ref3[0];
514
+ _ref3 = _slicedToArray(_ref2, 1),
515
+ _newLastHighLightedSelectOption3 = _ref3[0];
516
+
432
517
  this.setState({
433
518
  lastHighLightedSelectOption: _newLastHighLightedSelectOption3,
434
519
  highLightedSelectOptions: [_newLastHighLightedSelectOption3],
435
520
  shiftKeyPressHighLighted: 0
436
521
  });
437
522
  }
438
- } else if (keyCode === 27) {
439
- // this.handlePopupClose(e);
523
+ } else if (keyCode === 27) {// this.handlePopupClose(e);
440
524
  } else if (keyCode === 9) {
441
525
  this.handlePopupClose(e);
442
526
  }
@@ -450,12 +534,12 @@ var MultiSelectComponent = /*#__PURE__*/function (_React$Component) {
450
534
  var newSelectedOptions = [];
451
535
  suggestions.forEach(function (option) {
452
536
  var id = option.id;
537
+
453
538
  if (selectedOptions.indexOf(id) === -1) {
454
539
  newSelectedOptions.push(id);
455
540
  }
456
541
  });
457
- this.handleChange([].concat(_toConsumableArray(selectedOptions), newSelectedOptions));
458
- // this.handlePopupClose(e);
542
+ this.handleChange([].concat(_toConsumableArray(selectedOptions), newSelectedOptions)); // this.handlePopupClose(e);
459
543
  }
460
544
  }, {
461
545
  key: "handleDeselectAll",
@@ -463,12 +547,14 @@ var MultiSelectComponent = /*#__PURE__*/function (_React$Component) {
463
547
  e && e.preventDefault();
464
548
  var removeClose = this.props.removeClose;
465
549
  var highLightedSelectOptions = this.state.highLightedSelectOptions;
550
+
466
551
  if (highLightedSelectOptions.length) {
467
552
  this.setState({
468
553
  highLightedSelectOptions: [],
469
554
  lastHighLightedSelectOption: ''
470
555
  });
471
556
  }
557
+
472
558
  removeClose(e);
473
559
  this.handleChange([]);
474
560
  }
@@ -476,13 +562,15 @@ var MultiSelectComponent = /*#__PURE__*/function (_React$Component) {
476
562
  key: "handleSelectOption",
477
563
  value: function handleSelectOption(option, value, index, e) {
478
564
  var _this$props6 = this.props,
479
- selectedOptions = _this$props6.selectedOptions,
480
- isSearchClearOnSelect = _this$props6.isSearchClearOnSelect,
481
- keepSelectedOptions = _this$props6.keepSelectedOptions;
565
+ selectedOptions = _this$props6.selectedOptions,
566
+ isSearchClearOnSelect = _this$props6.isSearchClearOnSelect,
567
+ keepSelectedOptions = _this$props6.keepSelectedOptions;
482
568
  var searchStr = this.state.searchStr;
569
+
483
570
  if (searchStr.trim() != '' && isSearchClearOnSelect) {
484
571
  this.handleSearch('');
485
572
  }
573
+
486
574
  if (keepSelectedOptions && selectedOptions.indexOf(option) != -1) {
487
575
  var newSelectedOptions = selectedOptions.filter(function (id) {
488
576
  return id != option;
@@ -497,12 +585,13 @@ var MultiSelectComponent = /*#__PURE__*/function (_React$Component) {
497
585
  value: function handleRemoveOption(options) {
498
586
  var newOptions = !(0, _Common.getIsEmptyValue)(options) && !Array.isArray(options) ? [options] : options;
499
587
  var _this$props7 = this.props,
500
- selectedOptions = _this$props7.selectedOptions,
501
- isReadOnly = _this$props7.isReadOnly;
588
+ selectedOptions = _this$props7.selectedOptions,
589
+ isReadOnly = _this$props7.isReadOnly;
502
590
  var _this$state5 = this.state,
503
- highLightedSelectOptions = _this$state5.highLightedSelectOptions,
504
- lastHighLightedSelectOption = _this$state5.lastHighLightedSelectOption,
505
- shiftKeyPressHighLighted = _this$state5.shiftKeyPressHighLighted;
591
+ highLightedSelectOptions = _this$state5.highLightedSelectOptions,
592
+ lastHighLightedSelectOption = _this$state5.lastHighLightedSelectOption,
593
+ shiftKeyPressHighLighted = _this$state5.shiftKeyPressHighLighted;
594
+
506
595
  if (newOptions.length && !isReadOnly) {
507
596
  var newSelectedOptions = selectedOptions.filter(function (option) {
508
597
  return newOptions.indexOf(option) === -1;
@@ -512,13 +601,16 @@ var MultiSelectComponent = /*#__PURE__*/function (_React$Component) {
512
601
  });
513
602
  var isHighlightedRemoved = false;
514
603
  var newOptionsLen = newOptions.length;
604
+
515
605
  for (var i = 0; i < newOptionsLen; i++) {
516
606
  var removedOption = newOptions[i];
607
+
517
608
  if (highLightedSelectOptions.indexOf(removedOption) >= 0) {
518
609
  isHighlightedRemoved = true;
519
610
  break;
520
611
  }
521
612
  }
613
+
522
614
  this.setState({
523
615
  lastHighLightedSelectOption: newSelectedOptions.indexOf(lastHighLightedSelectOption) >= 0 && !isHighlightedRemoved ? lastHighLightedSelectOption : '',
524
616
  highLightedSelectOptions: isHighlightedRemoved ? [] : newHighLightedSelectOptions,
@@ -526,6 +618,7 @@ var MultiSelectComponent = /*#__PURE__*/function (_React$Component) {
526
618
  });
527
619
  this.handleChange(newSelectedOptions);
528
620
  }
621
+
529
622
  this.searchInput && this.searchInput.focus({
530
623
  preventScroll: true
531
624
  });
@@ -537,6 +630,7 @@ var MultiSelectComponent = /*#__PURE__*/function (_React$Component) {
537
630
  var hoverOption = this.state.hoverOption;
538
631
  var suggestionsOrder = this.suggestionsOrder;
539
632
  var newHoverIndex = suggestionsOrder.indexOf(id);
633
+
540
634
  if (newHoverIndex !== hoverOption) {
541
635
  this.setState({
542
636
  hoverOption: newHoverIndex
@@ -547,18 +641,22 @@ var MultiSelectComponent = /*#__PURE__*/function (_React$Component) {
547
641
  key: "handleFetchOptions",
548
642
  value: function handleFetchOptions() {
549
643
  var _this3 = this;
644
+
550
645
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
551
646
  args[_key] = arguments[_key];
552
647
  }
648
+
553
649
  var APICall = args[0],
554
- searchStr = args[1];
650
+ searchStr = args[1];
555
651
  var isFetchingOptions = this.state.isFetchingOptions;
556
652
  var _isMounted = this._isMounted;
557
653
  var isForce = isFetchingOptions && searchStr ? true : false;
654
+
558
655
  if (!isFetchingOptions && APICall || isForce) {
559
656
  this.setState({
560
657
  isFetchingOptions: true
561
658
  });
659
+
562
660
  try {
563
661
  return APICall(searchStr).then(function () {
564
662
  _isMounted && _this3.setState({
@@ -587,12 +685,13 @@ var MultiSelectComponent = /*#__PURE__*/function (_React$Component) {
587
685
  key: "handleSearch",
588
686
  value: function handleSearch(value, e) {
589
687
  var _this4 = this;
688
+
590
689
  var _this$props8 = this.props,
591
- onSearch = _this$props8.onSearch,
592
- isPopupOpen = _this$props8.isPopupOpen;
690
+ onSearch = _this$props8.onSearch,
691
+ isPopupOpen = _this$props8.isPopupOpen;
593
692
  !isPopupOpen && e && this.togglePopup(e);
594
693
  var _this$state$searchStr = this.state.searchStr,
595
- searchStr = _this$state$searchStr === void 0 ? '' : _this$state$searchStr;
694
+ searchStr = _this$state$searchStr === void 0 ? '' : _this$state$searchStr;
596
695
  var searchStrRegex = (0, _Common.getSearchString)(searchStr);
597
696
  var valueStrRegex = (0, _Common.getSearchString)(value);
598
697
  var isSearch = searchStrRegex !== valueStrRegex ? true : false;
@@ -613,19 +712,22 @@ var MultiSelectComponent = /*#__PURE__*/function (_React$Component) {
613
712
  var e = arguments.length > 1 ? arguments[1] : undefined;
614
713
  var selectedOptions = this.props.selectedOptions;
615
714
  var _this$state6 = this.state,
616
- highLightedSelectOptions = _this$state6.highLightedSelectOptions,
617
- lastHighLightedSelectOption = _this$state6.lastHighLightedSelectOption;
715
+ highLightedSelectOptions = _this$state6.highLightedSelectOptions,
716
+ lastHighLightedSelectOption = _this$state6.lastHighLightedSelectOption;
618
717
  var metaKey = e.metaKey,
619
- ctrlKey = e.ctrlKey,
620
- shiftKey = e.shiftKey;
718
+ ctrlKey = e.ctrlKey,
719
+ shiftKey = e.shiftKey;
720
+
621
721
  if (e && shiftKey) {
622
722
  //shift+click
623
723
  var from = selectedOptions.indexOf(lastHighLightedSelectOption) >= 0 ? selectedOptions.indexOf(lastHighLightedSelectOption) : 0;
624
724
  var to = id && selectedOptions.indexOf(id) >= 0 ? selectedOptions.indexOf(id) : null;
725
+
625
726
  if (to >= 0 && to < from) {
626
727
  var _ref4 = [from, from = to];
627
728
  to = _ref4[0];
628
729
  }
730
+
629
731
  to += 1;
630
732
  var newSelectedHighlights = to ? selectedOptions.slice(from, to) : [];
631
733
  to && this.setState({
@@ -636,6 +738,7 @@ var MultiSelectComponent = /*#__PURE__*/function (_React$Component) {
636
738
  //ctrl+click
637
739
  var isRemove = highLightedSelectOptions.indexOf(id) >= 0;
638
740
  var _newSelectedHighlights = [];
741
+
639
742
  if (isRemove) {
640
743
  lastHighLightedSelectOption = id === lastHighLightedSelectOption ? '' : lastHighLightedSelectOption;
641
744
  _newSelectedHighlights = highLightedSelectOptions.filter(function (option) {
@@ -645,6 +748,7 @@ var MultiSelectComponent = /*#__PURE__*/function (_React$Component) {
645
748
  lastHighLightedSelectOption = id;
646
749
  _newSelectedHighlights = [].concat(_toConsumableArray(highLightedSelectOptions), [id]);
647
750
  }
751
+
648
752
  this.setState({
649
753
  highLightedSelectOptions: _newSelectedHighlights,
650
754
  lastHighLightedSelectOption: lastHighLightedSelectOption
@@ -655,6 +759,7 @@ var MultiSelectComponent = /*#__PURE__*/function (_React$Component) {
655
759
  lastHighLightedSelectOption: id
656
760
  });
657
761
  }
762
+
658
763
  this.setState({
659
764
  shiftKeyPressHighLighted: 0
660
765
  });
@@ -673,8 +778,8 @@ var MultiSelectComponent = /*#__PURE__*/function (_React$Component) {
673
778
  key: "handleScrollFuncCall",
674
779
  value: function handleScrollFuncCall() {
675
780
  var _this$props9 = this.props,
676
- getNextOptions = _this$props9.getNextOptions,
677
- isNextOptions = _this$props9.isNextOptions;
781
+ getNextOptions = _this$props9.getNextOptions,
782
+ isNextOptions = _this$props9.isNextOptions;
678
783
  var searchStr = this.state.searchStr;
679
784
  isNextOptions && getNextOptions && this.handleFetchOptions(getNextOptions, searchStr);
680
785
  }
@@ -685,29 +790,34 @@ var MultiSelectComponent = /*#__PURE__*/function (_React$Component) {
685
790
  var e = arguments.length > 1 ? arguments[1] : undefined;
686
791
  var optionsNormalize = this.state.optionsNormalize;
687
792
  var _this$props10 = this.props,
688
- onChange = _this$props10.onChange,
689
- needToCloseOnSelect = _this$props10.needToCloseOnSelect,
690
- togglePopup = _this$props10.togglePopup,
691
- propSelectedOptions = _this$props10.selectedOptions,
692
- _this$props10$disable = _this$props10.disabledOptions,
693
- disabledOptions = _this$props10$disable === void 0 ? dummyArray : _this$props10$disable;
793
+ onChange = _this$props10.onChange,
794
+ needToCloseOnSelect = _this$props10.needToCloseOnSelect,
795
+ togglePopup = _this$props10.togglePopup,
796
+ propSelectedOptions = _this$props10.selectedOptions,
797
+ _this$props10$disable = _this$props10.disabledOptions,
798
+ disabledOptions = _this$props10$disable === void 0 ? dummyArray : _this$props10$disable;
799
+
694
800
  var _filterSelectedOption = (0, _dropDownUtils.filterSelectedOptions)({
695
- selectedOptions: selectedOptions,
696
- propSelectedOptions: propSelectedOptions,
697
- disabledOptions: disabledOptions
698
- }),
699
- newSelectedOptions = _filterSelectedOption.newSelectedOptions;
801
+ selectedOptions: selectedOptions,
802
+ propSelectedOptions: propSelectedOptions,
803
+ disabledOptions: disabledOptions
804
+ }),
805
+ newSelectedOptions = _filterSelectedOption.newSelectedOptions;
806
+
700
807
  var selectedOptionsLen = newSelectedOptions.length;
701
808
  var allSelectedOptionsDetails = [];
809
+
702
810
  for (var i = 0; i < selectedOptionsLen; i++) {
703
811
  var id = newSelectedOptions[i];
704
812
  allSelectedOptionsDetails.push(optionsNormalize[id]);
705
813
  }
706
- onChange && onChange(newSelectedOptions, allSelectedOptionsDetails);
707
- // this.setState({ searchStr: '' });
814
+
815
+ onChange && onChange(newSelectedOptions, allSelectedOptionsDetails); // this.setState({ searchStr: '' });
816
+
708
817
  this.searchInput && this.searchInput.focus({
709
818
  preventScroll: true
710
819
  });
820
+
711
821
  if (needToCloseOnSelect) {
712
822
  togglePopup(e);
713
823
  }
@@ -716,9 +826,9 @@ var MultiSelectComponent = /*#__PURE__*/function (_React$Component) {
716
826
  key: "togglePopup",
717
827
  value: function togglePopup(e) {
718
828
  var _this$props11 = this.props,
719
- togglePopup = _this$props11.togglePopup,
720
- defaultDropBoxPosition = _this$props11.defaultDropBoxPosition,
721
- isReadOnly = _this$props11.isReadOnly;
829
+ togglePopup = _this$props11.togglePopup,
830
+ defaultDropBoxPosition = _this$props11.defaultDropBoxPosition,
831
+ isReadOnly = _this$props11.isReadOnly;
722
832
  !isReadOnly && togglePopup(e, defaultDropBoxPosition ? "".concat(defaultDropBoxPosition) : null);
723
833
  }
724
834
  }, {
@@ -760,15 +870,18 @@ var MultiSelectComponent = /*#__PURE__*/function (_React$Component) {
760
870
  key: "handleActive",
761
871
  value: function handleActive(e) {
762
872
  var _this$state7 = this.state,
763
- searchStr = _this$state7.searchStr,
764
- isActive = _this$state7.isActive;
873
+ searchStr = _this$state7.searchStr,
874
+ isActive = _this$state7.isActive;
875
+
765
876
  if (!isActive) {
766
877
  this.setState({
767
878
  isActive: true
768
879
  });
769
880
  }
881
+
770
882
  var _ref5 = e || {},
771
- target = _ref5.target;
883
+ target = _ref5.target;
884
+
772
885
  target && target.setSelectionRange(target, 0);
773
886
  var onFocus = this.props.onFocus;
774
887
  onFocus && onFocus(searchStr);
@@ -777,6 +890,7 @@ var MultiSelectComponent = /*#__PURE__*/function (_React$Component) {
777
890
  key: "handleInactive",
778
891
  value: function handleInactive() {
779
892
  var isActive = this.state.isActive;
893
+
780
894
  if (isActive) {
781
895
  this.setState({
782
896
  isActive: false
@@ -787,8 +901,8 @@ var MultiSelectComponent = /*#__PURE__*/function (_React$Component) {
787
901
  key: "handleInputFocus",
788
902
  value: function handleInputFocus() {
789
903
  var _this$props12 = this.props,
790
- isDisabled = _this$props12.isDisabled,
791
- isReadOnly = _this$props12.isReadOnly;
904
+ isDisabled = _this$props12.isDisabled,
905
+ isReadOnly = _this$props12.isReadOnly;
792
906
  this.searchInput && !isDisabled && !isReadOnly && this.searchInput.focus({
793
907
  preventScroll: true
794
908
  });
@@ -797,8 +911,8 @@ var MultiSelectComponent = /*#__PURE__*/function (_React$Component) {
797
911
  key: "handleExposedPublicMethods",
798
912
  value: function handleExposedPublicMethods() {
799
913
  var _this$props13 = this.props,
800
- getPublicMethods = _this$props13.getPublicMethods,
801
- openPopupOnly = _this$props13.openPopupOnly;
914
+ getPublicMethods = _this$props13.getPublicMethods,
915
+ openPopupOnly = _this$props13.openPopupOnly;
802
916
  getPublicMethods && getPublicMethods({
803
917
  openPopupOnly: openPopupOnly
804
918
  });
@@ -817,80 +931,83 @@ var MultiSelectComponent = /*#__PURE__*/function (_React$Component) {
817
931
  key: "render",
818
932
  value: function render() {
819
933
  var _this5 = this;
934
+
820
935
  var _this$props14 = this.props,
821
- isReadOnly = _this$props14.isReadOnly,
822
- needSelectAll = _this$props14.needSelectAll,
823
- searchEmptyMessage = _this$props14.searchEmptyMessage,
824
- emptyMessage = _this$props14.emptyMessage,
825
- noMoreOptionsMessage = _this$props14.noMoreOptionsMessage,
826
- dropBoxSize = _this$props14.dropBoxSize,
827
- placeHolder = _this$props14.placeHolder,
828
- isPopupOpen = _this$props14.isPopupOpen,
829
- isPopupReady = _this$props14.isPopupReady,
830
- position = _this$props14.position,
831
- defaultDropBoxPosition = _this$props14.defaultDropBoxPosition,
832
- selectAllText = _this$props14.selectAllText,
833
- getContainerRef = _this$props14.getContainerRef,
834
- removeClose = _this$props14.removeClose,
835
- isAnimate = _this$props14.isAnimate,
836
- animationStyle = _this$props14.animationStyle,
837
- textBoxSize = _this$props14.textBoxSize,
838
- variant = _this$props14.variant,
839
- size = _this$props14.size,
840
- isDisabled = _this$props14.isDisabled,
841
- title = _this$props14.title,
842
- needResponsive = _this$props14.needResponsive,
843
- dataId = _this$props14.dataId,
844
- dataSelectorId = _this$props14.dataSelectorId,
845
- isSearching = _this$props14.isSearching,
846
- borderColor = _this$props14.borderColor,
847
- textBoxClass = _this$props14.textBoxClass,
848
- needBorder = _this$props14.needBorder,
849
- disableAction = _this$props14.disableAction,
850
- isBoxPaddingNeed = _this$props14.isBoxPaddingNeed,
851
- palette = _this$props14.palette,
852
- needAutoFocus = _this$props14.needAutoFocus,
853
- htmlId = _this$props14.htmlId,
854
- i18nKeys = _this$props14.i18nKeys,
855
- a11y = _this$props14.a11y,
856
- children = _this$props14.children,
857
- customChildrenClass = _this$props14.customChildrenClass,
858
- getFooter = _this$props14.getFooter,
859
- needEffect = _this$props14.needEffect,
860
- disabledOptions = _this$props14.disabledOptions,
861
- boxSize = _this$props14.boxSize,
862
- autoComplete = _this$props14.autoComplete,
863
- isLoading = _this$props14.isLoading;
936
+ isReadOnly = _this$props14.isReadOnly,
937
+ needSelectAll = _this$props14.needSelectAll,
938
+ searchEmptyMessage = _this$props14.searchEmptyMessage,
939
+ emptyMessage = _this$props14.emptyMessage,
940
+ noMoreOptionsMessage = _this$props14.noMoreOptionsMessage,
941
+ dropBoxSize = _this$props14.dropBoxSize,
942
+ placeHolder = _this$props14.placeHolder,
943
+ isPopupOpen = _this$props14.isPopupOpen,
944
+ isPopupReady = _this$props14.isPopupReady,
945
+ position = _this$props14.position,
946
+ defaultDropBoxPosition = _this$props14.defaultDropBoxPosition,
947
+ selectAllText = _this$props14.selectAllText,
948
+ getContainerRef = _this$props14.getContainerRef,
949
+ removeClose = _this$props14.removeClose,
950
+ isAnimate = _this$props14.isAnimate,
951
+ animationStyle = _this$props14.animationStyle,
952
+ textBoxSize = _this$props14.textBoxSize,
953
+ variant = _this$props14.variant,
954
+ size = _this$props14.size,
955
+ isDisabled = _this$props14.isDisabled,
956
+ title = _this$props14.title,
957
+ needResponsive = _this$props14.needResponsive,
958
+ dataId = _this$props14.dataId,
959
+ dataSelectorId = _this$props14.dataSelectorId,
960
+ isSearching = _this$props14.isSearching,
961
+ borderColor = _this$props14.borderColor,
962
+ textBoxClass = _this$props14.textBoxClass,
963
+ needBorder = _this$props14.needBorder,
964
+ disableAction = _this$props14.disableAction,
965
+ isBoxPaddingNeed = _this$props14.isBoxPaddingNeed,
966
+ palette = _this$props14.palette,
967
+ needAutoFocus = _this$props14.needAutoFocus,
968
+ htmlId = _this$props14.htmlId,
969
+ i18nKeys = _this$props14.i18nKeys,
970
+ a11y = _this$props14.a11y,
971
+ children = _this$props14.children,
972
+ customChildrenClass = _this$props14.customChildrenClass,
973
+ getFooter = _this$props14.getFooter,
974
+ needEffect = _this$props14.needEffect,
975
+ disabledOptions = _this$props14.disabledOptions,
976
+ boxSize = _this$props14.boxSize,
977
+ autoComplete = _this$props14.autoComplete,
978
+ isLoading = _this$props14.isLoading;
864
979
  var _i18nKeys = i18nKeys,
865
- _i18nKeys$clearText = _i18nKeys.clearText,
866
- clearText = _i18nKeys$clearText === void 0 ? 'Clear all' : _i18nKeys$clearText,
867
- _i18nKeys$searchText = _i18nKeys.searchText,
868
- searchText = _i18nKeys$searchText === void 0 ? 'Searching...' : _i18nKeys$searchText;
980
+ _i18nKeys$clearText = _i18nKeys.clearText,
981
+ clearText = _i18nKeys$clearText === void 0 ? 'Clear all' : _i18nKeys$clearText,
982
+ _i18nKeys$searchText = _i18nKeys.searchText,
983
+ searchText = _i18nKeys$searchText === void 0 ? 'Searching...' : _i18nKeys$searchText;
869
984
  var _a11y$clearLabel = a11y.clearLabel,
870
- clearLabel = _a11y$clearLabel === void 0 ? 'Clear all' : _a11y$clearLabel,
871
- ariaLabelledby = a11y.ariaLabelledby;
985
+ clearLabel = _a11y$clearLabel === void 0 ? 'Clear all' : _a11y$clearLabel,
986
+ ariaLabelledby = a11y.ariaLabelledby;
872
987
  i18nKeys = Object.assign({}, i18nKeys, {
873
988
  emptyText: i18nKeys.emptyText || emptyMessage,
874
989
  searchEmptyText: i18nKeys.searchEmptyText || searchEmptyMessage,
875
990
  noMoreText: i18nKeys.noMoreText || noMoreOptionsMessage
876
991
  });
877
992
  var _this$state8 = this.state,
878
- selectedOptions = _this$state8.selectedOptions,
879
- searchStr = _this$state8.searchStr,
880
- hoverOption = _this$state8.hoverOption,
881
- highLightedSelectOptions = _this$state8.highLightedSelectOptions,
882
- options = _this$state8.options,
883
- isFetchingOptions = _this$state8.isFetchingOptions,
884
- isActive = _this$state8.isActive,
885
- selectedOptionIds = _this$state8.selectedOptionIds;
993
+ selectedOptions = _this$state8.selectedOptions,
994
+ searchStr = _this$state8.searchStr,
995
+ hoverOption = _this$state8.hoverOption,
996
+ highLightedSelectOptions = _this$state8.highLightedSelectOptions,
997
+ options = _this$state8.options,
998
+ isFetchingOptions = _this$state8.isFetchingOptions,
999
+ isActive = _this$state8.isActive,
1000
+ selectedOptionIds = _this$state8.selectedOptionIds;
886
1001
  var suggestions = this.handleFilterSuggestions();
887
1002
  var setAriaId = this.getNextAriaId();
888
1003
  var ariaErrorId = this.getNextAriaId();
1004
+
889
1005
  var _this$getIsShowClearI = this.getIsShowClearIcon({
890
- selectedOptions: selectedOptions,
891
- disabledOptions: disabledOptions
892
- }),
893
- isShowClear = _this$getIsShowClearI.isShowClearIcon;
1006
+ selectedOptions: selectedOptions,
1007
+ disabledOptions: disabledOptions
1008
+ }),
1009
+ isShowClear = _this$getIsShowClearI.isShowClearIcon;
1010
+
894
1011
  var isShowClearIcon = !isReadOnly && !isDisabled && !disableAction && isShowClear;
895
1012
  return /*#__PURE__*/_react["default"].createElement("div", {
896
1013
  className: "".concat(_MultiSelectModule["default"].wrapper, " ").concat(isDisabled ? _MultiSelectModule["default"].disabled : '', " ").concat(isReadOnly ? _MultiSelectModule["default"].readOnly : '', " ").concat(disableAction ? (0, _CssProvider["default"])('isBlock') : '', " ").concat(borderColor === 'transparent' ? _MultiSelectModule["default"].transparentContainer : '', " ").concat(needEffect && !(isDisabled || isReadOnly) ? _MultiSelectModule["default"].effect : ''),
@@ -1041,18 +1158,19 @@ var MultiSelectComponent = /*#__PURE__*/function (_React$Component) {
1041
1158
  }) : null);
1042
1159
  }
1043
1160
  }]);
1161
+
1044
1162
  return MultiSelectComponent;
1045
1163
  }(_react["default"].Component);
1164
+
1046
1165
  exports.MultiSelectComponent = MultiSelectComponent;
1047
1166
  MultiSelectComponent.propTypes = _propTypes.MultiSelect_propTypes;
1048
- MultiSelectComponent.defaultProps = _defaultProps.MultiSelect_defaultProps;
1049
-
1050
- // if (__DOCS__) {
1167
+ MultiSelectComponent.defaultProps = _defaultProps.MultiSelect_defaultProps; // if (__DOCS__) {
1051
1168
  // MultiSelectComponent.docs = {
1052
1169
  // componentGroup: 'Form Elements',
1053
1170
  // folderName: 'Style Guide'
1054
1171
  // };
1055
1172
  // }
1173
+
1056
1174
  MultiSelectComponent.displayName = 'MultiSelect';
1057
1175
  var MultiSelect = (0, _Popup["default"])(MultiSelectComponent);
1058
1176
  MultiSelect.propTypes = MultiSelectComponent.propTypes;