@elastic/eui 72.2.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.
Files changed (99) hide show
  1. package/dist/eui_theme_dark.css +15 -67
  2. package/dist/eui_theme_dark.min.css +1 -1
  3. package/dist/eui_theme_light.css +15 -67
  4. package/dist/eui_theme_light.min.css +1 -1
  5. package/es/components/basic_table/basic_table.js +56 -101
  6. package/es/components/basic_table/basic_table.styles.js +45 -0
  7. package/es/components/datagrid/controls/column_selector.js +23 -7
  8. package/es/components/datagrid/controls/column_sorting_draggable.js +17 -8
  9. package/es/components/datagrid/data_grid.a11y.js +3 -2
  10. package/es/components/modal/confirm_modal.js +5 -3
  11. package/es/components/modal/modal.a11y.js +1 -1
  12. package/es/components/modal/modal_header_title.js +12 -3
  13. package/es/components/notification/notification_event.a11y.js +113 -0
  14. package/es/components/page/page_header/page_header.a11y.js +32 -0
  15. package/es/components/portal/portal.a11y.js +70 -0
  16. package/es/components/resizable_container/resizable_panel.js +5 -0
  17. package/es/components/tool_tip/tool_tip.js +10 -5
  18. package/es/components/tool_tip/tool_tip_manager.js +42 -0
  19. package/es/services/security/get_secure_rel_for_target.js +2 -8
  20. package/es/services/theme/hooks.js +18 -0
  21. package/es/services/theme/index.js +1 -1
  22. package/eui.d.ts +57 -19
  23. package/i18ntokens.json +54 -38
  24. package/lib/components/basic_table/basic_table.js +56 -100
  25. package/lib/components/basic_table/basic_table.styles.js +54 -0
  26. package/lib/components/datagrid/controls/column_selector.js +21 -6
  27. package/lib/components/datagrid/controls/column_sorting_draggable.js +17 -8
  28. package/lib/components/datagrid/data_grid.a11y.js +3 -2
  29. package/lib/components/modal/confirm_modal.js +5 -3
  30. package/lib/components/modal/modal.a11y.js +1 -1
  31. package/lib/components/modal/modal_header_title.js +12 -3
  32. package/lib/components/notification/notification_event.a11y.js +117 -0
  33. package/lib/components/page/page_header/page_header.a11y.js +40 -0
  34. package/lib/components/portal/portal.a11y.js +73 -0
  35. package/lib/components/resizable_container/resizable_panel.js +5 -0
  36. package/lib/components/tool_tip/tool_tip.js +13 -7
  37. package/lib/components/tool_tip/tool_tip_manager.js +50 -0
  38. package/lib/services/security/get_secure_rel_for_target.js +2 -9
  39. package/lib/services/theme/hooks.js +22 -2
  40. package/lib/services/theme/index.js +6 -0
  41. package/optimize/es/components/basic_table/basic_table.js +56 -101
  42. package/optimize/es/components/basic_table/basic_table.styles.js +45 -0
  43. package/optimize/es/components/datagrid/controls/column_selector.js +22 -7
  44. package/optimize/es/components/datagrid/controls/column_sorting_draggable.js +17 -8
  45. package/optimize/es/components/datagrid/data_grid.a11y.js +3 -2
  46. package/optimize/es/components/modal/confirm_modal.js +4 -3
  47. package/optimize/es/components/modal/modal.a11y.js +1 -1
  48. package/optimize/es/components/modal/modal_header_title.js +4 -2
  49. package/optimize/es/components/notification/notification_event.a11y.js +103 -0
  50. package/optimize/es/components/page/page_header/page_header.a11y.js +32 -0
  51. package/optimize/es/components/portal/portal.a11y.js +60 -0
  52. package/optimize/es/components/tool_tip/tool_tip.js +10 -5
  53. package/optimize/es/components/tool_tip/tool_tip_manager.js +41 -0
  54. package/optimize/es/services/security/get_secure_rel_for_target.js +2 -8
  55. package/optimize/es/services/theme/hooks.js +18 -0
  56. package/optimize/es/services/theme/index.js +1 -1
  57. package/optimize/lib/components/basic_table/basic_table.js +56 -95
  58. package/optimize/lib/components/basic_table/basic_table.styles.js +56 -0
  59. package/optimize/lib/components/datagrid/controls/column_selector.js +21 -6
  60. package/optimize/lib/components/datagrid/controls/column_sorting_draggable.js +17 -8
  61. package/optimize/lib/components/datagrid/data_grid.a11y.js +3 -2
  62. package/optimize/lib/components/modal/confirm_modal.js +4 -3
  63. package/optimize/lib/components/modal/modal.a11y.js +1 -1
  64. package/optimize/lib/components/modal/modal_header_title.js +4 -2
  65. package/optimize/lib/components/notification/notification_event.a11y.js +117 -0
  66. package/optimize/lib/components/page/page_header/page_header.a11y.js +40 -0
  67. package/optimize/lib/components/portal/portal.a11y.js +73 -0
  68. package/optimize/lib/components/tool_tip/tool_tip.js +13 -7
  69. package/optimize/lib/components/tool_tip/tool_tip_manager.js +49 -0
  70. package/optimize/lib/services/security/get_secure_rel_for_target.js +2 -9
  71. package/optimize/lib/services/theme/hooks.js +22 -2
  72. package/optimize/lib/services/theme/index.js +6 -0
  73. package/package.json +1 -1
  74. package/src/components/datagrid/controls/_data_grid_column_sorting.scss +14 -13
  75. package/src/components/index.scss +0 -1
  76. package/test-env/components/basic_table/basic_table.js +56 -95
  77. package/test-env/components/basic_table/basic_table.styles.js +56 -0
  78. package/test-env/components/datagrid/controls/column_selector.js +21 -6
  79. package/test-env/components/datagrid/controls/column_sorting_draggable.js +17 -8
  80. package/test-env/components/datagrid/data_grid.a11y.js +3 -2
  81. package/test-env/components/modal/confirm_modal.js +5 -3
  82. package/test-env/components/modal/modal.a11y.js +1 -1
  83. package/test-env/components/modal/modal_header_title.js +12 -3
  84. package/test-env/components/notification/notification_event.a11y.js +117 -0
  85. package/test-env/components/page/page_header/page_header.a11y.js +40 -0
  86. package/test-env/components/portal/portal.a11y.js +73 -0
  87. package/test-env/components/resizable_container/resizable_panel.js +5 -0
  88. package/test-env/components/tool_tip/tool_tip.js +13 -7
  89. package/test-env/components/tool_tip/tool_tip_manager.js +49 -0
  90. package/test-env/services/security/get_secure_rel_for_target.js +2 -9
  91. package/test-env/services/theme/hooks.js +22 -2
  92. package/test-env/services/theme/index.js +6 -0
  93. package/es/services/url.js +0 -23
  94. package/lib/services/url.js +0 -32
  95. package/optimize/es/services/url.js +0 -23
  96. package/optimize/lib/services/url.js +0 -32
  97. package/src/components/basic_table/_basic_table.scss +0 -41
  98. package/src/components/basic_table/_index.scss +0 -1
  99. package/test-env/services/url.js +0 -32
