@zohodesk/components 1.0.0-alpha-269 → 1.0.0-alpha-271

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 (434) hide show
  1. package/README.md +16 -0
  2. package/es/Accordion/Accordion.js +3 -7
  3. package/es/Accordion/AccordionItem.js +2 -4
  4. package/es/Animation/Animation.js +3 -3
  5. package/es/AppContainer/AppContainer.js +5 -13
  6. package/es/AppContainer/AppContainer.module.css +2 -2
  7. package/es/Avatar/Avatar.js +11 -23
  8. package/es/Avatar/Avatar.module.css +18 -18
  9. package/es/AvatarTeam/AvatarTeam.js +3 -3
  10. package/es/AvatarTeam/AvatarTeam.module.css +35 -35
  11. package/es/Button/Button.js +3 -4
  12. package/es/Button/css/Button.module.css +70 -70
  13. package/es/Buttongroup/Buttongroup.js +3 -3
  14. package/es/Buttongroup/Buttongroup.module.css +15 -14
  15. package/es/Card/Card.js +10 -21
  16. package/es/CheckBox/CheckBox.js +3 -5
  17. package/es/CheckBox/CheckBox.module.css +15 -15
  18. package/es/DateTime/CalendarView.js +20 -32
  19. package/es/DateTime/DateTime.js +6 -67
  20. package/es/DateTime/DateTime.module.css +39 -39
  21. package/es/DateTime/DateTimePopupFooter.js +2 -4
  22. package/es/DateTime/DateTimePopupHeader.js +2 -8
  23. package/es/DateTime/DateWidget.js +35 -98
  24. package/es/DateTime/DateWidget.module.css +5 -5
  25. package/es/DateTime/DaysRow.js +2 -4
  26. package/es/DateTime/Time.js +2 -10
  27. package/es/DateTime/YearView.js +4 -28
  28. package/es/DateTime/YearView.module.css +15 -15
  29. package/es/DateTime/__tests__/CalendarView.spec.js +0 -1
  30. package/es/DateTime/__tests__/DateTime.spec.js +0 -1
  31. package/es/DateTime/__tests__/DateWidget.spec.js +3 -2
  32. package/es/DateTime/common.js +0 -3
  33. package/es/DateTime/constants.js +0 -1
  34. package/es/DateTime/dateFormatUtils/dateFormat.js +30 -63
  35. package/es/DateTime/dateFormatUtils/dateFormats.js +1 -0
  36. package/es/DateTime/dateFormatUtils/dayChange.js +4 -13
  37. package/es/DateTime/dateFormatUtils/index.js +2 -32
  38. package/es/DateTime/dateFormatUtils/monthChange.js +0 -8
  39. package/es/DateTime/dateFormatUtils/timeChange.js +6 -22
  40. package/es/DateTime/dateFormatUtils/yearChange.js +2 -11
  41. package/es/DateTime/objectUtils.js +20 -14
  42. package/es/DateTime/typeChecker.js +0 -3
  43. package/es/DateTime/validator.js +6 -58
  44. package/es/DropBox/DropBox.js +5 -9
  45. package/es/DropBox/DropBoxElement/DropBoxElement.js +8 -13
  46. package/es/DropBox/DropBoxElement/css/DropBoxElement.module.css +85 -79
  47. package/es/DropBox/DropBoxElement/css/cssJSLogic.js +5 -7
  48. package/es/DropBox/DropBoxElement/props/propTypes.js +1 -1
  49. package/es/DropBox/DropBoxElement/useDropboxPosCalc.js +0 -3
  50. package/es/DropBox/__tests__/DropBox.spec.js +2 -2
  51. package/es/DropBox/css/DropBox.module.css +6 -6
  52. package/es/DropBox/props/defaultProps.js +2 -1
  53. package/es/DropBox/props/propTypes.js +2 -1
  54. package/es/DropDown/DropDown.js +4 -8
  55. package/es/DropDown/DropDown.module.css +2 -2
  56. package/es/DropDown/DropDownHeading.js +5 -4
  57. package/es/DropDown/DropDownHeading.module.css +6 -6
  58. package/es/DropDown/DropDownItem.js +0 -6
  59. package/es/DropDown/DropDownItem.module.css +12 -12
  60. package/es/DropDown/DropDownSearch.js +0 -4
  61. package/es/DropDown/DropDownSearch.module.css +3 -3
  62. package/es/DropDown/DropDownSeparator.js +0 -1
  63. package/es/DropDown/DropDownSeparator.module.css +2 -2
  64. package/es/DropDown/__tests__/DropDown.spec.js +2 -1
  65. package/es/Heading/Heading.js +3 -2
  66. package/es/Heading/Heading.module.css +2 -2
  67. package/es/Label/Label.js +3 -2
  68. package/es/Label/Label.module.css +5 -5
  69. package/es/Layout/Box.js +0 -13
  70. package/es/Layout/Container.js +1 -12
  71. package/es/Layout/Layout.module.css +15 -15
  72. package/es/Layout/index.js +2 -1
  73. package/es/ListItem/ListContainer.js +3 -8
  74. package/es/ListItem/ListItem.js +3 -9
  75. package/es/ListItem/ListItem.module.css +38 -38
  76. package/es/ListItem/ListItemWithAvatar.js +3 -9
  77. package/es/ListItem/ListItemWithCheckBox.js +2 -7
  78. package/es/ListItem/ListItemWithIcon.js +3 -8
  79. package/es/ListItem/ListItemWithRadio.js +3 -7
  80. package/es/Modal/Modal.js +11 -28
  81. package/es/MultiSelect/AdvancedGroupMultiSelect.js +13 -89
  82. package/es/MultiSelect/AdvancedMultiSelect.js +9 -32
  83. package/es/MultiSelect/EmptyState.js +0 -2
  84. package/es/MultiSelect/MultiSelect.js +32 -99
  85. package/es/MultiSelect/MultiSelect.module.css +31 -31
  86. package/es/MultiSelect/MultiSelectHeader.js +0 -3
  87. package/es/MultiSelect/MultiSelectWithAvatar.js +6 -12
  88. package/es/MultiSelect/SelectedOptions.js +3 -6
  89. package/es/MultiSelect/SelectedOptions.module.css +5 -5
  90. package/es/MultiSelect/Suggestions.js +3 -7
  91. package/es/MultiSelect/__tests__/MultiSelect.spec.js +6 -4
  92. package/es/MultiSelect/props/propTypes.js +0 -2
  93. package/es/PopOver/PopOver.js +2 -18
  94. package/es/PopOver/__tests__/PopOver.spec.js +1 -2
  95. package/es/Popup/Popup.js +24 -77
  96. package/es/Popup/__tests__/Popup.spec.js +5 -17
  97. package/es/Popup/viewPort.js +4 -16
  98. package/es/Provider/IdProvider.js +5 -10
  99. package/es/Provider/LibraryContext.js +4 -6
  100. package/es/Provider/NumberGenerator/NumberGenerator.js +7 -21
  101. package/es/Provider/ZindexProvider.js +2 -9
  102. package/es/Radio/Radio.js +2 -4
  103. package/es/Radio/Radio.module.css +9 -9
  104. package/es/Responsive/CustomResponsive.js +18 -30
  105. package/es/Responsive/RefWrapper.js +7 -6
  106. package/es/Responsive/ResizeComponent.js +25 -35
  107. package/es/Responsive/ResizeObserver.js +6 -26
  108. package/es/Responsive/Responsive.js +20 -34
  109. package/es/Responsive/index.js +3 -1
  110. package/es/Responsive/sizeObservers.js +7 -28
  111. package/es/Responsive/utils/index.js +5 -7
  112. package/es/Responsive/utils/shallowCompare.js +2 -7
  113. package/es/Responsive/windowResizeObserver.js +0 -7
  114. package/es/ResponsiveDropBox/ResponsiveDropBox.js +0 -4
  115. package/es/ResponsiveDropBox/ResponsiveDropBox.module.css +2 -2
  116. package/es/Ribbon/Ribbon.js +2 -3
  117. package/es/Ribbon/Ribbon.module.css +48 -46
  118. package/es/RippleEffect/RippleEffect.js +3 -1
  119. package/es/Select/GroupSelect.js +14 -58
  120. package/es/Select/Select.js +33 -79
  121. package/es/Select/Select.module.css +23 -23
  122. package/es/Select/SelectWithAvatar.js +4 -17
  123. package/es/Select/SelectWithIcon.js +5 -46
  124. package/es/Select/__tests__/Select.spec.js +8 -6
  125. package/es/Select/props/propTypes.js +0 -1
  126. package/es/Stencils/Stencils.js +3 -3
  127. package/es/Stencils/Stencils.module.css +11 -11
  128. package/es/Switch/Switch.js +3 -5
  129. package/es/Switch/Switch.module.css +23 -23
  130. package/es/Tab/Tab.js +4 -4
  131. package/es/Tab/Tab.module.css +14 -14
  132. package/es/Tab/TabContent.js +0 -1
  133. package/es/Tab/TabContentWrapper.js +0 -2
  134. package/es/Tab/TabWrapper.js +2 -5
  135. package/es/Tab/Tabs.js +7 -54
  136. package/es/Tab/Tabs.module.css +30 -37
  137. package/es/Tab/__tests__/Tab.spec.js +3 -1
  138. package/es/Tab/__tests__/TabWrapper.spec.js +0 -1
  139. package/es/Tag/Tag.js +3 -6
  140. package/es/Tag/Tag.module.css +25 -25
  141. package/es/TextBox/TextBox.js +3 -15
  142. package/es/TextBox/TextBox.module.css +9 -9
  143. package/es/TextBox/__tests__/TextBox.spec.js +4 -1
  144. package/es/TextBoxIcon/TextBoxIcon.js +2 -9
  145. package/es/TextBoxIcon/TextBoxIcon.module.css +7 -7
  146. package/es/TextBoxIcon/__tests__/TextBoxIcon.spec.js +7 -2
  147. package/es/Textarea/Textarea.js +3 -12
  148. package/es/Textarea/Textarea.module.css +21 -21
  149. package/es/Textarea/__tests__/Textarea.spec.js +2 -2
  150. package/es/Tooltip/Tooltip.js +14 -58
  151. package/es/Tooltip/Tooltip.module.css +5 -5
  152. package/es/Tooltip/__tests__/Tooltip.spec.js +0 -5
  153. package/es/VelocityAnimation/VelocityAnimation/VelocityAnimation.js +2 -3
  154. package/es/VelocityAnimation/VelocityAnimationGroup/VelocityAnimationGroup.js +5 -7
  155. package/es/common/animation.module.css +8 -8
  156. package/es/common/avatarsizes.module.css +16 -16
  157. package/es/common/basicReset.module.css +3 -3
  158. package/es/common/common.module.css +24 -24
  159. package/es/common/customscroll.module.css +2 -2
  160. package/es/deprecated/AdvancedMultiSelect.module.css +18 -18
  161. package/es/deprecated/PortalLayer/PortalLayer.js +20 -25
  162. package/es/semantic/Button/Button.js +2 -3
  163. package/es/semantic/Button/semanticButton.module.css +1 -1
  164. package/es/utils/Common.js +13 -54
  165. package/es/utils/ContextOptimizer.js +5 -4
  166. package/es/utils/__tests__/debounce.spec.js +2 -2
  167. package/es/utils/constructFullName.js +0 -2
  168. package/es/utils/css/compileClassNames.js +0 -5
  169. package/es/utils/css/mergeStyle.js +7 -8
  170. package/es/utils/css/utils.js +0 -1
  171. package/es/utils/datetime/common.js +5 -16
  172. package/es/utils/debounce.js +1 -5
  173. package/es/utils/dropDownUtils.js +11 -68
  174. package/es/utils/getInitial.js +0 -4
  175. package/es/utils/shallowEqual.js +0 -6
  176. package/lib/Accordion/Accordion.js +18 -42
  177. package/lib/Accordion/AccordionItem.js +18 -40
  178. package/lib/Accordion/__tests__/Accordion.spec.js +0 -3
  179. package/lib/Accordion/index.js +0 -3
  180. package/lib/Accordion/props/propTypes.js +0 -3
  181. package/lib/Animation/Animation.js +18 -38
  182. package/lib/Animation/__tests__/Animation.spec.js +7 -11
  183. package/lib/Animation/props/propTypes.js +0 -3
  184. package/lib/AppContainer/AppContainer.js +21 -56
  185. package/lib/AppContainer/AppContainer.module.css +2 -2
  186. package/lib/AppContainer/props/propTypes.js +0 -3
  187. package/lib/Avatar/Avatar.js +38 -78
  188. package/lib/Avatar/Avatar.module.css +18 -18
  189. package/lib/Avatar/__tests__/Avatar.spec.js +0 -44
  190. package/lib/Avatar/props/propTypes.js +0 -3
  191. package/lib/AvatarTeam/AvatarTeam.js +30 -52
  192. package/lib/AvatarTeam/AvatarTeam.module.css +35 -35
  193. package/lib/AvatarTeam/__tests__/AvatarTeam.spec.js +0 -13
  194. package/lib/AvatarTeam/props/propTypes.js +0 -3
  195. package/lib/Button/Button.js +20 -31
  196. package/lib/Button/css/Button.module.css +70 -70
  197. package/lib/Button/css/cssJSLogic.js +17 -18
  198. package/lib/Button/index.js +0 -3
  199. package/lib/Button/props/defaultProps.js +0 -2
  200. package/lib/Button/props/propTypes.js +0 -3
  201. package/lib/Buttongroup/Buttongroup.js +12 -32
  202. package/lib/Buttongroup/Buttongroup.module.css +15 -14
  203. package/lib/Buttongroup/__test__/Buttongroup.spec.js +0 -10
  204. package/lib/Buttongroup/props/propTypes.js +0 -3
  205. package/lib/Card/Card.js +46 -102
  206. package/lib/Card/__tests__/Card.spec.js +1 -10
  207. package/lib/Card/index.js +0 -4
  208. package/lib/Card/props/propTypes.js +0 -3
  209. package/lib/CheckBox/CheckBox.js +47 -71
  210. package/lib/CheckBox/CheckBox.module.css +15 -15
  211. package/lib/CheckBox/__tests__/CheckBox.spec.js +0 -3
  212. package/lib/CheckBox/props/propTypes.js +0 -3
  213. package/lib/DateTime/CalendarView.js +42 -82
  214. package/lib/DateTime/DateTime.js +155 -239
  215. package/lib/DateTime/DateTime.module.css +39 -39
  216. package/lib/DateTime/DateTimePopupFooter.js +8 -31
  217. package/lib/DateTime/DateTimePopupHeader.js +17 -48
  218. package/lib/DateTime/DateWidget.js +250 -352
  219. package/lib/DateTime/DateWidget.module.css +5 -5
  220. package/lib/DateTime/DaysRow.js +5 -27
  221. package/lib/DateTime/Time.js +32 -73
  222. package/lib/DateTime/YearView.js +28 -77
  223. package/lib/DateTime/YearView.module.css +15 -15
  224. package/lib/DateTime/__tests__/CalendarView.spec.js +5 -13
  225. package/lib/DateTime/__tests__/DateTime.spec.js +37 -51
  226. package/lib/DateTime/__tests__/DateWidget.spec.js +8 -10
  227. package/lib/DateTime/common.js +0 -6
  228. package/lib/DateTime/constants.js +0 -1
  229. package/lib/DateTime/dateFormatUtils/dateFormat.js +122 -184
  230. package/lib/DateTime/dateFormatUtils/dateFormats.js +1 -0
  231. package/lib/DateTime/dateFormatUtils/dayChange.js +7 -14
  232. package/lib/DateTime/dateFormatUtils/index.js +16 -74
  233. package/lib/DateTime/dateFormatUtils/monthChange.js +9 -19
  234. package/lib/DateTime/dateFormatUtils/timeChange.js +22 -54
  235. package/lib/DateTime/dateFormatUtils/yearChange.js +11 -22
  236. package/lib/DateTime/index.js +0 -2
  237. package/lib/DateTime/objectUtils.js +20 -24
  238. package/lib/DateTime/props/propTypes.js +1 -11
  239. package/lib/DateTime/typeChecker.js +0 -4
  240. package/lib/DateTime/validator.js +10 -73
  241. package/lib/DropBox/DropBox.js +12 -36
  242. package/lib/DropBox/DropBoxElement/DropBoxElement.js +44 -63
  243. package/lib/DropBox/DropBoxElement/css/DropBoxElement.module.css +85 -79
  244. package/lib/DropBox/DropBoxElement/css/cssJSLogic.js +35 -42
  245. package/lib/DropBox/DropBoxElement/props/propTypes.js +1 -4
  246. package/lib/DropBox/DropBoxElement/useDropboxPosCalc.js +9 -14
  247. package/lib/DropBox/__tests__/DropBox.spec.js +4 -8
  248. package/lib/DropBox/css/DropBox.module.css +6 -6
  249. package/lib/DropBox/css/cssJSLogic.js +1 -3
  250. package/lib/DropBox/props/defaultProps.js +4 -8
  251. package/lib/DropBox/props/propTypes.js +4 -10
  252. package/lib/DropDown/DropDown.js +8 -52
  253. package/lib/DropDown/DropDown.module.css +2 -2
  254. package/lib/DropDown/DropDownHeading.js +20 -39
  255. package/lib/DropDown/DropDownHeading.module.css +6 -6
  256. package/lib/DropDown/DropDownItem.js +20 -42
  257. package/lib/DropDown/DropDownItem.module.css +12 -12
  258. package/lib/DropDown/DropDownSearch.js +17 -40
  259. package/lib/DropDown/DropDownSearch.module.css +3 -3
  260. package/lib/DropDown/DropDownSeparator.js +4 -24
  261. package/lib/DropDown/DropDownSeparator.module.css +2 -2
  262. package/lib/DropDown/__tests__/DropDown.spec.js +9 -15
  263. package/lib/DropDown/__tests__/DropDownItem.spec.js +4 -9
  264. package/lib/DropDown/__tests__/DropDownSearch.spec.js +0 -3
  265. package/lib/DropDown/index.js +0 -9
  266. package/lib/DropDown/props/propTypes.js +4 -6
  267. package/lib/Heading/Heading.js +15 -37
  268. package/lib/Heading/Heading.module.css +2 -2
  269. package/lib/Heading/props/propTypes.js +0 -3
  270. package/lib/Label/Label.js +19 -39
  271. package/lib/Label/Label.module.css +5 -5
  272. package/lib/Label/__tests__/Label.spec.js +1 -14
  273. package/lib/Label/props/propTypes.js +0 -3
  274. package/lib/Layout/Box.js +11 -31
  275. package/lib/Layout/Container.js +10 -29
  276. package/lib/Layout/Layout.module.css +15 -15
  277. package/lib/Layout/__tests__/Box.spec.js +49 -65
  278. package/lib/Layout/__tests__/Container.spec.js +50 -67
  279. package/lib/Layout/index.js +0 -3
  280. package/lib/Layout/props/propTypes.js +0 -3
  281. package/lib/Layout/utils.js +0 -10
  282. package/lib/ListItem/ListContainer.js +27 -48
  283. package/lib/ListItem/ListItem.js +45 -69
  284. package/lib/ListItem/ListItem.module.css +38 -38
  285. package/lib/ListItem/ListItemWithAvatar.js +48 -75
  286. package/lib/ListItem/ListItemWithCheckBox.js +39 -64
  287. package/lib/ListItem/ListItemWithIcon.js +44 -68
  288. package/lib/ListItem/ListItemWithRadio.js +41 -65
  289. package/lib/ListItem/index.js +0 -7
  290. package/lib/ListItem/props/propTypes.js +4 -6
  291. package/lib/Modal/Modal.js +10 -45
  292. package/lib/Modal/props/propTypes.js +0 -3
  293. package/lib/MultiSelect/AdvancedGroupMultiSelect.js +166 -294
  294. package/lib/MultiSelect/AdvancedMultiSelect.js +125 -202
  295. package/lib/MultiSelect/EmptyState.js +24 -45
  296. package/lib/MultiSelect/MultiSelect.js +206 -323
  297. package/lib/MultiSelect/MultiSelect.module.css +31 -31
  298. package/lib/MultiSelect/MultiSelectHeader.js +8 -30
  299. package/lib/MultiSelect/MultiSelectWithAvatar.js +63 -105
  300. package/lib/MultiSelect/SelectedOptions.js +17 -43
  301. package/lib/MultiSelect/SelectedOptions.module.css +5 -5
  302. package/lib/MultiSelect/Suggestions.js +32 -64
  303. package/lib/MultiSelect/__tests__/MultiSelect.spec.js +75 -86
  304. package/lib/MultiSelect/index.js +0 -5
  305. package/lib/MultiSelect/props/defaultProps.js +0 -2
  306. package/lib/MultiSelect/props/propTypes.js +0 -5
  307. package/lib/PopOver/PopOver.js +49 -95
  308. package/lib/PopOver/__tests__/PopOver.spec.js +1 -4
  309. package/lib/PopOver/index.js +0 -4
  310. package/lib/PopOver/props/propTypes.js +0 -3
  311. package/lib/Popup/Popup.js +81 -158
  312. package/lib/Popup/__tests__/Popup.spec.js +8 -43
  313. package/lib/Popup/viewPort.js +14 -28
  314. package/lib/Provider/AvatarSize.js +0 -4
  315. package/lib/Provider/Config.js +0 -2
  316. package/lib/Provider/CssProvider.js +0 -4
  317. package/lib/Provider/IdProvider.js +6 -17
  318. package/lib/Provider/LibraryContext.js +15 -35
  319. package/lib/Provider/LibraryContextInit.js +0 -4
  320. package/lib/Provider/NumberGenerator/NumberGenerator.js +15 -44
  321. package/lib/Provider/ZindexProvider.js +3 -15
  322. package/lib/Provider/index.js +0 -5
  323. package/lib/Radio/Radio.js +38 -61
  324. package/lib/Radio/Radio.module.css +9 -9
  325. package/lib/Radio/__tests__/Radiospec.js +5 -9
  326. package/lib/Radio/props/propTypes.js +0 -3
  327. package/lib/Responsive/CustomResponsive.js +29 -73
  328. package/lib/Responsive/RefWrapper.js +11 -17
  329. package/lib/Responsive/ResizeComponent.js +36 -62
  330. package/lib/Responsive/ResizeObserver.js +10 -24
  331. package/lib/Responsive/Responsive.js +30 -80
  332. package/lib/Responsive/index.js +0 -4
  333. package/lib/Responsive/props/propTypes.js +0 -3
  334. package/lib/Responsive/sizeObservers.js +17 -53
  335. package/lib/Responsive/utils/index.js +3 -11
  336. package/lib/Responsive/utils/shallowCompare.js +2 -11
  337. package/lib/Responsive/windowResizeObserver.js +0 -8
  338. package/lib/ResponsiveDropBox/ResponsiveDropBox.js +17 -45
  339. package/lib/ResponsiveDropBox/ResponsiveDropBox.module.css +2 -2
  340. package/lib/ResponsiveDropBox/props/propTypes.js +0 -3
  341. package/lib/Ribbon/Ribbon.js +13 -33
  342. package/lib/Ribbon/Ribbon.module.css +48 -46
  343. package/lib/Ribbon/__tests__/Ribbon.spec.js +0 -22
  344. package/lib/Ribbon/props/propTypes.js +0 -3
  345. package/lib/RippleEffect/RippleEffect.js +10 -18
  346. package/lib/RippleEffect/props/propTypes.js +0 -3
  347. package/lib/Select/GroupSelect.js +130 -229
  348. package/lib/Select/Select.js +209 -290
  349. package/lib/Select/Select.module.css +23 -23
  350. package/lib/Select/SelectWithAvatar.js +56 -102
  351. package/lib/Select/SelectWithIcon.js +76 -132
  352. package/lib/Select/__tests__/Select.spec.js +91 -133
  353. package/lib/Select/index.js +0 -5
  354. package/lib/Select/props/defaultProps.js +4 -5
  355. package/lib/Select/props/propTypes.js +0 -4
  356. package/lib/Stencils/Stencils.js +10 -29
  357. package/lib/Stencils/Stencils.module.css +11 -11
  358. package/lib/Stencils/__tests__/Stencils.spec.js +0 -12
  359. package/lib/Stencils/props/propTypes.js +0 -3
  360. package/lib/Switch/Switch.js +34 -57
  361. package/lib/Switch/Switch.module.css +23 -23
  362. package/lib/Switch/props/propTypes.js +0 -3
  363. package/lib/Tab/Tab.js +27 -40
  364. package/lib/Tab/Tab.module.css +14 -14
  365. package/lib/Tab/TabContent.js +5 -12
  366. package/lib/Tab/TabContentWrapper.js +6 -13
  367. package/lib/Tab/TabWrapper.js +19 -37
  368. package/lib/Tab/Tabs.js +91 -171
  369. package/lib/Tab/Tabs.module.css +30 -37
  370. package/lib/Tab/__tests__/Tab.spec.js +58 -67
  371. package/lib/Tab/__tests__/TabContent.spec.js +6 -10
  372. package/lib/Tab/__tests__/TabContentWrapper.spec.js +20 -28
  373. package/lib/Tab/__tests__/TabWrapper.spec.js +0 -12
  374. package/lib/Tab/__tests__/Tabs.spec.js +39 -53
  375. package/lib/Tab/index.js +0 -6
  376. package/lib/Tab/props/propTypes.js +0 -3
  377. package/lib/Tag/Tag.js +43 -72
  378. package/lib/Tag/Tag.module.css +25 -25
  379. package/lib/Tag/__tests__/Tag.spec.js +8 -14
  380. package/lib/Tag/props/propTypes.js +0 -3
  381. package/lib/TextBox/TextBox.js +59 -85
  382. package/lib/TextBox/TextBox.module.css +9 -9
  383. package/lib/TextBox/__tests__/TextBox.spec.js +4 -14
  384. package/lib/TextBox/props/propTypes.js +4 -6
  385. package/lib/TextBoxIcon/TextBoxIcon.js +52 -79
  386. package/lib/TextBoxIcon/TextBoxIcon.module.css +7 -7
  387. package/lib/TextBoxIcon/__tests__/TextBoxIcon.spec.js +5 -14
  388. package/lib/TextBoxIcon/props/propTypes.js +0 -3
  389. package/lib/Textarea/Textarea.js +29 -54
  390. package/lib/Textarea/Textarea.module.css +21 -21
  391. package/lib/Textarea/__tests__/Textarea.spec.js +2 -14
  392. package/lib/Textarea/props/propTypes.js +0 -3
  393. package/lib/Tooltip/Tooltip.js +31 -94
  394. package/lib/Tooltip/Tooltip.module.css +5 -5
  395. package/lib/Tooltip/__tests__/Tooltip.spec.js +3 -24
  396. package/lib/Tooltip/props/propTypes.js +0 -3
  397. package/lib/VelocityAnimation/VelocityAnimation/VelocityAnimation.js +16 -40
  398. package/lib/VelocityAnimation/VelocityAnimation/props/propTypes.js +0 -3
  399. package/lib/VelocityAnimation/VelocityAnimationGroup/VelocityAnimationGroup.js +25 -53
  400. package/lib/VelocityAnimation/VelocityAnimationGroup/props/propTypes.js +0 -3
  401. package/lib/VelocityAnimation/index.js +0 -3
  402. package/lib/common/animation.module.css +8 -8
  403. package/lib/common/avatarsizes.module.css +16 -16
  404. package/lib/common/basicReset.module.css +3 -3
  405. package/lib/common/common.module.css +24 -24
  406. package/lib/common/customscroll.module.css +2 -2
  407. package/lib/css.js +0 -40
  408. package/lib/deprecated/AdvancedMultiSelect.module.css +18 -18
  409. package/lib/deprecated/PortalLayer/PortalLayer.js +23 -46
  410. package/lib/deprecated/PortalLayer/props/propTypes.js +0 -3
  411. package/lib/index.js +0 -57
  412. package/lib/semantic/Button/Button.js +22 -42
  413. package/lib/semantic/Button/props/propTypes.js +0 -3
  414. package/lib/semantic/Button/semanticButton.module.css +1 -1
  415. package/lib/semantic/index.js +0 -2
  416. package/lib/utils/Common.js +25 -109
  417. package/lib/utils/ContextOptimizer.js +10 -16
  418. package/lib/utils/__tests__/constructFullName.spec.js +0 -1
  419. package/lib/utils/__tests__/debounce.spec.js +2 -3
  420. package/lib/utils/__tests__/getInitial.spec.js +0 -1
  421. package/lib/utils/constructFullName.js +4 -13
  422. package/lib/utils/css/compileClassNames.js +0 -6
  423. package/lib/utils/css/mergeStyle.js +8 -11
  424. package/lib/utils/css/utils.js +0 -8
  425. package/lib/utils/datetime/common.js +5 -32
  426. package/lib/utils/debounce.js +1 -6
  427. package/lib/utils/dropDownUtils.js +59 -175
  428. package/lib/utils/dummyFunction.js +0 -2
  429. package/lib/utils/getHTMLFontSize.js +0 -1
  430. package/lib/utils/getInitial.js +0 -6
  431. package/lib/utils/index.js +0 -4
  432. package/lib/utils/scrollTo.js +0 -2
  433. package/lib/utils/shallowEqual.js +0 -8
  434. package/package.json +1 -1
