@elastic/eui 113.3.0 → 114.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/components/button/split_button/split_button.js +13 -0
- package/es/components/button/split_button/split_button_actions.js +15 -0
- package/es/components/collapsible_nav/collapsible_nav.js +5 -0
- package/es/components/color_picker/color_picker.js +31 -8
- package/es/components/datagrid/utils/scrolling.js +39 -10
- package/es/components/flyout/_flyout_overlay.js +34 -4
- package/es/components/flyout/flyout.component.js +13 -9
- package/es/components/flyout/flyout.js +9 -1
- package/es/components/flyout/flyout.styles.js +2 -2
- package/es/components/flyout/flyout_menu.js +2 -1
- package/es/components/flyout/flyout_resizable.js +5 -0
- package/es/components/flyout/manager/actions.js +5 -2
- package/es/components/flyout/manager/flyout_child.js +1 -0
- package/es/components/flyout/manager/flyout_managed.js +5 -3
- package/es/components/flyout/manager/reducer.js +116 -57
- package/es/components/flyout/manager/store.js +13 -6
- package/es/components/markdown_editor/plugins/markdown_default_plugins/parsing_plugins.js +2 -1
- package/es/components/markdown_editor/plugins/remark/remark_intraword_underscore.js +172 -0
- package/es/components/overlay_mask/overlay_mask.js +10 -3
- package/es/components/tree_view/tree_view_item.styles.js +1 -1
- package/es/services/hooks/index.js +8 -8
- package/es/services/hooks/useIsPointerDown.js +6 -15
- package/es/services/index.js +1 -1
- package/eui.d.ts +83 -51
- package/i18ntokens.json +661 -643
- package/lib/components/button/split_button/split_button.js +13 -0
- package/lib/components/button/split_button/split_button_actions.js +15 -0
- package/lib/components/collapsible_nav/collapsible_nav.js +5 -0
- package/lib/components/color_picker/color_picker.js +30 -7
- package/lib/components/datagrid/utils/scrolling.js +37 -8
- package/lib/components/flyout/_flyout_overlay.js +33 -3
- package/lib/components/flyout/flyout.component.js +13 -9
- package/lib/components/flyout/flyout.js +9 -1
- package/lib/components/flyout/flyout.styles.js +2 -2
- package/lib/components/flyout/flyout_menu.js +2 -1
- package/lib/components/flyout/flyout_resizable.js +5 -0
- package/lib/components/flyout/manager/actions.js +5 -2
- package/lib/components/flyout/manager/flyout_child.js +1 -0
- package/lib/components/flyout/manager/flyout_managed.js +5 -3
- package/lib/components/flyout/manager/reducer.js +116 -57
- package/lib/components/flyout/manager/store.js +13 -6
- package/lib/components/markdown_editor/plugins/markdown_default_plugins/parsing_plugins.js +2 -1
- package/lib/components/markdown_editor/plugins/remark/remark_intraword_underscore.js +179 -0
- package/lib/components/overlay_mask/overlay_mask.js +10 -3
- package/lib/components/tree_view/tree_view_item.styles.js +1 -1
- package/lib/services/hooks/index.js +60 -91
- package/lib/services/hooks/useIsPointerDown.js +7 -14
- package/lib/services/index.js +70 -11
- package/optimize/es/components/color_picker/color_picker.js +31 -8
- package/optimize/es/components/datagrid/utils/scrolling.js +39 -10
- package/optimize/es/components/flyout/_flyout_overlay.js +34 -4
- package/optimize/es/components/flyout/flyout.component.js +13 -9
- package/optimize/es/components/flyout/flyout.js +4 -1
- package/optimize/es/components/flyout/flyout.styles.js +2 -2
- package/optimize/es/components/flyout/flyout_menu.js +2 -1
- package/optimize/es/components/flyout/manager/actions.js +5 -2
- package/optimize/es/components/flyout/manager/flyout_managed.js +4 -3
- package/optimize/es/components/flyout/manager/reducer.js +116 -57
- package/optimize/es/components/flyout/manager/store.js +13 -6
- package/optimize/es/components/markdown_editor/plugins/markdown_default_plugins/parsing_plugins.js +2 -1
- package/optimize/es/components/markdown_editor/plugins/remark/remark_intraword_underscore.js +172 -0
- package/optimize/es/components/overlay_mask/overlay_mask.js +4 -2
- package/optimize/es/components/tree_view/tree_view_item.styles.js +1 -1
- package/optimize/es/services/hooks/index.js +8 -8
- package/optimize/es/services/hooks/useIsPointerDown.js +6 -10
- package/optimize/es/services/index.js +1 -1
- package/optimize/lib/components/color_picker/color_picker.js +30 -7
- package/optimize/lib/components/datagrid/utils/scrolling.js +37 -8
- package/optimize/lib/components/flyout/_flyout_overlay.js +33 -3
- package/optimize/lib/components/flyout/flyout.component.js +13 -9
- package/optimize/lib/components/flyout/flyout.js +4 -1
- package/optimize/lib/components/flyout/flyout.styles.js +2 -2
- package/optimize/lib/components/flyout/flyout_menu.js +2 -1
- package/optimize/lib/components/flyout/manager/actions.js +5 -2
- package/optimize/lib/components/flyout/manager/flyout_managed.js +4 -3
- package/optimize/lib/components/flyout/manager/reducer.js +116 -57
- package/optimize/lib/components/flyout/manager/store.js +13 -6
- package/optimize/lib/components/markdown_editor/plugins/markdown_default_plugins/parsing_plugins.js +2 -1
- package/optimize/lib/components/markdown_editor/plugins/remark/remark_intraword_underscore.js +179 -0
- package/optimize/lib/components/overlay_mask/overlay_mask.js +4 -2
- package/optimize/lib/components/tree_view/tree_view_item.styles.js +1 -1
- package/optimize/lib/services/hooks/index.js +60 -91
- package/optimize/lib/services/hooks/useIsPointerDown.js +5 -10
- package/optimize/lib/services/index.js +70 -11
- package/package.json +4 -4
- package/test-env/components/button/split_button/split_button.js +13 -0
- package/test-env/components/button/split_button/split_button_actions.js +15 -0
- package/test-env/components/collapsible_nav/collapsible_nav.js +5 -0
- package/test-env/components/color_picker/color_picker.js +30 -7
- package/test-env/components/datagrid/utils/scrolling.js +37 -8
- package/test-env/components/flyout/_flyout_overlay.js +33 -3
- package/test-env/components/flyout/flyout.component.js +13 -9
- package/test-env/components/flyout/flyout.styles.js +2 -2
- package/test-env/components/flyout/flyout_menu.js +2 -1
- package/test-env/components/flyout/flyout_resizable.js +5 -0
- package/test-env/components/flyout/manager/actions.js +5 -2
- package/test-env/components/flyout/manager/flyout_child.js +1 -0
- package/test-env/components/flyout/manager/flyout_managed.js +5 -3
- package/test-env/components/flyout/manager/reducer.js +116 -57
- package/test-env/components/flyout/manager/store.js +13 -6
- package/test-env/components/markdown_editor/plugins/markdown_default_plugins/parsing_plugins.js +2 -1
- package/test-env/components/markdown_editor/plugins/remark/remark_intraword_underscore.js +179 -0
- package/test-env/components/overlay_mask/overlay_mask.js +10 -3
- package/test-env/components/tree_view/tree_view_item.styles.js +1 -1
- package/test-env/services/hooks/index.js +60 -91
- package/test-env/services/hooks/useIsPointerDown.js +5 -10
- package/test-env/services/index.js +70 -11
|
@@ -26,7 +26,7 @@ export var euiTreeViewItemStyles = function euiTreeViewItemStyles(euiThemeContex
|
|
|
26
26
|
euiTreeView__node: _ref,
|
|
27
27
|
default: /*#__PURE__*/css(logicalCSS('max-height', defaultSize), " line-height:", defaultSize, ";;label:default;"),
|
|
28
28
|
compressed: /*#__PURE__*/css(logicalCSS('max-height', compressedSize), " line-height:", compressedSize, ";;label:compressed;"),
|
|
29
|
-
expanded: /*#__PURE__*/css(logicalCSS('max-height', '
|
|
29
|
+
expanded: /*#__PURE__*/css(logicalCSS('max-height', 'none'), ";;label:expanded;")
|
|
30
30
|
},
|
|
31
31
|
button: {
|
|
32
32
|
euiTreeView__nodeInner: /*#__PURE__*/css(logicalCSS('width', '100%'), " ", logicalCSS('padding-left', euiTheme.size.s), " ", logicalCSS('padding-right', euiTheme.size.xxs), " display:flex;align-items:center;&:focus{", euiFocusRing(euiThemeContext, 'inset'), ";}&:hover,&:active,&:focus{background-color:", euiTheme.components.treeViewItemBackgroundHover, ";};label:euiTreeView__nodeInner;"),
|
|
@@ -6,12 +6,12 @@
|
|
|
6
6
|
* Side Public License, v 1.
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
export
|
|
10
|
-
export
|
|
11
|
-
export
|
|
12
|
-
export
|
|
13
|
-
export
|
|
14
|
-
export
|
|
15
|
-
export
|
|
16
|
-
export
|
|
9
|
+
export { useDependentState } from './useDependentState';
|
|
10
|
+
export { useCombinedRefs, setMultipleRefs } from './useCombinedRefs';
|
|
11
|
+
export { useForceRender } from './useForceRender';
|
|
12
|
+
export { useLatest } from './useLatest';
|
|
13
|
+
export { useDeepEqual } from './useDeepEqual';
|
|
14
|
+
export { isMouseEvent, useMouseMove } from './useMouseMove';
|
|
15
|
+
export { useIsPointerDown } from './useIsPointerDown';
|
|
16
|
+
export { useUpdateEffect } from './useUpdateEffect';
|
|
17
17
|
export { useEuiDisabledElement } from './useEuiDisabledElement';
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
1
|
/*
|
|
3
2
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
4
3
|
* or more contributor license agreements. Licensed under the Elastic License
|
|
@@ -7,30 +6,27 @@ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
|
7
6
|
* Side Public License, v 1.
|
|
8
7
|
*/
|
|
9
8
|
|
|
10
|
-
import {
|
|
9
|
+
import { useRef, useEffect } from 'react';
|
|
11
10
|
|
|
12
11
|
/**
|
|
13
12
|
* A hook that tracks whether the pointer is currently down/pressed.
|
|
14
13
|
* Useful for detecting text selection in progress.
|
|
15
14
|
*/
|
|
16
15
|
export function useIsPointerDown(container) {
|
|
17
|
-
var
|
|
18
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
19
|
-
isPointerDown = _useState2[0],
|
|
20
|
-
setIsPointerDown = _useState2[1];
|
|
16
|
+
var isPointerDownRef = useRef(false);
|
|
21
17
|
useEffect(function () {
|
|
22
18
|
var handlePointerDown = function handlePointerDown(event) {
|
|
23
19
|
if (container !== null && container !== void 0 && container.current && !container.current.contains(event.target)) {
|
|
24
20
|
return;
|
|
25
21
|
}
|
|
26
|
-
|
|
22
|
+
isPointerDownRef.current = true;
|
|
27
23
|
};
|
|
28
24
|
var handlePointerUpOrCancel = function handlePointerUpOrCancel() {
|
|
29
|
-
|
|
25
|
+
isPointerDownRef.current = false;
|
|
30
26
|
};
|
|
31
27
|
var handleVisibilityChange = function handleVisibilityChange() {
|
|
32
28
|
if (document.visibilityState === 'hidden') {
|
|
33
|
-
|
|
29
|
+
isPointerDownRef.current = false;
|
|
34
30
|
}
|
|
35
31
|
};
|
|
36
32
|
var controller = new AbortController();
|
|
@@ -48,5 +44,5 @@ export function useIsPointerDown(container) {
|
|
|
48
44
|
controller.abort();
|
|
49
45
|
};
|
|
50
46
|
}, [container]);
|
|
51
|
-
return
|
|
47
|
+
return isPointerDownRef;
|
|
52
48
|
}
|
|
@@ -22,7 +22,7 @@ export * from './emotion';
|
|
|
22
22
|
export * from './findElement';
|
|
23
23
|
export { focusTrapPubSub } from './focus_trap';
|
|
24
24
|
export { dateFormatAliases, formatAuto, formatBoolean, formatDate, formatNumber, formatText } from './format';
|
|
25
|
-
export
|
|
25
|
+
export { useDependentState, useCombinedRefs, setMultipleRefs, useForceRender, useLatest, useDeepEqual, isMouseEvent, useMouseMove, useUpdateEffect, useEuiDisabledElement } from './hooks';
|
|
26
26
|
export { isEvenlyDivisibleBy, isWithinRange } from './number';
|
|
27
27
|
export { Pager } from './paging';
|
|
28
28
|
export { calculatePopoverPosition, findPopoverPosition } from './popover';
|
|
@@ -95,9 +95,12 @@ var EuiColorPicker = exports.EuiColorPicker = function EuiColorPicker(_ref) {
|
|
|
95
95
|
_ref$isClearable = _ref.isClearable,
|
|
96
96
|
isClearable = _ref$isClearable === void 0 ? false : _ref$isClearable,
|
|
97
97
|
placeholder = _ref.placeholder,
|
|
98
|
-
dataTestSubj = _ref['data-test-subj']
|
|
99
|
-
|
|
100
|
-
|
|
98
|
+
dataTestSubj = _ref['data-test-subj'],
|
|
99
|
+
_ariaLabel = _ref['aria-label'],
|
|
100
|
+
ariaLabelledby = _ref['aria-labelledby'],
|
|
101
|
+
ariaDescribedby = _ref['aria-describedby'];
|
|
102
|
+
var _useEuiI18n = (0, _i18n.useEuiI18n)(['euiColorPicker.popoverLabel', 'euiColorPicker.colorLabel', 'euiColorPicker.selectedColorLabel', 'euiColorPicker.colorErrorMessage', 'euiColorPicker.transparent', 'euiColorPicker.alphaLabel', 'euiColorPicker.openLabel', 'euiColorPicker.closeLabel', 'euiColorPicker.ariaLabel'], ['Color selection dialog', 'Color value', 'Selected color', 'Invalid color value', 'Transparent', 'Alpha channel (opacity) value', 'Press the escape key to close the popover', 'Press the down key to open a popover containing color options', 'Select a color']),
|
|
103
|
+
_useEuiI18n2 = (0, _slicedToArray2.default)(_useEuiI18n, 9),
|
|
101
104
|
popoverLabel = _useEuiI18n2[0],
|
|
102
105
|
colorLabel = _useEuiI18n2[1],
|
|
103
106
|
selectedColorLabel = _useEuiI18n2[2],
|
|
@@ -105,7 +108,16 @@ var EuiColorPicker = exports.EuiColorPicker = function EuiColorPicker(_ref) {
|
|
|
105
108
|
transparent = _useEuiI18n2[4],
|
|
106
109
|
alphaLabel = _useEuiI18n2[5],
|
|
107
110
|
openLabel = _useEuiI18n2[6],
|
|
108
|
-
closeLabel = _useEuiI18n2[7]
|
|
111
|
+
closeLabel = _useEuiI18n2[7],
|
|
112
|
+
ariaLabel = _useEuiI18n2[8];
|
|
113
|
+
var openLabelId = (0, _services.useGeneratedHtmlId)({
|
|
114
|
+
prefix: 'colorPicker',
|
|
115
|
+
suffix: 'openLabel'
|
|
116
|
+
});
|
|
117
|
+
var closeLabelId = (0, _services.useGeneratedHtmlId)({
|
|
118
|
+
prefix: 'colorPicker',
|
|
119
|
+
suffix: 'closeLabel'
|
|
120
|
+
});
|
|
109
121
|
var defaultSwatches = (0, _services.useEuiPaletteColorBlind)();
|
|
110
122
|
var swatches = _swatches !== null && _swatches !== void 0 ? _swatches : defaultSwatches;
|
|
111
123
|
var preferredFormat = (0, _react.useMemo)(function () {
|
|
@@ -434,10 +446,21 @@ var EuiColorPicker = exports.EuiColorPicker = function EuiColorPicker(_ref) {
|
|
|
434
446
|
readOnly: readOnly,
|
|
435
447
|
fullWidth: fullWidth,
|
|
436
448
|
autoComplete: "off",
|
|
437
|
-
"data-test-subj": testSubjAnchor
|
|
438
|
-
|
|
449
|
+
"data-test-subj": testSubjAnchor
|
|
450
|
+
// if an id is provided it might be used in combination with `htmlFor` on a label,
|
|
451
|
+
// so we don't want to override it with a fallback `aria-label`
|
|
452
|
+
,
|
|
453
|
+
"aria-label": _ariaLabel ? _ariaLabel : id || ariaLabelledby ? undefined : ariaLabel,
|
|
454
|
+
"aria-labelledby": ariaLabelledby,
|
|
455
|
+
"aria-describedby": (0, _classnames.default)(isColorSelectorShown ? openLabelId : closeLabelId, ariaDescribedby),
|
|
439
456
|
controlOnly: true // Don't need two EuiFormControlwrappers
|
|
440
|
-
}))
|
|
457
|
+
}), (0, _react2.jsx)(_accessibility.EuiScreenReaderOnly, null, (0, _react2.jsx)("span", null, (0, _react2.jsx)("span", {
|
|
458
|
+
id: openLabelId,
|
|
459
|
+
"aria-hidden": !isColorSelectorShown
|
|
460
|
+
}, openLabel), (0, _react2.jsx)("span", {
|
|
461
|
+
id: closeLabelId,
|
|
462
|
+
"aria-hidden": isColorSelectorShown
|
|
463
|
+
}, closeLabel))));
|
|
441
464
|
}
|
|
442
465
|
return display === 'inline' ? (0, _react2.jsx)("div", {
|
|
443
466
|
css: styles.euiColorPicker,
|
|
@@ -10,6 +10,7 @@ var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"))
|
|
|
10
10
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
11
11
|
var _react = _interopRequireWildcard(require("react"));
|
|
12
12
|
var _services = require("../../../services");
|
|
13
|
+
var _hooks = require("../../../services/hooks");
|
|
13
14
|
var _global_styling = require("../../../global_styling");
|
|
14
15
|
var _cell = require("../body/cell");
|
|
15
16
|
var _focus = require("./focus");
|
|
@@ -37,20 +38,48 @@ var useScroll = exports.useScroll = function useScroll(args) {
|
|
|
37
38
|
scrollCellIntoView = _useScrollCellIntoVie.scrollCellIntoView;
|
|
38
39
|
var _useContext = (0, _react.useContext)(_focus.DataGridFocusContext),
|
|
39
40
|
focusedCell = _useContext.focusedCell;
|
|
40
|
-
var
|
|
41
|
+
var isPointerDownRef = (0, _hooks.useIsPointerDown)(args.outerGridRef);
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Set when `focusedCell` changes while the pointer is held down (e.g. clicking a cell).
|
|
45
|
+
* Allows the `pointerup` listener below to scroll on release without
|
|
46
|
+
* causing snap-back when the user scrolls the grid without changing focus.
|
|
47
|
+
*/
|
|
48
|
+
var pendingScrollRef = (0, _react.useRef)(false);
|
|
49
|
+
(0, _react.useEffect)(function () {
|
|
50
|
+
if (!focusedCell) return;
|
|
51
|
+
if (isPointerDownRef.current) {
|
|
52
|
+
// Pointer is down - defer scroll decision to the pointerup listener
|
|
53
|
+
pendingScrollRef.current = true;
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
scrollCellIntoView({
|
|
57
|
+
rowIndex: focusedCell[1],
|
|
58
|
+
colIndex: focusedCell[0]
|
|
59
|
+
});
|
|
60
|
+
}, [focusedCell, scrollCellIntoView, isPointerDownRef]);
|
|
41
61
|
(0, _react.useEffect)(function () {
|
|
42
|
-
|
|
62
|
+
var handlePointerUp = function handlePointerUp() {
|
|
43
63
|
var _window;
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
64
|
+
if (!pendingScrollRef.current || !focusedCell) return;
|
|
65
|
+
pendingScrollRef.current = false;
|
|
66
|
+
|
|
67
|
+
// Skip if the interaction resulted in text being selected
|
|
68
|
+
if (((_window = window) === null || _window === void 0 || (_window = _window.getSelection()) === null || _window === void 0 ? void 0 : _window.type) === 'Range') return;
|
|
48
69
|
scrollCellIntoView({
|
|
49
70
|
rowIndex: focusedCell[1],
|
|
50
71
|
colIndex: focusedCell[0]
|
|
51
72
|
});
|
|
52
|
-
}
|
|
53
|
-
|
|
73
|
+
};
|
|
74
|
+
document.addEventListener('pointerup', handlePointerUp, {
|
|
75
|
+
capture: true
|
|
76
|
+
});
|
|
77
|
+
return function () {
|
|
78
|
+
return document.removeEventListener('pointerup', handlePointerUp, {
|
|
79
|
+
capture: true
|
|
80
|
+
});
|
|
81
|
+
};
|
|
82
|
+
}, [focusedCell, scrollCellIntoView]);
|
|
54
83
|
var _useContext2 = (0, _react.useContext)(_cell.DataGridCellPopoverContext),
|
|
55
84
|
popoverIsOpen = _useContext2.popoverIsOpen,
|
|
56
85
|
cellLocation = _useContext2.cellLocation;
|
|
@@ -9,6 +9,7 @@ exports.EuiFlyoutOverlay = void 0;
|
|
|
9
9
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
10
10
|
var _react = _interopRequireWildcard(require("react"));
|
|
11
11
|
var _css = require("@emotion/css");
|
|
12
|
+
var _services = require("../../services");
|
|
12
13
|
var _overlay_mask = require("../overlay_mask");
|
|
13
14
|
var _portal = require("../portal");
|
|
14
15
|
var _react2 = require("@emotion/react");
|
|
@@ -26,8 +27,7 @@ var getEuiFlyoutOverlayStyles = function getEuiFlyoutOverlayStyles(zIndex) {
|
|
|
26
27
|
/*
|
|
27
28
|
This needs to have !important to override the default EuiOverlayMask
|
|
28
29
|
z-index based on the headerZindexLocation prop. Using the style attribute
|
|
29
|
-
doesn't work since EuiOverlayMask requires
|
|
30
|
-
causes React errors in the test environment.
|
|
30
|
+
doesn't work since EuiOverlayMask requires the styles to be provided via className
|
|
31
31
|
*/
|
|
32
32
|
return /*#__PURE__*/(0, _css.css)("z-index:", zIndex, "!important;;label:getEuiFlyoutOverlayStyles;");
|
|
33
33
|
};
|
|
@@ -48,10 +48,39 @@ var EuiFlyoutOverlay = exports.EuiFlyoutOverlay = function EuiFlyoutOverlay(_ref
|
|
|
48
48
|
hasOverlayMask = _ref.hasOverlayMask,
|
|
49
49
|
maskZIndex = _ref.maskZIndex,
|
|
50
50
|
_ref$headerZindexLoca = _ref.headerZindexLocation,
|
|
51
|
-
headerZindexLocation = _ref$headerZindexLoca === void 0 ? 'below' : _ref$headerZindexLoca
|
|
51
|
+
headerZindexLocation = _ref$headerZindexLoca === void 0 ? 'below' : _ref$headerZindexLoca,
|
|
52
|
+
containerRect = _ref.containerRect;
|
|
52
53
|
var styles = (0, _react.useMemo)(function () {
|
|
53
54
|
return getEuiFlyoutOverlayStyles(maskZIndex);
|
|
54
55
|
}, [maskZIndex]);
|
|
56
|
+
|
|
57
|
+
// Internal ref so we can apply containerRect positioning directly on the DOM
|
|
58
|
+
// node, avoiding new Emotion CSS class generation on every scroll/resize.
|
|
59
|
+
var internalMaskRef = (0, _react.useRef)(null);
|
|
60
|
+
var combinedMaskRef = (0, _services.useCombinedRefs)([internalMaskRef, maskProps === null || maskProps === void 0 ? void 0 : maskProps.maskRef]);
|
|
61
|
+
(0, _react.useEffect)(function () {
|
|
62
|
+
var node = internalMaskRef.current;
|
|
63
|
+
if (!node) return;
|
|
64
|
+
|
|
65
|
+
// containerRect positioning must be applied via node.style.setProperty rather than
|
|
66
|
+
// through the style prop - EuiOverlayMask requires styles to be passed via className
|
|
67
|
+
if (containerRect) {
|
|
68
|
+
node.style.setProperty('inset-block-start', "".concat(containerRect.top, "px"));
|
|
69
|
+
node.style.setProperty('inset-inline-start', "".concat(containerRect.left, "px"));
|
|
70
|
+
node.style.setProperty('inline-size', "".concat(containerRect.width, "px"));
|
|
71
|
+
node.style.setProperty('block-size', "".concat(containerRect.height, "px"));
|
|
72
|
+
node.style.setProperty('inset-inline-end', 'auto');
|
|
73
|
+
node.style.setProperty('inset-block-end', 'auto');
|
|
74
|
+
} else {
|
|
75
|
+
node.style.removeProperty('inset-block-start');
|
|
76
|
+
node.style.removeProperty('inset-inline-start');
|
|
77
|
+
node.style.removeProperty('inline-size');
|
|
78
|
+
node.style.removeProperty('block-size');
|
|
79
|
+
node.style.removeProperty('inset-inline-end');
|
|
80
|
+
node.style.removeProperty('inset-block-end');
|
|
81
|
+
}
|
|
82
|
+
}, [containerRect, hasOverlayMask]); // toggling ownFocus while the flyout is already open should cause re-render
|
|
83
|
+
|
|
55
84
|
var content = children;
|
|
56
85
|
if (!isPushed || hasOverlayMask) {
|
|
57
86
|
content = (0, _react2.jsx)(_portal.EuiPortal, null, content);
|
|
@@ -60,6 +89,7 @@ var EuiFlyoutOverlay = exports.EuiFlyoutOverlay = function EuiFlyoutOverlay(_ref
|
|
|
60
89
|
return (0, _react2.jsx)(_react.default.Fragment, null, hasOverlayMask && (0, _react2.jsx)(_overlay_mask.EuiOverlayMask, (0, _extends2.default)({
|
|
61
90
|
headerZindexLocation: (_maskProps$headerZind = maskProps === null || maskProps === void 0 ? void 0 : maskProps.headerZindexLocation) !== null && _maskProps$headerZind !== void 0 ? _maskProps$headerZind : headerZindexLocation
|
|
62
91
|
}, maskProps, {
|
|
92
|
+
maskRef: combinedMaskRef,
|
|
63
93
|
className: classes
|
|
64
94
|
})), content);
|
|
65
95
|
};
|
|
@@ -33,7 +33,7 @@ var _use_flyout_z_index = require("./use_flyout_z_index");
|
|
|
33
33
|
var _flyout_parent_context = require("./flyout_parent_context");
|
|
34
34
|
var _use_flyout_menu = require("./use_flyout_menu");
|
|
35
35
|
var _react2 = require("@emotion/react");
|
|
36
|
-
var _excluded = ["className", "children", "as", "hideCloseButton", "flyoutMenuProps", "flyoutMenuDisplayMode", "closeButtonProps", "closeButtonPosition", "onClose", "ownFocus", "side", "size", "paddingSize", "maxWidth", "style", "hasChildBackground", "maskProps", "type", "outsideClickCloses", "pushMinBreakpoint", "pushAnimation", "focusTrapProps", "includeFixedHeadersInFocusTrap", "includeSelectorInFocusTrap", "aria-describedby", "aria-labelledby", "id", "resizable", "minWidth", "onResize", "onAnimationEnd", "container"];
|
|
36
|
+
var _excluded = ["className", "children", "as", "hideCloseButton", "flyoutMenuProps", "flyoutMenuDisplayMode", "closeButtonProps", "closeButtonPosition", "onClose", "ownFocus", "side", "size", "paddingSize", "maxWidth", "style", "hasChildBackground", "maskProps", "type", "outsideClickCloses", "pushMinBreakpoint", "pushAnimation", "hasAnimation", "focusTrapProps", "includeFixedHeadersInFocusTrap", "includeSelectorInFocusTrap", "aria-describedby", "aria-labelledby", "id", "resizable", "minWidth", "onResize", "onAnimationEnd", "container"];
|
|
37
37
|
/*
|
|
38
38
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
39
39
|
* or more contributor license agreements. Licensed under the Elastic License
|
|
@@ -96,23 +96,25 @@ var EuiFlyoutComponent = exports.EuiFlyoutComponent = /*#__PURE__*/(0, _react.fo
|
|
|
96
96
|
outsideClickCloses = _usePropsWithComponen.outsideClickCloses,
|
|
97
97
|
_usePropsWithComponen12 = _usePropsWithComponen.pushMinBreakpoint,
|
|
98
98
|
pushMinBreakpoint = _usePropsWithComponen12 === void 0 ? _const2.DEFAULT_PUSH_MIN_BREAKPOINT : _usePropsWithComponen12,
|
|
99
|
-
|
|
100
|
-
|
|
99
|
+
_pushAnimation = _usePropsWithComponen.pushAnimation,
|
|
100
|
+
_hasAnimation = _usePropsWithComponen.hasAnimation,
|
|
101
101
|
_focusTrapProps = _usePropsWithComponen.focusTrapProps,
|
|
102
|
-
|
|
103
|
-
includeFixedHeadersInFocusTrap =
|
|
102
|
+
_usePropsWithComponen13 = _usePropsWithComponen.includeFixedHeadersInFocusTrap,
|
|
103
|
+
includeFixedHeadersInFocusTrap = _usePropsWithComponen13 === void 0 ? true : _usePropsWithComponen13,
|
|
104
104
|
includeSelectorInFocusTrap = _usePropsWithComponen.includeSelectorInFocusTrap,
|
|
105
105
|
_ariaDescribedBy = _usePropsWithComponen['aria-describedby'],
|
|
106
106
|
_ariaLabelledBy = _usePropsWithComponen['aria-labelledby'],
|
|
107
107
|
id = _usePropsWithComponen.id,
|
|
108
|
-
|
|
109
|
-
resizable =
|
|
108
|
+
_usePropsWithComponen14 = _usePropsWithComponen.resizable,
|
|
109
|
+
resizable = _usePropsWithComponen14 === void 0 ? false : _usePropsWithComponen14,
|
|
110
110
|
minWidth = _usePropsWithComponen.minWidth,
|
|
111
111
|
onResize = _usePropsWithComponen.onResize,
|
|
112
112
|
onAnimationEnd = _usePropsWithComponen.onAnimationEnd,
|
|
113
113
|
containerProp = _usePropsWithComponen.container,
|
|
114
114
|
rest = (0, _objectWithoutProperties2.default)(_usePropsWithComponen, _excluded);
|
|
115
115
|
var container = resolveContainer(containerProp);
|
|
116
|
+
var hasAnimationDefault = type === 'overlay';
|
|
117
|
+
var hasAnimation = _hasAnimation !== null && _hasAnimation !== void 0 ? _hasAnimation : hasAnimationDefault;
|
|
116
118
|
var _useEuiThemeCSSVariab = (0, _services.useEuiThemeCSSVariables)(),
|
|
117
119
|
setGlobalCSSVariables = _useEuiThemeCSSVariab.setGlobalCSSVariables;
|
|
118
120
|
var Element = as || defaultElement;
|
|
@@ -533,7 +535,7 @@ var EuiFlyoutComponent = exports.EuiFlyoutComponent = /*#__PURE__*/(0, _react.fo
|
|
|
533
535
|
return _objectSpread(_objectSpread(_objectSpread({}, style), composedStyles), containerPositionStyles);
|
|
534
536
|
}, [style, size, layoutMode, siblingFlyoutId, siblingFlyoutWidth, maxWidth, flyoutZIndex, containerRect, side, isChildFlyout]);
|
|
535
537
|
var styles = (0, _services.useEuiMemoizedStyles)(_flyout.euiFlyoutStyles);
|
|
536
|
-
var cssStyles = [styles.euiFlyout, styles.paddingSizes[paddingSize], (0, _const2.isEuiFlyoutSizeNamed)(size) && styles[size], maxWidth === false && styles.noMaxWidth, isPushed ? styles.push.push : styles.overlay.overlay, isPushed ? styles.push[side] : styles.overlay[side],
|
|
538
|
+
var cssStyles = [styles.euiFlyout, styles.paddingSizes[paddingSize], (0, _const2.isEuiFlyoutSizeNamed)(size) && styles[size], maxWidth === false && styles.noMaxWidth, isPushed ? styles.push.push : styles.overlay.overlay, isPushed ? styles.push[side] : styles.overlay[side], !hasAnimation && styles.noAnimation, styles[side]];
|
|
537
539
|
var classes = (0, _classnames.default)('euiFlyout', isChildFlyout && hasChildBackground && 'euiFlyout--hasChildBackground', className);
|
|
538
540
|
var flyoutToggle = (0, _react.useRef)(document.activeElement);
|
|
539
541
|
var _useState5 = (0, _react.useState)([]),
|
|
@@ -669,8 +671,10 @@ var EuiFlyoutComponent = exports.EuiFlyoutComponent = /*#__PURE__*/(0, _react.fo
|
|
|
669
671
|
isPushed: isPushed,
|
|
670
672
|
maskZIndex: maskZIndex,
|
|
671
673
|
headerZindexLocation: effectiveHeaderZindexLocation,
|
|
674
|
+
containerRect: containerRect,
|
|
672
675
|
maskProps: _objectSpread(_objectSpread({}, maskProps), {}, {
|
|
673
|
-
maskRef: maskCombinedRefs
|
|
676
|
+
maskRef: maskCombinedRefs,
|
|
677
|
+
hasAnimation: hasAnimation
|
|
674
678
|
})
|
|
675
679
|
}, (0, _react2.jsx)(_services.EuiWindowEvent, {
|
|
676
680
|
event: "keydown",
|
|
@@ -47,7 +47,7 @@ var _flyout_parent_context = require("./flyout_parent_context");
|
|
|
47
47
|
var _const = require("./manager/const");
|
|
48
48
|
var _react2 = require("@emotion/react");
|
|
49
49
|
var _const2 = require("./const");
|
|
50
|
-
var _excluded = ["as", "onClose", "onActive", "session"];
|
|
50
|
+
var _excluded = ["as", "onClose", "onActive", "session", "historyKey"];
|
|
51
51
|
/*
|
|
52
52
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
53
53
|
* or more contributor license agreements. Licensed under the Elastic License
|
|
@@ -63,6 +63,7 @@ var EuiFlyout = exports.EuiFlyout = /*#__PURE__*/(0, _react.forwardRef)(function
|
|
|
63
63
|
onClose = _usePropsWithComponen.onClose,
|
|
64
64
|
onActive = _usePropsWithComponen.onActive,
|
|
65
65
|
session = _usePropsWithComponen.session,
|
|
66
|
+
historyKey = _usePropsWithComponen.historyKey,
|
|
66
67
|
rest = (0, _objectWithoutProperties2.default)(_usePropsWithComponen, _excluded);
|
|
67
68
|
var hasActiveSession = (0, _manager.useHasActiveSession)();
|
|
68
69
|
var isInsideParentFlyout = (0, _flyout_parent_context.useIsInsideParentFlyout)();
|
|
@@ -89,6 +90,7 @@ var EuiFlyout = exports.EuiFlyout = /*#__PURE__*/(0, _react.forwardRef)(function
|
|
|
89
90
|
return null;
|
|
90
91
|
}
|
|
91
92
|
return (0, _react2.jsx)(_manager.EuiFlyoutMain, (0, _extends2.default)({}, rest, {
|
|
93
|
+
historyKey: historyKey,
|
|
92
94
|
onClose: onClose,
|
|
93
95
|
onActive: onActive,
|
|
94
96
|
as: "div",
|
|
@@ -99,6 +101,7 @@ var EuiFlyout = exports.EuiFlyout = /*#__PURE__*/(0, _react.forwardRef)(function
|
|
|
99
101
|
// session=inherit: auto-join existing session as child
|
|
100
102
|
if (hasActiveSession && effectiveSession === _const.SESSION_INHERIT) {
|
|
101
103
|
return (0, _react2.jsx)(_manager.EuiFlyoutChild, (0, _extends2.default)({}, rest, {
|
|
104
|
+
historyKey: historyKey,
|
|
102
105
|
onClose: onClose,
|
|
103
106
|
onActive: onActive,
|
|
104
107
|
as: "div",
|
|
@@ -74,9 +74,9 @@ var euiFlyoutStyles = exports.euiFlyoutStyles = function euiFlyoutStyles(euiThem
|
|
|
74
74
|
push: {
|
|
75
75
|
push: /*#__PURE__*/(0, _react.css)("clip-path:none;z-index:", Number(euiTheme.levels.flyout) - 1, ";;label:push;"),
|
|
76
76
|
right: /*#__PURE__*/(0, _react.css)((0, _global_styling.logicalCSS)('border-left', euiTheme.border.thick), ";;label:right;"),
|
|
77
|
-
left: /*#__PURE__*/(0, _react.css)((0, _global_styling.logicalCSS)('border-right', euiTheme.border.thick), ";;label:left;")
|
|
78
|
-
noAnimation: _ref
|
|
77
|
+
left: /*#__PURE__*/(0, _react.css)((0, _global_styling.logicalCSS)('border-right', euiTheme.border.thick), ";;label:left;")
|
|
79
78
|
},
|
|
79
|
+
noAnimation: _ref,
|
|
80
80
|
// Padding
|
|
81
81
|
paddingSizes: {
|
|
82
82
|
none: /*#__PURE__*/(0, _react.css)(composeFlyoutPadding(euiThemeContext, 'none'), ";;label:none;"),
|
|
@@ -22,7 +22,7 @@ var _flyout_menu = require("./flyout_menu.styles");
|
|
|
22
22
|
var _flyout_menu_context = require("./flyout_menu_context");
|
|
23
23
|
var _i18n = require("../i18n");
|
|
24
24
|
var _react2 = require("@emotion/react");
|
|
25
|
-
var _excluded = ["className", "title", "titleId", "hideTitle", "hideCloseButton", "historyItems", "showBackButton", "backButtonProps", "customActions"];
|
|
25
|
+
var _excluded = ["className", "title", "titleId", "hideTitle", "hideCloseButton", "historyItems", "showBackButton", "backButtonProps", "customActions", "iconType"];
|
|
26
26
|
/*
|
|
27
27
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
28
28
|
* or more contributor license agreements. Licensed under the Elastic License
|
|
@@ -113,6 +113,7 @@ var EuiFlyoutMenu = exports.EuiFlyoutMenu = function EuiFlyoutMenu(_ref2) {
|
|
|
113
113
|
showBackButton = _ref2.showBackButton,
|
|
114
114
|
backButtonProps = _ref2.backButtonProps,
|
|
115
115
|
customActions = _ref2.customActions,
|
|
116
|
+
_iconType = _ref2.iconType,
|
|
116
117
|
rest = (0, _objectWithoutProperties2.default)(_ref2, _excluded);
|
|
117
118
|
var _useContext = (0, _react.useContext)(_flyout_menu_context.EuiFlyoutMenuContext),
|
|
118
119
|
onClose = _useContext.onClose;
|
|
@@ -75,19 +75,22 @@ var ACTION_CLOSE_UNMANAGED_FLYOUT = exports.ACTION_CLOSE_UNMANAGED_FLYOUT = "".c
|
|
|
75
75
|
* - `title` is used for the flyout menu.
|
|
76
76
|
* - `level` determines whether the flyout is `main` or `child`.
|
|
77
77
|
* - Optional `size` is the named EUI size (e.g. `s`, `m`, `l`).
|
|
78
|
+
* - Optional `historyKey` (Symbol) scopes history; only flyouts with the same reference share Back/history. Omit for a unique group per session.
|
|
78
79
|
* - Optional `iconType` is shown next to the session title in the history menu.
|
|
79
80
|
*/
|
|
80
81
|
var addFlyout = exports.addFlyout = function addFlyout(flyoutId, title) {
|
|
81
82
|
var level = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : _const.LEVEL_MAIN;
|
|
82
83
|
var size = arguments.length > 3 ? arguments[3] : undefined;
|
|
83
|
-
var
|
|
84
|
-
var
|
|
84
|
+
var historyKey = arguments.length > 4 ? arguments[4] : undefined;
|
|
85
|
+
var iconType = arguments.length > 5 ? arguments[5] : undefined;
|
|
86
|
+
var minWidth = arguments.length > 6 ? arguments[6] : undefined;
|
|
85
87
|
return {
|
|
86
88
|
type: ACTION_ADD,
|
|
87
89
|
flyoutId: flyoutId,
|
|
88
90
|
title: title,
|
|
89
91
|
level: level,
|
|
90
92
|
size: size,
|
|
93
|
+
historyKey: historyKey,
|
|
91
94
|
iconType: iconType,
|
|
92
95
|
minWidth: minWidth
|
|
93
96
|
};
|
|
@@ -26,7 +26,7 @@ var _selectors = require("./selectors");
|
|
|
26
26
|
var _store = require("./store");
|
|
27
27
|
var _validation = require("./validation");
|
|
28
28
|
var _react2 = require("@emotion/react");
|
|
29
|
-
var _excluded = ["id", "onClose", "onActive", "level", "size", "minWidth", "css", "flyoutMenuProps"];
|
|
29
|
+
var _excluded = ["id", "onClose", "onActive", "level", "size", "minWidth", "historyKey", "css", "flyoutMenuProps"];
|
|
30
30
|
/*
|
|
31
31
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
32
32
|
* or more contributor license agreements. Licensed under the Elastic License
|
|
@@ -66,6 +66,7 @@ var EuiManagedFlyout = exports.EuiManagedFlyout = /*#__PURE__*/(0, _react.forwar
|
|
|
66
66
|
level = _ref.level,
|
|
67
67
|
sizeProp = _ref.size,
|
|
68
68
|
minWidth = _ref.minWidth,
|
|
69
|
+
historyKey = _ref.historyKey,
|
|
69
70
|
customCss = _ref.css,
|
|
70
71
|
_flyoutMenuProps = _ref.flyoutMenuProps,
|
|
71
72
|
props = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
@@ -164,7 +165,7 @@ var EuiManagedFlyout = exports.EuiManagedFlyout = /*#__PURE__*/(0, _react.forwar
|
|
|
164
165
|
// Register with flyout manager context when open, remove when closed
|
|
165
166
|
// Using useLayoutEffect to run synchronously before DOM updates
|
|
166
167
|
(0, _react.useLayoutEffect)(function () {
|
|
167
|
-
addFlyout(flyoutId, title, level, size, _flyoutMenuProps === null || _flyoutMenuProps === void 0 ? void 0 : _flyoutMenuProps.iconType, typeof minWidth === 'number' ? minWidth : undefined);
|
|
168
|
+
addFlyout(flyoutId, title, level, size, level === _const.LEVEL_MAIN ? historyKey : undefined, _flyoutMenuProps === null || _flyoutMenuProps === void 0 ? void 0 : _flyoutMenuProps.iconType, typeof minWidth === 'number' ? minWidth : undefined);
|
|
168
169
|
return function () {
|
|
169
170
|
var currentStoreState = (0, _store.getFlyoutManagerStore)().getState();
|
|
170
171
|
var stillInStore = currentStoreState.flyouts.some(function (f) {
|
|
@@ -180,7 +181,7 @@ var EuiManagedFlyout = exports.EuiManagedFlyout = /*#__PURE__*/(0, _react.forwar
|
|
|
180
181
|
}
|
|
181
182
|
wasRegisteredRef.current = false;
|
|
182
183
|
};
|
|
183
|
-
}, [flyoutId, title, level, size, minWidth, _flyoutMenuProps === null || _flyoutMenuProps === void 0 ? void 0 : _flyoutMenuProps.iconType, addFlyout, closeFlyout, closeAllFlyouts]);
|
|
184
|
+
}, [flyoutId, title, level, size, minWidth, historyKey, _flyoutMenuProps === null || _flyoutMenuProps === void 0 ? void 0 : _flyoutMenuProps.iconType, addFlyout, closeFlyout, closeAllFlyouts]);
|
|
184
185
|
|
|
185
186
|
// Detect when flyout has been removed from manager state (e.g., via Back button)
|
|
186
187
|
// and trigger onClose callback to notify the parent component
|