@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
@@ -78,9 +78,9 @@ var EuiTableRowCell = exports.EuiTableRowCell = function EuiTableRowCell(_ref) {
78
78
  return defaultWidth;
79
79
  };
80
80
  var inlineWidthStyles = (0, _utils.resolveWidthPropsAsStyle)(_style, {
81
- width: getResponsiveWidth(width, mobileOptions === null || mobileOptions === void 0 ? void 0 : mobileOptions.minWidth),
81
+ width: getResponsiveWidth(width, mobileOptions === null || mobileOptions === void 0 ? void 0 : mobileOptions.width),
82
82
  minWidth: getResponsiveWidth(minWidth, mobileOptions === null || mobileOptions === void 0 ? void 0 : mobileOptions.minWidth),
83
- maxWidth: getResponsiveWidth(maxWidth, mobileOptions === null || mobileOptions === void 0 ? void 0 : mobileOptions.minWidth)
83
+ maxWidth: getResponsiveWidth(maxWidth, mobileOptions === null || mobileOptions === void 0 ? void 0 : mobileOptions.maxWidth)
84
84
  });
85
85
  var Element = setScopeRow ? 'th' : 'td';
86
86
  var sharedProps = _objectSpread({
@@ -59,6 +59,7 @@ export var CollapsedItemActions = function CollapsedItemActions(_ref) {
59
59
  var toolTipContent = callWithItemIfFunction(item)(action.description);
60
60
  var href = callWithItemIfFunction(item)(action.href);
61
61
  var dataTestSubj = callWithItemIfFunction(item)(action['data-test-subj']);
62
+ var color = action.color ? callWithItemIfFunction(item)(action.color) : undefined;
62
63
  var _onClick = action.onClick,
63
64
  target = action.target;
64
65
  controls.push(___EmotionJSX(EuiContextMenuItem, {
@@ -68,6 +69,7 @@ export var CollapsedItemActions = function CollapsedItemActions(_ref) {
68
69
  href: href,
69
70
  target: target,
70
71
  icon: icon,
72
+ color: color,
71
73
  "data-test-subj": dataTestSubj,
72
74
  onClick: function onClick(event) {
73
75
  event.persist();
@@ -1,6 +1,6 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
- var _excluded = ["children", "className", "hasPanel", "icon", "buttonRef", "disabled", "layoutAlign", "toolTipContent", "toolTipProps", "href", "target", "rel", "size"];
3
+ var _excluded = ["children", "className", "hasPanel", "icon", "buttonRef", "disabled", "layoutAlign", "toolTipContent", "toolTipProps", "href", "target", "rel", "size", "color"];
4
4
  /*
5
5
  * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
6
6
  * or more contributor license agreements. Licensed under the Elastic License
@@ -41,12 +41,13 @@ export var EuiContextMenuItem = function EuiContextMenuItem(_ref) {
41
41
  rel = _ref.rel,
42
42
  _ref$size = _ref.size,
43
43
  size = _ref$size === void 0 ? 'm' : _ref$size,
44
+ color = _ref.color,
44
45
  rest = _objectWithoutProperties(_ref, _excluded);
45
46
  var isHrefValid = !href || validateHref(href);
46
47
  var disabled = _disabled || !isHrefValid;
47
48
  var classes = classNames('euiContextMenuItem', className);
48
49
  var styles = useEuiMemoizedStyles(euiContextMenuItemStyles);
49
- var cssStyles = [styles.euiContextMenuItem, styles.sizes[size], styles.layoutAlign[layoutAlign], disabled && styles.disabled];
50
+ var cssStyles = [styles.euiContextMenuItem, styles.sizes[size], styles.layoutAlign[layoutAlign], disabled && styles.disabled, !disabled && color && styles.colors[color]];
50
51
  var iconInstance = icon && (typeof icon === 'string' ? ___EmotionJSX(EuiIcon, {
51
52
  type: icon,
52
53
  size: "m",
@@ -8,7 +8,7 @@ function _EMOTION_STRINGIFIED_CSS_ERROR__() { return "You have tried to stringif
8
8
  */
9
9
 
10
10
  import { css } from '@emotion/react';
11
- import { logicalCSS, logicalTextAlignCSS, euiFontSize } from '../../global_styling';
11
+ import { logicalCSS, logicalTextAlignCSS, euiFontSize, EXTENDED_BUTTON_COLORS, euiButtonEmptyColor } from '../../global_styling';
12
12
  var _ref = process.env.NODE_ENV === "production" ? {
13
13
  name: "4ak4s8-euiContextMenuItem__arrow",
14
14
  styles: "align-self:flex-end;label:euiContextMenuItem__arrow;"
@@ -77,6 +77,10 @@ export var euiContextMenuItemStyles = function euiContextMenuItemStyles(euiTheme
77
77
  euiContextMenuItem__text: _ref2,
78
78
  s: /*#__PURE__*/css(euiFontSize(euiThemeContext, 's'), ";;label:s;")
79
79
  },
80
- euiContextMenuItem__arrow: _ref
80
+ euiContextMenuItem__arrow: _ref,
81
+ // Colors - maps button color names to text color overrides
82
+ colors: Object.fromEntries(EXTENDED_BUTTON_COLORS.map(function (color) {
83
+ return [color, /*#__PURE__*/css("color:", euiButtonEmptyColor(euiThemeContext, color).color, ";;label:colors;")];
84
+ }))
81
85
  };
82
86
  };
@@ -152,11 +152,20 @@ export var EuiTimeWindowButtons = function EuiTimeWindowButtons(_ref) {
152
152
  export function useEuiTimeWindow(start, end, apply, options) {
153
153
  var _options$zoomFactor;
154
154
  var min = dateMath.parse(start);
155
+
156
+ /* `roundUp: true` will result in an "inclusive" time (e.g. 23:59:59.999 for 'now/d').
157
+ It only changes the value for relative expressions (e.g. 'now/d') but not absolute ISO strings. */
155
158
  var max = dateMath.parse(end, {
156
159
  roundUp: true
157
160
  });
158
161
  var isInvalid = !min || !min.isValid() || !max || !max.isValid();
159
- var windowDuration = isInvalid ? -1 : max.diff(min);
162
+ /* An end at .999ms is always considered an inclusive boundary (either as result of `roundUp: true`
163
+ or entered manually).
164
+ To avoid a 1ms drift on every time window or zoom step, windowDuration has to be increased by 1ms.
165
+ This ensures the window is always at a clean boundary (e.g. 00:00:00.000 - 23:59:59.999). */
166
+ var isInclusiveBoundary = !isInvalid && max.milliseconds() === 999;
167
+ var endBoundary = !isInvalid ? isInclusiveBoundary ? moment(max).add(1, 'ms') : moment(max) : null;
168
+ var windowDuration = isInvalid || !endBoundary ? -1 : endBoundary.diff(min);
160
169
  var isWindowDurationZero = windowDuration === 0;
161
170
  var zoomFactor = getPercentageMultiplier((_options$zoomFactor = options === null || options === void 0 ? void 0 : options.zoomFactor) !== null && _options$zoomFactor !== void 0 ? _options$zoomFactor : ZOOM_FACTOR_DEFAULT);
162
171
  var zoomDelta = windowDuration * (zoomFactor / 2); // Gets added to each end, that's why it's split in half
@@ -177,7 +186,10 @@ export function useEuiTimeWindow(start, end, apply, options) {
177
186
  function stepForward() {
178
187
  if (isInvalid || isWindowDurationZero) return;
179
188
  apply({
180
- start: moment(max).toISOString(),
189
+ /* Prevent 1ms drifts for inclusive boundaries by using the exclusive max (+ 1ms)
190
+ as the start of the next window (e.g. 00:00:00.000 instead of 23:59:59.999) */
191
+ start: (isInclusiveBoundary ? endBoundary // `!` is safe here because we early return on `isInvalid`
192
+ : moment(max)).toISOString(),
181
193
  end: moment(max).add(windowDuration, 'ms').toISOString()
182
194
  });
183
195
  }
@@ -185,7 +197,9 @@ export function useEuiTimeWindow(start, end, apply, options) {
185
197
  if (isInvalid || isWindowDurationZero) return;
186
198
  apply({
187
199
  start: moment(min).subtract(windowDuration, 'ms').toISOString(),
188
- end: moment(min).toISOString()
200
+ /* Prevent 1ms drifts for inclusive boundaries by using the exclusive min (- 1ms)
201
+ as the end of the previous window (e.g. 23:59:59.999 instead of 00:00:00.000) */
202
+ end: (isInclusiveBoundary ? moment(min).subtract(1, 'ms') : moment(min)).toISOString()
189
203
  });
190
204
  }
191
205
  function expandWindow() {
@@ -18,6 +18,14 @@ export var FLYOUT_SIDES = ['left', 'right'];
18
18
  export var FLYOUT_SIZES = ['s', 'm', 'l', 'fill'];
19
19
  /** Type representing a supported named flyout size. */
20
20
 
21
+ /** Menu display mode: always render menu when flyoutMenuProps is provided. */
22
+ export var MENU_DISPLAY_ALWAYS = 'always';
23
+ /** Menu display mode: only render menu when it has content (back button, history, title, or custom actions). */
24
+ export var MENU_DISPLAY_AUTO = 'auto';
25
+ /** Allowed flyout menu display modes. */
26
+ export var FLYOUT_MENU_DISPLAY_MODES = [MENU_DISPLAY_ALWAYS, MENU_DISPLAY_AUTO];
27
+ /** Type representing a supported flyout menu display mode. */
28
+
21
29
  /** Allowed padding sizes for flyout content. */
22
30
  export var FLYOUT_PADDING_SIZES = ['none', 's', 'm', 'l'];
23
31
  /** Type representing a supported flyout padding size. */
@@ -32,6 +40,8 @@ export var DEFAULT_SIDE = 'right';
32
40
  export var DEFAULT_SIZE = 'm';
33
41
  /** Default padding size inside flyouts. */
34
42
  export var DEFAULT_PADDING_SIZE = 'l';
43
+ /** Default flyout menu display mode. */
44
+ export var DEFAULT_MENU_DISPLAY_MODE = MENU_DISPLAY_AUTO;
35
45
 
36
46
  /**
37
47
  * Custom type checker for named flyout sizes since the prop
@@ -3,8 +3,7 @@ import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
3
3
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
4
4
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
5
5
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
6
- 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"],
7
- _excluded2 = ["titleId"];
6
+ 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"];
8
7
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
9
8
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
10
9
  /*
@@ -29,7 +28,7 @@ import { EuiScreenReaderOnly } from '../accessibility';
29
28
  import { EuiFlyoutCloseButton } from './_flyout_close_button';
30
29
  import { euiFlyoutStyles, composeFlyoutInlineStyles } from './flyout.styles';
31
30
  import { usePropsWithComponentDefaults } from '../provider/component_defaults';
32
- import { DEFAULT_PADDING_SIZE, DEFAULT_PUSH_MIN_BREAKPOINT, DEFAULT_SIDE, DEFAULT_SIZE, DEFAULT_TYPE, isEuiFlyoutSizeNamed } from './const';
31
+ import { DEFAULT_MENU_DISPLAY_MODE, DEFAULT_PADDING_SIZE, DEFAULT_PUSH_MIN_BREAKPOINT, DEFAULT_SIDE, DEFAULT_SIZE, DEFAULT_TYPE, isEuiFlyoutSizeNamed } from './const';
33
32
  import { useIsPushed } from './hooks';
34
33
  import { EuiFlyoutMenu } from './flyout_menu';
35
34
  import { EuiFlyoutOverlay } from './_flyout_overlay';
@@ -37,6 +36,7 @@ import { EuiFlyoutResizeButton } from './_flyout_resize_button';
37
36
  import { useEuiFlyoutResizable } from './use_flyout_resizable';
38
37
  import { useEuiFlyoutZIndex } from './use_flyout_z_index';
39
38
  import { EuiFlyoutParentProvider } from './flyout_parent_context';
39
+ import { useEuiFlyoutMenu } from './use_flyout_menu';
40
40
  import { jsx as ___EmotionJSX } from "@emotion/react";
41
41
  /**
42
42
  * Resolves the container prop (element, getter, or selector string) to an
@@ -63,40 +63,42 @@ export var EuiFlyoutComponent = /*#__PURE__*/forwardRef(function (props, ref) {
63
63
  _usePropsWithComponen2 = _usePropsWithComponen.hideCloseButton,
64
64
  hideCloseButton = _usePropsWithComponen2 === void 0 ? false : _usePropsWithComponen2,
65
65
  _flyoutMenuProps = _usePropsWithComponen.flyoutMenuProps,
66
+ _usePropsWithComponen3 = _usePropsWithComponen.flyoutMenuDisplayMode,
67
+ flyoutMenuDisplayMode = _usePropsWithComponen3 === void 0 ? DEFAULT_MENU_DISPLAY_MODE : _usePropsWithComponen3,
66
68
  closeButtonProps = _usePropsWithComponen.closeButtonProps,
67
- _usePropsWithComponen3 = _usePropsWithComponen.closeButtonPosition,
68
- closeButtonPosition = _usePropsWithComponen3 === void 0 ? 'inside' : _usePropsWithComponen3,
69
+ _usePropsWithComponen4 = _usePropsWithComponen.closeButtonPosition,
70
+ closeButtonPosition = _usePropsWithComponen4 === void 0 ? 'inside' : _usePropsWithComponen4,
69
71
  onClose = _usePropsWithComponen.onClose,
70
- _usePropsWithComponen4 = _usePropsWithComponen.ownFocus,
71
- ownFocus = _usePropsWithComponen4 === void 0 ? true : _usePropsWithComponen4,
72
- _usePropsWithComponen5 = _usePropsWithComponen.side,
73
- side = _usePropsWithComponen5 === void 0 ? DEFAULT_SIDE : _usePropsWithComponen5,
74
- _usePropsWithComponen6 = _usePropsWithComponen.size,
75
- _size = _usePropsWithComponen6 === void 0 ? DEFAULT_SIZE : _usePropsWithComponen6,
76
- _usePropsWithComponen7 = _usePropsWithComponen.paddingSize,
77
- paddingSize = _usePropsWithComponen7 === void 0 ? DEFAULT_PADDING_SIZE : _usePropsWithComponen7,
78
- _usePropsWithComponen8 = _usePropsWithComponen.maxWidth,
79
- maxWidth = _usePropsWithComponen8 === void 0 ? false : _usePropsWithComponen8,
72
+ _usePropsWithComponen5 = _usePropsWithComponen.ownFocus,
73
+ ownFocus = _usePropsWithComponen5 === void 0 ? true : _usePropsWithComponen5,
74
+ _usePropsWithComponen6 = _usePropsWithComponen.side,
75
+ side = _usePropsWithComponen6 === void 0 ? DEFAULT_SIDE : _usePropsWithComponen6,
76
+ _usePropsWithComponen7 = _usePropsWithComponen.size,
77
+ _size = _usePropsWithComponen7 === void 0 ? DEFAULT_SIZE : _usePropsWithComponen7,
78
+ _usePropsWithComponen8 = _usePropsWithComponen.paddingSize,
79
+ paddingSize = _usePropsWithComponen8 === void 0 ? DEFAULT_PADDING_SIZE : _usePropsWithComponen8,
80
+ _usePropsWithComponen9 = _usePropsWithComponen.maxWidth,
81
+ maxWidth = _usePropsWithComponen9 === void 0 ? false : _usePropsWithComponen9,
80
82
  style = _usePropsWithComponen.style,
81
- _usePropsWithComponen9 = _usePropsWithComponen.hasChildBackground,
82
- hasChildBackground = _usePropsWithComponen9 === void 0 ? false : _usePropsWithComponen9,
83
+ _usePropsWithComponen10 = _usePropsWithComponen.hasChildBackground,
84
+ hasChildBackground = _usePropsWithComponen10 === void 0 ? false : _usePropsWithComponen10,
83
85
  maskProps = _usePropsWithComponen.maskProps,
84
- _usePropsWithComponen10 = _usePropsWithComponen.type,
85
- type = _usePropsWithComponen10 === void 0 ? DEFAULT_TYPE : _usePropsWithComponen10,
86
+ _usePropsWithComponen11 = _usePropsWithComponen.type,
87
+ type = _usePropsWithComponen11 === void 0 ? DEFAULT_TYPE : _usePropsWithComponen11,
86
88
  outsideClickCloses = _usePropsWithComponen.outsideClickCloses,
87
- _usePropsWithComponen11 = _usePropsWithComponen.pushMinBreakpoint,
88
- pushMinBreakpoint = _usePropsWithComponen11 === void 0 ? DEFAULT_PUSH_MIN_BREAKPOINT : _usePropsWithComponen11,
89
- _usePropsWithComponen12 = _usePropsWithComponen.pushAnimation,
90
- pushAnimation = _usePropsWithComponen12 === void 0 ? false : _usePropsWithComponen12,
89
+ _usePropsWithComponen12 = _usePropsWithComponen.pushMinBreakpoint,
90
+ pushMinBreakpoint = _usePropsWithComponen12 === void 0 ? DEFAULT_PUSH_MIN_BREAKPOINT : _usePropsWithComponen12,
91
+ _usePropsWithComponen13 = _usePropsWithComponen.pushAnimation,
92
+ pushAnimation = _usePropsWithComponen13 === void 0 ? false : _usePropsWithComponen13,
91
93
  _focusTrapProps = _usePropsWithComponen.focusTrapProps,
92
- _usePropsWithComponen13 = _usePropsWithComponen.includeFixedHeadersInFocusTrap,
93
- includeFixedHeadersInFocusTrap = _usePropsWithComponen13 === void 0 ? true : _usePropsWithComponen13,
94
+ _usePropsWithComponen14 = _usePropsWithComponen.includeFixedHeadersInFocusTrap,
95
+ includeFixedHeadersInFocusTrap = _usePropsWithComponen14 === void 0 ? true : _usePropsWithComponen14,
94
96
  includeSelectorInFocusTrap = _usePropsWithComponen.includeSelectorInFocusTrap,
95
97
  _ariaDescribedBy = _usePropsWithComponen['aria-describedby'],
96
98
  _ariaLabelledBy = _usePropsWithComponen['aria-labelledby'],
97
99
  id = _usePropsWithComponen.id,
98
- _usePropsWithComponen14 = _usePropsWithComponen.resizable,
99
- resizable = _usePropsWithComponen14 === void 0 ? false : _usePropsWithComponen14,
100
+ _usePropsWithComponen15 = _usePropsWithComponen.resizable,
101
+ resizable = _usePropsWithComponen15 === void 0 ? false : _usePropsWithComponen15,
100
102
  minWidth = _usePropsWithComponen.minWidth,
101
103
  onResize = _usePropsWithComponen.onResize,
102
104
  onAnimationEnd = _usePropsWithComponen.onAnimationEnd,
@@ -154,6 +156,21 @@ export var EuiFlyoutComponent = /*#__PURE__*/forwardRef(function (props, ref) {
154
156
  var layoutMode = (_managerState$layoutM = managerState === null || managerState === void 0 ? void 0 : managerState.layoutMode) !== null && _managerState$layoutM !== void 0 ? _managerState$layoutM : LAYOUT_MODE_SIDE_BY_SIDE;
155
157
  var isActiveManagedFlyout = (currentSession === null || currentSession === void 0 ? void 0 : currentSession.mainFlyoutId) === flyoutId || (currentSession === null || currentSession === void 0 ? void 0 : currentSession.childFlyoutId) === flyoutId;
156
158
  var currentZIndexRef = useRef((_managerState$current = managerState === null || managerState === void 0 ? void 0 : managerState.currentZIndex) !== null && _managerState$current !== void 0 ? _managerState$current : 0);
159
+ var _useEuiFlyoutMenu = useEuiFlyoutMenu({
160
+ flyoutMenuProps: _flyoutMenuProps,
161
+ flyoutMenuDisplayMode: flyoutMenuDisplayMode,
162
+ ariaLabelledBy: _ariaLabelledBy
163
+ }),
164
+ flyoutMenuId = _useEuiFlyoutMenu.flyoutMenuId,
165
+ flyoutMenuProps = _useEuiFlyoutMenu.flyoutMenuProps,
166
+ shouldRenderMenu = _useEuiFlyoutMenu.shouldRenderMenu,
167
+ ariaLabelledBy = _useEuiFlyoutMenu.ariaLabelledBy;
168
+ useEffect(function () {
169
+ if (process.env.NODE_ENV === 'development' && _flyoutMenuProps && 'hideTitle' in _flyoutMenuProps) {
170
+ console.warn('EuiFlyout: `flyoutMenuProps.hideTitle` is deprecated. Use `EuiFlyoutHeader` for visible titles instead.');
171
+ }
172
+ // eslint-disable-next-line react-hooks/exhaustive-deps
173
+ }, []);
157
174
 
158
175
  // Use a ref to access the latest flyoutManager without triggering effect re-runs
159
176
  var flyoutManagerRef = useRef(flyoutManager);
@@ -602,34 +619,6 @@ export var EuiFlyoutComponent = /*#__PURE__*/forwardRef(function (props, ref) {
602
619
  })));
603
620
  }, [hasOverlayMask, descriptionId, focusTrapShards.length]);
604
621
 
605
- /*
606
- * If the flyout menu is to be rendered, ensure the flyout has aria-labelledby referencing the menu's titleId
607
- */
608
- var generatedMenuId = useGeneratedHtmlId();
609
- var _ref = _flyoutMenuProps || {},
610
- _titleId = _ref.titleId,
611
- flyoutMenuProps = _objectWithoutProperties(_ref, _excluded2);
612
- var hasMenu = !!_flyoutMenuProps;
613
- var flyoutMenuId = useMemo(function () {
614
- if (!hasMenu) return undefined;
615
- return _titleId || generatedMenuId;
616
- }, [hasMenu, _titleId, generatedMenuId]);
617
-
618
- // If the flyout level is LEVEL_MAIN, the title should be hidden by default
619
- var flyoutMenuHideTitle = useMemo(function () {
620
- if (!hasMenu) return undefined;
621
- if ((_flyoutMenuProps === null || _flyoutMenuProps === void 0 ? void 0 : _flyoutMenuProps.hideTitle) !== undefined) {
622
- return _flyoutMenuProps.hideTitle;
623
- }
624
- return (currentSession === null || currentSession === void 0 ? void 0 : currentSession.mainFlyoutId) === flyoutId;
625
- }, [hasMenu, _flyoutMenuProps, currentSession, flyoutId]);
626
- var ariaLabelledBy = useMemo(function () {
627
- if (flyoutMenuId) {
628
- return classnames(flyoutMenuId, _ariaLabelledBy);
629
- }
630
- return _ariaLabelledBy;
631
- }, [flyoutMenuId, _ariaLabelledBy]);
632
-
633
622
  /*
634
623
  * Trap focus even when `ownFocus={false}`, otherwise closing
635
624
  * the flyout won't return focus to the originating button.
@@ -697,13 +686,12 @@ export var EuiFlyoutComponent = /*#__PURE__*/forwardRef(function (props, ref) {
697
686
  "aria-labelledby": ariaLabelledBy,
698
687
  "data-autofocus": !isPushed || undefined,
699
688
  onAnimationEnd: onAnimationEnd
700
- }), !isPushed && screenReaderDescription, !_flyoutMenuProps && !hideCloseButton && ___EmotionJSX(EuiFlyoutCloseButton, _extends({}, closeButtonProps, {
689
+ }), !isPushed && screenReaderDescription, shouldRenderMenu ? ___EmotionJSX(EuiFlyoutMenu, _extends({}, flyoutMenuProps, {
690
+ titleId: flyoutMenuId
691
+ })) : !hideCloseButton && ___EmotionJSX(EuiFlyoutCloseButton, _extends({}, closeButtonProps, {
701
692
  onClose: handleClose,
702
693
  closeButtonPosition: closeButtonPosition,
703
694
  side: side
704
- })), _flyoutMenuProps && ___EmotionJSX(EuiFlyoutMenu, _extends({}, flyoutMenuProps, {
705
- hideTitle: flyoutMenuHideTitle,
706
- titleId: flyoutMenuId
707
695
  })), resizable && ___EmotionJSX(EuiFlyoutResizeButton, {
708
696
  type: type,
709
697
  side: side,
@@ -17,7 +17,7 @@ import { EuiFlyoutMenuContext } from './flyout_menu_context';
17
17
  import { useIsInsideParentFlyout } from './flyout_parent_context';
18
18
  import { SESSION_INHERIT, SESSION_NEVER, SESSION_START } from './manager/const';
19
19
  import { jsx as ___EmotionJSX } from "@emotion/react";
20
- export { FLYOUT_SIDES, FLYOUT_PADDING_SIZES, FLYOUT_SIZES, FLYOUT_TYPES } from './const';
20
+ export { FLYOUT_SIDES, FLYOUT_PADDING_SIZES, FLYOUT_SIZES, FLYOUT_TYPES, FLYOUT_MENU_DISPLAY_MODES } from './const';
21
21
  export var EuiFlyout = /*#__PURE__*/forwardRef(function (props, ref) {
22
22
  var _usePropsWithComponen = usePropsWithComponentDefaults('EuiFlyout', props),
23
23
  as = _usePropsWithComponen.as,
@@ -75,6 +75,7 @@ var HistoryPopover = function HistoryPopover(_ref) {
75
75
  return ___EmotionJSX(EuiListGroupItem, {
76
76
  key: "history-item-".concat(index),
77
77
  label: item.title,
78
+ iconType: item.iconType,
78
79
  size: "s",
79
80
  onClick: function onClick() {
80
81
  item.onClick();
@@ -98,7 +99,8 @@ export var EuiFlyoutMenu = function EuiFlyoutMenu(_ref2) {
98
99
  var className = _ref2.className,
99
100
  title = _ref2.title,
100
101
  titleId = _ref2.titleId,
101
- hideTitle = _ref2.hideTitle,
102
+ _ref2$hideTitle = _ref2.hideTitle,
103
+ hideTitle = _ref2$hideTitle === void 0 ? true : _ref2$hideTitle,
102
104
  hideCloseButton = _ref2.hideCloseButton,
103
105
  _ref2$historyItems = _ref2.historyItems,
104
106
  historyItems = _ref2$historyItems === void 0 ? [] : _ref2$historyItems,
@@ -129,7 +131,8 @@ export var EuiFlyoutMenu = function EuiFlyoutMenu(_ref2) {
129
131
  });
130
132
  return ___EmotionJSX("div", _extends({
131
133
  className: classes,
132
- css: styles.euiFlyoutMenu__container
134
+ css: styles.euiFlyoutMenu__container,
135
+ "data-test-subj": "euiFlyoutMenu"
133
136
  }, rest), ___EmotionJSX(EuiFlexGroup, {
134
137
  alignItems: "center",
135
138
  justifyContent: "spaceBetween",
@@ -54,7 +54,7 @@ export var ACTION_CLOSE_UNMANAGED_FLYOUT = "".concat(PREFIX, "/closeUnmanagedFly
54
54
 
55
55
  /** Go back one session (remove current session from stack). */
56
56
 
57
- /** Navigate to a specific flyout (remove all sessions after it). */
57
+ /** Navigate to a specific flyout (remove all sessions after it, or pop to child in history). */
58
58
 
59
59
  /** Set push padding offset for a specific side. */
60
60
 
@@ -69,17 +69,20 @@ export var ACTION_CLOSE_UNMANAGED_FLYOUT = "".concat(PREFIX, "/closeUnmanagedFly
69
69
  * - `title` is used for the flyout menu.
70
70
  * - `level` determines whether the flyout is `main` or `child`.
71
71
  * - Optional `size` is the named EUI size (e.g. `s`, `m`, `l`).
72
+ * - Optional `iconType` is shown next to the session title in the history menu.
72
73
  */
73
74
  export var addFlyout = function addFlyout(flyoutId, title) {
74
75
  var level = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : LEVEL_MAIN;
75
76
  var size = arguments.length > 3 ? arguments[3] : undefined;
76
- var minWidth = arguments.length > 4 ? arguments[4] : undefined;
77
+ var iconType = arguments.length > 4 ? arguments[4] : undefined;
78
+ var minWidth = arguments.length > 5 ? arguments[5] : undefined;
77
79
  return {
78
80
  type: ACTION_ADD,
79
81
  flyoutId: flyoutId,
80
82
  title: title,
81
83
  level: level,
82
84
  size: size,
85
+ iconType: iconType,
83
86
  minWidth: minWidth
84
87
  };
85
88
  };
@@ -140,11 +143,12 @@ export var goBack = function goBack() {
140
143
  };
141
144
  };
142
145
 
143
- /** Navigate to a specific flyout (remove all sessions after it). */
144
- export var goToFlyout = function goToFlyout(flyoutId) {
146
+ /** Navigate to a specific flyout (remove all sessions after it, or pop to child in history when level === 'child'). */
147
+ export var goToFlyout = function goToFlyout(flyoutId, level) {
145
148
  return {
146
149
  type: ACTION_GO_TO_FLYOUT,
147
- flyoutId: flyoutId
150
+ flyoutId: flyoutId,
151
+ level: level
148
152
  };
149
153
  };
150
154
 
@@ -26,6 +26,7 @@ import { EuiFlyoutIsManagedProvider } from './context';
26
26
  import { euiManagedFlyoutStyles } from './flyout_managed.styles';
27
27
  import { useFlyoutManager as _useFlyoutManager, useFlyoutId } from './hooks';
28
28
  import { useIsFlyoutRegistered } from './selectors';
29
+ import { getFlyoutManagerStore } from './store';
29
30
  import { createValidationErrorMessage, isNamedSize, validateManagedFlyoutSize, validateSizeCombination } from './validation';
30
31
 
31
32
  /**
@@ -155,18 +156,23 @@ export var EuiManagedFlyout = /*#__PURE__*/forwardRef(function (_ref, ref) {
155
156
  // Register with flyout manager context when open, remove when closed
156
157
  // Using useLayoutEffect to run synchronously before DOM updates
157
158
  useLayoutEffect(function () {
158
- addFlyout(flyoutId, title, level, size, typeof minWidth === 'number' ? minWidth : undefined);
159
+ addFlyout(flyoutId, title, level, size, _flyoutMenuProps === null || _flyoutMenuProps === void 0 ? void 0 : _flyoutMenuProps.iconType, typeof minWidth === 'number' ? minWidth : undefined);
159
160
  return function () {
160
- // Only call closeFlyout if it wasn't already called via onClose
161
- // This prevents duplicate removal when using Escape/X button
162
- if (flyoutExistsInManagerRef.current) {
161
+ var currentStoreState = getFlyoutManagerStore().getState();
162
+ var stillInStore = currentStoreState.flyouts.some(function (f) {
163
+ return f.flyoutId === flyoutId;
164
+ });
165
+ if (stillInStore) {
166
+ // Normal cleanup (deps changed or explicit close via isOpen=false)
163
167
  level === LEVEL_MAIN ? closeAllFlyouts() : closeFlyout(flyoutId);
168
+ } else if (wasRegisteredRef.current) {
169
+ var _onCloseCallbackRef$c;
170
+ // Cascade close: was registered but removed externally (e.g. main closed)
171
+ (_onCloseCallbackRef$c = onCloseCallbackRef.current) === null || _onCloseCallbackRef$c === void 0 || _onCloseCallbackRef$c.call(onCloseCallbackRef, new MouseEvent('navigation'));
164
172
  }
165
-
166
- // Reset navigation tracking when explicitly closed via isOpen=false
167
173
  wasRegisteredRef.current = false;
168
174
  };
169
- }, [flyoutId, title, level, size, minWidth, addFlyout, closeFlyout, closeAllFlyouts]);
175
+ }, [flyoutId, title, level, size, minWidth, _flyoutMenuProps === null || _flyoutMenuProps === void 0 ? void 0 : _flyoutMenuProps.iconType, addFlyout, closeFlyout, closeAllFlyouts]);
170
176
 
171
177
  // Detect when flyout has been removed from manager state (e.g., via Back button)
172
178
  // and trigger onClose callback to notify the parent component
@@ -178,8 +184,8 @@ export var EuiManagedFlyout = /*#__PURE__*/forwardRef(function (_ref, ref) {
178
184
  // If flyout was previously registered, is marked as open, but no longer exists in manager state,
179
185
  // it was removed via navigation (Back button) - trigger close callback
180
186
  if (wasRegisteredRef.current && !flyoutExistsInManager) {
181
- var _onCloseCallbackRef$c;
182
- (_onCloseCallbackRef$c = onCloseCallbackRef.current) === null || _onCloseCallbackRef$c === void 0 || _onCloseCallbackRef$c.call(onCloseCallbackRef, new MouseEvent('navigation'));
187
+ var _onCloseCallbackRef$c2;
188
+ (_onCloseCallbackRef$c2 = onCloseCallbackRef.current) === null || _onCloseCallbackRef$c2 === void 0 || _onCloseCallbackRef$c2.call(onCloseCallbackRef, new MouseEvent('navigation'));
183
189
  wasRegisteredRef.current = false; // Reset to avoid repeated calls
184
190
  }
185
191
  }, [flyoutExistsInManager, flyoutId]);
@@ -211,8 +217,7 @@ export var EuiManagedFlyout = /*#__PURE__*/forwardRef(function (_ref, ref) {
211
217
  flushSync(function () {
212
218
  level === LEVEL_MAIN ? closeAllFlyouts() : closeFlyout(flyoutId);
213
219
  });
214
-
215
- // trigger parent callback, unmounts the component
220
+ wasRegisteredRef.current = false; // Prevent cleanup from double-firing onClose
216
221
  if (onCloseCallbackRef.current) {
217
222
  var event = e || new MouseEvent('click');
218
223
  onCloseCallbackRef.current(event);