@elastic/eui 88.0.0 → 88.2.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_charts_theme.js +9 -8
- package/dist/eui_charts_theme.js.map +1 -1
- package/dist/eui_theme_dark.css +11 -41
- package/dist/eui_theme_dark.min.css +1 -1
- package/dist/eui_theme_light.css +11 -41
- package/dist/eui_theme_light.min.css +1 -1
- package/es/components/accordion/accordion.js +34 -9
- package/es/components/accordion/accordion.styles.js +29 -9
- package/es/components/collapsible_nav/collapsible_nav_group/collapsible_nav_group.js +10 -2
- package/es/components/collapsible_nav_beta/collapsible_nav_beta.js +10 -26
- package/es/components/collapsible_nav_beta/collapsible_nav_beta.styles.js +10 -1
- package/es/components/datagrid/controls/keyboard_shortcuts.js +1 -0
- package/es/components/description_list/description_list.js +40 -3
- package/es/components/flyout/flyout.styles.js +1 -1
- package/es/components/header/header.js +120 -25
- package/es/components/header/header.styles.js +1 -1
- package/es/components/index.js +1 -0
- package/es/components/markdown_editor/markdown_format.styles.js +3 -6
- package/es/components/overlay_mask/overlay_mask.styles.js +1 -1
- package/es/components/page/page_sidebar/page_sidebar.js +2 -4
- package/es/components/page_template/page_template.js +4 -31
- package/es/components/text/text.styles.js +3 -6
- package/es/components/text_truncate/index.js +10 -0
- package/es/components/text_truncate/text_truncate.js +232 -0
- package/es/components/text_truncate/text_truncate.styles.js +49 -0
- package/es/components/text_truncate/utils.js +348 -0
- package/es/global_styling/functions/typography.js +8 -8
- package/es/global_styling/variables/typography.js +1 -1
- package/es/services/theme/context.js +3 -1
- package/es/services/theme/hooks.js +19 -1
- package/es/services/theme/index.js +1 -1
- package/es/services/theme/provider.js +37 -8
- package/es/themes/amsterdam/global_styling/variables/_typography.js +1 -0
- package/eui.d.ts +282 -24
- package/i18ntokens.json +112 -112
- package/lib/components/accordion/accordion.js +33 -8
- package/lib/components/accordion/accordion.styles.js +31 -10
- package/lib/components/collapsible_nav/collapsible_nav_group/collapsible_nav_group.js +10 -2
- package/lib/components/collapsible_nav_beta/collapsible_nav_beta.js +10 -26
- package/lib/components/collapsible_nav_beta/collapsible_nav_beta.styles.js +10 -1
- package/lib/components/datagrid/controls/keyboard_shortcuts.js +1 -0
- package/lib/components/description_list/description_list.js +39 -3
- package/lib/components/flyout/flyout.styles.js +1 -1
- package/lib/components/header/header.js +120 -23
- package/lib/components/header/header.styles.js +1 -1
- package/lib/components/index.js +11 -0
- package/lib/components/markdown_editor/markdown_format.styles.js +3 -6
- package/lib/components/overlay_mask/overlay_mask.styles.js +1 -1
- package/lib/components/page/page_sidebar/page_sidebar.js +2 -4
- package/lib/components/page_template/page_template.js +2 -29
- package/lib/components/text/text.styles.js +3 -6
- package/lib/components/text_truncate/index.js +25 -0
- package/lib/components/text_truncate/text_truncate.js +242 -0
- package/lib/components/text_truncate/text_truncate.styles.js +54 -0
- package/lib/components/text_truncate/utils.js +352 -0
- package/lib/global_styling/functions/typography.js +8 -8
- package/lib/global_styling/variables/typography.js +3 -3
- package/lib/services/theme/context.js +3 -1
- package/lib/services/theme/hooks.js +21 -2
- package/lib/services/theme/index.js +6 -0
- package/lib/services/theme/provider.js +62 -35
- package/lib/themes/amsterdam/global_styling/variables/_typography.js +1 -0
- package/optimize/es/components/accordion/accordion.js +19 -7
- package/optimize/es/components/accordion/accordion.styles.js +29 -9
- package/optimize/es/components/collapsible_nav_beta/collapsible_nav_beta.js +5 -26
- package/optimize/es/components/collapsible_nav_beta/collapsible_nav_beta.styles.js +10 -1
- package/optimize/es/components/datagrid/controls/keyboard_shortcuts.js +1 -0
- package/optimize/es/components/description_list/description_list.js +22 -2
- package/optimize/es/components/flyout/flyout.styles.js +1 -1
- package/optimize/es/components/header/header.js +75 -25
- package/optimize/es/components/header/header.styles.js +1 -1
- package/optimize/es/components/index.js +1 -0
- package/optimize/es/components/markdown_editor/markdown_format.styles.js +3 -6
- package/optimize/es/components/overlay_mask/overlay_mask.styles.js +1 -1
- package/optimize/es/components/page/page_sidebar/page_sidebar.js +2 -4
- package/optimize/es/components/page_template/page_template.js +4 -26
- package/optimize/es/components/text/text.styles.js +3 -6
- package/optimize/es/components/text_truncate/index.js +10 -0
- package/optimize/es/components/text_truncate/text_truncate.js +148 -0
- package/optimize/es/components/text_truncate/text_truncate.styles.js +49 -0
- package/optimize/es/components/text_truncate/utils.js +337 -0
- package/optimize/es/global_styling/functions/typography.js +8 -8
- package/optimize/es/global_styling/variables/typography.js +1 -1
- package/optimize/es/services/theme/context.js +3 -1
- package/optimize/es/services/theme/hooks.js +19 -1
- package/optimize/es/services/theme/index.js +1 -1
- package/optimize/es/services/theme/provider.js +37 -8
- package/optimize/es/themes/amsterdam/global_styling/variables/_typography.js +1 -0
- package/optimize/lib/components/accordion/accordion.js +18 -6
- package/optimize/lib/components/accordion/accordion.styles.js +31 -10
- package/optimize/lib/components/collapsible_nav_beta/collapsible_nav_beta.js +5 -26
- package/optimize/lib/components/collapsible_nav_beta/collapsible_nav_beta.styles.js +10 -1
- package/optimize/lib/components/datagrid/controls/keyboard_shortcuts.js +1 -0
- package/optimize/lib/components/description_list/description_list.js +22 -2
- package/optimize/lib/components/flyout/flyout.styles.js +1 -1
- package/optimize/lib/components/header/header.js +77 -24
- package/optimize/lib/components/header/header.styles.js +1 -1
- package/optimize/lib/components/index.js +11 -0
- package/optimize/lib/components/markdown_editor/markdown_format.styles.js +3 -6
- package/optimize/lib/components/overlay_mask/overlay_mask.styles.js +1 -1
- package/optimize/lib/components/page/page_sidebar/page_sidebar.js +2 -4
- package/optimize/lib/components/page_template/page_template.js +2 -24
- package/optimize/lib/components/text/text.styles.js +3 -6
- package/optimize/lib/components/text_truncate/index.js +25 -0
- package/optimize/lib/components/text_truncate/text_truncate.js +158 -0
- package/optimize/lib/components/text_truncate/text_truncate.styles.js +54 -0
- package/optimize/lib/components/text_truncate/utils.js +342 -0
- package/optimize/lib/global_styling/functions/typography.js +8 -8
- package/optimize/lib/global_styling/variables/typography.js +3 -3
- package/optimize/lib/services/theme/context.js +3 -1
- package/optimize/lib/services/theme/hooks.js +21 -2
- package/optimize/lib/services/theme/index.js +6 -0
- package/optimize/lib/services/theme/provider.js +62 -35
- package/optimize/lib/themes/amsterdam/global_styling/variables/_typography.js +1 -0
- package/package.json +1 -1
- package/src/components/datagrid/_data_grid.scss +13 -2
- package/src/components/datagrid/controls/_data_grid_keyboard_shortcuts.scss +1 -7
- package/src/components/index.scss +0 -1
- package/src/global_styling/mixins/_header.scss +2 -0
- package/test-env/components/accordion/accordion.js +28 -8
- package/test-env/components/accordion/accordion.styles.js +31 -10
- package/test-env/components/collapsible_nav/collapsible_nav_group/collapsible_nav_group.js +10 -2
- package/test-env/components/collapsible_nav_beta/collapsible_nav_beta.js +10 -26
- package/test-env/components/collapsible_nav_beta/collapsible_nav_beta.styles.js +10 -1
- package/test-env/components/datagrid/controls/keyboard_shortcuts.js +1 -0
- package/test-env/components/description_list/description_list.js +37 -3
- package/test-env/components/flyout/flyout.styles.js +1 -1
- package/test-env/components/header/header.js +113 -23
- package/test-env/components/header/header.styles.js +1 -1
- package/test-env/components/index.js +11 -0
- package/test-env/components/markdown_editor/markdown_format.styles.js +3 -6
- package/test-env/components/overlay_mask/overlay_mask.styles.js +1 -1
- package/test-env/components/page/page_sidebar/page_sidebar.js +2 -4
- package/test-env/components/page_template/page_template.js +2 -24
- package/test-env/components/text/text.styles.js +3 -6
- package/test-env/components/text_truncate/index.js +25 -0
- package/test-env/components/text_truncate/text_truncate.js +236 -0
- package/test-env/components/text_truncate/text_truncate.styles.js +54 -0
- package/test-env/components/text_truncate/utils.js +342 -0
- package/test-env/global_styling/functions/typography.js +8 -8
- package/test-env/global_styling/variables/typography.js +3 -3
- package/test-env/services/theme/context.js +3 -1
- package/test-env/services/theme/hooks.js +21 -2
- package/test-env/services/theme/index.js +6 -0
- package/test-env/services/theme/provider.js +62 -35
- package/test-env/themes/amsterdam/global_styling/variables/_typography.js +1 -0
- package/src/components/accordion/_accordion_form.scss +0 -40
- package/src/components/accordion/_index.scss +0 -1
|
@@ -20,16 +20,16 @@ export function euiFontSizeFromScale(scale, _ref) {
|
|
|
20
20
|
var base = _ref.base,
|
|
21
21
|
font = _ref.font;
|
|
22
22
|
var _ref2 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {},
|
|
23
|
-
_ref2$
|
|
24
|
-
|
|
23
|
+
_ref2$unit = _ref2.unit,
|
|
24
|
+
unit = _ref2$unit === void 0 ? font.defaultUnits : _ref2$unit,
|
|
25
25
|
customScale = _ref2.customScale;
|
|
26
|
-
if (
|
|
26
|
+
if (unit === 'em') {
|
|
27
27
|
return "".concat(font.scale[scale], "em");
|
|
28
28
|
}
|
|
29
29
|
var numerator = base * font.scale[scale];
|
|
30
30
|
if (customScale) numerator *= font.scale[customScale];
|
|
31
31
|
var denominator = base * font.scale[font.body.scale];
|
|
32
|
-
return
|
|
32
|
+
return unit === 'px' ? "".concat(numerator, "px") : "".concat((numerator / denominator).toFixed(4), "rem");
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
/**
|
|
@@ -48,8 +48,8 @@ export function euiLineHeightFromBaseline(scale, _ref3) {
|
|
|
48
48
|
var base = _ref3.base,
|
|
49
49
|
font = _ref3.font;
|
|
50
50
|
var _ref4 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {},
|
|
51
|
-
_ref4$
|
|
52
|
-
|
|
51
|
+
_ref4$unit = _ref4.unit,
|
|
52
|
+
unit = _ref4$unit === void 0 ? font.defaultUnits : _ref4$unit,
|
|
53
53
|
customScale = _ref4.customScale;
|
|
54
54
|
var baseline = font.baseline,
|
|
55
55
|
lineHeightMultiplier = font.lineHeightMultiplier;
|
|
@@ -57,13 +57,13 @@ export function euiLineHeightFromBaseline(scale, _ref3) {
|
|
|
57
57
|
if (customScale) numerator *= font.scale[customScale];
|
|
58
58
|
var denominator = base * font.scale[font.body.scale];
|
|
59
59
|
var _lineHeightMultiplier = numerator <= base ? lineHeightMultiplier : lineHeightMultiplier * 0.833;
|
|
60
|
-
if (
|
|
60
|
+
if (unit === 'em') {
|
|
61
61
|
// Even though the line-height via `em` cannot be determined against the pixel baseline grid;
|
|
62
62
|
// we will assume that typically larger scale font-sizes should have a shorter line-height;
|
|
63
63
|
return _lineHeightMultiplier.toFixed(4).toString();
|
|
64
64
|
}
|
|
65
65
|
var pixelValue = Math.floor(Math.round(numerator * _lineHeightMultiplier) / baseline) * baseline;
|
|
66
|
-
return
|
|
66
|
+
return unit === 'px' ? "".concat(pixelValue, "px") : "".concat((pixelValue / denominator).toFixed(4), "rem");
|
|
67
67
|
}
|
|
68
68
|
|
|
69
69
|
/**
|
|
@@ -18,5 +18,7 @@ export var EuiNestedThemeContext = /*#__PURE__*/createContext({
|
|
|
18
18
|
isGlobalTheme: true,
|
|
19
19
|
hasDifferentColorFromGlobalTheme: false,
|
|
20
20
|
bodyColor: '',
|
|
21
|
-
colorClassName: ''
|
|
21
|
+
colorClassName: '',
|
|
22
|
+
setGlobalCSSVariables: function setGlobalCSSVariables() {},
|
|
23
|
+
setNearestThemeCSSVariables: function setNearestThemeCSSVariables() {}
|
|
22
24
|
});
|
|
@@ -8,7 +8,7 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
import React, { forwardRef, useContext, useMemo } from 'react';
|
|
11
|
-
import { EuiThemeContext, EuiModificationsContext, EuiColorModeContext, defaultComputedTheme } from './context';
|
|
11
|
+
import { EuiThemeContext, EuiModificationsContext, EuiColorModeContext, defaultComputedTheme, EuiNestedThemeContext } from './context';
|
|
12
12
|
import { emitEuiProviderWarning } from './warning';
|
|
13
13
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
14
14
|
var providerMessage = "`EuiProvider` is missing which can result in negative effects.\nWrap your component in `EuiProvider`: https://ela.st/euiprovider.";
|
|
@@ -63,4 +63,22 @@ export var RenderWithEuiTheme = function RenderWithEuiTheme(_ref) {
|
|
|
63
63
|
var children = _ref.children;
|
|
64
64
|
var theme = useEuiTheme();
|
|
65
65
|
return children(theme);
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Minor syntactical sugar hook for theme CSS variables.
|
|
70
|
+
* Primarily meant for internal EUI usage.
|
|
71
|
+
*/
|
|
72
|
+
export var useEuiThemeCSSVariables = function useEuiThemeCSSVariables() {
|
|
73
|
+
var _useContext = useContext(EuiNestedThemeContext),
|
|
74
|
+
setGlobalCSSVariables = _useContext.setGlobalCSSVariables,
|
|
75
|
+
globalCSSVariables = _useContext.globalCSSVariables,
|
|
76
|
+
setNearestThemeCSSVariables = _useContext.setNearestThemeCSSVariables,
|
|
77
|
+
themeCSSVariables = _useContext.themeCSSVariables;
|
|
78
|
+
return {
|
|
79
|
+
setGlobalCSSVariables: setGlobalCSSVariables,
|
|
80
|
+
globalCSSVariables: globalCSSVariables,
|
|
81
|
+
setNearestThemeCSSVariables: setNearestThemeCSSVariables,
|
|
82
|
+
themeCSSVariables: themeCSSVariables
|
|
83
|
+
};
|
|
66
84
|
};
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
export { EuiSystemContext, EuiThemeContext, EuiNestedThemeContext, EuiModificationsContext, EuiColorModeContext } from './context';
|
|
10
|
-
export { useEuiTheme, withEuiTheme, RenderWithEuiTheme } from './hooks';
|
|
10
|
+
export { useEuiTheme, withEuiTheme, RenderWithEuiTheme, useEuiThemeCSSVariables } from './hooks';
|
|
11
11
|
export { EuiThemeProvider } from './provider';
|
|
12
12
|
export { getEuiDevProviderWarning, setEuiDevProviderWarning } from './warning';
|
|
13
13
|
export { buildTheme, computed, isInverseColorMode, getColorMode, getComputed, getOn, mergeDeep, setOn, Computed } from './utils';
|
|
@@ -2,6 +2,7 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
3
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
4
4
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
5
|
+
import { css as _css } from "@emotion/react";
|
|
5
6
|
var _excluded = ["cloneElement", "className"];
|
|
6
7
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
7
8
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
@@ -13,10 +14,12 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
13
14
|
* Side Public License, v 1.
|
|
14
15
|
*/
|
|
15
16
|
|
|
16
|
-
import React, { useContext, useEffect, useRef, useMemo, useState } from 'react';
|
|
17
|
+
import React, { useContext, useEffect, useRef, useMemo, useState, useCallback } from 'react';
|
|
17
18
|
import classNames from 'classnames';
|
|
18
19
|
import { css } from '@emotion/css';
|
|
20
|
+
import { Global } from '@emotion/react';
|
|
19
21
|
import isEqual from 'lodash/isEqual';
|
|
22
|
+
import { cloneElementWithCss } from '../emotion';
|
|
20
23
|
import { EuiSystemContext, EuiThemeContext, EuiNestedThemeContext, EuiModificationsContext, EuiColorModeContext } from './context';
|
|
21
24
|
import { EuiEmotionThemeProvider } from './emotion';
|
|
22
25
|
import { buildTheme, getColorMode, getComputed, mergeDeep } from './utils';
|
|
@@ -29,7 +32,9 @@ export var EuiThemeProvider = function EuiThemeProvider(_ref) {
|
|
|
29
32
|
wrapperProps = _ref.wrapperProps;
|
|
30
33
|
var _useContext = useContext(EuiNestedThemeContext),
|
|
31
34
|
isGlobalTheme = _useContext.isGlobalTheme,
|
|
32
|
-
bodyColor = _useContext.bodyColor
|
|
35
|
+
bodyColor = _useContext.bodyColor,
|
|
36
|
+
globalCSSVariables = _useContext.globalCSSVariables,
|
|
37
|
+
setGlobalCSSVariables = _useContext.setGlobalCSSVariables;
|
|
33
38
|
var parentSystem = useContext(EuiSystemContext);
|
|
34
39
|
var parentModifications = useContext(EuiModificationsContext);
|
|
35
40
|
var parentColorMode = useContext(EuiColorModeContext);
|
|
@@ -84,15 +89,28 @@ export var EuiThemeProvider = function EuiThemeProvider(_ref) {
|
|
|
84
89
|
setTheme(getComputed(system, buildTheme(modifications, "_".concat(system.key)), colorMode));
|
|
85
90
|
}
|
|
86
91
|
}, [colorMode, system, modifications]);
|
|
92
|
+
var _useState9 = useState(),
|
|
93
|
+
_useState10 = _slicedToArray(_useState9, 2),
|
|
94
|
+
themeCSSVariables = _useState10[0],
|
|
95
|
+
_setThemeCSSVariables = _useState10[1];
|
|
96
|
+
var setThemeCSSVariables = useCallback(function (variables) {
|
|
97
|
+
return _setThemeCSSVariables(function (previous) {
|
|
98
|
+
return _objectSpread(_objectSpread({}, previous), variables);
|
|
99
|
+
});
|
|
100
|
+
}, []);
|
|
87
101
|
var nestedThemeContext = useMemo(function () {
|
|
88
102
|
return {
|
|
89
103
|
isGlobalTheme: false,
|
|
90
104
|
// The theme that determines the global body styles
|
|
91
105
|
bodyColor: isGlobalTheme ? theme.colors.text : bodyColor,
|
|
92
106
|
hasDifferentColorFromGlobalTheme: isGlobalTheme ? false : bodyColor !== theme.colors.text,
|
|
93
|
-
colorClassName: /*#__PURE__*/css("label:euiColorMode-", _colorMode, ";color:", theme.colors.text, ";;label:colorClassName;")
|
|
107
|
+
colorClassName: /*#__PURE__*/css("label:euiColorMode-", _colorMode, ";color:", theme.colors.text, ";;label:colorClassName;"),
|
|
108
|
+
setGlobalCSSVariables: isGlobalTheme ? setThemeCSSVariables : setGlobalCSSVariables,
|
|
109
|
+
globalCSSVariables: isGlobalTheme ? themeCSSVariables : globalCSSVariables,
|
|
110
|
+
setNearestThemeCSSVariables: setThemeCSSVariables,
|
|
111
|
+
themeCSSVariables: themeCSSVariables
|
|
94
112
|
};
|
|
95
|
-
}, [theme, isGlobalTheme, bodyColor, _colorMode]);
|
|
113
|
+
}, [theme, isGlobalTheme, bodyColor, _colorMode, setGlobalCSSVariables, globalCSSVariables, setThemeCSSVariables, themeCSSVariables]);
|
|
96
114
|
var renderedChildren = useMemo(function () {
|
|
97
115
|
if (isGlobalTheme) {
|
|
98
116
|
return children; // No wrapper
|
|
@@ -105,8 +123,15 @@ export var EuiThemeProvider = function EuiThemeProvider(_ref) {
|
|
|
105
123
|
var props = _objectSpread(_objectSpread({}, rest), {}, {
|
|
106
124
|
className: classNames(className, nestedThemeContext.colorClassName)
|
|
107
125
|
});
|
|
126
|
+
// Condition avoids rendering an empty Emotion selector if no
|
|
127
|
+
// theme-specific CSS variables have been set by child components
|
|
128
|
+
if (themeCSSVariables) {
|
|
129
|
+
props.css = _objectSpread({
|
|
130
|
+
label: 'euiCSSVariables'
|
|
131
|
+
}, themeCSSVariables);
|
|
132
|
+
}
|
|
108
133
|
if (cloneElement) {
|
|
109
|
-
return
|
|
134
|
+
return cloneElementWithCss(children, _objectSpread(_objectSpread({}, props), {}, {
|
|
110
135
|
className: classNames(children.props.className, props.className)
|
|
111
136
|
}));
|
|
112
137
|
} else {
|
|
@@ -114,8 +139,12 @@ export var EuiThemeProvider = function EuiThemeProvider(_ref) {
|
|
|
114
139
|
className: classNames('euiThemeProvider', props.className)
|
|
115
140
|
}), children);
|
|
116
141
|
}
|
|
117
|
-
}, [isGlobalTheme, nestedThemeContext, wrapperProps, children]);
|
|
118
|
-
return ___EmotionJSX(
|
|
142
|
+
}, [isGlobalTheme, themeCSSVariables, nestedThemeContext, wrapperProps, children]);
|
|
143
|
+
return ___EmotionJSX(React.Fragment, null, isGlobalTheme && themeCSSVariables && ___EmotionJSX(Global, {
|
|
144
|
+
styles: /*#__PURE__*/_css({
|
|
145
|
+
':root': themeCSSVariables
|
|
146
|
+
}, ";label:EuiThemeProvider;")
|
|
147
|
+
}), ___EmotionJSX(EuiColorModeContext.Provider, {
|
|
119
148
|
value: colorMode
|
|
120
149
|
}, ___EmotionJSX(EuiSystemContext.Provider, {
|
|
121
150
|
value: system
|
|
@@ -125,5 +154,5 @@ export var EuiThemeProvider = function EuiThemeProvider(_ref) {
|
|
|
125
154
|
value: theme
|
|
126
155
|
}, ___EmotionJSX(EuiNestedThemeContext.Provider, {
|
|
127
156
|
value: nestedThemeContext
|
|
128
|
-
}, ___EmotionJSX(EuiEmotionThemeProvider, null, renderedChildren))))));
|
|
157
|
+
}, ___EmotionJSX(EuiEmotionThemeProvider, null, renderedChildren)))))));
|
|
129
158
|
};
|
|
@@ -30,6 +30,7 @@ export var fontBase = {
|
|
|
30
30
|
familySerif: 'Georgia, Times, Times New Roman, serif',
|
|
31
31
|
// Careful using ligatures. Code editors like ACE will often error because of width calculations
|
|
32
32
|
featureSettings: "'calt' 1, 'kern' 1, 'liga' 1",
|
|
33
|
+
defaultUnits: 'rem',
|
|
33
34
|
baseline: computed(function (_ref) {
|
|
34
35
|
var _ref2 = _slicedToArray(_ref, 1),
|
|
35
36
|
base = _ref2[0];
|
|
@@ -7,6 +7,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
});
|
|
8
8
|
exports.PADDING_SIZES = exports.EuiAccordionClass = exports.EuiAccordion = void 0;
|
|
9
9
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
10
|
+
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
10
11
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
11
12
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
12
13
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
@@ -27,7 +28,8 @@ var _button = require("../button");
|
|
|
27
28
|
var _accordion = require("./accordion.styles");
|
|
28
29
|
var _global_styling = require("../../global_styling");
|
|
29
30
|
var _react2 = require("@emotion/react");
|
|
30
|
-
var _excluded = ["children", "buttonContent", "className", "id", "element", "buttonClassName", "buttonContentClassName", "extraAction", "paddingSize", "initialIsOpen", "arrowDisplay", "forceState", "isLoading", "isLoadingMessage", "isDisabled", "buttonProps", "buttonElement", "arrowProps", "theme"]
|
|
31
|
+
var _excluded = ["children", "buttonContent", "className", "id", "element", "buttonClassName", "buttonContentClassName", "extraAction", "paddingSize", "borders", "initialIsOpen", "arrowDisplay", "forceState", "isLoading", "isLoadingMessage", "isDisabled", "buttonProps", "buttonElement", "arrowProps", "theme"],
|
|
32
|
+
_excluded2 = ["paddingSize", "className", "css"];
|
|
31
33
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
32
34
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
33
35
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
|
|
@@ -165,18 +167,24 @@ var EuiAccordionClass = /*#__PURE__*/function (_Component) {
|
|
|
165
167
|
buttonContentClassName = _this$props3.buttonContentClassName,
|
|
166
168
|
extraAction = _this$props3.extraAction,
|
|
167
169
|
paddingSize = _this$props3.paddingSize,
|
|
170
|
+
borders = _this$props3.borders,
|
|
168
171
|
initialIsOpen = _this$props3.initialIsOpen,
|
|
169
172
|
arrowDisplay = _this$props3.arrowDisplay,
|
|
170
173
|
forceState = _this$props3.forceState,
|
|
171
174
|
isLoading = _this$props3.isLoading,
|
|
172
175
|
isLoadingMessage = _this$props3.isLoadingMessage,
|
|
173
176
|
isDisabled = _this$props3.isDisabled,
|
|
174
|
-
|
|
177
|
+
_buttonProps = _this$props3.buttonProps,
|
|
175
178
|
_this$props3$buttonEl = _this$props3.buttonElement,
|
|
176
179
|
_ButtonElement = _this$props3$buttonEl === void 0 ? 'button' : _this$props3$buttonEl,
|
|
177
180
|
arrowProps = _this$props3.arrowProps,
|
|
178
181
|
theme = _this$props3.theme,
|
|
179
182
|
rest = (0, _objectWithoutProperties2.default)(_this$props3, _excluded);
|
|
183
|
+
var _ref = _buttonProps || {},
|
|
184
|
+
buttonPaddingSize = _ref.paddingSize,
|
|
185
|
+
buttonPropsClassName = _ref.className,
|
|
186
|
+
buttonPropsCss = _ref.css,
|
|
187
|
+
buttonProps = (0, _objectWithoutProperties2.default)(_ref, _excluded2);
|
|
180
188
|
|
|
181
189
|
// Force button element to be a legend if the element is a fieldset
|
|
182
190
|
var ButtonElement = Element === 'fieldset' ? 'legend' : _ButtonElement;
|
|
@@ -187,10 +195,12 @@ var EuiAccordionClass = /*#__PURE__*/function (_Component) {
|
|
|
187
195
|
var classes = (0, _classnames.default)('euiAccordion', {
|
|
188
196
|
'euiAccordion-isOpen': this.isOpen
|
|
189
197
|
}, className);
|
|
198
|
+
var styles = (0, _accordion.euiAccordionStyles)(theme);
|
|
199
|
+
var cssStyles = [styles.euiAccordion, borders !== 'none' && styles.borders.borders, borders !== 'none' && styles.borders[borders]];
|
|
190
200
|
var childrenClasses = (0, _classnames.default)('euiAccordion__children', {
|
|
191
201
|
'euiAccordion__children-isLoading': isLoading
|
|
192
202
|
});
|
|
193
|
-
var buttonClasses = (0, _classnames.default)('euiAccordion__button', buttonClassName,
|
|
203
|
+
var buttonClasses = (0, _classnames.default)('euiAccordion__button', buttonClassName, buttonPropsClassName);
|
|
194
204
|
var buttonContentClasses = (0, _classnames.default)('euiAccordion__buttonContent', buttonContentClassName);
|
|
195
205
|
var iconButtonClasses = (0, _classnames.default)('euiAccordion__iconButton', {
|
|
196
206
|
'euiAccordion__iconButton-isOpen': this.isOpen,
|
|
@@ -199,7 +209,7 @@ var EuiAccordionClass = /*#__PURE__*/function (_Component) {
|
|
|
199
209
|
|
|
200
210
|
// Emotion styles
|
|
201
211
|
var buttonStyles = (0, _accordion.euiAccordionButtonStyles)(theme);
|
|
202
|
-
var cssButtonStyles = [buttonStyles.euiAccordion__button, isDisabled && buttonStyles.disabled,
|
|
212
|
+
var cssButtonStyles = [buttonStyles.euiAccordion__button, isDisabled && buttonStyles.disabled].concat((0, _toConsumableArray2.default)(buttonPaddingSize ? [buttonStyles[buttonPaddingSize], arrowDisplay === 'left' && buttonStyles.arrowLeft, arrowDisplay === 'right' && buttonStyles.arrowRight] : []), [buttonPropsCss]);
|
|
203
213
|
var childrenStyles = (0, _accordion.euiAccordionChildrenStyles)(theme);
|
|
204
214
|
var cssChildrenStyles = [childrenStyles.euiAccordion__children, isLoading && childrenStyles.isLoading, paddingSize && paddingSize !== 'none' && childrenStyles[paddingSize]];
|
|
205
215
|
var childWrapperStyles = (0, _accordion.euiAccordionChildWrapperStyles)(theme);
|
|
@@ -213,7 +223,7 @@ var EuiAccordionClass = /*#__PURE__*/function (_Component) {
|
|
|
213
223
|
var triggerWrapperStyles = (0, _accordion.euiAccordionTriggerWrapperStyles)();
|
|
214
224
|
var cssTriggerWrapperStyles = [triggerWrapperStyles.euiAccordion__triggerWrapper];
|
|
215
225
|
var iconButton;
|
|
216
|
-
var buttonId = (_buttonProps$id = buttonProps
|
|
226
|
+
var buttonId = (_buttonProps$id = buttonProps.id) !== null && _buttonProps$id !== void 0 ? _buttonProps$id : this.generatedId;
|
|
217
227
|
if (_arrowDisplay !== 'none') {
|
|
218
228
|
iconButton = (0, _react2.jsx)(_button.EuiButtonIcon, (0, _extends2.default)({
|
|
219
229
|
color: "text"
|
|
@@ -265,7 +275,8 @@ var EuiAccordionClass = /*#__PURE__*/function (_Component) {
|
|
|
265
275
|
className: buttonContentClasses
|
|
266
276
|
}, buttonContent));
|
|
267
277
|
return (0, _react2.jsx)(Element, (0, _extends2.default)({
|
|
268
|
-
className: classes
|
|
278
|
+
className: classes,
|
|
279
|
+
css: cssStyles
|
|
269
280
|
}, rest), (0, _react2.jsx)("div", {
|
|
270
281
|
className: "euiAccordion__triggerWrapper",
|
|
271
282
|
css: cssTriggerWrapperStyles
|
|
@@ -297,6 +308,7 @@ var EuiAccordionClass = /*#__PURE__*/function (_Component) {
|
|
|
297
308
|
exports.EuiAccordionClass = EuiAccordionClass;
|
|
298
309
|
(0, _defineProperty2.default)(EuiAccordionClass, "defaultProps", {
|
|
299
310
|
initialIsOpen: false,
|
|
311
|
+
borders: 'none',
|
|
300
312
|
paddingSize: 'none',
|
|
301
313
|
arrowDisplay: 'left',
|
|
302
314
|
isLoading: false,
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.euiAccordionTriggerWrapperStyles = exports.euiAccordionSpinnerStyles = exports.euiAccordionOptionalActionStyles = exports.euiAccordionIconButtonStyles = exports.euiAccordionChildrenStyles = exports.euiAccordionChildWrapperStyles = exports.euiAccordionButtonStyles = void 0;
|
|
6
|
+
exports.euiAccordionTriggerWrapperStyles = exports.euiAccordionStyles = exports.euiAccordionSpinnerStyles = exports.euiAccordionOptionalActionStyles = exports.euiAccordionIconButtonStyles = exports.euiAccordionChildrenStyles = exports.euiAccordionChildWrapperStyles = exports.euiAccordionButtonStyles = void 0;
|
|
7
7
|
var _react = require("@emotion/react");
|
|
8
8
|
var _global_styling = require("../../global_styling");
|
|
9
9
|
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)."; } /*
|
|
@@ -13,13 +13,34 @@ function _EMOTION_STRINGIFIED_CSS_ERROR__() { return "You have tried to stringif
|
|
|
13
13
|
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
14
14
|
* Side Public License, v 1.
|
|
15
15
|
*/
|
|
16
|
+
var euiAccordionStyles = function euiAccordionStyles(_ref5) {
|
|
17
|
+
var euiTheme = _ref5.euiTheme;
|
|
18
|
+
return {
|
|
19
|
+
euiAccordion: /*#__PURE__*/(0, _react.css)(";label:euiAccordion;"),
|
|
20
|
+
// Borders
|
|
21
|
+
borders: {
|
|
22
|
+
// Prevent border repeats
|
|
23
|
+
borders: /*#__PURE__*/(0, _react.css)("&+[class*='euiAccordion-borders']{", (0, _global_styling.logicalCSS)('border-top', 'none'), ";};label:borders;"),
|
|
24
|
+
horizontal: /*#__PURE__*/(0, _react.css)("border-block:", euiTheme.border.thin, ";;label:horizontal;"),
|
|
25
|
+
all: /*#__PURE__*/(0, _react.css)("border:", euiTheme.border.thin, ";;label:all;")
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
exports.euiAccordionStyles = euiAccordionStyles;
|
|
16
30
|
var euiAccordionButtonStyles = function euiAccordionButtonStyles(euiThemeContext) {
|
|
17
31
|
var euiTheme = euiThemeContext.euiTheme;
|
|
18
32
|
return {
|
|
19
33
|
euiAccordion__button: /*#__PURE__*/(0, _react.css)((0, _global_styling.euiFontSize)(euiThemeContext, 's'), " align-items:center;display:flex;flex-grow:1;line-height:", euiTheme.size.l, ";", (0, _global_styling.logicalTextAlignCSS)('left'), " ", (0, _global_styling.logicalCSS)('width', '100%'), " &:hover,&:focus{cursor:pointer;text-decoration:underline;};label:euiAccordion__button;"),
|
|
20
34
|
// Triggering button needs separate `disabled` key because the element that renders may not support `:disabled`;
|
|
21
35
|
// Hover pseudo selector for specificity
|
|
22
|
-
disabled: /*#__PURE__*/(0, _react.css)("&,&:hover{cursor:not-allowed;color:", euiTheme.colors.disabledText, ";text-decoration:none;};label:disabled;")
|
|
36
|
+
disabled: /*#__PURE__*/(0, _react.css)("&,&:hover{cursor:not-allowed;color:", euiTheme.colors.disabledText, ";text-decoration:none;};label:disabled;"),
|
|
37
|
+
// Optional padding sizes
|
|
38
|
+
s: /*#__PURE__*/(0, _react.css)("padding:", euiTheme.size.s, ";;label:s;"),
|
|
39
|
+
m: /*#__PURE__*/(0, _react.css)("padding:", euiTheme.size.base, ";;label:m;"),
|
|
40
|
+
l: /*#__PURE__*/(0, _react.css)("padding:", euiTheme.size.l, ";;label:l;"),
|
|
41
|
+
// Remove padding from the accordion button on the side that the arrow is on
|
|
42
|
+
arrowLeft: /*#__PURE__*/(0, _react.css)((0, _global_styling.logicalCSS)('padding-left', 0), ";;label:arrowLeft;"),
|
|
43
|
+
arrowRight: /*#__PURE__*/(0, _react.css)((0, _global_styling.logicalCSS)('padding-left', 0), ";;label:arrowRight;")
|
|
23
44
|
};
|
|
24
45
|
};
|
|
25
46
|
exports.euiAccordionButtonStyles = euiAccordionButtonStyles;
|
|
@@ -31,8 +52,8 @@ var _ref4 = process.env.NODE_ENV === "production" ? {
|
|
|
31
52
|
styles: "align-items:center;display:flex;label:isLoading;",
|
|
32
53
|
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
33
54
|
};
|
|
34
|
-
var euiAccordionChildrenStyles = function euiAccordionChildrenStyles(
|
|
35
|
-
var euiTheme =
|
|
55
|
+
var euiAccordionChildrenStyles = function euiAccordionChildrenStyles(_ref6) {
|
|
56
|
+
var euiTheme = _ref6.euiTheme;
|
|
36
57
|
return {
|
|
37
58
|
euiAccordion__children: /*#__PURE__*/(0, _react.css)(";label:euiAccordion__children;"),
|
|
38
59
|
isLoading: _ref4,
|
|
@@ -44,8 +65,8 @@ var euiAccordionChildrenStyles = function euiAccordionChildrenStyles(_ref5) {
|
|
|
44
65
|
};
|
|
45
66
|
};
|
|
46
67
|
exports.euiAccordionChildrenStyles = euiAccordionChildrenStyles;
|
|
47
|
-
var euiAccordionChildWrapperStyles = function euiAccordionChildWrapperStyles(
|
|
48
|
-
var euiTheme =
|
|
68
|
+
var euiAccordionChildWrapperStyles = function euiAccordionChildWrapperStyles(_ref7) {
|
|
69
|
+
var euiTheme = _ref7.euiTheme;
|
|
49
70
|
return {
|
|
50
71
|
euiAccordion__childWrapper: /*#__PURE__*/(0, _react.css)((0, _global_styling.logicalCSS)('height', 0), " opacity:0;overflow:hidden;transition:", _global_styling.logicals.height, " ", euiTheme.animation.normal, " ", euiTheme.animation.resistance, ",opacity ", euiTheme.animation.normal, " ", euiTheme.animation.resistance, ";visibility:hidden;&:focus{outline:none;};label:euiAccordion__childWrapper;"),
|
|
51
72
|
isOpen: /*#__PURE__*/(0, _react.css)((0, _global_styling.logicalCSS)('height', 'auto'), " opacity:1;visibility:visible;;label:isOpen;")
|
|
@@ -60,8 +81,8 @@ var _ref3 = process.env.NODE_ENV === "production" ? {
|
|
|
60
81
|
styles: "transform:rotate(\n 90deg\n )!important;label:isOpen;",
|
|
61
82
|
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
62
83
|
};
|
|
63
|
-
var euiAccordionIconButtonStyles = function euiAccordionIconButtonStyles(
|
|
64
|
-
var euiTheme =
|
|
84
|
+
var euiAccordionIconButtonStyles = function euiAccordionIconButtonStyles(_ref8) {
|
|
85
|
+
var euiTheme = _ref8.euiTheme;
|
|
65
86
|
return {
|
|
66
87
|
euiAccordion__iconButton: /*#__PURE__*/(0, _react.css)("flex-shrink:0;", (0, _global_styling.logicalCSS)('margin-right', euiTheme.size.xs), " transform:rotate(\n 0deg\n )!important;;label:euiAccordion__iconButton;"),
|
|
67
88
|
isOpen: _ref3,
|
|
@@ -83,8 +104,8 @@ var euiAccordionOptionalActionStyles = function euiAccordionOptionalActionStyles
|
|
|
83
104
|
};
|
|
84
105
|
};
|
|
85
106
|
exports.euiAccordionOptionalActionStyles = euiAccordionOptionalActionStyles;
|
|
86
|
-
var euiAccordionSpinnerStyles = function euiAccordionSpinnerStyles(
|
|
87
|
-
var euiTheme =
|
|
107
|
+
var euiAccordionSpinnerStyles = function euiAccordionSpinnerStyles(_ref9) {
|
|
108
|
+
var euiTheme = _ref9.euiTheme;
|
|
88
109
|
return {
|
|
89
110
|
euiAccordion__spinner: /*#__PURE__*/(0, _react.css)((0, _global_styling.logicalCSS)('margin-right', euiTheme.size.xs), ";;label:euiAccordion__spinner;")
|
|
90
111
|
};
|
|
@@ -14,7 +14,6 @@ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/h
|
|
|
14
14
|
var _react = _interopRequireWildcard(require("react"));
|
|
15
15
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
16
16
|
var _services = require("../../services");
|
|
17
|
-
var _global_styling = require("../../global_styling");
|
|
18
17
|
var _flyout = require("../flyout");
|
|
19
18
|
var _i18n = require("../i18n");
|
|
20
19
|
var _header = require("../header/header.styles");
|
|
@@ -22,7 +21,7 @@ var _context = require("./context");
|
|
|
22
21
|
var _collapsible_nav_button = require("./collapsible_nav_button");
|
|
23
22
|
var _collapsible_nav_beta = require("./collapsible_nav_beta.styles");
|
|
24
23
|
var _react2 = require("@emotion/react");
|
|
25
|
-
var _excluded = ["id", "children", "className", "
|
|
24
|
+
var _excluded = ["id", "children", "className", "initialIsCollapsed", "onCollapseToggle", "width", "side", "focusTrapProps"];
|
|
26
25
|
/*
|
|
27
26
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
28
27
|
* or more contributor license agreements. Licensed under the Elastic License
|
|
@@ -38,9 +37,9 @@ var EuiCollapsibleNavBeta = function EuiCollapsibleNavBeta(_ref) {
|
|
|
38
37
|
var id = _ref.id,
|
|
39
38
|
children = _ref.children,
|
|
40
39
|
className = _ref.className,
|
|
41
|
-
style = _ref.style,
|
|
42
40
|
_ref$initialIsCollaps = _ref.initialIsCollapsed,
|
|
43
41
|
initialIsCollapsed = _ref$initialIsCollaps === void 0 ? false : _ref$initialIsCollaps,
|
|
42
|
+
onCollapseToggle = _ref.onCollapseToggle,
|
|
44
43
|
_ref$width = _ref.width,
|
|
45
44
|
_width = _ref$width === void 0 ? 248 : _ref$width,
|
|
46
45
|
_ref$side = _ref.side,
|
|
@@ -59,9 +58,10 @@ var EuiCollapsibleNavBeta = function EuiCollapsibleNavBeta(_ref) {
|
|
|
59
58
|
setIsCollapsed = _useState2[1];
|
|
60
59
|
var toggleCollapsed = (0, _react.useCallback)(function () {
|
|
61
60
|
return setIsCollapsed(function (isCollapsed) {
|
|
61
|
+
onCollapseToggle === null || onCollapseToggle === void 0 ? void 0 : onCollapseToggle(!isCollapsed);
|
|
62
62
|
return !isCollapsed;
|
|
63
63
|
});
|
|
64
|
-
}, []);
|
|
64
|
+
}, [onCollapseToggle]);
|
|
65
65
|
var onClose = (0, _react.useCallback)(function () {
|
|
66
66
|
return setIsCollapsed(true);
|
|
67
67
|
}, []);
|
|
@@ -107,24 +107,6 @@ var EuiCollapsibleNavBeta = function EuiCollapsibleNavBeta(_ref) {
|
|
|
107
107
|
return _width;
|
|
108
108
|
}, [_width, isOverlayFullWidth, isPush, isCollapsed, headerHeight]);
|
|
109
109
|
|
|
110
|
-
/**
|
|
111
|
-
* Header affordance
|
|
112
|
-
*/
|
|
113
|
-
var _useState7 = (0, _react.useState)(false),
|
|
114
|
-
_useState8 = (0, _slicedToArray2.default)(_useState7, 2),
|
|
115
|
-
fixedHeadersCount = _useState8[0],
|
|
116
|
-
setFixedHeadersCount = _useState8[1];
|
|
117
|
-
(0, _react.useEffect)(function () {
|
|
118
|
-
setFixedHeadersCount(document.querySelectorAll('.euiHeader[data-fixed-header]').length);
|
|
119
|
-
}, []);
|
|
120
|
-
var stylesWithHeaderOffset = (0, _react.useMemo)(function () {
|
|
121
|
-
if (!fixedHeadersCount) return style;
|
|
122
|
-
var headersOffset = (0, _global_styling.mathWithUnits)(headerHeight, function (x) {
|
|
123
|
-
return x * fixedHeadersCount;
|
|
124
|
-
});
|
|
125
|
-
return _objectSpread(_objectSpread(_objectSpread({}, style), (0, _global_styling.logicalStyle)('top', headersOffset)), (0, _global_styling.logicalStyle)('height', "calc(100% - ".concat(headersOffset, ")")));
|
|
126
|
-
}, [fixedHeadersCount, style, headerHeight]);
|
|
127
|
-
|
|
128
110
|
/**
|
|
129
111
|
* Prop setup
|
|
130
112
|
*/
|
|
@@ -142,16 +124,13 @@ var EuiCollapsibleNavBeta = function EuiCollapsibleNavBeta(_ref) {
|
|
|
142
124
|
var classes = (0, _classnames.default)('euiCollapsibleNav', 'euiCollapsibleNavBeta', className);
|
|
143
125
|
var styles = (0, _collapsible_nav_beta.euiCollapsibleNavBetaStyles)(euiTheme);
|
|
144
126
|
var cssStyles = [styles.euiCollapsibleNavBeta, styles[side], isPush && styles.isPush, isPush && isCollapsed && styles.isPushCollapsed, isOverlayFullWidth && styles.isOverlayFullWidth];
|
|
145
|
-
|
|
146
|
-
// Wait for any fixed headers to be queried before rendering (prevents position jumping)
|
|
147
|
-
var flyout = fixedHeadersCount !== false && (0, _react2.jsx)(_flyout.EuiFlyout, (0, _extends2.default)({
|
|
127
|
+
var flyout = (0, _react2.jsx)(_flyout.EuiFlyout, (0, _extends2.default)({
|
|
148
128
|
"aria-label": defaultAriaLabel
|
|
149
129
|
}, rest, {
|
|
150
130
|
// EuiCollapsibleNav is significantly less permissive than EuiFlyout
|
|
151
131
|
id: flyoutID,
|
|
152
132
|
css: cssStyles,
|
|
153
133
|
className: classes,
|
|
154
|
-
style: stylesWithHeaderOffset,
|
|
155
134
|
size: width,
|
|
156
135
|
side: side,
|
|
157
136
|
focusTrapProps: focusTrapProps,
|
|
@@ -7,6 +7,7 @@ exports.euiCollapsibleNavBetaStyles = void 0;
|
|
|
7
7
|
var _react = require("@emotion/react");
|
|
8
8
|
var _global_styling = require("../../global_styling");
|
|
9
9
|
var _themes = require("../../themes");
|
|
10
|
+
var _header = require("../header/header.styles");
|
|
10
11
|
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)."; } /*
|
|
11
12
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
12
13
|
* or more contributor license agreements. Licensed under the Elastic License
|
|
@@ -24,8 +25,16 @@ var _ref = process.env.NODE_ENV === "production" ? {
|
|
|
24
25
|
};
|
|
25
26
|
var euiCollapsibleNavBetaStyles = function euiCollapsibleNavBetaStyles(euiThemeContext) {
|
|
26
27
|
var euiTheme = euiThemeContext.euiTheme;
|
|
28
|
+
|
|
29
|
+
// At least for serverless, EuiCollapsibleNav is only going to be used with 1
|
|
30
|
+
// fixed header. For those scenarios, we can prevent a minor layout jump on
|
|
31
|
+
// page load by setting the CSS var fallback to the height of a single header
|
|
32
|
+
var defaultHeaderHeight = (0, _header.euiHeaderVariables)(euiThemeContext).height;
|
|
33
|
+
var fixedHeaderOffset = "var(--euiFixedHeadersOffset, ".concat(defaultHeaderHeight, ")");
|
|
27
34
|
return {
|
|
28
|
-
euiCollapsibleNavBeta: /*#__PURE__*/(0, _react.css)((0, _global_styling.logicalCSS)('
|
|
35
|
+
euiCollapsibleNavBeta: /*#__PURE__*/(0, _react.css)((0, _global_styling.logicalCSS)('top', fixedHeaderOffset), (0, _global_styling.euiYScroll)(euiThemeContext, {
|
|
36
|
+
height: 'inherit'
|
|
37
|
+
}), (0, _global_styling.logicalCSS)('padding-bottom', euiTheme.size.xs), ".euiFlyoutBody{", (0, _global_styling.logicalCSS)('min-height', '50%'), ";}.euiFlyoutFooter{background-color:", euiTheme.colors.emptyShade, ";", (0, _global_styling.logicalCSS)('border-top', euiTheme.border.thin), ";};label:euiCollapsibleNavBeta;"),
|
|
29
38
|
left: /*#__PURE__*/(0, _react.css)((0, _global_styling.logicalCSS)('border-right', euiTheme.border.thin), ";;label:left;"),
|
|
30
39
|
right: /*#__PURE__*/(0, _react.css)((0, _global_styling.logicalCSS)('border-left', euiTheme.border.thin), ";;label:right;"),
|
|
31
40
|
isPush: /*#__PURE__*/(0, _react.css)((0, _themes.euiShadowFlat)(euiThemeContext), ";;label:isPush;"),
|
|
@@ -64,6 +64,7 @@ var useDataGridKeyboardShortcuts = function useDataGridKeyboardShortcuts() {
|
|
|
64
64
|
}, (0, _react2.jsx)(_description_list.EuiDescriptionList, {
|
|
65
65
|
"aria-labelledby": titleId,
|
|
66
66
|
type: "column",
|
|
67
|
+
columnWidths: [1, 3],
|
|
67
68
|
align: "center",
|
|
68
69
|
compressed: true,
|
|
69
70
|
listItems: [{
|
|
@@ -7,6 +7,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
});
|
|
8
8
|
exports.EuiDescriptionList = void 0;
|
|
9
9
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
10
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
10
11
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
11
12
|
var _react = _interopRequireWildcard(require("react"));
|
|
12
13
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
@@ -16,7 +17,7 @@ var _description_list_title = require("./description_list_title");
|
|
|
16
17
|
var _description_list_description = require("./description_list_description");
|
|
17
18
|
var _description_list = require("./description_list.styles");
|
|
18
19
|
var _react2 = require("@emotion/react");
|
|
19
|
-
var _excluded = ["align", "children", "className", "compressed", "descriptionProps", "listItems", "textStyle", "titleProps", "type", "rowGutterSize", "columnGutterSize"];
|
|
20
|
+
var _excluded = ["align", "children", "className", "style", "compressed", "descriptionProps", "listItems", "textStyle", "titleProps", "type", "rowGutterSize", "columnGutterSize", "columnWidths"];
|
|
20
21
|
/*
|
|
21
22
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
22
23
|
* or more contributor license agreements. Licensed under the Elastic License
|
|
@@ -26,11 +27,14 @@ var _excluded = ["align", "children", "className", "compressed", "descriptionPro
|
|
|
26
27
|
*/
|
|
27
28
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
28
29
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
30
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
31
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
29
32
|
var EuiDescriptionList = function EuiDescriptionList(_ref) {
|
|
30
33
|
var _ref$align = _ref.align,
|
|
31
34
|
align = _ref$align === void 0 ? 'left' : _ref$align,
|
|
32
35
|
children = _ref.children,
|
|
33
36
|
className = _ref.className,
|
|
37
|
+
style = _ref.style,
|
|
34
38
|
_ref$compressed = _ref.compressed,
|
|
35
39
|
compressed = _ref$compressed === void 0 ? false : _ref$compressed,
|
|
36
40
|
descriptionProps = _ref.descriptionProps,
|
|
@@ -44,6 +48,7 @@ var EuiDescriptionList = function EuiDescriptionList(_ref) {
|
|
|
44
48
|
rowGutterSize = _ref$rowGutterSize === void 0 ? 's' : _ref$rowGutterSize,
|
|
45
49
|
_ref$columnGutterSize = _ref.columnGutterSize,
|
|
46
50
|
columnGutterSize = _ref$columnGutterSize === void 0 ? 's' : _ref$columnGutterSize,
|
|
51
|
+
columnWidths = _ref.columnWidths,
|
|
47
52
|
rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
48
53
|
var showResponsiveColumns = (0, _services.useIsWithinBreakpoints)(['xs', 's']);
|
|
49
54
|
var type = (0, _react.useMemo)(function () {
|
|
@@ -56,6 +61,20 @@ var EuiDescriptionList = function EuiDescriptionList(_ref) {
|
|
|
56
61
|
var euiTheme = (0, _services.useEuiTheme)();
|
|
57
62
|
var styles = (0, _description_list.euiDescriptionListStyles)(euiTheme);
|
|
58
63
|
var cssStyles = [styles.euiDescriptionList, styles[type], styles[align], type === 'column' && styles.rowGap[rowGutterSize], type === 'column' && styles.columnGap[columnGutterSize]];
|
|
64
|
+
var inlineStyles = (0, _react.useMemo)(function () {
|
|
65
|
+
if (type === 'column' && columnWidths) {
|
|
66
|
+
// Leave string values as is - e.g. if a consumer passes in a specific '200px' or 'minmax()'
|
|
67
|
+
var convertNumbersToFr = function convertNumbersToFr(value) {
|
|
68
|
+
return typeof value === 'number' ? "".concat(value, "fr") : value;
|
|
69
|
+
};
|
|
70
|
+
var titleWidth = convertNumbersToFr(columnWidths[0]);
|
|
71
|
+
var descriptionWidth = convertNumbersToFr(columnWidths[1]);
|
|
72
|
+
return _objectSpread({
|
|
73
|
+
gridTemplateColumns: "".concat(titleWidth, " ").concat(descriptionWidth)
|
|
74
|
+
}, style);
|
|
75
|
+
}
|
|
76
|
+
return style;
|
|
77
|
+
}, [style, type, columnWidths]);
|
|
59
78
|
var classes = (0, _classnames.default)('euiDescriptionList', className);
|
|
60
79
|
var childrenOrListItems = null;
|
|
61
80
|
if (listItems) {
|
|
@@ -79,7 +98,8 @@ var EuiDescriptionList = function EuiDescriptionList(_ref) {
|
|
|
79
98
|
}
|
|
80
99
|
}, (0, _react2.jsx)("dl", (0, _extends2.default)({
|
|
81
100
|
className: classes,
|
|
82
|
-
css: cssStyles
|
|
101
|
+
css: cssStyles,
|
|
102
|
+
style: inlineStyles
|
|
83
103
|
}, rest, {
|
|
84
104
|
"data-type": _type
|
|
85
105
|
}), childrenOrListItems));
|
|
@@ -41,7 +41,7 @@ exports.euiFlyoutCloseButtonStyles = euiFlyoutCloseButtonStyles;
|
|
|
41
41
|
var euiFlyoutStyles = function euiFlyoutStyles(euiThemeContext) {
|
|
42
42
|
var euiTheme = euiThemeContext.euiTheme;
|
|
43
43
|
return {
|
|
44
|
-
euiFlyout: /*#__PURE__*/(0, _react.css)("position:fixed;", (0, _global_styling.logicalCSS)('
|
|
44
|
+
euiFlyout: /*#__PURE__*/(0, _react.css)("position:fixed;", (0, _global_styling.logicalCSS)('bottom', 0), " ", (0, _global_styling.logicalCSS)('top', 'var(--euiFixedHeadersOffset, 0)'), " ", (0, _global_styling.logicalCSS)('height', 'inherit'), " z-index:", euiTheme.levels.flyout, ";background:", euiTheme.colors.emptyShade, ";display:flex;flex-direction:column;align-items:stretch;&:focus{outline:none;}", (0, _global_styling.euiMaxBreakpoint)(euiThemeContext, 'm'), "{", (0, _global_styling.logicalCSS)('max-width', '90vw !important'), ";};label:euiFlyout;"),
|
|
45
45
|
// Flyout sizes
|
|
46
46
|
s: /*#__PURE__*/(0, _react.css)(composeFlyoutSizing(euiThemeContext, 's'), ";;label:s;"),
|
|
47
47
|
m: /*#__PURE__*/(0, _react.css)(composeFlyoutSizing(euiThemeContext, 'm'), ";;label:m;"),
|