@zohodesk/components 1.0.0-test-252 → 1.0.0

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 (601) hide show
  1. package/README.md +161 -1
  2. package/assets/Appearance/dark/mode/darkMode.module.css +181 -179
  3. package/assets/Appearance/dark/themes/blue/blueDarkCTAModifyCategory.module.css +452 -0
  4. package/assets/Appearance/dark/themes/blue/blueDarkCTATheme.module.css +31 -31
  5. package/assets/Appearance/dark/themes/blue/blueDarkComponentTheme.module.css +3 -0
  6. package/assets/Appearance/dark/themes/green/greenDarkCTAModifyCategory.module.css +452 -0
  7. package/assets/Appearance/dark/themes/green/greenDarkCTATheme.module.css +30 -30
  8. package/assets/Appearance/dark/themes/green/greenDarkComponentTheme.module.css +3 -0
  9. package/assets/Appearance/dark/themes/orange/orangeDarkCTAModifyCategory.module.css +452 -0
  10. package/assets/Appearance/dark/themes/orange/orangeDarkCTATheme.module.css +30 -30
  11. package/assets/Appearance/dark/themes/orange/orangeDarkComponentTheme.module.css +3 -0
  12. package/assets/Appearance/dark/themes/red/redDarkCTAModifyCategory.module.css +452 -0
  13. package/assets/Appearance/dark/themes/red/redDarkCTATheme.module.css +30 -30
  14. package/assets/Appearance/dark/themes/red/redDarkComponentTheme.module.css +3 -0
  15. package/assets/Appearance/dark/themes/yellow/yellowDarkCTAModifyCategory.module.css +452 -0
  16. package/assets/Appearance/dark/themes/yellow/yellowDarkCTATheme.module.css +30 -30
  17. package/assets/Appearance/dark/themes/yellow/yellowDarkComponentTheme.module.css +3 -0
  18. package/assets/Appearance/default/mode/defaultMode.module.css +177 -175
  19. package/assets/Appearance/default/themes/blue/blueDefaultCTAModifyCategory.module.css +452 -0
  20. package/assets/Appearance/default/themes/blue/blueDefaultCTATheme.module.css +31 -31
  21. package/assets/Appearance/default/themes/blue/blueDefaultComponentTheme.module.css +3 -0
  22. package/assets/Appearance/default/themes/green/greenDefaultCTAModifyCategory.module.css +452 -0
  23. package/assets/Appearance/default/themes/green/greenDefaultCTATheme.module.css +30 -30
  24. package/assets/Appearance/default/themes/green/greenDefaultComponentTheme.module.css +3 -0
  25. package/assets/Appearance/default/themes/orange/orangeDefaultCTAModifyCategory.module.css +452 -0
  26. package/assets/Appearance/default/themes/orange/orangeDefaultCTATheme.module.css +30 -30
  27. package/assets/Appearance/default/themes/orange/orangeDefaultComponentTheme.module.css +3 -0
  28. package/assets/Appearance/default/themes/red/redDefaultCTAModifyCategory.module.css +452 -0
  29. package/assets/Appearance/default/themes/red/redDefaultCTATheme.module.css +30 -30
  30. package/assets/Appearance/default/themes/red/redDefaultComponentTheme.module.css +3 -0
  31. package/assets/Appearance/default/themes/yellow/yellowDefaultCTAModifyCategory.module.css +452 -0
  32. package/assets/Appearance/default/themes/yellow/yellowDefaultCTATheme.module.css +30 -30
  33. package/assets/Appearance/default/themes/yellow/yellowDefaultComponentTheme.module.css +3 -0
  34. package/assets/Appearance/pureDark/mode/pureDarkMode.module.css +182 -180
  35. package/assets/Appearance/pureDark/themes/blue/bluePureDarkCTAModifyCategory.module.css +452 -0
  36. package/assets/Appearance/pureDark/themes/blue/bluePureDarkCTATheme.module.css +31 -31
  37. package/assets/Appearance/pureDark/themes/blue/bluePureDarkComponentTheme.module.css +3 -0
  38. package/assets/Appearance/pureDark/themes/green/greenPureDarkCTAModifyCategory.module.css +452 -0
  39. package/assets/Appearance/pureDark/themes/green/greenPureDarkCTATheme.module.css +30 -30
  40. package/assets/Appearance/pureDark/themes/green/greenPureDarkComponentTheme.module.css +3 -0
  41. package/assets/Appearance/pureDark/themes/orange/orangePureDarkCTAModifyCategory.module.css +452 -0
  42. package/assets/Appearance/pureDark/themes/orange/orangePureDarkCTATheme.module.css +30 -30
  43. package/assets/Appearance/pureDark/themes/orange/orangePureDarkComponentTheme.module.css +3 -0
  44. package/assets/Appearance/pureDark/themes/red/redPureDarkCTAModifyCategory.module.css +452 -0
  45. package/assets/Appearance/pureDark/themes/red/redPureDarkCTATheme.module.css +30 -30
  46. package/assets/Appearance/pureDark/themes/red/redPureDarkComponentTheme.module.css +3 -0
  47. package/assets/Appearance/pureDark/themes/yellow/yellowPureDarkCTAModifyCategory.module.css +452 -0
  48. package/assets/Appearance/pureDark/themes/yellow/yellowPureDarkCTATheme.module.css +30 -30
  49. package/assets/Appearance/pureDark/themes/yellow/yellowPureDarkComponentTheme.module.css +3 -0
  50. package/assets/Contrast/darkContrastLightness.module.css +39 -0
  51. package/assets/Contrast/defaultContrastLightness.module.css +39 -0
  52. package/assets/Contrast/pureDarkContrastLightness.module.css +39 -0
  53. package/css_error.log +1 -0
  54. package/es/Accordion/Accordion.js +19 -9
  55. package/es/Accordion/AccordionItem.js +13 -8
  56. package/es/Accordion/props/defaultProps.js +6 -2
  57. package/es/Accordion/props/propTypes.js +3 -0
  58. package/es/Animation/Animation.js +10 -9
  59. package/es/AppContainer/AppContainer.js +38 -15
  60. package/es/AppContainer/AppContainer.module.css +2 -2
  61. package/es/AppContainer/props/defaultProps.js +3 -1
  62. package/es/AppContainer/props/propTypes.js +2 -0
  63. package/es/Avatar/Avatar.js +48 -25
  64. package/es/Avatar/Avatar.module.css +59 -18
  65. package/es/Avatar/props/defaultProps.js +4 -1
  66. package/es/Avatar/props/propTypes.js +5 -2
  67. package/es/AvatarTeam/AvatarTeam.js +21 -11
  68. package/es/AvatarTeam/AvatarTeam.module.css +49 -21
  69. package/es/AvatarTeam/props/defaultProps.js +5 -1
  70. package/es/AvatarTeam/props/propTypes.js +5 -1
  71. package/es/Button/Button.js +55 -51
  72. package/{lib/Button → es/Button/css}/Button.module.css +62 -58
  73. package/es/Button/css/cssJSLogic.js +53 -0
  74. package/es/Button/index.js +2 -0
  75. package/es/Button/props/defaultProps.js +3 -1
  76. package/es/Button/props/propTypes.js +6 -2
  77. package/es/Buttongroup/Buttongroup.js +24 -16
  78. package/es/Buttongroup/Buttongroup.module.css +45 -28
  79. package/es/Buttongroup/props/defaultProps.js +3 -1
  80. package/es/Buttongroup/props/propTypes.js +3 -1
  81. package/es/Card/Card.js +48 -26
  82. package/es/Card/props/defaultProps.js +12 -2
  83. package/es/Card/props/propTypes.js +2 -2
  84. package/es/CheckBox/CheckBox.js +13 -9
  85. package/es/CheckBox/CheckBox.module.css +16 -16
  86. package/es/CheckBox/props/propTypes.js +1 -0
  87. package/es/DateTime/CalendarView.js +46 -19
  88. package/es/DateTime/DateTime.js +139 -77
  89. package/es/DateTime/DateTime.module.css +51 -48
  90. package/es/DateTime/DateTimePopupFooter.js +4 -2
  91. package/es/DateTime/DateTimePopupHeader.js +30 -11
  92. package/es/DateTime/DateWidget.js +122 -51
  93. package/es/DateTime/DateWidget.module.css +5 -5
  94. package/es/DateTime/DaysRow.js +6 -3
  95. package/es/DateTime/Time.js +10 -2
  96. package/es/DateTime/YearView.js +41 -9
  97. package/es/DateTime/YearView.module.css +33 -15
  98. package/es/DateTime/__tests__/CalendarView.spec.js +1 -0
  99. package/es/DateTime/__tests__/DateTime.spec.js +1 -0
  100. package/es/DateTime/__tests__/DateWidget.spec.js +2 -3
  101. package/es/DateTime/common.js +3 -0
  102. package/es/DateTime/constants.js +1 -0
  103. package/es/DateTime/dateFormatUtils/dateFormat.js +63 -30
  104. package/es/DateTime/dateFormatUtils/dateFormats.js +42 -0
  105. package/es/DateTime/dateFormatUtils/dayChange.js +13 -4
  106. package/es/DateTime/dateFormatUtils/index.js +59 -2
  107. package/es/DateTime/dateFormatUtils/monthChange.js +8 -0
  108. package/es/DateTime/dateFormatUtils/timeChange.js +22 -6
  109. package/es/DateTime/dateFormatUtils/yearChange.js +11 -2
  110. package/es/DateTime/index.js +1 -1
  111. package/es/DateTime/objectUtils.js +14 -20
  112. package/es/DateTime/props/defaultProps.js +2 -1
  113. package/es/DateTime/props/propTypes.js +5 -2
  114. package/es/DateTime/typeChecker.js +3 -0
  115. package/es/DateTime/validator.js +58 -6
  116. package/es/DropBox/DropBox.js +82 -218
  117. package/es/DropBox/DropBoxElement/DropBoxElement.js +132 -0
  118. package/es/DropBox/DropBoxElement/css/DropBoxElement.module.css +435 -0
  119. package/es/DropBox/DropBoxElement/css/cssJSLogic.js +91 -0
  120. package/es/DropBox/DropBoxElement/props/defaultProps.js +18 -0
  121. package/es/DropBox/DropBoxElement/props/propTypes.js +45 -0
  122. package/es/DropBox/DropBoxElement/useDropboxPosCalc.js +54 -0
  123. package/es/DropBox/__tests__/DropBox.spec.js +2 -2
  124. package/es/DropBox/css/DropBox.module.css +59 -0
  125. package/es/DropBox/css/cssJSLogic.js +14 -0
  126. package/es/DropBox/props/defaultProps.js +9 -15
  127. package/es/DropBox/props/propTypes.js +9 -41
  128. package/es/DropDown/DropDown.js +16 -9
  129. package/es/DropDown/DropDown.module.css +2 -2
  130. package/es/DropDown/DropDownHeading.js +18 -11
  131. package/es/DropDown/DropDownHeading.module.css +3 -3
  132. package/es/DropDown/DropDownItem.js +8 -1
  133. package/es/DropDown/DropDownItem.module.css +9 -9
  134. package/es/DropDown/DropDownSearch.js +4 -0
  135. package/es/DropDown/DropDownSeparator.js +1 -0
  136. package/es/DropDown/DropDownSeparator.module.css +2 -2
  137. package/es/DropDown/__tests__/DropDown.spec.js +1 -2
  138. package/es/DropDown/index.js +7 -0
  139. package/es/DropDown/props/defaultProps.js +3 -1
  140. package/es/DropDown/props/propTypes.js +2 -1
  141. package/es/Heading/Heading.js +8 -7
  142. package/es/Heading/Heading.module.css +2 -2
  143. package/es/Label/Label.js +14 -9
  144. package/es/Label/Label.module.css +1 -1
  145. package/es/Label/props/defaultProps.js +2 -1
  146. package/es/Label/props/propTypes.js +1 -0
  147. package/es/Layout/Box.js +19 -4
  148. package/es/Layout/Container.js +18 -5
  149. package/es/Layout/Layout.module.css +15 -15
  150. package/es/Layout/index.js +9 -10
  151. package/es/Layout/props/defaultProps.js +6 -2
  152. package/es/Layout/props/propTypes.js +7 -3
  153. package/es/Layout/utils.js +5 -1
  154. package/es/ListItem/ListContainer.js +21 -9
  155. package/es/ListItem/ListItem.js +30 -14
  156. package/es/ListItem/ListItem.module.css +37 -30
  157. package/es/ListItem/ListItemWithAvatar.js +30 -15
  158. package/es/ListItem/ListItemWithCheckBox.js +22 -10
  159. package/es/ListItem/ListItemWithIcon.js +29 -14
  160. package/es/ListItem/ListItemWithRadio.js +22 -10
  161. package/es/ListItem/index.js +6 -0
  162. package/es/ListItem/props/defaultProps.js +18 -6
  163. package/es/ListItem/props/propTypes.js +13 -1
  164. package/es/Modal/Modal.js +35 -17
  165. package/es/MultiSelect/AdvancedGroupMultiSelect.js +100 -20
  166. package/es/MultiSelect/AdvancedMultiSelect.js +45 -19
  167. package/es/MultiSelect/EmptyState.js +6 -0
  168. package/es/MultiSelect/MultiSelect.js +129 -46
  169. package/es/MultiSelect/MultiSelect.module.css +32 -31
  170. package/es/MultiSelect/MultiSelectHeader.js +3 -0
  171. package/es/MultiSelect/MultiSelectWithAvatar.js +43 -19
  172. package/es/MultiSelect/SelectedOptions.js +6 -3
  173. package/es/MultiSelect/SelectedOptions.module.css +5 -5
  174. package/es/MultiSelect/Suggestions.js +13 -6
  175. package/es/MultiSelect/__tests__/MultiSelect.spec.js +4 -6
  176. package/es/MultiSelect/index.js +4 -0
  177. package/es/MultiSelect/props/defaultProps.js +11 -4
  178. package/es/MultiSelect/props/propTypes.js +17 -5
  179. package/es/PopOver/PopOver.js +25 -9
  180. package/es/PopOver/__tests__/PopOver.spec.js +2 -1
  181. package/es/PopOver/index.js +3 -0
  182. package/es/Popup/Popup.js +80 -31
  183. package/es/Popup/__tests__/Popup.spec.js +17 -5
  184. package/es/Popup/viewPort.js +16 -4
  185. package/es/Provider/AvatarSize.js +1 -0
  186. package/es/Provider/IdProvider.js +16 -10
  187. package/es/Provider/LibraryContext.js +6 -4
  188. package/es/Provider/NumberGenerator/NumberGenerator.js +21 -7
  189. package/es/Provider/ZindexProvider.js +9 -2
  190. package/es/Provider/index.js +4 -0
  191. package/es/Radio/Radio.js +9 -7
  192. package/es/Radio/Radio.module.css +3 -3
  193. package/es/Responsive/CustomResponsive.js +37 -21
  194. package/es/Responsive/RefWrapper.js +6 -7
  195. package/es/Responsive/ResizeComponent.js +35 -25
  196. package/es/Responsive/ResizeObserver.js +26 -6
  197. package/es/Responsive/Responsive.js +34 -20
  198. package/es/Responsive/index.js +9 -8
  199. package/es/Responsive/sizeObservers.js +28 -7
  200. package/es/Responsive/utils/index.js +7 -5
  201. package/es/Responsive/utils/shallowCompare.js +7 -2
  202. package/es/Responsive/windowResizeObserver.js +7 -0
  203. package/es/ResponsiveDropBox/ResponsiveDropBox.js +4 -0
  204. package/es/ResponsiveDropBox/ResponsiveDropBox.module.css +2 -2
  205. package/es/Ribbon/Ribbon.js +21 -15
  206. package/es/Ribbon/Ribbon.module.css +133 -55
  207. package/es/Ribbon/props/defaultProps.js +2 -1
  208. package/es/Ribbon/props/propTypes.js +2 -1
  209. package/es/RippleEffect/RippleEffect.js +6 -7
  210. package/es/Select/GroupSelect.js +71 -23
  211. package/es/Select/Select.js +115 -50
  212. package/es/Select/Select.module.css +23 -23
  213. package/es/Select/SelectWithAvatar.js +31 -12
  214. package/es/Select/SelectWithIcon.js +60 -14
  215. package/es/Select/__tests__/Select.spec.js +6 -8
  216. package/es/Select/index.js +4 -0
  217. package/es/Select/props/defaultProps.js +6 -1
  218. package/es/Select/props/propTypes.js +10 -4
  219. package/es/Stencils/Stencils.js +10 -9
  220. package/es/Stencils/Stencils.module.css +2 -2
  221. package/es/Switch/Switch.js +14 -8
  222. package/es/Switch/Switch.module.css +49 -32
  223. package/es/Switch/props/defaultProps.js +2 -1
  224. package/es/Switch/props/propTypes.js +1 -0
  225. package/es/Tab/Tab.js +14 -11
  226. package/es/Tab/Tab.module.css +14 -15
  227. package/es/Tab/TabContent.js +6 -3
  228. package/es/Tab/TabContentWrapper.js +6 -2
  229. package/es/Tab/TabWrapper.js +9 -4
  230. package/es/Tab/Tabs.js +85 -21
  231. package/es/Tab/Tabs.module.css +36 -40
  232. package/es/Tab/__tests__/Tab.spec.js +4 -12
  233. package/es/Tab/__tests__/TabWrapper.spec.js +1 -0
  234. package/es/Tab/props/defaultProps.js +10 -5
  235. package/es/Tab/props/propTypes.js +10 -5
  236. package/es/Tag/Tag.js +16 -10
  237. package/es/Tag/Tag.module.css +10 -10
  238. package/es/Tag/props/defaultProps.js +2 -1
  239. package/es/Tag/props/propTypes.js +2 -1
  240. package/es/TextBox/TextBox.js +26 -10
  241. package/es/TextBox/TextBox.module.css +6 -5
  242. package/es/TextBox/__tests__/TextBox.spec.js +1 -4
  243. package/es/TextBox/props/defaultProps.js +2 -1
  244. package/es/TextBox/props/propTypes.js +2 -1
  245. package/es/TextBoxIcon/TextBoxIcon.js +39 -13
  246. package/es/TextBoxIcon/TextBoxIcon.module.css +7 -6
  247. package/es/TextBoxIcon/__tests__/TextBoxIcon.spec.js +2 -7
  248. package/es/TextBoxIcon/props/defaultProps.js +2 -1
  249. package/es/TextBoxIcon/props/propTypes.js +1 -0
  250. package/es/Textarea/Textarea.js +23 -10
  251. package/es/Textarea/Textarea.module.css +6 -6
  252. package/es/Textarea/__tests__/Textarea.spec.js +2 -2
  253. package/es/Textarea/props/defaultProps.js +2 -1
  254. package/es/Textarea/props/propTypes.js +1 -0
  255. package/es/Tooltip/Tooltip.js +67 -21
  256. package/es/Tooltip/Tooltip.module.css +40 -8
  257. package/es/Tooltip/__tests__/Tooltip.spec.js +5 -0
  258. package/es/VelocityAnimation/VelocityAnimation/VelocityAnimation.js +7 -6
  259. package/es/VelocityAnimation/VelocityAnimationGroup/VelocityAnimationGroup.js +11 -8
  260. package/es/VelocityAnimation/index.js +2 -0
  261. package/es/common/a11y.module.css +4 -0
  262. package/es/common/animation.module.css +8 -8
  263. package/es/common/avatarsizes.module.css +6 -2
  264. package/es/common/basicReset.module.css +3 -3
  265. package/es/common/boxShadow.module.css +34 -0
  266. package/es/common/common.module.css +24 -24
  267. package/es/common/customscroll.module.css +4 -2
  268. package/es/common/reset.module.css +1 -0
  269. package/es/css.js +2 -1
  270. package/es/deprecated/AdvancedMultiSelect.module.css +18 -18
  271. package/es/deprecated/PortalLayer/PortalLayer.js +30 -24
  272. package/es/index.js +30 -146
  273. package/es/semantic/Button/Button.js +9 -7
  274. package/es/semantic/Button/semanticButton.module.css +1 -1
  275. package/es/semantic/index.js +1 -0
  276. package/es/utils/Common.js +74 -7
  277. package/es/utils/ContextOptimizer.js +4 -5
  278. package/es/utils/__tests__/debounce.spec.js +2 -2
  279. package/es/utils/constructFullName.js +2 -0
  280. package/es/utils/css/compileClassNames.js +28 -0
  281. package/es/utils/css/mergeStyle.js +57 -0
  282. package/es/utils/css/utils.js +24 -0
  283. package/es/utils/datetime/GMTZones.js +48 -0
  284. package/es/utils/datetime/common.js +31 -7
  285. package/es/utils/debounce.js +5 -1
  286. package/es/utils/dropDownUtils.js +71 -13
  287. package/es/utils/getInitial.js +4 -0
  288. package/es/utils/index.js +3 -0
  289. package/es/utils/shallowEqual.js +6 -0
  290. package/install.md +10 -0
  291. package/lib/Accordion/Accordion.js +50 -18
  292. package/lib/Accordion/AccordionItem.js +47 -20
  293. package/lib/Accordion/__tests__/Accordion.spec.js +3 -0
  294. package/lib/Accordion/index.js +3 -0
  295. package/lib/Accordion/props/defaultProps.js +6 -2
  296. package/lib/Accordion/props/propTypes.js +6 -0
  297. package/lib/Animation/Animation.js +44 -21
  298. package/lib/Animation/__tests__/Animation.spec.js +11 -7
  299. package/lib/Animation/props/propTypes.js +3 -0
  300. package/lib/AppContainer/AppContainer.js +75 -27
  301. package/lib/AppContainer/AppContainer.module.css +2 -2
  302. package/lib/AppContainer/props/defaultProps.js +3 -1
  303. package/lib/AppContainer/props/propTypes.js +5 -0
  304. package/lib/Avatar/Avatar.js +97 -44
  305. package/lib/Avatar/Avatar.module.css +59 -18
  306. package/lib/Avatar/__tests__/Avatar.spec.js +44 -0
  307. package/lib/Avatar/props/defaultProps.js +4 -1
  308. package/lib/Avatar/props/propTypes.js +8 -2
  309. package/lib/AvatarTeam/AvatarTeam.js +64 -30
  310. package/lib/AvatarTeam/AvatarTeam.module.css +49 -21
  311. package/lib/AvatarTeam/__tests__/AvatarTeam.spec.js +13 -0
  312. package/lib/AvatarTeam/props/defaultProps.js +5 -1
  313. package/lib/AvatarTeam/props/propTypes.js +8 -1
  314. package/lib/Button/Button.js +64 -74
  315. package/{es/Button → lib/Button/css}/Button.module.css +62 -58
  316. package/lib/Button/css/cssJSLogic.js +41 -0
  317. package/lib/Button/index.js +23 -0
  318. package/lib/Button/props/defaultProps.js +5 -1
  319. package/lib/Button/props/propTypes.js +11 -3
  320. package/lib/Buttongroup/Buttongroup.js +49 -19
  321. package/lib/Buttongroup/Buttongroup.module.css +45 -28
  322. package/lib/Buttongroup/__test__/Buttongroup.spec.js +10 -0
  323. package/lib/Buttongroup/props/defaultProps.js +3 -1
  324. package/lib/Buttongroup/props/propTypes.js +6 -1
  325. package/lib/Card/Card.js +119 -55
  326. package/lib/Card/__tests__/Card.spec.js +10 -1
  327. package/lib/Card/index.js +4 -0
  328. package/lib/Card/props/defaultProps.js +16 -4
  329. package/lib/Card/props/propTypes.js +5 -2
  330. package/lib/CheckBox/CheckBox.js +76 -48
  331. package/lib/CheckBox/CheckBox.module.css +16 -16
  332. package/lib/CheckBox/__tests__/CheckBox.spec.js +3 -0
  333. package/lib/CheckBox/props/propTypes.js +4 -0
  334. package/lib/DateTime/CalendarView.js +95 -38
  335. package/lib/DateTime/DateTime.js +309 -216
  336. package/lib/DateTime/DateTime.module.css +51 -48
  337. package/lib/DateTime/DateTimePopupFooter.js +30 -5
  338. package/lib/DateTime/DateTimePopupHeader.js +69 -23
  339. package/lib/DateTime/DateWidget.js +370 -260
  340. package/lib/DateTime/DateWidget.module.css +5 -5
  341. package/lib/DateTime/DaysRow.js +28 -3
  342. package/lib/DateTime/Time.js +72 -29
  343. package/lib/DateTime/YearView.js +89 -30
  344. package/lib/DateTime/YearView.module.css +33 -15
  345. package/lib/DateTime/__tests__/CalendarView.spec.js +13 -5
  346. package/lib/DateTime/__tests__/DateTime.spec.js +51 -37
  347. package/lib/DateTime/__tests__/DateWidget.spec.js +10 -8
  348. package/lib/DateTime/common.js +6 -0
  349. package/lib/DateTime/constants.js +1 -0
  350. package/lib/DateTime/dateFormatUtils/dateFormat.js +184 -122
  351. package/lib/DateTime/dateFormatUtils/dateFormats.js +50 -0
  352. package/lib/DateTime/dateFormatUtils/dayChange.js +14 -7
  353. package/lib/DateTime/dateFormatUtils/index.js +99 -13
  354. package/lib/DateTime/dateFormatUtils/monthChange.js +19 -9
  355. package/lib/DateTime/dateFormatUtils/timeChange.js +52 -20
  356. package/lib/DateTime/dateFormatUtils/yearChange.js +22 -11
  357. package/lib/DateTime/index.js +3 -1
  358. package/lib/DateTime/objectUtils.js +24 -20
  359. package/lib/DateTime/props/defaultProps.js +2 -1
  360. package/lib/DateTime/props/propTypes.js +21 -2
  361. package/lib/DateTime/typeChecker.js +4 -0
  362. package/lib/DateTime/validator.js +69 -6
  363. package/lib/DropBox/DropBox.js +102 -249
  364. package/lib/DropBox/DropBoxElement/DropBoxElement.js +145 -0
  365. package/lib/DropBox/DropBoxElement/css/DropBoxElement.module.css +435 -0
  366. package/lib/DropBox/DropBoxElement/css/cssJSLogic.js +81 -0
  367. package/lib/DropBox/DropBoxElement/props/defaultProps.js +25 -0
  368. package/lib/DropBox/DropBoxElement/props/propTypes.js +56 -0
  369. package/lib/DropBox/DropBoxElement/useDropboxPosCalc.js +60 -0
  370. package/lib/DropBox/__tests__/DropBox.spec.js +8 -4
  371. package/lib/DropBox/css/DropBox.module.css +59 -0
  372. package/lib/DropBox/css/cssJSLogic.js +20 -0
  373. package/lib/DropBox/props/defaultProps.js +20 -17
  374. package/lib/DropBox/props/propTypes.js +22 -43
  375. package/lib/DropDown/DropDown.js +58 -10
  376. package/lib/DropDown/DropDown.module.css +2 -2
  377. package/lib/DropDown/DropDownHeading.js +47 -18
  378. package/lib/DropDown/DropDownHeading.module.css +3 -3
  379. package/lib/DropDown/DropDownItem.js +43 -18
  380. package/lib/DropDown/DropDownItem.module.css +9 -9
  381. package/lib/DropDown/DropDownSearch.js +39 -14
  382. package/lib/DropDown/DropDownSeparator.js +23 -1
  383. package/lib/DropDown/DropDownSeparator.module.css +2 -2
  384. package/lib/DropDown/__tests__/DropDown.spec.js +15 -9
  385. package/lib/DropDown/__tests__/DropDownItem.spec.js +9 -4
  386. package/lib/DropDown/__tests__/DropDownSearch.spec.js +3 -0
  387. package/lib/DropDown/index.js +65 -0
  388. package/lib/DropDown/props/defaultProps.js +3 -1
  389. package/lib/DropDown/props/propTypes.js +7 -1
  390. package/lib/Heading/Heading.js +42 -16
  391. package/lib/Heading/Heading.module.css +2 -2
  392. package/lib/Heading/props/propTypes.js +3 -0
  393. package/lib/Label/Label.js +47 -19
  394. package/lib/Label/Label.module.css +1 -1
  395. package/lib/Label/__tests__/Label.spec.js +14 -1
  396. package/lib/Label/props/defaultProps.js +2 -1
  397. package/lib/Label/props/propTypes.js +4 -0
  398. package/lib/Layout/Box.js +41 -16
  399. package/lib/Layout/Container.js +39 -15
  400. package/lib/Layout/Layout.module.css +15 -15
  401. package/lib/Layout/__tests__/Box.spec.js +65 -49
  402. package/lib/Layout/__tests__/Container.spec.js +67 -50
  403. package/lib/Layout/index.js +4 -11
  404. package/lib/Layout/props/defaultProps.js +6 -2
  405. package/lib/Layout/props/propTypes.js +10 -3
  406. package/lib/Layout/utils.js +15 -1
  407. package/lib/ListItem/ListContainer.js +61 -34
  408. package/lib/ListItem/ListItem.js +92 -50
  409. package/lib/ListItem/ListItem.module.css +37 -30
  410. package/lib/ListItem/ListItemWithAvatar.js +98 -54
  411. package/lib/ListItem/ListItemWithCheckBox.js +82 -41
  412. package/lib/ListItem/ListItemWithIcon.js +92 -50
  413. package/lib/ListItem/ListItemWithRadio.js +83 -42
  414. package/lib/ListItem/index.js +55 -0
  415. package/lib/ListItem/props/defaultProps.js +18 -6
  416. package/lib/ListItem/props/propTypes.js +18 -3
  417. package/lib/Modal/Modal.js +51 -13
  418. package/lib/Modal/props/propTypes.js +3 -0
  419. package/lib/MultiSelect/AdvancedGroupMultiSelect.js +300 -167
  420. package/lib/MultiSelect/AdvancedMultiSelect.js +212 -130
  421. package/lib/MultiSelect/EmptyState.js +48 -21
  422. package/lib/MultiSelect/MultiSelect.js +341 -205
  423. package/lib/MultiSelect/MultiSelect.module.css +32 -31
  424. package/lib/MultiSelect/MultiSelectHeader.js +29 -5
  425. package/lib/MultiSelect/MultiSelectWithAvatar.js +126 -65
  426. package/lib/MultiSelect/SelectedOptions.js +42 -14
  427. package/lib/MultiSelect/SelectedOptions.module.css +5 -5
  428. package/lib/MultiSelect/Suggestions.js +66 -29
  429. package/lib/MultiSelect/__tests__/MultiSelect.spec.js +86 -75
  430. package/lib/MultiSelect/index.js +39 -0
  431. package/lib/MultiSelect/props/defaultProps.js +13 -4
  432. package/lib/MultiSelect/props/propTypes.js +20 -5
  433. package/lib/PopOver/PopOver.js +101 -53
  434. package/lib/PopOver/__tests__/PopOver.spec.js +4 -1
  435. package/lib/PopOver/index.js +31 -0
  436. package/lib/PopOver/props/propTypes.js +3 -0
  437. package/lib/Popup/Popup.js +158 -83
  438. package/lib/Popup/__tests__/Popup.spec.js +42 -5
  439. package/lib/Popup/viewPort.js +28 -14
  440. package/lib/Provider/AvatarSize.js +5 -0
  441. package/lib/Provider/Config.js +2 -0
  442. package/lib/Provider/CssProvider.js +4 -0
  443. package/lib/Provider/IdProvider.js +23 -12
  444. package/lib/Provider/LibraryContext.js +32 -10
  445. package/lib/Provider/LibraryContextInit.js +4 -0
  446. package/lib/Provider/NumberGenerator/NumberGenerator.js +43 -14
  447. package/lib/Provider/ZindexProvider.js +15 -3
  448. package/lib/Provider/index.js +81 -0
  449. package/lib/Radio/Radio.js +65 -40
  450. package/lib/Radio/Radio.module.css +3 -3
  451. package/lib/Radio/__tests__/Radiospec.js +9 -5
  452. package/lib/Radio/props/propTypes.js +3 -0
  453. package/lib/Responsive/CustomResponsive.js +76 -26
  454. package/lib/Responsive/RefWrapper.js +15 -7
  455. package/lib/Responsive/ResizeComponent.js +58 -27
  456. package/lib/Responsive/ResizeObserver.js +23 -6
  457. package/lib/Responsive/Responsive.js +76 -24
  458. package/lib/Responsive/index.js +49 -22
  459. package/lib/Responsive/props/propTypes.js +3 -0
  460. package/lib/Responsive/sizeObservers.js +51 -13
  461. package/lib/Responsive/utils/index.js +11 -3
  462. package/lib/Responsive/utils/shallowCompare.js +11 -2
  463. package/lib/Responsive/windowResizeObserver.js +8 -0
  464. package/lib/ResponsiveDropBox/ResponsiveDropBox.js +44 -14
  465. package/lib/ResponsiveDropBox/ResponsiveDropBox.module.css +2 -2
  466. package/lib/ResponsiveDropBox/props/propTypes.js +3 -0
  467. package/lib/Ribbon/Ribbon.js +48 -21
  468. package/lib/Ribbon/Ribbon.module.css +133 -55
  469. package/lib/Ribbon/__tests__/Ribbon.spec.js +22 -0
  470. package/lib/Ribbon/props/defaultProps.js +2 -1
  471. package/lib/Ribbon/props/propTypes.js +5 -1
  472. package/lib/RippleEffect/RippleEffect.js +23 -14
  473. package/lib/RippleEffect/props/propTypes.js +3 -0
  474. package/lib/Select/GroupSelect.js +240 -137
  475. package/lib/Select/Select.js +320 -220
  476. package/lib/Select/Select.module.css +23 -23
  477. package/lib/Select/SelectWithAvatar.js +112 -59
  478. package/lib/Select/SelectWithIcon.js +145 -82
  479. package/lib/Select/__tests__/Select.spec.js +131 -89
  480. package/lib/Select/index.js +39 -0
  481. package/lib/Select/props/defaultProps.js +10 -2
  482. package/lib/Select/props/propTypes.js +13 -4
  483. package/lib/Stencils/Stencils.js +35 -13
  484. package/lib/Stencils/Stencils.module.css +2 -2
  485. package/lib/Stencils/__tests__/Stencils.spec.js +12 -0
  486. package/lib/Stencils/props/propTypes.js +3 -0
  487. package/lib/Switch/Switch.js +64 -35
  488. package/lib/Switch/Switch.module.css +49 -32
  489. package/lib/Switch/props/defaultProps.js +2 -1
  490. package/lib/Switch/props/propTypes.js +4 -0
  491. package/lib/Tab/Tab.js +49 -33
  492. package/lib/Tab/Tab.module.css +14 -15
  493. package/lib/Tab/TabContent.js +15 -6
  494. package/lib/Tab/TabContentWrapper.js +15 -6
  495. package/lib/Tab/TabWrapper.js +37 -17
  496. package/lib/Tab/Tabs.js +193 -94
  497. package/lib/Tab/Tabs.module.css +36 -40
  498. package/lib/Tab/__tests__/Tab.spec.js +74 -70
  499. package/lib/Tab/__tests__/TabContent.spec.js +10 -6
  500. package/lib/Tab/__tests__/TabContentWrapper.spec.js +28 -20
  501. package/lib/Tab/__tests__/TabWrapper.spec.js +12 -0
  502. package/lib/Tab/__tests__/Tabs.spec.js +53 -39
  503. package/lib/Tab/index.js +6 -0
  504. package/lib/Tab/props/defaultProps.js +10 -5
  505. package/lib/Tab/props/propTypes.js +13 -5
  506. package/lib/Tag/Tag.js +82 -48
  507. package/lib/Tag/Tag.module.css +10 -10
  508. package/lib/Tag/__tests__/Tag.spec.js +14 -8
  509. package/lib/Tag/props/defaultProps.js +2 -1
  510. package/lib/Tag/props/propTypes.js +5 -1
  511. package/lib/TextBox/TextBox.js +93 -61
  512. package/lib/TextBox/TextBox.module.css +6 -5
  513. package/lib/TextBox/__tests__/TextBox.spec.js +14 -4
  514. package/lib/TextBox/props/defaultProps.js +2 -1
  515. package/lib/TextBox/props/propTypes.js +6 -1
  516. package/lib/TextBoxIcon/TextBoxIcon.js +108 -60
  517. package/lib/TextBoxIcon/TextBoxIcon.module.css +7 -6
  518. package/lib/TextBoxIcon/__tests__/TextBoxIcon.spec.js +14 -5
  519. package/lib/TextBoxIcon/props/defaultProps.js +2 -1
  520. package/lib/TextBoxIcon/props/propTypes.js +4 -0
  521. package/lib/Textarea/Textarea.js +63 -32
  522. package/lib/Textarea/Textarea.module.css +6 -6
  523. package/lib/Textarea/__tests__/Textarea.spec.js +14 -2
  524. package/lib/Textarea/props/defaultProps.js +2 -1
  525. package/lib/Textarea/props/propTypes.js +4 -0
  526. package/lib/Tooltip/Tooltip.js +102 -35
  527. package/lib/Tooltip/Tooltip.module.css +40 -8
  528. package/lib/Tooltip/__tests__/Tooltip.spec.js +23 -0
  529. package/lib/Tooltip/props/propTypes.js +3 -0
  530. package/lib/VelocityAnimation/VelocityAnimation/VelocityAnimation.js +43 -17
  531. package/lib/VelocityAnimation/VelocityAnimation/props/propTypes.js +3 -0
  532. package/lib/VelocityAnimation/VelocityAnimationGroup/VelocityAnimationGroup.js +55 -24
  533. package/lib/VelocityAnimation/VelocityAnimationGroup/props/propTypes.js +3 -0
  534. package/lib/VelocityAnimation/index.js +23 -0
  535. package/lib/common/a11y.module.css +4 -0
  536. package/lib/common/animation.module.css +8 -8
  537. package/lib/common/avatarsizes.module.css +6 -2
  538. package/lib/common/basicReset.module.css +3 -3
  539. package/lib/common/boxShadow.module.css +34 -0
  540. package/lib/common/common.module.css +24 -24
  541. package/lib/common/customscroll.module.css +4 -2
  542. package/lib/common/reset.module.css +1 -0
  543. package/lib/css.js +42 -1
  544. package/lib/deprecated/AdvancedMultiSelect.module.css +18 -18
  545. package/lib/deprecated/PortalLayer/PortalLayer.js +50 -24
  546. package/lib/deprecated/PortalLayer/props/propTypes.js +3 -0
  547. package/lib/index.js +214 -210
  548. package/lib/semantic/Button/Button.js +47 -24
  549. package/lib/semantic/Button/props/propTypes.js +3 -0
  550. package/lib/semantic/Button/semanticButton.module.css +1 -1
  551. package/lib/semantic/index.js +15 -0
  552. package/lib/utils/Common.js +136 -17
  553. package/lib/utils/ContextOptimizer.js +16 -10
  554. package/lib/utils/__tests__/constructFullName.spec.js +1 -0
  555. package/lib/utils/__tests__/debounce.spec.js +3 -2
  556. package/lib/utils/__tests__/getInitial.spec.js +1 -0
  557. package/lib/utils/constructFullName.js +11 -2
  558. package/lib/utils/css/compileClassNames.js +37 -0
  559. package/lib/utils/css/mergeStyle.js +69 -0
  560. package/lib/utils/css/utils.js +41 -0
  561. package/lib/utils/datetime/GMTZones.js +55 -0
  562. package/lib/utils/datetime/common.js +52 -7
  563. package/lib/utils/debounce.js +6 -1
  564. package/lib/utils/dropDownUtils.js +177 -56
  565. package/lib/utils/dummyFunction.js +2 -0
  566. package/lib/utils/getHTMLFontSize.js +1 -0
  567. package/lib/utils/getInitial.js +6 -0
  568. package/lib/utils/index.js +121 -0
  569. package/lib/utils/scrollTo.js +2 -0
  570. package/lib/utils/shallowEqual.js +8 -0
  571. package/package.json +61 -26
  572. package/postPublish.js +8 -0
  573. package/prePublish.js +70 -0
  574. package/docs/external/active-line.js +0 -72
  575. package/docs/external/autorefresh.js +0 -47
  576. package/docs/external/codemirror.js +0 -9681
  577. package/docs/external/css/hopscotch.css +0 -576
  578. package/docs/external/css/styleGuide.css +0 -1100
  579. package/docs/external/css.js +0 -466
  580. package/docs/external/designTokens.js +0 -1
  581. package/docs/external/foldcode.js +0 -152
  582. package/docs/external/format.js +0 -129
  583. package/docs/external/htmlmixed.js +0 -84
  584. package/docs/external/images/bottom.png +0 -0
  585. package/docs/external/images/bottombg.jpg +0 -0
  586. package/docs/external/images/desk.png +0 -0
  587. package/docs/external/images/desklogo.png +0 -0
  588. package/docs/external/images/menu.png +0 -0
  589. package/docs/external/index.html +0 -127
  590. package/docs/external/javascript.js +0 -422
  591. package/docs/external/jsx.js +0 -148
  592. package/docs/external/matchbrackets.js +0 -145
  593. package/docs/external/xml.js +0 -322
  594. package/docs/package.json +0 -41
  595. package/docs/src/index.js +0 -1311
  596. package/es/Button/__tests__/Button.spec.js +0 -190
  597. package/es/Button/__tests__/__snapshots__/Button.spec.js.snap +0 -191
  598. package/es/DropBox/DropBox.module.css +0 -406
  599. package/lib/Button/__tests__/Button.spec.js +0 -193
  600. package/lib/Button/__tests__/__snapshots__/Button.spec.js.snap +0 -191
  601. package/lib/DropBox/DropBox.module.css +0 -406