@@ -2,16 +2,16 @@
2
2
 
3
3
  /** * Libraries ** */
4
4
  import datetime from '@zohodesk/datetimejs';
5
- /** * Methods ** */
6
5
 
6
+ /** * Methods ** */
7
7
  import { getDayEnd, convertYearToTwoDigit, addZero, getMonthDetails, getYearDetails, getDayDetails, getHourDetails, getMinuteDetails, getNoonDetails, getIsCurrentYear, removeYearPattern } from './index';
8
8
  import { getIsEmptyValue } from '../../utils/Common';
9
9
  import { formatDate } from '../../utils/datetime/common';
10
- /** * Constants ** */
11
10
 
12
- import { defaultFormat, supportedPatterns, // patternChangeStr,
11
+ /** * Constants ** */
12
+ import { defaultFormat, supportedPatterns,
13
+ // patternChangeStr,
13
14
  patternSplitStr, INCONSTANT, flags } from '../constants';
14
-
15
15
  function getDateFormatString() {
16
16
  let dateFormatArr = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
17
17
  let datePatternArr = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
@@ -21,23 +21,19 @@ function getDateFormatString() {
21
21
  return res;
22
22
  }, '');
23
23
  }
24
-
25
24
  function getIsValidPattern() {
26
25
  let dateFormatArr = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
27
26
  let datePatternArr = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
28
-
29
27
  const isValueInArray = function () {
30
28
  let possibleFormat = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
31
29
  return possibleFormat.some(str => dateFormatArr.indexOf(str) >= 0);
32
30
  };
33
-
34
31
  const haveDay = isValueInArray(flags.day);
35
32
  const haveMonth = isValueInArray(flags.month);
36
33
  const haveYear = isValueInArray(flags.year);
37
34
  const isValidPattern = datePatternArr.length && datePatternArr.length <= 2 && datePatternArr.every(patternStr => supportedPatterns.indexOf(patternStr) >= 0);
38
35
  return haveDay && haveMonth && (haveYear || !haveYear) && isValidPattern;
39
36
  }
