@elastic/eui 102.2.0 → 102.3.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_borealis_dark.json +1 -1
- package/es/components/badge/color_utils.js +1 -3
- package/es/components/badge/notification_badge/badge_notification.styles.js +6 -1
- package/es/components/basic_table/basic_table.js +4 -1
- package/es/components/basic_table/in_memory_table.js +4 -1
- package/es/components/breadcrumbs/_breadcrumb_content.styles.js +6 -3
- package/es/components/button/button_display/_button_display.js +1 -1
- package/es/components/button/button_display/_button_display.styles.js +11 -2
- package/es/components/button/button_display/_button_display_content.styles.js +6 -3
- package/es/components/button/button_empty/button_empty.styles.js +9 -12
- package/es/components/button/button_group/button_group.styles.js +5 -3
- package/es/components/button/button_group/button_group_button.js +19 -9
- package/es/components/button/button_group/button_group_button.styles.js +43 -19
- package/es/components/button/button_icon/button_icon.js +4 -2
- package/es/components/collapsible_nav/collapsible_nav.js +1 -0
- package/es/components/datagrid/controls/data_grid_toolbar_control.js +11 -1
- package/es/components/datagrid/utils/focus.js +2 -2
- package/es/components/filter_group/filter_button.js +88 -23
- package/es/components/filter_group/filter_button.styles.js +51 -15
- package/es/components/filter_group/filter_group.styles.js +18 -6
- package/es/components/markdown_editor/markdown_editor_footer.js +9 -4
- package/es/components/search_bar/filters/field_value_selection_filter.js +1 -0
- package/es/components/search_bar/filters/field_value_toggle_filter.js +3 -1
- package/es/components/search_bar/filters/field_value_toggle_group_filter.js +3 -1
- package/es/components/search_bar/filters/is_filter.js +3 -1
- package/es/components/search_bar/search_bar.a11y.js +3 -3
- package/es/global_styling/mixins/_button.js +95 -28
- package/es/services/theme/index.js +2 -1
- package/es/services/theme/provider.js +28 -2
- package/es/services/theme/theme_variant.js +22 -0
- package/es/themes/amsterdam/global_styling/variables/_buttons.js +348 -147
- package/es/themes/amsterdam/global_styling/variables/_components.js +229 -224
- package/es/themes/amsterdam/theme.js +2 -1
- package/es/themes/json/eui_theme_borealis_dark.json +1 -1
- package/eui.d.ts +194 -161
- package/lib/components/badge/color_utils.js +1 -3
- package/lib/components/badge/notification_badge/badge_notification.styles.js +6 -1
- package/lib/components/basic_table/basic_table.js +4 -1
- package/lib/components/basic_table/in_memory_table.js +4 -1
- package/lib/components/breadcrumbs/_breadcrumb_content.styles.js +5 -2
- package/lib/components/button/button_display/_button_display.js +1 -1
- package/lib/components/button/button_display/_button_display.styles.js +11 -2
- package/lib/components/button/button_display/_button_display_content.styles.js +6 -3
- package/lib/components/button/button_empty/button_empty.styles.js +10 -11
- package/lib/components/button/button_group/button_group.styles.js +5 -3
- package/lib/components/button/button_group/button_group_button.js +18 -8
- package/lib/components/button/button_group/button_group_button.styles.js +41 -17
- package/lib/components/button/button_icon/button_icon.js +3 -1
- package/lib/components/collapsible_nav/collapsible_nav.js +1 -0
- package/lib/components/datagrid/controls/data_grid_toolbar_control.js +11 -1
- package/lib/components/datagrid/utils/focus.js +1 -1
- package/lib/components/filter_group/filter_button.js +86 -21
- package/lib/components/filter_group/filter_button.styles.js +51 -15
- package/lib/components/filter_group/filter_group.styles.js +18 -6
- package/lib/components/markdown_editor/markdown_editor_footer.js +8 -3
- package/lib/components/search_bar/filters/field_value_selection_filter.js +1 -0
- package/lib/components/search_bar/filters/field_value_toggle_filter.js +3 -1
- package/lib/components/search_bar/filters/field_value_toggle_group_filter.js +3 -1
- package/lib/components/search_bar/filters/is_filter.js +3 -1
- package/lib/components/search_bar/search_bar.a11y.js +3 -3
- package/lib/global_styling/mixins/_button.js +94 -27
- package/lib/services/theme/index.js +42 -1
- package/lib/services/theme/provider.js +28 -2
- package/lib/services/theme/theme_variant.js +28 -0
- package/lib/themes/amsterdam/global_styling/variables/_buttons.js +348 -147
- package/lib/themes/amsterdam/global_styling/variables/_components.js +229 -224
- package/lib/themes/amsterdam/theme.js +2 -1
- package/lib/themes/json/eui_theme_borealis_dark.json +1 -1
- package/optimize/es/components/badge/color_utils.js +1 -3
- package/optimize/es/components/badge/notification_badge/badge_notification.styles.js +6 -1
- package/optimize/es/components/breadcrumbs/_breadcrumb_content.styles.js +6 -3
- package/optimize/es/components/button/button_display/_button_display.js +1 -1
- package/optimize/es/components/button/button_display/_button_display.styles.js +11 -2
- package/optimize/es/components/button/button_display/_button_display_content.styles.js +6 -3
- package/optimize/es/components/button/button_empty/button_empty.styles.js +9 -12
- package/optimize/es/components/button/button_group/button_group.styles.js +5 -3
- package/optimize/es/components/button/button_group/button_group_button.js +12 -8
- package/optimize/es/components/button/button_group/button_group_button.styles.js +43 -19
- package/optimize/es/components/button/button_icon/button_icon.js +4 -2
- package/optimize/es/components/datagrid/controls/data_grid_toolbar_control.js +11 -1
- package/optimize/es/components/datagrid/utils/focus.js +2 -2
- package/optimize/es/components/filter_group/filter_button.js +78 -21
- package/optimize/es/components/filter_group/filter_button.styles.js +51 -15
- package/optimize/es/components/filter_group/filter_group.styles.js +18 -6
- package/optimize/es/components/markdown_editor/markdown_editor_footer.js +9 -4
- package/optimize/es/components/search_bar/filters/field_value_selection_filter.js +1 -0
- package/optimize/es/components/search_bar/filters/field_value_toggle_filter.js +3 -1
- package/optimize/es/components/search_bar/filters/field_value_toggle_group_filter.js +3 -1
- package/optimize/es/components/search_bar/filters/is_filter.js +3 -1
- package/optimize/es/components/search_bar/search_bar.a11y.js +3 -3
- package/optimize/es/global_styling/mixins/_button.js +95 -28
- package/optimize/es/services/theme/index.js +2 -1
- package/optimize/es/services/theme/provider.js +28 -2
- package/optimize/es/services/theme/theme_variant.js +22 -0
- package/optimize/es/themes/amsterdam/global_styling/variables/_buttons.js +348 -147
- package/optimize/es/themes/amsterdam/global_styling/variables/_components.js +229 -224
- package/optimize/es/themes/amsterdam/theme.js +2 -1
- package/optimize/es/themes/json/eui_theme_borealis_dark.json +1 -1
- package/optimize/lib/components/badge/color_utils.js +1 -3
- package/optimize/lib/components/badge/notification_badge/badge_notification.styles.js +6 -1
- package/optimize/lib/components/breadcrumbs/_breadcrumb_content.styles.js +5 -2
- package/optimize/lib/components/button/button_display/_button_display.js +1 -1
- package/optimize/lib/components/button/button_display/_button_display.styles.js +11 -2
- package/optimize/lib/components/button/button_display/_button_display_content.styles.js +6 -3
- package/optimize/lib/components/button/button_empty/button_empty.styles.js +10 -11
- package/optimize/lib/components/button/button_group/button_group.styles.js +5 -3
- package/optimize/lib/components/button/button_group/button_group_button.js +11 -7
- package/optimize/lib/components/button/button_group/button_group_button.styles.js +41 -17
- package/optimize/lib/components/button/button_icon/button_icon.js +3 -1
- package/optimize/lib/components/datagrid/controls/data_grid_toolbar_control.js +11 -1
- package/optimize/lib/components/datagrid/utils/focus.js +1 -1
- package/optimize/lib/components/filter_group/filter_button.js +76 -19
- package/optimize/lib/components/filter_group/filter_button.styles.js +51 -15
- package/optimize/lib/components/filter_group/filter_group.styles.js +18 -6
- package/optimize/lib/components/markdown_editor/markdown_editor_footer.js +8 -3
- package/optimize/lib/components/search_bar/filters/field_value_selection_filter.js +1 -0
- package/optimize/lib/components/search_bar/filters/field_value_toggle_filter.js +3 -1
- package/optimize/lib/components/search_bar/filters/field_value_toggle_group_filter.js +3 -1
- package/optimize/lib/components/search_bar/filters/is_filter.js +3 -1
- package/optimize/lib/components/search_bar/search_bar.a11y.js +3 -3
- package/optimize/lib/global_styling/mixins/_button.js +94 -27
- package/optimize/lib/services/theme/index.js +42 -1
- package/optimize/lib/services/theme/provider.js +28 -2
- package/optimize/lib/services/theme/theme_variant.js +28 -0
- package/optimize/lib/themes/amsterdam/global_styling/variables/_buttons.js +348 -147
- package/optimize/lib/themes/amsterdam/global_styling/variables/_components.js +229 -224
- package/optimize/lib/themes/amsterdam/theme.js +2 -1
- package/optimize/lib/themes/json/eui_theme_borealis_dark.json +1 -1
- package/package.json +4 -4
- package/test-env/components/badge/color_utils.js +1 -3
- package/test-env/components/badge/notification_badge/badge_notification.styles.js +6 -1
- package/test-env/components/basic_table/basic_table.js +4 -1
- package/test-env/components/basic_table/in_memory_table.js +4 -1
- package/test-env/components/breadcrumbs/_breadcrumb_content.styles.js +5 -2
- package/test-env/components/button/button_display/_button_display.js +1 -1
- package/test-env/components/button/button_display/_button_display.styles.js +11 -2
- package/test-env/components/button/button_display/_button_display_content.styles.js +6 -3
- package/test-env/components/button/button_empty/button_empty.styles.js +10 -11
- package/test-env/components/button/button_group/button_group.styles.js +5 -3
- package/test-env/components/button/button_group/button_group_button.js +18 -8
- package/test-env/components/button/button_group/button_group_button.styles.js +41 -17
- package/test-env/components/button/button_icon/button_icon.js +3 -1
- package/test-env/components/collapsible_nav/collapsible_nav.js +1 -0
- package/test-env/components/datagrid/controls/data_grid_toolbar_control.js +11 -1
- package/test-env/components/datagrid/utils/focus.js +1 -1
- package/test-env/components/filter_group/filter_button.js +86 -21
- package/test-env/components/filter_group/filter_button.styles.js +51 -15
- package/test-env/components/filter_group/filter_group.styles.js +18 -6
- package/test-env/components/markdown_editor/markdown_editor_footer.js +8 -3
- package/test-env/components/search_bar/filters/field_value_selection_filter.js +1 -0
- package/test-env/components/search_bar/filters/field_value_toggle_filter.js +3 -1
- package/test-env/components/search_bar/filters/field_value_toggle_group_filter.js +3 -1
- package/test-env/components/search_bar/filters/is_filter.js +3 -1
- package/test-env/components/search_bar/search_bar.a11y.js +3 -3
- package/test-env/global_styling/mixins/_button.js +94 -27
- package/test-env/services/theme/index.js +42 -1
- package/test-env/services/theme/provider.js +28 -2
- package/test-env/services/theme/theme_variant.js +28 -0
- package/test-env/themes/amsterdam/global_styling/variables/_buttons.js +348 -147
- package/test-env/themes/amsterdam/global_styling/variables/_components.js +229 -224
- package/test-env/themes/amsterdam/theme.js +2 -1
- package/test-env/themes/json/eui_theme_borealis_dark.json +1 -1
|
@@ -3,10 +3,11 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.useEuiButtonFocusCSS = exports.useEuiButtonColorCSS = exports.euiButtonSizeMap = exports.euiButtonFillColor = exports.euiButtonEmptyColor = exports.euiButtonColor = exports.SEVERITY_COLORS = exports.EXTENDED_BUTTON_COLORS = exports.BUTTON_DISPLAYS = exports.BUTTON_COLORS = void 0;
|
|
6
|
+
exports.useEuiButtonFocusCSS = exports.useEuiButtonColorCSS = exports.highContrastHoverIndicatorStyles = exports.euiButtonSizeMap = exports.euiButtonFillColor = exports.euiButtonEmptyColor = exports.euiButtonColor = exports.SEVERITY_COLORS = exports.EXTENDED_BUTTON_COLORS = exports.BUTTON_DISPLAYS = exports.BUTTON_COLORS = void 0;
|
|
7
7
|
var _react = require("@emotion/react");
|
|
8
8
|
var _euiThemeCommon = require("@elastic/eui-theme-common");
|
|
9
9
|
var _services = require("../../services");
|
|
10
|
+
var _functions = require("../functions");
|
|
10
11
|
var _templateObject;
|
|
11
12
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
12
13
|
function _taggedTemplateLiteral(e, t) { return t || (t = e.slice(0)), Object.freeze(Object.defineProperties(e, { raw: { value: Object.freeze(t) } })); }
|
|
@@ -32,6 +33,25 @@ var SEVERITY_COLORS = exports.SEVERITY_COLORS = ['neutral', 'risk'];
|
|
|
32
33
|
var BUTTON_COLORS = exports.BUTTON_COLORS = ['text', 'accent', 'accentSecondary', 'primary', 'success', 'warning', 'danger'];
|
|
33
34
|
var EXTENDED_BUTTON_COLORS = exports.EXTENDED_BUTTON_COLORS = [].concat(BUTTON_COLORS, SEVERITY_COLORS);
|
|
34
35
|
var BUTTON_DISPLAYS = exports.BUTTON_DISPLAYS = ['base', 'fill', 'empty'];
|
|
36
|
+
var getButtonVariantTokenValues = function getButtonVariantTokenValues(_ref, color, variant) {
|
|
37
|
+
var euiTheme = _ref.euiTheme,
|
|
38
|
+
highContrastMode = _ref.highContrastMode;
|
|
39
|
+
var backgroundTokenBase = variant === 'base' ? 'background' : "background".concat(variant.charAt(0).toUpperCase() + variant.slice(1));
|
|
40
|
+
var textTokenBase = variant === 'filled' ? 'textColorFilled' : 'textColor';
|
|
41
|
+
var backgroundTokenName = (0, _euiThemeCommon.getTokenName)(backgroundTokenBase, color);
|
|
42
|
+
var textTokenName = (0, _euiThemeCommon.getTokenName)(textTokenBase, color);
|
|
43
|
+
var backgroundHoverTokenName = (0, _euiThemeCommon.getTokenName)(backgroundTokenBase, color, 'hover');
|
|
44
|
+
var backgroundActiveTokenName = (0, _euiThemeCommon.getTokenName)(backgroundTokenBase, color, 'active');
|
|
45
|
+
var highContrastForeground = ['warning', 'neutral', 'risk'].includes(color) ? euiTheme.colors.ink : color === 'disabled' ? euiTheme.components.buttons[textTokenName] : euiTheme.colors.textInverse;
|
|
46
|
+
var foreground = variant === 'filled' ? highContrastMode ? highContrastForeground : euiTheme.components.buttons[textTokenName] : euiTheme.components.buttons[textTokenName];
|
|
47
|
+
return {
|
|
48
|
+
color: foreground,
|
|
49
|
+
background: euiTheme.components.buttons[backgroundTokenName],
|
|
50
|
+
backgroundHover: euiTheme.components.buttons[backgroundHoverTokenName],
|
|
51
|
+
backgroundActive: euiTheme.components.buttons[backgroundActiveTokenName]
|
|
52
|
+
};
|
|
53
|
+
};
|
|
54
|
+
|
|
35
55
|
/**
|
|
36
56
|
* Creates the `base` version of button styles with proper text contrast.
|
|
37
57
|
* @param euiThemeContext
|
|
@@ -39,11 +59,9 @@ var BUTTON_DISPLAYS = exports.BUTTON_DISPLAYS = ['base', 'fill', 'empty'];
|
|
|
39
59
|
* @returns Style object `{ backgroundColor, color }`
|
|
40
60
|
*/
|
|
41
61
|
var euiButtonColor = exports.euiButtonColor = function euiButtonColor(euiThemeContext, color) {
|
|
42
|
-
var
|
|
43
|
-
var
|
|
44
|
-
var
|
|
45
|
-
var foreground = euiTheme.components.buttons[textTokenName];
|
|
46
|
-
var background = euiTheme.components.buttons[backgroundTokenName];
|
|
62
|
+
var buttonColors = getButtonVariantTokenValues(euiThemeContext, color, 'base');
|
|
63
|
+
var foreground = buttonColors.color;
|
|
64
|
+
var background = buttonColors.background;
|
|
47
65
|
return _objectSpread({
|
|
48
66
|
color: background === 'transparent' || color === 'disabled' ? foreground : (0, _services.makeHighContrastColor)(foreground)(background),
|
|
49
67
|
backgroundColor: background
|
|
@@ -57,13 +75,9 @@ var euiButtonColor = exports.euiButtonColor = function euiButtonColor(euiThemeCo
|
|
|
57
75
|
* @returns Style object `{ backgroundColor, color }`
|
|
58
76
|
*/
|
|
59
77
|
var euiButtonFillColor = exports.euiButtonFillColor = function euiButtonFillColor(euiThemeContext, color) {
|
|
60
|
-
var
|
|
61
|
-
|
|
62
|
-
var
|
|
63
|
-
var textColorTokenName = (0, _euiThemeCommon.getTokenName)('textColorFilled', color);
|
|
64
|
-
var highContrastForeground = ['warning', 'neutral', 'risk'].includes(color) ? euiTheme.colors.ink : color === 'disabled' ? euiTheme.components.buttons[textColorTokenName] : euiTheme.colors.textInverse;
|
|
65
|
-
var foreground = highContrastMode ? highContrastForeground : euiTheme.components.buttons[textColorTokenName];
|
|
66
|
-
var background = euiTheme.components.buttons[backgroundTokenName];
|
|
78
|
+
var buttonColors = getButtonVariantTokenValues(euiThemeContext, color, 'filled');
|
|
79
|
+
var foreground = buttonColors.color;
|
|
80
|
+
var background = buttonColors.background;
|
|
67
81
|
return _objectSpread({
|
|
68
82
|
color: foreground,
|
|
69
83
|
backgroundColor: background
|
|
@@ -87,9 +101,9 @@ var euiButtonEmptyColor = exports.euiButtonEmptyColor = function euiButtonEmptyC
|
|
|
87
101
|
break;
|
|
88
102
|
default:
|
|
89
103
|
{
|
|
90
|
-
var
|
|
104
|
+
var buttonColors = getButtonVariantTokenValues(euiThemeContext, color, 'empty');
|
|
91
105
|
foreground = euiButtonColor(euiThemeContext, color).color;
|
|
92
|
-
background =
|
|
106
|
+
background = buttonColors.backgroundHover;
|
|
93
107
|
break;
|
|
94
108
|
}
|
|
95
109
|
}
|
|
@@ -112,6 +126,8 @@ var useEuiButtonColorCSS = exports.useEuiButtonColorCSS = function useEuiButtonC
|
|
|
112
126
|
return colorsDisplaysMap[display];
|
|
113
127
|
};
|
|
114
128
|
var euiButtonDisplaysColors = function euiButtonDisplaysColors(euiThemeContext) {
|
|
129
|
+
var euiTheme = euiThemeContext.euiTheme;
|
|
130
|
+
var isRefreshVariant = (0, _services.isEuiThemeRefreshVariant)(euiThemeContext, 'buttonVariant');
|
|
115
131
|
var COLORS = [].concat(_toConsumableArray(EXTENDED_BUTTON_COLORS), ['disabled']);
|
|
116
132
|
var displaysColorsMap = {};
|
|
117
133
|
BUTTON_DISPLAYS.forEach(function (display) {
|
|
@@ -119,14 +135,28 @@ var euiButtonDisplaysColors = function euiButtonDisplaysColors(euiThemeContext)
|
|
|
119
135
|
COLORS.forEach(function (color) {
|
|
120
136
|
switch (display) {
|
|
121
137
|
case 'base':
|
|
122
|
-
|
|
123
|
-
|
|
138
|
+
{
|
|
139
|
+
var buttonColors = getButtonVariantTokenValues(euiThemeContext, color, 'base');
|
|
140
|
+
var borderStyle = color === 'text' && "\n border: ".concat(euiTheme.border.width.thin, " solid ").concat(euiTheme.colors.borderBasePlain, ";\n ");
|
|
141
|
+
var refreshVariantStyles = isRefreshVariant && "\n ".concat(_interactionStyles(euiThemeContext, buttonColors, 'overlay'), "\n ").concat(borderStyle, "\n ");
|
|
142
|
+
displaysColorsMap[display][color] = /*#__PURE__*/(0, _react.css)(euiButtonColor(euiThemeContext, color), " ", refreshVariantStyles, ";;label:displaysColorsMap-display-color;");
|
|
143
|
+
break;
|
|
144
|
+
}
|
|
124
145
|
case 'fill':
|
|
125
|
-
|
|
126
|
-
|
|
146
|
+
{
|
|
147
|
+
var _buttonColors = getButtonVariantTokenValues(euiThemeContext, color, 'filled');
|
|
148
|
+
var _refreshVariantStyles = isRefreshVariant && _interactionStyles(euiThemeContext, _buttonColors);
|
|
149
|
+
displaysColorsMap[display][color] = /*#__PURE__*/(0, _react.css)(euiButtonFillColor(euiThemeContext, color), "outline-color:", euiThemeContext.colorMode === 'DARK' && color === 'text' ? 'currentColor' : euiThemeContext.euiTheme.colors.fullShade, ";", _refreshVariantStyles, ";;label:displaysColorsMap-display-color;");
|
|
150
|
+
break;
|
|
151
|
+
}
|
|
127
152
|
case 'empty':
|
|
128
|
-
|
|
129
|
-
|
|
153
|
+
{
|
|
154
|
+
var _buttonColors2 = getButtonVariantTokenValues(euiThemeContext, color, 'empty');
|
|
155
|
+
var classicVariantStyles = !isRefreshVariant && "\n &:focus,\n &:active {\n background-color: ".concat(euiButtonEmptyColor(euiThemeContext, color).backgroundColor, ";\n }\n ");
|
|
156
|
+
var _refreshVariantStyles2 = isRefreshVariant && _interactionStyles(euiThemeContext, _buttonColors2, 'overlay');
|
|
157
|
+
displaysColorsMap[display][color] = /*#__PURE__*/(0, _react.css)("color:", euiButtonEmptyColor(euiThemeContext, color).color, ";", classicVariantStyles, " ", _refreshVariantStyles2, ";;label:displaysColorsMap-display-color;");
|
|
158
|
+
break;
|
|
159
|
+
}
|
|
130
160
|
}
|
|
131
161
|
|
|
132
162
|
// Tweak auto-generated Emotion label/className output
|
|
@@ -145,9 +175,10 @@ var useEuiButtonFocusCSS = exports.useEuiButtonFocusCSS = function useEuiButtonF
|
|
|
145
175
|
return (0, _services.useEuiMemoizedStyles)(euiButtonFocusCSS);
|
|
146
176
|
};
|
|
147
177
|
var euiButtonFocusAnimation = (0, _react.keyframes)(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n 50% {\n transform: translateY(1px);\n }\n"])));
|
|
148
|
-
var euiButtonFocusCSS = function euiButtonFocusCSS(
|
|
149
|
-
var euiTheme =
|
|
150
|
-
var
|
|
178
|
+
var euiButtonFocusCSS = function euiButtonFocusCSS(euiThemeContext) {
|
|
179
|
+
var euiTheme = euiThemeContext.euiTheme;
|
|
180
|
+
var isRefreshVariant = (0, _services.isEuiThemeRefreshVariant)(euiThemeContext, 'buttonVariant');
|
|
181
|
+
var focusCSS = isRefreshVariant ? /*#__PURE__*/(0, _react.css)(";label:focusCSS;") : /*#__PURE__*/(0, _react.css)(_euiThemeCommon.euiCanAnimate, "{transition:transform ", euiTheme.animation.normal, " ease-in-out,background-color ", euiTheme.animation.normal, " ease-in-out;&:hover:not(:disabled){transform:translateY(-1px);}&:focus{animation:", euiButtonFocusAnimation, " ", euiTheme.animation.normal, " ", euiTheme.animation.bounce, ";}&:active:not(:disabled){transform:translateY(1px);}};label:focusCSS;");
|
|
151
182
|
// Remove the auto-generated label.
|
|
152
183
|
// We could typically avoid a label by using a plain string `` instead of css``,
|
|
153
184
|
// but we need css`` for keyframes`` to work for the focus animation
|
|
@@ -159,27 +190,63 @@ var euiButtonFocusCSS = function euiButtonFocusCSS(_ref) {
|
|
|
159
190
|
* Map of `size` props to various sizings/scales
|
|
160
191
|
* that should remain consistent across all buttons
|
|
161
192
|
*/
|
|
162
|
-
var euiButtonSizeMap = exports.euiButtonSizeMap = function euiButtonSizeMap(
|
|
163
|
-
var euiTheme =
|
|
193
|
+
var euiButtonSizeMap = exports.euiButtonSizeMap = function euiButtonSizeMap(euiThemeContext) {
|
|
194
|
+
var euiTheme = euiThemeContext.euiTheme;
|
|
195
|
+
var isRefreshVariant = (0, _services.isEuiThemeRefreshVariant)(euiThemeContext, 'buttonVariant');
|
|
164
196
|
return {
|
|
165
197
|
xs: {
|
|
198
|
+
minWidth: euiTheme.base * (isRefreshVariant ? 6 : 7),
|
|
166
199
|
height: euiTheme.size.l,
|
|
167
200
|
radius: euiTheme.border.radius.small,
|
|
168
201
|
fontScale: 'xs'
|
|
169
202
|
},
|
|
170
203
|
s: {
|
|
204
|
+
minWidth: euiTheme.base * (isRefreshVariant ? 6 : 7),
|
|
171
205
|
height: euiTheme.size.xl,
|
|
172
206
|
radius: euiTheme.border.radius.small,
|
|
173
207
|
fontScale: 's'
|
|
174
208
|
},
|
|
175
209
|
m: {
|
|
210
|
+
minWidth: euiTheme.base * 7,
|
|
176
211
|
height: euiTheme.size.xxl,
|
|
177
|
-
radius: euiTheme.border.radius.medium,
|
|
212
|
+
radius: isRefreshVariant ? euiTheme.border.radius.small : euiTheme.border.radius.medium,
|
|
178
213
|
fontScale: 's'
|
|
179
214
|
}
|
|
180
215
|
};
|
|
181
216
|
};
|
|
182
217
|
|
|
218
|
+
/**
|
|
219
|
+
* internal styles util for applying button background color on hover
|
|
220
|
+
*/
|
|
221
|
+
var _interactionStyles = function _interactionStyles(euiThemeContext, buttonColors) {
|
|
222
|
+
var type = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'fill';
|
|
223
|
+
var isRefreshVariant = (0, _services.isEuiThemeRefreshVariant)(euiThemeContext, 'buttonVariant');
|
|
224
|
+
if (!isRefreshVariant) return "";
|
|
225
|
+
var baseStyles = function baseStyles() {
|
|
226
|
+
// button hover is applied as pseudo element with a transparent background-color
|
|
227
|
+
if (type === 'overlay') {
|
|
228
|
+
return "\n position: relative;\n overflow: hidden;\n\n &:hover:not(:disabled) {\n &::before {\n content: '';\n position: absolute;\n /* should stay under the content */\n z-index: 0;\n inset: 0;\n background-color: ".concat(buttonColors.backgroundHover, ";\n pointer-events: none;\n }\n }\n\n &:active:not(:disabled) {\n &::before {\n ").concat((0, _functions.logicalCSS)('width', '100%'), "\n ").concat((0, _functions.logicalCSS)('height', '100%'), "\n\n content: '';\n position: absolute;\n inset: 0;\n background-color: ").concat(buttonColors.backgroundActive, ";\n }\n }\n ");
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
// button hover is applied as opaque color
|
|
232
|
+
return "\n &:hover:not(:disabled) {\n background-color: ".concat(buttonColors.backgroundHover, ";\n }\n\n &:active:not(:disabled) {\n background-color: ").concat(buttonColors.backgroundActive, ";\n }\n ");
|
|
233
|
+
};
|
|
234
|
+
return " \n ".concat((0, _functions.highContrastModeStyles)(euiThemeContext, {
|
|
235
|
+
none: baseStyles(),
|
|
236
|
+
forced: "\n position: relative;\n overflow: hidden;\n\n ".concat(highContrastHoverIndicatorStyles(euiThemeContext), "\n ")
|
|
237
|
+
}), "\n ");
|
|
238
|
+
};
|
|
239
|
+
|
|
240
|
+
/**
|
|
241
|
+
* creates a bottom border on hover/focus to ensure a visible change as forced mode removed background colors
|
|
242
|
+
*/
|
|
243
|
+
var highContrastHoverIndicatorStyles = exports.highContrastHoverIndicatorStyles = function highContrastHoverIndicatorStyles(_ref2) {
|
|
244
|
+
var euiTheme = _ref2.euiTheme;
|
|
245
|
+
return "\n &:hover:not(:disabled) {\n transition: none;\n\n /* using pseudo border to be able to control the color */\n &::after {\n content: '';\n position: absolute;\n inset: ".concat(euiTheme.border.width.thin, ";\n border: ").concat(euiTheme.border.width.thick, " solid var(--highContrastHoverIndicatorColor, ").concat(euiTheme.border.color, ");\n border-radius: ").concat((0, _euiThemeCommon.mathWithUnits)(euiTheme.border.radius.small, function (x) {
|
|
246
|
+
return x / 2;
|
|
247
|
+
}), ";\n background-color: transparent;\n pointer-events: none;\n }\n }\n");
|
|
248
|
+
};
|
|
249
|
+
|
|
183
250
|
/**
|
|
184
251
|
* Internal util for high contrast button borders
|
|
185
252
|
*/
|
|
@@ -3,6 +3,35 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
+
var _exportNames = {
|
|
7
|
+
EuiSystemContext: true,
|
|
8
|
+
EuiThemeContext: true,
|
|
9
|
+
EuiNestedThemeContext: true,
|
|
10
|
+
EuiModificationsContext: true,
|
|
11
|
+
EuiColorModeContext: true,
|
|
12
|
+
EuiHighContrastModeContext: true,
|
|
13
|
+
useEuiTheme: true,
|
|
14
|
+
withEuiTheme: true,
|
|
15
|
+
RenderWithEuiTheme: true,
|
|
16
|
+
useEuiThemeCSSVariables: true,
|
|
17
|
+
useIsDarkMode: true,
|
|
18
|
+
EuiThemeProvider: true,
|
|
19
|
+
useEuiMemoizedStyles: true,
|
|
20
|
+
withEuiStylesMemoizer: true,
|
|
21
|
+
RenderWithEuiStylesMemoizer: true,
|
|
22
|
+
getEuiDevProviderWarning: true,
|
|
23
|
+
setEuiDevProviderWarning: true,
|
|
24
|
+
buildTheme: true,
|
|
25
|
+
computed: true,
|
|
26
|
+
isInverseColorMode: true,
|
|
27
|
+
getColorMode: true,
|
|
28
|
+
getComputed: true,
|
|
29
|
+
getOn: true,
|
|
30
|
+
mergeDeep: true,
|
|
31
|
+
setOn: true,
|
|
32
|
+
Computed: true,
|
|
33
|
+
COLOR_MODES_STANDARD: true
|
|
34
|
+
};
|
|
6
35
|
Object.defineProperty(exports, "COLOR_MODES_STANDARD", {
|
|
7
36
|
enumerable: true,
|
|
8
37
|
get: function get() {
|
|
@@ -171,4 +200,16 @@ var _provider = require("./provider");
|
|
|
171
200
|
var _style_memoization = require("./style_memoization");
|
|
172
201
|
var _warning = require("./warning");
|
|
173
202
|
var _utils = require("./utils");
|
|
174
|
-
var _types = require("./types");
|
|
203
|
+
var _types = require("./types");
|
|
204
|
+
var _theme_variant = require("./theme_variant");
|
|
205
|
+
Object.keys(_theme_variant).forEach(function (key) {
|
|
206
|
+
if (key === "default" || key === "__esModule") return;
|
|
207
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
208
|
+
if (key in exports && exports[key] === _theme_variant[key]) return;
|
|
209
|
+
Object.defineProperty(exports, key, {
|
|
210
|
+
enumerable: true,
|
|
211
|
+
get: function get() {
|
|
212
|
+
return _theme_variant[key];
|
|
213
|
+
}
|
|
214
|
+
});
|
|
215
|
+
});
|
|
@@ -148,9 +148,35 @@ var EuiThemeProvider = exports.EuiThemeProvider = function EuiThemeProvider(_ref
|
|
|
148
148
|
}, [highContrastMode]);
|
|
149
149
|
(0, _react2.useEffect)(function () {
|
|
150
150
|
if (!isParentTheme.current) {
|
|
151
|
-
|
|
151
|
+
/* Enables recomputation of component colors when flags are overridden on the provider
|
|
152
|
+
by adding the respective key to modifications to trigger a recomputation. */
|
|
153
|
+
// TODO: remove once visual refresh is completed and flags are obsolete
|
|
154
|
+
var flagsToRecompute = [{
|
|
155
|
+
flag: 'buttonVariant',
|
|
156
|
+
componentKey: 'buttons'
|
|
157
|
+
}];
|
|
158
|
+
var keys = {};
|
|
159
|
+
var forceRecomputeComponents = flagsToRecompute.some(function (item) {
|
|
160
|
+
var _modifications$flags, _modifications$compon;
|
|
161
|
+
if (Object.keys((_modifications$flags = modifications.flags) !== null && _modifications$flags !== void 0 ? _modifications$flags : {}).includes(item.flag) && !Object.keys((_modifications$compon = modifications.components) !== null && _modifications$compon !== void 0 ? _modifications$compon : {}).includes(item.componentKey)) {
|
|
162
|
+
keys[item.componentKey] = {
|
|
163
|
+
LIGHT: {},
|
|
164
|
+
DARK: {}
|
|
165
|
+
};
|
|
166
|
+
return true;
|
|
167
|
+
}
|
|
168
|
+
return false;
|
|
169
|
+
});
|
|
170
|
+
var componentModifications = forceRecomputeComponents ? {
|
|
171
|
+
components: keys
|
|
172
|
+
} : {};
|
|
173
|
+
|
|
174
|
+
// force recomputing of color & component tokens based on flag changes
|
|
175
|
+
var enhancedModifications = _objectSpread(_objectSpread({}, modificationsWithHighContrast), componentModifications);
|
|
176
|
+
var rebuiltTheme = (0, _utils.getComputed)(system, (0, _utils.buildTheme)(enhancedModifications, "_".concat(system.key)), colorMode, highContrastMode);
|
|
177
|
+
setTheme(rebuiltTheme);
|
|
152
178
|
}
|
|
153
|
-
}, [colorMode, highContrastMode, system, modificationsWithHighContrast]);
|
|
179
|
+
}, [colorMode, highContrastMode, system, modificationsWithHighContrast, modifications]);
|
|
154
180
|
var _useState9 = (0, _react2.useState)(),
|
|
155
181
|
_useState10 = _slicedToArray(_useState9, 2),
|
|
156
182
|
themeCSSVariables = _useState10[0],
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.useEuiThemeRefreshVariant = exports.isEuiThemeRefreshVariant = void 0;
|
|
7
|
+
var _hooks = require("./hooks");
|
|
8
|
+
/*
|
|
9
|
+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
10
|
+
* or more contributor license agreements. Licensed under the Elastic License
|
|
11
|
+
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
|
12
|
+
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
13
|
+
* Side Public License, v 1.
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
var isEuiThemeRefreshVariant = exports.isEuiThemeRefreshVariant = function isEuiThemeRefreshVariant(_ref, flag) {
|
|
17
|
+
var euiTheme = _ref.euiTheme;
|
|
18
|
+
return euiTheme.flags[flag] === 'refresh';
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Util to retrieve visual variant for UI elements
|
|
23
|
+
* Note: Temporary only - will be removed once the visual refresh is completed.
|
|
24
|
+
*/
|
|
25
|
+
var useEuiThemeRefreshVariant = exports.useEuiThemeRefreshVariant = function useEuiThemeRefreshVariant(flag) {
|
|
26
|
+
var euiThemeContext = (0, _hooks.useEuiTheme)();
|
|
27
|
+
return isEuiThemeRefreshVariant(euiThemeContext, flag);
|
|
28
|
+
};
|