@@ -2,8 +2,8 @@
2
2
  import React from 'react';
3
3
  import { MultiSelect_propTypes } from './props/propTypes';
4
4
  import { MultiSelect_defaultProps } from './props/defaultProps';
5
-
6
5
  /**** Components ****/
6
+
7
7
  import Popup from '../Popup/Popup';
8
8
  import TextBoxIcon from '../TextBoxIcon/TextBoxIcon';
9
9
  import { Container, Box } from '../Layout';
@@ -18,16 +18,18 @@ import ResponsiveDropBox from '../ResponsiveDropBox/ResponsiveDropBox';
18
18
  import { ResponsiveReceiver } from '../Responsive/CustomResponsive';
19
19
  import Loader from '@zohodesk/svg/lib/Loader/Loader';
20
20
  /**** Icons ****/
21
- import Icon from '@zohodesk/icons/lib/Icon';
21
+
22
+ import { Icon } from '@zohodesk/icons';
22
23
  /**** CSS ****/
23
- import style from './MultiSelect.module.css';
24
24
 
25
+ import style from './MultiSelect.module.css';
25
26
  /**** Methods ****/
27
+
26
28
  import { debounce, scrollTo, bind, getIsEmptyValue, getSearchString, findScrollEnd } from '../utils/Common.js';
