@elastic/eui 88.1.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.
Files changed (111) hide show
  1. package/dist/eui_charts_theme.js.map +1 -1
  2. package/dist/eui_theme_dark.css +9 -36
  3. package/dist/eui_theme_dark.min.css +1 -1
  4. package/dist/eui_theme_light.css +9 -36
  5. package/dist/eui_theme_light.min.css +1 -1
  6. package/es/components/accordion/accordion.js +34 -9
  7. package/es/components/accordion/accordion.styles.js +29 -9
  8. package/es/components/collapsible_nav/collapsible_nav_group/collapsible_nav_group.js +10 -2
  9. package/es/components/collapsible_nav_beta/collapsible_nav_beta.js +2 -25
  10. package/es/components/collapsible_nav_beta/collapsible_nav_beta.styles.js +10 -1
  11. package/es/components/flyout/flyout.styles.js +1 -1
  12. package/es/components/header/header.js +120 -25
  13. package/es/components/header/header.styles.js +1 -1
  14. package/es/components/index.js +1 -0
  15. package/es/components/overlay_mask/overlay_mask.styles.js +1 -1
  16. package/es/components/page/page_sidebar/page_sidebar.js +2 -4
  17. package/es/components/page_template/page_template.js +4 -31
  18. package/es/components/text_truncate/index.js +10 -0
  19. package/es/components/text_truncate/text_truncate.js +232 -0
  20. package/es/components/text_truncate/text_truncate.styles.js +49 -0
  21. package/es/components/text_truncate/utils.js +348 -0
  22. package/es/services/theme/context.js +3 -1
  23. package/es/services/theme/hooks.js +19 -1
  24. package/es/services/theme/index.js +1 -1
  25. package/es/services/theme/provider.js +37 -8
  26. package/eui.d.ts +246 -17
  27. package/i18ntokens.json +8 -8
  28. package/lib/components/accordion/accordion.js +33 -8
  29. package/lib/components/accordion/accordion.styles.js +31 -10
  30. package/lib/components/collapsible_nav/collapsible_nav_group/collapsible_nav_group.js +10 -2
  31. package/lib/components/collapsible_nav_beta/collapsible_nav_beta.js +2 -25
  32. package/lib/components/collapsible_nav_beta/collapsible_nav_beta.styles.js +10 -1
  33. package/lib/components/flyout/flyout.styles.js +1 -1
  34. package/lib/components/header/header.js +120 -23
  35. package/lib/components/header/header.styles.js +1 -1
  36. package/lib/components/index.js +11 -0
  37. package/lib/components/overlay_mask/overlay_mask.styles.js +1 -1
  38. package/lib/components/page/page_sidebar/page_sidebar.js +2 -4
  39. package/lib/components/page_template/page_template.js +2 -29
  40. package/lib/components/text_truncate/index.js +25 -0
  41. package/lib/components/text_truncate/text_truncate.js +242 -0
  42. package/lib/components/text_truncate/text_truncate.styles.js +54 -0
  43. package/lib/components/text_truncate/utils.js +352 -0
  44. package/lib/services/theme/context.js +3 -1
  45. package/lib/services/theme/hooks.js +21 -2
  46. package/lib/services/theme/index.js +6 -0
  47. package/lib/services/theme/provider.js +62 -35
  48. package/optimize/es/components/accordion/accordion.js +19 -7
  49. package/optimize/es/components/accordion/accordion.styles.js +29 -9
  50. package/optimize/es/components/collapsible_nav_beta/collapsible_nav_beta.js +2 -25
  51. package/optimize/es/components/collapsible_nav_beta/collapsible_nav_beta.styles.js +10 -1
  52. package/optimize/es/components/flyout/flyout.styles.js +1 -1
  53. package/optimize/es/components/header/header.js +75 -25
  54. package/optimize/es/components/header/header.styles.js +1 -1
  55. package/optimize/es/components/index.js +1 -0
  56. package/optimize/es/components/overlay_mask/overlay_mask.styles.js +1 -1
  57. package/optimize/es/components/page/page_sidebar/page_sidebar.js +2 -4
  58. package/optimize/es/components/page_template/page_template.js +4 -26
  59. package/optimize/es/components/text_truncate/index.js +10 -0
  60. package/optimize/es/components/text_truncate/text_truncate.js +148 -0
  61. package/optimize/es/components/text_truncate/text_truncate.styles.js +49 -0
  62. package/optimize/es/components/text_truncate/utils.js +337 -0
  63. package/optimize/es/services/theme/context.js +3 -1
  64. package/optimize/es/services/theme/hooks.js +19 -1
  65. package/optimize/es/services/theme/index.js +1 -1
  66. package/optimize/es/services/theme/provider.js +37 -8
  67. package/optimize/lib/components/accordion/accordion.js +18 -6
  68. package/optimize/lib/components/accordion/accordion.styles.js +31 -10
  69. package/optimize/lib/components/collapsible_nav_beta/collapsible_nav_beta.js +2 -25
  70. package/optimize/lib/components/collapsible_nav_beta/collapsible_nav_beta.styles.js +10 -1
  71. package/optimize/lib/components/flyout/flyout.styles.js +1 -1
  72. package/optimize/lib/components/header/header.js +77 -24
  73. package/optimize/lib/components/header/header.styles.js +1 -1
  74. package/optimize/lib/components/index.js +11 -0
  75. package/optimize/lib/components/overlay_mask/overlay_mask.styles.js +1 -1
  76. package/optimize/lib/components/page/page_sidebar/page_sidebar.js +2 -4
  77. package/optimize/lib/components/page_template/page_template.js +2 -24
  78. package/optimize/lib/components/text_truncate/index.js +25 -0
  79. package/optimize/lib/components/text_truncate/text_truncate.js +158 -0
  80. package/optimize/lib/components/text_truncate/text_truncate.styles.js +54 -0
  81. package/optimize/lib/components/text_truncate/utils.js +342 -0
  82. package/optimize/lib/services/theme/context.js +3 -1
  83. package/optimize/lib/services/theme/hooks.js +21 -2
  84. package/optimize/lib/services/theme/index.js +6 -0
  85. package/optimize/lib/services/theme/provider.js +62 -35
  86. package/package.json +1 -1
  87. package/src/components/datagrid/_data_grid.scss +13 -2
  88. package/src/components/index.scss +0 -1
  89. package/src/global_styling/mixins/_header.scss +2 -0
  90. package/test-env/components/accordion/accordion.js +28 -8
  91. package/test-env/components/accordion/accordion.styles.js +31 -10
  92. package/test-env/components/collapsible_nav/collapsible_nav_group/collapsible_nav_group.js +10 -2
  93. package/test-env/components/collapsible_nav_beta/collapsible_nav_beta.js +2 -25
  94. package/test-env/components/collapsible_nav_beta/collapsible_nav_beta.styles.js +10 -1
  95. package/test-env/components/flyout/flyout.styles.js +1 -1
  96. package/test-env/components/header/header.js +113 -23
  97. package/test-env/components/header/header.styles.js +1 -1
  98. package/test-env/components/index.js +11 -0
  99. package/test-env/components/overlay_mask/overlay_mask.styles.js +1 -1
  100. package/test-env/components/page/page_sidebar/page_sidebar.js +2 -4
  101. package/test-env/components/page_template/page_template.js +2 -24
  102. package/test-env/components/text_truncate/index.js +25 -0
  103. package/test-env/components/text_truncate/text_truncate.js +236 -0
  104. package/test-env/components/text_truncate/text_truncate.styles.js +54 -0
  105. package/test-env/components/text_truncate/utils.js +342 -0
  106. package/test-env/services/theme/context.js +3 -1
  107. package/test-env/services/theme/hooks.js +21 -2
  108. package/test-env/services/theme/index.js +6 -0
  109. package/test-env/services/theme/provider.js +62 -35
  110. package/src/components/accordion/_accordion_form.scss +0 -40
  111. package/src/components/accordion/_index.scss +0 -1
