@elastic/eui 92.0.0 → 92.1.1

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} +111 -244
  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 +130 -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} +111 -244
  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} +111 -244
  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} +111 -244
  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} +111 -244
  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
@@ -27,7 +27,7 @@ export var EuiAspectRatio = function EuiAspectRatio(_ref) {
27
27
  style = _ref.style,
28
28
  rest = _objectWithoutProperties(_ref, _excluded);
29
29
  var classes = classNames('euiAspectRatio', className);
30
- var euiAspectRatioStyle = _objectSpread({
30
+ var euiAspectRatioStyle = _objectSpread(_objectSpread({}, children.props.style), {}, {
31
31
  aspectRatio: "".concat(width, " / ").concat(height),
32
32
  height: 'auto',
33
33
  width: '100%',
@@ -1,5 +1,5 @@
1
1
  var _excluded = ["className"],
2
- _excluded2 = ["className"];
2
+ _excluded2 = ["className", "children"];
3
3
  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); }
4
4
  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; }
5
5
  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; }
@@ -45,6 +45,7 @@ export var EuiCollapsibleNavBody = function EuiCollapsibleNavBody(_ref) {
45
45
  };
46
46
  export var EuiCollapsibleNavFooter = function EuiCollapsibleNavFooter(_ref2) {
47
47
  var className = _ref2.className,
48
+ children = _ref2.children,
48
49
  props = _objectWithoutProperties(_ref2, _excluded2);
49
50
  var classes = classNames('euiCollapsibleNav__footer', className);
50
51
  var _useContext2 = useContext(EuiCollapsibleNavContext),
@@ -52,9 +53,12 @@ export var EuiCollapsibleNavFooter = function EuiCollapsibleNavFooter(_ref2) {
52
53
  isPush = _useContext2.isPush;
53
54
  var euiTheme = useEuiTheme();
54
55
  var styles = euiCollapsibleNavFooterStyles(euiTheme);
55
- var cssStyles = [styles.euiCollapsibleNav__footer, isCollapsed && isPush && styles.isPushCollapsed];
56
+ var cssStyles = styles.euiCollapsibleNav__footer;
57
+ var overflowWrapperStyles = [styles.euiFlyoutFooter__overflow, isCollapsed && isPush && styles.isPushCollapsed];
56
58
  return ___EmotionJSX(EuiFlyoutFooter, _extends({
57
59
  className: classes,
58
60
  css: cssStyles
59
- }, props));
61
+ }, props), ___EmotionJSX("div", {
62
+ css: overflowWrapperStyles
63
+ }, children));
60
64
  };
@@ -13,16 +13,16 @@ import { logicalCSS, euiYScrollWithShadows } from '../../global_styling';
13
13
  // Otherwise if scrollbars are visible, button icon visibility suffers.
14
14
  export var hideScrollbars = "\n scrollbar-width: none; /* Firefox */\n\n &::-webkit-scrollbar {\n display: none; /* Chrome, Edge, & Safari */\n }\n";
15
15
  export var euiCollapsibleNavBodyStyles = {
16
- // In case things get really dire responsively, ensure the footer doesn't overtake the body
17
- euiCollapsibleNav__body: /*#__PURE__*/css(logicalCSS('min-height', '50%'), ";;label:euiCollapsibleNav__body;"),
16
+ euiCollapsibleNav__body: /*#__PURE__*/css(";label:euiCollapsibleNav__body;"),
18
17
  isPushCollapsed: /*#__PURE__*/css(".euiFlyoutBody__overflow{", hideScrollbars, ";};label:isPushCollapsed;")
19
18
  };
