@elastic/eui 92.0.0 → 92.1.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 (156) hide show
  1. package/dist/eui_theme_dark.css +3 -18
  2. package/dist/eui_theme_dark.min.css +1 -1
  3. package/dist/eui_theme_light.css +3 -18
  4. package/dist/eui_theme_light.min.css +1 -1
  5. package/es/components/aspect_ratio/aspect_ratio.js +1 -1
  6. package/es/components/collapsible_nav_beta/collapsible_nav_body_footer.js +7 -3
  7. package/es/components/collapsible_nav_beta/collapsible_nav_body_footer.styles.js +4 -4
  8. package/es/components/datagrid/body/{data_grid_cell.js → cell/data_grid_cell.js} +56 -209
  9. package/es/components/datagrid/body/{data_grid_cell_actions.js → cell/data_grid_cell_actions.js} +5 -5
  10. package/es/components/datagrid/body/{data_grid_cell_popover.js → cell/data_grid_cell_popover.js} +4 -4
  11. package/es/components/datagrid/body/{data_grid_cell_wrapper.js → cell/data_grid_cell_wrapper.js} +1 -1
  12. package/es/components/datagrid/body/cell/focus_utils.js +166 -0
  13. package/es/components/datagrid/body/cell/index.js +11 -0
  14. package/es/components/datagrid/body/data_grid_body.js +0 -2
  15. package/es/components/datagrid/body/data_grid_body_custom.js +1 -7
  16. package/es/components/datagrid/body/data_grid_body_virtualized.js +1 -7
  17. package/es/components/datagrid/body/footer/data_grid_footer_row.js +1 -2
  18. package/es/components/datagrid/body/header/data_grid_control_header_cell.js +3 -6
  19. package/es/components/datagrid/body/header/data_grid_header_cell.js +27 -12
  20. package/es/components/datagrid/body/header/data_grid_header_cell_wrapper.js +45 -116
  21. package/es/components/datagrid/body/header/data_grid_header_row.js +5 -10
  22. package/es/components/datagrid/body/header/use_data_grid_header.js +3 -14
  23. package/es/components/datagrid/data_grid.js +2 -12
  24. package/es/components/datagrid/utils/focus.js +25 -54
  25. package/es/components/datagrid/utils/scrolling.js +1 -1
  26. package/es/components/flyout/flyout_resizable.js +10 -10
  27. package/es/components/flyout/flyout_resizable.styles.js +12 -6
  28. package/es/components/resizable_container/helpers.js +5 -6
  29. package/es/components/resizable_container/resizable_button.js +13 -4
  30. package/es/components/resizable_container/resizable_button.styles.js +18 -8
  31. package/es/components/resizable_container/resizable_container.js +28 -22
  32. package/es/components/steps/step_number.styles.js +6 -7
  33. package/es/components/tree_view/tree_view.js +9 -2
  34. package/eui.d.ts +125 -90
  35. package/i18ntokens.json +108 -72
  36. package/lib/components/aspect_ratio/aspect_ratio.js +1 -1
  37. package/lib/components/collapsible_nav_beta/collapsible_nav_body_footer.js +7 -3
  38. package/lib/components/collapsible_nav_beta/collapsible_nav_body_footer.styles.js +4 -4
  39. package/lib/components/datagrid/body/{data_grid_cell.js → cell/data_grid_cell.js} +56 -209
  40. package/lib/components/datagrid/body/{data_grid_cell_actions.js → cell/data_grid_cell_actions.js} +5 -5
  41. package/lib/components/datagrid/body/{data_grid_cell_popover.js → cell/data_grid_cell_popover.js} +4 -4
  42. package/lib/components/datagrid/body/{data_grid_cell_wrapper.js → cell/data_grid_cell_wrapper.js} +1 -1
  43. package/lib/components/datagrid/body/cell/focus_utils.js +174 -0
  44. package/lib/components/datagrid/body/cell/index.js +32 -0
  45. package/lib/components/datagrid/body/data_grid_body.js +0 -2
  46. package/lib/components/datagrid/body/data_grid_body_custom.js +2 -8
  47. package/lib/components/datagrid/body/data_grid_body_virtualized.js +2 -8
  48. package/lib/components/datagrid/body/footer/data_grid_footer_row.js +5 -6
  49. package/lib/components/datagrid/body/header/data_grid_control_header_cell.js +3 -6
  50. package/lib/components/datagrid/body/header/data_grid_header_cell.js +35 -20
  51. package/lib/components/datagrid/body/header/data_grid_header_cell_wrapper.js +47 -119
  52. package/lib/components/datagrid/body/header/data_grid_header_row.js +5 -10
  53. package/lib/components/datagrid/body/header/use_data_grid_header.js +10 -24
  54. package/lib/components/datagrid/data_grid.js +4 -14
  55. package/lib/components/datagrid/utils/focus.js +26 -56
  56. package/lib/components/datagrid/utils/scrolling.js +2 -2
  57. package/lib/components/flyout/flyout_resizable.js +10 -10
  58. package/lib/components/flyout/flyout_resizable.styles.js +12 -6
  59. package/lib/components/resizable_container/helpers.js +7 -7
  60. package/lib/components/resizable_container/resizable_button.js +13 -4
  61. package/lib/components/resizable_container/resizable_button.styles.js +18 -8
  62. package/lib/components/resizable_container/resizable_container.js +28 -22
  63. package/lib/components/steps/step_number.styles.js +6 -7
  64. package/lib/components/tree_view/tree_view.js +9 -2
  65. package/optimize/es/components/aspect_ratio/aspect_ratio.js +1 -1
  66. package/optimize/es/components/collapsible_nav_beta/collapsible_nav_body_footer.js +7 -3
  67. package/optimize/es/components/collapsible_nav_beta/collapsible_nav_body_footer.styles.js +4 -4
  68. package/optimize/es/components/datagrid/body/{data_grid_cell.js → cell/data_grid_cell.js} +56 -209
  69. package/optimize/es/components/datagrid/body/{data_grid_cell_actions.js → cell/data_grid_cell_actions.js} +5 -5
  70. package/optimize/es/components/datagrid/body/{data_grid_cell_popover.js → cell/data_grid_cell_popover.js} +4 -4
  71. package/optimize/es/components/datagrid/body/{data_grid_cell_wrapper.js → cell/data_grid_cell_wrapper.js} +1 -1
  72. package/optimize/es/components/datagrid/body/cell/focus_utils.js +153 -0
  73. package/optimize/es/components/datagrid/body/cell/index.js +11 -0
  74. package/optimize/es/components/datagrid/body/data_grid_body_custom.js +1 -5
  75. package/optimize/es/components/datagrid/body/data_grid_body_virtualized.js +1 -5
  76. package/optimize/es/components/datagrid/body/footer/data_grid_footer_row.js +1 -2
  77. package/optimize/es/components/datagrid/body/header/data_grid_control_header_cell.js +2 -4
  78. package/optimize/es/components/datagrid/body/header/data_grid_header_cell.js +25 -10
  79. package/optimize/es/components/datagrid/body/header/data_grid_header_cell_wrapper.js +41 -115
  80. package/optimize/es/components/datagrid/body/header/data_grid_header_row.js +4 -8
  81. package/optimize/es/components/datagrid/body/header/use_data_grid_header.js +3 -13
  82. package/optimize/es/components/datagrid/data_grid.js +2 -12
  83. package/optimize/es/components/datagrid/utils/focus.js +25 -54
  84. package/optimize/es/components/datagrid/utils/scrolling.js +1 -1
  85. package/optimize/es/components/flyout/flyout_resizable.js +10 -10
  86. package/optimize/es/components/flyout/flyout_resizable.styles.js +12 -6
  87. package/optimize/es/components/resizable_container/helpers.js +5 -6
  88. package/optimize/es/components/resizable_container/resizable_button.js +5 -2
  89. package/optimize/es/components/resizable_container/resizable_button.styles.js +18 -8
  90. package/optimize/es/components/resizable_container/resizable_container.js +28 -22
  91. package/optimize/es/components/steps/step_number.styles.js +6 -7
  92. package/optimize/es/components/tree_view/tree_view.js +9 -2
  93. package/optimize/lib/components/aspect_ratio/aspect_ratio.js +1 -1
  94. package/optimize/lib/components/collapsible_nav_beta/collapsible_nav_body_footer.js +7 -3
  95. package/optimize/lib/components/collapsible_nav_beta/collapsible_nav_body_footer.styles.js +4 -4
  96. package/optimize/lib/components/datagrid/body/{data_grid_cell.js → cell/data_grid_cell.js} +56 -209
  97. package/optimize/lib/components/datagrid/body/{data_grid_cell_actions.js → cell/data_grid_cell_actions.js} +5 -5
  98. package/optimize/lib/components/datagrid/body/{data_grid_cell_popover.js → cell/data_grid_cell_popover.js} +4 -4
  99. package/optimize/lib/components/datagrid/body/{data_grid_cell_wrapper.js → cell/data_grid_cell_wrapper.js} +1 -1
  100. package/optimize/lib/components/datagrid/body/cell/focus_utils.js +163 -0
  101. package/optimize/lib/components/datagrid/body/cell/index.js +32 -0
  102. package/optimize/lib/components/datagrid/body/data_grid_body_custom.js +2 -6
  103. package/optimize/lib/components/datagrid/body/data_grid_body_virtualized.js +2 -6
  104. package/optimize/lib/components/datagrid/body/footer/data_grid_footer_row.js +5 -6
  105. package/optimize/lib/components/datagrid/body/header/data_grid_control_header_cell.js +2 -4
  106. package/optimize/lib/components/datagrid/body/header/data_grid_header_cell.js +25 -10
  107. package/optimize/lib/components/datagrid/body/header/data_grid_header_cell_wrapper.js +41 -115
  108. package/optimize/lib/components/datagrid/body/header/data_grid_header_row.js +4 -8
  109. package/optimize/lib/components/datagrid/body/header/use_data_grid_header.js +4 -14
  110. package/optimize/lib/components/datagrid/data_grid.js +4 -14
  111. package/optimize/lib/components/datagrid/utils/focus.js +26 -56
  112. package/optimize/lib/components/datagrid/utils/scrolling.js +2 -2
  113. package/optimize/lib/components/flyout/flyout_resizable.js +10 -10
  114. package/optimize/lib/components/flyout/flyout_resizable.styles.js +12 -6
  115. package/optimize/lib/components/resizable_container/helpers.js +7 -7
  116. package/optimize/lib/components/resizable_container/resizable_button.js +5 -2
  117. package/optimize/lib/components/resizable_container/resizable_button.styles.js +18 -8
  118. package/optimize/lib/components/resizable_container/resizable_container.js +28 -22
  119. package/optimize/lib/components/steps/step_number.styles.js +6 -7
  120. package/optimize/lib/components/tree_view/tree_view.js +9 -2
  121. package/package.json +1 -1
  122. package/src/components/datagrid/body/header/_data_grid_header_row.scss +8 -7
  123. package/test-env/components/aspect_ratio/aspect_ratio.js +1 -1
  124. package/test-env/components/collapsible_nav_beta/collapsible_nav_body_footer.js +7 -3
  125. package/test-env/components/collapsible_nav_beta/collapsible_nav_body_footer.styles.js +4 -4
  126. package/test-env/components/datagrid/body/{data_grid_cell.js → cell/data_grid_cell.js} +56 -209
  127. package/test-env/components/datagrid/body/{data_grid_cell_actions.js → cell/data_grid_cell_actions.js} +5 -5
  128. package/test-env/components/datagrid/body/{data_grid_cell_popover.js → cell/data_grid_cell_popover.js} +4 -4
  129. package/test-env/components/datagrid/body/{data_grid_cell_wrapper.js → cell/data_grid_cell_wrapper.js} +1 -1
  130. package/test-env/components/datagrid/body/cell/focus_utils.js +172 -0
  131. package/test-env/components/datagrid/body/cell/index.js +32 -0
  132. package/test-env/components/datagrid/body/data_grid_body.js +0 -2
  133. package/test-env/components/datagrid/body/data_grid_body_custom.js +2 -8
  134. package/test-env/components/datagrid/body/data_grid_body_virtualized.js +2 -8
  135. package/test-env/components/datagrid/body/footer/data_grid_footer_row.js +5 -6
  136. package/test-env/components/datagrid/body/header/data_grid_control_header_cell.js +3 -6
  137. package/test-env/components/datagrid/body/header/data_grid_header_cell.js +25 -10
  138. package/test-env/components/datagrid/body/header/data_grid_header_cell_wrapper.js +44 -116
  139. package/test-env/components/datagrid/body/header/data_grid_header_row.js +5 -10
  140. package/test-env/components/datagrid/body/header/use_data_grid_header.js +4 -14
  141. package/test-env/components/datagrid/data_grid.js +4 -14
  142. package/test-env/components/datagrid/utils/focus.js +26 -56
  143. package/test-env/components/datagrid/utils/scrolling.js +2 -2
  144. package/test-env/components/flyout/flyout_resizable.js +10 -10
  145. package/test-env/components/flyout/flyout_resizable.styles.js +12 -6
  146. package/test-env/components/resizable_container/helpers.js +7 -7
  147. package/test-env/components/resizable_container/resizable_button.js +13 -4
  148. package/test-env/components/resizable_container/resizable_button.styles.js +18 -8
  149. package/test-env/components/resizable_container/resizable_container.js +28 -22
  150. package/test-env/components/steps/step_number.styles.js +6 -7
  151. package/test-env/components/tree_view/tree_view.js +9 -2
  152. package/es/components/datagrid/body/header/header_is_interactive.js +0 -58
  153. package/lib/components/datagrid/body/header/header_is_interactive.js +0 -63
  154. package/optimize/es/components/datagrid/body/header/header_is_interactive.js +0 -53
  155. package/optimize/lib/components/datagrid/body/header/header_is_interactive.js +0 -61
  156. package/test-env/components/datagrid/body/header/header_is_interactive.js +0 -61