@@ -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(_ref5) {
35
- var euiTheme = _ref5.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(_ref6) {
48
- var euiTheme = _ref6.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(_ref7) {
64
- var euiTheme = _ref7.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(_ref8) {
87
- var euiTheme = _ref8.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", "style", "initialIsCollapsed", "onCollapseToggle", "width", "side", "focusTrapProps"];
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,7 +37,6 @@ 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,
44
42
  onCollapseToggle = _ref.onCollapseToggle,
@@ -109,24 +107,6 @@ var EuiCollapsibleNavBeta = function EuiCollapsibleNavBeta(_ref) {
109
107
  return _width;
110
108
  }, [_width, isOverlayFullWidth, isPush, isCollapsed, headerHeight]);
111
109
 
112
- /**
113
- * Header affordance
114
- */
115
- var _useState7 = (0, _react.useState)(false),
116
- _useState8 = (0, _slicedToArray2.default)(_useState7, 2),
117
- fixedHeadersCount = _useState8[0],
118
- setFixedHeadersCount = _useState8[1];
119
- (0, _react.useEffect)(function () {
120
- setFixedHeadersCount(document.querySelectorAll('.euiHeader[data-fixed-header]').length);
121
- }, []);
122
- var stylesWithHeaderOffset = (0, _react.useMemo)(function () {
123
- if (!fixedHeadersCount) return style;
124
- var headersOffset = (0, _global_styling.mathWithUnits)(headerHeight, function (x) {
125
- return x * fixedHeadersCount;
126
- });
127
- return _objectSpread(_objectSpread(_objectSpread({}, style), (0, _global_styling.logicalStyle)('top', headersOffset)), (0, _global_styling.logicalStyle)('height', "calc(100% - ".concat(headersOffset, ")")));
128
- }, [fixedHeadersCount, style, headerHeight]);
129
-
130
110
  /**
131
111
  * Prop setup
132
112
  */
@@ -144,16 +124,13 @@ var EuiCollapsibleNavBeta = function EuiCollapsibleNavBeta(_ref) {
144
124
  var classes = (0, _classnames.default)('euiCollapsibleNav', 'euiCollapsibleNavBeta', className);
145
125
  var styles = (0, _collapsible_nav_beta.euiCollapsibleNavBetaStyles)(euiTheme);
146
126
  var cssStyles = [styles.euiCollapsibleNavBeta, styles[side], isPush && styles.isPush, isPush && isCollapsed && styles.isPushCollapsed, isOverlayFullWidth && styles.isOverlayFullWidth];
147
-
148
- // Wait for any fixed headers to be queried before rendering (prevents position jumping)
149
- var flyout = fixedHeadersCount !== false && (0, _react2.jsx)(_flyout.EuiFlyout, (0, _extends2.default)({
127
+ var flyout = (0, _react2.jsx)(_flyout.EuiFlyout, (0, _extends2.default)({
150
128
  "aria-label": defaultAriaLabel
151
129
  }, rest, {
152
130
  // EuiCollapsibleNav is significantly less permissive than EuiFlyout
153
131
  id: flyoutID,
154
132
  css: cssStyles,
155
133
  className: classes,
156
- style: stylesWithHeaderOffset,
157
134
  size: width,
158
135
  side: side,
159
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)('padding-bottom', euiTheme.size.xs), (0, _global_styling.euiYScroll)(euiThemeContext), ".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;"),
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;"),
@@ -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)('top', 0), " ", (0, _global_styling.logicalCSS)('bottom', 0), " ", (0, _global_styling.logicalCSS)('height', '100%'), " 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;"),
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;"),
@@ -5,17 +5,22 @@ var _typeof = require("@babel/runtime/helpers/typeof");
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
- exports.EuiHeader = void 0;
8
+ exports.euiFixedHeadersCount = exports.EuiHeader = exports.EuiFixedHeader = void 0;
9
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
10
+ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
9
11
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
10
12
  var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
11
13
  var _react = _interopRequireWildcard(require("react"));
12
14
  var _classnames = _interopRequireDefault(require("classnames"));
13
15
  var _services = require("../../services");
16
+ var _global_styling = require("../../global_styling");
14
17
  var _header_breadcrumbs = require("./header_breadcrumbs");
15
18
  var _header_section = require("./header_section");
16
19
  var _header = require("./header.styles");
17
20
  var _react2 = require("@emotion/react");
18
- var _excluded = ["children", "className", "sections", "position", "theme"];
21
+ var _euiFixedHeadersCount, _euiFixedHeadersCount2;
22
+ var _excluded = ["children", "className", "sections", "position", "theme"],
23
+ _excluded2 = ["children", "style"];
19
24
  /*
20
25
  * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
21
26
  * or more contributor license agreements. Licensed under the Elastic License
@@ -25,6 +30,8 @@ var _excluded = ["children", "className", "sections", "position", "theme"];
25
30
  */
26
31
  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); }
27
32
  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
+ 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; }
34
+ 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; }
28
35
  var createHeaderSection = function createHeaderSection(sections) {
29
36
  return sections.map(function (section, index) {
30
37
  return (0, _react2.jsx)(_header_section.EuiHeaderSectionItem, {
@@ -32,8 +39,6 @@ var createHeaderSection = function createHeaderSection(sections) {
32
39
  }, section);
33
40
  });
34
41
  };
35
- // Start a counter to manage the total number of fixed headers that need the body class
36
- var euiHeaderFixedCounter = 0;
37
42
  var EuiHeader = function EuiHeader(_ref) {
38
43
  var children = _ref.children,
39
44
  className = _ref.className,
@@ -47,22 +52,6 @@ var EuiHeader = function EuiHeader(_ref) {
47
52
  var euiTheme = (0, _services.useEuiTheme)();
48
53
  var styles = (0, _header.euiHeaderStyles)(euiTheme);
49
54
  var cssStyles = [styles.euiHeader, styles[position], styles[theme]];
50
- (0, _react.useEffect)(function () {
51
- if (position === 'fixed') {
52
- // Increment fixed header counter for each fixed header
53
- euiHeaderFixedCounter++;
54
- document.body.classList.add('euiBody--headerIsFixed');
55
- document.body.dataset.fixedHeaders = String(euiHeaderFixedCounter);
56
- return function () {
57
- // Both decrement the fixed counter AND then check if there are none
58
- if (--euiHeaderFixedCounter === 0) {
59
- // If there are none, THEN remove class
60
- document.body.classList.remove('euiBody--headerIsFixed');
61
- delete document.body.dataset.fixedHeaders;
62
- }
63
- };
64
- }
65
- }, [position]);
66
55
  var contents;
67
56
  if (sections) {
68
57
  if (children) {
@@ -91,10 +80,74 @@ var EuiHeader = function EuiHeader(_ref) {
91
80
  } else {
92
81
  contents = children;
93
82
  }
94
- return (0, _react2.jsx)("div", (0, _extends2.default)({
83
+ return position === 'fixed' ? (0, _react2.jsx)(EuiFixedHeader, (0, _extends2.default)({
95
84
  css: cssStyles,
96
- className: classes,
97
- "data-fixed-header": position === 'fixed' || undefined // Used by EuiFlyouts as a query selector
85
+ className: classes
86
+ }, rest), contents) : (0, _react2.jsx)("div", (0, _extends2.default)({
87
+ css: cssStyles,
88
+ className: classes
98
89
  }, rest), contents);
99
90
  };
100
- exports.EuiHeader = EuiHeader;
91
+
92
+ /**
93
+ * Fixed headers - logic around dynamically calculating the total
94
+ * page offset and setting the `top` position of subsequent headers
95
+ */
96
+
97
+ // Start a counter to manage the total number of fixed headers
98
+ // Exported for unit testing only
99
+ exports.EuiHeader = EuiHeader;
100
+ var euiFixedHeadersCount = 0;
101
+
102
+ // Exported for unit testing only
103
+ exports.euiFixedHeadersCount = euiFixedHeadersCount;
104
+ var EuiFixedHeader = function EuiFixedHeader(_ref2) {
105
+ var children = _ref2.children,
106
+ style = _ref2.style,
107
+ rest = (0, _objectWithoutProperties2.default)(_ref2, _excluded2);
108
+ var _useEuiThemeCSSVariab = (0, _services.useEuiThemeCSSVariables)(),
109
+ setGlobalCSSVariables = _useEuiThemeCSSVariab.setGlobalCSSVariables;
110
+ var euiTheme = (0, _services.useEuiTheme)();
111
+ var headerHeight = (0, _header.euiHeaderVariables)(euiTheme).height;
112
+ var getHeaderOffset = (0, _react.useCallback)(function () {
113
+ return (0, _global_styling.mathWithUnits)(headerHeight, function (x) {
114
+ return x * euiFixedHeadersCount;
115
+ });
116
+ }, [headerHeight]);
117
+ var _useState = (0, _react.useState)(),
118
+ _useState2 = (0, _slicedToArray2.default)(_useState, 2),
119
+ topPosition = _useState2[0],
120
+ setTopPosition = _useState2[1];
121
+ (0, _react.useEffect)(function () {
122
+ // Get the top position from the offset of previous header(s)
123
+ setTopPosition(getHeaderOffset());
124
+
125
+ // Increment fixed header counter for each fixed header
126
+ _euiFixedHeadersCount = euiFixedHeadersCount++, exports.euiFixedHeadersCount = euiFixedHeadersCount, _euiFixedHeadersCount;
127
+ setGlobalCSSVariables({
128
+ '--euiFixedHeadersOffset': getHeaderOffset()
129
+ });
130
+ document.body.classList.add('euiBody--headerIsFixed'); // TODO: Consider deleting this legacy className
131
+
132
+ return function () {
133
+ _euiFixedHeadersCount2 = euiFixedHeadersCount--, exports.euiFixedHeadersCount = euiFixedHeadersCount, _euiFixedHeadersCount2;
134
+ setGlobalCSSVariables({
135
+ '--euiFixedHeadersOffset': getHeaderOffset()
136
+ });
137
+ if (euiFixedHeadersCount === 0) {
138
+ document.body.classList.remove('euiBody--headerIsFixed'); // TODO: Consider deleting this legacy className
139
+ }
140
+ };
141
+ }, [getHeaderOffset, setGlobalCSSVariables]);
142
+ var inlineStyles = (0, _react.useMemo)(function () {
143
+ return (0, _global_styling.logicalStyles)(_objectSpread({
144
+ top: topPosition
145
+ }, style));
146
+ }, [topPosition, style]);
147
+ return (0, _react2.jsx)("div", (0, _extends2.default)({
148
+ "data-fixed-header": true // Used by EuiFlyouts as a query selector
149
+ ,
150
+ style: inlineStyles
151
+ }, rest), children);
152
+ };
153
+ exports.EuiFixedHeader = EuiFixedHeader;
@@ -40,7 +40,7 @@ var euiHeaderStyles = function euiHeaderStyles(euiThemeContext) {
40
40
  euiHeader: /*#__PURE__*/(0, _react.css)("display:flex;justify-content:space-between;", (0, _global_styling.logicalCSS)('height', height), " ", (0, _global_styling.logicalCSS)('padding-horizontal', padding), " ", (0, _mixins.euiShadowSmall)(euiThemeContext), ";;label:euiHeader;"),
41
41
  // Position
42
42
  static: /*#__PURE__*/(0, _react.css)("z-index:", Number(euiTheme.levels.header) - 1, ";position:relative;;label:static;"),
43
- fixed: /*#__PURE__*/(0, _react.css)("z-index:", euiTheme.levels.header, ";position:fixed;", (0, _global_styling.logicalCSS)('top', 0), " ", (0, _global_styling.logicalCSS)('horizontal', 0), " &+[data-fixed-header]{", (0, _global_styling.logicalCSS)('top', height), ";};label:fixed;"),
43
+ fixed: /*#__PURE__*/(0, _react.css)("z-index:", euiTheme.levels.header, ";position:fixed;", (0, _global_styling.logicalCSS)('top', 0), " ", (0, _global_styling.logicalCSS)('horizontal', 0), ";;label:fixed;"),
44
44
  // Theme
45
45
  default: /*#__PURE__*/(0, _react.css)("background-color:", euiTheme.colors.emptyShade, ";", (0, _global_styling.logicalCSS)('border-bottom', "".concat(euiTheme.border.width.thin, " solid ").concat(borderColor)), ";;label:default;"),
46
46
  dark: /*#__PURE__*/(0, _react.css)(euiHeaderDarkStyles(euiThemeContext, borderColor), ";label:dark;")
@@ -905,6 +905,17 @@ Object.keys(_text_diff).forEach(function (key) {
905
905
  }
906
906
  });
907
907
  });
908
+ var _text_truncate = require("./text_truncate");
909
+ Object.keys(_text_truncate).forEach(function (key) {
910
+ if (key === "default" || key === "__esModule") return;
911
+ if (key in exports && exports[key] === _text_truncate[key]) return;
912
+ Object.defineProperty(exports, key, {
913
+ enumerable: true,
914
+ get: function get() {
915
+ return _text_truncate[key];
916
+ }
917
+ });
918
+ });
908
919
  var _timeline = require("./timeline");
909
920
  Object.keys(_timeline).forEach(function (key) {
910
921
  if (key === "default" || key === "__esModule") return;
@@ -20,7 +20,7 @@ var euiOverlayMaskStyles = function euiOverlayMaskStyles(_ref) {
20
20
  return {
21
21
  euiOverlayMask: /*#__PURE__*/(0, _css.css)("position:fixed;", (0, _global_styling.logicalCSS)('top', 0), " ", (0, _global_styling.logicalCSS)('left', 0), " ", (0, _global_styling.logicalCSS)('right', 0), " ", (0, _global_styling.logicalCSS)('bottom', 0), " display:flex;align-items:center;justify-content:center;", (0, _global_styling.logicalCSS)('padding-bottom', '10vh'), " animation:", _global_styling.euiAnimFadeIn, " ", euiTheme.animation.fast, " ease-in;background:", (0, _services.transparentize)(euiTheme.colors.ink, 0.5), ";;label:euiOverlayMask;"),
22
22
  aboveHeader: /*#__PURE__*/(0, _css.css)("z-index:", euiTheme.levels.mask, ";;label:aboveHeader;"),
23
- belowHeader: /*#__PURE__*/(0, _css.css)("z-index:", euiTheme.levels.maskBelowHeader, ";", (0, _global_styling.logicalCSS)('top', "".concat(euiTheme.base * 3, "px")), ";;label:belowHeader;")
23
+ belowHeader: /*#__PURE__*/(0, _css.css)("z-index:", euiTheme.levels.maskBelowHeader, ";", (0, _global_styling.logicalCSS)('top', 'var(--euiFixedHeadersOffset, 0)'), ";;label:belowHeader;")
24
24
  };
25
25
  };
26
26
  exports.euiOverlayMaskStyles = euiOverlayMaskStyles;
@@ -54,10 +54,8 @@ var EuiPageSidebar = function EuiPageSidebar(_ref) {
54
54
  (0, _react.useLayoutEffect)(function () {
55
55
  var updatedStyles = _objectSpread(_objectSpread({}, style), (0, _global_styling.logicalStyle)('min-width', isResponding ? '100%' : minWidth));
56
56
  if (sticky) {
57
- var _document$body$datase;
58
- var euiHeaderFixedCounter = Number((_document$body$datase = document.body.dataset.fixedHeaders) !== null && _document$body$datase !== void 0 ? _document$body$datase : 0);
59
- var offset = (0, _typeof2.default)(sticky) === 'object' ? sticky === null || sticky === void 0 ? void 0 : sticky.offset : themeContext.euiTheme.base * 3 * euiHeaderFixedCounter;
60
- updatedStyles = _objectSpread(_objectSpread(_objectSpread({}, updatedStyles), (0, _global_styling.logicalStyle)('top', offset)), (0, _global_styling.logicalStyle)('max-height', "calc(100vh - ".concat(offset, "px)")));
57
+ var offset = (0, _typeof2.default)(sticky) === 'object' ? "".concat(sticky === null || sticky === void 0 ? void 0 : sticky.offset, "px") : 'var(--euiFixedHeadersOffset, 0)';
58
+ updatedStyles = _objectSpread(_objectSpread(_objectSpread({}, updatedStyles), (0, _global_styling.logicalStyle)('top', offset)), (0, _global_styling.logicalStyle)('max-height', "calc(100vh - ".concat(offset, ")")));
61
59
  }
62
60
  setInlineStyles(updatedStyles);
63
61
  }, [style, sticky, themeContext.euiTheme.base, isResponding, minWidth]);
@@ -8,7 +8,6 @@ Object.defineProperty(exports, "__esModule", {
8
8
  exports._EuiPageTemplate = exports.TemplateContext = exports.EuiPageTemplate = void 0;
9
9
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
10
10
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
11
- var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
12
11
  var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
13
12
  var _react = _interopRequireWildcard(require("react"));
14
13
  var _classnames = _interopRequireDefault(require("classnames"));
@@ -39,14 +38,6 @@ var TemplateContext = /*#__PURE__*/(0, _react.createContext)({
39
38
  bottomBar: {}
40
39
  });
41
40
  exports.TemplateContext = TemplateContext;
42
- var calculateOffset = function calculateOffset(base) {
43
- var _document$body$datase;
44
- if (typeof document === 'undefined') return 0; // SSR catch
45
-
46
- var euiHeaderFixedCounter = Number((_document$body$datase = document.body.dataset.fixedHeaders) !== null && _document$body$datase !== void 0 ? _document$body$datase : 0);
47
- return base * 3 * euiHeaderFixedCounter;
48
- };
49
-
50
41
  /**
51
42
  * Consumed via `EuiPageTemplate`,
52
43
  * it controls and propogates most of the shared props per direct child
@@ -62,7 +53,7 @@ var _EuiPageTemplate = function _EuiPageTemplate(_ref) {
62
53
  _ref$grow = _ref.grow,
63
54
  grow = _ref$grow === void 0 ? true : _ref$grow,
64
55
  bottomBorder = _ref.bottomBorder,
65
- _offset = _ref.offset,
56
+ offset = _ref.offset,
66
57
  panelled = _ref.panelled,
67
58
  contentBorder = _ref.contentBorder,
68
59
  component = _ref.component,
@@ -71,14 +62,6 @@ var _EuiPageTemplate = function _EuiPageTemplate(_ref) {
71
62
  _ref$minHeight = _ref.minHeight,
72
63
  minHeight = _ref$minHeight === void 0 ? '460px' : _ref$minHeight,
73
64
  rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
74
- var _useEuiTheme = (0, _services.useEuiTheme)(),
75
- euiTheme = _useEuiTheme.euiTheme;
76
- var _useState = (0, _react.useState)(function () {
77
- return _offset !== null && _offset !== void 0 ? _offset : calculateOffset(euiTheme.base);
78
- }),
79
- _useState2 = (0, _slicedToArray2.default)(_useState, 2),
80
- offset = _useState2[0],
81
- setOffset = _useState2[1];
82
65
  var templateContext = (0, _react.useContext)(TemplateContext);
83
66
 
84
67
  // Used as a target to insert the bottom bar component
@@ -86,11 +69,6 @@ var _EuiPageTemplate = function _EuiPageTemplate(_ref) {
86
69
  prefix: 'EuiPageTemplateInner',
87
70
  conditionalId: mainProps === null || mainProps === void 0 ? void 0 : mainProps.id
88
71
  });
89
- (0, _react.useEffect)(function () {
90
- if (_offset === undefined) {
91
- setOffset(calculateOffset(euiTheme.base));
92
- }
93
- }, [_offset, euiTheme.base]);
94
72
 
95
73
  // Sections include page header
96
74
  var sections = [];
@@ -149,7 +127,7 @@ var _EuiPageTemplate = function _EuiPageTemplate(_ref) {
149
127
  });
150
128
  var _minHeight = grow ? "max(".concat(minHeight, ", 100vh)") : minHeight;
151
129
  var classes = (0, _classnames.default)('euiPageTemplate', className);
152
- var pageStyle = _objectSpread(_objectSpread(_objectSpread({}, (0, _global_styling.logicalStyle)('min-height', _minHeight)), (0, _global_styling.logicalStyle)('padding-top', offset)), rest.style);
130
+ var pageStyle = _objectSpread(_objectSpread(_objectSpread({}, (0, _global_styling.logicalStyle)('min-height', _minHeight)), (0, _global_styling.logicalStyle)('padding-top', offset !== null && offset !== void 0 ? offset : 'var(--euiFixedHeadersOffset, 0)')), rest.style);
153
131
  templateContext.header = getHeaderProps();
154
132
  templateContext.section = getSectionProps();
155
133
  templateContext.emptyPrompt = {
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "EuiTextTruncate", {
7
+ enumerable: true,
8
+ get: function get() {
9
+ return _text_truncate.EuiTextTruncate;
10
+ }
11
+ });
12
+ Object.defineProperty(exports, "TruncationUtilsWithCanvas", {
13
+ enumerable: true,
14
+ get: function get() {
15
+ return _utils.TruncationUtilsWithCanvas;
16
+ }
17
+ });
18
+ Object.defineProperty(exports, "TruncationUtilsWithDOM", {
19
+ enumerable: true,
20
+ get: function get() {
21
+ return _utils.TruncationUtilsWithDOM;
22
+ }
23
+ });
24
+ var _text_truncate = require("./text_truncate");
25
+ var _utils = require("./utils");