@elastic/eui 71.1.0 → 72.1.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_charts_theme.js +13 -1
- package/dist/eui_charts_theme.js.map +1 -1
- package/dist/eui_theme_dark.css +20 -176
- package/dist/eui_theme_dark.min.css +1 -1
- package/dist/eui_theme_light.css +20 -176
- package/dist/eui_theme_light.min.css +1 -1
- package/es/components/basic_table/basic_table.js +2 -2
- package/es/components/basic_table/in_memory_table.js +3 -6
- package/es/components/basic_table/table.a11y.js +128 -0
- package/es/components/color_picker/color_picker.styles.js +16 -0
- package/es/components/color_picker/color_stops/color_stop_thumb.js +19 -7
- package/es/components/color_picker/color_stops/color_stop_thumb.styles.js +59 -0
- package/es/components/color_picker/color_stops/color_stops.js +25 -15
- package/es/components/color_picker/color_stops/color_stops.styles.js +65 -0
- package/es/components/date_picker/auto_refresh/refresh_interval.js +3 -1
- package/es/components/date_picker/super_date_picker/quick_select_popover/commonly_used_time_ranges.js +5 -2
- package/es/components/date_picker/super_date_picker/quick_select_popover/quick_select.js +3 -1
- package/es/components/date_picker/super_date_picker/quick_select_popover/quick_select_popover.js +160 -173
- package/es/components/date_picker/super_date_picker/quick_select_popover/recently_used.js +5 -2
- package/es/components/date_picker/super_date_picker/super_date_picker.js +16 -0
- package/es/components/error_boundary/error_boundary.a11y.js +67 -0
- package/es/components/expression/expression.a11y.js +254 -0
- package/es/components/filter_group/filter_group.a11y.js +281 -0
- package/es/components/focus_trap/focus_trap.a11y.js +131 -0
- package/es/components/form/file_picker/file_picker.js +1 -0
- package/es/components/form/range/range_highlight.styles.js +1 -1
- package/es/components/form/range/range_levels.styles.js +1 -1
- package/es/components/form/range/range_track.js +5 -2
- package/es/components/header/header.a11y.js +374 -0
- package/es/components/icon/icon_ML.a11y.js +33 -0
- package/es/components/icon/icon_apps.a11y.js +33 -0
- package/es/components/icon/icon_editor.a11y.js +33 -0
- package/es/components/icon/icon_elastic.a11y.js +33 -0
- package/es/components/icon/icon_glyphs.a11y.js +33 -0
- package/es/components/icon/icon_tokens.a11y.js +33 -0
- package/es/components/image/image.a11y.js +55 -0
- package/es/components/key_pad_menu/key_pad_menu.a11y.js +158 -0
- package/es/components/markdown_editor/plugins/markdown_default_plugins/parsing_plugins.js +1 -1
- package/es/components/popover/popover.js +2 -2
- package/es/components/selectable/selectable.js +4 -3
- package/es/components/selectable/selectable_list/selectable_list.js +17 -5
- package/es/components/table/table_footer_cell.js +1 -1
- package/es/components/table/table_header_cell.js +1 -1
- package/es/components/table/table_row_cell.js +2 -2
- package/es/components/tabs/tab.js +7 -17
- package/es/components/tabs/tabbed_content/tabbed_content.js +0 -16
- package/es/components/tabs/tabs.js +7 -11
- package/es/components/tabs/tabs_context.js +13 -0
- package/es/services/color/manipulation.js +9 -0
- package/es/services/index.js +11 -11
- package/eui.d.ts +195 -138
- package/i18ntokens.json +46 -30
- package/lib/components/basic_table/basic_table.js +2 -2
- package/lib/components/basic_table/in_memory_table.js +3 -6
- package/lib/components/basic_table/table.a11y.js +139 -0
- package/lib/components/color_picker/color_picker.styles.js +26 -0
- package/lib/components/color_picker/color_stops/color_stop_thumb.js +19 -6
- package/lib/components/color_picker/color_stops/color_stop_thumb.styles.js +69 -0
- package/lib/components/color_picker/color_stops/color_stops.js +25 -14
- package/lib/components/color_picker/color_stops/color_stops.styles.js +73 -0
- package/lib/components/date_picker/auto_refresh/refresh_interval.js +3 -1
- package/lib/components/date_picker/super_date_picker/quick_select_popover/commonly_used_time_ranges.js +5 -2
- package/lib/components/date_picker/super_date_picker/quick_select_popover/quick_select.js +3 -1
- package/lib/components/date_picker/super_date_picker/quick_select_popover/quick_select_popover.js +155 -168
- package/lib/components/date_picker/super_date_picker/quick_select_popover/recently_used.js +5 -2
- package/lib/components/date_picker/super_date_picker/super_date_picker.js +16 -0
- package/lib/components/error_boundary/error_boundary.a11y.js +75 -0
- package/lib/components/expression/expression.a11y.js +262 -0
- package/lib/components/filter_group/filter_group.a11y.js +287 -0
- package/lib/components/focus_trap/focus_trap.a11y.js +140 -0
- package/lib/components/form/file_picker/file_picker.js +1 -0
- package/lib/components/form/range/range_highlight.styles.js +1 -1
- package/lib/components/form/range/range_levels.styles.js +1 -1
- package/lib/components/form/range/range_track.js +6 -2
- package/lib/components/header/header.a11y.js +385 -0
- package/lib/components/icon/icon_ML.a11y.js +40 -0
- package/lib/components/icon/icon_apps.a11y.js +40 -0
- package/lib/components/icon/icon_editor.a11y.js +40 -0
- package/lib/components/icon/icon_elastic.a11y.js +40 -0
- package/lib/components/icon/icon_glyphs.a11y.js +40 -0
- package/lib/components/icon/icon_tokens.a11y.js +40 -0
- package/lib/components/image/image.a11y.js +61 -0
- package/lib/components/key_pad_menu/key_pad_menu.a11y.js +163 -0
- package/lib/components/markdown_editor/plugins/markdown_default_plugins/parsing_plugins.js +2 -2
- package/lib/components/popover/popover.js +2 -2
- package/lib/components/selectable/selectable.js +4 -3
- package/lib/components/selectable/selectable_list/selectable_list.js +17 -5
- package/lib/components/table/table_footer_cell.js +1 -1
- package/lib/components/table/table_header_cell.js +1 -1
- package/lib/components/table/table_row_cell.js +2 -2
- package/lib/components/tabs/tab.js +14 -17
- package/lib/components/tabs/tabbed_content/tabbed_content.js +0 -16
- package/lib/components/tabs/tabs.js +8 -14
- package/lib/components/tabs/tabs_context.js +23 -0
- package/lib/services/color/manipulation.js +14 -2
- package/lib/services/index.js +65 -58
- package/optimize/es/components/basic_table/table.a11y.js +128 -0
- package/optimize/es/components/color_picker/color_picker.styles.js +16 -0
- package/optimize/es/components/color_picker/color_stops/color_stop_thumb.js +19 -7
- package/optimize/es/components/color_picker/color_stops/color_stop_thumb.styles.js +59 -0
- package/optimize/es/components/color_picker/color_stops/color_stops.js +25 -15
- package/optimize/es/components/color_picker/color_stops/color_stops.styles.js +65 -0
- package/optimize/es/components/date_picker/auto_refresh/refresh_interval.js +3 -1
- package/optimize/es/components/date_picker/super_date_picker/quick_select_popover/commonly_used_time_ranges.js +5 -2
- package/optimize/es/components/date_picker/super_date_picker/quick_select_popover/quick_select.js +3 -1
- package/optimize/es/components/date_picker/super_date_picker/quick_select_popover/quick_select_popover.js +145 -169
- package/optimize/es/components/date_picker/super_date_picker/quick_select_popover/recently_used.js +5 -2
- package/optimize/es/components/date_picker/super_date_picker/super_date_picker.js +2 -0
- package/optimize/es/components/error_boundary/error_boundary.a11y.js +67 -0
- package/optimize/es/components/expression/expression.a11y.js +243 -0
- package/optimize/es/components/filter_group/filter_group.a11y.js +271 -0
- package/optimize/es/components/focus_trap/focus_trap.a11y.js +120 -0
- package/optimize/es/components/form/file_picker/file_picker.js +1 -0
- package/optimize/es/components/form/range/range_highlight.styles.js +1 -1
- package/optimize/es/components/form/range/range_levels.styles.js +1 -1
- package/optimize/es/components/form/range/range_track.js +5 -2
- package/optimize/es/components/header/header.a11y.js +364 -0
- package/optimize/es/components/icon/icon_ML.a11y.js +33 -0
- package/optimize/es/components/icon/icon_apps.a11y.js +33 -0
- package/optimize/es/components/icon/icon_editor.a11y.js +33 -0
- package/optimize/es/components/icon/icon_elastic.a11y.js +33 -0
- package/optimize/es/components/icon/icon_glyphs.a11y.js +33 -0
- package/optimize/es/components/icon/icon_tokens.a11y.js +33 -0
- package/optimize/es/components/image/image.a11y.js +55 -0
- package/optimize/es/components/key_pad_menu/key_pad_menu.a11y.js +148 -0
- package/optimize/es/components/markdown_editor/plugins/markdown_default_plugins/parsing_plugins.js +1 -1
- package/optimize/es/components/popover/popover.js +2 -2
- package/optimize/es/components/selectable/selectable.js +2 -2
- package/optimize/es/components/selectable/selectable_list/selectable_list.js +15 -4
- package/optimize/es/components/tabs/tab.js +7 -5
- package/optimize/es/components/tabs/tabs.js +7 -11
- package/optimize/es/components/tabs/tabs_context.js +13 -0
- package/optimize/es/services/color/manipulation.js +9 -0
- package/optimize/es/services/index.js +11 -11
- package/optimize/lib/components/basic_table/table.a11y.js +139 -0
- package/optimize/lib/components/color_picker/color_picker.styles.js +26 -0
- package/optimize/lib/components/color_picker/color_stops/color_stop_thumb.js +19 -6
- package/optimize/lib/components/color_picker/color_stops/color_stop_thumb.styles.js +69 -0
- package/optimize/lib/components/color_picker/color_stops/color_stops.js +25 -14
- package/optimize/lib/components/color_picker/color_stops/color_stops.styles.js +73 -0
- package/optimize/lib/components/date_picker/auto_refresh/refresh_interval.js +3 -1
- package/optimize/lib/components/date_picker/super_date_picker/quick_select_popover/commonly_used_time_ranges.js +5 -2
- package/optimize/lib/components/date_picker/super_date_picker/quick_select_popover/quick_select.js +3 -1
- package/optimize/lib/components/date_picker/super_date_picker/quick_select_popover/quick_select_popover.js +146 -167
- package/optimize/lib/components/date_picker/super_date_picker/quick_select_popover/recently_used.js +5 -2
- package/optimize/lib/components/date_picker/super_date_picker/super_date_picker.js +2 -0
- package/optimize/lib/components/error_boundary/error_boundary.a11y.js +75 -0
- package/optimize/lib/components/expression/expression.a11y.js +254 -0
- package/optimize/lib/components/filter_group/filter_group.a11y.js +287 -0
- package/optimize/lib/components/focus_trap/focus_trap.a11y.js +140 -0
- package/optimize/lib/components/form/file_picker/file_picker.js +1 -0
- package/optimize/lib/components/form/range/range_highlight.styles.js +1 -1
- package/optimize/lib/components/form/range/range_levels.styles.js +1 -1
- package/optimize/lib/components/form/range/range_track.js +6 -2
- package/optimize/lib/components/header/header.a11y.js +385 -0
- package/optimize/lib/components/icon/icon_ML.a11y.js +40 -0
- package/optimize/lib/components/icon/icon_apps.a11y.js +40 -0
- package/optimize/lib/components/icon/icon_editor.a11y.js +40 -0
- package/optimize/lib/components/icon/icon_elastic.a11y.js +40 -0
- package/optimize/lib/components/icon/icon_glyphs.a11y.js +40 -0
- package/optimize/lib/components/icon/icon_tokens.a11y.js +40 -0
- package/optimize/lib/components/image/image.a11y.js +61 -0
- package/optimize/lib/components/key_pad_menu/key_pad_menu.a11y.js +163 -0
- package/optimize/lib/components/markdown_editor/plugins/markdown_default_plugins/parsing_plugins.js +2 -2
- package/optimize/lib/components/popover/popover.js +2 -2
- package/optimize/lib/components/selectable/selectable.js +2 -2
- package/optimize/lib/components/selectable/selectable_list/selectable_list.js +15 -4
- package/optimize/lib/components/tabs/tab.js +15 -5
- package/optimize/lib/components/tabs/tabs.js +8 -14
- package/optimize/lib/components/tabs/tabs_context.js +23 -0
- package/optimize/lib/services/color/manipulation.js +14 -2
- package/optimize/lib/services/index.js +65 -58
- package/package.json +4 -6
- package/src/components/color_picker/_index.scss +0 -1
- package/src/components/date_picker/super_date_picker/quick_select_popover/_quick_select_popover.scss +14 -0
- package/src/components/form/file_picker/_file_picker.scss +14 -14
- package/src/themes/amsterdam/overrides/_index.scss +0 -1
- package/test-env/components/basic_table/basic_table.js +2 -2
- package/test-env/components/basic_table/in_memory_table.js +3 -6
- package/test-env/components/basic_table/table.a11y.js +139 -0
- package/test-env/components/color_picker/color_picker.styles.js +26 -0
- package/test-env/components/color_picker/color_stops/color_stop_thumb.js +19 -6
- package/test-env/components/color_picker/color_stops/color_stop_thumb.styles.js +69 -0
- package/test-env/components/color_picker/color_stops/color_stops.js +25 -14
- package/test-env/components/color_picker/color_stops/color_stops.styles.js +73 -0
- package/test-env/components/date_picker/auto_refresh/refresh_interval.js +3 -1
- package/test-env/components/date_picker/super_date_picker/quick_select_popover/commonly_used_time_ranges.js +5 -2
- package/test-env/components/date_picker/super_date_picker/quick_select_popover/quick_select.js +3 -1
- package/test-env/components/date_picker/super_date_picker/quick_select_popover/quick_select_popover.js +153 -166
- package/test-env/components/date_picker/super_date_picker/quick_select_popover/recently_used.js +5 -2
- package/test-env/components/date_picker/super_date_picker/super_date_picker.js +16 -0
- package/test-env/components/error_boundary/error_boundary.a11y.js +75 -0
- package/test-env/components/expression/expression.a11y.js +254 -0
- package/test-env/components/filter_group/filter_group.a11y.js +287 -0
- package/test-env/components/focus_trap/focus_trap.a11y.js +140 -0
- package/test-env/components/form/file_picker/file_picker.js +1 -0
- package/test-env/components/form/range/range_highlight.styles.js +1 -1
- package/test-env/components/form/range/range_levels.styles.js +1 -1
- package/test-env/components/form/range/range_track.js +6 -2
- package/test-env/components/header/header.a11y.js +385 -0
- package/test-env/components/icon/icon_ML.a11y.js +40 -0
- package/test-env/components/icon/icon_apps.a11y.js +40 -0
- package/test-env/components/icon/icon_editor.a11y.js +40 -0
- package/test-env/components/icon/icon_elastic.a11y.js +40 -0
- package/test-env/components/icon/icon_glyphs.a11y.js +40 -0
- package/test-env/components/icon/icon_tokens.a11y.js +40 -0
- package/test-env/components/image/image.a11y.js +61 -0
- package/test-env/components/key_pad_menu/key_pad_menu.a11y.js +163 -0
- package/test-env/components/markdown_editor/plugins/markdown_default_plugins/parsing_plugins.js +2 -2
- package/test-env/components/popover/popover.js +2 -2
- package/test-env/components/selectable/selectable.js +4 -3
- package/test-env/components/selectable/selectable_list/selectable_list.js +17 -5
- package/test-env/components/table/table_footer_cell.js +1 -1
- package/test-env/components/table/table_header_cell.js +1 -1
- package/test-env/components/table/table_row_cell.js +2 -2
- package/test-env/components/tabs/tab.js +15 -17
- package/test-env/components/tabs/tabbed_content/tabbed_content.js +0 -16
- package/test-env/components/tabs/tabs.js +8 -14
- package/test-env/components/tabs/tabs_context.js +23 -0
- package/test-env/services/color/manipulation.js +14 -2
- package/test-env/services/index.js +65 -58
- package/src/components/color_picker/color_stops/_color_stops.scss +0 -101
- package/src/components/color_picker/color_stops/_index.scss +0 -1
- package/src/themes/amsterdam/overrides/_color_stops.scss +0 -58
|
@@ -18,7 +18,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
18
18
|
*/
|
|
19
19
|
import React, { useCallback, useEffect, useMemo, useState } from 'react';
|
|
20
20
|
import classNames from 'classnames';
|
|
21
|
-
import { keys, DEFAULT_VISUALIZATION_COLOR, getSteppedGradient } from '../../../services';
|
|
21
|
+
import { keys, DEFAULT_VISUALIZATION_COLOR, getSteppedGradient, useEuiTheme } from '../../../services';
|
|
22
22
|
import { EuiColorStopThumb } from './color_stop_thumb';
|
|
23
23
|
import { addStop, addDefinedStop, getPositionFromStop, getStopFromMouseLocation, isInvalid, removeStop } from './utils';
|
|
24
24
|
import { getChromaColor } from '../utils';
|
|
@@ -27,6 +27,7 @@ import { EuiScreenReaderOnly } from '../../accessibility';
|
|
|
27
27
|
import { EuiRangeHighlight } from '../../form/range/range_highlight';
|
|
28
28
|
import { EuiRangeTrack } from '../../form/range/range_track';
|
|
29
29
|
import { EuiRangeWrapper } from '../../form/range/range_wrapper';
|
|
30
|
+
import { euiColorStopsStyles, euiColorStopsAddContainerStyles } from './color_stops.styles';
|
|
30
31
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
31
32
|
// Because of how the thumbs are rendered in the popover, using ref results in an infinite loop.
|
|
32
33
|
// We'll instead use old fashioned namespaced DOM selectors to get references
|
|
@@ -165,11 +166,16 @@ export var EuiColorStops = function EuiColorStops(_ref) {
|
|
|
165
166
|
setFocusStopOnUpdate = _useState14[1];
|
|
166
167
|
|
|
167
168
|
var isNotInteractive = disabled || readOnly;
|
|
168
|
-
var
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
169
|
+
var isDragging = isHoverDisabled && !isNotInteractive;
|
|
170
|
+
var addContainerIsDisabled = isHoverDisabled || isNotInteractive;
|
|
171
|
+
var classes = classNames('euiColorStops', className);
|
|
172
|
+
var euiTheme = useEuiTheme();
|
|
173
|
+
var styles = euiColorStopsStyles(euiTheme);
|
|
174
|
+
var cssPopoverStyles = [styles.euiColorStops, !disabled ? styles.isEnabled : styles.isDisabled, readOnly && styles.isReadOnly, isDragging && styles.isDragging];
|
|
175
|
+
var cssTrackStyles = [styles.euiColorStops__track];
|
|
176
|
+
var cssAddTargetStyles = [styles.euiColorStops__addTarget];
|
|
177
|
+
var addContainerStyles = euiColorStopsAddContainerStyles(euiTheme);
|
|
178
|
+
var cssAddContainerStyles = [addContainerStyles.euiColorStopsAddContainer, !addContainerIsDisabled ? addContainerStyles.isEnabled : addContainerStyles.isDisabled];
|
|
173
179
|
|
|
174
180
|
var getStopFromMouseLocationFn = function getStopFromMouseLocationFn(location) {
|
|
175
181
|
// Guard against `null` ref in usage
|
|
@@ -370,7 +376,7 @@ export var EuiColorStops = function EuiColorStops(_ref) {
|
|
|
370
376
|
disabled: disabled,
|
|
371
377
|
readOnly: readOnly,
|
|
372
378
|
"aria-valuetext": "Stop: ".concat(colorStop.stop, ", Color: ").concat(colorStop.color, " (").concat(index + 1, " of ").concat(colorStops.length, ")"),
|
|
373
|
-
isPopoverOpen: colorStop.id === openedStopId,
|
|
379
|
+
isPopoverOpen: !isDragging && colorStop.id === openedStopId,
|
|
374
380
|
openPopover: function openPopover() {
|
|
375
381
|
setOpenedStopId(colorStop.id);
|
|
376
382
|
},
|
|
@@ -380,7 +386,7 @@ export var EuiColorStops = function EuiColorStops(_ref) {
|
|
|
380
386
|
valueInputProps: valueInputProps
|
|
381
387
|
});
|
|
382
388
|
});
|
|
383
|
-
}, [colorStops, disabled, handleOnChange, max, min, mode, onRemove, openedStopId, rangeMax, rangeMin, readOnly, showAlpha, sortedStops, swatches, wrapperRef, valueInputProps]);
|
|
389
|
+
}, [colorStops, disabled, handleOnChange, isDragging, max, min, mode, onRemove, openedStopId, rangeMax, rangeMin, readOnly, showAlpha, sortedStops, swatches, wrapperRef, valueInputProps]);
|
|
384
390
|
var positions = wrapperRef ? sortedStops.map(function (_ref3) {
|
|
385
391
|
var stop = _ref3.stop;
|
|
386
392
|
return getPositionFromStopFn(stop);
|
|
@@ -388,10 +394,10 @@ export var EuiColorStops = function EuiColorStops(_ref) {
|
|
|
388
394
|
|
|
389
395
|
var gradientStop = function gradientStop(colorStop, index) {
|
|
390
396
|
var color = getChromaColor(colorStop.color, showAlpha);
|
|
391
|
-
var rgba = color ? color.css() : '
|
|
397
|
+
var rgba = color ? color.css() : 'transparent';
|
|
392
398
|
|
|
393
399
|
if (index === 0) {
|
|
394
|
-
return "
|
|
400
|
+
return "transparent, transparent ".concat(positions[index], "%, ").concat(rgba, " ").concat(positions[index], "%");
|
|
395
401
|
}
|
|
396
402
|
|
|
397
403
|
return "".concat(rgba, " ").concat(positions[index], "%");
|
|
@@ -419,13 +425,15 @@ export var EuiColorStops = function EuiColorStops(_ref) {
|
|
|
419
425
|
percentageSteps = percentageSteps + percentage;
|
|
420
426
|
});
|
|
421
427
|
steppedGradient = steppedGradient.substring(0, steppedGradient.length - 2);
|
|
422
|
-
gradient = "linear-gradient(to right,
|
|
428
|
+
gradient = "linear-gradient(to right, transparent ".concat(trailingPercentage, "%, ").concat(steppedGradient, ")");
|
|
423
429
|
} else {
|
|
424
430
|
var linearGradient = sortedStops.map(stopType === 'gradient' ? gradientStop : fixedStop);
|
|
425
431
|
gradient = "linear-gradient(to right,".concat(linearGradient, ")");
|
|
426
432
|
}
|
|
427
433
|
|
|
428
|
-
return ___EmotionJSX(EuiRangeWrapper, _extends({
|
|
434
|
+
return ___EmotionJSX(EuiRangeWrapper, _extends({
|
|
435
|
+
css: cssPopoverStyles
|
|
436
|
+
}, rest, {
|
|
429
437
|
"data-test-subj": classNames('euiColorStops', rest['data-test-subj']),
|
|
430
438
|
ref: setWrapperRef,
|
|
431
439
|
className: classes,
|
|
@@ -448,6 +456,8 @@ export var EuiColorStops = function EuiColorStops(_ref) {
|
|
|
448
456
|
token: "euiColorStops.screenReaderAnnouncement",
|
|
449
457
|
default: "{label}: {readOnly} {disabled} Color stop picker. Each stop consists of a number and corresponding color value. Use the Down and Up arrow keys to select individual stops. Press the Enter key to create a new stop."
|
|
450
458
|
}))), ___EmotionJSX(EuiRangeTrack, {
|
|
459
|
+
className: "euiColorStops__track",
|
|
460
|
+
css: cssTrackStyles,
|
|
451
461
|
min: min || rangeMin,
|
|
452
462
|
max: max || rangeMax,
|
|
453
463
|
compressed: compressed,
|
|
@@ -464,13 +474,13 @@ export var EuiColorStops = function EuiColorStops(_ref) {
|
|
|
464
474
|
trackWidth: trackWidth
|
|
465
475
|
}), ___EmotionJSX("div", {
|
|
466
476
|
"data-test-subj": "euiColorStopsAdd",
|
|
467
|
-
className:
|
|
468
|
-
|
|
469
|
-
}),
|
|
477
|
+
className: "euiColorStops__addContainer",
|
|
478
|
+
css: cssAddContainerStyles,
|
|
470
479
|
onClick: handleAddClick,
|
|
471
480
|
onMouseMove: handleAddHover
|
|
472
481
|
}, ___EmotionJSX("div", {
|
|
473
482
|
className: "euiColorStops__addTarget",
|
|
483
|
+
css: cssAddTargetStyles,
|
|
474
484
|
style: {
|
|
475
485
|
left: "".concat(addTargetPosition, "%")
|
|
476
486
|
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
function _EMOTION_STRINGIFIED_CSS_ERROR__() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
|
|
2
|
+
|
|
3
|
+
/*
|
|
4
|
+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
5
|
+
* or more contributor license agreements. Licensed under the Elastic License
|
|
6
|
+
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
|
7
|
+
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
8
|
+
* Side Public License, v 1.
|
|
9
|
+
*/
|
|
10
|
+
import { css } from '@emotion/react';
|
|
11
|
+
import { darken, brighten, hexToRgb } from '../../../services';
|
|
12
|
+
import { mathWithUnits, euiCanAnimate } from '../../../global_styling';
|
|
13
|
+
import { euiCustomControl } from '../../form/form.styles';
|
|
14
|
+
import { euiRangeThumbStyle, euiRangeVariables } from '../../form/range/range.styles';
|
|
15
|
+
|
|
16
|
+
var _ref2 = process.env.NODE_ENV === "production" ? {
|
|
17
|
+
name: "uu65b3-isDragging",
|
|
18
|
+
styles: "cursor:grabbing;label:isDragging;"
|
|
19
|
+
} : {
|
|
20
|
+
name: "uu65b3-isDragging",
|
|
21
|
+
styles: "cursor:grabbing;label:isDragging;",
|
|
22
|
+
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export var euiColorStopsStyles = function euiColorStopsStyles(euiThemeContext) {
|
|
26
|
+
var range = euiRangeVariables(euiThemeContext);
|
|
27
|
+
var euiTheme = euiThemeContext.euiTheme,
|
|
28
|
+
colorMode = euiThemeContext.colorMode;
|
|
29
|
+
var isDarkMode = colorMode === 'DARK';
|
|
30
|
+
var stripeColor = isDarkMode ? brighten(range.trackColor, 0.5) : darken(range.trackColor, 0.5);
|
|
31
|
+
var stripesBackground = "repeating-linear-gradient(\n -45deg,\n ".concat(range.trackColor, ",\n ").concat(range.trackColor, " 25%,\n ").concat(stripeColor, " 25%,\n ").concat(stripeColor, " 50%,\n ").concat(range.trackColor, " 50%\n )");
|
|
32
|
+
return {
|
|
33
|
+
// Base
|
|
34
|
+
euiColorStops: /*#__PURE__*/css(";label:euiColorStops;"),
|
|
35
|
+
isEnabled: /*#__PURE__*/css("&:focus{outline:none;}&:focus-visible{.euiColorStops__track::after{box-shadow:0 0 0 1px rgba(", hexToRgb(euiTheme.colors.emptyShade).join(', '), ", 0.8),0 0 0 3px ", range.focusColor, ";}};label:isEnabled;"),
|
|
36
|
+
isDisabled: /*#__PURE__*/css(";label:isDisabled;"),
|
|
37
|
+
isHoverDisabled: /*#__PURE__*/css(";label:isHoverDisabled;"),
|
|
38
|
+
isReadOnly: /*#__PURE__*/css(";label:isReadOnly;"),
|
|
39
|
+
isDragging: _ref2,
|
|
40
|
+
euiColorStops__track: /*#__PURE__*/css("&::after{background:", stripesBackground, ";background-size:", euiTheme.size.xs, " ", euiTheme.size.xs, ";};label:euiColorStops__track;"),
|
|
41
|
+
euiColorStops__addTarget: /*#__PURE__*/css(euiCustomControl(euiThemeContext, {
|
|
42
|
+
type: 'round'
|
|
43
|
+
}), ";", euiRangeThumbStyle(euiThemeContext), ";position:absolute;inset-block-start:0;block-size:", range.thumbHeight, ";inline-size:", range.thumbHeight, ";background-color:", euiTheme.colors.lightestShade, ";pointer-events:none;opacity:0;border:", euiTheme.border.width.thin, " solid ", euiTheme.colors.darkShade, ";box-shadow:none;z-index:", range.thumbZIndex, ";", euiCanAnimate, "{transition:opacity ", euiTheme.animation.fast, " ease-in;};label:euiColorStops__addTarget;")
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
var _ref = process.env.NODE_ENV === "production" ? {
|
|
48
|
+
name: "1173em8-isEnabled",
|
|
49
|
+
styles: "&:hover{cursor:pointer;.euiColorStops__addTarget{opacity:0.7;}};label:isEnabled;"
|
|
50
|
+
} : {
|
|
51
|
+
name: "1173em8-isEnabled",
|
|
52
|
+
styles: "&:hover{cursor:pointer;.euiColorStops__addTarget{opacity:0.7;}};label:isEnabled;",
|
|
53
|
+
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
export var euiColorStopsAddContainerStyles = function euiColorStopsAddContainerStyles(euiThemeContext) {
|
|
57
|
+
var range = euiRangeVariables(euiThemeContext);
|
|
58
|
+
return {
|
|
59
|
+
euiColorStopsAddContainer: /*#__PURE__*/css("display:block;position:absolute;inset-inline-start:0;inset-inline-end:0;inset-block-start:50%;block-size:", range.thumbHeight, ";margin-block-start:", mathWithUnits(range.thumbHeight, function (x) {
|
|
60
|
+
return x * -0.5;
|
|
61
|
+
}), ";z-index:", range.thumbZIndex, ";;label:euiColorStopsAddContainer;"),
|
|
62
|
+
isEnabled: _ref,
|
|
63
|
+
isDisabled: /*#__PURE__*/css(";label:isDisabled;")
|
|
64
|
+
};
|
|
65
|
+
};
|
|
@@ -213,7 +213,9 @@ export var EuiRefreshInterval = /*#__PURE__*/function (_Component) {
|
|
|
213
213
|
units = _this$state5.units;
|
|
214
214
|
return ___EmotionJSX(RenderI18nTimeOptions, null, function (_ref3) {
|
|
215
215
|
var refreshUnitsOptions = _ref3.refreshUnitsOptions;
|
|
216
|
-
return ___EmotionJSX("fieldset",
|
|
216
|
+
return ___EmotionJSX("fieldset", {
|
|
217
|
+
className: "euiQuickSelectPopover__panel"
|
|
218
|
+
}, ___EmotionJSX(EuiFlexGroup, {
|
|
217
219
|
alignItems: "center",
|
|
218
220
|
gutterSize: "s",
|
|
219
221
|
responsive: false,
|
|
@@ -38,10 +38,13 @@ export var EuiCommonlyUsedTimeRanges = function EuiCommonlyUsedTimeRanges(_ref)
|
|
|
38
38
|
"data-test-subj": dataTestSubj
|
|
39
39
|
}, label));
|
|
40
40
|
});
|
|
41
|
-
return ___EmotionJSX("fieldset",
|
|
41
|
+
return ___EmotionJSX("fieldset", {
|
|
42
|
+
className: "euiQuickSelectPopover__panel"
|
|
43
|
+
}, ___EmotionJSX(EuiTitle, {
|
|
42
44
|
size: "xxxs"
|
|
43
45
|
}, ___EmotionJSX("legend", {
|
|
44
|
-
id: legendId
|
|
46
|
+
id: legendId,
|
|
47
|
+
className: "euiQuickSelectPopover__panelTitle"
|
|
45
48
|
}, ___EmotionJSX(EuiI18n, {
|
|
46
49
|
token: "euiCommonlyUsedTimeRanges.legend",
|
|
47
50
|
default: "Commonly used"
|
package/optimize/es/components/date_picker/super_date_picker/quick_select_popover/quick_select.js
CHANGED
|
@@ -173,7 +173,9 @@ export var EuiQuickSelect = /*#__PURE__*/function (_Component) {
|
|
|
173
173
|
return value === timeUnits;
|
|
174
174
|
});
|
|
175
175
|
var timeUnit = matchedTimeUnit ? matchedTimeUnit.text : '';
|
|
176
|
-
return ___EmotionJSX("fieldset",
|
|
176
|
+
return ___EmotionJSX("fieldset", {
|
|
177
|
+
className: "euiQuickSelectPopover__panel"
|
|
178
|
+
}, ___EmotionJSX(EuiI18n, {
|
|
177
179
|
token: "euiQuickSelect.legendText",
|
|
178
180
|
default: "Quick select a time range"
|
|
179
181
|
}, function (legendText) {
|
|
@@ -1,14 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
6
|
-
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
7
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
8
|
-
|
|
9
|
-
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
10
|
-
|
|
11
|
-
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
3
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
4
|
+
var _excluded = ["applyTime"];
|
|
12
5
|
|
|
13
6
|
/*
|
|
14
7
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
@@ -17,177 +10,160 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
|
|
|
17
10
|
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
18
11
|
* Side Public License, v 1.
|
|
19
12
|
*/
|
|
20
|
-
import React, {
|
|
13
|
+
import React, { useState, useCallback, useMemo } from 'react';
|
|
21
14
|
import { EuiButtonEmpty } from '../../../button';
|
|
22
15
|
import { EuiIcon } from '../../../icon';
|
|
23
16
|
import { EuiPopover } from '../../../popover';
|
|
24
17
|
import { EuiTitle } from '../../../title';
|
|
25
|
-
import { EuiHorizontalRule } from '../../../horizontal_rule';
|
|
26
18
|
import { EuiText } from '../../../text';
|
|
19
|
+
import { useEuiI18n } from '../../../i18n';
|
|
27
20
|
import { EuiQuickSelect } from './quick_select';
|
|
28
21
|
import { EuiCommonlyUsedTimeRanges } from './commonly_used_time_ranges';
|
|
29
22
|
import { EuiRecentlyUsed } from './recently_used';
|
|
30
23
|
import { EuiRefreshInterval } from '../../auto_refresh/refresh_interval';
|
|
31
24
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
32
|
-
export var EuiQuickSelectPopover =
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
_defineProperty(_assertThisInitialized(_this), "closePopover", function () {
|
|
53
|
-
_this.setState({
|
|
54
|
-
isOpen: false
|
|
55
|
-
});
|
|
56
|
-
});
|
|
57
|
-
|
|
58
|
-
_defineProperty(_assertThisInitialized(_this), "togglePopover", function () {
|
|
59
|
-
_this.setState(function (prevState) {
|
|
60
|
-
return {
|
|
61
|
-
isOpen: !prevState.isOpen
|
|
62
|
-
};
|
|
63
|
-
});
|
|
64
|
-
});
|
|
65
|
-
|
|
66
|
-
_defineProperty(_assertThisInitialized(_this), "applyTime", function (_ref) {
|
|
67
|
-
var start = _ref.start,
|
|
68
|
-
end = _ref.end,
|
|
69
|
-
quickSelect = _ref.quickSelect,
|
|
70
|
-
_ref$keepPopoverOpen = _ref.keepPopoverOpen,
|
|
71
|
-
keepPopoverOpen = _ref$keepPopoverOpen === void 0 ? false : _ref$keepPopoverOpen;
|
|
72
|
-
|
|
73
|
-
_this.props.applyTime({
|
|
74
|
-
start: start,
|
|
75
|
-
end: end
|
|
76
|
-
});
|
|
77
|
-
|
|
78
|
-
if (quickSelect) {
|
|
79
|
-
_this.setState({
|
|
80
|
-
prevQuickSelect: quickSelect
|
|
81
|
-
});
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
if (!keepPopoverOpen) {
|
|
85
|
-
_this.closePopover();
|
|
86
|
-
}
|
|
25
|
+
export var EuiQuickSelectPopover = function EuiQuickSelectPopover(_ref) {
|
|
26
|
+
var _applyTime = _ref.applyTime,
|
|
27
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
28
|
+
|
|
29
|
+
var _useState = useState(),
|
|
30
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
31
|
+
prevQuickSelect = _useState2[0],
|
|
32
|
+
setQuickSelect = _useState2[1];
|
|
33
|
+
|
|
34
|
+
var _useState3 = useState(false),
|
|
35
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
36
|
+
isOpen = _useState4[0],
|
|
37
|
+
setIsOpen = _useState4[1];
|
|
38
|
+
|
|
39
|
+
var closePopover = useCallback(function () {
|
|
40
|
+
return setIsOpen(false);
|
|
41
|
+
}, []);
|
|
42
|
+
var togglePopover = useCallback(function () {
|
|
43
|
+
return setIsOpen(function (isOpen) {
|
|
44
|
+
return !isOpen;
|
|
87
45
|
});
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
applyTime: _this.applyTime,
|
|
100
|
-
start: start,
|
|
101
|
-
end: end,
|
|
102
|
-
prevQuickSelect: prevQuickSelect,
|
|
103
|
-
timeOptions: timeOptions
|
|
104
|
-
}), commonlyUsedRanges.length > 0 && ___EmotionJSX(EuiHorizontalRule, {
|
|
105
|
-
margin: "s"
|
|
106
|
-
}), ___EmotionJSX(EuiCommonlyUsedTimeRanges, {
|
|
107
|
-
applyTime: _this.applyTime,
|
|
108
|
-
commonlyUsedRanges: commonlyUsedRanges
|
|
109
|
-
}), recentlyUsedRanges.length > 0 && ___EmotionJSX(EuiHorizontalRule, {
|
|
110
|
-
margin: "s"
|
|
111
|
-
}), ___EmotionJSX(EuiRecentlyUsed, {
|
|
112
|
-
applyTime: _this.applyTime,
|
|
113
|
-
commonlyUsedRanges: commonlyUsedRanges,
|
|
114
|
-
dateFormat: dateFormat,
|
|
115
|
-
recentlyUsedRanges: recentlyUsedRanges
|
|
116
|
-
}), _this.renderCustomQuickSelectPanels());
|
|
117
|
-
});
|
|
118
|
-
|
|
119
|
-
_defineProperty(_assertThisInitialized(_this), "renderCustomQuickSelectPanels", function () {
|
|
120
|
-
var customQuickSelectPanels = _this.props.customQuickSelectPanels;
|
|
121
|
-
|
|
122
|
-
if (!customQuickSelectPanels) {
|
|
123
|
-
return null;
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
return customQuickSelectPanels.map(function (_ref2) {
|
|
127
|
-
var title = _ref2.title,
|
|
128
|
-
content = _ref2.content;
|
|
129
|
-
return ___EmotionJSX(Fragment, {
|
|
130
|
-
key: title
|
|
131
|
-
}, ___EmotionJSX(EuiHorizontalRule, {
|
|
132
|
-
margin: "s"
|
|
133
|
-
}), ___EmotionJSX(EuiTitle, {
|
|
134
|
-
size: "xxxs"
|
|
135
|
-
}, ___EmotionJSX("span", null, title)), ___EmotionJSX(EuiText, {
|
|
136
|
-
size: "s",
|
|
137
|
-
className: "euiQuickSelectPopover__section"
|
|
138
|
-
}, /*#__PURE__*/React.cloneElement(content, {
|
|
139
|
-
applyTime: _this.applyTime
|
|
140
|
-
})));
|
|
141
|
-
});
|
|
46
|
+
}, []);
|
|
47
|
+
var applyTime = useCallback(function (_ref2) {
|
|
48
|
+
var start = _ref2.start,
|
|
49
|
+
end = _ref2.end,
|
|
50
|
+
quickSelect = _ref2.quickSelect,
|
|
51
|
+
_ref2$keepPopoverOpen = _ref2.keepPopoverOpen,
|
|
52
|
+
keepPopoverOpen = _ref2$keepPopoverOpen === void 0 ? false : _ref2$keepPopoverOpen;
|
|
53
|
+
|
|
54
|
+
_applyTime({
|
|
55
|
+
start: start,
|
|
56
|
+
end: end
|
|
142
57
|
});
|
|
143
58
|
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
_createClass(EuiQuickSelectPopover, [{
|
|
148
|
-
key: "render",
|
|
149
|
-
value: function render() {
|
|
150
|
-
var _this$props2 = this.props,
|
|
151
|
-
applyRefreshInterval = _this$props2.applyRefreshInterval,
|
|
152
|
-
isDisabled = _this$props2.isDisabled,
|
|
153
|
-
isPaused = _this$props2.isPaused,
|
|
154
|
-
refreshInterval = _this$props2.refreshInterval;
|
|
155
|
-
var isOpen = this.state.isOpen;
|
|
156
|
-
|
|
157
|
-
var quickSelectButton = ___EmotionJSX(EuiButtonEmpty, {
|
|
158
|
-
className: "euiFormControlLayout__prepend",
|
|
159
|
-
textProps: {
|
|
160
|
-
className: 'euiQuickSelectPopover__buttonText'
|
|
161
|
-
},
|
|
162
|
-
onClick: this.togglePopover,
|
|
163
|
-
"aria-label": "Date quick select",
|
|
164
|
-
size: "xs",
|
|
165
|
-
iconType: "arrowDown",
|
|
166
|
-
iconSide: "right",
|
|
167
|
-
isDisabled: isDisabled,
|
|
168
|
-
"data-test-subj": "superDatePickerToggleQuickMenuButton"
|
|
169
|
-
}, ___EmotionJSX(EuiIcon, {
|
|
170
|
-
type: "calendar"
|
|
171
|
-
}));
|
|
59
|
+
if (quickSelect) {
|
|
60
|
+
setQuickSelect(quickSelect);
|
|
61
|
+
}
|
|
172
62
|
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
63
|
+
if (!keepPopoverOpen) {
|
|
64
|
+
closePopover();
|
|
65
|
+
}
|
|
66
|
+
}, [_applyTime, closePopover]);
|
|
67
|
+
var buttonlabel = useEuiI18n('euiQuickSelectPopover.buttonLabel', 'Date quick select');
|
|
68
|
+
|
|
69
|
+
var quickSelectButton = ___EmotionJSX(EuiButtonEmpty, {
|
|
70
|
+
className: "euiFormControlLayout__prepend",
|
|
71
|
+
textProps: {
|
|
72
|
+
className: 'euiQuickSelectPopover__buttonText'
|
|
73
|
+
},
|
|
74
|
+
onClick: togglePopover,
|
|
75
|
+
"aria-label": buttonlabel,
|
|
76
|
+
title: buttonlabel,
|
|
77
|
+
size: "xs",
|
|
78
|
+
iconType: "arrowDown",
|
|
79
|
+
iconSide: "right",
|
|
80
|
+
isDisabled: props.isDisabled,
|
|
81
|
+
"data-test-subj": "superDatePickerToggleQuickMenuButton"
|
|
82
|
+
}, ___EmotionJSX(EuiIcon, {
|
|
83
|
+
type: "calendar"
|
|
84
|
+
}));
|
|
85
|
+
|
|
86
|
+
return ___EmotionJSX(EuiPopover, {
|
|
87
|
+
button: quickSelectButton,
|
|
88
|
+
isOpen: isOpen,
|
|
89
|
+
closePopover: closePopover,
|
|
90
|
+
anchorPosition: "downLeft",
|
|
91
|
+
anchorClassName: "euiQuickSelectPopover__anchor"
|
|
92
|
+
}, ___EmotionJSX(EuiQuickSelectPanels, _extends({}, props, {
|
|
93
|
+
applyTime: applyTime,
|
|
94
|
+
prevQuickSelect: prevQuickSelect
|
|
95
|
+
})));
|
|
96
|
+
};
|
|
97
|
+
export var EuiQuickSelectPanels = function EuiQuickSelectPanels(_ref3) {
|
|
98
|
+
var start = _ref3.start,
|
|
99
|
+
end = _ref3.end,
|
|
100
|
+
dateFormat = _ref3.dateFormat,
|
|
101
|
+
timeOptions = _ref3.timeOptions,
|
|
102
|
+
commonlyUsedRanges = _ref3.commonlyUsedRanges,
|
|
103
|
+
recentlyUsedRanges = _ref3.recentlyUsedRanges,
|
|
104
|
+
customQuickSelectPanels = _ref3.customQuickSelectPanels,
|
|
105
|
+
customQuickSelectRender = _ref3.customQuickSelectRender,
|
|
106
|
+
isPaused = _ref3.isPaused,
|
|
107
|
+
refreshInterval = _ref3.refreshInterval,
|
|
108
|
+
applyRefreshInterval = _ref3.applyRefreshInterval,
|
|
109
|
+
applyTime = _ref3.applyTime,
|
|
110
|
+
prevQuickSelect = _ref3.prevQuickSelect;
|
|
111
|
+
|
|
112
|
+
var quickSelectElement = ___EmotionJSX(EuiQuickSelect, {
|
|
113
|
+
applyTime: applyTime,
|
|
114
|
+
start: start,
|
|
115
|
+
end: end,
|
|
116
|
+
prevQuickSelect: prevQuickSelect,
|
|
117
|
+
timeOptions: timeOptions
|
|
118
|
+
});
|
|
119
|
+
|
|
120
|
+
var commonlyUsedElement = ___EmotionJSX(EuiCommonlyUsedTimeRanges, {
|
|
121
|
+
applyTime: applyTime,
|
|
122
|
+
commonlyUsedRanges: commonlyUsedRanges
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
var recentlyUsedElement = ___EmotionJSX(EuiRecentlyUsed, {
|
|
126
|
+
applyTime: applyTime,
|
|
127
|
+
commonlyUsedRanges: commonlyUsedRanges,
|
|
128
|
+
dateFormat: dateFormat,
|
|
129
|
+
recentlyUsedRanges: recentlyUsedRanges
|
|
130
|
+
});
|
|
131
|
+
|
|
132
|
+
var refreshIntervalElement = applyRefreshInterval && ___EmotionJSX(EuiRefreshInterval, {
|
|
133
|
+
onRefreshChange: applyRefreshInterval,
|
|
134
|
+
isPaused: isPaused,
|
|
135
|
+
refreshInterval: refreshInterval
|
|
136
|
+
});
|
|
137
|
+
|
|
138
|
+
var customQuickSelectPanelsElement = useMemo(function () {
|
|
139
|
+
if (!customQuickSelectPanels) {
|
|
140
|
+
return null;
|
|
189
141
|
}
|
|
190
|
-
}]);
|
|
191
142
|
|
|
192
|
-
|
|
193
|
-
|
|
143
|
+
return customQuickSelectPanels.map(function (_ref4) {
|
|
144
|
+
var title = _ref4.title,
|
|
145
|
+
content = _ref4.content;
|
|
146
|
+
return ___EmotionJSX("div", {
|
|
147
|
+
key: title,
|
|
148
|
+
className: "euiQuickSelectPopover__panel"
|
|
149
|
+
}, ___EmotionJSX(EuiTitle, {
|
|
150
|
+
size: "xxxs"
|
|
151
|
+
}, ___EmotionJSX("span", null, title)), ___EmotionJSX(EuiText, {
|
|
152
|
+
size: "s",
|
|
153
|
+
className: "euiQuickSelectPopover__section"
|
|
154
|
+
}, /*#__PURE__*/React.cloneElement(content, {
|
|
155
|
+
applyTime: applyTime
|
|
156
|
+
})));
|
|
157
|
+
});
|
|
158
|
+
}, [customQuickSelectPanels, applyTime]);
|
|
159
|
+
return ___EmotionJSX("div", {
|
|
160
|
+
className: "euiQuickSelectPopover__content",
|
|
161
|
+
"data-test-subj": "superDatePickerQuickMenu"
|
|
162
|
+
}, customQuickSelectRender ? customQuickSelectRender({
|
|
163
|
+
quickSelect: quickSelectElement,
|
|
164
|
+
commonlyUsedRanges: commonlyUsedElement,
|
|
165
|
+
recentlyUsedRanges: recentlyUsedElement,
|
|
166
|
+
refreshInterval: refreshIntervalElement,
|
|
167
|
+
customQuickSelectPanels: customQuickSelectPanelsElement
|
|
168
|
+
}) : ___EmotionJSX(React.Fragment, null, quickSelectElement, commonlyUsedElement, recentlyUsedElement, refreshIntervalElement, customQuickSelectPanelsElement));
|
|
169
|
+
};
|
package/optimize/es/components/date_picker/super_date_picker/quick_select_popover/recently_used.js
CHANGED
|
@@ -47,10 +47,13 @@ export var EuiRecentlyUsed = function EuiRecentlyUsed(_ref) {
|
|
|
47
47
|
dateFormat: dateFormat
|
|
48
48
|
})));
|
|
49
49
|
});
|
|
50
|
-
return ___EmotionJSX("fieldset",
|
|
50
|
+
return ___EmotionJSX("fieldset", {
|
|
51
|
+
className: "euiQuickSelectPopover__panel"
|
|
52
|
+
}, ___EmotionJSX(EuiTitle, {
|
|
51
53
|
size: "xxxs"
|
|
52
54
|
}, ___EmotionJSX("legend", {
|
|
53
|
-
id: legendId
|
|
55
|
+
id: legendId,
|
|
56
|
+
className: "euiQuickSelectPopover__panelTitle"
|
|
54
57
|
}, ___EmotionJSX(EuiI18n, {
|
|
55
58
|
token: "euiRecentlyUsed.legend",
|
|
56
59
|
default: "Recently used date ranges"
|
|
@@ -384,6 +384,7 @@ export var EuiSuperDatePickerInternal = /*#__PURE__*/function (_Component) {
|
|
|
384
384
|
commonlyUsedRanges = _this$props5.commonlyUsedRanges,
|
|
385
385
|
timeOptions = _this$props5.timeOptions,
|
|
386
386
|
customQuickSelectPanels = _this$props5.customQuickSelectPanels,
|
|
387
|
+
customQuickSelectRender = _this$props5.customQuickSelectRender,
|
|
387
388
|
dateFormat = _this$props5.dateFormat,
|
|
388
389
|
end = _this$props5.end,
|
|
389
390
|
isAutoRefreshOnly = _this$props5.isAutoRefreshOnly,
|
|
@@ -415,6 +416,7 @@ export var EuiSuperDatePickerInternal = /*#__PURE__*/function (_Component) {
|
|
|
415
416
|
applyTime: this.applyQuickTime,
|
|
416
417
|
commonlyUsedRanges: commonlyUsedRanges,
|
|
417
418
|
customQuickSelectPanels: customQuickSelectPanels,
|
|
419
|
+
customQuickSelectRender: customQuickSelectRender,
|
|
418
420
|
dateFormat: dateFormat,
|
|
419
421
|
end: end,
|
|
420
422
|
isDisabled: isDisabled,
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
3
|
+
* or more contributor license agreements. Licensed under the Elastic License
|
|
4
|
+
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
|
5
|
+
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
6
|
+
* Side Public License, v 1.
|
|
7
|
+
*/
|
|
8
|
+
/// <reference types="../../../cypress/support"/>
|
|
9
|
+
import React from 'react';
|
|
10
|
+
import { EuiButton } from '../button';
|
|
11
|
+
import { EuiErrorBoundary } from './error_boundary';
|
|
12
|
+
import { EuiSpacer } from '../spacer';
|
|
13
|
+
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
14
|
+
|
|
15
|
+
var handleFocus = function handleFocus() {
|
|
16
|
+
var target = document.querySelector('pre.euiCodeBlock__pre');
|
|
17
|
+
target.focus();
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
describe('EuiErrorBoundary', function () {
|
|
21
|
+
describe('Automated accessibility check when an error is thrown', function () {
|
|
22
|
+
var BadComponent = function BadComponent() {
|
|
23
|
+
throw new Error('Throw the error.');
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
beforeEach(function () {
|
|
27
|
+
cy.on('uncaught:exception', function (err) {
|
|
28
|
+
if (err.message.includes('Throw the error')) {
|
|
29
|
+
return false;
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
cy.viewport(1024, 768); // medium breakpoint
|
|
33
|
+
|
|
34
|
+
cy.realMount(___EmotionJSX(React.Fragment, null, ___EmotionJSX(EuiButton, {
|
|
35
|
+
color: "primary",
|
|
36
|
+
onClick: handleFocus,
|
|
37
|
+
"data-test-subj": "cy-error-boundary-button"
|
|
38
|
+
}, "Press to focus"), ___EmotionJSX(EuiSpacer, null), ___EmotionJSX(EuiErrorBoundary, null, ___EmotionJSX(BadComponent, null))));
|
|
39
|
+
});
|
|
40
|
+
it('has zero violations on first render', function () {
|
|
41
|
+
cy.checkAxe();
|
|
42
|
+
});
|
|
43
|
+
it('has zero violations and accepts focus when the button is pressed', function () {
|
|
44
|
+
cy.realPress('Tab');
|
|
45
|
+
cy.realPress('Enter');
|
|
46
|
+
cy.get('pre.euiCodeBlock__pre').should('have.focus');
|
|
47
|
+
cy.checkAxe();
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
describe('Automated accessibility check when no error is thrown', function () {
|
|
51
|
+
var GoodComponent = function GoodComponent() {
|
|
52
|
+
return ___EmotionJSX("div", {
|
|
53
|
+
"data-test-subj": "cy-good-component"
|
|
54
|
+
}, "This is a properly rendered component.");
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
beforeEach(function () {
|
|
58
|
+
cy.viewport(1024, 768); // medium breakpoint
|
|
59
|
+
|
|
60
|
+
cy.realMount(___EmotionJSX(EuiErrorBoundary, null, ___EmotionJSX(GoodComponent, null)));
|
|
61
|
+
});
|
|
62
|
+
it('has zero violations when no violations are thrown', function () {
|
|
63
|
+
cy.get('div[data-test-subj="cy-good-component"]').should('exist');
|
|
64
|
+
cy.checkAxe();
|
|
65
|
+
});
|
|
66
|
+
});
|
|
67
|
+
});
|