40
-
41
37
  export function getDateFormatDetails() {
42
38
  let dateFormat = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
43
39
  let {
@@ -59,20 +55,17 @@ export function getDateFormatDetails() {
59
55
  isDateTime
60
56
  });
61
57
  const isHideYear = isHideCurrentYear ? isCurrentYear : false;
62
-
63
58
  function getDateFormat(dateFormat) {
64
59
  const token = /D{1,4}|M{1,4}|YY(?:YY)?|([HhmsA])\1?|[LloSZWN]|\[[^\]]*\]|'[^']*'/gi;
65
60
  dateFormatArr = [];
66
61
  patternArr = [];
67
62
  const newDateFormat = dateFormat.replace(token, match => {
68
63
  const dateFormatArrLen = dateFormatArr.length;
69
-
70
64
  if (match in flags) {
71
65
  dateFormatArr.push(match);
72
66
  const {
73
67
  type
74
68
  } = flags[match];
75
-
76
69
  if (type === 'day') {
77
70
  dayInfo = Object.assign({}, flags[match], {
78
71
  index: dateFormatArrLen
@@ -86,35 +79,28 @@ export function getDateFormatDetails() {
86
79
  index: dateFormatArrLen
87
80
  });
88
81
  }
89
-
90
82
  return patternSplitStr;
91
83
  }
92
-
93
84
  return match.slice(1, match.length - 1);
94
85
  });
95
86
  patternArr = newDateFormat.split(patternSplitStr).reduce((res, patternStr) => {
96
87
  if (patternStr) {
97
88
  res.push(patternStr);
98
89
  }
99
-
100
90
  return res;
101
91
  }, []);
102
92
  }
