@elastic/eui 113.3.0 → 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 (107) hide show
  1. package/es/components/button/split_button/split_button.js +13 -0
  2. package/es/components/button/split_button/split_button_actions.js +15 -0
  3. package/es/components/collapsible_nav/collapsible_nav.js +5 -0
  4. package/es/components/color_picker/color_picker.js +31 -8
  5. package/es/components/datagrid/utils/scrolling.js +39 -10
  6. package/es/components/flyout/_flyout_overlay.js +34 -4
  7. package/es/components/flyout/flyout.component.js +13 -9
  8. package/es/components/flyout/flyout.js +9 -1
  9. package/es/components/flyout/flyout.styles.js +2 -2
  10. package/es/components/flyout/flyout_menu.js +2 -1
  11. package/es/components/flyout/flyout_resizable.js +5 -0
  12. package/es/components/flyout/manager/actions.js +5 -2
  13. package/es/components/flyout/manager/flyout_child.js +1 -0
  14. package/es/components/flyout/manager/flyout_managed.js +5 -3
  15. package/es/components/flyout/manager/reducer.js +116 -57
  16. package/es/components/flyout/manager/store.js +13 -6
  17. package/es/components/markdown_editor/plugins/markdown_default_plugins/parsing_plugins.js +2 -1
  18. package/es/components/markdown_editor/plugins/remark/remark_intraword_underscore.js +172 -0
  19. package/es/components/overlay_mask/overlay_mask.js +10 -3
  20. package/es/components/tree_view/tree_view_item.styles.js +1 -1
  21. package/es/services/hooks/index.js +8 -8
  22. package/es/services/hooks/useIsPointerDown.js +6 -15
  23. package/es/services/index.js +1 -1
  24. package/eui.d.ts +83 -51
  25. package/i18ntokens.json +661 -643
  26. package/lib/components/button/split_button/split_button.js +13 -0
  27. package/lib/components/button/split_button/split_button_actions.js +15 -0
  28. package/lib/components/collapsible_nav/collapsible_nav.js +5 -0
  29. package/lib/components/color_picker/color_picker.js +30 -7
  30. package/lib/components/datagrid/utils/scrolling.js +37 -8
  31. package/lib/components/flyout/_flyout_overlay.js +33 -3
  32. package/lib/components/flyout/flyout.component.js +13 -9
  33. package/lib/components/flyout/flyout.js +9 -1
  34. package/lib/components/flyout/flyout.styles.js +2 -2
  35. package/lib/components/flyout/flyout_menu.js +2 -1
  36. package/lib/components/flyout/flyout_resizable.js +5 -0
  37. package/lib/components/flyout/manager/actions.js +5 -2
  38. package/lib/components/flyout/manager/flyout_child.js +1 -0
  39. package/lib/components/flyout/manager/flyout_managed.js +5 -3
  40. package/lib/components/flyout/manager/reducer.js +116 -57
  41. package/lib/components/flyout/manager/store.js +13 -6
  42. package/lib/components/markdown_editor/plugins/markdown_default_plugins/parsing_plugins.js +2 -1
  43. package/lib/components/markdown_editor/plugins/remark/remark_intraword_underscore.js +179 -0
  44. package/lib/components/overlay_mask/overlay_mask.js +10 -3
  45. package/lib/components/tree_view/tree_view_item.styles.js +1 -1
  46. package/lib/services/hooks/index.js +60 -91
  47. package/lib/services/hooks/useIsPointerDown.js +7 -14
  48. package/lib/services/index.js +70 -11
  49. package/optimize/es/components/color_picker/color_picker.js +31 -8
  50. package/optimize/es/components/datagrid/utils/scrolling.js +39 -10
  51. package/optimize/es/components/flyout/_flyout_overlay.js +34 -4
  52. package/optimize/es/components/flyout/flyout.component.js +13 -9
  53. package/optimize/es/components/flyout/flyout.js +4 -1
  54. package/optimize/es/components/flyout/flyout.styles.js +2 -2
  55. package/optimize/es/components/flyout/flyout_menu.js +2 -1
  56. package/optimize/es/components/flyout/manager/actions.js +5 -2
  57. package/optimize/es/components/flyout/manager/flyout_managed.js +4 -3
  58. package/optimize/es/components/flyout/manager/reducer.js +116 -57
  59. package/optimize/es/components/flyout/manager/store.js +13 -6
  60. package/optimize/es/components/markdown_editor/plugins/markdown_default_plugins/parsing_plugins.js +2 -1
  61. package/optimize/es/components/markdown_editor/plugins/remark/remark_intraword_underscore.js +172 -0
  62. package/optimize/es/components/overlay_mask/overlay_mask.js +4 -2
  63. package/optimize/es/components/tree_view/tree_view_item.styles.js +1 -1
  64. package/optimize/es/services/hooks/index.js +8 -8
  65. package/optimize/es/services/hooks/useIsPointerDown.js +6 -10
  66. package/optimize/es/services/index.js +1 -1
  67. package/optimize/lib/components/color_picker/color_picker.js +30 -7
  68. package/optimize/lib/components/datagrid/utils/scrolling.js +37 -8
  69. package/optimize/lib/components/flyout/_flyout_overlay.js +33 -3
  70. package/optimize/lib/components/flyout/flyout.component.js +13 -9
  71. package/optimize/lib/components/flyout/flyout.js +4 -1
  72. package/optimize/lib/components/flyout/flyout.styles.js +2 -2
  73. package/optimize/lib/components/flyout/flyout_menu.js +2 -1
  74. package/optimize/lib/components/flyout/manager/actions.js +5 -2
  75. package/optimize/lib/components/flyout/manager/flyout_managed.js +4 -3
  76. package/optimize/lib/components/flyout/manager/reducer.js +116 -57
  77. package/optimize/lib/components/flyout/manager/store.js +13 -6
  78. package/optimize/lib/components/markdown_editor/plugins/markdown_default_plugins/parsing_plugins.js +2 -1
  79. package/optimize/lib/components/markdown_editor/plugins/remark/remark_intraword_underscore.js +179 -0
  80. package/optimize/lib/components/overlay_mask/overlay_mask.js +4 -2
  81. package/optimize/lib/components/tree_view/tree_view_item.styles.js +1 -1
  82. package/optimize/lib/services/hooks/index.js +60 -91
  83. package/optimize/lib/services/hooks/useIsPointerDown.js +5 -10
  84. package/optimize/lib/services/index.js +70 -11
  85. package/package.json +4 -4
  86. package/test-env/components/button/split_button/split_button.js +13 -0
  87. package/test-env/components/button/split_button/split_button_actions.js +15 -0
  88. package/test-env/components/collapsible_nav/collapsible_nav.js +5 -0
  89. package/test-env/components/color_picker/color_picker.js +30 -7
  90. package/test-env/components/datagrid/utils/scrolling.js +37 -8
  91. package/test-env/components/flyout/_flyout_overlay.js +33 -3
  92. package/test-env/components/flyout/flyout.component.js +13 -9
  93. package/test-env/components/flyout/flyout.styles.js +2 -2
  94. package/test-env/components/flyout/flyout_menu.js +2 -1
  95. package/test-env/components/flyout/flyout_resizable.js +5 -0
  96. package/test-env/components/flyout/manager/actions.js +5 -2
  97. package/test-env/components/flyout/manager/flyout_child.js +1 -0
  98. package/test-env/components/flyout/manager/flyout_managed.js +5 -3
  99. package/test-env/components/flyout/manager/reducer.js +116 -57
  100. package/test-env/components/flyout/manager/store.js +13 -6
  101. package/test-env/components/markdown_editor/plugins/markdown_default_plugins/parsing_plugins.js +2 -1
  102. package/test-env/components/markdown_editor/plugins/remark/remark_intraword_underscore.js +179 -0
  103. package/test-env/components/overlay_mask/overlay_mask.js +10 -3
  104. package/test-env/components/tree_view/tree_view_item.styles.js +1 -1
  105. package/test-env/services/hooks/index.js +60 -91
  106. package/test-env/services/hooks/useIsPointerDown.js +5 -10
  107. package/test-env/services/index.js +70 -11