@@ -0,0 +1,11 @@
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
+
9
+ export { EuiDataGridCell } from './data_grid_cell';
10
+ export { Cell } from './data_grid_cell_wrapper';
11
+ export { DataGridCellPopoverContext, useCellPopover } from './data_grid_cell_popover';
@@ -567,8 +567,6 @@ EuiDataGridBody.propTypes = {
567
567
  renderCustomGridBody: PropTypes.func,
568
568
  interactiveCellId: PropTypes.string.isRequired,
569
569
  pagination: PropTypes.any,
570
- headerIsInteractive: PropTypes.bool.isRequired,
571
- handleHeaderMutation: PropTypes.any.isRequired,
572
570
  setVisibleColumns: PropTypes.func.isRequired,
573
571
  switchColumnPos: PropTypes.func.isRequired,
574
572
  onColumnResize: PropTypes.func,
@@ -33,7 +33,7 @@ import { useDefaultColumnWidth, useColumnWidths } from '../utils/col_widths';
33
33
  import { useRowHeightUtils, useDefaultRowHeight } from '../utils/row_heights';
34
34
  import { useDataGridHeader } from './header';
35
35
  import { useDataGridFooter } from './footer';
36
- import { Cell } from './data_grid_cell_wrapper';
36
+ import { Cell } from './cell';
37
37
  import { jsx as ___EmotionJSX } from "@emotion/react";
38
38
  export var EuiDataGridBodyCustomRender = function EuiDataGridBodyCustomRender(_ref) {
39
39
  var renderCustomGridBody = _ref.renderCustomGridBody,
@@ -48,8 +48,6 @@ export var EuiDataGridBodyCustomRender = function EuiDataGridBodyCustomRender(_r
48
48
  renderCellPopover = _ref.renderCellPopover,
49
49
  renderFooterCellValue = _ref.renderFooterCellValue,
50
50
  interactiveCellId = _ref.interactiveCellId,
51
- headerIsInteractive = _ref.headerIsInteractive,
52
- handleHeaderMutation = _ref.handleHeaderMutation,
53
51
  setVisibleColumns = _ref.setVisibleColumns,
54
52
  switchColumnPos = _ref.switchColumnPos,
55
53
  onColumnResize = _ref.onColumnResize,
@@ -95,8 +93,6 @@ export var EuiDataGridBodyCustomRender = function EuiDataGridBodyCustomRender(_r
95
93
  * Header & footer
96
94
  */
97
95
  var _useDataGridHeader = useDataGridHeader({
98
- headerIsInteractive: headerIsInteractive,
99
- handleHeaderMutation: handleHeaderMutation,
100
96
  switchColumnPos: switchColumnPos,
101
97
  setVisibleColumns: setVisibleColumns,
102
98
  leadingControlColumns: leadingControlColumns,
@@ -714,8 +710,6 @@ EuiDataGridBodyCustomRender.propTypes = {
714
710
  renderCustomGridBody: PropTypes.func,
715
711
  interactiveCellId: PropTypes.string.isRequired,
716
712
  pagination: PropTypes.any,
717
- headerIsInteractive: PropTypes.bool.isRequired,
718
- handleHeaderMutation: PropTypes.any.isRequired,
719
713
  setVisibleColumns: PropTypes.func.isRequired,
720
714
  switchColumnPos: PropTypes.func.isRequired,
721
715
  onColumnResize: PropTypes.func,
@@ -23,7 +23,7 @@ import { VariableSizeGrid as Grid } from 'react-window';
23
23
  import { useResizeObserver } from '../../observer/resize_observer';
24
24
  import { useDataGridHeader } from './header';
25
25
  import { useDataGridFooter } from './footer';
26
- import { Cell } from './data_grid_cell_wrapper';
26
+ import { Cell } from './cell';
27
27
  import { useRowManager } from './data_grid_row_manager';
28
28
  import { useFinalGridDimensions, useUnconstrainedHeight, useVirtualizeContainerWidth } from '../utils/grid_height_width';
29
29
  import { useDefaultColumnWidth, useColumnWidths } from '../utils/col_widths';
@@ -92,8 +92,6 @@ export var EuiDataGridBodyVirtualized = function EuiDataGridBodyVirtualized(_ref
92
92
  renderFooterCellValue = _ref3.renderFooterCellValue,
93
93
  interactiveCellId = _ref3.interactiveCellId,
94
94
  pagination = _ref3.pagination,
95
- headerIsInteractive = _ref3.headerIsInteractive,
96
- handleHeaderMutation = _ref3.handleHeaderMutation,
97
95
  setVisibleColumns = _ref3.setVisibleColumns,
98
96
  switchColumnPos = _ref3.switchColumnPos,
99
97
  onColumnResize = _ref3.onColumnResize,
@@ -143,8 +141,6 @@ export var EuiDataGridBodyVirtualized = function EuiDataGridBodyVirtualized(_ref
143
141
  * Header & footer
144
142
  */
145
143
  var _useDataGridHeader = useDataGridHeader({
146
- headerIsInteractive: headerIsInteractive,
147
- handleHeaderMutation: handleHeaderMutation,
148
144
  switchColumnPos: switchColumnPos,
149
145
  setVisibleColumns: setVisibleColumns,
150
146
  leadingControlColumns: leadingControlColumns,
@@ -843,8 +839,6 @@ EuiDataGridBodyVirtualized.propTypes = {
843
839
  renderCustomGridBody: PropTypes.func,
844
840
  interactiveCellId: PropTypes.string.isRequired,
845
841
  pagination: PropTypes.any,
846
- headerIsInteractive: PropTypes.bool.isRequired,
847
- handleHeaderMutation: PropTypes.any.isRequired,
848
842
  setVisibleColumns: PropTypes.func.isRequired,
849
843
  switchColumnPos: PropTypes.func.isRequired,
850
844
  onColumnResize: PropTypes.func,
@@ -12,8 +12,7 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
12
12
 
13
13
  import classnames from 'classnames';
14
14
  import React, { forwardRef, memo, useContext } from 'react';
15
- import { EuiDataGridCell } from '../data_grid_cell';
16
- import { DataGridCellPopoverContext } from '../data_grid_cell_popover';
15
+ import { EuiDataGridCell, DataGridCellPopoverContext } from '../cell';
17
16
  import { jsx as ___EmotionJSX } from "@emotion/react";
18
17
  var renderEmpty = function renderEmpty() {
19
18
  return null;
@@ -14,8 +14,7 @@ import { EuiDataGridHeaderCellWrapper } from './data_grid_header_cell_wrapper';
14
14
  import { jsx as ___EmotionJSX } from "@emotion/react";
15
15
  export var EuiDataGridControlHeaderCell = function EuiDataGridControlHeaderCell(_ref) {
16
16
  var controlColumn = _ref.controlColumn,
17
- index = _ref.index,
18
- headerIsInteractive = _ref.headerIsInteractive;
17
+ index = _ref.index;
19
18
  var HeaderCellRender = controlColumn.headerCellRender,
20
19
  headerCellProps = controlColumn.headerCellProps,
21
20
  width = controlColumn.width,
@@ -24,8 +23,7 @@ export var EuiDataGridControlHeaderCell = function EuiDataGridControlHeaderCell(
24
23
  className: classNames('euiDataGridHeaderCell--controlColumn', headerCellProps === null || headerCellProps === void 0 ? void 0 : headerCellProps.className),
25
24
  id: id,
26
25
  index: index,
27
- width: width,
28
- headerIsInteractive: headerIsInteractive
26
+ width: width
29
27
  }), ___EmotionJSX("div", {
30
28
  className: "euiDataGridHeaderCell__content"
31
29
  }, ___EmotionJSX(HeaderCellRender, null)));
@@ -61,6 +59,5 @@ EuiDataGridControlHeaderCell.propTypes = {
61
59
  * Optional props to pass to the column footer cell
62
60
  */
63
61
  footerCellProps: PropTypes.any
64
- }).isRequired,
65
- headerIsInteractive: PropTypes.bool.isRequired
62
+ }).isRequired
66
63
  };
@@ -1,15 +1,15 @@
1
1
  function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
2
2
  function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
3
3
  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)."; }
4
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
5
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
6
+ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
4
7
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
5
8
  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."); }
6
9
  function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
7
10
  function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
8
11
  function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
9
12
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
10
- function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
11
- function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
12
- function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
13
13
  /*
14
14
  * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
15
15
  * or more contributor license agreements. Licensed under the Elastic License
@@ -44,6 +44,7 @@ var _ref2 = process.env.NODE_ENV === "production" ? {
44
44
  toString: _EMOTION_STRINGIFIED_CSS_ERROR__
45
45
  };
46
46
  export var EuiDataGridHeaderCell = function EuiDataGridHeaderCell(_ref) {
47
+ var _classnames;
47
48
  var column = _ref.column,
48
49
  index = _ref.index,
49
50
  columns = _ref.columns,
@@ -53,15 +54,13 @@ export var EuiDataGridHeaderCell = function EuiDataGridHeaderCell(_ref) {
53
54
  defaultColumnWidth = _ref.defaultColumnWidth,
54
55
  setColumnWidth = _ref.setColumnWidth,
55
56
  setVisibleColumns = _ref.setVisibleColumns,
56
- switchColumnPos = _ref.switchColumnPos,
57
- headerIsInteractive = _ref.headerIsInteractive;
57
+ switchColumnPos = _ref.switchColumnPos;
58
58
  var id = column.id,
59
59
  display = column.display,
60
60
  displayAsText = column.displayAsText,
61
61
  displayHeaderCellProps = column.displayHeaderCellProps;
62
62
  var width = columnWidths[id] || defaultColumnWidth;
63
63
  var columnType = schema[id] ? schema[id].columnType : null;
64
- var classes = classnames(_defineProperty({}, "euiDataGridHeaderCell--".concat(columnType), columnType), displayHeaderCellProps === null || displayHeaderCellProps === void 0 ? void 0 : displayHeaderCellProps.className);
65
64
  var _useContext = useContext(DataGridFocusContext),
66
65
  setFocusedCell = _useContext.setFocusedCell,
67
66
  focusFirstVisibleInteractiveCell = _useContext.focusFirstVisibleInteractiveCell;
@@ -86,6 +85,14 @@ export var EuiDataGridHeaderCell = function EuiDataGridHeaderCell(_ref) {
86
85
  });
87
86
  var showColumnActions = columnActions && columnActions.length > 0;
88
87
  var actionsButtonRef = useRef(null);
88
+ var focusActionsButton = useCallback(function () {
89
+ var _actionsButtonRef$cur;
90
+ (_actionsButtonRef$cur = actionsButtonRef.current) === null || _actionsButtonRef$cur === void 0 ? void 0 : _actionsButtonRef$cur.focus();
91
+ }, []);
92
+ var _useState3 = useState(false),
93
+ _useState4 = _slicedToArray(_useState3, 2),
94
+ isActionsButtonFocused = _useState4[0],
95
+ setIsActionsButtonFocused = _useState4[1];
89
96
  var _useSortingUtils = useSortingUtils({
90
97
  sorting: sorting,
91
98
  id: id,
@@ -106,13 +113,16 @@ export var EuiDataGridHeaderCell = function EuiDataGridHeaderCell(_ref) {
106
113
  title: displayAsText || id,
107
114
  className: "euiDataGridHeaderCell__content"
108
115
  }, display || displayAsText || id), sortingArrow);
116
+ var classes = classnames((_classnames = {}, _defineProperty(_classnames, "euiDataGridHeaderCell--".concat(columnType), columnType), _defineProperty(_classnames, 'euiDataGridHeaderCell--hasColumnActions', showColumnActions), _defineProperty(_classnames, 'euiDataGridHeaderCell--isActionsPopoverOpen', isPopoverOpen), _classnames), displayHeaderCellProps === null || displayHeaderCellProps === void 0 ? void 0 : displayHeaderCellProps.className);
109
117
  return ___EmotionJSX(EuiDataGridHeaderCellWrapper, _extends({}, displayHeaderCellProps, {
110
118
  className: classes,
111
119
  id: id,
112
120
  index: index,
113
121
  width: width,
114
- headerIsInteractive: headerIsInteractive,
115
- "aria-sort": ariaSort
122
+ "aria-sort": ariaSort,
123
+ hasActionsPopover: showColumnActions,
124
+ isActionsButtonFocused: isActionsButtonFocused,
125
+ focusActionsButton: focusActionsButton
116
126
  }), column.isResizable !== false && width != null ? ___EmotionJSX(EuiDataGridColumnResizer, {
117
127
  columnId: id,
118
128
  columnWidth: width,
@@ -120,11 +130,16 @@ export var EuiDataGridHeaderCell = function EuiDataGridHeaderCell(_ref) {
120
130
  }) : null, !showColumnActions ? ___EmotionJSX(React.Fragment, null, cellContent, sortingScreenReaderText && ___EmotionJSX(EuiScreenReaderOnly, null, ___EmotionJSX("p", null, sortingScreenReaderText))) : ___EmotionJSX(React.Fragment, null, ___EmotionJSX("button", {
121
131
  className: "euiDataGridHeaderCell__button",
122
132
  onClick: function onClick() {
123
- setFocusedCell([index, -1]);
124
- setIsPopoverOpen(function (isPopoverOpen) {
133
+ return setIsPopoverOpen(function (isPopoverOpen) {
125
134
  return !isPopoverOpen;
126
135
  });
127
136
  },
137
+ onFocus: function onFocus() {
138
+ return setIsActionsButtonFocused(true);
139
+ },
140
+ onBlur: function onBlur() {
141
+ return setIsActionsButtonFocused(false);
142
+ },
128
143
  "aria-describedby": "".concat(sortingAriaId, " ").concat(actionsAriaId),
129
144
  ref: actionsButtonRef,
130
145
  "data-test-subj": "dataGridHeaderCellActionButton-".concat(id)
@@ -138,8 +153,8 @@ export var EuiDataGridHeaderCell = function EuiDataGridHeaderCell(_ref) {
138
153
  focusTrapProps: {
139
154
  // We need to override the default EuiPopover `onClickOutside` since the anchor is separate from the actual button
140
155
  onClickOutside: function onClickOutside(event) {
141
- var _actionsButtonRef$cur;
142
- if (((_actionsButtonRef$cur = actionsButtonRef.current) === null || _actionsButtonRef$cur === void 0 ? void 0 : _actionsButtonRef$cur.contains(event.target)) === false) {
156
+ var _actionsButtonRef$cur2;
157
+ if (((_actionsButtonRef$cur2 = actionsButtonRef.current) === null || _actionsButtonRef$cur2 === void 0 ? void 0 : _actionsButtonRef$cur2.contains(event.target)) === false) {
143
158
  setIsPopoverOpen(false);
144
159
  }
145
160
  }
@@ -1,4 +1,4 @@
1
- var _excluded = ["id", "index", "headerIsInteractive", "width", "className", "children"];
1
+ var _excluded = ["id", "index", "width", "className", "children", "hasActionsPopover", "isActionsButtonFocused", "focusActionsButton"];
2
2
  function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
3
3
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
4
4
  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."); }
@@ -18,123 +18,69 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
18
18
 
19
19
  import classnames from 'classnames';
20
20
  import PropTypes from "prop-types";
21
- import React, { useContext, useEffect, useRef, useState } from 'react';
22
- import { tabbable } from 'tabbable';
23
- import { keys } from '../../../../services';
21
+ import React, { useContext, useEffect, useState, useCallback } from 'react';
24
22
  import { DataGridFocusContext } from '../../utils/focus';
25
- import { jsx as ___EmotionJSX } from "@emotion/react";
23
+ import { HandleInteractiveChildren } from '../cell/focus_utils';
24
+
26
25
  /**
27
26
  * This is a wrapper that handles repeated concerns between control &
28
27
  * standard header cells. Most of its shared logic is around focus state/UX,
29
28
  * but it also DRY's out certain class/data-test-subj/style attributes
30
29
  */
30
+ import { jsx as ___EmotionJSX } from "@emotion/react";
31
31
  export var EuiDataGridHeaderCellWrapper = function EuiDataGridHeaderCellWrapper(_ref) {
32
32
  var id = _ref.id,
33
33
  index = _ref.index,
34
- headerIsInteractive = _ref.headerIsInteractive,
35
34
  width = _ref.width,
36
35
  className = _ref.className,
37
36
  children = _ref.children,
37
+ hasActionsPopover = _ref.hasActionsPopover,
38
+ isActionsButtonFocused = _ref.isActionsButtonFocused,
39
+ focusActionsButton = _ref.focusActionsButton,
38
40
  rest = _objectWithoutProperties(_ref, _excluded);
39
41
  var classes = classnames('euiDataGridHeaderCell', className);
42
+
43
+ // Must be a state and not a ref to trigger a HandleInteractiveChildren rerender
44
+ var _useState = useState(null),
45
+ _useState2 = _slicedToArray(_useState, 2),
46
+ headerEl = _useState2[0],
47
+ setHeaderEl = _useState2[1];
40
48
  var _useContext = useContext(DataGridFocusContext),
41
49
  setFocusedCell = _useContext.setFocusedCell,
42
50
  onFocusUpdate = _useContext.onFocusUpdate;
43
- var _useState = useState(false),
44
- _useState2 = _slicedToArray(_useState, 2),
45
- isFocused = _useState2[0],
46
- setIsFocused = _useState2[1];
51
+ var updateCellFocusContext = useCallback(function () {
52
+ setFocusedCell([index, -1]);
53
+ }, [index, setFocusedCell]);
54
+ var _useState3 = useState(false),
55
+ _useState4 = _slicedToArray(_useState3, 2),
56
+ isFocused = _useState4[0],
57
+ setIsFocused = _useState4[1];
47
58
  useEffect(function () {
48
59
  onFocusUpdate([index, -1], function (isFocused) {
49
60
  setIsFocused(isFocused);
50
61
  });
51
62
  }, [index, onFocusUpdate]);
52
- var headerRef = useRef(null);
53
- var _useState3 = useState(false),
54
- _useState4 = _slicedToArray(_useState3, 2),
55
- isCellEntered = _useState4[0],
56
- setIsCellEntered = _useState4[1];
57
- useEffect(function () {
58
- var headerNode = headerRef.current;
59
- if (isCellEntered) {
60
- enableAndFocusInteractives(headerNode);
61
- } else {
62
- disableInteractives(headerNode);
63
- }
64
- }, [isCellEntered]);
65
63
  useEffect(function () {
66
- var headerNode = headerRef.current;
67
- if (isFocused) {
68
- var interactives = headerNode.querySelectorAll('[data-euigrid-tab-managed]');
69
- if (interactives.length === 1) {
70
- setIsCellEntered(true);
71
- } else {
72
- headerNode.focus();
64
+ if (isFocused && headerEl) {
65
+ // Only focus the cell if not already focused on something in the cell
66
+ if (!headerEl.contains(document.activeElement)) {
67
+ headerEl.focus();
73
68
  }
74
- } else {
75
- setIsCellEntered(false);
76
69
  }
70
+ }, [isFocused, headerEl]);
77
71
 
78
- // focusin bubbles while focus does not, and this needs to react to children gaining focus
79
- var onFocusIn = function onFocusIn(e) {
80
- if (!headerIsInteractive) {
81
- // header is not interactive, avoid focusing
82
- requestAnimationFrame(function () {
83
- return headerNode.blur();
84
- });
85
- e.preventDefault();
86
- return false;
87
- } else {
88
- // take the focus
89
- if (isFocused === false) {
90
- setFocusedCell([index, -1]);
91
- } else {
92
- // this cell already had the grid's focus, so re-enable and focus interactives
93
- setIsCellEntered(true);
94
- }
95
- }
96
- };
97
-
98
- // focusout bubbles while blur does not, and this needs to react to the children losing focus
99
- var onFocusOut = function onFocusOut() {
100
- // wait for the next element to receive focus, then update interactives' state
101
- requestAnimationFrame(function () {
102
- if (!headerNode.contains(document.activeElement)) {
103
- setIsCellEntered(false);
104
- }
105
- });
106
- };
107
- var onKeyUp = function onKeyUp(event) {
108
- switch (event.key) {
109
- case keys.ENTER:
110
- {
111
- event.preventDefault();
112
- setIsCellEntered(true);
113
- break;
114
- }
115
- case keys.ESCAPE:
116
- {
117
- event.preventDefault();
118
- // move focus to cell
119
- setIsCellEntered(false);
120
- headerNode.focus();
121
- break;
122
- }
123
- }
124
- };
125
- headerNode.addEventListener('focusin', onFocusIn);
126
- headerNode.addEventListener('focusout', onFocusOut);
127
- headerNode.addEventListener('keyup', onKeyUp);
128
- return function () {
129
- headerNode.removeEventListener('focusin', onFocusIn);
130
- headerNode.removeEventListener('focusout', onFocusOut);
131
- headerNode.removeEventListener('keyup', onKeyUp);
132
- };
133
- }, [headerIsInteractive, isFocused, index, setFocusedCell]);
72
+ // For cell headers with actions, auto-focus into the button instead of the cell wrapper div
73
+ // The button text is significantly more useful to screen readers (e.g. contains sort order & hints)
74
+ var onFocus = useCallback(function (e) {
75
+ if (hasActionsPopover && e.target === headerEl) {
76
+ focusActionsButton === null || focusActionsButton === void 0 ? void 0 : focusActionsButton();
77
+ }
78
+ }, [hasActionsPopover, focusActionsButton, headerEl]);
134
79
  return ___EmotionJSX("div", _extends({
135
80
  role: "columnheader",
136
- ref: headerRef,
137
- tabIndex: isFocused && !isCellEntered ? 0 : -1,
81
+ ref: setHeaderEl,
82
+ tabIndex: isFocused && !isActionsButtonFocused ? 0 : -1,
83
+ onFocus: onFocus,
138
84
  className: classes,
139
85
  "data-test-subj": "dataGridHeaderCell-".concat(id),
140
86
  "data-gridcell-column-id": id,
@@ -144,35 +90,18 @@ export var EuiDataGridHeaderCellWrapper = function EuiDataGridHeaderCellWrapper(
144
90
  style: width != null ? {
145
91
  width: "".concat(width, "px")
146
92
  } : {}
147
- }, rest), children);
93
+ }, rest), ___EmotionJSX(HandleInteractiveChildren, {
94
+ cellEl: headerEl,
95
+ updateCellFocusContext: updateCellFocusContext,
96
+ renderFocusTrap: !hasActionsPopover
97
+ }, children));
148
98
  };
149
-
150
- /**
151
- * Utility fns for managing child interactive tabIndex state
152
- */
153
99
  EuiDataGridHeaderCellWrapper.propTypes = {
154
100
  id: PropTypes.string.isRequired,
155
101
  index: PropTypes.number.isRequired,
156
- headerIsInteractive: PropTypes.bool.isRequired,
157
102
  width: PropTypes.oneOfType([PropTypes.number.isRequired, PropTypes.oneOf([null])]),
158
- className: PropTypes.string
159
- };
160
- var disableInteractives = function disableInteractives(headerNode) {
161
- var tabbables = tabbable(headerNode);
162
- if (tabbables.length > 1) {
163
- console.warn("EuiDataGridHeaderCell expects at most 1 tabbable element, ".concat(tabbables.length, " found instead"));
164
- }
165
- tabbables.forEach(function (element) {
166
- element.setAttribute('data-euigrid-tab-managed', 'true');
167
- element.setAttribute('tabIndex', '-1');
168
- });
169
- };
170
- var enableAndFocusInteractives = function enableAndFocusInteractives(headerNode) {
171
- var interactiveElements = headerNode.querySelectorAll('[data-euigrid-tab-managed]');
172
- interactiveElements.forEach(function (element, i) {
173
- element.setAttribute('tabIndex', '0');
174
- if (i === 0) {
175
- element.focus();
176
- }
177
- });
103
+ className: PropTypes.string,
104
+ hasActionsPopover: PropTypes.bool,
105
+ isActionsButtonFocused: PropTypes.bool,
106
+ focusActionsButton: PropTypes.func
178
107
  };
@@ -1,4 +1,4 @@
1
- var _excluded = ["leadingControlColumns", "trailingControlColumns", "columns", "schema", "schemaDetectors", "columnWidths", "defaultColumnWidth", "className", "setColumnWidth", "setVisibleColumns", "switchColumnPos", "headerIsInteractive", "data-test-subj"];
1
+ var _excluded = ["leadingControlColumns", "trailingControlColumns", "columns", "schema", "schemaDetectors", "columnWidths", "defaultColumnWidth", "className", "setColumnWidth", "setVisibleColumns", "switchColumnPos", "data-test-subj"];
2
2
  function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
3
3
  function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
4
4
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
@@ -31,7 +31,6 @@ var EuiDataGridHeaderRow = /*#__PURE__*/forwardRef(function (props, ref) {
31
31
  setColumnWidth = props.setColumnWidth,
32
32
  setVisibleColumns = props.setVisibleColumns,
33
33
  switchColumnPos = props.switchColumnPos,
34
- headerIsInteractive = props.headerIsInteractive,
35
34
  _dataTestSubj = props['data-test-subj'],
36
35
  rest = _objectWithoutProperties(props, _excluded);
37
36
  var classes = classnames('euiDataGridHeader', className);
@@ -45,8 +44,7 @@ var EuiDataGridHeaderRow = /*#__PURE__*/forwardRef(function (props, ref) {
45
44
  return ___EmotionJSX(EuiDataGridControlHeaderCell, {
46
45
  key: controlColumn.id,
47
46
  index: index,
48
- controlColumn: controlColumn,
49
- headerIsInteractive: headerIsInteractive
47
+ controlColumn: controlColumn
50
48
  });
51
49
  }), columns.map(function (column, index) {
52
50
  return ___EmotionJSX(EuiDataGridHeaderCell, {
@@ -60,15 +58,13 @@ var EuiDataGridHeaderRow = /*#__PURE__*/forwardRef(function (props, ref) {
60
58
  setColumnWidth: setColumnWidth,
61
59
  setVisibleColumns: setVisibleColumns,
62
60
  switchColumnPos: switchColumnPos,
63
- defaultColumnWidth: defaultColumnWidth,
64
- headerIsInteractive: headerIsInteractive
61
+ defaultColumnWidth: defaultColumnWidth
65
62
  });
66
63
  }), trailingControlColumns.map(function (controlColumn, index) {
67
64
  return ___EmotionJSX(EuiDataGridControlHeaderCell, {
68
65
  key: controlColumn.id,
69
66
  index: index + leadingControlColumns.length + columns.length,
70
- controlColumn: controlColumn,
71
- headerIsInteractive: headerIsInteractive
67
+ controlColumn: controlColumn
72
68
  });
73
69
  }));
74
70
  });
@@ -607,8 +603,7 @@ EuiDataGridHeaderRow.propTypes = {
607
603
  defaultColumnWidth: PropTypes.oneOfType([PropTypes.number.isRequired, PropTypes.oneOf([null])]),
608
604
  setColumnWidth: PropTypes.func.isRequired,
609
605
  setVisibleColumns: PropTypes.func.isRequired,
610
- switchColumnPos: PropTypes.func.isRequired,
611
- headerIsInteractive: PropTypes.bool.isRequired
606
+ switchColumnPos: PropTypes.func.isRequired
612
607
  };
613
608
  EuiDataGridHeaderRow.displayName = 'EuiDataGridHeaderRow';
614
609
  export { EuiDataGridHeaderRow };
@@ -1,4 +1,3 @@
1
- var _excluded = ["handleHeaderMutation"];
2
1
  function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
3
2
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
4
3
  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."); }
@@ -6,8 +5,6 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
6
5
  function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
7
6
  function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
8
7
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
9
- function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
10
- function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
11
8
  /*
12
9
  * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
13
10
  * or more contributor license agreements. Licensed under the Elastic License
@@ -17,25 +14,18 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
17
14
  */
18
15
 
19
16
  import React, { useState, useMemo } from 'react';
20
- import { useMutationObserver } from '../../../observer/mutation_observer';
21
17
  import { useResizeObserver } from '../../../observer/resize_observer';
22
- import { useHeaderFocusWorkaround } from '../../utils/focus';
23
18
  import { EuiDataGridHeaderRow } from './data_grid_header_row';
24
- import { jsx as ___EmotionJSX } from "@emotion/react";
19
+
25
20
  /**
26
21
  * DRY out setting up the grid header and its refs & observers
27
22
  */
28
- export var useDataGridHeader = function useDataGridHeader(_ref) {
29
- var handleHeaderMutation = _ref.handleHeaderMutation,
30
- props = _objectWithoutProperties(_ref, _excluded);
23
+ import { jsx as ___EmotionJSX } from "@emotion/react";
24
+ export var useDataGridHeader = function useDataGridHeader(props) {
31
25
  var _useState = useState(null),
32
26
  _useState2 = _slicedToArray(_useState, 2),
33
27
  headerRowRef = _useState2[0],
34
28
  setHeaderRowRef = _useState2[1];
35
- useMutationObserver(headerRowRef, handleHeaderMutation, {
36
- subtree: true,
37
- childList: true
38
- });
39
29
  var _useResizeObserver = useResizeObserver(headerRowRef, 'height'),
40
30
  headerRowHeight = _useResizeObserver.height;
41
31
  var headerRow = useMemo(function () {
@@ -44,7 +34,6 @@ export var useDataGridHeader = function useDataGridHeader(_ref) {
44
34
  }, props));
45
35
  }, Object.values(props)); // eslint-disable-line react-hooks/exhaustive-deps
46
36
 
47
- useHeaderFocusWorkaround(props.headerIsInteractive);
48
37
  return {
49
38
  headerRow: headerRow,
50
39
  headerRowHeight: headerRowHeight
@@ -40,8 +40,7 @@ import { useDataGridColumnSelector, useDataGridColumnSorting, useDataGridDisplay
40
40
  import { DataGridSortingContext, useSorting } from './utils/sorting';
41
41
  import { DataGridFocusContext, useFocus, createKeyDownHandler, preventTabbing } from './utils/focus';
42
42
  import { useInMemoryValues, EuiDataGridInMemoryRenderer } from './utils/in_memory';
43
- import { useHeaderIsInteractive } from './body/header/header_is_interactive';
44
- import { DataGridCellPopoverContext, useCellPopover } from './body/data_grid_cell_popover';
43
+ import { DataGridCellPopoverContext, useCellPopover } from './body/cell';
45
44
  import { computeVisibleRows } from './utils/row_count';
46
45
  import { EuiDataGridPaginationRenderer } from './utils/data_grid_pagination';
47
46
  import { schemaDetectors as providedSchemaDetectors, useMergedSchema } from './utils/data_grid_schema';
@@ -211,13 +210,7 @@ export var EuiDataGrid = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function (pr
211
210
  /**
212
211
  * Focus
213
212
  */
214
- var _useHeaderIsInteracti = useHeaderIsInteractive(contentRef.current),
215
- headerIsInteractive = _useHeaderIsInteracti.headerIsInteractive,
216
- handleHeaderMutation = _useHeaderIsInteracti.handleHeaderMutation;
217
- var _useFocus = useFocus({
218
- headerIsInteractive: headerIsInteractive,
219
- gridItemsRendered: gridItemsRendered
220
- }),
213
+ var _useFocus = useFocus(),
221
214
  wrappingDivFocusProps = _useFocus.focusProps,
222
215
  focusContext = _objectWithoutProperties(_useFocus, _excluded2);
223
216
 
@@ -345,7 +338,6 @@ export var EuiDataGrid = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function (pr
345
338
  rowCount: rowCount,
346
339
  pagination: pagination,
347
340
  hasFooter: !!renderFooterCellValue,
348
- headerIsInteractive: headerIsInteractive,
349
341
  focusContext: focusContext
350
342
  }),
351
343
  "data-test-subj": "euiDataGridBody",
@@ -362,8 +354,6 @@ export var EuiDataGrid = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function (pr
362
354
  setVisibleColumns: setVisibleColumns,
363
355
  switchColumnPos: switchColumnPos,
364
356
  onColumnResize: onColumnResize,
365
- headerIsInteractive: headerIsInteractive,
366
- handleHeaderMutation: handleHeaderMutation,
367
357
  schemaDetectors: allSchemaDetectors,
368
358
  pagination: pagination,
369
359
  renderCellValue: renderCellValue,