@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.
Files changed (148) hide show
  1. package/dist/eui_charts_theme.js +9 -8
  2. package/dist/eui_charts_theme.js.map +1 -1
  3. package/dist/eui_theme_dark.css +11 -41
  4. package/dist/eui_theme_dark.min.css +1 -1
  5. package/dist/eui_theme_light.css +11 -41
  6. package/dist/eui_theme_light.min.css +1 -1
  7. package/es/components/accordion/accordion.js +34 -9
  8. package/es/components/accordion/accordion.styles.js +29 -9
  9. package/es/components/collapsible_nav/collapsible_nav_group/collapsible_nav_group.js +10 -2
  10. package/es/components/collapsible_nav_beta/collapsible_nav_beta.js +10 -26
  11. package/es/components/collapsible_nav_beta/collapsible_nav_beta.styles.js +10 -1
  12. package/es/components/datagrid/controls/keyboard_shortcuts.js +1 -0
  13. package/es/components/description_list/description_list.js +40 -3
  14. package/es/components/flyout/flyout.styles.js +1 -1
  15. package/es/components/header/header.js +120 -25
  16. package/es/components/header/header.styles.js +1 -1
  17. package/es/components/index.js +1 -0
  18. package/es/components/markdown_editor/markdown_format.styles.js +3 -6
  19. package/es/components/overlay_mask/overlay_mask.styles.js +1 -1
  20. package/es/components/page/page_sidebar/page_sidebar.js +2 -4
  21. package/es/components/page_template/page_template.js +4 -31
  22. package/es/components/text/text.styles.js +3 -6
  23. package/es/components/text_truncate/index.js +10 -0
  24. package/es/components/text_truncate/text_truncate.js +232 -0
  25. package/es/components/text_truncate/text_truncate.styles.js +49 -0
  26. package/es/components/text_truncate/utils.js +348 -0
  27. package/es/global_styling/functions/typography.js +8 -8
  28. package/es/global_styling/variables/typography.js +1 -1
  29. package/es/services/theme/context.js +3 -1
  30. package/es/services/theme/hooks.js +19 -1
  31. package/es/services/theme/index.js +1 -1
  32. package/es/services/theme/provider.js +37 -8
  33. package/es/themes/amsterdam/global_styling/variables/_typography.js +1 -0
  34. package/eui.d.ts +282 -24
  35. package/i18ntokens.json +112 -112
  36. package/lib/components/accordion/accordion.js +33 -8
  37. package/lib/components/accordion/accordion.styles.js +31 -10
  38. package/lib/components/collapsible_nav/collapsible_nav_group/collapsible_nav_group.js +10 -2
  39. package/lib/components/collapsible_nav_beta/collapsible_nav_beta.js +10 -26
  40. package/lib/components/collapsible_nav_beta/collapsible_nav_beta.styles.js +10 -1
  41. package/lib/components/datagrid/controls/keyboard_shortcuts.js +1 -0
  42. package/lib/components/description_list/description_list.js +39 -3
  43. package/lib/components/flyout/flyout.styles.js +1 -1
  44. package/lib/components/header/header.js +120 -23
  45. package/lib/components/header/header.styles.js +1 -1
  46. package/lib/components/index.js +11 -0
  47. package/lib/components/markdown_editor/markdown_format.styles.js +3 -6
  48. package/lib/components/overlay_mask/overlay_mask.styles.js +1 -1
  49. package/lib/components/page/page_sidebar/page_sidebar.js +2 -4
  50. package/lib/components/page_template/page_template.js +2 -29
  51. package/lib/components/text/text.styles.js +3 -6
  52. package/lib/components/text_truncate/index.js +25 -0
  53. package/lib/components/text_truncate/text_truncate.js +242 -0
  54. package/lib/components/text_truncate/text_truncate.styles.js +54 -0
  55. package/lib/components/text_truncate/utils.js +352 -0
  56. package/lib/global_styling/functions/typography.js +8 -8
  57. package/lib/global_styling/variables/typography.js +3 -3
  58. package/lib/services/theme/context.js +3 -1
  59. package/lib/services/theme/hooks.js +21 -2
  60. package/lib/services/theme/index.js +6 -0
  61. package/lib/services/theme/provider.js +62 -35
  62. package/lib/themes/amsterdam/global_styling/variables/_typography.js +1 -0
  63. package/optimize/es/components/accordion/accordion.js +19 -7
  64. package/optimize/es/components/accordion/accordion.styles.js +29 -9
  65. package/optimize/es/components/collapsible_nav_beta/collapsible_nav_beta.js +5 -26
  66. package/optimize/es/components/collapsible_nav_beta/collapsible_nav_beta.styles.js +10 -1
  67. package/optimize/es/components/datagrid/controls/keyboard_shortcuts.js +1 -0
  68. package/optimize/es/components/description_list/description_list.js +22 -2
  69. package/optimize/es/components/flyout/flyout.styles.js +1 -1
  70. package/optimize/es/components/header/header.js +75 -25
  71. package/optimize/es/components/header/header.styles.js +1 -1
  72. package/optimize/es/components/index.js +1 -0
  73. package/optimize/es/components/markdown_editor/markdown_format.styles.js +3 -6
  74. package/optimize/es/components/overlay_mask/overlay_mask.styles.js +1 -1
  75. package/optimize/es/components/page/page_sidebar/page_sidebar.js +2 -4
  76. package/optimize/es/components/page_template/page_template.js +4 -26
  77. package/optimize/es/components/text/text.styles.js +3 -6
  78. package/optimize/es/components/text_truncate/index.js +10 -0
  79. package/optimize/es/components/text_truncate/text_truncate.js +148 -0
  80. package/optimize/es/components/text_truncate/text_truncate.styles.js +49 -0
  81. package/optimize/es/components/text_truncate/utils.js +337 -0
  82. package/optimize/es/global_styling/functions/typography.js +8 -8
  83. package/optimize/es/global_styling/variables/typography.js +1 -1
  84. package/optimize/es/services/theme/context.js +3 -1
  85. package/optimize/es/services/theme/hooks.js +19 -1
  86. package/optimize/es/services/theme/index.js +1 -1
  87. package/optimize/es/services/theme/provider.js +37 -8
  88. package/optimize/es/themes/amsterdam/global_styling/variables/_typography.js +1 -0
  89. package/optimize/lib/components/accordion/accordion.js +18 -6
  90. package/optimize/lib/components/accordion/accordion.styles.js +31 -10
  91. package/optimize/lib/components/collapsible_nav_beta/collapsible_nav_beta.js +5 -26
  92. package/optimize/lib/components/collapsible_nav_beta/collapsible_nav_beta.styles.js +10 -1
  93. package/optimize/lib/components/datagrid/controls/keyboard_shortcuts.js +1 -0
  94. package/optimize/lib/components/description_list/description_list.js +22 -2
  95. package/optimize/lib/components/flyout/flyout.styles.js +1 -1
  96. package/optimize/lib/components/header/header.js +77 -24
  97. package/optimize/lib/components/header/header.styles.js +1 -1
  98. package/optimize/lib/components/index.js +11 -0
  99. package/optimize/lib/components/markdown_editor/markdown_format.styles.js +3 -6
  100. package/optimize/lib/components/overlay_mask/overlay_mask.styles.js +1 -1
  101. package/optimize/lib/components/page/page_sidebar/page_sidebar.js +2 -4
  102. package/optimize/lib/components/page_template/page_template.js +2 -24
  103. package/optimize/lib/components/text/text.styles.js +3 -6
  104. package/optimize/lib/components/text_truncate/index.js +25 -0
  105. package/optimize/lib/components/text_truncate/text_truncate.js +158 -0
  106. package/optimize/lib/components/text_truncate/text_truncate.styles.js +54 -0
  107. package/optimize/lib/components/text_truncate/utils.js +342 -0
  108. package/optimize/lib/global_styling/functions/typography.js +8 -8
  109. package/optimize/lib/global_styling/variables/typography.js +3 -3
  110. package/optimize/lib/services/theme/context.js +3 -1
  111. package/optimize/lib/services/theme/hooks.js +21 -2
  112. package/optimize/lib/services/theme/index.js +6 -0
  113. package/optimize/lib/services/theme/provider.js +62 -35
  114. package/optimize/lib/themes/amsterdam/global_styling/variables/_typography.js +1 -0
  115. package/package.json +1 -1
  116. package/src/components/datagrid/_data_grid.scss +13 -2
  117. package/src/components/datagrid/controls/_data_grid_keyboard_shortcuts.scss +1 -7
  118. package/src/components/index.scss +0 -1
  119. package/src/global_styling/mixins/_header.scss +2 -0
  120. package/test-env/components/accordion/accordion.js +28 -8
  121. package/test-env/components/accordion/accordion.styles.js +31 -10
  122. package/test-env/components/collapsible_nav/collapsible_nav_group/collapsible_nav_group.js +10 -2
  123. package/test-env/components/collapsible_nav_beta/collapsible_nav_beta.js +10 -26
  124. package/test-env/components/collapsible_nav_beta/collapsible_nav_beta.styles.js +10 -1
  125. package/test-env/components/datagrid/controls/keyboard_shortcuts.js +1 -0
  126. package/test-env/components/description_list/description_list.js +37 -3
  127. package/test-env/components/flyout/flyout.styles.js +1 -1
  128. package/test-env/components/header/header.js +113 -23
  129. package/test-env/components/header/header.styles.js +1 -1
  130. package/test-env/components/index.js +11 -0
  131. package/test-env/components/markdown_editor/markdown_format.styles.js +3 -6
  132. package/test-env/components/overlay_mask/overlay_mask.styles.js +1 -1
  133. package/test-env/components/page/page_sidebar/page_sidebar.js +2 -4
  134. package/test-env/components/page_template/page_template.js +2 -24
  135. package/test-env/components/text/text.styles.js +3 -6
  136. package/test-env/components/text_truncate/index.js +25 -0
  137. package/test-env/components/text_truncate/text_truncate.js +236 -0
  138. package/test-env/components/text_truncate/text_truncate.styles.js +54 -0
  139. package/test-env/components/text_truncate/utils.js +342 -0
  140. package/test-env/global_styling/functions/typography.js +8 -8
  141. package/test-env/global_styling/variables/typography.js +3 -3
  142. package/test-env/services/theme/context.js +3 -1
  143. package/test-env/services/theme/hooks.js +21 -2
  144. package/test-env/services/theme/index.js +6 -0
  145. package/test-env/services/theme/provider.js +62 -35
  146. package/test-env/themes/amsterdam/global_styling/variables/_typography.js +1 -0
  147. package/src/components/accordion/_accordion_form.scss +0 -40
  148. package/src/components/accordion/_index.scss +0 -1
