@jetbrains/ring-ui-built 6.0.1
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/LICENSE.txt +202 -0
- package/README.md +103 -0
- package/components/_helpers/_rollupPluginBabelHelpers.js +648 -0
- package/components/_helpers/anchor.js +31 -0
- package/components/_helpers/badge.js +3 -0
- package/components/_helpers/button__classes.js +34 -0
- package/components/_helpers/caption.js +31 -0
- package/components/_helpers/card.js +132 -0
- package/components/_helpers/date-picker.js +3 -0
- package/components/_helpers/dialog__body-scroll-preventer.js +54 -0
- package/components/_helpers/grid.js +3 -0
- package/components/_helpers/header.js +3 -0
- package/components/_helpers/heading.js +3 -0
- package/components/_helpers/icon__svg.js +75 -0
- package/components/_helpers/input.js +235 -0
- package/components/_helpers/island.js +3 -0
- package/components/_helpers/link.js +3 -0
- package/components/_helpers/list.js +3 -0
- package/components/_helpers/query-assist__suggestions.js +102 -0
- package/components/_helpers/select__filter.js +94 -0
- package/components/_helpers/services-link.js +48 -0
- package/components/_helpers/sidebar.js +123 -0
- package/components/_helpers/tab-link.js +34 -0
- package/components/_helpers/table.js +3 -0
- package/components/_helpers/theme.js +95 -0
- package/components/_helpers/title.js +103 -0
- package/components/alert/alert.d.ts +113 -0
- package/components/alert/alert.js +294 -0
- package/components/alert/container.d.ts +15 -0
- package/components/alert/container.js +52 -0
- package/components/alert-service/alert-service.d.ts +36 -0
- package/components/alert-service/alert-service.js +220 -0
- package/components/analytics/analytics.d.ts +18 -0
- package/components/analytics/analytics.js +31 -0
- package/components/analytics/analytics__custom-plugin.d.ts +28 -0
- package/components/analytics/analytics__custom-plugin.js +89 -0
- package/components/auth/auth.d.ts +3 -0
- package/components/auth/auth.js +133 -0
- package/components/auth/auth__core.d.ts +236 -0
- package/components/auth/auth__core.js +1653 -0
- package/components/auth/background-flow.d.ts +31 -0
- package/components/auth/background-flow.js +147 -0
- package/components/auth/down-notification.d.ts +15 -0
- package/components/auth/down-notification.js +157 -0
- package/components/auth/iframe-flow.d.ts +20 -0
- package/components/auth/iframe-flow.js +196 -0
- package/components/auth/request-builder.d.ts +48 -0
- package/components/auth/request-builder.js +104 -0
- package/components/auth/response-parser.d.ts +70 -0
- package/components/auth/response-parser.js +138 -0
- package/components/auth/storage.d.ts +112 -0
- package/components/auth/storage.js +429 -0
- package/components/auth/token-validator.d.ts +93 -0
- package/components/auth/token-validator.js +269 -0
- package/components/auth/window-flow.d.ts +26 -0
- package/components/auth/window-flow.js +154 -0
- package/components/auth-dialog/auth-dialog.d.ts +60 -0
- package/components/auth-dialog/auth-dialog.js +221 -0
- package/components/auth-dialog-service/auth-dialog-service.d.ts +6 -0
- package/components/auth-dialog-service/auth-dialog-service.js +92 -0
- package/components/avatar/avatar-example-datauri.d.ts +1 -0
- package/components/avatar/avatar-example-datauri.js +4 -0
- package/components/avatar/avatar.d.ts +52 -0
- package/components/avatar/avatar.js +183 -0
- package/components/avatar/fallback-avatar.d.ts +17 -0
- package/components/avatar/fallback-avatar.js +151 -0
- package/components/badge/badge.d.ts +24 -0
- package/components/badge/badge.js +59 -0
- package/components/button/button.d.ts +67 -0
- package/components/button/button.js +131 -0
- package/components/button/button__classes.d.ts +2 -0
- package/components/button/button__classes.js +2 -0
- package/components/button-group/button-group.d.ts +18 -0
- package/components/button-group/button-group.js +48 -0
- package/components/button-group/caption.d.ts +8 -0
- package/components/button-group/caption.js +5 -0
- package/components/button-set/button-set.d.ts +16 -0
- package/components/button-set/button-set.js +47 -0
- package/components/button-toolbar/button-toolbar.d.ts +16 -0
- package/components/button-toolbar/button-toolbar.js +46 -0
- package/components/caret/caret.d.ts +66 -0
- package/components/caret/caret.js +259 -0
- package/components/checkbox/checkbox.d.ts +45 -0
- package/components/checkbox/checkbox.js +130 -0
- package/components/clipboard/clipboard-fallback.d.ts +2 -0
- package/components/clipboard/clipboard-fallback.js +42 -0
- package/components/clipboard/clipboard.d.ts +5 -0
- package/components/clipboard/clipboard.js +185 -0
- package/components/code/code.d.ts +44 -0
- package/components/code/code.js +191 -0
- package/components/confirm/confirm.d.ts +48 -0
- package/components/confirm/confirm.js +153 -0
- package/components/confirm-service/confirm-service.d.ts +21 -0
- package/components/confirm-service/confirm-service.js +141 -0
- package/components/content-layout/content-layout.d.ts +26 -0
- package/components/content-layout/content-layout.js +79 -0
- package/components/content-layout/sidebar.d.ts +31 -0
- package/components/content-layout/sidebar.js +7 -0
- package/components/contenteditable/contenteditable.d.ts +47 -0
- package/components/contenteditable/contenteditable.js +84 -0
- package/components/control-label/control-label.d.ts +11 -0
- package/components/control-label/control-label.js +36 -0
- package/components/data-list/data-list.d.ts +85 -0
- package/components/data-list/data-list.js +251 -0
- package/components/data-list/data-list.mock.d.ts +16 -0
- package/components/data-list/data-list.mock.js +192 -0
- package/components/data-list/item.d.ts +50 -0
- package/components/data-list/item.js +235 -0
- package/components/data-list/selection.d.ts +16 -0
- package/components/data-list/selection.js +148 -0
- package/components/data-list/title.d.ts +26 -0
- package/components/data-list/title.js +28 -0
- package/components/date-picker/consts.d.ts +98 -0
- package/components/date-picker/consts.js +46 -0
- package/components/date-picker/date-input.d.ts +47 -0
- package/components/date-picker/date-input.js +177 -0
- package/components/date-picker/date-picker.d.ts +77 -0
- package/components/date-picker/date-picker.js +404 -0
- package/components/date-picker/date-popup.d.ts +55 -0
- package/components/date-picker/date-popup.js +488 -0
- package/components/date-picker/day.d.ts +30 -0
- package/components/date-picker/day.js +133 -0
- package/components/date-picker/formats.d.ts +2 -0
- package/components/date-picker/formats.js +3 -0
- package/components/date-picker/month-names.d.ts +13 -0
- package/components/date-picker/month-names.js +110 -0
- package/components/date-picker/month-slider.d.ts +29 -0
- package/components/date-picker/month-slider.js +93 -0
- package/components/date-picker/month.d.ts +14 -0
- package/components/date-picker/month.js +58 -0
- package/components/date-picker/months.d.ts +11 -0
- package/components/date-picker/months.js +133 -0
- package/components/date-picker/weekdays.d.ts +13 -0
- package/components/date-picker/weekdays.js +39 -0
- package/components/date-picker/years.d.ts +25 -0
- package/components/date-picker/years.js +134 -0
- package/components/dialog/dialog.d.ts +64 -0
- package/components/dialog/dialog.js +240 -0
- package/components/dialog/dialog__body-scroll-preventer.d.ts +9 -0
- package/components/dialog/dialog__body-scroll-preventer.js +6 -0
- package/components/dropdown/anchor.d.ts +11 -0
- package/components/dropdown/anchor.js +24 -0
- package/components/dropdown/dropdown.d.ts +87 -0
- package/components/dropdown/dropdown.js +247 -0
- package/components/dropdown-menu/dropdown-menu.d.ts +36 -0
- package/components/dropdown-menu/dropdown-menu.js +199 -0
- package/components/editable-heading/editable-heading.d.ts +32 -0
- package/components/editable-heading/editable-heading.js +276 -0
- package/components/error-bubble/error-bubble.d.ts +18 -0
- package/components/error-bubble/error-bubble.js +88 -0
- package/components/error-message/error-message.d.ts +27 -0
- package/components/error-message/error-message.js +78 -0
- package/components/footer/footer.d.ts +28 -0
- package/components/footer/footer.js +118 -0
- package/components/global/compose.d.ts +7 -0
- package/components/global/compose.js +17 -0
- package/components/global/composeRefs.d.ts +3 -0
- package/components/global/composeRefs.js +19 -0
- package/components/global/controls-height.d.ts +9 -0
- package/components/global/controls-height.js +19 -0
- package/components/global/create-stateful-context.d.ts +27 -0
- package/components/global/create-stateful-context.js +49 -0
- package/components/global/data-tests.d.ts +3 -0
- package/components/global/data-tests.js +30 -0
- package/components/global/dom.d.ts +37 -0
- package/components/global/dom.js +151 -0
- package/components/global/focus-sensor-hoc.d.ts +19 -0
- package/components/global/focus-sensor-hoc.js +165 -0
- package/components/global/fuzzy-highlight.d.ts +11 -0
- package/components/global/fuzzy-highlight.js +90 -0
- package/components/global/get-event-key.d.ts +2 -0
- package/components/global/get-event-key.js +101 -0
- package/components/global/get-uid.d.ts +1 -0
- package/components/global/get-uid.js +22 -0
- package/components/global/inject-styles.d.ts +3 -0
- package/components/global/inject-styles.js +22 -0
- package/components/global/linear-function.d.ts +6 -0
- package/components/global/linear-function.js +15 -0
- package/components/global/listeners.d.ts +8 -0
- package/components/global/listeners.js +58 -0
- package/components/global/memoize.d.ts +1 -0
- package/components/global/memoize.js +23 -0
- package/components/global/normalize-indent.d.ts +1 -0
- package/components/global/normalize-indent.js +60 -0
- package/components/global/promise-with-timeout.d.ts +5 -0
- package/components/global/promise-with-timeout.js +19 -0
- package/components/global/prop-types.d.ts +4 -0
- package/components/global/prop-types.js +9 -0
- package/components/global/react-dom-renderer.d.ts +16 -0
- package/components/global/react-dom-renderer.js +54 -0
- package/components/global/react-render-adapter.d.ts +1 -0
- package/components/global/react-render-adapter.js +6 -0
- package/components/global/rerender-hoc.d.ts +10 -0
- package/components/global/rerender-hoc.js +46 -0
- package/components/global/schedule-raf.d.ts +1 -0
- package/components/global/schedule-raf.js +28 -0
- package/components/global/sniffer.d.ts +3 -0
- package/components/global/sniffer.js +6 -0
- package/components/global/theme.d.ts +21 -0
- package/components/global/theme.js +42 -0
- package/components/global/trivial-template-tag.d.ts +1 -0
- package/components/global/trivial-template-tag.js +21 -0
- package/components/global/typescript-utils.d.ts +2 -0
- package/components/global/typescript-utils.js +8 -0
- package/components/global/url.d.ts +57 -0
- package/components/global/url.js +142 -0
- package/components/global/use-event-callback.d.ts +1 -0
- package/components/global/use-event-callback.js +17 -0
- package/components/global/variables.d.ts +89 -0
- package/components/global/variables.js +1 -0
- package/components/grid/col.d.ts +31 -0
- package/components/grid/col.js +80 -0
- package/components/grid/grid.d.ts +14 -0
- package/components/grid/grid.js +46 -0
- package/components/grid/row.d.ts +40 -0
- package/components/grid/row.js +75 -0
- package/components/group/group.d.ts +12 -0
- package/components/group/group.js +39 -0
- package/components/header/header.d.ts +34 -0
- package/components/header/header.js +189 -0
- package/components/header/logo.d.ts +14 -0
- package/components/header/logo.js +51 -0
- package/components/header/profile.d.ts +75 -0
- package/components/header/profile.js +258 -0
- package/components/header/services-link.d.ts +25 -0
- package/components/header/services-link.js +13 -0
- package/components/header/services.d.ts +33 -0
- package/components/header/services.js +174 -0
- package/components/header/smart-profile.d.ts +36 -0
- package/components/header/smart-profile.js +303 -0
- package/components/header/smart-services.d.ts +26 -0
- package/components/header/smart-services.js +192 -0
- package/components/header/tray-icon.d.ts +32 -0
- package/components/header/tray-icon.js +57 -0
- package/components/header/tray.d.ts +9 -0
- package/components/header/tray.js +41 -0
- package/components/heading/heading.d.ts +25 -0
- package/components/heading/heading.js +69 -0
- package/components/http/http.d.ts +61 -0
- package/components/http/http.js +386 -0
- package/components/http/http.mock.d.ts +20 -0
- package/components/http/http.mock.js +113 -0
- package/components/hub-source/hub-source.d.ts +44 -0
- package/components/hub-source/hub-source.js +217 -0
- package/components/hub-source/hub-source__user.d.ts +4 -0
- package/components/hub-source/hub-source__user.js +60 -0
- package/components/hub-source/hub-source__users-groups.d.ts +24 -0
- package/components/hub-source/hub-source__users-groups.js +86 -0
- package/components/i18n/i18n-context.d.ts +13 -0
- package/components/i18n/i18n-context.js +27 -0
- package/components/i18n/i18n.d.ts +59 -0
- package/components/i18n/i18n.js +139 -0
- package/components/icon/icon.d.ts +43 -0
- package/components/icon/icon.js +109 -0
- package/components/icon/icon__constants.d.ts +30 -0
- package/components/icon/icon__constants.js +34 -0
- package/components/icon/icon__svg.d.ts +15 -0
- package/components/icon/icon__svg.js +14 -0
- package/components/icon/index.d.ts +2 -0
- package/components/icon/index.js +17 -0
- package/components/input/input.d.ts +77 -0
- package/components/input/input.js +35 -0
- package/components/island/adaptive-island-hoc.d.ts +61 -0
- package/components/island/adaptive-island-hoc.js +53 -0
- package/components/island/content.d.ts +43 -0
- package/components/island/content.js +151 -0
- package/components/island/header.d.ts +8 -0
- package/components/island/header.js +100 -0
- package/components/island/island.d.ts +78 -0
- package/components/island/island.js +60 -0
- package/components/island-legacy/content-legacy.d.ts +10 -0
- package/components/island-legacy/content-legacy.js +34 -0
- package/components/island-legacy/header-legacy.d.ts +10 -0
- package/components/island-legacy/header-legacy.js +36 -0
- package/components/island-legacy/island-legacy.d.ts +12 -0
- package/components/island-legacy/island-legacy.js +36 -0
- package/components/link/clickableLink.d.ts +20 -0
- package/components/link/clickableLink.js +69 -0
- package/components/link/link.d.ts +138 -0
- package/components/link/link.js +86 -0
- package/components/list/consts.d.ts +77 -0
- package/components/list/consts.js +27 -0
- package/components/list/list.d.ts +205 -0
- package/components/list/list.js +802 -0
- package/components/list/list__custom.d.ts +6 -0
- package/components/list/list__custom.js +92 -0
- package/components/list/list__hint.d.ts +15 -0
- package/components/list/list__hint.js +33 -0
- package/components/list/list__item.d.ts +8 -0
- package/components/list/list__item.js +237 -0
- package/components/list/list__link.d.ts +9 -0
- package/components/list/list__link.js +76 -0
- package/components/list/list__separator.d.ts +5 -0
- package/components/list/list__separator.js +39 -0
- package/components/list/list__title.d.ts +5 -0
- package/components/list/list__title.js +48 -0
- package/components/list/list__users-groups-source.d.ts +27 -0
- package/components/list/list__users-groups-source.js +195 -0
- package/components/loader/loader.d.ts +28 -0
- package/components/loader/loader.js +93 -0
- package/components/loader/loader__core.d.ts +75 -0
- package/components/loader/loader__core.js +327 -0
- package/components/loader-inline/loader-inline.d.ts +18 -0
- package/components/loader-inline/loader-inline.js +50 -0
- package/components/loader-screen/loader-screen.d.ts +17 -0
- package/components/loader-screen/loader-screen.js +64 -0
- package/components/login-dialog/login-dialog.d.ts +47 -0
- package/components/login-dialog/login-dialog.js +216 -0
- package/components/login-dialog/service.d.ts +2 -0
- package/components/login-dialog/service.js +98 -0
- package/components/markdown/markdown.d.ts +12 -0
- package/components/markdown/markdown.js +43 -0
- package/components/message/message.d.ts +55 -0
- package/components/message/message.js +267 -0
- package/components/old-browsers-message/old-browsers-message.d.ts +2 -0
- package/components/old-browsers-message/old-browsers-message.js +92 -0
- package/components/old-browsers-message/old-browsers-message__stop.d.ts +1 -0
- package/components/old-browsers-message/old-browsers-message__stop.js +11 -0
- package/components/old-browsers-message/white-list.d.ts +2 -0
- package/components/old-browsers-message/white-list.js +37 -0
- package/components/pager/pager.d.ts +78 -0
- package/components/pager/pager.js +390 -0
- package/components/panel/panel.d.ts +12 -0
- package/components/panel/panel.js +39 -0
- package/components/permissions/permissions.d.ts +111 -0
- package/components/permissions/permissions.js +221 -0
- package/components/permissions/permissions__cache.d.ts +93 -0
- package/components/permissions/permissions__cache.js +257 -0
- package/components/popup/popup.consts.d.ts +37 -0
- package/components/popup/popup.consts.js +44 -0
- package/components/popup/popup.d.ts +147 -0
- package/components/popup/popup.js +424 -0
- package/components/popup/popup.target.d.ts +7 -0
- package/components/popup/popup.target.js +24 -0
- package/components/popup/position.d.ts +30 -0
- package/components/popup/position.js +271 -0
- package/components/popup-menu/popup-menu.d.ts +80 -0
- package/components/popup-menu/popup-menu.js +141 -0
- package/components/progress-bar/progress-bar.d.ts +64 -0
- package/components/progress-bar/progress-bar.js +120 -0
- package/components/query-assist/query-assist.d.ts +306 -0
- package/components/query-assist/query-assist.js +1098 -0
- package/components/query-assist/query-assist__suggestions.d.ts +29 -0
- package/components/query-assist/query-assist__suggestions.js +75 -0
- package/components/radio/radio.d.ts +18 -0
- package/components/radio/radio.js +48 -0
- package/components/radio/radio__item.d.ts +28 -0
- package/components/radio/radio__item.js +88 -0
- package/components/select/select.d.ts +276 -0
- package/components/select/select.js +1310 -0
- package/components/select/select__filter.d.ts +19 -0
- package/components/select/select__filter.js +85 -0
- package/components/select/select__popup.d.ts +166 -0
- package/components/select/select__popup.js +631 -0
- package/components/shortcuts/core.d.ts +74 -0
- package/components/shortcuts/core.js +249 -0
- package/components/shortcuts/shortcut-title.d.ts +1 -0
- package/components/shortcuts/shortcut-title.js +56 -0
- package/components/shortcuts/shortcuts-hoc.d.ts +65 -0
- package/components/shortcuts/shortcuts-hoc.js +61 -0
- package/components/shortcuts/shortcuts.d.ts +28 -0
- package/components/shortcuts/shortcuts.js +92 -0
- package/components/storage/storage.d.ts +18 -0
- package/components/storage/storage.js +92 -0
- package/components/storage/storage__fallback.d.ts +79 -0
- package/components/storage/storage__fallback.js +254 -0
- package/components/storage/storage__local.d.ts +38 -0
- package/components/storage/storage__local.js +217 -0
- package/components/style.css +1 -0
- package/components/tab-trap/tab-trap.d.ts +43 -0
- package/components/tab-trap/tab-trap.js +180 -0
- package/components/table/cell.d.ts +13 -0
- package/components/table/cell.js +37 -0
- package/components/table/disable-hover-hoc.d.ts +64 -0
- package/components/table/disable-hover-hoc.js +62 -0
- package/components/table/header-cell.d.ts +43 -0
- package/components/table/header-cell.js +109 -0
- package/components/table/header.d.ts +56 -0
- package/components/table/header.js +151 -0
- package/components/table/multitable.d.ts +25 -0
- package/components/table/multitable.js +140 -0
- package/components/table/row-with-focus-sensor.d.ts +18 -0
- package/components/table/row-with-focus-sensor.js +117 -0
- package/components/table/row.d.ts +59 -0
- package/components/table/row.js +299 -0
- package/components/table/selection-adapter.d.ts +5 -0
- package/components/table/selection-adapter.js +14 -0
- package/components/table/selection-shortcuts-hoc.d.ts +17 -0
- package/components/table/selection-shortcuts-hoc.js +205 -0
- package/components/table/selection.d.ts +47 -0
- package/components/table/selection.js +257 -0
- package/components/table/smart-table.d.ts +64 -0
- package/components/table/smart-table.js +149 -0
- package/components/table/table.d.ts +159 -0
- package/components/table/table.js +463 -0
- package/components/tabs/collapsible-more.d.ts +29 -0
- package/components/tabs/collapsible-more.js +222 -0
- package/components/tabs/collapsible-tab.d.ts +16 -0
- package/components/tabs/collapsible-tab.js +88 -0
- package/components/tabs/collapsible-tabs.d.ts +43 -0
- package/components/tabs/collapsible-tabs.js +354 -0
- package/components/tabs/custom-item.d.ts +9 -0
- package/components/tabs/custom-item.js +11 -0
- package/components/tabs/dumb-tabs.d.ts +35 -0
- package/components/tabs/dumb-tabs.js +189 -0
- package/components/tabs/smart-tabs.d.ts +20 -0
- package/components/tabs/smart-tabs.js +141 -0
- package/components/tabs/tab-link.d.ts +18 -0
- package/components/tabs/tab-link.js +13 -0
- package/components/tabs/tab.d.ts +27 -0
- package/components/tabs/tab.js +41 -0
- package/components/tabs/tabs.d.ts +7 -0
- package/components/tabs/tabs.js +99 -0
- package/components/tag/tag.d.ts +64 -0
- package/components/tag/tag.js +213 -0
- package/components/tags-input/tags-input.d.ts +138 -0
- package/components/tags-input/tags-input.js +534 -0
- package/components/tags-list/tags-list.d.ts +46 -0
- package/components/tags-list/tags-list.js +102 -0
- package/components/text/text.d.ts +23 -0
- package/components/text/text.js +57 -0
- package/components/toggle/toggle.d.ts +39 -0
- package/components/toggle/toggle.js +86 -0
- package/components/tooltip/tooltip.d.ts +65 -0
- package/components/tooltip/tooltip.js +229 -0
- package/components/user-agreement/service.d.ts +69 -0
- package/components/user-agreement/service.js +487 -0
- package/components/user-agreement/toolbox.eula.d.ts +2 -0
- package/components/user-agreement/toolbox.eula.js +3 -0
- package/components/user-agreement/user-agreement.d.ts +60 -0
- package/components/user-agreement/user-agreement.js +172 -0
- package/components/user-card/card.d.ts +70 -0
- package/components/user-card/card.js +80 -0
- package/components/user-card/smart-user-card-tooltip.d.ts +20 -0
- package/components/user-card/smart-user-card-tooltip.js +172 -0
- package/components/user-card/tooltip.d.ts +36 -0
- package/components/user-card/tooltip.js +144 -0
- package/components/user-card/user-card.d.ts +11 -0
- package/components/user-card/user-card.js +85 -0
- package/package.json +118 -0
- package/typings.d.ts +43 -0
@@ -0,0 +1,177 @@
|
|
1
|
+
import { a as _inherits, b as _createSuper, d as _createClass, _ as _defineProperty, c as _classCallCheck, k as _assertThisInitialized } from '../_helpers/_rollupPluginBabelHelpers.js';
|
2
|
+
import 'core-js/modules/es.array.concat.js';
|
3
|
+
import 'core-js/modules/es.regexp.exec.js';
|
4
|
+
import 'core-js/modules/es.string.replace.js';
|
5
|
+
import 'core-js/modules/es.array.filter.js';
|
6
|
+
import 'core-js/modules/es.object.to-string.js';
|
7
|
+
import React from 'react';
|
8
|
+
import classNames from 'classnames';
|
9
|
+
import PropTypes from 'prop-types';
|
10
|
+
import { I as Input } from '../_helpers/input.js';
|
11
|
+
import { ControlsHeight } from '../global/controls-height.js';
|
12
|
+
import { I18nContext } from '../i18n/i18n-context.js';
|
13
|
+
import { dateType } from './consts.js';
|
14
|
+
import { m as modules_0c7b7d96 } from '../_helpers/date-picker.js';
|
15
|
+
import 'core-js/modules/es.object.values.js';
|
16
|
+
import '@jetbrains/icons/close-12px';
|
17
|
+
import '../global/prop-types.js';
|
18
|
+
import '../button/button.js';
|
19
|
+
import '@jetbrains/icons/chevron-10px';
|
20
|
+
import '../icon/icon.js';
|
21
|
+
import 'util-deprecate';
|
22
|
+
import '../icon/icon__constants.js';
|
23
|
+
import '../_helpers/icon__svg.js';
|
24
|
+
import 'core-js/modules/es.string.starts-with.js';
|
25
|
+
import '../global/memoize.js';
|
26
|
+
import 'core-js/modules/es.array.iterator.js';
|
27
|
+
import 'core-js/modules/es.map.js';
|
28
|
+
import 'core-js/modules/web.dom-collections.iterator.js';
|
29
|
+
import 'core-js/modules/es.weak-map.js';
|
30
|
+
import '../link/clickableLink.js';
|
31
|
+
import '../_helpers/button__classes.js';
|
32
|
+
import '../global/get-uid.js';
|
33
|
+
import 'core-js/modules/es.regexp.to-string.js';
|
34
|
+
import '../global/composeRefs.js';
|
35
|
+
import 'core-js/modules/web.dom-collections.for-each.js';
|
36
|
+
import '../control-label/control-label.js';
|
37
|
+
import '../i18n/i18n.js';
|
38
|
+
import 'core-js/modules/es.set.js';
|
39
|
+
import 'date-fns/add';
|
40
|
+
|
41
|
+
var DateInput = /*#__PURE__*/function (_React$PureComponent) {
|
42
|
+
_inherits(DateInput, _React$PureComponent);
|
43
|
+
var _super = _createSuper(DateInput);
|
44
|
+
function DateInput() {
|
45
|
+
var _this;
|
46
|
+
_classCallCheck(this, DateInput);
|
47
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
48
|
+
args[_key] = arguments[_key];
|
49
|
+
}
|
50
|
+
_this = _super.call.apply(_super, [this].concat(args));
|
51
|
+
_defineProperty(_assertThisInitialized(_this), "input", void 0);
|
52
|
+
_defineProperty(_assertThisInitialized(_this), "inputRef", function (el) {
|
53
|
+
_this.input = el;
|
54
|
+
_this.updateInput(_this.props);
|
55
|
+
});
|
56
|
+
_defineProperty(_assertThisInitialized(_this), "handleChange", function (e) {
|
57
|
+
return _this.props.onInput(e.currentTarget.value, e.currentTarget.dataset.name);
|
58
|
+
});
|
59
|
+
_defineProperty(_assertThisInitialized(_this), "handleKeyDown", function (e) {
|
60
|
+
return e.key === 'Enter' && _this.props.onConfirm();
|
61
|
+
});
|
62
|
+
return _this;
|
63
|
+
}
|
64
|
+
_createClass(DateInput, [{
|
65
|
+
key: "componentDidUpdate",
|
66
|
+
value: function componentDidUpdate(prevProps) {
|
67
|
+
var _this$props = this.props,
|
68
|
+
text = _this$props.text,
|
69
|
+
active = _this$props.active;
|
70
|
+
if (text !== prevProps.text || active !== prevProps.active) {
|
71
|
+
this.updateInput({
|
72
|
+
text,
|
73
|
+
active
|
74
|
+
});
|
75
|
+
}
|
76
|
+
}
|
77
|
+
}, {
|
78
|
+
key: "updateInput",
|
79
|
+
value: function updateInput(_ref) {
|
80
|
+
var text = _ref.text,
|
81
|
+
active = _ref.active;
|
82
|
+
var el = this.input;
|
83
|
+
if (!el) {
|
84
|
+
return;
|
85
|
+
}
|
86
|
+
if (active) {
|
87
|
+
el.focus();
|
88
|
+
if (!text) {
|
89
|
+
el.select();
|
90
|
+
}
|
91
|
+
} else {
|
92
|
+
el.blur();
|
93
|
+
}
|
94
|
+
}
|
95
|
+
}, {
|
96
|
+
key: "render",
|
97
|
+
value: function render() {
|
98
|
+
var _this$props2 = this.props,
|
99
|
+
active = _this$props2.active,
|
100
|
+
divider = _this$props2.divider,
|
101
|
+
text = _this$props2.text,
|
102
|
+
time = _this$props2.time,
|
103
|
+
name = _this$props2.name,
|
104
|
+
hoverDate = _this$props2.hoverDate,
|
105
|
+
date = _this$props2.date,
|
106
|
+
displayFormat = _this$props2.displayFormat,
|
107
|
+
translations = _this$props2.translations,
|
108
|
+
onActivate = _this$props2.onActivate,
|
109
|
+
onClear = _this$props2.onClear,
|
110
|
+
fromPlaceholder = _this$props2.fromPlaceholder,
|
111
|
+
toPlaceholder = _this$props2.toPlaceholder,
|
112
|
+
timePlaceholder = _this$props2.timePlaceholder,
|
113
|
+
locale = _this$props2.locale;
|
114
|
+
var translate = this.context.translate;
|
115
|
+
var displayText = '';
|
116
|
+
if (active && hoverDate) {
|
117
|
+
displayText = displayFormat(hoverDate, locale);
|
118
|
+
} else if (active && text != null) {
|
119
|
+
displayText = text;
|
120
|
+
} else if (date) {
|
121
|
+
displayText = displayFormat(date, locale);
|
122
|
+
} else if (name === 'time') {
|
123
|
+
displayText = time || '';
|
124
|
+
}
|
125
|
+
var placeholder = function (_translations$addFirs, _translations$addSeco, _translations$addTime, _translations$selectN) {
|
126
|
+
switch (name) {
|
127
|
+
case 'from':
|
128
|
+
return fromPlaceholder || ((_translations$addFirs = translations === null || translations === void 0 ? void 0 : translations.addFirstDate) !== null && _translations$addFirs !== void 0 ? _translations$addFirs : translate('addFirstDate'));
|
129
|
+
case 'to':
|
130
|
+
return toPlaceholder || ((_translations$addSeco = translations === null || translations === void 0 ? void 0 : translations.addSecondDate) !== null && _translations$addSeco !== void 0 ? _translations$addSeco : translate('addSecondDate'));
|
131
|
+
case 'time':
|
132
|
+
return timePlaceholder || ((_translations$addTime = translations === null || translations === void 0 ? void 0 : translations.addTime) !== null && _translations$addTime !== void 0 ? _translations$addTime : translate('addTime'));
|
133
|
+
default:
|
134
|
+
return ((_translations$selectN = translations === null || translations === void 0 ? void 0 : translations.selectName) !== null && _translations$selectN !== void 0 ? _translations$selectN : translate('selectName')).replace('%name%', name).replace('{{name}}', name);
|
135
|
+
}
|
136
|
+
}();
|
137
|
+
var classes = classNames(modules_0c7b7d96.filter, modules_0c7b7d96["".concat(name, "Input")], divider && modules_0c7b7d96["".concat(name, "InputWithDivider")], 'ring-js-shortcuts');
|
138
|
+
return /*#__PURE__*/React.createElement(Input, {
|
139
|
+
autoComplete: "off",
|
140
|
+
borderless: true,
|
141
|
+
height: ControlsHeight.L,
|
142
|
+
"data-name": name,
|
143
|
+
inputRef: this.inputRef,
|
144
|
+
className: classes,
|
145
|
+
value: displayText,
|
146
|
+
onChange: this.handleChange,
|
147
|
+
onFocus: onActivate,
|
148
|
+
onKeyDown: this.handleKeyDown,
|
149
|
+
onClear: onClear,
|
150
|
+
placeholder: placeholder
|
151
|
+
});
|
152
|
+
}
|
153
|
+
}]);
|
154
|
+
return DateInput;
|
155
|
+
}(React.PureComponent);
|
156
|
+
_defineProperty(DateInput, "propTypes", {
|
157
|
+
active: PropTypes.bool,
|
158
|
+
divider: PropTypes.bool,
|
159
|
+
name: PropTypes.string,
|
160
|
+
text: PropTypes.string,
|
161
|
+
hoverDate: dateType,
|
162
|
+
date: dateType,
|
163
|
+
time: PropTypes.string,
|
164
|
+
displayFormat: PropTypes.func,
|
165
|
+
translations: PropTypes.object,
|
166
|
+
fromPlaceholder: PropTypes.string,
|
167
|
+
toPlaceholder: PropTypes.string,
|
168
|
+
timePlaceholder: PropTypes.string,
|
169
|
+
onInput: PropTypes.func,
|
170
|
+
onActivate: PropTypes.func,
|
171
|
+
onConfirm: PropTypes.func,
|
172
|
+
onClear: PropTypes.func,
|
173
|
+
locale: PropTypes.object
|
174
|
+
});
|
175
|
+
_defineProperty(DateInput, "contextType", I18nContext);
|
176
|
+
|
177
|
+
export { DateInput as default };
|
@@ -0,0 +1,77 @@
|
|
1
|
+
import React, { PureComponent } from 'react';
|
2
|
+
import PropTypes from 'prop-types';
|
3
|
+
import type { Locale } from 'date-fns';
|
4
|
+
import Popup from '../popup/popup';
|
5
|
+
import { DropdownAttrs } from '../dropdown/dropdown';
|
6
|
+
import { Size } from '../input/input';
|
7
|
+
import { DatePopupProps } from './date-popup';
|
8
|
+
import { DateInputTranslations, DatePickerChange } from './consts';
|
9
|
+
export interface DatePickerTranslations extends Partial<DateInputTranslations> {
|
10
|
+
setDate: string;
|
11
|
+
setDateTime: string;
|
12
|
+
setPeriod: string;
|
13
|
+
}
|
14
|
+
export type DatePickerProps = Omit<DatePopupProps, 'translations' | 'parseDateInput' | 'onComplete' | 'hidden'> & {
|
15
|
+
className: string;
|
16
|
+
clear: boolean;
|
17
|
+
inline: boolean;
|
18
|
+
popupClassName?: string | null | undefined;
|
19
|
+
dropdownProps?: DropdownAttrs;
|
20
|
+
translations?: DatePickerTranslations | null | undefined;
|
21
|
+
displayMonthFormat: (date: Date, locale: Locale | undefined) => string;
|
22
|
+
displayDayFormat: (date: Date, locale: Locale | undefined) => string;
|
23
|
+
displayTimeFormat: (date: Date, locale: Locale | undefined) => string;
|
24
|
+
applyTimeInput: (date: Date, time: string | null | undefined) => Date;
|
25
|
+
datePlaceholder?: string;
|
26
|
+
dateTimePlaceholder?: string;
|
27
|
+
rangePlaceholder?: string;
|
28
|
+
disabled?: boolean | null | undefined;
|
29
|
+
parseDateInput: (input: string | null | undefined) => Date | null;
|
30
|
+
size?: Size;
|
31
|
+
};
|
32
|
+
/**
|
33
|
+
* @name Date Picker
|
34
|
+
*/
|
35
|
+
export default class DatePicker extends PureComponent<DatePickerProps> {
|
36
|
+
static propTypes: {
|
37
|
+
className: PropTypes.Requireable<string>;
|
38
|
+
popupClassName: PropTypes.Requireable<string>;
|
39
|
+
date: PropTypes.Requireable<NonNullable<string | number | Date | null | undefined>>;
|
40
|
+
withTime: PropTypes.Requireable<boolean>;
|
41
|
+
range: PropTypes.Requireable<boolean>;
|
42
|
+
from: PropTypes.Requireable<NonNullable<string | number | Date | null | undefined>>;
|
43
|
+
to: PropTypes.Requireable<NonNullable<string | number | Date | null | undefined>>;
|
44
|
+
clear: PropTypes.Requireable<boolean>;
|
45
|
+
inline: PropTypes.Requireable<boolean>;
|
46
|
+
displayFormat: PropTypes.Requireable<(...args: any[]) => any>;
|
47
|
+
displayMonthFormat: PropTypes.Requireable<(...args: any[]) => any>;
|
48
|
+
displayDayFormat: PropTypes.Requireable<(...args: any[]) => any>;
|
49
|
+
displayTimeFormat: PropTypes.Requireable<(...args: any[]) => any>;
|
50
|
+
parseDateInput: PropTypes.Requireable<(...args: any[]) => any>;
|
51
|
+
applyTimeInput: PropTypes.Requireable<(...args: any[]) => any>;
|
52
|
+
datePlaceholder: PropTypes.Requireable<string>;
|
53
|
+
dateTimePlaceholder: PropTypes.Requireable<string>;
|
54
|
+
rangePlaceholder: PropTypes.Requireable<string>;
|
55
|
+
onChange: PropTypes.Requireable<(...args: any[]) => any>;
|
56
|
+
dropdownProps: PropTypes.Requireable<object>;
|
57
|
+
disabled: PropTypes.Requireable<boolean>;
|
58
|
+
minDate: PropTypes.Requireable<NonNullable<string | number | Date | null | undefined>>;
|
59
|
+
maxDate: PropTypes.Requireable<NonNullable<string | number | Date | null | undefined>>;
|
60
|
+
translations: PropTypes.Requireable<object>;
|
61
|
+
locale: PropTypes.Requireable<object>;
|
62
|
+
size: PropTypes.Requireable<Size>;
|
63
|
+
};
|
64
|
+
static defaultProps: DatePickerProps;
|
65
|
+
static contextType: React.Context<import("../i18n/i18n-context").I18nContextProps>;
|
66
|
+
context: React.ContextType<typeof DatePicker.contextType>;
|
67
|
+
handleChange: (change: DatePickerChange | Date | null | undefined) => void;
|
68
|
+
clear: () => void;
|
69
|
+
popup?: Popup | null;
|
70
|
+
popupRef: (el: Popup | null) => void;
|
71
|
+
closePopup: () => void;
|
72
|
+
parse: (arg: string | number | Date | null | undefined) => Date | null;
|
73
|
+
formatTime(): string | null;
|
74
|
+
getAnchorText: () => string;
|
75
|
+
render(): React.JSX.Element;
|
76
|
+
}
|
77
|
+
export type DatePickerAttrs = JSX.LibraryManagedAttributes<typeof DatePicker, DatePickerProps>;
|
@@ -0,0 +1,404 @@
|
|
1
|
+
import { _ as _defineProperty, j as _slicedToArray, m as _createForOfIteratorHelper, a as _inherits, b as _createSuper, c as _classCallCheck, k as _assertThisInitialized, d as _createClass, e as _objectWithoutProperties, f as _extends, g as _objectSpread2 } from '../_helpers/_rollupPluginBabelHelpers.js';
|
2
|
+
import 'core-js/modules/es.array.concat.js';
|
3
|
+
import 'core-js/modules/es.object.values.js';
|
4
|
+
import 'core-js/modules/es.array.map.js';
|
5
|
+
import React, { PureComponent } from 'react';
|
6
|
+
import PropTypes from 'prop-types';
|
7
|
+
import classNames from 'classnames';
|
8
|
+
import format from 'date-fns/format';
|
9
|
+
import isSameDay from 'date-fns/isSameDay';
|
10
|
+
import isSameMonth from 'date-fns/isSameMonth';
|
11
|
+
import isSameYear from 'date-fns/isSameYear';
|
12
|
+
import isValid from 'date-fns/isValid';
|
13
|
+
import parse from 'date-fns/parse';
|
14
|
+
import set from 'date-fns/set';
|
15
|
+
import calendarIcon from '@jetbrains/icons/calendar';
|
16
|
+
import chevronDownIcon from '@jetbrains/icons/chevron-down';
|
17
|
+
import memoize from '../global/memoize.js';
|
18
|
+
import Popup from '../popup/popup.js';
|
19
|
+
import Dropdown from '../dropdown/dropdown.js';
|
20
|
+
import Icon from '../icon/icon.js';
|
21
|
+
import { Button } from '../button/button.js';
|
22
|
+
import Link from '../link/link.js';
|
23
|
+
import { S as Size } from '../_helpers/input.js';
|
24
|
+
import { I18nContext } from '../i18n/i18n-context.js';
|
25
|
+
import DatePopup from './date-popup.js';
|
26
|
+
import { dateType } from './consts.js';
|
27
|
+
import { m as modules_0c7b7d96 } from '../_helpers/date-picker.js';
|
28
|
+
import formats from './formats.js';
|
29
|
+
import 'core-js/modules/es.array.iterator.js';
|
30
|
+
import 'core-js/modules/es.map.js';
|
31
|
+
import 'core-js/modules/es.object.to-string.js';
|
32
|
+
import 'core-js/modules/web.dom-collections.iterator.js';
|
33
|
+
import 'core-js/modules/es.weak-map.js';
|
34
|
+
import 'core-js/modules/web.dom-collections.for-each.js';
|
35
|
+
import 'core-js/modules/es.object.entries.js';
|
36
|
+
import 'core-js/modules/es.regexp.to-string.js';
|
37
|
+
import 'core-js/modules/es.regexp.exec.js';
|
38
|
+
import 'core-js/modules/es.string.replace.js';
|
39
|
+
import 'react-dom';
|
40
|
+
import '../global/get-uid.js';
|
41
|
+
import '../global/schedule-raf.js';
|
42
|
+
import '../global/dom.js';
|
43
|
+
import 'core-js/modules/es.object.assign.js';
|
44
|
+
import 'core-js/modules/es.array.filter.js';
|
45
|
+
import 'core-js/modules/es.string.split.js';
|
46
|
+
import 'core-js/modules/es.set.js';
|
47
|
+
import '../shortcuts/shortcuts.js';
|
48
|
+
import '../shortcuts/core.js';
|
49
|
+
import 'core-js/modules/es.array.includes.js';
|
50
|
+
import 'core-js/modules/es.string.includes.js';
|
51
|
+
import 'core-js/modules/es.array.slice.js';
|
52
|
+
import 'core-js/modules/es.array.splice.js';
|
53
|
+
import 'core-js/modules/es.string.match.js';
|
54
|
+
import 'core-js/modules/es.array.find-index.js';
|
55
|
+
import 'combokeys';
|
56
|
+
import '../global/sniffer.js';
|
57
|
+
import 'sniffr';
|
58
|
+
import '../global/data-tests.js';
|
59
|
+
import 'core-js/modules/es.array.reduce.js';
|
60
|
+
import '../tab-trap/tab-trap.js';
|
61
|
+
import '../popup/position.js';
|
62
|
+
import 'core-js/modules/es.array.sort.js';
|
63
|
+
import '../popup/popup.consts.js';
|
64
|
+
import '../popup/popup.target.js';
|
65
|
+
import '../global/typescript-utils.js';
|
66
|
+
import '../_helpers/anchor.js';
|
67
|
+
import '@jetbrains/icons/chevron-10px';
|
68
|
+
import 'util-deprecate';
|
69
|
+
import '../icon/icon__constants.js';
|
70
|
+
import '../_helpers/icon__svg.js';
|
71
|
+
import 'core-js/modules/es.string.starts-with.js';
|
72
|
+
import '../link/clickableLink.js';
|
73
|
+
import '../global/controls-height.js';
|
74
|
+
import '../_helpers/button__classes.js';
|
75
|
+
import '../_helpers/link.js';
|
76
|
+
import '@jetbrains/icons/close-12px';
|
77
|
+
import '../global/prop-types.js';
|
78
|
+
import '../global/composeRefs.js';
|
79
|
+
import '../control-label/control-label.js';
|
80
|
+
import '../i18n/i18n.js';
|
81
|
+
import 'date-fns/isAfter';
|
82
|
+
import 'date-fns/isBefore';
|
83
|
+
import 'date-fns/startOfDay';
|
84
|
+
import 'date-fns';
|
85
|
+
import './date-input.js';
|
86
|
+
import 'date-fns/add';
|
87
|
+
import './months.js';
|
88
|
+
import 'date-fns/addMonths';
|
89
|
+
import 'date-fns/getDay';
|
90
|
+
import 'date-fns/getDaysInMonth';
|
91
|
+
import 'date-fns/startOfMonth';
|
92
|
+
import 'date-fns/subMonths';
|
93
|
+
import 'date-fns/endOfMonth';
|
94
|
+
import '../global/linear-function.js';
|
95
|
+
import '../global/use-event-callback.js';
|
96
|
+
import './month.js';
|
97
|
+
import 'date-fns/addDays';
|
98
|
+
import 'date-fns/setDay';
|
99
|
+
import './day.js';
|
100
|
+
import 'date-fns/getDate';
|
101
|
+
import 'date-fns/isToday';
|
102
|
+
import './month-names.js';
|
103
|
+
import 'date-fns/isThisMonth';
|
104
|
+
import 'date-fns/startOfYear';
|
105
|
+
import './month-slider.js';
|
106
|
+
import 'date-fns/addYears';
|
107
|
+
import 'date-fns/subYears';
|
108
|
+
import './years.js';
|
109
|
+
import 'date-fns/getYear';
|
110
|
+
import 'date-fns/isThisYear';
|
111
|
+
import 'date-fns/setYear';
|
112
|
+
import './weekdays.js';
|
113
|
+
|
114
|
+
var _excluded = ["hidden", "className", "popupRef", "onClear", "datePopupProps", "onComplete"],
|
115
|
+
_excluded2 = ["className", "popupClassName", "clear", "inline", "dropdownProps", "translations"];
|
116
|
+
var PopupComponent = function PopupComponent(_ref) {
|
117
|
+
var _ref$hidden = _ref.hidden,
|
118
|
+
hidden = _ref$hidden === void 0 ? false : _ref$hidden,
|
119
|
+
className = _ref.className,
|
120
|
+
popupRef = _ref.popupRef,
|
121
|
+
onClear = _ref.onClear,
|
122
|
+
datePopupProps = _ref.datePopupProps,
|
123
|
+
onComplete = _ref.onComplete,
|
124
|
+
restProps = _objectWithoutProperties(_ref, _excluded);
|
125
|
+
return /*#__PURE__*/React.createElement(Popup, _extends({
|
126
|
+
hidden: hidden,
|
127
|
+
className: className,
|
128
|
+
ref: popupRef,
|
129
|
+
directions: [Popup.PopupProps.Directions.BOTTOM_RIGHT, Popup.PopupProps.Directions.BOTTOM_LEFT, Popup.PopupProps.Directions.TOP_LEFT, Popup.PopupProps.Directions.TOP_RIGHT]
|
130
|
+
}, restProps), /*#__PURE__*/React.createElement(DatePopup, _extends({
|
131
|
+
onClear: onClear
|
132
|
+
}, datePopupProps, {
|
133
|
+
onComplete: onComplete
|
134
|
+
})));
|
135
|
+
};
|
136
|
+
PopupComponent.propTypes = {
|
137
|
+
hidden: PropTypes.bool,
|
138
|
+
className: PropTypes.string,
|
139
|
+
popupRef: PropTypes.func,
|
140
|
+
onClear: PropTypes.func,
|
141
|
+
datePopupProps: PropTypes.shape(DatePopup.propTypes),
|
142
|
+
onComplete: PropTypes.func
|
143
|
+
};
|
144
|
+
/**
|
145
|
+
* @name Date Picker
|
146
|
+
*/
|
147
|
+
var DatePicker = /*#__PURE__*/function (_PureComponent) {
|
148
|
+
_inherits(DatePicker, _PureComponent);
|
149
|
+
var _super = _createSuper(DatePicker);
|
150
|
+
function DatePicker() {
|
151
|
+
var _this;
|
152
|
+
_classCallCheck(this, DatePicker);
|
153
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
154
|
+
args[_key] = arguments[_key];
|
155
|
+
}
|
156
|
+
_this = _super.call.apply(_super, [this].concat(args));
|
157
|
+
_defineProperty(_assertThisInitialized(_this), "handleChange", function (change) {
|
158
|
+
var _this$props = _this.props,
|
159
|
+
onChange = _this$props.onChange,
|
160
|
+
withTime = _this$props.withTime,
|
161
|
+
applyTimeInput = _this$props.applyTimeInput;
|
162
|
+
var adjustedChange = withTime && !(change instanceof Date) && (change === null || change === void 0 ? void 0 : change.date) != null ? applyTimeInput(change.date, change.time) : change;
|
163
|
+
onChange(adjustedChange);
|
164
|
+
});
|
165
|
+
_defineProperty(_assertThisInitialized(_this), "clear", function () {
|
166
|
+
var change = null;
|
167
|
+
if (_this.props.range) {
|
168
|
+
change = {
|
169
|
+
from: null,
|
170
|
+
to: null
|
171
|
+
};
|
172
|
+
}
|
173
|
+
_this.handleChange(change);
|
174
|
+
});
|
175
|
+
_defineProperty(_assertThisInitialized(_this), "popup", void 0);
|
176
|
+
_defineProperty(_assertThisInitialized(_this), "popupRef", function (el) {
|
177
|
+
_this.popup = el;
|
178
|
+
});
|
179
|
+
_defineProperty(_assertThisInitialized(_this), "closePopup", function () {
|
180
|
+
var _this$popup;
|
181
|
+
(_this$popup = _this.popup) === null || _this$popup === void 0 || _this$popup._onCloseAttempt();
|
182
|
+
});
|
183
|
+
_defineProperty(_assertThisInitialized(_this), "parse", memoize(function (date) {
|
184
|
+
var parseDateInput = _this.props.parseDateInput;
|
185
|
+
if (date instanceof Date) {
|
186
|
+
return date;
|
187
|
+
}
|
188
|
+
if (typeof date === 'number') {
|
189
|
+
return new Date(date);
|
190
|
+
}
|
191
|
+
return parseDateInput(date);
|
192
|
+
}));
|
193
|
+
_defineProperty(_assertThisInitialized(_this), "getAnchorText", function () {
|
194
|
+
var _this$props2 = _this.props,
|
195
|
+
range = _this$props2.range,
|
196
|
+
datePlaceholder = _this$props2.datePlaceholder,
|
197
|
+
dateTimePlaceholder = _this$props2.dateTimePlaceholder,
|
198
|
+
rangePlaceholder = _this$props2.rangePlaceholder,
|
199
|
+
withTime = _this$props2.withTime,
|
200
|
+
displayFormat = _this$props2.displayFormat,
|
201
|
+
displayMonthFormat = _this$props2.displayMonthFormat,
|
202
|
+
displayDayFormat = _this$props2.displayDayFormat,
|
203
|
+
translations = _this$props2.translations,
|
204
|
+
locale = _this$props2.locale;
|
205
|
+
var translate = _this.context.translate;
|
206
|
+
var date = _this.parse(_this.props.date);
|
207
|
+
var from = _this.parse(_this.props.from);
|
208
|
+
var to = _this.parse(_this.props.to);
|
209
|
+
var time = _this.formatTime();
|
210
|
+
if (!range && !withTime) {
|
211
|
+
var _ref2;
|
212
|
+
return date ? displayFormat(date, locale) : (_ref2 = datePlaceholder !== null && datePlaceholder !== void 0 ? datePlaceholder : translations === null || translations === void 0 ? void 0 : translations.setDate) !== null && _ref2 !== void 0 ? _ref2 : translate('setDate');
|
213
|
+
} else if (!range && withTime) {
|
214
|
+
if (!date && !time) {
|
215
|
+
var _ref3;
|
216
|
+
return (_ref3 = dateTimePlaceholder !== null && dateTimePlaceholder !== void 0 ? dateTimePlaceholder : translations === null || translations === void 0 ? void 0 : translations.setDateTime) !== null && _ref3 !== void 0 ? _ref3 : translate('setDateTime');
|
217
|
+
} else {
|
218
|
+
return "".concat(date && displayFormat(date, locale) || '—', ", ").concat(time || '—');
|
219
|
+
}
|
220
|
+
} else if (from && to) {
|
221
|
+
if (!isSameYear(from, to)) {
|
222
|
+
return "".concat(displayFormat(from, locale), " \u2014 ").concat(displayFormat(to, locale));
|
223
|
+
} else if (!isSameMonth(from, to)) {
|
224
|
+
return "".concat(displayMonthFormat(from, locale), " \u2014 ").concat(displayFormat(to, locale));
|
225
|
+
} else if (!isSameDay(from, to)) {
|
226
|
+
return "".concat(displayDayFormat(from, locale), " \u2014 ").concat(displayFormat(to, locale));
|
227
|
+
} else {
|
228
|
+
return "".concat(displayFormat(to, locale));
|
229
|
+
}
|
230
|
+
} else if (from) {
|
231
|
+
return "".concat(displayFormat(from, locale), " \u2014");
|
232
|
+
} else if (to) {
|
233
|
+
return "\u2014 ".concat(displayFormat(to, locale));
|
234
|
+
} else {
|
235
|
+
var _ref4;
|
236
|
+
return (_ref4 = rangePlaceholder !== null && rangePlaceholder !== void 0 ? rangePlaceholder : translations === null || translations === void 0 ? void 0 : translations.setPeriod) !== null && _ref4 !== void 0 ? _ref4 : translate('setPeriod');
|
237
|
+
}
|
238
|
+
});
|
239
|
+
return _this;
|
240
|
+
}
|
241
|
+
_createClass(DatePicker, [{
|
242
|
+
key: "formatTime",
|
243
|
+
value: function formatTime() {
|
244
|
+
var _this$props3 = this.props,
|
245
|
+
displayTimeFormat = _this$props3.displayTimeFormat,
|
246
|
+
locale = _this$props3.locale;
|
247
|
+
var date = this.parse(this.props.date);
|
248
|
+
if (date != null) {
|
249
|
+
return displayTimeFormat(date, locale);
|
250
|
+
}
|
251
|
+
return null;
|
252
|
+
}
|
253
|
+
}, {
|
254
|
+
key: "render",
|
255
|
+
value: function render() {
|
256
|
+
var _this$props$disabled, _this$props$disabled2;
|
257
|
+
var anchorContent = /*#__PURE__*/React.createElement("div", {
|
258
|
+
className: modules_0c7b7d96.anchorContent
|
259
|
+
}, /*#__PURE__*/React.createElement(Icon, {
|
260
|
+
glyph: calendarIcon,
|
261
|
+
className: modules_0c7b7d96.calendarIcon
|
262
|
+
}), this.getAnchorText(), /*#__PURE__*/React.createElement(Icon, {
|
263
|
+
glyph: chevronDownIcon,
|
264
|
+
className: modules_0c7b7d96.chevronDownIcon
|
265
|
+
}));
|
266
|
+
var _this$props4 = this.props,
|
267
|
+
className = _this$props4.className,
|
268
|
+
popupClassName = _this$props4.popupClassName,
|
269
|
+
clear = _this$props4.clear,
|
270
|
+
inline = _this$props4.inline,
|
271
|
+
dropdownProps = _this$props4.dropdownProps,
|
272
|
+
translations = _this$props4.translations,
|
273
|
+
datePopupProps = _objectWithoutProperties(_this$props4, _excluded2);
|
274
|
+
var classes = classNames(modules_0c7b7d96.datePicker, className, modules_0c7b7d96["size".concat(this.props.size)], {
|
275
|
+
[modules_0c7b7d96.inline]: inline
|
276
|
+
});
|
277
|
+
return /*#__PURE__*/React.createElement(Dropdown, _extends({
|
278
|
+
className: classes,
|
279
|
+
disabled: this.props.disabled,
|
280
|
+
anchor: inline ? /*#__PURE__*/React.createElement(Link, {
|
281
|
+
"data-test-ring-dropdown-anchor": true,
|
282
|
+
className: modules_0c7b7d96.anchor,
|
283
|
+
disabled: (_this$props$disabled = this.props.disabled) !== null && _this$props$disabled !== void 0 ? _this$props$disabled : false,
|
284
|
+
pseudo: true
|
285
|
+
}, this.getAnchorText()) : /*#__PURE__*/React.createElement(Button, {
|
286
|
+
"data-test-ring-dropdown-anchor": true,
|
287
|
+
className: modules_0c7b7d96.anchor,
|
288
|
+
text: false,
|
289
|
+
disabled: (_this$props$disabled2 = this.props.disabled) !== null && _this$props$disabled2 !== void 0 ? _this$props$disabled2 : false
|
290
|
+
}, anchorContent)
|
291
|
+
}, dropdownProps), /*#__PURE__*/React.createElement(PopupComponent, {
|
292
|
+
className: popupClassName,
|
293
|
+
popupRef: this.popupRef,
|
294
|
+
onClear: clear ? this.clear : null,
|
295
|
+
datePopupProps: _objectSpread2(_objectSpread2({}, datePopupProps), {}, {
|
296
|
+
translations,
|
297
|
+
onChange: this.handleChange,
|
298
|
+
parseDateInput: this.parse,
|
299
|
+
time: this.formatTime()
|
300
|
+
}),
|
301
|
+
onComplete: this.closePopup
|
302
|
+
}));
|
303
|
+
}
|
304
|
+
}]);
|
305
|
+
return DatePicker;
|
306
|
+
}(PureComponent);
|
307
|
+
_defineProperty(DatePicker, "propTypes", {
|
308
|
+
className: PropTypes.string,
|
309
|
+
popupClassName: PropTypes.string,
|
310
|
+
date: dateType,
|
311
|
+
withTime: PropTypes.bool,
|
312
|
+
range: PropTypes.bool,
|
313
|
+
from: dateType,
|
314
|
+
to: dateType,
|
315
|
+
clear: PropTypes.bool,
|
316
|
+
inline: PropTypes.bool,
|
317
|
+
displayFormat: PropTypes.func,
|
318
|
+
displayMonthFormat: PropTypes.func,
|
319
|
+
displayDayFormat: PropTypes.func,
|
320
|
+
displayTimeFormat: PropTypes.func,
|
321
|
+
parseDateInput: PropTypes.func,
|
322
|
+
applyTimeInput: PropTypes.func,
|
323
|
+
datePlaceholder: PropTypes.string,
|
324
|
+
dateTimePlaceholder: PropTypes.string,
|
325
|
+
rangePlaceholder: PropTypes.string,
|
326
|
+
onChange: PropTypes.func,
|
327
|
+
dropdownProps: PropTypes.object,
|
328
|
+
disabled: PropTypes.bool,
|
329
|
+
minDate: dateType,
|
330
|
+
maxDate: dateType,
|
331
|
+
translations: PropTypes.object,
|
332
|
+
locale: PropTypes.object,
|
333
|
+
size: PropTypes.oneOf(Object.values(Size))
|
334
|
+
});
|
335
|
+
_defineProperty(DatePicker, "defaultProps", {
|
336
|
+
className: '',
|
337
|
+
date: null,
|
338
|
+
withTime: false,
|
339
|
+
range: false,
|
340
|
+
from: null,
|
341
|
+
to: null,
|
342
|
+
clear: false,
|
343
|
+
inline: false,
|
344
|
+
size: Size.M,
|
345
|
+
displayFormat: function displayFormat(date, locale) {
|
346
|
+
return date ? format(date, 'd MMM yyyy', {
|
347
|
+
locale
|
348
|
+
}) : '';
|
349
|
+
},
|
350
|
+
displayMonthFormat: function displayMonthFormat(date, locale) {
|
351
|
+
return date ? format(date, 'd MMM', {
|
352
|
+
locale
|
353
|
+
}) : '';
|
354
|
+
},
|
355
|
+
displayDayFormat: function displayDayFormat(date, locale) {
|
356
|
+
return date ? format(date, 'd', {
|
357
|
+
locale
|
358
|
+
}) : '';
|
359
|
+
},
|
360
|
+
displayTimeFormat: function displayTimeFormat(date, locale) {
|
361
|
+
return date ? format(date, 'HH:mm', {
|
362
|
+
locale
|
363
|
+
}) : '';
|
364
|
+
},
|
365
|
+
minDate: null,
|
366
|
+
maxDate: null,
|
367
|
+
onChange() {},
|
368
|
+
applyTimeInput(date, timeString) {
|
369
|
+
var _timeString$split$map;
|
370
|
+
var _ref5 = (_timeString$split$map = timeString === null || timeString === void 0 ? void 0 : timeString.split(':').map(Number)) !== null && _timeString$split$map !== void 0 ? _timeString$split$map : [],
|
371
|
+
_ref6 = _slicedToArray(_ref5, 2),
|
372
|
+
hours = _ref6[0],
|
373
|
+
minutes = _ref6[1];
|
374
|
+
return minutes != null ? set(date, {
|
375
|
+
hours,
|
376
|
+
minutes
|
377
|
+
}) : date;
|
378
|
+
},
|
379
|
+
parseDateInput(string) {
|
380
|
+
if (!string) {
|
381
|
+
return null;
|
382
|
+
}
|
383
|
+
var today = new Date();
|
384
|
+
var _iterator = _createForOfIteratorHelper(formats),
|
385
|
+
_step;
|
386
|
+
try {
|
387
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
388
|
+
var format = _step.value;
|
389
|
+
var date = parse(string, format, today);
|
390
|
+
if (isValid(date)) {
|
391
|
+
return date;
|
392
|
+
}
|
393
|
+
}
|
394
|
+
} catch (err) {
|
395
|
+
_iterator.e(err);
|
396
|
+
} finally {
|
397
|
+
_iterator.f();
|
398
|
+
}
|
399
|
+
return null;
|
400
|
+
}
|
401
|
+
});
|
402
|
+
_defineProperty(DatePicker, "contextType", I18nContext);
|
403
|
+
|
404
|
+
export { DatePicker as default };
|