@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
|
@@ -43,6 +43,7 @@ var fontBase = {
|
|
|
43
43
|
familySerif: 'Georgia, Times, Times New Roman, serif',
|
|
44
44
|
// Careful using ligatures. Code editors like ACE will often error because of width calculations
|
|
45
45
|
featureSettings: "'calt' 1, 'kern' 1, 'liga' 1",
|
|
46
|
+
defaultUnits: 'rem',
|
|
46
47
|
baseline: (0, _utils.computed)(function (_ref) {
|
|
47
48
|
var _ref2 = _slicedToArray(_ref, 1),
|
|
48
49
|
base = _ref2[0];
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
2
3
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
4
|
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
4
5
|
import _createClass from "@babel/runtime/helpers/createClass";
|
|
@@ -7,7 +8,8 @@ import _inherits from "@babel/runtime/helpers/inherits";
|
|
|
7
8
|
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
8
9
|
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
9
10
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
10
|
-
var _excluded = ["children", "buttonContent", "className", "id", "element", "buttonClassName", "buttonContentClassName", "extraAction", "paddingSize", "initialIsOpen", "arrowDisplay", "forceState", "isLoading", "isLoadingMessage", "isDisabled", "buttonProps", "buttonElement", "arrowProps", "theme"]
|
|
11
|
+
var _excluded = ["children", "buttonContent", "className", "id", "element", "buttonClassName", "buttonContentClassName", "extraAction", "paddingSize", "borders", "initialIsOpen", "arrowDisplay", "forceState", "isLoading", "isLoadingMessage", "isDisabled", "buttonProps", "buttonElement", "arrowProps", "theme"],
|
|
12
|
+
_excluded2 = ["paddingSize", "className", "css"];
|
|
11
13
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
12
14
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
13
15
|
/*
|
|
@@ -27,7 +29,7 @@ import { EuiText } from '../text';
|
|
|
27
29
|
import { EuiI18n } from '../i18n';
|
|
28
30
|
import { htmlIdGenerator, withEuiTheme } from '../../services';
|
|
29
31
|
import { EuiButtonIcon } from '../button';
|
|
30
|
-
import { euiAccordionButtonStyles, euiAccordionChildrenStyles, euiAccordionChildWrapperStyles, euiAccordionIconButtonStyles, euiAccordionOptionalActionStyles, euiAccordionSpinnerStyles, euiAccordionTriggerWrapperStyles } from './accordion.styles';
|
|
32
|
+
import { euiAccordionStyles, euiAccordionButtonStyles, euiAccordionChildrenStyles, euiAccordionChildWrapperStyles, euiAccordionIconButtonStyles, euiAccordionOptionalActionStyles, euiAccordionSpinnerStyles, euiAccordionTriggerWrapperStyles } from './accordion.styles';
|
|
31
33
|
import { logicalCSS } from '../../global_styling';
|
|
32
34
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
33
35
|
export var PADDING_SIZES = ['none', 'xs', 's', 'm', 'l', 'xl'];
|
|
@@ -156,18 +158,24 @@ export var EuiAccordionClass = /*#__PURE__*/function (_Component) {
|
|
|
156
158
|
buttonContentClassName = _this$props3.buttonContentClassName,
|
|
157
159
|
extraAction = _this$props3.extraAction,
|
|
158
160
|
paddingSize = _this$props3.paddingSize,
|
|
161
|
+
borders = _this$props3.borders,
|
|
159
162
|
initialIsOpen = _this$props3.initialIsOpen,
|
|
160
163
|
arrowDisplay = _this$props3.arrowDisplay,
|
|
161
164
|
forceState = _this$props3.forceState,
|
|
162
165
|
isLoading = _this$props3.isLoading,
|
|
163
166
|
isLoadingMessage = _this$props3.isLoadingMessage,
|
|
164
167
|
isDisabled = _this$props3.isDisabled,
|
|
165
|
-
|
|
168
|
+
_buttonProps = _this$props3.buttonProps,
|
|
166
169
|
_this$props3$buttonEl = _this$props3.buttonElement,
|
|
167
170
|
_ButtonElement = _this$props3$buttonEl === void 0 ? 'button' : _this$props3$buttonEl,
|
|
168
171
|
arrowProps = _this$props3.arrowProps,
|
|
169
172
|
theme = _this$props3.theme,
|
|
170
173
|
rest = _objectWithoutProperties(_this$props3, _excluded);
|
|
174
|
+
var _ref = _buttonProps || {},
|
|
175
|
+
buttonPaddingSize = _ref.paddingSize,
|
|
176
|
+
buttonPropsClassName = _ref.className,
|
|
177
|
+
buttonPropsCss = _ref.css,
|
|
178
|
+
buttonProps = _objectWithoutProperties(_ref, _excluded2);
|
|
171
179
|
|
|
172
180
|
// Force button element to be a legend if the element is a fieldset
|
|
173
181
|
var ButtonElement = Element === 'fieldset' ? 'legend' : _ButtonElement;
|
|
@@ -178,10 +186,12 @@ export var EuiAccordionClass = /*#__PURE__*/function (_Component) {
|
|
|
178
186
|
var classes = classNames('euiAccordion', {
|
|
179
187
|
'euiAccordion-isOpen': this.isOpen
|
|
180
188
|
}, className);
|
|
189
|
+
var styles = euiAccordionStyles(theme);
|
|
190
|
+
var cssStyles = [styles.euiAccordion, borders !== 'none' && styles.borders.borders, borders !== 'none' && styles.borders[borders]];
|
|
181
191
|
var childrenClasses = classNames('euiAccordion__children', {
|
|
182
192
|
'euiAccordion__children-isLoading': isLoading
|
|
183
193
|
});
|
|
184
|
-
var buttonClasses = classNames('euiAccordion__button', buttonClassName,
|
|
194
|
+
var buttonClasses = classNames('euiAccordion__button', buttonClassName, buttonPropsClassName);
|
|
185
195
|
var buttonContentClasses = classNames('euiAccordion__buttonContent', buttonContentClassName);
|
|
186
196
|
var iconButtonClasses = classNames('euiAccordion__iconButton', {
|
|
187
197
|
'euiAccordion__iconButton-isOpen': this.isOpen,
|
|
@@ -190,7 +200,7 @@ export var EuiAccordionClass = /*#__PURE__*/function (_Component) {
|
|
|
190
200
|
|
|
191
201
|
// Emotion styles
|
|
192
202
|
var buttonStyles = euiAccordionButtonStyles(theme);
|
|
193
|
-
var cssButtonStyles = [buttonStyles.euiAccordion__button, isDisabled && buttonStyles.disabled,
|
|
203
|
+
var cssButtonStyles = [buttonStyles.euiAccordion__button, isDisabled && buttonStyles.disabled].concat(_toConsumableArray(buttonPaddingSize ? [buttonStyles[buttonPaddingSize], arrowDisplay === 'left' && buttonStyles.arrowLeft, arrowDisplay === 'right' && buttonStyles.arrowRight] : []), [buttonPropsCss]);
|
|
194
204
|
var childrenStyles = euiAccordionChildrenStyles(theme);
|
|
195
205
|
var cssChildrenStyles = [childrenStyles.euiAccordion__children, isLoading && childrenStyles.isLoading, paddingSize && paddingSize !== 'none' && childrenStyles[paddingSize]];
|
|
196
206
|
var childWrapperStyles = euiAccordionChildWrapperStyles(theme);
|
|
@@ -204,7 +214,7 @@ export var EuiAccordionClass = /*#__PURE__*/function (_Component) {
|
|
|
204
214
|
var triggerWrapperStyles = euiAccordionTriggerWrapperStyles();
|
|
205
215
|
var cssTriggerWrapperStyles = [triggerWrapperStyles.euiAccordion__triggerWrapper];
|
|
206
216
|
var iconButton;
|
|
207
|
-
var buttonId = (_buttonProps$id = buttonProps
|
|
217
|
+
var buttonId = (_buttonProps$id = buttonProps.id) !== null && _buttonProps$id !== void 0 ? _buttonProps$id : this.generatedId;
|
|
208
218
|
if (_arrowDisplay !== 'none') {
|
|
209
219
|
iconButton = ___EmotionJSX(EuiButtonIcon, _extends({
|
|
210
220
|
color: "text"
|
|
@@ -256,7 +266,8 @@ export var EuiAccordionClass = /*#__PURE__*/function (_Component) {
|
|
|
256
266
|
className: buttonContentClasses
|
|
257
267
|
}, buttonContent));
|
|
258
268
|
return ___EmotionJSX(Element, _extends({
|
|
259
|
-
className: classes
|
|
269
|
+
className: classes,
|
|
270
|
+
css: cssStyles
|
|
260
271
|
}, rest), ___EmotionJSX("div", {
|
|
261
272
|
className: "euiAccordion__triggerWrapper",
|
|
262
273
|
css: cssTriggerWrapperStyles
|
|
@@ -287,6 +298,7 @@ export var EuiAccordionClass = /*#__PURE__*/function (_Component) {
|
|
|
287
298
|
}(Component);
|
|
288
299
|
_defineProperty(EuiAccordionClass, "defaultProps", {
|
|
289
300
|
initialIsOpen: false,
|
|
301
|
+
borders: 'none',
|
|
290
302
|
paddingSize: 'none',
|
|
291
303
|
arrowDisplay: 'left',
|
|
292
304
|
isLoading: false,
|
|
@@ -9,13 +9,33 @@ function _EMOTION_STRINGIFIED_CSS_ERROR__() { return "You have tried to stringif
|
|
|
9
9
|
|
|
10
10
|
import { css } from '@emotion/react';
|
|
11
11
|
import { euiFontSize, logicals, logicalCSS, logicalTextAlignCSS } from '../../global_styling';
|
|
12
|
+
export var euiAccordionStyles = function euiAccordionStyles(_ref5) {
|
|
13
|
+
var euiTheme = _ref5.euiTheme;
|
|
14
|
+
return {
|
|
15
|
+
euiAccordion: /*#__PURE__*/css(";label:euiAccordion;"),
|
|
16
|
+
// Borders
|
|
17
|
+
borders: {
|
|
18
|
+
// Prevent border repeats
|
|
19
|
+
borders: /*#__PURE__*/css("&+[class*='euiAccordion-borders']{", logicalCSS('border-top', 'none'), ";};label:borders;"),
|
|
20
|
+
horizontal: /*#__PURE__*/css("border-block:", euiTheme.border.thin, ";;label:horizontal;"),
|
|
21
|
+
all: /*#__PURE__*/css("border:", euiTheme.border.thin, ";;label:all;")
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
};
|
|
12
25
|
export var euiAccordionButtonStyles = function euiAccordionButtonStyles(euiThemeContext) {
|
|
13
26
|
var euiTheme = euiThemeContext.euiTheme;
|
|
14
27
|
return {
|
|
15
28
|
euiAccordion__button: /*#__PURE__*/css(euiFontSize(euiThemeContext, 's'), " align-items:center;display:flex;flex-grow:1;line-height:", euiTheme.size.l, ";", logicalTextAlignCSS('left'), " ", logicalCSS('width', '100%'), " &:hover,&:focus{cursor:pointer;text-decoration:underline;};label:euiAccordion__button;"),
|
|
16
29
|
// Triggering button needs separate `disabled` key because the element that renders may not support `:disabled`;
|
|
17
30
|
// Hover pseudo selector for specificity
|
|
18
|
-
disabled: /*#__PURE__*/css("&,&:hover{cursor:not-allowed;color:", euiTheme.colors.disabledText, ";text-decoration:none;};label:disabled;")
|
|
31
|
+
disabled: /*#__PURE__*/css("&,&:hover{cursor:not-allowed;color:", euiTheme.colors.disabledText, ";text-decoration:none;};label:disabled;"),
|
|
32
|
+
// Optional padding sizes
|
|
33
|
+
s: /*#__PURE__*/css("padding:", euiTheme.size.s, ";;label:s;"),
|
|
34
|
+
m: /*#__PURE__*/css("padding:", euiTheme.size.base, ";;label:m;"),
|
|
35
|
+
l: /*#__PURE__*/css("padding:", euiTheme.size.l, ";;label:l;"),
|
|
36
|
+
// Remove padding from the accordion button on the side that the arrow is on
|
|
37
|
+
arrowLeft: /*#__PURE__*/css(logicalCSS('padding-left', 0), ";;label:arrowLeft;"),
|
|
38
|
+
arrowRight: /*#__PURE__*/css(logicalCSS('padding-left', 0), ";;label:arrowRight;")
|
|
19
39
|
};
|
|
20
40
|
};
|
|
21
41
|
var _ref4 = process.env.NODE_ENV === "production" ? {
|
|
@@ -26,8 +46,8 @@ var _ref4 = process.env.NODE_ENV === "production" ? {
|
|
|
26
46
|
styles: "align-items:center;display:flex;label:isLoading;",
|
|
27
47
|
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
28
48
|
};
|
|
29
|
-
export var euiAccordionChildrenStyles = function euiAccordionChildrenStyles(
|
|
30
|
-
var euiTheme =
|
|
49
|
+
export var euiAccordionChildrenStyles = function euiAccordionChildrenStyles(_ref6) {
|
|
50
|
+
var euiTheme = _ref6.euiTheme;
|
|
31
51
|
return {
|
|
32
52
|
euiAccordion__children: /*#__PURE__*/css(";label:euiAccordion__children;"),
|
|
33
53
|
isLoading: _ref4,
|
|
@@ -38,8 +58,8 @@ export var euiAccordionChildrenStyles = function euiAccordionChildrenStyles(_ref
|
|
|
38
58
|
xl: /*#__PURE__*/css("padding:", euiTheme.size.xl, ";;label:xl;")
|
|
39
59
|
};
|
|
40
60
|
};
|
|
41
|
-
export var euiAccordionChildWrapperStyles = function euiAccordionChildWrapperStyles(
|
|
42
|
-
var euiTheme =
|
|
61
|
+
export var euiAccordionChildWrapperStyles = function euiAccordionChildWrapperStyles(_ref7) {
|
|
62
|
+
var euiTheme = _ref7.euiTheme;
|
|
43
63
|
return {
|
|
44
64
|
euiAccordion__childWrapper: /*#__PURE__*/css(logicalCSS('height', 0), " opacity:0;overflow:hidden;transition:", logicals.height, " ", euiTheme.animation.normal, " ", euiTheme.animation.resistance, ",opacity ", euiTheme.animation.normal, " ", euiTheme.animation.resistance, ";visibility:hidden;&:focus{outline:none;};label:euiAccordion__childWrapper;"),
|
|
45
65
|
isOpen: /*#__PURE__*/css(logicalCSS('height', 'auto'), " opacity:1;visibility:visible;;label:isOpen;")
|
|
@@ -53,8 +73,8 @@ var _ref3 = process.env.NODE_ENV === "production" ? {
|
|
|
53
73
|
styles: "transform:rotate(\n 90deg\n )!important;label:isOpen;",
|
|
54
74
|
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
55
75
|
};
|
|
56
|
-
export var euiAccordionIconButtonStyles = function euiAccordionIconButtonStyles(
|
|
57
|
-
var euiTheme =
|
|
76
|
+
export var euiAccordionIconButtonStyles = function euiAccordionIconButtonStyles(_ref8) {
|
|
77
|
+
var euiTheme = _ref8.euiTheme;
|
|
58
78
|
return {
|
|
59
79
|
euiAccordion__iconButton: /*#__PURE__*/css("flex-shrink:0;", logicalCSS('margin-right', euiTheme.size.xs), " transform:rotate(\n 0deg\n )!important;;label:euiAccordion__iconButton;"),
|
|
60
80
|
isOpen: _ref3,
|
|
@@ -74,8 +94,8 @@ export var euiAccordionOptionalActionStyles = function euiAccordionOptionalActio
|
|
|
74
94
|
euiAccordion__optionalAction: _ref2
|
|
75
95
|
};
|
|
76
96
|
};
|
|
77
|
-
export var euiAccordionSpinnerStyles = function euiAccordionSpinnerStyles(
|
|
78
|
-
var euiTheme =
|
|
97
|
+
export var euiAccordionSpinnerStyles = function euiAccordionSpinnerStyles(_ref9) {
|
|
98
|
+
var euiTheme = _ref9.euiTheme;
|
|
79
99
|
return {
|
|
80
100
|
euiAccordion__spinner: /*#__PURE__*/css(logicalCSS('margin-right', euiTheme.size.xs), ";;label:euiAccordion__spinner;")
|
|
81
101
|
};
|
|
@@ -3,7 +3,7 @@ import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
|
3
3
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
4
4
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
5
5
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
6
|
-
var _excluded = ["id", "children", "className", "
|
|
6
|
+
var _excluded = ["id", "children", "className", "initialIsCollapsed", "onCollapseToggle", "width", "side", "focusTrapProps"];
|
|
7
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; }
|
|
8
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; }
|
|
9
9
|
/*
|
|
@@ -17,7 +17,6 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
17
17
|
import React, { useRef, useMemo, useState, useEffect, useCallback } from 'react';
|
|
18
18
|
import classNames from 'classnames';
|
|
19
19
|
import { useEuiTheme, useGeneratedHtmlId, throttle } from '../../services';
|
|
20
|
-
import { mathWithUnits, logicalStyle } from '../../global_styling';
|
|
21
20
|
import { EuiFlyout } from '../flyout';
|
|
22
21
|
import { useEuiI18n } from '../i18n';
|
|
23
22
|
import { euiHeaderVariables } from '../header/header.styles';
|
|
@@ -29,9 +28,9 @@ export var EuiCollapsibleNavBeta = function EuiCollapsibleNavBeta(_ref) {
|
|
|
29
28
|
var id = _ref.id,
|
|
30
29
|
children = _ref.children,
|
|
31
30
|
className = _ref.className,
|
|
32
|
-
style = _ref.style,
|
|
33
31
|
_ref$initialIsCollaps = _ref.initialIsCollapsed,
|
|
34
32
|
initialIsCollapsed = _ref$initialIsCollaps === void 0 ? false : _ref$initialIsCollaps,
|
|
33
|
+
onCollapseToggle = _ref.onCollapseToggle,
|
|
35
34
|
_ref$width = _ref.width,
|
|
36
35
|
_width = _ref$width === void 0 ? 248 : _ref$width,
|
|
37
36
|
_ref$side = _ref.side,
|
|
@@ -50,9 +49,10 @@ export var EuiCollapsibleNavBeta = function EuiCollapsibleNavBeta(_ref) {
|
|
|
50
49
|
setIsCollapsed = _useState2[1];
|
|
51
50
|
var toggleCollapsed = useCallback(function () {
|
|
52
51
|
return setIsCollapsed(function (isCollapsed) {
|
|
52
|
+
onCollapseToggle === null || onCollapseToggle === void 0 ? void 0 : onCollapseToggle(!isCollapsed);
|
|
53
53
|
return !isCollapsed;
|
|
54
54
|
});
|
|
55
|
-
}, []);
|
|
55
|
+
}, [onCollapseToggle]);
|
|
56
56
|
var onClose = useCallback(function () {
|
|
57
57
|
return setIsCollapsed(true);
|
|
58
58
|
}, []);
|
|
@@ -98,24 +98,6 @@ export var EuiCollapsibleNavBeta = function EuiCollapsibleNavBeta(_ref) {
|
|
|
98
98
|
return _width;
|
|
99
99
|
}, [_width, isOverlayFullWidth, isPush, isCollapsed, headerHeight]);
|
|
100
100
|
|
|
101
|
-
/**
|
|
102
|
-
* Header affordance
|
|
103
|
-
*/
|
|
104
|
-
var _useState7 = useState(false),
|
|
105
|
-
_useState8 = _slicedToArray(_useState7, 2),
|
|
106
|
-
fixedHeadersCount = _useState8[0],
|
|
107
|
-
setFixedHeadersCount = _useState8[1];
|
|
108
|
-
useEffect(function () {
|
|
109
|
-
setFixedHeadersCount(document.querySelectorAll('.euiHeader[data-fixed-header]').length);
|
|
110
|
-
}, []);
|
|
111
|
-
var stylesWithHeaderOffset = useMemo(function () {
|
|
112
|
-
if (!fixedHeadersCount) return style;
|
|
113
|
-
var headersOffset = mathWithUnits(headerHeight, function (x) {
|
|
114
|
-
return x * fixedHeadersCount;
|
|
115
|
-
});
|
|
116
|
-
return _objectSpread(_objectSpread(_objectSpread({}, style), logicalStyle('top', headersOffset)), logicalStyle('height', "calc(100% - ".concat(headersOffset, ")")));
|
|
117
|
-
}, [fixedHeadersCount, style, headerHeight]);
|
|
118
|
-
|
|
119
101
|
/**
|
|
120
102
|
* Prop setup
|
|
121
103
|
*/
|
|
@@ -133,16 +115,13 @@ export var EuiCollapsibleNavBeta = function EuiCollapsibleNavBeta(_ref) {
|
|
|
133
115
|
var classes = classNames('euiCollapsibleNav', 'euiCollapsibleNavBeta', className);
|
|
134
116
|
var styles = euiCollapsibleNavBetaStyles(euiTheme);
|
|
135
117
|
var cssStyles = [styles.euiCollapsibleNavBeta, styles[side], isPush && styles.isPush, isPush && isCollapsed && styles.isPushCollapsed, isOverlayFullWidth && styles.isOverlayFullWidth];
|
|
136
|
-
|
|
137
|
-
// Wait for any fixed headers to be queried before rendering (prevents position jumping)
|
|
138
|
-
var flyout = fixedHeadersCount !== false && ___EmotionJSX(EuiFlyout, _extends({
|
|
118
|
+
var flyout = ___EmotionJSX(EuiFlyout, _extends({
|
|
139
119
|
"aria-label": defaultAriaLabel
|
|
140
120
|
}, rest, {
|
|
141
121
|
// EuiCollapsibleNav is significantly less permissive than EuiFlyout
|
|
142
122
|
id: flyoutID,
|
|
143
123
|
css: cssStyles,
|
|
144
124
|
className: classes,
|
|
145
|
-
style: stylesWithHeaderOffset,
|
|
146
125
|
size: width,
|
|
147
126
|
side: side,
|
|
148
127
|
focusTrapProps: focusTrapProps,
|
|
@@ -10,6 +10,7 @@ function _EMOTION_STRINGIFIED_CSS_ERROR__() { return "You have tried to stringif
|
|
|
10
10
|
import { css } from '@emotion/react';
|
|
11
11
|
import { logicalCSS, euiYScroll } from '../../global_styling';
|
|
12
12
|
import { euiShadowFlat } from '../../themes';
|
|
13
|
+
import { euiHeaderVariables } from '../header/header.styles';
|
|
13
14
|
var _ref = process.env.NODE_ENV === "production" ? {
|
|
14
15
|
name: "1adm1dw-isPushCollapsed",
|
|
15
16
|
styles: "&,.euiFlyoutBody__overflow{scrollbar-width:none;&::-webkit-scrollbar{display:none;}};label:isPushCollapsed;"
|
|
@@ -20,8 +21,16 @@ var _ref = process.env.NODE_ENV === "production" ? {
|
|
|
20
21
|
};
|
|
21
22
|
export var euiCollapsibleNavBetaStyles = function euiCollapsibleNavBetaStyles(euiThemeContext) {
|
|
22
23
|
var euiTheme = euiThemeContext.euiTheme;
|
|
24
|
+
|
|
25
|
+
// At least for serverless, EuiCollapsibleNav is only going to be used with 1
|
|
26
|
+
// fixed header. For those scenarios, we can prevent a minor layout jump on
|
|
27
|
+
// page load by setting the CSS var fallback to the height of a single header
|
|
28
|
+
var defaultHeaderHeight = euiHeaderVariables(euiThemeContext).height;
|
|
29
|
+
var fixedHeaderOffset = "var(--euiFixedHeadersOffset, ".concat(defaultHeaderHeight, ")");
|
|
23
30
|
return {
|
|
24
|
-
euiCollapsibleNavBeta: /*#__PURE__*/css(logicalCSS('
|
|
31
|
+
euiCollapsibleNavBeta: /*#__PURE__*/css(logicalCSS('top', fixedHeaderOffset), euiYScroll(euiThemeContext, {
|
|
32
|
+
height: 'inherit'
|
|
33
|
+
}), logicalCSS('padding-bottom', euiTheme.size.xs), ".euiFlyoutBody{", logicalCSS('min-height', '50%'), ";}.euiFlyoutFooter{background-color:", euiTheme.colors.emptyShade, ";", logicalCSS('border-top', euiTheme.border.thin), ";};label:euiCollapsibleNavBeta;"),
|
|
25
34
|
left: /*#__PURE__*/css(logicalCSS('border-right', euiTheme.border.thin), ";;label:left;"),
|
|
26
35
|
right: /*#__PURE__*/css(logicalCSS('border-left', euiTheme.border.thin), ";;label:right;"),
|
|
27
36
|
isPush: /*#__PURE__*/css(euiShadowFlat(euiThemeContext), ";;label:isPush;"),
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
3
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
-
var _excluded = ["align", "children", "className", "compressed", "descriptionProps", "listItems", "textStyle", "titleProps", "type", "rowGutterSize", "columnGutterSize"];
|
|
4
|
+
var _excluded = ["align", "children", "className", "style", "compressed", "descriptionProps", "listItems", "textStyle", "titleProps", "type", "rowGutterSize", "columnGutterSize", "columnWidths"];
|
|
5
|
+
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; }
|
|
6
|
+
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; }
|
|
4
7
|
/*
|
|
5
8
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
6
9
|
* or more contributor license agreements. Licensed under the Elastic License
|
|
@@ -22,6 +25,7 @@ export var EuiDescriptionList = function EuiDescriptionList(_ref) {
|
|
|
22
25
|
align = _ref$align === void 0 ? 'left' : _ref$align,
|
|
23
26
|
children = _ref.children,
|
|
24
27
|
className = _ref.className,
|
|
28
|
+
style = _ref.style,
|
|
25
29
|
_ref$compressed = _ref.compressed,
|
|
26
30
|
compressed = _ref$compressed === void 0 ? false : _ref$compressed,
|
|
27
31
|
descriptionProps = _ref.descriptionProps,
|
|
@@ -35,6 +39,7 @@ export var EuiDescriptionList = function EuiDescriptionList(_ref) {
|
|
|
35
39
|
rowGutterSize = _ref$rowGutterSize === void 0 ? 's' : _ref$rowGutterSize,
|
|
36
40
|
_ref$columnGutterSize = _ref.columnGutterSize,
|
|
37
41
|
columnGutterSize = _ref$columnGutterSize === void 0 ? 's' : _ref$columnGutterSize,
|
|
42
|
+
columnWidths = _ref.columnWidths,
|
|
38
43
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
39
44
|
var showResponsiveColumns = useIsWithinBreakpoints(['xs', 's']);
|
|
40
45
|
var type = useMemo(function () {
|
|
@@ -47,6 +52,20 @@ export var EuiDescriptionList = function EuiDescriptionList(_ref) {
|
|
|
47
52
|
var euiTheme = useEuiTheme();
|
|
48
53
|
var styles = euiDescriptionListStyles(euiTheme);
|
|
49
54
|
var cssStyles = [styles.euiDescriptionList, styles[type], styles[align], type === 'column' && styles.rowGap[rowGutterSize], type === 'column' && styles.columnGap[columnGutterSize]];
|
|
55
|
+
var inlineStyles = useMemo(function () {
|
|
56
|
+
if (type === 'column' && columnWidths) {
|
|
57
|
+
// Leave string values as is - e.g. if a consumer passes in a specific '200px' or 'minmax()'
|
|
58
|
+
var convertNumbersToFr = function convertNumbersToFr(value) {
|
|
59
|
+
return typeof value === 'number' ? "".concat(value, "fr") : value;
|
|
60
|
+
};
|
|
61
|
+
var titleWidth = convertNumbersToFr(columnWidths[0]);
|
|
62
|
+
var descriptionWidth = convertNumbersToFr(columnWidths[1]);
|
|
63
|
+
return _objectSpread({
|
|
64
|
+
gridTemplateColumns: "".concat(titleWidth, " ").concat(descriptionWidth)
|
|
65
|
+
}, style);
|
|
66
|
+
}
|
|
67
|
+
return style;
|
|
68
|
+
}, [style, type, columnWidths]);
|
|
50
69
|
var classes = classNames('euiDescriptionList', className);
|
|
51
70
|
var childrenOrListItems = null;
|
|
52
71
|
if (listItems) {
|
|
@@ -70,7 +89,8 @@ export var EuiDescriptionList = function EuiDescriptionList(_ref) {
|
|
|
70
89
|
}
|
|
71
90
|
}, ___EmotionJSX("dl", _extends({
|
|
72
91
|
className: classes,
|
|
73
|
-
css: cssStyles
|
|
92
|
+
css: cssStyles,
|
|
93
|
+
style: inlineStyles
|
|
74
94
|
}, rest, {
|
|
75
95
|
"data-type": _type
|
|
76
96
|
}), childrenOrListItems));
|
|
@@ -32,7 +32,7 @@ export var euiFlyoutCloseButtonStyles = function euiFlyoutCloseButtonStyles(euiT
|
|
|
32
32
|
export var euiFlyoutStyles = function euiFlyoutStyles(euiThemeContext) {
|
|
33
33
|
var euiTheme = euiThemeContext.euiTheme;
|
|
34
34
|
return {
|
|
35
|
-
euiFlyout: /*#__PURE__*/css("position:fixed;", logicalCSS('
|
|
35
|
+
euiFlyout: /*#__PURE__*/css("position:fixed;", logicalCSS('bottom', 0), " ", logicalCSS('top', 'var(--euiFixedHeadersOffset, 0)'), " ", logicalCSS('height', 'inherit'), " z-index:", euiTheme.levels.flyout, ";background:", euiTheme.colors.emptyShade, ";display:flex;flex-direction:column;align-items:stretch;&:focus{outline:none;}", euiMaxBreakpoint(euiThemeContext, 'm'), "{", logicalCSS('max-width', '90vw !important'), ";};label:euiFlyout;"),
|
|
36
36
|
// Flyout sizes
|
|
37
37
|
s: /*#__PURE__*/css(composeFlyoutSizing(euiThemeContext, 's'), ";;label:s;"),
|
|
38
38
|
m: /*#__PURE__*/css(composeFlyoutSizing(euiThemeContext, 'm'), ";;label:m;"),
|
|
@@ -1,6 +1,11 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
1
3
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
4
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
-
var _excluded = ["children", "className", "sections", "position", "theme"]
|
|
5
|
+
var _excluded = ["children", "className", "sections", "position", "theme"],
|
|
6
|
+
_excluded2 = ["children", "style"];
|
|
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; }
|
|
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; }
|
|
4
9
|
/*
|
|
5
10
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
6
11
|
* or more contributor license agreements. Licensed under the Elastic License
|
|
@@ -9,12 +14,13 @@ var _excluded = ["children", "className", "sections", "position", "theme"];
|
|
|
9
14
|
* Side Public License, v 1.
|
|
10
15
|
*/
|
|
11
16
|
|
|
12
|
-
import React, { useEffect } from 'react';
|
|
17
|
+
import React, { useEffect, useState, useMemo, useCallback } from 'react';
|
|
13
18
|
import classNames from 'classnames';
|
|
14
|
-
import { useEuiTheme } from '../../services';
|
|
19
|
+
import { useEuiTheme, useEuiThemeCSSVariables } from '../../services';
|
|
20
|
+
import { mathWithUnits, logicalStyles } from '../../global_styling';
|
|
15
21
|
import { EuiHeaderBreadcrumbs } from './header_breadcrumbs';
|
|
16
22
|
import { EuiHeaderSectionItem, EuiHeaderSection } from './header_section';
|
|
17
|
-
import { euiHeaderStyles } from './header.styles';
|
|
23
|
+
import { euiHeaderStyles, euiHeaderVariables } from './header.styles';
|
|
18
24
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
19
25
|
var createHeaderSection = function createHeaderSection(sections) {
|
|
20
26
|
return sections.map(function (section, index) {
|
|
@@ -23,8 +29,6 @@ var createHeaderSection = function createHeaderSection(sections) {
|
|
|
23
29
|
}, section);
|
|
24
30
|
});
|
|
25
31
|
};
|
|
26
|
-
// Start a counter to manage the total number of fixed headers that need the body class
|
|
27
|
-
var euiHeaderFixedCounter = 0;
|
|
28
32
|
export var EuiHeader = function EuiHeader(_ref) {
|
|
29
33
|
var children = _ref.children,
|
|
30
34
|
className = _ref.className,
|
|
@@ -38,22 +42,6 @@ export var EuiHeader = function EuiHeader(_ref) {
|
|
|
38
42
|
var euiTheme = useEuiTheme();
|
|
39
43
|
var styles = euiHeaderStyles(euiTheme);
|
|
40
44
|
var cssStyles = [styles.euiHeader, styles[position], styles[theme]];
|
|
41
|
-
useEffect(function () {
|
|
42
|
-
if (position === 'fixed') {
|
|
43
|
-
// Increment fixed header counter for each fixed header
|
|
44
|
-
euiHeaderFixedCounter++;
|
|
45
|
-
document.body.classList.add('euiBody--headerIsFixed');
|
|
46
|
-
document.body.dataset.fixedHeaders = String(euiHeaderFixedCounter);
|
|
47
|
-
return function () {
|
|
48
|
-
// Both decrement the fixed counter AND then check if there are none
|
|
49
|
-
if (--euiHeaderFixedCounter === 0) {
|
|
50
|
-
// If there are none, THEN remove class
|
|
51
|
-
document.body.classList.remove('euiBody--headerIsFixed');
|
|
52
|
-
delete document.body.dataset.fixedHeaders;
|
|
53
|
-
}
|
|
54
|
-
};
|
|
55
|
-
}
|
|
56
|
-
}, [position]);
|
|
57
45
|
var contents;
|
|
58
46
|
if (sections) {
|
|
59
47
|
if (children) {
|
|
@@ -82,9 +70,71 @@ export var EuiHeader = function EuiHeader(_ref) {
|
|
|
82
70
|
} else {
|
|
83
71
|
contents = children;
|
|
84
72
|
}
|
|
85
|
-
return ___EmotionJSX(
|
|
73
|
+
return position === 'fixed' ? ___EmotionJSX(EuiFixedHeader, _extends({
|
|
86
74
|
css: cssStyles,
|
|
87
|
-
className: classes
|
|
88
|
-
|
|
75
|
+
className: classes
|
|
76
|
+
}, rest), contents) : ___EmotionJSX("div", _extends({
|
|
77
|
+
css: cssStyles,
|
|
78
|
+
className: classes
|
|
89
79
|
}, rest), contents);
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Fixed headers - logic around dynamically calculating the total
|
|
84
|
+
* page offset and setting the `top` position of subsequent headers
|
|
85
|
+
*/
|
|
86
|
+
|
|
87
|
+
// Start a counter to manage the total number of fixed headers
|
|
88
|
+
// Exported for unit testing only
|
|
89
|
+
export var euiFixedHeadersCount = 0;
|
|
90
|
+
|
|
91
|
+
// Exported for unit testing only
|
|
92
|
+
export var EuiFixedHeader = function EuiFixedHeader(_ref2) {
|
|
93
|
+
var children = _ref2.children,
|
|
94
|
+
style = _ref2.style,
|
|
95
|
+
rest = _objectWithoutProperties(_ref2, _excluded2);
|
|
96
|
+
var _useEuiThemeCSSVariab = useEuiThemeCSSVariables(),
|
|
97
|
+
setGlobalCSSVariables = _useEuiThemeCSSVariab.setGlobalCSSVariables;
|
|
98
|
+
var euiTheme = useEuiTheme();
|
|
99
|
+
var headerHeight = euiHeaderVariables(euiTheme).height;
|
|
100
|
+
var getHeaderOffset = useCallback(function () {
|
|
101
|
+
return mathWithUnits(headerHeight, function (x) {
|
|
102
|
+
return x * euiFixedHeadersCount;
|
|
103
|
+
});
|
|
104
|
+
}, [headerHeight]);
|
|
105
|
+
var _useState = useState(),
|
|
106
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
107
|
+
topPosition = _useState2[0],
|
|
108
|
+
setTopPosition = _useState2[1];
|
|
109
|
+
useEffect(function () {
|
|
110
|
+
// Get the top position from the offset of previous header(s)
|
|
111
|
+
setTopPosition(getHeaderOffset());
|
|
112
|
+
|
|
113
|
+
// Increment fixed header counter for each fixed header
|
|
114
|
+
euiFixedHeadersCount++;
|
|
115
|
+
setGlobalCSSVariables({
|
|
116
|
+
'--euiFixedHeadersOffset': getHeaderOffset()
|
|
117
|
+
});
|
|
118
|
+
document.body.classList.add('euiBody--headerIsFixed'); // TODO: Consider deleting this legacy className
|
|
119
|
+
|
|
120
|
+
return function () {
|
|
121
|
+
euiFixedHeadersCount--;
|
|
122
|
+
setGlobalCSSVariables({
|
|
123
|
+
'--euiFixedHeadersOffset': getHeaderOffset()
|
|
124
|
+
});
|
|
125
|
+
if (euiFixedHeadersCount === 0) {
|
|
126
|
+
document.body.classList.remove('euiBody--headerIsFixed'); // TODO: Consider deleting this legacy className
|
|
127
|
+
}
|
|
128
|
+
};
|
|
129
|
+
}, [getHeaderOffset, setGlobalCSSVariables]);
|
|
130
|
+
var inlineStyles = useMemo(function () {
|
|
131
|
+
return logicalStyles(_objectSpread({
|
|
132
|
+
top: topPosition
|
|
133
|
+
}, style));
|
|
134
|
+
}, [topPosition, style]);
|
|
135
|
+
return ___EmotionJSX("div", _extends({
|
|
136
|
+
"data-fixed-header": true // Used by EuiFlyouts as a query selector
|
|
137
|
+
,
|
|
138
|
+
style: inlineStyles
|
|
139
|
+
}, rest), children);
|
|
90
140
|
};
|
|
@@ -32,7 +32,7 @@ export var euiHeaderStyles = function euiHeaderStyles(euiThemeContext) {
|
|
|
32
32
|
euiHeader: /*#__PURE__*/css("display:flex;justify-content:space-between;", logicalCSS('height', height), " ", logicalCSS('padding-horizontal', padding), " ", euiShadowSmall(euiThemeContext), ";;label:euiHeader;"),
|
|
33
33
|
// Position
|
|
34
34
|
static: /*#__PURE__*/css("z-index:", Number(euiTheme.levels.header) - 1, ";position:relative;;label:static;"),
|
|
35
|
-
fixed: /*#__PURE__*/css("z-index:", euiTheme.levels.header, ";position:fixed;", logicalCSS('top', 0), " ", logicalCSS('horizontal', 0), "
|
|
35
|
+
fixed: /*#__PURE__*/css("z-index:", euiTheme.levels.header, ";position:fixed;", logicalCSS('top', 0), " ", logicalCSS('horizontal', 0), ";;label:fixed;"),
|
|
36
36
|
// Theme
|
|
37
37
|
default: /*#__PURE__*/css("background-color:", euiTheme.colors.emptyShade, ";", logicalCSS('border-bottom', "".concat(euiTheme.border.width.thin, " solid ").concat(borderColor)), ";;label:default;"),
|
|
38
38
|
dark: /*#__PURE__*/css(euiHeaderDarkStyles(euiThemeContext, borderColor), ";label:dark;")
|
|
@@ -17,8 +17,8 @@ var euiScaleMarkdownFormatText = function euiScaleMarkdownFormatText(euiTheme, o
|
|
|
17
17
|
var _euiFontSize = euiFontSize(euiTheme, 'm', options),
|
|
18
18
|
fontSize = _euiFontSize.fontSize,
|
|
19
19
|
lineHeight = _euiFontSize.lineHeight;
|
|
20
|
-
var
|
|
21
|
-
var lineHeightSize =
|
|
20
|
+
var unit = options.unit;
|
|
21
|
+
var lineHeightSize = unit === 'em' ? "".concat(lineHeight, "em") : lineHeight;
|
|
22
22
|
|
|
23
23
|
// Custom scales
|
|
24
24
|
var tablePaddingVertical = mathWithUnits(fontSize, function (x) {
|
|
@@ -39,19 +39,16 @@ export var euiMarkdownFormatStyles = function euiMarkdownFormatStyles(euiTheme)
|
|
|
39
39
|
euiMarkdownFormat: /*#__PURE__*/css(";label:euiMarkdownFormat;"),
|
|
40
40
|
// Text sizes
|
|
41
41
|
m: /*#__PURE__*/css(euiScaleMarkdownFormatText(euiTheme, {
|
|
42
|
-
measurement: 'rem',
|
|
43
42
|
customScale: 'm'
|
|
44
43
|
}), ";;label:m;"),
|
|
45
44
|
s: /*#__PURE__*/css(euiScaleMarkdownFormatText(euiTheme, {
|
|
46
|
-
measurement: 'rem',
|
|
47
45
|
customScale: 's'
|
|
48
46
|
}), ";;label:s;"),
|
|
49
47
|
xs: /*#__PURE__*/css(euiScaleMarkdownFormatText(euiTheme, {
|
|
50
|
-
measurement: 'rem',
|
|
51
48
|
customScale: 'xs'
|
|
52
49
|
}), ";;label:xs;"),
|
|
53
50
|
relative: /*#__PURE__*/css(euiScaleMarkdownFormatText(euiTheme, {
|
|
54
|
-
|
|
51
|
+
unit: 'em'
|
|
55
52
|
}), ";;label:relative;")
|
|
56
53
|
};
|
|
57
54
|
};
|
|
@@ -14,6 +14,6 @@ export var euiOverlayMaskStyles = function euiOverlayMaskStyles(_ref) {
|
|
|
14
14
|
return {
|
|
15
15
|
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;"),
|
|
16
16
|
aboveHeader: /*#__PURE__*/css("z-index:", euiTheme.levels.mask, ";;label:aboveHeader;"),
|
|
17
|
-
belowHeader: /*#__PURE__*/css("z-index:", euiTheme.levels.maskBelowHeader, ";", logicalCSS('top',
|
|
17
|
+
belowHeader: /*#__PURE__*/css("z-index:", euiTheme.levels.maskBelowHeader, ";", logicalCSS('top', 'var(--euiFixedHeadersOffset, 0)'), ";;label:belowHeader;")
|
|
18
18
|
};
|
|
19
19
|
};
|
|
@@ -45,10 +45,8 @@ export var EuiPageSidebar = function EuiPageSidebar(_ref) {
|
|
|
45
45
|
useLayoutEffect(function () {
|
|
46
46
|
var updatedStyles = _objectSpread(_objectSpread({}, style), logicalStyle('min-width', isResponding ? '100%' : minWidth));
|
|
47
47
|
if (sticky) {
|
|
48
|
-
var
|
|
49
|
-
|
|
50
|
-
var offset = _typeof(sticky) === 'object' ? sticky === null || sticky === void 0 ? void 0 : sticky.offset : themeContext.euiTheme.base * 3 * euiHeaderFixedCounter;
|
|
51
|
-
updatedStyles = _objectSpread(_objectSpread(_objectSpread({}, updatedStyles), logicalStyle('top', offset)), logicalStyle('max-height', "calc(100vh - ".concat(offset, "px)")));
|
|
48
|
+
var offset = _typeof(sticky) === 'object' ? "".concat(sticky === null || sticky === void 0 ? void 0 : sticky.offset, "px") : 'var(--euiFixedHeadersOffset, 0)';
|
|
49
|
+
updatedStyles = _objectSpread(_objectSpread(_objectSpread({}, updatedStyles), logicalStyle('top', offset)), logicalStyle('max-height', "calc(100vh - ".concat(offset, ")")));
|
|
52
50
|
}
|
|
53
51
|
setInlineStyles(updatedStyles);
|
|
54
52
|
}, [style, sticky, themeContext.euiTheme.base, isResponding, minWidth]);
|