@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
@@ -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(prevProps) {
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
- if (this.props.error) {
743
- return this.renderErrorBody(this.props.error);
744
- }
745
-
746
- var items = this.props.items;
747
-
748
- if (items.length === 0) {
749
- return this.renderEmptyBody();
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
- var rows = items.map(function (item, index) {
753
- // if there's pagination the item's index must be adjusted to the where it is in the whole dataset
754
- var tableItemIndex = hasPagination(_this4.props) && _this4.props.pagination.pageSize > 0 ? _this4.props.pagination.pageIndex * _this4.props.pagination.pageSize + index : index;
755
- return _this4.renderItemRow(item, tableItemIndex);
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: "renderErrorBody",
763
- value: function renderErrorBody(error) {
717
+ key: "renderErrorMessage",
718
+ value: function renderErrorMessage(error) {
764
719
  var colSpan = this.props.columns.length + (this.props.selection ? 1 : 0);
765
- return ___EmotionJSX(EuiTableBody, null, ___EmotionJSX(EuiTableRow, null, ___EmotionJSX(EuiTableRowCell, {
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: "renderEmptyBody",
778
- value: function renderEmptyBody() {
779
- var _this$props8 = this.props,
780
- columns = _this$props8.columns,
781
- selection = _this$props8.selection,
782
- noItemsMessage = _this$props8.noItemsMessage;
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(EuiTableBody, null, ___EmotionJSX(EuiTableRow, null, ___EmotionJSX(EuiTableRowCell, {
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$props9 = this.props,
798
- columns = _this$props9.columns,
799
- selection = _this$props9.selection,
800
- isSelectable = _this$props9.isSelectable,
801
- hasActions = _this$props9.hasActions,
802
- rowHeader = _this$props9.rowHeader,
803
- _this$props9$itemIdTo = _this$props9.itemIdToExpandedRowMap,
804
- itemIdToExpandedRowMap = _this$props9$itemIdTo === void 0 ? {} : _this$props9$itemIdTo,
805
- isExpandable = _this$props9.isExpandable;
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$props10 = this.props,
1046
- error = _this$props10.error,
1047
- pagination = _this$props10.pagination,
1048
- tableCaption = _this$props10.tableCaption,
1049
- onChange = _this$props10.onChange;
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
- } // used for moving in & out of `loading` state
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,4 +1,5 @@
1
1
  import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
2
+ import _extends from "@babel/runtime/helpers/extends";
2
3
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
3
4
 
4
5
  /*
@@ -11,7 +12,7 @@ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
11
12
  import React, { Fragment, useState, useMemo, useCallback } from 'react';
12
13
  import classNames from 'classnames';
13
14
  import { EuiPopover, EuiPopoverFooter, EuiPopoverTitle } from '../../popover';
14
- import { EuiI18n } from '../../i18n';
15
+ import { EuiI18n, useEuiI18n } from '../../i18n';
15
16
  import { EuiButtonEmpty } from '../../button';
16
17
  import { EuiFlexGroup, EuiFlexItem } from '../../flex';
17
18
  import { EuiSwitch, EuiFieldText } from '../../form';
@@ -79,6 +80,8 @@ export var useDataGridColumnSelector = function useDataGridColumnSelector(availa
79
80
  }, [sortedColumns, columnSearchText, displayValues]);
80
81
  var isDragEnabled = allowColumnReorder && columnSearchText.length === 0; // only allow drag-and-drop when not filtering columns
81
82
 
83
+ var dragHandleAriaLabel = useEuiI18n('euiColumnSelector.dragHandleAriaLabel', 'Drag handle');
84
+
82
85
  var buttonText = ___EmotionJSX(EuiI18n, {
83
86
  token: "euiColumnSelector.button",
84
87
  default: "Columns"
@@ -151,18 +154,23 @@ export var useDataGridColumnSelector = function useDataGridColumnSelector(availa
151
154
  key: id,
152
155
  draggableId: id,
153
156
  index: index,
154
- isDragDisabled: !isDragEnabled
157
+ isDragDisabled: !isDragEnabled,
158
+ hasInteractiveChildren: true,
159
+ customDragHandle: true
155
160
  }, function (provided, state) {
156
161
  return ___EmotionJSX("div", {
157
162
  className: "euiDataGridColumnSelector__item ".concat(state.isDragging && 'euiDataGridColumnSelector__item-isDragging'),
158
163
  "data-test-subj": "dataGridColumnSelectorColumnItem-".concat(id)
159
164
  }, ___EmotionJSX(EuiFlexGroup, {
160
165
  responsive: false,
161
- gutterSize: "m",
166
+ gutterSize: "s",
162
167
  alignItems: "center"
163
- }, ___EmotionJSX(EuiFlexItem, null, allowColumnHiding ? ___EmotionJSX(EuiSwitch, {
168
+ }, allowColumnHiding && ___EmotionJSX(EuiFlexItem, {
169
+ grow: false
170
+ }, ___EmotionJSX(EuiSwitch, {
164
171
  name: id,
165
172
  label: displayValues[id] || id,
173
+ showLabel: false,
166
174
  checked: visibleColumnIds.has(id),
167
175
  compressed: true,
168
176
  className: "euiSwitch--mini",
@@ -174,11 +182,18 @@ export var useDataGridColumnSelector = function useDataGridColumnSelector(availa
174
182
  setVisibleColumns(nextVisibleColumns);
175
183
  },
176
184
  "data-test-subj": "dataGridColumnSelectorToggleColumnVisibility-".concat(id)
177
- }) : ___EmotionJSX("span", {
185
+ })), ___EmotionJSX(EuiFlexItem // This extra column name flex item affords the column more grabbable real estate
186
+ // for mouse users, while hiding repetition for keyboard/screen reader users
187
+ , _extends({}, provided.dragHandleProps, {
188
+ "aria-hidden": true,
189
+ tabIndex: -1
190
+ }), ___EmotionJSX("span", {
178
191
  className: "euiDataGridColumnSelector__itemLabel"
179
- }, id)), isDragEnabled && ___EmotionJSX(EuiFlexItem, {
192
+ }, displayValues[id] || id)), isDragEnabled && ___EmotionJSX(EuiFlexItem, _extends({
180
193
  grow: false
181
- }, ___EmotionJSX(EuiIcon, {
194
+ }, provided.dragHandleProps, {
195
+ "aria-label": dragHandleAriaLabel
196
+ }), ___EmotionJSX(EuiIcon, {
182
197
  type: "grab",
183
198
  color: "subdued"
184
199
  }))));
@@ -56,7 +56,9 @@ export var EuiDataGridColumnSortingDraggable = function EuiDataGridColumnSorting
56
56
  var dragHandleAriaLabel = useEuiI18n('euiColumnSortingDraggable.dragHandleAriaLabel', 'Drag handle');
57
57
  return ___EmotionJSX(EuiDraggable, _extends({
58
58
  draggableId: id,
59
- index: index
59
+ index: index,
60
+ hasInteractiveChildren: true,
61
+ customDragHandle: true
60
62
  }, rest), function (provided, state) {
61
63
  return ___EmotionJSX("div", {
62
64
  className: "euiDataGridColumnSorting__item ".concat(state.isDragging && 'euiDataGridColumnSorting__item-isDragging')
@@ -98,18 +100,25 @@ export var EuiDataGridColumnSortingDraggable = function EuiDataGridColumnSorting
98
100
  sorting.onSort(nextColumns);
99
101
  }
100
102
  });
101
- })), ___EmotionJSX(EuiFlexItem, {
103
+ })), ___EmotionJSX(EuiFlexItem, _extends({
104
+ className: "euiDataGridColumnSorting__name" // This extra column name flex item affords the column more grabbable real estate
105
+ // for mouse users, while hiding repetition for keyboard/screen reader users
106
+
107
+ }, provided.dragHandleProps, {
108
+ tabIndex: -1,
109
+ "aria-hidden": true
110
+ }), ___EmotionJSX(EuiFlexGroup, {
111
+ gutterSize: "xs",
112
+ alignItems: "center",
113
+ responsive: false
114
+ }, ___EmotionJSX(EuiFlexItem, {
102
115
  grow: false
103
116
  }, ___EmotionJSX(EuiToken, {
104
117
  color: schemaDetails != null ? schemaDetails.color : undefined,
105
118
  iconType: schemaDetails != null ? schemaDetails.icon : 'tokenString'
106
- })), ___EmotionJSX(EuiFlexItem, {
107
- "aria-hidden": true
108
- }, ___EmotionJSX(EuiText, {
119
+ })), ___EmotionJSX(EuiFlexItem, null, ___EmotionJSX(EuiText, {
109
120
  size: "xs"
110
- }, ___EmotionJSX("p", null, display))), ___EmotionJSX(EuiFlexItem, {
111
- className: "euiDataGridColumnSorting__orderButtons"
112
- }, ___EmotionJSX(EuiI18n, {
121
+ }, ___EmotionJSX("p", null, display))))), ___EmotionJSX(EuiFlexItem, null, ___EmotionJSX(EuiI18n, {
113
122
  token: "euiColumnSortingDraggable.toggleLegend",
114
123
  default: "Select sorting method for {display}",
115
124
  values: {
@@ -167,7 +167,7 @@ describe('EuiDataGrid', function () {
167
167
  it('has zero violations on first render', function () {
168
168
  cy.checkAxe();
169
169
  });
170
- it('has zero violations when the columns reorder menu is open', function () {
170
+ it('has zero violations when the columns visibility menu is open', function () {
171
171
  cy.get('button[data-test-subj="dataGridColumnSelectorButton"]').realClick();
172
172
  cy.checkAxe();
173
173
  });
@@ -220,9 +220,10 @@ describe('EuiDataGrid', function () {
220
220
  cy.get('div[data-gridcell-visible-row-index="0"][data-gridcell-column-index="1"]').find('button.euiButtonIcon').last().realClick();
221
221
  cy.checkAxe();
222
222
  });
223
- it('has zero violations when the Favorite Distro column has been sorted', function () {
223
+ it('has zero violations on sort and when the columns sorting menu is open', function () {
224
224
  cy.get('button.euiDataGridHeaderCell__button').last().realClick();
225
225
  cy.get('button.euiListGroupItem__button').contains('Sort Alma to Debian').should('exist').realClick();
226
+ cy.get('button[data-test-subj="dataGridColumnSortingPopover"]').realClick();
226
227
  cy.checkAxe();
227
228
  });
228
229
  it('has zero violations when fullscreen is open', function () {
@@ -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, ___EmotionJSX("h1", null, "Title of modal"))), ___EmotionJSX(EuiModalBody, null, ___EmotionJSX("p", null, "This is a simple modal body")), ___EmotionJSX(EuiModalFooter, null, ___EmotionJSX(EuiButton, {
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), /*#__PURE__*/React.isValidElement(children) ? children : ___EmotionJSX("h1", null, children));
27
+ }, rest), ___EmotionJSX(Component, null, children));
26
28
  };
@@ -0,0 +1,103 @@
1
+ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
+
3
+ /*
4
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
5
+ * or more contributor license agreements. Licensed under the Elastic License
6
+ * 2.0 and the Server Side Public License, v 1; you may not use this file except
7
+ * in compliance with, at your election, the Elastic License 2.0 or the Server
8
+ * Side Public License, v 1.
9
+ */
10
+ /// <reference types="../../../cypress/support"/>
11
+ import React, { useState } from 'react';
12
+ import { EuiContextMenuItem } from '../context_menu';
13
+ import { EuiNotificationEvent } from './notification_event';
14
+ import { EuiPanel } from '../panel';
15
+ import { jsx as ___EmotionJSX } from "@emotion/react";
16
+
17
+ var NotificationEvent = function NotificationEvent() {
18
+ var _useState = useState(false),
19
+ _useState2 = _slicedToArray(_useState, 2),
20
+ isRead = _useState2[0],
21
+ setIsRead = _useState2[1];
22
+
23
+ var onRead = function onRead(id, isRead) {
24
+ setIsRead(!isRead);
25
+ };
26
+
27
+ var onOpenContextMenu = function onOpenContextMenu(id) {
28
+ return [___EmotionJSX(EuiContextMenuItem, {
29
+ key: "contextMenuItemA",
30
+ onClick: function onClick() {
31
+ return onRead(id, isRead);
32
+ }
33
+ }, isRead ? 'Mark as unread' : 'Mark as read'), ___EmotionJSX(EuiContextMenuItem, {
34
+ key: "contextMenuItemB",
35
+ onClick: function onClick() {}
36
+ }, "View messages like this"), ___EmotionJSX(EuiContextMenuItem, {
37
+ key: "contextMenuItemC",
38
+ onClick: function onClick() {}
39
+ }, "Don\u2019t notify me about this")];
40
+ };
41
+
42
+ return ___EmotionJSX(EuiPanel, {
43
+ paddingSize: "none",
44
+ hasShadow: true,
45
+ style: {
46
+ maxWidth: '540px'
47
+ }
48
+ }, ___EmotionJSX(EuiNotificationEvent, {
49
+ id: "cy-eui-notification-1",
50
+ type: "Report",
51
+ iconType: "logoKibana",
52
+ iconAriaLabel: "Kibana",
53
+ time: "1 min ago",
54
+ title: "[Error Monitoring Report] is generated",
55
+ primaryAction: "Download",
56
+ primaryActionProps: {
57
+ iconType: 'download'
58
+ },
59
+ messages: ['The reported was generated at 17:12:16 GMT+4'],
60
+ isRead: isRead,
61
+ onRead: onRead,
62
+ onOpenContextMenu: onOpenContextMenu,
63
+ onClickPrimaryAction: function onClickPrimaryAction() {},
64
+ onClickTitle: function onClickTitle() {}
65
+ }));
66
+ };
67
+
68
+ describe('EuiNotificationEvent', function () {
69
+ beforeEach(function () {
70
+ cy.viewport(1024, 768); // medium breakpoint
71
+
72
+ cy.realMount(___EmotionJSX(NotificationEvent, null));
73
+ cy.get('article.euiNotificationEvent').should('exist');
74
+ });
75
+ describe('Automated accessibility check', function () {
76
+ it('has zero violations on first render', function () {
77
+ cy.checkAxe();
78
+ });
79
+ it('has zero violations when popover is open', function () {
80
+ cy.get('button[data-test-subj="cy-eui-notification-1-notificationEventMetaButton"]').realClick();
81
+ cy.get('div.euiPopover__panel').should('exist');
82
+ cy.checkAxe();
83
+ });
84
+ it('has zero violations after the Mark as read button is clicked', function () {
85
+ cy.get('button[data-test-subj="cy-eui-notification-1-notificationEventMetaButton"]').realClick();
86
+ cy.get('div.euiPopover__panel').should('exist');
87
+ cy.get('div.euiPopover__panel button').first().realClick();
88
+ cy.checkAxe();
89
+ });
90
+ });
91
+ describe('Keyboard accessibility', function () {
92
+ it('has zero violations when the popover is opened by keyboard', function () {
93
+ cy.repeatRealPress('Tab');
94
+ cy.get('button[data-test-subj="cy-eui-notification-1-notificationEventMetaButton"]').should('have.focus');
95
+ cy.realPress('Enter');
96
+ cy.get('div.euiPopover__panel').should('exist');
97
+ cy.checkAxe();
98
+ cy.realPress('Escape');
99
+ cy.get('div.euiPopover__panel').should('not.exist');
100
+ cy.checkAxe();
101
+ });
102
+ });
103
+ });
@@ -0,0 +1,32 @@
1
+ /*
2
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3
+ * or more contributor license agreements. Licensed under the Elastic License
4
+ * 2.0 and the Server Side Public License, v 1; you may not use this file except
5
+ * in compliance with, at your election, the Elastic License 2.0 or the Server
6
+ * Side Public License, v 1.
7
+ */
8
+ /// <reference types="../../../../cypress/support"/>
9
+ import React from 'react';
10
+ import { EuiButton } from '../../button';
11
+ import { EuiPageHeader } from './page_header';
12
+ import { jsx as ___EmotionJSX } from "@emotion/react";
13
+ describe('EuiPageHeader', function () {
14
+ beforeEach(function () {
15
+ cy.viewport(1024, 768); // medium breakpoint
16
+
17
+ cy.realMount(___EmotionJSX(EuiPageHeader, {
18
+ pageTitle: "Page title",
19
+ iconType: "logoKibana",
20
+ description: "This description should be describing the current page as depicted by the page title. It will never extend beneath the right side content.",
21
+ rightSideItems: [___EmotionJSX(EuiButton, {
22
+ fill: true
23
+ }, "Add something"), ___EmotionJSX(EuiButton, null, "Do something")]
24
+ }));
25
+ cy.get('h1.euiTitle').should('exist');
26
+ });
27
+ describe('Automated accessibility check', function () {
28
+ it('has zero violations on first render', function () {
29
+ cy.checkAxe();
30
+ });
31
+ });
32
+ });