@elastic/eui 123.2.0 → 123.3.0-snapshot.1793244789306
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-icons.json +67 -66
- package/dist/svgs/add_to_chat.svg +3 -5
- package/dist/svgs/product_alert_zero.svg +5 -0
- 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/banner/banner.js +40 -3
- package/es/components/basic_table/basic_table.js +4 -4
- package/es/components/basic_table/in_memory_table.js +4 -4
- package/es/components/button/button_display/_button_display_content.js +1 -1
- package/es/components/button/button_empty/button_empty.js +1 -1
- package/es/components/button/button_icon/button_icon.js +1 -1
- package/es/components/call_out/call_out.js +40 -7
- 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/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_item.js +1 -1
- package/es/components/datagrid/body/cell/data_grid_cell.js +24 -24
- 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/header/data_grid_header_cell.js +12 -12
- package/es/components/datagrid/controls/column_sorting.js +13 -13
- package/es/components/datagrid/controls/column_sorting_draggable.js +1 -1
- package/es/components/datagrid/controls/data_grid_toolbar_control.js +1 -1
- 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/flyout/flyout.component.js +16 -2
- package/es/components/flyout/flyout_menu/flyout_menu.js +2 -2
- package/es/components/flyout/manager/flyout_managed.js +2 -2
- package/es/components/flyout/manager/selectors.js +7 -2
- package/es/components/flyout/use_pushed_flyout_return_focus.js +142 -0
- package/es/components/form/field_number/field_number.js +2 -2
- package/es/components/form/field_text/field_text.js +2 -2
- package/es/components/form/form_control_button/form_control_button.js +1 -1
- package/es/components/form/form_control_layout/append_prepend/form_append_prepend.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/text_area/text_area.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_section/header_section_item_button.js +1 -1
- package/es/components/icon/assets/add_to_chat.js +2 -10
- package/es/components/icon/assets/product_alert_zero.js +33 -0
- package/es/components/icon/icon.js +1 -1
- package/es/components/icon/icon_map.js +5 -0
- package/es/components/icon/svgs/add_to_chat.svg +3 -5
- package/es/components/icon/svgs/product_alert_zero.svg +5 -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/page/page_header/page_header_content.js +1 -1
- package/es/components/pagination/pagination_button.js +1 -1
- package/es/components/selectable/selectable_list/selectable_list.js +1 -1
- package/es/components/selectable/selectable_list/selectable_list_item.js +1 -1
- package/es/components/selectable/selectable_templates/selectable_template_sitewide.js +1 -1
- package/es/components/selectable/selectable_templates/selectable_template_sitewide.styles.js +5 -1
- package/es/components/table/table_header_cell.js +1 -1
- package/es/components/timeline/timeline_item_icon.js +1 -1
- package/es/components/toast/global_toast_list.js +2 -2
- package/es/components/toast/toast.js +2 -2
- package/es/components/token/token.styles.js +10 -4
- package/es/components/tool_tip/icon_tip.js +1 -1
- package/es/services/theme/provider.js +86 -101
- package/eui.d.ts +61 -12
- 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/banner/banner.js +39 -2
- package/lib/components/basic_table/basic_table.js +4 -4
- package/lib/components/basic_table/in_memory_table.js +4 -4
- package/lib/components/button/button_display/_button_display_content.js +1 -1
- package/lib/components/button/button_empty/button_empty.js +1 -1
- package/lib/components/button/button_icon/button_icon.js +1 -1
- package/lib/components/call_out/call_out.js +39 -6
- 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/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_item.js +1 -1
- package/lib/components/datagrid/body/cell/data_grid_cell.js +24 -24
- 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/header/data_grid_header_cell.js +12 -12
- package/lib/components/datagrid/controls/column_sorting.js +13 -13
- package/lib/components/datagrid/controls/column_sorting_draggable.js +1 -1
- package/lib/components/datagrid/controls/data_grid_toolbar_control.js +1 -1
- 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/flyout/flyout.component.js +16 -2
- package/lib/components/flyout/flyout_menu/flyout_menu.js +2 -2
- package/lib/components/flyout/manager/flyout_managed.js +1 -1
- package/lib/components/flyout/manager/selectors.js +8 -3
- package/lib/components/flyout/use_pushed_flyout_return_focus.js +146 -0
- package/lib/components/form/field_number/field_number.js +2 -2
- package/lib/components/form/field_text/field_text.js +2 -2
- package/lib/components/form/form_control_button/form_control_button.js +1 -1
- package/lib/components/form/form_control_layout/append_prepend/form_append_prepend.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/text_area/text_area.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_section/header_section_item_button.js +1 -1
- package/lib/components/icon/assets/add_to_chat.js +2 -10
- package/lib/components/icon/assets/product_alert_zero.js +40 -0
- package/lib/components/icon/icon.js +1 -1
- package/lib/components/icon/icon_map.js +7 -0
- package/lib/components/icon/svgs/add_to_chat.svg +3 -5
- package/lib/components/icon/svgs/product_alert_zero.svg +5 -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/page/page_header/page_header_content.js +1 -1
- package/lib/components/pagination/pagination_button.js +1 -1
- package/lib/components/selectable/selectable_list/selectable_list.js +1 -1
- package/lib/components/selectable/selectable_list/selectable_list_item.js +1 -1
- package/lib/components/selectable/selectable_templates/selectable_template_sitewide.js +1 -1
- package/lib/components/selectable/selectable_templates/selectable_template_sitewide.styles.js +5 -1
- package/lib/components/table/table_header_cell.js +1 -1
- package/lib/components/timeline/timeline_item_icon.js +1 -1
- package/lib/components/toast/global_toast_list.js +2 -2
- package/lib/components/toast/toast.js +2 -2
- package/lib/components/token/token.styles.js +10 -4
- package/lib/components/tool_tip/icon_tip.js +1 -1
- package/lib/services/theme/provider.js +85 -102
- package/optimize/es/components/banner/banner.js +35 -3
- package/optimize/es/components/call_out/call_out.js +33 -5
- package/optimize/es/components/flyout/flyout.component.js +16 -2
- package/optimize/es/components/flyout/manager/flyout_managed.js +2 -2
- package/optimize/es/components/flyout/manager/selectors.js +7 -2
- package/optimize/es/components/flyout/use_pushed_flyout_return_focus.js +142 -0
- package/optimize/es/components/icon/assets/add_to_chat.js +2 -10
- package/optimize/es/components/icon/assets/product_alert_zero.js +32 -0
- package/optimize/es/components/icon/icon_map.js +5 -0
- package/optimize/es/components/icon/svgs/add_to_chat.svg +3 -5
- package/optimize/es/components/icon/svgs/product_alert_zero.svg +5 -0
- package/optimize/es/components/selectable/selectable_templates/selectable_template_sitewide.styles.js +5 -1
- package/optimize/es/components/token/token.styles.js +10 -4
- package/optimize/es/services/theme/provider.js +82 -97
- package/optimize/lib/components/banner/banner.js +34 -2
- package/optimize/lib/components/call_out/call_out.js +32 -4
- package/optimize/lib/components/flyout/flyout.component.js +16 -2
- package/optimize/lib/components/flyout/manager/flyout_managed.js +1 -1
- package/optimize/lib/components/flyout/manager/selectors.js +8 -3
- package/optimize/lib/components/flyout/use_pushed_flyout_return_focus.js +149 -0
- package/optimize/lib/components/icon/assets/add_to_chat.js +2 -10
- package/optimize/lib/components/icon/assets/product_alert_zero.js +40 -0
- package/optimize/lib/components/icon/icon_map.js +7 -0
- package/optimize/lib/components/icon/svgs/add_to_chat.svg +3 -5
- package/optimize/lib/components/icon/svgs/product_alert_zero.svg +5 -0
- package/optimize/lib/components/selectable/selectable_templates/selectable_template_sitewide.styles.js +5 -1
- package/optimize/lib/components/token/token.styles.js +10 -4
- package/optimize/lib/services/theme/provider.js +80 -97
- package/package.json +12 -11
- 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/banner/banner.js +34 -2
- package/test-env/components/basic_table/basic_table.js +4 -4
- package/test-env/components/basic_table/in_memory_table.js +4 -4
- package/test-env/components/button/button_display/_button_display_content.js +1 -1
- package/test-env/components/button/button_empty/button_empty.js +1 -1
- package/test-env/components/button/button_icon/button_icon.js +1 -1
- package/test-env/components/call_out/call_out.js +34 -6
- 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/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_item.js +1 -1
- package/test-env/components/datagrid/body/cell/data_grid_cell.js +24 -24
- 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/header/data_grid_header_cell.js +12 -12
- package/test-env/components/datagrid/controls/column_sorting.js +13 -13
- package/test-env/components/datagrid/controls/column_sorting_draggable.js +1 -1
- package/test-env/components/datagrid/controls/data_grid_toolbar_control.js +1 -1
- 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/flyout/flyout.component.js +16 -2
- package/test-env/components/flyout/flyout_menu/flyout_menu.js +2 -2
- package/test-env/components/flyout/manager/flyout_managed.js +1 -1
- package/test-env/components/flyout/manager/selectors.js +8 -3
- package/test-env/components/flyout/use_pushed_flyout_return_focus.js +149 -0
- package/test-env/components/form/field_number/field_number.js +2 -2
- package/test-env/components/form/field_text/field_text.js +2 -2
- package/test-env/components/form/form_control_button/form_control_button.js +1 -1
- package/test-env/components/form/form_control_layout/append_prepend/form_append_prepend.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/text_area/text_area.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_section/header_section_item_button.js +1 -1
- package/test-env/components/icon/assets/add_to_chat.js +2 -10
- package/test-env/components/icon/assets/product_alert_zero.js +40 -0
- package/test-env/components/icon/icon_map.js +7 -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/page/page_header/page_header_content.js +1 -1
- package/test-env/components/pagination/pagination_button.js +1 -1
- package/test-env/components/selectable/selectable_list/selectable_list.js +1 -1
- package/test-env/components/selectable/selectable_list/selectable_list_item.js +1 -1
- package/test-env/components/selectable/selectable_templates/selectable_template_sitewide.js +1 -1
- package/test-env/components/selectable/selectable_templates/selectable_template_sitewide.styles.js +5 -1
- package/test-env/components/table/table_header_cell.js +1 -1
- package/test-env/components/timeline/timeline_item_icon.js +1 -1
- package/test-env/components/toast/global_toast_list.js +2 -2
- package/test-env/components/toast/toast.js +2 -2
- package/test-env/components/token/token.styles.js +10 -4
- package/test-env/components/tool_tip/icon_tip.js +1 -1
- package/test-env/services/theme/provider.js +80 -97
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import _typeof from "@babel/runtime/helpers/typeof";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
4
|
+
* or more contributor license agreements. Licensed under the Elastic License
|
|
5
|
+
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
|
6
|
+
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
7
|
+
* Side Public License, v 1.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import { useCallback, useLayoutEffect, useRef } from 'react';
|
|
11
|
+
import { PROPERTY_FLYOUT } from './manager/const';
|
|
12
|
+
import { isFlyoutInCurrentSession } from './manager/selectors';
|
|
13
|
+
import { getFlyoutManagerStore } from './manager/store';
|
|
14
|
+
/**
|
|
15
|
+
* Focus returns scheduled by pushed flyouts that just unmounted, keyed by
|
|
16
|
+
* timeout. A flyout mounting before they run (e.g. one remounted by a changed
|
|
17
|
+
* `key`) cancels them, so focus isn't pulled away from a flyout that is open.
|
|
18
|
+
*/
|
|
19
|
+
var pendingReturnFocus = new Map();
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Step 1, at unmount, before the DOM is removed: whether the user left focus
|
|
23
|
+
* somewhere a return is appropriate. Focus in another flyout passes because
|
|
24
|
+
* that flyout may be closing too; step 2 catches it if not.
|
|
25
|
+
*/
|
|
26
|
+
var mayReturnFocusOnUnmount = function mayReturnFocusOnUnmount(isFocusOwned) {
|
|
27
|
+
var active = document.activeElement;
|
|
28
|
+
return isFocusOwned || !active || active === document.body || !!active.closest('.euiFlyout');
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
/** Step 2, once everything closing alongside the flyout has unmounted. */
|
|
32
|
+
var isFocusStranded = function isFocusStranded() {
|
|
33
|
+
var active = document.activeElement;
|
|
34
|
+
return !active || active === document.body || !active.isConnected;
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Inactive managed sessions stay mounted but are moved off-screen, so focus
|
|
39
|
+
* inside one would be invisible.
|
|
40
|
+
*/
|
|
41
|
+
var isInInactiveSession = function isInInactiveSession(element) {
|
|
42
|
+
var owner = element.closest("[".concat(PROPERTY_FLYOUT, "]"));
|
|
43
|
+
return !!owner && !isFlyoutInCurrentSession(getFlyoutManagerStore().getState(), owner.id);
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* A flyout opened while nothing was focused captures `<body>`, which isn't
|
|
48
|
+
* a trigger worth returning to.
|
|
49
|
+
*/
|
|
50
|
+
var isUsableTrigger = function isUsableTrigger(element) {
|
|
51
|
+
return !!element && element.isConnected && element !== document.body;
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
/** Step 3: apply `returnFocus` the way `react-focus-lock` does. */
|
|
55
|
+
var returnFocusToTrigger = function returnFocusToTrigger(trigger, returnFocus) {
|
|
56
|
+
var howToReturnFocus = typeof returnFocus === 'function' ? returnFocus(trigger) : returnFocus;
|
|
57
|
+
if (!howToReturnFocus || !(trigger instanceof HTMLElement) || !isUsableTrigger(trigger) || isInInactiveSession(trigger)) {
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
trigger.focus(_typeof(howToReturnFocus) === 'object' ? howToReturnFocus : undefined);
|
|
61
|
+
};
|
|
62
|
+
/**
|
|
63
|
+
* Returns focus to the trigger element when a pushed flyout unmounts.
|
|
64
|
+
*
|
|
65
|
+
* Pushed flyouts disable their `EuiFocusTrap`, so nothing else returns focus
|
|
66
|
+
* for them. Overlay flyouts are skipped because their active trap already
|
|
67
|
+
* does. Focus is returned only when:
|
|
68
|
+
* - the flyout owned focus, or focus was on `<body>` or in another flyout,
|
|
69
|
+
* when it unmounted, and
|
|
70
|
+
* - after everything closing with it has unmounted, focus is on `<body>` or
|
|
71
|
+
* a removed element, and
|
|
72
|
+
* - `returnFocus` allows it, and the trigger is connected and not in an
|
|
73
|
+
* inactive managed session.
|
|
74
|
+
*
|
|
75
|
+
* Returns `onFocus` and `onBlur` handlers for the flyout element, composed
|
|
76
|
+
* with the ones passed in.
|
|
77
|
+
*/
|
|
78
|
+
export var usePushedFlyoutReturnFocus = function usePushedFlyoutReturnFocus(_ref) {
|
|
79
|
+
var isPushed = _ref.isPushed,
|
|
80
|
+
_ref$returnFocus = _ref.returnFocus,
|
|
81
|
+
returnFocus = _ref$returnFocus === void 0 ? true : _ref$returnFocus,
|
|
82
|
+
triggerRef = _ref.triggerRef,
|
|
83
|
+
_onFocus = _ref.onFocus,
|
|
84
|
+
_onBlur = _ref.onBlur;
|
|
85
|
+
var latest = useRef({
|
|
86
|
+
isPushed: isPushed,
|
|
87
|
+
returnFocus: returnFocus
|
|
88
|
+
});
|
|
89
|
+
latest.current.isPushed = isPushed;
|
|
90
|
+
latest.current.returnFocus = returnFocus;
|
|
91
|
+
|
|
92
|
+
// React focus events bubble through portals, so this also covers focus in
|
|
93
|
+
// content the flyout renders elsewhere in the DOM, such as popovers and
|
|
94
|
+
// child flyouts.
|
|
95
|
+
var isFocusOwnedRef = useRef(false);
|
|
96
|
+
var onFocus = useCallback(function (event) {
|
|
97
|
+
isFocusOwnedRef.current = true;
|
|
98
|
+
_onFocus === null || _onFocus === void 0 || _onFocus(event);
|
|
99
|
+
}, [_onFocus]);
|
|
100
|
+
var onBlur = useCallback(function (event) {
|
|
101
|
+
isFocusOwnedRef.current = false;
|
|
102
|
+
_onBlur === null || _onBlur === void 0 || _onBlur(event);
|
|
103
|
+
}, [_onBlur]);
|
|
104
|
+
useLayoutEffect(function () {
|
|
105
|
+
// A flyout replacing one that just closed captured its trigger after the
|
|
106
|
+
// closing flyout's DOM was removed, which is `<body>` or a removed
|
|
107
|
+
// element, so take over the closing flyout's trigger.
|
|
108
|
+
pendingReturnFocus.forEach(function (pendingTrigger, timeout) {
|
|
109
|
+
clearTimeout(timeout);
|
|
110
|
+
if (!isUsableTrigger(triggerRef.current) && isUsableTrigger(pendingTrigger)) {
|
|
111
|
+
triggerRef.current = pendingTrigger;
|
|
112
|
+
}
|
|
113
|
+
});
|
|
114
|
+
pendingReturnFocus.clear();
|
|
115
|
+
}, [triggerRef]);
|
|
116
|
+
|
|
117
|
+
// Layout cleanup runs before the DOM is removed, while focus still shows
|
|
118
|
+
// where the user left it.
|
|
119
|
+
useLayoutEffect(function () {
|
|
120
|
+
return function () {
|
|
121
|
+
var _latest$current = latest.current,
|
|
122
|
+
isPushed = _latest$current.isPushed,
|
|
123
|
+
returnFocus = _latest$current.returnFocus;
|
|
124
|
+
var trigger = triggerRef.current;
|
|
125
|
+
if (!isPushed || !returnFocus || !trigger) return;
|
|
126
|
+
if (!mayReturnFocusOnUnmount(isFocusOwnedRef.current)) return;
|
|
127
|
+
|
|
128
|
+
// Wait for sibling flyouts in the same history group, portalled
|
|
129
|
+
// content, and child flyout focus traps that pull focus back to
|
|
130
|
+
// themselves before releasing it.
|
|
131
|
+
var timeout = setTimeout(function () {
|
|
132
|
+
pendingReturnFocus.delete(timeout);
|
|
133
|
+
if (isFocusStranded()) returnFocusToTrigger(trigger, returnFocus);
|
|
134
|
+
});
|
|
135
|
+
pendingReturnFocus.set(timeout, trigger);
|
|
136
|
+
};
|
|
137
|
+
}, [triggerRef]);
|
|
138
|
+
return {
|
|
139
|
+
onFocus: onFocus,
|
|
140
|
+
onBlur: onBlur
|
|
141
|
+
};
|
|
142
|
+
};
|
|
@@ -26,17 +26,9 @@ var EuiIconAddToChat = function EuiIconAddToChat(_ref) {
|
|
|
26
26
|
}, props), title ? ___EmotionJSX("title", {
|
|
27
27
|
id: titleId
|
|
28
28
|
}, title) : null, ___EmotionJSX("path", {
|
|
29
|
-
|
|
30
|
-
d: "M8 0a1.5 1.5 0 0 1 .5 2.912V4H11a3 3 0 0 1 3 3h1l.102.005A1 1 0 0 1 16 8v1h-1V8h-1v1h-1V7a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v7h6v1H3a1 1 0 0 1-1-1v-2H1a1 1 0 0 1-1-1V8a1 1 0 0 1 1-1h1a3 3 0 0 1 3-3h2.5V2.912A1.498 1.498 0 0 1 8 0ZM1 11h1V8H1v3ZM8 1a.5.5 0 1 0 0 1 .5.5 0 0 0 0-1Z",
|
|
31
|
-
clipRule: "evenodd"
|
|
29
|
+
d: "M14 13h2v1h-2v2h-1v-2h-2v-1h2v-2h1z"
|
|
32
30
|
}), ___EmotionJSX("path", {
|
|
33
|
-
d: "
|
|
34
|
-
}), ___EmotionJSX("path", {
|
|
35
|
-
fillRule: "evenodd",
|
|
36
|
-
d: "M5.5 7a1.5 1.5 0 1 1 0 3 1.5 1.5 0 0 1 0-3Zm0 1a.5.5 0 1 0 0 1 .5.5 0 0 0 0-1Zm5-1a1.5 1.5 0 1 1 0 3 1.5 1.5 0 0 1 0-3Zm0 1a.5.5 0 1 0 0 1 .5.5 0 0 0 0-1Z",
|
|
37
|
-
clipRule: "evenodd"
|
|
38
|
-
}), ___EmotionJSX("path", {
|
|
39
|
-
d: "M14 13h2v1h-2v2h-1v-2h-2v-1h2v-2h1v2Z"
|
|
31
|
+
d: "M9.389 1c.4 0 .783.116 1.078.328.294.212.533.55.533.972V3h1a3 3 0 0 1 3 3v1h1v2h-2V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2h5v1H4a3 3 0 0 1-3-3v-2H0V7h1V6a3 3 0 0 1 3-3h1v-.7c0-.423.239-.76.533-.972A1.85 1.85 0 0 1 6.611 1zM6 10H5V7h1zm5 0h-1V7h1zM6 3h4V2H6z"
|
|
40
32
|
}));
|
|
41
33
|
};
|
|
42
34
|
export var icon = EuiIconAddToChat;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
+
var _excluded = ["title", "titleId"];
|
|
4
|
+
/*
|
|
5
|
+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
6
|
+
* or more contributor license agreements. Licensed under the Elastic License
|
|
7
|
+
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
|
8
|
+
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
9
|
+
* Side Public License, v 1.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
// THIS IS A GENERATED FILE. DO NOT MODIFY MANUALLY. @see scripts/compile-icons.js
|
|
13
|
+
|
|
14
|
+
import * as React from 'react';
|
|
15
|
+
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
16
|
+
var EuiIconProductAlertZero = function EuiIconProductAlertZero(_ref) {
|
|
17
|
+
var title = _ref.title,
|
|
18
|
+
titleId = _ref.titleId,
|
|
19
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
20
|
+
return ___EmotionJSX("svg", _extends({
|
|
21
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
22
|
+
width: 16,
|
|
23
|
+
height: 16,
|
|
24
|
+
viewBox: "0 0 16 16",
|
|
25
|
+
"aria-labelledby": titleId
|
|
26
|
+
}, props), title ? ___EmotionJSX("title", {
|
|
27
|
+
id: titleId
|
|
28
|
+
}, title) : null, ___EmotionJSX("path", {
|
|
29
|
+
d: "M11.283 14.24A7 7 0 0 1 8 15.053l-.362-.01a7 7 0 0 1-2.976-.833l.642-.793A6 6 0 0 0 8 14.053c.989 0 1.921-.24 2.745-.661zM8 .016a1.486 1.486 0 0 1 .365 2.925v2.084A2.997 2.997 0 0 1 10.995 8l-.003.153a3 3 0 0 1-.231 1.002l1.826 1.055a1.485 1.485 0 1 1-.382.648l-1.82-1.05a2.99 2.99 0 0 1-2.386 1.19l-.154-.005a3 3 0 0 1-2.22-1.166L3.8 10.88a1.485 1.485 0 0 1-2.722 1.125 1.487 1.487 0 0 1 2.35-1.78l1.815-1.048a3 3 0 0 1-.238-1.025L5 8a3 3 0 0 1 2.612-2.974v-2.09A1.485 1.485 0 0 1 8 .016M2.787 11.019a.487.487 0 1 0-.844.487.487.487 0 0 0 .844-.487m11.09-.18a.487.487 0 1 0-.484.844.487.487 0 0 0 .485-.843M8 6.002a1.998 1.998 0 1 0 0 3.997A1.998 1.998 0 0 0 8 6m0-4.985a.487.487 0 1 0 0 .974.487.487 0 0 0 0-.973M4.802 2.878A6.04 6.04 0 0 0 1.955 7.99l-1 .023v-.005A7.04 7.04 0 0 1 4.28 2.023zm6.993-.806a7.04 7.04 0 0 1 3.249 5.925l-1 .006a6.04 6.04 0 0 0-2.835-5.117z"
|
|
30
|
+
}));
|
|
31
|
+
};
|
|
32
|
+
export var icon = EuiIconProductAlertZero;
|
|
@@ -1907,6 +1907,11 @@ export var typeToPathMap = {
|
|
|
1907
1907
|
}, {
|
|
1908
1908
|
synonyms: ['agent', 'product', 'elastic agent', 'fleet', 'monitoring']
|
|
1909
1909
|
}),
|
|
1910
|
+
productAlertZero: withMetadata(function () {
|
|
1911
|
+
return import('./assets/product_alert_zero');
|
|
1912
|
+
}, {
|
|
1913
|
+
synonyms: ['alertzero', 'alert', 'zero', 'attack', 'security']
|
|
1914
|
+
}),
|
|
1910
1915
|
productCanvas: withMetadata(function () {
|
|
1911
1916
|
return import('./assets/product_canvas');
|
|
1912
1917
|
}, {
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16">
|
|
2
|
-
<path
|
|
3
|
-
<path d="
|
|
4
|
-
|
|
5
|
-
<path d="M14 13h2v1h-2v2h-1v-2h-2v-1h2v-2h1v2Z"/>
|
|
6
|
-
</svg>
|
|
2
|
+
<path d="M14 13h2v1h-2v2h-1v-2h-2v-1h2v-2h1z"/>
|
|
3
|
+
<path d="M9.389 1c.4 0 .783.116 1.078.328.294.212.533.55.533.972V3h1a3 3 0 0 1 3 3v1h1v2h-2V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2h5v1H4a3 3 0 0 1-3-3v-2H0V7h1V6a3 3 0 0 1 3-3h1v-.7c0-.423.239-.76.533-.972A1.85 1.85 0 0 1 6.611 1zM6 10H5V7h1zm5 0h-1V7h1zM6 3h4V2H6z"/>
|
|
4
|
+
</svg>
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16">
|
|
2
|
+
<path d="M11.283 14.24A7 7 0 0 1 8 15.053l-.362-.01a7 7 0 0 1-2.976-.833l.642-.793A6 6 0 0 0 8 14.053c.989 0 1.921-.24 2.745-.661z"/>
|
|
3
|
+
<path d="M8 .016a1.486 1.486 0 0 1 .365 2.925v2.084A2.997 2.997 0 0 1 10.995 8l-.003.153a3 3 0 0 1-.231 1.002l1.826 1.055a1.485 1.485 0 1 1-.382.648l-1.82-1.05a2.99 2.99 0 0 1-2.386 1.19l-.154-.005a3 3 0 0 1-2.22-1.166L3.8 10.88a1.485 1.485 0 0 1-2.722 1.125 1.487 1.487 0 0 1 2.35-1.78l1.815-1.048a3 3 0 0 1-.238-1.025L5 8a3 3 0 0 1 2.612-2.974v-2.09A1.485 1.485 0 0 1 8 .016M2.787 11.019a.487.487 0 1 0-.844.487.487.487 0 0 0 .844-.487m11.09-.18a.487.487 0 1 0-.484.844.487.487 0 0 0 .485-.843M8 6.002a1.998 1.998 0 1 0 0 3.997A1.998 1.998 0 0 0 8 6m0-4.985a.487.487 0 1 0 0 .974.487.487 0 0 0 0-.973"/>
|
|
4
|
+
<path d="M4.802 2.878A6.04 6.04 0 0 0 1.955 7.99l-1 .023v-.005A7.04 7.04 0 0 1 4.28 2.023zm6.993-.806a7.04 7.04 0 0 1 3.249 5.925l-1 .006a6.04 6.04 0 0 0-2.835-5.117z"/>
|
|
5
|
+
</svg>
|
|
@@ -20,7 +20,11 @@ var _ref = process.env.NODE_ENV === "production" ? {
|
|
|
20
20
|
};
|
|
21
21
|
export var euiSelectableTemplateSitewideStyles = function euiSelectableTemplateSitewideStyles(euiThemeContext) {
|
|
22
22
|
var euiTheme = euiThemeContext.euiTheme;
|
|
23
|
-
|
|
23
|
+
|
|
24
|
+
// Pass the theme's vis colors explicitly - see the note in token.styles.ts
|
|
25
|
+
var visColors = euiPaletteColorBlind({
|
|
26
|
+
colors: euiTheme.colors.vis
|
|
27
|
+
});
|
|
24
28
|
return {
|
|
25
29
|
euiSelectableTemplateSitewide: _ref,
|
|
26
30
|
euiSelectableTemplateSitewide__optionMetasList: /*#__PURE__*/css("display:block;", euiFontSize(euiThemeContext, 'xs'), " color:", euiTheme.colors.textSubdued, ";;label:euiSelectableTemplateSitewide__optionMetasList;"),
|
|
@@ -18,10 +18,16 @@ var getTokenColor = function getTokenColor(euiThemeContext, fill, color) {
|
|
|
18
18
|
var euiTheme = euiThemeContext.euiTheme,
|
|
19
19
|
colorMode = euiThemeContext.colorMode,
|
|
20
20
|
highContrastMode = euiThemeContext.highContrastMode;
|
|
21
|
-
//
|
|
22
|
-
//
|
|
23
|
-
|
|
24
|
-
|
|
21
|
+
// Pass the theme's vis colors explicitly rather than letting these fall back to
|
|
22
|
+
// EUI_VIS_COLOR_STORE - the store is only updated in an effect, so on the first
|
|
23
|
+
// render it can still hold the previous theme's palette. Memoized styles are not
|
|
24
|
+
// regenerated for a store update, so those colors would stay stale.
|
|
25
|
+
var visColors = euiPaletteColorBlind({
|
|
26
|
+
colors: euiTheme.colors.vis
|
|
27
|
+
});
|
|
28
|
+
var visColorsBehindText = euiPaletteColorBlindBehindText({
|
|
29
|
+
colors: euiTheme.colors.vis
|
|
30
|
+
});
|
|
25
31
|
var isVizColor = typeof color === 'number';
|
|
26
32
|
var iconColor = isVizColor ? visColors[color] : euiTheme.colors.darkShade;
|
|
27
33
|
var isDarkMode = colorMode === 'DARK';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
3
|
import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
|
|
4
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
5
4
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
5
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
6
6
|
import { css as _css } from "@emotion/react";
|
|
7
7
|
var _excluded = ["cloneElement", "className"];
|
|
8
8
|
var _templateObject;
|
|
@@ -28,7 +28,25 @@ import { EuiThemeMemoizedStylesProvider } from './style_memoization';
|
|
|
28
28
|
import { useHighContrastModifications } from './high_contrast_overrides';
|
|
29
29
|
import { buildTheme, getColorMode, getComputed, mergeDeep } from './utils';
|
|
30
30
|
import { EUI_VIS_COLOR_STORE } from '../color';
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Caches `value` during render, only swapping in a new one once `isSame`
|
|
34
|
+
* reports that it actually differs from the cached one.
|
|
35
|
+
*
|
|
36
|
+
* This keeps derived objects referentially stable (so that the - comparatively
|
|
37
|
+
* expensive - theme computation isn't rerun on every render) without deferring
|
|
38
|
+
* them to a `useEffect`/`setState` pair. Effect-synchronised state costs an
|
|
39
|
+
* extra commit, in which consumers would see e.g. an updated `colorMode`
|
|
40
|
+
* alongside a theme that is still computed from the previous one.
|
|
41
|
+
*/
|
|
31
42
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
43
|
+
var useStableValue = function useStableValue(value, isSame) {
|
|
44
|
+
var ref = useRef(value);
|
|
45
|
+
if (ref.current !== value && !isSame(ref.current, value)) {
|
|
46
|
+
ref.current = value;
|
|
47
|
+
}
|
|
48
|
+
return ref.current;
|
|
49
|
+
};
|
|
32
50
|
export var EuiThemeProvider = function EuiThemeProvider(_ref) {
|
|
33
51
|
var _system = _ref.theme,
|
|
34
52
|
_colorMode = _ref.colorMode,
|
|
@@ -57,118 +75,85 @@ export var EuiThemeProvider = function EuiThemeProvider(_ref) {
|
|
|
57
75
|
var EuiConditionalBreakpointProvider = useMemo(function () {
|
|
58
76
|
return isGlobalTheme || _modifications !== null && _modifications !== void 0 && _modifications.breakpoint ? CurrentEuiBreakpointProvider : Fragment;
|
|
59
77
|
}, [isGlobalTheme, _modifications]);
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
var
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
var
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
var prevColorMode = useRef(colorMode);
|
|
78
|
+
|
|
79
|
+
// Every value below is derived from props/parent context during render, so
|
|
80
|
+
// that all context values this provider exposes - most notably `colorMode`
|
|
81
|
+
// and the computed `theme` - always change within the same commit
|
|
82
|
+
var system = useStableValue(_system || parentSystem, function (previous, next) {
|
|
83
|
+
return previous.key === next.key;
|
|
84
|
+
});
|
|
85
|
+
var mergedModifications = useMemo(function () {
|
|
86
|
+
return mergeDeep(parentModifications, _modifications);
|
|
87
|
+
}, [parentModifications, _modifications]);
|
|
88
|
+
var modifications = useStableValue(mergedModifications, isEqual);
|
|
89
|
+
var colorMode = useMemo(function () {
|
|
90
|
+
return getColorMode(_colorMode, parentColorMode, isForced);
|
|
91
|
+
}, [_colorMode, parentColorMode, isForced]);
|
|
75
92
|
var highContrastMode = useMemo(function () {
|
|
76
93
|
if (isForced) return 'forced'; // System forced high contrast mode will always supercede application settings
|
|
77
94
|
if (_highContrastMode === true) return 'preferred'; // Convert the boolean prop to our internal enum
|
|
78
95
|
if (_highContrastMode === false) return false; // Allow `false` prop to override user/system preference
|
|
79
96
|
return parentHighContrastMode; // Fall back to the parent/system setting
|
|
80
97
|
}, [_highContrastMode, parentHighContrastMode, isForced]);
|
|
81
|
-
var prevHighContrastMode = useRef(highContrastMode);
|
|
82
98
|
var modificationsWithHighContrast = useHighContrastModifications({
|
|
83
99
|
highContrastMode: highContrastMode,
|
|
84
100
|
colorMode: colorMode,
|
|
85
101
|
system: system,
|
|
86
102
|
modifications: modifications
|
|
87
103
|
});
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
104
|
+
|
|
105
|
+
// If this provider resolves to the exact same theme as its parent, the
|
|
106
|
+
// already computed parent theme can be reused instead of recomputing it
|
|
107
|
+
var isParentTheme = useMemo(function () {
|
|
108
|
+
return isGlobalTheme ? system.key === DEFAULTS.system.key && colorMode === DEFAULTS.colorMode && highContrastMode === DEFAULTS.highContrastMode && !_modifications : system.key === parentSystem.key && colorMode === parentColorMode && highContrastMode === parentHighContrastMode && isEqual(parentModifications, modifications);
|
|
109
|
+
}, [isGlobalTheme, system, colorMode, highContrastMode, _modifications, parentSystem, parentColorMode, parentHighContrastMode, parentModifications, modifications]);
|
|
110
|
+
|
|
111
|
+
// Depending on `parentTheme` itself would recompute this provider's theme every
|
|
112
|
+
// time the parent's did, even where the parent's theme is not an input to it -
|
|
113
|
+
// `parentModifications` already reaches `getComputed` through `modifications`
|
|
114
|
+
var reusableParentTheme = isParentTheme && Object.keys(parentTheme).length ? parentTheme : null;
|
|
115
|
+
var theme = useMemo(function () {
|
|
116
|
+
if (reusableParentTheme) {
|
|
117
|
+
return _objectSpread({}, reusableParentTheme); // Intentionally create a new object to break referential equality
|
|
92
118
|
}
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
119
|
+
|
|
120
|
+
/* Enables recomputation of component colors when flags are overridden on the provider
|
|
121
|
+
by adding the respective key to modifications to trigger a recomputation. */
|
|
122
|
+
// NOTE: Keeping this as placeholder for potential future usage during Borealis changes
|
|
123
|
+
// TODO: remove once visual refresh is completed and flags are obsolete
|
|
124
|
+
var flagsToRecompute = [];
|
|
125
|
+
var keys = {};
|
|
126
|
+
var forceRecomputeComponents = flagsToRecompute.some(function (item) {
|
|
127
|
+
var _modifications$flags, _modifications$compon;
|
|
128
|
+
if (!item) return false;
|
|
129
|
+
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)) {
|
|
130
|
+
keys[item.componentKey] = {
|
|
131
|
+
LIGHT: {},
|
|
132
|
+
DARK: {}
|
|
133
|
+
};
|
|
134
|
+
return true;
|
|
135
|
+
}
|
|
136
|
+
return false;
|
|
98
137
|
});
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
var newSystem = _system || parentSystem;
|
|
108
|
-
if (prevSystemKey.current !== newSystem.key) {
|
|
109
|
-
setSystem(newSystem);
|
|
110
|
-
prevSystemKey.current = newSystem.key;
|
|
111
|
-
isParentTheme.current = false;
|
|
112
|
-
}
|
|
113
|
-
}, [_system, parentSystem, theme, updateVisColorStore]);
|
|
114
|
-
useEffect(function () {
|
|
115
|
-
updateVisColorStore(theme, isGlobalTheme);
|
|
116
|
-
}, [theme, colorMode, isGlobalTheme, updateVisColorStore]);
|
|
117
|
-
useEffect(function () {
|
|
118
|
-
var newModifications = mergeDeep(parentModifications, _modifications);
|
|
119
|
-
if (!isEqual(prevModifications.current, newModifications)) {
|
|
120
|
-
setModifications(newModifications);
|
|
121
|
-
prevModifications.current = newModifications;
|
|
122
|
-
isParentTheme.current = false;
|
|
123
|
-
}
|
|
124
|
-
}, [_modifications, parentModifications]);
|
|
125
|
-
useEffect(function () {
|
|
126
|
-
var newColorMode = getColorMode(_colorMode, parentColorMode, isForced);
|
|
127
|
-
if (!isEqual(newColorMode, prevColorMode.current)) {
|
|
128
|
-
setColorMode(newColorMode);
|
|
129
|
-
prevColorMode.current = newColorMode;
|
|
130
|
-
isParentTheme.current = false;
|
|
131
|
-
}
|
|
132
|
-
}, [_colorMode, parentColorMode, isForced]);
|
|
133
|
-
useEffect(function () {
|
|
134
|
-
if (prevHighContrastMode.current !== highContrastMode) {
|
|
135
|
-
isParentTheme.current = false;
|
|
136
|
-
}
|
|
137
|
-
}, [highContrastMode]);
|
|
138
|
-
useEffect(function () {
|
|
139
|
-
if (!isParentTheme.current) {
|
|
140
|
-
/* Enables recomputation of component colors when flags are overridden on the provider
|
|
141
|
-
by adding the respective key to modifications to trigger a recomputation. */
|
|
142
|
-
// NOTE: Keeping this as placeholder for potential future usage during Borealis changes
|
|
143
|
-
// TODO: remove once visual refresh is completed and flags are obsolete
|
|
144
|
-
var flagsToRecompute = [];
|
|
145
|
-
var keys = {};
|
|
146
|
-
var forceRecomputeComponents = flagsToRecompute.some(function (item) {
|
|
147
|
-
var _modifications$flags, _modifications$compon;
|
|
148
|
-
if (!item) return false;
|
|
149
|
-
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)) {
|
|
150
|
-
keys[item.componentKey] = {
|
|
151
|
-
LIGHT: {},
|
|
152
|
-
DARK: {}
|
|
153
|
-
};
|
|
154
|
-
return true;
|
|
155
|
-
}
|
|
156
|
-
return false;
|
|
157
|
-
});
|
|
158
|
-
var componentModifications = forceRecomputeComponents ? {
|
|
159
|
-
components: keys
|
|
160
|
-
} : {};
|
|
138
|
+
var componentModifications = forceRecomputeComponents ? {
|
|
139
|
+
components: keys
|
|
140
|
+
} : {};
|
|
141
|
+
|
|
142
|
+
// force recomputing of color & component tokens based on flag changes
|
|
143
|
+
var enhancedModifications = _objectSpread(_objectSpread({}, modificationsWithHighContrast), componentModifications);
|
|
144
|
+
return getComputed(system, buildTheme(enhancedModifications, "_".concat(system.key)), colorMode, highContrastMode);
|
|
145
|
+
}, [reusableParentTheme, system, colorMode, highContrastMode, modifications, modificationsWithHighContrast]);
|
|
161
146
|
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
147
|
+
// Genuine side effect - the vis color store is consumed outside of React
|
|
148
|
+
useEffect(function () {
|
|
149
|
+
if (isGlobalTheme) {
|
|
150
|
+
EUI_VIS_COLOR_STORE.setVisColors(theme.colors.vis);
|
|
166
151
|
}
|
|
167
|
-
}, [
|
|
168
|
-
var
|
|
169
|
-
|
|
170
|
-
themeCSSVariables =
|
|
171
|
-
_setThemeCSSVariables =
|
|
152
|
+
}, [theme, isGlobalTheme]);
|
|
153
|
+
var _useState = useState(),
|
|
154
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
155
|
+
themeCSSVariables = _useState2[0],
|
|
156
|
+
_setThemeCSSVariables = _useState2[1];
|
|
172
157
|
var setThemeCSSVariables = useCallback(function (variables) {
|
|
173
158
|
return _setThemeCSSVariables(function (previous) {
|
|
174
159
|
var merged = _objectSpread(_objectSpread({}, previous), variables);
|
|
@@ -7,6 +7,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
});
|
|
8
8
|
exports.EuiBanner = void 0;
|
|
9
9
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
10
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
10
11
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
11
12
|
var _react = _interopRequireWildcard(require("react"));
|
|
12
13
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
@@ -61,6 +62,29 @@ var EuiBanner = exports.EuiBanner = /*#__PURE__*/(0, _react.forwardRef)(function
|
|
|
61
62
|
var primaryActionProps = actionProps === null || actionProps === void 0 ? void 0 : actionProps.primary;
|
|
62
63
|
var secondaryActionProps = actionProps === null || actionProps === void 0 ? void 0 : actionProps.secondary;
|
|
63
64
|
var hasActions = Boolean(primaryActionProps) || Boolean(secondaryActionProps);
|
|
65
|
+
var titleRef = (0, _react.useRef)(null);
|
|
66
|
+
var contentRef = (0, _react.useRef)(null);
|
|
67
|
+
var _useState = (0, _react.useState)(''),
|
|
68
|
+
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
69
|
+
announcement = _useState2[0],
|
|
70
|
+
setAnnouncement = _useState2[1];
|
|
71
|
+
(0, _react.useEffect)(function () {
|
|
72
|
+
var content = contentRef.current;
|
|
73
|
+
if (!announceOnMount || !content) {
|
|
74
|
+
setAnnouncement('');
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
// `EuiText` does not forward refs. The text slot is the first direct
|
|
79
|
+
// `.euiText` child, since `children` render after it.
|
|
80
|
+
var textNode = text ? Array.from(content.children).find(function (node) {
|
|
81
|
+
return node.classList.contains('euiText');
|
|
82
|
+
}) : undefined;
|
|
83
|
+
var childrenText = Array.from(content.childNodes).filter(function (node) {
|
|
84
|
+
return node !== titleRef.current && node !== textNode;
|
|
85
|
+
}).map(readText).filter(Boolean).join(' ');
|
|
86
|
+
setAnnouncement([readText(titleRef.current), readText(textNode), childrenText].filter(Boolean).join(",\xA0"));
|
|
87
|
+
}, [announceOnMount, title, text, children]);
|
|
64
88
|
var componentClass = 'euiBanner';
|
|
65
89
|
var classes = (0, _classnames.default)(componentClass, className);
|
|
66
90
|
var backgroundColorStyles = (0, _global_styling.useEuiBackgroundColorCSS)()[color];
|
|
@@ -84,11 +108,13 @@ var EuiBanner = exports.EuiBanner = /*#__PURE__*/(0, _react.forwardRef)(function
|
|
|
84
108
|
className: "".concat(componentClass, "__body"),
|
|
85
109
|
css: styles.body
|
|
86
110
|
}, (0, _react2.jsx)("div", {
|
|
111
|
+
ref: contentRef,
|
|
87
112
|
className: "".concat(componentClass, "__content"),
|
|
88
113
|
css: styles.content
|
|
89
114
|
}, (0, _react2.jsx)(_title.EuiTitle, {
|
|
90
115
|
size: headingSize
|
|
91
116
|
}, (0, _react2.jsx)(Heading, {
|
|
117
|
+
ref: titleRef,
|
|
92
118
|
css: styles.title,
|
|
93
119
|
"data-test-subj": "".concat(dataTestSubj, "-title")
|
|
94
120
|
}, title)), onDismiss ? (0, _react2.jsx)(_button.EuiButtonIcon, (0, _extends2.default)({
|
|
@@ -118,6 +144,12 @@ var EuiBanner = exports.EuiBanner = /*#__PURE__*/(0, _react.forwardRef)(function
|
|
|
118
144
|
}, secondaryActionProps, {
|
|
119
145
|
color: "primary",
|
|
120
146
|
size: "s"
|
|
121
|
-
})) : null) : null)),
|
|
147
|
+
})) : null) : null)), announcement ? (0, _react2.jsx)(_accessibility.EuiLiveAnnouncer, null, announcement) : null);
|
|
122
148
|
});
|
|
123
|
-
EuiBanner.displayName = 'EuiBanner';
|
|
149
|
+
EuiBanner.displayName = 'EuiBanner';
|
|
150
|
+
|
|
151
|
+
// jsdom has no `innerText`, so tests read `textContent`
|
|
152
|
+
var readText = function readText(node) {
|
|
153
|
+
var _ref2, _innerText;
|
|
154
|
+
return (_ref2 = (_innerText = node === null || node === void 0 ? void 0 : node.innerText) !== null && _innerText !== void 0 ? _innerText : node === null || node === void 0 ? void 0 : node.textContent) === null || _ref2 === void 0 ? void 0 : _ref2.trim();
|
|
155
|
+
};
|
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
8
|
exports.EuiCallOut = exports.COLOR_TO_NOTIFICATION_ICON_MAP = void 0;
|
|
9
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
9
10
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
10
11
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
12
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
@@ -174,9 +175,35 @@ var EuiCallOut = exports.EuiCallOut = /*#__PURE__*/(0, _react.forwardRef)(functi
|
|
|
174
175
|
"data-test-subj": dataTestSubj && "".concat(dataTestSubj, "__actions")
|
|
175
176
|
}, actionPrimary, actionSecondary);
|
|
176
177
|
}, [actionProps, color, styles, dataTestSubj]);
|
|
177
|
-
var
|
|
178
|
-
|
|
179
|
-
|
|
178
|
+
var contentRef = (0, _react.useRef)(null);
|
|
179
|
+
var _useState = (0, _react.useState)(''),
|
|
180
|
+
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
181
|
+
announcement = _useState2[0],
|
|
182
|
+
setAnnouncement = _useState2[1];
|
|
183
|
+
(0, _react.useEffect)(function () {
|
|
184
|
+
var content = contentRef.current;
|
|
185
|
+
if (!announceOnMount || !content) {
|
|
186
|
+
setAnnouncement('');
|
|
187
|
+
return;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
// Read the nodes already on screen. The live region gets that text,
|
|
191
|
+
// not a second copy of the React tree. Only direct slots are read, so a
|
|
192
|
+
// callout nested in `children` is not picked up as this one's slots.
|
|
193
|
+
// Not `:scope >`: jsdom resolves `:scope` by tag and class, which the
|
|
194
|
+
// nested callout's content shares.
|
|
195
|
+
var parts = Array.from(content.children).filter(function (_ref2) {
|
|
196
|
+
var classList = _ref2.classList;
|
|
197
|
+
return ['euiCallOutHeader__title', 'euiCallOut__text', 'euiCallOut__additionalContent'].some(function (className) {
|
|
198
|
+
return classList.contains(className);
|
|
199
|
+
});
|
|
200
|
+
})
|
|
201
|
+
// jsdom has no `innerText`, so tests read `textContent`
|
|
202
|
+
.map(function (node) {
|
|
203
|
+
var _ref3, _node$innerText;
|
|
204
|
+
return (_ref3 = (_node$innerText = node.innerText) !== null && _node$innerText !== void 0 ? _node$innerText : node.textContent) === null || _ref3 === void 0 ? void 0 : _ref3.trim();
|
|
205
|
+
}).filter(Boolean);
|
|
206
|
+
setAnnouncement(parts.join(",\xA0"));
|
|
180
207
|
}, [announceOnMount, title, text, children]);
|
|
181
208
|
return (0, _react2.jsx)(_panel.EuiPanel, (0, _extends2.default)({
|
|
182
209
|
borderRadius: "none",
|
|
@@ -196,11 +223,12 @@ var EuiCallOut = exports.EuiCallOut = /*#__PURE__*/(0, _react.forwardRef)(functi
|
|
|
196
223
|
}, (0, _react2.jsx)("div", {
|
|
197
224
|
css: styles.body
|
|
198
225
|
}, icon, (0, _react2.jsx)("div", {
|
|
226
|
+
ref: contentRef,
|
|
199
227
|
css: styles.content
|
|
200
228
|
},
|
|
201
229
|
// Note: the DOM position of the dismiss button matters to screen reader users.
|
|
202
230
|
// We generally want them to have some context of _what_ they're dismissing,
|
|
203
231
|
// instead of navigating to the dismiss button first before the callout content
|
|
204
|
-
header && optionalChildren ? (0, _react2.jsx)(_react.default.Fragment, null, header, dismissButton, optionalChildren) : (0, _react2.jsx)(_react.default.Fragment, null, header || optionalChildren, dismissButton))), actionControls, announcement));
|
|
232
|
+
header && optionalChildren ? (0, _react2.jsx)(_react.default.Fragment, null, header, dismissButton, optionalChildren) : (0, _react2.jsx)(_react.default.Fragment, null, header || optionalChildren, dismissButton))), actionControls, announcement ? (0, _react2.jsx)(_live_announcer.EuiLiveAnnouncer, null, announcement) : null));
|
|
205
233
|
});
|
|
206
234
|
EuiCallOut.displayName = 'EuiCallOut';
|