diginet-core-ui 1.3.24

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 (360) hide show
  1. package/assets/avatar/default.svg +3 -0
  2. package/assets/images/menu/dhr/Default.svg +13 -0
  3. package/assets/images/menu/dhr/MHRM00N0001.svg +14 -0
  4. package/assets/images/menu/dhr/MHRM09N0001.svg +1 -0
  5. package/assets/images/menu/dhr/MHRM09N0002.svg +3 -0
  6. package/assets/images/menu/dhr/MHRM09N0003.svg +25 -0
  7. package/assets/images/menu/dhr/MHRM25N0001.svg +26 -0
  8. package/assets/images/menu/dhr/MHRM29N0001.svg +30 -0
  9. package/assets/images/menu/dhr/MHRM29N0015.svg +63 -0
  10. package/assets/images/menu/dhr/MHRM39N0012.svg +43 -0
  11. package/assets/images/menu/dhr/MHRM39N0013.svg +24 -0
  12. package/assets/images/menu/dhr/MHRM39N0014.svg +14 -0
  13. package/assets/images/menu/dhr/MHRM39N0015.svg +36 -0
  14. package/assets/images/menu/dhr/MHRM39N0016.svg +23 -0
  15. package/assets/images/menu/dhr/MHRM77N0001.svg +28 -0
  16. package/assets/images/menu/dhr/MHRM84N0001.svg +27 -0
  17. package/assets/images/menu/dhr/MHRM84N0002.svg +24 -0
  18. package/assets/images/menu/dhr/MHRM89N0001.svg +16 -0
  19. package/assets/images/menu/dhr/MHRP00N0001.svg +10 -0
  20. package/assets/images/menu/dhr/MHRP09N0001.svg +22 -0
  21. package/assets/images/menu/dhr/MHRP09N0002.svg +19 -0
  22. package/assets/images/menu/dhr/MHRP09N0003.svg +12 -0
  23. package/assets/images/menu/dhr/MHRP09N0004.svg +6 -0
  24. package/assets/images/menu/dhr/MHRP09N0005.svg +10 -0
  25. package/assets/images/menu/dhr/MHRP09N0006.svg +17 -0
  26. package/assets/images/menu/dhr/MHRP09N0007.svg +15 -0
  27. package/assets/images/menu/dhr/MHRP09N0008.svg +8 -0
  28. package/assets/images/menu/dhr/MHRP09N0009.svg +10 -0
  29. package/assets/images/menu/dhr/MHRP09N0010.svg +12 -0
  30. package/assets/images/menu/dhr/MHRP09N0011.svg +16 -0
  31. package/assets/images/menu/dhr/MHRP09N0012.svg +6 -0
  32. package/assets/images/menu/dhr/MHRP09N0013.svg +8 -0
  33. package/assets/images/menu/dhr/MHRP09N0014.svg +11 -0
  34. package/assets/images/menu/dhr/MHRP09N0015.svg +12 -0
  35. package/assets/images/menu/dhr/MHRP09N0016.svg +18 -0
  36. package/assets/images/menu/dhr/MHRP09N0017.svg +18 -0
  37. package/assets/images/menu/dhr/MHRP09N0018.svg +12 -0
  38. package/assets/images/menu/dhr/MHRP09N0019.svg +13 -0
  39. package/assets/images/menu/dhr/MHRP09N0020.svg +17 -0
  40. package/assets/images/menu/dhr/MHRP09N0021.svg +10 -0
  41. package/assets/images/menu/dhr/MHRP09N0022.svg +16 -0
  42. package/assets/images/menu/dhr/MHRP09N0023.svg +8 -0
  43. package/assets/images/menu/dhr/MHRP09N0024.svg +15 -0
  44. package/assets/images/menu/dhr/MHRP09N0025.svg +16 -0
  45. package/assets/images/menu/dhr/MHRP09N0026.svg +13 -0
  46. package/assets/images/menu/dhr/MHRP09N0027.svg +10 -0
  47. package/assets/images/menu/dhr/MHRP13N0001.svg +9 -0
  48. package/assets/images/menu/dhr/MHRP21N0001.svg +12 -0
  49. package/assets/images/menu/dhr/MHRP21N0002.svg +13 -0
  50. package/assets/images/menu/dhr/MHRP25N0001.svg +13 -0
  51. package/assets/images/menu/dhr/MHRP25N0002.svg +16 -0
  52. package/assets/images/menu/dhr/MHRP25N0003.svg +38 -0
  53. package/assets/images/menu/dhr/MHRP25N0004.svg +17 -0
  54. package/assets/images/menu/dhr/MHRP25N0005.svg +20 -0
  55. package/assets/images/menu/dhr/MHRP29N0001.svg +18 -0
  56. package/assets/images/menu/dhr/MHRP29N0002.svg +15 -0
  57. package/assets/images/menu/dhr/MHRP29N0003.svg +20 -0
  58. package/assets/images/menu/dhr/MHRP29N0004.svg +21 -0
  59. package/assets/images/menu/dhr/MHRP29N0005.svg +21 -0
  60. package/assets/images/menu/dhr/MHRP29N0006.svg +14 -0
  61. package/assets/images/menu/dhr/MHRP29N0007.svg +19 -0
  62. package/assets/images/menu/dhr/MHRP29N0008.svg +20 -0
  63. package/assets/images/menu/dhr/MHRP29N0009.svg +11 -0
  64. package/assets/images/menu/dhr/MHRP29N0010.svg +11 -0
  65. package/assets/images/menu/dhr/MHRP29N0011.svg +12 -0
  66. package/assets/images/menu/dhr/MHRP29N0013.svg +27 -0
  67. package/assets/images/menu/dhr/MHRP29N0014.svg +32 -0
  68. package/assets/images/menu/dhr/MHRP29N0016.svg +54 -0
  69. package/assets/images/menu/dhr/MHRP29N0017.svg +24 -0
  70. package/assets/images/menu/dhr/MHRP29N0018.svg +44 -0
  71. package/assets/images/menu/dhr/MHRP29N0019.svg +17 -0
  72. package/assets/images/menu/dhr/MHRP29N0020.svg +11 -0
  73. package/assets/images/menu/dhr/MHRP38N0001.svg +13 -0
  74. package/assets/images/menu/dhr/MHRP38N0002.svg +14 -0
  75. package/assets/images/menu/dhr/MHRP39N0001.svg +15 -0
  76. package/assets/images/menu/dhr/MHRP39N0002.svg +13 -0
  77. package/assets/images/menu/dhr/MHRP39N0003.svg +16 -0
  78. package/assets/images/menu/dhr/MHRP39N0004.svg +22 -0
  79. package/assets/images/menu/dhr/MHRP39N0005.svg +16 -0
  80. package/assets/images/menu/dhr/MHRP39N0006.svg +17 -0
  81. package/assets/images/menu/dhr/MHRP39N0007.svg +13 -0
  82. package/assets/images/menu/dhr/MHRP39N0008.svg +3 -0
  83. package/assets/images/menu/dhr/MHRP39N0009.svg +3 -0
  84. package/assets/images/menu/dhr/MHRP39N0010.svg +7 -0
  85. package/assets/images/menu/dhr/MHRP39N0011.svg +14 -0
  86. package/assets/images/menu/dhr/MHRP39N0013.svg +10 -0
  87. package/assets/images/menu/dhr/MHRP39N0014.svg +11 -0
  88. package/assets/images/menu/dhr/MHRP39N1222.svg +12 -0
  89. package/assets/images/menu/dhr/MHRP51N0001.svg +9 -0
  90. package/assets/images/menu/dhr/MHRP51N0002.svg +13 -0
  91. package/assets/images/menu/dhr/MHRP52N0001.svg +21 -0
  92. package/assets/images/menu/dhr/MHRP52N0002.svg +21 -0
  93. package/assets/images/menu/dhr/MHRP52N0003.svg +16 -0
  94. package/assets/images/menu/dhr/MHRP75N0001.svg +19 -0
  95. package/assets/images/menu/dhr/MHRP75N0002.svg +25 -0
  96. package/assets/images/menu/dhr/MHRP75N0003.svg +3 -0
  97. package/assets/images/menu/dhr/MHRP75N0006.svg +14 -0
  98. package/assets/images/menu/dhr/MHRP75N0007.svg +19 -0
  99. package/assets/images/menu/dhr/MHRP75N0008.svg +19 -0
  100. package/assets/images/menu/dhr/MHRP77N0007.svg +28 -0
  101. package/assets/images/menu/dhr/MHRP77N0008.svg +17 -0
  102. package/assets/images/menu/dhr/MHRP77N0009.svg +19 -0
  103. package/assets/images/menu/dhr/MHRP77N0010.svg +20 -0
  104. package/assets/images/menu/dhr/MHRP89N1000.svg +6 -0
  105. package/assets/images/menu/dhr/MHRP89N1001.svg +6 -0
  106. package/assets/images/menu/dhr/W00F0001.svg +3 -0
  107. package/assets/images/menu/dhr/W00F0002.svg +3 -0
  108. package/assets/images/menu/dhr/W00F0003.svg +3 -0
  109. package/assets/images/menu/dhr/W00F0004.svg +3 -0
  110. package/assets/images/menu/dhr/W00F0005.svg +1 -0
  111. package/assets/images/menu/dhr/W09F2000-WEB5.svg +17 -0
  112. package/assets/images/menu/dhr/W09F2000.svg +6 -0
  113. package/assets/images/menu/dhr/W09F2002-WEB5.svg +21 -0
  114. package/assets/images/menu/dhr/W09F2005-WEB5.svg +13 -0
  115. package/assets/images/menu/dhr/W09F2020-WEB5.svg +16 -0
  116. package/assets/images/menu/dhr/W09F2022-WEB5.svg +20 -0
  117. package/assets/images/menu/dhr/W09F2150-WEB5.svg +16 -0
  118. package/assets/images/menu/dhr/W09F2152-WEB5.svg +20 -0
  119. package/assets/images/menu/dhr/W09F2160-WEB5.svg +14 -0
  120. package/assets/images/menu/dhr/W09F2162-WEB5.svg +18 -0
  121. package/assets/images/menu/dhr/W29F4006-WEB5.svg +19 -0
  122. package/assets/images/menu/dhr/W75F2260-WEB5.svg +15 -0
  123. package/assets/images/menu/dhr/W75F2261-WEB5.svg +19 -0
  124. package/assets/images/menu/dhr/W75F3005-WEB5.svg +13 -0
  125. package/assets/images/menu/dhr/W75F4070-WEB5.svg +21 -0
  126. package/assets/images/menu/dhr/W75F4071-WEB5.svg +17 -0
  127. package/assets/images/menu/dhr/W75F4100-WEB5.svg +14 -0
  128. package/assets/images/menu/dhr/W77F1011.svg +19 -0
  129. package/assets/images/menu/dhr/W77F1013.svg +22 -0
  130. package/assets/images/menu/erp/W00F0001.svg +3 -0
  131. package/assets/images/menu/erp/W00F0002.svg +3 -0
  132. package/assets/images/menu/erp/W00F0003.svg +3 -0
  133. package/assets/images/menu/erp/W00F0004.svg +3 -0
  134. package/assets/images/menu/erp/W05F0001.svg +16 -0
  135. package/assets/images/menu/erp/W05F0001N0000.svg +16 -0
  136. package/assets/images/menu/erp/W05F0004N0000.svg +6 -0
  137. package/assets/images/menu/erp/W05F0006.svg +30 -0
  138. package/assets/images/menu/erp/W05F0007N0000.svg +6 -0
  139. package/assets/images/menu/erp/W05F0008.svg +14 -0
  140. package/assets/images/menu/erp/W05F4000.svg +9 -0
  141. package/assets/images/menu/erp/W06F0001.svg +17 -0
  142. package/assets/images/menu/erp/W06F0001N0000.svg +17 -0
  143. package/assets/images/menu/erp/W06F0004N0000.svg +22 -0
  144. package/assets/images/menu/erp/W06F0005.svg +22 -0
  145. package/assets/images/menu/erp/W06F0006.svg +55 -0
  146. package/assets/images/menu/erp/W06F0008.svg +17 -0
  147. package/assets/images/menu/erp/WA3F1025.svg +5 -0
  148. package/assets/images/menu/erp/WA3F2100.svg +10 -0
  149. package/components/accordion/context.js +6 -0
  150. package/components/accordion/css.js +159 -0
  151. package/components/accordion/details.js +60 -0
  152. package/components/accordion/group.js +122 -0
  153. package/components/accordion/index.js +117 -0
  154. package/components/accordion/summary.js +175 -0
  155. package/components/alert/index.js +264 -0
  156. package/components/alert/notify.js +192 -0
  157. package/components/avatar/index.js +556 -0
  158. package/components/badge/index.js +223 -0
  159. package/components/button/icon.js +493 -0
  160. package/components/button/index.js +653 -0
  161. package/components/button/more.js +135 -0
  162. package/components/button/ripple-effect.js +85 -0
  163. package/components/card/body-card.js +67 -0
  164. package/components/card/card.js +127 -0
  165. package/components/card/context.js +6 -0
  166. package/components/card/index.js +50 -0
  167. package/components/chart/Pie/Circle.js +50 -0
  168. package/components/chart/Pie/Sector.js +142 -0
  169. package/components/chart/Pie/Sectors.js +91 -0
  170. package/components/chart/Pie/index.js +311 -0
  171. package/components/chart/Pie-v2/Circle.js +50 -0
  172. package/components/chart/Pie-v2/Sector.js +128 -0
  173. package/components/chart/Pie-v2/Sectors.js +224 -0
  174. package/components/chart/Pie-v2/index.js +397 -0
  175. package/components/chart/bar/Axis.js +79 -0
  176. package/components/chart/bar/Bar.js +365 -0
  177. package/components/chart/bar/Grid.js +115 -0
  178. package/components/chart/bar/Labels.js +175 -0
  179. package/components/chart/bar/Points.js +111 -0
  180. package/components/chart/bar/index.js +172 -0
  181. package/components/chart/bar-v2/Axis.js +79 -0
  182. package/components/chart/bar-v2/Bar.js +374 -0
  183. package/components/chart/bar-v2/Grid.js +115 -0
  184. package/components/chart/bar-v2/Labels.js +175 -0
  185. package/components/chart/bar-v2/Points.js +111 -0
  186. package/components/chart/bar-v2/index.js +172 -0
  187. package/components/chart/line/Axis.js +79 -0
  188. package/components/chart/line/Grid.js +115 -0
  189. package/components/chart/line/Labels.js +172 -0
  190. package/components/chart/line/Path.js +163 -0
  191. package/components/chart/line/Point.js +348 -0
  192. package/components/chart/line/Title.js +56 -0
  193. package/components/chart/line/index.js +174 -0
  194. package/components/chart/line-v2/Axis.js +79 -0
  195. package/components/chart/line-v2/Grid.js +115 -0
  196. package/components/chart/line-v2/Labels.js +172 -0
  197. package/components/chart/line-v2/Path.js +163 -0
  198. package/components/chart/line-v2/Point.js +354 -0
  199. package/components/chart/line-v2/Title.js +56 -0
  200. package/components/chart/line-v2/index.js +174 -0
  201. package/components/check-text/index.js +157 -0
  202. package/components/check-text/interview-confirmation.js +172 -0
  203. package/components/check-text/interview-status.js +138 -0
  204. package/components/chip/attach.js +180 -0
  205. package/components/chip/index.js +340 -0
  206. package/components/collapse/index.js +67 -0
  207. package/components/dialogs/colors.js +11 -0
  208. package/components/divider/index.js +71 -0
  209. package/components/divider/style.js +12 -0
  210. package/components/form-control/attachment/index.js +1890 -0
  211. package/components/form-control/calendar/function.js +673 -0
  212. package/components/form-control/calendar/index.js +248 -0
  213. package/components/form-control/calendar/range.js +293 -0
  214. package/components/form-control/checkbox/index.js +306 -0
  215. package/components/form-control/control/index.js +92 -0
  216. package/components/form-control/date-picker/index-old.js +953 -0
  217. package/components/form-control/date-picker/index.js +676 -0
  218. package/components/form-control/date-range-picker/index.js +1305 -0
  219. package/components/form-control/dropdown/index.js +1865 -0
  220. package/components/form-control/dropdown-box/index.js +292 -0
  221. package/components/form-control/form/context.js +5 -0
  222. package/components/form-control/form/index.js +41 -0
  223. package/components/form-control/form-group/index.js +118 -0
  224. package/components/form-control/helper-text/index.js +71 -0
  225. package/components/form-control/input-base/index.js +733 -0
  226. package/components/form-control/label/index.js +73 -0
  227. package/components/form-control/money-input/index.js +491 -0
  228. package/components/form-control/number-input/index.js +633 -0
  229. package/components/form-control/phone-input/index.js +433 -0
  230. package/components/form-control/radio/index.js +263 -0
  231. package/components/form-control/text-input/index.js +523 -0
  232. package/components/form-control/time-picker/index.js +829 -0
  233. package/components/form-control/time-picker/swiper.js +590 -0
  234. package/components/form-control/toggle/index.js +250 -0
  235. package/components/form-view/helper-text.js +33 -0
  236. package/components/form-view/index.js +107 -0
  237. package/components/form-view/input.js +129 -0
  238. package/components/form-view/label.js +38 -0
  239. package/components/index.js +100 -0
  240. package/components/list/list-item-action.js +82 -0
  241. package/components/list/list-item-icon.js +76 -0
  242. package/components/list/list-item-text.js +57 -0
  243. package/components/list/list-item.js +114 -0
  244. package/components/list/list.js +155 -0
  245. package/components/list/sub-header.js +61 -0
  246. package/components/modal/body.js +71 -0
  247. package/components/modal/context.js +6 -0
  248. package/components/modal/footer.js +63 -0
  249. package/components/modal/header.js +108 -0
  250. package/components/modal/index.js +69 -0
  251. package/components/modal/modal.js +339 -0
  252. package/components/others/extra/index.js +124 -0
  253. package/components/others/scrollbar/index.js +95 -0
  254. package/components/paging/page-info.js +298 -0
  255. package/components/paging/page-selector.js +281 -0
  256. package/components/paper/index.js +119 -0
  257. package/components/popover/index.js +417 -0
  258. package/components/popup/danger_popup.js +215 -0
  259. package/components/popup/index.js +469 -0
  260. package/components/popup/proposals_popup.js +364 -0
  261. package/components/popup/v2/danger-popup.js +17 -0
  262. package/components/popup/v2/index.js +460 -0
  263. package/components/popup/v2/info-popup.js +17 -0
  264. package/components/popup/v2/success-popup.js +17 -0
  265. package/components/popup/v2/warning-popup.js +17 -0
  266. package/components/popup/v2/yes-no-popup.js +20 -0
  267. package/components/progress/circular.js +414 -0
  268. package/components/progress/linear.js +327 -0
  269. package/components/rating/index.js +392 -0
  270. package/components/slider/slider-container.js +356 -0
  271. package/components/slider/slider-item.js +183 -0
  272. package/components/status/index.js +123 -0
  273. package/components/tab/context.js +3 -0
  274. package/components/tab/tab-container.js +83 -0
  275. package/components/tab/tab-header.js +133 -0
  276. package/components/tab/tab-panel.js +51 -0
  277. package/components/tab/tab.js +206 -0
  278. package/components/tooltip/index.js +602 -0
  279. package/components/tooltip/portal.js +13 -0
  280. package/components/transfer/index.js +489 -0
  281. package/components/tree-view/css.js +94 -0
  282. package/components/tree-view/index.js +1009 -0
  283. package/components/typography/index.js +218 -0
  284. package/css/styles.css +1 -0
  285. package/css/styles.css.map +1 -0
  286. package/global/index.js +175 -0
  287. package/icons/basic.js +6326 -0
  288. package/icons/effect.js +171 -0
  289. package/icons/general/clock/clock.js +21 -0
  290. package/icons/general/color-handler/background.js +41 -0
  291. package/icons/general/color-handler/text.js +41 -0
  292. package/icons/general/emoji/emoji.js +35 -0
  293. package/icons/general/font-properties/bold.js +21 -0
  294. package/icons/general/font-properties/font-family.js +35 -0
  295. package/icons/general/font-properties/font-size.js +27 -0
  296. package/icons/general/font-properties/italic.js +21 -0
  297. package/icons/general/font-properties/underline.js +31 -0
  298. package/icons/general/hyperlink/hyperlink.js +38 -0
  299. package/icons/general/indent/decrease.js +55 -0
  300. package/icons/general/indent/increase.js +55 -0
  301. package/icons/general/index.js +21 -0
  302. package/icons/general/list/bullets.js +77 -0
  303. package/icons/general/list/numbering.js +71 -0
  304. package/icons/general/picture/picture.js +21 -0
  305. package/icons/general/steps/redo.js +21 -0
  306. package/icons/general/steps/undo.js +21 -0
  307. package/icons/general/text-align/center.js +21 -0
  308. package/icons/general/text-align/justify.js +21 -0
  309. package/icons/general/text-align/left.js +21 -0
  310. package/icons/general/text-align/right.js +21 -0
  311. package/icons/index.js +3 -0
  312. package/icons/menu/dhr.js +2440 -0
  313. package/icons/menu/erp.js +490 -0
  314. package/icons/menu/index.js +5 -0
  315. package/icons/menu/v2/index.js +52 -0
  316. package/locale/index.js +11 -0
  317. package/package.json +45 -0
  318. package/readme.md +517 -0
  319. package/styles/animation.js +890 -0
  320. package/styles/color-helper.js +504 -0
  321. package/styles/colors.js +306 -0
  322. package/styles/general.js +48 -0
  323. package/styles/media-queries.js +10 -0
  324. package/styles/typography.js +122 -0
  325. package/styles/utils.js +10 -0
  326. package/theme/index.js +5 -0
  327. package/theme/make-styles.js +95 -0
  328. package/theme/set-theme.js +39 -0
  329. package/theme/settings.js +230 -0
  330. package/theme/theme-provider.js +68 -0
  331. package/theme/theme.js +56 -0
  332. package/theme/with-styles.js +17 -0
  333. package/theme/with-theme.js +11 -0
  334. package/utils/array/array.js +186 -0
  335. package/utils/console.js +34 -0
  336. package/utils/date.js +471 -0
  337. package/utils/error/error.js +62 -0
  338. package/utils/error/errors.js +247 -0
  339. package/utils/getFileType.js +32 -0
  340. package/utils/index.js +23 -0
  341. package/utils/iterator.js +45 -0
  342. package/utils/map-parent.js +53 -0
  343. package/utils/number.js +64 -0
  344. package/utils/object/extend.js +57 -0
  345. package/utils/object/object.js +68 -0
  346. package/utils/parseHTML.js +8 -0
  347. package/utils/promisify.js +38 -0
  348. package/utils/randomString.js +33 -0
  349. package/utils/remove-unicode.js +6 -0
  350. package/utils/render-portal.js +90 -0
  351. package/utils/renderHTML.js +21 -0
  352. package/utils/renderIcon.js +57 -0
  353. package/utils/string/capitalize.js +3 -0
  354. package/utils/string/capitalizeSentenceCase.js +10 -0
  355. package/utils/string/string.js +81 -0
  356. package/utils/type.js +90 -0
  357. package/utils/updatePosition.js +36 -0
  358. package/utils/useOnClickOutside.js +23 -0
  359. package/utils/usePortal.js +56 -0
  360. package/utils/validate.js +149 -0
