@elastic/eui 113.2.0 → 113.3.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.
Files changed (79) hide show
  1. package/es/components/basic_table/collapsed_item_actions.js +2 -0
  2. package/es/components/context_menu/context_menu_item.js +9 -3
  3. package/es/components/context_menu/context_menu_item.styles.js +6 -2
  4. package/es/components/date_picker/super_date_picker/time_window_buttons.js +17 -3
  5. package/es/components/flyout/const.js +10 -0
  6. package/es/components/flyout/flyout.component.js +47 -59
  7. package/es/components/flyout/flyout.js +1 -1
  8. package/es/components/flyout/flyout_menu.js +17 -4
  9. package/es/components/flyout/manager/actions.js +9 -5
  10. package/es/components/flyout/manager/flyout_child.js +8 -2
  11. package/es/components/flyout/manager/flyout_managed.js +24 -13
  12. package/es/components/flyout/manager/reducer.js +182 -44
  13. package/es/components/flyout/manager/store.js +67 -12
  14. package/es/components/flyout/use_flyout_menu.js +70 -0
  15. package/es/components/form/file_picker/file_picker.js +46 -18
  16. package/es/components/table/table_row_cell.js +2 -2
  17. package/eui.d.ts +397 -15
  18. package/lib/components/basic_table/collapsed_item_actions.js +2 -0
  19. package/lib/components/context_menu/context_menu_item.js +9 -3
  20. package/lib/components/context_menu/context_menu_item.styles.js +5 -1
  21. package/lib/components/date_picker/super_date_picker/time_window_buttons.js +17 -3
  22. package/lib/components/flyout/const.js +11 -1
  23. package/lib/components/flyout/flyout.component.js +46 -58
  24. package/lib/components/flyout/flyout.js +6 -0
  25. package/lib/components/flyout/flyout_menu.js +17 -4
  26. package/lib/components/flyout/manager/actions.js +9 -5
  27. package/lib/components/flyout/manager/flyout_child.js +8 -2
  28. package/lib/components/flyout/manager/flyout_managed.js +16 -11
  29. package/lib/components/flyout/manager/reducer.js +181 -43
  30. package/lib/components/flyout/manager/store.js +67 -14
  31. package/lib/components/flyout/use_flyout_menu.js +75 -0
  32. package/lib/components/form/file_picker/file_picker.js +46 -18
  33. package/lib/components/table/table_row_cell.js +2 -2
  34. package/optimize/es/components/basic_table/collapsed_item_actions.js +2 -0
  35. package/optimize/es/components/context_menu/context_menu_item.js +3 -2
  36. package/optimize/es/components/context_menu/context_menu_item.styles.js +6 -2
  37. package/optimize/es/components/date_picker/super_date_picker/time_window_buttons.js +17 -3
  38. package/optimize/es/components/flyout/const.js +10 -0
  39. package/optimize/es/components/flyout/flyout.component.js +47 -59
  40. package/optimize/es/components/flyout/flyout.js +1 -1
  41. package/optimize/es/components/flyout/flyout_menu.js +5 -2
  42. package/optimize/es/components/flyout/manager/actions.js +9 -5
  43. package/optimize/es/components/flyout/manager/flyout_managed.js +16 -11
  44. package/optimize/es/components/flyout/manager/reducer.js +182 -44
  45. package/optimize/es/components/flyout/manager/store.js +62 -12
  46. package/optimize/es/components/flyout/use_flyout_menu.js +69 -0
  47. package/optimize/es/components/form/file_picker/file_picker.js +35 -18
  48. package/optimize/es/components/table/table_row_cell.js +2 -2
  49. package/optimize/lib/components/basic_table/collapsed_item_actions.js +2 -0
  50. package/optimize/lib/components/context_menu/context_menu_item.js +3 -2
  51. package/optimize/lib/components/context_menu/context_menu_item.styles.js +5 -1
  52. package/optimize/lib/components/date_picker/super_date_picker/time_window_buttons.js +17 -3
  53. package/optimize/lib/components/flyout/const.js +11 -1
  54. package/optimize/lib/components/flyout/flyout.component.js +46 -58
  55. package/optimize/lib/components/flyout/flyout.js +6 -0
  56. package/optimize/lib/components/flyout/flyout_menu.js +5 -2
  57. package/optimize/lib/components/flyout/manager/actions.js +9 -5
  58. package/optimize/lib/components/flyout/manager/flyout_managed.js +16 -11
  59. package/optimize/lib/components/flyout/manager/reducer.js +181 -43
  60. package/optimize/lib/components/flyout/manager/store.js +63 -12
  61. package/optimize/lib/components/flyout/use_flyout_menu.js +74 -0
  62. package/optimize/lib/components/form/file_picker/file_picker.js +35 -18
  63. package/optimize/lib/components/table/table_row_cell.js +2 -2
  64. package/package.json +3 -3
  65. package/test-env/components/basic_table/collapsed_item_actions.js +2 -0
  66. package/test-env/components/context_menu/context_menu_item.js +9 -3
  67. package/test-env/components/context_menu/context_menu_item.styles.js +5 -1
  68. package/test-env/components/date_picker/super_date_picker/time_window_buttons.js +17 -3
  69. package/test-env/components/flyout/const.js +11 -1
  70. package/test-env/components/flyout/flyout.component.js +46 -58
  71. package/test-env/components/flyout/flyout_menu.js +17 -4
  72. package/test-env/components/flyout/manager/actions.js +9 -5
  73. package/test-env/components/flyout/manager/flyout_child.js +8 -2
  74. package/test-env/components/flyout/manager/flyout_managed.js +16 -11
  75. package/test-env/components/flyout/manager/reducer.js +181 -43
  76. package/test-env/components/flyout/manager/store.js +63 -12
  77. package/test-env/components/flyout/use_flyout_menu.js +74 -0
  78. package/test-env/components/form/file_picker/file_picker.js +46 -18
  79. package/test-env/components/table/table_row_cell.js +2 -2
