@elastic/eui 106.0.0 → 106.1.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/es/components/collapsible_nav/collapsible_nav.js +4 -0
- package/es/components/flyout/flyout.js +85 -70
- package/es/components/flyout/flyout_child.js +13 -4
- package/es/components/flyout/flyout_child_manager.js +3 -1
- package/es/components/flyout/sessions/flyout_provider.js +4 -4
- package/es/components/flyout/sessions/flyout_reducer.js +11 -12
- package/es/components/flyout/sessions/use_eui_flyout.js +4 -27
- package/es/components/form/range/range_input.styles.js +5 -3
- package/es/components/provider/component_defaults/component_defaults.js +12 -2
- package/es/components/tree_view/tree_view.js +4 -0
- package/es/services/theme/provider.js +7 -1
- package/eui.d.ts +5931 -5928
- package/i18ntokens.json +508 -508
- package/lib/components/collapsible_nav/collapsible_nav.js +4 -0
- package/lib/components/flyout/flyout.js +84 -69
- package/lib/components/flyout/flyout_child.js +11 -2
- package/lib/components/flyout/flyout_child_manager.js +3 -1
- package/lib/components/flyout/sessions/flyout_provider.js +3 -3
- package/lib/components/flyout/sessions/flyout_reducer.js +11 -12
- package/lib/components/flyout/sessions/use_eui_flyout.js +4 -26
- package/lib/components/form/range/range_input.styles.js +5 -3
- package/lib/components/provider/component_defaults/component_defaults.js +12 -2
- package/lib/components/tree_view/tree_view.js +4 -0
- package/lib/services/theme/provider.js +7 -1
- package/optimize/es/components/flyout/flyout.js +85 -70
- package/optimize/es/components/flyout/flyout_child.js +13 -4
- package/optimize/es/components/flyout/flyout_child_manager.js +3 -1
- package/optimize/es/components/flyout/sessions/flyout_provider.js +4 -4
- package/optimize/es/components/flyout/sessions/flyout_reducer.js +11 -12
- package/optimize/es/components/flyout/sessions/use_eui_flyout.js +4 -27
- package/optimize/es/components/form/range/range_input.styles.js +5 -3
- package/optimize/es/components/tree_view/tree_view.js +1 -0
- package/optimize/es/services/theme/provider.js +7 -1
- package/optimize/lib/components/flyout/flyout.js +84 -69
- package/optimize/lib/components/flyout/flyout_child.js +11 -2
- package/optimize/lib/components/flyout/flyout_child_manager.js +3 -1
- package/optimize/lib/components/flyout/sessions/flyout_provider.js +3 -3
- package/optimize/lib/components/flyout/sessions/flyout_reducer.js +11 -12
- package/optimize/lib/components/flyout/sessions/use_eui_flyout.js +4 -26
- package/optimize/lib/components/form/range/range_input.styles.js +5 -3
- package/optimize/lib/components/tree_view/tree_view.js +1 -0
- package/optimize/lib/services/theme/provider.js +7 -1
- package/package.json +9 -11
- package/test-env/components/collapsible_nav/collapsible_nav.js +4 -0
- package/test-env/components/flyout/flyout_child.js +11 -2
- package/test-env/components/flyout/flyout_child_manager.js +3 -1
- package/test-env/components/flyout/sessions/flyout_provider.js +3 -3
- package/test-env/components/flyout/sessions/flyout_reducer.js +11 -12
- package/test-env/components/flyout/sessions/use_eui_flyout.js +4 -26
- package/test-env/components/form/range/range_input.styles.js +5 -3
- package/test-env/components/provider/component_defaults/component_defaults.js +12 -2
- package/test-env/components/tree_view/tree_view.js +4 -0
- package/test-env/services/theme/provider.js +7 -1
|
@@ -225,6 +225,10 @@ EuiCollapsibleNav.propTypes = {
|
|
|
225
225
|
* Set this to `false` if you need to disable this behavior for a specific reason.
|
|
226
226
|
*/
|
|
227
227
|
includeFixedHeadersInFocusTrap: _propTypes.default.bool,
|
|
228
|
+
/**
|
|
229
|
+
* Specify additional css selectors to include in the focus trap.
|
|
230
|
+
*/
|
|
231
|
+
includeSelectorInFocusTrap: _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.string.isRequired).isRequired, _propTypes.default.string.isRequired]),
|
|
228
232
|
/**
|
|
229
233
|
* ReactNode to render as this component's content
|
|
230
234
|
*/
|
|
@@ -20,8 +20,9 @@ var _flyout_close_button = require("./_flyout_close_button");
|
|
|
20
20
|
var _flyout = require("./flyout.styles");
|
|
21
21
|
var _flyout_child = require("./flyout_child");
|
|
22
22
|
var _flyout_child_manager = require("./flyout_child_manager");
|
|
23
|
+
var _component_defaults = require("../provider/component_defaults");
|
|
23
24
|
var _react2 = require("@emotion/react");
|
|
24
|
-
var _excluded = ["className", "children", "as", "hideCloseButton", "closeButtonProps", "closeButtonPosition", "onClose", "ownFocus", "side", "size", "paddingSize", "maxWidth", "style", "maskProps", "type", "outsideClickCloses", "pushMinBreakpoint", "pushAnimation", "focusTrapProps", "includeFixedHeadersInFocusTrap", "aria-describedby"];
|
|
25
|
+
var _excluded = ["className", "children", "as", "hideCloseButton", "closeButtonProps", "closeButtonPosition", "onClose", "ownFocus", "side", "size", "paddingSize", "maxWidth", "style", "maskProps", "type", "outsideClickCloses", "pushMinBreakpoint", "pushAnimation", "focusTrapProps", "includeFixedHeadersInFocusTrap", "includeSelectorInFocusTrap", "aria-describedby"];
|
|
25
26
|
/*
|
|
26
27
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
27
28
|
* or more contributor license agreements. Licensed under the Elastic License
|
|
@@ -62,40 +63,44 @@ function isEuiFlyoutSizeNamed(value) {
|
|
|
62
63
|
}
|
|
63
64
|
var PADDING_SIZES = exports.PADDING_SIZES = ['none', 's', 'm', 'l'];
|
|
64
65
|
var defaultElement = 'div';
|
|
65
|
-
var EuiFlyout = exports.EuiFlyout = /*#__PURE__*/(0, _react.forwardRef)(function (
|
|
66
|
-
var
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
66
|
+
var EuiFlyout = exports.EuiFlyout = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
67
|
+
var _usePropsWithComponen = (0, _component_defaults.usePropsWithComponentDefaults)('EuiFlyout', props),
|
|
68
|
+
className = _usePropsWithComponen.className,
|
|
69
|
+
children = _usePropsWithComponen.children,
|
|
70
|
+
as = _usePropsWithComponen.as,
|
|
71
|
+
_usePropsWithComponen2 = _usePropsWithComponen.hideCloseButton,
|
|
72
|
+
hideCloseButton = _usePropsWithComponen2 === void 0 ? false : _usePropsWithComponen2,
|
|
73
|
+
closeButtonProps = _usePropsWithComponen.closeButtonProps,
|
|
74
|
+
_usePropsWithComponen3 = _usePropsWithComponen.closeButtonPosition,
|
|
75
|
+
_closeButtonPosition = _usePropsWithComponen3 === void 0 ? 'inside' : _usePropsWithComponen3,
|
|
76
|
+
onClose = _usePropsWithComponen.onClose,
|
|
77
|
+
_usePropsWithComponen4 = _usePropsWithComponen.ownFocus,
|
|
78
|
+
ownFocus = _usePropsWithComponen4 === void 0 ? true : _usePropsWithComponen4,
|
|
79
|
+
_usePropsWithComponen5 = _usePropsWithComponen.side,
|
|
80
|
+
side = _usePropsWithComponen5 === void 0 ? 'right' : _usePropsWithComponen5,
|
|
81
|
+
_usePropsWithComponen6 = _usePropsWithComponen.size,
|
|
82
|
+
size = _usePropsWithComponen6 === void 0 ? 'm' : _usePropsWithComponen6,
|
|
83
|
+
_usePropsWithComponen7 = _usePropsWithComponen.paddingSize,
|
|
84
|
+
paddingSize = _usePropsWithComponen7 === void 0 ? 'l' : _usePropsWithComponen7,
|
|
85
|
+
_usePropsWithComponen8 = _usePropsWithComponen.maxWidth,
|
|
86
|
+
maxWidth = _usePropsWithComponen8 === void 0 ? false : _usePropsWithComponen8,
|
|
87
|
+
style = _usePropsWithComponen.style,
|
|
88
|
+
maskProps = _usePropsWithComponen.maskProps,
|
|
89
|
+
_usePropsWithComponen9 = _usePropsWithComponen.type,
|
|
90
|
+
type = _usePropsWithComponen9 === void 0 ? 'overlay' : _usePropsWithComponen9,
|
|
91
|
+
outsideClickCloses = _usePropsWithComponen.outsideClickCloses,
|
|
92
|
+
_usePropsWithComponen10 = _usePropsWithComponen.pushMinBreakpoint,
|
|
93
|
+
pushMinBreakpoint = _usePropsWithComponen10 === void 0 ? 'l' : _usePropsWithComponen10,
|
|
94
|
+
_usePropsWithComponen11 = _usePropsWithComponen.pushAnimation,
|
|
95
|
+
pushAnimation = _usePropsWithComponen11 === void 0 ? false : _usePropsWithComponen11,
|
|
96
|
+
_focusTrapProps = _usePropsWithComponen.focusTrapProps,
|
|
97
|
+
_usePropsWithComponen12 = _usePropsWithComponen.includeFixedHeadersInFocusTrap,
|
|
98
|
+
includeFixedHeadersInFocusTrap = _usePropsWithComponen12 === void 0 ? true : _usePropsWithComponen12,
|
|
99
|
+
includeSelectorInFocusTrap = _usePropsWithComponen.includeSelectorInFocusTrap,
|
|
100
|
+
_ariaDescribedBy = _usePropsWithComponen['aria-describedby'],
|
|
101
|
+
rest = _objectWithoutProperties(_usePropsWithComponen, _excluded);
|
|
102
|
+
var _useEuiThemeCSSVariab = (0, _services.useEuiThemeCSSVariables)(),
|
|
103
|
+
setGlobalCSSVariables = _useEuiThemeCSSVariab.setGlobalCSSVariables;
|
|
99
104
|
var Element = as || defaultElement;
|
|
100
105
|
var maskRef = (0, _react.useRef)(null);
|
|
101
106
|
|
|
@@ -154,12 +159,17 @@ var EuiFlyout = exports.EuiFlyout = /*#__PURE__*/(0, _react.forwardRef)(function
|
|
|
154
159
|
*/
|
|
155
160
|
if (isPushed) {
|
|
156
161
|
var paddingSide = side === 'left' ? 'paddingInlineStart' : 'paddingInlineEnd';
|
|
162
|
+
var cssVarName = "--euiPushFlyoutOffset".concat(side === 'left' ? 'InlineStart' : 'InlineEnd');
|
|
157
163
|
document.body.style[paddingSide] = "".concat(width, "px");
|
|
164
|
+
|
|
165
|
+
// EUI doesn't use this css variable, but it is useful for consumers
|
|
166
|
+
setGlobalCSSVariables(_defineProperty({}, cssVarName, "".concat(width, "px")));
|
|
158
167
|
return function () {
|
|
159
168
|
document.body.style[paddingSide] = '';
|
|
169
|
+
setGlobalCSSVariables(_defineProperty({}, cssVarName, null));
|
|
160
170
|
};
|
|
161
171
|
}
|
|
162
|
-
}, [isPushed, side, width]);
|
|
172
|
+
}, [isPushed, setGlobalCSSVariables, side, width]);
|
|
163
173
|
|
|
164
174
|
/**
|
|
165
175
|
* This class doesn't actually do anything by EUI, but is nice to add for consumers (JIC)
|
|
@@ -176,11 +186,11 @@ var EuiFlyout = exports.EuiFlyout = /*#__PURE__*/(0, _react.forwardRef)(function
|
|
|
176
186
|
* ESC key closes flyout (always?)
|
|
177
187
|
*/
|
|
178
188
|
var onKeyDown = (0, _react.useCallback)(function (event) {
|
|
179
|
-
if (!isPushed && event.key === _services.keys.ESCAPE) {
|
|
189
|
+
if (!isPushed && event.key === _services.keys.ESCAPE && !isChildFlyoutOpen) {
|
|
180
190
|
event.preventDefault();
|
|
181
191
|
onClose(event);
|
|
182
192
|
}
|
|
183
|
-
}, [onClose, isPushed]);
|
|
193
|
+
}, [onClose, isPushed, isChildFlyoutOpen]);
|
|
184
194
|
|
|
185
195
|
/**
|
|
186
196
|
* Set inline styles
|
|
@@ -209,32 +219,44 @@ var EuiFlyout = exports.EuiFlyout = /*#__PURE__*/(0, _react.forwardRef)(function
|
|
|
209
219
|
var flyoutToggle = (0, _react.useRef)(document.activeElement);
|
|
210
220
|
var _useState7 = (0, _react.useState)([]),
|
|
211
221
|
_useState8 = _slicedToArray(_useState7, 2),
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
(0, _react.
|
|
222
|
+
focusTrapShards = _useState8[0],
|
|
223
|
+
setFocusTrapShards = _useState8[1];
|
|
224
|
+
var focusTrapSelectors = (0, _react.useMemo)(function () {
|
|
225
|
+
var selectors = [];
|
|
226
|
+
if (includeSelectorInFocusTrap) {
|
|
227
|
+
selectors = Array.isArray(includeSelectorInFocusTrap) ? includeSelectorInFocusTrap : [includeSelectorInFocusTrap];
|
|
228
|
+
}
|
|
215
229
|
if (includeFixedHeadersInFocusTrap) {
|
|
216
|
-
|
|
217
|
-
|
|
230
|
+
selectors.push('.euiHeader[data-fixed-header]');
|
|
231
|
+
}
|
|
232
|
+
return selectors;
|
|
233
|
+
}, [includeSelectorInFocusTrap, includeFixedHeadersInFocusTrap]);
|
|
234
|
+
(0, _react.useEffect)(function () {
|
|
235
|
+
if (focusTrapSelectors.length > 0) {
|
|
236
|
+
var shardsEls = focusTrapSelectors.flatMap(function (selector) {
|
|
237
|
+
return Array.from(document.querySelectorAll(selector));
|
|
238
|
+
});
|
|
239
|
+
setFocusTrapShards(Array.from(shardsEls));
|
|
218
240
|
|
|
219
|
-
// Flyouts that are toggled from
|
|
241
|
+
// Flyouts that are toggled from shards do not have working
|
|
220
242
|
// focus trap autoFocus, so we need to focus the flyout wrapper ourselves
|
|
221
|
-
|
|
222
|
-
if (
|
|
243
|
+
shardsEls.forEach(function (shard) {
|
|
244
|
+
if (shard.contains(flyoutToggle.current)) {
|
|
223
245
|
resizeRef === null || resizeRef === void 0 || resizeRef.focus();
|
|
224
246
|
}
|
|
225
247
|
});
|
|
226
248
|
} else {
|
|
227
|
-
// Clear existing
|
|
228
|
-
|
|
229
|
-
return
|
|
249
|
+
// Clear existing shards if necessary, e.g. switching to `false`
|
|
250
|
+
setFocusTrapShards(function (shards) {
|
|
251
|
+
return shards.length ? [] : shards;
|
|
230
252
|
});
|
|
231
253
|
}
|
|
232
|
-
}, [
|
|
254
|
+
}, [focusTrapSelectors, resizeRef]);
|
|
233
255
|
var focusTrapProps = (0, _react.useMemo)(function () {
|
|
234
256
|
return _objectSpread(_objectSpread({}, _focusTrapProps), {}, {
|
|
235
|
-
shards: [].concat(_toConsumableArray(
|
|
257
|
+
shards: [].concat(_toConsumableArray(focusTrapShards), _toConsumableArray((_focusTrapProps === null || _focusTrapProps === void 0 ? void 0 : _focusTrapProps.shards) || []))
|
|
236
258
|
});
|
|
237
|
-
}, [_focusTrapProps,
|
|
259
|
+
}, [_focusTrapProps, focusTrapShards]);
|
|
238
260
|
|
|
239
261
|
/*
|
|
240
262
|
* Provide meaningful screen reader instructions/details
|
|
@@ -251,11 +273,11 @@ var EuiFlyout = exports.EuiFlyout = /*#__PURE__*/(0, _react.forwardRef)(function
|
|
|
251
273
|
}) : (0, _react2.jsx)(_i18n.EuiI18n, {
|
|
252
274
|
token: "euiFlyout.screenReaderNonModalDialog",
|
|
253
275
|
default: "You are in a non-modal dialog. To close the dialog, press Escape."
|
|
254
|
-
}), ' ',
|
|
255
|
-
token: "euiFlyout.
|
|
256
|
-
default: "You can still continue tabbing through
|
|
276
|
+
}), ' ', focusTrapShards.length > 0 && (0, _react2.jsx)(_i18n.EuiI18n, {
|
|
277
|
+
token: "euiFlyout.screenReaderFocusTrapShards",
|
|
278
|
+
default: "You can still continue tabbing through other global page landmarks."
|
|
257
279
|
})));
|
|
258
|
-
}, [hasOverlayMask, descriptionId,
|
|
280
|
+
}, [hasOverlayMask, descriptionId, focusTrapShards.length]);
|
|
259
281
|
|
|
260
282
|
/*
|
|
261
283
|
* Trap focus even when `ownFocus={false}`, otherwise closing
|
|
@@ -313,14 +335,7 @@ var EuiFlyout = exports.EuiFlyout = /*#__PURE__*/(0, _react.forwardRef)(function
|
|
|
313
335
|
disabled: isPushed || ownFocus && isChildFlyoutOpen,
|
|
314
336
|
scrollLock: hasOverlayMask,
|
|
315
337
|
clickOutsideDisables: !ownFocus,
|
|
316
|
-
onClickOutside: onClickOutside
|
|
317
|
-
returnFocus: function returnFocus() {
|
|
318
|
-
if (!isChildFlyoutOpen && flyoutToggle.current) {
|
|
319
|
-
flyoutToggle.current.focus();
|
|
320
|
-
return false; // We've handled focus
|
|
321
|
-
}
|
|
322
|
-
return true;
|
|
323
|
-
}
|
|
338
|
+
onClickOutside: onClickOutside
|
|
324
339
|
}, focusTrapProps), (0, _react2.jsx)(Element, _extends({
|
|
325
340
|
className: classes,
|
|
326
341
|
css: cssStyles,
|
|
@@ -347,11 +362,11 @@ EuiFlyout.displayName = 'EuiFlyout';
|
|
|
347
362
|
* - Otherwise still wrap within an EuiPortal so it appends to the bottom of the window.
|
|
348
363
|
* Push flyouts have no overlay OR portal behavior.
|
|
349
364
|
*/
|
|
350
|
-
var EuiFlyoutWrapper = function EuiFlyoutWrapper(
|
|
351
|
-
var children =
|
|
352
|
-
hasOverlayMask =
|
|
353
|
-
maskProps =
|
|
354
|
-
isPortalled =
|
|
365
|
+
var EuiFlyoutWrapper = function EuiFlyoutWrapper(_ref) {
|
|
366
|
+
var children = _ref.children,
|
|
367
|
+
hasOverlayMask = _ref.hasOverlayMask,
|
|
368
|
+
maskProps = _ref.maskProps,
|
|
369
|
+
isPortalled = _ref.isPortalled;
|
|
355
370
|
if (hasOverlayMask) {
|
|
356
371
|
return (0, _react2.jsx)(_overlay_mask.EuiOverlayMask, _extends({
|
|
357
372
|
headerZindexLocation: "below"
|
|
@@ -54,7 +54,8 @@ var EuiFlyoutChild = exports.EuiFlyoutChild = function EuiFlyoutChild(_ref) {
|
|
|
54
54
|
if (!flyoutContext) {
|
|
55
55
|
throw new Error('EuiFlyoutChild must be used as a child of EuiFlyout.');
|
|
56
56
|
}
|
|
57
|
-
var
|
|
57
|
+
var isChildFlyoutOpen = flyoutContext.isChildFlyoutOpen,
|
|
58
|
+
setIsChildFlyoutOpen = flyoutContext.setIsChildFlyoutOpen,
|
|
58
59
|
parentSize = flyoutContext.parentSize;
|
|
59
60
|
(0, _react.useEffect)(function () {
|
|
60
61
|
setIsChildFlyoutOpen === null || setIsChildFlyoutOpen === void 0 || setIsChildFlyoutOpen(true);
|
|
@@ -133,6 +134,13 @@ var EuiFlyoutChild = exports.EuiFlyoutChild = function EuiFlyoutChild(_ref) {
|
|
|
133
134
|
var childLayoutMode = flyoutContext.childLayoutMode,
|
|
134
135
|
parentFlyoutRef = flyoutContext.parentFlyoutRef;
|
|
135
136
|
var flyoutChildCss = [styles.euiFlyoutChild, backgroundStyle === 'shaded' ? styles.backgroundShaded : styles.backgroundDefault, size === 's' ? styles.s : styles.m, childLayoutMode === 'side-by-side' ? styles.sidePosition : styles.stackedPosition];
|
|
137
|
+
var onKeyDown = (0, _react.useCallback)(function (event) {
|
|
138
|
+
if (isChildFlyoutOpen && event.key === _services.keys.ESCAPE) {
|
|
139
|
+
event.preventDefault();
|
|
140
|
+
setIsChildFlyoutOpen === null || setIsChildFlyoutOpen === void 0 || setIsChildFlyoutOpen(false);
|
|
141
|
+
onClose(event.nativeEvent);
|
|
142
|
+
}
|
|
143
|
+
}, [isChildFlyoutOpen, onClose, setIsChildFlyoutOpen]);
|
|
136
144
|
return (0, _react2.jsx)(_focus_trap.EuiFocusTrap, {
|
|
137
145
|
returnFocus: function returnFocus() {
|
|
138
146
|
if (parentFlyoutRef !== null && parentFlyoutRef !== void 0 && parentFlyoutRef.current) {
|
|
@@ -153,7 +161,8 @@ var EuiFlyoutChild = exports.EuiFlyoutChild = function EuiFlyoutChild(_ref) {
|
|
|
153
161
|
"aria-label": ariaLabel,
|
|
154
162
|
"aria-labelledby": ariaLabelledBy,
|
|
155
163
|
"aria-describedby": ariaDescribedBy,
|
|
156
|
-
tabIndex: -1
|
|
164
|
+
tabIndex: -1,
|
|
165
|
+
onKeyDown: onKeyDown // used as generic container event handler
|
|
157
166
|
}, rest), flyoutTitleText && !ariaLabelledBy && (0, _react2.jsx)("h2", {
|
|
158
167
|
id: titleIdGenerated,
|
|
159
168
|
className: "euiScreenReaderOnly"
|
|
@@ -61,8 +61,10 @@ var EuiFlyoutChildProvider = exports.EuiFlyoutChildProvider = function EuiFlyout
|
|
|
61
61
|
window.addEventListener('resize', handleResize);
|
|
62
62
|
handleResize();
|
|
63
63
|
return function () {
|
|
64
|
-
|
|
64
|
+
window.removeEventListener('resize', handleResize);
|
|
65
|
+
reportIsChildOpen === null || reportIsChildOpen === void 0 || reportIsChildOpen(false);
|
|
65
66
|
};
|
|
67
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
66
68
|
}, []);
|
|
67
69
|
|
|
68
70
|
// Calculate stacking breakpoint value for child flyout.
|
|
@@ -60,7 +60,7 @@ var EuiFlyoutSessionProvider = exports.EuiFlyoutSessionProvider = function EuiFl
|
|
|
60
60
|
var activeFlyoutGroup = state.activeFlyoutGroup;
|
|
61
61
|
var handleClose = function handleClose() {
|
|
62
62
|
dispatch({
|
|
63
|
-
type: '
|
|
63
|
+
type: 'CLOSE_SESSION'
|
|
64
64
|
});
|
|
65
65
|
};
|
|
66
66
|
var handleCloseChild = function handleCloseChild() {
|
|
@@ -93,10 +93,10 @@ var EuiFlyoutSessionProvider = exports.EuiFlyoutSessionProvider = function EuiFl
|
|
|
93
93
|
}
|
|
94
94
|
}, children, (activeFlyoutGroup === null || activeFlyoutGroup === void 0 ? void 0 : activeFlyoutGroup.isMainOpen) && (0, _react2.jsx)(_index.EuiFlyout, _extends({
|
|
95
95
|
onClose: handleClose,
|
|
96
|
-
size:
|
|
96
|
+
size: config === null || config === void 0 ? void 0 : config.mainSize,
|
|
97
97
|
ownFocus: !activeFlyoutGroup.isChildOpen
|
|
98
98
|
}, flyoutPropsMain), mainFlyoutContentNode, activeFlyoutGroup.isChildOpen && childFlyoutContentNode && (0, _react2.jsx)(_index.EuiFlyoutChild, _extends({
|
|
99
99
|
onClose: handleCloseChild,
|
|
100
|
-
size:
|
|
100
|
+
size: config === null || config === void 0 ? void 0 : config.childSize
|
|
101
101
|
}, flyoutPropsChild), childFlyoutContentNode)));
|
|
102
102
|
};
|
|
@@ -69,10 +69,10 @@ function flyoutReducer(state, action) {
|
|
|
69
69
|
switch (action.type) {
|
|
70
70
|
case 'OPEN_MAIN_FLYOUT':
|
|
71
71
|
{
|
|
72
|
-
var _state$activeFlyoutGr, _state$activeFlyoutGr2;
|
|
73
72
|
var _action$payload = action.payload,
|
|
74
73
|
size = _action$payload.size,
|
|
75
|
-
flyoutProps = _action$payload.flyoutProps
|
|
74
|
+
flyoutProps = _action$payload.flyoutProps,
|
|
75
|
+
meta = _action$payload.meta;
|
|
76
76
|
var newHistory = _toConsumableArray(state.history);
|
|
77
77
|
if (state.activeFlyoutGroup) {
|
|
78
78
|
newHistory.push(state.activeFlyoutGroup);
|
|
@@ -82,11 +82,9 @@ function flyoutReducer(state, action) {
|
|
|
82
82
|
isChildOpen: false,
|
|
83
83
|
config: {
|
|
84
84
|
mainSize: size,
|
|
85
|
-
|
|
86
|
-
mainFlyoutProps: flyoutProps,
|
|
87
|
-
childFlyoutProps: {}
|
|
85
|
+
mainFlyoutProps: flyoutProps
|
|
88
86
|
},
|
|
89
|
-
meta:
|
|
87
|
+
meta: meta
|
|
90
88
|
};
|
|
91
89
|
return {
|
|
92
90
|
activeFlyoutGroup: applySizeConstraints(newActiveGroup),
|
|
@@ -101,14 +99,15 @@ function flyoutReducer(state, action) {
|
|
|
101
99
|
}
|
|
102
100
|
var _action$payload2 = action.payload,
|
|
103
101
|
_size = _action$payload2.size,
|
|
104
|
-
_flyoutProps = _action$payload2.flyoutProps
|
|
102
|
+
_flyoutProps = _action$payload2.flyoutProps,
|
|
103
|
+
_meta = _action$payload2.meta;
|
|
105
104
|
var updatedActiveGroup = _objectSpread(_objectSpread({}, state.activeFlyoutGroup), {}, {
|
|
106
105
|
isChildOpen: true,
|
|
107
106
|
config: _objectSpread(_objectSpread({}, state.activeFlyoutGroup.config), {}, {
|
|
108
107
|
childSize: _size,
|
|
109
108
|
childFlyoutProps: _flyoutProps
|
|
110
109
|
}),
|
|
111
|
-
meta:
|
|
110
|
+
meta: _meta
|
|
112
111
|
});
|
|
113
112
|
return {
|
|
114
113
|
history: state.history,
|
|
@@ -120,7 +119,7 @@ function flyoutReducer(state, action) {
|
|
|
120
119
|
var _action$payload3 = action.payload,
|
|
121
120
|
main = _action$payload3.main,
|
|
122
121
|
child = _action$payload3.child,
|
|
123
|
-
|
|
122
|
+
_meta2 = _action$payload3.meta;
|
|
124
123
|
var _newHistory = _toConsumableArray(state.history);
|
|
125
124
|
if (state.activeFlyoutGroup) {
|
|
126
125
|
_newHistory.push(state.activeFlyoutGroup);
|
|
@@ -136,7 +135,7 @@ function flyoutReducer(state, action) {
|
|
|
136
135
|
mainFlyoutProps: main.flyoutProps,
|
|
137
136
|
childFlyoutProps: child.flyoutProps
|
|
138
137
|
},
|
|
139
|
-
meta:
|
|
138
|
+
meta: _meta2
|
|
140
139
|
};
|
|
141
140
|
return {
|
|
142
141
|
activeFlyoutGroup: applySizeConstraints(_newActiveGroup),
|
|
@@ -191,8 +190,8 @@ function flyoutReducer(state, action) {
|
|
|
191
190
|
activeFlyoutGroup: finalUpdatedActiveGroup
|
|
192
191
|
});
|
|
193
192
|
}
|
|
194
|
-
case '
|
|
195
|
-
//
|
|
193
|
+
case 'CLOSE_SESSION':
|
|
194
|
+
// Remove the active group and close the session
|
|
196
195
|
return {
|
|
197
196
|
activeFlyoutGroup: null,
|
|
198
197
|
history: []
|
|
@@ -14,18 +14,6 @@ var _flyout_provider = require("./flyout_provider");
|
|
|
14
14
|
* Side Public License, v 1.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
/**
|
|
18
|
-
* Options that control a main flyout in a session
|
|
19
|
-
*/
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* Options that control a child flyout in a session
|
|
23
|
-
*/
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* Options for opening both a main flyout and child flyout simultaneously
|
|
27
|
-
*/
|
|
28
|
-
|
|
29
17
|
/**
|
|
30
18
|
* Hook for accessing the flyout API
|
|
31
19
|
* @public
|
|
@@ -65,17 +53,7 @@ function useEuiFlyoutSession() {
|
|
|
65
53
|
var openFlyoutGroup = function openFlyoutGroup(options) {
|
|
66
54
|
dispatch({
|
|
67
55
|
type: 'OPEN_FLYOUT_GROUP',
|
|
68
|
-
payload:
|
|
69
|
-
main: {
|
|
70
|
-
size: options.main.size,
|
|
71
|
-
flyoutProps: options.main.flyoutProps
|
|
72
|
-
},
|
|
73
|
-
child: {
|
|
74
|
-
size: options.child.size,
|
|
75
|
-
flyoutProps: options.child.flyoutProps
|
|
76
|
-
},
|
|
77
|
-
meta: options.meta
|
|
78
|
-
}
|
|
56
|
+
payload: options
|
|
79
57
|
});
|
|
80
58
|
};
|
|
81
59
|
var closeChildFlyout = function closeChildFlyout() {
|
|
@@ -88,9 +66,9 @@ function useEuiFlyoutSession() {
|
|
|
88
66
|
type: 'GO_BACK'
|
|
89
67
|
});
|
|
90
68
|
};
|
|
91
|
-
var
|
|
69
|
+
var closeSession = function closeSession() {
|
|
92
70
|
dispatch({
|
|
93
|
-
type: '
|
|
71
|
+
type: 'CLOSE_SESSION'
|
|
94
72
|
});
|
|
95
73
|
};
|
|
96
74
|
var isFlyoutOpen = !!((_state$activeFlyoutGr = state.activeFlyoutGroup) !== null && _state$activeFlyoutGr !== void 0 && _state$activeFlyoutGr.isMainOpen);
|
|
@@ -102,7 +80,7 @@ function useEuiFlyoutSession() {
|
|
|
102
80
|
openFlyoutGroup: openFlyoutGroup,
|
|
103
81
|
closeChildFlyout: closeChildFlyout,
|
|
104
82
|
goBack: goBack,
|
|
105
|
-
|
|
83
|
+
closeSession: closeSession,
|
|
106
84
|
isFlyoutOpen: isFlyoutOpen,
|
|
107
85
|
isChildFlyoutOpen: isChildFlyoutOpen,
|
|
108
86
|
canGoBack: canGoBack
|
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.euiRangeInputStyles = void 0;
|
|
7
7
|
var _react = require("@emotion/react");
|
|
8
|
+
var _services = require("../../../services");
|
|
8
9
|
/*
|
|
9
10
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
10
11
|
* or more contributor license agreements. Licensed under the Elastic License
|
|
@@ -13,9 +14,10 @@ var _react = require("@emotion/react");
|
|
|
13
14
|
* Side Public License, v 1.
|
|
14
15
|
*/
|
|
15
16
|
|
|
16
|
-
var euiRangeInputStyles = exports.euiRangeInputStyles = function euiRangeInputStyles(
|
|
17
|
-
var euiTheme =
|
|
17
|
+
var euiRangeInputStyles = exports.euiRangeInputStyles = function euiRangeInputStyles(euiThemeContext) {
|
|
18
|
+
var euiTheme = euiThemeContext.euiTheme;
|
|
19
|
+
var isRefreshVariant = (0, _services.isEuiThemeRefreshVariant)(euiThemeContext, 'formVariant');
|
|
18
20
|
return {
|
|
19
|
-
euiRangeInput: /*#__PURE__*/(0, _react.css)("inline-size:auto;min-inline-size:", euiTheme.base * 4, "px;.euiRange__popover &,.euiDualRange__popover &{inline-size:100%;};label:euiRangeInput;")
|
|
21
|
+
euiRangeInput: /*#__PURE__*/(0, _react.css)("inline-size:auto;min-inline-size:", euiTheme.base * (isRefreshVariant ? 3.5 : 4), "px;.euiRange__popover &,.euiDualRange__popover &{inline-size:100%;};label:euiRangeInput;")
|
|
20
22
|
};
|
|
21
23
|
};
|
|
@@ -68,7 +68,12 @@ EuiComponentDefaultsProvider.propTypes = {
|
|
|
68
68
|
*
|
|
69
69
|
* Defaults will be inherited by all `EuiBasicTable`s and `EuiInMemoryTable`s.
|
|
70
70
|
*/
|
|
71
|
-
EuiTable: _propTypes.default.any
|
|
71
|
+
EuiTable: _propTypes.default.any,
|
|
72
|
+
/**
|
|
73
|
+
* Provide a global configuration for `EuiFlyout`s.
|
|
74
|
+
* Defaults will be inherited by all `EuiFlyout`s.
|
|
75
|
+
*/
|
|
76
|
+
EuiFlyout: _propTypes.default.any
|
|
72
77
|
})
|
|
73
78
|
};
|
|
74
79
|
var useComponentDefaults = exports.useComponentDefaults = function useComponentDefaults() {
|
|
@@ -118,5 +123,10 @@ EuiProviderComponentDefaultsProps.propTypes = {
|
|
|
118
123
|
*
|
|
119
124
|
* Defaults will be inherited by all `EuiBasicTable`s and `EuiInMemoryTable`s.
|
|
120
125
|
*/
|
|
121
|
-
EuiTable: _propTypes.default.any
|
|
126
|
+
EuiTable: _propTypes.default.any,
|
|
127
|
+
/**
|
|
128
|
+
* Provide a global configuration for `EuiFlyout`s.
|
|
129
|
+
* Defaults will be inherited by all `EuiFlyout`s.
|
|
130
|
+
*/
|
|
131
|
+
EuiFlyout: _propTypes.default.any
|
|
122
132
|
};
|
|
@@ -240,6 +240,7 @@ var EuiTreeViewClass = exports.EuiTreeViewClass = /*#__PURE__*/function (_Compon
|
|
|
240
240
|
key: buttonId + index,
|
|
241
241
|
id: buttonId,
|
|
242
242
|
className: node.className,
|
|
243
|
+
css: node.css,
|
|
243
244
|
buttonRef: function buttonRef(ref) {
|
|
244
245
|
return _this2.setButtonRef(ref, index);
|
|
245
246
|
},
|
|
@@ -307,6 +308,9 @@ EuiTreeViewClass.propTypes = {
|
|
|
307
308
|
/** Optional class to throw on the node
|
|
308
309
|
*/
|
|
309
310
|
className: _propTypes.default.string,
|
|
311
|
+
/** Optional styles
|
|
312
|
+
*/
|
|
313
|
+
css: _propTypes.default.any,
|
|
310
314
|
/** Function to call when the item is clicked.
|
|
311
315
|
The open state of the item will always be toggled.
|
|
312
316
|
*/
|
|
@@ -190,7 +190,13 @@ var EuiThemeProvider = exports.EuiThemeProvider = function EuiThemeProvider(_ref
|
|
|
190
190
|
_setThemeCSSVariables = _useState10[1];
|
|
191
191
|
var setThemeCSSVariables = (0, _react2.useCallback)(function (variables) {
|
|
192
192
|
return _setThemeCSSVariables(function (previous) {
|
|
193
|
-
|
|
193
|
+
var merged = _objectSpread(_objectSpread({}, previous), variables);
|
|
194
|
+
Object.keys(merged).forEach(function (key) {
|
|
195
|
+
if (merged[key] === null) {
|
|
196
|
+
delete merged[key];
|
|
197
|
+
}
|
|
198
|
+
});
|
|
199
|
+
return merged;
|
|
194
200
|
});
|
|
195
201
|
}, []);
|
|
196
202
|
var nestedThemeContext = (0, _react2.useMemo)(function () {
|