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