@@ -16,7 +16,7 @@ var _icon = require("../icon");
16
16
  var _tool_tip = require("../tool_tip");
17
17
  var _context_menu_item = require("./context_menu_item.styles");
18
18
  var _react2 = require("@emotion/react");
19
- var _excluded = ["children", "className", "hasPanel", "icon", "buttonRef", "disabled", "layoutAlign", "toolTipContent", "toolTipProps", "href", "target", "rel", "size"];
19
+ var _excluded = ["children", "className", "hasPanel", "icon", "buttonRef", "disabled", "layoutAlign", "toolTipContent", "toolTipProps", "href", "target", "rel", "size", "color"];
20
20
  /*
21
21
  * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
22
22
  * or more contributor license agreements. Licensed under the Elastic License
@@ -47,12 +47,13 @@ var EuiContextMenuItem = exports.EuiContextMenuItem = function EuiContextMenuIte
47
47
  rel = _ref.rel,
48
48
  _ref$size = _ref.size,
49
49
  size = _ref$size === void 0 ? 'm' : _ref$size,
50
+ color = _ref.color,
50
51
  rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
51
52
  var isHrefValid = !href || (0, _href_validator.validateHref)(href);
52
53
  var disabled = _disabled || !isHrefValid;
53
54
  var classes = (0, _classnames.default)('euiContextMenuItem', className);
54
55
  var styles = (0, _services.useEuiMemoizedStyles)(_context_menu_item.euiContextMenuItemStyles);
55
- var cssStyles = [styles.euiContextMenuItem, styles.sizes[size], styles.layoutAlign[layoutAlign], disabled && styles.disabled];
56
+ var cssStyles = [styles.euiContextMenuItem, styles.sizes[size], styles.layoutAlign[layoutAlign], disabled && styles.disabled, !disabled && color && styles.colors[color]];
56
57
  var iconInstance = icon && (typeof icon === 'string' ? (0, _react2.jsx)(_icon.EuiIcon, {
57
58
  type: icon,
58
59
  size: "m",
@@ -81,6 +81,10 @@ var euiContextMenuItemStyles = exports.euiContextMenuItemStyles = function euiCo
81
81
  euiContextMenuItem__text: _ref2,
82
82
  s: /*#__PURE__*/(0, _react.css)((0, _global_styling.euiFontSize)(euiThemeContext, 's'), ";;label:s;")