103
-
104
93
  getDateFormat(dateFormat);
105
94
  const isValidPattern = getIsValidPattern(dateFormatArr, patternArr);
106
-
107
95
  if (!isValidPattern) {
108
96
  getDateFormat(defaultFormat);
109
97
  }
110
-
111
98
  if (isHideYear) {
112
99
  ({
113
100
  dateFormatArr,
114
101
  patternArr
115
102
  } = removeYearPattern(dateFormatArr, patternArr));
116
103
  }
117
-
118
104
  return {
119
105
  dateFormat: getDateFormatString(dateFormatArr, patternArr),
120
106
  dateFormatArr,
@@ -125,7 +111,6 @@ export function getDateFormatDetails() {
125
111
  isValidPattern
126
112
  };
127
113
  }
128
-
129
114
  function getDisplayFormatValue(dateVal, formatVal) {
130
115
  let {
131
116
  i18nShortMonths = [],
@@ -135,22 +120,18 @@ function getDisplayFormatValue(dateVal, formatVal) {
135
120
  length,
136
121
  type
137
122
  } = flags[formatVal] || {};
138
-
139
123
  if (length === INCONSTANT) {
140
124
  if (dateVal && formatVal === 'MMM' && i18nShortMonths.length) {
141
125
  return i18nShortMonths[dateVal - 1];
142
126
  } else if (dateVal && formatVal === 'MMMM' && i18nMonths.length) {
143
127
  return i18nMonths[dateVal - 1];
144
128
  }
145
-
146
129
  return addZero(dateVal, formatVal.length ? formatVal.length : 1);
147
130
  } else if (type === 'year' && length === 2) {
148
131
  return addZero(convertYearToTwoDigit(dateVal), length);
149
132
  }
150
-
151
133
  return addZero(dateVal, length);
152
134
  }
153
-
154
135
  function concatDate(values, dateFormatArr, patternArr, fillPlaceHolder) {
155
136
  let {
156
137
  i18nShortMonths,
@@ -171,7 +152,6 @@ function concatDate(values, dateFormatArr, patternArr, fillPlaceHolder) {
171
152
  }, '');
172
153
  return dateString;
173
154
  }
174
-
175
155
  export function getDateTimeString() {
176
156
  let values = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
177
157
  let dateFormatDetails = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
@@ -204,13 +184,11 @@ export function getDateTimeString() {
204
184
  i18nMonths
205
185
  });
206
186
  let timeString = '';
207
-
208
187
  if (isDateTime) {
209
188
  hour = !getIsEmptyValue(hour) ? addZero(hour, 2) : is24Hour ? 'HH' : 'hh';
210
189
  minute = !getIsEmptyValue(minute) ? addZero(minute, 2) : 'mm';
211
190
  timeString = ` ${hour}:${minute} ${is24Hour ? '' : `${noon || '--'}`}`;
212
191
  }
213
-
214
192
  return `${dateString}${timeString}`;
215
193
  }
