@elastic/eui 69.0.0 → 70.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/eui_theme_dark.css +0 -375
- package/dist/eui_theme_dark.json +0 -27
- package/dist/eui_theme_dark.json.d.ts +0 -27
- package/dist/eui_theme_dark.min.css +1 -1
- package/dist/eui_theme_light.css +0 -375
- package/dist/eui_theme_light.json +0 -27
- package/dist/eui_theme_light.json.d.ts +0 -27
- package/dist/eui_theme_light.min.css +1 -1
- package/es/components/basic_table/in_memory_table.js +8 -2
- package/es/components/code/code.js +7 -3
- package/es/components/code/code.styles.js +32 -0
- package/es/components/code/code_block.js +72 -315
- package/es/components/code/code_block.styles.js +153 -0
- package/es/components/code/code_block_controls.js +29 -0
- package/es/components/code/code_block_controls.styles.js +43 -0
- package/es/components/code/code_block_copy.js +65 -0
- package/es/components/code/code_block_full_screen.js +90 -0
- package/es/components/code/code_block_line.styles.js +49 -0
- package/es/components/code/code_block_overflow.js +78 -0
- package/es/components/code/code_block_virtualized.js +59 -0
- package/es/components/code/code_syntax.styles.js +43 -0
- package/es/components/code/utils.js +43 -37
- package/es/components/collapsible_nav/collapsible_nav.js +0 -5
- package/es/components/overlay_mask/overlay_mask.js +8 -14
- package/es/components/overlay_mask/overlay_mask.styles.js +4 -14
- package/es/components/overlay_mask/overlay_mask_body.styles.js +18 -0
- package/es/components/provider/provider.js +1 -5
- package/es/components/resizable_container/helpers.js +2 -2
- package/es/components/resizable_container/resizable_container.js +6 -9
- package/es/components/resizable_container/resizable_container.styles.js +28 -0
- package/es/components/resizable_container/resizable_panel.js +25 -48
- package/es/components/resizable_container/resizable_panel.styles.js +69 -0
- package/es/components/search_bar/query/ast.js +14 -3
- package/es/components/tool_tip/tool_tip.js +3 -2
- package/es/components/tool_tip/tool_tip.styles.js +17 -22
- package/es/components/tool_tip/tool_tip_arrow.js +17 -3
- package/es/components/tool_tip/tool_tip_popover.js +7 -7
- package/es/components/tour/tour.styles.js +4 -3
- package/es/components/tour/tour_step.js +7 -5
- package/es/global_styling/functions/logicals.js +5 -3
- package/es/global_styling/functions/math.js +37 -19
- package/es/global_styling/mixins/_padding.js +13 -9
- package/eui.d.ts +291 -37
- package/i18ntokens.json +22 -22
- package/lib/components/basic_table/in_memory_table.js +8 -2
- package/lib/components/code/code.js +9 -3
- package/lib/components/code/code.styles.js +35 -0
- package/lib/components/code/code_block.js +72 -320
- package/lib/components/code/code_block.styles.js +154 -0
- package/lib/components/code/code_block_controls.js +48 -0
- package/lib/components/code/code_block_controls.styles.js +39 -0
- package/lib/components/code/code_block_copy.js +78 -0
- package/lib/components/code/code_block_full_screen.js +108 -0
- package/lib/components/code/code_block_line.styles.js +45 -0
- package/lib/components/code/code_block_overflow.js +82 -0
- package/lib/components/code/code_block_virtualized.js +72 -0
- package/lib/components/code/code_syntax.styles.js +57 -0
- package/lib/components/code/utils.js +40 -39
- package/lib/components/collapsible_nav/collapsible_nav.js +0 -5
- package/lib/components/overlay_mask/overlay_mask.js +9 -14
- package/lib/components/overlay_mask/overlay_mask.styles.js +13 -17
- package/lib/components/overlay_mask/overlay_mask_body.styles.js +20 -0
- package/lib/components/provider/provider.js +7 -12
- package/lib/components/resizable_container/helpers.js +2 -2
- package/lib/components/resizable_container/resizable_container.js +7 -9
- package/lib/components/resizable_container/resizable_container.styles.js +31 -0
- package/lib/components/resizable_container/resizable_panel.js +28 -49
- package/lib/components/resizable_container/resizable_panel.styles.js +74 -0
- package/lib/components/search_bar/query/ast.js +14 -3
- package/lib/components/tool_tip/tool_tip.js +3 -2
- package/lib/components/tool_tip/tool_tip.styles.js +18 -26
- package/lib/components/tool_tip/tool_tip_arrow.js +19 -4
- package/lib/components/tool_tip/tool_tip_popover.js +6 -6
- package/lib/components/tour/tour.styles.js +3 -2
- package/lib/components/tour/tour_step.js +7 -5
- package/lib/global_styling/functions/logicals.js +5 -3
- package/lib/global_styling/functions/math.js +37 -19
- package/lib/global_styling/mixins/_padding.js +17 -10
- package/optimize/es/components/basic_table/in_memory_table.js +1 -1
- package/optimize/es/components/code/code.js +7 -3
- package/optimize/es/components/code/code.styles.js +32 -0
- package/optimize/es/components/code/code_block.js +70 -299
- package/optimize/es/components/code/code_block.styles.js +153 -0
- package/optimize/es/components/code/code_block_controls.js +29 -0
- package/optimize/es/components/code/code_block_controls.styles.js +43 -0
- package/optimize/es/components/code/code_block_copy.js +55 -0
- package/optimize/es/components/code/code_block_full_screen.js +80 -0
- package/optimize/es/components/code/code_block_line.styles.js +49 -0
- package/optimize/es/components/code/code_block_overflow.js +67 -0
- package/optimize/es/components/code/code_block_virtualized.js +59 -0
- package/optimize/es/components/code/code_syntax.styles.js +43 -0
- package/optimize/es/components/code/utils.js +43 -37
- package/optimize/es/components/overlay_mask/overlay_mask.js +8 -9
- package/optimize/es/components/overlay_mask/overlay_mask.styles.js +4 -14
- package/optimize/es/components/overlay_mask/overlay_mask_body.styles.js +18 -0
- package/optimize/es/components/provider/provider.js +1 -5
- package/optimize/es/components/resizable_container/helpers.js +2 -2
- package/optimize/es/components/resizable_container/resizable_container.js +6 -9
- package/optimize/es/components/resizable_container/resizable_container.styles.js +28 -0
- package/optimize/es/components/resizable_container/resizable_panel.js +25 -48
- package/optimize/es/components/resizable_container/resizable_panel.styles.js +69 -0
- package/optimize/es/components/search_bar/query/ast.js +14 -3
- package/optimize/es/components/tool_tip/tool_tip.js +3 -2
- package/optimize/es/components/tool_tip/tool_tip.styles.js +17 -22
- package/optimize/es/components/tool_tip/tool_tip_arrow.js +9 -3
- package/optimize/es/components/tool_tip/tool_tip_popover.js +7 -7
- package/optimize/es/components/tour/tour.styles.js +4 -3
- package/optimize/es/components/tour/tour_step.js +7 -5
- package/optimize/es/global_styling/functions/logicals.js +5 -3
- package/optimize/es/global_styling/functions/math.js +35 -17
- package/optimize/es/global_styling/mixins/_padding.js +13 -9
- package/optimize/lib/components/basic_table/in_memory_table.js +1 -1
- package/optimize/lib/components/code/code.js +9 -3
- package/optimize/lib/components/code/code.styles.js +35 -0
- package/optimize/lib/components/code/code_block.js +71 -306
- package/optimize/lib/components/code/code_block.styles.js +156 -0
- package/optimize/lib/components/code/code_block_controls.js +48 -0
- package/optimize/lib/components/code/code_block_controls.styles.js +39 -0
- package/optimize/lib/components/code/code_block_copy.js +78 -0
- package/optimize/lib/components/code/code_block_full_screen.js +108 -0
- package/optimize/lib/components/code/code_block_line.styles.js +45 -0
- package/optimize/lib/components/code/code_block_overflow.js +82 -0
- package/optimize/lib/components/code/code_block_virtualized.js +81 -0
- package/optimize/lib/components/code/code_syntax.styles.js +57 -0
- package/optimize/lib/components/code/utils.js +40 -37
- package/optimize/lib/components/overlay_mask/overlay_mask.js +9 -9
- package/optimize/lib/components/overlay_mask/overlay_mask.styles.js +13 -17
- package/optimize/lib/components/overlay_mask/overlay_mask_body.styles.js +20 -0
- package/optimize/lib/components/provider/provider.js +7 -12
- package/optimize/lib/components/resizable_container/helpers.js +2 -2
- package/optimize/lib/components/resizable_container/resizable_container.js +7 -9
- package/optimize/lib/components/resizable_container/resizable_container.styles.js +31 -0
- package/optimize/lib/components/resizable_container/resizable_panel.js +28 -49
- package/optimize/lib/components/resizable_container/resizable_panel.styles.js +76 -0
- package/optimize/lib/components/search_bar/query/ast.js +14 -3
- package/optimize/lib/components/tool_tip/tool_tip.js +3 -2
- package/optimize/lib/components/tool_tip/tool_tip.styles.js +18 -26
- package/optimize/lib/components/tool_tip/tool_tip_arrow.js +10 -10
- package/optimize/lib/components/tool_tip/tool_tip_popover.js +6 -6
- package/optimize/lib/components/tour/tour.styles.js +3 -2
- package/optimize/lib/components/tour/tour_step.js +7 -5
- package/optimize/lib/global_styling/functions/logicals.js +4 -10
- package/optimize/lib/global_styling/functions/math.js +37 -19
- package/optimize/lib/global_styling/mixins/_padding.js +17 -10
- package/package.json +8 -7
- package/src/components/index.scss +0 -1
- package/src/components/resizable_container/_index.scss +0 -2
- package/src/global_styling/mixins/_header.scss +1 -1
- package/src/global_styling/variables/_index.scss +0 -1
- package/src/themes/amsterdam/overrides/_index.scss +0 -1
- package/test-env/components/basic_table/in_memory_table.js +8 -2
- package/test-env/components/code/code.styles.js +35 -0
- package/test-env/components/code/code_block.styles.js +156 -0
- package/test-env/components/code/code_block_controls.js +48 -0
- package/test-env/components/code/code_block_controls.styles.js +39 -0
- package/test-env/components/code/code_block_copy.js +78 -0
- package/test-env/components/code/code_block_full_screen.js +108 -0
- package/test-env/components/code/code_block_line.styles.js +45 -0
- package/test-env/components/code/code_block_overflow.js +82 -0
- package/test-env/components/code/code_block_virtualized.js +81 -0
- package/test-env/components/code/code_syntax.styles.js +57 -0
- package/test-env/components/code/utils.js +40 -37
- package/test-env/components/collapsible_nav/collapsible_nav.js +0 -5
- package/test-env/components/overlay_mask/overlay_mask.js +9 -14
- package/test-env/components/overlay_mask/overlay_mask.styles.js +13 -17
- package/test-env/components/overlay_mask/overlay_mask_body.styles.js +20 -0
- package/test-env/components/provider/provider.js +7 -12
- package/test-env/components/resizable_container/helpers.js +2 -2
- package/test-env/components/resizable_container/resizable_container.js +7 -9
- package/test-env/components/resizable_container/resizable_container.styles.js +31 -0
- package/test-env/components/resizable_container/resizable_panel.js +28 -49
- package/test-env/components/resizable_container/resizable_panel.styles.js +76 -0
- package/test-env/components/search_bar/query/ast.js +14 -3
- package/test-env/components/tool_tip/tool_tip.js +3 -2
- package/test-env/components/tool_tip/tool_tip.styles.js +18 -26
- package/test-env/components/tool_tip/tool_tip_arrow.js +16 -11
- package/test-env/components/tool_tip/tool_tip_popover.js +6 -6
- package/test-env/components/tour/tour.styles.js +3 -2
- package/test-env/components/tour/tour_step.js +7 -5
- package/test-env/global_styling/functions/logicals.js +4 -10
- package/test-env/global_styling/functions/math.js +37 -19
- package/test-env/global_styling/mixins/_padding.js +17 -10
- package/src/components/code/_code.scss +0 -15
- package/src/components/code/_code_block.scss +0 -177
- package/src/components/code/_index.scss +0 -4
- package/src/components/code/_mixins.scss +0 -127
- package/src/components/code/_variables.scss +0 -5
- package/src/components/resizable_container/_resizable_container.scss +0 -8
- package/src/components/resizable_container/_resizable_panel.scss +0 -51
- package/src/global_styling/variables/_colors_code.scss +0 -23
- package/src/themes/amsterdam/overrides/_code.scss +0 -9
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
|
+
|
|
3
|
+
/*
|
|
4
|
+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
5
|
+
* or more contributor license agreements. Licensed under the Elastic License
|
|
6
|
+
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
|
7
|
+
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
8
|
+
* Side Public License, v 1.
|
|
9
|
+
*/
|
|
10
|
+
import React, { useMemo } from 'react';
|
|
11
|
+
import { useInnerText } from '../inner_text';
|
|
12
|
+
import { EuiCopy } from '../copy';
|
|
13
|
+
import { useEuiI18n } from '../i18n';
|
|
14
|
+
import { EuiButtonIcon } from '../button';
|
|
15
|
+
/**
|
|
16
|
+
* Hook that returns copy-related state/logic/utils
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
20
|
+
export var useCopy = function useCopy(_ref) {
|
|
21
|
+
var isCopyable = _ref.isCopyable,
|
|
22
|
+
isVirtualized = _ref.isVirtualized,
|
|
23
|
+
children = _ref.children;
|
|
24
|
+
|
|
25
|
+
var _useInnerText = useInnerText(''),
|
|
26
|
+
_useInnerText2 = _slicedToArray(_useInnerText, 2),
|
|
27
|
+
innerTextRef = _useInnerText2[0],
|
|
28
|
+
_innerText = _useInnerText2[1];
|
|
29
|
+
|
|
30
|
+
var innerText = useMemo(function () {
|
|
31
|
+
return (_innerText === null || _innerText === void 0 ? void 0 : _innerText.replace(/[\r\n?]{2}|\n\n/g, '\n')) || '';
|
|
32
|
+
}, [_innerText]);
|
|
33
|
+
var textToCopy = isVirtualized ? "".concat(children) : innerText; // Virtualized code blocks do not have inner text
|
|
34
|
+
|
|
35
|
+
var showCopyButton = isCopyable && textToCopy;
|
|
36
|
+
var copyAriaLabel = useEuiI18n('euiCodeBlockCopy.copy', 'Copy');
|
|
37
|
+
var copyButton = useMemo(function () {
|
|
38
|
+
return showCopyButton ? ___EmotionJSX("div", {
|
|
39
|
+
className: "euiCodeBlock__copyButton"
|
|
40
|
+
}, ___EmotionJSX(EuiCopy, {
|
|
41
|
+
textToCopy: textToCopy
|
|
42
|
+
}, function (copy) {
|
|
43
|
+
return ___EmotionJSX(EuiButtonIcon, {
|
|
44
|
+
onClick: copy,
|
|
45
|
+
iconType: "copyClipboard",
|
|
46
|
+
color: "text",
|
|
47
|
+
"aria-label": copyAriaLabel
|
|
48
|
+
});
|
|
49
|
+
})) : null;
|
|
50
|
+
}, [showCopyButton, textToCopy, copyAriaLabel]);
|
|
51
|
+
return {
|
|
52
|
+
innerTextRef: innerTextRef,
|
|
53
|
+
copyButton: copyButton
|
|
54
|
+
};
|
|
55
|
+
};
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
|
+
|
|
3
|
+
/*
|
|
4
|
+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
5
|
+
* or more contributor license agreements. Licensed under the Elastic License
|
|
6
|
+
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
|
7
|
+
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
8
|
+
* Side Public License, v 1.
|
|
9
|
+
*/
|
|
10
|
+
import React, { useState, useCallback, useMemo } from 'react';
|
|
11
|
+
import { keys, useEuiTheme } from '../../services';
|
|
12
|
+
import { useEuiI18n } from '../i18n';
|
|
13
|
+
import { EuiButtonIcon } from '../button';
|
|
14
|
+
import { EuiFocusTrap } from '../focus_trap';
|
|
15
|
+
import { EuiOverlayMask } from '../overlay_mask';
|
|
16
|
+
import { euiCodeBlockStyles } from './code_block.styles';
|
|
17
|
+
/**
|
|
18
|
+
* Hook that returns fullscreen-related state/logic/utils
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
22
|
+
export var useFullScreen = function useFullScreen(_ref) {
|
|
23
|
+
var overflowHeight = _ref.overflowHeight;
|
|
24
|
+
var showFullScreenButton = !!overflowHeight;
|
|
25
|
+
|
|
26
|
+
var _useState = useState(false),
|
|
27
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
28
|
+
isFullScreen = _useState2[0],
|
|
29
|
+
setIsFullScreen = _useState2[1];
|
|
30
|
+
|
|
31
|
+
var toggleFullScreen = useCallback(function () {
|
|
32
|
+
setIsFullScreen(function (isFullScreen) {
|
|
33
|
+
return !isFullScreen;
|
|
34
|
+
});
|
|
35
|
+
}, []);
|
|
36
|
+
var onKeyDown = useCallback(function (event) {
|
|
37
|
+
if (event.key === keys.ESCAPE) {
|
|
38
|
+
event.preventDefault();
|
|
39
|
+
event.stopPropagation();
|
|
40
|
+
setIsFullScreen(false);
|
|
41
|
+
}
|
|
42
|
+
}, []);
|
|
43
|
+
|
|
44
|
+
var _useEuiI18n = useEuiI18n(['euiCodeBlockFullScreen.fullscreenCollapse', 'euiCodeBlockFullScreen.fullscreenExpand'], ['Collapse', 'Expand']),
|
|
45
|
+
_useEuiI18n2 = _slicedToArray(_useEuiI18n, 2),
|
|
46
|
+
fullscreenCollapse = _useEuiI18n2[0],
|
|
47
|
+
fullscreenExpand = _useEuiI18n2[1];
|
|
48
|
+
|
|
49
|
+
var fullScreenButton = useMemo(function () {
|
|
50
|
+
return showFullScreenButton ? ___EmotionJSX(EuiButtonIcon, {
|
|
51
|
+
className: "euiCodeBlock__fullScreenButton",
|
|
52
|
+
onClick: toggleFullScreen,
|
|
53
|
+
iconType: isFullScreen ? 'fullScreenExit' : 'fullScreen',
|
|
54
|
+
color: "text",
|
|
55
|
+
"aria-label": isFullScreen ? fullscreenCollapse : fullscreenExpand
|
|
56
|
+
}) : null;
|
|
57
|
+
}, [showFullScreenButton, toggleFullScreen, isFullScreen, fullscreenCollapse, fullscreenExpand]);
|
|
58
|
+
return {
|
|
59
|
+
fullScreenButton: fullScreenButton,
|
|
60
|
+
isFullScreen: isFullScreen,
|
|
61
|
+
onKeyDown: onKeyDown
|
|
62
|
+
};
|
|
63
|
+
};
|
|
64
|
+
/**
|
|
65
|
+
* Portalled full screen wrapper
|
|
66
|
+
*/
|
|
67
|
+
|
|
68
|
+
export var EuiCodeBlockFullScreenWrapper = function EuiCodeBlockFullScreenWrapper(_ref2) {
|
|
69
|
+
var children = _ref2.children;
|
|
70
|
+
var euiThemeContext = useEuiTheme();
|
|
71
|
+
var styles = euiCodeBlockStyles(euiThemeContext);
|
|
72
|
+
var cssStyles = [styles.euiCodeBlock, styles.l, // Force fullscreen to use large font
|
|
73
|
+
styles.isFullScreen];
|
|
74
|
+
return ___EmotionJSX(EuiOverlayMask, null, ___EmotionJSX(EuiFocusTrap, {
|
|
75
|
+
clickOutsideDisables: true
|
|
76
|
+
}, ___EmotionJSX("div", {
|
|
77
|
+
className: "euiCodeBlockFullScreen",
|
|
78
|
+
css: cssStyles
|
|
79
|
+
}, children)));
|
|
80
|
+
};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
function _EMOTION_STRINGIFIED_CSS_ERROR__() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
|
|
2
|
+
|
|
3
|
+
/*
|
|
4
|
+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
5
|
+
* or more contributor license agreements. Licensed under the Elastic License
|
|
6
|
+
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
|
7
|
+
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
8
|
+
* Side Public License, v 1.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
/*
|
|
12
|
+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
13
|
+
* or more contributor license agreements. Licensed under the Elastic License
|
|
14
|
+
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
|
15
|
+
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
16
|
+
* Side Public License, v 1.
|
|
17
|
+
*/
|
|
18
|
+
import { css } from '@emotion/css';
|
|
19
|
+
import { euiBackgroundColor } from '../../global_styling';
|
|
20
|
+
// Note: These styles must be in a separate file due to using `css` from `@emotion/css`
|
|
21
|
+
// (i.e., applying styles in vanilla JS / directly to DOM nodes instead of React)
|
|
22
|
+
export var euiCodeBlockLineStyles = function euiCodeBlockLineStyles(euiThemeContext) {
|
|
23
|
+
var euiTheme = euiThemeContext.euiTheme;
|
|
24
|
+
return {
|
|
25
|
+
euiCodeBlock__line: /*#__PURE__*/css(process.env.NODE_ENV === "production" ? {
|
|
26
|
+
name: "yn676d-euiCodeBlock__line",
|
|
27
|
+
styles: "display:block;label:euiCodeBlock__line;"
|
|
28
|
+
} : {
|
|
29
|
+
name: "yn676d-euiCodeBlock__line",
|
|
30
|
+
styles: "display:block;label:euiCodeBlock__line;",
|
|
31
|
+
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
32
|
+
}),
|
|
33
|
+
hasLineNumbers: /*#__PURE__*/css(process.env.NODE_ENV === "production" ? {
|
|
34
|
+
name: "156gjef-hasLineNumbers",
|
|
35
|
+
styles: "display:flex;user-select:none;label:hasLineNumbers;"
|
|
36
|
+
} : {
|
|
37
|
+
name: "156gjef-hasLineNumbers",
|
|
38
|
+
styles: "display:flex;user-select:none;label:hasLineNumbers;",
|
|
39
|
+
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
40
|
+
}),
|
|
41
|
+
lineText: {
|
|
42
|
+
euiCodeBlock__lineText: /*#__PURE__*/css("flex-grow:1;display:inline-block;padding-inline-start:", euiTheme.size.s, ";border-inline-start:", euiTheme.border.thin, ";user-select:text;;label:euiCodeBlock__lineText;"),
|
|
43
|
+
isHighlighted: /*#__PURE__*/css("background:", euiBackgroundColor(euiThemeContext, 'primary'), ";border-inline-start:", euiTheme.border.width.thick, " solid ", euiTheme.colors.primary, ";;label:isHighlighted;")
|
|
44
|
+
},
|
|
45
|
+
lineNumber: {
|
|
46
|
+
euiCodeBlock__lineNumber: /*#__PURE__*/css("flex-grow:0;flex-shrink:0;user-select:none;padding-inline-end:", euiTheme.size.s, ";box-sizing:content-box;&:before{content:attr(data-line-number);color:", euiTheme.colors.subduedText, ";text-align:end;display:block;};label:euiCodeBlock__lineNumber;")
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
};
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
3
|
+
|
|
4
|
+
/*
|
|
5
|
+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
6
|
+
* or more contributor license agreements. Licensed under the Elastic License
|
|
7
|
+
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
|
8
|
+
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
9
|
+
* Side Public License, v 1.
|
|
10
|
+
*/
|
|
11
|
+
import { useEffect, useState, useMemo } from 'react';
|
|
12
|
+
import { useMutationObserver } from '../observer/mutation_observer';
|
|
13
|
+
import { useResizeObserver } from '../observer/resize_observer';
|
|
14
|
+
/**
|
|
15
|
+
* Overflow logic - returns overflow-related state/logic/utils
|
|
16
|
+
*
|
|
17
|
+
* Detects whether the code block overflows and returns a tabIndex of 0 if so,
|
|
18
|
+
* which allows keyboard users to use the up/down arrow keys to scroll through
|
|
19
|
+
* the container.
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
export var useOverflow = function useOverflow(_ref) {
|
|
23
|
+
var overflowHeight = _ref.overflowHeight;
|
|
24
|
+
|
|
25
|
+
var _useState = useState(null),
|
|
26
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
27
|
+
wrapperRef = _useState2[0],
|
|
28
|
+
setWrapperRef = _useState2[1];
|
|
29
|
+
|
|
30
|
+
var _useState3 = useState(-1),
|
|
31
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
32
|
+
tabIndex = _useState4[0],
|
|
33
|
+
setTabIndex = _useState4[1];
|
|
34
|
+
|
|
35
|
+
var _useResizeObserver = useResizeObserver(wrapperRef),
|
|
36
|
+
width = _useResizeObserver.width,
|
|
37
|
+
height = _useResizeObserver.height;
|
|
38
|
+
|
|
39
|
+
var doesOverflow = function doesOverflow() {
|
|
40
|
+
if (!wrapperRef) return;
|
|
41
|
+
var clientWidth = wrapperRef.clientWidth,
|
|
42
|
+
clientHeight = wrapperRef.clientHeight,
|
|
43
|
+
scrollWidth = wrapperRef.scrollWidth,
|
|
44
|
+
scrollHeight = wrapperRef.scrollHeight;
|
|
45
|
+
var doesOverflow = scrollHeight > clientHeight || scrollWidth > clientWidth;
|
|
46
|
+
setTabIndex(doesOverflow ? 0 : -1);
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
useMutationObserver(wrapperRef, doesOverflow, {
|
|
50
|
+
subtree: true,
|
|
51
|
+
childList: true
|
|
52
|
+
});
|
|
53
|
+
useEffect(doesOverflow, [width, height, wrapperRef]);
|
|
54
|
+
var overflowHeightStyles = useMemo(function () {
|
|
55
|
+
if (overflowHeight) {
|
|
56
|
+
var property = typeof overflowHeight === 'string' ? 'blockSize' : 'maxBlockSize';
|
|
57
|
+
return _defineProperty({}, property, overflowHeight);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
return {};
|
|
61
|
+
}, [overflowHeight]);
|
|
62
|
+
return {
|
|
63
|
+
setWrapperRef: setWrapperRef,
|
|
64
|
+
tabIndex: tabIndex,
|
|
65
|
+
overflowHeightStyles: overflowHeightStyles
|
|
66
|
+
};
|
|
67
|
+
};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
|
|
3
|
+
/*
|
|
4
|
+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
5
|
+
* or more contributor license agreements. Licensed under the Elastic License
|
|
6
|
+
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
|
7
|
+
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
8
|
+
* Side Public License, v 1.
|
|
9
|
+
*/
|
|
10
|
+
import React, { forwardRef, useMemo } from 'react';
|
|
11
|
+
import { FixedSizeList } from 'react-window';
|
|
12
|
+
import { EuiAutoSizer } from '../auto_sizer';
|
|
13
|
+
import { nodeToHtml } from './utils';
|
|
14
|
+
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
15
|
+
export var EuiCodeBlockVirtualized = function EuiCodeBlockVirtualized(_ref) {
|
|
16
|
+
var data = _ref.data,
|
|
17
|
+
rowHeight = _ref.rowHeight,
|
|
18
|
+
overflowHeight = _ref.overflowHeight,
|
|
19
|
+
preProps = _ref.preProps,
|
|
20
|
+
codeProps = _ref.codeProps;
|
|
21
|
+
var VirtualizedOuterElement = useMemo(function () {
|
|
22
|
+
return /*#__PURE__*/forwardRef(function (props, ref) {
|
|
23
|
+
return ___EmotionJSX("pre", _extends({}, props, {
|
|
24
|
+
ref: ref
|
|
25
|
+
}, preProps));
|
|
26
|
+
});
|
|
27
|
+
}, [preProps]);
|
|
28
|
+
var VirtualizedInnerElement = useMemo(function () {
|
|
29
|
+
return /*#__PURE__*/forwardRef(function (props, ref) {
|
|
30
|
+
return ___EmotionJSX("code", _extends({}, props, {
|
|
31
|
+
ref: ref
|
|
32
|
+
}, codeProps));
|
|
33
|
+
});
|
|
34
|
+
}, [codeProps]);
|
|
35
|
+
return ___EmotionJSX(EuiAutoSizer, {
|
|
36
|
+
disableHeight: typeof overflowHeight === 'number'
|
|
37
|
+
}, function (_ref2) {
|
|
38
|
+
var height = _ref2.height,
|
|
39
|
+
width = _ref2.width;
|
|
40
|
+
return ___EmotionJSX(FixedSizeList, {
|
|
41
|
+
height: height !== null && height !== void 0 ? height : overflowHeight,
|
|
42
|
+
width: width,
|
|
43
|
+
itemData: data,
|
|
44
|
+
itemSize: rowHeight,
|
|
45
|
+
itemCount: data.length,
|
|
46
|
+
outerElementType: VirtualizedOuterElement,
|
|
47
|
+
innerElementType: VirtualizedInnerElement
|
|
48
|
+
}, ListRow);
|
|
49
|
+
});
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
var ListRow = function ListRow(_ref3) {
|
|
53
|
+
var data = _ref3.data,
|
|
54
|
+
index = _ref3.index,
|
|
55
|
+
style = _ref3.style;
|
|
56
|
+
var row = data[index];
|
|
57
|
+
row.properties.style = style;
|
|
58
|
+
return nodeToHtml(row, index, data, 0);
|
|
59
|
+
};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
3
|
+
* or more contributor license agreements. Licensed under the Elastic License
|
|
4
|
+
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
|
5
|
+
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
6
|
+
* Side Public License, v 1.
|
|
7
|
+
*/
|
|
8
|
+
import { makeHighContrastColor, euiPaletteColorBlind } from '../../services';
|
|
9
|
+
var visColors = euiPaletteColorBlind();
|
|
10
|
+
export var euiCodeSyntaxColors = function euiCodeSyntaxColors(euiThemeContext) {
|
|
11
|
+
var euiTheme = euiThemeContext.euiTheme;
|
|
12
|
+
var backgroundColor = euiTheme.colors.lightestShade;
|
|
13
|
+
return {
|
|
14
|
+
backgroundColor: backgroundColor,
|
|
15
|
+
color: makeHighContrastColor(euiTheme.colors.text)(backgroundColor),
|
|
16
|
+
inlineCodeColor: makeHighContrastColor(visColors[3])(backgroundColor),
|
|
17
|
+
selectedBackgroundColor: 'inherit',
|
|
18
|
+
commentColor: makeHighContrastColor(euiTheme.colors.subduedText)(backgroundColor),
|
|
19
|
+
selectorTagColor: 'inherit',
|
|
20
|
+
stringColor: makeHighContrastColor(visColors[2])(backgroundColor),
|
|
21
|
+
tagColor: makeHighContrastColor(visColors[1])(backgroundColor),
|
|
22
|
+
nameColor: makeHighContrastColor(visColors[1])(backgroundColor),
|
|
23
|
+
numberColor: makeHighContrastColor(visColors[0])(backgroundColor),
|
|
24
|
+
keywordColor: makeHighContrastColor(visColors[3])(backgroundColor),
|
|
25
|
+
functionTitleColor: 'inherit',
|
|
26
|
+
typeColor: makeHighContrastColor(visColors[1])(backgroundColor),
|
|
27
|
+
attributeColor: 'inherit',
|
|
28
|
+
symbolColor: makeHighContrastColor(visColors[9])(backgroundColor),
|
|
29
|
+
paramsColor: 'inherit',
|
|
30
|
+
metaColor: makeHighContrastColor(euiTheme.colors.subduedText)(backgroundColor),
|
|
31
|
+
titleColor: makeHighContrastColor(visColors[7])(backgroundColor),
|
|
32
|
+
sectionColor: makeHighContrastColor(visColors[9])(backgroundColor),
|
|
33
|
+
additionColor: makeHighContrastColor(visColors[0])(backgroundColor),
|
|
34
|
+
deletionColor: makeHighContrastColor(euiTheme.colors.danger)(backgroundColor),
|
|
35
|
+
selectorClassColor: 'inherit',
|
|
36
|
+
selectorIdColor: 'inherit'
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
export var euiCodeSyntaxTokens = function euiCodeSyntaxTokens(euiThemeContext) {
|
|
40
|
+
var euiTheme = euiThemeContext.euiTheme;
|
|
41
|
+
var euiCodeBlock = euiCodeSyntaxColors(euiThemeContext);
|
|
42
|
+
return "\n .token.punctuation:not(.interpolation-punctuation):not([class*='attr-']) {\n opacity: .7;\n }\n \n .token.comment,\n .token.prolog,\n .token.doctype,\n .token.cdata,\n .token.coord,\n .token.blockquote {\n color: ".concat(euiCodeBlock.commentColor, ";\n font-style: italic;\n }\n \n .token.selector {\n color: ").concat(euiCodeBlock.selectorTagColor, ";\n }\n \n .token.string,\n .token.interpolation,\n .token.interpolation-punctuation,\n .token.doc-comment .token.keyword,\n .token.attr-value,\n .token.url .token.content {\n color: ").concat(euiCodeBlock.stringColor, ";\n }\n \n .token.number,\n .token.boolean,\n .token.keyword.nil,\n .token.regex,\n .token.variable,\n .token.unit,\n .token.hexcode,\n .token.attr-name,\n .token.attr-equals {\n color: ").concat(euiCodeBlock.numberColor, ";\n }\n \n .token.atrule .token.rule,\n .token.keyword {\n color: ").concat(euiCodeBlock.keywordColor, ";\n }\n \n .token.function {\n color: ").concat(euiCodeBlock.functionTitleColor, ";\n }\n \n .token.tag {\n color: ").concat(euiCodeBlock.tagColor, ";\n }\n \n .token.class-name {\n color: ").concat(euiCodeBlock.typeColor, ";\n }\n \n .token.property {\n color: ").concat(euiCodeBlock.attributeColor, ";\n }\n \n .token.console,\n .token.list-punctuation,\n .token.url-reference,\n .token.url .token.url {\n color: ").concat(euiCodeBlock.symbolColor, ";\n }\n \n .token.paramater {\n color: ").concat(euiCodeBlock.paramsColor, ";\n }\n \n .token.meta,\n .token.important {\n color: ").concat(euiCodeBlock.metaColor, ";\n }\n \n .token.title {\n color: ").concat(euiCodeBlock.titleColor, ";\n }\n \n .token.section {\n color: ").concat(euiCodeBlock.sectionColor, ";\n }\n \n .token.prefix.inserted,\n .token.prefix.deleted {\n padding-inline-start: -").concat(euiTheme.size.xs, ";\n margin-inline-start: -").concat(euiTheme.size.xs, ";\n }\n \n .token.prefix.inserted {\n box-shadow: -").concat(euiTheme.size.xs, " 0 ").concat(euiCodeBlock.additionColor, ";\n color: ").concat(euiCodeBlock.additionColor, ";\n }\n \n .token.prefix.deleted {\n box-shadow: -").concat(euiTheme.size.xs, " 0 ").concat(euiCodeBlock.deletionColor, ";\n color: ").concat(euiCodeBlock.deletionColor, ";\n }\n \n .token.selector .token.class {\n color: ").concat(euiCodeBlock.selectorClassColor, ";\n }\n \n .token.selector .token.id {\n color: ").concat(euiCodeBlock.selectorIdColor, ";\n }\n \n .token.italic {\n font-style: italic;\n }\n \n .token.important,\n .token.bold {\n font-weight: $euiCodeFontWeightBold;\n }\n \n .token.url-reference,\n .token.url .token.url {\n text-decoration: underline;\n }\n \n .token.entity {\n cursor: help;\n }\n ");
|
|
43
|
+
};
|
|
@@ -13,7 +13,12 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
13
13
|
*/
|
|
14
14
|
import React, { createElement } from 'react';
|
|
15
15
|
import { listLanguages, highlight } from 'refractor';
|
|
16
|
-
import
|
|
16
|
+
import { cx } from '@emotion/css';
|
|
17
|
+
import { euiCodeBlockLineStyles } from './code_block_line.styles';
|
|
18
|
+
/**
|
|
19
|
+
* Utils shared between EuiCode and EuiCodeBlock
|
|
20
|
+
*/
|
|
21
|
+
|
|
17
22
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
18
23
|
export var SUPPORTED_LANGUAGES = listLanguages();
|
|
19
24
|
export var DEFAULT_LANGUAGE = 'text';
|
|
@@ -40,7 +45,7 @@ export var nodeToHtml = function nodeToHtml(node, idx, nodes) {
|
|
|
40
45
|
children = node.children;
|
|
41
46
|
return /*#__PURE__*/createElement(tagName, _objectSpread(_objectSpread({}, properties), {}, {
|
|
42
47
|
key: key,
|
|
43
|
-
className:
|
|
48
|
+
className: cx(properties.className)
|
|
44
49
|
}), children && children.map(function (el, i) {
|
|
45
50
|
return nodeToHtml(el, i, nodes, depth + 1);
|
|
46
51
|
}));
|
|
@@ -55,8 +60,7 @@ export var nodeToHtml = function nodeToHtml(node, idx, nodes) {
|
|
|
55
60
|
*/
|
|
56
61
|
|
|
57
62
|
// Approximate width of a single digit/character
|
|
58
|
-
var CHAR_SIZE = 8;
|
|
59
|
-
var $euiSizeS = 8; // Creates an array of numbers from comma-separeated
|
|
63
|
+
var CHAR_SIZE = 8; // Creates an array of numbers from comma-separeated
|
|
60
64
|
// string of numbers or number ranges using `-`
|
|
61
65
|
// (e.g., "1, 3-10, 15")
|
|
62
66
|
|
|
@@ -129,8 +133,7 @@ var addLineData = function addLineData(nodes, data) {
|
|
|
129
133
|
}, []);
|
|
130
134
|
};
|
|
131
135
|
|
|
132
|
-
function wrapLines(nodes, options) {
|
|
133
|
-
var highlights = options.highlight ? parseLineRanges(options.highlight) : [];
|
|
136
|
+
function wrapLines(nodes, options, euiTheme) {
|
|
134
137
|
var grouped = [];
|
|
135
138
|
nodes.forEach(function (node) {
|
|
136
139
|
var lineStart = node.lineStart - 1;
|
|
@@ -142,41 +145,44 @@ function wrapLines(nodes, options) {
|
|
|
142
145
|
}
|
|
143
146
|
});
|
|
144
147
|
var wrapped = [];
|
|
145
|
-
var digits = grouped.length.toString().length;
|
|
146
|
-
var width = digits * CHAR_SIZE;
|
|
147
148
|
grouped.forEach(function (node, i) {
|
|
148
|
-
var
|
|
149
|
-
|
|
150
|
-
var
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
149
|
+
var children = node;
|
|
150
|
+
var styles = euiCodeBlockLineStyles(euiTheme);
|
|
151
|
+
var lineStyles = cx([styles.euiCodeBlock__line, options.showLineNumbers && styles.hasLineNumbers]);
|
|
152
|
+
|
|
153
|
+
if (options.showLineNumbers) {
|
|
154
|
+
var _properties;
|
|
155
|
+
|
|
156
|
+
var lineNumber = i + 1;
|
|
157
|
+
var digits = grouped.length.toString().length;
|
|
158
|
+
var width = digits * CHAR_SIZE;
|
|
159
|
+
var highlights = options.highlight ? parseLineRanges(options.highlight) : [];
|
|
160
|
+
var lineTextStyles = cx([styles.lineText.euiCodeBlock__lineText, highlights.includes(lineNumber) && styles.lineText.isHighlighted]);
|
|
161
|
+
var lineNumberStyles = cx(styles.lineNumber.euiCodeBlock__lineNumber);
|
|
162
|
+
children = [{
|
|
163
|
+
type: 'element',
|
|
164
|
+
tagName: 'span',
|
|
165
|
+
properties: (_properties = {
|
|
166
|
+
style: {
|
|
167
|
+
inlineSize: width
|
|
168
|
+
}
|
|
169
|
+
}, _defineProperty(_properties, 'data-line-number', lineNumber), _defineProperty(_properties, 'aria-hidden', true), _defineProperty(_properties, "className", ['euiCodeBlock__lineNumber', lineNumberStyles]), _properties),
|
|
170
|
+
children: []
|
|
171
|
+
}, {
|
|
172
|
+
type: 'element',
|
|
173
|
+
tagName: 'span',
|
|
174
|
+
properties: {
|
|
175
|
+
className: ['euiCodeBlock__lineText', lineTextStyles]
|
|
170
176
|
},
|
|
171
|
-
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
|
|
177
|
+
children: node
|
|
178
|
+
}];
|
|
179
|
+
}
|
|
180
|
+
|
|
175
181
|
wrapped.push({
|
|
176
182
|
type: 'element',
|
|
177
183
|
tagName: 'span',
|
|
178
184
|
properties: {
|
|
179
|
-
className: [
|
|
185
|
+
className: ['euiCodeBlock__line', lineStyles]
|
|
180
186
|
},
|
|
181
187
|
children: children
|
|
182
188
|
});
|
|
@@ -184,11 +190,11 @@ function wrapLines(nodes, options) {
|
|
|
184
190
|
return wrapped;
|
|
185
191
|
}
|
|
186
192
|
|
|
187
|
-
export var highlightByLine = function highlightByLine(children, language, data) {
|
|
193
|
+
export var highlightByLine = function highlightByLine(children, language, data, euiTheme) {
|
|
188
194
|
return wrapLines(addLineData(highlight(children, language), {
|
|
189
195
|
lineNumber: data.start
|
|
190
196
|
}), {
|
|
191
197
|
showLineNumbers: data.show,
|
|
192
198
|
highlight: data.highlight
|
|
193
|
-
});
|
|
199
|
+
}, euiTheme);
|
|
194
200
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
-
var _excluded = ["className", "children", "headerZindexLocation", "maskRef"
|
|
3
|
+
var _excluded = ["className", "children", "headerZindexLocation", "maskRef"];
|
|
4
4
|
|
|
5
5
|
/*
|
|
6
6
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
@@ -15,12 +15,13 @@ var _excluded = ["className", "children", "headerZindexLocation", "maskRef", "cs
|
|
|
15
15
|
* into portals.
|
|
16
16
|
*/
|
|
17
17
|
import React, { useEffect, useState } from 'react';
|
|
18
|
-
import
|
|
18
|
+
import { cx } from '@emotion/css';
|
|
19
19
|
import { Global } from '@emotion/react';
|
|
20
20
|
import { keysOf } from '../common';
|
|
21
21
|
import { useCombinedRefs, useEuiTheme } from '../../services';
|
|
22
22
|
import { EuiPortal } from '../portal';
|
|
23
|
-
import { euiOverlayMaskStyles
|
|
23
|
+
import { euiOverlayMaskStyles } from './overlay_mask.styles';
|
|
24
|
+
import { euiOverlayMaskBodyStyles } from './overlay_mask_body.styles';
|
|
24
25
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
25
26
|
export var EuiOverlayMask = function EuiOverlayMask(_ref) {
|
|
26
27
|
var className = _ref.className,
|
|
@@ -28,7 +29,6 @@ export var EuiOverlayMask = function EuiOverlayMask(_ref) {
|
|
|
28
29
|
_ref$headerZindexLoca = _ref.headerZindexLocation,
|
|
29
30
|
headerZindexLocation = _ref$headerZindexLoca === void 0 ? 'above' : _ref$headerZindexLoca,
|
|
30
31
|
maskRef = _ref.maskRef,
|
|
31
|
-
css = _ref.css,
|
|
32
32
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
33
33
|
|
|
34
34
|
var _useState = useState(null),
|
|
@@ -39,7 +39,7 @@ export var EuiOverlayMask = function EuiOverlayMask(_ref) {
|
|
|
39
39
|
var combinedMaskRef = useCombinedRefs([setOverlayMaskNode, maskRef]);
|
|
40
40
|
var euiTheme = useEuiTheme();
|
|
41
41
|
var styles = euiOverlayMaskStyles(euiTheme);
|
|
42
|
-
var cssStyles = [styles.euiOverlayMask, styles["".concat(headerZindexLocation, "Header")]];
|
|
42
|
+
var cssStyles = cx([styles.euiOverlayMask, styles["".concat(headerZindexLocation, "Header")]]);
|
|
43
43
|
useEffect(function () {
|
|
44
44
|
if (!overlayMaskNode) return;
|
|
45
45
|
keysOf(rest).forEach(function (key) {
|
|
@@ -55,13 +55,12 @@ export var EuiOverlayMask = function EuiOverlayMask(_ref) {
|
|
|
55
55
|
|
|
56
56
|
useEffect(function () {
|
|
57
57
|
if (!overlayMaskNode) return;
|
|
58
|
-
overlayMaskNode.className =
|
|
59
|
-
|
|
58
|
+
overlayMaskNode.className = cx('euiOverlayMask', cssStyles, className);
|
|
59
|
+
overlayMaskNode.dataset.relativeToHeader = headerZindexLocation;
|
|
60
|
+
}, [overlayMaskNode, className, cssStyles, headerZindexLocation]);
|
|
60
61
|
return ___EmotionJSX(EuiPortal, {
|
|
61
62
|
portalRef: combinedMaskRef
|
|
62
63
|
}, ___EmotionJSX(Global, {
|
|
63
64
|
styles: euiOverlayMaskBodyStyles
|
|
64
|
-
}), ___EmotionJSX(Global, {
|
|
65
|
-
styles: cssStyles
|
|
66
65
|
}), children);
|
|
67
66
|
};
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
function _EMOTION_STRINGIFIED_CSS_ERROR__() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
|
|
2
|
-
|
|
3
1
|
/*
|
|
4
2
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
5
3
|
* or more contributor license agreements. Licensed under the Elastic License
|
|
@@ -7,22 +5,14 @@ function _EMOTION_STRINGIFIED_CSS_ERROR__() { return "You have tried to stringif
|
|
|
7
5
|
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
8
6
|
* Side Public License, v 1.
|
|
9
7
|
*/
|
|
10
|
-
import { css } from '@emotion/
|
|
8
|
+
import { css } from '@emotion/css';
|
|
11
9
|
import { logicalCSS, euiAnimFadeIn } from '../../global_styling';
|
|
12
10
|
import { transparentize } from '../../services';
|
|
13
11
|
export var euiOverlayMaskStyles = function euiOverlayMaskStyles(_ref) {
|
|
14
12
|
var euiTheme = _ref.euiTheme;
|
|
15
13
|
return {
|
|
16
|
-
euiOverlayMask: /*#__PURE__*/css("
|
|
17
|
-
aboveHeader: /*#__PURE__*/css("
|
|
18
|
-
belowHeader: /*#__PURE__*/css("
|
|
14
|
+
euiOverlayMask: /*#__PURE__*/css("position:fixed;", logicalCSS('top', 0), " ", logicalCSS('left', 0), " ", logicalCSS('right', 0), " ", logicalCSS('bottom', 0), " display:flex;align-items:center;justify-content:center;", logicalCSS('padding-bottom', '10vh'), ";animation:", euiAnimFadeIn, " ", euiTheme.animation.fast, " ease-in;background:", transparentize(euiTheme.colors.ink, 0.5), ";;label:euiOverlayMask;"),
|
|
15
|
+
aboveHeader: /*#__PURE__*/css("z-index:", euiTheme.levels.mask, ";;label:aboveHeader;"),
|
|
16
|
+
belowHeader: /*#__PURE__*/css("z-index:", euiTheme.levels.maskBelowHeader, ";", logicalCSS('top', "".concat(euiTheme.base * 3, "px")), ";;label:belowHeader;")
|
|
19
17
|
};
|
|
20
|
-
};
|
|
21
|
-
export var euiOverlayMaskBodyStyles = process.env.NODE_ENV === "production" ? {
|
|
22
|
-
name: "131160-euiOverlayMaskBodyStyles",
|
|
23
|
-
styles: "body{overflow:hidden;};label:euiOverlayMaskBodyStyles;"
|
|
24
|
-
} : {
|
|
25
|
-
name: "131160-euiOverlayMaskBodyStyles",
|
|
26
|
-
styles: "body{overflow:hidden;};label:euiOverlayMaskBodyStyles;",
|
|
27
|
-
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
28
18
|
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
function _EMOTION_STRINGIFIED_CSS_ERROR__() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
|
|
2
|
+
|
|
3
|
+
/*
|
|
4
|
+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
5
|
+
* or more contributor license agreements. Licensed under the Elastic License
|
|
6
|
+
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
|
7
|
+
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
8
|
+
* Side Public License, v 1.
|
|
9
|
+
*/
|
|
10
|
+
import { css } from '@emotion/react';
|
|
11
|
+
export var euiOverlayMaskBodyStyles = process.env.NODE_ENV === "production" ? {
|
|
12
|
+
name: "131160-euiOverlayMaskBodyStyles",
|
|
13
|
+
styles: "body{overflow:hidden;};label:euiOverlayMaskBodyStyles;"
|
|
14
|
+
} : {
|
|
15
|
+
name: "131160-euiOverlayMaskBodyStyles",
|
|
16
|
+
styles: "body{overflow:hidden;};label:euiOverlayMaskBodyStyles;",
|
|
17
|
+
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
18
|
+
};
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* Side Public License, v 1.
|
|
7
7
|
*/
|
|
8
8
|
import React from 'react';
|
|
9
|
-
import
|
|
9
|
+
import { cache as fallbackCache } from '@emotion/css';
|
|
10
10
|
import { EuiGlobalStyles } from '../../global_styling/reset/global_styles';
|
|
11
11
|
import { EuiUtilityClasses } from '../../global_styling/utility/utility';
|
|
12
12
|
import { EuiThemeProvider, CurrentEuiBreakpointProvider } from '../../services';
|
|
@@ -18,10 +18,6 @@ var isEmotionCacheObject = function isEmotionCacheObject(obj) {
|
|
|
18
18
|
return obj.hasOwnProperty('key');
|
|
19
19
|
};
|
|
20
20
|
|
|
21
|
-
var fallbackCache = createCache({
|
|
22
|
-
key: 'css'
|
|
23
|
-
});
|
|
24
|
-
fallbackCache.compat = true;
|
|
25
21
|
export var EuiProvider = function EuiProvider(_ref) {
|
|
26
22
|
var _defaultCache;
|
|
27
23
|
|
|
@@ -33,7 +33,7 @@ export var sizesOnly = function sizesOnly(panelObject) {
|
|
|
33
33
|
|
|
34
34
|
var _getPanelMinSize = function _getPanelMinSize(panelMinSize, containerSize) {
|
|
35
35
|
var panelMinSizePercent = 0;
|
|
36
|
-
var panelMinSizeInt =
|
|
36
|
+
var panelMinSizeInt = parseFloat(panelMinSize);
|
|
37
37
|
|
|
38
38
|
if (panelMinSize.indexOf('px') > -1) {
|
|
39
39
|
panelMinSizePercent = pxToPercent(panelMinSizeInt, containerSize);
|
|
@@ -63,7 +63,7 @@ var getSiblingPanel = function getSiblingPanel(element, adjacency) {
|
|
|
63
63
|
var sibling = element[method];
|
|
64
64
|
|
|
65
65
|
while (sibling) {
|
|
66
|
-
if (sibling.matches('.euiResizablePanel:not(
|
|
66
|
+
if (sibling.matches('.euiResizablePanel:not([data-collapsed])')) {
|
|
67
67
|
return sibling;
|
|
68
68
|
}
|
|
69
69
|
|