83
83
  },
84
- euiContextMenuItem__arrow: _ref
84
+ euiContextMenuItem__arrow: _ref,
85
+ // Colors - maps button color names to text color overrides
86
+ colors: Object.fromEntries(_global_styling.EXTENDED_BUTTON_COLORS.map(function (color) {
87
+ return [color, /*#__PURE__*/(0, _react.css)("color:", (0, _global_styling.euiButtonEmptyColor)(euiThemeContext, color).color, ";;label:colors;")];
88
+ }))
85
89
  };
86
90
  };
@@ -160,11 +160,20 @@ var EuiTimeWindowButtons = exports.EuiTimeWindowButtons = function EuiTimeWindow
160
160
  function useEuiTimeWindow(start, end, apply, options) {
161
161
  var _options$zoomFactor;
162
162
  var min = _datemath.default.parse(start);
163
+
164
+ /* `roundUp: true` will result in an "inclusive" time (e.g. 23:59:59.999 for 'now/d').
165
+ It only changes the value for relative expressions (e.g. 'now/d') but not absolute ISO strings. */
163
166
  var max = _datemath.default.parse(end, {
164
167
  roundUp: true
165
168
  });
166
169
  var isInvalid = !min || !min.isValid() || !max || !max.isValid();
167
- var windowDuration = isInvalid ? -1 : max.diff(min);
170
+ /* An end at .999ms is always considered an inclusive boundary (either as result of `roundUp: true`
171
+ or entered manually).
172
+ To avoid a 1ms drift on every time window or zoom step, windowDuration has to be increased by 1ms.
173
+ This ensures the window is always at a clean boundary (e.g. 00:00:00.000 - 23:59:59.999). */
174
+ var isInclusiveBoundary = !isInvalid && max.milliseconds() === 999;
175
+ var endBoundary = !isInvalid ? isInclusiveBoundary ? (0, _moment.default)(max).add(1, 'ms') : (0, _moment.default)(max) : null;
176
+ var windowDuration = isInvalid || !endBoundary ? -1 : endBoundary.diff(min);
168
177
  var isWindowDurationZero = windowDuration === 0;
169
178
  var zoomFactor = getPercentageMultiplier((_options$zoomFactor = options === null || options === void 0 ? void 0 : options.zoomFactor) !== null && _options$zoomFactor !== void 0 ? _options$zoomFactor : ZOOM_FACTOR_DEFAULT);
170
179
  var zoomDelta = windowDuration * (zoomFactor / 2); // Gets added to each end, that's why it's split in half
@@ -185,7 +194,10 @@ function useEuiTimeWindow(start, end, apply, options) {
185
194
  function stepForward() {
186
195
  if (isInvalid || isWindowDurationZero) return;
187
196
  apply({
188
- start: (0, _moment.default)(max).toISOString(),
197
+ /* Prevent 1ms drifts for inclusive boundaries by using the exclusive max (+ 1ms)
198
+ as the start of the next window (e.g. 00:00:00.000 instead of 23:59:59.999) */
199
+ start: (isInclusiveBoundary ? endBoundary // `!` is safe here because we early return on `isInvalid`
200
+ : (0, _moment.default)(max)).toISOString(),
189
201
  end: (0, _moment.default)(max).add(windowDuration, 'ms').toISOString()
190
202
  });
191
203
  }
@@ -193,7 +205,9 @@ function useEuiTimeWindow(start, end, apply, options) {
193
205
  if (isInvalid || isWindowDurationZero) return;
194
206
  apply({
195
207
  start: (0, _moment.default)(min).subtract(windowDuration, 'ms').toISOString(),
196
- end: (0, _moment.default)(min).toISOString()
208
+ /* Prevent 1ms drifts for inclusive boundaries by using the exclusive min (- 1ms)
209
+ as the end of the previous window (e.g. 23:59:59.999 instead of 00:00:00.000) */
210
+ end: (isInclusiveBoundary ? (0, _moment.default)(min).subtract(1, 'ms') : (0, _moment.default)(min)).toISOString()
197
211
  });
198
212
  }
199
213
  function expandWindow() {
@@ -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", "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,40 +71,42 @@ 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
- _usePropsWithComponen3 = _usePropsWithComponen.closeButtonPosition,
76
- closeButtonPosition = _usePropsWithComponen3 === void 0 ? 'inside' : _usePropsWithComponen3,
77
+ _usePropsWithComponen4 = _usePropsWithComponen.closeButtonPosition,
78
+ closeButtonPosition = _usePropsWithComponen4 === void 0 ? 'inside' : _usePropsWithComponen4,
77
79
  onClose = _usePropsWithComponen.onClose,
78
- _usePropsWithComponen4 = _usePropsWithComponen.ownFocus,
79
- ownFocus = _usePropsWithComponen4 === void 0 ? true : _usePropsWithComponen4,
80
- _usePropsWithComponen5 = _usePropsWithComponen.side,
81
- side = _usePropsWithComponen5 === void 0 ? _const2.DEFAULT_SIDE : _usePropsWithComponen5,
82
- _usePropsWithComponen6 = _usePropsWithComponen.size,
83
- _size = _usePropsWithComponen6 === void 0 ? _const2.DEFAULT_SIZE : _usePropsWithComponen6,
84
- _usePropsWithComponen7 = _usePropsWithComponen.paddingSize,
85
- paddingSize = _usePropsWithComponen7 === void 0 ? _const2.DEFAULT_PADDING_SIZE : _usePropsWithComponen7,
86
- _usePropsWithComponen8 = _usePropsWithComponen.maxWidth,
87
- maxWidth = _usePropsWithComponen8 === void 0 ? false : _usePropsWithComponen8,
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
- _usePropsWithComponen9 = _usePropsWithComponen.hasChildBackground,
90
- hasChildBackground = _usePropsWithComponen9 === void 0 ? false : _usePropsWithComponen9,
91
+ _usePropsWithComponen10 = _usePropsWithComponen.hasChildBackground,
92
+ hasChildBackground = _usePropsWithComponen10 === void 0 ? false : _usePropsWithComponen10,
91
93
  maskProps = _usePropsWithComponen.maskProps,
92
- _usePropsWithComponen10 = _usePropsWithComponen.type,
93
- type = _usePropsWithComponen10 === void 0 ? _const2.DEFAULT_TYPE : _usePropsWithComponen10,
94
+ _usePropsWithComponen11 = _usePropsWithComponen.type,
95
+ type = _usePropsWithComponen11 === void 0 ? _const2.DEFAULT_TYPE : _usePropsWithComponen11,
94
96
  outsideClickCloses = _usePropsWithComponen.outsideClickCloses,
95
- _usePropsWithComponen11 = _usePropsWithComponen.pushMinBreakpoint,
96
- pushMinBreakpoint = _usePropsWithComponen11 === void 0 ? _const2.DEFAULT_PUSH_MIN_BREAKPOINT : _usePropsWithComponen11,
97
- _usePropsWithComponen12 = _usePropsWithComponen.pushAnimation,
98
- pushAnimation = _usePropsWithComponen12 === void 0 ? false : _usePropsWithComponen12,
97
+ _usePropsWithComponen12 = _usePropsWithComponen.pushMinBreakpoint,
98
+ pushMinBreakpoint = _usePropsWithComponen12 === void 0 ? _const2.DEFAULT_PUSH_MIN_BREAKPOINT : _usePropsWithComponen12,
99
+ _usePropsWithComponen13 = _usePropsWithComponen.pushAnimation,
100
+ pushAnimation = _usePropsWithComponen13 === void 0 ? false : _usePropsWithComponen13,
99
101
  _focusTrapProps = _usePropsWithComponen.focusTrapProps,
100
- _usePropsWithComponen13 = _usePropsWithComponen.includeFixedHeadersInFocusTrap,
101
- includeFixedHeadersInFocusTrap = _usePropsWithComponen13 === void 0 ? true : _usePropsWithComponen13,
102
+ _usePropsWithComponen14 = _usePropsWithComponen.includeFixedHeadersInFocusTrap,
103
+ includeFixedHeadersInFocusTrap = _usePropsWithComponen14 === void 0 ? true : _usePropsWithComponen14,
102
104
  includeSelectorInFocusTrap = _usePropsWithComponen.includeSelectorInFocusTrap,
103
105
  _ariaDescribedBy = _usePropsWithComponen['aria-describedby'],
104
106
  _ariaLabelledBy = _usePropsWithComponen['aria-labelledby'],
105
107
  id = _usePropsWithComponen.id,
106
- _usePropsWithComponen14 = _usePropsWithComponen.resizable,
107
- resizable = _usePropsWithComponen14 === void 0 ? false : _usePropsWithComponen14,
108
+ _usePropsWithComponen15 = _usePropsWithComponen.resizable,
109
+ resizable = _usePropsWithComponen15 === void 0 ? false : _usePropsWithComponen15,
108
110
  minWidth = _usePropsWithComponen.minWidth,
109
111
  onResize = _usePropsWithComponen.onResize,
110
112
  onAnimationEnd = _usePropsWithComponen.onAnimationEnd,
@@ -162,6 +164,21 @@ var EuiFlyoutComponent = exports.EuiFlyoutComponent = /*#__PURE__*/(0, _react.fo
162
164
  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
165
  var isActiveManagedFlyout = (currentSession === null || currentSession === void 0 ? void 0 : currentSession.mainFlyoutId) === flyoutId || (currentSession === null || currentSession === void 0 ? void 0 : currentSession.childFlyoutId) === flyoutId;
164
166
  var currentZIndexRef = (0, _react.useRef)((_managerState$current = managerState === null || managerState === void 0 ? void 0 : managerState.currentZIndex) !== null && _managerState$current !== void 0 ? _managerState$current : 0);
167
+ var _useEuiFlyoutMenu = (0, _use_flyout_menu.useEuiFlyoutMenu)({
168
+ flyoutMenuProps: _flyoutMenuProps,
169
+ flyoutMenuDisplayMode: flyoutMenuDisplayMode,
170
+ ariaLabelledBy: _ariaLabelledBy
171
+ }),
172
+ flyoutMenuId = _useEuiFlyoutMenu.flyoutMenuId,
173
+ flyoutMenuProps = _useEuiFlyoutMenu.flyoutMenuProps,
174
+ shouldRenderMenu = _useEuiFlyoutMenu.shouldRenderMenu,
175
+ ariaLabelledBy = _useEuiFlyoutMenu.ariaLabelledBy;
176
+ (0, _react.useEffect)(function () {
177
+ if (process.env.NODE_ENV === 'development' && _flyoutMenuProps && 'hideTitle' in _flyoutMenuProps) {
178
+ console.warn('EuiFlyout: `flyoutMenuProps.hideTitle` is deprecated. Use `EuiFlyoutHeader` for visible titles instead.');
179
+ }
180
+ // eslint-disable-next-line react-hooks/exhaustive-deps
181
+ }, []);
165
182
 
166
183
  // Use a ref to access the latest flyoutManager without triggering effect re-runs
167
184
  var flyoutManagerRef = (0, _react.useRef)(flyoutManager);
@@ -610,34 +627,6 @@ var EuiFlyoutComponent = exports.EuiFlyoutComponent = /*#__PURE__*/(0, _react.fo
610
627
  })));
611
628
  }, [hasOverlayMask, descriptionId, focusTrapShards.length]);
