@elastic/eui 121.0.0 → 122.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 (87) hide show
  1. package/dist/eui-icons.json +37 -37
  2. package/es/components/combo_box/combo_box_options_list/combo_box_options_list.js +8 -2
  3. package/es/components/datagrid/body/cell/data_grid_cell.js +8 -5
  4. package/es/components/datagrid/body/cell/data_grid_cell.styles.js +1 -1
  5. package/es/components/datagrid/body/cell/data_grid_cell_wrapper.js +4 -2
  6. package/es/components/datagrid/body/footer/data_grid_footer_row.js +4 -0
  7. package/es/components/datagrid/body/header/column_resizer.js +74 -87
  8. package/es/components/datagrid/body/header/data_grid_control_header_cell.js +2 -1
  9. package/es/components/datagrid/body/header/data_grid_header_cell.js +1 -0
  10. package/es/components/datagrid/body/header/data_grid_header_cell_wrapper.js +9 -3
  11. package/es/components/datagrid/body/header/data_grid_header_cell_wrapper.styles.js +1 -1
  12. package/es/components/datagrid/controls/keyboard_shortcuts.js +17 -1
  13. package/es/components/datagrid/data_grid.js +2 -0
  14. package/es/components/datagrid/utils/copy_focused_cell.js +34 -0
  15. package/es/components/filter_group/filter_group.a11y.js +1 -1
  16. package/es/components/form/super_select/super_select.js +247 -351
  17. package/es/components/list_item_layout/_list_item_layout.js +12 -0
  18. package/es/components/selectable/selectable_list/selectable_list_item.js +9 -7
  19. package/eui.d.ts +69 -95
  20. package/i18ntokens.json +608 -554
  21. package/lib/components/combo_box/combo_box_options_list/combo_box_options_list.js +8 -2
  22. package/lib/components/datagrid/body/cell/data_grid_cell.js +8 -5
  23. package/lib/components/datagrid/body/cell/data_grid_cell.styles.js +1 -1
  24. package/lib/components/datagrid/body/cell/data_grid_cell_wrapper.js +4 -2
  25. package/lib/components/datagrid/body/footer/data_grid_footer_row.js +4 -0
  26. package/lib/components/datagrid/body/header/column_resizer.js +73 -85
  27. package/lib/components/datagrid/body/header/data_grid_control_header_cell.js +2 -1
  28. package/lib/components/datagrid/body/header/data_grid_header_cell.js +1 -0
  29. package/lib/components/datagrid/body/header/data_grid_header_cell_wrapper.js +9 -3
  30. package/lib/components/datagrid/body/header/data_grid_header_cell_wrapper.styles.js +1 -1
  31. package/lib/components/datagrid/controls/keyboard_shortcuts.js +17 -1
  32. package/lib/components/datagrid/data_grid.js +2 -0
  33. package/lib/components/datagrid/utils/copy_focused_cell.js +39 -0
  34. package/lib/components/filter_group/filter_group.a11y.js +1 -1
  35. package/lib/components/form/super_select/super_select.js +253 -355
  36. package/lib/components/list_item_layout/_list_item_layout.js +12 -0
  37. package/lib/components/selectable/selectable_list/selectable_list_item.js +9 -7
  38. package/optimize/es/components/combo_box/combo_box_options_list/combo_box_options_list.js +8 -2
  39. package/optimize/es/components/datagrid/body/cell/data_grid_cell.js +5 -4
  40. package/optimize/es/components/datagrid/body/cell/data_grid_cell.styles.js +1 -1
  41. package/optimize/es/components/datagrid/body/cell/data_grid_cell_wrapper.js +4 -2
  42. package/optimize/es/components/datagrid/body/footer/data_grid_footer_row.js +4 -0
  43. package/optimize/es/components/datagrid/body/header/column_resizer.js +69 -81
  44. package/optimize/es/components/datagrid/body/header/data_grid_control_header_cell.js +2 -1
  45. package/optimize/es/components/datagrid/body/header/data_grid_header_cell.js +1 -0
  46. package/optimize/es/components/datagrid/body/header/data_grid_header_cell_wrapper.js +7 -3
  47. package/optimize/es/components/datagrid/body/header/data_grid_header_cell_wrapper.styles.js +1 -1
  48. package/optimize/es/components/datagrid/controls/keyboard_shortcuts.js +17 -1
  49. package/optimize/es/components/datagrid/data_grid.js +2 -0
  50. package/optimize/es/components/datagrid/utils/copy_focused_cell.js +34 -0
  51. package/optimize/es/components/filter_group/filter_group.a11y.js +1 -1
  52. package/optimize/es/components/form/super_select/super_select.js +242 -265
  53. package/optimize/es/components/selectable/selectable_list/selectable_list_item.js +9 -7
  54. package/optimize/lib/components/combo_box/combo_box_options_list/combo_box_options_list.js +8 -2
  55. package/optimize/lib/components/datagrid/body/cell/data_grid_cell.js +5 -4
  56. package/optimize/lib/components/datagrid/body/cell/data_grid_cell.styles.js +1 -1
  57. package/optimize/lib/components/datagrid/body/cell/data_grid_cell_wrapper.js +4 -2
  58. package/optimize/lib/components/datagrid/body/footer/data_grid_footer_row.js +4 -0
  59. package/optimize/lib/components/datagrid/body/header/column_resizer.js +69 -79
  60. package/optimize/lib/components/datagrid/body/header/data_grid_control_header_cell.js +2 -1
  61. package/optimize/lib/components/datagrid/body/header/data_grid_header_cell.js +1 -0
  62. package/optimize/lib/components/datagrid/body/header/data_grid_header_cell_wrapper.js +7 -3
  63. package/optimize/lib/components/datagrid/body/header/data_grid_header_cell_wrapper.styles.js +1 -1
  64. package/optimize/lib/components/datagrid/controls/keyboard_shortcuts.js +17 -1
  65. package/optimize/lib/components/datagrid/data_grid.js +2 -0
  66. package/optimize/lib/components/datagrid/utils/copy_focused_cell.js +39 -0
  67. package/optimize/lib/components/filter_group/filter_group.a11y.js +1 -1
  68. package/optimize/lib/components/form/super_select/super_select.js +243 -265
  69. package/optimize/lib/components/selectable/selectable_list/selectable_list_item.js +9 -7
  70. package/package.json +2 -2
  71. package/test-env/components/combo_box/combo_box_options_list/combo_box_options_list.js +8 -2
  72. package/test-env/components/datagrid/body/cell/data_grid_cell.js +8 -5
  73. package/test-env/components/datagrid/body/cell/data_grid_cell.styles.js +1 -1
  74. package/test-env/components/datagrid/body/cell/data_grid_cell_wrapper.js +4 -2
  75. package/test-env/components/datagrid/body/footer/data_grid_footer_row.js +4 -0
  76. package/test-env/components/datagrid/body/header/column_resizer.js +69 -79
  77. package/test-env/components/datagrid/body/header/data_grid_control_header_cell.js +2 -1
  78. package/test-env/components/datagrid/body/header/data_grid_header_cell.js +1 -0
  79. package/test-env/components/datagrid/body/header/data_grid_header_cell_wrapper.js +9 -3
  80. package/test-env/components/datagrid/body/header/data_grid_header_cell_wrapper.styles.js +1 -1
  81. package/test-env/components/datagrid/controls/keyboard_shortcuts.js +17 -1
  82. package/test-env/components/datagrid/data_grid.js +2 -0
  83. package/test-env/components/datagrid/utils/copy_focused_cell.js +16 -0
  84. package/test-env/components/filter_group/filter_group.a11y.js +1 -1
  85. package/test-env/components/form/super_select/super_select.js +243 -345
  86. package/test-env/components/list_item_layout/_list_item_layout.js +12 -0
  87. package/test-env/components/selectable/selectable_list/selectable_list_item.js +9 -7
