@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
@@ -0,0 +1,242 @@
1
+ "use strict";
2
+
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
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.EuiTextTruncate = void 0;
8
+ var _react = _interopRequireWildcard(require("react"));
9
+ var _propTypes = _interopRequireDefault(require("prop-types"));
10
+ var _services = require("../../services");
11
+ var _resize_observer = require("../observer/resize_observer");
12
+ var _utils = require("./utils");
13
+ var _text_truncate = require("./text_truncate.styles");
14
+ var _react2 = require("@emotion/react");
15
+ var _excluded = ["width"],
16
+ _excluded2 = ["width", "children", "text", "truncation", "truncationOffset", "truncationPosition", "ellipsis", "containerRef", "measurementRenderAPI"],
17
+ _excluded3 = ["onResize"];
18
+ /*
19
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
20
+ * or more contributor license agreements. Licensed under the Elastic License
21
+ * 2.0 and the Server Side Public License, v 1; you may not use this file except
22
+ * in compliance with, at your election, the Elastic License 2.0 or the Server
23
+ * Side Public License, v 1.
24
+ */
25
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
26
+ 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
+ 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; }
28
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
29
+ 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."); }
30
+ 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); }
31
+ 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; }
32
+ 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; } }
33
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
34
+ 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); }
35
+ 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; }
36
+ 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; }
37
+ var TRUNCATION_TYPES = ['end', 'start', 'startEnd', 'middle'];
38
+ var EuiTextTruncate = function EuiTextTruncate(_ref) {
39
+ var width = _ref.width,
40
+ props = _objectWithoutProperties(_ref, _excluded);
41
+ return width != null ? (0, _react2.jsx)(EuiTextTruncateWithWidth, _extends({
42
+ width: width
43
+ }, props)) : (0, _react2.jsx)(EuiTextTruncateWithResizeObserver, props);
44
+ };
45
+ exports.EuiTextTruncate = EuiTextTruncate;
46
+ EuiTextTruncate.propTypes = {
47
+ className: _propTypes.default.string,
48
+ "aria-label": _propTypes.default.string,
49
+ "data-test-subj": _propTypes.default.string,
50
+ css: _propTypes.default.any,
51
+ /**
52
+ * The full text string to truncate
53
+ */
54
+ text: _propTypes.default.string.isRequired,
55
+ /**
56
+ * The truncation type desired. Determines where the ellipses are placed.
57
+ */
58
+ truncation: _propTypes.default.any,
59
+ /**
60
+ * This prop **only** applies to the `start` and `end` truncation types.
61
+ * It allows preserving a certain number of characters of either the
62
+ * starting or ending text.
63
+ *
64
+ * If the passed offset is greater than the total text length,
65
+ * the offset will be ignored.
66
+ */
67
+ truncationOffset: _propTypes.default.number,
68
+ /**
69
+ * This prop **only** applies to the `startEnd` truncation type.
70
+ * It allows customizing the anchor position of the displayed text,
71
+ * which otherwise defaults to the middle of the text string.
72
+ *
73
+ * The primary use case for this prop for is search highlighting - e.g., if
74
+ * a user searches for a specific word in the text, pass the index of that
75
+ * found word to ensure it is always visible.
76
+ *
77
+ * This behavior will intelligently detect when positions are close to the start
78
+ * or end of the text, and omit leading or trailing ellipses when necessary.
79
+ * If the passed position is greater than the total text length,
80
+ * the truncation will simply default to `start` instead.
81
+ */
82
+ truncationPosition: _propTypes.default.number,
83
+ /**
84
+ * Defaults to the horizontal ellipsis character.
85
+ * Can be optionally configured to use other punctuation,
86
+ * e.g. spaces, brackets, hyphens, asterisks, etc.
87
+ */
88
+ ellipsis: _propTypes.default.string,
89
+ /**
90
+ * By default, EuiTextTruncate will render a resize observer to detect the
91
+ * available width it has. For performance reasons (e.g. multiple truncated
92
+ * text items within the same container), you may opt to pass in your own
93
+ * container width, which will skip initializing a resize observer.
94
+ */
95
+ width: _propTypes.default.number,
96
+ /**
97
+ * Optional callback that fires when the default resizer observer both mounts and
98
+ * registers a size change. This callback will **not** fire if `width` is passed.
99
+ */
100
+ onResize: _propTypes.default.func,
101
+ /**
102
+ * By default, EuiTextTruncate will calculate its truncation via DOM manipulation
103
+ * and measurement, which has the benefit of automatically inheriting font styles.
104
+ * However, if this approach proves to have a significant performance impact for your
105
+ * usage, consider using the `canvas` API instead, which is more performant.
106
+ *
107
+ * Please note that there are minute pixel to subpixel differences between the
108
+ * two options due to different rendering engines.
109
+ */
110
+ measurementRenderAPI: _propTypes.default.oneOf(["dom", "canvas"]),
111
+ /**
112
+ * By default, EuiTextTruncate will render the truncated string directly.
113
+ * You can optionally pass a render prop function to the component, which
114
+ * allows for more flexible text rendering, e.g. adding custom markup
115
+ * or highlighting
116
+ */
117
+ children: _propTypes.default.func
118
+ };
119
+ var EuiTextTruncateWithWidth = function EuiTextTruncateWithWidth(_ref2) {
120
+ var width = _ref2.width,
121
+ children = _ref2.children,
122
+ text = _ref2.text,
123
+ _ref2$truncation = _ref2.truncation,
124
+ _truncation = _ref2$truncation === void 0 ? 'end' : _ref2$truncation,
125
+ _ref2$truncationOffse = _ref2.truncationOffset,
126
+ _truncationOffset = _ref2$truncationOffse === void 0 ? 0 : _ref2$truncationOffse,
127
+ truncationPosition = _ref2.truncationPosition,
128
+ _ref2$ellipsis = _ref2.ellipsis,
129
+ ellipsis = _ref2$ellipsis === void 0 ? '…' : _ref2$ellipsis,
130
+ containerRef = _ref2.containerRef,
131
+ _ref2$measurementRend = _ref2.measurementRenderAPI,
132
+ measurementRenderAPI = _ref2$measurementRend === void 0 ? 'dom' : _ref2$measurementRend,
133
+ rest = _objectWithoutProperties(_ref2, _excluded2);
134
+ // Note: This needs to be a state and not a ref to trigger a rerender on mount
135
+ var _useState = (0, _react.useState)(null),
136
+ _useState2 = _slicedToArray(_useState, 2),
137
+ containerEl = _useState2[0],
138
+ setContainerEl = _useState2[1];
139
+ var refs = (0, _services.useCombinedRefs)([setContainerEl, containerRef]);
140
+
141
+ // Handle exceptions where we need to override the passed props
142
+ var _useMemo = (0, _react.useMemo)(function () {
143
+ var truncation = _truncation;
144
+ var truncationOffset = 0;
145
+ if (_truncation === 'end' || _truncation === 'start') {
146
+ if (0 < _truncationOffset && _truncationOffset < text.length) {
147
+ truncationOffset = _truncationOffset;
148
+ }
149
+ } else if (_truncation === 'startEnd' && truncationPosition != null) {
150
+ if (truncationPosition <= 0) {
151
+ truncation = 'end';
152
+ } else if (truncationPosition >= text.length) {
153
+ truncation = 'start';
154
+ }
155
+ }
156
+ return {
157
+ truncation: truncation,
158
+ truncationOffset: truncationOffset
159
+ };
160
+ }, [_truncation, _truncationOffset, truncationPosition, text.length]),
161
+ truncation = _useMemo.truncation,
162
+ truncationOffset = _useMemo.truncationOffset;
163
+ var truncatedText = (0, _react.useMemo)(function () {
164
+ var truncatedText = '';
165
+ if (!containerEl || !width) return truncatedText;
166
+ var params = {
167
+ fullText: text,
168
+ ellipsis: ellipsis,
169
+ container: containerEl,
170
+ availableWidth: width
171
+ };
172
+ var utils = measurementRenderAPI === 'canvas' ? new _utils.TruncationUtilsWithCanvas(params) : new _utils.TruncationUtilsWithDOM(params);
173
+ if (utils.checkIfTruncationIsNeeded() === false) {
174
+ truncatedText = text;
175
+ } else if (utils.checkSufficientEllipsisWidth(truncation) === false) {
176
+ truncatedText = '';
177
+ } else {
178
+ switch (truncation) {
179
+ case 'end':
180
+ truncatedText = utils.truncateEnd(truncationOffset);
181
+ break;
182
+ case 'start':
183
+ truncatedText = utils.truncateStart(truncationOffset);
184
+ break;
185
+ case 'startEnd':
186
+ if (truncationPosition == null) {
187
+ truncatedText = utils.truncateStartEndAtMiddle();
188
+ } else {
189
+ truncatedText = utils.truncateStartEndAtPosition(truncationPosition);
190
+ }
191
+ break;
192
+ case 'middle':
193
+ truncatedText = utils.truncateMiddle();
194
+ break;
195
+ }
196
+ }
197
+ if (measurementRenderAPI === 'dom') {
198
+ utils.cleanup();
199
+ }
200
+ return truncatedText;
201
+ }, [width, text, truncation, truncationOffset, truncationPosition, ellipsis, containerEl, measurementRenderAPI]);
202
+ var isTruncating = truncatedText !== text;
203
+ return (0, _react2.jsx)("div", _extends({
204
+ css: _text_truncate.euiTextTruncateStyles.euiTextTruncate,
205
+ ref: refs,
206
+ title: isTruncating ? text : undefined
207
+ }, rest), isTruncating ? (0, _react2.jsx)(_react.default.Fragment, null, (0, _react2.jsx)("span", {
208
+ css: _text_truncate.euiTextTruncateStyles.truncatedText,
209
+ "aria-hidden": true,
210
+ "data-test-subj": "truncatedText"
211
+ }, children ? children(truncatedText) : truncatedText), (0, _react2.jsx)("span", {
212
+ css: _text_truncate.euiTextTruncateStyles.fullText,
213
+ "data-test-subj": "fullText"
214
+ }, text)) : (0, _react2.jsx)("span", {
215
+ "data-test-subj": "fullText"
216
+ }, text));
217
+ };
218
+ EuiTextTruncateWithWidth.propTypes = {
219
+ width: _propTypes.default.number.isRequired,
220
+ containerRef: _propTypes.default.any
221
+ };
222
+ var EuiTextTruncateWithResizeObserver = function EuiTextTruncateWithResizeObserver(_ref3) {
223
+ var _onResize = _ref3.onResize,
224
+ props = _objectWithoutProperties(_ref3, _excluded3);
225
+ var _useState3 = (0, _react.useState)(0),
226
+ _useState4 = _slicedToArray(_useState3, 2),
227
+ width = _useState4[0],
228
+ setWidth = _useState4[1];
229
+ var onResize = (0, _react.useCallback)(function (_ref4) {
230
+ var width = _ref4.width;
231
+ setWidth(width);
232
+ _onResize === null || _onResize === void 0 ? void 0 : _onResize(width);
233
+ }, [_onResize]);
234
+ return (0, _react2.jsx)(_resize_observer.EuiResizeObserver, {
235
+ onResize: onResize
236
+ }, function (ref) {
237
+ return (0, _react2.jsx)(EuiTextTruncateWithWidth, _extends({
238
+ width: width,
239
+ containerRef: ref
240
+ }, props));
241
+ });
242
+ };
@@ -0,0 +1,54 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.euiTextTruncateStyles = void 0;
7
+ var _react = require("@emotion/react");
8
+ 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)."; } /*
9
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
10
+ * or more contributor license agreements. Licensed under the Elastic License
11
+ * 2.0 and the Server Side Public License, v 1; you may not use this file except
12
+ * in compliance with, at your election, the Elastic License 2.0 or the Server
13
+ * Side Public License, v 1.
14
+ */
15
+ var euiTextTruncateStyles = {
16
+ euiTextTruncate: process.env.NODE_ENV === "production" ? {
17
+ name: "7o5qnz-euiTextTruncate",
18
+ styles: "position:relative;overflow:hidden;white-space:nowrap;label:euiTextTruncate;"
19
+ } : {
20
+ name: "7o5qnz-euiTextTruncate",
21
+ styles: "position:relative;overflow:hidden;white-space:nowrap;label:euiTextTruncate;",
22
+ toString: _EMOTION_STRINGIFIED_CSS_ERROR__
23
+ },
24
+ /**
25
+ * The below CSS is a hack to get double clicking and selecting the *full* text
26
+ * instead of the truncated text (useful for copying/pasting, and mimics how
27
+ * `text-overflow: ellipsis` works).
28
+ *
29
+ * Real talk: I'm lowkey amazed it works and it wouldn't surprise me if we ran into
30
+ * cross-browser issues with this at some point. Hopefully CSS natively implements
31
+ * custom text truncation some day (https://github.com/w3c/csswg-drafts/issues/3937)
32
+ * and there'll be no need for the entire component at that point 🙏
33
+ */
34
+ // Makes the truncated text unselectable/un-clickable
35
+ truncatedText: process.env.NODE_ENV === "production" ? {
36
+ name: "1dore6v-truncatedText",
37
+ styles: "user-select:none;pointer-events:none;label:truncatedText;"
38
+ } : {
39
+ name: "1dore6v-truncatedText",
40
+ styles: "user-select:none;pointer-events:none;label:truncatedText;",
41
+ toString: _EMOTION_STRINGIFIED_CSS_ERROR__
42
+ },
43
+ // Positions the full text on top of the truncated text (so that clicking targets it)
44
+ // and gives it a color opacity of 0 so that it's not actually visible
45
+ fullText: process.env.NODE_ENV === "production" ? {
46
+ name: "1kxt4rj-fullText",
47
+ styles: "position:absolute;inset:0;overflow:hidden;color:rgba(0, 0, 0, 0);@supports (-webkit-hyphens: none){text-overflow:ellipsis;};label:fullText;"
48
+ } : {
49
+ name: "1kxt4rj-fullText",
50
+ styles: "position:absolute;inset:0;overflow:hidden;color:rgba(0, 0, 0, 0);@supports (-webkit-hyphens: none){text-overflow:ellipsis;};label:fullText;",
51
+ toString: _EMOTION_STRINGIFIED_CSS_ERROR__
52
+ }
53
+ };
54
+ exports.euiTextTruncateStyles = euiTextTruncateStyles;
@@ -0,0 +1,352 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.TruncationUtilsWithDOM = exports.TruncationUtilsWithCanvas = void 0;
7
+ var _excluded = ["container"],
8
+ _excluded2 = ["font", "container"];
9
+ 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); }
10
+ 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; }
11
+ 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; }
12
+ 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); }
13
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
14
+ 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); }; }
15
+ 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); }
16
+ function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
17
+ 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; } }
18
+ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
19
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
20
+ 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."); }
21
+ 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); }
22
+ 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; }
23
+ 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; } }
24
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
25
+ 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); } }
26
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
27
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
28
+ 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; }
29
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
30
+ 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); }
31
+ /*
32
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
33
+ * or more contributor license agreements. Licensed under the Elastic License
34
+ * 2.0 and the Server Side Public License, v 1; you may not use this file except
35
+ * in compliance with, at your election, the Elastic License 2.0 or the Server
36
+ * Side Public License, v 1.
37
+ */
38
+ /**
39
+ * This internal shared/base class contains the actual logic for truncating text
40
+ * (as well as a few handy utilities for checking whether truncation is possible
41
+ * or even necessary).
42
+ *
43
+ * How the underlying mechanism works: the full text is rendered, and then
44
+ * characters are removed one by one until the width of the text fits within
45
+ * the specified available width.
46
+ *
47
+ * Side note: The exception to this is the `truncateStartEndAtPosition` method,
48
+ * which works by building up from an empty string / by adding characters
49
+ * instead of removing them.
50
+ */
51
+ var _TruncationUtils = /*#__PURE__*/_createClass(function _TruncationUtils(_ref) {
52
+ var _this = this;
53
+ var fullText = _ref.fullText,
54
+ ellipsis = _ref.ellipsis,
55
+ availableWidth = _ref.availableWidth;
56
+ _classCallCheck(this, _TruncationUtils);
57
+ _defineProperty(this, "fullText", void 0);
58
+ _defineProperty(this, "ellipsis", void 0);
59
+ _defineProperty(this, "availableWidth", void 0);
60
+ /**
61
+ * Early return checks
62
+ */
63
+ _defineProperty(this, "checkIfTruncationIsNeeded", function () {
64
+ _this.setTextToCheck(_this.fullText);
65
+ if (_this.availableWidth > _this.textWidth) {
66
+ return false;
67
+ }
68
+ });
69
+ _defineProperty(this, "checkSufficientEllipsisWidth", function (truncation) {
70
+ var textToCheck = truncation === 'startEnd' ? "".concat(_this.ellipsis, " ").concat(_this.ellipsis) // startEnd needs a little more space
71
+ : _this.ellipsis;
72
+ _this.setTextToCheck(textToCheck);
73
+ if (_this.textWidth >= _this.availableWidth * 0.9) {
74
+ console.error('The truncation ellipsis is larger than the available width. No text can be rendered.');
75
+ return false;
76
+ }
77
+ });
78
+ _defineProperty(this, "checkTruncationOffsetWidth", function (text) {
79
+ _this.setTextToCheck(text);
80
+ if (_this.textWidth > _this.availableWidth) {
81
+ console.error("The passed truncationOffset is too large for the available width. Truncating the offset instead.");
82
+ return false;
83
+ }
84
+ });
85
+ /**
86
+ * Truncation types logic. This is where the magic happens
87
+ */
88
+ _defineProperty(this, "truncateStart", function (truncationOffset) {
89
+ var truncatedText = _this.fullText;
90
+ var leadingText = '';
91
+ var combinedText = function combinedText() {
92
+ return "".concat(leadingText).concat(truncatedText);
93
+ };
94
+ if (truncationOffset) {
95
+ var _splitText$at = splitText(_this.fullText).at(truncationOffset);
96
+ var _splitText$at2 = _slicedToArray(_splitText$at, 2);
97
+ leadingText = _splitText$at2[0];
98
+ truncatedText = _splitText$at2[1];
99
+ var widthCheck = "".concat(leadingText).concat(_this.ellipsis);
100
+ if (_this.checkTruncationOffsetWidth(widthCheck) === false) {
101
+ truncatedText = leadingText;
102
+ leadingText = '';
103
+ }
104
+ }
105
+ leadingText += _this.ellipsis;
106
+ _this.setTextToCheck(combinedText());
107
+ while (_this.textWidth > _this.availableWidth) {
108
+ truncatedText = removeFirstCharacter(truncatedText);
109
+ _this.setTextToCheck(combinedText());
110
+ }
111
+ return combinedText();
112
+ });
113
+ _defineProperty(this, "truncateEnd", function (truncationOffset) {
114
+ var truncatedText = _this.fullText;
115
+ var trailingText = '';
116
+ var combinedText = function combinedText() {
117
+ return "".concat(truncatedText).concat(trailingText);
118
+ };
119
+ if (truncationOffset) {
120
+ var index = _this.fullText.length - truncationOffset;
121
+ var _splitText$at3 = splitText(_this.fullText).at(index);
122
+ var _splitText$at4 = _slicedToArray(_splitText$at3, 2);
123
+ truncatedText = _splitText$at4[0];
124
+ trailingText = _splitText$at4[1];
125
+ var widthCheck = "".concat(_this.ellipsis).concat(trailingText);
126
+ if (_this.checkTruncationOffsetWidth(widthCheck) === false) {
127
+ truncatedText = trailingText;
128
+ trailingText = '';
129
+ }
130
+ }
131
+ trailingText = _this.ellipsis + trailingText;
132
+ _this.setTextToCheck(combinedText());
133
+ while (_this.textWidth > _this.availableWidth) {
134
+ truncatedText = removeLastCharacter(truncatedText);
135
+ _this.setTextToCheck(combinedText());
136
+ }
137
+ return combinedText();
138
+ });
139
+ _defineProperty(this, "truncateStartEndAtPosition", function (truncationPosition) {
140
+ // If using a non-centered startEnd anchor position, we need to *build*
141
+ // the string from scratch instead of *removing* from the full text string,
142
+ // to make sure we don't go past the beginning or end of the text
143
+ var truncatedText = '';
144
+ _this.setTextToCheck(truncatedText);
145
+
146
+ // Ellipses are conditional - if the anchor is towards the beginning or end,
147
+ // it's possible they shouldn't render
148
+ var startingEllipsis = _this.ellipsis;
149
+ var endingEllipsis = _this.ellipsis;
150
+
151
+ // Split the text into two at the anchor position
152
+ var _splitText$at5 = splitText(_this.fullText).at(truncationPosition),
153
+ _splitText$at6 = _slicedToArray(_splitText$at5, 2),
154
+ firstPart = _splitText$at6[0],
155
+ secondPart = _splitText$at6[1];
156
+ var combinedText = function combinedText() {
157
+ return "".concat(startingEllipsis).concat(truncatedText).concat(endingEllipsis);
158
+ };
159
+ while (_this.textWidth <= _this.availableWidth) {
160
+ if (firstPart.length > 0) {
161
+ truncatedText = "".concat(getLastCharacter(firstPart)).concat(truncatedText);
162
+ firstPart = removeLastCharacter(firstPart);
163
+ } else {
164
+ startingEllipsis = '';
165
+ }
166
+ if (secondPart.length > 0) {
167
+ truncatedText = "".concat(truncatedText).concat(getFirstCharacter(secondPart));
168
+ secondPart = removeFirstCharacter(secondPart);
169
+ } else {
170
+ endingEllipsis = '';
171
+ }
172
+ _this.setTextToCheck(combinedText());
173
+ }
174
+
175
+ // Because this logic builds text outwards vs. removing inwards, the final
176
+ // text width ends up a little larger than the container, and we need to
177
+ // remove the last added character(s)
178
+ if (!startingEllipsis) {
179
+ truncatedText = removeLastCharacter(truncatedText);
180
+ } else if (!endingEllipsis) {
181
+ truncatedText = removeFirstCharacter(truncatedText);
182
+ } else {
183
+ truncatedText = removeFirstAndLastCharacters(truncatedText);
184
+ }
185
+ return combinedText();
186
+ });
187
+ _defineProperty(this, "truncateStartEndAtMiddle", function () {
188
+ var truncatedText = _this.fullText;
189
+ _this.setTextToCheck(truncatedText);
190
+ var combinedText = function combinedText() {
191
+ return "".concat(_this.ellipsis).concat(truncatedText).concat(_this.ellipsis);
192
+ };
193
+ while (_this.textWidth > _this.availableWidth) {
194
+ truncatedText = removeFirstAndLastCharacters(truncatedText);
195
+ _this.setTextToCheck(combinedText());
196
+ }
197
+ return combinedText();
198
+ });
199
+ _defineProperty(this, "truncateMiddle", function () {
200
+ var middlePosition = Math.floor(_this.fullText.length / 2);
201
+ var _splitText$at7 = splitText(_this.fullText).at(middlePosition),
202
+ _splitText$at8 = _slicedToArray(_splitText$at7, 2),
203
+ firstHalf = _splitText$at8[0],
204
+ secondHalf = _splitText$at8[1];
205
+ var trimfirstHalf;
206
+ var combinedText = function combinedText() {
207
+ return "".concat(firstHalf).concat(_this.ellipsis).concat(secondHalf);
208
+ };
209
+ _this.setTextToCheck(combinedText());
210
+ while (_this.textWidth > _this.availableWidth) {
211
+ trimfirstHalf = !trimfirstHalf;
212
+ if (trimfirstHalf) {
213
+ firstHalf = removeLastCharacter(firstHalf);
214
+ } else {
215
+ secondHalf = removeFirstCharacter(secondHalf);
216
+ }
217
+ _this.setTextToCheck(combinedText());
218
+ }
219
+ return combinedText();
220
+ });
221
+ this.fullText = fullText;
222
+ this.ellipsis = ellipsis;
223
+ this.availableWidth = availableWidth;
224
+ }
225
+
226
+ /**
227
+ * Internal measurement utils which will be overridden depending on the
228
+ * rendering approach used (e.g. DOM vs Canvas).
229
+ */);
230
+ /**
231
+ * Creates a temporary vanilla JS DOM element for manipulating text and
232
+ * determining text width.
233
+ *
234
+ * Requires passing in a container element to which the temporary element
235
+ * will be appended. Any CSS/font styles that need to be accounted for should
236
+ * be automatically inherited from the container.
237
+ *
238
+ * NOTE: The consumer is responsible for calling the `cleanup()` method manually
239
+ * to remove the temporary DOM node once their usage of this utility is complete.
240
+ */
241
+ var TruncationUtilsWithDOM = /*#__PURE__*/function (_TruncationUtils2) {
242
+ _inherits(TruncationUtilsWithDOM, _TruncationUtils2);
243
+ var _super = _createSuper(TruncationUtilsWithDOM);
244
+ function TruncationUtilsWithDOM(_ref2) {
245
+ var _this2;
246
+ var container = _ref2.container,
247
+ rest = _objectWithoutProperties(_ref2, _excluded);
248
+ _classCallCheck(this, TruncationUtilsWithDOM);
249
+ _this2 = _super.call(this, rest);
250
+ _defineProperty(_assertThisInitialized(_this2), "container", void 0);
251
+ _defineProperty(_assertThisInitialized(_this2), "span", void 0);
252
+ _defineProperty(_assertThisInitialized(_this2), "setTextToCheck", function (text) {
253
+ _this2.span.textContent = text;
254
+ });
255
+ _defineProperty(_assertThisInitialized(_this2), "cleanup", function () {
256
+ _this2.container.removeChild(_this2.span);
257
+ });
258
+ _this2.container = container;
259
+ _this2.span = document.createElement('span');
260
+ _this2.span.style.position = 'absolute'; // Prevent page reflow/repaint for performance
261
+ _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
262
+ _this2.container.appendChild(_this2.span);
263
+ return _this2;
264
+ }
265
+ _createClass(TruncationUtilsWithDOM, [{
266
+ key: "textWidth",
267
+ get: function get() {
268
+ return this.span.offsetWidth;
269
+ }
270
+ }]);
271
+ return TruncationUtilsWithDOM;
272
+ }(_TruncationUtils);
273
+ /**
274
+ * Creates a temporary Canvas element for manipulating text & determining
275
+ * text width. This method is compatible with charts or other canvas-rendered
276
+ * frameworks, and requires no cleanup method.
277
+ *
278
+ * To accurately measure text, canvas rendering requires either a container to
279
+ * compute/derive font styles from, or a static font string (useful for usage
280
+ * outside the DOM). Particular care should be applied when fallback fonts are
281
+ * used, as more fallback fonts can lead to less precision.
282
+ *
283
+ * Please note that while canvas is more performant than DOM measurement, there
284
+ * are subpixel to single digit pixel differences between DOM and canvas
285
+ * measurement due to the different rendering engines used.
286
+ */
287
+ exports.TruncationUtilsWithDOM = TruncationUtilsWithDOM;
288
+ var TruncationUtilsWithCanvas = /*#__PURE__*/function (_TruncationUtils3) {
289
+ _inherits(TruncationUtilsWithCanvas, _TruncationUtils3);
290
+ var _super2 = _createSuper(TruncationUtilsWithCanvas);
291
+ function TruncationUtilsWithCanvas(_ref3) {
292
+ var _this3;
293
+ var font = _ref3.font,
294
+ container = _ref3.container,
295
+ rest = _objectWithoutProperties(_ref3, _excluded2);
296
+ _classCallCheck(this, TruncationUtilsWithCanvas);
297
+ _this3 = _super2.call(this, rest);
298
+ _defineProperty(_assertThisInitialized(_this3), "context", void 0);
299
+ _defineProperty(_assertThisInitialized(_this3), "currentText", '');
300
+ _defineProperty(_assertThisInitialized(_this3), "computeFontFromElement", function (element) {
301
+ var computedStyles = window.getComputedStyle(element);
302
+ return ['font-style', 'font-variant', 'font-weight', 'font-size', 'font-family'].map(function (prop) {
303
+ return computedStyles.getPropertyValue(prop);
304
+ }).join(' ').trim();
305
+ });
306
+ _defineProperty(_assertThisInitialized(_this3), "setTextToCheck", function (text) {
307
+ _this3.currentText = text;
308
+ });
309
+ _this3.context = document.createElement('canvas').getContext('2d');
310
+
311
+ // Set the canvas font to ensure text width calculations are correct
312
+ if (font) {
313
+ _this3.context.font = font;
314
+ } else if (container) {
315
+ _this3.context.font = _this3.computeFontFromElement(container);
316
+ }
317
+ return _this3;
318
+ }
319
+ _createClass(TruncationUtilsWithCanvas, [{
320
+ key: "textWidth",
321
+ get: function get() {
322
+ return this.context.measureText(this.currentText).width;
323
+ }
324
+ }]);
325
+ return TruncationUtilsWithCanvas;
326
+ }(_TruncationUtils);
327
+ /**
328
+ * DRY character/substring utils
329
+ */
330
+ exports.TruncationUtilsWithCanvas = TruncationUtilsWithCanvas;
331
+ var removeLastCharacter = function removeLastCharacter(text) {
332
+ return text.substring(0, text.length - 1);
333
+ };
334
+ var getLastCharacter = function getLastCharacter(text) {
335
+ return text.substring(text.length - 1);
336
+ };
337
+ var removeFirstCharacter = function removeFirstCharacter(text) {
338
+ return text.substring(1);
339
+ };
340
+ var getFirstCharacter = function getFirstCharacter(text) {
341
+ return text.substring(0, 1);
342
+ };
343
+ var removeFirstAndLastCharacters = function removeFirstAndLastCharacters(text) {
344
+ return text.substring(1, text.length - 1);
345
+ };
346
+ var splitText = function splitText(text) {
347
+ return {
348
+ at: function at(index) {
349
+ return [text.substring(0, index), text.substring(index)];
350
+ }
351
+ };
352
+ };
@@ -29,6 +29,8 @@ var EuiNestedThemeContext = /*#__PURE__*/(0, _react.createContext)({
29
29
  isGlobalTheme: true,
30
30
  hasDifferentColorFromGlobalTheme: false,
31
31
  bodyColor: '',
32
- colorClassName: ''
32
+ colorClassName: '',
33
+ setGlobalCSSVariables: function setGlobalCSSVariables() {},
34
+ setNearestThemeCSSVariables: function setNearestThemeCSSVariables() {}
33
35
  });
34
36
  exports.EuiNestedThemeContext = EuiNestedThemeContext;