diginet-core-ui 1.4.39 → 1.4.40

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