@@ -24,7 +24,7 @@ var _list_item_layout = require("../../list_item_layout");
24
24
  var _combo_box_options_list = require("./combo_box_options_list.styles");
25
25
  var _react2 = require("@emotion/react");
26
26
  var _excluded = ["children"],
27
- _excluded2 = ["key", "className", "isGroupLabelOption", "label", "value", "prepend", "append", "truncationProps", "toolTipContent", "toolTipProps"],
27
+ _excluded2 = ["key", "className", "isGroupLabelOption", "label", "value", "prepend", "append", "truncationProps", "toolTipContent", "toolTipProps", "title"],
28
28
  _excluded3 = ["data-test-subj", "activeOptionIndex", "areAllOptionsSelected", "customOptionText", "fullWidth", "getSelectedOptionForSearchValue", "isCaseSensitive", "isLoading", "listRef", "matchingOptions", "onCloseList", "onCreateOption", "onOptionClick", "onOptionEnterKey", "onScroll", "options", "renderOption", "rootId", "rowHeight", "scrollToIndex", "searchValue", "selectedOptions", "singleSelection", "delimiter", "onFocusBadge", "truncationProps", "listboxAriaLabel", "setListOptionRefs"];
29
29
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
30
30
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
@@ -100,6 +100,7 @@ var EuiComboBoxOptionsList = exports.EuiComboBoxOptionsList = /*#__PURE__*/funct
100
100
  _truncationProps = option.truncationProps,
101
101
  toolTipContent = option.toolTipContent,
102
102
  toolTipProps = option.toolTipProps,
103
+ title = option.title,
103
104
  rest = _objectWithoutProperties(option, _excluded2);
104
105
  var _this$props2 = _this.props,
105
106
  options = _this$props2.options,
@@ -151,7 +152,6 @@ var EuiComboBoxOptionsList = exports.EuiComboBoxOptionsList = /*#__PURE__*/funct
151
152
  // loses focus on selecting an option (due to actively removing it from the list)
152
153
  ,
153
154
  id: rootId("_option-".concat(options.indexOf(option))),
154
- title: hasNativeTruncation && !toolTipContent ? label : undefined,
155
155
  key: (_option$key = option.key) !== null && _option$key !== void 0 ? _option$key : option.label,
156
156
  prepend: option.prepend,
157
157
  append: hasOnFocusBadge ? (0, _react2.jsx)(_react.default.Fragment, null, option.append, hitEnterBadge) : option.append,
@@ -171,6 +171,12 @@ var EuiComboBoxOptionsList = exports.EuiComboBoxOptionsList = /*#__PURE__*/funct
171
171
  contentProps: {
172
172
  className: 'euiComboBoxOption__content'
173
173
  },
