@elastic/eui 122.1.0 → 123.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/eui-icons.json +94 -94
- package/es/components/datagrid/body/data_grid_body_virtualized.js +119 -36
- package/es/components/datagrid/utils/row_heights.js +4 -1
- package/es/components/flyout/flyout.component.js +129 -55
- package/es/components/flyout/flyout_menu/action_button.js +15 -21
- package/es/components/flyout/flyout_menu/flyout_menu.js +40 -46
- package/es/components/flyout/manager/flyout_managed.js +24 -6
- package/es/components/form/described_form_group/described_form_group.js +17 -4
- package/es/components/tabs/tabbed_content/tabbed_content.js +93 -138
- package/es/components/text_truncate/text_truncate.js +9 -4
- package/eui.d.ts +32 -58
- package/lib/components/datagrid/body/data_grid_body_virtualized.js +119 -36
- package/lib/components/datagrid/utils/row_heights.js +4 -1
- package/lib/components/flyout/flyout.component.js +134 -62
- package/lib/components/flyout/flyout_menu/action_button.js +18 -23
- package/lib/components/flyout/flyout_menu/flyout_menu.js +40 -46
- package/lib/components/flyout/manager/flyout_managed.js +23 -5
- package/lib/components/form/described_form_group/described_form_group.js +19 -3
- package/lib/components/tabs/tabbed_content/tabbed_content.js +98 -142
- package/lib/components/text_truncate/text_truncate.js +9 -4
- package/optimize/es/components/datagrid/body/data_grid_body_virtualized.js +116 -36
- package/optimize/es/components/datagrid/utils/row_heights.js +4 -1
- package/optimize/es/components/flyout/flyout.component.js +124 -50
- package/optimize/es/components/flyout/flyout_menu/action_button.js +14 -21
- package/optimize/es/components/flyout/manager/flyout_managed.js +24 -6
- package/optimize/es/components/form/described_form_group/described_form_group.js +17 -4
- package/optimize/es/components/tabs/tabbed_content/tabbed_content.js +87 -131
- package/optimize/es/components/text_truncate/text_truncate.js +4 -3
- package/optimize/lib/components/datagrid/body/data_grid_body_virtualized.js +116 -36
- package/optimize/lib/components/datagrid/utils/row_heights.js +4 -1
- package/optimize/lib/components/flyout/flyout.component.js +123 -49
- package/optimize/lib/components/flyout/flyout_menu/action_button.js +14 -22
- package/optimize/lib/components/flyout/manager/flyout_managed.js +23 -5
- package/optimize/lib/components/form/described_form_group/described_form_group.js +19 -3
- package/optimize/lib/components/tabs/tabbed_content/tabbed_content.js +87 -131
- package/optimize/lib/components/text_truncate/text_truncate.js +4 -3
- package/package.json +2 -2
- package/test-env/components/datagrid/body/data_grid_body_virtualized.js +119 -36
- package/test-env/components/datagrid/utils/row_heights.js +4 -1
- package/test-env/components/flyout/flyout.component.js +123 -49
- package/test-env/components/flyout/flyout_menu/action_button.js +14 -22
- package/test-env/components/flyout/flyout_menu/flyout_menu.js +40 -46
- package/test-env/components/flyout/manager/flyout_managed.js +23 -5
- package/test-env/components/form/described_form_group/described_form_group.js +19 -3
- package/test-env/components/tabs/tabbed_content/tabbed_content.js +88 -132
- package/test-env/components/text_truncate/text_truncate.js +9 -4
|
@@ -7,10 +7,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
});
|
|
8
8
|
exports.EuiFlyoutComponent = void 0;
|
|
9
9
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
10
|
-
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
11
10
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
12
11
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
13
12
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
13
|
+
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
14
14
|
var _react = _interopRequireWildcard(require("react"));
|
|
15
15
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
16
16
|
var _services = require("../../services");
|
|
@@ -61,6 +61,52 @@ var resolveContainer = function resolveContainer(raw) {
|
|
|
61
61
|
if (typeof HTMLElement === 'undefined') return null;
|
|
62
62
|
return raw instanceof HTMLElement ? raw : null;
|
|
63
63
|
};
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Per-target push-flyout offset bookkeeping, shared across every flyout React root (they all
|
|
67
|
+
* render from this one module). Keyed by the element the offset is applied to — a `container` or
|
|
68
|
+
* `document.body` — so flyouts targeting different elements never contend.
|
|
69
|
+
*
|
|
70
|
+
* Instead of a single owner per side, every currently-pushed flyout records its width as a
|
|
71
|
+
* contribution and the applied offset is derived from the set (the widest contribution). Closing,
|
|
72
|
+
* resizing, or backgrounding any one flyout just updates its own entry, so the result no longer
|
|
73
|
+
* depends on open/close order or on cross-root effect ordering. The target's base (pre-flyout)
|
|
74
|
+
* inline padding is captured when the first contribution arrives and restored when the last one
|
|
75
|
+
* leaves. See https://github.com/elastic/eui/issues/9788.
|
|
76
|
+
*/
|
|
77
|
+
|
|
78
|
+
var euiPushPaddingRegistry = new WeakMap();
|
|
79
|
+
var euiSideStyleKey = function euiSideStyleKey(side) {
|
|
80
|
+
return side === 'left' ? 'paddingInlineStart' : 'paddingInlineEnd';
|
|
81
|
+
};
|
|
82
|
+
var euiSideCssVarKey = function euiSideCssVarKey(side) {
|
|
83
|
+
return side === 'left' ? '--euiPushFlyoutOffsetInlineStart' : '--euiPushFlyoutOffsetInlineEnd';
|
|
84
|
+
};
|
|
85
|
+
var euiGetPushPaddingSideState = function euiGetPushPaddingSideState(target, side) {
|
|
86
|
+
var state = euiPushPaddingRegistry.get(target);
|
|
87
|
+
if (!state) {
|
|
88
|
+
state = {
|
|
89
|
+
left: {
|
|
90
|
+
base: '',
|
|
91
|
+
contributions: new Map()
|
|
92
|
+
},
|
|
93
|
+
right: {
|
|
94
|
+
base: '',
|
|
95
|
+
contributions: new Map()
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
euiPushPaddingRegistry.set(target, state);
|
|
99
|
+
}
|
|
100
|
+
return state[side];
|
|
101
|
+
};
|
|
102
|
+
var euiMaxContribution = function euiMaxContribution(contributions) {
|
|
103
|
+
var filter = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : function () {
|
|
104
|
+
return true;
|
|
105
|
+
};
|
|
106
|
+
return Math.max.apply(Math, [0].concat((0, _toConsumableArray2.default)(Array.from(contributions.values(), function (contribution) {
|
|
107
|
+
return filter(contribution) ? contribution.width : 0;
|
|
108
|
+
}))));
|
|
109
|
+
};
|
|
64
110
|
var defaultElement = 'div';
|
|
65
111
|
var EuiFlyoutComponent = exports.EuiFlyoutComponent = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
66
112
|
var _maskProps$headerZind, _managerSessions, _managerState$layoutM, _managerState$current, _managerState$flyouts, _managerState$pushPad;
|
|
@@ -115,8 +161,6 @@ var EuiFlyoutComponent = exports.EuiFlyoutComponent = /*#__PURE__*/(0, _react.fo
|
|
|
115
161
|
var container = resolveContainer(containerProp);
|
|
116
162
|
var hasAnimationDefault = type === 'overlay';
|
|
117
163
|
var hasAnimation = _hasAnimation !== null && _hasAnimation !== void 0 ? _hasAnimation : hasAnimationDefault;
|
|
118
|
-
var _useEuiThemeCSSVariab = (0, _services.useEuiThemeCSSVariables)(),
|
|
119
|
-
setGlobalCSSVariables = _useEuiThemeCSSVariab.setGlobalCSSVariables;
|
|
120
164
|
var Element = as || defaultElement;
|
|
121
165
|
var maskRef = (0, _react.useRef)(null);
|
|
122
166
|
|
|
@@ -133,10 +177,6 @@ var EuiFlyoutComponent = exports.EuiFlyoutComponent = /*#__PURE__*/(0, _react.fo
|
|
|
133
177
|
pushMinBreakpoint: pushMinBreakpoint,
|
|
134
178
|
containerWidth: containerReferenceWidth
|
|
135
179
|
});
|
|
136
|
-
// When no explicit container is provided, push padding targets
|
|
137
|
-
// document.body and global push-offset CSS vars are set. When a
|
|
138
|
-
// container is provided, only that element receives padding.
|
|
139
|
-
var shouldSetGlobalPushVars = container == null;
|
|
140
180
|
if ('container' in props && ('maskProps' in props || 'includeFixedHeadersInFocusTrap' in props) && process.env.NODE_ENV === 'development') {
|
|
141
181
|
if ('maskProps' in props) {
|
|
142
182
|
console.warn('EuiFlyout: `maskProps` is deprecated. Prefer using the `container` prop to scope flyouts.');
|
|
@@ -207,22 +247,33 @@ var EuiFlyoutComponent = exports.EuiFlyoutComponent = /*#__PURE__*/(0, _react.fo
|
|
|
207
247
|
}
|
|
208
248
|
}, [isInManagedContext, flyoutId]);
|
|
209
249
|
|
|
210
|
-
// Derive flyout identity and sibling info from the
|
|
250
|
+
// Derive flyout identity and sibling info from the session this flyout
|
|
251
|
+
// belongs to. Not the current (top-most) session: a newly opened main
|
|
252
|
+
// renders once before it registers its own session, and a backgrounded
|
|
253
|
+
// main is not in the current session at all. Reading the current session
|
|
254
|
+
// in those cases would treat the other session's main as this flyout's
|
|
255
|
+
// sibling and clamp the resizable width against it.
|
|
256
|
+
var ownSession = (0, _react.useMemo)(function () {
|
|
257
|
+
var _managerSessions$find;
|
|
258
|
+
return (_managerSessions$find = managerSessions === null || managerSessions === void 0 ? void 0 : managerSessions.find(function (session) {
|
|
259
|
+
return session.mainFlyoutId === flyoutId || session.childFlyoutId === flyoutId;
|
|
260
|
+
})) !== null && _managerSessions$find !== void 0 ? _managerSessions$find : null;
|
|
261
|
+
}, [managerSessions, flyoutId]);
|
|
211
262
|
var flyoutIdentity = (0, _react.useMemo)(function () {
|
|
212
|
-
if (!flyoutId || !
|
|
263
|
+
if (!flyoutId || !ownSession) {
|
|
213
264
|
return {
|
|
214
265
|
isMainFlyout: false,
|
|
215
266
|
siblingFlyoutId: null,
|
|
216
267
|
hasValidSession: false
|
|
217
268
|
};
|
|
218
269
|
}
|
|
219
|
-
var siblingFlyoutId =
|
|
270
|
+
var siblingFlyoutId = ownSession.mainFlyoutId === flyoutId ? ownSession.childFlyoutId : ownSession.mainFlyoutId;
|
|
220
271
|
return {
|
|
221
|
-
isMainFlyout:
|
|
272
|
+
isMainFlyout: ownSession.mainFlyoutId === flyoutId,
|
|
222
273
|
siblingFlyoutId: siblingFlyoutId,
|
|
223
274
|
hasValidSession: true
|
|
224
275
|
};
|
|
225
|
-
}, [flyoutId,
|
|
276
|
+
}, [flyoutId, ownSession]);
|
|
226
277
|
|
|
227
278
|
// Destructure for easier use
|
|
228
279
|
var siblingFlyoutId = flyoutIdentity.siblingFlyoutId,
|
|
@@ -303,17 +354,24 @@ var EuiFlyoutComponent = exports.EuiFlyoutComponent = /*#__PURE__*/(0, _react.fo
|
|
|
303
354
|
// the document element so that the child (fill) flyout can track it
|
|
304
355
|
// synchronously during drag resize, avoiding the 1-frame lag that
|
|
305
356
|
// results from the async ResizeObserver → manager-state pipeline.
|
|
357
|
+
// Only the active session's main publishes: a backgrounded main keeps its
|
|
358
|
+
// `isMainFlyout` role but must not leave its width behind for the new
|
|
359
|
+
// session's child to read.
|
|
306
360
|
(0, _react.useLayoutEffect)(function () {
|
|
307
|
-
if (!isMainFlyout) return;
|
|
361
|
+
if (!isMainFlyout || !isActiveManagedFlyout) return;
|
|
308
362
|
|
|
309
363
|
// Only set when we have a computed percentage (during active resize)
|
|
310
|
-
if (typeof size
|
|
311
|
-
|
|
312
|
-
|
|
364
|
+
if (typeof size !== 'string' || !size.endsWith('%')) return;
|
|
365
|
+
var style = document.documentElement.style;
|
|
366
|
+
style.setProperty('--euiFlyoutMainWidth', size);
|
|
313
367
|
return function () {
|
|
314
|
-
|
|
368
|
+
// Flyouts in separate React roots can run this cleanup after another
|
|
369
|
+
// main has already published its own width; leave that value alone.
|
|
370
|
+
if (style.getPropertyValue('--euiFlyoutMainWidth') === size) {
|
|
371
|
+
style.removeProperty('--euiFlyoutMainWidth');
|
|
372
|
+
}
|
|
315
373
|
};
|
|
316
|
-
}, [isMainFlyout, size]);
|
|
374
|
+
}, [isMainFlyout, isActiveManagedFlyout, size]);
|
|
317
375
|
|
|
318
376
|
/**
|
|
319
377
|
* Setting up the refs on the actual flyout element in order to
|
|
@@ -333,45 +391,61 @@ var EuiFlyoutComponent = exports.EuiFlyoutComponent = /*#__PURE__*/(0, _react.fo
|
|
|
333
391
|
* Uses useLayoutEffect so padding is applied before child render.
|
|
334
392
|
*/
|
|
335
393
|
(0, _react.useLayoutEffect)(function () {
|
|
336
|
-
if (!isPushed) {
|
|
337
|
-
return;
|
|
338
|
-
}
|
|
339
394
|
var paddingTarget = container !== null && container !== void 0 ? container : document.body;
|
|
340
|
-
var shouldApplyPadding = !isInManagedContext || isActiveManagedFlyout;
|
|
341
|
-
var paddingSide = side === 'left' ? 'paddingInlineStart' : 'paddingInlineEnd';
|
|
342
|
-
var cssVarName = "--euiPushFlyoutOffset".concat(side === 'left' ? 'InlineStart' : 'InlineEnd');
|
|
343
395
|
var managerSide = side === 'left' ? 'left' : 'right';
|
|
396
|
+
var styleKey = euiSideStyleKey(managerSide);
|
|
397
|
+
var state = euiGetPushPaddingSideState(paddingTarget, managerSide);
|
|
344
398
|
|
|
345
|
-
//
|
|
346
|
-
|
|
347
|
-
var
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
399
|
+
// Write the offset derived from all current contributions: the widest pushed flyout on
|
|
400
|
+
// this target.
|
|
401
|
+
var apply = function apply() {
|
|
402
|
+
var total = euiMaxContribution(state.contributions);
|
|
403
|
+
var isPushing = state.contributions.size > 0;
|
|
404
|
+
paddingTarget.style[styleKey] = isPushing ? "".concat(total, "px") : state.base;
|
|
405
|
+
// Without a `container` the offset is also exposed as a global CSS variable. It is
|
|
406
|
+
// written inline on `<html>` rather than through `EuiProvider`, because every React root
|
|
407
|
+
// has its own provider rendering its own `:root` block and the last one inserted would
|
|
408
|
+
// win regardless of which root's flyouts are still open.
|
|
409
|
+
if (container == null) {
|
|
410
|
+
var cssVar = euiSideCssVarKey(managerSide);
|
|
411
|
+
if (isPushing) {
|
|
412
|
+
document.documentElement.style.setProperty(cssVar, "".concat(total, "px"));
|
|
413
|
+
} else {
|
|
414
|
+
document.documentElement.style.removeProperty(cssVar);
|
|
415
|
+
}
|
|
360
416
|
}
|
|
361
|
-
|
|
362
|
-
|
|
417
|
+
// The manager only learns about managed flyouts, so it must not be told about a standalone
|
|
418
|
+
// flyout's width: nothing would ever reset it once that flyout closes.
|
|
419
|
+
if (isInManagedContext) {
|
|
420
|
+
var _flyoutManagerRef$cur5;
|
|
421
|
+
(_flyoutManagerRef$cur5 = flyoutManagerRef.current) === null || _flyoutManagerRef$cur5 === void 0 || _flyoutManagerRef$cur5.setPushPadding(managerSide, euiMaxContribution(state.contributions, function (c) {
|
|
422
|
+
return c.managed;
|
|
423
|
+
}));
|
|
363
424
|
}
|
|
425
|
+
};
|
|
426
|
+
var paddingWidth = layoutMode === _const.LAYOUT_MODE_STACKED && isMainFlyout && _siblingFlyoutWidth ? _siblingFlyoutWidth : width;
|
|
427
|
+
|
|
428
|
+
// A standalone flyout pushes whenever it is in push mode. A managed flyout only pushes while
|
|
429
|
+
// it is the active session's flyout; a backgrounded push flyout (e.g. under a new overlay
|
|
430
|
+
// session) withdraws its contribution so the page is not left pushed for it.
|
|
431
|
+
var shouldPush = isPushed && (!isInManagedContext || isActiveManagedFlyout);
|
|
432
|
+
if (!shouldPush) {
|
|
433
|
+
return;
|
|
364
434
|
}
|
|
435
|
+
if (state.contributions.size === 0) {
|
|
436
|
+
// First pushed flyout on this side: capture the app's own inline padding to restore later.
|
|
437
|
+
state.base = paddingTarget.style[styleKey];
|
|
438
|
+
}
|
|
439
|
+
state.contributions.set(flyoutId, {
|
|
440
|
+
width: paddingWidth,
|
|
441
|
+
managed: isInManagedContext
|
|
442
|
+
});
|
|
443
|
+
apply();
|
|
365
444
|
return function () {
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
setGlobalCSSVariables((0, _defineProperty2.default)({}, cssVarName, null));
|
|
369
|
-
}
|
|
370
|
-
if (isInManagedContext && flyoutManagerRef.current) {
|
|
371
|
-
flyoutManagerRef.current.setPushPadding(managerSide, 0);
|
|
372
|
-
}
|
|
445
|
+
state.contributions.delete(flyoutId);
|
|
446
|
+
apply();
|
|
373
447
|
};
|
|
374
|
-
}, [isPushed, isInManagedContext, isActiveManagedFlyout,
|
|
448
|
+
}, [isPushed, isInManagedContext, isActiveManagedFlyout, side, width, layoutMode, isMainFlyout, _siblingFlyoutWidth, container, flyoutId]);
|
|
375
449
|
|
|
376
450
|
/**
|
|
377
451
|
* This class doesn't actually do anything by EUI, but is nice to add for consumers (JIC)
|
|
@@ -6,10 +6,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.MenuActionButton = void 0;
|
|
8
8
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
9
10
|
var _react = _interopRequireDefault(require("react"));
|
|
10
11
|
var _button = require("../../button");
|
|
11
12
|
var _tool_tip = require("../../tool_tip");
|
|
12
13
|
var _react2 = require("@emotion/react");
|
|
14
|
+
var _excluded = ["toolTipContent", "toolTipProps"];
|
|
13
15
|
/*
|
|
14
16
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
15
17
|
* or more contributor license agreements. Licensed under the Elastic License
|
|
@@ -17,32 +19,22 @@ var _react2 = require("@emotion/react");
|
|
|
17
19
|
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
18
20
|
* Side Public License, v 1.
|
|
19
21
|
*/
|
|
20
|
-
|
|
21
22
|
var MenuActionButton = exports.MenuActionButton = function MenuActionButton(_ref) {
|
|
22
23
|
var action = _ref.action;
|
|
23
|
-
var
|
|
24
|
-
onClick = action.onClick,
|
|
25
|
-
ariaLabel = action['aria-label'],
|
|
26
|
-
toolTipContent = action.toolTipContent,
|
|
24
|
+
var toolTipContent = action.toolTipContent,
|
|
27
25
|
toolTipProps = action.toolTipProps,
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
isDisabled: isDisabled,
|
|
39
|
-
// Keeps the button focusable so tooltip-on-disabled works for keyboard users
|
|
40
|
-
isLoading: isLoading,
|
|
41
|
-
href: href,
|
|
42
|
-
target: target
|
|
43
|
-
};
|
|
26
|
+
buttonProps = (0, _objectWithoutProperties2.default)(action, _excluded);
|
|
27
|
+
var button = (0, _react2.jsx)(_button.EuiButtonIcon, (0, _extends2.default)({}, buttonProps, {
|
|
28
|
+
// The menu bar sets these props itself so every action looks the same.
|
|
29
|
+
// Anything set here also belongs in `EuiFlyoutMenuOwnedActionProps`.
|
|
30
|
+
color: "text",
|
|
31
|
+
size: "xs",
|
|
32
|
+
display: "empty",
|
|
33
|
+
iconSize: "m",
|
|
34
|
+
isSelected: undefined
|
|
35
|
+
}));
|
|
44
36
|
return toolTipContent ? (0, _react2.jsx)(_tool_tip.EuiToolTip, (0, _extends2.default)({
|
|
45
37
|
content: toolTipContent,
|
|
46
38
|
disableScreenReaderOutput: true
|
|
47
|
-
}, toolTipProps),
|
|
39
|
+
}, toolTipProps), button) : button;
|
|
48
40
|
};
|
|
@@ -251,97 +251,91 @@ EuiFlyoutMenu.propTypes = {
|
|
|
251
251
|
/**
|
|
252
252
|
* List of action items rendered at the start (inline-start) of the menu bar.
|
|
253
253
|
*/
|
|
254
|
-
leadingActions: _propTypes.default.arrayOf(_propTypes.default.shape({
|
|
254
|
+
leadingActions: _propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.shape({
|
|
255
255
|
/**
|
|
256
|
-
*
|
|
256
|
+
* Aria label for the action button
|
|
257
257
|
*/
|
|
258
|
-
|
|
258
|
+
"aria-label": _propTypes.default.string.isRequired,
|
|
259
259
|
/**
|
|
260
260
|
* onClick handler for the action button
|
|
261
261
|
*/
|
|
262
262
|
onClick: _propTypes.default.func,
|
|
263
263
|
/**
|
|
264
|
-
*
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
/**
|
|
268
|
-
* Optional tooltip content shown on hover/focus of the action button.
|
|
269
|
-
* When `isDisabled` is `true`, the action uses `aria-disabled` so the tooltip
|
|
270
|
-
* remains reachable via hover/focus (unless overridden via `toolTipProps`).
|
|
264
|
+
* Tooltip text shown on hover or focus.
|
|
265
|
+
* When the action is disabled, also set `hasAriaDisabled`. This keeps
|
|
266
|
+
* the button focusable so the tooltip remains reachable.
|
|
271
267
|
*/
|
|
272
268
|
toolTipContent: _propTypes.default.node,
|
|
273
269
|
/**
|
|
274
270
|
* Optional props to pass to the underlying {@link EuiToolTip}.
|
|
275
271
|
* Only used when `toolTipContent` is also provided.
|
|
276
272
|
*/
|
|
277
|
-
toolTipProps: _propTypes.default.any
|
|
273
|
+
toolTipProps: _propTypes.default.any
|
|
274
|
+
}).isRequired, _propTypes.default.shape({
|
|
278
275
|
/**
|
|
279
|
-
*
|
|
280
|
-
* the action is unavailable.
|
|
276
|
+
* Aria label for the action button
|
|
281
277
|
*/
|
|
282
|
-
|
|
278
|
+
"aria-label": _propTypes.default.string.isRequired,
|
|
283
279
|
/**
|
|
284
|
-
*
|
|
280
|
+
* onClick handler for the action button
|
|
285
281
|
*/
|
|
286
|
-
|
|
282
|
+
onClick: _propTypes.default.func,
|
|
287
283
|
/**
|
|
288
|
-
*
|
|
289
|
-
*
|
|
290
|
-
*
|
|
284
|
+
* Tooltip text shown on hover or focus.
|
|
285
|
+
* When the action is disabled, also set `hasAriaDisabled`. This keeps
|
|
286
|
+
* the button focusable so the tooltip remains reachable.
|
|
291
287
|
*/
|
|
292
|
-
|
|
288
|
+
toolTipContent: _propTypes.default.node,
|
|
293
289
|
/**
|
|
294
|
-
*
|
|
290
|
+
* Optional props to pass to the underlying {@link EuiToolTip}.
|
|
291
|
+
* Only used when `toolTipContent` is also provided.
|
|
295
292
|
*/
|
|
296
|
-
|
|
297
|
-
}).isRequired),
|
|
293
|
+
toolTipProps: _propTypes.default.any
|
|
294
|
+
}).isRequired]).isRequired),
|
|
298
295
|
/**
|
|
299
296
|
* List of action items rendered at the end (inline-end) of the menu bar.
|
|
300
297
|
*/
|
|
301
|
-
trailingActions: _propTypes.default.arrayOf(_propTypes.default.shape({
|
|
298
|
+
trailingActions: _propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.shape({
|
|
302
299
|
/**
|
|
303
|
-
*
|
|
300
|
+
* Aria label for the action button
|
|
304
301
|
*/
|
|
305
|
-
|
|
302
|
+
"aria-label": _propTypes.default.string.isRequired,
|
|
306
303
|
/**
|
|
307
304
|
* onClick handler for the action button
|
|
308
305
|
*/
|
|
309
306
|
onClick: _propTypes.default.func,
|
|
310
307
|
/**
|
|
311
|
-
*
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
/**
|
|
315
|
-
* Optional tooltip content shown on hover/focus of the action button.
|
|
316
|
-
* When `isDisabled` is `true`, the action uses `aria-disabled` so the tooltip
|
|
317
|
-
* remains reachable via hover/focus (unless overridden via `toolTipProps`).
|
|
308
|
+
* Tooltip text shown on hover or focus.
|
|
309
|
+
* When the action is disabled, also set `hasAriaDisabled`. This keeps
|
|
310
|
+
* the button focusable so the tooltip remains reachable.
|
|
318
311
|
*/
|
|
319
312
|
toolTipContent: _propTypes.default.node,
|
|
320
313
|
/**
|
|
321
314
|
* Optional props to pass to the underlying {@link EuiToolTip}.
|
|
322
315
|
* Only used when `toolTipContent` is also provided.
|
|
323
316
|
*/
|
|
324
|
-
toolTipProps: _propTypes.default.any
|
|
317
|
+
toolTipProps: _propTypes.default.any
|
|
318
|
+
}).isRequired, _propTypes.default.shape({
|
|
325
319
|
/**
|
|
326
|
-
*
|
|
327
|
-
* the action is unavailable.
|
|
320
|
+
* Aria label for the action button
|
|
328
321
|
*/
|
|
329
|
-
|
|
322
|
+
"aria-label": _propTypes.default.string.isRequired,
|
|
330
323
|
/**
|
|
331
|
-
*
|
|
324
|
+
* onClick handler for the action button
|
|
332
325
|
*/
|
|
333
|
-
|
|
326
|
+
onClick: _propTypes.default.func,
|
|
334
327
|
/**
|
|
335
|
-
*
|
|
336
|
-
*
|
|
337
|
-
*
|
|
328
|
+
* Tooltip text shown on hover or focus.
|
|
329
|
+
* When the action is disabled, also set `hasAriaDisabled`. This keeps
|
|
330
|
+
* the button focusable so the tooltip remains reachable.
|
|
338
331
|
*/
|
|
339
|
-
|
|
332
|
+
toolTipContent: _propTypes.default.node,
|
|
340
333
|
/**
|
|
341
|
-
*
|
|
334
|
+
* Optional props to pass to the underlying {@link EuiToolTip}.
|
|
335
|
+
* Only used when `toolTipContent` is also provided.
|
|
342
336
|
*/
|
|
343
|
-
|
|
344
|
-
}).isRequired),
|
|
337
|
+
toolTipProps: _propTypes.default.any
|
|
338
|
+
}).isRequired]).isRequired),
|
|
345
339
|
/**
|
|
346
340
|
* List of custom action items for the menu component
|
|
347
341
|
* @deprecated Use `trailingActions` instead. If both are supplied, `trailingActions` takes precedence.
|
|
@@ -173,6 +173,24 @@ var EuiManagedFlyout = exports.EuiManagedFlyout = /*#__PURE__*/(0, _react.forwar
|
|
|
173
173
|
flyoutExistsInManagerRef.current = flyoutExistsInManager;
|
|
174
174
|
}, [flyoutExistsInManager]);
|
|
175
175
|
|
|
176
|
+
// Closing a main closes its whole history group via `closeAllFlyouts`, which always targets
|
|
177
|
+
// the *current* session. A main that has been backgrounded by a newer session (e.g. closed
|
|
178
|
+
// programmatically from another React root) must only remove its own session, otherwise it
|
|
179
|
+
// tears down the foreground session and leaves its own stale session behind.
|
|
180
|
+
var closeOwnFlyouts = (0, _react.useCallback)(function () {
|
|
181
|
+
if (level !== _const.LEVEL_MAIN) {
|
|
182
|
+
closeFlyout(flyoutId);
|
|
183
|
+
return;
|
|
184
|
+
}
|
|
185
|
+
var _getFlyoutManagerStor = (0, _store.getFlyoutManagerStore)().getState(),
|
|
186
|
+
sessions = _getFlyoutManagerStor.sessions;
|
|
187
|
+
var ownSession = sessions.find(function (session) {
|
|
188
|
+
return session.mainFlyoutId === flyoutId;
|
|
189
|
+
});
|
|
190
|
+
var isBackgroundedMain = ownSession != null && ownSession !== sessions[sessions.length - 1];
|
|
191
|
+
isBackgroundedMain ? closeFlyout(flyoutId) : closeAllFlyouts();
|
|
192
|
+
}, [level, flyoutId, closeFlyout, closeAllFlyouts]);
|
|
193
|
+
|
|
176
194
|
// Register with flyout manager context when open, remove when closed
|
|
177
195
|
// Using useLayoutEffect to run synchronously before DOM updates
|
|
178
196
|
(0, _react.useLayoutEffect)(function () {
|
|
@@ -184,7 +202,7 @@ var EuiManagedFlyout = exports.EuiManagedFlyout = /*#__PURE__*/(0, _react.forwar
|
|
|
184
202
|
});
|
|
185
203
|
if (stillInStore) {
|
|
186
204
|
// Normal cleanup (deps changed or explicit close via isOpen=false)
|
|
187
|
-
|
|
205
|
+
closeOwnFlyouts();
|
|
188
206
|
} else if (wasRegisteredRef.current) {
|
|
189
207
|
var _onCloseCallbackRef$c, _store$consumeCloseMe;
|
|
190
208
|
// Removed externally while mounted: forward the store-stamped reason
|
|
@@ -195,7 +213,7 @@ var EuiManagedFlyout = exports.EuiManagedFlyout = /*#__PURE__*/(0, _react.forwar
|
|
|
195
213
|
}
|
|
196
214
|
wasRegisteredRef.current = false;
|
|
197
215
|
};
|
|
198
|
-
}, [flyoutId, title, level, size, minWidth, historyKey, _flyoutMenuProps === null || _flyoutMenuProps === void 0 ? void 0 : _flyoutMenuProps.iconType, addFlyout,
|
|
216
|
+
}, [flyoutId, title, level, size, minWidth, historyKey, _flyoutMenuProps === null || _flyoutMenuProps === void 0 ? void 0 : _flyoutMenuProps.iconType, addFlyout, closeOwnFlyouts]);
|
|
199
217
|
|
|
200
218
|
// Detect when flyout has been removed from manager state (e.g., via Back button)
|
|
201
219
|
// and trigger onClose callback to notify the parent component
|
|
@@ -210,8 +228,8 @@ var EuiManagedFlyout = exports.EuiManagedFlyout = /*#__PURE__*/(0, _react.forwar
|
|
|
210
228
|
// any other removal (e.g. a closeAllFlyouts cascade reaching a backgrounded
|
|
211
229
|
// flyout) defaults to `navigation-cascade`.
|
|
212
230
|
if (wasRegisteredRef.current && !flyoutExistsInManager) {
|
|
213
|
-
var _onCloseCallbackRef$c2,
|
|
214
|
-
(_onCloseCallbackRef$c2 = onCloseCallbackRef.current) === null || _onCloseCallbackRef$c2 === void 0 || _onCloseCallbackRef$c2.call(onCloseCallbackRef, new MouseEvent('navigation'), (
|
|
231
|
+
var _onCloseCallbackRef$c2, _getFlyoutManagerStor2;
|
|
232
|
+
(_onCloseCallbackRef$c2 = onCloseCallbackRef.current) === null || _onCloseCallbackRef$c2 === void 0 || _onCloseCallbackRef$c2.call(onCloseCallbackRef, new MouseEvent('navigation'), (_getFlyoutManagerStor2 = (0, _store.getFlyoutManagerStore)().consumeCloseMeta(flyoutId)) !== null && _getFlyoutManagerStor2 !== void 0 ? _getFlyoutManagerStor2 : {
|
|
215
233
|
reason: 'navigation-cascade'
|
|
216
234
|
});
|
|
217
235
|
wasRegisteredRef.current = false; // Reset to avoid repeated calls
|
|
@@ -248,7 +266,7 @@ var EuiManagedFlyout = exports.EuiManagedFlyout = /*#__PURE__*/(0, _react.forwar
|
|
|
248
266
|
// and ensures cascade close logic runs before DOM cleanup begins
|
|
249
267
|
// Using flushSync to force synchronous state update completion
|
|
250
268
|
(0, _reactDom.flushSync)(function () {
|
|
251
|
-
|
|
269
|
+
closeOwnFlyouts();
|
|
252
270
|
});
|
|
253
271
|
if (onCloseCallbackRef.current) {
|
|
254
272
|
var event = e || new MouseEvent('click');
|