@zohodesk/components 1.0.0-temp-155 → 1.0.0-temp-156

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