@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
|
@@ -25,6 +25,7 @@ var _flyout = require("./flyout.styles");
|
|
|
25
25
|
var _component_defaults = require("../provider/component_defaults");
|
|
26
26
|
var _const2 = require("./const");
|
|
27
27
|
var _hooks = require("./hooks");
|
|
28
|
+
var _use_pushed_flyout_return_focus = require("./use_pushed_flyout_return_focus");
|
|
28
29
|
var _flyout_menu = require("./flyout_menu");
|
|
29
30
|
var _flyout_overlay = require("./_flyout_overlay");
|
|
30
31
|
var _flyout_resize_button = require("./_flyout_resize_button");
|
|
@@ -33,7 +34,7 @@ var _use_flyout_z_index = require("./use_flyout_z_index");
|
|
|
33
34
|
var _flyout_parent_context = require("./flyout_parent_context");
|
|
34
35
|
var _use_flyout_menu = require("./use_flyout_menu");
|
|
35
36
|
var _react2 = require("@emotion/react");
|
|
36
|
-
var _excluded = ["className", "children", "as", "hideCloseButton", "flyoutMenuProps", "flyoutMenuDisplayMode", "closeButtonProps", "closeButtonPosition", "onClose", "ownFocus", "side", "size", "paddingSize", "maxWidth", "style", "hasChildBackground", "maskProps", "type", "outsideClickCloses", "pushMinBreakpoint", "pushAnimation", "hasAnimation", "focusTrapProps", "includeFixedHeadersInFocusTrap", "includeSelectorInFocusTrap", "aria-describedby", "aria-labelledby", "id", "resizable", "minWidth", "onResize", "onAnimationEnd", "scrollContainerRef", "container"];
|
|
37
|
+
var _excluded = ["className", "children", "as", "hideCloseButton", "flyoutMenuProps", "flyoutMenuDisplayMode", "closeButtonProps", "closeButtonPosition", "onClose", "ownFocus", "side", "size", "paddingSize", "maxWidth", "style", "hasChildBackground", "maskProps", "type", "outsideClickCloses", "pushMinBreakpoint", "pushAnimation", "hasAnimation", "focusTrapProps", "includeFixedHeadersInFocusTrap", "includeSelectorInFocusTrap", "aria-describedby", "aria-labelledby", "id", "resizable", "minWidth", "onResize", "onAnimationEnd", "onFocus", "onBlur", "scrollContainerRef", "container"];
|
|
37
38
|
/*
|
|
38
39
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
39
40
|
* or more contributor license agreements. Licensed under the Elastic License
|
|
@@ -156,6 +157,8 @@ var EuiFlyoutComponent = exports.EuiFlyoutComponent = /*#__PURE__*/(0, _react.fo
|
|
|
156
157
|
minWidth = _usePropsWithComponen.minWidth,
|
|
157
158
|
onResize = _usePropsWithComponen.onResize,
|
|
158
159
|
onAnimationEnd = _usePropsWithComponen.onAnimationEnd,
|
|
160
|
+
_onFocus = _usePropsWithComponen.onFocus,
|
|
161
|
+
_onBlur = _usePropsWithComponen.onBlur,
|
|
159
162
|
scrollContainerRef = _usePropsWithComponen.scrollContainerRef,
|
|
160
163
|
containerProp = _usePropsWithComponen.container,
|
|
161
164
|
rest = (0, _objectWithoutProperties2.default)(_usePropsWithComponen, _excluded);
|
|
@@ -625,6 +628,15 @@ var EuiFlyoutComponent = exports.EuiFlyoutComponent = /*#__PURE__*/(0, _react.fo
|
|
|
625
628
|
_useState6 = (0, _slicedToArray2.default)(_useState5, 2),
|
|
626
629
|
focusTrapShards = _useState6[0],
|
|
627
630
|
setFocusTrapShards = _useState6[1];
|
|
631
|
+
var _usePushedFlyoutRetur = (0, _use_pushed_flyout_return_focus.usePushedFlyoutReturnFocus)({
|
|
632
|
+
isPushed: isPushed,
|
|
633
|
+
returnFocus: _focusTrapProps === null || _focusTrapProps === void 0 ? void 0 : _focusTrapProps.returnFocus,
|
|
634
|
+
triggerRef: flyoutToggle,
|
|
635
|
+
onFocus: _onFocus,
|
|
636
|
+
onBlur: _onBlur
|
|
637
|
+
}),
|
|
638
|
+
onFocus = _usePushedFlyoutRetur.onFocus,
|
|
639
|
+
onBlur = _usePushedFlyoutRetur.onBlur;
|
|
628
640
|
var isSideBySideChild = isChildFlyout && layoutMode === _const.LAYOUT_MODE_SIDE_BY_SIDE;
|
|
629
641
|
// Side-by-side: main + child form a single modal unit; only main has aria-modal
|
|
630
642
|
// to avoid competing dialog semantics. Stacked children are independent modals.
|
|
@@ -780,7 +792,9 @@ var EuiFlyoutComponent = exports.EuiFlyoutComponent = /*#__PURE__*/(0, _react.fo
|
|
|
780
792
|
"aria-describedby": !isPushed ? ariaDescribedBy : _ariaDescribedBy,
|
|
781
793
|
"aria-labelledby": ariaLabelledBy,
|
|
782
794
|
"data-autofocus": !isPushed || undefined,
|
|
783
|
-
onAnimationEnd: onAnimationEnd
|
|
795
|
+
onAnimationEnd: onAnimationEnd,
|
|
796
|
+
onFocus: onFocus,
|
|
797
|
+
onBlur: onBlur
|
|
784
798
|
}), !isPushed && screenReaderDescription, shouldRenderMenu ? (0, _react2.jsx)(_flyout_menu.EuiFlyoutMenu, (0, _extends2.default)({}, flyoutMenuProps, {
|
|
785
799
|
titleId: flyoutMenuId
|
|
786
800
|
})) : !hideCloseButton && (0, _react2.jsx)(_flyout_close_button.EuiFlyoutCloseButton, (0, _extends2.default)({}, closeButtonProps, {
|
|
@@ -97,7 +97,7 @@ var EuiManagedFlyout = exports.EuiManagedFlyout = /*#__PURE__*/(0, _react.forwar
|
|
|
97
97
|
var managerSessions = managerState === null || managerState === void 0 ? void 0 : managerState.sessions;
|
|
98
98
|
var currentSession = managerSessions ? (_managerSessions = managerSessions[managerSessions.length - 1]) !== null && _managerSessions !== void 0 ? _managerSessions : null : null;
|
|
99
99
|
var layoutMode = (_managerState$layoutM = managerState === null || managerState === void 0 ? void 0 : managerState.layoutMode) !== null && _managerState$layoutM !== void 0 ? _managerState$layoutM : _const.LAYOUT_MODE_SIDE_BY_SIDE;
|
|
100
|
-
var isActive =
|
|
100
|
+
var isActive = !!managerState && (0, _selectors.isFlyoutInCurrentSession)(managerState, flyoutId);
|
|
101
101
|
|
|
102
102
|
// Derive parentFlyout and parentSize from single state read
|
|
103
103
|
var parentFlyoutId = currentSession === null || currentSession === void 0 ? void 0 : currentSession.mainFlyoutId;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.useSession = exports.usePushPaddingOffsets = exports.useParentFlyoutSize = exports.useIsFlyoutRegistered = exports.useIsFlyoutActive = exports.useHasPushPadding = exports.useHasChildFlyout = exports.useHasActiveSession = exports.useFlyoutWidth = exports.useFlyoutPagination = exports.useFlyoutMinWidth = exports.useFlyout = exports.useCurrentSession = exports.useCurrentMainFlyout = exports.useCurrentFlyoutZIndexRef = exports.useCurrentChildFlyout = void 0;
|
|
6
|
+
exports.useSession = exports.usePushPaddingOffsets = exports.useParentFlyoutSize = exports.useIsFlyoutRegistered = exports.useIsFlyoutActive = exports.useHasPushPadding = exports.useHasChildFlyout = exports.useHasActiveSession = exports.useFlyoutWidth = exports.useFlyoutPagination = exports.useFlyoutMinWidth = exports.useFlyout = exports.useCurrentSession = exports.useCurrentMainFlyout = exports.useCurrentFlyoutZIndexRef = exports.useCurrentChildFlyout = exports.isFlyoutInCurrentSession = void 0;
|
|
7
7
|
var _provider = require("./provider");
|
|
8
8
|
var _react = require("react");
|
|
9
9
|
/*
|
|
@@ -14,6 +14,11 @@ var _react = require("react");
|
|
|
14
14
|
* Side Public License, v 1.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
+
/** True if the given `flyoutId` is the main or child flyout in the latest session. */
|
|
18
|
+
var isFlyoutInCurrentSession = exports.isFlyoutInCurrentSession = function isFlyoutInCurrentSession(state, flyoutId) {
|
|
19
|
+
var currentSession = state.sessions[state.sessions.length - 1];
|
|
20
|
+
return (currentSession === null || currentSession === void 0 ? void 0 : currentSession.mainFlyoutId) === flyoutId || (currentSession === null || currentSession === void 0 ? void 0 : currentSession.childFlyoutId) === flyoutId;
|
|
21
|
+
};
|
|
17
22
|
var useSession = exports.useSession = function useSession(flyoutId) {
|
|
18
23
|
var context = (0, _provider.useFlyoutManager)();
|
|
19
24
|
if (!context) {
|
|
@@ -31,8 +36,8 @@ var useHasActiveSession = exports.useHasActiveSession = function useHasActiveSes
|
|
|
31
36
|
|
|
32
37
|
/** True if the given `flyoutId` is the main or child flyout in the latest session. */
|
|
33
38
|
var useIsFlyoutActive = exports.useIsFlyoutActive = function useIsFlyoutActive(flyoutId) {
|
|
34
|
-
var
|
|
35
|
-
return
|
|
39
|
+
var context = (0, _provider.useFlyoutManager)();
|
|
40
|
+
return !!context && isFlyoutInCurrentSession(context.state, flyoutId);
|
|
36
41
|
};
|
|
37
42
|
var useFlyout = exports.useFlyout = function useFlyout(flyoutId) {
|
|
38
43
|
var context = (0, _provider.useFlyoutManager)();
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.usePushedFlyoutReturnFocus = void 0;
|
|
8
|
+
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
9
|
+
var _react = require("react");
|
|
10
|
+
var _const = require("./manager/const");
|
|
11
|
+
var _selectors = require("./manager/selectors");
|
|
12
|
+
var _store = require("./manager/store");
|
|
13
|
+
/*
|
|
14
|
+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
15
|
+
* or more contributor license agreements. Licensed under the Elastic License
|
|
16
|
+
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
|
17
|
+
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
18
|
+
* Side Public License, v 1.
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Focus returns scheduled by pushed flyouts that just unmounted, keyed by
|
|
23
|
+
* timeout. A flyout mounting before they run (e.g. one remounted by a changed
|
|
24
|
+
* `key`) cancels them, so focus isn't pulled away from a flyout that is open.
|
|
25
|
+
*/
|
|
26
|
+
var pendingReturnFocus = new Map();
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Step 1, at unmount, before the DOM is removed: whether the user left focus
|
|
30
|
+
* somewhere a return is appropriate. Focus in another flyout passes because
|
|
31
|
+
* that flyout may be closing too; step 2 catches it if not.
|
|
32
|
+
*/
|
|
33
|
+
var mayReturnFocusOnUnmount = function mayReturnFocusOnUnmount(isFocusOwned) {
|
|
34
|
+
var active = document.activeElement;
|
|
35
|
+
return isFocusOwned || !active || active === document.body || !!active.closest('.euiFlyout');
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
/** Step 2, once everything closing alongside the flyout has unmounted. */
|
|
39
|
+
var isFocusStranded = function isFocusStranded() {
|
|
40
|
+
var active = document.activeElement;
|
|
41
|
+
return !active || active === document.body || !active.isConnected;
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Inactive managed sessions stay mounted but are moved off-screen, so focus
|
|
46
|
+
* inside one would be invisible.
|
|
47
|
+
*/
|
|
48
|
+
var isInInactiveSession = function isInInactiveSession(element) {
|
|
49
|
+
var owner = element.closest("[".concat(_const.PROPERTY_FLYOUT, "]"));
|
|
50
|
+
return !!owner && !(0, _selectors.isFlyoutInCurrentSession)((0, _store.getFlyoutManagerStore)().getState(), owner.id);
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* A flyout opened while nothing was focused captures `<body>`, which isn't
|
|
55
|
+
* a trigger worth returning to.
|
|
56
|
+
*/
|
|
57
|
+
var isUsableTrigger = function isUsableTrigger(element) {
|
|
58
|
+
return !!element && element.isConnected && element !== document.body;
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
/** Step 3: apply `returnFocus` the way `react-focus-lock` does. */
|
|
62
|
+
var returnFocusToTrigger = function returnFocusToTrigger(trigger, returnFocus) {
|
|
63
|
+
var howToReturnFocus = typeof returnFocus === 'function' ? returnFocus(trigger) : returnFocus;
|
|
64
|
+
if (!howToReturnFocus || !(trigger instanceof HTMLElement) || !isUsableTrigger(trigger) || isInInactiveSession(trigger)) {
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
trigger.focus((0, _typeof2.default)(howToReturnFocus) === 'object' ? howToReturnFocus : undefined);
|
|
68
|
+
};
|
|
69
|
+
/**
|
|
70
|
+
* Returns focus to the trigger element when a pushed flyout unmounts.
|
|
71
|
+
*
|
|
72
|
+
* Pushed flyouts disable their `EuiFocusTrap`, so nothing else returns focus
|
|
73
|
+
* for them. Overlay flyouts are skipped because their active trap already
|
|
74
|
+
* does. Focus is returned only when:
|
|
75
|
+
* - the flyout owned focus, or focus was on `<body>` or in another flyout,
|
|
76
|
+
* when it unmounted, and
|
|
77
|
+
* - after everything closing with it has unmounted, focus is on `<body>` or
|
|
78
|
+
* a removed element, and
|
|
79
|
+
* - `returnFocus` allows it, and the trigger is connected and not in an
|
|
80
|
+
* inactive managed session.
|
|
81
|
+
*
|
|
82
|
+
* Returns `onFocus` and `onBlur` handlers for the flyout element, composed
|
|
83
|
+
* with the ones passed in.
|
|
84
|
+
*/
|
|
85
|
+
var usePushedFlyoutReturnFocus = exports.usePushedFlyoutReturnFocus = function usePushedFlyoutReturnFocus(_ref) {
|
|
86
|
+
var isPushed = _ref.isPushed,
|
|
87
|
+
_ref$returnFocus = _ref.returnFocus,
|
|
88
|
+
returnFocus = _ref$returnFocus === void 0 ? true : _ref$returnFocus,
|
|
89
|
+
triggerRef = _ref.triggerRef,
|
|
90
|
+
_onFocus = _ref.onFocus,
|
|
91
|
+
_onBlur = _ref.onBlur;
|
|
92
|
+
var latest = (0, _react.useRef)({
|
|
93
|
+
isPushed: isPushed,
|
|
94
|
+
returnFocus: returnFocus
|
|
95
|
+
});
|
|
96
|
+
latest.current.isPushed = isPushed;
|
|
97
|
+
latest.current.returnFocus = returnFocus;
|
|
98
|
+
|
|
99
|
+
// React focus events bubble through portals, so this also covers focus in
|
|
100
|
+
// content the flyout renders elsewhere in the DOM, such as popovers and
|
|
101
|
+
// child flyouts.
|
|
102
|
+
var isFocusOwnedRef = (0, _react.useRef)(false);
|
|
103
|
+
var onFocus = (0, _react.useCallback)(function (event) {
|
|
104
|
+
isFocusOwnedRef.current = true;
|
|
105
|
+
_onFocus === null || _onFocus === void 0 || _onFocus(event);
|
|
106
|
+
}, [_onFocus]);
|
|
107
|
+
var onBlur = (0, _react.useCallback)(function (event) {
|
|
108
|
+
isFocusOwnedRef.current = false;
|
|
109
|
+
_onBlur === null || _onBlur === void 0 || _onBlur(event);
|
|
110
|
+
}, [_onBlur]);
|
|
111
|
+
(0, _react.useLayoutEffect)(function () {
|
|
112
|
+
// A flyout replacing one that just closed captured its trigger after the
|
|
113
|
+
// closing flyout's DOM was removed, which is `<body>` or a removed
|
|
114
|
+
// element, so take over the closing flyout's trigger.
|
|
115
|
+
pendingReturnFocus.forEach(function (pendingTrigger, timeout) {
|
|
116
|
+
clearTimeout(timeout);
|
|
117
|
+
if (!isUsableTrigger(triggerRef.current) && isUsableTrigger(pendingTrigger)) {
|
|
118
|
+
triggerRef.current = pendingTrigger;
|
|
119
|
+
}
|
|
120
|
+
});
|
|
121
|
+
pendingReturnFocus.clear();
|
|
122
|
+
}, [triggerRef]);
|
|
123
|
+
|
|
124
|
+
// Layout cleanup runs before the DOM is removed, while focus still shows
|
|
125
|
+
// where the user left it.
|
|
126
|
+
(0, _react.useLayoutEffect)(function () {
|
|
127
|
+
return function () {
|
|
128
|
+
var _latest$current = latest.current,
|
|
129
|
+
isPushed = _latest$current.isPushed,
|
|
130
|
+
returnFocus = _latest$current.returnFocus;
|
|
131
|
+
var trigger = triggerRef.current;
|
|
132
|
+
if (!isPushed || !returnFocus || !trigger) return;
|
|
133
|
+
if (!mayReturnFocusOnUnmount(isFocusOwnedRef.current)) return;
|
|
134
|
+
|
|
135
|
+
// Wait for sibling flyouts in the same history group, portalled
|
|
136
|
+
// content, and child flyout focus traps that pull focus back to
|
|
137
|
+
// themselves before releasing it.
|
|
138
|
+
var timeout = setTimeout(function () {
|
|
139
|
+
pendingReturnFocus.delete(timeout);
|
|
140
|
+
if (isFocusStranded()) returnFocusToTrigger(trigger, returnFocus);
|
|
141
|
+
});
|
|
142
|
+
pendingReturnFocus.set(timeout, trigger);
|
|
143
|
+
};
|
|
144
|
+
}, [triggerRef]);
|
|
145
|
+
return {
|
|
146
|
+
onFocus: onFocus,
|
|
147
|
+
onBlur: onBlur
|
|
148
|
+
};
|
|
149
|
+
};
|
|
@@ -34,17 +34,9 @@ var EuiIconAddToChat = function EuiIconAddToChat(_ref) {
|
|
|
34
34
|
}, props), title ? (0, _react2.jsx)("title", {
|
|
35
35
|
id: titleId
|
|
36
36
|
}, title) : null, (0, _react2.jsx)("path", {
|
|
37
|
-
|
|
38
|
-
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",
|
|
39
|
-
clipRule: "evenodd"
|
|
37
|
+
d: "M14 13h2v1h-2v2h-1v-2h-2v-1h2v-2h1z"
|
|
40
38
|
}), (0, _react2.jsx)("path", {
|
|
41
|
-
d: "
|
|
42
|
-
}), (0, _react2.jsx)("path", {
|
|
43
|
-
fillRule: "evenodd",
|
|
44
|
-
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",
|
|
45
|
-
clipRule: "evenodd"
|
|
46
|
-
}), (0, _react2.jsx)("path", {
|
|
47
|
-
d: "M14 13h2v1h-2v2h-1v-2h-2v-1h2v-2h1v2Z"
|
|
39
|
+
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"
|
|
48
40
|
}));
|
|
49
41
|
};
|
|
50
42
|
var icon = exports.icon = EuiIconAddToChat;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.icon = void 0;
|
|
9
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
10
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
11
|
+
var React = _interopRequireWildcard(require("react"));
|
|
12
|
+
var _react2 = require("@emotion/react");
|
|
13
|
+
var _excluded = ["title", "titleId"];
|
|
14
|
+
/*
|
|
15
|
+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
16
|
+
* or more contributor license agreements. Licensed under the Elastic License
|
|
17
|
+
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
|
18
|
+
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
19
|
+
* Side Public License, v 1.
|
|
20
|
+
*/
|
|
21
|
+
// THIS IS A GENERATED FILE. DO NOT MODIFY MANUALLY. @see scripts/compile-icons.js
|
|
22
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
23
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
24
|
+
var EuiIconProductAlertZero = function EuiIconProductAlertZero(_ref) {
|
|
25
|
+
var title = _ref.title,
|
|
26
|
+
titleId = _ref.titleId,
|
|
27
|
+
props = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
28
|
+
return (0, _react2.jsx)("svg", (0, _extends2.default)({
|
|
29
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
30
|
+
width: 16,
|
|
31
|
+
height: 16,
|
|
32
|
+
viewBox: "0 0 16 16",
|
|
33
|
+
"aria-labelledby": titleId
|
|
34
|
+
}, props), title ? (0, _react2.jsx)("title", {
|
|
35
|
+
id: titleId
|
|
36
|
+
}, title) : null, (0, _react2.jsx)("path", {
|
|
37
|
+
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"
|
|
38
|
+
}));
|
|
39
|
+
};
|
|
40
|
+
var icon = exports.icon = EuiIconProductAlertZero;
|
|
@@ -2697,6 +2697,13 @@ var typeToPathMap = exports.typeToPathMap = {
|
|
|
2697
2697
|
}, {
|
|
2698
2698
|
synonyms: ['agent', 'product', 'elastic agent', 'fleet', 'monitoring']
|
|
2699
2699
|
}),
|
|
2700
|
+
productAlertZero: withMetadata(function () {
|
|
2701
|
+
return Promise.resolve().then(function () {
|
|
2702
|
+
return _interopRequireWildcard(require('./assets/product_alert_zero'));
|
|
2703
|
+
});
|
|
2704
|
+
}, {
|
|
2705
|
+
synonyms: ['alertzero', 'alert', 'zero', 'attack', 'security']
|
|
2706
|
+
}),
|
|
2700
2707
|
productCanvas: withMetadata(function () {
|
|
2701
2708
|
return Promise.resolve().then(function () {
|
|
2702
2709
|
return _interopRequireWildcard(require('./assets/product_canvas'));
|
|
@@ -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>
|
|
@@ -24,7 +24,11 @@ var _ref = process.env.NODE_ENV === "production" ? {
|
|
|
24
24
|
};
|
|
25
25
|
var euiSelectableTemplateSitewideStyles = exports.euiSelectableTemplateSitewideStyles = function euiSelectableTemplateSitewideStyles(euiThemeContext) {
|
|
26
26
|
var euiTheme = euiThemeContext.euiTheme;
|
|
27
|
-
|
|
27
|
+
|
|
28
|
+
// Pass the theme's vis colors explicitly - see the note in token.styles.ts
|
|
29
|
+
var visColors = (0, _services.euiPaletteColorBlind)({
|
|
30
|
+
colors: euiTheme.colors.vis
|
|
31
|
+
});
|
|
28
32
|
return {
|
|
29
33
|
euiSelectableTemplateSitewide: _ref,
|
|
30
34
|
euiSelectableTemplateSitewide__optionMetasList: /*#__PURE__*/(0, _react.css)("display:block;", (0, _global_styling.euiFontSize)(euiThemeContext, 'xs'), " color:", euiTheme.colors.textSubdued, ";;label:euiSelectableTemplateSitewide__optionMetasList;"),
|
|
@@ -23,10 +23,16 @@ var getTokenColor = function getTokenColor(euiThemeContext, fill, color) {
|
|
|
23
23
|
var euiTheme = euiThemeContext.euiTheme,
|
|
24
24
|
colorMode = euiThemeContext.colorMode,
|
|
25
25
|
highContrastMode = euiThemeContext.highContrastMode;
|
|
26
|
-
//
|
|
27
|
-
//
|
|
28
|
-
|
|
29
|
-
|
|
26
|
+
// Pass the theme's vis colors explicitly rather than letting these fall back to
|
|
27
|
+
// EUI_VIS_COLOR_STORE - the store is only updated in an effect, so on the first
|
|
28
|
+
// render it can still hold the previous theme's palette. Memoized styles are not
|
|
29
|
+
// regenerated for a store update, so those colors would stay stale.
|
|
30
|
+
var visColors = (0, _services.euiPaletteColorBlind)({
|
|
31
|
+
colors: euiTheme.colors.vis
|
|
32
|
+
});
|
|
33
|
+
var visColorsBehindText = (0, _services.euiPaletteColorBlindBehindText)({
|
|
34
|
+
colors: euiTheme.colors.vis
|
|
35
|
+
});
|
|
30
36
|
var isVizColor = typeof color === 'number';
|
|
31
37
|
var iconColor = isVizColor ? visColors[color] : euiTheme.colors.darkShade;
|
|
32
38
|
var isDarkMode = colorMode === 'DARK';
|
|
@@ -9,8 +9,8 @@ exports.EuiThemeProvider = void 0;
|
|
|
9
9
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
10
10
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
11
11
|
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
12
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
13
12
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
13
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
14
14
|
var _react = require("@emotion/react");
|
|
15
15
|
var _react2 = _interopRequireWildcard(require("react"));
|
|
16
16
|
var _isEqual = _interopRequireDefault(require("lodash/isEqual"));
|
|
@@ -34,7 +34,23 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
34
34
|
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
|
35
35
|
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
36
36
|
* Side Public License, v 1.
|
|
37
|
+
*/ /**
|
|
38
|
+
* Caches `value` during render, only swapping in a new one once `isSame`
|
|
39
|
+
* reports that it actually differs from the cached one.
|
|
40
|
+
*
|
|
41
|
+
* This keeps derived objects referentially stable (so that the - comparatively
|
|
42
|
+
* expensive - theme computation isn't rerun on every render) without deferring
|
|
43
|
+
* them to a `useEffect`/`setState` pair. Effect-synchronised state costs an
|
|
44
|
+
* extra commit, in which consumers would see e.g. an updated `colorMode`
|
|
45
|
+
* alongside a theme that is still computed from the previous one.
|
|
37
46
|
*/
|
|
47
|
+
var useStableValue = function useStableValue(value, isSame) {
|
|
48
|
+
var ref = (0, _react2.useRef)(value);
|
|
49
|
+
if (ref.current !== value && !isSame(ref.current, value)) {
|
|
50
|
+
ref.current = value;
|
|
51
|
+
}
|
|
52
|
+
return ref.current;
|
|
53
|
+
};
|
|
38
54
|
var EuiThemeProvider = exports.EuiThemeProvider = function EuiThemeProvider(_ref) {
|
|
39
55
|
var _system = _ref.theme,
|
|
40
56
|
_colorMode = _ref.colorMode,
|
|
@@ -63,118 +79,85 @@ var EuiThemeProvider = exports.EuiThemeProvider = function EuiThemeProvider(_ref
|
|
|
63
79
|
var EuiConditionalBreakpointProvider = (0, _react2.useMemo)(function () {
|
|
64
80
|
return isGlobalTheme || _modifications !== null && _modifications !== void 0 && _modifications.breakpoint ? _current_breakpoint.CurrentEuiBreakpointProvider : _react2.Fragment;
|
|
65
81
|
}, [isGlobalTheme, _modifications]);
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
var
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
var
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
var prevColorMode = (0, _react2.useRef)(colorMode);
|
|
82
|
+
|
|
83
|
+
// Every value below is derived from props/parent context during render, so
|
|
84
|
+
// that all context values this provider exposes - most notably `colorMode`
|
|
85
|
+
// and the computed `theme` - always change within the same commit
|
|
86
|
+
var system = useStableValue(_system || parentSystem, function (previous, next) {
|
|
87
|
+
return previous.key === next.key;
|
|
88
|
+
});
|
|
89
|
+
var mergedModifications = (0, _react2.useMemo)(function () {
|
|
90
|
+
return (0, _utils.mergeDeep)(parentModifications, _modifications);
|
|
91
|
+
}, [parentModifications, _modifications]);
|
|
92
|
+
var modifications = useStableValue(mergedModifications, _isEqual.default);
|
|
93
|
+
var colorMode = (0, _react2.useMemo)(function () {
|
|
94
|
+
return (0, _utils.getColorMode)(_colorMode, parentColorMode, isForced);
|
|
95
|
+
}, [_colorMode, parentColorMode, isForced]);
|
|
81
96
|
var highContrastMode = (0, _react2.useMemo)(function () {
|
|
82
97
|
if (isForced) return 'forced'; // System forced high contrast mode will always supercede application settings
|
|
83
98
|
if (_highContrastMode === true) return 'preferred'; // Convert the boolean prop to our internal enum
|
|
84
99
|
if (_highContrastMode === false) return false; // Allow `false` prop to override user/system preference
|
|
85
100
|
return parentHighContrastMode; // Fall back to the parent/system setting
|
|
86
101
|
}, [_highContrastMode, parentHighContrastMode, isForced]);
|
|
87
|
-
var prevHighContrastMode = (0, _react2.useRef)(highContrastMode);
|
|
88
102
|
var modificationsWithHighContrast = (0, _high_contrast_overrides.useHighContrastModifications)({
|
|
89
103
|
highContrastMode: highContrastMode,
|
|
90
104
|
colorMode: colorMode,
|
|
91
105
|
system: system,
|
|
92
106
|
modifications: modifications
|
|
93
107
|
});
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
108
|
+
|
|
109
|
+
// If this provider resolves to the exact same theme as its parent, the
|
|
110
|
+
// already computed parent theme can be reused instead of recomputing it
|
|
111
|
+
var isParentTheme = (0, _react2.useMemo)(function () {
|
|
112
|
+
return isGlobalTheme ? system.key === _context.DEFAULTS.system.key && colorMode === _context.DEFAULTS.colorMode && highContrastMode === _context.DEFAULTS.highContrastMode && !_modifications : system.key === parentSystem.key && colorMode === parentColorMode && highContrastMode === parentHighContrastMode && (0, _isEqual.default)(parentModifications, modifications);
|
|
113
|
+
}, [isGlobalTheme, system, colorMode, highContrastMode, _modifications, parentSystem, parentColorMode, parentHighContrastMode, parentModifications, modifications]);
|
|
114
|
+
|
|
115
|
+
// Depending on `parentTheme` itself would recompute this provider's theme every
|
|
116
|
+
// time the parent's did, even where the parent's theme is not an input to it -
|
|
117
|
+
// `parentModifications` already reaches `getComputed` through `modifications`
|
|
118
|
+
var reusableParentTheme = isParentTheme && Object.keys(parentTheme).length ? parentTheme : null;
|
|
119
|
+
var theme = (0, _react2.useMemo)(function () {
|
|
120
|
+
if (reusableParentTheme) {
|
|
121
|
+
return _objectSpread({}, reusableParentTheme); // Intentionally create a new object to break referential equality
|
|
98
122
|
}
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
123
|
+
|
|
124
|
+
/* Enables recomputation of component colors when flags are overridden on the provider
|
|
125
|
+
by adding the respective key to modifications to trigger a recomputation. */
|
|
126
|
+
// NOTE: Keeping this as placeholder for potential future usage during Borealis changes
|
|
127
|
+
// TODO: remove once visual refresh is completed and flags are obsolete
|
|
128
|
+
var flagsToRecompute = [];
|
|
129
|
+
var keys = {};
|
|
130
|
+
var forceRecomputeComponents = flagsToRecompute.some(function (item) {
|
|
131
|
+
var _modifications$flags, _modifications$compon;
|
|
132
|
+
if (!item) return false;
|
|
133
|
+
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)) {
|
|
134
|
+
keys[item.componentKey] = {
|
|
135
|
+
LIGHT: {},
|
|
136
|
+
DARK: {}
|
|
137
|
+
};
|
|
138
|
+
return true;
|
|
139
|
+
}
|
|
140
|
+
return false;
|
|
104
141
|
});
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
: getInitialTheme()),
|
|
109
|
-
_useState8 = (0, _slicedToArray2.default)(_useState7, 2),
|
|
110
|
-
theme = _useState8[0],
|
|
111
|
-
setTheme = _useState8[1];
|
|
112
|
-
(0, _react2.useEffect)(function () {
|
|
113
|
-
var newSystem = _system || parentSystem;
|
|
114
|
-
if (prevSystemKey.current !== newSystem.key) {
|
|
115
|
-
setSystem(newSystem);
|
|
116
|
-
prevSystemKey.current = newSystem.key;
|
|
117
|
-
isParentTheme.current = false;
|
|
118
|
-
}
|
|
119
|
-
}, [_system, parentSystem, theme, updateVisColorStore]);
|
|
120
|
-
(0, _react2.useEffect)(function () {
|
|
121
|
-
updateVisColorStore(theme, isGlobalTheme);
|
|
122
|
-
}, [theme, colorMode, isGlobalTheme, updateVisColorStore]);
|
|
123
|
-
(0, _react2.useEffect)(function () {
|
|
124
|
-
var newModifications = (0, _utils.mergeDeep)(parentModifications, _modifications);
|
|
125
|
-
if (!(0, _isEqual.default)(prevModifications.current, newModifications)) {
|
|
126
|
-
setModifications(newModifications);
|
|
127
|
-
prevModifications.current = newModifications;
|
|
128
|
-
isParentTheme.current = false;
|
|
129
|
-
}
|
|
130
|
-
}, [_modifications, parentModifications]);
|
|
131
|
-
(0, _react2.useEffect)(function () {
|
|
132
|
-
var newColorMode = (0, _utils.getColorMode)(_colorMode, parentColorMode, isForced);
|
|
133
|
-
if (!(0, _isEqual.default)(newColorMode, prevColorMode.current)) {
|
|
134
|
-
setColorMode(newColorMode);
|
|
135
|
-
prevColorMode.current = newColorMode;
|
|
136
|
-
isParentTheme.current = false;
|
|
137
|
-
}
|
|
138
|
-
}, [_colorMode, parentColorMode, isForced]);
|
|
139
|
-
(0, _react2.useEffect)(function () {
|
|
140
|
-
if (prevHighContrastMode.current !== highContrastMode) {
|
|
141
|
-
isParentTheme.current = false;
|
|
142
|
-
}
|
|
143
|
-
}, [highContrastMode]);
|
|
144
|
-
(0, _react2.useEffect)(function () {
|
|
145
|
-
if (!isParentTheme.current) {
|
|
146
|
-
/* Enables recomputation of component colors when flags are overridden on the provider
|
|
147
|
-
by adding the respective key to modifications to trigger a recomputation. */
|
|
148
|
-
// NOTE: Keeping this as placeholder for potential future usage during Borealis changes
|
|
149
|
-
// TODO: remove once visual refresh is completed and flags are obsolete
|
|
150
|
-
var flagsToRecompute = [];
|
|
151
|
-
var keys = {};
|
|
152
|
-
var forceRecomputeComponents = flagsToRecompute.some(function (item) {
|
|
153
|
-
var _modifications$flags, _modifications$compon;
|
|
154
|
-
if (!item) return false;
|
|
155
|
-
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)) {
|
|
156
|
-
keys[item.componentKey] = {
|
|
157
|
-
LIGHT: {},
|
|
158
|
-
DARK: {}
|
|
159
|
-
};
|
|
160
|
-
return true;
|
|
161
|
-
}
|
|
162
|
-
return false;
|
|
163
|
-
});
|
|
164
|
-
var componentModifications = forceRecomputeComponents ? {
|
|
165
|
-
components: keys
|
|
166
|
-
} : {};
|
|
142
|
+
var componentModifications = forceRecomputeComponents ? {
|
|
143
|
+
components: keys
|
|
144
|
+
} : {};
|
|
167
145
|
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
146
|
+
// force recomputing of color & component tokens based on flag changes
|
|
147
|
+
var enhancedModifications = _objectSpread(_objectSpread({}, modificationsWithHighContrast), componentModifications);
|
|
148
|
+
return (0, _utils.getComputed)(system, (0, _utils.buildTheme)(enhancedModifications, "_".concat(system.key)), colorMode, highContrastMode);
|
|
149
|
+
}, [reusableParentTheme, system, colorMode, highContrastMode, modifications, modificationsWithHighContrast]);
|
|
150
|
+
|
|
151
|
+
// Genuine side effect - the vis color store is consumed outside of React
|
|
152
|
+
(0, _react2.useEffect)(function () {
|
|
153
|
+
if (isGlobalTheme) {
|
|
154
|
+
_color.EUI_VIS_COLOR_STORE.setVisColors(theme.colors.vis);
|
|
172
155
|
}
|
|
173
|
-
}, [
|
|
174
|
-
var
|
|
175
|
-
|
|
176
|
-
themeCSSVariables =
|
|
177
|
-
_setThemeCSSVariables =
|
|
156
|
+
}, [theme, isGlobalTheme]);
|
|
157
|
+
var _useState = (0, _react2.useState)(),
|
|
158
|
+
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
159
|
+
themeCSSVariables = _useState2[0],
|
|
160
|
+
_setThemeCSSVariables = _useState2[1];
|
|
178
161
|
var setThemeCSSVariables = (0, _react2.useCallback)(function (variables) {
|
|
179
162
|
return _setThemeCSSVariables(function (previous) {
|
|
180
163
|
var merged = _objectSpread(_objectSpread({}, previous), variables);
|