216
194
  export function getDateDetails(value, localValues, isDateTime, timeZone, _ref) {
@@ -225,7 +203,6 @@ export function getDateDetails(value, localValues, isDateTime, timeZone, _ref) {
225
203
  minute,
226
204
  noon
227
205
  } = localValues;
228
-
229
206
  if (value) {
230
207
  const dateObj = isDateTime ? datetime.toDate(datetime.tz.utcToTz(value, timeZone)) : value ? datetime.toDate(value) : new Date();
231
208
  const selectedDay = dateObj.getDate();
@@ -234,16 +211,13 @@ export function getDateDetails(value, localValues, isDateTime, timeZone, _ref) {
234
211
  const newDay = day ? day : selectedDay;
235
212
  const newMonth = month ? month : selectedMonth + 1;
236
213
  const newYear = year ? year : selectedYear;
237
-
238
214
  if (isDateTime) {
239
215
  let selectedHour = dateObj.getHours();
240
216
  const selectedMinute = dateObj.getMinutes();
241
217
  const selectedNoon = selectedHour < 12 ? 'AM' : 'PM';
242
-
243
218
  if (!is24Hour) {
244
219
  selectedHour = selectedHour === 0 ? 12 : selectedHour > 12 ? selectedHour - 12 : selectedHour;
245
220
  }
246
-
247
221
  const newHour = hour ? hour : selectedHour;
248
222
  const newMinute = minute ? minute : selectedMinute;
249
223
  const newNoon = noon ? noon : selectedNoon;
@@ -256,14 +230,12 @@ export function getDateDetails(value, localValues, isDateTime, timeZone, _ref) {
256
230
  noon: newNoon
257
231
  };
258
232
  }
259
-
260
233
  return {
261
234
  day: newDay,
262
235
  month: newMonth,
263
236
  year: newYear
264
237
  };
265
238
  }
266
-
267
239
  return localValues;
268
240
  }
269
241
  export function getIsValidDate(values, isDateTime, _ref2) {
@@ -287,7 +259,6 @@ export function getIsValidDate(values, isDateTime, _ref2) {
287
259
  const value = parseInt(val);
288
260
  return getIsEmptyValue(value);
289
261
  }
290
-
291
262
  return getIsEmptyValue(val);
292
263
  });