@@ -69,9 +69,9 @@ export var euiFlyoutStyles = function euiFlyoutStyles(euiThemeContext) {
69
69
  push: {
70
70
  push: /*#__PURE__*/css("clip-path:none;z-index:", Number(euiTheme.levels.flyout) - 1, ";;label:push;"),
71
71
  right: /*#__PURE__*/css(logicalCSS('border-left', euiTheme.border.thick), ";;label:right;"),
72
- left: /*#__PURE__*/css(logicalCSS('border-right', euiTheme.border.thick), ";;label:left;"),
73
- noAnimation: _ref
72
+ left: /*#__PURE__*/css(logicalCSS('border-right', euiTheme.border.thick), ";;label:left;")
74
73
  },
74
+ noAnimation: _ref,
75
75
  // Padding
76
76
  paddingSizes: {
77
77
  none: /*#__PURE__*/css(composeFlyoutPadding(euiThemeContext, 'none'), ";;label:none;"),
@@ -1,7 +1,7 @@
1
1
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
2
2
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
3
3
  import _extends from "@babel/runtime/helpers/extends";
4
- var _excluded = ["className", "title", "titleId", "hideTitle", "hideCloseButton", "historyItems", "showBackButton", "backButtonProps", "customActions"];
4
+ var _excluded = ["className", "title", "titleId", "hideTitle", "hideCloseButton", "historyItems", "showBackButton", "backButtonProps", "customActions", "iconType"];
5
5
  /*
6
6
  * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
7
7
  * or more contributor license agreements. Licensed under the Elastic License
@@ -107,6 +107,7 @@ export var EuiFlyoutMenu = function EuiFlyoutMenu(_ref2) {
107
107
  showBackButton = _ref2.showBackButton,
108
108
  backButtonProps = _ref2.backButtonProps,
109
109
  customActions = _ref2.customActions,
110
+ _iconType = _ref2.iconType,
110
111
  rest = _objectWithoutProperties(_ref2, _excluded);
111
112
  var _useContext = useContext(EuiFlyoutMenuContext),
112
113
  onClose = _useContext.onClose;
@@ -69,19 +69,22 @@ 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 `historyKey` (Symbol) scopes history; only flyouts with the same reference share Back/history. Omit for a unique group per session.
72
73
  * - Optional `iconType` is shown next to the session title in the history menu.
73
74
  */
74
75
  export var addFlyout = function addFlyout(flyoutId, title) {
75
76
  var level = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : LEVEL_MAIN;
76
77
  var size = arguments.length > 3 ? arguments[3] : undefined;
77
- var iconType = arguments.length > 4 ? arguments[4] : undefined;
78
- var minWidth = arguments.length > 5 ? arguments[5] : undefined;
78
+ var historyKey = arguments.length > 4 ? arguments[4] : undefined;
79
+ var iconType = arguments.length > 5 ? arguments[5] : undefined;
80
+ var minWidth = arguments.length > 6 ? arguments[6] : undefined;
79
81
  return {
80
82
  type: ACTION_ADD,
81
83
  flyoutId: flyoutId,
82
84
  title: title,
83
85
  level: level,
84
86
  size: size,
87
+ historyKey: historyKey,
85
88
  iconType: iconType,
86
89
  minWidth: minWidth
87
90
  };
@@ -2,7 +2,7 @@ import _extends from "@babel/runtime/helpers/extends";
2
2
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
3
3
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
4
4
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
5
- var _excluded = ["id", "onClose", "onActive", "level", "size", "minWidth", "css", "flyoutMenuProps"];
5
+ var _excluded = ["id", "onClose", "onActive", "level", "size", "minWidth", "historyKey", "css", "flyoutMenuProps"];
6
6
  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; }
7
7
  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; }
8
8
  /*
@@ -58,6 +58,7 @@ export var EuiManagedFlyout = /*#__PURE__*/forwardRef(function (_ref, ref) {
58
58
  level = _ref.level,
59
59
  sizeProp = _ref.size,
60
60
  minWidth = _ref.minWidth,
61
+ historyKey = _ref.historyKey,
61
62
  customCss = _ref.css,
62
63
  _flyoutMenuProps = _ref.flyoutMenuProps,
63
64
  props = _objectWithoutProperties(_ref, _excluded);
@@ -156,7 +157,7 @@ export var EuiManagedFlyout = /*#__PURE__*/forwardRef(function (_ref, ref) {
156
157
  // Register with flyout manager context when open, remove when closed
157
158
  // Using useLayoutEffect to run synchronously before DOM updates
158
159
  useLayoutEffect(function () {
159
- addFlyout(flyoutId, title, level, size, _flyoutMenuProps === null || _flyoutMenuProps === void 0 ? void 0 : _flyoutMenuProps.iconType, typeof minWidth === 'number' ? minWidth : undefined);
160
+ addFlyout(flyoutId, title, level, size, level === LEVEL_MAIN ? historyKey : undefined, _flyoutMenuProps === null || _flyoutMenuProps === void 0 ? void 0 : _flyoutMenuProps.iconType, typeof minWidth === 'number' ? minWidth : undefined);
160
161
  return function () {
161
162
  var currentStoreState = getFlyoutManagerStore().getState();
162
163
  var stillInStore = currentStoreState.flyouts.some(function (f) {
@@ -172,7 +173,7 @@ export var EuiManagedFlyout = /*#__PURE__*/forwardRef(function (_ref, ref) {
172
173
  }
173
174
  wasRegisteredRef.current = false;
174
175
  };
175
- }, [flyoutId, title, level, size, minWidth, _flyoutMenuProps === null || _flyoutMenuProps === void 0 ? void 0 : _flyoutMenuProps.iconType, addFlyout, closeFlyout, closeAllFlyouts]);
176
+ }, [flyoutId, title, level, size, minWidth, historyKey, _flyoutMenuProps === null || _flyoutMenuProps === void 0 ? void 0 : _flyoutMenuProps.iconType, addFlyout, closeFlyout, closeAllFlyouts]);
176
177
 
177
178
  // Detect when flyout has been removed from manager state (e.g., via Back button)
178
179
  // and trigger onClose callback to notify the parent component
@@ -26,6 +26,28 @@ export var initialState = {
26
26
  currentZIndex: 0,
27
27
  unmanagedFlyouts: []
28
28
  };
29
+ var addSessionFlyoutsToRemove = function addSessionFlyoutsToRemove(session, flyoutsToRemove) {
30
+ var _session$childHistory;
31
+ flyoutsToRemove.add(session.mainFlyoutId);
32
+ if (session.childFlyoutId) {
33
+ flyoutsToRemove.add(session.childFlyoutId);
34
+ }
35
+ ((_session$childHistory = session.childHistory) !== null && _session$childHistory !== void 0 ? _session$childHistory : []).forEach(function (e) {
36
+ return flyoutsToRemove.add(e.flyoutId);
37
+ });
38
+ };
39
+ var moveHistoryGroupToTop = function moveHistoryGroupToTop(sessions, historyKey) {
40
+ var groupSessions = [];
41
+ var otherSessions = [];
42
+ sessions.forEach(function (session) {
43
+ if (session.historyKey === historyKey) {
44
+ groupSessions.push(session);
45
+ } else {
46
+ otherSessions.push(session);
47
+ }
48
+ });
49
+ return [].concat(otherSessions, groupSessions);
50
+ };
29
51
 
30
52
  /**
31
53
  * Reducer handling all flyout manager actions and state transitions.
@@ -74,6 +96,7 @@ export function flyoutManagerReducer() {
74
96
  title = action.title,
75
97
  level = action.level,
76
98
  size = action.size,
99
+ historyKey = action.historyKey,
77
100
  iconType = action.iconType,
78
101
  minWidth = action.minWidth;
79
102
  var isDuplicate = state.flyouts.some(function (f) {
@@ -100,7 +123,8 @@ export function flyoutManagerReducer() {
100
123
  iconType: iconType,
101
124
  childFlyoutId: null,
102
125
  childHistory: [],
103
- zIndex: state.currentZIndex
126
+ zIndex: state.currentZIndex,
127
+ historyKey: historyKey !== null && historyKey !== void 0 ? historyKey : Symbol()
104
128
  };
105
129
  return _objectSpread(_objectSpread({}, state), {}, {
106
130
  sessions: [].concat(_toConsumableArray(state.sessions), [newSession]),
@@ -227,8 +251,8 @@ export function flyoutManagerReducer() {
227
251
  });
228
252
  }
229
253
  var owningSessionIndex = state.sessions.findIndex(function (session) {
230
- var _session$childHistory;
231
- return session.childFlyoutId === action.flyoutId || ((_session$childHistory = session.childHistory) !== null && _session$childHistory !== void 0 ? _session$childHistory : []).some(function (entry) {
254
+ var _session$childHistory2;
255
+ return session.childFlyoutId === action.flyoutId || ((_session$childHistory2 = session.childHistory) !== null && _session$childHistory2 !== void 0 ? _session$childHistory2 : []).some(function (entry) {
232
256
  return entry.flyoutId === action.flyoutId;
233
257
  });
234
258
  });
@@ -260,21 +284,37 @@ export function flyoutManagerReducer() {
260
284
  });
261
285
  }
262
286
 
263
- // Unregister all flyouts.
287
+ // Unregister all flyouts (within the current history group only).
264
288
  case ACTION_CLOSE_ALL:
265
289
  {
266
290
  if (state.sessions.length === 0) {
267
291
  return state;
268
292
  }
293
+ var _currentSessionIndex = state.sessions.length - 1;
294
+ var _currentSession = state.sessions[_currentSessionIndex];
295
+ var currentKey = _currentSession.historyKey;
269
296
 
270
- // Reset current z-index to 0 only if no unmanaged flyouts remain.
297
+ // Remove all sessions that have the current historyKey (entire group)
298
+ var _newSessions = state.sessions.filter(function (s) {
299
+ return s.historyKey !== currentKey;
300
+ });
301
+ var _flyoutsToRemove = new Set();
302
+ state.sessions.forEach(function (session) {
303
+ if (session.historyKey === currentKey) {
304
+ addSessionFlyoutsToRemove(session, _flyoutsToRemove);
305
+ }
306
+ });
307
+ var _newFlyouts3 = state.flyouts.filter(function (f) {
308
+ return !_flyoutsToRemove.has(f.flyoutId);
309
+ });
271
310
  var _newCurrentZIndex2 = state.currentZIndex;
272
- if (state.unmanagedFlyouts.length === 0) {
311
+ if (_newSessions.length === 0 && state.unmanagedFlyouts.length === 0) {
273
312
  _newCurrentZIndex2 = 0;
274
313
  }
275
- return _objectSpread(_objectSpread({}, initialState), {}, {
276
- currentZIndex: _newCurrentZIndex2,
277
- unmanagedFlyouts: state.unmanagedFlyouts
314
+ return _objectSpread(_objectSpread({}, state), {}, {
315
+ sessions: _newSessions,
316
+ flyouts: _newFlyouts3,
317
+ currentZIndex: _newCurrentZIndex2
278
318
  });
279
319
  }
280
320
 
@@ -286,8 +326,8 @@ export function flyoutManagerReducer() {
286
326
  return state;
287
327
  }
288
328
  var _updatedSessions2 = _toConsumableArray(state.sessions);
289
- var _currentSessionIndex = _updatedSessions2.length - 1;
290
- _updatedSessions2[_currentSessionIndex] = _objectSpread(_objectSpread({}, _updatedSessions2[_currentSessionIndex]), {}, {
329
+ var _currentSessionIndex2 = _updatedSessions2.length - 1;
330
+ _updatedSessions2[_currentSessionIndex2] = _objectSpread(_objectSpread({}, _updatedSessions2[_currentSessionIndex2]), {}, {
291
331
  childFlyoutId: action.flyoutId
292
332
  });
293
333
  return _objectSpread(_objectSpread({}, state), {}, {
@@ -333,51 +373,50 @@ export function flyoutManagerReducer() {
333
373
  });
334
374
  }
335
375
 
336
- // Go back: pop child history when any, else pop current session
376
+ // Go back: pop child history when any, else pop current session (only within same historyKey).
337
377
  case ACTION_GO_BACK:
338
378
  {
339
- var _currentSession$child3, _currentSession$child4;
379
+ var _currentSession2$chil;
340
380
  if (state.sessions.length === 0) {
341
381
  return state;
342
382
  }
343
- var _currentSessionIndex2 = state.sessions.length - 1;
344
- var _currentSession = state.sessions[_currentSessionIndex2];
345
- var _childHistory = (_currentSession$child3 = _currentSession.childHistory) !== null && _currentSession$child3 !== void 0 ? _currentSession$child3 : [];
383
+ var _currentSessionIndex3 = state.sessions.length - 1;
384
+ var _currentSession2 = state.sessions[_currentSessionIndex3];
385
+ var _childHistory = (_currentSession2$chil = _currentSession2.childHistory) !== null && _currentSession2$chil !== void 0 ? _currentSession2$chil : [];
346
386
  if (_childHistory.length > 0) {
347
387
  // Pop one child: set current child to the last entry in history, remove the current child flyout
348
388
  var popped = _childHistory[_childHistory.length - 1];
349
389
  var newChildHistory = _childHistory.slice(0, -1);
350
390
  var _updatedSessions3 = _toConsumableArray(state.sessions);
351
- _updatedSessions3[_currentSessionIndex2] = _objectSpread(_objectSpread({}, _currentSession), {}, {
391
+ _updatedSessions3[_currentSessionIndex3] = _objectSpread(_objectSpread({}, _currentSession2), {}, {
352
392
  childHistory: newChildHistory,
353
393
  childFlyoutId: popped.flyoutId,
354
394
  childTitle: popped.title,
355
395
  childIconType: popped.iconType
356
396
  });
357
- var _newFlyouts3 = state.flyouts.filter(function (f) {
358
- return f.flyoutId !== _currentSession.childFlyoutId;
397
+ var _newFlyouts4 = state.flyouts.filter(function (f) {
398
+ return f.flyoutId !== _currentSession2.childFlyoutId;
359
399
  });
360
400
  return _objectSpread(_objectSpread({}, state), {}, {
361
401
  sessions: _updatedSessions3,
362
- flyouts: _newFlyouts3
402
+ flyouts: _newFlyouts4
363
403
  });
364
404
  }
365
405
 
366
406
  // No child history: pop current session (main + all its children)
367
- var _flyoutsToRemove = new Set([_currentSession.mainFlyoutId]);
368
- if (_currentSession.childFlyoutId) {
369
- _flyoutsToRemove.add(_currentSession.childFlyoutId);
370
- }
371
- ((_currentSession$child4 = _currentSession.childHistory) !== null && _currentSession$child4 !== void 0 ? _currentSession$child4 : []).forEach(function (e) {
372
- return _flyoutsToRemove.add(e.flyoutId);
407
+ var _flyoutsToRemove2 = new Set();
408
+ addSessionFlyoutsToRemove(_currentSession2, _flyoutsToRemove2);
409
+ var sessionsWithoutCurrent = state.sessions.slice(0, _currentSessionIndex3);
410
+ var hasRemainingInCurrentGroup = sessionsWithoutCurrent.some(function (s) {
411
+ return s.historyKey === _currentSession2.historyKey;
373
412
  });
374
- var _newFlyouts4 = state.flyouts.filter(function (f) {
375
- return !_flyoutsToRemove.has(f.flyoutId);
413
+ var _newSessions2 = hasRemainingInCurrentGroup ? moveHistoryGroupToTop(sessionsWithoutCurrent, _currentSession2.historyKey) : sessionsWithoutCurrent;
414
+ var _newFlyouts5 = state.flyouts.filter(function (f) {
415
+ return !_flyoutsToRemove2.has(f.flyoutId);
376
416
  });
377
- var _newSessions = state.sessions.slice(0, _currentSessionIndex2);
378
417
  return _objectSpread(_objectSpread({}, state), {}, {
379
- sessions: _newSessions,
380
- flyouts: _newFlyouts4
418
+ sessions: _newSessions2,
419
+ flyouts: _newFlyouts5
381
420
  });
382
421
  }
383
422
 
@@ -386,11 +425,11 @@ export function flyoutManagerReducer() {
386
425
  {
387
426
  var _flyoutId3 = action.flyoutId,
388
427
  _level = action.level;
389
- var _currentSessionIndex3 = state.sessions.length - 1;
428
+ var _currentSessionIndex4 = state.sessions.length - 1;
390
429
  if (_level === LEVEL_CHILD && state.sessions.length > 0) {
391
- var _currentSession2$chil;
392
- var _currentSession2 = state.sessions[_currentSessionIndex3];
393
- var _childHistory2 = (_currentSession2$chil = _currentSession2.childHistory) !== null && _currentSession2$chil !== void 0 ? _currentSession2$chil : [];
430
+ var _currentSession3$chil;
431
+ var _currentSession3 = state.sessions[_currentSessionIndex4];
432
+ var _childHistory2 = (_currentSession3$chil = _currentSession3.childHistory) !== null && _currentSession3$chil !== void 0 ? _currentSession3$chil : [];
394
433
  var targetIndex = _childHistory2.findIndex(function (entry) {
395
434
  return entry.flyoutId === _flyoutId3;
396
435
  });
@@ -399,18 +438,18 @@ export function flyoutManagerReducer() {
399
438
  }
400
439
  var targetEntry = _childHistory2[targetIndex];
401
440
  var _newChildHistory = _childHistory2.slice(0, targetIndex);
402
- var _flyoutsToRemove2 = new Set();
403
- if (_currentSession2.childFlyoutId) {
404
- _flyoutsToRemove2.add(_currentSession2.childFlyoutId);
441
+ var _flyoutsToRemove3 = new Set();
442
+ if (_currentSession3.childFlyoutId) {
443
+ _flyoutsToRemove3.add(_currentSession3.childFlyoutId);
405
444
  }
406
445
  _childHistory2.slice(targetIndex + 1).forEach(function (e) {
407
- _flyoutsToRemove2.add(e.flyoutId);
446
+ _flyoutsToRemove3.add(e.flyoutId);
408
447
  });
409
- var _newFlyouts5 = state.flyouts.filter(function (f) {
410
- return !_flyoutsToRemove2.has(f.flyoutId);
448
+ var _newFlyouts6 = state.flyouts.filter(function (f) {
449
+ return !_flyoutsToRemove3.has(f.flyoutId);
411
450
  });
412
451
  var _updatedSessions4 = _toConsumableArray(state.sessions);
413
- _updatedSessions4[_currentSessionIndex3] = _objectSpread(_objectSpread({}, _currentSession2), {}, {
452
+ _updatedSessions4[_currentSessionIndex4] = _objectSpread(_objectSpread({}, _currentSession3), {}, {
414
453
  childHistory: _newChildHistory,
415
454
  childFlyoutId: targetEntry.flyoutId,
416
455
  childTitle: targetEntry.title,
@@ -418,7 +457,7 @@ export function flyoutManagerReducer() {
418
457
  });
419
458
  return _objectSpread(_objectSpread({}, state), {}, {
420
459
  sessions: _updatedSessions4,
421
- flyouts: _newFlyouts5
460
+ flyouts: _newFlyouts6
422
461
  });
423
462
  }
424
463
 
@@ -429,25 +468,45 @@ export function flyoutManagerReducer() {
429
468
  if (targetSessionIndex === -1) {
430
469
  return state; // Target flyout not found
431
470
  }
471
+ var _currentSession4 = state.sessions[_currentSessionIndex4];
472
+ var targetSession = state.sessions[targetSessionIndex];
473
+
474
+ // Group-local navigation: keep other history groups, remove only newer sessions in target's group,
475
+ // then bring that group to the top.
476
+ if (targetSession.historyKey === _currentSession4.historyKey) {
477
+ var _flyoutsToRemove4 = new Set();
478
+ var sessionsAfterTargetInGroup = state.sessions.filter(function (session, index) {
479
+ return index > targetSessionIndex && session.historyKey === targetSession.historyKey;
480
+ });
481
+ sessionsAfterTargetInGroup.forEach(function (session) {
482
+ addSessionFlyoutsToRemove(session, _flyoutsToRemove4);
483
+ });
484
+ var sessionsWithoutRemoved = state.sessions.filter(function (session) {
485
+ return !sessionsAfterTargetInGroup.some(function (removed) {
486
+ return removed.mainFlyoutId === session.mainFlyoutId;
487
+ });
488
+ });
489
+ var reorderedSessions = moveHistoryGroupToTop(sessionsWithoutRemoved, targetSession.historyKey);
490
+ var _newFlyouts7 = state.flyouts.filter(function (f) {
491
+ return !_flyoutsToRemove4.has(f.flyoutId);
492
+ });
493
+ return _objectSpread(_objectSpread({}, state), {}, {
494
+ sessions: reorderedSessions,
495
+ flyouts: _newFlyouts7
496
+ });
497
+ }
432
498
  var sessionsToClose = state.sessions.slice(targetSessionIndex + 1);
433
- var _flyoutsToRemove3 = new Set();
499
+ var _flyoutsToRemove5 = new Set();
434
500
  sessionsToClose.forEach(function (session) {
435
- var _session$childHistory2;
436
- _flyoutsToRemove3.add(session.mainFlyoutId);
437
- if (session.childFlyoutId) {
438
- _flyoutsToRemove3.add(session.childFlyoutId);
439
- }
440
- ((_session$childHistory2 = session.childHistory) !== null && _session$childHistory2 !== void 0 ? _session$childHistory2 : []).forEach(function (e) {
441
- return _flyoutsToRemove3.add(e.flyoutId);
442
- });
501
+ addSessionFlyoutsToRemove(session, _flyoutsToRemove5);
443
502
  });
444
- var _newFlyouts6 = state.flyouts.filter(function (f) {
445
- return !_flyoutsToRemove3.has(f.flyoutId);
503
+ var _newFlyouts8 = state.flyouts.filter(function (f) {
504
+ return !_flyoutsToRemove5.has(f.flyoutId);
446
505
  });
447
- var _newSessions2 = state.sessions.slice(0, targetSessionIndex + 1);
506
+ var _newSessions3 = state.sessions.slice(0, targetSessionIndex + 1);
448
507
  return _objectSpread(_objectSpread({}, state), {}, {
449
- sessions: _newSessions2,
450
- flyouts: _newFlyouts6
508
+ sessions: _newSessions3,
509
+ flyouts: _newFlyouts8
451
510
  });
452
511
  }
453
512
 
@@ -47,8 +47,15 @@ function createStore() {
47
47
  var _currentSession$child;
48
48
  var currentSessionIndex = currentState.sessions.length - 1;
49
49
  var currentSession = currentSessionIndex >= 0 ? currentState.sessions[currentSessionIndex] : null;
50
+ if (!currentSession) {
51
+ return [];
52
+ }
50
53
  var previousSessions = currentState.sessions.slice(0, currentSessionIndex);
51
- var childHistory = (_currentSession$child = currentSession === null || currentSession === void 0 ? void 0 : currentSession.childHistory) !== null && _currentSession$child !== void 0 ? _currentSession$child : [];
54
+ // Only include sessions in the same history group (same historyKey reference)
55
+ var previousSessionsInGroup = previousSessions.filter(function (session) {
56
+ return session.historyKey === currentSession.historyKey;
57
+ });
58
+ var childHistory = (_currentSession$child = currentSession.childHistory) !== null && _currentSession$child !== void 0 ? _currentSession$child : [];
52
59
  var childItems = _toConsumableArray(childHistory).reverse().map(function (entry) {
53
60
  return {
54
61
  title: entry.title,
@@ -59,11 +66,11 @@ function createStore() {
59
66
  };
60
67
  });
61
68
 
62
- // Previous sessions: list each session's current child then its child history (so all travelled entries appear)
69
+ // Previous sessions (same group): list each session's current child then its child history
63
70
  var previousSessionItems = [];
64
71
  var _loop = function _loop() {
65
72
  var _session$childHistory;
66
- var session = previousSessions[i];
73
+ var session = previousSessionsInGroup[i];
67
74
  var mainTitle = session.title;
68
75
  var mainFlyoutId = session.mainFlyoutId;
69
76
  var history = (_session$childHistory = session.childHistory) !== null && _session$childHistory !== void 0 ? _session$childHistory : [];
@@ -101,7 +108,7 @@ function createStore() {
101
108
  });
102
109
  }
103
110
  };
104
- for (var i = previousSessions.length - 1; i >= 0; i--) {
111
+ for (var i = previousSessionsInGroup.length - 1; i >= 0; i--) {
105
112
  _loop();
106
113
  }
107
114
  return [].concat(_toConsumableArray(childItems), previousSessionItems);
@@ -140,8 +147,8 @@ function createStore() {
140
147
  subscribe: subscribe,
141
148
  subscribeToEvents: subscribeToEvents,
142
149
  dispatch: dispatch,
143
- addFlyout: function addFlyout(flyoutId, title, level, size, iconType, minWidth) {
144
- return dispatch(addFlyoutAction(flyoutId, title, level, size, iconType, minWidth));
150
+ addFlyout: function addFlyout(flyoutId, title, level, size, historyKey, iconType, minWidth) {
151
+ return dispatch(addFlyoutAction(flyoutId, title, level, size, historyKey, iconType, minWidth));
145
152
  },
146
153
  closeFlyout: function closeFlyout(flyoutId) {
147
154
  return dispatch(closeFlyoutAction(flyoutId));
@@ -18,6 +18,7 @@ import markdown from 'remark-parse-no-trim';
18
18
  import emoji from 'remark-emoji';
19
19
  import breaks from 'remark-breaks';
20
20
  import highlight from '../remark/remark_prismjs';
21
+ import intrawordUnderscore from '../remark/remark_intraword_underscore';
21
22
  import * as MarkdownTooltip from '../markdown_tooltip';
22
23
  import * as MarkdownCheckbox from '../markdown_checkbox';
23
24
  import { euiMarkdownLinkValidator, DEFAULT_OPTIONS as LINK_VALIDATOR_DEFAULTS } from '../markdown_link_validator';
@@ -34,7 +35,7 @@ export var getDefaultEuiMarkdownParsingPlugins = function getDefaultEuiMarkdownP
34
35
  var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
35
36
  var exclude = _ref.exclude,
36
37
  parsingConfig = _objectWithoutProperties(_ref, _excluded);
37
- var parsingPlugins = [[markdown, {}], [highlight, {}]];
38
+ var parsingPlugins = [[markdown, {}], [highlight, {}], [intrawordUnderscore, {}]];
38
39
  Object.entries(DEFAULT_PARSING_PLUGINS).forEach(function (_ref2) {
39
40
  var _ref3 = _slicedToArray(_ref2, 2),
40
41
  pluginName = _ref3[0],
@@ -0,0 +1,172 @@
1
+ function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; }
2
+ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
3
+ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
4
+ /*
5
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
6
+ * or more contributor license agreements. Licensed under the Elastic License
7
+ * 2.0 and the Server Side Public License, v 1; you may not use this file except
8
+ * in compliance with, at your election, the Elastic License 2.0 or the Server
9
+ * Side Public License, v 1.
10
+ */
11
+
12
+ // Temporary workaround for https://github.com/elastic/eui/issues/9404
13
+ // remark-parse v8 doesn't implement the CommonMark rule that underscore
14
+ // emphasis delimiters flanked by alphanumerics on both sides (intraword)
15
+ // cannot open or close emphasis. This causes identifiers like
16
+ // `ABCD__PineappleCherry__e` to render with bold formatting.
17
+ // This plugin walks the parsed AST and reverses incorrectly applied
18
+ // emphasis/strong nodes when both sides are alphanumeric characters.
19
+
20
+ // eslint-disable-next-line import/no-unresolved
21
+
22
+ var isTextNode = function isTextNode(node) {
23
+ return node.type === 'text';
24
+ };
25
+ var isEmphasisOrStrong = function isEmphasisOrStrong(node) {
26
+ return node.type === 'emphasis' || node.type === 'strong';
27
+ };
28
+ var isAlphanumeric = function isAlphanumeric(ch) {
29
+ return /[a-zA-Z0-9]/.test(ch);
30
+ };
31
+
32
+ /**
33
+ * Recursively converts an emphasis/strong node back into plain text
34
+ * with underscore delimiters restored.
35
+ */
36
+ function flattenToText(node) {
37
+ var delimiter = node.type === 'emphasis' ? '_' : '__';
38
+ var inner = '';
39
+ var _iterator = _createForOfIteratorHelper(node.children),
40
+ _step;
41
+ try {
42
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
43
+ var child = _step.value;
44
+ if (isTextNode(child)) {
45
+ inner += child.value;
46
+ } else if (isEmphasisOrStrong(child)) {
47
+ inner += flattenToText(child);
48
+ } else {
49
+ // Contains non-text children (links, images, etc.) — leave emphasis intact
50
+ return delimiter + collectText(node) + delimiter;
51
+ }
52
+ }
53
+ } catch (err) {
54
+ _iterator.e(err);
55
+ } finally {
56
+ _iterator.f();
57
+ }
58
+ return delimiter + inner + delimiter;
59
+ }
60
+ function collectText(node) {
61
+ if (isTextNode(node)) return node.value;
62
+ if ('children' in node) {
63
+ return node.children.map(collectText).join('');
64
+ }
65
+ return '';
66
+ }
67
+ function processParent(parent, source) {
68
+ var modified = false;
69
+ var i = 0;
70
+ while (i < parent.children.length) {
71
+ var child = parent.children[i];
72
+ if (isEmphasisOrStrong(child) && isIntraword(parent, i, source)) {
73
+ var textValue = flattenToText(child);
74
+ var replacement = {
75
+ type: 'text',
76
+ value: textValue
77
+ };
78
+ parent.children.splice(i, 1, replacement);
79
+ modified = true;
80
+ // Don't advance — the replaced node may need to merge with neighbors
81
+ } else {
82
+ if ('children' in child) {
83
+ processParent(child, source);
84
+ }
85
+ i++;
86
+ }
87
+ if (modified) {
88
+ mergeAdjacentText(parent);
89
+ modified = false;
90
+ // After merging, restart scan since indices shifted
91
+ i = 0;
92
+ }
93
+ }
94
+ }
95
+ function getInnerText(node) {
96
+ if (isTextNode(node)) return node.value;
97
+ if ('children' in node) {
98
+ var children = node.children;
99
+ if (children.length > 0) return getInnerText(children[0]);
100
+ }
101
+ return '';
102
+ }
103
+ function getInnerTextEnd(node) {
104
+ if (isTextNode(node)) return node.value;
105
+ if ('children' in node) {
106
+ var children = node.children;
107
+ if (children.length > 0) return getInnerTextEnd(children[children.length - 1]);
108
+ }
109
+ return '';
110
+ }
111
+
112
+ /**
113
+ * Checks whether the emphasis/strong node at `index` within `parent`
114
+ * is an intraword usage of underscore delimiters.
115
+ *
116
+ * A node is intraword when at least one side has an alphanumeric text
117
+ * neighbor AND the inner content on the corresponding delimiter side
118
+ * also touches word characters — proving the underscores are embedded
119
+ * in a word rather than used as formatting.
120
+ */
121
+ function isIntraword(parent, index, source) {
122
+ var _node$position;
123
+ var node = parent.children[index];
124
+
125
+ // Verify the delimiter is `_` (not `*`) by inspecting the source
126
+ if (((_node$position = node.position) === null || _node$position === void 0 || (_node$position = _node$position.start) === null || _node$position === void 0 ? void 0 : _node$position.offset) != null) {
127
+ var ch = source[node.position.start.offset];
128
+ if (ch !== '_') return false;
129
+ }
130
+ var prev = index > 0 ? parent.children[index - 1] : null;
131
+ var next = index < parent.children.length - 1 ? parent.children[index + 1] : null;
132
+ var prevChar = prev != null && isTextNode(prev) && prev.value.length > 0 ? prev.value[prev.value.length - 1] : null;
133
+ var nextChar = next != null && isTextNode(next) && next.value.length > 0 ? next.value[0] : null;
134
+ var prevIsAlpha = prevChar != null && isAlphanumeric(prevChar);
135
+ var nextIsAlpha = nextChar != null && isAlphanumeric(nextChar);
136
+
137
+ // Both sides flanked by alphanumeric — classic intraword (e.g. `foo__bar__baz`)
138
+ if (prevIsAlpha && nextIsAlpha) return true;
139
+
140
+ // One-sided: prev is alpha or underscore, no alpha next — check inner text
141
+ // starts with alpha (e.g. `Lorem__ipsum__` or `Lorem__ipsum_`)
142
+ if (prevIsAlpha || prevChar === '_') {
143
+ var inner = getInnerText(node);
144
+ if (inner.length > 0 && isAlphanumeric(inner[0])) return true;
145
+ }
146
+
147
+ // One-sided: next is alpha or underscore, no alpha prev — check inner text
148
+ // ends with alpha (e.g. `__Lorem__ipsum` or `_Lorem__ipsum`)
149
+ if (nextIsAlpha || nextChar === '_') {
150
+ var _inner = getInnerTextEnd(node);
151
+ if (_inner.length > 0 && isAlphanumeric(_inner[_inner.length - 1])) return true;
152
+ }
153
+ return false;
154
+ }
155
+ function mergeAdjacentText(parent) {
156
+ var i = 0;
157
+ while (i < parent.children.length - 1) {
158
+ if (isTextNode(parent.children[i]) && isTextNode(parent.children[i + 1])) {
159
+ parent.children[i].value += parent.children[i + 1].value;
160
+ parent.children.splice(i + 1, 1);
161
+ } else {
162
+ i++;
163
+ }
164
+ }
165
+ }
166
+ var attacher = function remarkIntrawordUnderscore() {
167
+ return function (tree, file) {
168
+ var source = String(file);
169
+ processParent(tree, source);
170
+ };
171
+ };
172
+ export default attacher;
@@ -1,7 +1,7 @@
1
1
  import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
2
2
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
3
3
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
4
- var _excluded = ["className", "children", "headerZindexLocation", "maskRef"];
4
+ var _excluded = ["className", "children", "headerZindexLocation", "maskRef", "hasAnimation"];
5
5
  /*
6
6
  * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
7
7
  * or more contributor license agreements. Licensed under the Elastic License
@@ -25,6 +25,8 @@ export var EuiOverlayMask = function EuiOverlayMask(_ref) {
25
25
  _ref$headerZindexLoca = _ref.headerZindexLocation,
26
26
  headerZindexLocation = _ref$headerZindexLoca === void 0 ? 'above' : _ref$headerZindexLoca,
27
27
  maskRef = _ref.maskRef,
28
+ _ref$hasAnimation = _ref.hasAnimation,
29
+ hasAnimation = _ref$hasAnimation === void 0 ? true : _ref$hasAnimation,
28
30
  rest = _objectWithoutProperties(_ref, _excluded);
29
31
  var hasRendered = useRef(false);
30
32
  var _useState = useState(null),
@@ -36,7 +38,7 @@ export var EuiOverlayMask = function EuiOverlayMask(_ref) {
36
38
  hasRendered.current = true;
37
39
  }, []);
38
40
  var styles = useEuiMemoizedStyles(euiOverlayMaskStyles);
39
- var cssStyles = cx([styles.euiOverlayMask, styles["".concat(headerZindexLocation, "Header")], hasRendered.current && styles.noAnimation]);
41
+ var cssStyles = cx([styles.euiOverlayMask, styles["".concat(headerZindexLocation, "Header")], (hasRendered.current || !hasAnimation) && styles.noAnimation]);
40
42
  useEffect(function () {
41
43
  if (!overlayMaskNode) return;
42
44
  keysOf(rest).forEach(function (key) {