@elastic/eui 106.0.0 → 106.1.0-amsterdam.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/provider/provider.js +2 -2
- package/es/components/tree_view/tree_view.js +4 -0
- package/es/services/color/vis_color_store.js +1 -1
- package/es/services/theme/context.js +2 -2
- package/es/services/theme/provider.js +7 -1
- package/eui.d.ts +6156 -6153
- 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/provider/provider.js +2 -2
- package/lib/components/tree_view/tree_view.js +4 -0
- package/lib/services/color/vis_color_store.js +2 -2
- package/lib/services/theme/context.js +2 -2
- 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/provider/provider.js +2 -2
- package/optimize/es/components/tree_view/tree_view.js +1 -0
- package/optimize/es/services/color/vis_color_store.js +1 -1
- package/optimize/es/services/theme/context.js +2 -2
- 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/provider/provider.js +2 -2
- package/optimize/lib/components/tree_view/tree_view.js +1 -0
- package/optimize/lib/services/color/vis_color_store.js +2 -2
- package/optimize/lib/services/theme/context.js +2 -2
- 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/provider/provider.js +2 -2
- package/test-env/components/tree_view/tree_view.js +4 -0
- package/test-env/services/color/vis_color_store.js +2 -2
- package/test-env/services/theme/context.js +2 -2
- package/test-env/services/theme/provider.js +7 -1
|
@@ -218,6 +218,10 @@ EuiCollapsibleNav.propTypes = {
|
|
|
218
218
|
* Set this to `false` if you need to disable this behavior for a specific reason.
|
|
219
219
|
*/
|
|
220
220
|
includeFixedHeadersInFocusTrap: PropTypes.bool,
|
|
221
|
+
/**
|
|
222
|
+
* Specify additional css selectors to include in the focus trap.
|
|
223
|
+
*/
|
|
224
|
+
includeSelectorInFocusTrap: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.string.isRequired).isRequired, PropTypes.string.isRequired]),
|
|
221
225
|
/**
|
|
222
226
|
* ReactNode to render as this component's content
|
|
223
227
|
*/
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
-
var _excluded = ["className", "children", "as", "hideCloseButton", "closeButtonProps", "closeButtonPosition", "onClose", "ownFocus", "side", "size", "paddingSize", "maxWidth", "style", "maskProps", "type", "outsideClickCloses", "pushMinBreakpoint", "pushAnimation", "focusTrapProps", "includeFixedHeadersInFocusTrap", "aria-describedby"];
|
|
2
|
+
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"];
|
|
3
3
|
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
4
4
|
import PropTypes from "prop-types";
|
|
5
5
|
function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
|
|
@@ -29,7 +29,7 @@ function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t =
|
|
|
29
29
|
|
|
30
30
|
import React, { useEffect, useRef, useMemo, useCallback, useState, forwardRef } from 'react';
|
|
31
31
|
import classnames from 'classnames';
|
|
32
|
-
import { keys, EuiWindowEvent, useCombinedRefs, useIsWithinMinBreakpoint, useEuiMemoizedStyles, useGeneratedHtmlId } from '../../services';
|
|
32
|
+
import { keys, EuiWindowEvent, useCombinedRefs, useIsWithinMinBreakpoint, useEuiMemoizedStyles, useGeneratedHtmlId, useEuiThemeCSSVariables } from '../../services';
|
|
33
33
|
import { logicalStyle } from '../../global_styling';
|
|
34
34
|
import { EuiFocusTrap } from '../focus_trap';
|
|
35
35
|
import { EuiOverlayMask } from '../overlay_mask';
|
|
@@ -41,6 +41,7 @@ import { EuiFlyoutCloseButton } from './_flyout_close_button';
|
|
|
41
41
|
import { euiFlyoutStyles } from './flyout.styles';
|
|
42
42
|
import { EuiFlyoutChild } from './flyout_child';
|
|
43
43
|
import { EuiFlyoutChildProvider } from './flyout_child_manager';
|
|
44
|
+
import { usePropsWithComponentDefaults } from '../provider/component_defaults';
|
|
44
45
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
45
46
|
export var TYPES = ['push', 'overlay'];
|
|
46
47
|
export var SIDES = ['left', 'right'];
|
|
@@ -54,40 +55,44 @@ function isEuiFlyoutSizeNamed(value) {
|
|
|
54
55
|
}
|
|
55
56
|
export var PADDING_SIZES = ['none', 's', 'm', 'l'];
|
|
56
57
|
var defaultElement = 'div';
|
|
57
|
-
export var EuiFlyout = /*#__PURE__*/forwardRef(function (
|
|
58
|
-
var
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
58
|
+
export var EuiFlyout = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
59
|
+
var _usePropsWithComponen = usePropsWithComponentDefaults('EuiFlyout', props),
|
|
60
|
+
className = _usePropsWithComponen.className,
|
|
61
|
+
children = _usePropsWithComponen.children,
|
|
62
|
+
as = _usePropsWithComponen.as,
|
|
63
|
+
_usePropsWithComponen2 = _usePropsWithComponen.hideCloseButton,
|
|
64
|
+
hideCloseButton = _usePropsWithComponen2 === void 0 ? false : _usePropsWithComponen2,
|
|
65
|
+
closeButtonProps = _usePropsWithComponen.closeButtonProps,
|
|
66
|
+
_usePropsWithComponen3 = _usePropsWithComponen.closeButtonPosition,
|
|
67
|
+
_closeButtonPosition = _usePropsWithComponen3 === void 0 ? 'inside' : _usePropsWithComponen3,
|
|
68
|
+
onClose = _usePropsWithComponen.onClose,
|
|
69
|
+
_usePropsWithComponen4 = _usePropsWithComponen.ownFocus,
|
|
70
|
+
ownFocus = _usePropsWithComponen4 === void 0 ? true : _usePropsWithComponen4,
|
|
71
|
+
_usePropsWithComponen5 = _usePropsWithComponen.side,
|
|
72
|
+
side = _usePropsWithComponen5 === void 0 ? 'right' : _usePropsWithComponen5,
|
|
73
|
+
_usePropsWithComponen6 = _usePropsWithComponen.size,
|
|
74
|
+
size = _usePropsWithComponen6 === void 0 ? 'm' : _usePropsWithComponen6,
|
|
75
|
+
_usePropsWithComponen7 = _usePropsWithComponen.paddingSize,
|
|
76
|
+
paddingSize = _usePropsWithComponen7 === void 0 ? 'l' : _usePropsWithComponen7,
|
|
77
|
+
_usePropsWithComponen8 = _usePropsWithComponen.maxWidth,
|
|
78
|
+
maxWidth = _usePropsWithComponen8 === void 0 ? false : _usePropsWithComponen8,
|
|
79
|
+
style = _usePropsWithComponen.style,
|
|
80
|
+
maskProps = _usePropsWithComponen.maskProps,
|
|
81
|
+
_usePropsWithComponen9 = _usePropsWithComponen.type,
|
|
82
|
+
type = _usePropsWithComponen9 === void 0 ? 'overlay' : _usePropsWithComponen9,
|
|
83
|
+
outsideClickCloses = _usePropsWithComponen.outsideClickCloses,
|
|
84
|
+
_usePropsWithComponen10 = _usePropsWithComponen.pushMinBreakpoint,
|
|
85
|
+
pushMinBreakpoint = _usePropsWithComponen10 === void 0 ? 'l' : _usePropsWithComponen10,
|
|
86
|
+
_usePropsWithComponen11 = _usePropsWithComponen.pushAnimation,
|
|
87
|
+
pushAnimation = _usePropsWithComponen11 === void 0 ? false : _usePropsWithComponen11,
|
|
88
|
+
_focusTrapProps = _usePropsWithComponen.focusTrapProps,
|
|
89
|
+
_usePropsWithComponen12 = _usePropsWithComponen.includeFixedHeadersInFocusTrap,
|
|
90
|
+
includeFixedHeadersInFocusTrap = _usePropsWithComponen12 === void 0 ? true : _usePropsWithComponen12,
|
|
91
|
+
includeSelectorInFocusTrap = _usePropsWithComponen.includeSelectorInFocusTrap,
|
|
92
|
+
_ariaDescribedBy = _usePropsWithComponen['aria-describedby'],
|
|
93
|
+
rest = _objectWithoutProperties(_usePropsWithComponen, _excluded);
|
|
94
|
+
var _useEuiThemeCSSVariab = useEuiThemeCSSVariables(),
|
|
95
|
+
setGlobalCSSVariables = _useEuiThemeCSSVariab.setGlobalCSSVariables;
|
|
91
96
|
var Element = as || defaultElement;
|
|
92
97
|
var maskRef = useRef(null);
|
|
93
98
|
|
|
@@ -146,12 +151,17 @@ export var EuiFlyout = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
146
151
|
*/
|
|
147
152
|
if (isPushed) {
|
|
148
153
|
var paddingSide = side === 'left' ? 'paddingInlineStart' : 'paddingInlineEnd';
|
|
154
|
+
var cssVarName = "--euiPushFlyoutOffset".concat(side === 'left' ? 'InlineStart' : 'InlineEnd');
|
|
149
155
|
document.body.style[paddingSide] = "".concat(width, "px");
|
|
156
|
+
|
|
157
|
+
// EUI doesn't use this css variable, but it is useful for consumers
|
|
158
|
+
setGlobalCSSVariables(_defineProperty({}, cssVarName, "".concat(width, "px")));
|
|
150
159
|
return function () {
|
|
151
160
|
document.body.style[paddingSide] = '';
|
|
161
|
+
setGlobalCSSVariables(_defineProperty({}, cssVarName, null));
|
|
152
162
|
};
|
|
153
163
|
}
|
|
154
|
-
}, [isPushed, side, width]);
|
|
164
|
+
}, [isPushed, setGlobalCSSVariables, side, width]);
|
|
155
165
|
|
|
156
166
|
/**
|
|
157
167
|
* This class doesn't actually do anything by EUI, but is nice to add for consumers (JIC)
|
|
@@ -168,11 +178,11 @@ export var EuiFlyout = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
168
178
|
* ESC key closes flyout (always?)
|
|
169
179
|
*/
|
|
170
180
|
var onKeyDown = useCallback(function (event) {
|
|
171
|
-
if (!isPushed && event.key === keys.ESCAPE) {
|
|
181
|
+
if (!isPushed && event.key === keys.ESCAPE && !isChildFlyoutOpen) {
|
|
172
182
|
event.preventDefault();
|
|
173
183
|
onClose(event);
|
|
174
184
|
}
|
|
175
|
-
}, [onClose, isPushed]);
|
|
185
|
+
}, [onClose, isPushed, isChildFlyoutOpen]);
|
|
176
186
|
|
|
177
187
|
/**
|
|
178
188
|
* Set inline styles
|
|
@@ -201,32 +211,44 @@ export var EuiFlyout = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
201
211
|
var flyoutToggle = useRef(document.activeElement);
|
|
202
212
|
var _useState7 = useState([]),
|
|
203
213
|
_useState8 = _slicedToArray(_useState7, 2),
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
214
|
+
focusTrapShards = _useState8[0],
|
|
215
|
+
setFocusTrapShards = _useState8[1];
|
|
216
|
+
var focusTrapSelectors = useMemo(function () {
|
|
217
|
+
var selectors = [];
|
|
218
|
+
if (includeSelectorInFocusTrap) {
|
|
219
|
+
selectors = Array.isArray(includeSelectorInFocusTrap) ? includeSelectorInFocusTrap : [includeSelectorInFocusTrap];
|
|
220
|
+
}
|
|
207
221
|
if (includeFixedHeadersInFocusTrap) {
|
|
208
|
-
|
|
209
|
-
|
|
222
|
+
selectors.push('.euiHeader[data-fixed-header]');
|
|
223
|
+
}
|
|
224
|
+
return selectors;
|
|
225
|
+
}, [includeSelectorInFocusTrap, includeFixedHeadersInFocusTrap]);
|
|
226
|
+
useEffect(function () {
|
|
227
|
+
if (focusTrapSelectors.length > 0) {
|
|
228
|
+
var shardsEls = focusTrapSelectors.flatMap(function (selector) {
|
|
229
|
+
return Array.from(document.querySelectorAll(selector));
|
|
230
|
+
});
|
|
231
|
+
setFocusTrapShards(Array.from(shardsEls));
|
|
210
232
|
|
|
211
|
-
// Flyouts that are toggled from
|
|
233
|
+
// Flyouts that are toggled from shards do not have working
|
|
212
234
|
// focus trap autoFocus, so we need to focus the flyout wrapper ourselves
|
|
213
|
-
|
|
214
|
-
if (
|
|
235
|
+
shardsEls.forEach(function (shard) {
|
|
236
|
+
if (shard.contains(flyoutToggle.current)) {
|
|
215
237
|
resizeRef === null || resizeRef === void 0 || resizeRef.focus();
|
|
216
238
|
}
|
|
217
239
|
});
|
|
218
240
|
} else {
|
|
219
|
-
// Clear existing
|
|
220
|
-
|
|
221
|
-
return
|
|
241
|
+
// Clear existing shards if necessary, e.g. switching to `false`
|
|
242
|
+
setFocusTrapShards(function (shards) {
|
|
243
|
+
return shards.length ? [] : shards;
|
|
222
244
|
});
|
|
223
245
|
}
|
|
224
|
-
}, [
|
|
246
|
+
}, [focusTrapSelectors, resizeRef]);
|
|
225
247
|
var focusTrapProps = useMemo(function () {
|
|
226
248
|
return _objectSpread(_objectSpread({}, _focusTrapProps), {}, {
|
|
227
|
-
shards: [].concat(_toConsumableArray(
|
|
249
|
+
shards: [].concat(_toConsumableArray(focusTrapShards), _toConsumableArray((_focusTrapProps === null || _focusTrapProps === void 0 ? void 0 : _focusTrapProps.shards) || []))
|
|
228
250
|
});
|
|
229
|
-
}, [_focusTrapProps,
|
|
251
|
+
}, [_focusTrapProps, focusTrapShards]);
|
|
230
252
|
|
|
231
253
|
/*
|
|
232
254
|
* Provide meaningful screen reader instructions/details
|
|
@@ -243,11 +265,11 @@ export var EuiFlyout = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
243
265
|
}) : ___EmotionJSX(EuiI18n, {
|
|
244
266
|
token: "euiFlyout.screenReaderNonModalDialog",
|
|
245
267
|
default: "You are in a non-modal dialog. To close the dialog, press Escape."
|
|
246
|
-
}), ' ',
|
|
247
|
-
token: "euiFlyout.
|
|
248
|
-
default: "You can still continue tabbing through
|
|
268
|
+
}), ' ', focusTrapShards.length > 0 && ___EmotionJSX(EuiI18n, {
|
|
269
|
+
token: "euiFlyout.screenReaderFocusTrapShards",
|
|
270
|
+
default: "You can still continue tabbing through other global page landmarks."
|
|
249
271
|
})));
|
|
250
|
-
}, [hasOverlayMask, descriptionId,
|
|
272
|
+
}, [hasOverlayMask, descriptionId, focusTrapShards.length]);
|
|
251
273
|
|
|
252
274
|
/*
|
|
253
275
|
* Trap focus even when `ownFocus={false}`, otherwise closing
|
|
@@ -305,14 +327,7 @@ export var EuiFlyout = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
305
327
|
disabled: isPushed || ownFocus && isChildFlyoutOpen,
|
|
306
328
|
scrollLock: hasOverlayMask,
|
|
307
329
|
clickOutsideDisables: !ownFocus,
|
|
308
|
-
onClickOutside: onClickOutside
|
|
309
|
-
returnFocus: function returnFocus() {
|
|
310
|
-
if (!isChildFlyoutOpen && flyoutToggle.current) {
|
|
311
|
-
flyoutToggle.current.focus();
|
|
312
|
-
return false; // We've handled focus
|
|
313
|
-
}
|
|
314
|
-
return true;
|
|
315
|
-
}
|
|
330
|
+
onClickOutside: onClickOutside
|
|
316
331
|
}, focusTrapProps), ___EmotionJSX(Element, _extends({
|
|
317
332
|
className: classes,
|
|
318
333
|
css: cssStyles,
|
|
@@ -339,11 +354,11 @@ EuiFlyout.displayName = 'EuiFlyout';
|
|
|
339
354
|
* - Otherwise still wrap within an EuiPortal so it appends to the bottom of the window.
|
|
340
355
|
* Push flyouts have no overlay OR portal behavior.
|
|
341
356
|
*/
|
|
342
|
-
var EuiFlyoutWrapper = function EuiFlyoutWrapper(
|
|
343
|
-
var children =
|
|
344
|
-
hasOverlayMask =
|
|
345
|
-
maskProps =
|
|
346
|
-
isPortalled =
|
|
357
|
+
var EuiFlyoutWrapper = function EuiFlyoutWrapper(_ref) {
|
|
358
|
+
var children = _ref.children,
|
|
359
|
+
hasOverlayMask = _ref.hasOverlayMask,
|
|
360
|
+
maskProps = _ref.maskProps,
|
|
361
|
+
isPortalled = _ref.isPortalled;
|
|
347
362
|
if (hasOverlayMask) {
|
|
348
363
|
return ___EmotionJSX(EuiOverlayMask, _extends({
|
|
349
364
|
headerZindexLocation: "below"
|
|
@@ -10,10 +10,10 @@ function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t =
|
|
|
10
10
|
* Side Public License, v 1.
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
|
-
import React, { useContext, Children, useEffect, useMemo, useRef } from 'react';
|
|
13
|
+
import React, { useContext, Children, useEffect, useMemo, useRef, useCallback } from 'react';
|
|
14
14
|
import PropTypes from "prop-types";
|
|
15
15
|
import classNames from 'classnames';
|
|
16
|
-
import { useEuiMemoizedStyles, useGeneratedHtmlId } from '../../services';
|
|
16
|
+
import { keys, useEuiMemoizedStyles, useGeneratedHtmlId } from '../../services';
|
|
17
17
|
import { euiFlyoutChildStyles } from './flyout_child.styles';
|
|
18
18
|
import { EuiFlyoutCloseButton } from './_flyout_close_button';
|
|
19
19
|
import { EuiFlyoutContext } from './flyout_context';
|
|
@@ -46,7 +46,8 @@ export var EuiFlyoutChild = function EuiFlyoutChild(_ref) {
|
|
|
46
46
|
if (!flyoutContext) {
|
|
47
47
|
throw new Error('EuiFlyoutChild must be used as a child of EuiFlyout.');
|
|
48
48
|
}
|
|
49
|
-
var
|
|
49
|
+
var isChildFlyoutOpen = flyoutContext.isChildFlyoutOpen,
|
|
50
|
+
setIsChildFlyoutOpen = flyoutContext.setIsChildFlyoutOpen,
|
|
50
51
|
parentSize = flyoutContext.parentSize;
|
|
51
52
|
useEffect(function () {
|
|
52
53
|
setIsChildFlyoutOpen === null || setIsChildFlyoutOpen === void 0 || setIsChildFlyoutOpen(true);
|
|
@@ -125,6 +126,13 @@ export var EuiFlyoutChild = function EuiFlyoutChild(_ref) {
|
|
|
125
126
|
var childLayoutMode = flyoutContext.childLayoutMode,
|
|
126
127
|
parentFlyoutRef = flyoutContext.parentFlyoutRef;
|
|
127
128
|
var flyoutChildCss = [styles.euiFlyoutChild, backgroundStyle === 'shaded' ? styles.backgroundShaded : styles.backgroundDefault, size === 's' ? styles.s : styles.m, childLayoutMode === 'side-by-side' ? styles.sidePosition : styles.stackedPosition];
|
|
129
|
+
var onKeyDown = useCallback(function (event) {
|
|
130
|
+
if (isChildFlyoutOpen && event.key === keys.ESCAPE) {
|
|
131
|
+
event.preventDefault();
|
|
132
|
+
setIsChildFlyoutOpen === null || setIsChildFlyoutOpen === void 0 || setIsChildFlyoutOpen(false);
|
|
133
|
+
onClose(event.nativeEvent);
|
|
134
|
+
}
|
|
135
|
+
}, [isChildFlyoutOpen, onClose, setIsChildFlyoutOpen]);
|
|
128
136
|
return ___EmotionJSX(EuiFocusTrap, {
|
|
129
137
|
returnFocus: function returnFocus() {
|
|
130
138
|
if (parentFlyoutRef !== null && parentFlyoutRef !== void 0 && parentFlyoutRef.current) {
|
|
@@ -145,7 +153,8 @@ export var EuiFlyoutChild = function EuiFlyoutChild(_ref) {
|
|
|
145
153
|
"aria-label": ariaLabel,
|
|
146
154
|
"aria-labelledby": ariaLabelledBy,
|
|
147
155
|
"aria-describedby": ariaDescribedBy,
|
|
148
|
-
tabIndex: -1
|
|
156
|
+
tabIndex: -1,
|
|
157
|
+
onKeyDown: onKeyDown // used as generic container event handler
|
|
149
158
|
}, rest), flyoutTitleText && !ariaLabelledBy && ___EmotionJSX("h2", {
|
|
150
159
|
id: titleIdGenerated,
|
|
151
160
|
className: "euiScreenReaderOnly"
|
|
@@ -53,8 +53,10 @@ export var EuiFlyoutChildProvider = function EuiFlyoutChildProvider(_ref) {
|
|
|
53
53
|
window.addEventListener('resize', handleResize);
|
|
54
54
|
handleResize();
|
|
55
55
|
return function () {
|
|
56
|
-
|
|
56
|
+
window.removeEventListener('resize', handleResize);
|
|
57
|
+
reportIsChildOpen === null || reportIsChildOpen === void 0 || reportIsChildOpen(false);
|
|
57
58
|
};
|
|
59
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
58
60
|
}, []);
|
|
59
61
|
|
|
60
62
|
// Calculate stacking breakpoint value for child flyout.
|
|
@@ -15,7 +15,7 @@ function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
|
15
15
|
|
|
16
16
|
import React, { createContext, useContext, useReducer } from 'react';
|
|
17
17
|
import { EuiFlyout, EuiFlyoutChild } from '../index';
|
|
18
|
-
import {
|
|
18
|
+
import { flyoutReducer, initialFlyoutState } from './flyout_reducer';
|
|
19
19
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
20
20
|
var EuiFlyoutSessionContext = /*#__PURE__*/createContext(null);
|
|
21
21
|
|
|
@@ -53,7 +53,7 @@ export var EuiFlyoutSessionProvider = function EuiFlyoutSessionProvider(_ref) {
|
|
|
53
53
|
var activeFlyoutGroup = state.activeFlyoutGroup;
|
|
54
54
|
var handleClose = function handleClose() {
|
|
55
55
|
dispatch({
|
|
56
|
-
type: '
|
|
56
|
+
type: 'CLOSE_SESSION'
|
|
57
57
|
});
|
|
58
58
|
};
|
|
59
59
|
var handleCloseChild = function handleCloseChild() {
|
|
@@ -86,10 +86,10 @@ export var EuiFlyoutSessionProvider = function EuiFlyoutSessionProvider(_ref) {
|
|
|
86
86
|
}
|
|
87
87
|
}, children, (activeFlyoutGroup === null || activeFlyoutGroup === void 0 ? void 0 : activeFlyoutGroup.isMainOpen) && ___EmotionJSX(EuiFlyout, _extends({
|
|
88
88
|
onClose: handleClose,
|
|
89
|
-
size:
|
|
89
|
+
size: config === null || config === void 0 ? void 0 : config.mainSize,
|
|
90
90
|
ownFocus: !activeFlyoutGroup.isChildOpen
|
|
91
91
|
}, flyoutPropsMain), mainFlyoutContentNode, activeFlyoutGroup.isChildOpen && childFlyoutContentNode && ___EmotionJSX(EuiFlyoutChild, _extends({
|
|
92
92
|
onClose: handleCloseChild,
|
|
93
|
-
size:
|
|
93
|
+
size: config === null || config === void 0 ? void 0 : config.childSize
|
|
94
94
|
}, flyoutPropsChild), childFlyoutContentNode)));
|
|
95
95
|
};
|
|
@@ -62,10 +62,10 @@ export function flyoutReducer(state, action) {
|
|
|
62
62
|
switch (action.type) {
|
|
63
63
|
case 'OPEN_MAIN_FLYOUT':
|
|
64
64
|
{
|
|
65
|
-
var _state$activeFlyoutGr, _state$activeFlyoutGr2;
|
|
66
65
|
var _action$payload = action.payload,
|
|
67
66
|
size = _action$payload.size,
|
|
68
|
-
flyoutProps = _action$payload.flyoutProps
|
|
67
|
+
flyoutProps = _action$payload.flyoutProps,
|
|
68
|
+
meta = _action$payload.meta;
|
|
69
69
|
var newHistory = _toConsumableArray(state.history);
|
|
70
70
|
if (state.activeFlyoutGroup) {
|
|
71
71
|
newHistory.push(state.activeFlyoutGroup);
|
|
@@ -75,11 +75,9 @@ export function flyoutReducer(state, action) {
|
|
|
75
75
|
isChildOpen: false,
|
|
76
76
|
config: {
|
|
77
77
|
mainSize: size,
|
|
78
|
-
|
|
79
|
-
mainFlyoutProps: flyoutProps,
|
|
80
|
-
childFlyoutProps: {}
|
|
78
|
+
mainFlyoutProps: flyoutProps
|
|
81
79
|
},
|
|
82
|
-
meta:
|
|
80
|
+
meta: meta
|
|
83
81
|
};
|
|
84
82
|
return {
|
|
85
83
|
activeFlyoutGroup: applySizeConstraints(newActiveGroup),
|
|
@@ -94,14 +92,15 @@ export function flyoutReducer(state, action) {
|
|
|
94
92
|
}
|
|
95
93
|
var _action$payload2 = action.payload,
|
|
96
94
|
_size = _action$payload2.size,
|
|
97
|
-
_flyoutProps = _action$payload2.flyoutProps
|
|
95
|
+
_flyoutProps = _action$payload2.flyoutProps,
|
|
96
|
+
_meta = _action$payload2.meta;
|
|
98
97
|
var updatedActiveGroup = _objectSpread(_objectSpread({}, state.activeFlyoutGroup), {}, {
|
|
99
98
|
isChildOpen: true,
|
|
100
99
|
config: _objectSpread(_objectSpread({}, state.activeFlyoutGroup.config), {}, {
|
|
101
100
|
childSize: _size,
|
|
102
101
|
childFlyoutProps: _flyoutProps
|
|
103
102
|
}),
|
|
104
|
-
meta:
|
|
103
|
+
meta: _meta
|
|
105
104
|
});
|
|
106
105
|
return {
|
|
107
106
|
history: state.history,
|
|
@@ -113,7 +112,7 @@ export function flyoutReducer(state, action) {
|
|
|
113
112
|
var _action$payload3 = action.payload,
|
|
114
113
|
main = _action$payload3.main,
|
|
115
114
|
child = _action$payload3.child,
|
|
116
|
-
|
|
115
|
+
_meta2 = _action$payload3.meta;
|
|
117
116
|
var _newHistory = _toConsumableArray(state.history);
|
|
118
117
|
if (state.activeFlyoutGroup) {
|
|
119
118
|
_newHistory.push(state.activeFlyoutGroup);
|
|
@@ -129,7 +128,7 @@ export function flyoutReducer(state, action) {
|
|
|
129
128
|
mainFlyoutProps: main.flyoutProps,
|
|
130
129
|
childFlyoutProps: child.flyoutProps
|
|
131
130
|
},
|
|
132
|
-
meta:
|
|
131
|
+
meta: _meta2
|
|
133
132
|
};
|
|
134
133
|
return {
|
|
135
134
|
activeFlyoutGroup: applySizeConstraints(_newActiveGroup),
|
|
@@ -184,8 +183,8 @@ export function flyoutReducer(state, action) {
|
|
|
184
183
|
activeFlyoutGroup: finalUpdatedActiveGroup
|
|
185
184
|
});
|
|
186
185
|
}
|
|
187
|
-
case '
|
|
188
|
-
//
|
|
186
|
+
case 'CLOSE_SESSION':
|
|
187
|
+
// Remove the active group and close the session
|
|
189
188
|
return {
|
|
190
189
|
activeFlyoutGroup: null,
|
|
191
190
|
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
|
};
|
|
@@ -61,7 +61,12 @@ EuiComponentDefaultsProvider.propTypes = {
|
|
|
61
61
|
*
|
|
62
62
|
* Defaults will be inherited by all `EuiBasicTable`s and `EuiInMemoryTable`s.
|
|
63
63
|
*/
|
|
64
|
-
EuiTable: PropTypes.any
|
|
64
|
+
EuiTable: PropTypes.any,
|
|
65
|
+
/**
|
|
66
|
+
* Provide a global configuration for `EuiFlyout`s.
|
|
67
|
+
* Defaults will be inherited by all `EuiFlyout`s.
|
|
68
|
+
*/
|
|
69
|
+
EuiFlyout: PropTypes.any
|
|
65
70
|
})
|
|
66
71
|
};
|
|
67
72
|
export var useComponentDefaults = function useComponentDefaults() {
|
|
@@ -111,5 +116,10 @@ EuiProviderComponentDefaultsProps.propTypes = {
|
|
|
111
116
|
*
|
|
112
117
|
* Defaults will be inherited by all `EuiBasicTable`s and `EuiInMemoryTable`s.
|
|
113
118
|
*/
|
|
114
|
-
EuiTable: PropTypes.any
|
|
119
|
+
EuiTable: PropTypes.any,
|
|
120
|
+
/**
|
|
121
|
+
* Provide a global configuration for `EuiFlyout`s.
|
|
122
|
+
* Defaults will be inherited by all `EuiFlyout`s.
|
|
123
|
+
*/
|
|
124
|
+
EuiFlyout: PropTypes.any
|
|
115
125
|
};
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
import React from 'react';
|
|
10
|
-
import {
|
|
10
|
+
import { EuiThemeAmsterdam } from '../../themes';
|
|
11
11
|
import { EuiThemeProvider } from '../../services';
|
|
12
12
|
import { emitEuiProviderWarning } from '../../services/theme/warning';
|
|
13
13
|
import { cache as fallbackCache } from '../../services/emotion/css';
|
|
@@ -26,7 +26,7 @@ export var EuiProvider = function EuiProvider(_ref) {
|
|
|
26
26
|
var _ref$cache = _ref.cache,
|
|
27
27
|
cache = _ref$cache === void 0 ? fallbackCache : _ref$cache,
|
|
28
28
|
_ref$theme = _ref.theme,
|
|
29
|
-
theme = _ref$theme === void 0 ?
|
|
29
|
+
theme = _ref$theme === void 0 ? EuiThemeAmsterdam : _ref$theme,
|
|
30
30
|
_ref$globalStyles = _ref.globalStyles,
|
|
31
31
|
Globals = _ref$globalStyles === void 0 ? EuiGlobalStyles : _ref$globalStyles,
|
|
32
32
|
_ref$utilityClasses = _ref.utilityClasses,
|
|
@@ -233,6 +233,7 @@ export var EuiTreeViewClass = /*#__PURE__*/function (_Component) {
|
|
|
233
233
|
key: buttonId + index,
|
|
234
234
|
id: buttonId,
|
|
235
235
|
className: node.className,
|
|
236
|
+
css: node.css,
|
|
236
237
|
buttonRef: function buttonRef(ref) {
|
|
237
238
|
return _this2.setButtonRef(ref, index);
|
|
238
239
|
},
|
|
@@ -300,6 +301,9 @@ EuiTreeViewClass.propTypes = {
|
|
|
300
301
|
/** Optional class to throw on the node
|
|
301
302
|
*/
|
|
302
303
|
className: PropTypes.string,
|
|
304
|
+
/** Optional styles
|
|
305
|
+
*/
|
|
306
|
+
css: PropTypes.any,
|
|
303
307
|
/** Function to call when the item is clicked.
|
|
304
308
|
The open state of the item will always be toggled.
|
|
305
309
|
*/
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
import { EuiVisColorStore } from '@elastic/eui-theme-common';
|
|
10
|
-
import { colorVis } from '
|
|
10
|
+
import { colorVisLight as colorVis } from '../../themes/amsterdam/global_styling/variables/_colors_vis_light';
|
|
11
11
|
|
|
12
12
|
// initialsetup of Vis color storage with default colors
|
|
13
13
|
export var EUI_VIS_COLOR_STORE = EuiVisColorStore.getInstance(colorVis, false);
|
|
@@ -7,10 +7,10 @@
|
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
import { createContext } from 'react';
|
|
10
|
-
import {
|
|
10
|
+
import { EuiThemeAmsterdam } from '../../themes/amsterdam/theme';
|
|
11
11
|
import { DEFAULT_COLOR_MODE, getComputed } from './utils';
|
|
12
12
|
export var DEFAULTS = {
|
|
13
|
-
system:
|
|
13
|
+
system: EuiThemeAmsterdam,
|
|
14
14
|
modifications: {},
|
|
15
15
|
colorMode: DEFAULT_COLOR_MODE,
|
|
16
16
|
highContrastMode: false
|
|
@@ -185,7 +185,13 @@ export var EuiThemeProvider = function EuiThemeProvider(_ref) {
|
|
|
185
185
|
_setThemeCSSVariables = _useState10[1];
|
|
186
186
|
var setThemeCSSVariables = useCallback(function (variables) {
|
|
187
187
|
return _setThemeCSSVariables(function (previous) {
|
|
188
|
-
|
|
188
|
+
var merged = _objectSpread(_objectSpread({}, previous), variables);
|
|
189
|
+
Object.keys(merged).forEach(function (key) {
|
|
190
|
+
if (merged[key] === null) {
|
|
191
|
+
delete merged[key];
|
|
192
|
+
}
|
|
193
|
+
});
|
|
194
|
+
return merged;
|
|
189
195
|
});
|
|
190
196
|
}, []);
|
|
191
197
|
var nestedThemeContext = useMemo(function () {
|