@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
|
@@ -3,7 +3,7 @@ import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
|
3
3
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
4
4
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
5
5
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
6
|
-
var _excluded = ["className", "children", "as", "hideCloseButton", "closeButtonProps", "closeButtonPosition", "onClose", "ownFocus", "side", "size", "paddingSize", "maxWidth", "style", "maskProps", "type", "outsideClickCloses", "pushMinBreakpoint", "pushAnimation", "focusTrapProps", "includeFixedHeadersInFocusTrap", "aria-describedby"];
|
|
6
|
+
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"];
|
|
7
7
|
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; }
|
|
8
8
|
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; }
|
|
9
9
|
/*
|
|
@@ -16,7 +16,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
16
16
|
|
|
17
17
|
import React, { useEffect, useRef, useMemo, useCallback, useState, forwardRef } from 'react';
|
|
18
18
|
import classnames from 'classnames';
|
|
19
|
-
import { keys, EuiWindowEvent, useCombinedRefs, useIsWithinMinBreakpoint, useEuiMemoizedStyles, useGeneratedHtmlId } from '../../services';
|
|
19
|
+
import { keys, EuiWindowEvent, useCombinedRefs, useIsWithinMinBreakpoint, useEuiMemoizedStyles, useGeneratedHtmlId, useEuiThemeCSSVariables } from '../../services';
|
|
20
20
|
import { logicalStyle } from '../../global_styling';
|
|
21
21
|
import { EuiFocusTrap } from '../focus_trap';
|
|
22
22
|
import { EuiOverlayMask } from '../overlay_mask';
|
|
@@ -28,6 +28,7 @@ import { EuiFlyoutCloseButton } from './_flyout_close_button';
|
|
|
28
28
|
import { euiFlyoutStyles } from './flyout.styles';
|
|
29
29
|
import { EuiFlyoutChild } from './flyout_child';
|
|
30
30
|
import { EuiFlyoutChildProvider } from './flyout_child_manager';
|
|
31
|
+
import { usePropsWithComponentDefaults } from '../provider/component_defaults';
|
|
31
32
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
32
33
|
export var TYPES = ['push', 'overlay'];
|
|
33
34
|
export var SIDES = ['left', 'right'];
|
|
@@ -41,40 +42,44 @@ function isEuiFlyoutSizeNamed(value) {
|
|
|
41
42
|
}
|
|
42
43
|
export var PADDING_SIZES = ['none', 's', 'm', 'l'];
|
|
43
44
|
var defaultElement = 'div';
|
|
44
|
-
export var EuiFlyout = /*#__PURE__*/forwardRef(function (
|
|
45
|
-
var
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
45
|
+
export var EuiFlyout = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
46
|
+
var _usePropsWithComponen = usePropsWithComponentDefaults('EuiFlyout', props),
|
|
47
|
+
className = _usePropsWithComponen.className,
|
|
48
|
+
children = _usePropsWithComponen.children,
|
|
49
|
+
as = _usePropsWithComponen.as,
|
|
50
|
+
_usePropsWithComponen2 = _usePropsWithComponen.hideCloseButton,
|
|
51
|
+
hideCloseButton = _usePropsWithComponen2 === void 0 ? false : _usePropsWithComponen2,
|
|
52
|
+
closeButtonProps = _usePropsWithComponen.closeButtonProps,
|
|
53
|
+
_usePropsWithComponen3 = _usePropsWithComponen.closeButtonPosition,
|
|
54
|
+
_closeButtonPosition = _usePropsWithComponen3 === void 0 ? 'inside' : _usePropsWithComponen3,
|
|
55
|
+
onClose = _usePropsWithComponen.onClose,
|
|
56
|
+
_usePropsWithComponen4 = _usePropsWithComponen.ownFocus,
|
|
57
|
+
ownFocus = _usePropsWithComponen4 === void 0 ? true : _usePropsWithComponen4,
|
|
58
|
+
_usePropsWithComponen5 = _usePropsWithComponen.side,
|
|
59
|
+
side = _usePropsWithComponen5 === void 0 ? 'right' : _usePropsWithComponen5,
|
|
60
|
+
_usePropsWithComponen6 = _usePropsWithComponen.size,
|
|
61
|
+
size = _usePropsWithComponen6 === void 0 ? 'm' : _usePropsWithComponen6,
|
|
62
|
+
_usePropsWithComponen7 = _usePropsWithComponen.paddingSize,
|
|
63
|
+
paddingSize = _usePropsWithComponen7 === void 0 ? 'l' : _usePropsWithComponen7,
|
|
64
|
+
_usePropsWithComponen8 = _usePropsWithComponen.maxWidth,
|
|
65
|
+
maxWidth = _usePropsWithComponen8 === void 0 ? false : _usePropsWithComponen8,
|
|
66
|
+
style = _usePropsWithComponen.style,
|
|
67
|
+
maskProps = _usePropsWithComponen.maskProps,
|
|
68
|
+
_usePropsWithComponen9 = _usePropsWithComponen.type,
|
|
69
|
+
type = _usePropsWithComponen9 === void 0 ? 'overlay' : _usePropsWithComponen9,
|
|
70
|
+
outsideClickCloses = _usePropsWithComponen.outsideClickCloses,
|
|
71
|
+
_usePropsWithComponen10 = _usePropsWithComponen.pushMinBreakpoint,
|
|
72
|
+
pushMinBreakpoint = _usePropsWithComponen10 === void 0 ? 'l' : _usePropsWithComponen10,
|
|
73
|
+
_usePropsWithComponen11 = _usePropsWithComponen.pushAnimation,
|
|
74
|
+
pushAnimation = _usePropsWithComponen11 === void 0 ? false : _usePropsWithComponen11,
|
|
75
|
+
_focusTrapProps = _usePropsWithComponen.focusTrapProps,
|
|
76
|
+
_usePropsWithComponen12 = _usePropsWithComponen.includeFixedHeadersInFocusTrap,
|
|
77
|
+
includeFixedHeadersInFocusTrap = _usePropsWithComponen12 === void 0 ? true : _usePropsWithComponen12,
|
|
78
|
+
includeSelectorInFocusTrap = _usePropsWithComponen.includeSelectorInFocusTrap,
|
|
79
|
+
_ariaDescribedBy = _usePropsWithComponen['aria-describedby'],
|
|
80
|
+
rest = _objectWithoutProperties(_usePropsWithComponen, _excluded);
|
|
81
|
+
var _useEuiThemeCSSVariab = useEuiThemeCSSVariables(),
|
|
82
|
+
setGlobalCSSVariables = _useEuiThemeCSSVariab.setGlobalCSSVariables;
|
|
78
83
|
var Element = as || defaultElement;
|
|
79
84
|
var maskRef = useRef(null);
|
|
80
85
|
|
|
@@ -133,12 +138,17 @@ export var EuiFlyout = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
133
138
|
*/
|
|
134
139
|
if (isPushed) {
|
|
135
140
|
var paddingSide = side === 'left' ? 'paddingInlineStart' : 'paddingInlineEnd';
|
|
141
|
+
var cssVarName = "--euiPushFlyoutOffset".concat(side === 'left' ? 'InlineStart' : 'InlineEnd');
|
|
136
142
|
document.body.style[paddingSide] = "".concat(width, "px");
|
|
143
|
+
|
|
144
|
+
// EUI doesn't use this css variable, but it is useful for consumers
|
|
145
|
+
setGlobalCSSVariables(_defineProperty({}, cssVarName, "".concat(width, "px")));
|
|
137
146
|
return function () {
|
|
138
147
|
document.body.style[paddingSide] = '';
|
|
148
|
+
setGlobalCSSVariables(_defineProperty({}, cssVarName, null));
|
|
139
149
|
};
|
|
140
150
|
}
|
|
141
|
-
}, [isPushed, side, width]);
|
|
151
|
+
}, [isPushed, setGlobalCSSVariables, side, width]);
|
|
142
152
|
|
|
143
153
|
/**
|
|
144
154
|
* This class doesn't actually do anything by EUI, but is nice to add for consumers (JIC)
|
|
@@ -155,11 +165,11 @@ export var EuiFlyout = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
155
165
|
* ESC key closes flyout (always?)
|
|
156
166
|
*/
|
|
157
167
|
var onKeyDown = useCallback(function (event) {
|
|
158
|
-
if (!isPushed && event.key === keys.ESCAPE) {
|
|
168
|
+
if (!isPushed && event.key === keys.ESCAPE && !isChildFlyoutOpen) {
|
|
159
169
|
event.preventDefault();
|
|
160
170
|
onClose(event);
|
|
161
171
|
}
|
|
162
|
-
}, [onClose, isPushed]);
|
|
172
|
+
}, [onClose, isPushed, isChildFlyoutOpen]);
|
|
163
173
|
|
|
164
174
|
/**
|
|
165
175
|
* Set inline styles
|
|
@@ -188,32 +198,44 @@ export var EuiFlyout = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
188
198
|
var flyoutToggle = useRef(document.activeElement);
|
|
189
199
|
var _useState7 = useState([]),
|
|
190
200
|
_useState8 = _slicedToArray(_useState7, 2),
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
201
|
+
focusTrapShards = _useState8[0],
|
|
202
|
+
setFocusTrapShards = _useState8[1];
|
|
203
|
+
var focusTrapSelectors = useMemo(function () {
|
|
204
|
+
var selectors = [];
|
|
205
|
+
if (includeSelectorInFocusTrap) {
|
|
206
|
+
selectors = Array.isArray(includeSelectorInFocusTrap) ? includeSelectorInFocusTrap : [includeSelectorInFocusTrap];
|
|
207
|
+
}
|
|
194
208
|
if (includeFixedHeadersInFocusTrap) {
|
|
195
|
-
|
|
196
|
-
|
|
209
|
+
selectors.push('.euiHeader[data-fixed-header]');
|
|
210
|
+
}
|
|
211
|
+
return selectors;
|
|
212
|
+
}, [includeSelectorInFocusTrap, includeFixedHeadersInFocusTrap]);
|
|
213
|
+
useEffect(function () {
|
|
214
|
+
if (focusTrapSelectors.length > 0) {
|
|
215
|
+
var shardsEls = focusTrapSelectors.flatMap(function (selector) {
|
|
216
|
+
return Array.from(document.querySelectorAll(selector));
|
|
217
|
+
});
|
|
218
|
+
setFocusTrapShards(Array.from(shardsEls));
|
|
197
219
|
|
|
198
|
-
// Flyouts that are toggled from
|
|
220
|
+
// Flyouts that are toggled from shards do not have working
|
|
199
221
|
// focus trap autoFocus, so we need to focus the flyout wrapper ourselves
|
|
200
|
-
|
|
201
|
-
if (
|
|
222
|
+
shardsEls.forEach(function (shard) {
|
|
223
|
+
if (shard.contains(flyoutToggle.current)) {
|
|
202
224
|
resizeRef === null || resizeRef === void 0 || resizeRef.focus();
|
|
203
225
|
}
|
|
204
226
|
});
|
|
205
227
|
} else {
|
|
206
|
-
// Clear existing
|
|
207
|
-
|
|
208
|
-
return
|
|
228
|
+
// Clear existing shards if necessary, e.g. switching to `false`
|
|
229
|
+
setFocusTrapShards(function (shards) {
|
|
230
|
+
return shards.length ? [] : shards;
|
|
209
231
|
});
|
|
210
232
|
}
|
|
211
|
-
}, [
|
|
233
|
+
}, [focusTrapSelectors, resizeRef]);
|
|
212
234
|
var focusTrapProps = useMemo(function () {
|
|
213
235
|
return _objectSpread(_objectSpread({}, _focusTrapProps), {}, {
|
|
214
|
-
shards: [].concat(_toConsumableArray(
|
|
236
|
+
shards: [].concat(_toConsumableArray(focusTrapShards), _toConsumableArray((_focusTrapProps === null || _focusTrapProps === void 0 ? void 0 : _focusTrapProps.shards) || []))
|
|
215
237
|
});
|
|
216
|
-
}, [_focusTrapProps,
|
|
238
|
+
}, [_focusTrapProps, focusTrapShards]);
|
|
217
239
|
|
|
218
240
|
/*
|
|
219
241
|
* Provide meaningful screen reader instructions/details
|
|
@@ -230,11 +252,11 @@ export var EuiFlyout = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
230
252
|
}) : ___EmotionJSX(EuiI18n, {
|
|
231
253
|
token: "euiFlyout.screenReaderNonModalDialog",
|
|
232
254
|
default: "You are in a non-modal dialog. To close the dialog, press Escape."
|
|
233
|
-
}), ' ',
|
|
234
|
-
token: "euiFlyout.
|
|
235
|
-
default: "You can still continue tabbing through
|
|
255
|
+
}), ' ', focusTrapShards.length > 0 && ___EmotionJSX(EuiI18n, {
|
|
256
|
+
token: "euiFlyout.screenReaderFocusTrapShards",
|
|
257
|
+
default: "You can still continue tabbing through other global page landmarks."
|
|
236
258
|
})));
|
|
237
|
-
}, [hasOverlayMask, descriptionId,
|
|
259
|
+
}, [hasOverlayMask, descriptionId, focusTrapShards.length]);
|
|
238
260
|
|
|
239
261
|
/*
|
|
240
262
|
* Trap focus even when `ownFocus={false}`, otherwise closing
|
|
@@ -292,14 +314,7 @@ export var EuiFlyout = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
292
314
|
disabled: isPushed || ownFocus && isChildFlyoutOpen,
|
|
293
315
|
scrollLock: hasOverlayMask,
|
|
294
316
|
clickOutsideDisables: !ownFocus,
|
|
295
|
-
onClickOutside: onClickOutside
|
|
296
|
-
returnFocus: function returnFocus() {
|
|
297
|
-
if (!isChildFlyoutOpen && flyoutToggle.current) {
|
|
298
|
-
flyoutToggle.current.focus();
|
|
299
|
-
return false; // We've handled focus
|
|
300
|
-
}
|
|
301
|
-
return true;
|
|
302
|
-
}
|
|
317
|
+
onClickOutside: onClickOutside
|
|
303
318
|
}, focusTrapProps), ___EmotionJSX(Element, _extends({
|
|
304
319
|
className: classes,
|
|
305
320
|
css: cssStyles,
|
|
@@ -326,11 +341,11 @@ EuiFlyout.displayName = 'EuiFlyout';
|
|
|
326
341
|
* - Otherwise still wrap within an EuiPortal so it appends to the bottom of the window.
|
|
327
342
|
* Push flyouts have no overlay OR portal behavior.
|
|
328
343
|
*/
|
|
329
|
-
var EuiFlyoutWrapper = function EuiFlyoutWrapper(
|
|
330
|
-
var children =
|
|
331
|
-
hasOverlayMask =
|
|
332
|
-
maskProps =
|
|
333
|
-
isPortalled =
|
|
344
|
+
var EuiFlyoutWrapper = function EuiFlyoutWrapper(_ref) {
|
|
345
|
+
var children = _ref.children,
|
|
346
|
+
hasOverlayMask = _ref.hasOverlayMask,
|
|
347
|
+
maskProps = _ref.maskProps,
|
|
348
|
+
isPortalled = _ref.isPortalled;
|
|
334
349
|
if (hasOverlayMask) {
|
|
335
350
|
return ___EmotionJSX(EuiOverlayMask, _extends({
|
|
336
351
|
headerZindexLocation: "below"
|
|
@@ -9,9 +9,9 @@ var _excluded = ["children", "backgroundStyle", "className", "banner", "hideClos
|
|
|
9
9
|
* Side Public License, v 1.
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
-
import React, { useContext, Children, useEffect, useMemo, useRef } from 'react';
|
|
12
|
+
import React, { useContext, Children, useEffect, useMemo, useRef, useCallback } from 'react';
|
|
13
13
|
import classNames from 'classnames';
|
|
14
|
-
import { useEuiMemoizedStyles, useGeneratedHtmlId } from '../../services';
|
|
14
|
+
import { keys, useEuiMemoizedStyles, useGeneratedHtmlId } from '../../services';
|
|
15
15
|
import { euiFlyoutChildStyles } from './flyout_child.styles';
|
|
16
16
|
import { EuiFlyoutCloseButton } from './_flyout_close_button';
|
|
17
17
|
import { EuiFlyoutContext } from './flyout_context';
|
|
@@ -44,7 +44,8 @@ export var EuiFlyoutChild = function EuiFlyoutChild(_ref) {
|
|
|
44
44
|
if (!flyoutContext) {
|
|
45
45
|
throw new Error('EuiFlyoutChild must be used as a child of EuiFlyout.');
|
|
46
46
|
}
|
|
47
|
-
var
|
|
47
|
+
var isChildFlyoutOpen = flyoutContext.isChildFlyoutOpen,
|
|
48
|
+
setIsChildFlyoutOpen = flyoutContext.setIsChildFlyoutOpen,
|
|
48
49
|
parentSize = flyoutContext.parentSize;
|
|
49
50
|
useEffect(function () {
|
|
50
51
|
setIsChildFlyoutOpen === null || setIsChildFlyoutOpen === void 0 || setIsChildFlyoutOpen(true);
|
|
@@ -123,6 +124,13 @@ export var EuiFlyoutChild = function EuiFlyoutChild(_ref) {
|
|
|
123
124
|
var childLayoutMode = flyoutContext.childLayoutMode,
|
|
124
125
|
parentFlyoutRef = flyoutContext.parentFlyoutRef;
|
|
125
126
|
var flyoutChildCss = [styles.euiFlyoutChild, backgroundStyle === 'shaded' ? styles.backgroundShaded : styles.backgroundDefault, size === 's' ? styles.s : styles.m, childLayoutMode === 'side-by-side' ? styles.sidePosition : styles.stackedPosition];
|
|
127
|
+
var onKeyDown = useCallback(function (event) {
|
|
128
|
+
if (isChildFlyoutOpen && event.key === keys.ESCAPE) {
|
|
129
|
+
event.preventDefault();
|
|
130
|
+
setIsChildFlyoutOpen === null || setIsChildFlyoutOpen === void 0 || setIsChildFlyoutOpen(false);
|
|
131
|
+
onClose(event.nativeEvent);
|
|
132
|
+
}
|
|
133
|
+
}, [isChildFlyoutOpen, onClose, setIsChildFlyoutOpen]);
|
|
126
134
|
return ___EmotionJSX(EuiFocusTrap, {
|
|
127
135
|
returnFocus: function returnFocus() {
|
|
128
136
|
if (parentFlyoutRef !== null && parentFlyoutRef !== void 0 && parentFlyoutRef.current) {
|
|
@@ -143,7 +151,8 @@ export var EuiFlyoutChild = function EuiFlyoutChild(_ref) {
|
|
|
143
151
|
"aria-label": ariaLabel,
|
|
144
152
|
"aria-labelledby": ariaLabelledBy,
|
|
145
153
|
"aria-describedby": ariaDescribedBy,
|
|
146
|
-
tabIndex: -1
|
|
154
|
+
tabIndex: -1,
|
|
155
|
+
onKeyDown: onKeyDown // used as generic container event handler
|
|
147
156
|
}, rest), flyoutTitleText && !ariaLabelledBy && ___EmotionJSX("h2", {
|
|
148
157
|
id: titleIdGenerated,
|
|
149
158
|
className: "euiScreenReaderOnly"
|
|
@@ -47,8 +47,10 @@ export var EuiFlyoutChildProvider = function EuiFlyoutChildProvider(_ref) {
|
|
|
47
47
|
window.addEventListener('resize', handleResize);
|
|
48
48
|
handleResize();
|
|
49
49
|
return function () {
|
|
50
|
-
|
|
50
|
+
window.removeEventListener('resize', handleResize);
|
|
51
|
+
reportIsChildOpen === null || reportIsChildOpen === void 0 || reportIsChildOpen(false);
|
|
51
52
|
};
|
|
53
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
52
54
|
}, []);
|
|
53
55
|
|
|
54
56
|
// Calculate stacking breakpoint value for child flyout.
|
|
@@ -10,7 +10,7 @@ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
|
10
10
|
|
|
11
11
|
import React, { createContext, useContext, useReducer } from 'react';
|
|
12
12
|
import { EuiFlyout, EuiFlyoutChild } from '../index';
|
|
13
|
-
import {
|
|
13
|
+
import { flyoutReducer, initialFlyoutState } from './flyout_reducer';
|
|
14
14
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
15
15
|
var EuiFlyoutSessionContext = /*#__PURE__*/createContext(null);
|
|
16
16
|
|
|
@@ -48,7 +48,7 @@ export var EuiFlyoutSessionProvider = function EuiFlyoutSessionProvider(_ref) {
|
|
|
48
48
|
var activeFlyoutGroup = state.activeFlyoutGroup;
|
|
49
49
|
var handleClose = function handleClose() {
|
|
50
50
|
dispatch({
|
|
51
|
-
type: '
|
|
51
|
+
type: 'CLOSE_SESSION'
|
|
52
52
|
});
|
|
53
53
|
};
|
|
54
54
|
var handleCloseChild = function handleCloseChild() {
|
|
@@ -81,10 +81,10 @@ export var EuiFlyoutSessionProvider = function EuiFlyoutSessionProvider(_ref) {
|
|
|
81
81
|
}
|
|
82
82
|
}, children, (activeFlyoutGroup === null || activeFlyoutGroup === void 0 ? void 0 : activeFlyoutGroup.isMainOpen) && ___EmotionJSX(EuiFlyout, _extends({
|
|
83
83
|
onClose: handleClose,
|
|
84
|
-
size:
|
|
84
|
+
size: config === null || config === void 0 ? void 0 : config.mainSize,
|
|
85
85
|
ownFocus: !activeFlyoutGroup.isChildOpen
|
|
86
86
|
}, flyoutPropsMain), mainFlyoutContentNode, activeFlyoutGroup.isChildOpen && childFlyoutContentNode && ___EmotionJSX(EuiFlyoutChild, _extends({
|
|
87
87
|
onClose: handleCloseChild,
|
|
88
|
-
size:
|
|
88
|
+
size: config === null || config === void 0 ? void 0 : config.childSize
|
|
89
89
|
}, flyoutPropsChild), childFlyoutContentNode)));
|
|
90
90
|
};
|
|
@@ -54,10 +54,10 @@ export function flyoutReducer(state, action) {
|
|
|
54
54
|
switch (action.type) {
|
|
55
55
|
case 'OPEN_MAIN_FLYOUT':
|
|
56
56
|
{
|
|
57
|
-
var _state$activeFlyoutGr, _state$activeFlyoutGr2;
|
|
58
57
|
var _action$payload = action.payload,
|
|
59
58
|
size = _action$payload.size,
|
|
60
|
-
flyoutProps = _action$payload.flyoutProps
|
|
59
|
+
flyoutProps = _action$payload.flyoutProps,
|
|
60
|
+
meta = _action$payload.meta;
|
|
61
61
|
var newHistory = _toConsumableArray(state.history);
|
|
62
62
|
if (state.activeFlyoutGroup) {
|
|
63
63
|
newHistory.push(state.activeFlyoutGroup);
|
|
@@ -67,11 +67,9 @@ export function flyoutReducer(state, action) {
|
|
|
67
67
|
isChildOpen: false,
|
|
68
68
|
config: {
|
|
69
69
|
mainSize: size,
|
|
70
|
-
|
|
71
|
-
mainFlyoutProps: flyoutProps,
|
|
72
|
-
childFlyoutProps: {}
|
|
70
|
+
mainFlyoutProps: flyoutProps
|
|
73
71
|
},
|
|
74
|
-
meta:
|
|
72
|
+
meta: meta
|
|
75
73
|
};
|
|
76
74
|
return {
|
|
77
75
|
activeFlyoutGroup: applySizeConstraints(newActiveGroup),
|
|
@@ -86,14 +84,15 @@ export function flyoutReducer(state, action) {
|
|
|
86
84
|
}
|
|
87
85
|
var _action$payload2 = action.payload,
|
|
88
86
|
_size = _action$payload2.size,
|
|
89
|
-
_flyoutProps = _action$payload2.flyoutProps
|
|
87
|
+
_flyoutProps = _action$payload2.flyoutProps,
|
|
88
|
+
_meta = _action$payload2.meta;
|
|
90
89
|
var updatedActiveGroup = _objectSpread(_objectSpread({}, state.activeFlyoutGroup), {}, {
|
|
91
90
|
isChildOpen: true,
|
|
92
91
|
config: _objectSpread(_objectSpread({}, state.activeFlyoutGroup.config), {}, {
|
|
93
92
|
childSize: _size,
|
|
94
93
|
childFlyoutProps: _flyoutProps
|
|
95
94
|
}),
|
|
96
|
-
meta:
|
|
95
|
+
meta: _meta
|
|
97
96
|
});
|
|
98
97
|
return {
|
|
99
98
|
history: state.history,
|
|
@@ -105,7 +104,7 @@ export function flyoutReducer(state, action) {
|
|
|
105
104
|
var _action$payload3 = action.payload,
|
|
106
105
|
main = _action$payload3.main,
|
|
107
106
|
child = _action$payload3.child,
|
|
108
|
-
|
|
107
|
+
_meta2 = _action$payload3.meta;
|
|
109
108
|
var _newHistory = _toConsumableArray(state.history);
|
|
110
109
|
if (state.activeFlyoutGroup) {
|
|
111
110
|
_newHistory.push(state.activeFlyoutGroup);
|
|
@@ -121,7 +120,7 @@ export function flyoutReducer(state, action) {
|
|
|
121
120
|
mainFlyoutProps: main.flyoutProps,
|
|
122
121
|
childFlyoutProps: child.flyoutProps
|
|
123
122
|
},
|
|
124
|
-
meta:
|
|
123
|
+
meta: _meta2
|
|
125
124
|
};
|
|
126
125
|
return {
|
|
127
126
|
activeFlyoutGroup: applySizeConstraints(_newActiveGroup),
|
|
@@ -176,8 +175,8 @@ export function flyoutReducer(state, action) {
|
|
|
176
175
|
activeFlyoutGroup: finalUpdatedActiveGroup
|
|
177
176
|
});
|
|
178
177
|
}
|
|
179
|
-
case '
|
|
180
|
-
//
|
|
178
|
+
case 'CLOSE_SESSION':
|
|
179
|
+
// Remove the active group and close the session
|
|
181
180
|
return {
|
|
182
181
|
activeFlyoutGroup: null,
|
|
183
182
|
history: []
|
|
@@ -8,19 +8,6 @@
|
|
|
8
8
|
|
|
9
9
|
import { useEffect, useRef } from 'react';
|
|
10
10
|
import { useEuiFlyoutSessionContext } from './flyout_provider';
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Options that control a main flyout in a session
|
|
14
|
-
*/
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Options that control a child flyout in a session
|
|
18
|
-
*/
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Options for opening both a main flyout and child flyout simultaneously
|
|
22
|
-
*/
|
|
23
|
-
|
|
24
11
|
/**
|
|
25
12
|
* Hook for accessing the flyout API
|
|
26
13
|
* @public
|
|
@@ -60,17 +47,7 @@ export function useEuiFlyoutSession() {
|
|
|
60
47
|
var openFlyoutGroup = function openFlyoutGroup(options) {
|
|
61
48
|
dispatch({
|
|
62
49
|
type: 'OPEN_FLYOUT_GROUP',
|
|
63
|
-
payload:
|
|
64
|
-
main: {
|
|
65
|
-
size: options.main.size,
|
|
66
|
-
flyoutProps: options.main.flyoutProps
|
|
67
|
-
},
|
|
68
|
-
child: {
|
|
69
|
-
size: options.child.size,
|
|
70
|
-
flyoutProps: options.child.flyoutProps
|
|
71
|
-
},
|
|
72
|
-
meta: options.meta
|
|
73
|
-
}
|
|
50
|
+
payload: options
|
|
74
51
|
});
|
|
75
52
|
};
|
|
76
53
|
var closeChildFlyout = function closeChildFlyout() {
|
|
@@ -83,9 +60,9 @@ export function useEuiFlyoutSession() {
|
|
|
83
60
|
type: 'GO_BACK'
|
|
84
61
|
});
|
|
85
62
|
};
|
|
86
|
-
var
|
|
63
|
+
var closeSession = function closeSession() {
|
|
87
64
|
dispatch({
|
|
88
|
-
type: '
|
|
65
|
+
type: 'CLOSE_SESSION'
|
|
89
66
|
});
|
|
90
67
|
};
|
|
91
68
|
var isFlyoutOpen = !!((_state$activeFlyoutGr = state.activeFlyoutGroup) !== null && _state$activeFlyoutGr !== void 0 && _state$activeFlyoutGr.isMainOpen);
|
|
@@ -97,7 +74,7 @@ export function useEuiFlyoutSession() {
|
|
|
97
74
|
openFlyoutGroup: openFlyoutGroup,
|
|
98
75
|
closeChildFlyout: closeChildFlyout,
|
|
99
76
|
goBack: goBack,
|
|
100
|
-
|
|
77
|
+
closeSession: closeSession,
|
|
101
78
|
isFlyoutOpen: isFlyoutOpen,
|
|
102
79
|
isChildFlyoutOpen: isChildFlyoutOpen,
|
|
103
80
|
canGoBack: canGoBack
|
|
@@ -7,9 +7,11 @@
|
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
import { css } from '@emotion/react';
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
import { isEuiThemeRefreshVariant } from '../../../services';
|
|
11
|
+
export var euiRangeInputStyles = function euiRangeInputStyles(euiThemeContext) {
|
|
12
|
+
var euiTheme = euiThemeContext.euiTheme;
|
|
13
|
+
var isRefreshVariant = isEuiThemeRefreshVariant(euiThemeContext, 'formVariant');
|
|
12
14
|
return {
|
|
13
|
-
euiRangeInput: /*#__PURE__*/css("inline-size:auto;min-inline-size:", euiTheme.base * 4, "px;.euiRange__popover &,.euiDualRange__popover &{inline-size:100%;};label:euiRangeInput;")
|
|
15
|
+
euiRangeInput: /*#__PURE__*/css("inline-size:auto;min-inline-size:", euiTheme.base * (isRefreshVariant ? 3.5 : 4), "px;.euiRange__popover &,.euiDualRange__popover &{inline-size:100%;};label:euiRangeInput;")
|
|
14
16
|
};
|
|
15
17
|
};
|
|
@@ -176,7 +176,13 @@ export var EuiThemeProvider = function EuiThemeProvider(_ref) {
|
|
|
176
176
|
_setThemeCSSVariables = _useState10[1];
|
|
177
177
|
var setThemeCSSVariables = useCallback(function (variables) {
|
|
178
178
|
return _setThemeCSSVariables(function (previous) {
|
|
179
|
-
|
|
179
|
+
var merged = _objectSpread(_objectSpread({}, previous), variables);
|
|
180
|
+
Object.keys(merged).forEach(function (key) {
|
|
181
|
+
if (merged[key] === null) {
|
|
182
|
+
delete merged[key];
|
|
183
|
+
}
|
|
184
|
+
});
|
|
185
|
+
return merged;
|
|
180
186
|
});
|
|
181
187
|
}, []);
|
|
182
188
|
var nestedThemeContext = useMemo(function () {
|