@elastic/eui 113.2.1 → 114.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/components/basic_table/collapsed_item_actions.js +2 -0
- package/es/components/button/split_button/split_button.js +13 -0
- package/es/components/button/split_button/split_button_actions.js +15 -0
- package/es/components/collapsible_nav/collapsible_nav.js +5 -0
- package/es/components/color_picker/color_picker.js +31 -8
- package/es/components/context_menu/context_menu_item.js +9 -3
- package/es/components/context_menu/context_menu_item.styles.js +6 -2
- package/es/components/datagrid/utils/scrolling.js +39 -10
- package/es/components/date_picker/super_date_picker/time_window_buttons.js +17 -3
- package/es/components/flyout/_flyout_overlay.js +34 -4
- package/es/components/flyout/const.js +10 -0
- package/es/components/flyout/flyout.component.js +49 -57
- package/es/components/flyout/flyout.js +10 -2
- package/es/components/flyout/flyout.styles.js +2 -2
- package/es/components/flyout/flyout_menu.js +19 -5
- package/es/components/flyout/flyout_resizable.js +5 -0
- package/es/components/flyout/manager/actions.js +12 -5
- package/es/components/flyout/manager/flyout_child.js +9 -2
- package/es/components/flyout/manager/flyout_managed.js +27 -14
- package/es/components/flyout/manager/reducer.js +251 -54
- package/es/components/flyout/manager/store.js +74 -12
- package/es/components/flyout/use_flyout_menu.js +70 -0
- package/es/components/form/file_picker/file_picker.js +46 -18
- package/es/components/markdown_editor/plugins/markdown_default_plugins/parsing_plugins.js +2 -1
- package/es/components/markdown_editor/plugins/remark/remark_intraword_underscore.js +172 -0
- package/es/components/overlay_mask/overlay_mask.js +10 -3
- package/es/components/tree_view/tree_view_item.styles.js +1 -1
- package/es/services/hooks/index.js +8 -8
- package/es/services/hooks/useIsPointerDown.js +6 -15
- package/es/services/index.js +1 -1
- package/eui.d.ts +477 -63
- package/i18ntokens.json +661 -643
- package/lib/components/basic_table/collapsed_item_actions.js +2 -0
- package/lib/components/button/split_button/split_button.js +13 -0
- package/lib/components/button/split_button/split_button_actions.js +15 -0
- package/lib/components/collapsible_nav/collapsible_nav.js +5 -0
- package/lib/components/color_picker/color_picker.js +30 -7
- package/lib/components/context_menu/context_menu_item.js +9 -3
- package/lib/components/context_menu/context_menu_item.styles.js +5 -1
- package/lib/components/datagrid/utils/scrolling.js +37 -8
- package/lib/components/date_picker/super_date_picker/time_window_buttons.js +17 -3
- package/lib/components/flyout/_flyout_overlay.js +33 -3
- package/lib/components/flyout/const.js +11 -1
- package/lib/components/flyout/flyout.component.js +48 -56
- package/lib/components/flyout/flyout.js +15 -1
- package/lib/components/flyout/flyout.styles.js +2 -2
- package/lib/components/flyout/flyout_menu.js +19 -5
- package/lib/components/flyout/flyout_resizable.js +5 -0
- package/lib/components/flyout/manager/actions.js +12 -5
- package/lib/components/flyout/manager/flyout_child.js +9 -2
- package/lib/components/flyout/manager/flyout_managed.js +19 -12
- package/lib/components/flyout/manager/reducer.js +250 -53
- package/lib/components/flyout/manager/store.js +74 -14
- package/lib/components/flyout/use_flyout_menu.js +75 -0
- package/lib/components/form/file_picker/file_picker.js +46 -18
- package/lib/components/markdown_editor/plugins/markdown_default_plugins/parsing_plugins.js +2 -1
- package/lib/components/markdown_editor/plugins/remark/remark_intraword_underscore.js +179 -0
- package/lib/components/overlay_mask/overlay_mask.js +10 -3
- package/lib/components/tree_view/tree_view_item.styles.js +1 -1
- package/lib/services/hooks/index.js +60 -91
- package/lib/services/hooks/useIsPointerDown.js +7 -14
- package/lib/services/index.js +70 -11
- package/optimize/es/components/basic_table/collapsed_item_actions.js +2 -0
- package/optimize/es/components/color_picker/color_picker.js +31 -8
- package/optimize/es/components/context_menu/context_menu_item.js +3 -2
- package/optimize/es/components/context_menu/context_menu_item.styles.js +6 -2
- package/optimize/es/components/datagrid/utils/scrolling.js +39 -10
- package/optimize/es/components/date_picker/super_date_picker/time_window_buttons.js +17 -3
- package/optimize/es/components/flyout/_flyout_overlay.js +34 -4
- package/optimize/es/components/flyout/const.js +10 -0
- package/optimize/es/components/flyout/flyout.component.js +49 -57
- package/optimize/es/components/flyout/flyout.js +5 -2
- package/optimize/es/components/flyout/flyout.styles.js +2 -2
- package/optimize/es/components/flyout/flyout_menu.js +7 -3
- package/optimize/es/components/flyout/manager/actions.js +12 -5
- package/optimize/es/components/flyout/manager/flyout_managed.js +18 -12
- package/optimize/es/components/flyout/manager/reducer.js +251 -54
- package/optimize/es/components/flyout/manager/store.js +69 -12
- package/optimize/es/components/flyout/use_flyout_menu.js +69 -0
- package/optimize/es/components/form/file_picker/file_picker.js +35 -18
- package/optimize/es/components/markdown_editor/plugins/markdown_default_plugins/parsing_plugins.js +2 -1
- package/optimize/es/components/markdown_editor/plugins/remark/remark_intraword_underscore.js +172 -0
- package/optimize/es/components/overlay_mask/overlay_mask.js +4 -2
- package/optimize/es/components/tree_view/tree_view_item.styles.js +1 -1
- package/optimize/es/services/hooks/index.js +8 -8
- package/optimize/es/services/hooks/useIsPointerDown.js +6 -10
- package/optimize/es/services/index.js +1 -1
- package/optimize/lib/components/basic_table/collapsed_item_actions.js +2 -0
- package/optimize/lib/components/color_picker/color_picker.js +30 -7
- package/optimize/lib/components/context_menu/context_menu_item.js +3 -2
- package/optimize/lib/components/context_menu/context_menu_item.styles.js +5 -1
- package/optimize/lib/components/datagrid/utils/scrolling.js +37 -8
- package/optimize/lib/components/date_picker/super_date_picker/time_window_buttons.js +17 -3
- package/optimize/lib/components/flyout/_flyout_overlay.js +33 -3
- package/optimize/lib/components/flyout/const.js +11 -1
- package/optimize/lib/components/flyout/flyout.component.js +48 -56
- package/optimize/lib/components/flyout/flyout.js +10 -1
- package/optimize/lib/components/flyout/flyout.styles.js +2 -2
- package/optimize/lib/components/flyout/flyout_menu.js +7 -3
- package/optimize/lib/components/flyout/manager/actions.js +12 -5
- package/optimize/lib/components/flyout/manager/flyout_managed.js +18 -12
- package/optimize/lib/components/flyout/manager/reducer.js +250 -53
- package/optimize/lib/components/flyout/manager/store.js +70 -12
- package/optimize/lib/components/flyout/use_flyout_menu.js +74 -0
- package/optimize/lib/components/form/file_picker/file_picker.js +35 -18
- package/optimize/lib/components/markdown_editor/plugins/markdown_default_plugins/parsing_plugins.js +2 -1
- package/optimize/lib/components/markdown_editor/plugins/remark/remark_intraword_underscore.js +179 -0
- package/optimize/lib/components/overlay_mask/overlay_mask.js +4 -2
- package/optimize/lib/components/tree_view/tree_view_item.styles.js +1 -1
- package/optimize/lib/services/hooks/index.js +60 -91
- package/optimize/lib/services/hooks/useIsPointerDown.js +5 -10
- package/optimize/lib/services/index.js +70 -11
- package/package.json +4 -4
- package/test-env/components/basic_table/collapsed_item_actions.js +2 -0
- package/test-env/components/button/split_button/split_button.js +13 -0
- package/test-env/components/button/split_button/split_button_actions.js +15 -0
- package/test-env/components/collapsible_nav/collapsible_nav.js +5 -0
- package/test-env/components/color_picker/color_picker.js +30 -7
- package/test-env/components/context_menu/context_menu_item.js +9 -3
- package/test-env/components/context_menu/context_menu_item.styles.js +5 -1
- package/test-env/components/datagrid/utils/scrolling.js +37 -8
- package/test-env/components/date_picker/super_date_picker/time_window_buttons.js +17 -3
- package/test-env/components/flyout/_flyout_overlay.js +33 -3
- package/test-env/components/flyout/const.js +11 -1
- package/test-env/components/flyout/flyout.component.js +48 -56
- package/test-env/components/flyout/flyout.styles.js +2 -2
- package/test-env/components/flyout/flyout_menu.js +19 -5
- package/test-env/components/flyout/flyout_resizable.js +5 -0
- package/test-env/components/flyout/manager/actions.js +12 -5
- package/test-env/components/flyout/manager/flyout_child.js +9 -2
- package/test-env/components/flyout/manager/flyout_managed.js +19 -12
- package/test-env/components/flyout/manager/reducer.js +250 -53
- package/test-env/components/flyout/manager/store.js +70 -12
- package/test-env/components/flyout/use_flyout_menu.js +74 -0
- package/test-env/components/form/file_picker/file_picker.js +46 -18
- package/test-env/components/markdown_editor/plugins/markdown_default_plugins/parsing_plugins.js +2 -1
- package/test-env/components/markdown_editor/plugins/remark/remark_intraword_underscore.js +179 -0
- package/test-env/components/overlay_mask/overlay_mask.js +10 -3
- package/test-env/components/tree_view/tree_view_item.styles.js +1 -1
- package/test-env/services/hooks/index.js +60 -91
- package/test-env/services/hooks/useIsPointerDown.js +5 -10
- package/test-env/services/index.js +70 -11
|
@@ -9,6 +9,7 @@ exports.EuiFlyoutOverlay = void 0;
|
|
|
9
9
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
10
10
|
var _react = _interopRequireWildcard(require("react"));
|
|
11
11
|
var _css = require("@emotion/css");
|
|
12
|
+
var _services = require("../../services");
|
|
12
13
|
var _overlay_mask = require("../overlay_mask");
|
|
13
14
|
var _portal = require("../portal");
|
|
14
15
|
var _react2 = require("@emotion/react");
|
|
@@ -26,8 +27,7 @@ var getEuiFlyoutOverlayStyles = function getEuiFlyoutOverlayStyles(zIndex) {
|
|
|
26
27
|
/*
|
|
27
28
|
This needs to have !important to override the default EuiOverlayMask
|
|
28
29
|
z-index based on the headerZindexLocation prop. Using the style attribute
|
|
29
|
-
doesn't work since EuiOverlayMask requires
|
|
30
|
-
causes React errors in the test environment.
|
|
30
|
+
doesn't work since EuiOverlayMask requires the styles to be provided via className
|
|
31
31
|
*/
|
|
32
32
|
return /*#__PURE__*/(0, _css.css)("z-index:", zIndex, "!important;;label:getEuiFlyoutOverlayStyles;");
|
|
33
33
|
};
|
|
@@ -48,10 +48,39 @@ var EuiFlyoutOverlay = exports.EuiFlyoutOverlay = function EuiFlyoutOverlay(_ref
|
|
|
48
48
|
hasOverlayMask = _ref.hasOverlayMask,
|
|
49
49
|
maskZIndex = _ref.maskZIndex,
|
|
50
50
|
_ref$headerZindexLoca = _ref.headerZindexLocation,
|
|
51
|
-
headerZindexLocation = _ref$headerZindexLoca === void 0 ? 'below' : _ref$headerZindexLoca
|
|
51
|
+
headerZindexLocation = _ref$headerZindexLoca === void 0 ? 'below' : _ref$headerZindexLoca,
|
|
52
|
+
containerRect = _ref.containerRect;
|
|
52
53
|
var styles = (0, _react.useMemo)(function () {
|
|
53
54
|
return getEuiFlyoutOverlayStyles(maskZIndex);
|
|
54
55
|
}, [maskZIndex]);
|
|
56
|
+
|
|
57
|
+
// Internal ref so we can apply containerRect positioning directly on the DOM
|
|
58
|
+
// node, avoiding new Emotion CSS class generation on every scroll/resize.
|
|
59
|
+
var internalMaskRef = (0, _react.useRef)(null);
|
|
60
|
+
var combinedMaskRef = (0, _services.useCombinedRefs)([internalMaskRef, maskProps === null || maskProps === void 0 ? void 0 : maskProps.maskRef]);
|
|
61
|
+
(0, _react.useEffect)(function () {
|
|
62
|
+
var node = internalMaskRef.current;
|
|
63
|
+
if (!node) return;
|
|
64
|
+
|
|
65
|
+
// containerRect positioning must be applied via node.style.setProperty rather than
|
|
66
|
+
// through the style prop - EuiOverlayMask requires styles to be passed via className
|
|
67
|
+
if (containerRect) {
|
|
68
|
+
node.style.setProperty('inset-block-start', "".concat(containerRect.top, "px"));
|
|
69
|
+
node.style.setProperty('inset-inline-start', "".concat(containerRect.left, "px"));
|
|
70
|
+
node.style.setProperty('inline-size', "".concat(containerRect.width, "px"));
|
|
71
|
+
node.style.setProperty('block-size', "".concat(containerRect.height, "px"));
|
|
72
|
+
node.style.setProperty('inset-inline-end', 'auto');
|
|
73
|
+
node.style.setProperty('inset-block-end', 'auto');
|
|
74
|
+
} else {
|
|
75
|
+
node.style.removeProperty('inset-block-start');
|
|
76
|
+
node.style.removeProperty('inset-inline-start');
|
|
77
|
+
node.style.removeProperty('inline-size');
|
|
78
|
+
node.style.removeProperty('block-size');
|
|
79
|
+
node.style.removeProperty('inset-inline-end');
|
|
80
|
+
node.style.removeProperty('inset-block-end');
|
|
81
|
+
}
|
|
82
|
+
}, [containerRect, hasOverlayMask]); // toggling ownFocus while the flyout is already open should cause re-render
|
|
83
|
+
|
|
55
84
|
var content = children;
|
|
56
85
|
if (!isPushed || hasOverlayMask) {
|
|
57
86
|
content = (0, _react2.jsx)(_portal.EuiPortal, null, content);
|
|
@@ -60,6 +89,7 @@ var EuiFlyoutOverlay = exports.EuiFlyoutOverlay = function EuiFlyoutOverlay(_ref
|
|
|
60
89
|
return (0, _react2.jsx)(_react.default.Fragment, null, hasOverlayMask && (0, _react2.jsx)(_overlay_mask.EuiOverlayMask, (0, _extends2.default)({
|
|
61
90
|
headerZindexLocation: (_maskProps$headerZind = maskProps === null || maskProps === void 0 ? void 0 : maskProps.headerZindexLocation) !== null && _maskProps$headerZind !== void 0 ? _maskProps$headerZind : headerZindexLocation
|
|
62
91
|
}, maskProps, {
|
|
92
|
+
maskRef: combinedMaskRef,
|
|
63
93
|
className: classes
|
|
64
94
|
})), content);
|
|
65
95
|
};
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.FLYOUT_TYPES = exports.FLYOUT_SIZES = exports.FLYOUT_SIDES = exports.FLYOUT_PADDING_SIZES = exports.DEFAULT_TYPE = exports.DEFAULT_SIZE = exports.DEFAULT_SIDE = exports.DEFAULT_PUSH_MIN_BREAKPOINT = exports.DEFAULT_PADDING_SIZE = void 0;
|
|
6
|
+
exports.MENU_DISPLAY_AUTO = exports.MENU_DISPLAY_ALWAYS = exports.FLYOUT_TYPES = exports.FLYOUT_SIZES = exports.FLYOUT_SIDES = exports.FLYOUT_PADDING_SIZES = exports.FLYOUT_MENU_DISPLAY_MODES = exports.DEFAULT_TYPE = exports.DEFAULT_SIZE = exports.DEFAULT_SIDE = exports.DEFAULT_PUSH_MIN_BREAKPOINT = exports.DEFAULT_PADDING_SIZE = exports.DEFAULT_MENU_DISPLAY_MODE = void 0;
|
|
7
7
|
exports.isEuiFlyoutSizeNamed = isEuiFlyoutSizeNamed;
|
|
8
8
|
/*
|
|
9
9
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
@@ -25,6 +25,14 @@ var FLYOUT_SIDES = exports.FLYOUT_SIDES = ['left', 'right'];
|
|
|
25
25
|
var FLYOUT_SIZES = exports.FLYOUT_SIZES = ['s', 'm', 'l', 'fill'];
|
|
26
26
|
/** Type representing a supported named flyout size. */
|
|
27
27
|
|
|
28
|
+
/** Menu display mode: always render menu when flyoutMenuProps is provided. */
|
|
29
|
+
var MENU_DISPLAY_ALWAYS = exports.MENU_DISPLAY_ALWAYS = 'always';
|
|
30
|
+
/** Menu display mode: only render menu when it has content (back button, history, title, or custom actions). */
|
|
31
|
+
var MENU_DISPLAY_AUTO = exports.MENU_DISPLAY_AUTO = 'auto';
|
|
32
|
+
/** Allowed flyout menu display modes. */
|
|
33
|
+
var FLYOUT_MENU_DISPLAY_MODES = exports.FLYOUT_MENU_DISPLAY_MODES = [MENU_DISPLAY_ALWAYS, MENU_DISPLAY_AUTO];
|
|
34
|
+
/** Type representing a supported flyout menu display mode. */
|
|
35
|
+
|
|
28
36
|
/** Allowed padding sizes for flyout content. */
|
|
29
37
|
var FLYOUT_PADDING_SIZES = exports.FLYOUT_PADDING_SIZES = ['none', 's', 'm', 'l'];
|
|
30
38
|
/** Type representing a supported flyout padding size. */
|
|
@@ -39,6 +47,8 @@ var DEFAULT_SIDE = exports.DEFAULT_SIDE = 'right';
|
|
|
39
47
|
var DEFAULT_SIZE = exports.DEFAULT_SIZE = 'm';
|
|
40
48
|
/** Default padding size inside flyouts. */
|
|
41
49
|
var DEFAULT_PADDING_SIZE = exports.DEFAULT_PADDING_SIZE = 'l';
|
|
50
|
+
/** Default flyout menu display mode. */
|
|
51
|
+
var DEFAULT_MENU_DISPLAY_MODE = exports.DEFAULT_MENU_DISPLAY_MODE = MENU_DISPLAY_AUTO;
|
|
42
52
|
|
|
43
53
|
/**
|
|
44
54
|
* Custom type checker for named flyout sizes since the prop
|
|
@@ -31,9 +31,9 @@ var _flyout_resize_button = require("./_flyout_resize_button");
|
|
|
31
31
|
var _use_flyout_resizable = require("./use_flyout_resizable");
|
|
32
32
|
var _use_flyout_z_index = require("./use_flyout_z_index");
|
|
33
33
|
var _flyout_parent_context = require("./flyout_parent_context");
|
|
34
|
+
var _use_flyout_menu = require("./use_flyout_menu");
|
|
34
35
|
var _react2 = require("@emotion/react");
|
|
35
|
-
var _excluded = ["className", "children", "as", "hideCloseButton", "flyoutMenuProps", "closeButtonProps", "closeButtonPosition", "onClose", "ownFocus", "side", "size", "paddingSize", "maxWidth", "style", "hasChildBackground", "maskProps", "type", "outsideClickCloses", "pushMinBreakpoint", "pushAnimation", "focusTrapProps", "includeFixedHeadersInFocusTrap", "includeSelectorInFocusTrap", "aria-describedby", "aria-labelledby", "id", "resizable", "minWidth", "onResize", "onAnimationEnd", "container"]
|
|
36
|
-
_excluded2 = ["titleId"];
|
|
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", "container"];
|
|
37
37
|
/*
|
|
38
38
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
39
39
|
* or more contributor license agreements. Licensed under the Elastic License
|
|
@@ -71,31 +71,33 @@ var EuiFlyoutComponent = exports.EuiFlyoutComponent = /*#__PURE__*/(0, _react.fo
|
|
|
71
71
|
_usePropsWithComponen2 = _usePropsWithComponen.hideCloseButton,
|
|
72
72
|
hideCloseButton = _usePropsWithComponen2 === void 0 ? false : _usePropsWithComponen2,
|
|
73
73
|
_flyoutMenuProps = _usePropsWithComponen.flyoutMenuProps,
|
|
74
|
+
_usePropsWithComponen3 = _usePropsWithComponen.flyoutMenuDisplayMode,
|
|
75
|
+
flyoutMenuDisplayMode = _usePropsWithComponen3 === void 0 ? _const2.DEFAULT_MENU_DISPLAY_MODE : _usePropsWithComponen3,
|
|
74
76
|
closeButtonProps = _usePropsWithComponen.closeButtonProps,
|
|
75
|
-
|
|
76
|
-
closeButtonPosition =
|
|
77
|
+
_usePropsWithComponen4 = _usePropsWithComponen.closeButtonPosition,
|
|
78
|
+
closeButtonPosition = _usePropsWithComponen4 === void 0 ? 'inside' : _usePropsWithComponen4,
|
|
77
79
|
onClose = _usePropsWithComponen.onClose,
|
|
78
|
-
|
|
79
|
-
ownFocus =
|
|
80
|
-
|
|
81
|
-
side =
|
|
82
|
-
|
|
83
|
-
_size =
|
|
84
|
-
|
|
85
|
-
paddingSize =
|
|
86
|
-
|
|
87
|
-
maxWidth =
|
|
80
|
+
_usePropsWithComponen5 = _usePropsWithComponen.ownFocus,
|
|
81
|
+
ownFocus = _usePropsWithComponen5 === void 0 ? true : _usePropsWithComponen5,
|
|
82
|
+
_usePropsWithComponen6 = _usePropsWithComponen.side,
|
|
83
|
+
side = _usePropsWithComponen6 === void 0 ? _const2.DEFAULT_SIDE : _usePropsWithComponen6,
|
|
84
|
+
_usePropsWithComponen7 = _usePropsWithComponen.size,
|
|
85
|
+
_size = _usePropsWithComponen7 === void 0 ? _const2.DEFAULT_SIZE : _usePropsWithComponen7,
|
|
86
|
+
_usePropsWithComponen8 = _usePropsWithComponen.paddingSize,
|
|
87
|
+
paddingSize = _usePropsWithComponen8 === void 0 ? _const2.DEFAULT_PADDING_SIZE : _usePropsWithComponen8,
|
|
88
|
+
_usePropsWithComponen9 = _usePropsWithComponen.maxWidth,
|
|
89
|
+
maxWidth = _usePropsWithComponen9 === void 0 ? false : _usePropsWithComponen9,
|
|
88
90
|
style = _usePropsWithComponen.style,
|
|
89
|
-
|
|
90
|
-
hasChildBackground =
|
|
91
|
+
_usePropsWithComponen10 = _usePropsWithComponen.hasChildBackground,
|
|
92
|
+
hasChildBackground = _usePropsWithComponen10 === void 0 ? false : _usePropsWithComponen10,
|
|
91
93
|
maskProps = _usePropsWithComponen.maskProps,
|
|
92
|
-
|
|
93
|
-
type =
|
|
94
|
+
_usePropsWithComponen11 = _usePropsWithComponen.type,
|
|
95
|
+
type = _usePropsWithComponen11 === void 0 ? _const2.DEFAULT_TYPE : _usePropsWithComponen11,
|
|
94
96
|
outsideClickCloses = _usePropsWithComponen.outsideClickCloses,
|
|
95
|
-
|
|
96
|
-
pushMinBreakpoint =
|
|
97
|
-
|
|
98
|
-
|
|
97
|
+
_usePropsWithComponen12 = _usePropsWithComponen.pushMinBreakpoint,
|
|
98
|
+
pushMinBreakpoint = _usePropsWithComponen12 === void 0 ? _const2.DEFAULT_PUSH_MIN_BREAKPOINT : _usePropsWithComponen12,
|
|
99
|
+
_pushAnimation = _usePropsWithComponen.pushAnimation,
|
|
100
|
+
_hasAnimation = _usePropsWithComponen.hasAnimation,
|
|
99
101
|
_focusTrapProps = _usePropsWithComponen.focusTrapProps,
|
|
100
102
|
_usePropsWithComponen13 = _usePropsWithComponen.includeFixedHeadersInFocusTrap,
|
|
101
103
|
includeFixedHeadersInFocusTrap = _usePropsWithComponen13 === void 0 ? true : _usePropsWithComponen13,
|
|
@@ -111,6 +113,8 @@ var EuiFlyoutComponent = exports.EuiFlyoutComponent = /*#__PURE__*/(0, _react.fo
|
|
|
111
113
|
containerProp = _usePropsWithComponen.container,
|
|
112
114
|
rest = (0, _objectWithoutProperties2.default)(_usePropsWithComponen, _excluded);
|
|
113
115
|
var container = resolveContainer(containerProp);
|
|
116
|
+
var hasAnimationDefault = type === 'overlay';
|
|
117
|
+
var hasAnimation = _hasAnimation !== null && _hasAnimation !== void 0 ? _hasAnimation : hasAnimationDefault;
|
|
114
118
|
var _useEuiThemeCSSVariab = (0, _services.useEuiThemeCSSVariables)(),
|
|
115
119
|
setGlobalCSSVariables = _useEuiThemeCSSVariab.setGlobalCSSVariables;
|
|
116
120
|
var Element = as || defaultElement;
|
|
@@ -162,6 +166,21 @@ var EuiFlyoutComponent = exports.EuiFlyoutComponent = /*#__PURE__*/(0, _react.fo
|
|
|
162
166
|
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;
|
|
163
167
|
var isActiveManagedFlyout = (currentSession === null || currentSession === void 0 ? void 0 : currentSession.mainFlyoutId) === flyoutId || (currentSession === null || currentSession === void 0 ? void 0 : currentSession.childFlyoutId) === flyoutId;
|
|
164
168
|
var currentZIndexRef = (0, _react.useRef)((_managerState$current = managerState === null || managerState === void 0 ? void 0 : managerState.currentZIndex) !== null && _managerState$current !== void 0 ? _managerState$current : 0);
|
|
169
|
+
var _useEuiFlyoutMenu = (0, _use_flyout_menu.useEuiFlyoutMenu)({
|
|
170
|
+
flyoutMenuProps: _flyoutMenuProps,
|
|
171
|
+
flyoutMenuDisplayMode: flyoutMenuDisplayMode,
|
|
172
|
+
ariaLabelledBy: _ariaLabelledBy
|
|
173
|
+
}),
|
|
174
|
+
flyoutMenuId = _useEuiFlyoutMenu.flyoutMenuId,
|
|
175
|
+
flyoutMenuProps = _useEuiFlyoutMenu.flyoutMenuProps,
|
|
176
|
+
shouldRenderMenu = _useEuiFlyoutMenu.shouldRenderMenu,
|
|
177
|
+
ariaLabelledBy = _useEuiFlyoutMenu.ariaLabelledBy;
|
|
178
|
+
(0, _react.useEffect)(function () {
|
|
179
|
+
if (process.env.NODE_ENV === 'development' && _flyoutMenuProps && 'hideTitle' in _flyoutMenuProps) {
|
|
180
|
+
console.warn('EuiFlyout: `flyoutMenuProps.hideTitle` is deprecated. Use `EuiFlyoutHeader` for visible titles instead.');
|
|
181
|
+
}
|
|
182
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
183
|
+
}, []);
|
|
165
184
|
|
|
166
185
|
// Use a ref to access the latest flyoutManager without triggering effect re-runs
|
|
167
186
|
var flyoutManagerRef = (0, _react.useRef)(flyoutManager);
|
|
@@ -516,7 +535,7 @@ var EuiFlyoutComponent = exports.EuiFlyoutComponent = /*#__PURE__*/(0, _react.fo
|
|
|
516
535
|
return _objectSpread(_objectSpread(_objectSpread({}, style), composedStyles), containerPositionStyles);
|
|
517
536
|
}, [style, size, layoutMode, siblingFlyoutId, siblingFlyoutWidth, maxWidth, flyoutZIndex, containerRect, side, isChildFlyout]);
|
|
518
537
|
var styles = (0, _services.useEuiMemoizedStyles)(_flyout.euiFlyoutStyles);
|
|
519
|
-
var cssStyles = [styles.euiFlyout, styles.paddingSizes[paddingSize], (0, _const2.isEuiFlyoutSizeNamed)(size) && styles[size], maxWidth === false && styles.noMaxWidth, isPushed ? styles.push.push : styles.overlay.overlay, isPushed ? styles.push[side] : styles.overlay[side],
|
|
538
|
+
var cssStyles = [styles.euiFlyout, styles.paddingSizes[paddingSize], (0, _const2.isEuiFlyoutSizeNamed)(size) && styles[size], maxWidth === false && styles.noMaxWidth, isPushed ? styles.push.push : styles.overlay.overlay, isPushed ? styles.push[side] : styles.overlay[side], !hasAnimation && styles.noAnimation, styles[side]];
|
|
520
539
|
var classes = (0, _classnames.default)('euiFlyout', isChildFlyout && hasChildBackground && 'euiFlyout--hasChildBackground', className);
|
|
521
540
|
var flyoutToggle = (0, _react.useRef)(document.activeElement);
|
|
522
541
|
var _useState5 = (0, _react.useState)([]),
|
|
@@ -610,34 +629,6 @@ var EuiFlyoutComponent = exports.EuiFlyoutComponent = /*#__PURE__*/(0, _react.fo
|
|
|
610
629
|
})));
|
|
611
630
|
}, [hasOverlayMask, descriptionId, focusTrapShards.length]);
|
|
612
631
|
|
|
613
|
-
/*
|
|
614
|
-
* If the flyout menu is to be rendered, ensure the flyout has aria-labelledby referencing the menu's titleId
|
|
615
|
-
*/
|
|
616
|
-
var generatedMenuId = (0, _services.useGeneratedHtmlId)();
|
|
617
|
-
var _ref = _flyoutMenuProps || {},
|
|
618
|
-
_titleId = _ref.titleId,
|
|
619
|
-
flyoutMenuProps = (0, _objectWithoutProperties2.default)(_ref, _excluded2);
|
|
620
|
-
var hasMenu = !!_flyoutMenuProps;
|
|
621
|
-
var flyoutMenuId = (0, _react.useMemo)(function () {
|
|
622
|
-
if (!hasMenu) return undefined;
|
|
623
|
-
return _titleId || generatedMenuId;
|
|
624
|
-
}, [hasMenu, _titleId, generatedMenuId]);
|
|
625
|
-
|
|
626
|
-
// If the flyout level is LEVEL_MAIN, the title should be hidden by default
|
|
627
|
-
var flyoutMenuHideTitle = (0, _react.useMemo)(function () {
|
|
628
|
-
if (!hasMenu) return undefined;
|
|
629
|
-
if ((_flyoutMenuProps === null || _flyoutMenuProps === void 0 ? void 0 : _flyoutMenuProps.hideTitle) !== undefined) {
|
|
630
|
-
return _flyoutMenuProps.hideTitle;
|
|
631
|
-
}
|
|
632
|
-
return (currentSession === null || currentSession === void 0 ? void 0 : currentSession.mainFlyoutId) === flyoutId;
|
|
633
|
-
}, [hasMenu, _flyoutMenuProps, currentSession, flyoutId]);
|
|
634
|
-
var ariaLabelledBy = (0, _react.useMemo)(function () {
|
|
635
|
-
if (flyoutMenuId) {
|
|
636
|
-
return (0, _classnames.default)(flyoutMenuId, _ariaLabelledBy);
|
|
637
|
-
}
|
|
638
|
-
return _ariaLabelledBy;
|
|
639
|
-
}, [flyoutMenuId, _ariaLabelledBy]);
|
|
640
|
-
|
|
641
632
|
/*
|
|
642
633
|
* Trap focus even when `ownFocus={false}`, otherwise closing
|
|
643
634
|
* the flyout won't return focus to the originating button.
|
|
@@ -680,8 +671,10 @@ var EuiFlyoutComponent = exports.EuiFlyoutComponent = /*#__PURE__*/(0, _react.fo
|
|
|
680
671
|
isPushed: isPushed,
|
|
681
672
|
maskZIndex: maskZIndex,
|
|
682
673
|
headerZindexLocation: effectiveHeaderZindexLocation,
|
|
674
|
+
containerRect: containerRect,
|
|
683
675
|
maskProps: _objectSpread(_objectSpread({}, maskProps), {}, {
|
|
684
|
-
maskRef: maskCombinedRefs
|
|
676
|
+
maskRef: maskCombinedRefs,
|
|
677
|
+
hasAnimation: hasAnimation
|
|
685
678
|
})
|
|
686
679
|
}, (0, _react2.jsx)(_services.EuiWindowEvent, {
|
|
687
680
|
event: "keydown",
|
|
@@ -705,13 +698,12 @@ var EuiFlyoutComponent = exports.EuiFlyoutComponent = /*#__PURE__*/(0, _react.fo
|
|
|
705
698
|
"aria-labelledby": ariaLabelledBy,
|
|
706
699
|
"data-autofocus": !isPushed || undefined,
|
|
707
700
|
onAnimationEnd: onAnimationEnd
|
|
708
|
-
}), !isPushed && screenReaderDescription,
|
|
701
|
+
}), !isPushed && screenReaderDescription, shouldRenderMenu ? (0, _react2.jsx)(_flyout_menu.EuiFlyoutMenu, (0, _extends2.default)({}, flyoutMenuProps, {
|
|
702
|
+
titleId: flyoutMenuId
|
|
703
|
+
})) : !hideCloseButton && (0, _react2.jsx)(_flyout_close_button.EuiFlyoutCloseButton, (0, _extends2.default)({}, closeButtonProps, {
|
|
709
704
|
onClose: handleClose,
|
|
710
705
|
closeButtonPosition: closeButtonPosition,
|
|
711
706
|
side: side
|
|
712
|
-
})), _flyoutMenuProps && (0, _react2.jsx)(_flyout_menu.EuiFlyoutMenu, (0, _extends2.default)({}, flyoutMenuProps, {
|
|
713
|
-
hideTitle: flyoutMenuHideTitle,
|
|
714
|
-
titleId: flyoutMenuId
|
|
715
707
|
})), resizable && (0, _react2.jsx)(_flyout_resize_button.EuiFlyoutResizeButton, {
|
|
716
708
|
type: type,
|
|
717
709
|
side: side,
|
|
@@ -6,6 +6,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
8
|
exports.EuiFlyout = void 0;
|
|
9
|
+
Object.defineProperty(exports, "FLYOUT_MENU_DISPLAY_MODES", {
|
|
10
|
+
enumerable: true,
|
|
11
|
+
get: function get() {
|
|
12
|
+
return _const2.FLYOUT_MENU_DISPLAY_MODES;
|
|
13
|
+
}
|
|
14
|
+
});
|
|
9
15
|
Object.defineProperty(exports, "FLYOUT_PADDING_SIZES", {
|
|
10
16
|
enumerable: true,
|
|
11
17
|
get: function get() {
|
|
@@ -41,7 +47,7 @@ var _flyout_parent_context = require("./flyout_parent_context");
|
|
|
41
47
|
var _const = require("./manager/const");
|
|
42
48
|
var _react2 = require("@emotion/react");
|
|
43
49
|
var _const2 = require("./const");
|
|
44
|
-
var _excluded = ["as", "onClose", "onActive", "session"];
|
|
50
|
+
var _excluded = ["as", "onClose", "onActive", "session", "historyKey"];
|
|
45
51
|
/*
|
|
46
52
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
47
53
|
* or more contributor license agreements. Licensed under the Elastic License
|
|
@@ -57,6 +63,7 @@ var EuiFlyout = exports.EuiFlyout = /*#__PURE__*/(0, _react.forwardRef)(function
|
|
|
57
63
|
onClose = _usePropsWithComponen.onClose,
|
|
58
64
|
onActive = _usePropsWithComponen.onActive,
|
|
59
65
|
session = _usePropsWithComponen.session,
|
|
66
|
+
historyKey = _usePropsWithComponen.historyKey,
|
|
60
67
|
rest = (0, _objectWithoutProperties2.default)(_usePropsWithComponen, _excluded);
|
|
61
68
|
var hasActiveSession = (0, _manager.useHasActiveSession)();
|
|
62
69
|
var isInsideParentFlyout = (0, _flyout_parent_context.useIsInsideParentFlyout)();
|
|
@@ -83,6 +90,7 @@ var EuiFlyout = exports.EuiFlyout = /*#__PURE__*/(0, _react.forwardRef)(function
|
|
|
83
90
|
return null;
|
|
84
91
|
}
|
|
85
92
|
return (0, _react2.jsx)(_manager.EuiFlyoutMain, (0, _extends2.default)({}, rest, {
|
|
93
|
+
historyKey: historyKey,
|
|
86
94
|
onClose: onClose,
|
|
87
95
|
onActive: onActive,
|
|
88
96
|
as: "div",
|
|
@@ -93,6 +101,7 @@ var EuiFlyout = exports.EuiFlyout = /*#__PURE__*/(0, _react.forwardRef)(function
|
|
|
93
101
|
// session=inherit: auto-join existing session as child
|
|
94
102
|
if (hasActiveSession && effectiveSession === _const.SESSION_INHERIT) {
|
|
95
103
|
return (0, _react2.jsx)(_manager.EuiFlyoutChild, (0, _extends2.default)({}, rest, {
|
|
104
|
+
historyKey: historyKey,
|
|
96
105
|
onClose: onClose,
|
|
97
106
|
onActive: onActive,
|
|
98
107
|
as: "div",
|
|
@@ -74,9 +74,9 @@ var euiFlyoutStyles = exports.euiFlyoutStyles = function euiFlyoutStyles(euiThem
|
|
|
74
74
|
push: {
|
|
75
75
|
push: /*#__PURE__*/(0, _react.css)("clip-path:none;z-index:", Number(euiTheme.levels.flyout) - 1, ";;label:push;"),
|
|
76
76
|
right: /*#__PURE__*/(0, _react.css)((0, _global_styling.logicalCSS)('border-left', euiTheme.border.thick), ";;label:right;"),
|
|
77
|
-
left: /*#__PURE__*/(0, _react.css)((0, _global_styling.logicalCSS)('border-right', euiTheme.border.thick), ";;label:left;")
|
|
78
|
-
noAnimation: _ref
|
|
77
|
+
left: /*#__PURE__*/(0, _react.css)((0, _global_styling.logicalCSS)('border-right', euiTheme.border.thick), ";;label:left;")
|
|
79
78
|
},
|
|
79
|
+
noAnimation: _ref,
|
|
80
80
|
// Padding
|
|
81
81
|
paddingSizes: {
|
|
82
82
|
none: /*#__PURE__*/(0, _react.css)(composeFlyoutPadding(euiThemeContext, 'none'), ";;label:none;"),
|
|
@@ -22,7 +22,7 @@ var _flyout_menu = require("./flyout_menu.styles");
|
|
|
22
22
|
var _flyout_menu_context = require("./flyout_menu_context");
|
|
23
23
|
var _i18n = require("../i18n");
|
|
24
24
|
var _react2 = require("@emotion/react");
|
|
25
|
-
var _excluded = ["className", "title", "titleId", "hideTitle", "hideCloseButton", "historyItems", "showBackButton", "backButtonProps", "customActions"];
|
|
25
|
+
var _excluded = ["className", "title", "titleId", "hideTitle", "hideCloseButton", "historyItems", "showBackButton", "backButtonProps", "customActions", "iconType"];
|
|
26
26
|
/*
|
|
27
27
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
28
28
|
* or more contributor license agreements. Licensed under the Elastic License
|
|
@@ -81,6 +81,7 @@ var HistoryPopover = function HistoryPopover(_ref) {
|
|
|
81
81
|
return (0, _react2.jsx)(_list_group.EuiListGroupItem, {
|
|
82
82
|
key: "history-item-".concat(index),
|
|
83
83
|
label: item.title,
|
|
84
|
+
iconType: item.iconType,
|
|
84
85
|
size: "s",
|
|
85
86
|
onClick: function onClick() {
|
|
86
87
|
item.onClick();
|
|
@@ -104,13 +105,15 @@ var EuiFlyoutMenu = exports.EuiFlyoutMenu = function EuiFlyoutMenu(_ref2) {
|
|
|
104
105
|
var className = _ref2.className,
|
|
105
106
|
title = _ref2.title,
|
|
106
107
|
titleId = _ref2.titleId,
|
|
107
|
-
hideTitle = _ref2.hideTitle,
|
|
108
|
+
_ref2$hideTitle = _ref2.hideTitle,
|
|
109
|
+
hideTitle = _ref2$hideTitle === void 0 ? true : _ref2$hideTitle,
|
|
108
110
|
hideCloseButton = _ref2.hideCloseButton,
|
|
109
111
|
_ref2$historyItems = _ref2.historyItems,
|
|
110
112
|
historyItems = _ref2$historyItems === void 0 ? [] : _ref2$historyItems,
|
|
111
113
|
showBackButton = _ref2.showBackButton,
|
|
112
114
|
backButtonProps = _ref2.backButtonProps,
|
|
113
115
|
customActions = _ref2.customActions,
|
|
116
|
+
_iconType = _ref2.iconType,
|
|
114
117
|
rest = (0, _objectWithoutProperties2.default)(_ref2, _excluded);
|
|
115
118
|
var _useContext = (0, _react.useContext)(_flyout_menu_context.EuiFlyoutMenuContext),
|
|
116
119
|
onClose = _useContext.onClose;
|
|
@@ -135,7 +138,8 @@ var EuiFlyoutMenu = exports.EuiFlyoutMenu = function EuiFlyoutMenu(_ref2) {
|
|
|
135
138
|
});
|
|
136
139
|
return (0, _react2.jsx)("div", (0, _extends2.default)({
|
|
137
140
|
className: classes,
|
|
138
|
-
css: styles.euiFlyoutMenu__container
|
|
141
|
+
css: styles.euiFlyoutMenu__container,
|
|
142
|
+
"data-test-subj": "euiFlyoutMenu"
|
|
139
143
|
}, rest), (0, _react2.jsx)(_flex.EuiFlexGroup, {
|
|
140
144
|
alignItems: "center",
|
|
141
145
|
justifyContent: "spaceBetween",
|
|
@@ -60,7 +60,7 @@ var ACTION_CLOSE_UNMANAGED_FLYOUT = exports.ACTION_CLOSE_UNMANAGED_FLYOUT = "".c
|
|
|
60
60
|
|
|
61
61
|
/** Go back one session (remove current session from stack). */
|
|
62
62
|
|
|
63
|
-
/** Navigate to a specific flyout (remove all sessions after it). */
|
|
63
|
+
/** Navigate to a specific flyout (remove all sessions after it, or pop to child in history). */
|
|
64
64
|
|
|
65
65
|
/** Set push padding offset for a specific side. */
|
|
66
66
|
|
|
@@ -75,17 +75,23 @@ var ACTION_CLOSE_UNMANAGED_FLYOUT = exports.ACTION_CLOSE_UNMANAGED_FLYOUT = "".c
|
|
|
75
75
|
* - `title` is used for the flyout menu.
|
|
76
76
|
* - `level` determines whether the flyout is `main` or `child`.
|
|
77
77
|
* - Optional `size` is the named EUI size (e.g. `s`, `m`, `l`).
|
|
78
|
+
* - Optional `historyKey` (Symbol) scopes history; only flyouts with the same reference share Back/history. Omit for a unique group per session.
|
|
79
|
+
* - Optional `iconType` is shown next to the session title in the history menu.
|
|
78
80
|
*/
|
|
79
81
|
var addFlyout = exports.addFlyout = function addFlyout(flyoutId, title) {
|
|
80
82
|
var level = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : _const.LEVEL_MAIN;
|
|
81
83
|
var size = arguments.length > 3 ? arguments[3] : undefined;
|
|
82
|
-
var
|
|
84
|
+
var historyKey = arguments.length > 4 ? arguments[4] : undefined;
|
|
85
|
+
var iconType = arguments.length > 5 ? arguments[5] : undefined;
|
|
86
|
+
var minWidth = arguments.length > 6 ? arguments[6] : undefined;
|
|
83
87
|
return {
|
|
84
88
|
type: ACTION_ADD,
|
|
85
89
|
flyoutId: flyoutId,
|
|
86
90
|
title: title,
|
|
87
91
|
level: level,
|
|
88
92
|
size: size,
|
|
93
|
+
historyKey: historyKey,
|
|
94
|
+
iconType: iconType,
|
|
89
95
|
minWidth: minWidth
|
|
90
96
|
};
|
|
91
97
|
};
|
|
@@ -146,11 +152,12 @@ var goBack = exports.goBack = function goBack() {
|
|
|
146
152
|
};
|
|
147
153
|
};
|
|
148
154
|
|
|
149
|
-
/** Navigate to a specific flyout (remove all sessions after it). */
|
|
150
|
-
var goToFlyout = exports.goToFlyout = function goToFlyout(flyoutId) {
|
|
155
|
+
/** Navigate to a specific flyout (remove all sessions after it, or pop to child in history when level === 'child'). */
|
|
156
|
+
var goToFlyout = exports.goToFlyout = function goToFlyout(flyoutId, level) {
|
|
151
157
|
return {
|
|
152
158
|
type: ACTION_GO_TO_FLYOUT,
|
|
153
|
-
flyoutId: flyoutId
|
|
159
|
+
flyoutId: flyoutId,
|
|
160
|
+
level: level
|
|
154
161
|
};
|
|
155
162
|
};
|
|
156
163
|
|
|
@@ -23,9 +23,10 @@ var _context = require("./context");
|
|
|
23
23
|
var _flyout_managed = require("./flyout_managed.styles");
|
|
24
24
|
var _hooks = require("./hooks");
|
|
25
25
|
var _selectors = require("./selectors");
|
|
26
|
+
var _store = require("./store");
|
|
26
27
|
var _validation = require("./validation");
|
|
27
28
|
var _react2 = require("@emotion/react");
|
|
28
|
-
var _excluded = ["id", "onClose", "onActive", "level", "size", "minWidth", "css", "flyoutMenuProps"];
|
|
29
|
+
var _excluded = ["id", "onClose", "onActive", "level", "size", "minWidth", "historyKey", "css", "flyoutMenuProps"];
|
|
29
30
|
/*
|
|
30
31
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
31
32
|
* or more contributor license agreements. Licensed under the Elastic License
|
|
@@ -65,6 +66,7 @@ var EuiManagedFlyout = exports.EuiManagedFlyout = /*#__PURE__*/(0, _react.forwar
|
|
|
65
66
|
level = _ref.level,
|
|
66
67
|
sizeProp = _ref.size,
|
|
67
68
|
minWidth = _ref.minWidth,
|
|
69
|
+
historyKey = _ref.historyKey,
|
|
68
70
|
customCss = _ref.css,
|
|
69
71
|
_flyoutMenuProps = _ref.flyoutMenuProps,
|
|
70
72
|
props = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
@@ -163,18 +165,23 @@ var EuiManagedFlyout = exports.EuiManagedFlyout = /*#__PURE__*/(0, _react.forwar
|
|
|
163
165
|
// Register with flyout manager context when open, remove when closed
|
|
164
166
|
// Using useLayoutEffect to run synchronously before DOM updates
|
|
165
167
|
(0, _react.useLayoutEffect)(function () {
|
|
166
|
-
addFlyout(flyoutId, title, level, size, typeof minWidth === 'number' ? minWidth : undefined);
|
|
168
|
+
addFlyout(flyoutId, title, level, size, level === _const.LEVEL_MAIN ? historyKey : undefined, _flyoutMenuProps === null || _flyoutMenuProps === void 0 ? void 0 : _flyoutMenuProps.iconType, typeof minWidth === 'number' ? minWidth : undefined);
|
|
167
169
|
return function () {
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
170
|
+
var currentStoreState = (0, _store.getFlyoutManagerStore)().getState();
|
|
171
|
+
var stillInStore = currentStoreState.flyouts.some(function (f) {
|
|
172
|
+
return f.flyoutId === flyoutId;
|
|
173
|
+
});
|
|
174
|
+
if (stillInStore) {
|
|
175
|
+
// Normal cleanup (deps changed or explicit close via isOpen=false)
|
|
171
176
|
level === _const.LEVEL_MAIN ? closeAllFlyouts() : closeFlyout(flyoutId);
|
|
177
|
+
} else if (wasRegisteredRef.current) {
|
|
178
|
+
var _onCloseCallbackRef$c;
|
|
179
|
+
// Cascade close: was registered but removed externally (e.g. main closed)
|
|
180
|
+
(_onCloseCallbackRef$c = onCloseCallbackRef.current) === null || _onCloseCallbackRef$c === void 0 || _onCloseCallbackRef$c.call(onCloseCallbackRef, new MouseEvent('navigation'));
|
|
172
181
|
}
|
|
173
|
-
|
|
174
|
-
// Reset navigation tracking when explicitly closed via isOpen=false
|
|
175
182
|
wasRegisteredRef.current = false;
|
|
176
183
|
};
|
|
177
|
-
}, [flyoutId, title, level, size, minWidth, addFlyout, closeFlyout, closeAllFlyouts]);
|
|
184
|
+
}, [flyoutId, title, level, size, minWidth, historyKey, _flyoutMenuProps === null || _flyoutMenuProps === void 0 ? void 0 : _flyoutMenuProps.iconType, addFlyout, closeFlyout, closeAllFlyouts]);
|
|
178
185
|
|
|
179
186
|
// Detect when flyout has been removed from manager state (e.g., via Back button)
|
|
180
187
|
// and trigger onClose callback to notify the parent component
|
|
@@ -186,8 +193,8 @@ var EuiManagedFlyout = exports.EuiManagedFlyout = /*#__PURE__*/(0, _react.forwar
|
|
|
186
193
|
// If flyout was previously registered, is marked as open, but no longer exists in manager state,
|
|
187
194
|
// it was removed via navigation (Back button) - trigger close callback
|
|
188
195
|
if (wasRegisteredRef.current && !flyoutExistsInManager) {
|
|
189
|
-
var _onCloseCallbackRef$
|
|
190
|
-
(_onCloseCallbackRef$
|
|
196
|
+
var _onCloseCallbackRef$c2;
|
|
197
|
+
(_onCloseCallbackRef$c2 = onCloseCallbackRef.current) === null || _onCloseCallbackRef$c2 === void 0 || _onCloseCallbackRef$c2.call(onCloseCallbackRef, new MouseEvent('navigation'));
|
|
191
198
|
wasRegisteredRef.current = false; // Reset to avoid repeated calls
|
|
192
199
|
}
|
|
193
200
|
}, [flyoutExistsInManager, flyoutId]);
|
|
@@ -219,8 +226,7 @@ var EuiManagedFlyout = exports.EuiManagedFlyout = /*#__PURE__*/(0, _react.forwar
|
|
|
219
226
|
(0, _reactDom.flushSync)(function () {
|
|
220
227
|
level === _const.LEVEL_MAIN ? closeAllFlyouts() : closeFlyout(flyoutId);
|
|
221
228
|
});
|
|
222
|
-
|
|
223
|
-
// trigger parent callback, unmounts the component
|
|
229
|
+
wasRegisteredRef.current = false; // Prevent cleanup from double-firing onClose
|
|
224
230
|
if (onCloseCallbackRef.current) {
|
|
225
231
|
var event = e || new MouseEvent('click');
|
|
226
232
|
onCloseCallbackRef.current(event);
|