@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
|
@@ -179,7 +179,10 @@ var EuiToolTip = exports.EuiToolTip = /*#__PURE__*/function (_Component) {
|
|
|
179
179
|
});
|
|
180
180
|
(0, _defineProperty2.default)(_this, "onEscapeKey", function (event) {
|
|
181
181
|
if (event.key === _services.keys.ESCAPE) {
|
|
182
|
-
|
|
182
|
+
// when the tooltip is only visual, we don't want it to add an additional key stop
|
|
183
|
+
if (!_this.props.disableScreenReaderOutput) {
|
|
184
|
+
if (_this.state.visible) event.stopPropagation();
|
|
185
|
+
}
|
|
183
186
|
_this.setState({
|
|
184
187
|
hasFocus: false
|
|
185
188
|
}); // Allows mousing over back into the tooltip to work correctly
|
|
@@ -4,12 +4,14 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.useEuiButtonFocusCSS = exports.useEuiButtonColorCSS = exports.euiButtonSizeMap = exports.euiButtonFillColor = exports.euiButtonEmptyColor = exports.euiButtonColor = exports.BUTTON_DISPLAYS = exports.BUTTON_COLORS = void 0;
|
|
7
|
+
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;
|
|
8
8
|
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
9
|
+
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
9
10
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
10
11
|
var _react = require("@emotion/react");
|
|
11
12
|
var _euiThemeCommon = require("@elastic/eui-theme-common");
|
|
12
13
|
var _services = require("../../services");
|
|
14
|
+
var _functions = require("../functions");
|
|
13
15
|
var _templateObject;
|
|
14
16
|
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; }
|
|
15
17
|
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) { (0, _defineProperty2.default)(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; } /*
|
|
@@ -19,8 +21,30 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
19
21
|
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
20
22
|
* Side Public License, v 1.
|
|
21
23
|
*/
|
|
22
|
-
|
|
24
|
+
/** Tentative usage; these exist only to be used as button directly when used within other components */
|
|
25
|
+
var SEVERITY_COLORS = exports.SEVERITY_COLORS = ['neutral', 'risk'];
|
|
26
|
+
var BUTTON_COLORS = exports.BUTTON_COLORS = ['text', 'accent', 'accentSecondary', 'primary', 'success', 'warning', 'danger'];
|
|
27
|
+
var EXTENDED_BUTTON_COLORS = exports.EXTENDED_BUTTON_COLORS = [].concat(BUTTON_COLORS, SEVERITY_COLORS);
|
|
23
28
|
var BUTTON_DISPLAYS = exports.BUTTON_DISPLAYS = ['base', 'fill', 'empty'];
|
|
29
|
+
var getButtonVariantTokenValues = function getButtonVariantTokenValues(_ref, color, variant) {
|
|
30
|
+
var euiTheme = _ref.euiTheme,
|
|
31
|
+
highContrastMode = _ref.highContrastMode;
|
|
32
|
+
var backgroundTokenBase = variant === 'base' ? 'background' : "background".concat(variant.charAt(0).toUpperCase() + variant.slice(1));
|
|
33
|
+
var textTokenBase = variant === 'filled' ? 'textColorFilled' : 'textColor';
|
|
34
|
+
var backgroundTokenName = (0, _euiThemeCommon.getTokenName)(backgroundTokenBase, color);
|
|
35
|
+
var textTokenName = (0, _euiThemeCommon.getTokenName)(textTokenBase, color);
|
|
36
|
+
var backgroundHoverTokenName = (0, _euiThemeCommon.getTokenName)(backgroundTokenBase, color, 'hover');
|
|
37
|
+
var backgroundActiveTokenName = (0, _euiThemeCommon.getTokenName)(backgroundTokenBase, color, 'active');
|
|
38
|
+
var highContrastForeground = ['warning', 'neutral', 'risk'].includes(color) ? euiTheme.colors.ink : color === 'disabled' ? euiTheme.components.buttons[textTokenName] : euiTheme.colors.textInverse;
|
|
39
|
+
var foreground = variant === 'filled' ? highContrastMode ? highContrastForeground : euiTheme.components.buttons[textTokenName] : euiTheme.components.buttons[textTokenName];
|
|
40
|
+
return {
|
|
41
|
+
color: foreground,
|
|
42
|
+
background: euiTheme.components.buttons[backgroundTokenName],
|
|
43
|
+
backgroundHover: euiTheme.components.buttons[backgroundHoverTokenName],
|
|
44
|
+
backgroundActive: euiTheme.components.buttons[backgroundActiveTokenName]
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
|
|
24
48
|
/**
|
|
25
49
|
* Creates the `base` version of button styles with proper text contrast.
|
|
26
50
|
* @param euiThemeContext
|
|
@@ -28,11 +52,9 @@ var BUTTON_DISPLAYS = exports.BUTTON_DISPLAYS = ['base', 'fill', 'empty'];
|
|
|
28
52
|
* @returns Style object `{ backgroundColor, color }`
|
|
29
53
|
*/
|
|
30
54
|
var euiButtonColor = exports.euiButtonColor = function euiButtonColor(euiThemeContext, color) {
|
|
31
|
-
var
|
|
32
|
-
var
|
|
33
|
-
var
|
|
34
|
-
var foreground = euiTheme.components.buttons[textTokenName];
|
|
35
|
-
var background = euiTheme.components.buttons[backgroundTokenName];
|
|
55
|
+
var buttonColors = getButtonVariantTokenValues(euiThemeContext, color, 'base');
|
|
56
|
+
var foreground = buttonColors.color;
|
|
57
|
+
var background = buttonColors.background;
|
|
36
58
|
return _objectSpread({
|
|
37
59
|
color: background === 'transparent' || color === 'disabled' ? foreground : (0, _services.makeHighContrastColor)(foreground)(background),
|
|
38
60
|
backgroundColor: background
|
|
@@ -46,13 +68,9 @@ var euiButtonColor = exports.euiButtonColor = function euiButtonColor(euiThemeCo
|
|
|
46
68
|
* @returns Style object `{ backgroundColor, color }`
|
|
47
69
|
*/
|
|
48
70
|
var euiButtonFillColor = exports.euiButtonFillColor = function euiButtonFillColor(euiThemeContext, color) {
|
|
49
|
-
var
|
|
50
|
-
|
|
51
|
-
var
|
|
52
|
-
var textColorTokenName = (0, _euiThemeCommon.getTokenName)('textColorFilled', color);
|
|
53
|
-
var highContrastForeground = ['warning', 'neutral', 'risk'].includes(color) ? euiTheme.colors.ink : color === 'disabled' ? euiTheme.components.buttons[textColorTokenName] : euiTheme.colors.textInverse;
|
|
54
|
-
var foreground = highContrastMode ? highContrastForeground : euiTheme.components.buttons[textColorTokenName];
|
|
55
|
-
var background = euiTheme.components.buttons[backgroundTokenName];
|
|
71
|
+
var buttonColors = getButtonVariantTokenValues(euiThemeContext, color, 'filled');
|
|
72
|
+
var foreground = buttonColors.color;
|
|
73
|
+
var background = buttonColors.background;
|
|
56
74
|
return _objectSpread({
|
|
57
75
|
color: foreground,
|
|
58
76
|
backgroundColor: background
|
|
@@ -76,9 +94,9 @@ var euiButtonEmptyColor = exports.euiButtonEmptyColor = function euiButtonEmptyC
|
|
|
76
94
|
break;
|
|
77
95
|
default:
|
|
78
96
|
{
|
|
79
|
-
var
|
|
97
|
+
var buttonColors = getButtonVariantTokenValues(euiThemeContext, color, 'empty');
|
|
80
98
|
foreground = euiButtonColor(euiThemeContext, color).color;
|
|
81
|
-
background =
|
|
99
|
+
background = buttonColors.backgroundHover;
|
|
82
100
|
break;
|
|
83
101
|
}
|
|
84
102
|
}
|
|
@@ -91,7 +109,7 @@ var euiButtonEmptyColor = exports.euiButtonEmptyColor = function euiButtonEmptyC
|
|
|
91
109
|
/**
|
|
92
110
|
* Given the button display type, returns the Emotion based color keys.
|
|
93
111
|
* @param options Button display type
|
|
94
|
-
* @returns An object of `
|
|
112
|
+
* @returns An object of `_EuiExtendedButtonColor` keys including `disabled`
|
|
95
113
|
*/
|
|
96
114
|
var useEuiButtonColorCSS = exports.useEuiButtonColorCSS = function useEuiButtonColorCSS() {
|
|
97
115
|
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
@@ -101,21 +119,37 @@ var useEuiButtonColorCSS = exports.useEuiButtonColorCSS = function useEuiButtonC
|
|
|
101
119
|
return colorsDisplaysMap[display];
|
|
102
120
|
};
|
|
103
121
|
var euiButtonDisplaysColors = function euiButtonDisplaysColors(euiThemeContext) {
|
|
104
|
-
var
|
|
122
|
+
var euiTheme = euiThemeContext.euiTheme;
|
|
123
|
+
var isRefreshVariant = (0, _services.isEuiThemeRefreshVariant)(euiThemeContext, 'buttonVariant');
|
|
124
|
+
var COLORS = [].concat((0, _toConsumableArray2.default)(EXTENDED_BUTTON_COLORS), ['disabled']);
|
|
105
125
|
var displaysColorsMap = {};
|
|
106
126
|
BUTTON_DISPLAYS.forEach(function (display) {
|
|
107
127
|
displaysColorsMap[display] = {};
|
|
108
128
|
COLORS.forEach(function (color) {
|
|
109
129
|
switch (display) {
|
|
110
130
|
case 'base':
|
|
111
|
-
|
|
112
|
-
|
|
131
|
+
{
|
|
132
|
+
var buttonColors = getButtonVariantTokenValues(euiThemeContext, color, 'base');
|
|
133
|
+
var borderStyle = color === 'text' && "\n border: ".concat(euiTheme.border.width.thin, " solid ").concat(euiTheme.colors.borderBasePlain, ";\n ");
|
|
134
|
+
var refreshVariantStyles = isRefreshVariant && "\n ".concat(_interactionStyles(euiThemeContext, buttonColors, 'overlay'), "\n ").concat(borderStyle, "\n ");
|
|
135
|
+
displaysColorsMap[display][color] = /*#__PURE__*/(0, _react.css)(euiButtonColor(euiThemeContext, color), " ", refreshVariantStyles, ";;label:displaysColorsMap-display-color;");
|
|
136
|
+
break;
|
|
137
|
+
}
|
|
113
138
|
case 'fill':
|
|
114
|
-
|
|
115
|
-
|
|
139
|
+
{
|
|
140
|
+
var _buttonColors = getButtonVariantTokenValues(euiThemeContext, color, 'filled');
|
|
141
|
+
var _refreshVariantStyles = isRefreshVariant && _interactionStyles(euiThemeContext, _buttonColors);
|
|
142
|
+
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;");
|
|
143
|
+
break;
|
|
144
|
+
}
|
|
116
145
|
case 'empty':
|
|
117
|
-
|
|
118
|
-
|
|
146
|
+
{
|
|
147
|
+
var _buttonColors2 = getButtonVariantTokenValues(euiThemeContext, color, 'empty');
|
|
148
|
+
var classicVariantStyles = !isRefreshVariant && "\n &:focus,\n &:active {\n background-color: ".concat(euiButtonEmptyColor(euiThemeContext, color).backgroundColor, ";\n }\n ");
|
|
149
|
+
var _refreshVariantStyles2 = isRefreshVariant && _interactionStyles(euiThemeContext, _buttonColors2, 'overlay');
|
|
150
|
+
displaysColorsMap[display][color] = /*#__PURE__*/(0, _react.css)("color:", euiButtonEmptyColor(euiThemeContext, color).color, ";", classicVariantStyles, " ", _refreshVariantStyles2, ";;label:displaysColorsMap-display-color;");
|
|
151
|
+
break;
|
|
152
|
+
}
|
|
119
153
|
}
|
|
120
154
|
|
|
121
155
|
// Tweak auto-generated Emotion label/className output
|
|
@@ -134,9 +168,10 @@ var useEuiButtonFocusCSS = exports.useEuiButtonFocusCSS = function useEuiButtonF
|
|
|
134
168
|
return (0, _services.useEuiMemoizedStyles)(euiButtonFocusCSS);
|
|
135
169
|
};
|
|
136
170
|
var euiButtonFocusAnimation = (0, _react.keyframes)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n 50% {\n transform: translateY(1px);\n }\n"])));
|
|
137
|
-
var euiButtonFocusCSS = function euiButtonFocusCSS(
|
|
138
|
-
var euiTheme =
|
|
139
|
-
var
|
|
171
|
+
var euiButtonFocusCSS = function euiButtonFocusCSS(euiThemeContext) {
|
|
172
|
+
var euiTheme = euiThemeContext.euiTheme;
|
|
173
|
+
var isRefreshVariant = (0, _services.isEuiThemeRefreshVariant)(euiThemeContext, 'buttonVariant');
|
|
174
|
+
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;");
|
|
140
175
|
// Remove the auto-generated label.
|
|
141
176
|
// We could typically avoid a label by using a plain string `` instead of css``,
|
|
142
177
|
// but we need css`` for keyframes`` to work for the focus animation
|
|
@@ -148,27 +183,63 @@ var euiButtonFocusCSS = function euiButtonFocusCSS(_ref) {
|
|
|
148
183
|
* Map of `size` props to various sizings/scales
|
|
149
184
|
* that should remain consistent across all buttons
|
|
150
185
|
*/
|
|
151
|
-
var euiButtonSizeMap = exports.euiButtonSizeMap = function euiButtonSizeMap(
|
|
152
|
-
var euiTheme =
|
|
186
|
+
var euiButtonSizeMap = exports.euiButtonSizeMap = function euiButtonSizeMap(euiThemeContext) {
|
|
187
|
+
var euiTheme = euiThemeContext.euiTheme;
|
|
188
|
+
var isRefreshVariant = (0, _services.isEuiThemeRefreshVariant)(euiThemeContext, 'buttonVariant');
|
|
153
189
|
return {
|
|
154
190
|
xs: {
|
|
191
|
+
minWidth: euiTheme.base * (isRefreshVariant ? 6 : 7),
|
|
155
192
|
height: euiTheme.size.l,
|
|
156
193
|
radius: euiTheme.border.radius.small,
|
|
157
194
|
fontScale: 'xs'
|
|
158
195
|
},
|
|
159
196
|
s: {
|
|
197
|
+
minWidth: euiTheme.base * (isRefreshVariant ? 6 : 7),
|
|
160
198
|
height: euiTheme.size.xl,
|
|
161
199
|
radius: euiTheme.border.radius.small,
|
|
162
200
|
fontScale: 's'
|
|
163
201
|
},
|
|
164
202
|
m: {
|
|
203
|
+
minWidth: euiTheme.base * 7,
|
|
165
204
|
height: euiTheme.size.xxl,
|
|
166
|
-
radius: euiTheme.border.radius.medium,
|
|
205
|
+
radius: isRefreshVariant ? euiTheme.border.radius.small : euiTheme.border.radius.medium,
|
|
167
206
|
fontScale: 's'
|
|
168
207
|
}
|
|
169
208
|
};
|
|
170
209
|
};
|
|
171
210
|
|
|
211
|
+
/**
|
|
212
|
+
* internal styles util for applying button background color on hover
|
|
213
|
+
*/
|
|
214
|
+
var _interactionStyles = function _interactionStyles(euiThemeContext, buttonColors) {
|
|
215
|
+
var type = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'fill';
|
|
216
|
+
var isRefreshVariant = (0, _services.isEuiThemeRefreshVariant)(euiThemeContext, 'buttonVariant');
|
|
217
|
+
if (!isRefreshVariant) return "";
|
|
218
|
+
var baseStyles = function baseStyles() {
|
|
219
|
+
// button hover is applied as pseudo element with a transparent background-color
|
|
220
|
+
if (type === 'overlay') {
|
|
221
|
+
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 ");
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
// button hover is applied as opaque color
|
|
225
|
+
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 ");
|
|
226
|
+
};
|
|
227
|
+
return " \n ".concat((0, _functions.highContrastModeStyles)(euiThemeContext, {
|
|
228
|
+
none: baseStyles(),
|
|
229
|
+
forced: "\n position: relative;\n overflow: hidden;\n\n ".concat(highContrastHoverIndicatorStyles(euiThemeContext), "\n ")
|
|
230
|
+
}), "\n ");
|
|
231
|
+
};
|
|
232
|
+
|
|
233
|
+
/**
|
|
234
|
+
* creates a bottom border on hover/focus to ensure a visible change as forced mode removed background colors
|
|
235
|
+
*/
|
|
236
|
+
var highContrastHoverIndicatorStyles = exports.highContrastHoverIndicatorStyles = function highContrastHoverIndicatorStyles(_ref2) {
|
|
237
|
+
var euiTheme = _ref2.euiTheme;
|
|
238
|
+
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) {
|
|
239
|
+
return x / 2;
|
|
240
|
+
}), ";\n background-color: transparent;\n pointer-events: none;\n }\n }\n");
|
|
241
|
+
};
|
|
242
|
+
|
|
172
243
|
/**
|
|
173
244
|
* Internal util for high contrast button borders
|
|
174
245
|
*/
|
|
@@ -6,9 +6,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.useEuiBorderColorCSS = exports.useEuiBackgroundColorCSS = exports.useEuiBackgroundColor = exports.euiBorderColor = exports.euiBackgroundColor = exports.BACKGROUND_COLORS = void 0;
|
|
8
8
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
|
+
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
9
10
|
var _react = require("@emotion/react");
|
|
10
|
-
var _services = require("../../services");
|
|
11
11
|
var _euiThemeCommon = require("@elastic/eui-theme-common");
|
|
12
|
+
var _services = require("../../services");
|
|
13
|
+
var _button = require("./_button");
|
|
12
14
|
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; }
|
|
13
15
|
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) { (0, _defineProperty2.default)(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; } /*
|
|
14
16
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
@@ -17,7 +19,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
17
19
|
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
18
20
|
* Side Public License, v 1.
|
|
19
21
|
*/
|
|
20
|
-
var BACKGROUND_COLORS = exports.BACKGROUND_COLORS = ['transparent', 'plain', 'subdued', 'highlighted', 'accent', 'accentSecondary', 'primary', '
|
|
22
|
+
var BACKGROUND_COLORS = exports.BACKGROUND_COLORS = ['transparent', 'plain', 'subdued', 'highlighted', 'accent', 'accentSecondary', 'primary', 'success', 'warning', 'danger'].concat((0, _toConsumableArray2.default)(_button.SEVERITY_COLORS));
|
|
21
23
|
/**
|
|
22
24
|
* @deprecated - use background tokens directly
|
|
23
25
|
* @returns A single background color with optional alpha transparency
|
|
@@ -3,6 +3,34 @@
|
|
|
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
|
+
EuiThemeProvider: true,
|
|
18
|
+
useEuiMemoizedStyles: true,
|
|
19
|
+
withEuiStylesMemoizer: true,
|
|
20
|
+
RenderWithEuiStylesMemoizer: true,
|
|
21
|
+
getEuiDevProviderWarning: true,
|
|
22
|
+
setEuiDevProviderWarning: true,
|
|
23
|
+
buildTheme: true,
|
|
24
|
+
computed: true,
|
|
25
|
+
isInverseColorMode: true,
|
|
26
|
+
getColorMode: true,
|
|
27
|
+
getComputed: true,
|
|
28
|
+
getOn: true,
|
|
29
|
+
mergeDeep: true,
|
|
30
|
+
setOn: true,
|
|
31
|
+
Computed: true,
|
|
32
|
+
COLOR_MODES_STANDARD: true
|
|
33
|
+
};
|
|
6
34
|
Object.defineProperty(exports, "COLOR_MODES_STANDARD", {
|
|
7
35
|
enumerable: true,
|
|
8
36
|
get: function get() {
|
|
@@ -165,4 +193,16 @@ var _provider = require("./provider");
|
|
|
165
193
|
var _style_memoization = require("./style_memoization");
|
|
166
194
|
var _warning = require("./warning");
|
|
167
195
|
var _utils = require("./utils");
|
|
168
|
-
var _types = require("./types");
|
|
196
|
+
var _types = require("./types");
|
|
197
|
+
var _theme_variant = require("./theme_variant");
|
|
198
|
+
Object.keys(_theme_variant).forEach(function (key) {
|
|
199
|
+
if (key === "default" || key === "__esModule") return;
|
|
200
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
201
|
+
if (key in exports && exports[key] === _theme_variant[key]) return;
|
|
202
|
+
Object.defineProperty(exports, key, {
|
|
203
|
+
enumerable: true,
|
|
204
|
+
get: function get() {
|
|
205
|
+
return _theme_variant[key];
|
|
206
|
+
}
|
|
207
|
+
});
|
|
208
|
+
});
|
|
@@ -140,9 +140,35 @@ var EuiThemeProvider = exports.EuiThemeProvider = function EuiThemeProvider(_ref
|
|
|
140
140
|
}, [highContrastMode]);
|
|
141
141
|
(0, _react2.useEffect)(function () {
|
|
142
142
|
if (!isParentTheme.current) {
|
|
143
|
-
|
|
143
|
+
/* Enables recomputation of component colors when flags are overridden on the provider
|
|
144
|
+
by adding the respective key to modifications to trigger a recomputation. */
|
|
145
|
+
// TODO: remove once visual refresh is completed and flags are obsolete
|
|
146
|
+
var flagsToRecompute = [{
|
|
147
|
+
flag: 'buttonVariant',
|
|
148
|
+
componentKey: 'buttons'
|
|
149
|
+
}];
|
|
150
|
+
var keys = {};
|
|
151
|
+
var forceRecomputeComponents = flagsToRecompute.some(function (item) {
|
|
152
|
+
var _modifications$flags, _modifications$compon;
|
|
153
|
+
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)) {
|
|
154
|
+
keys[item.componentKey] = {
|
|
155
|
+
LIGHT: {},
|
|
156
|
+
DARK: {}
|
|
157
|
+
};
|
|
158
|
+
return true;
|
|
159
|
+
}
|
|
160
|
+
return false;
|
|
161
|
+
});
|
|
162
|
+
var componentModifications = forceRecomputeComponents ? {
|
|
163
|
+
components: keys
|
|
164
|
+
} : {};
|
|
165
|
+
|
|
166
|
+
// force recomputing of color & component tokens based on flag changes
|
|
167
|
+
var enhancedModifications = _objectSpread(_objectSpread({}, modificationsWithHighContrast), componentModifications);
|
|
168
|
+
var rebuiltTheme = (0, _utils.getComputed)(system, (0, _utils.buildTheme)(enhancedModifications, "_".concat(system.key)), colorMode, highContrastMode);
|
|
169
|
+
setTheme(rebuiltTheme);
|
|
144
170
|
}
|
|
145
|
-
}, [colorMode, highContrastMode, system, modificationsWithHighContrast]);
|
|
171
|
+
}, [colorMode, highContrastMode, system, modificationsWithHighContrast, modifications]);
|
|
146
172
|
var _useState9 = (0, _react2.useState)(),
|
|
147
173
|
_useState10 = (0, _slicedToArray2.default)(_useState9, 2),
|
|
148
174
|
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
|
+
};
|
|
@@ -24,7 +24,8 @@ declare module '@elastic/eui/optimize/lib/test/take_mounted_snapshot' {
|
|
|
24
24
|
|
|
25
25
|
}
|
|
26
26
|
declare module '@elastic/eui/optimize/lib/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
|
|