174
+ textProps: {
175
+ // `title` must not be set on the option element itself - it would
176
+ // become the option's accessible description, causing screen readers
177
+ // to announce the option name twice
178
+ title: title !== null && title !== void 0 ? title : hasNativeTruncation && !toolTipContent ? label : undefined
179
+ },
174
180
  onClick: function onClick() {
175
181
  if (onOptionClick) {
176
182
  onOptionClick(option);
@@ -22,7 +22,7 @@ var _focus_utils = require("./focus_utils");
22
22
  var _data_grid_cell = require("./data_grid_cell.styles");
23
23
  var _react2 = require("@emotion/react");
24
24
  var _excluded = ["renderCellValue", "cellContext", "column", "setCellContentsRef", "rowIndex", "colIndex", "rowHeightsOptions", "rowHeightUtils", "isControlColumn"],
25
- _excluded2 = ["width", "popoverContext", "interactiveCellId", "columnType", "className", "column", "style", "rowHeightUtils", "rowHeightsOptions", "rowManager", "pagination"],
25
+ _excluded2 = ["width", "popoverContext", "interactiveCellId", "columnType", "className", "column", "style", "rowHeightUtils", "rowHeightsOptions", "rowManager", "pagination", "isLastCopyColumn"],
26
26
  _excluded3 = ["isExpandable", "style", "className", "data-test-subj"],
27
27
  _excluded4 = ["columnId", "columnIndex", "rowIndex", "visibleRowIndex"];
28
28
  /*
@@ -668,6 +668,7 @@ EuiDataGridCellContent.propTypes = {
668
668
  */
669
669
  onChange: _propTypes.default.func
670
670
  }).isRequired,
671
+ isLastCopyColumn: _propTypes.default.bool,
671
672
  setCellProps: _propTypes.default.func.isRequired,
672
673
  setCellContentsRef: _propTypes.default.func.isRequired,
673
674
  isExpanded: _propTypes.default.bool.isRequired,
@@ -1007,6 +1008,8 @@ var EuiDataGridCell = exports.EuiDataGridCell = /*#__PURE__*/function (_Componen
1007
1008
  rowHeightsOptions = _this$props9.rowHeightsOptions,
1008
1009
  rowManager = _this$props9.rowManager,
1009
1010
  pagination = _this$props9.pagination,
1011
+ _this$props9$isLastCo = _this$props9.isLastCopyColumn,
1012
+ isLastCopyColumn = _this$props9$isLastCo === void 0 ? false : _this$props9$isLastCo,
1010
1013
  rest = _objectWithoutProperties(_this$props9, _excluded2);
1011
1014
  var rowIndex = rest.rowIndex,
1012
1015
  visibleRowIndex = rest.visibleRowIndex,
@@ -1018,7 +1021,6 @@ var EuiDataGridCell = exports.EuiDataGridCell = /*#__PURE__*/function (_Componen
1018
1021
 
1019
1022
  // classNames set by EuiDataGridCellWrapper
1020
1023
  var isControlColumn = cellClasses.includes('euiDataGridRowCell--controlColumn');
1021
- var isLastColumn = cellClasses.includes('euiDataGridRowCell--lastColumn');
1022
1024
  var ariaRowIndex = pagination ? visibleRowIndex + 1 + pagination.pageSize * pagination.pageIndex : visibleRowIndex + 1;
1023
1025
  var _this$state$cellProps2 = this.state.cellProps,
1024
1026
  _ = _this$state$cellProps2.isExpandable,
@@ -1058,7 +1060,7 @@ var EuiDataGridCell = exports.EuiDataGridCell = /*#__PURE__*/function (_Componen
1058
1060
  onKeyDown: this.handleCellKeyDown,
1059
1061
  onMouseEnter: this.onMouseEnter,
1060
1062
  onMouseLeave: this.onMouseLeave
1061
- }), (0, _react2.jsx)(_focus_utils.HandleInteractiveChildren, {
1063
+ }), isControlColumn && _services.tabularCopyMarkers.hiddenNoCopyBoundary, (0, _react2.jsx)(_focus_utils.HandleInteractiveChildren, {
1062
1064
  cellEl: this.cellRef.current,
1063
1065
  updateCellFocusContext: this.updateCellFocusContext,
1064
1066
  renderFocusTrap: !isExpandable
@@ -1074,7 +1076,7 @@ var EuiDataGridCell = exports.EuiDataGridCell = /*#__PURE__*/function (_Componen
1074
1076
  isControlColumn: isControlColumn,
1075
1077
  rowIndex: rowIndex,
1076
1078
  colIndex: colIndex
1077
- }))), isLastColumn ? _services.tabularCopyMarkers.hiddenNewline : _services.tabularCopyMarkers.hiddenTab, this.state.isFocused && (0, _react2.jsx)(CellScreenReaderDescription, {
1079
+ }))), isControlColumn ? _services.tabularCopyMarkers.hiddenNoCopyBoundary : isLastCopyColumn ? _services.tabularCopyMarkers.hiddenNewline : _services.tabularCopyMarkers.hiddenTab, this.state.isFocused && (0, _react2.jsx)(CellScreenReaderDescription, {
1078
1080
  columnName: (column === null || column === void 0 ? void 0 : column.displayAsText) || this.props.columnId,
1079
1081
  columnIndex: colIndex + 1,
1080
1082
  rowIndex: ariaRowIndex,
@@ -1564,7 +1566,8 @@ EuiDataGridCell.propTypes = {
1564
1566
  * Can be used for, e.g. storing user `gridStyle` in a local storage object.
1565
1567
  */
1566
1568
  onChange: _propTypes.default.func
1567
- }).isRequired
1569
+ }).isRequired,
1570
+ isLastCopyColumn: _propTypes.default.bool
1568
1571
  };
