@elastic/eui 67.0.0 → 67.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_theme_dark.css +0 -98
- package/dist/eui_theme_dark.min.css +1 -1
- package/dist/eui_theme_light.css +0 -98
- package/dist/eui_theme_light.min.css +1 -1
- package/es/components/badge/badge.js +84 -78
- package/es/components/badge/badge.styles.js +56 -0
- package/es/components/basic_table/in_memory_table.js +8 -0
- package/es/components/button/button.js +0 -1
- package/es/components/button/button_display/_button_display.js +10 -5
- package/es/components/button/button_display/_button_display.styles.js +2 -2
- package/es/components/button/button_display/_button_display_content.js +5 -3
- package/es/components/button/button_display/_button_display_content.styles.js +4 -1
- package/es/components/card/card.js +2 -2
- package/es/components/card/card.styles.js +5 -2
- package/es/components/notification/notification_event.js +1 -1
- package/es/components/notification/notification_event_meta.js +1 -1
- package/es/components/popover/popover_title.js +2 -2
- package/es/components/popover/popover_title.styles.js +18 -6
- package/es/components/search_bar/filters/custom_component_filter.js +16 -0
- package/es/components/search_bar/filters/filters.js +6 -0
- package/es/components/search_bar/query/ast.js +12 -0
- package/es/components/search_bar/query/ast_to_es_query_dsl.js +15 -10
- package/es/components/search_bar/query/query.js +17 -0
- package/es/components/search_bar/search_bar.js +4 -0
- package/es/components/search_bar/search_filters.js +4 -0
- package/es/components/selectable/selectable_list/selectable_list.js +2 -2
- package/es/components/selectable/selectable_list/selectable_list_item.js +2 -2
- package/es/services/color/contrast.js +2 -0
- package/es/services/index.js +1 -1
- package/es/services/theme/context.js +2 -1
- package/es/services/theme/hooks.js +27 -1
- package/es/services/theme/index.js +1 -1
- package/es/services/theme/provider.js +15 -1
- package/eui.d.ts +104 -28
- package/lib/components/badge/badge.js +92 -80
- package/lib/components/badge/badge.styles.js +61 -0
- package/lib/components/basic_table/in_memory_table.js +8 -0
- package/lib/components/button/button.js +0 -1
- package/lib/components/button/button_display/_button_display.js +10 -5
- package/lib/components/button/button_display/_button_display.styles.js +2 -2
- package/lib/components/button/button_display/_button_display_content.js +9 -4
- package/lib/components/button/button_display/_button_display_content.styles.js +4 -1
- package/lib/components/card/card.js +2 -2
- package/lib/components/card/card.styles.js +5 -2
- package/lib/components/notification/notification_event.js +1 -1
- package/lib/components/notification/notification_event_meta.js +1 -1
- package/lib/components/popover/popover_title.js +2 -2
- package/lib/components/popover/popover_title.styles.js +19 -7
- package/lib/components/search_bar/filters/custom_component_filter.js +29 -0
- package/lib/components/search_bar/filters/filters.js +7 -0
- package/lib/components/search_bar/query/ast.js +12 -0
- package/lib/components/search_bar/query/ast_to_es_query_dsl.js +16 -11
- package/lib/components/search_bar/query/query.js +17 -0
- package/lib/components/search_bar/search_bar.js +4 -0
- package/lib/components/search_bar/search_filters.js +4 -0
- package/lib/components/selectable/selectable_list/selectable_list.js +2 -2
- package/lib/components/selectable/selectable_list/selectable_list_item.js +2 -2
- package/lib/services/color/contrast.js +6 -1
- package/lib/services/index.js +7 -0
- package/lib/services/theme/context.js +4 -2
- package/lib/services/theme/hooks.js +28 -0
- package/lib/services/theme/index.js +12 -0
- package/lib/services/theme/provider.js +23 -2
- package/optimize/es/components/badge/badge.js +82 -76
- package/optimize/es/components/badge/badge.styles.js +56 -0
- package/optimize/es/components/basic_table/in_memory_table.js +4 -0
- package/optimize/es/components/button/button.js +0 -1
- package/optimize/es/components/button/button_display/_button_display.js +8 -3
- package/optimize/es/components/button/button_display/_button_display.styles.js +2 -2
- package/optimize/es/components/button/button_display/_button_display_content.js +3 -1
- package/optimize/es/components/button/button_display/_button_display_content.styles.js +4 -1
- package/optimize/es/components/card/card.js +2 -2
- package/optimize/es/components/card/card.styles.js +5 -2
- package/optimize/es/components/popover/popover_title.js +2 -2
- package/optimize/es/components/popover/popover_title.styles.js +18 -6
- package/optimize/es/components/search_bar/filters/custom_component_filter.js +16 -0
- package/optimize/es/components/search_bar/filters/filters.js +6 -0
- package/optimize/es/components/search_bar/query/ast.js +12 -0
- package/optimize/es/components/search_bar/query/ast_to_es_query_dsl.js +14 -9
- package/optimize/es/components/search_bar/query/query.js +17 -0
- package/optimize/es/services/color/contrast.js +2 -0
- package/optimize/es/services/index.js +1 -1
- package/optimize/es/services/theme/context.js +2 -1
- package/optimize/es/services/theme/hooks.js +27 -1
- package/optimize/es/services/theme/index.js +1 -1
- package/optimize/es/services/theme/provider.js +14 -1
- package/optimize/lib/components/badge/badge.js +90 -78
- package/optimize/lib/components/badge/badge.styles.js +61 -0
- package/optimize/lib/components/basic_table/in_memory_table.js +4 -0
- package/optimize/lib/components/button/button.js +0 -1
- package/optimize/lib/components/button/button_display/_button_display.js +8 -3
- package/optimize/lib/components/button/button_display/_button_display.styles.js +2 -2
- package/optimize/lib/components/button/button_display/_button_display_content.js +6 -2
- package/optimize/lib/components/button/button_display/_button_display_content.styles.js +4 -1
- package/optimize/lib/components/card/card.js +2 -2
- package/optimize/lib/components/card/card.styles.js +5 -2
- package/optimize/lib/components/popover/popover_title.js +2 -2
- package/optimize/lib/components/popover/popover_title.styles.js +19 -7
- package/optimize/lib/components/search_bar/filters/custom_component_filter.js +29 -0
- package/optimize/lib/components/search_bar/filters/filters.js +7 -0
- package/optimize/lib/components/search_bar/query/ast.js +12 -0
- package/optimize/lib/components/search_bar/query/ast_to_es_query_dsl.js +16 -11
- package/optimize/lib/components/search_bar/query/query.js +17 -0
- package/optimize/lib/services/color/contrast.js +5 -1
- package/optimize/lib/services/index.js +7 -0
- package/optimize/lib/services/theme/context.js +4 -2
- package/optimize/lib/services/theme/hooks.js +28 -0
- package/optimize/lib/services/theme/index.js +12 -0
- package/optimize/lib/services/theme/provider.js +23 -9
- package/package.json +5 -5
- package/src/components/badge/_index.scss +0 -1
- package/test-env/components/badge/badge.js +92 -80
- package/test-env/components/badge/badge.styles.js +61 -0
- package/test-env/components/basic_table/in_memory_table.js +8 -0
- package/test-env/components/button/button.js +0 -1
- package/test-env/components/button/button_display/_button_display.js +10 -5
- package/test-env/components/button/button_display/_button_display.styles.js +2 -2
- package/test-env/components/button/button_display/_button_display_content.js +8 -4
- package/test-env/components/button/button_display/_button_display_content.styles.js +4 -1
- package/test-env/components/card/card.js +2 -2
- package/test-env/components/card/card.styles.js +5 -2
- package/test-env/components/notification/notification_event.js +1 -1
- package/test-env/components/notification/notification_event_meta.js +1 -1
- package/test-env/components/popover/popover_title.js +2 -2
- package/test-env/components/popover/popover_title.styles.js +19 -7
- package/test-env/components/search_bar/filters/custom_component_filter.js +29 -0
- package/test-env/components/search_bar/filters/filters.js +7 -0
- package/test-env/components/search_bar/query/ast.js +12 -0
- package/test-env/components/search_bar/query/ast_to_es_query_dsl.js +16 -11
- package/test-env/components/search_bar/query/query.js +17 -0
- package/test-env/components/search_bar/search_bar.js +4 -0
- package/test-env/components/search_bar/search_filters.js +4 -0
- package/test-env/components/selectable/selectable_list/selectable_list.js +2 -2
- package/test-env/components/selectable/selectable_list/selectable_list_item.js +2 -2
- package/test-env/services/color/contrast.js +5 -1
- package/test-env/services/index.js +7 -0
- package/test-env/services/theme/context.js +4 -2
- package/test-env/services/theme/hooks.js +28 -0
- package/test-env/services/theme/index.js +12 -0
- package/test-env/services/theme/provider.js +23 -9
- package/src/components/badge/_badge.scss +0 -133
|
@@ -31,39 +31,23 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
|
|
|
31
31
|
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
32
32
|
* Side Public License, v 1.
|
|
33
33
|
*/
|
|
34
|
-
import React from 'react';
|
|
34
|
+
import React, { useMemo } from 'react';
|
|
35
35
|
import PropTypes from "prop-types";
|
|
36
36
|
import classNames from 'classnames';
|
|
37
37
|
import chroma from 'chroma-js';
|
|
38
|
-
import {
|
|
39
|
-
import { euiPaletteColorBlindBehindText, getSecureRelForTarget, isColorDark } from '../../services';
|
|
38
|
+
import { useEuiTheme, euiPaletteColorBlindBehindText, getSecureRelForTarget, isColorDark, wcagContrastMin } from '../../services';
|
|
40
39
|
import { EuiInnerText } from '../inner_text';
|
|
41
40
|
import { EuiIcon } from '../icon';
|
|
42
41
|
import { chromaValid, parseColor } from '../color_picker/utils';
|
|
43
42
|
import { validateHref } from '../../services/security/href_validator';
|
|
43
|
+
import { euiBadgeStyles } from './badge.styles';
|
|
44
44
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
45
|
-
|
|
46
|
-
var
|
|
47
|
-
|
|
45
|
+
export var ICON_SIDES = ['left', 'right'];
|
|
46
|
+
export var COLORS = ['default', 'hollow', 'primary', 'success', 'accent', 'warning', 'danger'];
|
|
47
|
+
// The color blind palette has some stricter accessibility needs with regards to
|
|
48
48
|
// charts and contrast. We use the euiPaletteColorBlindBehindText variant here since our
|
|
49
49
|
// accessibility concerns pertain to foreground (text) and background contrast
|
|
50
|
-
|
|
51
50
|
var visColors = euiPaletteColorBlindBehindText();
|
|
52
|
-
var colorToHexMap = {
|
|
53
|
-
// TODO - replace with variable once https://github.com/elastic/eui/issues/2731 is closed
|
|
54
|
-
default: '#d3dae6',
|
|
55
|
-
primary: visColors[1],
|
|
56
|
-
success: visColors[0],
|
|
57
|
-
accent: visColors[2],
|
|
58
|
-
warning: visColors[5],
|
|
59
|
-
danger: visColors[9]
|
|
60
|
-
};
|
|
61
|
-
export var COLORS = keysOf(colorToHexMap);
|
|
62
|
-
var iconSideToClassNameMap = {
|
|
63
|
-
left: 'euiBadge--iconLeft',
|
|
64
|
-
right: 'euiBadge--iconRight'
|
|
65
|
-
};
|
|
66
|
-
export var ICON_SIDES = keysOf(iconSideToClassNameMap);
|
|
67
51
|
export var EuiBadge = function EuiBadge(_ref) {
|
|
68
52
|
var children = _ref.children,
|
|
69
53
|
_ref$color = _ref.color,
|
|
@@ -84,53 +68,63 @@ export var EuiBadge = function EuiBadge(_ref) {
|
|
|
84
68
|
style = _ref.style,
|
|
85
69
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
86
70
|
|
|
71
|
+
var euiTheme = useEuiTheme();
|
|
87
72
|
var isHrefValid = !href || validateHref(href);
|
|
88
73
|
var isDisabled = _isDisabled || !isHrefValid;
|
|
89
|
-
var optionalCustomStyles =
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
74
|
+
var optionalCustomStyles = useMemo(function () {
|
|
75
|
+
var colorToHexMap = {
|
|
76
|
+
default: euiTheme.euiTheme.colors.lightShade,
|
|
77
|
+
hollow: '',
|
|
78
|
+
primary: visColors[1],
|
|
79
|
+
success: visColors[0],
|
|
80
|
+
accent: visColors[2],
|
|
81
|
+
warning: visColors[5],
|
|
82
|
+
danger: visColors[9]
|
|
83
|
+
};
|
|
84
|
+
var textColor = null;
|
|
85
|
+
var contrastRatio = null;
|
|
86
|
+
var colorHex = null;
|
|
87
|
+
|
|
88
|
+
try {
|
|
89
|
+
// Check if a valid color name was provided
|
|
90
|
+
if (COLORS.includes(color)) {
|
|
91
|
+
if (color === 'hollow') return style; // hollow uses its own CSS class
|
|
92
|
+
// Get the hex equivalent for the provided color name
|
|
93
|
+
|
|
94
|
+
colorHex = colorToHexMap[color]; // Set dark or light text color based upon best contrast
|
|
95
|
+
|
|
96
|
+
textColor = setTextColor(euiTheme, colorHex);
|
|
97
|
+
return _objectSpread({
|
|
98
|
+
backgroundColor: colorHex,
|
|
99
|
+
color: textColor
|
|
100
|
+
}, style);
|
|
101
|
+
} else {
|
|
102
|
+
// This is a custom color- let's do our best to ensure that it provides sufficient contrast
|
|
103
|
+
// Set dark or light text color based upon best contrast
|
|
104
|
+
textColor = setTextColor(euiTheme, color); // Check the contrast
|
|
105
|
+
|
|
106
|
+
contrastRatio = getColorContrast(textColor, color);
|
|
107
|
+
|
|
108
|
+
if (contrastRatio < wcagContrastMin) {
|
|
109
|
+
// It's low contrast, so lets show a warning in the console
|
|
110
|
+
console.warn('Warning: ', color, ' badge has low contrast of ', contrastRatio.toFixed(2), '. Should be above ', wcagContrastMin, '.');
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
return _objectSpread({
|
|
114
|
+
backgroundColor: color,
|
|
115
|
+
color: textColor
|
|
116
|
+
}, style);
|
|
118
117
|
}
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
backgroundColor: color,
|
|
122
|
-
color: textColor
|
|
123
|
-
}, optionalCustomStyles);
|
|
118
|
+
} catch (err) {
|
|
119
|
+
handleInvalidColor(color);
|
|
124
120
|
}
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
var
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
'euiBadge--hollow': color === 'hollow'
|
|
133
|
-
}, iconSideToClassNameMap[iconSide], className);
|
|
121
|
+
}, [color, style, euiTheme]);
|
|
122
|
+
var styles = euiBadgeStyles(euiTheme);
|
|
123
|
+
var cssStyles = [styles.euiBadge, (onClick || href) && !iconOnClick && styles.clickable, isDisabled && styles.disabled, color === 'hollow' && styles.hollow];
|
|
124
|
+
var textCssStyles = [styles.text.euiBadge__text, (onClick || href) && !isDisabled && styles.text.clickable];
|
|
125
|
+
var iconCssStyles = [styles.icon.euiBadge__icon, styles.icon[iconSide]];
|
|
126
|
+
var iconButtonCssStyles = [styles.iconButton.euiBadge__iconButton, styles.iconButton[iconSide]];
|
|
127
|
+
var classes = classNames('euiBadge', className);
|
|
134
128
|
var closeClassNames = classNames('euiBadge__icon', closeButtonProps && closeButtonProps.className);
|
|
135
129
|
var Element = href && !isDisabled ? 'a' : 'button';
|
|
136
130
|
var relObj = {};
|
|
@@ -160,6 +154,7 @@ export var EuiBadge = function EuiBadge(_ref) {
|
|
|
160
154
|
optionalIcon = ___EmotionJSX("button", {
|
|
161
155
|
type: "button",
|
|
162
156
|
className: "euiBadge__iconButton",
|
|
157
|
+
css: iconButtonCssStyles,
|
|
163
158
|
"aria-label": iconOnClickAriaLabel,
|
|
164
159
|
disabled: isDisabled,
|
|
165
160
|
title: iconOnClickAriaLabel,
|
|
@@ -168,7 +163,8 @@ export var EuiBadge = function EuiBadge(_ref) {
|
|
|
168
163
|
type: iconType,
|
|
169
164
|
size: "s",
|
|
170
165
|
color: "inherit" // forces the icon to inherit its parent color
|
|
171
|
-
|
|
166
|
+
,
|
|
167
|
+
css: iconCssStyles
|
|
172
168
|
}, closeButtonProps, {
|
|
173
169
|
className: closeClassNames
|
|
174
170
|
})));
|
|
@@ -177,6 +173,7 @@ export var EuiBadge = function EuiBadge(_ref) {
|
|
|
177
173
|
type: iconType,
|
|
178
174
|
size: children ? 's' : 'm',
|
|
179
175
|
className: "euiBadge__icon",
|
|
176
|
+
css: iconCssStyles,
|
|
180
177
|
color: "inherit" // forces the icon to inherit its parent color
|
|
181
178
|
|
|
182
179
|
});
|
|
@@ -188,28 +185,34 @@ export var EuiBadge = function EuiBadge(_ref) {
|
|
|
188
185
|
}
|
|
189
186
|
|
|
190
187
|
var content = ___EmotionJSX("span", {
|
|
191
|
-
className: "euiBadge__content"
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
188
|
+
className: "euiBadge__content",
|
|
189
|
+
css: styles.euiBadge__content
|
|
190
|
+
}, iconSide === 'left' && optionalIcon, children && ___EmotionJSX("span", {
|
|
191
|
+
className: "euiBadge__text",
|
|
192
|
+
css: textCssStyles
|
|
193
|
+
}, children), iconSide === 'right' && optionalIcon);
|
|
195
194
|
|
|
196
195
|
if (iconOnClick) {
|
|
197
196
|
return onClick || href ? ___EmotionJSX("span", {
|
|
198
197
|
className: classes,
|
|
198
|
+
css: cssStyles,
|
|
199
199
|
style: optionalCustomStyles
|
|
200
200
|
}, ___EmotionJSX("span", {
|
|
201
|
-
className: "euiBadge__content"
|
|
202
|
-
|
|
201
|
+
className: "euiBadge__content",
|
|
202
|
+
css: styles.euiBadge__content
|
|
203
|
+
}, iconSide === 'left' && optionalIcon, ___EmotionJSX(EuiInnerText, null, function (ref, innerText) {
|
|
203
204
|
return ___EmotionJSX(Element, _extends({
|
|
204
205
|
className: "euiBadge__childButton",
|
|
206
|
+
css: styles.euiBadge__childButton,
|
|
205
207
|
disabled: isDisabled,
|
|
206
208
|
"aria-label": onClickAriaLabel,
|
|
207
209
|
ref: ref,
|
|
208
210
|
title: innerText
|
|
209
211
|
}, relObj, rest), children);
|
|
210
|
-
}), optionalIcon)) : ___EmotionJSX(EuiInnerText, null, function (ref, innerText) {
|
|
212
|
+
}), iconSide === 'right' && optionalIcon)) : ___EmotionJSX(EuiInnerText, null, function (ref, innerText) {
|
|
211
213
|
return ___EmotionJSX("span", _extends({
|
|
212
214
|
className: classes,
|
|
215
|
+
css: cssStyles,
|
|
213
216
|
style: optionalCustomStyles,
|
|
214
217
|
ref: ref,
|
|
215
218
|
title: innerText
|
|
@@ -221,6 +224,7 @@ export var EuiBadge = function EuiBadge(_ref) {
|
|
|
221
224
|
disabled: isDisabled,
|
|
222
225
|
"aria-label": onClickAriaLabel,
|
|
223
226
|
className: classes,
|
|
227
|
+
css: cssStyles,
|
|
224
228
|
style: optionalCustomStyles,
|
|
225
229
|
ref: ref,
|
|
226
230
|
title: innerText
|
|
@@ -230,6 +234,7 @@ export var EuiBadge = function EuiBadge(_ref) {
|
|
|
230
234
|
return ___EmotionJSX(EuiInnerText, null, function (ref, innerText) {
|
|
231
235
|
return ___EmotionJSX("span", _extends({
|
|
232
236
|
className: classes,
|
|
237
|
+
css: cssStyles,
|
|
233
238
|
style: optionalCustomStyles,
|
|
234
239
|
ref: ref,
|
|
235
240
|
title: innerText
|
|
@@ -246,12 +251,12 @@ EuiBadge.propTypes = {
|
|
|
246
251
|
/**
|
|
247
252
|
* The side of the badge the icon should sit
|
|
248
253
|
*/
|
|
249
|
-
iconSide: PropTypes.
|
|
254
|
+
iconSide: PropTypes.any,
|
|
250
255
|
|
|
251
256
|
/**
|
|
252
257
|
* Accepts either our palette colors (primary, success ..etc) or a hex value `#FFFFFF`, `#000`.
|
|
253
258
|
*/
|
|
254
|
-
color: PropTypes.oneOfType([PropTypes.
|
|
259
|
+
color: PropTypes.oneOfType([PropTypes.any.isRequired, PropTypes.string.isRequired]),
|
|
255
260
|
|
|
256
261
|
/**
|
|
257
262
|
* Will override any color passed through the `color` prop.
|
|
@@ -296,13 +301,14 @@ function getColorContrast(textColor, color) {
|
|
|
296
301
|
return contrastValue;
|
|
297
302
|
}
|
|
298
303
|
|
|
299
|
-
function setTextColor(bgColor) {
|
|
300
|
-
var
|
|
304
|
+
function setTextColor(_ref2, bgColor) {
|
|
305
|
+
var euiTheme = _ref2.euiTheme;
|
|
306
|
+
var textColor = isColorDark.apply(void 0, _toConsumableArray(chroma(bgColor).rgb())) ? euiTheme.colors.ghost : euiTheme.colors.ink;
|
|
301
307
|
return textColor;
|
|
302
308
|
}
|
|
303
309
|
|
|
304
310
|
function handleInvalidColor(color) {
|
|
305
|
-
var isNamedColor =
|
|
311
|
+
var isNamedColor = COLORS.includes(color);
|
|
306
312
|
var isValidColorString = color && chromaValid(parseColor(color) || '');
|
|
307
313
|
|
|
308
314
|
if (!isNamedColor && !isValidColorString) {
|
|
@@ -0,0 +1,56 @@
|
|
|
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 { euiFontSize, euiFocusRing, euiTextTruncate, logicalCSS, logicalTextAlignCSS } from '../../global_styling';
|
|
12
|
+
import { euiButtonColor } from '../../themes/amsterdam/global_styling/mixins';
|
|
13
|
+
import { tint, transparentize } from '../../services';
|
|
14
|
+
|
|
15
|
+
var _ref = process.env.NODE_ENV === "production" ? {
|
|
16
|
+
name: "1hw5vc4-clickable",
|
|
17
|
+
styles: "cursor:pointer;label:clickable;"
|
|
18
|
+
} : {
|
|
19
|
+
name: "1hw5vc4-clickable",
|
|
20
|
+
styles: "cursor:pointer;label:clickable;",
|
|
21
|
+
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export var euiBadgeStyles = function euiBadgeStyles(euiThemeContext) {
|
|
25
|
+
var euiTheme = euiThemeContext.euiTheme,
|
|
26
|
+
colorMode = euiThemeContext.colorMode;
|
|
27
|
+
return {
|
|
28
|
+
euiBadge: /*#__PURE__*/css("display:inline-block;vertical-align:middle;padding:0 ", euiTheme.size.s, ";", logicalCSS('max-width', '100%'), " font-size:", euiFontSize(euiThemeContext, 'xs').fontSize, ";line-height:", euiTheme.base + 2, "px;font-weight:", euiTheme.font.weight.medium, ";white-space:nowrap;text-decoration:none;cursor:default;background-color:transparent;border:", euiTheme.border.width.thin, " solid transparent;border-radius:", parseFloat(String(euiTheme.border.radius.medium)) / 2, "px;", logicalTextAlignCSS('left'), " &:focus-within{", euiFocusRing(euiThemeContext), ";}&+.euiBadge{", logicalCSS('margin-left', euiTheme.size.xs), ";};label:euiBadge;"),
|
|
29
|
+
clickable: /*#__PURE__*/css("&:not(:disabled){&:hover,&:focus{text-decoration:underline;}}&:focus{", euiFocusRing(euiThemeContext), ";}&:disabled{cursor:not-allowed;};label:clickable;"),
|
|
30
|
+
disabled: /*#__PURE__*/css("color:", euiButtonColor(euiThemeContext, 'disabled').color, "!important;background-color:", euiButtonColor(euiThemeContext, 'disabled').backgroundColor, "!important;;label:disabled;"),
|
|
31
|
+
// Hollow has a border and is mostly used for autocompleters.
|
|
32
|
+
hollow: /*#__PURE__*/css("background-color:", euiTheme.colors.emptyShade, ";border-color:", colorMode === 'DARK' ? tint(euiTheme.border.color, 0.15) : euiTheme.border.color, ";color:", euiTheme.colors.text, ";;label:hollow;"),
|
|
33
|
+
// Content wrapper
|
|
34
|
+
euiBadge__content: /*#__PURE__*/css(logicalCSS( // Ensure proper height in case of just displaying an icon
|
|
35
|
+
'min-height', "".concat(euiTheme.base + parseFloat(String(euiTheme.border.width.thin)) * 2, "px")), " display:flex;align-items:center;overflow:hidden;;label:euiBadge__content;"),
|
|
36
|
+
// Text
|
|
37
|
+
text: {
|
|
38
|
+
euiBadge__text: /*#__PURE__*/css(euiTextTruncate(), " cursor:inherit;;label:euiBadge__text;"),
|
|
39
|
+
clickable: _ref
|
|
40
|
+
},
|
|
41
|
+
// Icon
|
|
42
|
+
icon: {
|
|
43
|
+
euiBadge__icon: /*#__PURE__*/css(";label:euiBadge__icon;"),
|
|
44
|
+
right: /*#__PURE__*/css("&:not(:only-child){", logicalCSS('margin-left', euiTheme.size.xs), ";};label:right;"),
|
|
45
|
+
left: /*#__PURE__*/css("&:not(:only-child){", logicalCSS('margin-right', euiTheme.size.xs), ";};label:left;")
|
|
46
|
+
},
|
|
47
|
+
// Clickable icons (iconOnClick)
|
|
48
|
+
iconButton: {
|
|
49
|
+
euiBadge__iconButton: /*#__PURE__*/css("font-size:0;&:focus{background-color:", transparentize(euiTheme.colors.ghost, 0.8), ";color:", euiTheme.colors.ink, ";border-radius:", parseFloat(String(euiTheme.border.radius.small)) / 2, "px;}&:disabled{cursor:not-allowed;}.euiBadge__icon{margin:0!important;};label:euiBadge__iconButton;"),
|
|
50
|
+
right: /*#__PURE__*/css(logicalCSS('margin-left', euiTheme.size.xs), ";;label:right;"),
|
|
51
|
+
left: /*#__PURE__*/css(logicalCSS('margin-right', euiTheme.size.xs), ";;label:left;")
|
|
52
|
+
},
|
|
53
|
+
// Used in badges with both onClick & iconOnClick
|
|
54
|
+
euiBadge__childButton: /*#__PURE__*/css(euiTextTruncate(), " text-align:inherit;font-weight:inherit;line-height:inherit;color:inherit;&:disabled{cursor:not-allowed;}&:not(:disabled){&:hover,&:focus{text-decoration:underline;}};label:euiBadge__childButton;")
|
|
55
|
+
};
|
|
56
|
+
};
|
|
@@ -541,6 +541,10 @@ export var EuiInMemoryTable = /*#__PURE__*/function (_Component) {
|
|
|
541
541
|
|
|
542
542
|
if (sortName !== prevState.prevProps.sortName || sortDirection !== prevState.prevProps.sortDirection) {
|
|
543
543
|
updatedPrevState = _objectSpread(_objectSpread({}, updatedPrevState), {}, {
|
|
544
|
+
prevProps: _objectSpread(_objectSpread({}, updatedPrevState.prevProps), {}, {
|
|
545
|
+
sortName: sortName,
|
|
546
|
+
sortDirection: sortDirection
|
|
547
|
+
}),
|
|
544
548
|
sortName: sortName,
|
|
545
549
|
sortDirection: sortDirection
|
|
546
550
|
});
|
|
@@ -1110,6 +1114,10 @@ EuiInMemoryTable.propTypes = {
|
|
|
1110
1114
|
operator: PropTypes.oneOf(["eq", "exact", "gt", "gte", "lt", "lte"])
|
|
1111
1115
|
}).isRequired).isRequired,
|
|
1112
1116
|
available: PropTypes.func
|
|
1117
|
+
}).isRequired, PropTypes.shape({
|
|
1118
|
+
type: PropTypes.oneOf(["custom_component"]).isRequired,
|
|
1119
|
+
component: PropTypes.elementType.isRequired,
|
|
1120
|
+
available: PropTypes.func
|
|
1113
1121
|
}).isRequired]).isRequired),
|
|
1114
1122
|
|
|
1115
1123
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var _excluded = ["children", "iconType", "iconSide", "size", "isDisabled", "disabled", "isLoading", "isSelected", "fullWidth", "minWidth", "contentProps", "textProps", "href", "target", "rel", "type"];
|
|
1
|
+
var _excluded = ["children", "iconType", "iconSide", "iconSize", "size", "isDisabled", "disabled", "isLoading", "isSelected", "fullWidth", "minWidth", "contentProps", "textProps", "href", "target", "rel", "type", "style"];
|
|
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
|
|
|
@@ -46,6 +46,7 @@ export var EuiButtonDisplay = /*#__PURE__*/forwardRef(function (_ref2, ref) {
|
|
|
46
46
|
var children = _ref2.children,
|
|
47
47
|
iconType = _ref2.iconType,
|
|
48
48
|
iconSide = _ref2.iconSide,
|
|
49
|
+
iconSize = _ref2.iconSize,
|
|
49
50
|
_ref2$size = _ref2.size,
|
|
50
51
|
size = _ref2$size === void 0 ? 'm' : _ref2$size,
|
|
51
52
|
isDisabled = _ref2.isDisabled,
|
|
@@ -61,6 +62,7 @@ export var EuiButtonDisplay = /*#__PURE__*/forwardRef(function (_ref2, ref) {
|
|
|
61
62
|
rel = _ref2.rel,
|
|
62
63
|
_ref2$type = _ref2.type,
|
|
63
64
|
type = _ref2$type === void 0 ? 'button' : _ref2$type,
|
|
65
|
+
style = _ref2.style,
|
|
64
66
|
rest = _objectWithoutProperties(_ref2, _excluded);
|
|
65
67
|
|
|
66
68
|
var buttonIsDisabled = isButtonDisabled({
|
|
@@ -68,9 +70,8 @@ export var EuiButtonDisplay = /*#__PURE__*/forwardRef(function (_ref2, ref) {
|
|
|
68
70
|
isDisabled: isDisabled || disabled,
|
|
69
71
|
isLoading: isLoading
|
|
70
72
|
});
|
|
71
|
-
var minWidthPx = typeof minWidth === 'number' ? "".concat(minWidth, "px") : minWidth;
|
|
72
73
|
var theme = useEuiTheme();
|
|
73
|
-
var styles = euiButtonDisplayStyles(theme
|
|
74
|
+
var styles = euiButtonDisplayStyles(theme);
|
|
74
75
|
var buttonRadiusStyle = useEuiButtonRadiusCSS()[size];
|
|
75
76
|
var cssStyles = [styles.euiButtonDisplay, styles[size], fullWidth && styles.fullWidth, buttonIsDisabled && styles.isDisabled, buttonRadiusStyle];
|
|
76
77
|
|
|
@@ -79,6 +80,7 @@ export var EuiButtonDisplay = /*#__PURE__*/forwardRef(function (_ref2, ref) {
|
|
|
79
80
|
isDisabled: buttonIsDisabled,
|
|
80
81
|
iconType: iconType,
|
|
81
82
|
iconSide: iconSide,
|
|
83
|
+
iconSize: iconSize,
|
|
82
84
|
textProps: _objectSpread({}, textProps)
|
|
83
85
|
}, contentProps), children);
|
|
84
86
|
|
|
@@ -108,6 +110,9 @@ export var EuiButtonDisplay = /*#__PURE__*/forwardRef(function (_ref2, ref) {
|
|
|
108
110
|
|
|
109
111
|
return createElement(element, _objectSpread(_objectSpread(_objectSpread({
|
|
110
112
|
css: cssStyles,
|
|
113
|
+
style: minWidth ? _objectSpread(_objectSpread({}, style), {}, {
|
|
114
|
+
minWidth: minWidth
|
|
115
|
+
}) : style,
|
|
111
116
|
ref: ref
|
|
112
117
|
}, elementProps), relObj), rest), innerNode);
|
|
113
118
|
});
|
|
@@ -178,7 +183,7 @@ EuiButtonDisplay.propTypes = {
|
|
|
178
183
|
/**
|
|
179
184
|
* Can only be one side `left` or `right`
|
|
180
185
|
*/
|
|
181
|
-
iconSide: PropTypes.
|
|
186
|
+
iconSide: PropTypes.oneOfType([PropTypes.any.isRequired, PropTypes.oneOf([undefined])]),
|
|
182
187
|
|
|
183
188
|
/**
|
|
184
189
|
* Object of props passed to the <span/> wrapping the content's text/children only (not icon)
|
|
@@ -191,7 +196,7 @@ EuiButtonDisplay.propTypes = {
|
|
|
191
196
|
ref: PropTypes.any,
|
|
192
197
|
"data-text": PropTypes.string
|
|
193
198
|
}),
|
|
194
|
-
iconSize: PropTypes.
|
|
199
|
+
iconSize: PropTypes.any,
|
|
195
200
|
isDisabled: PropTypes.bool,
|
|
196
201
|
className: PropTypes.string,
|
|
197
202
|
"aria-label": PropTypes.string,
|
|
@@ -28,11 +28,11 @@ var _ref = process.env.NODE_ENV === "production" ? {
|
|
|
28
28
|
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
29
29
|
};
|
|
30
30
|
|
|
31
|
-
export var euiButtonDisplayStyles = function euiButtonDisplayStyles(euiThemeContext
|
|
31
|
+
export var euiButtonDisplayStyles = function euiButtonDisplayStyles(euiThemeContext) {
|
|
32
32
|
var euiTheme = euiThemeContext.euiTheme;
|
|
33
33
|
return {
|
|
34
34
|
// Base
|
|
35
|
-
euiButtonDisplay: /*#__PURE__*/css(euiButtonBaseCSS(), ";",
|
|
35
|
+
euiButtonDisplay: /*#__PURE__*/css(euiButtonBaseCSS(), ";", logicalCSS('min-width', "".concat(euiTheme.base * 7, "px")), " font-weight:", euiTheme.font.weight.medium, ";padding:0 ", euiTheme.size.m, ";&:hover:not(:disabled),&:focus{text-decoration:underline;};label:euiButtonDisplay;"),
|
|
36
36
|
// States
|
|
37
37
|
isDisabled: _ref,
|
|
38
38
|
fullWidth: /*#__PURE__*/css("display:block;", logicalCSS('width', '100%'), ";;label:fullWidth;"),
|
|
@@ -21,6 +21,8 @@ import { EuiIcon } from '../../icon';
|
|
|
21
21
|
import { euiButtonDisplayContentStyles } from './_button_display_content.styles';
|
|
22
22
|
import classNames from 'classnames';
|
|
23
23
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
24
|
+
export var ICON_SIZES = ['s', 'm'];
|
|
25
|
+
export var ICON_SIDES = ['left', 'right'];
|
|
24
26
|
export var EuiButtonDisplayContent = function EuiButtonDisplayContent(_ref) {
|
|
25
27
|
var children = _ref.children,
|
|
26
28
|
textProps = _ref.textProps,
|
|
@@ -38,7 +40,7 @@ export var EuiButtonDisplayContent = function EuiButtonDisplayContent(_ref) {
|
|
|
38
40
|
var styles = euiButtonDisplayContentStyles(theme);
|
|
39
41
|
var cssStyles = [styles.euiButtonDisplayContent, iconSide && styles[iconSide]];
|
|
40
42
|
var cssSpinnerStyles = [styles.euiButtonDisplayContent__spinner];
|
|
41
|
-
var cssIconStyles = [styles.euiButtonDisplayContent__icon]; // Add an icon to the button if one exists.
|
|
43
|
+
var cssIconStyles = [styles.euiButtonDisplayContent__icon, iconSize && styles[iconSize]]; // Add an icon to the button if one exists.
|
|
42
44
|
|
|
43
45
|
var icon; // When the button is disabled the text gets gray
|
|
44
46
|
// and in some buttons the background gets a light gray
|
|
@@ -82,7 +84,7 @@ EuiButtonDisplayContent.propTypes = {
|
|
|
82
84
|
/**
|
|
83
85
|
* Can only be one side `left` or `right`
|
|
84
86
|
*/
|
|
85
|
-
iconSide: PropTypes.
|
|
87
|
+
iconSide: PropTypes.oneOfType([PropTypes.any.isRequired, PropTypes.oneOf([undefined])]),
|
|
86
88
|
isLoading: PropTypes.bool,
|
|
87
89
|
|
|
88
90
|
/**
|
|
@@ -96,7 +98,7 @@ EuiButtonDisplayContent.propTypes = {
|
|
|
96
98
|
ref: PropTypes.any,
|
|
97
99
|
"data-text": PropTypes.string
|
|
98
100
|
}),
|
|
99
|
-
iconSize: PropTypes.
|
|
101
|
+
iconSize: PropTypes.any,
|
|
100
102
|
isDisabled: PropTypes.bool,
|
|
101
103
|
className: PropTypes.string,
|
|
102
104
|
"aria-label": PropTypes.string,
|
|
@@ -46,6 +46,9 @@ export var euiButtonDisplayContentStyles = function euiButtonDisplayContentStyle
|
|
|
46
46
|
left: /*#__PURE__*/css(";label:left;"),
|
|
47
47
|
right: _ref3,
|
|
48
48
|
euiButtonDisplayContent__spinner: _ref2,
|
|
49
|
-
euiButtonDisplayContent__icon: _ref
|
|
49
|
+
euiButtonDisplayContent__icon: _ref,
|
|
50
|
+
// Icon size
|
|
51
|
+
s: /*#__PURE__*/css(";label:s;"),
|
|
52
|
+
m: /*#__PURE__*/css(";label:m;")
|
|
50
53
|
};
|
|
51
54
|
};
|
|
@@ -82,7 +82,7 @@ export var EuiCard = function EuiCard(_ref) {
|
|
|
82
82
|
var isDisabled = _isDisabled || !isHrefValid;
|
|
83
83
|
var isClickable = !isDisabled && (onClick || href || selectable && !selectable.isDisabled);
|
|
84
84
|
var euiThemeContext = useEuiTheme();
|
|
85
|
-
var styles = euiCardStyles(euiThemeContext, paddingSize
|
|
85
|
+
var styles = euiCardStyles(euiThemeContext, paddingSize);
|
|
86
86
|
var cardStyles = [styles.card.euiCard, // Text alignment should always be left when horizontal
|
|
87
87
|
styles.card.aligned[layout === 'horizontal' ? 'left' : textAlign], styles.card.layout[layout], isDisabled && styles.card.disabled];
|
|
88
88
|
var contentStyles = [styles.content.euiCard__content, styles.content.layout[layout]];
|
|
@@ -128,7 +128,7 @@ export var EuiCard = function EuiCard(_ref) {
|
|
|
128
128
|
|
|
129
129
|
if (image && layout === 'vertical') {
|
|
130
130
|
if ( /*#__PURE__*/isValidElement(image) || typeof image === 'string') {
|
|
131
|
-
var imageStyles = [styles.euiCard__image];
|
|
131
|
+
var imageStyles = [styles.image.euiCard__image, display === 'transparent' && styles.image.transparent];
|
|
132
132
|
imageNode = ___EmotionJSX("div", {
|
|
133
133
|
className: "euiCard__image",
|
|
134
134
|
css: imageStyles
|
|
@@ -54,7 +54,7 @@ var _ref5 = process.env.NODE_ENV === "production" ? {
|
|
|
54
54
|
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
55
55
|
};
|
|
56
56
|
|
|
57
|
-
export var euiCardStyles = function euiCardStyles(euiThemeContext, paddingSize
|
|
57
|
+
export var euiCardStyles = function euiCardStyles(euiThemeContext, paddingSize) {
|
|
58
58
|
var euiTheme = euiThemeContext.euiTheme;
|
|
59
59
|
var paddingAmount = euiPaddingSize(euiThemeContext, paddingSize);
|
|
60
60
|
var spacing = euiPaddingSize(euiThemeContext, paddingKey);
|
|
@@ -91,7 +91,10 @@ export var euiCardStyles = function euiCardStyles(euiThemeContext, paddingSize,
|
|
|
91
91
|
},
|
|
92
92
|
disabled: _ref2
|
|
93
93
|
},
|
|
94
|
-
|
|
94
|
+
image: {
|
|
95
|
+
euiCard__image: /*#__PURE__*/css("position:relative;overflow:hidden;", logicalCSS('width', "calc(100% + (".concat(paddingAmount, " * 2))")), ";", logicalCSS('left', "-".concat(paddingAmount)), ";", logicalCSS('top', "-".concat(paddingAmount)), ";", logicalCSS('margin-bottom', "-".concat(paddingAmount)), ";", logicalCSS('border-top-left-radius', "calc(".concat(euiTheme.border.radius.medium, " - ").concat(euiTheme.border.width.thin, ")")), " ", logicals['border-top-right-radius'], ":calc(", euiTheme.border.radius.medium, " - ", euiTheme.border.width.thin, ");img{", logicalCSS('width', '100%'), ";};label:euiCard__image;"),
|
|
96
|
+
transparent: /*#__PURE__*/css("border-radius:", euiTheme.border.radius.medium, ";;label:transparent;")
|
|
97
|
+
},
|
|
95
98
|
icon: {
|
|
96
99
|
euiCard__icon: /*#__PURE__*/css(";label:euiCard__icon;"),
|
|
97
100
|
withImage: /*#__PURE__*/css("position:absolute;", logicalCSS('top', '50%'), ";", logicalCSS('left', '50%'), ";transform:translate(-50%, calc(-50% + -", paddingAmount, "))!important;;label:withImage;"),
|
|
@@ -123,7 +123,7 @@ EuiNotificationEvent.propTypes = {
|
|
|
123
123
|
/**
|
|
124
124
|
* Accepts either our palette colors (primary, success ..etc) or a hex value `#FFFFFF`, `#000`.
|
|
125
125
|
*/
|
|
126
|
-
badgeColor: PropTypes.oneOfType([PropTypes.
|
|
126
|
+
badgeColor: PropTypes.oneOfType([PropTypes.any.isRequired, PropTypes.string.isRequired]),
|
|
127
127
|
|
|
128
128
|
/**
|
|
129
129
|
* The icon used to visually represent this data type. Accepts any `EuiIcon IconType`.
|
|
@@ -144,7 +144,7 @@ EuiNotificationEventMeta.propTypes = {
|
|
|
144
144
|
/**
|
|
145
145
|
* Accepts either our palette colors (primary, success ..etc) or a hex value `#FFFFFF`, `#000`.
|
|
146
146
|
*/
|
|
147
|
-
badgeColor: PropTypes.oneOfType([PropTypes.
|
|
147
|
+
badgeColor: PropTypes.oneOfType([PropTypes.any.isRequired, PropTypes.string.isRequired]),
|
|
148
148
|
|
|
149
149
|
/**
|
|
150
150
|
* The icon used to visually represent this data type. Accepts any `EuiIcon IconType`.
|
|
@@ -31,9 +31,9 @@ export var EuiPopoverTitle = function EuiPopoverTitle(_ref) {
|
|
|
31
31
|
panelPadding = _useContext.paddingSize;
|
|
32
32
|
|
|
33
33
|
var euiTheme = useEuiTheme();
|
|
34
|
-
var styles = euiPopoverTitleStyles(euiTheme
|
|
34
|
+
var styles = euiPopoverTitleStyles(euiTheme);
|
|
35
35
|
var paddingStyles = useEuiPaddingCSS();
|
|
36
|
-
var cssStyles = [styles.euiPopoverTitle, // If a paddingSize is not directly provided, inherit from the EuiPopoverPanel
|
|
36
|
+
var cssStyles = [styles.euiPopoverTitle, styles.panelPaddingSizes[panelPadding], // If a paddingSize is not directly provided, inherit from the EuiPopoverPanel
|
|
37
37
|
paddingStyles[paddingSize || panelPadding]];
|
|
38
38
|
var classes = classNames('euiPopoverTitle', className);
|
|
39
39
|
return ___EmotionJSX("div", _extends({
|
|
@@ -8,13 +8,25 @@
|
|
|
8
8
|
import { css } from '@emotion/react';
|
|
9
9
|
import { euiPaddingSize, logicalCSS } from '../../global_styling';
|
|
10
10
|
import { euiTitle } from '../title/title.styles';
|
|
11
|
-
export var euiPopoverTitleStyles = function euiPopoverTitleStyles(euiThemeContext
|
|
12
|
-
var euiTheme = euiThemeContext.euiTheme;
|
|
13
|
-
// ensure the title expands to cover that padding and
|
|
14
|
-
|
|
15
|
-
var panelPaddingSize = euiPaddingSize(euiThemeContext, panelPadding);
|
|
11
|
+
export var euiPopoverTitleStyles = function euiPopoverTitleStyles(euiThemeContext) {
|
|
12
|
+
var euiTheme = euiThemeContext.euiTheme;
|
|
16
13
|
return {
|
|
17
14
|
// Base
|
|
18
|
-
euiPopoverTitle: /*#__PURE__*/css(euiTitle(euiThemeContext, 'xxs'), ";", logicalCSS('border-bottom', euiTheme.border.thin), "
|
|
15
|
+
euiPopoverTitle: /*#__PURE__*/css(euiTitle(euiThemeContext, 'xxs'), ";", logicalCSS('border-bottom', euiTheme.border.thin), ";;label:euiPopoverTitle;"),
|
|
16
|
+
// If the popover's containing panel has padding applied,
|
|
17
|
+
// ensure the title expands to cover that padding via negative margins
|
|
18
|
+
panelPaddingSizes: {
|
|
19
|
+
none: /*#__PURE__*/css(";label:none;"),
|
|
20
|
+
xs: /*#__PURE__*/css(getPaddingOffset(euiThemeContext, 'xs'), ";;label:xs;"),
|
|
21
|
+
s: /*#__PURE__*/css(getPaddingOffset(euiThemeContext, 's'), ";;label:s;"),
|
|
22
|
+
m: /*#__PURE__*/css(getPaddingOffset(euiThemeContext, 'm'), ";;label:m;"),
|
|
23
|
+
l: /*#__PURE__*/css(getPaddingOffset(euiThemeContext, 'l'), ";;label:l;"),
|
|
24
|
+
xl: /*#__PURE__*/css(getPaddingOffset(euiThemeContext, 'xl'), ";;label:xl;")
|
|
25
|
+
}
|
|
19
26
|
};
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
var getPaddingOffset = function getPaddingOffset(euiThemeContext, size) {
|
|
30
|
+
var panelPaddingSize = euiPaddingSize(euiThemeContext, size);
|
|
31
|
+
return "margin: -".concat(panelPaddingSize, " -").concat(panelPaddingSize, " ").concat(panelPaddingSize, ";");
|
|
20
32
|
};
|
|
@@ -0,0 +1,16 @@
|
|
|
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 { jsx as ___EmotionJSX } from "@emotion/react";
|
|
10
|
+
export var CustomComponentFilter = function CustomComponentFilter(props) {
|
|
11
|
+
var CustomComponent = props.config.component;
|
|
12
|
+
return ___EmotionJSX(CustomComponent, {
|
|
13
|
+
query: props.query,
|
|
14
|
+
onChange: props.onChange
|
|
15
|
+
});
|
|
16
|
+
};
|
|
@@ -12,6 +12,7 @@ import { IsFilter } from './is_filter';
|
|
|
12
12
|
import { FieldValueSelectionFilter } from './field_value_selection_filter';
|
|
13
13
|
import { FieldValueToggleFilter } from './field_value_toggle_filter';
|
|
14
14
|
import { FieldValueToggleGroupFilter } from './field_value_toggle_group_filter';
|
|
15
|
+
import { CustomComponentFilter } from './custom_component_filter';
|
|
15
16
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
16
17
|
export var createFilter = function createFilter(index, config, query, onChange) {
|
|
17
18
|
var props = {
|
|
@@ -45,6 +46,11 @@ export var createFilter = function createFilter(index, config, query, onChange)
|
|
|
45
46
|
config: config
|
|
46
47
|
}));
|
|
47
48
|
|
|
49
|
+
case 'custom_component':
|
|
50
|
+
return ___EmotionJSX(CustomComponentFilter, _extends({}, props, {
|
|
51
|
+
config: config
|
|
52
|
+
}));
|
|
53
|
+
|
|
48
54
|
default:
|
|
49
55
|
// @ts-ignore TS knows that we've checked `config.type` exhaustively
|
|
50
56
|
throw new Error("Unknown search filter type [".concat(config.type, "]"));
|