@elastic/eui 59.1.0 → 60.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/README.md +7 -0
- package/dist/eui_theme_dark.css +0 -493
- package/dist/eui_theme_dark.json +7 -44
- package/dist/eui_theme_dark.json.d.ts +7 -44
- package/dist/eui_theme_dark.min.css +1 -1
- package/dist/eui_theme_light.css +0 -493
- package/dist/eui_theme_light.json +7 -44
- package/dist/eui_theme_light.json.d.ts +7 -44
- package/dist/eui_theme_light.min.css +1 -1
- package/es/components/accessibility/screen_reader_live/screen_reader_live.js +30 -7
- package/es/components/accessibility/screen_reader_only/screen_reader_only.js +14 -19
- package/es/components/accessibility/screen_reader_only/screen_reader_only.styles.js +11 -1
- package/es/components/accessibility/skip_link/skip_link.js +20 -4
- package/es/components/avatar/avatar.js +2 -2
- package/es/components/badge/badge.js +1 -1
- package/es/components/button/button_icon/button_icon.js +1 -1
- package/es/components/collapsible_nav/collapsible_nav_group/collapsible_nav_group.js +2 -2
- package/es/components/combo_box/matching_options.js +3 -2
- package/es/components/datagrid/body/data_grid_body.js +6 -6
- package/es/components/datagrid/body/data_grid_cell.js +12 -12
- package/es/components/datagrid/body/header/data_grid_header_cell.js +6 -6
- package/es/components/datagrid/body/header/data_grid_header_row.js +6 -6
- package/es/components/datagrid/data_grid.js +6 -6
- package/es/components/datagrid/utils/in_memory.js +6 -6
- package/es/components/date_picker/date_picker.js +1 -1
- package/es/components/empty_prompt/empty_prompt.js +1 -1
- package/es/components/form/field_text/field_text.js +1 -1
- package/es/components/form/form_control_layout/form_control_layout.js +1 -1
- package/es/components/form/form_control_layout/form_control_layout_icons.js +1 -1
- package/es/components/health/health.js +1 -1
- package/es/components/icon/icon.js +43 -495
- package/es/components/icon/icon.styles.js +75 -0
- package/es/components/icon/icon_map.js +455 -0
- package/es/components/icon/named_colors.js +2 -13
- package/es/components/list_group/list_group.js +1 -1
- package/es/components/list_group/list_group_item.js +1 -1
- package/es/components/list_group/pinnable_list_group/pinnable_list_group.js +2 -2
- package/es/components/notification/notification_event.js +2 -2
- package/es/components/notification/notification_event_meta.js +1 -1
- package/es/components/notification/notification_event_read_button.js +1 -1
- package/es/components/progress/progress.js +34 -87
- package/es/components/progress/progress.styles.js +155 -0
- package/es/components/provider/cache/cache_provider.js +17 -0
- package/es/components/provider/cache/index.js +8 -0
- package/es/components/provider/provider.js +35 -5
- package/es/components/selectable/selectable.js +39 -22
- package/es/components/selectable/selectable_list/selectable_list.js +1 -1
- package/es/components/selectable/selectable_list/selectable_list_item.js +1 -1
- package/es/components/selectable/selectable_templates/selectable_template_sitewide.js +2 -2
- package/es/components/stat/stat.js +28 -35
- package/es/components/stat/stat.styles.js +38 -0
- package/es/components/timeline/timeline.js +15 -8
- package/es/components/timeline/timeline.styles.js +29 -0
- package/es/components/timeline/timeline_item.js +4 -16
- package/es/components/timeline/timeline_item.styles.js +18 -3
- package/es/components/timeline/timeline_item_icon.styles.js +14 -4
- package/es/components/tool_tip/icon_tip.js +1 -1
- package/es/global_styling/functions/logicals.js +2 -2
- package/es/global_styling/utility/utility.js +17 -0
- package/es/services/theme/hooks.js +4 -2
- package/es/services/theme/provider.js +1 -5
- package/es/test/emotion-prefix.js +29 -0
- package/es/test/index.d.ts +5 -0
- package/es/test/index.js +2 -1
- package/eui.d.ts +450 -454
- package/i18ntokens.json +18 -18
- package/lib/components/accessibility/screen_reader_live/screen_reader_live.js +29 -6
- package/lib/components/accessibility/screen_reader_only/screen_reader_only.js +22 -19
- package/lib/components/accessibility/screen_reader_only/screen_reader_only.styles.js +16 -2
- package/lib/components/accessibility/skip_link/skip_link.js +21 -4
- package/lib/components/avatar/avatar.js +2 -2
- package/lib/components/badge/badge.js +1 -1
- package/lib/components/button/button_icon/button_icon.js +1 -1
- package/lib/components/collapsible_nav/collapsible_nav_group/collapsible_nav_group.js +2 -2
- package/lib/components/combo_box/matching_options.js +3 -2
- package/lib/components/datagrid/body/data_grid_body.js +6 -6
- package/lib/components/datagrid/body/data_grid_cell.js +12 -12
- package/lib/components/datagrid/body/header/data_grid_header_cell.js +6 -6
- package/lib/components/datagrid/body/header/data_grid_header_row.js +6 -6
- package/lib/components/datagrid/data_grid.js +6 -6
- package/lib/components/datagrid/utils/in_memory.js +6 -6
- package/lib/components/date_picker/date_picker.js +1 -1
- package/lib/components/empty_prompt/empty_prompt.js +1 -1
- package/lib/components/form/field_text/field_text.js +1 -1
- package/lib/components/form/form_control_layout/form_control_layout.js +1 -1
- package/lib/components/form/form_control_layout/form_control_layout_icons.js +1 -1
- package/lib/components/health/health.js +1 -1
- package/lib/components/icon/icon.js +54 -499
- package/lib/components/icon/icon.styles.js +79 -0
- package/lib/components/icon/icon_map.js +463 -0
- package/lib/components/icon/named_colors.js +4 -15
- package/lib/components/list_group/list_group.js +1 -1
- package/lib/components/list_group/list_group_item.js +1 -1
- package/lib/components/list_group/pinnable_list_group/pinnable_list_group.js +2 -2
- package/lib/components/notification/notification_event.js +2 -2
- package/lib/components/notification/notification_event_meta.js +1 -1
- package/lib/components/notification/notification_event_read_button.js +1 -1
- package/lib/components/progress/progress.js +36 -88
- package/lib/components/progress/progress.styles.js +166 -0
- package/lib/components/provider/cache/cache_provider.js +29 -0
- package/lib/components/provider/cache/index.js +18 -0
- package/lib/components/provider/provider.js +36 -5
- package/lib/components/selectable/selectable.js +39 -22
- package/lib/components/selectable/selectable_list/selectable_list.js +1 -1
- package/lib/components/selectable/selectable_list/selectable_list_item.js +1 -1
- package/lib/components/selectable/selectable_templates/selectable_template_sitewide.js +3 -3
- package/lib/components/stat/stat.js +30 -40
- package/lib/components/stat/stat.styles.js +45 -0
- package/lib/components/timeline/timeline.js +20 -9
- package/lib/components/timeline/timeline.styles.js +39 -0
- package/lib/components/timeline/timeline_item.js +4 -17
- package/lib/components/timeline/timeline_item.styles.js +17 -10
- package/lib/components/timeline/timeline_item_icon.styles.js +15 -4
- package/lib/components/tool_tip/icon_tip.js +1 -1
- package/lib/global_styling/functions/logicals.js +2 -2
- package/lib/global_styling/utility/utility.js +31 -0
- package/lib/services/theme/hooks.js +4 -2
- package/lib/services/theme/provider.js +3 -6
- package/lib/test/emotion-prefix.js +38 -0
- package/lib/test/index.d.ts +5 -0
- package/lib/test/index.js +23 -1
- package/optimize/es/components/accessibility/screen_reader_live/screen_reader_live.js +21 -6
- package/optimize/es/components/accessibility/screen_reader_only/screen_reader_only.js +11 -17
- package/optimize/es/components/accessibility/screen_reader_only/screen_reader_only.styles.js +11 -1
- package/optimize/es/components/accessibility/skip_link/skip_link.js +20 -4
- package/optimize/es/components/combo_box/matching_options.js +3 -2
- package/optimize/es/components/icon/icon.js +40 -492
- package/optimize/es/components/icon/icon.styles.js +75 -0
- package/optimize/es/components/icon/icon_map.js +455 -0
- package/optimize/es/components/icon/named_colors.js +2 -13
- package/optimize/es/components/progress/progress.js +31 -84
- package/optimize/es/components/progress/progress.styles.js +155 -0
- package/optimize/es/components/provider/cache/cache_provider.js +17 -0
- package/optimize/es/components/provider/cache/index.js +8 -0
- package/optimize/es/components/provider/provider.js +35 -5
- package/optimize/es/components/selectable/selectable.js +33 -22
- package/optimize/es/components/stat/stat.js +25 -33
- package/optimize/es/components/stat/stat.styles.js +38 -0
- package/optimize/es/components/timeline/timeline.js +10 -1
- package/optimize/es/components/timeline/timeline.styles.js +29 -0
- package/optimize/es/components/timeline/timeline_item.js +4 -9
- package/optimize/es/components/timeline/timeline_item.styles.js +18 -3
- package/optimize/es/components/timeline/timeline_item_icon.styles.js +14 -4
- package/optimize/es/global_styling/functions/logicals.js +2 -2
- package/optimize/es/global_styling/utility/utility.js +17 -0
- package/optimize/es/services/theme/hooks.js +4 -2
- package/optimize/es/services/theme/provider.js +1 -5
- package/optimize/es/test/emotion-prefix.js +27 -0
- package/optimize/es/test/index.d.ts +5 -0
- package/optimize/es/test/index.js +2 -1
- package/optimize/lib/components/accessibility/screen_reader_live/screen_reader_live.js +20 -5
- package/optimize/lib/components/accessibility/screen_reader_only/screen_reader_only.js +18 -16
- package/optimize/lib/components/accessibility/screen_reader_only/screen_reader_only.styles.js +16 -2
- package/optimize/lib/components/accessibility/skip_link/skip_link.js +21 -4
- package/optimize/lib/components/combo_box/matching_options.js +3 -2
- package/optimize/lib/components/icon/icon.js +49 -494
- package/optimize/lib/components/icon/icon.styles.js +81 -0
- package/optimize/lib/components/icon/icon_map.js +463 -0
- package/optimize/lib/components/icon/named_colors.js +4 -15
- package/optimize/lib/components/progress/progress.js +33 -85
- package/optimize/lib/components/progress/progress.styles.js +168 -0
- package/optimize/lib/components/provider/cache/cache_provider.js +29 -0
- package/optimize/lib/components/provider/cache/index.js +18 -0
- package/optimize/lib/components/provider/provider.js +36 -5
- package/optimize/lib/components/selectable/selectable.js +33 -22
- package/optimize/lib/components/stat/stat.js +27 -37
- package/optimize/lib/components/stat/stat.styles.js +47 -0
- package/optimize/lib/components/timeline/timeline.js +14 -2
- package/optimize/lib/components/timeline/timeline.styles.js +39 -0
- package/optimize/lib/components/timeline/timeline_item.js +4 -10
- package/optimize/lib/components/timeline/timeline_item.styles.js +17 -10
- package/optimize/lib/components/timeline/timeline_item_icon.styles.js +15 -4
- package/optimize/lib/global_styling/functions/logicals.js +2 -2
- package/optimize/lib/global_styling/utility/utility.js +31 -0
- package/optimize/lib/services/theme/hooks.js +4 -2
- package/optimize/lib/services/theme/provider.js +3 -6
- package/optimize/lib/test/emotion-prefix.js +40 -0
- package/optimize/lib/test/index.d.ts +5 -0
- package/optimize/lib/test/index.js +23 -1
- package/package.json +2 -2
- package/src/components/form/form_control_layout/_form_control_layout.scss +2 -4
- package/src/components/index.scss +0 -4
- package/src/global_styling/variables/_form.scss +9 -0
- package/src/themes/amsterdam/overrides/_index.scss +0 -1
- package/test-env/components/accessibility/screen_reader_live/screen_reader_live.js +29 -6
- package/test-env/components/accessibility/screen_reader_only/screen_reader_only.js +21 -18
- package/test-env/components/accessibility/screen_reader_only/screen_reader_only.styles.js +16 -2
- package/test-env/components/accessibility/skip_link/skip_link.js +21 -4
- package/test-env/components/avatar/avatar.js +2 -2
- package/test-env/components/badge/badge.js +1 -1
- package/test-env/components/button/button_icon/button_icon.js +1 -1
- package/test-env/components/collapsible_nav/collapsible_nav_group/collapsible_nav_group.js +2 -2
- package/test-env/components/combo_box/matching_options.js +3 -2
- package/test-env/components/datagrid/body/data_grid_body.js +6 -6
- package/test-env/components/datagrid/body/data_grid_cell.js +12 -12
- package/test-env/components/datagrid/body/header/data_grid_header_cell.js +6 -6
- package/test-env/components/datagrid/body/header/data_grid_header_row.js +6 -6
- package/test-env/components/datagrid/data_grid.js +6 -6
- package/test-env/components/datagrid/utils/in_memory.js +6 -6
- package/test-env/components/date_picker/date_picker.js +1 -1
- package/test-env/components/empty_prompt/empty_prompt.js +1 -1
- package/test-env/components/form/field_text/field_text.js +1 -1
- package/test-env/components/form/form_control_layout/form_control_layout.js +1 -1
- package/test-env/components/form/form_control_layout/form_control_layout_icons.js +1 -1
- package/test-env/components/health/health.js +1 -1
- package/test-env/components/icon/icon.styles.js +81 -0
- package/test-env/components/icon/icon_map.js +463 -0
- package/test-env/components/icon/named_colors.js +4 -15
- package/test-env/components/list_group/list_group.js +1 -1
- package/test-env/components/list_group/list_group_item.js +1 -1
- package/test-env/components/list_group/pinnable_list_group/pinnable_list_group.js +2 -2
- package/test-env/components/notification/notification_event.js +2 -2
- package/test-env/components/notification/notification_event_meta.js +1 -1
- package/test-env/components/notification/notification_event_read_button.js +1 -1
- package/test-env/components/progress/progress.js +36 -88
- package/test-env/components/progress/progress.styles.js +168 -0
- package/test-env/components/provider/cache/cache_provider.js +29 -0
- package/test-env/components/provider/cache/index.js +18 -0
- package/test-env/components/provider/provider.js +36 -5
- package/test-env/components/selectable/selectable.js +39 -22
- package/test-env/components/selectable/selectable_list/selectable_list.js +1 -1
- package/test-env/components/selectable/selectable_list/selectable_list_item.js +1 -1
- package/test-env/components/selectable/selectable_templates/selectable_template_sitewide.js +3 -3
- package/test-env/components/stat/stat.js +29 -39
- package/test-env/components/stat/stat.styles.js +47 -0
- package/test-env/components/timeline/timeline.js +19 -9
- package/test-env/components/timeline/timeline.styles.js +39 -0
- package/test-env/components/timeline/timeline_item.js +4 -17
- package/test-env/components/timeline/timeline_item.styles.js +17 -10
- package/test-env/components/timeline/timeline_item_icon.styles.js +15 -4
- package/test-env/components/tool_tip/icon_tip.js +1 -1
- package/test-env/global_styling/functions/logicals.js +2 -2
- package/test-env/global_styling/utility/utility.js +31 -0
- package/test-env/services/theme/hooks.js +4 -2
- package/test-env/services/theme/provider.js +3 -6
- package/test-env/test/emotion-prefix.js +40 -0
- package/test-env/test/index.js +23 -1
- package/src/components/accessibility/_index.scss +0 -1
- package/src/components/accessibility/screen_reader_only/_screen_reader_only.scss +0 -5
- package/src/components/icon/_icon.scss +0 -87
- package/src/components/icon/_index.scss +0 -2
- package/src/components/icon/_variables.scss +0 -22
- package/src/components/progress/_index.scss +0 -2
- package/src/components/progress/_progress.scss +0 -166
- package/src/components/progress/_variables.scss +0 -21
- package/src/components/stat/_index.scss +0 -1
- package/src/components/stat/_stat.scss +0 -50
- package/src/themes/amsterdam/overrides/_progress.scss +0 -3
|
@@ -2,6 +2,12 @@ var _excluded = ["children", "className", "description", "isLoading", "reverse",
|
|
|
2
2
|
|
|
3
3
|
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
4
4
|
|
|
5
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
6
|
+
|
|
7
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
8
|
+
|
|
9
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
10
|
+
|
|
5
11
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
6
12
|
|
|
7
13
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
@@ -15,31 +21,16 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
|
|
|
15
21
|
*/
|
|
16
22
|
import React, { Fragment, createElement } from 'react';
|
|
17
23
|
import PropTypes from "prop-types";
|
|
18
|
-
import { keysOf } from '../common';
|
|
19
24
|
import classNames from 'classnames';
|
|
20
25
|
import { EuiText } from '../text';
|
|
21
26
|
import { EuiTitle } from '../title/title';
|
|
22
27
|
import { EuiScreenReaderOnly } from '../accessibility';
|
|
23
28
|
import { EuiI18n } from '../i18n';
|
|
29
|
+
import { useEuiTheme } from '../../services';
|
|
30
|
+
import { euiStatStyles, euiStatTitleStyles } from './stat.styles';
|
|
24
31
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
25
|
-
var
|
|
26
|
-
|
|
27
|
-
subdued: 'euiStat__title--subdued',
|
|
28
|
-
primary: 'euiStat__title--primary',
|
|
29
|
-
success: 'euiStat__title--success',
|
|
30
|
-
danger: 'euiStat__title--danger',
|
|
31
|
-
accent: 'euiStat__title--accent'
|
|
32
|
-
};
|
|
33
|
-
export var COLORS = keysOf(colorToClassNameMap);
|
|
34
|
-
var textAlignToClassNameMap = {
|
|
35
|
-
left: 'euiStat--leftAligned',
|
|
36
|
-
center: 'euiStat--centerAligned',
|
|
37
|
-
right: 'euiStat--rightAligned'
|
|
38
|
-
};
|
|
39
|
-
export var isColorClass = function isColorClass(input) {
|
|
40
|
-
return colorToClassNameMap.hasOwnProperty(input);
|
|
41
|
-
};
|
|
42
|
-
export var ALIGNMENTS = keysOf(textAlignToClassNameMap);
|
|
32
|
+
export var COLORS = ['default', 'subdued', 'primary', 'success', 'danger', 'accent'];
|
|
33
|
+
export var ALIGNMENTS = ['left', 'center', 'right'];
|
|
43
34
|
export var EuiStat = function EuiStat(_ref) {
|
|
44
35
|
var children = _ref.children,
|
|
45
36
|
className = _ref.className,
|
|
@@ -61,10 +52,10 @@ export var EuiStat = function EuiStat(_ref) {
|
|
|
61
52
|
descriptionElement = _ref$descriptionEleme === void 0 ? 'p' : _ref$descriptionEleme,
|
|
62
53
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
63
54
|
|
|
64
|
-
var
|
|
65
|
-
var
|
|
66
|
-
|
|
67
|
-
|
|
55
|
+
var euiTheme = useEuiTheme();
|
|
56
|
+
var styles = euiStatStyles();
|
|
57
|
+
var cssStyles = [styles.euiStat, styles[textAlign]];
|
|
58
|
+
var classes = classNames('euiStat', className);
|
|
68
59
|
var commonProps = {
|
|
69
60
|
'aria-hidden': true
|
|
70
61
|
};
|
|
@@ -74,20 +65,21 @@ export var EuiStat = function EuiStat(_ref) {
|
|
|
74
65
|
className: "euiStat__description"
|
|
75
66
|
}, /*#__PURE__*/createElement(descriptionElement, commonProps, description));
|
|
76
67
|
|
|
77
|
-
var
|
|
78
|
-
|
|
68
|
+
var isNamedTitleColor = COLORS.includes(titleColor);
|
|
69
|
+
var titleStyles = euiStatTitleStyles(euiTheme);
|
|
70
|
+
var titleCssStyles = [titleStyles.euiStat__title, isNamedTitleColor && titleStyles[titleColor], isLoading && titleStyles.isLoading];
|
|
71
|
+
var titleProps = isNamedTitleColor ? commonProps : _objectSpread(_objectSpread({}, commonProps), {}, {
|
|
79
72
|
style: {
|
|
80
|
-
color:
|
|
73
|
+
color: titleColor
|
|
81
74
|
}
|
|
82
|
-
};
|
|
75
|
+
});
|
|
83
76
|
var titleChildren = isLoading ? '--' : title;
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
className: titleClasses
|
|
87
|
-
}, /*#__PURE__*/createElement(titleElement, commonProps, titleChildren)) : ___EmotionJSX(EuiTitle, {
|
|
77
|
+
|
|
78
|
+
var titleDisplay = ___EmotionJSX(EuiTitle, {
|
|
88
79
|
size: titleSize,
|
|
89
|
-
className:
|
|
90
|
-
|
|
80
|
+
className: "euiStat__title",
|
|
81
|
+
css: titleCssStyles
|
|
82
|
+
}, /*#__PURE__*/createElement(titleElement, titleProps, titleChildren));
|
|
91
83
|
|
|
92
84
|
var screenReader = ___EmotionJSX(EuiScreenReaderOnly, null, ___EmotionJSX("p", null, isLoading ? ___EmotionJSX(EuiI18n, {
|
|
93
85
|
token: "euiStat.loadingText",
|
|
@@ -97,6 +89,7 @@ export var EuiStat = function EuiStat(_ref) {
|
|
|
97
89
|
var statDisplay = ___EmotionJSX(Fragment, null, !reverse && descriptionDisplay, titleDisplay, reverse && descriptionDisplay, typeof title === 'string' && typeof description === 'string' && screenReader);
|
|
98
90
|
|
|
99
91
|
return ___EmotionJSX("div", _extends({
|
|
92
|
+
css: cssStyles,
|
|
100
93
|
className: classes
|
|
101
94
|
}, rest), statDisplay, children);
|
|
102
95
|
};
|
|
@@ -119,7 +112,7 @@ EuiStat.propTypes = {
|
|
|
119
112
|
* Flips the order of the description and title
|
|
120
113
|
*/
|
|
121
114
|
reverse: PropTypes.bool,
|
|
122
|
-
textAlign: PropTypes.
|
|
115
|
+
textAlign: PropTypes.any,
|
|
123
116
|
|
|
124
117
|
/**
|
|
125
118
|
* The (value) text
|
|
@@ -129,7 +122,7 @@ EuiStat.propTypes = {
|
|
|
129
122
|
/**
|
|
130
123
|
* The color of the title text
|
|
131
124
|
*/
|
|
132
|
-
titleColor: PropTypes.oneOfType([PropTypes.
|
|
125
|
+
titleColor: PropTypes.oneOfType([PropTypes.any.isRequired, PropTypes.string.isRequired]),
|
|
133
126
|
|
|
134
127
|
/**
|
|
135
128
|
* Size of the title. See EuiTitle for options ('s', 'm', 'l'... etc)
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
var _templateObject;
|
|
2
|
+
|
|
3
|
+
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
4
|
+
|
|
5
|
+
/*
|
|
6
|
+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
7
|
+
* or more contributor license agreements. Licensed under the Elastic License
|
|
8
|
+
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
|
9
|
+
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
10
|
+
* Side Public License, v 1.
|
|
11
|
+
*/
|
|
12
|
+
import { css, keyframes } from '@emotion/react';
|
|
13
|
+
import { logicalTextAlignCSS, euiCanAnimate } from '../../global_styling';
|
|
14
|
+
export var euiStatStyles = function euiStatStyles() {
|
|
15
|
+
return {
|
|
16
|
+
euiStat: /*#__PURE__*/css(";label:euiStat;"),
|
|
17
|
+
// Text align
|
|
18
|
+
left: /*#__PURE__*/css(logicalTextAlignCSS('left'), " align-items:flex-start;;label:left;"),
|
|
19
|
+
center: /*#__PURE__*/css(logicalTextAlignCSS('center'), " align-items:center;;label:center;"),
|
|
20
|
+
right: /*#__PURE__*/css(logicalTextAlignCSS('right'), " align-items:flex-end;;label:right;")
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
export var euiStatTitleStyles = function euiStatTitleStyles(_ref) {
|
|
24
|
+
var euiTheme = _ref.euiTheme;
|
|
25
|
+
return {
|
|
26
|
+
euiStat__title: /*#__PURE__*/css(";label:euiStat__title;"),
|
|
27
|
+
// Colors
|
|
28
|
+
default: /*#__PURE__*/css("color:", euiTheme.colors.fullShade, ";;label:default;"),
|
|
29
|
+
subdued: /*#__PURE__*/css("color:", euiTheme.colors.subduedText, ";;label:subdued;"),
|
|
30
|
+
primary: /*#__PURE__*/css("color:", euiTheme.colors.primaryText, ";;label:primary;"),
|
|
31
|
+
success: /*#__PURE__*/css("color:", euiTheme.colors.successText, ";;label:success;"),
|
|
32
|
+
danger: /*#__PURE__*/css("color:", euiTheme.colors.dangerText, ";;label:danger;"),
|
|
33
|
+
accent: /*#__PURE__*/css("color:", euiTheme.colors.accentText, ";;label:accent;"),
|
|
34
|
+
// Loading
|
|
35
|
+
isLoading: /*#__PURE__*/css(euiCanAnimate, "{animation:", euiStatPulse, " 1.5s infinite ease-in-out;};label:isLoading;")
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
var euiStatPulse = keyframes(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n 0% { opacity: 1; }\n 50% { opacity: .25; }\n 100% { opacity: 1; }\n"])));
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var _excluded = ["className", "items", "children"];
|
|
1
|
+
var _excluded = ["className", "items", "children", "gutterSize"];
|
|
2
2
|
|
|
3
3
|
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
4
4
|
|
|
@@ -16,19 +16,28 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
|
|
|
16
16
|
import React from 'react';
|
|
17
17
|
import PropTypes from "prop-types";
|
|
18
18
|
import classNames from 'classnames';
|
|
19
|
+
import { useEuiTheme } from '../../services';
|
|
19
20
|
import { EuiTimelineItem } from './timeline_item';
|
|
21
|
+
import { euiTimelineStyles } from './timeline.styles';
|
|
20
22
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
23
|
+
export var GUTTER_SIZES = ['m', 'l', 'xl'];
|
|
21
24
|
export var EuiTimeline = function EuiTimeline(_ref) {
|
|
22
25
|
var className = _ref.className,
|
|
23
26
|
_ref$items = _ref.items,
|
|
24
27
|
items = _ref$items === void 0 ? [] : _ref$items,
|
|
25
28
|
children = _ref.children,
|
|
29
|
+
_ref$gutterSize = _ref.gutterSize,
|
|
30
|
+
gutterSize = _ref$gutterSize === void 0 ? 'xl' : _ref$gutterSize,
|
|
26
31
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
27
32
|
|
|
28
33
|
var classes = classNames('euiTimeline', className);
|
|
34
|
+
var euiTheme = useEuiTheme();
|
|
35
|
+
var styles = euiTimelineStyles(euiTheme);
|
|
36
|
+
var cssStyles = [styles.euiTimeline, styles[gutterSize]];
|
|
29
37
|
return (// eslint-disable-next-line jsx-a11y/no-redundant-roles
|
|
30
38
|
___EmotionJSX("ol", _extends({
|
|
31
39
|
className: classes,
|
|
40
|
+
css: cssStyles,
|
|
32
41
|
role: "list"
|
|
33
42
|
}, rest), items.map(function (item, index) {
|
|
34
43
|
return ___EmotionJSX(EuiTimelineItem, _extends({
|
|
@@ -46,17 +55,15 @@ EuiTimeline.propTypes = {
|
|
|
46
55
|
* Vertical alignment of the event with the icon
|
|
47
56
|
*/
|
|
48
57
|
verticalAlign: PropTypes.any,
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* Sets the HTML element for `EuiTimelineItem`.
|
|
52
|
-
* By default, the element renders as a `<li/>`.
|
|
53
|
-
* Only change the HTML element when it is not wrapped in a `EuiTimeline` that renders as a `<ol/>`.
|
|
54
|
-
*/
|
|
55
|
-
component: PropTypes.any,
|
|
56
58
|
className: PropTypes.string,
|
|
57
59
|
"aria-label": PropTypes.string,
|
|
58
60
|
"data-test-subj": PropTypes.string
|
|
59
61
|
}).isRequired),
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Sets the size of the vertical space between each timeline item
|
|
65
|
+
*/
|
|
66
|
+
gutterSize: PropTypes.any,
|
|
60
67
|
className: PropTypes.string,
|
|
61
68
|
"aria-label": PropTypes.string,
|
|
62
69
|
"data-test-subj": PropTypes.string
|
|
@@ -0,0 +1,29 @@
|
|
|
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
|
+
import { css } from '@emotion/react';
|
|
9
|
+
import { logicalCSS } from '../../global_styling';
|
|
10
|
+
|
|
11
|
+
var _gutterSizeAdjustment = function _gutterSizeAdjustment(gutterSize) {
|
|
12
|
+
return "\n gap: ".concat(gutterSize, ";\n\n // The vertical line height needs to be adjusted with the gutter size\n [class*='euiTimelineItem-']:not(:last-child) > [class*='euiTimelineItemIcon-']::before {\n ").concat(logicalCSS('height', "calc(100% + ".concat(gutterSize, ")")), ";\n }\n ");
|
|
13
|
+
}; // The vertical line should only appear when the EuiTimelineItem's
|
|
14
|
+
// are wrapped in a EuiTimeline. That's why these styles live here.
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
var timelineVerticalLine = function timelineVerticalLine(euiTheme) {
|
|
18
|
+
return " \n [class*='euiTimelineItem-'] > [class*='euiTimelineItemIcon-']::before {\n content: '';\n position: absolute;\n ".concat(logicalCSS('top', 0), ";\n ").concat(logicalCSS('width', euiTheme.size.xxs), ";\n background-color: ").concat(euiTheme.colors.lightShade, ";\n }\n\n > [class*='euiTimelineItem-center']:first-child > [class*='euiTimelineItemIcon-']::before {\n ").concat(logicalCSS('top', '50%'), ";\n }\n \n > [class*='euiTimelineItem-center']:last-child:not(:only-child) > [class*='euiTimelineItemIcon-']::before {\n ").concat(logicalCSS('height', '50%'), ";\n }\n ");
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export var euiTimelineStyles = function euiTimelineStyles(_ref) {
|
|
22
|
+
var euiTheme = _ref.euiTheme;
|
|
23
|
+
return {
|
|
24
|
+
euiTimeline: /*#__PURE__*/css("display:flex;flex-direction:column;", timelineVerticalLine(euiTheme), ";;label:euiTimeline;"),
|
|
25
|
+
m: /*#__PURE__*/css(_gutterSizeAdjustment(euiTheme.size.base), ";label:m;"),
|
|
26
|
+
l: /*#__PURE__*/css(_gutterSizeAdjustment(euiTheme.size.l), ";label:l;"),
|
|
27
|
+
xl: /*#__PURE__*/css(_gutterSizeAdjustment(euiTheme.size.xl), ";label:xl;")
|
|
28
|
+
};
|
|
29
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var _excluded = ["children", "verticalAlign", "icon", "iconAriaLabel", "className"
|
|
1
|
+
var _excluded = ["children", "verticalAlign", "icon", "iconAriaLabel", "className"];
|
|
2
2
|
|
|
3
3
|
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
4
4
|
|
|
@@ -15,7 +15,6 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
|
|
|
15
15
|
*/
|
|
16
16
|
import React from 'react';
|
|
17
17
|
import PropTypes from "prop-types";
|
|
18
|
-
import { useEuiTheme } from '../../services';
|
|
19
18
|
import { EuiTimelineItemEvent } from './timeline_item_event';
|
|
20
19
|
import { EuiTimelineItemIcon } from './timeline_item_icon';
|
|
21
20
|
import { euiTimelineItemStyles } from './timeline_item.styles';
|
|
@@ -28,15 +27,11 @@ export var EuiTimelineItem = function EuiTimelineItem(_ref) {
|
|
|
28
27
|
icon = _ref.icon,
|
|
29
28
|
iconAriaLabel = _ref.iconAriaLabel,
|
|
30
29
|
className = _ref.className,
|
|
31
|
-
_ref$component = _ref.component,
|
|
32
|
-
component = _ref$component === void 0 ? 'li' : _ref$component,
|
|
33
30
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
34
31
|
|
|
35
|
-
var
|
|
36
|
-
var
|
|
37
|
-
|
|
38
|
-
var Element = component;
|
|
39
|
-
return ___EmotionJSX(Element, _extends({
|
|
32
|
+
var styles = euiTimelineItemStyles();
|
|
33
|
+
var cssStyles = [styles.euiTimelineItem, styles[verticalAlign]];
|
|
34
|
+
return ___EmotionJSX("li", _extends({
|
|
40
35
|
css: cssStyles
|
|
41
36
|
}, rest), ___EmotionJSX(EuiTimelineItemIcon, {
|
|
42
37
|
icon: icon,
|
|
@@ -51,13 +46,6 @@ EuiTimelineItem.propTypes = {
|
|
|
51
46
|
* Vertical alignment of the event with the icon
|
|
52
47
|
*/
|
|
53
48
|
verticalAlign: PropTypes.any,
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* Sets the HTML element for `EuiTimelineItem`.
|
|
57
|
-
* By default, the element renders as a `<li/>`.
|
|
58
|
-
* Only change the HTML element when it is not wrapped in a `EuiTimeline` that renders as a `<ol/>`.
|
|
59
|
-
*/
|
|
60
|
-
component: PropTypes.any,
|
|
61
49
|
className: PropTypes.string,
|
|
62
50
|
"aria-label": PropTypes.string,
|
|
63
51
|
"data-test-subj": PropTypes.string
|
|
@@ -1,3 +1,5 @@
|
|
|
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
|
+
|
|
1
3
|
/*
|
|
2
4
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
3
5
|
* or more contributor license agreements. Licensed under the Elastic License
|
|
@@ -6,9 +8,22 @@
|
|
|
6
8
|
* Side Public License, v 1.
|
|
7
9
|
*/
|
|
8
10
|
import { css } from '@emotion/react';
|
|
9
|
-
|
|
10
|
-
|
|
11
|
+
|
|
12
|
+
var _ref = process.env.NODE_ENV === "production" ? {
|
|
13
|
+
name: "5bggde-euiTimelineItem",
|
|
14
|
+
styles: "display:flex;position:relative;label:euiTimelineItem;"
|
|
15
|
+
} : {
|
|
16
|
+
name: "5bggde-euiTimelineItem",
|
|
17
|
+
styles: "display:flex;position:relative;label:euiTimelineItem;",
|
|
18
|
+
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export var euiTimelineItemStyles = function euiTimelineItemStyles() {
|
|
11
22
|
return {
|
|
12
|
-
euiTimelineItem:
|
|
23
|
+
euiTimelineItem: _ref,
|
|
24
|
+
// Vertical alignments
|
|
25
|
+
// These classes are being targeted in timeline.styles.ts
|
|
26
|
+
top: /*#__PURE__*/css(";label:top;"),
|
|
27
|
+
center: /*#__PURE__*/css(";label:center;")
|
|
13
28
|
};
|
|
14
29
|
};
|
|
@@ -8,6 +8,7 @@ function _EMOTION_STRINGIFIED_CSS_ERROR__() { return "You have tried to stringif
|
|
|
8
8
|
* Side Public License, v 1.
|
|
9
9
|
*/
|
|
10
10
|
import { css } from '@emotion/react';
|
|
11
|
+
import { logicalCSS } from '../../global_styling';
|
|
11
12
|
|
|
12
13
|
var _ref = process.env.NODE_ENV === "production" ? {
|
|
13
14
|
name: "8391db-center",
|
|
@@ -27,11 +28,20 @@ var _ref2 = process.env.NODE_ENV === "production" ? {
|
|
|
27
28
|
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
28
29
|
};
|
|
29
30
|
|
|
30
|
-
|
|
31
|
-
|
|
31
|
+
var _ref3 = process.env.NODE_ENV === "production" ? {
|
|
32
|
+
name: "kuz8oa-euiTimelineItemIcon__content",
|
|
33
|
+
styles: "display:flex;justify-content:center;align-items:center;position:relative;label:euiTimelineItemIcon__content;"
|
|
34
|
+
} : {
|
|
35
|
+
name: "kuz8oa-euiTimelineItemIcon__content",
|
|
36
|
+
styles: "display:flex;justify-content:center;align-items:center;position:relative;label:euiTimelineItemIcon__content;",
|
|
37
|
+
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export var euiTimelineItemIconStyles = function euiTimelineItemIconStyles(_ref4) {
|
|
41
|
+
var euiTheme = _ref4.euiTheme;
|
|
32
42
|
return {
|
|
33
|
-
euiTimelineItemIcon: /*#__PURE__*/css("display:flex;position:relative;flex-grow:0;
|
|
34
|
-
euiTimelineItemIcon__content:
|
|
43
|
+
euiTimelineItemIcon: /*#__PURE__*/css("display:flex;position:relative;flex-grow:0;justify-content:center;", logicalCSS('margin-right', euiTheme.size.base), ";;label:euiTimelineItemIcon;"),
|
|
44
|
+
euiTimelineItemIcon__content: _ref3,
|
|
35
45
|
// Vertical alignments
|
|
36
46
|
top: _ref2,
|
|
37
47
|
center: _ref
|
|
@@ -46,9 +46,9 @@ var logicalPaddings = {
|
|
|
46
46
|
};
|
|
47
47
|
var logicalPosition = {
|
|
48
48
|
top: 'inset-block-start',
|
|
49
|
-
right: 'inset-inline-
|
|
49
|
+
right: 'inset-inline-end',
|
|
50
50
|
bottom: 'inset-block-end',
|
|
51
|
-
left: 'inset-inline-
|
|
51
|
+
left: 'inset-inline-start',
|
|
52
52
|
horizontal: 'inset-block',
|
|
53
53
|
vertical: 'inset-inline',
|
|
54
54
|
inset: 'inset'
|
|
@@ -0,0 +1,17 @@
|
|
|
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
|
+
import React from 'react';
|
|
9
|
+
import { Global, css } from '@emotion/react';
|
|
10
|
+
import { euiScreenReaderOnly } from '../../components/accessibility/screen_reader_only/screen_reader_only.styles';
|
|
11
|
+
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
12
|
+
var globalStyles = /*#__PURE__*/css(".euiScreenReaderOnly{", euiScreenReaderOnly(), ";};label:globalStyles;");
|
|
13
|
+
export var EuiUtilityClasses = function EuiUtilityClasses() {
|
|
14
|
+
return ___EmotionJSX(Global, {
|
|
15
|
+
styles: globalStyles
|
|
16
|
+
});
|
|
17
|
+
};
|
|
@@ -20,8 +20,10 @@ export var useEuiTheme = function useEuiTheme() {
|
|
|
20
20
|
modifications: modifications
|
|
21
21
|
};
|
|
22
22
|
};
|
|
23
|
+
// Provide the component props interface as the generic to allow the docs props table to populate.
|
|
24
|
+
// e.g., `const EuiComponent = withEuiTheme<EuiComponentProps>(_EuiComponent)`
|
|
23
25
|
export var withEuiTheme = function withEuiTheme(Component) {
|
|
24
|
-
var componentName = Component.displayName || Component.name || '
|
|
26
|
+
var componentName = Component.displayName || Component.name || 'ComponentWithTheme';
|
|
25
27
|
|
|
26
28
|
var Render = function Render(props, ref) {
|
|
27
29
|
var _useEuiTheme = useEuiTheme(),
|
|
@@ -40,6 +42,6 @@ export var withEuiTheme = function withEuiTheme(Component) {
|
|
|
40
42
|
};
|
|
41
43
|
|
|
42
44
|
var WithEuiTheme = /*#__PURE__*/forwardRef(Render);
|
|
43
|
-
WithEuiTheme.displayName =
|
|
45
|
+
WithEuiTheme.displayName = componentName;
|
|
44
46
|
return WithEuiTheme;
|
|
45
47
|
};
|
|
@@ -18,7 +18,6 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
|
18
18
|
* Side Public License, v 1.
|
|
19
19
|
*/
|
|
20
20
|
import React, { useContext, useEffect, useRef, useState } from 'react';
|
|
21
|
-
import { CacheProvider } from '@emotion/react';
|
|
22
21
|
import isEqual from 'lodash/isEqual';
|
|
23
22
|
import { EuiSystemContext, EuiThemeContext, EuiModificationsContext, EuiColorModeContext } from './context';
|
|
24
23
|
import { buildTheme, getColorMode, getComputed, mergeDeep } from './utils';
|
|
@@ -27,7 +26,6 @@ export var EuiThemeProvider = function EuiThemeProvider(_ref) {
|
|
|
27
26
|
var _system = _ref.theme,
|
|
28
27
|
_colorMode = _ref.colorMode,
|
|
29
28
|
_modifications = _ref.modify,
|
|
30
|
-
cache = _ref.cache,
|
|
31
29
|
children = _ref.children;
|
|
32
30
|
var parentSystem = useContext(EuiSystemContext);
|
|
33
31
|
var parentModifications = useContext(EuiModificationsContext);
|
|
@@ -101,7 +99,5 @@ export var EuiThemeProvider = function EuiThemeProvider(_ref) {
|
|
|
101
99
|
value: modifications
|
|
102
100
|
}, ___EmotionJSX(EuiThemeContext.Provider, {
|
|
103
101
|
value: theme
|
|
104
|
-
},
|
|
105
|
-
value: cache
|
|
106
|
-
}, children) : children))));
|
|
102
|
+
}, children))));
|
|
107
103
|
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
|
2
|
+
|
|
3
|
+
function _wrapRegExp() { _wrapRegExp = function _wrapRegExp(re, groups) { return new BabelRegExp(re, undefined, groups); }; var _super = RegExp.prototype; var _groups = new WeakMap(); function BabelRegExp(re, flags, groups) { var _this = new RegExp(re, flags); _groups.set(_this, groups || _groups.get(re)); return _setPrototypeOf(_this, BabelRegExp.prototype); } _inherits(BabelRegExp, RegExp); BabelRegExp.prototype.exec = function (str) { var result = _super.exec.call(this, str); if (result) result.groups = buildGroups(result, this); return result; }; BabelRegExp.prototype[Symbol.replace] = function (str, substitution) { if (typeof substitution === "string") { var groups = _groups.get(this); return _super[Symbol.replace].call(this, str, substitution.replace(/\$<([^>]+)>/g, function (_, name) { return "$" + groups[name]; })); } else if (typeof substitution === "function") { var _this = this; return _super[Symbol.replace].call(this, str, function () { var args = arguments; if (_typeof(args[args.length - 1]) !== "object") { args = [].slice.call(args); args.push(buildGroups(args, _this)); } return substitution.apply(this, args); }); } else { return _super[Symbol.replace].call(this, str, substitution); } }; function buildGroups(result, re) { var g = _groups.get(re); return Object.keys(g).reduce(function (groups, name) { groups[name] = result[g[name]]; return groups; }, Object.create(null)); } return _wrapRegExp.apply(this, arguments); }
|
|
4
|
+
|
|
5
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
6
|
+
|
|
7
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
8
|
+
|
|
9
|
+
/*
|
|
10
|
+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
11
|
+
* or more contributor license agreements. Licensed under the Elastic License
|
|
12
|
+
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
|
13
|
+
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
14
|
+
* Side Public License, v 1.
|
|
15
|
+
*/
|
|
16
|
+
export var replaceEmotionPrefix = function replaceEmotionPrefix(selector) {
|
|
17
|
+
var _euiMatch$groups;
|
|
18
|
+
|
|
19
|
+
// Matches the Emotion className pattern + the EUI variant naming convention.
|
|
20
|
+
// Starts with `css-[hash]-`.
|
|
21
|
+
// Contains `eui[ComponentName] or `Eui[ComponentName]`.
|
|
22
|
+
// Capture the component name (from above) and all variant additions until the end of the string.
|
|
23
|
+
var euiMatch = selector.match( /*#__PURE__*/_wrapRegExp(/css\x2D[0-9A-Z_a-z]{6,}\x2D([Ee]ui[A-Z][\x2D0-9A-Z_a-z]*$)/, {
|
|
24
|
+
euiComponent: 1
|
|
25
|
+
})); // Use the captured group (`euiComponent`) if available and prepend with `emotion-`,
|
|
26
|
+
// otherwise use the full selector.
|
|
27
|
+
|
|
28
|
+
return euiMatch !== null && euiMatch !== void 0 && (_euiMatch$groups = euiMatch.groups) !== null && _euiMatch$groups !== void 0 && _euiMatch$groups.euiComponent ? "emotion-".concat(euiMatch.groups.euiComponent) : selector;
|
|
29
|
+
};
|
package/es/test/index.d.ts
CHANGED
|
@@ -36,6 +36,10 @@ declare module '@elastic/eui/es/test/react_warnings' {
|
|
|
36
36
|
declare module '@elastic/eui/es/test/sleep' {
|
|
37
37
|
export function sleep(ms?: number): Promise<unknown>;
|
|
38
38
|
|
|
39
|
+
}
|
|
40
|
+
declare module '@elastic/eui/es/test/emotion-prefix' {
|
|
41
|
+
export const replaceEmotionPrefix: (selector: string) => string;
|
|
42
|
+
|
|
39
43
|
}
|
|
40
44
|
declare module '@elastic/eui/es/test' {
|
|
41
45
|
export { requiredProps } from '@elastic/eui/es/test/required_props';
|
|
@@ -43,5 +47,6 @@ declare module '@elastic/eui/es/test' {
|
|
|
43
47
|
export { findTestSubject } from '@elastic/eui/es/test/find_test_subject';
|
|
44
48
|
export { startThrowingReactWarnings, stopThrowingReactWarnings, } from '@elastic/eui/es/test/react_warnings';
|
|
45
49
|
export { sleep } from '@elastic/eui/es/test/sleep';
|
|
50
|
+
export * from '@elastic/eui/es/test/emotion-prefix';
|
|
46
51
|
|
|
47
52
|
}
|
package/es/test/index.js
CHANGED
|
@@ -9,4 +9,5 @@ export { requiredProps } from './required_props';
|
|
|
9
9
|
export { takeMountedSnapshot } from './take_mounted_snapshot';
|
|
10
10
|
export { findTestSubject } from './find_test_subject';
|
|
11
11
|
export { startThrowingReactWarnings, stopThrowingReactWarnings } from './react_warnings';
|
|
12
|
-
export { sleep } from './sleep';
|
|
12
|
+
export { sleep } from './sleep';
|
|
13
|
+
export * from './emotion-prefix';
|