@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
|
};
|
|
@@ -172,6 +172,24 @@ var EuiManagedFlyout = exports.EuiManagedFlyout = /*#__PURE__*/(0, _react.forwar
|
|
|
172
172
|
flyoutExistsInManagerRef.current = flyoutExistsInManager;
|
|
173
173
|
}, [flyoutExistsInManager]);
|
|
174
174
|
|
|
175
|
+
// Closing a main closes its whole history group via `closeAllFlyouts`, which always targets
|
|
176
|
+
// the *current* session. A main that has been backgrounded by a newer session (e.g. closed
|
|
177
|
+
// programmatically from another React root) must only remove its own session, otherwise it
|
|
178
|
+
// tears down the foreground session and leaves its own stale session behind.
|
|
179
|
+
var closeOwnFlyouts = (0, _react.useCallback)(function () {
|
|
180
|
+
if (level !== _const.LEVEL_MAIN) {
|
|
181
|
+
closeFlyout(flyoutId);
|
|
182
|
+
return;
|
|
183
|
+
}
|
|
184
|
+
var _getFlyoutManagerStor = (0, _store.getFlyoutManagerStore)().getState(),
|
|
185
|
+
sessions = _getFlyoutManagerStor.sessions;
|
|
186
|
+
var ownSession = sessions.find(function (session) {
|
|
187
|
+
return session.mainFlyoutId === flyoutId;
|
|
188
|
+
});
|
|
189
|
+
var isBackgroundedMain = ownSession != null && ownSession !== sessions[sessions.length - 1];
|
|
190
|
+
isBackgroundedMain ? closeFlyout(flyoutId) : closeAllFlyouts();
|
|
191
|
+
}, [level, flyoutId, closeFlyout, closeAllFlyouts]);
|
|
192
|
+
|
|
175
193
|
// Register with flyout manager context when open, remove when closed
|
|
176
194
|
// Using useLayoutEffect to run synchronously before DOM updates
|
|
177
195
|
(0, _react.useLayoutEffect)(function () {
|
|
@@ -183,7 +201,7 @@ var EuiManagedFlyout = exports.EuiManagedFlyout = /*#__PURE__*/(0, _react.forwar
|
|
|
183
201
|
});
|
|
184
202
|
if (stillInStore) {
|
|
185
203
|
// Normal cleanup (deps changed or explicit close via isOpen=false)
|
|
186
|
-
|
|
204
|
+
closeOwnFlyouts();
|
|
187
205
|
} else if (wasRegisteredRef.current) {
|
|
188
206
|
var _onCloseCallbackRef$c, _store$consumeCloseMe;
|
|
189
207
|
// Removed externally while mounted: forward the store-stamped reason
|
|
@@ -194,7 +212,7 @@ var EuiManagedFlyout = exports.EuiManagedFlyout = /*#__PURE__*/(0, _react.forwar
|
|
|
194
212
|
}
|
|
195
213
|
wasRegisteredRef.current = false;
|
|
196
214
|
};
|
|
197
|
-
}, [flyoutId, title, level, size, minWidth, historyKey, _flyoutMenuProps === null || _flyoutMenuProps === void 0 ? void 0 : _flyoutMenuProps.iconType, addFlyout,
|
|
215
|
+
}, [flyoutId, title, level, size, minWidth, historyKey, _flyoutMenuProps === null || _flyoutMenuProps === void 0 ? void 0 : _flyoutMenuProps.iconType, addFlyout, closeOwnFlyouts]);
|
|
198
216
|
|
|
199
217
|
// Detect when flyout has been removed from manager state (e.g., via Back button)
|
|
200
218
|
// and trigger onClose callback to notify the parent component
|
|
@@ -209,8 +227,8 @@ var EuiManagedFlyout = exports.EuiManagedFlyout = /*#__PURE__*/(0, _react.forwar
|
|
|
209
227
|
// any other removal (e.g. a closeAllFlyouts cascade reaching a backgrounded
|
|
210
228
|
// flyout) defaults to `navigation-cascade`.
|
|
211
229
|
if (wasRegisteredRef.current && !flyoutExistsInManager) {
|
|
212
|
-
var _onCloseCallbackRef$c2,
|
|
213
|
-
(_onCloseCallbackRef$c2 = onCloseCallbackRef.current) === null || _onCloseCallbackRef$c2 === void 0 || _onCloseCallbackRef$c2.call(onCloseCallbackRef, new MouseEvent('navigation'), (
|
|
230
|
+
var _onCloseCallbackRef$c2, _getFlyoutManagerStor2;
|
|
231
|
+
(_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 : {
|
|
214
232
|
reason: 'navigation-cascade'
|
|
215
233
|
});
|
|
216
234
|
wasRegisteredRef.current = false; // Reset to avoid repeated calls
|
|
@@ -247,7 +265,7 @@ var EuiManagedFlyout = exports.EuiManagedFlyout = /*#__PURE__*/(0, _react.forwar
|
|
|
247
265
|
// and ensures cascade close logic runs before DOM cleanup begins
|
|
248
266
|
// Using flushSync to force synchronous state update completion
|
|
249
267
|
(0, _reactDom.flushSync)(function () {
|
|
250
|
-
|
|
268
|
+
closeOwnFlyouts();
|
|
251
269
|
});
|
|
252
270
|
if (onCloseCallbackRef.current) {
|
|
253
271
|
var event = e || new MouseEvent('click');
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
4
5
|
Object.defineProperty(exports, "__esModule", {
|
|
5
6
|
value: true
|
|
6
7
|
});
|
|
7
8
|
exports.EuiDescribedFormGroup = void 0;
|
|
8
9
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
10
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
10
|
-
var _react =
|
|
11
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
11
12
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
12
13
|
var _services = require("../../../services");
|
|
13
14
|
var _title = require("../../title");
|
|
@@ -16,7 +17,7 @@ var _flex = require("../../flex");
|
|
|
16
17
|
var _eui_form_context = require("../eui_form_context");
|
|
17
18
|
var _described_form_group = require("./described_form_group.styles");
|
|
18
19
|
var _react2 = require("@emotion/react");
|
|
19
|
-
var _excluded = ["children", "className", "gutterSize", "fullWidth", "ratio", "titleSize", "title", "description", "descriptionFlexItemProps", "fieldFlexItemProps"];
|
|
20
|
+
var _excluded = ["children", "className", "gutterSize", "fullWidth", "ratio", "titleSize", "title", "description", "descriptionFlexItemProps", "fieldFlexItemProps", "aria-label", "aria-labelledby"];
|
|
20
21
|
/*
|
|
21
22
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
22
23
|
* or more contributor license agreements. Licensed under the Elastic License
|
|
@@ -24,6 +25,8 @@ var _excluded = ["children", "className", "gutterSize", "fullWidth", "ratio", "t
|
|
|
24
25
|
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
25
26
|
* Side Public License, v 1.
|
|
26
27
|
*/
|
|
28
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
29
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
27
30
|
/**
|
|
28
31
|
* @see {@link https://eui.elastic.co/docs/components/forms/layouts/described-groups/|EuiDescribedFormGroup documentation}
|
|
29
32
|
*/
|
|
@@ -44,7 +47,15 @@ var EuiDescribedFormGroup = exports.EuiDescribedFormGroup = function EuiDescribe
|
|
|
44
47
|
description = props.description,
|
|
45
48
|
descriptionFlexItemProps = props.descriptionFlexItemProps,
|
|
46
49
|
fieldFlexItemProps = props.fieldFlexItemProps,
|
|
50
|
+
ariaLabel = props['aria-label'],
|
|
51
|
+
ariaLabelledby = props['aria-labelledby'],
|
|
47
52
|
rest = (0, _objectWithoutProperties2.default)(props, _excluded);
|
|
53
|
+
var generatedTitleId = (0, _services.useGeneratedHtmlId)({
|
|
54
|
+
prefix: 'euiDescribedFormGroupTitle'
|
|
55
|
+
});
|
|
56
|
+
// Reuse an `id` already set on the title element, so that consumers
|
|
57
|
+
// referencing it from their own `aria-labelledby` keep working
|
|
58
|
+
var titleId = /*#__PURE__*/(0, _react.isValidElement)(title) && title.props.id || generatedTitleId;
|
|
48
59
|
var styles = (0, _services.useEuiMemoizedStyles)(_described_form_group.euiDescribedFormGroupStyles);
|
|
49
60
|
var cssStyles = [styles.euiDescribedFormGroup, fullWidth ? styles.fullWidth : styles.formWidth];
|
|
50
61
|
var descriptionColumnStyles = [styles.euiDescribedFormGroup__descriptionColumn, descriptionFlexItemProps === null || descriptionFlexItemProps === void 0 ? void 0 : descriptionFlexItemProps.css];
|
|
@@ -78,7 +89,11 @@ var EuiDescribedFormGroup = exports.EuiDescribedFormGroup = function EuiDescribe
|
|
|
78
89
|
break;
|
|
79
90
|
}
|
|
80
91
|
return (0, _react2.jsx)(_flex.EuiFlexGroup, (0, _extends2.default)({
|
|
81
|
-
role: "group"
|
|
92
|
+
role: "group",
|
|
93
|
+
"aria-label": ariaLabel
|
|
94
|
+
// The title names the group, unless the consumer provides their own label
|
|
95
|
+
,
|
|
96
|
+
"aria-labelledby": ariaLabelledby !== null && ariaLabelledby !== void 0 ? ariaLabelledby : ariaLabel == null ? titleId : undefined
|
|
82
97
|
}, rest, {
|
|
83
98
|
css: cssStyles,
|
|
84
99
|
className: classes,
|
|
@@ -90,6 +105,7 @@ var EuiDescribedFormGroup = exports.EuiDescribedFormGroup = function EuiDescribe
|
|
|
90
105
|
css: descriptionColumnStyles,
|
|
91
106
|
className: (0, _classnames.default)('euiDescribedFormGroup__descriptionColumn', descriptionFlexItemProps === null || descriptionFlexItemProps === void 0 ? void 0 : descriptionFlexItemProps.className)
|
|
92
107
|
}), (0, _react2.jsx)(_title.EuiTitle, {
|
|
108
|
+
id: titleId,
|
|
93
109
|
size: titleSize,
|
|
94
110
|
className: "euiDescribedFormGroup__title"
|
|
95
111
|
}, title), renderedDescription), (0, _react2.jsx)(_flex.EuiFlexItem, (0, _extends2.default)({
|