612
629
 
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
630
  /*
642
631
  * Trap focus even when `ownFocus={false}`, otherwise closing
643
632
  * the flyout won't return focus to the originating button.
@@ -705,13 +694,12 @@ var EuiFlyoutComponent = exports.EuiFlyoutComponent = /*#__PURE__*/(0, _react.fo
705
694
  "aria-labelledby": ariaLabelledBy,
706
695
  "data-autofocus": !isPushed || undefined,
707
696
  onAnimationEnd: onAnimationEnd
708
- }), !isPushed && screenReaderDescription, !_flyoutMenuProps && !hideCloseButton && (0, _react2.jsx)(_flyout_close_button.EuiFlyoutCloseButton, (0, _extends2.default)({}, closeButtonProps, {
697
+ }), !isPushed && screenReaderDescription, shouldRenderMenu ? (0, _react2.jsx)(_flyout_menu.EuiFlyoutMenu, (0, _extends2.default)({}, flyoutMenuProps, {
698
+ titleId: flyoutMenuId
699
+ })) : !hideCloseButton && (0, _react2.jsx)(_flyout_close_button.EuiFlyoutCloseButton, (0, _extends2.default)({}, closeButtonProps, {
709
700
  onClose: handleClose,
710
701
  closeButtonPosition: closeButtonPosition,
711
702
  side: side
712
- })), _flyoutMenuProps && (0, _react2.jsx)(_flyout_menu.EuiFlyoutMenu, (0, _extends2.default)({}, flyoutMenuProps, {
713
- hideTitle: flyoutMenuHideTitle,
714
- titleId: flyoutMenuId
715
703
  })), resizable && (0, _react2.jsx)(_flyout_resize_button.EuiFlyoutResizeButton, {
716
704
  type: type,
717
705
  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() {
@@ -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,7 +105,8 @@ 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,
@@ -135,7 +137,8 @@ var EuiFlyoutMenu = exports.EuiFlyoutMenu = function EuiFlyoutMenu(_ref2) {
135
137
  });
136
138
  return (0, _react2.jsx)("div", (0, _extends2.default)({
137
139
  className: classes,
138
- css: styles.euiFlyoutMenu__container
140
+ css: styles.euiFlyoutMenu__container,
141
+ "data-test-subj": "euiFlyoutMenu"
139
142
  }, rest), (0, _react2.jsx)(_flex.EuiFlexGroup, {
140
143
  alignItems: "center",
141
144
  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,20 @@ 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 `iconType` is shown next to the session title in the history menu.
78
79
  */
79
80
  var addFlyout = exports.addFlyout = function addFlyout(flyoutId, title) {
80
81
  var level = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : _const.LEVEL_MAIN;
81
82
  var size = arguments.length > 3 ? arguments[3] : undefined;
82
- var minWidth = arguments.length > 4 ? arguments[4] : undefined;
83
+ var iconType = arguments.length > 4 ? arguments[4] : undefined;
84
+ var minWidth = arguments.length > 5 ? arguments[5] : undefined;
83
85
  return {
84
86
  type: ACTION_ADD,
85
87
  flyoutId: flyoutId,
86
88
  title: title,
87
89
  level: level,
88
90
  size: size,
91
+ iconType: iconType,
89
92
  minWidth: minWidth
90
93
  };
91
94
  };
@@ -146,11 +149,12 @@ var goBack = exports.goBack = function goBack() {
146
149
  };
147
150
  };
148
151
 
149
- /** Navigate to a specific flyout (remove all sessions after it). */
150
- var goToFlyout = exports.goToFlyout = function goToFlyout(flyoutId) {
152
+ /** Navigate to a specific flyout (remove all sessions after it, or pop to child in history when level === 'child'). */
153
+ var goToFlyout = exports.goToFlyout = function goToFlyout(flyoutId, level) {
151
154
  return {
152
155
  type: ACTION_GO_TO_FLYOUT,
153
- flyoutId: flyoutId
156
+ flyoutId: flyoutId,
157
+ level: level
154
158
  };
155
159
  };
156
160
 
@@ -23,6 +23,7 @@ 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
29
  var _excluded = ["id", "onClose", "onActive", "level", "size", "minWidth", "css", "flyoutMenuProps"];
@@ -163,18 +164,23 @@ var EuiManagedFlyout = exports.EuiManagedFlyout = /*#__PURE__*/(0, _react.forwar
163
164
  // Register with flyout manager context when open, remove when closed
164
165
  // Using useLayoutEffect to run synchronously before DOM updates
165
166
  (0, _react.useLayoutEffect)(function () {
166
- addFlyout(flyoutId, title, level, size, typeof minWidth === 'number' ? minWidth : undefined);
167
+ addFlyout(flyoutId, title, level, size, _flyoutMenuProps === null || _flyoutMenuProps === void 0 ? void 0 : _flyoutMenuProps.iconType, typeof minWidth === 'number' ? minWidth : undefined);
167
168
  return function () {
168
- // Only call closeFlyout if it wasn't already called via onClose
169
- // This prevents duplicate removal when using Escape/X button
170
- if (flyoutExistsInManagerRef.current) {
169
+ var currentStoreState = (0, _store.getFlyoutManagerStore)().getState();
170
+ var stillInStore = currentStoreState.flyouts.some(function (f) {
171
+ return f.flyoutId === flyoutId;
172
+ });
173
+ if (stillInStore) {
174
+ // Normal cleanup (deps changed or explicit close via isOpen=false)
171
175
  level === _const.LEVEL_MAIN ? closeAllFlyouts() : closeFlyout(flyoutId);
176
+ } else if (wasRegisteredRef.current) {
177
+ var _onCloseCallbackRef$c;
178
+ // Cascade close: was registered but removed externally (e.g. main closed)
179
+ (_onCloseCallbackRef$c = onCloseCallbackRef.current) === null || _onCloseCallbackRef$c === void 0 || _onCloseCallbackRef$c.call(onCloseCallbackRef, new MouseEvent('navigation'));
172
180
  }
173
-
174
- // Reset navigation tracking when explicitly closed via isOpen=false
175
181
  wasRegisteredRef.current = false;
176
182
  };
177
- }, [flyoutId, title, level, size, minWidth, addFlyout, closeFlyout, closeAllFlyouts]);
183
+ }, [flyoutId, title, level, size, minWidth, _flyoutMenuProps === null || _flyoutMenuProps === void 0 ? void 0 : _flyoutMenuProps.iconType, addFlyout, closeFlyout, closeAllFlyouts]);
178
184
 
179
185
  // Detect when flyout has been removed from manager state (e.g., via Back button)
180
186
  // and trigger onClose callback to notify the parent component
@@ -186,8 +192,8 @@ var EuiManagedFlyout = exports.EuiManagedFlyout = /*#__PURE__*/(0, _react.forwar
186
192
  // If flyout was previously registered, is marked as open, but no longer exists in manager state,
187
193
  // it was removed via navigation (Back button) - trigger close callback
188
194
  if (wasRegisteredRef.current && !flyoutExistsInManager) {
189
- var _onCloseCallbackRef$c;
190
- (_onCloseCallbackRef$c = onCloseCallbackRef.current) === null || _onCloseCallbackRef$c === void 0 || _onCloseCallbackRef$c.call(onCloseCallbackRef, new MouseEvent('navigation'));
195
+ var _onCloseCallbackRef$c2;
196
+ (_onCloseCallbackRef$c2 = onCloseCallbackRef.current) === null || _onCloseCallbackRef$c2 === void 0 || _onCloseCallbackRef$c2.call(onCloseCallbackRef, new MouseEvent('navigation'));
191
197
  wasRegisteredRef.current = false; // Reset to avoid repeated calls
192
198
  }
193
199
  }, [flyoutExistsInManager, flyoutId]);
@@ -219,8 +225,7 @@ var EuiManagedFlyout = exports.EuiManagedFlyout = /*#__PURE__*/(0, _react.forwar
219
225
  (0, _reactDom.flushSync)(function () {
220
226
  level === _const.LEVEL_MAIN ? closeAllFlyouts() : closeFlyout(flyoutId);
221
227
  });
222
-
223
- // trigger parent callback, unmounts the component
228
+ wasRegisteredRef.current = false; // Prevent cleanup from double-firing onClose
224
229
  if (onCloseCallbackRef.current) {
225
230
  var event = e || new MouseEvent('click');
226
231
  onCloseCallbackRef.current(event);