@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
|
@@ -62,6 +62,8 @@ var _delay_render = require("../delay_render");
|
|
|
62
62
|
|
|
63
63
|
var _accessibility2 = require("../../services/accessibility");
|
|
64
64
|
|
|
65
|
+
var _basic_table = require("./basic_table.styles");
|
|
66
|
+
|
|
65
67
|
var _react2 = require("@emotion/react");
|
|
66
68
|
|
|
67
69
|
var _excluded = ["className", "loading", "items", "itemId", "columns", "pagination", "sorting", "selection", "onChange", "error", "noItemsMessage", "compressed", "itemIdToExpandedRowMap", "responsive", "isSelectable", "isExpandable", "hasActions", "rowProps", "cellProps", "tableCaption", "rowHeader", "tableLayout"],
|
|
@@ -182,40 +184,6 @@ var EuiBasicTable = /*#__PURE__*/function (_Component) {
|
|
|
182
184
|
|
|
183
185
|
(0, _classCallCheck2.default)(this, EuiBasicTable);
|
|
184
186
|
_this = _super.call(this, props);
|
|
185
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "cleanups", []);
|
|
186
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "tbody", null);
|
|
187
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "setTbody", function (tbody) {
|
|
188
|
-
// remove listeners from an existing element
|
|
189
|
-
_this.removeLoadingListeners(); // update the ref
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
_this.tbody = tbody; // if loading, add listeners
|
|
193
|
-
|
|
194
|
-
if (_this.props.loading === true && tbody) {
|
|
195
|
-
_this.addLoadingListeners(tbody);
|
|
196
|
-
}
|
|
197
|
-
});
|
|
198
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "addLoadingListeners", function (tbody) {
|
|
199
|
-
var listener = function listener(event) {
|
|
200
|
-
event.stopPropagation();
|
|
201
|
-
event.preventDefault();
|
|
202
|
-
};
|
|
203
|
-
|
|
204
|
-
['mousedown', 'mouseup', 'mouseover', 'mouseout', 'mouseenter', 'mouseleave', 'click', 'dblclick', 'keydown', 'keyup', 'keypress'].forEach(function (event) {
|
|
205
|
-
tbody.addEventListener(event, listener, true);
|
|
206
|
-
|
|
207
|
-
_this.cleanups.push(function () {
|
|
208
|
-
tbody.removeEventListener(event, listener, true);
|
|
209
|
-
});
|
|
210
|
-
});
|
|
211
|
-
});
|
|
212
|
-
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "removeLoadingListeners", function () {
|
|
213
|
-
_this.cleanups.forEach(function (cleanup) {
|
|
214
|
-
return cleanup();
|
|
215
|
-
});
|
|
216
|
-
|
|
217
|
-
_this.cleanups.length = 0;
|
|
218
|
-
});
|
|
219
187
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "tableId", (0, _accessibility2.htmlIdGenerator)('__table')());
|
|
220
188
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "selectAllIdGenerator", (0, _accessibility2.htmlIdGenerator)('_selection_column-checkbox'));
|
|
221
189
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "renderSelectAll", function (isMobile) {
|
|
@@ -302,27 +270,13 @@ var EuiBasicTable = /*#__PURE__*/function (_Component) {
|
|
|
302
270
|
(0, _createClass2.default)(EuiBasicTable, [{
|
|
303
271
|
key: "componentDidMount",
|
|
304
272
|
value: function componentDidMount() {
|
|
305
|
-
if (this.props.loading && this.tbody) this.addLoadingListeners(this.tbody);
|
|
306
273
|
this.getInitialSelection();
|
|
307
274
|
}
|
|
308
275
|
}, {
|
|
309
276
|
key: "componentDidUpdate",
|
|
310
|
-
value: function componentDidUpdate(
|
|
311
|
-
if (prevProps.loading !== this.props.loading) {
|
|
312
|
-
if (this.props.loading && this.tbody) {
|
|
313
|
-
this.addLoadingListeners(this.tbody);
|
|
314
|
-
} else {
|
|
315
|
-
this.removeLoadingListeners();
|
|
316
|
-
}
|
|
317
|
-
}
|
|
318
|
-
|
|
277
|
+
value: function componentDidUpdate() {
|
|
319
278
|
this.getInitialSelection();
|
|
320
279
|
}
|
|
321
|
-
}, {
|
|
322
|
-
key: "componentWillUnmount",
|
|
323
|
-
value: function componentWillUnmount() {
|
|
324
|
-
this.removeLoadingListeners();
|
|
325
|
-
}
|
|
326
280
|
}, {
|
|
327
281
|
key: "getInitialSelection",
|
|
328
282
|
value: function getInitialSelection() {
|
|
@@ -482,7 +436,8 @@ var EuiBasicTable = /*#__PURE__*/function (_Component) {
|
|
|
482
436
|
var _this$props3 = this.props,
|
|
483
437
|
compressed = _this$props3.compressed,
|
|
484
438
|
responsive = _this$props3.responsive,
|
|
485
|
-
tableLayout = _this$props3.tableLayout
|
|
439
|
+
tableLayout = _this$props3.tableLayout,
|
|
440
|
+
loading = _this$props3.loading;
|
|
486
441
|
var mobileHeader = responsive ? (0, _react2.jsx)(_table.EuiTableHeaderMobile, null, (0, _react2.jsx)(_flex.EuiFlexGroup, {
|
|
487
442
|
responsive: false,
|
|
488
443
|
justifyContent: "spaceBetween",
|
|
@@ -500,7 +455,8 @@ var EuiBasicTable = /*#__PURE__*/function (_Component) {
|
|
|
500
455
|
id: this.tableId,
|
|
501
456
|
tableLayout: tableLayout,
|
|
502
457
|
responsive: responsive,
|
|
503
|
-
compressed: compressed
|
|
458
|
+
compressed: compressed,
|
|
459
|
+
css: loading && _basic_table.safariLoadingWorkaround
|
|
504
460
|
}, caption, head, body, footer));
|
|
505
461
|
}
|
|
506
462
|
}, {
|
|
@@ -763,30 +719,35 @@ var EuiBasicTable = /*#__PURE__*/function (_Component) {
|
|
|
763
719
|
value: function renderTableBody() {
|
|
764
720
|
var _this4 = this;
|
|
765
721
|
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
var
|
|
771
|
-
|
|
772
|
-
if (
|
|
773
|
-
|
|
722
|
+
var _this$props8 = this.props,
|
|
723
|
+
error = _this$props8.error,
|
|
724
|
+
loading = _this$props8.loading,
|
|
725
|
+
items = _this$props8.items;
|
|
726
|
+
var content;
|
|
727
|
+
|
|
728
|
+
if (error) {
|
|
729
|
+
content = this.renderErrorMessage(error);
|
|
730
|
+
} else if (items.length === 0) {
|
|
731
|
+
content = this.renderEmptyMessage();
|
|
732
|
+
} else {
|
|
733
|
+
content = items.map(function (item, index) {
|
|
734
|
+
// if there's pagination the item's index must be adjusted to the where it is in the whole dataset
|
|
735
|
+
var tableItemIndex = hasPagination(_this4.props) && _this4.props.pagination.pageSize > 0 ? _this4.props.pagination.pageIndex * _this4.props.pagination.pageSize + index : index;
|
|
736
|
+
return _this4.renderItemRow(item, tableItemIndex);
|
|
737
|
+
});
|
|
774
738
|
}
|
|
775
739
|
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
740
|
+
return (0, _react2.jsx)(_services.RenderWithEuiTheme, null, function (theme) {
|
|
741
|
+
return (0, _react2.jsx)(_table.EuiTableBody, {
|
|
742
|
+
css: loading && (0, _basic_table.euiBasicTableBodyLoading)(theme)
|
|
743
|
+
}, content);
|
|
780
744
|
});
|
|
781
|
-
return (0, _react2.jsx)(_table.EuiTableBody, {
|
|
782
|
-
bodyRef: this.setTbody
|
|
783
|
-
}, rows);
|
|
784
745
|
}
|
|
785
746
|
}, {
|
|
786
|
-
key: "
|
|
787
|
-
value: function
|
|
747
|
+
key: "renderErrorMessage",
|
|
748
|
+
value: function renderErrorMessage(error) {
|
|
788
749
|
var colSpan = this.props.columns.length + (this.props.selection ? 1 : 0);
|
|
789
|
-
return (0, _react2.jsx)(_table.
|
|
750
|
+
return (0, _react2.jsx)(_table.EuiTableRow, null, (0, _react2.jsx)(_table.EuiTableRowCell, {
|
|
790
751
|
align: "center",
|
|
791
752
|
colSpan: colSpan,
|
|
792
753
|
mobileOptions: {
|
|
@@ -795,38 +756,38 @@ var EuiBasicTable = /*#__PURE__*/function (_Component) {
|
|
|
795
756
|
}, (0, _react2.jsx)(_icon.EuiIcon, {
|
|
796
757
|
type: "minusInCircle",
|
|
797
758
|
color: "danger"
|
|
798
|
-
}), " ", error))
|
|
759
|
+
}), " ", error));
|
|
799
760
|
}
|
|
800
761
|
}, {
|
|
801
|
-
key: "
|
|
802
|
-
value: function
|
|
803
|
-
var _this$
|
|
804
|
-
columns = _this$
|
|
805
|
-
selection = _this$
|
|
806
|
-
noItemsMessage = _this$
|
|
762
|
+
key: "renderEmptyMessage",
|
|
763
|
+
value: function renderEmptyMessage() {
|
|
764
|
+
var _this$props9 = this.props,
|
|
765
|
+
columns = _this$props9.columns,
|
|
766
|
+
selection = _this$props9.selection,
|
|
767
|
+
noItemsMessage = _this$props9.noItemsMessage;
|
|
807
768
|
var colSpan = columns.length + (selection ? 1 : 0);
|
|
808
|
-
return (0, _react2.jsx)(_table.
|
|
769
|
+
return (0, _react2.jsx)(_table.EuiTableRow, null, (0, _react2.jsx)(_table.EuiTableRowCell, {
|
|
809
770
|
align: "center",
|
|
810
771
|
colSpan: colSpan,
|
|
811
772
|
mobileOptions: {
|
|
812
773
|
width: '100%'
|
|
813
774
|
}
|
|
814
|
-
}, noItemsMessage))
|
|
775
|
+
}, noItemsMessage));
|
|
815
776
|
}
|
|
816
777
|
}, {
|
|
817
778
|
key: "renderItemRow",
|
|
818
779
|
value: function renderItemRow(item, rowIndex) {
|
|
819
780
|
var _this5 = this;
|
|
820
781
|
|
|
821
|
-
var _this$
|
|
822
|
-
columns = _this$
|
|
823
|
-
selection = _this$
|
|
824
|
-
isSelectable = _this$
|
|
825
|
-
hasActions = _this$
|
|
826
|
-
rowHeader = _this$
|
|
827
|
-
_this$
|
|
828
|
-
itemIdToExpandedRowMap = _this$
|
|
829
|
-
isExpandable = _this$
|
|
782
|
+
var _this$props10 = this.props,
|
|
783
|
+
columns = _this$props10.columns,
|
|
784
|
+
selection = _this$props10.selection,
|
|
785
|
+
isSelectable = _this$props10.isSelectable,
|
|
786
|
+
hasActions = _this$props10.hasActions,
|
|
787
|
+
rowHeader = _this$props10.rowHeader,
|
|
788
|
+
_this$props10$itemIdT = _this$props10.itemIdToExpandedRowMap,
|
|
789
|
+
itemIdToExpandedRowMap = _this$props10$itemIdT === void 0 ? {} : _this$props10$itemIdT,
|
|
790
|
+
isExpandable = _this$props10.isExpandable;
|
|
830
791
|
var cells = [];
|
|
831
792
|
var itemIdCallback = this.props.itemId;
|
|
832
793
|
var itemId = getItemId(item, itemIdCallback) != null ? getItemId(item, itemIdCallback) : rowIndex;
|
|
@@ -978,7 +939,8 @@ var EuiBasicTable = /*#__PURE__*/function (_Component) {
|
|
|
978
939
|
key: key,
|
|
979
940
|
align: "right",
|
|
980
941
|
textOnly: false,
|
|
981
|
-
hasActions: true
|
|
942
|
+
hasActions: true,
|
|
943
|
+
css: _basic_table.euiBasicTableActionsWrapper
|
|
982
944
|
}, tools);
|
|
983
945
|
}
|
|
984
946
|
}, {
|
|
@@ -1062,11 +1024,11 @@ var EuiBasicTable = /*#__PURE__*/function (_Component) {
|
|
|
1062
1024
|
value: function renderPaginationBar() {
|
|
1063
1025
|
var _this8 = this;
|
|
1064
1026
|
|
|
1065
|
-
var _this$
|
|
1066
|
-
error = _this$
|
|
1067
|
-
pagination = _this$
|
|
1068
|
-
tableCaption = _this$
|
|
1069
|
-
onChange = _this$
|
|
1027
|
+
var _this$props11 = this.props,
|
|
1028
|
+
error = _this$props11.error,
|
|
1029
|
+
pagination = _this$props11.pagination,
|
|
1030
|
+
tableCaption = _this$props11.tableCaption,
|
|
1031
|
+
onChange = _this$props11.onChange;
|
|
1070
1032
|
|
|
1071
1033
|
if (!error && pagination && pagination.totalItemCount > 0) {
|
|
1072
1034
|
if (!onChange) {
|
|
@@ -1118,8 +1080,7 @@ var EuiBasicTable = /*#__PURE__*/function (_Component) {
|
|
|
1118
1080
|
}
|
|
1119
1081
|
|
|
1120
1082
|
return null;
|
|
1121
|
-
}
|
|
1122
|
-
|
|
1083
|
+
}
|
|
1123
1084
|
}]);
|
|
1124
1085
|
return EuiBasicTable;
|
|
1125
1086
|
}(_react.Component);
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.safariLoadingWorkaround = exports.euiBasicTableBodyLoading = exports.euiBasicTableActionsWrapper = void 0;
|
|
9
|
+
|
|
10
|
+
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
11
|
+
|
|
12
|
+
var _react = require("@emotion/react");
|
|
13
|
+
|
|
14
|
+
var _global_styling = require("../../global_styling");
|
|
15
|
+
|
|
16
|
+
var _templateObject;
|
|
17
|
+
|
|
18
|
+
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)."; }
|
|
19
|
+
|
|
20
|
+
var tableLoadingLine = (0, _react.keyframes)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n from {\n ", "\n ", "\n }\n\n 20% {\n ", "\n ", "\n }\n\n 80% {\n ", "\n ", "\n }\n\n 100% {\n ", "\n ", "\n }\n"])), (0, _global_styling.logicalCSS)('left', 0), (0, _global_styling.logicalCSS)('width', 0), (0, _global_styling.logicalCSS)('left', 0), (0, _global_styling.logicalCSS)('width', '40%'), (0, _global_styling.logicalCSS)('left', '60%'), (0, _global_styling.logicalCSS)('width', '40%'), (0, _global_styling.logicalCSS)('left', '100%'), (0, _global_styling.logicalCSS)('width', 0));
|
|
21
|
+
|
|
22
|
+
var euiBasicTableBodyLoading = function euiBasicTableBodyLoading(_ref2) {
|
|
23
|
+
var euiTheme = _ref2.euiTheme;
|
|
24
|
+
return /*#__PURE__*/(0, _react.css)("position:relative;overflow:hidden;&::before{position:absolute;content:'';", (0, _global_styling.logicalCSS)('width', '100%'), " ", (0, _global_styling.logicalCSS)('height', euiTheme.border.width.thick), " background-color:", euiTheme.colors.primary, ";animation:", tableLoadingLine, " 1s linear infinite;", _global_styling.euiCantAnimate, "{animation-duration:2s;}};label:euiBasicTableBodyLoading;");
|
|
25
|
+
}; // Fix to make the loading indicator position correctly in Safari
|
|
26
|
+
// For whatever annoying reason, Safari doesn't respect `position: relative;`
|
|
27
|
+
// on `tbody` without `position: relative` on the parent `table`
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
exports.euiBasicTableBodyLoading = euiBasicTableBodyLoading;
|
|
31
|
+
|
|
32
|
+
var _ref = process.env.NODE_ENV === "production" ? {
|
|
33
|
+
name: "6xbnw4-safariLoadingWorkaround",
|
|
34
|
+
styles: "position:relative;label:safariLoadingWorkaround;"
|
|
35
|
+
} : {
|
|
36
|
+
name: "6xbnw4-safariLoadingWorkaround",
|
|
37
|
+
styles: "position:relative;label:safariLoadingWorkaround;",
|
|
38
|
+
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
var safariLoadingWorkaround = function safariLoadingWorkaround() {
|
|
42
|
+
return _ref;
|
|
43
|
+
}; // Unsets the extra height caused by tooltip/popover wrappers around table action buttons
|
|
44
|
+
// Without this, the row height jumps whenever actions are disabled
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
exports.safariLoadingWorkaround = safariLoadingWorkaround;
|
|
48
|
+
var euiBasicTableActionsWrapper = process.env.NODE_ENV === "production" ? {
|
|
49
|
+
name: "1mshepa-euiBasicTableActionsWrapper",
|
|
50
|
+
styles: "line-height:1;label:euiBasicTableActionsWrapper;"
|
|
51
|
+
} : {
|
|
52
|
+
name: "1mshepa-euiBasicTableActionsWrapper",
|
|
53
|
+
styles: "line-height:1;label:euiBasicTableActionsWrapper;",
|
|
54
|
+
toString: _EMOTION_STRINGIFIED_CSS_ERROR__
|
|
55
|
+
};
|
|
56
|
+
exports.euiBasicTableActionsWrapper = euiBasicTableActionsWrapper;
|
|
@@ -39,7 +39,7 @@ var _text = require("../text");
|
|
|
39
39
|
|
|
40
40
|
var _react2 = require("@emotion/react");
|
|
41
41
|
|
|
42
|
-
var _excluded = ["children", "title", "onCancel", "onConfirm", "cancelButtonText", "confirmButtonText", "confirmButtonDisabled", "className", "buttonColor", "defaultFocusedButton", "isLoading"];
|
|
42
|
+
var _excluded = ["children", "title", "titleProps", "onCancel", "onConfirm", "cancelButtonText", "confirmButtonText", "confirmButtonDisabled", "className", "buttonColor", "defaultFocusedButton", "isLoading"];
|
|
43
43
|
|
|
44
44
|
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); }
|
|
45
45
|
|
|
@@ -53,6 +53,7 @@ exports.CANCEL_BUTTON = CANCEL_BUTTON;
|
|
|
53
53
|
var EuiConfirmModal = function EuiConfirmModal(_ref) {
|
|
54
54
|
var children = _ref.children,
|
|
55
55
|
title = _ref.title,
|
|
56
|
+
titleProps = _ref.titleProps,
|
|
56
57
|
onCancel = _ref.onCancel,
|
|
57
58
|
onConfirm = _ref.onConfirm,
|
|
58
59
|
cancelButtonText = _ref.cancelButtonText,
|
|
@@ -104,9 +105,9 @@ var EuiConfirmModal = function EuiConfirmModal(_ref) {
|
|
|
104
105
|
var modalTitle;
|
|
105
106
|
|
|
106
107
|
if (title) {
|
|
107
|
-
modalTitle = (0, _react2.jsx)(_modal_header.EuiModalHeader, null, (0, _react2.jsx)(_modal_header_title.EuiModalHeaderTitle, {
|
|
108
|
+
modalTitle = (0, _react2.jsx)(_modal_header.EuiModalHeader, null, (0, _react2.jsx)(_modal_header_title.EuiModalHeaderTitle, (0, _extends2.default)({
|
|
108
109
|
"data-test-subj": "confirmModalTitleText"
|
|
109
|
-
}, title));
|
|
110
|
+
}, titleProps), title));
|
|
110
111
|
}
|
|
111
112
|
|
|
112
113
|
var message;
|
|
@@ -47,7 +47,7 @@ var Modal = function Modal() {
|
|
|
47
47
|
};
|
|
48
48
|
return (0, _react2.jsx)("div", null, (0, _react2.jsx)(_button.EuiButton, {
|
|
49
49
|
onClick: showModal
|
|
50
|
-
}, "Show confirm modal"), isModalVisible && (0, _react2.jsx)(_index.EuiModal, modalProps, (0, _react2.jsx)(_index.EuiModalHeader, null, (0, _react2.jsx)(_index.EuiModalHeaderTitle, null,
|
|
50
|
+
}, "Show confirm modal"), isModalVisible && (0, _react2.jsx)(_index.EuiModal, modalProps, (0, _react2.jsx)(_index.EuiModalHeader, null, (0, _react2.jsx)(_index.EuiModalHeaderTitle, null, "Title of modal")), (0, _react2.jsx)(_index.EuiModalBody, null, (0, _react2.jsx)("p", null, "This is a simple modal body")), (0, _react2.jsx)(_index.EuiModalFooter, null, (0, _react2.jsx)(_button.EuiButton, {
|
|
51
51
|
onClick: closeModal,
|
|
52
52
|
fill: true
|
|
53
53
|
}, "Close"))));
|
|
@@ -19,17 +19,19 @@ var _title = require("../title");
|
|
|
19
19
|
|
|
20
20
|
var _react2 = require("@emotion/react");
|
|
21
21
|
|
|
22
|
-
var _excluded = ["className", "children"];
|
|
22
|
+
var _excluded = ["className", "children", "component"];
|
|
23
23
|
|
|
24
24
|
var EuiModalHeaderTitle = function EuiModalHeaderTitle(_ref) {
|
|
25
25
|
var className = _ref.className,
|
|
26
26
|
children = _ref.children,
|
|
27
|
+
_ref$component = _ref.component,
|
|
28
|
+
Component = _ref$component === void 0 ? 'h1' : _ref$component,
|
|
27
29
|
rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
28
30
|
var classes = (0, _classnames.default)('euiModalHeader__title', className);
|
|
29
31
|
return (0, _react2.jsx)(_title.EuiTitle, (0, _extends2.default)({
|
|
30
32
|
size: "m",
|
|
31
33
|
className: classes
|
|
32
|
-
}, rest),
|
|
34
|
+
}, rest), (0, _react2.jsx)(Component, null, children));
|
|
33
35
|
};
|
|
34
36
|
|
|
35
37
|
exports.EuiModalHeaderTitle = EuiModalHeaderTitle;
|
|
@@ -5,8 +5,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.getSecureRelForTarget = void 0;
|
|
7
7
|
|
|
8
|
-
var _url = require("../url");
|
|
9
|
-
|
|
10
8
|
/*
|
|
11
9
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
12
10
|
* or more contributor license agreements. Licensed under the Elastic License
|
|
@@ -20,18 +18,13 @@ var _url = require("../url");
|
|
|
20
18
|
* https://www.jitbit.com/alexblog/256-targetblank---the-most-underestimated-vulnerability-ever/
|
|
21
19
|
*/
|
|
22
20
|
var getSecureRelForTarget = function getSecureRelForTarget(_ref) {
|
|
23
|
-
var
|
|
24
|
-
_ref$target = _ref.target,
|
|
21
|
+
var _ref$target = _ref.target,
|
|
25
22
|
target = _ref$target === void 0 ? '' : _ref$target,
|
|
26
23
|
rel = _ref.rel;
|
|
27
|
-
var isElasticHref = !!href && (0, _url.isDomainSecure)(href);
|
|
28
24
|
var relParts = !!rel ? rel.split(' ').filter(function (part) {
|
|
29
25
|
return !!part.length && part !== 'noreferrer';
|
|
30
26
|
}) : [];
|
|
31
|
-
|
|
32
|
-
if (!isElasticHref) {
|
|
33
|
-
relParts.push('noreferrer');
|
|
34
|
-
}
|
|
27
|
+
relParts.push('noreferrer');
|
|
35
28
|
|
|
36
29
|
if (target.includes('_blank') && relParts.indexOf('noopener') === -1) {
|
|
37
30
|
relParts.push('noopener');
|
|
@@ -7,7 +7,7 @@ var _typeof = require("@babel/runtime/helpers/typeof");
|
|
|
7
7
|
Object.defineProperty(exports, "__esModule", {
|
|
8
8
|
value: true
|
|
9
9
|
});
|
|
10
|
-
exports.withEuiTheme = exports.useEuiTheme = void 0;
|
|
10
|
+
exports.withEuiTheme = exports.useEuiTheme = exports.RenderWithEuiTheme = void 0;
|
|
11
11
|
|
|
12
12
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
13
13
|
|
|
@@ -31,6 +31,9 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
31
31
|
* Side Public License, v 1.
|
|
32
32
|
*/
|
|
33
33
|
var providerMessage = "`EuiProvider` is missing which can result in negative effects.\nWrap your component in `EuiProvider`: https://ela.st/euiprovider.";
|
|
34
|
+
/**
|
|
35
|
+
* Hook for function components
|
|
36
|
+
*/
|
|
34
37
|
|
|
35
38
|
var useEuiTheme = function useEuiTheme() {
|
|
36
39
|
var theme = (0, _react.useContext)(_context.EuiThemeContext);
|
|
@@ -66,6 +69,10 @@ var useEuiTheme = function useEuiTheme() {
|
|
|
66
69
|
}, [theme, colorMode, modifications]);
|
|
67
70
|
return assembledTheme;
|
|
68
71
|
};
|
|
72
|
+
/**
|
|
73
|
+
* HOC for class components
|
|
74
|
+
*/
|
|
75
|
+
|
|
69
76
|
|
|
70
77
|
exports.useEuiTheme = useEuiTheme;
|
|
71
78
|
|
|
@@ -86,5 +93,18 @@ var withEuiTheme = function withEuiTheme(Component) {
|
|
|
86
93
|
WithEuiTheme.displayName = componentName;
|
|
87
94
|
return WithEuiTheme;
|
|
88
95
|
};
|
|
96
|
+
/**
|
|
97
|
+
* Render prop alternative for complex class components
|
|
98
|
+
* Most useful for scenarios where a HOC may interfere with typing
|
|
99
|
+
*/
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
exports.withEuiTheme = withEuiTheme;
|
|
103
|
+
|
|
104
|
+
var RenderWithEuiTheme = function RenderWithEuiTheme(_ref) {
|
|
105
|
+
var children = _ref.children;
|
|
106
|
+
var theme = useEuiTheme();
|
|
107
|
+
return children(theme);
|
|
108
|
+
};
|
|
89
109
|
|
|
90
|
-
exports.
|
|
110
|
+
exports.RenderWithEuiTheme = RenderWithEuiTheme;
|
|
@@ -45,6 +45,12 @@ Object.defineProperty(exports, "EuiThemeProvider", {
|
|
|
45
45
|
return _provider.EuiThemeProvider;
|
|
46
46
|
}
|
|
47
47
|
});
|
|
48
|
+
Object.defineProperty(exports, "RenderWithEuiTheme", {
|
|
49
|
+
enumerable: true,
|
|
50
|
+
get: function get() {
|
|
51
|
+
return _hooks.RenderWithEuiTheme;
|
|
52
|
+
}
|
|
53
|
+
});
|
|
48
54
|
Object.defineProperty(exports, "buildTheme", {
|
|
49
55
|
enumerable: true,
|
|
50
56
|
get: function get() {
|
package/package.json
CHANGED