@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.
Files changed (142) hide show
  1. package/es/components/basic_table/collapsed_item_actions.js +2 -0
  2. package/es/components/button/split_button/split_button.js +13 -0
  3. package/es/components/button/split_button/split_button_actions.js +15 -0
  4. package/es/components/collapsible_nav/collapsible_nav.js +5 -0
  5. package/es/components/color_picker/color_picker.js +31 -8
  6. package/es/components/context_menu/context_menu_item.js +9 -3
  7. package/es/components/context_menu/context_menu_item.styles.js +6 -2
  8. package/es/components/datagrid/utils/scrolling.js +39 -10
  9. package/es/components/date_picker/super_date_picker/time_window_buttons.js +17 -3
  10. package/es/components/flyout/_flyout_overlay.js +34 -4
  11. package/es/components/flyout/const.js +10 -0
  12. package/es/components/flyout/flyout.component.js +49 -57
  13. package/es/components/flyout/flyout.js +10 -2
  14. package/es/components/flyout/flyout.styles.js +2 -2
  15. package/es/components/flyout/flyout_menu.js +19 -5
  16. package/es/components/flyout/flyout_resizable.js +5 -0
  17. package/es/components/flyout/manager/actions.js +12 -5
  18. package/es/components/flyout/manager/flyout_child.js +9 -2
  19. package/es/components/flyout/manager/flyout_managed.js +27 -14
  20. package/es/components/flyout/manager/reducer.js +251 -54
  21. package/es/components/flyout/manager/store.js +74 -12
  22. package/es/components/flyout/use_flyout_menu.js +70 -0
  23. package/es/components/form/file_picker/file_picker.js +46 -18
  24. package/es/components/markdown_editor/plugins/markdown_default_plugins/parsing_plugins.js +2 -1
  25. package/es/components/markdown_editor/plugins/remark/remark_intraword_underscore.js +172 -0
  26. package/es/components/overlay_mask/overlay_mask.js +10 -3
  27. package/es/components/tree_view/tree_view_item.styles.js +1 -1
  28. package/es/services/hooks/index.js +8 -8
  29. package/es/services/hooks/useIsPointerDown.js +6 -15
  30. package/es/services/index.js +1 -1
  31. package/eui.d.ts +477 -63
  32. package/i18ntokens.json +661 -643
  33. package/lib/components/basic_table/collapsed_item_actions.js +2 -0
  34. package/lib/components/button/split_button/split_button.js +13 -0
  35. package/lib/components/button/split_button/split_button_actions.js +15 -0
  36. package/lib/components/collapsible_nav/collapsible_nav.js +5 -0
  37. package/lib/components/color_picker/color_picker.js +30 -7
  38. package/lib/components/context_menu/context_menu_item.js +9 -3
  39. package/lib/components/context_menu/context_menu_item.styles.js +5 -1
  40. package/lib/components/datagrid/utils/scrolling.js +37 -8
  41. package/lib/components/date_picker/super_date_picker/time_window_buttons.js +17 -3
  42. package/lib/components/flyout/_flyout_overlay.js +33 -3
  43. package/lib/components/flyout/const.js +11 -1
  44. package/lib/components/flyout/flyout.component.js +48 -56
  45. package/lib/components/flyout/flyout.js +15 -1
  46. package/lib/components/flyout/flyout.styles.js +2 -2
  47. package/lib/components/flyout/flyout_menu.js +19 -5
  48. package/lib/components/flyout/flyout_resizable.js +5 -0
  49. package/lib/components/flyout/manager/actions.js +12 -5
  50. package/lib/components/flyout/manager/flyout_child.js +9 -2
  51. package/lib/components/flyout/manager/flyout_managed.js +19 -12
  52. package/lib/components/flyout/manager/reducer.js +250 -53
  53. package/lib/components/flyout/manager/store.js +74 -14
  54. package/lib/components/flyout/use_flyout_menu.js +75 -0
  55. package/lib/components/form/file_picker/file_picker.js +46 -18
  56. package/lib/components/markdown_editor/plugins/markdown_default_plugins/parsing_plugins.js +2 -1
  57. package/lib/components/markdown_editor/plugins/remark/remark_intraword_underscore.js +179 -0
  58. package/lib/components/overlay_mask/overlay_mask.js +10 -3
  59. package/lib/components/tree_view/tree_view_item.styles.js +1 -1
  60. package/lib/services/hooks/index.js +60 -91
  61. package/lib/services/hooks/useIsPointerDown.js +7 -14
  62. package/lib/services/index.js +70 -11
  63. package/optimize/es/components/basic_table/collapsed_item_actions.js +2 -0
  64. package/optimize/es/components/color_picker/color_picker.js +31 -8
  65. package/optimize/es/components/context_menu/context_menu_item.js +3 -2
  66. package/optimize/es/components/context_menu/context_menu_item.styles.js +6 -2
  67. package/optimize/es/components/datagrid/utils/scrolling.js +39 -10
  68. package/optimize/es/components/date_picker/super_date_picker/time_window_buttons.js +17 -3
  69. package/optimize/es/components/flyout/_flyout_overlay.js +34 -4
  70. package/optimize/es/components/flyout/const.js +10 -0
  71. package/optimize/es/components/flyout/flyout.component.js +49 -57
  72. package/optimize/es/components/flyout/flyout.js +5 -2
  73. package/optimize/es/components/flyout/flyout.styles.js +2 -2
  74. package/optimize/es/components/flyout/flyout_menu.js +7 -3
  75. package/optimize/es/components/flyout/manager/actions.js +12 -5
  76. package/optimize/es/components/flyout/manager/flyout_managed.js +18 -12
  77. package/optimize/es/components/flyout/manager/reducer.js +251 -54
  78. package/optimize/es/components/flyout/manager/store.js +69 -12
  79. package/optimize/es/components/flyout/use_flyout_menu.js +69 -0
  80. package/optimize/es/components/form/file_picker/file_picker.js +35 -18
  81. package/optimize/es/components/markdown_editor/plugins/markdown_default_plugins/parsing_plugins.js +2 -1
  82. package/optimize/es/components/markdown_editor/plugins/remark/remark_intraword_underscore.js +172 -0
  83. package/optimize/es/components/overlay_mask/overlay_mask.js +4 -2
  84. package/optimize/es/components/tree_view/tree_view_item.styles.js +1 -1
  85. package/optimize/es/services/hooks/index.js +8 -8
  86. package/optimize/es/services/hooks/useIsPointerDown.js +6 -10
  87. package/optimize/es/services/index.js +1 -1
  88. package/optimize/lib/components/basic_table/collapsed_item_actions.js +2 -0
  89. package/optimize/lib/components/color_picker/color_picker.js +30 -7
  90. package/optimize/lib/components/context_menu/context_menu_item.js +3 -2
  91. package/optimize/lib/components/context_menu/context_menu_item.styles.js +5 -1
  92. package/optimize/lib/components/datagrid/utils/scrolling.js +37 -8
  93. package/optimize/lib/components/date_picker/super_date_picker/time_window_buttons.js +17 -3
  94. package/optimize/lib/components/flyout/_flyout_overlay.js +33 -3
  95. package/optimize/lib/components/flyout/const.js +11 -1
  96. package/optimize/lib/components/flyout/flyout.component.js +48 -56
  97. package/optimize/lib/components/flyout/flyout.js +10 -1
  98. package/optimize/lib/components/flyout/flyout.styles.js +2 -2
  99. package/optimize/lib/components/flyout/flyout_menu.js +7 -3
  100. package/optimize/lib/components/flyout/manager/actions.js +12 -5
  101. package/optimize/lib/components/flyout/manager/flyout_managed.js +18 -12
  102. package/optimize/lib/components/flyout/manager/reducer.js +250 -53
  103. package/optimize/lib/components/flyout/manager/store.js +70 -12
  104. package/optimize/lib/components/flyout/use_flyout_menu.js +74 -0
  105. package/optimize/lib/components/form/file_picker/file_picker.js +35 -18
  106. package/optimize/lib/components/markdown_editor/plugins/markdown_default_plugins/parsing_plugins.js +2 -1
  107. package/optimize/lib/components/markdown_editor/plugins/remark/remark_intraword_underscore.js +179 -0
  108. package/optimize/lib/components/overlay_mask/overlay_mask.js +4 -2
  109. package/optimize/lib/components/tree_view/tree_view_item.styles.js +1 -1
  110. package/optimize/lib/services/hooks/index.js +60 -91
  111. package/optimize/lib/services/hooks/useIsPointerDown.js +5 -10
  112. package/optimize/lib/services/index.js +70 -11
  113. package/package.json +4 -4
  114. package/test-env/components/basic_table/collapsed_item_actions.js +2 -0
  115. package/test-env/components/button/split_button/split_button.js +13 -0
  116. package/test-env/components/button/split_button/split_button_actions.js +15 -0
  117. package/test-env/components/collapsible_nav/collapsible_nav.js +5 -0
  118. package/test-env/components/color_picker/color_picker.js +30 -7
  119. package/test-env/components/context_menu/context_menu_item.js +9 -3
  120. package/test-env/components/context_menu/context_menu_item.styles.js +5 -1
  121. package/test-env/components/datagrid/utils/scrolling.js +37 -8
  122. package/test-env/components/date_picker/super_date_picker/time_window_buttons.js +17 -3
  123. package/test-env/components/flyout/_flyout_overlay.js +33 -3
  124. package/test-env/components/flyout/const.js +11 -1
  125. package/test-env/components/flyout/flyout.component.js +48 -56
  126. package/test-env/components/flyout/flyout.styles.js +2 -2
  127. package/test-env/components/flyout/flyout_menu.js +19 -5
  128. package/test-env/components/flyout/flyout_resizable.js +5 -0
  129. package/test-env/components/flyout/manager/actions.js +12 -5
  130. package/test-env/components/flyout/manager/flyout_child.js +9 -2
  131. package/test-env/components/flyout/manager/flyout_managed.js +19 -12
  132. package/test-env/components/flyout/manager/reducer.js +250 -53
  133. package/test-env/components/flyout/manager/store.js +70 -12
  134. package/test-env/components/flyout/use_flyout_menu.js +74 -0
  135. package/test-env/components/form/file_picker/file_picker.js +46 -18
  136. package/test-env/components/markdown_editor/plugins/markdown_default_plugins/parsing_plugins.js +2 -1
  137. package/test-env/components/markdown_editor/plugins/remark/remark_intraword_underscore.js +179 -0
  138. package/test-env/components/overlay_mask/overlay_mask.js +10 -3
  139. package/test-env/components/tree_view/tree_view_item.styles.js +1 -1
  140. package/test-env/services/hooks/index.js +60 -91
  141. package/test-env/services/hooks/useIsPointerDown.js +5 -10
  142. package/test-env/services/index.js +70 -11