293
264
  const haveAllValues = valuesArr.every((val, index) => {
@@ -303,10 +274,8 @@ export function getIsValidDate(values, isDateTime, _ref2) {
303
274
  } else if (val) {
304
275
  return true;
305
276
  }
306
-
307
277
  return false;
308
278
  });
309
-
310
279
  if (haveAllValues) {
311
280
  const dayEnd = getDayEnd(month, year);
312
281
  const {
@@ -331,7 +300,6 @@ export function getIsValidDate(values, isDateTime, _ref2) {
331
300
  const {
332
301
  allowedValues: noonAllowedValues
333
302
  } = getNoonDetails();
334
-
335
303
  if (dayEnd < day || dayStart > day) {
336
304
  isError = true;
337
305
  message = 'Wrong Day';
@@ -355,7 +323,6 @@ export function getIsValidDate(values, isDateTime, _ref2) {
355
323
  isError = true;
356
324
  message = 'Empty value';
357
325
  }
358
-
359
326
  return {
360
327
  isError,
361
328
  message,
@@ -380,25 +347,21 @@ export function getSelectedDate(values, props) {
380
347
  isDateTime,
381
348
  is24Hour
382
349
  } = props;
383
-
384
350
  if (!is24Hour) {
385
351
  if (parseInt(hour) === 12) {
386
352
  hour = noon === 'AM' ? 0 : 12;
387
353
  }
388
-
389
354
  if (noon === 'PM') {
390
355
  if (hour < 12) {
391
356
  hour = parseInt(hour) + 12;
392
357
  }
393
358
  }
394
359
  }
395
-
396
360
  month = parseInt(month) - 1;
397
361
  const minInMillis = min ? datetime.millis(min) : null,
398
- maxInMillis = max ? datetime.millis(max) : null;
362
+ maxInMillis = max ? datetime.millis(max) : null;
399
363
  let selectedInMillis,
400
- selectedValue = '';
401
-
364
+ selectedValue = '';
402
365
  if (isDateTime) {
403
366
  selectedInMillis = datetime.tz.tzToUtc(Date.UTC(year, month, date, hour, mins), timeZone);
404
367
  selectedValue = datetime.ISO(selectedInMillis);
@@ -406,10 +369,8 @@ export function getSelectedDate(values, props) {
406
369
  selectedInMillis = Date.UTC(year, month, date);
407
370
  selectedValue = formatDate(new Date(year, month, date), 'YYYY-MM-DD');
408
371
  }
409
-
410
372
  let isError = false;
411
373
  let errorType = '';
412
-
413
374
  if (minInMillis && minInMillis > selectedInMillis) {
414
375
  isError = true;
415
376
  errorType = 'MIN';
@@ -417,14 +378,12 @@ export function getSelectedDate(values, props) {
417
378
  isError = true;
418
379
  errorType = 'MAX';
419
380
  }
420
-
421
381
  return {
422
382
  isError,
423
383
  errorType,
424
384
  selectedValue: selectedValue
425
385
  };
426
386
  }
427
-
428
387
  function getDateFormatLength(type, length) {
429
388
  let formatVal = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
430
389
  let {
@@ -453,20 +412,16 @@ function getDateFormatLength(type, length) {
453
412
  }, isDateTime, timeZone, {
454
413
  is24Hour
455
414
  });
456
-
457
415
  if (length === INCONSTANT) {
458
416
  if (selectedMonth && formatVal === 'MMM' && i18nShortMonths.length) {
459
417
  return i18nShortMonths[selectedMonth - 1].length;
460
418
  } else if (selectedMonth && formatVal === 'MMMM' && i18nMonths.length) {
461
419
  return i18nMonths[selectedMonth - 1].length;
462
420
  }
463
-
464
421
  return formatVal.length ? formatVal.length : 1;
465
422
  }
466
-
467
423
  return length;
468
424
  }
469
-
470
425
  export function getDateFormatSelection(dateFormatDetails, isDateTime) {
471
426
  let {
472
427
  i18nShortMonths,
@@ -489,24 +444,20 @@ export function getDateFormatSelection(dateFormatDetails, isDateTime) {
489
444
  const clickIndex = {};
490
445
  const order = [];
491
446
  let tempLength = 0;
492
-
493
447
  function addResult(type, length) {
494
448
  const startIndex = tempLength;
495
449
  const endIndex = tempLength + length;
496
450
  const orderLen = order.length;
497
451
  focusedIndex[`${startIndex}_${endIndex}`] = orderLen;
498
-
499
452
  for (let i = startIndex; i <= endIndex; i++) {
500
453
  clickIndex[i] = orderLen;
501
454
  }
502
-
503
455
  order.push({
504
456
  type,
505
457
  index: [startIndex, endIndex]
506
458
  });
507
459
  tempLength += length;
508
460
  }
509
-
510
461
  dateFormatArr.forEach((formatVal, index) => {
511
462
  const {
512
463
  type,
@@ -530,32 +481,38 @@ export function getDateFormatSelection(dateFormatDetails, isDateTime) {
530
481
  addResult(type, validLength);
531
482
  tempLength += patternVal.length;
532
483
  });
533
-
534
484
  if (isDateTime) {
535
485
  //For space between date and time
536
- tempLength += 1; //hour
486
+ tempLength += 1;
537
487
 
538
- addResult('hour', 2); //For :
488
+ //hour
489
+ addResult('hour', 2);
539
490
 
540
- tempLength += 1; //minute
491
+ //For :
492
+ tempLength += 1;
541
493
 
542
- addResult('minute', 2); //For space between time and noon
494
+ //minute
495
+ addResult('minute', 2);
543
496
 
544
- tempLength += 1; //noon
497
+ //For space between time and noon
498
+ tempLength += 1;
545
499
 
500
+ //noon
546
501
  if (!is24Hour) {
547
502
  addResult('noon', 2);
548
503
  }
549
504
  }
550
-
551
505
  return {
552
506
  focusedIndex,
553
507
  clickIndex,
554
508
  order
555
509
  };
556
- } // export function getDateValues(date = '', dateFormatDetails = {}) {
510
+ }
511
+
512
+ // export function getDateValues(date = '', dateFormatDetails = {}) {
557
513
  // const { dateFormatArr, patternArr, dayInfo, monthInfo, yearInfo } =
558
514
  // dateFormatDetails;
515
+
559
516
  // const newDate = date.split('').reduce((res, str) => {
560
517
  // if (patternArr.indexOf(str) >= 0) {
561
518
  // res += patternChangeStr;
@@ -564,16 +521,21 @@ export function getDateFormatSelection(dateFormatDetails, isDateTime) {
564
521
  // }
565
522
  // return res;
566
523
  // }, '');
524
+
567
525
  // const dateArr = newDate.split(patternChangeStr);
526
+
568
527
  // const { index: dayIndex, length: dayLength } = dayInfo;
569
528
  // let day = dateArr[dayIndex];
570
529
  // day = addZero(day, dayLength);
530
+
571
531
  // const { index: monthIndex, length: monthLength } = monthInfo;
572
532
  // let month = dateArr[monthIndex];
573
533
  // month = addZero(month, monthLength);
534
+
574
535
  // const { index: yearIndex, length: yearLength } = yearInfo;
575
536
  // let year = dateArr[yearIndex];
576
537
  // year = addZero(year, yearLength);
538
+
577
539
  // return {
578
540
  // day,
579
541
  // month,
@@ -581,16 +543,21 @@ export function getDateFormatSelection(dateFormatDetails, isDateTime) {
581
543
  // dateString: concatDate({ day, month, year }, dateFormatArr, patternArr)
582
544
  // };
583
545
  // }
546
+
584
547
  // export function getDateTimeValues(value = '', dateFormatDetails = {}) {
585
548
  // const [date, time = '', noon = ''] = value.split(' ');
549
+
586
550
  // let [hour = '', minute = ''] = time.split(':');
587
551
  // hour = addZero(hour, 2);
588
552
  // minute = addZero(minute, 2);
553
+
589
554
  // const { day, month, year, dateString } = getDateValues(
590
555
  // date,
591
556
  // dateFormatDetails
592
557
  // );
558
+
593
559
  // const timeString = `${hour}:${minute}`;
560
+
594
561
  // return {
595
562
  // day,
596
563
  // month,
@@ -16,6 +16,7 @@
16
16
  // 15.A: represent the AM or PM
17
17
  // 16.Z: represent the timezone (Asia/Kolkata)
18
18
  // 17. (O) : Offset Of the timezone (GMT+00:00)
19
+
19
20
  export const dateSymbols = {
20
21
  d: 'date',
21
22
  dd: 'date',
@@ -6,12 +6,11 @@ export function getChangedDay(values, event, focusOrders, keyActions) {
6
6
  which
7
7
  } = event;
8
8
  const {
9
- day = ''
10
- /*month = '', year = ''*/
11
-
9
+ day = '' /*month = '', year = ''*/
12
10
  } = values;
13
11
  let isChanged = false;
14
- let newDay = Number.parseInt(day) || 0; // const newMonth = Number.parseInt(month) || 0;
12
+ let newDay = Number.parseInt(day) || 0;
13
+ // const newMonth = Number.parseInt(month) || 0;
15
14
  // const newYear = Number.parseInt(year) || 0;
16
15
 
17
16
  const {
@@ -21,11 +20,8 @@ export function getChangedDay(values, event, focusOrders, keyActions) {
21
20
  const isNewType = getIsNewValueType(focusOrders, keyActions);
22
21
  const {
23
22
  startPoint,
24
- endPoint
25
- /*getDayEnd(newMonth, newYear);*/
26
-
23
+ endPoint /*getDayEnd(newMonth, newYear);*/
27
24
  } = getDayDetails();
28
-
29
25
  if (keyCode === 38) {
30
26
  //up arrow
31
27
  if (newDay === endPoint || !newDay) {
@@ -48,19 +44,15 @@ export function getChangedDay(values, event, focusOrders, keyActions) {
48
44
  const keyString = String.fromCharCode(which);
49
45
  let newValue = isNewType ? keyString : day.toString() + keyString;
50
46
  newValue = Number.parseInt(newValue);
51
-
52
47
  if (isNewType) {
53
48
  isChanged = true;
54
-
55
49
  if (newValue * 10 > endPoint) {
56
50
  newFocusOrder += 1;
57
51
  }
58
-
59
52
  newDay = newValue;
60
53
  } else {
61
54
  isChanged = true;
62
55
  newFocusOrder += 1;
63
-
64
56
  if (newValue > endPoint) {
65
57
  newDay = endPoint;
66
58
  } else if (!newValue) {
@@ -73,7 +65,6 @@ export function getChangedDay(values, event, focusOrders, keyActions) {
73
65
  isChanged = true;
74
66
  newDay = '';
75
67
  }
76
-
77
68
  return {
78
69
  day: newDay,
79
70
  isChanged,
@@ -2,11 +2,11 @@
2
2
 
3
3
  /** * Libraries ** */
4
4
  import datetime from '@zohodesk/datetimejs';
5
- /** * Methods ** */
6
5
 
6
+ /** * Methods ** */
7
7
  import { getMonthEnd } from '../../utils/datetime/common';
8
- /** * Constants ** */
9
8
 
9
+ /** * Constants ** */
10
10
  import { flags, INVALID_DATE } from '../constants';
11
11
  export function convertYearToTwoDigit(year) {
12
12
  return parseInt(year.toString().slice(-2));
@@ -15,7 +15,6 @@ export function addZero() {
15
15
  let value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
16
16
  let length = arguments.length > 1 ? arguments[1] : undefined;
17
17
  let newValue = value.toString();
18
-
19
18
  for (let i = 0; i < length; i++) {
20
19
  if (newValue.length < length) {
21
20
  newValue = `0${newValue}`;
@@ -23,19 +22,16 @@ export function addZero() {
23
22
  break;
24
23
  }
25
24
  }
26
-
27
25
  return newValue;
28
26
  }
29
27
  export function getDayEnd(month, year) {
30
28
  month -= 1;
31
29
  const monthend = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
32
-
33
30
  if (month && year) {
34
31
  return getMonthEnd(month, year);
35
32
  } else if (month) {
36
33
  return monthend[month];
37
34
  }
38
-
39
35
  return 31;
40
36
  }
41
37
  export function getIsNumberTyped(event) {
@@ -45,18 +41,15 @@ export function getIsNumberTyped(event) {
45
41
  metaKey,
46
42
  shiftKey
47
43
  } = event;
48
-
49
44
  if (keyCode >= 48 && keyCode <= 57 && !ctrlKey && !metaKey && !shiftKey) {
50
45
  return true;
51
46
  }
52
-
53
47
  return false;
54
48
  }
55
49
  export function getIsDeleteTyped(keyCode) {
56
50
  if (keyCode === 8) {
57
51
  return true;
58
52
  }
59
-
60
53
  return false;
61
54
  }
62
55
  export function getIsNewValueType(focusOrders, keyActions) {
@@ -85,7 +78,6 @@ export function getMonthDetails() {
85
78
  export function getYearDetails(yearLength) {
86
79
  const dateObj = new Date();
87
80
  const year = dateObj.getFullYear();
88
-
89
81
  if (yearLength === 2) {
90
82
  return {
91
83
  startPoint: 0,
@@ -93,7 +85,6 @@ export function getYearDetails(yearLength) {
93
85
  currentYear: year
94
86
  };
95
87
  }
96
-
97
88
  return {
98
89
  startPoint: 1850,
99
90
  endPoint: 9999,
@@ -107,11 +98,9 @@ export function convertTwoDigitToYear() {
107
98
  let year = dateObj.getFullYear();
108
99
  const digitValueStr = addZero(digitValue.toString(), 2);
109
100
  year = selectedYear ? selectedYear : year;
110
-
111
101
  if (digitValueStr && digitValueStr.length <= 2) {
112
102
  return parseInt(year.toString().slice(0, 2) + digitValueStr);
113
103
  }
114
-
115
104
  return digitValue;
116
105
  }
117
106
  export function getHourDetails(is24Hour) {
@@ -126,12 +115,10 @@ export function getHourSuggestions(is24Hour) {
126
115
  endPoint
127
116
  } = getHourDetails(is24Hour);
128
117
  const hourArr = [];
129
-
130
118
  for (let hour = startPoint; hour <= endPoint; hour++) {
131
119
  const htxt = addZeroIfNeeded(hour);
132
120
  hourArr.push(htxt);
133
121
  }
134
-
135
122
  return hourArr;
136
123
  }
137
124
  export function getMinuteDetails() {
@@ -146,12 +133,10 @@ export function getMinuteSuggestions() {
146
133
  endPoint
147
134
  } = getMinuteDetails();
148
135
  const minArr = [];
149
-
150
136
  for (let minute = startPoint; minute <= endPoint; minute++) {
151
137
  const mtxt = addZeroIfNeeded(minute);
152
138
  minArr.push(mtxt);
153
139
  }
154
-
155
140
  return minArr;
156
141
  }
157
142
  export function addZeroIfNeeded(value) {
@@ -161,14 +146,12 @@ export function getIsNoonValueTyped(event) {
161
146
  const {
162
147
  keyCode
163
148
  } = event;
164
-
165
149
  if (keyCode === 65 || keyCode === 77 || keyCode === 80) {
166
150
  //A -65
167
151
  //M -77
168
152
  //P -80
169
153
  return true;
170
154
  }
171
-
172
155
  return false;
173
156
  }
174
157
  export function getNoonDetails() {
@@ -176,42 +159,32 @@ export function getNoonDetails() {
176
159
  allowedValues: ['AM', 'PM']
177
160
  };
178
161
  }
179
-
180
162
  function getIsArrowTyped(keyCode) {
181
163
  const arrowKeycodes = [37, 38, 39, 40];
182
-
183
164
  if (arrowKeycodes.indexOf(keyCode) >= 0) {
184
165
  return true;
185
166
  }
186
-
187
167
  return false;
188
168
  }
189
-
190
169
  export function getIsSupportedKey(event) {
191
170
  const {
192
171
  keyCode
193
172
  } = event;
194
-
195
173
  if (getIsArrowTyped(keyCode) || getIsDeleteTyped(keyCode) || getIsNumberTyped(event) || getIsNoonValueTyped(event)) {
196
174
  return true;
197
175
  }
198
-
199
176
  return false;
200
177
  }
201
178
  export function arrayIsNotEqual(a, b) {
202
179
  return a.some((val, index) => val !== b[index]);
203
180
  }
204
-
205
181
  function getIsEmptyValue(value, startPoint, endPoint) {
206
182
  const newValue = parseInt(value) || 0;
207
-
208
183
  if (newValue >= startPoint && newValue <= endPoint) {
209
184
  return false;
210
185
  }
211
-
212
186
  return true;
213
187
  }
214
-
215
188
  export function getIsEmptyHour(value, is24Hour) {
216
189
  const {
217
190
  startPoint,
@@ -233,7 +206,6 @@ export function getIsCurrentYear(_ref) {
233
206
  timeZone
234
207
  } = _ref;
235
208
  let isCurrentYear = false;
236
-
237
209
  if (value && value !== INVALID_DATE) {
238
210
  const dateObj = isDateTime ? datetime.toDate(datetime.tz.utcToTz(value, timeZone)) : datetime.toDate(value);
239
211
  const currentDateObj = new Date();
@@ -241,7 +213,6 @@ export function getIsCurrentYear(_ref) {
241
213
  const selectedYear = dateObj.getFullYear();
242
214
  isCurrentYear = currentYear === selectedYear;
243
215
  }
244
-
245
216
  return {
246
217
  isCurrentYear
247
218
  };
@@ -254,7 +225,6 @@ export function removeYearPattern(dateFormatArr, patternArr) {
254
225
  const {
255
226
  type
256
227
  } = flags[val];
257
-
258
228
  if (type === 'year') {
259
229
  yearIndex = index;
260
230
  } else {