@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.
- package/dist/eui_charts_theme.js.map +1 -1
- package/dist/eui_theme_dark.css +9 -36
- package/dist/eui_theme_dark.min.css +1 -1
- package/dist/eui_theme_light.css +9 -36
- package/dist/eui_theme_light.min.css +1 -1
- package/es/components/accordion/accordion.js +34 -9
- package/es/components/accordion/accordion.styles.js +29 -9
- package/es/components/collapsible_nav/collapsible_nav_group/collapsible_nav_group.js +10 -2
- package/es/components/collapsible_nav_beta/collapsible_nav_beta.js +2 -25
- package/es/components/collapsible_nav_beta/collapsible_nav_beta.styles.js +10 -1
- package/es/components/flyout/flyout.styles.js +1 -1
- package/es/components/header/header.js +120 -25
- package/es/components/header/header.styles.js +1 -1
- package/es/components/index.js +1 -0
- package/es/components/overlay_mask/overlay_mask.styles.js +1 -1
- package/es/components/page/page_sidebar/page_sidebar.js +2 -4
- package/es/components/page_template/page_template.js +4 -31
- package/es/components/text_truncate/index.js +10 -0
- package/es/components/text_truncate/text_truncate.js +232 -0
- package/es/components/text_truncate/text_truncate.styles.js +49 -0
- package/es/components/text_truncate/utils.js +348 -0
- package/es/services/theme/context.js +3 -1
- package/es/services/theme/hooks.js +19 -1
- package/es/services/theme/index.js +1 -1
- package/es/services/theme/provider.js +37 -8
- package/eui.d.ts +246 -17
- package/i18ntokens.json +8 -8
- package/lib/components/accordion/accordion.js +33 -8
- package/lib/components/accordion/accordion.styles.js +31 -10
- package/lib/components/collapsible_nav/collapsible_nav_group/collapsible_nav_group.js +10 -2
- package/lib/components/collapsible_nav_beta/collapsible_nav_beta.js +2 -25
- package/lib/components/collapsible_nav_beta/collapsible_nav_beta.styles.js +10 -1
- package/lib/components/flyout/flyout.styles.js +1 -1
- package/lib/components/header/header.js +120 -23
- package/lib/components/header/header.styles.js +1 -1
- package/lib/components/index.js +11 -0
- package/lib/components/overlay_mask/overlay_mask.styles.js +1 -1
- package/lib/components/page/page_sidebar/page_sidebar.js +2 -4
- package/lib/components/page_template/page_template.js +2 -29
- package/lib/components/text_truncate/index.js +25 -0
- package/lib/components/text_truncate/text_truncate.js +242 -0
- package/lib/components/text_truncate/text_truncate.styles.js +54 -0
- package/lib/components/text_truncate/utils.js +352 -0
- package/lib/services/theme/context.js +3 -1
- package/lib/services/theme/hooks.js +21 -2
- package/lib/services/theme/index.js +6 -0
- package/lib/services/theme/provider.js +62 -35
- package/optimize/es/components/accordion/accordion.js +19 -7
- package/optimize/es/components/accordion/accordion.styles.js +29 -9
- package/optimize/es/components/collapsible_nav_beta/collapsible_nav_beta.js +2 -25
- package/optimize/es/components/collapsible_nav_beta/collapsible_nav_beta.styles.js +10 -1
- package/optimize/es/components/flyout/flyout.styles.js +1 -1
- package/optimize/es/components/header/header.js +75 -25
- package/optimize/es/components/header/header.styles.js +1 -1
- package/optimize/es/components/index.js +1 -0
- package/optimize/es/components/overlay_mask/overlay_mask.styles.js +1 -1
- package/optimize/es/components/page/page_sidebar/page_sidebar.js +2 -4
- package/optimize/es/components/page_template/page_template.js +4 -26
- package/optimize/es/components/text_truncate/index.js +10 -0
- package/optimize/es/components/text_truncate/text_truncate.js +148 -0
- package/optimize/es/components/text_truncate/text_truncate.styles.js +49 -0
- package/optimize/es/components/text_truncate/utils.js +337 -0
- package/optimize/es/services/theme/context.js +3 -1
- package/optimize/es/services/theme/hooks.js +19 -1
- package/optimize/es/services/theme/index.js +1 -1
- package/optimize/es/services/theme/provider.js +37 -8
- package/optimize/lib/components/accordion/accordion.js +18 -6
- package/optimize/lib/components/accordion/accordion.styles.js +31 -10
- package/optimize/lib/components/collapsible_nav_beta/collapsible_nav_beta.js +2 -25
- package/optimize/lib/components/collapsible_nav_beta/collapsible_nav_beta.styles.js +10 -1
- package/optimize/lib/components/flyout/flyout.styles.js +1 -1
- package/optimize/lib/components/header/header.js +77 -24
- package/optimize/lib/components/header/header.styles.js +1 -1
- package/optimize/lib/components/index.js +11 -0
- package/optimize/lib/components/overlay_mask/overlay_mask.styles.js +1 -1
- package/optimize/lib/components/page/page_sidebar/page_sidebar.js +2 -4
- package/optimize/lib/components/page_template/page_template.js +2 -24
- package/optimize/lib/components/text_truncate/index.js +25 -0
- package/optimize/lib/components/text_truncate/text_truncate.js +158 -0
- package/optimize/lib/components/text_truncate/text_truncate.styles.js +54 -0
- package/optimize/lib/components/text_truncate/utils.js +342 -0
- package/optimize/lib/services/theme/context.js +3 -1
- package/optimize/lib/services/theme/hooks.js +21 -2
- package/optimize/lib/services/theme/index.js +6 -0
- package/optimize/lib/services/theme/provider.js +62 -35
- package/package.json +1 -1
- package/src/components/datagrid/_data_grid.scss +13 -2
- package/src/components/index.scss +0 -1
- package/src/global_styling/mixins/_header.scss +2 -0
- package/test-env/components/accordion/accordion.js +28 -8
- package/test-env/components/accordion/accordion.styles.js +31 -10
- package/test-env/components/collapsible_nav/collapsible_nav_group/collapsible_nav_group.js +10 -2
- package/test-env/components/collapsible_nav_beta/collapsible_nav_beta.js +2 -25
- package/test-env/components/collapsible_nav_beta/collapsible_nav_beta.styles.js +10 -1
- package/test-env/components/flyout/flyout.styles.js +1 -1
- package/test-env/components/header/header.js +113 -23
- package/test-env/components/header/header.styles.js +1 -1
- package/test-env/components/index.js +11 -0
- package/test-env/components/overlay_mask/overlay_mask.styles.js +1 -1
- package/test-env/components/page/page_sidebar/page_sidebar.js +2 -4
- package/test-env/components/page_template/page_template.js +2 -24
- package/test-env/components/text_truncate/index.js +25 -0
- package/test-env/components/text_truncate/text_truncate.js +236 -0
- package/test-env/components/text_truncate/text_truncate.styles.js +54 -0
- package/test-env/components/text_truncate/utils.js +342 -0
- package/test-env/services/theme/context.js +3 -1
- package/test-env/services/theme/hooks.js +21 -2
- package/test-env/services/theme/index.js +6 -0
- package/test-env/services/theme/provider.js +62 -35
- package/src/components/accordion/_accordion_form.scss +0 -40
- package/src/components/accordion/_index.scss +0 -1
|
@@ -0,0 +1,337 @@
|
|
|
1
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
2
|
+
import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
|
|
3
|
+
import _inherits from "@babel/runtime/helpers/inherits";
|
|
4
|
+
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
5
|
+
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
6
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
7
|
+
import _createClass from "@babel/runtime/helpers/createClass";
|
|
8
|
+
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
9
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
10
|
+
var _excluded = ["container"],
|
|
11
|
+
_excluded2 = ["font", "container"];
|
|
12
|
+
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); }; }
|
|
13
|
+
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; } }
|
|
14
|
+
/*
|
|
15
|
+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
16
|
+
* or more contributor license agreements. Licensed under the Elastic License
|
|
17
|
+
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
|
18
|
+
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
19
|
+
* Side Public License, v 1.
|
|
20
|
+
*/
|
|
21
|
+
/**
|
|
22
|
+
* This internal shared/base class contains the actual logic for truncating text
|
|
23
|
+
* (as well as a few handy utilities for checking whether truncation is possible
|
|
24
|
+
* or even necessary).
|
|
25
|
+
*
|
|
26
|
+
* How the underlying mechanism works: the full text is rendered, and then
|
|
27
|
+
* characters are removed one by one until the width of the text fits within
|
|
28
|
+
* the specified available width.
|
|
29
|
+
*
|
|
30
|
+
* Side note: The exception to this is the `truncateStartEndAtPosition` method,
|
|
31
|
+
* which works by building up from an empty string / by adding characters
|
|
32
|
+
* instead of removing them.
|
|
33
|
+
*/
|
|
34
|
+
var _TruncationUtils = /*#__PURE__*/_createClass(function _TruncationUtils(_ref) {
|
|
35
|
+
var _this = this;
|
|
36
|
+
var fullText = _ref.fullText,
|
|
37
|
+
ellipsis = _ref.ellipsis,
|
|
38
|
+
availableWidth = _ref.availableWidth;
|
|
39
|
+
_classCallCheck(this, _TruncationUtils);
|
|
40
|
+
_defineProperty(this, "fullText", void 0);
|
|
41
|
+
_defineProperty(this, "ellipsis", void 0);
|
|
42
|
+
_defineProperty(this, "availableWidth", void 0);
|
|
43
|
+
/**
|
|
44
|
+
* Early return checks
|
|
45
|
+
*/
|
|
46
|
+
_defineProperty(this, "checkIfTruncationIsNeeded", function () {
|
|
47
|
+
_this.setTextToCheck(_this.fullText);
|
|
48
|
+
if (_this.availableWidth > _this.textWidth) {
|
|
49
|
+
return false;
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
_defineProperty(this, "checkSufficientEllipsisWidth", function (truncation) {
|
|
53
|
+
var textToCheck = truncation === 'startEnd' ? "".concat(_this.ellipsis, " ").concat(_this.ellipsis) // startEnd needs a little more space
|
|
54
|
+
: _this.ellipsis;
|
|
55
|
+
_this.setTextToCheck(textToCheck);
|
|
56
|
+
if (_this.textWidth >= _this.availableWidth * 0.9) {
|
|
57
|
+
console.error('The truncation ellipsis is larger than the available width. No text can be rendered.');
|
|
58
|
+
return false;
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
_defineProperty(this, "checkTruncationOffsetWidth", function (text) {
|
|
62
|
+
_this.setTextToCheck(text);
|
|
63
|
+
if (_this.textWidth > _this.availableWidth) {
|
|
64
|
+
console.error("The passed truncationOffset is too large for the available width. Truncating the offset instead.");
|
|
65
|
+
return false;
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
/**
|
|
69
|
+
* Truncation types logic. This is where the magic happens
|
|
70
|
+
*/
|
|
71
|
+
_defineProperty(this, "truncateStart", function (truncationOffset) {
|
|
72
|
+
var truncatedText = _this.fullText;
|
|
73
|
+
var leadingText = '';
|
|
74
|
+
var combinedText = function combinedText() {
|
|
75
|
+
return "".concat(leadingText).concat(truncatedText);
|
|
76
|
+
};
|
|
77
|
+
if (truncationOffset) {
|
|
78
|
+
var _splitText$at = splitText(_this.fullText).at(truncationOffset);
|
|
79
|
+
var _splitText$at2 = _slicedToArray(_splitText$at, 2);
|
|
80
|
+
leadingText = _splitText$at2[0];
|
|
81
|
+
truncatedText = _splitText$at2[1];
|
|
82
|
+
var widthCheck = "".concat(leadingText).concat(_this.ellipsis);
|
|
83
|
+
if (_this.checkTruncationOffsetWidth(widthCheck) === false) {
|
|
84
|
+
truncatedText = leadingText;
|
|
85
|
+
leadingText = '';
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
leadingText += _this.ellipsis;
|
|
89
|
+
_this.setTextToCheck(combinedText());
|
|
90
|
+
while (_this.textWidth > _this.availableWidth) {
|
|
91
|
+
truncatedText = removeFirstCharacter(truncatedText);
|
|
92
|
+
_this.setTextToCheck(combinedText());
|
|
93
|
+
}
|
|
94
|
+
return combinedText();
|
|
95
|
+
});
|
|
96
|
+
_defineProperty(this, "truncateEnd", function (truncationOffset) {
|
|
97
|
+
var truncatedText = _this.fullText;
|
|
98
|
+
var trailingText = '';
|
|
99
|
+
var combinedText = function combinedText() {
|
|
100
|
+
return "".concat(truncatedText).concat(trailingText);
|
|
101
|
+
};
|
|
102
|
+
if (truncationOffset) {
|
|
103
|
+
var index = _this.fullText.length - truncationOffset;
|
|
104
|
+
var _splitText$at3 = splitText(_this.fullText).at(index);
|
|
105
|
+
var _splitText$at4 = _slicedToArray(_splitText$at3, 2);
|
|
106
|
+
truncatedText = _splitText$at4[0];
|
|
107
|
+
trailingText = _splitText$at4[1];
|
|
108
|
+
var widthCheck = "".concat(_this.ellipsis).concat(trailingText);
|
|
109
|
+
if (_this.checkTruncationOffsetWidth(widthCheck) === false) {
|
|
110
|
+
truncatedText = trailingText;
|
|
111
|
+
trailingText = '';
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
trailingText = _this.ellipsis + trailingText;
|
|
115
|
+
_this.setTextToCheck(combinedText());
|
|
116
|
+
while (_this.textWidth > _this.availableWidth) {
|
|
117
|
+
truncatedText = removeLastCharacter(truncatedText);
|
|
118
|
+
_this.setTextToCheck(combinedText());
|
|
119
|
+
}
|
|
120
|
+
return combinedText();
|
|
121
|
+
});
|
|
122
|
+
_defineProperty(this, "truncateStartEndAtPosition", function (truncationPosition) {
|
|
123
|
+
// If using a non-centered startEnd anchor position, we need to *build*
|
|
124
|
+
// the string from scratch instead of *removing* from the full text string,
|
|
125
|
+
// to make sure we don't go past the beginning or end of the text
|
|
126
|
+
var truncatedText = '';
|
|
127
|
+
_this.setTextToCheck(truncatedText);
|
|
128
|
+
|
|
129
|
+
// Ellipses are conditional - if the anchor is towards the beginning or end,
|
|
130
|
+
// it's possible they shouldn't render
|
|
131
|
+
var startingEllipsis = _this.ellipsis;
|
|
132
|
+
var endingEllipsis = _this.ellipsis;
|
|
133
|
+
|
|
134
|
+
// Split the text into two at the anchor position
|
|
135
|
+
var _splitText$at5 = splitText(_this.fullText).at(truncationPosition),
|
|
136
|
+
_splitText$at6 = _slicedToArray(_splitText$at5, 2),
|
|
137
|
+
firstPart = _splitText$at6[0],
|
|
138
|
+
secondPart = _splitText$at6[1];
|
|
139
|
+
var combinedText = function combinedText() {
|
|
140
|
+
return "".concat(startingEllipsis).concat(truncatedText).concat(endingEllipsis);
|
|
141
|
+
};
|
|
142
|
+
while (_this.textWidth <= _this.availableWidth) {
|
|
143
|
+
if (firstPart.length > 0) {
|
|
144
|
+
truncatedText = "".concat(getLastCharacter(firstPart)).concat(truncatedText);
|
|
145
|
+
firstPart = removeLastCharacter(firstPart);
|
|
146
|
+
} else {
|
|
147
|
+
startingEllipsis = '';
|
|
148
|
+
}
|
|
149
|
+
if (secondPart.length > 0) {
|
|
150
|
+
truncatedText = "".concat(truncatedText).concat(getFirstCharacter(secondPart));
|
|
151
|
+
secondPart = removeFirstCharacter(secondPart);
|
|
152
|
+
} else {
|
|
153
|
+
endingEllipsis = '';
|
|
154
|
+
}
|
|
155
|
+
_this.setTextToCheck(combinedText());
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
// Because this logic builds text outwards vs. removing inwards, the final
|
|
159
|
+
// text width ends up a little larger than the container, and we need to
|
|
160
|
+
// remove the last added character(s)
|
|
161
|
+
if (!startingEllipsis) {
|
|
162
|
+
truncatedText = removeLastCharacter(truncatedText);
|
|
163
|
+
} else if (!endingEllipsis) {
|
|
164
|
+
truncatedText = removeFirstCharacter(truncatedText);
|
|
165
|
+
} else {
|
|
166
|
+
truncatedText = removeFirstAndLastCharacters(truncatedText);
|
|
167
|
+
}
|
|
168
|
+
return combinedText();
|
|
169
|
+
});
|
|
170
|
+
_defineProperty(this, "truncateStartEndAtMiddle", function () {
|
|
171
|
+
var truncatedText = _this.fullText;
|
|
172
|
+
_this.setTextToCheck(truncatedText);
|
|
173
|
+
var combinedText = function combinedText() {
|
|
174
|
+
return "".concat(_this.ellipsis).concat(truncatedText).concat(_this.ellipsis);
|
|
175
|
+
};
|
|
176
|
+
while (_this.textWidth > _this.availableWidth) {
|
|
177
|
+
truncatedText = removeFirstAndLastCharacters(truncatedText);
|
|
178
|
+
_this.setTextToCheck(combinedText());
|
|
179
|
+
}
|
|
180
|
+
return combinedText();
|
|
181
|
+
});
|
|
182
|
+
_defineProperty(this, "truncateMiddle", function () {
|
|
183
|
+
var middlePosition = Math.floor(_this.fullText.length / 2);
|
|
184
|
+
var _splitText$at7 = splitText(_this.fullText).at(middlePosition),
|
|
185
|
+
_splitText$at8 = _slicedToArray(_splitText$at7, 2),
|
|
186
|
+
firstHalf = _splitText$at8[0],
|
|
187
|
+
secondHalf = _splitText$at8[1];
|
|
188
|
+
var trimfirstHalf;
|
|
189
|
+
var combinedText = function combinedText() {
|
|
190
|
+
return "".concat(firstHalf).concat(_this.ellipsis).concat(secondHalf);
|
|
191
|
+
};
|
|
192
|
+
_this.setTextToCheck(combinedText());
|
|
193
|
+
while (_this.textWidth > _this.availableWidth) {
|
|
194
|
+
trimfirstHalf = !trimfirstHalf;
|
|
195
|
+
if (trimfirstHalf) {
|
|
196
|
+
firstHalf = removeLastCharacter(firstHalf);
|
|
197
|
+
} else {
|
|
198
|
+
secondHalf = removeFirstCharacter(secondHalf);
|
|
199
|
+
}
|
|
200
|
+
_this.setTextToCheck(combinedText());
|
|
201
|
+
}
|
|
202
|
+
return combinedText();
|
|
203
|
+
});
|
|
204
|
+
this.fullText = fullText;
|
|
205
|
+
this.ellipsis = ellipsis;
|
|
206
|
+
this.availableWidth = availableWidth;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
/**
|
|
210
|
+
* Internal measurement utils which will be overridden depending on the
|
|
211
|
+
* rendering approach used (e.g. DOM vs Canvas).
|
|
212
|
+
*/);
|
|
213
|
+
/**
|
|
214
|
+
* Creates a temporary vanilla JS DOM element for manipulating text and
|
|
215
|
+
* determining text width.
|
|
216
|
+
*
|
|
217
|
+
* Requires passing in a container element to which the temporary element
|
|
218
|
+
* will be appended. Any CSS/font styles that need to be accounted for should
|
|
219
|
+
* be automatically inherited from the container.
|
|
220
|
+
*
|
|
221
|
+
* NOTE: The consumer is responsible for calling the `cleanup()` method manually
|
|
222
|
+
* to remove the temporary DOM node once their usage of this utility is complete.
|
|
223
|
+
*/
|
|
224
|
+
|
|
225
|
+
export var TruncationUtilsWithDOM = /*#__PURE__*/function (_TruncationUtils2) {
|
|
226
|
+
_inherits(TruncationUtilsWithDOM, _TruncationUtils2);
|
|
227
|
+
var _super = _createSuper(TruncationUtilsWithDOM);
|
|
228
|
+
function TruncationUtilsWithDOM(_ref2) {
|
|
229
|
+
var _this2;
|
|
230
|
+
var container = _ref2.container,
|
|
231
|
+
rest = _objectWithoutProperties(_ref2, _excluded);
|
|
232
|
+
_classCallCheck(this, TruncationUtilsWithDOM);
|
|
233
|
+
_this2 = _super.call(this, rest);
|
|
234
|
+
_defineProperty(_assertThisInitialized(_this2), "container", void 0);
|
|
235
|
+
_defineProperty(_assertThisInitialized(_this2), "span", void 0);
|
|
236
|
+
_defineProperty(_assertThisInitialized(_this2), "setTextToCheck", function (text) {
|
|
237
|
+
_this2.span.textContent = text;
|
|
238
|
+
});
|
|
239
|
+
_defineProperty(_assertThisInitialized(_this2), "cleanup", function () {
|
|
240
|
+
_this2.container.removeChild(_this2.span);
|
|
241
|
+
});
|
|
242
|
+
_this2.container = container;
|
|
243
|
+
_this2.span = document.createElement('span');
|
|
244
|
+
_this2.span.style.position = 'absolute'; // Prevent page reflow/repaint for performance
|
|
245
|
+
_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
|
|
246
|
+
_this2.container.appendChild(_this2.span);
|
|
247
|
+
return _this2;
|
|
248
|
+
}
|
|
249
|
+
_createClass(TruncationUtilsWithDOM, [{
|
|
250
|
+
key: "textWidth",
|
|
251
|
+
get: function get() {
|
|
252
|
+
return this.span.offsetWidth;
|
|
253
|
+
}
|
|
254
|
+
}]);
|
|
255
|
+
return TruncationUtilsWithDOM;
|
|
256
|
+
}(_TruncationUtils);
|
|
257
|
+
|
|
258
|
+
/**
|
|
259
|
+
* Creates a temporary Canvas element for manipulating text & determining
|
|
260
|
+
* text width. This method is compatible with charts or other canvas-rendered
|
|
261
|
+
* frameworks, and requires no cleanup method.
|
|
262
|
+
*
|
|
263
|
+
* To accurately measure text, canvas rendering requires either a container to
|
|
264
|
+
* compute/derive font styles from, or a static font string (useful for usage
|
|
265
|
+
* outside the DOM). Particular care should be applied when fallback fonts are
|
|
266
|
+
* used, as more fallback fonts can lead to less precision.
|
|
267
|
+
*
|
|
268
|
+
* Please note that while canvas is more performant than DOM measurement, there
|
|
269
|
+
* are subpixel to single digit pixel differences between DOM and canvas
|
|
270
|
+
* measurement due to the different rendering engines used.
|
|
271
|
+
*/
|
|
272
|
+
export var TruncationUtilsWithCanvas = /*#__PURE__*/function (_TruncationUtils3) {
|
|
273
|
+
_inherits(TruncationUtilsWithCanvas, _TruncationUtils3);
|
|
274
|
+
var _super2 = _createSuper(TruncationUtilsWithCanvas);
|
|
275
|
+
function TruncationUtilsWithCanvas(_ref3) {
|
|
276
|
+
var _this3;
|
|
277
|
+
var font = _ref3.font,
|
|
278
|
+
container = _ref3.container,
|
|
279
|
+
rest = _objectWithoutProperties(_ref3, _excluded2);
|
|
280
|
+
_classCallCheck(this, TruncationUtilsWithCanvas);
|
|
281
|
+
_this3 = _super2.call(this, rest);
|
|
282
|
+
_defineProperty(_assertThisInitialized(_this3), "context", void 0);
|
|
283
|
+
_defineProperty(_assertThisInitialized(_this3), "currentText", '');
|
|
284
|
+
_defineProperty(_assertThisInitialized(_this3), "computeFontFromElement", function (element) {
|
|
285
|
+
var computedStyles = window.getComputedStyle(element);
|
|
286
|
+
return ['font-style', 'font-variant', 'font-weight', 'font-size', 'font-family'].map(function (prop) {
|
|
287
|
+
return computedStyles.getPropertyValue(prop);
|
|
288
|
+
}).join(' ').trim();
|
|
289
|
+
});
|
|
290
|
+
_defineProperty(_assertThisInitialized(_this3), "setTextToCheck", function (text) {
|
|
291
|
+
_this3.currentText = text;
|
|
292
|
+
});
|
|
293
|
+
_this3.context = document.createElement('canvas').getContext('2d');
|
|
294
|
+
|
|
295
|
+
// Set the canvas font to ensure text width calculations are correct
|
|
296
|
+
if (font) {
|
|
297
|
+
_this3.context.font = font;
|
|
298
|
+
} else if (container) {
|
|
299
|
+
_this3.context.font = _this3.computeFontFromElement(container);
|
|
300
|
+
}
|
|
301
|
+
return _this3;
|
|
302
|
+
}
|
|
303
|
+
_createClass(TruncationUtilsWithCanvas, [{
|
|
304
|
+
key: "textWidth",
|
|
305
|
+
get: function get() {
|
|
306
|
+
return this.context.measureText(this.currentText).width;
|
|
307
|
+
}
|
|
308
|
+
}]);
|
|
309
|
+
return TruncationUtilsWithCanvas;
|
|
310
|
+
}(_TruncationUtils);
|
|
311
|
+
|
|
312
|
+
/**
|
|
313
|
+
* DRY character/substring utils
|
|
314
|
+
*/
|
|
315
|
+
|
|
316
|
+
var removeLastCharacter = function removeLastCharacter(text) {
|
|
317
|
+
return text.substring(0, text.length - 1);
|
|
318
|
+
};
|
|
319
|
+
var getLastCharacter = function getLastCharacter(text) {
|
|
320
|
+
return text.substring(text.length - 1);
|
|
321
|
+
};
|
|
322
|
+
var removeFirstCharacter = function removeFirstCharacter(text) {
|
|
323
|
+
return text.substring(1);
|
|
324
|
+
};
|
|
325
|
+
var getFirstCharacter = function getFirstCharacter(text) {
|
|
326
|
+
return text.substring(0, 1);
|
|
327
|
+
};
|
|
328
|
+
var removeFirstAndLastCharacters = function removeFirstAndLastCharacters(text) {
|
|
329
|
+
return text.substring(1, text.length - 1);
|
|
330
|
+
};
|
|
331
|
+
var splitText = function splitText(text) {
|
|
332
|
+
return {
|
|
333
|
+
at: function at(index) {
|
|
334
|
+
return [text.substring(0, index), text.substring(index)];
|
|
335
|
+
}
|
|
336
|
+
};
|
|
337
|
+
};
|
|
@@ -18,5 +18,7 @@ export var EuiNestedThemeContext = /*#__PURE__*/createContext({
|
|
|
18
18
|
isGlobalTheme: true,
|
|
19
19
|
hasDifferentColorFromGlobalTheme: false,
|
|
20
20
|
bodyColor: '',
|
|
21
|
-
colorClassName: ''
|
|
21
|
+
colorClassName: '',
|
|
22
|
+
setGlobalCSSVariables: function setGlobalCSSVariables() {},
|
|
23
|
+
setNearestThemeCSSVariables: function setNearestThemeCSSVariables() {}
|
|
22
24
|
});
|
|
@@ -8,7 +8,7 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
import React, { forwardRef, useContext, useMemo } from 'react';
|
|
11
|
-
import { EuiThemeContext, EuiModificationsContext, EuiColorModeContext, defaultComputedTheme } from './context';
|
|
11
|
+
import { EuiThemeContext, EuiModificationsContext, EuiColorModeContext, defaultComputedTheme, EuiNestedThemeContext } from './context';
|
|
12
12
|
import { emitEuiProviderWarning } from './warning';
|
|
13
13
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
14
14
|
var providerMessage = "`EuiProvider` is missing which can result in negative effects.\nWrap your component in `EuiProvider`: https://ela.st/euiprovider.";
|
|
@@ -63,4 +63,22 @@ export var RenderWithEuiTheme = function RenderWithEuiTheme(_ref) {
|
|
|
63
63
|
var children = _ref.children;
|
|
64
64
|
var theme = useEuiTheme();
|
|
65
65
|
return children(theme);
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Minor syntactical sugar hook for theme CSS variables.
|
|
70
|
+
* Primarily meant for internal EUI usage.
|
|
71
|
+
*/
|
|
72
|
+
export var useEuiThemeCSSVariables = function useEuiThemeCSSVariables() {
|
|
73
|
+
var _useContext = useContext(EuiNestedThemeContext),
|
|
74
|
+
setGlobalCSSVariables = _useContext.setGlobalCSSVariables,
|
|
75
|
+
globalCSSVariables = _useContext.globalCSSVariables,
|
|
76
|
+
setNearestThemeCSSVariables = _useContext.setNearestThemeCSSVariables,
|
|
77
|
+
themeCSSVariables = _useContext.themeCSSVariables;
|
|
78
|
+
return {
|
|
79
|
+
setGlobalCSSVariables: setGlobalCSSVariables,
|
|
80
|
+
globalCSSVariables: globalCSSVariables,
|
|
81
|
+
setNearestThemeCSSVariables: setNearestThemeCSSVariables,
|
|
82
|
+
themeCSSVariables: themeCSSVariables
|
|
83
|
+
};
|
|
66
84
|
};
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
export { EuiSystemContext, EuiThemeContext, EuiNestedThemeContext, EuiModificationsContext, EuiColorModeContext } from './context';
|
|
10
|
-
export { useEuiTheme, withEuiTheme, RenderWithEuiTheme } from './hooks';
|
|
10
|
+
export { useEuiTheme, withEuiTheme, RenderWithEuiTheme, useEuiThemeCSSVariables } from './hooks';
|
|
11
11
|
export { EuiThemeProvider } from './provider';
|
|
12
12
|
export { getEuiDevProviderWarning, setEuiDevProviderWarning } from './warning';
|
|
13
13
|
export { buildTheme, computed, isInverseColorMode, getColorMode, getComputed, getOn, mergeDeep, setOn, Computed } from './utils';
|
|
@@ -2,6 +2,7 @@ import _extends from "@babel/runtime/helpers/extends";
|
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
3
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
4
4
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
5
|
+
import { css as _css } from "@emotion/react";
|
|
5
6
|
var _excluded = ["cloneElement", "className"];
|
|
6
7
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
7
8
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
@@ -13,10 +14,12 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
13
14
|
* Side Public License, v 1.
|
|
14
15
|
*/
|
|
15
16
|
|
|
16
|
-
import React, { useContext, useEffect, useRef, useMemo, useState } from 'react';
|
|
17
|
+
import React, { useContext, useEffect, useRef, useMemo, useState, useCallback } from 'react';
|
|
17
18
|
import classNames from 'classnames';
|
|
18
19
|
import { css } from '@emotion/css';
|
|
20
|
+
import { Global } from '@emotion/react';
|
|
19
21
|
import isEqual from 'lodash/isEqual';
|
|
22
|
+
import { cloneElementWithCss } from '../emotion';
|
|
20
23
|
import { EuiSystemContext, EuiThemeContext, EuiNestedThemeContext, EuiModificationsContext, EuiColorModeContext } from './context';
|
|
21
24
|
import { EuiEmotionThemeProvider } from './emotion';
|
|
22
25
|
import { buildTheme, getColorMode, getComputed, mergeDeep } from './utils';
|
|
@@ -29,7 +32,9 @@ export var EuiThemeProvider = function EuiThemeProvider(_ref) {
|
|
|
29
32
|
wrapperProps = _ref.wrapperProps;
|
|
30
33
|
var _useContext = useContext(EuiNestedThemeContext),
|
|
31
34
|
isGlobalTheme = _useContext.isGlobalTheme,
|
|
32
|
-
bodyColor = _useContext.bodyColor
|
|
35
|
+
bodyColor = _useContext.bodyColor,
|
|
36
|
+
globalCSSVariables = _useContext.globalCSSVariables,
|
|
37
|
+
setGlobalCSSVariables = _useContext.setGlobalCSSVariables;
|
|
33
38
|
var parentSystem = useContext(EuiSystemContext);
|
|
34
39
|
var parentModifications = useContext(EuiModificationsContext);
|
|
35
40
|
var parentColorMode = useContext(EuiColorModeContext);
|
|
@@ -84,15 +89,28 @@ export var EuiThemeProvider = function EuiThemeProvider(_ref) {
|
|
|
84
89
|
setTheme(getComputed(system, buildTheme(modifications, "_".concat(system.key)), colorMode));
|
|
85
90
|
}
|
|
86
91
|
}, [colorMode, system, modifications]);
|
|
92
|
+
var _useState9 = useState(),
|
|
93
|
+
_useState10 = _slicedToArray(_useState9, 2),
|
|
94
|
+
themeCSSVariables = _useState10[0],
|
|
95
|
+
_setThemeCSSVariables = _useState10[1];
|
|
96
|
+
var setThemeCSSVariables = useCallback(function (variables) {
|
|
97
|
+
return _setThemeCSSVariables(function (previous) {
|
|
98
|
+
return _objectSpread(_objectSpread({}, previous), variables);
|
|
99
|
+
});
|
|
100
|
+
}, []);
|
|
87
101
|
var nestedThemeContext = useMemo(function () {
|
|
88
102
|
return {
|
|
89
103
|
isGlobalTheme: false,
|
|
90
104
|
// The theme that determines the global body styles
|
|
91
105
|
bodyColor: isGlobalTheme ? theme.colors.text : bodyColor,
|
|
92
106
|
hasDifferentColorFromGlobalTheme: isGlobalTheme ? false : bodyColor !== theme.colors.text,
|
|
93
|
-
colorClassName: /*#__PURE__*/css("label:euiColorMode-", _colorMode, ";color:", theme.colors.text, ";;label:colorClassName;")
|
|
107
|
+
colorClassName: /*#__PURE__*/css("label:euiColorMode-", _colorMode, ";color:", theme.colors.text, ";;label:colorClassName;"),
|
|
108
|
+
setGlobalCSSVariables: isGlobalTheme ? setThemeCSSVariables : setGlobalCSSVariables,
|
|
109
|
+
globalCSSVariables: isGlobalTheme ? themeCSSVariables : globalCSSVariables,
|
|
110
|
+
setNearestThemeCSSVariables: setThemeCSSVariables,
|
|
111
|
+
themeCSSVariables: themeCSSVariables
|
|
94
112
|
};
|
|
95
|
-
}, [theme, isGlobalTheme, bodyColor, _colorMode]);
|
|
113
|
+
}, [theme, isGlobalTheme, bodyColor, _colorMode, setGlobalCSSVariables, globalCSSVariables, setThemeCSSVariables, themeCSSVariables]);
|
|
96
114
|
var renderedChildren = useMemo(function () {
|
|
97
115
|
if (isGlobalTheme) {
|
|
98
116
|
return children; // No wrapper
|
|
@@ -105,8 +123,15 @@ export var EuiThemeProvider = function EuiThemeProvider(_ref) {
|
|
|
105
123
|
var props = _objectSpread(_objectSpread({}, rest), {}, {
|
|
106
124
|
className: classNames(className, nestedThemeContext.colorClassName)
|
|
107
125
|
});
|
|
126
|
+
// Condition avoids rendering an empty Emotion selector if no
|
|
127
|
+
// theme-specific CSS variables have been set by child components
|
|
128
|
+
if (themeCSSVariables) {
|
|
129
|
+
props.css = _objectSpread({
|
|
130
|
+
label: 'euiCSSVariables'
|
|
131
|
+
}, themeCSSVariables);
|
|
132
|
+
}
|
|
108
133
|
if (cloneElement) {
|
|
109
|
-
return
|
|
134
|
+
return cloneElementWithCss(children, _objectSpread(_objectSpread({}, props), {}, {
|
|
110
135
|
className: classNames(children.props.className, props.className)
|
|
111
136
|
}));
|
|
112
137
|
} else {
|
|
@@ -114,8 +139,12 @@ export var EuiThemeProvider = function EuiThemeProvider(_ref) {
|
|
|
114
139
|
className: classNames('euiThemeProvider', props.className)
|
|
115
140
|
}), children);
|
|
116
141
|
}
|
|
117
|
-
}, [isGlobalTheme, nestedThemeContext, wrapperProps, children]);
|
|
118
|
-
return ___EmotionJSX(
|
|
142
|
+
}, [isGlobalTheme, themeCSSVariables, nestedThemeContext, wrapperProps, children]);
|
|
143
|
+
return ___EmotionJSX(React.Fragment, null, isGlobalTheme && themeCSSVariables && ___EmotionJSX(Global, {
|
|
144
|
+
styles: /*#__PURE__*/_css({
|
|
145
|
+
':root': themeCSSVariables
|
|
146
|
+
}, ";label:EuiThemeProvider;")
|
|
147
|
+
}), ___EmotionJSX(EuiColorModeContext.Provider, {
|
|
119
148
|
value: colorMode
|
|
120
149
|
}, ___EmotionJSX(EuiSystemContext.Provider, {
|
|
121
150
|
value: system
|
|
@@ -125,5 +154,5 @@ export var EuiThemeProvider = function EuiThemeProvider(_ref) {
|
|
|
125
154
|
value: theme
|
|
126
155
|
}, ___EmotionJSX(EuiNestedThemeContext.Provider, {
|
|
127
156
|
value: nestedThemeContext
|
|
128
|
-
}, ___EmotionJSX(EuiEmotionThemeProvider, null, renderedChildren))))));
|
|
157
|
+
}, ___EmotionJSX(EuiEmotionThemeProvider, null, renderedChildren)))))));
|
|
129
158
|
};
|
|
@@ -7,6 +7,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
});
|
|
8
8
|
exports.PADDING_SIZES = exports.EuiAccordionClass = exports.EuiAccordion = void 0;
|
|
9
9
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
10
|
+
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
10
11
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
11
12
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
12
13
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
@@ -27,7 +28,8 @@ var _button = require("../button");
|
|
|
27
28
|
var _accordion = require("./accordion.styles");
|
|
28
29
|
var _global_styling = require("../../global_styling");
|
|
29
30
|
var _react2 = require("@emotion/react");
|
|
30
|
-
var _excluded = ["children", "buttonContent", "className", "id", "element", "buttonClassName", "buttonContentClassName", "extraAction", "paddingSize", "initialIsOpen", "arrowDisplay", "forceState", "isLoading", "isLoadingMessage", "isDisabled", "buttonProps", "buttonElement", "arrowProps", "theme"]
|
|
31
|
+
var _excluded = ["children", "buttonContent", "className", "id", "element", "buttonClassName", "buttonContentClassName", "extraAction", "paddingSize", "borders", "initialIsOpen", "arrowDisplay", "forceState", "isLoading", "isLoadingMessage", "isDisabled", "buttonProps", "buttonElement", "arrowProps", "theme"],
|
|
32
|
+
_excluded2 = ["paddingSize", "className", "css"];
|
|
31
33
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
32
34
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
33
35
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
|
|
@@ -165,18 +167,24 @@ var EuiAccordionClass = /*#__PURE__*/function (_Component) {
|
|
|
165
167
|
buttonContentClassName = _this$props3.buttonContentClassName,
|
|
166
168
|
extraAction = _this$props3.extraAction,
|
|
167
169
|
paddingSize = _this$props3.paddingSize,
|
|
170
|
+
borders = _this$props3.borders,
|
|
168
171
|
initialIsOpen = _this$props3.initialIsOpen,
|
|
169
172
|
arrowDisplay = _this$props3.arrowDisplay,
|
|
170
173
|
forceState = _this$props3.forceState,
|
|
171
174
|
isLoading = _this$props3.isLoading,
|
|
172
175
|
isLoadingMessage = _this$props3.isLoadingMessage,
|
|
173
176
|
isDisabled = _this$props3.isDisabled,
|
|
174
|
-
|
|
177
|
+
_buttonProps = _this$props3.buttonProps,
|
|
175
178
|
_this$props3$buttonEl = _this$props3.buttonElement,
|
|
176
179
|
_ButtonElement = _this$props3$buttonEl === void 0 ? 'button' : _this$props3$buttonEl,
|
|
177
180
|
arrowProps = _this$props3.arrowProps,
|
|
178
181
|
theme = _this$props3.theme,
|
|
179
182
|
rest = (0, _objectWithoutProperties2.default)(_this$props3, _excluded);
|
|
183
|
+
var _ref = _buttonProps || {},
|
|
184
|
+
buttonPaddingSize = _ref.paddingSize,
|
|
185
|
+
buttonPropsClassName = _ref.className,
|
|
186
|
+
buttonPropsCss = _ref.css,
|
|
187
|
+
buttonProps = (0, _objectWithoutProperties2.default)(_ref, _excluded2);
|
|
180
188
|
|
|
181
189
|
// Force button element to be a legend if the element is a fieldset
|
|
182
190
|
var ButtonElement = Element === 'fieldset' ? 'legend' : _ButtonElement;
|
|
@@ -187,10 +195,12 @@ var EuiAccordionClass = /*#__PURE__*/function (_Component) {
|
|
|
187
195
|
var classes = (0, _classnames.default)('euiAccordion', {
|
|
188
196
|
'euiAccordion-isOpen': this.isOpen
|
|
189
197
|
}, className);
|
|
198
|
+
var styles = (0, _accordion.euiAccordionStyles)(theme);
|
|
199
|
+
var cssStyles = [styles.euiAccordion, borders !== 'none' && styles.borders.borders, borders !== 'none' && styles.borders[borders]];
|
|
190
200
|
var childrenClasses = (0, _classnames.default)('euiAccordion__children', {
|
|
191
201
|
'euiAccordion__children-isLoading': isLoading
|
|
192
202
|
});
|
|
193
|
-
var buttonClasses = (0, _classnames.default)('euiAccordion__button', buttonClassName,
|
|
203
|
+
var buttonClasses = (0, _classnames.default)('euiAccordion__button', buttonClassName, buttonPropsClassName);
|
|
194
204
|
var buttonContentClasses = (0, _classnames.default)('euiAccordion__buttonContent', buttonContentClassName);
|
|
195
205
|
var iconButtonClasses = (0, _classnames.default)('euiAccordion__iconButton', {
|
|
196
206
|
'euiAccordion__iconButton-isOpen': this.isOpen,
|
|
@@ -199,7 +209,7 @@ var EuiAccordionClass = /*#__PURE__*/function (_Component) {
|
|
|
199
209
|
|
|
200
210
|
// Emotion styles
|
|
201
211
|
var buttonStyles = (0, _accordion.euiAccordionButtonStyles)(theme);
|
|
202
|
-
var cssButtonStyles = [buttonStyles.euiAccordion__button, isDisabled && buttonStyles.disabled,
|
|
212
|
+
var cssButtonStyles = [buttonStyles.euiAccordion__button, isDisabled && buttonStyles.disabled].concat((0, _toConsumableArray2.default)(buttonPaddingSize ? [buttonStyles[buttonPaddingSize], arrowDisplay === 'left' && buttonStyles.arrowLeft, arrowDisplay === 'right' && buttonStyles.arrowRight] : []), [buttonPropsCss]);
|
|
203
213
|
var childrenStyles = (0, _accordion.euiAccordionChildrenStyles)(theme);
|
|
204
214
|
var cssChildrenStyles = [childrenStyles.euiAccordion__children, isLoading && childrenStyles.isLoading, paddingSize && paddingSize !== 'none' && childrenStyles[paddingSize]];
|
|
205
215
|
var childWrapperStyles = (0, _accordion.euiAccordionChildWrapperStyles)(theme);
|
|
@@ -213,7 +223,7 @@ var EuiAccordionClass = /*#__PURE__*/function (_Component) {
|
|
|
213
223
|
var triggerWrapperStyles = (0, _accordion.euiAccordionTriggerWrapperStyles)();
|
|
214
224
|
var cssTriggerWrapperStyles = [triggerWrapperStyles.euiAccordion__triggerWrapper];
|
|
215
225
|
var iconButton;
|
|
216
|
-
var buttonId = (_buttonProps$id = buttonProps
|
|
226
|
+
var buttonId = (_buttonProps$id = buttonProps.id) !== null && _buttonProps$id !== void 0 ? _buttonProps$id : this.generatedId;
|
|
217
227
|
if (_arrowDisplay !== 'none') {
|
|
218
228
|
iconButton = (0, _react2.jsx)(_button.EuiButtonIcon, (0, _extends2.default)({
|
|
219
229
|
color: "text"
|
|
@@ -265,7 +275,8 @@ var EuiAccordionClass = /*#__PURE__*/function (_Component) {
|
|
|
265
275
|
className: buttonContentClasses
|
|
266
276
|
}, buttonContent));
|
|
267
277
|
return (0, _react2.jsx)(Element, (0, _extends2.default)({
|
|
268
|
-
className: classes
|
|
278
|
+
className: classes,
|
|
279
|
+
css: cssStyles
|
|
269
280
|
}, rest), (0, _react2.jsx)("div", {
|
|
270
281
|
className: "euiAccordion__triggerWrapper",
|
|
271
282
|
css: cssTriggerWrapperStyles
|
|
@@ -297,6 +308,7 @@ var EuiAccordionClass = /*#__PURE__*/function (_Component) {
|
|
|
297
308
|
exports.EuiAccordionClass = EuiAccordionClass;
|
|
298
309
|
(0, _defineProperty2.default)(EuiAccordionClass, "defaultProps", {
|
|
299
310
|
initialIsOpen: false,
|
|
311
|
+
borders: 'none',
|
|
300
312
|
paddingSize: 'none',
|
|
301
313
|
arrowDisplay: 'left',
|
|
302
314
|
isLoading: false,
|