@@ -71,6 +71,7 @@ var CollapsedItemActions = exports.CollapsedItemActions = function CollapsedItem
71
71
  var toolTipContent = (0, _action_types.callWithItemIfFunction)(item)(action.description);
72
72
  var href = (0, _action_types.callWithItemIfFunction)(item)(action.href);
73
73
  var dataTestSubj = (0, _action_types.callWithItemIfFunction)(item)(action['data-test-subj']);
74
+ var color = action.color ? (0, _action_types.callWithItemIfFunction)(item)(action.color) : undefined;
74
75
  var _onClick = action.onClick,
75
76
  target = action.target;
76
77
  controls.push((0, _react2.jsx)(_context_menu.EuiContextMenuItem, {
@@ -80,6 +81,7 @@ var CollapsedItemActions = exports.CollapsedItemActions = function CollapsedItem
80
81
  href: href,
81
82
  target: target,
82
83
  icon: icon,
84
+ color: color,
83
85
  "data-test-subj": dataTestSubj,
84
86
  onClick: function onClick(event) {
85
87
  event.persist();
@@ -106,6 +106,19 @@ _EuiSplitButton.propTypes = {
106
106
  "aria-label": _propTypes.default.string,
107
107
  "data-test-subj": _propTypes.default.string,
108
108
  css: _propTypes.default.any,
109
+ /**
110
+ * Controls the disabled behavior via the native `disabled` attribute.
111
+ */
112
+ isDisabled: _propTypes.default.bool,
113
+ /**
114
+ * NOTE: Beta feature, may be changed or removed in the future
115
+ *
116
+ * Changes the native `disabled` attribute to `aria-disabled` to preserve focusability.
117
+ * This results in a semantically disabled button without the default browser handling of the disabled state.
118
+ *
119
+ * Use e.g. when a disabled button should have a tooltip.
120
+ */
121
+ hasAriaDisabled: _propTypes.default.bool,
109
122
  size: _propTypes.default.any,
110
123
  color: _propTypes.default.any,
111
124
  fill: _propTypes.default.bool,
@@ -69,6 +69,19 @@ var EuiSplitButtonActionPrimary = exports.EuiSplitButtonActionPrimary = function
69
69
  return tooltipProps ? (0, _react2.jsx)(_tool_tip.EuiToolTip, tooltipProps, button) : button;
70
70
  };
71
71
  EuiSplitButtonActionPrimary.propTypes = {
72
+ /**
73
+ * Controls the disabled behavior via the native `disabled` attribute.
74
+ */
75
+ isDisabled: _propTypes.default.bool,
76
+ /**
77
+ * NOTE: Beta feature, may be changed or removed in the future
78
+ *
79
+ * Changes the native `disabled` attribute to `aria-disabled` to preserve focusability.
80
+ * This results in a semantically disabled button without the default browser handling of the disabled state.
81
+ *
82
+ * Use e.g. when a disabled button should have a tooltip.
83
+ */
84
+ hasAriaDisabled: _propTypes.default.bool,
72
85
  /**
73
86
  * Enables rendering an `EuiToolTip` with the passed props.
74
87
  */
@@ -111,6 +124,8 @@ var EuiSplitButtonActionSecondary = exports.EuiSplitButtonActionSecondary = func
111
124
  })) : action;
112
125
  };
113
126
  EuiSplitButtonActionSecondary.propTypes = {
127
+ isDisabled: _propTypes.default.bool,
128
+ hasAriaDisabled: _propTypes.default.bool,
114
129
  /**
115
130
  * Enables rendering an `EuiToolTip` with the passed props.
116
131
  */
@@ -137,6 +137,11 @@ EuiCollapsibleNav.propTypes = {
137
137
  * @default undefined (auto-inherit when nested, otherwise 'never')
138
138
  */
139
139
  session: _propTypes.default.oneOfType([_propTypes.default.any.isRequired, _propTypes.default.any.isRequired, _propTypes.default.any.isRequired]),
140
+ /**
141
+ * Optional Symbol to scope flyout history. Only flyouts that receive the same Symbol reference share Back button and history; omit to get a unique group per session.
142
+ * @default undefined (each session gets a unique key and does not share history)
143
+ */
144
+ historyKey: _propTypes.default.any,
140
145
  /**
141
146
  * Callback fired when the flyout becomes active/visible, which may happen programmatically from history navigation.
142
147
  */
@@ -101,9 +101,12 @@ var EuiColorPicker = exports.EuiColorPicker = function EuiColorPicker(_ref) {
101
101
  _ref$isClearable = _ref.isClearable,
102
102
  isClearable = _ref$isClearable === void 0 ? false : _ref$isClearable,
103
103
  placeholder = _ref.placeholder,
104
- dataTestSubj = _ref['data-test-subj'];
105
- var _useEuiI18n = (0, _i18n.useEuiI18n)(['euiColorPicker.popoverLabel', 'euiColorPicker.colorLabel', 'euiColorPicker.selectedColorLabel', 'euiColorPicker.colorErrorMessage', 'euiColorPicker.transparent', 'euiColorPicker.alphaLabel', 'euiColorPicker.openLabel', 'euiColorPicker.closeLabel'], ['Color selection dialog', 'Color value', 'Selected color', 'Invalid color value', 'Transparent', 'Alpha channel (opacity) value', 'Press the escape key to close the popover', 'Press the down key to open a popover containing color options']),
106
- _useEuiI18n2 = _slicedToArray(_useEuiI18n, 8),
104
+ dataTestSubj = _ref['data-test-subj'],
105
+ _ariaLabel = _ref['aria-label'],
106
+ ariaLabelledby = _ref['aria-labelledby'],
107
+ ariaDescribedby = _ref['aria-describedby'];
108
+ var _useEuiI18n = (0, _i18n.useEuiI18n)(['euiColorPicker.popoverLabel', 'euiColorPicker.colorLabel', 'euiColorPicker.selectedColorLabel', 'euiColorPicker.colorErrorMessage', 'euiColorPicker.transparent', 'euiColorPicker.alphaLabel', 'euiColorPicker.openLabel', 'euiColorPicker.closeLabel', 'euiColorPicker.ariaLabel'], ['Color selection dialog', 'Color value', 'Selected color', 'Invalid color value', 'Transparent', 'Alpha channel (opacity) value', 'Press the escape key to close the popover', 'Press the down key to open a popover containing color options', 'Select a color']),
109
+ _useEuiI18n2 = _slicedToArray(_useEuiI18n, 9),
107
110
  popoverLabel = _useEuiI18n2[0],
108
111
  colorLabel = _useEuiI18n2[1],
109
112
  selectedColorLabel = _useEuiI18n2[2],
@@ -111,7 +114,16 @@ var EuiColorPicker = exports.EuiColorPicker = function EuiColorPicker(_ref) {
111
114
  transparent = _useEuiI18n2[4],
112
115
  alphaLabel = _useEuiI18n2[5],
113
116
  openLabel = _useEuiI18n2[6],
114
- closeLabel = _useEuiI18n2[7];
117
+ closeLabel = _useEuiI18n2[7],
118
+ ariaLabel = _useEuiI18n2[8];
119
+ var openLabelId = (0, _services.useGeneratedHtmlId)({
120
+ prefix: 'colorPicker',
121
+ suffix: 'openLabel'
122
+ });
123
+ var closeLabelId = (0, _services.useGeneratedHtmlId)({
124
+ prefix: 'colorPicker',
125
+ suffix: 'closeLabel'
126
+ });
115
127
  var defaultSwatches = (0, _services.useEuiPaletteColorBlind)();
116
128
  var swatches = _swatches !== null && _swatches !== void 0 ? _swatches : defaultSwatches;
117
129
  var preferredFormat = (0, _react.useMemo)(function () {
@@ -440,10 +452,21 @@ var EuiColorPicker = exports.EuiColorPicker = function EuiColorPicker(_ref) {
440
452
  readOnly: readOnly,
441
453
  fullWidth: fullWidth,
442
454
  autoComplete: "off",
443
- "data-test-subj": testSubjAnchor,
444
- "aria-label": isColorSelectorShown ? openLabel : closeLabel,
455
+ "data-test-subj": testSubjAnchor
456
+ // if an id is provided it might be used in combination with `htmlFor` on a label,
457
+ // so we don't want to override it with a fallback `aria-label`
458
+ ,
459
+ "aria-label": _ariaLabel ? _ariaLabel : id || ariaLabelledby ? undefined : ariaLabel,
460
+ "aria-labelledby": ariaLabelledby,
461
+ "aria-describedby": (0, _classnames.default)(isColorSelectorShown ? openLabelId : closeLabelId, ariaDescribedby),
445
462
  controlOnly: true // Don't need two EuiFormControlwrappers
446
- }));
463
+ }), (0, _react2.jsx)(_accessibility.EuiScreenReaderOnly, null, (0, _react2.jsx)("span", null, (0, _react2.jsx)("span", {
464
+ id: openLabelId,
465
+ "aria-hidden": !isColorSelectorShown
466
+ }, openLabel), (0, _react2.jsx)("span", {
467
+ id: closeLabelId,
468
+ "aria-hidden": isColorSelectorShown
469
+ }, closeLabel))));
447
470
  }
448
471
  return display === 'inline' ? (0, _react2.jsx)("div", {
449
472
  css: styles.euiColorPicker,
@@ -14,7 +14,7 @@ var _icon = require("../icon");
14
14
  var _tool_tip = require("../tool_tip");
15
15
  var _context_menu_item = require("./context_menu_item.styles");
16
16
  var _react2 = require("@emotion/react");
17
- var _excluded = ["children", "className", "hasPanel", "icon", "buttonRef", "disabled", "layoutAlign", "toolTipContent", "toolTipProps", "href", "target", "rel", "size"];
17
+ var _excluded = ["children", "className", "hasPanel", "icon", "buttonRef", "disabled", "layoutAlign", "toolTipContent", "toolTipProps", "href", "target", "rel", "size", "color"];
18
18
  /*
19
19
  * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
20
20
  * or more contributor license agreements. Licensed under the Elastic License
@@ -49,12 +49,13 @@ var EuiContextMenuItem = exports.EuiContextMenuItem = function EuiContextMenuIte
49
49
  rel = _ref.rel,
50
50
  _ref$size = _ref.size,
51
51
  size = _ref$size === void 0 ? 'm' : _ref$size,
52
+ color = _ref.color,
52
53
  rest = _objectWithoutProperties(_ref, _excluded);
53
54
  var isHrefValid = !href || (0, _href_validator.validateHref)(href);
54
55
  var disabled = _disabled || !isHrefValid;
55
56
  var classes = (0, _classnames.default)('euiContextMenuItem', className);
56
57
  var styles = (0, _services.useEuiMemoizedStyles)(_context_menu_item.euiContextMenuItemStyles);
57
- var cssStyles = [styles.euiContextMenuItem, styles.sizes[size], styles.layoutAlign[layoutAlign], disabled && styles.disabled];
58
+ var cssStyles = [styles.euiContextMenuItem, styles.sizes[size], styles.layoutAlign[layoutAlign], disabled && styles.disabled, !disabled && color && styles.colors[color]];
58
59
  var iconInstance = icon && (typeof icon === 'string' ? (0, _react2.jsx)(_icon.EuiIcon, {
59
60
  type: icon,
60
61
  size: "m",
@@ -150,5 +151,10 @@ EuiContextMenuItem.propTypes = {
150
151
  /**
151
152
  * Reduce the size to `s` when in need of a more compressed menu
152
153
  */
153
- size: _propTypes.default.any
154
+ size: _propTypes.default.any,
155
+ /**
156
+ * Applies a color to the text and icon of the item.
157
+ * Accepts the same color values as `EuiButtonEmpty`.
158
+ */
159
+ color: _propTypes.default.any
154
160
  };
@@ -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
  };
@@ -7,6 +7,7 @@ Object.defineProperty(exports, "__esModule", {
7
7
  exports.useScrollCellIntoView = exports.useScrollBars = exports.useScroll = void 0;
8
8
  var _react = _interopRequireWildcard(require("react"));
9
9
  var _services = require("../../../services");
10
+ var _hooks = require("../../../services/hooks");
10
11
  var _global_styling = require("../../../global_styling");
11
12
  var _cell = require("../body/cell");
12
13
  var _focus = require("./focus");
@@ -35,20 +36,48 @@ var useScroll = exports.useScroll = function useScroll(args) {
35
36
  scrollCellIntoView = _useScrollCellIntoVie.scrollCellIntoView;
36
37
  var _useContext = (0, _react.useContext)(_focus.DataGridFocusContext),
37
38
  focusedCell = _useContext.focusedCell;
38
- var isPointerDown = (0, _services.useIsPointerDown)(args.outerGridRef);
39
+ var isPointerDownRef = (0, _hooks.useIsPointerDown)(args.outerGridRef);
40
+
41
+ /**
42
+ * Set when `focusedCell` changes while the pointer is held down (e.g. clicking a cell).
43
+ * Allows the `pointerup` listener below to scroll on release without
44
+ * causing snap-back when the user scrolls the grid without changing focus.
45
+ */
46
+ var pendingScrollRef = (0, _react.useRef)(false);
47
+ (0, _react.useEffect)(function () {
48
+ if (!focusedCell) return;
49
+ if (isPointerDownRef.current) {
50
+ // Pointer is down - defer scroll decision to the pointerup listener
51
+ pendingScrollRef.current = true;
52
+ return;
53
+ }
54
+ scrollCellIntoView({
55
+ rowIndex: focusedCell[1],
56
+ colIndex: focusedCell[0]
57
+ });
58
+ }, [focusedCell, scrollCellIntoView, isPointerDownRef]);
39
59
  (0, _react.useEffect)(function () {
40
- if (focusedCell) {
60
+ var handlePointerUp = function handlePointerUp() {
41
61
  var _window;
42
- // do not scroll if text is being selected
43
- if (isPointerDown || ((_window = window) === null || _window === void 0 || (_window = _window.getSelection()) === null || _window === void 0 ? void 0 : _window.type) === 'Range') {
44
- return;
45
- }
62
+ if (!pendingScrollRef.current || !focusedCell) return;
63
+ pendingScrollRef.current = false;
64
+
65
+ // Skip if the interaction resulted in text being selected
66
+ if (((_window = window) === null || _window === void 0 || (_window = _window.getSelection()) === null || _window === void 0 ? void 0 : _window.type) === 'Range') return;
46
67
  scrollCellIntoView({
47
68
  rowIndex: focusedCell[1],
48
69
  colIndex: focusedCell[0]
49
70
  });
50
- }
51
- }, [focusedCell, isPointerDown, scrollCellIntoView]);
71
+ };
72
+ document.addEventListener('pointerup', handlePointerUp, {
73
+ capture: true
74
+ });
75
+ return function () {
76
+ return document.removeEventListener('pointerup', handlePointerUp, {
77
+ capture: true
78
+ });
79
+ };
80
+ }, [focusedCell, scrollCellIntoView]);
52
81
  var _useContext2 = (0, _react.useContext)(_cell.DataGridCellPopoverContext),
53
82
  popoverIsOpen = _useContext2.popoverIsOpen,
54
83
  cellLocation = _useContext2.cellLocation;
@@ -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() {
@@ -7,6 +7,7 @@ Object.defineProperty(exports, "__esModule", {
7
7
  exports.EuiFlyoutOverlay = void 0;
8
8
  var _react = _interopRequireWildcard(require("react"));
9
9
  var _css = require("@emotion/css");
10
+ var _services = require("../../services");
10
11
  var _overlay_mask = require("../overlay_mask");
11
12
  var _portal = require("../portal");
12
13
  var _react2 = require("@emotion/react");
@@ -23,8 +24,7 @@ var getEuiFlyoutOverlayStyles = function getEuiFlyoutOverlayStyles(zIndex) {
23
24
  /*
24
25
  This needs to have !important to override the default EuiOverlayMask
25
26
  z-index based on the headerZindexLocation prop. Using the style attribute
26
- doesn't work since EuiOverlayMask requires a string style prop that
27
- causes React errors in the test environment.
27
+ doesn't work since EuiOverlayMask requires the styles to be provided via className
28
28
  */
29
29
  return /*#__PURE__*/(0, _css.css)("z-index:", zIndex, "!important;;label:getEuiFlyoutOverlayStyles;");
30
30
  };
@@ -45,10 +45,39 @@ var EuiFlyoutOverlay = exports.EuiFlyoutOverlay = function EuiFlyoutOverlay(_ref
45
45
  hasOverlayMask = _ref.hasOverlayMask,
46
46
  maskZIndex = _ref.maskZIndex,
47
47
  _ref$headerZindexLoca = _ref.headerZindexLocation,
48
- headerZindexLocation = _ref$headerZindexLoca === void 0 ? 'below' : _ref$headerZindexLoca;
48
+ headerZindexLocation = _ref$headerZindexLoca === void 0 ? 'below' : _ref$headerZindexLoca,
49
+ containerRect = _ref.containerRect;
49
50
  var styles = (0, _react.useMemo)(function () {
50
51
  return getEuiFlyoutOverlayStyles(maskZIndex);
51
52
  }, [maskZIndex]);
53
+
54
+ // Internal ref so we can apply containerRect positioning directly on the DOM
55
+ // node, avoiding new Emotion CSS class generation on every scroll/resize.
56
+ var internalMaskRef = (0, _react.useRef)(null);
57
+ var combinedMaskRef = (0, _services.useCombinedRefs)([internalMaskRef, maskProps === null || maskProps === void 0 ? void 0 : maskProps.maskRef]);
58
+ (0, _react.useEffect)(function () {
59
+ var node = internalMaskRef.current;
60
+ if (!node) return;
61
+
62
+ // containerRect positioning must be applied via node.style.setProperty rather than
63
+ // through the style prop - EuiOverlayMask requires styles to be passed via className
64
+ if (containerRect) {
65
+ node.style.setProperty('inset-block-start', "".concat(containerRect.top, "px"));
66
+ node.style.setProperty('inset-inline-start', "".concat(containerRect.left, "px"));
67
+ node.style.setProperty('inline-size', "".concat(containerRect.width, "px"));
68
+ node.style.setProperty('block-size', "".concat(containerRect.height, "px"));
69
+ node.style.setProperty('inset-inline-end', 'auto');
70
+ node.style.setProperty('inset-block-end', 'auto');
71
+ } else {
72
+ node.style.removeProperty('inset-block-start');
73
+ node.style.removeProperty('inset-inline-start');
74
+ node.style.removeProperty('inline-size');
75
+ node.style.removeProperty('block-size');
76
+ node.style.removeProperty('inset-inline-end');
77
+ node.style.removeProperty('inset-block-end');
78
+ }
79
+ }, [containerRect, hasOverlayMask]); // toggling ownFocus while the flyout is already open should cause re-render
80
+
52
81
  var content = children;
53
82
  if (!isPushed || hasOverlayMask) {
54
83
  content = (0, _react2.jsx)(_portal.EuiPortal, null, content);
@@ -57,6 +86,7 @@ var EuiFlyoutOverlay = exports.EuiFlyoutOverlay = function EuiFlyoutOverlay(_ref
57
86
  return (0, _react2.jsx)(_react.default.Fragment, null, hasOverlayMask && (0, _react2.jsx)(_overlay_mask.EuiOverlayMask, _extends({
58
87
  headerZindexLocation: (_maskProps$headerZind = maskProps === null || maskProps === void 0 ? void 0 : maskProps.headerZindexLocation) !== null && _maskProps$headerZind !== void 0 ? _maskProps$headerZind : headerZindexLocation
59
88
  }, maskProps, {
89
+ maskRef: combinedMaskRef,
60
90
  className: classes
61
91
  })), content);
62
92
  };
@@ -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
@@ -25,9 +25,9 @@ var _flyout_resize_button = require("./_flyout_resize_button");
25
25
  var _use_flyout_resizable = require("./use_flyout_resizable");
26
26
  var _use_flyout_z_index = require("./use_flyout_z_index");
27
27
  var _flyout_parent_context = require("./flyout_parent_context");
28
+ var _use_flyout_menu = require("./use_flyout_menu");
28
29
  var _react2 = require("@emotion/react");
29
- 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"],
30
- _excluded2 = ["titleId"];
30
+ 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"];
31
31
  /*
32
32
  * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
33
33
  * or more contributor license agreements. Licensed under the Elastic License
@@ -82,31 +82,33 @@ var EuiFlyoutComponent = exports.EuiFlyoutComponent = /*#__PURE__*/(0, _react.fo
82
82
  _usePropsWithComponen2 = _usePropsWithComponen.hideCloseButton,
83
83
  hideCloseButton = _usePropsWithComponen2 === void 0 ? false : _usePropsWithComponen2,
84
84
  _flyoutMenuProps = _usePropsWithComponen.flyoutMenuProps,
85
+ _usePropsWithComponen3 = _usePropsWithComponen.flyoutMenuDisplayMode,
86
+ flyoutMenuDisplayMode = _usePropsWithComponen3 === void 0 ? _const2.DEFAULT_MENU_DISPLAY_MODE : _usePropsWithComponen3,
85
87
  closeButtonProps = _usePropsWithComponen.closeButtonProps,
86
- _usePropsWithComponen3 = _usePropsWithComponen.closeButtonPosition,
87
- closeButtonPosition = _usePropsWithComponen3 === void 0 ? 'inside' : _usePropsWithComponen3,
88
+ _usePropsWithComponen4 = _usePropsWithComponen.closeButtonPosition,
89
+ closeButtonPosition = _usePropsWithComponen4 === void 0 ? 'inside' : _usePropsWithComponen4,
88
90
  onClose = _usePropsWithComponen.onClose,
89
- _usePropsWithComponen4 = _usePropsWithComponen.ownFocus,
90
- ownFocus = _usePropsWithComponen4 === void 0 ? true : _usePropsWithComponen4,
91
- _usePropsWithComponen5 = _usePropsWithComponen.side,
92
- side = _usePropsWithComponen5 === void 0 ? _const2.DEFAULT_SIDE : _usePropsWithComponen5,
93
- _usePropsWithComponen6 = _usePropsWithComponen.size,
94
- _size = _usePropsWithComponen6 === void 0 ? _const2.DEFAULT_SIZE : _usePropsWithComponen6,
95
- _usePropsWithComponen7 = _usePropsWithComponen.paddingSize,
96
- paddingSize = _usePropsWithComponen7 === void 0 ? _const2.DEFAULT_PADDING_SIZE : _usePropsWithComponen7,
97
- _usePropsWithComponen8 = _usePropsWithComponen.maxWidth,
98
- maxWidth = _usePropsWithComponen8 === void 0 ? false : _usePropsWithComponen8,
91
+ _usePropsWithComponen5 = _usePropsWithComponen.ownFocus,
92
+ ownFocus = _usePropsWithComponen5 === void 0 ? true : _usePropsWithComponen5,
93
+ _usePropsWithComponen6 = _usePropsWithComponen.side,
94
+ side = _usePropsWithComponen6 === void 0 ? _const2.DEFAULT_SIDE : _usePropsWithComponen6,
95
+ _usePropsWithComponen7 = _usePropsWithComponen.size,
96
+ _size = _usePropsWithComponen7 === void 0 ? _const2.DEFAULT_SIZE : _usePropsWithComponen7,
97
+ _usePropsWithComponen8 = _usePropsWithComponen.paddingSize,
98
+ paddingSize = _usePropsWithComponen8 === void 0 ? _const2.DEFAULT_PADDING_SIZE : _usePropsWithComponen8,
99
+ _usePropsWithComponen9 = _usePropsWithComponen.maxWidth,
100
+ maxWidth = _usePropsWithComponen9 === void 0 ? false : _usePropsWithComponen9,
99
101
  style = _usePropsWithComponen.style,
100
- _usePropsWithComponen9 = _usePropsWithComponen.hasChildBackground,
101
- hasChildBackground = _usePropsWithComponen9 === void 0 ? false : _usePropsWithComponen9,
102
+ _usePropsWithComponen10 = _usePropsWithComponen.hasChildBackground,
103
+ hasChildBackground = _usePropsWithComponen10 === void 0 ? false : _usePropsWithComponen10,
102
104
  maskProps = _usePropsWithComponen.maskProps,
103
- _usePropsWithComponen10 = _usePropsWithComponen.type,
104
- type = _usePropsWithComponen10 === void 0 ? _const2.DEFAULT_TYPE : _usePropsWithComponen10,
105
+ _usePropsWithComponen11 = _usePropsWithComponen.type,
106
+ type = _usePropsWithComponen11 === void 0 ? _const2.DEFAULT_TYPE : _usePropsWithComponen11,
105
107
  outsideClickCloses = _usePropsWithComponen.outsideClickCloses,
106
- _usePropsWithComponen11 = _usePropsWithComponen.pushMinBreakpoint,
107
- pushMinBreakpoint = _usePropsWithComponen11 === void 0 ? _const2.DEFAULT_PUSH_MIN_BREAKPOINT : _usePropsWithComponen11,
108
- _usePropsWithComponen12 = _usePropsWithComponen.pushAnimation,
109
- pushAnimation = _usePropsWithComponen12 === void 0 ? false : _usePropsWithComponen12,
108
+ _usePropsWithComponen12 = _usePropsWithComponen.pushMinBreakpoint,
109
+ pushMinBreakpoint = _usePropsWithComponen12 === void 0 ? _const2.DEFAULT_PUSH_MIN_BREAKPOINT : _usePropsWithComponen12,
110
+ _pushAnimation = _usePropsWithComponen.pushAnimation,
111
+ _hasAnimation = _usePropsWithComponen.hasAnimation,
110
112
  _focusTrapProps = _usePropsWithComponen.focusTrapProps,
111
113
  _usePropsWithComponen13 = _usePropsWithComponen.includeFixedHeadersInFocusTrap,
112
114
  includeFixedHeadersInFocusTrap = _usePropsWithComponen13 === void 0 ? true : _usePropsWithComponen13,
@@ -122,6 +124,8 @@ var EuiFlyoutComponent = exports.EuiFlyoutComponent = /*#__PURE__*/(0, _react.fo
122
124
  containerProp = _usePropsWithComponen.container,
123
125
  rest = _objectWithoutProperties(_usePropsWithComponen, _excluded);
124
126
  var container = resolveContainer(containerProp);
127
+ var hasAnimationDefault = type === 'overlay';
128
+ var hasAnimation = _hasAnimation !== null && _hasAnimation !== void 0 ? _hasAnimation : hasAnimationDefault;
125
129
  var _useEuiThemeCSSVariab = (0, _services.useEuiThemeCSSVariables)(),
126
130
  setGlobalCSSVariables = _useEuiThemeCSSVariab.setGlobalCSSVariables;
127
131
  var Element = as || defaultElement;
@@ -173,6 +177,21 @@ var EuiFlyoutComponent = exports.EuiFlyoutComponent = /*#__PURE__*/(0, _react.fo
173
177
  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;
174
178
  var isActiveManagedFlyout = (currentSession === null || currentSession === void 0 ? void 0 : currentSession.mainFlyoutId) === flyoutId || (currentSession === null || currentSession === void 0 ? void 0 : currentSession.childFlyoutId) === flyoutId;
175
179
  var currentZIndexRef = (0, _react.useRef)((_managerState$current = managerState === null || managerState === void 0 ? void 0 : managerState.currentZIndex) !== null && _managerState$current !== void 0 ? _managerState$current : 0);
180
+ var _useEuiFlyoutMenu = (0, _use_flyout_menu.useEuiFlyoutMenu)({
181
+ flyoutMenuProps: _flyoutMenuProps,
182
+ flyoutMenuDisplayMode: flyoutMenuDisplayMode,
183
+ ariaLabelledBy: _ariaLabelledBy
184
+ }),
185
+ flyoutMenuId = _useEuiFlyoutMenu.flyoutMenuId,
186
+ flyoutMenuProps = _useEuiFlyoutMenu.flyoutMenuProps,
187
+ shouldRenderMenu = _useEuiFlyoutMenu.shouldRenderMenu,
188
+ ariaLabelledBy = _useEuiFlyoutMenu.ariaLabelledBy;
189
+ (0, _react.useEffect)(function () {
190
+ if (process.env.NODE_ENV === 'development' && _flyoutMenuProps && 'hideTitle' in _flyoutMenuProps) {
191
+ console.warn('EuiFlyout: `flyoutMenuProps.hideTitle` is deprecated. Use `EuiFlyoutHeader` for visible titles instead.');
192
+ }
193
+ // eslint-disable-next-line react-hooks/exhaustive-deps
194
+ }, []);
176
195
 
177
196
  // Use a ref to access the latest flyoutManager without triggering effect re-runs
178
197
  var flyoutManagerRef = (0, _react.useRef)(flyoutManager);
@@ -527,7 +546,7 @@ var EuiFlyoutComponent = exports.EuiFlyoutComponent = /*#__PURE__*/(0, _react.fo
527
546
  return _objectSpread(_objectSpread(_objectSpread({}, style), composedStyles), containerPositionStyles);
528
547
  }, [style, size, layoutMode, siblingFlyoutId, siblingFlyoutWidth, maxWidth, flyoutZIndex, containerRect, side, isChildFlyout]);
529
548
  var styles = (0, _services.useEuiMemoizedStyles)(_flyout.euiFlyoutStyles);
530
- 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], isPushed && !pushAnimation && styles.push.noAnimation, styles[side]];
549
+ 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]];
531
550
  var classes = (0, _classnames.default)('euiFlyout', isChildFlyout && hasChildBackground && 'euiFlyout--hasChildBackground', className);
532
551
  var flyoutToggle = (0, _react.useRef)(document.activeElement);
533
552
  var _useState5 = (0, _react.useState)([]),
@@ -621,34 +640,6 @@ var EuiFlyoutComponent = exports.EuiFlyoutComponent = /*#__PURE__*/(0, _react.fo
621
640
  })));
622
641
  }, [hasOverlayMask, descriptionId, focusTrapShards.length]);
