@elastic/eui 81.1.0 → 81.2.0
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/dist/eui_theme_dark.css +28 -25
- package/dist/eui_theme_dark.min.css +1 -1
- package/dist/eui_theme_light.css +28 -25
- package/dist/eui_theme_light.min.css +1 -1
- package/es/components/date_picker/super_date_picker/super_date_picker.js +49 -39
- package/eui.d.ts +9 -2
- package/lib/components/date_picker/super_date_picker/super_date_picker.js +49 -39
- package/optimize/es/components/date_picker/super_date_picker/super_date_picker.js +31 -37
- package/optimize/lib/components/date_picker/super_date_picker/super_date_picker.js +31 -37
- package/package.json +1 -1
- package/src/components/date_picker/super_date_picker/_super_date_picker.scss +34 -28
- package/test-env/components/date_picker/super_date_picker/super_date_picker.js +49 -39
|
@@ -18,10 +18,10 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
18
18
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
19
19
|
var _moment = _interopRequireDefault(require("moment"));
|
|
20
20
|
var _datemath = _interopRequireDefault(require("@elastic/datemath"));
|
|
21
|
+
var _predicate = require("../../../services/predicate");
|
|
21
22
|
var _context = require("../../context");
|
|
22
23
|
var _date_picker_range = require("../date_picker_range");
|
|
23
24
|
var _form = require("../../form");
|
|
24
|
-
var _flex = require("../../flex");
|
|
25
25
|
var _time_options = require("./time_options");
|
|
26
26
|
var _pretty_duration = require("./pretty_duration");
|
|
27
27
|
var _async_interval = require("./async_interval");
|
|
@@ -228,7 +228,7 @@ var EuiSuperDatePickerInternal = /*#__PURE__*/function (_Component) {
|
|
|
228
228
|
customQuickSelectRender: customQuickSelectRender,
|
|
229
229
|
dateFormat: dateFormat,
|
|
230
230
|
end: end,
|
|
231
|
-
isDisabled: isDisabled,
|
|
231
|
+
isDisabled: !!isDisabled,
|
|
232
232
|
isPaused: isPaused,
|
|
233
233
|
recentlyUsedRanges: recentlyUsedRanges,
|
|
234
234
|
refreshInterval: refreshInterval,
|
|
@@ -259,41 +259,38 @@ var EuiSuperDatePickerInternal = /*#__PURE__*/function (_Component) {
|
|
|
259
259
|
timeFormat = _this$props3.timeFormat,
|
|
260
260
|
utcOffset = _this$props3.utcOffset,
|
|
261
261
|
compressed = _this$props3.compressed,
|
|
262
|
-
onFocus = _this$props3.onFocus
|
|
263
|
-
className = _this$props3.className,
|
|
264
|
-
dataTestSubj = _this$props3['data-test-subj'];
|
|
262
|
+
onFocus = _this$props3.onFocus;
|
|
265
263
|
var autoRefreshAppend = !isPaused ? (0, _react2.jsx)(_auto_refresh.EuiAutoRefreshButton, {
|
|
266
264
|
refreshInterval: refreshInterval,
|
|
267
|
-
isDisabled: isDisabled,
|
|
265
|
+
isDisabled: !!isDisabled,
|
|
268
266
|
isPaused: isPaused,
|
|
269
267
|
onRefreshChange: _this.onRefreshChange,
|
|
270
268
|
shortHand: true
|
|
271
269
|
}) : undefined;
|
|
272
270
|
var formControlLayoutProps = {
|
|
273
|
-
className: (0, _classnames.default)('euiSuperDatePicker', className),
|
|
274
271
|
compressed: compressed,
|
|
275
272
|
isInvalid: isInvalid,
|
|
276
273
|
isLoading: isLoading && !showUpdateButton,
|
|
277
|
-
disabled: isDisabled,
|
|
274
|
+
disabled: !!isDisabled,
|
|
278
275
|
prepend: _this.renderQuickSelect(),
|
|
279
|
-
append: autoRefreshAppend
|
|
280
|
-
'data-test-subj': dataTestSubj
|
|
276
|
+
append: autoRefreshAppend
|
|
281
277
|
};
|
|
282
278
|
if (isQuickSelectOnly) {
|
|
283
279
|
return (0, _react2.jsx)(_form.EuiFormControlLayout, (0, _extends2.default)({
|
|
284
280
|
iconsPosition: "static"
|
|
285
281
|
}, formControlLayoutProps));
|
|
286
282
|
}
|
|
287
|
-
|
|
283
|
+
var isDisabledDisplay = (0, _predicate.isObject)(isDisabled) && (isDisabled === null || isDisabled === void 0 ? void 0 : isDisabled.display);
|
|
284
|
+
if (isDisabledDisplay || showPrettyDuration && !isStartDatePopoverOpen && !isEndDatePopoverOpen) {
|
|
288
285
|
return (0, _react2.jsx)(_form.EuiFormControlLayout, formControlLayoutProps, (0, _react2.jsx)("button", {
|
|
289
286
|
className: (0, _classnames.default)('euiSuperDatePicker__prettyFormat', {
|
|
290
287
|
'euiSuperDatePicker__prettyFormat--disabled': isDisabled
|
|
291
288
|
}),
|
|
292
289
|
"data-test-subj": "superDatePickerShowDatesButton",
|
|
293
|
-
disabled: isDisabled,
|
|
290
|
+
disabled: !!isDisabled,
|
|
294
291
|
onClick: _this.hidePrettyDuration,
|
|
295
292
|
onFocus: onFocus
|
|
296
|
-
}, (0, _react2.jsx)(_pretty_duration.PrettyDuration, {
|
|
293
|
+
}, isDisabledDisplay ? isDisabled.display : (0, _react2.jsx)(_pretty_duration.PrettyDuration, {
|
|
297
294
|
timeFrom: start,
|
|
298
295
|
timeTo: end,
|
|
299
296
|
quickRanges: commonlyUsedRanges,
|
|
@@ -303,9 +300,6 @@ var EuiSuperDatePickerInternal = /*#__PURE__*/function (_Component) {
|
|
|
303
300
|
return (0, _react2.jsx)(_context.EuiI18nConsumer, null, function (_ref4) {
|
|
304
301
|
var contextLocale = _ref4.locale;
|
|
305
302
|
return (0, _react2.jsx)(_date_picker_range.EuiDatePickerRange, (0, _extends2.default)({}, formControlLayoutProps, {
|
|
306
|
-
className: (0, _classnames.default)(formControlLayoutProps.className, {
|
|
307
|
-
'euiSuperDatePicker--needsUpdating': hasChanged && !isDisabled && !isInvalid
|
|
308
|
-
}),
|
|
309
303
|
isCustom: true,
|
|
310
304
|
iconType: false,
|
|
311
305
|
startDateControl: (0, _react2.jsx)(_date_popover_button.EuiDatePopoverButton, {
|
|
@@ -314,7 +308,7 @@ var EuiSuperDatePickerInternal = /*#__PURE__*/function (_Component) {
|
|
|
314
308
|
position: "start",
|
|
315
309
|
needsUpdating: hasChanged,
|
|
316
310
|
isInvalid: isInvalid,
|
|
317
|
-
isDisabled: isDisabled,
|
|
311
|
+
isDisabled: !!isDisabled,
|
|
318
312
|
onChange: _this.setStart,
|
|
319
313
|
value: start,
|
|
320
314
|
dateFormat: dateFormat,
|
|
@@ -334,7 +328,7 @@ var EuiSuperDatePickerInternal = /*#__PURE__*/function (_Component) {
|
|
|
334
328
|
compressed: compressed,
|
|
335
329
|
needsUpdating: hasChanged,
|
|
336
330
|
isInvalid: isInvalid,
|
|
337
|
-
isDisabled: isDisabled,
|
|
331
|
+
isDisabled: !!isDisabled,
|
|
338
332
|
onChange: _this.setEnd,
|
|
339
333
|
value: end,
|
|
340
334
|
dateFormat: dateFormat,
|
|
@@ -376,18 +370,16 @@ var EuiSuperDatePickerInternal = /*#__PURE__*/function (_Component) {
|
|
|
376
370
|
showUpdateButton = _this$props5.showUpdateButton,
|
|
377
371
|
compressed = _this$props5.compressed;
|
|
378
372
|
if (!showUpdateButton) return null;
|
|
379
|
-
return (0, _react2.jsx)(
|
|
380
|
-
grow: false
|
|
381
|
-
}, (0, _react2.jsx)(_super_update_button.EuiSuperUpdateButton, (0, _extends2.default)({
|
|
373
|
+
return (0, _react2.jsx)(_super_update_button.EuiSuperUpdateButton, (0, _extends2.default)({
|
|
382
374
|
needsUpdate: _this.state.hasChanged,
|
|
383
375
|
showTooltip: !_this.state.isStartDatePopoverOpen && !_this.state.isEndDatePopoverOpen,
|
|
384
376
|
isLoading: isLoading,
|
|
385
|
-
isDisabled: isDisabled || _this.state.isInvalid,
|
|
377
|
+
isDisabled: !!isDisabled || _this.state.isInvalid,
|
|
386
378
|
onClick: _this.handleClickUpdateButton,
|
|
387
379
|
"data-test-subj": "superDatePickerApplyTimeButton",
|
|
388
380
|
size: compressed ? 's' : 'm',
|
|
389
381
|
iconOnly: showUpdateButton === 'iconOnly'
|
|
390
|
-
}, updateButtonProps))
|
|
382
|
+
}, updateButtonProps));
|
|
391
383
|
});
|
|
392
384
|
return _this;
|
|
393
385
|
}
|
|
@@ -406,30 +398,32 @@ var EuiSuperDatePickerInternal = /*#__PURE__*/function (_Component) {
|
|
|
406
398
|
isQuickSelectOnly = _this$props6.isQuickSelectOnly,
|
|
407
399
|
compressed = _this$props6.compressed,
|
|
408
400
|
className = _this$props6.className;
|
|
401
|
+
var _this$state2 = this.state,
|
|
402
|
+
hasChanged = _this$state2.hasChanged,
|
|
403
|
+
isInvalid = _this$state2.isInvalid;
|
|
409
404
|
|
|
410
405
|
// Force reduction in width if showing quick select only
|
|
411
406
|
var width = isQuickSelectOnly ? 'auto' : _width;
|
|
412
|
-
var
|
|
413
|
-
'
|
|
414
|
-
'
|
|
415
|
-
'
|
|
416
|
-
'
|
|
417
|
-
'
|
|
407
|
+
var classes = (0, _classnames.default)('euiSuperDatePicker', className, {
|
|
408
|
+
'euiSuperDatePicker--needsUpdating': hasChanged && !isDisabled && !isInvalid,
|
|
409
|
+
'euiSuperDatePicker--noUpdateButton': !showUpdateButton,
|
|
410
|
+
'euiSuperDatePicker--isAutoRefreshOnly': isAutoRefreshOnly,
|
|
411
|
+
'euiSuperDatePicker--isQuickSelectOnly': isQuickSelectOnly,
|
|
412
|
+
'euiSuperDatePicker--fullWidth': width === 'full',
|
|
413
|
+
'euiSuperDatePicker--autoWidth': width === 'auto'
|
|
418
414
|
});
|
|
419
|
-
return (0, _react2.jsx)(
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
}, isAutoRefreshOnly && onRefreshChange ? (0, _react2.jsx)(_flex.EuiFlexItem, null, (0, _react2.jsx)(_auto_refresh.EuiAutoRefresh, {
|
|
415
|
+
return (0, _react2.jsx)("div", {
|
|
416
|
+
className: classes,
|
|
417
|
+
"data-test-subj": dataTestSubj
|
|
418
|
+
}, isAutoRefreshOnly && onRefreshChange ? (0, _react2.jsx)(_auto_refresh.EuiAutoRefresh, {
|
|
424
419
|
isPaused: isPaused,
|
|
425
420
|
refreshInterval: refreshInterval,
|
|
426
421
|
onRefreshChange: onRefreshChange,
|
|
427
422
|
fullWidth: width === 'full',
|
|
428
423
|
compressed: compressed,
|
|
429
|
-
isDisabled: isDisabled,
|
|
430
|
-
"data-test-subj": dataTestSubj,
|
|
424
|
+
isDisabled: !!isDisabled,
|
|
431
425
|
className: className
|
|
432
|
-
})
|
|
426
|
+
}) : (0, _react2.jsx)(_react.default.Fragment, null, this.renderDatePickerRange(), this.renderUpdateButton()));
|
|
433
427
|
}
|
|
434
428
|
}], [{
|
|
435
429
|
key: "getDerivedStateFromProps",
|
package/package.json
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
.
|
|
1
|
+
.euiSuperDatePicker {
|
|
2
|
+
display: flex;
|
|
3
|
+
gap: $euiSizeS;
|
|
2
4
|
max-width: 100%;
|
|
3
5
|
// Set a sensible min-width for when width is auto
|
|
4
6
|
min-width: MIN(($euiFormMaxWidth / 2) + $euiSuperDatePickerButtonWidth + $euiSizeS, 100%);
|
|
@@ -8,36 +10,38 @@
|
|
|
8
10
|
width: 100%;
|
|
9
11
|
}
|
|
10
12
|
|
|
11
|
-
|
|
13
|
+
&--isAutoRefreshOnly {
|
|
14
|
+
min-width: MIN($euiFormMaxWidth / 2, 100%);
|
|
15
|
+
width: $euiFormMaxWidth;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
&--noUpdateButton {
|
|
19
|
+
min-width: MIN($euiFormMaxWidth / 2, 100%);
|
|
20
|
+
width: $euiSuperDatePickerWidth;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
&--fullWidth {
|
|
12
24
|
width: 100%;
|
|
13
25
|
}
|
|
14
26
|
|
|
15
|
-
|
|
27
|
+
&--isQuickSelectOnly {
|
|
16
28
|
min-width: 0;
|
|
17
29
|
}
|
|
18
30
|
|
|
19
|
-
|
|
31
|
+
&--autoWidth {
|
|
20
32
|
display: inline-flex;
|
|
21
33
|
width: auto;
|
|
22
34
|
}
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
.euiSuperDatePicker__flexWrapper--isAutoRefreshOnly {
|
|
26
|
-
min-width: MIN($euiFormMaxWidth / 2, 100%);
|
|
27
|
-
width: $euiFormMaxWidth;
|
|
28
|
-
}
|
|
29
35
|
|
|
30
|
-
.
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
}
|
|
36
|
+
.euiDatePickerRange {
|
|
37
|
+
flex-grow: 1;
|
|
38
|
+
}
|
|
34
39
|
|
|
35
|
-
.
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
max-width: 100% !important;
|
|
40
|
+
.euiFormControlLayout {
|
|
41
|
+
max-width: 100%; // Allow it to always grow to fit the container since the default form max width is too small
|
|
42
|
+
}
|
|
39
43
|
|
|
40
|
-
|
|
44
|
+
.euiFormControlLayout__childrenWrapper {
|
|
41
45
|
display: flex;
|
|
42
46
|
align-items: center;
|
|
43
47
|
overflow: hidden;
|
|
@@ -74,16 +78,18 @@
|
|
|
74
78
|
/**
|
|
75
79
|
* Make the arrow delimiter match the colors of `.euiDatePopoverButton-needsUpdating`
|
|
76
80
|
*/
|
|
77
|
-
.euiSuperDatePicker--needsUpdating
|
|
78
|
-
.
|
|
79
|
-
|
|
80
|
-
|
|
81
|
+
.euiSuperDatePicker--needsUpdating {
|
|
82
|
+
.euiFormControlLayoutDelimited { // Extra specificity needed to override default delimited styles
|
|
83
|
+
.euiFormControlLayout__childrenWrapper {
|
|
84
|
+
background-color: $euiSuperDatePickerNeedsUpdatingBackgroundColor;
|
|
85
|
+
}
|
|
81
86
|
|
|
82
|
-
|
|
83
|
-
|
|
87
|
+
.euiFormControlLayoutDelimited__delimiter {
|
|
88
|
+
color: $euiSuperDatePickerNeedsUpdatingTextColor;
|
|
89
|
+
}
|
|
84
90
|
}
|
|
85
|
-
}
|
|
86
91
|
|
|
87
|
-
.
|
|
88
|
-
|
|
92
|
+
.euiFormControlLayout__childrenWrapper {
|
|
93
|
+
transition: background $euiAnimSpeedFast ease-in; // Match @mixin euiSuperDatePickerText / .euiDatePopoverButton
|
|
94
|
+
}
|
|
89
95
|
}
|
|
@@ -19,10 +19,10 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
|
19
19
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
20
20
|
var _moment = _interopRequireDefault(require("moment"));
|
|
21
21
|
var _datemath = _interopRequireDefault(require("@elastic/datemath"));
|
|
22
|
+
var _predicate = require("../../../services/predicate");
|
|
22
23
|
var _context = require("../../context");
|
|
23
24
|
var _date_picker_range = require("../date_picker_range");
|
|
24
25
|
var _form = require("../../form");
|
|
25
|
-
var _flex = require("../../flex");
|
|
26
26
|
var _time_options = require("./time_options");
|
|
27
27
|
var _pretty_duration = require("./pretty_duration");
|
|
28
28
|
var _async_interval = require("./async_interval");
|
|
@@ -229,7 +229,7 @@ var EuiSuperDatePickerInternal = /*#__PURE__*/function (_Component) {
|
|
|
229
229
|
customQuickSelectRender: customQuickSelectRender,
|
|
230
230
|
dateFormat: dateFormat,
|
|
231
231
|
end: end,
|
|
232
|
-
isDisabled: isDisabled,
|
|
232
|
+
isDisabled: !!isDisabled,
|
|
233
233
|
isPaused: isPaused,
|
|
234
234
|
recentlyUsedRanges: recentlyUsedRanges,
|
|
235
235
|
refreshInterval: refreshInterval,
|
|
@@ -260,41 +260,38 @@ var EuiSuperDatePickerInternal = /*#__PURE__*/function (_Component) {
|
|
|
260
260
|
timeFormat = _this$props3.timeFormat,
|
|
261
261
|
utcOffset = _this$props3.utcOffset,
|
|
262
262
|
compressed = _this$props3.compressed,
|
|
263
|
-
onFocus = _this$props3.onFocus
|
|
264
|
-
className = _this$props3.className,
|
|
265
|
-
dataTestSubj = _this$props3['data-test-subj'];
|
|
263
|
+
onFocus = _this$props3.onFocus;
|
|
266
264
|
var autoRefreshAppend = !isPaused ? (0, _react2.jsx)(_auto_refresh.EuiAutoRefreshButton, {
|
|
267
265
|
refreshInterval: refreshInterval,
|
|
268
|
-
isDisabled: isDisabled,
|
|
266
|
+
isDisabled: !!isDisabled,
|
|
269
267
|
isPaused: isPaused,
|
|
270
268
|
onRefreshChange: _this.onRefreshChange,
|
|
271
269
|
shortHand: true
|
|
272
270
|
}) : undefined;
|
|
273
271
|
var formControlLayoutProps = {
|
|
274
|
-
className: (0, _classnames.default)('euiSuperDatePicker', className),
|
|
275
272
|
compressed: compressed,
|
|
276
273
|
isInvalid: isInvalid,
|
|
277
274
|
isLoading: isLoading && !showUpdateButton,
|
|
278
|
-
disabled: isDisabled,
|
|
275
|
+
disabled: !!isDisabled,
|
|
279
276
|
prepend: _this.renderQuickSelect(),
|
|
280
|
-
append: autoRefreshAppend
|
|
281
|
-
'data-test-subj': dataTestSubj
|
|
277
|
+
append: autoRefreshAppend
|
|
282
278
|
};
|
|
283
279
|
if (isQuickSelectOnly) {
|
|
284
280
|
return (0, _react2.jsx)(_form.EuiFormControlLayout, (0, _extends2.default)({
|
|
285
281
|
iconsPosition: "static"
|
|
286
282
|
}, formControlLayoutProps));
|
|
287
283
|
}
|
|
288
|
-
|
|
284
|
+
var isDisabledDisplay = (0, _predicate.isObject)(isDisabled) && (isDisabled === null || isDisabled === void 0 ? void 0 : isDisabled.display);
|
|
285
|
+
if (isDisabledDisplay || showPrettyDuration && !isStartDatePopoverOpen && !isEndDatePopoverOpen) {
|
|
289
286
|
return (0, _react2.jsx)(_form.EuiFormControlLayout, formControlLayoutProps, (0, _react2.jsx)("button", {
|
|
290
287
|
className: (0, _classnames.default)('euiSuperDatePicker__prettyFormat', {
|
|
291
288
|
'euiSuperDatePicker__prettyFormat--disabled': isDisabled
|
|
292
289
|
}),
|
|
293
290
|
"data-test-subj": "superDatePickerShowDatesButton",
|
|
294
|
-
disabled: isDisabled,
|
|
291
|
+
disabled: !!isDisabled,
|
|
295
292
|
onClick: _this.hidePrettyDuration,
|
|
296
293
|
onFocus: onFocus
|
|
297
|
-
}, (0, _react2.jsx)(_pretty_duration.PrettyDuration, {
|
|
294
|
+
}, isDisabledDisplay ? isDisabled.display : (0, _react2.jsx)(_pretty_duration.PrettyDuration, {
|
|
298
295
|
timeFrom: start,
|
|
299
296
|
timeTo: end,
|
|
300
297
|
quickRanges: commonlyUsedRanges,
|
|
@@ -304,9 +301,6 @@ var EuiSuperDatePickerInternal = /*#__PURE__*/function (_Component) {
|
|
|
304
301
|
return (0, _react2.jsx)(_context.EuiI18nConsumer, null, function (_ref4) {
|
|
305
302
|
var contextLocale = _ref4.locale;
|
|
306
303
|
return (0, _react2.jsx)(_date_picker_range.EuiDatePickerRange, (0, _extends2.default)({}, formControlLayoutProps, {
|
|
307
|
-
className: (0, _classnames.default)(formControlLayoutProps.className, {
|
|
308
|
-
'euiSuperDatePicker--needsUpdating': hasChanged && !isDisabled && !isInvalid
|
|
309
|
-
}),
|
|
310
304
|
isCustom: true,
|
|
311
305
|
iconType: false,
|
|
312
306
|
startDateControl: (0, _react2.jsx)(_date_popover_button.EuiDatePopoverButton, {
|
|
@@ -315,7 +309,7 @@ var EuiSuperDatePickerInternal = /*#__PURE__*/function (_Component) {
|
|
|
315
309
|
position: "start",
|
|
316
310
|
needsUpdating: hasChanged,
|
|
317
311
|
isInvalid: isInvalid,
|
|
318
|
-
isDisabled: isDisabled,
|
|
312
|
+
isDisabled: !!isDisabled,
|
|
319
313
|
onChange: _this.setStart,
|
|
320
314
|
value: start,
|
|
321
315
|
dateFormat: dateFormat,
|
|
@@ -335,7 +329,7 @@ var EuiSuperDatePickerInternal = /*#__PURE__*/function (_Component) {
|
|
|
335
329
|
compressed: compressed,
|
|
336
330
|
needsUpdating: hasChanged,
|
|
337
331
|
isInvalid: isInvalid,
|
|
338
|
-
isDisabled: isDisabled,
|
|
332
|
+
isDisabled: !!isDisabled,
|
|
339
333
|
onChange: _this.setEnd,
|
|
340
334
|
value: end,
|
|
341
335
|
dateFormat: dateFormat,
|
|
@@ -377,18 +371,16 @@ var EuiSuperDatePickerInternal = /*#__PURE__*/function (_Component) {
|
|
|
377
371
|
showUpdateButton = _this$props5.showUpdateButton,
|
|
378
372
|
compressed = _this$props5.compressed;
|
|
379
373
|
if (!showUpdateButton) return null;
|
|
380
|
-
return (0, _react2.jsx)(
|
|
381
|
-
grow: false
|
|
382
|
-
}, (0, _react2.jsx)(_super_update_button.EuiSuperUpdateButton, (0, _extends2.default)({
|
|
374
|
+
return (0, _react2.jsx)(_super_update_button.EuiSuperUpdateButton, (0, _extends2.default)({
|
|
383
375
|
needsUpdate: _this.state.hasChanged,
|
|
384
376
|
showTooltip: !_this.state.isStartDatePopoverOpen && !_this.state.isEndDatePopoverOpen,
|
|
385
377
|
isLoading: isLoading,
|
|
386
|
-
isDisabled: isDisabled || _this.state.isInvalid,
|
|
378
|
+
isDisabled: !!isDisabled || _this.state.isInvalid,
|
|
387
379
|
onClick: _this.handleClickUpdateButton,
|
|
388
380
|
"data-test-subj": "superDatePickerApplyTimeButton",
|
|
389
381
|
size: compressed ? 's' : 'm',
|
|
390
382
|
iconOnly: showUpdateButton === 'iconOnly'
|
|
391
|
-
}, updateButtonProps))
|
|
383
|
+
}, updateButtonProps));
|
|
392
384
|
});
|
|
393
385
|
return _this;
|
|
394
386
|
}
|
|
@@ -407,30 +399,32 @@ var EuiSuperDatePickerInternal = /*#__PURE__*/function (_Component) {
|
|
|
407
399
|
isQuickSelectOnly = _this$props6.isQuickSelectOnly,
|
|
408
400
|
compressed = _this$props6.compressed,
|
|
409
401
|
className = _this$props6.className;
|
|
402
|
+
var _this$state2 = this.state,
|
|
403
|
+
hasChanged = _this$state2.hasChanged,
|
|
404
|
+
isInvalid = _this$state2.isInvalid;
|
|
410
405
|
|
|
411
406
|
// Force reduction in width if showing quick select only
|
|
412
407
|
var width = isQuickSelectOnly ? 'auto' : _width;
|
|
413
|
-
var
|
|
414
|
-
'
|
|
415
|
-
'
|
|
416
|
-
'
|
|
417
|
-
'
|
|
418
|
-
'
|
|
408
|
+
var classes = (0, _classnames.default)('euiSuperDatePicker', className, {
|
|
409
|
+
'euiSuperDatePicker--needsUpdating': hasChanged && !isDisabled && !isInvalid,
|
|
410
|
+
'euiSuperDatePicker--noUpdateButton': !showUpdateButton,
|
|
411
|
+
'euiSuperDatePicker--isAutoRefreshOnly': isAutoRefreshOnly,
|
|
412
|
+
'euiSuperDatePicker--isQuickSelectOnly': isQuickSelectOnly,
|
|
413
|
+
'euiSuperDatePicker--fullWidth': width === 'full',
|
|
414
|
+
'euiSuperDatePicker--autoWidth': width === 'auto'
|
|
419
415
|
});
|
|
420
|
-
return (0, _react2.jsx)(
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
}, isAutoRefreshOnly && onRefreshChange ? (0, _react2.jsx)(_flex.EuiFlexItem, null, (0, _react2.jsx)(_auto_refresh.EuiAutoRefresh, {
|
|
416
|
+
return (0, _react2.jsx)("div", {
|
|
417
|
+
className: classes,
|
|
418
|
+
"data-test-subj": dataTestSubj
|
|
419
|
+
}, isAutoRefreshOnly && onRefreshChange ? (0, _react2.jsx)(_auto_refresh.EuiAutoRefresh, {
|
|
425
420
|
isPaused: isPaused,
|
|
426
421
|
refreshInterval: refreshInterval,
|
|
427
422
|
onRefreshChange: onRefreshChange,
|
|
428
423
|
fullWidth: width === 'full',
|
|
429
424
|
compressed: compressed,
|
|
430
|
-
isDisabled: isDisabled,
|
|
431
|
-
"data-test-subj": dataTestSubj,
|
|
425
|
+
isDisabled: !!isDisabled,
|
|
432
426
|
className: className
|
|
433
|
-
})
|
|
427
|
+
}) : (0, _react2.jsx)(_react.default.Fragment, null, this.renderDatePickerRange(), this.renderUpdateButton()));
|
|
434
428
|
}
|
|
435
429
|
}], [{
|
|
436
430
|
key: "getDerivedStateFromProps",
|
|
@@ -503,7 +497,15 @@ EuiSuperDatePickerInternal.propTypes = {
|
|
|
503
497
|
* Set isAutoRefreshOnly to true to limit the component to only display auto refresh content.
|
|
504
498
|
*/
|
|
505
499
|
isAutoRefreshOnly: _propTypes.default.bool,
|
|
506
|
-
|
|
500
|
+
/**
|
|
501
|
+
* Accepts either a true/false boolean or an object configuration.
|
|
502
|
+
*
|
|
503
|
+
* The configuration will render the component as disabled, and allow you to
|
|
504
|
+
* customize the displayed disabled text.
|
|
505
|
+
*/
|
|
506
|
+
isDisabled: _propTypes.default.oneOfType([_propTypes.default.bool.isRequired, _propTypes.default.shape({
|
|
507
|
+
display: _propTypes.default.node.isRequired
|
|
508
|
+
}).isRequired]),
|
|
507
509
|
isLoading: _propTypes.default.bool,
|
|
508
510
|
isPaused: _propTypes.default.oneOfType([_propTypes.default.bool, _propTypes.default.bool.isRequired]),
|
|
509
511
|
/**
|
|
@@ -702,7 +704,15 @@ EuiSuperDatePicker.propTypes = {
|
|
|
702
704
|
* Set isAutoRefreshOnly to true to limit the component to only display auto refresh content.
|
|
703
705
|
*/
|
|
704
706
|
isAutoRefreshOnly: _propTypes.default.bool,
|
|
705
|
-
|
|
707
|
+
/**
|
|
708
|
+
* Accepts either a true/false boolean or an object configuration.
|
|
709
|
+
*
|
|
710
|
+
* The configuration will render the component as disabled, and allow you to
|
|
711
|
+
* customize the displayed disabled text.
|
|
712
|
+
*/
|
|
713
|
+
isDisabled: _propTypes.default.oneOfType([_propTypes.default.bool.isRequired, _propTypes.default.shape({
|
|
714
|
+
display: _propTypes.default.node.isRequired
|
|
715
|
+
}).isRequired]),
|
|
706
716
|
isLoading: _propTypes.default.bool,
|
|
707
717
|
isPaused: _propTypes.default.bool,
|
|
708
718
|
/**
|