1569
1572
  var RenderCellInRow = /*#__PURE__*/(0, _react.memo)(function (_ref2) {
1570
1573
  var row = _ref2.row,
@@ -108,7 +108,7 @@ var euiDataGridRowCellStyles = exports.euiDataGridRowCellStyles = function euiDa
108
108
  var _euiDataGridCellOutli = euiDataGridCellOutlineSelectors(),
109
109
  outlineSelectors = _euiDataGridCellOutli.outline;
110
110
  return {
111
- euiDataGridRowCell: /*#__PURE__*/(0, _react.css)("position:relative;", outlineSelectors.show, "{", cellOutline.focusStyles, ";}", outlineSelectors.hover, "{", cellOutline.hoverStyles, ";}", outlineSelectors.focusTrapped, "{", cellOutline.hoverStyles, ";}&>[data-focus-lock-disabled]{", (0, _global_styling.logicalCSS)('height', '100%'), ";}&:where(.euiDataGridRowCell--numeric, .euiDataGridRowCell--currency){", (0, _global_styling.logicalTextAlignCSS)('right'), ";}&:where(.euiDataGridRowCell--uppercase){text-transform:uppercase;}&:where(.euiDataGridRowCell--lowercase){text-transform:lowercase;}&:where(.euiDataGridRowCell--capitalize){text-transform:capitalize;};label:euiDataGridRowCell;"),
111
+ euiDataGridRowCell: /*#__PURE__*/(0, _react.css)("position:relative;", outlineSelectors.show, "{", cellOutline.focusStyles, ";}", outlineSelectors.hover, "{", cellOutline.hoverStyles, ";}", outlineSelectors.focusTrapped, "{", cellOutline.hoverStyles, ";}&>[data-focus-lock-disabled]{", (0, _global_styling.logicalCSS)('height', '100%'), ";}&:where(.euiDataGridRowCell--numeric, .euiDataGridRowCell--currency){", (0, _global_styling.logicalTextAlignCSS)('right'), ";}&:where(.euiDataGridRowCell--uppercase){text-transform:uppercase;}&:where(.euiDataGridRowCell--lowercase){text-transform:lowercase;}&:where(.euiDataGridRowCell--capitalize){text-transform:capitalize;}&:where(.euiDataGridRowCell--controlColumn){user-select:none;};label:euiDataGridRowCell;"),
112
112
  content: {
113
113
  euiDataGridRowCell__content: _ref,
114
114
  autoHeight: /*#__PURE__*/(0, _react.css)((0, _global_styling.logicalCSS)('height', 'auto'), ";;label:autoHeight;"),
@@ -60,6 +60,7 @@ var CellWrapper = exports.CellWrapper = /*#__PURE__*/(0, _react.memo)(function (
60
60
  getCorrectRowIndex = _useContext.getCorrectRowIndex;
61
61
  var isFirstColumn = colIndex === 0;
62
62
  var isLastColumn = colIndex === visibleColCount - 1;
63
+ var isLastCopyColumn = columns.length > 0 && colIndex === leadingControlColumns.length + columns.length - 1;
63
64
  var isLeadingControlColumn = colIndex < leadingControlColumns.length;
64
65
  var isTrailingControlColumn = colIndex >= leadingControlColumns.length + columns.length;
65
66
  var datacolIndex = colIndex - leadingControlColumns.length;
@@ -90,9 +91,10 @@ var CellWrapper = exports.CellWrapper = /*#__PURE__*/(0, _react.memo)(function (
90
91
  rowManager: rowManager,
91
92
  popoverContext: popoverContext,
92
93
  pagination: pagination,
93
- cellContext: cellContext
94
+ cellContext: cellContext,
95
+ isLastCopyColumn: isLastCopyColumn
94
96
  };
95
- }, [colIndex, setRowHeight, visibleRowIndex, getCorrectRowIndex, interactiveCellId, style, rowHeightsOptions, rowHeightUtils, rowManager, popoverContext, pagination, cellContext, isFirstColumn, isLastColumn, isLeadingControlColumn, isTrailingControlColumn, textTransform]);
97
+ }, [colIndex, setRowHeight, visibleRowIndex, getCorrectRowIndex, interactiveCellId, style, rowHeightsOptions, rowHeightUtils, rowManager, popoverContext, pagination, cellContext, isFirstColumn, isLastColumn, isLastCopyColumn, isLeadingControlColumn, isTrailingControlColumn, textTransform]);
96
98
  if (isLeadingControlColumn) {
97
99
  var leadingColumn = leadingControlColumns[colIndex];
98
100
  var id = leadingColumn.id,
@@ -50,6 +50,7 @@ var EuiDataGridFooterRow = exports.EuiDataGridFooterRow = /*#__PURE__*/(0, _reac
50
50
  var cssStyles = [styles.euiDataGridFooter, gridStyles.stickyFooter && styles.sticky, gridStyles.footer === 'striped' ? visibleRowIndex % 2 !== 0 && styles.striped : styles[gridStyles.footer]];
51
51
  var classes = (0, _classnames.default)('euiDataGridFooter', className);
52
52
  var dataTestSubj = (0, _classnames.default)('dataGridRow', 'dataGridFooterRow', _dataTestSubj);
53
+ var lastCopyColumnIndex = columns.length > 0 ? leadingControlColumns.length + columns.length - 1 : -1;
53
54
  var getCellClasses = (0, _react.useCallback)(function (columnIndex, classes) {
54
55
  return (0, _classnames.default)('euiDataGridFooterCell', {
55
56
  'euiDataGridRowCell--firstColumn': columnIndex === 0,
@@ -83,6 +84,7 @@ var EuiDataGridFooterRow = exports.EuiDataGridFooterRow = /*#__PURE__*/(0, _reac
83
84
  width: width,
84
85
  renderCellValue: footerCellRender !== null && footerCellRender !== void 0 ? footerCellRender : renderEmpty,
85
86
  isExpandable: false,
87
+ isLastCopyColumn: i === lastCopyColumnIndex,
86
88
  className: getCellClasses(i, (0, _classnames.default)('euiDataGridRowCell--controlColumn', footerCellProps === null || footerCellProps === void 0 ? void 0 : footerCellProps.className))
87
89
  }));
88
90
  }), columns.map(function (_ref3, i) {
@@ -100,6 +102,7 @@ var EuiDataGridFooterRow = exports.EuiDataGridFooterRow = /*#__PURE__*/(0, _reac
100
102
  renderCellValue: renderCellValue,
101
103
  renderCellPopover: renderCellPopover,
102
104
  isExpandable: true,
105
+ isLastCopyColumn: columnPosition === lastCopyColumnIndex,
103
106
  className: getCellClasses(columnPosition)
104
107
  }));
105
108
  }), trailingControlColumns.map(function (_ref4, i) {
@@ -115,6 +118,7 @@ var EuiDataGridFooterRow = exports.EuiDataGridFooterRow = /*#__PURE__*/(0, _reac
115
118
  width: width,
116
119
  renderCellValue: footerCellRender !== null && footerCellRender !== void 0 ? footerCellRender : renderEmpty,
117
120
  isExpandable: false,
121
+ isLastCopyColumn: colIndex === lastCopyColumnIndex,
118
122
  className: getCellClasses(colIndex, (0, _classnames.default)('euiDataGridRowCell--controlColumn', footerCellProps === null || footerCellProps === void 0 ? void 0 : footerCellProps.className))
119
123
  }));
120
124
  }));
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
 