@@ -0,0 +1,49 @@
1
+ function _EMOTION_STRINGIFIED_CSS_ERROR__() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
2
+ /*
3
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
4
+ * or more contributor license agreements. Licensed under the Elastic License
5
+ * 2.0 and the Server Side Public License, v 1; you may not use this file except
6
+ * in compliance with, at your election, the Elastic License 2.0 or the Server
7
+ * Side Public License, v 1.
8
+ */
9
+
10
+ import { css } from '@emotion/react';
11
+ export var euiTextTruncateStyles = {
12
+ euiTextTruncate: process.env.NODE_ENV === "production" ? {
13
+ name: "7o5qnz-euiTextTruncate",
14
+ styles: "position:relative;overflow:hidden;white-space:nowrap;label:euiTextTruncate;"
15
+ } : {
16
+ name: "7o5qnz-euiTextTruncate",
17
+ styles: "position:relative;overflow:hidden;white-space:nowrap;label:euiTextTruncate;",
18
+ toString: _EMOTION_STRINGIFIED_CSS_ERROR__
19
+ },
20
+ /**
21
+ * The below CSS is a hack to get double clicking and selecting the *full* text
22
+ * instead of the truncated text (useful for copying/pasting, and mimics how
23
+ * `text-overflow: ellipsis` works).
24
+ *
25
+ * Real talk: I'm lowkey amazed it works and it wouldn't surprise me if we ran into
26
+ * cross-browser issues with this at some point. Hopefully CSS natively implements
27
+ * custom text truncation some day (https://github.com/w3c/csswg-drafts/issues/3937)
28
+ * and there'll be no need for the entire component at that point 🙏
29
+ */
30
+ // Makes the truncated text unselectable/un-clickable
31
+ truncatedText: process.env.NODE_ENV === "production" ? {
32
+ name: "1dore6v-truncatedText",
33
+ styles: "user-select:none;pointer-events:none;label:truncatedText;"
34
+ } : {
35
+ name: "1dore6v-truncatedText",
36
+ styles: "user-select:none;pointer-events:none;label:truncatedText;",
37
+ toString: _EMOTION_STRINGIFIED_CSS_ERROR__
38
+ },
39
+ // Positions the full text on top of the truncated text (so that clicking targets it)
40
+ // and gives it a color opacity of 0 so that it's not actually visible
41
+ fullText: process.env.NODE_ENV === "production" ? {
42
+ name: "1kxt4rj-fullText",
43
+ styles: "position:absolute;inset:0;overflow:hidden;color:rgba(0, 0, 0, 0);@supports (-webkit-hyphens: none){text-overflow:ellipsis;};label:fullText;"
44
+ } : {
45
+ name: "1kxt4rj-fullText",
46
+ styles: "position:absolute;inset:0;overflow:hidden;color:rgba(0, 0, 0, 0);@supports (-webkit-hyphens: none){text-overflow:ellipsis;};label:fullText;",
47
+ toString: _EMOTION_STRINGIFIED_CSS_ERROR__
48
+ }
49
+ };
@@ -0,0 +1,348 @@
1
+ var _excluded = ["container"],
2
+ _excluded2 = ["font", "container"];
3
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
4
+ function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
5
+ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
6
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
7
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
8
+ 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); }; }
9
+ function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
10
+ function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
11
+ 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; } }
12
+ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
13
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
14
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
15
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
16
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
17
+ function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
18
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
19
+ function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
20
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
21
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
22
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
23
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
24
+ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
25
+ /*
26
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
27
+ * or more contributor license agreements. Licensed under the Elastic License
28
+ * 2.0 and the Server Side Public License, v 1; you may not use this file except
29
+ * in compliance with, at your election, the Elastic License 2.0 or the Server
30
+ * Side Public License, v 1.
31
+ */
32
+ /**
33
+ * This internal shared/base class contains the actual logic for truncating text
34
+ * (as well as a few handy utilities for checking whether truncation is possible
35
+ * or even necessary).
36
+ *
37
+ * How the underlying mechanism works: the full text is rendered, and then
38
+ * characters are removed one by one until the width of the text fits within
39
+ * the specified available width.
40
+ *
41
+ * Side note: The exception to this is the `truncateStartEndAtPosition` method,
42
+ * which works by building up from an empty string / by adding characters
43
+ * instead of removing them.
44
+ */
45
+ var _TruncationUtils = /*#__PURE__*/_createClass(function _TruncationUtils(_ref) {
46
+ var _this = this;
47
+ var fullText = _ref.fullText,
48
+ ellipsis = _ref.ellipsis,
49
+ availableWidth = _ref.availableWidth;
50
+ _classCallCheck(this, _TruncationUtils);
51
+ _defineProperty(this, "fullText", void 0);
52
+ _defineProperty(this, "ellipsis", void 0);
53
+ _defineProperty(this, "availableWidth", void 0);
54
+ /**
55
+ * Early return checks
56
+ */
57
+ _defineProperty(this, "checkIfTruncationIsNeeded", function () {
58
+ _this.setTextToCheck(_this.fullText);
59
+ if (_this.availableWidth > _this.textWidth) {
60
+ return false;
61
+ }
62
+ });
63
+ _defineProperty(this, "checkSufficientEllipsisWidth", function (truncation) {
64
+ var textToCheck = truncation === 'startEnd' ? "".concat(_this.ellipsis, " ").concat(_this.ellipsis) // startEnd needs a little more space
65
+ : _this.ellipsis;
66
+ _this.setTextToCheck(textToCheck);
67
+ if (_this.textWidth >= _this.availableWidth * 0.9) {
68
+ console.error('The truncation ellipsis is larger than the available width. No text can be rendered.');
69
+ return false;
70
+ }
71
+ });
72
+ _defineProperty(this, "checkTruncationOffsetWidth", function (text) {
73
+ _this.setTextToCheck(text);
74
+ if (_this.textWidth > _this.availableWidth) {
75
+ console.error("The passed truncationOffset is too large for the available width. Truncating the offset instead.");
76
+ return false;
77
+ }
78
+ });
79
+ /**
80
+ * Truncation types logic. This is where the magic happens
81
+ */
82
+ _defineProperty(this, "truncateStart", function (truncationOffset) {
83
+ var truncatedText = _this.fullText;
84
+ var leadingText = '';
85
+ var combinedText = function combinedText() {
86
+ return "".concat(leadingText).concat(truncatedText);
87
+ };
88
+ if (truncationOffset) {
89
+ var _splitText$at = splitText(_this.fullText).at(truncationOffset);
90
+ var _splitText$at2 = _slicedToArray(_splitText$at, 2);
91
+ leadingText = _splitText$at2[0];
92
+ truncatedText = _splitText$at2[1];
93
+ var widthCheck = "".concat(leadingText).concat(_this.ellipsis);
94
+ if (_this.checkTruncationOffsetWidth(widthCheck) === false) {
95
+ truncatedText = leadingText;
96
+ leadingText = '';
97
+ }
98
+ }
99
+ leadingText += _this.ellipsis;
100
+ _this.setTextToCheck(combinedText());
101
+ while (_this.textWidth > _this.availableWidth) {
102
+ truncatedText = removeFirstCharacter(truncatedText);
103
+ _this.setTextToCheck(combinedText());
104
+ }
105
+ return combinedText();
106
+ });
107
+ _defineProperty(this, "truncateEnd", function (truncationOffset) {
108
+ var truncatedText = _this.fullText;
109
+ var trailingText = '';
110
+ var combinedText = function combinedText() {
111
+ return "".concat(truncatedText).concat(trailingText);
112
+ };
113
+ if (truncationOffset) {
114
+ var index = _this.fullText.length - truncationOffset;
115
+ var _splitText$at3 = splitText(_this.fullText).at(index);
116
+ var _splitText$at4 = _slicedToArray(_splitText$at3, 2);
117
+ truncatedText = _splitText$at4[0];
118
+ trailingText = _splitText$at4[1];
119
+ var widthCheck = "".concat(_this.ellipsis).concat(trailingText);
120
+ if (_this.checkTruncationOffsetWidth(widthCheck) === false) {
121
+ truncatedText = trailingText;
122
+ trailingText = '';
123
+ }
124
+ }
125
+ trailingText = _this.ellipsis + trailingText;
126
+ _this.setTextToCheck(combinedText());
127
+ while (_this.textWidth > _this.availableWidth) {
128
+ truncatedText = removeLastCharacter(truncatedText);
129
+ _this.setTextToCheck(combinedText());
130
+ }
131
+ return combinedText();
132
+ });
133
+ _defineProperty(this, "truncateStartEndAtPosition", function (truncationPosition) {
134
+ // If using a non-centered startEnd anchor position, we need to *build*
135
+ // the string from scratch instead of *removing* from the full text string,
136
+ // to make sure we don't go past the beginning or end of the text
137
+ var truncatedText = '';
138
+ _this.setTextToCheck(truncatedText);
139
+
140
+ // Ellipses are conditional - if the anchor is towards the beginning or end,
141
+ // it's possible they shouldn't render
142
+ var startingEllipsis = _this.ellipsis;
143
+ var endingEllipsis = _this.ellipsis;
144
+
145
+ // Split the text into two at the anchor position
146
+ var _splitText$at5 = splitText(_this.fullText).at(truncationPosition),
147
+ _splitText$at6 = _slicedToArray(_splitText$at5, 2),
148
+ firstPart = _splitText$at6[0],
149
+ secondPart = _splitText$at6[1];
150
+ var combinedText = function combinedText() {
151
+ return "".concat(startingEllipsis).concat(truncatedText).concat(endingEllipsis);
152
+ };
153
+ while (_this.textWidth <= _this.availableWidth) {
154
+ if (firstPart.length > 0) {
155
+ truncatedText = "".concat(getLastCharacter(firstPart)).concat(truncatedText);
156
+ firstPart = removeLastCharacter(firstPart);
157
+ } else {
158
+ startingEllipsis = '';
159
+ }
160
+ if (secondPart.length > 0) {
161
+ truncatedText = "".concat(truncatedText).concat(getFirstCharacter(secondPart));
162
+ secondPart = removeFirstCharacter(secondPart);
163
+ } else {
164
+ endingEllipsis = '';
165
+ }
166
+ _this.setTextToCheck(combinedText());
167
+ }
168
+
169
+ // Because this logic builds text outwards vs. removing inwards, the final
170
+ // text width ends up a little larger than the container, and we need to
171
+ // remove the last added character(s)
172
+ if (!startingEllipsis) {
173
+ truncatedText = removeLastCharacter(truncatedText);
174
+ } else if (!endingEllipsis) {
175
+ truncatedText = removeFirstCharacter(truncatedText);
176
+ } else {
177
+ truncatedText = removeFirstAndLastCharacters(truncatedText);
178
+ }
179
+ return combinedText();
180
+ });
181
+ _defineProperty(this, "truncateStartEndAtMiddle", function () {
182
+ var truncatedText = _this.fullText;
183
+ _this.setTextToCheck(truncatedText);
184
+ var combinedText = function combinedText() {
185
+ return "".concat(_this.ellipsis).concat(truncatedText).concat(_this.ellipsis);
186
+ };
187
+ while (_this.textWidth > _this.availableWidth) {
188
+ truncatedText = removeFirstAndLastCharacters(truncatedText);
189
+ _this.setTextToCheck(combinedText());
190
+ }
191
+ return combinedText();
192
+ });
193
+ _defineProperty(this, "truncateMiddle", function () {
194
+ var middlePosition = Math.floor(_this.fullText.length / 2);
195
+ var _splitText$at7 = splitText(_this.fullText).at(middlePosition),
196
+ _splitText$at8 = _slicedToArray(_splitText$at7, 2),
197
+ firstHalf = _splitText$at8[0],
198
+ secondHalf = _splitText$at8[1];
199
+ var trimfirstHalf;
200
+ var combinedText = function combinedText() {
201
+ return "".concat(firstHalf).concat(_this.ellipsis).concat(secondHalf);
202
+ };
203
+ _this.setTextToCheck(combinedText());
204
+ while (_this.textWidth > _this.availableWidth) {
205
+ trimfirstHalf = !trimfirstHalf;
206
+ if (trimfirstHalf) {
207
+ firstHalf = removeLastCharacter(firstHalf);
208
+ } else {
209
+ secondHalf = removeFirstCharacter(secondHalf);
210
+ }
211
+ _this.setTextToCheck(combinedText());
212
+ }
213
+ return combinedText();
214
+ });
215
+ this.fullText = fullText;
216
+ this.ellipsis = ellipsis;
217
+ this.availableWidth = availableWidth;
218
+ }
219
+
220
+ /**
221
+ * Internal measurement utils which will be overridden depending on the
222
+ * rendering approach used (e.g. DOM vs Canvas).
223
+ */);
224
+ /**
225
+ * Creates a temporary vanilla JS DOM element for manipulating text and
226
+ * determining text width.
227
+ *
228
+ * Requires passing in a container element to which the temporary element
229
+ * will be appended. Any CSS/font styles that need to be accounted for should
230
+ * be automatically inherited from the container.
231
+ *
232
+ * NOTE: The consumer is responsible for calling the `cleanup()` method manually
233
+ * to remove the temporary DOM node once their usage of this utility is complete.
234
+ */
235
+
236
+ export var TruncationUtilsWithDOM = /*#__PURE__*/function (_TruncationUtils2) {
237
+ _inherits(TruncationUtilsWithDOM, _TruncationUtils2);
238
+ var _super = _createSuper(TruncationUtilsWithDOM);
239
+ function TruncationUtilsWithDOM(_ref2) {
240
+ var _this2;
241
+ var container = _ref2.container,
242
+ rest = _objectWithoutProperties(_ref2, _excluded);
243
+ _classCallCheck(this, TruncationUtilsWithDOM);
244
+ _this2 = _super.call(this, rest);
245
+ _defineProperty(_assertThisInitialized(_this2), "container", void 0);
246
+ _defineProperty(_assertThisInitialized(_this2), "span", void 0);
247
+ _defineProperty(_assertThisInitialized(_this2), "setTextToCheck", function (text) {
248
+ _this2.span.textContent = text;
249
+ });
250
+ _defineProperty(_assertThisInitialized(_this2), "cleanup", function () {
251
+ _this2.container.removeChild(_this2.span);
252
+ });
253
+ _this2.container = container;
254
+ _this2.span = document.createElement('span');
255
+ _this2.span.style.position = 'absolute'; // Prevent page reflow/repaint for performance
256
+ _this2.span.style.whiteSpace = 'nowrap'; // EuiTextTruncate already sets this on the parent, but we'll set it here as well for consumers who use this util standalone
257
+ _this2.container.appendChild(_this2.span);
258
+ return _this2;
259
+ }
260
+ _createClass(TruncationUtilsWithDOM, [{
261
+ key: "textWidth",
262
+ get: function get() {
263
+ return this.span.offsetWidth;
264
+ }
265
+ }]);
266
+ return TruncationUtilsWithDOM;
267
+ }(_TruncationUtils);
268
+
269
+ /**
270
+ * Creates a temporary Canvas element for manipulating text & determining
271
+ * text width. This method is compatible with charts or other canvas-rendered
272
+ * frameworks, and requires no cleanup method.
273
+ *
274
+ * To accurately measure text, canvas rendering requires either a container to
275
+ * compute/derive font styles from, or a static font string (useful for usage
276
+ * outside the DOM). Particular care should be applied when fallback fonts are
277
+ * used, as more fallback fonts can lead to less precision.
278
+ *
279
+ * Please note that while canvas is more performant than DOM measurement, there
280
+ * are subpixel to single digit pixel differences between DOM and canvas
281
+ * measurement due to the different rendering engines used.
282
+ */
283
+ export var TruncationUtilsWithCanvas = /*#__PURE__*/function (_TruncationUtils3) {
284
+ _inherits(TruncationUtilsWithCanvas, _TruncationUtils3);
285
+ var _super2 = _createSuper(TruncationUtilsWithCanvas);
286
+ function TruncationUtilsWithCanvas(_ref3) {
287
+ var _this3;
288
+ var font = _ref3.font,
289
+ container = _ref3.container,
290
+ rest = _objectWithoutProperties(_ref3, _excluded2);
291
+ _classCallCheck(this, TruncationUtilsWithCanvas);
292
+ _this3 = _super2.call(this, rest);
293
+ _defineProperty(_assertThisInitialized(_this3), "context", void 0);
294
+ _defineProperty(_assertThisInitialized(_this3), "currentText", '');
295
+ _defineProperty(_assertThisInitialized(_this3), "computeFontFromElement", function (element) {
296
+ var computedStyles = window.getComputedStyle(element);
297
+ return ['font-style', 'font-variant', 'font-weight', 'font-size', 'font-family'].map(function (prop) {
298
+ return computedStyles.getPropertyValue(prop);
299
+ }).join(' ').trim();
300
+ });
301
+ _defineProperty(_assertThisInitialized(_this3), "setTextToCheck", function (text) {
302
+ _this3.currentText = text;
303
+ });
304
+ _this3.context = document.createElement('canvas').getContext('2d');
305
+
306
+ // Set the canvas font to ensure text width calculations are correct
307
+ if (font) {
308
+ _this3.context.font = font;
309
+ } else if (container) {
310
+ _this3.context.font = _this3.computeFontFromElement(container);
311
+ }
312
+ return _this3;
313
+ }
314
+ _createClass(TruncationUtilsWithCanvas, [{
315
+ key: "textWidth",
316
+ get: function get() {
317
+ return this.context.measureText(this.currentText).width;
318
+ }
319
+ }]);
320
+ return TruncationUtilsWithCanvas;
321
+ }(_TruncationUtils);
322
+
323
+ /**
324
+ * DRY character/substring utils
325
+ */
326
+
327
+ var removeLastCharacter = function removeLastCharacter(text) {
328
+ return text.substring(0, text.length - 1);
329
+ };
330
+ var getLastCharacter = function getLastCharacter(text) {
331
+ return text.substring(text.length - 1);
332
+ };
333
+ var removeFirstCharacter = function removeFirstCharacter(text) {
334
+ return text.substring(1);
335
+ };
336
+ var getFirstCharacter = function getFirstCharacter(text) {
337
+ return text.substring(0, 1);
338
+ };
339
+ var removeFirstAndLastCharacters = function removeFirstAndLastCharacters(text) {
340
+ return text.substring(1, text.length - 1);
341
+ };
342
+ var splitText = function splitText(text) {
343
+ return {
344
+ at: function at(index) {
345
+ return [text.substring(0, index), text.substring(index)];
346
+ }
347
+ };
348
+ };
@@ -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$measurement = _ref2.measurement,
24
- measurement = _ref2$measurement === void 0 ? 'rem' : _ref2$measurement,
23
+ _ref2$unit = _ref2.unit,
24
+ unit = _ref2$unit === void 0 ? font.defaultUnits : _ref2$unit,
25
25
  customScale = _ref2.customScale;