@@ -0,0 +1,1305 @@
1
+ function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2
+
3
+ /** @jsxRuntime classic */
4
+
5
+ /** @jsx jsx */
6
+ import { css, jsx } from '@emotion/core';
7
+ import { useImperativeHandle, useRef, memo, forwardRef, useEffect, useState, useCallback } from 'react';
8
+ import { Button, Divider, HelperText, InputBase, Label, Typography } from '../..';
9
+ import ControlComp from '../control';
10
+ import PropTypes from 'prop-types';
11
+ import theme from '../../../theme/settings';
12
+ import Icon from '../../../icons';
13
+ import { render } from 'react-dom';
14
+ import { randomString, updatePosition, date as moment, capitalizeSentenceCase, isEqual } from '../../../utils';
15
+ import { getGlobal } from '../../../global';
16
+ import { generateCalendarCSS, onUpdateNavigator, renderHeader, renderNavigator } from '../calendar/function';
17
+ import locale from '../../../locale';
18
+ const DateRangePickerV2 = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
19
+ actionIconAt,
20
+ controls,
21
+ clearAble,
22
+ defaultValue,
23
+ disabled,
24
+ displayFormat,
25
+ error,
26
+ errorProps,
27
+ inputProps,
28
+ inputStyle,
29
+ label,
30
+ labelProps,
31
+ max,
32
+ min,
33
+ onChange,
34
+ onShowTooltip,
35
+ placeholder,
36
+ pressESCToClose,
37
+ readOnly,
38
+ required,
39
+ returnFormat,
40
+ startFromZero,
41
+ style,
42
+ textAlign,
43
+ unitCount,
44
+ value,
45
+ viewType,
46
+ ...props
47
+ }, reference) => {
48
+ const footerRef = useRef(null);
49
+ const iconRef = useRef(null);
50
+ const ipConRef = useRef(null);
51
+ const ipRef = useRef(null);
52
+ const pickerRef = useRef(null);
53
+ const tableFrRef = useRef(null);
54
+ const tableToRef = useRef(null);
55
+ const tooltipRef = useRef(null);
56
+ const ref = useRef(null);
57
+ const tempValues = useRef([]);
58
+ const values = useRef([]);
59
+ const valueFr = useRef(null);
60
+ const valueTo = useRef(null);
61
+ const selected = useRef(0);
62
+ const [, setValues] = useState(Date.now());
63
+ const [, setTempValues] = useState(Date.now());
64
+ const [, setValueFr] = useState(Date.now());
65
+ const [, setValueTo] = useState(Date.now());
66
+ const [, setSelected] = useState(Date.now());
67
+ const navigatorFromRefs = {
68
+ doubleLeft: useRef(null),
69
+ doubleRight: useRef(null),
70
+ left: useRef(null),
71
+ right: useRef(null),
72
+ content: useRef(null)
73
+ };
74
+ const navigatorToRefs = {
75
+ doubleLeft: useRef(null),
76
+ doubleRight: useRef(null),
77
+ left: useRef(null),
78
+ right: useRef(null),
79
+ content: useRef(null)
80
+ };
81
+ useImperativeHandle(reference, () => ({
82
+ get: () => {
83
+ return ref.current;
84
+ }
85
+ }));
86
+ const [id] = useState(randomString(6, {
87
+ allowSymbol: false
88
+ }));
89
+ const unique = {
90
+ backGr: 'DGN-UI-Portal',
91
+ close: 'DGN-UI-DateRangePickerV2-close',
92
+ cancel: 'DGN-UI-DateRangePickerV2-cancel',
93
+ confirm: 'DGN-UI-DateRangePickerV2-confirm',
94
+ divider: 'DGN-UI-DateRangePickerV2-Divider',
95
+ disabled: 'DGN-UI-DateRangePickerV2-disabled',
96
+ error: 'DGN-UI-DateRangePickerV2-error',
97
+ focus: 'DGN-UI-DateRangePickerV2-focus',
98
+ footer: 'DGN-UI-DateRangePickerV2-Footer',
99
+ picker: 'DGN-UI-DateRangePickerV2-Picker-' + id,
100
+ wrapper: 'DGN-UI-DateRangePickerV2-Wrapper',
101
+ container: 'DGN-UI-DateRangePickerV2',
102
+ icon: 'DGN-UI-DateRangePickerV2-Icon',
103
+ tooltip: 'DGN-UI-DateRangePickerV2-Tooltip',
104
+ navigator: {
105
+ navigator: 'DGN-UI-DateRangePickerV2-Navigator',
106
+ around: 'DGN-UI-DateRangePickerV2-Navigator-Around',
107
+ center: 'DGN-UI-DateRangePickerV2-Navigator-Center'
108
+ },
109
+ table: {
110
+ container: 'DGN-UI-DateRangePickerV2-Table-Container',
111
+ table: 'DGN-UI-DateRangePickerV2-Table-Table',
112
+ header: 'DGN-UI-DateRangePickerV2-Table-Header',
113
+ raw: 'DGN-UI-DateRangePickerV2-Table-Raw',
114
+ data: 'DGN-UI-DateRangePickerV2-Table-Data'
115
+ },
116
+ day: {
117
+ day: 'DGN-UI-DateRangePickerV2-Day',
118
+ week: 'DGN-UI-DateRangePickerV2-Week',
119
+ today: 'DGN-UI-DateRangePickerV2-Day-today',
120
+ active: 'DGN-UI-DateRangePickerV2-Day-active',
121
+ limit: 'DGN-UI-DateRangePickerV2-Day-limit',
122
+ from: 'DGN-UI-DateRangePickerV2-Day-from',
123
+ to: 'DGN-UI-DateRangePickerV2-Day-to',
124
+ between: 'DGN-UI-DateRangePickerV2-Day-between'
125
+ }
126
+ };
127
+ const closeText = getGlobal(['close']);
128
+ const cancelText = getGlobal(['cancel']);
129
+ const confirmText = getGlobal(['confirm']);
130
+ const unitText = getGlobal([unitCount]);
131
+ const iconAreaCSS = css`
132
+ align-items : center;
133
+ color : inherit;
134
+ display : flex;
135
+ width : 24px;
136
+ & span {
137
+ padding: 0;
138
+ }
139
+ .${unique.icon} {
140
+ cursor : pointer;
141
+ opacity : 0;
142
+ transition : visibility 50ms cubic-bezier(0.4, 0, 0.2, 1) 0ms, opacity 300ms cubic-bezier(0.4, 0, 0.2, 1) 50ms;
143
+ visibility : hidden;
144
+ will-change: visibility, opacity;
145
+ }
146
+ .${unique.icon}-cancel {
147
+ transform : translateX(-100%);
148
+ }
149
+ .${unique.icon}-accept {
150
+ opacity : 1;
151
+ visibility: visible;
152
+ }
153
+ `;
154
+ const hiddenStyle = {
155
+ opacity: 0,
156
+ visibility: 'hidden'
157
+ };
158
+ const activeStyle = {
159
+ opacity: 1,
160
+ pointerEvents: 'none',
161
+ visibility: 'visible'
162
+ };
163
+ const controlContainerCSS = css`
164
+ display : flex;
165
+ justify-content: flex-end;
166
+ margin : 0 16px 16px;
167
+ `;
168
+ const buttonProps = {
169
+ style: {
170
+ display: 'none',
171
+ margin: '0 2px',
172
+ padding: '7px 8px',
173
+ visibility: 'hidden'
174
+ }
175
+ };
176
+
177
+ const typographyProps = className => {
178
+ return {
179
+ className,
180
+ color: 'inherit',
181
+ style: {
182
+ alignItems: 'center',
183
+ borderRadius: '50%',
184
+ display: 'flex',
185
+ height: 24,
186
+ justifyContent: 'center',
187
+ margin: 'auto',
188
+ pointerEvents: 'none',
189
+ transition: 'background-color 150ms linear',
190
+ width: 24
191
+ },
192
+ type: 'h6'
193
+ };
194
+ };
195
+
196
+ const dividerProps = {
197
+ direction: 'vertical',
198
+ className: unique.divider,
199
+ height: '100%',
200
+ style: {
201
+ height: '226px',
202
+ margin: '18px 2px 0px'
203
+ }
204
+ };
205
+ const pickerCSS = {
206
+ backGr: 'background-color: transparent; inset: 0px; pointer-events: auto; position: fixed; z-index: 9001;',
207
+ container: css`
208
+ background-color: ${theme.colors.white};
209
+ border-radius : ${theme.border.radius};
210
+ box-shadow : ${theme.boxShadows.large};
211
+ display : flex;
212
+ flex-flow : column;
213
+ .${unique.wrapper} {
214
+ display : flex;
215
+ min-width: 633px;
216
+ }
217
+ .${unique.tooltip} {
218
+ background-color: rgba(21, 26, 48, 0.9);
219
+ border-radius : ${theme.border.radius};
220
+ height : 18px;
221
+ min-width : 65px;
222
+ padding : 3px 6px;
223
+ pointer-events : none;
224
+ position : fixed;
225
+ text-align : center;
226
+ transition : left 0.05s ease-in, top 0.05s ease-in;
227
+ user-select : none;
228
+ vertical-align : middle;
229
+ visibility : hidden;
230
+ white-space : nowrap;
231
+ will-change : left top visibility;
232
+ z-index : 9003;
233
+ }
234
+ @media only screen and (max-width: 599px) {
235
+ max-width : 400px;
236
+ .${unique.wrapper} {
237
+ flex-direction: column;
238
+ min-width : 260px;
239
+ }
240
+ .${unique.divider} {
241
+ height: 1px !important;
242
+ margin: 0px 16px !important;
243
+ width : calc(100% - 32px) !important;
244
+ }
245
+ }
246
+ `,
247
+ picker: (position, width) => css`
248
+ border-radius : ${theme.border.radius};
249
+ height : max-content;
250
+ left : ${position.left}px;
251
+ max-width : 805px;
252
+ min-width : ${window.innerWidth <= 633 ? 300 : 633}px;
253
+ opacity : 0;
254
+ position : fixed;
255
+ top : ${position.top}px;
256
+ transform : scale(0);
257
+ transform-origin: ${position.transformOrigin};
258
+ transition : opacity 120ms cubic-bezier(0.4, 0, 0.2, 1) 0ms, transform 200ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;
259
+ width : ${width}px;
260
+ z-index : 9002;
261
+ `,
262
+ active: {
263
+ opacity: 1,
264
+ transform: 'scale(1)'
265
+ },
266
+ remove: {
267
+ opacity: 0,
268
+ pointerEvents: 'none',
269
+ transform: 'scale(0)'
270
+ }
271
+ };
272
+ const updateValues = useCallback(v => {
273
+ values.current = v;
274
+ setValues();
275
+ }, [values]);
276
+ const updateTempValues = useCallback(v => {
277
+ tempValues.current = v;
278
+ setTempValues();
279
+ }, [tempValues]);
280
+ const updateSelected = useCallback(v => {
281
+ selected.current = v;
282
+ setSelected();
283
+ }, [selected]);
284
+ const updateValueFr = useCallback(v => {
285
+ valueFr.current = v;
286
+ setValueFr();
287
+ }, [valueFr]);
288
+ const updateValueTo = useCallback(v => {
289
+ valueTo.current = v;
290
+ setValueTo();
291
+ }, [valueTo]);
292
+
293
+ const toLocalTimestamp = t => {
294
+ if (typeof t === 'object' && t.getTime) {
295
+ t = t.getTime();
296
+ }
297
+
298
+ if (typeof t === 'string' && !t.match(/\d{13}/)) {
299
+ t = Date.parse(t).getTime();
300
+ }
301
+
302
+ t = parseInt(t, 10) - new Date().getTimezoneOffset() * 60 * 1000;
303
+ return t;
304
+ };
305
+
306
+ const getDaysFrom1970 = t => {
307
+ return Math.floor(toLocalTimestamp(t) / 86400000);
308
+ };
309
+
310
+ const countDays = (start, end) => {
311
+ return Math.abs(getDaysFrom1970(start) - getDaysFrom1970(end)) + (startFromZero ? 0 : 1);
312
+ };
313
+
314
+ const formatValue = (value, format, utc = false) => {
315
+ return moment(value).format(format, utc);
316
+ };
317
+
318
+ const getDateOfWeek = date => {
319
+ let day = date.getDay();
320
+ if (day === 0) day = 7;
321
+ return day - 1;
322
+ };
323
+
324
+ const isValidDate = v => {
325
+ if (!v || v === null) return false;
326
+
327
+ if (Object.prototype.toString.call(v) === '[object Date]') {
328
+ return true;
329
+ }
330
+
331
+ if (!isNaN(Date.parse(new Date(v)))) {
332
+ return true;
333
+ }
334
+
335
+ return false;
336
+ };
337
+
338
+ const isValidValues = v => {
339
+ if (!v || !Array.isArray(v) || v.length !== 2) {
340
+ return false;
341
+ }
342
+
343
+ if (isValidDate(v[0]) && isValidDate(v[1]) && +moment(v[0]).diff(v[1]) <= 0) {
344
+ return true;
345
+ }
346
+
347
+ return false;
348
+ };
349
+
350
+ const isActive = day => {
351
+ if (values.current[0] && +moment(values.current[0]).diff(day) === 0) {
352
+ if (values.current[1] && +moment(values.current[0]).diff(values.current[1]) < 0) {
353
+ return `${unique.day.from + ' ' + unique.day.active}`;
354
+ } else {
355
+ return unique.day.active;
356
+ }
357
+ } else if (values.current[1] && parseDate(values.current[1]) === parseDate(day)) {
358
+ return `${unique.day.to + ' ' + unique.day.active}`;
359
+ }
360
+
361
+ return '';
362
+ };
363
+
364
+ const isToday = day => {
365
+ return +moment(day).diff(new Date().setHours(0, 0, 0, 0)) === 0 ? unique.day.today : '';
366
+ };
367
+
368
+ const isBetween = dayParsed => {
369
+ if (values.current[0] && values.current[1] && parseDate(values.current[0]) < dayParsed && dayParsed < parseDate(values.current[1])) {
370
+ return unique.day.between;
371
+ }
372
+
373
+ return '';
374
+ };
375
+
376
+ const isLimit = (day, max, min) => {
377
+ return isBefore(min, day) || isAfter(max, day) ? unique.day.limit : '';
378
+ };
379
+
380
+ const isBefore = (min, time) => {
381
+ return min && isValidDate(min) && moment(time).diff(min) < 0;
382
+ };
383
+
384
+ const isAfter = (max, time) => {
385
+ return max && isValidDate(max) && moment(time).diff(max) > 0;
386
+ };
387
+
388
+ const countDay = v => {
389
+ if (v && Array.isArray(v) && v.length === 2) {
390
+ return Number(+moment(v[1]).diff(v[0]) + (startFromZero ? 0 : 1));
391
+ }
392
+
393
+ return Number(startFromZero ? 0 : 1);
394
+ };
395
+
396
+ const onChangeValue = v => {
397
+ setInputValue(v[0], true);
398
+ setInputValue(v[1], false);
399
+ !!onChange && onChange({
400
+ value: [formatValue(v[0], returnFormat), formatValue(v[1], returnFormat), selected.current]
401
+ });
402
+ };
403
+
404
+ const onDayClick = e => {
405
+ const el = e.currentTarget;
406
+ const v = parseInt(el.dataset.time, 10);
407
+
408
+ if (values.current.length === 0) {
409
+ //push
410
+ el.classList.add(unique.day.active);
411
+ updateValues([v]);
412
+ updateSelected(countDay(values.current));
413
+ renderPicker();
414
+ controls ? setButtonState() : onChangeValue([values.current[0], values.current[0]]);
415
+ } else {
416
+ if (values.current.length === 1) {
417
+ if (+moment(values.current[0]).diff(new Date(v)) > 0) {
418
+ //unshift
419
+ el.classList.add(unique.day.active);
420
+ updateValues([v, values.current[0]]);
421
+ updateSelected(countDay(values.current));
422
+ renderPicker();
423
+ controls ? setButtonState() : onChangeValue(values.current);
424
+ } else if (+moment(values.current[0]).diff(new Date(v)) < 0) {
425
+ //push
426
+ el.classList.add(unique.day.active);
427
+ updateValues([values.current[0], v]);
428
+ updateSelected(countDay(values.current));
429
+ renderPicker();
430
+ controls ? setButtonState() : onChangeValue(values.current);
431
+ } else {
432
+ //cancel
433
+ e.preventDefault();
434
+ }
435
+ } else {
436
+ //restart
437
+ pickerRef.current.querySelectorAll(`.${unique.day.active}`).forEach(element => {
438
+ element.classList.remove(unique.day.active, unique.day.from, unique.day.to);
439
+ });
440
+ el.classList.add(unique.day.active);
441
+ updateValues([v]);
442
+ updateSelected(countDay(values.current));
443
+ renderPicker();
444
+ controls ? setButtonState() : onChangeValue([values.current[0], values.current[0]]);
445
+ }
446
+ }
447
+ };
448
+
449
+ const parseDate = day => {
450
+ return Date.parse(new Date(day));
451
+ };
452
+
453
+ const renderCalendar = (time, type) => {
454
+ time = new Date(time);
455
+ const firstDay = new Date(new Date(time).setDate(1)),
456
+ lastDay = new Date(firstDay.getFullYear(), firstDay.getMonth() + 1, 0),
457
+ prevDay = new Date(firstDay.getFullYear(), firstDay.getMonth(), 0),
458
+ lastDate = lastDay.getDate(),
459
+ prevDate = prevDay.getDate();
460
+ let tableBody = [],
461
+ tableRaw = [],
462
+ tableData = [],
463
+ weekDateFirst = getDateOfWeek(firstDay),
464
+ weekDateLast = getDateOfWeek(lastDay);
465
+ /**
466
+ * days of previous month
467
+ */
468
+
469
+ for (let i = weekDateFirst; i > 0; i--) {
470
+ const day = Date.parse(new Date(time.getFullYear(), time.getMonth(), 1));
471
+ tableData.push(jsx("td", {
472
+ key: `previous_month-${prevDate - i + 1}`,
473
+ "data-time": day - 1,
474
+ className: `${[unique.table.data, 'previous_month', isBetween(day - 1)].join(' ').trim().replace(/ +(?= )/g, '')}`
475
+ }, jsx("span", {
476
+ className: unique.day.day
477
+ })));
478
+ }
479
+ /**
480
+ * days of current month
481
+ */
482
+
483
+
484
+ for (let i = 0; i < lastDate; i++) {
485
+ const day = new Date(time.getFullYear(), time.getMonth(), i + 1);
486
+ tableData.push(jsx("td", {
487
+ key: `this_month-${i + 1}`,
488
+ "data-time": Date.parse(day),
489
+ className: `${[unique.table.data, 'this_month', isToday(day), isActive(day), (max && max !== undefined || min && min !== undefined) && isLimit(day, new Date(max).setHours(0, 0, 0, 0), new Date(min).setHours(0, 0, 0, 0)), isBetween(Date.parse(day))].join(' ').trim().replace(/ +(?= )/g, '')}`,
490
+ onClick: onDayClick
491
+ }, jsx(Typography, typographyProps(unique.day.day), i + 1)));
492
+ }
493
+ /**
494
+ * days of next month
495
+ */
496
+
497
+
498
+ for (let i = 0; i < 13 - weekDateLast; i++) {
499
+ const day = Date.parse(new Date(time.getFullYear(), time.getMonth() + 1, 0));
500
+ tableData.push(jsx("td", {
501
+ key: `next_month-${i + 1}`,
502
+ "data-time": i < 6 - weekDateLast && day + 1,
503
+ className: `${[unique.table.data, 'next_month', i < 6 - weekDateLast && isBetween(day + 1)].join(' ').trim().replace(/ +(?= )/g, '')}`
504
+ }, jsx("span", {
505
+ className: unique.day.day
506
+ })));
507
+ }
508
+
509
+ for (let i = 0; i < 6; i++) {
510
+ for (let j = 0; j < 7; j++) {
511
+ tableRaw.push(tableData[7 * i + j] || jsx("td", {
512
+ key: 7 * i + j,
513
+ className: `${[unique.table.data, 'next_month'].join(' ').trim().replace(/ +(?= )/g, '')}`
514
+ }));
515
+ }
516
+
517
+ tableBody.push(jsx("tr", {
518
+ key: i,
519
+ className: unique.day.week
520
+ }, tableRaw));
521
+ tableRaw = [];
522
+ }
523
+
524
+ if (type === 'from') {
525
+ onUpdateNavigator(time, navigatorFromRefs);
526
+
527
+ if (tableFrRef.current) {
528
+ tableFrRef.current.querySelector('tbody').remove();
529
+ render(tableBody, tableFrRef.current.appendChild(document.createElement('tbody')));
530
+ }
531
+ } else if (type === 'to') {
532
+ onUpdateNavigator(time, navigatorToRefs);
533
+
534
+ if (tableToRef.current) {
535
+ tableToRef.current.querySelector('tbody').remove();
536
+ render(tableBody, tableToRef.current.appendChild(document.createElement('tbody')));
537
+ }
538
+ }
539
+
540
+ ;
541
+ };
542
+
543
+ const updateFromTo = (times = [new Date(), new Date()]) => {
544
+ const timeFr = new Date(times[0]);
545
+ const timeTo = new Date(times[1]);
546
+ const from = new Date(timeFr.getFullYear(), timeFr.getMonth());
547
+ const to = new Date(timeTo.getFullYear(), +moment(timeTo).diff(timeFr, 'months') === 0 ? timeTo.getMonth() + 1 : timeTo.getMonth());
548
+ updateValueFr(from);
549
+ updateValueTo(to);
550
+ };
551
+
552
+ const update = v => {
553
+ if (v) {
554
+ if (isValidValues(v)) {
555
+ updateValues([new Date(v[0]).setHours(0, 0, 0, 0), new Date(v[1]).setHours(0, 0, 0, 0)]);
556
+ updateSelected(countDay(values.current));
557
+ updateFromTo(values.current);
558
+ setInputValue(values.current[0], true);
559
+ setInputValue(values.current[1], false);
560
+ } else {
561
+ updateValues([]);
562
+ updateFromTo([new Date(), new Date(new Date().getFullYear(), new Date().getMonth() + 1)]);
563
+ }
564
+ } else {
565
+ updateValues([new Date().setHours(0, 0, 0, 0), new Date().setHours(0, 0, 0, 0)]);
566
+ updateSelected(0);
567
+ updateFromTo(values.current); // setInputValue(values.current[0], true);
568
+ // setInputValue(values.current[1], false);
569
+ }
570
+ };
571
+
572
+ const getPickerStyle = () => {
573
+ const {
574
+ innerHeight,
575
+ innerWidth
576
+ } = window;
577
+ const {
578
+ left,
579
+ height,
580
+ top,
581
+ width
582
+ } = ipConRef.current.getBoundingClientRect();
583
+ const pickerHeight = width < 567 ? controls ? 550 : 495 : controls ? 310 : 256;
584
+ let style = {};
585
+ style.left = left;
586
+ style.top = top + height + 4;
587
+ style.transformOrigin = '50% 20%';
588
+
589
+ if (style.top + pickerHeight > innerHeight) {
590
+ if (top > pickerHeight) {
591
+ style.top = top - pickerHeight - 4;
592
+ style.transformOrigin = '50% 80%';
593
+ } else {
594
+ style.top = Math.round((innerHeight - pickerHeight - 16) / 2);
595
+ style.transformOrigin = 'center';
596
+ }
597
+ }
598
+
599
+ const trueWidth = width > 320 ? width < 633 ? 633 : width : 320;
600
+
601
+ if (left + trueWidth > innerWidth) {
602
+ if (innerWidth > trueWidth) {
603
+ style.left = (innerWidth - trueWidth) / 2;
604
+ }
605
+ }
606
+
607
+ return pickerCSS.picker(style, width).styles;
608
+ };
609
+
610
+ const clearDayHovering = arr => {
611
+ if (values.current.length !== 2) {
612
+ for (let i in arr) {
613
+ arr[i].classList.remove(unique.day.from, unique.day.to, unique.day.between);
614
+ }
615
+
616
+ tooltipRef.current.style.visibility = 'hidden';
617
+ }
618
+ };
619
+
620
+ const createBackground = () => {
621
+ let background = document.getElementById(unique.backGr);
622
+
623
+ if (!background) {
624
+ background = document.createElement('div');
625
+ background.id = unique.backGr;
626
+ background.classList.add(unique.portal, unique.backGr);
627
+ document.body.appendChild(background);
628
+ }
629
+
630
+ background.style.cssText = pickerCSS.backGr;
631
+ return background;
632
+ };
633
+
634
+ const createPicker = () => {
635
+ const picker = document.createElement('div');
636
+ picker.id = unique.picker;
637
+ picker.style.cssText = getPickerStyle();
638
+ return picker;
639
+ };
640
+
641
+ const setPrevTime = (e, level, time, type) => {
642
+ if (!valueFr.current || !time) return;
643
+ const firstDayOfMin = min && min !== null && new Date(new Date(min).setDate(1)).setHours(0, 0, 0, 0);
644
+ const firstDayOfTime = new Date(new Date(time).setDate(1)).setHours(0, 0, 0, 0);
645
+
646
+ if (level === 'month') {
647
+ if (firstDayOfMin) {
648
+ if (type === 'to' && getDaysFrom1970(firstDayOfTime) - getDaysFrom1970(firstDayOfMin) < 59) {
649
+ e.currentTarget.disabled = true;
650
+ return;
651
+ }
652
+
653
+ if (getDaysFrom1970(firstDayOfTime) - getDaysFrom1970(firstDayOfMin) < 28) {
654
+ e.currentTarget.disabled = true;
655
+ return;
656
+ }
657
+ }
658
+
659
+ time.setMonth(time.getMonth() - 1);
660
+ renderCalendar(time, type);
661
+ }
662
+
663
+ if (level === 'year') {
664
+ if (firstDayOfMin) {
665
+ if (type === 'to' && getDaysFrom1970(firstDayOfTime) - getDaysFrom1970(firstDayOfMin) < 396) {
666
+ e.currentTarget.disabled = true;
667
+ return;
668
+ }
669
+
670
+ if (getDaysFrom1970(firstDayOfTime) - getDaysFrom1970(firstDayOfMin) < 365) {
671
+ e.currentTarget.disabled = true;
672
+ return;
673
+ }
674
+ }
675
+
676
+ time.setFullYear(time.getFullYear() - 1);
677
+ renderCalendar(time, type);
678
+ }
679
+
680
+ if (type === 'to') {
681
+ if (+moment(time).diff(valueFr.current, 'months') < 1) {
682
+ valueFr.current.setFullYear(time.getFullYear());
683
+ valueFr.current.setMonth(time.getMonth() - 1);
684
+ renderCalendar(valueFr.current, 'from');
685
+ }
686
+ }
687
+ };
688
+
689
+ const setNextTime = (e, level, time, type) => {
690
+ if (!valueTo.current || !time) return;
691
+ const firstDayOfMax = max && max !== null && new Date(new Date(max).setDate(1)).setHours(0, 0, 0, 0);
692
+ const firstDayOfTime = new Date(new Date(time).setDate(1)).setHours(0, 0, 0, 0);
693
+
694
+ if (level === 'month') {
695
+ if (firstDayOfMax) {
696
+ if (type === 'from' && getDaysFrom1970(firstDayOfTime) - getDaysFrom1970(firstDayOfMax) > -59) {
697
+ e.currentTarget.disabled = true;
698
+ return;
699
+ }
700
+
701
+ if (getDaysFrom1970(firstDayOfTime) - getDaysFrom1970(firstDayOfMax) > -28) {
702
+ e.currentTarget.disabled = true;
703
+ return;
704
+ }
705
+ }
706
+
707
+ time.setMonth(time.getMonth() + 1);
708
+ renderCalendar(time, type);
709
+ }
710
+
711
+ if (level === 'year') {
712
+ if (firstDayOfMax) {
713
+ if (type === 'from' && getDaysFrom1970(firstDayOfTime) - getDaysFrom1970(firstDayOfMax) > -396) {
714
+ e.currentTarget.disabled = true;
715
+ return;
716
+ }
717
+
718
+ if (getDaysFrom1970(firstDayOfTime) - getDaysFrom1970(firstDayOfMax) > -365) {
719
+ e.currentTarget.disabled = true;
720
+ return;
721
+ }
722
+ }
723
+
724
+ time.setFullYear(time.getFullYear() + 1);
725
+ renderCalendar(time, type);
726
+ }
727
+
728
+ if (type === 'from') {
729
+ if (+moment(time).diff(valueTo.current, 'months') >= 0) {
730
+ valueTo.current.setFullYear(time.getFullYear());
731
+ valueTo.current.setMonth(time.getMonth() + 1);
732
+ renderCalendar(valueTo.current, 'to');
733
+ }
734
+ }
735
+ };
736
+
737
+ const setButtonState = () => {
738
+ const isVisible = isEqual(values.current, tempValues.current);
739
+
740
+ const query = function (selector) {
741
+ return footerRef.current.querySelector(selector);
742
+ };
743
+
744
+ const close = query(`.${unique.close}`);
745
+ const cancel = query(`.${unique.cancel}`);
746
+ const confirm = query(`.${unique.confirm}`);
747
+ const hidden = {
748
+ display: 'none',
749
+ visibility: 'hidden'
750
+ };
751
+ const visible = {
752
+ display: 'inline-flex',
753
+ visibility: 'visible'
754
+ };
755
+
756
+ if (isVisible) {
757
+ Object.assign(close.style, visible);
758
+ Object.assign(cancel.style, hidden);
759
+ Object.assign(confirm.style, hidden);
760
+ } else {
761
+ Object.assign(cancel.style, visible);
762
+ Object.assign(confirm.style, visible);
763
+ Object.assign(close.style, hidden);
764
+ }
765
+ };
766
+
767
+ const onCancel = () => {
768
+ updateValues(tempValues.current);
769
+ setButtonState();
770
+ closePicker();
771
+ };
772
+
773
+ const onConfirm = () => {
774
+ setButtonState();
775
+
776
+ if (values.current.length === 1) {
777
+ onChangeValue([values.current[0], values.current[0]]);
778
+ } else {
779
+ onChangeValue(values.current);
780
+ }
781
+
782
+ closePicker();
783
+ };
784
+
785
+ const onSwap = open => {
786
+ const t = iconRef.current.childNodes[+open];
787
+
788
+ if (open) {
789
+ Object.assign(t.style, { ...hiddenStyle
790
+ });
791
+ Object.assign(t.previousSibling.style, { ...activeStyle
792
+ });
793
+ setTimeout(() => {
794
+ t.previousSibling.style.pointerEvents = null;
795
+ }, 200);
796
+ } else {
797
+ Object.assign(t.style, { ...hiddenStyle
798
+ });
799
+ Object.assign(t.nextSibling.style, { ...activeStyle
800
+ });
801
+ setTimeout(() => {
802
+ t.nextSibling.style.pointerEvents = null;
803
+ }, 200);
804
+ }
805
+ };
806
+
807
+ const onScroll = () => {
808
+ const node = document.getElementById(unique.picker);
809
+
810
+ if (!ipConRef.current || !node) {
811
+ window.removeEventListener('scroll', onScroll);
812
+ return;
813
+ }
814
+
815
+ updatePosition(ipConRef.current, node, closePicker);
816
+ };
817
+
818
+ const onResize = () => {
819
+ if (!ref.current) return;
820
+ const {
821
+ width
822
+ } = ref.current.getBoundingClientRect();
823
+ const node = document.getElementById(unique.picker);
824
+
825
+ if (node) {
826
+ node.style.width = width + 'px';
827
+ }
828
+
829
+ onScroll();
830
+ };
831
+
832
+ const onDayHover = (e, arr) => {
833
+ const currentTime = parseInt(e.target.dataset.time, 10);
834
+ let tooltipContent = '';
835
+ if (e.target.classList.contains(unique.day.limit)) return;
836
+
837
+ for (let i in arr) {
838
+ const time = parseInt(arr[i].dataset.time, 10);
839
+
840
+ if (values.current[0] && !values.current[1]) {
841
+ const firstValue = Number(values.current[0]);
842
+
843
+ if (firstValue <= time && currentTime >= time && currentTime !== firstValue) {
844
+ if (time === firstValue) {
845
+ arr[i].classList.remove(unique.day.between, unique.day.to);
846
+ arr[i].classList.add(unique.day.from);
847
+ } else if (currentTime === time) {
848
+ arr[i].classList.remove(unique.day.between, unique.day.from);
849
+ arr[i].classList.add(unique.day.to);
850
+ } else {
851
+ arr[i].classList.remove(unique.day.to, unique.day.from);
852
+ arr[i].classList.add(unique.day.between);
853
+ }
854
+ } else if (firstValue >= time && currentTime <= time && currentTime !== firstValue) {
855
+ if (time === firstValue) {
856
+ arr[i].classList.remove(unique.day.between, unique.day.from);
857
+ arr[i].classList.add(unique.day.to);
858
+ } else if (currentTime === time) {
859
+ arr[i].classList.remove(unique.day.between, unique.day.to);
860
+ arr[i].classList.add(unique.day.from);
861
+ } else {
862
+ arr[i].classList.remove(unique.day.to, unique.day.from);
863
+ arr[i].classList.add(unique.day.between);
864
+ }
865
+ } else {
866
+ arr[i].classList.remove(unique.day.to, unique.day.from, unique.day.between);
867
+ }
868
+ }
869
+ }
870
+
871
+ if (values.current[0] && !values.current[1]) {
872
+ const dates = Math.abs(countDays(new Date(values.current), new Date(currentTime)));
873
+ const tooltip = tooltipRef.current;
874
+
875
+ if (onShowTooltip && dates > 0) {
876
+ tooltipContent = dates + ' ' + unitText;
877
+ }
878
+
879
+ if (tooltipContent) {
880
+ const tooltipBounding = tooltip.getBoundingClientRect();
881
+ const dayBounding = e.target.getBoundingClientRect();
882
+ const pickerBounding = pickerRef.current.getBoundingClientRect();
883
+ tooltip.style.visibility = 'visible';
884
+ let left = dayBounding.left - pickerBounding.left + dayBounding.width / 2 - tooltipBounding.width / 2 + 'px';
885
+ let top = dayBounding.top - pickerBounding.top - 4 - tooltipBounding.height + 'px';
886
+ tooltip.childNodes[0].textContent = tooltipContent;
887
+ setTimeout(() => {
888
+ tooltip.style.left = left;
889
+ tooltip.style.top = top;
890
+ }, 10);
891
+ } else {
892
+ tooltipRef.current.style.visibility = 'hidden';
893
+ }
894
+ } else {
895
+ tooltipRef.current.style.visibility = 'hidden';
896
+ }
897
+ };
898
+
899
+ const onPickerHover = (e, arr) => {
900
+ arr = Array.from(arr);
901
+
902
+ if (e.target.tagName && e.target.tagName.toLowerCase() === 'td') {
903
+ onDayHover(e, arr);
904
+ } else {
905
+ clearDayHovering(arr);
906
+ }
907
+ };
908
+
909
+ const pressESCHandler = event => {
910
+ if (event.key === 'Escape') {
911
+ onClickOutside({
912
+ target: null
913
+ });
914
+ }
915
+
916
+ ;
917
+ };
918
+
919
+ const renderPicker = () => {
920
+ renderCalendar(valueFr.current, 'from');
921
+ renderCalendar(valueTo.current, 'to');
922
+ };
923
+
924
+ const openPicker = () => {
925
+ const backGr = createBackground();
926
+ const picker = createPicker();
927
+ render(pickerComp, backGr.appendChild(picker));
928
+ const arr = pickerRef.current.getElementsByTagName('td');
929
+ updateTempValues(values.current.length === 1 ? [values.current[0], values.current[0]] : values.current);
930
+ setTimeout(() => {
931
+ Object.assign(picker.style, { ...pickerCSS.active
932
+ });
933
+ renderPicker();
934
+ pickerRef.current.addEventListener('mouseover', e => onPickerHover(e, arr));
935
+ window.addEventListener('resize', onResize);
936
+ window.addEventListener('scroll', onScroll);
937
+ document.addEventListener('mousedown', onClickOutside);
938
+
939
+ if (pressESCToClose) {
940
+ document.addEventListener('keydown', pressESCHandler);
941
+ }
942
+
943
+ controls && setButtonState();
944
+ });
945
+ };
946
+
947
+ const closePicker = () => {
948
+ const backGr = document.getElementById(unique.backGr);
949
+ if (!backGr) return;
950
+ const picker = backGr.querySelector(`#${unique.picker}`);
951
+ if (!picker) return;
952
+ Object.assign(picker.style, { ...pickerCSS.remove
953
+ });
954
+
955
+ if (pressESCToClose) {
956
+ document.removeEventListener('keydown', pressESCHandler);
957
+ }
958
+
959
+ document.removeEventListener('mousedown', onClickOutside);
960
+ window.removeEventListener('scroll', onScroll);
961
+ window.removeEventListener('resize', onResize);
962
+ setTimeout(() => {
963
+ backGr.remove();
964
+ }, 200);
965
+ pickerRef.current && pickerRef.current.removeEventListener('mouseover', onPickerHover);
966
+
967
+ if (ipConRef.current) {
968
+ ipConRef.current.classList.remove(unique.focus);
969
+ ipConRef.current.style.zIndex = null;
970
+ }
971
+
972
+ ipRef.current && ipRef.current.blur();
973
+ updateTempValues([]);
974
+ };
975
+
976
+ const onClickOutside = e => {
977
+ if (ipConRef.current && !ipConRef.current.contains(e.target) && ipRef.current && !ipRef.current.contains(e.target) && pickerRef.current && !pickerRef.current.contains(e.target)) {
978
+ controls ? onCancel() : closePicker();
979
+ }
980
+ };
981
+
982
+ const triggerFocus = () => {
983
+ if (!ipConRef.current.classList.contains(unique.focus)) {
984
+ ipRef.current.focus();
985
+ } else {
986
+ onClickOutside({
987
+ target: null
988
+ });
989
+ }
990
+ };
991
+
992
+ const onInputFocus = () => {
993
+ const el = ipConRef.current;
994
+
995
+ if (!el.classList.contains(unique.focus)) {
996
+ el.classList.add(unique.focus);
997
+ openPicker();
998
+ }
999
+ };
1000
+
1001
+ const setInputValue = (time, reset, unshift = false) => {
1002
+ if (!ipRef.current) return;
1003
+ const el = ipRef.current;
1004
+ let enUnitText = locale.get() === 'en' && selected.current > 1 ? unitText + 's' : unitText;
1005
+ let tempValue = '';
1006
+
1007
+ if (!reset) {
1008
+ if (unshift) {
1009
+ tempValue = formatValue(time, displayFormat) + ' - ' + el.value + ` (${selected.current} ${enUnitText})`;
1010
+ } else {
1011
+ tempValue = el.value + ' - ' + formatValue(time, displayFormat) + ` (${selected.current} ${enUnitText})`;
1012
+ }
1013
+ } else {
1014
+ tempValue = formatValue(time, displayFormat);
1015
+ }
1016
+
1017
+ el.value = capitalizeSentenceCase(tempValue);
1018
+ clearAble && onSwap(false);
1019
+ };
1020
+
1021
+ const onClear = () => {
1022
+ if (!clearAble || !ipRef.current) return;
1023
+ ipRef.current.value = '';
1024
+ updateValues([]);
1025
+ const e = {
1026
+ value: null
1027
+ };
1028
+ !!onChange && onChange(e);
1029
+ onSwap(true);
1030
+ };
1031
+
1032
+ useEffect(() => {
1033
+ update(defaultValue);
1034
+ return () => {
1035
+ closePicker();
1036
+ };
1037
+ }, []);
1038
+ useEffect(() => {
1039
+ if (value) {
1040
+ update(value);
1041
+ closePicker();
1042
+ }
1043
+ }, [value]);
1044
+ useEffect(() => {
1045
+ if (!readOnly) {
1046
+ ipRef.current.addEventListener('focus', onInputFocus);
1047
+ }
1048
+
1049
+ return () => {
1050
+ if (!ipRef.current) return;
1051
+
1052
+ if (!readOnly) {
1053
+ ipRef.current.removeEventListener('focus', onInputFocus);
1054
+ }
1055
+ };
1056
+ }, [onChange]);
1057
+ useEffect(() => {
1058
+ if (min && min !== null) {
1059
+ let arr = new Array();
1060
+ const newMin = new Date(min).setHours(0, 0, 0, 0);
1061
+
1062
+ if (isBefore(newMin, values.current[0])) {
1063
+ arr.push(newMin);
1064
+
1065
+ if (isBefore(newMin, values.current[1])) {
1066
+ arr.push(newMin);
1067
+ } else {
1068
+ arr.push(values.current[1]);
1069
+ }
1070
+
1071
+ update(arr);
1072
+ }
1073
+ }
1074
+
1075
+ if (max && max !== null) {
1076
+ let arr = new Array();
1077
+ const newMax = max && new Date(max).setHours(0, 0, 0, 0);
1078
+
1079
+ if (isAfter(newMax, values.current[1])) {
1080
+ arr.push(newMax);
1081
+
1082
+ if (isAfter(newMax, values.current[0])) {
1083
+ arr.push(newMax);
1084
+ } else {
1085
+ arr.unshift(values.current[0]);
1086
+ }
1087
+
1088
+ update(arr);
1089
+ }
1090
+ }
1091
+ }, [max, min]);
1092
+ useEffect(() => {
1093
+ if (ipRef.current.value !== '') {
1094
+ update(values.current);
1095
+ }
1096
+
1097
+ if (disabled) {
1098
+ iconRef.current.childNodes[0].style.pointerEvents = 'none';
1099
+ closePicker();
1100
+ } else if (!readOnly) {
1101
+ ipRef.current.addEventListener('focus', onInputFocus);
1102
+ } else {
1103
+ iconRef.current.childNodes[0].style.pointerEvents = 'none';
1104
+ closePicker();
1105
+ }
1106
+
1107
+ return () => {
1108
+ if (!iconRef.current || !ipRef.current) return;
1109
+
1110
+ if (disabled) {
1111
+ iconRef.current.childNodes[0].style.pointerEvents = null;
1112
+ } else if (!readOnly) {
1113
+ ipRef.current.removeEventListener('focus', onInputFocus);
1114
+ } else {
1115
+ iconRef.current.childNodes[0].style.pointerEvents = null;
1116
+ }
1117
+
1118
+ closePicker();
1119
+ };
1120
+ }, [actionIconAt, clearAble, controls, disabled, displayFormat, max, min, pressESCToClose, readOnly, startFromZero, unitCount, viewType]);
1121
+ const iconComp = jsx("div", {
1122
+ css: iconAreaCSS,
1123
+ ref: iconRef
1124
+ }, jsx(Icon, {
1125
+ onClick: triggerFocus,
1126
+ className: `${unique.icon} ${unique.icon}-accept`,
1127
+ viewBox: true,
1128
+ name: 'CalendarNew'
1129
+ }), jsx(Icon, {
1130
+ onClick: onClear,
1131
+ className: `${unique.icon} ${unique.icon}-cancel`,
1132
+ viewBox: true,
1133
+ name: 'Close'
1134
+ }));
1135
+ const endIcon = actionIconAt === 'end' && iconComp;
1136
+ const startIcon = actionIconAt === 'start' && iconComp;
1137
+ const footerMemo = jsx("div", {
1138
+ css: controlContainerCSS,
1139
+ className: unique.footer,
1140
+ ref: footerRef
1141
+ }, jsx(Button, _extends({}, buttonProps, {
1142
+ className: unique.close,
1143
+ onClick: () => onClickOutside({
1144
+ target: null
1145
+ })
1146
+ }), closeText), jsx(Button, _extends({}, buttonProps, {
1147
+ className: unique.cancel,
1148
+ onClick: onCancel
1149
+ }), cancelText), jsx(Button, _extends({}, buttonProps, {
1150
+ color: 'info',
1151
+ className: unique.confirm,
1152
+ onClick: onConfirm
1153
+ }), confirmText));
1154
+ const leftCalendarComp = jsx("div", {
1155
+ css: generateCalendarCSS(unique, false, false)
1156
+ }, renderNavigator(unique, navigatorFromRefs, e => setPrevTime(e, 'year', valueFr.current, 'from'), e => setPrevTime(e, 'month', valueFr.current, 'from'), e => setNextTime(e, 'month', valueFr.current, 'from'), e => setNextTime(e, 'year', valueFr.current, 'from')), jsx("div", {
1157
+ className: unique.table.container
1158
+ }, jsx("table", {
1159
+ className: unique.table.table,
1160
+ ref: tableFrRef
1161
+ }, renderHeader(unique), jsx("tbody", null))));
1162
+ const rightCalendarComp = jsx("div", {
1163
+ css: generateCalendarCSS(unique, false, false)
1164
+ }, renderNavigator(unique, navigatorToRefs, e => setPrevTime(e, 'year', valueTo.current, 'to'), e => setPrevTime(e, 'month', valueTo.current, 'to'), e => setNextTime(e, 'month', valueTo.current, 'to'), e => setNextTime(e, 'year', valueTo.current, 'to')), jsx("div", {
1165
+ className: unique.table.container
1166
+ }, jsx("table", {
1167
+ className: unique.table.table,
1168
+ ref: tableToRef
1169
+ }, renderHeader(unique), jsx("tbody", null))));
1170
+ const tooltipComp = jsx("div", {
1171
+ className: unique.tooltip,
1172
+ ref: tooltipRef
1173
+ }, jsx(Typography, {
1174
+ color: theme.colors.white,
1175
+ type: 'p2'
1176
+ }));
1177
+ const pickerComp = jsx("div", {
1178
+ css: pickerCSS.container,
1179
+ ref: pickerRef
1180
+ }, jsx("div", {
1181
+ className: unique.wrapper
1182
+ }, leftCalendarComp, jsx(Divider, dividerProps), rightCalendarComp), tooltipComp, !!controls && footerMemo);
1183
+ return jsx(ControlComp, _extends({}, props, {
1184
+ disabled: disabled,
1185
+ error: error,
1186
+ ref: ref,
1187
+ style: style
1188
+ }), !!label && jsx(Label, _extends({}, labelProps, {
1189
+ disabled: disabled,
1190
+ required: required
1191
+ }), label), jsx(InputBase, _extends({
1192
+ placeholder: placeholder
1193
+ }, inputProps, {
1194
+ readOnly: true,
1195
+ ref: ipConRef,
1196
+ inputRef: ipRef,
1197
+ disabled: disabled,
1198
+ viewType: viewType,
1199
+ inputStyle: {
1200
+ textAlign: textAlign,
1201
+ textOverflow: 'ellipsis',
1202
+ ...inputStyle
1203
+ },
1204
+ startIcon: startIcon,
1205
+ startIconProps: {
1206
+ className: 'non-effect allow-disabled'
1207
+ },
1208
+ endIcon: endIcon
1209
+ })), !!error && jsx(HelperText, _extends({}, errorProps, {
1210
+ disabled: disabled
1211
+ }), error));
1212
+ }));
1213
+ DateRangePickerV2.defaultProps = {
1214
+ actionIconAt: 'end',
1215
+ clearAble: false,
1216
+ controls: false,
1217
+ unitCount: 'day',
1218
+ disabled: false,
1219
+ displayFormat: 'DD/MM/YY',
1220
+ onShowTooltip: true,
1221
+ pressESCToClose: true,
1222
+ readOnly: false,
1223
+ required: false,
1224
+ startFromZero: false,
1225
+ textAlign: 'start',
1226
+ returnFormat: 'YYYY-MM-DD',
1227
+ viewType: 'underlined'
1228
+ };
1229
+ DateRangePickerV2.propTypes = {
1230
+ /** action icons position */
1231
+ actionIconAt: PropTypes.oneOf(['end', 'start']),
1232
+
1233
+ /** display the clear icon if true */
1234
+ clearAble: PropTypes.bool,
1235
+
1236
+ /** if 'true' the calendar will have a footer controls */
1237
+ controls: PropTypes.bool,
1238
+
1239
+ /** the count unit when select */
1240
+ unitCount: PropTypes.oneOf(['day', 'night']),
1241
+
1242
+ /** the default value of the component */
1243
+ defaultValue: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.instanceOf(Date)), PropTypes.arrayOf(PropTypes.string)]),
1244
+
1245
+ /** if 'true' the form control will be disabled */
1246
+ disabled: PropTypes.bool,
1247
+
1248
+ /** format to display value */
1249
+ displayFormat: PropTypes.oneOfType([PropTypes.oneOf(['DD/MM/YYYY', 'MM/DD/YYYY', 'YYYY/MM/DD', 'DD-MM-YYYY', 'MM-DD-YYYY', 'YYYY-MM-DD']), PropTypes.string]),
1250
+
1251
+ /** error of the form control */
1252
+ error: PropTypes.string,
1253
+
1254
+ /** inputProps are properties of the input element */
1255
+ inputProps: PropTypes.object,
1256
+
1257
+ /** inputStyle is style of input element */
1258
+ inputStyle: PropTypes.object,
1259
+
1260
+ /** content of the label element */
1261
+ label: PropTypes.string,
1262
+
1263
+ /** labelProps are properties if the label element */
1264
+ labelProps: PropTypes.object,
1265
+
1266
+ /** min value of date picker */
1267
+ min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.string]),
1268
+
1269
+ /** max value of date picker */
1270
+ max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.string]),
1271
+
1272
+ /** a callback function when value input change */
1273
+ onChange: PropTypes.func,
1274
+
1275
+ /** hints for input */
1276
+ placeholder: PropTypes.string,
1277
+
1278
+ /** allow close Popup when press ESC */
1279
+ pressESCToClose: PropTypes.bool,
1280
+
1281
+ /** status read only of input */
1282
+ readOnly: PropTypes.bool,
1283
+
1284
+ /** required state of the form control */
1285
+ required: PropTypes.bool,
1286
+
1287
+ /** format of the returned value */
1288
+ returnFormat: PropTypes.oneOfType([PropTypes.oneOf(['DD/MM/YYYY', 'MM/DD/YYYY', 'YYYY/MM/DD', 'DD-MM-YYYY', 'MM-DD-YYYY', 'YYYY-MM-DD']), PropTypes.string]),
1289
+
1290
+ /** counter with start with 0 or 1 */
1291
+ startFromZero: PropTypes.bool,
1292
+
1293
+ /** style of the component */
1294
+ style: PropTypes.object,
1295
+
1296
+ /** text align of the input */
1297
+ textAlign: PropTypes.oneOf(['center', 'end', 'start']),
1298
+
1299
+ /** value of the component */
1300
+ value: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.string])),
1301
+
1302
+ /** view type of the form control */
1303
+ viewType: PropTypes.oneOf(['outlined', 'underlined'])
1304
+ };
1305
+ export default DateRangePickerV2;