3
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
3
4
  Object.defineProperty(exports, "__esModule", {
4
5
  value: true
5
6
  });
@@ -14,20 +15,12 @@ var _react2 = require("@emotion/react");
14
15
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
15
16
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
16
17
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
17
- function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
18
- function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
19
- function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
20
- function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
21
- function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
22
- function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); }
23
- function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
24
- function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
25
- function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }
26
- function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); }
27
- function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
28
- function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
29
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
30
- function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } /*
18
+ function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
19
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
20
+ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
21
+ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
22
+ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
23
+ function _arrayWithHoles(r) { if (Array.isArray(r)) return r; } /*
31
24
  * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
32
25
  * or more contributor license agreements. Licensed under the Elastic License
33
26
  * 2.0 and the Server Side Public License, v 1; you may not use this file except
@@ -35,78 +28,73 @@ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e
35
28
  * Side Public License, v 1.
36
29
  */
37
30
  var MINIMUM_COLUMN_WIDTH = 40;
38
- var EuiDataGridColumnResizer = exports.EuiDataGridColumnResizer = /*#__PURE__*/function (_Component) {
39
- function EuiDataGridColumnResizer() {
40
- var _this;
41
- _classCallCheck(this, EuiDataGridColumnResizer);
42
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
43
- args[_key] = arguments[_key];
44
- }
45
- _this = _callSuper(this, EuiDataGridColumnResizer, [].concat(args));
46
- _defineProperty(_this, "state", {
47
- initialX: 0,
48
- offset: 0
49
- });
50
- _defineProperty(_this, "onMouseDown", function (e) {
51
- _this.setState({
52
- initialX: e.pageX
53
- });
54
- window.addEventListener('mouseup', _this.onMouseUp);
55
- window.addEventListener('blur', _this.onMouseUp);
56
- window.addEventListener('mousemove', _this.onMouseMove);
31
+ var EuiDataGridColumnResizer = exports.EuiDataGridColumnResizer = function EuiDataGridColumnResizer(_ref) {
32
+ var columnId = _ref.columnId,
33
+ columnWidth = _ref.columnWidth,
34
+ setColumnWidth = _ref.setColumnWidth,
35
+ isLastColumn = _ref.isLastColumn;
36
+ var styles = (0, _services.useEuiMemoizedStyles)(_column_resizer.euiDataGridColumnResizerStyles);
37
+ var _useState = (0, _react.useState)(0),
38
+ _useState2 = _slicedToArray(_useState, 2),
39
+ offset = _useState2[0],
40
+ setOffset = _useState2[1];
41
+ var initialX = (0, _react.useRef)(0);
42
+
43
+ // Handlers are bound to `window`, so they must stay stable to be removed
44
+ // and read current values from a ref
45
+ var latest = (0, _services.useLatest)({
46
+ columnId: columnId,
47
+ columnWidth: columnWidth,
48
+ setColumnWidth: setColumnWidth,
49
+ offset: offset
50
+ });
51
+ var onMouseMove = (0, _react.useCallback)(function (e) {
52
+ var _ref2 = latest.current,
53
+ columnWidth = _ref2.columnWidth;
54
+ setOffset(Math.max(e.pageX - initialX.current, -(columnWidth - MINIMUM_COLUMN_WIDTH)));
55
+ }, [latest]);
56
+ var onMouseUp = (0, _react.useCallback)(function () {
57
+ var _ref3 = latest.current,
58
+ columnId = _ref3.columnId,
59
+ columnWidth = _ref3.columnWidth,
60
+ setColumnWidth = _ref3.setColumnWidth,
61
+ offset = _ref3.offset;
62
+ setColumnWidth(columnId, Math.max(MINIMUM_COLUMN_WIDTH, columnWidth + offset));
63
+ setOffset(0);
64
+ window.removeEventListener('mouseup', onMouseUp);
65
+ window.removeEventListener('blur', onMouseUp);
66
+ window.removeEventListener('mousemove', onMouseMove);
67
+ }, [latest, onMouseMove]);
68
+ var onMouseDown = (0, _react.useCallback)(function (e) {
69
+ initialX.current = e.pageX;
70
+ window.addEventListener('mouseup', onMouseUp);
71
+ window.addEventListener('blur', onMouseUp);
72
+ window.addEventListener('mousemove', onMouseMove);
73
+
74
+ // don't let this action steal focus
75
+ e.preventDefault();
76
+ }, [onMouseUp, onMouseMove]);
57
77
 
58
- // don't let this action steal focus
59
- e.preventDefault();
60
- });
61
- _defineProperty(_this, "onMouseUp", function () {
62
- var offset = _this.state.offset;
63
- var _this$props = _this.props,
64
- columnId = _this$props.columnId,
65
- columnWidth = _this$props.columnWidth,
66
- setColumnWidth = _this$props.setColumnWidth;
67
- setColumnWidth(columnId, Math.max(MINIMUM_COLUMN_WIDTH, columnWidth + offset));
68
- _this.setState({
69
- offset: 0
70
- });
71
- window.removeEventListener('mouseup', _this.onMouseUp);
72
- window.removeEventListener('blur', _this.onMouseUp);
73
- window.removeEventListener('mousemove', _this.onMouseMove);
74
- });
75
- _defineProperty(_this, "onMouseMove", function (e) {
76
- var columnWidth = _this.props.columnWidth;
77
- _this.setState(function (_ref) {
78
- var initialX = _ref.initialX;
79
- return {
80
- offset: Math.max(e.pageX - initialX, -(columnWidth - MINIMUM_COLUMN_WIDTH))
81
- };
82
- });
83
- });
84
- return _this;
85
- }
86
- _inherits(EuiDataGridColumnResizer, _Component);
87
- return _createClass(EuiDataGridColumnResizer, [{
88
- key: "render",
89
- value: function render() {
90
- var _this2 = this;
91
- var offset = this.state.offset;
92
- var isLastColumn = this.props.isLastColumn;
93
- return (0, _react2.jsx)(_services.RenderWithEuiStylesMemoizer, null, function (stylesMemoizer) {
94
- var styles = stylesMemoizer(_column_resizer.euiDataGridColumnResizerStyles);
95
- var cssStyles = [styles.euiDataGridColumnResizer, isLastColumn && styles.isLastColumn, offset && styles.isDragging];
96
- return (0, _react2.jsx)("div", {
97
- css: cssStyles,
98
- className: "euiDataGridColumnResizer",
99
- "data-test-subj": "dataGridColumnResizer",
100
- style: offset ? (0, _global_styling.logicalStyle)('margin-right', "".concat(-offset, "px")) : undefined,
101
- onMouseDown: _this2.onMouseDown
102
- }, (0, _react2.jsx)(_draggable_columns.DragOverlay, {
103
- isDragging: !!offset,
104
- cursor: "ew-resize"
105
- }));
106
- });
107
- }
108
- }]);
109
- }(_react.Component);
78
+ // Clean up listeners if unmounted mid-drag
79
+ (0, _react.useEffect)(function () {
80
+ return function () {
81
+ window.removeEventListener('mouseup', onMouseUp);
82
+ window.removeEventListener('blur', onMouseUp);
83
+ window.removeEventListener('mousemove', onMouseMove);
84
+ };
85
+ }, [onMouseUp, onMouseMove]);
86
+ var cssStyles = [styles.euiDataGridColumnResizer, isLastColumn && styles.isLastColumn, offset && styles.isDragging];
87
+ return (0, _react2.jsx)("div", {
88
+ css: cssStyles,
89
+ className: "euiDataGridColumnResizer",
90
+ "data-test-subj": "dataGridColumnResizer",
91
+ style: offset ? (0, _global_styling.logicalStyle)('margin-right', "".concat(-offset, "px")) : undefined,
92
+ onMouseDown: onMouseDown
93
+ }, (0, _react2.jsx)(_draggable_columns.DragOverlay, {
94
+ isDragging: !!offset,
95
+ cursor: "ew-resize"
96
+ }));
97
+ };
110
98
  EuiDataGridColumnResizer.propTypes = {
111
99
  columnId: _propTypes.default.string.isRequired,
112
100
  columnWidth: _propTypes.default.number.isRequired,
@@ -33,7 +33,8 @@ var EuiDataGridControlHeaderCell = exports.EuiDataGridControlHeaderCell = /*#__P
33
33
  id: id,
34
34
  index: index,
35
35
  width: width,
36
- isLastColumn: isLastColumn
36
+ isLastColumn: isLastColumn,
37
+ isControlColumn: true
37
38
  }), (0, _react2.jsx)(HeaderCellRender, null));
38
39
  });
39
40
  EuiDataGridControlHeaderCell.propTypes = {
@@ -103,6 +103,7 @@ var EuiDataGridHeaderCell = exports.EuiDataGridHeaderCell = /*#__PURE__*/(0, _re
103
103
  id: id,
104
104
  index: index,
105
105
  isLastColumn: isLastColumn,
106
+ isLastCopyColumn: columns.length > 0 ? columns[columns.length - 1].id === id : isLastColumn,
106
107
  width: width,
107
108
  "aria-sort": ariaSort,
108
109
  "aria-labelledby": cellContentId,
@@ -13,7 +13,7 @@ var _focus = require("../../utils/focus");
13
13
  var _focus_utils = require("../cell/focus_utils");
14
14
  var _data_grid_header_cell_wrapper = require("./data_grid_header_cell_wrapper.styles");
15
15
  var _react2 = require("@emotion/react");
16
- var _excluded = ["id", "index", "isLastColumn", "width", "className", "children", "hasColumnActions", "isDragging", "onKeyDown", "aria-label", "aria-labelledby"];
16
+ var _excluded = ["id", "index", "isLastColumn", "isLastCopyColumn", "isControlColumn", "width", "className", "children", "hasColumnActions", "isDragging", "onKeyDown", "aria-label", "aria-labelledby"];
17
17
  /*
18
18
  * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
19
19
  * or more contributor license agreements. Licensed under the Elastic License
@@ -42,6 +42,10 @@ var EuiDataGridHeaderCellWrapper = exports.EuiDataGridHeaderCellWrapper = functi
42
42
  var id = _ref.id,
43
43
  index = _ref.index,
44
44
  isLastColumn = _ref.isLastColumn,
45
+ _ref$isLastCopyColumn = _ref.isLastCopyColumn,
46
+ isLastCopyColumn = _ref$isLastCopyColumn === void 0 ? isLastColumn : _ref$isLastCopyColumn,
47
+ _ref$isControlColumn = _ref.isControlColumn,
48
+ isControlColumn = _ref$isControlColumn === void 0 ? false : _ref$isControlColumn,
45
49
  width = _ref.width,
46
50
  className = _ref.className,
47
51
  children = _ref.children,
@@ -117,18 +121,20 @@ var EuiDataGridHeaderCellWrapper = exports.EuiDataGridHeaderCellWrapper = functi
117
121
  } : {},
118
122
  "aria-label": renderFocusTrap ? ariaLabel : undefined,
119
123
  "aria-labelledby": renderFocusTrap ? ariaLabelledby : undefined
120
- }, rest), (0, _react2.jsx)(_focus_utils.HandleInteractiveChildren, {
124
+ }, rest), isControlColumn && _services.tabularCopyMarkers.hiddenNoCopyBoundary, (0, _react2.jsx)(_focus_utils.HandleInteractiveChildren, {
121
125
  cellEl: isDragging ? null : headerEl,
122
126
  renderFocusTrap: isDragging ? false : renderFocusTrap,
123
127
  updateCellFocusContext: updateCellFocusContext,
124
128
  onInteractiveChildrenFound: setInteractiveChildren
125
- }, typeof children === 'function' ? children(renderFocusTrap) : children), isLastColumn ? _services.tabularCopyMarkers.hiddenNewline : _services.tabularCopyMarkers.hiddenTab);
129
+ }, typeof children === 'function' ? children(renderFocusTrap) : children), isControlColumn ? _services.tabularCopyMarkers.hiddenNoCopyBoundary : isLastCopyColumn ? _services.tabularCopyMarkers.hiddenNewline : _services.tabularCopyMarkers.hiddenTab);
126
130
  };
127
131
  EuiDataGridHeaderCellWrapper.propTypes = {
128
132
  children: _propTypes.default.oneOfType([_propTypes.default.node.isRequired, _propTypes.default.func.isRequired]).isRequired,
129
133
  id: _propTypes.default.string.isRequired,
130
134
  index: _propTypes.default.number.isRequired,
131
135
  isLastColumn: _propTypes.default.bool.isRequired,
136
+ isLastCopyColumn: _propTypes.default.bool,
137
+ isControlColumn: _propTypes.default.bool,
132
138
  width: _propTypes.default.oneOfType([_propTypes.default.number.isRequired, _propTypes.default.oneOf([null])]),
133
139
  className: _propTypes.default.string,
134
140
  "aria-label": _propTypes.default.any,
@@ -26,6 +26,6 @@ var euiDataGridHeaderCellWrapperStyles = exports.euiDataGridHeaderCellWrapperSty
26
26
  var _euiDataGridCellOutli2 = (0, _data_grid_cell.euiDataGridCellOutlineSelectors)(),
27
27
  outlineSelectors = _euiDataGridCellOutli2.header;
28
28
  return {
29
- euiDataGridHeaderCell: /*#__PURE__*/(0, _react.css)("position:relative;display:flex;align-items:center;flex:0 0 auto;font-weight:", euiTheme.font.weight.bold, ";", outlineSelectors.focus, "{", focusStyles, ";}", outlineSelectors.focusTrapped, "{", hoverStyles, ";}", outlineSelectors.showActions, "{&,&>[data-focus-lock-disabled]{gap:", euiTheme.size.xxs, ";}}&>[data-focus-lock-disabled]{display:flex;align-items:center;", (0, _global_styling.logicalCSS)('width', '100%'), ";};label:euiDataGridHeaderCell;")
29
+ euiDataGridHeaderCell: /*#__PURE__*/(0, _react.css)("position:relative;display:flex;align-items:center;flex:0 0 auto;font-weight:", euiTheme.font.weight.bold, ";", outlineSelectors.focus, "{", focusStyles, ";}", outlineSelectors.focusTrapped, "{", hoverStyles, ";}", outlineSelectors.showActions, "{&,&>[data-focus-lock-disabled]{gap:", euiTheme.size.xxs, ";}}&>[data-focus-lock-disabled]{display:flex;align-items:center;", (0, _global_styling.logicalCSS)('width', '100%'), ";}&:where(.euiDataGridHeaderCell--controlColumn){user-select:none;};label:euiDataGridHeaderCell;")
30
30
  };
31
31
  };
