@zohodesk/components 1.6.0 → 1.6.2

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 (560) hide show
  1. package/README.md +18 -1
  2. package/_react-cli.config.js +24 -0
  3. package/assets/Appearance/dark/mode/Component_DarkMode.module.css +330 -321
  4. package/assets/Appearance/dark/mode/Component_v1_DarkMode.module.css +15 -9
  5. package/assets/Appearance/dark/themes/blue/blue_CTA_DarkModifyCategory.module.css +466 -466
  6. package/assets/Appearance/dark/themes/blue/blue_CTA_DarkTheme.module.css +34 -34
  7. package/assets/Appearance/dark/themes/blue/blue_ComponentTheme_DarkTheme.module.css +33 -29
  8. package/assets/Appearance/dark/themes/green/green_CTA_DarkModifyCategory.module.css +466 -466
  9. package/assets/Appearance/dark/themes/green/green_CTA_DarkTheme.module.css +34 -34
  10. package/assets/Appearance/dark/themes/green/green_ComponentTheme_DarkTheme.module.css +33 -29
  11. package/assets/Appearance/dark/themes/orange/orange_CTA_DarkModifyCategory.module.css +466 -466
  12. package/assets/Appearance/dark/themes/orange/orange_CTA_DarkTheme.module.css +34 -34
  13. package/assets/Appearance/dark/themes/orange/orange_ComponentTheme_DarkTheme.module.css +33 -29
  14. package/assets/Appearance/dark/themes/red/red_CTA_DarkModifyCategory.module.css +466 -466
  15. package/assets/Appearance/dark/themes/red/red_CTA_DarkTheme.module.css +34 -34
  16. package/assets/Appearance/dark/themes/red/red_ComponentTheme_DarkTheme.module.css +33 -29
  17. package/assets/Appearance/dark/themes/yellow/yellow_CTA_DarkModifyCategory.module.css +466 -466
  18. package/assets/Appearance/dark/themes/yellow/yellow_CTA_DarkTheme.module.css +34 -34
  19. package/assets/Appearance/dark/themes/yellow/yellow_ComponentTheme_DarkTheme.module.css +33 -29
  20. package/assets/Appearance/light/mode/Component_LightMode.module.css +330 -321
  21. package/assets/Appearance/light/mode/Component_v1_LightMode.module.css +15 -9
  22. package/assets/Appearance/light/themes/blue/blue_CTA_LightModifyCategory.module.css +466 -466
  23. package/assets/Appearance/light/themes/blue/blue_CTA_LightTheme.module.css +34 -34
  24. package/assets/Appearance/light/themes/blue/blue_ComponentTheme_LightTheme.module.css +33 -29
  25. package/assets/Appearance/light/themes/green/green_CTA_LightModifyCategory.module.css +466 -466
  26. package/assets/Appearance/light/themes/green/green_CTA_LightTheme.module.css +34 -34
  27. package/assets/Appearance/light/themes/green/green_ComponentTheme_LightTheme.module.css +33 -29
  28. package/assets/Appearance/light/themes/orange/orange_CTA_LightModifyCategory.module.css +466 -466
  29. package/assets/Appearance/light/themes/orange/orange_CTA_LightTheme.module.css +34 -34
  30. package/assets/Appearance/light/themes/orange/orange_ComponentTheme_LightTheme.module.css +33 -29
  31. package/assets/Appearance/light/themes/red/red_CTA_LightModifyCategory.module.css +466 -466
  32. package/assets/Appearance/light/themes/red/red_CTA_LightTheme.module.css +34 -34
  33. package/assets/Appearance/light/themes/red/red_ComponentTheme_LightTheme.module.css +33 -29
  34. package/assets/Appearance/light/themes/yellow/yellow_CTA_LightModifyCategory.module.css +466 -466
  35. package/assets/Appearance/light/themes/yellow/yellow_CTA_LightTheme.module.css +34 -34
  36. package/assets/Appearance/light/themes/yellow/yellow_ComponentTheme_LightTheme.module.css +33 -29
  37. package/assets/Appearance/pureDark/mode/Component_PureDarkMode.module.css +330 -321
  38. package/assets/Appearance/pureDark/mode/Component_v1_PureDarkMode.module.css +15 -9
  39. package/assets/Appearance/pureDark/themes/blue/blue_CTA_PureDarkModifyCategory.module.css +466 -466
  40. package/assets/Appearance/pureDark/themes/blue/blue_CTA_PureDarkTheme.module.css +34 -34
  41. package/assets/Appearance/pureDark/themes/blue/blue_ComponentTheme_PureDarkTheme.module.css +33 -29
  42. package/assets/Appearance/pureDark/themes/green/green_CTA_PureDarkModifyCategory.module.css +466 -466
  43. package/assets/Appearance/pureDark/themes/green/green_CTA_PureDarkTheme.module.css +34 -34
  44. package/assets/Appearance/pureDark/themes/green/green_ComponentTheme_PureDarkTheme.module.css +33 -29
  45. package/assets/Appearance/pureDark/themes/orange/orange_CTA_PureDarkModifyCategory.module.css +466 -466
  46. package/assets/Appearance/pureDark/themes/orange/orange_CTA_PureDarkTheme.module.css +34 -34
  47. package/assets/Appearance/pureDark/themes/orange/orange_ComponentTheme_PureDarkTheme.module.css +33 -29
  48. package/assets/Appearance/pureDark/themes/red/red_CTA_PureDarkModifyCategory.module.css +466 -466
  49. package/assets/Appearance/pureDark/themes/red/red_CTA_PureDarkTheme.module.css +34 -34
  50. package/assets/Appearance/pureDark/themes/red/red_ComponentTheme_PureDarkTheme.module.css +33 -29
  51. package/assets/Appearance/pureDark/themes/yellow/yellow_CTA_PureDarkModifyCategory.module.css +466 -466
  52. package/assets/Appearance/pureDark/themes/yellow/yellow_CTA_PureDarkTheme.module.css +34 -34
  53. package/assets/Appearance/pureDark/themes/yellow/yellow_ComponentTheme_PureDarkTheme.module.css +33 -29
  54. package/assets/Contrast/darkContrastLightness.module.css +36 -36
  55. package/assets/Contrast/lightContrastLightness.module.css +36 -36
  56. package/assets/Contrast/pureDarkContrastLightness.module.css +36 -36
  57. package/cbt.config.js +41 -0
  58. package/es/AppContainer/AppContainer.js +9 -10
  59. package/es/Avatar/Avatar.js +5 -4
  60. package/es/Avatar/Avatar.module.css +8 -8
  61. package/es/AvatarTeam/AvatarTeam.js +7 -7
  62. package/es/AvatarTeam/AvatarTeam.module.css +30 -30
  63. package/es/Button/Button.js +6 -5
  64. package/es/Button/css/Button.module.css +19 -19
  65. package/es/Buttongroup/Buttongroup.js +0 -0
  66. package/es/Buttongroup/Buttongroup.module.css +5 -3
  67. package/es/Card/Card.js +0 -0
  68. package/es/CheckBox/CheckBox.js +11 -11
  69. package/es/ColorSelect/ColorMultiSelect.js +4 -2
  70. package/es/ColorSelect/ColorSingleSelect.js +4 -2
  71. package/es/ColorSelect/_shared/ColorIndicator/ColorIndicator.js +4 -3
  72. package/es/ColorSelect/_shared/ColorIndicator/ColorIndicator.module.css +2 -2
  73. package/es/ColorSelect/_shared/ColoredTag/ColoredTag.js +4 -2
  74. package/es/ColorSelect/_shared/helpers/renderHelpers.js +6 -4
  75. package/es/DateTime/CalendarView.js +0 -0
  76. package/es/DateTime/DateTime.js +5 -4
  77. package/es/DateTime/DateWidget.js +5 -4
  78. package/es/DateTime/Time.js +11 -12
  79. package/es/DateTime/YearView.js +0 -0
  80. package/es/DateTime/common.js +0 -0
  81. package/es/DateTime/index.js +0 -0
  82. package/es/DateTime/objectUtils.js +0 -0
  83. package/es/DateTime/typeChecker.js +0 -0
  84. package/es/DateTime/validator.js +0 -0
  85. package/es/DropBox/DropBox.js +11 -10
  86. package/es/DropBox/DropBoxElement/css/DropBoxElement.module.css +6 -3
  87. package/es/DropDown/DropDown.js +1 -2
  88. package/es/DropDown/DropDownHeading.js +0 -0
  89. package/es/DropDown/DropDownHeading.module.css +4 -4
  90. package/es/DropDown/DropDownItem.js +0 -0
  91. package/es/DropDown/DropDownItem.module.css +4 -4
  92. package/es/DropDown/DropDownSearch.js +0 -0
  93. package/es/DropDown/DropDownSearch.module.css +3 -3
  94. package/es/DropDown/DropDownSeparator.js +0 -0
  95. package/es/Label/Label.js +7 -7
  96. package/es/Label/Label.module.css +5 -5
  97. package/es/Layout/Box.js +0 -0
  98. package/es/Layout/Container.js +0 -0
  99. package/es/Layout/utils.js +0 -0
  100. package/es/ListItem/ListContainer.js +5 -6
  101. package/es/ListItem/ListItem.js +5 -4
  102. package/es/ListItem/ListItem.module.css +30 -19
  103. package/es/ListItem/ListItemWithAvatar.js +10 -11
  104. package/es/ListItem/ListItemWithCheckBox.js +5 -4
  105. package/es/ListItem/ListItemWithIcon.js +5 -4
  106. package/es/ListItem/ListItemWithRadio.js +5 -4
  107. package/es/Modal/Modal.js +5 -4
  108. package/es/MultiSelect/AdvancedGroupMultiSelect.js +2 -0
  109. package/es/MultiSelect/AdvancedMultiSelect.js +11 -8
  110. package/es/MultiSelect/EmptyState.js +16 -2
  111. package/es/MultiSelect/MultiSelect.js +10 -8
  112. package/es/MultiSelect/MultiSelectWithAvatar.js +7 -4
  113. package/es/MultiSelect/SelectedOptions.js +8 -6
  114. package/es/MultiSelect/Suggestions.js +8 -6
  115. package/es/MultiSelect/props/propTypes.js +3 -0
  116. package/es/Popup/Popup.js +0 -0
  117. package/es/Provider/LibraryContext.js +11 -3
  118. package/es/Radio/Radio.js +11 -11
  119. package/es/Radio/Radio.module.css +9 -8
  120. package/es/Responsive/CustomResponsive.js +0 -0
  121. package/es/ResponsiveDropBox/ResponsiveDropBox.js +4 -2
  122. package/es/Ribbon/Ribbon.js +0 -0
  123. package/es/Ribbon/Ribbon.module.css +25 -20
  124. package/es/Select/GroupSelect.js +13 -12
  125. package/es/Select/Select.js +14 -12
  126. package/es/Select/SelectWithAvatar.js +13 -12
  127. package/es/Select/SelectWithIcon.js +10 -8
  128. package/es/Select/props/propTypes.js +3 -0
  129. package/es/Stencils/Stencils.js +0 -0
  130. package/es/Stencils/Stencils.module.css +11 -11
  131. package/es/Switch/Switch.js +8 -8
  132. package/es/Tab/Tab.js +5 -4
  133. package/es/Tab/TabContentWrapper.js +5 -4
  134. package/es/Tab/TabWrapper.js +4 -2
  135. package/es/Tab/Tabs.js +19 -20
  136. package/es/Tag/Tag.js +11 -12
  137. package/es/Tag/Tag.module.css +18 -17
  138. package/es/TextBox/TextBox.js +5 -5
  139. package/es/TextBox/TextBox.module.css +9 -9
  140. package/es/TextBoxIcon/TextBoxIcon.js +4 -2
  141. package/es/TextBoxIcon/TextBoxIcon.module.css +1 -1
  142. package/es/Textarea/Textarea.js +7 -6
  143. package/es/Textarea/Textarea.module.css +18 -18
  144. package/es/VelocityAnimation/VelocityAnimationGroup/VelocityAnimationGroup.js +5 -4
  145. package/es/common/avatarsizes.module.css +16 -16
  146. package/es/common/common.module.css +2 -2
  147. package/es/deprecated/PortalLayer/PortalLayer.js +6 -8
  148. package/es/deprecated/Switch/Switch.js +8 -8
  149. package/es/shared/ArrowIcon/ArrowIcon.js +6 -6
  150. package/es/shared/InputFieldLine/InputFieldLine.js +6 -6
  151. package/es/shared/InputFieldLine/InputFieldLine.module.css +2 -2
  152. package/es/utils/Common.js +0 -0
  153. package/es/utils/dropDownUtils.js +0 -0
  154. package/es/v1/Label/Label.js +98 -33
  155. package/es/v1/Label/__tests__/Label.spec.js +214 -0
  156. package/es/v1/Label/__tests__/__snapshots__/Label.spec.js.snap +457 -0
  157. package/es/v1/Label/constants/index.js +8 -0
  158. package/es/v1/Label/css/Label_v1.module.css +42 -0
  159. package/es/v1/Label/css/cssJSLogic.js +44 -0
  160. package/es/v1/Label/props/defaultProps.js +14 -9
  161. package/es/v1/Label/props/propTypes.js +34 -14
  162. package/es/v1/Switch/Switch.js +7 -6
  163. package/es/v1/Switch/css/Switch_v1.module.css +28 -28
  164. package/lib/Avatar/Avatar.module.css +8 -8
  165. package/lib/AvatarTeam/AvatarTeam.js +0 -0
  166. package/lib/AvatarTeam/AvatarTeam.module.css +30 -30
  167. package/lib/Button/Button.js +0 -0
  168. package/lib/Button/css/Button.module.css +19 -19
  169. package/lib/Buttongroup/Buttongroup.js +0 -0
  170. package/lib/Buttongroup/Buttongroup.module.css +5 -3
  171. package/lib/Card/Card.js +0 -0
  172. package/lib/CheckBox/CheckBox.js +0 -0
  173. package/lib/ColorSelect/_shared/ColorIndicator/ColorIndicator.module.css +2 -2
  174. package/lib/DateTime/CalendarView.js +0 -0
  175. package/lib/DateTime/DateTime.js +0 -0
  176. package/lib/DateTime/DateWidget.js +0 -0
  177. package/lib/DateTime/YearView.js +0 -0
  178. package/lib/DateTime/common.js +0 -0
  179. package/lib/DateTime/index.js +0 -0
  180. package/lib/DateTime/objectUtils.js +0 -0
  181. package/lib/DateTime/typeChecker.js +0 -0
  182. package/lib/DateTime/validator.js +0 -0
  183. package/lib/DropBox/DropBox.js +0 -0
  184. package/lib/DropBox/DropBoxElement/css/DropBoxElement.module.css +6 -3
  185. package/lib/DropDown/DropDown.js +0 -0
  186. package/lib/DropDown/DropDownHeading.js +0 -0
  187. package/lib/DropDown/DropDownHeading.module.css +4 -4
  188. package/lib/DropDown/DropDownItem.js +0 -0
  189. package/lib/DropDown/DropDownItem.module.css +4 -4
  190. package/lib/DropDown/DropDownSearch.js +0 -0
  191. package/lib/DropDown/DropDownSearch.module.css +3 -3
  192. package/lib/DropDown/DropDownSeparator.js +0 -0
  193. package/lib/Label/Label.js +0 -0
  194. package/lib/Label/Label.module.css +5 -5
  195. package/lib/Layout/Box.js +0 -0
  196. package/lib/Layout/Container.js +0 -0
  197. package/lib/Layout/utils.js +0 -0
  198. package/lib/ListItem/ListItem.js +0 -0
  199. package/lib/ListItem/ListItem.module.css +30 -19
  200. package/lib/MultiSelect/AdvancedGroupMultiSelect.js +2 -0
  201. package/lib/MultiSelect/AdvancedMultiSelect.js +2 -0
  202. package/lib/MultiSelect/EmptyState.js +17 -2
  203. package/lib/MultiSelect/MultiSelect.js +2 -0
  204. package/lib/MultiSelect/MultiSelectWithAvatar.js +2 -0
  205. package/lib/MultiSelect/props/propTypes.js +3 -0
  206. package/lib/Popup/Popup.js +0 -0
  207. package/lib/Provider/LibraryContext.js +11 -3
  208. package/lib/Radio/Radio.js +0 -0
  209. package/lib/Radio/Radio.module.css +9 -8
  210. package/lib/Responsive/CustomResponsive.js +0 -0
  211. package/lib/Ribbon/Ribbon.js +0 -0
  212. package/lib/Ribbon/Ribbon.module.css +25 -20
  213. package/lib/Select/GroupSelect.js +2 -0
  214. package/lib/Select/Select.js +2 -0
  215. package/lib/Select/SelectWithAvatar.js +2 -0
  216. package/lib/Select/SelectWithIcon.js +2 -0
  217. package/lib/Select/props/propTypes.js +3 -0
  218. package/lib/Stencils/Stencils.js +0 -0
  219. package/lib/Stencils/Stencils.module.css +11 -11
  220. package/lib/Switch/Switch.js +0 -0
  221. package/lib/Tag/Tag.js +0 -0
  222. package/lib/Tag/Tag.module.css +18 -17
  223. package/lib/TextBox/TextBox.js +0 -0
  224. package/lib/TextBox/TextBox.module.css +9 -9
  225. package/lib/TextBoxIcon/TextBoxIcon.js +0 -0
  226. package/lib/TextBoxIcon/TextBoxIcon.module.css +1 -1
  227. package/lib/Textarea/Textarea.js +0 -0
  228. package/lib/Textarea/Textarea.module.css +18 -18
  229. package/lib/common/avatarsizes.module.css +16 -16
  230. package/lib/common/common.module.css +2 -2
  231. package/lib/deprecated/Switch/Switch.js +0 -0
  232. package/lib/shared/InputFieldLine/InputFieldLine.module.css +2 -2
  233. package/lib/utils/Common.js +0 -0
  234. package/lib/utils/dropDownUtils.js +0 -0
  235. package/lib/v1/Label/Label.js +104 -36
  236. package/lib/v1/Label/__tests__/Label.spec.js +221 -0
  237. package/lib/v1/Label/__tests__/__snapshots__/Label.spec.js.snap +457 -0
  238. package/lib/v1/Label/constants/index.js +16 -0
  239. package/lib/v1/Label/css/Label_v1.module.css +42 -0
  240. package/lib/v1/Label/css/cssJSLogic.js +38 -0
  241. package/lib/v1/Label/props/defaultProps.js +16 -11
  242. package/lib/v1/Label/props/propTypes.js +36 -16
  243. package/lib/v1/Switch/css/Switch_v1.module.css +28 -28
  244. package/package.json +15 -20
  245. package/es/v1/Accordion/Accordion.js +0 -66
  246. package/es/v1/Accordion/AccordionItem.js +0 -57
  247. package/es/v1/Accordion/index.js +0 -2
  248. package/es/v1/Accordion/props/defaultProps.js +0 -12
  249. package/es/v1/Accordion/props/propTypes.js +0 -33
  250. package/es/v1/Animation/Animation.js +0 -45
  251. package/es/v1/Animation/props/defaultProps.js +0 -7
  252. package/es/v1/Animation/props/propTypes.js +0 -12
  253. package/es/v1/Animation/utils.js +0 -83
  254. package/es/v1/AppContainer/AppContainer.js +0 -115
  255. package/es/v1/AppContainer/props/defaultProps.js +0 -10
  256. package/es/v1/AppContainer/props/propTypes.js +0 -17
  257. package/es/v1/Avatar/Avatar.js +0 -139
  258. package/es/v1/Avatar/props/defaultProps.js +0 -17
  259. package/es/v1/Avatar/props/propTypes.js +0 -26
  260. package/es/v1/AvatarTeam/AvatarTeam.js +0 -70
  261. package/es/v1/AvatarTeam/props/defaultProps.js +0 -17
  262. package/es/v1/AvatarTeam/props/propTypes.js +0 -27
  263. package/es/v1/Button/Button.js +0 -67
  264. package/es/v1/Button/props/defaultProps.js +0 -18
  265. package/es/v1/Button/props/propTypes.js +0 -28
  266. package/es/v1/Buttongroup/Buttongroup.js +0 -31
  267. package/es/v1/Buttongroup/props/defaultProps.js +0 -6
  268. package/es/v1/Buttongroup/props/propTypes.js +0 -9
  269. package/es/v1/Card/Card.js +0 -237
  270. package/es/v1/Card/index.js +0 -4
  271. package/es/v1/Card/props/defaultProps.js +0 -25
  272. package/es/v1/Card/props/propTypes.js +0 -48
  273. package/es/v1/CheckBox/CheckBox.js +0 -161
  274. package/es/v1/CheckBox/props/defaultProps.js +0 -18
  275. package/es/v1/CheckBox/props/propTypes.js +0 -41
  276. package/es/v1/DateTime/CalendarView.js +0 -254
  277. package/es/v1/DateTime/DateTime.js +0 -779
  278. package/es/v1/DateTime/DateTimePopupFooter.js +0 -47
  279. package/es/v1/DateTime/DateTimePopupHeader.js +0 -105
  280. package/es/v1/DateTime/DateWidget.js +0 -1134
  281. package/es/v1/DateTime/DaysRow.js +0 -32
  282. package/es/v1/DateTime/Time.js +0 -181
  283. package/es/v1/DateTime/YearView.js +0 -264
  284. package/es/v1/DateTime/index.js +0 -1
  285. package/es/v1/DateTime/props/defaultProps.js +0 -63
  286. package/es/v1/DateTime/props/propTypes.js +0 -206
  287. package/es/v1/DropBox/DropBox.js +0 -79
  288. package/es/v1/DropBox/DropBoxElement/DropBoxElement.js +0 -133
  289. package/es/v1/DropBox/DropBoxElement/props/defaultProps.js +0 -18
  290. package/es/v1/DropBox/DropBoxElement/props/propTypes.js +0 -51
  291. package/es/v1/DropBox/props/defaultProps.js +0 -14
  292. package/es/v1/DropBox/props/propTypes.js +0 -16
  293. package/es/v1/DropBox/utils/isMobilePopover.js +0 -17
  294. package/es/v1/DropDown/DropDown.js +0 -53
  295. package/es/v1/DropDown/DropDownHeading.js +0 -36
  296. package/es/v1/DropDown/DropDownItem.js +0 -56
  297. package/es/v1/DropDown/DropDownSearch.js +0 -58
  298. package/es/v1/DropDown/DropDownSeparator.js +0 -12
  299. package/es/v1/DropDown/props/defaultProps.js +0 -21
  300. package/es/v1/DropDown/props/propTypes.js +0 -66
  301. package/es/v1/Heading/Heading.js +0 -35
  302. package/es/v1/Heading/props/defaultProps.js +0 -5
  303. package/es/v1/Heading/props/propTypes.js +0 -12
  304. package/es/v1/Layout/Box.js +0 -115
  305. package/es/v1/Layout/Container.js +0 -132
  306. package/es/v1/Layout/index.js +0 -2
  307. package/es/v1/Layout/props/defaultProps.js +0 -16
  308. package/es/v1/Layout/props/propTypes.js +0 -46
  309. package/es/v1/ListItem/ListContainer.js +0 -104
  310. package/es/v1/ListItem/ListItem.js +0 -123
  311. package/es/v1/ListItem/ListItemWithAvatar.js +0 -143
  312. package/es/v1/ListItem/ListItemWithCheckBox.js +0 -104
  313. package/es/v1/ListItem/ListItemWithIcon.js +0 -126
  314. package/es/v1/ListItem/ListItemWithRadio.js +0 -105
  315. package/es/v1/ListItem/index.js +0 -6
  316. package/es/v1/ListItem/props/defaultProps.js +0 -97
  317. package/es/v1/ListItem/props/propTypes.js +0 -202
  318. package/es/v1/Modal/Modal.js +0 -125
  319. package/es/v1/Modal/props/defaultProps.js +0 -3
  320. package/es/v1/Modal/props/propTypes.js +0 -7
  321. package/es/v1/MultiSelect/AdvancedGroupMultiSelect.js +0 -1092
  322. package/es/v1/MultiSelect/AdvancedMultiSelect.js +0 -583
  323. package/es/v1/MultiSelect/EmptyState.js +0 -64
  324. package/es/v1/MultiSelect/MobileHeader/MobileHeader.js +0 -50
  325. package/es/v1/MultiSelect/MobileHeader/props/defaultProps.js +0 -7
  326. package/es/v1/MultiSelect/MobileHeader/props/propTypes.js +0 -7
  327. package/es/v1/MultiSelect/MultiSelect.js +0 -1119
  328. package/es/v1/MultiSelect/MultiSelectHeader.js +0 -32
  329. package/es/v1/MultiSelect/MultiSelectWithAvatar.js +0 -208
  330. package/es/v1/MultiSelect/SelectedOptions.js +0 -84
  331. package/es/v1/MultiSelect/Suggestions.js +0 -141
  332. package/es/v1/MultiSelect/index.js +0 -4
  333. package/es/v1/MultiSelect/props/defaultProps.js +0 -165
  334. package/es/v1/MultiSelect/props/propTypes.js +0 -322
  335. package/es/v1/PopOver/PopOver.js +0 -176
  336. package/es/v1/PopOver/props/defaultProps.js +0 -7
  337. package/es/v1/PopOver/props/propTypes.js +0 -53
  338. package/es/v1/Popup/Popup.js +0 -644
  339. package/es/v1/Radio/Radio.js +0 -130
  340. package/es/v1/Radio/props/defaultProps.js +0 -15
  341. package/es/v1/Radio/props/propTypes.js +0 -40
  342. package/es/v1/ResponsiveDropBox/ResponsiveDropBox.js +0 -56
  343. package/es/v1/ResponsiveDropBox/props/defaultProps.js +0 -4
  344. package/es/v1/ResponsiveDropBox/props/propTypes.js +0 -8
  345. package/es/v1/Ribbon/Ribbon.js +0 -33
  346. package/es/v1/Ribbon/props/defaultProps.js +0 -9
  347. package/es/v1/Ribbon/props/propTypes.js +0 -11
  348. package/es/v1/RippleEffect/RippleEffect.js +0 -25
  349. package/es/v1/RippleEffect/props/defaultProps.js +0 -10
  350. package/es/v1/RippleEffect/props/propTypes.js +0 -12
  351. package/es/v1/Select/GroupSelect.js +0 -818
  352. package/es/v1/Select/Select.js +0 -975
  353. package/es/v1/Select/SelectWithAvatar.js +0 -356
  354. package/es/v1/Select/SelectWithIcon.js +0 -545
  355. package/es/v1/Select/index.js +0 -4
  356. package/es/v1/Select/props/defaultProps.js +0 -126
  357. package/es/v1/Select/props/propTypes.js +0 -297
  358. package/es/v1/Stencils/Stencils.js +0 -26
  359. package/es/v1/Stencils/props/defaultProps.js +0 -6
  360. package/es/v1/Stencils/props/propTypes.js +0 -7
  361. package/es/v1/Tab/Tab.js +0 -106
  362. package/es/v1/Tab/TabContent.js +0 -30
  363. package/es/v1/Tab/TabContentWrapper.js +0 -33
  364. package/es/v1/Tab/TabWrapper.js +0 -55
  365. package/es/v1/Tab/Tabs.js +0 -619
  366. package/es/v1/Tab/index.js +0 -5
  367. package/es/v1/Tab/props/defaultProps.js +0 -51
  368. package/es/v1/Tab/props/propTypes.js +0 -117
  369. package/es/v1/Tab/v1Tab.module.css +0 -100
  370. package/es/v1/Tab/v1TabContent.module.css +0 -4
  371. package/es/v1/Tab/v1Tabs.module.css +0 -167
  372. package/es/v1/Tag/Tag.js +0 -140
  373. package/es/v1/Tag/props/defaultProps.js +0 -15
  374. package/es/v1/Tag/props/propTypes.js +0 -36
  375. package/es/v1/TextBox/TextBox.js +0 -160
  376. package/es/v1/TextBox/props/defaultProps.js +0 -20
  377. package/es/v1/TextBox/props/propTypes.js +0 -56
  378. package/es/v1/TextBoxIcon/TextBoxIcon.js +0 -166
  379. package/es/v1/TextBoxIcon/props/defaultProps.js +0 -24
  380. package/es/v1/TextBoxIcon/props/propTypes.js +0 -53
  381. package/es/v1/Textarea/Textarea.js +0 -100
  382. package/es/v1/Textarea/props/defaultProps.js +0 -17
  383. package/es/v1/Textarea/props/propTypes.js +0 -31
  384. package/es/v1/Tooltip/Tooltip.js +0 -530
  385. package/es/v1/Tooltip/props/defaultProps.js +0 -4
  386. package/es/v1/Tooltip/props/propTypes.js +0 -5
  387. package/es/v1/Typography/Typography.js +0 -38
  388. package/es/v1/Typography/css/cssJSLogic.js +0 -56
  389. package/es/v1/Typography/css/v1_Typography.module.css +0 -380
  390. package/es/v1/Typography/props/defaultProps.js +0 -8
  391. package/es/v1/Typography/props/propTypes.js +0 -27
  392. package/es/v1/Typography/utils/index.js +0 -50
  393. package/es/v1/VelocityAnimation/VelocityAnimation/VelocityAnimation.js +0 -69
  394. package/es/v1/VelocityAnimation/VelocityAnimation/props/defaultProps.js +0 -7
  395. package/es/v1/VelocityAnimation/VelocityAnimation/props/propTypes.js +0 -12
  396. package/es/v1/VelocityAnimation/VelocityAnimationGroup/VelocityAnimationGroup.js +0 -99
  397. package/es/v1/VelocityAnimation/VelocityAnimationGroup/props/defaultProps.js +0 -15
  398. package/es/v1/VelocityAnimation/VelocityAnimationGroup/props/propTypes.js +0 -19
  399. package/es/v1/semantic/Button/Button.js +0 -53
  400. package/es/v1/semantic/Button/props/defaultProps.js +0 -12
  401. package/es/v1/semantic/Button/props/propTypes.js +0 -22
  402. package/es/v1/semantic/index.js +0 -1
  403. package/lib/v1/Accordion/Accordion.js +0 -98
  404. package/lib/v1/Accordion/AccordionItem.js +0 -68
  405. package/lib/v1/Accordion/index.js +0 -23
  406. package/lib/v1/Accordion/props/defaultProps.js +0 -20
  407. package/lib/v1/Accordion/props/propTypes.js +0 -45
  408. package/lib/v1/Animation/Animation.js +0 -61
  409. package/lib/v1/Animation/props/defaultProps.js +0 -14
  410. package/lib/v1/Animation/props/propTypes.js +0 -23
  411. package/lib/v1/Animation/utils.js +0 -94
  412. package/lib/v1/AppContainer/AppContainer.js +0 -146
  413. package/lib/v1/AppContainer/props/defaultProps.js +0 -17
  414. package/lib/v1/AppContainer/props/propTypes.js +0 -28
  415. package/lib/v1/Avatar/Avatar.js +0 -191
  416. package/lib/v1/Avatar/props/defaultProps.js +0 -24
  417. package/lib/v1/Avatar/props/propTypes.js +0 -37
  418. package/lib/v1/AvatarTeam/AvatarTeam.js +0 -81
  419. package/lib/v1/AvatarTeam/props/defaultProps.js +0 -24
  420. package/lib/v1/AvatarTeam/props/propTypes.js +0 -38
  421. package/lib/v1/Button/Button.js +0 -82
  422. package/lib/v1/Button/props/defaultProps.js +0 -27
  423. package/lib/v1/Button/props/propTypes.js +0 -40
  424. package/lib/v1/Buttongroup/Buttongroup.js +0 -44
  425. package/lib/v1/Buttongroup/props/defaultProps.js +0 -13
  426. package/lib/v1/Buttongroup/props/propTypes.js +0 -20
  427. package/lib/v1/Card/Card.js +0 -269
  428. package/lib/v1/Card/index.js +0 -37
  429. package/lib/v1/Card/props/defaultProps.js +0 -35
  430. package/lib/v1/Card/props/propTypes.js +0 -62
  431. package/lib/v1/CheckBox/CheckBox.js +0 -172
  432. package/lib/v1/CheckBox/props/defaultProps.js +0 -25
  433. package/lib/v1/CheckBox/props/propTypes.js +0 -52
  434. package/lib/v1/DateTime/CalendarView.js +0 -322
  435. package/lib/v1/DateTime/DateTime.js +0 -877
  436. package/lib/v1/DateTime/DateTimePopupFooter.js +0 -96
  437. package/lib/v1/DateTime/DateTimePopupHeader.js +0 -166
  438. package/lib/v1/DateTime/DateWidget.js +0 -1163
  439. package/lib/v1/DateTime/DaysRow.js +0 -81
  440. package/lib/v1/DateTime/Time.js +0 -270
  441. package/lib/v1/DateTime/YearView.js +0 -325
  442. package/lib/v1/DateTime/index.js +0 -15
  443. package/lib/v1/DateTime/props/defaultProps.js +0 -76
  444. package/lib/v1/DateTime/props/propTypes.js +0 -238
  445. package/lib/v1/DropBox/DropBox.js +0 -109
  446. package/lib/v1/DropBox/DropBoxElement/DropBoxElement.js +0 -146
  447. package/lib/v1/DropBox/DropBoxElement/props/defaultProps.js +0 -25
  448. package/lib/v1/DropBox/DropBoxElement/props/propTypes.js +0 -62
  449. package/lib/v1/DropBox/props/defaultProps.js +0 -30
  450. package/lib/v1/DropBox/props/propTypes.js +0 -35
  451. package/lib/v1/DropBox/utils/isMobilePopover.js +0 -25
  452. package/lib/v1/DropDown/DropDown.js +0 -74
  453. package/lib/v1/DropDown/DropDownHeading.js +0 -47
  454. package/lib/v1/DropDown/DropDownItem.js +0 -75
  455. package/lib/v1/DropDown/DropDownSearch.js +0 -77
  456. package/lib/v1/DropDown/DropDownSeparator.js +0 -24
  457. package/lib/v1/DropDown/props/defaultProps.js +0 -31
  458. package/lib/v1/DropDown/props/propTypes.js +0 -87
  459. package/lib/v1/Heading/Heading.js +0 -53
  460. package/lib/v1/Heading/props/defaultProps.js +0 -12
  461. package/lib/v1/Heading/props/propTypes.js +0 -23
  462. package/lib/v1/Layout/Box.js +0 -128
  463. package/lib/v1/Layout/Container.js +0 -145
  464. package/lib/v1/Layout/index.js +0 -23
  465. package/lib/v1/Layout/props/defaultProps.js +0 -24
  466. package/lib/v1/Layout/props/propTypes.js +0 -58
  467. package/lib/v1/ListItem/ListContainer.js +0 -128
  468. package/lib/v1/ListItem/ListItem.js +0 -138
  469. package/lib/v1/ListItem/ListItemWithAvatar.js +0 -167
  470. package/lib/v1/ListItem/ListItemWithCheckBox.js +0 -126
  471. package/lib/v1/ListItem/ListItemWithIcon.js +0 -143
  472. package/lib/v1/ListItem/ListItemWithRadio.js +0 -127
  473. package/lib/v1/ListItem/index.js +0 -55
  474. package/lib/v1/ListItem/props/defaultProps.js +0 -109
  475. package/lib/v1/ListItem/props/propTypes.js +0 -196
  476. package/lib/v1/Modal/Modal.js +0 -166
  477. package/lib/v1/Modal/props/defaultProps.js +0 -10
  478. package/lib/v1/Modal/props/propTypes.js +0 -18
  479. package/lib/v1/MultiSelect/AdvancedGroupMultiSelect.js +0 -1180
  480. package/lib/v1/MultiSelect/AdvancedMultiSelect.js +0 -649
  481. package/lib/v1/MultiSelect/EmptyState.js +0 -112
  482. package/lib/v1/MultiSelect/MobileHeader/MobileHeader.js +0 -62
  483. package/lib/v1/MultiSelect/MobileHeader/props/defaultProps.js +0 -14
  484. package/lib/v1/MultiSelect/MobileHeader/props/propTypes.js +0 -18
  485. package/lib/v1/MultiSelect/MultiSelect.js +0 -1202
  486. package/lib/v1/MultiSelect/MultiSelectHeader.js +0 -78
  487. package/lib/v1/MultiSelect/MultiSelectWithAvatar.js +0 -262
  488. package/lib/v1/MultiSelect/SelectedOptions.js +0 -130
  489. package/lib/v1/MultiSelect/Suggestions.js +0 -196
  490. package/lib/v1/MultiSelect/index.js +0 -39
  491. package/lib/v1/MultiSelect/props/defaultProps.js +0 -181
  492. package/lib/v1/MultiSelect/props/propTypes.js +0 -350
  493. package/lib/v1/PopOver/PopOver.js +0 -197
  494. package/lib/v1/PopOver/props/defaultProps.js +0 -15
  495. package/lib/v1/PopOver/props/propTypes.js +0 -66
  496. package/lib/v1/Popup/Popup.js +0 -715
  497. package/lib/v1/Radio/Radio.js +0 -141
  498. package/lib/v1/Radio/props/defaultProps.js +0 -22
  499. package/lib/v1/Radio/props/propTypes.js +0 -51
  500. package/lib/v1/ResponsiveDropBox/ResponsiveDropBox.js +0 -79
  501. package/lib/v1/ResponsiveDropBox/props/defaultProps.js +0 -11
  502. package/lib/v1/ResponsiveDropBox/props/propTypes.js +0 -27
  503. package/lib/v1/Ribbon/Ribbon.js +0 -44
  504. package/lib/v1/Ribbon/props/defaultProps.js +0 -16
  505. package/lib/v1/Ribbon/props/propTypes.js +0 -22
  506. package/lib/v1/RippleEffect/RippleEffect.js +0 -40
  507. package/lib/v1/RippleEffect/props/defaultProps.js +0 -17
  508. package/lib/v1/RippleEffect/props/propTypes.js +0 -23
  509. package/lib/v1/Select/GroupSelect.js +0 -894
  510. package/lib/v1/Select/Select.js +0 -1025
  511. package/lib/v1/Select/SelectWithAvatar.js +0 -406
  512. package/lib/v1/Select/SelectWithIcon.js +0 -607
  513. package/lib/v1/Select/index.js +0 -39
  514. package/lib/v1/Select/props/defaultProps.js +0 -125
  515. package/lib/v1/Select/props/propTypes.js +0 -319
  516. package/lib/v1/Stencils/Stencils.js +0 -43
  517. package/lib/v1/Stencils/props/defaultProps.js +0 -13
  518. package/lib/v1/Stencils/props/propTypes.js +0 -18
  519. package/lib/v1/Tab/Tab.js +0 -132
  520. package/lib/v1/Tab/TabContent.js +0 -42
  521. package/lib/v1/Tab/TabContentWrapper.js +0 -47
  522. package/lib/v1/Tab/TabWrapper.js +0 -89
  523. package/lib/v1/Tab/Tabs.js +0 -688
  524. package/lib/v1/Tab/index.js +0 -47
  525. package/lib/v1/Tab/props/defaultProps.js +0 -62
  526. package/lib/v1/Tab/props/propTypes.js +0 -132
  527. package/lib/v1/Tab/v1Tab.module.css +0 -100
  528. package/lib/v1/Tab/v1TabContent.module.css +0 -4
  529. package/lib/v1/Tab/v1Tabs.module.css +0 -167
  530. package/lib/v1/Tag/Tag.js +0 -160
  531. package/lib/v1/Tag/props/defaultProps.js +0 -22
  532. package/lib/v1/Tag/props/propTypes.js +0 -47
  533. package/lib/v1/TextBox/TextBox.js +0 -175
  534. package/lib/v1/TextBox/props/defaultProps.js +0 -27
  535. package/lib/v1/TextBox/props/propTypes.js +0 -62
  536. package/lib/v1/TextBoxIcon/TextBoxIcon.js +0 -206
  537. package/lib/v1/TextBoxIcon/props/defaultProps.js +0 -31
  538. package/lib/v1/TextBoxIcon/props/propTypes.js +0 -72
  539. package/lib/v1/Textarea/Textarea.js +0 -118
  540. package/lib/v1/Textarea/props/defaultProps.js +0 -24
  541. package/lib/v1/Textarea/props/propTypes.js +0 -42
  542. package/lib/v1/Tooltip/Tooltip.js +0 -599
  543. package/lib/v1/Tooltip/props/defaultProps.js +0 -11
  544. package/lib/v1/Tooltip/props/propTypes.js +0 -16
  545. package/lib/v1/Typography/Typography.js +0 -56
  546. package/lib/v1/Typography/css/cssJSLogic.js +0 -48
  547. package/lib/v1/Typography/css/v1_Typography.module.css +0 -380
  548. package/lib/v1/Typography/props/defaultProps.js +0 -15
  549. package/lib/v1/Typography/props/propTypes.js +0 -38
  550. package/lib/v1/Typography/utils/index.js +0 -59
  551. package/lib/v1/VelocityAnimation/VelocityAnimation/VelocityAnimation.js +0 -90
  552. package/lib/v1/VelocityAnimation/VelocityAnimation/props/defaultProps.js +0 -14
  553. package/lib/v1/VelocityAnimation/VelocityAnimation/props/propTypes.js +0 -23
  554. package/lib/v1/VelocityAnimation/VelocityAnimationGroup/VelocityAnimationGroup.js +0 -126
  555. package/lib/v1/VelocityAnimation/VelocityAnimationGroup/props/defaultProps.js +0 -22
  556. package/lib/v1/VelocityAnimation/VelocityAnimationGroup/props/propTypes.js +0 -30
  557. package/lib/v1/semantic/Button/Button.js +0 -63
  558. package/lib/v1/semantic/Button/props/defaultProps.js +0 -19
  559. package/lib/v1/semantic/Button/props/propTypes.js +0 -33
  560. package/lib/v1/semantic/index.js +0 -15
