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,673 @@
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 { render } from 'react-dom';
8
+ import { Button, ButtonIcon, Typography } from '../..';
9
+ import { getGlobal } from '../../../global';
10
+ import locale from '../../../locale';
11
+ import theme from '../../../theme/settings';
12
+ import { date as moment } from '../../../utils';
13
+ /**
14
+ * START STYLE
15
+ */
16
+
17
+ /**
18
+ *
19
+ * @param {Object} unique
20
+ * @param {Boolean} boxShadow
21
+ * @returns
22
+ */
23
+
24
+ const generateCalendarCSS = (unique, boxShadow = true, onClickActive = true) => css`
25
+ background-color: ${theme.colors.calendar.table.bgDefault};
26
+ border-radius : ${theme.border.radius};
27
+ box-shadow : ${boxShadow ? theme.boxShadows.large : 'none'};
28
+ box-sizing : border-box;
29
+ display : flex;
30
+ flex-direction : column;
31
+ max-width : 400px;
32
+ min-width : 260px;
33
+ width : 100%;
34
+ .${unique.navigator.navigator} {
35
+ display : flex;
36
+ flex-direction : row;
37
+ height : 28px;
38
+ justify-content: space-between;
39
+ margin : 0px 14px;
40
+ margin-top : 14px;
41
+ max-width : 400px;
42
+ width : calc(100% - 28px);
43
+ .${unique.navigator.around} {
44
+ display : flex;
45
+ flex-direction: row;
46
+ height : 28px;
47
+ user-select : none;
48
+ width : 64px;
49
+ }
50
+ .${unique.navigator.center} {
51
+ align-items: center;
52
+ display : inline-flex;
53
+ height : 28px;
54
+ margin : 0 4px;
55
+ min-width : 150px;
56
+ text-align : center;
57
+ user-select: none;
58
+ width : 100%;
59
+ button {
60
+ height: 28px;
61
+ }
62
+ .DGN-UI-Typography {
63
+ min-width : 150px;
64
+ }
65
+ }
66
+ }
67
+ .${unique.icon} {
68
+ height: 28px;
69
+ margin: 0 2px;
70
+ width : 28px;
71
+ svg, path, g {
72
+ pointer-events: none;
73
+ }
74
+ }
75
+ .${unique.table.container} {
76
+ display: flex;
77
+ margin : 10px 0;
78
+ margin-top: 6px;
79
+ width : 100%;
80
+ }
81
+ .${unique.table.table} {
82
+ border-collapse: separate;
83
+ margin : 0 16px;
84
+ padding : 0;
85
+ table-layout : fixed;
86
+ width : calc(100% - 32px);
87
+ .${unique.table.data} {
88
+ color : ${theme.colors.input};
89
+ cursor : pointer;
90
+ height : 24px;
91
+ min-width : 24px;
92
+ padding : 1px;
93
+ position : relative;
94
+ text-align : center;
95
+ user-select: none;
96
+ &:nth-of-type(7n - 1) {
97
+ color: ${theme.colors.calendar.day.saturday} !important;
98
+ }
99
+ &:nth-of-type(7n) {
100
+ color: ${theme.colors.calendar.day.sunday} !important;
101
+ }
102
+ &.next_month, &.previous_month, &.${unique.day.limit} {
103
+ cursor : default;
104
+ opacity : 0.25;
105
+ pointer-events: none;
106
+ }
107
+ &:hover {
108
+ span.${unique.day.day} {
109
+ background-color: ${theme.colors.hover};
110
+ }
111
+ }
112
+ ${onClickActive ? `&:active {
113
+ span.${unique.day.day} {
114
+ background-color: ${theme.colors.pressing};
115
+ }
116
+ }` : ''}
117
+ &.${unique.day.active} {
118
+ span.${unique.day.day} {
119
+ background-color: ${theme.colors.focus};
120
+ font-family: ${theme.typography.fontFamilyBold};
121
+ }
122
+ }
123
+ &.${unique.day.today} {
124
+ span {
125
+ border : ${theme.border.style} 1px ${theme.colors.primary};
126
+ box-sizing : border-box;
127
+ font-weight : 700;
128
+ /* text-decoration-line : underline;
129
+ text-decoration-thickness: 2px;
130
+ text-underline-offset : 1px */
131
+ }
132
+ }
133
+ &.${unique.day.between} {
134
+ opacity: 1;
135
+ &::before{
136
+ background-color: ${theme.colors.hover};
137
+ }
138
+ }
139
+ &.${unique.day.from} {
140
+ opacity: 1;
141
+ &::before{
142
+ background-color : ${theme.colors.hover};
143
+ border-bottom-left-radius: 12px;
144
+ border-top-left-radius : 12px;
145
+ left : calc((100% - 24px)/2);
146
+ }
147
+ }
148
+ &.${unique.day.to} {
149
+ opacity: 1;
150
+ &::before{
151
+ background-color : ${theme.colors.hover};
152
+ border-bottom-right-radius: 12px;
153
+ border-top-right-radius : 12px;
154
+ right : calc((100% - 24px)/2);
155
+ }
156
+ }
157
+ ::before {
158
+ position: absolute;
159
+ inset: 1px -2px;
160
+ content: '';
161
+ }
162
+ }
163
+ .${unique.table.header} {
164
+ color : ${theme.colors.label};
165
+ height : 24px;
166
+ min-width : 24px;
167
+ padding : 0;
168
+ padding-bottom: 6px;
169
+ user-select : none;
170
+ text-align : center;
171
+ &:nth-of-type(6) {
172
+ color: ${theme.colors.calendar.day.saturday} !important;
173
+ }
174
+ &:nth-of-type(7) {
175
+ color: ${theme.colors.calendar.day.sunday} !important;
176
+ }
177
+ }
178
+ }
179
+ @media only screen and (max-width: 599px) {
180
+ .${unique.navigator.navigator} {
181
+ height : 24px;
182
+ margin-top: 14px;
183
+ .${unique.navigator.center} {
184
+ height : 24px;
185
+ margin : 0;
186
+ min-width: 130px;
187
+ button {
188
+ height: 24px;
189
+ }
190
+ .DGN-UI-Typography {
191
+ font-size: 18px;
192
+ min-width: 130px;
193
+ }
194
+ }
195
+ .${unique.navigator.around} {
196
+ height: 24px;
197
+ width : 56px;
198
+ }
199
+ .${unique.icon} {
200
+ height: 24px;
201
+ margin: 0 2px;
202
+ width : 24px;
203
+ svg, path, g {
204
+ pointer-events: none;
205
+ }
206
+ }
207
+ }
208
+ .${unique.table.container} {
209
+ margin: 6px 0;
210
+ }
211
+ .${unique.table.table} {
212
+ margin: 0 10px;
213
+ width : calc(100% - 20px);
214
+ .DGN-UI-Typography {
215
+ font-size: 14px;
216
+ }
217
+ }
218
+ }
219
+ `;
220
+ /**
221
+ * END STYLE
222
+ */
223
+
224
+ /**
225
+ *
226
+ * @description return props of the typography.
227
+ * @param {String} className
228
+ * @returns {Object} props of the typography
229
+ */
230
+
231
+
232
+ const typographyProps = className => {
233
+ return {
234
+ className,
235
+ color: 'inherit',
236
+ style: {
237
+ alignItems: 'center',
238
+ borderRadius: '50%',
239
+ display: 'flex',
240
+ height: 24,
241
+ justifyContent: 'center',
242
+ margin: 'auto',
243
+ transition: 'background-color 150ms linear',
244
+ width: 24
245
+ },
246
+ type: 'h6'
247
+ };
248
+ };
249
+ /**
250
+ *
251
+ * @description return props of the button icon.
252
+ * @param {String} className
253
+ * @returns {Object} props of the button icon
254
+ */
255
+
256
+
257
+ const buttonIconProps = className => {
258
+ return {
259
+ className,
260
+ circular: true,
261
+ height: 28,
262
+ viewBox: true,
263
+ viewType: 'text',
264
+ width: 28
265
+ };
266
+ };
267
+ /**
268
+ *
269
+ * @description return props of the button icon.
270
+ * @param {Function} fn
271
+ * @returns {Object} props of the button text
272
+ */
273
+
274
+
275
+ const buttonTextProps = fn => {
276
+ return {
277
+ onClick: fn,
278
+ color: 'primary',
279
+ style: {
280
+ borderRadius: 20,
281
+ margin: 0,
282
+ padding: '2px 4px',
283
+ textTransform: 'initial',
284
+ width: '100%'
285
+ }
286
+ };
287
+ };
288
+ /**
289
+ * @description detect value is a Date object
290
+ * @param {String | Number | Array} value
291
+ * @returns boolean
292
+ */
293
+
294
+
295
+ const isValidDate = value => {
296
+ if (!!value && value !== null && !isNaN(Date.parse(new Date(value)))) {
297
+ return true;
298
+ }
299
+
300
+ ;
301
+ return false;
302
+ };
303
+ /**
304
+ *
305
+ * @description set Sunday (0) to the last day of week.
306
+ * @param {Date} date
307
+ * @returns number of day from 0 (Monday) to 6 (Sunday).
308
+ */
309
+
310
+
311
+ const getDateOfWeek = date => {
312
+ let day = date.getDay();
313
+ if (day === 0) day = 7;
314
+ return day - 1;
315
+ };
316
+ /**
317
+ *
318
+ * @description check day is today.
319
+ * @param {Date} day
320
+ * @param {Date} today
321
+ * @param {String} className
322
+ * @returns {Boolean} is today
323
+ */
324
+
325
+
326
+ const isToday = (day, today, className) => {
327
+ return +moment(day).diff(today) === 0 ? className : '';
328
+ };
329
+ /**
330
+ *
331
+ * @description check day is active day.
332
+ * @param {Date} day
333
+ * @param {Date} active
334
+ * @param {String} className
335
+ * @returns {Boolean} is active day
336
+ */
337
+
338
+
339
+ const isActive = (day, active, className) => {
340
+ if (Array.isArray(active)) {
341
+ if (+moment(day).diff(active[0]) === 0 || +moment(day).diff(active[1]) === 0) {
342
+ return className;
343
+ }
344
+ }
345
+
346
+ if (+moment(day).diff(active) === 0) {
347
+ return className;
348
+ }
349
+
350
+ return '';
351
+ };
352
+ /**
353
+ *
354
+ * @description check day is min/max day.
355
+ * @param {Date} day
356
+ * @param {Date} max
357
+ * @param {Date} min
358
+ * @param {Object} className
359
+ * @returns {Boolean} is limited day
360
+ */
361
+
362
+
363
+ const isLimit = (day, max, min, className) => {
364
+ return isBeforeLimit(min, day) || isAfterLimit(max, day) ? className : '';
365
+ };
366
+
367
+ const isBetween = (day, from, to, className) => {
368
+ if (from && isValidDate(from) && +moment(day).diff(from) === 0) {
369
+ return className.from;
370
+ }
371
+
372
+ if (to && isValidDate(to) && +moment(day).diff(to) === 0) {
373
+ return className.to;
374
+ }
375
+
376
+ if (from && to && isValidDate(from) && isValidDate(to) && +moment(day).diff(from) > 0 && +moment(day).diff(to) < 0) {
377
+ return className.between;
378
+ }
379
+
380
+ return '';
381
+ };
382
+
383
+ const isBeforeLimit = (min, time) => {
384
+ return min && isValidDate(min) && moment(time).diff(new Date(min).setHours(0, 0, 0, 0)) < 0;
385
+ };
386
+
387
+ const isAfterLimit = (max, time) => {
388
+ return max && isValidDate(max) && moment(time).diff(new Date(max).setHours(0, 0, 0, 0)) > 0;
389
+ };
390
+ /**
391
+ *
392
+ * @description return the table body of the calendar.
393
+ * @param {Date} time
394
+ * @param {Date} activeValue
395
+ * @param {Object} className
396
+ * @param {Boolean} displayAnotherMonth
397
+ * @param {Function} onTableDataClick
398
+ * @param {Date} min
399
+ * @param {Date} max
400
+ * @returns {Element}
401
+ */
402
+
403
+
404
+ const renderTableBody = (time, activeValue, className, displayAnotherMonth, onTableDataClick, min, max) => {
405
+ time = new Date(time);
406
+ const firstDay = new Date(new Date(time).setDate(1)),
407
+ lastDay = new Date(firstDay.getFullYear(), firstDay.getMonth() + 1, 0),
408
+ prevDay = new Date(firstDay.getFullYear(), firstDay.getMonth(), 0),
409
+ today = new Date().setHours(0, 0, 0, 0),
410
+ lastDate = lastDay.getDate(),
411
+ prevDate = prevDay.getDate();
412
+ let active = Array.isArray(activeValue) ? new Date(activeValue[0]) : new Date(activeValue);
413
+ let tableBody = [],
414
+ tableRaw = [],
415
+ tableData = [],
416
+ weekDateFirst = getDateOfWeek(firstDay),
417
+ weekDateLast = getDateOfWeek(lastDay);
418
+
419
+ if (activeValue && Array.isArray(activeValue) && activeValue.length === 2 && activeValue[0] !== activeValue[1]) {
420
+ /**
421
+ * days of previous month
422
+ */
423
+ active = activeValue;
424
+
425
+ for (let i = weekDateFirst; i > 0; i--) {
426
+ const day = new Date(time.getFullYear(), time.getMonth() - 1, // displayAnotherMonth ? prevDate - i + 1 : 1
427
+ 1);
428
+ tableData.push(jsx("td", {
429
+ key: `previous_month-${prevDate - i + 1}`,
430
+ "data-time": Date.parse(day) - 1
431
+ /*(displayAnotherMonth ? 0 : 1)*/
432
+ ,
433
+ className: `${[className.table.data, 'previous_month', isToday(day, today, className.day.today), isActive(day, active, className.day.active), isBetween(day, active[0], active[1], className.day)].join(' ')}`
434
+ }, jsx(Typography, typographyProps(className.day.day), '')));
435
+ }
436
+ /**
437
+ * days of this month
438
+ */
439
+
440
+
441
+ for (let i = 0; i < lastDate; i++) {
442
+ const day = new Date(time.getFullYear(), time.getMonth(), i + 1);
443
+ tableData.push(jsx("td", {
444
+ key: `this_month-${i + 1}`,
445
+ "data-time": Date.parse(day),
446
+ className: `${[className.table.data, 'this_month', isToday(day, today, className.day.today), isActive(day, active, className.day.active), isLimit(day, max, min, className.day.limit), isBetween(day, active[0], active[1], className.day)].join(' ')}`,
447
+ onClick: onTableDataClick
448
+ }, jsx(Typography, typographyProps(className.day.day), i + 1)));
449
+ }
450
+ /**
451
+ * days of next month
452
+ */
453
+
454
+
455
+ for (let i = 0; i < 20 - weekDateLast; i++) {
456
+ const day = new Date(time.getFullYear(), time.getMonth() + 1, // displayAnotherMonth ? i + 1 : 6 - weekDateLast
457
+ 6 - weekDateLast);
458
+ tableData.push(jsx("td", {
459
+ key: `next_month-${i + 1}`,
460
+ "data-time": Date.parse(day) + 1
461
+ /*(displayAnotherMonth ? 0 : 1)*/
462
+ ,
463
+ className: `${[className.table.data, 'next_month', isToday(day, today, className.day.today), isActive(day, active, className.day.active), isBetween(day, active[0], active[1], className.day)].join(' ')}`
464
+ }, jsx(Typography, typographyProps(className.day.day), '')));
465
+ }
466
+ } else {
467
+ /**
468
+ * days of previous month
469
+ */
470
+ for (let i = weekDateFirst; i > 0; i--) {
471
+ const day = new Date(time.getFullYear(), time.getMonth() - 1, displayAnotherMonth ? prevDate - i + 1 : 1);
472
+ tableData.push(jsx("td", {
473
+ key: `previous_month-${prevDate - i + 1}`,
474
+ "data-time": Date.parse(day) - (displayAnotherMonth ? 0 : 1),
475
+ className: `${[className.table.data, 'previous_month', isToday(day, today, className.day.today), isActive(day, active, className.day.active)].join(' ')}`
476
+ }, jsx(Typography, typographyProps(className.day.day), displayAnotherMonth ? prevDate - i + 1 : '')));
477
+ }
478
+ /**
479
+ * days of this month
480
+ */
481
+
482
+
483
+ for (let i = 0; i < lastDate; i++) {
484
+ const day = new Date(time.getFullYear(), time.getMonth(), i + 1);
485
+ tableData.push(jsx("td", {
486
+ key: `this_month-${i + 1}`,
487
+ "data-time": Date.parse(day),
488
+ className: `${[className.table.data, 'this_month', isToday(day, today, className.day.today), isActive(day, active, className.day.active), isLimit(day, max, min, className.day.limit)].join(' ')}`,
489
+ onClick: onTableDataClick
490
+ }, jsx(Typography, typographyProps(className.day.day), i + 1)));
491
+ }
492
+ /**
493
+ * days of next month
494
+ */
495
+
496
+
497
+ for (let i = 0; i < 20 - weekDateLast; i++) {
498
+ const day = new Date(time.getFullYear(), time.getMonth() + 1, displayAnotherMonth ? i + 1 : 6 - weekDateLast);
499
+ tableData.push(jsx("td", {
500
+ key: `next_month-${i + 1}`,
501
+ "data-time": Date.parse(day) + (displayAnotherMonth ? 0 : 1),
502
+ className: `${[className.table.data, 'next_month', isToday(day, today, className.day.today), isActive(day, active, className.day.active)].join(' ')}`
503
+ }, jsx(Typography, typographyProps(className.day.day), displayAnotherMonth ? i + 1 : '')));
504
+ }
505
+ }
506
+
507
+ for (let i = 0; i < 6; i++) {
508
+ for (let j = 0; j < 7; j++) {
509
+ tableRaw.push(tableData[7 * i + j]);
510
+ }
511
+
512
+ tableBody.push(jsx("tr", {
513
+ key: i,
514
+ className: className.day.week
515
+ }, tableRaw));
516
+ tableRaw = [];
517
+ }
518
+
519
+ return tableBody;
520
+ };
521
+ /**
522
+ *
523
+ * @param {Object} className
524
+ * @returns
525
+ */
526
+
527
+
528
+ const renderHeader = className => {
529
+ const weekdays = getGlobal(['weekdaysLong']);
530
+ const tableHeader = [];
531
+
532
+ for (let i in weekdays) {
533
+ tableHeader.push(jsx("th", {
534
+ key: i,
535
+ className: className.table.header
536
+ }, jsx(Typography, {
537
+ color: 'inherit',
538
+ type: 'h6'
539
+ }, weekdays[i])));
540
+ }
541
+
542
+ const header = jsx("thead", null, jsx("tr", {
543
+ className: className.table.raw
544
+ }, tableHeader));
545
+ return header;
546
+ };
547
+ /**
548
+ *
549
+ * @param {Object} className
550
+ * @param {Object} refs
551
+ * @param {Function} dbLeftFn
552
+ * @param {Function} leftFn
553
+ * @param {Function} rightFn
554
+ * @param {Function} dbRightFn
555
+ * @returns navigator
556
+ */
557
+
558
+
559
+ const renderNavigator = (className, refs, dbLeftFn, leftFn, rightFn, dbRightFn, fn) => jsx("div", {
560
+ className: className.navigator.navigator
561
+ }, jsx("div", {
562
+ className: className.navigator.around
563
+ }, jsx(ButtonIcon, _extends({}, buttonIconProps(className.icon), {
564
+ name: 'ArrowDoubleLeft',
565
+ onClick: dbLeftFn,
566
+ ref: refs.doubleLeft
567
+ })), jsx(ButtonIcon, _extends({}, buttonIconProps(className.icon), {
568
+ name: 'ArrowLeft',
569
+ onClick: leftFn,
570
+ ref: refs.left
571
+ }))), jsx("div", {
572
+ className: className.navigator.center
573
+ }, jsx(Button, buttonTextProps(fn), jsx(Typography, {
574
+ color: 'primary',
575
+ type: 'h3',
576
+ ref: refs.content
577
+ }))), jsx("div", {
578
+ className: className.navigator.around
579
+ }, jsx(ButtonIcon, _extends({}, buttonIconProps(className.icon), {
580
+ name: 'ArrowRight',
581
+ onClick: rightFn,
582
+ ref: refs.right
583
+ })), jsx(ButtonIcon, _extends({}, buttonIconProps(className.icon), {
584
+ name: 'ArrowDoubleRight',
585
+ onClick: dbRightFn,
586
+ ref: refs.doubleRight
587
+ }))));
588
+ /**
589
+ *
590
+ * @param {Date} time
591
+ * @returns {String} month year
592
+ */
593
+
594
+
595
+ const renderNavigatorContent = time => {
596
+ const value = new Date(time);
597
+ const months = getGlobal(['months', 'full']);
598
+ return [months[value.getMonth()], value.getFullYear()];
599
+ };
600
+ /**
601
+ *
602
+ * @param {Date} time
603
+ * @param {Object} refs
604
+ * @param {Date} min
605
+ * @param {Date} max
606
+ */
607
+
608
+
609
+ const onUpdateNavigator = (time, refs, min, max) => {
610
+ const el = refs.content.current;
611
+ const vl = renderNavigatorContent(time);
612
+ const year = locale.get() === 'vi' ? ` ${getGlobal(['year'])} ` : '';
613
+
614
+ if (el) {
615
+ el.innerHTML = `${vl[0]} ${year}${vl[1]}`;
616
+ }
617
+
618
+ const firstDayOfMin = new Date(new Date(new Date(min).setDate(1)).setHours(0, 0, 0, 0));
619
+ const firstDayOfMax = new Date(new Date(new Date(max).setDate(1)).setHours(0, 0, 0, 0));
620
+ refs.doubleLeft.current.disabled = false;
621
+ refs.doubleRight.current.disabled = false;
622
+ refs.left.current.disabled = false;
623
+ refs.right.current.disabled = false;
624
+
625
+ if (min && isValidDate(min)) {
626
+ if (moment(time).diff(firstDayOfMin) < 365) {
627
+ refs.doubleLeft.current.disabled = true;
628
+ }
629
+
630
+ if (moment(time).diff(firstDayOfMin) <= 28) {
631
+ refs.doubleLeft.current.disabled = true;
632
+ refs.left.current.disabled = true;
633
+ }
634
+ }
635
+
636
+ if (max && isValidDate(max)) {
637
+ if (moment(time).diff(firstDayOfMax) > -334) {
638
+ refs.doubleRight.current.disabled = true;
639
+ }
640
+
641
+ if (moment(time).diff(firstDayOfMax) > -1) {
642
+ refs.doubleRight.current.disabled = true;
643
+ refs.right.current.disabled = true;
644
+ }
645
+ }
646
+ };
647
+ /**
648
+ *
649
+ * @param {Date} time
650
+ * @param {Object} navigatorRefs
651
+ * @param {Date} min
652
+ * @param {Date} max
653
+ * @param {Element} table
654
+ * @param {Date} activeValue
655
+ * @param {Object} className
656
+ * @param {Boolean} displayAnotherMonth
657
+ * @param {Function} onTableDataClick
658
+ * @param {Function} onUpdateNavigatorValue
659
+ */
660
+
661
+
662
+ const onUpdateCalendar = (time, navigatorRefs, min, max, table, activeValue, className, displayAnotherMonth, onTableDataClick, onUpdateNavigatorValue) => {
663
+ onUpdateNavigator(time, navigatorRefs, min, max);
664
+ onUpdateNavigatorValue(time);
665
+
666
+ if (table) {
667
+ const child = renderTableBody(time, activeValue, className, displayAnotherMonth, onTableDataClick, min, max);
668
+ table.querySelector('tbody').remove();
669
+ render(child, table.appendChild(document.createElement('tbody')));
670
+ }
671
+ };
672
+
673
+ export { renderTableBody, renderHeader, renderNavigator, onUpdateNavigator, renderNavigatorContent, onUpdateCalendar, isBeforeLimit, isAfterLimit, isValidDate, generateCalendarCSS };