@@ -36,6 +36,7 @@ var useDataGridKeyboardShortcuts = exports.useDataGridKeyboardShortcuts = functi
36
36
  setIsOpen = _useState2[1];
37
37
  var title = (0, _i18n.useEuiI18n)('euiKeyboardShortcuts.title', 'Keyboard shortcuts');
38
38
  var titleId = (0, _services.useGeneratedHtmlId)();
39
+ var copyModifier = typeof navigator !== 'undefined' && /Mac|iP(hone|od|ad)/.test(navigator.platform) ? 'Cmd' : 'Ctrl';
39
40
  var styles = (0, _services.useEuiMemoizedStyles)(_keyboard_shortcuts.euiDataGridKeyboardShortcutsStyles);
40
41
  var keyboardShortcuts = (0, _react.useMemo)(function () {
41
42
  return (0, _react2.jsx)(_popover.EuiPopover, {
@@ -187,9 +188,24 @@ var useDataGridKeyboardShortcuts = exports.useDataGridKeyboardShortcuts = functi
187
188
  token: "euiKeyboardShortcuts.escapeDescription",
188
189
  default: "Close cell details and actions"
189
190
  })
191
+ }, {
192
+ title: (0, _react2.jsx)(_react.default.Fragment, null, (0, _react2.jsx)("kbd", null, copyModifier === 'Cmd' ? (0, _react2.jsx)(_i18n.EuiI18n, {
193
+ token: "euiKeyboardShortcuts.cmd",
194
+ default: "Cmd"
195
+ }) : (0, _react2.jsx)(_i18n.EuiI18n, {
196
+ token: "euiKeyboardShortcuts.ctrl",
197
+ default: "Ctrl"
198
+ })), ' ', (0, _react2.jsx)("kbd", null, (0, _react2.jsx)(_i18n.EuiI18n, {
199
+ token: "euiKeyboardShortcuts.copyTitle",
200
+ default: "C"
201
+ }))),
202
+ description: (0, _react2.jsx)(_i18n.EuiI18n, {
203
+ token: "euiKeyboardShortcuts.copyDescription",
204
+ default: "Copy the focused cell value"
205
+ })
190
206
  }]