@@ -64,6 +64,8 @@ var _delay_render = require("../delay_render");
64
64
 
65
65
  var _accessibility2 = require("../../services/accessibility");
66
66
 
67
+ var _basic_table = require("./basic_table.styles");
68
+
67
69
  var _react2 = require("@emotion/react");
68
70
 
69
71
  var _excluded = ["className", "loading", "items", "itemId", "columns", "pagination", "sorting", "selection", "onChange", "error", "noItemsMessage", "compressed", "itemIdToExpandedRowMap", "responsive", "isSelectable", "isExpandable", "hasActions", "rowProps", "cellProps", "tableCaption", "rowHeader", "tableLayout"],
@@ -184,40 +186,6 @@ var EuiBasicTable = /*#__PURE__*/function (_Component) {
184
186
 
185
187
  (0, _classCallCheck2.default)(this, EuiBasicTable);
186
188
  _this = _super.call(this, props);
187
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "cleanups", []);
188
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "tbody", null);
189
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "setTbody", function (tbody) {
190
- // remove listeners from an existing element
191
- _this.removeLoadingListeners(); // update the ref
192
-
193
-
194
- _this.tbody = tbody; // if loading, add listeners
195
-
196
- if (_this.props.loading === true && tbody) {
197
- _this.addLoadingListeners(tbody);
198
- }
199
- });
200
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "addLoadingListeners", function (tbody) {
201
- var listener = function listener(event) {
202
- event.stopPropagation();
203
- event.preventDefault();
204
- };
205
-
206
- ['mousedown', 'mouseup', 'mouseover', 'mouseout', 'mouseenter', 'mouseleave', 'click', 'dblclick', 'keydown', 'keyup', 'keypress'].forEach(function (event) {
207
- tbody.addEventListener(event, listener, true);
208
-
209
- _this.cleanups.push(function () {
210
- tbody.removeEventListener(event, listener, true);
211
- });
212
- });
213
- });
214
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "removeLoadingListeners", function () {
215
- _this.cleanups.forEach(function (cleanup) {
216
- return cleanup();
217
- });
218
-
219
- _this.cleanups.length = 0;
220
- });
221
189
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "tableId", (0, _accessibility2.htmlIdGenerator)('__table')());
222
190
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "selectAllIdGenerator", (0, _accessibility2.htmlIdGenerator)('_selection_column-checkbox'));
223
191
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "renderSelectAll", function (isMobile) {
@@ -304,27 +272,13 @@ var EuiBasicTable = /*#__PURE__*/function (_Component) {
304
272
  (0, _createClass2.default)(EuiBasicTable, [{
305
273
  key: "componentDidMount",
306
274
  value: function componentDidMount() {
307
- if (this.props.loading && this.tbody) this.addLoadingListeners(this.tbody);
308
275
  this.getInitialSelection();
309
276
  }
310
277
  }, {
311
278
  key: "componentDidUpdate",
312
- value: function componentDidUpdate(prevProps) {
313
- if (prevProps.loading !== this.props.loading) {
314
- if (this.props.loading && this.tbody) {
315
- this.addLoadingListeners(this.tbody);
316
- } else {
317
- this.removeLoadingListeners();
318
- }
319
- }
320
-
279
+ value: function componentDidUpdate() {
321
280
  this.getInitialSelection();
322
281
  }
323
- }, {
324
- key: "componentWillUnmount",
325
- value: function componentWillUnmount() {
326
- this.removeLoadingListeners();
327
- }
328
282
  }, {
329
283
  key: "getInitialSelection",
330
284
  value: function getInitialSelection() {
@@ -484,7 +438,8 @@ var EuiBasicTable = /*#__PURE__*/function (_Component) {
484
438
  var _this$props3 = this.props,
485
439
  compressed = _this$props3.compressed,
486
440
  responsive = _this$props3.responsive,
487
- tableLayout = _this$props3.tableLayout;
441
+ tableLayout = _this$props3.tableLayout,
442
+ loading = _this$props3.loading;
488
443
  var mobileHeader = responsive ? (0, _react2.jsx)(_table.EuiTableHeaderMobile, null, (0, _react2.jsx)(_flex.EuiFlexGroup, {
489
444
  responsive: false,
490
445
  justifyContent: "spaceBetween",
@@ -502,7 +457,8 @@ var EuiBasicTable = /*#__PURE__*/function (_Component) {
502
457
  id: this.tableId,
503
458
  tableLayout: tableLayout,
504
459
  responsive: responsive,
505
- compressed: compressed
460
+ compressed: compressed,
461
+ css: loading && _basic_table.safariLoadingWorkaround
506
462
  }, caption, head, body, footer));
507
463
  }
508
464
  }, {
@@ -765,30 +721,35 @@ var EuiBasicTable = /*#__PURE__*/function (_Component) {
765
721
  value: function renderTableBody() {
766
722
  var _this4 = this;
767
723
 
768
- if (this.props.error) {
769
- return this.renderErrorBody(this.props.error);
770
- }
771
-
772
- var items = this.props.items;
773
-
774
- if (items.length === 0) {
775
- return this.renderEmptyBody();
724
+ var _this$props8 = this.props,
725
+ error = _this$props8.error,
726
+ loading = _this$props8.loading,
727
+ items = _this$props8.items;
728
+ var content;
729
+
730
+ if (error) {
731
+ content = this.renderErrorMessage(error);
732
+ } else if (items.length === 0) {
733
+ content = this.renderEmptyMessage();
734
+ } else {
735
+ content = items.map(function (item, index) {
736
+ // if there's pagination the item's index must be adjusted to the where it is in the whole dataset
737
+ var tableItemIndex = hasPagination(_this4.props) && _this4.props.pagination.pageSize > 0 ? _this4.props.pagination.pageIndex * _this4.props.pagination.pageSize + index : index;
738
+ return _this4.renderItemRow(item, tableItemIndex);
739
+ });
776
740
  }
777
741
 
778
- var rows = items.map(function (item, index) {
779
- // if there's pagination the item's index must be adjusted to the where it is in the whole dataset
780
- var tableItemIndex = hasPagination(_this4.props) && _this4.props.pagination.pageSize > 0 ? _this4.props.pagination.pageIndex * _this4.props.pagination.pageSize + index : index;
781
- return _this4.renderItemRow(item, tableItemIndex);
742
+ return (0, _react2.jsx)(_services.RenderWithEuiTheme, null, function (theme) {
743
+ return (0, _react2.jsx)(_table.EuiTableBody, {
744
+ css: loading && (0, _basic_table.euiBasicTableBodyLoading)(theme)
745
+ }, content);
782
746
  });
783
- return (0, _react2.jsx)(_table.EuiTableBody, {
784
- bodyRef: this.setTbody
785
- }, rows);
786
747
  }
787
748
  }, {
788
- key: "renderErrorBody",
789
- value: function renderErrorBody(error) {
749
+ key: "renderErrorMessage",
750
+ value: function renderErrorMessage(error) {
790
751
  var colSpan = this.props.columns.length + (this.props.selection ? 1 : 0);
791
- return (0, _react2.jsx)(_table.EuiTableBody, null, (0, _react2.jsx)(_table.EuiTableRow, null, (0, _react2.jsx)(_table.EuiTableRowCell, {
752
+ return (0, _react2.jsx)(_table.EuiTableRow, null, (0, _react2.jsx)(_table.EuiTableRowCell, {
792
753
  align: "center",
793
754
  colSpan: colSpan,
794
755
  mobileOptions: {
@@ -797,38 +758,38 @@ var EuiBasicTable = /*#__PURE__*/function (_Component) {
797
758
  }, (0, _react2.jsx)(_icon.EuiIcon, {
798
759
  type: "minusInCircle",
799
760
  color: "danger"
800
- }), " ", error)));
761
+ }), " ", error));
801
762
  }
802
763
  }, {
803
- key: "renderEmptyBody",
804
- value: function renderEmptyBody() {
805
- var _this$props8 = this.props,
806
- columns = _this$props8.columns,
807
- selection = _this$props8.selection,
808
- noItemsMessage = _this$props8.noItemsMessage;
764
+ key: "renderEmptyMessage",
765
+ value: function renderEmptyMessage() {
766
+ var _this$props9 = this.props,
767
+ columns = _this$props9.columns,
768
+ selection = _this$props9.selection,
769
+ noItemsMessage = _this$props9.noItemsMessage;
809
770
  var colSpan = columns.length + (selection ? 1 : 0);
810
- return (0, _react2.jsx)(_table.EuiTableBody, null, (0, _react2.jsx)(_table.EuiTableRow, null, (0, _react2.jsx)(_table.EuiTableRowCell, {
771
+ return (0, _react2.jsx)(_table.EuiTableRow, null, (0, _react2.jsx)(_table.EuiTableRowCell, {
811
772
  align: "center",
812
773
  colSpan: colSpan,
813
774
  mobileOptions: {
814
775
  width: '100%'
815
776
  }
816
- }, noItemsMessage)));
777
+ }, noItemsMessage));
817
778
  }
818
779
  }, {
819
780
  key: "renderItemRow",
820
781
  value: function renderItemRow(item, rowIndex) {
821
782
  var _this5 = this;
822
783
 
823
- var _this$props9 = this.props,
824
- columns = _this$props9.columns,
825
- selection = _this$props9.selection,
826
- isSelectable = _this$props9.isSelectable,
827
- hasActions = _this$props9.hasActions,
828
- rowHeader = _this$props9.rowHeader,
829
- _this$props9$itemIdTo = _this$props9.itemIdToExpandedRowMap,
830
- itemIdToExpandedRowMap = _this$props9$itemIdTo === void 0 ? {} : _this$props9$itemIdTo,
831
- isExpandable = _this$props9.isExpandable;
784
+ var _this$props10 = this.props,
785
+ columns = _this$props10.columns,
786
+ selection = _this$props10.selection,
787
+ isSelectable = _this$props10.isSelectable,
788
+ hasActions = _this$props10.hasActions,
789
+ rowHeader = _this$props10.rowHeader,
790
+ _this$props10$itemIdT = _this$props10.itemIdToExpandedRowMap,
791
+ itemIdToExpandedRowMap = _this$props10$itemIdT === void 0 ? {} : _this$props10$itemIdT,
792
+ isExpandable = _this$props10.isExpandable;
832
793
  var cells = [];
833
794
  var itemIdCallback = this.props.itemId;
834
795
  var itemId = getItemId(item, itemIdCallback) != null ? getItemId(item, itemIdCallback) : rowIndex;
@@ -980,7 +941,8 @@ var EuiBasicTable = /*#__PURE__*/function (_Component) {
980
941
  key: key,
981
942
  align: "right",
982
943
  textOnly: false,
983
- hasActions: true
944
+ hasActions: true,
945
+ css: _basic_table.euiBasicTableActionsWrapper
984
946
  }, tools);
985
947
  }
986
948
  }, {
@@ -1064,11 +1026,11 @@ var EuiBasicTable = /*#__PURE__*/function (_Component) {
1064
1026
  value: function renderPaginationBar() {
1065
1027
  var _this8 = this;
1066
1028
 
1067
- var _this$props10 = this.props,
1068
- error = _this$props10.error,
1069
- pagination = _this$props10.pagination,
1070
- tableCaption = _this$props10.tableCaption,
1071
- onChange = _this$props10.onChange;
1029
+ var _this$props11 = this.props,
1030
+ error = _this$props11.error,
1031
+ pagination = _this$props11.pagination,
1032
+ tableCaption = _this$props11.tableCaption,
1033
+ onChange = _this$props11.onChange;
1072
1034
 
1073
1035
  if (!error && pagination && pagination.totalItemCount > 0) {
1074
1036
  if (!onChange) {
@@ -1120,8 +1082,7 @@ var EuiBasicTable = /*#__PURE__*/function (_Component) {
1120
1082
  }
1121
1083
 
1122
1084
  return null;
1123
- } // used for moving in & out of `loading` state
1124
-
1085
+ }
1125
1086
  }]);
1126
1087
  return EuiBasicTable;
1127
1088
  }(_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;
@@ -11,6 +11,8 @@ exports.useDataGridColumnSelector = void 0;
11
11
 
12
12
  var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
13
13
 
14
+ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
15
+
14
16
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
15
17
 
16
18
  var _react = _interopRequireWildcard(require("react"));
@@ -107,6 +109,7 @@ var useDataGridColumnSelector = function useDataGridColumnSelector(availableColu
107
109
  }, [sortedColumns, columnSearchText, displayValues]);
108
110
  var isDragEnabled = allowColumnReorder && columnSearchText.length === 0; // only allow drag-and-drop when not filtering columns
109
111
 
112
+ var dragHandleAriaLabel = (0, _i18n.useEuiI18n)('euiColumnSelector.dragHandleAriaLabel', 'Drag handle');
110
113
  var buttonText = (0, _react2.jsx)(_i18n.EuiI18n, {
111
114
  token: "euiColumnSelector.button",
112
115
  default: "Columns"
@@ -179,18 +182,23 @@ var useDataGridColumnSelector = function useDataGridColumnSelector(availableColu
179
182
  key: id,
180
183
  draggableId: id,
181
184
  index: index,
182
- isDragDisabled: !isDragEnabled
185
+ isDragDisabled: !isDragEnabled,
186
+ hasInteractiveChildren: true,
187
+ customDragHandle: true
183
188
  }, function (provided, state) {
184
189
  return (0, _react2.jsx)("div", {
185
190
  className: "euiDataGridColumnSelector__item ".concat(state.isDragging && 'euiDataGridColumnSelector__item-isDragging'),
186
191
  "data-test-subj": "dataGridColumnSelectorColumnItem-".concat(id)
187
192
  }, (0, _react2.jsx)(_flex.EuiFlexGroup, {
188
193
  responsive: false,
189
- gutterSize: "m",
194
+ gutterSize: "s",
190
195
  alignItems: "center"
191
- }, (0, _react2.jsx)(_flex.EuiFlexItem, null, allowColumnHiding ? (0, _react2.jsx)(_form.EuiSwitch, {
196
+ }, allowColumnHiding && (0, _react2.jsx)(_flex.EuiFlexItem, {
197
+ grow: false
198
+ }, (0, _react2.jsx)(_form.EuiSwitch, {
192
199
  name: id,
193
200
  label: displayValues[id] || id,
201
+ showLabel: false,
194
202
  checked: visibleColumnIds.has(id),
195
203
  compressed: true,
196
204
  className: "euiSwitch--mini",
@@ -202,11 +210,18 @@ var useDataGridColumnSelector = function useDataGridColumnSelector(availableColu
202
210
  setVisibleColumns(nextVisibleColumns);
203
211
  },
204
212
  "data-test-subj": "dataGridColumnSelectorToggleColumnVisibility-".concat(id)
205
- }) : (0, _react2.jsx)("span", {
213
+ })), (0, _react2.jsx)(_flex.EuiFlexItem // This extra column name flex item affords the column more grabbable real estate
214
+ // for mouse users, while hiding repetition for keyboard/screen reader users
215
+ , (0, _extends2.default)({}, provided.dragHandleProps, {
216
+ "aria-hidden": true,
217
+ tabIndex: -1
218
+ }), (0, _react2.jsx)("span", {
206
219
  className: "euiDataGridColumnSelector__itemLabel"
207
- }, id)), isDragEnabled && (0, _react2.jsx)(_flex.EuiFlexItem, {
220
+ }, displayValues[id] || id)), isDragEnabled && (0, _react2.jsx)(_flex.EuiFlexItem, (0, _extends2.default)({
208
221
  grow: false
209
- }, (0, _react2.jsx)(_icon.EuiIcon, {
222
+ }, provided.dragHandleProps, {
223
+ "aria-label": dragHandleAriaLabel
224
+ }), (0, _react2.jsx)(_icon.EuiIcon, {
210
225
  type: "grab",
211
226
  color: "subdued"
212
227
  }))));
@@ -75,7 +75,9 @@ var EuiDataGridColumnSortingDraggable = function EuiDataGridColumnSortingDraggab
75
75
  var dragHandleAriaLabel = (0, _i18n.useEuiI18n)('euiColumnSortingDraggable.dragHandleAriaLabel', 'Drag handle');
76
76
  return (0, _react2.jsx)(_drag_and_drop.EuiDraggable, (0, _extends2.default)({
77
77
  draggableId: id,
78
- index: index
78
+ index: index,
79
+ hasInteractiveChildren: true,
80
+ customDragHandle: true
79
81
  }, rest), function (provided, state) {
80
82
  return (0, _react2.jsx)("div", {
81
83
  className: "euiDataGridColumnSorting__item ".concat(state.isDragging && 'euiDataGridColumnSorting__item-isDragging')
@@ -116,18 +118,25 @@ var EuiDataGridColumnSortingDraggable = function EuiDataGridColumnSortingDraggab
116
118
  sorting.onSort(nextColumns);
117
119
  }
118
120
  });
119
- })), (0, _react2.jsx)(_flex.EuiFlexItem, {
121
+ })), (0, _react2.jsx)(_flex.EuiFlexItem, (0, _extends2.default)({
122
+ className: "euiDataGridColumnSorting__name" // This extra column name flex item affords the column more grabbable real estate
123
+ // for mouse users, while hiding repetition for keyboard/screen reader users
124
+
125
+ }, provided.dragHandleProps, {
126
+ tabIndex: -1,
127
+ "aria-hidden": true
128
+ }), (0, _react2.jsx)(_flex.EuiFlexGroup, {
129
+ gutterSize: "xs",
130
+ alignItems: "center",
131
+ responsive: false
132
+ }, (0, _react2.jsx)(_flex.EuiFlexItem, {
120
133
  grow: false
121
134
  }, (0, _react2.jsx)(_token.EuiToken, {
122
135
  color: schemaDetails != null ? schemaDetails.color : undefined,
123
136
  iconType: schemaDetails != null ? schemaDetails.icon : 'tokenString'
124
- })), (0, _react2.jsx)(_flex.EuiFlexItem, {
125
- "aria-hidden": true
126
- }, (0, _react2.jsx)(_text.EuiText, {
137
+ })), (0, _react2.jsx)(_flex.EuiFlexItem, null, (0, _react2.jsx)(_text.EuiText, {
127
138
  size: "xs"
128
- }, (0, _react2.jsx)("p", null, display))), (0, _react2.jsx)(_flex.EuiFlexItem, {
129
- className: "euiDataGridColumnSorting__orderButtons"
130
- }, (0, _react2.jsx)(_i18n.EuiI18n, {
139
+ }, (0, _react2.jsx)("p", null, display))))), (0, _react2.jsx)(_flex.EuiFlexItem, null, (0, _react2.jsx)(_i18n.EuiI18n, {
131
140
  token: "euiColumnSortingDraggable.toggleLegend",
132
141
  default: "Select sorting method for {display}",
133
142
  values: {
@@ -181,7 +181,7 @@ describe('EuiDataGrid', function () {
181
181
  it('has zero violations on first render', function () {
182
182
  cy.checkAxe();
183
183
  });
184
- it('has zero violations when the columns reorder menu is open', function () {
184
+ it('has zero violations when the columns visibility menu is open', function () {
185
185
  cy.get('button[data-test-subj="dataGridColumnSelectorButton"]').realClick();
186
186
  cy.checkAxe();
187
187
  });
@@ -234,9 +234,10 @@ describe('EuiDataGrid', function () {
234
234
  cy.get('div[data-gridcell-visible-row-index="0"][data-gridcell-column-index="1"]').find('button.euiButtonIcon').last().realClick();
235
235
  cy.checkAxe();
236
236
  });
237
- it('has zero violations when the Favorite Distro column has been sorted', function () {
237
+ it('has zero violations on sort and when the columns sorting menu is open', function () {
238
238
  cy.get('button.euiDataGridHeaderCell__button').last().realClick();
239
239
  cy.get('button.euiListGroupItem__button').contains('Sort Alma to Debian').should('exist').realClick();
240
+ cy.get('button[data-test-subj="dataGridColumnSortingPopover"]').realClick();
240
241
  cy.checkAxe();
241
242
  });
242
243
  it('has zero violations when fullscreen is open', function () {
@@ -41,7 +41,7 @@ var _text = require("../text");
41
41
 
42
42
  var _react2 = require("@emotion/react");
43
43
 
44
- var _excluded = ["children", "title", "onCancel", "onConfirm", "cancelButtonText", "confirmButtonText", "confirmButtonDisabled", "className", "buttonColor", "defaultFocusedButton", "isLoading"];
44
+ var _excluded = ["children", "title", "titleProps", "onCancel", "onConfirm", "cancelButtonText", "confirmButtonText", "confirmButtonDisabled", "className", "buttonColor", "defaultFocusedButton", "isLoading"];
45
45
 
46
46
  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); }
47
47
 
@@ -55,6 +55,7 @@ exports.CANCEL_BUTTON = CANCEL_BUTTON;
55
55
  var EuiConfirmModal = function EuiConfirmModal(_ref) {
56
56
  var children = _ref.children,
57
57
  title = _ref.title,
58
+ titleProps = _ref.titleProps,
58
59
  onCancel = _ref.onCancel,
59
60
  onConfirm = _ref.onConfirm,
60
61
  cancelButtonText = _ref.cancelButtonText,
@@ -106,9 +107,9 @@ var EuiConfirmModal = function EuiConfirmModal(_ref) {
106
107
  var modalTitle;
107
108
 
108
109
  if (title) {
109
- modalTitle = (0, _react2.jsx)(_modal_header.EuiModalHeader, null, (0, _react2.jsx)(_modal_header_title.EuiModalHeaderTitle, {
110
+ modalTitle = (0, _react2.jsx)(_modal_header.EuiModalHeader, null, (0, _react2.jsx)(_modal_header_title.EuiModalHeaderTitle, (0, _extends2.default)({
110
111
  "data-test-subj": "confirmModalTitleText"
111
- }, title));
112
+ }, titleProps), title));
112
113
  }
113
114
 
114
115
  var message;
@@ -147,6 +148,7 @@ EuiConfirmModal.propTypes = {
147
148
  */
148
149
  children: _propTypes.default.node,
149
150
  title: _propTypes.default.node,
151
+ titleProps: _propTypes.default.any,
150
152
  cancelButtonText: _propTypes.default.node,
151
153
  confirmButtonText: _propTypes.default.node,
152
154
  onCancel: _propTypes.default.func.isRequired,
@@ -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, (0, _react2.jsx)("h1", 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, {
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"))));
@@ -21,17 +21,19 @@ var _title = require("../title");
21
21
 
22
22
  var _react2 = require("@emotion/react");
23
23
 
24
- var _excluded = ["className", "children"];
24
+ var _excluded = ["className", "children", "component"];
25
25
 
26
26
  var EuiModalHeaderTitle = function EuiModalHeaderTitle(_ref) {
27
27
  var className = _ref.className,
28
28
  children = _ref.children,
29
+ _ref$component = _ref.component,
30
+ Component = _ref$component === void 0 ? 'h1' : _ref$component,
29
31
  rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
30
32
  var classes = (0, _classnames.default)('euiModalHeader__title', className);
31
33
  return (0, _react2.jsx)(_title.EuiTitle, (0, _extends2.default)({
32
34
  size: "m",
33
35
  className: classes
34
- }, rest), /*#__PURE__*/_react.default.isValidElement(children) ? children : (0, _react2.jsx)("h1", null, children));
36
+ }, rest), (0, _react2.jsx)(Component, null, children));
35
37
  };
36
38
 
37
39
  exports.EuiModalHeaderTitle = EuiModalHeaderTitle;
@@ -39,5 +41,12 @@ EuiModalHeaderTitle.propTypes = {
39
41
  className: _propTypes.default.string,
40
42
  "aria-label": _propTypes.default.string,
41
43
  "data-test-subj": _propTypes.default.string,
42
- css: _propTypes.default.any
44
+ css: _propTypes.default.any,
45
+
46
+ /**
47
+ * The tag to render. Can be changed to a lower heading
48
+ * level like `h2` or a container `div`.
49
+ * @default h1
50
+ */
51
+ component: _propTypes.default.any
43
52
  };
@@ -0,0 +1,117 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ var _typeof = require("@babel/runtime/helpers/typeof");
6
+
7
+ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
8
+
9
+ var _react = _interopRequireWildcard(require("react"));
10
+
11
+ var _context_menu = require("../context_menu");
12
+
13
+ var _notification_event = require("./notification_event");
14
+
15
+ var _panel = require("../panel");
16
+
17
+ var _react2 = require("@emotion/react");
18
+
19
+ 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); }
20
+
21
+ 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; }
22
+
23
+ /*
24
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
25
+ * or more contributor license agreements. Licensed under the Elastic License
26
+ * 2.0 and the Server Side Public License, v 1; you may not use this file except
27
+ * in compliance with, at your election, the Elastic License 2.0 or the Server
28
+ * Side Public License, v 1.
29
+ */
30
+ /// <reference types="../../../cypress/support"/>
31
+ var NotificationEvent = function NotificationEvent() {
32
+ var _useState = (0, _react.useState)(false),
33
+ _useState2 = (0, _slicedToArray2.default)(_useState, 2),
34
+ isRead = _useState2[0],
35
+ setIsRead = _useState2[1];
36
+
37
+ var onRead = function onRead(id, isRead) {
38
+ setIsRead(!isRead);
39
+ };
40
+
41
+ var onOpenContextMenu = function onOpenContextMenu(id) {
42
+ return [(0, _react2.jsx)(_context_menu.EuiContextMenuItem, {
43
+ key: "contextMenuItemA",
44
+ onClick: function onClick() {
45
+ return onRead(id, isRead);
46
+ }
47
+ }, isRead ? 'Mark as unread' : 'Mark as read'), (0, _react2.jsx)(_context_menu.EuiContextMenuItem, {
48
+ key: "contextMenuItemB",
49
+ onClick: function onClick() {}
50
+ }, "View messages like this"), (0, _react2.jsx)(_context_menu.EuiContextMenuItem, {
51
+ key: "contextMenuItemC",
52
+ onClick: function onClick() {}
53
+ }, "Don\u2019t notify me about this")];
54
+ };
55
+
56
+ return (0, _react2.jsx)(_panel.EuiPanel, {
57
+ paddingSize: "none",
58
+ hasShadow: true,
59
+ style: {
60
+ maxWidth: '540px'
61
+ }
62
+ }, (0, _react2.jsx)(_notification_event.EuiNotificationEvent, {
63
+ id: "cy-eui-notification-1",
64
+ type: "Report",
65
+ iconType: "logoKibana",
66
+ iconAriaLabel: "Kibana",
67
+ time: "1 min ago",
68
+ title: "[Error Monitoring Report] is generated",
69
+ primaryAction: "Download",
70
+ primaryActionProps: {
71
+ iconType: 'download'
72
+ },
73
+ messages: ['The reported was generated at 17:12:16 GMT+4'],
74
+ isRead: isRead,
75
+ onRead: onRead,
76
+ onOpenContextMenu: onOpenContextMenu,
77
+ onClickPrimaryAction: function onClickPrimaryAction() {},
78
+ onClickTitle: function onClickTitle() {}
79
+ }));
80
+ };
81
+
82
+ describe('EuiNotificationEvent', function () {
83
+ beforeEach(function () {
84
+ cy.viewport(1024, 768); // medium breakpoint
85
+
86
+ cy.realMount((0, _react2.jsx)(NotificationEvent, null));
87
+ cy.get('article.euiNotificationEvent').should('exist');
88
+ });
89
+ describe('Automated accessibility check', function () {
90
+ it('has zero violations on first render', function () {
91
+ cy.checkAxe();
92
+ });
93
+ it('has zero violations when popover is open', function () {
94
+ cy.get('button[data-test-subj="cy-eui-notification-1-notificationEventMetaButton"]').realClick();
95
+ cy.get('div.euiPopover__panel').should('exist');
96
+ cy.checkAxe();
97
+ });
98
+ it('has zero violations after the Mark as read button is clicked', function () {
99
+ cy.get('button[data-test-subj="cy-eui-notification-1-notificationEventMetaButton"]').realClick();
100
+ cy.get('div.euiPopover__panel').should('exist');
101
+ cy.get('div.euiPopover__panel button').first().realClick();
102
+ cy.checkAxe();
103
+ });
104
+ });
105
+ describe('Keyboard accessibility', function () {
106
+ it('has zero violations when the popover is opened by keyboard', function () {
107
+ cy.repeatRealPress('Tab');
108
+ cy.get('button[data-test-subj="cy-eui-notification-1-notificationEventMetaButton"]').should('have.focus');
109
+ cy.realPress('Enter');
110
+ cy.get('div.euiPopover__panel').should('exist');
111
+ cy.checkAxe();
112
+ cy.realPress('Escape');
113
+ cy.get('div.euiPopover__panel').should('not.exist');
114
+ cy.checkAxe();
115
+ });
116
+ });
117
+ });