623
642
 
624
- /*
625
- * If the flyout menu is to be rendered, ensure the flyout has aria-labelledby referencing the menu's titleId
626
- */
627
- var generatedMenuId = (0, _services.useGeneratedHtmlId)();
628
- var _ref = _flyoutMenuProps || {},
629
- _titleId = _ref.titleId,
630
- flyoutMenuProps = _objectWithoutProperties(_ref, _excluded2);
631
- var hasMenu = !!_flyoutMenuProps;
632
- var flyoutMenuId = (0, _react.useMemo)(function () {
633
- if (!hasMenu) return undefined;
634
- return _titleId || generatedMenuId;
635
- }, [hasMenu, _titleId, generatedMenuId]);
636
-
637
- // If the flyout level is LEVEL_MAIN, the title should be hidden by default
638
- var flyoutMenuHideTitle = (0, _react.useMemo)(function () {
639
- if (!hasMenu) return undefined;
640
- if ((_flyoutMenuProps === null || _flyoutMenuProps === void 0 ? void 0 : _flyoutMenuProps.hideTitle) !== undefined) {
641
- return _flyoutMenuProps.hideTitle;
642
- }
643
- return (currentSession === null || currentSession === void 0 ? void 0 : currentSession.mainFlyoutId) === flyoutId;
644
- }, [hasMenu, _flyoutMenuProps, currentSession, flyoutId]);
645
- var ariaLabelledBy = (0, _react.useMemo)(function () {
646
- if (flyoutMenuId) {
647
- return (0, _classnames.default)(flyoutMenuId, _ariaLabelledBy);
648
- }
649
- return _ariaLabelledBy;
650
- }, [flyoutMenuId, _ariaLabelledBy]);
651
-
652
643
  /*
653
644
  * Trap focus even when `ownFocus={false}`, otherwise closing
654
645
  * the flyout won't return focus to the originating button.
@@ -691,8 +682,10 @@ var EuiFlyoutComponent = exports.EuiFlyoutComponent = /*#__PURE__*/(0, _react.fo
691
682
  isPushed: isPushed,
692
683
  maskZIndex: maskZIndex,
693
684
  headerZindexLocation: effectiveHeaderZindexLocation,
685
+ containerRect: containerRect,
694
686
  maskProps: _objectSpread(_objectSpread({}, maskProps), {}, {
695
- maskRef: maskCombinedRefs
687
+ maskRef: maskCombinedRefs,
688
+ hasAnimation: hasAnimation
696
689
  })
697
690
  }, (0, _react2.jsx)(_services.EuiWindowEvent, {
698
691
  event: "keydown",
@@ -716,13 +709,12 @@ var EuiFlyoutComponent = exports.EuiFlyoutComponent = /*#__PURE__*/(0, _react.fo
716
709
  "aria-labelledby": ariaLabelledBy,
717
710
  "data-autofocus": !isPushed || undefined,
718
711
  onAnimationEnd: onAnimationEnd
719
- }), !isPushed && screenReaderDescription, !_flyoutMenuProps && !hideCloseButton && (0, _react2.jsx)(_flyout_close_button.EuiFlyoutCloseButton, _extends({}, closeButtonProps, {
712
+ }), !isPushed && screenReaderDescription, shouldRenderMenu ? (0, _react2.jsx)(_flyout_menu.EuiFlyoutMenu, _extends({}, flyoutMenuProps, {
713
+ titleId: flyoutMenuId
714
+ })) : !hideCloseButton && (0, _react2.jsx)(_flyout_close_button.EuiFlyoutCloseButton, _extends({}, closeButtonProps, {
720
715
  onClose: handleClose,
721
716
  closeButtonPosition: closeButtonPosition,
722
717
  side: side
723
- })), _flyoutMenuProps && (0, _react2.jsx)(_flyout_menu.EuiFlyoutMenu, _extends({}, flyoutMenuProps, {
724
- hideTitle: flyoutMenuHideTitle,
725
- titleId: flyoutMenuId
726
718
  })), resizable && (0, _react2.jsx)(_flyout_resize_button.EuiFlyoutResizeButton, {
727
719
  type: type,
728
720
  side: side,
@@ -5,6 +5,12 @@ Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
7
  exports.EuiFlyout = void 0;
8
+ Object.defineProperty(exports, "FLYOUT_MENU_DISPLAY_MODES", {
9
+ enumerable: true,
10
+ get: function get() {
11
+ return _const2.FLYOUT_MENU_DISPLAY_MODES;
12
+ }
13
+ });
8
14
  Object.defineProperty(exports, "FLYOUT_PADDING_SIZES", {
9
15
  enumerable: true,
10
16
  get: function get() {
@@ -39,7 +45,7 @@ var _flyout_parent_context = require("./flyout_parent_context");
39
45
  var _const = require("./manager/const");
40
46
  var _react2 = require("@emotion/react");
41
47
  var _const2 = require("./const");
42
- var _excluded = ["as", "onClose", "onActive", "session"];
48
+ var _excluded = ["as", "onClose", "onActive", "session", "historyKey"];
43
49
  /*
44
50
  * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
45
51
  * or more contributor license agreements. Licensed under the Elastic License
@@ -59,6 +65,7 @@ var EuiFlyout = exports.EuiFlyout = /*#__PURE__*/(0, _react.forwardRef)(function
59
65
  onClose = _usePropsWithComponen.onClose,
60
66
  onActive = _usePropsWithComponen.onActive,
61
67
  session = _usePropsWithComponen.session,
68
+ historyKey = _usePropsWithComponen.historyKey,
62
69
  rest = _objectWithoutProperties(_usePropsWithComponen, _excluded);
63
70
  var hasActiveSession = (0, _manager.useHasActiveSession)();
64
71
  var isInsideParentFlyout = (0, _flyout_parent_context.useIsInsideParentFlyout)();
@@ -85,6 +92,7 @@ var EuiFlyout = exports.EuiFlyout = /*#__PURE__*/(0, _react.forwardRef)(function
85
92
  return null;
86
93
  }
87
94
  return (0, _react2.jsx)(_manager.EuiFlyoutMain, _extends({}, rest, {
95
+ historyKey: historyKey,
88
96
  onClose: onClose,
89
97
  onActive: onActive,
90
98
  as: "div",
@@ -95,6 +103,7 @@ var EuiFlyout = exports.EuiFlyout = /*#__PURE__*/(0, _react.forwardRef)(function
95
103
  // session=inherit: auto-join existing session as child
96
104
  if (hasActiveSession && effectiveSession === _const.SESSION_INHERIT) {
97
105
  return (0, _react2.jsx)(_manager.EuiFlyoutChild, _extends({}, rest, {
106
+ historyKey: historyKey,
98
107
  onClose: onClose,
99
108
  onActive: onActive,
100
109
  as: "div",
@@ -128,6 +137,11 @@ EuiFlyout.propTypes = {
128
137
  * @default undefined (auto-inherit when nested, otherwise 'never')
129
138
  */
130
139
  session: _propTypes.default.oneOfType([_propTypes.default.any.isRequired, _propTypes.default.any.isRequired, _propTypes.default.any.isRequired]),
140
+ /**
141
+ * Optional Symbol to scope flyout history. Only flyouts that receive the same Symbol reference share Back button and history; omit to get a unique group per session.
142
+ * @default undefined (each session gets a unique key and does not share history)
143
+ */
144
+ historyKey: _propTypes.default.any,
131
145
  /**
132
146
  * Callback fired when the flyout becomes active/visible, which may happen programmatically from history navigation.
133
147
  */