26
- if (measurement === 'em') {
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 measurement === 'px' ? "".concat(numerator, "px") : "".concat((numerator / denominator).toFixed(4), "rem");
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$measurement = _ref4.measurement,
52
- measurement = _ref4$measurement === void 0 ? 'rem' : _ref4$measurement,
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 (measurement === 'em') {
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 measurement === 'px' ? "".concat(pixelValue, "px") : "".concat((pixelValue / denominator).toFixed(4), "rem");
66
+ return unit === 'px' ? "".concat(pixelValue, "px") : "".concat((pixelValue / denominator).toFixed(4), "rem");
67
67
  }
68
68
 
69
69
  /**
@@ -10,7 +10,7 @@
10
10
  * Font units of measure
11
11
  */
12
12
 
13
- export var EuiThemeFontSizeMeasurements = ['rem', 'px', 'em'];
13
+ export var EuiThemeFontUnits = ['rem', 'px', 'em'];
14
14
  /*
15
15
  * Font scale
16
16
  */
@@ -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 @@ function _extends() { _extends = Object.assign ? Object.assign.bind() : function
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';
@@ -1,4 +1,5 @@
1
1
  function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
2
+ import { css as _css } from "@emotion/react";
2
3
  var _excluded = ["cloneElement", "className"];
3
4
  function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
4
5
  function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
@@ -22,10 +23,12 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
22
23
  * Side Public License, v 1.
23
24
  */
24
25
 
25
- import React, { useContext, useEffect, useRef, useMemo, useState } from 'react';
26
+ import React, { useContext, useEffect, useRef, useMemo, useState, useCallback } from 'react';
26
27
  import classNames from 'classnames';
27
28
  import { css } from '@emotion/css';
29
+ import { Global } from '@emotion/react';
28
30
  import isEqual from 'lodash/isEqual';
31
+ import { cloneElementWithCss } from '../emotion';
29
32
  import { EuiSystemContext, EuiThemeContext, EuiNestedThemeContext, EuiModificationsContext, EuiColorModeContext } from './context';
30
33
  import { EuiEmotionThemeProvider } from './emotion';
31
34
  import { buildTheme, getColorMode, getComputed, mergeDeep } from './utils';
@@ -38,7 +41,9 @@ export var EuiThemeProvider = function EuiThemeProvider(_ref) {
38
41
  wrapperProps = _ref.wrapperProps;
39
42
  var _useContext = useContext(EuiNestedThemeContext),
40
43
  isGlobalTheme = _useContext.isGlobalTheme,
41
- bodyColor = _useContext.bodyColor;
44
+ bodyColor = _useContext.bodyColor,
45
+ globalCSSVariables = _useContext.globalCSSVariables,
46
+ setGlobalCSSVariables = _useContext.setGlobalCSSVariables;
42
47
  var parentSystem = useContext(EuiSystemContext);
43
48
  var parentModifications = useContext(EuiModificationsContext);
44
49
  var parentColorMode = useContext(EuiColorModeContext);
@@ -93,15 +98,28 @@ export var EuiThemeProvider = function EuiThemeProvider(_ref) {
93
98
  setTheme(getComputed(system, buildTheme(modifications, "_".concat(system.key)), colorMode));
94
99
  }
95
100
  }, [colorMode, system, modifications]);
101
+ var _useState9 = useState(),
102
+ _useState10 = _slicedToArray(_useState9, 2),
103
+ themeCSSVariables = _useState10[0],
104
+ _setThemeCSSVariables = _useState10[1];
105
+ var setThemeCSSVariables = useCallback(function (variables) {
106
+ return _setThemeCSSVariables(function (previous) {
107
+ return _objectSpread(_objectSpread({}, previous), variables);
108
+ });
109
+ }, []);
96
110
  var nestedThemeContext = useMemo(function () {
97
111
  return {
98
112
  isGlobalTheme: false,
99
113
  // The theme that determines the global body styles
100
114
  bodyColor: isGlobalTheme ? theme.colors.text : bodyColor,
101
115
  hasDifferentColorFromGlobalTheme: isGlobalTheme ? false : bodyColor !== theme.colors.text,
102
- colorClassName: /*#__PURE__*/css("label:euiColorMode-", _colorMode, ";color:", theme.colors.text, ";;label:colorClassName;")
116
+ colorClassName: /*#__PURE__*/css("label:euiColorMode-", _colorMode, ";color:", theme.colors.text, ";;label:colorClassName;"),
117
+ setGlobalCSSVariables: isGlobalTheme ? setThemeCSSVariables : setGlobalCSSVariables,
118
+ globalCSSVariables: isGlobalTheme ? themeCSSVariables : globalCSSVariables,
119
+ setNearestThemeCSSVariables: setThemeCSSVariables,
120
+ themeCSSVariables: themeCSSVariables
103
121
  };
104
- }, [theme, isGlobalTheme, bodyColor, _colorMode]);
122
+ }, [theme, isGlobalTheme, bodyColor, _colorMode, setGlobalCSSVariables, globalCSSVariables, setThemeCSSVariables, themeCSSVariables]);
105
123
  var renderedChildren = useMemo(function () {
106
124
  if (isGlobalTheme) {
107
125
  return children; // No wrapper
@@ -114,8 +132,15 @@ export var EuiThemeProvider = function EuiThemeProvider(_ref) {
114
132
  var props = _objectSpread(_objectSpread({}, rest), {}, {
115
133
  className: classNames(className, nestedThemeContext.colorClassName)
116
134
  });
135
+ // Condition avoids rendering an empty Emotion selector if no
136
+ // theme-specific CSS variables have been set by child components
137
+ if (themeCSSVariables) {
138
+ props.css = _objectSpread({
139
+ label: 'euiCSSVariables'
140
+ }, themeCSSVariables);
141
+ }
117
142
  if (cloneElement) {
118
- return /*#__PURE__*/React.cloneElement(children, _objectSpread(_objectSpread({}, props), {}, {
143
+ return cloneElementWithCss(children, _objectSpread(_objectSpread({}, props), {}, {
119
144
  className: classNames(children.props.className, props.className)
120
145
  }));
121
146
  } else {
@@ -123,8 +148,12 @@ export var EuiThemeProvider = function EuiThemeProvider(_ref) {
123
148
  className: classNames('euiThemeProvider', props.className)
124
149
  }), children);
125
150
  }
126
- }, [isGlobalTheme, nestedThemeContext, wrapperProps, children]);
127
- return ___EmotionJSX(EuiColorModeContext.Provider, {
151
+ }, [isGlobalTheme, themeCSSVariables, nestedThemeContext, wrapperProps, children]);
152
+ return ___EmotionJSX(React.Fragment, null, isGlobalTheme && themeCSSVariables && ___EmotionJSX(Global, {
153
+ styles: /*#__PURE__*/_css({
154
+ ':root': themeCSSVariables
155
+ }, ";label:EuiThemeProvider;")
156
+ }), ___EmotionJSX(EuiColorModeContext.Provider, {
128
157
  value: colorMode
129
158
  }, ___EmotionJSX(EuiSystemContext.Provider, {
130
159
  value: system
@@ -134,5 +163,5 @@ export var EuiThemeProvider = function EuiThemeProvider(_ref) {
134
163
  value: theme
135
164
  }, ___EmotionJSX(EuiNestedThemeContext.Provider, {
136
165
  value: nestedThemeContext
137
- }, ___EmotionJSX(EuiEmotionThemeProvider, null, renderedChildren))))));
166
+ }, ___EmotionJSX(EuiEmotionThemeProvider, null, renderedChildren)))))));
138
167
  };
@@ -38,6 +38,7 @@ export var fontBase = {
38
38
  familySerif: 'Georgia, Times, Times New Roman, serif',
39
39
  // Careful using ligatures. Code editors like ACE will often error because of width calculations
40
40
  featureSettings: "'calt' 1, 'kern' 1, 'liga' 1",
41
+ defaultUnits: 'rem',
41
42
  baseline: computed(function (_ref) {
42
43
  var _ref2 = _slicedToArray(_ref, 1),
43
44
  base = _ref2[0];