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.
- package/.browserslistrc +6 -0
- package/.eslintrc.js +91 -0
- package/.husky/pre-commit +4 -0
- package/.prettierrc +32 -0
- package/.storybook/main.js +4 -0
- package/.storybook/manager.js +10 -0
- package/.storybook/preview-head.html +17 -0
- package/.storybook/preview.js +36 -0
- package/.storybook/themeDecorator.js +19 -0
- package/babel.config.json +17 -0
- package/bitbucket-pipelines.yml +18 -0
- package/jsconfig.json +8 -0
- package/package.json +78 -44
- package/package.json.tmp +44 -0
- package/postcss.config.js +9 -0
- package/readme.md +5 -0
- package/src/assets/images/menu/dhr/MHRP15N0002.svg +17 -0
- package/src/assets/images/menu/dhr/MHRP15N0003.svg +26 -0
- package/src/components/accordion/context.js +5 -0
- package/src/components/accordion/details.js +80 -0
- package/src/components/accordion/group.js +140 -0
- package/src/components/accordion/index.js +207 -0
- package/src/components/accordion/index.stories.js +278 -0
- package/src/components/accordion/summary.js +380 -0
- package/src/components/alert/index.js +312 -0
- package/src/components/alert/index.stories.js +109 -0
- package/src/components/alert/notify.js +179 -0
- package/src/components/avatar/index.js +472 -0
- package/src/components/avatar/index.stories.js +80 -0
- package/src/components/badge/index.js +307 -0
- package/src/components/badge/index.stories.js +187 -0
- package/src/components/breadcrumb/index.js +280 -0
- package/src/components/breadcrumb/index.stories.js +69 -0
- package/src/components/button/button.stories.js +34 -0
- package/src/components/button/buttonIcon.stories.js +36 -0
- package/src/components/button/buttonMore.stories.js +58 -0
- package/src/components/button/icon.js +468 -0
- package/src/components/button/index.js +582 -0
- package/src/components/button/more.js +249 -0
- package/src/components/button/ripple-effect.js +95 -0
- package/src/components/button/sample.stories.js +194 -0
- package/src/components/card/body.js +73 -0
- package/src/components/card/extra.js +73 -0
- package/src/components/card/footer.js +73 -0
- package/src/components/card/header.js +74 -0
- package/src/components/card/index.js +256 -0
- package/src/components/card/index.stories.js +242 -0
- package/src/components/chart/Pie/Circle.js +68 -0
- package/src/components/chart/Pie/Sector.js +134 -0
- package/src/components/chart/Pie/Sectors.js +96 -0
- package/src/components/chart/Pie/index.js +312 -0
- package/src/components/chart/Pie/index.stories.js +77 -0
- package/src/components/chart/Pie-v2/Circle.js +62 -0
- package/src/components/chart/Pie-v2/Sector.js +128 -0
- package/src/components/chart/Pie-v2/Sectors.js +353 -0
- package/src/components/chart/Pie-v2/index.js +499 -0
- package/src/components/chart/Pie-v2/index.stories.js +77 -0
- package/src/components/chart/bar/Axis.js +67 -0
- package/src/components/chart/bar/Bar.js +365 -0
- package/src/components/chart/bar/Grid.js +111 -0
- package/src/components/chart/bar/Labels.js +193 -0
- package/src/components/chart/bar/Points.js +112 -0
- package/src/components/chart/bar/index.js +170 -0
- package/src/components/chart/bar/index.stories.js +174 -0
- package/src/components/chart/bar-v2/Axis.js +67 -0
- package/src/components/chart/bar-v2/Bar.js +372 -0
- package/src/components/chart/bar-v2/Grid.js +111 -0
- package/src/components/chart/bar-v2/Labels.js +193 -0
- package/src/components/chart/bar-v2/Points.js +112 -0
- package/src/components/chart/bar-v2/index.js +170 -0
- package/src/components/chart/bar-v2/index.stories.js +174 -0
- package/src/components/chart/line/Axis.js +68 -0
- package/src/components/chart/line/Grid.js +98 -0
- package/src/components/chart/line/Labels.js +191 -0
- package/src/components/chart/line/Path.js +155 -0
- package/src/components/chart/line/Point.js +358 -0
- package/src/components/chart/line/Title.js +50 -0
- package/src/components/chart/line/index.js +202 -0
- package/src/components/chart/line/index.stories.js +148 -0
- package/src/components/chart/line-v2/Axis.js +66 -0
- package/src/components/chart/line-v2/Grid.js +111 -0
- package/src/components/chart/line-v2/Labels.js +190 -0
- package/src/components/chart/line-v2/Path.js +154 -0
- package/src/components/chart/line-v2/Point.js +336 -0
- package/src/components/chart/line-v2/Title.js +50 -0
- package/src/components/chart/line-v2/index.js +172 -0
- package/src/components/chart/line-v2/index.stories.js +148 -0
- package/src/components/check-text/index.js +168 -0
- package/src/components/check-text/index.stories.js +50 -0
- package/src/components/check-text/interview-confirmation.js +169 -0
- package/src/components/check-text/interview-status.js +142 -0
- package/src/components/chip/attach.js +156 -0
- package/src/components/chip/index.js +366 -0
- package/src/components/chip/index.stories.js +190 -0
- package/src/components/collapse/index.js +104 -0
- package/src/components/collapse/index.stories.js +35 -0
- package/src/components/dialogs/colors.js +13 -0
- package/src/components/divider/index.js +87 -0
- package/src/components/divider/index.stories.js +52 -0
- package/src/components/form-control/attachment/index.js +1770 -0
- package/src/components/form-control/attachment/index.stories.js +106 -0
- package/src/components/form-control/calendar/function.js +959 -0
- package/src/components/form-control/calendar/index.js +413 -0
- package/src/components/form-control/calendar/index.stories.js +40 -0
- package/src/components/form-control/calendar/range.js +329 -0
- package/src/components/form-control/checkbox/index.js +382 -0
- package/src/components/form-control/checkbox/index.stories.js +110 -0
- package/src/components/form-control/control/index.js +99 -0
- package/src/components/form-control/date-input/DateField.js +191 -0
- package/src/components/form-control/date-input/index.js +315 -0
- package/src/components/form-control/date-input/index.stories.js +96 -0
- package/src/components/form-control/date-input/useDateInputState.js +138 -0
- package/src/components/form-control/date-input/useIsFocused.js +25 -0
- package/src/components/form-control/date-input/useKeyboardInputEvent.js +45 -0
- package/src/components/form-control/date-input/utils.js +293 -0
- package/src/components/form-control/date-picker/index.js +429 -0
- package/src/components/form-control/date-picker/index.stories.js +141 -0
- package/src/components/form-control/date-range-picker/index.js +1349 -0
- package/src/components/form-control/date-range-picker/index.stories.js +43 -0
- package/src/components/form-control/dropdown/index.js +1858 -0
- package/src/components/form-control/dropdown/index.stories.js +222 -0
- package/src/components/form-control/dropdown-box/index.js +271 -0
- package/src/components/form-control/dropdown-box/index.stories.js +103 -0
- package/src/components/form-control/form/context.js +5 -0
- package/src/components/form-control/form/index.js +39 -0
- package/src/components/form-control/form-group/index.js +131 -0
- package/src/components/form-control/form-group/index.stories.js +57 -0
- package/src/components/form-control/helper-text/index.js +92 -0
- package/src/components/form-control/helper-text/index.stories.js +29 -0
- package/src/components/form-control/input-base/UncontrolledInputBase.js +499 -0
- package/src/components/form-control/input-base/index.js +706 -0
- package/src/components/form-control/input-base/index.stories.js +69 -0
- package/src/components/form-control/label/index.js +127 -0
- package/src/components/form-control/label/index.stories.js +69 -0
- package/src/components/form-control/money-input/index.js +622 -0
- package/src/components/form-control/money-input/index.stories.js +42 -0
- package/src/components/form-control/number-input/index.js +582 -0
- package/src/components/form-control/number-input/index.stories.js +53 -0
- package/src/components/form-control/number-input/index2.js +531 -0
- package/src/components/form-control/password-input/index.js +259 -0
- package/src/components/form-control/password-input/index.stories.js +32 -0
- package/src/components/form-control/phone-input/index.js +382 -0
- package/src/components/form-control/phone-input/index.stories.js +39 -0
- package/src/components/form-control/radio/index.js +241 -0
- package/src/components/form-control/radio/index.stories.js +51 -0
- package/src/components/form-control/text-input/index.js +254 -0
- package/src/components/form-control/text-input/index.stories.js +60 -0
- package/src/components/form-control/time-picker/index.js +782 -0
- package/src/components/form-control/time-picker/index.mdx +49 -0
- package/src/components/form-control/time-picker/index.stories.js +69 -0
- package/src/components/form-control/time-picker/swiper.js +568 -0
- package/src/components/form-control/time-picker/v2/index.js +785 -0
- package/src/components/form-control/time-picker/v2/index.stories.js +43 -0
- package/src/components/form-control/toggle/index.js +247 -0
- package/src/components/form-control/toggle/index.stories.js +51 -0
- package/src/components/form-view/helper-text.js +30 -0
- package/src/components/form-view/index.js +100 -0
- package/src/components/form-view/index.stories.js +25 -0
- package/src/components/form-view/input.js +134 -0
- package/src/components/form-view/label.js +39 -0
- package/src/components/grid/Col.js +89 -0
- package/src/components/grid/Container.js +99 -0
- package/src/components/grid/Row.js +97 -0
- package/src/components/grid/context.js +5 -0
- package/src/components/grid/index.js +323 -0
- package/src/components/grid/index.stories.js +523 -0
- package/src/components/image/index.js +191 -0
- package/src/components/image/index.stories.js +53 -0
- package/src/components/index.js +157 -0
- package/src/components/list/index.stories.js +261 -0
- package/src/components/list/list-item-action.js +94 -0
- package/src/components/list/list-item-icon.js +89 -0
- package/src/components/list/list-item-text.js +69 -0
- package/src/components/list/list-item.js +131 -0
- package/src/components/list/list.js +164 -0
- package/src/components/list/sub-header.js +79 -0
- package/src/components/modal/body.js +84 -0
- package/src/components/modal/context.js +5 -0
- package/src/components/modal/footer.js +90 -0
- package/src/components/modal/header.js +145 -0
- package/src/components/modal/index.js +59 -0
- package/src/components/modal/index.stories.js +95 -0
- package/src/components/modal/modal.js +330 -0
- package/src/components/others/date/index.stories.js +217 -0
- package/src/components/others/extra/index.js +129 -0
- package/src/components/others/extra/index.mdx +39 -0
- package/src/components/others/extra/index.stories.js +17 -0
- package/src/components/others/import/index.js +66 -0
- package/src/components/others/import/index.stories.js +70 -0
- package/src/components/others/locale/index.stories.js +42 -0
- package/src/components/others/option-wrapper/index.js +34 -0
- package/src/components/others/scrollbar/index.js +106 -0
- package/src/components/others/scrollbar/index.stories.js +68 -0
- package/src/components/others/validate/index.stories.js +113 -0
- package/src/components/paging/index.stories.js +76 -0
- package/src/components/paging/page-info.js +637 -0
- package/src/components/paging/page-selector.js +437 -0
- package/src/components/paper/index.js +128 -0
- package/src/components/paper/index.stories.js +37 -0
- package/src/components/popover/body.js +98 -0
- package/src/components/popover/footer.js +96 -0
- package/src/components/popover/header.js +99 -0
- package/src/components/popover/index.js +718 -0
- package/src/components/popover/index.stories.js +189 -0
- package/src/components/popup/danger_popup.js +196 -0
- package/src/components/popup/index.js +464 -0
- package/src/components/popup/v2/index.js +556 -0
- package/src/components/popup/v2/index.stories.js +113 -0
- package/src/components/progress/circular.js +326 -0
- package/src/components/progress/index.stories.js +51 -0
- package/src/components/progress/linear.js +361 -0
- package/src/components/rating/index.js +309 -0
- package/src/components/rating/index.stories.js +78 -0
- package/src/components/skeleton/index.js +79 -0
- package/src/components/skeleton/index.stories.js +29 -0
- package/src/components/slider/index.stories.js +50 -0
- package/src/components/slider/slider-container.js +415 -0
- package/src/components/slider/slider-item.js +222 -0
- package/src/components/status/index.js +145 -0
- package/src/components/status/index.stories.js +71 -0
- package/src/components/tab/context.js +5 -0
- package/src/components/tab/index.stories.js +123 -0
- package/src/components/tab/tab-container.js +109 -0
- package/src/components/tab/tab-header.js +177 -0
- package/src/components/tab/tab-panel.js +101 -0
- package/src/components/tab/tab.js +249 -0
- package/src/components/tooltip/index.js +580 -0
- package/src/components/tooltip/index.stories.js +282 -0
- package/src/components/tooltip/portal.js +10 -0
- package/src/components/transfer/index.js +555 -0
- package/src/components/transfer/index.stories.js +53 -0
- package/src/components/tree-view/index.js +1085 -0
- package/src/components/tree-view/index.stories.js +347 -0
- package/src/components/typography/index.js +331 -0
- package/src/components/typography/index.stories.js +166 -0
- package/src/docs/changelog/changelog.md +1354 -0
- package/src/docs/changelog/index.stories.js +20 -0
- package/src/global/index.js +247 -0
- package/src/icons/basic.js +5930 -0
- package/src/icons/basic.stories.js +178 -0
- package/src/icons/effect.js +167 -0
- package/src/icons/general/clock/clock.js +16 -0
- package/src/icons/general/color-handler/background.js +34 -0
- package/src/icons/general/color-handler/text.js +34 -0
- package/src/icons/general/emoji/emoji.js +27 -0
- package/src/icons/general/font-properties/bold.js +17 -0
- package/src/icons/general/font-properties/font-family.js +27 -0
- package/src/icons/general/font-properties/font-size.js +24 -0
- package/src/icons/general/font-properties/italic.js +17 -0
- package/src/icons/general/font-properties/underline.js +26 -0
- package/src/icons/general/hyperlink/hyperlink.js +33 -0
- package/src/icons/general/indent/decrease.js +54 -0
- package/src/icons/general/indent/increase.js +54 -0
- package/src/icons/general/index.js +21 -0
- package/src/icons/general/index.mdx +68 -0
- package/src/icons/general/list/bullets.js +76 -0
- package/src/icons/general/list/numbering.js +69 -0
- package/src/icons/general/picture/picture.js +17 -0
- package/src/icons/general/steps/redo.js +17 -0
- package/src/icons/general/steps/undo.js +17 -0
- package/src/icons/general/text-align/center.js +17 -0
- package/src/icons/general/text-align/justify.js +17 -0
- package/src/icons/general/text-align/left.js +17 -0
- package/src/icons/general/text-align/right.js +17 -0
- package/src/icons/index.js +3 -0
- package/src/icons/index.stories.js +22 -0
- package/src/icons/menu/dhr.js +2625 -0
- package/src/icons/menu/erp.js +513 -0
- package/src/icons/menu/index.js +6 -0
- package/src/icons/menu/index.stories.js +107 -0
- package/src/icons/menu/v2/index.js +77 -0
- package/src/icons/menu/v2/index.stories.js +426 -0
- package/src/locale/index.js +13 -0
- package/src/scss/styles.scss +10 -0
- package/src/styles/animation.js +930 -0
- package/src/styles/animations.js +13 -0
- package/src/styles/color-helper.js +364 -0
- package/src/styles/colors.js +504 -0
- package/src/styles/colors.stories.js +105 -0
- package/src/styles/font.js +26 -0
- package/src/styles/general.js +824 -0
- package/src/styles/sx/index.js +35 -0
- package/src/styles/typography.js +181 -0
- package/src/styles/utils.js +35 -0
- package/src/theme/createBreakpoints.js +95 -0
- package/src/theme/createSpacing.js +12 -0
- package/src/theme/createTheme.js +29 -0
- package/src/theme/createZIndex.js +10 -0
- package/src/theme/docs/breakpoints.md +242 -0
- package/src/theme/docs/colors.md +64 -0
- package/src/theme/docs/components.md +32 -0
- package/src/theme/docs/darkMode.md +20 -0
- package/src/theme/docs/spacing.md +52 -0
- package/src/theme/docs/theming.md +69 -0
- package/src/theme/docs/zIndex.md +27 -0
- package/src/theme/index.js +15 -0
- package/src/theme/make-styles.js +32 -0
- package/src/theme/settings.js +816 -0
- package/src/theme/stories/breakpoints.stories.js +20 -0
- package/src/theme/stories/colors.stories.js +20 -0
- package/src/theme/stories/components.stories.js +20 -0
- package/src/theme/stories/darkMode.stories.js +20 -0
- package/src/theme/stories/spacing.stories.js +20 -0
- package/src/theme/stories/theming.stories.js +20 -0
- package/src/theme/stories/zIndex.stories.js +20 -0
- package/src/theme/theme-provider.js +101 -0
- package/src/theme/theme.js +57 -0
- package/src/theme/use-classes.js +19 -0
- package/src/theme/utils/getThemeProps.js +11 -0
- package/src/theme/utils/resolveProps.js +16 -0
- package/src/theme/utils/useThemeProps.js +8 -0
- package/src/utils/array/array.js +197 -0
- package/src/utils/classNames/index.js +28 -0
- package/src/utils/classNames/index.stories.js +61 -0
- package/src/utils/console.js +30 -0
- package/src/utils/date.js +391 -0
- package/src/utils/error/error.js +65 -0
- package/src/utils/error/errors.js +250 -0
- package/src/utils/getFileType.js +24 -0
- package/src/utils/handleBreakpoints.js +27 -0
- package/src/utils/hexToRGBA/index.js +25 -0
- package/src/utils/hexToRGBA/index.stories.js +43 -0
- package/src/utils/index.js +40 -0
- package/src/utils/intersectionObserver.js +45 -0
- package/src/utils/isMobile/index.js +22 -0
- package/src/utils/isMobile/index.stories.js +49 -0
- package/src/utils/isUndefined.js +3 -0
- package/src/utils/iterator.js +45 -0
- package/src/utils/map-parent.js +49 -0
- package/src/utils/object/deepmerge.js +129 -0
- package/src/utils/object/extend.js +55 -0
- package/src/utils/object/object.js +61 -0
- package/src/utils/parseHTML.js +20 -0
- package/src/utils/promisify.js +37 -0
- package/src/utils/randomString.js +22 -0
- package/src/utils/refMethodType.js +9 -0
- package/src/utils/refType.js +5 -0
- package/src/utils/remove-unicode.js +13 -0
- package/src/utils/render-portal.js +87 -0
- package/src/utils/renderHTML.js +17 -0
- package/src/utils/renderIcon.js +41 -0
- package/src/utils/sb-template.js +115 -0
- package/src/utils/storybook/index.js +1 -0
- package/src/utils/storybook/refArgTypes.js +46 -0
- package/src/utils/string/capitalize.js +6 -0
- package/src/utils/string/capitalizeSentenceCase.js +9 -0
- package/src/utils/string/string.js +83 -0
- package/src/utils/type.js +121 -0
- package/src/utils/updatePosition.js +27 -0
- package/src/utils/useControlled/index.js +23 -0
- package/src/utils/useDelayUnmount.js +17 -0
- package/src/utils/useElementSize.js +59 -0
- package/src/utils/useEventListener.js +54 -0
- package/src/utils/useInput.js +39 -0
- package/src/utils/useMediaQuery/index.js +50 -0
- package/src/utils/useMediaQuery/index.stories.js +55 -0
- package/src/utils/useOnClickOutside.js +28 -0
- package/src/utils/usePortal.js +54 -0
- package/src/utils/validate.js +135 -0
- package/components/accordion/context.js +0 -6
- package/components/accordion/details.js +0 -76
- package/components/accordion/group.js +0 -135
- package/components/accordion/index.js +0 -178
- package/components/accordion/summary.js +0 -324
- package/components/alert/index.js +0 -257
- package/components/alert/notify.js +0 -140
- package/components/avatar/index.js +0 -388
- package/components/badge/index.js +0 -231
- package/components/breadcrumb/index.js +0 -220
- package/components/button/icon.js +0 -357
- package/components/button/index.js +0 -444
- package/components/button/more.js +0 -210
- package/components/button/ripple-effect.js +0 -81
- package/components/card/body.js +0 -76
- package/components/card/extra.js +0 -76
- package/components/card/footer.js +0 -76
- package/components/card/header.js +0 -80
- package/components/card/index.js +0 -203
- package/components/chart/Pie/Circle.js +0 -50
- package/components/chart/Pie/Sector.js +0 -124
- package/components/chart/Pie/Sectors.js +0 -81
- package/components/chart/Pie/index.js +0 -277
- package/components/chart/Pie-v2/Circle.js +0 -48
- package/components/chart/Pie-v2/Sector.js +0 -108
- package/components/chart/Pie-v2/Sectors.js +0 -204
- package/components/chart/Pie-v2/index.js +0 -488
- package/components/chart/bar/Axis.js +0 -67
- package/components/chart/bar/Bar.js +0 -344
- package/components/chart/bar/Grid.js +0 -97
- package/components/chart/bar/Labels.js +0 -162
- package/components/chart/bar/Points.js +0 -94
- package/components/chart/bar/index.js +0 -161
- package/components/chart/bar-v2/Axis.js +0 -67
- package/components/chart/bar-v2/Bar.js +0 -354
- package/components/chart/bar-v2/Grid.js +0 -97
- package/components/chart/bar-v2/Labels.js +0 -162
- package/components/chart/bar-v2/Points.js +0 -94
- package/components/chart/bar-v2/index.js +0 -161
- package/components/chart/line/Axis.js +0 -68
- package/components/chart/line/Grid.js +0 -99
- package/components/chart/line/Labels.js +0 -160
- package/components/chart/line/Path.js +0 -154
- package/components/chart/line/Point.js +0 -343
- package/components/chart/line/Title.js +0 -52
- package/components/chart/line/index.js +0 -199
- package/components/chart/line-v2/Axis.js +0 -66
- package/components/chart/line-v2/Grid.js +0 -97
- package/components/chart/line-v2/Labels.js +0 -160
- package/components/chart/line-v2/Path.js +0 -153
- package/components/chart/line-v2/Point.js +0 -326
- package/components/chart/line-v2/Title.js +0 -52
- package/components/chart/line-v2/index.js +0 -165
- package/components/check-text/index.js +0 -155
- package/components/check-text/interview-confirmation.js +0 -171
- package/components/check-text/interview-status.js +0 -137
- package/components/chip/attach.js +0 -167
- package/components/chip/index.js +0 -275
- package/components/collapse/index.js +0 -93
- package/components/dialogs/colors.js +0 -13
- package/components/divider/index.js +0 -89
- package/components/form-control/attachment/index.js +0 -1537
- package/components/form-control/calendar/function.js +0 -752
- package/components/form-control/calendar/index.js +0 -317
- package/components/form-control/calendar/range.js +0 -291
- package/components/form-control/checkbox/index.js +0 -329
- package/components/form-control/control/index.js +0 -91
- package/components/form-control/date-input/DateField.js +0 -187
- package/components/form-control/date-input/index.js +0 -292
- package/components/form-control/date-input/useDateInputState.js +0 -129
- package/components/form-control/date-input/useIsFocused.js +0 -20
- package/components/form-control/date-input/useKeyboardInputEvent.js +0 -45
- package/components/form-control/date-input/utils.js +0 -290
- package/components/form-control/date-picker/index.js +0 -357
- package/components/form-control/date-range-picker/index.js +0 -1183
- package/components/form-control/dropdown/index.js +0 -1624
- package/components/form-control/dropdown-box/index.js +0 -238
- package/components/form-control/form/context.js +0 -5
- package/components/form-control/form/index.js +0 -40
- package/components/form-control/form-group/index.js +0 -117
- package/components/form-control/helper-text/index.js +0 -88
- package/components/form-control/input-base/UncontrolledInputBase.js +0 -450
- package/components/form-control/input-base/index.js +0 -646
- package/components/form-control/label/index.js +0 -117
- package/components/form-control/money-input/index.js +0 -513
- package/components/form-control/number-input/index.js +0 -582
- package/components/form-control/number-input/index2.js +0 -481
- package/components/form-control/password-input/index.js +0 -242
- package/components/form-control/phone-input/index.js +0 -364
- package/components/form-control/radio/index.js +0 -224
- package/components/form-control/text-input/index.js +0 -239
- package/components/form-control/time-picker/index.js +0 -781
- package/components/form-control/time-picker/swiper.js +0 -540
- package/components/form-control/time-picker/v2/index.js +0 -809
- package/components/form-control/toggle/index.js +0 -222
- package/components/form-view/helper-text.js +0 -33
- package/components/form-view/index.js +0 -95
- package/components/form-view/input.js +0 -117
- package/components/form-view/label.js +0 -37
- package/components/grid/Col.js +0 -91
- package/components/grid/Container.js +0 -85
- package/components/grid/Row.js +0 -81
- package/components/grid/context.js +0 -3
- package/components/grid/index.js +0 -251
- package/components/image/index.js +0 -170
- package/components/index.js +0 -156
- package/components/list/list-item-action.js +0 -82
- package/components/list/list-item-icon.js +0 -71
- package/components/list/list-item-text.js +0 -56
- package/components/list/list-item.js +0 -108
- package/components/list/list.js +0 -149
- package/components/list/sub-header.js +0 -63
- package/components/modal/body.js +0 -74
- package/components/modal/context.js +0 -6
- package/components/modal/footer.js +0 -78
- package/components/modal/header.js +0 -128
- package/components/modal/index.js +0 -63
- package/components/modal/modal.js +0 -292
- package/components/others/extra/index.js +0 -116
- package/components/others/import/index.js +0 -71
- package/components/others/option-wrapper/index.js +0 -39
- package/components/others/scrollbar/index.js +0 -94
- package/components/paging/page-info.js +0 -582
- package/components/paging/page-selector.js +0 -381
- package/components/paper/index.js +0 -112
- package/components/popover/body.js +0 -86
- package/components/popover/footer.js +0 -84
- package/components/popover/header.js +0 -88
- package/components/popover/index.js +0 -663
- package/components/popup/danger_popup.js +0 -189
- package/components/popup/index.js +0 -414
- package/components/popup/v2/index.js +0 -398
- package/components/progress/circular.js +0 -296
- package/components/progress/linear.js +0 -324
- package/components/rating/index.js +0 -243
- package/components/skeleton/index.js +0 -79
- package/components/slider/slider-container.js +0 -340
- package/components/slider/slider-item.js +0 -205
- package/components/status/index.js +0 -111
- package/components/tab/context.js +0 -3
- package/components/tab/tab-container.js +0 -100
- package/components/tab/tab-header.js +0 -160
- package/components/tab/tab-panel.js +0 -91
- package/components/tab/tab.js +0 -210
- package/components/tooltip/index.js +0 -522
- package/components/tooltip/portal.js +0 -11
- package/components/transfer/index.js +0 -434
- package/components/tree-view/index.js +0 -1017
- package/components/typography/index.js +0 -193
- package/css/styles.css +0 -1
- package/css/styles.css.map +0 -1
- package/global/index.js +0 -194
- package/icons/basic.js +0 -7864
- package/icons/effect.js +0 -131
- package/icons/general/clock/clock.js +0 -20
- package/icons/general/color-handler/background.js +0 -40
- package/icons/general/color-handler/text.js +0 -40
- package/icons/general/emoji/emoji.js +0 -34
- package/icons/general/font-properties/bold.js +0 -20
- package/icons/general/font-properties/font-family.js +0 -34
- package/icons/general/font-properties/font-size.js +0 -26
- package/icons/general/font-properties/italic.js +0 -20
- package/icons/general/font-properties/underline.js +0 -30
- package/icons/general/hyperlink/hyperlink.js +0 -37
- package/icons/general/indent/decrease.js +0 -54
- package/icons/general/indent/increase.js +0 -54
- package/icons/general/index.js +0 -21
- package/icons/general/list/bullets.js +0 -76
- package/icons/general/list/numbering.js +0 -70
- package/icons/general/picture/picture.js +0 -20
- package/icons/general/steps/redo.js +0 -20
- package/icons/general/steps/undo.js +0 -20
- package/icons/general/text-align/center.js +0 -20
- package/icons/general/text-align/justify.js +0 -20
- package/icons/general/text-align/left.js +0 -20
- package/icons/general/text-align/right.js +0 -20
- package/icons/index.js +0 -3
- package/icons/menu/dhr.js +0 -2442
- package/icons/menu/erp.js +0 -491
- package/icons/menu/index.js +0 -5
- package/icons/menu/v2/index.js +0 -71
- package/locale/index.js +0 -11
- package/styles/animation.js +0 -848
- package/styles/animations.js +0 -13
- package/styles/color-helper.js +0 -343
- package/styles/colors.js +0 -476
- package/styles/font.js +0 -24
- package/styles/general.js +0 -568
- package/styles/sx/index.js +0 -28
- package/styles/typography.js +0 -156
- package/styles/utils.js +0 -35
- package/theme/createBreakpoints.js +0 -82
- package/theme/createSpacing.js +0 -10
- package/theme/createTheme.js +0 -26
- package/theme/createZIndex.js +0 -9
- package/theme/index.js +0 -14
- package/theme/make-styles.js +0 -30
- package/theme/settings.js +0 -861
- package/theme/theme-provider.js +0 -102
- package/theme/theme.js +0 -57
- package/theme/use-classes.js +0 -15
- package/theme/utils/getThemeProps.js +0 -12
- package/theme/utils/resolveProps.js +0 -17
- package/theme/utils/useThemeProps.js +0 -14
- package/utils/array/array.js +0 -169
- package/utils/classNames/index.js +0 -25
- package/utils/console.js +0 -27
- package/utils/date.js +0 -401
- package/utils/error/error.js +0 -53
- package/utils/error/errors.js +0 -200
- package/utils/getFileType.js +0 -23
- package/utils/handleBreakpoints.js +0 -25
- package/utils/hexToRGBA/index.js +0 -23
- package/utils/index.js +0 -38
- package/utils/intersectionObserver.js +0 -37
- package/utils/isMobile/index.js +0 -21
- package/utils/isUndefined.js +0 -2
- package/utils/iterator.js +0 -36
- package/utils/map-parent.js +0 -46
- package/utils/object/deepmerge.js +0 -103
- package/utils/object/extend.js +0 -47
- package/utils/object/object.js +0 -54
- package/utils/parseHTML.js +0 -18
- package/utils/promisify.js +0 -34
- package/utils/randomString.js +0 -26
- package/utils/refMethodType.js +0 -6
- package/utils/refType.js +0 -5
- package/utils/remove-unicode.js +0 -5
- package/utils/render-portal.js +0 -87
- package/utils/renderHTML.js +0 -18
- package/utils/renderIcon.js +0 -53
- package/utils/sb-template.js +0 -113
- package/utils/storybook/index.js +0 -1
- package/utils/storybook/refArgTypes.js +0 -41
- package/utils/string/capitalize.js +0 -3
- package/utils/string/capitalizeSentenceCase.js +0 -8
- package/utils/string/string.js +0 -60
- package/utils/type.js +0 -69
- package/utils/updatePosition.js +0 -35
- package/utils/useControlled/index.js +0 -14
- package/utils/useDelayUnmount.js +0 -15
- package/utils/useElementSize.js +0 -55
- package/utils/useEventListener.js +0 -51
- package/utils/useInput.js +0 -33
- package/utils/useMediaQuery/index.js +0 -44
- package/utils/useOnClickOutside.js +0 -21
- package/utils/usePortal.js +0 -49
- package/utils/validate.js +0 -135
- /package/{assets → src/assets}/avatar/default.svg +0 -0
- /package/{assets → src/assets}/fonts/SF-Pro-Display-Bold.otf +0 -0
- /package/{assets → src/assets}/fonts/SF-Pro-Display-Medium.otf +0 -0
- /package/{assets → src/assets}/fonts/SF-Pro-Display-Regular.otf +0 -0
- /package/{assets → src/assets}/fonts/text-security-disc-compat.eot +0 -0
- /package/{assets → src/assets}/fonts/text-security-disc-compat.ttf +0 -0
- /package/{assets → src/assets}/fonts/text-security-disc-compat.woff2 +0 -0
- /package/{assets → src/assets}/fonts/text-security-disc.woff2 +0 -0
- /package/{assets → src/assets}/image/default.png +0 -0
- /package/{assets → src/assets}/images/icons/wifi.svg +0 -0
- /package/{assets → src/assets}/images/menu/bem/WA3F0100.svg +0 -0
- /package/{assets → src/assets}/images/menu/bem/WA3F1025.svg +0 -0
- /package/{assets → src/assets}/images/menu/bem/WA3F2000.svg +0 -0
- /package/{assets → src/assets}/images/menu/bem/WA3F2020.svg +0 -0
- /package/{assets → src/assets}/images/menu/bem/WA3F2030.svg +0 -0
- /package/{assets → src/assets}/images/menu/bem/WA3F2040.svg +0 -0
- /package/{assets → src/assets}/images/menu/bem/WA3F2100.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/ALL.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/D00.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/D09.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/D13.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/D15.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/D21.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/D25.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/D29.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/D38.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/D39.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/D51.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/D52.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/D77.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/D84.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/D89.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/Default.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/MAHR21N0000.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/MAHR29N0001.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/MAHR29N0002.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/MAHR29N0003.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/MAHR29N0004.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/MAHR29N0011.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/MAHR29N0012.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/MAHR29N0013.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/MAHR75N0005.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/MAHR75N0006.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/MAHR75N0007.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/MAHR75N0008.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/MAHR75N0009.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/MAHR75N0010.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/MAHR89N0014.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/MAHR89N0015.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/MHRM00N0001.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/MHRM00N0002.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/MHRM00N0003.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/MHRM00N0004.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/MHRM00N0005.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/MHRM00N0006.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/MHRM00N0007.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/MHRM09N0001.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/MHRM09N0002.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/MHRM09N0003.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/MHRM09N0004.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/MHRM09N0005.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/MHRM09N1010.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/MHRM09N1015.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/MHRM09N1020.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/MHRM09N1025.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/MHRM09N1030.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/MHRM09N1035.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/MHRM09N1040.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/MHRM09N1400.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/MHRM13N0001.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/MHRM13N0002.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/MHRM13N0003.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/MHRM13N0004.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/MHRM15N0001.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/MHRM25N0001.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/MHRM29N0001.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/MHRM29N0002.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/MHRM29N0003.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/MHRM29N0004.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/MHRM29N0005.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/MHRM29N0015.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/MHRM38N0001.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/MHRM38N0002.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/MHRM38N0003.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/MHRM39N0012.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/MHRM39N0013.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/MHRM39N0014.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/MHRM39N0015.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/MHRM39N0016.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/MHRM39N0017.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/MHRM39N0018.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/MHRM39N0019.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/MHRM39N0020.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/MHRM39N0021.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/MHRM39N0022.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/MHRM39N0023.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/MHRM51N0005.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/MHRM51N0006.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/MHRM51N0007.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/MHRM77N0001.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/MHRM77N0003.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/MHRM82N0001.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/MHRM82N0002.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/MHRM84N0001.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/MHRM84N0002.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/MHRM89N0001.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/MHRM89N0002.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/MHRP00N0001.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/MHRP09N0001.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/MHRP09N0002.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/MHRP09N0003.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/MHRP09N0004.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/MHRP09N0005.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/MHRP09N0006.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/MHRP09N0007.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/MHRP09N0008.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/MHRP09N0009.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/MHRP09N0010.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/MHRP09N0011.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/MHRP09N0012.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/MHRP09N0013.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/MHRP09N0014.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/MHRP09N0015.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/MHRP09N0016.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/MHRP09N0017.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/MHRP09N0018.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/MHRP09N0019.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/MHRP09N0020.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/MHRP09N0021.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/MHRP09N0022.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/MHRP09N0023.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/MHRP09N0024.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/MHRP09N0025.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/MHRP09N0026.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/MHRP09N0027.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/MHRP09N0028.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/MHRP09N0029.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/MHRP09N0030.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/MHRP09N0031.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/MHRP09N0032.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/MHRP09N0033.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/MHRP09N0034.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/MHRP09N0035.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/MHRP13N0001.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/MHRP13N0005.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/MHRP13N0006.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/MHRP21N0001.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/MHRP21N0002.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/MHRP25L0101.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/MHRP25L0501.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/MHRP25N0001.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/MHRP25N0002.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/MHRP25N0003.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/MHRP25N0004.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/MHRP25N0005.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/MHRP29N0001.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/MHRP29N0002.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/MHRP29N0003.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/MHRP29N0004.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/MHRP29N0005.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/MHRP29N0006.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/MHRP29N0007.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/MHRP29N0008.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/MHRP29N0009.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/MHRP29N0010.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/MHRP29N0011.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/MHRP29N0012.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/MHRP29N0013.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/MHRP29N0014.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/MHRP29N0016.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/MHRP29N0017.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/MHRP29N0018.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/MHRP29N0019.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/MHRP29N0020.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/MHRP29N0021.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/MHRP29N0022.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/MHRP29N0023.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/MHRP29N0026.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/MHRP29N0027.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/MHRP29N0028.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/MHRP29N0029.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/MHRP29N0030.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/MHRP38N0001.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/MHRP38N0002.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/MHRP39N0001.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/MHRP39N0002.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/MHRP39N0003.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/MHRP39N0004.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/MHRP39N0005.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/MHRP39N0006.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/MHRP39N0007.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/MHRP39N0008.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/MHRP39N0009.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/MHRP39N0010.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/MHRP39N0011.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/MHRP39N0013.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/MHRP39N0014.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/MHRP39N0015.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/MHRP39N0017.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/MHRP39N0018.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/MHRP39N0019.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/MHRP39N0020.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/MHRP39N0021.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/MHRP39N1222.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/MHRP51N0001.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/MHRP51N0002.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/MHRP51N0003.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/MHRP51N0004.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/MHRP52N0001.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/MHRP52N0002.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/MHRP52N0003.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/MHRP75N0001.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/MHRP75N0002.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/MHRP75N0003.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/MHRP75N0006.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/MHRP75N0007.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/MHRP75N0008.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/MHRP77N0007.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/MHRP77N0008.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/MHRP77N0009.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/MHRP77N0010.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/MHRP77N0011.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/MHRP89N1000.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/MHRP89N1001.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/TASK.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/W00F0001.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/W00F0002.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/W00F0003.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/W00F0004.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/W00F0005.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/W09F2000-WEB5.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/W09F2000.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/W09F2002-WEB5.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/W09F2005-WEB5.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/W09F2020-WEB5.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/W09F2022-WEB5.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/W09F2150-WEB5.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/W09F2152-WEB5.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/W09F2160-WEB5.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/W09F2162-WEB5.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/W29F4006-WEB5.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/W75F2260-WEB5.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/W75F2261-WEB5.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/W75F3005-WEB5.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/W75F4070-WEB5.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/W75F4071-WEB5.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/W75F4100-WEB5.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/W77F1011.svg +0 -0
- /package/{assets → src/assets}/images/menu/dhr/W77F1013.svg +0 -0
- /package/{assets → src/assets}/images/menu/eo/W00F0001.svg +0 -0
- /package/{assets → src/assets}/images/menu/eo/W00F0002.svg +0 -0
- /package/{assets → src/assets}/images/menu/eo/W00F0003.svg +0 -0
- /package/{assets → src/assets}/images/menu/eo/W00F0004.svg +0 -0
- /package/{assets → src/assets}/images/menu/eo/WEO76APP0001.svg +0 -0
- /package/{assets → src/assets}/images/menu/eo/WEO76APP0002.svg +0 -0
- /package/{assets → src/assets}/images/menu/eo/WEO76LIS0001.svg +0 -0
- /package/{assets → src/assets}/images/menu/eo/WEO76LIS0002.svg +0 -0
- /package/{assets → src/assets}/images/menu/eo/WEO76LIS0003.svg +0 -0
- /package/{assets → src/assets}/images/menu/eo/WEO76LIS0004.svg +0 -0
- /package/{assets → src/assets}/images/menu/eo/WEO76LIS0005.svg +0 -0
- /package/{assets → src/assets}/images/menu/eo/WEO76LIS0006.svg +0 -0
- /package/{assets → src/assets}/images/menu/eo/WEO76LIS0007.svg +0 -0
- /package/{assets → src/assets}/images/menu/eo/WEO76REQ0001.svg +0 -0
- /package/{assets → src/assets}/images/menu/eo/WEO76REQ0002.svg +0 -0
- /package/{assets → src/assets}/images/menu/eo/WEO76REQ0003.svg +0 -0
- /package/{assets → src/assets}/images/menu/eo/WEO76TRA0001.svg +0 -0
- /package/{assets → src/assets}/images/menu/eo/WTM76ACC0001.svg +0 -0
- /package/{assets → src/assets}/images/menu/eo/WTM76INF0001.svg +0 -0
- /package/{assets → src/assets}/images/menu/eo/WTM76PRO0001.svg +0 -0
- /package/{assets → src/assets}/images/menu/eo/WTM76SYS0001.svg +0 -0
- /package/{assets → src/assets}/images/menu/erp/D05.svg +0 -0
- /package/{assets → src/assets}/images/menu/erp/D06.svg +0 -0
- /package/{assets → src/assets}/images/menu/erp/D90R.svg +0 -0
- /package/{assets → src/assets}/images/menu/erp/DBC.svg +0 -0
- /package/{assets → src/assets}/images/menu/erp/W00F0001.svg +0 -0
- /package/{assets → src/assets}/images/menu/erp/W00F0002.svg +0 -0
- /package/{assets → src/assets}/images/menu/erp/W00F0003.svg +0 -0
- /package/{assets → src/assets}/images/menu/erp/W00F0004.svg +0 -0
- /package/{assets → src/assets}/images/menu/erp/W05F0001.svg +0 -0
- /package/{assets → src/assets}/images/menu/erp/W05F0001N0000.svg +0 -0
- /package/{assets → src/assets}/images/menu/erp/W05F0004N0000.svg +0 -0
- /package/{assets → src/assets}/images/menu/erp/W05F0006N0000.svg +0 -0
- /package/{assets → src/assets}/images/menu/erp/W05F0007N0000.svg +0 -0
- /package/{assets → src/assets}/images/menu/erp/W05F0008N0000.svg +0 -0
- /package/{assets → src/assets}/images/menu/erp/W05F0011N0000.svg +0 -0
- /package/{assets → src/assets}/images/menu/erp/W05F0013N0000.svg +0 -0
- /package/{assets → src/assets}/images/menu/erp/W05F4000N0000.svg +0 -0
- /package/{assets → src/assets}/images/menu/erp/W06F0001.svg +0 -0
- /package/{assets → src/assets}/images/menu/erp/W06F0001N0000.svg +0 -0
- /package/{assets → src/assets}/images/menu/erp/W06F0004N0000.svg +0 -0
- /package/{assets → src/assets}/images/menu/erp/W06F0005N0000.svg +0 -0
- /package/{assets → src/assets}/images/menu/erp/W06F0006N0000.svg +0 -0
- /package/{assets → src/assets}/images/menu/erp/W06F0008N0000.svg +0 -0
- /package/{assets → src/assets}/images/menu/erp/W94F1000N0000.svg +0 -0
- /package/{assets → src/assets}/images/menu/erp/W94F1000N0001.svg +0 -0
- /package/{assets → src/assets}/images/menu/erp/WA3F1025.svg +0 -0
- /package/{assets → src/assets}/images/menu/erp/WA3F2100.svg +0 -0
- /package/{assets → src/assets}/storybook/avatar01.svg +0 -0
- /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;
|