20
19
  export var euiCollapsibleNavFooterStyles = function euiCollapsibleNavFooterStyles(euiThemeContext) {
21
20
  var euiTheme = euiThemeContext.euiTheme;
22
21
  return {
23
- euiCollapsibleNav__footer: /*#__PURE__*/css("background-color:", euiTheme.colors.emptyShade, ";", logicalCSS('border-top', euiTheme.border.thin), " ", euiYScrollWithShadows(euiThemeContext, {
22
+ euiCollapsibleNav__footer: /*#__PURE__*/css(logicalCSS('max-height', '50%'), " background-color:", euiTheme.colors.emptyShade, ";", logicalCSS('border-top', euiTheme.border.thin), ";;label:euiCollapsibleNav__footer;"),
23
+ euiFlyoutFooter__overflow: /*#__PURE__*/css(euiYScrollWithShadows(euiThemeContext, {
24
24
  side: 'end'
25
- }), ";;label:euiCollapsibleNav__footer;"),
25
+ }), ";;label:euiFlyoutFooter__overflow;"),
26
26
  isPushCollapsed: /*#__PURE__*/css(hideScrollbars, ";;label:isPushCollapsed;")
27
27
  };
28
28
  };
@@ -32,17 +32,16 @@ import classNames from 'classnames';
32
32
  import PropTypes from "prop-types";
33
33
  import React, { Component, createRef, memo } from 'react';
34
34
  import { createPortal } from 'react-dom';
35
- import { tabbable } from 'tabbable';
36
- import { keys } from '../../../services';
37
- import { EuiScreenReaderOnly } from '../../accessibility';
38
- import { EuiFocusTrap } from '../../focus_trap';
39
- import { EuiI18n } from '../../i18n';
40
- import { EuiTextBlockTruncate } from '../../text_truncate';
41
- import { hasResizeObserver } from '../../observer/resize_observer/resize_observer';
42
- import { DataGridFocusContext } from '../utils/focus';
35
+ import { IS_JEST_ENVIRONMENT } from '../../../../utils';
36
+ import { keys } from '../../../../services';
37
+ import { EuiScreenReaderOnly } from '../../../accessibility';
38
+ import { EuiI18n } from '../../../i18n';
39
+ import { EuiTextBlockTruncate } from '../../../text_truncate';
40
+ import { hasResizeObserver } from '../../../observer/resize_observer/resize_observer';
41
+ import { DataGridFocusContext } from '../../utils/focus';
43
42
  import { EuiDataGridCellActions, EuiDataGridCellPopoverActions } from './data_grid_cell_actions';
44
43
  import { DefaultCellPopover } from './data_grid_cell_popover';
45
- import { IS_JEST_ENVIRONMENT } from '../../../utils';
44
+ import { HandleInteractiveChildren } from './focus_utils';
46
45
  import { jsx as ___EmotionJSX } from "@emotion/react";
47
46
  var EuiDataGridCellContent = /*#__PURE__*/memo(function (_ref) {
48
47
  var renderCellValue = _ref.renderCellValue,
@@ -92,7 +91,10 @@ var EuiDataGridCellContent = /*#__PURE__*/memo(function (_ref) {
92
91
  col: colIndex + 1,
93
92
  row: ariaRowIndex
94
93
  }
95
- })));
94
+ }), cellActions && ___EmotionJSX(React.Fragment, null, '. ', ___EmotionJSX(EuiI18n, {
95
+ token: "euiDataGridCell.expansionEnterPrompt",
96
+ default: "Press the Enter key to expand this cell."
97
+ }))));
96
98
  return ___EmotionJSX(React.Fragment, null, cellContent, screenReaderText, cellActions);
97
99
  });
