@elastic/eui 102.0.0 → 102.1.0-snapshot.1746441787383
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/accessibility/skip_link/skip_link.js +7 -0
- package/es/components/badge/color_utils.js +1 -3
- package/es/components/badge/notification_badge/badge_notification.styles.js +6 -1
- package/es/components/breadcrumbs/_breadcrumb_content.styles.js +6 -3
- package/es/components/button/button.js +7 -0
- 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.js +7 -0
- package/es/components/button/button_empty/button_empty.styles.js +9 -12
- package/es/components/button/button_group/button_group.js +5 -0
- 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 +11 -2
- package/es/components/card/card.js +7 -0
- package/es/components/card/card_select/card_select.js +7 -0
- package/es/components/collapsible_nav_beta/_kibana_solution/collapsible_nav_kibana_solution.js +7 -0
- package/es/components/color_picker/color_picker.js +13 -8
- package/es/components/color_picker/hue.js +27 -6
- package/es/components/color_picker/hue.styles.js +3 -2
- package/es/components/color_picker/saturation.js +16 -11
- package/es/components/color_picker/saturation.styles.js +2 -1
- package/es/components/datagrid/body/cell/data_grid_cell.js +7 -0
- package/es/components/datagrid/body/cell/data_grid_cell_actions.js +2 -2
- package/es/components/datagrid/body/cell/data_grid_cell_actions.styles.js +1 -1
- package/es/components/datagrid/body/data_grid_body.js +7 -0
- package/es/components/datagrid/body/data_grid_body_custom.js +7 -0
- package/es/components/datagrid/body/data_grid_body_virtualized.js +7 -0
- package/es/components/datagrid/body/header/data_grid_header_cell.js +7 -0
- package/es/components/datagrid/controls/column_sorting.js +7 -0
- package/es/components/datagrid/controls/data_grid_toolbar_control.js +18 -1
- package/es/components/datagrid/utils/in_memory.js +7 -0
- package/es/components/date_picker/auto_refresh/auto_refresh.js +7 -0
- package/es/components/filter_group/filter_button.js +98 -24
- 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/header/header_links/header_link.js +7 -0
- package/es/components/header/header_section/header_section_item_button.js +7 -0
- package/es/components/list_group/list_group.js +7 -0
- package/es/components/list_group/list_group_item.js +7 -0
- package/es/components/list_group/list_group_item_extra_action.js +7 -0
- package/es/components/list_group/pinnable_list_group/pinnable_list_group.js +7 -0
- package/es/components/pagination/pagination_button.js +7 -0
- 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/components/table/table_header_cell.js +30 -12
- package/es/components/tool_tip/tool_tip.js +4 -1
- package/es/global_styling/mixins/_button.js +108 -31
- package/es/global_styling/mixins/_color.js +9 -2
- 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/test/index.d.ts +2 -1
- 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/eui.d.ts +919 -701
- package/lib/components/accessibility/skip_link/skip_link.js +7 -0
- package/lib/components/badge/color_utils.js +1 -3
- package/lib/components/badge/notification_badge/badge_notification.styles.js +6 -1
- package/lib/components/breadcrumbs/_breadcrumb_content.styles.js +5 -2
- package/lib/components/button/button.js +7 -0
- 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.js +7 -0
- package/lib/components/button/button_empty/button_empty.styles.js +10 -11
- package/lib/components/button/button_group/button_group.js +5 -0
- 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 +10 -1
- package/lib/components/card/card.js +7 -0
- package/lib/components/card/card_select/card_select.js +7 -0
- package/lib/components/collapsible_nav_beta/_kibana_solution/collapsible_nav_kibana_solution.js +7 -0
- package/lib/components/color_picker/color_picker.js +13 -8
- package/lib/components/color_picker/hue.js +26 -5
- package/lib/components/color_picker/hue.styles.js +3 -2
- package/lib/components/color_picker/saturation.js +16 -11
- package/lib/components/color_picker/saturation.styles.js +2 -1
- package/lib/components/datagrid/body/cell/data_grid_cell.js +7 -0
- package/lib/components/datagrid/body/cell/data_grid_cell_actions.js +2 -2
- package/lib/components/datagrid/body/cell/data_grid_cell_actions.styles.js +1 -1
- package/lib/components/datagrid/body/data_grid_body.js +7 -0
- package/lib/components/datagrid/body/data_grid_body_custom.js +7 -0
- package/lib/components/datagrid/body/data_grid_body_virtualized.js +7 -0
- package/lib/components/datagrid/body/header/data_grid_header_cell.js +7 -0
- package/lib/components/datagrid/controls/column_sorting.js +7 -0
- package/lib/components/datagrid/controls/data_grid_toolbar_control.js +18 -1
- package/lib/components/datagrid/utils/in_memory.js +7 -0
- package/lib/components/date_picker/auto_refresh/auto_refresh.js +7 -0
- package/lib/components/filter_group/filter_button.js +96 -22
- 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/header/header_links/header_link.js +7 -0
- package/lib/components/header/header_section/header_section_item_button.js +7 -0
- package/lib/components/list_group/list_group.js +7 -0
- package/lib/components/list_group/list_group_item.js +7 -0
- package/lib/components/list_group/list_group_item_extra_action.js +7 -0
- package/lib/components/list_group/pinnable_list_group/pinnable_list_group.js +7 -0
- package/lib/components/pagination/pagination_button.js +7 -0
- 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/components/table/table_header_cell.js +28 -10
- package/lib/components/tool_tip/tool_tip.js +4 -1
- package/lib/global_styling/mixins/_button.js +106 -30
- package/lib/global_styling/mixins/_color.js +11 -4
- package/lib/services/theme/index.js +41 -1
- package/lib/services/theme/provider.js +28 -2
- package/lib/services/theme/theme_variant.js +28 -0
- package/lib/test/index.d.ts +2 -1
- 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/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/color_picker/color_picker.js +13 -8
- package/optimize/es/components/color_picker/hue.js +22 -6
- package/optimize/es/components/color_picker/hue.styles.js +3 -2
- package/optimize/es/components/color_picker/saturation.js +16 -11
- package/optimize/es/components/color_picker/saturation.styles.js +2 -1
- package/optimize/es/components/datagrid/body/cell/data_grid_cell_actions.js +2 -2
- package/optimize/es/components/datagrid/body/cell/data_grid_cell_actions.styles.js +1 -1
- package/optimize/es/components/datagrid/controls/data_grid_toolbar_control.js +11 -1
- 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/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/components/table/table_header_cell.js +26 -11
- package/optimize/es/components/tool_tip/tool_tip.js +4 -1
- package/optimize/es/global_styling/mixins/_button.js +103 -31
- package/optimize/es/global_styling/mixins/_color.js +4 -2
- 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/test/index.d.ts +2 -1
- 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/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/color_picker/color_picker.js +13 -8
- package/optimize/lib/components/color_picker/hue.js +21 -5
- package/optimize/lib/components/color_picker/hue.styles.js +3 -2
- package/optimize/lib/components/color_picker/saturation.js +16 -11
- package/optimize/lib/components/color_picker/saturation.styles.js +2 -1
- package/optimize/lib/components/datagrid/body/cell/data_grid_cell_actions.js +2 -2
- package/optimize/lib/components/datagrid/body/cell/data_grid_cell_actions.styles.js +1 -1
- package/optimize/lib/components/datagrid/controls/data_grid_toolbar_control.js +11 -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/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/components/table/table_header_cell.js +25 -11
- package/optimize/lib/components/tool_tip/tool_tip.js +4 -1
- package/optimize/lib/global_styling/mixins/_button.js +101 -30
- package/optimize/lib/global_styling/mixins/_color.js +4 -2
- package/optimize/lib/services/theme/index.js +41 -1
- package/optimize/lib/services/theme/provider.js +28 -2
- package/optimize/lib/services/theme/theme_variant.js +28 -0
- package/optimize/lib/test/index.d.ts +2 -1
- 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/package.json +7 -6
- package/test-env/components/accessibility/skip_link/skip_link.js +7 -0
- 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/breadcrumbs/_breadcrumb_content.styles.js +5 -2
- package/test-env/components/button/button.js +7 -0
- 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.js +7 -0
- package/test-env/components/button/button_empty/button_empty.styles.js +10 -11
- package/test-env/components/button/button_group/button_group.js +5 -0
- 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 +10 -1
- package/test-env/components/card/card.js +7 -0
- package/test-env/components/card/card_select/card_select.js +7 -0
- package/test-env/components/collapsible_nav_beta/_kibana_solution/collapsible_nav_kibana_solution.js +7 -0
- package/test-env/components/color_picker/color_picker.js +13 -8
- package/test-env/components/color_picker/hue.js +21 -5
- package/test-env/components/color_picker/hue.styles.js +3 -2
- package/test-env/components/color_picker/saturation.js +16 -11
- package/test-env/components/color_picker/saturation.styles.js +2 -1
- package/test-env/components/datagrid/body/cell/data_grid_cell.js +7 -0
- package/test-env/components/datagrid/body/cell/data_grid_cell_actions.js +2 -2
- package/test-env/components/datagrid/body/cell/data_grid_cell_actions.styles.js +1 -1
- package/test-env/components/datagrid/body/data_grid_body.js +7 -0
- package/test-env/components/datagrid/body/data_grid_body_custom.js +7 -0
- package/test-env/components/datagrid/body/data_grid_body_virtualized.js +7 -0
- package/test-env/components/datagrid/body/header/data_grid_header_cell.js +7 -0
- package/test-env/components/datagrid/controls/column_sorting.js +7 -0
- package/test-env/components/datagrid/controls/data_grid_toolbar_control.js +18 -1
- package/test-env/components/datagrid/utils/in_memory.js +7 -0
- package/test-env/components/date_picker/auto_refresh/auto_refresh.js +7 -0
- package/test-env/components/filter_group/filter_button.js +96 -22
- 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/header/header_links/header_link.js +7 -0
- package/test-env/components/header/header_section/header_section_item_button.js +7 -0
- package/test-env/components/list_group/list_group.js +7 -0
- package/test-env/components/list_group/list_group_item.js +7 -0
- package/test-env/components/list_group/list_group_item_extra_action.js +7 -0
- package/test-env/components/list_group/pinnable_list_group/pinnable_list_group.js +7 -0
- package/test-env/components/pagination/pagination_button.js +7 -0
- 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/components/table/table_header_cell.js +26 -12
- package/test-env/components/tool_tip/tool_tip.js +4 -1
- package/test-env/global_styling/mixins/_button.js +101 -30
- package/test-env/global_styling/mixins/_color.js +4 -2
- package/test-env/services/theme/index.js +41 -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
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
|
|
2
|
+
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
2
3
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
4
|
var _templateObject;
|
|
4
5
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
@@ -12,10 +13,34 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
12
13
|
*/
|
|
13
14
|
|
|
14
15
|
import { css, keyframes } from '@emotion/react';
|
|
15
|
-
import { getTokenName, euiCanAnimate } from '@elastic/eui-theme-common';
|
|
16
|
-
import { makeHighContrastColor, useEuiMemoizedStyles } from '../../services';
|
|
17
|
-
|
|
16
|
+
import { getTokenName, euiCanAnimate, mathWithUnits } from '@elastic/eui-theme-common';
|
|
17
|
+
import { makeHighContrastColor, useEuiMemoizedStyles, isEuiThemeRefreshVariant } from '../../services';
|
|
18
|
+
import { highContrastModeStyles, logicalCSS } from '../functions';
|
|
19
|
+
|
|
20
|
+
/** Tentative usage; these exist only to be used as button directly when used within other components */
|
|
21
|
+
export var SEVERITY_COLORS = ['neutral', 'risk'];
|
|
22
|
+
export var BUTTON_COLORS = ['text', 'accent', 'accentSecondary', 'primary', 'success', 'warning', 'danger'];
|
|
23
|
+
export var EXTENDED_BUTTON_COLORS = [].concat(BUTTON_COLORS, SEVERITY_COLORS);
|
|
18
24
|
export var BUTTON_DISPLAYS = ['base', 'fill', 'empty'];
|
|
25
|
+
var getButtonVariantTokenValues = function getButtonVariantTokenValues(_ref, color, variant) {
|
|
26
|
+
var euiTheme = _ref.euiTheme,
|
|
27
|
+
highContrastMode = _ref.highContrastMode;
|
|
28
|
+
var backgroundTokenBase = variant === 'base' ? 'background' : "background".concat(variant.charAt(0).toUpperCase() + variant.slice(1));
|
|
29
|
+
var textTokenBase = variant === 'filled' ? 'textColorFilled' : 'textColor';
|
|
30
|
+
var backgroundTokenName = getTokenName(backgroundTokenBase, color);
|
|
31
|
+
var textTokenName = getTokenName(textTokenBase, color);
|
|
32
|
+
var backgroundHoverTokenName = getTokenName(backgroundTokenBase, color, 'hover');
|
|
33
|
+
var backgroundActiveTokenName = getTokenName(backgroundTokenBase, color, 'active');
|
|
34
|
+
var highContrastForeground = ['warning', 'neutral', 'risk'].includes(color) ? euiTheme.colors.ink : color === 'disabled' ? euiTheme.components.buttons[textTokenName] : euiTheme.colors.textInverse;
|
|
35
|
+
var foreground = variant === 'filled' ? highContrastMode ? highContrastForeground : euiTheme.components.buttons[textTokenName] : euiTheme.components.buttons[textTokenName];
|
|
36
|
+
return {
|
|
37
|
+
color: foreground,
|
|
38
|
+
background: euiTheme.components.buttons[backgroundTokenName],
|
|
39
|
+
backgroundHover: euiTheme.components.buttons[backgroundHoverTokenName],
|
|
40
|
+
backgroundActive: euiTheme.components.buttons[backgroundActiveTokenName]
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
|
|
19
44
|
/**
|
|
20
45
|
* Creates the `base` version of button styles with proper text contrast.
|
|
21
46
|
* @param euiThemeContext
|
|
@@ -23,11 +48,9 @@ export var BUTTON_DISPLAYS = ['base', 'fill', 'empty'];
|
|
|
23
48
|
* @returns Style object `{ backgroundColor, color }`
|
|
24
49
|
*/
|
|
25
50
|
export var euiButtonColor = function euiButtonColor(euiThemeContext, color) {
|
|
26
|
-
var
|
|
27
|
-
var
|
|
28
|
-
var
|
|
29
|
-
var foreground = euiTheme.components.buttons[textTokenName];
|
|
30
|
-
var background = euiTheme.components.buttons[backgroundTokenName];
|
|
51
|
+
var buttonColors = getButtonVariantTokenValues(euiThemeContext, color, 'base');
|
|
52
|
+
var foreground = buttonColors.color;
|
|
53
|
+
var background = buttonColors.background;
|
|
31
54
|
return _objectSpread({
|
|
32
55
|
color: background === 'transparent' || color === 'disabled' ? foreground : makeHighContrastColor(foreground)(background),
|
|
33
56
|
backgroundColor: background
|
|
@@ -41,13 +64,9 @@ export var euiButtonColor = function euiButtonColor(euiThemeContext, color) {
|
|
|
41
64
|
* @returns Style object `{ backgroundColor, color }`
|
|
42
65
|
*/
|
|
43
66
|
export var euiButtonFillColor = function euiButtonFillColor(euiThemeContext, color) {
|
|
44
|
-
var
|
|
45
|
-
|
|
46
|
-
var
|
|
47
|
-
var textColorTokenName = getTokenName('textColorFilled', color);
|
|
48
|
-
var highContrastForeground = ['warning', 'neutral', 'risk'].includes(color) ? euiTheme.colors.ink : color === 'disabled' ? euiTheme.components.buttons[textColorTokenName] : euiTheme.colors.textInverse;
|
|
49
|
-
var foreground = highContrastMode ? highContrastForeground : euiTheme.components.buttons[textColorTokenName];
|
|
50
|
-
var background = euiTheme.components.buttons[backgroundTokenName];
|
|
67
|
+
var buttonColors = getButtonVariantTokenValues(euiThemeContext, color, 'filled');
|
|
68
|
+
var foreground = buttonColors.color;
|
|
69
|
+
var background = buttonColors.background;
|
|
51
70
|
return _objectSpread({
|
|
52
71
|
color: foreground,
|
|
53
72
|
backgroundColor: background
|
|
@@ -71,9 +90,9 @@ export var euiButtonEmptyColor = function euiButtonEmptyColor(euiThemeContext, c
|
|
|
71
90
|
break;
|
|
72
91
|
default:
|
|
73
92
|
{
|
|
74
|
-
var
|
|
93
|
+
var buttonColors = getButtonVariantTokenValues(euiThemeContext, color, 'empty');
|
|
75
94
|
foreground = euiButtonColor(euiThemeContext, color).color;
|
|
76
|
-
background =
|
|
95
|
+
background = buttonColors.backgroundHover;
|
|
77
96
|
break;
|
|
78
97
|
}
|
|
79
98
|
}
|
|
@@ -86,7 +105,7 @@ export var euiButtonEmptyColor = function euiButtonEmptyColor(euiThemeContext, c
|
|
|
86
105
|
/**
|
|
87
106
|
* Given the button display type, returns the Emotion based color keys.
|
|
88
107
|
* @param options Button display type
|
|
89
|
-
* @returns An object of `
|
|
108
|
+
* @returns An object of `_EuiExtendedButtonColor` keys including `disabled`
|
|
90
109
|
*/
|
|
91
110
|
export var useEuiButtonColorCSS = function useEuiButtonColorCSS() {
|
|
92
111
|
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
@@ -96,21 +115,37 @@ export var useEuiButtonColorCSS = function useEuiButtonColorCSS() {
|
|
|
96
115
|
return colorsDisplaysMap[display];
|
|
97
116
|
};
|
|
98
117
|
var euiButtonDisplaysColors = function euiButtonDisplaysColors(euiThemeContext) {
|
|
99
|
-
var
|
|
118
|
+
var euiTheme = euiThemeContext.euiTheme;
|
|
119
|
+
var isRefreshVariant = isEuiThemeRefreshVariant(euiThemeContext, 'buttonVariant');
|
|
120
|
+
var COLORS = [].concat(_toConsumableArray(EXTENDED_BUTTON_COLORS), ['disabled']);
|
|
100
121
|
var displaysColorsMap = {};
|
|
101
122
|
BUTTON_DISPLAYS.forEach(function (display) {
|
|
102
123
|
displaysColorsMap[display] = {};
|
|
103
124
|
COLORS.forEach(function (color) {
|
|
104
125
|
switch (display) {
|
|
105
126
|
case 'base':
|
|
106
|
-
|
|
107
|
-
|
|
127
|
+
{
|
|
128
|
+
var buttonColors = getButtonVariantTokenValues(euiThemeContext, color, 'base');
|
|
129
|
+
var borderStyle = color === 'text' && "\n border: ".concat(euiTheme.border.width.thin, " solid ").concat(euiTheme.colors.borderBasePlain, ";\n ");
|
|
130
|
+
var refreshVariantStyles = isRefreshVariant && "\n ".concat(_interactionStyles(euiThemeContext, buttonColors, 'overlay'), "\n ").concat(borderStyle, "\n ");
|
|
131
|
+
displaysColorsMap[display][color] = /*#__PURE__*/css(euiButtonColor(euiThemeContext, color), " ", refreshVariantStyles, ";;label:displaysColorsMap-display-color;");
|
|
132
|
+
break;
|
|
133
|
+
}
|
|
108
134
|
case 'fill':
|
|
109
|
-
|
|
110
|
-
|
|
135
|
+
{
|
|
136
|
+
var _buttonColors = getButtonVariantTokenValues(euiThemeContext, color, 'filled');
|
|
137
|
+
var _refreshVariantStyles = isRefreshVariant && _interactionStyles(euiThemeContext, _buttonColors);
|
|
138
|
+
displaysColorsMap[display][color] = /*#__PURE__*/css(euiButtonFillColor(euiThemeContext, color), "outline-color:", euiThemeContext.colorMode === 'DARK' && color === 'text' ? 'currentColor' : euiThemeContext.euiTheme.colors.fullShade, ";", _refreshVariantStyles, ";;label:displaysColorsMap-display-color;");
|
|
139
|
+
break;
|
|
140
|
+
}
|
|
111
141
|
case 'empty':
|
|
112
|
-
|
|
113
|
-
|
|
142
|
+
{
|
|
143
|
+
var _buttonColors2 = getButtonVariantTokenValues(euiThemeContext, color, 'empty');
|
|
144
|
+
var classicVariantStyles = !isRefreshVariant && "\n &:focus,\n &:active {\n background-color: ".concat(euiButtonEmptyColor(euiThemeContext, color).backgroundColor, ";\n }\n ");
|
|
145
|
+
var _refreshVariantStyles2 = isRefreshVariant && _interactionStyles(euiThemeContext, _buttonColors2, 'overlay');
|
|
146
|
+
displaysColorsMap[display][color] = /*#__PURE__*/css("color:", euiButtonEmptyColor(euiThemeContext, color).color, ";", classicVariantStyles, " ", _refreshVariantStyles2, ";;label:displaysColorsMap-display-color;");
|
|
147
|
+
break;
|
|
148
|
+
}
|
|
114
149
|
}
|
|
115
150
|
|
|
116
151
|
// Tweak auto-generated Emotion label/className output
|
|
@@ -129,9 +164,10 @@ export var useEuiButtonFocusCSS = function useEuiButtonFocusCSS() {
|
|
|
129
164
|
return useEuiMemoizedStyles(euiButtonFocusCSS);
|
|
130
165
|
};
|
|
131
166
|
var euiButtonFocusAnimation = keyframes(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n 50% {\n transform: translateY(1px);\n }\n"])));
|
|
132
|
-
var euiButtonFocusCSS = function euiButtonFocusCSS(
|
|
133
|
-
var euiTheme =
|
|
134
|
-
var
|
|
167
|
+
var euiButtonFocusCSS = function euiButtonFocusCSS(euiThemeContext) {
|
|
168
|
+
var euiTheme = euiThemeContext.euiTheme;
|
|
169
|
+
var isRefreshVariant = isEuiThemeRefreshVariant(euiThemeContext, 'buttonVariant');
|
|
170
|
+
var focusCSS = isRefreshVariant ? /*#__PURE__*/css(";label:focusCSS;") : /*#__PURE__*/css(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;");
|
|
135
171
|
// Remove the auto-generated label.
|
|
136
172
|
// We could typically avoid a label by using a plain string `` instead of css``,
|
|
137
173
|
// but we need css`` for keyframes`` to work for the focus animation
|
|
@@ -143,27 +179,63 @@ var euiButtonFocusCSS = function euiButtonFocusCSS(_ref) {
|
|
|
143
179
|
* Map of `size` props to various sizings/scales
|
|
144
180
|
* that should remain consistent across all buttons
|
|
145
181
|
*/
|
|
146
|
-
export var euiButtonSizeMap = function euiButtonSizeMap(
|
|
147
|
-
var euiTheme =
|
|
182
|
+
export var euiButtonSizeMap = function euiButtonSizeMap(euiThemeContext) {
|
|
183
|
+
var euiTheme = euiThemeContext.euiTheme;
|
|
184
|
+
var isRefreshVariant = isEuiThemeRefreshVariant(euiThemeContext, 'buttonVariant');
|
|
148
185
|
return {
|
|
149
186
|
xs: {
|
|
187
|
+
minWidth: euiTheme.base * (isRefreshVariant ? 6 : 7),
|
|
150
188
|
height: euiTheme.size.l,
|
|
151
189
|
radius: euiTheme.border.radius.small,
|
|
152
190
|
fontScale: 'xs'
|
|
153
191
|
},
|
|
154
192
|
s: {
|
|
193
|
+
minWidth: euiTheme.base * (isRefreshVariant ? 6 : 7),
|
|
155
194
|
height: euiTheme.size.xl,
|
|
156
195
|
radius: euiTheme.border.radius.small,
|
|
157
196
|
fontScale: 's'
|
|
158
197
|
},
|
|
159
198
|
m: {
|
|
199
|
+
minWidth: euiTheme.base * 7,
|
|
160
200
|
height: euiTheme.size.xxl,
|
|
161
|
-
radius: euiTheme.border.radius.medium,
|
|
201
|
+
radius: isRefreshVariant ? euiTheme.border.radius.small : euiTheme.border.radius.medium,
|
|
162
202
|
fontScale: 's'
|
|
163
203
|
}
|
|
164
204
|
};
|
|
165
205
|
};
|
|
166
206
|
|
|
207
|
+
/**
|
|
208
|
+
* internal styles util for applying button background color on hover
|
|
209
|
+
*/
|
|
210
|
+
var _interactionStyles = function _interactionStyles(euiThemeContext, buttonColors) {
|
|
211
|
+
var type = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'fill';
|
|
212
|
+
var isRefreshVariant = isEuiThemeRefreshVariant(euiThemeContext, 'buttonVariant');
|
|
213
|
+
if (!isRefreshVariant) return "";
|
|
214
|
+
var baseStyles = function baseStyles() {
|
|
215
|
+
// button hover is applied as pseudo element with a transparent background-color
|
|
216
|
+
if (type === 'overlay') {
|
|
217
|
+
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(logicalCSS('width', '100%'), "\n ").concat(logicalCSS('height', '100%'), "\n\n content: '';\n position: absolute;\n inset: 0;\n background-color: ").concat(buttonColors.backgroundActive, ";\n }\n }\n ");
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
// button hover is applied as opaque color
|
|
221
|
+
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 ");
|
|
222
|
+
};
|
|
223
|
+
return " \n ".concat(highContrastModeStyles(euiThemeContext, {
|
|
224
|
+
none: baseStyles(),
|
|
225
|
+
forced: "\n position: relative;\n overflow: hidden;\n\n ".concat(highContrastHoverIndicatorStyles(euiThemeContext), "\n ")
|
|
226
|
+
}), "\n ");
|
|
227
|
+
};
|
|
228
|
+
|
|
229
|
+
/**
|
|
230
|
+
* creates a bottom border on hover/focus to ensure a visible change as forced mode removed background colors
|
|
231
|
+
*/
|
|
232
|
+
export var highContrastHoverIndicatorStyles = function highContrastHoverIndicatorStyles(_ref2) {
|
|
233
|
+
var euiTheme = _ref2.euiTheme;
|
|
234
|
+
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(mathWithUnits(euiTheme.border.radius.small, function (x) {
|
|
235
|
+
return x / 2;
|
|
236
|
+
}), ";\n background-color: transparent;\n pointer-events: none;\n }\n }\n");
|
|
237
|
+
};
|
|
238
|
+
|
|
167
239
|
/**
|
|
168
240
|
* Internal util for high contrast button borders
|
|
169
241
|
*/
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
2
3
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
4
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
5
|
/*
|
|
@@ -10,9 +11,10 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
10
11
|
*/
|
|
11
12
|
|
|
12
13
|
import { css } from '@emotion/react';
|
|
13
|
-
import { useEuiMemoizedStyles } from '../../services';
|
|
14
14
|
import { getTokenName } from '@elastic/eui-theme-common';
|
|
15
|
-
|
|
15
|
+
import { useEuiMemoizedStyles } from '../../services';
|
|
16
|
+
import { SEVERITY_COLORS } from './_button';
|
|
17
|
+
export var BACKGROUND_COLORS = ['transparent', 'plain', 'subdued', 'highlighted', 'accent', 'accentSecondary', 'primary', 'success', 'warning', 'danger'].concat(_toConsumableArray(SEVERITY_COLORS));
|
|
16
18
|
/**
|
|
17
19
|
* @deprecated - use background tokens directly
|
|
18
20
|
* @returns A single background color with optional alpha transparency
|
|
@@ -12,4 +12,5 @@ export { EuiThemeProvider } from './provider';
|
|
|
12
12
|
export { useEuiMemoizedStyles, withEuiStylesMemoizer, RenderWithEuiStylesMemoizer } from './style_memoization';
|
|
13
13
|
export { getEuiDevProviderWarning, setEuiDevProviderWarning } from './warning';
|
|
14
14
|
export { buildTheme, computed, isInverseColorMode, getColorMode, getComputed, getOn, mergeDeep, setOn, Computed } from './utils';
|
|
15
|
-
export { COLOR_MODES_STANDARD } from './types';
|
|
15
|
+
export { COLOR_MODES_STANDARD } from './types';
|
|
16
|
+
export * from './theme_variant';
|
|
@@ -134,9 +134,35 @@ export var EuiThemeProvider = function EuiThemeProvider(_ref) {
|
|
|
134
134
|
}, [highContrastMode]);
|
|
135
135
|
useEffect(function () {
|
|
136
136
|
if (!isParentTheme.current) {
|
|
137
|
-
|
|
137
|
+
/* Enables recomputation of component colors when flags are overridden on the provider
|
|
138
|
+
by adding the respective key to modifications to trigger a recomputation. */
|
|
139
|
+
// TODO: remove once visual refresh is completed and flags are obsolete
|
|
140
|
+
var flagsToRecompute = [{
|
|
141
|
+
flag: 'buttonVariant',
|
|
142
|
+
componentKey: 'buttons'
|
|
143
|
+
}];
|
|
144
|
+
var keys = {};
|
|
145
|
+
var forceRecomputeComponents = flagsToRecompute.some(function (item) {
|
|
146
|
+
var _modifications$flags, _modifications$compon;
|
|
147
|
+
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)) {
|
|
148
|
+
keys[item.componentKey] = {
|
|
149
|
+
LIGHT: {},
|
|
150
|
+
DARK: {}
|
|
151
|
+
};
|
|
152
|
+
return true;
|
|
153
|
+
}
|
|
154
|
+
return false;
|
|
155
|
+
});
|
|
156
|
+
var componentModifications = forceRecomputeComponents ? {
|
|
157
|
+
components: keys
|
|
158
|
+
} : {};
|
|
159
|
+
|
|
160
|
+
// force recomputing of color & component tokens based on flag changes
|
|
161
|
+
var enhancedModifications = _objectSpread(_objectSpread({}, modificationsWithHighContrast), componentModifications);
|
|
162
|
+
var rebuiltTheme = getComputed(system, buildTheme(enhancedModifications, "_".concat(system.key)), colorMode, highContrastMode);
|
|
163
|
+
setTheme(rebuiltTheme);
|
|
138
164
|
}
|
|
139
|
-
}, [colorMode, highContrastMode, system, modificationsWithHighContrast]);
|
|
165
|
+
}, [colorMode, highContrastMode, system, modificationsWithHighContrast, modifications]);
|
|
140
166
|
var _useState9 = useState(),
|
|
141
167
|
_useState10 = _slicedToArray(_useState9, 2),
|
|
142
168
|
themeCSSVariables = _useState10[0],
|
|
@@ -0,0 +1,22 @@
|
|
|
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
|
+
|
|
9
|
+
import { useEuiTheme } from './hooks';
|
|
10
|
+
export var isEuiThemeRefreshVariant = function isEuiThemeRefreshVariant(_ref, flag) {
|
|
11
|
+
var euiTheme = _ref.euiTheme;
|
|
12
|
+
return euiTheme.flags[flag] === 'refresh';
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Util to retrieve visual variant for UI elements
|
|
17
|
+
* Note: Temporary only - will be removed once the visual refresh is completed.
|
|
18
|
+
*/
|
|
19
|
+
export var useEuiThemeRefreshVariant = function useEuiThemeRefreshVariant(flag) {
|
|
20
|
+
var euiThemeContext = useEuiTheme();
|
|
21
|
+
return isEuiThemeRefreshVariant(euiThemeContext, flag);
|
|
22
|
+
};
|
|
@@ -24,7 +24,8 @@ declare module '@elastic/eui/optimize/es/test/take_mounted_snapshot' {
|
|
|
24
24
|
|
|
25
25
|
}
|
|
26
26
|
declare module '@elastic/eui/optimize/es/test/find_test_subject' {
|
|
27
|
-
import { ReactWrapper, ShallowWrapper } from 'enzyme'; const MATCHERS: readonly ["=", "~=", "|=", "^=", "$=", "*="];
|
|
27
|
+
import { ReactWrapper, ShallowWrapper } from 'enzyme'; const MATCHERS: readonly ["=", "~=", "|=", "^=", "$=", "*="];
|
|
28
|
+
type FindTestSubject<T extends ShallowWrapper | ReactWrapper> = (mountedComponent: T, testSubjectSelector: string, matcher?: (typeof MATCHERS)[number]) => ReturnType<T['find']>;
|
|
28
29
|
export const findTestSubject: FindTestSubject<ShallowWrapper<any> | ReactWrapper<any>>;
|
|
29
30
|
export {};
|
|
30
31
|
|