@elastic/eui 79.0.1 → 81.0.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_charts_theme.js.map +1 -1
- package/dist/eui_theme_dark.css +9 -11
- package/dist/eui_theme_dark.min.css +1 -1
- package/dist/eui_theme_light.css +11 -13
- package/dist/eui_theme_light.min.css +1 -1
- package/es/components/avatar/avatar.js +1 -1
- package/es/components/badge/badge.js +1 -1
- package/es/components/badge/beta_badge/beta_badge.js +1 -1
- package/es/components/basic_table/basic_table.js +1 -1
- package/es/components/basic_table/collapsed_item_actions.js +1 -1
- package/es/components/basic_table/in_memory_table.js +1 -1
- package/es/components/bottom_bar/bottom_bar.js +4 -1
- package/es/components/bottom_bar/bottom_bar.styles.js +2 -2
- package/es/components/button/_button_content_deprecated.js +1 -1
- package/es/components/button/button.js +4 -1
- package/es/components/button/button_display/_button_display.js +1 -1
- package/es/components/button/button_display/_button_display_content.js +1 -1
- package/es/components/button/button_empty/button_empty.js +5 -2
- package/es/components/button/button_group/button_group.js +1 -1
- package/es/components/button/button_group/button_group_button.js +1 -1
- package/es/components/button/button_icon/button_icon.js +5 -2
- package/es/components/call_out/call_out.js +1 -1
- package/es/components/card/card.js +1 -1
- package/es/components/collapsible_nav/collapsible_nav_group/collapsible_nav_group.js +1 -1
- package/es/components/combo_box/combo_box_input/combo_box_input.js +1 -1
- package/es/components/comment_list/comment.js +2 -2
- package/es/components/comment_list/comment_event.js +1 -1
- package/es/components/comment_list/comment_list.js +2 -2
- package/es/components/comment_list/comment_timeline.js +1 -1
- package/es/components/context_menu/context_menu.js +18 -7
- package/es/components/datagrid/body/data_grid_body.js +13 -13
- package/es/components/datagrid/body/data_grid_body_custom.js +13 -13
- package/es/components/datagrid/body/data_grid_body_virtualized.js +13 -13
- package/es/components/datagrid/body/data_grid_cell.js +24 -24
- package/es/components/datagrid/body/header/data_grid_header_cell.js +12 -12
- package/es/components/datagrid/body/header/data_grid_header_row.js +13 -13
- package/es/components/datagrid/controls/column_sorting_draggable.js +1 -1
- package/es/components/datagrid/data_grid.js +13 -13
- package/es/components/datagrid/utils/in_memory.js +12 -12
- package/es/components/date_picker/date_picker.js +2 -2
- package/es/components/date_picker/date_picker_range.js +1 -1
- package/es/components/empty_prompt/empty_prompt.js +1 -1
- package/es/components/facet/facet_button.js +1 -1
- package/es/components/filter_group/filter_group.a11y.js +2 -2
- package/es/components/form/field_number/field_number.js +25 -16
- package/es/components/form/field_text/field_text.js +2 -2
- package/es/components/form/form_control_layout/form_control_layout.js +2 -2
- package/es/components/form/form_control_layout/form_control_layout_custom_icon.js +1 -1
- package/es/components/form/form_control_layout/form_control_layout_icons.js +2 -2
- package/es/components/header/header_links/header_link.js +1 -1
- package/es/components/header/header_links/header_links.js +1 -1
- package/es/components/header/header_logo.js +1 -1
- package/es/components/icon/assets/app_vulnerability_management.js +36 -0
- package/es/components/icon/assets/logo_vulnerability_management.js +41 -0
- package/es/components/icon/icon.js +1 -1
- package/es/components/icon/icon_map.js +2 -0
- package/es/components/key_pad_menu/key_pad_menu_item.js +1 -1
- package/es/components/list_group/list_group.js +2 -2
- package/es/components/list_group/list_group_item.js +2 -2
- package/es/components/list_group/list_group_item_extra_action.js +1 -1
- package/es/components/list_group/pinnable_list_group/pinnable_list_group.js +4 -4
- package/es/components/loading/loading_logo.js +1 -1
- package/es/components/markdown_editor/markdown_editor.js +1 -1
- package/es/components/markdown_editor/markdown_editor_drop_zone.js +1 -1
- package/es/components/markdown_editor/markdown_editor_footer.js +1 -1
- package/es/components/markdown_editor/markdown_editor_toolbar.js +1 -1
- package/es/components/notification/notification_event.js +2 -2
- package/es/components/notification/notification_event_meta.js +1 -1
- package/es/components/overlay_mask/overlay_mask.js +25 -9
- package/es/components/page/page_header/page_header_content.js +1 -1
- package/es/components/pagination/pagination_button.js +1 -1
- package/es/components/portal/portal.js +17 -0
- package/es/components/selectable/selectable.a11y.js +39 -23
- package/es/components/selectable/selectable.js +4 -4
- package/es/components/selectable/selectable_list/selectable_list.js +6 -6
- package/es/components/selectable/selectable_list/selectable_list_item.js +120 -58
- package/es/components/selectable/selectable_templates/selectable_template_sitewide.js +5 -5
- package/es/components/suggest/suggest.js +1 -1
- package/es/components/suggest/suggest_item.js +1 -1
- package/es/components/table/table_header_button.js +1 -1
- package/es/components/timeline/timeline_item_icon.js +1 -1
- package/es/components/toast/global_toast_list.js +1 -1
- package/es/components/toast/toast.js +1 -1
- package/es/components/tool_tip/icon_tip.js +1 -1
- package/es/global_styling/reset/global_styles.js +1 -1
- package/es/services/theme/context.js +7 -1
- package/es/services/theme/index.js +1 -1
- package/es/services/theme/provider.js +47 -4
- package/eui.d.ts +79 -25
- package/i18ntokens.json +88 -52
- package/lib/components/avatar/avatar.js +1 -1
- package/lib/components/badge/badge.js +1 -1
- package/lib/components/badge/beta_badge/beta_badge.js +1 -1
- package/lib/components/basic_table/basic_table.js +1 -1
- package/lib/components/basic_table/collapsed_item_actions.js +1 -1
- package/lib/components/basic_table/in_memory_table.js +1 -1
- package/lib/components/bottom_bar/bottom_bar.js +4 -1
- package/lib/components/bottom_bar/bottom_bar.styles.js +2 -2
- package/lib/components/button/_button_content_deprecated.js +1 -1
- package/lib/components/button/button.js +4 -1
- package/lib/components/button/button_display/_button_display.js +1 -1
- package/lib/components/button/button_display/_button_display_content.js +1 -1
- package/lib/components/button/button_empty/button_empty.js +5 -2
- package/lib/components/button/button_group/button_group.js +1 -1
- package/lib/components/button/button_group/button_group_button.js +1 -1
- package/lib/components/button/button_icon/button_icon.js +5 -2
- package/lib/components/call_out/call_out.js +1 -1
- package/lib/components/card/card.js +1 -1
- package/lib/components/collapsible_nav/collapsible_nav_group/collapsible_nav_group.js +1 -1
- package/lib/components/combo_box/combo_box_input/combo_box_input.js +1 -1
- package/lib/components/comment_list/comment.js +2 -2
- package/lib/components/comment_list/comment_event.js +1 -1
- package/lib/components/comment_list/comment_list.js +2 -2
- package/lib/components/comment_list/comment_timeline.js +1 -1
- package/lib/components/context_menu/context_menu.js +18 -7
- package/lib/components/datagrid/body/data_grid_body.js +13 -13
- package/lib/components/datagrid/body/data_grid_body_custom.js +13 -13
- package/lib/components/datagrid/body/data_grid_body_virtualized.js +13 -13
- package/lib/components/datagrid/body/data_grid_cell.js +24 -24
- package/lib/components/datagrid/body/header/data_grid_header_cell.js +12 -12
- package/lib/components/datagrid/body/header/data_grid_header_row.js +13 -13
- package/lib/components/datagrid/controls/column_sorting_draggable.js +1 -1
- package/lib/components/datagrid/data_grid.js +13 -13
- package/lib/components/datagrid/utils/in_memory.js +12 -12
- package/lib/components/date_picker/date_picker.js +2 -2
- package/lib/components/date_picker/date_picker_range.js +1 -1
- package/lib/components/empty_prompt/empty_prompt.js +1 -1
- package/lib/components/facet/facet_button.js +1 -1
- package/lib/components/filter_group/filter_group.a11y.js +2 -2
- package/lib/components/form/field_number/field_number.js +25 -16
- package/lib/components/form/field_text/field_text.js +2 -2
- package/lib/components/form/form_control_layout/form_control_layout.js +2 -2
- package/lib/components/form/form_control_layout/form_control_layout_custom_icon.js +1 -1
- package/lib/components/form/form_control_layout/form_control_layout_icons.js +2 -2
- package/lib/components/header/header_links/header_link.js +1 -1
- package/lib/components/header/header_links/header_links.js +1 -1
- package/lib/components/header/header_logo.js +1 -1
- package/lib/components/icon/assets/app_vulnerability_management.js +36 -0
- package/lib/components/icon/assets/logo_vulnerability_management.js +41 -0
- package/lib/components/icon/icon.js +1 -1
- package/lib/components/icon/icon_map.js +2 -0
- package/lib/components/icon/svgs/app_vulnerability_management.svg +4 -0
- package/lib/components/icon/svgs/logo_vulnerability_management.svg +7 -0
- package/lib/components/key_pad_menu/key_pad_menu_item.js +1 -1
- package/lib/components/list_group/list_group.js +2 -2
- package/lib/components/list_group/list_group_item.js +2 -2
- package/lib/components/list_group/list_group_item_extra_action.js +1 -1
- package/lib/components/list_group/pinnable_list_group/pinnable_list_group.js +4 -4
- package/lib/components/loading/loading_logo.js +1 -1
- package/lib/components/markdown_editor/markdown_editor.js +1 -1
- package/lib/components/markdown_editor/markdown_editor_drop_zone.js +1 -1
- package/lib/components/markdown_editor/markdown_editor_footer.js +1 -1
- package/lib/components/markdown_editor/markdown_editor_toolbar.js +1 -1
- package/lib/components/notification/notification_event.js +2 -2
- package/lib/components/notification/notification_event_meta.js +1 -1
- package/lib/components/overlay_mask/overlay_mask.js +25 -4
- package/lib/components/page/page_header/page_header_content.js +1 -1
- package/lib/components/portal/portal.js +17 -0
- package/lib/components/selectable/selectable.a11y.js +39 -23
- package/lib/components/selectable/selectable.js +4 -4
- package/lib/components/selectable/selectable_list/selectable_list.js +6 -6
- package/lib/components/selectable/selectable_list/selectable_list_item.js +120 -58
- package/lib/components/selectable/selectable_templates/selectable_template_sitewide.js +5 -5
- package/lib/components/suggest/suggest.js +1 -1
- package/lib/components/suggest/suggest_item.js +1 -1
- package/lib/components/table/table_header_button.js +1 -1
- package/lib/components/timeline/timeline_item_icon.js +1 -1
- package/lib/components/toast/global_toast_list.js +1 -1
- package/lib/components/toast/toast.js +1 -1
- package/lib/components/tool_tip/icon_tip.js +1 -1
- package/lib/global_styling/reset/global_styles.js +1 -1
- package/lib/services/theme/context.js +9 -2
- package/lib/services/theme/index.js +6 -0
- package/lib/services/theme/provider.js +45 -2
- package/optimize/es/components/bottom_bar/bottom_bar.js +4 -1
- package/optimize/es/components/bottom_bar/bottom_bar.styles.js +2 -2
- package/optimize/es/components/button/button.js +4 -1
- package/optimize/es/components/button/button_empty/button_empty.js +4 -1
- package/optimize/es/components/button/button_icon/button_icon.js +4 -1
- package/optimize/es/components/combo_box/combo_box_input/combo_box_input.js +1 -1
- package/optimize/es/components/context_menu/context_menu.js +13 -7
- package/optimize/es/components/filter_group/filter_group.a11y.js +2 -2
- package/optimize/es/components/form/field_number/field_number.js +21 -13
- package/optimize/es/components/icon/assets/app_vulnerability_management.js +35 -0
- package/optimize/es/components/icon/assets/logo_vulnerability_management.js +40 -0
- package/optimize/es/components/icon/icon_map.js +2 -0
- package/optimize/es/components/overlay_mask/overlay_mask.js +22 -9
- package/optimize/es/components/portal/portal.js +18 -1
- package/optimize/es/components/selectable/selectable.a11y.js +39 -23
- package/optimize/es/components/selectable/selectable_list/selectable_list_item.js +117 -54
- package/optimize/es/global_styling/reset/global_styles.js +1 -1
- package/optimize/es/services/theme/context.js +7 -1
- package/optimize/es/services/theme/index.js +1 -1
- package/optimize/es/services/theme/provider.js +46 -4
- package/optimize/lib/components/bottom_bar/bottom_bar.js +4 -1
- package/optimize/lib/components/bottom_bar/bottom_bar.styles.js +2 -2
- package/optimize/lib/components/button/button.js +4 -1
- package/optimize/lib/components/button/button_empty/button_empty.js +4 -1
- package/optimize/lib/components/button/button_icon/button_icon.js +4 -1
- package/optimize/lib/components/combo_box/combo_box_input/combo_box_input.js +1 -1
- package/optimize/lib/components/context_menu/context_menu.js +13 -7
- package/optimize/lib/components/filter_group/filter_group.a11y.js +2 -2
- package/optimize/lib/components/form/field_number/field_number.js +21 -13
- package/optimize/lib/components/icon/assets/app_vulnerability_management.js +36 -0
- package/optimize/lib/components/icon/assets/logo_vulnerability_management.js +41 -0
- package/optimize/lib/components/icon/icon_map.js +2 -0
- package/optimize/lib/components/icon/svgs/app_vulnerability_management.svg +4 -0
- package/optimize/lib/components/icon/svgs/logo_vulnerability_management.svg +7 -0
- package/optimize/lib/components/overlay_mask/overlay_mask.js +22 -4
- package/optimize/lib/components/portal/portal.js +18 -1
- package/optimize/lib/components/selectable/selectable.a11y.js +39 -23
- package/optimize/lib/components/selectable/selectable_list/selectable_list_item.js +117 -54
- package/optimize/lib/global_styling/reset/global_styles.js +1 -1
- package/optimize/lib/services/theme/context.js +9 -2
- package/optimize/lib/services/theme/index.js +6 -0
- package/optimize/lib/services/theme/provider.js +44 -2
- package/package.json +2 -5
- package/src/components/combo_box/_combo_box.scss +9 -11
- package/src/components/selectable/selectable_templates/_variables.scss +9 -5
- package/test-env/components/avatar/avatar.js +1 -1
- package/test-env/components/badge/badge.js +1 -1
- package/test-env/components/badge/beta_badge/beta_badge.js +1 -1
- package/test-env/components/basic_table/basic_table.js +1 -1
- package/test-env/components/basic_table/collapsed_item_actions.js +1 -1
- package/test-env/components/basic_table/in_memory_table.js +1 -1
- package/test-env/components/bottom_bar/bottom_bar.js +4 -1
- package/test-env/components/bottom_bar/bottom_bar.styles.js +2 -2
- package/test-env/components/button/_button_content_deprecated.js +1 -1
- package/test-env/components/button/button.js +4 -1
- package/test-env/components/button/button_display/_button_display.js +1 -1
- package/test-env/components/button/button_display/_button_display_content.js +1 -1
- package/test-env/components/button/button_empty/button_empty.js +5 -2
- package/test-env/components/button/button_group/button_group.js +1 -1
- package/test-env/components/button/button_group/button_group_button.js +1 -1
- package/test-env/components/button/button_icon/button_icon.js +5 -2
- package/test-env/components/call_out/call_out.js +1 -1
- package/test-env/components/card/card.js +1 -1
- package/test-env/components/collapsible_nav/collapsible_nav_group/collapsible_nav_group.js +1 -1
- package/test-env/components/combo_box/combo_box_input/combo_box_input.js +1 -1
- package/test-env/components/comment_list/comment.js +2 -2
- package/test-env/components/comment_list/comment_event.js +1 -1
- package/test-env/components/comment_list/comment_list.js +2 -2
- package/test-env/components/comment_list/comment_timeline.js +1 -1
- package/test-env/components/context_menu/context_menu.js +18 -7
- package/test-env/components/datagrid/body/data_grid_body.js +13 -13
- package/test-env/components/datagrid/body/data_grid_body_custom.js +13 -13
- package/test-env/components/datagrid/body/data_grid_body_virtualized.js +13 -13
- package/test-env/components/datagrid/body/data_grid_cell.js +24 -24
- package/test-env/components/datagrid/body/header/data_grid_header_cell.js +12 -12
- package/test-env/components/datagrid/body/header/data_grid_header_row.js +13 -13
- package/test-env/components/datagrid/controls/column_sorting_draggable.js +1 -1
- package/test-env/components/datagrid/data_grid.js +13 -13
- package/test-env/components/datagrid/utils/in_memory.js +12 -12
- package/test-env/components/date_picker/date_picker.js +2 -2
- package/test-env/components/date_picker/date_picker_range.js +1 -1
- package/test-env/components/empty_prompt/empty_prompt.js +1 -1
- package/test-env/components/facet/facet_button.js +1 -1
- package/test-env/components/filter_group/filter_group.a11y.js +2 -2
- package/test-env/components/form/field_number/field_number.js +25 -16
- package/test-env/components/form/field_text/field_text.js +2 -2
- package/test-env/components/form/form_control_layout/form_control_layout.js +2 -2
- package/test-env/components/form/form_control_layout/form_control_layout_custom_icon.js +1 -1
- package/test-env/components/form/form_control_layout/form_control_layout_icons.js +2 -2
- package/test-env/components/header/header_links/header_link.js +1 -1
- package/test-env/components/header/header_links/header_links.js +1 -1
- package/test-env/components/header/header_logo.js +1 -1
- package/test-env/components/icon/assets/app_vulnerability_management.js +36 -0
- package/test-env/components/icon/assets/logo_vulnerability_management.js +41 -0
- package/test-env/components/icon/icon_map.js +2 -0
- package/test-env/components/key_pad_menu/key_pad_menu_item.js +1 -1
- package/test-env/components/list_group/list_group.js +2 -2
- package/test-env/components/list_group/list_group_item.js +2 -2
- package/test-env/components/list_group/list_group_item_extra_action.js +1 -1
- package/test-env/components/list_group/pinnable_list_group/pinnable_list_group.js +4 -4
- package/test-env/components/loading/loading_logo.js +1 -1
- package/test-env/components/markdown_editor/markdown_editor.js +1 -1
- package/test-env/components/markdown_editor/markdown_editor_drop_zone.js +1 -1
- package/test-env/components/markdown_editor/markdown_editor_footer.js +1 -1
- package/test-env/components/markdown_editor/markdown_editor_toolbar.js +1 -1
- package/test-env/components/notification/notification_event.js +2 -2
- package/test-env/components/notification/notification_event_meta.js +1 -1
- package/test-env/components/overlay_mask/overlay_mask.js +22 -4
- package/test-env/components/page/page_header/page_header_content.js +1 -1
- package/test-env/components/portal/portal.js +17 -0
- package/test-env/components/selectable/selectable.a11y.js +39 -23
- package/test-env/components/selectable/selectable.js +4 -4
- package/test-env/components/selectable/selectable_list/selectable_list.js +6 -6
- package/test-env/components/selectable/selectable_list/selectable_list_item.js +121 -58
- package/test-env/components/selectable/selectable_templates/selectable_template_sitewide.js +5 -5
- package/test-env/components/suggest/suggest.js +1 -1
- package/test-env/components/suggest/suggest_item.js +1 -1
- package/test-env/components/table/table_header_button.js +1 -1
- package/test-env/components/timeline/timeline_item_icon.js +1 -1
- package/test-env/components/toast/global_toast_list.js +1 -1
- package/test-env/components/toast/toast.js +1 -1
- package/test-env/components/tool_tip/icon_tip.js +1 -1
- package/test-env/global_styling/reset/global_styles.js +1 -1
- package/test-env/services/theme/context.js +9 -2
- package/test-env/services/theme/index.js +6 -0
- package/test-env/services/theme/provider.js +44 -2
|
@@ -260,6 +260,7 @@ export var typeToPathMap = {
|
|
|
260
260
|
logoSketch: 'logo_sketch',
|
|
261
261
|
logoSlack: 'logo_slack',
|
|
262
262
|
logoUptime: 'logo_uptime',
|
|
263
|
+
logoVulnerabilityManagement: 'logo_vulnerability_management',
|
|
263
264
|
logoWebhook: 'logo_webhook',
|
|
264
265
|
logoWindows: 'logo_windows',
|
|
265
266
|
logoWorkplaceSearch: 'logo_workplace_search',
|
|
@@ -415,6 +416,7 @@ export var typeToPathMap = {
|
|
|
415
416
|
visVega: 'vis_vega',
|
|
416
417
|
visVisualBuilder: 'vis_visual_builder',
|
|
417
418
|
visualizeApp: 'app_visualize',
|
|
419
|
+
vulnerabilityManagementApp: 'app_vulnerability_management',
|
|
418
420
|
warning: 'warning',
|
|
419
421
|
alert: 'warning',
|
|
420
422
|
// NOTE: This is an undocumented alias for `warning`, added for legacy compatability with Elastic Charts
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
1
2
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
3
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
4
|
var _excluded = ["className", "children", "headerZindexLocation", "maskRef"];
|
|
@@ -9,11 +10,6 @@ var _excluded = ["className", "children", "headerZindexLocation", "maskRef"];
|
|
|
9
10
|
* Side Public License, v 1.
|
|
10
11
|
*/
|
|
11
12
|
|
|
12
|
-
/**
|
|
13
|
-
* NOTE: We can't test this component because Enzyme doesn't support rendering
|
|
14
|
-
* into portals.
|
|
15
|
-
*/
|
|
16
|
-
|
|
17
13
|
import React, { useEffect, useState } from 'react';
|
|
18
14
|
import { cx } from '@emotion/css';
|
|
19
15
|
import { Global } from '@emotion/react';
|
|
@@ -50,11 +46,28 @@ export var EuiOverlayMask = function EuiOverlayMask(_ref) {
|
|
|
50
46
|
});
|
|
51
47
|
}, [overlayMaskNode]); // eslint-disable-line react-hooks/exhaustive-deps
|
|
52
48
|
|
|
49
|
+
// Note: Use `classList.add/remove` instead of setting the entire `className`
|
|
50
|
+
// so as not to override any existing classes set by `EuiPortal`
|
|
53
51
|
useEffect(function () {
|
|
54
|
-
if (
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
52
|
+
if (overlayMaskNode) {
|
|
53
|
+
overlayMaskNode.classList.add('euiOverlayMask', cssStyles);
|
|
54
|
+
overlayMaskNode.dataset.relativeToHeader = headerZindexLocation;
|
|
55
|
+
return function () {
|
|
56
|
+
return overlayMaskNode.classList.remove(cssStyles);
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
}, [overlayMaskNode, cssStyles, headerZindexLocation]);
|
|
60
|
+
useEffect(function () {
|
|
61
|
+
if (className && overlayMaskNode) {
|
|
62
|
+
var _overlayMaskNode$clas;
|
|
63
|
+
var classNameArgs = className.split(' '); // The `classList` API doesn't support multiple classes in the same string
|
|
64
|
+
(_overlayMaskNode$clas = overlayMaskNode.classList).add.apply(_overlayMaskNode$clas, _toConsumableArray(classNameArgs));
|
|
65
|
+
return function () {
|
|
66
|
+
var _overlayMaskNode$clas2;
|
|
67
|
+
return (_overlayMaskNode$clas2 = overlayMaskNode.classList).remove.apply(_overlayMaskNode$clas2, _toConsumableArray(classNameArgs));
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
}, [overlayMaskNode, className]);
|
|
58
71
|
return ___EmotionJSX(EuiPortal, {
|
|
59
72
|
portalRef: combinedMaskRef
|
|
60
73
|
}, ___EmotionJSX(Global, {
|
|
@@ -22,6 +22,7 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
|
|
|
22
22
|
|
|
23
23
|
import { Component } from 'react';
|
|
24
24
|
import { createPortal } from 'react-dom';
|
|
25
|
+
import { EuiNestedThemeContext } from '../../services';
|
|
25
26
|
import { keysOf } from '../common';
|
|
26
27
|
export var insertPositions = {
|
|
27
28
|
after: 'afterend',
|
|
@@ -55,6 +56,7 @@ export var EuiPortal = /*#__PURE__*/function (_Component) {
|
|
|
55
56
|
_createClass(EuiPortal, [{
|
|
56
57
|
key: "componentDidMount",
|
|
57
58
|
value: function componentDidMount() {
|
|
59
|
+
this.setThemeColor();
|
|
58
60
|
this.updatePortalRef(this.portalNode);
|
|
59
61
|
}
|
|
60
62
|
}, {
|
|
@@ -66,6 +68,20 @@ export var EuiPortal = /*#__PURE__*/function (_Component) {
|
|
|
66
68
|
}
|
|
67
69
|
this.updatePortalRef(null);
|
|
68
70
|
}
|
|
71
|
+
|
|
72
|
+
// Set the inherited color of the portal based on the wrapping EuiThemeProvider
|
|
73
|
+
}, {
|
|
74
|
+
key: "setThemeColor",
|
|
75
|
+
value: function setThemeColor() {
|
|
76
|
+
if (this.portalNode && this.context) {
|
|
77
|
+
var _this$context = this.context,
|
|
78
|
+
hasDifferentColorFromGlobalTheme = _this$context.hasDifferentColorFromGlobalTheme,
|
|
79
|
+
colorClassName = _this$context.colorClassName;
|
|
80
|
+
if (hasDifferentColorFromGlobalTheme && this.props.insert == null) {
|
|
81
|
+
this.portalNode.classList.add(colorClassName);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
69
85
|
}, {
|
|
70
86
|
key: "updatePortalRef",
|
|
71
87
|
value: function updatePortalRef(ref) {
|
|
@@ -80,4 +96,5 @@ export var EuiPortal = /*#__PURE__*/function (_Component) {
|
|
|
80
96
|
}
|
|
81
97
|
}]);
|
|
82
98
|
return EuiPortal;
|
|
83
|
-
}(Component);
|
|
99
|
+
}(Component);
|
|
100
|
+
_defineProperty(EuiPortal, "contextType", EuiNestedThemeContext);
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
|
-
import _extends from "@babel/runtime/helpers/extends";
|
|
3
2
|
/*
|
|
4
3
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
5
4
|
* or more contributor license agreements. Licensed under the Elastic License
|
|
@@ -25,27 +24,27 @@ var options = [{
|
|
|
25
24
|
}, {
|
|
26
25
|
label: "Pandora is one of Saturn's moons, named for a Titaness of Greek mythology"
|
|
27
26
|
}];
|
|
28
|
-
var
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
}, args), function (list, search) {
|
|
40
|
-
return ___EmotionJSX(React.Fragment, null, search, list);
|
|
41
|
-
});
|
|
42
|
-
};
|
|
27
|
+
var excludedOptions = [{
|
|
28
|
+
label: 'Titan',
|
|
29
|
+
'data-test-subj': 'titanOption',
|
|
30
|
+
checked: 'on'
|
|
31
|
+
}, {
|
|
32
|
+
label: 'Enceladus',
|
|
33
|
+
checked: 'off'
|
|
34
|
+
}, {
|
|
35
|
+
label: "Pandora is one of Saturn's moons, named for a Titaness of Greek mythology",
|
|
36
|
+
checked: 'mixed'
|
|
37
|
+
}];
|
|
43
38
|
describe('EuiSelectable', function () {
|
|
44
39
|
describe('with a `searchable` configuration', function () {
|
|
45
40
|
it('has no accessibility errors', function () {
|
|
46
41
|
var onChange = cy.stub();
|
|
47
|
-
cy.realMount(___EmotionJSX(
|
|
48
|
-
|
|
42
|
+
cy.realMount(___EmotionJSX(EuiSelectable, {
|
|
43
|
+
options: options,
|
|
44
|
+
onChange: onChange,
|
|
45
|
+
searchable: true
|
|
46
|
+
}, function (list, search) {
|
|
47
|
+
return ___EmotionJSX(React.Fragment, null, search, list);
|
|
49
48
|
}));
|
|
50
49
|
cy.checkAxe();
|
|
51
50
|
});
|
|
@@ -53,9 +52,25 @@ describe('EuiSelectable', function () {
|
|
|
53
52
|
describe('without a `searchable` configuration', function () {
|
|
54
53
|
it('has no accessibility errors', function () {
|
|
55
54
|
var onChange = cy.stub();
|
|
56
|
-
cy.realMount(___EmotionJSX(
|
|
55
|
+
cy.realMount(___EmotionJSX(EuiSelectable, {
|
|
57
56
|
"aria-label": "No search box",
|
|
57
|
+
options: options,
|
|
58
58
|
onChange: onChange
|
|
59
|
+
}, function (list) {
|
|
60
|
+
return ___EmotionJSX(React.Fragment, null, list);
|
|
61
|
+
}));
|
|
62
|
+
cy.checkAxe();
|
|
63
|
+
});
|
|
64
|
+
});
|
|
65
|
+
describe('with excluded and mixed options configuration', function () {
|
|
66
|
+
it('has no accessibility errors', function () {
|
|
67
|
+
var onChange = cy.stub();
|
|
68
|
+
cy.realMount(___EmotionJSX(EuiSelectable, {
|
|
69
|
+
"aria-label": "Excluded and mixed options",
|
|
70
|
+
options: excludedOptions,
|
|
71
|
+
onChange: onChange
|
|
72
|
+
}, function (list) {
|
|
73
|
+
return ___EmotionJSX(React.Fragment, null, list);
|
|
59
74
|
}));
|
|
60
75
|
cy.checkAxe();
|
|
61
76
|
});
|
|
@@ -82,12 +97,13 @@ describe('EuiSelectable', function () {
|
|
|
82
97
|
button: button,
|
|
83
98
|
isOpen: isPopoverOpen,
|
|
84
99
|
closePopover: onClosePopover
|
|
85
|
-
}, ___EmotionJSX(
|
|
100
|
+
}, ___EmotionJSX(EuiSelectable, {
|
|
86
101
|
"aria-label": "With popover",
|
|
87
102
|
options: options,
|
|
88
|
-
onChange: onChange
|
|
89
|
-
|
|
90
|
-
|
|
103
|
+
onChange: onChange,
|
|
104
|
+
searchable: true
|
|
105
|
+
}, function (list, search) {
|
|
106
|
+
return ___EmotionJSX(React.Fragment, null, search, list);
|
|
91
107
|
}));
|
|
92
108
|
};
|
|
93
109
|
it('has no accessibility errors', function () {
|
|
@@ -2,6 +2,7 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
3
|
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
4
4
|
import _createClass from "@babel/runtime/helpers/createClass";
|
|
5
|
+
import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
|
|
5
6
|
import _inherits from "@babel/runtime/helpers/inherits";
|
|
6
7
|
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
7
8
|
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
@@ -27,18 +28,28 @@ import { EuiScreenReaderOnly } from '../../accessibility';
|
|
|
27
28
|
import { EuiBadge } from '../../badge';
|
|
28
29
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
29
30
|
function resolveIconAndColor(checked) {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
31
|
+
switch (checked) {
|
|
32
|
+
case 'on':
|
|
33
|
+
return {
|
|
34
|
+
icon: 'check',
|
|
35
|
+
color: 'text'
|
|
36
|
+
};
|
|
37
|
+
case 'off':
|
|
38
|
+
return {
|
|
39
|
+
icon: 'cross',
|
|
40
|
+
color: 'text'
|
|
41
|
+
};
|
|
42
|
+
case 'mixed':
|
|
43
|
+
return {
|
|
44
|
+
icon: 'minus',
|
|
45
|
+
color: 'text'
|
|
46
|
+
};
|
|
47
|
+
case undefined:
|
|
48
|
+
default:
|
|
49
|
+
return {
|
|
50
|
+
icon: 'empty'
|
|
51
|
+
};
|
|
34
52
|
}
|
|
35
|
-
return checked === 'on' ? {
|
|
36
|
-
icon: 'check',
|
|
37
|
-
color: 'text'
|
|
38
|
-
} : {
|
|
39
|
-
icon: 'cross',
|
|
40
|
-
color: 'text'
|
|
41
|
-
};
|
|
42
53
|
}
|
|
43
54
|
var paddingSizeToClassNameMap = {
|
|
44
55
|
none: null,
|
|
@@ -50,8 +61,32 @@ export var EuiSelectableListItem = /*#__PURE__*/function (_Component) {
|
|
|
50
61
|
_inherits(EuiSelectableListItem, _Component);
|
|
51
62
|
var _super = _createSuper(EuiSelectableListItem);
|
|
52
63
|
function EuiSelectableListItem(props) {
|
|
64
|
+
var _this;
|
|
53
65
|
_classCallCheck(this, EuiSelectableListItem);
|
|
54
|
-
|
|
66
|
+
_this = _super.call(this, props);
|
|
67
|
+
// aria-checked is intended to be used with role="checkbox" but
|
|
68
|
+
// the MDN documentation lists it as a possibility for role="option".
|
|
69
|
+
// See https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-checked
|
|
70
|
+
// and https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/option_role
|
|
71
|
+
_defineProperty(_assertThisInitialized(_this), "isChecked", function (role, checked) {
|
|
72
|
+
var rolesThatCanBeMixed = ['option', 'checkbox', 'menuitemcheckbox'];
|
|
73
|
+
var rolesThatCanBeChecked = [].concat(rolesThatCanBeMixed, ['radio', 'menuitemradio', 'switch']);
|
|
74
|
+
if (!rolesThatCanBeChecked.includes(role)) return undefined;
|
|
75
|
+
switch (checked) {
|
|
76
|
+
case 'on':
|
|
77
|
+
case 'off':
|
|
78
|
+
return true;
|
|
79
|
+
case 'mixed':
|
|
80
|
+
if (rolesThatCanBeMixed.includes(role)) {
|
|
81
|
+
return 'mixed';
|
|
82
|
+
} else {
|
|
83
|
+
return false;
|
|
84
|
+
}
|
|
85
|
+
default:
|
|
86
|
+
return false;
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
return _this;
|
|
55
90
|
}
|
|
56
91
|
_createClass(EuiSelectableListItem, [{
|
|
57
92
|
key: "render",
|
|
@@ -90,41 +125,71 @@ export var EuiSelectableListItem = /*#__PURE__*/function (_Component) {
|
|
|
90
125
|
});
|
|
91
126
|
}
|
|
92
127
|
var state;
|
|
93
|
-
var
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
+
var instructions;
|
|
129
|
+
var screenReaderStrings = {
|
|
130
|
+
checked: {
|
|
131
|
+
state: ___EmotionJSX(EuiI18n, {
|
|
132
|
+
token: "euiSelectableListItem.checkedOption",
|
|
133
|
+
default: "Checked option."
|
|
134
|
+
}),
|
|
135
|
+
instructions: ___EmotionJSX(EuiI18n, {
|
|
136
|
+
token: "euiSelectableListItem.checkOptionInstructions",
|
|
137
|
+
default: "To check this option, press Enter."
|
|
138
|
+
})
|
|
139
|
+
},
|
|
140
|
+
unchecked: {
|
|
141
|
+
instructions: ___EmotionJSX(EuiI18n, {
|
|
142
|
+
token: "euiSelectableListItem.uncheckOptionInstructions",
|
|
143
|
+
default: "To uncheck this option, press Enter."
|
|
144
|
+
})
|
|
145
|
+
},
|
|
146
|
+
excluded: {
|
|
147
|
+
state: ___EmotionJSX(EuiI18n, {
|
|
148
|
+
token: "euiSelectableListItem.excludedOption",
|
|
149
|
+
default: "Excluded option."
|
|
150
|
+
}),
|
|
151
|
+
instructions: ___EmotionJSX(EuiI18n, {
|
|
152
|
+
token: "euiSelectableListItem.excludeOptionInstructions",
|
|
153
|
+
default: "To exclude this option, press Enter."
|
|
154
|
+
})
|
|
155
|
+
},
|
|
156
|
+
mixed: {
|
|
157
|
+
state: ___EmotionJSX(EuiI18n, {
|
|
158
|
+
token: "euiSelectableListItem.mixedOption",
|
|
159
|
+
default: "Mixed (indeterminate) option."
|
|
160
|
+
}),
|
|
161
|
+
instructions: ___EmotionJSX(EuiI18n, {
|
|
162
|
+
token: "euiSelectableListItem.mixedOptionInstructions",
|
|
163
|
+
default: "To check this option for all, press Enter once."
|
|
164
|
+
}),
|
|
165
|
+
uncheckInstructions: ___EmotionJSX(EuiI18n, {
|
|
166
|
+
token: "euiSelectableListItem.mixedOptionUncheckInstructions",
|
|
167
|
+
default: "To uncheck this option for all, press Enter twice."
|
|
168
|
+
}),
|
|
169
|
+
excludeInstructions: ___EmotionJSX(EuiI18n, {
|
|
170
|
+
token: "euiSelectableListItem.mixedOptionExcludeInstructions",
|
|
171
|
+
default: "To exclude this option for all, press Enter twice."
|
|
172
|
+
})
|
|
173
|
+
}
|
|
174
|
+
};
|
|
175
|
+
switch (checked) {
|
|
176
|
+
case 'on':
|
|
177
|
+
state = screenReaderStrings.checked.state;
|
|
178
|
+
// eslint-disable-next-line no-nested-ternary
|
|
179
|
+
instructions = allowExclusions ? screenReaderStrings.excluded.instructions : searchable ? screenReaderStrings.unchecked.instructions : undefined;
|
|
180
|
+
break;
|
|
181
|
+
case 'off':
|
|
182
|
+
state = screenReaderStrings.excluded.state;
|
|
183
|
+
instructions = screenReaderStrings.unchecked.instructions;
|
|
184
|
+
break;
|
|
185
|
+
case 'mixed':
|
|
186
|
+
state = screenReaderStrings.mixed.state;
|
|
187
|
+
instructions = ___EmotionJSX(React.Fragment, null, screenReaderStrings.mixed.instructions, ' ', allowExclusions ? screenReaderStrings.mixed.excludeInstructions : screenReaderStrings.mixed.uncheckInstructions);
|
|
188
|
+
break;
|
|
189
|
+
case undefined:
|
|
190
|
+
default:
|
|
191
|
+
instructions = allowExclusions || searchable ? screenReaderStrings.checked.instructions : undefined;
|
|
192
|
+
break;
|
|
128
193
|
}
|
|
129
194
|
var prependNode;
|
|
130
195
|
if (prepend) {
|
|
@@ -161,22 +226,20 @@ export var EuiSelectableListItem = /*#__PURE__*/function (_Component) {
|
|
|
161
226
|
}, append, " ", isFocused && !disabled ? onFocusBadgeNode : null);
|
|
162
227
|
}
|
|
163
228
|
}
|
|
164
|
-
var
|
|
229
|
+
var screenReaderText = (state || instructions) && ___EmotionJSX(EuiScreenReaderOnly, null, ___EmotionJSX("div", null, state || instructions ? '. ' : null, state, state && instructions ? ' ' : null, instructions));
|
|
165
230
|
return ___EmotionJSX("li", _extends({
|
|
166
231
|
role: role,
|
|
167
|
-
"
|
|
168
|
-
,
|
|
169
|
-
"aria-checked": role === 'option' ? isChecked : undefined // Whether the item is "checked"
|
|
232
|
+
"aria-disabled": disabled,
|
|
233
|
+
"aria-checked": this.isChecked(role, checked) // Whether the item is "checked"
|
|
170
234
|
,
|
|
171
235
|
"aria-selected": !disabled && isFocused // Whether the item has keyboard focus per W3 spec
|
|
172
236
|
,
|
|
173
|
-
className: classes
|
|
174
|
-
"aria-disabled": disabled
|
|
237
|
+
className: classes
|
|
175
238
|
}, rest), ___EmotionJSX("span", {
|
|
176
239
|
className: "euiSelectableListItem__content"
|
|
177
240
|
}, optionIcon, prependNode, ___EmotionJSX("span", {
|
|
178
241
|
className: textClasses
|
|
179
|
-
}, children,
|
|
242
|
+
}, children, screenReaderText), appendNode));
|
|
180
243
|
}
|
|
181
244
|
}]);
|
|
182
245
|
return EuiSelectableListItem;
|
|
@@ -42,7 +42,7 @@ export var EuiGlobalStyles = function EuiGlobalStyles(_ref) {
|
|
|
42
42
|
/**
|
|
43
43
|
* Final styles
|
|
44
44
|
*/
|
|
45
|
-
var styles = /*#__PURE__*/css(reset, " html{", scrollbarStyles, " ", fontReset, " text-size-adjust:100%;font-kerning:normal;", logicalCSS('height', '100%'), " background-color:", colors.body, ";color:", colors.text, ";}code,pre,kbd,samp{font-family:", font.familyCode, ";}input,textarea,select{", fontReset, ";}button{font-family:", font.family, ";}em{font-style:italic;}strong{font-weight:", font.weight.bold, ";}*:focus{", euiFocusRing(euiThemeContext), ";}::selection{background:", transparentize(colors.primary, colorMode === 'LIGHT' ? 0.1 : 0.2), ";}a{color:", colors.primaryText, ";&,&:hover,&:focus{text-decoration:none;}}.euiBody-hasPortalContent{position:relative;};label:styles;");
|
|
45
|
+
var styles = /*#__PURE__*/css(reset, " html{", scrollbarStyles, " ", fontReset, " text-size-adjust:100%;font-kerning:normal;", logicalCSS('height', '100%'), " background-color:", colors.body, ";color:", colors.text, ";}code,pre,kbd,samp{font-family:", font.familyCode, ";}input,textarea,select{", fontReset, ";}select:disabled{opacity:1;}button{font-family:", font.family, ";}em{font-style:italic;}strong{font-weight:", font.weight.bold, ";}*:focus{", euiFocusRing(euiThemeContext), ";}::selection{background:", transparentize(colors.primary, colorMode === 'LIGHT' ? 0.1 : 0.2), ";}a{color:", colors.primaryText, ";&,&:hover,&:focus{text-decoration:none;}}.euiBody-hasPortalContent{position:relative;};label:styles;");
|
|
46
46
|
return ___EmotionJSX(Global, {
|
|
47
47
|
styles: styles
|
|
48
48
|
});
|
|
@@ -13,4 +13,10 @@ export var EuiSystemContext = /*#__PURE__*/createContext(EuiThemeAmsterdam);
|
|
|
13
13
|
export var EuiModificationsContext = /*#__PURE__*/createContext({});
|
|
14
14
|
export var EuiColorModeContext = /*#__PURE__*/createContext(DEFAULT_COLOR_MODE);
|
|
15
15
|
export var defaultComputedTheme = getComputed(EuiThemeAmsterdam, {}, DEFAULT_COLOR_MODE);
|
|
16
|
-
export var EuiThemeContext = /*#__PURE__*/createContext(defaultComputedTheme);
|
|
16
|
+
export var EuiThemeContext = /*#__PURE__*/createContext(defaultComputedTheme);
|
|
17
|
+
export var EuiNestedThemeContext = /*#__PURE__*/createContext({
|
|
18
|
+
isGlobalTheme: true,
|
|
19
|
+
hasDifferentColorFromGlobalTheme: false,
|
|
20
|
+
bodyColor: '',
|
|
21
|
+
colorClassName: ''
|
|
22
|
+
});
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* Side Public License, v 1.
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
export { EuiSystemContext, EuiThemeContext, EuiModificationsContext, EuiColorModeContext } from './context';
|
|
9
|
+
export { EuiSystemContext, EuiThemeContext, EuiNestedThemeContext, EuiModificationsContext, EuiColorModeContext } from './context';
|
|
10
10
|
export { useEuiTheme, withEuiTheme, RenderWithEuiTheme } from './hooks';
|
|
11
11
|
export { EuiThemeProvider, getEuiDevProviderWarning, setEuiDevProviderWarning } from './provider';
|
|
12
12
|
export { buildTheme, computed, isInverseColorMode, getColorMode, getComputed, getOn, mergeDeep, setOn, Computed } from './utils';
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
1
3
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
4
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
5
|
+
var _excluded = ["cloneElement", "className"];
|
|
3
6
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
4
7
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
5
8
|
/*
|
|
@@ -10,9 +13,11 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
10
13
|
* Side Public License, v 1.
|
|
11
14
|
*/
|
|
12
15
|
|
|
13
|
-
import React, { useContext, useEffect, useRef, useState } from 'react';
|
|
16
|
+
import React, { useContext, useEffect, useRef, useMemo, useState } from 'react';
|
|
17
|
+
import classNames from 'classnames';
|
|
18
|
+
import { css } from '@emotion/css';
|
|
14
19
|
import isEqual from 'lodash/isEqual';
|
|
15
|
-
import { EuiSystemContext, EuiThemeContext, EuiModificationsContext, EuiColorModeContext } from './context';
|
|
20
|
+
import { EuiSystemContext, EuiThemeContext, EuiNestedThemeContext, EuiModificationsContext, EuiColorModeContext } from './context';
|
|
16
21
|
import { buildTheme, getColorMode, getComputed, mergeDeep } from './utils';
|
|
17
22
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
18
23
|
var providerWarning = undefined;
|
|
@@ -26,7 +31,11 @@ export var EuiThemeProvider = function EuiThemeProvider(_ref) {
|
|
|
26
31
|
var _system = _ref.theme,
|
|
27
32
|
_colorMode = _ref.colorMode,
|
|
28
33
|
_modifications = _ref.modify,
|
|
29
|
-
children = _ref.children
|
|
34
|
+
children = _ref.children,
|
|
35
|
+
wrapperProps = _ref.wrapperProps;
|
|
36
|
+
var _useContext = useContext(EuiNestedThemeContext),
|
|
37
|
+
isGlobalTheme = _useContext.isGlobalTheme,
|
|
38
|
+
bodyColor = _useContext.bodyColor;
|
|
30
39
|
var parentSystem = useContext(EuiSystemContext);
|
|
31
40
|
var parentModifications = useContext(EuiModificationsContext);
|
|
32
41
|
var parentColorMode = useContext(EuiColorModeContext);
|
|
@@ -81,6 +90,37 @@ export var EuiThemeProvider = function EuiThemeProvider(_ref) {
|
|
|
81
90
|
setTheme(getComputed(system, buildTheme(modifications, "_".concat(system.key)), colorMode));
|
|
82
91
|
}
|
|
83
92
|
}, [colorMode, system, modifications]);
|
|
93
|
+
var nestedThemeContext = useMemo(function () {
|
|
94
|
+
return {
|
|
95
|
+
isGlobalTheme: false,
|
|
96
|
+
// The theme that determines the global body styles
|
|
97
|
+
bodyColor: isGlobalTheme ? theme.colors.text : bodyColor,
|
|
98
|
+
hasDifferentColorFromGlobalTheme: isGlobalTheme ? false : bodyColor !== theme.colors.text,
|
|
99
|
+
colorClassName: /*#__PURE__*/css("label:euiColorMode-", _colorMode, ";color:", theme.colors.text, ";;label:colorClassName;")
|
|
100
|
+
};
|
|
101
|
+
}, [theme, isGlobalTheme, bodyColor, _colorMode]);
|
|
102
|
+
var renderedChildren = useMemo(function () {
|
|
103
|
+
if (isGlobalTheme) {
|
|
104
|
+
return children; // No wrapper
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
var _ref2 = wrapperProps || {},
|
|
108
|
+
cloneElement = _ref2.cloneElement,
|
|
109
|
+
className = _ref2.className,
|
|
110
|
+
rest = _objectWithoutProperties(_ref2, _excluded);
|
|
111
|
+
var props = _objectSpread(_objectSpread({}, rest), {}, {
|
|
112
|
+
className: classNames(className, nestedThemeContext.colorClassName)
|
|
113
|
+
});
|
|
114
|
+
if (cloneElement) {
|
|
115
|
+
return /*#__PURE__*/React.cloneElement(children, _objectSpread(_objectSpread({}, props), {}, {
|
|
116
|
+
className: classNames(children.props.className, props.className)
|
|
117
|
+
}));
|
|
118
|
+
} else {
|
|
119
|
+
return ___EmotionJSX("span", _extends({}, props, {
|
|
120
|
+
className: classNames('euiThemeProvider', props.className)
|
|
121
|
+
}), children);
|
|
122
|
+
}
|
|
123
|
+
}, [isGlobalTheme, nestedThemeContext, wrapperProps, children]);
|
|
84
124
|
return ___EmotionJSX(EuiColorModeContext.Provider, {
|
|
85
125
|
value: colorMode
|
|
86
126
|
}, ___EmotionJSX(EuiSystemContext.Provider, {
|
|
@@ -89,5 +129,7 @@ export var EuiThemeProvider = function EuiThemeProvider(_ref) {
|
|
|
89
129
|
value: modifications
|
|
90
130
|
}, ___EmotionJSX(EuiThemeContext.Provider, {
|
|
91
131
|
value: theme
|
|
92
|
-
},
|
|
132
|
+
}, ___EmotionJSX(EuiNestedThemeContext.Provider, {
|
|
133
|
+
value: nestedThemeContext
|
|
134
|
+
}, renderedChildren)))));
|
|
93
135
|
};
|
|
@@ -129,7 +129,10 @@ var _EuiBottomBar = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
|
129
129
|
var EuiBottomBar = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
130
130
|
var BottomBar = _EuiBottomBar;
|
|
131
131
|
return (0, _react2.jsx)(_provider.EuiThemeProvider, {
|
|
132
|
-
colorMode: 'dark'
|
|
132
|
+
colorMode: 'dark',
|
|
133
|
+
wrapperProps: {
|
|
134
|
+
cloneElement: true
|
|
135
|
+
}
|
|
133
136
|
}, (0, _react2.jsx)(BottomBar, (0, _extends2.default)({
|
|
134
137
|
ref: ref
|
|
135
138
|
}, props)));
|
|
@@ -16,8 +16,8 @@ var euiBottomBarStyles = function euiBottomBarStyles(euiThemeContext) {
|
|
|
16
16
|
var euiTheme = euiThemeContext.euiTheme;
|
|
17
17
|
return {
|
|
18
18
|
// Base
|
|
19
|
-
//
|
|
20
|
-
euiBottomBar: /*#__PURE__*/(0, _react.css)((0, _mixins.euiShadowFlat)(euiThemeContext), ";background:", (0, _services.shade)(euiTheme.colors.lightestShade, 0.5), ";
|
|
19
|
+
// `color` is inherited from the wrapping `EuiThemeProvider colorMode="dark"`
|
|
20
|
+
euiBottomBar: /*#__PURE__*/(0, _react.css)((0, _mixins.euiShadowFlat)(euiThemeContext), ";background:", (0, _services.shade)(euiTheme.colors.lightestShade, 0.5), ";", _global_styling.euiCanAnimate, "{animation:", euiBottomBarAppear, " ", euiTheme.animation.slow, " ", euiTheme.animation.resistance, ";};label:euiBottomBar;"),
|
|
21
21
|
static: /*#__PURE__*/(0, _react.css)(";label:static;"),
|
|
22
22
|
fixed: /*#__PURE__*/(0, _react.css)("z-index:", Number(euiTheme.levels.header) - 2, ";;label:fixed;"),
|
|
23
23
|
sticky: /*#__PURE__*/(0, _react.css)("z-index:", Number(euiTheme.levels.header) - 2, ";;label:sticky;"),
|
|
@@ -53,7 +53,10 @@ var EuiButton = function EuiButton(props) {
|
|
|
53
53
|
if (_color === 'ghost') {
|
|
54
54
|
// INCEPTION: If `ghost`, re-implement with a wrapping dark mode theme provider
|
|
55
55
|
return (0, _react2.jsx)(_services.EuiThemeProvider, {
|
|
56
|
-
colorMode: "dark"
|
|
56
|
+
colorMode: "dark",
|
|
57
|
+
wrapperProps: {
|
|
58
|
+
cloneElement: true
|
|
59
|
+
}
|
|
57
60
|
}, (0, _react2.jsx)(EuiButton, (0, _extends2.default)({}, props, {
|
|
58
61
|
color: "text"
|
|
59
62
|
})));
|
|
@@ -78,7 +78,10 @@ var EuiButtonEmpty = function EuiButtonEmpty(props) {
|
|
|
78
78
|
if (_color === 'ghost') {
|
|
79
79
|
// INCEPTION: If `ghost`, re-implement with a wrapping dark mode theme provider
|
|
80
80
|
return (0, _react2.jsx)(_services.EuiThemeProvider, {
|
|
81
|
-
colorMode: "dark"
|
|
81
|
+
colorMode: "dark",
|
|
82
|
+
wrapperProps: {
|
|
83
|
+
cloneElement: true
|
|
84
|
+
}
|
|
82
85
|
}, (0, _react2.jsx)(EuiButtonEmpty, (0, _extends2.default)({}, props, {
|
|
83
86
|
color: "text"
|
|
84
87
|
})));
|
|
@@ -80,7 +80,10 @@ var EuiButtonIcon = function EuiButtonIcon(props) {
|
|
|
80
80
|
if (_color === 'ghost') {
|
|
81
81
|
// INCEPTION: If `ghost`, re-implement with a wrapping dark mode theme provider
|
|
82
82
|
return (0, _react2.jsx)(_services.EuiThemeProvider, {
|
|
83
|
-
colorMode: "dark"
|
|
83
|
+
colorMode: "dark",
|
|
84
|
+
wrapperProps: {
|
|
85
|
+
cloneElement: true
|
|
86
|
+
}
|
|
84
87
|
}, (0, _react2.jsx)(EuiButtonIcon, (0, _extends2.default)({}, props, {
|
|
85
88
|
color: "text"
|
|
86
89
|
})));
|
|
@@ -190,7 +190,7 @@ var EuiComboBoxInput = /*#__PURE__*/function (_Component) {
|
|
|
190
190
|
};
|
|
191
191
|
}
|
|
192
192
|
var icon;
|
|
193
|
-
if (!noIcon) {
|
|
193
|
+
if (!noIcon && !isDisabled) {
|
|
194
194
|
icon = {
|
|
195
195
|
'aria-label': isListOpen ? 'Close list of options' : 'Open list of options',
|
|
196
196
|
'data-test-subj': 'comboBoxToggleListButton',
|