98
100
  EuiDataGridCellContent.propTypes = {
@@ -595,43 +597,21 @@ export var EuiDataGridCell = /*#__PURE__*/function (_Component) {
595
597
  _defineProperty(_assertThisInitialized(_this), "state", {
596
598
  cellProps: {},
597
599
  isFocused: false,
598
- isEntered: false,
599
- enableInteractions: false,
600
- disableCellTabIndex: false,
600
+ isHovered: false,
601
601
  cellTextAlign: 'Left'
602
602
  });
603
603
  _defineProperty(_assertThisInitialized(_this), "unsubscribeCell", void 0);
604
- _defineProperty(_assertThisInitialized(_this), "focusTimeout", void 0);
605
604
  _defineProperty(_assertThisInitialized(_this), "style", null);
606
- _defineProperty(_assertThisInitialized(_this), "getInteractables", function () {
607
- var tabbingRef = _this.cellContentsRef;
608
- if (tabbingRef) {
609
- return tabbingRef.querySelectorAll('[data-datagrid-interactable=true]');
610
- }
611
- return [];
605
+ _defineProperty(_assertThisInitialized(_this), "updateCellFocusContext", function () {
606
+ _this.context.setFocusedCell([_this.props.colIndex, _this.props.visibleRowIndex]);
612
607
  });
613
608
  _defineProperty(_assertThisInitialized(_this), "takeFocus", function (preventScroll) {
614
609
  var cell = _this.cellRef.current;
615
- if (cell) {
616
- // only update focus if we are not already focused on something in this cell
617
- var element = document.activeElement;
618
- while (element != null && element !== cell) {
619
- element = element.parentElement;
620
- }
621
- var doFocusUpdate = element !== cell;
622
- if (doFocusUpdate) {
623
- var interactables = _this.getInteractables();
624
- if (_this.isExpandable() === false && interactables.length === 1) {
625
- // Only one element can be interacted with
626
- interactables[0].focus({
627
- preventScroll: preventScroll
628
- });
629
- } else {
630
- cell.focus({
631
- preventScroll: preventScroll
632
- });
633
- }
634
- }
610
+ // Only focus the cell if not already focused on something in the cell
611
+ if (cell && !cell.contains(document.activeElement)) {
612
+ cell.focus({
613
+ preventScroll: preventScroll
614
+ });
635
615
  }
636
616
  });
637
617
  _defineProperty(_assertThisInitialized(_this), "recalculateAutoHeight", function () {
@@ -700,61 +680,8 @@ export var EuiDataGridCell = /*#__PURE__*/function (_Component) {
700
680
  } else if (_this.contentObserver) {
701
681
  _this.contentObserver.disconnect();
702
682
  }
703
- _this.preventTabbing();
704
683
  _this.setCellTextAlign();
705
684
  });
706
- _defineProperty(_assertThisInitialized(_this), "onFocus", function (e) {
707
- // only perform this logic when the event's originating element (e.target) is
708
- // the wrapping element with the onFocus logic
709
- // reasons:
710
- // * the outcome is only meaningful when the focus shifts to the wrapping element
711
- // * if the cell children include portalled content React will bubble the focus
712
- // event up, which can trigger the focus() call below, causing focus lock fighting
713
- if (_this.cellRef.current === e.target) {
714
- var _this$props5 = _this.props,
715
- colIndex = _this$props5.colIndex,
716
- visibleRowIndex = _this$props5.visibleRowIndex;
717
- // focus in next tick to give potential focus capturing mechanisms time to release their traps
718
- // also clear any previous focus timeout that may still be queued
719
- if (EuiDataGridCell.activeFocusTimeoutId) {
720
- window.clearTimeout(EuiDataGridCell.activeFocusTimeoutId);
721
- }
722
- EuiDataGridCell.activeFocusTimeoutId = _this.focusTimeout = window.setTimeout(function () {
723
- _this.context.setFocusedCell([colIndex, visibleRowIndex]);
724
- var interactables = _this.getInteractables();
725
- if (interactables.length === 1 && _this.isExpandable() === false) {
726
- interactables[0].focus();
727
- _this.setState({
728
- disableCellTabIndex: true
729
- });
730
- }
731
- }, 0);
732
- }
733
- });
734
- _defineProperty(_assertThisInitialized(_this), "onBlur", function () {
735
- _this.setState({
736
- disableCellTabIndex: false
737
- });
738
- });
739
- _defineProperty(_assertThisInitialized(_this), "preventTabbing", function () {
740
- if (_this.cellContentsRef) {
741
- var tabbables = tabbable(_this.cellContentsRef);
742
- for (var i = 0; i < tabbables.length; i++) {
743
- var element = tabbables[i];
744
- element.setAttribute('tabIndex', '-1');
745
- element.setAttribute('data-datagrid-interactable', 'true');
746
- }
747
- }
748
- });
749
- _defineProperty(_assertThisInitialized(_this), "enableTabbing", function () {
750
- if (_this.cellContentsRef) {
751
- var interactables = _this.getInteractables();
752
- for (var i = 0; i < interactables.length; i++) {
753
- var element = interactables[i];
754
- element.removeAttribute('tabIndex');
755
- }
756
- }
757
- });
758
685
  _defineProperty(_assertThisInitialized(_this), "setCellTextAlign", function () {
759
686
  if (_this.cellContentsRef) {
760
687
  var columnType = _this.props.columnType;
@@ -807,14 +734,14 @@ export var EuiDataGridCell = /*#__PURE__*/function (_Component) {
807
734
  setPopoverAnchorPosition("down".concat(_this.state.cellTextAlign));
808
735
 
809
736
  // Set popover contents with cell content
810
- var _this$props6 = _this.props,
811
- renderCellPopover = _this$props6.renderCellPopover,
812
- renderCellValue = _this$props6.renderCellValue,
813
- rowIndex = _this$props6.rowIndex,
814
- colIndex = _this$props6.colIndex,
815
- column = _this$props6.column,
816
- columnId = _this$props6.columnId,
817
- columnType = _this$props6.columnType;
737
+ var _this$props5 = _this.props,
738
+ renderCellPopover = _this$props5.renderCellPopover,
739
+ renderCellValue = _this$props5.renderCellValue,
740
+ rowIndex = _this$props5.rowIndex,
741
+ colIndex = _this$props5.colIndex,
742
+ column = _this$props5.column,
743
+ columnId = _this$props5.columnId,
744
+ columnType = _this$props5.columnType;
818
745
  var PopoverElement = renderCellPopover || DefaultCellPopover;
819
746
  var CellElement = renderCellValue;
820
747
  var sharedProps = {
@@ -839,14 +766,59 @@ export var EuiDataGridCell = /*#__PURE__*/function (_Component) {
839
766
  setPopoverContent(popoverContent);
840
767
  }
841
768
  });
769
+ _defineProperty(_assertThisInitialized(_this), "handleCellKeyDown", function (event) {
770
+ if (_this.isExpandable()) {
771
+ if (_this.isPopoverOpen()) return;
772
+ var _this$props6 = _this.props,
773
+ openCellPopover = _this$props6.popoverContext.openCellPopover,
774
+ visibleRowIndex = _this$props6.visibleRowIndex,
775
+ colIndex = _this$props6.colIndex;
776
+ switch (event.key) {
777
+ case keys.ENTER:
778
+ case keys.F2:
779
+ event.preventDefault();
780
+ openCellPopover({
781
+ rowIndex: visibleRowIndex,
782
+ colIndex: colIndex
783
+ });
784
+ break;
785
+ }
786
+ }
787
+ });
788
+ _defineProperty(_assertThisInitialized(_this), "handleCellExpansionClick", function () {
789
+ var _this$props7 = _this.props,
790
+ _this$props7$popoverC = _this$props7.popoverContext,
791
+ openCellPopover = _this$props7$popoverC.openCellPopover,
792
+ closeCellPopover = _this$props7$popoverC.closeCellPopover,
793
+ visibleRowIndex = _this$props7.visibleRowIndex,
794
+ colIndex = _this$props7.colIndex;
795
+ if (_this.isPopoverOpen()) {
796
+ closeCellPopover();
797
+ } else {
798
+ openCellPopover({
799
+ rowIndex: visibleRowIndex,
800
+ colIndex: colIndex
801
+ });
802
+ }
803
+ });
804
+ _defineProperty(_assertThisInitialized(_this), "onMouseEnter", function () {
805
+ return _this.setState({
806
+ isHovered: true
807
+ });
808
+ });
809
+ _defineProperty(_assertThisInitialized(_this), "onMouseLeave", function () {
810
+ return _this.setState({
811
+ isHovered: false
812
+ });
813
+ });
842
814
  return _this;
843
815
  }
844
816
  _createClass(EuiDataGridCell, [{
845
817
  key: "componentDidMount",
846
818
  value: function componentDidMount() {
847
- var _this$props7 = this.props,
848
- colIndex = _this$props7.colIndex,
849
- visibleRowIndex = _this$props7.visibleRowIndex;
819
+ var _this$props8 = this.props,
820
+ colIndex = _this$props8.colIndex,
821
+ visibleRowIndex = _this$props8.visibleRowIndex;
850
822
  this.unsubscribeCell = this.context.onFocusUpdate([colIndex, visibleRowIndex], this.onFocusUpdate);
851
823
 
852
824
  // Account for virtualization - when a cell unmounts when scrolled out of view
@@ -865,7 +837,6 @@ export var EuiDataGridCell = /*#__PURE__*/function (_Component) {
865
837
  }, {
866
838
  key: "componentWillUnmount",
867
839
  value: function componentWillUnmount() {
868
- window.clearTimeout(this.focusTimeout);
869
840
  if (this.unsubscribeCell) {
870
841
  this.unsubscribeCell();
871
842
  }
@@ -932,39 +903,33 @@ export var EuiDataGridCell = /*#__PURE__*/function (_Component) {
932
903
  if (nextProps.style.width !== this.props.style.width) return true;
933
904
  }
934
905
  if (nextState.cellProps !== this.state.cellProps) return true;
935
- if (nextState.isEntered !== this.state.isEntered) return true;
936
906
  if (nextState.isFocused !== this.state.isFocused) return true;
937
- if (nextState.enableInteractions !== this.state.enableInteractions) return true;
938
- if (nextState.disableCellTabIndex !== this.state.disableCellTabIndex) return true;
907
+ if (nextState.isHovered !== this.state.isHovered) return true;
939
908
  return false;
940
909
  }
941
910
  }, {
942
911
  key: "render",
943
912
  value: function render() {
944
- var _classNames,
945
- _rowHeightsOptions$li,
946
- _this2 = this;
947
- var _this$props8 = this.props,
948
- width = _this$props8.width,
949
- _this$props8$popoverC = _this$props8.popoverContext,
950
- closeCellPopover = _this$props8$popoverC.closeCellPopover,
951
- openCellPopover = _this$props8$popoverC.openCellPopover,
952
- interactiveCellId = _this$props8.interactiveCellId,
953
- columnType = _this$props8.columnType,
954
- className = _this$props8.className,
955
- column = _this$props8.column,
956
- style = _this$props8.style,
957
- rowHeightUtils = _this$props8.rowHeightUtils,
958
- rowHeightsOptions = _this$props8.rowHeightsOptions,
959
- rowManager = _this$props8.rowManager,
960
- pagination = _this$props8.pagination,
961
- rest = _objectWithoutProperties(_this$props8, _excluded2);
913
+ var _classNames, _rowHeightsOptions$li;
914
+ var _this$props9 = this.props,
915
+ width = _this$props9.width,
916
+ popoverContext = _this$props9.popoverContext,
917
+ interactiveCellId = _this$props9.interactiveCellId,
918
+ columnType = _this$props9.columnType,
919
+ className = _this$props9.className,
920
+ column = _this$props9.column,
921
+ style = _this$props9.style,
922
+ rowHeightUtils = _this$props9.rowHeightUtils,
923
+ rowHeightsOptions = _this$props9.rowHeightsOptions,
924
+ rowManager = _this$props9.rowManager,
925
+ pagination = _this$props9.pagination,
926
+ rest = _objectWithoutProperties(_this$props9, _excluded2);
962
927
  var rowIndex = rest.rowIndex,
963
928
  visibleRowIndex = rest.visibleRowIndex,
964
929
  colIndex = rest.colIndex;
965
930
  var isExpandable = this.isExpandable();
966
931
  var popoverIsOpen = this.isPopoverOpen();
967
- var showCellActions = this.state.isFocused || this.state.isEntered || this.state.enableInteractions || popoverIsOpen;
932
+ var showCellActions = isExpandable && (popoverIsOpen || this.state.isFocused || this.state.isHovered);
968
933
  var cellClasses = classNames('euiDataGridRowCell', "euiDataGridRowCell--align".concat(this.state.cellTextAlign), (_classNames = {}, _defineProperty(_classNames, "euiDataGridRowCell--".concat(columnType), columnType), _defineProperty(_classNames, 'euiDataGridRowCell--open', popoverIsOpen), _classNames), className);
969
934
  var ariaRowIndex = pagination ? visibleRowIndex + 1 + pagination.pageSize * pagination.pageIndex : visibleRowIndex + 1;
970
935
  var _this$state$cellProps2 = this.state.cellProps,
@@ -985,68 +950,6 @@ export var EuiDataGridCell = /*#__PURE__*/function (_Component) {
985
950
  // column width, can be undefined
986
951
  lineHeight: (_rowHeightsOptions$li = rowHeightsOptions === null || rowHeightsOptions === void 0 ? void 0 : rowHeightsOptions.lineHeight) !== null && _rowHeightsOptions$li !== void 0 ? _rowHeightsOptions$li : undefined
987
952
  }, cellPropsStyle);
988
- var handleCellKeyDown = function handleCellKeyDown(event) {
989
- if (isExpandable) {
990
- if (popoverIsOpen) {
991
- return;
992
- }
993
- switch (event.key) {
994
- case keys.ENTER:
995
- case keys.F2:
996
- event.preventDefault();
997
- openCellPopover({
998
- rowIndex: visibleRowIndex,
999
- colIndex: colIndex
1000
- });
1001
- break;
1002
- }
1003
- } else {
1004
- if (event.key === keys.ENTER || event.key === keys.F2 || event.key === keys.ESCAPE) {
1005
- var interactables = _this2.getInteractables();
1006
- if (interactables.length >= 2) {
1007
- switch (event.key) {
1008
- case keys.ENTER:
1009
- // `Enter` only activates the trap
1010
- if (_this2.state.isEntered === false) {
1011
- _this2.enableTabbing();
1012
- _this2.setState({
1013
- isEntered: true
1014
- });
1015
-
1016
- // result of this keypress is focus shifts to the first interactive element
1017
- // and then the browser fires the onClick event because that's how [Enter] works
1018
- // so we need to prevent that default action otherwise entering the trap triggers the first element
1019
- event.preventDefault();
1020
- }
1021
- break;
1022
- case keys.F2:
1023
- // toggle interactives' focus trap
1024
- _this2.setState(function (_ref2) {
1025
- var isEntered = _ref2.isEntered;
1026
- if (isEntered) {
1027
- _this2.preventTabbing();
1028
- } else {
1029
- _this2.enableTabbing();
1030
- }
1031
- return {
1032
- isEntered: !isEntered
1033
- };
1034
- });
1035
- break;
1036
- case keys.ESCAPE:
1037
- // `Escape` only de-activates the trap
1038
- _this2.preventTabbing();
1039
- if (_this2.state.isEntered === true) {
1040
- _this2.setState({
1041
- isEntered: false
1042
- });
1043
- }
1044
- break;
1045
- }
1046
- }
1047
- }
1048
- }
1049
- };
1050
953
  var rowHeight = rowHeightUtils === null || rowHeightUtils === void 0 ? void 0 : rowHeightUtils.getRowHeightOption(rowIndex, rowHeightsOptions);
1051
954
  var cellContentProps = _objectSpread(_objectSpread({}, rest), {}, {
1052
955
  setCellProps: this.setCellProps,
@@ -1062,40 +965,10 @@ export var EuiDataGridCell = /*#__PURE__*/function (_Component) {
1062
965
  isControlColumn: cellClasses.includes('euiDataGridRowCell--controlColumn'),
1063
966
  ariaRowIndex: ariaRowIndex
1064
967
  });
1065
- var cellActions = showCellActions && ___EmotionJSX(React.Fragment, null, ___EmotionJSX(EuiDataGridCellActions, {
1066
- rowIndex: rowIndex,
1067
- colIndex: colIndex,
1068
- column: column,
1069
- onExpandClick: function onExpandClick() {
1070
- if (popoverIsOpen) {
1071
- closeCellPopover();
1072
- } else {
1073
- openCellPopover({
1074
- rowIndex: visibleRowIndex,
1075
- colIndex: colIndex
1076
- });
1077
- }
1078
- }
1079
- }), ___EmotionJSX("div", {
1080
- ref: this.popoverAnchorRef,
1081
- "data-test-subject": "cellPopoverAnchor"
1082
- }));
1083
- var cellContent = isExpandable ? ___EmotionJSX(EuiDataGridCellContent, _extends({}, cellContentProps, {
1084
- cellActions: cellActions
1085
- })) : ___EmotionJSX(EuiFocusTrap, {
1086
- disabled: !this.state.isEntered,
1087
- autoFocus: true,
1088
- onDeactivation: function onDeactivation() {
1089
- _this2.setState({
1090
- isEntered: false
1091
- }, _this2.preventTabbing);
1092
- },
1093
- clickOutsideDisables: true
1094
- }, ___EmotionJSX(EuiDataGridCellContent, cellContentProps));
1095
968
  var cell = ___EmotionJSX("div", _extends({
1096
969
  role: "gridcell",
1097
970
  "aria-rowindex": ariaRowIndex,
1098
- tabIndex: this.state.isFocused && !this.state.disableCellTabIndex ? 0 : -1,
971
+ tabIndex: this.state.isFocused ? 0 : -1,
1099
972
  ref: this.cellRef
1100
973
  }, cellProps, {
1101
974
  "data-test-subj": "dataGridRowCell"
@@ -1109,20 +982,24 @@ export var EuiDataGridCell = /*#__PURE__*/function (_Component) {
1109
982
  ,
1110
983
  "data-gridcell-visible-row-index": this.props.visibleRowIndex // Affected by sorting & pagination
1111
984
  ,
1112
- onKeyDown: handleCellKeyDown,
1113
- onFocus: this.onFocus,
1114
- onMouseEnter: function onMouseEnter() {
1115
- _this2.setState({
1116
- enableInteractions: true
1117
- });
1118
- },
1119
- onMouseLeave: function onMouseLeave() {
1120
- _this2.setState({
1121
- enableInteractions: false
1122
- });
1123
- },
1124
- onBlur: this.onBlur
1125
- }), cellContent);
985
+ onKeyDown: this.handleCellKeyDown,
986
+ onMouseEnter: this.onMouseEnter,
987
+ onMouseLeave: this.onMouseLeave
988
+ }), ___EmotionJSX(HandleInteractiveChildren, {
989
+ cellEl: this.cellRef.current,
990
+ updateCellFocusContext: this.updateCellFocusContext,
991
+ renderFocusTrap: !isExpandable
992
+ }, ___EmotionJSX(EuiDataGridCellContent, _extends({}, cellContentProps, {
993
+ cellActions: showCellActions && ___EmotionJSX(React.Fragment, null, ___EmotionJSX(EuiDataGridCellActions, {
994
+ rowIndex: rowIndex,
995
+ colIndex: colIndex,
996
+ column: column,
997
+ onExpandClick: this.handleCellExpansionClick
998
+ }), ___EmotionJSX("div", {
999
+ ref: this.popoverAnchorRef,
1000
+ "data-test-subject": "cellPopoverAnchor"
1001
+ }))
1002
+ }))));
1126
1003
  return rowManager && !IS_JEST_ENVIRONMENT ? /*#__PURE__*/createPortal(cell, rowManager.getRow({
1127
1004
  rowIndex: rowIndex,
1128
1005
  visibleRowIndex: visibleRowIndex,
@@ -1134,16 +1011,6 @@ export var EuiDataGridCell = /*#__PURE__*/function (_Component) {
1134
1011
  }]);
1135
1012
  return EuiDataGridCell;
1136
1013
  }(Component);
1137
- // focus tracking is split between the entire grid & individual cells,
1138
- // the parent grid owns which cell is focused,
1139
- // but individual cells need to react to changes and also report that
1140
- // they are focused in response to user actions like clicking on the cell
1141
- // to avoid focus trap fighting, cells wait a tick after being clicked to allow
1142
- // any existing traps to disconnect before the cell reports the new focus state to the parent grid
1143
- // but because of this small delay, multiple cells could queue up focus and
1144
- // create an infinite loop as the cells activate->deactivate->...
1145
- // so we track the last timeout id and clear that request if superseded
1146
- _defineProperty(EuiDataGridCell, "activeFocusTimeoutId", undefined);
1147
1014
  _defineProperty(EuiDataGridCell, "contextType", DataGridFocusContext);
1148
1015
  EuiDataGridCell.propTypes = {
1149
1016
  rowIndex: PropTypes.number.isRequired,
@@ -18,11 +18,11 @@ function _extends() { _extends = Object.assign ? Object.assign.bind() : function
18
18
  */
19
19
 
20
20
  import React, { useMemo, useCallback } from 'react';
21
- import { EuiI18n } from '../../i18n';
22
- import { EuiButtonIcon } from '../../button/button_icon';
23
- import { EuiButtonEmpty } from '../../button/button_empty';
24
- import { EuiFlexGroup, EuiFlexItem } from '../../flex';
25
- import { EuiPopoverFooter } from '../../popover';
21
+ import { EuiI18n } from '../../../i18n';
22
+ import { EuiButtonIcon } from '../../../button/button_icon';
23
+ import { EuiButtonEmpty } from '../../../button/button_empty';
24
+ import { EuiFlexGroup, EuiFlexItem } from '../../../flex';
25
+ import { EuiPopoverFooter } from '../../../popover';
26
26
  import { jsx as ___EmotionJSX } from "@emotion/react";
27
27
  export var EuiDataGridCellActions = function EuiDataGridCellActions(_ref) {
28
28
  var onExpandClick = _ref.onExpandClick,
@@ -21,8 +21,8 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
21
21
 
22
22
  import React, { createContext, useState, useCallback } from 'react';
23
23
  import classNames from 'classnames';
24
- import { keys } from '../../../services';
25
- import { EuiWrappingPopover } from '../../popover';
24
+ import { keys } from '../../../../services';
25
+ import { EuiWrappingPopover } from '../../../popover';
26
26
  export var DataGridCellPopoverContext = /*#__PURE__*/createContext({
27
27
  popoverIsOpen: false,
28
28
  cellLocation: {
@@ -160,8 +160,8 @@ export var useCellPopover = function useCellPopover() {
160
160
  /**
161
161
  * Popover content renderers
162
162
  */
163
- import { EuiText } from '../../text';
164
- import { EuiCodeBlock } from '../../code';
163
+ import { EuiText } from '../../../text';
164
+ import { EuiCodeBlock } from '../../../code';
165
165
  import { jsx as ___EmotionJSX } from "@emotion/react";
166
166
  export var DefaultCellPopover = function DefaultCellPopover(_ref2) {
167
167
  var schema = _ref2.schema,
@@ -16,7 +16,7 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
16
16
 
17
17
  import React, { useContext, useMemo } from 'react';
18
18
  import classNames from 'classnames';
19
- import { DataGridSortingContext } from '../utils/sorting';
19
+ import { DataGridSortingContext } from '../../utils/sorting';
20
20
  import { DataGridCellPopoverContext } from './data_grid_cell_popover';
21
21
  import { EuiDataGridCell } from './data_grid_cell';
22
22
  import { jsx as ___EmotionJSX } from "@emotion/react";