@elastic/eui 73.0.0 → 74.0.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_theme_dark.css +0 -55
- package/dist/eui_theme_dark.min.css +1 -1
- package/dist/eui_theme_light.css +0 -55
- package/dist/eui_theme_light.min.css +1 -1
- package/es/components/basic_table/basic_table.js +56 -101
- package/es/components/basic_table/basic_table.styles.js +45 -0
- package/es/components/modal/confirm_modal.js +5 -3
- package/es/components/modal/modal.a11y.js +1 -1
- package/es/components/modal/modal_header_title.js +12 -3
- package/es/components/resizable_container/resizable_panel.js +5 -0
- package/es/services/security/get_secure_rel_for_target.js +2 -8
- package/es/services/theme/hooks.js +18 -0
- package/es/services/theme/index.js +1 -1
- package/eui.d.ts +46 -19
- package/i18ntokens.json +18 -18
- package/lib/components/basic_table/basic_table.js +56 -100
- package/lib/components/basic_table/basic_table.styles.js +54 -0
- package/lib/components/modal/confirm_modal.js +5 -3
- package/lib/components/modal/modal.a11y.js +1 -1
- package/lib/components/modal/modal_header_title.js +12 -3
- package/lib/components/resizable_container/resizable_panel.js +5 -0
- package/lib/services/security/get_secure_rel_for_target.js +2 -9
- package/lib/services/theme/hooks.js +22 -2
- package/lib/services/theme/index.js +6 -0
- package/optimize/es/components/basic_table/basic_table.js +56 -101
- package/optimize/es/components/basic_table/basic_table.styles.js +45 -0
- package/optimize/es/components/modal/confirm_modal.js +4 -3
- package/optimize/es/components/modal/modal.a11y.js +1 -1
- package/optimize/es/components/modal/modal_header_title.js +4 -2
- package/optimize/es/services/security/get_secure_rel_for_target.js +2 -8
- package/optimize/es/services/theme/hooks.js +18 -0
- package/optimize/es/services/theme/index.js +1 -1
- package/optimize/lib/components/basic_table/basic_table.js +56 -95
- package/optimize/lib/components/basic_table/basic_table.styles.js +56 -0
- package/optimize/lib/components/modal/confirm_modal.js +4 -3
- package/optimize/lib/components/modal/modal.a11y.js +1 -1
- package/optimize/lib/components/modal/modal_header_title.js +4 -2
- package/optimize/lib/services/security/get_secure_rel_for_target.js +2 -9
- package/optimize/lib/services/theme/hooks.js +22 -2
- package/optimize/lib/services/theme/index.js +6 -0
- package/package.json +1 -1
- package/src/components/index.scss +0 -1
- package/test-env/components/basic_table/basic_table.js +56 -95
- package/test-env/components/basic_table/basic_table.styles.js +56 -0
- package/test-env/components/modal/confirm_modal.js +5 -3
- package/test-env/components/modal/modal.a11y.js +1 -1
- package/test-env/components/modal/modal_header_title.js +12 -3
- package/test-env/components/resizable_container/resizable_panel.js +5 -0
- package/test-env/services/security/get_secure_rel_for_target.js +2 -9
- package/test-env/services/theme/hooks.js +22 -2
- package/test-env/services/theme/index.js +6 -0
- package/CHANGELOG.md +0 -6185
- package/es/services/url.js +0 -23
- package/lib/services/url.js +0 -32
- package/optimize/es/services/url.js +0 -23
- package/optimize/lib/services/url.js +0 -32
- package/src/components/basic_table/_basic_table.scss +0 -41
- package/src/components/basic_table/_index.scss +0 -1
- package/src/components/date_picker/react-datepicker/LICENSE +0 -21
- package/src/components/date_picker/react-datepicker/README.md +0 -168
- package/src/services/theme/README.md +0 -153
- package/src/test/README.md +0 -59
- package/test-env/services/url.js +0 -32
|
@@ -28,7 +28,7 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
|
|
|
28
28
|
*/
|
|
29
29
|
import React, { Component, Fragment } from 'react';
|
|
30
30
|
import classNames from 'classnames';
|
|
31
|
-
import { formatAuto, formatBoolean, formatDate, formatNumber, formatText, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, SortDirection } from '../../services';
|
|
31
|
+
import { formatAuto, formatBoolean, formatDate, formatNumber, formatText, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, SortDirection, RenderWithEuiTheme } from '../../services';
|
|
32
32
|
import { isFunction } from '../../services/predicate';
|
|
33
33
|
import { get } from '../../services/objects';
|
|
34
34
|
import { EuiFlexGroup, EuiFlexItem } from '../flex';
|
|
@@ -42,6 +42,7 @@ import { EuiScreenReaderOnly } from '../accessibility';
|
|
|
42
42
|
import { EuiI18n } from '../i18n';
|
|
43
43
|
import { EuiDelayRender } from '../delay_render';
|
|
44
44
|
import { htmlIdGenerator } from '../../services/accessibility';
|
|
45
|
+
import { euiBasicTableBodyLoading, safariLoadingWorkaround, euiBasicTableActionsWrapper } from './basic_table.styles';
|
|
45
46
|
import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
46
47
|
var dataTypesProfiles = {
|
|
47
48
|
auto: {
|
|
@@ -147,45 +148,6 @@ export var EuiBasicTable = /*#__PURE__*/function (_Component) {
|
|
|
147
148
|
|
|
148
149
|
_this = _super.call(this, props);
|
|
149
150
|
|
|
150
|
-
_defineProperty(_assertThisInitialized(_this), "cleanups", []);
|
|
151
|
-
|
|
152
|
-
_defineProperty(_assertThisInitialized(_this), "tbody", null);
|
|
153
|
-
|
|
154
|
-
_defineProperty(_assertThisInitialized(_this), "setTbody", function (tbody) {
|
|
155
|
-
// remove listeners from an existing element
|
|
156
|
-
_this.removeLoadingListeners(); // update the ref
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
_this.tbody = tbody; // if loading, add listeners
|
|
160
|
-
|
|
161
|
-
if (_this.props.loading === true && tbody) {
|
|
162
|
-
_this.addLoadingListeners(tbody);
|
|
163
|
-
}
|
|
164
|
-
});
|
|
165
|
-
|
|
166
|
-
_defineProperty(_assertThisInitialized(_this), "addLoadingListeners", function (tbody) {
|
|
167
|
-
var listener = function listener(event) {
|
|
168
|
-
event.stopPropagation();
|
|
169
|
-
event.preventDefault();
|
|
170
|
-
};
|
|
171
|
-
|
|
172
|
-
['mousedown', 'mouseup', 'mouseover', 'mouseout', 'mouseenter', 'mouseleave', 'click', 'dblclick', 'keydown', 'keyup', 'keypress'].forEach(function (event) {
|
|
173
|
-
tbody.addEventListener(event, listener, true);
|
|
174
|
-
|
|
175
|
-
_this.cleanups.push(function () {
|
|
176
|
-
tbody.removeEventListener(event, listener, true);
|
|
177
|
-
});
|
|
178
|
-
});
|
|
179
|
-
});
|
|
180
|
-
|
|
181
|
-
_defineProperty(_assertThisInitialized(_this), "removeLoadingListeners", function () {
|
|
182
|
-
_this.cleanups.forEach(function (cleanup) {
|
|
183
|
-
return cleanup();
|
|
184
|
-
});
|
|
185
|
-
|
|
186
|
-
_this.cleanups.length = 0;
|
|
187
|
-
});
|
|
188
|
-
|
|
189
151
|
_defineProperty(_assertThisInitialized(_this), "tableId", htmlIdGenerator('__table')());
|
|
190
152
|
|
|
191
153
|
_defineProperty(_assertThisInitialized(_this), "selectAllIdGenerator", htmlIdGenerator('_selection_column-checkbox'));
|
|
@@ -277,27 +239,13 @@ export var EuiBasicTable = /*#__PURE__*/function (_Component) {
|
|
|
277
239
|
_createClass(EuiBasicTable, [{
|
|
278
240
|
key: "componentDidMount",
|
|
279
241
|
value: function componentDidMount() {
|
|
280
|
-
if (this.props.loading && this.tbody) this.addLoadingListeners(this.tbody);
|
|
281
242
|
this.getInitialSelection();
|
|
282
243
|
}
|
|
283
244
|
}, {
|
|
284
245
|
key: "componentDidUpdate",
|
|
285
|
-
value: function componentDidUpdate(
|
|
286
|
-
if (prevProps.loading !== this.props.loading) {
|
|
287
|
-
if (this.props.loading && this.tbody) {
|
|
288
|
-
this.addLoadingListeners(this.tbody);
|
|
289
|
-
} else {
|
|
290
|
-
this.removeLoadingListeners();
|
|
291
|
-
}
|
|
292
|
-
}
|
|
293
|
-
|
|
246
|
+
value: function componentDidUpdate() {
|
|
294
247
|
this.getInitialSelection();
|
|
295
248
|
}
|
|
296
|
-
}, {
|
|
297
|
-
key: "componentWillUnmount",
|
|
298
|
-
value: function componentWillUnmount() {
|
|
299
|
-
this.removeLoadingListeners();
|
|
300
|
-
}
|
|
301
249
|
}, {
|
|
302
250
|
key: "getInitialSelection",
|
|
303
251
|
value: function getInitialSelection() {
|
|
@@ -458,7 +406,8 @@ export var EuiBasicTable = /*#__PURE__*/function (_Component) {
|
|
|
458
406
|
var _this$props3 = this.props,
|
|
459
407
|
compressed = _this$props3.compressed,
|
|
460
408
|
responsive = _this$props3.responsive,
|
|
461
|
-
tableLayout = _this$props3.tableLayout
|
|
409
|
+
tableLayout = _this$props3.tableLayout,
|
|
410
|
+
loading = _this$props3.loading;
|
|
462
411
|
var mobileHeader = responsive ? ___EmotionJSX(EuiTableHeaderMobile, null, ___EmotionJSX(EuiFlexGroup, {
|
|
463
412
|
responsive: false,
|
|
464
413
|
justifyContent: "spaceBetween",
|
|
@@ -476,7 +425,8 @@ export var EuiBasicTable = /*#__PURE__*/function (_Component) {
|
|
|
476
425
|
id: this.tableId,
|
|
477
426
|
tableLayout: tableLayout,
|
|
478
427
|
responsive: responsive,
|
|
479
|
-
compressed: compressed
|
|
428
|
+
compressed: compressed,
|
|
429
|
+
css: loading && safariLoadingWorkaround
|
|
480
430
|
}, caption, head, body, footer));
|
|
481
431
|
}
|
|
482
432
|
}, {
|
|
@@ -739,30 +689,35 @@ export var EuiBasicTable = /*#__PURE__*/function (_Component) {
|
|
|
739
689
|
value: function renderTableBody() {
|
|
740
690
|
var _this4 = this;
|
|
741
691
|
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
var
|
|
747
|
-
|
|
748
|
-
if (
|
|
749
|
-
|
|
692
|
+
var _this$props8 = this.props,
|
|
693
|
+
error = _this$props8.error,
|
|
694
|
+
loading = _this$props8.loading,
|
|
695
|
+
items = _this$props8.items;
|
|
696
|
+
var content;
|
|
697
|
+
|
|
698
|
+
if (error) {
|
|
699
|
+
content = this.renderErrorMessage(error);
|
|
700
|
+
} else if (items.length === 0) {
|
|
701
|
+
content = this.renderEmptyMessage();
|
|
702
|
+
} else {
|
|
703
|
+
content = items.map(function (item, index) {
|
|
704
|
+
// if there's pagination the item's index must be adjusted to the where it is in the whole dataset
|
|
705
|
+
var tableItemIndex = hasPagination(_this4.props) && _this4.props.pagination.pageSize > 0 ? _this4.props.pagination.pageIndex * _this4.props.pagination.pageSize + index : index;
|
|
706
|
+
return _this4.renderItemRow(item, tableItemIndex);
|
|
707
|
+
});
|
|
750
708
|
}
|
|
751
709
|
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
710
|
+
return ___EmotionJSX(RenderWithEuiTheme, null, function (theme) {
|
|
711
|
+
return ___EmotionJSX(EuiTableBody, {
|
|
712
|
+
css: loading && euiBasicTableBodyLoading(theme)
|
|
713
|
+
}, content);
|
|
756
714
|
});
|
|
757
|
-
return ___EmotionJSX(EuiTableBody, {
|
|
758
|
-
bodyRef: this.setTbody
|
|
759
|
-
}, rows);
|
|
760
715
|
}
|
|
761
716
|
}, {
|
|
762
|
-
key: "
|
|
763
|
-
value: function
|
|
717
|
+
key: "renderErrorMessage",
|
|
718
|
+
value: function renderErrorMessage(error) {
|
|
764
719
|
var colSpan = this.props.columns.length + (this.props.selection ? 1 : 0);
|
|
765
|
-
return ___EmotionJSX(
|
|
720
|
+
return ___EmotionJSX(EuiTableRow, null, ___EmotionJSX(EuiTableRowCell, {
|
|
766
721
|
align: "center",
|
|
767
722
|
colSpan: colSpan,
|
|
768
723
|
mobileOptions: {
|
|
@@ -771,38 +726,38 @@ export var EuiBasicTable = /*#__PURE__*/function (_Component) {
|
|
|
771
726
|
}, ___EmotionJSX(EuiIcon, {
|
|
772
727
|
type: "minusInCircle",
|
|
773
728
|
color: "danger"
|
|
774
|
-
}), " ", error))
|
|
729
|
+
}), " ", error));
|
|
775
730
|
}
|
|
776
731
|
}, {
|
|
777
|
-
key: "
|
|
778
|
-
value: function
|
|
779
|
-
var _this$
|
|
780
|
-
columns = _this$
|
|
781
|
-
selection = _this$
|
|
782
|
-
noItemsMessage = _this$
|
|
732
|
+
key: "renderEmptyMessage",
|
|
733
|
+
value: function renderEmptyMessage() {
|
|
734
|
+
var _this$props9 = this.props,
|
|
735
|
+
columns = _this$props9.columns,
|
|
736
|
+
selection = _this$props9.selection,
|
|
737
|
+
noItemsMessage = _this$props9.noItemsMessage;
|
|
783
738
|
var colSpan = columns.length + (selection ? 1 : 0);
|
|
784
|
-
return ___EmotionJSX(
|
|
739
|
+
return ___EmotionJSX(EuiTableRow, null, ___EmotionJSX(EuiTableRowCell, {
|
|
785
740
|
align: "center",
|
|
786
741
|
colSpan: colSpan,
|
|
787
742
|
mobileOptions: {
|
|
788
743
|
width: '100%'
|
|
789
744
|
}
|
|
790
|
-
}, noItemsMessage))
|
|
745
|
+
}, noItemsMessage));
|
|
791
746
|
}
|
|
792
747
|
}, {
|
|
793
748
|
key: "renderItemRow",
|
|
794
749
|
value: function renderItemRow(item, rowIndex) {
|
|
795
750
|
var _this5 = this;
|
|
796
751
|
|
|
797
|
-
var _this$
|
|
798
|
-
columns = _this$
|
|
799
|
-
selection = _this$
|
|
800
|
-
isSelectable = _this$
|
|
801
|
-
hasActions = _this$
|
|
802
|
-
rowHeader = _this$
|
|
803
|
-
_this$
|
|
804
|
-
itemIdToExpandedRowMap = _this$
|
|
805
|
-
isExpandable = _this$
|
|
752
|
+
var _this$props10 = this.props,
|
|
753
|
+
columns = _this$props10.columns,
|
|
754
|
+
selection = _this$props10.selection,
|
|
755
|
+
isSelectable = _this$props10.isSelectable,
|
|
756
|
+
hasActions = _this$props10.hasActions,
|
|
757
|
+
rowHeader = _this$props10.rowHeader,
|
|
758
|
+
_this$props10$itemIdT = _this$props10.itemIdToExpandedRowMap,
|
|
759
|
+
itemIdToExpandedRowMap = _this$props10$itemIdT === void 0 ? {} : _this$props10$itemIdT,
|
|
760
|
+
isExpandable = _this$props10.isExpandable;
|
|
806
761
|
var cells = [];
|
|
807
762
|
var itemIdCallback = this.props.itemId;
|
|
808
763
|
var itemId = getItemId(item, itemIdCallback) != null ? getItemId(item, itemIdCallback) : rowIndex;
|
|
@@ -957,7 +912,8 @@ export var EuiBasicTable = /*#__PURE__*/function (_Component) {
|
|
|
957
912
|
key: key,
|
|
958
913
|
align: "right",
|
|
959
914
|
textOnly: false,
|
|
960
|
-
hasActions: true
|
|
915
|
+
hasActions: true,
|
|
916
|
+
css: euiBasicTableActionsWrapper
|
|
961
917
|
}, tools);
|
|
962
918
|
}
|
|
963
919
|
}, {
|
|
@@ -1042,11 +998,11 @@ export var EuiBasicTable = /*#__PURE__*/function (_Component) {
|
|
|
1042
998
|
value: function renderPaginationBar() {
|
|
1043
999
|
var _this8 = this;
|
|
1044
1000
|
|
|
1045
|
-
var _this$
|
|
1046
|
-
error = _this$
|
|
1047
|
-
pagination = _this$
|
|
1048
|
-
tableCaption = _this$
|
|
1049
|
-
onChange = _this$
|
|
1001
|
+
var _this$props11 = this.props,
|
|
1002
|
+
error = _this$props11.error,
|
|
1003
|
+
pagination = _this$props11.pagination,
|
|
1004
|
+
tableCaption = _this$props11.tableCaption,
|
|
1005
|
+
onChange = _this$props11.onChange;
|
|
1050
1006
|
|
|
1051
1007
|
if (!error && pagination && pagination.totalItemCount > 0) {
|
|
1052
1008
|
if (!onChange) {
|
|
@@ -1098,8 +1054,7 @@ export var EuiBasicTable = /*#__PURE__*/function (_Component) {
|
|
|
1098
1054
|
}
|
|
1099
1055
|
|
|
1100
1056
|
return null;
|
|
1101
|
-
}
|
|
1102
|
-
|
|
1057
|
+
}
|
|
1103
1058
|
}]);
|
|
1104
1059
|
|
|
1105
1060
|
return EuiBasicTable;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
|
|
2
|
+
|
|
3
|
+
var _templateObject;
|
|
4
|
+
|
|
5
|
+
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)."; }
|
|
6
|
+
|
|
7
|
+
/*
|
|
8
|
+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
9
|
+
* or more contributor license agreements. Licensed under the Elastic License
|
|
10
|
+
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
|
11
|
+
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
12
|
+
* Side Public License, v 1.
|
|
13
|
+
*/
|
|
14
|
+
import { css, keyframes } from '@emotion/react';
|
|
15
|
+
import { logicalCSS, euiCantAnimate } from '../../global_styling';
|
|
16
|
+
var tableLoadingLine = keyframes(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n from {\n ", "\n ", "\n }\n\n 20% {\n ", "\n ", "\n }\n\n 80% {\n ", "\n ", "\n }\n\n 100% {\n ", "\n ", "\n }\n"])), logicalCSS('left', 0), logicalCSS('width', 0), logicalCSS('left', 0), logicalCSS('width', '40%'), logicalCSS('left', '60%'), logicalCSS('width', '40%'), logicalCSS('left', '100%'), logicalCSS('width', 0));
|
|
17
|
+
export var euiBasicTableBodyLoading = function euiBasicTableBodyLoading(_ref2) {
|
|
18
|
+
var euiTheme = _ref2.euiTheme;
|
|
19
|
+
return /*#__PURE__*/css("position:relative;overflow:hidden;&::before{position:absolute;content:'';", logicalCSS('width', '100%'), " ", logicalCSS('height', euiTheme.border.width.thick), " background-color:", euiTheme.colors.primary, ";animation:", tableLoadingLine, " 1s linear infinite;", euiCantAnimate, "{animation-duration:2s;}};label:euiBasicTableBodyLoading;");
|
|
20
|
+
}; // Fix to make the loading indicator position correctly in Safari
|
|
21
|
+
// For whatever annoying reason, Safari doesn't respect `position: relative;`
|
|
22
|
+
// on `tbody` without `position: relative` on the parent `table`
|
|
23
|
+
|
|
24
|
+
var _ref = process.env.NODE_ENV === "production" ? {
|
|
25
|
+
name: "6xbnw4-safariLoadingWorkaround",
|
|
26
|
+
styles: "position:relative;label:safariLoadingWorkaround;"
|
|
27
|
+
} : {
|
|
28
|
+
name: "6xbnw4-safariLoadingWorkaround",
|
|
29
|
+
styles: "position:relative;label:safariLoadingWorkaround;",
|
|
30
|
+
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export var safariLoadingWorkaround = function safariLoadingWorkaround() {
|
|
34
|
+
return _ref;
|
|
35
|
+
}; // Unsets the extra height caused by tooltip/popover wrappers around table action buttons
|
|
36
|
+
// Without this, the row height jumps whenever actions are disabled
|
|
37
|
+
|
|
38
|
+
export var euiBasicTableActionsWrapper = process.env.NODE_ENV === "production" ? {
|
|
39
|
+
name: "1mshepa-euiBasicTableActionsWrapper",
|
|
40
|
+
styles: "line-height:1;label:euiBasicTableActionsWrapper;"
|
|
41
|
+
} : {
|
|
42
|
+
name: "1mshepa-euiBasicTableActionsWrapper",
|
|
43
|
+
styles: "line-height:1;label:euiBasicTableActionsWrapper;",
|
|
44
|
+
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
45
|
+
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
3
3
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
4
|
-
var _excluded = ["children", "title", "onCancel", "onConfirm", "cancelButtonText", "confirmButtonText", "confirmButtonDisabled", "className", "buttonColor", "defaultFocusedButton", "isLoading"];
|
|
4
|
+
var _excluded = ["children", "title", "titleProps", "onCancel", "onConfirm", "cancelButtonText", "confirmButtonText", "confirmButtonDisabled", "className", "buttonColor", "defaultFocusedButton", "isLoading"];
|
|
5
5
|
|
|
6
6
|
/*
|
|
7
7
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
@@ -27,6 +27,7 @@ export var CANCEL_BUTTON = 'cancel';
|
|
|
27
27
|
export var EuiConfirmModal = function EuiConfirmModal(_ref) {
|
|
28
28
|
var children = _ref.children,
|
|
29
29
|
title = _ref.title,
|
|
30
|
+
titleProps = _ref.titleProps,
|
|
30
31
|
onCancel = _ref.onCancel,
|
|
31
32
|
onConfirm = _ref.onConfirm,
|
|
32
33
|
cancelButtonText = _ref.cancelButtonText,
|
|
@@ -78,9 +79,9 @@ export var EuiConfirmModal = function EuiConfirmModal(_ref) {
|
|
|
78
79
|
var modalTitle;
|
|
79
80
|
|
|
80
81
|
if (title) {
|
|
81
|
-
modalTitle = ___EmotionJSX(EuiModalHeader, null, ___EmotionJSX(EuiModalHeaderTitle, {
|
|
82
|
+
modalTitle = ___EmotionJSX(EuiModalHeader, null, ___EmotionJSX(EuiModalHeaderTitle, _extends({
|
|
82
83
|
"data-test-subj": "confirmModalTitleText"
|
|
83
|
-
}, title));
|
|
84
|
+
}, titleProps), title));
|
|
84
85
|
}
|
|
85
86
|
|
|
86
87
|
var message;
|
|
@@ -34,7 +34,7 @@ var Modal = function Modal() {
|
|
|
34
34
|
};
|
|
35
35
|
return ___EmotionJSX("div", null, ___EmotionJSX(EuiButton, {
|
|
36
36
|
onClick: showModal
|
|
37
|
-
}, "Show confirm modal"), isModalVisible && ___EmotionJSX(EuiModal, modalProps, ___EmotionJSX(EuiModalHeader, null, ___EmotionJSX(EuiModalHeaderTitle, null,
|
|
37
|
+
}, "Show confirm modal"), isModalVisible && ___EmotionJSX(EuiModal, modalProps, ___EmotionJSX(EuiModalHeader, null, ___EmotionJSX(EuiModalHeaderTitle, null, "Title of modal")), ___EmotionJSX(EuiModalBody, null, ___EmotionJSX("p", null, "This is a simple modal body")), ___EmotionJSX(EuiModalFooter, null, ___EmotionJSX(EuiButton, {
|
|
38
38
|
onClick: closeModal,
|
|
39
39
|
fill: true
|
|
40
40
|
}, "Close"))));
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
|
-
var _excluded = ["className", "children"];
|
|
3
|
+
var _excluded = ["className", "children", "component"];
|
|
4
4
|
|
|
5
5
|
/*
|
|
6
6
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
@@ -16,11 +16,13 @@ import { jsx as ___EmotionJSX } from "@emotion/react";
|
|
|
16
16
|
export var EuiModalHeaderTitle = function EuiModalHeaderTitle(_ref) {
|
|
17
17
|
var className = _ref.className,
|
|
18
18
|
children = _ref.children,
|
|
19
|
+
_ref$component = _ref.component,
|
|
20
|
+
Component = _ref$component === void 0 ? 'h1' : _ref$component,
|
|
19
21
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
20
22
|
|
|
21
23
|
var classes = classnames('euiModalHeader__title', className);
|
|
22
24
|
return ___EmotionJSX(EuiTitle, _extends({
|
|
23
25
|
size: "m",
|
|
24
26
|
className: classes
|
|
25
|
-
}, rest),
|
|
27
|
+
}, rest), ___EmotionJSX(Component, null, children));
|
|
26
28
|
};
|
|
@@ -10,20 +10,14 @@
|
|
|
10
10
|
* Secures outbound links. For more info:
|
|
11
11
|
* https://www.jitbit.com/alexblog/256-targetblank---the-most-underestimated-vulnerability-ever/
|
|
12
12
|
*/
|
|
13
|
-
import { isDomainSecure } from '../url';
|
|
14
13
|
export var getSecureRelForTarget = function getSecureRelForTarget(_ref) {
|
|
15
|
-
var
|
|
16
|
-
_ref$target = _ref.target,
|
|
14
|
+
var _ref$target = _ref.target,
|
|
17
15
|
target = _ref$target === void 0 ? '' : _ref$target,
|
|
18
16
|
rel = _ref.rel;
|
|
19
|
-
var isElasticHref = !!href && isDomainSecure(href);
|
|
20
17
|
var relParts = !!rel ? rel.split(' ').filter(function (part) {
|
|
21
18
|
return !!part.length && part !== 'noreferrer';
|
|
22
19
|
}) : [];
|
|
23
|
-
|
|
24
|
-
if (!isElasticHref) {
|
|
25
|
-
relParts.push('noreferrer');
|
|
26
|
-
}
|
|
20
|
+
relParts.push('noreferrer');
|
|
27
21
|
|
|
28
22
|
if (target.includes('_blank') && relParts.indexOf('noopener') === -1) {
|
|
29
23
|
relParts.push('noopener');
|
|
@@ -12,6 +12,10 @@ import { EuiThemeContext, EuiModificationsContext, EuiColorModeContext, defaultC
|
|
|
12
12
|
import { getEuiDevProviderWarning } from './provider';
|
|
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.";
|
|
15
|
+
/**
|
|
16
|
+
* Hook for function components
|
|
17
|
+
*/
|
|
18
|
+
|
|
15
19
|
export var useEuiTheme = function useEuiTheme() {
|
|
16
20
|
var theme = useContext(EuiThemeContext);
|
|
17
21
|
var colorMode = useContext(EuiColorModeContext);
|
|
@@ -46,6 +50,10 @@ export var useEuiTheme = function useEuiTheme() {
|
|
|
46
50
|
}, [theme, colorMode, modifications]);
|
|
47
51
|
return assembledTheme;
|
|
48
52
|
};
|
|
53
|
+
/**
|
|
54
|
+
* HOC for class components
|
|
55
|
+
*/
|
|
56
|
+
|
|
49
57
|
// Provide the component props interface as the generic to allow the docs props table to populate.
|
|
50
58
|
// e.g., `const EuiComponent = withEuiTheme<EuiComponentProps>(_EuiComponent)`
|
|
51
59
|
export var withEuiTheme = function withEuiTheme(Component) {
|
|
@@ -62,4 +70,14 @@ export var withEuiTheme = function withEuiTheme(Component) {
|
|
|
62
70
|
var WithEuiTheme = /*#__PURE__*/forwardRef(Render);
|
|
63
71
|
WithEuiTheme.displayName = componentName;
|
|
64
72
|
return WithEuiTheme;
|
|
73
|
+
};
|
|
74
|
+
/**
|
|
75
|
+
* Render prop alternative for complex class components
|
|
76
|
+
* Most useful for scenarios where a HOC may interfere with typing
|
|
77
|
+
*/
|
|
78
|
+
|
|
79
|
+
export var RenderWithEuiTheme = function RenderWithEuiTheme(_ref) {
|
|
80
|
+
var children = _ref.children;
|
|
81
|
+
var theme = useEuiTheme();
|
|
82
|
+
return children(theme);
|
|
65
83
|
};
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* Side Public License, v 1.
|
|
7
7
|
*/
|
|
8
8
|
export { EuiSystemContext, EuiThemeContext, EuiModificationsContext, EuiColorModeContext } from './context';
|
|
9
|
-
export { useEuiTheme, withEuiTheme } from './hooks';
|
|
9
|
+
export { useEuiTheme, withEuiTheme, RenderWithEuiTheme } from './hooks';
|
|
10
10
|
export { EuiThemeProvider, getEuiDevProviderWarning, setEuiDevProviderWarning } from './provider';
|
|
11
11
|
export { buildTheme, computed, isInverseColorMode, getColorMode, getComputed, getOn, mergeDeep, setOn, Computed } from './utils';
|
|
12
12
|
export { COLOR_MODES_STANDARD } from './types';
|