27
29
  import { makeFormatOptions, makeGetMultiSelectFilterSuggestions as makeGetFilterSuggestions, makeGetMultiSelectSelectedOptions as makeGetSelectedOptions, makeObjectConcat, filterSelectedOptions, makeGetIsShowClearIcon } from '../utils/dropDownUtils';
28
30
  import { getLibraryConfig } from '../Provider/Config';
29
-
30
31
  /* eslint-disable react/forbid-component-props */
32
+
31
33
  /* eslint-disable react/no-unused-prop-types */
32
34
 
33
35
  const dummyArray = [];
@@ -38,9 +40,8 @@ export class MultiSelectComponent extends React.Component {
38
40
  this.getFilterSuggestions = makeGetFilterSuggestions();
39
41
  this.formatOptions = makeFormatOptions();
40
42
  this.getSelectedOptions = makeGetSelectedOptions();
41
- this.getIsShowClearIcon = makeGetIsShowClearIcon();
43
+ this.getIsShowClearIcon = makeGetIsShowClearIcon(); //Use in AdvancedMultiSelect component
42
44
 
43
- //Use in AdvancedMultiSelect component
44
45
  this.objectConcat = makeObjectConcat();
45
46
  this.formatSelectedOptions = makeFormatOptions();
46
47
  const {
@@ -78,11 +79,11 @@ export class MultiSelectComponent extends React.Component {
78
79
  this.handleScroll = this.handleScroll.bind(this);
79
80
  this.handleScrollFuncCall = debounce(this.handleScrollFuncCall.bind(this), 500);
80
81
  }
82
+
81
83
  componentDidMount() {
82
84
  // let { suggestionContainer } = this;
83
85
  this._isMounted = true;
84
- this.handleExposedPublicMethods();
85
- // suggestionContainer &&
86
+ this.handleExposedPublicMethods(); // suggestionContainer &&
86
87
  // suggestionContainer.addEventListener('scroll', this.handleScroll);
87
88
  }
88
89
 
@@ -95,6 +96,7 @@ export class MultiSelectComponent extends React.Component {
95
96
  prefixText
96
97
  } = nextProps;
97
98
  const oldProps = this.props;
99
+
98
100
  if (selectedOptions !== oldProps.selectedOptions || options !== oldProps.options || valueField !== oldProps.valueField || textField !== oldProps.textField || prefixText !== oldProps.prefixText //For GroupMultiSelect component
99
101
  ) {
100
102
  const {
@@ -133,6 +135,7 @@ export class MultiSelectComponent extends React.Component {
133
135
  });
134
136
  }
135
137
  }
138
+
136
139
  componentDidUpdate(prevProps, prevState) {
137
140
  const {
138
141
  suggestionContainer,
@@ -151,11 +154,11 @@ export class MultiSelectComponent extends React.Component {
151
154
  onDropBoxClose,
152
155
  onDropBoxOpen,
153
156
  isSearchClearOnClose
154
- } = this.props;
157
+ } = this.props; //handle dropbox open & close
155
158
 
156
- //handle dropbox open & close
157
159
  if (prevProps.isPopupOpen !== isPopupOpen) {
158
160
  isPopupOpen && onDropBoxOpen && this.handleFetchOptions(onDropBoxOpen, searchStr);
161
+
159
162
  if (!isPopupOpen) {
160
163
  this.setState({
161
164
  hoverOption: 0
@@ -163,41 +166,42 @@ export class MultiSelectComponent extends React.Component {
163
166
  isSearchClearOnClose && searchStr && this.handleSearch('');
164
167
  onDropBoxClose && onDropBoxClose();
165
168
  }
166
- }
169
+ } //scrollTo handling
170
+
167
171
 
168
- //scrollTo handling
169
172
  const hoverId = suggestionsOrder[hoverOption] || '';
170
173
  const selectedSuggestion = this[`suggestion_${hoverId}`];
171
174
  const lastHighLightedSelectOption = highLightedSelectOptions.slice(-1).length ? highLightedSelectOptions.slice(-1)[0] : null;
172
175
  const selectedOption = this[`selectedOption_${lastHighLightedSelectOption}`];
173
176
  isPopupOpen && scrollTo(suggestionContainer, selectedSuggestion);
174
- selectedOptions.length && selectedOption && scrollTo(selectedOptionContainer, selectedOption);
177
+ selectedOptions.length && selectedOption && scrollTo(selectedOptionContainer, selectedOption); //When suggestions length less than 5, getNextOptions function call
175
178
 
176
- //When suggestions length less than 5, getNextOptions function call
177
179
  const {
178
180
  isNextOptions,
179
181
  getNextOptions
180
- } = this.props;
181
- // let { searchStr } = this.state;
182
+ } = this.props; // let { searchStr } = this.state;
183
+
182
184
  const suggestions = this.handleFilterSuggestions();
183
185
  const suggestionsLen = suggestions.length;
186
+
184
187
  if (isPopupOpen && suggestionsLen <= 5 && isNextOptions && getNextOptions && !needLocalSearch) {
185
188
  this.handleFetchOptions(getNextOptions, searchStr);
186
- }
189
+ } //Need To MultiselectNew Component
190
+
187
191
 
188
- //Need To MultiselectNew Component
189
192
  this.handleComponentDidUpdate(prevProps, prevState);
190
193
  }
194
+
191
195
  componentWillUnmount() {
192
196
  // let { suggestionContainer } = this;
193
- this._isMounted = false;
194
- // suggestionContainer &&
197
+ this._isMounted = false; // suggestionContainer &&
195
198
  // suggestionContainer.removeEventListener('scroll', this.handleScroll);
196
199
  }
197
200
 
198
201
  handleComponentDidUpdate() {
199
202
  return;
200
203
  }
204
+
201
205
  handleFormatOptions(props) {
202
206
  const {
203
207
  options,
@@ -215,12 +219,14 @@ export class MultiSelectComponent extends React.Component {
215
219
  disabledOptions
216
220
  });
217
221
  }
222
+
218
223
  handleGetSelectedOptions(selectedOptions, normalizedFormatOptions) {
219
224
  return this.getSelectedOptions({
220
225
  selectedOptions,
221
226
  normalizedFormatOptions
222
227
  });
223
228
  }
229
+
224
230
  handleInputCick(e) {
225
231
  const {
226
232
  removeClose
@@ -229,6 +235,7 @@ export class MultiSelectComponent extends React.Component {
229
235
  highLightedSelectOptions,
230
236
  searchStr = ''
231
237
  } = this.state;
238
+
232
239
  if (highLightedSelectOptions.length) {
233
240
  this.setState({
234
241
  highLightedSelectOptions: [],
@@ -242,6 +249,7 @@ export class MultiSelectComponent extends React.Component {
242
249
  this.togglePopup(e);
243
250
  }
244
251
  }
252
+
245
253
  handleFilterSuggestions() {
246
254
  const {
247
255
  options = dummyArray,
@@ -249,7 +257,8 @@ export class MultiSelectComponent extends React.Component {
249
257
  } = this.state;
250
258
  const {
251
259
  selectedOptions,
252
- needLocalSearch
260
+ needLocalSearch,
261
+ keepSelectedOptions
253
262
  } = this.props;
254
263
  const {
255
264
  suggestions,
@@ -258,11 +267,13 @@ export class MultiSelectComponent extends React.Component {
258
267
  options,
259
268
  selectedOptions,
260
269
  searchStr: getSearchString(searchStr),
261
- needSearch: needLocalSearch
270
+ needSearch: needLocalSearch,
271
+ keepSelectedOptions
262
272
  });
263
273
  this.suggestionsOrder = suggestionIds;
264
274
  return suggestions;
265
275
  }
276
+
266
277
  handleKeyDown(e) {
267
278
  const {
268
279
  keyCode,
@@ -287,20 +298,27 @@ export class MultiSelectComponent extends React.Component {
287
298
  onKeyDown
288
299
  } = this.props;
289
300
  const highLightedSelectOptionsLen = highLightedSelectOptions.length;
301
+
290
302
  if (isPopupOpen && (keyCode === 38 || keyCode === 40 || keyCode === 13 || keyCode === 27 || keyCode === 9)) {
291
303
  suggestions = this.handleFilterSuggestions();
292
304
  }
305
+
293
306
  if (!isPopupOpen && !isPopupOpenOnEnter) {
294
307
  onKeyDown && onKeyDown(e);
295
308
  }
309
+
296
310
  if (!isPopupOpen && keyCode === 40) {
297
311
  //down arrow press popup open
298
312
  e.preventDefault(); //prevent body scroll
313
+
299
314
  this.togglePopup(e);
300
315
  }
316
+
301
317
  const suggestionsLen = suggestions.length;
318
+
302
319
  if (suggestionsLen && isPopupOpen && keyCode === 38) {
303
320
  //up arrow
321
+
304
322
  /*if (hoverOption === 0) { //disable first to last option higlight
305
323
  !isNextOptions && this.setState({ hoverOption: suggestionsLen - 1 });
306
324
  }*/
@@ -311,6 +329,7 @@ export class MultiSelectComponent extends React.Component {
311
329
  }
312
330
  } else if (suggestionsLen && isPopupOpen && keyCode === 40) {
313
331
  //down arrow
332
+
314
333
  /*else if (hoverOption === suggestionsLen - 1 || hoverOption === null) {
315
334
  //disable last to first option higlight
316
335
  !isNextOptions && this.setState({ hoverOption: 0 });
@@ -338,8 +357,7 @@ export class MultiSelectComponent extends React.Component {
338
357
  if (highLightedSelectOptionsLen) {
339
358
  this.handleRemoveOption(highLightedSelectOptions);
340
359
  } else {
341
- this.handleRemoveOption(selectedOptions.slice(-1));
342
- // this.setState({
360
+ this.handleRemoveOption(selectedOptions.slice(-1)); // this.setState({
343
361
  // highLightedSelectOptions: selectedOptions.slice(-1)
344
362
  // });
345
363
  }
@@ -354,6 +372,7 @@ export class MultiSelectComponent extends React.Component {
354
372
  const lastHighLightedSelectOptionIndex = lastHighLightedSelectOption && selectedOptions.indexOf(lastHighLightedSelectOption) >= 0 ? selectedOptions.indexOf(lastHighLightedSelectOption) : 0;
355
373
  const newShiftKeyPressHighLighted = shiftKeyPressHighLighted ? shiftKeyPressHighLighted : shiftKeyPressHighLighted + 1;
356
374
  const newHighLightedSelectOption = lastHighLightedSelectOptionIndex !== null ? selectedOptions[lastHighLightedSelectOptionIndex + newShiftKeyPressHighLighted] : selectedOptions[0];
375
+
357
376
  if (!getIsEmptyValue(newHighLightedSelectOption)) {
358
377
  const newLastHighLightedSelectOption = lastHighLightedSelectOption ? lastHighLightedSelectOption : selectedOptions[0];
359
378
  highLightedSelectOptions = !shiftKeyPressHighLighted ? [newLastHighLightedSelectOption] : highLightedSelectOptions;
@@ -370,6 +389,7 @@ export class MultiSelectComponent extends React.Component {
370
389
  const lastHighLightedSelectOptionIndex = lastHighLightedSelectOption ? selectedOptions.indexOf(lastHighLightedSelectOption) : selectedOptions.length - 1;
371
390
  const newShiftKeyPressHighLighted = shiftKeyPressHighLighted !== 1 ? shiftKeyPressHighLighted : shiftKeyPressHighLighted - 1;
372
391
  const newHighLightedSelectOption = selectedOptions[lastHighLightedSelectOptionIndex + newShiftKeyPressHighLighted - 1];
392
+
373
393
  if (!getIsEmptyValue(newHighLightedSelectOption)) {
374
394
  const newLastHighLightedSelectOption = lastHighLightedSelectOption ? lastHighLightedSelectOption : selectedOptions.slice(-1)[0];
375
395
  highLightedSelectOptions = !shiftKeyPressHighLighted ? [newLastHighLightedSelectOption] : highLightedSelectOptions;
@@ -382,14 +402,15 @@ export class MultiSelectComponent extends React.Component {
382
402
  });
383
403
  }
384
404
  } else if ((keyCode === 39 || keyCode === 37) && selectedOptions.length && !searchStr.length) {
385
- const isRightArrow = keyCode === 39 ? true : false;
386
- // let isLefttArrow = keyCode === 37 ? true : false;
405
+ const isRightArrow = keyCode === 39 ? true : false; // let isLefttArrow = keyCode === 37 ? true : false;
406
+
387
407
  if (highLightedSelectOptions.length) {
388
408
  const [lastHighLightedSelectOption] = highLightedSelectOptions.slice(-1);
389
409
  const lastHighLightedSelectOptionIndex = selectedOptions.indexOf(lastHighLightedSelectOption);
390
410
  const newLastHighLightedSelectOptionIndex = isRightArrow ? lastHighLightedSelectOptionIndex === selectedOptions.length - 1 ? lastHighLightedSelectOptionIndex : lastHighLightedSelectOptionIndex + 1 : lastHighLightedSelectOptionIndex - 1;
391
411
  const newLastHighLightedSelectOption = selectedOptions[newLastHighLightedSelectOptionIndex];
392
412
  const isEmptyHighlighted = isRightArrow && highLightedSelectOptions.length === 1 && selectedOptions.slice(-1)[0] === lastHighLightedSelectOption ? true : false;
413
+
393
414
  if (!getIsEmptyValue(newLastHighLightedSelectOption)) {
394
415
  this.setState({
395
416
  lastHighLightedSelectOption: isEmptyHighlighted ? '' : newLastHighLightedSelectOption,
@@ -405,12 +426,12 @@ export class MultiSelectComponent extends React.Component {
405
426
  shiftKeyPressHighLighted: 0
406
427
  });
407
428
  }
408
- } else if (keyCode === 27) {
409
- // this.handlePopupClose(e);
429
+ } else if (keyCode === 27) {// this.handlePopupClose(e);
410
430
  } else if (keyCode === 9) {
411
431
  this.handlePopupClose(e);
412
432
  }
413
433
  }
434
+
414
435
  handleSelectAll(e) {
415
436
  e && e.preventDefault();
416
437
  const suggestions = this.handleFilterSuggestions();
@@ -422,12 +443,12 @@ export class MultiSelectComponent extends React.Component {
422
443
  const {
423
444
  id
424
445
  } = option;
446
+
425
447
  if (selectedOptions.indexOf(id) === -1) {
426
448
  newSelectedOptions.push(id);
427
449
  }
428
450
  });
429
- this.handleChange([...selectedOptions, ...newSelectedOptions]);
430
- // this.handlePopupClose(e);
451
+ this.handleChange([...selectedOptions, ...newSelectedOptions]); // this.handlePopupClose(e);
431
452
  }
432
453
 
433
454
  handleDeselectAll(e) {
@@ -438,28 +459,40 @@ export class MultiSelectComponent extends React.Component {
438
459
  const {
439
460
  highLightedSelectOptions
440
461
  } = this.state;
462
+
441
463
  if (highLightedSelectOptions.length) {
442
464
  this.setState({
443
465
  highLightedSelectOptions: [],
444
466
  lastHighLightedSelectOption: ''
445
467
  });
446
468
  }
469
+
447
470
  removeClose(e);
448
471
  this.handleChange([]);
449
472
  }
473
+
450
474
  handleSelectOption(option, value, index, e) {
451
475
  const {
452
476
  selectedOptions,
453
- isSearchClearOnSelect
477
+ isSearchClearOnSelect,
478
+ keepSelectedOptions
454
479
  } = this.props;
455
480
  const {
456
481
  searchStr
457
482
  } = this.state;
483
+
458
484
  if (searchStr.trim() != '' && isSearchClearOnSelect) {
459
485
  this.handleSearch('');
460
486
  }
461
- this.handleChange([...selectedOptions, option], e);
462
- // e && e.stopPropagation && this.handlePopupClose(e);
487
+
488
+ if (keepSelectedOptions && selectedOptions.indexOf(option) != -1) {
489
+ let newSelectedOptions = selectedOptions.filter(id => {
490
+ return id != option;
491
+ });
492
+ this.handleChange(newSelectedOptions, e);
493
+ } else {
494
+ this.handleChange([...selectedOptions, option], e);
495
+ }
463
496
  }
464
497
 
465
498
  handleRemoveOption(options) {
@@ -473,18 +506,22 @@ export class MultiSelectComponent extends React.Component {
473
506
  lastHighLightedSelectOption,
474
507
  shiftKeyPressHighLighted
475
508
  } = this.state;
509
+
476
510
  if (newOptions.length && !isReadOnly) {
477
511
  const newSelectedOptions = selectedOptions.filter(option => newOptions.indexOf(option) === -1);
478
512
  const newHighLightedSelectOptions = highLightedSelectOptions.filter(option => newSelectedOptions.indexOf(option) >= 0);
479
513
  let isHighlightedRemoved = false;
480
514
  const newOptionsLen = newOptions.length;
515
+
481
516
  for (let i = 0; i < newOptionsLen; i++) {
482
517
  const removedOption = newOptions[i];
518
+
483
519
  if (highLightedSelectOptions.indexOf(removedOption) >= 0) {
484
520
  isHighlightedRemoved = true;
485
521
  break;
486
522
  }
487
523
  }
524
+
488
525
  this.setState({
489
526
  lastHighLightedSelectOption: newSelectedOptions.indexOf(lastHighLightedSelectOption) >= 0 && !isHighlightedRemoved ? lastHighLightedSelectOption : '',
490
527
  highLightedSelectOptions: isHighlightedRemoved ? [] : newHighLightedSelectOptions,
@@ -492,10 +529,12 @@ export class MultiSelectComponent extends React.Component {
492
529
  });
493
530
  this.handleChange(newSelectedOptions);
494
531
  }
532
+
495
533
  this.searchInput && this.searchInput.focus({
496
534
  preventScroll: true
497
535
  });
498
536
  }
537
+
499
538
  handleMouseEnter(id, val, hoverOptionIndex, e) {
500
539
  e && e.preventDefault();
501
540
  const {
@@ -505,16 +544,19 @@ export class MultiSelectComponent extends React.Component {
505
544
  suggestionsOrder
506
545
  } = this;
507
546
  const newHoverIndex = suggestionsOrder.indexOf(id);
547
+
508
548
  if (newHoverIndex !== hoverOption) {
509
549
  this.setState({
510
550
  hoverOption: newHoverIndex
511
551
  });
512
552
  }
513
553
  }
554
+
514
555
  handleFetchOptions() {
515
556
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
516
557
  args[_key] = arguments[_key];
517
558
  }
559
+
518
560
  const [APICall, searchStr] = args;
519
561
  const {
520
562
  isFetchingOptions
@@ -523,10 +565,12 @@ export class MultiSelectComponent extends React.Component {
523
565
  _isMounted
524
566
  } = this;
525
567
  const isForce = isFetchingOptions && searchStr ? true : false;
568
+
526
569
  if (!isFetchingOptions && APICall || isForce) {
527
570
  this.setState({
528
571
  isFetchingOptions: true
529
572
  });
573
+
530
574
  try {
531
575
  return APICall(searchStr).then(() => {
532
576
  _isMounted && this.setState({
@@ -544,6 +588,7 @@ export class MultiSelectComponent extends React.Component {
544
588
  }
545
589
  }
546
590
  }
591
+
547
592
  handleSearchOptions() {
548
593
  const {
549
594
  onSearch
@@ -553,6 +598,7 @@ export class MultiSelectComponent extends React.Component {
553
598
  } = this.state;
554
599
  searchStr && this.handleFetchOptions(onSearch, searchStr);
555
600
  }
601
+
556
602
  handleSearch(value, e) {
557
603
  const {
558
604
  onSearch,
@@ -575,6 +621,7 @@ export class MultiSelectComponent extends React.Component {
575
621
  }
576
622
  });
577
623
  }
624
+
578
625
  handleClickSelectedOption() {
579
626
  let id = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
580
627
  let e = arguments.length > 1 ? arguments[1] : undefined;
@@ -590,13 +637,16 @@ export class MultiSelectComponent extends React.Component {
590
637
  ctrlKey,
591
638
  shiftKey
592
639
  } = e;
640
+
593
641
  if (e && shiftKey) {
594
642
  //shift+click
595
643
  let from = selectedOptions.indexOf(lastHighLightedSelectOption) >= 0 ? selectedOptions.indexOf(lastHighLightedSelectOption) : 0;
596
644
  let to = id && selectedOptions.indexOf(id) >= 0 ? selectedOptions.indexOf(id) : null;
645
+
597
646
  if (to >= 0 && to < from) {
598
647
  [to] = [from, from = to];
599
648
  }
649
+
600
650
  to += 1;
601
651
  const newSelectedHighlights = to ? selectedOptions.slice(from, to) : [];
602
652
  to && this.setState({
@@ -607,6 +657,7 @@ export class MultiSelectComponent extends React.Component {
607
657
  //ctrl+click
608
658
  const isRemove = highLightedSelectOptions.indexOf(id) >= 0;
609
659
  let newSelectedHighlights = [];
660
+
610
661
  if (isRemove) {
611
662
  lastHighLightedSelectOption = id === lastHighLightedSelectOption ? '' : lastHighLightedSelectOption;
612
663
  newSelectedHighlights = highLightedSelectOptions.filter(option => option !== id);
@@ -614,6 +665,7 @@ export class MultiSelectComponent extends React.Component {
614
665
  lastHighLightedSelectOption = id;
615
666
  newSelectedHighlights = [...highLightedSelectOptions, id];
616
667
  }
668
+
617
669
  this.setState({
618
670
  highLightedSelectOptions: newSelectedHighlights,
619
671
  lastHighLightedSelectOption
@@ -624,6 +676,7 @@ export class MultiSelectComponent extends React.Component {
624
676
  lastHighLightedSelectOption: id
625
677
  });
626
678
  }
679
+
627
680
  this.setState({
628
681
  shiftKeyPressHighLighted: 0
629
682
  });
@@ -631,11 +684,13 @@ export class MultiSelectComponent extends React.Component {
631
684
  preventScroll: true
632
685
  });
633
686
  }
687
+
634
688
  handleScroll(e) {
635
689
  let ele = e.target;
636
690
  let isScrollReachedBottom = findScrollEnd(ele);
637
691
  isScrollReachedBottom && this.handleScrollFuncCall();
638
692
  }
693
+
639
694
  handleScrollFuncCall() {
640
695
  const {
641
696
  getNextOptions,
@@ -646,6 +701,7 @@ export class MultiSelectComponent extends React.Component {
646
701
  } = this.state;
647
702
  isNextOptions && getNextOptions && this.handleFetchOptions(getNextOptions, searchStr);
648
703
  }
704
+
649
705
  handleChange() {
650
706
  let selectedOptions = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
651
707
  let e = arguments.length > 1 ? arguments[1] : undefined;
@@ -668,19 +724,23 @@ export class MultiSelectComponent extends React.Component {
668
724
  });
669
725
  const selectedOptionsLen = newSelectedOptions.length;
670
726
  const allSelectedOptionsDetails = [];
727
+
671
728
  for (let i = 0; i < selectedOptionsLen; i++) {
672
729
  const id = newSelectedOptions[i];
673
730
  allSelectedOptionsDetails.push(optionsNormalize[id]);
674
731
  }
675
- onChange && onChange(newSelectedOptions, allSelectedOptionsDetails);
676
- // this.setState({ searchStr: '' });
732
+
733
+ onChange && onChange(newSelectedOptions, allSelectedOptionsDetails); // this.setState({ searchStr: '' });
734
+
677
735
  this.searchInput && this.searchInput.focus({
678
736
  preventScroll: true
679
737
  });
738
+
680
739
  if (needToCloseOnSelect) {
681
740
  togglePopup(e);
682
741
  }
683
742
  }
743
+
684
744
  togglePopup(e) {
685
745
  const {
686
746
  togglePopup,
@@ -689,12 +749,14 @@ export class MultiSelectComponent extends React.Component {
689
749
  } = this.props;
690
750
  !isReadOnly && togglePopup(e, defaultDropBoxPosition ? `${defaultDropBoxPosition}` : null);
691
751
  }
752
+
692
753
  handlePopupClose(e) {
693
754
  const {
694
755
  closePopupOnly
695
756
  } = this.props;
696
757
  closePopupOnly(e);
697
758
  }
759
+
698
760
  searchInputRef(el) {
699
761
  const {
700
762
  getRef
@@ -702,6 +764,7 @@ export class MultiSelectComponent extends React.Component {
702
764
  this.searchInput = el;
703
765
  getRef && getRef(el);
704
766
  }
767
+
705
768
  selectedOptionContainerRef(el) {
706
769
  const {
707
770
  getTargetRef
@@ -709,25 +772,31 @@ export class MultiSelectComponent extends React.Component {
709
772
  this.selectedOptionContainer = el;
710
773
  getTargetRef(el);
711
774
  }
775
+
712
776
  selectedOptionRef(el, id) {
713
777
  this[`selectedOption_${id}`] = el;
714
778
  }
779
+
715
780
  suggestionContainerRef(el) {
716
781
  this.suggestionContainer = el;
717
782
  }
783
+
718
784
  suggestionItemRef(el, index, id) {
719
785
  this[`suggestion_${id}`] = el;
720
786
  }
787
+
721
788
  handleActive(e) {
722
789
  const {
723
790
  searchStr,
724
791
  isActive
725
792
  } = this.state;
793
+
726
794
  if (!isActive) {
727
795
  this.setState({
728
796
  isActive: true
729
797
  });
730
798
  }
799
+
731
800
  const {
732
801
  target
733
802
  } = e || {};
@@ -737,16 +806,19 @@ export class MultiSelectComponent extends React.Component {
737
806
  } = this.props;
738
807
  onFocus && onFocus(searchStr);
739
808
  }
809
+
740
810
  handleInactive() {
741
811
  const {
742
812
  isActive
743
813
  } = this.state;
814
+
744
815
  if (isActive) {
745
816
  this.setState({
746
817
  isActive: false
747
818
  });
748
819
  }
749
820
  }
821
+
750
822
  handleInputFocus() {
751
823
  const {
752
824
  isDisabled,
@@ -756,6 +828,7 @@ export class MultiSelectComponent extends React.Component {
756
828
  preventScroll: true
757
829
  });
758
830
  }
831
+
759
832
  handleExposedPublicMethods() {
760
833
  const {
761
834
  getPublicMethods,
@@ -765,6 +838,7 @@ export class MultiSelectComponent extends React.Component {
765
838
  openPopupOnly
766
839
  });
767
840
  }
841
+
768
842
  responsiveFunc(_ref) {
769
843
  let {
770
844
  mediaQueryOR
@@ -775,6 +849,7 @@ export class MultiSelectComponent extends React.Component {
775
849
  }])
776
850
  };
777
851
  }
852
+
778
853
  render() {
779
854
  let {
780
855
  isReadOnly,
@@ -800,6 +875,7 @@ export class MultiSelectComponent extends React.Component {
800
875
  title,
801
876
  needResponsive,
802
877
  dataId,
878
+ dataSelectorId,
803
879
  isSearching,
804
880
  borderColor,
805
881
  textBoxClass,
@@ -825,7 +901,8 @@ export class MultiSelectComponent extends React.Component {
825
901
  searchText = 'Searching...'
826
902
  } = i18nKeys;
827
903
  const {
828
- clearLabel = 'Clear all'
904
+ clearLabel = 'Clear all',
905
+ ariaLabelledby
829
906
  } = a11y;
830
907
  i18nKeys = Object.assign({}, i18nKeys, {
831
908
  emptyText: i18nKeys.emptyText || emptyMessage,
@@ -839,7 +916,8 @@ export class MultiSelectComponent extends React.Component {
839
916
  highLightedSelectOptions,
840
917
  options,
841
918
  isFetchingOptions,
842
- isActive
919
+ isActive,
920
+ selectedOptionIds
843
921
  } = this.state;
844
922
  const suggestions = this.handleFilterSuggestions();
845
923
  const setAriaId = this.getNextAriaId();
@@ -854,8 +932,10 @@ export class MultiSelectComponent extends React.Component {
854
932
  return /*#__PURE__*/React.createElement("div", {
855
933
  className: `${style.wrapper} ${isDisabled ? style.disabled : ''} ${isReadOnly ? style.readOnly : ''} ${disableAction ? CssProvider('isBlock') : ''} ${borderColor === 'transparent' ? style.transparentContainer : ''} ${needEffect && !(isDisabled || isReadOnly) ? style.effect : ''}`,
856
934
  "data-id": `${isDisabled ? `${dataId}_disabled` : isReadOnly ? `${dataId}_readOnly` : dataId}`,
935
+ "data-test-id": `${isDisabled ? `${dataId}_disabled` : isReadOnly ? `${dataId}_readOnly` : dataId}`,
857
936
  "data-title": isDisabled ? title : null,
858
- onClick: this.handleInputFocus
937
+ onClick: this.handleInputFocus,
938
+ "data-selector-id": dataSelectorId
859
939
  }, /*#__PURE__*/React.createElement(Container, {
860
940
  align: "vertical",
861
941
  alignBox: "row",
@@ -907,7 +987,8 @@ export class MultiSelectComponent extends React.Component {
907
987
  ariaExpanded: !isReadOnly && !isDisabled && !disableAction && isPopupOpen ? true : false,
908
988
  ariaHaspopup: true,
909
989
  ariaRequired: true,
910
- ariaDescribedby: ariaErrorId
990
+ ariaDescribedby: ariaErrorId,
991
+ ariaLabelledby: ariaLabelledby
911
992
  },
912
993
  autoComplete: autoComplete
913
994
  }, /*#__PURE__*/React.createElement(Container, {
@@ -981,6 +1062,7 @@ export class MultiSelectComponent extends React.Component {
981
1062
  needBorder: false,
982
1063
  dataId: `${dataId}_Options`,
983
1064
  palette: palette,
1065
+ selectedOptions: selectedOptionIds,
984
1066
  a11y: {
985
1067
  role: 'option'
986
1068
  }
@@ -999,15 +1081,16 @@ export class MultiSelectComponent extends React.Component {
999
1081
  }, /*#__PURE__*/React.createElement(Loader, null))), getFooter ? /*#__PURE__*/React.createElement(CardFooter, null, getFooter()) : null)));
1000
1082
  }) : null);
1001
1083
  }
1084
+
1002
1085
  }
1003
1086
  MultiSelectComponent.propTypes = MultiSelect_propTypes;
1004
- MultiSelectComponent.defaultProps = MultiSelect_defaultProps;
1005
- if (false) {
1006
- MultiSelectComponent.docs = {
1007
- componentGroup: 'Form Elements',
1008
- folderName: 'Style Guide'
1009
- };
1010
- }
1087
+ MultiSelectComponent.defaultProps = MultiSelect_defaultProps; // if (__DOCS__) {
1088
+ // MultiSelectComponent.docs = {
1089
+ // componentGroup: 'Form Elements',
1090
+ // folderName: 'Style Guide'
1091
+ // };
1092
+ // }
1093
+
1011
1094
  MultiSelectComponent.displayName = 'MultiSelect';
1012
1095
  const MultiSelect = Popup(MultiSelectComponent);
1013
1096
  MultiSelect.propTypes = MultiSelectComponent.propTypes;