@zohodesk/components 1.0.0-temp-164 → 1.0.0-temp-166

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 (478) hide show
  1. package/README.md +34 -0
  2. package/assets/Appearance/dark/mode/Component_DarkMode.module.css +151 -151
  3. package/assets/Appearance/dark/themes/blue/blue_CTA_DarkModifyCategory.module.css +450 -450
  4. package/assets/Appearance/dark/themes/blue/blue_CTA_DarkTheme.module.css +30 -30
  5. package/assets/Appearance/dark/themes/green/green_CTA_DarkModifyCategory.module.css +450 -450
  6. package/assets/Appearance/dark/themes/green/green_CTA_DarkTheme.module.css +30 -30
  7. package/assets/Appearance/dark/themes/orange/orange_CTA_DarkModifyCategory.module.css +450 -450
  8. package/assets/Appearance/dark/themes/orange/orange_CTA_DarkTheme.module.css +30 -30
  9. package/assets/Appearance/dark/themes/red/red_CTA_DarkModifyCategory.module.css +450 -450
  10. package/assets/Appearance/dark/themes/red/red_CTA_DarkTheme.module.css +30 -30
  11. package/assets/Appearance/dark/themes/yellow/yellow_CTA_DarkModifyCategory.module.css +450 -450
  12. package/assets/Appearance/dark/themes/yellow/yellow_CTA_DarkTheme.module.css +30 -30
  13. package/assets/Appearance/light/mode/Component_LightMode.module.css +148 -148
  14. package/assets/Appearance/light/themes/blue/blue_CTA_LightModifyCategory.module.css +450 -450
  15. package/assets/Appearance/light/themes/blue/blue_CTA_LightTheme.module.css +30 -30
  16. package/assets/Appearance/light/themes/green/green_CTA_LightModifyCategory.module.css +450 -450
  17. package/assets/Appearance/light/themes/green/green_CTA_LightTheme.module.css +30 -30
  18. package/assets/Appearance/light/themes/orange/orange_CTA_LightModifyCategory.module.css +450 -450
  19. package/assets/Appearance/light/themes/orange/orange_CTA_LightTheme.module.css +30 -30
  20. package/assets/Appearance/light/themes/red/red_CTA_LightModifyCategory.module.css +450 -450
  21. package/assets/Appearance/light/themes/red/red_CTA_LightTheme.module.css +30 -30
  22. package/assets/Appearance/light/themes/yellow/yellow_CTA_LightModifyCategory.module.css +450 -450
  23. package/assets/Appearance/light/themes/yellow/yellow_CTA_LightTheme.module.css +30 -30
  24. package/assets/Appearance/pureDark/mode/Component_PureDarkMode.module.css +153 -153
  25. package/assets/Appearance/pureDark/themes/blue/blue_CTA_PureDarkModifyCategory.module.css +450 -450
  26. package/assets/Appearance/pureDark/themes/blue/blue_CTA_PureDarkTheme.module.css +30 -30
  27. package/assets/Appearance/pureDark/themes/green/green_CTA_PureDarkModifyCategory.module.css +450 -450
  28. package/assets/Appearance/pureDark/themes/green/green_CTA_PureDarkTheme.module.css +30 -30
  29. package/assets/Appearance/pureDark/themes/orange/orange_CTA_PureDarkModifyCategory.module.css +450 -450
  30. package/assets/Appearance/pureDark/themes/orange/orange_CTA_PureDarkTheme.module.css +30 -30
  31. package/assets/Appearance/pureDark/themes/red/red_CTA_PureDarkModifyCategory.module.css +450 -450
  32. package/assets/Appearance/pureDark/themes/red/red_CTA_PureDarkTheme.module.css +30 -30
  33. package/assets/Appearance/pureDark/themes/yellow/yellow_CTA_PureDarkModifyCategory.module.css +450 -450
  34. package/assets/Appearance/pureDark/themes/yellow/yellow_CTA_PureDarkTheme.module.css +30 -30
  35. package/es/Accordion/Accordion.js +8 -3
  36. package/es/Accordion/AccordionItem.js +5 -2
  37. package/es/Animation/Animation.js +3 -3
  38. package/es/AppContainer/AppContainer.js +27 -10
  39. package/es/AppContainer/AppContainer.module.css +2 -2
  40. package/es/AppContainer/props/defaultProps.js +2 -1
  41. package/es/AppContainer/props/propTypes.js +1 -0
  42. package/es/Avatar/Avatar.js +26 -11
  43. package/es/Avatar/Avatar.module.css +18 -18
  44. package/es/AvatarTeam/AvatarTeam.js +4 -3
  45. package/es/AvatarTeam/AvatarTeam.module.css +35 -35
  46. package/es/Button/Button.js +5 -3
  47. package/es/Button/css/Button.module.css +70 -70
  48. package/es/Buttongroup/Buttongroup.js +4 -3
  49. package/es/Buttongroup/Buttongroup.module.css +14 -15
  50. package/es/Card/Card.js +21 -10
  51. package/es/CheckBox/CheckBox.js +5 -3
  52. package/es/CheckBox/CheckBox.module.css +15 -15
  53. package/es/DateTime/CalendarView.js +33 -20
  54. package/es/DateTime/DateTime.js +113 -12
  55. package/es/DateTime/DateTime.module.css +39 -39
  56. package/es/DateTime/DateTimePopupFooter.js +4 -2
  57. package/es/DateTime/DateTimePopupHeader.js +8 -2
  58. package/es/DateTime/DateWidget.js +100 -35
  59. package/es/DateTime/DateWidget.module.css +5 -5
  60. package/es/DateTime/DaysRow.js +4 -2
  61. package/es/DateTime/Time.js +10 -2
  62. package/es/DateTime/YearView.js +28 -4
  63. package/es/DateTime/YearView.module.css +15 -15
  64. package/es/DateTime/__tests__/CalendarView.spec.js +1 -0
  65. package/es/DateTime/__tests__/DateTime.spec.js +1 -0
  66. package/es/DateTime/__tests__/DateWidget.spec.js +2 -3
  67. package/es/DateTime/common.js +3 -0
  68. package/es/DateTime/constants.js +1 -0
  69. package/es/DateTime/dateFormatUtils/dateFormat.js +63 -30
  70. package/es/DateTime/dateFormatUtils/dateFormats.js +0 -1
  71. package/es/DateTime/dateFormatUtils/dayChange.js +13 -4
  72. package/es/DateTime/dateFormatUtils/index.js +32 -2
  73. package/es/DateTime/dateFormatUtils/monthChange.js +8 -0
  74. package/es/DateTime/dateFormatUtils/timeChange.js +22 -6
  75. package/es/DateTime/dateFormatUtils/yearChange.js +11 -2
  76. package/es/DateTime/objectUtils.js +14 -20
  77. package/es/DateTime/props/defaultProps.js +2 -1
  78. package/es/DateTime/typeChecker.js +3 -0
  79. package/es/DateTime/validator.js +58 -6
  80. package/es/DropBox/DropBox.js +9 -5
  81. package/es/DropBox/DropBoxElement/DropBoxElement.js +18 -6
  82. package/es/DropBox/DropBoxElement/css/DropBoxElement.module.css +85 -79
  83. package/es/DropBox/DropBoxElement/css/cssJSLogic.js +6 -4
  84. package/es/DropBox/DropBoxElement/props/propTypes.js +1 -1
  85. package/es/DropBox/DropBoxElement/useDropboxPosCalc.js +3 -0
  86. package/es/DropBox/__tests__/DropBox.spec.js +2 -2
  87. package/es/DropBox/css/DropBox.module.css +6 -6
  88. package/es/DropBox/props/defaultProps.js +1 -2
  89. package/es/DropBox/props/propTypes.js +1 -2
  90. package/es/DropDown/DropDown.js +10 -5
  91. package/es/DropDown/DropDown.module.css +2 -2
  92. package/es/DropDown/DropDownHeading.js +5 -5
  93. package/es/DropDown/DropDownHeading.module.css +6 -6
  94. package/es/DropDown/DropDownItem.js +8 -1
  95. package/es/DropDown/DropDownItem.module.css +12 -12
  96. package/es/DropDown/DropDownSearch.js +4 -0
  97. package/es/DropDown/DropDownSearch.module.css +3 -3
  98. package/es/DropDown/DropDownSeparator.js +1 -0
  99. package/es/DropDown/DropDownSeparator.module.css +2 -2
  100. package/es/DropDown/__tests__/DropDown.spec.js +1 -2
  101. package/es/Heading/Heading.js +3 -3
  102. package/es/Heading/Heading.module.css +2 -2
  103. package/es/Label/Label.js +3 -3
  104. package/es/Label/Label.module.css +5 -5
  105. package/es/Layout/Box.js +17 -3
  106. package/es/Layout/Container.js +16 -4
  107. package/es/Layout/Layout.module.css +15 -15
  108. package/es/Layout/index.js +1 -2
  109. package/es/Layout/props/defaultProps.js +2 -0
  110. package/es/Layout/props/propTypes.js +2 -0
  111. package/es/Layout/utils.js +5 -1
  112. package/es/ListItem/ListContainer.js +8 -3
  113. package/es/ListItem/ListItem.js +9 -3
  114. package/es/ListItem/ListItem.module.css +38 -38
  115. package/es/ListItem/ListItemWithAvatar.js +9 -3
  116. package/es/ListItem/ListItemWithCheckBox.js +7 -2
  117. package/es/ListItem/ListItemWithIcon.js +8 -3
  118. package/es/ListItem/ListItemWithRadio.js +7 -3
  119. package/es/Modal/Modal.js +28 -11
  120. package/es/MultiSelect/AdvancedGroupMultiSelect.js +90 -13
  121. package/es/MultiSelect/AdvancedMultiSelect.js +33 -9
  122. package/es/MultiSelect/EmptyState.js +6 -0
  123. package/es/MultiSelect/MultiSelect.js +100 -32
  124. package/es/MultiSelect/MultiSelect.module.css +31 -31
  125. package/es/MultiSelect/MultiSelectHeader.js +3 -0
  126. package/es/MultiSelect/MultiSelectWithAvatar.js +13 -6
  127. package/es/MultiSelect/SelectedOptions.js +6 -3
  128. package/es/MultiSelect/SelectedOptions.module.css +5 -5
  129. package/es/MultiSelect/Suggestions.js +7 -3
  130. package/es/MultiSelect/__tests__/MultiSelect.spec.js +4 -6
  131. package/es/MultiSelect/props/propTypes.js +2 -0
  132. package/es/PopOver/PopOver.js +18 -2
  133. package/es/PopOver/__tests__/PopOver.spec.js +2 -1
  134. package/es/Popup/Popup.js +77 -27
  135. package/es/Popup/__tests__/Popup.spec.js +17 -5
  136. package/es/Popup/viewPort.js +16 -4
  137. package/es/Provider/IdProvider.js +10 -5
  138. package/es/Provider/LibraryContext.js +6 -4
  139. package/es/Provider/NumberGenerator/NumberGenerator.js +21 -7
  140. package/es/Provider/ZindexProvider.js +9 -2
  141. package/es/Radio/Radio.js +4 -2
  142. package/es/Radio/Radio.module.css +9 -9
  143. package/es/Responsive/CustomResponsive.js +30 -18
  144. package/es/Responsive/RefWrapper.js +6 -7
  145. package/es/Responsive/ResizeComponent.js +35 -25
  146. package/es/Responsive/ResizeObserver.js +26 -6
  147. package/es/Responsive/Responsive.js +34 -20
  148. package/es/Responsive/index.js +1 -3
  149. package/es/Responsive/sizeObservers.js +28 -7
  150. package/es/Responsive/utils/index.js +7 -5
  151. package/es/Responsive/utils/shallowCompare.js +7 -2
  152. package/es/Responsive/windowResizeObserver.js +7 -0
  153. package/es/ResponsiveDropBox/ResponsiveDropBox.js +4 -0
  154. package/es/ResponsiveDropBox/ResponsiveDropBox.module.css +2 -2
  155. package/es/Ribbon/Ribbon.js +4 -2
  156. package/es/Ribbon/Ribbon.module.css +46 -48
  157. package/es/RippleEffect/RippleEffect.js +1 -3
  158. package/es/Select/GroupSelect.js +59 -14
  159. package/es/Select/Select.js +81 -34
  160. package/es/Select/Select.module.css +23 -23
  161. package/es/Select/SelectWithAvatar.js +19 -4
  162. package/es/Select/SelectWithIcon.js +48 -6
  163. package/es/Select/__tests__/Select.spec.js +6 -8
  164. package/es/Select/props/propTypes.js +1 -0
  165. package/es/Stencils/Stencils.js +3 -3
  166. package/es/Stencils/Stencils.module.css +11 -11
  167. package/es/Switch/Switch.js +6 -3
  168. package/es/Switch/Switch.module.css +23 -23
  169. package/es/Tab/Tab.js +4 -4
  170. package/es/Tab/Tab.module.css +14 -14
  171. package/es/Tab/TabContent.js +1 -0
  172. package/es/Tab/TabContentWrapper.js +2 -0
  173. package/es/Tab/TabWrapper.js +5 -2
  174. package/es/Tab/Tabs.js +56 -8
  175. package/es/Tab/Tabs.module.css +24 -42
  176. package/es/Tab/__tests__/Tab.spec.js +1 -3
  177. package/es/Tab/__tests__/TabWrapper.spec.js +1 -0
  178. package/es/Tag/Tag.js +7 -3
  179. package/es/Tag/Tag.module.css +25 -25
  180. package/es/TextBox/TextBox.js +16 -3
  181. package/es/TextBox/TextBox.module.css +9 -9
  182. package/es/TextBox/__tests__/TextBox.spec.js +1 -4
  183. package/es/TextBoxIcon/TextBoxIcon.js +9 -2
  184. package/es/TextBoxIcon/TextBoxIcon.module.css +7 -7
  185. package/es/TextBoxIcon/__tests__/TextBoxIcon.spec.js +2 -7
  186. package/es/Textarea/Textarea.js +13 -3
  187. package/es/Textarea/Textarea.module.css +21 -21
  188. package/es/Textarea/__tests__/Textarea.spec.js +2 -2
  189. package/es/Tooltip/Tooltip.js +60 -15
  190. package/es/Tooltip/Tooltip.module.css +5 -5
  191. package/es/Tooltip/__tests__/Tooltip.spec.js +5 -0
  192. package/es/VelocityAnimation/VelocityAnimation/VelocityAnimation.js +3 -2
  193. package/es/VelocityAnimation/VelocityAnimationGroup/VelocityAnimationGroup.js +7 -5
  194. package/es/common/animation.module.css +8 -8
  195. package/es/common/avatarsizes.module.css +16 -16
  196. package/es/common/basicReset.module.css +3 -3
  197. package/es/common/common.module.css +24 -24
  198. package/es/common/customscroll.module.css +2 -2
  199. package/es/deprecated/AdvancedMultiSelect.module.css +18 -18
  200. package/es/deprecated/PortalLayer/PortalLayer.js +25 -20
  201. package/es/semantic/Button/Button.js +4 -2
  202. package/es/semantic/Button/semanticButton.module.css +1 -1
  203. package/es/utils/Common.js +58 -9
  204. package/es/utils/ContextOptimizer.js +4 -5
  205. package/es/utils/__tests__/debounce.spec.js +2 -2
  206. package/es/utils/constructFullName.js +2 -0
  207. package/es/utils/css/compileClassNames.js +5 -0
  208. package/es/utils/css/mergeStyle.js +7 -6
  209. package/es/utils/css/utils.js +1 -0
  210. package/es/utils/datetime/GMTZones.js +48 -0
  211. package/es/utils/datetime/common.js +31 -7
  212. package/es/utils/debounce.js +5 -1
  213. package/es/utils/dropDownUtils.js +68 -11
  214. package/es/utils/getInitial.js +4 -0
  215. package/es/utils/shallowEqual.js +6 -0
  216. package/lib/Accordion/Accordion.js +43 -18
  217. package/lib/Accordion/AccordionItem.js +41 -18
  218. package/lib/Accordion/__tests__/Accordion.spec.js +3 -0
  219. package/lib/Accordion/index.js +3 -0
  220. package/lib/Accordion/props/propTypes.js +3 -0
  221. package/lib/Animation/Animation.js +38 -18
  222. package/lib/Animation/__tests__/Animation.spec.js +11 -7
  223. package/lib/Animation/props/propTypes.js +3 -0
  224. package/lib/AppContainer/AppContainer.js +66 -26
  225. package/lib/AppContainer/AppContainer.module.css +2 -2
  226. package/lib/AppContainer/props/defaultProps.js +2 -1
  227. package/lib/AppContainer/props/propTypes.js +4 -0
  228. package/lib/Avatar/Avatar.js +81 -38
  229. package/lib/Avatar/Avatar.module.css +18 -18
  230. package/lib/Avatar/__tests__/Avatar.spec.js +44 -0
  231. package/lib/Avatar/props/propTypes.js +3 -0
  232. package/lib/AvatarTeam/AvatarTeam.js +53 -30
  233. package/lib/AvatarTeam/AvatarTeam.module.css +35 -35
  234. package/lib/AvatarTeam/__tests__/AvatarTeam.spec.js +13 -0
  235. package/lib/AvatarTeam/props/propTypes.js +3 -0
  236. package/lib/Button/Button.js +32 -20
  237. package/lib/Button/css/Button.module.css +70 -70
  238. package/lib/Button/css/cssJSLogic.js +18 -17
  239. package/lib/Button/index.js +3 -0
  240. package/lib/Button/props/defaultProps.js +2 -0
  241. package/lib/Button/props/propTypes.js +3 -0
  242. package/lib/Buttongroup/Buttongroup.js +33 -12
  243. package/lib/Buttongroup/Buttongroup.module.css +14 -15
  244. package/lib/Buttongroup/__test__/Buttongroup.spec.js +10 -0
  245. package/lib/Buttongroup/props/propTypes.js +3 -0
  246. package/lib/Card/Card.js +102 -46
  247. package/lib/Card/__tests__/Card.spec.js +10 -1
  248. package/lib/Card/index.js +4 -0
  249. package/lib/Card/props/propTypes.js +3 -0
  250. package/lib/CheckBox/CheckBox.js +71 -47
  251. package/lib/CheckBox/CheckBox.module.css +15 -15
  252. package/lib/CheckBox/__tests__/CheckBox.spec.js +3 -0
  253. package/lib/CheckBox/props/propTypes.js +3 -0
  254. package/lib/DateTime/CalendarView.js +83 -42
  255. package/lib/DateTime/DateTime.js +287 -160
  256. package/lib/DateTime/DateTime.module.css +39 -39
  257. package/lib/DateTime/DateTimePopupFooter.js +31 -8
  258. package/lib/DateTime/DateTimePopupHeader.js +48 -17
  259. package/lib/DateTime/DateWidget.js +354 -250
  260. package/lib/DateTime/DateWidget.module.css +5 -5
  261. package/lib/DateTime/DaysRow.js +27 -5
  262. package/lib/DateTime/Time.js +73 -32
  263. package/lib/DateTime/YearView.js +77 -28
  264. package/lib/DateTime/YearView.module.css +15 -15
  265. package/lib/DateTime/__tests__/CalendarView.spec.js +13 -5
  266. package/lib/DateTime/__tests__/DateTime.spec.js +51 -37
  267. package/lib/DateTime/__tests__/DateWidget.spec.js +10 -8
  268. package/lib/DateTime/common.js +6 -0
  269. package/lib/DateTime/constants.js +1 -0
  270. package/lib/DateTime/dateFormatUtils/dateFormat.js +184 -122
  271. package/lib/DateTime/dateFormatUtils/dateFormats.js +0 -1
  272. package/lib/DateTime/dateFormatUtils/dayChange.js +14 -7
  273. package/lib/DateTime/dateFormatUtils/index.js +74 -16
  274. package/lib/DateTime/dateFormatUtils/monthChange.js +19 -9
  275. package/lib/DateTime/dateFormatUtils/timeChange.js +54 -22
  276. package/lib/DateTime/dateFormatUtils/yearChange.js +22 -11
  277. package/lib/DateTime/index.js +2 -0
  278. package/lib/DateTime/objectUtils.js +24 -20
  279. package/lib/DateTime/props/defaultProps.js +2 -1
  280. package/lib/DateTime/props/propTypes.js +11 -1
  281. package/lib/DateTime/typeChecker.js +4 -0
  282. package/lib/DateTime/validator.js +73 -10
  283. package/lib/DropBox/DropBox.js +36 -12
  284. package/lib/DropBox/DropBoxElement/DropBoxElement.js +68 -42
  285. package/lib/DropBox/DropBoxElement/css/DropBoxElement.module.css +85 -79
  286. package/lib/DropBox/DropBoxElement/css/cssJSLogic.js +43 -34
  287. package/lib/DropBox/DropBoxElement/props/propTypes.js +4 -1
  288. package/lib/DropBox/DropBoxElement/useDropboxPosCalc.js +14 -9
  289. package/lib/DropBox/__tests__/DropBox.spec.js +8 -4
  290. package/lib/DropBox/css/DropBox.module.css +6 -6
  291. package/lib/DropBox/css/cssJSLogic.js +3 -1
  292. package/lib/DropBox/props/defaultProps.js +8 -4
  293. package/lib/DropBox/props/propTypes.js +10 -4
  294. package/lib/DropDown/DropDown.js +54 -9
  295. package/lib/DropDown/DropDown.module.css +2 -2
  296. package/lib/DropDown/DropDownHeading.js +40 -20
  297. package/lib/DropDown/DropDownHeading.module.css +6 -6
  298. package/lib/DropDown/DropDownItem.js +44 -21
  299. package/lib/DropDown/DropDownItem.module.css +12 -12
  300. package/lib/DropDown/DropDownSearch.js +40 -17
  301. package/lib/DropDown/DropDownSearch.module.css +3 -3
  302. package/lib/DropDown/DropDownSeparator.js +24 -4
  303. package/lib/DropDown/DropDownSeparator.module.css +2 -2
  304. package/lib/DropDown/__tests__/DropDown.spec.js +15 -9
  305. package/lib/DropDown/__tests__/DropDownItem.spec.js +9 -4
  306. package/lib/DropDown/__tests__/DropDownSearch.spec.js +3 -0
  307. package/lib/DropDown/index.js +9 -0
  308. package/lib/DropDown/props/propTypes.js +6 -4
  309. package/lib/Heading/Heading.js +39 -16
  310. package/lib/Heading/Heading.module.css +2 -2
  311. package/lib/Heading/props/propTypes.js +3 -0
  312. package/lib/Label/Label.js +40 -19
  313. package/lib/Label/Label.module.css +5 -5
  314. package/lib/Label/__tests__/Label.spec.js +14 -1
  315. package/lib/Label/props/propTypes.js +3 -0
  316. package/lib/Layout/Box.js +39 -15
  317. package/lib/Layout/Container.js +37 -14
  318. package/lib/Layout/Layout.module.css +15 -15
  319. package/lib/Layout/__tests__/Box.spec.js +65 -49
  320. package/lib/Layout/__tests__/Container.spec.js +67 -50
  321. package/lib/Layout/index.js +3 -0
  322. package/lib/Layout/props/defaultProps.js +2 -0
  323. package/lib/Layout/props/propTypes.js +5 -0
  324. package/lib/Layout/utils.js +15 -1
  325. package/lib/ListItem/ListContainer.js +48 -27
  326. package/lib/ListItem/ListItem.js +69 -45
  327. package/lib/ListItem/ListItem.module.css +38 -38
  328. package/lib/ListItem/ListItemWithAvatar.js +75 -48
  329. package/lib/ListItem/ListItemWithCheckBox.js +64 -39
  330. package/lib/ListItem/ListItemWithIcon.js +68 -44
  331. package/lib/ListItem/ListItemWithRadio.js +65 -41
  332. package/lib/ListItem/index.js +7 -0
  333. package/lib/ListItem/props/propTypes.js +6 -4
  334. package/lib/Modal/Modal.js +45 -10
  335. package/lib/Modal/props/propTypes.js +3 -0
  336. package/lib/MultiSelect/AdvancedGroupMultiSelect.js +295 -166
  337. package/lib/MultiSelect/AdvancedMultiSelect.js +203 -125
  338. package/lib/MultiSelect/EmptyState.js +49 -24
  339. package/lib/MultiSelect/MultiSelect.js +324 -206
  340. package/lib/MultiSelect/MultiSelect.module.css +31 -31
  341. package/lib/MultiSelect/MultiSelectHeader.js +30 -8
  342. package/lib/MultiSelect/MultiSelectWithAvatar.js +106 -63
  343. package/lib/MultiSelect/SelectedOptions.js +43 -17
  344. package/lib/MultiSelect/SelectedOptions.module.css +5 -5
  345. package/lib/MultiSelect/Suggestions.js +64 -32
  346. package/lib/MultiSelect/__tests__/MultiSelect.spec.js +86 -75
  347. package/lib/MultiSelect/index.js +5 -0
  348. package/lib/MultiSelect/props/defaultProps.js +2 -0
  349. package/lib/MultiSelect/props/propTypes.js +5 -0
  350. package/lib/PopOver/PopOver.js +95 -49
  351. package/lib/PopOver/__tests__/PopOver.spec.js +4 -1
  352. package/lib/PopOver/index.js +4 -0
  353. package/lib/PopOver/props/propTypes.js +3 -0
  354. package/lib/Popup/Popup.js +158 -84
  355. package/lib/Popup/__tests__/Popup.spec.js +43 -8
  356. package/lib/Popup/viewPort.js +28 -14
  357. package/lib/Provider/AvatarSize.js +4 -0
  358. package/lib/Provider/Config.js +2 -0
  359. package/lib/Provider/CssProvider.js +4 -0
  360. package/lib/Provider/IdProvider.js +17 -6
  361. package/lib/Provider/LibraryContext.js +35 -15
  362. package/lib/Provider/LibraryContextInit.js +4 -0
  363. package/lib/Provider/NumberGenerator/NumberGenerator.js +44 -15
  364. package/lib/Provider/ZindexProvider.js +15 -3
  365. package/lib/Provider/index.js +5 -0
  366. package/lib/Radio/Radio.js +61 -38
  367. package/lib/Radio/Radio.module.css +9 -9
  368. package/lib/Radio/__tests__/Radiospec.js +9 -5
  369. package/lib/Radio/props/propTypes.js +3 -0
  370. package/lib/Responsive/CustomResponsive.js +73 -29
  371. package/lib/Responsive/RefWrapper.js +17 -11
  372. package/lib/Responsive/ResizeComponent.js +62 -36
  373. package/lib/Responsive/ResizeObserver.js +24 -10
  374. package/lib/Responsive/Responsive.js +80 -30
  375. package/lib/Responsive/index.js +4 -0
  376. package/lib/Responsive/props/propTypes.js +3 -0
  377. package/lib/Responsive/sizeObservers.js +53 -17
  378. package/lib/Responsive/utils/index.js +11 -3
  379. package/lib/Responsive/utils/shallowCompare.js +11 -2
  380. package/lib/Responsive/windowResizeObserver.js +8 -0
  381. package/lib/ResponsiveDropBox/ResponsiveDropBox.js +45 -17
  382. package/lib/ResponsiveDropBox/ResponsiveDropBox.module.css +2 -2
  383. package/lib/ResponsiveDropBox/props/propTypes.js +3 -0
  384. package/lib/Ribbon/Ribbon.js +34 -13
  385. package/lib/Ribbon/Ribbon.module.css +46 -48
  386. package/lib/Ribbon/__tests__/Ribbon.spec.js +22 -0
  387. package/lib/Ribbon/props/propTypes.js +3 -0
  388. package/lib/RippleEffect/RippleEffect.js +18 -10
  389. package/lib/RippleEffect/props/propTypes.js +3 -0
  390. package/lib/Select/GroupSelect.js +230 -130
  391. package/lib/Select/Select.js +292 -210
  392. package/lib/Select/Select.module.css +23 -23
  393. package/lib/Select/SelectWithAvatar.js +104 -56
  394. package/lib/Select/SelectWithIcon.js +134 -77
  395. package/lib/Select/__tests__/Select.spec.js +133 -91
  396. package/lib/Select/index.js +5 -0
  397. package/lib/Select/props/defaultProps.js +5 -4
  398. package/lib/Select/props/propTypes.js +4 -0
  399. package/lib/Stencils/Stencils.js +29 -10
  400. package/lib/Stencils/Stencils.module.css +11 -11
  401. package/lib/Stencils/__tests__/Stencils.spec.js +12 -0
  402. package/lib/Stencils/props/propTypes.js +3 -0
  403. package/lib/Switch/Switch.js +58 -34
  404. package/lib/Switch/Switch.module.css +23 -23
  405. package/lib/Switch/props/propTypes.js +3 -0
  406. package/lib/Tab/Tab.js +40 -27
  407. package/lib/Tab/Tab.module.css +14 -14
  408. package/lib/Tab/TabContent.js +12 -5
  409. package/lib/Tab/TabContentWrapper.js +13 -6
  410. package/lib/Tab/TabWrapper.js +37 -19
  411. package/lib/Tab/Tabs.js +173 -92
  412. package/lib/Tab/Tabs.module.css +24 -42
  413. package/lib/Tab/__tests__/Tab.spec.js +67 -58
  414. package/lib/Tab/__tests__/TabContent.spec.js +10 -6
  415. package/lib/Tab/__tests__/TabContentWrapper.spec.js +28 -20
  416. package/lib/Tab/__tests__/TabWrapper.spec.js +12 -0
  417. package/lib/Tab/__tests__/Tabs.spec.js +53 -39
  418. package/lib/Tab/index.js +6 -0
  419. package/lib/Tab/props/propTypes.js +3 -0
  420. package/lib/Tag/Tag.js +73 -43
  421. package/lib/Tag/Tag.module.css +25 -25
  422. package/lib/Tag/__tests__/Tag.spec.js +14 -8
  423. package/lib/Tag/props/propTypes.js +3 -0
  424. package/lib/TextBox/TextBox.js +86 -59
  425. package/lib/TextBox/TextBox.module.css +9 -9
  426. package/lib/TextBox/__tests__/TextBox.spec.js +14 -4
  427. package/lib/TextBox/props/propTypes.js +6 -4
  428. package/lib/TextBoxIcon/TextBoxIcon.js +79 -52
  429. package/lib/TextBoxIcon/TextBoxIcon.module.css +7 -7
  430. package/lib/TextBoxIcon/__tests__/TextBoxIcon.spec.js +14 -5
  431. package/lib/TextBoxIcon/props/propTypes.js +3 -0
  432. package/lib/Textarea/Textarea.js +55 -29
  433. package/lib/Textarea/Textarea.module.css +21 -21
  434. package/lib/Textarea/__tests__/Textarea.spec.js +14 -2
  435. package/lib/Textarea/props/propTypes.js +3 -0
  436. package/lib/Tooltip/Tooltip.js +96 -32
  437. package/lib/Tooltip/Tooltip.module.css +5 -5
  438. package/lib/Tooltip/__tests__/Tooltip.spec.js +24 -3
  439. package/lib/Tooltip/props/propTypes.js +3 -0
  440. package/lib/VelocityAnimation/VelocityAnimation/VelocityAnimation.js +40 -16
  441. package/lib/VelocityAnimation/VelocityAnimation/props/propTypes.js +3 -0
  442. package/lib/VelocityAnimation/VelocityAnimationGroup/VelocityAnimationGroup.js +53 -25
  443. package/lib/VelocityAnimation/VelocityAnimationGroup/props/propTypes.js +3 -0
  444. package/lib/VelocityAnimation/index.js +3 -0
  445. package/lib/common/animation.module.css +8 -8
  446. package/lib/common/avatarsizes.module.css +16 -16
  447. package/lib/common/basicReset.module.css +3 -3
  448. package/lib/common/common.module.css +24 -24
  449. package/lib/common/customscroll.module.css +2 -2
  450. package/lib/css.js +40 -0
  451. package/lib/deprecated/AdvancedMultiSelect.module.css +18 -18
  452. package/lib/deprecated/PortalLayer/PortalLayer.js +46 -23
  453. package/lib/deprecated/PortalLayer/props/propTypes.js +3 -0
  454. package/lib/index.js +57 -0
  455. package/lib/semantic/Button/Button.js +43 -22
  456. package/lib/semantic/Button/props/propTypes.js +3 -0
  457. package/lib/semantic/Button/semanticButton.module.css +1 -1
  458. package/lib/semantic/index.js +2 -0
  459. package/lib/utils/Common.js +117 -19
  460. package/lib/utils/ContextOptimizer.js +16 -10
  461. package/lib/utils/__tests__/constructFullName.spec.js +1 -0
  462. package/lib/utils/__tests__/debounce.spec.js +3 -2
  463. package/lib/utils/__tests__/getInitial.spec.js +1 -0
  464. package/lib/utils/constructFullName.js +13 -4
  465. package/lib/utils/css/compileClassNames.js +6 -0
  466. package/lib/utils/css/mergeStyle.js +10 -7
  467. package/lib/utils/css/utils.js +8 -0
  468. package/lib/utils/datetime/GMTZones.js +55 -0
  469. package/lib/utils/datetime/common.js +52 -7
  470. package/lib/utils/debounce.js +6 -1
  471. package/lib/utils/dropDownUtils.js +175 -59
  472. package/lib/utils/dummyFunction.js +2 -0
  473. package/lib/utils/getHTMLFontSize.js +1 -0
  474. package/lib/utils/getInitial.js +6 -0
  475. package/lib/utils/index.js +4 -0
  476. package/lib/utils/scrollTo.js +2 -0
  477. package/lib/utils/shallowEqual.js +8 -0
  478. package/package.json +18 -27