@@ -1,1119 +0,0 @@
1
- /**** Libraries ****/
2
- import React from 'react';
3
- import { MultiSelect_propTypes } from "./props/propTypes";
4
- import { MultiSelect_defaultProps } from "./props/defaultProps";
5
- import { defaultProps as MobileHeader_defaultProps } from "./MobileHeader/props/defaultProps";
6
- /**** Components ****/
7
-
8
- import Popup from "../Popup/Popup";
9
- import TextBoxIcon from "../TextBoxIcon/TextBoxIcon";
10
- import { Container, Box } from "../Layout";
11
- import Card, { CardContent, CardHeader, CardFooter } from "../Card/Card";
12
- import SelectedOptions from "./SelectedOptions";
13
- import Suggestions from "./Suggestions";
14
- import EmptyState from "./EmptyState";
15
- import MobileHeader from "./MobileHeader/MobileHeader";
16
- import MultiSelectHeader from "./MultiSelectHeader";
17
- import CssProvider from "../../Provider/CssProvider";
18
- import { getUniqueId } from "../../Provider/IdProvider";
19
- import ResponsiveDropBox from "../ResponsiveDropBox/ResponsiveDropBox";
20
- import Loader from '@zohodesk/svg/lib/Loader/Loader';
21
- import isMobilePopover from "../DropBox/utils/isMobilePopover";
22
- /**** Icons ****/
23
-
24
- import { Icon } from '@zohodesk/icons';
25
- /**** CSS ****/
26
-
27
- import style from "../../MultiSelect/MultiSelect.module.css";
28
- /**** Methods ****/
29
-
30
- import { debounce, scrollTo, bind, getIsEmptyValue, getSearchString, findScrollEnd } from "../../utils/Common.js";
31
- import { makeFormatOptions, makeGetMultiSelectFilterSuggestions as makeGetFilterSuggestions, makeGetMultiSelectSelectedOptions as makeGetSelectedOptions, makeObjectConcat, filterSelectedOptions, makeGetIsShowClearIcon } from "../../utils/dropDownUtils"; // import { getLibraryConfig } from '../../Provider/Config';
32
-
33
- /* eslint-disable react/forbid-component-props */
34
-
35
- /* eslint-disable react/no-unused-prop-types */
36
-
37
- const dummyArray = [];
38
- export class MultiSelectComponent extends React.Component {
39
- constructor(props) {
40
- super(props);
41
- this.getNextAriaId = getUniqueId(this);
42
- this.getFilterSuggestions = makeGetFilterSuggestions();
43
- this.formatOptions = makeFormatOptions();
44
- this.getSelectedOptions = makeGetSelectedOptions();
45
- this.getIsShowClearIcon = makeGetIsShowClearIcon(); //Use in AdvancedMultiSelect component
46
-
47
- this.objectConcat = makeObjectConcat();
48
- this.formatSelectedOptions = makeFormatOptions();
49
- const {
50
- selectedOptions,
51
- searchDebounceTime = 500
52
- } = this.props;
53
- const {
54
- allOptions,
55
- normalizedAllOptions,
56
- normalizedFormatOptions
57
- } = this.handleFormatOptions(this.props);
58
- const {
59
- formatSelectedOptions,
60
- normalizedSelectedOptions,
61
- selectedOptionIds
62
- } = this.handleGetSelectedOptions(selectedOptions, normalizedFormatOptions, this.props);
63
- this.state = {
64
- options: allOptions,
65
- optionsNormalize: normalizedAllOptions,
66
- selectedOptions: formatSelectedOptions,
67
- selectedOptionIds,
68
- searchStr: '',
69
- hoverOption: 0,
70
- isFetchingOptions: false,
71
- highLightedSelectOptions: [],
72
- lastHighLightedSelectOption: '',
73
- shiftKeyPressHighLighted: 0,
74
- isActive: false
75
- };
76
- this.allSelectedOptionsDetails = normalizedSelectedOptions;
77
- this.suggestionsOrder = [];
78
- this._isMounted = false;
79
- bind.apply(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', 'getSelectionUI', 'moveFocusToTextbox']);
80
- this.handleSearchOptions = debounce(this.handleSearchOptions.bind(this), searchDebounceTime);
81
- this.handleScroll = this.handleScroll.bind(this);
82
- this.handleScrollFuncCall = debounce(this.handleScrollFuncCall.bind(this), 500);
83
- }
84
-
85
- componentDidMount() {
86
- // let { suggestionContainer } = this;
87
- this._isMounted = true;
88
- this.handleExposedPublicMethods(); // suggestionContainer &&
89
- // suggestionContainer.addEventListener('scroll', this.handleScroll);
90
- }
91
-
92
- UNSAFE_componentWillReceiveProps(nextProps) {
93
- const {
94
- selectedOptions,
95
- options,
96
- valueField,
97
- textField,
98
- prefixText
99
- } = nextProps;
100
- const oldProps = this.props;
101
-
102
- if (selectedOptions !== oldProps.selectedOptions || options !== oldProps.options || valueField !== oldProps.valueField || textField !== oldProps.textField || prefixText !== oldProps.prefixText //For GroupMultiSelect component
103
- ) {
104
- const {
105
- allOptions,
106
- normalizedAllOptions,
107
- normalizedFormatOptions
108
- } = this.handleFormatOptions(nextProps);
109
- const {
110
- allSelectedOptionsDetails: oldAllSelectedOptionsDetails
111
- } = this;
112
- const optionsDetails = Object.assign({}, oldAllSelectedOptionsDetails, normalizedFormatOptions);
113
- const {
114
- formatSelectedOptions,
115
- normalizedSelectedOptions,
116
- selectedOptionIds
117
- } = this.handleGetSelectedOptions(selectedOptions, optionsDetails, nextProps);
118
- this.allSelectedOptionsDetails = Object.assign(oldAllSelectedOptionsDetails, normalizedSelectedOptions);
119
- this.setState({
120
- options: allOptions,
121
- optionsNormalize: normalizedAllOptions,
122
- selectedOptions: formatSelectedOptions,
123
- selectedOptionIds
124
- }, () => {
125
- const {
126
- hoverOption
127
- } = this.state;
128
- const suggestions = this.handleFilterSuggestions();
129
- const suggestionsLen = suggestions.length;
130
- const {
131
- id
132
- } = suggestions[hoverOption] || {};
133
- const newHoverOption = !getIsEmptyValue(id) ? hoverOption : suggestionsLen ? suggestionsLen - 1 : 0;
134
- this.setState({
135
- hoverOption: newHoverOption
136
- });
137
- });
138
- }
139
- }
140
-
141
- componentDidUpdate(prevProps, prevState) {
142
- const {
143
- suggestionContainer,
144
- selectedOptionContainer,
145
- suggestionsOrder
146
- } = this;
147
- const {
148
- hoverOption,
149
- highLightedSelectOptions,
150
- selectedOptions,
151
- searchStr
152
- } = this.state;
153
- const {
154
- needLocalSearch,
155
- isPopupOpen,
156
- onDropBoxClose,
157
- onDropBoxOpen,
158
- isSearchClearOnClose
159
- } = this.props; //handle dropbox open & close
160
-
161
- if (prevProps.isPopupOpen !== isPopupOpen) {
162
- isPopupOpen && onDropBoxOpen && this.handleFetchOptions(onDropBoxOpen, searchStr);
163
-
164
- if (!isPopupOpen) {
165
- this.setState({
166
- hoverOption: 0
167
- });
168
- isSearchClearOnClose && searchStr && this.handleSearch('');
169
- onDropBoxClose && onDropBoxClose();
170
- }
171
- } //scrollTo handling
172
-
173
-
174
- const hoverId = suggestionsOrder[hoverOption] || '';
175
- const selectedSuggestion = this[`suggestion_${hoverId}`];
176
- const lastHighLightedSelectOption = highLightedSelectOptions.slice(-1).length ? highLightedSelectOptions.slice(-1)[0] : null;
177
- const selectedOption = this[`selectedOption_${lastHighLightedSelectOption}`];
178
- isPopupOpen && scrollTo(suggestionContainer, selectedSuggestion);
179
- selectedOptions.length && selectedOption && scrollTo(selectedOptionContainer, selectedOption); //When suggestions length less than 5, getNextOptions function call
180
-
181
- const {
182
- isNextOptions,
183
- getNextOptions
184
- } = this.props; // let { searchStr } = this.state;
185
-
186
- const suggestions = this.handleFilterSuggestions();
187
- const suggestionsLen = suggestions.length;
188
-
189
- if (isPopupOpen && suggestionsLen <= 5 && isNextOptions && getNextOptions && !needLocalSearch) {
190
- this.handleFetchOptions(getNextOptions, searchStr);
191
- } //Need To MultiselectNew Component
192
-
193
-
194
- this.handleComponentDidUpdate(prevProps, prevState); // if (isPopupOpen && isNextOptions && prevProps.selectedOptions.length !== selectedOptions.length) {
195
- // let { scrollHeight, clientHeight } = this.suggestionContainer || {};
196
- // let isElementScrollable = scrollHeight > clientHeight;
197
- // if (!isElementScrollable) {
198
- // this.handleScrollFuncCall();
199
- // }
200
- // }
201
- }
202
-
203
- componentWillUnmount() {
204
- // let { suggestionContainer } = this;
205
- this._isMounted = false; // suggestionContainer &&
206
- // suggestionContainer.removeEventListener('scroll', this.handleScroll);
207
- }
208
-
209
- handleComponentDidUpdate() {
210
- return;
211
- }
212
-
213
- handleFormatOptions(props) {
214
- const {
215
- options,
216
- valueField,
217
- textField,
218
- prefixText,
219
- disabledOptions
220
- } = props;
221
- return this.formatOptions({
222
- options,
223
- valueField,
224
- textField,
225
- prefixText,
226
- optionType: 'default',
227
- disabledOptions
228
- });
229
- }
230
-
231
- handleGetSelectedOptions(selectedOptions, normalizedFormatOptions) {
232
- return this.getSelectedOptions({
233
- selectedOptions,
234
- normalizedFormatOptions
235
- });
236
- }
237
-
238
- handleInputCick(e) {
239
- const {
240
- removeClose
241
- } = this.props;
242
- const {
243
- highLightedSelectOptions,
244
- searchStr = ''
245
- } = this.state;
246
-
247
- if (highLightedSelectOptions.length) {
248
- this.setState({
249
- highLightedSelectOptions: [],
250
- shiftKeyPressHighLighted: 0,
251
- lastHighLightedSelectOption: ''
252
- });
253
- removeClose(e);
254
- } else if (searchStr.length) {
255
- removeClose(e);
256
- } else {
257
- this.togglePopup(e);
258
- }
259
- }
260
-
261
- handleFilterSuggestions() {
262
- const {
263
- options = dummyArray,
264
- searchStr = ''
265
- } = this.state;
266
- const {
267
- selectedOptions,
268
- needLocalSearch,
269
- keepSelectedOptions
270
- } = this.props;
271
- const {
272
- suggestions,
273
- suggestionIds
274
- } = this.getFilterSuggestions({
275
- options,
276
- selectedOptions,
277
- searchStr: getSearchString(searchStr),
278
- needSearch: needLocalSearch,
279
- keepSelectedOptions
280
- });
281
- this.suggestionsOrder = suggestionIds;
282
- return suggestions;
283
- }
284
-
285
- handleKeyDown(e) {
286
- const {
287
- keyCode,
288
- ctrlKey,
289
- metaKey,
290
- shiftKey
291
- } = e;
292
- let suggestions = [];
293
- let {
294
- hoverOption,
295
- searchStr,
296
- highLightedSelectOptions,
297
- lastHighLightedSelectOption,
298
- shiftKeyPressHighLighted,
299
- selectedOptionIds: selectedOptions
300
- } = this.state;
301
- const {
302
- isNextOptions,
303
- getNextOptions,
304
- isPopupOpen,
305
- isPopupOpenOnEnter,
306
- onKeyDown
307
- } = this.props;
308
- const highLightedSelectOptionsLen = highLightedSelectOptions.length;
309
-
310
- if (isPopupOpen && (keyCode === 38 || keyCode === 40 || keyCode === 13 || keyCode === 27 || keyCode === 9)) {
311
- suggestions = this.handleFilterSuggestions();
312
- }
313
-
314
- if (!isPopupOpen && !isPopupOpenOnEnter) {
315
- onKeyDown && onKeyDown(e);
316
- }
317
-
318
- if (!isPopupOpen && keyCode === 40) {
319
- //down arrow press popup open
320
- e.preventDefault(); //prevent body scroll
321
-
322
- this.togglePopup(e);
323
- }
324
-
325
- const suggestionsLen = suggestions.length;
326
-
327
- if (suggestionsLen && isPopupOpen && keyCode === 38) {
328
- //up arrow
329
-
330
- /*if (hoverOption === 0) { //disable first to last option higlight
331
- !isNextOptions && this.setState({ hoverOption: suggestionsLen - 1 });
332
- }*/
333
- if (hoverOption) {
334
- this.setState({
335
- hoverOption: hoverOption - 1
336
- });
337
- }
338
- } else if (suggestionsLen && isPopupOpen && keyCode === 40) {
339
- //down arrow
340
-
341
- /*else if (hoverOption === suggestionsLen - 1 || hoverOption === null) {
342
- //disable last to first option higlight
343
- !isNextOptions && this.setState({ hoverOption: 0 });
344
- }*/
345
- if (isNextOptions && suggestionsLen >= 5 && hoverOption === suggestionsLen - 3) {
346
- getNextOptions && this.handleFetchOptions(getNextOptions, searchStr);
347
- this.setState({
348
- hoverOption: hoverOption + 1
349
- });
350
- } else if (suggestionsLen - 1 > hoverOption) {
351
- this.setState({
352
- hoverOption: hoverOption + 1
353
- });
354
- }
355
- } else if (keyCode === 13) {
356
- //enter key
357
- const selectedOption = suggestions[hoverOption] || {};
358
- const {
359
- id
360
- } = selectedOption;
361
- isPopupOpen && !getIsEmptyValue(id) && this.handleSelectOption(id, e);
362
- !isPopupOpen && isPopupOpenOnEnter && this.togglePopup(e);
363
- } else if (selectedOptions.length && keyCode === 8 && !searchStr.length) {
364
- //backspace key
365
- if (highLightedSelectOptionsLen) {
366
- this.handleRemoveOption(highLightedSelectOptions);
367
- } else {
368
- this.handleRemoveOption(selectedOptions.slice(-1)); // this.setState({
369
- // highLightedSelectOptions: selectedOptions.slice(-1)
370
- // });
371
- }
372
- } else if (selectedOptions && keyCode === 65 && (ctrlKey || metaKey) && !searchStr.length) {
373
- //ctrl+a key
374
- this.setState({
375
- highLightedSelectOptions: selectedOptions,
376
- shiftKeyPressHighLighted: 0
377
- });
378
- } else if (keyCode === 39 && shiftKey && selectedOptions.length && !searchStr.length) {
379
- //shift+right arrow=39
380
- const lastHighLightedSelectOptionIndex = lastHighLightedSelectOption && selectedOptions.indexOf(lastHighLightedSelectOption) >= 0 ? selectedOptions.indexOf(lastHighLightedSelectOption) : 0;
381
- const newShiftKeyPressHighLighted = shiftKeyPressHighLighted ? shiftKeyPressHighLighted : shiftKeyPressHighLighted + 1;
382
- const newHighLightedSelectOption = lastHighLightedSelectOptionIndex !== null ? selectedOptions[lastHighLightedSelectOptionIndex + newShiftKeyPressHighLighted] : selectedOptions[0];
383
-
384
- if (!getIsEmptyValue(newHighLightedSelectOption)) {
385
- const newLastHighLightedSelectOption = lastHighLightedSelectOption ? lastHighLightedSelectOption : selectedOptions[0];
386
- highLightedSelectOptions = !shiftKeyPressHighLighted ? [newLastHighLightedSelectOption] : highLightedSelectOptions;
387
- const isRemove = highLightedSelectOptions.indexOf(newHighLightedSelectOption) >= 0 && newHighLightedSelectOption !== lastHighLightedSelectOption ? true : false;
388
- const newHighLightedSelectOptions = isRemove ? highLightedSelectOptions.filter(option => option !== newHighLightedSelectOption) : [...highLightedSelectOptions, newHighLightedSelectOption];
389
- this.setState({
390
- highLightedSelectOptions: newHighLightedSelectOptions,
391
- shiftKeyPressHighLighted: newShiftKeyPressHighLighted + 1,
392
- lastHighLightedSelectOption: newLastHighLightedSelectOption
393
- });
394
- }
395
- } else if (keyCode === 37 && shiftKey && selectedOptions.length && !searchStr.length) {
396
- // shift+left arrow=37
397
- const lastHighLightedSelectOptionIndex = lastHighLightedSelectOption ? selectedOptions.indexOf(lastHighLightedSelectOption) : selectedOptions.length - 1;
398
- const newShiftKeyPressHighLighted = shiftKeyPressHighLighted !== 1 ? shiftKeyPressHighLighted : shiftKeyPressHighLighted - 1;
399
- const newHighLightedSelectOption = selectedOptions[lastHighLightedSelectOptionIndex + newShiftKeyPressHighLighted - 1];
400
-
401
- if (!getIsEmptyValue(newHighLightedSelectOption)) {
402
- const newLastHighLightedSelectOption = lastHighLightedSelectOption ? lastHighLightedSelectOption : selectedOptions.slice(-1)[0];
403
- highLightedSelectOptions = !shiftKeyPressHighLighted ? [newLastHighLightedSelectOption] : highLightedSelectOptions;
404
- const isRemove = highLightedSelectOptions.indexOf(newHighLightedSelectOption) >= 0 && newHighLightedSelectOption !== lastHighLightedSelectOption ? true : false;
405
- const newHighLightedSelectOptions = isRemove ? highLightedSelectOptions.filter(option => option !== newHighLightedSelectOption) : [...highLightedSelectOptions, newHighLightedSelectOption];
406
- this.setState({
407
- highLightedSelectOptions: newHighLightedSelectOptions,
408
- shiftKeyPressHighLighted: newShiftKeyPressHighLighted - 1,
409
- lastHighLightedSelectOption: newLastHighLightedSelectOption
410
- });
411
- }
412
- } else if ((keyCode === 39 || keyCode === 37) && selectedOptions.length && !searchStr.length) {
413
- const isRightArrow = keyCode === 39 ? true : false; // let isLefttArrow = keyCode === 37 ? true : false;
414
-
415
- if (highLightedSelectOptions.length) {
416
- const [lastHighLightedSelectOption] = highLightedSelectOptions.slice(-1);
417
- const lastHighLightedSelectOptionIndex = selectedOptions.indexOf(lastHighLightedSelectOption);
418
- const newLastHighLightedSelectOptionIndex = isRightArrow ? lastHighLightedSelectOptionIndex === selectedOptions.length - 1 ? lastHighLightedSelectOptionIndex : lastHighLightedSelectOptionIndex + 1 : lastHighLightedSelectOptionIndex - 1;
419
- const newLastHighLightedSelectOption = selectedOptions[newLastHighLightedSelectOptionIndex];
420
- const isEmptyHighlighted = isRightArrow && highLightedSelectOptions.length === 1 && selectedOptions.slice(-1)[0] === lastHighLightedSelectOption ? true : false;
421
-
422
- if (!getIsEmptyValue(newLastHighLightedSelectOption)) {
423
- this.setState({
424
- lastHighLightedSelectOption: isEmptyHighlighted ? '' : newLastHighLightedSelectOption,
425
- highLightedSelectOptions: isEmptyHighlighted ? [] : [newLastHighLightedSelectOption],
426
- shiftKeyPressHighLighted: 0
427
- });
428
- }
429
- } else {
430
- const [newLastHighLightedSelectOption] = isRightArrow ? selectedOptions : selectedOptions.slice(-1);
431
- this.setState({
432
- lastHighLightedSelectOption: newLastHighLightedSelectOption,
433
- highLightedSelectOptions: [newLastHighLightedSelectOption],
434
- shiftKeyPressHighLighted: 0
435
- });
436
- }
437
- } // eslint-disable-next-line
438
- else if (keyCode === 27) {// this.handlePopupClose(e);
439
- } else if (keyCode === 9) {
440
- this.handlePopupClose(e);
441
- }
442
- }
443
-
444
- handleSelectAll(e) {
445
- e && e.preventDefault();
446
- const suggestions = this.handleFilterSuggestions();
447
- const {
448
- selectedOptions
449
- } = this.props;
450
- const newSelectedOptions = [];
451
- suggestions.forEach(option => {
452
- const {
453
- id
454
- } = option;
455
-
456
- if (selectedOptions.indexOf(id) === -1) {
457
- newSelectedOptions.push(id);
458
- }
459
- });
460
- this.handleChange([...selectedOptions, ...newSelectedOptions]); // this.handlePopupClose(e);
461
- }
462
-
463
- handleDeselectAll(e) {
464
- e && e.preventDefault();
465
- const {
466
- removeClose
467
- } = this.props;
468
- const {
469
- highLightedSelectOptions
470
- } = this.state;
471
-
472
- if (highLightedSelectOptions.length) {
473
- this.setState({
474
- highLightedSelectOptions: [],
475
- lastHighLightedSelectOption: ''
476
- });
477
- }
478
-
479
- removeClose(e);
480
- this.handleChange([]);
481
- }
482
-
483
- handleSelectOption(option, value, index, e) {
484
- const {
485
- selectedOptions,
486
- isSearchClearOnSelect,
487
- keepSelectedOptions
488
- } = this.props;
489
- const {
490
- searchStr
491
- } = this.state;
492
-
493
- if (searchStr.trim() != '' && isSearchClearOnSelect) {
494
- this.handleSearch('');
495
- }
496
-
497
- if (keepSelectedOptions && selectedOptions.indexOf(option) != -1) {
498
- let newSelectedOptions = selectedOptions.filter(id => {
499
- return id != option;
500
- });
501
- this.handleChange(newSelectedOptions, e);
502
- } else {
503
- this.handleChange([...selectedOptions, option], e);
504
- }
505
- }
506
-
507
- handleRemoveOption(options) {
508
- const newOptions = !getIsEmptyValue(options) && !Array.isArray(options) ? [options] : options;
509
- const {
510
- selectedOptions,
511
- isReadOnly
512
- } = this.props;
513
- const {
514
- highLightedSelectOptions,
515
- lastHighLightedSelectOption,
516
- shiftKeyPressHighLighted
517
- } = this.state;
518
-
519
- if (newOptions.length && !isReadOnly) {
520
- const newSelectedOptions = selectedOptions.filter(option => newOptions.indexOf(option) === -1);
521
- const newHighLightedSelectOptions = highLightedSelectOptions.filter(option => newSelectedOptions.indexOf(option) >= 0);
522
- let isHighlightedRemoved = false;
523
- const newOptionsLen = newOptions.length;
524
-
525
- for (let i = 0; i < newOptionsLen; i++) {
526
- const removedOption = newOptions[i];
527
-
528
- if (highLightedSelectOptions.indexOf(removedOption) >= 0) {
529
- isHighlightedRemoved = true;
530
- break;
531
- }
532
- }
533
-
534
- this.setState({
535
- lastHighLightedSelectOption: newSelectedOptions.indexOf(lastHighLightedSelectOption) >= 0 && !isHighlightedRemoved ? lastHighLightedSelectOption : '',
536
- highLightedSelectOptions: isHighlightedRemoved ? [] : newHighLightedSelectOptions,
537
- shiftKeyPressHighLighted: isHighlightedRemoved ? 0 : shiftKeyPressHighLighted
538
- });
539
- this.handleChange(newSelectedOptions);
540
- }
541
-
542
- this.moveFocusToTextbox();
543
- }
544
-
545
- handleMouseEnter(id, val, hoverOptionIndex, e) {
546
- e && e.preventDefault();
547
- const {
548
- hoverOption
549
- } = this.state;
550
- const {
551
- suggestionsOrder
552
- } = this;
553
- const newHoverIndex = suggestionsOrder.indexOf(id);
554
-
555
- if (newHoverIndex !== hoverOption) {
556
- this.setState({
557
- hoverOption: newHoverIndex
558
- });
559
- }
560
- }
561
-
562
- handleFetchOptions() {
563
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
564
- args[_key] = arguments[_key];
565
- }
566
-
567
- const [APICall, searchStr] = args;
568
- const {
569
- isFetchingOptions
570
- } = this.state;
571
- const {
572
- _isMounted
573
- } = this;
574
- const isForce = isFetchingOptions && searchStr ? true : false;
575
-
576
- if (!isFetchingOptions && APICall || isForce) {
577
- this.setState({
578
- isFetchingOptions: true
579
- });
580
-
581
- try {
582
- return APICall(searchStr).then(() => {
583
- _isMounted && this.setState({
584
- isFetchingOptions: false
585
- });
586
- }, () => {
587
- _isMounted && this.setState({
588
- isFetchingOptions: false
589
- });
590
- });
591
- } catch (e) {
592
- _isMounted && this.setState({
593
- isFetchingOptions: false
594
- });
595
- }
596
- }
597
- }
598
-
599
- handleSearchOptions() {
600
- const {
601
- onSearch
602
- } = this.props;
603
- const {
604
- searchStr
605
- } = this.state;
606
- searchStr && this.handleFetchOptions(onSearch, searchStr);
607
- }
608
-
609
- handleSearch(value, e) {
610
- const {
611
- onSearch,
612
- isPopupOpen
613
- } = this.props;
614
- !isPopupOpen && e && this.togglePopup(e);
615
- const {
616
- searchStr = ''
617
- } = this.state;
618
- const searchStrRegex = getSearchString(searchStr);
619
- const valueStrRegex = getSearchString(value);
620
- const isSearch = searchStrRegex !== valueStrRegex ? true : false;
621
- this.setState({
622
- searchStr: value
623
- }, () => {
624
- if (!value) {
625
- onSearch && onSearch('');
626
- } else if (isSearch && onSearch) {
627
- this.handleSearchOptions();
628
- }
629
- });
630
- }
631
-
632
- handleClickSelectedOption() {
633
- let id = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
634
- let e = arguments.length > 1 ? arguments[1] : undefined;
635
- const {
636
- selectedOptions
637
- } = this.props;
638
- let {
639
- highLightedSelectOptions,
640
- lastHighLightedSelectOption
641
- } = this.state;
642
- const {
643
- metaKey,
644
- ctrlKey,
645
- shiftKey
646
- } = e;
647
-
648
- if (e && shiftKey) {
649
- //shift+click
650
- let from = selectedOptions.indexOf(lastHighLightedSelectOption) >= 0 ? selectedOptions.indexOf(lastHighLightedSelectOption) : 0;
651
- let to = id && selectedOptions.indexOf(id) >= 0 ? selectedOptions.indexOf(id) : null;
652
-
653
- if (to >= 0 && to < from) {
654
- [to] = [from, from = to];
655
- }
656
-
657
- to += 1;
658
- const newSelectedHighlights = to ? selectedOptions.slice(from, to) : [];
659
- to && this.setState({
660
- highLightedSelectOptions: newSelectedHighlights,
661
- lastHighLightedSelectOption: id
662
- });
663
- } else if (e && (ctrlKey || metaKey)) {
664
- //ctrl+click
665
- const isRemove = highLightedSelectOptions.indexOf(id) >= 0;
666
- let newSelectedHighlights = [];
667
-
668
- if (isRemove) {
669
- lastHighLightedSelectOption = id === lastHighLightedSelectOption ? '' : lastHighLightedSelectOption;
670
- newSelectedHighlights = highLightedSelectOptions.filter(option => option !== id);
671
- } else {
672
- lastHighLightedSelectOption = id;
673
- newSelectedHighlights = [...highLightedSelectOptions, id];
674
- }
675
-
676
- this.setState({
677
- highLightedSelectOptions: newSelectedHighlights,
678
- lastHighLightedSelectOption
679
- });
680
- } else {
681
- this.setState({
682
- highLightedSelectOptions: [id],
683
- lastHighLightedSelectOption: id
684
- });
685
- }
686
-
687
- this.setState({
688
- shiftKeyPressHighLighted: 0
689
- });
690
- this.moveFocusToTextbox();
691
- }
692
-
693
- handleScroll(e) {
694
- let ele = e.target;
695
- let isScrollReachedBottom = findScrollEnd(ele);
696
- isScrollReachedBottom && this.handleScrollFuncCall();
697
- }
698
-
699
- handleScrollFuncCall() {
700
- const {
701
- getNextOptions,
702
- isNextOptions
703
- } = this.props;
704
- const {
705
- searchStr
706
- } = this.state;
707
- isNextOptions && getNextOptions && this.handleFetchOptions(getNextOptions, searchStr);
708
- }
709
-
710
- handleChange() {
711
- let selectedOptions = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
712
- let e = arguments.length > 1 ? arguments[1] : undefined;
713
- const {
714
- optionsNormalize
715
- } = this.state;
716
- const {
717
- onChange,
718
- needToCloseOnSelect,
719
- togglePopup,
720
- selectedOptions: propSelectedOptions,
721
- disabledOptions = dummyArray
722
- } = this.props;
723
- const {
724
- newSelectedOptions
725
- } = filterSelectedOptions({
726
- selectedOptions,
727
- propSelectedOptions,
728
- disabledOptions
729
- });
730
- const selectedOptionsLen = newSelectedOptions.length;
731
- const allSelectedOptionsDetails = [];
732
-
733
- for (let i = 0; i < selectedOptionsLen; i++) {
734
- const id = newSelectedOptions[i];
735
- allSelectedOptionsDetails.push(optionsNormalize[id]);
736
- }
737
-
738
- onChange && onChange(newSelectedOptions, allSelectedOptionsDetails); // this.setState({ searchStr: '' });
739
-
740
- this.moveFocusToTextbox();
741
-
742
- if (needToCloseOnSelect) {
743
- togglePopup(e);
744
- }
745
- }
746
-
747
- togglePopup(e) {
748
- const {
749
- togglePopup,
750
- defaultDropBoxPosition,
751
- isReadOnly
752
- } = this.props;
753
- !isReadOnly && togglePopup(e, defaultDropBoxPosition ? `${defaultDropBoxPosition}` : null);
754
- }
755
-
756
- handlePopupClose(e) {
757
- const {
758
- closePopupOnly
759
- } = this.props;
760
- closePopupOnly(e);
761
- }
762
-
763
- searchInputRef(el) {
764
- const {
765
- getRef
766
- } = this.props;
767
- this.searchInput = el;
768
- getRef && getRef(el);
769
- }
770
-
771
- selectedOptionContainerRef(el) {
772
- const {
773
- getTargetRef
774
- } = this.props;
775
- this.selectedOptionContainer = el;
776
- getTargetRef(el);
777
- }
778
-
779
- selectedOptionRef(el, id) {
780
- this[`selectedOption_${id}`] = el;
781
- }
782
-
783
- suggestionContainerRef(el) {
784
- this.suggestionContainer = el;
785
- }
786
-
787
- suggestionItemRef(el, index, id) {
788
- this[`suggestion_${id}`] = el;
789
- }
790
-
791
- handleActive(e) {
792
- const {
793
- searchStr,
794
- isActive
795
- } = this.state;
796
-
797
- if (!isActive) {
798
- this.setState({
799
- isActive: true
800
- });
801
- }
802
-
803
- const {
804
- target
805
- } = e || {};
806
- target && target.setSelectionRange(target, 0);
807
- const {
808
- onFocus
809
- } = this.props;
810
- onFocus && onFocus(searchStr);
811
- }
812
-
813
- handleInactive() {
814
- const {
815
- isActive
816
- } = this.state;
817
-
818
- if (isActive) {
819
- this.setState({
820
- isActive: false
821
- });
822
- }
823
- }
824
-
825
- handleInputFocus() {
826
- const {
827
- isDisabled,
828
- isReadOnly
829
- } = this.props;
830
- !isDisabled && !isReadOnly && this.moveFocusToTextbox();
831
- }
832
-
833
- moveFocusToTextbox() {
834
- this.searchInput && this.searchInput.focus({
835
- preventScroll: true
836
- });
837
- }
838
-
839
- handleExposedPublicMethods() {
840
- const {
841
- getPublicMethods,
842
- openPopupOnly
843
- } = this.props;
844
- getPublicMethods && getPublicMethods({
845
- openPopupOnly
846
- });
847
- }
848
-
849
- getSelectionUI() {
850
- let isResponsive = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
851
- let {
852
- size,
853
- needBorder,
854
- disableAction,
855
- borderColor,
856
- placeHolder,
857
- textBoxSize,
858
- variant,
859
- textBoxClass,
860
- needAutoFocus,
861
- htmlId,
862
- children,
863
- customChildrenClass,
864
- autoComplete,
865
- a11y,
866
- disabledOptions,
867
- i18nKeys,
868
- isReadOnly,
869
- isDisabled,
870
- palette,
871
- dataId,
872
- setAriaId,
873
- isPopupOpen,
874
- ariaErrorId
875
- } = this.props;
876
- let {
877
- isActive,
878
- selectedOptions,
879
- highLightedSelectOptions,
880
- searchStr
881
- } = this.state;
882
- const {
883
- clearText = 'Clear all'
884
- } = i18nKeys;
885
- const {
886
- clearLabel = 'Clear all',
887
- ariaLabelledby
888
- } = a11y;
889
- let {
890
- isShowClearIcon: isShowClear
891
- } = this.getIsShowClearIcon({
892
- selectedOptions,
893
- disabledOptions
894
- });
895
- const isShowClearIcon = !isReadOnly && !isDisabled && !disableAction && isShowClear;
896
- return /*#__PURE__*/React.createElement(Container, {
897
- align: "vertical",
898
- alignBox: "row",
899
- className: `${style.container} ${style[size]} ${needBorder ? !disableAction ? style[`borderColor_${borderColor}`] : style.borderColor_transparent : ''} ${isActive && needBorder || isResponsive ? style.active : ''} ${textBoxClass} ${needBorder ? style.hasBorder : ''}`,
900
- eleRef: this.selectedOptionContainerRef,
901
- wrap: "wrap"
902
- }, /*#__PURE__*/React.createElement(SelectedOptions, {
903
- selectedOptions: selectedOptions,
904
- highLightedSelectOptions: highLightedSelectOptions,
905
- isReadOnly: isReadOnly,
906
- getRef: this.selectedOptionRef,
907
- onRemove: this.handleRemoveOption,
908
- onSelect: this.handleClickSelectedOption,
909
- size: size,
910
- palette: palette,
911
- dataId: `${dataId}_selectedOptions`
912
- }), /*#__PURE__*/React.createElement(Box, {
913
- flexible: true,
914
- className: style.wrapper,
915
- adjust: true,
916
- shrink: true
917
- }, /*#__PURE__*/React.createElement("span", {
918
- className: ` ${style.custmSpan} ${textBoxSize === 'xmedium' ? style.custmSpanXmedium : style.custmSpanMedium} ${isShowClearIcon ? style.clearIconSpace : ''}
919
- ${customChildrenClass ? customChildrenClass : ''}`
920
- }, searchStr), /*#__PURE__*/React.createElement(TextBoxIcon, {
921
- isDisabled: isDisabled,
922
- inputRef: this.searchInputRef,
923
- needBorder: false,
924
- onBlur: this.handleInactive,
925
- onChange: this.handleSearch,
926
- onClick: !isResponsive ? this.handleInputCick : undefined,
927
- onFocus: this.handleActive,
928
- onKeyDown: this.handleKeyDown,
929
- autofocus: needAutoFocus,
930
- placeHolder: selectedOptions.length >= 1 ? '' : placeHolder,
931
- size: textBoxSize,
932
- value: searchStr,
933
- variant: variant,
934
- dataId: `${dataId}_textBox`,
935
- isReadOnly: isReadOnly,
936
- tabindex: isDisabled && '-1',
937
- customClass: {
938
- customTBoxWrap: style.custmInputWrapper
939
- },
940
- htmlId: htmlId,
941
- a11y: {
942
- role: 'combobox',
943
- ariaOwns: setAriaId,
944
- ariaControls: setAriaId,
945
- ariaExpanded: !isReadOnly && !isDisabled && !disableAction && isPopupOpen ? true : false,
946
- ariaHaspopup: true,
947
- ariaRequired: true,
948
- ariaDescribedby: ariaErrorId,
949
- ariaLabelledby: ariaLabelledby
950
- },
951
- autoComplete: autoComplete
952
- }, /*#__PURE__*/React.createElement(Container, {
953
- alignBox: "row",
954
- align: "vertical"
955
- }, isShowClearIcon ? /*#__PURE__*/React.createElement(Box, {
956
- className: `${style.delete} ${style[`${palette}Delete`]}`,
957
- dataId: `${dataId}_clearIcon`,
958
- "data-title": clearText,
959
- onClick: this.handleDeselectAll,
960
- tagName: "button",
961
- "aria-label": clearLabel
962
- }, /*#__PURE__*/React.createElement(Icon, {
963
- name: "ZD-delete",
964
- size: "15"
965
- })) : null, children ? /*#__PURE__*/React.createElement(Box, {
966
- dataId: `${dataId}_children`
967
- }, children) : null))));
968
- }
969
-
970
- render() {
971
- let {
972
- isReadOnly,
973
- searchEmptyMessage,
974
- emptyMessage,
975
- noMoreOptionsMessage,
976
- dropBoxSize,
977
- isPopupOpen,
978
- isPopupReady,
979
- position,
980
- defaultDropBoxPosition,
981
- getContainerRef,
982
- removeClose,
983
- isAnimate,
984
- animationStyle,
985
- isDisabled,
986
- title,
987
- needResponsive,
988
- dataId,
989
- dataSelectorId,
990
- isSearching,
991
- borderColor,
992
- disableAction,
993
- isBoxPaddingNeed,
994
- isAbsolutePositioningNeeded,
995
- positionsOffset,
996
- targetOffset,
997
- isRestrictScroll,
998
- palette,
999
- i18nKeys,
1000
- getFooter,
1001
- needEffect,
1002
- boxSize,
1003
- isLoading,
1004
- selectAllText,
1005
- needSelectAll
1006
- } = this.props;
1007
- const {
1008
- selectedOptions,
1009
- searchStr,
1010
- hoverOption,
1011
- options,
1012
- isFetchingOptions,
1013
- selectedOptionIds
1014
- } = this.state;
1015
- const {
1016
- searchText = 'Searching...'
1017
- } = i18nKeys;
1018
- const suggestions = this.handleFilterSuggestions();
1019
- const setAriaId = this.getNextAriaId();
1020
- const ariaErrorId = this.getNextAriaId();
1021
- i18nKeys = Object.assign({}, MobileHeader_defaultProps.i18nKeys, i18nKeys, {
1022
- emptyText: i18nKeys.emptyText || emptyMessage,
1023
- searchEmptyText: i18nKeys.searchEmptyText || searchEmptyMessage,
1024
- noMoreText: i18nKeys.noMoreText || noMoreOptionsMessage
1025
- });
1026
- let isModel = isMobilePopover(needResponsive);
1027
- return /*#__PURE__*/React.createElement("div", {
1028
- className: `${style.wrapper} ${isDisabled ? style.disabled : ''} ${isReadOnly ? style.readOnly : ''} ${disableAction ? CssProvider('isBlock') : ''} ${borderColor === 'transparent' ? style.transparentContainer : ''} ${needEffect && !(isDisabled || isReadOnly) ? style.effect : ''}`,
1029
- "data-id": `${isDisabled ? `${dataId}_disabled` : isReadOnly ? `${dataId}_readOnly` : dataId}`,
1030
- "data-test-id": `${isDisabled ? `${dataId}_disabled` : isReadOnly ? `${dataId}_readOnly` : dataId}`,
1031
- "data-title": isDisabled ? title : null,
1032
- onClick: this.handleInputFocus,
1033
- "data-selector-id": dataSelectorId
1034
- }, this.getSelectionUI(), !isReadOnly && !isDisabled && !disableAction && isPopupOpen ? /*#__PURE__*/React.createElement(ResponsiveDropBox, {
1035
- animationStyle: animationStyle,
1036
- boxPosition: position || `${defaultDropBoxPosition}`,
1037
- getRef: getContainerRef,
1038
- isActive: isPopupReady,
1039
- isAnimate: isAnimate,
1040
- isArrow: false,
1041
- onClick: removeClose,
1042
- needResponsive: needResponsive,
1043
- isPadding: false,
1044
- isBoxPaddingNeed: isBoxPaddingNeed,
1045
- isAbsolutePositioningNeeded: isAbsolutePositioningNeeded,
1046
- positionsOffset: positionsOffset,
1047
- targetOffset: targetOffset,
1048
- isRestrictScroll: isRestrictScroll,
1049
- palette: palette,
1050
- htmlId: setAriaId,
1051
- a11y: {
1052
- role: 'listbox',
1053
- ariaMultiselectable: true
1054
- },
1055
- size: boxSize,
1056
- alignBox: "row",
1057
- isResponsivePadding: getFooter ? false : true,
1058
- dataId: `${dataId}_dropbox`
1059
- }, /*#__PURE__*/React.createElement(Box, {
1060
- flexible: true
1061
- }, /*#__PURE__*/React.createElement(Card, {
1062
- customClass: `${style.box} ${style[`${palette}Box`]}`,
1063
- onScroll: this.handleScroll
1064
- }, isModel && /*#__PURE__*/React.createElement(MobileHeader, {
1065
- selectedOptions: selectedOptions,
1066
- i18nKeys: i18nKeys,
1067
- onClick: this.handlePopupClose
1068
- }, /*#__PURE__*/React.createElement("div", {
1069
- className: style.effect
1070
- }, this.getSelectionUI(true))), needSelectAll ? /*#__PURE__*/React.createElement(CardHeader, null, /*#__PURE__*/React.createElement(MultiSelectHeader, {
1071
- onSelect: this.handleSelectAll,
1072
- selectAllText: selectAllText,
1073
- suggestions: suggestions,
1074
- dataId: dataId
1075
- })) : null, isLoading ? /*#__PURE__*/React.createElement(Container, {
1076
- align: "both",
1077
- className: style.loader
1078
- }, /*#__PURE__*/React.createElement(Loader, null)) : /*#__PURE__*/React.createElement(CardContent, {
1079
- shrink: true,
1080
- customClass: !isModel && dropBoxSize ? style[dropBoxSize] : '',
1081
- eleRef: this.suggestionContainerRef
1082
- }, isSearching ? /*#__PURE__*/React.createElement("div", {
1083
- className: style[palette]
1084
- }, searchText) : suggestions.length ? /*#__PURE__*/React.createElement(Suggestions, {
1085
- suggestions: suggestions,
1086
- getRef: this.suggestionItemRef,
1087
- hoverOption: hoverOption,
1088
- onClick: this.handleSelectOption,
1089
- onMouseEnter: this.handleMouseEnter,
1090
- needBorder: false,
1091
- dataId: `${dataId}_Options`,
1092
- palette: palette,
1093
- selectedOptions: selectedOptionIds,
1094
- a11y: {
1095
- role: 'option'
1096
- }
1097
- }) : /*#__PURE__*/React.createElement(EmptyState, {
1098
- isLoading: isFetchingOptions,
1099
- options: options,
1100
- searchString: searchStr,
1101
- suggestions: suggestions,
1102
- dataId: dataId,
1103
- palette: palette,
1104
- i18nKeys: i18nKeys,
1105
- htmlId: ariaErrorId
1106
- }), isFetchingOptions && /*#__PURE__*/React.createElement(Container, {
1107
- isCover: false,
1108
- align: "both"
1109
- }, /*#__PURE__*/React.createElement(Loader, null))), getFooter ? /*#__PURE__*/React.createElement(CardFooter, null, getFooter()) : null))) : null);
1110
- }
1111
-
1112
- }
1113
- MultiSelectComponent.propTypes = MultiSelect_propTypes;
1114
- MultiSelectComponent.defaultProps = MultiSelect_defaultProps;
1115
- MultiSelectComponent.displayName = 'MultiSelect';
1116
- const MultiSelect = Popup(MultiSelectComponent);
1117
- MultiSelect.propTypes = MultiSelectComponent.propTypes;
1118
- MultiSelect.defaultProps = MultiSelectComponent.defaultProps;
1119
- export default MultiSelect;