191
207
  })));
192
- }, [isOpen, title, titleId, styles]);
208
+ }, [isOpen, title, titleId, styles, copyModifier]);
193
209
  return {
194
210
  keyboardShortcuts: keyboardShortcuts
195
211
  };
@@ -22,6 +22,7 @@ var _in_memory = require("./utils/in_memory");
22
22
  var _cell = require("./body/cell");
23
23
  var _row_count = require("./utils/row_count");
24
24
  var _data_grid_schema = require("./utils/data_grid_schema");
25
+ var _copy_focused_cell = require("./utils/copy_focused_cell");
25
26
  var _ref = require("./utils/ref");
26
27
  var _data_grid_types = require("./data_grid_types");
27
28
  var _data_grid = require("./data_grid.styles");
@@ -266,6 +267,7 @@ var EuiDataGrid = exports.EuiDataGrid = /*#__PURE__*/(0, _react.memo)( /*#__PURE
266
267
  var showToolbar = !!toolbarVisibility;
267
268
  var _useDataGridKeyboardS = (0, _controls.useDataGridKeyboardShortcuts)(),
268
269
  keyboardShortcuts = _useDataGridKeyboardS.keyboardShortcuts;
270
+ (0, _copy_focused_cell.useCopyFocusedDataGridCell)();
269
271
  var _useDataGridFullScree = (0, _controls.useDataGridFullScreenSelector)(onFullScreenChange),
270
272
  isFullScreen = _useDataGridFullScree.isFullScreen,
271
273
  setIsFullScreen = _useDataGridFullScree.setIsFullScreen,
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.useCopyFocusedDataGridCell = exports.copyFocusedDataGridCell = void 0;
7
+ var _react = require("react");
8
+ /*
9
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
10
+ * or more contributor license agreements. Licensed under the Elastic License
11
+ * 2.0 and the Server Side Public License, v 1; you may not use this file except
12
+ * in compliance with, at your election, the Elastic License 2.0 or the Server
13
+ * Side Public License, v 1.
14
+ */
15
+
16
+ /** Copies the focused data cell value when nothing is selected. */
17
+ var copyFocusedDataGridCell = exports.copyFocusedDataGridCell = function copyFocusedDataGridCell(event) {
18
+ var _window$getSelection, _ref, _cellContent$innerTex;
19
+ if (event.defaultPrevented) return;
20
+ var cell = document.activeElement;
21
+ if (!(cell instanceof HTMLElement)) return;
22
+ if (!cell.classList.contains('euiDataGridRowCell')) return;
23
+ if (cell.classList.contains('euiDataGridRowCell--controlColumn')) return;
24
+ if ((_window$getSelection = window.getSelection()) !== null && _window$getSelection !== void 0 && _window$getSelection.toString()) return;
25
+ if (!event.clipboardData) return;
26
+ var cellContent = cell.querySelector('[data-datagrid-cellcontent]');
27
+ var text = (_ref = (_cellContent$innerTex = cellContent === null || cellContent === void 0 ? void 0 : cellContent.innerText) !== null && _cellContent$innerTex !== void 0 ? _cellContent$innerTex : cellContent === null || cellContent === void 0 ? void 0 : cellContent.textContent) !== null && _ref !== void 0 ? _ref : '';
28
+ if (!text) return;
29
+ event.clipboardData.setData('text/plain', text);
30
+ event.preventDefault();
31
+ };
32
+ var useCopyFocusedDataGridCell = exports.useCopyFocusedDataGridCell = function useCopyFocusedDataGridCell() {
33
+ (0, _react.useEffect)(function () {
34
+ // The handler is static, so the browser dedupes identical listeners.
35
+ // Do not remove on unmount — that would disable copy for remaining grids.
36
+ // Same approach as OverrideCopiedTabularContent.
37
+ document.addEventListener('copy', copyFocusedDataGridCell);
38
+ }, []);
39
+ };
@@ -241,7 +241,7 @@ describe('EuiFilterGroup multiselect example', function () {
241
241
  cy.realPress('Enter');
242
242
  cy.get('input[role="combobox"]').then(function ($input) {
243
243
  var activeOptionId = $input.attr('aria-activedescendant');
244
- cy.get("li[id=\"".concat(activeOptionId, "\"]")).find('span.euiSelectableListItem__text').should('have.text', 'Dmitri Shostakovich. Checked option. To exclude this option, press Enter.');
244
+ cy.get("li[id=\"".concat(activeOptionId, "\"]")).find('span.euiSelectableListItem__text').should('have.text', 'Dmitri Shostakovich. To exclude this option, press Enter.');
245
245
  });
246
246
  cy.realPress('ArrowDown');
247
247
  cy.repeatRealPress('Enter');