package/es/Popup/Popup.js CHANGED
@@ -1,16 +1,18 @@
1
1
  function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2
+
2
3
  /**** Libraries ****/
3
4
  import React from 'react';
4
5
  import PropTypes from 'prop-types';
5
6
  import hoistStatics from 'hoist-non-react-statics';
6
-
7
7
  /**** Methods ****/
8
+
8
9
  import { debounce, isDescendant, isTextSelected, cancelBubblingEffect } from '../utils/Common.js';
9
10
  import viewPort from './viewPort';
10
11
  import { absolutePositionMapping, rtlAbsolutePositionMapping, rtlFixedPositionMapping } from './PositionMapping.json';
11
12
  import ResizeObserver from '@zohodesk/virtualizer/lib/commons/ResizeObserver.js';
12
13
  let lastOpenedGroup = [];
13
14
  let popups = {};
15
+
14
16
  global.closeGroupPopups = function (groupName) {
15
17
  const groupPopups = popups[groupName] || [];
16
18
  groupPopups.forEach(popup => {
@@ -20,6 +22,7 @@ global.closeGroupPopups = function (groupName) {
20
22
  });
21
23
  });
22
24
  };
25
+
23
26
  const defaultState = {
24
27
  position: 'bottomCenter',
25
28
  height: '0px',
@@ -33,8 +36,8 @@ const defaultState = {
33
36
  //{height: ‘’, width: ‘’,}
34
37
  isAbsolutePositioningNeeded: true
35
38
  };
36
-
37
39
  /* eslint-disable react/no-deprecated */
40
+
38
41
  /* eslint-disable react/prop-types */
39
42
 
40
43
  const Popup = function (Component) {
@@ -47,6 +50,7 @@ const Popup = function (Component) {
47
50
  scrollDebounceTime: popupScrollDebounceTime = 0,
48
51
  closeOnScroll: closeOnScrollPopup = false
49
52
  } = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
53
+
50
54
  class Popup extends React.Component {
51
55
  constructor(props) {
52
56
  super(props);
@@ -87,9 +91,8 @@ const Popup = function (Component) {
87
91
  this.handleDocumentMouseDown = this.handleDocumentMouseDown.bind(this);
88
92
  this.handleDocumentFocus = this.handleDocumentFocus.bind(this);
89
93
  this.handleGetNeedPrevent = this.handleGetNeedPrevent.bind(this);
90
- this.popupObserver = new ResizeObserver(this.handlePopupResize);
94
+ this.popupObserver = new ResizeObserver(this.handlePopupResize); //dropBoxSize
91
95
 
92
- //dropBoxSize
93
96
  this.size = null;
94
97
  this.isAbsolutePopup = isAbsolutePopup;
95
98
  this.needPopupArrow = needPopupArrow;
@@ -101,25 +104,29 @@ const Popup = function (Component) {
101
104
  } = this.getScrollDebounceTime(this);
102
105
  this.handleScroll = debounce(this.handleScroll.bind(this), scrollDebounceTime);
103
106
  }
107
+
104
108
  componentDidMount() {
105
109
  const group = this.getGroup();
106
110
  const groupPopups = popups[group] || [];
107
111
  groupPopups.push(this);
108
112
  popups[group] = groupPopups;
113
+
109
114
  if (Object.keys(popups).length === 1 && groupPopups.length === 1) {
110
115
  document.addEventListener('click', this.documentClickHandler, false);
111
- document.addEventListener('keyup', this.documentKeyupHandler, false);
112
- // document.addEventListener('scroll', this.handleScroll, true);
116
+ document.addEventListener('keyup', this.documentKeyupHandler, false); // document.addEventListener('scroll', this.handleScroll, true);
117
+
113
118
  window.addEventListener('resize', this.handleResize);
114
119
  document.addEventListener('click', this.documentClickHandler1, true);
115
120
  document.addEventListener('mousedown', this.handleDocumentMouseDown, true);
116
121
  document.addEventListener('focus', this.handleDocumentFocus, true);
117
122
  }
118
123
  }
124
+
119
125
  componentWillReceiveProps(nextProps) {
120
126
  const {
121
127
  isPopupOpen
122
128
  } = this.state;
129
+
123
130
  if (typeof nextProps.isPopupOpen !== 'undefined' && nextProps.isPopupOpen !== isPopupOpen) {
124
131
  this.setState({
125
132
  isPopupOpen: nextProps.isPopupOpen,
@@ -127,6 +134,7 @@ const Popup = function (Component) {
127
134
  });
128
135
  }
129
136
  }
137
+
130
138
  componentDidUpdate(prevProps, prevState) {
131
139
  const {
132
140
  isPopupReady
@@ -140,6 +148,7 @@ const Popup = function (Component) {
140
148
  const {
141
149
  needResizeHandling: propResizeHandling
142
150
  } = this.props;
151
+
143
152
  if (oldStateOpen !== isPopupReady) {
144
153
  if (isPopupReady && dropElement && (propResizeHandling !== undefined ? propResizeHandling : needResizeHandling)) {
145
154
  this.popupObserver.replaceObservationElement(dropElement);
@@ -149,6 +158,7 @@ const Popup = function (Component) {
149
158
  }
150
159
  }
151
160
  }
161
+
152
162
  componentWillUnmount() {
153
163
  const group = this.getGroup();
154
164
  popups = Object.keys(popups).reduce((res, groupName) => {
@@ -158,34 +168,40 @@ const Popup = function (Component) {
158
168
  newGroupPopups.length === 0 && lastOpenedGroup.indexOf(group) >= 0 && lastOpenedGroup.splice(lastOpenedGroup.indexOf(group), 1);
159
169
  res[group] = newGroupPopups;
160
170
  }
171
+
161
172
  return res;
162
173
  }, popups);
163
174
  let noPopups = true;
175
+
164
176
  for (const i in popups) {
165
177
  if (popups[i].length >= 1) {
166
178
  noPopups = false;
167
179
  break;
168
180
  }
169
181
  }
182
+
170
183
  if (this.popupObserver) {
171
184
  this.popupObserver.disconnect();
172
185
  }
186
+
173
187
  if (noPopups) {
174
188
  document.removeEventListener('click', this.documentClickHandler);
175
- document.removeEventListener('keyup', this.documentKeyupHandler);
176
- // document.removeEventListener('scroll', this.handleScroll);
189
+ document.removeEventListener('keyup', this.documentKeyupHandler); // document.removeEventListener('scroll', this.handleScroll);
190
+
177
191
  window.removeEventListener('resize', this.handleResize);
178
192
  document.removeEventListener('click', this.documentClickHandler1, true);
179
193
  document.removeEventListener('mousedown', this.handleDocumentMouseDown, true);
180
194
  document.removeEventListener('focus', this.handleDocumentFocus, true);
181
195
  }
182
196
  }
197
+
183
198
  getGroup() {
184
199
  const {
185
200
  popupGroup
186
201
  } = this.props;
187
202
  return popupGroup || group;
188
203
  }
204
+
189
205
  getNeedArrow(popup) {
190
206
  const {
191
207
  isArrow
@@ -195,6 +211,7 @@ const Popup = function (Component) {
195
211
  } = popup;
196
212
  return isArrow !== undefined ? isArrow : needPopupArrow;
197
213
  }
214
+
198
215
  getScrollDebounceTime(popup) {
199
216
  const {
200
217
  scrollDebounceTime
@@ -204,6 +221,7 @@ const Popup = function (Component) {
204
221
  } = popup;
205
222
  return scrollDebounceTime !== undefined ? scrollDebounceTime : popupScrollDebounceTime;
206
223
  }
224
+
207
225
  getCloseOnScrollPopup(popup) {
208
226
  const {
209
227
  closeOnScroll
@@ -213,6 +231,7 @@ const Popup = function (Component) {
213
231
  } = popup;
214
232
  return closeOnScroll !== undefined ? closeOnScroll : closeOnScrollPopup;
215
233
  }
234
+
216
235
  getIsAbsolutePopup(popup) {
217
236
  const {
218
237
  isAbsolutePositioningNeeded
@@ -222,6 +241,7 @@ const Popup = function (Component) {
222
241
  } = popup;
223
242
  return isAbsolutePositioningNeeded !== undefined ? isAbsolutePositioningNeeded : isAbsolutePopup;
224
243
  }
244
+
225
245
  getCustomPositionOrder(popup) {
226
246
  const {
227
247
  customOrder = []
@@ -231,6 +251,7 @@ const Popup = function (Component) {
231
251
  } = popup;
232
252
  return customOrder.length !== 0 ? customOrder : customPositionOrder;
233
253
  }
254
+
234
255
  togglePopup(e, defaultPosition) {
235
256
  const group = this.getGroup();
236
257
  this.removeClose(e);
@@ -248,6 +269,7 @@ const Popup = function (Component) {
248
269
  });
249
270
  }
250
271
  });
272
+
251
273
  if (isPopupOpen) {
252
274
  this.setState({
253
275
  isPopupOpen: false,
@@ -257,18 +279,21 @@ const Popup = function (Component) {
257
279
  this.handlePopupPosition(defaultPosition);
258
280
  }
259
281
  }
282
+
260
283
  openPopupOnly(e, defaultPosition) {
261
284
  const group = this.getGroup();
262
285
  this.removeClose(e);
263
286
  lastOpenedGroup = lastOpenedGroup.indexOf(group) === -1 ? [group, ...lastOpenedGroup] : lastOpenedGroup;
264
287
  this.handlePopupPosition(defaultPosition);
265
288
  }
289
+
266
290
  closePopupOnly(e) {
267
291
  this.removeClose(e);
268
292
  lastOpenedGroup.splice(0, 1);
269
293
  const {
270
294
  isPopupOpen
271
295
  } = this.state;
296
+
272
297
  if (isPopupOpen) {
273
298
  this.setState({
274
299
  isPopupOpen: false,
@@ -276,6 +301,7 @@ const Popup = function (Component) {
276
301
  });
277
302
  }
278
303
  }
304
+
279
305
  handleCloseLastOpenedGroup() {
280
306
  const groupPopups = lastOpenedGroup.length ? popups[lastOpenedGroup[0]] || [] : [];
281
307
  lastOpenedGroup.splice(0, 1);
@@ -286,67 +312,74 @@ const Popup = function (Component) {
286
312
  });
287
313
  });
288
314
  }
315
+
289
316
  handleDocumentMouseDown(e) {
290
317
  const needPrevent = this.handleGetNeedPrevent(e);
318
+
291
319
  if (needPrevent) {
292
320
  this.removeClose(e);
293
321
  }
294
322
  }
323
+
295
324
  handleDocumentFocus(e) {
296
325
  const needPrevent = this.handleGetNeedPrevent(e);
326
+
297
327
  if (needPrevent) {
298
328
  this.removeClose(e);
299
329
  }
300
330
  }
331
+
301
332
  handleGetNeedPrevent(e) {
302
333
  let needPrevent = false;
334
+
303
335
  if (lastOpenedGroup.length > 1) {
304
336
  const {
305
337
  target
306
338
  } = e;
307
339
  const groupPopups = lastOpenedGroup.length ? popups[lastOpenedGroup[0]] : [];
308
- let openedPopup = null;
309
- // eslint-disable-next-line guard-for-in
340
+ let openedPopup = null; // eslint-disable-next-line guard-for-in
341
+
310
342
  for (const i in groupPopups) {
311
343
  const {
312
344
  isPopupOpen
313
345
  } = groupPopups[i].state;
346
+
314
347
  if (isPopupOpen) {
315
348
  openedPopup = groupPopups[i];
316
349
  break;
317
350
  }
318
351
  }
352
+
319
353
  if (openedPopup) {
320
354
  const {
321
355
  dropElement,
322
356
  placeHolderElement
323
357
  } = openedPopup;
324
358
  const isDropBoxChild = isDescendant(dropElement, target);
325
- const isTargetChild = isDescendant(placeHolderElement, target);
326
- // const massUpdateParent = document.querySelector(
327
- // '[data-id=massUpdatePopup]'
328
- // );
329
- // const isPopupMassUpdateChild = isDescendant(
359
+ const isTargetChild = isDescendant(placeHolderElement, target); // const isPopupMassUpdateChild = isDescendant(
330
360
  // massUpdateParent,
331
361
  // dropElement
332
362
  // );
333
363
 
334
- if (!isDropBoxChild && !isTargetChild
335
- // && isPopupMassUpdateChild
364
+ if (!isDropBoxChild && !isTargetChild // && isPopupMassUpdateChild
336
365
  ) {
337
366
  needPrevent = true;
338
367
  }
339
368
  }
340
369
  }
370
+
341
371
  return needPrevent;
342
372
  }
373
+
343
374
  documentClickHandler1(e) {
344
375
  const needPrevent = this.handleGetNeedPrevent(e);
376
+
345
377
  if (needPrevent) {
346
378
  this.removeClose(e);
347
379
  this.handleCloseLastOpenedGroup();
348
380
  }
349
381
  }
382
+
350
383
  documentClickHandler() {
351
384
  try {
352
385
  Object.keys(popups).forEach(groupName => {
@@ -359,25 +392,26 @@ const Popup = function (Component) {
359
392
  });
360
393
  });
361
394
  lastOpenedGroup = [];
362
- } catch (e) {
363
- // eslint-disable-next-line no-console
395
+ } catch (e) {// eslint-disable-next-line no-console
364
396
  //console.error('popup component not unmounted properly', e);
365
397
  }
366
398
  }
399
+
367
400
  documentKeyupHandler(e) {
368
401
  try {
369
402
  if (e.keyCode === 27) {
370
403
  this.handleCloseLastOpenedGroup();
371
404
  }
372
- } catch (e) {
373
- // eslint-disable-next-line no-console
405
+ } catch (e) {// eslint-disable-next-line no-console
374
406
  //console.log('error', e);
375
407
  }
376
408
  }
409
+
377
410
  removeClose(e) {
378
411
  // e && e.preventDefault && e.preventDefault();
379
412
  cancelBubblingEffect(e);
380
413
  }
414
+
381
415
  handlePopupPosition() {
382
416
  let defaultPosition = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'bottomCenter';
383
417
  let isResizeHandling = arguments.length > 1 ? arguments[1] : undefined;
@@ -392,11 +426,13 @@ const Popup = function (Component) {
392
426
  const needArrow = this.getNeedArrow(this);
393
427
  const isAbsolute = this.getIsAbsolutePopup(this);
394
428
  const customOrder = this.getCustomPositionOrder(this);
429
+
395
430
  if (direction === 'rtl') {
396
431
  defaultPosition = isAbsolute ? rtlAbsolutePositionMapping[defaultPosition] : rtlFixedPositionMapping[defaultPosition];
397
432
  } else {
398
433
  defaultPosition = isAbsolute ? absolutePositionMapping[defaultPosition] : defaultPosition;
399
434
  }
435
+
400
436
  if (!placeHolderElement && !dropElement) {
401
437
  this.setState({
402
438
  isPopupOpen: true,
@@ -404,6 +440,7 @@ const Popup = function (Component) {
404
440
  });
405
441
  return;
406
442
  }
443
+
407
444
  const setPosition = () => {
408
445
  requestAnimationFrame(() => {
409
446
  const {
@@ -427,6 +464,7 @@ const Popup = function (Component) {
427
464
  targetOffset,
428
465
  popupOffset
429
466
  } = betterPosition || {};
467
+
430
468
  if (position !== view || !isPopupReady) {
431
469
  this.setState({
432
470
  isPopupReady: true,
@@ -440,6 +478,7 @@ const Popup = function (Component) {
440
478
  }
441
479
  });
442
480
  };
481
+
443
482
  if (isResizeHandling) {
444
483
  setPosition();
445
484
  } else {
@@ -450,6 +489,7 @@ const Popup = function (Component) {
450
489
  }, setPosition);
451
490
  }
452
491
  }
492
+
453
493
  handleOpenPopupPositionChange() {
454
494
  Object.keys(popups).forEach(groupName => {
455
495
  const groupPopups = popups[groupName] || [];
@@ -464,6 +504,7 @@ const Popup = function (Component) {
464
504
  position,
465
505
  positionsOffset = {}
466
506
  } = popup.state;
507
+
467
508
  if (placeHolderElement && dropElement) {
468
509
  const scrollContainer = placeHolderElement.closest('[data-scroll=true]') || document.body;
469
510
  requestAnimationFrame(() => {
@@ -490,9 +531,7 @@ const Popup = function (Component) {
490
531
  left = '',
491
532
  top = ''
492
533
  } = viewsOffset[view] || {};
493
- const changeState = isAbsolute ? position !== view : oldLeft !== left || oldTop !== top;
494
-
495
- // let isInViewPort = viewPort.isInViewPort(
534
+ const changeState = isAbsolute ? position !== view : oldLeft !== left || oldTop !== top; // let isInViewPort = viewPort.isInViewPort(
496
535
  // placeHolderElement,
497
536
  // scrollContainer
498
537
  // );
@@ -506,9 +545,7 @@ const Popup = function (Component) {
506
545
  popupOffset,
507
546
  isAbsolutePositioningNeeded: isAbsolute
508
547
  });
509
- }
510
-
511
- // if (!isInViewPort && !isAbsolute) {
548
+ } // if (!isInViewPort && !isAbsolute) {
512
549
  // popup.setState({ isPopupOpen: false, isPopupReady: false });
513
550
  // } else if (view && changeState) {
514
551
  // popup.setState({
@@ -520,6 +557,7 @@ const Popup = function (Component) {
520
557
  // isAbsolutePositioningNeeded: isAbsolute
521
558
  // });
522
559
  // }
560
+
523
561
  });
524
562
  }
525
563
  }
@@ -530,6 +568,7 @@ const Popup = function (Component) {
530
568
  handleResize() {
531
569
  this.handleOpenPopupPositionChange();
532
570
  }
571
+
533
572
  handleScroll(e) {
534
573
  // this.handleOpenPopupPositionChange();
535
574
  const {
@@ -538,14 +577,17 @@ const Popup = function (Component) {
538
577
  const {
539
578
  isPopupReady
540
579
  } = this.state;
580
+
541
581
  if (isPopupReady) {
542
582
  console.log('onscrollPopupREady');
543
583
  }
584
+
544
585
  if (isPopupReady && closeOnScroll) {
545
586
  console.log(this, 'handle Scroll');
546
587
  this.togglePopup(e);
547
588
  }
548
589
  }
590
+
549
591
  handlePopupResize(popupSize) {
550
592
  const {
551
593
  height,
@@ -559,17 +601,22 @@ const Popup = function (Component) {
559
601
  isPopupReady,
560
602
  position
561
603
  } = this.state;
604
+
562
605
  if (isPopupReady && this.size && (oldHeight !== height || width !== oldWidth)) {
563
606
  this.handlePopupPosition(position, true);
564
607
  }
608
+
565
609
  this.size = popupSize;
566
610
  }
611
+
567
612
  getTargetRef(el) {
568
613
  this.placeHolderElement = el;
569
614
  }
615
+
570
616
  getContainerRef(el) {
571
617
  this.dropElement = el;
572
618
  }
619
+
573
620
  render() {
574
621
  const {
575
622
  isPopupReady,
@@ -585,11 +632,14 @@ const Popup = function (Component) {
585
632
  getContainerRef: this.getContainerRef
586
633
  }));
587
634
  }
635
+
588
636
  }
637
+
589
638
  Popup.displayName = Component.displayName || Component.name || Popup.name;
590
639
  Popup.contextTypes = {
591
640
  direction: PropTypes.string
592
641
  };
593
642
  return hoistStatics(Popup, Component);
594
643
  };
644
+
595
645
  export default Popup;
@@ -1,22 +1,29 @@
1
1
  /* eslint-disable no-undef */
2
+
2
3
  /**** Libraries ****/
3
4
  import React from 'react';
4
5
  import ReactDOM from 'react-dom';
5
6
  import PropTypes from 'prop-types';
6
7
  /**** Components ****/
8
+
7
9
  import Popup from '../Popup';
10
+
8
11
  class SamplePopup extends React.Component {
9
12
  constructor(props) {
10
13
  super(props);
11
14
  }
15
+
12
16
  render() {
13
17
  return /*#__PURE__*/React.createElement("div", null, "Sample Popup");
14
18
  }
19
+
15
20
  }
21
+
16
22
  class SamplePopupCopy extends React.Component {
17
23
  constructor(props) {
18
24
  super(props);
19
25
  }
26
+
20
27
  render() {
21
28
  return /*#__PURE__*/React.createElement("div", {
22
29
  "data-id": "samplePopup",
@@ -25,26 +32,33 @@ class SamplePopupCopy extends React.Component {
25
32
  }
26
33
  }, "Sample Popup");
27
34
  }
35
+
28
36
  }
37
+
29
38
  SamplePopupCopy.propTypes = {
30
39
  removeClose: PropTypes.func
31
40
  };
41
+
32
42
  class SamplePopupCopy1 extends React.Component {
33
43
  constructor(props) {
34
44
  super(props);
35
45
  }
46
+
36
47
  render() {
37
48
  return /*#__PURE__*/React.createElement("div", {
38
49
  "data-id": "samplePopup"
39
50
  }, "Sample Popup");
40
51
  }
52
+
41
53
  }
54
+
42
55
  describe('Popup component conditions', () => {
43
56
  it('should click same popup with removeClose', () => {
44
57
  let PopupWrapperComponent = Popup(SamplePopupCopy);
45
58
  let div = document.createElement('div');
46
59
  document.body.append(div);
47
60
  /*eslint-disable */
61
+
48
62
  let popupDom = ReactDOM.render( /*#__PURE__*/React.createElement(PopupWrapperComponent, null), div);
49
63
  /*eslint-enable */
50
64
 
@@ -87,6 +101,7 @@ describe('Popup component conditions', () => {
87
101
  let div = document.createElement('div');
88
102
  document.body.append(div);
89
103
  /*eslint-disable */
104
+
90
105
  let popupDom = ReactDOM.render( /*#__PURE__*/React.createElement(PopupWrapperComponent, null), div);
91
106
  /*eslint-enable */
92
107
 
@@ -108,15 +123,12 @@ describe('Popup component conditions', () => {
108
123
  let PopupWrapperComponent = Popup(SamplePopupCopy1);
109
124
  let popupDom = TestUtils.renderIntoDocument( /*#__PURE__*/React.createElement(PopupWrapperComponent, null));
110
125
  popupDom.togglePopup();
111
- expect(popupDom.state.isPopupOpen).toBeTruthy();
126
+ expect(popupDom.state.isPopupOpen).toBeTruthy(); //TestUtils.Simulate.keyUp(document, {keyCode:27});
112
127
 
113
- //TestUtils.Simulate.keyUp(document, {keyCode:27});
114
128
  let e = document.createEvent('HTMLEvents');
115
129
  e.initEvent('keyup', false, true);
116
130
  e.keyCode = 27;
117
131
  document.dispatchEvent(e);
118
132
  expect(popupDom.state.isPopupOpen).toBeFalsy();
119
133
  });
120
- });
121
-
122
- //Group Popup Handling Open and close
134
+ }); //Group Popup Handling Open and close
@@ -4,6 +4,7 @@ let viewPort = {
4
4
  if (!el) {
5
5
  return;
6
6
  }
7
+
7
8
  let rectTemp = el.getBoundingClientRect();
8
9
  let rect = {
9
10
  height: rectTemp.height || el.clientHeight,
@@ -26,9 +27,11 @@ let viewPort = {
26
27
  x: 0,
27
28
  y: 0
28
29
  };
30
+
29
31
  if (customFrame) {
30
32
  customFrameRect = customFrame.getBoundingClientRect();
31
33
  }
34
+
32
35
  let newRect = {
33
36
  top: rect.top - customFrameRect.top,
34
37
  left: rect.left - customFrameRect.left,
@@ -61,6 +64,7 @@ let viewPort = {
61
64
  if (!el) {
62
65
  return;
63
66
  }
67
+
64
68
  let elRects = viewPort.frameRelativeRects(el, customFrame);
65
69
  let {
66
70
  rect
@@ -78,9 +82,11 @@ let viewPort = {
78
82
  needArrow,
79
83
  isAbsolute
80
84
  } = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
85
+
81
86
  if (!el) {
82
87
  return;
83
88
  }
89
+
84
90
  let elViewPortEle = viewPort.getViewPortEle(el);
85
91
  let elRects = viewPort.frameRelativeRects(el, customFrame, elViewPortEle);
86
92
  let {
@@ -95,13 +101,12 @@ let viewPort = {
95
101
  let relativeBoxDocumentRects = viewPort.frameRelativeRects(relativeBox, customFrame);
96
102
  let {
97
103
  rectGap: documentGap
98
- } = relativeBoxDocumentRects;
99
-
100
- //rect => PopOverContainer, relativeBoxGap => PopOverTarget
101
-
104
+ } = relativeBoxDocumentRects; //rect => PopOverContainer, relativeBoxGap => PopOverTarget
102
105
  //Horizontal ~ ----- X axis
103
106
  //Vertical ~ ||||||| Y axis
107
+
104
108
  let paddingSpace = 5; // space between target and relative element
109
+
105
110
  let arrowSize = needArrow ? 10 : 0;
106
111
  rect.height = rect.height + (needArrow ? arrowSize : paddingSpace);
107
112
  rect.width = rect.width + (needArrow ? arrowSize : paddingSpace);
@@ -284,6 +289,7 @@ let viewPort = {
284
289
  if (!el) {
285
290
  return;
286
291
  }
292
+
287
293
  let elRects = viewPort.frameRelativeRects(el, customFrame);
288
294
  let {
289
295
  rectGap
@@ -310,9 +316,11 @@ let viewPort = {
310
316
  needArrow,
311
317
  isAbsolute
312
318
  });
319
+
313
320
  if (!viewPortPossibilities) {
314
321
  return;
315
322
  }
323
+
316
324
  let {
317
325
  views,
318
326
  viewsOffset,
@@ -321,10 +329,12 @@ let viewPort = {
321
329
  } = viewPortPossibilities;
322
330
  let view = null;
323
331
  let isViewFound = false;
332
+
324
333
  if (!isViewFound && defaultView && views[defaultView]) {
325
334
  view = defaultView;
326
335
  isViewFound = true;
327
336
  }
337
+
328
338
  if (!isViewFound) {
329
339
  if (customOrder.length > 0) {
330
340
  isViewFound = customOrder.some(position => {
@@ -342,9 +352,11 @@ let viewPort = {
342
352
  });
343
353
  }
344
354
  }
355
+
345
356
  if (!isViewFound) {
346
357
  view = defaultView;
347
358
  }
359
+
348
360
  return {
349
361
  view,
350
362
  views,